From 7deb5cc2665c5549a8ac6e53c6ff049207b56877 Mon Sep 17 00:00:00 2001 From: support Date: Thu, 7 Apr 2022 13:35:44 +0000 Subject: [PATCH] Built motion from commit e2d2a7e0.|2.6.7 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage.events.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 +- server/api/client-side-logs.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.oauth.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 +- .../cmContactHasItem.attributes.js | 2 +- .../cmContactHasItem.controller.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.model.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.rpc.js | 2 +- server/api/cmContactHasItem/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 +- .../cmHopperAdditionalPhone.attributes.js | 2 +- .../cmHopperAdditionalPhone.controller.js | 2 +- .../cmHopperAdditionalPhone.model.js | 2 +- .../cmHopperAdditionalPhone.rpc.js | 2 +- server/api/cmHopperAdditionalPhone/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 +- .../contactItemType/contactItemType.attributes.js | 2 +- .../contactItemType/contactItemType.controller.js | 2 +- .../api/contactItemType/contactItemType.model.js | 2 +- server/api/contactItemType/contactItemType.rpc.js | 2 +- server/api/contactItemType/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user-setting/index.js | 2 +- server/api/user-setting/user-setting.attributes.js | 2 +- server/api/user-setting/user-setting.controller.js | 2 +- server/api/user-setting/user-setting.events.js | 2 +- server/api/user-setting/user-setting.model.js | 2 +- server/api/user-setting/user-setting.socket.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.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/cloud-provider.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/api.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/events.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/project.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/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/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/tvox.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- server/utils/client-side-logger.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- 1188 files changed, 1188 insertions(+), 1188 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 93e1a14..7b5b263 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-07T13:13:34.809Z", + "time": "2022-04-07T13:27:51.809Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9feaf87..217434c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-07T13:13:34.809Z", + "time": "2022-04-07T13:27:51.809Z", "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 d828211..c7209be 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 _0x07d6=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty','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]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x4707a3,_0x106fd8){var _0x33dc9b=function(_0x35f934){while(--_0x35f934){_0x4707a3['push'](_0x4707a3['shift']());}};_0x33dc9b(++_0x106fd8);}(_0x07d6,0x1f2));var _0x607d=function(_0x548c66,_0x4ea9b6){_0x548c66=_0x548c66-0x0;var _0x48b69d=_0x07d6[_0x548c66];return _0x48b69d;};'use strict';var Sequelize=require('sequelize');module[_0x607d('0x0')]={'name':{'type':Sequelize[_0x607d('0x1')],'get':function(_0x37be81){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x607d('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x607d('0x3'),_0x607d('0x4'),_0x607d('0x5'),_0x607d('0x6'),_0x607d('0x7'),_0x607d('0x8'),_0x607d('0x9'),_0x607d('0xa')]],'msg':_0x607d('0xb')}},'comment':_0x607d('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x607d('0xc')},'data2':{'type':Sequelize[_0x607d('0x2')](0x1000),'comment':_0x607d('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x607d('0xe')},'data4':{'type':Sequelize[_0x607d('0x2')](0x1000),'comments':_0x607d('0xf')},'data5':{'type':Sequelize[_0x607d('0x2')](0x1000),'comments':_0x607d('0x10')},'data6':{'type':Sequelize[_0x607d('0x2')],'comments':_0x607d('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0x607d('0x12')}}; \ No newline at end of file +var _0xf430=['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[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty'];(function(_0x21929f,_0xb96182){var _0x1a6077=function(_0x209786){while(--_0x209786){_0x21929f['push'](_0x21929f['shift']());}};_0x1a6077(++_0xb96182);}(_0xf430,0x102));var _0x0f43=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xf430[_0x4e93a9];return _0x43013c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0f43('0x0')],'get':function(_0x3cf97f){return this[_0x0f43('0x1')](_0x0f43('0x2'));}},'action':{'type':Sequelize[_0x0f43('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0f43('0x4'),_0x0f43('0x5'),_0x0f43('0x6'),_0x0f43('0x7'),_0x0f43('0x8'),_0x0f43('0x9'),_0x0f43('0xa'),_0x0f43('0xb')]],'msg':_0x0f43('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x0f43('0x3')](0x1000),'comment':_0x0f43('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x0f43('0xe')},'data4':{'type':Sequelize[_0x0f43('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x0f43('0x3')](0x1000),'comments':_0x0f43('0xf')},'data6':{'type':Sequelize[_0x0f43('0x3')],'comments':_0x0f43('0x10')},'data7':{'type':Sequelize[_0x0f43('0x11')],'comments':_0x0f43('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9b6bbd2..b59bf6c 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 _0x904e=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','save','update','then','destroy','error','stack','name','send','body','Action','catch','find','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x904e,0x1a3));var _0xe904=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x904e[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe904('0x0'));var jsonpatch=require(_0xe904('0x1'));var rp=require('request-promise');var moment=require(_0xe904('0x2'));var BPromise=require(_0xe904('0x3'));var Mustache=require(_0xe904('0x4'));var util=require(_0xe904('0x5'));var path=require(_0xe904('0x6'));var sox=require(_0xe904('0x7'));var csv=require(_0xe904('0x8'));var ejs=require(_0xe904('0x9'));var fs=require('fs');var fs_extra=require(_0xe904('0xa'));var _=require(_0xe904('0xb'));var squel=require(_0xe904('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe904('0xd'));var toCsv=require(_0xe904('0x8'));var querystring=require(_0xe904('0xe'));var Papa=require(_0xe904('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe904('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe904('0x11'))(_0xe904('0x12'));var utils=require('../../config/utils');var config=require(_0xe904('0x13'));var licenseUtil=require(_0xe904('0x14'));var db=require(_0xe904('0x15'))['db'];function respondWithStatusCode(_0x312275,_0x1e0d23){_0x1e0d23=_0x1e0d23||0xcc;return function(_0xa94c7d){if(_0xa94c7d){return _0x312275[_0xe904('0x16')](_0x1e0d23);}return _0x312275[_0xe904('0x17')](_0x1e0d23)[_0xe904('0x18')]();};}function respondWithResult(_0xddf6f0,_0x17aaf2){_0x17aaf2=_0x17aaf2||0xc8;return function(_0x3514d1){if(_0x3514d1){return _0xddf6f0[_0xe904('0x17')](_0x17aaf2)[_0xe904('0x19')](_0x3514d1);}};}function respondWithFilteredResult(_0x3217fd,_0x1f0e9b){return function(_0xffc9d8){if(_0xffc9d8){var _0x5aaef1=typeof _0x1f0e9b['offset']==='undefined'&&typeof _0x1f0e9b[_0xe904('0x1a')]===_0xe904('0x1b');var _0x90b468=_0xffc9d8[_0xe904('0x1c')];var _0x299342=_0x5aaef1?0x0:_0x1f0e9b[_0xe904('0x1d')];var _0x4dc97f=_0x5aaef1?_0xffc9d8[_0xe904('0x1c')]:_0x1f0e9b[_0xe904('0x1d')]+_0x1f0e9b[_0xe904('0x1a')];var _0x466d87;if(_0x4dc97f>=_0x90b468){_0x4dc97f=_0x90b468;_0x466d87=0xc8;}else{_0x466d87=0xce;}_0x3217fd[_0xe904('0x17')](_0x466d87);return _0x3217fd[_0xe904('0x1e')]('Content-Range',_0x299342+'-'+_0x4dc97f+'/'+_0x90b468)['json'](_0xffc9d8);}return null;};}function patchUpdates(_0x3455fc){return function(_0x145f92){try{jsonpatch['apply'](_0x145f92,_0x3455fc,!![]);}catch(_0x1ec233){return BPromise['reject'](_0x1ec233);}return _0x145f92[_0xe904('0x1f')]();};}function saveUpdates(_0x3421a2,_0x1ca40f){return function(_0x1a8cf7){if(_0x1a8cf7){return _0x1a8cf7[_0xe904('0x20')](_0x3421a2)[_0xe904('0x21')](function(_0x1c15a8){return _0x1c15a8;});}return null;};}function removeEntity(_0x40815f,_0xd82187){return function(_0x2151ab){if(_0x2151ab){return _0x2151ab[_0xe904('0x22')]()[_0xe904('0x21')](function(){_0x40815f[_0xe904('0x17')](0xcc)[_0xe904('0x18')]();});}};}function handleEntityNotFound(_0x4f5bfe,_0x4acb8e){return function(_0x379c76){if(!_0x379c76){_0x4f5bfe[_0xe904('0x16')](0x194);}return _0x379c76;};}function handleError(_0x2c4c76,_0x158d3d){_0x158d3d=_0x158d3d||0x1f4;return function(_0x5b76b1){logger[_0xe904('0x23')](_0x5b76b1[_0xe904('0x24')]);if(_0x5b76b1[_0xe904('0x25')]){delete _0x5b76b1['name'];}_0x2c4c76['status'](_0x158d3d)[_0xe904('0x26')](_0x5b76b1);};}exports[_0xe904('0x20')]=function(_0x539873,_0xb58c2c){if(_0x539873['body']['id']){delete _0x539873[_0xe904('0x27')]['id'];}return db[_0xe904('0x28')]['find']({'where':{'id':_0x539873['params']['id']}})[_0xe904('0x21')](handleEntityNotFound(_0xb58c2c,null))['then'](saveUpdates(_0x539873[_0xe904('0x27')],null))[_0xe904('0x21')](respondWithResult(_0xb58c2c,null))[_0xe904('0x29')](handleError(_0xb58c2c,null));};exports[_0xe904('0x22')]=function(_0x2770b0,_0x4df979){return db[_0xe904('0x28')][_0xe904('0x2a')]({'where':{'id':_0x2770b0[_0xe904('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4df979,null))['then'](removeEntity(_0x4df979,null))[_0xe904('0x29')](handleError(_0x4df979,null));}; \ No newline at end of file +var _0x8e7c=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','error','name','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x40e7b3,_0x23a8e7){var _0x2cfb20=function(_0x4cb603){while(--_0x4cb603){_0x40e7b3['push'](_0x40e7b3['shift']());}};_0x2cfb20(++_0x23a8e7);}(_0x8e7c,0x81));var _0xc8e7=function(_0x2a8d5e,_0x1c3bca){_0x2a8d5e=_0x2a8d5e-0x0;var _0x1d30e6=_0x8e7c[_0x2a8d5e];return _0x1d30e6;};'use strict';var emlformat=require(_0xc8e7('0x0'));var rimraf=require(_0xc8e7('0x1'));var zipdir=require(_0xc8e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8e7('0x3'));var moment=require(_0xc8e7('0x4'));var BPromise=require(_0xc8e7('0x5'));var Mustache=require('mustache');var util=require(_0xc8e7('0x6'));var path=require(_0xc8e7('0x7'));var sox=require(_0xc8e7('0x8'));var csv=require(_0xc8e7('0x9'));var ejs=require(_0xc8e7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8e7('0xb'));var crypto=require(_0xc8e7('0xc'));var jsforce=require(_0xc8e7('0xd'));var deskjs=require(_0xc8e7('0xe'));var toCsv=require(_0xc8e7('0x9'));var querystring=require(_0xc8e7('0xf'));var Papa=require(_0xc8e7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc8e7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8e7('0x12'));var logger=require(_0xc8e7('0x13'))(_0xc8e7('0x14'));var utils=require(_0xc8e7('0x15'));var config=require(_0xc8e7('0x16'));var licenseUtil=require(_0xc8e7('0x17'));var db=require(_0xc8e7('0x18'))['db'];function respondWithStatusCode(_0x496eb6,_0x251a6d){_0x251a6d=_0x251a6d||0xcc;return function(_0x39b1d0){if(_0x39b1d0){return _0x496eb6[_0xc8e7('0x19')](_0x251a6d);}return _0x496eb6[_0xc8e7('0x1a')](_0x251a6d)[_0xc8e7('0x1b')]();};}function respondWithResult(_0x263ed8,_0x10aaed){_0x10aaed=_0x10aaed||0xc8;return function(_0x582161){if(_0x582161){return _0x263ed8[_0xc8e7('0x1a')](_0x10aaed)[_0xc8e7('0x1c')](_0x582161);}};}function respondWithFilteredResult(_0x2751fc,_0x393634){return function(_0x4fb934){if(_0x4fb934){var _0xccf6d7=typeof _0x393634[_0xc8e7('0x1d')]===_0xc8e7('0x1e')&&typeof _0x393634['limit']===_0xc8e7('0x1e');var _0x1cc699=_0x4fb934['count'];var _0x50aa0f=_0xccf6d7?0x0:_0x393634[_0xc8e7('0x1d')];var _0x310d5e=_0xccf6d7?_0x4fb934[_0xc8e7('0x1f')]:_0x393634[_0xc8e7('0x1d')]+_0x393634[_0xc8e7('0x20')];var _0x34f570;if(_0x310d5e>=_0x1cc699){_0x310d5e=_0x1cc699;_0x34f570=0xc8;}else{_0x34f570=0xce;}_0x2751fc[_0xc8e7('0x1a')](_0x34f570);return _0x2751fc['set'](_0xc8e7('0x21'),_0x50aa0f+'-'+_0x310d5e+'/'+_0x1cc699)[_0xc8e7('0x1c')](_0x4fb934);}return null;};}function patchUpdates(_0x275ac8){return function(_0x445389){try{jsonpatch[_0xc8e7('0x22')](_0x445389,_0x275ac8,!![]);}catch(_0x54076c){return BPromise['reject'](_0x54076c);}return _0x445389['save']();};}function saveUpdates(_0x3f21ea,_0x207fdd){return function(_0x19824a){if(_0x19824a){return _0x19824a['update'](_0x3f21ea)[_0xc8e7('0x23')](function(_0x282dd7){return _0x282dd7;});}return null;};}function removeEntity(_0x59307f,_0x185c5e){return function(_0x2c478b){if(_0x2c478b){return _0x2c478b[_0xc8e7('0x24')]()['then'](function(){_0x59307f[_0xc8e7('0x1a')](0xcc)[_0xc8e7('0x1b')]();});}};}function handleEntityNotFound(_0x4e5412,_0x53a883){return function(_0x131d1e){if(!_0x131d1e){_0x4e5412[_0xc8e7('0x19')](0x194);}return _0x131d1e;};}function handleError(_0x1b9276,_0x361695){_0x361695=_0x361695||0x1f4;return function(_0x1f4392){logger[_0xc8e7('0x25')](_0x1f4392['stack']);if(_0x1f4392[_0xc8e7('0x26')]){delete _0x1f4392['name'];}_0x1b9276[_0xc8e7('0x1a')](_0x361695)['send'](_0x1f4392);};}exports[_0xc8e7('0x27')]=function(_0x116668,_0x43f172){if(_0x116668['body']['id']){delete _0x116668[_0xc8e7('0x28')]['id'];}return db[_0xc8e7('0x29')][_0xc8e7('0x2a')]({'where':{'id':_0x116668[_0xc8e7('0x2b')]['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x43f172,null))[_0xc8e7('0x23')](saveUpdates(_0x116668[_0xc8e7('0x28')],null))[_0xc8e7('0x23')](respondWithResult(_0x43f172,null))['catch'](handleError(_0x43f172,null));};exports[_0xc8e7('0x24')]=function(_0x37712f,_0x5edd50){return db[_0xc8e7('0x29')][_0xc8e7('0x2a')]({'where':{'id':_0x37712f[_0xc8e7('0x2b')]['id']}})[_0xc8e7('0x23')](handleEntityNotFound(_0x5edd50,null))[_0xc8e7('0x23')](removeEntity(_0x5edd50,null))[_0xc8e7('0x2c')](handleError(_0x5edd50,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c3d8555..967e57e 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 _0x24ad=['Action','tools_actions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define'];(function(_0x48e823,_0x4a57dd){var _0x2934ad=function(_0x296bcf){while(--_0x296bcf){_0x48e823['push'](_0x48e823['shift']());}};_0x2934ad(++_0x4a57dd);}(_0x24ad,0xf2));var _0xd24a=function(_0x2acb47,_0x565dbe){_0x2acb47=_0x2acb47-0x0;var _0xab9951=_0x24ad[_0x2acb47];return _0xab9951;};'use strict';var _=require(_0xd24a('0x0'));var util=require('util');var logger=require(_0xd24a('0x1'))('api');var moment=require(_0xd24a('0x2'));var BPromise=require(_0xd24a('0x3'));var rp=require(_0xd24a('0x4'));var fs=require('fs');var path=require(_0xd24a('0x5'));var rimraf=require(_0xd24a('0x6'));var config=require(_0xd24a('0x7'));var attributes=require(_0xd24a('0x8'));module['exports']=function(_0xa64a05,_0x18ce8d){return _0xa64a05[_0xd24a('0x9')](_0xd24a('0xa'),attributes,{'tableName':_0xd24a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b42=['request-promise','path','rimraf','../../config/environment','exports','define','lodash','moment','bluebird'];(function(_0x433108,_0x16ee0c){var _0x19de8e=function(_0xba76aa){while(--_0xba76aa){_0x433108['push'](_0x433108['shift']());}};_0x19de8e(++_0x16ee0c);}(_0x8b42,0x15c));var _0x28b4=function(_0x3f0b8a,_0x578b56){_0x3f0b8a=_0x3f0b8a-0x0;var _0x3fceba=_0x8b42[_0x3f0b8a];return _0x3fceba;};'use strict';var _=require(_0x28b4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x28b4('0x1'));var BPromise=require(_0x28b4('0x2'));var rp=require(_0x28b4('0x3'));var fs=require('fs');var path=require(_0x28b4('0x4'));var rimraf=require(_0x28b4('0x5'));var config=require(_0x28b4('0x6'));var attributes=require('./action.attributes');module[_0x28b4('0x7')]=function(_0x38e1d3,_0x165728){return _0x38e1d3[_0x28b4('0x8')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 9eaabe7..e269473 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x4975,0x86));var _0x5497=function(_0x10b21f,_0x3cd561){_0x10b21f=_0x10b21f-0x0;var _0x371a86=_0x4975[_0x10b21f];return _0x371a86;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5c1531,_0x3780d7){var _0x3690c9=function(_0x1b135e){while(--_0x1b135e){_0x5c1531['push'](_0x5c1531['shift']());}};_0x3690c9(++_0x3780d7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index ee168bb..81f6807 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 _0x47f9=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','destroy','exports'];(function(_0x42796f,_0x249394){var _0x20de26=function(_0x1a1f62){while(--_0x1a1f62){_0x42796f['push'](_0x42796f['shift']());}};_0x20de26(++_0x249394);}(_0x47f9,0x70));var _0x947f=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0x47f9[_0x5c1930];return _0x163a34;};'use strict';var multer=require('multer');var util=require(_0x947f('0x0'));var path=require(_0x947f('0x1'));var timeout=require('connect-timeout');var express=require(_0x947f('0x2'));var router=express[_0x947f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x947f('0x4'));var interaction=require(_0x947f('0x5'));var config=require(_0x947f('0x6'));var controller=require(_0x947f('0x7'));router[_0x947f('0x8')](_0x947f('0x9'),auth['isAuthenticated'](),controller[_0x947f('0xa')]);router[_0x947f('0xb')](_0x947f('0x9'),auth['isAuthenticated'](),controller[_0x947f('0xc')]);module[_0x947f('0xd')]=router; \ No newline at end of file +var _0xe1dc=['../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x598af4,_0x24a0e9){var _0x222213=function(_0x41bdd7){while(--_0x41bdd7){_0x598af4['push'](_0x598af4['shift']());}};_0x222213(++_0x24a0e9);}(_0xe1dc,0xd8));var _0xce1d=function(_0x5f0131,_0x3604f8){_0x5f0131=_0x5f0131-0x0;var _0x5c3a57=_0xe1dc[_0x5f0131];return _0x5c3a57;};'use strict';var multer=require('multer');var util=require(_0xce1d('0x0'));var path=require(_0xce1d('0x1'));var timeout=require(_0xce1d('0x2'));var express=require(_0xce1d('0x3'));var router=express[_0xce1d('0x4')]();var fs_extra=require(_0xce1d('0x5'));var auth=require(_0xce1d('0x6'));var interaction=require(_0xce1d('0x7'));var config=require(_0xce1d('0x8'));var controller=require(_0xce1d('0x9'));router[_0xce1d('0xa')](_0xce1d('0xb'),auth['isAuthenticated'](),controller[_0xce1d('0xc')]);router['delete'](_0xce1d('0xb'),auth[_0xce1d('0xd')](),controller[_0xce1d('0xe')]);module[_0xce1d('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 54d60f8..e705a54 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 _0xda19=['exports','STRING','TEXT'];(function(_0x4f40fb,_0x3756ca){var _0x341d94=function(_0x32e26c){while(--_0x32e26c){_0x4f40fb['push'](_0x4f40fb['shift']());}};_0x341d94(++_0x3756ca);}(_0xda19,0xd5));var _0x9da1=function(_0x1e37b8,_0x1efa66){_0x1e37b8=_0x1e37b8-0x0;var _0x56315c=_0xda19[_0x1e37b8];return _0x56315c;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x1f4830,_0x1a6743){var _0x3bd1d7=function(_0x176d33){while(--_0x176d33){_0x1f4830['push'](_0x1f4830['shift']());}};_0x3bd1d7(++_0x1a6743);}(_0xe14b,0x93));var _0xbe14=function(_0x542028,_0x39daa6){_0x542028=_0x542028-0x0;var _0x1331c1=_0xe14b[_0x542028];return _0x1331c1;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5109e9e..7305d1b 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 _0x6fc3=['update','then','get','CustomReports','UserProfileResource','status','name','send','index','map','AnalyticCustomReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Reports','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','length','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','IS\x20NOT\x20EMPTY','clone','output','web','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','run','runReport','MIN(%s)','alias','debug','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','dbH','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x6fc3,0x1c2));var _0x36fc=function(_0xc2778b,_0x1dea89){_0xc2778b=_0xc2778b-0x0;var _0x1f2050=_0x6fc3[_0xc2778b];return _0x1f2050;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36fc('0x0'));var jsonpatch=require(_0x36fc('0x1'));var rp=require('request-promise');var moment=require(_0x36fc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x36fc('0x3'));var util=require(_0x36fc('0x4'));var path=require('path');var sox=require(_0x36fc('0x5'));var csv=require(_0x36fc('0x6'));var ejs=require(_0x36fc('0x7'));var fs=require('fs');var fs_extra=require(_0x36fc('0x8'));var _=require('lodash');var squel=require(_0x36fc('0x9'));var crypto=require(_0x36fc('0xa'));var jsforce=require(_0x36fc('0xb'));var deskjs=require(_0x36fc('0xc'));var toCsv=require(_0x36fc('0x6'));var querystring=require(_0x36fc('0xd'));var Papa=require(_0x36fc('0xe'));var Redis=require(_0x36fc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x36fc('0x10'));var as=require(_0x36fc('0x11'));var hardwareService=require(_0x36fc('0x12'));var logger=require(_0x36fc('0x13'))(_0x36fc('0x14'));var utils=require(_0x36fc('0x15'));var config=require(_0x36fc('0x16'));var licenseUtil=require(_0x36fc('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x36fc('0x18')];function respondWithStatusCode(_0x2f2f7e,_0x25fac1){_0x25fac1=_0x25fac1||0xcc;return function(_0x3a7049){if(_0x3a7049){return _0x2f2f7e[_0x36fc('0x19')](_0x25fac1);}return _0x2f2f7e['status'](_0x25fac1)[_0x36fc('0x1a')]();};}function respondWithResult(_0x4934e6,_0x27fdaf){_0x27fdaf=_0x27fdaf||0xc8;return function(_0x4bbfaa){if(_0x4bbfaa){return _0x4934e6['status'](_0x27fdaf)[_0x36fc('0x1b')](_0x4bbfaa);}};}function respondWithFilteredResult(_0xd6f93b,_0x43b693){return function(_0x47bb6f){if(_0x47bb6f){var _0x3fc232=typeof _0x43b693[_0x36fc('0x1c')]===_0x36fc('0x1d')&&typeof _0x43b693[_0x36fc('0x1e')]===_0x36fc('0x1d');var _0x3f6259=_0x47bb6f[_0x36fc('0x1f')];var _0x2361cf=_0x3fc232?0x0:_0x43b693[_0x36fc('0x1c')];var _0x120574=_0x3fc232?_0x47bb6f[_0x36fc('0x1f')]:_0x43b693['offset']+_0x43b693['limit'];var _0x2b6789;if(_0x120574>=_0x3f6259){_0x120574=_0x3f6259;_0x2b6789=0xc8;}else{_0x2b6789=0xce;}_0xd6f93b['status'](_0x2b6789);return _0xd6f93b['set'](_0x36fc('0x20'),_0x2361cf+'-'+_0x120574+'/'+_0x3f6259)[_0x36fc('0x1b')](_0x47bb6f);}return null;};}function patchUpdates(_0x11b93f){return function(_0xc8bb22){try{jsonpatch[_0x36fc('0x21')](_0xc8bb22,_0x11b93f,!![]);}catch(_0x219f6b){return BPromise[_0x36fc('0x22')](_0x219f6b);}return _0xc8bb22[_0x36fc('0x23')]();};}function saveUpdates(_0x2a4fb0,_0x58f932){return function(_0xf4a1b3){if(_0xf4a1b3){return _0xf4a1b3[_0x36fc('0x24')](_0x2a4fb0)['then'](function(_0x1e7a6f){return _0x1e7a6f;});}return null;};}function removeEntity(_0x174327,_0x75d49f){return function(_0x23d870){if(_0x23d870){return _0x23d870['destroy']()[_0x36fc('0x25')](function(){var _0x123dc8=_0x23d870[_0x36fc('0x26')]({'plain':!![]});var _0x2b8596=_0x36fc('0x27');return db[_0x36fc('0x28')]['destroy']({'where':{'type':_0x2b8596,'resourceId':_0x123dc8['id']}})[_0x36fc('0x25')](function(){return _0x23d870;});})['then'](function(){_0x174327[_0x36fc('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc7ce,_0x5d5b60){return function(_0x219c71){if(!_0x219c71){_0x2bc7ce['sendStatus'](0x194);}return _0x219c71;};}function handleError(_0x1e5d59,_0xd75055){_0xd75055=_0xd75055||0x1f4;return function(_0x3a0a5f){logger['error'](_0x3a0a5f['stack']);if(_0x3a0a5f[_0x36fc('0x2a')]){delete _0x3a0a5f[_0x36fc('0x2a')];}_0x1e5d59[_0x36fc('0x29')](_0xd75055)[_0x36fc('0x2b')](_0x3a0a5f);};}exports[_0x36fc('0x2c')]=function(_0x4f9978,_0x1514c2){var _0x2be7d0={},_0x21a71a={},_0xa355fc={'count':0x0,'rows':[]};var _0x2a75aa=_[_0x36fc('0x2d')](db[_0x36fc('0x2e')][_0x36fc('0x2f')],function(_0x399b7b){return{'name':_0x399b7b['fieldName'],'type':_0x399b7b['type'][_0x36fc('0x30')]};});_0x21a71a[_0x36fc('0x31')]=_[_0x36fc('0x2d')](_0x2a75aa,'name');_0x21a71a[_0x36fc('0x32')]=_[_0x36fc('0x33')](_0x4f9978['query']);_0x21a71a['filters']=_[_0x36fc('0x34')](_0x21a71a['model'],_0x21a71a[_0x36fc('0x32')]);_0x2be7d0['attributes']=_[_0x36fc('0x34')](_0x21a71a[_0x36fc('0x31')],qs[_0x36fc('0x35')](_0x4f9978['query'][_0x36fc('0x35')]));_0x2be7d0[_0x36fc('0x36')]=_0x2be7d0['attributes']['length']?_0x2be7d0[_0x36fc('0x36')]:_0x21a71a[_0x36fc('0x31')];if(!_0x4f9978['query'][_0x36fc('0x37')](_0x36fc('0x38'))){_0x2be7d0[_0x36fc('0x1e')]=qs[_0x36fc('0x1e')](_0x4f9978[_0x36fc('0x32')][_0x36fc('0x1e')]);_0x2be7d0[_0x36fc('0x1c')]=qs[_0x36fc('0x1c')](_0x4f9978[_0x36fc('0x32')]['offset']);}_0x2be7d0['order']=qs[_0x36fc('0x39')](_0x4f9978[_0x36fc('0x32')][_0x36fc('0x39')]);_0x2be7d0['where']=qs[_0x36fc('0x3a')](_[_0x36fc('0x3b')](_0x4f9978[_0x36fc('0x32')],_0x21a71a['filters']),_0x2a75aa);if(_0x4f9978[_0x36fc('0x32')][_0x36fc('0x3c')]){_0x2be7d0[_0x36fc('0x3d')]=_[_0x36fc('0x3e')](_0x2be7d0['where'],{'$or':_[_0x36fc('0x2d')](_0x2a75aa,function(_0x4667b2){if(_0x4667b2[_0x36fc('0x3f')]!=='VIRTUAL'){var _0x45d6c0={};_0x45d6c0[_0x4667b2[_0x36fc('0x2a')]]={'$like':'%'+_0x4f9978[_0x36fc('0x32')][_0x36fc('0x3c')]+'%'};return _0x45d6c0;}})});}_0x2be7d0=_['merge']({},_0x2be7d0,_0x4f9978[_0x36fc('0x40')]);var _0x4d8b2e={'where':_0x2be7d0[_0x36fc('0x3d')]};return db[_0x36fc('0x2e')][_0x36fc('0x1f')](_0x4d8b2e)[_0x36fc('0x25')](function(_0x2833d3){_0xa355fc[_0x36fc('0x1f')]=_0x2833d3;if(_0x4f9978[_0x36fc('0x32')][_0x36fc('0x41')]){_0x2be7d0[_0x36fc('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x36fc('0x43')](_0x2be7d0);})[_0x36fc('0x25')](function(_0x589147){_0xa355fc[_0x36fc('0x44')]=_0x589147;return _0xa355fc;})[_0x36fc('0x25')](respondWithFilteredResult(_0x1514c2,_0x2be7d0))[_0x36fc('0x45')](handleError(_0x1514c2,null));};exports['show']=function(_0x336574,_0x419f92){var _0x1a7cb9={'raw':![],'where':{'id':_0x336574[_0x36fc('0x46')]['id']}},_0x2dc022={};_0x2dc022[_0x36fc('0x31')]=_[_0x36fc('0x33')](db[_0x36fc('0x2e')]['rawAttributes']);_0x2dc022['query']=_[_0x36fc('0x33')](_0x336574[_0x36fc('0x32')]);_0x2dc022[_0x36fc('0x3a')]=_[_0x36fc('0x34')](_0x2dc022[_0x36fc('0x31')],_0x2dc022['query']);_0x1a7cb9[_0x36fc('0x36')]=_[_0x36fc('0x34')](_0x2dc022[_0x36fc('0x31')],qs['fields'](_0x336574[_0x36fc('0x32')][_0x36fc('0x35')]));_0x1a7cb9['attributes']=_0x1a7cb9[_0x36fc('0x36')]['length']?_0x1a7cb9[_0x36fc('0x36')]:_0x2dc022[_0x36fc('0x31')];if(_0x336574[_0x36fc('0x32')][_0x36fc('0x41')]){_0x1a7cb9[_0x36fc('0x42')]=[{'all':!![]}];}_0x1a7cb9=_['merge']({},_0x1a7cb9,_0x336574[_0x36fc('0x40')]);return db[_0x36fc('0x2e')][_0x36fc('0x47')](_0x1a7cb9)[_0x36fc('0x25')](handleEntityNotFound(_0x419f92,null))[_0x36fc('0x25')](respondWithResult(_0x419f92,null))['catch'](handleError(_0x419f92,null));};exports[_0x36fc('0x48')]=function(_0x1654b9,_0xe9b671){return db[_0x36fc('0x2e')][_0x36fc('0x48')](_0x1654b9[_0x36fc('0x49')],{})[_0x36fc('0x25')](function(_0xaba8d1){var _0x1feeb5=_0x1654b9['user'][_0x36fc('0x26')]({'plain':!![]});if(!_0x1feeb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1feeb5['role']===_0x36fc('0x4a')){var _0x237efe=_0xaba8d1[_0x36fc('0x26')]({'plain':!![]});var _0xa84c8c=_0x36fc('0x4b');return db['UserProfileSection'][_0x36fc('0x47')]({'where':{'name':_0xa84c8c,'userProfileId':_0x1feeb5[_0x36fc('0x4c')]},'raw':!![]})[_0x36fc('0x25')](function(_0x3b61e2){if(_0x3b61e2&&_0x3b61e2[_0x36fc('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x237efe['name'],'resourceId':_0x237efe['id'],'type':_0x36fc('0x27'),'sectionId':_0x3b61e2['id']},{})[_0x36fc('0x25')](function(){return _0xaba8d1;});}else{return _0xaba8d1;}})[_0x36fc('0x45')](function(_0x1333f9){logger[_0x36fc('0x4e')](_0x36fc('0x4f'),_0x1333f9);throw _0x1333f9;});}return _0xaba8d1;})[_0x36fc('0x25')](respondWithResult(_0xe9b671,0xc9))['catch'](handleError(_0xe9b671,null));};exports[_0x36fc('0x24')]=function(_0x22e019,_0x536ca2){if(_0x22e019['body']['id']){delete _0x22e019[_0x36fc('0x49')]['id'];}return db[_0x36fc('0x2e')][_0x36fc('0x47')]({'where':{'id':_0x22e019[_0x36fc('0x46')]['id']}})[_0x36fc('0x25')](handleEntityNotFound(_0x536ca2,null))['then'](saveUpdates(_0x22e019[_0x36fc('0x49')],null))['then'](respondWithResult(_0x536ca2,null))[_0x36fc('0x45')](handleError(_0x536ca2,null));};exports[_0x36fc('0x50')]=function(_0x5dfe5d,_0x4eace7){return db[_0x36fc('0x2e')][_0x36fc('0x47')]({'where':{'id':_0x5dfe5d[_0x36fc('0x46')]['id']}})[_0x36fc('0x25')](handleEntityNotFound(_0x4eace7,null))[_0x36fc('0x25')](removeEntity(_0x4eace7,null))[_0x36fc('0x45')](handleError(_0x4eace7,null));};exports[_0x36fc('0x51')]=function(_0x495c90,_0x2c04ad){var _0x23e6be=0xa;var _0x4a0d5a=[_0x36fc('0x52'),_0x36fc('0x53'),'right_join',_0x36fc('0x54')];var _0xf56230={'SUM':_0x36fc('0x55'),'COUNT':_0x36fc('0x56'),'COUNT DISTINCT':_0x36fc('0x57'),'MAX':_0x36fc('0x58'),'MIN':'MIN(%s)','AVG':_0x36fc('0x59'),'GROUP_CONCAT':_0x36fc('0x5a'),'GROUP_CONCAT ASC':_0x36fc('0x5b'),'GROUP_CONCAT DESC':_0x36fc('0x5c')};var _0x5b5162={'SEC_TO_TIME':_0x36fc('0x5d'),'DATE':_0x36fc('0x5e'),'HOUR':_0x36fc('0x5f'),'ROUND':_0x36fc('0x60'),'UNIX_TIMESTAMP':_0x36fc('0x61')};var _0x1f1d27=function(_0x3e65f7){return!_[_0x36fc('0x62')]([_0x36fc('0x63'),_0x36fc('0x64'),_0x36fc('0x65'),'IS\x20NOT\x20EMPTY'],_0x3e65f7);};var _0x4c8aa7=function(_0x5cda4f){if(!_0x5cda4f||!_0x5cda4f['rules'][_0x36fc('0x66')]){return'';}for(var _0x2da568='(',_0x79a9be=0x0;_0x79a9be<_0x5cda4f[_0x36fc('0x67')]['length'];_0x79a9be+=0x1){_0x79a9be>0x0&&(_0x2da568+='\x20'+_0x5cda4f[_0x36fc('0x68')]+'\x20');_0x2da568+=_0x5cda4f[_0x36fc('0x67')][_0x79a9be][_0x36fc('0x69')]?_0x4c8aa7(_0x5cda4f['rules'][_0x79a9be][_0x36fc('0x69')]):_0x5cda4f['rules'][_0x79a9be][_0x36fc('0x6a')]+'\x20'+_0x5cda4f['rules'][_0x79a9be]['condition']+(_0x1f1d27(_0x5cda4f[_0x36fc('0x67')][_0x79a9be][_0x36fc('0x6b')])?'\x20'+_0x5cda4f['rules'][_0x79a9be][_0x36fc('0x6c')]:'');}return _0x2da568+')';};var _0x1bd722={'where':{'id':_0x495c90[_0x36fc('0x46')]['id']}},_0x3ff41f,_0x14d898,_0x35d658,_0x4ebba8,_0x21e71b;_0x1bd722=_[_0x36fc('0x3e')]({},_0x1bd722,_0x495c90[_0x36fc('0x40')]);return db[_0x36fc('0x2e')][_0x36fc('0x47')](_0x1bd722)['then'](function(_0x1a3001){if(_0x1a3001){_0x3ff41f=_0x1a3001;return _0x1a3001[_0x36fc('0x6d')]();}return null;})[_0x36fc('0x25')](function(_0x1d85f5){if(_0x1d85f5){if(!_0x1d85f5['length']){throw new db[(_0x36fc('0x6e'))][(_0x36fc('0x6f'))](_0x36fc('0x70'),0x193);}_0x14d898=_0x1d85f5;return db[_0x36fc('0x71')][_0x36fc('0x43')]({'raw':!![]});}return null;})[_0x36fc('0x25')](function(_0xcfb459){if(_0xcfb459){_0x35d658=_['keyBy'](_0xcfb459,'id');var _0x37c8a0;var _0x3d5a43=squel[_0x36fc('0x72')]();_0x3d5a43[_0x36fc('0x73')](_0x3ff41f[_0x36fc('0x74')]);for(var _0x16e5ae=0x0;_0x16e5ae<_0x14d898['length'];_0x16e5ae+=0x1){_0x37c8a0=_0x14d898[_0x16e5ae][_0x36fc('0x75')]?_0x35d658[_0x14d898[_0x16e5ae][_0x36fc('0x75')]][_0x36fc('0x76')]:_0x14d898[_0x16e5ae][_0x36fc('0x6a')];_0x37c8a0=_0x14d898[_0x16e5ae][_0x36fc('0x77')]?_[_0x36fc('0x78')](_0xf56230[_0x14d898[_0x16e5ae][_0x36fc('0x77')]],'%s',_0x37c8a0):_0x37c8a0;_0x37c8a0=_0x14d898[_0x16e5ae]['format']?_[_0x36fc('0x78')](_0x5b5162[_0x14d898[_0x16e5ae][_0x36fc('0x79')]],'%s',_0x37c8a0):_0x37c8a0;if(_0x14d898[_0x16e5ae][_0x36fc('0x7a')]){_0x3d5a43[_0x36fc('0x69')](_0x37c8a0);}_0x14d898[_0x16e5ae][_0x36fc('0x7b')]&&_0x3d5a43[_0x36fc('0x7c')](_0x37c8a0,_0x14d898[_0x16e5ae][_0x36fc('0x7b')]===_0x36fc('0x7d')?![]:!![]);_0x3d5a43['field'](_0x37c8a0,_0x14d898[_0x16e5ae]['alias']||_0x37c8a0);}if(_0x3ff41f[_0x36fc('0x7e')]){_0x3ff41f[_0x36fc('0x7e')]=JSON[_0x36fc('0x7f')](_0x3ff41f[_0x36fc('0x7e')]);for(var _0x3b56d3=0x0;_0x3b56d3<_0x3ff41f['joins']['length'];_0x3b56d3+=0x1){if(_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x3f')]&&_[_0x36fc('0x62')](_0x4a0d5a,_0x3ff41f['joins'][_0x3b56d3][_0x36fc('0x3f')])&&_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x80')]&&_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x81')]&&_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x82')]){_0x3d5a43[_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x3f')]](_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x81')],null,util['format'](_0x36fc('0x83'),_0x3ff41f[_0x36fc('0x74')],_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3][_0x36fc('0x80')],_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3]['foreignTable'],_0x3ff41f[_0x36fc('0x7e')][_0x3b56d3]['foreignKey']));}}}if(_0x3ff41f[_0x36fc('0x84')]){_0x3ff41f[_0x36fc('0x84')]=JSON[_0x36fc('0x7f')](_0x3ff41f[_0x36fc('0x84')]);_0x3d5a43[_0x36fc('0x3d')](_0x4c8aa7(_0x3ff41f[_0x36fc('0x84')]['group']));}_0x21e71b=_0x3d5a43['clone']();_0x3d5a43[_0x36fc('0x1e')](_0x23e6be);_0x3d5a43[_0x36fc('0x1c')](0x0);logger['debug'](_0x36fc('0x85'),_0x3d5a43[_0x36fc('0x86')]());return dbH[_0x36fc('0x87')][_0x36fc('0x32')](_0x3d5a43[_0x36fc('0x86')](),{'type':dbH[_0x36fc('0x87')][_0x36fc('0x88')][_0x36fc('0x89')]});}})[_0x36fc('0x25')](respondWithResult(_0x2c04ad,null))[_0x36fc('0x45')](handleError(_0x2c04ad,null));};function runReport(_0x4c3049,_0x1abae2,_0x54c542){var _0x3726cc=_0x1abae2[_0x36fc('0x2a')];var _0x1d296b=0xa;var _0x57d3e4=[_0x36fc('0x52'),_0x36fc('0x53'),'right_join',_0x36fc('0x54')];var _0x3c68af={'SUM':_0x36fc('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x36fc('0x57'),'MAX':_0x36fc('0x58'),'MIN':'MIN(%s)','AVG':_0x36fc('0x59'),'GROUP_CONCAT':_0x36fc('0x5a'),'GROUP_CONCAT ASC':_0x36fc('0x5b'),'GROUP_CONCAT DESC':_0x36fc('0x5c')};var _0x490fe4={'SEC_TO_TIME':_0x36fc('0x5d'),'DATE':_0x36fc('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x362952=function(_0x15efb0){return!_[_0x36fc('0x62')]([_0x36fc('0x63'),'IS\x20NOT\x20NULL',_0x36fc('0x65'),_0x36fc('0x8a')],_0x15efb0);};var _0x5a4e71=function(_0x26206d){if(!_0x26206d||!_0x26206d[_0x36fc('0x67')][_0x36fc('0x66')]){return'';}for(var _0x243117='(',_0x53a8a2=0x0;_0x53a8a2<_0x26206d[_0x36fc('0x67')]['length'];_0x53a8a2+=0x1){_0x53a8a2>0x0&&(_0x243117+='\x20'+_0x26206d['operator']+'\x20');_0x243117+=_0x26206d[_0x36fc('0x67')][_0x53a8a2]['group']?_0x5a4e71(_0x26206d['rules'][_0x53a8a2][_0x36fc('0x69')]):_0x26206d[_0x36fc('0x67')][_0x53a8a2][_0x36fc('0x6a')]+'\x20'+_0x26206d[_0x36fc('0x67')][_0x53a8a2][_0x36fc('0x6b')]+(_0x362952(_0x26206d[_0x36fc('0x67')][_0x53a8a2][_0x36fc('0x6b')])?'\x20'+_0x26206d[_0x36fc('0x67')][_0x53a8a2][_0x36fc('0x6c')]:'');}return _0x243117+')';};var _0x2e25a7={'where':{'id':_0x4c3049['id']}},_0x2a504a,_0x3e9528,_0x4ec179,_0x5c177f,_0x197f71;_0x2e25a7=_[_0x36fc('0x3e')]({},_0x2e25a7,_0x54c542);return db[_0x36fc('0x2e')][_0x36fc('0x47')](_0x2e25a7)['then'](function(_0x2d4abd){if(_0x2d4abd){_0x2a504a=_0x2d4abd;return _0x2d4abd[_0x36fc('0x6d')]();}return null;})[_0x36fc('0x25')](function(_0xd69f9a){if(_0xd69f9a){if(!_0xd69f9a[_0x36fc('0x66')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3e9528=_0xd69f9a;return db[_0x36fc('0x71')][_0x36fc('0x43')]({'raw':!![]});}return null;})[_0x36fc('0x25')](function(_0xb8eaad){if(_0xb8eaad){_0x4ec179=_['keyBy'](_0xb8eaad,'id');var _0x33aa59;var _0x562aed=squel['select']();_0x562aed[_0x36fc('0x73')](_0x2a504a[_0x36fc('0x74')]);for(var _0xe1ec0=0x0;_0xe1ec0<_0x3e9528[_0x36fc('0x66')];_0xe1ec0+=0x1){_0x33aa59=_0x3e9528[_0xe1ec0]['MetricId']?_0x4ec179[_0x3e9528[_0xe1ec0]['MetricId']][_0x36fc('0x76')]:_0x3e9528[_0xe1ec0]['field'];_0x33aa59=_0x3e9528[_0xe1ec0][_0x36fc('0x77')]?_[_0x36fc('0x78')](_0x3c68af[_0x3e9528[_0xe1ec0][_0x36fc('0x77')]],'%s',_0x33aa59):_0x33aa59;_0x33aa59=_0x3e9528[_0xe1ec0][_0x36fc('0x79')]?_[_0x36fc('0x78')](_0x490fe4[_0x3e9528[_0xe1ec0]['format']],'%s',_0x33aa59):_0x33aa59;if(_0x3e9528[_0xe1ec0][_0x36fc('0x7a')]){_0x562aed[_0x36fc('0x69')](_0x33aa59);}_0x3e9528[_0xe1ec0]['orderBy']&&_0x562aed[_0x36fc('0x7c')](_0x33aa59,_0x3e9528[_0xe1ec0]['orderBy']===_0x36fc('0x7d')?![]:!![]);_0x562aed[_0x36fc('0x6a')](_0x33aa59,_0x3e9528[_0xe1ec0]['alias']||_0x33aa59);}if(_0x2a504a[_0x36fc('0x7e')]){_0x2a504a['joins']=JSON[_0x36fc('0x7f')](_0x2a504a['joins']);for(var _0x3e4075=0x0;_0x3e4075<_0x2a504a['joins'][_0x36fc('0x66')];_0x3e4075+=0x1){if(_0x2a504a[_0x36fc('0x7e')][_0x3e4075][_0x36fc('0x3f')]&&_['includes'](_0x57d3e4,_0x2a504a[_0x36fc('0x7e')][_0x3e4075]['type'])&&_0x2a504a[_0x36fc('0x7e')][_0x3e4075][_0x36fc('0x80')]&&_0x2a504a[_0x36fc('0x7e')][_0x3e4075][_0x36fc('0x81')]&&_0x2a504a['joins'][_0x3e4075][_0x36fc('0x82')]){_0x562aed[_0x2a504a[_0x36fc('0x7e')][_0x3e4075][_0x36fc('0x3f')]](_0x2a504a[_0x36fc('0x7e')][_0x3e4075]['foreignTable'],null,util[_0x36fc('0x79')](_0x36fc('0x83'),_0x2a504a['table'],_0x2a504a[_0x36fc('0x7e')][_0x3e4075][_0x36fc('0x80')],_0x2a504a['joins'][_0x3e4075]['foreignTable'],_0x2a504a[_0x36fc('0x7e')][_0x3e4075]['foreignKey']));}}}if(_0x2a504a['conditions']){_0x2a504a[_0x36fc('0x84')]=JSON[_0x36fc('0x7f')](_0x2a504a['conditions']);_0x562aed[_0x36fc('0x3d')](_0x5a4e71(_0x2a504a[_0x36fc('0x84')][_0x36fc('0x69')]));}_0x197f71=_0x562aed[_0x36fc('0x8b')]();_0x562aed[_0x36fc('0x1e')](_0x1d296b);_0x562aed[_0x36fc('0x1c')](0x0);return;}})[_0x36fc('0x25')](function(){if(_0x1abae2[_0x36fc('0x8c')]===_0x36fc('0x8d')){return null;}var _0x1fe35e=_['merge'](_0x1abae2,{'name':_0x1abae2['fullPath']||_0x1abae2[_0x36fc('0x2a')]||_0x2a504a[_0x36fc('0x2a')],'basename':_0x3726cc,'savename':util['format']('%s-%s.%s',_0x1abae2[_0x36fc('0x2a')]||_0x2a504a[_0x36fc('0x2a')],require('randomstring')[_0x36fc('0x8e')](0x4),_0x1abae2[_0x36fc('0x8c')]||_0x36fc('0x8f')),'reportId':_0x2a504a['id'],'reportType':_0x36fc('0x90')});return db[_0x36fc('0x91')]['create'](_0x1fe35e,{'raw':!![]});})[_0x36fc('0x25')](function(_0x2d1bb5){if(_0x2a504a['table']===_0x36fc('0x92')){_0x197f71[_0x36fc('0x3d')](_0x2a504a[_0x36fc('0x74')]+_0x36fc('0x93'),_0x1abae2[_0x36fc('0x94')],_0x1abae2[_0x36fc('0x95')]);}else{_0x197f71[_0x36fc('0x3d')](_0x2a504a[_0x36fc('0x74')]+_0x36fc('0x96'),_0x1abae2['startDate'],_0x1abae2['endDate']);}if(_0x2d1bb5){logger[_0x36fc('0x97')](_0x36fc('0x98'),_0x197f71[_0x36fc('0x86')]());require(_0x36fc('0x99'))['fork'](path['join'](__dirname,_0x36fc('0x9a'),_0x2d1bb5[_0x36fc('0x8c')]),[_0x2d1bb5['id'],_0x197f71[_0x36fc('0x86')](),path[_0x36fc('0x52')](__dirname,'../../files/reports',_0x2d1bb5[_0x36fc('0x9b')]),_0x3726cc]);return _0x2d1bb5;}else{var _0x566d92=squel[_0x36fc('0x72')]();_0x566d92[_0x36fc('0x73')]('('+_0x197f71[_0x36fc('0x86')]()+')',_0x36fc('0x9c'));_0x566d92[_0x36fc('0x6a')]('COUNT(*)',_0x36fc('0x1f'));_0x197f71[_0x36fc('0x1e')](_0x1abae2['limit']||_0x1d296b);_0x197f71[_0x36fc('0x1c')](_0x1abae2['offset']||0x0);return dbH[_0x36fc('0x87')][_0x36fc('0x32')](_0x566d92[_0x36fc('0x86')](),{'type':dbH[_0x36fc('0x87')][_0x36fc('0x88')][_0x36fc('0x89')]})[_0x36fc('0x25')](function(_0x18b413){if(!_0x18b413[_0x36fc('0x66')]){_0x5c177f=0x0;}else{_0x5c177f=_0x18b413[0x0][_0x36fc('0x1f')]||0x0;}return dbH[_0x36fc('0x87')][_0x36fc('0x32')](_0x197f71[_0x36fc('0x86')](),{'type':dbH[_0x36fc('0x87')][_0x36fc('0x88')][_0x36fc('0x89')]});})['then'](function(_0x3c7891){return{'rows':_0x3c7891||[],'count':_0x5c177f};});}});}exports[_0x36fc('0x9d')]=function(_0x259d54,_0x1f8d03){return runReport(_0x259d54['params'],_0x259d54[_0x36fc('0x32')],_0x259d54[_0x36fc('0x40')])['then'](respondWithResult(_0x1f8d03,null))['catch'](handleError(_0x1f8d03,null));};exports[_0x36fc('0x9e')]=runReport;exports[_0x36fc('0x32')]=function(_0x39eaba,_0x13a541){var _0x3dd5c8=0xa;var _0x2eac78=[_0x36fc('0x52'),'left_join','right_join','cross_join'];var _0x2f136d={'SUM':_0x36fc('0x55'),'COUNT':_0x36fc('0x56'),'COUNT DISTINCT':_0x36fc('0x57'),'MAX':_0x36fc('0x58'),'MIN':_0x36fc('0x9f'),'AVG':_0x36fc('0x59'),'GROUP_CONCAT':_0x36fc('0x5a'),'GROUP_CONCAT ASC':_0x36fc('0x5b'),'GROUP_CONCAT DESC':_0x36fc('0x5c')};var _0xb90d5={'SEC_TO_TIME':_0x36fc('0x5d'),'DATE':_0x36fc('0x5e'),'HOUR':_0x36fc('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x36fc('0x61')};var _0x192074=function(_0x1f492c){return!_[_0x36fc('0x62')]([_0x36fc('0x63'),_0x36fc('0x64'),'IS\x20EMPTY',_0x36fc('0x8a')],_0x1f492c);};var _0x15ab16=function(_0x51fcc1){if(!_0x51fcc1||!_0x51fcc1[_0x36fc('0x67')][_0x36fc('0x66')]){return'';}for(var _0x56c54c='(',_0x4366f2=0x0;_0x4366f2<_0x51fcc1[_0x36fc('0x67')][_0x36fc('0x66')];_0x4366f2+=0x1){_0x4366f2>0x0&&(_0x56c54c+='\x20'+_0x51fcc1[_0x36fc('0x68')]+'\x20');_0x56c54c+=_0x51fcc1[_0x36fc('0x67')][_0x4366f2][_0x36fc('0x69')]?_0x15ab16(_0x51fcc1['rules'][_0x4366f2][_0x36fc('0x69')]):_0x51fcc1[_0x36fc('0x67')][_0x4366f2][_0x36fc('0x6a')]+'\x20'+_0x51fcc1[_0x36fc('0x67')][_0x4366f2]['condition']+(_0x192074(_0x51fcc1[_0x36fc('0x67')][_0x4366f2][_0x36fc('0x6b')])?'\x20'+_0x51fcc1[_0x36fc('0x67')][_0x4366f2][_0x36fc('0x6c')]:'');}return _0x56c54c+')';};var _0x1339c7={'where':{'id':_0x39eaba['params']['id']}},_0x3265c6,_0x5b6153,_0x14bb9f,_0x163cf2,_0x1f5180;_0x1339c7=_['merge']({},_0x1339c7,_0x39eaba[_0x36fc('0x40')]);return db['AnalyticCustomReport'][_0x36fc('0x47')](_0x1339c7)['then'](function(_0x2c3c3c){if(_0x2c3c3c){_0x3265c6=_0x2c3c3c;return _0x2c3c3c[_0x36fc('0x6d')]();}return null;})[_0x36fc('0x25')](function(_0x1d037d){if(_0x1d037d){if(!_0x1d037d['length']){throw new db[(_0x36fc('0x6e'))][(_0x36fc('0x6f'))](_0x36fc('0x70'),0x193);}_0x5b6153=_0x1d037d;return db[_0x36fc('0x71')]['findAll']({'raw':!![]});}return null;})[_0x36fc('0x25')](function(_0x356215){if(_0x356215){_0x14bb9f=_['keyBy'](_0x356215,'id');var _0x5c7eba;var _0x375191=squel[_0x36fc('0x72')]();_0x375191[_0x36fc('0x73')](_0x3265c6[_0x36fc('0x74')]);for(var _0xe26435=0x0;_0xe26435<_0x5b6153[_0x36fc('0x66')];_0xe26435+=0x1){_0x5c7eba=_0x5b6153[_0xe26435][_0x36fc('0x75')]?_0x14bb9f[_0x5b6153[_0xe26435][_0x36fc('0x75')]][_0x36fc('0x76')]:_0x5b6153[_0xe26435][_0x36fc('0x6a')];_0x5c7eba=_0x5b6153[_0xe26435][_0x36fc('0x77')]?_[_0x36fc('0x78')](_0x2f136d[_0x5b6153[_0xe26435][_0x36fc('0x77')]],'%s',_0x5c7eba):_0x5c7eba;_0x5c7eba=_0x5b6153[_0xe26435]['format']?_[_0x36fc('0x78')](_0xb90d5[_0x5b6153[_0xe26435]['format']],'%s',_0x5c7eba):_0x5c7eba;if(_0x5b6153[_0xe26435][_0x36fc('0x7a')]){_0x375191[_0x36fc('0x69')](_0x5c7eba);}_0x5b6153[_0xe26435][_0x36fc('0x7b')]&&_0x375191[_0x36fc('0x7c')](_0x5c7eba,_0x5b6153[_0xe26435][_0x36fc('0x7b')]==='DESC'?![]:!![]);_0x375191['field'](_0x5c7eba,_0x5b6153[_0xe26435][_0x36fc('0xa0')]||_0x5c7eba);}if(_0x3265c6[_0x36fc('0x7e')]){_0x3265c6['joins']=JSON[_0x36fc('0x7f')](_0x3265c6[_0x36fc('0x7e')]);for(var _0x4daae7=0x0;_0x4daae7<_0x3265c6[_0x36fc('0x7e')]['length'];_0x4daae7+=0x1){if(_0x3265c6['joins'][_0x4daae7][_0x36fc('0x3f')]&&_[_0x36fc('0x62')](_0x2eac78,_0x3265c6['joins'][_0x4daae7][_0x36fc('0x3f')])&&_0x3265c6[_0x36fc('0x7e')][_0x4daae7][_0x36fc('0x80')]&&_0x3265c6[_0x36fc('0x7e')][_0x4daae7][_0x36fc('0x81')]&&_0x3265c6['joins'][_0x4daae7][_0x36fc('0x82')]){_0x375191[_0x3265c6['joins'][_0x4daae7][_0x36fc('0x3f')]](_0x3265c6[_0x36fc('0x7e')][_0x4daae7][_0x36fc('0x81')],null,util[_0x36fc('0x79')](_0x36fc('0x83'),_0x3265c6['table'],_0x3265c6[_0x36fc('0x7e')][_0x4daae7][_0x36fc('0x80')],_0x3265c6[_0x36fc('0x7e')][_0x4daae7]['foreignTable'],_0x3265c6['joins'][_0x4daae7]['foreignKey']));}}}if(_0x3265c6[_0x36fc('0x84')]){_0x3265c6[_0x36fc('0x84')]=JSON[_0x36fc('0x7f')](_0x3265c6[_0x36fc('0x84')]);_0x375191[_0x36fc('0x3d')](_0x15ab16(_0x3265c6['conditions'][_0x36fc('0x69')]));}_0x1f5180=_0x375191[_0x36fc('0x8b')]();_0x375191[_0x36fc('0x1e')](_0x3dd5c8);_0x375191['offset'](0x0);logger[_0x36fc('0xa1')](_0x36fc('0x85'),_0x375191[_0x36fc('0x86')]());return dbH[_0x36fc('0x87')][_0x36fc('0x32')](_0x375191[_0x36fc('0x86')](),{'type':dbH[_0x36fc('0x87')]['QueryTypes'][_0x36fc('0x89')]});}})[_0x36fc('0x25')](function(){return{'sql':_0x1f5180[_0x36fc('0x86')]()};})['then'](respondWithResult(_0x13a541,null))[_0x36fc('0x45')](handleError(_0x13a541,null));}; \ No newline at end of file +var _0x98f0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','AnalyticCustomReport','rows','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','body','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','replace','function','format','orderBy','DESC','alias','parse','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','MIN(%s)','DATE(%s)','HOUR(%s)','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','countTable','COUNT(*)','runReport','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','debug','eml-format','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','error','name','send','index','rawAttributes','type','model','map','keys','query','intersection','attributes'];(function(_0x46d2d6,_0x46d924){var _0x569c76=function(_0x1c9a55){while(--_0x1c9a55){_0x46d2d6['push'](_0x46d2d6['shift']());}};_0x569c76(++_0x46d924);}(_0x98f0,0x1b5));var _0x098f=function(_0x5ca52a,_0x54d9db){_0x5ca52a=_0x5ca52a-0x0;var _0x1f9ff4=_0x98f0[_0x5ca52a];return _0x1f9ff4;};'use strict';var emlformat=require(_0x098f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x098f('0x1'));var jsonpatch=require(_0x098f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x098f('0x3'));var sox=require(_0x098f('0x4'));var csv=require(_0x098f('0x5'));var ejs=require(_0x098f('0x6'));var fs=require('fs');var fs_extra=require(_0x098f('0x7'));var _=require('lodash');var squel=require(_0x098f('0x8'));var crypto=require(_0x098f('0x9'));var jsforce=require(_0x098f('0xa'));var deskjs=require(_0x098f('0xb'));var toCsv=require(_0x098f('0x5'));var querystring=require(_0x098f('0xc'));var Papa=require(_0x098f('0xd'));var Redis=require(_0x098f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x098f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x098f('0x10'))(_0x098f('0x11'));var utils=require(_0x098f('0x12'));var config=require(_0x098f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x098f('0x14'))['db'];var dbH=require(_0x098f('0x14'))['dbH'];function respondWithStatusCode(_0x3bfb0b,_0x1de18e){_0x1de18e=_0x1de18e||0xcc;return function(_0x72a41c){if(_0x72a41c){return _0x3bfb0b[_0x098f('0x15')](_0x1de18e);}return _0x3bfb0b['status'](_0x1de18e)[_0x098f('0x16')]();};}function respondWithResult(_0x1e7fcc,_0x5da723){_0x5da723=_0x5da723||0xc8;return function(_0x411b6e){if(_0x411b6e){return _0x1e7fcc['status'](_0x5da723)[_0x098f('0x17')](_0x411b6e);}};}function respondWithFilteredResult(_0xaff9f5,_0x12b864){return function(_0x603082){if(_0x603082){var _0x4466a8=typeof _0x12b864['offset']===_0x098f('0x18')&&typeof _0x12b864[_0x098f('0x19')]===_0x098f('0x18');var _0x2d2fc6=_0x603082[_0x098f('0x1a')];var _0x251d4b=_0x4466a8?0x0:_0x12b864['offset'];var _0xa85478=_0x4466a8?_0x603082[_0x098f('0x1a')]:_0x12b864[_0x098f('0x1b')]+_0x12b864[_0x098f('0x19')];var _0x1df8f0;if(_0xa85478>=_0x2d2fc6){_0xa85478=_0x2d2fc6;_0x1df8f0=0xc8;}else{_0x1df8f0=0xce;}_0xaff9f5[_0x098f('0x1c')](_0x1df8f0);return _0xaff9f5[_0x098f('0x1d')](_0x098f('0x1e'),_0x251d4b+'-'+_0xa85478+'/'+_0x2d2fc6)[_0x098f('0x17')](_0x603082);}return null;};}function patchUpdates(_0xc3642c){return function(_0x1cbc99){try{jsonpatch[_0x098f('0x1f')](_0x1cbc99,_0xc3642c,!![]);}catch(_0x313ce3){return BPromise[_0x098f('0x20')](_0x313ce3);}return _0x1cbc99[_0x098f('0x21')]();};}function saveUpdates(_0x2b94ec,_0x4f24df){return function(_0x425cef){if(_0x425cef){return _0x425cef[_0x098f('0x22')](_0x2b94ec)['then'](function(_0x52bd4){return _0x52bd4;});}return null;};}function removeEntity(_0x237381,_0x1fa961){return function(_0x1177b2){if(_0x1177b2){return _0x1177b2['destroy']()[_0x098f('0x23')](function(){var _0x3ed256=_0x1177b2[_0x098f('0x24')]({'plain':!![]});var _0x4864d5=_0x098f('0x25');return db[_0x098f('0x26')][_0x098f('0x27')]({'where':{'type':_0x4864d5,'resourceId':_0x3ed256['id']}})['then'](function(){return _0x1177b2;});})[_0x098f('0x23')](function(){_0x237381[_0x098f('0x1c')](0xcc)[_0x098f('0x16')]();});}};}function handleEntityNotFound(_0xaba5a9,_0x3146d1){return function(_0x11cf6d){if(!_0x11cf6d){_0xaba5a9[_0x098f('0x15')](0x194);}return _0x11cf6d;};}function handleError(_0x5c896a,_0x43907){_0x43907=_0x43907||0x1f4;return function(_0x4f3600){logger[_0x098f('0x28')](_0x4f3600['stack']);if(_0x4f3600[_0x098f('0x29')]){delete _0x4f3600[_0x098f('0x29')];}_0x5c896a[_0x098f('0x1c')](_0x43907)[_0x098f('0x2a')](_0x4f3600);};}exports[_0x098f('0x2b')]=function(_0x38551c,_0x2c3a5f){var _0xf476a4={},_0xf5fdf6={},_0x3e47d1={'count':0x0,'rows':[]};var _0x500c5f=_['map'](db['AnalyticCustomReport'][_0x098f('0x2c')],function(_0xe9dde5){return{'name':_0xe9dde5['fieldName'],'type':_0xe9dde5[_0x098f('0x2d')]['key']};});_0xf5fdf6[_0x098f('0x2e')]=_[_0x098f('0x2f')](_0x500c5f,_0x098f('0x29'));_0xf5fdf6['query']=_[_0x098f('0x30')](_0x38551c[_0x098f('0x31')]);_0xf5fdf6['filters']=_[_0x098f('0x32')](_0xf5fdf6[_0x098f('0x2e')],_0xf5fdf6[_0x098f('0x31')]);_0xf476a4[_0x098f('0x33')]=_[_0x098f('0x32')](_0xf5fdf6[_0x098f('0x2e')],qs[_0x098f('0x34')](_0x38551c[_0x098f('0x31')]['fields']));_0xf476a4[_0x098f('0x33')]=_0xf476a4[_0x098f('0x33')][_0x098f('0x35')]?_0xf476a4[_0x098f('0x33')]:_0xf5fdf6[_0x098f('0x2e')];if(!_0x38551c[_0x098f('0x31')][_0x098f('0x36')](_0x098f('0x37'))){_0xf476a4[_0x098f('0x19')]=qs['limit'](_0x38551c[_0x098f('0x31')][_0x098f('0x19')]);_0xf476a4[_0x098f('0x1b')]=qs[_0x098f('0x1b')](_0x38551c[_0x098f('0x31')][_0x098f('0x1b')]);}_0xf476a4[_0x098f('0x38')]=qs[_0x098f('0x39')](_0x38551c[_0x098f('0x31')][_0x098f('0x39')]);_0xf476a4[_0x098f('0x3a')]=qs['filters'](_[_0x098f('0x3b')](_0x38551c['query'],_0xf5fdf6[_0x098f('0x3c')]),_0x500c5f);if(_0x38551c['query'][_0x098f('0x3d')]){_0xf476a4[_0x098f('0x3a')]=_[_0x098f('0x3e')](_0xf476a4[_0x098f('0x3a')],{'$or':_[_0x098f('0x2f')](_0x500c5f,function(_0x4019b1){if(_0x4019b1['type']!==_0x098f('0x3f')){var _0x5674be={};_0x5674be[_0x4019b1[_0x098f('0x29')]]={'$like':'%'+_0x38551c[_0x098f('0x31')][_0x098f('0x3d')]+'%'};return _0x5674be;}})});}_0xf476a4=_[_0x098f('0x3e')]({},_0xf476a4,_0x38551c['options']);var _0x24ad31={'where':_0xf476a4['where']};return db['AnalyticCustomReport'][_0x098f('0x1a')](_0x24ad31)[_0x098f('0x23')](function(_0x558f08){_0x3e47d1[_0x098f('0x1a')]=_0x558f08;if(_0x38551c[_0x098f('0x31')][_0x098f('0x40')]){_0xf476a4[_0x098f('0x41')]=[{'all':!![]}];}return db[_0x098f('0x42')]['findAll'](_0xf476a4);})[_0x098f('0x23')](function(_0x20a43b){_0x3e47d1[_0x098f('0x43')]=_0x20a43b;return _0x3e47d1;})[_0x098f('0x23')](respondWithFilteredResult(_0x2c3a5f,_0xf476a4))['catch'](handleError(_0x2c3a5f,null));};exports['show']=function(_0x1c3c8b,_0x143a44){var _0x2758f9={'raw':![],'where':{'id':_0x1c3c8b[_0x098f('0x44')]['id']}},_0x2b788d={};_0x2b788d['model']=_['keys'](db[_0x098f('0x42')]['rawAttributes']);_0x2b788d[_0x098f('0x31')]=_[_0x098f('0x30')](_0x1c3c8b['query']);_0x2b788d['filters']=_[_0x098f('0x32')](_0x2b788d['model'],_0x2b788d[_0x098f('0x31')]);_0x2758f9[_0x098f('0x33')]=_[_0x098f('0x32')](_0x2b788d['model'],qs['fields'](_0x1c3c8b[_0x098f('0x31')][_0x098f('0x34')]));_0x2758f9[_0x098f('0x33')]=_0x2758f9['attributes'][_0x098f('0x35')]?_0x2758f9[_0x098f('0x33')]:_0x2b788d[_0x098f('0x2e')];if(_0x1c3c8b[_0x098f('0x31')]['includeAll']){_0x2758f9[_0x098f('0x41')]=[{'all':!![]}];}_0x2758f9=_[_0x098f('0x3e')]({},_0x2758f9,_0x1c3c8b[_0x098f('0x45')]);return db['AnalyticCustomReport'][_0x098f('0x46')](_0x2758f9)[_0x098f('0x23')](handleEntityNotFound(_0x143a44,null))['then'](respondWithResult(_0x143a44,null))['catch'](handleError(_0x143a44,null));};exports[_0x098f('0x47')]=function(_0x1a9b97,_0x2cbfcb){return db[_0x098f('0x42')][_0x098f('0x47')](_0x1a9b97['body'],{})['then'](function(_0x1da7a3){var _0x3eecd7=_0x1a9b97['user']['get']({'plain':!![]});if(!_0x3eecd7)throw new Error(_0x098f('0x48'));if(_0x3eecd7[_0x098f('0x49')]===_0x098f('0x4a')){var _0x3ebc01=_0x1da7a3[_0x098f('0x24')]({'plain':!![]});var _0x105655=_0x098f('0x4b');return db[_0x098f('0x4c')][_0x098f('0x46')]({'where':{'name':_0x105655,'userProfileId':_0x3eecd7[_0x098f('0x4d')]},'raw':!![]})[_0x098f('0x23')](function(_0x2d8bf5){if(_0x2d8bf5&&_0x2d8bf5[_0x098f('0x4e')]===0x0){return db['UserProfileResource'][_0x098f('0x47')]({'name':_0x3ebc01[_0x098f('0x29')],'resourceId':_0x3ebc01['id'],'type':_0x098f('0x25'),'sectionId':_0x2d8bf5['id']},{})['then'](function(){return _0x1da7a3;});}else{return _0x1da7a3;}})[_0x098f('0x4f')](function(_0x3ef306){logger[_0x098f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ef306);throw _0x3ef306;});}return _0x1da7a3;})[_0x098f('0x23')](respondWithResult(_0x2cbfcb,0xc9))[_0x098f('0x4f')](handleError(_0x2cbfcb,null));};exports[_0x098f('0x22')]=function(_0x1888dc,_0x1ac930){if(_0x1888dc[_0x098f('0x50')]['id']){delete _0x1888dc[_0x098f('0x50')]['id'];}return db[_0x098f('0x42')][_0x098f('0x46')]({'where':{'id':_0x1888dc['params']['id']}})[_0x098f('0x23')](handleEntityNotFound(_0x1ac930,null))[_0x098f('0x23')](saveUpdates(_0x1888dc[_0x098f('0x50')],null))[_0x098f('0x23')](respondWithResult(_0x1ac930,null))[_0x098f('0x4f')](handleError(_0x1ac930,null));};exports['destroy']=function(_0x30833e,_0x251f49){return db[_0x098f('0x42')][_0x098f('0x46')]({'where':{'id':_0x30833e[_0x098f('0x44')]['id']}})[_0x098f('0x23')](handleEntityNotFound(_0x251f49,null))[_0x098f('0x23')](removeEntity(_0x251f49,null))[_0x098f('0x4f')](handleError(_0x251f49,null));};exports[_0x098f('0x51')]=function(_0x515c68,_0x5e905e){var _0x3dc1ac=0xa;var _0x2a40d7=['join',_0x098f('0x52'),_0x098f('0x53'),'cross_join'];var _0x53d60d={'SUM':_0x098f('0x54'),'COUNT':_0x098f('0x55'),'COUNT DISTINCT':_0x098f('0x56'),'MAX':_0x098f('0x57'),'MIN':'MIN(%s)','AVG':_0x098f('0x58'),'GROUP_CONCAT':_0x098f('0x59'),'GROUP_CONCAT ASC':_0x098f('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3512f0={'SEC_TO_TIME':_0x098f('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x098f('0x5c')};var _0x3a91dd=function(_0x7bc1ee){return!_[_0x098f('0x5d')]([_0x098f('0x5e'),_0x098f('0x5f'),_0x098f('0x60'),_0x098f('0x61')],_0x7bc1ee);};var _0x2eb5ad=function(_0x2c8fd3){if(!_0x2c8fd3||!_0x2c8fd3[_0x098f('0x62')][_0x098f('0x35')]){return'';}for(var _0x5a3764='(',_0x49d501=0x0;_0x49d501<_0x2c8fd3[_0x098f('0x62')][_0x098f('0x35')];_0x49d501+=0x1){_0x49d501>0x0&&(_0x5a3764+='\x20'+_0x2c8fd3['operator']+'\x20');_0x5a3764+=_0x2c8fd3[_0x098f('0x62')][_0x49d501][_0x098f('0x63')]?_0x2eb5ad(_0x2c8fd3['rules'][_0x49d501][_0x098f('0x63')]):_0x2c8fd3[_0x098f('0x62')][_0x49d501][_0x098f('0x64')]+'\x20'+_0x2c8fd3[_0x098f('0x62')][_0x49d501]['condition']+(_0x3a91dd(_0x2c8fd3[_0x098f('0x62')][_0x49d501][_0x098f('0x65')])?'\x20'+_0x2c8fd3[_0x098f('0x62')][_0x49d501][_0x098f('0x66')]:'');}return _0x5a3764+')';};var _0x1e636c={'where':{'id':_0x515c68[_0x098f('0x44')]['id']}},_0x381187,_0x2dbe56,_0x2de95b,_0x2933cd,_0x2d0777;_0x1e636c=_[_0x098f('0x3e')]({},_0x1e636c,_0x515c68['options']);return db[_0x098f('0x42')][_0x098f('0x46')](_0x1e636c)[_0x098f('0x23')](function(_0xb100e6){if(_0xb100e6){_0x381187=_0xb100e6;return _0xb100e6[_0x098f('0x67')]();}return null;})['then'](function(_0x1da5d1){if(_0x1da5d1){if(!_0x1da5d1[_0x098f('0x35')]){throw new db[(_0x098f('0x68'))][(_0x098f('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2dbe56=_0x1da5d1;return db[_0x098f('0x6a')][_0x098f('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x12203c){if(_0x12203c){_0x2de95b=_[_0x098f('0x6c')](_0x12203c,'id');var _0x4de10a;var _0x1e92d1=squel[_0x098f('0x6d')]();_0x1e92d1[_0x098f('0x6e')](_0x381187['table']);for(var _0x2dd6a9=0x0;_0x2dd6a9<_0x2dbe56['length'];_0x2dd6a9+=0x1){_0x4de10a=_0x2dbe56[_0x2dd6a9][_0x098f('0x6f')]?_0x2de95b[_0x2dbe56[_0x2dd6a9][_0x098f('0x6f')]][_0x098f('0x70')]:_0x2dbe56[_0x2dd6a9][_0x098f('0x64')];_0x4de10a=_0x2dbe56[_0x2dd6a9]['function']?_[_0x098f('0x71')](_0x53d60d[_0x2dbe56[_0x2dd6a9][_0x098f('0x72')]],'%s',_0x4de10a):_0x4de10a;_0x4de10a=_0x2dbe56[_0x2dd6a9][_0x098f('0x73')]?_[_0x098f('0x71')](_0x3512f0[_0x2dbe56[_0x2dd6a9]['format']],'%s',_0x4de10a):_0x4de10a;if(_0x2dbe56[_0x2dd6a9]['groupBy']){_0x1e92d1[_0x098f('0x63')](_0x4de10a);}_0x2dbe56[_0x2dd6a9]['orderBy']&&_0x1e92d1['order'](_0x4de10a,_0x2dbe56[_0x2dd6a9][_0x098f('0x74')]===_0x098f('0x75')?![]:!![]);_0x1e92d1[_0x098f('0x64')](_0x4de10a,_0x2dbe56[_0x2dd6a9][_0x098f('0x76')]||_0x4de10a);}if(_0x381187['joins']){_0x381187['joins']=JSON[_0x098f('0x77')](_0x381187['joins']);for(var _0x282718=0x0;_0x282718<_0x381187[_0x098f('0x78')][_0x098f('0x35')];_0x282718+=0x1){if(_0x381187['joins'][_0x282718]['type']&&_[_0x098f('0x5d')](_0x2a40d7,_0x381187[_0x098f('0x78')][_0x282718][_0x098f('0x2d')])&&_0x381187[_0x098f('0x78')][_0x282718][_0x098f('0x79')]&&_0x381187[_0x098f('0x78')][_0x282718]['foreignTable']&&_0x381187[_0x098f('0x78')][_0x282718][_0x098f('0x7a')]){_0x1e92d1[_0x381187[_0x098f('0x78')][_0x282718]['type']](_0x381187['joins'][_0x282718][_0x098f('0x7b')],null,util['format'](_0x098f('0x7c'),_0x381187[_0x098f('0x7d')],_0x381187['joins'][_0x282718][_0x098f('0x79')],_0x381187[_0x098f('0x78')][_0x282718]['foreignTable'],_0x381187[_0x098f('0x78')][_0x282718][_0x098f('0x7a')]));}}}if(_0x381187[_0x098f('0x7e')]){_0x381187[_0x098f('0x7e')]=JSON['parse'](_0x381187[_0x098f('0x7e')]);_0x1e92d1[_0x098f('0x3a')](_0x2eb5ad(_0x381187['conditions'][_0x098f('0x63')]));}_0x2d0777=_0x1e92d1[_0x098f('0x7f')]();_0x1e92d1['limit'](_0x3dc1ac);_0x1e92d1[_0x098f('0x1b')](0x0);logger['debug'](_0x098f('0x80'),_0x1e92d1[_0x098f('0x81')]());return dbH['sequelize']['query'](_0x1e92d1[_0x098f('0x81')](),{'type':dbH[_0x098f('0x82')][_0x098f('0x83')][_0x098f('0x84')]});}})['then'](respondWithResult(_0x5e905e,null))[_0x098f('0x4f')](handleError(_0x5e905e,null));};function runReport(_0x27ba25,_0x48e8e8,_0x337e99){var _0x4cef5f=_0x48e8e8[_0x098f('0x29')];var _0x595c83=0xa;var _0x2c1e5c=[_0x098f('0x85'),_0x098f('0x52'),_0x098f('0x53'),'cross_join'];var _0x53857e={'SUM':'SUM(%s)','COUNT':_0x098f('0x55'),'COUNT DISTINCT':_0x098f('0x56'),'MAX':_0x098f('0x57'),'MIN':_0x098f('0x86'),'AVG':_0x098f('0x58'),'GROUP_CONCAT':_0x098f('0x59'),'GROUP_CONCAT ASC':_0x098f('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2a156d={'SEC_TO_TIME':_0x098f('0x5b'),'DATE':_0x098f('0x87'),'HOUR':_0x098f('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x098f('0x5c')};var _0x248e68=function(_0x3e67aa){return!_[_0x098f('0x5d')]([_0x098f('0x5e'),_0x098f('0x5f'),_0x098f('0x60'),_0x098f('0x61')],_0x3e67aa);};var _0x169e45=function(_0x348383){if(!_0x348383||!_0x348383['rules']['length']){return'';}for(var _0x44c755='(',_0x53aafe=0x0;_0x53aafe<_0x348383[_0x098f('0x62')][_0x098f('0x35')];_0x53aafe+=0x1){_0x53aafe>0x0&&(_0x44c755+='\x20'+_0x348383['operator']+'\x20');_0x44c755+=_0x348383[_0x098f('0x62')][_0x53aafe][_0x098f('0x63')]?_0x169e45(_0x348383['rules'][_0x53aafe][_0x098f('0x63')]):_0x348383['rules'][_0x53aafe]['field']+'\x20'+_0x348383['rules'][_0x53aafe]['condition']+(_0x248e68(_0x348383[_0x098f('0x62')][_0x53aafe][_0x098f('0x65')])?'\x20'+_0x348383[_0x098f('0x62')][_0x53aafe][_0x098f('0x66')]:'');}return _0x44c755+')';};var _0x3ec2d8={'where':{'id':_0x27ba25['id']}},_0x5a8b87,_0x9a0f1b,_0x5ee13f,_0x301ead,_0x3a652a;_0x3ec2d8=_[_0x098f('0x3e')]({},_0x3ec2d8,_0x337e99);return db[_0x098f('0x42')][_0x098f('0x46')](_0x3ec2d8)[_0x098f('0x23')](function(_0x5e8adc){if(_0x5e8adc){_0x5a8b87=_0x5e8adc;return _0x5e8adc[_0x098f('0x67')]();}return null;})['then'](function(_0x106cb2){if(_0x106cb2){if(!_0x106cb2[_0x098f('0x35')]){throw new db[(_0x098f('0x68'))][(_0x098f('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x9a0f1b=_0x106cb2;return db[_0x098f('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x098f('0x23')](function(_0xe389b2){if(_0xe389b2){_0x5ee13f=_[_0x098f('0x6c')](_0xe389b2,'id');var _0x4ec21e;var _0x494c72=squel[_0x098f('0x6d')]();_0x494c72[_0x098f('0x6e')](_0x5a8b87[_0x098f('0x7d')]);for(var _0x29f159=0x0;_0x29f159<_0x9a0f1b[_0x098f('0x35')];_0x29f159+=0x1){_0x4ec21e=_0x9a0f1b[_0x29f159][_0x098f('0x6f')]?_0x5ee13f[_0x9a0f1b[_0x29f159][_0x098f('0x6f')]][_0x098f('0x70')]:_0x9a0f1b[_0x29f159][_0x098f('0x64')];_0x4ec21e=_0x9a0f1b[_0x29f159][_0x098f('0x72')]?_['replace'](_0x53857e[_0x9a0f1b[_0x29f159]['function']],'%s',_0x4ec21e):_0x4ec21e;_0x4ec21e=_0x9a0f1b[_0x29f159][_0x098f('0x73')]?_['replace'](_0x2a156d[_0x9a0f1b[_0x29f159][_0x098f('0x73')]],'%s',_0x4ec21e):_0x4ec21e;if(_0x9a0f1b[_0x29f159]['groupBy']){_0x494c72[_0x098f('0x63')](_0x4ec21e);}_0x9a0f1b[_0x29f159][_0x098f('0x74')]&&_0x494c72[_0x098f('0x38')](_0x4ec21e,_0x9a0f1b[_0x29f159]['orderBy']===_0x098f('0x75')?![]:!![]);_0x494c72[_0x098f('0x64')](_0x4ec21e,_0x9a0f1b[_0x29f159][_0x098f('0x76')]||_0x4ec21e);}if(_0x5a8b87['joins']){_0x5a8b87['joins']=JSON[_0x098f('0x77')](_0x5a8b87['joins']);for(var _0x62d567=0x0;_0x62d567<_0x5a8b87[_0x098f('0x78')]['length'];_0x62d567+=0x1){if(_0x5a8b87[_0x098f('0x78')][_0x62d567][_0x098f('0x2d')]&&_[_0x098f('0x5d')](_0x2c1e5c,_0x5a8b87[_0x098f('0x78')][_0x62d567]['type'])&&_0x5a8b87[_0x098f('0x78')][_0x62d567]['parentKey']&&_0x5a8b87['joins'][_0x62d567][_0x098f('0x7b')]&&_0x5a8b87[_0x098f('0x78')][_0x62d567]['foreignKey']){_0x494c72[_0x5a8b87[_0x098f('0x78')][_0x62d567][_0x098f('0x2d')]](_0x5a8b87[_0x098f('0x78')][_0x62d567][_0x098f('0x7b')],null,util[_0x098f('0x73')](_0x098f('0x7c'),_0x5a8b87[_0x098f('0x7d')],_0x5a8b87['joins'][_0x62d567][_0x098f('0x79')],_0x5a8b87['joins'][_0x62d567][_0x098f('0x7b')],_0x5a8b87[_0x098f('0x78')][_0x62d567][_0x098f('0x7a')]));}}}if(_0x5a8b87['conditions']){_0x5a8b87[_0x098f('0x7e')]=JSON['parse'](_0x5a8b87['conditions']);_0x494c72['where'](_0x169e45(_0x5a8b87['conditions']['group']));}_0x3a652a=_0x494c72[_0x098f('0x7f')]();_0x494c72[_0x098f('0x19')](_0x595c83);_0x494c72['offset'](0x0);return;}})[_0x098f('0x23')](function(){if(_0x48e8e8[_0x098f('0x89')]==='web'){return null;}var _0x17eb31=_['merge'](_0x48e8e8,{'name':_0x48e8e8[_0x098f('0x8a')]||_0x48e8e8['name']||_0x5a8b87[_0x098f('0x29')],'basename':_0x4cef5f,'savename':util[_0x098f('0x73')](_0x098f('0x8b'),_0x48e8e8[_0x098f('0x29')]||_0x5a8b87[_0x098f('0x29')],require(_0x098f('0x8c'))[_0x098f('0x8d')](0x4),_0x48e8e8[_0x098f('0x89')]||_0x098f('0x8e')),'reportId':_0x5a8b87['id'],'reportType':'custom'});return db[_0x098f('0x8f')][_0x098f('0x47')](_0x17eb31,{'raw':!![]});})['then'](function(_0x110269){if(_0x5a8b87[_0x098f('0x7d')]===_0x098f('0x90')){_0x3a652a[_0x098f('0x3a')](_0x5a8b87['table']+_0x098f('0x91'),_0x48e8e8[_0x098f('0x92')],_0x48e8e8[_0x098f('0x93')]);}else{_0x3a652a[_0x098f('0x3a')](_0x5a8b87[_0x098f('0x7d')]+_0x098f('0x94'),_0x48e8e8[_0x098f('0x92')],_0x48e8e8[_0x098f('0x93')]);}if(_0x110269){logger[_0x098f('0x95')]('Run\x20Query:',_0x3a652a[_0x098f('0x81')]());require(_0x098f('0x96'))[_0x098f('0x97')](path[_0x098f('0x85')](__dirname,_0x098f('0x98'),_0x110269[_0x098f('0x89')]),[_0x110269['id'],_0x3a652a[_0x098f('0x81')](),path['join'](__dirname,'../../files/reports',_0x110269['savename']),_0x4cef5f]);return _0x110269;}else{var _0x573bc7=squel['select']();_0x573bc7['from']('('+_0x3a652a[_0x098f('0x81')]()+')',_0x098f('0x99'));_0x573bc7[_0x098f('0x64')](_0x098f('0x9a'),_0x098f('0x1a'));_0x3a652a['limit'](_0x48e8e8[_0x098f('0x19')]||_0x595c83);_0x3a652a[_0x098f('0x1b')](_0x48e8e8[_0x098f('0x1b')]||0x0);return dbH[_0x098f('0x82')]['query'](_0x573bc7[_0x098f('0x81')](),{'type':dbH['sequelize'][_0x098f('0x83')][_0x098f('0x84')]})[_0x098f('0x23')](function(_0x353d3b){if(!_0x353d3b[_0x098f('0x35')]){_0x301ead=0x0;}else{_0x301ead=_0x353d3b[0x0][_0x098f('0x1a')]||0x0;}return dbH[_0x098f('0x82')][_0x098f('0x31')](_0x3a652a[_0x098f('0x81')](),{'type':dbH[_0x098f('0x82')][_0x098f('0x83')][_0x098f('0x84')]});})[_0x098f('0x23')](function(_0x10d68f){return{'rows':_0x10d68f||[],'count':_0x301ead};});}});}exports['run']=function(_0xee08ac,_0x42596d){return runReport(_0xee08ac['params'],_0xee08ac['query'],_0xee08ac[_0x098f('0x45')])['then'](respondWithResult(_0x42596d,null))[_0x098f('0x4f')](handleError(_0x42596d,null));};exports[_0x098f('0x9b')]=runReport;exports[_0x098f('0x31')]=function(_0xa271d3,_0x54f395){var _0x43f05d=0xa;var _0x289b74=[_0x098f('0x85'),_0x098f('0x52'),'right_join',_0x098f('0x9c')];var _0x58e52d={'SUM':_0x098f('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x098f('0x56'),'MAX':_0x098f('0x57'),'MIN':_0x098f('0x86'),'AVG':_0x098f('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x098f('0x5a'),'GROUP_CONCAT DESC':_0x098f('0x9d')};var _0xb2de15={'SEC_TO_TIME':_0x098f('0x5b'),'DATE':_0x098f('0x87'),'HOUR':'HOUR(%s)','ROUND':_0x098f('0x9e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c12fc=function(_0x5a97b5){return!_[_0x098f('0x5d')]([_0x098f('0x5e'),'IS\x20NOT\x20NULL',_0x098f('0x60'),_0x098f('0x61')],_0x5a97b5);};var _0x5aa4ee=function(_0xe14488){if(!_0xe14488||!_0xe14488[_0x098f('0x62')][_0x098f('0x35')]){return'';}for(var _0x4aeda8='(',_0x2b37a8=0x0;_0x2b37a8<_0xe14488['rules'][_0x098f('0x35')];_0x2b37a8+=0x1){_0x2b37a8>0x0&&(_0x4aeda8+='\x20'+_0xe14488[_0x098f('0x9f')]+'\x20');_0x4aeda8+=_0xe14488['rules'][_0x2b37a8]['group']?_0x5aa4ee(_0xe14488[_0x098f('0x62')][_0x2b37a8][_0x098f('0x63')]):_0xe14488[_0x098f('0x62')][_0x2b37a8]['field']+'\x20'+_0xe14488[_0x098f('0x62')][_0x2b37a8][_0x098f('0x65')]+(_0x5c12fc(_0xe14488[_0x098f('0x62')][_0x2b37a8][_0x098f('0x65')])?'\x20'+_0xe14488[_0x098f('0x62')][_0x2b37a8]['value']:'');}return _0x4aeda8+')';};var _0x3602e4={'where':{'id':_0xa271d3['params']['id']}},_0x19107d,_0x148e1c,_0x5ea9b2,_0x1a2e28,_0x3c386e;_0x3602e4=_[_0x098f('0x3e')]({},_0x3602e4,_0xa271d3['options']);return db[_0x098f('0x42')][_0x098f('0x46')](_0x3602e4)[_0x098f('0x23')](function(_0xe2bdd5){if(_0xe2bdd5){_0x19107d=_0xe2bdd5;return _0xe2bdd5['getFields']();}return null;})[_0x098f('0x23')](function(_0x174e9e){if(_0x174e9e){if(!_0x174e9e['length']){throw new db[(_0x098f('0x68'))][(_0x098f('0x69'))](_0x098f('0xa0'),0x193);}_0x148e1c=_0x174e9e;return db[_0x098f('0x6a')][_0x098f('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x1f963d){if(_0x1f963d){_0x5ea9b2=_[_0x098f('0x6c')](_0x1f963d,'id');var _0x185e2b;var _0x3c419a=squel['select']();_0x3c419a[_0x098f('0x6e')](_0x19107d['table']);for(var _0x52dc6a=0x0;_0x52dc6a<_0x148e1c[_0x098f('0x35')];_0x52dc6a+=0x1){_0x185e2b=_0x148e1c[_0x52dc6a][_0x098f('0x6f')]?_0x5ea9b2[_0x148e1c[_0x52dc6a][_0x098f('0x6f')]][_0x098f('0x70')]:_0x148e1c[_0x52dc6a][_0x098f('0x64')];_0x185e2b=_0x148e1c[_0x52dc6a][_0x098f('0x72')]?_['replace'](_0x58e52d[_0x148e1c[_0x52dc6a][_0x098f('0x72')]],'%s',_0x185e2b):_0x185e2b;_0x185e2b=_0x148e1c[_0x52dc6a][_0x098f('0x73')]?_[_0x098f('0x71')](_0xb2de15[_0x148e1c[_0x52dc6a][_0x098f('0x73')]],'%s',_0x185e2b):_0x185e2b;if(_0x148e1c[_0x52dc6a][_0x098f('0xa1')]){_0x3c419a[_0x098f('0x63')](_0x185e2b);}_0x148e1c[_0x52dc6a][_0x098f('0x74')]&&_0x3c419a[_0x098f('0x38')](_0x185e2b,_0x148e1c[_0x52dc6a][_0x098f('0x74')]===_0x098f('0x75')?![]:!![]);_0x3c419a[_0x098f('0x64')](_0x185e2b,_0x148e1c[_0x52dc6a][_0x098f('0x76')]||_0x185e2b);}if(_0x19107d[_0x098f('0x78')]){_0x19107d['joins']=JSON[_0x098f('0x77')](_0x19107d[_0x098f('0x78')]);for(var _0x5154fe=0x0;_0x5154fe<_0x19107d[_0x098f('0x78')]['length'];_0x5154fe+=0x1){if(_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x2d')]&&_[_0x098f('0x5d')](_0x289b74,_0x19107d[_0x098f('0x78')][_0x5154fe]['type'])&&_0x19107d[_0x098f('0x78')][_0x5154fe]['parentKey']&&_0x19107d[_0x098f('0x78')][_0x5154fe]['foreignTable']&&_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x7a')]){_0x3c419a[_0x19107d['joins'][_0x5154fe]['type']](_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x7b')],null,util[_0x098f('0x73')](_0x098f('0x7c'),_0x19107d[_0x098f('0x7d')],_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x79')],_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x7b')],_0x19107d[_0x098f('0x78')][_0x5154fe][_0x098f('0x7a')]));}}}if(_0x19107d[_0x098f('0x7e')]){_0x19107d['conditions']=JSON[_0x098f('0x77')](_0x19107d['conditions']);_0x3c419a[_0x098f('0x3a')](_0x5aa4ee(_0x19107d['conditions'][_0x098f('0x63')]));}_0x3c386e=_0x3c419a[_0x098f('0x7f')]();_0x3c419a[_0x098f('0x19')](_0x43f05d);_0x3c419a[_0x098f('0x1b')](0x0);logger[_0x098f('0xa2')](_0x098f('0x80'),_0x3c419a[_0x098f('0x81')]());return dbH[_0x098f('0x82')][_0x098f('0x31')](_0x3c419a[_0x098f('0x81')](),{'type':dbH[_0x098f('0x82')][_0x098f('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x3c386e[_0x098f('0x81')]()};})[_0x098f('0x23')](respondWithResult(_0x54f395,null))[_0x098f('0x4f')](handleError(_0x54f395,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 73ab72f..e321b15 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 _0x92a3=['../../config/logger','moment','bluebird','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','util'];(function(_0x3ff1ac,_0xd050bc){var _0x45dd93=function(_0x4d03c0){while(--_0x4d03c0){_0x3ff1ac['push'](_0x3ff1ac['shift']());}};_0x45dd93(++_0xd050bc);}(_0x92a3,0x120));var _0x392a=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x92a3[_0x2fe959];return _0x2f6ace;};'use strict';var _=require(_0x392a('0x0'));var util=require(_0x392a('0x1'));var logger=require(_0x392a('0x2'))('api');var moment=require(_0x392a('0x3'));var BPromise=require(_0x392a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x392a('0x5'));var config=require('../../config/environment');var attributes=require(_0x392a('0x6'));module[_0x392a('0x7')]=function(_0x5e6304,_0x18f678){return _0x5e6304[_0x392a('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x392a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf48f=['bluebird','rimraf','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','api','moment'];(function(_0x3cba3,_0x63a5ca){var _0x23ed82=function(_0x3dc674){while(--_0x3dc674){_0x3cba3['push'](_0x3cba3['shift']());}};_0x23ed82(++_0x63a5ca);}(_0xf48f,0xb1));var _0xff48=function(_0x4eb4c8,_0x4fa385){_0x4eb4c8=_0x4eb4c8-0x0;var _0x48a424=_0xf48f[_0x4eb4c8];return _0x48a424;};'use strict';var _=require(_0xff48('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff48('0x1'));var moment=require(_0xff48('0x2'));var BPromise=require(_0xff48('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff48('0x4'));var config=require('../../config/environment');var attributes=require(_0xff48('0x5'));module[_0xff48('0x6')]=function(_0x6e2c27,_0x477ecb){return _0x6e2c27[_0xff48('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0xff48('0x8'),'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 ffda135..6ec3b69 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 _0xc20a=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x25be63,_0x4b335e){var _0x4daaa8=function(_0x4b7f37){while(--_0x4b7f37){_0x25be63['push'](_0x25be63['shift']());}};_0x4daaa8(++_0x4b335e);}(_0xc20a,0xb6));var _0xac20=function(_0x1dd630,_0x164609){_0x1dd630=_0x1dd630-0x0;var _0x595feb=_0xc20a[_0x1dd630];return _0x595feb;};'use strict';var _=require(_0xac20('0x0'));var util=require(_0xac20('0x1'));var moment=require(_0xac20('0x2'));var BPromise=require(_0xac20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac20('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac20('0x5'))(_0xac20('0x6'));var config=require('../../config/environment');var jayson=require(_0xac20('0x7'));var client=jayson[_0xac20('0x8')][_0xac20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569566,_0x1d61c2,_0x48fce9){return new BPromise(function(_0x411def,_0x1912b9){return client[_0xac20('0xa')](_0x569566,_0x48fce9)[_0xac20('0xb')](function(_0x596aab){logger[_0xac20('0xc')](_0xac20('0xd'),_0x1d61c2,_0xac20('0xe'));logger[_0xac20('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1d61c2,_0xac20('0xe'),JSON['stringify'](_0x596aab));if(_0x596aab['error']){if(_0x596aab['error']['code']===0x1f4){logger[_0xac20('0x10')](_0xac20('0xd'),_0x1d61c2,_0x596aab['error']['message']);return _0x1912b9(_0x596aab[_0xac20('0x10')][_0xac20('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x1d61c2,_0x596aab[_0xac20('0x10')][_0xac20('0x11')]);return _0x411def(_0x596aab[_0xac20('0x10')][_0xac20('0x11')]);}else{logger[_0xac20('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1d61c2,_0xac20('0xe'));_0x411def(_0x596aab['result'][_0xac20('0x11')]);}})[_0xac20('0x12')](function(_0x4dbe60){logger[_0xac20('0x10')](_0xac20('0xd'),_0x1d61c2,_0x4dbe60);_0x1912b9(_0x4dbe60);});});} \ No newline at end of file +var _0x4648=['then','info','debug','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x4648,0x6e));var _0x8464=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x4648[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x8464('0x0'));var util=require(_0x8464('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8464('0x2'));var fs=require('fs');var Redis=require(_0x8464('0x3'));var db=require(_0x8464('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8464('0x5'));var config=require(_0x8464('0x6'));var jayson=require(_0x8464('0x7'));var client=jayson[_0x8464('0x8')][_0x8464('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35d976,_0x1dce4a,_0x4763ec){return new BPromise(function(_0x1f3830,_0x3d9f0f){return client['request'](_0x35d976,_0x4763ec)[_0x8464('0xa')](function(_0x57ec3d){logger[_0x8464('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1dce4a,'request\x20sent');logger[_0x8464('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1dce4a,_0x8464('0xd'),JSON[_0x8464('0xe')](_0x57ec3d));if(_0x57ec3d['error']){if(_0x57ec3d[_0x8464('0xf')][_0x8464('0x10')]===0x1f4){logger[_0x8464('0xf')](_0x8464('0x11'),_0x1dce4a,_0x57ec3d[_0x8464('0xf')][_0x8464('0x12')]);return _0x3d9f0f(_0x57ec3d[_0x8464('0xf')][_0x8464('0x12')]);}logger[_0x8464('0xf')](_0x8464('0x11'),_0x1dce4a,_0x57ec3d[_0x8464('0xf')]['message']);return _0x1f3830(_0x57ec3d[_0x8464('0xf')][_0x8464('0x12')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x1dce4a,'request\x20sent');_0x1f3830(_0x57ec3d[_0x8464('0x13')][_0x8464('0x12')]);}})['catch'](function(_0x4ad121){logger['error'](_0x8464('0x11'),_0x1dce4a,_0x4ad121);_0x3d9f0f(_0x4ad121);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3d592ee..0629485 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 _0x904c=['index','get','/:id','show','/:id/preview','run','/:id/query','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated'];(function(_0xb39f22,_0x41eb24){var _0x4455ff=function(_0x8e182c){while(--_0x8e182c){_0xb39f22['push'](_0xb39f22['shift']());}};_0x4455ff(++_0x41eb24);}(_0x904c,0x1d9));var _0xc904=function(_0x4a85e1,_0x14f9c1){_0x4a85e1=_0x4a85e1-0x0;var _0x4300b7=_0x904c[_0x4a85e1];return _0x4300b7;};'use strict';var multer=require(_0xc904('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc904('0x1'));var express=require(_0xc904('0x2'));var router=express[_0xc904('0x3')]();var fs_extra=require(_0xc904('0x4'));var auth=require(_0xc904('0x5'));var interaction=require(_0xc904('0x6'));var config=require(_0xc904('0x7'));var controller=require(_0xc904('0x8'));router['get']('/',auth[_0xc904('0x9')](),controller[_0xc904('0xa')]);router[_0xc904('0xb')](_0xc904('0xc'),auth['isAuthenticated'](),controller[_0xc904('0xd')]);router[_0xc904('0xb')](_0xc904('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xc904('0xb')]('/:id/run',auth[_0xc904('0x9')](),controller[_0xc904('0xf')]);router[_0xc904('0xb')](_0xc904('0x10'),auth[_0xc904('0x9')](),controller['query']);router['post']('/',auth[_0xc904('0x9')](),controller[_0xc904('0x11')]);router[_0xc904('0x12')]('/:id',auth[_0xc904('0x9')](),controller[_0xc904('0x13')]);router[_0xc904('0x14')](_0xc904('0xc'),auth[_0xc904('0x9')](),controller[_0xc904('0x15')]);module[_0xc904('0x16')]=router; \ No newline at end of file +var _0xb5f3=['/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4fb5fc,_0x8f539b){var _0xfb187=function(_0x2d9e45){while(--_0x2d9e45){_0x4fb5fc['push'](_0x4fb5fc['shift']());}};_0xfb187(++_0x8f539b);}(_0xb5f3,0x1c3));var _0x3b5f=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xb5f3[_0x439d59];return _0x3670c7;};'use strict';var multer=require(_0x3b5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3b5f('0x1'));var express=require(_0x3b5f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b5f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3b5f('0x4'));var controller=require(_0x3b5f('0x5'));router[_0x3b5f('0x6')]('/',auth[_0x3b5f('0x7')](),controller[_0x3b5f('0x8')]);router[_0x3b5f('0x6')](_0x3b5f('0x9'),auth[_0x3b5f('0x7')](),controller[_0x3b5f('0xa')]);router['get']('/:id/preview',auth[_0x3b5f('0x7')](),controller['preview']);router[_0x3b5f('0x6')](_0x3b5f('0xb'),auth[_0x3b5f('0x7')](),controller[_0x3b5f('0xc')]);router[_0x3b5f('0x6')](_0x3b5f('0xd'),auth[_0x3b5f('0x7')](),controller[_0x3b5f('0xe')]);router[_0x3b5f('0xf')]('/',auth['isAuthenticated'](),controller[_0x3b5f('0x10')]);router[_0x3b5f('0x11')](_0x3b5f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3b5f('0x12')](_0x3b5f('0x9'),auth[_0x3b5f('0x7')](),controller[_0x3b5f('0x13')]);module[_0x3b5f('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 225d1b6..2fb9547 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x5cd42a,_0x21a323){var _0x34a0ef=function(_0x22b943){while(--_0x22b943){_0x5cd42a['push'](_0x5cd42a['shift']());}};_0x34a0ef(++_0x21a323);}(_0x6f47,0xc7));var _0x76f4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6f47[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x274854,_0x545b06){var _0x150a58=function(_0x238f4a){while(--_0x238f4a){_0x274854['push'](_0x274854['shift']());}};_0x150a58(++_0x545b06);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x14f751,_0x418f90){_0x14f751=_0x14f751-0x0;var _0x320d37=_0x3f8a[_0x14f751];return _0x320d37;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index de8166f..f54a5d0 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b72a0,_0x4796d3){_0x5b72a0=_0x5b72a0-0x0;var _0x514edd=_0x2ef3[_0x5b72a0];return _0x514edd;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x231857,_0x1ca50c){_0x231857=_0x231857-0x0;var _0x3ec87e=_0xc6ac[_0x231857];return _0x3ec87e;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index c10fe88..aebb6be 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 _0x98f9=['../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x98f9,0x89));var _0x998f=function(_0x22b36e,_0x3dbd6b){_0x22b36e=_0x22b36e-0x0;var _0x6495e0=_0x98f9[_0x22b36e];return _0x6495e0;};'use strict';var _=require(_0x998f('0x0'));var util=require(_0x998f('0x1'));var logger=require(_0x998f('0x2'))(_0x998f('0x3'));var moment=require('moment');var BPromise=require(_0x998f('0x4'));var rp=require(_0x998f('0x5'));var fs=require('fs');var path=require(_0x998f('0x6'));var rimraf=require('rimraf');var config=require(_0x998f('0x7'));var attributes=require(_0x998f('0x8'));module[_0x998f('0x9')]=function(_0xcde580,_0x5bd2af){return _0xcde580[_0x998f('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x998f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69ca=['AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x69ca,0x91));var _0xa69c=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0x69ca[_0x5a2db8];return _0x28b4f8;};'use strict';var _=require(_0xa69c('0x0'));var util=require(_0xa69c('0x1'));var logger=require(_0xa69c('0x2'))(_0xa69c('0x3'));var moment=require(_0xa69c('0x4'));var BPromise=require(_0xa69c('0x5'));var rp=require(_0xa69c('0x6'));var fs=require('fs');var path=require(_0xa69c('0x7'));var rimraf=require(_0xa69c('0x8'));var config=require(_0xa69c('0x9'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x25adce,_0x3d3c57){return _0x25adce[_0xa69c('0xa')](_0xa69c('0xb'),attributes,{'tableName':'analytics_default_reports','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 c6e089a..ceacbd8 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 _0x0e77=['client','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf36aa6,_0x302470){var _0x28c4d3=function(_0x5358a0){while(--_0x5358a0){_0xf36aa6['push'](_0xf36aa6['shift']());}};_0x28c4d3(++_0x302470);}(_0x0e77,0x1af));var _0x70e7=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0e77[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x70e7('0x0'));var moment=require(_0x70e7('0x1'));var BPromise=require(_0x70e7('0x2'));var rs=require(_0x70e7('0x3'));var fs=require('fs');var Redis=require(_0x70e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70e7('0x5'));var logger=require(_0x70e7('0x6'))(_0x70e7('0x7'));var config=require(_0x70e7('0x8'));var jayson=require(_0x70e7('0x9'));var client=jayson[_0x70e7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d36cf,_0x70ee9f,_0x24f599){return new BPromise(function(_0x1483b6,_0x2a32f5){return client[_0x70e7('0xb')](_0x3d36cf,_0x24f599)['then'](function(_0x4c6c9c){logger[_0x70e7('0xc')](_0x70e7('0xd'),_0x70ee9f,_0x70e7('0xe'));logger[_0x70e7('0xf')](_0x70e7('0x10'),_0x70ee9f,'request\x20sent',JSON[_0x70e7('0x11')](_0x4c6c9c));if(_0x4c6c9c[_0x70e7('0x12')]){if(_0x4c6c9c[_0x70e7('0x12')]['code']===0x1f4){logger['error'](_0x70e7('0xd'),_0x70ee9f,_0x4c6c9c[_0x70e7('0x12')][_0x70e7('0x13')]);return _0x2a32f5(_0x4c6c9c[_0x70e7('0x12')][_0x70e7('0x13')]);}logger[_0x70e7('0x12')](_0x70e7('0xd'),_0x70ee9f,_0x4c6c9c[_0x70e7('0x12')][_0x70e7('0x13')]);return _0x1483b6(_0x4c6c9c[_0x70e7('0x12')][_0x70e7('0x13')]);}else{logger[_0x70e7('0xc')](_0x70e7('0xd'),_0x70ee9f,'request\x20sent');_0x1483b6(_0x4c6c9c[_0x70e7('0x14')][_0x70e7('0x13')]);}})['catch'](function(_0x3d3cd7){logger['error'](_0x70e7('0xd'),_0x70ee9f,_0x3d3cd7);_0x2a32f5(_0x3d3cd7);});});} \ No newline at end of file +var _0x6ff3=['code','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b6b89,_0x172ec0){var _0x5aa6af=function(_0x19cd5e){while(--_0x19cd5e){_0x2b6b89['push'](_0x2b6b89['shift']());}};_0x5aa6af(++_0x172ec0);}(_0x6ff3,0x1e1));var _0x36ff=function(_0x56ec4b,_0x110a5a){_0x56ec4b=_0x56ec4b-0x0;var _0x45ea8c=_0x6ff3[_0x56ec4b];return _0x45ea8c;};'use strict';var _=require(_0x36ff('0x0'));var util=require('util');var moment=require(_0x36ff('0x1'));var BPromise=require(_0x36ff('0x2'));var rs=require(_0x36ff('0x3'));var fs=require('fs');var Redis=require(_0x36ff('0x4'));var db=require(_0x36ff('0x5'))['db'];var utils=require(_0x36ff('0x6'));var logger=require(_0x36ff('0x7'))(_0x36ff('0x8'));var config=require('../../config/environment');var jayson=require(_0x36ff('0x9'));var client=jayson[_0x36ff('0xa')][_0x36ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x450b08,_0x494f12,_0x573c90){return new BPromise(function(_0x4a76ff,_0x393911){return client[_0x36ff('0xc')](_0x450b08,_0x573c90)[_0x36ff('0xd')](function(_0x5e1380){logger['info'](_0x36ff('0xe'),_0x494f12,_0x36ff('0xf'));logger[_0x36ff('0x10')](_0x36ff('0x11'),_0x494f12,_0x36ff('0xf'),JSON[_0x36ff('0x12')](_0x5e1380));if(_0x5e1380['error']){if(_0x5e1380['error'][_0x36ff('0x13')]===0x1f4){logger[_0x36ff('0x14')](_0x36ff('0xe'),_0x494f12,_0x5e1380['error'][_0x36ff('0x15')]);return _0x393911(_0x5e1380[_0x36ff('0x14')][_0x36ff('0x15')]);}logger[_0x36ff('0x14')](_0x36ff('0xe'),_0x494f12,_0x5e1380[_0x36ff('0x14')][_0x36ff('0x15')]);return _0x4a76ff(_0x5e1380[_0x36ff('0x14')][_0x36ff('0x15')]);}else{logger[_0x36ff('0x16')](_0x36ff('0xe'),_0x494f12,_0x36ff('0xf'));_0x4a76ff(_0x5e1380[_0x36ff('0x17')]['message']);}})[_0x36ff('0x18')](function(_0x5beec6){logger[_0x36ff('0x14')](_0x36ff('0xe'),_0x494f12,_0x5beec6);_0x393911(_0x5beec6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5106dbc..25a71b5 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 _0x4d75=['/:id/query','query','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','index','get','/:id','/:id/preview','isAuthenticated','preview','/:id/run','run'];(function(_0x5659f8,_0x6a299d){var _0x2dc495=function(_0x568307){while(--_0x568307){_0x5659f8['push'](_0x5659f8['shift']());}};_0x2dc495(++_0x6a299d);}(_0x4d75,0x178));var _0x54d7=function(_0x3c28dd,_0x4b2df6){_0x3c28dd=_0x3c28dd-0x0;var _0x55311d=_0x4d75[_0x3c28dd];return _0x55311d;};'use strict';var multer=require(_0x54d7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x54d7('0x1'));var express=require(_0x54d7('0x2'));var router=express[_0x54d7('0x3')]();var fs_extra=require(_0x54d7('0x4'));var auth=require(_0x54d7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x54d7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x54d7('0x7')]);router[_0x54d7('0x8')](_0x54d7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x54d7('0x8')](_0x54d7('0xa'),auth[_0x54d7('0xb')](),controller[_0x54d7('0xc')]);router[_0x54d7('0x8')](_0x54d7('0xd'),auth[_0x54d7('0xb')](),controller[_0x54d7('0xe')]);router['get'](_0x54d7('0xf'),auth[_0x54d7('0xb')](),controller[_0x54d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x54d7('0x11')]);router[_0x54d7('0x12')](_0x54d7('0x9'),auth[_0x54d7('0xb')](),controller[_0x54d7('0x13')]);router[_0x54d7('0x14')](_0x54d7('0x9'),auth[_0x54d7('0xb')](),controller[_0x54d7('0x15')]);module[_0x54d7('0x16')]=router; \ No newline at end of file +var _0x06ae=['isAuthenticated','show','/:id/preview','/:id/query','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id'];(function(_0xcbc5bd,_0x6e7646){var _0x5b23c0=function(_0x13ab6d){while(--_0x13ab6d){_0xcbc5bd['push'](_0xcbc5bd['shift']());}};_0x5b23c0(++_0x6e7646);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xe06a('0x0'));var path=require(_0xe06a('0x1'));var timeout=require(_0xe06a('0x2'));var express=require(_0xe06a('0x3'));var router=express[_0xe06a('0x4')]();var fs_extra=require(_0xe06a('0x5'));var auth=require(_0xe06a('0x6'));var interaction=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe06a('0x9')]);router[_0xe06a('0xa')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller[_0xe06a('0xd')]);router['get'](_0xe06a('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xe06a('0xa')]('/:id/run',auth[_0xe06a('0xc')](),controller['run']);router['get'](_0xe06a('0xf'),auth[_0xe06a('0xc')](),controller['query']);router[_0xe06a('0x10')]('/',auth[_0xe06a('0xc')](),controller['create']);router[_0xe06a('0x11')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller['update']);router[_0xe06a('0x12')](_0xe06a('0xb'),auth[_0xe06a('0xc')](),controller[_0xe06a('0x13')]);module[_0xe06a('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e040df7..9dbe68e 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 _0xedf9=['csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','moment','exports','STRING'];(function(_0x24d41e,_0x503591){var _0x30b964=function(_0x14673b){while(--_0x14673b){_0x24d41e['push'](_0x24d41e['shift']());}};_0x30b964(++_0x503591);}(_0xedf9,0x1cb));var _0x9edf=function(_0x20d970,_0x454832){_0x20d970=_0x20d970-0x0;var _0x5e9c45=_0xedf9[_0x20d970];return _0x5e9c45;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edf('0x0'));module[_0x9edf('0x1')]={'name':{'type':Sequelize[_0x9edf('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x9edf('0x3'),_0x9edf('0x4'),_0x9edf('0x5')),'allowNull':![],'defaultValue':_0x9edf('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x9edf('0x6')]},'endDate':{'type':Sequelize[_0x9edf('0x6')]},'status':{'type':Sequelize[_0x9edf('0x2')],'defaultValue':_0x9edf('0x7')},'type':{'type':Sequelize['ENUM'](_0x9edf('0x8'),_0x9edf('0x9')),'allowNull':![],'defaultValue':_0x9edf('0x8')},'reportId':{'type':Sequelize[_0x9edf('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x9edf('0x2')]}}; \ No newline at end of file +var _0x8381=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x8381,0x17e));var _0x1838=function(_0x2520ac,_0x5eda89){_0x2520ac=_0x2520ac-0x0;var _0x19a8bd=_0x8381[_0x2520ac];return _0x19a8bd;};'use strict';var Sequelize=require(_0x1838('0x0'));var moment=require(_0x1838('0x1'));module[_0x1838('0x2')]={'name':{'type':Sequelize[_0x1838('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x1838('0x4')](_0x1838('0x5'),_0x1838('0x6'),_0x1838('0x7')),'allowNull':![],'defaultValue':_0x1838('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1838('0x8')]},'status':{'type':Sequelize[_0x1838('0x3')],'defaultValue':_0x1838('0x9')},'type':{'type':Sequelize['ENUM'](_0x1838('0xa'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x1838('0xb')]},'reportType':{'type':Sequelize[_0x1838('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 55a6be3..8f65844 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 _0xbadf=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','ExtractedReports','sendStatus','stack','send','map','AnalyticExtractedReport','fieldName','type','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','update','params','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4abeea,_0x497282){var _0x3c525d=function(_0x4f31f7){while(--_0x4f31f7){_0x4abeea['push'](_0x4abeea['shift']());}};_0x3c525d(++_0x497282);}(_0xbadf,0x107));var _0xfbad=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0xbadf[_0x4f3b2d];return _0x3dddfa;};'use strict';var emlformat=require(_0xfbad('0x0'));var rimraf=require(_0xfbad('0x1'));var zipdir=require(_0xfbad('0x2'));var jsonpatch=require(_0xfbad('0x3'));var rp=require(_0xfbad('0x4'));var moment=require('moment');var BPromise=require(_0xfbad('0x5'));var Mustache=require(_0xfbad('0x6'));var util=require(_0xfbad('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfbad('0x8'));var ejs=require(_0xfbad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbad('0xa'));var squel=require(_0xfbad('0xb'));var crypto=require('crypto');var jsforce=require(_0xfbad('0xc'));var deskjs=require(_0xfbad('0xd'));var toCsv=require(_0xfbad('0x8'));var querystring=require('querystring');var Papa=require(_0xfbad('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbad('0xf'));var as=require(_0xfbad('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbad('0x11'))(_0xfbad('0x12'));var utils=require(_0xfbad('0x13'));var config=require(_0xfbad('0x14'));var licenseUtil=require(_0xfbad('0x15'));var db=require(_0xfbad('0x16'))['db'];function respondWithStatusCode(_0x555ccb,_0x9e0b7b){_0x9e0b7b=_0x9e0b7b||0xcc;return function(_0x3ded97){if(_0x3ded97){return _0x555ccb['sendStatus'](_0x9e0b7b);}return _0x555ccb['status'](_0x9e0b7b)[_0xfbad('0x17')]();};}function respondWithResult(_0x2bd142,_0x360410){_0x360410=_0x360410||0xc8;return function(_0x270632){if(_0x270632){return _0x2bd142[_0xfbad('0x18')](_0x360410)[_0xfbad('0x19')](_0x270632);}};}function respondWithFilteredResult(_0x4ff40d,_0x1e3273){return function(_0x57e6b3){if(_0x57e6b3){var _0x144c0e=typeof _0x1e3273[_0xfbad('0x1a')]===_0xfbad('0x1b')&&typeof _0x1e3273[_0xfbad('0x1c')]===_0xfbad('0x1b');var _0xda47d1=_0x57e6b3[_0xfbad('0x1d')];var _0x10c529=_0x144c0e?0x0:_0x1e3273[_0xfbad('0x1a')];var _0xf15a44=_0x144c0e?_0x57e6b3['count']:_0x1e3273[_0xfbad('0x1a')]+_0x1e3273[_0xfbad('0x1c')];var _0x181da4;if(_0xf15a44>=_0xda47d1){_0xf15a44=_0xda47d1;_0x181da4=0xc8;}else{_0x181da4=0xce;}_0x4ff40d[_0xfbad('0x18')](_0x181da4);return _0x4ff40d[_0xfbad('0x1e')](_0xfbad('0x1f'),_0x10c529+'-'+_0xf15a44+'/'+_0xda47d1)[_0xfbad('0x19')](_0x57e6b3);}return null;};}function patchUpdates(_0x36d409){return function(_0x1d39ba){try{jsonpatch[_0xfbad('0x20')](_0x1d39ba,_0x36d409,!![]);}catch(_0x27b7c0){return BPromise[_0xfbad('0x21')](_0x27b7c0);}return _0x1d39ba[_0xfbad('0x22')]();};}function saveUpdates(_0x16a69d,_0xa210ba){return function(_0x64af3b){if(_0x64af3b){return _0x64af3b['update'](_0x16a69d)[_0xfbad('0x23')](function(_0x45ba08){return _0x45ba08;});}return null;};}function removeEntity(_0xd7e5a,_0x1e08f6){return function(_0x499dbf){if(_0x499dbf){return _0x499dbf[_0xfbad('0x24')]()[_0xfbad('0x23')](function(){var _0x119a93=_0x499dbf['get']({'plain':!![]});var _0x8bbb27=_0xfbad('0x25');return db['UserProfileResource'][_0xfbad('0x24')]({'where':{'type':_0x8bbb27,'resourceId':_0x119a93['id']}})['then'](function(){return _0x499dbf;});})[_0xfbad('0x23')](function(){_0xd7e5a['status'](0xcc)[_0xfbad('0x17')]();});}};}function handleEntityNotFound(_0x4112c3,_0x3061e6){return function(_0xe6596e){if(!_0xe6596e){_0x4112c3[_0xfbad('0x26')](0x194);}return _0xe6596e;};}function handleError(_0xf92f09,_0x336f20){_0x336f20=_0x336f20||0x1f4;return function(_0x49a967){logger['error'](_0x49a967[_0xfbad('0x27')]);if(_0x49a967['name']){delete _0x49a967['name'];}_0xf92f09[_0xfbad('0x18')](_0x336f20)[_0xfbad('0x28')](_0x49a967);};}exports['index']=function(_0x18a961,_0x341294){var _0x947db0={},_0x3bafad={},_0x34f074={'count':0x0,'rows':[]};var _0x58e876=_[_0xfbad('0x29')](db[_0xfbad('0x2a')]['rawAttributes'],function(_0x1fd00f){return{'name':_0x1fd00f[_0xfbad('0x2b')],'type':_0x1fd00f[_0xfbad('0x2c')]['key']};});_0x3bafad[_0xfbad('0x2d')]=_['map'](_0x58e876,_0xfbad('0x2e'));_0x3bafad[_0xfbad('0x2f')]=_[_0xfbad('0x30')](_0x18a961[_0xfbad('0x2f')]);_0x3bafad['filters']=_['intersection'](_0x3bafad[_0xfbad('0x2d')],_0x3bafad[_0xfbad('0x2f')]);_0x947db0[_0xfbad('0x31')]=_[_0xfbad('0x32')](_0x3bafad[_0xfbad('0x2d')],qs[_0xfbad('0x33')](_0x18a961['query'][_0xfbad('0x33')]));_0x947db0[_0xfbad('0x31')]=_0x947db0[_0xfbad('0x31')][_0xfbad('0x34')]?_0x947db0[_0xfbad('0x31')]:_0x3bafad[_0xfbad('0x2d')];if(!_0x18a961['query'][_0xfbad('0x35')](_0xfbad('0x36'))){_0x947db0[_0xfbad('0x1c')]=qs['limit'](_0x18a961['query'][_0xfbad('0x1c')]);_0x947db0[_0xfbad('0x1a')]=qs[_0xfbad('0x1a')](_0x18a961[_0xfbad('0x2f')][_0xfbad('0x1a')]);}_0x947db0[_0xfbad('0x37')]=qs[_0xfbad('0x38')](_0x18a961[_0xfbad('0x2f')][_0xfbad('0x38')]);_0x947db0[_0xfbad('0x39')]=qs[_0xfbad('0x3a')](_[_0xfbad('0x3b')](_0x18a961['query'],_0x3bafad['filters']),_0x58e876);if(_0x18a961[_0xfbad('0x2f')]['filter']){_0x947db0[_0xfbad('0x39')]=_[_0xfbad('0x3c')](_0x947db0['where'],{'$or':_['map'](_0x58e876,function(_0xd6028a){if(_0xd6028a[_0xfbad('0x2c')]!==_0xfbad('0x3d')){var _0x6c041f={};_0x6c041f[_0xd6028a[_0xfbad('0x2e')]]={'$like':'%'+_0x18a961[_0xfbad('0x2f')][_0xfbad('0x3e')]+'%'};return _0x6c041f;}})});}_0x947db0=_['merge']({},_0x947db0,_0x18a961[_0xfbad('0x3f')]);var _0x1b06c5={'where':_0x947db0[_0xfbad('0x39')]};return db[_0xfbad('0x2a')][_0xfbad('0x1d')](_0x1b06c5)[_0xfbad('0x23')](function(_0x271c79){_0x34f074[_0xfbad('0x1d')]=_0x271c79;if(_0x18a961['query']['includeAll']){_0x947db0[_0xfbad('0x40')]=[{'all':!![]}];}return db[_0xfbad('0x2a')][_0xfbad('0x41')](_0x947db0);})[_0xfbad('0x23')](function(_0x50019e){_0x34f074[_0xfbad('0x42')]=_0x50019e;return _0x34f074;})[_0xfbad('0x23')](respondWithFilteredResult(_0x341294,_0x947db0))[_0xfbad('0x43')](handleError(_0x341294,null));};exports[_0xfbad('0x44')]=function(_0x408692,_0x1d5de0){var _0x51a7c5={'raw':!![],'where':{'id':_0x408692['params']['id']}},_0x307319={};_0x307319[_0xfbad('0x2d')]=_[_0xfbad('0x30')](db[_0xfbad('0x2a')][_0xfbad('0x45')]);_0x307319['query']=_[_0xfbad('0x30')](_0x408692['query']);_0x307319[_0xfbad('0x3a')]=_[_0xfbad('0x32')](_0x307319[_0xfbad('0x2d')],_0x307319['query']);_0x51a7c5[_0xfbad('0x31')]=_['intersection'](_0x307319[_0xfbad('0x2d')],qs[_0xfbad('0x33')](_0x408692['query']['fields']));_0x51a7c5[_0xfbad('0x31')]=_0x51a7c5['attributes']['length']?_0x51a7c5['attributes']:_0x307319['model'];if(_0x408692['query']['includeAll']){_0x51a7c5[_0xfbad('0x40')]=[{'all':!![]}];}_0x51a7c5=_['merge']({},_0x51a7c5,_0x408692[_0xfbad('0x3f')]);return db[_0xfbad('0x2a')][_0xfbad('0x46')](_0x51a7c5)[_0xfbad('0x23')](handleEntityNotFound(_0x1d5de0,null))['then'](respondWithResult(_0x1d5de0,null))[_0xfbad('0x43')](handleError(_0x1d5de0,null));};exports['create']=function(_0x3e37a1,_0x1f3d2b){return db[_0xfbad('0x2a')][_0xfbad('0x47')](_0x3e37a1[_0xfbad('0x48')],{})[_0xfbad('0x23')](function(_0x255830){var _0x403a8e=_0x3e37a1['user'][_0xfbad('0x49')]({'plain':!![]});if(!_0x403a8e)throw new Error(_0xfbad('0x4a'));if(_0x403a8e[_0xfbad('0x4b')]===_0xfbad('0x4c')){var _0x1065e4=_0x255830['get']({'plain':!![]});var _0x5d4a5c=_0xfbad('0x25');return db[_0xfbad('0x4d')]['find']({'where':{'name':_0x5d4a5c,'userProfileId':_0x403a8e[_0xfbad('0x4e')]},'raw':!![]})[_0xfbad('0x23')](function(_0x2bf5f2){if(_0x2bf5f2&&_0x2bf5f2[_0xfbad('0x4f')]===0x0){return db['UserProfileResource'][_0xfbad('0x47')]({'name':_0x1065e4[_0xfbad('0x2e')],'resourceId':_0x1065e4['id'],'type':_0x2bf5f2[_0xfbad('0x2e')],'sectionId':_0x2bf5f2['id']},{})[_0xfbad('0x23')](function(){return _0x255830;});}else{return _0x255830;}})[_0xfbad('0x43')](function(_0x335b95){logger[_0xfbad('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x335b95);throw _0x335b95;});}return _0x255830;})[_0xfbad('0x23')](respondWithResult(_0x1f3d2b,0xc9))[_0xfbad('0x43')](handleError(_0x1f3d2b,null));};exports[_0xfbad('0x51')]=function(_0x4aa1da,_0x43db94){if(_0x4aa1da[_0xfbad('0x48')]['id']){delete _0x4aa1da[_0xfbad('0x48')]['id'];}return db[_0xfbad('0x2a')][_0xfbad('0x46')]({'where':{'id':_0x4aa1da[_0xfbad('0x52')]['id']}})['then'](handleEntityNotFound(_0x43db94,null))[_0xfbad('0x23')](saveUpdates(_0x4aa1da[_0xfbad('0x48')],null))[_0xfbad('0x23')](respondWithResult(_0x43db94,null))[_0xfbad('0x43')](handleError(_0x43db94,null));};exports[_0xfbad('0x24')]=function(_0x2a3bb7,_0x288fb5){return db['AnalyticExtractedReport'][_0xfbad('0x46')]({'where':{'id':_0x2a3bb7[_0xfbad('0x52')]['id']}})[_0xfbad('0x23')](handleEntityNotFound(_0x288fb5,null))[_0xfbad('0x23')](removeEntity(_0x288fb5,null))[_0xfbad('0x43')](handleError(_0x288fb5,null));};exports['download']=function(_0x42ad4a,_0x4b96af,_0x50e9a7){return db[_0xfbad('0x2a')][_0xfbad('0x46')]({'where':{'id':_0x42ad4a['params']['id']},'attributes':[_0xfbad('0x2e'),_0xfbad('0x53'),_0xfbad('0x54'),_0xfbad('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x4b96af,null))[_0xfbad('0x23')](function(_0x3c6bb3){if(_0x3c6bb3){if(!fs[_0xfbad('0x56')](path[_0xfbad('0x57')](config[_0xfbad('0x58')],_0xfbad('0x59'),_0x3c6bb3[_0xfbad('0x54')]))){throw new db[(_0xfbad('0x5a'))][(_0xfbad('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x42ad4a[_0xfbad('0x2f')]['exists']){return _0x4b96af[_0xfbad('0x26')](0xc8);}return _0x4b96af['download'](path[_0xfbad('0x57')](config['root'],'server/files/reports',_0x3c6bb3[_0xfbad('0x54')]),util['format'](_0xfbad('0x5c'),_0x3c6bb3[_0xfbad('0x53')]||_0x3c6bb3[_0xfbad('0x2e')],_0x3c6bb3[_0xfbad('0x55')][_0xfbad('0x5d')]()));}})[_0xfbad('0x43')](handleError(_0x4b96af,null));}; \ No newline at end of file +var _0x3735=['name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','ExtractedReports','UserProfileResource','stack'];(function(_0x3c6cd5,_0x46bbfd){var _0x3b46d8=function(_0x30772e){while(--_0x30772e){_0x3c6cd5['push'](_0x3c6cd5['shift']());}};_0x3b46d8(++_0x46bbfd);}(_0x3735,0xe3));var _0x5373=function(_0x57c2f6,_0x1ee1bf){_0x57c2f6=_0x57c2f6-0x0;var _0x1cbd95=_0x3735[_0x57c2f6];return _0x1cbd95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5373('0x0'));var zipdir=require(_0x5373('0x1'));var jsonpatch=require(_0x5373('0x2'));var rp=require(_0x5373('0x3'));var moment=require(_0x5373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5373('0x5'));var util=require(_0x5373('0x6'));var path=require(_0x5373('0x7'));var sox=require(_0x5373('0x8'));var csv=require(_0x5373('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5373('0xa'));var _=require(_0x5373('0xb'));var squel=require(_0x5373('0xc'));var crypto=require(_0x5373('0xd'));var jsforce=require(_0x5373('0xe'));var deskjs=require(_0x5373('0xf'));var toCsv=require(_0x5373('0x9'));var querystring=require('querystring');var Papa=require(_0x5373('0x10'));var Redis=require(_0x5373('0x11'));var authService=require(_0x5373('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5373('0x13'));var hardwareService=require(_0x5373('0x14'));var logger=require(_0x5373('0x15'))(_0x5373('0x16'));var utils=require(_0x5373('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5373('0x18'))['db'];function respondWithStatusCode(_0x2e286c,_0x21de5c){_0x21de5c=_0x21de5c||0xcc;return function(_0x2bf296){if(_0x2bf296){return _0x2e286c[_0x5373('0x19')](_0x21de5c);}return _0x2e286c[_0x5373('0x1a')](_0x21de5c)[_0x5373('0x1b')]();};}function respondWithResult(_0x4082a6,_0x20e6a7){_0x20e6a7=_0x20e6a7||0xc8;return function(_0x11f40d){if(_0x11f40d){return _0x4082a6['status'](_0x20e6a7)['json'](_0x11f40d);}};}function respondWithFilteredResult(_0x4a8487,_0x75d00b){return function(_0x26ca3c){if(_0x26ca3c){var _0x5d2b73=typeof _0x75d00b[_0x5373('0x1c')]===_0x5373('0x1d')&&typeof _0x75d00b[_0x5373('0x1e')]===_0x5373('0x1d');var _0x3e6411=_0x26ca3c['count'];var _0x3a7c16=_0x5d2b73?0x0:_0x75d00b['offset'];var _0x12a957=_0x5d2b73?_0x26ca3c[_0x5373('0x1f')]:_0x75d00b['offset']+_0x75d00b[_0x5373('0x1e')];var _0x1d9503;if(_0x12a957>=_0x3e6411){_0x12a957=_0x3e6411;_0x1d9503=0xc8;}else{_0x1d9503=0xce;}_0x4a8487['status'](_0x1d9503);return _0x4a8487['set'](_0x5373('0x20'),_0x3a7c16+'-'+_0x12a957+'/'+_0x3e6411)['json'](_0x26ca3c);}return null;};}function patchUpdates(_0x30c675){return function(_0xb88268){try{jsonpatch['apply'](_0xb88268,_0x30c675,!![]);}catch(_0x277243){return BPromise[_0x5373('0x21')](_0x277243);}return _0xb88268['save']();};}function saveUpdates(_0x4a7f30,_0x1a189a){return function(_0x2d8cd1){if(_0x2d8cd1){return _0x2d8cd1[_0x5373('0x22')](_0x4a7f30)[_0x5373('0x23')](function(_0x4f044c){return _0x4f044c;});}return null;};}function removeEntity(_0x32487a,_0x3bb9a3){return function(_0x41dc25){if(_0x41dc25){return _0x41dc25[_0x5373('0x24')]()[_0x5373('0x23')](function(){var _0x3d1147=_0x41dc25['get']({'plain':!![]});var _0x360196=_0x5373('0x25');return db[_0x5373('0x26')][_0x5373('0x24')]({'where':{'type':_0x360196,'resourceId':_0x3d1147['id']}})[_0x5373('0x23')](function(){return _0x41dc25;});})[_0x5373('0x23')](function(){_0x32487a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd867,_0x3a0482){return function(_0x53a821){if(!_0x53a821){_0x2fd867[_0x5373('0x19')](0x194);}return _0x53a821;};}function handleError(_0x4b9ac9,_0x17da16){_0x17da16=_0x17da16||0x1f4;return function(_0x1f05df){logger['error'](_0x1f05df[_0x5373('0x27')]);if(_0x1f05df[_0x5373('0x28')]){delete _0x1f05df[_0x5373('0x28')];}_0x4b9ac9[_0x5373('0x1a')](_0x17da16)['send'](_0x1f05df);};}exports[_0x5373('0x29')]=function(_0x8c417b,_0x3a99aa){var _0x39f692={},_0x469740={},_0x1bcce4={'count':0x0,'rows':[]};var _0x16ba58=_[_0x5373('0x2a')](db[_0x5373('0x2b')][_0x5373('0x2c')],function(_0x5889cc){return{'name':_0x5889cc[_0x5373('0x2d')],'type':_0x5889cc[_0x5373('0x2e')][_0x5373('0x2f')]};});_0x469740[_0x5373('0x30')]=_[_0x5373('0x2a')](_0x16ba58,_0x5373('0x28'));_0x469740[_0x5373('0x31')]=_[_0x5373('0x32')](_0x8c417b[_0x5373('0x31')]);_0x469740[_0x5373('0x33')]=_[_0x5373('0x34')](_0x469740[_0x5373('0x30')],_0x469740[_0x5373('0x31')]);_0x39f692[_0x5373('0x35')]=_[_0x5373('0x34')](_0x469740[_0x5373('0x30')],qs[_0x5373('0x36')](_0x8c417b['query'][_0x5373('0x36')]));_0x39f692[_0x5373('0x35')]=_0x39f692[_0x5373('0x35')][_0x5373('0x37')]?_0x39f692[_0x5373('0x35')]:_0x469740[_0x5373('0x30')];if(!_0x8c417b['query'][_0x5373('0x38')]('nolimit')){_0x39f692[_0x5373('0x1e')]=qs['limit'](_0x8c417b[_0x5373('0x31')][_0x5373('0x1e')]);_0x39f692['offset']=qs[_0x5373('0x1c')](_0x8c417b[_0x5373('0x31')][_0x5373('0x1c')]);}_0x39f692['order']=qs[_0x5373('0x39')](_0x8c417b[_0x5373('0x31')][_0x5373('0x39')]);_0x39f692[_0x5373('0x3a')]=qs[_0x5373('0x33')](_[_0x5373('0x3b')](_0x8c417b[_0x5373('0x31')],_0x469740['filters']),_0x16ba58);if(_0x8c417b[_0x5373('0x31')]['filter']){_0x39f692['where']=_['merge'](_0x39f692[_0x5373('0x3a')],{'$or':_[_0x5373('0x2a')](_0x16ba58,function(_0x375967){if(_0x375967[_0x5373('0x2e')]!==_0x5373('0x3c')){var _0x2c9d5e={};_0x2c9d5e[_0x375967[_0x5373('0x28')]]={'$like':'%'+_0x8c417b[_0x5373('0x31')][_0x5373('0x3d')]+'%'};return _0x2c9d5e;}})});}_0x39f692=_['merge']({},_0x39f692,_0x8c417b[_0x5373('0x3e')]);var _0x599c26={'where':_0x39f692[_0x5373('0x3a')]};return db[_0x5373('0x2b')][_0x5373('0x1f')](_0x599c26)['then'](function(_0x397f79){_0x1bcce4[_0x5373('0x1f')]=_0x397f79;if(_0x8c417b[_0x5373('0x31')][_0x5373('0x3f')]){_0x39f692[_0x5373('0x40')]=[{'all':!![]}];}return db[_0x5373('0x2b')][_0x5373('0x41')](_0x39f692);})['then'](function(_0x3b61c6){_0x1bcce4['rows']=_0x3b61c6;return _0x1bcce4;})[_0x5373('0x23')](respondWithFilteredResult(_0x3a99aa,_0x39f692))[_0x5373('0x42')](handleError(_0x3a99aa,null));};exports[_0x5373('0x43')]=function(_0x1a2a2f,_0x44bd46){var _0x474363={'raw':!![],'where':{'id':_0x1a2a2f[_0x5373('0x44')]['id']}},_0x5e8d4c={};_0x5e8d4c[_0x5373('0x30')]=_[_0x5373('0x32')](db[_0x5373('0x2b')]['rawAttributes']);_0x5e8d4c[_0x5373('0x31')]=_[_0x5373('0x32')](_0x1a2a2f[_0x5373('0x31')]);_0x5e8d4c[_0x5373('0x33')]=_[_0x5373('0x34')](_0x5e8d4c['model'],_0x5e8d4c[_0x5373('0x31')]);_0x474363[_0x5373('0x35')]=_[_0x5373('0x34')](_0x5e8d4c['model'],qs[_0x5373('0x36')](_0x1a2a2f[_0x5373('0x31')][_0x5373('0x36')]));_0x474363[_0x5373('0x35')]=_0x474363['attributes']['length']?_0x474363['attributes']:_0x5e8d4c['model'];if(_0x1a2a2f[_0x5373('0x31')][_0x5373('0x3f')]){_0x474363[_0x5373('0x40')]=[{'all':!![]}];}_0x474363=_['merge']({},_0x474363,_0x1a2a2f[_0x5373('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x474363)[_0x5373('0x23')](handleEntityNotFound(_0x44bd46,null))[_0x5373('0x23')](respondWithResult(_0x44bd46,null))[_0x5373('0x42')](handleError(_0x44bd46,null));};exports['create']=function(_0x4e34cc,_0x1ee87e){return db[_0x5373('0x2b')][_0x5373('0x45')](_0x4e34cc[_0x5373('0x46')],{})[_0x5373('0x23')](function(_0x72cb0a){var _0x2e1be6=_0x4e34cc['user']['get']({'plain':!![]});if(!_0x2e1be6)throw new Error(_0x5373('0x47'));if(_0x2e1be6[_0x5373('0x48')]==='user'){var _0x2816cb=_0x72cb0a['get']({'plain':!![]});var _0x9d3a74=_0x5373('0x25');return db[_0x5373('0x49')][_0x5373('0x4a')]({'where':{'name':_0x9d3a74,'userProfileId':_0x2e1be6[_0x5373('0x4b')]},'raw':!![]})['then'](function(_0x1756f1){if(_0x1756f1&&_0x1756f1[_0x5373('0x4c')]===0x0){return db['UserProfileResource'][_0x5373('0x45')]({'name':_0x2816cb[_0x5373('0x28')],'resourceId':_0x2816cb['id'],'type':_0x1756f1[_0x5373('0x28')],'sectionId':_0x1756f1['id']},{})['then'](function(){return _0x72cb0a;});}else{return _0x72cb0a;}})[_0x5373('0x42')](function(_0x22d58c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22d58c);throw _0x22d58c;});}return _0x72cb0a;})['then'](respondWithResult(_0x1ee87e,0xc9))[_0x5373('0x42')](handleError(_0x1ee87e,null));};exports[_0x5373('0x22')]=function(_0x2b300e,_0x30a53e){if(_0x2b300e[_0x5373('0x46')]['id']){delete _0x2b300e[_0x5373('0x46')]['id'];}return db[_0x5373('0x2b')][_0x5373('0x4a')]({'where':{'id':_0x2b300e[_0x5373('0x44')]['id']}})[_0x5373('0x23')](handleEntityNotFound(_0x30a53e,null))[_0x5373('0x23')](saveUpdates(_0x2b300e[_0x5373('0x46')],null))[_0x5373('0x23')](respondWithResult(_0x30a53e,null))[_0x5373('0x42')](handleError(_0x30a53e,null));};exports['destroy']=function(_0x466a3c,_0x532212){return db[_0x5373('0x2b')][_0x5373('0x4a')]({'where':{'id':_0x466a3c[_0x5373('0x44')]['id']}})[_0x5373('0x23')](handleEntityNotFound(_0x532212,null))[_0x5373('0x23')](removeEntity(_0x532212,null))[_0x5373('0x42')](handleError(_0x532212,null));};exports[_0x5373('0x4d')]=function(_0x33bd7c,_0x1960e0,_0x4d3db1){return db[_0x5373('0x2b')][_0x5373('0x4a')]({'where':{'id':_0x33bd7c['params']['id']},'attributes':[_0x5373('0x28'),_0x5373('0x4e'),_0x5373('0x4f'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x1960e0,null))['then'](function(_0x4af4dc){if(_0x4af4dc){if(!fs[_0x5373('0x50')](path['join'](config[_0x5373('0x51')],_0x5373('0x52'),_0x4af4dc[_0x5373('0x4f')]))){throw new db[(_0x5373('0x53'))][(_0x5373('0x54'))](_0x5373('0x55'));}if(_0x33bd7c[_0x5373('0x31')][_0x5373('0x56')]){return _0x1960e0[_0x5373('0x19')](0xc8);}return _0x1960e0[_0x5373('0x4d')](path['join'](config[_0x5373('0x51')],_0x5373('0x52'),_0x4af4dc[_0x5373('0x4f')]),util['format'](_0x5373('0x57'),_0x4af4dc[_0x5373('0x4e')]||_0x4af4dc[_0x5373('0x28')],_0x4af4dc[_0x5373('0x58')]['toLowerCase']()));}})[_0x5373('0x42')](handleError(_0x1960e0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a311916..c3dbaa1 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 _0x4ca4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x13877c,_0x13b3e8){var _0x333fd5=function(_0x1e69de){while(--_0x1e69de){_0x13877c['push'](_0x13877c['shift']());}};_0x333fd5(++_0x13b3e8);}(_0x4ca4,0x16a));var _0x44ca=function(_0x5c3d11,_0x70231c){_0x5c3d11=_0x5c3d11-0x0;var _0xad6cea=_0x4ca4[_0x5c3d11];return _0xad6cea;};'use strict';var _=require(_0x44ca('0x0'));var util=require(_0x44ca('0x1'));var logger=require(_0x44ca('0x2'))(_0x44ca('0x3'));var moment=require(_0x44ca('0x4'));var BPromise=require(_0x44ca('0x5'));var rp=require(_0x44ca('0x6'));var fs=require('fs');var path=require(_0x44ca('0x7'));var rimraf=require(_0x44ca('0x8'));var config=require(_0x44ca('0x9'));var attributes=require(_0x44ca('0xa'));module[_0x44ca('0xb')]=function(_0x660fc0,_0x3ad88b){return _0x660fc0[_0x44ca('0xc')]('AnalyticExtractedReport',attributes,{'tableName':_0x44ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5be9=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','util','api','moment','bluebird','rimraf'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5be9,0x1cf));var _0x95be=function(_0x2f39fa,_0x2de0fe){_0x2f39fa=_0x2f39fa-0x0;var _0x4f1bc2=_0x5be9[_0x2f39fa];return _0x4f1bc2;};'use strict';var _=require('lodash');var util=require(_0x95be('0x0'));var logger=require('../../config/logger')(_0x95be('0x1'));var moment=require(_0x95be('0x2'));var BPromise=require(_0x95be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95be('0x4'));var config=require('../../config/environment');var attributes=require(_0x95be('0x5'));module[_0x95be('0x6')]=function(_0x27ddae,_0x2f19ae){return _0x27ddae[_0x95be('0x7')](_0x95be('0x8'),attributes,{'tableName':'analytics_extracted_reports','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 f488ef9..7be92a5 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 _0x9f6d=['debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1fa68f,_0x27d664){var _0x22f98d=function(_0x125b09){while(--_0x125b09){_0x1fa68f['push'](_0x1fa68f['shift']());}};_0x22f98d(++_0x27d664);}(_0x9f6d,0x140));var _0xd9f6=function(_0x52b1b7,_0x32b7ef){_0x52b1b7=_0x52b1b7-0x0;var _0x1d1899=_0x9f6d[_0x52b1b7];return _0x1d1899;};'use strict';var _=require(_0xd9f6('0x0'));var util=require(_0xd9f6('0x1'));var moment=require(_0xd9f6('0x2'));var BPromise=require(_0xd9f6('0x3'));var rs=require(_0xd9f6('0x4'));var fs=require('fs');var Redis=require(_0xd9f6('0x5'));var db=require(_0xd9f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9f6('0x7'));var config=require(_0xd9f6('0x8'));var jayson=require(_0xd9f6('0x9'));var client=jayson[_0xd9f6('0xa')][_0xd9f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4edd,_0x4df34c,_0x2f839d){return new BPromise(function(_0x4853ae,_0x4aff56){return client[_0xd9f6('0xc')](_0x2f4edd,_0x2f839d)['then'](function(_0x5a12dd){logger[_0xd9f6('0xd')](_0xd9f6('0xe'),_0x4df34c,_0xd9f6('0xf'));logger[_0xd9f6('0x10')](_0xd9f6('0x11'),_0x4df34c,_0xd9f6('0xf'),JSON[_0xd9f6('0x12')](_0x5a12dd));if(_0x5a12dd[_0xd9f6('0x13')]){if(_0x5a12dd['error'][_0xd9f6('0x14')]===0x1f4){logger[_0xd9f6('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4df34c,_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);return _0x4aff56(_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);}logger[_0xd9f6('0x13')](_0xd9f6('0xe'),_0x4df34c,_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);return _0x4853ae(_0x5a12dd[_0xd9f6('0x13')][_0xd9f6('0x15')]);}else{logger[_0xd9f6('0xd')](_0xd9f6('0xe'),_0x4df34c,_0xd9f6('0xf'));_0x4853ae(_0x5a12dd[_0xd9f6('0x16')][_0xd9f6('0x15')]);}})[_0xd9f6('0x17')](function(_0x43afbb){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4df34c,_0x43afbb);_0x4aff56(_0x43afbb);});});} \ No newline at end of file +var _0x1189=['client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ec0e7,_0x28811a){var _0x249bd5=function(_0x55548f){while(--_0x55548f){_0x2ec0e7['push'](_0x2ec0e7['shift']());}};_0x249bd5(++_0x28811a);}(_0x1189,0x193));var _0x9118=function(_0xacf6f0,_0x15c178){_0xacf6f0=_0xacf6f0-0x0;var _0x2c83b4=_0x1189[_0xacf6f0];return _0x2c83b4;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var moment=require('moment');var BPromise=require(_0x9118('0x2'));var rs=require(_0x9118('0x3'));var fs=require('fs');var Redis=require(_0x9118('0x4'));var db=require(_0x9118('0x5'))['db'];var utils=require(_0x9118('0x6'));var logger=require(_0x9118('0x7'))(_0x9118('0x8'));var config=require(_0x9118('0x9'));var jayson=require(_0x9118('0xa'));var client=jayson[_0x9118('0xb')][_0x9118('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5888ce,_0x1d9715,_0x23cd8f){return new BPromise(function(_0x463cb5,_0x32c929){return client[_0x9118('0xd')](_0x5888ce,_0x23cd8f)['then'](function(_0x5be55e){logger['info'](_0x9118('0xe'),_0x1d9715,'request\x20sent');logger['debug'](_0x9118('0xf'),_0x1d9715,_0x9118('0x10'),JSON[_0x9118('0x11')](_0x5be55e));if(_0x5be55e[_0x9118('0x12')]){if(_0x5be55e[_0x9118('0x12')][_0x9118('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d9715,_0x5be55e[_0x9118('0x12')][_0x9118('0x14')]);return _0x32c929(_0x5be55e[_0x9118('0x12')]['message']);}logger[_0x9118('0x12')](_0x9118('0xe'),_0x1d9715,_0x5be55e[_0x9118('0x12')]['message']);return _0x463cb5(_0x5be55e[_0x9118('0x12')][_0x9118('0x14')]);}else{logger[_0x9118('0x15')](_0x9118('0xe'),_0x1d9715,'request\x20sent');_0x463cb5(_0x5be55e['result'][_0x9118('0x14')]);}})[_0x9118('0x16')](function(_0x3e076f){logger[_0x9118('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d9715,_0x3e076f);_0x32c929(_0x3e076f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 45db069..b605a66 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 _0x1bd7=['isAuthenticated','index','show','get','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x497795,_0x49331c){var _0x25e6b9=function(_0x3ae941){while(--_0x3ae941){_0x497795['push'](_0x497795['shift']());}};_0x25e6b9(++_0x49331c);}(_0x1bd7,0x19a));var _0x71bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bd7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x71bd('0x0'));var path=require(_0x71bd('0x1'));var timeout=require(_0x71bd('0x2'));var express=require(_0x71bd('0x3'));var router=express[_0x71bd('0x4')]();var fs_extra=require(_0x71bd('0x5'));var auth=require(_0x71bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x71bd('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x71bd('0x8')](),controller[_0x71bd('0x9')]);router['get']('/:id',auth[_0x71bd('0x8')](),controller[_0x71bd('0xa')]);router[_0x71bd('0xb')](_0x71bd('0xc'),auth[_0x71bd('0x8')](),controller[_0x71bd('0xd')]);router[_0x71bd('0xe')]('/',auth[_0x71bd('0x8')](),controller[_0x71bd('0xf')]);router[_0x71bd('0x10')](_0x71bd('0x11'),auth[_0x71bd('0x8')](),controller[_0x71bd('0x12')]);router[_0x71bd('0x13')]('/:id',auth[_0x71bd('0x8')](),controller[_0x71bd('0x14')]);module[_0x71bd('0x15')]=router; \ No newline at end of file +var _0xc0d1=['/:id/download','download','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x291c61,_0x5b6b3f){var _0x285311=function(_0x1b532d){while(--_0x1b532d){_0x291c61['push'](_0x291c61['shift']());}};_0x285311(++_0x5b6b3f);}(_0xc0d1,0x15c));var _0x1c0d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc0d1[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x1c0d('0x0'));var path=require(_0x1c0d('0x1'));var timeout=require('connect-timeout');var express=require(_0x1c0d('0x2'));var router=express[_0x1c0d('0x3')]();var fs_extra=require(_0x1c0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1c0d('0x5'));var config=require(_0x1c0d('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x1c0d('0x7')]('/',auth['isAuthenticated'](),controller[_0x1c0d('0x8')]);router[_0x1c0d('0x7')](_0x1c0d('0x9'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0xb')]);router[_0x1c0d('0x7')](_0x1c0d('0xc'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0xd')]);router[_0x1c0d('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c0d('0xf')]);router[_0x1c0d('0x10')](_0x1c0d('0x9'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0x11')]);router[_0x1c0d('0x12')](_0x1c0d('0x9'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0x13')]);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 d4ce337..7875dc7 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 _0x86b9=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x86b9,0x1ad));var _0x986b=function(_0x570632,_0x1ada64){_0x570632=_0x570632-0x0;var _0x2e32fb=_0x86b9[_0x570632];return _0x2e32fb;};'use strict';var Sequelize=require(_0x986b('0x0'));module[_0x986b('0x1')]={'field':{'type':Sequelize[_0x986b('0x2')]},'alias':{'type':Sequelize[_0x986b('0x3')]},'function':{'type':Sequelize[_0x986b('0x3')]},'format':{'type':Sequelize[_0x986b('0x3')]},'groupBy':{'type':Sequelize[_0x986b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x986b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x15b3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b3,0x1a3));var _0x315b=function(_0x5ae82c,_0x13bf1f){_0x5ae82c=_0x5ae82c-0x0;var _0x49c659=_0x15b3[_0x5ae82c];return _0x49c659;};'use strict';var Sequelize=require(_0x315b('0x0'));module[_0x315b('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x315b('0x2')]},'function':{'type':Sequelize[_0x315b('0x2')]},'format':{'type':Sequelize[_0x315b('0x2')]},'groupBy':{'type':Sequelize[_0x315b('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x315b('0x2')]},'custom':{'type':Sequelize[_0x315b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a5fba11..49a3b54 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 _0xc73a=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','findAll','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','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','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters'];(function(_0x2556fb,_0x2027f6){var _0x164c31=function(_0x28cc5e){while(--_0x28cc5e){_0x2556fb['push'](_0x2556fb['shift']());}};_0x164c31(++_0x2027f6);}(_0xc73a,0x72));var _0xac73=function(_0x2a0721,_0x3f002a){_0x2a0721=_0x2a0721-0x0;var _0x2a2148=_0xc73a[_0x2a0721];return _0x2a2148;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac73('0x0'));var zipdir=require(_0xac73('0x1'));var jsonpatch=require(_0xac73('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xac73('0x3'));var Mustache=require(_0xac73('0x4'));var util=require(_0xac73('0x5'));var path=require('path');var sox=require(_0xac73('0x6'));var csv=require(_0xac73('0x7'));var ejs=require(_0xac73('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac73('0x9'));var squel=require(_0xac73('0xa'));var crypto=require(_0xac73('0xb'));var jsforce=require(_0xac73('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xac73('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac73('0xd'));var authService=require(_0xac73('0xe'));var qs=require(_0xac73('0xf'));var as=require(_0xac73('0x10'));var hardwareService=require(_0xac73('0x11'));var logger=require(_0xac73('0x12'))(_0xac73('0x13'));var utils=require(_0xac73('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac73('0x15'));var db=require(_0xac73('0x16'))['db'];function respondWithStatusCode(_0x40d791,_0x7b4ade){_0x7b4ade=_0x7b4ade||0xcc;return function(_0x3caaa2){if(_0x3caaa2){return _0x40d791[_0xac73('0x17')](_0x7b4ade);}return _0x40d791['status'](_0x7b4ade)[_0xac73('0x18')]();};}function respondWithResult(_0x54a0fa,_0x3b8c56){_0x3b8c56=_0x3b8c56||0xc8;return function(_0x2e6c17){if(_0x2e6c17){return _0x54a0fa[_0xac73('0x19')](_0x3b8c56)[_0xac73('0x1a')](_0x2e6c17);}};}function respondWithFilteredResult(_0x5579e1,_0x113430){return function(_0x1466ca){if(_0x1466ca){var _0x518a0d=typeof _0x113430[_0xac73('0x1b')]===_0xac73('0x1c')&&typeof _0x113430[_0xac73('0x1d')]==='undefined';var _0x1120ce=_0x1466ca[_0xac73('0x1e')];var _0x20fb6f=_0x518a0d?0x0:_0x113430[_0xac73('0x1b')];var _0x3b6044=_0x518a0d?_0x1466ca['count']:_0x113430[_0xac73('0x1b')]+_0x113430[_0xac73('0x1d')];var _0x4d137f;if(_0x3b6044>=_0x1120ce){_0x3b6044=_0x1120ce;_0x4d137f=0xc8;}else{_0x4d137f=0xce;}_0x5579e1[_0xac73('0x19')](_0x4d137f);return _0x5579e1[_0xac73('0x1f')](_0xac73('0x20'),_0x20fb6f+'-'+_0x3b6044+'/'+_0x1120ce)[_0xac73('0x1a')](_0x1466ca);}return null;};}function patchUpdates(_0x102a02){return function(_0xeef7ea){try{jsonpatch[_0xac73('0x21')](_0xeef7ea,_0x102a02,!![]);}catch(_0xa07af0){return BPromise[_0xac73('0x22')](_0xa07af0);}return _0xeef7ea['save']();};}function saveUpdates(_0x999f70,_0x1c42ff){return function(_0x3b2c93){if(_0x3b2c93){return _0x3b2c93['update'](_0x999f70)[_0xac73('0x23')](function(_0x4998aa){return _0x4998aa;});}return null;};}function removeEntity(_0xc7791d,_0x1a3b6f){return function(_0x1522ac){if(_0x1522ac){return _0x1522ac[_0xac73('0x24')]()[_0xac73('0x23')](function(){_0xc7791d[_0xac73('0x19')](0xcc)[_0xac73('0x18')]();});}};}function handleEntityNotFound(_0x4df196,_0xc76c54){return function(_0x3e9d1c){if(!_0x3e9d1c){_0x4df196[_0xac73('0x17')](0x194);}return _0x3e9d1c;};}function handleError(_0xeee382,_0x180b3e){_0x180b3e=_0x180b3e||0x1f4;return function(_0x2dcfa6){logger['error'](_0x2dcfa6[_0xac73('0x25')]);if(_0x2dcfa6[_0xac73('0x26')]){delete _0x2dcfa6[_0xac73('0x26')];}_0xeee382[_0xac73('0x19')](_0x180b3e)[_0xac73('0x27')](_0x2dcfa6);};}exports[_0xac73('0x28')]=function(_0x364429,_0x2bc336){var _0x35dd60={},_0x4bc16f={},_0xfc0e93={'count':0x0,'rows':[]};var _0x2bcfb5=_[_0xac73('0x29')](db[_0xac73('0x2a')][_0xac73('0x2b')],function(_0x459467){return{'name':_0x459467['fieldName'],'type':_0x459467[_0xac73('0x2c')][_0xac73('0x2d')]};});_0x4bc16f[_0xac73('0x2e')]=_[_0xac73('0x29')](_0x2bcfb5,'name');_0x4bc16f[_0xac73('0x2f')]=_[_0xac73('0x30')](_0x364429[_0xac73('0x2f')]);_0x4bc16f[_0xac73('0x31')]=_[_0xac73('0x32')](_0x4bc16f[_0xac73('0x2e')],_0x4bc16f[_0xac73('0x2f')]);_0x35dd60[_0xac73('0x33')]=_[_0xac73('0x32')](_0x4bc16f[_0xac73('0x2e')],qs[_0xac73('0x34')](_0x364429[_0xac73('0x2f')][_0xac73('0x34')]));_0x35dd60[_0xac73('0x33')]=_0x35dd60[_0xac73('0x33')][_0xac73('0x35')]?_0x35dd60[_0xac73('0x33')]:_0x4bc16f[_0xac73('0x2e')];if(!_0x364429['query'][_0xac73('0x36')](_0xac73('0x37'))){_0x35dd60[_0xac73('0x1d')]=qs['limit'](_0x364429['query'][_0xac73('0x1d')]);_0x35dd60['offset']=qs['offset'](_0x364429[_0xac73('0x2f')][_0xac73('0x1b')]);}_0x35dd60[_0xac73('0x38')]=qs[_0xac73('0x39')](_0x364429['query'][_0xac73('0x39')]);_0x35dd60['where']=qs[_0xac73('0x31')](_[_0xac73('0x3a')](_0x364429['query'],_0x4bc16f[_0xac73('0x31')]),_0x2bcfb5);if(_0x364429[_0xac73('0x2f')][_0xac73('0x3b')]){_0x35dd60[_0xac73('0x3c')]=_[_0xac73('0x3d')](_0x35dd60[_0xac73('0x3c')],{'$or':_[_0xac73('0x29')](_0x2bcfb5,function(_0x292f7b){if(_0x292f7b[_0xac73('0x2c')]!==_0xac73('0x3e')){var _0x49d6a9={};_0x49d6a9[_0x292f7b[_0xac73('0x26')]]={'$like':'%'+_0x364429['query'][_0xac73('0x3b')]+'%'};return _0x49d6a9;}})});}_0x35dd60=_['merge']({},_0x35dd60,_0x364429[_0xac73('0x3f')]);var _0x5e5eb8={'where':_0x35dd60[_0xac73('0x3c')]};return db[_0xac73('0x2a')]['count'](_0x5e5eb8)[_0xac73('0x23')](function(_0x1e4b90){_0xfc0e93['count']=_0x1e4b90;if(_0x364429['query']['includeAll']){_0x35dd60['include']=[{'all':!![]}];}return db[_0xac73('0x2a')]['findAll'](_0x35dd60);})['then'](function(_0x5287c4){_0xfc0e93[_0xac73('0x40')]=_0x5287c4;return _0xfc0e93;})[_0xac73('0x23')](respondWithFilteredResult(_0x2bc336,_0x35dd60))[_0xac73('0x41')](handleError(_0x2bc336,null));};exports[_0xac73('0x42')]=function(_0x542998,_0x5dab73){var _0x235947={'raw':![],'where':{'id':_0x542998[_0xac73('0x43')]['id']}},_0x3ed3c2={};_0x3ed3c2['model']=_[_0xac73('0x30')](db[_0xac73('0x2a')]['rawAttributes']);_0x3ed3c2[_0xac73('0x2f')]=_[_0xac73('0x30')](_0x542998[_0xac73('0x2f')]);_0x3ed3c2[_0xac73('0x31')]=_['intersection'](_0x3ed3c2[_0xac73('0x2e')],_0x3ed3c2[_0xac73('0x2f')]);_0x235947[_0xac73('0x33')]=_['intersection'](_0x3ed3c2[_0xac73('0x2e')],qs[_0xac73('0x34')](_0x542998[_0xac73('0x2f')][_0xac73('0x34')]));_0x235947['attributes']=_0x235947[_0xac73('0x33')][_0xac73('0x35')]?_0x235947['attributes']:_0x3ed3c2[_0xac73('0x2e')];if(_0x542998[_0xac73('0x2f')][_0xac73('0x44')]){_0x235947[_0xac73('0x45')]=[{'all':!![]}];}_0x235947=_[_0xac73('0x3d')]({},_0x235947,_0x542998['options']);return db[_0xac73('0x2a')][_0xac73('0x46')](_0x235947)['then'](handleEntityNotFound(_0x5dab73,null))[_0xac73('0x23')](respondWithResult(_0x5dab73,null))[_0xac73('0x41')](handleError(_0x5dab73,null));};exports[_0xac73('0x47')]=function(_0x37b818,_0x463ebe){return db[_0xac73('0x2a')]['create'](_0x37b818[_0xac73('0x48')],{})[_0xac73('0x23')](respondWithResult(_0x463ebe,0xc9))[_0xac73('0x41')](handleError(_0x463ebe,null));};exports['bulkCreate']=function(_0x1bb6d2,_0x527650){return db[_0xac73('0x2a')][_0xac73('0x49')](_0x1bb6d2['body'],{'raw':![],'individualHooks':!![]})[_0xac73('0x23')](respondWithResult(_0x527650,0xc9))['catch'](handleError(_0x527650,null));};exports[_0xac73('0x4a')]=function(_0x5cf61b,_0x62c8d8){if(_0x5cf61b[_0xac73('0x48')]['id']){delete _0x5cf61b[_0xac73('0x48')]['id'];}return db[_0xac73('0x2a')][_0xac73('0x46')]({'where':{'id':_0x5cf61b['params']['id']}})[_0xac73('0x23')](handleEntityNotFound(_0x62c8d8,null))[_0xac73('0x23')](saveUpdates(_0x5cf61b['body'],null))[_0xac73('0x23')](respondWithResult(_0x62c8d8,null))[_0xac73('0x41')](handleError(_0x62c8d8,null));};exports[_0xac73('0x24')]=function(_0x2ece77,_0x52917b){return db['AnalyticFieldReport'][_0xac73('0x46')]({'where':{'id':_0x2ece77[_0xac73('0x43')]['id']}})[_0xac73('0x23')](handleEntityNotFound(_0x52917b,null))[_0xac73('0x23')](removeEntity(_0x52917b,null))[_0xac73('0x41')](handleError(_0x52917b,null));};exports[_0xac73('0x4b')]=function(_0x1fa693,_0x44509c){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x1fa693[_0xac73('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xac73('0x23')](respondWithResult(_0x44509c,0xcc))[_0xac73('0x41')](handleError(_0x44509c,null));};exports[_0xac73('0x4c')]=function(_0x3666ce,_0x298540,_0x459cb4){return db[_0xac73('0x4d')]['findOne']({'where':{'id':_0x3666ce[_0xac73('0x43')]['id']}})[_0xac73('0x23')](handleEntityNotFound(_0x298540,null))['then'](function(_0x5b3dda){if(_0x5b3dda){return db[_0xac73('0x4e')][_0xac73('0x4f')](function(_0x4629c0){return db[_0xac73('0x2a')]['destroy']({'where':{'CustomReportId':_0x3666ce['params']['id']},'transaction':_0x4629c0})['then'](function(_0x24e55d){var _0x56e971=_[_0xac73('0x29')](_0x3666ce[_0xac73('0x48')],function(_0x3e608){delete _0x3e608['id'];_0x3e608[_0xac73('0x50')]=_0x3666ce[_0xac73('0x43')]['id'];return _0x3e608;});return db[_0xac73('0x2a')][_0xac73('0x49')](_0x56e971,{'transaction':_0x4629c0});});})[_0xac73('0x23')](function(){return db[_0xac73('0x2a')][_0xac73('0x51')]({'where':{'CustomReportId':_0x3666ce[_0xac73('0x43')]['id']}});});}})['then'](respondWithResult(_0x298540,null))[_0xac73('0x41')](handleError(_0x298540,null));}; \ No newline at end of file +var _0x087a=['moment','bluebird','mustache','path','sox','to-csv','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','json','limit','count','offset','set','apply','reject','save','update','then','destroy','error','send','index','map','AnalyticFieldReport','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','options','create','bulkCreate','body','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','fast-json-patch','request-promise'];(function(_0x1c6a18,_0x518dc7){var _0x14a8c4=function(_0x3e1250){while(--_0x3e1250){_0x1c6a18['push'](_0x1c6a18['shift']());}};_0x14a8c4(++_0x518dc7);}(_0x087a,0x14d));var _0xa087=function(_0x4b38d1,_0x497bc8){_0x4b38d1=_0x4b38d1-0x0;var _0x267a11=_0x087a[_0x4b38d1];return _0x267a11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa087('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa087('0x1'));var rp=require(_0xa087('0x2'));var moment=require(_0xa087('0x3'));var BPromise=require(_0xa087('0x4'));var Mustache=require(_0xa087('0x5'));var util=require('util');var path=require(_0xa087('0x6'));var sox=require(_0xa087('0x7'));var csv=require(_0xa087('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa087('0x9'));var _=require(_0xa087('0xa'));var squel=require(_0xa087('0xb'));var crypto=require(_0xa087('0xc'));var jsforce=require(_0xa087('0xd'));var deskjs=require(_0xa087('0xe'));var toCsv=require(_0xa087('0x8'));var querystring=require(_0xa087('0xf'));var Papa=require(_0xa087('0x10'));var Redis=require(_0xa087('0x11'));var authService=require(_0xa087('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa087('0x13'));var logger=require(_0xa087('0x14'))(_0xa087('0x15'));var utils=require(_0xa087('0x16'));var config=require(_0xa087('0x17'));var licenseUtil=require(_0xa087('0x18'));var db=require(_0xa087('0x19'))['db'];function respondWithStatusCode(_0x15e2af,_0x4dc418){_0x4dc418=_0x4dc418||0xcc;return function(_0x107676){if(_0x107676){return _0x15e2af[_0xa087('0x1a')](_0x4dc418);}return _0x15e2af['status'](_0x4dc418)['end']();};}function respondWithResult(_0x37d4db,_0x3a57d8){_0x3a57d8=_0x3a57d8||0xc8;return function(_0x1ffed6){if(_0x1ffed6){return _0x37d4db[_0xa087('0x1b')](_0x3a57d8)[_0xa087('0x1c')](_0x1ffed6);}};}function respondWithFilteredResult(_0x2ac460,_0x4a7e2d){return function(_0x565463){if(_0x565463){var _0x3c3e17=typeof _0x4a7e2d['offset']==='undefined'&&typeof _0x4a7e2d[_0xa087('0x1d')]==='undefined';var _0x3b5582=_0x565463[_0xa087('0x1e')];var _0x3ee04c=_0x3c3e17?0x0:_0x4a7e2d[_0xa087('0x1f')];var _0x1825f7=_0x3c3e17?_0x565463[_0xa087('0x1e')]:_0x4a7e2d[_0xa087('0x1f')]+_0x4a7e2d['limit'];var _0x5749d0;if(_0x1825f7>=_0x3b5582){_0x1825f7=_0x3b5582;_0x5749d0=0xc8;}else{_0x5749d0=0xce;}_0x2ac460['status'](_0x5749d0);return _0x2ac460[_0xa087('0x20')]('Content-Range',_0x3ee04c+'-'+_0x1825f7+'/'+_0x3b5582)[_0xa087('0x1c')](_0x565463);}return null;};}function patchUpdates(_0xa3689e){return function(_0x2c730a){try{jsonpatch[_0xa087('0x21')](_0x2c730a,_0xa3689e,!![]);}catch(_0x449e92){return BPromise[_0xa087('0x22')](_0x449e92);}return _0x2c730a[_0xa087('0x23')]();};}function saveUpdates(_0x57ae31,_0x2b6366){return function(_0x42ceb1){if(_0x42ceb1){return _0x42ceb1[_0xa087('0x24')](_0x57ae31)[_0xa087('0x25')](function(_0x16c740){return _0x16c740;});}return null;};}function removeEntity(_0x406df0,_0xa221c){return function(_0x28511c){if(_0x28511c){return _0x28511c[_0xa087('0x26')]()['then'](function(){_0x406df0[_0xa087('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e724,_0x1429c7){return function(_0x151244){if(!_0x151244){_0x20e724[_0xa087('0x1a')](0x194);}return _0x151244;};}function handleError(_0x21cd83,_0x114008){_0x114008=_0x114008||0x1f4;return function(_0x43fdc7){logger[_0xa087('0x27')](_0x43fdc7['stack']);if(_0x43fdc7['name']){delete _0x43fdc7['name'];}_0x21cd83['status'](_0x114008)[_0xa087('0x28')](_0x43fdc7);};}exports[_0xa087('0x29')]=function(_0x3dc578,_0x48aff8){var _0x52ee10={},_0xbdbc40={},_0x2cb480={'count':0x0,'rows':[]};var _0x82b850=_[_0xa087('0x2a')](db[_0xa087('0x2b')]['rawAttributes'],function(_0x4afd5f){return{'name':_0x4afd5f[_0xa087('0x2c')],'type':_0x4afd5f[_0xa087('0x2d')][_0xa087('0x2e')]};});_0xbdbc40[_0xa087('0x2f')]=_[_0xa087('0x2a')](_0x82b850,_0xa087('0x30'));_0xbdbc40[_0xa087('0x31')]=_[_0xa087('0x32')](_0x3dc578[_0xa087('0x31')]);_0xbdbc40[_0xa087('0x33')]=_['intersection'](_0xbdbc40[_0xa087('0x2f')],_0xbdbc40['query']);_0x52ee10[_0xa087('0x34')]=_['intersection'](_0xbdbc40[_0xa087('0x2f')],qs[_0xa087('0x35')](_0x3dc578[_0xa087('0x31')]['fields']));_0x52ee10['attributes']=_0x52ee10['attributes'][_0xa087('0x36')]?_0x52ee10[_0xa087('0x34')]:_0xbdbc40[_0xa087('0x2f')];if(!_0x3dc578['query'][_0xa087('0x37')]('nolimit')){_0x52ee10[_0xa087('0x1d')]=qs['limit'](_0x3dc578['query']['limit']);_0x52ee10['offset']=qs[_0xa087('0x1f')](_0x3dc578['query'][_0xa087('0x1f')]);}_0x52ee10[_0xa087('0x38')]=qs[_0xa087('0x39')](_0x3dc578['query']['sort']);_0x52ee10[_0xa087('0x3a')]=qs[_0xa087('0x33')](_[_0xa087('0x3b')](_0x3dc578[_0xa087('0x31')],_0xbdbc40[_0xa087('0x33')]),_0x82b850);if(_0x3dc578[_0xa087('0x31')]['filter']){_0x52ee10[_0xa087('0x3a')]=_[_0xa087('0x3c')](_0x52ee10[_0xa087('0x3a')],{'$or':_[_0xa087('0x2a')](_0x82b850,function(_0x5d39cc){if(_0x5d39cc[_0xa087('0x2d')]!==_0xa087('0x3d')){var _0x40d58b={};_0x40d58b[_0x5d39cc['name']]={'$like':'%'+_0x3dc578[_0xa087('0x31')][_0xa087('0x3e')]+'%'};return _0x40d58b;}})});}_0x52ee10=_[_0xa087('0x3c')]({},_0x52ee10,_0x3dc578['options']);var _0x5634f5={'where':_0x52ee10[_0xa087('0x3a')]};return db[_0xa087('0x2b')][_0xa087('0x1e')](_0x5634f5)[_0xa087('0x25')](function(_0x1e40cf){_0x2cb480[_0xa087('0x1e')]=_0x1e40cf;if(_0x3dc578[_0xa087('0x31')][_0xa087('0x3f')]){_0x52ee10[_0xa087('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa087('0x41')](_0x52ee10);})[_0xa087('0x25')](function(_0x43dcae){_0x2cb480[_0xa087('0x42')]=_0x43dcae;return _0x2cb480;})[_0xa087('0x25')](respondWithFilteredResult(_0x48aff8,_0x52ee10))[_0xa087('0x43')](handleError(_0x48aff8,null));};exports[_0xa087('0x44')]=function(_0x420acd,_0x49a93d){var _0x147e9a={'raw':![],'where':{'id':_0x420acd['params']['id']}},_0x503811={};_0x503811[_0xa087('0x2f')]=_[_0xa087('0x32')](db[_0xa087('0x2b')][_0xa087('0x45')]);_0x503811[_0xa087('0x31')]=_[_0xa087('0x32')](_0x420acd['query']);_0x503811[_0xa087('0x33')]=_[_0xa087('0x46')](_0x503811['model'],_0x503811[_0xa087('0x31')]);_0x147e9a[_0xa087('0x34')]=_[_0xa087('0x46')](_0x503811[_0xa087('0x2f')],qs[_0xa087('0x35')](_0x420acd[_0xa087('0x31')][_0xa087('0x35')]));_0x147e9a[_0xa087('0x34')]=_0x147e9a['attributes'][_0xa087('0x36')]?_0x147e9a[_0xa087('0x34')]:_0x503811[_0xa087('0x2f')];if(_0x420acd[_0xa087('0x31')][_0xa087('0x3f')]){_0x147e9a[_0xa087('0x40')]=[{'all':!![]}];}_0x147e9a=_['merge']({},_0x147e9a,_0x420acd[_0xa087('0x47')]);return db[_0xa087('0x2b')]['find'](_0x147e9a)[_0xa087('0x25')](handleEntityNotFound(_0x49a93d,null))[_0xa087('0x25')](respondWithResult(_0x49a93d,null))[_0xa087('0x43')](handleError(_0x49a93d,null));};exports[_0xa087('0x48')]=function(_0x21ac7e,_0x36f07e){return db['AnalyticFieldReport'][_0xa087('0x48')](_0x21ac7e['body'],{})[_0xa087('0x25')](respondWithResult(_0x36f07e,0xc9))[_0xa087('0x43')](handleError(_0x36f07e,null));};exports[_0xa087('0x49')]=function(_0x3f867a,_0x18fbdb){return db['AnalyticFieldReport'][_0xa087('0x49')](_0x3f867a[_0xa087('0x4a')],{'raw':![],'individualHooks':!![]})[_0xa087('0x25')](respondWithResult(_0x18fbdb,0xc9))['catch'](handleError(_0x18fbdb,null));};exports[_0xa087('0x24')]=function(_0x40c94e,_0x2ee1fb){if(_0x40c94e[_0xa087('0x4a')]['id']){delete _0x40c94e['body']['id'];}return db['AnalyticFieldReport'][_0xa087('0x4b')]({'where':{'id':_0x40c94e[_0xa087('0x4c')]['id']}})[_0xa087('0x25')](handleEntityNotFound(_0x2ee1fb,null))['then'](saveUpdates(_0x40c94e[_0xa087('0x4a')],null))[_0xa087('0x25')](respondWithResult(_0x2ee1fb,null))[_0xa087('0x43')](handleError(_0x2ee1fb,null));};exports[_0xa087('0x26')]=function(_0x416c1d,_0x1021e8){return db[_0xa087('0x2b')][_0xa087('0x4b')]({'where':{'id':_0x416c1d['params']['id']}})[_0xa087('0x25')](handleEntityNotFound(_0x1021e8,null))[_0xa087('0x25')](removeEntity(_0x1021e8,null))[_0xa087('0x43')](handleError(_0x1021e8,null));};exports[_0xa087('0x4d')]=function(_0x272580,_0x1c3e67){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x272580[_0xa087('0x31')][_0xa087('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xa087('0x25')](respondWithResult(_0x1c3e67,0xcc))[_0xa087('0x43')](handleError(_0x1c3e67,null));};exports[_0xa087('0x4f')]=function(_0x1081e2,_0x4e31ce,_0x4ad912){return db[_0xa087('0x50')]['findOne']({'where':{'id':_0x1081e2[_0xa087('0x4c')]['id']}})[_0xa087('0x25')](handleEntityNotFound(_0x4e31ce,null))[_0xa087('0x25')](function(_0x2fe894){if(_0x2fe894){return db[_0xa087('0x51')][_0xa087('0x52')](function(_0x1f3aa3){return db[_0xa087('0x2b')][_0xa087('0x26')]({'where':{'CustomReportId':_0x1081e2[_0xa087('0x4c')]['id']},'transaction':_0x1f3aa3})[_0xa087('0x25')](function(_0x4625c4){var _0x13f39a=_['map'](_0x1081e2[_0xa087('0x4a')],function(_0x1b2097){delete _0x1b2097['id'];_0x1b2097[_0xa087('0x53')]=_0x1081e2[_0xa087('0x4c')]['id'];return _0x1b2097;});return db[_0xa087('0x2b')][_0xa087('0x49')](_0x13f39a,{'transaction':_0x1f3aa3});});})['then'](function(){return db[_0xa087('0x2b')][_0xa087('0x41')]({'where':{'CustomReportId':_0x1081e2[_0xa087('0x4c')]['id']}});});}})[_0xa087('0x25')](respondWithResult(_0x4e31ce,null))[_0xa087('0x43')](handleError(_0x4e31ce,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 87ffe69..c8bf605 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 _0xfd85=['../../config/environment','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4b221c,_0x520afe){var _0x398e12=function(_0x50b575){while(--_0x50b575){_0x4b221c['push'](_0x4b221c['shift']());}};_0x398e12(++_0x520afe);}(_0xfd85,0x81));var _0x5fd8=function(_0x34e481,_0x1f0d05){_0x34e481=_0x34e481-0x0;var _0x195d01=_0xfd85[_0x34e481];return _0x195d01;};'use strict';var _=require('lodash');var util=require(_0x5fd8('0x0'));var logger=require(_0x5fd8('0x1'))(_0x5fd8('0x2'));var moment=require('moment');var BPromise=require(_0x5fd8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fd8('0x4'));var rimraf=require(_0x5fd8('0x5'));var config=require(_0x5fd8('0x6'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x12cb71,_0x5e532a){return _0x12cb71['define'](_0x5fd8('0x7'),attributes,{'tableName':_0x5fd8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a67=['bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','../../config/logger','api','moment'];(function(_0x3111e5,_0x42f028){var _0x7df4d8=function(_0x365792){while(--_0x365792){_0x3111e5['push'](_0x3111e5['shift']());}};_0x7df4d8(++_0x42f028);}(_0x0a67,0x115));var _0x70a6=function(_0x4ba9b4,_0x52ab66){_0x4ba9b4=_0x4ba9b4-0x0;var _0x2adb67=_0x0a67[_0x4ba9b4];return _0x2adb67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x70a6('0x0'))(_0x70a6('0x1'));var moment=require(_0x70a6('0x2'));var BPromise=require(_0x70a6('0x3'));var rp=require(_0x70a6('0x4'));var fs=require('fs');var path=require(_0x70a6('0x5'));var rimraf=require(_0x70a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x70a6('0x7'));module['exports']=function(_0x219b23,_0x95a633){return _0x219b23['define'](_0x70a6('0x8'),attributes,{'tableName':_0x70a6('0x9'),'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 4695db8..9fa6f74 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 _0x2e17=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2e17,0x98));var _0x72e1=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x2e17[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var moment=require('moment');var BPromise=require(_0x72e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72e1('0x3'));var db=require(_0x72e1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x72e1('0x5'))(_0x72e1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72e1('0x7'));var client=jayson['client'][_0x72e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fe2f1,_0x3216fc,_0x5166d5){return new BPromise(function(_0x4fc481,_0x4a90e4){return client[_0x72e1('0x9')](_0x2fe2f1,_0x5166d5)['then'](function(_0x256ac9){logger[_0x72e1('0xa')](_0x72e1('0xb'),_0x3216fc,'request\x20sent');logger[_0x72e1('0xc')](_0x72e1('0xd'),_0x3216fc,_0x72e1('0xe'),JSON[_0x72e1('0xf')](_0x256ac9));if(_0x256ac9['error']){if(_0x256ac9[_0x72e1('0x10')][_0x72e1('0x11')]===0x1f4){logger[_0x72e1('0x10')](_0x72e1('0xb'),_0x3216fc,_0x256ac9[_0x72e1('0x10')]['message']);return _0x4a90e4(_0x256ac9[_0x72e1('0x10')][_0x72e1('0x12')]);}logger[_0x72e1('0x10')](_0x72e1('0xb'),_0x3216fc,_0x256ac9[_0x72e1('0x10')][_0x72e1('0x12')]);return _0x4fc481(_0x256ac9[_0x72e1('0x10')][_0x72e1('0x12')]);}else{logger[_0x72e1('0xa')](_0x72e1('0xb'),_0x3216fc,_0x72e1('0xe'));_0x4fc481(_0x256ac9[_0x72e1('0x13')][_0x72e1('0x12')]);}})[_0x72e1('0x14')](function(_0x3747b5){logger[_0x72e1('0x10')](_0x72e1('0xb'),_0x3216fc,_0x3747b5);_0x4a90e4(_0x3747b5);});});} \ No newline at end of file +var _0xc4fc=['../../config/utils','../../config/logger','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x419ffd,_0x10bdfe){var _0xb0b19d=function(_0x335815){while(--_0x335815){_0x419ffd['push'](_0x419ffd['shift']());}};_0xb0b19d(++_0x10bdfe);}(_0xc4fc,0x68));var _0xcc4f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc4fc[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xcc4f('0x0'));var util=require(_0xcc4f('0x1'));var moment=require(_0xcc4f('0x2'));var BPromise=require(_0xcc4f('0x3'));var rs=require(_0xcc4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc4f('0x5'))['db'];var utils=require(_0xcc4f('0x6'));var logger=require(_0xcc4f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcc4f('0x8'));var client=jayson['client'][_0xcc4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319362,_0x2fc72c,_0xbc368c){return new BPromise(function(_0x2e71a0,_0x127872){return client[_0xcc4f('0xa')](_0x319362,_0xbc368c)[_0xcc4f('0xb')](function(_0x3ea200){logger[_0xcc4f('0xc')](_0xcc4f('0xd'),_0x2fc72c,_0xcc4f('0xe'));logger[_0xcc4f('0xf')](_0xcc4f('0x10'),_0x2fc72c,_0xcc4f('0xe'),JSON['stringify'](_0x3ea200));if(_0x3ea200[_0xcc4f('0x11')]){if(_0x3ea200['error'][_0xcc4f('0x12')]===0x1f4){logger[_0xcc4f('0x11')](_0xcc4f('0xd'),_0x2fc72c,_0x3ea200['error'][_0xcc4f('0x13')]);return _0x127872(_0x3ea200[_0xcc4f('0x11')][_0xcc4f('0x13')]);}logger[_0xcc4f('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2fc72c,_0x3ea200[_0xcc4f('0x11')]['message']);return _0x2e71a0(_0x3ea200[_0xcc4f('0x11')][_0xcc4f('0x13')]);}else{logger[_0xcc4f('0xc')](_0xcc4f('0xd'),_0x2fc72c,_0xcc4f('0xe'));_0x2e71a0(_0x3ea200[_0xcc4f('0x14')][_0xcc4f('0x13')]);}})[_0xcc4f('0x15')](function(_0x2a3a7f){logger[_0xcc4f('0x11')](_0xcc4f('0xd'),_0x2fc72c,_0x2a3a7f);_0x127872(_0x2a3a7f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0419366..b7c4043 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(_0x229fe9,_0x1b6252){var _0x184b49=function(_0x59b07e){while(--_0x59b07e){_0x229fe9['push'](_0x229fe9['shift']());}};_0x184b49(++_0x1b6252);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x9209e6,_0x22950b){var _0x15832a=function(_0x568ae9){while(--_0x568ae9){_0x9209e6['push'](_0x9209e6['shift']());}};_0x15832a(++_0x22950b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 90d79e3..accdf24 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 _0x608a=['exports','STRING','TEXT'];(function(_0x2bcb76,_0x1fc42e){var _0x4c4301=function(_0x578c38){while(--_0x578c38){_0x2bcb76['push'](_0x2bcb76['shift']());}};_0x4c4301(++_0x1fc42e);}(_0x608a,0xff));var _0xa608=function(_0x230e44,_0x30918f){_0x230e44=_0x230e44-0x0;var _0x380c4f=_0x608a[_0x230e44];return _0x380c4f;};'use strict';var Sequelize=require('sequelize');module[_0xa608('0x0')]={'name':{'type':Sequelize[_0xa608('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa608('0x1')]},'metric':{'type':Sequelize[_0xa608('0x2')]},'description':{'type':Sequelize[_0xa608('0x1')]}}; \ No newline at end of file +var _0x0713=['TEXT','STRING','name'];(function(_0x3162fa,_0x5091bc){var _0x37373c=function(_0x3fa1aa){while(--_0x3fa1aa){_0x3162fa['push'](_0x3162fa['shift']());}};_0x37373c(++_0x5091bc);}(_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')},'table':{'type':Sequelize[_0x3071('0x0')]},'metric':{'type':Sequelize[_0x3071('0x2')]},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 59c4345..bcdf7c2 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 _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x295fee,_0x4463ae){var _0x4fc9bc=function(_0x44a702){while(--_0x44a702){_0x295fee['push'](_0x295fee['shift']());}};_0x4fc9bc(++_0x4463ae);}(_0xdc97,0x13b));var _0x7dc9=function(_0x40b199,_0x589b94){_0x40b199=_0x40b199-0x0;var _0x419220=_0xdc97[_0x40b199];return _0x419220;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file +var _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0xd08f2b,_0x5d07d0){var _0x59f815=function(_0x2f4eee){while(--_0x2f4eee){_0xd08f2b['push'](_0xd08f2b['shift']());}};_0x59f815(++_0x5d07d0);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x134438,_0x21045a){_0x134438=_0x134438-0x0;var _0x2899ea=_0xd6d6[_0x134438];return _0x2899ea;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fb677f7..e678985 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 _0x4cc7=['exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes'];(function(_0x3e52f9,_0x5a96b9){var _0x22075e=function(_0x4cbbf8){while(--_0x4cbbf8){_0x3e52f9['push'](_0x3e52f9['shift']());}};_0x22075e(++_0x5a96b9);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x304411,_0x1c8764){_0x304411=_0x304411-0x0;var _0x5c3bad=_0x4cc7[_0x304411];return _0x5c3bad;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var logger=require(_0x74cc('0x2'))(_0x74cc('0x3'));var moment=require(_0x74cc('0x4'));var BPromise=require(_0x74cc('0x5'));var rp=require(_0x74cc('0x6'));var fs=require('fs');var path=require(_0x74cc('0x7'));var rimraf=require('rimraf');var config=require(_0x74cc('0x8'));var attributes=require(_0x74cc('0x9'));module[_0x74cc('0xa')]=function(_0x3b5d01,_0x225d38){return _0x3b5d01[_0x74cc('0xb')](_0x74cc('0xc'),attributes,{'tableName':_0x74cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2975=['AnalyticMetric','analytics_metrics','util','../../config/logger','api','moment','bluebird','request-promise','./analyticMetric.attributes','exports','define'];(function(_0x1f75ff,_0x7f2e60){var _0x2191de=function(_0x5ef6ac){while(--_0x5ef6ac){_0x1f75ff['push'](_0x1f75ff['shift']());}};_0x2191de(++_0x7f2e60);}(_0x2975,0x1c5));var _0x5297=function(_0x42a8d5,_0x33cf93){_0x42a8d5=_0x42a8d5-0x0;var _0x515da6=_0x2975[_0x42a8d5];return _0x515da6;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var logger=require(_0x5297('0x1'))(_0x5297('0x2'));var moment=require(_0x5297('0x3'));var BPromise=require(_0x5297('0x4'));var rp=require(_0x5297('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5297('0x6'));module[_0x5297('0x7')]=function(_0x11a43d,_0x3da9c6){return _0x11a43d[_0x5297('0x8')](_0x5297('0x9'),attributes,{'tableName':_0x5297('0xa'),'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 ccf2618..9fe1fee 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 _0x5eb5=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x449edf,_0x178ff9){var _0x55dda0=function(_0x23e4fb){while(--_0x23e4fb){_0x449edf['push'](_0x449edf['shift']());}};_0x55dda0(++_0x178ff9);}(_0x5eb5,0x1d8));var _0x55eb=function(_0x298c93,_0x770694){_0x298c93=_0x298c93-0x0;var _0xca5ea3=_0x5eb5[_0x298c93];return _0xca5ea3;};'use strict';var _=require(_0x55eb('0x0'));var util=require(_0x55eb('0x1'));var moment=require(_0x55eb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55eb('0x3'));var db=require(_0x55eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55eb('0x5'))(_0x55eb('0x6'));var config=require('../../config/environment');var jayson=require(_0x55eb('0x7'));var client=jayson['client'][_0x55eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e88f9,_0x1c20c7,_0x460aef){return new BPromise(function(_0x1b5cab,_0x3ee400){return client[_0x55eb('0x9')](_0x1e88f9,_0x460aef)[_0x55eb('0xa')](function(_0x1a6f4d){logger[_0x55eb('0xb')](_0x55eb('0xc'),_0x1c20c7,'request\x20sent');logger['debug'](_0x55eb('0xd'),_0x1c20c7,_0x55eb('0xe'),JSON[_0x55eb('0xf')](_0x1a6f4d));if(_0x1a6f4d[_0x55eb('0x10')]){if(_0x1a6f4d['error'][_0x55eb('0x11')]===0x1f4){logger[_0x55eb('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1c20c7,_0x1a6f4d[_0x55eb('0x10')]['message']);return _0x3ee400(_0x1a6f4d[_0x55eb('0x10')][_0x55eb('0x12')]);}logger['error'](_0x55eb('0xc'),_0x1c20c7,_0x1a6f4d[_0x55eb('0x10')]['message']);return _0x1b5cab(_0x1a6f4d[_0x55eb('0x10')][_0x55eb('0x12')]);}else{logger[_0x55eb('0xb')](_0x55eb('0xc'),_0x1c20c7,_0x55eb('0xe'));_0x1b5cab(_0x1a6f4d[_0x55eb('0x13')]['message']);}})['catch'](function(_0x53cea5){logger['error'](_0x55eb('0xc'),_0x1c20c7,_0x53cea5);_0x3ee400(_0x53cea5);});});} \ No newline at end of file +var _0xc330=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x270cd0,_0x50e6ff){var _0x542885=function(_0x27e1e7){while(--_0x27e1e7){_0x270cd0['push'](_0x270cd0['shift']());}};_0x542885(++_0x50e6ff);}(_0xc330,0xce));var _0x0c33=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xc330[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x0c33('0x0'));var util=require(_0x0c33('0x1'));var moment=require(_0x0c33('0x2'));var BPromise=require(_0x0c33('0x3'));var rs=require(_0x0c33('0x4'));var fs=require('fs');var Redis=require(_0x0c33('0x5'));var db=require(_0x0c33('0x6'))['db'];var utils=require(_0x0c33('0x7'));var logger=require(_0x0c33('0x8'))(_0x0c33('0x9'));var config=require('../../config/environment');var jayson=require(_0x0c33('0xa'));var client=jayson[_0x0c33('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6d35a,_0x14a494,_0x30126c){return new BPromise(function(_0x145d74,_0xf291d9){return client['request'](_0xd6d35a,_0x30126c)[_0x0c33('0xc')](function(_0x8ce72c){logger['info'](_0x0c33('0xd'),_0x14a494,_0x0c33('0xe'));logger[_0x0c33('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x14a494,_0x0c33('0xe'),JSON[_0x0c33('0x10')](_0x8ce72c));if(_0x8ce72c[_0x0c33('0x11')]){if(_0x8ce72c['error'][_0x0c33('0x12')]===0x1f4){logger[_0x0c33('0x11')](_0x0c33('0xd'),_0x14a494,_0x8ce72c['error']['message']);return _0xf291d9(_0x8ce72c[_0x0c33('0x11')][_0x0c33('0x13')]);}logger[_0x0c33('0x11')](_0x0c33('0xd'),_0x14a494,_0x8ce72c[_0x0c33('0x11')][_0x0c33('0x13')]);return _0x145d74(_0x8ce72c[_0x0c33('0x11')][_0x0c33('0x13')]);}else{logger[_0x0c33('0x14')](_0x0c33('0xd'),_0x14a494,_0x0c33('0xe'));_0x145d74(_0x8ce72c[_0x0c33('0x15')][_0x0c33('0x13')]);}})[_0x0c33('0x16')](function(_0x5e65a3){logger[_0x0c33('0x11')](_0x0c33('0xd'),_0x14a494,_0x5e65a3);_0xf291d9(_0x5e65a3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 49e8491..2c300b0 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 _0x3f27=['/:id','post','create','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x54bd7a,_0x2a868e){var _0x54c89b=function(_0x296f21){while(--_0x296f21){_0x54bd7a['push'](_0x54bd7a['shift']());}};_0x54c89b(++_0x2a868e);}(_0x3f27,0x1f4));var _0x73f2=function(_0x1672b6,_0x4a11ad){_0x1672b6=_0x1672b6-0x0;var _0x121be7=_0x3f27[_0x1672b6];return _0x121be7;};'use strict';var multer=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var path=require(_0x73f2('0x2'));var timeout=require(_0x73f2('0x3'));var express=require(_0x73f2('0x4'));var router=express['Router']();var fs_extra=require(_0x73f2('0x5'));var auth=require(_0x73f2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x73f2('0x7')]('/',auth[_0x73f2('0x8')](),controller[_0x73f2('0x9')]);router[_0x73f2('0x7')](_0x73f2('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x73f2('0xb')]('/',auth[_0x73f2('0x8')](),controller[_0x73f2('0xc')]);router[_0x73f2('0xd')](_0x73f2('0xa'),auth[_0x73f2('0x8')](),controller['update']);router[_0x73f2('0xe')](_0x73f2('0xa'),auth[_0x73f2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x56da=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b5b76,_0x213610){var _0x5abd7c=function(_0x2c06dd){while(--_0x2c06dd){_0x4b5b76['push'](_0x4b5b76['shift']());}};_0x5abd7c(++_0x213610);}(_0x56da,0x119));var _0xa56d=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0x56da[_0x46e523];return _0x5da0ee;};'use strict';var multer=require(_0xa56d('0x0'));var util=require('util');var path=require(_0xa56d('0x1'));var timeout=require(_0xa56d('0x2'));var express=require('express');var router=express[_0xa56d('0x3')]();var fs_extra=require(_0xa56d('0x4'));var auth=require(_0xa56d('0x5'));var interaction=require(_0xa56d('0x6'));var config=require(_0xa56d('0x7'));var controller=require(_0xa56d('0x8'));router[_0xa56d('0x9')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xb')]);router[_0xa56d('0x9')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa56d('0xd')]('/',auth[_0xa56d('0xa')](),controller[_0xa56d('0xe')]);router[_0xa56d('0xf')](_0xa56d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa56d('0x10')](_0xa56d('0xc'),auth[_0xa56d('0xa')](),controller['destroy']);module[_0xa56d('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9273068..76009b2 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 _0xddbc=['TEXT','sequelize','exports'];(function(_0x34a9fe,_0x5cf50b){var _0x443985=function(_0x23e027){while(--_0x23e027){_0x34a9fe['push'](_0x34a9fe['shift']());}};_0x443985(++_0x5cf50b);}(_0xddbc,0xe2));var _0xcddb=function(_0x4cdbb8,_0x278779){_0x4cdbb8=_0x4cdbb8-0x0;var _0x24beca=_0xddbc[_0x4cdbb8];return _0x24beca;};'use strict';var Sequelize=require(_0xcddb('0x0'));module[_0xcddb('0x1')]={'tree':{'type':Sequelize[_0xcddb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x09e1=['TEXT','sequelize'];(function(_0x10bea5,_0x3b9545){var _0x4a241b=function(_0xd5d5a9){while(--_0xd5d5a9){_0x10bea5['push'](_0x10bea5['shift']());}};_0x4a241b(++_0x3b9545);}(_0x09e1,0x9d));var _0x109e=function(_0x1e0aee,_0x3b7a1d){_0x1e0aee=_0x1e0aee-0x0;var _0x478c48=_0x09e1[_0x1e0aee];return _0x478c48;};'use strict';var Sequelize=require(_0x109e('0x0'));module['exports']={'tree':{'type':Sequelize[_0x109e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 92f34e4..fc619a1 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 _0xe626=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','AnalyticTreeReport','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','rows','catch','show','params','keys','includeAll','options','create','body','find','destroy'];(function(_0x42cc58,_0x5a4760){var _0x5ca9cb=function(_0xf46e9b){while(--_0xf46e9b){_0x42cc58['push'](_0x42cc58['shift']());}};_0x5ca9cb(++_0x5a4760);}(_0xe626,0x11c));var _0x6e62=function(_0x7bd00e,_0x152f4a){_0x7bd00e=_0x7bd00e-0x0;var _0x2fff89=_0xe626[_0x7bd00e];return _0x2fff89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e62('0x0'));var zipdir=require(_0x6e62('0x1'));var jsonpatch=require(_0x6e62('0x2'));var rp=require(_0x6e62('0x3'));var moment=require('moment');var BPromise=require(_0x6e62('0x4'));var Mustache=require(_0x6e62('0x5'));var util=require(_0x6e62('0x6'));var path=require(_0x6e62('0x7'));var sox=require(_0x6e62('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e62('0x9'));var _=require(_0x6e62('0xa'));var squel=require(_0x6e62('0xb'));var crypto=require(_0x6e62('0xc'));var jsforce=require(_0x6e62('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e62('0xe'));var querystring=require(_0x6e62('0xf'));var Papa=require(_0x6e62('0x10'));var Redis=require(_0x6e62('0x11'));var authService=require(_0x6e62('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6e62('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e62('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6e62('0x15'))['db'];function respondWithStatusCode(_0x24ca8a,_0x181a7c){_0x181a7c=_0x181a7c||0xcc;return function(_0x51308b){if(_0x51308b){return _0x24ca8a['sendStatus'](_0x181a7c);}return _0x24ca8a[_0x6e62('0x16')](_0x181a7c)[_0x6e62('0x17')]();};}function respondWithResult(_0x3932e2,_0x42aefc){_0x42aefc=_0x42aefc||0xc8;return function(_0x37548e){if(_0x37548e){return _0x3932e2[_0x6e62('0x16')](_0x42aefc)[_0x6e62('0x18')](_0x37548e);}};}function respondWithFilteredResult(_0x5c8d73,_0x48b58b){return function(_0x1ff785){if(_0x1ff785){var _0x3dcaff=typeof _0x48b58b['offset']==='undefined'&&typeof _0x48b58b['limit']===_0x6e62('0x19');var _0x57f332=_0x1ff785[_0x6e62('0x1a')];var _0x3b69d3=_0x3dcaff?0x0:_0x48b58b[_0x6e62('0x1b')];var _0x291846=_0x3dcaff?_0x1ff785[_0x6e62('0x1a')]:_0x48b58b[_0x6e62('0x1b')]+_0x48b58b['limit'];var _0x100716;if(_0x291846>=_0x57f332){_0x291846=_0x57f332;_0x100716=0xc8;}else{_0x100716=0xce;}_0x5c8d73[_0x6e62('0x16')](_0x100716);return _0x5c8d73[_0x6e62('0x1c')](_0x6e62('0x1d'),_0x3b69d3+'-'+_0x291846+'/'+_0x57f332)[_0x6e62('0x18')](_0x1ff785);}return null;};}function patchUpdates(_0x1a18bd){return function(_0x32fe71){try{jsonpatch['apply'](_0x32fe71,_0x1a18bd,!![]);}catch(_0x39f44c){return BPromise[_0x6e62('0x1e')](_0x39f44c);}return _0x32fe71[_0x6e62('0x1f')]();};}function saveUpdates(_0x536fa9,_0x15bc9a){return function(_0x434d5f){if(_0x434d5f){return _0x434d5f[_0x6e62('0x20')](_0x536fa9)[_0x6e62('0x21')](function(_0x4cfc70){return _0x4cfc70;});}return null;};}function removeEntity(_0x1d135a,_0x35c2fa){return function(_0x5c3b4c){if(_0x5c3b4c){return _0x5c3b4c['destroy']()[_0x6e62('0x21')](function(){_0x1d135a[_0x6e62('0x16')](0xcc)[_0x6e62('0x17')]();});}};}function handleEntityNotFound(_0x27882b,_0x3bff71){return function(_0x475b90){if(!_0x475b90){_0x27882b[_0x6e62('0x22')](0x194);}return _0x475b90;};}function handleError(_0x46bfd1,_0x367a74){_0x367a74=_0x367a74||0x1f4;return function(_0x25235c){logger[_0x6e62('0x23')](_0x25235c['stack']);if(_0x25235c[_0x6e62('0x24')]){delete _0x25235c[_0x6e62('0x24')];}_0x46bfd1[_0x6e62('0x16')](_0x367a74)[_0x6e62('0x25')](_0x25235c);};}exports[_0x6e62('0x26')]=function(_0x7089c6,_0xea04e9){var _0x842090={},_0x427803={},_0x4e3503={'count':0x0,'rows':[]};var _0x47155f=_[_0x6e62('0x27')](db[_0x6e62('0x28')][_0x6e62('0x29')],function(_0xbaeb1d){return{'name':_0xbaeb1d['fieldName'],'type':_0xbaeb1d['type'][_0x6e62('0x2a')]};});_0x427803['model']=_[_0x6e62('0x27')](_0x47155f,_0x6e62('0x24'));_0x427803[_0x6e62('0x2b')]=_['keys'](_0x7089c6[_0x6e62('0x2b')]);_0x427803[_0x6e62('0x2c')]=_[_0x6e62('0x2d')](_0x427803[_0x6e62('0x2e')],_0x427803[_0x6e62('0x2b')]);_0x842090[_0x6e62('0x2f')]=_[_0x6e62('0x2d')](_0x427803['model'],qs[_0x6e62('0x30')](_0x7089c6[_0x6e62('0x2b')]['fields']));_0x842090['attributes']=_0x842090[_0x6e62('0x2f')][_0x6e62('0x31')]?_0x842090[_0x6e62('0x2f')]:_0x427803[_0x6e62('0x2e')];if(!_0x7089c6[_0x6e62('0x2b')][_0x6e62('0x32')]('nolimit')){_0x842090[_0x6e62('0x33')]=qs[_0x6e62('0x33')](_0x7089c6['query'][_0x6e62('0x33')]);_0x842090[_0x6e62('0x1b')]=qs[_0x6e62('0x1b')](_0x7089c6[_0x6e62('0x2b')][_0x6e62('0x1b')]);}_0x842090[_0x6e62('0x34')]=qs[_0x6e62('0x35')](_0x7089c6[_0x6e62('0x2b')]['sort']);_0x842090['where']=qs[_0x6e62('0x2c')](_[_0x6e62('0x36')](_0x7089c6[_0x6e62('0x2b')],_0x427803[_0x6e62('0x2c')]),_0x47155f);if(_0x7089c6[_0x6e62('0x2b')][_0x6e62('0x37')]){_0x842090['where']=_['merge'](_0x842090[_0x6e62('0x38')],{'$or':_[_0x6e62('0x27')](_0x47155f,function(_0x2cc7bd){if(_0x2cc7bd[_0x6e62('0x39')]!==_0x6e62('0x3a')){var _0x528a00={};_0x528a00[_0x2cc7bd[_0x6e62('0x24')]]={'$like':'%'+_0x7089c6[_0x6e62('0x2b')]['filter']+'%'};return _0x528a00;}})});}_0x842090=_[_0x6e62('0x3b')]({},_0x842090,_0x7089c6['options']);var _0x3caeb4={'where':_0x842090[_0x6e62('0x38')]};return db[_0x6e62('0x28')]['count'](_0x3caeb4)[_0x6e62('0x21')](function(_0x1f2f1d){_0x4e3503[_0x6e62('0x1a')]=_0x1f2f1d;if(_0x7089c6[_0x6e62('0x2b')]['includeAll']){_0x842090['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x842090);})[_0x6e62('0x21')](function(_0x1d4452){_0x4e3503[_0x6e62('0x3c')]=_0x1d4452;return _0x4e3503;})['then'](respondWithFilteredResult(_0xea04e9,_0x842090))[_0x6e62('0x3d')](handleError(_0xea04e9,null));};exports[_0x6e62('0x3e')]=function(_0x279579,_0xc8b18e){var _0x2ff046={'raw':!![],'where':{'id':_0x279579[_0x6e62('0x3f')]['id']}},_0x1ece39={};_0x1ece39['model']=_[_0x6e62('0x40')](db[_0x6e62('0x28')][_0x6e62('0x29')]);_0x1ece39[_0x6e62('0x2b')]=_[_0x6e62('0x40')](_0x279579[_0x6e62('0x2b')]);_0x1ece39[_0x6e62('0x2c')]=_[_0x6e62('0x2d')](_0x1ece39[_0x6e62('0x2e')],_0x1ece39[_0x6e62('0x2b')]);_0x2ff046[_0x6e62('0x2f')]=_[_0x6e62('0x2d')](_0x1ece39[_0x6e62('0x2e')],qs[_0x6e62('0x30')](_0x279579[_0x6e62('0x2b')][_0x6e62('0x30')]));_0x2ff046['attributes']=_0x2ff046[_0x6e62('0x2f')][_0x6e62('0x31')]?_0x2ff046['attributes']:_0x1ece39[_0x6e62('0x2e')];if(_0x279579[_0x6e62('0x2b')][_0x6e62('0x41')]){_0x2ff046['include']=[{'all':!![]}];}_0x2ff046=_['merge']({},_0x2ff046,_0x279579[_0x6e62('0x42')]);return db[_0x6e62('0x28')]['find'](_0x2ff046)['then'](handleEntityNotFound(_0xc8b18e,null))[_0x6e62('0x21')](respondWithResult(_0xc8b18e,null))['catch'](handleError(_0xc8b18e,null));};exports[_0x6e62('0x43')]=function(_0x24c890,_0x2e0e7f){return db[_0x6e62('0x28')][_0x6e62('0x43')](_0x24c890[_0x6e62('0x44')],{})[_0x6e62('0x21')](respondWithResult(_0x2e0e7f,0xc9))[_0x6e62('0x3d')](handleError(_0x2e0e7f,null));};exports['update']=function(_0x4d09c2,_0x58e73b){if(_0x4d09c2['body']['id']){delete _0x4d09c2[_0x6e62('0x44')]['id'];}return db[_0x6e62('0x28')][_0x6e62('0x45')]({'where':{'id':_0x4d09c2[_0x6e62('0x3f')]['id']}})['then'](handleEntityNotFound(_0x58e73b,null))[_0x6e62('0x21')](saveUpdates(_0x4d09c2['body'],null))[_0x6e62('0x21')](respondWithResult(_0x58e73b,null))[_0x6e62('0x3d')](handleError(_0x58e73b,null));};exports[_0x6e62('0x46')]=function(_0x41783b,_0x2bb113){return db[_0x6e62('0x28')][_0x6e62('0x45')]({'where':{'id':_0x41783b[_0x6e62('0x3f')]['id']}})[_0x6e62('0x21')](handleEntityNotFound(_0x2bb113,null))['then'](removeEntity(_0x2bb113,null))[_0x6e62('0x3d')](handleError(_0x2bb113,null));}; \ No newline at end of file +var _0xe25b=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','end','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','type','key','keys','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','body','update','eml-format','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra'];(function(_0x3d6395,_0x808e0){var _0x3f697e=function(_0x2bc7eb){while(--_0x2bc7eb){_0x3d6395['push'](_0x3d6395['shift']());}};_0x3f697e(++_0x808e0);}(_0xe25b,0x1cd));var _0xbe25=function(_0x448853,_0x858022){_0x448853=_0x448853-0x0;var _0x20b5b3=_0xe25b[_0x448853];return _0x20b5b3;};'use strict';var emlformat=require(_0xbe25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbe25('0x2'));var BPromise=require(_0xbe25('0x3'));var Mustache=require(_0xbe25('0x4'));var util=require('util');var path=require(_0xbe25('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbe25('0x6'));var fs=require('fs');var fs_extra=require(_0xbe25('0x7'));var _=require(_0xbe25('0x8'));var squel=require('squel');var crypto=require(_0xbe25('0x9'));var jsforce=require(_0xbe25('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe25('0xb'));var Papa=require(_0xbe25('0xc'));var Redis=require(_0xbe25('0xd'));var authService=require(_0xbe25('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe25('0xf'))('api');var utils=require(_0xbe25('0x10'));var config=require(_0xbe25('0x11'));var licenseUtil=require(_0xbe25('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x189c27,_0x44f413){_0x44f413=_0x44f413||0xcc;return function(_0x1a1c34){if(_0x1a1c34){return _0x189c27['sendStatus'](_0x44f413);}return _0x189c27[_0xbe25('0x13')](_0x44f413)['end']();};}function respondWithResult(_0x5bad55,_0x5260bd){_0x5260bd=_0x5260bd||0xc8;return function(_0x4cf94a){if(_0x4cf94a){return _0x5bad55[_0xbe25('0x13')](_0x5260bd)[_0xbe25('0x14')](_0x4cf94a);}};}function respondWithFilteredResult(_0x37acf3,_0x4b36fe){return function(_0x2c8746){if(_0x2c8746){var _0x22792f=typeof _0x4b36fe[_0xbe25('0x15')]===_0xbe25('0x16')&&typeof _0x4b36fe[_0xbe25('0x17')]===_0xbe25('0x16');var _0x38cc49=_0x2c8746[_0xbe25('0x18')];var _0x368fd7=_0x22792f?0x0:_0x4b36fe[_0xbe25('0x15')];var _0x3f70c2=_0x22792f?_0x2c8746[_0xbe25('0x18')]:_0x4b36fe[_0xbe25('0x15')]+_0x4b36fe[_0xbe25('0x17')];var _0x31b1ad;if(_0x3f70c2>=_0x38cc49){_0x3f70c2=_0x38cc49;_0x31b1ad=0xc8;}else{_0x31b1ad=0xce;}_0x37acf3[_0xbe25('0x13')](_0x31b1ad);return _0x37acf3[_0xbe25('0x19')](_0xbe25('0x1a'),_0x368fd7+'-'+_0x3f70c2+'/'+_0x38cc49)[_0xbe25('0x14')](_0x2c8746);}return null;};}function patchUpdates(_0x4345da){return function(_0x39912c){try{jsonpatch[_0xbe25('0x1b')](_0x39912c,_0x4345da,!![]);}catch(_0x564b27){return BPromise['reject'](_0x564b27);}return _0x39912c['save']();};}function saveUpdates(_0x219f8b,_0x2ebff9){return function(_0x4ba276){if(_0x4ba276){return _0x4ba276['update'](_0x219f8b)['then'](function(_0x12263b){return _0x12263b;});}return null;};}function removeEntity(_0x50b17e,_0x3cec6f){return function(_0x43a550){if(_0x43a550){return _0x43a550[_0xbe25('0x1c')]()[_0xbe25('0x1d')](function(){_0x50b17e[_0xbe25('0x13')](0xcc)[_0xbe25('0x1e')]();});}};}function handleEntityNotFound(_0x346643,_0x2420c6){return function(_0x3fabcd){if(!_0x3fabcd){_0x346643[_0xbe25('0x1f')](0x194);}return _0x3fabcd;};}function handleError(_0x5538fd,_0x3f47dd){_0x3f47dd=_0x3f47dd||0x1f4;return function(_0x268705){logger[_0xbe25('0x20')](_0x268705[_0xbe25('0x21')]);if(_0x268705['name']){delete _0x268705[_0xbe25('0x22')];}_0x5538fd[_0xbe25('0x13')](_0x3f47dd)[_0xbe25('0x23')](_0x268705);};}exports['index']=function(_0x33ac3b,_0x137b61){var _0x586527={},_0xd1db4a={},_0xbe020a={'count':0x0,'rows':[]};var _0x5537b6=_[_0xbe25('0x24')](db[_0xbe25('0x25')][_0xbe25('0x26')],function(_0x9d8729){return{'name':_0x9d8729['fieldName'],'type':_0x9d8729[_0xbe25('0x27')][_0xbe25('0x28')]};});_0xd1db4a['model']=_[_0xbe25('0x24')](_0x5537b6,'name');_0xd1db4a['query']=_[_0xbe25('0x29')](_0x33ac3b[_0xbe25('0x2a')]);_0xd1db4a[_0xbe25('0x2b')]=_['intersection'](_0xd1db4a[_0xbe25('0x2c')],_0xd1db4a[_0xbe25('0x2a')]);_0x586527[_0xbe25('0x2d')]=_[_0xbe25('0x2e')](_0xd1db4a['model'],qs[_0xbe25('0x2f')](_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x2f')]));_0x586527[_0xbe25('0x2d')]=_0x586527['attributes']['length']?_0x586527[_0xbe25('0x2d')]:_0xd1db4a['model'];if(!_0x33ac3b[_0xbe25('0x2a')]['hasOwnProperty']('nolimit')){_0x586527[_0xbe25('0x17')]=qs[_0xbe25('0x17')](_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x17')]);_0x586527[_0xbe25('0x15')]=qs[_0xbe25('0x15')](_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x15')]);}_0x586527[_0xbe25('0x30')]=qs[_0xbe25('0x31')](_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x31')]);_0x586527[_0xbe25('0x32')]=qs[_0xbe25('0x2b')](_[_0xbe25('0x33')](_0x33ac3b[_0xbe25('0x2a')],_0xd1db4a[_0xbe25('0x2b')]),_0x5537b6);if(_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x34')]){_0x586527['where']=_[_0xbe25('0x35')](_0x586527[_0xbe25('0x32')],{'$or':_[_0xbe25('0x24')](_0x5537b6,function(_0x35e699){if(_0x35e699[_0xbe25('0x27')]!==_0xbe25('0x36')){var _0x59eb25={};_0x59eb25[_0x35e699[_0xbe25('0x22')]]={'$like':'%'+_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x34')]+'%'};return _0x59eb25;}})});}_0x586527=_[_0xbe25('0x35')]({},_0x586527,_0x33ac3b[_0xbe25('0x37')]);var _0x183b3d={'where':_0x586527[_0xbe25('0x32')]};return db[_0xbe25('0x25')][_0xbe25('0x18')](_0x183b3d)['then'](function(_0xeb8e9d){_0xbe020a[_0xbe25('0x18')]=_0xeb8e9d;if(_0x33ac3b[_0xbe25('0x2a')][_0xbe25('0x38')]){_0x586527['include']=[{'all':!![]}];}return db[_0xbe25('0x25')][_0xbe25('0x39')](_0x586527);})[_0xbe25('0x1d')](function(_0x15303b){_0xbe020a[_0xbe25('0x3a')]=_0x15303b;return _0xbe020a;})[_0xbe25('0x1d')](respondWithFilteredResult(_0x137b61,_0x586527))[_0xbe25('0x3b')](handleError(_0x137b61,null));};exports[_0xbe25('0x3c')]=function(_0x36ad20,_0x475f2e){var _0x49056c={'raw':!![],'where':{'id':_0x36ad20[_0xbe25('0x3d')]['id']}},_0x195b66={};_0x195b66['model']=_[_0xbe25('0x29')](db[_0xbe25('0x25')][_0xbe25('0x26')]);_0x195b66[_0xbe25('0x2a')]=_[_0xbe25('0x29')](_0x36ad20[_0xbe25('0x2a')]);_0x195b66[_0xbe25('0x2b')]=_[_0xbe25('0x2e')](_0x195b66[_0xbe25('0x2c')],_0x195b66['query']);_0x49056c[_0xbe25('0x2d')]=_[_0xbe25('0x2e')](_0x195b66[_0xbe25('0x2c')],qs[_0xbe25('0x2f')](_0x36ad20[_0xbe25('0x2a')][_0xbe25('0x2f')]));_0x49056c[_0xbe25('0x2d')]=_0x49056c['attributes'][_0xbe25('0x3e')]?_0x49056c[_0xbe25('0x2d')]:_0x195b66['model'];if(_0x36ad20[_0xbe25('0x2a')][_0xbe25('0x38')]){_0x49056c[_0xbe25('0x3f')]=[{'all':!![]}];}_0x49056c=_[_0xbe25('0x35')]({},_0x49056c,_0x36ad20[_0xbe25('0x37')]);return db['AnalyticTreeReport'][_0xbe25('0x40')](_0x49056c)[_0xbe25('0x1d')](handleEntityNotFound(_0x475f2e,null))[_0xbe25('0x1d')](respondWithResult(_0x475f2e,null))[_0xbe25('0x3b')](handleError(_0x475f2e,null));};exports['create']=function(_0x345dec,_0x5bea67){return db[_0xbe25('0x25')]['create'](_0x345dec[_0xbe25('0x41')],{})[_0xbe25('0x1d')](respondWithResult(_0x5bea67,0xc9))['catch'](handleError(_0x5bea67,null));};exports[_0xbe25('0x42')]=function(_0x174166,_0x338e5e){if(_0x174166[_0xbe25('0x41')]['id']){delete _0x174166[_0xbe25('0x41')]['id'];}return db[_0xbe25('0x25')]['find']({'where':{'id':_0x174166[_0xbe25('0x3d')]['id']}})[_0xbe25('0x1d')](handleEntityNotFound(_0x338e5e,null))[_0xbe25('0x1d')](saveUpdates(_0x174166[_0xbe25('0x41')],null))['then'](respondWithResult(_0x338e5e,null))[_0xbe25('0x3b')](handleError(_0x338e5e,null));};exports[_0xbe25('0x1c')]=function(_0xa6ff5c,_0x593404){return db[_0xbe25('0x25')]['find']({'where':{'id':_0xa6ff5c[_0xbe25('0x3d')]['id']}})[_0xbe25('0x1d')](handleEntityNotFound(_0x593404,null))['then'](removeEntity(_0x593404,null))[_0xbe25('0x3b')](handleError(_0x593404,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index cb31cd0..27c2f52 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 _0x16c9=['exports','AnalyticTreeReport','analytics_report_trees','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x4ec274,_0xdf8df0){var _0x2f3647=function(_0x5abf3c){while(--_0x5abf3c){_0x4ec274['push'](_0x4ec274['shift']());}};_0x2f3647(++_0xdf8df0);}(_0x16c9,0x1a5));var _0x916c=function(_0x53b9ff,_0x89eb4f){_0x53b9ff=_0x53b9ff-0x0;var _0x3eee48=_0x16c9[_0x53b9ff];return _0x3eee48;};'use strict';var _=require(_0x916c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x916c('0x1'));var BPromise=require(_0x916c('0x2'));var rp=require(_0x916c('0x3'));var fs=require('fs');var path=require(_0x916c('0x4'));var rimraf=require(_0x916c('0x5'));var config=require(_0x916c('0x6'));var attributes=require(_0x916c('0x7'));module[_0x916c('0x8')]=function(_0x5078d1,_0x5ea000){return _0x5078d1['define'](_0x916c('0x9'),attributes,{'tableName':_0x916c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2179=['moment','bluebird','request-promise','path','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2179,0xce));var _0x9217=function(_0x38edc7,_0x5d0576){_0x38edc7=_0x38edc7-0x0;var _0x3eb41e=_0x2179[_0x38edc7];return _0x3eb41e;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var logger=require(_0x9217('0x2'))('api');var moment=require(_0x9217('0x3'));var BPromise=require(_0x9217('0x4'));var rp=require(_0x9217('0x5'));var fs=require('fs');var path=require(_0x9217('0x6'));var rimraf=require('rimraf');var config=require(_0x9217('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x9217('0x8')]=function(_0x3f7077,_0x558355){return _0x3f7077['define'](_0x9217('0x9'),attributes,{'tableName':_0x9217('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index b339da9..506c4e3 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5da955,_0x32d5cd){var _0x5450d6=function(_0x540565){while(--_0x540565){_0x5da955['push'](_0x5da955['shift']());}};_0x5450d6(++_0x32d5cd);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ae150,_0x817f38){_0x4ae150=_0x4ae150-0x0;var _0xe87f12=_0x2ef3[_0x4ae150];return _0xe87f12;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1ad7fc,_0x444145){var _0x3bb433=function(_0x1e27ef){while(--_0x1e27ef){_0x1ad7fc['push'](_0x1ad7fc['shift']());}};_0x3bb433(++_0x444145);}(_0x2ef3,0xba));var _0x32ef=function(_0x1bb050,_0x41970d){_0x1bb050=_0x1bb050-0x0;var _0x4e4857=_0x2ef3[_0x1bb050];return _0x4e4857;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a6a3f39..a8a1711 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 _0x2c63=['path','express','Router','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x3c9df8,_0x387a5d){var _0x3c8cd3=function(_0x4a0541){while(--_0x4a0541){_0x3c9df8['push'](_0x3c9df8['shift']());}};_0x3c8cd3(++_0x387a5d);}(_0x2c63,0xed));var _0x32c6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2c63[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x32c6('0x0'));var path=require(_0x32c6('0x1'));var timeout=require('connect-timeout');var express=require(_0x32c6('0x2'));var router=express[_0x32c6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32c6('0x4'));var controller=require(_0x32c6('0x5'));router[_0x32c6('0x6')]('/',auth[_0x32c6('0x7')](),controller['index']);router[_0x32c6('0x6')](_0x32c6('0x8'),auth['isAuthenticated'](),controller[_0x32c6('0x9')]);router[_0x32c6('0xa')]('/',auth['isAuthenticated'](),controller[_0x32c6('0xb')]);router[_0x32c6('0xc')](_0x32c6('0x8'),auth[_0x32c6('0x7')](),controller[_0x32c6('0xd')]);router[_0x32c6('0xe')](_0x32c6('0x8'),auth['isAuthenticated'](),controller[_0x32c6('0xf')]);module[_0x32c6('0x10')]=router; \ No newline at end of file +var _0x64a6=['get','isAuthenticated','index','/:id','post','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller'];(function(_0x81e27a,_0xeed7b7){var _0x429715=function(_0x21c5f9){while(--_0x21c5f9){_0x81e27a['push'](_0x81e27a['shift']());}};_0x429715(++_0xeed7b7);}(_0x64a6,0xd4));var _0x664a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x64a6[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x664a('0x0'));var util=require(_0x664a('0x1'));var path=require('path');var timeout=require(_0x664a('0x2'));var express=require(_0x664a('0x3'));var router=express[_0x664a('0x4')]();var fs_extra=require(_0x664a('0x5'));var auth=require(_0x664a('0x6'));var interaction=require(_0x664a('0x7'));var config=require('../../config/environment');var controller=require(_0x664a('0x8'));router[_0x664a('0x9')]('/',auth[_0x664a('0xa')](),controller[_0x664a('0xb')]);router['get'](_0x664a('0xc'),auth[_0x664a('0xa')](),controller['show']);router[_0x664a('0xd')]('/',auth[_0x664a('0xa')](),controller['create']);router[_0x664a('0xe')]('/:id',auth[_0x664a('0xa')](),controller[_0x664a('0xf')]);router['delete'](_0x664a('0xc'),auth['isAuthenticated'](),controller[_0x664a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e21f6e0..4af7855 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 _0xaf9b=['STRING','sequelize'];(function(_0x4f6337,_0x3a75bf){var _0x2bd335=function(_0x23aaa9){while(--_0x23aaa9){_0x4f6337['push'](_0x4f6337['shift']());}};_0x2bd335(++_0x3a75bf);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x2f24d1,_0x4a9e7e){_0x2f24d1=_0x2f24d1-0x0;var _0x49a3f7=_0xaf9b[_0x2f24d1];return _0x49a3f7;};'use strict';var Sequelize=require(_0xbaf9('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaf9('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbaf9('0x1')]}}; \ No newline at end of file +var _0xc368=['STRING','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xc368,0x7b));var _0x8c36=function(_0x463a63,_0x2e9612){_0x463a63=_0x463a63-0x0;var _0x1cd88f=_0xc368[_0x463a63];return _0x1cd88f;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x8c36('0x1')]},'type':{'type':Sequelize[_0x8c36('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 14f4ab4..7ebde69 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 _0xa53b=['findAll','show','params','rawAttributes','includeAll','include','find','catch','clone','get','createdAt','updatedAt','body','omit','create','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Attachment','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa53b,0x1d7));var _0xba53=function(_0x2898df,_0x5b750e){_0x2898df=_0x2898df-0x0;var _0x47dab3=_0xa53b[_0x2898df];return _0x47dab3;};'use strict';var emlformat=require(_0xba53('0x0'));var rimraf=require(_0xba53('0x1'));var zipdir=require(_0xba53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba53('0x3'));var BPromise=require(_0xba53('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba53('0x5'));var sox=require(_0xba53('0x6'));var csv=require(_0xba53('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba53('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xba53('0x9'));var jsforce=require(_0xba53('0xa'));var deskjs=require(_0xba53('0xb'));var toCsv=require(_0xba53('0x7'));var querystring=require(_0xba53('0xc'));var Papa=require('papaparse');var Redis=require(_0xba53('0xd'));var authService=require(_0xba53('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xba53('0xf'));var hardwareService=require(_0xba53('0x10'));var logger=require(_0xba53('0x11'))(_0xba53('0x12'));var utils=require(_0xba53('0x13'));var config=require(_0xba53('0x14'));var licenseUtil=require(_0xba53('0x15'));var db=require(_0xba53('0x16'))['db'];function respondWithStatusCode(_0x1a1b58,_0xc47984){_0xc47984=_0xc47984||0xcc;return function(_0x2ed133){if(_0x2ed133){return _0x1a1b58[_0xba53('0x17')](_0xc47984);}return _0x1a1b58[_0xba53('0x18')](_0xc47984)[_0xba53('0x19')]();};}function respondWithResult(_0x19e4ee,_0x173f26){_0x173f26=_0x173f26||0xc8;return function(_0x1e55fd){if(_0x1e55fd){return _0x19e4ee['status'](_0x173f26)[_0xba53('0x1a')](_0x1e55fd);}};}function respondWithFilteredResult(_0x1e6fec,_0x44dae3){return function(_0x243e78){if(_0x243e78){var _0x208f24=typeof _0x44dae3[_0xba53('0x1b')]===_0xba53('0x1c')&&typeof _0x44dae3[_0xba53('0x1d')]===_0xba53('0x1c');var _0x19e2f6=_0x243e78[_0xba53('0x1e')];var _0x15de98=_0x208f24?0x0:_0x44dae3[_0xba53('0x1b')];var _0x22dd1b=_0x208f24?_0x243e78[_0xba53('0x1e')]:_0x44dae3[_0xba53('0x1b')]+_0x44dae3['limit'];var _0x232e88;if(_0x22dd1b>=_0x19e2f6){_0x22dd1b=_0x19e2f6;_0x232e88=0xc8;}else{_0x232e88=0xce;}_0x1e6fec['status'](_0x232e88);return _0x1e6fec[_0xba53('0x1f')](_0xba53('0x20'),_0x15de98+'-'+_0x22dd1b+'/'+_0x19e2f6)[_0xba53('0x1a')](_0x243e78);}return null;};}function patchUpdates(_0x5a041a){return function(_0x369ea7){try{jsonpatch[_0xba53('0x21')](_0x369ea7,_0x5a041a,!![]);}catch(_0x5346db){return BPromise[_0xba53('0x22')](_0x5346db);}return _0x369ea7[_0xba53('0x23')]();};}function saveUpdates(_0x31558c,_0x4383c9){return function(_0xd892e0){if(_0xd892e0){return _0xd892e0[_0xba53('0x24')](_0x31558c)[_0xba53('0x25')](function(_0x1226b7){return _0x1226b7;});}return null;};}function removeEntity(_0x23e692,_0xbba862){return function(_0x32a3ad){if(_0x32a3ad){return _0x32a3ad[_0xba53('0x26')]()['then'](function(){_0x23e692[_0xba53('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4561e6,_0x22f050){return function(_0x2f0ac5){if(!_0x2f0ac5){_0x4561e6['sendStatus'](0x194);}return _0x2f0ac5;};}function handleError(_0x4dd3ad,_0xae0d36){_0xae0d36=_0xae0d36||0x1f4;return function(_0x4ad626){logger['error'](_0x4ad626[_0xba53('0x27')]);if(_0x4ad626[_0xba53('0x28')]){delete _0x4ad626['name'];}_0x4dd3ad[_0xba53('0x18')](_0xae0d36)[_0xba53('0x29')](_0x4ad626);};}exports[_0xba53('0x2a')]=function(_0x4c067e,_0x38dd66){var _0x1a046f={},_0x5447ec={},_0x54059d={'count':0x0,'rows':[]};var _0x5d1c64=_[_0xba53('0x2b')](db[_0xba53('0x2c')]['rawAttributes'],function(_0x33a001){return{'name':_0x33a001['fieldName'],'type':_0x33a001[_0xba53('0x2d')]['key']};});_0x5447ec[_0xba53('0x2e')]=_['map'](_0x5d1c64,'name');_0x5447ec[_0xba53('0x2f')]=_[_0xba53('0x30')](_0x4c067e[_0xba53('0x2f')]);_0x5447ec[_0xba53('0x31')]=_[_0xba53('0x32')](_0x5447ec[_0xba53('0x2e')],_0x5447ec[_0xba53('0x2f')]);_0x1a046f['attributes']=_[_0xba53('0x32')](_0x5447ec['model'],qs[_0xba53('0x33')](_0x4c067e['query'][_0xba53('0x33')]));_0x1a046f[_0xba53('0x34')]=_0x1a046f[_0xba53('0x34')][_0xba53('0x35')]?_0x1a046f[_0xba53('0x34')]:_0x5447ec[_0xba53('0x2e')];if(!_0x4c067e[_0xba53('0x2f')][_0xba53('0x36')](_0xba53('0x37'))){_0x1a046f[_0xba53('0x1d')]=qs['limit'](_0x4c067e['query'][_0xba53('0x1d')]);_0x1a046f[_0xba53('0x1b')]=qs[_0xba53('0x1b')](_0x4c067e[_0xba53('0x2f')][_0xba53('0x1b')]);}_0x1a046f['order']=qs[_0xba53('0x38')](_0x4c067e['query']['sort']);_0x1a046f[_0xba53('0x39')]=qs[_0xba53('0x31')](_[_0xba53('0x3a')](_0x4c067e[_0xba53('0x2f')],_0x5447ec[_0xba53('0x31')]),_0x5d1c64);if(_0x4c067e['query'][_0xba53('0x3b')]){_0x1a046f[_0xba53('0x39')]=_[_0xba53('0x3c')](_0x1a046f[_0xba53('0x39')],{'$or':_[_0xba53('0x2b')](_0x5d1c64,function(_0x2a8c9c){if(_0x2a8c9c[_0xba53('0x2d')]!==_0xba53('0x3d')){var _0x348e41={};_0x348e41[_0x2a8c9c[_0xba53('0x28')]]={'$like':'%'+_0x4c067e[_0xba53('0x2f')][_0xba53('0x3b')]+'%'};return _0x348e41;}})});}_0x1a046f=_[_0xba53('0x3c')]({},_0x1a046f,_0x4c067e[_0xba53('0x3e')]);var _0x2e6d8b={'where':_0x1a046f['where']};return db[_0xba53('0x2c')]['count'](_0x2e6d8b)[_0xba53('0x25')](function(_0x51af91){_0x54059d[_0xba53('0x1e')]=_0x51af91;if(_0x4c067e[_0xba53('0x2f')]['includeAll']){_0x1a046f['include']=[{'all':!![]}];}return db[_0xba53('0x2c')][_0xba53('0x3f')](_0x1a046f);})['then'](function(_0xdefd2f){_0x54059d['rows']=_0xdefd2f;return _0x54059d;})[_0xba53('0x25')](respondWithFilteredResult(_0x38dd66,_0x1a046f))['catch'](handleError(_0x38dd66,null));};exports[_0xba53('0x40')]=function(_0x4a2ad3,_0x1803bd){var _0x11ff36={'raw':!![],'where':{'id':_0x4a2ad3[_0xba53('0x41')]['id']}},_0x5314b6={};_0x5314b6[_0xba53('0x2e')]=_[_0xba53('0x30')](db[_0xba53('0x2c')][_0xba53('0x42')]);_0x5314b6[_0xba53('0x2f')]=_[_0xba53('0x30')](_0x4a2ad3[_0xba53('0x2f')]);_0x5314b6[_0xba53('0x31')]=_[_0xba53('0x32')](_0x5314b6[_0xba53('0x2e')],_0x5314b6[_0xba53('0x2f')]);_0x11ff36['attributes']=_['intersection'](_0x5314b6['model'],qs[_0xba53('0x33')](_0x4a2ad3['query'][_0xba53('0x33')]));_0x11ff36['attributes']=_0x11ff36[_0xba53('0x34')][_0xba53('0x35')]?_0x11ff36['attributes']:_0x5314b6[_0xba53('0x2e')];if(_0x4a2ad3['query'][_0xba53('0x43')]){_0x11ff36[_0xba53('0x44')]=[{'all':!![]}];}_0x11ff36=_['merge']({},_0x11ff36,_0x4a2ad3[_0xba53('0x3e')]);return db[_0xba53('0x2c')][_0xba53('0x45')](_0x11ff36)[_0xba53('0x25')](handleEntityNotFound(_0x1803bd,null))[_0xba53('0x25')](respondWithResult(_0x1803bd,null))[_0xba53('0x46')](handleError(_0x1803bd,null));};exports[_0xba53('0x47')]=function(_0x50969a,_0x3391c8){var _0x5147a2={'where':{'id':_0x50969a[_0xba53('0x41')]['id']}},_0x45f8ee={};_0x45f8ee['model']=_[_0xba53('0x30')](db[_0xba53('0x2c')][_0xba53('0x42')]);_0x5147a2[_0xba53('0x34')]=_[_0xba53('0x32')](_0x45f8ee[_0xba53('0x2e')],qs['fields'](_0x50969a[_0xba53('0x2f')][_0xba53('0x33')]));_0x5147a2[_0xba53('0x34')]=_0x5147a2['attributes'][_0xba53('0x35')]?_0x5147a2[_0xba53('0x34')]:_0x45f8ee['model'];if(_0x50969a[_0xba53('0x2f')][_0xba53('0x43')]){_0x5147a2[_0xba53('0x44')]=[{'all':!![]}];}_0x5147a2=_[_0xba53('0x3c')]({},_0x5147a2,_0x50969a[_0xba53('0x3e')]);return db[_0xba53('0x2c')][_0xba53('0x45')](_0x5147a2)[_0xba53('0x25')](handleEntityNotFound(_0x3391c8,null))[_0xba53('0x25')](function(_0x5a4c0a){if(_0x5a4c0a){var _0x40cc87=_0x5a4c0a[_0xba53('0x48')]({'plain':!![]});_0x40cc87=qs['omit'](_0x40cc87,['id',_0xba53('0x49'),_0xba53('0x4a')]);_0x50969a[_0xba53('0x4b')]=_[_0xba53('0x4c')](_0x50969a['body'],['id',_0xba53('0x49'),_0xba53('0x4a')]);return db[_0xba53('0x2c')][_0xba53('0x4d')](_[_0xba53('0x3c')](_0x40cc87,_0x50969a[_0xba53('0x4b')]),{'include':_0x50969a[_0xba53('0x2f')][_0xba53('0x43')]?[{'all':!![]}]:undefined});}})[_0xba53('0x25')](respondWithResult(_0x3391c8,0xc9))[_0xba53('0x46')](handleError(_0x3391c8,null));};exports[_0xba53('0x24')]=function(_0x1c12ab,_0x57381b){if(_0x1c12ab[_0xba53('0x4b')]['id']){delete _0x1c12ab[_0xba53('0x4b')]['id'];}return db[_0xba53('0x2c')][_0xba53('0x45')]({'where':{'id':_0x1c12ab[_0xba53('0x41')]['id']}})['then'](handleEntityNotFound(_0x57381b,null))[_0xba53('0x25')](saveUpdates(_0x1c12ab['body'],null))[_0xba53('0x25')](respondWithResult(_0x57381b,null))[_0xba53('0x46')](handleError(_0x57381b,null));};exports[_0xba53('0x26')]=function(_0x4ec8c1,_0x48ef4e){return db[_0xba53('0x2c')][_0xba53('0x45')]({'where':{'id':_0x4ec8c1['params']['id']}})['then'](handleEntityNotFound(_0x48ef4e,null))[_0xba53('0x25')](removeEntity(_0x48ef4e,null))['catch'](handleError(_0x48ef4e,null));};exports[_0xba53('0x4d')]=function(_0x197d3e,_0x361403,_0x5bc2a2){_0x197d3e[_0xba53('0x4b')]['name']=_0x197d3e[_0xba53('0x4e')]['originalname'];_0x197d3e['body'][_0xba53('0x4f')]=_0x197d3e[_0xba53('0x4e')][_0xba53('0x50')];_0x197d3e[_0xba53('0x4b')][_0xba53('0x2d')]=_0x197d3e[_0xba53('0x4e')][_0xba53('0x51')];return db['Attachment'][_0xba53('0x4d')](_0x197d3e[_0xba53('0x4b')])[_0xba53('0x25')](respondWithResult(_0x361403,0xc9))[_0xba53('0x46')](handleError(_0x361403,null));};exports[_0xba53('0x52')]=function(_0x32c38f,_0x54dd04,_0x150f70){return db[_0xba53('0x2c')][_0xba53('0x53')]({'where':{'id':_0x32c38f[_0xba53('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x54dd04,null))[_0xba53('0x25')](function(_0x4eab44){if(_0x4eab44){var _0x4fa7c5=_0x4eab44[_0xba53('0x54')]!==null;var _0x5e994d=path[_0xba53('0x55')](config[_0xba53('0x56')],_0xba53('0x57'));if(_0x4fa7c5){_0x5e994d=path[_0xba53('0x55')](_0x5e994d,_0xba53('0x58'));}var _0x2acfb4=path[_0xba53('0x55')](_0x5e994d,_0x4eab44['basename']);return _0x54dd04[_0xba53('0x52')](_0x2acfb4);}})[_0xba53('0x46')](handleError(_0x54dd04,null));}; \ No newline at end of file +var _0x08f8=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','Attachment','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','clone','get','omit','createdAt','updatedAt','body','create','update','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0x3c6bc6,_0x5b2080){var _0x1a22e6=function(_0x3d3443){while(--_0x3d3443){_0x3c6bc6['push'](_0x3c6bc6['shift']());}};_0x1a22e6(++_0x5b2080);}(_0x08f8,0x16c));var _0x808f=function(_0x4ac225,_0x2e8e23){_0x4ac225=_0x4ac225-0x0;var _0x584273=_0x08f8[_0x4ac225];return _0x584273;};'use strict';var emlformat=require(_0x808f('0x0'));var rimraf=require(_0x808f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x808f('0x2'));var moment=require('moment');var BPromise=require(_0x808f('0x3'));var Mustache=require(_0x808f('0x4'));var util=require('util');var path=require(_0x808f('0x5'));var sox=require(_0x808f('0x6'));var csv=require(_0x808f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x808f('0x8'));var squel=require(_0x808f('0x9'));var crypto=require('crypto');var jsforce=require(_0x808f('0xa'));var deskjs=require(_0x808f('0xb'));var toCsv=require(_0x808f('0x7'));var querystring=require(_0x808f('0xc'));var Papa=require('papaparse');var Redis=require(_0x808f('0xd'));var authService=require(_0x808f('0xe'));var qs=require(_0x808f('0xf'));var as=require(_0x808f('0x10'));var hardwareService=require(_0x808f('0x11'));var logger=require(_0x808f('0x12'))(_0x808f('0x13'));var utils=require(_0x808f('0x14'));var config=require(_0x808f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x808f('0x16'))['db'];function respondWithStatusCode(_0x116d69,_0x19b064){_0x19b064=_0x19b064||0xcc;return function(_0x555855){if(_0x555855){return _0x116d69[_0x808f('0x17')](_0x19b064);}return _0x116d69[_0x808f('0x18')](_0x19b064)[_0x808f('0x19')]();};}function respondWithResult(_0x54b435,_0x56ee63){_0x56ee63=_0x56ee63||0xc8;return function(_0x15fcce){if(_0x15fcce){return _0x54b435[_0x808f('0x18')](_0x56ee63)[_0x808f('0x1a')](_0x15fcce);}};}function respondWithFilteredResult(_0x5a6780,_0x3549f4){return function(_0x5ca21f){if(_0x5ca21f){var _0x39fc28=typeof _0x3549f4['offset']===_0x808f('0x1b')&&typeof _0x3549f4[_0x808f('0x1c')]===_0x808f('0x1b');var _0x195a14=_0x5ca21f[_0x808f('0x1d')];var _0x471a6e=_0x39fc28?0x0:_0x3549f4[_0x808f('0x1e')];var _0x160922=_0x39fc28?_0x5ca21f[_0x808f('0x1d')]:_0x3549f4[_0x808f('0x1e')]+_0x3549f4[_0x808f('0x1c')];var _0x16a9e7;if(_0x160922>=_0x195a14){_0x160922=_0x195a14;_0x16a9e7=0xc8;}else{_0x16a9e7=0xce;}_0x5a6780['status'](_0x16a9e7);return _0x5a6780[_0x808f('0x1f')](_0x808f('0x20'),_0x471a6e+'-'+_0x160922+'/'+_0x195a14)[_0x808f('0x1a')](_0x5ca21f);}return null;};}function patchUpdates(_0x283119){return function(_0x4b5387){try{jsonpatch[_0x808f('0x21')](_0x4b5387,_0x283119,!![]);}catch(_0x29f2c9){return BPromise['reject'](_0x29f2c9);}return _0x4b5387[_0x808f('0x22')]();};}function saveUpdates(_0xe6170,_0x38331b){return function(_0x4dbcfc){if(_0x4dbcfc){return _0x4dbcfc['update'](_0xe6170)['then'](function(_0x564acb){return _0x564acb;});}return null;};}function removeEntity(_0x15d82e,_0x5fa0fd){return function(_0x4b08e1){if(_0x4b08e1){return _0x4b08e1[_0x808f('0x23')]()[_0x808f('0x24')](function(){_0x15d82e[_0x808f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d0e03,_0x571f77){return function(_0x188b2c){if(!_0x188b2c){_0x9d0e03[_0x808f('0x17')](0x194);}return _0x188b2c;};}function handleError(_0x9cd98d,_0x29eb9b){_0x29eb9b=_0x29eb9b||0x1f4;return function(_0x1b8a65){logger[_0x808f('0x25')](_0x1b8a65[_0x808f('0x26')]);if(_0x1b8a65[_0x808f('0x27')]){delete _0x1b8a65[_0x808f('0x27')];}_0x9cd98d[_0x808f('0x18')](_0x29eb9b)[_0x808f('0x28')](_0x1b8a65);};}exports[_0x808f('0x29')]=function(_0x269652,_0x28bf19){var _0x1a0c1e={},_0xc16d2d={},_0x2def88={'count':0x0,'rows':[]};var _0x2753cc=_[_0x808f('0x2a')](db[_0x808f('0x2b')][_0x808f('0x2c')],function(_0x534faf){return{'name':_0x534faf[_0x808f('0x2d')],'type':_0x534faf[_0x808f('0x2e')][_0x808f('0x2f')]};});_0xc16d2d['model']=_[_0x808f('0x2a')](_0x2753cc,_0x808f('0x27'));_0xc16d2d[_0x808f('0x30')]=_[_0x808f('0x31')](_0x269652['query']);_0xc16d2d[_0x808f('0x32')]=_[_0x808f('0x33')](_0xc16d2d[_0x808f('0x34')],_0xc16d2d['query']);_0x1a0c1e[_0x808f('0x35')]=_[_0x808f('0x33')](_0xc16d2d['model'],qs[_0x808f('0x36')](_0x269652[_0x808f('0x30')][_0x808f('0x36')]));_0x1a0c1e[_0x808f('0x35')]=_0x1a0c1e[_0x808f('0x35')][_0x808f('0x37')]?_0x1a0c1e[_0x808f('0x35')]:_0xc16d2d[_0x808f('0x34')];if(!_0x269652[_0x808f('0x30')][_0x808f('0x38')](_0x808f('0x39'))){_0x1a0c1e[_0x808f('0x1c')]=qs[_0x808f('0x1c')](_0x269652['query'][_0x808f('0x1c')]);_0x1a0c1e[_0x808f('0x1e')]=qs['offset'](_0x269652[_0x808f('0x30')][_0x808f('0x1e')]);}_0x1a0c1e[_0x808f('0x3a')]=qs[_0x808f('0x3b')](_0x269652[_0x808f('0x30')][_0x808f('0x3b')]);_0x1a0c1e[_0x808f('0x3c')]=qs['filters'](_[_0x808f('0x3d')](_0x269652[_0x808f('0x30')],_0xc16d2d[_0x808f('0x32')]),_0x2753cc);if(_0x269652[_0x808f('0x30')][_0x808f('0x3e')]){_0x1a0c1e['where']=_[_0x808f('0x3f')](_0x1a0c1e['where'],{'$or':_[_0x808f('0x2a')](_0x2753cc,function(_0x17e98c){if(_0x17e98c[_0x808f('0x2e')]!==_0x808f('0x40')){var _0x39d9b6={};_0x39d9b6[_0x17e98c['name']]={'$like':'%'+_0x269652[_0x808f('0x30')]['filter']+'%'};return _0x39d9b6;}})});}_0x1a0c1e=_[_0x808f('0x3f')]({},_0x1a0c1e,_0x269652[_0x808f('0x41')]);var _0x196615={'where':_0x1a0c1e[_0x808f('0x3c')]};return db['Attachment'][_0x808f('0x1d')](_0x196615)[_0x808f('0x24')](function(_0x46eaf4){_0x2def88['count']=_0x46eaf4;if(_0x269652['query'][_0x808f('0x42')]){_0x1a0c1e[_0x808f('0x43')]=[{'all':!![]}];}return db[_0x808f('0x2b')][_0x808f('0x44')](_0x1a0c1e);})[_0x808f('0x24')](function(_0x190402){_0x2def88[_0x808f('0x45')]=_0x190402;return _0x2def88;})[_0x808f('0x24')](respondWithFilteredResult(_0x28bf19,_0x1a0c1e))[_0x808f('0x46')](handleError(_0x28bf19,null));};exports[_0x808f('0x47')]=function(_0x6e0b4d,_0xd74d62){var _0x2edb7e={'raw':!![],'where':{'id':_0x6e0b4d[_0x808f('0x48')]['id']}},_0x28f5be={};_0x28f5be[_0x808f('0x34')]=_[_0x808f('0x31')](db['Attachment'][_0x808f('0x2c')]);_0x28f5be[_0x808f('0x30')]=_['keys'](_0x6e0b4d[_0x808f('0x30')]);_0x28f5be[_0x808f('0x32')]=_[_0x808f('0x33')](_0x28f5be[_0x808f('0x34')],_0x28f5be[_0x808f('0x30')]);_0x2edb7e[_0x808f('0x35')]=_[_0x808f('0x33')](_0x28f5be[_0x808f('0x34')],qs['fields'](_0x6e0b4d[_0x808f('0x30')]['fields']));_0x2edb7e[_0x808f('0x35')]=_0x2edb7e[_0x808f('0x35')][_0x808f('0x37')]?_0x2edb7e[_0x808f('0x35')]:_0x28f5be[_0x808f('0x34')];if(_0x6e0b4d[_0x808f('0x30')][_0x808f('0x42')]){_0x2edb7e[_0x808f('0x43')]=[{'all':!![]}];}_0x2edb7e=_[_0x808f('0x3f')]({},_0x2edb7e,_0x6e0b4d[_0x808f('0x41')]);return db[_0x808f('0x2b')][_0x808f('0x49')](_0x2edb7e)[_0x808f('0x24')](handleEntityNotFound(_0xd74d62,null))[_0x808f('0x24')](respondWithResult(_0xd74d62,null))[_0x808f('0x46')](handleError(_0xd74d62,null));};exports[_0x808f('0x4a')]=function(_0x2b10e0,_0x32ea79){var _0x493fa0={'where':{'id':_0x2b10e0['params']['id']}},_0x1e9cfe={};_0x1e9cfe[_0x808f('0x34')]=_[_0x808f('0x31')](db[_0x808f('0x2b')][_0x808f('0x2c')]);_0x493fa0[_0x808f('0x35')]=_[_0x808f('0x33')](_0x1e9cfe[_0x808f('0x34')],qs[_0x808f('0x36')](_0x2b10e0[_0x808f('0x30')][_0x808f('0x36')]));_0x493fa0[_0x808f('0x35')]=_0x493fa0[_0x808f('0x35')][_0x808f('0x37')]?_0x493fa0[_0x808f('0x35')]:_0x1e9cfe[_0x808f('0x34')];if(_0x2b10e0['query'][_0x808f('0x42')]){_0x493fa0['include']=[{'all':!![]}];}_0x493fa0=_[_0x808f('0x3f')]({},_0x493fa0,_0x2b10e0[_0x808f('0x41')]);return db['Attachment'][_0x808f('0x49')](_0x493fa0)[_0x808f('0x24')](handleEntityNotFound(_0x32ea79,null))[_0x808f('0x24')](function(_0x1177a2){if(_0x1177a2){var _0x4eb2ee=_0x1177a2[_0x808f('0x4b')]({'plain':!![]});_0x4eb2ee=qs[_0x808f('0x4c')](_0x4eb2ee,['id',_0x808f('0x4d'),_0x808f('0x4e')]);_0x2b10e0[_0x808f('0x4f')]=_[_0x808f('0x4c')](_0x2b10e0[_0x808f('0x4f')],['id',_0x808f('0x4d'),_0x808f('0x4e')]);return db[_0x808f('0x2b')][_0x808f('0x50')](_[_0x808f('0x3f')](_0x4eb2ee,_0x2b10e0[_0x808f('0x4f')]),{'include':_0x2b10e0[_0x808f('0x30')][_0x808f('0x42')]?[{'all':!![]}]:undefined});}})[_0x808f('0x24')](respondWithResult(_0x32ea79,0xc9))[_0x808f('0x46')](handleError(_0x32ea79,null));};exports[_0x808f('0x51')]=function(_0x128dc5,_0xc804fb){if(_0x128dc5[_0x808f('0x4f')]['id']){delete _0x128dc5['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x128dc5[_0x808f('0x48')]['id']}})['then'](handleEntityNotFound(_0xc804fb,null))[_0x808f('0x24')](saveUpdates(_0x128dc5[_0x808f('0x4f')],null))['then'](respondWithResult(_0xc804fb,null))[_0x808f('0x46')](handleError(_0xc804fb,null));};exports[_0x808f('0x23')]=function(_0x2a4b2c,_0x397347){return db[_0x808f('0x2b')]['find']({'where':{'id':_0x2a4b2c[_0x808f('0x48')]['id']}})[_0x808f('0x24')](handleEntityNotFound(_0x397347,null))[_0x808f('0x24')](removeEntity(_0x397347,null))['catch'](handleError(_0x397347,null));};exports[_0x808f('0x50')]=function(_0x126b55,_0x3431d2,_0x77444){_0x126b55[_0x808f('0x4f')][_0x808f('0x27')]=_0x126b55[_0x808f('0x52')][_0x808f('0x53')];_0x126b55[_0x808f('0x4f')][_0x808f('0x54')]=_0x126b55[_0x808f('0x52')][_0x808f('0x55')];_0x126b55[_0x808f('0x4f')][_0x808f('0x2e')]=_0x126b55[_0x808f('0x52')][_0x808f('0x56')];return db['Attachment']['create'](_0x126b55[_0x808f('0x4f')])[_0x808f('0x24')](respondWithResult(_0x3431d2,0xc9))['catch'](handleError(_0x3431d2,null));};exports[_0x808f('0x57')]=function(_0x2daaaa,_0xd98311,_0x5f8761){return db['Attachment'][_0x808f('0x58')]({'where':{'id':_0x2daaaa[_0x808f('0x48')]['id']},'raw':!![]})[_0x808f('0x24')](handleEntityNotFound(_0xd98311,null))['then'](function(_0x3d58ac){if(_0x3d58ac){var _0x88d56b=_0x3d58ac[_0x808f('0x59')]!==null;var _0x24aeb8=path[_0x808f('0x5a')](config[_0x808f('0x5b')],_0x808f('0x5c'));if(_0x88d56b){_0x24aeb8=path[_0x808f('0x5a')](_0x24aeb8,_0x808f('0x5d'));}var _0x553cea=path[_0x808f('0x5a')](_0x24aeb8,_0x3d58ac['basename']);return _0xd98311[_0x808f('0x57')](_0x553cea);}})['catch'](handleError(_0xd98311,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0070bac..7ddb6f6 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 _0x3db8=['attachments','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','Attachment'];(function(_0x2e9780,_0x51e78b){var _0x4ed3cd=function(_0x49a0c9){while(--_0x49a0c9){_0x2e9780['push'](_0x2e9780['shift']());}};_0x4ed3cd(++_0x51e78b);}(_0x3db8,0x12d));var _0x83db=function(_0x3555f7,_0x3a43c3){_0x3555f7=_0x3555f7-0x0;var _0x3dfb3d=_0x3db8[_0x3555f7];return _0x3dfb3d;};'use strict';var _=require(_0x83db('0x0'));var util=require('util');var logger=require(_0x83db('0x1'))(_0x83db('0x2'));var moment=require(_0x83db('0x3'));var BPromise=require(_0x83db('0x4'));var rp=require(_0x83db('0x5'));var fs=require('fs');var path=require(_0x83db('0x6'));var rimraf=require(_0x83db('0x7'));var config=require(_0x83db('0x8'));var attributes=require(_0x83db('0x9'));module['exports']=function(_0x5de6d3,_0x3d7052){return _0x5de6d3['define'](_0x83db('0xa'),attributes,{'tableName':_0x83db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b4=['attachments','api','moment','request-promise','rimraf','./attachment.attributes','exports','define','Attachment'];(function(_0x1f0c5b,_0x2994f4){var _0x2a10c8=function(_0xef76ce){while(--_0xef76ce){_0x1f0c5b['push'](_0x1f0c5b['shift']());}};_0x2a10c8(++_0x2994f4);}(_0x80b4,0x172));var _0x480b=function(_0x8df02,_0x108944){_0x8df02=_0x8df02-0x0;var _0x26b9c8=_0x80b4[_0x8df02];return _0x26b9c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x480b('0x0'));var moment=require(_0x480b('0x1'));var BPromise=require('bluebird');var rp=require(_0x480b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x480b('0x3'));var config=require('../../config/environment');var attributes=require(_0x480b('0x4'));module[_0x480b('0x5')]=function(_0x48049b,_0x5d8a98){return _0x48049b[_0x480b('0x6')](_0x480b('0x7'),attributes,{'tableName':_0x480b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 20159fe..94efe62 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 _0x885e=['body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','CreateAttachment','Attachment','create'];(function(_0x3c7762,_0x45911c){var _0x5bd127=function(_0x576073){while(--_0x576073){_0x3c7762['push'](_0x3c7762['shift']());}};_0x5bd127(++_0x45911c);}(_0x885e,0xe4));var _0xe885=function(_0x4f5610,_0x1c5eb4){_0x4f5610=_0x4f5610-0x0;var _0x292b45=_0x885e[_0x4f5610];return _0x292b45;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var moment=require('moment');var BPromise=require(_0xe885('0x2'));var rs=require(_0xe885('0x3'));var fs=require('fs');var Redis=require(_0xe885('0x4'));var db=require(_0xe885('0x5'))['db'];var utils=require(_0xe885('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe885('0x7'));var jayson=require(_0xe885('0x8'));var client=jayson[_0xe885('0x9')][_0xe885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55d2b2,_0x37778a,_0x597bdc){return new BPromise(function(_0x2e8fe0,_0x3c5cc7){return client[_0xe885('0xb')](_0x55d2b2,_0x597bdc)[_0xe885('0xc')](function(_0x231f2f){logger[_0xe885('0xd')]('Attachment,\x20%s,\x20%s',_0x37778a,_0xe885('0xe'));logger[_0xe885('0xf')](_0xe885('0x10'),_0x37778a,_0xe885('0xe'),JSON[_0xe885('0x11')](_0x231f2f));if(_0x231f2f[_0xe885('0x12')]){if(_0x231f2f[_0xe885('0x12')]['code']===0x1f4){logger[_0xe885('0x12')](_0xe885('0x13'),_0x37778a,_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);return _0x3c5cc7(_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);}logger[_0xe885('0x12')]('Attachment,\x20%s,\x20%s',_0x37778a,_0x231f2f['error']['message']);return _0x2e8fe0(_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);}else{logger[_0xe885('0xd')](_0xe885('0x13'),_0x37778a,'request\x20sent');_0x2e8fe0(_0x231f2f['result'][_0xe885('0x14')]);}})['catch'](function(_0x36b9e7){logger[_0xe885('0x12')](_0xe885('0x13'),_0x37778a,_0x36b9e7);_0x3c5cc7(_0x36b9e7);});});}exports[_0xe885('0x15')]=function(_0x25a002){var _0x365eab=this;return new Promise(function(_0x4f5045,_0x39f07c){return db[_0xe885('0x16')][_0xe885('0x17')](_0x25a002[_0xe885('0x18')],{'raw':_0x25a002[_0xe885('0x19')]?_0x25a002[_0xe885('0x19')][_0xe885('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x159624){logger[_0xe885('0xd')](_0xe885('0x15'),_0x25a002);logger[_0xe885('0xf')](_0xe885('0x15'),_0x25a002,JSON[_0xe885('0x11')](_0x159624));_0x4f5045(_0x159624);})[_0xe885('0x1b')](function(_0x4375ff){logger[_0xe885('0x12')](_0xe885('0x15'),_0x4375ff[_0xe885('0x14')],_0x25a002);_0x39f07c(_0x365eab[_0xe885('0x12')](0x1f4,_0x4375ff['message']));});});}; \ No newline at end of file +var _0x180f=['error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4eda4a,_0x47d7b0){var _0x2b3249=function(_0x1eca99){while(--_0x1eca99){_0x4eda4a['push'](_0x4eda4a['shift']());}};_0x2b3249(++_0x47d7b0);}(_0x180f,0xf3));var _0xf180=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x180f[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var moment=require('moment');var BPromise=require(_0xf180('0x2'));var rs=require(_0xf180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf180('0x4'))['db'];var utils=require(_0xf180('0x5'));var logger=require(_0xf180('0x6'))(_0xf180('0x7'));var config=require(_0xf180('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf180('0x9')][_0xf180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513113,_0x47d87b,_0x1d6ca7){return new BPromise(function(_0x303412,_0x342a02){return client[_0xf180('0xb')](_0x513113,_0x1d6ca7)[_0xf180('0xc')](function(_0x4390be){logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,_0xf180('0xf'));logger['debug'](_0xf180('0x10'),_0x47d87b,_0xf180('0xf'),JSON[_0xf180('0x11')](_0x4390be));if(_0x4390be[_0xf180('0x12')]){if(_0x4390be[_0xf180('0x12')][_0xf180('0x13')]===0x1f4){logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x342a02(_0x4390be[_0xf180('0x12')]['message']);}logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x303412(_0x4390be['error'][_0xf180('0x14')]);}else{logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,'request\x20sent');_0x303412(_0x4390be[_0xf180('0x15')][_0xf180('0x14')]);}})['catch'](function(_0x115b86){logger[_0xf180('0x12')]('Attachment,\x20%s,\x20%s',_0x47d87b,_0x115b86);_0x342a02(_0x115b86);});});}exports[_0xf180('0x16')]=function(_0x14ddc6){var _0x335c78=this;return new Promise(function(_0xf7ab26,_0x3eb0db){return db[_0xf180('0x17')][_0xf180('0x18')](_0x14ddc6[_0xf180('0x19')],{'raw':_0x14ddc6[_0xf180('0x1a')]?_0x14ddc6[_0xf180('0x1a')][_0xf180('0x1b')]===undefined?!![]:![]:!![]})[_0xf180('0xc')](function(_0x180c0a){logger['info'](_0xf180('0x16'),_0x14ddc6);logger[_0xf180('0x1c')]('CreateAttachment',_0x14ddc6,JSON[_0xf180('0x11')](_0x180c0a));_0xf7ab26(_0x180c0a);})['catch'](function(_0x36aeee){logger['error'](_0xf180('0x16'),_0x36aeee[_0xf180('0x14')],_0x14ddc6);_0x3eb0db(_0x335c78['error'](0x1f4,_0x36aeee['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index bc012b6..1e3479b 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x402a29,_0x561ab8){var _0x497a3a=function(_0x560760){while(--_0x560760){_0x402a29['push'](_0x402a29['shift']());}};_0x497a3a(++_0x561ab8);}(_0xadb5,0xad));var _0x5adb=function(_0x2619ee,_0x45c634){_0x2619ee=_0x2619ee-0x0;var _0x44f396=_0xadb5[_0x2619ee];return _0x44f396;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b0e,0x187));var _0xe0b0=function(_0x19dcc8,_0x4bae0e){_0x19dcc8=_0x19dcc8-0x0;var _0x2810f4=_0x0b0e[_0x19dcc8];return _0x2810f4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ab335fd..9787321 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc15=['../../config/utils','../../config/environment','api','undefined','baseDN','activedirectory','url','domain','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blockedAt','online','admin','agent','name','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','password','passport','passport-local','Strategy','activedirectory2','bluebird','../../mysqldb'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdc15,0xe0));var _0x5dc1=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0xdc15[_0x1e9e56];return _0x5d5e2e;};'use strict';var passport=require(_0x5dc1('0x0'));var LocalStrategy=require(_0x5dc1('0x1'))[_0x5dc1('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x5dc1('0x3'));var BPromise=require(_0x5dc1('0x4'));var util=require('util');var db=require(_0x5dc1('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5dc1('0x6'));var config=require(_0x5dc1('0x7'));var logger=require('../../config/logger')(_0x5dc1('0x8'));function isActiveDirectoryConfigured(_0x128b7b){var _0x4c6782=![];if(typeof _0x128b7b['activedirectory']!==_0x5dc1('0x9')){_0x4c6782=_0x128b7b['activedirectory'][_0x5dc1('0xa')]&&_0x128b7b[_0x5dc1('0xb')][_0x5dc1('0xc')]&&_0x128b7b[_0x5dc1('0xb')][_0x5dc1('0xd')];}return _0x4c6782;}function adAuthenticate(_0x55c7fd,_0x5afd04,_0x4d94da){return new BPromise(function(_0x3d0ce0,_0x386f38){try{var _0x517f98=new ActiveDirectory(_0x55c7fd);_0x517f98['authenticate'](_0x5afd04,_0x4d94da,function(_0x359e03,_0x401773){if(_0x359e03){logger[_0x5dc1('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x5afd04,util['inspect'](_0x359e03,{'showHidden':![],'depth':null}));_0x386f38(_0x5dc1('0xf'));}else if(!_0x401773){logger[_0x5dc1('0xe')](_0x5dc1('0x10'),_0x5afd04);_0x386f38(_0x5dc1('0xf'));}else{_0x3d0ce0(_0x401773);}});}catch(_0x2ea434){_0x386f38(_0x2ea434);}});}function ActiveDirectoryAuthenticate(_0x2e1e3b,_0xeba0e7,_0x5df36c,_0xa779dd){var _0x46b8af,_0x2a6bb3;if(!isActiveDirectoryConfigured(config)){logger[_0x5dc1('0xe')](_0x5dc1('0x11'),_0xeba0e7);return _0xa779dd(null,![],{'message':_0x5dc1('0xf')});}return db[_0x5dc1('0x12')][_0x5dc1('0x13')]({'where':{'id':0x1},'attributes':[_0x5dc1('0x14'),_0x5dc1('0x15')],'raw':!![]})[_0x5dc1('0x16')](function(_0x412ac9){_0x46b8af=_0x412ac9;if(!_0x46b8af['adSsoEnabled']){logger[_0x5dc1('0xe')](_0x5dc1('0x17'),_0xeba0e7);throw new Error(_0x5dc1('0xf'));}return _0x2e1e3b['findOne']({'attributes':['id','name','password',_0x5dc1('0x18'),_0x5dc1('0x19'),_0x5dc1('0x1a'),'blocked',_0x5dc1('0x1b'),_0x5dc1('0x1c')],'where':{'name':_0xeba0e7,'role':{'$or':[_0x5dc1('0x1d'),'user',_0x5dc1('0x1e')]},'adSsoEnabled':!![]}});})[_0x5dc1('0x16')](function(_0x2d4ba5){if(!_0x2d4ba5||_0x2d4ba5&&_0x2d4ba5[_0x5dc1('0x1f')]!==_0xeba0e7){throw new Error(_0x5dc1('0xf'));}_0x2a6bb3=_0x2d4ba5;var _0x542e28=_0x2a6bb3[_0x5dc1('0x1f')]+'@'+config[_0x5dc1('0xb')][_0x5dc1('0xd')];return adAuthenticate(config[_0x5dc1('0xb')],_0x542e28,_0x5df36c);})['then'](function(_0x3fccf4){if(_0x2a6bb3['disabled']){throw new Error(_0x5dc1('0xf'));}if(_0x46b8af[_0x5dc1('0x15')]>0x0){if(_0x2a6bb3['blocked']){if(moment(_0x2a6bb3[_0x5dc1('0x1b')])['add'](_0x46b8af['blockDuration'],'minutes')>moment()){throw new Error(_0x5dc1('0xf'));}return utils[_0x5dc1('0x20')](_0x2a6bb3,0x0,![],null)[_0x5dc1('0x16')](function(){return utils[_0x5dc1('0x21')](_0x2a6bb3);})['then'](function(){return _0xa779dd(null,_0x2a6bb3);});}else{return utils[_0x5dc1('0x21')](_0x2a6bb3)[_0x5dc1('0x16')](function(){return _0xa779dd(null,_0x2a6bb3);});}}else{return utils[_0x5dc1('0x21')](_0x2a6bb3)['then'](function(){return _0xa779dd(null,_0x2a6bb3);});}})[_0x5dc1('0x22')](function(_0x3772c9){return _0xa779dd(null,![],_0x3772c9);});}function handleError(_0x115e5f,_0x38ebd6,_0x447388){return _0x115e5f[_0x5dc1('0x23')](_0x38ebd6||0x1f4)[_0x5dc1('0x24')]({'message':_0x447388?_0x447388[_0x5dc1('0x25')]||_0x447388:''});}exports[_0x5dc1('0x26')]=function(_0x56fb91,_0x5bcfe1,_0x332f8c){passport[_0x5dc1('0x27')]('ad-login',function(_0x151ac4,_0x1cdec7,_0x4532f2){var _0x545190=_0x151ac4||_0x4532f2;if(_0x545190){return handleError(_0x5bcfe1,0x191,_0x545190);}if(!_0x1cdec7){return handleError(_0x5bcfe1,0x194,{'message':_0x5dc1('0x28')});}else{var _0x3e6a01={'payload':{'id':_0x1cdec7['id'],'role':_0x1cdec7[_0x5dc1('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0x5dc1('0x29')](_0x3e6a01)[_0x5dc1('0x16')](function(_0x97089c){_0x5bcfe1[_0x5dc1('0x2a')]({'id':_0x1cdec7['id'],'token':_0x97089c,'statusCall':'','isAlreadyLogged':_0x1cdec7[_0x5dc1('0x1c')]});});}})(_0x56fb91,_0x5bcfe1,_0x332f8c);};passport[_0x5dc1('0x2b')](_0x5dc1('0x2c'),new LocalStrategy({'usernameField':_0x5dc1('0x1f'),'passwordField':_0x5dc1('0x2d')},function(_0x4060c9,_0xe8f58,_0x4e2d4c){return ActiveDirectoryAuthenticate(db['User'],_0x4060c9,_0xe8f58,_0x4e2d4c);})); \ No newline at end of file +var _0xa151=['findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','role','disabled','blockedAt','admin','user','agent','name','domain','then','blocked','add','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','signToken','json','online','use','password','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','undefined','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa151,0x13d));var _0x1a15=function(_0x35940f,_0x5c1827){_0x35940f=_0x35940f-0x0;var _0xd1d3fd=_0xa151[_0x35940f];return _0xd1d3fd;};'use strict';var passport=require(_0x1a15('0x0'));var LocalStrategy=require(_0x1a15('0x1'))['Strategy'];var moment=require(_0x1a15('0x2'));var ActiveDirectory=require(_0x1a15('0x3'));var BPromise=require(_0x1a15('0x4'));var util=require('util');var db=require(_0x1a15('0x5'))['db'];var authService=require(_0x1a15('0x6'));var utils=require(_0x1a15('0x7'));var config=require('../../config/environment');var logger=require(_0x1a15('0x8'))('api');function isActiveDirectoryConfigured(_0x2ae542){var _0x29b7c5=![];if(typeof _0x2ae542[_0x1a15('0x9')]!==_0x1a15('0xa')){_0x29b7c5=_0x2ae542[_0x1a15('0x9')]['baseDN']&&_0x2ae542[_0x1a15('0x9')][_0x1a15('0xb')]&&_0x2ae542[_0x1a15('0x9')]['domain'];}return _0x29b7c5;}function adAuthenticate(_0x150f2c,_0x1f3ccc,_0x5c2978){return new BPromise(function(_0x383e53,_0x25ca9b){try{var _0x560c2a=new ActiveDirectory(_0x150f2c);_0x560c2a[_0x1a15('0xc')](_0x1f3ccc,_0x5c2978,function(_0xb2bfe9,_0x94be83){if(_0xb2bfe9){logger[_0x1a15('0xd')]('Error\x20authenticate\x20%s:\x20%s',_0x1f3ccc,util[_0x1a15('0xe')](_0xb2bfe9,{'showHidden':![],'depth':null}));_0x25ca9b(_0x1a15('0xf'));}else if(!_0x94be83){logger[_0x1a15('0xd')](_0x1a15('0x10'),_0x1f3ccc);_0x25ca9b(_0x1a15('0xf'));}else{_0x383e53(_0x94be83);}});}catch(_0x4a7cea){_0x25ca9b(_0x4a7cea);}});}function ActiveDirectoryAuthenticate(_0x437e9e,_0x10f022,_0x243932,_0x14fee1){var _0x3a3c0a,_0x4272d9;if(!isActiveDirectoryConfigured(config)){logger[_0x1a15('0xd')](_0x1a15('0x11'),_0x10f022);return _0x14fee1(null,![],{'message':_0x1a15('0xf')});}return db[_0x1a15('0x12')][_0x1a15('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x1a15('0x14')],'raw':!![]})['then'](function(_0x3d68f9){_0x3a3c0a=_0x3d68f9;if(!_0x3a3c0a[_0x1a15('0x15')]){logger[_0x1a15('0xd')](_0x1a15('0x16'),_0x10f022);throw new Error(_0x1a15('0xf'));}return _0x437e9e[_0x1a15('0x13')]({'attributes':['id','name','password','salt',_0x1a15('0x17'),_0x1a15('0x18'),'blocked',_0x1a15('0x19'),'online'],'where':{'name':_0x10f022,'role':{'$or':[_0x1a15('0x1a'),_0x1a15('0x1b'),_0x1a15('0x1c')]},'adSsoEnabled':!![]}});})['then'](function(_0x585184){if(!_0x585184||_0x585184&&_0x585184[_0x1a15('0x1d')]!==_0x10f022){throw new Error(_0x1a15('0xf'));}_0x4272d9=_0x585184;var _0x66a894=_0x4272d9[_0x1a15('0x1d')]+'@'+config[_0x1a15('0x9')][_0x1a15('0x1e')];return adAuthenticate(config[_0x1a15('0x9')],_0x66a894,_0x243932);})[_0x1a15('0x1f')](function(_0x3781c5){if(_0x4272d9[_0x1a15('0x18')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3a3c0a[_0x1a15('0x14')]>0x0){if(_0x4272d9[_0x1a15('0x20')]){if(moment(_0x4272d9['blockedAt'])[_0x1a15('0x21')](_0x3a3c0a[_0x1a15('0x14')],'minutes')>moment()){throw new Error(_0x1a15('0xf'));}return utils[_0x1a15('0x22')](_0x4272d9,0x0,![],null)['then'](function(){return utils[_0x1a15('0x23')](_0x4272d9);})[_0x1a15('0x1f')](function(){return _0x14fee1(null,_0x4272d9);});}else{return utils[_0x1a15('0x23')](_0x4272d9)[_0x1a15('0x1f')](function(){return _0x14fee1(null,_0x4272d9);});}}else{return utils['getLicense'](_0x4272d9)[_0x1a15('0x1f')](function(){return _0x14fee1(null,_0x4272d9);});}})[_0x1a15('0x24')](function(_0x5d2244){return _0x14fee1(null,![],_0x5d2244);});}function handleError(_0x51583b,_0x4b8d63,_0x443648){return _0x51583b[_0x1a15('0x25')](_0x4b8d63||0x1f4)[_0x1a15('0x26')]({'message':_0x443648?_0x443648[_0x1a15('0x27')]||_0x443648:''});}exports[_0x1a15('0x28')]=function(_0x4a8d3e,_0x5b8529,_0x22945f){passport['authenticate'](_0x1a15('0x29'),function(_0x3ab9c6,_0x487ad3,_0x2d9e95){var _0x3b0fed=_0x3ab9c6||_0x2d9e95;if(_0x3b0fed){return handleError(_0x5b8529,0x191,_0x3b0fed);}if(!_0x487ad3){return handleError(_0x5b8529,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x341dbf={'payload':{'id':_0x487ad3['id'],'role':_0x487ad3[_0x1a15('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0x1a15('0x2a')](_0x341dbf)[_0x1a15('0x1f')](function(_0x2c4766){_0x5b8529[_0x1a15('0x2b')]({'id':_0x487ad3['id'],'token':_0x2c4766,'statusCall':'','isAlreadyLogged':_0x487ad3[_0x1a15('0x2c')]});});}})(_0x4a8d3e,_0x5b8529,_0x22945f);};passport[_0x1a15('0x2d')](_0x1a15('0x29'),new LocalStrategy({'usernameField':_0x1a15('0x1d'),'passwordField':_0x1a15('0x2e')},function(_0x228da0,_0x16a2ee,_0x31c11d){return ActiveDirectoryAuthenticate(db[_0x1a15('0x2f')],_0x228da0,_0x16a2ee,_0x31c11d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e77f24d..f211cf1 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f3c=['exports','./authActiveDirectory.controller','post'];(function(_0x433bd9,_0x2cdb95){var _0x37d089=function(_0x465a59){while(--_0x465a59){_0x433bd9['push'](_0x433bd9['shift']());}};_0x37d089(++_0x2cdb95);}(_0x6f3c,0x1e4));var _0xc6f3=function(_0x49e2bc,_0x2fc2c0){_0x49e2bc=_0x49e2bc-0x0;var _0x598cf0=_0x6f3c[_0x49e2bc];return _0x598cf0;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xc6f3('0x0'));router[_0xc6f3('0x1')]('/',controller['login']);module[_0xc6f3('0x2')]=router; \ No newline at end of file +var _0xdf98=['express','Router','post','login','exports'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0xdf98,0x104));var _0x8df9=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0xdf98[_0x4df85c];return _0x4e2a61;};'use strict';var express=require(_0x8df9('0x0'));var router=express[_0x8df9('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x8df9('0x2')]('/',controller[_0x8df9('0x3')]);module[_0x8df9('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 78bc9d8..2202e64 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7a54,0x106));var _0x47a5=function(_0x6cc949,_0x3113fc){_0x6cc949=_0x6cc949-0x0;var _0x3fca8c=_0x7a54[_0x6cc949];return _0x3fca8c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x7a54,0x106));var _0x47a5=function(_0x58e131,_0x3917c6){_0x58e131=_0x58e131-0x0;var _0x399c5e=_0x7a54[_0x58e131];return _0x399c5e;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7c54df4..7a64e7b 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 _0x832e=['get','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','../user/user.controller.js','../../components/auth/service','login'];(function(_0x43d9b0,_0x47d444){var _0x2f4302=function(_0x231a8a){while(--_0x231a8a){_0x43d9b0['push'](_0x43d9b0['shift']());}};_0x2f4302(++_0x47d444);}(_0x832e,0x118));var _0xe832=function(_0x4421f8,_0x551905){_0x4421f8=_0x4421f8-0x0;var _0xa14c73=_0x832e[_0x4421f8];return _0xa14c73;};'use strict';var express=require(_0xe832('0x0'));var passport=require(_0xe832('0x1'));var router=express[_0xe832('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xe832('0x3'));var authService=require(_0xe832('0x4'));router['get']('/',controller[_0xe832('0x5')]);router[_0xe832('0x6')](_0xe832('0x7'),controller[_0xe832('0x8')],authService[_0xe832('0x9')],userController[_0xe832('0x5')],authService[_0xe832('0xa')]);module['exports']=router; \ No newline at end of file +var _0x713d=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x713d,0x16f));var _0xd713=function(_0x3ad92d,_0x5d3ac3){_0x3ad92d=_0x3ad92d-0x0;var _0xa856d3=_0x713d[_0x3ad92d];return _0xa856d3;};'use strict';var express=require('express');var passport=require(_0xd713('0x0'));var router=express[_0xd713('0x1')]();var controller=require(_0xd713('0x2'));var userController=require(_0xd713('0x3'));var authService=require(_0xd713('0x4'));router[_0xd713('0x5')]('/',controller[_0xd713('0x6')]);router[_0xd713('0x5')](_0xd713('0x7'),controller[_0xd713('0x8')],authService[_0xd713('0x9')],userController['login'],authService[_0xd713('0xa')]);module[_0xd713('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e9da874..b5b6125 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 _0x60e6=['blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','SendMail','error','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x60e6,0x1c6));var _0x660e=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0x60e6[_0x497b1e];return _0x3f72e1;};'use strict';var util=require(_0x660e('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x660e('0x1')];var jayson=require(_0x660e('0x2'));var _=require(_0x660e('0x3'));var rs=require(_0x660e('0x4'));var moment=require(_0x660e('0x5'));var db=require(_0x660e('0x6'))['db'];var authService=require(_0x660e('0x7'));var utils=require(_0x660e('0x8'));var client=jayson[_0x660e('0x9')][_0x660e('0xa')]({'port':0x232b});function localAuthenticate(_0x24c3dc,_0x950409,_0x5475b6,_0x3e5801){var _0x51d122,_0x491778;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x660e('0xb'),_0x660e('0xc')],'raw':!![]})[_0x660e('0xd')](function(_0x445118){_0x51d122=_0x445118;return _0x24c3dc[_0x660e('0xe')]({'attributes':['id',_0x660e('0xf'),_0x660e('0x10'),_0x660e('0x11'),_0x660e('0x12'),_0x660e('0x13'),_0x660e('0x14'),_0x660e('0x15'),_0x660e('0x16')],'where':{'name':_0x950409,'role':{'$or':[_0x660e('0x17'),_0x660e('0x18'),_0x660e('0x19')]}}});})[_0x660e('0xd')](function(_0x2aa1d0){if(!_0x2aa1d0||_0x2aa1d0&&_0x2aa1d0['name']!==_0x950409){throw new Error(_0x660e('0x1a'));}else{_0x491778=_0x2aa1d0;return _0x491778;}})['then'](function(){_0x491778['authenticate'](_0x5475b6,function(_0x16ee9b,_0x17c001){var _0x558882=_0x491778[_0x660e('0x16')]+0x1;if(_0x16ee9b){return _0x3e5801(_0x16ee9b);}else if(!_0x17c001){if(_0x491778['disabled']){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}else if(_0x51d122[_0x660e('0xb')]>0x0){if(_0x491778[_0x660e('0x14')]){if(_0x51d122['blockDuration']>0x0){if(moment(_0x491778['blockedAt'])[_0x660e('0x1b')](_0x51d122['blockDuration'],_0x660e('0x1c'))>moment()){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}else{return utils[_0x660e('0x1d')](_0x491778,_0x558882,![],null)[_0x660e('0xd')](function(){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});});}}else{return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}}else{if(_0x558882>=_0x51d122[_0x660e('0xb')]){return utils[_0x660e('0x1d')](_0x491778,0x0,!![],moment())[_0x660e('0xd')](function(){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});});}else{return utils['clearBlockUser'](_0x491778,_0x558882,![],null)[_0x660e('0xd')](function(){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});});}}}else{return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}}else{if(_0x491778[_0x660e('0x13')]){return _0x3e5801(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x51d122[_0x660e('0xb')]>0x0){if(_0x491778[_0x660e('0x14')]){if(_0x51d122[_0x660e('0xc')]>0x0){if(moment(_0x491778[_0x660e('0x15')])['add'](_0x51d122['blockDuration'],_0x660e('0x1c'))>moment()){return _0x3e5801(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x660e('0x1d')](_0x491778,0x0,![],null)['then'](function(){return utils[_0x660e('0x1e')](_0x491778);})[_0x660e('0xd')](function(){return _0x3e5801(null,_0x491778);});}}else{return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}}else{return utils[_0x660e('0x1d')](_0x491778,0x0,![],null)[_0x660e('0xd')](function(){return utils['getLicense'](_0x491778);})['then'](function(){return _0x3e5801(null,_0x491778);})[_0x660e('0x1f')](function(_0x1b253a){return _0x3e5801(null,![],_0x1b253a);});}}else{if(_0x491778[_0x660e('0x14')]){return _0x3e5801(null,![],{'message':_0x660e('0x1a')});}else{return utils[_0x660e('0x1e')](_0x491778)[_0x660e('0xd')](function(){return _0x3e5801(null,_0x491778);});}}}});})[_0x660e('0x1f')](function(_0xa197f0){return _0x3e5801(null,![],_0xa197f0);});}function sendServiceMail(_0x4b9a4e){return db['MailAccount'][_0x660e('0x20')]({'where':{'service':!![]},'attributes':['id',_0x660e('0xf'),_0x660e('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x660e('0x22'),'include':[{'model':db[_0x660e('0x23')],'as':_0x660e('0x23')}]}]})[_0x660e('0xd')](function(_0x14baf2){if(!_0x14baf2){throw new Error(_0x660e('0x24'));}var _0x254ca6=_0x14baf2[_0x660e('0x25')]();var _0xc3d7ae={'account':_0x254ca6,'message':_['merge']({'from':util[_0x660e('0x26')]('\x22%s\x22\x20<%s>',_0x14baf2[_0x660e('0xf')],_0x14baf2['email']||_0x14baf2[_0x660e('0x22')][_0x660e('0x18')])},_0x4b9a4e)};return client['request'](_0x660e('0x27'),_0xc3d7ae);})['then'](function(_0x4ea5fc){if(_0x4ea5fc[_0x660e('0x28')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4ea5fc[_0x660e('0x28')][_0x660e('0x29')]||JSON[_0x660e('0x2a')](_0x4ea5fc[_0x660e('0x28')])));}return!![];});}function handleError(_0x3288e7,_0x14777f,_0xe1d738){return _0x3288e7[_0x660e('0x2b')](_0x14777f||0x1f4)[_0x660e('0x2c')]({'message':_0xe1d738?_0xe1d738['message']||_0xe1d738:''});}exports[_0x660e('0x2d')]=function(_0x119a8a,_0x54fd95,_0x384e55){passport[_0x660e('0x2e')](_0x660e('0x2f'),function(_0x30dbd0,_0x1012df,_0x263aa7){var _0x43dd0b=_0x30dbd0||_0x263aa7;if(_0x43dd0b){return handleError(_0x54fd95,0x191,_0x43dd0b);}if(!_0x1012df){return handleError(_0x54fd95,0x194,{'message':_0x660e('0x30')});}else{var _0x586c2a={'payload':{'id':_0x1012df['id'],'role':_0x1012df[_0x660e('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x586c2a)[_0x660e('0xd')](function(_0x2a829e){_0x54fd95['json']({'id':_0x1012df['id'],'token':_0x2a829e,'statusCall':'','isAlreadyLogged':_0x1012df['online']});});}})(_0x119a8a,_0x54fd95,_0x384e55);};exports[_0x660e('0x31')]=function(_0x52d781,_0x4c7fdc){if(!_0x52d781[_0x660e('0x32')]['email']){return handleError(_0x4c7fdc,0x1f4,{'message':_0x660e('0x33')});}var _0x3f0559=rs[_0x660e('0x34')]();_0x52d781[_0x660e('0x32')][_0x660e('0x21')]=_0x52d781['body']['email']['trim']()[_0x660e('0x35')]();var _0x414712;return db[_0x660e('0x36')][_0x660e('0xe')]({'where':{'id':0x1},'attributes':[_0x660e('0xb'),_0x660e('0xc')],'raw':!![]})[_0x660e('0xd')](function(_0x1f146c){_0x414712=_0x1f146c;return db[_0x660e('0x37')]['find']({'where':{'email':_0x52d781[_0x660e('0x32')][_0x660e('0x21')]}});})[_0x660e('0xd')](function(_0x4cce3e){if(!_0x4cce3e){throw new Error(_0x660e('0x38'));}if(_0x4cce3e['disabled']){throw new Error(_0x660e('0x39'));}if(_0x4cce3e[_0x660e('0x14')]){if(moment(_0x4cce3e[_0x660e('0x15')])[_0x660e('0x1b')](_0x414712['blockDuration'],'minutes')>moment()){throw new Error(_0x660e('0x3a'));}else{_0x4cce3e[_0x660e('0x14')]=![];_0x4cce3e[_0x660e('0x15')]=null;}}_0x4cce3e[_0x660e('0x3b')]=_0x3f0559;_0x4cce3e[_0x660e('0x3c')]=Date['now']()+0x36ee80;return _0x4cce3e[_0x660e('0x3d')]();})['then'](function(){return sendServiceMail({'to':_0x52d781[_0x660e('0x32')][_0x660e('0x21')],'subject':_0x660e('0x3e'),'text':_0x660e('0x3f')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x660e('0x40')+_0x52d781[_0x660e('0x41')]['host']+_0x660e('0x42')+_0x3f0559+'\x0a\x0a'+_0x660e('0x43')});})[_0x660e('0xd')](function(){_0x4c7fdc[_0x660e('0x2b')](0xc8)[_0x660e('0x2c')]({'message':_0x660e('0x44')});})[_0x660e('0x1f')](function(_0x455da5){return handleError(_0x4c7fdc,0x1f4,_0x455da5);});};exports[_0x660e('0x45')]=function(_0x3bf0b8,_0x2c10e2){return db[_0x660e('0x37')][_0x660e('0x20')]({'where':{'resetPasswordToken':_0x3bf0b8['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x660e('0x46')]()}}})['then'](function(_0x42c62a){if(!_0x42c62a){throw new Error(_0x660e('0x47'));}return db[_0x660e('0x36')][_0x660e('0xe')]({'attributes':['id',_0x660e('0x48'),_0x660e('0x49'),_0x660e('0x4a')]})['then'](function(_0x466ef2){if(_0x466ef2[_0x660e('0x48')])authService[_0x660e('0x4b')](_0x3bf0b8[_0x660e('0x32')][_0x660e('0x10')]);if(!_0x466ef2[_0x660e('0x49')]||!_0x42c62a[_0x660e('0x4c')])return _0x42c62a;authService[_0x660e('0x4d')](_0x3bf0b8[_0x660e('0x32')][_0x660e('0x10')],_0x42c62a[_0x660e('0x4c')],_0x466ef2[_0x660e('0x4a')]);return _0x42c62a;})[_0x660e('0xd')](function(){_0x42c62a[_0x660e('0x10')]=_0x3bf0b8['body'][_0x660e('0x10')];_0x42c62a[_0x660e('0x3b')]=null;_0x42c62a[_0x660e('0x3c')]=null;return _0x42c62a['save']();});})[_0x660e('0xd')](function(){_0x2c10e2['status'](0xc8)[_0x660e('0x2c')]({'message':_0x660e('0x4e')});})[_0x660e('0x1f')](function(_0x27744a){return handleError(_0x2c10e2,0x1f4,_0x27744a);});};passport['use'](_0x660e('0x2f'),new LocalStrategy({'usernameField':_0x660e('0xf'),'passwordField':_0x660e('0x10')},function(_0xcf1a59,_0x336405,_0x2dd65d){return localAuthenticate(db[_0x660e('0x37')],_0xcf1a59,_0x336405,_0x2dd65d);})); \ No newline at end of file +var _0xda48=['xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','use','util','passport-local','Strategy','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','salt','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','add','minutes','clearBlockUser','getLicense','catch','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save'];(function(_0x38b430,_0x58f4e0){var _0x19047b=function(_0x341419){while(--_0x341419){_0x38b430['push'](_0x38b430['shift']());}};_0x19047b(++_0x58f4e0);}(_0xda48,0xc2));var _0x8da4=function(_0xe91d3f,_0x5e715f){_0xe91d3f=_0xe91d3f-0x0;var _0x40b934=_0xda48[_0xe91d3f];return _0x40b934;};'use strict';var util=require(_0x8da4('0x0'));var passport=require('passport');var LocalStrategy=require(_0x8da4('0x1'))[_0x8da4('0x2')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require(_0x8da4('0x3'));var db=require(_0x8da4('0x4'))['db'];var authService=require(_0x8da4('0x5'));var utils=require(_0x8da4('0x6'));var client=jayson[_0x8da4('0x7')][_0x8da4('0x8')]({'port':0x232b});function localAuthenticate(_0x49f7ee,_0x29937d,_0x23c596,_0x444c96){var _0x1e9e57,_0x4bc5b1;return db[_0x8da4('0x9')][_0x8da4('0xa')]({'where':{'id':0x1},'attributes':[_0x8da4('0xb'),'blockDuration'],'raw':!![]})[_0x8da4('0xc')](function(_0x5b635a){_0x1e9e57=_0x5b635a;return _0x49f7ee[_0x8da4('0xa')]({'attributes':['id','name',_0x8da4('0xd'),_0x8da4('0xe'),'role','disabled',_0x8da4('0xf'),_0x8da4('0x10'),_0x8da4('0x11')],'where':{'name':_0x29937d,'role':{'$or':[_0x8da4('0x12'),_0x8da4('0x13'),'agent']}}});})[_0x8da4('0xc')](function(_0x48d857){if(!_0x48d857||_0x48d857&&_0x48d857[_0x8da4('0x14')]!==_0x29937d){throw new Error(_0x8da4('0x15'));}else{_0x4bc5b1=_0x48d857;return _0x4bc5b1;}})[_0x8da4('0xc')](function(){_0x4bc5b1[_0x8da4('0x16')](_0x23c596,function(_0x4cde44,_0x541f34){var _0xd1420d=_0x4bc5b1['loginAttempts']+0x1;if(_0x4cde44){return _0x444c96(_0x4cde44);}else if(!_0x541f34){if(_0x4bc5b1[_0x8da4('0x17')]){return _0x444c96(null,![],{'message':_0x8da4('0x15')});}else if(_0x1e9e57[_0x8da4('0xb')]>0x0){if(_0x4bc5b1[_0x8da4('0xf')]){if(_0x1e9e57[_0x8da4('0x18')]>0x0){if(moment(_0x4bc5b1[_0x8da4('0x10')])[_0x8da4('0x19')](_0x1e9e57[_0x8da4('0x18')],_0x8da4('0x1a'))>moment()){return _0x444c96(null,![],{'message':_0x8da4('0x15')});}else{return utils['clearBlockUser'](_0x4bc5b1,_0xd1420d,![],null)[_0x8da4('0xc')](function(){return _0x444c96(null,![],{'message':_0x8da4('0x15')});});}}else{return _0x444c96(null,![],{'message':_0x8da4('0x15')});}}else{if(_0xd1420d>=_0x1e9e57[_0x8da4('0xb')]){return utils[_0x8da4('0x1b')](_0x4bc5b1,0x0,!![],moment())['then'](function(){return _0x444c96(null,![],{'message':_0x8da4('0x15')});});}else{return utils[_0x8da4('0x1b')](_0x4bc5b1,_0xd1420d,![],null)[_0x8da4('0xc')](function(){return _0x444c96(null,![],{'message':_0x8da4('0x15')});});}}}else{return _0x444c96(null,![],{'message':_0x8da4('0x15')});}}else{if(_0x4bc5b1[_0x8da4('0x17')]){return _0x444c96(null,![],{'message':_0x8da4('0x15')});}else if(_0x1e9e57['allowedLoginAttempts']>0x0){if(_0x4bc5b1[_0x8da4('0xf')]){if(_0x1e9e57[_0x8da4('0x18')]>0x0){if(moment(_0x4bc5b1['blockedAt'])[_0x8da4('0x19')](_0x1e9e57[_0x8da4('0x18')],'minutes')>moment()){return _0x444c96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x8da4('0x1b')](_0x4bc5b1,0x0,![],null)[_0x8da4('0xc')](function(){return utils[_0x8da4('0x1c')](_0x4bc5b1);})[_0x8da4('0xc')](function(){return _0x444c96(null,_0x4bc5b1);});}}else{return _0x444c96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x4bc5b1,0x0,![],null)[_0x8da4('0xc')](function(){return utils[_0x8da4('0x1c')](_0x4bc5b1);})[_0x8da4('0xc')](function(){return _0x444c96(null,_0x4bc5b1);})[_0x8da4('0x1d')](function(_0xeb0f02){return _0x444c96(null,![],_0xeb0f02);});}}else{if(_0x4bc5b1[_0x8da4('0xf')]){return _0x444c96(null,![],{'message':_0x8da4('0x15')});}else{return utils[_0x8da4('0x1c')](_0x4bc5b1)[_0x8da4('0xc')](function(){return _0x444c96(null,_0x4bc5b1);});}}}});})[_0x8da4('0x1d')](function(_0x4b46f1){return _0x444c96(null,![],_0x4b46f1);});}function sendServiceMail(_0x1e8d93){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x8da4('0x14'),_0x8da4('0x1e')],'include':[{'model':db[_0x8da4('0x1f')],'as':_0x8da4('0x20'),'include':[{'model':db[_0x8da4('0x21')],'as':_0x8da4('0x21')}]}]})[_0x8da4('0xc')](function(_0x49a4cf){if(!_0x49a4cf){throw new Error(_0x8da4('0x22'));}var _0x5bb804=_0x49a4cf['getSmtpOptions']();var _0x4125e3={'account':_0x5bb804,'message':_[_0x8da4('0x23')]({'from':util[_0x8da4('0x24')](_0x8da4('0x25'),_0x49a4cf[_0x8da4('0x14')],_0x49a4cf[_0x8da4('0x1e')]||_0x49a4cf[_0x8da4('0x20')]['user'])},_0x1e8d93)};return client[_0x8da4('0x26')](_0x8da4('0x27'),_0x4125e3);})[_0x8da4('0xc')](function(_0x114003){if(_0x114003['error']){throw new Error(util[_0x8da4('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x114003[_0x8da4('0x28')]['message']||JSON[_0x8da4('0x29')](_0x114003[_0x8da4('0x28')])));}return!![];});}function handleError(_0x37afb6,_0x101f0f,_0x49fad1){return _0x37afb6[_0x8da4('0x2a')](_0x101f0f||0x1f4)[_0x8da4('0x2b')]({'message':_0x49fad1?_0x49fad1[_0x8da4('0x2c')]||_0x49fad1:''});}exports[_0x8da4('0x2d')]=function(_0x47dd39,_0x503a4a,_0x123161){passport['authenticate'](_0x8da4('0x2e'),function(_0x342ddf,_0xda9358,_0x589f84){var _0x5da35e=_0x342ddf||_0x589f84;if(_0x5da35e){return handleError(_0x503a4a,0x191,_0x5da35e);}if(!_0xda9358){return handleError(_0x503a4a,0x194,{'message':_0x8da4('0x2f')});}else{var _0xb37901={'payload':{'id':_0xda9358['id'],'role':_0xda9358[_0x8da4('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x8da4('0x31')](_0xb37901)['then'](function(_0x9c770c){_0x503a4a['json']({'id':_0xda9358['id'],'token':_0x9c770c,'statusCall':'','isAlreadyLogged':_0xda9358[_0x8da4('0x32')]});});}})(_0x47dd39,_0x503a4a,_0x123161);};exports['forgot']=function(_0x368119,_0x31942c){if(!_0x368119[_0x8da4('0x33')]['email']){return handleError(_0x31942c,0x1f4,{'message':_0x8da4('0x34')});}var _0x125000=rs[_0x8da4('0x35')]();_0x368119[_0x8da4('0x33')][_0x8da4('0x1e')]=_0x368119[_0x8da4('0x33')][_0x8da4('0x1e')][_0x8da4('0x36')]()[_0x8da4('0x37')]();var _0x3b54c9;return db[_0x8da4('0x9')][_0x8da4('0xa')]({'where':{'id':0x1},'attributes':[_0x8da4('0xb'),_0x8da4('0x18')],'raw':!![]})[_0x8da4('0xc')](function(_0x19b2f2){_0x3b54c9=_0x19b2f2;return db[_0x8da4('0x38')][_0x8da4('0x39')]({'where':{'email':_0x368119[_0x8da4('0x33')][_0x8da4('0x1e')]}});})['then'](function(_0x50d3a3){if(!_0x50d3a3){throw new Error(_0x8da4('0x3a'));}if(_0x50d3a3[_0x8da4('0x17')]){throw new Error(_0x8da4('0x3b'));}if(_0x50d3a3[_0x8da4('0xf')]){if(moment(_0x50d3a3[_0x8da4('0x10')])[_0x8da4('0x19')](_0x3b54c9[_0x8da4('0x18')],_0x8da4('0x1a'))>moment()){throw new Error(_0x8da4('0x3c'));}else{_0x50d3a3[_0x8da4('0xf')]=![];_0x50d3a3[_0x8da4('0x10')]=null;}}_0x50d3a3['resetPasswordToken']=_0x125000;_0x50d3a3[_0x8da4('0x3d')]=Date[_0x8da4('0x3e')]()+0x36ee80;return _0x50d3a3[_0x8da4('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x368119[_0x8da4('0x33')][_0x8da4('0x1e')],'subject':_0x8da4('0x40'),'text':_0x8da4('0x41')+_0x8da4('0x42')+_0x8da4('0x43')+_0x368119[_0x8da4('0x44')][_0x8da4('0x45')]+_0x8da4('0x46')+_0x125000+'\x0a\x0a'+_0x8da4('0x47')});})[_0x8da4('0xc')](function(){_0x31942c[_0x8da4('0x2a')](0xc8)[_0x8da4('0x2b')]({'message':_0x8da4('0x48')});})[_0x8da4('0x1d')](function(_0x5c40d0){return handleError(_0x31942c,0x1f4,_0x5c40d0);});};exports[_0x8da4('0x49')]=function(_0x221c7e,_0x5801b4){return db[_0x8da4('0x38')][_0x8da4('0x39')]({'where':{'resetPasswordToken':_0x221c7e[_0x8da4('0x4a')][_0x8da4('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x8da4('0x3e')]()}}})[_0x8da4('0xc')](function(_0x537a5e){if(!_0x537a5e){throw new Error(_0x8da4('0x4c'));}return db[_0x8da4('0x9')][_0x8da4('0xa')]({'attributes':['id',_0x8da4('0x4d'),_0x8da4('0x4e'),_0x8da4('0x4f')]})[_0x8da4('0xc')](function(_0x2d2fb4){if(_0x2d2fb4[_0x8da4('0x4d')])authService[_0x8da4('0x50')](_0x221c7e[_0x8da4('0x33')][_0x8da4('0xd')]);if(!_0x2d2fb4[_0x8da4('0x4e')]||!_0x537a5e['previousPasswords'])return _0x537a5e;authService[_0x8da4('0x51')](_0x221c7e['body']['password'],_0x537a5e[_0x8da4('0x52')],_0x2d2fb4[_0x8da4('0x4f')]);return _0x537a5e;})[_0x8da4('0xc')](function(){_0x537a5e[_0x8da4('0xd')]=_0x221c7e['body'][_0x8da4('0xd')];_0x537a5e[_0x8da4('0x53')]=null;_0x537a5e['resetPasswordExpires']=null;return _0x537a5e[_0x8da4('0x3f')]();});})['then'](function(){_0x5801b4[_0x8da4('0x2a')](0xc8)['send']({'message':_0x8da4('0x54')});})[_0x8da4('0x1d')](function(_0x5a4334){return handleError(_0x5801b4,0x1f4,_0x5a4334);});};passport[_0x8da4('0x55')](_0x8da4('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':_0x8da4('0xd')},function(_0xf33a8d,_0x1d4dce,_0x5613f5){return localAuthenticate(db[_0x8da4('0x38')],_0xf33a8d,_0x1d4dce,_0x5613f5);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index cd4d373..ab81803 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 _0x329d=['/reset/:token','reset','express','Router','post','forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x329d,0x7a));var _0xd329=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x329d[_0x21b36c];return _0x236627;};'use strict';var express=require(_0xd329('0x0'));var router=express[_0xd329('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xd329('0x2')]('/forgot',controller[_0xd329('0x3')]);router['post'](_0xd329('0x4'),controller[_0xd329('0x5')]);module['exports']=router; \ No newline at end of file +var _0x8c29=['post','/forgot','forgot','reset','exports','express','Router','./authLocal.controller'];(function(_0x3c48de,_0x40602e){var _0x17942d=function(_0xefb110){while(--_0xefb110){_0x3c48de['push'](_0x3c48de['shift']());}};_0x17942d(++_0x40602e);}(_0x8c29,0x1dd));var _0x98c2=function(_0x179f89,_0x14cdb5){_0x179f89=_0x179f89-0x0;var _0x24632f=_0x8c29[_0x179f89];return _0x24632f;};'use strict';var express=require(_0x98c2('0x0'));var router=express[_0x98c2('0x1')]();var controller=require(_0x98c2('0x2'));router['post']('/',controller['login']);router[_0x98c2('0x3')](_0x98c2('0x4'),controller[_0x98c2('0x5')]);router['post']('/reset/:token',controller[_0x98c2('0x6')]);module[_0x98c2('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 f1898aa..24521eb 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 _0x3b7f=['STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b7f,0xd1));var _0xf3b7=function(_0x2aa1d7,_0x1b35d2){_0x2aa1d7=_0x2aa1d7-0x0;var _0x44ce7d=_0x3b7f[_0x2aa1d7];return _0x44ce7d;};'use strict';var Sequelize=require(_0xf3b7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf3b7('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf3b7('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x11a9=['STRING','INTEGER'];(function(_0x445892,_0x6afa21){var _0x1a0169=function(_0x7aec7a){while(--_0x7aec7a){_0x445892['push'](_0x445892['shift']());}};_0x1a0169(++_0x6afa21);}(_0x11a9,0x176));var _0x911a=function(_0x57d53e,_0x4f8f69){_0x57d53e=_0x57d53e-0x0;var _0x56525e=_0x11a9[_0x57d53e];return _0x56525e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x911a('0x0')]},'description':{'type':Sequelize[_0x911a('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x911a('0x1')],'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 2103c34..21dbd41 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 _0x9728=['where','VIRTUAL','options','count','findAll','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','omit','ids','getConditions','nolimit','getActions','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','save','update','then','destroy','end','name','send','index','map','Automation','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge'];(function(_0x292967,_0x15053b){var _0xa27097=function(_0x1f2ea9){while(--_0x1f2ea9){_0x292967['push'](_0x292967['shift']());}};_0xa27097(++_0x15053b);}(_0x9728,0xb7));var _0x8972=function(_0xf32424,_0x57f56d){_0xf32424=_0xf32424-0x0;var _0x3290ce=_0x9728[_0xf32424];return _0x3290ce;};'use strict';var emlformat=require(_0x8972('0x0'));var rimraf=require(_0x8972('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8972('0x2'));var rp=require(_0x8972('0x3'));var moment=require(_0x8972('0x4'));var BPromise=require(_0x8972('0x5'));var Mustache=require(_0x8972('0x6'));var util=require(_0x8972('0x7'));var path=require(_0x8972('0x8'));var sox=require(_0x8972('0x9'));var csv=require(_0x8972('0xa'));var ejs=require(_0x8972('0xb'));var fs=require('fs');var fs_extra=require(_0x8972('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8972('0xd'));var jsforce=require(_0x8972('0xe'));var deskjs=require(_0x8972('0xf'));var toCsv=require(_0x8972('0xa'));var querystring=require('querystring');var Papa=require(_0x8972('0x10'));var Redis=require(_0x8972('0x11'));var authService=require(_0x8972('0x12'));var qs=require(_0x8972('0x13'));var as=require(_0x8972('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8972('0x15'))(_0x8972('0x16'));var utils=require(_0x8972('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8972('0x18'));var db=require(_0x8972('0x19'))['db'];function respondWithStatusCode(_0x3d9268,_0x1c55cd){_0x1c55cd=_0x1c55cd||0xcc;return function(_0x54e230){if(_0x54e230){return _0x3d9268[_0x8972('0x1a')](_0x1c55cd);}return _0x3d9268[_0x8972('0x1b')](_0x1c55cd)['end']();};}function respondWithResult(_0x3249bd,_0x3ecf3c){_0x3ecf3c=_0x3ecf3c||0xc8;return function(_0x82f71e){if(_0x82f71e){return _0x3249bd[_0x8972('0x1b')](_0x3ecf3c)[_0x8972('0x1c')](_0x82f71e);}};}function respondWithFilteredResult(_0x3b6000,_0xa2fe5c){return function(_0x841e7d){if(_0x841e7d){var _0x57b82f=typeof _0xa2fe5c['offset']===_0x8972('0x1d')&&typeof _0xa2fe5c[_0x8972('0x1e')]===_0x8972('0x1d');var _0x2802d1=_0x841e7d['count'];var _0x88ad1c=_0x57b82f?0x0:_0xa2fe5c[_0x8972('0x1f')];var _0xb138e9=_0x57b82f?_0x841e7d['count']:_0xa2fe5c['offset']+_0xa2fe5c[_0x8972('0x1e')];var _0x2e9bf1;if(_0xb138e9>=_0x2802d1){_0xb138e9=_0x2802d1;_0x2e9bf1=0xc8;}else{_0x2e9bf1=0xce;}_0x3b6000[_0x8972('0x1b')](_0x2e9bf1);return _0x3b6000[_0x8972('0x20')]('Content-Range',_0x88ad1c+'-'+_0xb138e9+'/'+_0x2802d1)[_0x8972('0x1c')](_0x841e7d);}return null;};}function patchUpdates(_0x989664){return function(_0x1d64f3){try{jsonpatch[_0x8972('0x21')](_0x1d64f3,_0x989664,!![]);}catch(_0x2b368d){return BPromise['reject'](_0x2b368d);}return _0x1d64f3[_0x8972('0x22')]();};}function saveUpdates(_0x4575f5,_0x55625b){return function(_0x22f08d){if(_0x22f08d){return _0x22f08d[_0x8972('0x23')](_0x4575f5)[_0x8972('0x24')](function(_0x3a910e){return _0x3a910e;});}return null;};}function removeEntity(_0x4c4ab0,_0x4774b1){return function(_0x2c080d){if(_0x2c080d){return _0x2c080d[_0x8972('0x25')]()[_0x8972('0x24')](function(){_0x4c4ab0['status'](0xcc)[_0x8972('0x26')]();});}};}function handleEntityNotFound(_0x2ceb26,_0x297c2e){return function(_0x1ea200){if(!_0x1ea200){_0x2ceb26['sendStatus'](0x194);}return _0x1ea200;};}function handleError(_0x466059,_0x1553a3){_0x1553a3=_0x1553a3||0x1f4;return function(_0x3e45c1){logger['error'](_0x3e45c1['stack']);if(_0x3e45c1[_0x8972('0x27')]){delete _0x3e45c1['name'];}_0x466059[_0x8972('0x1b')](_0x1553a3)[_0x8972('0x28')](_0x3e45c1);};}exports[_0x8972('0x29')]=function(_0x568c1c,_0xe63df6){var _0x35f134={},_0x254e23={},_0x12c0be={'count':0x0,'rows':[]};var _0x3d6dd8=_[_0x8972('0x2a')](db[_0x8972('0x2b')][_0x8972('0x2c')],function(_0x216fec){return{'name':_0x216fec['fieldName'],'type':_0x216fec[_0x8972('0x2d')]['key']};});_0x254e23['model']=_[_0x8972('0x2a')](_0x3d6dd8,_0x8972('0x27'));_0x254e23[_0x8972('0x2e')]=_[_0x8972('0x2f')](_0x568c1c['query']);_0x254e23[_0x8972('0x30')]=_[_0x8972('0x31')](_0x254e23[_0x8972('0x32')],_0x254e23[_0x8972('0x2e')]);_0x35f134[_0x8972('0x33')]=_['intersection'](_0x254e23['model'],qs[_0x8972('0x34')](_0x568c1c[_0x8972('0x2e')]['fields']));_0x35f134[_0x8972('0x33')]=_0x35f134[_0x8972('0x33')][_0x8972('0x35')]?_0x35f134[_0x8972('0x33')]:_0x254e23[_0x8972('0x32')];if(!_0x568c1c[_0x8972('0x2e')][_0x8972('0x36')]('nolimit')){_0x35f134[_0x8972('0x1e')]=qs[_0x8972('0x1e')](_0x568c1c['query'][_0x8972('0x1e')]);_0x35f134[_0x8972('0x1f')]=qs[_0x8972('0x1f')](_0x568c1c[_0x8972('0x2e')]['offset']);}_0x35f134[_0x8972('0x37')]=qs[_0x8972('0x38')](_0x568c1c[_0x8972('0x2e')][_0x8972('0x38')]);_0x35f134['where']=qs[_0x8972('0x30')](_[_0x8972('0x39')](_0x568c1c[_0x8972('0x2e')],_0x254e23[_0x8972('0x30')]),_0x3d6dd8);if(_0x568c1c[_0x8972('0x2e')][_0x8972('0x3a')]){_0x35f134['where']=_[_0x8972('0x3b')](_0x35f134[_0x8972('0x3c')],{'$or':_['map'](_0x3d6dd8,function(_0x47f208){if(_0x47f208['type']!==_0x8972('0x3d')){var _0x16319f={};_0x16319f[_0x47f208['name']]={'$like':'%'+_0x568c1c[_0x8972('0x2e')][_0x8972('0x3a')]+'%'};return _0x16319f;}})});}_0x35f134=_[_0x8972('0x3b')]({},_0x35f134,_0x568c1c[_0x8972('0x3e')]);var _0x16eea0={'where':_0x35f134['where']};return db[_0x8972('0x2b')][_0x8972('0x3f')](_0x16eea0)[_0x8972('0x24')](function(_0x29d1b4){_0x12c0be['count']=_0x29d1b4;if(_0x568c1c[_0x8972('0x2e')]['includeAll']){_0x35f134['include']=[{'all':!![]}];}return db[_0x8972('0x2b')][_0x8972('0x40')](_0x35f134);})[_0x8972('0x24')](function(_0xd86a3d){_0x12c0be[_0x8972('0x41')]=_0xd86a3d;return _0x12c0be;})[_0x8972('0x24')](respondWithFilteredResult(_0xe63df6,_0x35f134))[_0x8972('0x42')](handleError(_0xe63df6,null));};exports[_0x8972('0x43')]=function(_0x4010ae,_0xe47930){var _0x2c4777={'raw':![],'where':{'id':_0x4010ae[_0x8972('0x44')]['id']}},_0x2ceca3={};_0x2ceca3[_0x8972('0x32')]=_['keys'](db[_0x8972('0x2b')][_0x8972('0x2c')]);_0x2ceca3[_0x8972('0x2e')]=_[_0x8972('0x2f')](_0x4010ae[_0x8972('0x2e')]);_0x2ceca3[_0x8972('0x30')]=_[_0x8972('0x31')](_0x2ceca3[_0x8972('0x32')],_0x2ceca3[_0x8972('0x2e')]);_0x2c4777[_0x8972('0x33')]=_[_0x8972('0x31')](_0x2ceca3[_0x8972('0x32')],qs[_0x8972('0x34')](_0x4010ae[_0x8972('0x2e')]['fields']));_0x2c4777[_0x8972('0x33')]=_0x2c4777[_0x8972('0x33')][_0x8972('0x35')]?_0x2c4777['attributes']:_0x2ceca3[_0x8972('0x32')];if(_0x4010ae[_0x8972('0x2e')][_0x8972('0x45')]){_0x2c4777['include']=[{'all':!![]}];}_0x2c4777=_['merge']({},_0x2c4777,_0x4010ae[_0x8972('0x3e')]);return db[_0x8972('0x2b')][_0x8972('0x46')](_0x2c4777)[_0x8972('0x24')](handleEntityNotFound(_0xe47930,null))[_0x8972('0x24')](respondWithResult(_0xe47930,null))['catch'](handleError(_0xe47930,null));};exports['create']=function(_0x396e5b,_0x1fb94b){return db['Automation'][_0x8972('0x47')](_0x396e5b[_0x8972('0x48')],{})[_0x8972('0x24')](respondWithResult(_0x1fb94b,0xc9))[_0x8972('0x42')](handleError(_0x1fb94b,null));};exports[_0x8972('0x23')]=function(_0x33da77,_0x1c88a4){if(_0x33da77[_0x8972('0x48')]['id']){delete _0x33da77[_0x8972('0x48')]['id'];}return db[_0x8972('0x2b')][_0x8972('0x46')]({'where':{'id':_0x33da77[_0x8972('0x44')]['id']}})[_0x8972('0x24')](handleEntityNotFound(_0x1c88a4,null))[_0x8972('0x24')](saveUpdates(_0x33da77[_0x8972('0x48')],null))[_0x8972('0x24')](respondWithResult(_0x1c88a4,null))[_0x8972('0x42')](handleError(_0x1c88a4,null));};exports[_0x8972('0x25')]=function(_0x1697e3,_0x198ef6){return db['Automation'][_0x8972('0x46')]({'where':{'id':_0x1697e3[_0x8972('0x44')]['id']}})['then'](handleEntityNotFound(_0x198ef6,null))[_0x8972('0x24')](removeEntity(_0x198ef6,null))[_0x8972('0x42')](handleError(_0x198ef6,null));};exports[_0x8972('0x49')]=function(_0x5ab797,_0x33098f,_0x450420){return db[_0x8972('0x4a')]['find']({'where':{'id':_0x5ab797[_0x8972('0x44')]['id']}})[_0x8972('0x24')](handleEntityNotFound(_0x33098f,null))[_0x8972('0x24')](function(_0x5f5659){if(_0x5f5659){return _0x5f5659[_0x8972('0x49')](_0x5ab797[_0x8972('0x48')]['ids'],_[_0x8972('0x4b')](_0x5ab797['body'],[_0x8972('0x4c'),'id'])||{});}})[_0x8972('0x24')](respondWithResult(_0x33098f,null))[_0x8972('0x42')](handleError(_0x33098f,null));};exports[_0x8972('0x4d')]=function(_0x22b378,_0x1efcc7,_0x22abf5){var _0x53924d={};var _0xfb1021={};var _0x30d098;var _0x40452d;return db[_0x8972('0x2b')]['findOne']({'where':{'id':_0x22b378[_0x8972('0x44')]['id']}})[_0x8972('0x24')](handleEntityNotFound(_0x1efcc7,null))['then'](function(_0x269491){if(_0x269491){_0x30d098=_0x269491;_0xfb1021[_0x8972('0x32')]=_[_0x8972('0x2f')](db['Condition'][_0x8972('0x2c')]);_0xfb1021[_0x8972('0x2e')]=_[_0x8972('0x2f')](_0x22b378[_0x8972('0x2e')]);_0xfb1021[_0x8972('0x30')]=_[_0x8972('0x31')](_0xfb1021[_0x8972('0x32')],_0xfb1021['query']);_0x53924d[_0x8972('0x33')]=_[_0x8972('0x31')](_0xfb1021[_0x8972('0x32')],qs['fields'](_0x22b378['query'][_0x8972('0x34')]));_0x53924d[_0x8972('0x33')]=_0x53924d[_0x8972('0x33')]['length']?_0x53924d[_0x8972('0x33')]:_0xfb1021[_0x8972('0x32')];_0x53924d[_0x8972('0x37')]=qs[_0x8972('0x38')](_0x22b378['query'][_0x8972('0x38')]);_0x53924d[_0x8972('0x3c')]=qs[_0x8972('0x30')](_['pick'](_0x22b378[_0x8972('0x2e')],_0xfb1021[_0x8972('0x30')]));if(_0x22b378['query'][_0x8972('0x3a')]){_0x53924d[_0x8972('0x3c')]=_[_0x8972('0x3b')](_0x53924d[_0x8972('0x3c')],{'$or':_[_0x8972('0x2a')](_0x53924d[_0x8972('0x33')],function(_0x125c9c){var _0x3e927a={};_0x3e927a[_0x125c9c]={'$like':'%'+_0x22b378[_0x8972('0x2e')][_0x8972('0x3a')]+'%'};return _0x3e927a;})});}_0x53924d=_['merge']({},_0x53924d,_0x22b378[_0x8972('0x3e')]);return _0x30d098['getConditions'](_0x53924d);}})[_0x8972('0x24')](function(_0x3b2bea){if(_0x3b2bea){_0x40452d=_0x3b2bea[_0x8972('0x35')];if(!_0x22b378['query']['hasOwnProperty'](_0x8972('0x4e'))){_0x53924d[_0x8972('0x1e')]=qs[_0x8972('0x1e')](_0x22b378[_0x8972('0x2e')]['limit']);_0x53924d['offset']=qs['offset'](_0x22b378[_0x8972('0x2e')][_0x8972('0x1f')]);}return _0x30d098[_0x8972('0x4d')](_0x53924d);}})[_0x8972('0x24')](function(_0x51b243){if(_0x51b243){return _0x51b243?{'count':_0x40452d,'rows':_0x51b243}:null;}})['then'](respondWithResult(_0x1efcc7,null))[_0x8972('0x42')](handleError(_0x1efcc7,null));};exports['addActions']=function(_0x500ea2,_0x1a9f8d,_0x33b2b7){return db['Action'][_0x8972('0x46')]({'where':{'id':_0x500ea2['params']['id']}})[_0x8972('0x24')](handleEntityNotFound(_0x1a9f8d,null))[_0x8972('0x24')](function(_0x150460){if(_0x150460){return _0x150460['addActions'](_0x500ea2['body'][_0x8972('0x4c')],_[_0x8972('0x4b')](_0x500ea2[_0x8972('0x48')],['ids','id'])||{});}})[_0x8972('0x24')](respondWithResult(_0x1a9f8d,null))[_0x8972('0x42')](handleError(_0x1a9f8d,null));};exports[_0x8972('0x4f')]=function(_0x3b0d20,_0x12adba,_0x500489){var _0x7505c1={};var _0x487d12={};var _0x3e7bcf;var _0x30729d;return db[_0x8972('0x2b')][_0x8972('0x50')]({'where':{'id':_0x3b0d20[_0x8972('0x44')]['id']}})['then'](handleEntityNotFound(_0x12adba,null))[_0x8972('0x24')](function(_0x49e556){if(_0x49e556){_0x3e7bcf=_0x49e556;_0x487d12['model']=_[_0x8972('0x2f')](db['Action'][_0x8972('0x2c')]);_0x487d12[_0x8972('0x2e')]=_[_0x8972('0x2f')](_0x3b0d20[_0x8972('0x2e')]);_0x487d12[_0x8972('0x30')]=_[_0x8972('0x31')](_0x487d12[_0x8972('0x32')],_0x487d12[_0x8972('0x2e')]);_0x7505c1['attributes']=_[_0x8972('0x31')](_0x487d12[_0x8972('0x32')],qs[_0x8972('0x34')](_0x3b0d20[_0x8972('0x2e')][_0x8972('0x34')]));_0x7505c1[_0x8972('0x33')]=_0x7505c1['attributes']['length']?_0x7505c1[_0x8972('0x33')]:_0x487d12[_0x8972('0x32')];_0x7505c1[_0x8972('0x37')]=qs[_0x8972('0x38')](_0x3b0d20[_0x8972('0x2e')][_0x8972('0x38')]);_0x7505c1[_0x8972('0x3c')]=qs['filters'](_[_0x8972('0x39')](_0x3b0d20[_0x8972('0x2e')],_0x487d12[_0x8972('0x30')]));if(_0x3b0d20['query']['filter']){_0x7505c1[_0x8972('0x3c')]=_[_0x8972('0x3b')](_0x7505c1['where'],{'$or':_[_0x8972('0x2a')](_0x7505c1[_0x8972('0x33')],function(_0x5a610c){var _0x252e10={};_0x252e10[_0x5a610c]={'$like':'%'+_0x3b0d20['query'][_0x8972('0x3a')]+'%'};return _0x252e10;})});}_0x7505c1=_[_0x8972('0x3b')]({},_0x7505c1,_0x3b0d20[_0x8972('0x3e')]);return _0x3e7bcf[_0x8972('0x4f')](_0x7505c1);}})[_0x8972('0x24')](function(_0xfc723d){if(_0xfc723d){_0x30729d=_0xfc723d[_0x8972('0x35')];if(!_0x3b0d20[_0x8972('0x2e')][_0x8972('0x36')](_0x8972('0x4e'))){_0x7505c1[_0x8972('0x1e')]=qs[_0x8972('0x1e')](_0x3b0d20[_0x8972('0x2e')][_0x8972('0x1e')]);_0x7505c1[_0x8972('0x1f')]=qs[_0x8972('0x1f')](_0x3b0d20[_0x8972('0x2e')][_0x8972('0x1f')]);}return _0x3e7bcf[_0x8972('0x4f')](_0x7505c1);}})[_0x8972('0x24')](function(_0x1d0359){if(_0x1d0359){return _0x1d0359?{'count':_0x30729d,'rows':_0x1d0359}:null;}})[_0x8972('0x24')](respondWithResult(_0x12adba,null))[_0x8972('0x42')](handleError(_0x12adba,null));}; \ No newline at end of file +var _0x65dd=['Condition','ids','findOne','getConditions','addActions','getActions','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','Automation','includeAll','include','findAll','rows','catch','params','keys','options','create','body','update','find','addConditions'];(function(_0x40f310,_0x33f8ba){var _0x414b2d=function(_0x23aa85){while(--_0x23aa85){_0x40f310['push'](_0x40f310['shift']());}};_0x414b2d(++_0x33f8ba);}(_0x65dd,0x14b));var _0xd65d=function(_0x1221eb,_0x5324be){_0x1221eb=_0x1221eb-0x0;var _0x39cc1b=_0x65dd[_0x1221eb];return _0x39cc1b;};'use strict';var emlformat=require(_0xd65d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd65d('0x1'));var jsonpatch=require(_0xd65d('0x2'));var rp=require(_0xd65d('0x3'));var moment=require(_0xd65d('0x4'));var BPromise=require(_0xd65d('0x5'));var Mustache=require(_0xd65d('0x6'));var util=require(_0xd65d('0x7'));var path=require('path');var sox=require(_0xd65d('0x8'));var csv=require(_0xd65d('0x9'));var ejs=require(_0xd65d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd65d('0xb'));var jsforce=require(_0xd65d('0xc'));var deskjs=require(_0xd65d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd65d('0xe'));var Redis=require(_0xd65d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd65d('0x10'));var hardwareService=require(_0xd65d('0x11'));var logger=require('../../config/logger')(_0xd65d('0x12'));var utils=require(_0xd65d('0x13'));var config=require(_0xd65d('0x14'));var licenseUtil=require(_0xd65d('0x15'));var db=require(_0xd65d('0x16'))['db'];function respondWithStatusCode(_0x41f4e5,_0xddb65){_0xddb65=_0xddb65||0xcc;return function(_0x358cc5){if(_0x358cc5){return _0x41f4e5['sendStatus'](_0xddb65);}return _0x41f4e5[_0xd65d('0x17')](_0xddb65)[_0xd65d('0x18')]();};}function respondWithResult(_0x49eadc,_0x5f2ac2){_0x5f2ac2=_0x5f2ac2||0xc8;return function(_0x364369){if(_0x364369){return _0x49eadc[_0xd65d('0x17')](_0x5f2ac2)['json'](_0x364369);}};}function respondWithFilteredResult(_0x56d9b6,_0x25118b){return function(_0x2a4071){if(_0x2a4071){var _0x480263=typeof _0x25118b[_0xd65d('0x19')]===_0xd65d('0x1a')&&typeof _0x25118b[_0xd65d('0x1b')]===_0xd65d('0x1a');var _0x2e68ae=_0x2a4071[_0xd65d('0x1c')];var _0x3f8e30=_0x480263?0x0:_0x25118b[_0xd65d('0x19')];var _0x129dc7=_0x480263?_0x2a4071['count']:_0x25118b['offset']+_0x25118b[_0xd65d('0x1b')];var _0x57df4b;if(_0x129dc7>=_0x2e68ae){_0x129dc7=_0x2e68ae;_0x57df4b=0xc8;}else{_0x57df4b=0xce;}_0x56d9b6[_0xd65d('0x17')](_0x57df4b);return _0x56d9b6[_0xd65d('0x1d')]('Content-Range',_0x3f8e30+'-'+_0x129dc7+'/'+_0x2e68ae)['json'](_0x2a4071);}return null;};}function patchUpdates(_0xd1c871){return function(_0x3815cc){try{jsonpatch[_0xd65d('0x1e')](_0x3815cc,_0xd1c871,!![]);}catch(_0x47bfed){return BPromise[_0xd65d('0x1f')](_0x47bfed);}return _0x3815cc[_0xd65d('0x20')]();};}function saveUpdates(_0x499973,_0x5cb0dc){return function(_0xeaf033){if(_0xeaf033){return _0xeaf033['update'](_0x499973)[_0xd65d('0x21')](function(_0x14fa0d){return _0x14fa0d;});}return null;};}function removeEntity(_0x3f5c98,_0x56fa74){return function(_0x24c52a){if(_0x24c52a){return _0x24c52a[_0xd65d('0x22')]()['then'](function(){_0x3f5c98[_0xd65d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158468,_0x5206ef){return function(_0x50e306){if(!_0x50e306){_0x158468['sendStatus'](0x194);}return _0x50e306;};}function handleError(_0x4b8a4a,_0x3d8bd8){_0x3d8bd8=_0x3d8bd8||0x1f4;return function(_0x524c4a){logger[_0xd65d('0x23')](_0x524c4a[_0xd65d('0x24')]);if(_0x524c4a[_0xd65d('0x25')]){delete _0x524c4a[_0xd65d('0x25')];}_0x4b8a4a[_0xd65d('0x17')](_0x3d8bd8)[_0xd65d('0x26')](_0x524c4a);};}exports[_0xd65d('0x27')]=function(_0x38ade9,_0x31d787){var _0x3860e9={},_0x7a3cb2={},_0x43c1ab={'count':0x0,'rows':[]};var _0x2765e8=_[_0xd65d('0x28')](db['Automation'][_0xd65d('0x29')],function(_0x17b6c8){return{'name':_0x17b6c8[_0xd65d('0x2a')],'type':_0x17b6c8[_0xd65d('0x2b')][_0xd65d('0x2c')]};});_0x7a3cb2['model']=_['map'](_0x2765e8,_0xd65d('0x25'));_0x7a3cb2[_0xd65d('0x2d')]=_['keys'](_0x38ade9[_0xd65d('0x2d')]);_0x7a3cb2[_0xd65d('0x2e')]=_[_0xd65d('0x2f')](_0x7a3cb2[_0xd65d('0x30')],_0x7a3cb2[_0xd65d('0x2d')]);_0x3860e9[_0xd65d('0x31')]=_['intersection'](_0x7a3cb2[_0xd65d('0x30')],qs[_0xd65d('0x32')](_0x38ade9['query']['fields']));_0x3860e9[_0xd65d('0x31')]=_0x3860e9['attributes'][_0xd65d('0x33')]?_0x3860e9['attributes']:_0x7a3cb2[_0xd65d('0x30')];if(!_0x38ade9[_0xd65d('0x2d')][_0xd65d('0x34')](_0xd65d('0x35'))){_0x3860e9[_0xd65d('0x1b')]=qs['limit'](_0x38ade9['query'][_0xd65d('0x1b')]);_0x3860e9[_0xd65d('0x19')]=qs[_0xd65d('0x19')](_0x38ade9['query'][_0xd65d('0x19')]);}_0x3860e9[_0xd65d('0x36')]=qs['sort'](_0x38ade9[_0xd65d('0x2d')][_0xd65d('0x37')]);_0x3860e9['where']=qs['filters'](_['pick'](_0x38ade9[_0xd65d('0x2d')],_0x7a3cb2['filters']),_0x2765e8);if(_0x38ade9['query'][_0xd65d('0x38')]){_0x3860e9[_0xd65d('0x39')]=_[_0xd65d('0x3a')](_0x3860e9[_0xd65d('0x39')],{'$or':_['map'](_0x2765e8,function(_0x2322e4){if(_0x2322e4[_0xd65d('0x2b')]!==_0xd65d('0x3b')){var _0x38bc5c={};_0x38bc5c[_0x2322e4[_0xd65d('0x25')]]={'$like':'%'+_0x38ade9[_0xd65d('0x2d')][_0xd65d('0x38')]+'%'};return _0x38bc5c;}})});}_0x3860e9=_['merge']({},_0x3860e9,_0x38ade9['options']);var _0x803bde={'where':_0x3860e9[_0xd65d('0x39')]};return db[_0xd65d('0x3c')]['count'](_0x803bde)['then'](function(_0x2ebf52){_0x43c1ab['count']=_0x2ebf52;if(_0x38ade9['query'][_0xd65d('0x3d')]){_0x3860e9[_0xd65d('0x3e')]=[{'all':!![]}];}return db[_0xd65d('0x3c')][_0xd65d('0x3f')](_0x3860e9);})['then'](function(_0x5cbb34){_0x43c1ab[_0xd65d('0x40')]=_0x5cbb34;return _0x43c1ab;})['then'](respondWithFilteredResult(_0x31d787,_0x3860e9))[_0xd65d('0x41')](handleError(_0x31d787,null));};exports['show']=function(_0x4a3d57,_0x251a76){var _0x1f9b3a={'raw':![],'where':{'id':_0x4a3d57[_0xd65d('0x42')]['id']}},_0x3ff2a8={};_0x3ff2a8['model']=_[_0xd65d('0x43')](db['Automation'][_0xd65d('0x29')]);_0x3ff2a8[_0xd65d('0x2d')]=_[_0xd65d('0x43')](_0x4a3d57[_0xd65d('0x2d')]);_0x3ff2a8[_0xd65d('0x2e')]=_['intersection'](_0x3ff2a8[_0xd65d('0x30')],_0x3ff2a8[_0xd65d('0x2d')]);_0x1f9b3a[_0xd65d('0x31')]=_[_0xd65d('0x2f')](_0x3ff2a8['model'],qs['fields'](_0x4a3d57[_0xd65d('0x2d')][_0xd65d('0x32')]));_0x1f9b3a['attributes']=_0x1f9b3a[_0xd65d('0x31')][_0xd65d('0x33')]?_0x1f9b3a[_0xd65d('0x31')]:_0x3ff2a8[_0xd65d('0x30')];if(_0x4a3d57[_0xd65d('0x2d')][_0xd65d('0x3d')]){_0x1f9b3a['include']=[{'all':!![]}];}_0x1f9b3a=_[_0xd65d('0x3a')]({},_0x1f9b3a,_0x4a3d57[_0xd65d('0x44')]);return db[_0xd65d('0x3c')]['find'](_0x1f9b3a)[_0xd65d('0x21')](handleEntityNotFound(_0x251a76,null))['then'](respondWithResult(_0x251a76,null))[_0xd65d('0x41')](handleError(_0x251a76,null));};exports[_0xd65d('0x45')]=function(_0x1de8fa,_0x2502db){return db['Automation'][_0xd65d('0x45')](_0x1de8fa[_0xd65d('0x46')],{})['then'](respondWithResult(_0x2502db,0xc9))[_0xd65d('0x41')](handleError(_0x2502db,null));};exports[_0xd65d('0x47')]=function(_0x95ae0c,_0x5a2a93){if(_0x95ae0c['body']['id']){delete _0x95ae0c[_0xd65d('0x46')]['id'];}return db[_0xd65d('0x3c')][_0xd65d('0x48')]({'where':{'id':_0x95ae0c['params']['id']}})['then'](handleEntityNotFound(_0x5a2a93,null))[_0xd65d('0x21')](saveUpdates(_0x95ae0c['body'],null))[_0xd65d('0x21')](respondWithResult(_0x5a2a93,null))[_0xd65d('0x41')](handleError(_0x5a2a93,null));};exports['destroy']=function(_0x3bb75d,_0x147214){return db['Automation']['find']({'where':{'id':_0x3bb75d['params']['id']}})[_0xd65d('0x21')](handleEntityNotFound(_0x147214,null))[_0xd65d('0x21')](removeEntity(_0x147214,null))[_0xd65d('0x41')](handleError(_0x147214,null));};exports[_0xd65d('0x49')]=function(_0x311ffd,_0x212199,_0x5dcbe7){return db[_0xd65d('0x4a')]['find']({'where':{'id':_0x311ffd[_0xd65d('0x42')]['id']}})['then'](handleEntityNotFound(_0x212199,null))[_0xd65d('0x21')](function(_0x798506){if(_0x798506){return _0x798506[_0xd65d('0x49')](_0x311ffd['body'][_0xd65d('0x4b')],_['omit'](_0x311ffd[_0xd65d('0x46')],[_0xd65d('0x4b'),'id'])||{});}})[_0xd65d('0x21')](respondWithResult(_0x212199,null))['catch'](handleError(_0x212199,null));};exports['getConditions']=function(_0x14378f,_0x5cfdd4,_0x385127){var _0xc871c5={};var _0x4f1b08={};var _0xa64339;var _0x3fa5e6;return db[_0xd65d('0x3c')][_0xd65d('0x4c')]({'where':{'id':_0x14378f[_0xd65d('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cfdd4,null))['then'](function(_0x394525){if(_0x394525){_0xa64339=_0x394525;_0x4f1b08[_0xd65d('0x30')]=_[_0xd65d('0x43')](db['Condition'][_0xd65d('0x29')]);_0x4f1b08[_0xd65d('0x2d')]=_[_0xd65d('0x43')](_0x14378f['query']);_0x4f1b08[_0xd65d('0x2e')]=_[_0xd65d('0x2f')](_0x4f1b08[_0xd65d('0x30')],_0x4f1b08[_0xd65d('0x2d')]);_0xc871c5[_0xd65d('0x31')]=_[_0xd65d('0x2f')](_0x4f1b08['model'],qs[_0xd65d('0x32')](_0x14378f[_0xd65d('0x2d')][_0xd65d('0x32')]));_0xc871c5['attributes']=_0xc871c5['attributes']['length']?_0xc871c5[_0xd65d('0x31')]:_0x4f1b08[_0xd65d('0x30')];_0xc871c5[_0xd65d('0x36')]=qs[_0xd65d('0x37')](_0x14378f[_0xd65d('0x2d')][_0xd65d('0x37')]);_0xc871c5[_0xd65d('0x39')]=qs[_0xd65d('0x2e')](_['pick'](_0x14378f[_0xd65d('0x2d')],_0x4f1b08[_0xd65d('0x2e')]));if(_0x14378f[_0xd65d('0x2d')][_0xd65d('0x38')]){_0xc871c5[_0xd65d('0x39')]=_['merge'](_0xc871c5['where'],{'$or':_[_0xd65d('0x28')](_0xc871c5[_0xd65d('0x31')],function(_0xfa6b29){var _0x5d2bcd={};_0x5d2bcd[_0xfa6b29]={'$like':'%'+_0x14378f[_0xd65d('0x2d')][_0xd65d('0x38')]+'%'};return _0x5d2bcd;})});}_0xc871c5=_[_0xd65d('0x3a')]({},_0xc871c5,_0x14378f['options']);return _0xa64339[_0xd65d('0x4d')](_0xc871c5);}})[_0xd65d('0x21')](function(_0x6d61df){if(_0x6d61df){_0x3fa5e6=_0x6d61df['length'];if(!_0x14378f[_0xd65d('0x2d')][_0xd65d('0x34')](_0xd65d('0x35'))){_0xc871c5[_0xd65d('0x1b')]=qs[_0xd65d('0x1b')](_0x14378f[_0xd65d('0x2d')][_0xd65d('0x1b')]);_0xc871c5[_0xd65d('0x19')]=qs[_0xd65d('0x19')](_0x14378f[_0xd65d('0x2d')][_0xd65d('0x19')]);}return _0xa64339[_0xd65d('0x4d')](_0xc871c5);}})[_0xd65d('0x21')](function(_0x8c835e){if(_0x8c835e){return _0x8c835e?{'count':_0x3fa5e6,'rows':_0x8c835e}:null;}})[_0xd65d('0x21')](respondWithResult(_0x5cfdd4,null))[_0xd65d('0x41')](handleError(_0x5cfdd4,null));};exports[_0xd65d('0x4e')]=function(_0x125183,_0xf0c59d,_0x3d666b){return db['Action'][_0xd65d('0x48')]({'where':{'id':_0x125183[_0xd65d('0x42')]['id']}})[_0xd65d('0x21')](handleEntityNotFound(_0xf0c59d,null))['then'](function(_0x2a8602){if(_0x2a8602){return _0x2a8602[_0xd65d('0x4e')](_0x125183['body']['ids'],_['omit'](_0x125183[_0xd65d('0x46')],[_0xd65d('0x4b'),'id'])||{});}})[_0xd65d('0x21')](respondWithResult(_0xf0c59d,null))[_0xd65d('0x41')](handleError(_0xf0c59d,null));};exports[_0xd65d('0x4f')]=function(_0x46e619,_0x4281db,_0x85f5c1){var _0x2393c5={};var _0x23cd7e={};var _0x2891c6;var _0x52ce0d;return db[_0xd65d('0x3c')][_0xd65d('0x4c')]({'where':{'id':_0x46e619['params']['id']}})[_0xd65d('0x21')](handleEntityNotFound(_0x4281db,null))[_0xd65d('0x21')](function(_0x3d154b){if(_0x3d154b){_0x2891c6=_0x3d154b;_0x23cd7e[_0xd65d('0x30')]=_[_0xd65d('0x43')](db['Action']['rawAttributes']);_0x23cd7e[_0xd65d('0x2d')]=_[_0xd65d('0x43')](_0x46e619[_0xd65d('0x2d')]);_0x23cd7e['filters']=_[_0xd65d('0x2f')](_0x23cd7e['model'],_0x23cd7e[_0xd65d('0x2d')]);_0x2393c5[_0xd65d('0x31')]=_['intersection'](_0x23cd7e[_0xd65d('0x30')],qs[_0xd65d('0x32')](_0x46e619[_0xd65d('0x2d')][_0xd65d('0x32')]));_0x2393c5['attributes']=_0x2393c5[_0xd65d('0x31')][_0xd65d('0x33')]?_0x2393c5[_0xd65d('0x31')]:_0x23cd7e[_0xd65d('0x30')];_0x2393c5[_0xd65d('0x36')]=qs[_0xd65d('0x37')](_0x46e619['query'][_0xd65d('0x37')]);_0x2393c5[_0xd65d('0x39')]=qs['filters'](_[_0xd65d('0x50')](_0x46e619[_0xd65d('0x2d')],_0x23cd7e[_0xd65d('0x2e')]));if(_0x46e619[_0xd65d('0x2d')]['filter']){_0x2393c5['where']=_[_0xd65d('0x3a')](_0x2393c5[_0xd65d('0x39')],{'$or':_[_0xd65d('0x28')](_0x2393c5[_0xd65d('0x31')],function(_0x18ad88){var _0x183a1a={};_0x183a1a[_0x18ad88]={'$like':'%'+_0x46e619[_0xd65d('0x2d')][_0xd65d('0x38')]+'%'};return _0x183a1a;})});}_0x2393c5=_['merge']({},_0x2393c5,_0x46e619[_0xd65d('0x44')]);return _0x2891c6[_0xd65d('0x4f')](_0x2393c5);}})[_0xd65d('0x21')](function(_0x12fca0){if(_0x12fca0){_0x52ce0d=_0x12fca0[_0xd65d('0x33')];if(!_0x46e619[_0xd65d('0x2d')]['hasOwnProperty'](_0xd65d('0x35'))){_0x2393c5[_0xd65d('0x1b')]=qs['limit'](_0x46e619[_0xd65d('0x2d')][_0xd65d('0x1b')]);_0x2393c5[_0xd65d('0x19')]=qs[_0xd65d('0x19')](_0x46e619[_0xd65d('0x2d')][_0xd65d('0x19')]);}return _0x2891c6[_0xd65d('0x4f')](_0x2393c5);}})[_0xd65d('0x21')](function(_0x428f72){if(_0x428f72){return _0x428f72?{'count':_0x52ce0d,'rows':_0x428f72}:null;}})['then'](respondWithResult(_0x4281db,null))[_0xd65d('0x41')](handleError(_0x4281db,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2a70c14..d382268 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 _0xfa10=['bluebird','request-promise','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x582ffc,_0xe6c9f){var _0x54d111=function(_0x41b017){while(--_0x41b017){_0x582ffc['push'](_0x582ffc['shift']());}};_0x54d111(++_0xe6c9f);}(_0xfa10,0x1cf));var _0x0fa1=function(_0x4763f8,_0x252cf3){_0x4763f8=_0x4763f8-0x0;var _0x3b254a=_0xfa10[_0x4763f8];return _0x3b254a;};'use strict';var _=require(_0x0fa1('0x0'));var util=require(_0x0fa1('0x1'));var logger=require(_0x0fa1('0x2'))(_0x0fa1('0x3'));var moment=require(_0x0fa1('0x4'));var BPromise=require(_0x0fa1('0x5'));var rp=require(_0x0fa1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fa1('0x7'));var config=require(_0x0fa1('0x8'));var attributes=require('./automation.attributes');module[_0x0fa1('0x9')]=function(_0xf2571c,_0x42eeee){return _0xf2571c[_0x0fa1('0xa')](_0x0fa1('0xb'),attributes,{'tableName':_0x0fa1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb47=['exports','Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb47,0xab));var _0x7eb4=function(_0x43185e,_0xef8549){_0x43185e=_0x43185e-0x0;var _0x34350e=_0xeb47[_0x43185e];return _0x34350e;};'use strict';var _=require(_0x7eb4('0x0'));var util=require(_0x7eb4('0x1'));var logger=require(_0x7eb4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7eb4('0x3'));var rp=require(_0x7eb4('0x4'));var fs=require('fs');var path=require(_0x7eb4('0x5'));var rimraf=require(_0x7eb4('0x6'));var config=require(_0x7eb4('0x7'));var attributes=require(_0x7eb4('0x8'));module[_0x7eb4('0x9')]=function(_0x222c39,_0x1b1e32){return _0x222c39['define'](_0x7eb4('0xa'),attributes,{'tableName':_0x7eb4('0xb'),'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 8add508..bd5bd9b 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 _0x9a1b=['info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1feab9,_0x71d303){var _0x1c4328=function(_0x3244f2){while(--_0x3244f2){_0x1feab9['push'](_0x1feab9['shift']());}};_0x1c4328(++_0x71d303);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x4867bc,_0x15b914){_0x4867bc=_0x4867bc-0x0;var _0x5c3ceb=_0x9a1b[_0x4867bc];return _0x5c3ceb;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9a1('0x1'));var fs=require('fs');var Redis=require(_0xb9a1('0x2'));var db=require(_0xb9a1('0x3'))['db'];var utils=require(_0xb9a1('0x4'));var logger=require('../../config/logger')(_0xb9a1('0x5'));var config=require(_0xb9a1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb9a1('0x7')][_0xb9a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x233810,_0x5c0924,_0x267773){return new BPromise(function(_0x36334d,_0x404275){return client[_0xb9a1('0x9')](_0x233810,_0x267773)[_0xb9a1('0xa')](function(_0x5e70af){logger['info'](_0xb9a1('0xb'),_0x5c0924,_0xb9a1('0xc'));logger[_0xb9a1('0xd')](_0xb9a1('0xe'),_0x5c0924,_0xb9a1('0xc'),JSON[_0xb9a1('0xf')](_0x5e70af));if(_0x5e70af[_0xb9a1('0x10')]){if(_0x5e70af[_0xb9a1('0x10')]['code']===0x1f4){logger['error'](_0xb9a1('0xb'),_0x5c0924,_0x5e70af[_0xb9a1('0x10')]['message']);return _0x404275(_0x5e70af[_0xb9a1('0x10')]['message']);}logger[_0xb9a1('0x10')](_0xb9a1('0xb'),_0x5c0924,_0x5e70af[_0xb9a1('0x10')]['message']);return _0x36334d(_0x5e70af[_0xb9a1('0x10')][_0xb9a1('0x11')]);}else{logger[_0xb9a1('0x12')]('Automation,\x20%s,\x20%s',_0x5c0924,_0xb9a1('0xc'));_0x36334d(_0x5e70af[_0xb9a1('0x13')][_0xb9a1('0x11')]);}})['catch'](function(_0x20c96e){logger[_0xb9a1('0x10')]('Automation,\x20%s,\x20%s',_0x5c0924,_0x20c96e);_0x404275(_0x20c96e);});});} \ No newline at end of file +var _0xbc95=['stringify','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','http','request','then','info','Automation,\x20%s,\x20%s','debug'];(function(_0x115d1f,_0xc8262){var _0x357a9e=function(_0x510cb1){while(--_0x510cb1){_0x115d1f['push'](_0x115d1f['shift']());}};_0x357a9e(++_0xc8262);}(_0xbc95,0x1f4));var _0x5bc9=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0xbc95[_0x32f26d];return _0x5d9ddc;};'use strict';var _=require(_0x5bc9('0x0'));var util=require(_0x5bc9('0x1'));var moment=require(_0x5bc9('0x2'));var BPromise=require(_0x5bc9('0x3'));var rs=require(_0x5bc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bc9('0x5'))(_0x5bc9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5bc9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c02e9,_0x2fb0a2,_0x4bdc20){return new BPromise(function(_0x49ab1a,_0x6cc9f1){return client[_0x5bc9('0x8')](_0x5c02e9,_0x4bdc20)[_0x5bc9('0x9')](function(_0x357d27){logger[_0x5bc9('0xa')](_0x5bc9('0xb'),_0x2fb0a2,'request\x20sent');logger[_0x5bc9('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2fb0a2,'request\x20sent',JSON[_0x5bc9('0xd')](_0x357d27));if(_0x357d27['error']){if(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0xf')]===0x1f4){logger[_0x5bc9('0xe')](_0x5bc9('0xb'),_0x2fb0a2,_0x357d27[_0x5bc9('0xe')]['message']);return _0x6cc9f1(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0x10')]);}logger['error'](_0x5bc9('0xb'),_0x2fb0a2,_0x357d27['error']['message']);return _0x49ab1a(_0x357d27[_0x5bc9('0xe')][_0x5bc9('0x10')]);}else{logger[_0x5bc9('0xa')](_0x5bc9('0xb'),_0x2fb0a2,_0x5bc9('0x11'));_0x49ab1a(_0x357d27[_0x5bc9('0x12')]['message']);}})['catch'](function(_0x617dad){logger[_0x5bc9('0xe')]('Automation,\x20%s,\x20%s',_0x2fb0a2,_0x617dad);_0x6cc9f1(_0x617dad);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index db17b7f..faeec2f 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 _0xc818=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions'];(function(_0x5c9646,_0x3e04a9){var _0x5c19b5=function(_0x1c095b){while(--_0x1c095b){_0x5c9646['push'](_0x5c9646['shift']());}};_0x5c19b5(++_0x3e04a9);}(_0xc818,0x1e3));var _0x8c81=function(_0x1b617a,_0x5ec7ed){_0x1b617a=_0x1b617a-0x0;var _0x3a6d8a=_0xc818[_0x1b617a];return _0x3a6d8a;};'use strict';var multer=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var timeout=require(_0x8c81('0x3'));var express=require('express');var router=express[_0x8c81('0x4')]();var fs_extra=require(_0x8c81('0x5'));var auth=require(_0x8c81('0x6'));var interaction=require(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var controller=require(_0x8c81('0x9'));router[_0x8c81('0xa')]('/',auth['isAuthenticated'](),controller[_0x8c81('0xb')]);router[_0x8c81('0xa')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['show']);router[_0x8c81('0xa')](_0x8c81('0xe'),auth[_0x8c81('0xd')](),controller[_0x8c81('0xf')]);router[_0x8c81('0xa')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller['getActions']);router[_0x8c81('0x11')]('/',auth[_0x8c81('0xd')](),controller[_0x8c81('0x12')]);router[_0x8c81('0x11')]('/:id/conditions',auth[_0x8c81('0xd')](),controller[_0x8c81('0x13')]);router[_0x8c81('0x11')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x14')]);router[_0x8c81('0x15')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['update']);router['delete'](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x16')]);module[_0x8c81('0x17')]=router; \ No newline at end of file +var _0x777f=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put'];(function(_0x5041a5,_0x3890be){var _0x37a8a7=function(_0x326f9c){while(--_0x326f9c){_0x5041a5['push'](_0x5041a5['shift']());}};_0x37a8a7(++_0x3890be);}(_0x777f,0x9f));var _0xf777=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x777f[_0x22eb96];return _0x5e1adf;};'use strict';var multer=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var path=require(_0xf777('0x2'));var timeout=require(_0xf777('0x3'));var express=require(_0xf777('0x4'));var router=express[_0xf777('0x5')]();var fs_extra=require(_0xf777('0x6'));var auth=require(_0xf777('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf777('0x8'));var controller=require(_0xf777('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf777('0xa')](_0xf777('0xb'),auth[_0xf777('0xc')](),controller[_0xf777('0xd')]);router[_0xf777('0xa')](_0xf777('0xe'),auth[_0xf777('0xc')](),controller[_0xf777('0xf')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0xf777('0x10')]);router[_0xf777('0x11')]('/',auth['isAuthenticated'](),controller[_0xf777('0x12')]);router[_0xf777('0x11')](_0xf777('0xe'),auth['isAuthenticated'](),controller[_0xf777('0x13')]);router[_0xf777('0x11')](_0xf777('0x14'),auth[_0xf777('0xc')](),controller[_0xf777('0x15')]);router[_0xf777('0x16')](_0xf777('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf777('0x17')]('/:id',auth[_0xf777('0xc')](),controller[_0xf777('0x18')]);module[_0xf777('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 25a9cb3..6fb2f8a 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 _0x542b=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting'];(function(_0x2a56bc,_0x25761d){var _0x313c8c=function(_0x498717){while(--_0x498717){_0x2a56bc['push'](_0x2a56bc['shift']());}};_0x313c8c(++_0x25761d);}(_0x542b,0x11b));var _0xb542=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x542b[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0xb542('0x0'));module[_0xb542('0x1')]={'name':{'type':Sequelize[_0xb542('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb542('0x3')](_0xb542('0x4')),'allowNull':![],'defaultValue':_0xb542('0x4')},'description':{'type':Sequelize[_0xb542('0x2')]},'active':{'type':Sequelize[_0xb542('0x5')],'defaultValue':0x0,'comment':_0xb542('0x6')},'limitCalls':{'type':Sequelize[_0xb542('0x7')](0x4)[_0xb542('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb542('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb542('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xb542('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb542('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb542('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb542('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'defaultValue':0x3,'comment':_0xb542('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb542('0x7')](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb542('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb542('0x2')],'defaultValue':_0xb542('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xb542('0x10'),_0xb542('0x11'),_0xb542('0x12')),'defaultValue':_0xb542('0x10')},'dialAMDActive':{'type':Sequelize[_0xb542('0x5')],'defaultValue':0x0,'comment':_0xb542('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xb542('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xb542('0x7')](0x9)[_0xb542('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb542('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb542('0x7')](0x9)[_0xb542('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb542('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb542('0x7')](0x9)[_0xb542('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb542('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb542('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb542('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb542('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb542('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb542('0x7')](0x9)[_0xb542('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb542('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xb542('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb542('0x7')](0x9)[_0xb542('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb542('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb542('0x3')](_0xb542('0x1b'),_0xb542('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb542('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xb542('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb542('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb542('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb542('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xb542('0x7')](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb542('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)[_0xb542('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb542('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb542('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb542('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb542('0x7')](0x5)[_0xb542('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb542('0x25')}}; \ No newline at end of file +var _0x558c=['#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','never','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x19597b,_0x57a8e6){var _0x10d259=function(_0x48979b){while(--_0x48979b){_0x19597b['push'](_0x19597b['shift']());}};_0x10d259(++_0x57a8e6);}(_0x558c,0xbc));var _0xc558=function(_0xe4a6f0,_0x55ff14){_0xe4a6f0=_0xe4a6f0-0x0;var _0x580d29=_0x558c[_0xe4a6f0];return _0x580d29;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc558('0x0')],'unique':_0xc558('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc558('0x2')](_0xc558('0x3')),'allowNull':![],'defaultValue':_0xc558('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc558('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xc558('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc558('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc558('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc558('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc558('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc558('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc558('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc558('0x0')],'defaultValue':_0xc558('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc558('0xf'),_0xc558('0x10'),'onlyIfOpen'),'defaultValue':_0xc558('0xf')},'dialAMDActive':{'type':Sequelize[_0xc558('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc558('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc558('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc558('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc558('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc558('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc558('0x5')](0x5)[_0xc558('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc558('0x5')](0x9)[_0xc558('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc558('0x14')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xc558('0x15')),'defaultValue':_0xc558('0x16')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc558('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc558('0x17')},'dialCutDigit':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc558('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc558('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)[_0xc558('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc558('0x1a')},'dialDropRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)[_0xc558('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc558('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)[_0xc558('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc558('0x5')](0x3)[_0xc558('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc558('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc558('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 14e5f76..a3ffc60 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 _0x1c19=['autoAssociation','clone','params','options','omit','updatedAt','createdAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','ListId','field','phone','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','NOW()','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','map','Campaign','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1c19,0x1f2));var _0x91c1=function(_0x2e4ee7,_0x4bdc11){_0x2e4ee7=_0x2e4ee7-0x0;var _0x49e2e8=_0x1c19[_0x2e4ee7];return _0x49e2e8;};'use strict';var emlformat=require(_0x91c1('0x0'));var rimraf=require(_0x91c1('0x1'));var zipdir=require(_0x91c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91c1('0x3'));var moment=require(_0x91c1('0x4'));var BPromise=require(_0x91c1('0x5'));var Mustache=require('mustache');var util=require(_0x91c1('0x6'));var path=require('path');var sox=require(_0x91c1('0x7'));var csv=require(_0x91c1('0x8'));var ejs=require(_0x91c1('0x9'));var fs=require('fs');var fs_extra=require(_0x91c1('0xa'));var _=require(_0x91c1('0xb'));var squel=require(_0x91c1('0xc'));var crypto=require(_0x91c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x91c1('0x8'));var querystring=require(_0x91c1('0xe'));var Papa=require(_0x91c1('0xf'));var Redis=require(_0x91c1('0x10'));var authService=require(_0x91c1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x91c1('0x12'));var utils=require(_0x91c1('0x13'));var config=require(_0x91c1('0x14'));var licenseUtil=require(_0x91c1('0x15'));var db=require(_0x91c1('0x16'))['db'];function respondWithStatusCode(_0x521049,_0x4f5cdb){_0x4f5cdb=_0x4f5cdb||0xcc;return function(_0x5f482a){if(_0x5f482a){return _0x521049[_0x91c1('0x17')](_0x4f5cdb);}return _0x521049[_0x91c1('0x18')](_0x4f5cdb)[_0x91c1('0x19')]();};}function respondWithResult(_0x3af3c9,_0x17a19f){_0x17a19f=_0x17a19f||0xc8;return function(_0x410149){if(_0x410149){return _0x3af3c9[_0x91c1('0x18')](_0x17a19f)['json'](_0x410149);}};}function respondWithFilteredResult(_0x471730,_0xc0004f){return function(_0x5cabd3){if(_0x5cabd3){var _0x24b040=typeof _0xc0004f[_0x91c1('0x1a')]===_0x91c1('0x1b')&&typeof _0xc0004f[_0x91c1('0x1c')]==='undefined';var _0x4675d2=_0x5cabd3[_0x91c1('0x1d')];var _0x46c2c8=_0x24b040?0x0:_0xc0004f[_0x91c1('0x1a')];var _0x2837a4=_0x24b040?_0x5cabd3[_0x91c1('0x1d')]:_0xc0004f[_0x91c1('0x1a')]+_0xc0004f[_0x91c1('0x1c')];var _0x258e9d;if(_0x2837a4>=_0x4675d2){_0x2837a4=_0x4675d2;_0x258e9d=0xc8;}else{_0x258e9d=0xce;}_0x471730[_0x91c1('0x18')](_0x258e9d);return _0x471730[_0x91c1('0x1e')](_0x91c1('0x1f'),_0x46c2c8+'-'+_0x2837a4+'/'+_0x4675d2)['json'](_0x5cabd3);}return null;};}function patchUpdates(_0x362de8){return function(_0x3856e6){try{jsonpatch[_0x91c1('0x20')](_0x3856e6,_0x362de8,!![]);}catch(_0x147917){return BPromise['reject'](_0x147917);}return _0x3856e6[_0x91c1('0x21')]();};}function saveUpdates(_0x257db8,_0x3c4318){return function(_0x5bc24e){if(_0x5bc24e){return _0x5bc24e['update'](_0x257db8)['then'](function(_0x4bfbac){return _0x4bfbac;});}return null;};}function removeEntity(_0x1fc6c0,_0x4f77d5){return function(_0x2c8246){if(_0x2c8246){return _0x2c8246[_0x91c1('0x22')]()[_0x91c1('0x23')](function(){var _0x1b8def=_0x2c8246[_0x91c1('0x24')]({'plain':!![]});var _0x378b84=_0x91c1('0x25');return db[_0x91c1('0x26')][_0x91c1('0x22')]({'where':{'type':_0x378b84,'resourceId':_0x1b8def['id']}})[_0x91c1('0x23')](function(){return _0x2c8246;});})[_0x91c1('0x23')](function(){_0x1fc6c0['status'](0xcc)[_0x91c1('0x19')]();});}};}function handleEntityNotFound(_0x200719,_0x2462df){return function(_0x52f07f){if(!_0x52f07f){_0x200719[_0x91c1('0x17')](0x194);}return _0x52f07f;};}function handleError(_0x92847,_0x54541a){_0x54541a=_0x54541a||0x1f4;return function(_0x5351f3){logger[_0x91c1('0x27')](_0x5351f3[_0x91c1('0x28')]);if(_0x5351f3[_0x91c1('0x29')]){delete _0x5351f3[_0x91c1('0x29')];}_0x92847[_0x91c1('0x18')](_0x54541a)['send'](_0x5351f3);};}exports['index']=function(_0x445657,_0x4c7ead){var _0x426b95={},_0x1a9fbf={},_0x4f0089={'count':0x0,'rows':[]};var _0x92b238=_[_0x91c1('0x2a')](db[_0x91c1('0x2b')][_0x91c1('0x2c')],function(_0x4c227c){return{'name':_0x4c227c['fieldName'],'type':_0x4c227c[_0x91c1('0x2d')]['key']};});_0x1a9fbf[_0x91c1('0x2e')]=_['map'](_0x92b238,_0x91c1('0x29'));_0x1a9fbf[_0x91c1('0x2f')]=_[_0x91c1('0x30')](_0x445657[_0x91c1('0x2f')]);_0x1a9fbf[_0x91c1('0x31')]=_[_0x91c1('0x32')](_0x1a9fbf['model'],_0x1a9fbf[_0x91c1('0x2f')]);_0x426b95[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x1a9fbf[_0x91c1('0x2e')],qs[_0x91c1('0x34')](_0x445657[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x426b95[_0x91c1('0x33')]=_0x426b95[_0x91c1('0x33')][_0x91c1('0x35')]?_0x426b95[_0x91c1('0x33')]:_0x1a9fbf[_0x91c1('0x2e')];if(!_0x445657[_0x91c1('0x2f')]['hasOwnProperty']('nolimit')){_0x426b95[_0x91c1('0x1c')]=qs[_0x91c1('0x1c')](_0x445657[_0x91c1('0x2f')][_0x91c1('0x1c')]);_0x426b95[_0x91c1('0x1a')]=qs[_0x91c1('0x1a')](_0x445657['query'][_0x91c1('0x1a')]);}_0x426b95[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x445657[_0x91c1('0x2f')][_0x91c1('0x37')]);_0x426b95[_0x91c1('0x38')]=qs[_0x91c1('0x31')](_[_0x91c1('0x39')](_0x445657[_0x91c1('0x2f')],_0x1a9fbf[_0x91c1('0x31')]),_0x92b238);if(_0x445657['query'][_0x91c1('0x3a')]){_0x426b95['where']=_['merge'](_0x426b95[_0x91c1('0x38')],{'$or':_[_0x91c1('0x2a')](_0x92b238,function(_0x2a6688){if(_0x2a6688[_0x91c1('0x2d')]!==_0x91c1('0x3b')){var _0x3c8631={};_0x3c8631[_0x2a6688[_0x91c1('0x29')]]={'$like':'%'+_0x445657['query'][_0x91c1('0x3a')]+'%'};return _0x3c8631;}})});}_0x426b95=_['merge']({},_0x426b95,_0x445657['options']);var _0x4a6c7c={'where':_0x426b95[_0x91c1('0x38')]};return db[_0x91c1('0x2b')][_0x91c1('0x1d')](_0x4a6c7c)[_0x91c1('0x23')](function(_0x29b534){_0x4f0089[_0x91c1('0x1d')]=_0x29b534;if(_0x445657['query'][_0x91c1('0x3c')]){_0x426b95[_0x91c1('0x3d')]=[{'all':!![]}];}return db['Campaign'][_0x91c1('0x3e')](_0x426b95);})[_0x91c1('0x23')](function(_0x1809bf){_0x4f0089[_0x91c1('0x3f')]=_0x1809bf;return _0x4f0089;})[_0x91c1('0x23')](respondWithFilteredResult(_0x4c7ead,_0x426b95))[_0x91c1('0x40')](handleError(_0x4c7ead,null));};exports[_0x91c1('0x41')]=function(_0x37478e,_0x1aba2e){var _0x46e8df={'raw':![],'where':{'id':_0x37478e['params']['id']}},_0x53c1af={};_0x53c1af['model']=_['keys'](db[_0x91c1('0x2b')][_0x91c1('0x2c')]);_0x53c1af[_0x91c1('0x2f')]=_['keys'](_0x37478e[_0x91c1('0x2f')]);_0x53c1af[_0x91c1('0x31')]=_[_0x91c1('0x32')](_0x53c1af['model'],_0x53c1af[_0x91c1('0x2f')]);_0x46e8df[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x53c1af[_0x91c1('0x2e')],qs['fields'](_0x37478e[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x46e8df[_0x91c1('0x33')]=_0x46e8df['attributes'][_0x91c1('0x35')]?_0x46e8df[_0x91c1('0x33')]:_0x53c1af['model'];if(_0x37478e[_0x91c1('0x2f')]['includeAll']){_0x46e8df[_0x91c1('0x3d')]=[{'all':!![]}];}_0x46e8df=_[_0x91c1('0x42')]({},_0x46e8df,_0x37478e['options']);return db['Campaign']['find'](_0x46e8df)[_0x91c1('0x23')](handleEntityNotFound(_0x1aba2e,null))[_0x91c1('0x23')](respondWithResult(_0x1aba2e,null))['catch'](handleError(_0x1aba2e,null));};exports['create']=function(_0x8ee110,_0x4253e5){return db[_0x91c1('0x2b')][_0x91c1('0x43')](_0x8ee110[_0x91c1('0x44')],{})[_0x91c1('0x23')](function(_0x13c884){var _0x3c9d69=_0x8ee110[_0x91c1('0x45')][_0x91c1('0x24')]({'plain':!![]});if(!_0x3c9d69)throw new Error(_0x91c1('0x46'));if(_0x3c9d69['role']===_0x91c1('0x45')){var _0x3f00e5=_0x13c884['get']({'plain':!![]});var _0x397450=_0x91c1('0x25');return db[_0x91c1('0x47')][_0x91c1('0x48')]({'where':{'name':_0x397450,'userProfileId':_0x3c9d69[_0x91c1('0x49')]},'raw':!![]})[_0x91c1('0x23')](function(_0x3b0bc8){if(_0x3b0bc8&&_0x3b0bc8[_0x91c1('0x4a')]===0x0){return db[_0x91c1('0x26')][_0x91c1('0x43')]({'name':_0x3f00e5[_0x91c1('0x29')],'resourceId':_0x3f00e5['id'],'type':_0x3b0bc8[_0x91c1('0x29')],'sectionId':_0x3b0bc8['id']},{})[_0x91c1('0x23')](function(){return _0x13c884;});}else{return _0x13c884;}})[_0x91c1('0x40')](function(_0x56113e){logger[_0x91c1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56113e);throw _0x56113e;});}return _0x13c884;})[_0x91c1('0x23')](respondWithResult(_0x4253e5,0xc9))[_0x91c1('0x40')](handleError(_0x4253e5,null));};exports[_0x91c1('0x4b')]=function(_0x3b09dd,_0x34191a){var _0x3c8787={'where':{'id':_0x3b09dd[_0x91c1('0x4c')]['id']}},_0x27849c={};_0x27849c[_0x91c1('0x2e')]=_[_0x91c1('0x30')](db[_0x91c1('0x2b')][_0x91c1('0x2c')]);_0x3c8787[_0x91c1('0x33')]=_['intersection'](_0x27849c['model'],qs[_0x91c1('0x34')](_0x3b09dd[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x3c8787[_0x91c1('0x33')]=_0x3c8787[_0x91c1('0x33')][_0x91c1('0x35')]?_0x3c8787[_0x91c1('0x33')]:_0x27849c[_0x91c1('0x2e')];if(_0x3b09dd[_0x91c1('0x2f')][_0x91c1('0x3c')]){_0x3c8787['include']=[{'all':!![]}];}_0x3c8787=_[_0x91c1('0x42')]({},_0x3c8787,_0x3b09dd[_0x91c1('0x4d')]);return db[_0x91c1('0x2b')][_0x91c1('0x48')](_0x3c8787)[_0x91c1('0x23')](handleEntityNotFound(_0x34191a,null))[_0x91c1('0x23')](function(_0x56f3a5){if(_0x56f3a5){var _0x1a6180=_0x56f3a5[_0x91c1('0x24')]({'plain':!![]});_0x1a6180=qs[_0x91c1('0x4e')](_0x1a6180,['id','createdAt',_0x91c1('0x4f')]);_0x3b09dd[_0x91c1('0x44')]=_['omit'](_0x3b09dd[_0x91c1('0x44')],['id',_0x91c1('0x50'),_0x91c1('0x4f')]);return db[_0x91c1('0x2b')][_0x91c1('0x43')](_[_0x91c1('0x42')](_0x1a6180,_0x3b09dd[_0x91c1('0x44')]),{'include':_0x3b09dd[_0x91c1('0x2f')][_0x91c1('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x1512e1){var _0x52e0b7=_0x3b09dd['user']['get']({'plain':!![]});if(!_0x52e0b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52e0b7[_0x91c1('0x51')]==='user'){var _0x4398c2=_0x1512e1[_0x91c1('0x24')]({'plain':!![]});var _0x3969f9=_0x91c1('0x25');return db[_0x91c1('0x47')][_0x91c1('0x48')]({'where':{'name':_0x3969f9,'userProfileId':_0x52e0b7[_0x91c1('0x49')]},'raw':!![]})[_0x91c1('0x23')](function(_0x11f429){if(_0x11f429&&_0x11f429['autoAssociation']===0x0){return db[_0x91c1('0x26')][_0x91c1('0x43')]({'name':_0x4398c2['name'],'resourceId':_0x4398c2['id'],'type':_0x11f429['name'],'sectionId':_0x11f429['id']},{})['then'](function(){return _0x1512e1;});}else{return _0x1512e1;}})[_0x91c1('0x40')](function(_0x5e4896){logger['error'](_0x91c1('0x52'),_0x5e4896);throw _0x5e4896;});}return _0x1512e1;});}})[_0x91c1('0x23')](respondWithResult(_0x34191a,0xc9))[_0x91c1('0x40')](handleError(_0x34191a,null));};exports[_0x91c1('0x53')]=function(_0x154d47,_0x529581){if(_0x154d47[_0x91c1('0x44')]['id']){delete _0x154d47[_0x91c1('0x44')]['id'];}return db[_0x91c1('0x2b')][_0x91c1('0x48')]({'where':{'id':_0x154d47[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x529581,null))[_0x91c1('0x23')](saveUpdates(_0x154d47[_0x91c1('0x44')],null))[_0x91c1('0x23')](respondWithResult(_0x529581,null))[_0x91c1('0x40')](handleError(_0x529581,null));};exports[_0x91c1('0x22')]=function(_0x27f456,_0x4fe43c){return db[_0x91c1('0x2b')][_0x91c1('0x48')]({'where':{'id':_0x27f456['params']['id']}})['then'](handleEntityNotFound(_0x4fe43c,null))[_0x91c1('0x23')](removeEntity(_0x4fe43c,null))[_0x91c1('0x40')](handleError(_0x4fe43c,null));};exports['getHoppers']=function(_0x1f0470,_0x32ce96,_0x3e931d){var _0xa2f653={'raw':!![],'where':{}};var _0x3c3502={};var _0xf0d28c={'count':0x0,'rows':[]};return db[_0x91c1('0x2b')][_0x91c1('0x54')]({'where':{'id':_0x1f0470[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x32ce96,null))[_0x91c1('0x23')](function(_0x4c39d2){if(_0x4c39d2){_0x3c3502['model']=_[_0x91c1('0x30')](db[_0x91c1('0x55')]['rawAttributes']);_0x3c3502[_0x91c1('0x2f')]=_[_0x91c1('0x30')](_0x1f0470[_0x91c1('0x2f')]);_0x3c3502[_0x91c1('0x31')]=_['intersection'](_0x3c3502[_0x91c1('0x2e')],_0x3c3502[_0x91c1('0x2f')]);_0xa2f653[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x3c3502[_0x91c1('0x2e')],qs[_0x91c1('0x34')](_0x1f0470['query']['fields']));_0xa2f653['attributes']=_0xa2f653['attributes'][_0x91c1('0x35')]?_0xa2f653['attributes']:_0x3c3502[_0x91c1('0x2e')];if(!_0x1f0470[_0x91c1('0x2f')][_0x91c1('0x56')](_0x91c1('0x57'))){_0xa2f653[_0x91c1('0x1c')]=qs[_0x91c1('0x1c')](_0x1f0470['query'][_0x91c1('0x1c')]);_0xa2f653[_0x91c1('0x1a')]=qs[_0x91c1('0x1a')](_0x1f0470[_0x91c1('0x2f')][_0x91c1('0x1a')]);}_0xa2f653[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x1f0470['query'][_0x91c1('0x37')]);_0xa2f653['where']=qs[_0x91c1('0x31')](_[_0x91c1('0x39')](_0x1f0470[_0x91c1('0x2f')],_0x3c3502[_0x91c1('0x31')]));_0xa2f653[_0x91c1('0x38')][_0x91c1('0x58')]=_0x4c39d2['id'];if(_0x1f0470[_0x91c1('0x2f')][_0x91c1('0x3a')]){_0xa2f653[_0x91c1('0x38')]=_['merge'](_0xa2f653[_0x91c1('0x38')],{'$or':_[_0x91c1('0x2a')](_0xa2f653[_0x91c1('0x33')],function(_0x18425c){var _0x5c253a={};_0x5c253a[_0x18425c]={'$like':'%'+_0x1f0470[_0x91c1('0x2f')]['filter']+'%'};return _0x5c253a;})});}_0xa2f653=_[_0x91c1('0x42')]({},_0xa2f653,_0x1f0470[_0x91c1('0x4d')]);return db[_0x91c1('0x55')][_0x91c1('0x1d')]({'where':_0xa2f653['where']})['then'](function(_0x102166){_0xf0d28c['count']=_0x102166;if(_0x1f0470[_0x91c1('0x2f')]['includeAll']){_0xa2f653[_0x91c1('0x3d')]=[{'all':!![]}];}return db[_0x91c1('0x55')][_0x91c1('0x3e')](_0xa2f653);})[_0x91c1('0x23')](function(_0x38adcf){_0xf0d28c[_0x91c1('0x3f')]=_0x38adcf;return _0xf0d28c;});}})[_0x91c1('0x23')](respondWithFilteredResult(_0x32ce96,_0xa2f653))['catch'](handleError(_0x32ce96,null));};exports[_0x91c1('0x59')]=function(_0x202372,_0x5422f0,_0x2fcf6c){var _0x3032c5={'raw':!![],'where':{}};var _0x57c751={};var _0x628102={'count':0x0,'rows':[]};return db[_0x91c1('0x2b')][_0x91c1('0x54')]({'where':{'id':_0x202372[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x5422f0,null))[_0x91c1('0x23')](function(_0x4b8242){if(_0x4b8242){_0x57c751[_0x91c1('0x2e')]=_[_0x91c1('0x30')](db['CmHopperHistory'][_0x91c1('0x2c')]);_0x57c751[_0x91c1('0x2f')]=_[_0x91c1('0x30')](_0x202372['query']);_0x57c751[_0x91c1('0x31')]=_[_0x91c1('0x32')](_0x57c751[_0x91c1('0x2e')],_0x57c751[_0x91c1('0x2f')]);_0x3032c5[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x57c751[_0x91c1('0x2e')],qs['fields'](_0x202372[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x3032c5[_0x91c1('0x33')]=_0x3032c5[_0x91c1('0x33')][_0x91c1('0x35')]?_0x3032c5[_0x91c1('0x33')]:_0x57c751['model'];if(!_0x202372[_0x91c1('0x2f')][_0x91c1('0x56')](_0x91c1('0x57'))){_0x3032c5['limit']=qs[_0x91c1('0x1c')](_0x202372['query'][_0x91c1('0x1c')]);_0x3032c5[_0x91c1('0x1a')]=qs['offset'](_0x202372[_0x91c1('0x2f')][_0x91c1('0x1a')]);}_0x3032c5[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x202372['query'][_0x91c1('0x37')]);_0x3032c5['where']=qs['filters'](_[_0x91c1('0x39')](_0x202372[_0x91c1('0x2f')],_0x57c751[_0x91c1('0x31')]));_0x3032c5['where'][_0x91c1('0x58')]=_0x4b8242['id'];if(_0x202372[_0x91c1('0x2f')][_0x91c1('0x3a')]){_0x3032c5['where']=_['merge'](_0x3032c5[_0x91c1('0x38')],{'$or':_[_0x91c1('0x2a')](_0x3032c5[_0x91c1('0x33')],function(_0x2d63d5){var _0x55f7c4={};_0x55f7c4[_0x2d63d5]={'$like':'%'+_0x202372[_0x91c1('0x2f')]['filter']+'%'};return _0x55f7c4;})});}_0x3032c5=_[_0x91c1('0x42')]({},_0x3032c5,_0x202372[_0x91c1('0x4d')]);return db[_0x91c1('0x5a')][_0x91c1('0x1d')]({'where':_0x3032c5[_0x91c1('0x38')]})[_0x91c1('0x23')](function(_0x24025c){_0x628102[_0x91c1('0x1d')]=_0x24025c;if(_0x202372[_0x91c1('0x2f')][_0x91c1('0x3c')]){_0x3032c5[_0x91c1('0x3d')]=[{'all':!![]}];}return db[_0x91c1('0x5a')][_0x91c1('0x3e')](_0x3032c5);})['then'](function(_0x11ca01){_0x628102[_0x91c1('0x3f')]=_0x11ca01;return _0x628102;});}})[_0x91c1('0x23')](respondWithFilteredResult(_0x5422f0,_0x3032c5))[_0x91c1('0x40')](handleError(_0x5422f0,null));};exports[_0x91c1('0x5b')]=function(_0xe03790,_0x28d64d,_0x5dd9ea){var _0x301a34={'raw':!![],'where':{}};var _0x32d4e6={};var _0x45da6d={'count':0x0,'rows':[]};return db[_0x91c1('0x2b')][_0x91c1('0x54')]({'where':{'id':_0xe03790[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x28d64d,null))[_0x91c1('0x23')](function(_0xdcb7cc){if(_0xdcb7cc){_0x32d4e6[_0x91c1('0x2e')]=_[_0x91c1('0x30')](db[_0x91c1('0x5c')][_0x91c1('0x2c')]);_0x32d4e6[_0x91c1('0x2f')]=_[_0x91c1('0x30')](_0xe03790['query']);_0x32d4e6[_0x91c1('0x31')]=_[_0x91c1('0x32')](_0x32d4e6[_0x91c1('0x2e')],_0x32d4e6[_0x91c1('0x2f')]);_0x301a34[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x32d4e6[_0x91c1('0x2e')],qs[_0x91c1('0x34')](_0xe03790[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x301a34['attributes']=_0x301a34[_0x91c1('0x33')][_0x91c1('0x35')]?_0x301a34[_0x91c1('0x33')]:_0x32d4e6[_0x91c1('0x2e')];if(!_0xe03790[_0x91c1('0x2f')][_0x91c1('0x56')]('nolimit')){_0x301a34[_0x91c1('0x1c')]=qs[_0x91c1('0x1c')](_0xe03790[_0x91c1('0x2f')][_0x91c1('0x1c')]);_0x301a34[_0x91c1('0x1a')]=qs[_0x91c1('0x1a')](_0xe03790[_0x91c1('0x2f')][_0x91c1('0x1a')]);}_0x301a34[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0xe03790['query'][_0x91c1('0x37')]);_0x301a34[_0x91c1('0x38')]=qs[_0x91c1('0x31')](_['pick'](_0xe03790[_0x91c1('0x2f')],_0x32d4e6[_0x91c1('0x31')]));_0x301a34[_0x91c1('0x38')][_0x91c1('0x58')]=_0xdcb7cc['id'];if(_0xe03790['query']['filter']){_0x301a34[_0x91c1('0x38')]=_[_0x91c1('0x42')](_0x301a34[_0x91c1('0x38')],{'$or':_[_0x91c1('0x2a')](_0x301a34[_0x91c1('0x33')],function(_0x354450){var _0x6ec1c={};_0x6ec1c[_0x354450]={'$like':'%'+_0xe03790[_0x91c1('0x2f')][_0x91c1('0x3a')]+'%'};return _0x6ec1c;})});}_0x301a34=_[_0x91c1('0x42')]({},_0x301a34,_0xe03790[_0x91c1('0x4d')]);return db[_0x91c1('0x5c')][_0x91c1('0x1d')]({'where':_0x301a34[_0x91c1('0x38')]})['then'](function(_0x32d8ea){_0x45da6d[_0x91c1('0x1d')]=_0x32d8ea;if(_0xe03790[_0x91c1('0x2f')][_0x91c1('0x3c')]){_0x301a34[_0x91c1('0x3d')]=[{'all':!![]}];}return db[_0x91c1('0x5c')][_0x91c1('0x3e')](_0x301a34);})[_0x91c1('0x23')](function(_0x29611e){_0x45da6d[_0x91c1('0x3f')]=_0x29611e;return _0x45da6d;});}})[_0x91c1('0x23')](respondWithFilteredResult(_0x28d64d,_0x301a34))[_0x91c1('0x40')](handleError(_0x28d64d,null));};exports[_0x91c1('0x5d')]=function(_0x1e9ec9,_0x3c1061,_0x3cfe02){var _0xb3d2d3={'raw':!![],'where':{}};var _0x288d40={};var _0x3e8573={'count':0x0,'rows':[]};return db[_0x91c1('0x2b')][_0x91c1('0x54')]({'where':{'id':_0x1e9ec9['params']['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x3c1061,null))[_0x91c1('0x23')](function(_0x1e4d20){if(_0x1e4d20){_0x288d40[_0x91c1('0x2e')]=_[_0x91c1('0x30')](db[_0x91c1('0x5e')][_0x91c1('0x2c')]);_0x288d40[_0x91c1('0x2f')]=_[_0x91c1('0x30')](_0x1e9ec9[_0x91c1('0x2f')]);_0x288d40[_0x91c1('0x31')]=_['intersection'](_0x288d40[_0x91c1('0x2e')],_0x288d40[_0x91c1('0x2f')]);_0xb3d2d3[_0x91c1('0x33')]=_['intersection'](_0x288d40[_0x91c1('0x2e')],qs['fields'](_0x1e9ec9['query'][_0x91c1('0x34')]));_0xb3d2d3['attributes']=_0xb3d2d3[_0x91c1('0x33')][_0x91c1('0x35')]?_0xb3d2d3[_0x91c1('0x33')]:_0x288d40[_0x91c1('0x2e')];if(!_0x1e9ec9[_0x91c1('0x2f')][_0x91c1('0x56')](_0x91c1('0x57'))){_0xb3d2d3['limit']=qs[_0x91c1('0x1c')](_0x1e9ec9[_0x91c1('0x2f')][_0x91c1('0x1c')]);_0xb3d2d3['offset']=qs['offset'](_0x1e9ec9[_0x91c1('0x2f')][_0x91c1('0x1a')]);}_0xb3d2d3[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x1e9ec9[_0x91c1('0x2f')]['sort']);_0xb3d2d3[_0x91c1('0x38')]=qs[_0x91c1('0x31')](_[_0x91c1('0x39')](_0x1e9ec9['query'],_0x288d40[_0x91c1('0x31')]));_0xb3d2d3[_0x91c1('0x38')][_0x91c1('0x58')]=_0x1e4d20['id'];if(_0x1e9ec9[_0x91c1('0x2f')][_0x91c1('0x3a')]){_0xb3d2d3[_0x91c1('0x38')]=_[_0x91c1('0x42')](_0xb3d2d3[_0x91c1('0x38')],{'$or':_[_0x91c1('0x2a')](_0xb3d2d3['attributes'],function(_0x39ec2b){var _0x50a175={};_0x50a175[_0x39ec2b]={'$like':'%'+_0x1e9ec9[_0x91c1('0x2f')]['filter']+'%'};return _0x50a175;})});}_0xb3d2d3=_[_0x91c1('0x42')]({},_0xb3d2d3,_0x1e9ec9[_0x91c1('0x4d')]);return db[_0x91c1('0x5e')][_0x91c1('0x1d')]({'where':_0xb3d2d3[_0x91c1('0x38')]})['then'](function(_0x2717bd){_0x3e8573['count']=_0x2717bd;if(_0x1e9ec9[_0x91c1('0x2f')][_0x91c1('0x3c')]){_0xb3d2d3['include']=[{'all':!![]}];}return db[_0x91c1('0x5e')][_0x91c1('0x3e')](_0xb3d2d3);})[_0x91c1('0x23')](function(_0x323786){_0x3e8573[_0x91c1('0x3f')]=_0x323786;return _0x3e8573;});}})[_0x91c1('0x23')](respondWithFilteredResult(_0x3c1061,_0xb3d2d3))['catch'](handleError(_0x3c1061,null));};exports[_0x91c1('0x5f')]=function(_0x4b47f4,_0x41ae20,_0x3efef6){var _0x2c25c7={};var _0x29804e={};var _0x1e0cd1;var _0x32500e;return db[_0x91c1('0x2b')][_0x91c1('0x54')]({'where':{'id':_0x4b47f4[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x41ae20,null))['then'](function(_0x378fc4){if(_0x378fc4){_0x1e0cd1=_0x378fc4;_0x29804e['model']=_[_0x91c1('0x30')](db[_0x91c1('0x60')]['rawAttributes']);_0x29804e['query']=_['keys'](_0x4b47f4[_0x91c1('0x2f')]);_0x29804e[_0x91c1('0x31')]=_[_0x91c1('0x32')](_0x29804e[_0x91c1('0x2e')],_0x29804e[_0x91c1('0x2f')]);_0x2c25c7[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x29804e['model'],qs['fields'](_0x4b47f4[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x2c25c7['attributes']=_0x2c25c7[_0x91c1('0x33')][_0x91c1('0x35')]?_0x2c25c7[_0x91c1('0x33')]:_0x29804e[_0x91c1('0x2e')];_0x2c25c7[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x4b47f4[_0x91c1('0x2f')][_0x91c1('0x37')]);_0x2c25c7[_0x91c1('0x38')]=qs[_0x91c1('0x31')](_[_0x91c1('0x39')](_0x4b47f4['query'],_0x29804e[_0x91c1('0x31')]));if(_0x4b47f4[_0x91c1('0x2f')]['filter']){_0x2c25c7[_0x91c1('0x38')]=_[_0x91c1('0x42')](_0x2c25c7[_0x91c1('0x38')],{'$or':_['map'](_0x2c25c7[_0x91c1('0x33')],function(_0x41a297){var _0x4fee36={};_0x4fee36[_0x41a297]={'$like':'%'+_0x4b47f4[_0x91c1('0x2f')][_0x91c1('0x3a')]+'%'};return _0x4fee36;})});}_0x2c25c7=_[_0x91c1('0x42')]({},_0x2c25c7,_0x4b47f4[_0x91c1('0x4d')]);return _0x1e0cd1['getLists'](_0x2c25c7);}})['then'](function(_0x29ad1c){if(_0x29ad1c){_0x32500e=_0x29ad1c[_0x91c1('0x35')];if(!_0x4b47f4['query']['hasOwnProperty'](_0x91c1('0x57'))){_0x2c25c7[_0x91c1('0x1c')]=qs['limit'](_0x4b47f4[_0x91c1('0x2f')][_0x91c1('0x1c')]);_0x2c25c7[_0x91c1('0x1a')]=qs[_0x91c1('0x1a')](_0x4b47f4[_0x91c1('0x2f')]['offset']);}return _0x1e0cd1[_0x91c1('0x5f')](_0x2c25c7);}})[_0x91c1('0x23')](function(_0x3c7d12){if(_0x3c7d12){return _0x3c7d12?{'count':_0x32500e,'rows':_0x3c7d12}:null;}})['then'](respondWithResult(_0x41ae20,null))[_0x91c1('0x40')](handleError(_0x41ae20,null));};exports['addLists']=function(_0xad304f,_0x129605,_0x58f951){var _0x26d22c,_0x5604db;var _0xf0a8b=[];var _0xed84c9=moment()[_0x91c1('0x61')](_0x91c1('0x62'));return db['Campaign'][_0x91c1('0x48')]({'where':{'id':_0xad304f[_0x91c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x129605,null))[_0x91c1('0x23')](function(_0x14b5d4){if(_0x14b5d4){_0x5604db=_0x14b5d4;return _0x14b5d4[_0x91c1('0x63')](_0xad304f[_0x91c1('0x44')]['ids'],_['omit'](_0xad304f[_0x91c1('0x44')],['ids','id'])||{});}return null;})['spread'](function(_0x2a156c){var _0xaf6e53;var _0x6fc56;_0x26d22c=_0x2a156c||[];var _0x3e5ab2=[];if(_0x2a156c){for(var _0x10cba5=0x0;_0x10cba5<_0x2a156c[_0x91c1('0x35')];_0x10cba5+=0x1){var _0x23b9d3=_0x2a156c[_0x10cba5][_0x91c1('0x24')]({'plain':!![]});_0x5604db[_0x91c1('0x64')]=_0xad304f[_0x91c1('0x44')][_0x91c1('0x64')]?_0xad304f[_0x91c1('0x44')]['dialCheckDuplicateType']:_0x5604db['dialCheckDuplicateType'];switch(_0x5604db[_0x91c1('0x64')]){case _0x91c1('0x65'):_0xaf6e53=squel[_0x91c1('0x66')]()['into'](_0x91c1('0x67'))[_0x91c1('0x68')](['phone','scheduledAt',_0x91c1('0x69'),_0x91c1('0x6a'),_0x91c1('0x58'),_0x91c1('0x50'),_0x91c1('0x4f')],squel['select']()[_0x91c1('0x6b')](_0x91c1('0x6c'),_0x91c1('0x6c'))[_0x91c1('0x6b')]('NOW()',_0x91c1('0x6d'))[_0x91c1('0x6b')]('id','ContactId')[_0x91c1('0x6b')](_0x23b9d3[_0x91c1('0x6e')][_0x91c1('0x6f')](),_0x91c1('0x6a'))[_0x91c1('0x6b')](_0xad304f[_0x91c1('0x4c')]['id'][_0x91c1('0x6f')](),'CampaignId')[_0x91c1('0x6b')]('\x27'+_0xed84c9+'\x27',_0x91c1('0x50'))[_0x91c1('0x6b')]('\x27'+_0xed84c9+'\x27',_0x91c1('0x4f'))[_0x91c1('0x70')](_0x91c1('0x71'))[_0x91c1('0x38')](_0x91c1('0x72'))[_0x91c1('0x38')]('ListId\x20=\x20?',_0x23b9d3['CmListId'][_0x91c1('0x6f')]())[_0x91c1('0x38')](_0x91c1('0x73'))[_0x91c1('0x38')](_0x91c1('0x74'),squel[_0x91c1('0x75')]()[_0x91c1('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0x91c1('0x70')]('cm_hopper_final')['where'](_0x91c1('0x76'),_0xad304f['params']['id'][_0x91c1('0x6f')]()))[_0x91c1('0x38')](_0x91c1('0x74'),squel[_0x91c1('0x75')]()[_0x91c1('0x6b')](_0x91c1('0x77'))[_0x91c1('0x70')](_0x91c1('0x67'))[_0x91c1('0x38')](_0x91c1('0x76'),_0xad304f[_0x91c1('0x4c')]['id'][_0x91c1('0x6f')]())))['toString']();break;case _0x91c1('0x78'):_0xaf6e53=squel['insert']()[_0x91c1('0x79')](_0x91c1('0x67'))[_0x91c1('0x68')]([_0x91c1('0x6c'),_0x91c1('0x6d'),_0x91c1('0x69'),_0x91c1('0x6a'),_0x91c1('0x58'),_0x91c1('0x50'),_0x91c1('0x4f')],squel[_0x91c1('0x75')]()[_0x91c1('0x6b')](_0x91c1('0x6c'),_0x91c1('0x6c'))[_0x91c1('0x6b')](_0x91c1('0x7a'),'scheduledAt')[_0x91c1('0x6b')]('id',_0x91c1('0x69'))[_0x91c1('0x6b')](_0x23b9d3[_0x91c1('0x6e')][_0x91c1('0x6f')](),_0x91c1('0x6a'))[_0x91c1('0x6b')](_0xad304f[_0x91c1('0x4c')]['id'][_0x91c1('0x6f')](),_0x91c1('0x58'))['field']('\x27'+_0xed84c9+'\x27','createdAt')[_0x91c1('0x6b')]('\x27'+_0xed84c9+'\x27',_0x91c1('0x4f'))['from'](_0x91c1('0x71'))[_0x91c1('0x38')](_0x91c1('0x72'))['where']('ListId\x20=\x20?',_0x23b9d3[_0x91c1('0x6e')][_0x91c1('0x6f')]())[_0x91c1('0x38')](_0x91c1('0x73'))[_0x91c1('0x38')](_0x91c1('0x74'),squel[_0x91c1('0x75')]()[_0x91c1('0x6b')](_0x91c1('0x77'))[_0x91c1('0x70')]('cm_hopper')[_0x91c1('0x38')](_0x91c1('0x76'),_0xad304f[_0x91c1('0x4c')]['id'][_0x91c1('0x6f')]())))[_0x91c1('0x6f')]();break;default:_0xaf6e53=squel[_0x91c1('0x66')]()['into'](_0x91c1('0x67'))[_0x91c1('0x68')]([_0x91c1('0x6c'),'scheduledAt',_0x91c1('0x69'),_0x91c1('0x6a'),_0x91c1('0x58'),_0x91c1('0x50'),_0x91c1('0x4f')],squel[_0x91c1('0x75')]()[_0x91c1('0x6b')](_0x91c1('0x6c'),'phone')[_0x91c1('0x6b')](_0x91c1('0x7a'),_0x91c1('0x6d'))['field']('id',_0x91c1('0x69'))['field'](_0x23b9d3['CmListId'][_0x91c1('0x6f')](),_0x91c1('0x6a'))['field'](_0xad304f[_0x91c1('0x4c')]['id']['toString'](),_0x91c1('0x58'))['field']('\x27'+_0xed84c9+'\x27',_0x91c1('0x50'))['field']('\x27'+_0xed84c9+'\x27',_0x91c1('0x4f'))[_0x91c1('0x70')](_0x91c1('0x71'))[_0x91c1('0x38')](_0x91c1('0x72'))[_0x91c1('0x38')](_0x91c1('0x7b'),_0x23b9d3[_0x91c1('0x6e')][_0x91c1('0x6f')]())[_0x91c1('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x91c1('0x6f')]();}_0x6fc56=squel[_0x91c1('0x66')]()[_0x91c1('0x79')](_0x91c1('0x7c'))['fromQuery']([_0x91c1('0x7d'),_0x91c1('0x6d'),_0x91c1('0x6c'),_0x91c1('0x7e'),'createdAt',_0x91c1('0x4f')],squel[_0x91c1('0x75')]()[_0x91c1('0x6b')]('h.id','id')[_0x91c1('0x6b')](_0x91c1('0x7a'),_0x91c1('0x6d'))[_0x91c1('0x6b')](_0x91c1('0x7f'),'phone')[_0x91c1('0x6b')](_0x91c1('0x80'),_0x91c1('0x7e'))[_0x91c1('0x6b')]('\x27'+_0xed84c9+'\x27',_0x91c1('0x50'))['field']('\x27'+_0xed84c9+'\x27',_0x91c1('0x4f'))[_0x91c1('0x70')]('cm_contact_has_items','ci')[_0x91c1('0x81')](_0x91c1('0x67'),'h',_0x91c1('0x82'))[_0x91c1('0x38')](_0x91c1('0x83'),_0x23b9d3[_0x91c1('0x6e')][_0x91c1('0x6f')]())[_0x91c1('0x38')](_0x91c1('0x84'),_0xad304f[_0x91c1('0x4c')]['id']['toString']())[_0x91c1('0x38')](_0x91c1('0x85'),_0xed84c9))[_0x91c1('0x6f')]();_0x3e5ab2[_0x91c1('0x86')](db[_0x91c1('0x87')][_0x91c1('0x2f')](_0xaf6e53));_0xf0a8b['push'](db[_0x91c1('0x87')][_0x91c1('0x2f')](_0x6fc56));}return BPromise[_0x91c1('0x88')](_0x3e5ab2);}})['then'](function(){return BPromise['all'](_0xf0a8b);})[_0x91c1('0x23')](function(){return _0x26d22c;})['then'](respondWithResult(_0x129605,null))[_0x91c1('0x40')](handleError(_0x129605,null));};exports[_0x91c1('0x89')]=function(_0x3596c9,_0x27fe6d,_0x534515){return db[_0x91c1('0x2b')][_0x91c1('0x48')]({'where':{'id':_0x3596c9['params']['id']}})['then'](handleEntityNotFound(_0x27fe6d,null))[_0x91c1('0x23')](function(_0x18324b){if(_0x18324b){return _0x18324b[_0x91c1('0x89')](_0x3596c9[_0x91c1('0x2f')][_0x91c1('0x8a')]);}})[_0x91c1('0x23')](function(_0x14376a){if(_0x14376a){return db[_0x91c1('0x55')]['destroy']({'where':{'ListId':_0x3596c9['query'][_0x91c1('0x8a')],'CampaignId':_0x3596c9[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](function(){return _0x14376a;});}})['then'](respondWithStatusCode(_0x27fe6d,null))[_0x91c1('0x40')](handleError(_0x27fe6d,null));};exports['getBlackLists']=function(_0x1134e4,_0x95bb8,_0x5a827f){var _0x438786={};var _0x29b90e={};var _0x23abed;var _0x2c8cbd;return db[_0x91c1('0x2b')]['findOne']({'where':{'id':_0x1134e4['params']['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x95bb8,null))[_0x91c1('0x23')](function(_0x1434e7){if(_0x1434e7){_0x23abed=_0x1434e7;_0x29b90e[_0x91c1('0x2e')]=_[_0x91c1('0x30')](db['CmList'][_0x91c1('0x2c')]);_0x29b90e['query']=_['keys'](_0x1134e4[_0x91c1('0x2f')]);_0x29b90e[_0x91c1('0x31')]=_['intersection'](_0x29b90e[_0x91c1('0x2e')],_0x29b90e[_0x91c1('0x2f')]);_0x438786[_0x91c1('0x33')]=_[_0x91c1('0x32')](_0x29b90e[_0x91c1('0x2e')],qs[_0x91c1('0x34')](_0x1134e4[_0x91c1('0x2f')][_0x91c1('0x34')]));_0x438786[_0x91c1('0x33')]=_0x438786[_0x91c1('0x33')][_0x91c1('0x35')]?_0x438786[_0x91c1('0x33')]:_0x29b90e[_0x91c1('0x2e')];_0x438786[_0x91c1('0x36')]=qs[_0x91c1('0x37')](_0x1134e4[_0x91c1('0x2f')][_0x91c1('0x37')]);_0x438786[_0x91c1('0x38')]=qs[_0x91c1('0x31')](_[_0x91c1('0x39')](_0x1134e4['query'],_0x29b90e[_0x91c1('0x31')]));if(_0x1134e4['query'][_0x91c1('0x3a')]){_0x438786['where']=_[_0x91c1('0x42')](_0x438786['where'],{'$or':_['map'](_0x438786[_0x91c1('0x33')],function(_0x14b430){var _0x25f9fb={};_0x25f9fb[_0x14b430]={'$like':'%'+_0x1134e4[_0x91c1('0x2f')][_0x91c1('0x3a')]+'%'};return _0x25f9fb;})});}_0x438786=_[_0x91c1('0x42')]({},_0x438786,_0x1134e4[_0x91c1('0x4d')]);return _0x23abed['getBlackLists'](_0x438786);}})['then'](function(_0x370714){if(_0x370714){_0x2c8cbd=_0x370714[_0x91c1('0x35')];if(!_0x1134e4[_0x91c1('0x2f')]['hasOwnProperty'](_0x91c1('0x57'))){_0x438786['limit']=qs['limit'](_0x1134e4[_0x91c1('0x2f')]['limit']);_0x438786['offset']=qs[_0x91c1('0x1a')](_0x1134e4[_0x91c1('0x2f')][_0x91c1('0x1a')]);}return _0x23abed['getBlackLists'](_0x438786);}})['then'](function(_0x22fafd){if(_0x22fafd){return _0x22fafd?{'count':_0x2c8cbd,'rows':_0x22fafd}:null;}})[_0x91c1('0x23')](respondWithResult(_0x95bb8,null))[_0x91c1('0x40')](handleError(_0x95bb8,null));};exports[_0x91c1('0x8b')]=function(_0x3a03d1,_0x1c747a,_0xf2b9d0){var _0x420e14,_0x36dc85;var _0x4da6c1=[];var _0x379575=moment()[_0x91c1('0x61')](_0x91c1('0x62'));return db[_0x91c1('0x2b')]['find']({'where':{'id':_0x3a03d1['params']['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x1c747a,null))[_0x91c1('0x23')](function(_0x4452e9){if(_0x4452e9){_0x36dc85=_0x4452e9;return _0x4452e9[_0x91c1('0x8b')](_0x3a03d1[_0x91c1('0x44')][_0x91c1('0x8a')],_[_0x91c1('0x4e')](_0x3a03d1[_0x91c1('0x44')],[_0x91c1('0x8a'),'id'])||{});}return null;})[_0x91c1('0x8c')](function(_0x4ad5a){var _0x1ea4e8;var _0xea140a;_0x420e14=_0x4ad5a||[];var _0x2c2459=[];if(_0x4ad5a){for(var _0x2db243=0x0;_0x2db243<_0x4ad5a[_0x91c1('0x35')];_0x2db243+=0x1){var _0x36176e=_0x4ad5a[_0x2db243][_0x91c1('0x24')]({'plain':!![]});_0x1ea4e8=squel[_0x91c1('0x66')]()[_0x91c1('0x79')](_0x91c1('0x8d'))[_0x91c1('0x68')]([_0x91c1('0x6c'),'ContactId',_0x91c1('0x6a'),_0x91c1('0x58'),'createdAt',_0x91c1('0x4f')],squel[_0x91c1('0x75')]()[_0x91c1('0x6b')]('phone',_0x91c1('0x6c'))['field']('id','ContactId')[_0x91c1('0x6b')](_0x36176e['CmListId'][_0x91c1('0x6f')](),_0x91c1('0x6a'))[_0x91c1('0x6b')](_0x3a03d1['params']['id'][_0x91c1('0x6f')](),_0x91c1('0x58'))['field'](_0x91c1('0x7a'),'createdAt')[_0x91c1('0x6b')](_0x91c1('0x7a'),_0x91c1('0x4f'))['from'](_0x91c1('0x71'))['where'](_0x91c1('0x72'))['where']('ListId\x20=\x20?',_0x36176e[_0x91c1('0x6e')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x2c2459[_0x91c1('0x86')](db['sequelize'][_0x91c1('0x2f')](_0x1ea4e8));}return BPromise[_0x91c1('0x88')](_0x2c2459);}})[_0x91c1('0x23')](function(){return _0x420e14;})[_0x91c1('0x23')](respondWithResult(_0x1c747a,null))[_0x91c1('0x40')](handleError(_0x1c747a,null));};exports['removeBlackLists']=function(_0x4effc2,_0x7c0da8,_0x448f54){return db['Campaign'][_0x91c1('0x48')]({'where':{'id':_0x4effc2[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](handleEntityNotFound(_0x7c0da8,null))[_0x91c1('0x23')](function(_0x3157c5){if(_0x3157c5){return _0x3157c5[_0x91c1('0x8e')](_0x4effc2['query'][_0x91c1('0x8a')]);}})[_0x91c1('0x23')](function(_0x40f3ad){if(_0x40f3ad){return db[_0x91c1('0x5e')][_0x91c1('0x22')]({'where':{'ListId':_0x4effc2[_0x91c1('0x2f')][_0x91c1('0x8a')],'CampaignId':_0x4effc2[_0x91c1('0x4c')]['id']}})[_0x91c1('0x23')](function(){return _0x40f3ad;});}})[_0x91c1('0x23')](respondWithStatusCode(_0x7c0da8,null))['catch'](handleError(_0x7c0da8,null));}; \ No newline at end of file +var _0xeb74=['params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','nolimit','sort','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','CampaignId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','fromQuery','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','send','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x44cc6f,_0xe6a260){var _0x2b22c4=function(_0x827143){while(--_0x827143){_0x44cc6f['push'](_0x44cc6f['shift']());}};_0x2b22c4(++_0xe6a260);}(_0xeb74,0xe3));var _0x4eb7=function(_0x24e709,_0x4008c4){_0x24e709=_0x24e709-0x0;var _0x30e4e9=_0xeb74[_0x24e709];return _0x30e4e9;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['Campaign'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['clone']=function(_0x4e3163,_0x2e5d28){var _0x5a3192={'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}},_0x2f68a8={};_0x2f68a8[_0x4eb7('0x35')]=_[_0x4eb7('0x37')](db['Campaign'][_0x4eb7('0x32')]);_0x5a3192[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x2f68a8[_0x4eb7('0x35')],qs['fields'](_0x4e3163[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x5a3192['attributes']=_0x5a3192[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x5a3192['attributes']:_0x2f68a8[_0x4eb7('0x35')];if(_0x4e3163['query'][_0x4eb7('0x46')]){_0x5a3192['include']=[{'all':!![]}];}_0x5a3192=_[_0x4eb7('0x42')]({},_0x5a3192,_0x4e3163[_0x4eb7('0x45')]);return db[_0x4eb7('0x31')][_0x4eb7('0x4c')](_0x5a3192)[_0x4eb7('0x25')](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](function(_0x4e05ac){if(_0x4e05ac){var _0x4a4fc5=_0x4e05ac[_0x4eb7('0x27')]({'plain':!![]});_0x4a4fc5=qs[_0x4eb7('0x55')](_0x4a4fc5,['id',_0x4eb7('0x56'),_0x4eb7('0x57')]);_0x4e3163['body']=_[_0x4eb7('0x55')](_0x4e3163[_0x4eb7('0x58')],['id','createdAt',_0x4eb7('0x57')]);return db[_0x4eb7('0x31')][_0x4eb7('0x4d')](_[_0x4eb7('0x42')](_0x4a4fc5,_0x4e3163[_0x4eb7('0x58')]),{'include':_0x4e3163[_0x4eb7('0x36')][_0x4eb7('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x5839f1){var _0xcc658e=_0x4e3163['user'][_0x4eb7('0x27')]({'plain':!![]});if(!_0xcc658e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcc658e[_0x4eb7('0x50')]==='user'){var _0x4f7fd1=_0x5839f1[_0x4eb7('0x27')]({'plain':!![]});var _0xa67fe1='IvrCampaigns';return db[_0x4eb7('0x51')]['find']({'where':{'name':_0xa67fe1,'userProfileId':_0xcc658e[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x4ab8e8){if(_0x4ab8e8&&_0x4ab8e8[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')]['create']({'name':_0x4f7fd1['name'],'resourceId':_0x4f7fd1['id'],'type':_0x4ab8e8['name'],'sectionId':_0x4ab8e8['id']},{})['then'](function(){return _0x5839f1;});}else{return _0x5839f1;}})[_0x4eb7('0x49')](function(_0x560ffc){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x560ffc);throw _0x560ffc;});}return _0x5839f1;});}})['then'](respondWithResult(_0x2e5d28,0xc9))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports[_0x4eb7('0x24')]=function(_0x463ab6,_0x984dc3){if(_0x463ab6[_0x4eb7('0x58')]['id']){delete _0x463ab6[_0x4eb7('0x58')]['id'];}return db['Campaign']['find']({'where':{'id':_0x463ab6['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x984dc3,null))[_0x4eb7('0x25')](saveUpdates(_0x463ab6[_0x4eb7('0x58')],null))[_0x4eb7('0x25')](respondWithResult(_0x984dc3,null))[_0x4eb7('0x49')](handleError(_0x984dc3,null));};exports['destroy']=function(_0x4be9e2,_0x438fc2){return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4be9e2[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x438fc2,null))['then'](removeEntity(_0x438fc2,null))[_0x4eb7('0x49')](handleError(_0x438fc2,null));};exports[_0x4eb7('0x59')]=function(_0x2db051,_0x3743f3,_0x5b787c){var _0x4ea56b={'raw':!![],'where':{}};var _0x3bcbd1={};var _0x3883f3={'count':0x0,'rows':[]};return db['Campaign'][_0x4eb7('0x5a')]({'where':{'id':_0x2db051['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x3743f3,null))[_0x4eb7('0x25')](function(_0x3d06c0){if(_0x3d06c0){_0x3bcbd1[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x5b')][_0x4eb7('0x32')]);_0x3bcbd1[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x2db051[_0x4eb7('0x36')]);_0x3bcbd1[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x3bcbd1[_0x4eb7('0x35')],_0x3bcbd1[_0x4eb7('0x36')]);_0x4ea56b[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x3bcbd1[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x2db051[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x4ea56b[_0x4eb7('0x39')]=_0x4ea56b[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x4ea56b[_0x4eb7('0x39')]:_0x3bcbd1['model'];if(!_0x2db051['query'][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x4ea56b[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x2db051[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0x4ea56b[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x2db051['query'][_0x4eb7('0x1b')]);}_0x4ea56b[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x2db051['query']['sort']);_0x4ea56b[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x2db051['query'],_0x3bcbd1['filters']));_0x4ea56b[_0x4eb7('0x3f')][_0x4eb7('0x5e')]=_0x3d06c0['id'];if(_0x2db051[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x4ea56b[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x4ea56b[_0x4eb7('0x3f')],{'$or':_[_0x4eb7('0x30')](_0x4ea56b[_0x4eb7('0x39')],function(_0x2e531e){var _0x21f405={};_0x21f405[_0x2e531e]={'$like':'%'+_0x2db051[_0x4eb7('0x36')]['filter']+'%'};return _0x21f405;})});}_0x4ea56b=_['merge']({},_0x4ea56b,_0x2db051[_0x4eb7('0x45')]);return db[_0x4eb7('0x5b')][_0x4eb7('0x1e')]({'where':_0x4ea56b[_0x4eb7('0x3f')]})[_0x4eb7('0x25')](function(_0x1cc1ac){_0x3883f3['count']=_0x1cc1ac;if(_0x2db051['query'][_0x4eb7('0x46')]){_0x4ea56b[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x5b')][_0x4eb7('0x5f')](_0x4ea56b);})[_0x4eb7('0x25')](function(_0x2480ed){_0x3883f3[_0x4eb7('0x48')]=_0x2480ed;return _0x3883f3;});}})[_0x4eb7('0x25')](respondWithFilteredResult(_0x3743f3,_0x4ea56b))[_0x4eb7('0x49')](handleError(_0x3743f3,null));};exports[_0x4eb7('0x60')]=function(_0x44d914,_0x77fb5,_0x12afc0){var _0x186946={'raw':!![],'where':{}};var _0x5ea3ed={};var _0x1a2850={'count':0x0,'rows':[]};return db[_0x4eb7('0x31')][_0x4eb7('0x5a')]({'where':{'id':_0x44d914[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x77fb5,null))[_0x4eb7('0x25')](function(_0xac2468){if(_0xac2468){_0x5ea3ed['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x61')][_0x4eb7('0x32')]);_0x5ea3ed['query']=_[_0x4eb7('0x37')](_0x44d914[_0x4eb7('0x36')]);_0x5ea3ed[_0x4eb7('0x38')]=_['intersection'](_0x5ea3ed[_0x4eb7('0x35')],_0x5ea3ed['query']);_0x186946['attributes']=_[_0x4eb7('0x3a')](_0x5ea3ed['model'],qs[_0x4eb7('0x3b')](_0x44d914['query'][_0x4eb7('0x3b')]));_0x186946[_0x4eb7('0x39')]=_0x186946[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x186946[_0x4eb7('0x39')]:_0x5ea3ed[_0x4eb7('0x35')];if(!_0x44d914['query'][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x186946[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x44d914[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0x186946[_0x4eb7('0x1b')]=qs['offset'](_0x44d914[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0x186946[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x44d914[_0x4eb7('0x36')][_0x4eb7('0x5d')]);_0x186946[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x44d914[_0x4eb7('0x36')],_0x5ea3ed[_0x4eb7('0x38')]));_0x186946[_0x4eb7('0x3f')][_0x4eb7('0x5e')]=_0xac2468['id'];if(_0x44d914['query'][_0x4eb7('0x41')]){_0x186946[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x186946[_0x4eb7('0x3f')],{'$or':_[_0x4eb7('0x30')](_0x186946[_0x4eb7('0x39')],function(_0x33d64f){var _0x69d5={};_0x69d5[_0x33d64f]={'$like':'%'+_0x44d914['query'][_0x4eb7('0x41')]+'%'};return _0x69d5;})});}_0x186946=_[_0x4eb7('0x42')]({},_0x186946,_0x44d914[_0x4eb7('0x45')]);return db[_0x4eb7('0x61')]['count']({'where':_0x186946[_0x4eb7('0x3f')]})['then'](function(_0x55efba){_0x1a2850['count']=_0x55efba;if(_0x44d914['query'][_0x4eb7('0x46')]){_0x186946[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x61')][_0x4eb7('0x5f')](_0x186946);})['then'](function(_0x351f20){_0x1a2850[_0x4eb7('0x48')]=_0x351f20;return _0x1a2850;});}})[_0x4eb7('0x25')](respondWithFilteredResult(_0x77fb5,_0x186946))[_0x4eb7('0x49')](handleError(_0x77fb5,null));};exports[_0x4eb7('0x62')]=function(_0x101079,_0x105139,_0x34af15){var _0x4f1998={'raw':!![],'where':{}};var _0x8e873d={};var _0x33ff1e={'count':0x0,'rows':[]};return db[_0x4eb7('0x31')]['findOne']({'where':{'id':_0x101079[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x105139,null))[_0x4eb7('0x25')](function(_0x6519f8){if(_0x6519f8){_0x8e873d['model']=_[_0x4eb7('0x37')](db['CmHopperFinal'][_0x4eb7('0x32')]);_0x8e873d['query']=_[_0x4eb7('0x37')](_0x101079['query']);_0x8e873d[_0x4eb7('0x38')]=_['intersection'](_0x8e873d['model'],_0x8e873d[_0x4eb7('0x36')]);_0x4f1998[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x8e873d['model'],qs['fields'](_0x101079['query']['fields']));_0x4f1998[_0x4eb7('0x39')]=_0x4f1998[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x4f1998[_0x4eb7('0x39')]:_0x8e873d['model'];if(!_0x101079[_0x4eb7('0x36')][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x4f1998['limit']=qs[_0x4eb7('0x1d')](_0x101079['query'][_0x4eb7('0x1d')]);_0x4f1998[_0x4eb7('0x1b')]=qs['offset'](_0x101079[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0x4f1998[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x101079[_0x4eb7('0x36')][_0x4eb7('0x5d')]);_0x4f1998[_0x4eb7('0x3f')]=qs['filters'](_[_0x4eb7('0x40')](_0x101079[_0x4eb7('0x36')],_0x8e873d['filters']));_0x4f1998[_0x4eb7('0x3f')][_0x4eb7('0x5e')]=_0x6519f8['id'];if(_0x101079[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x4f1998[_0x4eb7('0x3f')]=_['merge'](_0x4f1998['where'],{'$or':_['map'](_0x4f1998[_0x4eb7('0x39')],function(_0x5a64ee){var _0x47dd40={};_0x47dd40[_0x5a64ee]={'$like':'%'+_0x101079['query']['filter']+'%'};return _0x47dd40;})});}_0x4f1998=_[_0x4eb7('0x42')]({},_0x4f1998,_0x101079['options']);return db[_0x4eb7('0x63')][_0x4eb7('0x1e')]({'where':_0x4f1998[_0x4eb7('0x3f')]})[_0x4eb7('0x25')](function(_0x54c754){_0x33ff1e[_0x4eb7('0x1e')]=_0x54c754;if(_0x101079[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x4f1998['include']=[{'all':!![]}];}return db[_0x4eb7('0x63')][_0x4eb7('0x5f')](_0x4f1998);})[_0x4eb7('0x25')](function(_0x16fdd4){_0x33ff1e[_0x4eb7('0x48')]=_0x16fdd4;return _0x33ff1e;});}})['then'](respondWithFilteredResult(_0x105139,_0x4f1998))['catch'](handleError(_0x105139,null));};exports[_0x4eb7('0x64')]=function(_0x5d90ea,_0xb32651,_0x4a029b){var _0x1e89e5={'raw':!![],'where':{}};var _0x272c72={};var _0x499c99={'count':0x0,'rows':[]};return db[_0x4eb7('0x31')][_0x4eb7('0x5a')]({'where':{'id':_0x5d90ea[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0xb32651,null))['then'](function(_0x5769f5){if(_0x5769f5){_0x272c72[_0x4eb7('0x35')]=_[_0x4eb7('0x37')](db[_0x4eb7('0x65')][_0x4eb7('0x32')]);_0x272c72[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x5d90ea[_0x4eb7('0x36')]);_0x272c72[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x272c72[_0x4eb7('0x35')],_0x272c72['query']);_0x1e89e5[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x272c72[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x1e89e5['attributes']=_0x1e89e5[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x1e89e5[_0x4eb7('0x39')]:_0x272c72['model'];if(!_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x1e89e5['limit']=qs[_0x4eb7('0x1d')](_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0x1e89e5[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0x1e89e5[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x5d')]);_0x1e89e5[_0x4eb7('0x3f')]=qs['filters'](_[_0x4eb7('0x40')](_0x5d90ea[_0x4eb7('0x36')],_0x272c72[_0x4eb7('0x38')]));_0x1e89e5[_0x4eb7('0x3f')]['CampaignId']=_0x5769f5['id'];if(_0x5d90ea[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1e89e5[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1e89e5[_0x4eb7('0x3f')],{'$or':_[_0x4eb7('0x30')](_0x1e89e5[_0x4eb7('0x39')],function(_0x53afbd){var _0x4de732={};_0x4de732[_0x53afbd]={'$like':'%'+_0x5d90ea[_0x4eb7('0x36')]['filter']+'%'};return _0x4de732;})});}_0x1e89e5=_['merge']({},_0x1e89e5,_0x5d90ea[_0x4eb7('0x45')]);return db[_0x4eb7('0x65')][_0x4eb7('0x1e')]({'where':_0x1e89e5[_0x4eb7('0x3f')]})[_0x4eb7('0x25')](function(_0x5ce7ff){_0x499c99[_0x4eb7('0x1e')]=_0x5ce7ff;if(_0x5d90ea['query'][_0x4eb7('0x46')]){_0x1e89e5[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x65')][_0x4eb7('0x5f')](_0x1e89e5);})[_0x4eb7('0x25')](function(_0xa32dd){_0x499c99['rows']=_0xa32dd;return _0x499c99;});}})['then'](respondWithFilteredResult(_0xb32651,_0x1e89e5))[_0x4eb7('0x49')](handleError(_0xb32651,null));};exports[_0x4eb7('0x66')]=function(_0x52c84b,_0x11c58b,_0x234ece){var _0x12cc9d={};var _0x5d169b={};var _0x5795de;var _0x4a983d;return db[_0x4eb7('0x31')][_0x4eb7('0x5a')]({'where':{'id':_0x52c84b[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x11c58b,null))[_0x4eb7('0x25')](function(_0x6efad6){if(_0x6efad6){_0x5795de=_0x6efad6;_0x5d169b[_0x4eb7('0x35')]=_['keys'](db['CmList'][_0x4eb7('0x32')]);_0x5d169b[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x52c84b[_0x4eb7('0x36')]);_0x5d169b[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x5d169b[_0x4eb7('0x35')],_0x5d169b[_0x4eb7('0x36')]);_0x12cc9d['attributes']=_[_0x4eb7('0x3a')](_0x5d169b['model'],qs[_0x4eb7('0x3b')](_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x12cc9d[_0x4eb7('0x39')]=_0x12cc9d['attributes'][_0x4eb7('0x3c')]?_0x12cc9d[_0x4eb7('0x39')]:_0x5d169b[_0x4eb7('0x35')];_0x12cc9d[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x5d')]);_0x12cc9d[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x52c84b[_0x4eb7('0x36')],_0x5d169b[_0x4eb7('0x38')]));if(_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x12cc9d[_0x4eb7('0x3f')]=_['merge'](_0x12cc9d[_0x4eb7('0x3f')],{'$or':_[_0x4eb7('0x30')](_0x12cc9d[_0x4eb7('0x39')],function(_0x3fe52b){var _0x47fb87={};_0x47fb87[_0x3fe52b]={'$like':'%'+_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x47fb87;})});}_0x12cc9d=_['merge']({},_0x12cc9d,_0x52c84b['options']);return _0x5795de['getLists'](_0x12cc9d);}})[_0x4eb7('0x25')](function(_0x517077){if(_0x517077){_0x4a983d=_0x517077[_0x4eb7('0x3c')];if(!_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x12cc9d['limit']=qs[_0x4eb7('0x1d')](_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0x12cc9d[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x52c84b[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}return _0x5795de[_0x4eb7('0x66')](_0x12cc9d);}})[_0x4eb7('0x25')](function(_0x2a8d21){if(_0x2a8d21){return _0x2a8d21?{'count':_0x4a983d,'rows':_0x2a8d21}:null;}})[_0x4eb7('0x25')](respondWithResult(_0x11c58b,null))['catch'](handleError(_0x11c58b,null));};exports[_0x4eb7('0x67')]=function(_0x293e4d,_0x12abfc,_0xb9c2e5){var _0x3a9778,_0x383931;var _0x4fd35a=[];var _0xd0353a=moment()[_0x4eb7('0x68')](_0x4eb7('0x69'));return db['Campaign'][_0x4eb7('0x4c')]({'where':{'id':_0x293e4d[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x12abfc,null))[_0x4eb7('0x25')](function(_0xb0a8cb){if(_0xb0a8cb){_0x383931=_0xb0a8cb;return _0xb0a8cb[_0x4eb7('0x67')](_0x293e4d[_0x4eb7('0x58')][_0x4eb7('0x6a')],_[_0x4eb7('0x55')](_0x293e4d[_0x4eb7('0x58')],['ids','id'])||{});}return null;})[_0x4eb7('0x6b')](function(_0x48af11){var _0x57e88b;var _0x4ac4c0;_0x3a9778=_0x48af11||[];var _0x4106a1=[];if(_0x48af11){for(var _0x4e2c55=0x0;_0x4e2c55<_0x48af11[_0x4eb7('0x3c')];_0x4e2c55+=0x1){var _0x33d92e=_0x48af11[_0x4e2c55][_0x4eb7('0x27')]({'plain':!![]});_0x383931['dialCheckDuplicateType']=_0x293e4d[_0x4eb7('0x58')][_0x4eb7('0x6c')]?_0x293e4d['body'][_0x4eb7('0x6c')]:_0x383931[_0x4eb7('0x6c')];switch(_0x383931['dialCheckDuplicateType']){case _0x4eb7('0x6d'):_0x57e88b=squel[_0x4eb7('0x6e')]()['into'](_0x4eb7('0x6f'))['fromQuery']([_0x4eb7('0x70'),'scheduledAt',_0x4eb7('0x71'),_0x4eb7('0x72'),'CampaignId','createdAt',_0x4eb7('0x57')],squel[_0x4eb7('0x73')]()[_0x4eb7('0x74')](_0x4eb7('0x70'),_0x4eb7('0x70'))['field'](_0x4eb7('0x75'),_0x4eb7('0x76'))[_0x4eb7('0x74')]('id',_0x4eb7('0x71'))[_0x4eb7('0x74')](_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')](),_0x4eb7('0x72'))[_0x4eb7('0x74')](_0x293e4d[_0x4eb7('0x4b')]['id']['toString'](),_0x4eb7('0x5e'))[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27',_0x4eb7('0x56'))['field']('\x27'+_0xd0353a+'\x27',_0x4eb7('0x57'))[_0x4eb7('0x79')](_0x4eb7('0x7a'))[_0x4eb7('0x3f')]('deletedAt\x20IS\x20NULL')[_0x4eb7('0x3f')](_0x4eb7('0x7b'),_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')]())[_0x4eb7('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4eb7('0x73')]()[_0x4eb7('0x74')](_0x4eb7('0x7c'))[_0x4eb7('0x79')]('cm_hopper_final')[_0x4eb7('0x3f')]('CampaignId\x20=\x20?',_0x293e4d[_0x4eb7('0x4b')]['id'][_0x4eb7('0x78')]()))['where'](_0x4eb7('0x7d'),squel[_0x4eb7('0x73')]()[_0x4eb7('0x74')](_0x4eb7('0x7e'))['from']('cm_hopper')[_0x4eb7('0x3f')]('CampaignId\x20=\x20?',_0x293e4d[_0x4eb7('0x4b')]['id']['toString']())))[_0x4eb7('0x78')]();break;case _0x4eb7('0x7f'):_0x57e88b=squel[_0x4eb7('0x6e')]()[_0x4eb7('0x80')]('cm_hopper')['fromQuery']([_0x4eb7('0x70'),_0x4eb7('0x76'),_0x4eb7('0x71'),_0x4eb7('0x72'),_0x4eb7('0x5e'),_0x4eb7('0x56'),_0x4eb7('0x57')],squel['select']()['field'](_0x4eb7('0x70'),_0x4eb7('0x70'))['field'](_0x4eb7('0x75'),_0x4eb7('0x76'))[_0x4eb7('0x74')]('id',_0x4eb7('0x71'))[_0x4eb7('0x74')](_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')](),_0x4eb7('0x72'))['field'](_0x293e4d[_0x4eb7('0x4b')]['id'][_0x4eb7('0x78')](),_0x4eb7('0x5e'))[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27',_0x4eb7('0x56'))[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27','updatedAt')[_0x4eb7('0x79')](_0x4eb7('0x7a'))['where'](_0x4eb7('0x81'))[_0x4eb7('0x3f')]('ListId\x20=\x20?',_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')]())[_0x4eb7('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x4eb7('0x7d'),squel[_0x4eb7('0x73')]()[_0x4eb7('0x74')](_0x4eb7('0x7e'))[_0x4eb7('0x79')]('cm_hopper')[_0x4eb7('0x3f')](_0x4eb7('0x82'),_0x293e4d['params']['id'][_0x4eb7('0x78')]())))['toString']();break;default:_0x57e88b=squel['insert']()[_0x4eb7('0x80')](_0x4eb7('0x6f'))['fromQuery'](['phone',_0x4eb7('0x76'),_0x4eb7('0x71'),_0x4eb7('0x72'),_0x4eb7('0x5e'),_0x4eb7('0x56'),'updatedAt'],squel[_0x4eb7('0x73')]()['field'](_0x4eb7('0x70'),'phone')[_0x4eb7('0x74')](_0x4eb7('0x75'),_0x4eb7('0x76'))[_0x4eb7('0x74')]('id','ContactId')['field'](_0x33d92e['CmListId'][_0x4eb7('0x78')](),_0x4eb7('0x72'))[_0x4eb7('0x74')](_0x293e4d[_0x4eb7('0x4b')]['id'][_0x4eb7('0x78')](),_0x4eb7('0x5e'))[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27','createdAt')[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27',_0x4eb7('0x57'))[_0x4eb7('0x79')](_0x4eb7('0x7a'))['where'](_0x4eb7('0x81'))['where'](_0x4eb7('0x7b'),_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')]())[_0x4eb7('0x3f')](_0x4eb7('0x83')))[_0x4eb7('0x78')]();}_0x4ac4c0=squel[_0x4eb7('0x6e')]()[_0x4eb7('0x80')](_0x4eb7('0x84'))[_0x4eb7('0x85')]([_0x4eb7('0x86'),'scheduledAt',_0x4eb7('0x70'),'OrderBy',_0x4eb7('0x56'),'updatedAt'],squel[_0x4eb7('0x73')]()[_0x4eb7('0x74')](_0x4eb7('0x87'),'id')[_0x4eb7('0x74')](_0x4eb7('0x75'),_0x4eb7('0x76'))[_0x4eb7('0x74')](_0x4eb7('0x88'),_0x4eb7('0x70'))[_0x4eb7('0x74')](_0x4eb7('0x89'),_0x4eb7('0x8a'))['field']('\x27'+_0xd0353a+'\x27',_0x4eb7('0x56'))[_0x4eb7('0x74')]('\x27'+_0xd0353a+'\x27',_0x4eb7('0x57'))[_0x4eb7('0x79')](_0x4eb7('0x8b'),'ci')[_0x4eb7('0x8c')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x4eb7('0x8d'),_0x33d92e[_0x4eb7('0x77')][_0x4eb7('0x78')]())[_0x4eb7('0x3f')](_0x4eb7('0x8e'),_0x293e4d['params']['id'][_0x4eb7('0x78')]())[_0x4eb7('0x3f')](_0x4eb7('0x8f'),_0xd0353a))[_0x4eb7('0x78')]();_0x4106a1[_0x4eb7('0x90')](db[_0x4eb7('0x91')][_0x4eb7('0x36')](_0x57e88b));_0x4fd35a[_0x4eb7('0x90')](db[_0x4eb7('0x91')][_0x4eb7('0x36')](_0x4ac4c0));}return BPromise[_0x4eb7('0x92')](_0x4106a1);}})['then'](function(){return BPromise[_0x4eb7('0x92')](_0x4fd35a);})[_0x4eb7('0x25')](function(){return _0x3a9778;})['then'](respondWithResult(_0x12abfc,null))[_0x4eb7('0x49')](handleError(_0x12abfc,null));};exports[_0x4eb7('0x93')]=function(_0x3f4911,_0x4c103a,_0x4c53de){return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x3f4911[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x4c103a,null))['then'](function(_0x501a14){if(_0x501a14){return _0x501a14[_0x4eb7('0x93')](_0x3f4911[_0x4eb7('0x36')]['ids']);}})['then'](function(_0x3a5349){if(_0x3a5349){return db[_0x4eb7('0x5b')][_0x4eb7('0x26')]({'where':{'ListId':_0x3f4911[_0x4eb7('0x36')][_0x4eb7('0x6a')],'CampaignId':_0x3f4911['params']['id']}})[_0x4eb7('0x25')](function(){return _0x3a5349;});}})['then'](respondWithStatusCode(_0x4c103a,null))[_0x4eb7('0x49')](handleError(_0x4c103a,null));};exports[_0x4eb7('0x94')]=function(_0x17e567,_0x1241fc,_0x4011ed){var _0x36a4c1={};var _0x56c403={};var _0xcc27e5;var _0x3a5725;return db[_0x4eb7('0x31')]['findOne']({'where':{'id':_0x17e567['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x1241fc,null))[_0x4eb7('0x25')](function(_0x43d887){if(_0x43d887){_0xcc27e5=_0x43d887;_0x56c403[_0x4eb7('0x35')]=_['keys'](db['CmList'][_0x4eb7('0x32')]);_0x56c403[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x17e567[_0x4eb7('0x36')]);_0x56c403[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x56c403['model'],_0x56c403[_0x4eb7('0x36')]);_0x36a4c1[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x56c403[_0x4eb7('0x35')],qs['fields'](_0x17e567['query'][_0x4eb7('0x3b')]));_0x36a4c1[_0x4eb7('0x39')]=_0x36a4c1[_0x4eb7('0x39')][_0x4eb7('0x3c')]?_0x36a4c1[_0x4eb7('0x39')]:_0x56c403[_0x4eb7('0x35')];_0x36a4c1[_0x4eb7('0x3e')]=qs[_0x4eb7('0x5d')](_0x17e567[_0x4eb7('0x36')][_0x4eb7('0x5d')]);_0x36a4c1[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x17e567['query'],_0x56c403[_0x4eb7('0x38')]));if(_0x17e567[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x36a4c1[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x36a4c1['where'],{'$or':_[_0x4eb7('0x30')](_0x36a4c1[_0x4eb7('0x39')],function(_0xad9b5b){var _0x2df275={};_0x2df275[_0xad9b5b]={'$like':'%'+_0x17e567[_0x4eb7('0x36')]['filter']+'%'};return _0x2df275;})});}_0x36a4c1=_[_0x4eb7('0x42')]({},_0x36a4c1,_0x17e567[_0x4eb7('0x45')]);return _0xcc27e5[_0x4eb7('0x94')](_0x36a4c1);}})[_0x4eb7('0x25')](function(_0x4a7dd7){if(_0x4a7dd7){_0x3a5725=_0x4a7dd7[_0x4eb7('0x3c')];if(!_0x17e567['query'][_0x4eb7('0x3d')](_0x4eb7('0x5c'))){_0x36a4c1[_0x4eb7('0x1d')]=qs['limit'](_0x17e567['query'][_0x4eb7('0x1d')]);_0x36a4c1[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x17e567['query']['offset']);}return _0xcc27e5[_0x4eb7('0x94')](_0x36a4c1);}})[_0x4eb7('0x25')](function(_0xcba9ca){if(_0xcba9ca){return _0xcba9ca?{'count':_0x3a5725,'rows':_0xcba9ca}:null;}})['then'](respondWithResult(_0x1241fc,null))[_0x4eb7('0x49')](handleError(_0x1241fc,null));};exports[_0x4eb7('0x95')]=function(_0x4d8187,_0x438a08,_0x245c91){var _0x586757,_0x2bcfb9;var _0x396178=[];var _0x3abceb=moment()[_0x4eb7('0x68')](_0x4eb7('0x69'));return db['Campaign']['find']({'where':{'id':_0x4d8187['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x438a08,null))['then'](function(_0xc25719){if(_0xc25719){_0x2bcfb9=_0xc25719;return _0xc25719[_0x4eb7('0x95')](_0x4d8187[_0x4eb7('0x58')][_0x4eb7('0x6a')],_[_0x4eb7('0x55')](_0x4d8187[_0x4eb7('0x58')],[_0x4eb7('0x6a'),'id'])||{});}return null;})[_0x4eb7('0x6b')](function(_0x5fe16d){var _0x1828fc;var _0x2f6c36;_0x586757=_0x5fe16d||[];var _0xd1780=[];if(_0x5fe16d){for(var _0x18e3ab=0x0;_0x18e3ab<_0x5fe16d['length'];_0x18e3ab+=0x1){var _0x1ab700=_0x5fe16d[_0x18e3ab]['get']({'plain':!![]});_0x1828fc=squel[_0x4eb7('0x6e')]()['into']('cm_hopper_black')[_0x4eb7('0x85')]([_0x4eb7('0x70'),_0x4eb7('0x71'),_0x4eb7('0x72'),_0x4eb7('0x5e'),_0x4eb7('0x56'),_0x4eb7('0x57')],squel['select']()['field']('phone',_0x4eb7('0x70'))['field']('id',_0x4eb7('0x71'))[_0x4eb7('0x74')](_0x1ab700[_0x4eb7('0x77')]['toString'](),_0x4eb7('0x72'))['field'](_0x4d8187[_0x4eb7('0x4b')]['id'][_0x4eb7('0x78')](),_0x4eb7('0x5e'))[_0x4eb7('0x74')](_0x4eb7('0x75'),'createdAt')[_0x4eb7('0x74')](_0x4eb7('0x75'),_0x4eb7('0x57'))[_0x4eb7('0x79')](_0x4eb7('0x7a'))[_0x4eb7('0x3f')](_0x4eb7('0x81'))[_0x4eb7('0x3f')]('ListId\x20=\x20?',_0x1ab700[_0x4eb7('0x77')][_0x4eb7('0x78')]())[_0x4eb7('0x3f')](_0x4eb7('0x83')))[_0x4eb7('0x78')]();_0xd1780[_0x4eb7('0x90')](db[_0x4eb7('0x91')]['query'](_0x1828fc));}return BPromise[_0x4eb7('0x92')](_0xd1780);}})['then'](function(){return _0x586757;})['then'](respondWithResult(_0x438a08,null))[_0x4eb7('0x49')](handleError(_0x438a08,null));};exports[_0x4eb7('0x96')]=function(_0x483403,_0x4272df,_0xd7819d){return db[_0x4eb7('0x31')]['find']({'where':{'id':_0x483403[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x4272df,null))[_0x4eb7('0x25')](function(_0x160ce5){if(_0x160ce5){return _0x160ce5[_0x4eb7('0x96')](_0x483403[_0x4eb7('0x36')][_0x4eb7('0x6a')]);}})[_0x4eb7('0x25')](function(_0x159701){if(_0x159701){return db[_0x4eb7('0x65')][_0x4eb7('0x26')]({'where':{'ListId':_0x483403['query'][_0x4eb7('0x6a')],'CampaignId':_0x483403[_0x4eb7('0x4b')]['id']}})['then'](function(){return _0x159701;});}})[_0x4eb7('0x25')](respondWithStatusCode(_0x4272df,null))['catch'](handleError(_0x4272df,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1c5f669..e671154 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(_0x4e7306,_0x51515f){var _0x403bbe=function(_0x311e60){while(--_0x311e60){_0x4e7306['push'](_0x4e7306['shift']());}};_0x403bbe(++_0x51515f);}(_0x7a54,0x106));var _0x47a5=function(_0x4e3ac4,_0x5dcb6a){_0x4e3ac4=_0x4e3ac4-0x0;var _0x48baf4=_0x7a54[_0x4e3ac4];return _0x48baf4;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index da2fa57..b236c11 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 _0xfc1e=['result','GetCampaign','findAll','options','attributes','limit','include','map','model','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x54165a,_0x285d04){var _0x21d301=function(_0x125b97){while(--_0x125b97){_0x54165a['push'](_0x54165a['shift']());}};_0x21d301(++_0x285d04);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0xfc1e[_0x5d3903];return _0x4b8bc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefc1('0x0'));var rs=require(_0xefc1('0x1'));var fs=require('fs');var Redis=require(_0xefc1('0x2'));var db=require(_0xefc1('0x3'))['db'];var utils=require(_0xefc1('0x4'));var logger=require('../../config/logger')(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38927c,_0x44d15b,_0x3ff4a7){return new BPromise(function(_0x45bec4,_0x77f637){return client[_0xefc1('0x8')](_0x38927c,_0x3ff4a7)[_0xefc1('0x9')](function(_0x244927){logger[_0xefc1('0xa')](_0xefc1('0xb'),_0x44d15b,'request\x20sent');logger[_0xefc1('0xc')](_0xefc1('0xd'),_0x44d15b,_0xefc1('0xe'),JSON[_0xefc1('0xf')](_0x244927));if(_0x244927[_0xefc1('0x10')]){if(_0x244927[_0xefc1('0x10')][_0xefc1('0x11')]===0x1f4){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x77f637(_0x244927['error'][_0xefc1('0x12')]);}logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x45bec4(_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);}else{logger[_0xefc1('0xa')]('Campaign,\x20%s,\x20%s',_0x44d15b,_0xefc1('0xe'));_0x45bec4(_0x244927[_0xefc1('0x13')][_0xefc1('0x12')]);}})['catch'](function(_0x159adb){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x159adb);_0x77f637(_0x159adb);});});}exports[_0xefc1('0x14')]=function(_0x257914){var _0x38923c=this;return new Promise(function(_0x3b5a6e,_0x126052){return db['Campaign'][_0xefc1('0x15')]({'raw':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x257914['options']?_0x257914[_0xefc1('0x16')]['where']||null:null,'attributes':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x17')]||null:null,'limit':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x18')]||null:null,'include':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')][_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x257914[_0xefc1('0x16')]['include'],function(_0x2f4935){return{'model':db[_0x2f4935[_0xefc1('0x1b')]],'as':_0x2f4935['as'],'attributes':_0x2f4935['attributes'],'include':_0x2f4935[_0xefc1('0x19')]?_['map'](_0x2f4935['include'],function(_0x21aa3b){return{'model':db[_0x21aa3b[_0xefc1('0x1b')]],'as':_0x21aa3b['as'],'attributes':_0x21aa3b[_0xefc1('0x17')],'include':_0x21aa3b[_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x21aa3b[_0xefc1('0x19')],function(_0x538145){return{'model':db[_0x538145['model']],'as':_0x538145['as'],'attributes':_0x538145[_0xefc1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xefc1('0x9')](function(_0x20e438){logger[_0xefc1('0xa')](_0xefc1('0x14'),_0x257914);logger['debug'](_0xefc1('0x14'),_0x257914,JSON[_0xefc1('0xf')](_0x20e438));_0x3b5a6e(_0x20e438);})['catch'](function(_0x486a5b){logger[_0xefc1('0x10')](_0xefc1('0x14'),_0x486a5b[_0xefc1('0x12')],_0x257914);_0x126052(_0x38923c['error'](0x1f4,_0x486a5b[_0xefc1('0x12')]));});});}; \ No newline at end of file +var _0x1ddc=['Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Campaign','findAll','options','attributes','limit','map','include','model','GetCampaign','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x444ff9,_0x29dc7a){_0x444ff9=_0x444ff9-0x0;var _0x3b550f=_0x1ddc[_0x444ff9];return _0x3b550f;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3938ff,_0x25c543,_0x593de5){return new BPromise(function(_0x54819b,_0x411452){return client[_0xc1dd('0x9')](_0x3938ff,_0x593de5)[_0xc1dd('0xa')](function(_0x217d07){logger['info'](_0xc1dd('0xb'),_0x25c543,_0xc1dd('0xc'));logger[_0xc1dd('0xd')](_0xc1dd('0xe'),_0x25c543,'request\x20sent',JSON[_0xc1dd('0xf')](_0x217d07));if(_0x217d07[_0xc1dd('0x10')]){if(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x11')]===0x1f4){logger[_0xc1dd('0x10')](_0xc1dd('0xb'),_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x411452(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}logger[_0xc1dd('0x10')]('Campaign,\x20%s,\x20%s',_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x54819b(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}else{logger[_0xc1dd('0x13')]('Campaign,\x20%s,\x20%s',_0x25c543,_0xc1dd('0xc'));_0x54819b(_0x217d07[_0xc1dd('0x14')][_0xc1dd('0x12')]);}})[_0xc1dd('0x15')](function(_0x5815d3){logger['error'](_0xc1dd('0xb'),_0x25c543,_0x5815d3);_0x411452(_0x5815d3);});});}exports['GetCampaign']=function(_0x35139a){var _0x4c3114=this;return new Promise(function(_0x6198a7,_0x24446f){return db[_0xc1dd('0x16')][_0xc1dd('0x17')]({'raw':_0x35139a[_0xc1dd('0x18')]?_0x35139a[_0xc1dd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x35139a[_0xc1dd('0x18')]?_0x35139a[_0xc1dd('0x18')]['where']||null:null,'attributes':_0x35139a[_0xc1dd('0x18')]?_0x35139a[_0xc1dd('0x18')][_0xc1dd('0x19')]||null:null,'limit':_0x35139a[_0xc1dd('0x18')]?_0x35139a[_0xc1dd('0x18')][_0xc1dd('0x1a')]||null:null,'include':_0x35139a[_0xc1dd('0x18')]?_0x35139a[_0xc1dd('0x18')]['include']?_[_0xc1dd('0x1b')](_0x35139a[_0xc1dd('0x18')][_0xc1dd('0x1c')],function(_0x3363ff){return{'model':db[_0x3363ff['model']],'as':_0x3363ff['as'],'attributes':_0x3363ff[_0xc1dd('0x19')],'include':_0x3363ff[_0xc1dd('0x1c')]?_[_0xc1dd('0x1b')](_0x3363ff[_0xc1dd('0x1c')],function(_0x16fb8b){return{'model':db[_0x16fb8b[_0xc1dd('0x1d')]],'as':_0x16fb8b['as'],'attributes':_0x16fb8b[_0xc1dd('0x19')],'include':_0x16fb8b[_0xc1dd('0x1c')]?_[_0xc1dd('0x1b')](_0x16fb8b[_0xc1dd('0x1c')],function(_0x1212c3){return{'model':db[_0x1212c3[_0xc1dd('0x1d')]],'as':_0x1212c3['as'],'attributes':_0x1212c3[_0xc1dd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc1dd('0xa')](function(_0x5b8edc){logger['info'](_0xc1dd('0x1e'),_0x35139a);logger[_0xc1dd('0xd')](_0xc1dd('0x1e'),_0x35139a,JSON[_0xc1dd('0xf')](_0x5b8edc));_0x6198a7(_0x5b8edc);})[_0xc1dd('0x15')](function(_0x39b8ac){logger[_0xc1dd('0x10')]('GetCampaign',_0x39b8ac[_0xc1dd('0x12')],_0x35139a);_0x24446f(_0x4c3114[_0xc1dd('0x10')](0x1f4,_0x39b8ac[_0xc1dd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 14043c3..f0e54d0 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 _0x8a62=['removeLists','removeBlackLists','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','clone','addBlackLists','put','delete'];(function(_0x2146e9,_0x192469){var _0x5a3151=function(_0x33ca2a){while(--_0x33ca2a){_0x2146e9['push'](_0x2146e9['shift']());}};_0x5a3151(++_0x192469);}(_0x8a62,0x98));var _0x28a6=function(_0x3a53a0,_0x631292){_0x3a53a0=_0x3a53a0-0x0;var _0x276c2f=_0x8a62[_0x3a53a0];return _0x276c2f;};'use strict';var multer=require('multer');var util=require(_0x28a6('0x0'));var path=require(_0x28a6('0x1'));var timeout=require(_0x28a6('0x2'));var express=require('express');var router=express[_0x28a6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28a6('0x4'));var interaction=require(_0x28a6('0x5'));var config=require(_0x28a6('0x6'));var controller=require(_0x28a6('0x7'));router[_0x28a6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x28a6('0x8')](_0x28a6('0x9'),auth[_0x28a6('0xa')](),controller[_0x28a6('0xb')]);router['get'](_0x28a6('0xc'),auth[_0x28a6('0xa')](),controller[_0x28a6('0xd')]);router[_0x28a6('0x8')](_0x28a6('0xe'),auth[_0x28a6('0xa')](),controller[_0x28a6('0xf')]);router['get'](_0x28a6('0x10'),auth['isAuthenticated'](),controller[_0x28a6('0x11')]);router[_0x28a6('0x8')](_0x28a6('0x12'),auth[_0x28a6('0xa')](),controller[_0x28a6('0x13')]);router[_0x28a6('0x8')](_0x28a6('0x14'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x28a6('0x15'),auth['isAuthenticated'](),controller[_0x28a6('0x16')]);router['post']('/',auth[_0x28a6('0xa')](),controller['create']);router[_0x28a6('0x17')]('/:id/clone',auth[_0x28a6('0xa')](),controller[_0x28a6('0x18')]);router[_0x28a6('0x17')](_0x28a6('0x14'),auth['isAuthenticated'](),controller['addLists']);router[_0x28a6('0x17')]('/:id/blacklists',auth[_0x28a6('0xa')](),controller[_0x28a6('0x19')]);router[_0x28a6('0x1a')](_0x28a6('0x9'),auth[_0x28a6('0xa')](),controller['update']);router[_0x28a6('0x1b')](_0x28a6('0x9'),auth[_0x28a6('0xa')](),controller['destroy']);router[_0x28a6('0x1b')](_0x28a6('0x14'),auth[_0x28a6('0xa')](),controller[_0x28a6('0x1c')]);router[_0x28a6('0x1b')]('/:id/blacklists',auth[_0x28a6('0xa')](),controller[_0x28a6('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x3de8=['getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','update','delete','removeBlackLists','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists'];(function(_0x152c9d,_0x371656){var _0x462f34=function(_0x5a0f6b){while(--_0x5a0f6b){_0x152c9d['push'](_0x152c9d['shift']());}};_0x462f34(++_0x371656);}(_0x3de8,0xe9));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x83de('0x0'));var util=require(_0x83de('0x1'));var path=require('path');var timeout=require(_0x83de('0x2'));var express=require(_0x83de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83de('0x4'));var config=require(_0x83de('0x5'));var controller=require(_0x83de('0x6'));router[_0x83de('0x7')]('/',auth[_0x83de('0x8')](),controller['index']);router[_0x83de('0x7')](_0x83de('0x9'),auth[_0x83de('0x8')](),controller['show']);router['get'](_0x83de('0xa'),auth[_0x83de('0x8')](),controller['getHoppers']);router['get'](_0x83de('0xb'),auth[_0x83de('0x8')](),controller[_0x83de('0xc')]);router[_0x83de('0x7')](_0x83de('0xd'),auth[_0x83de('0x8')](),controller['getHopperFinals']);router[_0x83de('0x7')](_0x83de('0xe'),auth['isAuthenticated'](),controller[_0x83de('0xf')]);router[_0x83de('0x7')](_0x83de('0x10'),auth['isAuthenticated'](),controller[_0x83de('0x11')]);router['get'](_0x83de('0x12'),auth['isAuthenticated'](),controller[_0x83de('0x13')]);router[_0x83de('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x83de('0x14')](_0x83de('0x15'),auth['isAuthenticated'](),controller[_0x83de('0x16')]);router['post']('/:id/lists',auth[_0x83de('0x8')](),controller[_0x83de('0x17')]);router['post'](_0x83de('0x12'),auth['isAuthenticated'](),controller[_0x83de('0x18')]);router['put'](_0x83de('0x9'),auth[_0x83de('0x8')](),controller[_0x83de('0x19')]);router[_0x83de('0x1a')](_0x83de('0x9'),auth[_0x83de('0x8')](),controller['destroy']);router[_0x83de('0x1a')](_0x83de('0x10'),auth[_0x83de('0x8')](),controller['removeLists']);router['delete'](_0x83de('0x12'),auth[_0x83de('0x8')](),controller[_0x83de('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3e25afa..de17357 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 _0x2f56=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x303c89,_0x4702e9){var _0x18debe=function(_0x2a31d7){while(--_0x2a31d7){_0x303c89['push'](_0x303c89['shift']());}};_0x18debe(++_0x4702e9);}(_0x2f56,0x159));var _0x62f5=function(_0x5112ce,_0x23a09f){_0x5112ce=_0x5112ce-0x0;var _0x5bcefa=_0x2f56[_0x5112ce];return _0x5bcefa;};'use strict';var Sequelize=require(_0x62f5('0x0'));module[_0x62f5('0x1')]={'key':{'type':Sequelize[_0x62f5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x62f5('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x62f5('0x2')]},'name':{'type':Sequelize[_0x62f5('0x4')],'get':function(){return this[_0x62f5('0x5')](_0x62f5('0x6'));}}}; \ No newline at end of file +var _0x2424=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2424,0x17d));var _0x4242=function(_0x1ffa19,_0x29347b){_0x1ffa19=_0x1ffa19-0x0;var _0x5d0051=_0x2424[_0x1ffa19];return _0x5d0051;};'use strict';var Sequelize=require(_0x4242('0x0'));module[_0x4242('0x1')]={'key':{'type':Sequelize[_0x4242('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x4242('0x2')]},'name':{'type':Sequelize[_0x4242('0x3')],'get':function(){return this[_0x4242('0x4')](_0x4242('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ceeedef..51b2c72 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 _0xe990=['reject','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','findAll','rows','show','rawAttributes','includeAll','include','options','find','update','body','catch','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0xe990,0x1e8));var _0x0e99=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe990[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x0e99('0x0'));var rimraf=require(_0x0e99('0x1'));var zipdir=require(_0x0e99('0x2'));var jsonpatch=require(_0x0e99('0x3'));var rp=require(_0x0e99('0x4'));var moment=require(_0x0e99('0x5'));var BPromise=require(_0x0e99('0x6'));var Mustache=require(_0x0e99('0x7'));var util=require(_0x0e99('0x8'));var path=require(_0x0e99('0x9'));var sox=require('sox');var csv=require(_0x0e99('0xa'));var ejs=require(_0x0e99('0xb'));var fs=require('fs');var fs_extra=require(_0x0e99('0xc'));var _=require('lodash');var squel=require(_0x0e99('0xd'));var crypto=require('crypto');var jsforce=require(_0x0e99('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e99('0xa'));var querystring=require(_0x0e99('0xf'));var Papa=require(_0x0e99('0x10'));var Redis=require('ioredis');var authService=require(_0x0e99('0x11'));var qs=require(_0x0e99('0x12'));var as=require(_0x0e99('0x13'));var hardwareService=require(_0x0e99('0x14'));var logger=require('../../config/logger')(_0x0e99('0x15'));var utils=require(_0x0e99('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0e99('0x17'));var db=require(_0x0e99('0x18'))['db'];function respondWithStatusCode(_0x2a34a6,_0x1da1a0){_0x1da1a0=_0x1da1a0||0xcc;return function(_0x564e80){if(_0x564e80){return _0x2a34a6['sendStatus'](_0x1da1a0);}return _0x2a34a6[_0x0e99('0x19')](_0x1da1a0)[_0x0e99('0x1a')]();};}function respondWithResult(_0x3451cd,_0x37aa55){_0x37aa55=_0x37aa55||0xc8;return function(_0x30d941){if(_0x30d941){return _0x3451cd[_0x0e99('0x19')](_0x37aa55)[_0x0e99('0x1b')](_0x30d941);}};}function respondWithFilteredResult(_0x279afa,_0x4b3e10){return function(_0x300c65){if(_0x300c65){var _0xd27e30=typeof _0x4b3e10[_0x0e99('0x1c')]==='undefined'&&typeof _0x4b3e10['limit']===_0x0e99('0x1d');var _0x3665d6=_0x300c65['count'];var _0x86352f=_0xd27e30?0x0:_0x4b3e10[_0x0e99('0x1c')];var _0x41b27e=_0xd27e30?_0x300c65[_0x0e99('0x1e')]:_0x4b3e10[_0x0e99('0x1c')]+_0x4b3e10[_0x0e99('0x1f')];var _0xf7a144;if(_0x41b27e>=_0x3665d6){_0x41b27e=_0x3665d6;_0xf7a144=0xc8;}else{_0xf7a144=0xce;}_0x279afa[_0x0e99('0x19')](_0xf7a144);return _0x279afa['set'](_0x0e99('0x20'),_0x86352f+'-'+_0x41b27e+'/'+_0x3665d6)[_0x0e99('0x1b')](_0x300c65);}return null;};}function patchUpdates(_0x2e15e8){return function(_0x3c1164){try{jsonpatch[_0x0e99('0x21')](_0x3c1164,_0x2e15e8,!![]);}catch(_0x4ddc1e){return BPromise[_0x0e99('0x22')](_0x4ddc1e);}return _0x3c1164['save']();};}function saveUpdates(_0x3bfb9e,_0x391d24){return function(_0x3beff1){if(_0x3beff1){return _0x3beff1['update'](_0x3bfb9e)[_0x0e99('0x23')](function(_0x5f32cb){return _0x5f32cb;});}return null;};}function removeEntity(_0x3a5d8c,_0x5b876c){return function(_0x54db21){if(_0x54db21){return _0x54db21[_0x0e99('0x24')]()[_0x0e99('0x23')](function(){var _0x37193b=_0x54db21[_0x0e99('0x25')]({'plain':!![]});var _0xbe2b41=_0x0e99('0x26');return db[_0x0e99('0x27')][_0x0e99('0x24')]({'where':{'type':_0xbe2b41,'resourceId':_0x37193b['id']}})[_0x0e99('0x23')](function(){return _0x54db21;});})[_0x0e99('0x23')](function(){_0x3a5d8c[_0x0e99('0x19')](0xcc)[_0x0e99('0x1a')]();});}};}function handleEntityNotFound(_0xe529e5,_0xf8bc75){return function(_0x5901f7){if(!_0x5901f7){_0xe529e5[_0x0e99('0x28')](0x194);}return _0x5901f7;};}function handleError(_0x500786,_0x4b7792){_0x4b7792=_0x4b7792||0x1f4;return function(_0x545a4c){logger['error'](_0x545a4c[_0x0e99('0x29')]);if(_0x545a4c[_0x0e99('0x2a')]){delete _0x545a4c[_0x0e99('0x2a')];}_0x500786[_0x0e99('0x19')](_0x4b7792)['send'](_0x545a4c);};}exports[_0x0e99('0x2b')]=function(_0x1852ac,_0x38ac80){var _0x437280={},_0x143a3e={},_0x64a5ad={'count':0x0,'rows':[]};var _0x1f7fb8=_[_0x0e99('0x2c')](db[_0x0e99('0x2d')]['rawAttributes'],function(_0x151de7){return{'name':_0x151de7[_0x0e99('0x2e')],'type':_0x151de7[_0x0e99('0x2f')]['key']};});_0x143a3e[_0x0e99('0x30')]=_['map'](_0x1f7fb8,'name');_0x143a3e[_0x0e99('0x31')]=_[_0x0e99('0x32')](_0x1852ac[_0x0e99('0x31')]);_0x143a3e[_0x0e99('0x33')]=_[_0x0e99('0x34')](_0x143a3e[_0x0e99('0x30')],_0x143a3e[_0x0e99('0x31')]);_0x437280[_0x0e99('0x35')]=_[_0x0e99('0x34')](_0x143a3e[_0x0e99('0x30')],qs[_0x0e99('0x36')](_0x1852ac[_0x0e99('0x31')][_0x0e99('0x36')]));_0x437280[_0x0e99('0x35')]=_0x437280[_0x0e99('0x35')][_0x0e99('0x37')]?_0x437280['attributes']:_0x143a3e[_0x0e99('0x30')];if(!_0x1852ac[_0x0e99('0x31')]['hasOwnProperty'](_0x0e99('0x38'))){_0x437280[_0x0e99('0x1f')]=qs['limit'](_0x1852ac[_0x0e99('0x31')][_0x0e99('0x1f')]);_0x437280[_0x0e99('0x1c')]=qs['offset'](_0x1852ac['query'][_0x0e99('0x1c')]);}_0x437280['order']=qs[_0x0e99('0x39')](_0x1852ac[_0x0e99('0x31')]['sort']);_0x437280['where']=qs[_0x0e99('0x33')](_['pick'](_0x1852ac['query'],_0x143a3e['filters']),_0x1f7fb8);if(_0x1852ac['query'][_0x0e99('0x3a')]){_0x437280['where']=_[_0x0e99('0x3b')](_0x437280[_0x0e99('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1852ac[_0x0e99('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x1852ac[_0x0e99('0x31')]['filter']+'%'}}]});}_0x437280=_[_0x0e99('0x3b')]({},_0x437280,_0x1852ac['options']);var _0x1dd34e={'where':_0x437280[_0x0e99('0x3c')]};return db[_0x0e99('0x2d')][_0x0e99('0x1e')](_0x1dd34e)[_0x0e99('0x23')](function(_0x447162){_0x64a5ad['count']=_0x447162;if(_0x1852ac[_0x0e99('0x31')]['includeAll']){_0x437280['include']=[{'all':!![]}];}return db[_0x0e99('0x2d')][_0x0e99('0x3d')](_0x437280);})['then'](function(_0x145924){_0x64a5ad[_0x0e99('0x3e')]=_0x145924;return _0x64a5ad;})['then'](respondWithFilteredResult(_0x38ac80,_0x437280))['catch'](handleError(_0x38ac80,null));};exports[_0x0e99('0x3f')]=function(_0x50b892,_0x20a72f){var _0x830200={'raw':!![],'where':{'id':_0x50b892['params']['id']}},_0x247b94={};_0x247b94[_0x0e99('0x30')]=_[_0x0e99('0x32')](db[_0x0e99('0x2d')][_0x0e99('0x40')]);_0x247b94['query']=_[_0x0e99('0x32')](_0x50b892[_0x0e99('0x31')]);_0x247b94[_0x0e99('0x33')]=_[_0x0e99('0x34')](_0x247b94[_0x0e99('0x30')],_0x247b94[_0x0e99('0x31')]);_0x830200['attributes']=_[_0x0e99('0x34')](_0x247b94[_0x0e99('0x30')],qs[_0x0e99('0x36')](_0x50b892[_0x0e99('0x31')]['fields']));_0x830200[_0x0e99('0x35')]=_0x830200['attributes'][_0x0e99('0x37')]?_0x830200['attributes']:_0x247b94[_0x0e99('0x30')];if(_0x50b892[_0x0e99('0x31')][_0x0e99('0x41')]){_0x830200[_0x0e99('0x42')]=[{'all':!![]}];}_0x830200=_[_0x0e99('0x3b')]({},_0x830200,_0x50b892[_0x0e99('0x43')]);return db[_0x0e99('0x2d')][_0x0e99('0x44')](_0x830200)['then'](handleEntityNotFound(_0x20a72f,null))[_0x0e99('0x23')](respondWithResult(_0x20a72f,null))['catch'](handleError(_0x20a72f,null));};exports[_0x0e99('0x45')]=function(_0x398b46,_0x5295eb){if(_0x398b46[_0x0e99('0x46')]['id']){delete _0x398b46['body']['id'];}return db['CannedAnswer'][_0x0e99('0x44')]({'where':{'id':_0x398b46['params']['id']}})['then'](handleEntityNotFound(_0x5295eb,null))[_0x0e99('0x23')](saveUpdates(_0x398b46[_0x0e99('0x46')],null))[_0x0e99('0x23')](respondWithResult(_0x5295eb,null))[_0x0e99('0x47')](handleError(_0x5295eb,null));};exports[_0x0e99('0x24')]=function(_0x469a21,_0x914203){return db[_0x0e99('0x2d')][_0x0e99('0x44')]({'where':{'id':_0x469a21[_0x0e99('0x48')]['id']}})['then'](handleEntityNotFound(_0x914203,null))['then'](removeEntity(_0x914203,null))[_0x0e99('0x47')](handleError(_0x914203,null));};exports['create']=function(_0x3fc7d3,_0x5aaf74){var _0x1596fd={'key':_0x3fc7d3[_0x0e99('0x46')]['key']};if(_0x3fc7d3[_0x0e99('0x46')][_0x0e99('0x49')]){_0x1596fd[_0x0e99('0x49')]=_0x3fc7d3[_0x0e99('0x46')][_0x0e99('0x49')];}else if(_0x3fc7d3[_0x0e99('0x46')]['SmsAccountId']){_0x1596fd[_0x0e99('0x4a')]=_0x3fc7d3['body'][_0x0e99('0x4a')];}else if(_0x3fc7d3['body'][_0x0e99('0x4b')]){_0x1596fd[_0x0e99('0x4b')]=_0x3fc7d3['body'][_0x0e99('0x4b')];}else if(_0x3fc7d3['body'][_0x0e99('0x4c')]){_0x1596fd[_0x0e99('0x4c')]=_0x3fc7d3['body'][_0x0e99('0x4c')];}return db['CannedAnswer']['find']({'where':_0x1596fd})[_0x0e99('0x23')](function(_0x23cf34){if(_0x23cf34){throw new db[(_0x0e99('0x4d'))][(_0x0e99('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x0e99('0x2d')][_0x0e99('0x4f')](_0x3fc7d3['body']);})[_0x0e99('0x23')](function(_0x3a2382){var _0x2c819a=_0x3fc7d3[_0x0e99('0x50')][_0x0e99('0x25')]({'plain':!![]});if(!_0x2c819a)throw new Error(_0x0e99('0x51'));if(_0x2c819a[_0x0e99('0x52')]===_0x0e99('0x50')){var _0x4a597d=_0x3a2382[_0x0e99('0x25')]({'plain':!![]});return db[_0x0e99('0x53')][_0x0e99('0x44')]({'where':{'name':'CannedAnswers','userProfileId':_0x2c819a['userProfileId']},'raw':!![]})[_0x0e99('0x23')](function(_0x18b450){if(_0x18b450&&_0x18b450[_0x0e99('0x54')]===0x0){return db[_0x0e99('0x27')][_0x0e99('0x4f')]({'name':_0x4a597d[_0x0e99('0x2a')],'resourceId':_0x4a597d['id'],'type':_0x18b450[_0x0e99('0x2a')],'sectionId':_0x18b450['id']},{})[_0x0e99('0x23')](function(){return _0x3a2382;});}else{return _0x3a2382;}})[_0x0e99('0x47')](function(_0x2a7f50){logger[_0x0e99('0x55')](_0x0e99('0x56'),_0x2a7f50);throw _0x2a7f50;});}return _0x3a2382;})[_0x0e99('0x23')](respondWithResult(_0x5aaf74,0xc9))[_0x0e99('0x47')](handleError(_0x5aaf74,null));}; \ No newline at end of file +var _0xd342=['model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','CannedAnswer','includeAll','include','findAll','rows','catch','show','keys','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','rawAttributes','fieldName','type','key'];(function(_0x51c354,_0x11e319){var _0x45e16a=function(_0x1d15aa){while(--_0x1d15aa){_0x51c354['push'](_0x51c354['shift']());}};_0x45e16a(++_0x11e319);}(_0xd342,0x12d));var _0x2d34=function(_0x357c7d,_0x46f4f8){_0x357c7d=_0x357c7d-0x0;var _0x2f2f9a=_0xd342[_0x357c7d];return _0x2f2f9a;};'use strict';var emlformat=require(_0x2d34('0x0'));var rimraf=require(_0x2d34('0x1'));var zipdir=require(_0x2d34('0x2'));var jsonpatch=require(_0x2d34('0x3'));var rp=require(_0x2d34('0x4'));var moment=require(_0x2d34('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d34('0x6'));var util=require(_0x2d34('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d34('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d34('0x9'));var squel=require(_0x2d34('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d34('0xb'));var deskjs=require(_0x2d34('0xc'));var toCsv=require(_0x2d34('0xd'));var querystring=require(_0x2d34('0xe'));var Papa=require(_0x2d34('0xf'));var Redis=require(_0x2d34('0x10'));var authService=require(_0x2d34('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d34('0x12'));var hardwareService=require(_0x2d34('0x13'));var logger=require(_0x2d34('0x14'))(_0x2d34('0x15'));var utils=require(_0x2d34('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2d34('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54667e,_0x454d26){_0x454d26=_0x454d26||0xcc;return function(_0xe59808){if(_0xe59808){return _0x54667e[_0x2d34('0x18')](_0x454d26);}return _0x54667e['status'](_0x454d26)[_0x2d34('0x19')]();};}function respondWithResult(_0x5db22b,_0x4793c4){_0x4793c4=_0x4793c4||0xc8;return function(_0x2d4268){if(_0x2d4268){return _0x5db22b[_0x2d34('0x1a')](_0x4793c4)[_0x2d34('0x1b')](_0x2d4268);}};}function respondWithFilteredResult(_0x211611,_0x166518){return function(_0x118815){if(_0x118815){var _0x50c78c=typeof _0x166518[_0x2d34('0x1c')]===_0x2d34('0x1d')&&typeof _0x166518[_0x2d34('0x1e')]==='undefined';var _0x4e54c9=_0x118815[_0x2d34('0x1f')];var _0x5340c6=_0x50c78c?0x0:_0x166518[_0x2d34('0x1c')];var _0x346798=_0x50c78c?_0x118815[_0x2d34('0x1f')]:_0x166518[_0x2d34('0x1c')]+_0x166518[_0x2d34('0x1e')];var _0x280cdb;if(_0x346798>=_0x4e54c9){_0x346798=_0x4e54c9;_0x280cdb=0xc8;}else{_0x280cdb=0xce;}_0x211611[_0x2d34('0x1a')](_0x280cdb);return _0x211611[_0x2d34('0x20')](_0x2d34('0x21'),_0x5340c6+'-'+_0x346798+'/'+_0x4e54c9)['json'](_0x118815);}return null;};}function patchUpdates(_0x5d92ea){return function(_0x1f8802){try{jsonpatch[_0x2d34('0x22')](_0x1f8802,_0x5d92ea,!![]);}catch(_0x4c38ac){return BPromise['reject'](_0x4c38ac);}return _0x1f8802['save']();};}function saveUpdates(_0x7481a0,_0x102075){return function(_0x48d43d){if(_0x48d43d){return _0x48d43d[_0x2d34('0x23')](_0x7481a0)[_0x2d34('0x24')](function(_0x28d726){return _0x28d726;});}return null;};}function removeEntity(_0x5d1138,_0x5d3a00){return function(_0x2162ae){if(_0x2162ae){return _0x2162ae[_0x2d34('0x25')]()[_0x2d34('0x24')](function(){var _0x2dcd08=_0x2162ae[_0x2d34('0x26')]({'plain':!![]});var _0x3a7a97='CannedAnswers';return db[_0x2d34('0x27')]['destroy']({'where':{'type':_0x3a7a97,'resourceId':_0x2dcd08['id']}})[_0x2d34('0x24')](function(){return _0x2162ae;});})[_0x2d34('0x24')](function(){_0x5d1138[_0x2d34('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x84bbcf,_0x104693){return function(_0x28c5b0){if(!_0x28c5b0){_0x84bbcf[_0x2d34('0x18')](0x194);}return _0x28c5b0;};}function handleError(_0x375fe5,_0x8180e3){_0x8180e3=_0x8180e3||0x1f4;return function(_0x297fb1){logger[_0x2d34('0x28')](_0x297fb1[_0x2d34('0x29')]);if(_0x297fb1['name']){delete _0x297fb1[_0x2d34('0x2a')];}_0x375fe5[_0x2d34('0x1a')](_0x8180e3)['send'](_0x297fb1);};}exports['index']=function(_0x5b602b,_0x206605){var _0x361012={},_0x1ccb41={},_0x3b9256={'count':0x0,'rows':[]};var _0x16d789=_['map'](db['CannedAnswer'][_0x2d34('0x2b')],function(_0x28fbc0){return{'name':_0x28fbc0[_0x2d34('0x2c')],'type':_0x28fbc0[_0x2d34('0x2d')][_0x2d34('0x2e')]};});_0x1ccb41[_0x2d34('0x2f')]=_['map'](_0x16d789,_0x2d34('0x2a'));_0x1ccb41['query']=_['keys'](_0x5b602b['query']);_0x1ccb41[_0x2d34('0x30')]=_[_0x2d34('0x31')](_0x1ccb41[_0x2d34('0x2f')],_0x1ccb41[_0x2d34('0x32')]);_0x361012[_0x2d34('0x33')]=_[_0x2d34('0x31')](_0x1ccb41['model'],qs[_0x2d34('0x34')](_0x5b602b['query'][_0x2d34('0x34')]));_0x361012[_0x2d34('0x33')]=_0x361012[_0x2d34('0x33')][_0x2d34('0x35')]?_0x361012['attributes']:_0x1ccb41[_0x2d34('0x2f')];if(!_0x5b602b[_0x2d34('0x32')][_0x2d34('0x36')](_0x2d34('0x37'))){_0x361012['limit']=qs[_0x2d34('0x1e')](_0x5b602b['query'][_0x2d34('0x1e')]);_0x361012['offset']=qs[_0x2d34('0x1c')](_0x5b602b[_0x2d34('0x32')][_0x2d34('0x1c')]);}_0x361012[_0x2d34('0x38')]=qs[_0x2d34('0x39')](_0x5b602b[_0x2d34('0x32')][_0x2d34('0x39')]);_0x361012['where']=qs['filters'](_[_0x2d34('0x3a')](_0x5b602b['query'],_0x1ccb41[_0x2d34('0x30')]),_0x16d789);if(_0x5b602b[_0x2d34('0x32')][_0x2d34('0x3b')]){_0x361012[_0x2d34('0x3c')]=_[_0x2d34('0x3d')](_0x361012[_0x2d34('0x3c')],{'$or':[{'key':{'$like':'%'+_0x5b602b[_0x2d34('0x32')][_0x2d34('0x3b')]+'%'}},{'value':{'$like':'%'+_0x5b602b['query'][_0x2d34('0x3b')]+'%'}}]});}_0x361012=_[_0x2d34('0x3d')]({},_0x361012,_0x5b602b['options']);var _0x3dcd58={'where':_0x361012[_0x2d34('0x3c')]};return db[_0x2d34('0x3e')][_0x2d34('0x1f')](_0x3dcd58)['then'](function(_0x31aae6){_0x3b9256[_0x2d34('0x1f')]=_0x31aae6;if(_0x5b602b[_0x2d34('0x32')][_0x2d34('0x3f')]){_0x361012[_0x2d34('0x40')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2d34('0x41')](_0x361012);})[_0x2d34('0x24')](function(_0x8e7435){_0x3b9256[_0x2d34('0x42')]=_0x8e7435;return _0x3b9256;})[_0x2d34('0x24')](respondWithFilteredResult(_0x206605,_0x361012))[_0x2d34('0x43')](handleError(_0x206605,null));};exports[_0x2d34('0x44')]=function(_0x1460dc,_0x5bf3cb){var _0x8a5cc4={'raw':!![],'where':{'id':_0x1460dc['params']['id']}},_0x236cf3={};_0x236cf3[_0x2d34('0x2f')]=_[_0x2d34('0x45')](db[_0x2d34('0x3e')][_0x2d34('0x2b')]);_0x236cf3['query']=_[_0x2d34('0x45')](_0x1460dc['query']);_0x236cf3['filters']=_[_0x2d34('0x31')](_0x236cf3[_0x2d34('0x2f')],_0x236cf3[_0x2d34('0x32')]);_0x8a5cc4[_0x2d34('0x33')]=_[_0x2d34('0x31')](_0x236cf3[_0x2d34('0x2f')],qs['fields'](_0x1460dc[_0x2d34('0x32')][_0x2d34('0x34')]));_0x8a5cc4[_0x2d34('0x33')]=_0x8a5cc4[_0x2d34('0x33')][_0x2d34('0x35')]?_0x8a5cc4[_0x2d34('0x33')]:_0x236cf3[_0x2d34('0x2f')];if(_0x1460dc[_0x2d34('0x32')][_0x2d34('0x3f')]){_0x8a5cc4['include']=[{'all':!![]}];}_0x8a5cc4=_[_0x2d34('0x3d')]({},_0x8a5cc4,_0x1460dc['options']);return db['CannedAnswer'][_0x2d34('0x46')](_0x8a5cc4)[_0x2d34('0x24')](handleEntityNotFound(_0x5bf3cb,null))[_0x2d34('0x24')](respondWithResult(_0x5bf3cb,null))[_0x2d34('0x43')](handleError(_0x5bf3cb,null));};exports[_0x2d34('0x23')]=function(_0x307cde,_0x5e92f6){if(_0x307cde[_0x2d34('0x47')]['id']){delete _0x307cde['body']['id'];}return db[_0x2d34('0x3e')]['find']({'where':{'id':_0x307cde[_0x2d34('0x48')]['id']}})[_0x2d34('0x24')](handleEntityNotFound(_0x5e92f6,null))[_0x2d34('0x24')](saveUpdates(_0x307cde[_0x2d34('0x47')],null))[_0x2d34('0x24')](respondWithResult(_0x5e92f6,null))['catch'](handleError(_0x5e92f6,null));};exports[_0x2d34('0x25')]=function(_0x19e9b0,_0x421cd8){return db['CannedAnswer']['find']({'where':{'id':_0x19e9b0[_0x2d34('0x48')]['id']}})['then'](handleEntityNotFound(_0x421cd8,null))[_0x2d34('0x24')](removeEntity(_0x421cd8,null))['catch'](handleError(_0x421cd8,null));};exports[_0x2d34('0x49')]=function(_0x1a3633,_0x4b23a4){var _0x3d0603={'key':_0x1a3633['body'][_0x2d34('0x2e')]};if(_0x1a3633[_0x2d34('0x47')]['MailAccountId']){_0x3d0603[_0x2d34('0x4a')]=_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4a')];}else if(_0x1a3633[_0x2d34('0x47')]['SmsAccountId']){_0x3d0603['SmsAccountId']=_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4b')];}else if(_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4c')]){_0x3d0603['OpenchannelAccountId']=_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4c')];}else if(_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4d')]){_0x3d0603[_0x2d34('0x4d')]=_0x1a3633[_0x2d34('0x47')][_0x2d34('0x4d')];}return db[_0x2d34('0x3e')]['find']({'where':_0x3d0603})[_0x2d34('0x24')](function(_0x24a06c){if(_0x24a06c){throw new db[(_0x2d34('0x4e'))]['ValidationError'](_0x2d34('0x4f'));}return db[_0x2d34('0x3e')]['create'](_0x1a3633['body']);})['then'](function(_0x33cea2){var _0x23f4c2=_0x1a3633[_0x2d34('0x50')][_0x2d34('0x26')]({'plain':!![]});if(!_0x23f4c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f4c2[_0x2d34('0x51')]===_0x2d34('0x50')){var _0x12544c=_0x33cea2['get']({'plain':!![]});return db[_0x2d34('0x52')][_0x2d34('0x46')]({'where':{'name':_0x2d34('0x53'),'userProfileId':_0x23f4c2[_0x2d34('0x54')]},'raw':!![]})[_0x2d34('0x24')](function(_0x59b157){if(_0x59b157&&_0x59b157[_0x2d34('0x55')]===0x0){return db[_0x2d34('0x27')][_0x2d34('0x49')]({'name':_0x12544c['name'],'resourceId':_0x12544c['id'],'type':_0x59b157['name'],'sectionId':_0x59b157['id']},{})['then'](function(){return _0x33cea2;});}else{return _0x33cea2;}})[_0x2d34('0x43')](function(_0x2b5e14){logger['error'](_0x2d34('0x56'),_0x2b5e14);throw _0x2b5e14;});}return _0x33cea2;})[_0x2d34('0x24')](respondWithResult(_0x4b23a4,0xc9))[_0x2d34('0x43')](handleError(_0x4b23a4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9eee018..5b245c4 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 _0x10ff=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','lodash','api','moment'];(function(_0x87cd78,_0x1fa259){var _0x12b1f5=function(_0x3d55bf){while(--_0x3d55bf){_0x87cd78['push'](_0x87cd78['shift']());}};_0x12b1f5(++_0x1fa259);}(_0x10ff,0x1b5));var _0xf10f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x10ff[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf10f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf10f('0x1'));var moment=require(_0xf10f('0x2'));var BPromise=require('bluebird');var rp=require(_0xf10f('0x3'));var fs=require('fs');var path=require(_0xf10f('0x4'));var rimraf=require(_0xf10f('0x5'));var config=require(_0xf10f('0x6'));var attributes=require(_0xf10f('0x7'));module[_0xf10f('0x8')]=function(_0x12186e,_0x38820d){return _0x12186e[_0xf10f('0x9')](_0xf10f('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x12ed=['exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x458586,_0x85fbee){var _0x23c612=function(_0x59cebb){while(--_0x59cebb){_0x458586['push'](_0x458586['shift']());}};_0x23c612(++_0x85fbee);}(_0x12ed,0x1d9));var _0xd12e=function(_0x35ade4,_0x4e3cfa){_0x35ade4=_0x35ade4-0x0;var _0x274e32=_0x12ed[_0x35ade4];return _0x274e32;};'use strict';var _=require(_0xd12e('0x0'));var util=require(_0xd12e('0x1'));var logger=require('../../config/logger')(_0xd12e('0x2'));var moment=require(_0xd12e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd12e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd12e('0x5'));var config=require(_0xd12e('0x6'));var attributes=require(_0xd12e('0x7'));module[_0xd12e('0x8')]=function(_0x474cdb,_0x143019){return _0x474cdb[_0xd12e('0x9')]('CannedAnswer',attributes,{'tableName':_0xd12e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd12e('0xb'),'collate':_0xd12e('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7590ac9..3c5102f 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(_0x339101,_0x15dd25){var _0x426e7a=function(_0x53596a){while(--_0x53596a){_0x339101['push'](_0x339101['shift']());}};_0x426e7a(++_0x15dd25);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x1b8ed8,_0x4b2629){var _0x2248c9=function(_0x3755f7){while(--_0x3755f7){_0x1b8ed8['push'](_0x1b8ed8['shift']());}};_0x2248c9(++_0x4b2629);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 d3b0653..fdec471 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 _0xaed0=['show','post','create','put','update','destroy','exports','multer','path','Router','../../components/auth/service','./cannedAnswer.controller','isAuthenticated','index','get','/:id'];(function(_0x809bb1,_0x25f72e){var _0x1a762a=function(_0x146da8){while(--_0x146da8){_0x809bb1['push'](_0x809bb1['shift']());}};_0x1a762a(++_0x25f72e);}(_0xaed0,0x1e7));var _0x0aed=function(_0x21278c,_0x3bb264){_0x21278c=_0x21278c-0x0;var _0x19679b=_0xaed0[_0x21278c];return _0x19679b;};'use strict';var multer=require(_0x0aed('0x0'));var util=require('util');var path=require(_0x0aed('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0aed('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0aed('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0aed('0x4'));router['get']('/',auth[_0x0aed('0x5')](),controller[_0x0aed('0x6')]);router[_0x0aed('0x7')](_0x0aed('0x8'),auth[_0x0aed('0x5')](),controller[_0x0aed('0x9')]);router[_0x0aed('0xa')]('/',auth[_0x0aed('0x5')](),controller[_0x0aed('0xb')]);router[_0x0aed('0xc')](_0x0aed('0x8'),auth[_0x0aed('0x5')](),controller[_0x0aed('0xd')]);router['delete'](_0x0aed('0x8'),auth[_0x0aed('0x5')](),controller[_0x0aed('0xe')]);module[_0x0aed('0xf')]=router; \ No newline at end of file +var _0x87a8=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x2cf891,_0x54171b){var _0x307493=function(_0x4acd75){while(--_0x4acd75){_0x2cf891['push'](_0x2cf891['shift']());}};_0x307493(++_0x54171b);}(_0x87a8,0x1b8));var _0x887a=function(_0x11239b,_0xdfd2b0){_0x11239b=_0x11239b-0x0;var _0x1d51c4=_0x87a8[_0x11239b];return _0x1d51c4;};'use strict';var multer=require(_0x887a('0x0'));var util=require('util');var path=require(_0x887a('0x1'));var timeout=require(_0x887a('0x2'));var express=require(_0x887a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x887a('0x4'));var interaction=require(_0x887a('0x5'));var config=require(_0x887a('0x6'));var controller=require(_0x887a('0x7'));router[_0x887a('0x8')]('/',auth['isAuthenticated'](),controller[_0x887a('0x9')]);router[_0x887a('0x8')](_0x887a('0xa'),auth[_0x887a('0xb')](),controller['show']);router[_0x887a('0xc')]('/',auth[_0x887a('0xb')](),controller[_0x887a('0xd')]);router[_0x887a('0xe')](_0x887a('0xa'),auth[_0x887a('0xb')](),controller[_0x887a('0xf')]);router[_0x887a('0x10')](_0x887a('0xa'),auth[_0x887a('0xb')](),controller[_0x887a('0x11')]);module[_0x887a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e13605c..006825a 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 _0xc17f=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x3dad31,_0x56532e){var _0x5e9cb3=function(_0x3cb6c4){while(--_0x3cb6c4){_0x3dad31['push'](_0x3dad31['shift']());}};_0x5e9cb3(++_0x56532e);}(_0xc17f,0xb8));var _0xfc17=function(_0x540cdd,_0x45bd54){_0x540cdd=_0x540cdd-0x0;var _0x2f976e=_0xc17f[_0x540cdd];return _0x2f976e;};'use strict';var Sequelize=require(_0xfc17('0x0'));module[_0xfc17('0x1')]={'calldate':{'type':Sequelize[_0xfc17('0x2')],'allowNull':![],'defaultValue':_0xfc17('0x3')},'clid':{'type':Sequelize[_0xfc17('0x4')]},'src':{'type':Sequelize[_0xfc17('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xfc17('0x4')]},'channel':{'type':Sequelize[_0xfc17('0x4')]},'dstchannel':{'type':Sequelize[_0xfc17('0x4')]},'lastapp':{'type':Sequelize[_0xfc17('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xfc17('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfc17('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfc17('0x4')]},'amaflags':{'type':Sequelize[_0xfc17('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfc17('0x4')]},'userfield':{'type':Sequelize[_0xfc17('0x4')]},'uniqueid':{'type':Sequelize[_0xfc17('0x4')]},'linkedid':{'type':Sequelize[_0xfc17('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xfc17('0x4')]},'type':{'type':Sequelize[_0xfc17('0x4')]},'tag':{'type':Sequelize[_0xfc17('0x4')]}}; \ No newline at end of file +var _0xde9f=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xde9f,0x16d));var _0xfde9=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xde9f[_0x52666e];return _0x515330;};'use strict';var Sequelize=require(_0xfde9('0x0'));module[_0xfde9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xfde9('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xfde9('0x3')]},'dst':{'type':Sequelize[_0xfde9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfde9('0x3')]},'dstchannel':{'type':Sequelize[_0xfde9('0x3')]},'lastapp':{'type':Sequelize[_0xfde9('0x3')]},'lastdata':{'type':Sequelize[_0xfde9('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfde9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfde9('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfde9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xfde9('0x3')]},'peeraccount':{'type':Sequelize[_0xfde9('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xfde9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d9d6471..d411e18 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 _0xbacd=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x45236e,_0x137377){var _0x3c528d=function(_0x1bb977){while(--_0x1bb977){_0x45236e['push'](_0x45236e['shift']());}};_0x3c528d(++_0x137377);}(_0xbacd,0x1c5));var _0xdbac=function(_0x33eae5,_0x22b51d){_0x33eae5=_0x33eae5-0x0;var _0x56b25c=_0xbacd[_0x33eae5];return _0x56b25c;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x2b4cda,_0x3a0f3f){return function(_0x15653d){if(!_0x15653d){_0x2b4cda[_0xdbac('0x1b')](0x194);}return _0x15653d;};}function handleError(_0x175ebc,_0x2cb8b4){_0x2cb8b4=_0x2cb8b4||0x1f4;return function(_0x1ea3c3){logger[_0xdbac('0x29')](_0x1ea3c3[_0xdbac('0x2a')]);if(_0x1ea3c3[_0xdbac('0x2b')]){delete _0x1ea3c3[_0xdbac('0x2b')];}_0x175ebc[_0xdbac('0x1d')](_0x2cb8b4)[_0xdbac('0x2c')](_0x1ea3c3);};}exports[_0xdbac('0x2d')]=function(_0xe744cc,_0x1caa18){var _0x4e7ef9={},_0x446a32={},_0x397f3d={'count':0x0,'rows':[]};var _0x43c0a3=_[_0xdbac('0x2e')](db['Cdr']['rawAttributes'],function(_0x10c3c8){return{'name':_0x10c3c8[_0xdbac('0x2f')],'type':_0x10c3c8[_0xdbac('0x30')][_0xdbac('0x31')]};});_0x446a32['model']=_[_0xdbac('0x2e')](_0x43c0a3,_0xdbac('0x2b'));_0x446a32[_0xdbac('0x32')]=_[_0xdbac('0x33')](_0xe744cc[_0xdbac('0x32')]);_0x446a32[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],_0x446a32['query']);_0x4e7ef9['attributes']=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0xe744cc[_0xdbac('0x32')]['fields']));_0x4e7ef9['attributes']=_0x4e7ef9[_0xdbac('0x38')][_0xdbac('0x39')]?_0x4e7ef9[_0xdbac('0x38')]:_0x446a32[_0xdbac('0x36')];if(!_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3a')](_0xdbac('0x3b'))){_0x4e7ef9[_0xdbac('0x22')]=qs[_0xdbac('0x22')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x22')]);_0x4e7ef9[_0xdbac('0x1f')]=qs[_0xdbac('0x1f')](_0xe744cc['query'][_0xdbac('0x1f')]);}_0x4e7ef9['order']=qs[_0xdbac('0x3c')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3c')]);_0x4e7ef9[_0xdbac('0x3d')]=qs['filters'](_[_0xdbac('0x3e')](_0xe744cc[_0xdbac('0x32')],_0x446a32['filters']),_0x43c0a3);if(_0xe744cc['query'][_0xdbac('0x3f')]){_0x4e7ef9['where']=_['merge'](_0x4e7ef9[_0xdbac('0x3d')],{'$or':_[_0xdbac('0x2e')](_0x43c0a3,function(_0x6c5ecc){if(_0x6c5ecc['type']!==_0xdbac('0x40')){var _0x35f8b7={};_0x35f8b7[_0x6c5ecc[_0xdbac('0x2b')]]={'$like':'%'+_0xe744cc[_0xdbac('0x32')]['filter']+'%'};return _0x35f8b7;}})});}_0x4e7ef9=_['merge']({},_0x4e7ef9,_0xe744cc[_0xdbac('0x41')]);var _0x124904={'where':_0x4e7ef9[_0xdbac('0x3d')]};return db[_0xdbac('0x42')][_0xdbac('0x21')](_0x124904)['then'](function(_0x1a27a4){_0x397f3d[_0xdbac('0x21')]=_0x1a27a4;if(_0xe744cc['query'][_0xdbac('0x43')]){_0x4e7ef9[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x42')][_0xdbac('0x45')](_0x4e7ef9);})[_0xdbac('0x27')](function(_0x575b59){_0x397f3d[_0xdbac('0x46')]=_0x575b59;return _0x397f3d;})[_0xdbac('0x27')](respondWithFilteredResult(_0x1caa18,_0x4e7ef9))[_0xdbac('0x47')](handleError(_0x1caa18,null));};exports[_0xdbac('0x48')]=function(_0x726ba4,_0x25344a){var _0x2589e1={'raw':!![],'where':{'id':_0x726ba4[_0xdbac('0x49')]['id']}},_0x3c1894={};_0x3c1894[_0xdbac('0x36')]=_[_0xdbac('0x33')](db[_0xdbac('0x42')]['rawAttributes']);_0x3c1894['query']=_['keys'](_0x726ba4['query']);_0x3c1894[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],_0x3c1894[_0xdbac('0x32')]);_0x2589e1[_0xdbac('0x38')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0x726ba4[_0xdbac('0x32')]['fields']));_0x2589e1['attributes']=_0x2589e1['attributes'][_0xdbac('0x39')]?_0x2589e1[_0xdbac('0x38')]:_0x3c1894['model'];if(_0x726ba4['query']['includeAll']){_0x2589e1[_0xdbac('0x44')]=[{'all':!![]}];}_0x2589e1=_[_0xdbac('0x4a')]({},_0x2589e1,_0x726ba4[_0xdbac('0x41')]);return db['Cdr'][_0xdbac('0x4b')](_0x2589e1)[_0xdbac('0x27')](handleEntityNotFound(_0x25344a,null))[_0xdbac('0x27')](respondWithResult(_0x25344a,null))[_0xdbac('0x47')](handleError(_0x25344a,null));};exports[_0xdbac('0x4c')]=function(_0x5b8aca,_0x35696f){return db[_0xdbac('0x42')][_0xdbac('0x4c')](_0x5b8aca[_0xdbac('0x4d')],{})['then'](respondWithResult(_0x35696f,0xc9))[_0xdbac('0x47')](handleError(_0x35696f,null));};exports[_0xdbac('0x26')]=function(_0x1463ca,_0x5d6e86){if(_0x1463ca[_0xdbac('0x4d')]['id']){delete _0x1463ca[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x42')][_0xdbac('0x4b')]({'where':{'id':_0x1463ca[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x5d6e86,null))['then'](saveUpdates(_0x1463ca[_0xdbac('0x4d')],null))[_0xdbac('0x27')](respondWithResult(_0x5d6e86,null))['catch'](handleError(_0x5d6e86,null));};exports[_0xdbac('0x28')]=function(_0x12b600,_0x26ee2e){return db[_0xdbac('0x42')]['find']({'where':{'id':_0x12b600['params']['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x26ee2e,null))[_0xdbac('0x27')](removeEntity(_0x26ee2e,null))['catch'](handleError(_0x26ee2e,null));};exports['describe']=function(_0x3f0b35,_0x538747){return db[_0xdbac('0x42')][_0xdbac('0x4e')]()[_0xdbac('0x27')](respondWithResult(_0x538747,null))['catch'](handleError(_0x538747,null));}; \ No newline at end of file +var _0x9c5a=['order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','Cdr','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x22f9a1,_0x20a035){var _0x6f5014=function(_0x22d325){while(--_0x22d325){_0x22f9a1['push'](_0x22f9a1['shift']());}};_0x6f5014(++_0x20a035);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x56c23f,_0xcb8fad){_0x56c23f=_0x56c23f-0x0;var _0x8fba65=_0x9c5a[_0x56c23f];return _0x8fba65;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['Cdr'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['map'](_0x4f6e70,_0xa9c5('0x26'));_0x185eb8[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x413edf[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2f')]=_[_0xa9c5('0x30')](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8['query']);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x32')](_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x198cdf[_0xa9c5('0x31')]=_0x198cdf[_0xa9c5('0x31')]['length']?_0x198cdf['attributes']:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x33')](_0xa9c5('0x34'))){_0x198cdf[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x413edf['query']['limit']);_0x198cdf['offset']=qs[_0xa9c5('0x1e')](_0x413edf[_0xa9c5('0x2d')]['offset']);}_0x198cdf[_0xa9c5('0x35')]=qs['sort'](_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x36')]);_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x2f')](_['pick'](_0x413edf[_0xa9c5('0x2d')],_0x185eb8[_0xa9c5('0x2f')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x38')]){_0x198cdf[_0xa9c5('0x37')]=_[_0xa9c5('0x39')](_0x198cdf[_0xa9c5('0x37')],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x573fc0){if(_0x573fc0[_0xa9c5('0x3a')]!==_0xa9c5('0x3b')){var _0x841c18={};_0x841c18[_0x573fc0[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x38')]+'%'};return _0x841c18;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3c')]);var _0x5b7a0a={'where':_0x198cdf[_0xa9c5('0x37')]};return db['Cdr'][_0xa9c5('0x1d')](_0x5b7a0a)[_0xa9c5('0x24')](function(_0x37fb1b){_0x325c65['count']=_0x37fb1b;if(_0x413edf[_0xa9c5('0x2d')][_0xa9c5('0x3d')]){_0x198cdf[_0xa9c5('0x3e')]=[{'all':!![]}];}return db[_0xa9c5('0x3f')]['findAll'](_0x198cdf);})[_0xa9c5('0x24')](function(_0x97803f){_0x325c65[_0xa9c5('0x40')]=_0x97803f;return _0x325c65;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x41')](handleError(_0x32baf9,null));};exports['show']=function(_0x2a1138,_0x566b60){var _0x1de605={'raw':!![],'where':{'id':_0x2a1138[_0xa9c5('0x42')]['id']}},_0x397614={};_0x397614[_0xa9c5('0x2c')]=_[_0xa9c5('0x2e')](db[_0xa9c5('0x3f')][_0xa9c5('0x29')]);_0x397614[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x2a1138[_0xa9c5('0x2d')]);_0x397614['filters']=_[_0xa9c5('0x30')](_0x397614[_0xa9c5('0x2c')],_0x397614[_0xa9c5('0x2d')]);_0x1de605[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x397614[_0xa9c5('0x2c')],qs['fields'](_0x2a1138[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x1de605['attributes']=_0x1de605['attributes']['length']?_0x1de605['attributes']:_0x397614['model'];if(_0x2a1138[_0xa9c5('0x2d')][_0xa9c5('0x3d')]){_0x1de605[_0xa9c5('0x3e')]=[{'all':!![]}];}_0x1de605=_[_0xa9c5('0x39')]({},_0x1de605,_0x2a1138[_0xa9c5('0x3c')]);return db[_0xa9c5('0x3f')][_0xa9c5('0x43')](_0x1de605)[_0xa9c5('0x24')](handleEntityNotFound(_0x566b60,null))[_0xa9c5('0x24')](respondWithResult(_0x566b60,null))[_0xa9c5('0x41')](handleError(_0x566b60,null));};exports[_0xa9c5('0x44')]=function(_0x2c3dbf,_0x1c2ccf){return db['Cdr'][_0xa9c5('0x44')](_0x2c3dbf['body'],{})[_0xa9c5('0x24')](respondWithResult(_0x1c2ccf,0xc9))[_0xa9c5('0x41')](handleError(_0x1c2ccf,null));};exports['update']=function(_0x5cbd33,_0xf00970){if(_0x5cbd33[_0xa9c5('0x45')]['id']){delete _0x5cbd33[_0xa9c5('0x45')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5cbd33[_0xa9c5('0x42')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0xf00970,null))['then'](saveUpdates(_0x5cbd33[_0xa9c5('0x45')],null))[_0xa9c5('0x24')](respondWithResult(_0xf00970,null))[_0xa9c5('0x41')](handleError(_0xf00970,null));};exports[_0xa9c5('0x46')]=function(_0x34020f,_0xb369da){return db['Cdr']['find']({'where':{'id':_0x34020f['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0xb369da,null))[_0xa9c5('0x24')](removeEntity(_0xb369da,null))[_0xa9c5('0x41')](handleError(_0xb369da,null));};exports[_0xa9c5('0x47')]=function(_0x380266,_0x15d044){return db['Cdr'][_0xa9c5('0x47')]()[_0xa9c5('0x24')](respondWithResult(_0x15d044,null))[_0xa9c5('0x41')](handleError(_0x15d044,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9260d48..44ae420 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x547877,_0x41d5dc){var _0x291d53=function(_0x3dccc5){while(--_0x3dccc5){_0x547877['push'](_0x547877['shift']());}};_0x291d53(++_0x41d5dc);}(_0x7a54,0x106));var _0x47a5=function(_0x59b1d8,_0x4f1846){_0x59b1d8=_0x59b1d8-0x0;var _0x543b0e=_0x7a54[_0x59b1d8];return _0x543b0e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3f2e17,_0x356198){var _0x32c01a=function(_0xe75dae){while(--_0xe75dae){_0x3f2e17['push'](_0x3f2e17['shift']());}};_0x32c01a(++_0x356198);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 89e8b5b..bd68590 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 _0xfa59=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x3f42dc,_0x3332a4){var _0x4888a3=function(_0x24a5f8){while(--_0x24a5f8){_0x3f42dc['push'](_0x3f42dc['shift']());}};_0x4888a3(++_0x3332a4);}(_0xfa59,0x10b));var _0x9fa5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfa59[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9fa5('0x0'));var util=require(_0x9fa5('0x1'));var moment=require('moment');var BPromise=require(_0x9fa5('0x2'));var rs=require(_0x9fa5('0x3'));var fs=require('fs');var Redis=require(_0x9fa5('0x4'));var db=require(_0x9fa5('0x5'))['db'];var utils=require(_0x9fa5('0x6'));var logger=require(_0x9fa5('0x7'))(_0x9fa5('0x8'));var config=require(_0x9fa5('0x9'));var jayson=require(_0x9fa5('0xa'));var client=jayson[_0x9fa5('0xb')][_0x9fa5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x218c9f,_0x483d8c,_0x2ee9b4){return new BPromise(function(_0xb36bfc,_0x496a63){return client['request'](_0x218c9f,_0x2ee9b4)[_0x9fa5('0xd')](function(_0x5650c8){logger['info'](_0x9fa5('0xe'),_0x483d8c,'request\x20sent');logger[_0x9fa5('0xf')](_0x9fa5('0x10'),_0x483d8c,_0x9fa5('0x11'),JSON['stringify'](_0x5650c8));if(_0x5650c8['error']){if(_0x5650c8['error'][_0x9fa5('0x12')]===0x1f4){logger[_0x9fa5('0x13')]('Cdr,\x20%s,\x20%s',_0x483d8c,_0x5650c8[_0x9fa5('0x13')][_0x9fa5('0x14')]);return _0x496a63(_0x5650c8[_0x9fa5('0x13')]['message']);}logger[_0x9fa5('0x13')]('Cdr,\x20%s,\x20%s',_0x483d8c,_0x5650c8['error'][_0x9fa5('0x14')]);return _0xb36bfc(_0x5650c8[_0x9fa5('0x13')]['message']);}else{logger[_0x9fa5('0x15')]('Cdr,\x20%s,\x20%s',_0x483d8c,'request\x20sent');_0xb36bfc(_0x5650c8[_0x9fa5('0x16')][_0x9fa5('0x14')]);}})[_0x9fa5('0x17')](function(_0x40ad11){logger['error'](_0x9fa5('0xe'),_0x483d8c,_0x40ad11);_0x496a63(_0x40ad11);});});} \ No newline at end of file +var _0x4d67=['http','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','Cdr,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x173f45,_0x3bf2be){var _0x19f610=function(_0x1a7495){while(--_0x1a7495){_0x173f45['push'](_0x173f45['shift']());}};_0x19f610(++_0x3bf2be);}(_0x4d67,0x6e));var _0x74d6=function(_0x185fb1,_0x30ad2f){_0x185fb1=_0x185fb1-0x0;var _0x3ab848=_0x4d67[_0x185fb1];return _0x3ab848;};'use strict';var _=require(_0x74d6('0x0'));var util=require(_0x74d6('0x1'));var moment=require('moment');var BPromise=require(_0x74d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74d6('0x3'));var db=require(_0x74d6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x74d6('0x5'))(_0x74d6('0x6'));var config=require(_0x74d6('0x7'));var jayson=require(_0x74d6('0x8'));var client=jayson[_0x74d6('0x9')][_0x74d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fed2f,_0x157839,_0x6c5c5e){return new BPromise(function(_0x27dbda,_0x49ea8f){return client['request'](_0x4fed2f,_0x6c5c5e)[_0x74d6('0xb')](function(_0x41005d){logger[_0x74d6('0xc')]('Cdr,\x20%s,\x20%s',_0x157839,_0x74d6('0xd'));logger[_0x74d6('0xe')](_0x74d6('0xf'),_0x157839,_0x74d6('0xd'),JSON['stringify'](_0x41005d));if(_0x41005d[_0x74d6('0x10')]){if(_0x41005d[_0x74d6('0x10')]['code']===0x1f4){logger['error'](_0x74d6('0x11'),_0x157839,_0x41005d[_0x74d6('0x10')]['message']);return _0x49ea8f(_0x41005d[_0x74d6('0x10')][_0x74d6('0x12')]);}logger[_0x74d6('0x10')]('Cdr,\x20%s,\x20%s',_0x157839,_0x41005d[_0x74d6('0x10')]['message']);return _0x27dbda(_0x41005d['error']['message']);}else{logger[_0x74d6('0xc')](_0x74d6('0x11'),_0x157839,'request\x20sent');_0x27dbda(_0x41005d[_0x74d6('0x13')][_0x74d6('0x12')]);}})['catch'](function(_0xbee65a){logger[_0x74d6('0x10')]('Cdr,\x20%s,\x20%s',_0x157839,_0xbee65a);_0x49ea8f(_0xbee65a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e6bf3e7..e93b0f1 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4e35d2,_0x516864){var _0x384964=function(_0x53012b){while(--_0x53012b){_0x4e35d2['push'](_0x4e35d2['shift']());}};_0x384964(++_0x516864);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 aabd92a..9d9dabf 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 _0x213f=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x5710c9,_0x44780c){var _0x5dd2d5=function(_0x51213d){while(--_0x51213d){_0x5710c9['push'](_0x5710c9['shift']());}};_0x5dd2d5(++_0x44780c);}(_0x213f,0x117));var _0xf213=function(_0xa2f1f7,_0x32b527){_0xa2f1f7=_0xa2f1f7-0x0;var _0x57081f=_0x213f[_0xa2f1f7];return _0x57081f;};'use strict';var Sequelize=require(_0xf213('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf213('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':_0xf213('0x3')},'appdata':{'type':Sequelize[_0xf213('0x4')]()},'description':{'type':Sequelize[_0xf213('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf213('0x5')}}; \ No newline at end of file +var _0xfab0=['sequelize','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5ba68e,_0x12d804){var _0x3c4158=function(_0x5c8c15){while(--_0x5c8c15){_0x5ba68e['push'](_0x5ba68e['shift']());}};_0x3c4158(++_0x12d804);}(_0xfab0,0x96));var _0x0fab=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0xfab0[_0x2fab67];return _0x3b0237;};'use strict';var Sequelize=require(_0x0fab('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0fab('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0fab('0x2')],'allowNull':![],'defaultValue':_0x0fab('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0fab('0x2')],'defaultValue':_0x0fab('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f9c2b1e..1ff58c2 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 _0x0f88=['model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','show','params'];(function(_0x559947,_0x31384a){var _0x5dd49b=function(_0x314341){while(--_0x314341){_0x559947['push'](_0x559947['shift']());}};_0x5dd49b(++_0x31384a);}(_0x0f88,0x1d9));var _0x80f8=function(_0x354fc7,_0x10bd45){_0x354fc7=_0x354fc7-0x0;var _0x462135=_0x0f88[_0x354fc7];return _0x462135;};'use strict';var emlformat=require(_0x80f8('0x0'));var rimraf=require(_0x80f8('0x1'));var zipdir=require(_0x80f8('0x2'));var jsonpatch=require(_0x80f8('0x3'));var rp=require(_0x80f8('0x4'));var moment=require(_0x80f8('0x5'));var BPromise=require(_0x80f8('0x6'));var Mustache=require(_0x80f8('0x7'));var util=require('util');var path=require(_0x80f8('0x8'));var sox=require('sox');var csv=require(_0x80f8('0x9'));var ejs=require(_0x80f8('0xa'));var fs=require('fs');var fs_extra=require(_0x80f8('0xb'));var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0x9'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x80f8('0x1c'))['db'];function respondWithStatusCode(_0x3fbc80,_0x35538b){_0x35538b=_0x35538b||0xcc;return function(_0x5e6020){if(_0x5e6020){return _0x3fbc80[_0x80f8('0x1d')](_0x35538b);}return _0x3fbc80[_0x80f8('0x1e')](_0x35538b)[_0x80f8('0x1f')]();};}function respondWithResult(_0x495b10,_0x4887d3){_0x4887d3=_0x4887d3||0xc8;return function(_0x4f8755){if(_0x4f8755){return _0x495b10['status'](_0x4887d3)[_0x80f8('0x20')](_0x4f8755);}};}function respondWithFilteredResult(_0x574fc1,_0x2c9b94){return function(_0x25c36b){if(_0x25c36b){var _0x381355=typeof _0x2c9b94[_0x80f8('0x21')]===_0x80f8('0x22')&&typeof _0x2c9b94[_0x80f8('0x23')]===_0x80f8('0x22');var _0x16ae36=_0x25c36b[_0x80f8('0x24')];var _0xeff401=_0x381355?0x0:_0x2c9b94['offset'];var _0x450b77=_0x381355?_0x25c36b[_0x80f8('0x24')]:_0x2c9b94[_0x80f8('0x21')]+_0x2c9b94[_0x80f8('0x23')];var _0xa88a03;if(_0x450b77>=_0x16ae36){_0x450b77=_0x16ae36;_0xa88a03=0xc8;}else{_0xa88a03=0xce;}_0x574fc1['status'](_0xa88a03);return _0x574fc1[_0x80f8('0x25')](_0x80f8('0x26'),_0xeff401+'-'+_0x450b77+'/'+_0x16ae36)['json'](_0x25c36b);}return null;};}function patchUpdates(_0xbaea36){return function(_0x3d23b5){try{jsonpatch['apply'](_0x3d23b5,_0xbaea36,!![]);}catch(_0x431b10){return BPromise[_0x80f8('0x27')](_0x431b10);}return _0x3d23b5[_0x80f8('0x28')]();};}function saveUpdates(_0x2a693d,_0x214dc7){return function(_0x1a4988){if(_0x1a4988){return _0x1a4988[_0x80f8('0x29')](_0x2a693d)[_0x80f8('0x2a')](function(_0x5b823a){return _0x5b823a;});}return null;};}function removeEntity(_0x26c62a,_0x530350){return function(_0x192ae5){if(_0x192ae5){return _0x192ae5['destroy']()[_0x80f8('0x2a')](function(){_0x26c62a['status'](0xcc)[_0x80f8('0x1f')]();});}};}function handleEntityNotFound(_0x34c126,_0x5e3f76){return function(_0x57fad1){if(!_0x57fad1){_0x34c126['sendStatus'](0x194);}return _0x57fad1;};}function handleError(_0x40d26a,_0x3032bb){_0x3032bb=_0x3032bb||0x1f4;return function(_0x4ae1a6){logger[_0x80f8('0x2b')](_0x4ae1a6['stack']);if(_0x4ae1a6[_0x80f8('0x2c')]){delete _0x4ae1a6['name'];}_0x40d26a[_0x80f8('0x1e')](_0x3032bb)['send'](_0x4ae1a6);};}exports[_0x80f8('0x2d')]=function(_0x1b92a9,_0x109ea3){var _0x46d379={'raw':!![],'where':{'id':_0x1b92a9[_0x80f8('0x2e')]['id']}},_0x42e871={};_0x42e871[_0x80f8('0x2f')]=_[_0x80f8('0x30')](db[_0x80f8('0x31')][_0x80f8('0x32')]);_0x42e871['query']=_['keys'](_0x1b92a9[_0x80f8('0x33')]);_0x42e871[_0x80f8('0x34')]=_[_0x80f8('0x35')](_0x42e871[_0x80f8('0x2f')],_0x42e871['query']);_0x46d379[_0x80f8('0x36')]=_[_0x80f8('0x35')](_0x42e871['model'],qs[_0x80f8('0x37')](_0x1b92a9['query'][_0x80f8('0x37')]));_0x46d379['attributes']=_0x46d379[_0x80f8('0x36')][_0x80f8('0x38')]?_0x46d379['attributes']:_0x42e871['model'];if(_0x1b92a9[_0x80f8('0x33')][_0x80f8('0x39')]){_0x46d379[_0x80f8('0x3a')]=[{'all':!![]}];}_0x46d379=_[_0x80f8('0x3b')]({},_0x46d379,_0x1b92a9[_0x80f8('0x3c')]);return db[_0x80f8('0x31')][_0x80f8('0x3d')](_0x46d379)['then'](handleEntityNotFound(_0x109ea3,null))[_0x80f8('0x2a')](respondWithResult(_0x109ea3,null))[_0x80f8('0x3e')](handleError(_0x109ea3,null));};exports[_0x80f8('0x29')]=function(_0x3c6d37,_0x5cec47){if(_0x3c6d37[_0x80f8('0x3f')]['id']){delete _0x3c6d37[_0x80f8('0x3f')]['id'];}return db[_0x80f8('0x31')][_0x80f8('0x3d')]({'where':{'id':_0x3c6d37['params']['id']}})[_0x80f8('0x2a')](handleEntityNotFound(_0x5cec47,null))['then'](saveUpdates(_0x3c6d37['body'],null))[_0x80f8('0x2a')](respondWithResult(_0x5cec47,null))[_0x80f8('0x3e')](handleError(_0x5cec47,null));};exports[_0x80f8('0x40')]=function(_0x3d92a9,_0x52eba0){return db[_0x80f8('0x31')][_0x80f8('0x3d')]({'where':{'id':_0x3d92a9[_0x80f8('0x2e')]['id']}})[_0x80f8('0x2a')](handleEntityNotFound(_0x52eba0,null))[_0x80f8('0x2a')](removeEntity(_0x52eba0,null))[_0x80f8('0x3e')](handleError(_0x52eba0,null));}; \ No newline at end of file +var _0x3276=['filters','intersection','attributes','length','includeAll','include','merge','options','find','ChatApplication','params','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','rawAttributes','query'];(function(_0x572219,_0x184991){var _0x321bc3=function(_0x1dfffb){while(--_0x1dfffb){_0x572219['push'](_0x572219['shift']());}};_0x321bc3(++_0x184991);}(_0x3276,0xc7));var _0x6327=function(_0x3eebe0,_0x2bca68){_0x3eebe0=_0x3eebe0-0x0;var _0x39da4a=_0x3276[_0x3eebe0];return _0x39da4a;};'use strict';var emlformat=require(_0x6327('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6327('0x1'));var rp=require(_0x6327('0x2'));var moment=require(_0x6327('0x3'));var BPromise=require(_0x6327('0x4'));var Mustache=require(_0x6327('0x5'));var util=require(_0x6327('0x6'));var path=require(_0x6327('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6327('0x8'));var fs=require('fs');var fs_extra=require(_0x6327('0x9'));var _=require(_0x6327('0xa'));var squel=require('squel');var crypto=require(_0x6327('0xb'));var jsforce=require(_0x6327('0xc'));var deskjs=require(_0x6327('0xd'));var toCsv=require(_0x6327('0xe'));var querystring=require('querystring');var Papa=require(_0x6327('0xf'));var Redis=require(_0x6327('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6327('0x11'));var as=require(_0x6327('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6327('0x13'))(_0x6327('0x14'));var utils=require(_0x6327('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6327('0x16'));var db=require(_0x6327('0x17'))['db'];function respondWithStatusCode(_0xb6de72,_0x32408c){_0x32408c=_0x32408c||0xcc;return function(_0x3ff61b){if(_0x3ff61b){return _0xb6de72[_0x6327('0x18')](_0x32408c);}return _0xb6de72[_0x6327('0x19')](_0x32408c)[_0x6327('0x1a')]();};}function respondWithResult(_0x576b1c,_0x306095){_0x306095=_0x306095||0xc8;return function(_0x48eb75){if(_0x48eb75){return _0x576b1c[_0x6327('0x19')](_0x306095)['json'](_0x48eb75);}};}function respondWithFilteredResult(_0x441ff9,_0x1e850c){return function(_0x43186f){if(_0x43186f){var _0x4e9741=typeof _0x1e850c[_0x6327('0x1b')]===_0x6327('0x1c')&&typeof _0x1e850c[_0x6327('0x1d')]===_0x6327('0x1c');var _0x3ea016=_0x43186f[_0x6327('0x1e')];var _0x341a51=_0x4e9741?0x0:_0x1e850c[_0x6327('0x1b')];var _0x287899=_0x4e9741?_0x43186f[_0x6327('0x1e')]:_0x1e850c[_0x6327('0x1b')]+_0x1e850c[_0x6327('0x1d')];var _0x55cf65;if(_0x287899>=_0x3ea016){_0x287899=_0x3ea016;_0x55cf65=0xc8;}else{_0x55cf65=0xce;}_0x441ff9[_0x6327('0x19')](_0x55cf65);return _0x441ff9[_0x6327('0x1f')](_0x6327('0x20'),_0x341a51+'-'+_0x287899+'/'+_0x3ea016)[_0x6327('0x21')](_0x43186f);}return null;};}function patchUpdates(_0x4cbc80){return function(_0x56249b){try{jsonpatch[_0x6327('0x22')](_0x56249b,_0x4cbc80,!![]);}catch(_0x700766){return BPromise[_0x6327('0x23')](_0x700766);}return _0x56249b[_0x6327('0x24')]();};}function saveUpdates(_0x3078c5,_0x76c718){return function(_0x5754e1){if(_0x5754e1){return _0x5754e1[_0x6327('0x25')](_0x3078c5)[_0x6327('0x26')](function(_0x2f153c){return _0x2f153c;});}return null;};}function removeEntity(_0x1c3d7f,_0x302b3f){return function(_0x254c2f){if(_0x254c2f){return _0x254c2f[_0x6327('0x27')]()[_0x6327('0x26')](function(){_0x1c3d7f[_0x6327('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51dbe9,_0xc155b){return function(_0x499321){if(!_0x499321){_0x51dbe9[_0x6327('0x18')](0x194);}return _0x499321;};}function handleError(_0x5ada97,_0x3c3711){_0x3c3711=_0x3c3711||0x1f4;return function(_0x559dbb){logger[_0x6327('0x28')](_0x559dbb[_0x6327('0x29')]);if(_0x559dbb['name']){delete _0x559dbb[_0x6327('0x2a')];}_0x5ada97[_0x6327('0x19')](_0x3c3711)[_0x6327('0x2b')](_0x559dbb);};}exports[_0x6327('0x2c')]=function(_0x894157,_0x29f43e){var _0x42b225={'raw':!![],'where':{'id':_0x894157['params']['id']}},_0x2c4ca5={};_0x2c4ca5[_0x6327('0x2d')]=_[_0x6327('0x2e')](db['ChatApplication'][_0x6327('0x2f')]);_0x2c4ca5[_0x6327('0x30')]=_['keys'](_0x894157[_0x6327('0x30')]);_0x2c4ca5[_0x6327('0x31')]=_[_0x6327('0x32')](_0x2c4ca5['model'],_0x2c4ca5[_0x6327('0x30')]);_0x42b225[_0x6327('0x33')]=_[_0x6327('0x32')](_0x2c4ca5[_0x6327('0x2d')],qs['fields'](_0x894157[_0x6327('0x30')]['fields']));_0x42b225['attributes']=_0x42b225[_0x6327('0x33')][_0x6327('0x34')]?_0x42b225[_0x6327('0x33')]:_0x2c4ca5[_0x6327('0x2d')];if(_0x894157['query'][_0x6327('0x35')]){_0x42b225[_0x6327('0x36')]=[{'all':!![]}];}_0x42b225=_[_0x6327('0x37')]({},_0x42b225,_0x894157[_0x6327('0x38')]);return db['ChatApplication'][_0x6327('0x39')](_0x42b225)[_0x6327('0x26')](handleEntityNotFound(_0x29f43e,null))[_0x6327('0x26')](respondWithResult(_0x29f43e,null))['catch'](handleError(_0x29f43e,null));};exports[_0x6327('0x25')]=function(_0x3f21f9,_0x456090){if(_0x3f21f9['body']['id']){delete _0x3f21f9['body']['id'];}return db[_0x6327('0x3a')]['find']({'where':{'id':_0x3f21f9[_0x6327('0x3b')]['id']}})['then'](handleEntityNotFound(_0x456090,null))[_0x6327('0x26')](saveUpdates(_0x3f21f9[_0x6327('0x3c')],null))[_0x6327('0x26')](respondWithResult(_0x456090,null))[_0x6327('0x3d')](handleError(_0x456090,null));};exports[_0x6327('0x27')]=function(_0x2b1982,_0x544e6b){return db[_0x6327('0x3a')][_0x6327('0x39')]({'where':{'id':_0x2b1982[_0x6327('0x3b')]['id']}})[_0x6327('0x26')](handleEntityNotFound(_0x544e6b,null))['then'](removeEntity(_0x544e6b,null))['catch'](handleError(_0x544e6b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 986ea02..f47afea 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 _0x1748=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatApplication','utf8mb4'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x1748,0x146));var _0x8174=function(_0x3798a1,_0x1d57d1){_0x3798a1=_0x3798a1-0x0;var _0x2e6636=_0x1748[_0x3798a1];return _0x2e6636;};'use strict';var _=require(_0x8174('0x0'));var util=require(_0x8174('0x1'));var logger=require(_0x8174('0x2'))('api');var moment=require(_0x8174('0x3'));var BPromise=require(_0x8174('0x4'));var rp=require(_0x8174('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8174('0x6'));var config=require(_0x8174('0x7'));var attributes=require('./chatApplication.attributes');module[_0x8174('0x8')]=function(_0x4f0763,_0xa513b2){return _0x4f0763[_0x8174('0x9')](_0x8174('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8174('0xb'),'collate':_0x8174('0xc')});}; \ No newline at end of file +var _0x1427=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','../../config/environment','./chatApplication.attributes'];(function(_0xc826d9,_0x27e433){var _0x5dcb0c=function(_0x5d95b3){while(--_0x5d95b3){_0xc826d9['push'](_0xc826d9['shift']());}};_0x5dcb0c(++_0x27e433);}(_0x1427,0x7b));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7142('0x0'));var logger=require(_0x7142('0x1'))(_0x7142('0x2'));var moment=require(_0x7142('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7142('0x4'));var rimraf=require('rimraf');var config=require(_0x7142('0x5'));var attributes=require(_0x7142('0x6'));module[_0x7142('0x7')]=function(_0x3a225d,_0x28a8cd){return _0x3a225d[_0x7142('0x8')](_0x7142('0x9'),attributes,{'tableName':_0x7142('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7142('0xb'),'collate':_0x7142('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0b89db2..94ffbbc 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 _0x2365=['ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5852ca,_0x4b3f30){var _0x311057=function(_0x99a1d8){while(--_0x99a1d8){_0x5852ca['push'](_0x5852ca['shift']());}};_0x311057(++_0x4b3f30);}(_0x2365,0x126));var _0x5236=function(_0x55d434,_0x10c9dc){_0x55d434=_0x55d434-0x0;var _0xb57f84=_0x2365[_0x55d434];return _0xb57f84;};'use strict';var _=require(_0x5236('0x0'));var util=require(_0x5236('0x1'));var moment=require(_0x5236('0x2'));var BPromise=require(_0x5236('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5236('0x4'));var db=require(_0x5236('0x5'))['db'];var utils=require(_0x5236('0x6'));var logger=require('../../config/logger')(_0x5236('0x7'));var config=require(_0x5236('0x8'));var jayson=require(_0x5236('0x9'));var client=jayson[_0x5236('0xa')][_0x5236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aa2c3,_0x2898f4,_0x269c73){return new BPromise(function(_0x437189,_0x2b753e){return client[_0x5236('0xc')](_0x5aa2c3,_0x269c73)[_0x5236('0xd')](function(_0x1e189e){logger[_0x5236('0xe')](_0x5236('0xf'),_0x2898f4,_0x5236('0x10'));logger[_0x5236('0x11')](_0x5236('0x12'),_0x2898f4,_0x5236('0x10'),JSON['stringify'](_0x1e189e));if(_0x1e189e[_0x5236('0x13')]){if(_0x1e189e[_0x5236('0x13')][_0x5236('0x14')]===0x1f4){logger[_0x5236('0x13')](_0x5236('0xf'),_0x2898f4,_0x1e189e[_0x5236('0x13')][_0x5236('0x15')]);return _0x2b753e(_0x1e189e[_0x5236('0x13')]['message']);}logger[_0x5236('0x13')](_0x5236('0xf'),_0x2898f4,_0x1e189e['error']['message']);return _0x437189(_0x1e189e[_0x5236('0x13')]['message']);}else{logger[_0x5236('0xe')](_0x5236('0xf'),_0x2898f4,'request\x20sent');_0x437189(_0x1e189e[_0x5236('0x16')][_0x5236('0x15')]);}})[_0x5236('0x17')](function(_0x14e19c){logger[_0x5236('0x13')](_0x5236('0xf'),_0x2898f4,_0x14e19c);_0x2b753e(_0x14e19c);});});} \ No newline at end of file +var _0xb103=['info','request\x20sent','debug','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x47e2a2,_0xdc9935){var _0x2f3352=function(_0x3480ae){while(--_0x3480ae){_0x47e2a2['push'](_0x47e2a2['shift']());}};_0x2f3352(++_0xdc9935);}(_0xb103,0x82));var _0x3b10=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xb103[_0x967959];return _0x5c4489;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b10('0x0'));var BPromise=require(_0x3b10('0x1'));var rs=require(_0x3b10('0x2'));var fs=require('fs');var Redis=require(_0x3b10('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b10('0x4'));var logger=require('../../config/logger')(_0x3b10('0x5'));var config=require(_0x3b10('0x6'));var jayson=require(_0x3b10('0x7'));var client=jayson['client'][_0x3b10('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4380c0,_0x13c400,_0x304c5c){return new BPromise(function(_0x135051,_0x3fc6c8){return client[_0x3b10('0x9')](_0x4380c0,_0x304c5c)['then'](function(_0x555cc1){logger[_0x3b10('0xa')]('ChatApplication,\x20%s,\x20%s',_0x13c400,_0x3b10('0xb'));logger[_0x3b10('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x13c400,'request\x20sent',JSON[_0x3b10('0xd')](_0x555cc1));if(_0x555cc1['error']){if(_0x555cc1[_0x3b10('0xe')][_0x3b10('0xf')]===0x1f4){logger[_0x3b10('0xe')]('ChatApplication,\x20%s,\x20%s',_0x13c400,_0x555cc1['error'][_0x3b10('0x10')]);return _0x3fc6c8(_0x555cc1[_0x3b10('0xe')][_0x3b10('0x10')]);}logger['error'](_0x3b10('0x11'),_0x13c400,_0x555cc1[_0x3b10('0xe')]['message']);return _0x135051(_0x555cc1[_0x3b10('0xe')][_0x3b10('0x10')]);}else{logger[_0x3b10('0xa')]('ChatApplication,\x20%s,\x20%s',_0x13c400,_0x3b10('0xb'));_0x135051(_0x555cc1[_0x3b10('0x12')][_0x3b10('0x10')]);}})[_0x3b10('0x13')](function(_0x959c02){logger[_0x3b10('0xe')](_0x3b10('0x11'),_0x13c400,_0x959c02);_0x3fc6c8(_0x959c02);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3ad1460..7bd48e5 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 _0x11b1=['delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x11b1,0xfa));var _0x111b=function(_0xc2f2ab,_0x292fab){_0xc2f2ab=_0xc2f2ab-0x0;var _0xd5b3ec=_0x11b1[_0xc2f2ab];return _0xd5b3ec;};'use strict';var multer=require(_0x111b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x111b('0x1'));var router=express[_0x111b('0x2')]();var fs_extra=require(_0x111b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x111b('0x4'));var config=require('../../config/environment');var controller=require(_0x111b('0x5'));router['get'](_0x111b('0x6'),auth[_0x111b('0x7')](),controller[_0x111b('0x8')]);router[_0x111b('0x9')](_0x111b('0x6'),auth[_0x111b('0x7')](),controller['update']);router[_0x111b('0xa')](_0x111b('0x6'),auth[_0x111b('0x7')](),controller[_0x111b('0xb')]);module[_0x111b('0xc')]=router; \ No newline at end of file +var _0xaf98=['../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0xaf98,0x145));var _0x8af9=function(_0x3ab7e0,_0x3e8f88){_0x3ab7e0=_0x3ab7e0-0x0;var _0x47a5ba=_0xaf98[_0x3ab7e0];return _0x47a5ba;};'use strict';var multer=require('multer');var util=require(_0x8af9('0x0'));var path=require(_0x8af9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8af9('0x2')]();var fs_extra=require(_0x8af9('0x3'));var auth=require(_0x8af9('0x4'));var interaction=require(_0x8af9('0x5'));var config=require(_0x8af9('0x6'));var controller=require(_0x8af9('0x7'));router['get'](_0x8af9('0x8'),auth[_0x8af9('0x9')](),controller[_0x8af9('0xa')]);router[_0x8af9('0xb')](_0x8af9('0x8'),auth['isAuthenticated'](),controller[_0x8af9('0xc')]);router[_0x8af9('0xd')]('/:id',auth[_0x8af9('0x9')](),controller[_0x8af9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f056526..7c36692 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 _0xfd1b=['BOOLEAN','STRING'];(function(_0xd840,_0x14119c){var _0x1d19e4=function(_0x5e0cd4){while(--_0x5e0cd4){_0xd840['push'](_0xd840['shift']());}};_0x1d19e4(++_0x14119c);}(_0xfd1b,0x1b1));var _0xbfd1=function(_0x423fff,_0x428afb){_0x423fff=_0x423fff-0x0;var _0x48d8a9=_0xfd1b[_0x423fff];return _0x48d8a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbfd1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xbfd1('0x0')]},'write':{'type':Sequelize[_0xbfd1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x46e4=['STRING','BOOLEAN','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x46e4,0xdd));var _0x446e=function(_0x20b328,_0x11174d){_0x20b328=_0x20b328-0x0;var _0x3d0297=_0x46e4[_0x20b328];return _0x3d0297;};'use strict';var Sequelize=require(_0x446e('0x0'));module['exports']={'name':{'type':Sequelize[_0x446e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x446e('0x1')]},'write':{'type':Sequelize[_0x446e('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1011f4b..7d25158 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 _0x41f9=['redis','defaults','localhost','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','ChatGroup','includeAll','include','findAll','params','merge','find','catch','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','findOne','User','options','getMembers','removeMembers','addMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x634811,_0xc4455c){var _0x31aa5b=function(_0xec9150){while(--_0xec9150){_0x634811['push'](_0x634811['shift']());}};_0x31aa5b(++_0xc4455c);}(_0x41f9,0xa9));var _0x941f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x41f9[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0x941f('0x0'));var rimraf=require(_0x941f('0x1'));var zipdir=require(_0x941f('0x2'));var jsonpatch=require(_0x941f('0x3'));var rp=require(_0x941f('0x4'));var moment=require(_0x941f('0x5'));var BPromise=require(_0x941f('0x6'));var Mustache=require('mustache');var util=require(_0x941f('0x7'));var path=require('path');var sox=require(_0x941f('0x8'));var csv=require('to-csv');var ejs=require(_0x941f('0x9'));var fs=require('fs');var fs_extra=require(_0x941f('0xa'));var _=require(_0x941f('0xb'));var squel=require(_0x941f('0xc'));var crypto=require('crypto');var jsforce=require(_0x941f('0xd'));var deskjs=require(_0x941f('0xe'));var toCsv=require(_0x941f('0xf'));var querystring=require(_0x941f('0x10'));var Papa=require(_0x941f('0x11'));var Redis=require(_0x941f('0x12'));var authService=require(_0x941f('0x13'));var qs=require(_0x941f('0x14'));var as=require(_0x941f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x941f('0x16'))(_0x941f('0x17'));var utils=require(_0x941f('0x18'));var config=require(_0x941f('0x19'));var licenseUtil=require(_0x941f('0x1a'));var db=require('../../mysqldb')['db'];config[_0x941f('0x1b')]=_[_0x941f('0x1c')](config[_0x941f('0x1b')],{'host':_0x941f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x941f('0x1b')]));require(_0x941f('0x1e'))['register'](socket);function respondWithStatusCode(_0x46be05,_0x10bdcd){_0x10bdcd=_0x10bdcd||0xcc;return function(_0x3ea8f2){if(_0x3ea8f2){return _0x46be05[_0x941f('0x1f')](_0x10bdcd);}return _0x46be05[_0x941f('0x20')](_0x10bdcd)['end']();};}function respondWithResult(_0x3e3fea,_0x18bd5a){_0x18bd5a=_0x18bd5a||0xc8;return function(_0x18ac38){if(_0x18ac38){return _0x3e3fea[_0x941f('0x20')](_0x18bd5a)[_0x941f('0x21')](_0x18ac38);}};}function respondWithFilteredResult(_0x296ddb,_0x2ebedf){return function(_0x1f4845){if(_0x1f4845){var _0x327935=typeof _0x2ebedf[_0x941f('0x22')]===_0x941f('0x23')&&typeof _0x2ebedf[_0x941f('0x24')]===_0x941f('0x23');var _0x48980b=_0x1f4845[_0x941f('0x25')];var _0x4580dc=_0x327935?0x0:_0x2ebedf[_0x941f('0x22')];var _0x45c459=_0x327935?_0x1f4845[_0x941f('0x25')]:_0x2ebedf['offset']+_0x2ebedf[_0x941f('0x24')];var _0xf8daab;if(_0x45c459>=_0x48980b){_0x45c459=_0x48980b;_0xf8daab=0xc8;}else{_0xf8daab=0xce;}_0x296ddb[_0x941f('0x20')](_0xf8daab);return _0x296ddb[_0x941f('0x26')](_0x941f('0x27'),_0x4580dc+'-'+_0x45c459+'/'+_0x48980b)[_0x941f('0x21')](_0x1f4845);}return null;};}function patchUpdates(_0x2c0542){return function(_0x2ad230){try{jsonpatch[_0x941f('0x28')](_0x2ad230,_0x2c0542,!![]);}catch(_0xc227ae){return BPromise[_0x941f('0x29')](_0xc227ae);}return _0x2ad230[_0x941f('0x2a')]();};}function saveUpdates(_0x311b23,_0x4b0da3){return function(_0x21dea5){if(_0x21dea5){return _0x21dea5[_0x941f('0x2b')](_0x311b23)[_0x941f('0x2c')](function(_0x3e035b){return _0x3e035b;});}return null;};}function removeEntity(_0x27b927,_0x711f64){return function(_0x44f326){if(_0x44f326){return _0x44f326[_0x941f('0x2d')]()[_0x941f('0x2c')](function(){_0x27b927['status'](0xcc)[_0x941f('0x2e')]();});}};}function handleEntityNotFound(_0x5c8fca,_0x4fe170){return function(_0x537f56){if(!_0x537f56){_0x5c8fca['sendStatus'](0x194);}return _0x537f56;};}function handleError(_0x305e13,_0x3492e8){_0x3492e8=_0x3492e8||0x1f4;return function(_0x1f9508){logger[_0x941f('0x2f')](_0x1f9508[_0x941f('0x30')]);if(_0x1f9508[_0x941f('0x31')]){delete _0x1f9508[_0x941f('0x31')];}_0x305e13['status'](_0x3492e8)[_0x941f('0x32')](_0x1f9508);};}exports['index']=function(_0x1471d6,_0x10820e){var _0x2c4b04={},_0x22b5db={},_0x57f9b7={'count':0x0,'rows':[]};var _0x35d570=_[_0x941f('0x33')](db['ChatGroup'][_0x941f('0x34')],function(_0x5e999d){return{'name':_0x5e999d[_0x941f('0x35')],'type':_0x5e999d[_0x941f('0x36')][_0x941f('0x37')]};});_0x22b5db['model']=_['map'](_0x35d570,_0x941f('0x31'));_0x22b5db[_0x941f('0x38')]=_[_0x941f('0x39')](_0x1471d6[_0x941f('0x38')]);_0x22b5db[_0x941f('0x3a')]=_[_0x941f('0x3b')](_0x22b5db[_0x941f('0x3c')],_0x22b5db[_0x941f('0x38')]);_0x2c4b04[_0x941f('0x3d')]=_[_0x941f('0x3b')](_0x22b5db['model'],qs[_0x941f('0x3e')](_0x1471d6[_0x941f('0x38')]['fields']));_0x2c4b04['attributes']=_0x2c4b04[_0x941f('0x3d')][_0x941f('0x3f')]?_0x2c4b04['attributes']:_0x22b5db[_0x941f('0x3c')];if(!_0x1471d6[_0x941f('0x38')][_0x941f('0x40')](_0x941f('0x41'))){_0x2c4b04[_0x941f('0x24')]=qs[_0x941f('0x24')](_0x1471d6[_0x941f('0x38')][_0x941f('0x24')]);_0x2c4b04[_0x941f('0x22')]=qs[_0x941f('0x22')](_0x1471d6[_0x941f('0x38')][_0x941f('0x22')]);}_0x2c4b04[_0x941f('0x42')]=qs['sort'](_0x1471d6[_0x941f('0x38')][_0x941f('0x43')]);_0x2c4b04['where']=qs[_0x941f('0x3a')](_[_0x941f('0x44')](_0x1471d6['query'],_0x22b5db['filters']),_0x35d570);if(_0x1471d6[_0x941f('0x38')][_0x941f('0x45')]){_0x2c4b04[_0x941f('0x46')]=_['merge'](_0x2c4b04[_0x941f('0x46')],{'$or':_[_0x941f('0x33')](_0x35d570,function(_0x38a53f){if(_0x38a53f[_0x941f('0x36')]!==_0x941f('0x47')){var _0x4d3a23={};_0x4d3a23[_0x38a53f['name']]={'$like':'%'+_0x1471d6[_0x941f('0x38')]['filter']+'%'};return _0x4d3a23;}})});}_0x2c4b04=_['merge']({},_0x2c4b04,_0x1471d6['options']);var _0x25bb01={'where':_0x2c4b04[_0x941f('0x46')]};return db[_0x941f('0x48')][_0x941f('0x25')](_0x25bb01)[_0x941f('0x2c')](function(_0x52f25c){_0x57f9b7[_0x941f('0x25')]=_0x52f25c;if(_0x1471d6[_0x941f('0x38')][_0x941f('0x49')]){_0x2c4b04[_0x941f('0x4a')]=[{'all':!![]}];}return db[_0x941f('0x48')][_0x941f('0x4b')](_0x2c4b04);})[_0x941f('0x2c')](function(_0x138816){_0x57f9b7['rows']=_0x138816;return _0x57f9b7;})[_0x941f('0x2c')](respondWithFilteredResult(_0x10820e,_0x2c4b04))['catch'](handleError(_0x10820e,null));};exports['show']=function(_0x25715c,_0x5efea1){var _0x4be236={'raw':!![],'where':{'id':_0x25715c[_0x941f('0x4c')]['id']}},_0x261345={};_0x261345[_0x941f('0x3c')]=_['keys'](db[_0x941f('0x48')][_0x941f('0x34')]);_0x261345[_0x941f('0x38')]=_[_0x941f('0x39')](_0x25715c['query']);_0x261345[_0x941f('0x3a')]=_[_0x941f('0x3b')](_0x261345[_0x941f('0x3c')],_0x261345[_0x941f('0x38')]);_0x4be236[_0x941f('0x3d')]=_[_0x941f('0x3b')](_0x261345[_0x941f('0x3c')],qs[_0x941f('0x3e')](_0x25715c['query'][_0x941f('0x3e')]));_0x4be236[_0x941f('0x3d')]=_0x4be236['attributes'][_0x941f('0x3f')]?_0x4be236[_0x941f('0x3d')]:_0x261345['model'];if(_0x25715c[_0x941f('0x38')][_0x941f('0x49')]){_0x4be236['include']=[{'all':!![]}];}_0x4be236=_[_0x941f('0x4d')]({},_0x4be236,_0x25715c['options']);return db[_0x941f('0x48')][_0x941f('0x4e')](_0x4be236)[_0x941f('0x2c')](handleEntityNotFound(_0x5efea1,null))['then'](respondWithResult(_0x5efea1,null))[_0x941f('0x4f')](handleError(_0x5efea1,null));};exports[_0x941f('0x50')]=function(_0x1379e1,_0x9b9d16){return db[_0x941f('0x48')][_0x941f('0x50')](_0x1379e1[_0x941f('0x51')],{})[_0x941f('0x2c')](respondWithResult(_0x9b9d16,0xc9))['catch'](handleError(_0x9b9d16,null));};exports[_0x941f('0x2b')]=function(_0x44d142,_0x1c2963){if(_0x44d142[_0x941f('0x51')]['id']){delete _0x44d142[_0x941f('0x51')]['id'];}return db['ChatGroup'][_0x941f('0x4e')]({'where':{'id':_0x44d142[_0x941f('0x4c')]['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0x1c2963,null))[_0x941f('0x2c')](saveUpdates(_0x44d142[_0x941f('0x51')],null))[_0x941f('0x2c')](respondWithResult(_0x1c2963,null))[_0x941f('0x4f')](handleError(_0x1c2963,null));};exports['destroy']=function(_0x191694,_0x1c48c6){return db[_0x941f('0x48')][_0x941f('0x4e')]({'where':{'id':_0x191694[_0x941f('0x4c')]['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0x1c48c6,null))[_0x941f('0x2c')](removeEntity(_0x1c48c6,null))[_0x941f('0x4f')](handleError(_0x1c48c6,null));};exports[_0x941f('0x52')]=function(_0x5a3533,_0x1cb5a3){return db[_0x941f('0x48')][_0x941f('0x52')]()['then'](respondWithResult(_0x1cb5a3,null))['catch'](handleError(_0x1cb5a3,null));};exports[_0x941f('0x53')]=function(_0x20e40b,_0x16b875,_0x4b8afc){return db['ChatInternalMessage'][_0x941f('0x25')]({'where':{'ChatGroupId':_0x20e40b[_0x941f('0x4c')]['id'],'ToId':_0x20e40b[_0x941f('0x54')]['id'],'read':![]}})['then'](function(_0x1decf3){return{'id':_[_0x941f('0x55')](_0x20e40b[_0x941f('0x4c')]['id']),'count':_0x1decf3};})[_0x941f('0x2c')](respondWithResult(_0x16b875,null))[_0x941f('0x4f')](handleError(_0x16b875,null));};exports[_0x941f('0x56')]=function(_0x5999e0,_0x4f6027,_0x385b09){return db[_0x941f('0x48')][_0x941f('0x4e')]({'where':{'id':_0x5999e0['params']['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0x4f6027,null))['then'](function(_0x145986){if(_0x145986){return _0x145986[_0x941f('0x56')](_0x5999e0[_0x941f('0x51')][_0x941f('0x57')],_[_0x941f('0x58')](_0x5999e0['body'],[_0x941f('0x57'),'id'])||{});}})['then'](respondWithResult(_0x4f6027,null))[_0x941f('0x4f')](handleError(_0x4f6027,null));};exports['getMembers']=function(_0x63c912,_0x563299,_0x530f74){var _0xc1fb5b={};var _0x255e50={};var _0x4ee701;var _0x2eaa9f;return db[_0x941f('0x48')][_0x941f('0x59')]({'where':{'id':_0x63c912[_0x941f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x563299,null))[_0x941f('0x2c')](function(_0x55d6b0){if(_0x55d6b0){_0x4ee701=_0x55d6b0;_0x255e50[_0x941f('0x3c')]=_[_0x941f('0x39')](db[_0x941f('0x5a')][_0x941f('0x34')]);_0x255e50['query']=_[_0x941f('0x39')](_0x63c912[_0x941f('0x38')]);_0x255e50['filters']=_[_0x941f('0x3b')](_0x255e50[_0x941f('0x3c')],_0x255e50[_0x941f('0x38')]);_0xc1fb5b[_0x941f('0x3d')]=_['intersection'](_0x255e50[_0x941f('0x3c')],qs['fields'](_0x63c912[_0x941f('0x38')][_0x941f('0x3e')]));_0xc1fb5b[_0x941f('0x3d')]=_0xc1fb5b[_0x941f('0x3d')]['length']?_0xc1fb5b['attributes']:_0x255e50[_0x941f('0x3c')];_0xc1fb5b[_0x941f('0x42')]=qs[_0x941f('0x43')](_0x63c912[_0x941f('0x38')][_0x941f('0x43')]);_0xc1fb5b[_0x941f('0x46')]=qs[_0x941f('0x3a')](_['pick'](_0x63c912[_0x941f('0x38')],_0x255e50['filters']));if(_0x63c912['query'][_0x941f('0x45')]){_0xc1fb5b[_0x941f('0x46')]=_[_0x941f('0x4d')](_0xc1fb5b[_0x941f('0x46')],{'$or':_[_0x941f('0x33')](_0xc1fb5b[_0x941f('0x3d')],function(_0x234ae0){var _0x5418fc={};_0x5418fc[_0x234ae0]={'$like':'%'+_0x63c912['query']['filter']+'%'};return _0x5418fc;})});}_0xc1fb5b=_['merge']({},_0xc1fb5b,_0x63c912[_0x941f('0x5b')]);return _0x4ee701[_0x941f('0x5c')](_0xc1fb5b);}})['then'](function(_0x39a8c8){if(_0x39a8c8){_0x2eaa9f=_0x39a8c8[_0x941f('0x3f')];if(!_0x63c912['query']['hasOwnProperty'](_0x941f('0x41'))){_0xc1fb5b[_0x941f('0x24')]=qs[_0x941f('0x24')](_0x63c912['query'][_0x941f('0x24')]);_0xc1fb5b[_0x941f('0x22')]=qs[_0x941f('0x22')](_0x63c912['query'][_0x941f('0x22')]);}return _0x4ee701[_0x941f('0x5c')](_0xc1fb5b);}})['then'](function(_0x410d63){if(_0x410d63){return _0x410d63?{'count':_0x2eaa9f,'rows':_0x410d63}:null;}})[_0x941f('0x2c')](respondWithResult(_0x563299,null))[_0x941f('0x4f')](handleError(_0x563299,null));};exports[_0x941f('0x5d')]=function(_0x33fd1e,_0xbe27ee,_0x28fe26){return db[_0x941f('0x48')][_0x941f('0x4e')]({'where':{'id':_0x33fd1e[_0x941f('0x4c')]['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0xbe27ee,null))[_0x941f('0x2c')](function(_0x14574b){if(_0x14574b){return _0x14574b[_0x941f('0x5d')](_0x33fd1e[_0x941f('0x38')]['ids']);}})[_0x941f('0x2c')](respondWithStatusCode(_0xbe27ee,null))[_0x941f('0x4f')](handleError(_0xbe27ee,null));};exports[_0x941f('0x5e')]=function(_0x49af84,_0x1570db,_0x161136){if(_0x49af84[_0x941f('0x51')]['id']){delete _0x49af84[_0x941f('0x51')]['id'];}return db[_0x941f('0x48')]['find']({'where':{'id':_0x49af84[_0x941f('0x4c')]['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0x1570db,null))[_0x941f('0x2c')](function(_0x226c02){if(_0x226c02){_0x49af84['body']['ChatGroupId']=_0x226c02['id'];return db['ChatInternalMessage'][_0x941f('0x50')](_0x49af84[_0x941f('0x51')]);}})[_0x941f('0x2c')](respondWithResult(_0x1570db,null))[_0x941f('0x4f')](handleError(_0x1570db,null));};exports[_0x941f('0x5f')]=function(_0x5d0fb9,_0x2d4db3,_0x505069){var _0x59168d={};var _0x5a3358={};var _0x3a69af;var _0x49f20e;return db['ChatGroup'][_0x941f('0x59')]({'where':{'id':_0x5d0fb9[_0x941f('0x4c')]['id']}})[_0x941f('0x2c')](handleEntityNotFound(_0x2d4db3,null))['then'](function(_0xda37c7){if(_0xda37c7){_0x3a69af=_0xda37c7;_0x5a3358[_0x941f('0x3c')]=_[_0x941f('0x39')](db['ChatInternalMessage'][_0x941f('0x34')]);_0x5a3358[_0x941f('0x38')]=_[_0x941f('0x39')](_0x5d0fb9[_0x941f('0x38')]);_0x5a3358[_0x941f('0x3a')]=_[_0x941f('0x3b')](_0x5a3358['model'],_0x5a3358[_0x941f('0x38')]);_0x59168d[_0x941f('0x3d')]=_[_0x941f('0x3b')](_0x5a3358[_0x941f('0x3c')],qs['fields'](_0x5d0fb9[_0x941f('0x38')]['fields']));_0x59168d[_0x941f('0x3d')]=_0x59168d['attributes'][_0x941f('0x3f')]?_0x59168d['attributes']:_0x5a3358[_0x941f('0x3c')];_0x59168d[_0x941f('0x42')]=qs[_0x941f('0x43')](_0x5d0fb9[_0x941f('0x38')][_0x941f('0x43')]);_0x59168d[_0x941f('0x46')]=qs[_0x941f('0x3a')](_[_0x941f('0x44')](_0x5d0fb9[_0x941f('0x38')],_0x5a3358[_0x941f('0x3a')]));if(_0x5d0fb9[_0x941f('0x38')][_0x941f('0x45')]){_0x59168d[_0x941f('0x46')]=_['merge'](_0x59168d[_0x941f('0x46')],{'$or':_[_0x941f('0x33')](_0x59168d[_0x941f('0x3d')],function(_0xa86913){var _0x52a350={};_0x52a350[_0xa86913]={'$like':'%'+_0x5d0fb9[_0x941f('0x38')][_0x941f('0x45')]+'%'};return _0x52a350;})});}if(_0x5d0fb9[_0x941f('0x38')][_0x941f('0x60')]){var _0x5f0df1=_0x5d0fb9[_0x941f('0x38')]['$gte']['split'](',');var _0x33926d={};_0x33926d[_0x5f0df1[0x0]]={'$gte':moment(_0x5f0df1[0x1])['format'](_0x941f('0x61'))};_0x59168d['where']=_[_0x941f('0x4d')](_0x59168d['where'],_0x33926d);}_0x59168d=_[_0x941f('0x4d')]({},_0x59168d,_0x5d0fb9[_0x941f('0x5b')]);return _0x3a69af['getMessages'](_0x59168d);}})[_0x941f('0x2c')](function(_0x1fddfb){if(_0x1fddfb){_0x49f20e=_0x1fddfb[_0x941f('0x3f')];if(!_0x5d0fb9[_0x941f('0x38')][_0x941f('0x40')](_0x941f('0x41'))){_0x59168d[_0x941f('0x24')]=qs['limit'](_0x5d0fb9[_0x941f('0x38')][_0x941f('0x24')]);_0x59168d['offset']=qs[_0x941f('0x22')](_0x5d0fb9[_0x941f('0x38')][_0x941f('0x22')]);}return _0x3a69af[_0x941f('0x5f')](_0x59168d);}})['then'](function(_0x2057fb){if(_0x2057fb){return _0x2057fb?{'count':_0x49f20e,'rows':_0x2057fb}:null;}})[_0x941f('0x2c')](respondWithResult(_0x2d4db3,null))[_0x941f('0x4f')](handleError(_0x2d4db3,null));}; \ No newline at end of file +var _0xe5cf=['YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','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','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','getMembers','findOne','User','fields','order','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','format'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xe5cf,0x12a));var _0xfe5c=function(_0x4466c6,_0x25db42){_0x4466c6=_0x4466c6-0x0;var _0x45c69d=_0xe5cf[_0x4466c6];return _0x45c69d;};'use strict';var emlformat=require(_0xfe5c('0x0'));var rimraf=require(_0xfe5c('0x1'));var zipdir=require(_0xfe5c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5c('0x3'));var moment=require(_0xfe5c('0x4'));var BPromise=require(_0xfe5c('0x5'));var Mustache=require(_0xfe5c('0x6'));var util=require(_0xfe5c('0x7'));var path=require(_0xfe5c('0x8'));var sox=require(_0xfe5c('0x9'));var csv=require(_0xfe5c('0xa'));var ejs=require(_0xfe5c('0xb'));var fs=require('fs');var fs_extra=require(_0xfe5c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfe5c('0xd'));var jsforce=require(_0xfe5c('0xe'));var deskjs=require(_0xfe5c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfe5c('0x10'));var Papa=require(_0xfe5c('0x11'));var Redis=require('ioredis');var authService=require(_0xfe5c('0x12'));var qs=require(_0xfe5c('0x13'));var as=require(_0xfe5c('0x14'));var hardwareService=require(_0xfe5c('0x15'));var logger=require('../../config/logger')(_0xfe5c('0x16'));var utils=require(_0xfe5c('0x17'));var config=require(_0xfe5c('0x18'));var licenseUtil=require(_0xfe5c('0x19'));var db=require('../../mysqldb')['db'];config[_0xfe5c('0x1a')]=_[_0xfe5c('0x1b')](config[_0xfe5c('0x1a')],{'host':_0xfe5c('0x1c'),'port':0x18eb});var socket=require(_0xfe5c('0x1d'))(new Redis(config['redis']));require(_0xfe5c('0x1e'))[_0xfe5c('0x1f')](socket);function respondWithStatusCode(_0x1f280a,_0x173da8){_0x173da8=_0x173da8||0xcc;return function(_0x54a84c){if(_0x54a84c){return _0x1f280a[_0xfe5c('0x20')](_0x173da8);}return _0x1f280a[_0xfe5c('0x21')](_0x173da8)['end']();};}function respondWithResult(_0x415669,_0x3add65){_0x3add65=_0x3add65||0xc8;return function(_0x5713b9){if(_0x5713b9){return _0x415669[_0xfe5c('0x21')](_0x3add65)[_0xfe5c('0x22')](_0x5713b9);}};}function respondWithFilteredResult(_0x1944d6,_0x5871c8){return function(_0x22fe75){if(_0x22fe75){var _0x4ac07a=typeof _0x5871c8['offset']===_0xfe5c('0x23')&&typeof _0x5871c8[_0xfe5c('0x24')]===_0xfe5c('0x23');var _0x11796c=_0x22fe75['count'];var _0x197ac1=_0x4ac07a?0x0:_0x5871c8[_0xfe5c('0x25')];var _0x36f37b=_0x4ac07a?_0x22fe75[_0xfe5c('0x26')]:_0x5871c8[_0xfe5c('0x25')]+_0x5871c8[_0xfe5c('0x24')];var _0x262c72;if(_0x36f37b>=_0x11796c){_0x36f37b=_0x11796c;_0x262c72=0xc8;}else{_0x262c72=0xce;}_0x1944d6['status'](_0x262c72);return _0x1944d6[_0xfe5c('0x27')](_0xfe5c('0x28'),_0x197ac1+'-'+_0x36f37b+'/'+_0x11796c)[_0xfe5c('0x22')](_0x22fe75);}return null;};}function patchUpdates(_0x881b4d){return function(_0x5e1712){try{jsonpatch['apply'](_0x5e1712,_0x881b4d,!![]);}catch(_0x14afd1){return BPromise[_0xfe5c('0x29')](_0x14afd1);}return _0x5e1712[_0xfe5c('0x2a')]();};}function saveUpdates(_0x1dd59d,_0x49670f){return function(_0x5f5be3){if(_0x5f5be3){return _0x5f5be3[_0xfe5c('0x2b')](_0x1dd59d)[_0xfe5c('0x2c')](function(_0x4f7363){return _0x4f7363;});}return null;};}function removeEntity(_0x382972,_0x454979){return function(_0x5c19d4){if(_0x5c19d4){return _0x5c19d4[_0xfe5c('0x2d')]()[_0xfe5c('0x2c')](function(){_0x382972['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a246,_0x48819f){return function(_0x2a3569){if(!_0x2a3569){_0x10a246[_0xfe5c('0x20')](0x194);}return _0x2a3569;};}function handleError(_0x56c7b2,_0x4ab684){_0x4ab684=_0x4ab684||0x1f4;return function(_0x15739d){logger[_0xfe5c('0x2e')](_0x15739d['stack']);if(_0x15739d[_0xfe5c('0x2f')]){delete _0x15739d['name'];}_0x56c7b2[_0xfe5c('0x21')](_0x4ab684)[_0xfe5c('0x30')](_0x15739d);};}exports[_0xfe5c('0x31')]=function(_0x41d1b0,_0xcd37dc){var _0x1bde98={},_0x269ec9={},_0x8f225c={'count':0x0,'rows':[]};var _0x20dd1b=_[_0xfe5c('0x32')](db[_0xfe5c('0x33')][_0xfe5c('0x34')],function(_0x52c062){return{'name':_0x52c062[_0xfe5c('0x35')],'type':_0x52c062[_0xfe5c('0x36')][_0xfe5c('0x37')]};});_0x269ec9[_0xfe5c('0x38')]=_[_0xfe5c('0x32')](_0x20dd1b,_0xfe5c('0x2f'));_0x269ec9[_0xfe5c('0x39')]=_[_0xfe5c('0x3a')](_0x41d1b0['query']);_0x269ec9[_0xfe5c('0x3b')]=_[_0xfe5c('0x3c')](_0x269ec9[_0xfe5c('0x38')],_0x269ec9[_0xfe5c('0x39')]);_0x1bde98[_0xfe5c('0x3d')]=_[_0xfe5c('0x3c')](_0x269ec9['model'],qs['fields'](_0x41d1b0['query']['fields']));_0x1bde98[_0xfe5c('0x3d')]=_0x1bde98[_0xfe5c('0x3d')][_0xfe5c('0x3e')]?_0x1bde98[_0xfe5c('0x3d')]:_0x269ec9['model'];if(!_0x41d1b0[_0xfe5c('0x39')][_0xfe5c('0x3f')](_0xfe5c('0x40'))){_0x1bde98[_0xfe5c('0x24')]=qs['limit'](_0x41d1b0['query']['limit']);_0x1bde98[_0xfe5c('0x25')]=qs['offset'](_0x41d1b0[_0xfe5c('0x39')][_0xfe5c('0x25')]);}_0x1bde98['order']=qs[_0xfe5c('0x41')](_0x41d1b0[_0xfe5c('0x39')][_0xfe5c('0x41')]);_0x1bde98['where']=qs['filters'](_[_0xfe5c('0x42')](_0x41d1b0[_0xfe5c('0x39')],_0x269ec9[_0xfe5c('0x3b')]),_0x20dd1b);if(_0x41d1b0[_0xfe5c('0x39')][_0xfe5c('0x43')]){_0x1bde98[_0xfe5c('0x44')]=_[_0xfe5c('0x45')](_0x1bde98['where'],{'$or':_[_0xfe5c('0x32')](_0x20dd1b,function(_0x2fd2bd){if(_0x2fd2bd[_0xfe5c('0x36')]!==_0xfe5c('0x46')){var _0x3e71ef={};_0x3e71ef[_0x2fd2bd['name']]={'$like':'%'+_0x41d1b0['query'][_0xfe5c('0x43')]+'%'};return _0x3e71ef;}})});}_0x1bde98=_[_0xfe5c('0x45')]({},_0x1bde98,_0x41d1b0[_0xfe5c('0x47')]);var _0x5a003={'where':_0x1bde98[_0xfe5c('0x44')]};return db[_0xfe5c('0x33')][_0xfe5c('0x26')](_0x5a003)[_0xfe5c('0x2c')](function(_0x5ab269){_0x8f225c[_0xfe5c('0x26')]=_0x5ab269;if(_0x41d1b0[_0xfe5c('0x39')][_0xfe5c('0x48')]){_0x1bde98[_0xfe5c('0x49')]=[{'all':!![]}];}return db[_0xfe5c('0x33')][_0xfe5c('0x4a')](_0x1bde98);})['then'](function(_0x559587){_0x8f225c[_0xfe5c('0x4b')]=_0x559587;return _0x8f225c;})[_0xfe5c('0x2c')](respondWithFilteredResult(_0xcd37dc,_0x1bde98))[_0xfe5c('0x4c')](handleError(_0xcd37dc,null));};exports['show']=function(_0x335f87,_0x5e6264){var _0x47955f={'raw':!![],'where':{'id':_0x335f87[_0xfe5c('0x4d')]['id']}},_0x274eee={};_0x274eee[_0xfe5c('0x38')]=_[_0xfe5c('0x3a')](db[_0xfe5c('0x33')][_0xfe5c('0x34')]);_0x274eee[_0xfe5c('0x39')]=_[_0xfe5c('0x3a')](_0x335f87[_0xfe5c('0x39')]);_0x274eee[_0xfe5c('0x3b')]=_[_0xfe5c('0x3c')](_0x274eee[_0xfe5c('0x38')],_0x274eee[_0xfe5c('0x39')]);_0x47955f['attributes']=_[_0xfe5c('0x3c')](_0x274eee[_0xfe5c('0x38')],qs['fields'](_0x335f87['query']['fields']));_0x47955f[_0xfe5c('0x3d')]=_0x47955f['attributes'][_0xfe5c('0x3e')]?_0x47955f['attributes']:_0x274eee['model'];if(_0x335f87['query']['includeAll']){_0x47955f[_0xfe5c('0x49')]=[{'all':!![]}];}_0x47955f=_[_0xfe5c('0x45')]({},_0x47955f,_0x335f87['options']);return db[_0xfe5c('0x33')][_0xfe5c('0x4e')](_0x47955f)['then'](handleEntityNotFound(_0x5e6264,null))['then'](respondWithResult(_0x5e6264,null))['catch'](handleError(_0x5e6264,null));};exports['create']=function(_0x566dc4,_0x2eb053){return db[_0xfe5c('0x33')][_0xfe5c('0x4f')](_0x566dc4['body'],{})['then'](respondWithResult(_0x2eb053,0xc9))[_0xfe5c('0x4c')](handleError(_0x2eb053,null));};exports[_0xfe5c('0x2b')]=function(_0x1ecef2,_0x17f662){if(_0x1ecef2[_0xfe5c('0x50')]['id']){delete _0x1ecef2[_0xfe5c('0x50')]['id'];}return db[_0xfe5c('0x33')]['find']({'where':{'id':_0x1ecef2[_0xfe5c('0x4d')]['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x17f662,null))[_0xfe5c('0x2c')](saveUpdates(_0x1ecef2[_0xfe5c('0x50')],null))[_0xfe5c('0x2c')](respondWithResult(_0x17f662,null))[_0xfe5c('0x4c')](handleError(_0x17f662,null));};exports['destroy']=function(_0x54ba3f,_0x291de5){return db[_0xfe5c('0x33')][_0xfe5c('0x4e')]({'where':{'id':_0x54ba3f['params']['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x291de5,null))[_0xfe5c('0x2c')](removeEntity(_0x291de5,null))[_0xfe5c('0x4c')](handleError(_0x291de5,null));};exports[_0xfe5c('0x51')]=function(_0x4bb684,_0x3f6e3c){return db['ChatGroup'][_0xfe5c('0x51')]()[_0xfe5c('0x2c')](respondWithResult(_0x3f6e3c,null))['catch'](handleError(_0x3f6e3c,null));};exports['getUnread']=function(_0x5a9a48,_0x48e796,_0x5bbb68){return db[_0xfe5c('0x52')]['count']({'where':{'ChatGroupId':_0x5a9a48[_0xfe5c('0x4d')]['id'],'ToId':_0x5a9a48['user']['id'],'read':![]}})[_0xfe5c('0x2c')](function(_0x14dc5a){return{'id':_[_0xfe5c('0x53')](_0x5a9a48[_0xfe5c('0x4d')]['id']),'count':_0x14dc5a};})['then'](respondWithResult(_0x48e796,null))[_0xfe5c('0x4c')](handleError(_0x48e796,null));};exports[_0xfe5c('0x54')]=function(_0xcd8fb9,_0x4862b7,_0x2a4959){return db[_0xfe5c('0x33')][_0xfe5c('0x4e')]({'where':{'id':_0xcd8fb9[_0xfe5c('0x4d')]['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x4862b7,null))[_0xfe5c('0x2c')](function(_0x271146){if(_0x271146){return _0x271146[_0xfe5c('0x54')](_0xcd8fb9[_0xfe5c('0x50')]['ids'],_['omit'](_0xcd8fb9['body'],['ids','id'])||{});}})[_0xfe5c('0x2c')](respondWithResult(_0x4862b7,null))[_0xfe5c('0x4c')](handleError(_0x4862b7,null));};exports[_0xfe5c('0x55')]=function(_0x207f43,_0xc3d17a,_0x2b99c6){var _0x1639c1={};var _0x2fd796={};var _0x30b763;var _0x5bc22c;return db[_0xfe5c('0x33')][_0xfe5c('0x56')]({'where':{'id':_0x207f43[_0xfe5c('0x4d')]['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0xc3d17a,null))[_0xfe5c('0x2c')](function(_0x50429d){if(_0x50429d){_0x30b763=_0x50429d;_0x2fd796[_0xfe5c('0x38')]=_[_0xfe5c('0x3a')](db[_0xfe5c('0x57')][_0xfe5c('0x34')]);_0x2fd796[_0xfe5c('0x39')]=_[_0xfe5c('0x3a')](_0x207f43[_0xfe5c('0x39')]);_0x2fd796[_0xfe5c('0x3b')]=_[_0xfe5c('0x3c')](_0x2fd796[_0xfe5c('0x38')],_0x2fd796[_0xfe5c('0x39')]);_0x1639c1[_0xfe5c('0x3d')]=_['intersection'](_0x2fd796[_0xfe5c('0x38')],qs['fields'](_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x58')]));_0x1639c1[_0xfe5c('0x3d')]=_0x1639c1[_0xfe5c('0x3d')]['length']?_0x1639c1['attributes']:_0x2fd796['model'];_0x1639c1[_0xfe5c('0x59')]=qs[_0xfe5c('0x41')](_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x41')]);_0x1639c1['where']=qs[_0xfe5c('0x3b')](_[_0xfe5c('0x42')](_0x207f43[_0xfe5c('0x39')],_0x2fd796[_0xfe5c('0x3b')]));if(_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x43')]){_0x1639c1['where']=_[_0xfe5c('0x45')](_0x1639c1[_0xfe5c('0x44')],{'$or':_['map'](_0x1639c1[_0xfe5c('0x3d')],function(_0x81a297){var _0x3c8164={};_0x3c8164[_0x81a297]={'$like':'%'+_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x43')]+'%'};return _0x3c8164;})});}_0x1639c1=_['merge']({},_0x1639c1,_0x207f43[_0xfe5c('0x47')]);return _0x30b763['getMembers'](_0x1639c1);}})[_0xfe5c('0x2c')](function(_0x18dd2c){if(_0x18dd2c){_0x5bc22c=_0x18dd2c['length'];if(!_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x3f')]('nolimit')){_0x1639c1[_0xfe5c('0x24')]=qs[_0xfe5c('0x24')](_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x24')]);_0x1639c1[_0xfe5c('0x25')]=qs[_0xfe5c('0x25')](_0x207f43[_0xfe5c('0x39')][_0xfe5c('0x25')]);}return _0x30b763[_0xfe5c('0x55')](_0x1639c1);}})['then'](function(_0x1ba8d6){if(_0x1ba8d6){return _0x1ba8d6?{'count':_0x5bc22c,'rows':_0x1ba8d6}:null;}})[_0xfe5c('0x2c')](respondWithResult(_0xc3d17a,null))[_0xfe5c('0x4c')](handleError(_0xc3d17a,null));};exports[_0xfe5c('0x5a')]=function(_0x1e02d0,_0x49b493,_0x33f131){return db['ChatGroup'][_0xfe5c('0x4e')]({'where':{'id':_0x1e02d0[_0xfe5c('0x4d')]['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x49b493,null))[_0xfe5c('0x2c')](function(_0x37fdaf){if(_0x37fdaf){return _0x37fdaf['removeMembers'](_0x1e02d0['query'][_0xfe5c('0x5b')]);}})[_0xfe5c('0x2c')](respondWithStatusCode(_0x49b493,null))['catch'](handleError(_0x49b493,null));};exports[_0xfe5c('0x5c')]=function(_0x21f80c,_0x495235,_0x5b3828){if(_0x21f80c[_0xfe5c('0x50')]['id']){delete _0x21f80c[_0xfe5c('0x50')]['id'];}return db[_0xfe5c('0x33')][_0xfe5c('0x4e')]({'where':{'id':_0x21f80c[_0xfe5c('0x4d')]['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x495235,null))[_0xfe5c('0x2c')](function(_0x529cbd){if(_0x529cbd){_0x21f80c['body'][_0xfe5c('0x5d')]=_0x529cbd['id'];return db[_0xfe5c('0x52')]['create'](_0x21f80c[_0xfe5c('0x50')]);}})[_0xfe5c('0x2c')](respondWithResult(_0x495235,null))[_0xfe5c('0x4c')](handleError(_0x495235,null));};exports[_0xfe5c('0x5e')]=function(_0x147c32,_0x1b0ca6,_0x50aa9d){var _0x123267={};var _0x146870={};var _0x21d2f0;var _0x37970a;return db[_0xfe5c('0x33')][_0xfe5c('0x56')]({'where':{'id':_0x147c32['params']['id']}})[_0xfe5c('0x2c')](handleEntityNotFound(_0x1b0ca6,null))['then'](function(_0x3d006c){if(_0x3d006c){_0x21d2f0=_0x3d006c;_0x146870[_0xfe5c('0x38')]=_['keys'](db[_0xfe5c('0x52')]['rawAttributes']);_0x146870['query']=_['keys'](_0x147c32[_0xfe5c('0x39')]);_0x146870[_0xfe5c('0x3b')]=_[_0xfe5c('0x3c')](_0x146870[_0xfe5c('0x38')],_0x146870[_0xfe5c('0x39')]);_0x123267['attributes']=_['intersection'](_0x146870[_0xfe5c('0x38')],qs[_0xfe5c('0x58')](_0x147c32[_0xfe5c('0x39')][_0xfe5c('0x58')]));_0x123267[_0xfe5c('0x3d')]=_0x123267[_0xfe5c('0x3d')][_0xfe5c('0x3e')]?_0x123267['attributes']:_0x146870[_0xfe5c('0x38')];_0x123267[_0xfe5c('0x59')]=qs[_0xfe5c('0x41')](_0x147c32['query'][_0xfe5c('0x41')]);_0x123267[_0xfe5c('0x44')]=qs[_0xfe5c('0x3b')](_[_0xfe5c('0x42')](_0x147c32[_0xfe5c('0x39')],_0x146870['filters']));if(_0x147c32[_0xfe5c('0x39')]['filter']){_0x123267[_0xfe5c('0x44')]=_[_0xfe5c('0x45')](_0x123267[_0xfe5c('0x44')],{'$or':_[_0xfe5c('0x32')](_0x123267['attributes'],function(_0x153a13){var _0x39014b={};_0x39014b[_0x153a13]={'$like':'%'+_0x147c32[_0xfe5c('0x39')]['filter']+'%'};return _0x39014b;})});}if(_0x147c32['query'][_0xfe5c('0x5f')]){var _0x51ea0e=_0x147c32['query'][_0xfe5c('0x5f')][_0xfe5c('0x60')](',');var _0x1ac773={};_0x1ac773[_0x51ea0e[0x0]]={'$gte':moment(_0x51ea0e[0x1])[_0xfe5c('0x61')](_0xfe5c('0x62'))};_0x123267[_0xfe5c('0x44')]=_[_0xfe5c('0x45')](_0x123267[_0xfe5c('0x44')],_0x1ac773);}_0x123267=_[_0xfe5c('0x45')]({},_0x123267,_0x147c32[_0xfe5c('0x47')]);return _0x21d2f0[_0xfe5c('0x5e')](_0x123267);}})[_0xfe5c('0x2c')](function(_0x3b316a){if(_0x3b316a){_0x37970a=_0x3b316a[_0xfe5c('0x3e')];if(!_0x147c32[_0xfe5c('0x39')][_0xfe5c('0x3f')](_0xfe5c('0x40'))){_0x123267[_0xfe5c('0x24')]=qs[_0xfe5c('0x24')](_0x147c32['query'][_0xfe5c('0x24')]);_0x123267['offset']=qs[_0xfe5c('0x25')](_0x147c32['query']['offset']);}return _0x21d2f0[_0xfe5c('0x5e')](_0x123267);}})[_0xfe5c('0x2c')](function(_0x59dde8){if(_0x59dde8){return _0x59dde8?{'count':_0x37970a,'rows':_0x59dde8}:null;}})[_0xfe5c('0x2c')](respondWithResult(_0x1b0ca6,null))[_0xfe5c('0x4c')](handleError(_0x1b0ca6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 63d96f2..1081137 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 _0xf82b=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x39fdb7,_0x5ac80d){var _0xbd17e7=function(_0x33c1ef){while(--_0x33c1ef){_0x39fdb7['push'](_0x39fdb7['shift']());}};_0xbd17e7(++_0x5ac80d);}(_0xf82b,0xe3));var _0xbf82=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf82b[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xbf82('0x0'));var ChatGroup=require(_0xbf82('0x1'))['db'][_0xbf82('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbf82('0x3')](0x0);var events={'afterCreate':_0xbf82('0x4'),'afterUpdate':_0xbf82('0x5'),'afterDestroy':_0xbf82('0x6')};function emitEvent(_0x37a39d){return function(_0x5ea455,_0x13fb0b,_0x2d2eee){ChatGroupEvents[_0xbf82('0x7')](_0x37a39d+':'+_0x5ea455['id'],_0x5ea455);ChatGroupEvents['emit'](_0x37a39d,_0x5ea455);_0x2d2eee(null);};}for(var e in events){if(events[_0xbf82('0x8')](e)){var event=events[e];ChatGroup[_0xbf82('0x9')](e,emitEvent(event));}}module[_0xbf82('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0x0309=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove'];(function(_0x58bf06,_0x4b9259){var _0x122771=function(_0x481817){while(--_0x481817){_0x58bf06['push'](_0x58bf06['shift']());}};_0x122771(++_0x4b9259);}(_0x0309,0x8d));var _0x9030=function(_0x17931e,_0x96932c){_0x17931e=_0x17931e-0x0;var _0x4ec2ff=_0x0309[_0x17931e];return _0x4ec2ff;};'use strict';var EventEmitter=require(_0x9030('0x0'));var ChatGroup=require(_0x9030('0x1'))['db'][_0x9030('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9030('0x3')](0x0);var events={'afterCreate':_0x9030('0x4'),'afterUpdate':'update','afterDestroy':_0x9030('0x5')};function emitEvent(_0x1131fd){return function(_0x4aa8c5,_0x52abf3,_0x300f73){ChatGroupEvents['emit'](_0x1131fd+':'+_0x4aa8c5['id'],_0x4aa8c5);ChatGroupEvents['emit'](_0x1131fd,_0x4aa8c5);_0x300f73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9030('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index cefefcd..f2d1e6d 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 _0xdcd3=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x13405d,_0x44a104){var _0x4784cc=function(_0x2620e6){while(--_0x2620e6){_0x13405d['push'](_0x13405d['shift']());}};_0x4784cc(++_0x44a104);}(_0xdcd3,0x19f));var _0x3dcd=function(_0xf19a74,_0x11026c){_0xf19a74=_0xf19a74-0x0;var _0x14b399=_0xdcd3[_0xf19a74];return _0x14b399;};'use strict';var _=require(_0x3dcd('0x0'));var util=require(_0x3dcd('0x1'));var logger=require(_0x3dcd('0x2'))(_0x3dcd('0x3'));var moment=require('moment');var BPromise=require(_0x3dcd('0x4'));var rp=require(_0x3dcd('0x5'));var fs=require('fs');var path=require(_0x3dcd('0x6'));var rimraf=require(_0x3dcd('0x7'));var config=require('../../config/environment');var attributes=require(_0x3dcd('0x8'));module[_0x3dcd('0x9')]=function(_0x44c1aa,_0x2742b7){return _0x44c1aa[_0x3dcd('0xa')](_0x3dcd('0xb'),attributes,{'tableName':_0x3dcd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce0a=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xce0a,0xf0));var _0xace0=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0xce0a[_0x427217];return _0x5b28fb;};'use strict';var _=require(_0xace0('0x0'));var util=require(_0xace0('0x1'));var logger=require(_0xace0('0x2'))(_0xace0('0x3'));var moment=require('moment');var BPromise=require(_0xace0('0x4'));var rp=require(_0xace0('0x5'));var fs=require('fs');var path=require(_0xace0('0x6'));var rimraf=require(_0xace0('0x7'));var config=require(_0xace0('0x8'));var attributes=require(_0xace0('0x9'));module[_0xace0('0xa')]=function(_0x397ae4,_0x4655f2){return _0x397ae4[_0xace0('0xb')](_0xace0('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 187d8b5..78d6c59 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 _0xadc5=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x443691,_0x17b893){var _0xb668dc=function(_0x4ae1b8){while(--_0x4ae1b8){_0x443691['push'](_0x443691['shift']());}};_0xb668dc(++_0x17b893);}(_0xadc5,0x1bd));var _0x5adc=function(_0x4113ca,_0x22afff){_0x4113ca=_0x4113ca-0x0;var _0x4328ab=_0xadc5[_0x4113ca];return _0x4328ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5adc('0x0'));var BPromise=require(_0x5adc('0x1'));var rs=require(_0x5adc('0x2'));var fs=require('fs');var Redis=require(_0x5adc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5adc('0x4'))(_0x5adc('0x5'));var config=require(_0x5adc('0x6'));var jayson=require(_0x5adc('0x7'));var client=jayson[_0x5adc('0x8')][_0x5adc('0x9')]({'port':0x232a});config[_0x5adc('0xa')]=_[_0x5adc('0xb')](config[_0x5adc('0xa')],{'host':_0x5adc('0xc'),'port':0x18eb});var socket=require(_0x5adc('0xd'))(new Redis(config[_0x5adc('0xa')]));require(_0x5adc('0xe'))[_0x5adc('0xf')](socket);function respondWithRpcPromise(_0x2c3df1,_0x436a13,_0x166703){return new BPromise(function(_0x1be611,_0xeb4ebf){return client[_0x5adc('0x10')](_0x2c3df1,_0x166703)[_0x5adc('0x11')](function(_0x2b76ca){logger[_0x5adc('0x12')](_0x5adc('0x13'),_0x436a13,_0x5adc('0x14'));logger['debug'](_0x5adc('0x15'),_0x436a13,_0x5adc('0x14'),JSON[_0x5adc('0x16')](_0x2b76ca));if(_0x2b76ca[_0x5adc('0x17')]){if(_0x2b76ca[_0x5adc('0x17')]['code']===0x1f4){logger[_0x5adc('0x17')](_0x5adc('0x13'),_0x436a13,_0x2b76ca['error'][_0x5adc('0x18')]);return _0xeb4ebf(_0x2b76ca[_0x5adc('0x17')][_0x5adc('0x18')]);}logger[_0x5adc('0x17')](_0x5adc('0x13'),_0x436a13,_0x2b76ca[_0x5adc('0x17')][_0x5adc('0x18')]);return _0x1be611(_0x2b76ca[_0x5adc('0x17')][_0x5adc('0x18')]);}else{logger[_0x5adc('0x12')]('ChatGroup,\x20%s,\x20%s',_0x436a13,_0x5adc('0x14'));_0x1be611(_0x2b76ca[_0x5adc('0x19')]['message']);}})[_0x5adc('0x1a')](function(_0x2f9ad4){logger[_0x5adc('0x17')](_0x5adc('0x13'),_0x436a13,_0x2f9ad4);_0xeb4ebf(_0x2f9ad4);});});} \ No newline at end of file +var _0x46fc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x260d4b,_0x25be3a){var _0x32751f=function(_0xd7db96){while(--_0xd7db96){_0x260d4b['push'](_0x260d4b['shift']());}};_0x32751f(++_0x25be3a);}(_0x46fc,0x103));var _0xc46f=function(_0x5904ba,_0x38ce04){_0x5904ba=_0x5904ba-0x0;var _0x996e12=_0x46fc[_0x5904ba];return _0x996e12;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var moment=require(_0xc46f('0x2'));var BPromise=require(_0xc46f('0x3'));var rs=require(_0xc46f('0x4'));var fs=require('fs');var Redis=require(_0xc46f('0x5'));var db=require(_0xc46f('0x6'))['db'];var utils=require(_0xc46f('0x7'));var logger=require(_0xc46f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46f('0x9'));var client=jayson[_0xc46f('0xa')][_0xc46f('0xb')]({'port':0x232a});config[_0xc46f('0xc')]=_[_0xc46f('0xd')](config[_0xc46f('0xc')],{'host':_0xc46f('0xe'),'port':0x18eb});var socket=require(_0xc46f('0xf'))(new Redis(config[_0xc46f('0xc')]));require(_0xc46f('0x10'))[_0xc46f('0x11')](socket);function respondWithRpcPromise(_0x3df2a4,_0x112351,_0x832eae){return new BPromise(function(_0x58eaa5,_0x3b438d){return client[_0xc46f('0x12')](_0x3df2a4,_0x832eae)[_0xc46f('0x13')](function(_0x14e547){logger['info']('ChatGroup,\x20%s,\x20%s',_0x112351,'request\x20sent');logger[_0xc46f('0x14')](_0xc46f('0x15'),_0x112351,'request\x20sent',JSON[_0xc46f('0x16')](_0x14e547));if(_0x14e547[_0xc46f('0x17')]){if(_0x14e547['error']['code']===0x1f4){logger[_0xc46f('0x17')](_0xc46f('0x18'),_0x112351,_0x14e547[_0xc46f('0x17')][_0xc46f('0x19')]);return _0x3b438d(_0x14e547['error']['message']);}logger['error'](_0xc46f('0x18'),_0x112351,_0x14e547[_0xc46f('0x17')][_0xc46f('0x19')]);return _0x58eaa5(_0x14e547['error'][_0xc46f('0x19')]);}else{logger[_0xc46f('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x112351,'request\x20sent');_0x58eaa5(_0x14e547[_0xc46f('0x1b')]['message']);}})[_0xc46f('0x1c')](function(_0x14d1f5){logger[_0xc46f('0x17')]('ChatGroup,\x20%s,\x20%s',_0x112351,_0x14d1f5);_0x3b438d(_0x14d1f5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 424597d..660e0ef 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 _0x006b=['length','chatGroup:','./chatGroup.events','save','update','emit','removeListener'];(function(_0x2a6ab8,_0x5eb621){var _0x5752ab=function(_0x49766d){while(--_0x49766d){_0x2a6ab8['push'](_0x2a6ab8['shift']());}};_0x5752ab(++_0x5eb621);}(_0x006b,0x87));var _0xb006=function(_0x39804e,_0x5d5530){_0x39804e=_0x39804e-0x0;var _0x32a258=_0x006b[_0x39804e];return _0x32a258;};'use strict';var ChatGroupEvents=require(_0xb006('0x0'));var events=[_0xb006('0x1'),'remove',_0xb006('0x2')];function createListener(_0xd66c51,_0x5c3a32){return function(_0x2693c8){_0x5c3a32[_0xb006('0x3')](_0xd66c51,_0x2693c8);};}function removeListener(_0x455eed,_0x5e10a8){return function(){ChatGroupEvents[_0xb006('0x4')](_0x455eed,_0x5e10a8);};}exports['register']=function(_0xce406b){for(var _0x1b06b3=0x0,_0x9518e1=events[_0xb006('0x5')];_0x1b06b3<_0x9518e1;_0x1b06b3++){var _0x33bddb=events[_0x1b06b3];var _0x56b6f1=createListener(_0xb006('0x6')+_0x33bddb,_0xce406b);ChatGroupEvents['on'](_0x33bddb,_0x56b6f1);}}; \ No newline at end of file +var _0xe1e1=['length','chatGroup:','save','removeListener','register'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe1e1,0xcf));var _0x1e1e=function(_0x813342,_0x1210d1){_0x813342=_0x813342-0x0;var _0x44ab10=_0xe1e1[_0x813342];return _0x44ab10;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x1e1e('0x0'),'remove','update'];function createListener(_0xa96c8f,_0x1cf029){return function(_0x199075){_0x1cf029['emit'](_0xa96c8f,_0x199075);};}function removeListener(_0x4881bb,_0x422ac2){return function(){ChatGroupEvents[_0x1e1e('0x1')](_0x4881bb,_0x422ac2);};}exports[_0x1e1e('0x2')]=function(_0x53e4c){for(var _0x59d82c=0x0,_0x19926d=events[_0x1e1e('0x3')];_0x59d82c<_0x19926d;_0x59d82c++){var _0x34b57b=events[_0x59d82c];var _0x17a7f5=createListener(_0x1e1e('0x4')+_0x34b57b,_0x53e4c);ChatGroupEvents['on'](_0x34b57b,_0x17a7f5);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d5f7d89..3e17463 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 _0x8700=['getUnread','/:id/members','getMembers','get','/:id/messages','getMessages','post','create','addMessage','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','/describe','/:id','show'];(function(_0x4109ed,_0x3afcf5){var _0x1e8493=function(_0x5843e5){while(--_0x5843e5){_0x4109ed['push'](_0x4109ed['shift']());}};_0x1e8493(++_0x3afcf5);}(_0x8700,0x75));var _0x0870=function(_0x221102,_0x458de6){_0x221102=_0x221102-0x0;var _0x5d0673=_0x8700[_0x221102];return _0x5d0673;};'use strict';var multer=require(_0x0870('0x0'));var util=require(_0x0870('0x1'));var path=require(_0x0870('0x2'));var timeout=require('connect-timeout');var express=require(_0x0870('0x3'));var router=express[_0x0870('0x4')]();var fs_extra=require(_0x0870('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0870('0x6'));var config=require('../../config/environment');var controller=require(_0x0870('0x7'));router['get']('/',auth[_0x0870('0x8')](),controller[_0x0870('0x9')]);router['get'](_0x0870('0xa'),auth[_0x0870('0x8')](),controller['describe']);router['get'](_0x0870('0xb'),auth[_0x0870('0x8')](),controller[_0x0870('0xc')]);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0x0870('0xd')]);router['get'](_0x0870('0xe'),auth['isAuthenticated'](),controller[_0x0870('0xf')]);router[_0x0870('0x10')](_0x0870('0x11'),auth['isAuthenticated'](),controller[_0x0870('0x12')]);router[_0x0870('0x13')]('/',auth['isAuthenticated'](),controller[_0x0870('0x14')]);router['post']('/:id/members',auth[_0x0870('0x8')](),controller['addMembers']);router[_0x0870('0x13')]('/:id/messages',auth[_0x0870('0x8')](),controller[_0x0870('0x15')]);router['put'](_0x0870('0xb'),auth[_0x0870('0x8')](),controller[_0x0870('0x16')]);router[_0x0870('0x17')](_0x0870('0xb'),auth[_0x0870('0x8')](),controller[_0x0870('0x18')]);router['delete']('/:id/members',auth[_0x0870('0x8')](),controller['removeMembers']);module[_0x0870('0x19')]=router; \ No newline at end of file +var _0xcf66=['post','create','addMembers','put','update','delete','destroy','removeMembers','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','/:id','getUnread','get','/:id/members','getMembers','/:id/messages','getMessages'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xcf66,0x19d));var _0x6cf6=function(_0x41c443,_0x28ef86){_0x41c443=_0x41c443-0x0;var _0x2e2a6c=_0xcf66[_0x41c443];return _0x2e2a6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6cf6('0x0'));var timeout=require(_0x6cf6('0x1'));var express=require(_0x6cf6('0x2'));var router=express[_0x6cf6('0x3')]();var fs_extra=require(_0x6cf6('0x4'));var auth=require(_0x6cf6('0x5'));var interaction=require(_0x6cf6('0x6'));var config=require(_0x6cf6('0x7'));var controller=require(_0x6cf6('0x8'));router['get']('/',auth[_0x6cf6('0x9')](),controller[_0x6cf6('0xa')]);router['get'](_0x6cf6('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6cf6('0xc'),auth[_0x6cf6('0x9')](),controller['show']);router['get']('/:id/unread',auth[_0x6cf6('0x9')](),controller[_0x6cf6('0xd')]);router[_0x6cf6('0xe')](_0x6cf6('0xf'),auth['isAuthenticated'](),controller[_0x6cf6('0x10')]);router[_0x6cf6('0xe')](_0x6cf6('0x11'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x12')]);router[_0x6cf6('0x13')]('/',auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x14')]);router[_0x6cf6('0x13')](_0x6cf6('0xf'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x15')]);router[_0x6cf6('0x13')](_0x6cf6('0x11'),auth[_0x6cf6('0x9')](),controller['addMessage']);router[_0x6cf6('0x16')]('/:id',auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x17')]);router[_0x6cf6('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x6cf6('0x19')]);router['delete'](_0x6cf6('0xf'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x1a')]);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 3686b8f..27a4acc 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 _0xd7a0=['ENUM','out','BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','DATE','STRING'];(function(_0x35d2d6,_0x14e944){var _0x1637d5=function(_0x327b04){while(--_0x327b04){_0x35d2d6['push'](_0x35d2d6['shift']());}};_0x1637d5(++_0x14e944);}(_0xd7a0,0x163));var _0x0d7a=function(_0x4aa3ac,_0x1dc5ea){_0x4aa3ac=_0x4aa3ac-0x0;var _0x24c9e6=_0xd7a0[_0x4aa3ac];return _0x24c9e6;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module[_0x0d7a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0d7a('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x0d7a('0x3'),_0x0d7a('0x4')),'defaultValue':_0x0d7a('0x3')},'ratingMessage':{'type':Sequelize[_0x0d7a('0x5')]},'pathTranscript':{'type':Sequelize[_0x0d7a('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0d7a('0x6')]},'disposition':{'type':Sequelize[_0x0d7a('0x7')]},'secondDisposition':{'type':Sequelize[_0x0d7a('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0d7a('0x7')]},'note':{'type':Sequelize[_0x0d7a('0x7')]},'browserName':{'type':Sequelize[_0x0d7a('0x7')]},'browserVersion':{'type':Sequelize[_0x0d7a('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x0d7a('0x7')]},'deviceModel':{'type':Sequelize[_0x0d7a('0x7')]},'deviceVendor':{'type':Sequelize[_0x0d7a('0x7')]},'deviceType':{'type':Sequelize[_0x0d7a('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x0d7a('0x7')]},'formData':{'type':Sequelize[_0x0d7a('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x0d7a('0x6')]},'lastMsgAt':{'type':Sequelize[_0x0d7a('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x0d7a('0x8')]('in',_0x0d7a('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0d7a('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x0d7a('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c71=['BOOLEAN','exports','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0c71,0xfb));var _0x10c7=function(_0xea35b3,_0x18f99a){_0xea35b3=_0xea35b3-0x0;var _0xcac0c5=_0x0c71[_0xea35b3];return _0xcac0c5;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x10c7('0x1')]},'ratingType':{'type':Sequelize[_0x10c7('0x2')](_0x10c7('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x10c7('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x10c7('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x10c7('0x6')]},'disposition':{'type':Sequelize[_0x10c7('0x5')]},'secondDisposition':{'type':Sequelize[_0x10c7('0x5')]},'thirdDisposition':{'type':Sequelize[_0x10c7('0x5')]},'note':{'type':Sequelize[_0x10c7('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x10c7('0x5')]},'osName':{'type':Sequelize[_0x10c7('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x10c7('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x10c7('0x4')]},'customerIp':{'type':Sequelize[_0x10c7('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x10c7('0x7'))},'read1stAt':{'type':Sequelize[_0x10c7('0x6')]},'lastMsgAt':{'type':Sequelize[_0x10c7('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x10c7('0x2')]('in',_0x10c7('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x10c7('0x5')]},'customerPort':{'type':Sequelize[_0x10c7('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x10c7('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x10c7('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c5c94c4..ef15404 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 _0x9f62=['findAll','getMyMessages','addTags','setTags','ids','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','read','Account','Owner','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','.pdf','err','zip-dir','moment','bluebird','mustache','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','stack','name','send','render','merge','body','contact','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','talking','answered','unmanaged','abandoned','total','UserId','closed','waiting','disposition','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','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','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`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?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','user','sequelize','toString','ChatInteraction','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.mobile','o.fullname','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','includeAll','include','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','ValidationError','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','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','omit','getMessages','nolimit','sort','$gte','options'];(function(_0x2ca55e,_0x280c31){var _0x3c7753=function(_0x4719e8){while(--_0x4719e8){_0x2ca55e['push'](_0x2ca55e['shift']());}};_0x3c7753(++_0x280c31);}(_0x9f62,0x154));var _0x29f6=function(_0x209c36,_0x26b379){_0x209c36=_0x209c36-0x0;var _0x2a0f24=_0x9f62[_0x209c36];return _0x2a0f24;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x0'));var rp=require('request-promise');var moment=require(_0x29f6('0x1'));var BPromise=require(_0x29f6('0x2'));var Mustache=require(_0x29f6('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x29f6('0x4'));var fs=require('fs');var _=require(_0x29f6('0x5'));var squel=require(_0x29f6('0x6'));var Redis=require(_0x29f6('0x7'));var qs=require('../../components/parsers/qs');var as=require(_0x29f6('0x8'));var pdf=require(_0x29f6('0x9'));var logger=require(_0x29f6('0xa'))(_0x29f6('0xb'));var config=require(_0x29f6('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x29f6('0xd'),'port':0x18eb});var socket=require(_0x29f6('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x29f6('0xf')](socket);var jayson=require(_0x29f6('0x10'));var client=jayson['client'][_0x29f6('0x11')]({'port':0x232b});var client9004=jayson[_0x29f6('0x12')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b9b6a,_0x559585,_0x57b2d2,_0x2ae0e4){return new BPromise(function(_0x55cf4,_0x189344){var _0x11a1fd=_0x2ae0e4||client;return _0x11a1fd[_0x29f6('0x13')](_0x5b9b6a,_0x57b2d2)[_0x29f6('0x14')](function(_0x35d2e2){logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));logger[_0x29f6('0x18')](_0x29f6('0x19'),_0x559585,_0x29f6('0x17'),JSON[_0x29f6('0x1a')](_0x35d2e2));if(_0x35d2e2[_0x29f6('0x1b')]){if(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x559585,_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x189344(_0x35d2e2[_0x29f6('0x1b')]['message']);}logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x35d2e2['error'][_0x29f6('0x1d')]);return _0x55cf4(_0x35d2e2[_0x29f6('0x1b')][_0x29f6('0x1d')]);}else{logger[_0x29f6('0x15')](_0x29f6('0x16'),_0x559585,_0x29f6('0x17'));_0x55cf4(_0x35d2e2['result'][_0x29f6('0x1d')]);}})['catch'](function(_0x4acb15){logger[_0x29f6('0x1b')](_0x29f6('0x16'),_0x559585,_0x4acb15);_0x189344(_0x4acb15);});});}function respondWithStatusCode(_0x39c6b3,_0xafb5dd){_0xafb5dd=_0xafb5dd||0xcc;return function(_0x54ddeb){if(_0x54ddeb){return _0x39c6b3[_0x29f6('0x1e')](_0xafb5dd);}return _0x39c6b3['status'](_0xafb5dd)[_0x29f6('0x1f')]();};}function respondWithResult(_0xcce041,_0x4200cc){_0x4200cc=_0x4200cc||0xc8;return function(_0x1b80aa){if(_0x1b80aa){return _0xcce041['status'](_0x4200cc)[_0x29f6('0x20')](_0x1b80aa);}};}function respondWithFilteredResult(_0x4d494f,_0x47c385){return function(_0x1401fb){if(_0x1401fb){var _0x45f792=typeof _0x47c385[_0x29f6('0x21')]===_0x29f6('0x22')&&typeof _0x47c385[_0x29f6('0x23')]===_0x29f6('0x22');var _0x23c630=_0x1401fb['count'];var _0x2183b7=_0x45f792?0x0:_0x47c385[_0x29f6('0x21')];var _0x1ab8d8=_0x45f792?_0x1401fb[_0x29f6('0x24')]:_0x47c385[_0x29f6('0x21')]+_0x47c385[_0x29f6('0x23')];var _0x3790f5;if(_0x1ab8d8>=_0x23c630){_0x1ab8d8=_0x23c630;_0x3790f5=0xc8;}else{_0x3790f5=0xce;}_0x4d494f[_0x29f6('0x25')](_0x3790f5);return _0x4d494f[_0x29f6('0x26')](_0x29f6('0x27'),_0x2183b7+'-'+_0x1ab8d8+'/'+_0x23c630)[_0x29f6('0x20')](_0x1401fb);}return null;};}function saveUpdates(_0x1c3f0b){return function(_0x40c830){if(_0x40c830){return _0x40c830[_0x29f6('0x28')](_0x1c3f0b)[_0x29f6('0x14')](function(_0x218931){return _0x218931;});}return null;};}function removeEntity(_0x3a7249){return function(_0x5492c2){if(_0x5492c2){return _0x5492c2['destroy']()[_0x29f6('0x14')](function(){_0x3a7249['status'](0xcc)[_0x29f6('0x1f')]();});}};}function handleEntityNotFound(_0xc8d2c5){return function(_0x1e1bb6){if(!_0x1e1bb6){_0xc8d2c5[_0x29f6('0x1e')](0x194);}return _0x1e1bb6;};}function handleError(_0x5e5d89,_0x53e11f){_0x53e11f=_0x53e11f||0x1f4;return function(_0x1bde69){logger[_0x29f6('0x1b')](_0x1bde69[_0x29f6('0x29')]);if(_0x1bde69[_0x29f6('0x2a')]){delete _0x1bde69[_0x29f6('0x2a')];}_0x5e5d89[_0x29f6('0x25')](_0x53e11f)[_0x29f6('0x2b')](_0x1bde69);};}function getMustacheRender(_0x1c3f0f,_0xad83a3){return Mustache[_0x29f6('0x2c')](_0x1c3f0f,_[_0x29f6('0x2d')](_0xad83a3[_0x29f6('0x2e')],{'contact':_0xad83a3[_0x29f6('0x2f')],'message':_0xad83a3[_0x29f6('0x1d')],'agent':_0xad83a3['agent'],'interaction':_0xad83a3['interaction'],'account':_0xad83a3[_0x29f6('0x30')]}))||'';}function getInteractionUsers(_0x44cf19,_0x1cd62a){return new BPromise(function(_0x5416dc,_0x3e1e25){try{if(_0x1cd62a[_0x44cf19['id']]){_0x44cf19[_0x29f6('0x31')]=_[_0x29f6('0x32')](_0x1cd62a[_0x44cf19['id']],function(_0x27d945){return{'id':_0x27d945['id'],'fullname':_0x27d945[_0x29f6('0x33')]};});}}catch(_0x48fbd1){_0x3e1e25(_0x48fbd1);}_0x5416dc(_0x44cf19);});}function getInteractionTags(_0x7695ee,_0x2ad06f){return new BPromise(function(_0x2c3441,_0x1b51cc){try{if(_0x7695ee['TagIds']){_0x7695ee[_0x29f6('0x34')]=[];_0x7695ee[_0x29f6('0x35')][_0x29f6('0x36')](',')[_0x29f6('0x37')](function(_0x5ddc09){_0x7695ee['Tags'][_0x29f6('0x38')](_0x2ad06f[_0x5ddc09]);});}delete _0x7695ee['TagIds'];}catch(_0x10f077){_0x1b51cc(_0x10f077);}_0x2c3441(_0x7695ee);});}function updateChatInteraction(_0x551411,_0x3a1a75,_0x537210){return new BPromise(function(_0x34b1ea,_0x11fb2d){return getInteractionUsers(_0x551411,_0x537210)['then'](function(_0x1431fc){return getInteractionTags(_0x1431fc,_0x3a1a75);})['then'](function(_0x3f3475){return getStateInteraction(_0x3f3475);})[_0x29f6('0x14')](function(_0x4aea11){_0x34b1ea(_0x4aea11);})[_0x29f6('0x39')](function(_0xc6a6b1){_0x11fb2d(_0xc6a6b1);});});}function getStateInteraction(_0x2cad42){return new BPromise(function(_0x1e9d5a){_0x2cad42['waiting']=0x0;_0x2cad42[_0x29f6('0x3a')]=0x0;_0x2cad42[_0x29f6('0x3b')]=0x0;_0x2cad42[_0x29f6('0x3c')]=0x0;_0x2cad42[_0x29f6('0x3d')]=0x0;_0x2cad42[_0x29f6('0x3e')]=0x0;if(!_0x2cad42['closed']&&!_0x2cad42[_0x29f6('0x3f')]){_0x2cad42['waiting']+=0x1;}if(!_0x2cad42[_0x29f6('0x40')]&&_0x2cad42['UserId']){_0x2cad42[_0x29f6('0x3a')]+=0x1;if(_0x2cad42[_0x29f6('0x41')]){_0x2cad42['waiting']-=0x1;}}if(_0x2cad42[_0x29f6('0x40')]&&_0x2cad42[_0x29f6('0x42')]===_0x29f6('0x3d')){_0x2cad42[_0x29f6('0x3d')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42[_0x29f6('0x40')]&&!_0x2cad42[_0x29f6('0x3f')]&&_0x2cad42['disposition']){_0x2cad42[_0x29f6('0x3c')]+=0x1;if(_0x2cad42['waiting']){_0x2cad42[_0x29f6('0x41')]-=0x1;}}else if(_0x2cad42['closed']&&_0x2cad42['UserId']){_0x2cad42['answered']+=0x1;if(_0x2cad42[_0x29f6('0x3a')]){_0x2cad42[_0x29f6('0x3a')]-=0x1;}}_0x2cad42[_0x29f6('0x3e')]+=0x1;_0x1e9d5a(_0x2cad42);});}exports[_0x29f6('0x43')]=function(_0x19fd60,_0x270842){var _0x29b3f6={},_0x155ffb={},_0x352119={'count':0x0,'rows':[]};var _0x1bde93=_['map'](db['ChatInteraction'][_0x29f6('0x44')],function(_0x450e76){return{'name':_0x450e76[_0x29f6('0x45')],'type':_0x450e76[_0x29f6('0x46')]['key']};});_0x155ffb[_0x29f6('0x47')]=_[_0x29f6('0x32')](_0x1bde93,'name');_0x155ffb[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x19fd60[_0x29f6('0x48')]);_0x155ffb[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],_0x155ffb[_0x29f6('0x48')]);_0x29b3f6[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x155ffb[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x19fd60[_0x29f6('0x48')]['fields']));_0x29b3f6[_0x29f6('0x4c')]=_0x29b3f6[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x29b3f6[_0x29f6('0x4c')]:_0x155ffb[_0x29f6('0x47')];if(!_0x19fd60['query'][_0x29f6('0x4f')]('nolimit')){_0x29b3f6['limit']=qs[_0x29f6('0x23')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x23')]);_0x29b3f6[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x19fd60['query'][_0x29f6('0x21')]);}_0x29b3f6[_0x29f6('0x50')]=qs['sort'](_0x19fd60[_0x29f6('0x48')]['sort']);_0x29b3f6[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x19fd60[_0x29f6('0x48')],_0x155ffb['filters']),_0x1bde93);var _0x199060=[];var _0xaa915c=squel[_0x29f6('0x53')]()[_0x29f6('0x54')]('id')[_0x29f6('0x54')](_0x29f6('0x2a'))[_0x29f6('0x54')]('color')[_0x29f6('0x55')](_0x29f6('0x56'));var _0x3bca11=squel[_0x29f6('0x53')]()[_0x29f6('0x54')](_0x29f6('0x57'))[_0x29f6('0x54')](_0x29f6('0x58'))[_0x29f6('0x54')](_0x29f6('0x59'))['from']('user_has_chat_interactions','ui')[_0x29f6('0x5a')](_0x29f6('0x5b'),'u',_0x29f6('0x5c'));var _0x5ab84e=squel[_0x29f6('0x53')]()['from']('chat_interactions','i')[_0x29f6('0x5a')](_0x29f6('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x29f6('0x5b'),'o',_0x29f6('0x5e'))[_0x29f6('0x5a')]('chat_websites','a',_0x29f6('0x5f'))[_0x29f6('0x5a')](_0x29f6('0x60'),'me',_0x29f6('0x61'))[_0x29f6('0x5a')](_0x29f6('0x62'),'it',_0x29f6('0x63'))[_0x29f6('0x5a')](_0x29f6('0x56'),'t',_0x29f6('0x64'));var _0x2d4c8d=squel[_0x29f6('0x65')]();var _0x434e04=[];var _0x5078d1=squel['expr']();var _0x2bd7d9;if(_0x19fd60['query'][_0x29f6('0x66')]){_0x2bd7d9=as[_0x29f6('0x67')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x66')]);var _0x2f757b=_0x2bd7d9['sqlOperator'];for(var _0x56c442=0x0;_0x56c442<_0x2bd7d9[_0x29f6('0x68')][_0x29f6('0x4e')];_0x56c442++){var _0x293f9d=_0x2bd7d9[_0x29f6('0x68')][_0x56c442];var _0x56342e='i';var _0x32291b=_['find'](_0x1bde93,['name',_0x293f9d[_0x29f6('0x54')]]);if(!_0x32291b){switch(_0x293f9d[_0x29f6('0x54')]){case'unreadMessages':if(_0x293f9d[_0x29f6('0x69')]==0x1){_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d['field']+_0x29f6('0x6b'));}else{_0x5ab84e[_0x29f6('0x6a')]('`'+_0x293f9d[_0x29f6('0x54')]+_0x29f6('0x6c'));}break;case _0x29f6('0x6d'):if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){if(_0x293f9d['value'][_0x29f6('0x36')]('\x20')['length']>0x1){_0x2d4c8d[_0x2f757b](_0x29f6('0x70'),qs['getFullTextValue'](_0x293f9d['value']),null);}else{var _0x1a3357='%'+_0x293f9d[_0x29f6('0x69')]+'%';_0x2d4c8d[_0x2f757b](_0x29f6('0x71'),_0x1a3357,_0x1a3357,_0x1a3357);}}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x72')]);_0x293f9d[_0x29f6('0x54')]='ContactId';_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b[_0x29f6('0x46')],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x76'):var _0x56f3cb=_0x293f9d[_0x29f6('0x69')][_0x29f6('0x36')](',')[_0x29f6('0x32')](function(_0x456578){return Number(_0x456578);});_0x56f3cb[_0x29f6('0x37')](function(_0x122a1a){_0x5078d1['or'](_0x29f6('0x77'),'%,'+_0x122a1a+',%');});_0x434e04=_[_0x29f6('0x78')](_0x434e04,_0x56f3cb);break;case'User':if(_0x293f9d[_0x29f6('0x6e')]===_0x29f6('0x6f')){_0x2d4c8d[_0x2f757b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x293f9d[_0x29f6('0x69')]+'%',null);}else{_0x32291b=_['find'](_0x1bde93,[_0x29f6('0x2a'),_0x29f6('0x3f')]);_0x293f9d['field']=_0x29f6('0x3f');_0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e['text'],_0x411f3e['value'][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}break;case _0x29f6('0x2e'):_0x411f3e=as[_0x29f6('0x73')]('me',null,_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')]['start'],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);break;}}else{var _0x411f3e=as[_0x29f6('0x73')](_0x56342e,_0x32291b['type'],_0x293f9d);_0x2d4c8d[_0x2f757b](_0x411f3e[_0x29f6('0x74')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x75')],_0x411f3e[_0x29f6('0x69')][_0x29f6('0x1f')]);}}}else{var _0x478ed0=_(_0x19fd60[_0x29f6('0x48')])[_0x29f6('0x49')]()[_0x29f6('0x32')](function(_0x1f401c){return _[_0x29f6('0x79')](_0x1bde93,[_0x29f6('0x2a'),_0x1f401c])?_0x1f401c:undefined;})['compact']()[_0x29f6('0x69')]();if(!_['isEmpty'](_0x478ed0)){_0x478ed0['forEach'](function(_0x4f9907){if(_0x4f9907===_0x29f6('0x7a')){_0x5ab84e['where'](_0x29f6('0x7b'),[][_0x29f6('0x7c')](_0x19fd60[_0x29f6('0x48')][_0x4f9907]));}else if(_0x4f9907===_0x29f6('0x7d')){var _0x8a5e58=JSON[_0x29f6('0x7e')](_0x19fd60[_0x29f6('0x48')][_0x4f9907])['$gte'];var _0x3a23f3=JSON['parse'](_0x19fd60[_0x29f6('0x48')][_0x4f9907])[_0x29f6('0x7f')];_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x80'),_0x8a5e58,_0x3a23f3);}else{if(_0x19fd60[_0x29f6('0x48')][_0x4f9907]===_0x29f6('0x81')){_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x82'));}else{_0x5ab84e[_0x29f6('0x51')]('i.'+_0x4f9907+_0x29f6('0x83'),_0x19fd60[_0x29f6('0x48')][_0x4f9907]);}}});}if(_0x19fd60[_0x29f6('0x48')]['read']){if(_0x19fd60['query']['read']==0x1){_0x5ab84e[_0x29f6('0x6a')](_0x29f6('0x84'));}else{_0x5ab84e['having'](_0x29f6('0x85'));}}if(_0x19fd60['query'][_0x29f6('0x86')]){_0x434e04=_[_0x29f6('0x87')](_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')])?_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]:new Array(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x86')]);_0x434e04[_0x29f6('0x37')](function(_0xa2ab9e){_0x5078d1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa2ab9e+',%');});}if(_0x19fd60[_0x29f6('0x48')]['filter']){var _0x16bb3c=_0x19fd60[_0x29f6('0x48')][_0x29f6('0x88')][_0x29f6('0x89')]('\x5c','\x5c\x5c')[_0x29f6('0x89')](/'/g,'\x27\x27');if(qs[_0x29f6('0x8a')](_0x16bb3c)){_0x2d4c8d['or'](_0x29f6('0x8b'),_0x16bb3c+'%');}else{_0x2d4c8d['or'](_0x29f6('0x8c'),qs['getFullTextValue'](_0x16bb3c))['or'](_0x29f6('0x8d'),_0x16bb3c+'%');}}}_0x5ab84e[_0x29f6('0x51')](_0x2d4c8d);_0x5ab84e['group']('i.id');var _0x216f51={'type':db[_0x29f6('0x8e')][_0x29f6('0x8f')][_0x29f6('0x90')],'raw':!![]};var _0x467dd2=_0x5ab84e[_0x29f6('0x91')]();_0x467dd2[_0x29f6('0x54')](_0x29f6('0x92'));_0x467dd2[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));if(_0x29b3f6[_0x29f6('0x50')]){_0x29b3f6['order']['forEach'](function(_0x2e2f16){var _0x180658=_0x2e2f16[0x0]==='contactName'?_0x2e2f16[0x0]:'i.'+_0x2e2f16[0x0];_0x5ab84e[_0x29f6('0x50')](_0x180658,_0x2e2f16[0x1]===_0x29f6('0x95')?![]:!![]);});}if(!_[_0x29f6('0x96')](_0x434e04)){_0x5ab84e[_0x29f6('0x6a')](_0x5078d1);_0x467dd2[_0x29f6('0x51')](_0x29f6('0x97'),_0x434e04);}BPromise[_0x29f6('0x98')]()['then'](function(){if(!_0x2bd7d9){if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return;_0x467dd2[_0x29f6('0x51')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x99'));return;}if(_0x19fd60['user'][_0x29f6('0x9a')]!==_0x29f6('0x9b'))return;return _0x19fd60['user'][_0x29f6('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x405124){if(_[_0x29f6('0x96')](_0x405124)){_0x467dd2[_0x29f6('0x51')](_0x29f6('0x9d'));_0x5ab84e[_0x29f6('0x51')](_0x29f6('0x9d'));}else{_0x467dd2['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));_0x5ab84e[_0x29f6('0x51')]('i.ChatWebsiteId\x20IN\x20?',_[_0x29f6('0x32')](_0x405124,'id'));}});})['then'](function(){if(_0x19fd60[_0x29f6('0x9e')][_0x29f6('0x9a')]===_0x29f6('0x9b')&&!_0x2bd7d9&&!_0x19fd60[_0x29f6('0x48')][_0x29f6('0x7a')])return[];return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x467dd2['toString'](),_0x216f51);})[_0x29f6('0x14')](function(_0x365b6d){_0x352119[_0x29f6('0x24')]=_0x365b6d['length'];if(_0x352119['count']===0x0)return[];return db['sequelize']['query'](_0xaa915c[_0x29f6('0xa0')](),_0x216f51)['then'](function(_0x537a8d){_0x199060=_['keyBy'](_0x537a8d,'id');_0x216f51=_[_0x29f6('0x2d')](_0x216f51,{'model':db[_0x29f6('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19fd60[_0x29f6('0x48')][_0x29f6('0x4d')]){_0x29b3f6[_0x29f6('0x4c')]['forEach'](function(_0x28cf80){_0x5ab84e['field']('i.'+_0x28cf80);});}else{_0x5ab84e[_0x29f6('0x54')](_0x29f6('0x93'),_0x29f6('0x94'));_0x5ab84e[_0x29f6('0x54')]('a.key','Account.key');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa2'),_0x29f6('0xa3'));_0x5ab84e['field'](_0x29f6('0xa4'),_0x29f6('0xa5'));_0x5ab84e['field'](_0x29f6('0xa6'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa7'),_0x29f6('0xa8'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xa9'),_0x29f6('0xaa'));_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xab'),_0x29f6('0xac'));_0x5ab84e['field'](_0x29f6('0xad'),'Contact.phone');_0x5ab84e['field']('c.mobile',_0x29f6('0xae'));_0x5ab84e[_0x29f6('0x54')]('c.fax','Contact.fax');_0x5ab84e[_0x29f6('0x54')](_0x29f6('0xaf'),'Owner.fullname');_0x5ab84e['field']('o.internal','Owner.internal');_0x5ab84e[_0x29f6('0x54')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x29f6('0x35'));}if(_0x29b3f6[_0x29f6('0x23')])_0x5ab84e['limit'](_0x29b3f6[_0x29f6('0x23')]);if(_0x29b3f6[_0x29f6('0x21')])_0x5ab84e['offset'](_0x29b3f6[_0x29f6('0x21')]);return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x5ab84e[_0x29f6('0xa0')](),_0x216f51);})[_0x29f6('0x14')](function(_0x399328){if(_0x399328[_0x29f6('0x4e')]>0x0)_0x3bca11[_0x29f6('0x51')](_0x29f6('0xb0'),_[_0x29f6('0x32')](_0x399328,'id'));return db[_0x29f6('0x9f')][_0x29f6('0x48')](_0x3bca11[_0x29f6('0xa0')](),_0x216f51)[_0x29f6('0x14')](function(_0x5076ed){var _0x24757e=_[_0x29f6('0xb1')](_0x5076ed,_0x29f6('0xb2'));var _0x264617=[];_0x399328[_0x29f6('0x37')](function(_0x3569f7){_0x264617[_0x29f6('0x38')](updateChatInteraction(_0x3569f7,_0x199060,_0x24757e));});return BPromise['all'](_0x264617);});});})[_0x29f6('0x14')](function(_0x4ec09d){_0x352119[_0x29f6('0xb3')]=_0x4ec09d;return _0x352119;})[_0x29f6('0x14')](respondWithFilteredResult(_0x270842,_0x29b3f6))[_0x29f6('0x39')](handleError(_0x270842,null));};exports[_0x29f6('0xb4')]=function(_0x43c44d,_0x63517e){var _0x2dc960={'raw':![],'where':{'id':_0x43c44d[_0x29f6('0xb5')]['id']}},_0x312a6f={};_0x312a6f['model']=_[_0x29f6('0x49')](db[_0x29f6('0xa1')]['rawAttributes']);_0x312a6f['query']=_[_0x29f6('0x49')](_0x43c44d[_0x29f6('0x48')]);_0x312a6f[_0x29f6('0x4a')]=_[_0x29f6('0x4b')](_0x312a6f['model'],_0x312a6f[_0x29f6('0x48')]);_0x2dc960[_0x29f6('0x4c')]=_['intersection'](_0x312a6f[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x43c44d[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x2dc960[_0x29f6('0x4c')]=_0x2dc960[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2dc960[_0x29f6('0x4c')]:_0x312a6f[_0x29f6('0x47')];if(_0x43c44d[_0x29f6('0x48')][_0x29f6('0xb6')]){_0x2dc960[_0x29f6('0xb7')]=[{'all':!![]}];}_0x2dc960=_[_0x29f6('0x2d')]({},_0x2dc960,_0x43c44d['options']);return db[_0x29f6('0xa1')][_0x29f6('0xb8')](_0x2dc960)[_0x29f6('0x14')](handleEntityNotFound(_0x63517e,null))[_0x29f6('0x14')](respondWithResult(_0x63517e,null))['catch'](handleError(_0x63517e,null));};exports[_0x29f6('0xb9')]=function(_0x2ffad1,_0x37ea1b){return db['ChatInteraction'][_0x29f6('0xb9')](_0x2ffad1[_0x29f6('0x2e')],{})['then'](respondWithResult(_0x37ea1b,0xc9))[_0x29f6('0x39')](handleError(_0x37ea1b,null));};exports[_0x29f6('0x28')]=function(_0x26f030,_0x247bce){if(_0x26f030[_0x29f6('0x2e')]['id']){delete _0x26f030[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x26f030[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x247bce,null))[_0x29f6('0x14')](saveUpdates(_0x26f030['body'],null))['then'](respondWithResult(_0x247bce,null))[_0x29f6('0x39')](handleError(_0x247bce,null));};exports[_0x29f6('0xba')]=function(_0x1621b7,_0x1f0e72){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x1621b7[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1f0e72,null))['then'](removeEntity(_0x1f0e72,null))['catch'](handleError(_0x1f0e72,null));};exports['describe']=function(_0x1fd477,_0x45dfd1){return db[_0x29f6('0xa1')][_0x29f6('0xbb')]()['then'](respondWithResult(_0x45dfd1,null))[_0x29f6('0x39')](handleError(_0x45dfd1,null));};exports[_0x29f6('0xbc')]=function(_0x4f2471,_0x1ef540){var _0x5a51c0=_0x4f2471[_0x29f6('0xb5')]['id'];var _0x2a2e0e;var _0xaccfb7;var _0x19c10d;return db['ChatInteraction'][_0x29f6('0xbd')]({'where':{'id':_0x5a51c0}})['then'](function(_0x47785a){_0x2a2e0e=_0x47785a;return db[_0x29f6('0xbe')][_0x29f6('0xbd')]({'where':{'id':_0x47785a[_0x29f6('0x7a')]},'attributes':['id',_0x29f6('0xbf'),_0x29f6('0xc0'),'vidaooTopic','vidaooNote',_0x29f6('0xc1')],'raw':!![]});})['then'](function(_0x5db958){if(_0x5db958&&_0x5db958[_0x29f6('0xbf')]&&_0x5db958['vidaooEscalation']){_0xaccfb7=_0x5db958;var _0x67c30a={'interaction':{'id':_0x5a51c0},'agent':{'id':_0x4f2471[_0x29f6('0x9e')]['id'],'name':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x2a')],'fullname':_0x4f2471[_0x29f6('0x9e')][_0x29f6('0x33')],'email':_0x4f2471['user'][_0x29f6('0xc2')]},'contact':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x2f')],'account':_0x4f2471[_0x29f6('0x2e')][_0x29f6('0x30')]};var _0x1cec09={'rejectUnauthorized':![],'method':_0x29f6('0xc3'),'url':_0x29f6('0xc4'),'headers':{'X-APIKEY':_0x5db958[_0x29f6('0xbf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4f2471[_0x29f6('0x9e')][_0x29f6('0xc2')]],'buttons':null,'topic':_0xaccfb7['vidaooTopic'],'note':_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc6')])?null:getMustacheRender(_0xaccfb7['vidaooNote'],_0x67c30a),'metadata':null},'redirect':_0x29f6('0xc7'),'json':!![]};try{if(!_[_0x29f6('0xc5')](_0xaccfb7[_0x29f6('0xc1')])){var _0x50d48d=getMustacheRender(_0xaccfb7['vidaooMetadata'],_0x67c30a);var _0x1413a5=JSON[_0x29f6('0x7e')](_0x50d48d);_0x1cec09[_0x29f6('0x2e')][_0x29f6('0xc8')]=_0x1413a5;}}catch(_0x2b6357){throw new db[(_0x29f6('0x8e'))]['ValidationError'](_0x29f6('0xc9'));}return rp(_0x1cec09);}else{throw new db[(_0x29f6('0x8e'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x231f26){_0x19c10d=_0x231f26;if(_0x19c10d['id']){var _0x578d49={'body':_0x19c10d[_0x29f6('0xca')],'ChatWebsiteId':_0xaccfb7['id'],'ChatInteractionId':_0x2a2e0e['id'],'direction':'out','UserId':_0x4f2471[_0x29f6('0x9e')]['id']};return db[_0x29f6('0xcb')][_0x29f6('0xb9')](_0x578d49,{});}else{throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x29f6('0x14')](function(){return _0x2a2e0e['updateAttributes']({'vidaooSessionId':_0x19c10d['id']});})[_0x29f6('0x14')](respondWithResult(_0x1ef540,null))[_0x29f6('0x39')](handleError(_0x1ef540,null));};exports[_0x29f6('0xcd')]=function(_0x19d1cb,_0x478660){if(_0x19d1cb[_0x29f6('0x2e')]['id']){delete _0x19d1cb[_0x29f6('0x2e')]['id'];}return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x19d1cb[_0x29f6('0xb5')]['id']},'include':[{'model':db['CmContact'],'as':_0x29f6('0x6d')}]})[_0x29f6('0x14')](handleEntityNotFound(_0x478660,null))['then'](saveUpdates(_0x19d1cb[_0x29f6('0x2e')],null))['then'](respondWithResult(_0x478660,null))[_0x29f6('0x39')](handleError(_0x478660,null));};exports[_0x29f6('0xce')]=function(_0x52c66d,_0x955f7){if(_0x52c66d[_0x29f6('0x2e')]['id']){delete _0x52c66d['body']['id'];}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x52c66d[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](function(_0x352a07){if(!_0x352a07){logger[_0x29f6('0x1b')](_0x29f6('0xcf'),_0x29f6('0xce'),0x194,'entity\x20not\x20found');_0x955f7[_0x29f6('0x1e')](0x194);}else{if(_0x352a07[_0x29f6('0x3f')]){throw new db[(_0x29f6('0x8e'))][(_0x29f6('0xcc'))]('Interaction\x20already\x20assigned');}}return _0x352a07;})[_0x29f6('0x14')](function(_0x10648e){if(_0x10648e){return _0x10648e[_0x29f6('0x28')]({'closed':_0x52c66d[_0x29f6('0x2e')][_0x29f6('0x40')],'disposition':_0x52c66d['body']['disposition']})[_0x29f6('0x14')](function(_0x1b3b27){return _0x1b3b27;});}})['then'](function(){return respondWithRpcPromise(_0x29f6('0xd0'),'abandon',_0x52c66d['body'],client9004);})[_0x29f6('0x14')](respondWithResult(_0x955f7,null))['catch'](handleError(_0x955f7,null));};exports[_0x29f6('0xd1')]=function(_0x24a7fb,_0x454c4c){_0x24a7fb[_0x29f6('0x2e')]['name']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd3')];_0x24a7fb[_0x29f6('0x2e')][_0x29f6('0xd4')]=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd5')];_0x24a7fb['body']['type']=_0x24a7fb[_0x29f6('0xd2')][_0x29f6('0xd6')];return db[_0x29f6('0xd7')][_0x29f6('0xb9')](_0x24a7fb[_0x29f6('0x2e')])[_0x29f6('0x14')](respondWithResult(_0x454c4c,0xc9))[_0x29f6('0x39')](handleError(_0x454c4c,null));};exports[_0x29f6('0xd8')]=function(_0x3d131a,_0x2bc181){return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d131a[_0x29f6('0xb5')]['id']},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null))[_0x29f6('0x14')](function(_0x583f5f){if(_0x583f5f){if(_0x583f5f[_0x29f6('0x40')]){return _0x2bc181[_0x29f6('0x25')](0x193)[_0x29f6('0x20')]({'status':0x193,'message':_0x29f6('0xd9')});}return db[_0x29f6('0xd7')]['findOne']({'where':{'id':_0x3d131a[_0x29f6('0x48')][_0x29f6('0xda')]},'raw':!![]})[_0x29f6('0x14')](handleEntityNotFound(_0x2bc181,null));}})['then'](function(_0x2378b8){if(_0x2378b8){var _0x2a5414=_0x2378b8[_0x29f6('0xdb')]!==null;var _0x189048=path['join'](config[_0x29f6('0xdc')],'server/files/attachments/');if(_0x2a5414){_0x189048=path[_0x29f6('0xdd')](_0x189048,'offline-chat/');}var _0x2aa18b=path[_0x29f6('0xdd')](_0x189048,_0x2378b8[_0x29f6('0xd4')]);return _0x2bc181[_0x29f6('0xde')](_0x2aa18b);}})['catch'](handleError(_0x2bc181,null));};exports[_0x29f6('0xdf')]=function(_0x2216ef,_0x4577ee){var _0x2ef994=null;var _0x28e4c5=null;var _0x168724=null;if(_0x2216ef[_0x29f6('0x2e')]['id']){delete _0x2216ef[_0x29f6('0x2e')]['id'];}if(_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')]){_0x168724=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server/files/chat/upload/',util[_0x29f6('0xe1')](_0x29f6('0xe2'),Date[_0x29f6('0xe3')]()));_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe4')]=_0x168724;}return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x2216ef[_0x29f6('0xb5')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x29f6('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x29f6('0x14')](handleEntityNotFound(_0x4577ee,null))['then'](saveUpdates(_0x2216ef[_0x29f6('0x2e')],null))[_0x29f6('0x14')](function(_0x4a3381){if(_0x4a3381){_0x2ef994=_0x4a3381;return db[_0x29f6('0xbe')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994[_0x29f6('0x7a')]}});}})[_0x29f6('0x14')](function(_0xdb766a){if(_0xdb766a){_0x28e4c5=_0xdb766a;return db[_0x29f6('0xe6')][_0x29f6('0xb8')]({'where':{'id':_0x2ef994['ContactId']}});}})[_0x29f6('0x14')](function(_0x37735f){if(_0x37735f){if(_0x168724){var _0x399aed=null;for(var _0xe432b0=0x1;_0xe432b0<_0x2ef994[_0x29f6('0xe5')][_0x29f6('0x4e')];++_0xe432b0){_0x399aed=_0x2ef994['Messages'][_0xe432b0];var _0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):_0x29f6('0xe9');var _0x46a5da=_0x2216ef['body'][_0x29f6('0xea')]||util['format']('%s%d',_0x29f6('0xeb'),_0x399aed[_0x29f6('0x72')]);switch(_0x28e4c5[_0x29f6('0xec')]){case _0x29f6('0xed'):_0x21bc96=_0x399aed['UserId']?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed[_0x29f6('0x3f')]):_0x29f6('0xe9');break;case _0x29f6('0xee'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed[_0x29f6('0xef')][_0x29f6('0xf0')]||_0x399aed[_0x29f6('0xef')][_0x29f6('0x33')]:_0x29f6('0xe9');break;case _0x29f6('0xf1'):_0x21bc96=_0x399aed[_0x29f6('0x3f')]?_0x399aed['User']['fullname']:_0x29f6('0xe9');break;default:_0x21bc96=_0x399aed[_0x29f6('0x3f')]?util['format'](_0x29f6('0xe7'),_0x28e4c5[_0x29f6('0xe8')],_0x399aed['UserId']):'System';}var _0x593d86=util[_0x29f6('0xe1')](_0x29f6('0xf2'),moment(_0x399aed[_0x29f6('0x7d')])[_0x29f6('0xe1')]('MM/DD/YYYY\x20HH:mm:ss'),_0x399aed[_0x29f6('0xf3')]==='in'?_0x46a5da:_0x21bc96,_0x399aed[_0x29f6('0x2e')]);if(!_0x399aed[_0x29f6('0xf4')]){fs[_0x29f6('0xf5')](_0x168724,_0x593d86);}}return db[_0x29f6('0xf6')][_0x29f6('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x29f6('0xf7')],'as':_0x29f6('0xf8'),'raw':!![],'include':[{'model':db[_0x29f6('0xf9')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x29f6('0x14')](function(_0x294136){if(!_0x294136||!_0x294136[_0x29f6('0xf8')]||!_0x2216ef[_0x29f6('0x2e')])return _0x2ef994;var _0x59fb2a=_0x294136['getSmtpOptions']();return respondWithRpcPromise(_0x29f6('0xfa'),_0x29f6('0xfb'),{'account':_0x59fb2a,'message':{'from':util[_0x29f6('0xe1')](_0x29f6('0xfc'),_0x294136[_0x29f6('0x2a')],_0x294136['email']||_0x294136[_0x29f6('0xf8')][_0x29f6('0x9e')]),'to':_0x2216ef[_0x29f6('0x2e')][_0x29f6('0xe0')],'subject':_0x29f6('0xfd'),'text':util[_0x29f6('0xe1')](_0x29f6('0xfe'),_0x2216ef['body'][_0x29f6('0xe0')]),'attachments':[{'path':_0x168724}]}})[_0x29f6('0x14')](function(){return _0x2ef994;})[_0x29f6('0x39')](function(_0x3d027f){logger['error'](_0x3d027f);});})[_0x29f6('0x14')](respondWithStatusCode(_0x4577ee,0xc8))[_0x29f6('0x39')](handleError(_0x4577ee,null));};exports[_0x29f6('0xff')]=function(_0x2df557,_0x589222){return db[_0x29f6('0xcb')][_0x29f6('0xb8')]({'where':{'id':_0x2df557[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x589222,null))[_0x29f6('0x14')](function(_0x318fd1){if(_0x318fd1){return _0x318fd1[_0x29f6('0xff')](_0x2df557[_0x29f6('0x2e')]['ids'],_[_0x29f6('0x100')](_0x2df557[_0x29f6('0x2e')],['ids','id'])||{});}})['then'](respondWithResult(_0x589222,null))['catch'](handleError(_0x589222,null));};exports[_0x29f6('0x101')]=function(_0x29017d,_0x5863a2){var _0x2f7729={'raw':![],'where':{}};var _0x171342={};var _0x1dafb9={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x29017d['params']['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x5863a2,null))[_0x29f6('0x14')](function(_0x1207f7){if(_0x1207f7){_0x171342[_0x29f6('0x47')]=_[_0x29f6('0x49')](db[_0x29f6('0xcb')][_0x29f6('0x44')]);_0x171342[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x29017d[_0x29f6('0x48')]);_0x171342['filters']=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],_0x171342['query']);_0x2f7729[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x171342[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x29017d[_0x29f6('0x48')]['fields']));_0x2f7729[_0x29f6('0x4c')]=_0x2f7729[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x2f7729['attributes']:_0x171342['model'];if(!_0x29017d[_0x29f6('0x48')][_0x29f6('0x4f')](_0x29f6('0x102'))){_0x2f7729[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x29017d[_0x29f6('0x48')]['limit']);_0x2f7729['offset']=qs[_0x29f6('0x21')](_0x29017d[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x2f7729[_0x29f6('0x50')]=qs[_0x29f6('0x103')](_0x29017d[_0x29f6('0x48')]['sort']);_0x2f7729['where']=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x29017d[_0x29f6('0x48')],_0x171342['filters']));_0x2f7729['where']['ChatInteractionId']=_0x1207f7['id'];if(_0x29017d[_0x29f6('0x48')]['filter']){_0x2f7729[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x2f7729[_0x29f6('0x4c')],function(_0x25532f){var _0x31ebb3={};_0x31ebb3[_0x25532f]={'$like':'%'+_0x29017d[_0x29f6('0x48')][_0x29f6('0x88')]+'%'};return _0x31ebb3;})});}if(_0x29017d['query'][_0x29f6('0x104')]){var _0x173977=_0x29017d['query'][_0x29f6('0x104')][_0x29f6('0x36')](',');var _0x43acdc={};_0x43acdc[_0x173977[0x0]]={'$gte':moment(_0x173977[0x1])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f7729['where']=_[_0x29f6('0x2d')](_0x2f7729[_0x29f6('0x51')],_0x43acdc);}_0x2f7729=_[_0x29f6('0x2d')]({},_0x2f7729,_0x29017d[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x2f7729['where']})[_0x29f6('0x14')](function(_0x216ad8){_0x1dafb9['count']=_0x216ad8;if(_0x29017d['query']['includeAll']){_0x2f7729[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')][_0x29f6('0x106')](_0x2f7729);})[_0x29f6('0x14')](function(_0x2b1808){_0x1dafb9['rows']=_0x2b1808;return _0x1dafb9;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x5863a2,_0x2f7729))[_0x29f6('0x39')](handleError(_0x5863a2,null));};exports[_0x29f6('0x107')]=function(_0x3d68f3,_0x1cb0c0){var _0x47e4e5={'where':{}},_0x3a19d2={},_0x3450c3={'count':0x0,'rows':[]};return db[_0x29f6('0xa1')][_0x29f6('0xbd')]({'where':{'id':_0x3d68f3[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x1cb0c0,null))[_0x29f6('0x14')](function(_0x6a318b){if(_0x6a318b){_0x3a19d2['model']=_[_0x29f6('0x49')](db[_0x29f6('0xcb')]['rawAttributes']);_0x3a19d2[_0x29f6('0x48')]=_[_0x29f6('0x49')](_0x3d68f3[_0x29f6('0x48')]);_0x3a19d2['filters']=_['intersection'](_0x3a19d2['model'],_0x3a19d2['query']);_0x47e4e5[_0x29f6('0x4c')]=_[_0x29f6('0x4b')](_0x3a19d2[_0x29f6('0x47')],qs[_0x29f6('0x4d')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x4d')]));_0x47e4e5[_0x29f6('0x4c')]=_0x47e4e5[_0x29f6('0x4c')][_0x29f6('0x4e')]?_0x47e4e5[_0x29f6('0x4c')]:_0x3a19d2['model'];if(!_0x3d68f3[_0x29f6('0x48')]['hasOwnProperty'](_0x29f6('0x102'))){_0x47e4e5[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x23')]);_0x47e4e5[_0x29f6('0x21')]=qs[_0x29f6('0x21')](_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x21')]);}_0x47e4e5['order']=qs['sort'](_0x3d68f3[_0x29f6('0x48')]['sort']);_0x47e4e5[_0x29f6('0x51')]=qs[_0x29f6('0x4a')](_[_0x29f6('0x52')](_0x3d68f3[_0x29f6('0x48')],_0x3a19d2[_0x29f6('0x4a')]));_0x47e4e5['where'][_0x29f6('0xb2')]=_0x6a318b['id'];if(_0x3d68f3[_0x29f6('0x48')][_0x29f6('0x88')]){_0x47e4e5[_0x29f6('0x51')]=_[_0x29f6('0x2d')](_0x47e4e5[_0x29f6('0x51')],{'$or':_[_0x29f6('0x32')](_0x47e4e5[_0x29f6('0x4c')],function(_0x346ece){var _0xc22605={};_0xc22605[_0x346ece]={'$like':'%'+_0x3d68f3[_0x29f6('0x48')]['filter']+'%'};return _0xc22605;})});}_0x47e4e5[_0x29f6('0x51')]['secret']=![];if(_0x3d68f3[_0x29f6('0x48')]['id']){_0x47e4e5[_0x29f6('0x51')]['id']={'$gt':_0x3d68f3['query']['id']};}_0x47e4e5=_['merge']({},_0x47e4e5,_0x3d68f3[_0x29f6('0x105')]);return db[_0x29f6('0xcb')]['count']({'where':_0x47e4e5[_0x29f6('0x51')]})[_0x29f6('0x14')](function(_0x15db8c){_0x3450c3[_0x29f6('0x24')]=_0x15db8c;_0x47e4e5[_0x29f6('0xb7')]=[];if(_0x3d68f3['query']['includeAgent']){_0x47e4e5[_0x29f6('0xb7')]['push']({'model':db[_0x29f6('0xef')],'as':_0x29f6('0xef'),'attributes':['id','fullname',_0x29f6('0xf0')]});}if(_0x3d68f3[_0x29f6('0x48')]['includeAll']){_0x47e4e5[_0x29f6('0xb7')]=[{'all':!![]}];}return db[_0x29f6('0xcb')]['findAll'](_0x47e4e5);})['then'](function(_0x37c860){_0x3450c3[_0x29f6('0xb3')]=_0x37c860;return _0x3450c3;});}})[_0x29f6('0x14')](respondWithFilteredResult(_0x1cb0c0,_0x47e4e5))[_0x29f6('0x39')](handleError(_0x1cb0c0,null));};exports[_0x29f6('0x108')]=function(_0x371548,_0x7a0ebf){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x371548[_0x29f6('0xb5')]['id']}})[_0x29f6('0x14')](handleEntityNotFound(_0x7a0ebf,null))[_0x29f6('0x14')](function(_0x1e05e2){if(_0x1e05e2){return _0x1e05e2[_0x29f6('0x109')](_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')],_[_0x29f6('0x100')](_0x371548[_0x29f6('0x2e')],[_0x29f6('0x10a'),'id'])||{})[_0x29f6('0x10b')](function(){return db[_0x29f6('0x76')]['findAll']({'attributes':['id',_0x29f6('0x2a'),_0x29f6('0x10c')],'where':{'id':_0x371548[_0x29f6('0x2e')][_0x29f6('0x10a')]}});})['then'](function(_0x5248ba){socket[_0x29f6('0x10d')](_0x29f6('0x10e'),{'id':Number(_0x371548[_0x29f6('0xb5')]['id']),'tags':_0x5248ba||[]});return{'id':Number(_0x371548['params']['id']),'tags':_0x5248ba||[]};});}})[_0x29f6('0x14')](respondWithResult(_0x7a0ebf,null))[_0x29f6('0x39')](handleError(_0x7a0ebf,null));};exports[_0x29f6('0x10f')]=function(_0x47028e,_0x410ab5){return db[_0x29f6('0xa1')][_0x29f6('0xb8')]({'where':{'id':_0x47028e[_0x29f6('0xb5')]['id']}})['then'](handleEntityNotFound(_0x410ab5,null))[_0x29f6('0x14')](function(_0x281c49){if(_0x281c49){return _0x281c49[_0x29f6('0x10f')](_0x47028e[_0x29f6('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x410ab5,null))[_0x29f6('0x39')](handleError(_0x410ab5,null));};exports['download']=function(_0x5250bc,_0x31ba94){var _0x31dcfe=moment()[_0x29f6('0x110')]()[_0x29f6('0xa0')]();var _0x5cf3d4=path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],_0x29f6('0x111'),'files',_0x29f6('0x112'));var _0x5dcaf2=path['join'](config['root'],'server',_0x29f6('0x113'),_0x29f6('0x114'));var _0xcf75fe=path[_0x29f6('0xdd')](_0x5cf3d4,_0x31dcfe);var _0x48ecb0=util['format']('transcript-%d-%s.zip',_0x5250bc[_0x29f6('0xb5')]['id'],_0x31dcfe);var _0x5de30e=path[_0x29f6('0xdd')](_0x5cf3d4,_0x48ecb0);var _0x10989a=[];_0x10989a[_0x29f6('0x38')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10989a[_0x29f6('0x38')]({'model':db[_0x29f6('0xe6')],'as':_0x29f6('0x6d'),'attributes':['id',_0x29f6('0x115'),_0x29f6('0x116')],'raw':!![]});if(_0x5250bc['query'][_0x29f6('0x114')]){_0x10989a[_0x29f6('0x38')]({'model':db['Attachment'],'as':_0x29f6('0xd7'),'raw':!![]});}var _0x15c951=[{'model':db[_0x29f6('0xcb')],'as':'Messages','attributes':['id','body',_0x29f6('0x7d'),'direction',_0x29f6('0xf4'),_0x29f6('0x117')],'include':_0x10989a}];_0x15c951['push']({'model':db['ChatWebsite'],'as':_0x29f6('0x118'),'attributes':['id',_0x29f6('0x2a')]});_0x15c951[_0x29f6('0x38')]({'model':db['User'],'as':_0x29f6('0x119'),'attributes':['id',_0x29f6('0x33')]});return db[_0x29f6('0xa1')]['find']({'where':{'id':_0x5250bc[_0x29f6('0xb5')]['id']},'include':_0x15c951})['then'](handleEntityNotFound(_0x31ba94,null))[_0x29f6('0x14')](function(_0x4ad41d){if(_0x4ad41d){var _0x598bcd=_0x4ad41d['get']({'plain':!![]});fs['mkdirSync'](_0xcf75fe);var _0x53751c={'channel':_0x29f6('0x11a'),'account':_0x598bcd['Account'][_0x29f6('0x2a')],'agent':_0x598bcd[_0x29f6('0x119')]?_0x598bcd[_0x29f6('0x119')][_0x29f6('0x33')]:_0x29f6('0x11b'),'createdAt':moment(_0x598bcd['createdAt'])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'closedAt':_0x598bcd['closed']?moment(_0x598bcd[_0x29f6('0x11d')])[_0x29f6('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29f6('0xa0')]():'','disposition':_0x598bcd['disposition'],'chatInfo':{'browser':_0x598bcd[_0x29f6('0x11e')],'os':_0x598bcd[_0x29f6('0x11f')],'referer':_0x598bcd[_0x29f6('0x120')],'customerIp':_0x598bcd[_0x29f6('0x121')],'customerPort':_0x598bcd[_0x29f6('0x122')]?_0x598bcd[_0x29f6('0x122')]:_0x29f6('0x11b')},'messages':_(_0x598bcd[_0x29f6('0xe5')])[_0x29f6('0x123')]()[_0x29f6('0x88')]({'secret':![]})[_0x29f6('0x32')](function(_0x2fd414){if(_0x2fd414['Attachment']){var _0x49c5f6=path[_0x29f6('0xdd')](_0x5dcaf2,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]);if(fs[_0x29f6('0x124')](_0x49c5f6)){fs[_0x29f6('0x125')](_0x49c5f6)[_0x29f6('0x126')](fs[_0x29f6('0x127')](path[_0x29f6('0xdd')](_0xcf75fe,_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')])));}}return{'date':moment(_0x2fd414[_0x29f6('0x7d')])[_0x29f6('0xe1')](_0x29f6('0x11c'))[_0x29f6('0xa0')](),'sender':_0x2fd414[_0x29f6('0xf3')]===_0x29f6('0x128')?_0x2fd414[_0x29f6('0xef')]?_0x2fd414[_0x29f6('0xef')]['fullname']:_0x29f6('0xe9'):_0x2fd414[_0x29f6('0x6d')]['firstName']+(_0x2fd414['Contact'][_0x29f6('0x116')]?'\x20'+_0x2fd414[_0x29f6('0x6d')][_0x29f6('0x116')]:''),'body':_0x2fd414[_0x29f6('0xd7')]?_0x2fd414[_0x29f6('0xd7')][_0x29f6('0xd4')]:_0x2fd414[_0x29f6('0x2e')],'direction':_0x2fd414['direction']==='out'?'A':'C','secret':_0x2fd414['secret'],'read':_0x2fd414[_0x29f6('0x117')],'attachment':_0x2fd414[_0x29f6('0xd7')]};})[_0x29f6('0x69')]()};return ejs[_0x29f6('0x129')](path[_0x29f6('0xdd')](config[_0x29f6('0xdc')],'server','views',_0x29f6('0x12a')),{'interaction':_0x53751c})[_0x29f6('0x14')](function(_0x3307a1){var _0x595aff=path[_0x29f6('0xdd')](_0xcf75fe,'transcript-'+_0x598bcd['id']+'-'+_0x31dcfe+_0x29f6('0x12b'));var _0x3101aa={'path':_0x595aff,'channel':'Chat','interactionId':_0x598bcd['id']};return pdf['createPdfFromHTML'](_0x3307a1,_0x3101aa);})[_0x29f6('0x14')](function(){return new Promise(function(_0x4c7b46,_0x41d45f){zipdir(_0xcf75fe,{'saveTo':_0x5de30e},function(_0x1f1679,_0x2dfc83){if(_0x1f1679)return _0x41d45f(_0x1f1679);return _0x4c7b46(_0x2dfc83);});})[_0x29f6('0x14')](function(){return new BPromise(function(_0x53cde9,_0x26eef7){rimraf(_0xcf75fe,function(_0x17b595){if(_0x17b595)_0x26eef7(_0x17b595);return _0x53cde9();});});})['then'](function(){return _0x31ba94[_0x29f6('0xde')](_0x5de30e,_0x48ecb0,function(_0x22fcde){if(_0x22fcde){logger[_0x29f6('0x1b')](_0x29f6('0x12c'),_0x22fcde);}else{fs['unlinkSync'](_0x5de30e);}});});});}else{return _0x31ba94[_0x29f6('0x1e')](0xc8);}})[_0x29f6('0x39')](handleError(_0x31ba94,null));}; \ No newline at end of file +var _0xb43b=['i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','rawAttributes','includeAll','include','options','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','AbandonInteraction','file','basename','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','format','transcript-%s.txt','now','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','nolimit','$gte','findAll','getMyMessages','includeAgent','alias','spread','color','emit','chatInteractionTags:save','removeTags','server','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Account','Chat','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','referer','createReadStream','pipe','createWriteStream','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','lodash','squel','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','offset','undefined','limit','count','set','json','update','stack','name','status','render','merge','body','contact','agent','interaction','account','Users','map','fullname','split','forEach','push','TagIds','talking','answered','unmanaged','abandoned','closed','UserId','waiting','disposition','total','index','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\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?','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve'];(function(_0x583761,_0x119f81){var _0x4b72f0=function(_0x351cad){while(--_0x351cad){_0x583761['push'](_0x583761['shift']());}};_0x4b72f0(++_0x119f81);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5145bd,_0x2739d2){_0x5145bd=_0x5145bd-0x0;var _0x109bd1=_0xb43b[_0x5145bd];return _0x109bd1;};'use strict';var rimraf=require(_0xbb43('0x0'));var zipdir=require(_0xbb43('0x1'));var rp=require('request-promise');var moment=require(_0xbb43('0x2'));var BPromise=require(_0xbb43('0x3'));var Mustache=require(_0xbb43('0x4'));var util=require('util');var path=require(_0xbb43('0x5'));var ejs=require(_0xbb43('0x6'));var fs=require('fs');var _=require(_0xbb43('0x7'));var squel=require(_0xbb43('0x8'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0xbb43('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xbb43('0xa'))(_0xbb43('0xb'));var config=require(_0xbb43('0xc'));var db=require(_0xbb43('0xd'))['db'];config[_0xbb43('0xe')]=_['defaults'](config[_0xbb43('0xe')],{'host':_0xbb43('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb43('0xe')]));require(_0xbb43('0x10'))[_0xbb43('0x11')](socket);var jayson=require(_0xbb43('0x12'));var client=jayson[_0xbb43('0x13')][_0xbb43('0x14')]({'port':0x232b});var client9004=jayson['client'][_0xbb43('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x2a5a4d,_0x50e2c0,_0x578392,_0x41e7e5){return new BPromise(function(_0x4a3714,_0x593d0b){var _0x438591=_0x41e7e5||client;return _0x438591['request'](_0x2a5a4d,_0x578392)[_0xbb43('0x15')](function(_0x43021d){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x50e2c0,'request\x20sent');logger[_0xbb43('0x16')](_0xbb43('0x17'),_0x50e2c0,'request\x20sent',JSON['stringify'](_0x43021d));if(_0x43021d[_0xbb43('0x18')]){if(_0x43021d['error']['code']===0x1f4){logger[_0xbb43('0x18')](_0xbb43('0x19'),_0x50e2c0,_0x43021d[_0xbb43('0x18')]['message']);return _0x593d0b(_0x43021d[_0xbb43('0x18')]['message']);}logger[_0xbb43('0x18')](_0xbb43('0x19'),_0x50e2c0,_0x43021d['error']['message']);return _0x4a3714(_0x43021d[_0xbb43('0x18')][_0xbb43('0x1a')]);}else{logger[_0xbb43('0x1b')](_0xbb43('0x19'),_0x50e2c0,'request\x20sent');_0x4a3714(_0x43021d[_0xbb43('0x1c')]['message']);}})[_0xbb43('0x1d')](function(_0x4bfaca){logger[_0xbb43('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x50e2c0,_0x4bfaca);_0x593d0b(_0x4bfaca);});});}function respondWithStatusCode(_0x3f323e,_0x451cbd){_0x451cbd=_0x451cbd||0xcc;return function(_0x577ddd){if(_0x577ddd){return _0x3f323e[_0xbb43('0x1e')](_0x451cbd);}return _0x3f323e['status'](_0x451cbd)[_0xbb43('0x1f')]();};}function respondWithResult(_0x298ce2,_0x16384e){_0x16384e=_0x16384e||0xc8;return function(_0x4d6d77){if(_0x4d6d77){return _0x298ce2['status'](_0x16384e)['json'](_0x4d6d77);}};}function respondWithFilteredResult(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(_0x5d8310){var _0x3b3083=typeof _0x32d7f0[_0xbb43('0x20')]===_0xbb43('0x21')&&typeof _0x32d7f0[_0xbb43('0x22')]==='undefined';var _0x4b5342=_0x5d8310[_0xbb43('0x23')];var _0x42800f=_0x3b3083?0x0:_0x32d7f0[_0xbb43('0x20')];var _0x8b3205=_0x3b3083?_0x5d8310[_0xbb43('0x23')]:_0x32d7f0[_0xbb43('0x20')]+_0x32d7f0[_0xbb43('0x22')];var _0x473828;if(_0x8b3205>=_0x4b5342){_0x8b3205=_0x4b5342;_0x473828=0xc8;}else{_0x473828=0xce;}_0x269ca5['status'](_0x473828);return _0x269ca5[_0xbb43('0x24')]('Content-Range',_0x42800f+'-'+_0x8b3205+'/'+_0x4b5342)[_0xbb43('0x25')](_0x5d8310);}return null;};}function saveUpdates(_0x436fd5){return function(_0x34f5b2){if(_0x34f5b2){return _0x34f5b2[_0xbb43('0x26')](_0x436fd5)['then'](function(_0x157d62){return _0x157d62;});}return null;};}function removeEntity(_0x547a6f){return function(_0x5566cf){if(_0x5566cf){return _0x5566cf['destroy']()[_0xbb43('0x15')](function(){_0x547a6f['status'](0xcc)[_0xbb43('0x1f')]();});}};}function handleEntityNotFound(_0x4511d9){return function(_0xc577ac){if(!_0xc577ac){_0x4511d9['sendStatus'](0x194);}return _0xc577ac;};}function handleError(_0x205011,_0x1bdf91){_0x1bdf91=_0x1bdf91||0x1f4;return function(_0x46650c){logger[_0xbb43('0x18')](_0x46650c[_0xbb43('0x27')]);if(_0x46650c[_0xbb43('0x28')]){delete _0x46650c[_0xbb43('0x28')];}_0x205011[_0xbb43('0x29')](_0x1bdf91)['send'](_0x46650c);};}function getMustacheRender(_0x2109aa,_0x3961f5){return Mustache[_0xbb43('0x2a')](_0x2109aa,_[_0xbb43('0x2b')](_0x3961f5[_0xbb43('0x2c')],{'contact':_0x3961f5[_0xbb43('0x2d')],'message':_0x3961f5[_0xbb43('0x1a')],'agent':_0x3961f5[_0xbb43('0x2e')],'interaction':_0x3961f5[_0xbb43('0x2f')],'account':_0x3961f5[_0xbb43('0x30')]}))||'';}function getInteractionUsers(_0x21346a,_0x18debb){return new BPromise(function(_0x2b87c7,_0x33f45c){try{if(_0x18debb[_0x21346a['id']]){_0x21346a[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x18debb[_0x21346a['id']],function(_0x549841){return{'id':_0x549841['id'],'fullname':_0x549841[_0xbb43('0x33')]};});}}catch(_0x2d2056){_0x33f45c(_0x2d2056);}_0x2b87c7(_0x21346a);});}function getInteractionTags(_0x52a694,_0x285014){return new BPromise(function(_0x2c9a7c,_0x11d384){try{if(_0x52a694['TagIds']){_0x52a694['Tags']=[];_0x52a694['TagIds'][_0xbb43('0x34')](',')[_0xbb43('0x35')](function(_0x4a95c3){_0x52a694['Tags'][_0xbb43('0x36')](_0x285014[_0x4a95c3]);});}delete _0x52a694[_0xbb43('0x37')];}catch(_0x29f6e5){_0x11d384(_0x29f6e5);}_0x2c9a7c(_0x52a694);});}function updateChatInteraction(_0x37afbb,_0x3f9e7f,_0x5edacc){return new BPromise(function(_0x249b6a,_0x526cb8){return getInteractionUsers(_0x37afbb,_0x5edacc)[_0xbb43('0x15')](function(_0x3340aa){return getInteractionTags(_0x3340aa,_0x3f9e7f);})[_0xbb43('0x15')](function(_0x531d96){return getStateInteraction(_0x531d96);})[_0xbb43('0x15')](function(_0x4f0f13){_0x249b6a(_0x4f0f13);})[_0xbb43('0x1d')](function(_0x93aa1c){_0x526cb8(_0x93aa1c);});});}function getStateInteraction(_0x56c808){return new BPromise(function(_0x4783fe){_0x56c808['waiting']=0x0;_0x56c808[_0xbb43('0x38')]=0x0;_0x56c808[_0xbb43('0x39')]=0x0;_0x56c808[_0xbb43('0x3a')]=0x0;_0x56c808[_0xbb43('0x3b')]=0x0;_0x56c808['total']=0x0;if(!_0x56c808[_0xbb43('0x3c')]&&!_0x56c808[_0xbb43('0x3d')]){_0x56c808['waiting']+=0x1;}if(!_0x56c808[_0xbb43('0x3c')]&&_0x56c808['UserId']){_0x56c808[_0xbb43('0x38')]+=0x1;if(_0x56c808[_0xbb43('0x3e')]){_0x56c808[_0xbb43('0x3e')]-=0x1;}}if(_0x56c808[_0xbb43('0x3c')]&&_0x56c808[_0xbb43('0x3f')]===_0xbb43('0x3b')){_0x56c808['abandoned']+=0x1;if(_0x56c808[_0xbb43('0x3e')]){_0x56c808['waiting']-=0x1;}}else if(_0x56c808[_0xbb43('0x3c')]&&!_0x56c808[_0xbb43('0x3d')]&&_0x56c808[_0xbb43('0x3f')]){_0x56c808[_0xbb43('0x3a')]+=0x1;if(_0x56c808['waiting']){_0x56c808[_0xbb43('0x3e')]-=0x1;}}else if(_0x56c808[_0xbb43('0x3c')]&&_0x56c808[_0xbb43('0x3d')]){_0x56c808[_0xbb43('0x39')]+=0x1;if(_0x56c808[_0xbb43('0x38')]){_0x56c808[_0xbb43('0x38')]-=0x1;}}_0x56c808[_0xbb43('0x40')]+=0x1;_0x4783fe(_0x56c808);});}exports[_0xbb43('0x41')]=function(_0x5a662b,_0x2eaece){var _0x8c57af={},_0x4898b2={},_0x1a66f0={'count':0x0,'rows':[]};var _0x5d4c19=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x1c3482){return{'name':_0x1c3482['fieldName'],'type':_0x1c3482[_0xbb43('0x42')]['key']};});_0x4898b2[_0xbb43('0x43')]=_[_0xbb43('0x32')](_0x5d4c19,_0xbb43('0x28'));_0x4898b2['query']=_[_0xbb43('0x44')](_0x5a662b['query']);_0x4898b2[_0xbb43('0x45')]=_[_0xbb43('0x46')](_0x4898b2[_0xbb43('0x43')],_0x4898b2[_0xbb43('0x47')]);_0x8c57af[_0xbb43('0x48')]=_[_0xbb43('0x46')](_0x4898b2[_0xbb43('0x43')],qs['fields'](_0x5a662b[_0xbb43('0x47')][_0xbb43('0x49')]));_0x8c57af[_0xbb43('0x48')]=_0x8c57af[_0xbb43('0x48')]['length']?_0x8c57af[_0xbb43('0x48')]:_0x4898b2[_0xbb43('0x43')];if(!_0x5a662b[_0xbb43('0x47')][_0xbb43('0x4a')]('nolimit')){_0x8c57af[_0xbb43('0x22')]=qs[_0xbb43('0x22')](_0x5a662b[_0xbb43('0x47')]['limit']);_0x8c57af[_0xbb43('0x20')]=qs[_0xbb43('0x20')](_0x5a662b[_0xbb43('0x47')][_0xbb43('0x20')]);}_0x8c57af[_0xbb43('0x4b')]=qs['sort'](_0x5a662b['query'][_0xbb43('0x4c')]);_0x8c57af['where']=qs[_0xbb43('0x45')](_[_0xbb43('0x4d')](_0x5a662b['query'],_0x4898b2[_0xbb43('0x45')]),_0x5d4c19);var _0x3719dc=[];var _0x39dc59=squel[_0xbb43('0x4e')]()[_0xbb43('0x4f')]('id')['field'](_0xbb43('0x28'))['field']('color')[_0xbb43('0x50')](_0xbb43('0x51'));var _0x182c9b=squel[_0xbb43('0x4e')]()[_0xbb43('0x4f')]('u.id')['field'](_0xbb43('0x52'))[_0xbb43('0x4f')](_0xbb43('0x53'))[_0xbb43('0x50')](_0xbb43('0x54'),'ui')[_0xbb43('0x55')](_0xbb43('0x56'),'u',_0xbb43('0x57'));var _0x1a3f98=squel['select']()[_0xbb43('0x50')](_0xbb43('0x58'),'i')[_0xbb43('0x55')](_0xbb43('0x59'),'c',_0xbb43('0x5a'))[_0xbb43('0x55')](_0xbb43('0x56'),'o',_0xbb43('0x5b'))[_0xbb43('0x55')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0xbb43('0x55')](_0xbb43('0x5c'),'me',_0xbb43('0x5d'))[_0xbb43('0x55')](_0xbb43('0x5e'),'it',_0xbb43('0x5f'))[_0xbb43('0x55')]('tools_tags','t',_0xbb43('0x60'));var _0x599eec=squel['expr']();var _0x1decf2=[];var _0x1f626a=squel[_0xbb43('0x61')]();var _0x22ce17;if(_0x5a662b[_0xbb43('0x47')][_0xbb43('0x62')]){_0x22ce17=as[_0xbb43('0x63')](_0x5a662b[_0xbb43('0x47')]['search']);var _0x4f2631=_0x22ce17[_0xbb43('0x64')];for(var _0x2b96b8=0x0;_0x2b96b8<_0x22ce17[_0xbb43('0x65')][_0xbb43('0x66')];_0x2b96b8++){var _0x1a3cdc=_0x22ce17[_0xbb43('0x65')][_0x2b96b8];var _0x12717e='i';var _0x404e22=_[_0xbb43('0x67')](_0x5d4c19,['name',_0x1a3cdc[_0xbb43('0x4f')]]);if(!_0x404e22){switch(_0x1a3cdc[_0xbb43('0x4f')]){case _0xbb43('0x68'):if(_0x1a3cdc[_0xbb43('0x69')]==0x1){_0x1a3f98[_0xbb43('0x6a')]('`'+_0x1a3cdc[_0xbb43('0x4f')]+'`\x20=\x200');}else{_0x1a3f98[_0xbb43('0x6a')]('`'+_0x1a3cdc[_0xbb43('0x4f')]+_0xbb43('0x6b'));}break;case _0xbb43('0x6c'):if(_0x1a3cdc[_0xbb43('0x6d')]==='$substring'){if(_0x1a3cdc[_0xbb43('0x69')][_0xbb43('0x34')]('\x20')[_0xbb43('0x66')]>0x1){_0x599eec[_0x4f2631](_0xbb43('0x6e'),qs[_0xbb43('0x6f')](_0x1a3cdc[_0xbb43('0x69')]),null);}else{var _0x2bd30e='%'+_0x1a3cdc[_0xbb43('0x69')]+'%';_0x599eec[_0x4f2631](_0xbb43('0x70'),_0x2bd30e,_0x2bd30e,_0x2bd30e);}}else{_0x404e22=_[_0xbb43('0x67')](_0x5d4c19,['name',_0xbb43('0x71')]);_0x1a3cdc['field']=_0xbb43('0x71');_0x3e4619=as[_0xbb43('0x72')](_0x12717e,_0x404e22[_0xbb43('0x42')],_0x1a3cdc);_0x599eec[_0x4f2631](_0x3e4619[_0xbb43('0x73')],_0x3e4619[_0xbb43('0x69')]['start'],_0x3e4619['value'][_0xbb43('0x1f')]);}break;case _0xbb43('0x74'):var _0x48f14a=_0x1a3cdc[_0xbb43('0x69')][_0xbb43('0x34')](',')[_0xbb43('0x32')](function(_0x52ca51){return Number(_0x52ca51);});_0x48f14a[_0xbb43('0x35')](function(_0x298a77){_0x1f626a['or'](_0xbb43('0x75'),'%,'+_0x298a77+',%');});_0x1decf2=_[_0xbb43('0x76')](_0x1decf2,_0x48f14a);break;case _0xbb43('0x77'):if(_0x1a3cdc[_0xbb43('0x6d')]===_0xbb43('0x78')){_0x599eec[_0x4f2631](_0xbb43('0x79'),'%'+_0x1a3cdc[_0xbb43('0x69')]+'%',null);}else{_0x404e22=_[_0xbb43('0x67')](_0x5d4c19,['name','UserId']);_0x1a3cdc[_0xbb43('0x4f')]=_0xbb43('0x3d');_0x3e4619=as[_0xbb43('0x72')](_0x12717e,_0x404e22['type'],_0x1a3cdc);_0x599eec[_0x4f2631](_0x3e4619[_0xbb43('0x73')],_0x3e4619[_0xbb43('0x69')][_0xbb43('0x7a')],_0x3e4619[_0xbb43('0x69')][_0xbb43('0x1f')]);}break;case'body':_0x3e4619=as[_0xbb43('0x72')]('me',null,_0x1a3cdc);_0x599eec[_0x4f2631](_0x3e4619[_0xbb43('0x73')],_0x3e4619[_0xbb43('0x69')]['start'],_0x3e4619[_0xbb43('0x69')][_0xbb43('0x1f')]);break;}}else{var _0x3e4619=as[_0xbb43('0x72')](_0x12717e,_0x404e22[_0xbb43('0x42')],_0x1a3cdc);_0x599eec[_0x4f2631](_0x3e4619[_0xbb43('0x73')],_0x3e4619[_0xbb43('0x69')][_0xbb43('0x7a')],_0x3e4619[_0xbb43('0x69')][_0xbb43('0x1f')]);}}}else{var _0x445219=_(_0x5a662b['query'])[_0xbb43('0x44')]()[_0xbb43('0x32')](function(_0x2d439f){return _[_0xbb43('0x7b')](_0x5d4c19,[_0xbb43('0x28'),_0x2d439f])?_0x2d439f:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x445219)){_0x445219[_0xbb43('0x35')](function(_0x34e4d6){if(_0x34e4d6===_0xbb43('0x7c')){_0x1a3f98[_0xbb43('0x7d')](_0xbb43('0x7e'),[][_0xbb43('0x7f')](_0x5a662b[_0xbb43('0x47')][_0x34e4d6]));}else if(_0x34e4d6==='createdAt'){var _0x3a5d49=JSON[_0xbb43('0x80')](_0x5a662b[_0xbb43('0x47')][_0x34e4d6])['$gte'];var _0x26e95d=JSON['parse'](_0x5a662b[_0xbb43('0x47')][_0x34e4d6])['$lte'];_0x1a3f98[_0xbb43('0x7d')](_0xbb43('0x81'),_0x3a5d49,_0x26e95d);}else{if(_0x5a662b[_0xbb43('0x47')][_0x34e4d6]===_0xbb43('0x82')){_0x1a3f98[_0xbb43('0x7d')]('i.'+_0x34e4d6+_0xbb43('0x83'));}else{_0x1a3f98[_0xbb43('0x7d')]('i.'+_0x34e4d6+_0xbb43('0x84'),_0x5a662b['query'][_0x34e4d6]);}}});}if(_0x5a662b[_0xbb43('0x47')][_0xbb43('0x85')]){if(_0x5a662b['query'][_0xbb43('0x85')]==0x1){_0x1a3f98[_0xbb43('0x6a')](_0xbb43('0x86'));}else{_0x1a3f98['having'](_0xbb43('0x87'));}}if(_0x5a662b[_0xbb43('0x47')][_0xbb43('0x88')]){_0x1decf2=_[_0xbb43('0x89')](_0x5a662b[_0xbb43('0x47')][_0xbb43('0x88')])?_0x5a662b['query'][_0xbb43('0x88')]:new Array(_0x5a662b['query'][_0xbb43('0x88')]);_0x1decf2[_0xbb43('0x35')](function(_0x4b2a47){_0x1f626a['or'](_0xbb43('0x75'),'%,'+_0x4b2a47+',%');});}if(_0x5a662b[_0xbb43('0x47')]['filter']){var _0x4cee72=_0x5a662b[_0xbb43('0x47')][_0xbb43('0x8a')][_0xbb43('0x8b')]('\x5c','\x5c\x5c')[_0xbb43('0x8b')](/'/g,'\x27\x27');if(qs[_0xbb43('0x8c')](_0x4cee72)){_0x599eec['or'](_0xbb43('0x8d'),_0x4cee72+'%');}else{_0x599eec['or'](_0xbb43('0x8e'),qs[_0xbb43('0x6f')](_0x4cee72))['or'](_0xbb43('0x8f'),_0x4cee72+'%');}}}_0x1a3f98[_0xbb43('0x7d')](_0x599eec);_0x1a3f98['group'](_0xbb43('0x90'));var _0x104ce3={'type':db[_0xbb43('0x91')]['QueryTypes']['SELECT'],'raw':!![]};var _0xd6a304=_0x1a3f98[_0xbb43('0x92')]();_0xd6a304[_0xbb43('0x4f')](_0xbb43('0x90'));_0xd6a304['field'](_0xbb43('0x93'),'unreadMessages');if(_0x8c57af[_0xbb43('0x4b')]){_0x8c57af[_0xbb43('0x4b')][_0xbb43('0x35')](function(_0x5d606f){var _0x1451ec=_0x5d606f[0x0]===_0xbb43('0x94')?_0x5d606f[0x0]:'i.'+_0x5d606f[0x0];_0x1a3f98['order'](_0x1451ec,_0x5d606f[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbb43('0x95')](_0x1decf2)){_0x1a3f98[_0xbb43('0x6a')](_0x1f626a);_0xd6a304[_0xbb43('0x7d')](_0xbb43('0x96'),_0x1decf2);}BPromise[_0xbb43('0x97')]()[_0xbb43('0x15')](function(){if(!_0x22ce17){if(_0x5a662b[_0xbb43('0x47')][_0xbb43('0x7c')])return;_0xd6a304['where'](_0xbb43('0x98'));_0x1a3f98[_0xbb43('0x7d')](_0xbb43('0x98'));return;}if(_0x5a662b[_0xbb43('0x99')]['role']!==_0xbb43('0x2e'))return;return _0x5a662b['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xbb43('0x15')](function(_0x40f913){if(_[_0xbb43('0x95')](_0x40f913)){_0xd6a304['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x1a3f98['where'](_0xbb43('0x9a'));}else{_0xd6a304[_0xbb43('0x7d')](_0xbb43('0x7e'),_[_0xbb43('0x32')](_0x40f913,'id'));_0x1a3f98[_0xbb43('0x7d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xbb43('0x32')](_0x40f913,'id'));}});})['then'](function(){if(_0x5a662b[_0xbb43('0x99')]['role']==='agent'&&!_0x22ce17&&!_0x5a662b['query'][_0xbb43('0x7c')])return[];return db[_0xbb43('0x9b')]['query'](_0xd6a304[_0xbb43('0x9c')](),_0x104ce3);})[_0xbb43('0x15')](function(_0x134ca3){_0x1a66f0[_0xbb43('0x23')]=_0x134ca3[_0xbb43('0x66')];if(_0x1a66f0[_0xbb43('0x23')]===0x0)return[];return db[_0xbb43('0x9b')][_0xbb43('0x47')](_0x39dc59[_0xbb43('0x9c')](),_0x104ce3)[_0xbb43('0x15')](function(_0x20f767){_0x3719dc=_['keyBy'](_0x20f767,'id');_0x104ce3=_[_0xbb43('0x2b')](_0x104ce3,{'model':db[_0xbb43('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a662b[_0xbb43('0x47')][_0xbb43('0x49')]){_0x8c57af[_0xbb43('0x48')][_0xbb43('0x35')](function(_0x1852e0){_0x1a3f98[_0xbb43('0x4f')]('i.'+_0x1852e0);});}else{_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0x93'),_0xbb43('0x68'));_0x1a3f98['field']('a.key',_0xbb43('0x9e'));_0x1a3f98[_0xbb43('0x4f')]('a.mandatoryDisposition',_0xbb43('0x9f'));_0x1a3f98['field'](_0xbb43('0xa0'),_0xbb43('0x94'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa1'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa2'),'Contact.firstName');_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa3'),_0xbb43('0xa4'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa5'),_0xbb43('0xa6'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa7'),_0xbb43('0xa8'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xa9'),_0xbb43('0xaa'));_0x1a3f98[_0xbb43('0x4f')](_0xbb43('0xab'),_0xbb43('0xac'));_0x1a3f98['field'](_0xbb43('0xad'),_0xbb43('0xae'));_0x1a3f98['field']('o.internal',_0xbb43('0xaf'));_0x1a3f98['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbb43('0x37'));}if(_0x8c57af['limit'])_0x1a3f98[_0xbb43('0x22')](_0x8c57af[_0xbb43('0x22')]);if(_0x8c57af[_0xbb43('0x20')])_0x1a3f98[_0xbb43('0x20')](_0x8c57af['offset']);return db[_0xbb43('0x9b')][_0xbb43('0x47')](_0x1a3f98[_0xbb43('0x9c')](),_0x104ce3);})['then'](function(_0x263d28){if(_0x263d28[_0xbb43('0x66')]>0x0)_0x182c9b['where'](_0xbb43('0xb0'),_[_0xbb43('0x32')](_0x263d28,'id'));return db[_0xbb43('0x9b')][_0xbb43('0x47')](_0x182c9b[_0xbb43('0x9c')](),_0x104ce3)[_0xbb43('0x15')](function(_0x457e5b){var _0x134c3b=_[_0xbb43('0xb1')](_0x457e5b,_0xbb43('0xb2'));var _0xda0e5d=[];_0x263d28[_0xbb43('0x35')](function(_0x2aef2f){_0xda0e5d[_0xbb43('0x36')](updateChatInteraction(_0x2aef2f,_0x3719dc,_0x134c3b));});return BPromise['all'](_0xda0e5d);});});})[_0xbb43('0x15')](function(_0x1e757f){_0x1a66f0[_0xbb43('0xb3')]=_0x1e757f;return _0x1a66f0;})[_0xbb43('0x15')](respondWithFilteredResult(_0x2eaece,_0x8c57af))['catch'](handleError(_0x2eaece,null));};exports[_0xbb43('0xb4')]=function(_0xd3af99,_0x44f9a8){var _0x2745a6={'raw':![],'where':{'id':_0xd3af99['params']['id']}},_0x3dc08f={};_0x3dc08f[_0xbb43('0x43')]=_[_0xbb43('0x44')](db['ChatInteraction'][_0xbb43('0xb5')]);_0x3dc08f[_0xbb43('0x47')]=_['keys'](_0xd3af99[_0xbb43('0x47')]);_0x3dc08f[_0xbb43('0x45')]=_[_0xbb43('0x46')](_0x3dc08f[_0xbb43('0x43')],_0x3dc08f[_0xbb43('0x47')]);_0x2745a6['attributes']=_[_0xbb43('0x46')](_0x3dc08f[_0xbb43('0x43')],qs[_0xbb43('0x49')](_0xd3af99[_0xbb43('0x47')][_0xbb43('0x49')]));_0x2745a6['attributes']=_0x2745a6[_0xbb43('0x48')]['length']?_0x2745a6['attributes']:_0x3dc08f[_0xbb43('0x43')];if(_0xd3af99[_0xbb43('0x47')][_0xbb43('0xb6')]){_0x2745a6[_0xbb43('0xb7')]=[{'all':!![]}];}_0x2745a6=_[_0xbb43('0x2b')]({},_0x2745a6,_0xd3af99[_0xbb43('0xb8')]);return db['ChatInteraction']['find'](_0x2745a6)['then'](handleEntityNotFound(_0x44f9a8,null))[_0xbb43('0x15')](respondWithResult(_0x44f9a8,null))[_0xbb43('0x1d')](handleError(_0x44f9a8,null));};exports[_0xbb43('0xb9')]=function(_0x3b7b8e,_0x10b34b){return db[_0xbb43('0x9d')][_0xbb43('0xb9')](_0x3b7b8e[_0xbb43('0x2c')],{})['then'](respondWithResult(_0x10b34b,0xc9))[_0xbb43('0x1d')](handleError(_0x10b34b,null));};exports['update']=function(_0x6510ee,_0x4c5500){if(_0x6510ee[_0xbb43('0x2c')]['id']){delete _0x6510ee[_0xbb43('0x2c')]['id'];}return db[_0xbb43('0x9d')][_0xbb43('0x67')]({'where':{'id':_0x6510ee[_0xbb43('0xba')]['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x4c5500,null))[_0xbb43('0x15')](saveUpdates(_0x6510ee['body'],null))[_0xbb43('0x15')](respondWithResult(_0x4c5500,null))[_0xbb43('0x1d')](handleError(_0x4c5500,null));};exports[_0xbb43('0xbb')]=function(_0x45d407,_0x53549d){return db[_0xbb43('0x9d')]['find']({'where':{'id':_0x45d407[_0xbb43('0xba')]['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x53549d,null))[_0xbb43('0x15')](removeEntity(_0x53549d,null))[_0xbb43('0x1d')](handleError(_0x53549d,null));};exports[_0xbb43('0xbc')]=function(_0x1a1e9e,_0xe0b935){return db[_0xbb43('0x9d')][_0xbb43('0xbc')]()['then'](respondWithResult(_0xe0b935,null))[_0xbb43('0x1d')](handleError(_0xe0b935,null));};exports[_0xbb43('0xbd')]=function(_0x2733f4,_0x4933f7){var _0x3e1bc0=_0x2733f4['params']['id'];var _0x50c68e;var _0x12d058;var _0x17d7c4;return db['ChatInteraction'][_0xbb43('0xbe')]({'where':{'id':_0x3e1bc0}})['then'](function(_0x2d1b62){_0x50c68e=_0x2d1b62;return db[_0xbb43('0xbf')][_0xbb43('0xbe')]({'where':{'id':_0x2d1b62['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xbb43('0xc0'),_0xbb43('0xc1'),_0xbb43('0xc2')],'raw':!![]});})[_0xbb43('0x15')](function(_0x13dfba){if(_0x13dfba&&_0x13dfba['vidaooApiKey']&&_0x13dfba[_0xbb43('0xc3')]){_0x12d058=_0x13dfba;var _0x7271d0={'interaction':{'id':_0x3e1bc0},'agent':{'id':_0x2733f4[_0xbb43('0x99')]['id'],'name':_0x2733f4[_0xbb43('0x99')][_0xbb43('0x28')],'fullname':_0x2733f4[_0xbb43('0x99')]['fullname'],'email':_0x2733f4['user'][_0xbb43('0xc4')]},'contact':_0x2733f4[_0xbb43('0x2c')]['contact'],'account':_0x2733f4['body'][_0xbb43('0x30')]};var _0x543bd5={'rejectUnauthorized':![],'method':_0xbb43('0xc5'),'url':_0xbb43('0xc6'),'headers':{'X-APIKEY':_0x13dfba[_0xbb43('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2733f4[_0xbb43('0x99')]['email']],'buttons':null,'topic':_0x12d058[_0xbb43('0xc0')],'note':_[_0xbb43('0xc8')](_0x12d058[_0xbb43('0xc1')])?null:getMustacheRender(_0x12d058[_0xbb43('0xc1')],_0x7271d0),'metadata':null},'redirect':_0xbb43('0xc9'),'json':!![]};try{if(!_[_0xbb43('0xc8')](_0x12d058['vidaooMetadata'])){var _0x493308=getMustacheRender(_0x12d058[_0xbb43('0xc2')],_0x7271d0);var _0x3a8237=JSON[_0xbb43('0x80')](_0x493308);_0x543bd5[_0xbb43('0x2c')][_0xbb43('0xca')]=_0x3a8237;}}catch(_0x51d255){throw new db['Sequelize'][(_0xbb43('0xcb'))](_0xbb43('0xcc'));}return rp(_0x543bd5);}else{throw new db[(_0xbb43('0x91'))]['ValidationError'](_0xbb43('0xcd'));}})[_0xbb43('0x15')](function(_0x3c4059){_0x17d7c4=_0x3c4059;if(_0x17d7c4['id']){var _0x4bc906={'body':_0x17d7c4[_0xbb43('0xce')],'ChatWebsiteId':_0x12d058['id'],'ChatInteractionId':_0x50c68e['id'],'direction':'out','UserId':_0x2733f4[_0xbb43('0x99')]['id']};return db[_0xbb43('0xcf')][_0xbb43('0xb9')](_0x4bc906,{});}else{throw new db['Sequelize'][(_0xbb43('0xcb'))](_0xbb43('0xd0'));}})[_0xbb43('0x15')](function(){return _0x50c68e[_0xbb43('0xd1')]({'vidaooSessionId':_0x17d7c4['id']});})[_0xbb43('0x15')](respondWithResult(_0x4933f7,null))[_0xbb43('0x1d')](handleError(_0x4933f7,null));};exports[_0xbb43('0xd2')]=function(_0x4122e7,_0x301b7f){if(_0x4122e7[_0xbb43('0x2c')]['id']){delete _0x4122e7[_0xbb43('0x2c')]['id'];}return db[_0xbb43('0x9d')][_0xbb43('0x67')]({'where':{'id':_0x4122e7[_0xbb43('0xba')]['id']},'include':[{'model':db['CmContact'],'as':_0xbb43('0x6c')}]})[_0xbb43('0x15')](handleEntityNotFound(_0x301b7f,null))[_0xbb43('0x15')](saveUpdates(_0x4122e7[_0xbb43('0x2c')],null))[_0xbb43('0x15')](respondWithResult(_0x301b7f,null))[_0xbb43('0x1d')](handleError(_0x301b7f,null));};exports[_0xbb43('0xd3')]=function(_0x1a9c77,_0x1f8f78){if(_0x1a9c77[_0xbb43('0x2c')]['id']){delete _0x1a9c77[_0xbb43('0x2c')]['id'];}return db[_0xbb43('0x9d')][_0xbb43('0x67')]({'where':{'id':_0x1a9c77[_0xbb43('0xba')]['id']}})[_0xbb43('0x15')](function(_0x357e45){if(!_0x357e45){logger[_0xbb43('0x18')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xbb43('0xd3'),0x194,'entity\x20not\x20found');_0x1f8f78['sendStatus'](0x194);}else{if(_0x357e45[_0xbb43('0x3d')]){throw new db[(_0xbb43('0x91'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x357e45;})[_0xbb43('0x15')](function(_0x5911fc){if(_0x5911fc){return _0x5911fc['update']({'closed':_0x1a9c77[_0xbb43('0x2c')]['closed'],'disposition':_0x1a9c77[_0xbb43('0x2c')]['disposition']})[_0xbb43('0x15')](function(_0x5fdbcd){return _0x5fdbcd;});}})['then'](function(){return respondWithRpcPromise(_0xbb43('0xd4'),_0xbb43('0xd3'),_0x1a9c77[_0xbb43('0x2c')],client9004);})[_0xbb43('0x15')](respondWithResult(_0x1f8f78,null))[_0xbb43('0x1d')](handleError(_0x1f8f78,null));};exports['attachmentUpload']=function(_0x6b0dd,_0x240d76){_0x6b0dd[_0xbb43('0x2c')][_0xbb43('0x28')]=_0x6b0dd[_0xbb43('0xd5')]['originalname'];_0x6b0dd[_0xbb43('0x2c')][_0xbb43('0xd6')]=_0x6b0dd[_0xbb43('0xd5')]['filename'];_0x6b0dd['body'][_0xbb43('0x42')]=_0x6b0dd[_0xbb43('0xd5')][_0xbb43('0xd7')];return db['Attachment']['create'](_0x6b0dd[_0xbb43('0x2c')])[_0xbb43('0x15')](respondWithResult(_0x240d76,0xc9))[_0xbb43('0x1d')](handleError(_0x240d76,null));};exports[_0xbb43('0xd8')]=function(_0x235942,_0x51673b){return db[_0xbb43('0x9d')][_0xbb43('0xbe')]({'where':{'id':_0x235942[_0xbb43('0xba')]['id']},'raw':!![]})[_0xbb43('0x15')](handleEntityNotFound(_0x51673b,null))[_0xbb43('0x15')](function(_0x2937c2){if(_0x2937c2){if(_0x2937c2['closed']){return _0x51673b[_0xbb43('0x29')](0x193)[_0xbb43('0x25')]({'status':0x193,'message':_0xbb43('0xd9')});}return db['Attachment'][_0xbb43('0xbe')]({'where':{'id':_0x235942['query'][_0xbb43('0xda')]},'raw':!![]})[_0xbb43('0x15')](handleEntityNotFound(_0x51673b,null));}})[_0xbb43('0x15')](function(_0x2e66b8){if(_0x2e66b8){var _0x59bb83=_0x2e66b8[_0xbb43('0xdb')]!==null;var _0x512e64=path[_0xbb43('0xdc')](config[_0xbb43('0xdd')],_0xbb43('0xde'));if(_0x59bb83){_0x512e64=path[_0xbb43('0xdc')](_0x512e64,_0xbb43('0xdf'));}var _0x532596=path[_0xbb43('0xdc')](_0x512e64,_0x2e66b8[_0xbb43('0xd6')]);return _0x51673b[_0xbb43('0xe0')](_0x532596);}})[_0xbb43('0x1d')](handleError(_0x51673b,null));};exports[_0xbb43('0xe1')]=function(_0x597c10,_0x1ba8b8){var _0x3b50e8=null;var _0x39c8fd=null;var _0x4e6ac5=null;if(_0x597c10[_0xbb43('0x2c')]['id']){delete _0x597c10['body']['id'];}if(_0x597c10['body']['mailTranscript']){_0x4e6ac5=path['join'](config[_0xbb43('0xdd')],'server/files/chat/upload/',util[_0xbb43('0xe2')](_0xbb43('0xe3'),Date[_0xbb43('0xe4')]()));_0x597c10[_0xbb43('0x2c')]['pathTranscript']=_0x4e6ac5;}return db[_0xbb43('0x9d')][_0xbb43('0x67')]({'where':{'id':_0x597c10['params']['id']},'include':[{'model':db[_0xbb43('0xcf')],'as':_0xbb43('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xbb43('0x15')](handleEntityNotFound(_0x1ba8b8,null))[_0xbb43('0x15')](saveUpdates(_0x597c10[_0xbb43('0x2c')],null))['then'](function(_0x17065d){if(_0x17065d){_0x3b50e8=_0x17065d;return db['ChatWebsite'][_0xbb43('0x67')]({'where':{'id':_0x3b50e8[_0xbb43('0x7c')]}});}})[_0xbb43('0x15')](function(_0x2f8e05){if(_0x2f8e05){_0x39c8fd=_0x2f8e05;return db['CmContact'][_0xbb43('0x67')]({'where':{'id':_0x3b50e8[_0xbb43('0x71')]}});}})[_0xbb43('0x15')](function(_0x7c7f55){if(_0x7c7f55){if(_0x4e6ac5){var _0x20040b=null;for(var _0x57e81b=0x1;_0x57e81b<_0x3b50e8[_0xbb43('0xe5')][_0xbb43('0x66')];++_0x57e81b){_0x20040b=_0x3b50e8['Messages'][_0x57e81b];var _0x5a87b3=_0x20040b[_0xbb43('0x3d')]?util['format'](_0xbb43('0xe6'),_0x39c8fd[_0xbb43('0xe7')],_0x20040b[_0xbb43('0x3d')]):_0xbb43('0xe8');var _0x6bbd30=_0x597c10[_0xbb43('0x2c')][_0xbb43('0xe9')]||util[_0xbb43('0xe2')](_0xbb43('0xe6'),_0xbb43('0xea'),_0x20040b['ContactId']);switch(_0x39c8fd[_0xbb43('0xeb')]){case _0xbb43('0xec'):_0x5a87b3=_0x20040b[_0xbb43('0x3d')]?util['format'](_0xbb43('0xe6'),_0x39c8fd[_0xbb43('0xe7')],_0x20040b[_0xbb43('0x3d')]):_0xbb43('0xe8');break;case _0xbb43('0xed'):_0x5a87b3=_0x20040b['UserId']?_0x20040b[_0xbb43('0x77')]['alias']||_0x20040b['User']['fullname']:'System';break;case _0xbb43('0xee'):_0x5a87b3=_0x20040b[_0xbb43('0x3d')]?_0x20040b[_0xbb43('0x77')][_0xbb43('0x33')]:_0xbb43('0xe8');break;default:_0x5a87b3=_0x20040b[_0xbb43('0x3d')]?util[_0xbb43('0xe2')]('%s%d',_0x39c8fd[_0xbb43('0xe7')],_0x20040b[_0xbb43('0x3d')]):_0xbb43('0xe8');}var _0x16e6d0=util[_0xbb43('0xe2')](_0xbb43('0xef'),moment(_0x20040b[_0xbb43('0xf0')])[_0xbb43('0xe2')](_0xbb43('0xf1')),_0x20040b[_0xbb43('0xf2')]==='in'?_0x6bbd30:_0x5a87b3,_0x20040b[_0xbb43('0x2c')]);if(!_0x20040b['secret']){fs['appendFileSync'](_0x4e6ac5,_0x16e6d0);}}return db[_0xbb43('0xf3')][_0xbb43('0xbe')]({'where':{'service':!![]},'include':[{'model':db[_0xbb43('0xf4')],'as':_0xbb43('0xf5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xbb43('0xf6'),'raw':!![]}]}]});}}})[_0xbb43('0x15')](function(_0x42441d){if(!_0x42441d||!_0x42441d[_0xbb43('0xf5')]||!_0x597c10['body'])return _0x3b50e8;var _0x5228d9=_0x42441d[_0xbb43('0xf7')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5228d9,'message':{'from':util[_0xbb43('0xe2')](_0xbb43('0xf8'),_0x42441d[_0xbb43('0x28')],_0x42441d[_0xbb43('0xc4')]||_0x42441d['Smtp'][_0xbb43('0x99')]),'to':_0x597c10[_0xbb43('0x2c')][_0xbb43('0xf9')],'subject':'Mail\x20Transcript','text':util[_0xbb43('0xe2')](_0xbb43('0xfa'),_0x597c10[_0xbb43('0x2c')][_0xbb43('0xf9')]),'attachments':[{'path':_0x4e6ac5}]}})[_0xbb43('0x15')](function(){return _0x3b50e8;})[_0xbb43('0x1d')](function(_0x5d7a43){logger[_0xbb43('0x18')](_0x5d7a43);});})['then'](respondWithStatusCode(_0x1ba8b8,0xc8))[_0xbb43('0x1d')](handleError(_0x1ba8b8,null));};exports[_0xbb43('0xfb')]=function(_0x36a180,_0x30b80a){return db[_0xbb43('0xcf')][_0xbb43('0x67')]({'where':{'id':_0x36a180['params']['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x30b80a,null))[_0xbb43('0x15')](function(_0x52a9cb){if(_0x52a9cb){return _0x52a9cb[_0xbb43('0xfb')](_0x36a180[_0xbb43('0x2c')][_0xbb43('0xfc')],_[_0xbb43('0xfd')](_0x36a180[_0xbb43('0x2c')],[_0xbb43('0xfc'),'id'])||{});}})[_0xbb43('0x15')](respondWithResult(_0x30b80a,null))[_0xbb43('0x1d')](handleError(_0x30b80a,null));};exports['getMessages']=function(_0x45d84c,_0x30dd90){var _0x3e0507={'raw':![],'where':{}};var _0x2965d6={};var _0x4db12f={'count':0x0,'rows':[]};return db[_0xbb43('0x9d')][_0xbb43('0xbe')]({'where':{'id':_0x45d84c[_0xbb43('0xba')]['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x30dd90,null))[_0xbb43('0x15')](function(_0x26f8e9){if(_0x26f8e9){_0x2965d6[_0xbb43('0x43')]=_[_0xbb43('0x44')](db[_0xbb43('0xcf')][_0xbb43('0xb5')]);_0x2965d6['query']=_[_0xbb43('0x44')](_0x45d84c[_0xbb43('0x47')]);_0x2965d6[_0xbb43('0x45')]=_['intersection'](_0x2965d6[_0xbb43('0x43')],_0x2965d6[_0xbb43('0x47')]);_0x3e0507[_0xbb43('0x48')]=_[_0xbb43('0x46')](_0x2965d6[_0xbb43('0x43')],qs['fields'](_0x45d84c[_0xbb43('0x47')][_0xbb43('0x49')]));_0x3e0507[_0xbb43('0x48')]=_0x3e0507[_0xbb43('0x48')][_0xbb43('0x66')]?_0x3e0507[_0xbb43('0x48')]:_0x2965d6['model'];if(!_0x45d84c[_0xbb43('0x47')][_0xbb43('0x4a')](_0xbb43('0xfe'))){_0x3e0507[_0xbb43('0x22')]=qs[_0xbb43('0x22')](_0x45d84c[_0xbb43('0x47')][_0xbb43('0x22')]);_0x3e0507[_0xbb43('0x20')]=qs[_0xbb43('0x20')](_0x45d84c[_0xbb43('0x47')][_0xbb43('0x20')]);}_0x3e0507[_0xbb43('0x4b')]=qs[_0xbb43('0x4c')](_0x45d84c[_0xbb43('0x47')]['sort']);_0x3e0507[_0xbb43('0x7d')]=qs[_0xbb43('0x45')](_[_0xbb43('0x4d')](_0x45d84c[_0xbb43('0x47')],_0x2965d6[_0xbb43('0x45')]));_0x3e0507[_0xbb43('0x7d')]['ChatInteractionId']=_0x26f8e9['id'];if(_0x45d84c[_0xbb43('0x47')][_0xbb43('0x8a')]){_0x3e0507[_0xbb43('0x7d')]=_[_0xbb43('0x2b')](_0x3e0507[_0xbb43('0x7d')],{'$or':_[_0xbb43('0x32')](_0x3e0507[_0xbb43('0x48')],function(_0x1a89da){var _0x3f7b7c={};_0x3f7b7c[_0x1a89da]={'$like':'%'+_0x45d84c['query'][_0xbb43('0x8a')]+'%'};return _0x3f7b7c;})});}if(_0x45d84c[_0xbb43('0x47')][_0xbb43('0xff')]){var _0x435691=_0x45d84c[_0xbb43('0x47')]['$gte'][_0xbb43('0x34')](',');var _0x58ac0d={};_0x58ac0d[_0x435691[0x0]]={'$gte':moment(_0x435691[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3e0507[_0xbb43('0x7d')]=_[_0xbb43('0x2b')](_0x3e0507['where'],_0x58ac0d);}_0x3e0507=_['merge']({},_0x3e0507,_0x45d84c[_0xbb43('0xb8')]);return db['ChatMessage'][_0xbb43('0x23')]({'where':_0x3e0507[_0xbb43('0x7d')]})[_0xbb43('0x15')](function(_0x2f7bcf){_0x4db12f[_0xbb43('0x23')]=_0x2f7bcf;if(_0x45d84c['query'][_0xbb43('0xb6')]){_0x3e0507[_0xbb43('0xb7')]=[{'all':!![]}];}return db[_0xbb43('0xcf')][_0xbb43('0x100')](_0x3e0507);})[_0xbb43('0x15')](function(_0xc6c129){_0x4db12f['rows']=_0xc6c129;return _0x4db12f;});}})[_0xbb43('0x15')](respondWithFilteredResult(_0x30dd90,_0x3e0507))[_0xbb43('0x1d')](handleError(_0x30dd90,null));};exports[_0xbb43('0x101')]=function(_0x47d4d7,_0x40ca42){var _0x4cd83a={'where':{}},_0x169866={},_0x27c99b={'count':0x0,'rows':[]};return db[_0xbb43('0x9d')][_0xbb43('0xbe')]({'where':{'id':_0x47d4d7[_0xbb43('0xba')]['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x40ca42,null))[_0xbb43('0x15')](function(_0x2109cc){if(_0x2109cc){_0x169866[_0xbb43('0x43')]=_['keys'](db[_0xbb43('0xcf')][_0xbb43('0xb5')]);_0x169866[_0xbb43('0x47')]=_[_0xbb43('0x44')](_0x47d4d7[_0xbb43('0x47')]);_0x169866[_0xbb43('0x45')]=_[_0xbb43('0x46')](_0x169866['model'],_0x169866[_0xbb43('0x47')]);_0x4cd83a['attributes']=_[_0xbb43('0x46')](_0x169866['model'],qs[_0xbb43('0x49')](_0x47d4d7[_0xbb43('0x47')][_0xbb43('0x49')]));_0x4cd83a[_0xbb43('0x48')]=_0x4cd83a[_0xbb43('0x48')]['length']?_0x4cd83a['attributes']:_0x169866['model'];if(!_0x47d4d7[_0xbb43('0x47')][_0xbb43('0x4a')]('nolimit')){_0x4cd83a['limit']=qs[_0xbb43('0x22')](_0x47d4d7[_0xbb43('0x47')][_0xbb43('0x22')]);_0x4cd83a[_0xbb43('0x20')]=qs[_0xbb43('0x20')](_0x47d4d7['query'][_0xbb43('0x20')]);}_0x4cd83a[_0xbb43('0x4b')]=qs['sort'](_0x47d4d7['query'][_0xbb43('0x4c')]);_0x4cd83a[_0xbb43('0x7d')]=qs[_0xbb43('0x45')](_['pick'](_0x47d4d7[_0xbb43('0x47')],_0x169866['filters']));_0x4cd83a[_0xbb43('0x7d')][_0xbb43('0xb2')]=_0x2109cc['id'];if(_0x47d4d7[_0xbb43('0x47')][_0xbb43('0x8a')]){_0x4cd83a[_0xbb43('0x7d')]=_['merge'](_0x4cd83a[_0xbb43('0x7d')],{'$or':_[_0xbb43('0x32')](_0x4cd83a[_0xbb43('0x48')],function(_0x1dc19d){var _0x1249c7={};_0x1249c7[_0x1dc19d]={'$like':'%'+_0x47d4d7['query'][_0xbb43('0x8a')]+'%'};return _0x1249c7;})});}_0x4cd83a[_0xbb43('0x7d')]['secret']=![];if(_0x47d4d7['query']['id']){_0x4cd83a[_0xbb43('0x7d')]['id']={'$gt':_0x47d4d7[_0xbb43('0x47')]['id']};}_0x4cd83a=_['merge']({},_0x4cd83a,_0x47d4d7['options']);return db[_0xbb43('0xcf')][_0xbb43('0x23')]({'where':_0x4cd83a[_0xbb43('0x7d')]})[_0xbb43('0x15')](function(_0x569f54){_0x27c99b[_0xbb43('0x23')]=_0x569f54;_0x4cd83a['include']=[];if(_0x47d4d7[_0xbb43('0x47')][_0xbb43('0x102')]){_0x4cd83a[_0xbb43('0xb7')]['push']({'model':db[_0xbb43('0x77')],'as':_0xbb43('0x77'),'attributes':['id',_0xbb43('0x33'),_0xbb43('0x103')]});}if(_0x47d4d7[_0xbb43('0x47')][_0xbb43('0xb6')]){_0x4cd83a[_0xbb43('0xb7')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb43('0x100')](_0x4cd83a);})['then'](function(_0x1e5668){_0x27c99b[_0xbb43('0xb3')]=_0x1e5668;return _0x27c99b;});}})[_0xbb43('0x15')](respondWithFilteredResult(_0x40ca42,_0x4cd83a))[_0xbb43('0x1d')](handleError(_0x40ca42,null));};exports['addTags']=function(_0x1731e8,_0x2ec383){return db['ChatInteraction'][_0xbb43('0x67')]({'where':{'id':_0x1731e8['params']['id']}})[_0xbb43('0x15')](handleEntityNotFound(_0x2ec383,null))[_0xbb43('0x15')](function(_0x37c4b4){if(_0x37c4b4){return _0x37c4b4['setTags'](_0x1731e8['body'][_0xbb43('0xfc')],_['omit'](_0x1731e8[_0xbb43('0x2c')],['ids','id'])||{})[_0xbb43('0x104')](function(){return db[_0xbb43('0x74')][_0xbb43('0x100')]({'attributes':['id',_0xbb43('0x28'),_0xbb43('0x105')],'where':{'id':_0x1731e8[_0xbb43('0x2c')][_0xbb43('0xfc')]}});})[_0xbb43('0x15')](function(_0x58d41d){socket[_0xbb43('0x106')](_0xbb43('0x107'),{'id':Number(_0x1731e8[_0xbb43('0xba')]['id']),'tags':_0x58d41d||[]});return{'id':Number(_0x1731e8[_0xbb43('0xba')]['id']),'tags':_0x58d41d||[]};});}})['then'](respondWithResult(_0x2ec383,null))[_0xbb43('0x1d')](handleError(_0x2ec383,null));};exports[_0xbb43('0x108')]=function(_0x3178f7,_0x360eb5){return db[_0xbb43('0x9d')][_0xbb43('0x67')]({'where':{'id':_0x3178f7['params']['id']}})['then'](handleEntityNotFound(_0x360eb5,null))['then'](function(_0x31f548){if(_0x31f548){return _0x31f548['removeTags'](_0x3178f7[_0xbb43('0x47')][_0xbb43('0xfc')]);}})['then'](respondWithStatusCode(_0x360eb5,null))[_0xbb43('0x1d')](handleError(_0x360eb5,null));};exports[_0xbb43('0xe0')]=function(_0xea8659,_0x157391){var _0x2b60f0=moment()['unix']()[_0xbb43('0x9c')]();var _0x19622c=path['join'](config['root'],_0xbb43('0x109'),'files',_0xbb43('0x10a'));var _0x24fa63=path['join'](config[_0xbb43('0xdd')],_0xbb43('0x109'),'files',_0xbb43('0x10b'));var _0x5eb021=path['join'](_0x19622c,_0x2b60f0);var _0x4bb31b=util['format'](_0xbb43('0x10c'),_0xea8659[_0xbb43('0xba')]['id'],_0x2b60f0);var _0x21ba01=path[_0xbb43('0xdc')](_0x19622c,_0x4bb31b);var _0x2414e4=[];_0x2414e4[_0xbb43('0x36')]({'model':db[_0xbb43('0x77')],'as':_0xbb43('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x2414e4[_0xbb43('0x36')]({'model':db[_0xbb43('0x10d')],'as':_0xbb43('0x6c'),'attributes':['id',_0xbb43('0x10e'),_0xbb43('0x10f')],'raw':!![]});if(_0xea8659[_0xbb43('0x47')]['attachments']){_0x2414e4['push']({'model':db[_0xbb43('0x110')],'as':_0xbb43('0x110'),'raw':!![]});}var _0x2e8b8c=[{'model':db['ChatMessage'],'as':_0xbb43('0xe5'),'attributes':['id',_0xbb43('0x2c'),_0xbb43('0xf0'),_0xbb43('0xf2'),'secret',_0xbb43('0x85')],'include':_0x2414e4}];_0x2e8b8c['push']({'model':db[_0xbb43('0xbf')],'as':_0xbb43('0x111'),'attributes':['id',_0xbb43('0x28')]});_0x2e8b8c['push']({'model':db[_0xbb43('0x77')],'as':'Owner','attributes':['id',_0xbb43('0x33')]});return db['ChatInteraction']['find']({'where':{'id':_0xea8659[_0xbb43('0xba')]['id']},'include':_0x2e8b8c})[_0xbb43('0x15')](handleEntityNotFound(_0x157391,null))['then'](function(_0x312c22){if(_0x312c22){var _0x1f7d62=_0x312c22['get']({'plain':!![]});fs['mkdirSync'](_0x5eb021);var _0x4ab4d5={'channel':_0xbb43('0x112'),'account':_0x1f7d62['Account'][_0xbb43('0x28')],'agent':_0x1f7d62[_0xbb43('0x113')]?_0x1f7d62[_0xbb43('0x113')][_0xbb43('0x33')]:_0xbb43('0x114'),'createdAt':moment(_0x1f7d62['createdAt'])[_0xbb43('0xe2')](_0xbb43('0x115'))[_0xbb43('0x9c')](),'closedAt':_0x1f7d62[_0xbb43('0x3c')]?moment(_0x1f7d62[_0xbb43('0x116')])[_0xbb43('0xe2')](_0xbb43('0x115'))['toString']():'','disposition':_0x1f7d62['disposition'],'chatInfo':{'browser':_0x1f7d62['browserName'],'os':_0x1f7d62[_0xbb43('0x117')],'referer':_0x1f7d62[_0xbb43('0x118')],'customerIp':_0x1f7d62['customerIp'],'customerPort':_0x1f7d62['customerPort']?_0x1f7d62['customerPort']:_0xbb43('0x114')},'messages':_(_0x1f7d62[_0xbb43('0xe5')])['tail']()[_0xbb43('0x8a')]({'secret':![]})[_0xbb43('0x32')](function(_0x533eae){if(_0x533eae[_0xbb43('0x110')]){var _0x24790f=path['join'](_0x24fa63,_0x533eae[_0xbb43('0x110')][_0xbb43('0xd6')]);if(fs['existsSync'](_0x24790f)){fs[_0xbb43('0x119')](_0x24790f)[_0xbb43('0x11a')](fs[_0xbb43('0x11b')](path[_0xbb43('0xdc')](_0x5eb021,_0x533eae[_0xbb43('0x110')][_0xbb43('0xd6')])));}}return{'date':moment(_0x533eae[_0xbb43('0xf0')])['format'](_0xbb43('0x115'))[_0xbb43('0x9c')](),'sender':_0x533eae['direction']===_0xbb43('0x11c')?_0x533eae[_0xbb43('0x77')]?_0x533eae[_0xbb43('0x77')]['fullname']:_0xbb43('0xe8'):_0x533eae[_0xbb43('0x6c')][_0xbb43('0x10e')]+(_0x533eae[_0xbb43('0x6c')][_0xbb43('0x10f')]?'\x20'+_0x533eae['Contact'][_0xbb43('0x10f')]:''),'body':_0x533eae[_0xbb43('0x110')]?_0x533eae['Attachment'][_0xbb43('0xd6')]:_0x533eae[_0xbb43('0x2c')],'direction':_0x533eae[_0xbb43('0xf2')]===_0xbb43('0x11c')?'A':'C','secret':_0x533eae[_0xbb43('0x11d')],'read':_0x533eae[_0xbb43('0x85')],'attachment':_0x533eae[_0xbb43('0x110')]};})[_0xbb43('0x69')]()};return ejs[_0xbb43('0x11e')](path[_0xbb43('0xdc')](config['root'],_0xbb43('0x109'),_0xbb43('0x11f'),_0xbb43('0x120')),{'interaction':_0x4ab4d5})[_0xbb43('0x15')](function(_0x5cce0f){var _0x5e6df7=path[_0xbb43('0xdc')](_0x5eb021,_0xbb43('0x121')+_0x1f7d62['id']+'-'+_0x2b60f0+_0xbb43('0x122'));var _0x18b331={'path':_0x5e6df7,'channel':_0xbb43('0x112'),'interactionId':_0x1f7d62['id']};return pdf[_0xbb43('0x123')](_0x5cce0f,_0x18b331);})[_0xbb43('0x15')](function(){return new Promise(function(_0x574325,_0x3f800d){zipdir(_0x5eb021,{'saveTo':_0x21ba01},function(_0x262099,_0x306138){if(_0x262099)return _0x3f800d(_0x262099);return _0x574325(_0x306138);});})[_0xbb43('0x15')](function(){return new BPromise(function(_0x271aa2,_0x62768a){rimraf(_0x5eb021,function(_0x1e48ab){if(_0x1e48ab)_0x62768a(_0x1e48ab);return _0x271aa2();});});})[_0xbb43('0x15')](function(){return _0x157391[_0xbb43('0xe0')](_0x21ba01,_0x4bb31b,function(_0x41341e){if(_0x41341e){logger['error']('err',_0x41341e);}else{fs[_0xbb43('0x124')](_0x21ba01);}});});});}else{return _0x157391['sendStatus'](0xc8);}})[_0xbb43('0x1d')](handleError(_0x157391,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6a3bc9b..7ef0f66 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 _0xa18e=['Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','remove','getUsers','setDataValue'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xa18e,0x1c0));var _0xea18=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xa18e[_0x5a3cf0];return _0x5a64ee;};'use strict';var EventEmitter=require(_0xea18('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xea18('0x1')];var ChatMessage=require(_0xea18('0x2'))['db'][_0xea18('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xea18('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xea18('0x5')};function emitEvent(_0xe9309){return function(_0x5203fa,_0x1e9994,_0x198a28){_0x5203fa[_0xea18('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10a59c){_0x5203fa[_0xea18('0x7')](_0xea18('0x8'),_0x10a59c[_0xea18('0x9')](function(_0x2a80b6){return{'id':_0x2a80b6['id']};}));return ChatMessage[_0xea18('0xa')]({'where':{'ChatInteractionId':_0x5203fa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xea18('0xb')](function(_0x4adbea){_0x5203fa[_0xea18('0x7')](_0xea18('0xc'),_0x4adbea[_0xea18('0xd')]);ChatInteractionEvents[_0xea18('0xe')](_0xe9309+':'+_0x5203fa['id'],_0x5203fa);ChatInteractionEvents[_0xea18('0xe')](_0xe9309,_0x5203fa);_0x198a28(null);})[_0xea18('0xf')](_0x198a28(null));};}for(var e in events){if(events[_0xea18('0x10')](e)){var event=events[e];ChatInteraction[_0xea18('0x11')](e,emitEvent(event));}}module[_0xea18('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x24a5=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','Users','map','findAll','setDataValue','unreadMessages'];(function(_0xf8c90c,_0x29d757){var _0x37c757=function(_0xe50cd4){while(--_0xe50cd4){_0xf8c90c['push'](_0xf8c90c['shift']());}};_0x37c757(++_0x29d757);}(_0x24a5,0x1c6));var _0x524a=function(_0x418da8,_0x417bdd){_0x418da8=_0x418da8-0x0;var _0x2ae1c4=_0x24a5[_0x418da8];return _0x2ae1c4;};'use strict';var EventEmitter=require(_0x524a('0x0'));var ChatInteraction=require(_0x524a('0x1'))['db'][_0x524a('0x2')];var ChatMessage=require(_0x524a('0x1'))['db'][_0x524a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x524a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x527694){return function(_0x3b14e3,_0x59acf1,_0x5218e0){_0x3b14e3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x301cd6){_0x3b14e3['setDataValue'](_0x524a('0x5'),_0x301cd6[_0x524a('0x6')](function(_0x132c37){return{'id':_0x132c37['id']};}));return ChatMessage[_0x524a('0x7')]({'where':{'ChatInteractionId':_0x3b14e3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1fabf6){_0x3b14e3[_0x524a('0x8')](_0x524a('0x9'),_0x1fabf6[_0x524a('0xa')]);ChatInteractionEvents[_0x524a('0xb')](_0x527694+':'+_0x3b14e3['id'],_0x3b14e3);ChatInteractionEvents[_0x524a('0xb')](_0x527694,_0x3b14e3);_0x5218e0(null);})[_0x524a('0xc')](_0x5218e0(null));};}for(var e in events){if(events[_0x524a('0xd')](e)){var event=events[e];ChatInteraction[_0x524a('0xe')](e,emitEvent(event));}}module[_0x524a('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 c3da693..315a8a9 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 _0x6d4d=['utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1398ad,_0x44e0e2){var _0x10ea56=function(_0x58c12a){while(--_0x58c12a){_0x1398ad['push'](_0x1398ad['shift']());}};_0x10ea56(++_0x44e0e2);}(_0x6d4d,0x177));var _0xd6d4=function(_0x2fc884,_0x2e4070){_0x2fc884=_0x2fc884-0x0;var _0xb2525d=_0x6d4d[_0x2fc884];return _0xb2525d;};'use strict';var _=require(_0xd6d4('0x0'));var util=require(_0xd6d4('0x1'));var logger=require('../../config/logger')(_0xd6d4('0x2'));var moment=require('moment');var BPromise=require(_0xd6d4('0x3'));var rp=require(_0xd6d4('0x4'));var fs=require('fs');var path=require(_0xd6d4('0x5'));var rimraf=require(_0xd6d4('0x6'));var config=require(_0xd6d4('0x7'));var attributes=require(_0xd6d4('0x8'));module[_0xd6d4('0x9')]=function(_0x1c2c72,_0x4fa78f){return _0x1c2c72['define'](_0xd6d4('0xa'),attributes,{'tableName':_0xd6d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5903f8,_0x4f662f,_0x30cb4e){if(_0x5903f8[_0xd6d4('0xc')](_0xd6d4('0xd'))){_0x5903f8[_0xd6d4('0xe')]=moment()['format'](_0xd6d4('0xf'));}_0x30cb4e(null,_0x5903f8);}},'charset':_0xd6d4('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x263a=['../../config/environment','./chatInteraction.attributes','exports','define','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0x263a,0x1c3));var _0xa263=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x263a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa263('0x0'));var util=require('util');var logger=require(_0xa263('0x1'))(_0xa263('0x2'));var moment=require(_0xa263('0x3'));var BPromise=require(_0xa263('0x4'));var rp=require(_0xa263('0x5'));var fs=require('fs');var path=require(_0xa263('0x6'));var rimraf=require(_0xa263('0x7'));var config=require(_0xa263('0x8'));var attributes=require(_0xa263('0x9'));module[_0xa263('0xa')]=function(_0x5bf5db,_0x310121){return _0x5bf5db[_0xa263('0xb')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x489ce6,_0x1d057d,_0x16f24b){if(_0x489ce6[_0xa263('0xc')](_0xa263('0xd'))){_0x489ce6[_0xa263('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x16f24b(null,_0x489ce6);}},'charset':_0xa263('0xf'),'collate':_0xa263('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a941f04..61fe7fc 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 _0xb2ed=['info','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','then','debug','AddTagsToChatInteraction','find','ids','omit','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3964b5,_0xeb4190){var _0x37d532=function(_0xadd178){while(--_0xadd178){_0x3964b5['push'](_0x3964b5['shift']());}};_0x37d532(++_0xeb4190);}(_0xb2ed,0x179));var _0xdb2e=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xb2ed[_0x148c09];return _0x18e613;};'use strict';var _=require(_0xdb2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb2e('0x1'));var rs=require(_0xdb2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb2e('0x3'))['db'];var utils=require(_0xdb2e('0x4'));var logger=require('../../config/logger')(_0xdb2e('0x5'));var config=require(_0xdb2e('0x6'));var jayson=require(_0xdb2e('0x7'));var client=jayson[_0xdb2e('0x8')][_0xdb2e('0x9')]({'port':0x232a});config['redis']=_[_0xdb2e('0xa')](config[_0xdb2e('0xb')],{'host':_0xdb2e('0xc'),'port':0x18eb});var socket=require(_0xdb2e('0xd'))(new Redis(config[_0xdb2e('0xb')]));require(_0xdb2e('0xe'))['register'](socket);function respondWithRpcPromise(_0x48c0e5,_0x2b06a0,_0x4092c1){return new BPromise(function(_0x4e9495,_0x3f6677){return client[_0xdb2e('0xf')](_0x48c0e5,_0x4092c1)['then'](function(_0xf4e273){logger['info'](_0xdb2e('0x10'),_0x2b06a0,_0xdb2e('0x11'));logger['debug'](_0xdb2e('0x12'),_0x2b06a0,_0xdb2e('0x11'),JSON[_0xdb2e('0x13')](_0xf4e273));if(_0xf4e273[_0xdb2e('0x14')]){if(_0xf4e273[_0xdb2e('0x14')][_0xdb2e('0x15')]===0x1f4){logger[_0xdb2e('0x14')](_0xdb2e('0x10'),_0x2b06a0,_0xf4e273[_0xdb2e('0x14')][_0xdb2e('0x16')]);return _0x3f6677(_0xf4e273['error'][_0xdb2e('0x16')]);}logger['error'](_0xdb2e('0x10'),_0x2b06a0,_0xf4e273['error'][_0xdb2e('0x16')]);return _0x4e9495(_0xf4e273[_0xdb2e('0x14')][_0xdb2e('0x16')]);}else{logger[_0xdb2e('0x17')](_0xdb2e('0x10'),_0x2b06a0,_0xdb2e('0x11'));_0x4e9495(_0xf4e273[_0xdb2e('0x18')][_0xdb2e('0x16')]);}})[_0xdb2e('0x19')](function(_0x15ff53){logger[_0xdb2e('0x14')](_0xdb2e('0x10'),_0x2b06a0,_0x15ff53);_0x3f6677(_0x15ff53);});});}exports[_0xdb2e('0x1a')]=function(_0x549ed8){var _0x48023c=this;return new Promise(function(_0x3abd54,_0x58b156){return db[_0xdb2e('0x1b')][_0xdb2e('0x1c')](_0x549ed8['body'],{'raw':_0x549ed8[_0xdb2e('0x1d')]?_0x549ed8[_0xdb2e('0x1d')][_0xdb2e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549ed8['options']?_0x549ed8[_0xdb2e('0x1d')][_0xdb2e('0x1f')]||null:null,'attributes':_0x549ed8[_0xdb2e('0x1d')]?_0x549ed8[_0xdb2e('0x1d')][_0xdb2e('0x20')]||null:null,'limit':_0x549ed8['options']?_0x549ed8[_0xdb2e('0x1d')]['limit']||null:null})[_0xdb2e('0x21')](function(_0x4580c3){logger[_0xdb2e('0x17')](_0xdb2e('0x1a'),_0x549ed8);logger[_0xdb2e('0x22')](_0xdb2e('0x1a'),_0x549ed8,JSON[_0xdb2e('0x13')](_0x4580c3));_0x3abd54(_0x4580c3);})[_0xdb2e('0x19')](function(_0x1b6da5){logger[_0xdb2e('0x14')](_0xdb2e('0x1a'),_0x1b6da5['message'],_0x549ed8);_0x58b156(_0x48023c[_0xdb2e('0x14')](0x1f4,_0x1b6da5[_0xdb2e('0x16')]));});});};exports[_0xdb2e('0x23')]=function(_0x16024c){return new Promise(function(_0x390862,_0x214d33){return db[_0xdb2e('0x1b')][_0xdb2e('0x24')]({'where':_0x16024c[_0xdb2e('0x1d')]?_0x16024c[_0xdb2e('0x1d')]['where']||null:null})[_0xdb2e('0x21')](function(_0x5ab539){if(_0x5ab539){return _0x5ab539['addTags'](_0x16024c['body'][_0xdb2e('0x25')],_[_0xdb2e('0x26')](_0x16024c['body'],[_0xdb2e('0x25'),'id'])||{});}})['spread'](function(_0x77ee2){logger[_0xdb2e('0x17')]('AddTags',_0x16024c);logger[_0xdb2e('0x22')](_0xdb2e('0x27'),_0x16024c,JSON[_0xdb2e('0x13')](_0x77ee2));_0x390862(_0x77ee2);})['catch'](function(_0x45fb19){logger[_0xdb2e('0x14')](_0xdb2e('0x27'),_0x45fb19[_0xdb2e('0x16')],_0x16024c);_0x214d33(_this[_0xdb2e('0x14')](0x1f4,_0x45fb19[_0xdb2e('0x16')]));});});}; \ No newline at end of file +var _0xf1b5=['update','body','options','raw','attributes','limit','catch','find','where','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','UpdateChatInteraction','ChatInteraction'];(function(_0x491956,_0x43d798){var _0x4cde6b=function(_0x43ccba){while(--_0x43ccba){_0x491956['push'](_0x491956['shift']());}};_0x4cde6b(++_0x43d798);}(_0xf1b5,0x117));var _0x5f1b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1b5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5f1b('0x0'));var moment=require(_0x5f1b('0x1'));var BPromise=require(_0x5f1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f1b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f1b('0x4'));var logger=require(_0x5f1b('0x5'))('rpc');var config=require(_0x5f1b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5f1b('0x7')]['http']({'port':0x232a});config[_0x5f1b('0x8')]=_[_0x5f1b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f1b('0xa'))(new Redis(config[_0x5f1b('0x8')]));require(_0x5f1b('0xb'))[_0x5f1b('0xc')](socket);function respondWithRpcPromise(_0x5581f5,_0x40da75,_0x50df19){return new BPromise(function(_0x1ace5a,_0x4a081d){return client[_0x5f1b('0xd')](_0x5581f5,_0x50df19)[_0x5f1b('0xe')](function(_0x3d573c){logger[_0x5f1b('0xf')](_0x5f1b('0x10'),_0x40da75,_0x5f1b('0x11'));logger[_0x5f1b('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x40da75,'request\x20sent',JSON[_0x5f1b('0x13')](_0x3d573c));if(_0x3d573c['error']){if(_0x3d573c[_0x5f1b('0x14')][_0x5f1b('0x15')]===0x1f4){logger[_0x5f1b('0x14')](_0x5f1b('0x10'),_0x40da75,_0x3d573c[_0x5f1b('0x14')][_0x5f1b('0x16')]);return _0x4a081d(_0x3d573c['error'][_0x5f1b('0x16')]);}logger[_0x5f1b('0x14')](_0x5f1b('0x10'),_0x40da75,_0x3d573c[_0x5f1b('0x14')][_0x5f1b('0x16')]);return _0x1ace5a(_0x3d573c[_0x5f1b('0x14')][_0x5f1b('0x16')]);}else{logger[_0x5f1b('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x40da75,_0x5f1b('0x11'));_0x1ace5a(_0x3d573c['result']['message']);}})['catch'](function(_0x508ca3){logger['error'](_0x5f1b('0x10'),_0x40da75,_0x508ca3);_0x4a081d(_0x508ca3);});});}exports[_0x5f1b('0x17')]=function(_0x127c9a){var _0x2f09f9=this;return new Promise(function(_0x40523d,_0x1aa7d1){return db[_0x5f1b('0x18')][_0x5f1b('0x19')](_0x127c9a[_0x5f1b('0x1a')],{'raw':_0x127c9a[_0x5f1b('0x1b')]?_0x127c9a[_0x5f1b('0x1b')][_0x5f1b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x127c9a[_0x5f1b('0x1b')]?_0x127c9a[_0x5f1b('0x1b')]['where']||null:null,'attributes':_0x127c9a[_0x5f1b('0x1b')]?_0x127c9a[_0x5f1b('0x1b')][_0x5f1b('0x1d')]||null:null,'limit':_0x127c9a[_0x5f1b('0x1b')]?_0x127c9a[_0x5f1b('0x1b')][_0x5f1b('0x1e')]||null:null})['then'](function(_0x2627c2){logger[_0x5f1b('0xf')](_0x5f1b('0x17'),_0x127c9a);logger[_0x5f1b('0x12')](_0x5f1b('0x17'),_0x127c9a,JSON[_0x5f1b('0x13')](_0x2627c2));_0x40523d(_0x2627c2);})[_0x5f1b('0x1f')](function(_0x4257bb){logger[_0x5f1b('0x14')](_0x5f1b('0x17'),_0x4257bb[_0x5f1b('0x16')],_0x127c9a);_0x1aa7d1(_0x2f09f9[_0x5f1b('0x14')](0x1f4,_0x4257bb[_0x5f1b('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0xb0c5ce){return new Promise(function(_0x11d8a5,_0x27e386){return db[_0x5f1b('0x18')][_0x5f1b('0x20')]({'where':_0xb0c5ce[_0x5f1b('0x1b')]?_0xb0c5ce[_0x5f1b('0x1b')][_0x5f1b('0x21')]||null:null})[_0x5f1b('0xe')](function(_0x3e5c39){if(_0x3e5c39){return _0x3e5c39[_0x5f1b('0x22')](_0xb0c5ce[_0x5f1b('0x1a')][_0x5f1b('0x23')],_['omit'](_0xb0c5ce[_0x5f1b('0x1a')],[_0x5f1b('0x23'),'id'])||{});}})[_0x5f1b('0x24')](function(_0x3b9607){logger['info']('AddTags',_0xb0c5ce);logger[_0x5f1b('0x12')](_0x5f1b('0x25'),_0xb0c5ce,JSON[_0x5f1b('0x13')](_0x3b9607));_0x11d8a5(_0x3b9607);})[_0x5f1b('0x1f')](function(_0xec8ad9){logger[_0x5f1b('0x14')](_0x5f1b('0x25'),_0xec8ad9[_0x5f1b('0x16')],_0xb0c5ce);_0x27e386(_this['error'](0x1f4,_0xec8ad9[_0x5f1b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 214f829..ccb06f1 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 _0x45fc=['length','./chatInteraction.events','update','removeListener','register'];(function(_0x327f87,_0x5e05ff){var _0x5cca27=function(_0x180d99){while(--_0x180d99){_0x327f87['push'](_0x327f87['shift']());}};_0x5cca27(++_0x5e05ff);}(_0x45fc,0x1b9));var _0xc45f=function(_0x16df89,_0x31311e){_0x16df89=_0x16df89-0x0;var _0x14dba3=_0x45fc[_0x16df89];return _0x14dba3;};'use strict';var ChatInteractionEvents=require(_0xc45f('0x0'));var events=['save','remove',_0xc45f('0x1')];function createListener(_0x1c2dac,_0x43cbd3){return function(_0x2f27d9){_0x43cbd3['emit'](_0x1c2dac,_0x2f27d9);};}function removeListener(_0x3a4c82,_0x157d02){return function(){ChatInteractionEvents[_0xc45f('0x2')](_0x3a4c82,_0x157d02);};}exports[_0xc45f('0x3')]=function(_0x50fa53){for(var _0x296521=0x0,_0x9bbcc1=events[_0xc45f('0x4')];_0x296521<_0x9bbcc1;_0x296521++){var _0x616b22=events[_0x296521];var _0x2c2d85=createListener('chatInteraction:'+_0x616b22,_0x50fa53);ChatInteractionEvents['on'](_0x616b22,_0x2c2d85);}}; \ No newline at end of file +var _0xf9f9=['emit','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x3669d0,_0x2ae8c1){var _0x37a9e4=function(_0x34e049){while(--_0x34e049){_0x3669d0['push'](_0x3669d0['shift']());}};_0x37a9e4(++_0x2ae8c1);}(_0xf9f9,0x90));var _0x9f9f=function(_0x11fc3f,_0x5b2b90){_0x11fc3f=_0x11fc3f-0x0;var _0x4d8e0d=_0xf9f9[_0x11fc3f];return _0x4d8e0d;};'use strict';var ChatInteractionEvents=require(_0x9f9f('0x0'));var events=[_0x9f9f('0x1'),_0x9f9f('0x2'),'update'];function createListener(_0x5ec2b9,_0x103b3a){return function(_0x27bfd6){_0x103b3a[_0x9f9f('0x3')](_0x5ec2b9,_0x27bfd6);};}function removeListener(_0xd0543f,_0x4c986d){return function(){ChatInteractionEvents[_0x9f9f('0x4')](_0xd0543f,_0x4c986d);};}exports[_0x9f9f('0x5')]=function(_0xe759d9){for(var _0x3c2b59=0x0,_0x5bef94=events['length'];_0x3c2b59<_0x5bef94;_0x3c2b59++){var _0x397af8=events[_0x3c2b59];var _0x251da5=createListener(_0x9f9f('0x6')+_0x397af8,_0xe759d9);ChatInteractionEvents['on'](_0x397af8,_0x251da5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 98f3690..7ef2d4d 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 _0x0271=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','/:id/messages','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','destroy','delete'];(function(_0x5edc93,_0x461b5e){var _0x2d9463=function(_0x291d93){while(--_0x291d93){_0x5edc93['push'](_0x5edc93['shift']());}};_0x2d9463(++_0x461b5e);}(_0x0271,0x139));var _0x1027=function(_0x524de5,_0x17e494){_0x524de5=_0x524de5-0x0;var _0x1a7a5f=_0x0271[_0x524de5];return _0x1a7a5f;};'use strict';var multer=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var path=require(_0x1027('0x2'));var timeout=require(_0x1027('0x3'));var express=require('express');var router=express[_0x1027('0x4')]();var fs_extra=require(_0x1027('0x5'));var auth=require(_0x1027('0x6'));var interaction=require(_0x1027('0x7'));var config=require(_0x1027('0x8'));var controller=require(_0x1027('0x9'));router[_0x1027('0xa')]('/',auth[_0x1027('0xb')](),controller[_0x1027('0xc')]);router[_0x1027('0xa')](_0x1027('0xd'),auth[_0x1027('0xb')](),controller[_0x1027('0xe')]);router['get']('/:id',auth[_0x1027('0xf')](),controller[_0x1027('0x10')]);router[_0x1027('0xa')](_0x1027('0x11'),auth[_0x1027('0xf')](),controller['attachmentDownload']);router[_0x1027('0xa')]('/:id/messages',auth[_0x1027('0xb')](),controller['getMessages']);router[_0x1027('0xa')](_0x1027('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x1027('0x13')]);router['get']('/:id/download',auth[_0x1027('0xb')](),controller[_0x1027('0x14')]);router[_0x1027('0x15')]('/',auth[_0x1027('0xb')](),controller[_0x1027('0x16')]);router['post'](_0x1027('0x17'),auth['isAuthenticated'](),controller[_0x1027('0x18')]);var upload=multer({'storage':multer[_0x1027('0x19')]({'destination':function(_0x1e592e,_0x441cd6,_0x30da44){_0x30da44(null,path[_0x1027('0x1a')](config['root'],_0x1027('0x1b')));},'filename':function(_0x50dd0c,_0x167524,_0x3be189){_0x3be189(null,util['format'](_0x1027('0x1c'),Date[_0x1027('0x1d')](),_0x167524[_0x1027('0x1e')][_0x1027('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1027('0x15')](_0x1027('0x20'),upload[_0x1027('0x21')]('file'),controller['attachmentUpload']);router[_0x1027('0x15')](_0x1027('0x22'),auth[_0x1027('0xf')](),controller['addMessage']);router[_0x1027('0x15')](_0x1027('0x23'),auth[_0x1027('0xb')](),interaction[_0x1027('0x24')](_0x1027('0x25'),_0x1027('0x26')),controller[_0x1027('0x27')]);router[_0x1027('0x28')](_0x1027('0x29'),auth[_0x1027('0xb')](),interaction['tracked'](_0x1027('0x25'),_0x1027('0x2a')),controller[_0x1027('0x2b')]);router[_0x1027('0x28')]('/:id/custom_update',controller[_0x1027('0x2c')]);router[_0x1027('0x28')](_0x1027('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x1027('0x2e')]);router[_0x1027('0x28')](_0x1027('0x2f'),controller[_0x1027('0x30')]);router['delete'](_0x1027('0x29'),auth[_0x1027('0xb')](),interaction['tracked'](_0x1027('0x25'),'chatinteraction:destroy'),controller[_0x1027('0x31')]);router[_0x1027('0x32')]('/:id/tags',auth[_0x1027('0xb')](),controller['removeTags']);module[_0x1027('0x33')]=router; \ No newline at end of file +var _0xf2eb=['destroy','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy'];(function(_0x18d50f,_0x124aff){var _0x8ce385=function(_0x321962){while(--_0x321962){_0x18d50f['push'](_0x18d50f['shift']());}};_0x8ce385(++_0x124aff);}(_0xf2eb,0x120));var _0xbf2e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf2eb[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0xbf2e('0x0'));var util=require(_0xbf2e('0x1'));var path=require(_0xbf2e('0x2'));var timeout=require(_0xbf2e('0x3'));var express=require(_0xbf2e('0x4'));var router=express[_0xbf2e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf2e('0x6'));var interaction=require(_0xbf2e('0x7'));var config=require(_0xbf2e('0x8'));var controller=require(_0xbf2e('0x9'));router[_0xbf2e('0xa')]('/',auth[_0xbf2e('0xb')](),controller['index']);router['get'](_0xbf2e('0xc'),auth[_0xbf2e('0xb')](),controller[_0xbf2e('0xd')]);router['get'](_0xbf2e('0xe'),auth[_0xbf2e('0xf')](),controller['show']);router[_0xbf2e('0xa')](_0xbf2e('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xbf2e('0x11')]);router['get'](_0xbf2e('0x12'),auth[_0xbf2e('0xb')](),controller[_0xbf2e('0x13')]);router[_0xbf2e('0xa')](_0xbf2e('0x14'),auth[_0xbf2e('0xf')](),controller['getMyMessages']);router['get'](_0xbf2e('0x15'),auth['isAuthenticated'](),controller['download']);router[_0xbf2e('0x16')]('/',auth['isAuthenticated'](),controller[_0xbf2e('0x17')]);router[_0xbf2e('0x16')](_0xbf2e('0x18'),auth[_0xbf2e('0xb')](),controller[_0xbf2e('0x19')]);var upload=multer({'storage':multer[_0xbf2e('0x1a')]({'destination':function(_0x11eb6d,_0x53285d,_0x19d73c){_0x19d73c(null,path[_0xbf2e('0x1b')](config[_0xbf2e('0x1c')],_0xbf2e('0x1d')));},'filename':function(_0xa92968,_0x3fee43,_0x27efad){_0x27efad(null,util[_0xbf2e('0x1e')](_0xbf2e('0x1f'),Date[_0xbf2e('0x20')](),_0x3fee43[_0xbf2e('0x21')][_0xbf2e('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbf2e('0x16')](_0xbf2e('0x23'),upload[_0xbf2e('0x24')](_0xbf2e('0x25')),controller[_0xbf2e('0x26')]);router[_0xbf2e('0x16')](_0xbf2e('0x12'),auth['isChatInteractionAuthorized'](),controller[_0xbf2e('0x27')]);router[_0xbf2e('0x16')](_0xbf2e('0x28'),auth[_0xbf2e('0xb')](),interaction[_0xbf2e('0x29')](_0xbf2e('0x2a'),_0xbf2e('0x2b')),controller[_0xbf2e('0x2c')]);router[_0xbf2e('0x2d')]('/:id',auth[_0xbf2e('0xb')](),interaction[_0xbf2e('0x29')](_0xbf2e('0x2a'),'chatinteraction:update'),controller[_0xbf2e('0x2e')]);router[_0xbf2e('0x2d')](_0xbf2e('0x2f'),controller[_0xbf2e('0x30')]);router[_0xbf2e('0x2d')](_0xbf2e('0x31'),auth[_0xbf2e('0xf')](),controller[_0xbf2e('0x32')]);router['put'](_0xbf2e('0x33'),controller[_0xbf2e('0x34')]);router['delete'](_0xbf2e('0xe'),auth['isAuthenticated'](),interaction[_0xbf2e('0x29')](_0xbf2e('0x2a'),_0xbf2e('0x35')),controller[_0xbf2e('0x36')]);router[_0xbf2e('0x37')](_0xbf2e('0x28'),auth[_0xbf2e('0xb')](),controller['removeTags']);module[_0xbf2e('0x38')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index db4f42a..481701b 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 _0xdca8=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xdca8,0x15f));var _0x8dca=function(_0x1678db,_0x3a5489){_0x1678db=_0x1678db-0x0;var _0x245f29=_0xdca8[_0x1678db];return _0x245f29;};'use strict';var Sequelize=require(_0x8dca('0x0'));module[_0x8dca('0x1')]={'body':{'type':Sequelize[_0x8dca('0x2')](_0x8dca('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8dca('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8dca('0x5')]}}; \ No newline at end of file +var _0xd3b3=['TEXT','BOOLEAN','INTEGER'];(function(_0x1f5bcc,_0x4e8729){var _0x537bd7=function(_0x419cf4){while(--_0x419cf4){_0x1f5bcc['push'](_0x1f5bcc['shift']());}};_0x537bd7(++_0x4e8729);}(_0xd3b3,0x1ad));var _0x3d3b=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xd3b3[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3d3b('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3d3b('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3d3b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index efdf8e5..b6ef30e 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 _0xa6c4=['sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','show','params','rawAttributes','fields','include','find','create','body','catch','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','fullname','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','type','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','push','messages','createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ChatInternalMessage','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa6c4,0x119));var _0x4a6c=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xa6c4[_0x29e35f];return _0x266b74;};'use strict';var emlformat=require(_0x4a6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a6c('0x2'));var moment=require(_0x4a6c('0x3'));var BPromise=require(_0x4a6c('0x4'));var Mustache=require(_0x4a6c('0x5'));var util=require(_0x4a6c('0x6'));var path=require(_0x4a6c('0x7'));var sox=require(_0x4a6c('0x8'));var csv=require(_0x4a6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a6c('0xa'));var crypto=require(_0x4a6c('0xb'));var jsforce=require(_0x4a6c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4a6c('0x9'));var querystring=require(_0x4a6c('0xd'));var Papa=require(_0x4a6c('0xe'));var Redis=require(_0x4a6c('0xf'));var authService=require(_0x4a6c('0x10'));var qs=require(_0x4a6c('0x11'));var as=require(_0x4a6c('0x12'));var hardwareService=require(_0x4a6c('0x13'));var logger=require('../../config/logger')(_0x4a6c('0x14'));var utils=require(_0x4a6c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4a6c('0x16'));var db=require(_0x4a6c('0x17'))['db'];config[_0x4a6c('0x18')]=_[_0x4a6c('0x19')](config['redis'],{'host':_0x4a6c('0x1a'),'port':0x18eb});var socket=require(_0x4a6c('0x1b'))(new Redis(config[_0x4a6c('0x18')]));require('./chatInternalMessage.socket')[_0x4a6c('0x1c')](socket);function respondWithStatusCode(_0x8b02cb,_0xa59264){_0xa59264=_0xa59264||0xcc;return function(_0x109266){if(_0x109266){return _0x8b02cb[_0x4a6c('0x1d')](_0xa59264);}return _0x8b02cb[_0x4a6c('0x1e')](_0xa59264)[_0x4a6c('0x1f')]();};}function respondWithResult(_0x5f6856,_0x40666c){_0x40666c=_0x40666c||0xc8;return function(_0x1cf664){if(_0x1cf664){return _0x5f6856['status'](_0x40666c)[_0x4a6c('0x20')](_0x1cf664);}};}function respondWithFilteredResult(_0x2ef347,_0x3874a0){return function(_0x3ff422){if(_0x3ff422){var _0xfdb3ab=typeof _0x3874a0[_0x4a6c('0x21')]===_0x4a6c('0x22')&&typeof _0x3874a0['limit']==='undefined';var _0x25c659=_0x3ff422['count'];var _0xede467=_0xfdb3ab?0x0:_0x3874a0[_0x4a6c('0x21')];var _0x18fa99=_0xfdb3ab?_0x3ff422['count']:_0x3874a0[_0x4a6c('0x21')]+_0x3874a0[_0x4a6c('0x23')];var _0x1c9ba2;if(_0x18fa99>=_0x25c659){_0x18fa99=_0x25c659;_0x1c9ba2=0xc8;}else{_0x1c9ba2=0xce;}_0x2ef347[_0x4a6c('0x1e')](_0x1c9ba2);return _0x2ef347[_0x4a6c('0x24')](_0x4a6c('0x25'),_0xede467+'-'+_0x18fa99+'/'+_0x25c659)[_0x4a6c('0x20')](_0x3ff422);}return null;};}function patchUpdates(_0x2646f3){return function(_0x144df8){try{jsonpatch[_0x4a6c('0x26')](_0x144df8,_0x2646f3,!![]);}catch(_0x2b8e16){return BPromise[_0x4a6c('0x27')](_0x2b8e16);}return _0x144df8[_0x4a6c('0x28')]();};}function saveUpdates(_0x43d196,_0x35694d){return function(_0x27322a){if(_0x27322a){return _0x27322a[_0x4a6c('0x29')](_0x43d196)[_0x4a6c('0x2a')](function(_0x157e53){return _0x157e53;});}return null;};}function removeEntity(_0x102c4b,_0x5b87fc){return function(_0x47d38c){if(_0x47d38c){return _0x47d38c[_0x4a6c('0x2b')]()['then'](function(){_0x102c4b[_0x4a6c('0x1e')](0xcc)[_0x4a6c('0x1f')]();});}};}function handleEntityNotFound(_0x5b0a49,_0x6ceb18){return function(_0x19c277){if(!_0x19c277){_0x5b0a49[_0x4a6c('0x1d')](0x194);}return _0x19c277;};}function handleError(_0x16af77,_0xd837c8){_0xd837c8=_0xd837c8||0x1f4;return function(_0x2f8902){logger[_0x4a6c('0x2c')](_0x2f8902[_0x4a6c('0x2d')]);if(_0x2f8902['name']){delete _0x2f8902[_0x4a6c('0x2e')];}_0x16af77['status'](_0xd837c8)['send'](_0x2f8902);};}exports[_0x4a6c('0x2f')]=function(_0x5f1818,_0x1907fd){var _0x32fc21={},_0x3d3e4a={},_0x11f4e0={'count':0x0,'rows':[]};var _0x496581=_['map'](db[_0x4a6c('0x30')]['rawAttributes'],function(_0x3efda9){return{'name':_0x3efda9[_0x4a6c('0x31')],'type':_0x3efda9['type'][_0x4a6c('0x32')]};});_0x3d3e4a[_0x4a6c('0x33')]=_[_0x4a6c('0x34')](_0x496581,_0x4a6c('0x2e'));_0x3d3e4a[_0x4a6c('0x35')]=_[_0x4a6c('0x36')](_0x5f1818[_0x4a6c('0x35')]);_0x3d3e4a[_0x4a6c('0x37')]=_[_0x4a6c('0x38')](_0x3d3e4a[_0x4a6c('0x33')],_0x3d3e4a[_0x4a6c('0x35')]);_0x32fc21['attributes']=_[_0x4a6c('0x38')](_0x3d3e4a['model'],qs['fields'](_0x5f1818[_0x4a6c('0x35')]['fields']));_0x32fc21[_0x4a6c('0x39')]=_0x32fc21[_0x4a6c('0x39')][_0x4a6c('0x3a')]?_0x32fc21[_0x4a6c('0x39')]:_0x3d3e4a[_0x4a6c('0x33')];if(!_0x5f1818[_0x4a6c('0x35')]['hasOwnProperty'](_0x4a6c('0x3b'))){_0x32fc21[_0x4a6c('0x23')]=qs[_0x4a6c('0x23')](_0x5f1818['query']['limit']);_0x32fc21[_0x4a6c('0x21')]=qs[_0x4a6c('0x21')](_0x5f1818['query'][_0x4a6c('0x21')]);}_0x32fc21[_0x4a6c('0x3c')]=qs[_0x4a6c('0x3d')](_0x5f1818[_0x4a6c('0x35')][_0x4a6c('0x3d')]);_0x32fc21['where']=qs['filters'](_[_0x4a6c('0x3e')](_0x5f1818[_0x4a6c('0x35')],_0x3d3e4a['filters']),_0x496581);if(_0x5f1818[_0x4a6c('0x35')][_0x4a6c('0x3f')]){_0x32fc21[_0x4a6c('0x40')]=_[_0x4a6c('0x41')](_0x32fc21[_0x4a6c('0x40')],{'$or':_[_0x4a6c('0x34')](_0x496581,function(_0x3f9c12){if(_0x3f9c12['type']!==_0x4a6c('0x42')){var _0x30c9b8={};_0x30c9b8[_0x3f9c12[_0x4a6c('0x2e')]]={'$like':'%'+_0x5f1818[_0x4a6c('0x35')]['filter']+'%'};return _0x30c9b8;}})});}_0x32fc21=_[_0x4a6c('0x41')]({},_0x32fc21,_0x5f1818[_0x4a6c('0x43')]);var _0x54f906={'where':_0x32fc21[_0x4a6c('0x40')]};return db[_0x4a6c('0x30')]['count'](_0x54f906)[_0x4a6c('0x2a')](function(_0x57b407){_0x11f4e0[_0x4a6c('0x44')]=_0x57b407;if(_0x5f1818['query'][_0x4a6c('0x45')]){_0x32fc21['include']=[{'all':!![]}];}return db[_0x4a6c('0x30')]['findAll'](_0x32fc21);})['then'](function(_0x1b075d){_0x11f4e0['rows']=_0x1b075d;return _0x11f4e0;})[_0x4a6c('0x2a')](respondWithFilteredResult(_0x1907fd,_0x32fc21))['catch'](handleError(_0x1907fd,null));};exports[_0x4a6c('0x46')]=function(_0x962046,_0x56f494){var _0x2d24e8={'raw':!![],'where':{'id':_0x962046[_0x4a6c('0x47')]['id']}},_0x15b3a3={};_0x15b3a3[_0x4a6c('0x33')]=_[_0x4a6c('0x36')](db[_0x4a6c('0x30')][_0x4a6c('0x48')]);_0x15b3a3['query']=_[_0x4a6c('0x36')](_0x962046[_0x4a6c('0x35')]);_0x15b3a3['filters']=_['intersection'](_0x15b3a3['model'],_0x15b3a3[_0x4a6c('0x35')]);_0x2d24e8[_0x4a6c('0x39')]=_[_0x4a6c('0x38')](_0x15b3a3[_0x4a6c('0x33')],qs[_0x4a6c('0x49')](_0x962046[_0x4a6c('0x35')]['fields']));_0x2d24e8[_0x4a6c('0x39')]=_0x2d24e8[_0x4a6c('0x39')][_0x4a6c('0x3a')]?_0x2d24e8[_0x4a6c('0x39')]:_0x15b3a3[_0x4a6c('0x33')];if(_0x962046[_0x4a6c('0x35')][_0x4a6c('0x45')]){_0x2d24e8[_0x4a6c('0x4a')]=[{'all':!![]}];}_0x2d24e8=_[_0x4a6c('0x41')]({},_0x2d24e8,_0x962046[_0x4a6c('0x43')]);return db['ChatInternalMessage'][_0x4a6c('0x4b')](_0x2d24e8)[_0x4a6c('0x2a')](handleEntityNotFound(_0x56f494,null))[_0x4a6c('0x2a')](respondWithResult(_0x56f494,null))['catch'](handleError(_0x56f494,null));};exports[_0x4a6c('0x4c')]=function(_0x4c360f,_0x119e76){return db[_0x4a6c('0x30')][_0x4a6c('0x4c')](_0x4c360f[_0x4a6c('0x4d')],{})[_0x4a6c('0x2a')](respondWithResult(_0x119e76,0xc9))['catch'](handleError(_0x119e76,null));};exports[_0x4a6c('0x29')]=function(_0x3dca30,_0x3f168c){if(_0x3dca30['body']['id']){delete _0x3dca30[_0x4a6c('0x4d')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x3dca30[_0x4a6c('0x47')]['id']}})[_0x4a6c('0x2a')](handleEntityNotFound(_0x3f168c,null))['then'](saveUpdates(_0x3dca30[_0x4a6c('0x4d')],null))[_0x4a6c('0x2a')](respondWithResult(_0x3f168c,null))[_0x4a6c('0x4e')](handleError(_0x3f168c,null));};exports['destroy']=function(_0x40a857,_0x4b5792){return db[_0x4a6c('0x30')][_0x4a6c('0x4b')]({'where':{'id':_0x40a857[_0x4a6c('0x47')]['id']}})[_0x4a6c('0x2a')](handleEntityNotFound(_0x4b5792,null))[_0x4a6c('0x2a')](removeEntity(_0x4b5792,null))[_0x4a6c('0x4e')](handleError(_0x4b5792,null));};exports[_0x4a6c('0x4f')]=function(_0x408aac,_0x3e83b6){return db[_0x4a6c('0x30')]['describe']()[_0x4a6c('0x2a')](respondWithResult(_0x3e83b6,null))[_0x4a6c('0x4e')](handleError(_0x3e83b6,null));};function wrapUser(_0x4e2426){return function(_0xa5d437){var _0xfaeef7=_0x4e2426[_0x4a6c('0x50')]({'plain':!![]});_0xfaeef7['messages']=[];if(_0xa5d437){_0xfaeef7[_0x4a6c('0x51')]=_0xa5d437['createdAt'];_0xfaeef7[_0x4a6c('0x52')]=_0xa5d437;}else{_0xfaeef7[_0x4a6c('0x51')]=moment(0x0)[_0x4a6c('0x53')](_0x4a6c('0x54'));_0xfaeef7[_0x4a6c('0x52')]={};}return _0xfaeef7;};}exports[_0x4a6c('0x55')]=function(_0x56e025,_0x2522c5,_0x2f9593){var _0xbad15b=[];return db[_0x4a6c('0x56')][_0x4a6c('0x57')]({'where':{'role':[_0x4a6c('0x58'),_0x4a6c('0x59'),'user']},'attributes':['id',_0x4a6c('0x5a'),'name','role','userpic',_0x4a6c('0x5b'),_0x4a6c('0x5c'),_0x4a6c('0x5d'),_0x4a6c('0x5e'),'showWebBar'],'order':qs['sort'](_0x4a6c('0x5f')),'include':[{'model':db[_0x4a6c('0x60')],'as':_0x4a6c('0x61'),'attributes':['id',_0x4a6c('0x2e'),_0x4a6c('0x62')],'through':{'attributes':[]}}]})[_0x4a6c('0x2a')](function(_0x42e444){if(_0x42e444){var _0x20a5cc=_0x56e025[_0x4a6c('0x63')]['get']({'plain':!![]});if(!_0x20a5cc)throw new Error(_0x4a6c('0x64'));if(_0x20a5cc[_0x4a6c('0x65')]===_0x4a6c('0x63')){return db[_0x4a6c('0x66')][_0x4a6c('0x4b')]({'where':{'name':_0x4a6c('0x67'),'userProfileId':_0x20a5cc[_0x4a6c('0x68')]},'raw':!![]})[_0x4a6c('0x2a')](function(_0x11c3b2){if(_0x11c3b2){if(_0x11c3b2[_0x4a6c('0x69')]===0x0){return db['UserProfileResource'][_0x4a6c('0x57')]({'where':{'sectionId':_0x11c3b2['id']},'raw':!![]})[_0x4a6c('0x2a')](function(_0x3367ce){var _0x351563=[];if(_['isEmpty'](_0x3367ce)){_0x351563=_['filter'](_0x42e444,function(_0x19f0da){if(_0x19f0da[_0x4a6c('0x65')]!==_0x4a6c('0x58')){return _0x19f0da;}});return _0x351563;}else{for(var _0x4d026e=0x0;_0x4d026e<_0x42e444[_0x4a6c('0x3a')];_0x4d026e++){var _0x4eb752=_0x42e444[_0x4d026e];if(_0x4eb752[_0x4a6c('0x65')]===_0x4a6c('0x58')){var _0x409720=_[_0x4a6c('0x4b')](_0x3367ce,function(_0x202d18){return _0x202d18['resourceId']===_0x4eb752['id'];});if(_0x409720)_0x351563['push'](_0x4eb752);}else{_0x351563[_0x4a6c('0x6a')](_0x4eb752);}}return _0x351563;}});}else{return _0x42e444;}}else{var _0x3f474b=_['filter'](_0x42e444,function(_0xb79e7d){if(_0xb79e7d[_0x4a6c('0x65')]!=='agent'){return _0xb79e7d;}});return _0x3f474b;}});}else{return _0x42e444;}}})[_0x4a6c('0x2a')](function(_0x4a9ac5){var _0x403b2e=[];if(_0x4a9ac5){_0xbad15b=_0x4a9ac5;for(var _0x1b07bf=0x0;_0x1b07bf<_0x4a9ac5[_0x4a6c('0x3a')];_0x1b07bf+=0x1){_0xbad15b[_0x1b07bf][_0x4a6c('0x6b')]=[];_0x403b2e[_0x4a6c('0x6a')](db[_0x4a6c('0x30')][_0x4a6c('0x4b')]({'where':{'FromId':[_0x56e025[_0x4a6c('0x63')]['id'],_0x4a9ac5[_0x1b07bf]['id']],'ToId':[_0x56e025['user']['id'],_0x4a9ac5[_0x1b07bf]['id']],'ChatGroupId':null},'attributes':['id',_0x4a6c('0x6c'),_0x4a6c('0x6d'),_0x4a6c('0x6e'),_0x4a6c('0x6f'),_0x4a6c('0x4d')],'order':qs[_0x4a6c('0x3d')](_0x4a6c('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x4a9ac5[_0x1b07bf])));}return BPromise[_0x4a6c('0x71')](_0x403b2e);}return[];})[_0x4a6c('0x2a')](function(_0x3cfad4){return{'rows':_0x3cfad4,'count':_0x3cfad4[_0x4a6c('0x3a')]};})['then'](respondWithResult(_0x2522c5,null))[_0x4a6c('0x4e')](handleError(_0x2522c5,null));}; \ No newline at end of file +var _0xb82e=['userProfileId','autoAssociation','isEmpty','resourceId','push','messages','FromId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','ChatInternalMessage','includeAll','include','findAll','rows','show','params','find','catch','create','update','body','describe','createdAt','lastMessage','lastMessageAt','format','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents'];(function(_0x4cd86a,_0x2416ea){var _0x4bbff0=function(_0x16b25e){while(--_0x16b25e){_0x4cd86a['push'](_0x4cd86a['shift']());}};_0x4bbff0(++_0x2416ea);}(_0xb82e,0x79));var _0xeb82=function(_0x2ed357,_0x5c7bab){_0x2ed357=_0x2ed357-0x0;var _0x2da7cd=_0xb82e[_0x2ed357];return _0x2da7cd;};'use strict';var emlformat=require(_0xeb82('0x0'));var rimraf=require(_0xeb82('0x1'));var zipdir=require(_0xeb82('0x2'));var jsonpatch=require(_0xeb82('0x3'));var rp=require(_0xeb82('0x4'));var moment=require(_0xeb82('0x5'));var BPromise=require(_0xeb82('0x6'));var Mustache=require(_0xeb82('0x7'));var util=require(_0xeb82('0x8'));var path=require(_0xeb82('0x9'));var sox=require(_0xeb82('0xa'));var csv=require(_0xeb82('0xb'));var ejs=require(_0xeb82('0xc'));var fs=require('fs');var fs_extra=require(_0xeb82('0xd'));var _=require('lodash');var squel=require(_0xeb82('0xe'));var crypto=require(_0xeb82('0xf'));var jsforce=require(_0xeb82('0x10'));var deskjs=require(_0xeb82('0x11'));var toCsv=require(_0xeb82('0xb'));var querystring=require(_0xeb82('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb82('0x13'));var hardwareService=require(_0xeb82('0x14'));var logger=require(_0xeb82('0x15'))('api');var utils=require(_0xeb82('0x16'));var config=require(_0xeb82('0x17'));var licenseUtil=require(_0xeb82('0x18'));var db=require('../../mysqldb')['db'];config[_0xeb82('0x19')]=_[_0xeb82('0x1a')](config[_0xeb82('0x19')],{'host':_0xeb82('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xeb82('0x1c')](socket);function respondWithStatusCode(_0x3dbc93,_0x260406){_0x260406=_0x260406||0xcc;return function(_0x1fad63){if(_0x1fad63){return _0x3dbc93[_0xeb82('0x1d')](_0x260406);}return _0x3dbc93[_0xeb82('0x1e')](_0x260406)[_0xeb82('0x1f')]();};}function respondWithResult(_0x438608,_0x32a0f5){_0x32a0f5=_0x32a0f5||0xc8;return function(_0x287414){if(_0x287414){return _0x438608[_0xeb82('0x1e')](_0x32a0f5)[_0xeb82('0x20')](_0x287414);}};}function respondWithFilteredResult(_0x6593a9,_0x5819f7){return function(_0xb797b2){if(_0xb797b2){var _0x4d2679=typeof _0x5819f7[_0xeb82('0x21')]===_0xeb82('0x22')&&typeof _0x5819f7[_0xeb82('0x23')]===_0xeb82('0x22');var _0x5368ce=_0xb797b2[_0xeb82('0x24')];var _0xf8fbaa=_0x4d2679?0x0:_0x5819f7[_0xeb82('0x21')];var _0x15f6b6=_0x4d2679?_0xb797b2['count']:_0x5819f7[_0xeb82('0x21')]+_0x5819f7[_0xeb82('0x23')];var _0x45eb33;if(_0x15f6b6>=_0x5368ce){_0x15f6b6=_0x5368ce;_0x45eb33=0xc8;}else{_0x45eb33=0xce;}_0x6593a9[_0xeb82('0x1e')](_0x45eb33);return _0x6593a9[_0xeb82('0x25')](_0xeb82('0x26'),_0xf8fbaa+'-'+_0x15f6b6+'/'+_0x5368ce)[_0xeb82('0x20')](_0xb797b2);}return null;};}function patchUpdates(_0x21987b){return function(_0x1eee35){try{jsonpatch[_0xeb82('0x27')](_0x1eee35,_0x21987b,!![]);}catch(_0x1a2d5b){return BPromise[_0xeb82('0x28')](_0x1a2d5b);}return _0x1eee35[_0xeb82('0x29')]();};}function saveUpdates(_0x150584,_0x209d52){return function(_0x132bb1){if(_0x132bb1){return _0x132bb1['update'](_0x150584)[_0xeb82('0x2a')](function(_0x11b062){return _0x11b062;});}return null;};}function removeEntity(_0x3cc6db,_0x347c36){return function(_0x2f101c){if(_0x2f101c){return _0x2f101c['destroy']()[_0xeb82('0x2a')](function(){_0x3cc6db[_0xeb82('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce74b,_0x310e87){return function(_0x5088e0){if(!_0x5088e0){_0x5ce74b[_0xeb82('0x1d')](0x194);}return _0x5088e0;};}function handleError(_0x5eaa82,_0x387907){_0x387907=_0x387907||0x1f4;return function(_0x1bdf54){logger['error'](_0x1bdf54[_0xeb82('0x2b')]);if(_0x1bdf54[_0xeb82('0x2c')]){delete _0x1bdf54[_0xeb82('0x2c')];}_0x5eaa82[_0xeb82('0x1e')](_0x387907)[_0xeb82('0x2d')](_0x1bdf54);};}exports[_0xeb82('0x2e')]=function(_0x997188,_0x2f8316){var _0x49e820={},_0x31f136={},_0x141025={'count':0x0,'rows':[]};var _0x5a9fdd=_['map'](db['ChatInternalMessage'][_0xeb82('0x2f')],function(_0x464a4a){return{'name':_0x464a4a[_0xeb82('0x30')],'type':_0x464a4a[_0xeb82('0x31')][_0xeb82('0x32')]};});_0x31f136['model']=_['map'](_0x5a9fdd,'name');_0x31f136['query']=_[_0xeb82('0x33')](_0x997188[_0xeb82('0x34')]);_0x31f136[_0xeb82('0x35')]=_[_0xeb82('0x36')](_0x31f136[_0xeb82('0x37')],_0x31f136[_0xeb82('0x34')]);_0x49e820['attributes']=_[_0xeb82('0x36')](_0x31f136[_0xeb82('0x37')],qs[_0xeb82('0x38')](_0x997188['query'][_0xeb82('0x38')]));_0x49e820['attributes']=_0x49e820['attributes'][_0xeb82('0x39')]?_0x49e820[_0xeb82('0x3a')]:_0x31f136[_0xeb82('0x37')];if(!_0x997188['query'][_0xeb82('0x3b')]('nolimit')){_0x49e820[_0xeb82('0x23')]=qs['limit'](_0x997188[_0xeb82('0x34')]['limit']);_0x49e820[_0xeb82('0x21')]=qs[_0xeb82('0x21')](_0x997188[_0xeb82('0x34')][_0xeb82('0x21')]);}_0x49e820[_0xeb82('0x3c')]=qs[_0xeb82('0x3d')](_0x997188[_0xeb82('0x34')]['sort']);_0x49e820[_0xeb82('0x3e')]=qs[_0xeb82('0x35')](_[_0xeb82('0x3f')](_0x997188[_0xeb82('0x34')],_0x31f136[_0xeb82('0x35')]),_0x5a9fdd);if(_0x997188[_0xeb82('0x34')]['filter']){_0x49e820['where']=_[_0xeb82('0x40')](_0x49e820[_0xeb82('0x3e')],{'$or':_[_0xeb82('0x41')](_0x5a9fdd,function(_0x5b6de6){if(_0x5b6de6[_0xeb82('0x31')]!==_0xeb82('0x42')){var _0x408688={};_0x408688[_0x5b6de6[_0xeb82('0x2c')]]={'$like':'%'+_0x997188[_0xeb82('0x34')][_0xeb82('0x43')]+'%'};return _0x408688;}})});}_0x49e820=_[_0xeb82('0x40')]({},_0x49e820,_0x997188[_0xeb82('0x44')]);var _0x3682f4={'where':_0x49e820[_0xeb82('0x3e')]};return db[_0xeb82('0x45')][_0xeb82('0x24')](_0x3682f4)['then'](function(_0x5137fd){_0x141025[_0xeb82('0x24')]=_0x5137fd;if(_0x997188[_0xeb82('0x34')][_0xeb82('0x46')]){_0x49e820[_0xeb82('0x47')]=[{'all':!![]}];}return db[_0xeb82('0x45')][_0xeb82('0x48')](_0x49e820);})[_0xeb82('0x2a')](function(_0x37fd7b){_0x141025[_0xeb82('0x49')]=_0x37fd7b;return _0x141025;})['then'](respondWithFilteredResult(_0x2f8316,_0x49e820))['catch'](handleError(_0x2f8316,null));};exports[_0xeb82('0x4a')]=function(_0x2e652b,_0x3c4e99){var _0x314baf={'raw':!![],'where':{'id':_0x2e652b[_0xeb82('0x4b')]['id']}},_0x26128f={};_0x26128f['model']=_[_0xeb82('0x33')](db[_0xeb82('0x45')][_0xeb82('0x2f')]);_0x26128f[_0xeb82('0x34')]=_[_0xeb82('0x33')](_0x2e652b[_0xeb82('0x34')]);_0x26128f[_0xeb82('0x35')]=_['intersection'](_0x26128f['model'],_0x26128f['query']);_0x314baf['attributes']=_[_0xeb82('0x36')](_0x26128f[_0xeb82('0x37')],qs['fields'](_0x2e652b[_0xeb82('0x34')][_0xeb82('0x38')]));_0x314baf['attributes']=_0x314baf[_0xeb82('0x3a')][_0xeb82('0x39')]?_0x314baf[_0xeb82('0x3a')]:_0x26128f[_0xeb82('0x37')];if(_0x2e652b[_0xeb82('0x34')]['includeAll']){_0x314baf['include']=[{'all':!![]}];}_0x314baf=_[_0xeb82('0x40')]({},_0x314baf,_0x2e652b[_0xeb82('0x44')]);return db[_0xeb82('0x45')][_0xeb82('0x4c')](_0x314baf)[_0xeb82('0x2a')](handleEntityNotFound(_0x3c4e99,null))[_0xeb82('0x2a')](respondWithResult(_0x3c4e99,null))[_0xeb82('0x4d')](handleError(_0x3c4e99,null));};exports[_0xeb82('0x4e')]=function(_0x41caf7,_0x552959){return db[_0xeb82('0x45')][_0xeb82('0x4e')](_0x41caf7['body'],{})[_0xeb82('0x2a')](respondWithResult(_0x552959,0xc9))['catch'](handleError(_0x552959,null));};exports[_0xeb82('0x4f')]=function(_0xdd7304,_0x2bbe31){if(_0xdd7304[_0xeb82('0x50')]['id']){delete _0xdd7304[_0xeb82('0x50')]['id'];}return db[_0xeb82('0x45')]['find']({'where':{'id':_0xdd7304[_0xeb82('0x4b')]['id']}})[_0xeb82('0x2a')](handleEntityNotFound(_0x2bbe31,null))['then'](saveUpdates(_0xdd7304[_0xeb82('0x50')],null))[_0xeb82('0x2a')](respondWithResult(_0x2bbe31,null))[_0xeb82('0x4d')](handleError(_0x2bbe31,null));};exports['destroy']=function(_0x4785d5,_0x1dfb60){return db['ChatInternalMessage'][_0xeb82('0x4c')]({'where':{'id':_0x4785d5[_0xeb82('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1dfb60,null))[_0xeb82('0x2a')](removeEntity(_0x1dfb60,null))[_0xeb82('0x4d')](handleError(_0x1dfb60,null));};exports[_0xeb82('0x51')]=function(_0x3c1fcd,_0x2a66c5){return db[_0xeb82('0x45')][_0xeb82('0x51')]()[_0xeb82('0x2a')](respondWithResult(_0x2a66c5,null))[_0xeb82('0x4d')](handleError(_0x2a66c5,null));};function wrapUser(_0x4f6c62){return function(_0x883050){var _0x438406=_0x4f6c62['get']({'plain':!![]});_0x438406['messages']=[];if(_0x883050){_0x438406['lastMessageAt']=_0x883050[_0xeb82('0x52')];_0x438406[_0xeb82('0x53')]=_0x883050;}else{_0x438406[_0xeb82('0x54')]=moment(0x0)[_0xeb82('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x438406[_0xeb82('0x53')]={};}return _0x438406;};}exports['getUsers']=function(_0x227989,_0x21f803,_0x29fe2d){var _0x422b7a=[];return db[_0xeb82('0x56')][_0xeb82('0x48')]({'where':{'role':[_0xeb82('0x57'),'admin',_0xeb82('0x58')]},'attributes':['id',_0xeb82('0x59'),_0xeb82('0x2c'),_0xeb82('0x5a'),_0xeb82('0x5b'),_0xeb82('0x5c'),_0xeb82('0x5d'),_0xeb82('0x5e'),_0xeb82('0x5f'),_0xeb82('0x60')],'order':qs[_0xeb82('0x3d')](_0xeb82('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0xeb82('0x62'),'attributes':['id','name',_0xeb82('0x31')],'through':{'attributes':[]}}]})[_0xeb82('0x2a')](function(_0x334f3a){if(_0x334f3a){var _0x3d9a67=_0x227989[_0xeb82('0x58')][_0xeb82('0x63')]({'plain':!![]});if(!_0x3d9a67)throw new Error(_0xeb82('0x64'));if(_0x3d9a67[_0xeb82('0x5a')]==='user'){return db[_0xeb82('0x65')][_0xeb82('0x4c')]({'where':{'name':_0xeb82('0x66'),'userProfileId':_0x3d9a67[_0xeb82('0x67')]},'raw':!![]})['then'](function(_0x56ac00){if(_0x56ac00){if(_0x56ac00[_0xeb82('0x68')]===0x0){return db['UserProfileResource'][_0xeb82('0x48')]({'where':{'sectionId':_0x56ac00['id']},'raw':!![]})['then'](function(_0xf1d56f){var _0x32edf9=[];if(_[_0xeb82('0x69')](_0xf1d56f)){_0x32edf9=_[_0xeb82('0x43')](_0x334f3a,function(_0x3f37b0){if(_0x3f37b0['role']!==_0xeb82('0x57')){return _0x3f37b0;}});return _0x32edf9;}else{for(var _0x267ab5=0x0;_0x267ab5<_0x334f3a[_0xeb82('0x39')];_0x267ab5++){var _0x2ec708=_0x334f3a[_0x267ab5];if(_0x2ec708[_0xeb82('0x5a')]===_0xeb82('0x57')){var _0xfe38a2=_[_0xeb82('0x4c')](_0xf1d56f,function(_0x443efa){return _0x443efa[_0xeb82('0x6a')]===_0x2ec708['id'];});if(_0xfe38a2)_0x32edf9[_0xeb82('0x6b')](_0x2ec708);}else{_0x32edf9[_0xeb82('0x6b')](_0x2ec708);}}return _0x32edf9;}});}else{return _0x334f3a;}}else{var _0xcdcaad=_['filter'](_0x334f3a,function(_0x13101a){if(_0x13101a['role']!==_0xeb82('0x57')){return _0x13101a;}});return _0xcdcaad;}});}else{return _0x334f3a;}}})[_0xeb82('0x2a')](function(_0x43abf1){var _0x1ecda5=[];if(_0x43abf1){_0x422b7a=_0x43abf1;for(var _0x2bd919=0x0;_0x2bd919<_0x43abf1[_0xeb82('0x39')];_0x2bd919+=0x1){_0x422b7a[_0x2bd919][_0xeb82('0x6c')]=[];_0x1ecda5[_0xeb82('0x6b')](db[_0xeb82('0x45')][_0xeb82('0x4c')]({'where':{'FromId':[_0x227989[_0xeb82('0x58')]['id'],_0x43abf1[_0x2bd919]['id']],'ToId':[_0x227989[_0xeb82('0x58')]['id'],_0x43abf1[_0x2bd919]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xeb82('0x6d'),'ToId',_0xeb82('0x6e'),_0xeb82('0x50')],'order':qs['sort'](_0xeb82('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xeb82('0x2a')](wrapUser(_0x43abf1[_0x2bd919])));}return BPromise['all'](_0x1ecda5);}return[];})['then'](function(_0x4d1d57){return{'rows':_0x4d1d57,'count':_0x4d1d57['length']};})[_0xeb82('0x2a')](respondWithResult(_0x21f803,null))[_0xeb82('0x4d')](handleError(_0x21f803,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 69671ff..78b55da 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 _0x171b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove'];(function(_0x134bfc,_0x144d5f){var _0x2f4dcc=function(_0x56cf22){while(--_0x56cf22){_0x134bfc['push'](_0x134bfc['shift']());}};_0x2f4dcc(++_0x144d5f);}(_0x171b,0x112));var _0xb171=function(_0x4259c1,_0x2757e8){_0x4259c1=_0x4259c1-0x0;var _0x1e95df=_0x171b[_0x4259c1];return _0x1e95df;};'use strict';var EventEmitter=require(_0xb171('0x0'));var ChatInternalMessage=require(_0xb171('0x1'))['db'][_0xb171('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb171('0x3'),'afterUpdate':_0xb171('0x4'),'afterDestroy':_0xb171('0x5')};function emitEvent(_0x129a52){return function(_0x38b87a,_0x2fa374,_0x1f56ea){ChatInternalMessageEvents[_0xb171('0x6')](_0x129a52+':'+_0x38b87a['id'],_0x38b87a);ChatInternalMessageEvents[_0xb171('0x6')](_0x129a52,_0x38b87a);_0x1f56ea(null);};}for(var e in events){if(events[_0xb171('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb171('0x8')](e,emitEvent(event));}}module[_0xb171('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x1698=['hook','exports','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x1e3c87,_0x368df7){var _0x17beb5=function(_0x5b9af1){while(--_0x5b9af1){_0x1e3c87['push'](_0x1e3c87['shift']());}};_0x17beb5(++_0x368df7);}(_0x1698,0x1c4));var _0x8169=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x1698[_0x616290];return _0x453879;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8169('0x0')](0x0);var events={'afterCreate':_0x8169('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x401fa4){return function(_0x1a6bcc,_0x4aed65,_0xd26922){ChatInternalMessageEvents['emit'](_0x401fa4+':'+_0x1a6bcc['id'],_0x1a6bcc);ChatInternalMessageEvents[_0x8169('0x2')](_0x401fa4,_0x1a6bcc);_0xd26922(null);};}for(var e in events){if(events[_0x8169('0x3')](e)){var event=events[e];ChatInternalMessage[_0x8169('0x4')](e,emitEvent(event));}}module[_0x8169('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 68c288c..ea3a803 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 _0x942b=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatInternalMessage.attributes','exports'];(function(_0x578c18,_0x1de4d8){var _0x18604c=function(_0x4e8c2b){while(--_0x4e8c2b){_0x578c18['push'](_0x578c18['shift']());}};_0x18604c(++_0x1de4d8);}(_0x942b,0x107));var _0xb942=function(_0x555fdf,_0x41db9e){_0x555fdf=_0x555fdf-0x0;var _0x3b6e3a=_0x942b[_0x555fdf];return _0x3b6e3a;};'use strict';var _=require(_0xb942('0x0'));var util=require(_0xb942('0x1'));var logger=require(_0xb942('0x2'))(_0xb942('0x3'));var moment=require(_0xb942('0x4'));var BPromise=require(_0xb942('0x5'));var rp=require(_0xb942('0x6'));var fs=require('fs');var path=require(_0xb942('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb942('0x8'));module[_0xb942('0x9')]=function(_0x2c65a7,_0x4657a3){return _0x2c65a7['define']('ChatInternalMessage',attributes,{'tableName':_0xb942('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb942('0xb'),'collate':_0xb942('0xc')});}; \ No newline at end of file +var _0xc99e=['lodash','../../config/logger','moment','request-promise','path','rimraf','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3c3a03,_0x3c0da1){var _0x57ff53=function(_0xd08f4a){while(--_0xd08f4a){_0x3c3a03['push'](_0x3c3a03['shift']());}};_0x57ff53(++_0x3c0da1);}(_0xc99e,0x113));var _0xec99=function(_0x2c086d,_0x3928ad){_0x2c086d=_0x2c086d-0x0;var _0x3ba1ff=_0xc99e[_0x2c086d];return _0x3ba1ff;};'use strict';var _=require(_0xec99('0x0'));var util=require('util');var logger=require(_0xec99('0x1'))('api');var moment=require(_0xec99('0x2'));var BPromise=require('bluebird');var rp=require(_0xec99('0x3'));var fs=require('fs');var path=require(_0xec99('0x4'));var rimraf=require(_0xec99('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xec99('0x6')]=function(_0x50beef,_0x340753){return _0x50beef[_0xec99('0x7')]('ChatInternalMessage',attributes,{'tableName':_0xec99('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec99('0x9'),'collate':_0xec99('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2067216..97abbdc 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 _0xfff6=['redis','defaults','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34956e,_0xbcaeef){var _0x156cce=function(_0x16f093){while(--_0x16f093){_0x34956e['push'](_0x34956e['shift']());}};_0x156cce(++_0xbcaeef);}(_0xfff6,0x97));var _0x6fff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfff6[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6fff('0x0'));var BPromise=require(_0x6fff('0x1'));var rs=require(_0x6fff('0x2'));var fs=require('fs');var Redis=require(_0x6fff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fff('0x4'));var logger=require(_0x6fff('0x5'))(_0x6fff('0x6'));var config=require(_0x6fff('0x7'));var jayson=require(_0x6fff('0x8'));var client=jayson[_0x6fff('0x9')][_0x6fff('0xa')]({'port':0x232a});config[_0x6fff('0xb')]=_[_0x6fff('0xc')](config[_0x6fff('0xb')],{'host':_0x6fff('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6fff('0xb')]));require(_0x6fff('0xe'))[_0x6fff('0xf')](socket);function respondWithRpcPromise(_0x23d292,_0x11c2c3,_0x51c560){return new BPromise(function(_0x4b5a40,_0x5ced83){return client['request'](_0x23d292,_0x51c560)[_0x6fff('0x10')](function(_0x4c4d6e){logger[_0x6fff('0x11')](_0x6fff('0x12'),_0x11c2c3,_0x6fff('0x13'));logger[_0x6fff('0x14')](_0x6fff('0x15'),_0x11c2c3,_0x6fff('0x13'),JSON[_0x6fff('0x16')](_0x4c4d6e));if(_0x4c4d6e[_0x6fff('0x17')]){if(_0x4c4d6e[_0x6fff('0x17')][_0x6fff('0x18')]===0x1f4){logger[_0x6fff('0x17')](_0x6fff('0x12'),_0x11c2c3,_0x4c4d6e[_0x6fff('0x17')][_0x6fff('0x19')]);return _0x5ced83(_0x4c4d6e[_0x6fff('0x17')][_0x6fff('0x19')]);}logger[_0x6fff('0x17')](_0x6fff('0x12'),_0x11c2c3,_0x4c4d6e[_0x6fff('0x17')]['message']);return _0x4b5a40(_0x4c4d6e[_0x6fff('0x17')]['message']);}else{logger[_0x6fff('0x11')](_0x6fff('0x12'),_0x11c2c3,'request\x20sent');_0x4b5a40(_0x4c4d6e[_0x6fff('0x1a')][_0x6fff('0x19')]);}})['catch'](function(_0xb2195){logger[_0x6fff('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x11c2c3,_0xb2195);_0x5ced83(_0xb2195);});});} \ No newline at end of file +var _0x64fa=['result','catch','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','request\x20sent'];(function(_0x228acb,_0x3d4196){var _0x294939=function(_0x2673fc){while(--_0x2673fc){_0x228acb['push'](_0x228acb['shift']());}};_0x294939(++_0x3d4196);}(_0x64fa,0xbf));var _0xa64f=function(_0xb5bced,_0x22a520){_0xb5bced=_0xb5bced-0x0;var _0x13adc2=_0x64fa[_0xb5bced];return _0x13adc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa64f('0x0'));var rs=require(_0xa64f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa64f('0x2'));var logger=require(_0xa64f('0x3'))(_0xa64f('0x4'));var config=require(_0xa64f('0x5'));var jayson=require(_0xa64f('0x6'));var client=jayson[_0xa64f('0x7')][_0xa64f('0x8')]({'port':0x232a});config[_0xa64f('0x9')]=_[_0xa64f('0xa')](config[_0xa64f('0x9')],{'host':_0xa64f('0xb'),'port':0x18eb});var socket=require(_0xa64f('0xc'))(new Redis(config[_0xa64f('0x9')]));require(_0xa64f('0xd'))[_0xa64f('0xe')](socket);function respondWithRpcPromise(_0xff5771,_0x73b433,_0x25ff23){return new BPromise(function(_0x541ae7,_0x1c9542){return client[_0xa64f('0xf')](_0xff5771,_0x25ff23)[_0xa64f('0x10')](function(_0x51d8b5){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x73b433,'request\x20sent');logger[_0xa64f('0x11')](_0xa64f('0x12'),_0x73b433,'request\x20sent',JSON[_0xa64f('0x13')](_0x51d8b5));if(_0x51d8b5[_0xa64f('0x14')]){if(_0x51d8b5[_0xa64f('0x14')][_0xa64f('0x15')]===0x1f4){logger[_0xa64f('0x14')](_0xa64f('0x16'),_0x73b433,_0x51d8b5[_0xa64f('0x14')][_0xa64f('0x17')]);return _0x1c9542(_0x51d8b5[_0xa64f('0x14')][_0xa64f('0x17')]);}logger[_0xa64f('0x14')](_0xa64f('0x16'),_0x73b433,_0x51d8b5[_0xa64f('0x14')][_0xa64f('0x17')]);return _0x541ae7(_0x51d8b5[_0xa64f('0x14')][_0xa64f('0x17')]);}else{logger['info'](_0xa64f('0x16'),_0x73b433,_0xa64f('0x18'));_0x541ae7(_0x51d8b5[_0xa64f('0x19')][_0xa64f('0x17')]);}})[_0xa64f('0x1a')](function(_0x2a6a9c){logger['error'](_0xa64f('0x16'),_0x73b433,_0x2a6a9c);_0x1c9542(_0x2a6a9c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 957a99c..e4e813b 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 _0xf3d6=['length','chatInternalMessage:','remove','update','emit','removeListener','register'];(function(_0x524653,_0x5ba03d){var _0x16d192=function(_0x2ff2dd){while(--_0x2ff2dd){_0x524653['push'](_0x524653['shift']());}};_0x16d192(++_0x5ba03d);}(_0xf3d6,0xdb));var _0x6f3d=function(_0x5837b1,_0x54229a){_0x5837b1=_0x5837b1-0x0;var _0x490d8b=_0xf3d6[_0x5837b1];return _0x490d8b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x6f3d('0x0'),_0x6f3d('0x1')];function createListener(_0x113f40,_0x508e9f){return function(_0x4285a0){_0x508e9f[_0x6f3d('0x2')](_0x113f40,_0x4285a0);};}function removeListener(_0x55adf3,_0x16e151){return function(){ChatInternalMessageEvents[_0x6f3d('0x3')](_0x55adf3,_0x16e151);};}exports[_0x6f3d('0x4')]=function(_0x23d88a){for(var _0x1f31d7=0x0,_0x426c8f=events[_0x6f3d('0x5')];_0x1f31d7<_0x426c8f;_0x1f31d7++){var _0x238395=events[_0x1f31d7];var _0x496fb1=createListener(_0x6f3d('0x6')+_0x238395,_0x23d88a);ChatInternalMessageEvents['on'](_0x238395,_0x496fb1);}}; \ No newline at end of file +var _0x0779=['./chatInternalMessage.events','save','update','emit','removeListener','register','length'];(function(_0x13b8b1,_0x42882a){var _0x467f68=function(_0x1948e0){while(--_0x1948e0){_0x13b8b1['push'](_0x13b8b1['shift']());}};_0x467f68(++_0x42882a);}(_0x0779,0x126));var _0x9077=function(_0xd563ee,_0x2be32c){_0xd563ee=_0xd563ee-0x0;var _0x1ba94d=_0x0779[_0xd563ee];return _0x1ba94d;};'use strict';var ChatInternalMessageEvents=require(_0x9077('0x0'));var events=[_0x9077('0x1'),'remove',_0x9077('0x2')];function createListener(_0x49227e,_0x4ad4d8){return function(_0x5c1ce7){_0x4ad4d8[_0x9077('0x3')](_0x49227e,_0x5c1ce7);};}function removeListener(_0x4c0c86,_0x53de89){return function(){ChatInternalMessageEvents[_0x9077('0x4')](_0x4c0c86,_0x53de89);};}exports[_0x9077('0x5')]=function(_0x4c1ab3){for(var _0x49cb4f=0x0,_0x720665=events[_0x9077('0x6')];_0x49cb4f<_0x720665;_0x49cb4f++){var _0x48ad1d=events[_0x49cb4f];var _0x31627e=createListener('chatInternalMessage:'+_0x48ad1d,_0x4c1ab3);ChatInternalMessageEvents['on'](_0x48ad1d,_0x31627e);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 05ea022..487d074 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 _0x6825=['update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','isAuthenticated','/describe','get','/users','getUsers','post','create','put','/:id'];(function(_0x3af40d,_0x5f38f6){var _0x363acb=function(_0x2ed0f8){while(--_0x2ed0f8){_0x3af40d['push'](_0x3af40d['shift']());}};_0x363acb(++_0x5f38f6);}(_0x6825,0x70));var _0x5682=function(_0x299492,_0x34c8e2){_0x299492=_0x299492-0x0;var _0x3cf0c9=_0x6825[_0x299492];return _0x3cf0c9;};'use strict';var multer=require('multer');var util=require(_0x5682('0x0'));var path=require('path');var timeout=require(_0x5682('0x1'));var express=require(_0x5682('0x2'));var router=express['Router']();var fs_extra=require(_0x5682('0x3'));var auth=require(_0x5682('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x5682('0x5')](),controller['index']);router['get'](_0x5682('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x5682('0x7')](_0x5682('0x8'),auth[_0x5682('0x5')](),controller[_0x5682('0x9')]);router[_0x5682('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5682('0xa')]('/',auth[_0x5682('0x5')](),controller[_0x5682('0xb')]);router[_0x5682('0xc')](_0x5682('0xd'),controller[_0x5682('0xe')]);router[_0x5682('0xf')](_0x5682('0xd'),auth[_0x5682('0x5')](),controller[_0x5682('0x10')]);module[_0x5682('0x11')]=router; \ No newline at end of file +var _0xf874=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','describe','/users','isAuthenticated','getUsers','show','post','create','put','/:id','update','delete'];(function(_0x57d96a,_0x5f2495){var _0x1e9d93=function(_0xe2376d){while(--_0xe2376d){_0x57d96a['push'](_0x57d96a['shift']());}};_0x1e9d93(++_0x5f2495);}(_0xf874,0x177));var _0x4f87=function(_0x3f650e,_0x151fec){_0x3f650e=_0x3f650e-0x0;var _0x294c88=_0xf874[_0x3f650e];return _0x294c88;};'use strict';var multer=require(_0x4f87('0x0'));var util=require('util');var path=require(_0x4f87('0x1'));var timeout=require(_0x4f87('0x2'));var express=require(_0x4f87('0x3'));var router=express[_0x4f87('0x4')]();var fs_extra=require(_0x4f87('0x5'));var auth=require(_0x4f87('0x6'));var interaction=require(_0x4f87('0x7'));var config=require('../../config/environment');var controller=require(_0x4f87('0x8'));router[_0x4f87('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4f87('0xa')]);router['get'](_0x4f87('0xb'),auth[_0x4f87('0xc')](),controller[_0x4f87('0xd')]);router[_0x4f87('0x9')]('/:id',auth[_0x4f87('0xc')](),controller[_0x4f87('0xe')]);router[_0x4f87('0xf')]('/',auth[_0x4f87('0xc')](),controller[_0x4f87('0x10')]);router[_0x4f87('0x11')](_0x4f87('0x12'),controller[_0x4f87('0x13')]);router[_0x4f87('0x14')](_0x4f87('0x12'),auth[_0x4f87('0xc')](),controller['destroy']);module[_0x4f87('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 4abb05a..0fc7469 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 _0x65c9=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0x498834,_0x57c709){var _0x2fc7ef=function(_0x393556){while(--_0x393556){_0x498834['push'](_0x498834['shift']());}};_0x2fc7ef(++_0x57c709);}(_0x65c9,0x182));var _0x965c=function(_0x35f2c0,_0x6184a4){_0x35f2c0=_0x35f2c0-0x0;var _0x3d41c9=_0x65c9[_0x35f2c0];return _0x3d41c9;};'use strict';var Sequelize=require(_0x965c('0x0'));module[_0x965c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x965c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x965c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x965c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x965c('0x4')]('in',_0x965c('0x5')),'defaultValue':_0x965c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x965c('0x6')]},'providerName':{'type':Sequelize[_0x965c('0x7')]},'providerResponse':{'type':Sequelize[_0x965c('0x8')]}}; \ No newline at end of file +var _0xe9e8=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x2064b0,_0x232d42){var _0x4ac160=function(_0x2540fa){while(--_0x2540fa){_0x2064b0['push'](_0x2064b0['shift']());}};_0x4ac160(++_0x232d42);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x129bd2,_0xda7c6){_0x129bd2=_0x129bd2-0x0;var _0x31c204=_0xe9e8[_0x129bd2];return _0x31c204;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'body':{'type':Sequelize[_0x8e9e('0x2')](_0x8e9e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8e9e('0x5')]('in','out'),'defaultValue':_0x8e9e('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8e9e('0x7')]},'providerName':{'type':Sequelize[_0x8e9e('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8710ed8..d876af9 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 _0x2e32=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','end','stack','send','map','ChatMessage','fieldName','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','name','includeAll','include','findAll','rows','catch','params','rawAttributes','length','merge','options','find','create','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','update','isNil','read1stAt','get','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','EventManager','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','channel','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','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','client','request','then'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x2e32,0x1f0));var _0x22e3=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x2e32[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x22e3('0x0'));var rimraf=require(_0x22e3('0x1'));var zipdir=require(_0x22e3('0x2'));var jsonpatch=require(_0x22e3('0x3'));var rp=require(_0x22e3('0x4'));var moment=require(_0x22e3('0x5'));var BPromise=require(_0x22e3('0x6'));var Mustache=require(_0x22e3('0x7'));var util=require('util');var path=require(_0x22e3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x22e3('0x9'));var fs=require('fs');var fs_extra=require(_0x22e3('0xa'));var _=require('lodash');var squel=require(_0x22e3('0xb'));var crypto=require(_0x22e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x22e3('0xd'));var toCsv=require(_0x22e3('0xe'));var querystring=require(_0x22e3('0xf'));var Papa=require('papaparse');var Redis=require(_0x22e3('0x10'));var authService=require(_0x22e3('0x11'));var qs=require(_0x22e3('0x12'));var as=require(_0x22e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22e3('0x14'))(_0x22e3('0x15'));var utils=require(_0x22e3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x22e3('0x17'));var db=require(_0x22e3('0x18'))['db'];config[_0x22e3('0x19')]=_[_0x22e3('0x1a')](config[_0x22e3('0x19')],{'host':_0x22e3('0x1b'),'port':0x18eb});var socket=require(_0x22e3('0x1c'))(new Redis(config[_0x22e3('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x22e3('0x1d')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b3786,_0x47e487,_0x289880,_0x14c134){return new BPromise(function(_0x1f4ec5,_0x3e9d33){var _0x48f3bf=_0x14c134||client;return _0x48f3bf[_0x22e3('0x1e')](_0x3b3786,_0x289880)[_0x22e3('0x1f')](function(_0x17b5e3){logger['info'](_0x22e3('0x20'),_0x47e487,_0x22e3('0x21'));logger[_0x22e3('0x22')](_0x22e3('0x23'),_0x47e487,'request\x20sent',JSON[_0x22e3('0x24')](_0x17b5e3));if(_0x17b5e3[_0x22e3('0x25')]){if(_0x17b5e3[_0x22e3('0x25')][_0x22e3('0x26')]===0x1f4){logger[_0x22e3('0x25')](_0x22e3('0x20'),_0x47e487,_0x17b5e3['error'][_0x22e3('0x27')]);return _0x3e9d33(_0x17b5e3[_0x22e3('0x25')][_0x22e3('0x27')]);}logger[_0x22e3('0x25')](_0x22e3('0x20'),_0x47e487,_0x17b5e3['error'][_0x22e3('0x27')]);return _0x1f4ec5(_0x17b5e3[_0x22e3('0x25')]['message']);}else{logger[_0x22e3('0x28')](_0x22e3('0x20'),_0x47e487,_0x22e3('0x21'));_0x1f4ec5(_0x17b5e3['result'][_0x22e3('0x27')]);}})['catch'](function(_0x23889f){logger[_0x22e3('0x25')](_0x22e3('0x20'),_0x47e487,_0x23889f);_0x3e9d33(_0x23889f);});});}function respondWithStatusCode(_0x13e267,_0x52f049){_0x52f049=_0x52f049||0xcc;return function(_0xbd0ee1){if(_0xbd0ee1){return _0x13e267[_0x22e3('0x29')](_0x52f049);}return _0x13e267[_0x22e3('0x2a')](_0x52f049)['end']();};}function respondWithResult(_0x168582,_0x55e42f){_0x55e42f=_0x55e42f||0xc8;return function(_0x5a8224){if(_0x5a8224){return _0x168582['status'](_0x55e42f)[_0x22e3('0x2b')](_0x5a8224);}};}function respondWithFilteredResult(_0x180229,_0x381973){return function(_0x2b9a79){if(_0x2b9a79){var _0x19f164=typeof _0x381973[_0x22e3('0x2c')]===_0x22e3('0x2d')&&typeof _0x381973[_0x22e3('0x2e')]==='undefined';var _0x22b523=_0x2b9a79[_0x22e3('0x2f')];var _0x258cc4=_0x19f164?0x0:_0x381973['offset'];var _0x10cccc=_0x19f164?_0x2b9a79[_0x22e3('0x2f')]:_0x381973[_0x22e3('0x2c')]+_0x381973[_0x22e3('0x2e')];var _0x407fee;if(_0x10cccc>=_0x22b523){_0x10cccc=_0x22b523;_0x407fee=0xc8;}else{_0x407fee=0xce;}_0x180229['status'](_0x407fee);return _0x180229[_0x22e3('0x30')]('Content-Range',_0x258cc4+'-'+_0x10cccc+'/'+_0x22b523)[_0x22e3('0x2b')](_0x2b9a79);}return null;};}function patchUpdates(_0x2227ca){return function(_0x32ee8f){try{jsonpatch[_0x22e3('0x31')](_0x32ee8f,_0x2227ca,!![]);}catch(_0x287a77){return BPromise[_0x22e3('0x32')](_0x287a77);}return _0x32ee8f[_0x22e3('0x33')]();};}function saveUpdates(_0x11b5ca,_0x4765b1){return function(_0x514478){if(_0x514478){return _0x514478['update'](_0x11b5ca)[_0x22e3('0x1f')](function(_0x1a7404){return _0x1a7404;});}return null;};}function removeEntity(_0x256a55,_0x3d15fc){return function(_0x277c01){if(_0x277c01){return _0x277c01[_0x22e3('0x34')]()[_0x22e3('0x1f')](function(){_0x256a55[_0x22e3('0x2a')](0xcc)[_0x22e3('0x35')]();});}};}function handleEntityNotFound(_0x5eecb3,_0xc628fc){return function(_0x2f42b1){if(!_0x2f42b1){_0x5eecb3['sendStatus'](0x194);}return _0x2f42b1;};}function handleError(_0x2b497d,_0x43cdf2){_0x43cdf2=_0x43cdf2||0x1f4;return function(_0x589d60){logger[_0x22e3('0x25')](_0x589d60[_0x22e3('0x36')]);if(_0x589d60['name']){delete _0x589d60['name'];}_0x2b497d[_0x22e3('0x2a')](_0x43cdf2)[_0x22e3('0x37')](_0x589d60);};}exports['index']=function(_0x543e91,_0x4b628f){var _0x13914c={},_0x9dbcf={},_0x3c5bf8={'count':0x0,'rows':[]};var _0x210567=_[_0x22e3('0x38')](db[_0x22e3('0x39')]['rawAttributes'],function(_0x3d7fb7){return{'name':_0x3d7fb7[_0x22e3('0x3a')],'type':_0x3d7fb7['type'][_0x22e3('0x3b')]};});_0x9dbcf[_0x22e3('0x3c')]=_[_0x22e3('0x38')](_0x210567,'name');_0x9dbcf['query']=_[_0x22e3('0x3d')](_0x543e91['query']);_0x9dbcf[_0x22e3('0x3e')]=_['intersection'](_0x9dbcf['model'],_0x9dbcf[_0x22e3('0x3f')]);_0x13914c[_0x22e3('0x40')]=_[_0x22e3('0x41')](_0x9dbcf['model'],qs[_0x22e3('0x42')](_0x543e91['query'][_0x22e3('0x42')]));_0x13914c[_0x22e3('0x40')]=_0x13914c[_0x22e3('0x40')]['length']?_0x13914c['attributes']:_0x9dbcf[_0x22e3('0x3c')];if(!_0x543e91[_0x22e3('0x3f')][_0x22e3('0x43')]('nolimit')){_0x13914c[_0x22e3('0x2e')]=qs[_0x22e3('0x2e')](_0x543e91['query']['limit']);_0x13914c['offset']=qs[_0x22e3('0x2c')](_0x543e91[_0x22e3('0x3f')][_0x22e3('0x2c')]);}_0x13914c[_0x22e3('0x44')]=qs[_0x22e3('0x45')](_0x543e91['query']['sort']);_0x13914c[_0x22e3('0x46')]=qs['filters'](_[_0x22e3('0x47')](_0x543e91[_0x22e3('0x3f')],_0x9dbcf['filters']),_0x210567);if(_0x543e91[_0x22e3('0x3f')][_0x22e3('0x48')]){_0x13914c[_0x22e3('0x46')]=_['merge'](_0x13914c[_0x22e3('0x46')],{'$or':_[_0x22e3('0x38')](_0x210567,function(_0x4ae392){if(_0x4ae392[_0x22e3('0x49')]!==_0x22e3('0x4a')){var _0x292ad5={};_0x292ad5[_0x4ae392[_0x22e3('0x4b')]]={'$like':'%'+_0x543e91[_0x22e3('0x3f')][_0x22e3('0x48')]+'%'};return _0x292ad5;}})});}_0x13914c=_['merge']({},_0x13914c,_0x543e91['options']);var _0x556817={'where':_0x13914c[_0x22e3('0x46')]};return db[_0x22e3('0x39')]['count'](_0x556817)[_0x22e3('0x1f')](function(_0x3ad2dd){_0x3c5bf8[_0x22e3('0x2f')]=_0x3ad2dd;if(_0x543e91[_0x22e3('0x3f')][_0x22e3('0x4c')]){_0x13914c[_0x22e3('0x4d')]=[{'all':!![]}];}return db[_0x22e3('0x39')][_0x22e3('0x4e')](_0x13914c);})[_0x22e3('0x1f')](function(_0x5f3ca3){_0x3c5bf8[_0x22e3('0x4f')]=_0x5f3ca3;return _0x3c5bf8;})[_0x22e3('0x1f')](respondWithFilteredResult(_0x4b628f,_0x13914c))[_0x22e3('0x50')](handleError(_0x4b628f,null));};exports['show']=function(_0x47e7fc,_0xf0c8cd){var _0x1a9bb9={'raw':!![],'where':{'id':_0x47e7fc[_0x22e3('0x51')]['id']}},_0x273eba={};_0x273eba['model']=_[_0x22e3('0x3d')](db[_0x22e3('0x39')][_0x22e3('0x52')]);_0x273eba[_0x22e3('0x3f')]=_[_0x22e3('0x3d')](_0x47e7fc[_0x22e3('0x3f')]);_0x273eba[_0x22e3('0x3e')]=_[_0x22e3('0x41')](_0x273eba['model'],_0x273eba[_0x22e3('0x3f')]);_0x1a9bb9[_0x22e3('0x40')]=_[_0x22e3('0x41')](_0x273eba[_0x22e3('0x3c')],qs[_0x22e3('0x42')](_0x47e7fc[_0x22e3('0x3f')][_0x22e3('0x42')]));_0x1a9bb9[_0x22e3('0x40')]=_0x1a9bb9[_0x22e3('0x40')][_0x22e3('0x53')]?_0x1a9bb9['attributes']:_0x273eba['model'];if(_0x47e7fc['query'][_0x22e3('0x4c')]){_0x1a9bb9[_0x22e3('0x4d')]=[{'all':!![]}];}_0x1a9bb9=_[_0x22e3('0x54')]({},_0x1a9bb9,_0x47e7fc[_0x22e3('0x55')]);return db[_0x22e3('0x39')][_0x22e3('0x56')](_0x1a9bb9)[_0x22e3('0x1f')](handleEntityNotFound(_0xf0c8cd,null))[_0x22e3('0x1f')](respondWithResult(_0xf0c8cd,null))[_0x22e3('0x50')](handleError(_0xf0c8cd,null));};exports[_0x22e3('0x57')]=function(_0x85c5ac,_0x11de06){return db[_0x22e3('0x39')][_0x22e3('0x57')](_0x85c5ac[_0x22e3('0x58')],{})[_0x22e3('0x1f')](respondWithResult(_0x11de06,0xc9))[_0x22e3('0x50')](handleError(_0x11de06,null));};exports['update']=function(_0x448c2c,_0x1673dd){if(_0x448c2c[_0x22e3('0x58')]['id']){delete _0x448c2c[_0x22e3('0x58')]['id'];}return db[_0x22e3('0x39')][_0x22e3('0x56')]({'where':{'id':_0x448c2c[_0x22e3('0x51')]['id']}})[_0x22e3('0x1f')](handleEntityNotFound(_0x1673dd,null))['then'](saveUpdates(_0x448c2c[_0x22e3('0x58')],null))['then'](respondWithResult(_0x1673dd,null))[_0x22e3('0x50')](handleError(_0x1673dd,null));};exports[_0x22e3('0x34')]=function(_0x112ae0,_0x3366df){return db[_0x22e3('0x39')][_0x22e3('0x56')]({'where':{'id':_0x112ae0[_0x22e3('0x51')]['id']}})['then'](handleEntityNotFound(_0x3366df,null))[_0x22e3('0x1f')](removeEntity(_0x3366df,null))['catch'](handleError(_0x3366df,null));};exports['describe']=function(_0x4796da,_0x3bc16c){return db[_0x22e3('0x39')][_0x22e3('0x59')]()[_0x22e3('0x1f')](respondWithResult(_0x3bc16c,null))[_0x22e3('0x50')](handleError(_0x3bc16c,null));};var interaction_log=require(_0x22e3('0x14'))(_0x22e3('0x5a'));exports[_0x22e3('0x5b')]=function(_0x59a753,_0x38a94f,_0x3cf128){var _0x40746d={'agent':{},'channel':_0x22e3('0x5c')};if(_0x59a753[_0x22e3('0x58')]['id']){delete _0x59a753[_0x22e3('0x58')]['id'];}_0x59a753[_0x22e3('0x58')][_0x22e3('0x5d')]=!![];_0x59a753[_0x22e3('0x58')]['readAt']=moment()[_0x22e3('0x5e')](_0x22e3('0x5f'));_0x59a753['body'][_0x22e3('0x60')]=_0x59a753['body'][_0x22e3('0x60')]||_0x59a753[_0x22e3('0x61')]['id'];_0x40746d['agent']['id']=_0x59a753[_0x22e3('0x58')][_0x22e3('0x60')];return db['ChatMessage'][_0x22e3('0x56')]({'where':{'id':_0x59a753[_0x22e3('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38a94f,null))[_0x22e3('0x1f')](saveUpdates(_0x59a753[_0x22e3('0x58')],null))[_0x22e3('0x1f')](function(_0x28487a){if(_0x28487a){_0x40746d[_0x22e3('0x27')]=_0x28487a['get']({'plain':!![]});return db[_0x22e3('0x62')][_0x22e3('0x56')]({'where':{'id':_0x28487a['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x38a94f,null))[_0x22e3('0x1f')](function(_0x559154){if(_0x559154){return _0x559154[_0x22e3('0x63')]({'UserId':_0x59a753['body']['UserId'],'read1stAt':_[_0x22e3('0x64')](_0x559154[_0x22e3('0x65')])?moment()[_0x22e3('0x5e')](_0x22e3('0x5f')):undefined});}return null;})['then'](function(_0x5a9fef){if(_0x5a9fef){_0x40746d['interaction']=_0x5a9fef[_0x22e3('0x66')]({'plain':!![]});interaction_log[_0x22e3('0x28')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59a753[_0x22e3('0x61')]['id'],_0x59a753['user'][_0x22e3('0x4b')],_0x59a753[_0x22e3('0x61')][_0x22e3('0x67')],_0x40746d[_0x22e3('0x68')]['id'],_0x59a753['body']?JSON[_0x22e3('0x24')](_0x59a753[_0x22e3('0x58')]):_0x22e3('0x69'));return respondWithRpcPromise(_0x22e3('0x6a'),_0x22e3('0x6b'),_0x40746d);}return null;})[_0x22e3('0x1f')](function(_0x2476bd){var _0x58b5e1=_0x22e3('0x6c')+_0x2476bd[_0x22e3('0x27')][_0x22e3('0x6d')];return db[_0x22e3('0x6e')][_0x22e3('0x3f')](_0x58b5e1,{'type':db[_0x22e3('0x6f')][_0x22e3('0x70')][_0x22e3('0x71')],'raw':!![]})[_0x22e3('0x1f')](function(_0x30f681){return _0x30f681;});})['then'](function(_0x594da3){if(_0x594da3){_0x40746d[_0x22e3('0x27')]['contact']=_0x594da3[0x0];if(!_0x59a753['body'][_0x22e3('0x60')])return;return db[_0x22e3('0x72')][_0x22e3('0x56')]({'where':{'id':_0x59a753[_0x22e3('0x58')][_0x22e3('0x60')],'role':_0x22e3('0x73')},'attributes':['id',_0x22e3('0x4b'),_0x22e3('0x74'),_0x22e3('0x75'),_0x22e3('0x76')],'raw':!![]});}return null;})[_0x22e3('0x1f')](function(_0x5deb5d){if(!_0x5deb5d)return null;_0x40746d['message'][_0x22e3('0x73')]=_0x5deb5d;return _0x40746d;})[_0x22e3('0x1f')](function(_0x426dab){if(_0x426dab){if(_0x59a753[_0x22e3('0x58')][_0x22e3('0x77')]){_0x40746d[_0x22e3('0x27')][_0x22e3('0x78')]=util[_0x22e3('0x5e')](_0x22e3('0x79'),_0x59a753[_0x22e3('0x61')][_0x22e3('0x4b')]);_0x40746d[_0x22e3('0x27')]['channel']=_0x40746d['channel'];_0x40746d['message']['motionChannel']=_0x40746d['channel'];_0x40746d[_0x22e3('0x27')]['event']=_0x22e3('0x5b');return respondWithRpcPromise(_0x22e3('0x7a'),'EventManager',{'event':'acceptmessage','message':_['merge'](_0x40746d['message'],JSON[_0x22e3('0x7b')](_0x40746d[_0x22e3('0x68')][_0x22e3('0x7c')]))},client9002)[_0x22e3('0x1f')](function(){return _0x40746d;});}return _0x40746d;}return null;})[_0x22e3('0x1f')](respondWithResult(_0x38a94f,null))[_0x22e3('0x50')](handleError(_0x38a94f,null));};var interaction_log=require('../../config/logger')(_0x22e3('0x5a'));exports[_0x22e3('0x32')]=function(_0x5cf2c7,_0x4bbb8d,_0x40ac80){var _0x3aa9c2={'agent':{},'channel':'chat'};if(_0x5cf2c7['body']['id']){delete _0x5cf2c7[_0x22e3('0x58')]['id'];}_0x5cf2c7[_0x22e3('0x58')][_0x22e3('0x60')]=_0x5cf2c7[_0x22e3('0x58')][_0x22e3('0x60')]||_0x5cf2c7[_0x22e3('0x61')]['id'];_0x3aa9c2[_0x22e3('0x73')]['id']=_0x5cf2c7[_0x22e3('0x58')][_0x22e3('0x60')];return db[_0x22e3('0x39')][_0x22e3('0x56')]({'where':{'id':_0x5cf2c7[_0x22e3('0x51')]['id'],'UserId':null}})[_0x22e3('0x1f')](handleEntityNotFound(_0x4bbb8d,null))[_0x22e3('0x1f')](function(_0xbcc9b7){if(_0xbcc9b7){_0x3aa9c2['message']=_0xbcc9b7['get']({'plain':!![]});return db[_0x22e3('0x62')][_0x22e3('0x56')]({'where':{'id':_0xbcc9b7[_0x22e3('0x7d')]}});}return null;})[_0x22e3('0x1f')](handleEntityNotFound(_0x4bbb8d,null))['then'](function(_0xb88afa){if(_0xb88afa){_0x3aa9c2[_0x22e3('0x68')]=_0xb88afa[_0x22e3('0x66')]({'plain':!![]});interaction_log[_0x22e3('0x28')](_0x22e3('0x7e'),_0x5cf2c7[_0x22e3('0x61')]['id'],_0x5cf2c7['user'][_0x22e3('0x4b')],_0x5cf2c7['user'][_0x22e3('0x67')],_0x3aa9c2[_0x22e3('0x68')]['id'],_0x5cf2c7['body']?JSON[_0x22e3('0x24')](_0x5cf2c7['body']):'null');return respondWithRpcPromise('RejectMessage',_0x22e3('0x7f'),_0x3aa9c2);}return null;})[_0x22e3('0x1f')](function(_0x1efae9){var _0x330402=_0x22e3('0x6c')+_0x1efae9['message'][_0x22e3('0x6d')];return db['sequelize'][_0x22e3('0x3f')](_0x330402,{'type':db[_0x22e3('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x22e3('0x1f')](function(_0x2fb7cd){return _0x2fb7cd;});})[_0x22e3('0x1f')](function(_0x548507){if(_0x548507){_0x3aa9c2[_0x22e3('0x27')]['contact']=_0x548507[0x0];if(!_0x5cf2c7[_0x22e3('0x58')]['UserId'])return;return db['User'][_0x22e3('0x56')]({'where':{'id':_0x5cf2c7['body'][_0x22e3('0x60')],'role':_0x22e3('0x73')},'attributes':['id',_0x22e3('0x4b'),_0x22e3('0x74'),_0x22e3('0x75'),_0x22e3('0x76')],'raw':!![]});}return null;})[_0x22e3('0x1f')](function(_0x21084b){if(!_0x21084b)return null;_0x3aa9c2[_0x22e3('0x27')][_0x22e3('0x73')]=_0x21084b;return _0x3aa9c2;})[_0x22e3('0x1f')](function(_0x51a348){if(_0x51a348){_0x51a348[_0x22e3('0x27')][_0x22e3('0x78')]=util['format']('SIP/%s',_0x5cf2c7['user'][_0x22e3('0x4b')]);_0x51a348['message'][_0x22e3('0x80')]=_0x3aa9c2['channel'];_0x51a348[_0x22e3('0x27')][_0x22e3('0x81')]=_0x3aa9c2[_0x22e3('0x80')];_0x51a348['message'][_0x22e3('0x82')]=_0x22e3('0x32');respondWithRpcPromise(_0x22e3('0x7a'),_0x22e3('0x7a'),{'event':_0x22e3('0x83'),'message':_[_0x22e3('0x54')](_0x3aa9c2['message'],JSON[_0x22e3('0x7b')](_0x3aa9c2['interaction']['formData']))},client9002);return _0x3aa9c2;}return null;})[_0x22e3('0x1f')](respondWithResult(_0x4bbb8d,null))[_0x22e3('0x50')](handleError(_0x4bbb8d,null));}; \ No newline at end of file +var _0xdc2f=['channel','event','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','formData','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','ChatMessage','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','show','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','motionChannel'];(function(_0x47ae45,_0x5f1fce){var _0x5f3267=function(_0x421a8e){while(--_0x421a8e){_0x47ae45['push'](_0x47ae45['shift']());}};_0x5f3267(++_0x5f1fce);}(_0xdc2f,0x192));var _0xfdc2=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xdc2f[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0xfdc2('0x0'));var rimraf=require(_0xfdc2('0x1'));var zipdir=require(_0xfdc2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdc2('0x3'));var moment=require(_0xfdc2('0x4'));var BPromise=require(_0xfdc2('0x5'));var Mustache=require('mustache');var util=require(_0xfdc2('0x6'));var path=require('path');var sox=require(_0xfdc2('0x7'));var csv=require(_0xfdc2('0x8'));var ejs=require(_0xfdc2('0x9'));var fs=require('fs');var fs_extra=require(_0xfdc2('0xa'));var _=require(_0xfdc2('0xb'));var squel=require(_0xfdc2('0xc'));var crypto=require(_0xfdc2('0xd'));var jsforce=require(_0xfdc2('0xe'));var deskjs=require(_0xfdc2('0xf'));var toCsv=require(_0xfdc2('0x8'));var querystring=require(_0xfdc2('0x10'));var Papa=require(_0xfdc2('0x11'));var Redis=require(_0xfdc2('0x12'));var authService=require(_0xfdc2('0x13'));var qs=require(_0xfdc2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdc2('0x15'));var logger=require(_0xfdc2('0x16'))(_0xfdc2('0x17'));var utils=require(_0xfdc2('0x18'));var config=require(_0xfdc2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfdc2('0x1a'))['db'];config[_0xfdc2('0x1b')]=_[_0xfdc2('0x1c')](config[_0xfdc2('0x1b')],{'host':_0xfdc2('0x1d'),'port':0x18eb});var socket=require(_0xfdc2('0x1e'))(new Redis(config[_0xfdc2('0x1b')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xfdc2('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xfdc2('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40465d,_0x44c3cb,_0x24372e,_0x36eef9){return new BPromise(function(_0x3ca5c,_0x3f3568){var _0x51836f=_0x36eef9||client;return _0x51836f['request'](_0x40465d,_0x24372e)[_0xfdc2('0x21')](function(_0x7f0260){logger[_0xfdc2('0x22')](_0xfdc2('0x23'),_0x44c3cb,_0xfdc2('0x24'));logger[_0xfdc2('0x25')](_0xfdc2('0x26'),_0x44c3cb,'request\x20sent',JSON[_0xfdc2('0x27')](_0x7f0260));if(_0x7f0260[_0xfdc2('0x28')]){if(_0x7f0260['error'][_0xfdc2('0x29')]===0x1f4){logger[_0xfdc2('0x28')](_0xfdc2('0x23'),_0x44c3cb,_0x7f0260['error'][_0xfdc2('0x2a')]);return _0x3f3568(_0x7f0260['error'][_0xfdc2('0x2a')]);}logger[_0xfdc2('0x28')](_0xfdc2('0x23'),_0x44c3cb,_0x7f0260[_0xfdc2('0x28')]['message']);return _0x3ca5c(_0x7f0260[_0xfdc2('0x28')]['message']);}else{logger[_0xfdc2('0x22')](_0xfdc2('0x23'),_0x44c3cb,_0xfdc2('0x24'));_0x3ca5c(_0x7f0260['result'][_0xfdc2('0x2a')]);}})[_0xfdc2('0x2b')](function(_0x28ce24){logger[_0xfdc2('0x28')](_0xfdc2('0x23'),_0x44c3cb,_0x28ce24);_0x3f3568(_0x28ce24);});});}function respondWithStatusCode(_0x700baf,_0x5e77b9){_0x5e77b9=_0x5e77b9||0xcc;return function(_0x52212b){if(_0x52212b){return _0x700baf[_0xfdc2('0x2c')](_0x5e77b9);}return _0x700baf[_0xfdc2('0x2d')](_0x5e77b9)['end']();};}function respondWithResult(_0x40129e,_0xb73019){_0xb73019=_0xb73019||0xc8;return function(_0x3f997a){if(_0x3f997a){return _0x40129e[_0xfdc2('0x2d')](_0xb73019)[_0xfdc2('0x2e')](_0x3f997a);}};}function respondWithFilteredResult(_0x596dc1,_0x36c5ed){return function(_0x4057ed){if(_0x4057ed){var _0x1a2f2f=typeof _0x36c5ed['offset']==='undefined'&&typeof _0x36c5ed['limit']==='undefined';var _0x5a990b=_0x4057ed[_0xfdc2('0x2f')];var _0x234953=_0x1a2f2f?0x0:_0x36c5ed['offset'];var _0x169c4a=_0x1a2f2f?_0x4057ed['count']:_0x36c5ed[_0xfdc2('0x30')]+_0x36c5ed[_0xfdc2('0x31')];var _0x3d9be9;if(_0x169c4a>=_0x5a990b){_0x169c4a=_0x5a990b;_0x3d9be9=0xc8;}else{_0x3d9be9=0xce;}_0x596dc1[_0xfdc2('0x2d')](_0x3d9be9);return _0x596dc1[_0xfdc2('0x32')](_0xfdc2('0x33'),_0x234953+'-'+_0x169c4a+'/'+_0x5a990b)['json'](_0x4057ed);}return null;};}function patchUpdates(_0x331f9f){return function(_0x5bb362){try{jsonpatch[_0xfdc2('0x34')](_0x5bb362,_0x331f9f,!![]);}catch(_0x4e750e){return BPromise[_0xfdc2('0x35')](_0x4e750e);}return _0x5bb362[_0xfdc2('0x36')]();};}function saveUpdates(_0xa37fba,_0x68a2d1){return function(_0x4cb013){if(_0x4cb013){return _0x4cb013[_0xfdc2('0x37')](_0xa37fba)[_0xfdc2('0x21')](function(_0xc400be){return _0xc400be;});}return null;};}function removeEntity(_0x3d7230,_0x2a73c1){return function(_0x20a779){if(_0x20a779){return _0x20a779[_0xfdc2('0x38')]()['then'](function(){_0x3d7230[_0xfdc2('0x2d')](0xcc)[_0xfdc2('0x39')]();});}};}function handleEntityNotFound(_0x24f53b,_0x2134cf){return function(_0x521712){if(!_0x521712){_0x24f53b['sendStatus'](0x194);}return _0x521712;};}function handleError(_0x168efd,_0x5788e8){_0x5788e8=_0x5788e8||0x1f4;return function(_0x29bb33){logger[_0xfdc2('0x28')](_0x29bb33[_0xfdc2('0x3a')]);if(_0x29bb33[_0xfdc2('0x3b')]){delete _0x29bb33[_0xfdc2('0x3b')];}_0x168efd['status'](_0x5788e8)[_0xfdc2('0x3c')](_0x29bb33);};}exports[_0xfdc2('0x3d')]=function(_0x4a76ca,_0x416f98){var _0x2c24af={},_0xb085ae={},_0x5a4521={'count':0x0,'rows':[]};var _0x359840=_['map'](db[_0xfdc2('0x3e')]['rawAttributes'],function(_0x3a0854){return{'name':_0x3a0854[_0xfdc2('0x3f')],'type':_0x3a0854[_0xfdc2('0x40')][_0xfdc2('0x41')]};});_0xb085ae[_0xfdc2('0x42')]=_[_0xfdc2('0x43')](_0x359840,'name');_0xb085ae[_0xfdc2('0x44')]=_['keys'](_0x4a76ca[_0xfdc2('0x44')]);_0xb085ae[_0xfdc2('0x45')]=_[_0xfdc2('0x46')](_0xb085ae[_0xfdc2('0x42')],_0xb085ae[_0xfdc2('0x44')]);_0x2c24af['attributes']=_['intersection'](_0xb085ae['model'],qs[_0xfdc2('0x47')](_0x4a76ca['query'][_0xfdc2('0x47')]));_0x2c24af[_0xfdc2('0x48')]=_0x2c24af['attributes'][_0xfdc2('0x49')]?_0x2c24af[_0xfdc2('0x48')]:_0xb085ae[_0xfdc2('0x42')];if(!_0x4a76ca[_0xfdc2('0x44')]['hasOwnProperty'](_0xfdc2('0x4a'))){_0x2c24af[_0xfdc2('0x31')]=qs['limit'](_0x4a76ca[_0xfdc2('0x44')]['limit']);_0x2c24af[_0xfdc2('0x30')]=qs[_0xfdc2('0x30')](_0x4a76ca['query']['offset']);}_0x2c24af[_0xfdc2('0x4b')]=qs[_0xfdc2('0x4c')](_0x4a76ca[_0xfdc2('0x44')]['sort']);_0x2c24af[_0xfdc2('0x4d')]=qs[_0xfdc2('0x45')](_[_0xfdc2('0x4e')](_0x4a76ca[_0xfdc2('0x44')],_0xb085ae[_0xfdc2('0x45')]),_0x359840);if(_0x4a76ca[_0xfdc2('0x44')][_0xfdc2('0x4f')]){_0x2c24af[_0xfdc2('0x4d')]=_['merge'](_0x2c24af['where'],{'$or':_[_0xfdc2('0x43')](_0x359840,function(_0x3da7d9){if(_0x3da7d9['type']!=='VIRTUAL'){var _0x1195cb={};_0x1195cb[_0x3da7d9['name']]={'$like':'%'+_0x4a76ca[_0xfdc2('0x44')][_0xfdc2('0x4f')]+'%'};return _0x1195cb;}})});}_0x2c24af=_[_0xfdc2('0x50')]({},_0x2c24af,_0x4a76ca[_0xfdc2('0x51')]);var _0x2a01bf={'where':_0x2c24af['where']};return db[_0xfdc2('0x3e')]['count'](_0x2a01bf)[_0xfdc2('0x21')](function(_0xba8dc0){_0x5a4521['count']=_0xba8dc0;if(_0x4a76ca[_0xfdc2('0x44')][_0xfdc2('0x52')]){_0x2c24af['include']=[{'all':!![]}];}return db[_0xfdc2('0x3e')]['findAll'](_0x2c24af);})['then'](function(_0x21a96d){_0x5a4521['rows']=_0x21a96d;return _0x5a4521;})['then'](respondWithFilteredResult(_0x416f98,_0x2c24af))[_0xfdc2('0x2b')](handleError(_0x416f98,null));};exports[_0xfdc2('0x53')]=function(_0x2926cd,_0x265c71){var _0x40e830={'raw':!![],'where':{'id':_0x2926cd['params']['id']}},_0x298d77={};_0x298d77[_0xfdc2('0x42')]=_['keys'](db[_0xfdc2('0x3e')]['rawAttributes']);_0x298d77['query']=_['keys'](_0x2926cd['query']);_0x298d77['filters']=_['intersection'](_0x298d77[_0xfdc2('0x42')],_0x298d77[_0xfdc2('0x44')]);_0x40e830[_0xfdc2('0x48')]=_[_0xfdc2('0x46')](_0x298d77['model'],qs[_0xfdc2('0x47')](_0x2926cd[_0xfdc2('0x44')][_0xfdc2('0x47')]));_0x40e830[_0xfdc2('0x48')]=_0x40e830[_0xfdc2('0x48')][_0xfdc2('0x49')]?_0x40e830[_0xfdc2('0x48')]:_0x298d77[_0xfdc2('0x42')];if(_0x2926cd[_0xfdc2('0x44')][_0xfdc2('0x52')]){_0x40e830['include']=[{'all':!![]}];}_0x40e830=_[_0xfdc2('0x50')]({},_0x40e830,_0x2926cd[_0xfdc2('0x51')]);return db[_0xfdc2('0x3e')][_0xfdc2('0x54')](_0x40e830)[_0xfdc2('0x21')](handleEntityNotFound(_0x265c71,null))[_0xfdc2('0x21')](respondWithResult(_0x265c71,null))[_0xfdc2('0x2b')](handleError(_0x265c71,null));};exports[_0xfdc2('0x55')]=function(_0x577085,_0x82a1ec){return db[_0xfdc2('0x3e')]['create'](_0x577085['body'],{})[_0xfdc2('0x21')](respondWithResult(_0x82a1ec,0xc9))[_0xfdc2('0x2b')](handleError(_0x82a1ec,null));};exports[_0xfdc2('0x37')]=function(_0x21750c,_0x3394b9){if(_0x21750c[_0xfdc2('0x56')]['id']){delete _0x21750c[_0xfdc2('0x56')]['id'];}return db[_0xfdc2('0x3e')][_0xfdc2('0x54')]({'where':{'id':_0x21750c[_0xfdc2('0x57')]['id']}})[_0xfdc2('0x21')](handleEntityNotFound(_0x3394b9,null))[_0xfdc2('0x21')](saveUpdates(_0x21750c[_0xfdc2('0x56')],null))['then'](respondWithResult(_0x3394b9,null))[_0xfdc2('0x2b')](handleError(_0x3394b9,null));};exports['destroy']=function(_0x48d232,_0x3952a9){return db['ChatMessage'][_0xfdc2('0x54')]({'where':{'id':_0x48d232['params']['id']}})[_0xfdc2('0x21')](handleEntityNotFound(_0x3952a9,null))[_0xfdc2('0x21')](removeEntity(_0x3952a9,null))[_0xfdc2('0x2b')](handleError(_0x3952a9,null));};exports[_0xfdc2('0x58')]=function(_0x4bb82,_0x4af9fe){return db[_0xfdc2('0x3e')][_0xfdc2('0x58')]()[_0xfdc2('0x21')](respondWithResult(_0x4af9fe,null))['catch'](handleError(_0x4af9fe,null));};var interaction_log=require('../../config/logger')(_0xfdc2('0x59'));exports[_0xfdc2('0x5a')]=function(_0x23be4a,_0x5939ef,_0x52214f){var _0x5231f9={'agent':{},'channel':_0xfdc2('0x5b')};if(_0x23be4a[_0xfdc2('0x56')]['id']){delete _0x23be4a[_0xfdc2('0x56')]['id'];}_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x5c')]=!![];_0x23be4a['body'][_0xfdc2('0x5d')]=moment()[_0xfdc2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x5f')]=_0x23be4a['body'][_0xfdc2('0x5f')]||_0x23be4a[_0xfdc2('0x60')]['id'];_0x5231f9['agent']['id']=_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x5f')];return db[_0xfdc2('0x3e')]['find']({'where':{'id':_0x23be4a[_0xfdc2('0x57')]['id'],'UserId':null}})[_0xfdc2('0x21')](handleEntityNotFound(_0x5939ef,null))[_0xfdc2('0x21')](saveUpdates(_0x23be4a[_0xfdc2('0x56')],null))[_0xfdc2('0x21')](function(_0xc0f8b5){if(_0xc0f8b5){_0x5231f9[_0xfdc2('0x2a')]=_0xc0f8b5[_0xfdc2('0x61')]({'plain':!![]});return db[_0xfdc2('0x62')][_0xfdc2('0x54')]({'where':{'id':_0xc0f8b5[_0xfdc2('0x63')]}});}return null;})[_0xfdc2('0x21')](handleEntityNotFound(_0x5939ef,null))[_0xfdc2('0x21')](function(_0x28c30e){if(_0x28c30e){return _0x28c30e[_0xfdc2('0x37')]({'UserId':_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x5f')],'read1stAt':_['isNil'](_0x28c30e[_0xfdc2('0x64')])?moment()['format'](_0xfdc2('0x65')):undefined});}return null;})[_0xfdc2('0x21')](function(_0x1d55f1){if(_0x1d55f1){_0x5231f9['interaction']=_0x1d55f1[_0xfdc2('0x61')]({'plain':!![]});interaction_log[_0xfdc2('0x22')](_0xfdc2('0x66'),_0x23be4a[_0xfdc2('0x60')]['id'],_0x23be4a[_0xfdc2('0x60')][_0xfdc2('0x3b')],_0x23be4a[_0xfdc2('0x60')]['role'],_0x5231f9[_0xfdc2('0x67')]['id'],_0x23be4a['body']?JSON[_0xfdc2('0x27')](_0x23be4a[_0xfdc2('0x56')]):_0xfdc2('0x68'));return respondWithRpcPromise('AcceptMessage',_0xfdc2('0x69'),_0x5231f9);}return null;})[_0xfdc2('0x21')](function(_0x4fa2b0){var _0x1277d1=_0xfdc2('0x6a')+_0x4fa2b0['message'][_0xfdc2('0x6b')];return db[_0xfdc2('0x6c')][_0xfdc2('0x44')](_0x1277d1,{'type':db[_0xfdc2('0x6d')][_0xfdc2('0x6e')][_0xfdc2('0x6f')],'raw':!![]})[_0xfdc2('0x21')](function(_0x22059e){return _0x22059e;});})[_0xfdc2('0x21')](function(_0x5afe08){if(_0x5afe08){_0x5231f9[_0xfdc2('0x2a')][_0xfdc2('0x70')]=_0x5afe08[0x0];if(!_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x5f')])return;return db[_0xfdc2('0x71')][_0xfdc2('0x54')]({'where':{'id':_0x23be4a['body'][_0xfdc2('0x5f')],'role':_0xfdc2('0x72')},'attributes':['id',_0xfdc2('0x3b'),_0xfdc2('0x73'),_0xfdc2('0x74'),_0xfdc2('0x75')],'raw':!![]});}return null;})['then'](function(_0x5381d8){if(!_0x5381d8)return null;_0x5231f9['message'][_0xfdc2('0x72')]=_0x5381d8;return _0x5231f9;})['then'](function(_0x3810cb){if(_0x3810cb){if(_0x23be4a[_0xfdc2('0x56')][_0xfdc2('0x76')]){_0x5231f9[_0xfdc2('0x2a')][_0xfdc2('0x77')]=util[_0xfdc2('0x5e')](_0xfdc2('0x78'),_0x23be4a['user'][_0xfdc2('0x3b')]);_0x5231f9['message']['channel']=_0x5231f9['channel'];_0x5231f9[_0xfdc2('0x2a')][_0xfdc2('0x79')]=_0x5231f9[_0xfdc2('0x7a')];_0x5231f9[_0xfdc2('0x2a')][_0xfdc2('0x7b')]=_0xfdc2('0x5a');return respondWithRpcPromise('EventManager',_0xfdc2('0x7c'),{'event':_0xfdc2('0x7d'),'message':_['merge'](_0x5231f9[_0xfdc2('0x2a')],JSON[_0xfdc2('0x7e')](_0x5231f9[_0xfdc2('0x67')]['formData']))},client9002)[_0xfdc2('0x21')](function(){return _0x5231f9;});}return _0x5231f9;}return null;})[_0xfdc2('0x21')](respondWithResult(_0x5939ef,null))[_0xfdc2('0x2b')](handleError(_0x5939ef,null));};var interaction_log=require(_0xfdc2('0x16'))('chat-interactions');exports[_0xfdc2('0x35')]=function(_0x1e6d7a,_0x538aeb,_0x16dc4f){var _0xb4aef7={'agent':{},'channel':_0xfdc2('0x5b')};if(_0x1e6d7a[_0xfdc2('0x56')]['id']){delete _0x1e6d7a[_0xfdc2('0x56')]['id'];}_0x1e6d7a[_0xfdc2('0x56')][_0xfdc2('0x5f')]=_0x1e6d7a[_0xfdc2('0x56')][_0xfdc2('0x5f')]||_0x1e6d7a['user']['id'];_0xb4aef7[_0xfdc2('0x72')]['id']=_0x1e6d7a[_0xfdc2('0x56')][_0xfdc2('0x5f')];return db['ChatMessage'][_0xfdc2('0x54')]({'where':{'id':_0x1e6d7a[_0xfdc2('0x57')]['id'],'UserId':null}})[_0xfdc2('0x21')](handleEntityNotFound(_0x538aeb,null))['then'](function(_0x533301){if(_0x533301){_0xb4aef7[_0xfdc2('0x2a')]=_0x533301[_0xfdc2('0x61')]({'plain':!![]});return db[_0xfdc2('0x62')]['find']({'where':{'id':_0x533301[_0xfdc2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x538aeb,null))[_0xfdc2('0x21')](function(_0x4d8c3a){if(_0x4d8c3a){_0xb4aef7['interaction']=_0x4d8c3a['get']({'plain':!![]});interaction_log[_0xfdc2('0x22')](_0xfdc2('0x7f'),_0x1e6d7a['user']['id'],_0x1e6d7a[_0xfdc2('0x60')]['name'],_0x1e6d7a[_0xfdc2('0x60')][_0xfdc2('0x80')],_0xb4aef7[_0xfdc2('0x67')]['id'],_0x1e6d7a[_0xfdc2('0x56')]?JSON[_0xfdc2('0x27')](_0x1e6d7a[_0xfdc2('0x56')]):_0xfdc2('0x68'));return respondWithRpcPromise(_0xfdc2('0x81'),'rejectMessage',_0xb4aef7);}return null;})[_0xfdc2('0x21')](function(_0x448ab2){var _0x4246fb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x448ab2[_0xfdc2('0x2a')][_0xfdc2('0x6b')];return db[_0xfdc2('0x6c')][_0xfdc2('0x44')](_0x4246fb,{'type':db[_0xfdc2('0x6d')]['QueryTypes'][_0xfdc2('0x6f')],'raw':!![]})[_0xfdc2('0x21')](function(_0x1de5b0){return _0x1de5b0;});})[_0xfdc2('0x21')](function(_0x559722){if(_0x559722){_0xb4aef7[_0xfdc2('0x2a')][_0xfdc2('0x70')]=_0x559722[0x0];if(!_0x1e6d7a[_0xfdc2('0x56')]['UserId'])return;return db[_0xfdc2('0x71')]['find']({'where':{'id':_0x1e6d7a['body'][_0xfdc2('0x5f')],'role':'agent'},'attributes':['id',_0xfdc2('0x3b'),_0xfdc2('0x73'),_0xfdc2('0x74'),'internal'],'raw':!![]});}return null;})[_0xfdc2('0x21')](function(_0x4797ea){if(!_0x4797ea)return null;_0xb4aef7[_0xfdc2('0x2a')]['agent']=_0x4797ea;return _0xb4aef7;})[_0xfdc2('0x21')](function(_0x1384c3){if(_0x1384c3){_0x1384c3[_0xfdc2('0x2a')][_0xfdc2('0x77')]=util[_0xfdc2('0x5e')](_0xfdc2('0x78'),_0x1e6d7a[_0xfdc2('0x60')][_0xfdc2('0x3b')]);_0x1384c3[_0xfdc2('0x2a')][_0xfdc2('0x7a')]=_0xb4aef7['channel'];_0x1384c3['message'][_0xfdc2('0x79')]=_0xb4aef7['channel'];_0x1384c3[_0xfdc2('0x2a')][_0xfdc2('0x7b')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0xfdc2('0x50')](_0xb4aef7[_0xfdc2('0x2a')],JSON['parse'](_0xb4aef7['interaction'][_0xfdc2('0x82')]))},client9002);return _0xb4aef7;}return null;})[_0xfdc2('0x21')](respondWithResult(_0x538aeb,null))[_0xfdc2('0x2b')](handleError(_0x538aeb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 95a7c04..1dcd49e 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 _0x2200=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x223494,_0x7b0380){var _0xa7293e=function(_0x34a577){while(--_0x34a577){_0x223494['push'](_0x223494['shift']());}};_0xa7293e(++_0x7b0380);}(_0x2200,0x9d));var _0x0220=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x2200[_0x15cbce];return _0x257f29;};'use strict';var EventEmitter=require(_0x0220('0x0'));var ChatMessage=require(_0x0220('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0220('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0220('0x3'),'afterDestroy':_0x0220('0x4')};function emitEvent(_0x12fe17){return function(_0x5e31d1,_0x4de14e,_0x17b63a){ChatMessageEvents[_0x0220('0x5')](_0x12fe17+':'+_0x5e31d1['id'],_0x5e31d1);ChatMessageEvents[_0x0220('0x5')](_0x12fe17,_0x5e31d1);_0x17b63a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x0220('0x6')](e,emitEvent(event));}}module[_0x0220('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x75e0=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x75e0,0xa7));var _0x075e=function(_0x2447c1,_0x28fe94){_0x2447c1=_0x2447c1-0x0;var _0x37e46d=_0x75e0[_0x2447c1];return _0x37e46d;};'use strict';var EventEmitter=require(_0x075e('0x0'));var ChatMessage=require(_0x075e('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x075e('0x2')](0x0);var events={'afterCreate':_0x075e('0x3'),'afterUpdate':_0x075e('0x4'),'afterDestroy':_0x075e('0x5')};function emitEvent(_0x58c9fd){return function(_0x233919,_0x4c127d,_0x1473d3){ChatMessageEvents[_0x075e('0x6')](_0x58c9fd+':'+_0x233919['id'],_0x233919);ChatMessageEvents[_0x075e('0x6')](_0x58c9fd,_0x233919);_0x1473d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x075e('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 850d6a2..9d771c4 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 _0x69c8=['moment','bluebird','request-promise','path','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x69c8,0xbc));var _0x869c=function(_0x50e7a4,_0x35bfbf){_0x50e7a4=_0x50e7a4-0x0;var _0x35c692=_0x69c8[_0x50e7a4];return _0x35c692;};'use strict';var _=require(_0x869c('0x0'));var util=require(_0x869c('0x1'));var logger=require(_0x869c('0x2'))(_0x869c('0x3'));var moment=require(_0x869c('0x4'));var BPromise=require(_0x869c('0x5'));var rp=require(_0x869c('0x6'));var fs=require('fs');var path=require(_0x869c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x869c('0x8'));module[_0x869c('0x9')]=function(_0x2ba45b,_0x134695){return _0x2ba45b[_0x869c('0xa')](_0x869c('0xb'),attributes,{'tableName':_0x869c('0xc'),'paranoid':![],'indexes':[{'name':_0x869c('0xd'),'fields':[_0x869c('0xe')],'type':_0x869c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x535546,_0x36e6c7,_0x4dd4b9){var _0x2728fb=_0x2ba45b[_0x869c('0x10')];var _0x453406=_0x535546[_0x869c('0x11')]({'plain':!![]});if(_0x453406[_0x869c('0x12')]['toLowerCase']()==='in'||_0x453406[_0x869c('0x12')][_0x869c('0x13')]()===_0x869c('0x14')&&!_0x453406[_0x869c('0x15')]&&!_[_0x869c('0x16')](_0x453406[_0x869c('0x17')])){_0x2728fb['ChatInteraction'][_0x869c('0x18')]({'where':{'id':_0x453406[_0x869c('0x19')]}})[_0x869c('0x1a')](function(_0x1d747a){if(_0x1d747a){_0x1d747a[_0x869c('0x1b')]({'lastMsgAt':_0x453406[_0x869c('0x1c')],'lastMsgDirection':_0x453406[_0x869c('0x12')][_0x869c('0x13')]()});}})[_0x869c('0x1d')](function(_0x344fb8){console[_0x869c('0x1e')](_0x344fb8);});}_0x4dd4b9();}},'charset':'utf8mb4','collate':_0x869c('0x1f')});}; \ No newline at end of file +var _0x1fda=['error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','FULLTEXT','get','toLowerCase','direction','out','isNil','ChatInteractionId','then','createdAt'];(function(_0x26659f,_0x32f426){var _0x42667f=function(_0xdc0b71){while(--_0xdc0b71){_0x26659f['push'](_0x26659f['shift']());}};_0x42667f(++_0x32f426);}(_0x1fda,0x19b));var _0xa1fd=function(_0x13c0f3,_0x33d4bf){_0x13c0f3=_0x13c0f3-0x0;var _0x1c2c33=_0x1fda[_0x13c0f3];return _0x1c2c33;};'use strict';var _=require(_0xa1fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa1fd('0x1'));var moment=require(_0xa1fd('0x2'));var BPromise=require(_0xa1fd('0x3'));var rp=require(_0xa1fd('0x4'));var fs=require('fs');var path=require(_0xa1fd('0x5'));var rimraf=require(_0xa1fd('0x6'));var config=require(_0xa1fd('0x7'));var attributes=require(_0xa1fd('0x8'));module['exports']=function(_0x151253,_0x3e4df7){return _0x151253[_0xa1fd('0x9')](_0xa1fd('0xa'),attributes,{'tableName':_0xa1fd('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xa1fd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3198c4,_0x48037d,_0x1a5001){var _0x1efb03=_0x151253['models'];var _0x410515=_0x3198c4[_0xa1fd('0xd')]({'plain':!![]});if(_0x410515['direction'][_0xa1fd('0xe')]()==='in'||_0x410515[_0xa1fd('0xf')][_0xa1fd('0xe')]()===_0xa1fd('0x10')&&!_0x410515['secret']&&!_[_0xa1fd('0x11')](_0x410515['UserId'])){_0x1efb03['ChatInteraction']['findOne']({'where':{'id':_0x410515[_0xa1fd('0x12')]}})[_0xa1fd('0x13')](function(_0x1d09ce){if(_0x1d09ce){_0x1d09ce['update']({'lastMsgAt':_0x410515[_0xa1fd('0x14')],'lastMsgDirection':_0x410515[_0xa1fd('0xf')][_0xa1fd('0xe')]()});}})['catch'](function(_0x1b4697){console[_0xa1fd('0x15')](_0x1b4697);});}_0x1a5001();}},'charset':_0xa1fd('0x16'),'collate':_0xa1fd('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 946904e..6698a01 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 _0x7be6=['ChatMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','CreateChatMessage'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7be6,0x1e3));var _0x67be=function(_0x318162,_0x222103){_0x318162=_0x318162-0x0;var _0xfea92b=_0x7be6[_0x318162];return _0xfea92b;};'use strict';var _=require(_0x67be('0x0'));var util=require(_0x67be('0x1'));var moment=require(_0x67be('0x2'));var BPromise=require(_0x67be('0x3'));var rs=require(_0x67be('0x4'));var fs=require('fs');var Redis=require(_0x67be('0x5'));var db=require(_0x67be('0x6'))['db'];var utils=require(_0x67be('0x7'));var logger=require(_0x67be('0x8'))(_0x67be('0x9'));var config=require(_0x67be('0xa'));var jayson=require(_0x67be('0xb'));var client=jayson[_0x67be('0xc')][_0x67be('0xd')]({'port':0x232a});config[_0x67be('0xe')]=_['defaults'](config[_0x67be('0xe')],{'host':_0x67be('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x67be('0x10'))[_0x67be('0x11')](socket);function respondWithRpcPromise(_0x500f48,_0x405f14,_0xc01bec){return new BPromise(function(_0x939d83,_0x2991da){return client['request'](_0x500f48,_0xc01bec)['then'](function(_0x32a333){logger[_0x67be('0x12')](_0x67be('0x13'),_0x405f14,_0x67be('0x14'));logger[_0x67be('0x15')](_0x67be('0x16'),_0x405f14,_0x67be('0x14'),JSON['stringify'](_0x32a333));if(_0x32a333[_0x67be('0x17')]){if(_0x32a333[_0x67be('0x17')][_0x67be('0x18')]===0x1f4){logger[_0x67be('0x17')]('ChatMessage,\x20%s,\x20%s',_0x405f14,_0x32a333[_0x67be('0x17')][_0x67be('0x19')]);return _0x2991da(_0x32a333[_0x67be('0x17')][_0x67be('0x19')]);}logger[_0x67be('0x17')](_0x67be('0x13'),_0x405f14,_0x32a333[_0x67be('0x17')]['message']);return _0x939d83(_0x32a333[_0x67be('0x17')]['message']);}else{logger[_0x67be('0x12')](_0x67be('0x13'),_0x405f14,_0x67be('0x14'));_0x939d83(_0x32a333['result'][_0x67be('0x19')]);}})['catch'](function(_0x5e058f){logger[_0x67be('0x17')]('ChatMessage,\x20%s,\x20%s',_0x405f14,_0x5e058f);_0x2991da(_0x5e058f);});});}exports[_0x67be('0x1a')]=function(_0x38cfb5){var _0x5a97ba=this;return new Promise(function(_0x5c8e5a,_0x1012f9){return db[_0x67be('0x1b')][_0x67be('0x1c')](_0x38cfb5[_0x67be('0x1d')],{'raw':_0x38cfb5[_0x67be('0x1e')]?_0x38cfb5[_0x67be('0x1e')][_0x67be('0x1f')]===undefined?!![]:![]:!![]})[_0x67be('0x20')](function(_0x111411){logger[_0x67be('0x12')](_0x67be('0x1a'),_0x38cfb5);logger[_0x67be('0x15')](_0x67be('0x1a'),_0x38cfb5,JSON['stringify'](_0x111411));_0x5c8e5a(_0x111411);})[_0x67be('0x21')](function(_0x2c31a1){logger[_0x67be('0x17')](_0x67be('0x1a'),_0x2c31a1[_0x67be('0x19')],_0x38cfb5);_0x1012f9(_0x5a97ba[_0x67be('0x17')](0x1f4,_0x2c31a1[_0x67be('0x19')]));});});}; \ No newline at end of file +var _0x154a=['body','options','raw','CreateChatMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','create'];(function(_0x5042a8,_0x2d66a5){var _0x51b197=function(_0x41111f){while(--_0x41111f){_0x5042a8['push'](_0x5042a8['shift']());}};_0x51b197(++_0x2d66a5);}(_0x154a,0x1e5));var _0xa154=function(_0x4d7033,_0x1ce24e){_0x4d7033=_0x4d7033-0x0;var _0x309128=_0x154a[_0x4d7033];return _0x309128;};'use strict';var _=require(_0xa154('0x0'));var util=require(_0xa154('0x1'));var moment=require(_0xa154('0x2'));var BPromise=require('bluebird');var rs=require(_0xa154('0x3'));var fs=require('fs');var Redis=require(_0xa154('0x4'));var db=require(_0xa154('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa154('0x6'))(_0xa154('0x7'));var config=require(_0xa154('0x8'));var jayson=require(_0xa154('0x9'));var client=jayson[_0xa154('0xa')][_0xa154('0xb')]({'port':0x232a});config[_0xa154('0xc')]=_['defaults'](config['redis'],{'host':_0xa154('0xd'),'port':0x18eb});var socket=require(_0xa154('0xe'))(new Redis(config[_0xa154('0xc')]));require(_0xa154('0xf'))['register'](socket);function respondWithRpcPromise(_0x1c90ad,_0x1f7b15,_0x3737aa){return new BPromise(function(_0x41285a,_0x549ad4){return client[_0xa154('0x10')](_0x1c90ad,_0x3737aa)[_0xa154('0x11')](function(_0x591537){logger[_0xa154('0x12')](_0xa154('0x13'),_0x1f7b15,'request\x20sent');logger[_0xa154('0x14')](_0xa154('0x15'),_0x1f7b15,_0xa154('0x16'),JSON[_0xa154('0x17')](_0x591537));if(_0x591537[_0xa154('0x18')]){if(_0x591537[_0xa154('0x18')]['code']===0x1f4){logger[_0xa154('0x18')](_0xa154('0x13'),_0x1f7b15,_0x591537[_0xa154('0x18')][_0xa154('0x19')]);return _0x549ad4(_0x591537[_0xa154('0x18')]['message']);}logger[_0xa154('0x18')](_0xa154('0x13'),_0x1f7b15,_0x591537[_0xa154('0x18')][_0xa154('0x19')]);return _0x41285a(_0x591537[_0xa154('0x18')][_0xa154('0x19')]);}else{logger[_0xa154('0x12')](_0xa154('0x13'),_0x1f7b15,'request\x20sent');_0x41285a(_0x591537['result'][_0xa154('0x19')]);}})['catch'](function(_0x50ccf0){logger[_0xa154('0x18')](_0xa154('0x13'),_0x1f7b15,_0x50ccf0);_0x549ad4(_0x50ccf0);});});}exports['CreateChatMessage']=function(_0x3c34a3){var _0x37ec74=this;return new Promise(function(_0x9c36cb,_0x45b651){return db['ChatMessage'][_0xa154('0x1a')](_0x3c34a3[_0xa154('0x1b')],{'raw':_0x3c34a3[_0xa154('0x1c')]?_0x3c34a3[_0xa154('0x1c')][_0xa154('0x1d')]===undefined?!![]:![]:!![]})[_0xa154('0x11')](function(_0x1f9f00){logger[_0xa154('0x12')](_0xa154('0x1e'),_0x3c34a3);logger[_0xa154('0x14')](_0xa154('0x1e'),_0x3c34a3,JSON[_0xa154('0x17')](_0x1f9f00));_0x9c36cb(_0x1f9f00);})[_0xa154('0x1f')](function(_0x3e61b0){logger[_0xa154('0x18')](_0xa154('0x1e'),_0x3e61b0[_0xa154('0x19')],_0x3c34a3);_0x45b651(_0x37ec74[_0xa154('0x18')](0x1f4,_0x3e61b0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2b3ba3a..40ae35e 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 _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x3645,0x154));var _0x5364=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x3645[_0x34d346];return _0x122d76;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5364('0x0'),_0x5364('0x1'),_0x5364('0x2')];function createListener(_0x28eafb,_0x2d71d7){return function(_0x2f629b){_0x2d71d7[_0x5364('0x3')](_0x28eafb,_0x2f629b);};}function removeListener(_0x5a63bf,_0x334a16){return function(){ChatMessageEvents[_0x5364('0x4')](_0x5a63bf,_0x334a16);};}exports[_0x5364('0x5')]=function(_0x1f9c6b){for(var _0x417c44=0x0,_0x7933a5=events[_0x5364('0x6')];_0x417c44<_0x7933a5;_0x417c44++){var _0x43fb3f=events[_0x417c44];var _0x3c1b21=createListener('chatMessage:'+_0x43fb3f,_0x1f9c6b);ChatMessageEvents['on'](_0x43fb3f,_0x3c1b21);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x3e74,0x175));var _0x43e7=function(_0x18d077,_0xd20563){_0x18d077=_0x18d077-0x0;var _0x50dec6=_0x3e74[_0x18d077];return _0x50dec6;};'use strict';var ChatMessageEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatMessageEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatMessageEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 7e1b658..6fbe130 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 _0x5b18=['../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','chatmessage:create','create','put','update','accept','delete','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0xb010e8,_0x47ae36){var _0x1fdb0a=function(_0x6db2e4){while(--_0x6db2e4){_0xb010e8['push'](_0xb010e8['shift']());}};_0x1fdb0a(++_0x47ae36);}(_0x5b18,0xf8));var _0x85b1=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0x5b18[_0x21c23e];return _0xa7b7e2;};'use strict';var multer=require('multer');var util=require(_0x85b1('0x0'));var path=require(_0x85b1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85b1('0x2')]();var fs_extra=require(_0x85b1('0x3'));var auth=require(_0x85b1('0x4'));var interaction=require(_0x85b1('0x5'));var config=require(_0x85b1('0x6'));var controller=require(_0x85b1('0x7'));router['get']('/',auth[_0x85b1('0x8')](),controller[_0x85b1('0x9')]);router[_0x85b1('0xa')](_0x85b1('0xb'),auth[_0x85b1('0x8')](),controller['describe']);router['get'](_0x85b1('0xc'),auth[_0x85b1('0x8')](),controller[_0x85b1('0xd')]);router[_0x85b1('0xe')]('/',auth[_0x85b1('0x8')](),interaction[_0x85b1('0xf')]('chat',_0x85b1('0x10')),controller[_0x85b1('0x11')]);router[_0x85b1('0x12')](_0x85b1('0xc'),controller[_0x85b1('0x13')]);router[_0x85b1('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x85b1('0x14')]);router[_0x85b1('0x12')]('/:id/reject',auth[_0x85b1('0x8')](),controller['reject']);router[_0x85b1('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x85b1('0x16')]=router; \ No newline at end of file +var _0xec85=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec85,0x12c));var _0x5ec8=function(_0x3abd6a,_0xd7417b){_0x3abd6a=_0x3abd6a-0x0;var _0x2d383c=_0xec85[_0x3abd6a];return _0x2d383c;};'use strict';var multer=require(_0x5ec8('0x0'));var util=require('util');var path=require(_0x5ec8('0x1'));var timeout=require(_0x5ec8('0x2'));var express=require(_0x5ec8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5ec8('0x4'));var interaction=require(_0x5ec8('0x5'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x5ec8('0x6')](),controller['index']);router[_0x5ec8('0x7')](_0x5ec8('0x8'),auth['isAuthenticated'](),controller[_0x5ec8('0x9')]);router[_0x5ec8('0x7')](_0x5ec8('0xa'),auth[_0x5ec8('0x6')](),controller[_0x5ec8('0xb')]);router[_0x5ec8('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x5ec8('0xd'),_0x5ec8('0xe')),controller[_0x5ec8('0xf')]);router[_0x5ec8('0x10')](_0x5ec8('0xa'),controller[_0x5ec8('0x11')]);router[_0x5ec8('0x10')](_0x5ec8('0x12'),auth['isAuthenticated'](),controller[_0x5ec8('0x13')]);router[_0x5ec8('0x10')](_0x5ec8('0x14'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x5ec8('0xa'),auth['isAuthenticated'](),controller[_0x5ec8('0x15')]);module[_0x5ec8('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index bd377cb..5eeab96 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 _0xadb5=['medium','TEXT','exports'];(function(_0x4fb479,_0x148044){var _0x2685ee=function(_0x5150e9){while(--_0x5150e9){_0x4fb479['push'](_0x4fb479['shift']());}};_0x2685ee(++_0x148044);}(_0xadb5,0xad));var _0x5adb=function(_0x64b63,_0x40c6e9){_0x64b63=_0x64b63-0x0;var _0x367bc7=_0xadb5[_0x64b63];return _0x367bc7;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x44e5f3,_0x98265d){var _0x3a9dc0=function(_0x3daca6){while(--_0x3daca6){_0x44e5f3['push'](_0x44e5f3['shift']());}};_0x3a9dc0(++_0x98265d);}(_0x2032,0xd9));var _0x2203=function(_0x5eb99b,_0x48b62a){_0x5eb99b=_0x5eb99b-0x0;var _0x1c76f2=_0x2032[_0x5eb99b];return _0x1c76f2;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2a89eb6..eb0fed0 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5a483f,_0x95b3f8){var _0x247d88=function(_0x5e6359){while(--_0x5e6359){_0x5a483f['push'](_0x5a483f['shift']());}};_0x247d88(++_0x95b3f8);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x37d793,_0x22441d){_0x37d793=_0x37d793-0x0;var _0x28adb7=_0x7a54[_0x37d793];return _0x28adb7;};'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.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c1b1481..cad8a29 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d91=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x22c867,_0x20589d){var _0x439f1f=function(_0xd69f7){while(--_0xd69f7){_0x22c867['push'](_0x22c867['shift']());}};_0x439f1f(++_0x20589d);}(_0x0d91,0x76));var _0x10d9=function(_0x5bdd5d,_0x5042c5){_0x5bdd5d=_0x5bdd5d-0x0;var _0x37d28c=_0x0d91[_0x5bdd5d];return _0x37d28c;};'use strict';var EventEmitter=require(_0x10d9('0x0'));var ChatOfflineMessage=require(_0x10d9('0x1'))['db'][_0x10d9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x10d9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x10d9('0x4'),'afterDestroy':_0x10d9('0x5')};function emitEvent(_0x132a71){return function(_0x56ab5d,_0x2f6e57,_0x305c20){ChatOfflineMessageEvents[_0x10d9('0x6')](_0x132a71+':'+_0x56ab5d['id'],_0x56ab5d);ChatOfflineMessageEvents['emit'](_0x132a71,_0x56ab5d);_0x305c20(null);};}for(var e in events){if(events[_0x10d9('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x10d9('0x8')](e,emitEvent(event));}}module[_0x10d9('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x41be=['update','remove','emit','hook','exports','events','setMaxListeners'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x41be,0x11d));var _0xe41b=function(_0x23cc76,_0x9c756b){_0x23cc76=_0x23cc76-0x0;var _0x2f5c13=_0x41be[_0x23cc76];return _0x2f5c13;};'use strict';var EventEmitter=require(_0xe41b('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe41b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe41b('0x2'),'afterDestroy':_0xe41b('0x3')};function emitEvent(_0x335c93){return function(_0x19cab3,_0x2e898c,_0x33e8c0){ChatOfflineMessageEvents[_0xe41b('0x4')](_0x335c93+':'+_0x19cab3['id'],_0x19cab3);ChatOfflineMessageEvents[_0xe41b('0x4')](_0x335c93,_0x19cab3);_0x33e8c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xe41b('0x5')](e,emitEvent(event));}}module[_0xe41b('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index d25a3c8..cea14a4 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 _0x211b=['ChatOfflineMessage','chat_offline_messages','exports','define'];(function(_0x160734,_0x2f62c3){var _0x168888=function(_0x3f3a6e){while(--_0x3f3a6e){_0x160734['push'](_0x160734['shift']());}};_0x168888(++_0x2f62c3);}(_0x211b,0x1d2));var _0xb211=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x211b[_0x1ae5ab];return _0x1ce001;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xb211('0x0')]=function(_0x36e262){return _0x36e262[_0xb211('0x1')](_0xb211('0x2'),attributes,{'tableName':_0xb211('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x126d=['./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x40bb78,_0x4ea7da){var _0x2371b7=function(_0x4caedb){while(--_0x4caedb){_0x40bb78['push'](_0x40bb78['shift']());}};_0x2371b7(++_0x4ea7da);}(_0x126d,0x1bd));var _0xd126=function(_0x69f3aa,_0x2331f6){_0x69f3aa=_0x69f3aa-0x0;var _0xe7999a=_0x126d[_0x69f3aa];return _0xe7999a;};'use strict';var attributes=require(_0xd126('0x0'));module['exports']=function(_0x4b52d4){return _0x4b52d4[_0xd126('0x1')](_0xd126('0x2'),attributes,{'tableName':_0xd126('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd126('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6db1cb6..15aabcf 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 _0xceb3=['rpc','../../config/environment','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0xceb3,0xf5));var _0x3ceb=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xceb3[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require(_0x3ceb('0x0'));var util=require(_0x3ceb('0x1'));var moment=require(_0x3ceb('0x2'));var BPromise=require(_0x3ceb('0x3'));var rs=require(_0x3ceb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ceb('0x5'))['db'];var utils=require(_0x3ceb('0x6'));var logger=require(_0x3ceb('0x7'))(_0x3ceb('0x8'));var config=require(_0x3ceb('0x9'));var jayson=require(_0x3ceb('0xa'));var client=jayson[_0x3ceb('0xb')][_0x3ceb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x245f31,_0x1467cd,_0xdd8862){return new BPromise(function(_0x433147,_0x3c5dd9){return client['request'](_0x245f31,_0xdd8862)['then'](function(_0x3bb28d){logger[_0x3ceb('0xd')](_0x3ceb('0xe'),_0x1467cd,_0x3ceb('0xf'));logger['debug'](_0x3ceb('0x10'),_0x1467cd,'request\x20sent',JSON[_0x3ceb('0x11')](_0x3bb28d));if(_0x3bb28d[_0x3ceb('0x12')]){if(_0x3bb28d[_0x3ceb('0x12')][_0x3ceb('0x13')]===0x1f4){logger[_0x3ceb('0x12')](_0x3ceb('0xe'),_0x1467cd,_0x3bb28d[_0x3ceb('0x12')][_0x3ceb('0x14')]);return _0x3c5dd9(_0x3bb28d[_0x3ceb('0x12')]['message']);}logger[_0x3ceb('0x12')](_0x3ceb('0xe'),_0x1467cd,_0x3bb28d[_0x3ceb('0x12')][_0x3ceb('0x14')]);return _0x433147(_0x3bb28d[_0x3ceb('0x12')]['message']);}else{logger[_0x3ceb('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1467cd,'request\x20sent');_0x433147(_0x3bb28d[_0x3ceb('0x15')][_0x3ceb('0x14')]);}})[_0x3ceb('0x16')](function(_0x506d40){logger[_0x3ceb('0x12')](_0x3ceb('0xe'),_0x1467cd,_0x506d40);_0x3c5dd9(_0x506d40);});});} \ No newline at end of file +var _0x0a52=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x3965de,_0x4a3560){var _0x347113=function(_0x5bc637){while(--_0x5bc637){_0x3965de['push'](_0x3965de['shift']());}};_0x347113(++_0x4a3560);}(_0x0a52,0xe4));var _0x20a5=function(_0x22d299,_0x1d1a10){_0x22d299=_0x22d299-0x0;var _0x2360d0=_0x0a52[_0x22d299];return _0x2360d0;};'use strict';var _=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var moment=require('moment');var BPromise=require(_0x20a5('0x2'));var rs=require(_0x20a5('0x3'));var fs=require('fs');var Redis=require(_0x20a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20a5('0x5'));var logger=require(_0x20a5('0x6'))(_0x20a5('0x7'));var config=require(_0x20a5('0x8'));var jayson=require(_0x20a5('0x9'));var client=jayson[_0x20a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56b172,_0x39920b,_0x1f44fd){return new BPromise(function(_0x478779,_0x37196c){return client[_0x20a5('0xb')](_0x56b172,_0x1f44fd)[_0x20a5('0xc')](function(_0xcf7c56){logger['info'](_0x20a5('0xd'),_0x39920b,_0x20a5('0xe'));logger[_0x20a5('0xf')](_0x20a5('0x10'),_0x39920b,_0x20a5('0xe'),JSON[_0x20a5('0x11')](_0xcf7c56));if(_0xcf7c56[_0x20a5('0x12')]){if(_0xcf7c56[_0x20a5('0x12')]['code']===0x1f4){logger[_0x20a5('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x39920b,_0xcf7c56[_0x20a5('0x12')][_0x20a5('0x13')]);return _0x37196c(_0xcf7c56['error'][_0x20a5('0x13')]);}logger[_0x20a5('0x12')](_0x20a5('0xd'),_0x39920b,_0xcf7c56[_0x20a5('0x12')][_0x20a5('0x13')]);return _0x478779(_0xcf7c56[_0x20a5('0x12')][_0x20a5('0x13')]);}else{logger[_0x20a5('0x14')](_0x20a5('0xd'),_0x39920b,_0x20a5('0xe'));_0x478779(_0xcf7c56[_0x20a5('0x15')][_0x20a5('0x13')]);}})['catch'](function(_0x2ea9ab){logger['error'](_0x20a5('0xd'),_0x39920b,_0x2ea9ab);_0x37196c(_0x2ea9ab);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0033e5e..aa21330 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 _0x0fdb=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','describe','isAuthenticated'];(function(_0x43469e,_0x4e69d6){var _0xcefd2a=function(_0x8ded6f){while(--_0x8ded6f){_0x43469e['push'](_0x43469e['shift']());}};_0xcefd2a(++_0x4e69d6);}(_0x0fdb,0x110));var _0xb0fd=function(_0x53308b,_0x28dc1a){_0x53308b=_0x53308b-0x0;var _0x5eac23=_0x0fdb[_0x53308b];return _0x5eac23;};'use strict';var multer=require('multer');var util=require(_0xb0fd('0x0'));var path=require(_0xb0fd('0x1'));var timeout=require(_0xb0fd('0x2'));var express=require(_0xb0fd('0x3'));var router=express[_0xb0fd('0x4')]();var fs_extra=require(_0xb0fd('0x5'));var auth=require(_0xb0fd('0x6'));var interaction=require(_0xb0fd('0x7'));var config=require(_0xb0fd('0x8'));var controller=require(_0xb0fd('0x9'));router[_0xb0fd('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb0fd('0xa')](_0xb0fd('0xb'),auth['isAuthenticated'](),controller[_0xb0fd('0xc')]);router[_0xb0fd('0xa')]('/:id',auth[_0xb0fd('0xd')](),controller[_0xb0fd('0xe')]);router[_0xb0fd('0xf')]('/',auth[_0xb0fd('0xd')](),controller[_0xb0fd('0x10')]);router[_0xb0fd('0x11')]('/:id',auth[_0xb0fd('0xd')](),controller[_0xb0fd('0x12')]);router[_0xb0fd('0x13')]('/:id',auth[_0xb0fd('0xd')](),controller[_0xb0fd('0x14')]);module[_0xb0fd('0x15')]=router; \ No newline at end of file +var _0xdd79=['/describe','isAuthenticated','show','post','create','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index'];(function(_0x7f816c,_0x25f12e){var _0x9106ca=function(_0x9958b3){while(--_0x9958b3){_0x7f816c['push'](_0x7f816c['shift']());}};_0x9106ca(++_0x25f12e);}(_0xdd79,0x128));var _0x9dd7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd79[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x9dd7('0x0'));var util=require(_0x9dd7('0x1'));var path=require('path');var timeout=require(_0x9dd7('0x2'));var express=require('express');var router=express[_0x9dd7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9dd7('0x4'));var interaction=require(_0x9dd7('0x5'));var config=require(_0x9dd7('0x6'));var controller=require(_0x9dd7('0x7'));router[_0x9dd7('0x8')]('/',auth['isAuthenticated'](),controller[_0x9dd7('0x9')]);router['get'](_0x9dd7('0xa'),auth[_0x9dd7('0xb')](),controller['describe']);router[_0x9dd7('0x8')]('/:id',auth[_0x9dd7('0xb')](),controller[_0x9dd7('0xc')]);router[_0x9dd7('0xd')]('/',auth[_0x9dd7('0xb')](),controller[_0x9dd7('0xe')]);router['put']('/:id',auth[_0x9dd7('0xb')](),controller['update']);router['delete'](_0x9dd7('0xf'),auth[_0x9dd7('0xb')](),controller[_0x9dd7('0x10')]);module[_0x9dd7('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d40ea06..1bcf0d8 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 _0xd9ff=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x19cf1f,_0x4105e3){var _0x234028=function(_0x24748c){while(--_0x24748c){_0x19cf1f['push'](_0x19cf1f['shift']());}};_0x234028(++_0x4105e3);}(_0xd9ff,0x1e6));var _0xfd9f=function(_0x52e22e,_0x3674e9){_0x52e22e=_0x52e22e-0x0;var _0xb79010=_0xd9ff[_0x52e22e];return _0xb79010;};'use strict';var Sequelize=require(_0xfd9f('0x0'));module[_0xfd9f('0x1')]={'name':{'type':Sequelize[_0xfd9f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfd9f('0x3')](_0xfd9f('0x4'),_0xfd9f('0x5')),'defaultValue':_0xfd9f('0x4')},'selector':{'type':Sequelize[_0xfd9f('0x2')]},'timeout':{'type':Sequelize[_0xfd9f('0x6')]}}; \ No newline at end of file +var _0x9c8c=['exports','STRING','mouseOver','INTEGER','sequelize'];(function(_0x2dad33,_0x314bb4){var _0x2dc233=function(_0x36282c){while(--_0x36282c){_0x2dad33['push'](_0x2dad33['shift']());}};_0x2dc233(++_0x314bb4);}(_0x9c8c,0x1ee));var _0xc9c8=function(_0x2335ca,_0x1db94a){_0x2335ca=_0x2335ca-0x0;var _0x21631c=_0x9c8c[_0x2335ca];return _0x21631c;};'use strict';var Sequelize=require(_0xc9c8('0x0'));module[_0xc9c8('0x1')]={'name':{'type':Sequelize[_0xc9c8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc9c8('0x3'),'timeout'),'defaultValue':_0xc9c8('0x3')},'selector':{'type':Sequelize[_0xc9c8('0x2')]},'timeout':{'type':Sequelize[_0xc9c8('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d7b4766..c3415ab 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 _0x7a2d=['destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','then'];(function(_0x4f4643,_0x1d2526){var _0x383711=function(_0x519da6){while(--_0x519da6){_0x4f4643['push'](_0x4f4643['shift']());}};_0x383711(++_0x1d2526);}(_0x7a2d,0x142));var _0xd7a2=function(_0x77f1ba,_0x55d5d7){_0x77f1ba=_0x77f1ba-0x0;var _0x2fe1dd=_0x7a2d[_0x77f1ba];return _0x2fe1dd;};'use strict';var emlformat=require(_0xd7a2('0x0'));var rimraf=require(_0xd7a2('0x1'));var zipdir=require(_0xd7a2('0x2'));var jsonpatch=require(_0xd7a2('0x3'));var rp=require(_0xd7a2('0x4'));var moment=require(_0xd7a2('0x5'));var BPromise=require(_0xd7a2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd7a2('0x7'));var sox=require(_0xd7a2('0x8'));var csv=require(_0xd7a2('0x9'));var ejs=require(_0xd7a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7a2('0xb'));var squel=require(_0xd7a2('0xc'));var crypto=require(_0xd7a2('0xd'));var jsforce=require(_0xd7a2('0xe'));var deskjs=require(_0xd7a2('0xf'));var toCsv=require(_0xd7a2('0x9'));var querystring=require(_0xd7a2('0x10'));var Papa=require(_0xd7a2('0x11'));var Redis=require(_0xd7a2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd7a2('0x13'));var as=require(_0xd7a2('0x14'));var hardwareService=require(_0xd7a2('0x15'));var logger=require(_0xd7a2('0x16'))(_0xd7a2('0x17'));var utils=require(_0xd7a2('0x18'));var config=require(_0xd7a2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x72ff99,_0x4d8a97){_0x4d8a97=_0x4d8a97||0xcc;return function(_0x58cde8){if(_0x58cde8){return _0x72ff99[_0xd7a2('0x1a')](_0x4d8a97);}return _0x72ff99[_0xd7a2('0x1b')](_0x4d8a97)[_0xd7a2('0x1c')]();};}function respondWithResult(_0x3724c5,_0x37f995){_0x37f995=_0x37f995||0xc8;return function(_0x42a6c5){if(_0x42a6c5){return _0x3724c5[_0xd7a2('0x1b')](_0x37f995)[_0xd7a2('0x1d')](_0x42a6c5);}};}function respondWithFilteredResult(_0x16e2d6,_0x292f64){return function(_0x47b226){if(_0x47b226){var _0x2dc1b7=typeof _0x292f64['offset']==='undefined'&&typeof _0x292f64[_0xd7a2('0x1e')]===_0xd7a2('0x1f');var _0x2e8c80=_0x47b226[_0xd7a2('0x20')];var _0x296784=_0x2dc1b7?0x0:_0x292f64[_0xd7a2('0x21')];var _0x510caa=_0x2dc1b7?_0x47b226['count']:_0x292f64[_0xd7a2('0x21')]+_0x292f64[_0xd7a2('0x1e')];var _0x2653b1;if(_0x510caa>=_0x2e8c80){_0x510caa=_0x2e8c80;_0x2653b1=0xc8;}else{_0x2653b1=0xce;}_0x16e2d6['status'](_0x2653b1);return _0x16e2d6['set'](_0xd7a2('0x22'),_0x296784+'-'+_0x510caa+'/'+_0x2e8c80)['json'](_0x47b226);}return null;};}function patchUpdates(_0x4f885a){return function(_0x217c19){try{jsonpatch['apply'](_0x217c19,_0x4f885a,!![]);}catch(_0x5b50d9){return BPromise[_0xd7a2('0x23')](_0x5b50d9);}return _0x217c19['save']();};}function saveUpdates(_0x5bd05f,_0x4fc69c){return function(_0x21da02){if(_0x21da02){return _0x21da02[_0xd7a2('0x24')](_0x5bd05f)[_0xd7a2('0x25')](function(_0x21be90){return _0x21be90;});}return null;};}function removeEntity(_0x2b17ca,_0x3a2be7){return function(_0x2bfde1){if(_0x2bfde1){return _0x2bfde1[_0xd7a2('0x26')]()[_0xd7a2('0x25')](function(){_0x2b17ca[_0xd7a2('0x1b')](0xcc)[_0xd7a2('0x1c')]();});}};}function handleEntityNotFound(_0x2601b3,_0x1c3580){return function(_0x5caa05){if(!_0x5caa05){_0x2601b3['sendStatus'](0x194);}return _0x5caa05;};}function handleError(_0x11a498,_0x52b1b4){_0x52b1b4=_0x52b1b4||0x1f4;return function(_0x41e24b){logger['error'](_0x41e24b[_0xd7a2('0x27')]);if(_0x41e24b[_0xd7a2('0x28')]){delete _0x41e24b[_0xd7a2('0x28')];}_0x11a498[_0xd7a2('0x1b')](_0x52b1b4)[_0xd7a2('0x29')](_0x41e24b);};}exports[_0xd7a2('0x2a')]=function(_0x1a69e4,_0x303dc5){var _0x43b81c={'raw':!![],'where':{'id':_0x1a69e4[_0xd7a2('0x2b')]['id']}},_0x410cce={};_0x410cce[_0xd7a2('0x2c')]=_[_0xd7a2('0x2d')](db[_0xd7a2('0x2e')][_0xd7a2('0x2f')]);_0x410cce['query']=_[_0xd7a2('0x2d')](_0x1a69e4[_0xd7a2('0x30')]);_0x410cce['filters']=_[_0xd7a2('0x31')](_0x410cce[_0xd7a2('0x2c')],_0x410cce['query']);_0x43b81c[_0xd7a2('0x32')]=_[_0xd7a2('0x31')](_0x410cce[_0xd7a2('0x2c')],qs['fields'](_0x1a69e4[_0xd7a2('0x30')][_0xd7a2('0x33')]));_0x43b81c[_0xd7a2('0x32')]=_0x43b81c['attributes'][_0xd7a2('0x34')]?_0x43b81c['attributes']:_0x410cce[_0xd7a2('0x2c')];if(_0x1a69e4[_0xd7a2('0x30')][_0xd7a2('0x35')]){_0x43b81c[_0xd7a2('0x36')]=[{'all':!![]}];}_0x43b81c=_['merge']({},_0x43b81c,_0x1a69e4[_0xd7a2('0x37')]);return db[_0xd7a2('0x2e')][_0xd7a2('0x38')](_0x43b81c)[_0xd7a2('0x25')](handleEntityNotFound(_0x303dc5,null))['then'](respondWithResult(_0x303dc5,null))[_0xd7a2('0x39')](handleError(_0x303dc5,null));};exports[_0xd7a2('0x3a')]=function(_0x2bd3a6,_0x446153){return db[_0xd7a2('0x2e')][_0xd7a2('0x3a')](_0x2bd3a6[_0xd7a2('0x3b')],{})[_0xd7a2('0x25')](respondWithResult(_0x446153,0xc9))[_0xd7a2('0x39')](handleError(_0x446153,null));};exports['update']=function(_0x356375,_0x475fae){if(_0x356375[_0xd7a2('0x3b')]['id']){delete _0x356375[_0xd7a2('0x3b')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x356375[_0xd7a2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x475fae,null))[_0xd7a2('0x25')](saveUpdates(_0x356375[_0xd7a2('0x3b')],null))['then'](respondWithResult(_0x475fae,null))[_0xd7a2('0x39')](handleError(_0x475fae,null));};exports[_0xd7a2('0x26')]=function(_0x189e21,_0x392ffe){return db[_0xd7a2('0x2e')][_0xd7a2('0x38')]({'where':{'id':_0x189e21[_0xd7a2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x392ffe,null))['then'](removeEntity(_0x392ffe,null))[_0xd7a2('0x39')](handleError(_0x392ffe,null));}; \ No newline at end of file +var _0xb2b5=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','destroy','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4252fb,_0x2875b6){var _0x40b2ae=function(_0xf9ca79){while(--_0xf9ca79){_0x4252fb['push'](_0x4252fb['shift']());}};_0x40b2ae(++_0x2875b6);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb2b5[_0x160c73];return _0xd9302;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b2b('0x0'));var moment=require(_0x5b2b('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b2b('0x2'));var path=require(_0x5b2b('0x3'));var sox=require(_0x5b2b('0x4'));var csv=require(_0x5b2b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b2b('0x6'));var _=require(_0x5b2b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b2b('0x8'));var deskjs=require(_0x5b2b('0x9'));var toCsv=require(_0x5b2b('0x5'));var querystring=require(_0x5b2b('0xa'));var Papa=require(_0x5b2b('0xb'));var Redis=require(_0x5b2b('0xc'));var authService=require(_0x5b2b('0xd'));var qs=require(_0x5b2b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b2b('0xf'));var logger=require(_0x5b2b('0x10'))('api');var utils=require(_0x5b2b('0x11'));var config=require(_0x5b2b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b2b('0x13'))['db'];function respondWithStatusCode(_0x1a339a,_0xfe1936){_0xfe1936=_0xfe1936||0xcc;return function(_0x12f1f8){if(_0x12f1f8){return _0x1a339a[_0x5b2b('0x14')](_0xfe1936);}return _0x1a339a[_0x5b2b('0x15')](_0xfe1936)[_0x5b2b('0x16')]();};}function respondWithResult(_0x4bfe97,_0x30e9a3){_0x30e9a3=_0x30e9a3||0xc8;return function(_0x4fa243){if(_0x4fa243){return _0x4bfe97[_0x5b2b('0x15')](_0x30e9a3)[_0x5b2b('0x17')](_0x4fa243);}};}function respondWithFilteredResult(_0x3f5236,_0x2611a3){return function(_0x4ff4ba){if(_0x4ff4ba){var _0x310060=typeof _0x2611a3['offset']===_0x5b2b('0x18')&&typeof _0x2611a3['limit']==='undefined';var _0x44be6d=_0x4ff4ba[_0x5b2b('0x19')];var _0x5b6645=_0x310060?0x0:_0x2611a3[_0x5b2b('0x1a')];var _0x2db9ee=_0x310060?_0x4ff4ba[_0x5b2b('0x19')]:_0x2611a3[_0x5b2b('0x1a')]+_0x2611a3[_0x5b2b('0x1b')];var _0x47bb1b;if(_0x2db9ee>=_0x44be6d){_0x2db9ee=_0x44be6d;_0x47bb1b=0xc8;}else{_0x47bb1b=0xce;}_0x3f5236[_0x5b2b('0x15')](_0x47bb1b);return _0x3f5236[_0x5b2b('0x1c')](_0x5b2b('0x1d'),_0x5b6645+'-'+_0x2db9ee+'/'+_0x44be6d)[_0x5b2b('0x17')](_0x4ff4ba);}return null;};}function patchUpdates(_0x1b994d){return function(_0x42f0ed){try{jsonpatch[_0x5b2b('0x1e')](_0x42f0ed,_0x1b994d,!![]);}catch(_0x208c1f){return BPromise[_0x5b2b('0x1f')](_0x208c1f);}return _0x42f0ed[_0x5b2b('0x20')]();};}function saveUpdates(_0x34c624,_0xa8ebd5){return function(_0x2de273){if(_0x2de273){return _0x2de273[_0x5b2b('0x21')](_0x34c624)['then'](function(_0x5e0add){return _0x5e0add;});}return null;};}function removeEntity(_0xfdaeed,_0x58e346){return function(_0x3a530f){if(_0x3a530f){return _0x3a530f['destroy']()[_0x5b2b('0x22')](function(){_0xfdaeed[_0x5b2b('0x15')](0xcc)[_0x5b2b('0x16')]();});}};}function handleEntityNotFound(_0x37cbd8,_0x33a88c){return function(_0x564c21){if(!_0x564c21){_0x37cbd8[_0x5b2b('0x14')](0x194);}return _0x564c21;};}function handleError(_0x3e97dc,_0x55b05c){_0x55b05c=_0x55b05c||0x1f4;return function(_0x3fd917){logger[_0x5b2b('0x23')](_0x3fd917['stack']);if(_0x3fd917[_0x5b2b('0x24')]){delete _0x3fd917[_0x5b2b('0x24')];}_0x3e97dc[_0x5b2b('0x15')](_0x55b05c)[_0x5b2b('0x25')](_0x3fd917);};}exports[_0x5b2b('0x26')]=function(_0x94d866,_0x57284a){var _0x2c80be={'raw':!![],'where':{'id':_0x94d866[_0x5b2b('0x27')]['id']}},_0x42b46c={};_0x42b46c[_0x5b2b('0x28')]=_[_0x5b2b('0x29')](db['ChatProactiveAction'][_0x5b2b('0x2a')]);_0x42b46c[_0x5b2b('0x2b')]=_[_0x5b2b('0x29')](_0x94d866[_0x5b2b('0x2b')]);_0x42b46c[_0x5b2b('0x2c')]=_[_0x5b2b('0x2d')](_0x42b46c['model'],_0x42b46c[_0x5b2b('0x2b')]);_0x2c80be[_0x5b2b('0x2e')]=_[_0x5b2b('0x2d')](_0x42b46c[_0x5b2b('0x28')],qs[_0x5b2b('0x2f')](_0x94d866[_0x5b2b('0x2b')][_0x5b2b('0x2f')]));_0x2c80be[_0x5b2b('0x2e')]=_0x2c80be[_0x5b2b('0x2e')][_0x5b2b('0x30')]?_0x2c80be['attributes']:_0x42b46c[_0x5b2b('0x28')];if(_0x94d866[_0x5b2b('0x2b')][_0x5b2b('0x31')]){_0x2c80be[_0x5b2b('0x32')]=[{'all':!![]}];}_0x2c80be=_[_0x5b2b('0x33')]({},_0x2c80be,_0x94d866[_0x5b2b('0x34')]);return db[_0x5b2b('0x35')][_0x5b2b('0x36')](_0x2c80be)[_0x5b2b('0x22')](handleEntityNotFound(_0x57284a,null))['then'](respondWithResult(_0x57284a,null))[_0x5b2b('0x37')](handleError(_0x57284a,null));};exports[_0x5b2b('0x38')]=function(_0x1f6b2f,_0xf0bed){return db['ChatProactiveAction']['create'](_0x1f6b2f[_0x5b2b('0x39')],{})['then'](respondWithResult(_0xf0bed,0xc9))[_0x5b2b('0x37')](handleError(_0xf0bed,null));};exports[_0x5b2b('0x21')]=function(_0x176eb4,_0x461515){if(_0x176eb4['body']['id']){delete _0x176eb4[_0x5b2b('0x39')]['id'];}return db[_0x5b2b('0x35')][_0x5b2b('0x36')]({'where':{'id':_0x176eb4[_0x5b2b('0x27')]['id']}})[_0x5b2b('0x22')](handleEntityNotFound(_0x461515,null))[_0x5b2b('0x22')](saveUpdates(_0x176eb4[_0x5b2b('0x39')],null))['then'](respondWithResult(_0x461515,null))['catch'](handleError(_0x461515,null));};exports[_0x5b2b('0x3a')]=function(_0xb4ad96,_0x4a97e0){return db[_0x5b2b('0x35')][_0x5b2b('0x36')]({'where':{'id':_0xb4ad96['params']['id']}})['then'](handleEntityNotFound(_0x4a97e0,null))['then'](removeEntity(_0x4a97e0,null))[_0x5b2b('0x37')](handleError(_0x4a97e0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index dd39c3f..58ac940 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 _0xc89d=['path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','moment'];(function(_0x29a4d5,_0x51eb8a){var _0xa9e951=function(_0x148e22){while(--_0x148e22){_0x29a4d5['push'](_0x29a4d5['shift']());}};_0xa9e951(++_0x51eb8a);}(_0xc89d,0x128));var _0xdc89=function(_0xf50207,_0x22ce0a){_0xf50207=_0xf50207-0x0;var _0x28e44a=_0xc89d[_0xf50207];return _0x28e44a;};'use strict';var _=require(_0xdc89('0x0'));var util=require(_0xdc89('0x1'));var logger=require(_0xdc89('0x2'))('api');var moment=require(_0xdc89('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc89('0x4'));var rimraf=require('rimraf');var config=require(_0xdc89('0x5'));var attributes=require(_0xdc89('0x6'));module[_0xdc89('0x7')]=function(_0x359333,_0x192304){return _0x359333[_0xdc89('0x8')](_0xdc89('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fab=['chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x126ad0,_0x4274d6){var _0x31cde4=function(_0x3be80c){while(--_0x3be80c){_0x126ad0['push'](_0x126ad0['shift']());}};_0x31cde4(++_0x4274d6);}(_0x6fab,0x1ae));var _0xb6fa=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x6fab[_0x242a4f];return _0x122117;};'use strict';var _=require(_0xb6fa('0x0'));var util=require('util');var logger=require(_0xb6fa('0x1'))('api');var moment=require(_0xb6fa('0x2'));var BPromise=require(_0xb6fa('0x3'));var rp=require(_0xb6fa('0x4'));var fs=require('fs');var path=require(_0xb6fa('0x5'));var rimraf=require('rimraf');var config=require(_0xb6fa('0x6'));var attributes=require(_0xb6fa('0x7'));module[_0xb6fa('0x8')]=function(_0x127bd8,_0xdd627f){return _0x127bd8[_0xb6fa('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xb6fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 1da71fb..265a883 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 _0x08fa=['http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','../../config/logger','../../config/environment','client'];(function(_0x5d8987,_0x14d054){var _0x2997eb=function(_0x56f92a){while(--_0x56f92a){_0x5d8987['push'](_0x5d8987['shift']());}};_0x2997eb(++_0x14d054);}(_0x08fa,0x12d));var _0xa08f=function(_0x1a6561,_0x18c449){_0x1a6561=_0x1a6561-0x0;var _0x531a9c=_0x08fa[_0x1a6561];return _0x531a9c;};'use strict';var _=require(_0xa08f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa08f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa08f('0x2'))('rpc');var config=require(_0xa08f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xa08f('0x4')][_0xa08f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2d3ca0,_0x5969fb,_0x1c5e1b){return new BPromise(function(_0x1f3223,_0x59c5a5){return client['request'](_0x2d3ca0,_0x1c5e1b)[_0xa08f('0x6')](function(_0x22f829){logger['info'](_0xa08f('0x7'),_0x5969fb,_0xa08f('0x8'));logger[_0xa08f('0x9')](_0xa08f('0xa'),_0x5969fb,_0xa08f('0x8'),JSON[_0xa08f('0xb')](_0x22f829));if(_0x22f829[_0xa08f('0xc')]){if(_0x22f829[_0xa08f('0xc')][_0xa08f('0xd')]===0x1f4){logger[_0xa08f('0xc')](_0xa08f('0x7'),_0x5969fb,_0x22f829[_0xa08f('0xc')][_0xa08f('0xe')]);return _0x59c5a5(_0x22f829[_0xa08f('0xc')][_0xa08f('0xe')]);}logger['error'](_0xa08f('0x7'),_0x5969fb,_0x22f829[_0xa08f('0xc')][_0xa08f('0xe')]);return _0x1f3223(_0x22f829[_0xa08f('0xc')][_0xa08f('0xe')]);}else{logger[_0xa08f('0xf')](_0xa08f('0x7'),_0x5969fb,_0xa08f('0x8'));_0x1f3223(_0x22f829[_0xa08f('0x10')][_0xa08f('0xe')]);}})[_0xa08f('0x11')](function(_0x4efb26){logger[_0xa08f('0xc')](_0xa08f('0x7'),_0x5969fb,_0x4efb26);_0x59c5a5(_0x4efb26);});});} \ No newline at end of file +var _0x82c4=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x15e73b,_0x191a5d){var _0x433c2a=function(_0x1ea70c){while(--_0x1ea70c){_0x15e73b['push'](_0x15e73b['shift']());}};_0x433c2a(++_0x191a5d);}(_0x82c4,0x19f));var _0x482c=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0x82c4[_0x52282a];return _0x3c66b4;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x482c('0x4'));var db=require(_0x482c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x6'))(_0x482c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x482c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33302c,_0x3b7a24,_0x75e0ec){return new BPromise(function(_0x4ef26f,_0xe5dc74){return client[_0x482c('0x9')](_0x33302c,_0x75e0ec)[_0x482c('0xa')](function(_0x2a8b34){logger[_0x482c('0xb')](_0x482c('0xc'),_0x3b7a24,'request\x20sent');logger[_0x482c('0xd')](_0x482c('0xe'),_0x3b7a24,_0x482c('0xf'),JSON[_0x482c('0x10')](_0x2a8b34));if(_0x2a8b34[_0x482c('0x11')]){if(_0x2a8b34[_0x482c('0x11')][_0x482c('0x12')]===0x1f4){logger[_0x482c('0x11')](_0x482c('0xc'),_0x3b7a24,_0x2a8b34[_0x482c('0x11')][_0x482c('0x13')]);return _0xe5dc74(_0x2a8b34[_0x482c('0x11')][_0x482c('0x13')]);}logger[_0x482c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b7a24,_0x2a8b34[_0x482c('0x11')][_0x482c('0x13')]);return _0x4ef26f(_0x2a8b34[_0x482c('0x11')][_0x482c('0x13')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x3b7a24,_0x482c('0xf'));_0x4ef26f(_0x2a8b34[_0x482c('0x14')]['message']);}})[_0x482c('0x15')](function(_0x2de2b6){logger[_0x482c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b7a24,_0x2de2b6);_0xe5dc74(_0x2de2b6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 22ae501..caa762d 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 _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x4a4d27,_0x2e0670){var _0x34d00b=function(_0x47c9bd){while(--_0x47c9bd){_0x4a4d27['push'](_0x4a4d27['shift']());}};_0x34d00b(++_0x2e0670);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2e5f15,_0x5c62c0){_0x2e5f15=_0x2e5f15-0x0;var _0x4624b4=_0x3f8a[_0x2e5f15];return _0x4624b4;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xa2ac9,_0xf07f28){var _0x690e9b=function(_0x5b2582){while(--_0x5b2582){_0xa2ac9['push'](_0xa2ac9['shift']());}};_0x690e9b(++_0xf07f28);}(_0x5d58,0x187));var _0x85d5=function(_0x2f949d,_0x310eba){_0x2f949d=_0x2f949d-0x0;var _0x217158=_0x5d58[_0x2f949d];return _0x217158;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 5331c30..208bf0c 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 _0xff8e=['beepall','sequelize','exports'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xff8e,0x7c));var _0xeff8=function(_0x474495,_0x50c083){_0x474495=_0x474495-0x0;var _0x2f3abf=_0xff8e[_0x474495];return _0x2f3abf;};'use strict';var Sequelize=require(_0xeff8('0x0'));module[_0xeff8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xeff8('0x2'),'roundrobin')}}; \ No newline at end of file +var _0x628b=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x628b,0x15c));var _0xb628=function(_0x4a4644,_0x45526c){_0x4a4644=_0x4a4644-0x0;var _0x14c6f2=_0x628b[_0x4a4644];return _0x14c6f2;};'use strict';var Sequelize=require(_0xb628('0x0'));module[_0xb628('0x1')]={'name':{'type':Sequelize[_0xb628('0x2')],'unique':_0xb628('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb628('0x2')]},'timeout':{'type':Sequelize[_0xb628('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb628('0x5')](_0xb628('0x6'),_0xb628('0x7'),_0xb628('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1180b81..c7ac943 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 _0x7870=['status','end','json','offset','undefined','limit','apply','reject','save','update','get','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','show','params','length','create','body','ChatQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','TeamId','includes','all','union','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x222f42,_0x54f2f5){var _0x28251a=function(_0x263c95){while(--_0x263c95){_0x222f42['push'](_0x222f42['shift']());}};_0x28251a(++_0x54f2f5);}(_0x7870,0x195));var _0x0787=function(_0x223d6d,_0x14e9e3){_0x223d6d=_0x223d6d-0x0;var _0x349dd0=_0x7870[_0x223d6d];return _0x349dd0;};'use strict';var emlformat=require(_0x0787('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0787('0x1'));var rp=require(_0x0787('0x2'));var moment=require(_0x0787('0x3'));var BPromise=require(_0x0787('0x4'));var Mustache=require(_0x0787('0x5'));var util=require('util');var path=require(_0x0787('0x6'));var sox=require(_0x0787('0x7'));var csv=require(_0x0787('0x8'));var ejs=require(_0x0787('0x9'));var fs=require('fs');var fs_extra=require(_0x0787('0xa'));var _=require('lodash');var squel=require(_0x0787('0xb'));var crypto=require(_0x0787('0xc'));var jsforce=require(_0x0787('0xd'));var deskjs=require(_0x0787('0xe'));var toCsv=require(_0x0787('0x8'));var querystring=require(_0x0787('0xf'));var Papa=require(_0x0787('0x10'));var Redis=require(_0x0787('0x11'));var authService=require(_0x0787('0x12'));var qs=require(_0x0787('0x13'));var as=require(_0x0787('0x14'));var hardwareService=require(_0x0787('0x15'));var logger=require(_0x0787('0x16'))(_0x0787('0x17'));var utils=require(_0x0787('0x18'));var config=require(_0x0787('0x19'));var licenseUtil=require(_0x0787('0x1a'));var db=require(_0x0787('0x1b'))['db'];config[_0x0787('0x1c')]=_[_0x0787('0x1d')](config['redis'],{'host':_0x0787('0x1e'),'port':0x18eb});var socket=require(_0x0787('0x1f'))(new Redis(config[_0x0787('0x1c')]));require('./chatQueue.socket')[_0x0787('0x20')](socket);var jayson=require(_0x0787('0x21'));var client=jayson[_0x0787('0x22')][_0x0787('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2d0a62,_0x314f9c,_0x2fcbdc,_0xdfc711){return new BPromise(function(_0x3e1176,_0x3532e4){var _0x299404=_0xdfc711||client;return _0x299404[_0x0787('0x24')](_0x2d0a62,_0x2fcbdc)[_0x0787('0x25')](function(_0x1f872a){logger[_0x0787('0x26')](_0x0787('0x27'),_0x314f9c,_0x0787('0x28'));logger['debug'](_0x0787('0x29'),_0x314f9c,'request\x20sent',JSON[_0x0787('0x2a')](_0x1f872a));if(_0x1f872a[_0x0787('0x2b')]){if(_0x1f872a[_0x0787('0x2b')][_0x0787('0x2c')]===0x1f4){logger['error'](_0x0787('0x27'),_0x314f9c,_0x1f872a[_0x0787('0x2b')]['message']);return _0x3532e4(_0x1f872a[_0x0787('0x2b')][_0x0787('0x2d')]);}logger[_0x0787('0x2b')](_0x0787('0x27'),_0x314f9c,_0x1f872a[_0x0787('0x2b')][_0x0787('0x2d')]);return _0x3e1176(_0x1f872a['error'][_0x0787('0x2d')]);}else{logger[_0x0787('0x26')](_0x0787('0x27'),_0x314f9c,_0x0787('0x28'));_0x3e1176(_0x1f872a[_0x0787('0x2e')][_0x0787('0x2d')]);}})[_0x0787('0x2f')](function(_0x58d4a0){logger[_0x0787('0x2b')](_0x0787('0x27'),_0x314f9c,_0x58d4a0);_0x3532e4(_0x58d4a0);});});}function respondWithStatusCode(_0x26cb57,_0x27d6ed){_0x27d6ed=_0x27d6ed||0xcc;return function(_0x5d5f0b){if(_0x5d5f0b){return _0x26cb57['sendStatus'](_0x27d6ed);}return _0x26cb57[_0x0787('0x30')](_0x27d6ed)[_0x0787('0x31')]();};}function respondWithResult(_0x222d64,_0x5a9d90){_0x5a9d90=_0x5a9d90||0xc8;return function(_0x3fe5f1){if(_0x3fe5f1){return _0x222d64[_0x0787('0x30')](_0x5a9d90)[_0x0787('0x32')](_0x3fe5f1);}};}function respondWithFilteredResult(_0x43297f,_0x16c162){return function(_0x548894){if(_0x548894){var _0x2ff4e4=typeof _0x16c162[_0x0787('0x33')]===_0x0787('0x34')&&typeof _0x16c162['limit']===_0x0787('0x34');var _0x595ddc=_0x548894['count'];var _0x5a01a3=_0x2ff4e4?0x0:_0x16c162[_0x0787('0x33')];var _0x25c937=_0x2ff4e4?_0x548894['count']:_0x16c162['offset']+_0x16c162[_0x0787('0x35')];var _0x421357;if(_0x25c937>=_0x595ddc){_0x25c937=_0x595ddc;_0x421357=0xc8;}else{_0x421357=0xce;}_0x43297f['status'](_0x421357);return _0x43297f['set']('Content-Range',_0x5a01a3+'-'+_0x25c937+'/'+_0x595ddc)[_0x0787('0x32')](_0x548894);}return null;};}function patchUpdates(_0x721c55){return function(_0x468585){try{jsonpatch[_0x0787('0x36')](_0x468585,_0x721c55,!![]);}catch(_0x5df64a){return BPromise[_0x0787('0x37')](_0x5df64a);}return _0x468585[_0x0787('0x38')]();};}function saveUpdates(_0x4112a5,_0x2e9f10){return function(_0xbbac62){if(_0xbbac62){return _0xbbac62[_0x0787('0x39')](_0x4112a5)[_0x0787('0x25')](function(_0x1277b9){return _0x1277b9;});}return null;};}function removeEntity(_0x18dcfc,_0xf5cf3){return function(_0x1e31a2){if(_0x1e31a2){return _0x1e31a2['destroy']()[_0x0787('0x25')](function(){var _0x205e8b=_0x1e31a2[_0x0787('0x3a')]({'plain':!![]});var _0xffe216='ChatQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0xffe216,'resourceId':_0x205e8b['id']}})[_0x0787('0x25')](function(){return _0x1e31a2;});})[_0x0787('0x25')](function(){_0x18dcfc[_0x0787('0x30')](0xcc)[_0x0787('0x31')]();});}};}function handleEntityNotFound(_0x380147,_0xd0675a){return function(_0x40ce8c){if(!_0x40ce8c){_0x380147['sendStatus'](0x194);}return _0x40ce8c;};}function handleError(_0x48b9c1,_0x2b4c9e){_0x2b4c9e=_0x2b4c9e||0x1f4;return function(_0x3e7c68){logger[_0x0787('0x2b')](_0x3e7c68[_0x0787('0x3b')]);if(_0x3e7c68[_0x0787('0x3c')]){delete _0x3e7c68[_0x0787('0x3c')];}_0x48b9c1[_0x0787('0x30')](_0x2b4c9e)[_0x0787('0x3d')](_0x3e7c68);};}exports[_0x0787('0x3e')]=function(_0x3cd39f,_0x276b27){var _0x2fc8d0={},_0x391b99={},_0x5a8feb={'count':0x0,'rows':[]};var _0x6da400=_[_0x0787('0x3f')](db[_0x0787('0x40')][_0x0787('0x41')],function(_0x1239f5){return{'name':_0x1239f5[_0x0787('0x42')],'type':_0x1239f5[_0x0787('0x43')][_0x0787('0x44')]};});_0x391b99[_0x0787('0x45')]=_[_0x0787('0x3f')](_0x6da400,_0x0787('0x3c'));_0x391b99['query']=_[_0x0787('0x46')](_0x3cd39f['query']);_0x391b99[_0x0787('0x47')]=_[_0x0787('0x48')](_0x391b99[_0x0787('0x45')],_0x391b99[_0x0787('0x49')]);_0x2fc8d0[_0x0787('0x4a')]=_[_0x0787('0x48')](_0x391b99[_0x0787('0x45')],qs[_0x0787('0x4b')](_0x3cd39f[_0x0787('0x49')][_0x0787('0x4b')]));_0x2fc8d0['attributes']=_0x2fc8d0[_0x0787('0x4a')]['length']?_0x2fc8d0[_0x0787('0x4a')]:_0x391b99[_0x0787('0x45')];if(!_0x3cd39f[_0x0787('0x49')][_0x0787('0x4c')](_0x0787('0x4d'))){_0x2fc8d0[_0x0787('0x35')]=qs[_0x0787('0x35')](_0x3cd39f[_0x0787('0x49')][_0x0787('0x35')]);_0x2fc8d0[_0x0787('0x33')]=qs['offset'](_0x3cd39f['query']['offset']);}_0x2fc8d0[_0x0787('0x4e')]=qs[_0x0787('0x4f')](_0x3cd39f['query'][_0x0787('0x4f')]);_0x2fc8d0[_0x0787('0x50')]=qs['filters'](_[_0x0787('0x51')](_0x3cd39f[_0x0787('0x49')],_0x391b99['filters']),_0x6da400);if(_0x3cd39f['query']['filter']){_0x2fc8d0[_0x0787('0x50')]=_[_0x0787('0x52')](_0x2fc8d0[_0x0787('0x50')],{'$or':_[_0x0787('0x3f')](_0x6da400,function(_0x4c74a8){if(_0x4c74a8[_0x0787('0x43')]!==_0x0787('0x53')){var _0x39b00b={};_0x39b00b[_0x4c74a8[_0x0787('0x3c')]]={'$like':'%'+_0x3cd39f[_0x0787('0x49')][_0x0787('0x54')]+'%'};return _0x39b00b;}})});}_0x2fc8d0=_[_0x0787('0x52')]({},_0x2fc8d0,_0x3cd39f[_0x0787('0x55')]);var _0x58de81={'where':_0x2fc8d0['where']};return db[_0x0787('0x40')][_0x0787('0x56')](_0x58de81)[_0x0787('0x25')](function(_0x5a5ed8){_0x5a8feb['count']=_0x5a5ed8;if(_0x3cd39f[_0x0787('0x49')]['includeAll']){_0x2fc8d0[_0x0787('0x57')]=[{'all':!![]}];}return db[_0x0787('0x40')][_0x0787('0x58')](_0x2fc8d0);})['then'](function(_0x3970d2){_0x5a8feb['rows']=_0x3970d2;return _0x5a8feb;})[_0x0787('0x25')](respondWithFilteredResult(_0x276b27,_0x2fc8d0))[_0x0787('0x2f')](handleError(_0x276b27,null));};exports[_0x0787('0x59')]=function(_0x4f67f9,_0x53f1df){var _0x2be5a3={'raw':!![],'where':{'id':_0x4f67f9[_0x0787('0x5a')]['id']}},_0x2f0722={};_0x2f0722[_0x0787('0x45')]=_[_0x0787('0x46')](db[_0x0787('0x40')][_0x0787('0x41')]);_0x2f0722[_0x0787('0x49')]=_[_0x0787('0x46')](_0x4f67f9[_0x0787('0x49')]);_0x2f0722[_0x0787('0x47')]=_[_0x0787('0x48')](_0x2f0722['model'],_0x2f0722[_0x0787('0x49')]);_0x2be5a3[_0x0787('0x4a')]=_[_0x0787('0x48')](_0x2f0722[_0x0787('0x45')],qs[_0x0787('0x4b')](_0x4f67f9[_0x0787('0x49')]['fields']));_0x2be5a3[_0x0787('0x4a')]=_0x2be5a3[_0x0787('0x4a')][_0x0787('0x5b')]?_0x2be5a3[_0x0787('0x4a')]:_0x2f0722[_0x0787('0x45')];if(_0x4f67f9[_0x0787('0x49')]['includeAll']){_0x2be5a3[_0x0787('0x57')]=[{'all':!![]}];}_0x2be5a3=_['merge']({},_0x2be5a3,_0x4f67f9[_0x0787('0x55')]);return db[_0x0787('0x40')]['find'](_0x2be5a3)[_0x0787('0x25')](handleEntityNotFound(_0x53f1df,null))[_0x0787('0x25')](respondWithResult(_0x53f1df,null))[_0x0787('0x2f')](handleError(_0x53f1df,null));};exports[_0x0787('0x5c')]=function(_0x229a23,_0x521619){return db[_0x0787('0x40')][_0x0787('0x5c')](_0x229a23[_0x0787('0x5d')],{})['then'](function(_0x519568){var _0x38838e=_0x229a23['user'][_0x0787('0x3a')]({'plain':!![]});if(!_0x38838e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38838e['role']==='user'){var _0x1a3b9b=_0x519568[_0x0787('0x3a')]({'plain':!![]});var _0x764a96=_0x0787('0x5e');return db[_0x0787('0x5f')]['find']({'where':{'name':_0x764a96,'userProfileId':_0x38838e[_0x0787('0x60')]},'raw':!![]})[_0x0787('0x25')](function(_0xc80f5b){if(_0xc80f5b&&_0xc80f5b[_0x0787('0x61')]===0x0){return db[_0x0787('0x62')]['create']({'name':_0x1a3b9b['name'],'resourceId':_0x1a3b9b['id'],'type':_0xc80f5b['name'],'sectionId':_0xc80f5b['id']},{})[_0x0787('0x25')](function(){return _0x519568;});}else{return _0x519568;}})[_0x0787('0x2f')](function(_0x41e8a3){logger[_0x0787('0x2b')](_0x0787('0x63'),_0x41e8a3);throw _0x41e8a3;});}return _0x519568;})[_0x0787('0x25')](respondWithResult(_0x521619,0xc9))[_0x0787('0x2f')](handleError(_0x521619,null));};exports['update']=function(_0x4181e9,_0x59a00b){if(_0x4181e9[_0x0787('0x5d')]['id']){delete _0x4181e9[_0x0787('0x5d')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x4181e9[_0x0787('0x5a')]['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x59a00b,null))['then'](saveUpdates(_0x4181e9[_0x0787('0x5d')],null))[_0x0787('0x25')](respondWithResult(_0x59a00b,null))[_0x0787('0x2f')](handleError(_0x59a00b,null));};exports['destroy']=function(_0x5a77bb,_0x59b58f){return db['ChatQueue'][_0x0787('0x64')]({'where':{'id':_0x5a77bb['params']['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x59b58f,null))[_0x0787('0x25')](removeEntity(_0x59b58f,null))[_0x0787('0x2f')](handleError(_0x59b58f,null));};exports['describe']=function(_0x36967e,_0x2d4a09){return db[_0x0787('0x40')][_0x0787('0x65')]()['then'](respondWithResult(_0x2d4a09,null))['catch'](handleError(_0x2d4a09,null));};exports['getMembers']=function(_0x296c18,_0x5e5e63,_0x414995){var _0x970265={'raw':!![],'where':{}},_0x3c5844={},_0x5cf35;return db[_0x0787('0x40')][_0x0787('0x66')]({'where':{'id':_0x296c18[_0x0787('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e5e63,null))['then'](function(_0x44860a){if(_0x44860a){_0x5cf35=_0x44860a[_0x0787('0x3a')]({'plain':!![]});_0x3c5844['model']=_[_0x0787('0x46')](db[_0x0787('0x67')][_0x0787('0x41')]);_0x3c5844[_0x0787('0x49')]=_[_0x0787('0x46')](_0x296c18[_0x0787('0x49')]);_0x3c5844[_0x0787('0x47')]=_[_0x0787('0x48')](_0x3c5844['model'],_0x3c5844[_0x0787('0x49')]);_0x970265[_0x0787('0x4a')]=_['intersection'](_0x3c5844[_0x0787('0x45')],qs[_0x0787('0x4b')](_0x296c18[_0x0787('0x49')][_0x0787('0x4b')]));_0x970265[_0x0787('0x4a')]=_0x970265[_0x0787('0x4a')]['length']?_0x970265['attributes']:_0x3c5844[_0x0787('0x45')];if(!_0x296c18[_0x0787('0x49')][_0x0787('0x4c')](_0x0787('0x4d'))){_0x970265[_0x0787('0x35')]=qs[_0x0787('0x35')](_0x296c18[_0x0787('0x49')][_0x0787('0x35')]);_0x970265['offset']=qs[_0x0787('0x33')](_0x296c18[_0x0787('0x49')][_0x0787('0x33')]);}_0x970265[_0x0787('0x4e')]=qs[_0x0787('0x4f')](_0x296c18[_0x0787('0x49')][_0x0787('0x4f')]);_0x970265[_0x0787('0x50')]=qs[_0x0787('0x47')](_[_0x0787('0x51')](_0x296c18[_0x0787('0x49')],_0x3c5844[_0x0787('0x47')]));_0x970265[_0x0787('0x50')]['ChatQueueId']=_0x44860a['id'];if(_0x296c18[_0x0787('0x49')][_0x0787('0x54')]){_0x970265[_0x0787('0x50')]=_[_0x0787('0x52')](_0x970265[_0x0787('0x50')],{'$or':_[_0x0787('0x3f')](_0x970265[_0x0787('0x4a')],function(_0x1160bc){var _0x2fb6a6={};_0x2fb6a6[_0x1160bc]={'$like':'%'+_0x296c18[_0x0787('0x49')][_0x0787('0x54')]+'%'};return _0x2fb6a6;})});}_0x970265=_['merge']({},_0x970265,_0x296c18['options']);return db[_0x0787('0x67')]['findAll'](_0x970265);}})[_0x0787('0x25')](function(_0x310c1b){if(_0x310c1b){return db[_0x0787('0x68')][_0x0787('0x69')]({'where':{'id':_[_0x0787('0x3f')](_0x310c1b,_0x0787('0x6a')),'role':_0x0787('0x6b')},'attributes':['id','name',_0x0787('0x6c'),_0x0787('0x6d'),_0x0787('0x6e')]});}})[_0x0787('0x25')](function(_0x5e0f48){if(_0x5e0f48){return{'count':_0x5e0f48[_0x0787('0x56')],'rows':_[_0x0787('0x3f')](_0x5e0f48[_0x0787('0x6f')],function(_0x555e4b){return{'membername':_0x555e4b[_0x0787('0x3c')],'UserId':_0x555e4b['id'],'queue_name':_0x5cf35[_0x0787('0x3c')],'ChatQueueId':_0x5cf35['id'],'interface':util[_0x0787('0x70')](_0x0787('0x71'),'SIP',_0x555e4b[_0x0787('0x3c')]),'penalty':0x0,'paused':_0x555e4b['chatPause'],'createdAt':_0x555e4b[_0x0787('0x6e')],'updatedAt':_0x555e4b[_0x0787('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0787('0x25')](respondWithFilteredResult(_0x5e5e63,_0x970265))[_0x0787('0x2f')](handleError(_0x5e5e63,null));};exports[_0x0787('0x72')]=function(_0x37d4b7,_0x3d474f,_0x59d4ad){var _0x1e9f4f={};var _0x384840={};var _0x27275e;var _0x2a5775;return db['ChatQueue']['findOne']({'where':{'id':_0x37d4b7[_0x0787('0x5a')]['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x3d474f,null))[_0x0787('0x25')](function(_0x33c12c){if(_0x33c12c){_0x27275e=_0x33c12c;_0x384840['model']=_[_0x0787('0x46')](db[_0x0787('0x73')][_0x0787('0x41')]);_0x384840['query']=_[_0x0787('0x46')](_0x37d4b7[_0x0787('0x49')]);_0x384840[_0x0787('0x47')]=_['intersection'](_0x384840[_0x0787('0x45')],_0x384840[_0x0787('0x49')]);_0x1e9f4f['attributes']=_[_0x0787('0x48')](_0x384840[_0x0787('0x45')],qs[_0x0787('0x4b')](_0x37d4b7[_0x0787('0x49')][_0x0787('0x4b')]));_0x1e9f4f[_0x0787('0x4a')]=_0x1e9f4f[_0x0787('0x4a')][_0x0787('0x5b')]?_0x1e9f4f[_0x0787('0x4a')]:_0x384840[_0x0787('0x45')];_0x1e9f4f[_0x0787('0x4e')]=qs[_0x0787('0x4f')](_0x37d4b7[_0x0787('0x49')][_0x0787('0x4f')]);_0x1e9f4f[_0x0787('0x50')]=qs['filters'](_[_0x0787('0x51')](_0x37d4b7[_0x0787('0x49')],_0x384840['filters']));if(_0x37d4b7['query'][_0x0787('0x54')]){_0x1e9f4f[_0x0787('0x50')]=_[_0x0787('0x52')](_0x1e9f4f[_0x0787('0x50')],{'$or':_['map'](_0x1e9f4f[_0x0787('0x4a')],function(_0x16b520){var _0x38374d={};_0x38374d[_0x16b520]={'$like':'%'+_0x37d4b7[_0x0787('0x49')][_0x0787('0x54')]+'%'};return _0x38374d;})});}_0x1e9f4f=_[_0x0787('0x52')]({},_0x1e9f4f,_0x37d4b7[_0x0787('0x55')]);return _0x27275e['getTeams'](_0x1e9f4f);}})[_0x0787('0x25')](function(_0x502e95){if(_0x502e95){_0x2a5775=_0x502e95[_0x0787('0x5b')];if(!_0x37d4b7[_0x0787('0x49')]['hasOwnProperty'](_0x0787('0x4d'))){_0x1e9f4f[_0x0787('0x35')]=qs[_0x0787('0x35')](_0x37d4b7[_0x0787('0x49')]['limit']);_0x1e9f4f['offset']=qs[_0x0787('0x33')](_0x37d4b7[_0x0787('0x49')][_0x0787('0x33')]);}return _0x27275e[_0x0787('0x72')](_0x1e9f4f);}})[_0x0787('0x25')](function(_0x4638a3){if(_0x4638a3){return _0x4638a3?{'count':_0x2a5775,'rows':_0x4638a3}:null;}})[_0x0787('0x25')](respondWithResult(_0x3d474f,null))[_0x0787('0x2f')](handleError(_0x3d474f,null));};exports[_0x0787('0x74')]=function(_0x309327,_0x54b68e,_0x2d4833){var _0x1e1663=_0x309327[_0x0787('0x5d')][_0x0787('0x75')];return db[_0x0787('0x73')][_0x0787('0x58')]({'where':{'id':_0x1e1663},'attributes':['id'],'include':[{'model':db[_0x0787('0x68')],'as':'Agents','attributes':['id',_0x0787('0x3c'),_0x0787('0x76'),_0x0787('0x77'),'interface'],'raw':!![]}]})[_0x0787('0x25')](function(_0x14692d){if(_0x14692d){var _0x5063d6=_[_0x0787('0x78')](_0x14692d,function(_0x3b4b3d){var _0x4dea2e=_0x3b4b3d[_0x0787('0x3a')]({'plain':!![]});return _0x4dea2e[_0x0787('0x79')];});return db[_0x0787('0x40')][_0x0787('0x64')]({'where':{'id':_0x309327['params']['id']}})[_0x0787('0x25')](function(_0x4702f5){return db[_0x0787('0x7a')][_0x0787('0x7b')](function(_0x4bb85d){return _0x4702f5[_0x0787('0x74')](_0x1e1663,{'transaction':_0x4bb85d})[_0x0787('0x25')](function(){return BPromise[_0x0787('0x7c')](_0x5063d6,function(_0x1f1aa1){return db[_0x0787('0x67')][_0x0787('0x7d')]({'where':{'UserId':_0x1f1aa1['id'],'ChatQueueId':_0x309327[_0x0787('0x5a')]['id']},'transaction':_0x4bb85d});});})[_0x0787('0x25')](function(){_0x5063d6[_0x0787('0x7e')](function(_0x90420e){socket[_0x0787('0x7f')](_0x0787('0x80'),{'UserId':_0x90420e['id'],'ChatQueueId':_0x4702f5['id']});});});});});}})['then'](respondWithStatusCode(_0x54b68e,null))[_0x0787('0x2f')](handleError(_0x54b68e,null));};exports[_0x0787('0x81')]=function(_0x5709f1,_0x2486f8,_0x13c1c9){return db[_0x0787('0x73')]['findAll']({'where':{'id':_0x5709f1[_0x0787('0x49')][_0x0787('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0787('0x68')],'as':_0x0787('0x79'),'attributes':['id'],'raw':!![]}]})[_0x0787('0x25')](handleEntityNotFound(_0x2486f8,null))[_0x0787('0x25')](function(_0x107cab){var _0x49c3f1=_[_0x0787('0x3f')](_0x107cab,'id');var _0x2cb3a1=[];var _0x2034fd=[];var _0x551795=squel['select']();_0x551795[_0x0787('0x82')](_0x0787('0x83'))['from'](_0x0787('0x84'),'tq')[_0x0787('0x85')](_0x0787('0x86'),'ut',_0x0787('0x87'))[_0x0787('0x50')]('ChatQueueId\x20=\x20?',_0x5709f1[_0x0787('0x5a')]['id']);for(var _0x72bb5e=0x0;_0x72bb5e<_0x107cab[_0x0787('0x5b')];_0x72bb5e+=0x1){let _0x1510ee=_0x107cab[_0x72bb5e];for(var _0x1f9ba4=0x0;_0x1f9ba4<_0x1510ee[_0x0787('0x79')]['length'];_0x1f9ba4+=0x1){let _0x3d21ed=_0x1510ee['Agents'][_0x1f9ba4];var _0x573637=_0x551795[_0x0787('0x88')]();_0x573637['where']('ut.UserId\x20=\x20?',_0x3d21ed['id']);_0x2034fd[_0x0787('0x89')](db[_0x0787('0x7a')][_0x0787('0x49')](_0x573637['toString'](),{'type':db[_0x0787('0x7a')][_0x0787('0x8a')]['SELECT']})['then'](function(_0x487593){if(_0x487593[_0x0787('0x5b')]===0x1){return _0x3d21ed['id'];}else{var _0x4cbcb1=_['every'](_[_0x0787('0x3f')](_0x487593,_0x0787('0x8b')),function(_0xd4c7ec){return _[_0x0787('0x8c')](_0x49c3f1,_0xd4c7ec);});if(_0x4cbcb1){return _0x3d21ed['id'];}}}));}}return BPromise[_0x0787('0x8d')](_0x2034fd)[_0x0787('0x25')](function(_0x56d316){_0x2cb3a1=_(_0x2cb3a1)[_0x0787('0x8e')](_0x56d316)['compact']()['value']();return db[_0x0787('0x40')][_0x0787('0x64')]({'where':{'id':_0x5709f1[_0x0787('0x5a')]['id']}})['then'](function(_0x54751d){return db[_0x0787('0x7a')]['transaction'](function(_0x4b3baf){return _0x54751d[_0x0787('0x81')](_0x5709f1[_0x0787('0x49')][_0x0787('0x75')],{'transaction':_0x4b3baf})[_0x0787('0x25')](function(){if(!_[_0x0787('0x8f')](_0x2cb3a1)){return _0x54751d[_0x0787('0x90')](_0x2cb3a1,{'transaction':_0x4b3baf});}})['then'](function(){_0x2cb3a1['forEach'](function(_0x303452){socket[_0x0787('0x7f')]('userChatQueue:remove',{'UserId':_0x303452,'ChatQueueId':_0x54751d['id']});});});});});});})[_0x0787('0x25')](respondWithStatusCode(_0x2486f8,null))['catch'](handleError(_0x2486f8,null));};exports[_0x0787('0x91')]=function(_0x4bdbba,_0x128603,_0x2bc2d8){return db['ChatQueue'][_0x0787('0x64')]({'where':{'id':_0x4bdbba[_0x0787('0x5a')]['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x128603,null))[_0x0787('0x25')](function(_0x2f39a1){if(_0x2f39a1){return _0x2f39a1[_0x0787('0x91')](_0x4bdbba[_0x0787('0x5d')][_0x0787('0x75')],_[_0x0787('0x92')](_0x4bdbba['body'],['ids','id'])||{})[_0x0787('0x93')](function(_0x50fffa){for(var _0x59bd99=0x0;_0x59bd99<_0x4bdbba[_0x0787('0x5d')]['ids'][_0x0787('0x5b')];_0x59bd99+=0x1){socket[_0x0787('0x7f')](_0x0787('0x80'),{'UserId':Number(_0x4bdbba[_0x0787('0x5d')][_0x0787('0x75')][_0x59bd99]),'ChatQueueId':Number(_0x4bdbba[_0x0787('0x5a')]['id'])});}return _0x50fffa;});}})['then'](respondWithResult(_0x128603,null))[_0x0787('0x2f')](handleError(_0x128603,null));};exports[_0x0787('0x90')]=function(_0x3a378a,_0x5a632a,_0x361ea1){return db[_0x0787('0x40')][_0x0787('0x64')]({'where':{'id':_0x3a378a[_0x0787('0x5a')]['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x5a632a,null))[_0x0787('0x25')](function(_0x59c255){if(_0x59c255){return _0x59c255[_0x0787('0x90')](_0x3a378a[_0x0787('0x49')][_0x0787('0x75')])[_0x0787('0x25')](function(){if(_[_0x0787('0x94')](_0x3a378a[_0x0787('0x49')][_0x0787('0x75')])){for(var _0x2b006c=0x0;_0x2b006c<_0x3a378a[_0x0787('0x49')][_0x0787('0x75')][_0x0787('0x5b')];_0x2b006c+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x3a378a[_0x0787('0x49')][_0x0787('0x75')][_0x2b006c]),'ChatQueueId':Number(_0x3a378a[_0x0787('0x5a')]['id'])});}}else{socket['emit'](_0x0787('0x95'),{'UserId':Number(_0x3a378a[_0x0787('0x49')]['ids']),'ChatQueueId':Number(_0x3a378a[_0x0787('0x5a')]['id'])});}});}})[_0x0787('0x25')](respondWithStatusCode(_0x5a632a,null))[_0x0787('0x2f')](handleError(_0x5a632a,null));};exports[_0x0787('0x96')]=function(_0x45b924,_0x1acb36,_0x56f56f){var _0x513e54={};var _0x4cbe76={};var _0x1104b6;var _0x129d46;return db[_0x0787('0x40')][_0x0787('0x66')]({'where':{'id':_0x45b924[_0x0787('0x5a')]['id']}})[_0x0787('0x25')](handleEntityNotFound(_0x1acb36,null))[_0x0787('0x25')](function(_0x51449b){if(_0x51449b){_0x1104b6=_0x51449b;_0x4cbe76['model']=_[_0x0787('0x46')](db['User']['rawAttributes']);_0x4cbe76[_0x0787('0x49')]=_[_0x0787('0x46')](_0x45b924['query']);_0x4cbe76[_0x0787('0x47')]=_[_0x0787('0x48')](_0x4cbe76['model'],_0x4cbe76[_0x0787('0x49')]);_0x513e54['attributes']=_[_0x0787('0x48')](_0x4cbe76['model'],qs[_0x0787('0x4b')](_0x45b924[_0x0787('0x49')][_0x0787('0x4b')]));_0x513e54['attributes']=_0x513e54['attributes'][_0x0787('0x5b')]?_0x513e54[_0x0787('0x4a')]:_0x4cbe76['model'];_0x513e54[_0x0787('0x4e')]=qs[_0x0787('0x4f')](_0x45b924[_0x0787('0x49')][_0x0787('0x4f')]);_0x513e54[_0x0787('0x50')]=qs[_0x0787('0x47')](_['pick'](_0x45b924['query'],_0x4cbe76[_0x0787('0x47')]));if(_0x45b924[_0x0787('0x49')][_0x0787('0x54')]){_0x513e54['where']=_[_0x0787('0x52')](_0x513e54[_0x0787('0x50')],{'$or':_[_0x0787('0x3f')](_0x513e54[_0x0787('0x4a')],function(_0x5e3e04){var _0x5bd5a9={};_0x5bd5a9[_0x5e3e04]={'$like':'%'+_0x45b924[_0x0787('0x49')]['filter']+'%'};return _0x5bd5a9;})});}_0x513e54=_[_0x0787('0x52')]({},_0x513e54,_0x45b924['options']);return _0x1104b6[_0x0787('0x96')](_0x513e54);}})[_0x0787('0x25')](function(_0x2ac26d){if(_0x2ac26d){_0x129d46=_0x2ac26d[_0x0787('0x5b')];if(!_0x45b924[_0x0787('0x49')]['hasOwnProperty']('nolimit')){_0x513e54[_0x0787('0x35')]=qs['limit'](_0x45b924[_0x0787('0x49')][_0x0787('0x35')]);_0x513e54[_0x0787('0x33')]=qs['offset'](_0x45b924[_0x0787('0x49')][_0x0787('0x33')]);}return _0x1104b6[_0x0787('0x96')](_0x513e54);}})[_0x0787('0x25')](function(_0x409985){if(_0x409985){return _0x409985?{'count':_0x129d46,'rows':_0x409985}:null;}})[_0x0787('0x25')](respondWithResult(_0x1acb36,null))[_0x0787('0x2f')](handleError(_0x1acb36,null));}; \ No newline at end of file +var _0x335f=['autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','filter','findAndCountAll','UserId','updatedAt','chatPause','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','sendStatus','status','json','undefined','limit','count','offset','set','save','update','destroy','then','get','UserProfileResource','end','stack','name','send','index','ChatQueue','key','model','map','keys','query','filters','fields','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','findAll','rows','show','rawAttributes','intersection','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection'];(function(_0x2a29de,_0x1acca3){var _0x1e31f3=function(_0x5d4187){while(--_0x5d4187){_0x2a29de['push'](_0x2a29de['shift']());}};_0x1e31f3(++_0x1acca3);}(_0x335f,0x16a));var _0xf335=function(_0xb83e0b,_0xc15aa4){_0xb83e0b=_0xb83e0b-0x0;var _0x4d280c=_0x335f[_0xb83e0b];return _0x4d280c;};'use strict';var emlformat=require(_0xf335('0x0'));var rimraf=require(_0xf335('0x1'));var zipdir=require(_0xf335('0x2'));var jsonpatch=require(_0xf335('0x3'));var rp=require(_0xf335('0x4'));var moment=require('moment');var BPromise=require(_0xf335('0x5'));var Mustache=require(_0xf335('0x6'));var util=require('util');var path=require(_0xf335('0x7'));var sox=require(_0xf335('0x8'));var csv=require('to-csv');var ejs=require(_0xf335('0x9'));var fs=require('fs');var fs_extra=require(_0xf335('0xa'));var _=require(_0xf335('0xb'));var squel=require('squel');var crypto=require(_0xf335('0xc'));var jsforce=require(_0xf335('0xd'));var deskjs=require(_0xf335('0xe'));var toCsv=require(_0xf335('0xf'));var querystring=require(_0xf335('0x10'));var Papa=require(_0xf335('0x11'));var Redis=require(_0xf335('0x12'));var authService=require(_0xf335('0x13'));var qs=require(_0xf335('0x14'));var as=require(_0xf335('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf335('0x16'))(_0xf335('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf335('0x18'));var db=require(_0xf335('0x19'))['db'];config[_0xf335('0x1a')]=_['defaults'](config[_0xf335('0x1a')],{'host':_0xf335('0x1b'),'port':0x18eb});var socket=require(_0xf335('0x1c'))(new Redis(config[_0xf335('0x1a')]));require('./chatQueue.socket')[_0xf335('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf335('0x1e')][_0xf335('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x27492e,_0x1ed04a,_0x1ea085,_0x1090e2){return new BPromise(function(_0x52722a,_0x3a065a){var _0x10e71f=_0x1090e2||client;return _0x10e71f[_0xf335('0x20')](_0x27492e,_0x1ea085)['then'](function(_0x53ef05){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1ed04a,'request\x20sent');logger[_0xf335('0x21')](_0xf335('0x22'),_0x1ed04a,_0xf335('0x23'),JSON[_0xf335('0x24')](_0x53ef05));if(_0x53ef05['error']){if(_0x53ef05[_0xf335('0x25')][_0xf335('0x26')]===0x1f4){logger[_0xf335('0x25')](_0xf335('0x27'),_0x1ed04a,_0x53ef05[_0xf335('0x25')][_0xf335('0x28')]);return _0x3a065a(_0x53ef05[_0xf335('0x25')]['message']);}logger[_0xf335('0x25')](_0xf335('0x27'),_0x1ed04a,_0x53ef05[_0xf335('0x25')][_0xf335('0x28')]);return _0x52722a(_0x53ef05[_0xf335('0x25')]['message']);}else{logger[_0xf335('0x29')](_0xf335('0x27'),_0x1ed04a,_0xf335('0x23'));_0x52722a(_0x53ef05[_0xf335('0x2a')]['message']);}})['catch'](function(_0x4417a6){logger[_0xf335('0x25')]('ChatQueue,\x20%s,\x20%s',_0x1ed04a,_0x4417a6);_0x3a065a(_0x4417a6);});});}function respondWithStatusCode(_0x1b81a2,_0xea7032){_0xea7032=_0xea7032||0xcc;return function(_0x392f3a){if(_0x392f3a){return _0x1b81a2[_0xf335('0x2b')](_0xea7032);}return _0x1b81a2[_0xf335('0x2c')](_0xea7032)['end']();};}function respondWithResult(_0x3014e8,_0x822948){_0x822948=_0x822948||0xc8;return function(_0x4dea2d){if(_0x4dea2d){return _0x3014e8['status'](_0x822948)[_0xf335('0x2d')](_0x4dea2d);}};}function respondWithFilteredResult(_0x298308,_0x4178ff){return function(_0x3bb7a1){if(_0x3bb7a1){var _0x2145dd=typeof _0x4178ff['offset']===_0xf335('0x2e')&&typeof _0x4178ff[_0xf335('0x2f')]===_0xf335('0x2e');var _0x4ebe05=_0x3bb7a1[_0xf335('0x30')];var _0x4f1e54=_0x2145dd?0x0:_0x4178ff[_0xf335('0x31')];var _0x489bcc=_0x2145dd?_0x3bb7a1['count']:_0x4178ff[_0xf335('0x31')]+_0x4178ff['limit'];var _0xefbc45;if(_0x489bcc>=_0x4ebe05){_0x489bcc=_0x4ebe05;_0xefbc45=0xc8;}else{_0xefbc45=0xce;}_0x298308[_0xf335('0x2c')](_0xefbc45);return _0x298308[_0xf335('0x32')]('Content-Range',_0x4f1e54+'-'+_0x489bcc+'/'+_0x4ebe05)[_0xf335('0x2d')](_0x3bb7a1);}return null;};}function patchUpdates(_0x68c3ba){return function(_0x34c8fb){try{jsonpatch['apply'](_0x34c8fb,_0x68c3ba,!![]);}catch(_0x20a9b0){return BPromise['reject'](_0x20a9b0);}return _0x34c8fb[_0xf335('0x33')]();};}function saveUpdates(_0x100763,_0x44d3f7){return function(_0x408f40){if(_0x408f40){return _0x408f40[_0xf335('0x34')](_0x100763)['then'](function(_0x1d4730){return _0x1d4730;});}return null;};}function removeEntity(_0x58ae53,_0x38eb76){return function(_0x4c1c01){if(_0x4c1c01){return _0x4c1c01[_0xf335('0x35')]()[_0xf335('0x36')](function(){var _0x2dbe0c=_0x4c1c01[_0xf335('0x37')]({'plain':!![]});var _0xff3206='ChatQueues';return db[_0xf335('0x38')][_0xf335('0x35')]({'where':{'type':_0xff3206,'resourceId':_0x2dbe0c['id']}})['then'](function(){return _0x4c1c01;});})['then'](function(){_0x58ae53['status'](0xcc)[_0xf335('0x39')]();});}};}function handleEntityNotFound(_0x597598,_0x4ea666){return function(_0x2cc28c){if(!_0x2cc28c){_0x597598[_0xf335('0x2b')](0x194);}return _0x2cc28c;};}function handleError(_0x4229f2,_0x4483c8){_0x4483c8=_0x4483c8||0x1f4;return function(_0x5ee892){logger[_0xf335('0x25')](_0x5ee892[_0xf335('0x3a')]);if(_0x5ee892[_0xf335('0x3b')]){delete _0x5ee892[_0xf335('0x3b')];}_0x4229f2[_0xf335('0x2c')](_0x4483c8)[_0xf335('0x3c')](_0x5ee892);};}exports[_0xf335('0x3d')]=function(_0x2972ad,_0xe90219){var _0x3bc7ed={},_0xf92f67={},_0xb7d744={'count':0x0,'rows':[]};var _0x2582a7=_['map'](db[_0xf335('0x3e')]['rawAttributes'],function(_0x646971){return{'name':_0x646971['fieldName'],'type':_0x646971['type'][_0xf335('0x3f')]};});_0xf92f67[_0xf335('0x40')]=_[_0xf335('0x41')](_0x2582a7,_0xf335('0x3b'));_0xf92f67['query']=_[_0xf335('0x42')](_0x2972ad[_0xf335('0x43')]);_0xf92f67[_0xf335('0x44')]=_['intersection'](_0xf92f67[_0xf335('0x40')],_0xf92f67[_0xf335('0x43')]);_0x3bc7ed['attributes']=_['intersection'](_0xf92f67[_0xf335('0x40')],qs[_0xf335('0x45')](_0x2972ad[_0xf335('0x43')]['fields']));_0x3bc7ed[_0xf335('0x46')]=_0x3bc7ed['attributes']['length']?_0x3bc7ed[_0xf335('0x46')]:_0xf92f67[_0xf335('0x40')];if(!_0x2972ad['query']['hasOwnProperty'](_0xf335('0x47'))){_0x3bc7ed['limit']=qs['limit'](_0x2972ad[_0xf335('0x43')][_0xf335('0x2f')]);_0x3bc7ed[_0xf335('0x31')]=qs[_0xf335('0x31')](_0x2972ad['query'][_0xf335('0x31')]);}_0x3bc7ed[_0xf335('0x48')]=qs[_0xf335('0x49')](_0x2972ad[_0xf335('0x43')][_0xf335('0x49')]);_0x3bc7ed['where']=qs[_0xf335('0x44')](_['pick'](_0x2972ad[_0xf335('0x43')],_0xf92f67[_0xf335('0x44')]),_0x2582a7);if(_0x2972ad[_0xf335('0x43')]['filter']){_0x3bc7ed['where']=_['merge'](_0x3bc7ed[_0xf335('0x4a')],{'$or':_[_0xf335('0x41')](_0x2582a7,function(_0x334810){if(_0x334810['type']!==_0xf335('0x4b')){var _0x509ec7={};_0x509ec7[_0x334810['name']]={'$like':'%'+_0x2972ad[_0xf335('0x43')]['filter']+'%'};return _0x509ec7;}})});}_0x3bc7ed=_[_0xf335('0x4c')]({},_0x3bc7ed,_0x2972ad[_0xf335('0x4d')]);var _0x44be02={'where':_0x3bc7ed[_0xf335('0x4a')]};return db[_0xf335('0x3e')][_0xf335('0x30')](_0x44be02)[_0xf335('0x36')](function(_0x53ebcf){_0xb7d744[_0xf335('0x30')]=_0x53ebcf;if(_0x2972ad['query']['includeAll']){_0x3bc7ed['include']=[{'all':!![]}];}return db[_0xf335('0x3e')][_0xf335('0x4e')](_0x3bc7ed);})[_0xf335('0x36')](function(_0x776259){_0xb7d744[_0xf335('0x4f')]=_0x776259;return _0xb7d744;})[_0xf335('0x36')](respondWithFilteredResult(_0xe90219,_0x3bc7ed))['catch'](handleError(_0xe90219,null));};exports[_0xf335('0x50')]=function(_0x1c28dc,_0x335ecb){var _0x4e35ba={'raw':!![],'where':{'id':_0x1c28dc['params']['id']}},_0x17a146={};_0x17a146[_0xf335('0x40')]=_['keys'](db['ChatQueue'][_0xf335('0x51')]);_0x17a146['query']=_[_0xf335('0x42')](_0x1c28dc['query']);_0x17a146[_0xf335('0x44')]=_[_0xf335('0x52')](_0x17a146[_0xf335('0x40')],_0x17a146[_0xf335('0x43')]);_0x4e35ba[_0xf335('0x46')]=_[_0xf335('0x52')](_0x17a146[_0xf335('0x40')],qs['fields'](_0x1c28dc[_0xf335('0x43')][_0xf335('0x45')]));_0x4e35ba[_0xf335('0x46')]=_0x4e35ba[_0xf335('0x46')][_0xf335('0x53')]?_0x4e35ba[_0xf335('0x46')]:_0x17a146['model'];if(_0x1c28dc[_0xf335('0x43')]['includeAll']){_0x4e35ba['include']=[{'all':!![]}];}_0x4e35ba=_[_0xf335('0x4c')]({},_0x4e35ba,_0x1c28dc[_0xf335('0x4d')]);return db[_0xf335('0x3e')][_0xf335('0x54')](_0x4e35ba)['then'](handleEntityNotFound(_0x335ecb,null))[_0xf335('0x36')](respondWithResult(_0x335ecb,null))['catch'](handleError(_0x335ecb,null));};exports[_0xf335('0x55')]=function(_0x1e0718,_0x21d820){return db[_0xf335('0x3e')][_0xf335('0x55')](_0x1e0718['body'],{})[_0xf335('0x36')](function(_0x15e555){var _0x3b59cb=_0x1e0718['user'][_0xf335('0x37')]({'plain':!![]});if(!_0x3b59cb)throw new Error(_0xf335('0x56'));if(_0x3b59cb[_0xf335('0x57')]===_0xf335('0x58')){var _0x3eb403=_0x15e555['get']({'plain':!![]});var _0x3aa7a2=_0xf335('0x59');return db[_0xf335('0x5a')][_0xf335('0x54')]({'where':{'name':_0x3aa7a2,'userProfileId':_0x3b59cb['userProfileId']},'raw':!![]})[_0xf335('0x36')](function(_0x2168c3){if(_0x2168c3&&_0x2168c3[_0xf335('0x5b')]===0x0){return db[_0xf335('0x38')][_0xf335('0x55')]({'name':_0x3eb403[_0xf335('0x3b')],'resourceId':_0x3eb403['id'],'type':_0x2168c3['name'],'sectionId':_0x2168c3['id']},{})['then'](function(){return _0x15e555;});}else{return _0x15e555;}})[_0xf335('0x5c')](function(_0x218763){logger[_0xf335('0x25')](_0xf335('0x5d'),_0x218763);throw _0x218763;});}return _0x15e555;})[_0xf335('0x36')](respondWithResult(_0x21d820,0xc9))['catch'](handleError(_0x21d820,null));};exports[_0xf335('0x34')]=function(_0x1c336c,_0x25a8e9){if(_0x1c336c['body']['id']){delete _0x1c336c[_0xf335('0x5e')]['id'];}return db['ChatQueue'][_0xf335('0x54')]({'where':{'id':_0x1c336c['params']['id']}})[_0xf335('0x36')](handleEntityNotFound(_0x25a8e9,null))[_0xf335('0x36')](saveUpdates(_0x1c336c[_0xf335('0x5e')],null))[_0xf335('0x36')](respondWithResult(_0x25a8e9,null))[_0xf335('0x5c')](handleError(_0x25a8e9,null));};exports[_0xf335('0x35')]=function(_0x147ab0,_0x3ea68a){return db['ChatQueue']['find']({'where':{'id':_0x147ab0[_0xf335('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ea68a,null))[_0xf335('0x36')](removeEntity(_0x3ea68a,null))[_0xf335('0x5c')](handleError(_0x3ea68a,null));};exports[_0xf335('0x60')]=function(_0x1dad5a,_0x1c5514){return db[_0xf335('0x3e')][_0xf335('0x60')]()['then'](respondWithResult(_0x1c5514,null))[_0xf335('0x5c')](handleError(_0x1c5514,null));};exports[_0xf335('0x61')]=function(_0x26f7da,_0x5d1174,_0x129c5b){var _0x38bf1c={'raw':!![],'where':{}},_0x1c1c78={},_0x3ee864;return db[_0xf335('0x3e')][_0xf335('0x62')]({'where':{'id':_0x26f7da[_0xf335('0x5f')]['id']}})[_0xf335('0x36')](handleEntityNotFound(_0x5d1174,null))[_0xf335('0x36')](function(_0x541e6d){if(_0x541e6d){_0x3ee864=_0x541e6d[_0xf335('0x37')]({'plain':!![]});_0x1c1c78['model']=_['keys'](db[_0xf335('0x63')][_0xf335('0x51')]);_0x1c1c78[_0xf335('0x43')]=_['keys'](_0x26f7da['query']);_0x1c1c78['filters']=_[_0xf335('0x52')](_0x1c1c78[_0xf335('0x40')],_0x1c1c78[_0xf335('0x43')]);_0x38bf1c['attributes']=_[_0xf335('0x52')](_0x1c1c78[_0xf335('0x40')],qs[_0xf335('0x45')](_0x26f7da[_0xf335('0x43')]['fields']));_0x38bf1c[_0xf335('0x46')]=_0x38bf1c['attributes'][_0xf335('0x53')]?_0x38bf1c['attributes']:_0x1c1c78[_0xf335('0x40')];if(!_0x26f7da[_0xf335('0x43')][_0xf335('0x64')](_0xf335('0x47'))){_0x38bf1c[_0xf335('0x2f')]=qs[_0xf335('0x2f')](_0x26f7da[_0xf335('0x43')][_0xf335('0x2f')]);_0x38bf1c[_0xf335('0x31')]=qs['offset'](_0x26f7da[_0xf335('0x43')][_0xf335('0x31')]);}_0x38bf1c[_0xf335('0x48')]=qs['sort'](_0x26f7da['query']['sort']);_0x38bf1c['where']=qs[_0xf335('0x44')](_[_0xf335('0x65')](_0x26f7da[_0xf335('0x43')],_0x1c1c78['filters']));_0x38bf1c[_0xf335('0x4a')][_0xf335('0x66')]=_0x541e6d['id'];if(_0x26f7da['query']['filter']){_0x38bf1c[_0xf335('0x4a')]=_[_0xf335('0x4c')](_0x38bf1c['where'],{'$or':_[_0xf335('0x41')](_0x38bf1c[_0xf335('0x46')],function(_0x535590){var _0x3f2366={};_0x3f2366[_0x535590]={'$like':'%'+_0x26f7da[_0xf335('0x43')][_0xf335('0x67')]+'%'};return _0x3f2366;})});}_0x38bf1c=_[_0xf335('0x4c')]({},_0x38bf1c,_0x26f7da[_0xf335('0x4d')]);return db[_0xf335('0x63')]['findAll'](_0x38bf1c);}})[_0xf335('0x36')](function(_0xd8cf8){if(_0xd8cf8){return db['User'][_0xf335('0x68')]({'where':{'id':_[_0xf335('0x41')](_0xd8cf8,_0xf335('0x69')),'role':'agent'},'attributes':['id','name','chatPause',_0xf335('0x6a'),'createdAt']});}})[_0xf335('0x36')](function(_0x41b6b7){if(_0x41b6b7){return{'count':_0x41b6b7[_0xf335('0x30')],'rows':_[_0xf335('0x41')](_0x41b6b7[_0xf335('0x4f')],function(_0xe79e65){return{'membername':_0xe79e65[_0xf335('0x3b')],'UserId':_0xe79e65['id'],'queue_name':_0x3ee864[_0xf335('0x3b')],'ChatQueueId':_0x3ee864['id'],'interface':util['format']('%s/%s','SIP',_0xe79e65['name']),'penalty':0x0,'paused':_0xe79e65[_0xf335('0x6b')],'createdAt':_0xe79e65[_0xf335('0x6c')],'updatedAt':_0xe79e65['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf335('0x36')](respondWithFilteredResult(_0x5d1174,_0x38bf1c))[_0xf335('0x5c')](handleError(_0x5d1174,null));};exports[_0xf335('0x6d')]=function(_0x26d469,_0x5cffe0,_0xdc1cbf){var _0xa997a3={};var _0x30dcc6={};var _0x4111cd;var _0xa504d5;return db[_0xf335('0x3e')][_0xf335('0x62')]({'where':{'id':_0x26d469[_0xf335('0x5f')]['id']}})[_0xf335('0x36')](handleEntityNotFound(_0x5cffe0,null))[_0xf335('0x36')](function(_0x5943f3){if(_0x5943f3){_0x4111cd=_0x5943f3;_0x30dcc6[_0xf335('0x40')]=_[_0xf335('0x42')](db[_0xf335('0x6e')][_0xf335('0x51')]);_0x30dcc6[_0xf335('0x43')]=_[_0xf335('0x42')](_0x26d469[_0xf335('0x43')]);_0x30dcc6[_0xf335('0x44')]=_['intersection'](_0x30dcc6[_0xf335('0x40')],_0x30dcc6['query']);_0xa997a3['attributes']=_['intersection'](_0x30dcc6['model'],qs[_0xf335('0x45')](_0x26d469[_0xf335('0x43')][_0xf335('0x45')]));_0xa997a3['attributes']=_0xa997a3[_0xf335('0x46')][_0xf335('0x53')]?_0xa997a3[_0xf335('0x46')]:_0x30dcc6[_0xf335('0x40')];_0xa997a3[_0xf335('0x48')]=qs[_0xf335('0x49')](_0x26d469[_0xf335('0x43')][_0xf335('0x49')]);_0xa997a3['where']=qs[_0xf335('0x44')](_[_0xf335('0x65')](_0x26d469['query'],_0x30dcc6[_0xf335('0x44')]));if(_0x26d469['query']['filter']){_0xa997a3[_0xf335('0x4a')]=_[_0xf335('0x4c')](_0xa997a3['where'],{'$or':_['map'](_0xa997a3[_0xf335('0x46')],function(_0x5022fa){var _0x81f739={};_0x81f739[_0x5022fa]={'$like':'%'+_0x26d469[_0xf335('0x43')]['filter']+'%'};return _0x81f739;})});}_0xa997a3=_[_0xf335('0x4c')]({},_0xa997a3,_0x26d469[_0xf335('0x4d')]);return _0x4111cd[_0xf335('0x6d')](_0xa997a3);}})[_0xf335('0x36')](function(_0x3bdda4){if(_0x3bdda4){_0xa504d5=_0x3bdda4[_0xf335('0x53')];if(!_0x26d469['query'][_0xf335('0x64')](_0xf335('0x47'))){_0xa997a3[_0xf335('0x2f')]=qs['limit'](_0x26d469['query']['limit']);_0xa997a3[_0xf335('0x31')]=qs[_0xf335('0x31')](_0x26d469[_0xf335('0x43')]['offset']);}return _0x4111cd[_0xf335('0x6d')](_0xa997a3);}})[_0xf335('0x36')](function(_0x4f4006){if(_0x4f4006){return _0x4f4006?{'count':_0xa504d5,'rows':_0x4f4006}:null;}})[_0xf335('0x36')](respondWithResult(_0x5cffe0,null))['catch'](handleError(_0x5cffe0,null));};exports[_0xf335('0x6f')]=function(_0x3d13d6,_0x2b69d5,_0xcfd113){var _0x4fdeca=_0x3d13d6[_0xf335('0x5e')][_0xf335('0x70')];return db[_0xf335('0x6e')]['findAll']({'where':{'id':_0x4fdeca},'attributes':['id'],'include':[{'model':db[_0xf335('0x71')],'as':_0xf335('0x72'),'attributes':['id','name',_0xf335('0x73'),_0xf335('0x74'),_0xf335('0x75')],'raw':!![]}]})['then'](function(_0x5d5604){if(_0x5d5604){var _0x12f3f6=_[_0xf335('0x76')](_0x5d5604,function(_0x2aad52){var _0x344051=_0x2aad52[_0xf335('0x37')]({'plain':!![]});return _0x344051['Agents'];});return db[_0xf335('0x3e')][_0xf335('0x54')]({'where':{'id':_0x3d13d6[_0xf335('0x5f')]['id']}})[_0xf335('0x36')](function(_0x1b67d6){return db[_0xf335('0x77')]['transaction'](function(_0x302458){return _0x1b67d6['addTeams'](_0x4fdeca,{'transaction':_0x302458})[_0xf335('0x36')](function(){return BPromise[_0xf335('0x78')](_0x12f3f6,function(_0x668fd1){return db[_0xf335('0x63')]['findOrCreate']({'where':{'UserId':_0x668fd1['id'],'ChatQueueId':_0x3d13d6[_0xf335('0x5f')]['id']},'transaction':_0x302458});});})[_0xf335('0x36')](function(){_0x12f3f6[_0xf335('0x79')](function(_0x2e97eb){socket[_0xf335('0x7a')](_0xf335('0x7b'),{'UserId':_0x2e97eb['id'],'ChatQueueId':_0x1b67d6['id']});});});});});}})[_0xf335('0x36')](respondWithStatusCode(_0x2b69d5,null))[_0xf335('0x5c')](handleError(_0x2b69d5,null));};exports[_0xf335('0x7c')]=function(_0x2181cd,_0xee5262,_0x582c6d){return db[_0xf335('0x6e')]['findAll']({'where':{'id':_0x2181cd[_0xf335('0x43')][_0xf335('0x70')]},'attributes':['id'],'include':[{'model':db[_0xf335('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf335('0x36')](handleEntityNotFound(_0xee5262,null))[_0xf335('0x36')](function(_0x496920){var _0x1f8a7e=_[_0xf335('0x41')](_0x496920,'id');var _0x5a6af1=[];var _0x2d3b91=[];var _0x5912c0=squel[_0xf335('0x7d')]();_0x5912c0[_0xf335('0x7e')](_0xf335('0x7f'))[_0xf335('0x80')](_0xf335('0x81'),'tq')[_0xf335('0x82')](_0xf335('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf335('0x4a')]('ChatQueueId\x20=\x20?',_0x2181cd[_0xf335('0x5f')]['id']);for(var _0x1f6813=0x0;_0x1f6813<_0x496920[_0xf335('0x53')];_0x1f6813+=0x1){let _0x3a5e97=_0x496920[_0x1f6813];for(var _0x46a6ab=0x0;_0x46a6ab<_0x3a5e97[_0xf335('0x72')][_0xf335('0x53')];_0x46a6ab+=0x1){let _0x3550a6=_0x3a5e97[_0xf335('0x72')][_0x46a6ab];var _0x1f9b95=_0x5912c0[_0xf335('0x84')]();_0x1f9b95['where'](_0xf335('0x85'),_0x3550a6['id']);_0x2d3b91['push'](db[_0xf335('0x77')][_0xf335('0x43')](_0x1f9b95['toString'](),{'type':db['sequelize'][_0xf335('0x86')][_0xf335('0x87')]})['then'](function(_0x121740){if(_0x121740[_0xf335('0x53')]===0x1){return _0x3550a6['id'];}else{var _0x5a4a77=_[_0xf335('0x88')](_[_0xf335('0x41')](_0x121740,_0xf335('0x89')),function(_0x3c2ec6){return _[_0xf335('0x8a')](_0x1f8a7e,_0x3c2ec6);});if(_0x5a4a77){return _0x3550a6['id'];}}}));}}return BPromise[_0xf335('0x8b')](_0x2d3b91)['then'](function(_0x45c78f){_0x5a6af1=_(_0x5a6af1)['union'](_0x45c78f)[_0xf335('0x8c')]()[_0xf335('0x8d')]();return db[_0xf335('0x3e')][_0xf335('0x54')]({'where':{'id':_0x2181cd[_0xf335('0x5f')]['id']}})[_0xf335('0x36')](function(_0x5c53ee){return db[_0xf335('0x77')][_0xf335('0x8e')](function(_0x4cf6b9){return _0x5c53ee[_0xf335('0x7c')](_0x2181cd[_0xf335('0x43')][_0xf335('0x70')],{'transaction':_0x4cf6b9})[_0xf335('0x36')](function(){if(!_[_0xf335('0x8f')](_0x5a6af1)){return _0x5c53ee[_0xf335('0x90')](_0x5a6af1,{'transaction':_0x4cf6b9});}})[_0xf335('0x36')](function(){_0x5a6af1[_0xf335('0x79')](function(_0x4f9803){socket[_0xf335('0x7a')](_0xf335('0x91'),{'UserId':_0x4f9803,'ChatQueueId':_0x5c53ee['id']});});});});});});})[_0xf335('0x36')](respondWithStatusCode(_0xee5262,null))[_0xf335('0x5c')](handleError(_0xee5262,null));};exports[_0xf335('0x92')]=function(_0x5c73c2,_0x13fd42,_0x319cc0){return db['ChatQueue']['find']({'where':{'id':_0x5c73c2[_0xf335('0x5f')]['id']}})[_0xf335('0x36')](handleEntityNotFound(_0x13fd42,null))[_0xf335('0x36')](function(_0x219cd4){if(_0x219cd4){return _0x219cd4[_0xf335('0x92')](_0x5c73c2[_0xf335('0x5e')][_0xf335('0x70')],_[_0xf335('0x93')](_0x5c73c2[_0xf335('0x5e')],[_0xf335('0x70'),'id'])||{})[_0xf335('0x94')](function(_0x532911){for(var _0x1b9bf5=0x0;_0x1b9bf5<_0x5c73c2[_0xf335('0x5e')]['ids'][_0xf335('0x53')];_0x1b9bf5+=0x1){socket['emit'](_0xf335('0x7b'),{'UserId':Number(_0x5c73c2[_0xf335('0x5e')][_0xf335('0x70')][_0x1b9bf5]),'ChatQueueId':Number(_0x5c73c2['params']['id'])});}return _0x532911;});}})[_0xf335('0x36')](respondWithResult(_0x13fd42,null))['catch'](handleError(_0x13fd42,null));};exports[_0xf335('0x90')]=function(_0x2b45bc,_0x4cf99f,_0x59a04f){return db[_0xf335('0x3e')][_0xf335('0x54')]({'where':{'id':_0x2b45bc['params']['id']}})['then'](handleEntityNotFound(_0x4cf99f,null))[_0xf335('0x36')](function(_0x313e9c){if(_0x313e9c){return _0x313e9c[_0xf335('0x90')](_0x2b45bc['query']['ids'])[_0xf335('0x36')](function(){if(_[_0xf335('0x95')](_0x2b45bc[_0xf335('0x43')]['ids'])){for(var _0x2371d9=0x0;_0x2371d9<_0x2b45bc[_0xf335('0x43')][_0xf335('0x70')][_0xf335('0x53')];_0x2371d9+=0x1){socket[_0xf335('0x7a')](_0xf335('0x91'),{'UserId':Number(_0x2b45bc['query'][_0xf335('0x70')][_0x2371d9]),'ChatQueueId':Number(_0x2b45bc[_0xf335('0x5f')]['id'])});}}else{socket[_0xf335('0x7a')](_0xf335('0x91'),{'UserId':Number(_0x2b45bc[_0xf335('0x43')]['ids']),'ChatQueueId':Number(_0x2b45bc[_0xf335('0x5f')]['id'])});}});}})[_0xf335('0x36')](respondWithStatusCode(_0x4cf99f,null))[_0xf335('0x5c')](handleError(_0x4cf99f,null));};exports['getAgents']=function(_0x5f5346,_0x3b4033,_0x567453){var _0x35a5b7={};var _0x16bb6b={};var _0x174c65;var _0xa7bd7c;return db[_0xf335('0x3e')][_0xf335('0x62')]({'where':{'id':_0x5f5346['params']['id']}})[_0xf335('0x36')](handleEntityNotFound(_0x3b4033,null))[_0xf335('0x36')](function(_0x554bb3){if(_0x554bb3){_0x174c65=_0x554bb3;_0x16bb6b[_0xf335('0x40')]=_[_0xf335('0x42')](db[_0xf335('0x71')][_0xf335('0x51')]);_0x16bb6b['query']=_[_0xf335('0x42')](_0x5f5346['query']);_0x16bb6b['filters']=_[_0xf335('0x52')](_0x16bb6b[_0xf335('0x40')],_0x16bb6b[_0xf335('0x43')]);_0x35a5b7['attributes']=_[_0xf335('0x52')](_0x16bb6b[_0xf335('0x40')],qs[_0xf335('0x45')](_0x5f5346[_0xf335('0x43')][_0xf335('0x45')]));_0x35a5b7[_0xf335('0x46')]=_0x35a5b7[_0xf335('0x46')]['length']?_0x35a5b7['attributes']:_0x16bb6b[_0xf335('0x40')];_0x35a5b7[_0xf335('0x48')]=qs[_0xf335('0x49')](_0x5f5346['query'][_0xf335('0x49')]);_0x35a5b7[_0xf335('0x4a')]=qs['filters'](_[_0xf335('0x65')](_0x5f5346[_0xf335('0x43')],_0x16bb6b[_0xf335('0x44')]));if(_0x5f5346[_0xf335('0x43')]['filter']){_0x35a5b7[_0xf335('0x4a')]=_[_0xf335('0x4c')](_0x35a5b7[_0xf335('0x4a')],{'$or':_['map'](_0x35a5b7[_0xf335('0x46')],function(_0x13fcb4){var _0x4141a0={};_0x4141a0[_0x13fcb4]={'$like':'%'+_0x5f5346['query']['filter']+'%'};return _0x4141a0;})});}_0x35a5b7=_[_0xf335('0x4c')]({},_0x35a5b7,_0x5f5346['options']);return _0x174c65[_0xf335('0x96')](_0x35a5b7);}})[_0xf335('0x36')](function(_0x1591b5){if(_0x1591b5){_0xa7bd7c=_0x1591b5[_0xf335('0x53')];if(!_0x5f5346[_0xf335('0x43')][_0xf335('0x64')](_0xf335('0x47'))){_0x35a5b7[_0xf335('0x2f')]=qs['limit'](_0x5f5346[_0xf335('0x43')]['limit']);_0x35a5b7[_0xf335('0x31')]=qs['offset'](_0x5f5346['query'][_0xf335('0x31')]);}return _0x174c65[_0xf335('0x96')](_0x35a5b7);}})['then'](function(_0x2a4448){if(_0x2a4448){return _0x2a4448?{'count':_0xa7bd7c,'rows':_0x2a4448}:null;}})[_0xf335('0x36')](respondWithResult(_0x3b4033,null))[_0xf335('0x5c')](handleError(_0x3b4033,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 25c7643..4238773 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 _0xfc6e=['events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x57745d,_0x1fe06e){var _0x414130=function(_0x39e8a8){while(--_0x39e8a8){_0x57745d['push'](_0x57745d['shift']());}};_0x414130(++_0x1fe06e);}(_0xfc6e,0x13b));var _0xefc6=function(_0x19c4bd,_0x19a00d){_0x19c4bd=_0x19c4bd-0x0;var _0x2fc7b5=_0xfc6e[_0x19c4bd];return _0x2fc7b5;};'use strict';var EventEmitter=require(_0xefc6('0x0'));var ChatQueue=require(_0xefc6('0x1'))['db'][_0xefc6('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xefc6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xefc6('0x4'),'afterDestroy':_0xefc6('0x5')};function emitEvent(_0x3aaa94){return function(_0x3ece1a,_0x169f18,_0x1df705){ChatQueueEvents['emit'](_0x3aaa94+':'+_0x3ece1a['id'],_0x3ece1a);ChatQueueEvents[_0xefc6('0x6')](_0x3aaa94,_0x3ece1a);_0x1df705(null);};}for(var e in events){if(events[_0xefc6('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xefc6('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xf734=['emit','hook','exports','ChatQueue','setMaxListeners','save','update'];(function(_0x28b78c,_0x1b406d){var _0x1c4f79=function(_0x178c2f){while(--_0x178c2f){_0x28b78c['push'](_0x28b78c['shift']());}};_0x1c4f79(++_0x1b406d);}(_0xf734,0x129));var _0x4f73=function(_0x9f231b,_0x1ed4bb){_0x9f231b=_0x9f231b-0x0;var _0x3c1276=_0xf734[_0x9f231b];return _0x3c1276;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x4f73('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4f73('0x1')](0x0);var events={'afterCreate':_0x4f73('0x2'),'afterUpdate':_0x4f73('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34e8ac){return function(_0x5d8421,_0x394946,_0x5c797f){ChatQueueEvents[_0x4f73('0x4')](_0x34e8ac+':'+_0x5d8421['id'],_0x5d8421);ChatQueueEvents[_0x4f73('0x4')](_0x34e8ac,_0x5d8421);_0x5c797f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4f73('0x5')](e,emitEvent(event));}}module[_0x4f73('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3f6c903..ae272a4 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 _0x1cd7=['define','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x599610,_0x1c88b0){var _0x124756=function(_0x46fda4){while(--_0x46fda4){_0x599610['push'](_0x599610['shift']());}};_0x124756(++_0x1c88b0);}(_0x1cd7,0xb1));var _0x71cd=function(_0x3f95ba,_0x4d880a){_0x3f95ba=_0x3f95ba-0x0;var _0x3f8987=_0x1cd7[_0x3f95ba];return _0x3f8987;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x71cd('0x0'))(_0x71cd('0x1'));var moment=require(_0x71cd('0x2'));var BPromise=require(_0x71cd('0x3'));var rp=require(_0x71cd('0x4'));var fs=require('fs');var path=require(_0x71cd('0x5'));var rimraf=require('rimraf');var config=require(_0x71cd('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x144c2f,_0x3adcbc){return _0x144c2f[_0x71cd('0x7')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeea8=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xeea8,0xb1));var _0x8eea=function(_0x8c96ac,_0xdda81e){_0x8c96ac=_0x8c96ac-0x0;var _0x39f78e=_0xeea8[_0x8c96ac];return _0x39f78e;};'use strict';var _=require(_0x8eea('0x0'));var util=require(_0x8eea('0x1'));var logger=require(_0x8eea('0x2'))(_0x8eea('0x3'));var moment=require(_0x8eea('0x4'));var BPromise=require(_0x8eea('0x5'));var rp=require(_0x8eea('0x6'));var fs=require('fs');var path=require(_0x8eea('0x7'));var rimraf=require(_0x8eea('0x8'));var config=require(_0x8eea('0x9'));var attributes=require(_0x8eea('0xa'));module['exports']=function(_0xc2c556,_0x5e035e){return _0xc2c556[_0x8eea('0xb')]('ChatQueue',attributes,{'tableName':_0x8eea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e85cd57..a0632b2 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 _0xb5a4=['socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','then','debug','ShowChatQueue','find','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x4e2ec5,_0xc79b56){var _0x1dd09c=function(_0x5c9484){while(--_0x5c9484){_0x4e2ec5['push'](_0x4e2ec5['shift']());}};_0x1dd09c(++_0xc79b56);}(_0xb5a4,0x17d));var _0x4b5a=function(_0x270c2d,_0x1b378b){_0x270c2d=_0x270c2d-0x0;var _0x4f728a=_0xb5a4[_0x270c2d];return _0x4f728a;};'use strict';var _=require('lodash');var util=require(_0x4b5a('0x0'));var moment=require(_0x4b5a('0x1'));var BPromise=require(_0x4b5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b5a('0x3'));var db=require(_0x4b5a('0x4'))['db'];var utils=require(_0x4b5a('0x5'));var logger=require(_0x4b5a('0x6'))(_0x4b5a('0x7'));var config=require(_0x4b5a('0x8'));var jayson=require(_0x4b5a('0x9'));var client=jayson[_0x4b5a('0xa')][_0x4b5a('0xb')]({'port':0x232a});config['redis']=_[_0x4b5a('0xc')](config[_0x4b5a('0xd')],{'host':_0x4b5a('0xe'),'port':0x18eb});var socket=require(_0x4b5a('0xf'))(new Redis(config[_0x4b5a('0xd')]));require(_0x4b5a('0x10'))[_0x4b5a('0x11')](socket);function respondWithRpcPromise(_0x10e9ac,_0x5b8213,_0x1b0c8a){return new BPromise(function(_0x53f6cd,_0x59395e){return client[_0x4b5a('0x12')](_0x10e9ac,_0x1b0c8a)['then'](function(_0x191734){logger[_0x4b5a('0x13')](_0x4b5a('0x14'),_0x5b8213,'request\x20sent');logger['debug'](_0x4b5a('0x15'),_0x5b8213,_0x4b5a('0x16'),JSON[_0x4b5a('0x17')](_0x191734));if(_0x191734[_0x4b5a('0x18')]){if(_0x191734[_0x4b5a('0x18')][_0x4b5a('0x19')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5b8213,_0x191734[_0x4b5a('0x18')][_0x4b5a('0x1a')]);return _0x59395e(_0x191734[_0x4b5a('0x18')]['message']);}logger['error'](_0x4b5a('0x14'),_0x5b8213,_0x191734['error'][_0x4b5a('0x1a')]);return _0x53f6cd(_0x191734[_0x4b5a('0x18')]['message']);}else{logger[_0x4b5a('0x13')](_0x4b5a('0x14'),_0x5b8213,_0x4b5a('0x16'));_0x53f6cd(_0x191734[_0x4b5a('0x1b')][_0x4b5a('0x1a')]);}})['catch'](function(_0x4fbd7c){logger['error'](_0x4b5a('0x14'),_0x5b8213,_0x4fbd7c);_0x59395e(_0x4fbd7c);});});}exports[_0x4b5a('0x1c')]=function(_0x2cc10c){var _0xa351fe=this;return new Promise(function(_0x402eb1,_0x5140c1){return db[_0x4b5a('0x1d')][_0x4b5a('0x1e')]({'raw':_0x2cc10c[_0x4b5a('0x1f')]?_0x2cc10c[_0x4b5a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2cc10c[_0x4b5a('0x1f')]?_0x2cc10c[_0x4b5a('0x1f')][_0x4b5a('0x20')]||null:null,'attributes':_0x2cc10c['options']?_0x2cc10c[_0x4b5a('0x1f')][_0x4b5a('0x21')]||null:null,'limit':_0x2cc10c[_0x4b5a('0x1f')]?_0x2cc10c[_0x4b5a('0x1f')][_0x4b5a('0x22')]||null:null,'include':_0x2cc10c['options']?_0x2cc10c[_0x4b5a('0x1f')][_0x4b5a('0x23')]?_[_0x4b5a('0x24')](_0x2cc10c['options'][_0x4b5a('0x23')],function(_0x2d4fc8){return{'model':db[_0x2d4fc8['model']],'as':_0x2d4fc8['as'],'attributes':_0x2d4fc8[_0x4b5a('0x21')],'include':_0x2d4fc8[_0x4b5a('0x23')]?_['map'](_0x2d4fc8[_0x4b5a('0x23')],function(_0x2036c2){return{'model':db[_0x2036c2[_0x4b5a('0x25')]],'as':_0x2036c2['as'],'attributes':_0x2036c2[_0x4b5a('0x21')],'include':_0x2036c2[_0x4b5a('0x23')]?_[_0x4b5a('0x24')](_0x2036c2['include'],function(_0x517d99){return{'model':db[_0x517d99[_0x4b5a('0x25')]],'as':_0x517d99['as'],'attributes':_0x517d99[_0x4b5a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4b5a('0x26')](function(_0x51c187){logger['info'](_0x4b5a('0x1c'),_0x2cc10c);logger[_0x4b5a('0x27')](_0x4b5a('0x1c'),_0x2cc10c,JSON['stringify'](_0x51c187));_0x402eb1(_0x51c187);})['catch'](function(_0x50eec4){logger[_0x4b5a('0x18')](_0x4b5a('0x1c'),_0x50eec4[_0x4b5a('0x1a')],_0x2cc10c);_0x5140c1(_0xa351fe[_0x4b5a('0x18')](0x1f4,_0x50eec4[_0x4b5a('0x1a')]));});});};exports[_0x4b5a('0x28')]=function(_0x37c954){var _0x809744=this;return new Promise(function(_0x497c36,_0x1604a9){return db[_0x4b5a('0x1d')][_0x4b5a('0x29')]({'raw':_0x37c954[_0x4b5a('0x1f')]?_0x37c954[_0x4b5a('0x1f')][_0x4b5a('0x2a')]===undefined?!![]:![]:!![],'where':_0x37c954[_0x4b5a('0x1f')]?_0x37c954[_0x4b5a('0x1f')][_0x4b5a('0x20')]||null:null,'attributes':_0x37c954['options']?_0x37c954[_0x4b5a('0x1f')][_0x4b5a('0x21')]||null:null,'include':_0x37c954[_0x4b5a('0x1f')]?_0x37c954['options']['include']?_[_0x4b5a('0x24')](_0x37c954['options']['include'],function(_0x3a6a76){return{'model':db[_0x3a6a76[_0x4b5a('0x25')]],'as':_0x3a6a76['as'],'attributes':_0x3a6a76['attributes'],'include':_0x3a6a76['include']?_['map'](_0x3a6a76[_0x4b5a('0x23')],function(_0x22ff8b){return{'model':db[_0x22ff8b[_0x4b5a('0x25')]],'as':_0x22ff8b['as'],'attributes':_0x22ff8b['attributes'],'include':_0x22ff8b['include']?_[_0x4b5a('0x24')](_0x22ff8b[_0x4b5a('0x23')],function(_0x5ce35e){return{'model':db[_0x5ce35e[_0x4b5a('0x25')]],'as':_0x5ce35e['as'],'attributes':_0x5ce35e[_0x4b5a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4b5a('0x26')](function(_0x283727){logger[_0x4b5a('0x13')](_0x4b5a('0x28'),_0x37c954);logger[_0x4b5a('0x27')](_0x4b5a('0x28'),_0x37c954,JSON[_0x4b5a('0x17')](_0x283727));_0x497c36(_0x283727);})[_0x4b5a('0x2b')](function(_0x1caaa5){logger[_0x4b5a('0x18')]('ShowChatQueue',_0x1caaa5[_0x4b5a('0x1a')],_0x37c954);_0x1604a9(_0x809744[_0x4b5a('0x18')](0x1f4,_0x1caaa5[_0x4b5a('0x1a')]));});});}; \ No newline at end of file +var _0x2b4a=['raw','where','limit','include','map','attributes','model','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','findAll','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x2b4a[_0x2e04ef];return _0x5722b0;};'use strict';var _=require(_0xa2b4('0x0'));var util=require(_0xa2b4('0x1'));var moment=require(_0xa2b4('0x2'));var BPromise=require(_0xa2b4('0x3'));var rs=require(_0xa2b4('0x4'));var fs=require('fs');var Redis=require(_0xa2b4('0x5'));var db=require(_0xa2b4('0x6'))['db'];var utils=require(_0xa2b4('0x7'));var logger=require('../../config/logger')(_0xa2b4('0x8'));var config=require(_0xa2b4('0x9'));var jayson=require(_0xa2b4('0xa'));var client=jayson[_0xa2b4('0xb')]['http']({'port':0x232a});config[_0xa2b4('0xc')]=_[_0xa2b4('0xd')](config['redis'],{'host':_0xa2b4('0xe'),'port':0x18eb});var socket=require(_0xa2b4('0xf'))(new Redis(config[_0xa2b4('0xc')]));require(_0xa2b4('0x10'))[_0xa2b4('0x11')](socket);function respondWithRpcPromise(_0x20619e,_0x5e5cb0,_0x5f5abc){return new BPromise(function(_0xfda0b6,_0x4c2f17){return client[_0xa2b4('0x12')](_0x20619e,_0x5f5abc)[_0xa2b4('0x13')](function(_0x2913ce){logger[_0xa2b4('0x14')](_0xa2b4('0x15'),_0x5e5cb0,_0xa2b4('0x16'));logger[_0xa2b4('0x17')](_0xa2b4('0x18'),_0x5e5cb0,_0xa2b4('0x16'),JSON[_0xa2b4('0x19')](_0x2913ce));if(_0x2913ce[_0xa2b4('0x1a')]){if(_0x2913ce[_0xa2b4('0x1a')][_0xa2b4('0x1b')]===0x1f4){logger[_0xa2b4('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x5e5cb0,_0x2913ce[_0xa2b4('0x1a')][_0xa2b4('0x1c')]);return _0x4c2f17(_0x2913ce[_0xa2b4('0x1a')][_0xa2b4('0x1c')]);}logger[_0xa2b4('0x1a')](_0xa2b4('0x15'),_0x5e5cb0,_0x2913ce['error'][_0xa2b4('0x1c')]);return _0xfda0b6(_0x2913ce[_0xa2b4('0x1a')][_0xa2b4('0x1c')]);}else{logger[_0xa2b4('0x14')]('ChatQueue,\x20%s,\x20%s',_0x5e5cb0,_0xa2b4('0x16'));_0xfda0b6(_0x2913ce[_0xa2b4('0x1d')][_0xa2b4('0x1c')]);}})[_0xa2b4('0x1e')](function(_0x6ed641){logger['error'](_0xa2b4('0x15'),_0x5e5cb0,_0x6ed641);_0x4c2f17(_0x6ed641);});});}exports[_0xa2b4('0x1f')]=function(_0x28b194){var _0x426e4e=this;return new Promise(function(_0x4e41f0,_0x57b56e){return db['ChatQueue'][_0xa2b4('0x20')]({'raw':_0x28b194['options']?_0x28b194[_0xa2b4('0x21')][_0xa2b4('0x22')]===undefined?!![]:![]:!![],'where':_0x28b194[_0xa2b4('0x21')]?_0x28b194[_0xa2b4('0x21')][_0xa2b4('0x23')]||null:null,'attributes':_0x28b194['options']?_0x28b194[_0xa2b4('0x21')]['attributes']||null:null,'limit':_0x28b194['options']?_0x28b194['options'][_0xa2b4('0x24')]||null:null,'include':_0x28b194[_0xa2b4('0x21')]?_0x28b194[_0xa2b4('0x21')][_0xa2b4('0x25')]?_[_0xa2b4('0x26')](_0x28b194['options'][_0xa2b4('0x25')],function(_0x369a4d){return{'model':db[_0x369a4d['model']],'as':_0x369a4d['as'],'attributes':_0x369a4d['attributes'],'include':_0x369a4d[_0xa2b4('0x25')]?_[_0xa2b4('0x26')](_0x369a4d[_0xa2b4('0x25')],function(_0xc716b1){return{'model':db[_0xc716b1['model']],'as':_0xc716b1['as'],'attributes':_0xc716b1[_0xa2b4('0x27')],'include':_0xc716b1['include']?_['map'](_0xc716b1[_0xa2b4('0x25')],function(_0x5cabc4){return{'model':db[_0x5cabc4[_0xa2b4('0x28')]],'as':_0x5cabc4['as'],'attributes':_0x5cabc4[_0xa2b4('0x27')]};}):[]};}):[]};}):[]:[]})[_0xa2b4('0x13')](function(_0x3eb9e8){logger[_0xa2b4('0x14')]('GetChatQueue',_0x28b194);logger['debug'](_0xa2b4('0x1f'),_0x28b194,JSON[_0xa2b4('0x19')](_0x3eb9e8));_0x4e41f0(_0x3eb9e8);})[_0xa2b4('0x1e')](function(_0x7e2950){logger[_0xa2b4('0x1a')]('GetChatQueue',_0x7e2950[_0xa2b4('0x1c')],_0x28b194);_0x57b56e(_0x426e4e['error'](0x1f4,_0x7e2950[_0xa2b4('0x1c')]));});});};exports['ShowChatQueue']=function(_0x4f83a8){var _0x67f6ee=this;return new Promise(function(_0x453b0f,_0x20447a){return db[_0xa2b4('0x29')][_0xa2b4('0x2a')]({'raw':_0x4f83a8['options']?_0x4f83a8[_0xa2b4('0x21')][_0xa2b4('0x22')]===undefined?!![]:![]:!![],'where':_0x4f83a8[_0xa2b4('0x21')]?_0x4f83a8[_0xa2b4('0x21')][_0xa2b4('0x23')]||null:null,'attributes':_0x4f83a8[_0xa2b4('0x21')]?_0x4f83a8['options']['attributes']||null:null,'include':_0x4f83a8[_0xa2b4('0x21')]?_0x4f83a8['options']['include']?_['map'](_0x4f83a8['options']['include'],function(_0x35c11e){return{'model':db[_0x35c11e['model']],'as':_0x35c11e['as'],'attributes':_0x35c11e['attributes'],'include':_0x35c11e[_0xa2b4('0x25')]?_[_0xa2b4('0x26')](_0x35c11e[_0xa2b4('0x25')],function(_0x50a0fa){return{'model':db[_0x50a0fa[_0xa2b4('0x28')]],'as':_0x50a0fa['as'],'attributes':_0x50a0fa['attributes'],'include':_0x50a0fa[_0xa2b4('0x25')]?_[_0xa2b4('0x26')](_0x50a0fa['include'],function(_0x5cfb47){return{'model':db[_0x5cfb47['model']],'as':_0x5cfb47['as'],'attributes':_0x5cfb47[_0xa2b4('0x27')]};}):[]};}):[]};}):[]:[]})[_0xa2b4('0x13')](function(_0x23db33){logger[_0xa2b4('0x14')](_0xa2b4('0x2b'),_0x4f83a8);logger[_0xa2b4('0x17')](_0xa2b4('0x2b'),_0x4f83a8,JSON[_0xa2b4('0x19')](_0x23db33));_0x453b0f(_0x23db33);})[_0xa2b4('0x1e')](function(_0x443eb1){logger['error'](_0xa2b4('0x2b'),_0x443eb1['message'],_0x4f83a8);_0x20447a(_0x67f6ee['error'](0x1f4,_0x443eb1[_0xa2b4('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 766399f..3722ec6 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 _0x0e85=['update','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x4db751,_0x1af8ef){var _0x386732=function(_0x3a4412){while(--_0x3a4412){_0x4db751['push'](_0x4db751['shift']());}};_0x386732(++_0x1af8ef);}(_0x0e85,0x7c));var _0x50e8=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x0e85[_0x3740fe];return _0x55492b;};'use strict';var ChatQueueEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatQueueEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatQueueEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0xdace=['remove','update','emit','register','length','./chatQueue.events'];(function(_0x1c3863,_0x3d9c0e){var _0x1110f4=function(_0x31602e){while(--_0x31602e){_0x1c3863['push'](_0x1c3863['shift']());}};_0x1110f4(++_0x3d9c0e);}(_0xdace,0xc5));var _0xedac=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xdace[_0x574617];return _0x29de90;};'use strict';var ChatQueueEvents=require(_0xedac('0x0'));var events=['save',_0xedac('0x1'),_0xedac('0x2')];function createListener(_0x46eba0,_0x518516){return function(_0x413d77){_0x518516[_0xedac('0x3')](_0x46eba0,_0x413d77);};}function removeListener(_0x15d3bd,_0xefb142){return function(){ChatQueueEvents['removeListener'](_0x15d3bd,_0xefb142);};}exports[_0xedac('0x4')]=function(_0x1cba89){for(var _0x39328a=0x0,_0x5ecbd3=events[_0xedac('0x5')];_0x39328a<_0x5ecbd3;_0x39328a++){var _0x21440e=events[_0x39328a];var _0x162eea=createListener('chatQueue:'+_0x21440e,_0x1cba89);ChatQueueEvents['on'](_0x21440e,_0x162eea);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 99eef48..e4d4c26 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1fba66,_0x5407f3){var _0x2b3f89=function(_0x41f0ff){while(--_0x41f0ff){_0x1fba66['push'](_0x1fba66['shift']());}};_0x2b3f89(++_0x5407f3);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'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['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +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(_0x56b495,_0x535ede){var _0x21943f=function(_0x5cab79){while(--_0x5cab79){_0x56b495['push'](_0x56b495['shift']());}};_0x21943f(++_0x535ede);}(_0xe14b,0x93));var _0xbe14=function(_0x2e697c,_0xc8720){_0x2e697c=_0x2e697c-0x0;var _0x4e558b=_0xe14b[_0x2e697c];return _0x4e558b;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3921165..7ae0acb 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 _0x793d=['sequelize','exports','STRING','DATE','moment'];(function(_0x1d9428,_0x5021a0){var _0x162843=function(_0x97c9c2){while(--_0x97c9c2){_0x1d9428['push'](_0x1d9428['shift']());}};_0x162843(++_0x5021a0);}(_0x793d,0x15d));var _0xd793=function(_0x2cf360,_0xf8915e){_0x2cf360=_0x2cf360-0x0;var _0x222778=_0x793d[_0x2cf360];return _0x222778;};'use strict';var moment=require(_0xd793('0x0'));var Sequelize=require(_0xd793('0x1'));module[_0xd793('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd793('0x3')]},'joinAt':{'type':Sequelize[_0xd793('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd793('0x4')]},'exitAt':{'type':Sequelize[_0xd793('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac4b=['moment','sequelize','exports','DATE','STRING'];(function(_0x1103e6,_0x3a0217){var _0x5bc0ef=function(_0x3e979b){while(--_0x3e979b){_0x1103e6['push'](_0x1103e6['shift']());}};_0x5bc0ef(++_0x3a0217);}(_0xac4b,0xb4));var _0xbac4=function(_0x160661,_0x33ffa0){_0x160661=_0x160661-0x0;var _0x2bd307=_0xac4b[_0x160661];return _0x2bd307;};'use strict';var moment=require(_0xbac4('0x0'));var Sequelize=require(_0xbac4('0x1'));module[_0xbac4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbac4('0x3')]},'leaveAt':{'type':Sequelize[_0xbac4('0x3')]},'acceptAt':{'type':Sequelize[_0xbac4('0x3')]},'exitAt':{'type':Sequelize[_0xbac4('0x3')]},'reason':{'type':Sequelize[_0xbac4('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index df35df9..40f0cfc 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 _0xb89c=['status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','nolimit','sort','pick','merge','where','filter','options','include','rows','catch','show','keys','intersection','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x389f40,_0x13c234){var _0x41a331=function(_0x1edece){while(--_0x1edece){_0x389f40['push'](_0x389f40['shift']());}};_0x41a331(++_0x13c234);}(_0xb89c,0x198));var _0xcb89=function(_0x4fd209,_0x334f60){_0x4fd209=_0x4fd209-0x0;var _0x2c5064=_0xb89c[_0x4fd209];return _0x2c5064;};'use strict';var emlformat=require(_0xcb89('0x0'));var rimraf=require(_0xcb89('0x1'));var zipdir=require(_0xcb89('0x2'));var jsonpatch=require(_0xcb89('0x3'));var rp=require('request-promise');var moment=require(_0xcb89('0x4'));var BPromise=require(_0xcb89('0x5'));var Mustache=require('mustache');var util=require(_0xcb89('0x6'));var path=require(_0xcb89('0x7'));var sox=require(_0xcb89('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb89('0x9'));var _=require(_0xcb89('0xa'));var squel=require(_0xcb89('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb89('0xc'));var deskjs=require(_0xcb89('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb89('0xe'));var Redis=require('ioredis');var authService=require(_0xcb89('0xf'));var qs=require(_0xcb89('0x10'));var as=require(_0xcb89('0x11'));var hardwareService=require(_0xcb89('0x12'));var logger=require(_0xcb89('0x13'))(_0xcb89('0x14'));var utils=require('../../config/utils');var config=require(_0xcb89('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb89('0x16'))['db'];function respondWithStatusCode(_0xf61a78,_0x31dbd7){_0x31dbd7=_0x31dbd7||0xcc;return function(_0x363de1){if(_0x363de1){return _0xf61a78[_0xcb89('0x17')](_0x31dbd7);}return _0xf61a78[_0xcb89('0x18')](_0x31dbd7)[_0xcb89('0x19')]();};}function respondWithResult(_0x53774a,_0x33f09a){_0x33f09a=_0x33f09a||0xc8;return function(_0x90a9eb){if(_0x90a9eb){return _0x53774a['status'](_0x33f09a)[_0xcb89('0x1a')](_0x90a9eb);}};}function respondWithFilteredResult(_0x15c35e,_0x1805fa){return function(_0x50a395){if(_0x50a395){var _0x8b9afa=typeof _0x1805fa['offset']==='undefined'&&typeof _0x1805fa[_0xcb89('0x1b')]===_0xcb89('0x1c');var _0x254d38=_0x50a395[_0xcb89('0x1d')];var _0x3ace69=_0x8b9afa?0x0:_0x1805fa[_0xcb89('0x1e')];var _0x1d99bd=_0x8b9afa?_0x50a395[_0xcb89('0x1d')]:_0x1805fa['offset']+_0x1805fa[_0xcb89('0x1b')];var _0x2bcb0b;if(_0x1d99bd>=_0x254d38){_0x1d99bd=_0x254d38;_0x2bcb0b=0xc8;}else{_0x2bcb0b=0xce;}_0x15c35e['status'](_0x2bcb0b);return _0x15c35e['set'](_0xcb89('0x1f'),_0x3ace69+'-'+_0x1d99bd+'/'+_0x254d38)[_0xcb89('0x1a')](_0x50a395);}return null;};}function patchUpdates(_0x1bbf3f){return function(_0x7a2f38){try{jsonpatch[_0xcb89('0x20')](_0x7a2f38,_0x1bbf3f,!![]);}catch(_0x355994){return BPromise[_0xcb89('0x21')](_0x355994);}return _0x7a2f38[_0xcb89('0x22')]();};}function saveUpdates(_0x5e547c,_0x1ae8e0){return function(_0x1dc399){if(_0x1dc399){return _0x1dc399[_0xcb89('0x23')](_0x5e547c)[_0xcb89('0x24')](function(_0x5d164c){return _0x5d164c;});}return null;};}function removeEntity(_0x136ecb,_0x4e81e2){return function(_0x189ada){if(_0x189ada){return _0x189ada['destroy']()[_0xcb89('0x24')](function(){_0x136ecb[_0xcb89('0x18')](0xcc)[_0xcb89('0x19')]();});}};}function handleEntityNotFound(_0x52bed3,_0x3b4d44){return function(_0x6925c7){if(!_0x6925c7){_0x52bed3[_0xcb89('0x17')](0x194);}return _0x6925c7;};}function handleError(_0x25b797,_0x7dc2d2){_0x7dc2d2=_0x7dc2d2||0x1f4;return function(_0x8febfd){logger[_0xcb89('0x25')](_0x8febfd[_0xcb89('0x26')]);if(_0x8febfd[_0xcb89('0x27')]){delete _0x8febfd['name'];}_0x25b797[_0xcb89('0x18')](_0x7dc2d2)['send'](_0x8febfd);};}exports[_0xcb89('0x28')]=function(_0x557dd4,_0x52eb25){var _0x185676={},_0x407daa={},_0x3b0c71={'count':0x0,'rows':[]};var _0x16059d=_[_0xcb89('0x29')](db[_0xcb89('0x2a')][_0xcb89('0x2b')],function(_0x240258){return{'name':_0x240258[_0xcb89('0x2c')],'type':_0x240258[_0xcb89('0x2d')][_0xcb89('0x2e')]};});_0x407daa['model']=_['map'](_0x16059d,_0xcb89('0x27'));_0x407daa[_0xcb89('0x2f')]=_['keys'](_0x557dd4[_0xcb89('0x2f')]);_0x407daa[_0xcb89('0x30')]=_['intersection'](_0x407daa[_0xcb89('0x31')],_0x407daa[_0xcb89('0x2f')]);_0x185676[_0xcb89('0x32')]=_['intersection'](_0x407daa[_0xcb89('0x31')],qs['fields'](_0x557dd4['query'][_0xcb89('0x33')]));_0x185676[_0xcb89('0x32')]=_0x185676[_0xcb89('0x32')]['length']?_0x185676[_0xcb89('0x32')]:_0x407daa[_0xcb89('0x31')];if(!_0x557dd4[_0xcb89('0x2f')]['hasOwnProperty'](_0xcb89('0x34'))){_0x185676[_0xcb89('0x1b')]=qs[_0xcb89('0x1b')](_0x557dd4[_0xcb89('0x2f')][_0xcb89('0x1b')]);_0x185676[_0xcb89('0x1e')]=qs['offset'](_0x557dd4[_0xcb89('0x2f')][_0xcb89('0x1e')]);}_0x185676['order']=qs[_0xcb89('0x35')](_0x557dd4[_0xcb89('0x2f')][_0xcb89('0x35')]);_0x185676['where']=qs[_0xcb89('0x30')](_[_0xcb89('0x36')](_0x557dd4[_0xcb89('0x2f')],_0x407daa[_0xcb89('0x30')]),_0x16059d);if(_0x557dd4[_0xcb89('0x2f')]['filter']){_0x185676['where']=_[_0xcb89('0x37')](_0x185676[_0xcb89('0x38')],{'$or':_[_0xcb89('0x29')](_0x16059d,function(_0x282fa3){if(_0x282fa3['type']!=='VIRTUAL'){var _0x1890e1={};_0x1890e1[_0x282fa3['name']]={'$like':'%'+_0x557dd4[_0xcb89('0x2f')][_0xcb89('0x39')]+'%'};return _0x1890e1;}})});}_0x185676=_[_0xcb89('0x37')]({},_0x185676,_0x557dd4[_0xcb89('0x3a')]);var _0x599b29={'where':_0x185676[_0xcb89('0x38')]};return db[_0xcb89('0x2a')][_0xcb89('0x1d')](_0x599b29)[_0xcb89('0x24')](function(_0x1b5082){_0x3b0c71[_0xcb89('0x1d')]=_0x1b5082;if(_0x557dd4[_0xcb89('0x2f')]['includeAll']){_0x185676[_0xcb89('0x3b')]=[{'all':!![]}];}return db[_0xcb89('0x2a')]['findAll'](_0x185676);})[_0xcb89('0x24')](function(_0x49c3a9){_0x3b0c71[_0xcb89('0x3c')]=_0x49c3a9;return _0x3b0c71;})[_0xcb89('0x24')](respondWithFilteredResult(_0x52eb25,_0x185676))[_0xcb89('0x3d')](handleError(_0x52eb25,null));};exports[_0xcb89('0x3e')]=function(_0x3a6b1e,_0x356e8f){var _0x5cc614={'raw':!![],'where':{'id':_0x3a6b1e['params']['id']}},_0x483150={};_0x483150[_0xcb89('0x31')]=_[_0xcb89('0x3f')](db[_0xcb89('0x2a')][_0xcb89('0x2b')]);_0x483150['query']=_[_0xcb89('0x3f')](_0x3a6b1e[_0xcb89('0x2f')]);_0x483150['filters']=_['intersection'](_0x483150[_0xcb89('0x31')],_0x483150[_0xcb89('0x2f')]);_0x5cc614[_0xcb89('0x32')]=_[_0xcb89('0x40')](_0x483150['model'],qs[_0xcb89('0x33')](_0x3a6b1e[_0xcb89('0x2f')][_0xcb89('0x33')]));_0x5cc614[_0xcb89('0x32')]=_0x5cc614['attributes'][_0xcb89('0x41')]?_0x5cc614['attributes']:_0x483150[_0xcb89('0x31')];if(_0x3a6b1e[_0xcb89('0x2f')][_0xcb89('0x42')]){_0x5cc614[_0xcb89('0x3b')]=[{'all':!![]}];}_0x5cc614=_[_0xcb89('0x37')]({},_0x5cc614,_0x3a6b1e['options']);return db[_0xcb89('0x2a')][_0xcb89('0x43')](_0x5cc614)['then'](handleEntityNotFound(_0x356e8f,null))[_0xcb89('0x24')](respondWithResult(_0x356e8f,null))[_0xcb89('0x3d')](handleError(_0x356e8f,null));};exports['create']=function(_0x4bb31e,_0x3775b3){return db[_0xcb89('0x2a')][_0xcb89('0x44')](_0x4bb31e[_0xcb89('0x45')],{})[_0xcb89('0x24')](respondWithResult(_0x3775b3,0xc9))[_0xcb89('0x3d')](handleError(_0x3775b3,null));};exports[_0xcb89('0x23')]=function(_0x295f08,_0x484585){if(_0x295f08[_0xcb89('0x45')]['id']){delete _0x295f08[_0xcb89('0x45')]['id'];}return db['ChatQueueReport'][_0xcb89('0x43')]({'where':{'id':_0x295f08['params']['id']}})[_0xcb89('0x24')](handleEntityNotFound(_0x484585,null))[_0xcb89('0x24')](saveUpdates(_0x295f08[_0xcb89('0x45')],null))[_0xcb89('0x24')](respondWithResult(_0x484585,null))['catch'](handleError(_0x484585,null));};exports['destroy']=function(_0x1fb950,_0x40dc8e){return db[_0xcb89('0x2a')][_0xcb89('0x43')]({'where':{'id':_0x1fb950[_0xcb89('0x46')]['id']}})[_0xcb89('0x24')](handleEntityNotFound(_0x40dc8e,null))[_0xcb89('0x24')](removeEntity(_0x40dc8e,null))[_0xcb89('0x3d')](handleError(_0x40dc8e,null));};exports[_0xcb89('0x47')]=function(_0x56da18,_0x1dc709){return db[_0xcb89('0x2a')][_0xcb89('0x47')]()['then'](respondWithResult(_0x1dc709,null))[_0xcb89('0x3d')](handleError(_0x1dc709,null));}; \ No newline at end of file +var _0x229c=['rimraf','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','error','stack','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','describe'];(function(_0x4ce19b,_0xbba834){var _0x617495=function(_0xb5c941){while(--_0xb5c941){_0x4ce19b['push'](_0x4ce19b['shift']());}};_0x617495(++_0xbba834);}(_0x229c,0xcf));var _0xc229=function(_0x35fb43,_0x2ed757){_0x35fb43=_0x35fb43-0x0;var _0x379bda=_0x229c[_0x35fb43];return _0x379bda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc229('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc229('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc229('0x2'));var util=require('util');var path=require(_0xc229('0x3'));var sox=require(_0xc229('0x4'));var csv=require(_0xc229('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc229('0x6'));var _=require('lodash');var squel=require(_0xc229('0x7'));var crypto=require(_0xc229('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc229('0x9'));var toCsv=require(_0xc229('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc229('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc229('0xb'));var hardwareService=require(_0xc229('0xc'));var logger=require(_0xc229('0xd'))(_0xc229('0xe'));var utils=require(_0xc229('0xf'));var config=require(_0xc229('0x10'));var licenseUtil=require(_0xc229('0x11'));var db=require(_0xc229('0x12'))['db'];function respondWithStatusCode(_0xf7cd15,_0x337ae0){_0x337ae0=_0x337ae0||0xcc;return function(_0x1faf37){if(_0x1faf37){return _0xf7cd15[_0xc229('0x13')](_0x337ae0);}return _0xf7cd15[_0xc229('0x14')](_0x337ae0)['end']();};}function respondWithResult(_0x36cfb4,_0x53ba7a){_0x53ba7a=_0x53ba7a||0xc8;return function(_0x6dd4c2){if(_0x6dd4c2){return _0x36cfb4[_0xc229('0x14')](_0x53ba7a)[_0xc229('0x15')](_0x6dd4c2);}};}function respondWithFilteredResult(_0x1cc8ed,_0x1d9efd){return function(_0x7b71c3){if(_0x7b71c3){var _0x292f30=typeof _0x1d9efd[_0xc229('0x16')]===_0xc229('0x17')&&typeof _0x1d9efd[_0xc229('0x18')]===_0xc229('0x17');var _0x11771e=_0x7b71c3[_0xc229('0x19')];var _0x4cae05=_0x292f30?0x0:_0x1d9efd[_0xc229('0x16')];var _0x10339a=_0x292f30?_0x7b71c3[_0xc229('0x19')]:_0x1d9efd[_0xc229('0x16')]+_0x1d9efd[_0xc229('0x18')];var _0x14ef5e;if(_0x10339a>=_0x11771e){_0x10339a=_0x11771e;_0x14ef5e=0xc8;}else{_0x14ef5e=0xce;}_0x1cc8ed[_0xc229('0x14')](_0x14ef5e);return _0x1cc8ed['set']('Content-Range',_0x4cae05+'-'+_0x10339a+'/'+_0x11771e)[_0xc229('0x15')](_0x7b71c3);}return null;};}function patchUpdates(_0x53dbba){return function(_0x46b7b0){try{jsonpatch[_0xc229('0x1a')](_0x46b7b0,_0x53dbba,!![]);}catch(_0x55691a){return BPromise['reject'](_0x55691a);}return _0x46b7b0[_0xc229('0x1b')]();};}function saveUpdates(_0x40d549,_0x3a9957){return function(_0x3b20af){if(_0x3b20af){return _0x3b20af[_0xc229('0x1c')](_0x40d549)[_0xc229('0x1d')](function(_0x6e7910){return _0x6e7910;});}return null;};}function removeEntity(_0x50fd02,_0x5cb52f){return function(_0x8c4f83){if(_0x8c4f83){return _0x8c4f83[_0xc229('0x1e')]()['then'](function(){_0x50fd02['status'](0xcc)[_0xc229('0x1f')]();});}};}function handleEntityNotFound(_0x30c711,_0x12a5b8){return function(_0x190e58){if(!_0x190e58){_0x30c711[_0xc229('0x13')](0x194);}return _0x190e58;};}function handleError(_0x268546,_0x5a05b3){_0x5a05b3=_0x5a05b3||0x1f4;return function(_0x103d43){logger[_0xc229('0x20')](_0x103d43[_0xc229('0x21')]);if(_0x103d43['name']){delete _0x103d43['name'];}_0x268546[_0xc229('0x14')](_0x5a05b3)['send'](_0x103d43);};}exports[_0xc229('0x22')]=function(_0x2a6e38,_0x2c5fbf){var _0x1a94ac={},_0xfa1ba2={},_0x34d258={'count':0x0,'rows':[]};var _0x1928b8=_[_0xc229('0x23')](db[_0xc229('0x24')][_0xc229('0x25')],function(_0x195be7){return{'name':_0x195be7[_0xc229('0x26')],'type':_0x195be7[_0xc229('0x27')][_0xc229('0x28')]};});_0xfa1ba2[_0xc229('0x29')]=_[_0xc229('0x23')](_0x1928b8,_0xc229('0x2a'));_0xfa1ba2[_0xc229('0x2b')]=_[_0xc229('0x2c')](_0x2a6e38[_0xc229('0x2b')]);_0xfa1ba2[_0xc229('0x2d')]=_['intersection'](_0xfa1ba2[_0xc229('0x29')],_0xfa1ba2['query']);_0x1a94ac[_0xc229('0x2e')]=_[_0xc229('0x2f')](_0xfa1ba2['model'],qs[_0xc229('0x30')](_0x2a6e38[_0xc229('0x2b')][_0xc229('0x30')]));_0x1a94ac[_0xc229('0x2e')]=_0x1a94ac[_0xc229('0x2e')][_0xc229('0x31')]?_0x1a94ac['attributes']:_0xfa1ba2[_0xc229('0x29')];if(!_0x2a6e38[_0xc229('0x2b')][_0xc229('0x32')](_0xc229('0x33'))){_0x1a94ac[_0xc229('0x18')]=qs[_0xc229('0x18')](_0x2a6e38[_0xc229('0x2b')][_0xc229('0x18')]);_0x1a94ac[_0xc229('0x16')]=qs[_0xc229('0x16')](_0x2a6e38[_0xc229('0x2b')]['offset']);}_0x1a94ac[_0xc229('0x34')]=qs[_0xc229('0x35')](_0x2a6e38[_0xc229('0x2b')]['sort']);_0x1a94ac[_0xc229('0x36')]=qs[_0xc229('0x2d')](_['pick'](_0x2a6e38['query'],_0xfa1ba2[_0xc229('0x2d')]),_0x1928b8);if(_0x2a6e38['query']['filter']){_0x1a94ac['where']=_[_0xc229('0x37')](_0x1a94ac['where'],{'$or':_['map'](_0x1928b8,function(_0x19b4a8){if(_0x19b4a8['type']!==_0xc229('0x38')){var _0x3f0008={};_0x3f0008[_0x19b4a8[_0xc229('0x2a')]]={'$like':'%'+_0x2a6e38[_0xc229('0x2b')][_0xc229('0x39')]+'%'};return _0x3f0008;}})});}_0x1a94ac=_['merge']({},_0x1a94ac,_0x2a6e38[_0xc229('0x3a')]);var _0x4f9912={'where':_0x1a94ac[_0xc229('0x36')]};return db[_0xc229('0x24')][_0xc229('0x19')](_0x4f9912)[_0xc229('0x1d')](function(_0x2c352b){_0x34d258[_0xc229('0x19')]=_0x2c352b;if(_0x2a6e38['query'][_0xc229('0x3b')]){_0x1a94ac[_0xc229('0x3c')]=[{'all':!![]}];}return db[_0xc229('0x24')][_0xc229('0x3d')](_0x1a94ac);})[_0xc229('0x1d')](function(_0x48e504){_0x34d258['rows']=_0x48e504;return _0x34d258;})[_0xc229('0x1d')](respondWithFilteredResult(_0x2c5fbf,_0x1a94ac))[_0xc229('0x3e')](handleError(_0x2c5fbf,null));};exports[_0xc229('0x3f')]=function(_0x1deb7b,_0x553386){var _0x109b37={'raw':!![],'where':{'id':_0x1deb7b[_0xc229('0x40')]['id']}},_0x192f0d={};_0x192f0d[_0xc229('0x29')]=_[_0xc229('0x2c')](db[_0xc229('0x24')][_0xc229('0x25')]);_0x192f0d['query']=_['keys'](_0x1deb7b[_0xc229('0x2b')]);_0x192f0d[_0xc229('0x2d')]=_[_0xc229('0x2f')](_0x192f0d[_0xc229('0x29')],_0x192f0d[_0xc229('0x2b')]);_0x109b37[_0xc229('0x2e')]=_[_0xc229('0x2f')](_0x192f0d[_0xc229('0x29')],qs[_0xc229('0x30')](_0x1deb7b[_0xc229('0x2b')]['fields']));_0x109b37[_0xc229('0x2e')]=_0x109b37['attributes'][_0xc229('0x31')]?_0x109b37[_0xc229('0x2e')]:_0x192f0d[_0xc229('0x29')];if(_0x1deb7b['query'][_0xc229('0x3b')]){_0x109b37['include']=[{'all':!![]}];}_0x109b37=_[_0xc229('0x37')]({},_0x109b37,_0x1deb7b[_0xc229('0x3a')]);return db[_0xc229('0x24')]['find'](_0x109b37)[_0xc229('0x1d')](handleEntityNotFound(_0x553386,null))[_0xc229('0x1d')](respondWithResult(_0x553386,null))[_0xc229('0x3e')](handleError(_0x553386,null));};exports[_0xc229('0x41')]=function(_0x2f3cc,_0x7d7799){return db[_0xc229('0x24')][_0xc229('0x41')](_0x2f3cc[_0xc229('0x42')],{})[_0xc229('0x1d')](respondWithResult(_0x7d7799,0xc9))[_0xc229('0x3e')](handleError(_0x7d7799,null));};exports[_0xc229('0x1c')]=function(_0x13f449,_0x41d94c){if(_0x13f449[_0xc229('0x42')]['id']){delete _0x13f449[_0xc229('0x42')]['id'];}return db[_0xc229('0x24')][_0xc229('0x43')]({'where':{'id':_0x13f449[_0xc229('0x40')]['id']}})[_0xc229('0x1d')](handleEntityNotFound(_0x41d94c,null))['then'](saveUpdates(_0x13f449['body'],null))[_0xc229('0x1d')](respondWithResult(_0x41d94c,null))[_0xc229('0x3e')](handleError(_0x41d94c,null));};exports[_0xc229('0x1e')]=function(_0x442dbe,_0x5c043c){return db['ChatQueueReport'][_0xc229('0x43')]({'where':{'id':_0x442dbe['params']['id']}})[_0xc229('0x1d')](handleEntityNotFound(_0x5c043c,null))['then'](removeEntity(_0x5c043c,null))[_0xc229('0x3e')](handleError(_0x5c043c,null));};exports[_0xc229('0x44')]=function(_0x47fd5c,_0x3df335){return db[_0xc229('0x24')][_0xc229('0x44')]()['then'](respondWithResult(_0x3df335,null))[_0xc229('0x3e')](handleError(_0x3df335,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1950e4d..1bdedd1 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(_0x16b737,_0x16d0cb){var _0x3405fa=function(_0x389d5b){while(--_0x389d5b){_0x16b737['push'](_0x16b737['shift']());}};_0x3405fa(++_0x16d0cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x380356,_0x44304f){var _0x542fb4=function(_0x132eec){while(--_0x132eec){_0x380356['push'](_0x380356['shift']());}};_0x542fb4(++_0x44304f);}(_0xe706,0xa3));var _0x6e70=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0xe706[_0x5aa992];return _0x2e2d59;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4f7f32f..f45acef 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 _0x756e=['request','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','ChatQueueReport','create','body','options','raw','then','CreateChatQueueReport','update','where','attributes','limit','UpdateChatQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2917f0,_0x1cd7fb){var _0x41602e=function(_0xb196e3){while(--_0xb196e3){_0x2917f0['push'](_0x2917f0['shift']());}};_0x41602e(++_0x1cd7fb);}(_0x756e,0x18d));var _0xe756=function(_0x52f871,_0x4091eb){_0x52f871=_0x52f871-0x0;var _0x4e380f=_0x756e[_0x52f871];return _0x4e380f;};'use strict';var _=require('lodash');var util=require(_0xe756('0x0'));var moment=require('moment');var BPromise=require(_0xe756('0x1'));var rs=require(_0xe756('0x2'));var fs=require('fs');var Redis=require(_0xe756('0x3'));var db=require(_0xe756('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe756('0x5'))(_0xe756('0x6'));var config=require(_0xe756('0x7'));var jayson=require(_0xe756('0x8'));var client=jayson[_0xe756('0x9')][_0xe756('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ee1e6,_0x3e47e6,_0x1f0738){return new BPromise(function(_0x134ba7,_0x381dba){return client[_0xe756('0xb')](_0x2ee1e6,_0x1f0738)['then'](function(_0xc6a946){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3e47e6,_0xe756('0xc'));logger[_0xe756('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x3e47e6,_0xe756('0xc'),JSON[_0xe756('0xe')](_0xc6a946));if(_0xc6a946[_0xe756('0xf')]){if(_0xc6a946[_0xe756('0xf')][_0xe756('0x10')]===0x1f4){logger[_0xe756('0xf')](_0xe756('0x11'),_0x3e47e6,_0xc6a946['error']['message']);return _0x381dba(_0xc6a946[_0xe756('0xf')][_0xe756('0x12')]);}logger[_0xe756('0xf')](_0xe756('0x11'),_0x3e47e6,_0xc6a946[_0xe756('0xf')][_0xe756('0x12')]);return _0x134ba7(_0xc6a946[_0xe756('0xf')][_0xe756('0x12')]);}else{logger[_0xe756('0x13')](_0xe756('0x11'),_0x3e47e6,_0xe756('0xc'));_0x134ba7(_0xc6a946[_0xe756('0x14')][_0xe756('0x12')]);}})[_0xe756('0x15')](function(_0x557b5c){logger['error'](_0xe756('0x11'),_0x3e47e6,_0x557b5c);_0x381dba(_0x557b5c);});});}exports['CreateChatQueueReport']=function(_0x31b538){var _0x2f0638=this;return new Promise(function(_0x381f49,_0x2d20b3){return db[_0xe756('0x16')][_0xe756('0x17')](_0x31b538[_0xe756('0x18')],{'raw':_0x31b538[_0xe756('0x19')]?_0x31b538[_0xe756('0x19')][_0xe756('0x1a')]===undefined?!![]:![]:!![]})[_0xe756('0x1b')](function(_0x269bdd){logger['info'](_0xe756('0x1c'),_0x31b538);logger[_0xe756('0xd')](_0xe756('0x1c'),_0x31b538,JSON[_0xe756('0xe')](_0x269bdd));_0x381f49(_0x269bdd);})[_0xe756('0x15')](function(_0x1d9383){logger[_0xe756('0xf')](_0xe756('0x1c'),_0x1d9383[_0xe756('0x12')],_0x31b538);_0x2d20b3(_0x2f0638[_0xe756('0xf')](0x1f4,_0x1d9383['message']));});});};exports['UpdateChatQueueReport']=function(_0xacf91){var _0x5b82eb=this;return new Promise(function(_0x146dbe,_0x576feb){return db['ChatQueueReport'][_0xe756('0x1d')](_0xacf91[_0xe756('0x18')],{'raw':_0xacf91[_0xe756('0x19')]?_0xacf91['options'][_0xe756('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xacf91['options']?_0xacf91['options'][_0xe756('0x1e')]||null:null,'attributes':_0xacf91[_0xe756('0x19')]?_0xacf91['options'][_0xe756('0x1f')]||null:null,'limit':_0xacf91['options']?_0xacf91['options'][_0xe756('0x20')]||null:null})[_0xe756('0x1b')](function(_0x1d7043){logger[_0xe756('0x13')](_0xe756('0x21'),_0xacf91);logger[_0xe756('0xd')](_0xe756('0x21'),_0xacf91,JSON[_0xe756('0xe')](_0x1d7043));_0x146dbe(_0x1d7043);})['catch'](function(_0x27b5b5){logger[_0xe756('0xf')]('UpdateChatQueueReport',_0x27b5b5[_0xe756('0x12')],_0xacf91);_0x576feb(_0x5b82eb['error'](0x1f4,_0x27b5b5[_0xe756('0x12')]));});});}; \ No newline at end of file +var _0x3107=['client','http','request','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','limit','then','UpdateChatQueueReport','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11e2ea,_0x1d81d6){var _0x446348=function(_0x2dfef1){while(--_0x2dfef1){_0x11e2ea['push'](_0x11e2ea['shift']());}};_0x446348(++_0x1d81d6);}(_0x3107,0x1b8));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7310('0x0'));var BPromise=require(_0x7310('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7310('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7310('0x3'));var logger=require(_0x7310('0x4'))(_0x7310('0x5'));var config=require(_0x7310('0x6'));var jayson=require(_0x7310('0x7'));var client=jayson[_0x7310('0x8')][_0x7310('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3895d9,_0x45cf32,_0x5bc976){return new BPromise(function(_0x30812e,_0x1a481d){return client[_0x7310('0xa')](_0x3895d9,_0x5bc976)['then'](function(_0x19bda8){logger[_0x7310('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x45cf32,'request\x20sent');logger[_0x7310('0xc')](_0x7310('0xd'),_0x45cf32,_0x7310('0xe'),JSON[_0x7310('0xf')](_0x19bda8));if(_0x19bda8[_0x7310('0x10')]){if(_0x19bda8[_0x7310('0x10')][_0x7310('0x11')]===0x1f4){logger[_0x7310('0x10')](_0x7310('0x12'),_0x45cf32,_0x19bda8[_0x7310('0x10')]['message']);return _0x1a481d(_0x19bda8[_0x7310('0x10')][_0x7310('0x13')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x45cf32,_0x19bda8[_0x7310('0x10')][_0x7310('0x13')]);return _0x30812e(_0x19bda8[_0x7310('0x10')]['message']);}else{logger[_0x7310('0xb')](_0x7310('0x12'),_0x45cf32,_0x7310('0xe'));_0x30812e(_0x19bda8[_0x7310('0x14')][_0x7310('0x13')]);}})['catch'](function(_0x1d0769){logger['error'](_0x7310('0x12'),_0x45cf32,_0x1d0769);_0x1a481d(_0x1d0769);});});}exports[_0x7310('0x15')]=function(_0x2fa1ca){var _0x36844e=this;return new Promise(function(_0xe43518,_0x538518){return db[_0x7310('0x16')][_0x7310('0x17')](_0x2fa1ca[_0x7310('0x18')],{'raw':_0x2fa1ca[_0x7310('0x19')]?_0x2fa1ca[_0x7310('0x19')][_0x7310('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1efda5){logger['info'](_0x7310('0x15'),_0x2fa1ca);logger[_0x7310('0xc')]('CreateChatQueueReport',_0x2fa1ca,JSON['stringify'](_0x1efda5));_0xe43518(_0x1efda5);})['catch'](function(_0x4511c2){logger[_0x7310('0x10')]('CreateChatQueueReport',_0x4511c2[_0x7310('0x13')],_0x2fa1ca);_0x538518(_0x36844e[_0x7310('0x10')](0x1f4,_0x4511c2[_0x7310('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x377d73){var _0x563f84=this;return new Promise(function(_0x5cb4a1,_0x125e30){return db[_0x7310('0x16')][_0x7310('0x1b')](_0x377d73[_0x7310('0x18')],{'raw':_0x377d73[_0x7310('0x19')]?_0x377d73[_0x7310('0x19')][_0x7310('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x377d73[_0x7310('0x19')]?_0x377d73[_0x7310('0x19')]['where']||null:null,'attributes':_0x377d73[_0x7310('0x19')]?_0x377d73[_0x7310('0x19')]['attributes']||null:null,'limit':_0x377d73[_0x7310('0x19')]?_0x377d73[_0x7310('0x19')][_0x7310('0x1c')]||null:null})[_0x7310('0x1d')](function(_0x2cb1b5){logger[_0x7310('0xb')](_0x7310('0x1e'),_0x377d73);logger[_0x7310('0xc')](_0x7310('0x1e'),_0x377d73,JSON[_0x7310('0xf')](_0x2cb1b5));_0x5cb4a1(_0x2cb1b5);})[_0x7310('0x1f')](function(_0x57e516){logger[_0x7310('0x10')](_0x7310('0x1e'),_0x57e516[_0x7310('0x13')],_0x377d73);_0x125e30(_0x563f84['error'](0x1f4,_0x57e516[_0x7310('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1c98743..821ad57 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 _0x5a8d=['index','/describe','describe','/:id','show','post','isAuthenticated','create','put','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x3942e0,_0x168622){var _0x377871=function(_0x46fe1c){while(--_0x46fe1c){_0x3942e0['push'](_0x3942e0['shift']());}};_0x377871(++_0x168622);}(_0x5a8d,0xac));var _0xd5a8=function(_0x1c8a2f,_0x45b2b8){_0x1c8a2f=_0x1c8a2f-0x0;var _0x469bd4=_0x5a8d[_0x1c8a2f];return _0x469bd4;};'use strict';var multer=require('multer');var util=require(_0xd5a8('0x0'));var path=require(_0xd5a8('0x1'));var timeout=require(_0xd5a8('0x2'));var express=require('express');var router=express[_0xd5a8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd5a8('0x4'));var interaction=require(_0xd5a8('0x5'));var config=require(_0xd5a8('0x6'));var controller=require(_0xd5a8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd5a8('0x8')]);router['get'](_0xd5a8('0x9'),auth['isAuthenticated'](),controller[_0xd5a8('0xa')]);router['get'](_0xd5a8('0xb'),auth['isAuthenticated'](),controller[_0xd5a8('0xc')]);router[_0xd5a8('0xd')]('/',auth[_0xd5a8('0xe')](),controller[_0xd5a8('0xf')]);router[_0xd5a8('0x10')](_0xd5a8('0xb'),auth[_0xd5a8('0xe')](),controller['update']);router['delete'](_0xd5a8('0xb'),auth[_0xd5a8('0xe')](),controller['destroy']);module[_0xd5a8('0x11')]=router; \ No newline at end of file +var _0xe3e6=['update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x49c5e7,_0x398f36){var _0x70bbae=function(_0x1e77d3){while(--_0x1e77d3){_0x49c5e7['push'](_0x49c5e7['shift']());}};_0x70bbae(++_0x398f36);}(_0xe3e6,0xd5));var _0x6e3e=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xe3e6[_0x5bfa44];return _0x43815f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e3e('0x0'));var timeout=require(_0x6e3e('0x1'));var express=require(_0x6e3e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e3e('0x3'));var interaction=require(_0x6e3e('0x4'));var config=require(_0x6e3e('0x5'));var controller=require(_0x6e3e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e3e('0x7')]);router[_0x6e3e('0x8')]('/describe',auth[_0x6e3e('0x9')](),controller['describe']);router['get'](_0x6e3e('0xa'),auth[_0x6e3e('0x9')](),controller[_0x6e3e('0xb')]);router[_0x6e3e('0xc')]('/',auth[_0x6e3e('0x9')](),controller[_0x6e3e('0xd')]);router[_0x6e3e('0xe')](_0x6e3e('0xa'),auth[_0x6e3e('0x9')](),controller[_0x6e3e('0xf')]);router[_0x6e3e('0x10')](_0x6e3e('0xa'),auth['isAuthenticated'](),controller[_0x6e3e('0x11')]);module[_0x6e3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0814c3e..7799041 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2fbfe2,_0x29310a){var _0x42662a=function(_0x39921a){while(--_0x39921a){_0x2fbfe2['push'](_0x2fbfe2['shift']());}};_0x42662a(++_0x29310a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x26b109,_0x25f9c0){_0x26b109=_0x26b109-0x0;var _0x35608a=_0xf4eb[_0x26b109];return _0x35608a;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3caba9,_0x1f0498){var _0x3bc5f0=function(_0x55c068){while(--_0x55c068){_0x3caba9['push'](_0x3caba9['shift']());}};_0x3bc5f0(++_0x1f0498);}(_0x54ef,0x112));var _0xf54e=function(_0xeb1aef,_0x2ee5b0){_0xeb1aef=_0xeb1aef-0x0;var _0x3b8dfd=_0x54ef[_0xeb1aef];return _0x3b8dfd;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1a2dc06..52a8601 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 _0x566b=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','rawAttributes','keys','include','find','catch','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x10a306,_0x1603c7){var _0x38e538=function(_0x4f4947){while(--_0x4f4947){_0x10a306['push'](_0x10a306['shift']());}};_0x38e538(++_0x1603c7);}(_0x566b,0x159));var _0xb566=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x566b[_0x43a37c];return _0x5d1d40;};'use strict';var emlformat=require(_0xb566('0x0'));var rimraf=require(_0xb566('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb566('0x2'));var rp=require('request-promise');var moment=require(_0xb566('0x3'));var BPromise=require(_0xb566('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb566('0x5'));var sox=require(_0xb566('0x6'));var csv=require(_0xb566('0x7'));var ejs=require(_0xb566('0x8'));var fs=require('fs');var fs_extra=require(_0xb566('0x9'));var _=require(_0xb566('0xa'));var squel=require('squel');var crypto=require(_0xb566('0xb'));var jsforce=require(_0xb566('0xc'));var deskjs=require(_0xb566('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb566('0xe'));var Papa=require(_0xb566('0xf'));var Redis=require('ioredis');var authService=require(_0xb566('0x10'));var qs=require(_0xb566('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb566('0x12'));var logger=require('../../config/logger')(_0xb566('0x13'));var utils=require(_0xb566('0x14'));var config=require(_0xb566('0x15'));var licenseUtil=require(_0xb566('0x16'));var db=require(_0xb566('0x17'))['db'];function respondWithStatusCode(_0xb84328,_0x43acb3){_0x43acb3=_0x43acb3||0xcc;return function(_0x514aa7){if(_0x514aa7){return _0xb84328[_0xb566('0x18')](_0x43acb3);}return _0xb84328[_0xb566('0x19')](_0x43acb3)[_0xb566('0x1a')]();};}function respondWithResult(_0x5990ab,_0x13940e){_0x13940e=_0x13940e||0xc8;return function(_0x4a30cb){if(_0x4a30cb){return _0x5990ab[_0xb566('0x19')](_0x13940e)[_0xb566('0x1b')](_0x4a30cb);}};}function respondWithFilteredResult(_0x3c0665,_0x1dcbc7){return function(_0xea1526){if(_0xea1526){var _0x20deae=typeof _0x1dcbc7[_0xb566('0x1c')]===_0xb566('0x1d')&&typeof _0x1dcbc7[_0xb566('0x1e')]==='undefined';var _0x2345e3=_0xea1526[_0xb566('0x1f')];var _0x21cc4f=_0x20deae?0x0:_0x1dcbc7[_0xb566('0x1c')];var _0x4dc6d9=_0x20deae?_0xea1526['count']:_0x1dcbc7[_0xb566('0x1c')]+_0x1dcbc7[_0xb566('0x1e')];var _0x3d9991;if(_0x4dc6d9>=_0x2345e3){_0x4dc6d9=_0x2345e3;_0x3d9991=0xc8;}else{_0x3d9991=0xce;}_0x3c0665[_0xb566('0x19')](_0x3d9991);return _0x3c0665[_0xb566('0x20')](_0xb566('0x21'),_0x21cc4f+'-'+_0x4dc6d9+'/'+_0x2345e3)['json'](_0xea1526);}return null;};}function patchUpdates(_0x24a746){return function(_0x59f86f){try{jsonpatch[_0xb566('0x22')](_0x59f86f,_0x24a746,!![]);}catch(_0x428801){return BPromise['reject'](_0x428801);}return _0x59f86f[_0xb566('0x23')]();};}function saveUpdates(_0x4d81c3,_0x136dfe){return function(_0x5da04a){if(_0x5da04a){return _0x5da04a['update'](_0x4d81c3)['then'](function(_0x378f40){return _0x378f40;});}return null;};}function removeEntity(_0x150cbf,_0x1cdc56){return function(_0x393931){if(_0x393931){return _0x393931[_0xb566('0x24')]()[_0xb566('0x25')](function(){_0x150cbf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb677,_0x21c0de){return function(_0x137210){if(!_0x137210){_0x2fb677[_0xb566('0x18')](0x194);}return _0x137210;};}function handleError(_0x543445,_0x209aa5){_0x209aa5=_0x209aa5||0x1f4;return function(_0x21b76b){logger['error'](_0x21b76b[_0xb566('0x26')]);if(_0x21b76b[_0xb566('0x27')]){delete _0x21b76b[_0xb566('0x27')];}_0x543445['status'](_0x209aa5)[_0xb566('0x28')](_0x21b76b);};}exports[_0xb566('0x29')]=function(_0x54693d,_0x308376){var _0x3cc60b={},_0x4d0725={},_0x20a81d={'count':0x0,'rows':[]};var _0x25ac0d=_[_0xb566('0x2a')](db[_0xb566('0x2b')]['rawAttributes'],function(_0xe7e398){return{'name':_0xe7e398[_0xb566('0x2c')],'type':_0xe7e398[_0xb566('0x2d')][_0xb566('0x2e')]};});_0x4d0725[_0xb566('0x2f')]=_[_0xb566('0x2a')](_0x25ac0d,_0xb566('0x27'));_0x4d0725[_0xb566('0x30')]=_['keys'](_0x54693d[_0xb566('0x30')]);_0x4d0725[_0xb566('0x31')]=_[_0xb566('0x32')](_0x4d0725[_0xb566('0x2f')],_0x4d0725[_0xb566('0x30')]);_0x3cc60b['attributes']=_['intersection'](_0x4d0725[_0xb566('0x2f')],qs['fields'](_0x54693d[_0xb566('0x30')][_0xb566('0x33')]));_0x3cc60b['attributes']=_0x3cc60b[_0xb566('0x34')][_0xb566('0x35')]?_0x3cc60b['attributes']:_0x4d0725[_0xb566('0x2f')];if(!_0x54693d[_0xb566('0x30')][_0xb566('0x36')](_0xb566('0x37'))){_0x3cc60b[_0xb566('0x1e')]=qs[_0xb566('0x1e')](_0x54693d[_0xb566('0x30')][_0xb566('0x1e')]);_0x3cc60b[_0xb566('0x1c')]=qs['offset'](_0x54693d[_0xb566('0x30')]['offset']);}_0x3cc60b['order']=qs[_0xb566('0x38')](_0x54693d[_0xb566('0x30')][_0xb566('0x38')]);_0x3cc60b[_0xb566('0x39')]=qs[_0xb566('0x31')](_[_0xb566('0x3a')](_0x54693d[_0xb566('0x30')],_0x4d0725[_0xb566('0x31')]),_0x25ac0d);if(_0x54693d[_0xb566('0x30')][_0xb566('0x3b')]){_0x3cc60b['where']=_[_0xb566('0x3c')](_0x3cc60b[_0xb566('0x39')],{'$or':_[_0xb566('0x2a')](_0x25ac0d,function(_0x2d6c04){if(_0x2d6c04['type']!==_0xb566('0x3d')){var _0x46c184={};_0x46c184[_0x2d6c04[_0xb566('0x27')]]={'$like':'%'+_0x54693d[_0xb566('0x30')]['filter']+'%'};return _0x46c184;}})});}_0x3cc60b=_[_0xb566('0x3c')]({},_0x3cc60b,_0x54693d[_0xb566('0x3e')]);var _0x5da972={'where':_0x3cc60b[_0xb566('0x39')]};return db[_0xb566('0x2b')]['count'](_0x5da972)[_0xb566('0x25')](function(_0x141452){_0x20a81d[_0xb566('0x1f')]=_0x141452;if(_0x54693d[_0xb566('0x30')]['includeAll']){_0x3cc60b['include']=[{'all':!![]}];}return db[_0xb566('0x2b')][_0xb566('0x3f')](_0x3cc60b);})[_0xb566('0x25')](function(_0x501903){_0x20a81d['rows']=_0x501903;return _0x20a81d;})[_0xb566('0x25')](respondWithFilteredResult(_0x308376,_0x3cc60b))['catch'](handleError(_0x308376,null));};exports[_0xb566('0x40')]=function(_0x383464,_0x5380da){var _0xbe7f12={'raw':!![],'where':{'id':_0x383464[_0xb566('0x41')]['id']}},_0x220761={};_0x220761[_0xb566('0x2f')]=_['keys'](db[_0xb566('0x2b')][_0xb566('0x42')]);_0x220761[_0xb566('0x30')]=_[_0xb566('0x43')](_0x383464[_0xb566('0x30')]);_0x220761[_0xb566('0x31')]=_['intersection'](_0x220761[_0xb566('0x2f')],_0x220761['query']);_0xbe7f12[_0xb566('0x34')]=_[_0xb566('0x32')](_0x220761['model'],qs[_0xb566('0x33')](_0x383464[_0xb566('0x30')]['fields']));_0xbe7f12[_0xb566('0x34')]=_0xbe7f12[_0xb566('0x34')][_0xb566('0x35')]?_0xbe7f12[_0xb566('0x34')]:_0x220761[_0xb566('0x2f')];if(_0x383464[_0xb566('0x30')]['includeAll']){_0xbe7f12[_0xb566('0x44')]=[{'all':!![]}];}_0xbe7f12=_[_0xb566('0x3c')]({},_0xbe7f12,_0x383464[_0xb566('0x3e')]);return db[_0xb566('0x2b')][_0xb566('0x45')](_0xbe7f12)[_0xb566('0x25')](handleEntityNotFound(_0x5380da,null))['then'](respondWithResult(_0x5380da,null))[_0xb566('0x46')](handleError(_0x5380da,null));};exports['create']=function(_0x179aec,_0x3cf8a0){return db[_0xb566('0x2b')]['create'](_0x179aec[_0xb566('0x47')],{})['then'](respondWithResult(_0x3cf8a0,0xc9))[_0xb566('0x46')](handleError(_0x3cf8a0,null));};exports[_0xb566('0x48')]=function(_0x4e9205,_0x242721){if(_0x4e9205[_0xb566('0x47')]['id']){delete _0x4e9205['body']['id'];}return db[_0xb566('0x2b')]['find']({'where':{'id':_0x4e9205[_0xb566('0x41')]['id']}})['then'](handleEntityNotFound(_0x242721,null))[_0xb566('0x25')](saveUpdates(_0x4e9205[_0xb566('0x47')],null))[_0xb566('0x25')](respondWithResult(_0x242721,null))[_0xb566('0x46')](handleError(_0x242721,null));};exports[_0xb566('0x24')]=function(_0x355515,_0x429848){return db[_0xb566('0x2b')]['find']({'where':{'id':_0x355515['params']['id']}})[_0xb566('0x25')](handleEntityNotFound(_0x429848,null))[_0xb566('0x25')](removeEntity(_0x429848,null))[_0xb566('0x46')](handleError(_0x429848,null));};exports[_0xb566('0x49')]=function(_0x50494d,_0x17af22){return db[_0xb566('0x2b')]['describe']()[_0xb566('0x25')](respondWithResult(_0x17af22,null))[_0xb566('0x46')](handleError(_0x17af22,null));}; \ No newline at end of file +var _0x27af=['to-csv','fs-extra','lodash','squel','crypto','querystring','../../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','limit','count','set','Content-Range','reject','save','then','destroy','end','error','stack','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0x27af,0x123));var _0xf27a=function(_0x2df6b8,_0x2b5afa){_0x2df6b8=_0x2df6b8-0x0;var _0x181780=_0x27af[_0x2df6b8];return _0x181780;};'use strict';var emlformat=require(_0xf27a('0x0'));var rimraf=require(_0xf27a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf27a('0x2'));var rp=require(_0xf27a('0x3'));var moment=require(_0xf27a('0x4'));var BPromise=require(_0xf27a('0x5'));var Mustache=require(_0xf27a('0x6'));var util=require('util');var path=require(_0xf27a('0x7'));var sox=require(_0xf27a('0x8'));var csv=require(_0xf27a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf27a('0xa'));var _=require(_0xf27a('0xb'));var squel=require(_0xf27a('0xc'));var crypto=require(_0xf27a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf27a('0x9'));var querystring=require(_0xf27a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf27a('0xf'));var qs=require(_0xf27a('0x10'));var as=require(_0xf27a('0x11'));var hardwareService=require(_0xf27a('0x12'));var logger=require('../../config/logger')(_0xf27a('0x13'));var utils=require(_0xf27a('0x14'));var config=require(_0xf27a('0x15'));var licenseUtil=require(_0xf27a('0x16'));var db=require(_0xf27a('0x17'))['db'];function respondWithStatusCode(_0x162d5b,_0x4c1361){_0x4c1361=_0x4c1361||0xcc;return function(_0x4d4650){if(_0x4d4650){return _0x162d5b[_0xf27a('0x18')](_0x4c1361);}return _0x162d5b[_0xf27a('0x19')](_0x4c1361)['end']();};}function respondWithResult(_0x2a9a91,_0x303cc6){_0x303cc6=_0x303cc6||0xc8;return function(_0x363037){if(_0x363037){return _0x2a9a91[_0xf27a('0x19')](_0x303cc6)[_0xf27a('0x1a')](_0x363037);}};}function respondWithFilteredResult(_0x36fc3d,_0x3e20b4){return function(_0xda3730){if(_0xda3730){var _0x104dac=typeof _0x3e20b4[_0xf27a('0x1b')]===_0xf27a('0x1c')&&typeof _0x3e20b4[_0xf27a('0x1d')]===_0xf27a('0x1c');var _0x2252ed=_0xda3730[_0xf27a('0x1e')];var _0x247f7b=_0x104dac?0x0:_0x3e20b4['offset'];var _0x48556c=_0x104dac?_0xda3730[_0xf27a('0x1e')]:_0x3e20b4['offset']+_0x3e20b4[_0xf27a('0x1d')];var _0x447306;if(_0x48556c>=_0x2252ed){_0x48556c=_0x2252ed;_0x447306=0xc8;}else{_0x447306=0xce;}_0x36fc3d[_0xf27a('0x19')](_0x447306);return _0x36fc3d[_0xf27a('0x1f')](_0xf27a('0x20'),_0x247f7b+'-'+_0x48556c+'/'+_0x2252ed)[_0xf27a('0x1a')](_0xda3730);}return null;};}function patchUpdates(_0x55fdd2){return function(_0xa131bb){try{jsonpatch['apply'](_0xa131bb,_0x55fdd2,!![]);}catch(_0x1e0a16){return BPromise[_0xf27a('0x21')](_0x1e0a16);}return _0xa131bb[_0xf27a('0x22')]();};}function saveUpdates(_0x2109b0,_0x40b6d8){return function(_0xd96da7){if(_0xd96da7){return _0xd96da7['update'](_0x2109b0)[_0xf27a('0x23')](function(_0x1299da){return _0x1299da;});}return null;};}function removeEntity(_0x9b85df,_0x10044a){return function(_0x98b292){if(_0x98b292){return _0x98b292[_0xf27a('0x24')]()[_0xf27a('0x23')](function(){_0x9b85df[_0xf27a('0x19')](0xcc)[_0xf27a('0x25')]();});}};}function handleEntityNotFound(_0x16aac8,_0x10e8d6){return function(_0x425253){if(!_0x425253){_0x16aac8[_0xf27a('0x18')](0x194);}return _0x425253;};}function handleError(_0x2a3ae7,_0x44b9e9){_0x44b9e9=_0x44b9e9||0x1f4;return function(_0x34e981){logger[_0xf27a('0x26')](_0x34e981[_0xf27a('0x27')]);if(_0x34e981['name']){delete _0x34e981['name'];}_0x2a3ae7[_0xf27a('0x19')](_0x44b9e9)[_0xf27a('0x28')](_0x34e981);};}exports['index']=function(_0x452e99,_0x10cf01){var _0x4725ae={},_0x2ea8e5={},_0x2decd6={'count':0x0,'rows':[]};var _0x2b2dbe=_['map'](db[_0xf27a('0x29')][_0xf27a('0x2a')],function(_0x2147ce){return{'name':_0x2147ce[_0xf27a('0x2b')],'type':_0x2147ce[_0xf27a('0x2c')][_0xf27a('0x2d')]};});_0x2ea8e5[_0xf27a('0x2e')]=_[_0xf27a('0x2f')](_0x2b2dbe,_0xf27a('0x30'));_0x2ea8e5[_0xf27a('0x31')]=_[_0xf27a('0x32')](_0x452e99['query']);_0x2ea8e5[_0xf27a('0x33')]=_['intersection'](_0x2ea8e5['model'],_0x2ea8e5[_0xf27a('0x31')]);_0x4725ae['attributes']=_[_0xf27a('0x34')](_0x2ea8e5[_0xf27a('0x2e')],qs[_0xf27a('0x35')](_0x452e99['query'][_0xf27a('0x35')]));_0x4725ae[_0xf27a('0x36')]=_0x4725ae['attributes'][_0xf27a('0x37')]?_0x4725ae[_0xf27a('0x36')]:_0x2ea8e5[_0xf27a('0x2e')];if(!_0x452e99['query'][_0xf27a('0x38')]('nolimit')){_0x4725ae[_0xf27a('0x1d')]=qs['limit'](_0x452e99[_0xf27a('0x31')][_0xf27a('0x1d')]);_0x4725ae[_0xf27a('0x1b')]=qs[_0xf27a('0x1b')](_0x452e99['query']['offset']);}_0x4725ae[_0xf27a('0x39')]=qs['sort'](_0x452e99[_0xf27a('0x31')][_0xf27a('0x3a')]);_0x4725ae[_0xf27a('0x3b')]=qs[_0xf27a('0x33')](_[_0xf27a('0x3c')](_0x452e99[_0xf27a('0x31')],_0x2ea8e5['filters']),_0x2b2dbe);if(_0x452e99[_0xf27a('0x31')][_0xf27a('0x3d')]){_0x4725ae[_0xf27a('0x3b')]=_[_0xf27a('0x3e')](_0x4725ae[_0xf27a('0x3b')],{'$or':_['map'](_0x2b2dbe,function(_0x403e13){if(_0x403e13[_0xf27a('0x2c')]!==_0xf27a('0x3f')){var _0x267e20={};_0x267e20[_0x403e13[_0xf27a('0x30')]]={'$like':'%'+_0x452e99[_0xf27a('0x31')][_0xf27a('0x3d')]+'%'};return _0x267e20;}})});}_0x4725ae=_['merge']({},_0x4725ae,_0x452e99[_0xf27a('0x40')]);var _0x42b6e5={'where':_0x4725ae['where']};return db[_0xf27a('0x29')][_0xf27a('0x1e')](_0x42b6e5)[_0xf27a('0x23')](function(_0x329083){_0x2decd6['count']=_0x329083;if(_0x452e99[_0xf27a('0x31')]['includeAll']){_0x4725ae[_0xf27a('0x41')]=[{'all':!![]}];}return db[_0xf27a('0x29')][_0xf27a('0x42')](_0x4725ae);})[_0xf27a('0x23')](function(_0x4a6db4){_0x2decd6['rows']=_0x4a6db4;return _0x2decd6;})[_0xf27a('0x23')](respondWithFilteredResult(_0x10cf01,_0x4725ae))['catch'](handleError(_0x10cf01,null));};exports[_0xf27a('0x43')]=function(_0x38aae7,_0x36fcef){var _0x2a7a62={'raw':!![],'where':{'id':_0x38aae7[_0xf27a('0x44')]['id']}},_0x4fcf31={};_0x4fcf31['model']=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x4fcf31[_0xf27a('0x31')]=_[_0xf27a('0x32')](_0x38aae7[_0xf27a('0x31')]);_0x4fcf31[_0xf27a('0x33')]=_[_0xf27a('0x34')](_0x4fcf31[_0xf27a('0x2e')],_0x4fcf31[_0xf27a('0x31')]);_0x2a7a62[_0xf27a('0x36')]=_[_0xf27a('0x34')](_0x4fcf31[_0xf27a('0x2e')],qs[_0xf27a('0x35')](_0x38aae7[_0xf27a('0x31')]['fields']));_0x2a7a62[_0xf27a('0x36')]=_0x2a7a62[_0xf27a('0x36')][_0xf27a('0x37')]?_0x2a7a62[_0xf27a('0x36')]:_0x4fcf31['model'];if(_0x38aae7[_0xf27a('0x31')][_0xf27a('0x45')]){_0x2a7a62[_0xf27a('0x41')]=[{'all':!![]}];}_0x2a7a62=_[_0xf27a('0x3e')]({},_0x2a7a62,_0x38aae7[_0xf27a('0x40')]);return db[_0xf27a('0x29')][_0xf27a('0x46')](_0x2a7a62)['then'](handleEntityNotFound(_0x36fcef,null))['then'](respondWithResult(_0x36fcef,null))[_0xf27a('0x47')](handleError(_0x36fcef,null));};exports[_0xf27a('0x48')]=function(_0x282c54,_0x5b483b){return db[_0xf27a('0x29')][_0xf27a('0x48')](_0x282c54['body'],{})[_0xf27a('0x23')](respondWithResult(_0x5b483b,0xc9))[_0xf27a('0x47')](handleError(_0x5b483b,null));};exports['update']=function(_0x852f44,_0x2d1d36){if(_0x852f44[_0xf27a('0x49')]['id']){delete _0x852f44[_0xf27a('0x49')]['id'];}return db[_0xf27a('0x29')]['find']({'where':{'id':_0x852f44['params']['id']}})[_0xf27a('0x23')](handleEntityNotFound(_0x2d1d36,null))[_0xf27a('0x23')](saveUpdates(_0x852f44[_0xf27a('0x49')],null))['then'](respondWithResult(_0x2d1d36,null))[_0xf27a('0x47')](handleError(_0x2d1d36,null));};exports[_0xf27a('0x24')]=function(_0x12002d,_0x41321f){return db[_0xf27a('0x29')][_0xf27a('0x46')]({'where':{'id':_0x12002d[_0xf27a('0x44')]['id']}})[_0xf27a('0x23')](handleEntityNotFound(_0x41321f,null))[_0xf27a('0x23')](removeEntity(_0x41321f,null))[_0xf27a('0x47')](handleError(_0x41321f,null));};exports['describe']=function(_0x496327,_0x3c4d4e){return db['ChatTransferReport'][_0xf27a('0x4a')]()[_0xf27a('0x23')](respondWithResult(_0x3c4d4e,null))['catch'](handleError(_0x3c4d4e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 83ba962..e016e4d 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 _0xd8f7=['util','api','moment','bluebird','path','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x3014d1,_0x348a55){var _0x797494=function(_0x5aa7f3){while(--_0x5aa7f3){_0x3014d1['push'](_0x3014d1['shift']());}};_0x797494(++_0x348a55);}(_0xd8f7,0xe6));var _0x7d8f=function(_0x59b732,_0x471ce6){_0x59b732=_0x59b732-0x0;var _0x17e28f=_0xd8f7[_0x59b732];return _0x17e28f;};'use strict';var _=require(_0x7d8f('0x0'));var util=require(_0x7d8f('0x1'));var logger=require('../../config/logger')(_0x7d8f('0x2'));var moment=require(_0x7d8f('0x3'));var BPromise=require(_0x7d8f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d8f('0x5'));var rimraf=require('rimraf');var config=require(_0x7d8f('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x7d8f('0x7')]=function(_0x41cd14,_0x1498d2){return _0x41cd14['define'](_0x7d8f('0x8'),attributes,{'tableName':_0x7d8f('0x9'),'paranoid':![],'indexes':[{'name':_0x7d8f('0xa'),'fields':[_0x7d8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff34=['path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xff34,0x10f));var _0x4ff3=function(_0x51bfac,_0x5e2b04){_0x51bfac=_0x51bfac-0x0;var _0x35c7dc=_0xff34[_0x51bfac];return _0x35c7dc;};'use strict';var _=require(_0x4ff3('0x0'));var util=require(_0x4ff3('0x1'));var logger=require(_0x4ff3('0x2'))('api');var moment=require(_0x4ff3('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ff3('0x4'));var fs=require('fs');var path=require(_0x4ff3('0x5'));var rimraf=require(_0x4ff3('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ff3('0x7'));module[_0x4ff3('0x8')]=function(_0x383e91,_0x2b8f07){return _0x383e91[_0x4ff3('0x9')](_0x4ff3('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4ff3('0xb'),'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 94c70b2..23dc0a5 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 _0xe37c=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x552203,_0x530526){var _0x3dab1e=function(_0x569ae5){while(--_0x569ae5){_0x552203['push'](_0x552203['shift']());}};_0x3dab1e(++_0x530526);}(_0xe37c,0x7e));var _0xce37=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xe37c[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xce37('0x0'));var util=require(_0xce37('0x1'));var moment=require(_0xce37('0x2'));var BPromise=require(_0xce37('0x3'));var rs=require(_0xce37('0x4'));var fs=require('fs');var Redis=require(_0xce37('0x5'));var db=require(_0xce37('0x6'))['db'];var utils=require(_0xce37('0x7'));var logger=require('../../config/logger')(_0xce37('0x8'));var config=require(_0xce37('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xce37('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x535eea,_0x33138d,_0x450c97){return new BPromise(function(_0xb83250,_0x37a8b0){return client[_0xce37('0xb')](_0x535eea,_0x450c97)[_0xce37('0xc')](function(_0x5bc9ab){logger[_0xce37('0xd')](_0xce37('0xe'),_0x33138d,_0xce37('0xf'));logger[_0xce37('0x10')](_0xce37('0x11'),_0x33138d,_0xce37('0xf'),JSON['stringify'](_0x5bc9ab));if(_0x5bc9ab[_0xce37('0x12')]){if(_0x5bc9ab['error']['code']===0x1f4){logger[_0xce37('0x12')](_0xce37('0xe'),_0x33138d,_0x5bc9ab[_0xce37('0x12')][_0xce37('0x13')]);return _0x37a8b0(_0x5bc9ab[_0xce37('0x12')][_0xce37('0x13')]);}logger['error'](_0xce37('0xe'),_0x33138d,_0x5bc9ab[_0xce37('0x12')][_0xce37('0x13')]);return _0xb83250(_0x5bc9ab[_0xce37('0x12')][_0xce37('0x13')]);}else{logger['info'](_0xce37('0xe'),_0x33138d,'request\x20sent');_0xb83250(_0x5bc9ab[_0xce37('0x14')][_0xce37('0x13')]);}})[_0xce37('0x15')](function(_0x36dc74){logger[_0xce37('0x12')](_0xce37('0xe'),_0x33138d,_0x36dc74);_0x37a8b0(_0x36dc74);});});} \ No newline at end of file +var _0x7fed=['then','info','debug','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x131dd8,_0x10823d){var _0x1289a2=function(_0x4dee36){while(--_0x4dee36){_0x131dd8['push'](_0x131dd8['shift']());}};_0x1289a2(++_0x10823d);}(_0x7fed,0x1d8));var _0xd7fe=function(_0x5816f0,_0x10a65d){_0x5816f0=_0x5816f0-0x0;var _0x133fc5=_0x7fed[_0x5816f0];return _0x133fc5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd7fe('0x0'));var rs=require(_0xd7fe('0x1'));var fs=require('fs');var Redis=require(_0xd7fe('0x2'));var db=require(_0xd7fe('0x3'))['db'];var utils=require(_0xd7fe('0x4'));var logger=require(_0xd7fe('0x5'))(_0xd7fe('0x6'));var config=require(_0xd7fe('0x7'));var jayson=require(_0xd7fe('0x8'));var client=jayson[_0xd7fe('0x9')][_0xd7fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8b29,_0xe8a596,_0x48956c){return new BPromise(function(_0x20ef39,_0x1b08a9){return client['request'](_0x2c8b29,_0x48956c)[_0xd7fe('0xb')](function(_0x3458d5){logger[_0xd7fe('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0xe8a596,'request\x20sent');logger[_0xd7fe('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xe8a596,_0xd7fe('0xe'),JSON['stringify'](_0x3458d5));if(_0x3458d5[_0xd7fe('0xf')]){if(_0x3458d5['error'][_0xd7fe('0x10')]===0x1f4){logger[_0xd7fe('0xf')](_0xd7fe('0x11'),_0xe8a596,_0x3458d5[_0xd7fe('0xf')][_0xd7fe('0x12')]);return _0x1b08a9(_0x3458d5[_0xd7fe('0xf')]['message']);}logger[_0xd7fe('0xf')](_0xd7fe('0x11'),_0xe8a596,_0x3458d5[_0xd7fe('0xf')]['message']);return _0x20ef39(_0x3458d5['error'][_0xd7fe('0x12')]);}else{logger[_0xd7fe('0xc')](_0xd7fe('0x11'),_0xe8a596,'request\x20sent');_0x20ef39(_0x3458d5[_0xd7fe('0x13')][_0xd7fe('0x12')]);}})[_0xd7fe('0x14')](function(_0x881080){logger[_0xd7fe('0xf')](_0xd7fe('0x11'),_0xe8a596,_0x881080);_0x1b08a9(_0x881080);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a5ea548..2fe428f 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 _0xad89=['show','post','update','delete','destroy','exports','util','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x576dcb,_0x37e6fb){var _0x40e82d=function(_0x3d1140){while(--_0x3d1140){_0x576dcb['push'](_0x576dcb['shift']());}};_0x40e82d(++_0x37e6fb);}(_0xad89,0xc1));var _0x9ad8=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0xad89[_0x16b667];return _0x58620e;};'use strict';var multer=require('multer');var util=require(_0x9ad8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9ad8('0x1'));var router=express[_0x9ad8('0x2')]();var fs_extra=require(_0x9ad8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ad8('0x4'));var controller=require(_0x9ad8('0x5'));router[_0x9ad8('0x6')]('/',auth['isAuthenticated'](),controller[_0x9ad8('0x7')]);router[_0x9ad8('0x6')]('/describe',auth[_0x9ad8('0x8')](),controller[_0x9ad8('0x9')]);router[_0x9ad8('0x6')](_0x9ad8('0xa'),auth[_0x9ad8('0x8')](),controller[_0x9ad8('0xb')]);router[_0x9ad8('0xc')]('/',auth[_0x9ad8('0x8')](),controller['create']);router['put'](_0x9ad8('0xa'),auth[_0x9ad8('0x8')](),controller[_0x9ad8('0xd')]);router[_0x9ad8('0xe')](_0x9ad8('0xa'),auth['isAuthenticated'](),controller[_0x9ad8('0xf')]);module[_0x9ad8('0x10')]=router; \ No newline at end of file +var _0xc67e=['put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x17df16,_0x84c577){var _0x1ba549=function(_0x4a368c){while(--_0x4a368c){_0x17df16['push'](_0x17df16['shift']());}};_0x1ba549(++_0x84c577);}(_0xc67e,0x6d));var _0xec67=function(_0x24050a,_0x1ce736){_0x24050a=_0x24050a-0x0;var _0x4d27aa=_0xc67e[_0x24050a];return _0x4d27aa;};'use strict';var multer=require('multer');var util=require(_0xec67('0x0'));var path=require(_0xec67('0x1'));var timeout=require(_0xec67('0x2'));var express=require(_0xec67('0x3'));var router=express[_0xec67('0x4')]();var fs_extra=require(_0xec67('0x5'));var auth=require(_0xec67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xec67('0x7'));var controller=require(_0xec67('0x8'));router[_0xec67('0x9')]('/',auth[_0xec67('0xa')](),controller['index']);router[_0xec67('0x9')](_0xec67('0xb'),auth[_0xec67('0xa')](),controller[_0xec67('0xc')]);router[_0xec67('0x9')](_0xec67('0xd'),auth['isAuthenticated'](),controller[_0xec67('0xe')]);router[_0xec67('0xf')]('/',auth[_0xec67('0xa')](),controller[_0xec67('0x10')]);router[_0xec67('0x11')]('/:id',auth[_0xec67('0xa')](),controller[_0xec67('0x12')]);router[_0xec67('0x13')](_0xec67('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xec67('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a56dfa4..78505fb 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 _0xbdb7=['address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','thumb','stringify','input','name','onlineForm','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','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','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0x617098,_0x537975){var _0x170ef9=function(_0x5a4d5d){while(--_0x5a4d5d){_0x617098['push'](_0x617098['shift']());}};_0x170ef9(++_0x537975);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0xbdb7[_0x5b174b];return _0x47ee37;};'use strict';var Sequelize=require(_0x7bdb('0x0'));var rs=require(_0x7bdb('0x1'));module[_0x7bdb('0x2')]={'name':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'unique':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x3')]},'mapKey':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x6')},'customerAlias':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7bdb('0x3')]},'animation':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x7bdb('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7bdb('0x10')]},'closingQuestion':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x13')},'noteTitle':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x14')},'closingMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'skipMessageButton':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x7bdb('0x16'),_0x7bdb('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return JSON[_0x7bdb('0x18')]({'items':[{'type':_0x7bdb('0x19'),'variable':null,'config':{'placeholder':_0x7bdb('0x1a'),'type':'text','required':!![]},'props':{'title':_0x7bdb('0x1a'),'helpText':''}},{'type':_0x7bdb('0x19'),'props':{'title':_0x7bdb('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x7bdb('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x7bdb('0x1b'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x2abef6){return this['setDataValue'](_0x7bdb('0x1b'),JSON[_0x7bdb('0x18')](_0x2abef6));}},'offlineForm':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return JSON[_0x7bdb('0x18')]({'items':[{'type':_0x7bdb('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7bdb('0x5'),'type':_0x7bdb('0x5')},'variable':null},{'type':_0x7bdb('0x1c'),'config':{'placeholder':_0x7bdb('0x1d')},'props':{'title':_0x7bdb('0x1d'),'helpText':_0x7bdb('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x7bdb('0x1f')](_0x7bdb('0x20'))?JSON[_0x7bdb('0x21')](this[_0x7bdb('0x1f')](_0x7bdb('0x20'))):{};},'set':function(_0x81ca6f){return this['setDataValue'](_0x7bdb('0x20'),JSON[_0x7bdb('0x18')](_0x81ca6f));}},'token':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':function(){return rs[_0x7bdb('0x22')]();}},'autoclose':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7bdb('0x3')]},'forwardOffline':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7bdb('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x23')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7bdb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':function(){return _0x7bdb('0x26');}},'notificationSound':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bdb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x28')},'verticalAlignment':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x29')},'messagesAlignment':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':_0x7bdb('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7bdb('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7bdb('0x3')],'allowNull':![],'defaultValue':_0x7bdb('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7bdb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x7bdb('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bdb('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7bdb('0x2d'),'set':function(_0x2d578e){if(!_0x2d578e)this[_0x7bdb('0x2e')](_0x7bdb('0x2f'),null);this[_0x7bdb('0x2e')](_0x7bdb('0x30'),_0x2d578e);}},'vidaooEscalation':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bdb('0x31')},'vidaooNote':{'type':Sequelize[_0x7bdb('0x3')],'defaultValue':function(){return _0x7bdb('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x7bdb('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7bdb('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7bdb('0x10')]}}; \ No newline at end of file +var _0x9f62=['Skip','Feedback','thumb','stringify','input','name','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x198a8c,_0x18d312){var _0x235594=function(_0x3856ed){while(--_0x3856ed){_0x198a8c['push'](_0x198a8c['shift']());}};_0x235594(++_0x18d312);}(_0x9f62,0x154));var _0x29f6=function(_0x5deb13,_0x27cbea){_0x5deb13=_0x5deb13-0x0;var _0x24b3f3=_0x9f62[_0x5deb13];return _0x24b3f3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x29f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'unique':_0x29f6('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x3')},'mapKeyOffline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x3')},'key':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x4')},'customerAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':_0x29f6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x29f6('0x8')](_0x29f6('0x9'),'squared'),'defaultValue':_0x29f6('0x9')},'header_online':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0xa')},'header_offline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xb')},'download_transcript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x29f6('0xe')]},'closingQuestion':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x11')},'noteTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x13')},'closingMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x15')},'ratingType':{'type':Sequelize[_0x29f6('0x8')]('star',_0x29f6('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'variable':null,'config':{'placeholder':_0x29f6('0x19'),'type':'text','required':!![]},'props':{'title':_0x29f6('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x29f6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x29f6('0x1a')]('onlineForm')?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')]('onlineForm')):{};},'set':function(_0x1401fb){return this[_0x29f6('0x1c')](_0x29f6('0x1d'),JSON[_0x29f6('0x17')](_0x1401fb));}},'offlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null},{'type':_0x29f6('0x1e'),'config':{'placeholder':_0x29f6('0x1f')},'props':{'title':_0x29f6('0x1f'),'helpText':_0x29f6('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x29f6('0x1a')](_0x29f6('0x21'))?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')](_0x29f6('0x21'))):{};},'set':function(_0x1c3f0b){return this[_0x29f6('0x1c')](_0x29f6('0x21'),JSON[_0x29f6('0x17')](_0x1c3f0b));}},'token':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return rs[_0x29f6('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x29f6('0x1')]},'waitingTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x24')},'offlineMessageBody':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x26')},'skipUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'sendUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return _0x29f6('0x27');}},'notificationSound':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x29f6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x29')},'messagesAlignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x29f6('0x1')]},'customerAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x29f6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29f6('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f3475){if(!_0x3f3475)this[_0x29f6('0x1c')]('mandatoryDispositionPauseId',null);this[_0x29f6('0x1c')](_0x29f6('0x2a'),_0x3f3475);}},'vidaooEscalation':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x29f6('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x2b')},'vidaooNote':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return _0x29f6('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x29f6('0xc')],'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 f3a5f37..ef13688 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 _0xa4ff=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','ChatWebsiteId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','CannedAnswer','removeAnswers','file','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','Sequelize','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','update','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','firstName','NotifyMailAccount','notifyMail','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','interval','inspect','Interval','Intervals','getProactiveActions','custom','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','utf8','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','Transaction','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','html-to-text','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','mandatoryDispositionPause','map','rawAttributes','key','model','query','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','ChatWebsite','includeAll','include','findAll','rows','show','keys','intersection','options','find','create','body','user'];(function(_0x3daab5,_0x4c82c0){var _0x5c9961=function(_0xd26f32){while(--_0xd26f32){_0x3daab5['push'](_0x3daab5['shift']());}};_0x5c9961(++_0x4c82c0);}(_0xa4ff,0xd9));var _0xfa4f=function(_0x4c08c8,_0x2b68cf){_0x4c08c8=_0x4c08c8-0x0;var _0x213f03=_0xa4ff[_0x4c08c8];return _0x213f03;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xfa4f('0x0'));var util=require(_0xfa4f('0x1'));var path=require(_0xfa4f('0x2'));var ejs=require(_0xfa4f('0x3'));var fs=require('fs');var fs_extra=require(_0xfa4f('0x4'));var _=require(_0xfa4f('0x5'));var querystring=require(_0xfa4f('0x6'));var Redis=require(_0xfa4f('0x7'));var qs=require(_0xfa4f('0x8'));var logger=require(_0xfa4f('0x9'))(_0xfa4f('0xa'));var config=require(_0xfa4f('0xb'));var db=require(_0xfa4f('0xc'))['db'];config['redis']=_[_0xfa4f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa4f('0xe'))(new Redis(config[_0xfa4f('0xf')]));require(_0xfa4f('0x10'))['register'](socket);var htmlToText=require(_0xfa4f('0x11'));var jayson=require('jayson/promise');var client=jayson[_0xfa4f('0x12')][_0xfa4f('0x13')]({'port':0x232c});var client9002=jayson[_0xfa4f('0x12')][_0xfa4f('0x13')]({'port':0x232a});var client9003=jayson[_0xfa4f('0x12')][_0xfa4f('0x13')]({'port':0x232b});var client9001=jayson[_0xfa4f('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0x31ee79,_0x5796b1,_0x20710a,_0x309889){return new BPromise(function(_0x4d9d3c,_0x3b87f7){var _0x5b3bd8=_0x309889||client;return _0x5b3bd8['request'](_0x31ee79,_0x20710a)['then'](function(_0x16f0b7){logger[_0xfa4f('0x14')](_0xfa4f('0x15'),_0x5796b1,_0xfa4f('0x16'));logger[_0xfa4f('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5796b1,_0xfa4f('0x16'),JSON[_0xfa4f('0x18')](_0x16f0b7));if(_0x16f0b7[_0xfa4f('0x19')]){if(_0x16f0b7[_0xfa4f('0x19')]['code']===0x1f4){logger[_0xfa4f('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x5796b1,_0x16f0b7[_0xfa4f('0x19')][_0xfa4f('0x1a')]);return _0x3b87f7(_0x16f0b7[_0xfa4f('0x19')][_0xfa4f('0x1a')]);}logger[_0xfa4f('0x19')](_0xfa4f('0x15'),_0x5796b1,_0x16f0b7[_0xfa4f('0x19')][_0xfa4f('0x1a')]);return _0x4d9d3c(_0x16f0b7[_0xfa4f('0x19')][_0xfa4f('0x1a')]);}else{logger[_0xfa4f('0x14')](_0xfa4f('0x15'),_0x5796b1,_0xfa4f('0x16'));_0x4d9d3c(_0x16f0b7['result'][_0xfa4f('0x1a')]);}})[_0xfa4f('0x1b')](function(_0x7ec642){logger[_0xfa4f('0x19')](_0xfa4f('0x15'),_0x5796b1,_0x7ec642);_0x3b87f7(_0x7ec642);});});}function respondWithStatusCode(_0x13f626,_0x32c4af){_0x32c4af=_0x32c4af||0xcc;return function(_0x2fcd5a){if(_0x2fcd5a){return _0x13f626[_0xfa4f('0x1c')](_0x32c4af);}return _0x13f626[_0xfa4f('0x1d')](_0x32c4af)[_0xfa4f('0x1e')]();};}function respondWithResult(_0x54ab2c,_0x29c4a0){_0x29c4a0=_0x29c4a0||0xc8;return function(_0x22c1bc){if(_0x22c1bc){return _0x54ab2c[_0xfa4f('0x1d')](_0x29c4a0)[_0xfa4f('0x1f')](_0x22c1bc);}};}function respondWithFilteredResult(_0x549edf,_0x8e3037){return function(_0x289e54){if(_0x289e54){var _0x2da299=typeof _0x8e3037[_0xfa4f('0x20')]==='undefined'&&typeof _0x8e3037[_0xfa4f('0x21')]==='undefined';var _0x30218a=_0x289e54['count'];var _0x231b28=_0x2da299?0x0:_0x8e3037[_0xfa4f('0x20')];var _0x3472e6=_0x2da299?_0x289e54[_0xfa4f('0x22')]:_0x8e3037[_0xfa4f('0x20')]+_0x8e3037[_0xfa4f('0x21')];var _0x13c02a;if(_0x3472e6>=_0x30218a){_0x3472e6=_0x30218a;_0x13c02a=0xc8;}else{_0x13c02a=0xce;}_0x549edf[_0xfa4f('0x1d')](_0x13c02a);return _0x549edf[_0xfa4f('0x23')](_0xfa4f('0x24'),_0x231b28+'-'+_0x3472e6+'/'+_0x30218a)[_0xfa4f('0x1f')](_0x289e54);}return null;};}function saveUpdates(_0x48e835){return function(_0x4f6d43){if(_0x4f6d43){return _0x4f6d43['update'](_0x48e835)[_0xfa4f('0x25')](function(_0x270378){return _0x270378;});}return null;};}function removeEntity(_0x44a1b5){return function(_0x3ea5d7){if(_0x3ea5d7){return _0x3ea5d7[_0xfa4f('0x26')]()['then'](function(){var _0x2649e9=_0x3ea5d7[_0xfa4f('0x27')]({'plain':!![]});var _0xcecb0=_0xfa4f('0x28');return db[_0xfa4f('0x29')][_0xfa4f('0x26')]({'where':{'type':_0xcecb0,'resourceId':_0x2649e9['id']}})['then'](function(){return _0x3ea5d7;});})['then'](function(){_0x44a1b5[_0xfa4f('0x1d')](0xcc)[_0xfa4f('0x1e')]();});}};}function handleEntityNotFound(_0x4700bc){return function(_0x1e4500){if(!_0x1e4500){_0x4700bc[_0xfa4f('0x1c')](0x194);}return _0x1e4500;};}function handleError(_0x215ff4,_0x2d10f2){_0x2d10f2=_0x2d10f2||0x1f4;return function(_0x29babf){logger[_0xfa4f('0x19')](_0x29babf[_0xfa4f('0x2a')]);if(_0x29babf[_0xfa4f('0x2b')]){delete _0x29babf[_0xfa4f('0x2b')];}_0x215ff4[_0xfa4f('0x1d')](_0x2d10f2)['send'](_0x29babf);};}exports['index']=function(_0x516cb7,_0xe9a259){var _0x1c0943={'include':[{'model':db['Pause'],'as':_0xfa4f('0x2c')}]},_0x34109a={},_0x4dd4d3={'count':0x0,'rows':[]};var _0xf59977=_[_0xfa4f('0x2d')](db['ChatWebsite'][_0xfa4f('0x2e')],function(_0x14b15f){return{'name':_0x14b15f['fieldName'],'type':_0x14b15f['type'][_0xfa4f('0x2f')]};});_0x34109a[_0xfa4f('0x30')]=_[_0xfa4f('0x2d')](_0xf59977,_0xfa4f('0x2b'));_0x34109a[_0xfa4f('0x31')]=_['keys'](_0x516cb7[_0xfa4f('0x31')]);_0x34109a['filters']=_['intersection'](_0x34109a[_0xfa4f('0x30')],_0x34109a[_0xfa4f('0x31')]);_0x1c0943[_0xfa4f('0x32')]=_['intersection'](_0x34109a[_0xfa4f('0x30')],qs[_0xfa4f('0x33')](_0x516cb7[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0x1c0943[_0xfa4f('0x32')]=_0x1c0943[_0xfa4f('0x32')][_0xfa4f('0x34')]?_0x1c0943[_0xfa4f('0x32')]:_0x34109a[_0xfa4f('0x30')];if(!_0x516cb7[_0xfa4f('0x31')]['hasOwnProperty'](_0xfa4f('0x35'))){_0x1c0943['limit']=qs['limit'](_0x516cb7['query']['limit']);_0x1c0943[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x516cb7['query']['offset']);}_0x1c0943[_0xfa4f('0x36')]=qs['sort'](_0x516cb7[_0xfa4f('0x31')][_0xfa4f('0x37')]);_0x1c0943['where']=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x516cb7[_0xfa4f('0x31')],_0x34109a[_0xfa4f('0x38')]),_0xf59977);if(_0x516cb7[_0xfa4f('0x31')][_0xfa4f('0x3a')]){_0x1c0943[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x1c0943['where'],{'$or':_[_0xfa4f('0x2d')](_0xf59977,function(_0x25581c){if(_0x25581c[_0xfa4f('0x3d')]!==_0xfa4f('0x3e')){var _0xef058f={};_0xef058f[_0x25581c[_0xfa4f('0x2b')]]={'$like':'%'+_0x516cb7[_0xfa4f('0x31')][_0xfa4f('0x3a')]+'%'};return _0xef058f;}})});}_0x1c0943=_[_0xfa4f('0x3c')]({},_0x1c0943,_0x516cb7['options']);var _0x28976d={'where':_0x1c0943[_0xfa4f('0x3b')]};return db[_0xfa4f('0x3f')][_0xfa4f('0x22')](_0x28976d)[_0xfa4f('0x25')](function(_0x5677c7){_0x4dd4d3[_0xfa4f('0x22')]=_0x5677c7;if(_0x516cb7[_0xfa4f('0x31')][_0xfa4f('0x40')]){_0x1c0943[_0xfa4f('0x41')]=[{'all':!![]}];}return db[_0xfa4f('0x3f')][_0xfa4f('0x42')](_0x1c0943);})[_0xfa4f('0x25')](function(_0xfb23bb){_0x4dd4d3[_0xfa4f('0x43')]=_0xfb23bb;return _0x4dd4d3;})[_0xfa4f('0x25')](respondWithFilteredResult(_0xe9a259,_0x1c0943))[_0xfa4f('0x1b')](handleError(_0xe9a259,null));};exports[_0xfa4f('0x44')]=function(_0x1cb0c8,_0x46924e){var _0x353788={'raw':![],'where':{'id':_0x1cb0c8['params']['id']},'include':[{'model':db['Pause'],'as':_0xfa4f('0x2c')}]},_0x6fb01c={};_0x6fb01c['model']=_['keys'](db['ChatWebsite'][_0xfa4f('0x2e')]);_0x6fb01c[_0xfa4f('0x31')]=_[_0xfa4f('0x45')](_0x1cb0c8[_0xfa4f('0x31')]);_0x6fb01c['filters']=_['intersection'](_0x6fb01c[_0xfa4f('0x30')],_0x6fb01c[_0xfa4f('0x31')]);_0x353788[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x6fb01c['model'],qs[_0xfa4f('0x33')](_0x1cb0c8['query'][_0xfa4f('0x33')]));_0x353788[_0xfa4f('0x32')]=_0x353788[_0xfa4f('0x32')][_0xfa4f('0x34')]?_0x353788['attributes']:_0x6fb01c['model'];if(_0x1cb0c8[_0xfa4f('0x31')][_0xfa4f('0x40')]){_0x353788[_0xfa4f('0x41')]=[{'all':!![]}];}_0x353788=_[_0xfa4f('0x3c')]({},_0x353788,_0x1cb0c8[_0xfa4f('0x47')]);return db[_0xfa4f('0x3f')][_0xfa4f('0x48')](_0x353788)[_0xfa4f('0x25')](handleEntityNotFound(_0x46924e,null))[_0xfa4f('0x25')](respondWithResult(_0x46924e,null))[_0xfa4f('0x1b')](handleError(_0x46924e,null));};exports[_0xfa4f('0x49')]=function(_0x142a09,_0x462abc){return db[_0xfa4f('0x3f')][_0xfa4f('0x49')](_0x142a09[_0xfa4f('0x4a')],{})['then'](function(_0x477148){var _0x370ae0=_0x142a09[_0xfa4f('0x4b')]['get']({'plain':!![]});if(!_0x370ae0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x370ae0[_0xfa4f('0x4c')]===_0xfa4f('0x4b')){var _0x3d1ef9=_0x477148['get']({'plain':!![]});var _0x35e7e0='ChatWebsites';return db[_0xfa4f('0x4d')][_0xfa4f('0x48')]({'where':{'name':_0x35e7e0,'userProfileId':_0x370ae0[_0xfa4f('0x4e')]},'raw':!![]})[_0xfa4f('0x25')](function(_0x137588){if(_0x137588&&_0x137588[_0xfa4f('0x4f')]===0x0){return db[_0xfa4f('0x29')][_0xfa4f('0x49')]({'name':_0x3d1ef9[_0xfa4f('0x2b')],'resourceId':_0x3d1ef9['id'],'type':_0x137588[_0xfa4f('0x2b')],'sectionId':_0x137588['id']},{})[_0xfa4f('0x25')](function(){return _0x477148;});}else{return _0x477148;}})[_0xfa4f('0x1b')](function(_0xf888a8){logger[_0xfa4f('0x19')](_0xfa4f('0x50'),_0xf888a8);throw _0xf888a8;});}return _0x477148;})[_0xfa4f('0x25')](respondWithResult(_0x462abc,0xc9))[_0xfa4f('0x1b')](handleError(_0x462abc,null));};exports['update']=function(_0x1e881b,_0x58a9d0){if(_0x1e881b[_0xfa4f('0x4a')]['id']){delete _0x1e881b['body']['id'];}return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x1e881b[_0xfa4f('0x51')]['id']},'include':[{'model':db[_0xfa4f('0x52')],'as':_0xfa4f('0x2c')}]})[_0xfa4f('0x25')](handleEntityNotFound(_0x58a9d0,null))[_0xfa4f('0x25')](saveUpdates(_0x1e881b['body'],null))[_0xfa4f('0x25')](respondWithResult(_0x58a9d0,null))[_0xfa4f('0x1b')](handleError(_0x58a9d0,null));};exports[_0xfa4f('0x26')]=function(_0x1b67b9,_0x46c1cc){return db[_0xfa4f('0x3f')]['find']({'where':{'id':_0x1b67b9[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x46c1cc,null))[_0xfa4f('0x25')](removeEntity(_0x46c1cc,null))[_0xfa4f('0x1b')](handleError(_0x46c1cc,null));};exports[_0xfa4f('0x53')]=function(_0xa8135b,_0x26fdff){return db[_0xfa4f('0x3f')][_0xfa4f('0x53')]()[_0xfa4f('0x25')](respondWithResult(_0x26fdff,null))[_0xfa4f('0x1b')](handleError(_0x26fdff,null));};exports['addDisposition']=function(_0x4cfd6a,_0x457e44){if(_0x4cfd6a[_0xfa4f('0x4a')]['id']){delete _0x4cfd6a['body']['id'];}return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x4cfd6a[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x457e44,null))[_0xfa4f('0x25')](function(_0x3c36cf){if(_0x3c36cf){_0x4cfd6a[_0xfa4f('0x4a')][_0xfa4f('0x54')]=_0x3c36cf['id'];return db['Disposition'][_0xfa4f('0x49')](_0x4cfd6a[_0xfa4f('0x4a')]);}})[_0xfa4f('0x25')](respondWithResult(_0x457e44,null))[_0xfa4f('0x1b')](handleError(_0x457e44,null));};exports['getDispositions']=function(_0x3bfdea,_0x4b1d1a){var _0x149eb1={'raw':![],'where':{}};var _0x57b966={};var _0x470581={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa4f('0x55')]({'where':{'id':_0x3bfdea[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x4b1d1a,null))[_0xfa4f('0x25')](function(_0x52443a){if(_0x52443a){_0x57b966[_0xfa4f('0x30')]=_[_0xfa4f('0x45')](db[_0xfa4f('0x56')][_0xfa4f('0x2e')]);_0x57b966[_0xfa4f('0x31')]=_[_0xfa4f('0x45')](_0x3bfdea[_0xfa4f('0x31')]);_0x57b966[_0xfa4f('0x38')]=_[_0xfa4f('0x46')](_0x57b966[_0xfa4f('0x30')],_0x57b966['query']);_0x149eb1[_0xfa4f('0x32')]=_['intersection'](_0x57b966['model'],qs[_0xfa4f('0x33')](_0x3bfdea[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0x149eb1['attributes']=_0x149eb1['attributes'][_0xfa4f('0x34')]?_0x149eb1[_0xfa4f('0x32')]:_0x57b966[_0xfa4f('0x30')];if(!_0x3bfdea[_0xfa4f('0x31')][_0xfa4f('0x57')](_0xfa4f('0x35'))){_0x149eb1[_0xfa4f('0x21')]=qs[_0xfa4f('0x21')](_0x3bfdea[_0xfa4f('0x31')]['limit']);_0x149eb1['offset']=qs['offset'](_0x3bfdea[_0xfa4f('0x31')][_0xfa4f('0x20')]);}_0x149eb1[_0xfa4f('0x36')]=qs[_0xfa4f('0x37')](_0x3bfdea[_0xfa4f('0x31')]['sort']);_0x149eb1[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x3bfdea[_0xfa4f('0x31')],_0x57b966[_0xfa4f('0x38')]));_0x149eb1['where'][_0xfa4f('0x54')]=_0x52443a['id'];if(_0x3bfdea[_0xfa4f('0x31')][_0xfa4f('0x3a')]){_0x149eb1[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x149eb1[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0x149eb1['attributes'],function(_0x431650){var _0x2a63ec={};_0x2a63ec[_0x431650]={'$like':'%'+_0x3bfdea[_0xfa4f('0x31')][_0xfa4f('0x3a')]+'%'};return _0x2a63ec;})});}_0x149eb1=_[_0xfa4f('0x3c')]({},_0x149eb1,_0x3bfdea['options']);return db[_0xfa4f('0x56')][_0xfa4f('0x22')]({'where':_0x149eb1[_0xfa4f('0x3b')]})[_0xfa4f('0x25')](function(_0x3b78bc){_0x470581[_0xfa4f('0x22')]=_0x3b78bc;if(_0x3bfdea[_0xfa4f('0x31')]['includeAll']){_0x149eb1[_0xfa4f('0x41')]=[{'all':!![]}];}return db[_0xfa4f('0x56')][_0xfa4f('0x42')](_0x149eb1);})[_0xfa4f('0x25')](function(_0x11b3e4){_0x470581['rows']=_0x11b3e4;return _0x470581;});}})[_0xfa4f('0x25')](respondWithFilteredResult(_0x4b1d1a,_0x149eb1))[_0xfa4f('0x1b')](handleError(_0x4b1d1a,null));};exports[_0xfa4f('0x58')]=function(_0x14dcef,_0x3c736e){return db['ChatWebsite']['find']({'where':{'id':_0x14dcef[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x3c736e,null))[_0xfa4f('0x25')](function(_0x1401a8){if(_0x1401a8){return _0x1401a8[_0xfa4f('0x58')](_0x14dcef[_0xfa4f('0x31')][_0xfa4f('0x59')]);}})[_0xfa4f('0x25')](respondWithStatusCode(_0x3c736e,null))[_0xfa4f('0x1b')](handleError(_0x3c736e,null));};exports['addAnswer']=function(_0x472850,_0xfa2f0d){if(_0x472850['body']['id']){delete _0x472850[_0xfa4f('0x4a')]['id'];}return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x472850['params']['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0xfa2f0d,null))[_0xfa4f('0x25')](function(_0x434ac1){if(_0x434ac1){_0x472850[_0xfa4f('0x4a')][_0xfa4f('0x54')]=_0x434ac1['id'];return db[_0xfa4f('0x5a')][_0xfa4f('0x49')](_0x472850[_0xfa4f('0x4a')]);}})[_0xfa4f('0x25')](respondWithResult(_0xfa2f0d,null))['catch'](handleError(_0xfa2f0d,null));};exports['getAnswers']=function(_0x130988,_0x1c969c){var _0x56bbc6={'raw':![],'where':{}};var _0x46ac9e={};var _0x2f0f1e={'count':0x0,'rows':[]};return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0x130988[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x1c969c,null))[_0xfa4f('0x25')](function(_0x15fe22){if(_0x15fe22){_0x46ac9e[_0xfa4f('0x30')]=_[_0xfa4f('0x45')](db[_0xfa4f('0x5a')][_0xfa4f('0x2e')]);_0x46ac9e[_0xfa4f('0x31')]=_[_0xfa4f('0x45')](_0x130988['query']);_0x46ac9e[_0xfa4f('0x38')]=_['intersection'](_0x46ac9e[_0xfa4f('0x30')],_0x46ac9e[_0xfa4f('0x31')]);_0x56bbc6[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x46ac9e[_0xfa4f('0x30')],qs['fields'](_0x130988[_0xfa4f('0x31')]['fields']));_0x56bbc6['attributes']=_0x56bbc6['attributes'][_0xfa4f('0x34')]?_0x56bbc6[_0xfa4f('0x32')]:_0x46ac9e[_0xfa4f('0x30')];if(!_0x130988[_0xfa4f('0x31')][_0xfa4f('0x57')](_0xfa4f('0x35'))){_0x56bbc6[_0xfa4f('0x21')]=qs[_0xfa4f('0x21')](_0x130988[_0xfa4f('0x31')][_0xfa4f('0x21')]);_0x56bbc6[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x130988[_0xfa4f('0x31')][_0xfa4f('0x20')]);}_0x56bbc6[_0xfa4f('0x36')]=qs[_0xfa4f('0x37')](_0x130988[_0xfa4f('0x31')][_0xfa4f('0x37')]);_0x56bbc6[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x130988[_0xfa4f('0x31')],_0x46ac9e[_0xfa4f('0x38')]));_0x56bbc6['where'][_0xfa4f('0x54')]=_0x15fe22['id'];if(_0x130988[_0xfa4f('0x31')]['filter']){_0x56bbc6[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x56bbc6[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0x56bbc6[_0xfa4f('0x32')],function(_0xe226c6){var _0x3c13d9={};_0x3c13d9[_0xe226c6]={'$like':'%'+_0x130988['query'][_0xfa4f('0x3a')]+'%'};return _0x3c13d9;})});}_0x56bbc6=_[_0xfa4f('0x3c')]({},_0x56bbc6,_0x130988[_0xfa4f('0x47')]);return db[_0xfa4f('0x5a')][_0xfa4f('0x22')]({'where':_0x56bbc6[_0xfa4f('0x3b')]})['then'](function(_0x36e983){_0x2f0f1e[_0xfa4f('0x22')]=_0x36e983;if(_0x130988['query']['includeAll']){_0x56bbc6[_0xfa4f('0x41')]=[{'all':!![]}];}return db[_0xfa4f('0x5a')]['findAll'](_0x56bbc6);})['then'](function(_0x51d75e){_0x2f0f1e[_0xfa4f('0x43')]=_0x51d75e;return _0x2f0f1e;});}})[_0xfa4f('0x25')](respondWithFilteredResult(_0x1c969c,_0x56bbc6))[_0xfa4f('0x1b')](handleError(_0x1c969c,null));};exports[_0xfa4f('0x5b')]=function(_0x4e33d3,_0x44f828){return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x4e33d3['params']['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x44f828,null))[_0xfa4f('0x25')](function(_0x5f1724){if(_0x5f1724){return _0x5f1724[_0xfa4f('0x5b')](_0x4e33d3[_0xfa4f('0x31')][_0xfa4f('0x59')]);}})[_0xfa4f('0x25')](respondWithStatusCode(_0x44f828,null))['catch'](handleError(_0x44f828,null));};exports['addLogo']=function(_0x754b1c,_0x1935d1){_0x754b1c[_0xfa4f('0x4a')]['sitepic']=_0x754b1c[_0xfa4f('0x5c')]['filename'];return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x754b1c[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x1935d1,null))[_0xfa4f('0x25')](saveUpdates(_0x754b1c['body'],null))[_0xfa4f('0x25')](respondWithResult(_0x1935d1,null))['catch'](handleError(_0x1935d1,null));};exports['addAvatar']=function(_0x66b310,_0x11ba1d){_0x66b310['body'][_0xfa4f('0x5d')]=_0x66b310[_0xfa4f('0x5c')][_0xfa4f('0x5e')];return db[_0xfa4f('0x3f')]['find']({'where':{'id':_0x66b310['params']['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x11ba1d,null))[_0xfa4f('0x25')](saveUpdates(_0x66b310['body'],null))[_0xfa4f('0x25')](respondWithResult(_0x11ba1d,null))[_0xfa4f('0x1b')](handleError(_0x11ba1d,null));};exports[_0xfa4f('0x5f')]=function(_0x53346d,_0x446cce){_0x53346d['body'][_0xfa4f('0x60')]=_0x53346d[_0xfa4f('0x5c')][_0xfa4f('0x5e')];return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x53346d[_0xfa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x446cce,null))['then'](saveUpdates(_0x53346d[_0xfa4f('0x4a')],null))[_0xfa4f('0x25')](respondWithResult(_0x446cce,null))[_0xfa4f('0x1b')](handleError(_0x446cce,null));};exports[_0xfa4f('0x61')]=function(_0x557c79,_0x2bfe1d){_0x557c79[_0xfa4f('0x4a')][_0xfa4f('0x62')]=_0x557c79[_0xfa4f('0x5c')]['filename'];return db['ChatWebsite'][_0xfa4f('0x48')]({'where':{'id':_0x557c79[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x2bfe1d,null))[_0xfa4f('0x25')](saveUpdates(_0x557c79[_0xfa4f('0x4a')],null))[_0xfa4f('0x25')](respondWithResult(_0x2bfe1d,null))[_0xfa4f('0x1b')](handleError(_0x2bfe1d,null));};exports['getLogo']=function(_0x32a79a,_0x5bdb7d){var _0xd2c468=path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],'server/files/images/logos/default_logo.svg');var _0x3fe4e5={'where':{'id':_0x32a79a['params']['id']},'attributes':['id',_0xfa4f('0x65')],'raw':!![]};var _0x4ca51a=![];return require(_0xfa4f('0x66'))[_0xfa4f('0x67')]()['then'](function(_0x24ac63){if(_0x24ac63){_0x4ca51a=_0x24ac63['custom'];}})[_0xfa4f('0x25')](function(){return db['ChatWebsite'][_0xfa4f('0x48')](_0x3fe4e5);})['then'](handleEntityNotFound(_0x5bdb7d,null))['then'](function(_0x4c3948){if(_0x4c3948){if(!_[_0xfa4f('0x68')](_0x4c3948[_0xfa4f('0x65')])){if(fs[_0xfa4f('0x69')](path[_0xfa4f('0x63')](config['root'],_0xfa4f('0x6a'),_0x4c3948[_0xfa4f('0x65')]))&&_0x4ca51a){_0xd2c468=path['join'](config['root'],_0xfa4f('0x6a'),_0x4c3948[_0xfa4f('0x65')]);}}return _0x5bdb7d[_0xfa4f('0x6b')](_0xd2c468);}})['catch'](handleError(_0x5bdb7d,null));};exports[_0xfa4f('0x6c')]=function(_0x5aee6d,_0x281d14){var _0x1aa040=path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0x6d'));var _0x4516ca={'where':{'id':_0x5aee6d['params']['id']},'attributes':['id',_0xfa4f('0x5d')],'raw':!![]};return db[_0xfa4f('0x3f')]['find'](_0x4516ca)[_0xfa4f('0x25')](handleEntityNotFound(_0x281d14,null))[_0xfa4f('0x25')](function(_0x29c794){if(_0x29c794){if(!_[_0xfa4f('0x68')](_0x29c794[_0xfa4f('0x5d')])){if(fs['existsSync'](path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0x6e'),_0x29c794['agentAvatar']))){_0x1aa040=path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0x6e'),_0x29c794[_0xfa4f('0x5d')]);}}return _0x281d14[_0xfa4f('0x6b')](_0x1aa040);}})[_0xfa4f('0x1b')](handleError(_0x281d14,null));};exports[_0xfa4f('0x6f')]=function(_0x13183a,_0x37c734){var _0x2735aa=path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],'server/files/images/avatars/customer_avatar.png');var _0x58ae55={'where':{'id':_0x13183a['params']['id']},'attributes':['id','customerAvatar',_0xfa4f('0x70')],'raw':!![]};return db[_0xfa4f('0x3f')][_0xfa4f('0x48')](_0x58ae55)[_0xfa4f('0x25')](handleEntityNotFound(_0x37c734,null))[_0xfa4f('0x25')](function(_0x1c4632){if(_0x1c4632){if(!_['isNil'](_0x1c4632[_0xfa4f('0x60')])){if(fs[_0xfa4f('0x69')](path[_0xfa4f('0x63')](config['root'],'server/files/images/avatars/',_0x1c4632['customerAvatar']))&&_0x1c4632[_0xfa4f('0x70')]){_0x2735aa=path['join'](config[_0xfa4f('0x64')],'server/files/images/avatars/',_0x1c4632[_0xfa4f('0x60')]);}}return _0x37c734['download'](_0x2735aa);}})[_0xfa4f('0x1b')](handleError(_0x37c734,null));};exports[_0xfa4f('0x71')]=function(_0x117d64,_0x4576b7){var _0x488a16=path['join'](config[_0xfa4f('0x64')],_0xfa4f('0x72'));var _0x3b4d5a={'where':{'id':_0x117d64[_0xfa4f('0x51')]['id']},'attributes':['id',_0xfa4f('0x62')],'raw':!![]};return db[_0xfa4f('0x3f')]['find'](_0x3b4d5a)[_0xfa4f('0x25')](handleEntityNotFound(_0x4576b7,null))[_0xfa4f('0x25')](function(_0x469e81){if(_0x469e81){if(!_[_0xfa4f('0x68')](_0x469e81[_0xfa4f('0x62')])){if(fs['existsSync'](path[_0xfa4f('0x63')](config['root'],'server/files/images/avatars/',_0x469e81[_0xfa4f('0x62')]))){_0x488a16=path['join'](config['root'],_0xfa4f('0x6e'),_0x469e81['systemAvatar']);}}return _0x4576b7[_0xfa4f('0x6b')](_0x488a16);}})[_0xfa4f('0x1b')](handleError(_0x4576b7,null));};exports['notify']=function(_0x205e05,_0x30691f){var _0x43be2f=require('user-agent-parser');var _0x1dfc61=new _0x43be2f();var _0x9bc9f9=_0x1dfc61[_0xfa4f('0x73')](_0x205e05[_0xfa4f('0x74')][_0xfa4f('0x75')])[_0xfa4f('0x76')]();var _0x5c9d94={'body':_0x205e05[_0xfa4f('0x4a')],'channel':_0xfa4f('0x77')};var _0x19f21f=[];var _0x592746=[];var _0x227a13={};var _0x499728=![];return db[_0xfa4f('0x78')][_0xfa4f('0x53')]()['then'](function(_0x216430){if(!_0x216430){throw new db['Sequelize']['ValidationError'](_0xfa4f('0x79'));}_0x19f21f=_[_0xfa4f('0x7a')](_[_0xfa4f('0x45')](_0x216430),['createdAt',_0xfa4f('0x7b')]);_0x592746=_['difference'](_[_0xfa4f('0x45')](_0x216430),[_0xfa4f('0x7c'),_0xfa4f('0x7b'),_0xfa4f('0x7d'),_0xfa4f('0x7e')]);if(_0x205e05[_0xfa4f('0x4a')]['id']){delete _0x205e05[_0xfa4f('0x4a')]['id'];}if(_['isNil'](_0x205e05['body']['from'])){throw new db['Sequelize']['ValidationError'](_0xfa4f('0x7f'));}if(_[_0xfa4f('0x68')](_0x205e05[_0xfa4f('0x4a')]['body'])||_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0x4a')]===''){throw new db[(_0xfa4f('0x80'))][(_0xfa4f('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa4f('0x68')](_0x205e05[_0xfa4f('0x4a')]['mapKey'])){throw new db[(_0xfa4f('0x80'))][(_0xfa4f('0x81'))](_0xfa4f('0x82')+_0x592746);}if(!_[_0xfa4f('0x83')](_0x592746,_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0x84')])){throw new db['Sequelize'][(_0xfa4f('0x81'))](_0xfa4f('0x85')+_0x592746);}_0x227a13[_0x205e05['body'][_0xfa4f('0x84')]]=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0x86')];})[_0xfa4f('0x25')](function(){return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x205e05['params']['id']},'include':[{'model':db[_0xfa4f('0x87')],'as':_0xfa4f('0x88'),'include':[{'model':db[_0xfa4f('0x78')],'as':_0xfa4f('0x89'),'where':_0x227a13,'limit':0x1,'order':[['updatedAt',_0xfa4f('0x8a')]]}]},{'model':db[_0xfa4f('0x8b')],'as':'Applications'}]});})[_0xfa4f('0x25')](handleEntityNotFound(_0x30691f,null))[_0xfa4f('0x25')](function(_0x58d410){if(_0x58d410&&_0x58d410[_0xfa4f('0x88')]){_0x5c9d94[_0xfa4f('0x8c')]=_0x58d410;_0x5c9d94[_0xfa4f('0x8d')]=_0x58d410[_0xfa4f('0x8e')];_0x5c9d94[_0xfa4f('0x8f')]=_0x58d410[_0xfa4f('0x88')];_0x5c9d94['applications']=_['orderBy'](_0x5c9d94[_0xfa4f('0x8d')],[_0xfa4f('0x90')],[_0xfa4f('0x91')]);if(_0x5c9d94[_0xfa4f('0x8c')][_0xfa4f('0x8e')]){delete _0x5c9d94[_0xfa4f('0x8c')][_0xfa4f('0x8e')];}if(_0x5c9d94[_0xfa4f('0x8c')][_0xfa4f('0x88')]&&_0x5c9d94['account']['List'][_0xfa4f('0x89')]['length']){return _0x5c9d94['account'][_0xfa4f('0x88')]['Contacts'][0x0];}var _0x2ad64d=_[_0xfa4f('0xd')](_0x205e05[_0xfa4f('0x4a')],{'firstName':_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0x86')],'ListId':_0x58d410[_0xfa4f('0x7e')]});_0x2ad64d[_0x205e05['body']['mapKey']]=_0x205e05['body']['from'];return db[_0xfa4f('0x78')]['create'](_0x2ad64d,{'fields':_0x19f21f,'raw':!![]});}})[_0xfa4f('0x25')](handleEntityNotFound(_0x30691f,null))[_0xfa4f('0x25')](function(_0x406f3b){_0x5c9d94[_0xfa4f('0x92')]=_0x406f3b;var _0x3a174f=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0x93')];if(_0x205e05['headers'][_0xfa4f('0x94')]){_0x3a174f=_0x205e05[_0xfa4f('0x74')]['cf-connecting-ip'];}else if(_0x205e05['headers'][_0xfa4f('0x95')]){_0x3a174f=_[_0xfa4f('0x96')](_0x205e05['headers']['x-forwarded-for'][_0xfa4f('0x97')](','));}if(_0x406f3b){var _0xd1092b={'ContactId':_0x406f3b['id'],'ChatWebsiteId':_0x205e05['params']['id'],'from':(_0x406f3b['firstName']||'')+'\x20'+(_0x406f3b['lastName']||''),'customerIp':_0x3a174f,'customerPort':_0x205e05[_0xfa4f('0x74')][_0xfa4f('0x98')]?_0x205e05['headers'][_0xfa4f('0x98')]:null,'referer':_0x205e05[_0xfa4f('0x4a')]['referer'],'browserName':_0x9bc9f9[_0xfa4f('0x99')][_0xfa4f('0x2b')]&&_0x9bc9f9[_0xfa4f('0x99')][_0xfa4f('0x9a')]?util['format'](_0xfa4f('0x9b'),_0x9bc9f9['browser']['name'],_0x9bc9f9[_0xfa4f('0x99')]['version']):_0xfa4f('0x9c'),'browserVersion':_0x9bc9f9[_0xfa4f('0x99')]['version']||_0xfa4f('0x9c'),'osName':util[_0xfa4f('0x9d')]('%s\x20%s',_0x9bc9f9['os'][_0xfa4f('0x2b')],_0x9bc9f9['os'][_0xfa4f('0x9a')]),'osVersion':_0x9bc9f9['os'][_0xfa4f('0x9a')],'deviceModel':_0x9bc9f9[_0xfa4f('0x9e')][_0xfa4f('0x30')]&&_0x9bc9f9[_0xfa4f('0x9e')][_0xfa4f('0x9f')]?util[_0xfa4f('0x9d')](_0xfa4f('0xa0'),_0x9bc9f9['device'][_0xfa4f('0x30')],_0x9bc9f9[_0xfa4f('0x9e')]['vendor'],_0x9bc9f9[_0xfa4f('0x9e')][_0xfa4f('0x3d')]):null,'deviceVendor':_0x9bc9f9[_0xfa4f('0x9e')]['vendor'],'deviceType':_0x9bc9f9[_0xfa4f('0x9e')][_0xfa4f('0x3d')],'formData':JSON[_0xfa4f('0x18')](_0x205e05[_0xfa4f('0x4a')])};var _0xc74962={'ChatWebsiteId':_0x205e05[_0xfa4f('0x51')]['id'],'closed':![]};if(_0x205e05[_0xfa4f('0x4a')]['threadId']){_0xc74962[_0xfa4f('0xa1')]=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa1')];return db[_0xfa4f('0xa2')][_0xfa4f('0x48')]({'where':_0xc74962})[_0xfa4f('0x25')](function(_0x5dd9ca){if(_0x5dd9ca){return[_0x5dd9ca,![]];}_0xd1092b[_0xfa4f('0xa1')]=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa1')];_0xd1092b[_0xfa4f('0xa3')]=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa3')];return db['ChatInteraction'][_0xfa4f('0x49')](_0xd1092b)[_0xfa4f('0x25')](function(_0x3545a3){return[_0x3545a3,!![]];});});}_0xc74962[_0xfa4f('0xa4')]=_0x406f3b['id'];if(_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa5')]&&_0x205e05['body'][_0xfa4f('0xa5')]['id']){_0xc74962['id']=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa5')]['id'];return db[_0xfa4f('0xa2')][_0xfa4f('0x48')]({'where':_0xc74962})[_0xfa4f('0x25')](function(_0x54696c){if(_0x54696c){return[_0x54696c,![]];}return db['ChatInteraction']['create'](_0xd1092b)[_0xfa4f('0x25')](function(_0x3c1a26){return[_0x3c1a26,!![]];});});}return db[_0xfa4f('0xa2')]['create'](_0xd1092b)[_0xfa4f('0x25')](function(_0x3c5c76){return[_0x3c5c76,!![]];});}})['spread'](function(_0x200b4a,_0x2b38b8){if(_0x200b4a){_0x499728=_0x2b38b8;if(!_0x2b38b8){var _0x347c7c={'from':(_0x5c9d94[_0xfa4f('0x92')]['firstName']||'')+'\x20'+(_0x5c9d94[_0xfa4f('0x92')][_0xfa4f('0xa6')]||'')};if(_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa1')]&&_0x205e05[_0xfa4f('0x4a')]['messageId']&&_0x205e05[_0xfa4f('0x4a')]['threadId']!=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa7')]){_0x347c7c[_0xfa4f('0xa1')]=_0x205e05[_0xfa4f('0x4a')][_0xfa4f('0xa7')];}return _0x200b4a[_0xfa4f('0xa8')](_0x347c7c);}else{return _0x200b4a;}}})['then'](function(_0x1b7d92){_0x5c9d94[_0xfa4f('0xa5')]=_0x1b7d92['get']({'plain':!![]});_0x5c9d94[_0xfa4f('0xa5')][_0xfa4f('0xa9')]=_0x499728;if(_0x5c9d94[_0xfa4f('0xa5')]['created']){if(_0x5c9d94[_0xfa4f('0x8c')][_0xfa4f('0xaa')]){_0x5c9d94[_0xfa4f('0x8d')][_0xfa4f('0xab')]({'id':0x0,'priority':_0x5c9d94[_0xfa4f('0x8d')]['length']+0x1,'app':_0xfa4f('0xac'),'appdata':'unmanaged','interval':_0xfa4f('0xad')});}}return db[_0xfa4f('0xae')][_0xfa4f('0x49')]({'body':_0x205e05[_0xfa4f('0x4a')]['body'],'ChatWebsiteId':_0x205e05[_0xfa4f('0x51')]['id'],'ChatInteractionId':_0x1b7d92['id'],'direction':'in','ContactId':_0x5c9d94[_0xfa4f('0x92')]['id'],'AttachmentId':_0x205e05['body'][_0xfa4f('0xaf')]});})['then'](function(_0x14f24b){_0x5c9d94[_0xfa4f('0x1a')]=_0x14f24b;if(_0x5c9d94[_0xfa4f('0xa5')][_0xfa4f('0xb0')]){return db[_0xfa4f('0xb1')][_0xfa4f('0x48')]({'attributes':['id',_0xfa4f('0x2b')],'where':{'id':_0x5c9d94[_0xfa4f('0xa5')]['UserId']}})['then'](function(_0x5c41dc){if(_0x5c41dc){_0x5c9d94[_0xfa4f('0x8d')][_0xfa4f('0xb2')]({'id':0x0,'priority':0x0,'app':_0xfa4f('0xb3'),'appdata':_0x5c41dc[_0xfa4f('0x2b')]+','+(_0x5c9d94['account'][_0xfa4f('0xb4')]||0xa),'interval':_0xfa4f('0xad')});_0x5c9d94[_0xfa4f('0xb5')]=!![];}return respondWithRpcPromise(_0xfa4f('0xb6'),_0xfa4f('0xb7'),_0x5c9d94);});}return respondWithRpcPromise(_0xfa4f('0xb6'),_0xfa4f('0xb7'),_0x5c9d94);})[_0xfa4f('0x25')](function(_0x3a81e2){respondWithRpcPromise(_0xfa4f('0xb8'),_0xfa4f('0xb8'),{'event':_0xfa4f('0xb9'),'message':_0x3a81e2},client9002);return _0x3a81e2;})[_0xfa4f('0x25')](respondWithResult(_0x30691f,null))[_0xfa4f('0x1b')](handleError(_0x30691f,null));};exports[_0xfa4f('0xba')]=function(_0x3b55f9,_0x1f2dbd){var _0x588b25,_0x595619,_0x2b3228;var _0x1490f9=[];var _0x5e5e9f={};var _0x3d6539=_0x3b55f9[_0xfa4f('0xbb')]||[];var _0x47d435=[];var _0x3a4edf;return db[_0xfa4f('0x78')][_0xfa4f('0x53')]()['then'](function(_0x5d1c3b){if(!_0x5d1c3b){throw new db['Sequelize'][(_0xfa4f('0x81'))](_0xfa4f('0x79'));}_0x1490f9=_[_0xfa4f('0x7a')](_[_0xfa4f('0x45')](_0x5d1c3b),[_0xfa4f('0x7c'),_0xfa4f('0x7b'),'CompanyId',_0xfa4f('0x7e')]);if(_0x3b55f9[_0xfa4f('0x4a')]['id']){delete _0x3b55f9['body']['id'];}if(_[_0xfa4f('0x68')](_0x3b55f9[_0xfa4f('0x4a')]['from'])){throw _0x1f2dbd['status'](0x1f4)[_0xfa4f('0xbc')](new db[(_0xfa4f('0x80'))][(_0xfa4f('0x81'))](_0xfa4f('0x7f')));}if(_[_0xfa4f('0x68')](_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0x4a')])||_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0x4a')]===''){throw _0x1f2dbd[_0xfa4f('0x1d')](0x1f4)[_0xfa4f('0xbc')](new db['Sequelize']['ValidationError'](_0xfa4f('0xbd')));}if(_['isNil'](_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0xbe')])){throw _0x1f2dbd[_0xfa4f('0x1d')](0x1f4)['send'](new db[(_0xfa4f('0x80'))][(_0xfa4f('0x81'))](_0xfa4f('0xbf')+_0x1490f9));}if(!_['includes'](_0x1490f9,_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0xbe')])){throw _0x1f2dbd[_0xfa4f('0x1d')](0x1f4)['send'](new db[(_0xfa4f('0x80'))][(_0xfa4f('0x81'))](_0xfa4f('0xc0')+_0x1490f9));}_0x5e5e9f[_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0xbe')]]=_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0x86')];})[_0xfa4f('0x25')](function(){return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x3b55f9['params']['id']},'include':[{'model':db[_0xfa4f('0x87')],'as':_0xfa4f('0x88')},{'model':db['MailAccount'],'as':_0xfa4f('0xc1')}]});})[_0xfa4f('0x25')](handleEntityNotFound(_0x1f2dbd,null))[_0xfa4f('0x25')](function(_0x310059){if(_0x310059&&_0x310059['List']){_0x595619=_0x310059;var _0x44e14c=_[_0xfa4f('0xd')](_0x3b55f9[_0xfa4f('0x4a')],{'firstName':_0x3b55f9['body'][_0xfa4f('0x86')],'phone':_0x3b55f9['body'][_0xfa4f('0x86')],'ListId':_0x310059[_0xfa4f('0x7e')]});_0x44e14c[_0x3b55f9[_0xfa4f('0x4a')]['mapKeyOffline']]=_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0x86')];return db['CmContact'][_0xfa4f('0xc2')]({'where':_0x5e5e9f,'defaults':_0x44e14c});}})[_0xfa4f('0xc3')](function(_0x5dcb52){if(_0x5dcb52){_0x2b3228=_0x5dcb52;var _0x40d904=fs[_0xfa4f('0xc4')](path[_0xfa4f('0x63')](config['root'],_0xfa4f('0xc5')),'utf8');var _0x35cd8c=ejs[_0xfa4f('0xc6')](_0x40d904,{'body':_[_0xfa4f('0xc7')](_0x3b55f9[_0xfa4f('0x4a')][_0xfa4f('0x4a')]),'bodyTitle':_0x595619['offlineMessageBody']});return db[_0xfa4f('0xc8')][_0xfa4f('0x49')]({'body':_0x35cd8c,'plainBody':htmlToText[_0xfa4f('0xc9')](_0x35cd8c),'ContactId':_0x5dcb52['id'],'ChatWebsiteId':_0x595619['id']});}})[_0xfa4f('0x25')](function(_0x4bdbf1){_0x3a4edf=_0x4bdbf1;if(_0x3d6539['length']){var _0x20f150=_0x3d6539[_0xfa4f('0x2d')](function(_0x5059f2){return{'name':_0x5059f2[_0xfa4f('0xca')],'basename':_0x5059f2[_0xfa4f('0x5e')],'type':_0x5059f2[_0xfa4f('0xcb')],'ChatOfflineMessageId':_0x4bdbf1['id']};});_0x47d435=_0x20f150[_0xfa4f('0x2d')](_0x450dc0=>{var _0x13e371={'filename':_0x450dc0[_0xfa4f('0x2b')],'path':path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0xcc'),_0xfa4f('0xbb'),_0xfa4f('0xcd'),_0xfa4f('0xce'),_0x450dc0[_0xfa4f('0xcf')])};return _0x13e371;});if(!_0x595619['openNewInteraction']){return db[_0xfa4f('0xd0')][_0xfa4f('0xd1')](function(_0x150df3){return db[_0xfa4f('0xd2')][_0xfa4f('0xd3')](_0x20f150,{'transaction':_0x150df3});});}}})[_0xfa4f('0x25')](function(){if(_0x3a4edf){_0x588b25=_0x3a4edf;return db[_0xfa4f('0xc1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xfa4f('0xd4')],'as':_0xfa4f('0xd5'),'raw':!![],'include':[{'model':db[_0xfa4f('0xd6')],'as':_0xfa4f('0xd6'),'raw':!![]}]}]});}})[_0xfa4f('0x25')](function(_0x5d2cef){if(_0x5d2cef&&_0x5d2cef['Smtp']&&_0x595619[_0xfa4f('0xd7')]&&_0x595619[_0xfa4f('0xd8')]){var _0x319e0f=_0x5d2cef[_0xfa4f('0xd9')]();return respondWithRpcPromise(_0xfa4f('0xda'),_0xfa4f('0xdb'),{'account':_0x319e0f,'message':{'from':util['format'](_0xfa4f('0xdc'),_0x5d2cef[_0xfa4f('0x2b')],_0x5d2cef[_0xfa4f('0xdd')]||_0x5d2cef[_0xfa4f('0xd5')][_0xfa4f('0x4b')]),'to':_0x595619[_0xfa4f('0xd8')],'subject':_0x595619[_0xfa4f('0xde')],'html':_0x588b25[_0xfa4f('0x4a')],'attachments':_0x47d435}},client9003)[_0xfa4f('0x25')](function(){return _0x588b25;})[_0xfa4f('0x1b')](function(_0x56ef3c){logger[_0xfa4f('0x19')](_0x56ef3c);});}})[_0xfa4f('0x25')](function(){if(_0x595619&&_0x595619[_0xfa4f('0xdf')]&&_0x595619[_0xfa4f('0xe0')]){var _0x176c04=[];if(_0x3d6539[_0xfa4f('0x34')]){_0x176c04=_0x3d6539['map'](function(_0x374c8f){return{'name':_0x374c8f['originalname'],'basename':_0x374c8f[_0xfa4f('0x5e')],'type':_0x374c8f[_0xfa4f('0xcb')],'ChatOfflineMessageId':_0x3a4edf['id']};});}var _0x69c778;if(!_[_0xfa4f('0x68')](_0x595619[_0xfa4f('0xe1')])){var _0x1e5442=_[_0xfa4f('0x2d')](_0x3b55f9[_0xfa4f('0x4a')],function(_0x16e7ae){return _0x16e7ae;});var _0x26315d=_[_0xfa4f('0xe2')](_0x1e5442)[0x0];var _0x344b07=_[_0xfa4f('0xe3')](_0x26315d,function(_0x4060e7){return _0x4060e7;});_0x69c778=_0x344b07[0x1][_0x595619['subjectOffline']];}var _0x31dcc7={'from':_0x2b3228[_0xfa4f('0xdd')],'firstName':_0x2b3228[_0xfa4f('0xe4')],'lastName':_0x2b3228[_0xfa4f('0xa6')],'mapKey':_0xfa4f('0xdd'),'message':{'from':_0x2b3228['email'],'to':_0x595619[_0xfa4f('0xc1')][_0xfa4f('0xdd')],'cc':'','subject':_[_0xfa4f('0x68')](_0x69c778)?_0x595619[_0xfa4f('0xde')]:_0x69c778,'messageId':'','sentAt':new Date(),'attach':_0x176c04[_0xfa4f('0x34')],'attachments':_0x176c04,'originChannel':'Chat','ChatWebsiteId':_0x595619['id'],'ChatOfflineMessageId':_0x588b25['id'],'originTo':_0x595619[_0xfa4f('0xc1')][_0xfa4f('0xdd')]},'body':_0x588b25[_0xfa4f('0x4a')]};var _0x5ecee7={'account':{'id':_0x595619['MailAccountId']},'body':_0x31dcc7,'log':_0xfa4f('0xe5')};return respondWithRpcPromise(_0xfa4f('0xe5'),_0xfa4f('0xe6'),_0x5ecee7,client9001)['then'](function(){return _0x588b25;})[_0xfa4f('0x1b')](function(_0x2e97b2){logger[_0xfa4f('0x19')](_0x2e97b2);});}return;})['then'](function(){if(_0x588b25){return _0x588b25;}})['then'](respondWithResult(_0x1f2dbd,null))[_0xfa4f('0x1b')](function(_0x5354c5){logger['error'](_0xfa4f('0x1b'),_0x5354c5);for(var _0x5a40a9 of _0x3d6539){var _0x59eff8=path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0xcc'),_0xfa4f('0xbb'),_0xfa4f('0xcd'),'offline-chat',_0x5a40a9[_0xfa4f('0x5e')]);fs_extra['remove'](_0x59eff8)['catch'](function(_0x5b9c93){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x59eff8,_0x5b9c93);});}});};exports[_0xfa4f('0xe7')]=function(_0x2cc7e4,_0x2d597e){return db['ChatInteraction'][_0xfa4f('0x48')]({'where':{'id':_0x2cc7e4[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x2d597e,null))[_0xfa4f('0x25')](function(_0x13a357){if(_0x13a357){return _0x13a357[_0xfa4f('0xe7')](_0x2cc7e4[_0xfa4f('0x4a')][_0xfa4f('0x59')],_[_0xfa4f('0xe8')](_0x2cc7e4[_0xfa4f('0x4a')],['ids','id'])||{});}})[_0xfa4f('0x25')](respondWithResult(_0x2d597e,null))['catch'](handleError(_0x2d597e,null));};exports[_0xfa4f('0xe9')]=function(_0xbb0e3c,_0x2e6792){var _0xb7e934={'raw':![],'where':{}};var _0x59b8a5={};var _0x36c983={'count':0x0,'rows':[]};return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0xbb0e3c[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x2e6792,null))[_0xfa4f('0x25')](function(_0x175de1){if(_0x175de1){_0x59b8a5[_0xfa4f('0x30')]=_[_0xfa4f('0x45')](db[_0xfa4f('0xa2')][_0xfa4f('0x2e')]);_0x59b8a5[_0xfa4f('0x31')]=_['keys'](_0xbb0e3c[_0xfa4f('0x31')]);_0x59b8a5[_0xfa4f('0x38')]=_['intersection'](_0x59b8a5[_0xfa4f('0x30')],_0x59b8a5['query']);_0xb7e934[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x59b8a5['model'],qs['fields'](_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0xb7e934[_0xfa4f('0x32')]=_0xb7e934[_0xfa4f('0x32')][_0xfa4f('0x34')]?_0xb7e934[_0xfa4f('0x32')]:_0x59b8a5[_0xfa4f('0x30')];if(!_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x57')](_0xfa4f('0x35'))){_0xb7e934[_0xfa4f('0x21')]=qs['limit'](_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x21')]);_0xb7e934[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0xbb0e3c['query'][_0xfa4f('0x20')]);}_0xb7e934[_0xfa4f('0x36')]=qs['sort'](_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x37')]);_0xb7e934[_0xfa4f('0x3b')]=qs['filters'](_[_0xfa4f('0x39')](_0xbb0e3c['query'],_0x59b8a5['filters']));_0xb7e934[_0xfa4f('0x3b')][_0xfa4f('0x54')]=_0x175de1['id'];if(_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x3a')]){_0xb7e934[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0xb7e934[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0xb7e934['attributes'],function(_0x3ab097){var _0x4f5fe2={};_0x4f5fe2[_0x3ab097]={'$like':'%'+_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x3a')]+'%'};return _0x4f5fe2;})});}_0xb7e934=_['merge']({},_0xb7e934,_0xbb0e3c[_0xfa4f('0x47')]);return db[_0xfa4f('0xa2')]['count']({'where':_0xb7e934[_0xfa4f('0x3b')]})[_0xfa4f('0x25')](function(_0x2c5cdd){_0x36c983[_0xfa4f('0x22')]=_0x2c5cdd;if(_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0x40')]){_0xb7e934[_0xfa4f('0x41')]=[{'model':db['CmContact'],'as':_0xfa4f('0xea'),'required':![]},{'model':db[_0xfa4f('0xb1')],'as':_0xfa4f('0xeb'),'attributes':[_0xfa4f('0x2b'),_0xfa4f('0xec'),'internal'],'required':![]},{'model':db[_0xfa4f('0xed')],'as':_0xfa4f('0xee'),'attributes':['id',_0xfa4f('0x2b'),_0xfa4f('0xef')],'where':_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0xf0')]?{'id':_0xbb0e3c[_0xfa4f('0x31')]['tag']}:undefined,'required':_0xbb0e3c[_0xfa4f('0x31')][_0xfa4f('0xf0')]?!![]:![]}];}return db[_0xfa4f('0xa2')][_0xfa4f('0x42')](_0xb7e934);})[_0xfa4f('0x25')](function(_0x591afe){_0x36c983['rows']=_0x591afe;return _0x36c983;});}})[_0xfa4f('0x25')](respondWithFilteredResult(_0x2e6792,_0xb7e934))[_0xfa4f('0x1b')](handleError(_0x2e6792,null));};function iftimePromise(_0x1ef8ba,_0x564b0a){return respondWithRpcPromise('Command',_0xfa4f('0xf1'),{'command':_0x564b0a[_0xfa4f('0xf2')]?util[_0xfa4f('0x9d')](_0xfa4f('0xf3'),_0x1ef8ba['interval'],_0x564b0a[_0xfa4f('0xf2')]):util[_0xfa4f('0x9d')](_0xfa4f('0xf4'),_0x1ef8ba['interval'])},client9002)['then'](function(_0x301b16){var _0x13eedc=_0x301b16&&_0x301b16['indexOf'](_0xfa4f('0xf5'))>=0x0?!![]:![];logger['info'](_0xfa4f('0xf6'),_0x564b0a['id'],_0x1ef8ba['id'],_0x1ef8ba['interval'],_0x13eedc?_0xfa4f('0xf7'):_0xfa4f('0xf8'),_0x564b0a[_0xfa4f('0xf2')]?_0x564b0a['timezone']:'No\x20timezone');return _0x13eedc;})[_0xfa4f('0x1b')](function(_0x42ec70){logger[_0xfa4f('0x19')](_0xfa4f('0xf6'),_0x564b0a['id'],_0x1ef8ba['id'],_0x1ef8ba[_0xfa4f('0xf9')],util[_0xfa4f('0xfa')](_0x42ec70,{'showHidden':![],'depth':null}),_0x564b0a['timezone']?_0x564b0a[_0xfa4f('0xf2')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x24096a,_0x488e3f){var _0x24ac3c=0x0;var _0x3d13fe=0x0;var _0x38db69=![];var _0x1572a3;var _0x258249;return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x24096a['params']['id']},'include':[{'model':db[_0xfa4f('0xfb')],'as':'Interval','include':[{'model':db[_0xfa4f('0xfb')],'as':_0xfa4f('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xfa4f('0x25')](handleEntityNotFound(_0x488e3f,null))[_0xfa4f('0x25')](function(_0x352481){if(_0x352481){_0x1572a3=_0x352481;return _0x352481[_0xfa4f('0xfd')]({'raw':!![]});}})[_0xfa4f('0x25')](function(_0x585cdf){if(_0x1572a3){if(_0x585cdf){_0x258249=_0x585cdf;}}return require(_0xfa4f('0x66'))[_0xfa4f('0x67')]();})[_0xfa4f('0x25')](function(_0x5a429a){if(_0x5a429a){_0x3d13fe=_0x5a429a['virtual'];_0x38db69=_0x5a429a[_0xfa4f('0xfe')];}})['then'](function(){return db[_0xfa4f('0xa2')][_0xfa4f('0x22')]({'where':{'closed':![]}});})[_0xfa4f('0x25')](function(_0x1a29d2){_0x24ac3c=_0x1a29d2;if(_0x3d13fe&&_0x1a29d2>_0x3d13fe){return db['License'][_0xfa4f('0x55')]({'where':{'id':0x1}})[_0xfa4f('0x25')](function(_0x5381c3){if(_0x5381c3){_0x5381c3[_0xfa4f('0xff')](_0xfa4f('0x100'));}});}})[_0xfa4f('0x25')](function(){if(_0x1572a3[_0xfa4f('0xfb')]&&_0x1572a3[_0xfa4f('0xfb')][_0xfa4f('0xfc')]){var _0x4961a4=[];for(var _0x573716=0x0;_0x573716<_0x1572a3[_0xfa4f('0xfb')][_0xfa4f('0xfc')][_0xfa4f('0x34')];_0x573716++){var _0x2c23d1=_0x1572a3[_0xfa4f('0xfb')][_0xfa4f('0xfc')][_0x573716][_0xfa4f('0x27')]({'plain':!![]});_0x4961a4[_0xfa4f('0xab')](iftimePromise(_0x2c23d1,_0x1572a3));}return BPromise[_0xfa4f('0x101')](_0x4961a4)['then'](function(_0x50e296){return _['some'](_0x50e296);});}else{return!![];}})[_0xfa4f('0x25')](function(_0x198e3e){var _0x11b634=fs[_0xfa4f('0xc4')](path[_0xfa4f('0x63')](config[_0xfa4f('0x64')],_0xfa4f('0x102')),_0xfa4f('0x103'));var _0x41b9ee={'remote':_0x1572a3['remote'],'query':querystring[_0xfa4f('0x18')](_[_0xfa4f('0x3c')](_0x1572a3[_0xfa4f('0x27')]({'plain':!![]}),{'customerIp':_0x24096a[_0xfa4f('0x74')][_0xfa4f('0x95')]||_0x24096a[_0xfa4f('0x74')][_0xfa4f('0x104')]||_0x24096a[_0xfa4f('0x105')][_0xfa4f('0x106')]||_0x24096a['ip'],'referer':_0x24096a[_0xfa4f('0x74')][_0xfa4f('0x107')],'openedInteractions':_0x24ac3c,'maxInteractions':_0x3d13fe,'virtual':_0x38db69['virtual'],'online':_0x198e3e,'custom':_0x38db69}))[_0xfa4f('0x108')](/'/g,'\x5c\x27')};_0x488e3f[_0xfa4f('0xbc')](ejs['render'](Mustache['render'](_0x11b634,_0x41b9ee),{'proactiveActions':_0x258249,'alignment':_0x1572a3[_0xfa4f('0x109')],'verticalAlignment':_0x1572a3[_0xfa4f('0x10a')],'div_color':_0x1572a3[_0xfa4f('0xef')],'labelText':_0x1572a3[_0xfa4f('0x10b')],'text_color':_0x1572a3[_0xfa4f('0x10c')],'text_button_color':_0x1572a3[_0xfa4f('0x10d')],'button_color':_0x1572a3[_0xfa4f('0x10e')],'background_color':_0x1572a3[_0xfa4f('0x10f')],'hideWhenOffline':_0x1572a3['hideWhenOffline'],'interval':_0x1572a3[_0xfa4f('0x110')]}));})[_0xfa4f('0x1b')](handleError(_0x488e3f,null));};exports[_0xfa4f('0x111')]=function(_0xd9e519,_0x7d79e9){var _0xd754cd=_0xd9e519[_0xfa4f('0x51')]['id'];var _0x5a400b=_0xd9e519[_0xfa4f('0x4a')];var _0x4177e5=0xc8;var _0x42c4a9=null;return db['sequelize'][_0xfa4f('0xd1')]({'isolationLevel':db[_0xfa4f('0xd0')][_0xfa4f('0x112')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x26a8ca){return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0xd754cd},'transaction':_0x26a8ca})[_0xfa4f('0x25')](function(_0x5385d3){if(_0x5385d3){return db[_0xfa4f('0x8b')][_0xfa4f('0x26')]({'where':{'ChatWebsiteId':_0xd754cd},'transaction':_0x26a8ca})['then'](function(){var _0x2bf180=_['map'](_0x5a400b,function(_0x1d0ae8){_0x1d0ae8[_0xfa4f('0x54')]=_0xd754cd;return _0x1d0ae8;});return db['ChatApplication'][_0xfa4f('0xd3')](_0x2bf180,{'transaction':_0x26a8ca});});}else{_0x4177e5=0x194;_0x42c4a9=[];}});})[_0xfa4f('0x25')](function(){if(_0x4177e5!==0x194){return db[_0xfa4f('0x8b')][_0xfa4f('0x113')]({'where':{'ChatWebsiteId':_0xd754cd},'order':_0xfa4f('0x90')})['then'](function(_0x54671c){_0x42c4a9=_0x54671c;});}})[_0xfa4f('0x1b')](function(_0x4fc2d3){_0x4177e5=0x1f4;logger[_0xfa4f('0x19')](_0x4fc2d3[_0xfa4f('0x2a')]);if(_0x4fc2d3['name']){delete _0x4fc2d3[_0xfa4f('0x2b')];}_0x42c4a9=_0x4fc2d3;})[_0xfa4f('0x114')](function(){if(_0x42c4a9===null){_0x7d79e9[_0xfa4f('0x1c')](_0x4177e5);}else{if(_0x4177e5===0x1f4){_0x7d79e9[_0xfa4f('0x1d')](_0x4177e5)[_0xfa4f('0xbc')](_0x42c4a9);}else{_0x7d79e9[_0xfa4f('0x1d')](_0x4177e5)[_0xfa4f('0x1f')](_0x42c4a9);}}});};exports[_0xfa4f('0x115')]=function(_0x2df894,_0x440c58){var _0x5932c1={};var _0x1afdc4={};var _0x114e26;var _0x3a3491;return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0x2df894[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x440c58,null))[_0xfa4f('0x25')](function(_0x4f92c0){if(_0x4f92c0){_0x114e26=_0x4f92c0;_0x1afdc4['model']=_['keys'](db[_0xfa4f('0x8b')]['rawAttributes']);_0x1afdc4[_0xfa4f('0x31')]=_['keys'](_0x2df894[_0xfa4f('0x31')]);_0x1afdc4[_0xfa4f('0x38')]=_['intersection'](_0x1afdc4[_0xfa4f('0x30')],_0x1afdc4[_0xfa4f('0x31')]);_0x5932c1[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x1afdc4[_0xfa4f('0x30')],qs['fields'](_0x2df894[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0x5932c1[_0xfa4f('0x32')]=_0x5932c1['attributes']['length']?_0x5932c1[_0xfa4f('0x32')]:_0x1afdc4['model'];_0x5932c1[_0xfa4f('0x36')]=qs[_0xfa4f('0x37')](_0x2df894['query'][_0xfa4f('0x37')]);_0x5932c1[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x2df894['query'],_0x1afdc4[_0xfa4f('0x38')]));if(_0x2df894['query'][_0xfa4f('0x3a')]){_0x5932c1[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x5932c1[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0x5932c1[_0xfa4f('0x32')],function(_0x58b18e){var _0x7997a2={};_0x7997a2[_0x58b18e]={'$like':'%'+_0x2df894['query'][_0xfa4f('0x3a')]+'%'};return _0x7997a2;})});}_0x5932c1=_[_0xfa4f('0x3c')]({},_0x5932c1,_0x2df894[_0xfa4f('0x47')]);return _0x114e26['getApplications'](_0x5932c1);}})[_0xfa4f('0x25')](function(_0xf5e383){if(_0xf5e383){_0x3a3491=_0xf5e383[_0xfa4f('0x34')];if(!_0x2df894[_0xfa4f('0x31')][_0xfa4f('0x57')](_0xfa4f('0x35'))){_0x5932c1[_0xfa4f('0x21')]=qs['limit'](_0x2df894[_0xfa4f('0x31')]['limit']);_0x5932c1[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x2df894[_0xfa4f('0x31')][_0xfa4f('0x20')]);}return _0x114e26[_0xfa4f('0x115')](_0x5932c1);}})[_0xfa4f('0x25')](function(_0x2fb40f){if(_0x2fb40f){return _0x2fb40f?{'count':_0x3a3491,'rows':_0x2fb40f}:null;}})[_0xfa4f('0x25')](respondWithResult(_0x440c58,null))[_0xfa4f('0x1b')](handleError(_0x440c58,null));};exports[_0xfa4f('0x116')]=function(_0x1dc047,_0x243cf4){return db['chatProactiveAction'][_0xfa4f('0x48')]({'where':{'id':_0x1dc047[_0xfa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x243cf4,null))[_0xfa4f('0x25')](function(_0x35a78c){if(_0x35a78c){return _0x35a78c[_0xfa4f('0x116')](_0x1dc047['body'][_0xfa4f('0x59')],_[_0xfa4f('0xe8')](_0x1dc047[_0xfa4f('0x4a')],['ids','id'])||{});}})[_0xfa4f('0x25')](respondWithResult(_0x243cf4,null))[_0xfa4f('0x1b')](handleError(_0x243cf4,null));};exports[_0xfa4f('0xfd')]=function(_0x59acbd,_0x1e4918){var _0x2cd041={};var _0x53a8d4={};var _0x308559;var _0x174358;return db['ChatWebsite'][_0xfa4f('0x55')]({'where':{'id':_0x59acbd[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x1e4918,null))[_0xfa4f('0x25')](function(_0x5abe17){if(_0x5abe17){_0x308559=_0x5abe17;_0x53a8d4['model']=_['keys'](db[_0xfa4f('0x117')][_0xfa4f('0x2e')]);_0x53a8d4[_0xfa4f('0x31')]=_[_0xfa4f('0x45')](_0x59acbd['query']);_0x53a8d4[_0xfa4f('0x38')]=_['intersection'](_0x53a8d4[_0xfa4f('0x30')],_0x53a8d4[_0xfa4f('0x31')]);_0x2cd041[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x53a8d4[_0xfa4f('0x30')],qs[_0xfa4f('0x33')](_0x59acbd['query'][_0xfa4f('0x33')]));_0x2cd041['attributes']=_0x2cd041['attributes'][_0xfa4f('0x34')]?_0x2cd041[_0xfa4f('0x32')]:_0x53a8d4[_0xfa4f('0x30')];_0x2cd041['order']=qs[_0xfa4f('0x37')](_0x59acbd['query'][_0xfa4f('0x37')]);_0x2cd041[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x59acbd['query'],_0x53a8d4[_0xfa4f('0x38')]));if(_0x59acbd['query']['filter']){_0x2cd041[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x2cd041[_0xfa4f('0x3b')],{'$or':_['map'](_0x2cd041[_0xfa4f('0x32')],function(_0x8ec31c){var _0x5b8f4={};_0x5b8f4[_0x8ec31c]={'$like':'%'+_0x59acbd[_0xfa4f('0x31')][_0xfa4f('0x3a')]+'%'};return _0x5b8f4;})});}_0x2cd041=_[_0xfa4f('0x3c')]({},_0x2cd041,_0x59acbd[_0xfa4f('0x47')]);return _0x308559['getProactiveActions'](_0x2cd041);}})[_0xfa4f('0x25')](function(_0x5ded80){if(_0x5ded80){_0x174358=_0x5ded80[_0xfa4f('0x34')];if(!_0x59acbd[_0xfa4f('0x31')][_0xfa4f('0x57')](_0xfa4f('0x35'))){_0x2cd041[_0xfa4f('0x21')]=qs['limit'](_0x59acbd[_0xfa4f('0x31')][_0xfa4f('0x21')]);_0x2cd041[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x59acbd[_0xfa4f('0x31')][_0xfa4f('0x20')]);}return _0x308559[_0xfa4f('0xfd')](_0x2cd041);}})['then'](function(_0x4144e8){if(_0x4144e8){return _0x4144e8?{'count':_0x174358,'rows':_0x4144e8}:null;}})[_0xfa4f('0x25')](respondWithResult(_0x1e4918,null))[_0xfa4f('0x1b')](handleError(_0x1e4918,null));};exports['getFields']=function(_0x1dfae8,_0x2df2e7){var _0x375cee=_0x1dfae8[_0xfa4f('0x31')]['online']===_0xfa4f('0x118')?_0xfa4f('0x119'):_0xfa4f('0x11a');return db['ChatWebsite'][_0xfa4f('0x48')]({'attributes':['id',_0x375cee],'where':{'id':_0x1dfae8[_0xfa4f('0x51')]['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x2df2e7,null))[_0xfa4f('0x25')](function(_0x9a6a1){if(_0x9a6a1){var _0x15005e=_0x9a6a1[_0x375cee];var _0x30b209=_0x15005e&&_0x15005e['items']?_0x15005e[_0xfa4f('0x11b')]:[];_0x2df2e7[_0xfa4f('0xbc')]({'fromKey':_['isNil'](_0x15005e[_0xfa4f('0x11c')])?undefined:_0x15005e[_0xfa4f('0x11c')],'count':_0x30b209[_0xfa4f('0x34')],'rows':_0x30b209});}})[_0xfa4f('0x1b')](handleError(_0x2df2e7,null));};exports[_0xfa4f('0x11d')]=function(_0x5d7f5f,_0xba0f44){var _0x15520e={'raw':![],'where':{}};var _0x43254c={};var _0x41bcb8={'count':0x0,'rows':[]};return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0x5d7f5f[_0xfa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0xba0f44,null))['then'](function(_0x15ccd4){if(_0x15ccd4){_0x43254c[_0xfa4f('0x30')]=_['keys'](db[_0xfa4f('0xc8')][_0xfa4f('0x2e')]);_0x43254c[_0xfa4f('0x31')]=_[_0xfa4f('0x45')](_0x5d7f5f[_0xfa4f('0x31')]);_0x43254c['filters']=_[_0xfa4f('0x46')](_0x43254c[_0xfa4f('0x30')],_0x43254c['query']);_0x15520e['attributes']=_['intersection'](_0x43254c['model'],qs[_0xfa4f('0x33')](_0x5d7f5f[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0x15520e[_0xfa4f('0x32')]=_0x15520e[_0xfa4f('0x32')][_0xfa4f('0x34')]?_0x15520e[_0xfa4f('0x32')]:_0x43254c[_0xfa4f('0x30')];if(!_0x5d7f5f[_0xfa4f('0x31')][_0xfa4f('0x57')]('nolimit')){_0x15520e[_0xfa4f('0x21')]=qs[_0xfa4f('0x21')](_0x5d7f5f[_0xfa4f('0x31')][_0xfa4f('0x21')]);_0x15520e[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x5d7f5f['query'][_0xfa4f('0x20')]);}_0x15520e[_0xfa4f('0x36')]=qs['sort'](_0x5d7f5f[_0xfa4f('0x31')][_0xfa4f('0x37')]);_0x15520e[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_['pick'](_0x5d7f5f[_0xfa4f('0x31')],_0x43254c[_0xfa4f('0x38')]));_0x15520e[_0xfa4f('0x3b')][_0xfa4f('0x54')]=_0x15ccd4['id'];if(_0x5d7f5f[_0xfa4f('0x31')][_0xfa4f('0x3a')]){_0x15520e[_0xfa4f('0x3b')]=_[_0xfa4f('0x3c')](_0x15520e[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0x15520e[_0xfa4f('0x32')],function(_0x58d61d){var _0x4a076b={};_0x4a076b[_0x58d61d]={'$like':'%'+_0x5d7f5f[_0xfa4f('0x31')]['filter']+'%'};return _0x4a076b;})});}_0x15520e=_['merge']({},_0x15520e,_0x5d7f5f[_0xfa4f('0x47')]);return db[_0xfa4f('0xc8')][_0xfa4f('0x22')]({'where':_0x15520e[_0xfa4f('0x3b')]})['then'](function(_0xe53f8e){_0x41bcb8[_0xfa4f('0x22')]=_0xe53f8e;if(_0x5d7f5f['query'][_0xfa4f('0x40')]){_0x15520e[_0xfa4f('0x41')]=[{'all':!![]}];}else{_0x15520e['include']=[{'model':db[_0xfa4f('0x78')],'as':_0xfa4f('0xea'),'required':![]},{'model':db[_0xfa4f('0xd2')],'as':_0xfa4f('0x11e'),'required':![]}];}return db[_0xfa4f('0xc8')][_0xfa4f('0x42')](_0x15520e);})[_0xfa4f('0x25')](function(_0x3c35bf){_0x41bcb8['rows']=_0x3c35bf;return _0x41bcb8;});}})['then'](respondWithFilteredResult(_0xba0f44,_0x15520e))[_0xfa4f('0x1b')](handleError(_0xba0f44,null));};exports['addAgents']=function(_0x30761b,_0x5f2739){return db[_0xfa4f('0x3f')]['find']({'where':{'id':_0x30761b['params']['id']}})[_0xfa4f('0x25')](handleEntityNotFound(_0x5f2739,null))['then'](function(_0x1a588e){if(_0x1a588e){return _0x1a588e['addAgents'](_0x30761b['body'][_0xfa4f('0x59')],_[_0xfa4f('0xe8')](_0x30761b[_0xfa4f('0x4a')],['ids','id'])||{})[_0xfa4f('0xc3')](function(_0x2298e3){for(var _0xf4e111=0x0;_0xf4e111<_0x30761b[_0xfa4f('0x4a')][_0xfa4f('0x59')][_0xfa4f('0x34')];_0xf4e111+=0x1){socket[_0xfa4f('0x11f')](_0xfa4f('0x120'),{'UserId':Number(_0x30761b[_0xfa4f('0x4a')][_0xfa4f('0x59')][_0xf4e111]),'ChatWebsiteId':Number(_0x30761b[_0xfa4f('0x51')]['id'])});}return _0x2298e3;});}})[_0xfa4f('0x25')](respondWithResult(_0x5f2739,null))[_0xfa4f('0x1b')](handleError(_0x5f2739,null));};exports[_0xfa4f('0x121')]=function(_0x442113,_0x55440d){return db[_0xfa4f('0x3f')][_0xfa4f('0x48')]({'where':{'id':_0x442113[_0xfa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x55440d,null))[_0xfa4f('0x25')](function(_0x3ae566){if(_0x3ae566){return _0x3ae566[_0xfa4f('0x121')](_0x442113[_0xfa4f('0x31')]['ids'])[_0xfa4f('0x25')](function(){if(_[_0xfa4f('0x122')](_0x442113['query']['ids'])){for(var _0x5324eb=0x0;_0x5324eb<_0x442113[_0xfa4f('0x31')]['ids'][_0xfa4f('0x34')];_0x5324eb+=0x1){socket[_0xfa4f('0x11f')](_0xfa4f('0x123'),{'UserId':Number(_0x442113[_0xfa4f('0x31')][_0xfa4f('0x59')][_0x5324eb]),'ChatWebsiteId':Number(_0x442113[_0xfa4f('0x51')]['id'])});}}else{socket[_0xfa4f('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x442113[_0xfa4f('0x31')][_0xfa4f('0x59')]),'ChatWebsiteId':Number(_0x442113[_0xfa4f('0x51')]['id'])});}});}})[_0xfa4f('0x25')](respondWithStatusCode(_0x55440d,null))[_0xfa4f('0x1b')](handleError(_0x55440d,null));};exports[_0xfa4f('0x124')]=function(_0x40738c,_0x3095fa){var _0x57e0e2={};var _0x31d292={};var _0x5f4f02;var _0xd7bd83;return db[_0xfa4f('0x3f')][_0xfa4f('0x55')]({'where':{'id':_0x40738c[_0xfa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x3095fa,null))[_0xfa4f('0x25')](function(_0x1323a3){if(_0x1323a3){_0x5f4f02=_0x1323a3;_0x31d292[_0xfa4f('0x30')]=_[_0xfa4f('0x45')](db[_0xfa4f('0xb1')]['rawAttributes']);_0x31d292[_0xfa4f('0x31')]=_['keys'](_0x40738c[_0xfa4f('0x31')]);_0x31d292['filters']=_[_0xfa4f('0x46')](_0x31d292[_0xfa4f('0x30')],_0x31d292[_0xfa4f('0x31')]);_0x57e0e2[_0xfa4f('0x32')]=_[_0xfa4f('0x46')](_0x31d292[_0xfa4f('0x30')],qs[_0xfa4f('0x33')](_0x40738c[_0xfa4f('0x31')][_0xfa4f('0x33')]));_0x57e0e2[_0xfa4f('0x32')]=_0x57e0e2[_0xfa4f('0x32')]['length']?_0x57e0e2[_0xfa4f('0x32')]:_0x31d292[_0xfa4f('0x30')];_0x57e0e2[_0xfa4f('0x36')]=qs['sort'](_0x40738c[_0xfa4f('0x31')][_0xfa4f('0x37')]);_0x57e0e2[_0xfa4f('0x3b')]=qs[_0xfa4f('0x38')](_[_0xfa4f('0x39')](_0x40738c['query'],_0x31d292[_0xfa4f('0x38')]));if(_0x40738c[_0xfa4f('0x31')]['filter']){_0x57e0e2['where']=_[_0xfa4f('0x3c')](_0x57e0e2[_0xfa4f('0x3b')],{'$or':_[_0xfa4f('0x2d')](_0x57e0e2[_0xfa4f('0x32')],function(_0x4abcbd){var _0x5a72f9={};_0x5a72f9[_0x4abcbd]={'$like':'%'+_0x40738c['query'][_0xfa4f('0x3a')]+'%'};return _0x5a72f9;})});}_0x57e0e2=_[_0xfa4f('0x3c')]({},_0x57e0e2,_0x40738c[_0xfa4f('0x47')]);return _0x5f4f02[_0xfa4f('0x124')](_0x57e0e2);}})['then'](function(_0x2dd873){if(_0x2dd873){_0xd7bd83=_0x2dd873[_0xfa4f('0x34')];if(!_0x40738c['query']['hasOwnProperty']('nolimit')){_0x57e0e2[_0xfa4f('0x21')]=qs[_0xfa4f('0x21')](_0x40738c[_0xfa4f('0x31')][_0xfa4f('0x21')]);_0x57e0e2[_0xfa4f('0x20')]=qs[_0xfa4f('0x20')](_0x40738c['query'][_0xfa4f('0x20')]);}return _0x5f4f02[_0xfa4f('0x124')](_0x57e0e2);}})['then'](function(_0x548b10){if(_0x548b10){return _0x548b10?{'count':_0xd7bd83,'rows':_0x548b10}:null;}})[_0xfa4f('0x25')](respondWithResult(_0x3095fa,null))[_0xfa4f('0x1b')](handleError(_0x3095fa,null));}; \ No newline at end of file +var _0x6d9e=['device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','push','close','ChatMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','virtual','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','includeAll','include','show','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','pick','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','options','removeAnswers','addLogo','file','filename','addAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','existsSync','server/files/images/logos/','join','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','isNil','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','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','List','Contacts','DESC','ChatApplication','Applications','applications','list','priority','asc','account','contact','cf-connecting-ip','x-forwarded-for','first','lastName','x-real-port','referer','browser','version','format','unknown'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0x6d9e,0x1a8));var _0xe6d9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6d9e[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0xe6d9('0x0'));var Mustache=require(_0xe6d9('0x1'));var util=require(_0xe6d9('0x2'));var path=require(_0xe6d9('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe6d9('0x4'));var _=require(_0xe6d9('0x5'));var querystring=require('querystring');var Redis=require(_0xe6d9('0x6'));var qs=require(_0xe6d9('0x7'));var logger=require(_0xe6d9('0x8'))(_0xe6d9('0x9'));var config=require('../../config/environment');var db=require(_0xe6d9('0xa'))['db'];config[_0xe6d9('0xb')]=_[_0xe6d9('0xc')](config['redis'],{'host':_0xe6d9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6d9('0xb')]));require('./chatWebsite.socket')[_0xe6d9('0xe')](socket);var htmlToText=require(_0xe6d9('0xf'));var jayson=require('jayson/promise');var client=jayson[_0xe6d9('0x10')]['http']({'port':0x232c});var client9002=jayson[_0xe6d9('0x10')][_0xe6d9('0x11')]({'port':0x232a});var client9003=jayson[_0xe6d9('0x10')]['http']({'port':0x232b});var client9001=jayson[_0xe6d9('0x10')][_0xe6d9('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x1bc092,_0x3b2d60,_0x32c680,_0x1ef066){return new BPromise(function(_0x35f43a,_0x5bf97a){var _0x508ded=_0x1ef066||client;return _0x508ded[_0xe6d9('0x12')](_0x1bc092,_0x32c680)[_0xe6d9('0x13')](function(_0x5b8116){logger[_0xe6d9('0x14')](_0xe6d9('0x15'),_0x3b2d60,_0xe6d9('0x16'));logger['debug'](_0xe6d9('0x17'),_0x3b2d60,_0xe6d9('0x16'),JSON[_0xe6d9('0x18')](_0x5b8116));if(_0x5b8116[_0xe6d9('0x19')]){if(_0x5b8116['error'][_0xe6d9('0x1a')]===0x1f4){logger[_0xe6d9('0x19')](_0xe6d9('0x15'),_0x3b2d60,_0x5b8116[_0xe6d9('0x19')][_0xe6d9('0x1b')]);return _0x5bf97a(_0x5b8116[_0xe6d9('0x19')][_0xe6d9('0x1b')]);}logger[_0xe6d9('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x3b2d60,_0x5b8116['error'][_0xe6d9('0x1b')]);return _0x35f43a(_0x5b8116[_0xe6d9('0x19')][_0xe6d9('0x1b')]);}else{logger[_0xe6d9('0x14')](_0xe6d9('0x15'),_0x3b2d60,_0xe6d9('0x16'));_0x35f43a(_0x5b8116['result']['message']);}})['catch'](function(_0x8e7220){logger['error'](_0xe6d9('0x15'),_0x3b2d60,_0x8e7220);_0x5bf97a(_0x8e7220);});});}function respondWithStatusCode(_0x5d608c,_0x1b15c2){_0x1b15c2=_0x1b15c2||0xcc;return function(_0x427bf7){if(_0x427bf7){return _0x5d608c[_0xe6d9('0x1c')](_0x1b15c2);}return _0x5d608c['status'](_0x1b15c2)[_0xe6d9('0x1d')]();};}function respondWithResult(_0x38b198,_0x50b1f3){_0x50b1f3=_0x50b1f3||0xc8;return function(_0x494cc7){if(_0x494cc7){return _0x38b198[_0xe6d9('0x1e')](_0x50b1f3)[_0xe6d9('0x1f')](_0x494cc7);}};}function respondWithFilteredResult(_0x2635f3,_0x4917ac){return function(_0x35ef62){if(_0x35ef62){var _0x4c29a7=typeof _0x4917ac[_0xe6d9('0x20')]===_0xe6d9('0x21')&&typeof _0x4917ac['limit']===_0xe6d9('0x21');var _0x5e43f7=_0x35ef62[_0xe6d9('0x22')];var _0x329e6a=_0x4c29a7?0x0:_0x4917ac[_0xe6d9('0x20')];var _0x28a358=_0x4c29a7?_0x35ef62[_0xe6d9('0x22')]:_0x4917ac[_0xe6d9('0x20')]+_0x4917ac['limit'];var _0x11be3e;if(_0x28a358>=_0x5e43f7){_0x28a358=_0x5e43f7;_0x11be3e=0xc8;}else{_0x11be3e=0xce;}_0x2635f3[_0xe6d9('0x1e')](_0x11be3e);return _0x2635f3[_0xe6d9('0x23')](_0xe6d9('0x24'),_0x329e6a+'-'+_0x28a358+'/'+_0x5e43f7)[_0xe6d9('0x1f')](_0x35ef62);}return null;};}function saveUpdates(_0x1ce078){return function(_0x50c513){if(_0x50c513){return _0x50c513[_0xe6d9('0x25')](_0x1ce078)['then'](function(_0x28c682){return _0x28c682;});}return null;};}function removeEntity(_0x45320a){return function(_0x5efe39){if(_0x5efe39){return _0x5efe39[_0xe6d9('0x26')]()[_0xe6d9('0x13')](function(){var _0x2d5186=_0x5efe39[_0xe6d9('0x27')]({'plain':!![]});var _0x3773d3=_0xe6d9('0x28');return db[_0xe6d9('0x29')][_0xe6d9('0x26')]({'where':{'type':_0x3773d3,'resourceId':_0x2d5186['id']}})[_0xe6d9('0x13')](function(){return _0x5efe39;});})[_0xe6d9('0x13')](function(){_0x45320a[_0xe6d9('0x1e')](0xcc)[_0xe6d9('0x1d')]();});}};}function handleEntityNotFound(_0x2bb35a){return function(_0x51a8ea){if(!_0x51a8ea){_0x2bb35a[_0xe6d9('0x1c')](0x194);}return _0x51a8ea;};}function handleError(_0x52102a,_0x43884d){_0x43884d=_0x43884d||0x1f4;return function(_0x209c84){logger[_0xe6d9('0x19')](_0x209c84[_0xe6d9('0x2a')]);if(_0x209c84[_0xe6d9('0x2b')]){delete _0x209c84[_0xe6d9('0x2b')];}_0x52102a[_0xe6d9('0x1e')](_0x43884d)[_0xe6d9('0x2c')](_0x209c84);};}exports['index']=function(_0x5b3398,_0xbb445b){var _0x220a99={'include':[{'model':db[_0xe6d9('0x2d')],'as':_0xe6d9('0x2e')}]},_0x4e1ea7={},_0x197f82={'count':0x0,'rows':[]};var _0x5f1050=_[_0xe6d9('0x2f')](db[_0xe6d9('0x30')]['rawAttributes'],function(_0x1d1833){return{'name':_0x1d1833[_0xe6d9('0x31')],'type':_0x1d1833[_0xe6d9('0x32')][_0xe6d9('0x33')]};});_0x4e1ea7[_0xe6d9('0x34')]=_[_0xe6d9('0x2f')](_0x5f1050,'name');_0x4e1ea7[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x5b3398[_0xe6d9('0x35')]);_0x4e1ea7[_0xe6d9('0x37')]=_[_0xe6d9('0x38')](_0x4e1ea7[_0xe6d9('0x34')],_0x4e1ea7[_0xe6d9('0x35')]);_0x220a99[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0x4e1ea7[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x5b3398['query'][_0xe6d9('0x3a')]));_0x220a99[_0xe6d9('0x39')]=_0x220a99[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x220a99[_0xe6d9('0x39')]:_0x4e1ea7[_0xe6d9('0x34')];if(!_0x5b3398[_0xe6d9('0x35')]['hasOwnProperty'](_0xe6d9('0x3c'))){_0x220a99[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x5b3398[_0xe6d9('0x35')][_0xe6d9('0x3d')]);_0x220a99[_0xe6d9('0x20')]=qs[_0xe6d9('0x20')](_0x5b3398[_0xe6d9('0x35')][_0xe6d9('0x20')]);}_0x220a99[_0xe6d9('0x3e')]=qs['sort'](_0x5b3398['query'][_0xe6d9('0x3f')]);_0x220a99['where']=qs['filters'](_['pick'](_0x5b3398[_0xe6d9('0x35')],_0x4e1ea7['filters']),_0x5f1050);if(_0x5b3398[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x220a99[_0xe6d9('0x41')]=_[_0xe6d9('0x42')](_0x220a99[_0xe6d9('0x41')],{'$or':_['map'](_0x5f1050,function(_0x30ab20){if(_0x30ab20[_0xe6d9('0x32')]!=='VIRTUAL'){var _0x1a39f1={};_0x1a39f1[_0x30ab20[_0xe6d9('0x2b')]]={'$like':'%'+_0x5b3398[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0x1a39f1;}})});}_0x220a99=_['merge']({},_0x220a99,_0x5b3398['options']);var _0x1eb037={'where':_0x220a99[_0xe6d9('0x41')]};return db[_0xe6d9('0x30')]['count'](_0x1eb037)[_0xe6d9('0x13')](function(_0x5a8927){_0x197f82[_0xe6d9('0x22')]=_0x5a8927;if(_0x5b3398[_0xe6d9('0x35')][_0xe6d9('0x43')]){_0x220a99[_0xe6d9('0x44')]=[{'all':!![]}];}return db[_0xe6d9('0x30')]['findAll'](_0x220a99);})[_0xe6d9('0x13')](function(_0x50aae3){_0x197f82['rows']=_0x50aae3;return _0x197f82;})['then'](respondWithFilteredResult(_0xbb445b,_0x220a99))['catch'](handleError(_0xbb445b,null));};exports[_0xe6d9('0x45')]=function(_0x582eb8,_0x559807){var _0x114017={'raw':![],'where':{'id':_0x582eb8['params']['id']},'include':[{'model':db[_0xe6d9('0x2d')],'as':_0xe6d9('0x2e')}]},_0x1a19dc={};_0x1a19dc[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db[_0xe6d9('0x30')][_0xe6d9('0x46')]);_0x1a19dc[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x582eb8[_0xe6d9('0x35')]);_0x1a19dc['filters']=_[_0xe6d9('0x38')](_0x1a19dc[_0xe6d9('0x34')],_0x1a19dc[_0xe6d9('0x35')]);_0x114017['attributes']=_['intersection'](_0x1a19dc[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x582eb8[_0xe6d9('0x35')][_0xe6d9('0x3a')]));_0x114017[_0xe6d9('0x39')]=_0x114017[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x114017[_0xe6d9('0x39')]:_0x1a19dc[_0xe6d9('0x34')];if(_0x582eb8[_0xe6d9('0x35')]['includeAll']){_0x114017[_0xe6d9('0x44')]=[{'all':!![]}];}_0x114017=_[_0xe6d9('0x42')]({},_0x114017,_0x582eb8['options']);return db[_0xe6d9('0x30')][_0xe6d9('0x47')](_0x114017)[_0xe6d9('0x13')](handleEntityNotFound(_0x559807,null))[_0xe6d9('0x13')](respondWithResult(_0x559807,null))[_0xe6d9('0x48')](handleError(_0x559807,null));};exports[_0xe6d9('0x49')]=function(_0x1b2933,_0x315f39){return db[_0xe6d9('0x30')][_0xe6d9('0x49')](_0x1b2933['body'],{})[_0xe6d9('0x13')](function(_0xecff66){var _0x2e8368=_0x1b2933[_0xe6d9('0x4a')]['get']({'plain':!![]});if(!_0x2e8368)throw new Error(_0xe6d9('0x4b'));if(_0x2e8368[_0xe6d9('0x4c')]===_0xe6d9('0x4a')){var _0x49b3b0=_0xecff66['get']({'plain':!![]});var _0x4a21ca='ChatWebsites';return db['UserProfileSection'][_0xe6d9('0x47')]({'where':{'name':_0x4a21ca,'userProfileId':_0x2e8368['userProfileId']},'raw':!![]})[_0xe6d9('0x13')](function(_0x24a304){if(_0x24a304&&_0x24a304[_0xe6d9('0x4d')]===0x0){return db[_0xe6d9('0x29')][_0xe6d9('0x49')]({'name':_0x49b3b0[_0xe6d9('0x2b')],'resourceId':_0x49b3b0['id'],'type':_0x24a304[_0xe6d9('0x2b')],'sectionId':_0x24a304['id']},{})[_0xe6d9('0x13')](function(){return _0xecff66;});}else{return _0xecff66;}})[_0xe6d9('0x48')](function(_0x342e2f){logger[_0xe6d9('0x19')](_0xe6d9('0x4e'),_0x342e2f);throw _0x342e2f;});}return _0xecff66;})['then'](respondWithResult(_0x315f39,0xc9))[_0xe6d9('0x48')](handleError(_0x315f39,null));};exports['update']=function(_0x14996d,_0x4cc184){if(_0x14996d[_0xe6d9('0x4f')]['id']){delete _0x14996d['body']['id'];}return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x14996d[_0xe6d9('0x50')]['id']},'include':[{'model':db[_0xe6d9('0x2d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4cc184,null))[_0xe6d9('0x13')](saveUpdates(_0x14996d['body'],null))['then'](respondWithResult(_0x4cc184,null))['catch'](handleError(_0x4cc184,null));};exports[_0xe6d9('0x26')]=function(_0x5af88a,_0x453984){return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x5af88a[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x453984,null))['then'](removeEntity(_0x453984,null))['catch'](handleError(_0x453984,null));};exports['describe']=function(_0x59f42e,_0xbaf2ea){return db[_0xe6d9('0x30')][_0xe6d9('0x51')]()[_0xe6d9('0x13')](respondWithResult(_0xbaf2ea,null))['catch'](handleError(_0xbaf2ea,null));};exports[_0xe6d9('0x52')]=function(_0x3cdf54,_0x2c00c3){if(_0x3cdf54['body']['id']){delete _0x3cdf54['body']['id'];}return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x3cdf54[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x2c00c3,null))['then'](function(_0x27db03){if(_0x27db03){_0x3cdf54['body'][_0xe6d9('0x53')]=_0x27db03['id'];return db[_0xe6d9('0x54')][_0xe6d9('0x49')](_0x3cdf54[_0xe6d9('0x4f')]);}})[_0xe6d9('0x13')](respondWithResult(_0x2c00c3,null))['catch'](handleError(_0x2c00c3,null));};exports[_0xe6d9('0x55')]=function(_0x1014b5,_0x152de5){var _0x664a3d={'raw':![],'where':{}};var _0x14f2a0={};var _0x1d6415={'count':0x0,'rows':[]};return db[_0xe6d9('0x30')]['findOne']({'where':{'id':_0x1014b5['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x152de5,null))[_0xe6d9('0x13')](function(_0x562b3d){if(_0x562b3d){_0x14f2a0[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db[_0xe6d9('0x54')][_0xe6d9('0x46')]);_0x14f2a0[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x1014b5[_0xe6d9('0x35')]);_0x14f2a0[_0xe6d9('0x37')]=_[_0xe6d9('0x38')](_0x14f2a0[_0xe6d9('0x34')],_0x14f2a0[_0xe6d9('0x35')]);_0x664a3d[_0xe6d9('0x39')]=_['intersection'](_0x14f2a0[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x1014b5['query'][_0xe6d9('0x3a')]));_0x664a3d[_0xe6d9('0x39')]=_0x664a3d[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x664a3d[_0xe6d9('0x39')]:_0x14f2a0[_0xe6d9('0x34')];if(!_0x1014b5[_0xe6d9('0x35')][_0xe6d9('0x56')](_0xe6d9('0x3c'))){_0x664a3d[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x1014b5[_0xe6d9('0x35')][_0xe6d9('0x3d')]);_0x664a3d[_0xe6d9('0x20')]=qs[_0xe6d9('0x20')](_0x1014b5['query'][_0xe6d9('0x20')]);}_0x664a3d[_0xe6d9('0x3e')]=qs['sort'](_0x1014b5[_0xe6d9('0x35')][_0xe6d9('0x3f')]);_0x664a3d['where']=qs[_0xe6d9('0x37')](_[_0xe6d9('0x57')](_0x1014b5['query'],_0x14f2a0[_0xe6d9('0x37')]));_0x664a3d[_0xe6d9('0x41')][_0xe6d9('0x53')]=_0x562b3d['id'];if(_0x1014b5[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x664a3d[_0xe6d9('0x41')]=_['merge'](_0x664a3d[_0xe6d9('0x41')],{'$or':_[_0xe6d9('0x2f')](_0x664a3d[_0xe6d9('0x39')],function(_0x398f86){var _0x1286db={};_0x1286db[_0x398f86]={'$like':'%'+_0x1014b5[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0x1286db;})});}_0x664a3d=_['merge']({},_0x664a3d,_0x1014b5['options']);return db[_0xe6d9('0x54')][_0xe6d9('0x22')]({'where':_0x664a3d[_0xe6d9('0x41')]})[_0xe6d9('0x13')](function(_0x30585b){_0x1d6415[_0xe6d9('0x22')]=_0x30585b;if(_0x1014b5['query']['includeAll']){_0x664a3d[_0xe6d9('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xe6d9('0x58')](_0x664a3d);})[_0xe6d9('0x13')](function(_0x5f4829){_0x1d6415[_0xe6d9('0x59')]=_0x5f4829;return _0x1d6415;});}})[_0xe6d9('0x13')](respondWithFilteredResult(_0x152de5,_0x664a3d))[_0xe6d9('0x48')](handleError(_0x152de5,null));};exports[_0xe6d9('0x5a')]=function(_0x561cfa,_0x50cf4f){return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x561cfa[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x50cf4f,null))[_0xe6d9('0x13')](function(_0x2e65f9){if(_0x2e65f9){return _0x2e65f9[_0xe6d9('0x5a')](_0x561cfa[_0xe6d9('0x35')][_0xe6d9('0x5b')]);}})[_0xe6d9('0x13')](respondWithStatusCode(_0x50cf4f,null))[_0xe6d9('0x48')](handleError(_0x50cf4f,null));};exports['addAnswer']=function(_0x22b30b,_0x51efa5){if(_0x22b30b[_0xe6d9('0x4f')]['id']){delete _0x22b30b[_0xe6d9('0x4f')]['id'];}return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x22b30b[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x51efa5,null))[_0xe6d9('0x13')](function(_0x15f592){if(_0x15f592){_0x22b30b[_0xe6d9('0x4f')][_0xe6d9('0x53')]=_0x15f592['id'];return db[_0xe6d9('0x5c')][_0xe6d9('0x49')](_0x22b30b[_0xe6d9('0x4f')]);}})['then'](respondWithResult(_0x51efa5,null))[_0xe6d9('0x48')](handleError(_0x51efa5,null));};exports[_0xe6d9('0x5d')]=function(_0x4b1145,_0x5d2a2b){var _0x59c8a2={'raw':![],'where':{}};var _0x5559c6={};var _0x976f18={'count':0x0,'rows':[]};return db[_0xe6d9('0x30')][_0xe6d9('0x5e')]({'where':{'id':_0x4b1145['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x5d2a2b,null))[_0xe6d9('0x13')](function(_0x572112){if(_0x572112){_0x5559c6['model']=_[_0xe6d9('0x36')](db[_0xe6d9('0x5c')][_0xe6d9('0x46')]);_0x5559c6['query']=_[_0xe6d9('0x36')](_0x4b1145[_0xe6d9('0x35')]);_0x5559c6[_0xe6d9('0x37')]=_['intersection'](_0x5559c6[_0xe6d9('0x34')],_0x5559c6[_0xe6d9('0x35')]);_0x59c8a2[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0x5559c6[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x3a')]));_0x59c8a2['attributes']=_0x59c8a2[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x59c8a2['attributes']:_0x5559c6[_0xe6d9('0x34')];if(!_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x56')](_0xe6d9('0x3c'))){_0x59c8a2[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x3d')]);_0x59c8a2['offset']=qs[_0xe6d9('0x20')](_0x4b1145[_0xe6d9('0x35')]['offset']);}_0x59c8a2[_0xe6d9('0x3e')]=qs['sort'](_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x3f')]);_0x59c8a2[_0xe6d9('0x41')]=qs[_0xe6d9('0x37')](_['pick'](_0x4b1145[_0xe6d9('0x35')],_0x5559c6[_0xe6d9('0x37')]));_0x59c8a2[_0xe6d9('0x41')][_0xe6d9('0x53')]=_0x572112['id'];if(_0x4b1145['query'][_0xe6d9('0x40')]){_0x59c8a2['where']=_[_0xe6d9('0x42')](_0x59c8a2['where'],{'$or':_[_0xe6d9('0x2f')](_0x59c8a2['attributes'],function(_0x55f138){var _0x30625c={};_0x30625c[_0x55f138]={'$like':'%'+_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0x30625c;})});}_0x59c8a2=_['merge']({},_0x59c8a2,_0x4b1145[_0xe6d9('0x5f')]);return db[_0xe6d9('0x5c')]['count']({'where':_0x59c8a2[_0xe6d9('0x41')]})[_0xe6d9('0x13')](function(_0xb8789a){_0x976f18[_0xe6d9('0x22')]=_0xb8789a;if(_0x4b1145[_0xe6d9('0x35')][_0xe6d9('0x43')]){_0x59c8a2[_0xe6d9('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe6d9('0x58')](_0x59c8a2);})[_0xe6d9('0x13')](function(_0x24295d){_0x976f18['rows']=_0x24295d;return _0x976f18;});}})['then'](respondWithFilteredResult(_0x5d2a2b,_0x59c8a2))[_0xe6d9('0x48')](handleError(_0x5d2a2b,null));};exports['removeAnswers']=function(_0x36b9ff,_0x14deaf){return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x36b9ff[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x14deaf,null))[_0xe6d9('0x13')](function(_0x501a22){if(_0x501a22){return _0x501a22[_0xe6d9('0x60')](_0x36b9ff[_0xe6d9('0x35')][_0xe6d9('0x5b')]);}})[_0xe6d9('0x13')](respondWithStatusCode(_0x14deaf,null))[_0xe6d9('0x48')](handleError(_0x14deaf,null));};exports[_0xe6d9('0x61')]=function(_0x45fe71,_0x19e0de){_0x45fe71[_0xe6d9('0x4f')]['sitepic']=_0x45fe71[_0xe6d9('0x62')][_0xe6d9('0x63')];return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x45fe71[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x19e0de,null))[_0xe6d9('0x13')](saveUpdates(_0x45fe71[_0xe6d9('0x4f')],null))['then'](respondWithResult(_0x19e0de,null))[_0xe6d9('0x48')](handleError(_0x19e0de,null));};exports[_0xe6d9('0x64')]=function(_0x3b5d42,_0x331ee4){_0x3b5d42[_0xe6d9('0x4f')]['agentAvatar']=_0x3b5d42[_0xe6d9('0x62')][_0xe6d9('0x63')];return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x3b5d42[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x331ee4,null))[_0xe6d9('0x13')](saveUpdates(_0x3b5d42[_0xe6d9('0x4f')],null))['then'](respondWithResult(_0x331ee4,null))[_0xe6d9('0x48')](handleError(_0x331ee4,null));};exports[_0xe6d9('0x65')]=function(_0x5eca3d,_0x3b8e68){_0x5eca3d['body'][_0xe6d9('0x66')]=_0x5eca3d[_0xe6d9('0x62')][_0xe6d9('0x63')];return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x5eca3d['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x3b8e68,null))[_0xe6d9('0x13')](saveUpdates(_0x5eca3d[_0xe6d9('0x4f')],null))[_0xe6d9('0x13')](respondWithResult(_0x3b8e68,null))[_0xe6d9('0x48')](handleError(_0x3b8e68,null));};exports['addSystemAvatar']=function(_0x542658,_0x436b64){_0x542658[_0xe6d9('0x4f')][_0xe6d9('0x67')]=_0x542658[_0xe6d9('0x62')][_0xe6d9('0x63')];return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x542658['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x436b64,null))[_0xe6d9('0x13')](saveUpdates(_0x542658[_0xe6d9('0x4f')],null))[_0xe6d9('0x13')](respondWithResult(_0x436b64,null))[_0xe6d9('0x48')](handleError(_0x436b64,null));};exports[_0xe6d9('0x68')]=function(_0x520bd0,_0x1b6904){var _0x1d8fe9=path['join'](config[_0xe6d9('0x69')],_0xe6d9('0x6a'));var _0x448dae={'where':{'id':_0x520bd0[_0xe6d9('0x50')]['id']},'attributes':['id',_0xe6d9('0x6b')],'raw':!![]};var _0x52ab6a=![];return require(_0xe6d9('0x6c'))['getLicense']()[_0xe6d9('0x13')](function(_0x162295){if(_0x162295){_0x52ab6a=_0x162295[_0xe6d9('0x6d')];}})[_0xe6d9('0x13')](function(){return db[_0xe6d9('0x30')]['find'](_0x448dae);})['then'](handleEntityNotFound(_0x1b6904,null))['then'](function(_0x56cb85){if(_0x56cb85){if(!_['isNil'](_0x56cb85[_0xe6d9('0x6b')])){if(fs[_0xe6d9('0x6e')](path['join'](config[_0xe6d9('0x69')],_0xe6d9('0x6f'),_0x56cb85[_0xe6d9('0x6b')]))&&_0x52ab6a){_0x1d8fe9=path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0x6f'),_0x56cb85[_0xe6d9('0x6b')]);}}return _0x1b6904['download'](_0x1d8fe9);}})[_0xe6d9('0x48')](handleError(_0x1b6904,null));};exports[_0xe6d9('0x71')]=function(_0xef9dcb,_0x4dc161){var _0x44069e=path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0x72'));var _0xf94210={'where':{'id':_0xef9dcb['params']['id']},'attributes':['id',_0xe6d9('0x73')],'raw':!![]};return db[_0xe6d9('0x30')]['find'](_0xf94210)[_0xe6d9('0x13')](handleEntityNotFound(_0x4dc161,null))['then'](function(_0xb9d1a7){if(_0xb9d1a7){if(!_['isNil'](_0xb9d1a7[_0xe6d9('0x73')])){if(fs[_0xe6d9('0x6e')](path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0x74'),_0xb9d1a7['agentAvatar']))){_0x44069e=path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0x74'),_0xb9d1a7[_0xe6d9('0x73')]);}}return _0x4dc161['download'](_0x44069e);}})['catch'](handleError(_0x4dc161,null));};exports[_0xe6d9('0x75')]=function(_0x3224ba,_0x308782){var _0x14f51d=path[_0xe6d9('0x70')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x396da2={'where':{'id':_0x3224ba['params']['id']},'attributes':['id',_0xe6d9('0x66'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xe6d9('0x47')](_0x396da2)[_0xe6d9('0x13')](handleEntityNotFound(_0x308782,null))[_0xe6d9('0x13')](function(_0xc48ea1){if(_0xc48ea1){if(!_[_0xe6d9('0x76')](_0xc48ea1[_0xe6d9('0x66')])){if(fs[_0xe6d9('0x6e')](path[_0xe6d9('0x70')](config['root'],'server/files/images/avatars/',_0xc48ea1[_0xe6d9('0x66')]))&&_0xc48ea1[_0xe6d9('0x77')]){_0x14f51d=path['join'](config[_0xe6d9('0x69')],'server/files/images/avatars/',_0xc48ea1['customerAvatar']);}}return _0x308782[_0xe6d9('0x78')](_0x14f51d);}})[_0xe6d9('0x48')](handleError(_0x308782,null));};exports[_0xe6d9('0x79')]=function(_0x491330,_0x5a6b52){var _0x540413=path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0x7a'));var _0x5e95ae={'where':{'id':_0x491330[_0xe6d9('0x50')]['id']},'attributes':['id',_0xe6d9('0x67')],'raw':!![]};return db['ChatWebsite'][_0xe6d9('0x47')](_0x5e95ae)[_0xe6d9('0x13')](handleEntityNotFound(_0x5a6b52,null))['then'](function(_0x517c32){if(_0x517c32){if(!_[_0xe6d9('0x76')](_0x517c32[_0xe6d9('0x67')])){if(fs['existsSync'](path['join'](config['root'],_0xe6d9('0x74'),_0x517c32[_0xe6d9('0x67')]))){_0x540413=path[_0xe6d9('0x70')](config['root'],_0xe6d9('0x74'),_0x517c32[_0xe6d9('0x67')]);}}return _0x5a6b52[_0xe6d9('0x78')](_0x540413);}})[_0xe6d9('0x48')](handleError(_0x5a6b52,null));};exports[_0xe6d9('0x7b')]=function(_0x545200,_0x2ee29e){var _0x3a717b=require(_0xe6d9('0x7c'));var _0x5d2f3a=new _0x3a717b();var _0x288782=_0x5d2f3a[_0xe6d9('0x7d')](_0x545200[_0xe6d9('0x7e')][_0xe6d9('0x7f')])[_0xe6d9('0x80')]();var _0x47b148={'body':_0x545200[_0xe6d9('0x4f')],'channel':_0xe6d9('0x81')};var _0x46308e=[];var _0x5872f7=[];var _0x162f92={};var _0x2de9fd=![];return db[_0xe6d9('0x82')][_0xe6d9('0x51')]()[_0xe6d9('0x13')](function(_0x578194){if(!_0x578194){throw new db['Sequelize'][(_0xe6d9('0x83'))](_0xe6d9('0x84'));}_0x46308e=_[_0xe6d9('0x85')](_[_0xe6d9('0x36')](_0x578194),[_0xe6d9('0x86'),_0xe6d9('0x87')]);_0x5872f7=_[_0xe6d9('0x85')](_[_0xe6d9('0x36')](_0x578194),[_0xe6d9('0x86'),_0xe6d9('0x87'),'CompanyId',_0xe6d9('0x88')]);if(_0x545200['body']['id']){delete _0x545200[_0xe6d9('0x4f')]['id'];}if(_[_0xe6d9('0x76')](_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x89')])){throw new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))]('from\x20is\x20mandatory');}if(_[_0xe6d9('0x76')](_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x4f')])||_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x4f')]===''){throw new db['Sequelize'][(_0xe6d9('0x83'))](_0xe6d9('0x8b'));}if(_[_0xe6d9('0x76')](_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x8c')])){throw new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0x8d')+_0x5872f7);}if(!_[_0xe6d9('0x8e')](_0x5872f7,_0x545200['body']['mapKey'])){throw new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0x8f')+_0x5872f7);}_0x162f92[_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x8c')]]=_0x545200['body'][_0xe6d9('0x89')];})['then'](function(){return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x545200[_0xe6d9('0x50')]['id']},'include':[{'model':db[_0xe6d9('0x90')],'as':_0xe6d9('0x91'),'include':[{'model':db[_0xe6d9('0x82')],'as':_0xe6d9('0x92'),'where':_0x162f92,'limit':0x1,'order':[[_0xe6d9('0x87'),_0xe6d9('0x93')]]}]},{'model':db[_0xe6d9('0x94')],'as':_0xe6d9('0x95')}]});})[_0xe6d9('0x13')](handleEntityNotFound(_0x2ee29e,null))[_0xe6d9('0x13')](function(_0x3fa156){if(_0x3fa156&&_0x3fa156[_0xe6d9('0x91')]){_0x47b148['account']=_0x3fa156;_0x47b148[_0xe6d9('0x96')]=_0x3fa156[_0xe6d9('0x95')];_0x47b148[_0xe6d9('0x97')]=_0x3fa156[_0xe6d9('0x91')];_0x47b148[_0xe6d9('0x96')]=_['orderBy'](_0x47b148['applications'],[_0xe6d9('0x98')],[_0xe6d9('0x99')]);if(_0x47b148['account'][_0xe6d9('0x95')]){delete _0x47b148['account'][_0xe6d9('0x95')];}if(_0x47b148['account'][_0xe6d9('0x91')]&&_0x47b148[_0xe6d9('0x9a')]['List']['Contacts']['length']){return _0x47b148['account'][_0xe6d9('0x91')]['Contacts'][0x0];}var _0x9b369d=_[_0xe6d9('0xc')](_0x545200[_0xe6d9('0x4f')],{'firstName':_0x545200[_0xe6d9('0x4f')]['from'],'ListId':_0x3fa156[_0xe6d9('0x88')]});_0x9b369d[_0x545200['body'][_0xe6d9('0x8c')]]=_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x89')];return db[_0xe6d9('0x82')][_0xe6d9('0x49')](_0x9b369d,{'fields':_0x46308e,'raw':!![]});}})[_0xe6d9('0x13')](handleEntityNotFound(_0x2ee29e,null))[_0xe6d9('0x13')](function(_0x5eff11){_0x47b148[_0xe6d9('0x9b')]=_0x5eff11;var _0x23fdfd=_0x545200[_0xe6d9('0x4f')]['customerIp'];if(_0x545200[_0xe6d9('0x7e')][_0xe6d9('0x9c')]){_0x23fdfd=_0x545200[_0xe6d9('0x7e')]['cf-connecting-ip'];}else if(_0x545200['headers'][_0xe6d9('0x9d')]){_0x23fdfd=_[_0xe6d9('0x9e')](_0x545200[_0xe6d9('0x7e')][_0xe6d9('0x9d')]['split'](','));}if(_0x5eff11){var _0x396932={'ContactId':_0x5eff11['id'],'ChatWebsiteId':_0x545200[_0xe6d9('0x50')]['id'],'from':(_0x5eff11['firstName']||'')+'\x20'+(_0x5eff11[_0xe6d9('0x9f')]||''),'customerIp':_0x23fdfd,'customerPort':_0x545200[_0xe6d9('0x7e')][_0xe6d9('0xa0')]?_0x545200[_0xe6d9('0x7e')][_0xe6d9('0xa0')]:null,'referer':_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xa1')],'browserName':_0x288782[_0xe6d9('0xa2')][_0xe6d9('0x2b')]&&_0x288782['browser'][_0xe6d9('0xa3')]?util[_0xe6d9('0xa4')]('%s\x20%s',_0x288782['browser'][_0xe6d9('0x2b')],_0x288782[_0xe6d9('0xa2')][_0xe6d9('0xa3')]):'unknown','browserVersion':_0x288782[_0xe6d9('0xa2')][_0xe6d9('0xa3')]||_0xe6d9('0xa5'),'osName':util['format']('%s\x20%s',_0x288782['os'][_0xe6d9('0x2b')],_0x288782['os'][_0xe6d9('0xa3')]),'osVersion':_0x288782['os'][_0xe6d9('0xa3')],'deviceModel':_0x288782[_0xe6d9('0xa6')][_0xe6d9('0x34')]&&_0x288782[_0xe6d9('0xa6')][_0xe6d9('0xa7')]?util[_0xe6d9('0xa4')]('%s\x20%s\x20%s',_0x288782[_0xe6d9('0xa6')][_0xe6d9('0x34')],_0x288782[_0xe6d9('0xa6')]['vendor'],_0x288782['device'][_0xe6d9('0x32')]):null,'deviceVendor':_0x288782[_0xe6d9('0xa6')][_0xe6d9('0xa7')],'deviceType':_0x288782[_0xe6d9('0xa6')][_0xe6d9('0x32')],'formData':JSON[_0xe6d9('0x18')](_0x545200[_0xe6d9('0x4f')])};var _0x579245={'ChatWebsiteId':_0x545200[_0xe6d9('0x50')]['id'],'closed':![]};if(_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xa8')]){_0x579245[_0xe6d9('0xa8')]=_0x545200['body'][_0xe6d9('0xa8')];return db[_0xe6d9('0xa9')][_0xe6d9('0x47')]({'where':_0x579245})[_0xe6d9('0x13')](function(_0x5e20dd){if(_0x5e20dd){return[_0x5e20dd,![]];}_0x396932[_0xe6d9('0xa8')]=_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xa8')];_0x396932['externalUrl']=_0x545200['body'][_0xe6d9('0xaa')];return db[_0xe6d9('0xa9')][_0xe6d9('0x49')](_0x396932)['then'](function(_0x42ae1e){return[_0x42ae1e,!![]];});});}_0x579245[_0xe6d9('0xab')]=_0x5eff11['id'];if(_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xac')]&&_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xac')]['id']){_0x579245['id']=_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xac')]['id'];return db[_0xe6d9('0xa9')][_0xe6d9('0x47')]({'where':_0x579245})['then'](function(_0x4a1cab){if(_0x4a1cab){return[_0x4a1cab,![]];}return db['ChatInteraction'][_0xe6d9('0x49')](_0x396932)[_0xe6d9('0x13')](function(_0x58fbca){return[_0x58fbca,!![]];});});}return db[_0xe6d9('0xa9')][_0xe6d9('0x49')](_0x396932)['then'](function(_0x208917){return[_0x208917,!![]];});}})['spread'](function(_0x47477b,_0x136aac){if(_0x47477b){_0x2de9fd=_0x136aac;if(!_0x136aac){var _0x186063={'from':(_0x47b148['contact'][_0xe6d9('0xad')]||'')+'\x20'+(_0x47b148['contact'][_0xe6d9('0x9f')]||'')};if(_0x545200['body'][_0xe6d9('0xa8')]&&_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xae')]&&_0x545200[_0xe6d9('0x4f')]['threadId']!=_0x545200['body']['messageId']){_0x186063['threadId']=_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xae')];}return _0x47477b['update'](_0x186063);}else{return _0x47477b;}}})['then'](function(_0x582535){_0x47b148['interaction']=_0x582535[_0xe6d9('0x27')]({'plain':!![]});_0x47b148[_0xe6d9('0xac')][_0xe6d9('0xaf')]=_0x2de9fd;if(_0x47b148[_0xe6d9('0xac')]['created']){if(_0x47b148[_0xe6d9('0x9a')]['autoclose']){_0x47b148[_0xe6d9('0x96')][_0xe6d9('0xb0')]({'id':0x0,'priority':_0x47b148[_0xe6d9('0x96')][_0xe6d9('0x3b')]+0x1,'app':_0xe6d9('0xb1'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xe6d9('0xb2')][_0xe6d9('0x49')]({'body':_0x545200[_0xe6d9('0x4f')][_0xe6d9('0x4f')],'ChatWebsiteId':_0x545200['params']['id'],'ChatInteractionId':_0x582535['id'],'direction':'in','ContactId':_0x47b148[_0xe6d9('0x9b')]['id'],'AttachmentId':_0x545200[_0xe6d9('0x4f')][_0xe6d9('0xb3')]});})[_0xe6d9('0x13')](function(_0x3c9247){_0x47b148[_0xe6d9('0x1b')]=_0x3c9247;if(_0x47b148[_0xe6d9('0xac')][_0xe6d9('0xb4')]){return db['User']['find']({'attributes':['id',_0xe6d9('0x2b')],'where':{'id':_0x47b148[_0xe6d9('0xac')][_0xe6d9('0xb4')]}})['then'](function(_0x177c2f){if(_0x177c2f){_0x47b148[_0xe6d9('0x96')][_0xe6d9('0xb5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x177c2f[_0xe6d9('0x2b')]+','+(_0x47b148[_0xe6d9('0x9a')][_0xe6d9('0xb6')]||0xa),'interval':_0xe6d9('0xb7')});_0x47b148[_0xe6d9('0xb8')]=!![];}return respondWithRpcPromise('Start',_0xe6d9('0xb9'),_0x47b148);});}return respondWithRpcPromise(_0xe6d9('0xba'),_0xe6d9('0xb9'),_0x47b148);})[_0xe6d9('0x13')](function(_0x2ff776){respondWithRpcPromise(_0xe6d9('0xbb'),_0xe6d9('0xbb'),{'event':'notify','message':_0x2ff776},client9002);return _0x2ff776;})[_0xe6d9('0x13')](respondWithResult(_0x2ee29e,null))[_0xe6d9('0x48')](handleError(_0x2ee29e,null));};exports[_0xe6d9('0xbc')]=function(_0x5ca0d2,_0x336ae5){var _0x4a32e5,_0x58953a,_0x1ec06d;var _0x432317=[];var _0x23ab2b={};var _0x2cba15=_0x5ca0d2[_0xe6d9('0xbd')]||[];var _0x300f75=[];var _0x587d1c;return db[_0xe6d9('0x82')]['describe']()[_0xe6d9('0x13')](function(_0x3070a3){if(!_0x3070a3){throw new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0x84'));}_0x432317=_['difference'](_[_0xe6d9('0x36')](_0x3070a3),[_0xe6d9('0x86'),_0xe6d9('0x87'),'CompanyId',_0xe6d9('0x88')]);if(_0x5ca0d2[_0xe6d9('0x4f')]['id']){delete _0x5ca0d2[_0xe6d9('0x4f')]['id'];}if(_[_0xe6d9('0x76')](_0x5ca0d2['body'][_0xe6d9('0x89')])){throw _0x336ae5[_0xe6d9('0x1e')](0x1f4)['send'](new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0xbe')));}if(_[_0xe6d9('0x76')](_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0x4f')])||_0x5ca0d2['body'][_0xe6d9('0x4f')]===''){throw _0x336ae5[_0xe6d9('0x1e')](0x1f4)[_0xe6d9('0x2c')](new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0x8b')));}if(_[_0xe6d9('0x76')](_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0xbf')])){throw _0x336ae5[_0xe6d9('0x1e')](0x1f4)[_0xe6d9('0x2c')](new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x432317));}if(!_[_0xe6d9('0x8e')](_0x432317,_0x5ca0d2[_0xe6d9('0x4f')]['mapKeyOffline'])){throw _0x336ae5[_0xe6d9('0x1e')](0x1f4)['send'](new db[(_0xe6d9('0x8a'))][(_0xe6d9('0x83'))](_0xe6d9('0xc0')+_0x432317));}_0x23ab2b[_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0xbf')]]=_0x5ca0d2[_0xe6d9('0x4f')]['from'];})[_0xe6d9('0x13')](function(){return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x5ca0d2[_0xe6d9('0x50')]['id']},'include':[{'model':db[_0xe6d9('0x90')],'as':'List'},{'model':db[_0xe6d9('0xc1')],'as':_0xe6d9('0xc1')}]});})[_0xe6d9('0x13')](handleEntityNotFound(_0x336ae5,null))['then'](function(_0x1a91a1){if(_0x1a91a1&&_0x1a91a1[_0xe6d9('0x91')]){_0x58953a=_0x1a91a1;var _0x124bd7=_[_0xe6d9('0xc')](_0x5ca0d2[_0xe6d9('0x4f')],{'firstName':_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0x89')],'phone':_0x5ca0d2['body']['from'],'ListId':_0x1a91a1['ListId']});_0x124bd7[_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0xbf')]]=_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0x89')];return db[_0xe6d9('0x82')]['findOrCreate']({'where':_0x23ab2b,'defaults':_0x124bd7});}})[_0xe6d9('0xc2')](function(_0x280473){if(_0x280473){_0x1ec06d=_0x280473;var _0x2d88b0=fs[_0xe6d9('0xc3')](path[_0xe6d9('0x70')](config[_0xe6d9('0x69')],_0xe6d9('0xc4')),_0xe6d9('0xc5'));var _0xf0a82e=ejs['render'](_0x2d88b0,{'body':_[_0xe6d9('0xc6')](_0x5ca0d2[_0xe6d9('0x4f')][_0xe6d9('0x4f')]),'bodyTitle':_0x58953a[_0xe6d9('0xc7')]});return db[_0xe6d9('0xc8')][_0xe6d9('0x49')]({'body':_0xf0a82e,'plainBody':htmlToText[_0xe6d9('0xc9')](_0xf0a82e),'ContactId':_0x280473['id'],'ChatWebsiteId':_0x58953a['id']});}})[_0xe6d9('0x13')](function(_0x5d97d4){_0x587d1c=_0x5d97d4;if(_0x2cba15[_0xe6d9('0x3b')]){var _0x9030d7=_0x2cba15['map'](function(_0x4d688c){return{'name':_0x4d688c['originalname'],'basename':_0x4d688c[_0xe6d9('0x63')],'type':_0x4d688c[_0xe6d9('0xca')],'ChatOfflineMessageId':_0x5d97d4['id']};});_0x300f75=_0x9030d7[_0xe6d9('0x2f')](_0x27fd90=>{var _0x5e77b9={'filename':_0x27fd90[_0xe6d9('0x2b')],'path':path[_0xe6d9('0x70')](config['root'],'server','files','attachments',_0xe6d9('0xcb'),_0x27fd90[_0xe6d9('0xcc')])};return _0x5e77b9;});if(!_0x58953a[_0xe6d9('0xcd')]){return db[_0xe6d9('0xce')][_0xe6d9('0xcf')](function(_0xa1bf44){return db[_0xe6d9('0xd0')][_0xe6d9('0xd1')](_0x9030d7,{'transaction':_0xa1bf44});});}}})[_0xe6d9('0x13')](function(){if(_0x587d1c){_0x4a32e5=_0x587d1c;return db['MailAccount'][_0xe6d9('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0xe6d9('0xd2')],'as':_0xe6d9('0xd3'),'raw':!![],'include':[{'model':db[_0xe6d9('0xd4')],'as':_0xe6d9('0xd4'),'raw':!![]}]}]});}})['then'](function(_0x28f4bf){if(_0x28f4bf&&_0x28f4bf[_0xe6d9('0xd3')]&&_0x58953a[_0xe6d9('0xd5')]&&_0x58953a[_0xe6d9('0xd6')]){var _0x4fc51a=_0x28f4bf[_0xe6d9('0xd7')]();return respondWithRpcPromise(_0xe6d9('0xd8'),_0xe6d9('0xd9'),{'account':_0x4fc51a,'message':{'from':util[_0xe6d9('0xa4')]('\x22%s\x22\x20<%s>',_0x28f4bf[_0xe6d9('0x2b')],_0x28f4bf[_0xe6d9('0xda')]||_0x28f4bf[_0xe6d9('0xd3')][_0xe6d9('0x4a')]),'to':_0x58953a[_0xe6d9('0xd6')],'subject':_0x58953a['offlineMessageSubject'],'html':_0x4a32e5[_0xe6d9('0x4f')],'attachments':_0x300f75}},client9003)[_0xe6d9('0x13')](function(){return _0x4a32e5;})[_0xe6d9('0x48')](function(_0x970cc7){logger['error'](_0x970cc7);});}})[_0xe6d9('0x13')](function(){if(_0x58953a&&_0x58953a[_0xe6d9('0xcd')]&&_0x58953a[_0xe6d9('0xdb')]){var _0x31187e=[];if(_0x2cba15[_0xe6d9('0x3b')]){_0x31187e=_0x2cba15[_0xe6d9('0x2f')](function(_0x442331){return{'name':_0x442331[_0xe6d9('0xdc')],'basename':_0x442331['filename'],'type':_0x442331[_0xe6d9('0xca')],'ChatOfflineMessageId':_0x587d1c['id']};});}var _0x31567f;if(!_['isNil'](_0x58953a[_0xe6d9('0xdd')])){var _0x375f10=_[_0xe6d9('0x2f')](_0x5ca0d2[_0xe6d9('0x4f')],function(_0x2afeee){return _0x2afeee;});var _0x103b5c=_[_0xe6d9('0xde')](_0x375f10)[0x0];var _0x5bf20a=_[_0xe6d9('0xdf')](_0x103b5c,function(_0x529cc0){return _0x529cc0;});_0x31567f=_0x5bf20a[0x1][_0x58953a[_0xe6d9('0xdd')]];}var _0x2ec4a8={'from':_0x1ec06d['email'],'firstName':_0x1ec06d[_0xe6d9('0xad')],'lastName':_0x1ec06d['lastName'],'mapKey':'email','message':{'from':_0x1ec06d[_0xe6d9('0xda')],'to':_0x58953a[_0xe6d9('0xc1')]['email'],'cc':'','subject':_[_0xe6d9('0x76')](_0x31567f)?_0x58953a[_0xe6d9('0xe0')]:_0x31567f,'messageId':'','sentAt':new Date(),'attach':_0x31187e['length'],'attachments':_0x31187e,'originChannel':'Chat','ChatWebsiteId':_0x58953a['id'],'ChatOfflineMessageId':_0x4a32e5['id'],'originTo':_0x58953a[_0xe6d9('0xc1')]['email']},'body':_0x4a32e5[_0xe6d9('0x4f')]};var _0x23b8c7={'account':{'id':_0x58953a[_0xe6d9('0xdb')]},'body':_0x2ec4a8,'log':_0xe6d9('0xe1')};return respondWithRpcPromise('NotifyMailAccount',_0xe6d9('0xe2'),_0x23b8c7,client9001)['then'](function(){return _0x4a32e5;})[_0xe6d9('0x48')](function(_0x54fc0c){logger['error'](_0x54fc0c);});}return;})['then'](function(){if(_0x4a32e5){return _0x4a32e5;}})[_0xe6d9('0x13')](respondWithResult(_0x336ae5,null))[_0xe6d9('0x48')](function(_0xe00e7c){logger['error'](_0xe6d9('0x48'),_0xe00e7c);for(var _0x588efc of _0x2cba15){var _0x304d7f=path['join'](config[_0xe6d9('0x69')],'server',_0xe6d9('0xbd'),_0xe6d9('0xe3'),_0xe6d9('0xcb'),_0x588efc[_0xe6d9('0x63')]);fs_extra['remove'](_0x304d7f)[_0xe6d9('0x48')](function(_0x4b5b24){logger[_0xe6d9('0x19')](_0xe6d9('0xe4'),_0x304d7f,_0x4b5b24);});}});};exports[_0xe6d9('0xe5')]=function(_0x57c94a,_0x328a11){return db[_0xe6d9('0xa9')][_0xe6d9('0x47')]({'where':{'id':_0x57c94a[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x328a11,null))[_0xe6d9('0x13')](function(_0x583802){if(_0x583802){return _0x583802[_0xe6d9('0xe5')](_0x57c94a[_0xe6d9('0x4f')][_0xe6d9('0x5b')],_[_0xe6d9('0xe6')](_0x57c94a['body'],[_0xe6d9('0x5b'),'id'])||{});}})[_0xe6d9('0x13')](respondWithResult(_0x328a11,null))['catch'](handleError(_0x328a11,null));};exports[_0xe6d9('0xe7')]=function(_0x45277e,_0x5d68d5){var _0x332ad1={'raw':![],'where':{}};var _0x103eaf={};var _0x22e87f={'count':0x0,'rows':[]};return db[_0xe6d9('0x30')][_0xe6d9('0x5e')]({'where':{'id':_0x45277e[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x5d68d5,null))[_0xe6d9('0x13')](function(_0xcccb1c){if(_0xcccb1c){_0x103eaf[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db[_0xe6d9('0xa9')][_0xe6d9('0x46')]);_0x103eaf[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x45277e[_0xe6d9('0x35')]);_0x103eaf[_0xe6d9('0x37')]=_[_0xe6d9('0x38')](_0x103eaf[_0xe6d9('0x34')],_0x103eaf[_0xe6d9('0x35')]);_0x332ad1[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0x103eaf[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x45277e['query'][_0xe6d9('0x3a')]));_0x332ad1['attributes']=_0x332ad1[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x332ad1[_0xe6d9('0x39')]:_0x103eaf[_0xe6d9('0x34')];if(!_0x45277e[_0xe6d9('0x35')][_0xe6d9('0x56')]('nolimit')){_0x332ad1[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x45277e[_0xe6d9('0x35')][_0xe6d9('0x3d')]);_0x332ad1[_0xe6d9('0x20')]=qs['offset'](_0x45277e[_0xe6d9('0x35')][_0xe6d9('0x20')]);}_0x332ad1[_0xe6d9('0x3e')]=qs['sort'](_0x45277e['query']['sort']);_0x332ad1[_0xe6d9('0x41')]=qs[_0xe6d9('0x37')](_[_0xe6d9('0x57')](_0x45277e[_0xe6d9('0x35')],_0x103eaf[_0xe6d9('0x37')]));_0x332ad1[_0xe6d9('0x41')][_0xe6d9('0x53')]=_0xcccb1c['id'];if(_0x45277e[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x332ad1['where']=_['merge'](_0x332ad1['where'],{'$or':_[_0xe6d9('0x2f')](_0x332ad1[_0xe6d9('0x39')],function(_0xabe9e8){var _0x59a3fd={};_0x59a3fd[_0xabe9e8]={'$like':'%'+_0x45277e['query'][_0xe6d9('0x40')]+'%'};return _0x59a3fd;})});}_0x332ad1=_[_0xe6d9('0x42')]({},_0x332ad1,_0x45277e[_0xe6d9('0x5f')]);return db[_0xe6d9('0xa9')][_0xe6d9('0x22')]({'where':_0x332ad1[_0xe6d9('0x41')]})[_0xe6d9('0x13')](function(_0x4dcf2d){_0x22e87f[_0xe6d9('0x22')]=_0x4dcf2d;if(_0x45277e[_0xe6d9('0x35')][_0xe6d9('0x43')]){_0x332ad1[_0xe6d9('0x44')]=[{'model':db[_0xe6d9('0x82')],'as':_0xe6d9('0xe8'),'required':![]},{'model':db[_0xe6d9('0xe9')],'as':_0xe6d9('0xea'),'attributes':[_0xe6d9('0x2b'),_0xe6d9('0xeb'),'internal'],'required':![]},{'model':db[_0xe6d9('0xec')],'as':_0xe6d9('0xed'),'attributes':['id','name',_0xe6d9('0xee')],'where':_0x45277e[_0xe6d9('0x35')][_0xe6d9('0xef')]?{'id':_0x45277e[_0xe6d9('0x35')][_0xe6d9('0xef')]}:undefined,'required':_0x45277e[_0xe6d9('0x35')]['tag']?!![]:![]}];}return db[_0xe6d9('0xa9')][_0xe6d9('0x58')](_0x332ad1);})[_0xe6d9('0x13')](function(_0x543921){_0x22e87f[_0xe6d9('0x59')]=_0x543921;return _0x22e87f;});}})['then'](respondWithFilteredResult(_0x5d68d5,_0x332ad1))[_0xe6d9('0x48')](handleError(_0x5d68d5,null));};function iftimePromise(_0x471cbe,_0x1fcfd1){return respondWithRpcPromise(_0xe6d9('0xf0'),_0xe6d9('0xf1'),{'command':_0x1fcfd1[_0xe6d9('0xf2')]?util[_0xe6d9('0xa4')](_0xe6d9('0xf3'),_0x471cbe[_0xe6d9('0xf4')],_0x1fcfd1[_0xe6d9('0xf2')]):util[_0xe6d9('0xa4')](_0xe6d9('0xf5'),_0x471cbe[_0xe6d9('0xf4')])},client9002)['then'](function(_0x7eb158){var _0x3d3b4a=_0x7eb158&&_0x7eb158['indexOf'](_0xe6d9('0xf6'))>=0x0?!![]:![];logger['info'](_0xe6d9('0xf7'),_0x1fcfd1['id'],_0x471cbe['id'],_0x471cbe[_0xe6d9('0xf4')],_0x3d3b4a?_0xe6d9('0xf8'):'OFFLINE',_0x1fcfd1['timezone']?_0x1fcfd1[_0xe6d9('0xf2')]:_0xe6d9('0xf9'));return _0x3d3b4a;})[_0xe6d9('0x48')](function(_0x5f580e){logger[_0xe6d9('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1fcfd1['id'],_0x471cbe['id'],_0x471cbe[_0xe6d9('0xf4')],util[_0xe6d9('0xfa')](_0x5f580e,{'showHidden':![],'depth':null}),_0x1fcfd1[_0xe6d9('0xf2')]?_0x1fcfd1[_0xe6d9('0xf2')]:_0xe6d9('0xf9'));return![];});}exports[_0xe6d9('0xf1')]=function(_0xeb36fa,_0x279a3c){var _0x286fbd=0x0;var _0x376625=0x0;var _0x3154b6=![];var _0x2c5a5b;var _0xffed10;return db[_0xe6d9('0x30')]['find']({'where':{'id':_0xeb36fa['params']['id']},'include':[{'model':db[_0xe6d9('0xfb')],'as':_0xe6d9('0xfb'),'include':[{'model':db[_0xe6d9('0xfb')],'as':_0xe6d9('0xfc'),'attributes':['id',_0xe6d9('0xf4')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x279a3c,null))[_0xe6d9('0x13')](function(_0x1d6b06){if(_0x1d6b06){_0x2c5a5b=_0x1d6b06;return _0x1d6b06['getProactiveActions']({'raw':!![]});}})['then'](function(_0x40d1cf){if(_0x2c5a5b){if(_0x40d1cf){_0xffed10=_0x40d1cf;}}return require(_0xe6d9('0x6c'))['getLicense']();})[_0xe6d9('0x13')](function(_0x383c22){if(_0x383c22){_0x376625=_0x383c22['virtual'];_0x3154b6=_0x383c22[_0xe6d9('0x6d')];}})[_0xe6d9('0x13')](function(){return db[_0xe6d9('0xa9')][_0xe6d9('0x22')]({'where':{'closed':![]}});})[_0xe6d9('0x13')](function(_0x88d71a){_0x286fbd=_0x88d71a;if(_0x376625&&_0x88d71a>_0x376625){return db[_0xe6d9('0xfd')]['findOne']({'where':{'id':0x1}})['then'](function(_0x51dc70){if(_0x51dc70){_0x51dc70[_0xe6d9('0xfe')](_0xe6d9('0xff'));}});}})['then'](function(){if(_0x2c5a5b[_0xe6d9('0xfb')]&&_0x2c5a5b[_0xe6d9('0xfb')][_0xe6d9('0xfc')]){var _0x32122b=[];for(var _0x43273d=0x0;_0x43273d<_0x2c5a5b[_0xe6d9('0xfb')][_0xe6d9('0xfc')][_0xe6d9('0x3b')];_0x43273d++){var _0x96f3e5=_0x2c5a5b['Interval']['Intervals'][_0x43273d]['get']({'plain':!![]});_0x32122b[_0xe6d9('0xb0')](iftimePromise(_0x96f3e5,_0x2c5a5b));}return BPromise[_0xe6d9('0x100')](_0x32122b)[_0xe6d9('0x13')](function(_0x3cf029){return _[_0xe6d9('0x101')](_0x3cf029);});}else{return!![];}})[_0xe6d9('0x13')](function(_0x5d4f33){var _0x44f32c=fs[_0xe6d9('0xc3')](path[_0xe6d9('0x70')](config['root'],_0xe6d9('0x102')),_0xe6d9('0xc5'));var _0xcba026={'remote':_0x2c5a5b[_0xe6d9('0x103')],'query':querystring[_0xe6d9('0x18')](_[_0xe6d9('0x42')](_0x2c5a5b[_0xe6d9('0x27')]({'plain':!![]}),{'customerIp':_0xeb36fa[_0xe6d9('0x7e')][_0xe6d9('0x9d')]||_0xeb36fa[_0xe6d9('0x7e')]['x-real-ip']||_0xeb36fa[_0xe6d9('0x104')][_0xe6d9('0x105')]||_0xeb36fa['ip'],'referer':_0xeb36fa[_0xe6d9('0x7e')][_0xe6d9('0xa1')],'openedInteractions':_0x286fbd,'maxInteractions':_0x376625,'virtual':_0x3154b6[_0xe6d9('0x106')],'online':_0x5d4f33,'custom':_0x3154b6}))[_0xe6d9('0x107')](/'/g,'\x5c\x27')};_0x279a3c[_0xe6d9('0x2c')](ejs[_0xe6d9('0x108')](Mustache[_0xe6d9('0x108')](_0x44f32c,_0xcba026),{'proactiveActions':_0xffed10,'alignment':_0x2c5a5b[_0xe6d9('0x109')],'verticalAlignment':_0x2c5a5b[_0xe6d9('0x10a')],'div_color':_0x2c5a5b[_0xe6d9('0xee')],'labelText':_0x2c5a5b[_0xe6d9('0x10b')],'text_color':_0x2c5a5b[_0xe6d9('0x10c')],'text_button_color':_0x2c5a5b[_0xe6d9('0x10d')],'button_color':_0x2c5a5b[_0xe6d9('0x10e')],'background_color':_0x2c5a5b['backgroundColor'],'hideWhenOffline':_0x2c5a5b[_0xe6d9('0x10f')],'interval':_0x2c5a5b['IntervalId']}));})[_0xe6d9('0x48')](handleError(_0x279a3c,null));};exports[_0xe6d9('0x110')]=function(_0x257e08,_0x1c9171){var _0x32be6c=_0x257e08[_0xe6d9('0x50')]['id'];var _0x3fce15=_0x257e08[_0xe6d9('0x4f')];var _0xc5e27e=0xc8;var _0x52065f=null;return db[_0xe6d9('0xce')][_0xe6d9('0xcf')]({'isolationLevel':db[_0xe6d9('0xce')][_0xe6d9('0x111')][_0xe6d9('0x112')][_0xe6d9('0x113')]},function(_0x18976b){return db[_0xe6d9('0x30')]['findOne']({'where':{'id':_0x32be6c},'transaction':_0x18976b})[_0xe6d9('0x13')](function(_0xc4b43a){if(_0xc4b43a){return db[_0xe6d9('0x94')][_0xe6d9('0x26')]({'where':{'ChatWebsiteId':_0x32be6c},'transaction':_0x18976b})[_0xe6d9('0x13')](function(){var _0x22031a=_[_0xe6d9('0x2f')](_0x3fce15,function(_0x3cfb4d){_0x3cfb4d['ChatWebsiteId']=_0x32be6c;return _0x3cfb4d;});return db[_0xe6d9('0x94')][_0xe6d9('0xd1')](_0x22031a,{'transaction':_0x18976b});});}else{_0xc5e27e=0x194;_0x52065f=[];}});})[_0xe6d9('0x13')](function(){if(_0xc5e27e!==0x194){return db[_0xe6d9('0x94')][_0xe6d9('0x114')]({'where':{'ChatWebsiteId':_0x32be6c},'order':_0xe6d9('0x98')})['then'](function(_0x4c98c7){_0x52065f=_0x4c98c7;});}})[_0xe6d9('0x48')](function(_0x15072f){_0xc5e27e=0x1f4;logger[_0xe6d9('0x19')](_0x15072f[_0xe6d9('0x2a')]);if(_0x15072f[_0xe6d9('0x2b')]){delete _0x15072f['name'];}_0x52065f=_0x15072f;})[_0xe6d9('0x115')](function(){if(_0x52065f===null){_0x1c9171[_0xe6d9('0x1c')](_0xc5e27e);}else{if(_0xc5e27e===0x1f4){_0x1c9171[_0xe6d9('0x1e')](_0xc5e27e)[_0xe6d9('0x2c')](_0x52065f);}else{_0x1c9171['status'](_0xc5e27e)[_0xe6d9('0x1f')](_0x52065f);}}});};exports[_0xe6d9('0x116')]=function(_0x433449,_0x287bbd){var _0x1c6c1d={};var _0x3fc712={};var _0x48c6ab;var _0x3c5767;return db[_0xe6d9('0x30')][_0xe6d9('0x5e')]({'where':{'id':_0x433449[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x287bbd,null))[_0xe6d9('0x13')](function(_0x925caa){if(_0x925caa){_0x48c6ab=_0x925caa;_0x3fc712['model']=_[_0xe6d9('0x36')](db['ChatApplication'][_0xe6d9('0x46')]);_0x3fc712[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x433449['query']);_0x3fc712[_0xe6d9('0x37')]=_[_0xe6d9('0x38')](_0x3fc712[_0xe6d9('0x34')],_0x3fc712[_0xe6d9('0x35')]);_0x1c6c1d['attributes']=_[_0xe6d9('0x38')](_0x3fc712[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x433449['query'][_0xe6d9('0x3a')]));_0x1c6c1d['attributes']=_0x1c6c1d['attributes'][_0xe6d9('0x3b')]?_0x1c6c1d[_0xe6d9('0x39')]:_0x3fc712[_0xe6d9('0x34')];_0x1c6c1d[_0xe6d9('0x3e')]=qs[_0xe6d9('0x3f')](_0x433449['query'][_0xe6d9('0x3f')]);_0x1c6c1d['where']=qs[_0xe6d9('0x37')](_[_0xe6d9('0x57')](_0x433449[_0xe6d9('0x35')],_0x3fc712[_0xe6d9('0x37')]));if(_0x433449['query'][_0xe6d9('0x40')]){_0x1c6c1d[_0xe6d9('0x41')]=_['merge'](_0x1c6c1d[_0xe6d9('0x41')],{'$or':_[_0xe6d9('0x2f')](_0x1c6c1d[_0xe6d9('0x39')],function(_0x1dd0ff){var _0xea49f0={};_0xea49f0[_0x1dd0ff]={'$like':'%'+_0x433449[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0xea49f0;})});}_0x1c6c1d=_[_0xe6d9('0x42')]({},_0x1c6c1d,_0x433449['options']);return _0x48c6ab['getApplications'](_0x1c6c1d);}})[_0xe6d9('0x13')](function(_0x1f4f00){if(_0x1f4f00){_0x3c5767=_0x1f4f00[_0xe6d9('0x3b')];if(!_0x433449[_0xe6d9('0x35')]['hasOwnProperty'](_0xe6d9('0x3c'))){_0x1c6c1d[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x433449[_0xe6d9('0x35')]['limit']);_0x1c6c1d[_0xe6d9('0x20')]=qs['offset'](_0x433449[_0xe6d9('0x35')][_0xe6d9('0x20')]);}return _0x48c6ab[_0xe6d9('0x116')](_0x1c6c1d);}})[_0xe6d9('0x13')](function(_0x441b1d){if(_0x441b1d){return _0x441b1d?{'count':_0x3c5767,'rows':_0x441b1d}:null;}})[_0xe6d9('0x13')](respondWithResult(_0x287bbd,null))[_0xe6d9('0x48')](handleError(_0x287bbd,null));};exports[_0xe6d9('0x117')]=function(_0x15df45,_0x4a9ac0){return db[_0xe6d9('0x118')][_0xe6d9('0x47')]({'where':{'id':_0x15df45[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x4a9ac0,null))[_0xe6d9('0x13')](function(_0x29f510){if(_0x29f510){return _0x29f510[_0xe6d9('0x117')](_0x15df45[_0xe6d9('0x4f')][_0xe6d9('0x5b')],_[_0xe6d9('0xe6')](_0x15df45[_0xe6d9('0x4f')],[_0xe6d9('0x5b'),'id'])||{});}})[_0xe6d9('0x13')](respondWithResult(_0x4a9ac0,null))[_0xe6d9('0x48')](handleError(_0x4a9ac0,null));};exports[_0xe6d9('0x119')]=function(_0x276bc9,_0x17de6a){var _0x3b59ec={};var _0xfabbff={};var _0x4a7bdd;var _0x3bfdf9;return db['ChatWebsite'][_0xe6d9('0x5e')]({'where':{'id':_0x276bc9['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x17de6a,null))[_0xe6d9('0x13')](function(_0x397aaa){if(_0x397aaa){_0x4a7bdd=_0x397aaa;_0xfabbff[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db[_0xe6d9('0x11a')][_0xe6d9('0x46')]);_0xfabbff['query']=_[_0xe6d9('0x36')](_0x276bc9['query']);_0xfabbff[_0xe6d9('0x37')]=_['intersection'](_0xfabbff[_0xe6d9('0x34')],_0xfabbff[_0xe6d9('0x35')]);_0x3b59ec[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0xfabbff[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x276bc9[_0xe6d9('0x35')]['fields']));_0x3b59ec[_0xe6d9('0x39')]=_0x3b59ec[_0xe6d9('0x39')][_0xe6d9('0x3b')]?_0x3b59ec[_0xe6d9('0x39')]:_0xfabbff[_0xe6d9('0x34')];_0x3b59ec[_0xe6d9('0x3e')]=qs[_0xe6d9('0x3f')](_0x276bc9[_0xe6d9('0x35')][_0xe6d9('0x3f')]);_0x3b59ec[_0xe6d9('0x41')]=qs[_0xe6d9('0x37')](_[_0xe6d9('0x57')](_0x276bc9[_0xe6d9('0x35')],_0xfabbff[_0xe6d9('0x37')]));if(_0x276bc9[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x3b59ec[_0xe6d9('0x41')]=_[_0xe6d9('0x42')](_0x3b59ec['where'],{'$or':_[_0xe6d9('0x2f')](_0x3b59ec[_0xe6d9('0x39')],function(_0x276ad4){var _0x16f95c={};_0x16f95c[_0x276ad4]={'$like':'%'+_0x276bc9[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0x16f95c;})});}_0x3b59ec=_[_0xe6d9('0x42')]({},_0x3b59ec,_0x276bc9[_0xe6d9('0x5f')]);return _0x4a7bdd[_0xe6d9('0x119')](_0x3b59ec);}})[_0xe6d9('0x13')](function(_0x2e4f13){if(_0x2e4f13){_0x3bfdf9=_0x2e4f13['length'];if(!_0x276bc9[_0xe6d9('0x35')][_0xe6d9('0x56')](_0xe6d9('0x3c'))){_0x3b59ec['limit']=qs[_0xe6d9('0x3d')](_0x276bc9['query'][_0xe6d9('0x3d')]);_0x3b59ec[_0xe6d9('0x20')]=qs[_0xe6d9('0x20')](_0x276bc9['query'][_0xe6d9('0x20')]);}return _0x4a7bdd[_0xe6d9('0x119')](_0x3b59ec);}})['then'](function(_0x3e96a4){if(_0x3e96a4){return _0x3e96a4?{'count':_0x3bfdf9,'rows':_0x3e96a4}:null;}})[_0xe6d9('0x13')](respondWithResult(_0x17de6a,null))[_0xe6d9('0x48')](handleError(_0x17de6a,null));};exports['getFields']=function(_0x4b9979,_0x5927bc){var _0x53ecbe=_0x4b9979[_0xe6d9('0x35')]['online']===_0xe6d9('0x11b')?_0xe6d9('0x11c'):'onlineForm';return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'attributes':['id',_0x53ecbe],'where':{'id':_0x4b9979['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x5927bc,null))[_0xe6d9('0x13')](function(_0x3f08da){if(_0x3f08da){var _0x3fcc1c=_0x3f08da[_0x53ecbe];var _0x379959=_0x3fcc1c&&_0x3fcc1c[_0xe6d9('0x11d')]?_0x3fcc1c['items']:[];_0x5927bc[_0xe6d9('0x2c')]({'fromKey':_[_0xe6d9('0x76')](_0x3fcc1c[_0xe6d9('0x11e')])?undefined:_0x3fcc1c[_0xe6d9('0x11e')],'count':_0x379959[_0xe6d9('0x3b')],'rows':_0x379959});}})[_0xe6d9('0x48')](handleError(_0x5927bc,null));};exports[_0xe6d9('0x11f')]=function(_0x199ee3,_0x21bf74){var _0x2ce0c9={'raw':![],'where':{}};var _0x3626dc={};var _0x4fa95b={'count':0x0,'rows':[]};return db[_0xe6d9('0x30')][_0xe6d9('0x5e')]({'where':{'id':_0x199ee3[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x21bf74,null))['then'](function(_0x188857){if(_0x188857){_0x3626dc[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db[_0xe6d9('0xc8')][_0xe6d9('0x46')]);_0x3626dc[_0xe6d9('0x35')]=_['keys'](_0x199ee3[_0xe6d9('0x35')]);_0x3626dc[_0xe6d9('0x37')]=_['intersection'](_0x3626dc[_0xe6d9('0x34')],_0x3626dc['query']);_0x2ce0c9[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0x3626dc[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x199ee3['query'][_0xe6d9('0x3a')]));_0x2ce0c9[_0xe6d9('0x39')]=_0x2ce0c9['attributes']['length']?_0x2ce0c9[_0xe6d9('0x39')]:_0x3626dc['model'];if(!_0x199ee3['query'][_0xe6d9('0x56')](_0xe6d9('0x3c'))){_0x2ce0c9[_0xe6d9('0x3d')]=qs['limit'](_0x199ee3[_0xe6d9('0x35')]['limit']);_0x2ce0c9['offset']=qs[_0xe6d9('0x20')](_0x199ee3[_0xe6d9('0x35')]['offset']);}_0x2ce0c9['order']=qs['sort'](_0x199ee3['query'][_0xe6d9('0x3f')]);_0x2ce0c9[_0xe6d9('0x41')]=qs[_0xe6d9('0x37')](_['pick'](_0x199ee3[_0xe6d9('0x35')],_0x3626dc[_0xe6d9('0x37')]));_0x2ce0c9[_0xe6d9('0x41')]['ChatWebsiteId']=_0x188857['id'];if(_0x199ee3[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x2ce0c9[_0xe6d9('0x41')]=_[_0xe6d9('0x42')](_0x2ce0c9[_0xe6d9('0x41')],{'$or':_[_0xe6d9('0x2f')](_0x2ce0c9['attributes'],function(_0x421f80){var _0x485a27={};_0x485a27[_0x421f80]={'$like':'%'+_0x199ee3[_0xe6d9('0x35')][_0xe6d9('0x40')]+'%'};return _0x485a27;})});}_0x2ce0c9=_['merge']({},_0x2ce0c9,_0x199ee3[_0xe6d9('0x5f')]);return db[_0xe6d9('0xc8')]['count']({'where':_0x2ce0c9[_0xe6d9('0x41')]})[_0xe6d9('0x13')](function(_0x5d66f2){_0x4fa95b[_0xe6d9('0x22')]=_0x5d66f2;if(_0x199ee3[_0xe6d9('0x35')][_0xe6d9('0x43')]){_0x2ce0c9['include']=[{'all':!![]}];}else{_0x2ce0c9[_0xe6d9('0x44')]=[{'model':db[_0xe6d9('0x82')],'as':'Contact','required':![]},{'model':db[_0xe6d9('0xd0')],'as':_0xe6d9('0x120'),'required':![]}];}return db[_0xe6d9('0xc8')][_0xe6d9('0x58')](_0x2ce0c9);})[_0xe6d9('0x13')](function(_0x1bda9f){_0x4fa95b['rows']=_0x1bda9f;return _0x4fa95b;});}})['then'](respondWithFilteredResult(_0x21bf74,_0x2ce0c9))[_0xe6d9('0x48')](handleError(_0x21bf74,null));};exports['addAgents']=function(_0x4d08df,_0x1232a0){return db[_0xe6d9('0x30')]['find']({'where':{'id':_0x4d08df[_0xe6d9('0x50')]['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x1232a0,null))[_0xe6d9('0x13')](function(_0x4d8819){if(_0x4d8819){return _0x4d8819[_0xe6d9('0x121')](_0x4d08df[_0xe6d9('0x4f')]['ids'],_[_0xe6d9('0xe6')](_0x4d08df[_0xe6d9('0x4f')],[_0xe6d9('0x5b'),'id'])||{})[_0xe6d9('0xc2')](function(_0x528e7b){for(var _0x9d7400=0x0;_0x9d7400<_0x4d08df['body'][_0xe6d9('0x5b')][_0xe6d9('0x3b')];_0x9d7400+=0x1){socket[_0xe6d9('0x122')]('userChatWebsite:save',{'UserId':Number(_0x4d08df[_0xe6d9('0x4f')]['ids'][_0x9d7400]),'ChatWebsiteId':Number(_0x4d08df[_0xe6d9('0x50')]['id'])});}return _0x528e7b;});}})[_0xe6d9('0x13')](respondWithResult(_0x1232a0,null))[_0xe6d9('0x48')](handleError(_0x1232a0,null));};exports[_0xe6d9('0x123')]=function(_0x4c08ac,_0x3925fb){return db[_0xe6d9('0x30')][_0xe6d9('0x47')]({'where':{'id':_0x4c08ac[_0xe6d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3925fb,null))[_0xe6d9('0x13')](function(_0x54c037){if(_0x54c037){return _0x54c037['removeAgents'](_0x4c08ac['query']['ids'])[_0xe6d9('0x13')](function(){if(_[_0xe6d9('0x124')](_0x4c08ac[_0xe6d9('0x35')][_0xe6d9('0x5b')])){for(var _0x3f7201=0x0;_0x3f7201<_0x4c08ac[_0xe6d9('0x35')][_0xe6d9('0x5b')]['length'];_0x3f7201+=0x1){socket['emit'](_0xe6d9('0x125'),{'UserId':Number(_0x4c08ac[_0xe6d9('0x35')][_0xe6d9('0x5b')][_0x3f7201]),'ChatWebsiteId':Number(_0x4c08ac[_0xe6d9('0x50')]['id'])});}}else{socket[_0xe6d9('0x122')](_0xe6d9('0x125'),{'UserId':Number(_0x4c08ac[_0xe6d9('0x35')]['ids']),'ChatWebsiteId':Number(_0x4c08ac[_0xe6d9('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3925fb,null))[_0xe6d9('0x48')](handleError(_0x3925fb,null));};exports[_0xe6d9('0x126')]=function(_0x46778c,_0x274ec5){var _0x20bcd8={};var _0x305dae={};var _0x484349;var _0x1663ed;return db[_0xe6d9('0x30')]['findOne']({'where':{'id':_0x46778c['params']['id']}})[_0xe6d9('0x13')](handleEntityNotFound(_0x274ec5,null))[_0xe6d9('0x13')](function(_0x42f81c){if(_0x42f81c){_0x484349=_0x42f81c;_0x305dae[_0xe6d9('0x34')]=_[_0xe6d9('0x36')](db['User'][_0xe6d9('0x46')]);_0x305dae[_0xe6d9('0x35')]=_[_0xe6d9('0x36')](_0x46778c['query']);_0x305dae[_0xe6d9('0x37')]=_['intersection'](_0x305dae[_0xe6d9('0x34')],_0x305dae[_0xe6d9('0x35')]);_0x20bcd8[_0xe6d9('0x39')]=_[_0xe6d9('0x38')](_0x305dae[_0xe6d9('0x34')],qs[_0xe6d9('0x3a')](_0x46778c[_0xe6d9('0x35')][_0xe6d9('0x3a')]));_0x20bcd8['attributes']=_0x20bcd8[_0xe6d9('0x39')]['length']?_0x20bcd8[_0xe6d9('0x39')]:_0x305dae[_0xe6d9('0x34')];_0x20bcd8[_0xe6d9('0x3e')]=qs[_0xe6d9('0x3f')](_0x46778c[_0xe6d9('0x35')][_0xe6d9('0x3f')]);_0x20bcd8[_0xe6d9('0x41')]=qs[_0xe6d9('0x37')](_[_0xe6d9('0x57')](_0x46778c[_0xe6d9('0x35')],_0x305dae[_0xe6d9('0x37')]));if(_0x46778c[_0xe6d9('0x35')][_0xe6d9('0x40')]){_0x20bcd8['where']=_['merge'](_0x20bcd8[_0xe6d9('0x41')],{'$or':_['map'](_0x20bcd8['attributes'],function(_0x5b0008){var _0x599917={};_0x599917[_0x5b0008]={'$like':'%'+_0x46778c[_0xe6d9('0x35')]['filter']+'%'};return _0x599917;})});}_0x20bcd8=_[_0xe6d9('0x42')]({},_0x20bcd8,_0x46778c[_0xe6d9('0x5f')]);return _0x484349['getAgents'](_0x20bcd8);}})[_0xe6d9('0x13')](function(_0x595da2){if(_0x595da2){_0x1663ed=_0x595da2[_0xe6d9('0x3b')];if(!_0x46778c[_0xe6d9('0x35')][_0xe6d9('0x56')]('nolimit')){_0x20bcd8[_0xe6d9('0x3d')]=qs[_0xe6d9('0x3d')](_0x46778c[_0xe6d9('0x35')][_0xe6d9('0x3d')]);_0x20bcd8[_0xe6d9('0x20')]=qs[_0xe6d9('0x20')](_0x46778c['query'][_0xe6d9('0x20')]);}return _0x484349['getAgents'](_0x20bcd8);}})['then'](function(_0x3bc756){if(_0x3bc756){return _0x3bc756?{'count':_0x1663ed,'rows':_0x3bc756}:null;}})[_0xe6d9('0x13')](respondWithResult(_0x274ec5,null))[_0xe6d9('0x48')](handleError(_0x274ec5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a566238..5f2f84c 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 _0xeb79=['ChatWebsite','save','remove','emit','hook'];(function(_0x57f100,_0xa53aca){var _0x4cac01=function(_0x447061){while(--_0x447061){_0x57f100['push'](_0x57f100['shift']());}};_0x4cac01(++_0xa53aca);}(_0xeb79,0x87));var _0x9eb7=function(_0x1f7070,_0x2c97fc){_0x1f7070=_0x1f7070-0x0;var _0x2d063b=_0xeb79[_0x1f7070];return _0x2d063b;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x9eb7('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9eb7('0x1'),'afterUpdate':'update','afterDestroy':_0x9eb7('0x2')};function emitEvent(_0x47e1e5){return function(_0x3ee5c6,_0x2987e1,_0x385233){ChatWebsiteEvents[_0x9eb7('0x3')](_0x47e1e5+':'+_0x3ee5c6['id'],_0x3ee5c6);ChatWebsiteEvents['emit'](_0x47e1e5,_0x3ee5c6);_0x385233(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9eb7('0x4')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xeec6=['events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0xeec6[_0x25b4a4];return _0x707267;};'use strict';var EventEmitter=require(_0x6eec('0x0'));var ChatWebsite=require(_0x6eec('0x1'))['db'][_0x6eec('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6eec('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6eec('0x4'),'afterDestroy':_0x6eec('0x5')};function emitEvent(_0x1699ce){return function(_0x2d7a15,_0x3e7b6b,_0x2e450c){ChatWebsiteEvents['emit'](_0x1699ce+':'+_0x2d7a15['id'],_0x2d7a15);ChatWebsiteEvents[_0x6eec('0x6')](_0x1699ce,_0x2d7a15);_0x2e450c(null);};}for(var e in events){if(events[_0x6eec('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x6eec('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 8932a4a..210fccc 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 _0x2f0c=['rimraf','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2f0c,0xad));var _0xc2f0=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x2f0c[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0xc2f0('0x0'));var util=require(_0xc2f0('0x1'));var logger=require(_0xc2f0('0x2'))(_0xc2f0('0x3'));var moment=require(_0xc2f0('0x4'));var BPromise=require(_0xc2f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2f0('0x6'));var rimraf=require(_0xc2f0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc2f0('0x8'));module[_0xc2f0('0x9')]=function(_0x16d091,_0x2fa7f8){return _0x16d091[_0xc2f0('0xa')]('ChatWebsite',attributes,{'tableName':_0xc2f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x245b=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4d0d1f,_0x53c5fb){var _0x6845eb=function(_0xa59e1d){while(--_0xa59e1d){_0x4d0d1f['push'](_0x4d0d1f['shift']());}};_0x6845eb(++_0x53c5fb);}(_0x245b,0x119));var _0xb245=function(_0x54b8c4,_0x44c72f){_0x54b8c4=_0x54b8c4-0x0;var _0x50bd7f=_0x245b[_0x54b8c4];return _0x50bd7f;};'use strict';var _=require('lodash');var util=require(_0xb245('0x0'));var logger=require(_0xb245('0x1'))('api');var moment=require(_0xb245('0x2'));var BPromise=require(_0xb245('0x3'));var rp=require(_0xb245('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb245('0x5'));var attributes=require(_0xb245('0x6'));module[_0xb245('0x7')]=function(_0x369b45,_0x43f04f){return _0x369b45[_0xb245('0x8')](_0xb245('0x9'),attributes,{'tableName':_0xb245('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 f17f0c8..a327de5 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 _0x7b4d=['then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatWebsite.socket','request'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7b4d,0x73));var _0xd7b4=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x7b4d[_0x4a29a9];return _0x386570;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd7b4('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd7b4('0x1'));var logger=require(_0xd7b4('0x2'))(_0xd7b4('0x3'));var config=require('../../config/environment');var jayson=require(_0xd7b4('0x4'));var client=jayson[_0xd7b4('0x5')]['http']({'port':0x232a});config[_0xd7b4('0x6')]=_['defaults'](config['redis'],{'host':_0xd7b4('0x7'),'port':0x18eb});var socket=require(_0xd7b4('0x8'))(new Redis(config[_0xd7b4('0x6')]));require(_0xd7b4('0x9'))['register'](socket);function respondWithRpcPromise(_0x44fba0,_0x569308,_0xe391c3){return new BPromise(function(_0x385d8c,_0x51264c){return client[_0xd7b4('0xa')](_0x44fba0,_0xe391c3)[_0xd7b4('0xb')](function(_0x311265){logger[_0xd7b4('0xc')](_0xd7b4('0xd'),_0x569308,_0xd7b4('0xe'));logger['debug'](_0xd7b4('0xf'),_0x569308,_0xd7b4('0xe'),JSON[_0xd7b4('0x10')](_0x311265));if(_0x311265[_0xd7b4('0x11')]){if(_0x311265[_0xd7b4('0x11')][_0xd7b4('0x12')]===0x1f4){logger[_0xd7b4('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x569308,_0x311265[_0xd7b4('0x11')]['message']);return _0x51264c(_0x311265[_0xd7b4('0x11')][_0xd7b4('0x13')]);}logger['error'](_0xd7b4('0xd'),_0x569308,_0x311265[_0xd7b4('0x11')][_0xd7b4('0x13')]);return _0x385d8c(_0x311265[_0xd7b4('0x11')][_0xd7b4('0x13')]);}else{logger[_0xd7b4('0xc')](_0xd7b4('0xd'),_0x569308,_0xd7b4('0xe'));_0x385d8c(_0x311265['result']['message']);}})[_0xd7b4('0x14')](function(_0x139429){logger['error'](_0xd7b4('0xd'),_0x569308,_0x139429);_0x51264c(_0x139429);});});} \ No newline at end of file +var _0x0663=['bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0663,0xcf));var _0x3066=function(_0x51620a,_0x53c8c7){_0x51620a=_0x51620a-0x0;var _0x539150=_0x0663[_0x51620a];return _0x539150;};'use strict';var _=require(_0x3066('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3066('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3066('0x2'))['db'];var utils=require(_0x3066('0x3'));var logger=require(_0x3066('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3066('0x5'));var client=jayson[_0x3066('0x6')][_0x3066('0x7')]({'port':0x232a});config[_0x3066('0x8')]=_[_0x3066('0x9')](config[_0x3066('0x8')],{'host':_0x3066('0xa'),'port':0x18eb});var socket=require(_0x3066('0xb'))(new Redis(config[_0x3066('0x8')]));require(_0x3066('0xc'))[_0x3066('0xd')](socket);function respondWithRpcPromise(_0xff742d,_0x5b11ac,_0x1602cf){return new BPromise(function(_0x13e453,_0x2b508c){return client[_0x3066('0xe')](_0xff742d,_0x1602cf)['then'](function(_0x26c495){logger['info'](_0x3066('0xf'),_0x5b11ac,_0x3066('0x10'));logger[_0x3066('0x11')](_0x3066('0x12'),_0x5b11ac,'request\x20sent',JSON[_0x3066('0x13')](_0x26c495));if(_0x26c495[_0x3066('0x14')]){if(_0x26c495['error'][_0x3066('0x15')]===0x1f4){logger['error'](_0x3066('0xf'),_0x5b11ac,_0x26c495[_0x3066('0x14')][_0x3066('0x16')]);return _0x2b508c(_0x26c495[_0x3066('0x14')][_0x3066('0x16')]);}logger[_0x3066('0x14')](_0x3066('0xf'),_0x5b11ac,_0x26c495[_0x3066('0x14')]['message']);return _0x13e453(_0x26c495[_0x3066('0x14')][_0x3066('0x16')]);}else{logger[_0x3066('0x17')](_0x3066('0xf'),_0x5b11ac,'request\x20sent');_0x13e453(_0x26c495[_0x3066('0x18')][_0x3066('0x16')]);}})[_0x3066('0x19')](function(_0x5d14dc){logger[_0x3066('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x5b11ac,_0x5d14dc);_0x2b508c(_0x5d14dc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index eb14125..00c18b0 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 _0xa84c=['remove','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa84c,0x1d3));var _0xca84=function(_0x44dc4c,_0x357e6a){_0x44dc4c=_0x44dc4c-0x0;var _0x4e644e=_0xa84c[_0x44dc4c];return _0x4e644e;};'use strict';var ChatWebsiteEvents=require(_0xca84('0x0'));var events=['save',_0xca84('0x1'),'update'];function createListener(_0x55e597,_0xd95225){return function(_0x4415a8){_0xd95225['emit'](_0x55e597,_0x4415a8);};}function removeListener(_0x433179,_0xa9a87b){return function(){ChatWebsiteEvents[_0xca84('0x2')](_0x433179,_0xa9a87b);};}exports[_0xca84('0x3')]=function(_0x51c719){for(var _0x5b4295=0x0,_0x53b9ae=events[_0xca84('0x4')];_0x5b4295<_0x53b9ae;_0x5b4295++){var _0x1e8a12=events[_0x5b4295];var _0x3669ca=createListener(_0xca84('0x5')+_0x1e8a12,_0x51c719);ChatWebsiteEvents['on'](_0x1e8a12,_0x3669ca);}}; \ No newline at end of file +var _0x85dc=['register','length','chatWebsite:','./chatWebsite.events','save','update','removeListener'];(function(_0x20f391,_0xed985b){var _0x3cdbc5=function(_0x4c16b8){while(--_0x4c16b8){_0x20f391['push'](_0x20f391['shift']());}};_0x3cdbc5(++_0xed985b);}(_0x85dc,0x65));var _0xc85d=function(_0x188598,_0x512231){_0x188598=_0x188598-0x0;var _0x1f486d=_0x85dc[_0x188598];return _0x1f486d;};'use strict';var ChatWebsiteEvents=require(_0xc85d('0x0'));var events=[_0xc85d('0x1'),'remove',_0xc85d('0x2')];function createListener(_0x4644af,_0x333a52){return function(_0x1c0d49){_0x333a52['emit'](_0x4644af,_0x1c0d49);};}function removeListener(_0x1d3da8,_0x3d27ae){return function(){ChatWebsiteEvents[_0xc85d('0x3')](_0x1d3da8,_0x3d27ae);};}exports[_0xc85d('0x4')]=function(_0x349c2e){for(var _0x5b8a9e=0x0,_0x498a89=events[_0xc85d('0x5')];_0x5b8a9e<_0x498a89;_0x5b8a9e++){var _0x282d89=events[_0x5b8a9e];var _0x12e976=createListener(_0xc85d('0x6')+_0x282d89,_0x349c2e);ChatWebsiteEvents['on'](_0x282d89,_0x12e976);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 99975e5..6eb675c 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 _0x8a1f=['now','originalname','addLogo','/:id/avatar','file','addAvatar','single','addCustomerAvatar','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a1f,0x196));var _0xf8a1=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x8a1f[_0x16e57d];return _0x40239c;};'use strict';var multer=require('multer');var util=require(_0xf8a1('0x0'));var path=require('path');var timeout=require(_0xf8a1('0x1'));var express=require('express');var router=express[_0xf8a1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf8a1('0x3'));var interaction=require(_0xf8a1('0x4'));var config=require(_0xf8a1('0x5'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xf8a1('0x6')](),controller['index']);router[_0xf8a1('0x7')](_0xf8a1('0x8'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x9')]);router[_0xf8a1('0x7')](_0xf8a1('0xa'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0xb')]);router[_0xf8a1('0x7')](_0xf8a1('0xc'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0xd')]);router[_0xf8a1('0x7')](_0xf8a1('0xe'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0xf')]);router[_0xf8a1('0x7')](_0xf8a1('0x10'),controller[_0xf8a1('0x11')]);router['get']('/:id/avatar',controller[_0xf8a1('0x12')]);router[_0xf8a1('0x7')](_0xf8a1('0x13'),controller['getCustomerAvatar']);router[_0xf8a1('0x7')]('/:id/system_avatar',controller[_0xf8a1('0x14')]);router['get'](_0xf8a1('0x15'),auth['isAuthenticated'](),controller[_0xf8a1('0x16')]);router[_0xf8a1('0x7')](_0xf8a1('0x17'),controller[_0xf8a1('0x18')]);router[_0xf8a1('0x7')](_0xf8a1('0x19'),auth['isAuthenticated'](),controller[_0xf8a1('0x1a')]);router['get'](_0xf8a1('0x1b'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x1c')]);router[_0xf8a1('0x7')](_0xf8a1('0x1d'),controller[_0xf8a1('0x1e')]);router[_0xf8a1('0x7')](_0xf8a1('0x1f'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x20')]);router[_0xf8a1('0x7')](_0xf8a1('0x21'),auth[_0xf8a1('0x6')](),controller['getAgents']);router['post']('/',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x22')]);router[_0xf8a1('0x23')](_0xf8a1('0xc'),auth['isAuthenticated'](),controller[_0xf8a1('0x24')]);router[_0xf8a1('0x23')](_0xf8a1('0xe'),auth['isAuthenticated'](),controller[_0xf8a1('0x25')]);var upload=multer({'storage':multer[_0xf8a1('0x26')]({'destination':function(_0x538009,_0x1ca470,_0x472884){_0x472884(null,path[_0xf8a1('0x27')](config[_0xf8a1('0x28')],_0xf8a1('0x29')));},'filename':function(_0x5d2c1a,_0x3b8f00,_0x3ebbe8){_0x3ebbe8(null,util[_0xf8a1('0x2a')](_0xf8a1('0x2b'),Date[_0xf8a1('0x2c')](),_0x3b8f00[_0xf8a1('0x2d')]));}})});router[_0xf8a1('0x23')](_0xf8a1('0x10'),upload['single']('file'),controller[_0xf8a1('0x2e')]);var upload=multer({'storage':multer[_0xf8a1('0x26')]({'destination':function(_0x3db96a,_0x33b5c8,_0x35ca21){_0x35ca21(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x5ea9a2,_0x5dfbc4,_0x25e4f8){_0x25e4f8(null,util['format']('%s-%s',Date[_0xf8a1('0x2c')](),_0x5dfbc4[_0xf8a1('0x2d')]));}})});router[_0xf8a1('0x23')](_0xf8a1('0x2f'),upload['single'](_0xf8a1('0x30')),controller[_0xf8a1('0x31')]);var upload=multer({'storage':multer[_0xf8a1('0x26')]({'destination':function(_0x36d2da,_0x5d7643,_0x431065){_0x431065(null,path[_0xf8a1('0x27')](config[_0xf8a1('0x28')],'server/files/images/avatars/'));},'filename':function(_0x29ae83,_0x4c636a,_0x2c6d56){_0x2c6d56(null,util[_0xf8a1('0x2a')](_0xf8a1('0x2b'),Date[_0xf8a1('0x2c')](),_0x4c636a['originalname']));}})});router[_0xf8a1('0x23')](_0xf8a1('0x13'),upload[_0xf8a1('0x32')](_0xf8a1('0x30')),controller[_0xf8a1('0x33')]);var upload=multer({'storage':multer[_0xf8a1('0x26')]({'destination':function(_0x5591a9,_0x15289e,_0x2bbbba){_0x2bbbba(null,path[_0xf8a1('0x27')](config[_0xf8a1('0x28')],_0xf8a1('0x34')));},'filename':function(_0x213ffe,_0xe3af9,_0x336a44){_0x336a44(null,util[_0xf8a1('0x2a')](_0xf8a1('0x2b'),Date['now'](),_0xe3af9['originalname']));}})});router[_0xf8a1('0x23')](_0xf8a1('0x35'),upload[_0xf8a1('0x32')](_0xf8a1('0x30')),controller[_0xf8a1('0x36')]);router[_0xf8a1('0x23')](_0xf8a1('0x37'),controller[_0xf8a1('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0xf8a1('0x26')]({'destination':function(_0x4b5cad,_0x716262,_0x194f8b){const _0x1f7947=path['join'](config[_0xf8a1('0x28')],_0xf8a1('0x39'),'attachments',_0xf8a1('0x3a'));fs_extra[_0xf8a1('0x3b')](_0x1f7947,function(){_0x194f8b(null,_0x1f7947);});},'filename':function(_0x45da27,_0x1e6959,_0x1335c4){const _0x5c7d32=_0x1e6959[_0xf8a1('0x2d')][_0xf8a1('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1e52ee=path[_0xf8a1('0x3d')](_0x5c7d32);const _0x2ee43c=Date[_0xf8a1('0x2c')]()+'-'+_0x5c7d32[_0xf8a1('0x3c')](_0x1e52ee,'')+_0x1e52ee;_0x1335c4(null,_0x2ee43c);}})});router[_0xf8a1('0x23')](_0xf8a1('0x3e'),offlineUploadMulter[_0xf8a1('0x3f')](),controller[_0xf8a1('0x40')]);router[_0xf8a1('0x23')]('/:id/interactions',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x41')]);router[_0xf8a1('0x23')](_0xf8a1('0x19'),auth[_0xf8a1('0x6')](),controller['addApplications']);router[_0xf8a1('0x23')](_0xf8a1('0x1b'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x42')]);router[_0xf8a1('0x23')]('/:id/users',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x43')]);router[_0xf8a1('0x44')](_0xf8a1('0xa'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x45')]);router[_0xf8a1('0x46')](_0xf8a1('0xa'),auth['isAuthenticated'](),controller[_0xf8a1('0x47')]);router[_0xf8a1('0x46')](_0xf8a1('0xc'),auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x48')]);router[_0xf8a1('0x46')](_0xf8a1('0xe'),auth[_0xf8a1('0x6')](),controller['removeAnswers']);router[_0xf8a1('0x46')]('/:id/users',auth[_0xf8a1('0x6')](),controller[_0xf8a1('0x49')]);module[_0xf8a1('0x4a')]=router; \ No newline at end of file +var _0xdf99=['getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','post','/:id/dispositions','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','single','file','join','root','server/files/images/avatars/','/:id/avatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','/:id/applications','addApplications','/:id/users','addAgents','put','update','/:id','destroy','removeDispositions','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x1d77a1,_0x29dbe4){var _0x1b6fa4=function(_0x41ea43){while(--_0x41ea43){_0x1d77a1['push'](_0x1d77a1['shift']());}};_0x1b6fa4(++_0x29dbe4);}(_0xdf99,0x136));var _0x9df9=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0xdf99[_0x32f26d];return _0x5d9ddc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9df9('0x0'));var timeout=require(_0x9df9('0x1'));var express=require(_0x9df9('0x2'));var router=express[_0x9df9('0x3')]();var fs_extra=require(_0x9df9('0x4'));var auth=require(_0x9df9('0x5'));var interaction=require(_0x9df9('0x6'));var config=require(_0x9df9('0x7'));var controller=require(_0x9df9('0x8'));router[_0x9df9('0x9')]('/',auth[_0x9df9('0xa')](),controller['index']);router['get'](_0x9df9('0xb'),auth[_0x9df9('0xa')](),controller[_0x9df9('0xc')]);router[_0x9df9('0x9')]('/:id',auth[_0x9df9('0xa')](),controller[_0x9df9('0xd')]);router[_0x9df9('0x9')]('/:id/dispositions',auth[_0x9df9('0xa')](),controller[_0x9df9('0xe')]);router[_0x9df9('0x9')](_0x9df9('0xf'),auth['isAuthenticated'](),controller[_0x9df9('0x10')]);router['get'](_0x9df9('0x11'),controller[_0x9df9('0x12')]);router[_0x9df9('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x9df9('0x9')](_0x9df9('0x13'),controller[_0x9df9('0x14')]);router[_0x9df9('0x9')](_0x9df9('0x15'),controller['getSystemAvatar']);router[_0x9df9('0x9')](_0x9df9('0x16'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x17')]);router[_0x9df9('0x9')](_0x9df9('0x18'),controller['getSnippet']);router[_0x9df9('0x9')]('/:id/applications',auth[_0x9df9('0xa')](),controller[_0x9df9('0x19')]);router['get'](_0x9df9('0x1a'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x1b')]);router[_0x9df9('0x9')](_0x9df9('0x1c'),controller[_0x9df9('0x1d')]);router['get'](_0x9df9('0x1e'),auth[_0x9df9('0xa')](),controller['getOfflineMessages']);router[_0x9df9('0x9')]('/:id/users',auth[_0x9df9('0xa')](),controller['getAgents']);router[_0x9df9('0x1f')]('/',auth[_0x9df9('0xa')](),controller['create']);router['post'](_0x9df9('0x20'),auth['isAuthenticated'](),controller[_0x9df9('0x21')]);router[_0x9df9('0x1f')](_0x9df9('0xf'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x22')]);var upload=multer({'storage':multer[_0x9df9('0x23')]({'destination':function(_0x37201c,_0x5f2ad0,_0x3147d1){_0x3147d1(null,path['join'](config['root'],_0x9df9('0x24')));},'filename':function(_0x5b3903,_0x257c48,_0x3ce933){_0x3ce933(null,util[_0x9df9('0x25')](_0x9df9('0x26'),Date[_0x9df9('0x27')](),_0x257c48[_0x9df9('0x28')]));}})});router['post']('/:id/logo',upload[_0x9df9('0x29')](_0x9df9('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0x9df9('0x23')]({'destination':function(_0x24fa9e,_0x21fcc9,_0x2466ad){_0x2466ad(null,path[_0x9df9('0x2b')](config[_0x9df9('0x2c')],_0x9df9('0x2d')));},'filename':function(_0x270e5c,_0x2243a4,_0x5ec081){_0x5ec081(null,util['format']('%s-%s',Date[_0x9df9('0x27')](),_0x2243a4[_0x9df9('0x28')]));}})});router[_0x9df9('0x1f')](_0x9df9('0x2e'),upload[_0x9df9('0x29')](_0x9df9('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0x9df9('0x23')]({'destination':function(_0x3d7660,_0xb961fd,_0x5d07de){_0x5d07de(null,path[_0x9df9('0x2b')](config[_0x9df9('0x2c')],_0x9df9('0x2d')));},'filename':function(_0x394117,_0x532e96,_0x29557a){_0x29557a(null,util[_0x9df9('0x25')](_0x9df9('0x26'),Date['now'](),_0x532e96[_0x9df9('0x28')]));}})});router['post'](_0x9df9('0x13'),upload['single'](_0x9df9('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9df9('0x23')]({'destination':function(_0x2df8b7,_0xb62ea1,_0x1b628c){_0x1b628c(null,path[_0x9df9('0x2b')](config[_0x9df9('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x56c5e4,_0x38c91c,_0x193c36){_0x193c36(null,util[_0x9df9('0x25')](_0x9df9('0x26'),Date[_0x9df9('0x27')](),_0x38c91c[_0x9df9('0x28')]));}})});router[_0x9df9('0x1f')]('/:id/system_avatar',upload[_0x9df9('0x29')]('file'),controller[_0x9df9('0x2f')]);router[_0x9df9('0x1f')]('/:id/notify',controller[_0x9df9('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x9df9('0x23')]({'destination':function(_0x416c46,_0x2c066,_0x4f23ab){const _0x245bb3=path['join'](config[_0x9df9('0x2c')],'server/files',_0x9df9('0x31'),_0x9df9('0x32'));fs_extra[_0x9df9('0x33')](_0x245bb3,function(){_0x4f23ab(null,_0x245bb3);});},'filename':function(_0x508542,_0x3687f7,_0x330c75){const _0xd70db1=_0x3687f7['originalname'][_0x9df9('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x43f99a=path[_0x9df9('0x35')](_0xd70db1);const _0xbc0536=Date['now']()+'-'+_0xd70db1[_0x9df9('0x34')](_0x43f99a,'')+_0x43f99a;_0x330c75(null,_0xbc0536);}})});router[_0x9df9('0x1f')](_0x9df9('0x36'),offlineUploadMulter['any'](),controller['offline']);router[_0x9df9('0x1f')](_0x9df9('0x16'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x37')]);router[_0x9df9('0x1f')](_0x9df9('0x38'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x39')]);router['post'](_0x9df9('0x1a'),auth['isAuthenticated'](),controller['addProactiveActions']);router['post'](_0x9df9('0x3a'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x3b')]);router[_0x9df9('0x3c')]('/:id',auth['isAuthenticated'](),controller[_0x9df9('0x3d')]);router['delete'](_0x9df9('0x3e'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x3f')]);router['delete'](_0x9df9('0x20'),auth[_0x9df9('0xa')](),controller[_0x9df9('0x40')]);router[_0x9df9('0x41')](_0x9df9('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x9df9('0x41')](_0x9df9('0x3a'),auth[_0x9df9('0xa')](),controller['removeAgents']);module[_0x9df9('0x42')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 0d4d9bf..51fd0de 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','use','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x575dd5,_0x5f24fe){var _0x338962=function(_0x1b7f77){while(--_0x1b7f77){_0x575dd5['push'](_0x575dd5['shift']());}};_0x338962(++_0x5f24fe);}(_0xedd9,0xa2));var _0x9edd=function(_0x1bf951,_0x3f59aa){_0x1bf951=_0x1bf951-0x0;var _0x210585=_0xedd9[_0x1bf951];return _0x210585;};var beaverLogger=require(_0x9edd('0x0'));var express=require(_0x9edd('0x1'));var auth=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var isProduction=config[_0x9edd('0x5')]===_0x9edd('0x6')||![];function clientSideLogs(_0x2924ad,_0x20fbcc,_0x50a1d9){var _0x22a52a=_0x2924ad[_0x9edd('0x7')]['get']('client-side-logger');if(!_0x22a52a){throw new Error(_0x9edd('0x8'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x22a52a,'enableCors':!isProduction})(_0x2924ad,_0x20fbcc,_0x50a1d9);}router[_0x9edd('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x9edd('0xa')]=router; \ No newline at end of file +var _0x39c5=['exports','beaver-logger/server','express','../components/auth/service','env','production','app','get','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0x180b14,_0x1bddba){var _0x221f13=function(_0x17742c){while(--_0x17742c){_0x180b14['push'](_0x180b14['shift']());}};_0x221f13(++_0x1bddba);}(_0x39c5,0x1ed));var _0x539c=function(_0x30e092,_0x4c1763){_0x30e092=_0x30e092-0x0;var _0xdd544f=_0x39c5[_0x30e092];return _0xdd544f;};var beaverLogger=require(_0x539c('0x0'));var express=require(_0x539c('0x1'));var auth=require(_0x539c('0x2'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x539c('0x3')]===_0x539c('0x4')||![];function clientSideLogs(_0x370c42,_0x4ebfc8,_0x1fbc77){var _0x42c70a=_0x370c42[_0x539c('0x5')][_0x539c('0x6')](_0x539c('0x7'));if(!_0x42c70a){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x539c('0x8')]({'uri':_0x539c('0x9'),'logger':_0x42c70a,'enableCors':!isProduction})(_0x370c42,_0x4ebfc8,_0x1fbc77);}router[_0x539c('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0x539c('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 05dba74..cb40dba 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 _0x0ee1=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x2fcd6e,_0x365baf){var _0x1277fe=function(_0x33c15f){while(--_0x33c15f){_0x2fcd6e['push'](_0x2fcd6e['shift']());}};_0x1277fe(++_0x365baf);}(_0x0ee1,0x161));var _0x10ee=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x0ee1[_0x7148a3];return _0x52f31d;};'use strict';var Sequelize=require(_0x10ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x10ee('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x10ee('0x2')](_0x10ee('0x3'),_0x10ee('0x4'),_0x10ee('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x10ee('0x2')](_0x10ee('0x6'),_0x10ee('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':_0x10ee('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0x10ee('0x9')},'data3':{'type':Sequelize[_0x10ee('0x1')],'comment':_0x10ee('0xa')},'data4':{'type':Sequelize[_0x10ee('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x10ee('0xb')],'comment':_0x10ee('0xc')},'data6':{'type':Sequelize[_0x10ee('0xb')],'comment':_0x10ee('0xd')},'data7':{'type':Sequelize[_0x10ee('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xa849=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0xc17737,_0x9e6a4b){var _0x3c8d6f=function(_0x18a7e4){while(--_0x18a7e4){_0xc17737['push'](_0xc17737['shift']());}};_0x3c8d6f(++_0x9e6a4b);}(_0xa849,0x180));var _0x9a84=function(_0x11fe62,_0x462b8e){_0x11fe62=_0x11fe62-0x0;var _0x2cd6ed=_0xa849[_0x11fe62];return _0x2cd6ed;};'use strict';var Sequelize=require('sequelize');module[_0x9a84('0x0')]={'name':{'type':Sequelize[_0x9a84('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x9a84('0x2'),'Google',_0x9a84('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9a84('0x4')](_0x9a84('0x5'),_0x9a84('0x6'))},'data1':{'type':Sequelize[_0x9a84('0x1')],'comment':_0x9a84('0x7')},'data2':{'type':Sequelize[_0x9a84('0x1')],'comment':_0x9a84('0x8')},'data3':{'type':Sequelize[_0x9a84('0x1')],'comment':_0x9a84('0x9')},'data4':{'type':Sequelize[_0x9a84('0x1')],'comment':_0x9a84('0xa')},'data5':{'type':Sequelize[_0x9a84('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x9a84('0xc')},'data7':{'type':Sequelize[_0x9a84('0xb')],'comment':_0x9a84('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e501542..94c2ca3 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 _0xb961=['undefined','offset','count','limit','Content-Range','update','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','CloudProvider','includeAll','include','findAll','then','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','find','create','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','status','json'];(function(_0x9bf782,_0x7da9d5){var _0x514b67=function(_0x322a0c){while(--_0x322a0c){_0x9bf782['push'](_0x9bf782['shift']());}};_0x514b67(++_0x7da9d5);}(_0xb961,0x1bf));var _0x1b96=function(_0x799c60,_0x586227){_0x799c60=_0x799c60-0x0;var _0x5efdae=_0xb961[_0x799c60];return _0x5efdae;};'use strict';var _=require(_0x1b96('0x0'));var Redis=require(_0x1b96('0x1'));var qs=require(_0x1b96('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x1b96('0x3'));var logger=require(_0x1b96('0x4'))(_0x1b96('0x5'));var db=require(_0x1b96('0x6'))['db'];var oauth=require(_0x1b96('0x7'));config[_0x1b96('0x8')]=_['defaults'](config[_0x1b96('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b96('0x9'))(new Redis(config[_0x1b96('0x8')]));var redis=new Redis(config[_0x1b96('0x8')]);function respondWithStatusCode(_0x326c66,_0x1ca1be){_0x1ca1be=_0x1ca1be||0xcc;return function(_0x4a415c){if(_0x4a415c){return _0x326c66[_0x1b96('0xa')](_0x1ca1be);}return _0x326c66[_0x1b96('0xb')](_0x1ca1be)['end']();};}function respondWithResult(_0x117ff6,_0x2af079){_0x2af079=_0x2af079||0xc8;return function(_0x2700ac){if(_0x2700ac){return _0x117ff6[_0x1b96('0xb')](_0x2af079)[_0x1b96('0xc')](_0x2700ac);}};}function respondWithFilteredResult(_0x55c240,_0x47ea78){return function(_0x229d99){if(_0x229d99){var _0x5f52a7=typeof _0x47ea78['offset']===_0x1b96('0xd')&&typeof _0x47ea78['limit']===_0x1b96('0xd');var _0x8ef4bf=_0x229d99['count'];var _0xf9a0e9=_0x5f52a7?0x0:_0x47ea78[_0x1b96('0xe')];var _0x54e07c=_0x5f52a7?_0x229d99[_0x1b96('0xf')]:_0x47ea78[_0x1b96('0xe')]+_0x47ea78[_0x1b96('0x10')];var _0x533ac5;if(_0x54e07c>=_0x8ef4bf){_0x54e07c=_0x8ef4bf;_0x533ac5=0xc8;}else{_0x533ac5=0xce;}_0x55c240[_0x1b96('0xb')](_0x533ac5);return _0x55c240['set'](_0x1b96('0x11'),_0xf9a0e9+'-'+_0x54e07c+'/'+_0x8ef4bf)[_0x1b96('0xc')](_0x229d99);}return null;};}function saveUpdates(_0x41e1d6){return function(_0xd83ca2){if(_0xd83ca2){return _0xd83ca2[_0x1b96('0x12')](_0x41e1d6)['then'](function(_0x12ff7d){return _0x12ff7d;});}return null;};}function removeEntity(_0x2dec7a){return function(_0xadd829){if(_0xadd829){return _0xadd829['destroy']()['then'](function(){_0x2dec7a['status'](0xcc)[_0x1b96('0x13')]();});}};}function handleEntityNotFound(_0xfc188f){return function(_0x2813c9){if(!_0x2813c9){_0xfc188f['sendStatus'](0x194);}return _0x2813c9;};}function handleError(_0x346fd5,_0x4778a5){_0x4778a5=_0x4778a5||0x1f4;return function(_0x28deb8){logger[_0x1b96('0x14')](_0x28deb8[_0x1b96('0x15')]);if(_0x28deb8['name']){delete _0x28deb8[_0x1b96('0x16')];}_0x346fd5[_0x1b96('0xb')](_0x4778a5)[_0x1b96('0x17')](_0x28deb8);};}function maskClientSecret(_0x5390f3){return _['padEnd'](_0x5390f3['slice'](0x0,0x3),0x14,'*');}exports[_0x1b96('0x18')]=function(_0x3ec93c,_0x589b40){var _0x155f83={},_0x2cd699={},_0x3b7f03={'count':0x0,'rows':[]};var _0x43851f=_[_0x1b96('0x19')](db['CloudProvider']['rawAttributes'],function(_0x504c93){return{'name':_0x504c93['fieldName'],'type':_0x504c93[_0x1b96('0x1a')][_0x1b96('0x1b')]};});_0x2cd699[_0x1b96('0x1c')]=_[_0x1b96('0x19')](_0x43851f,_0x1b96('0x16'));_0x2cd699[_0x1b96('0x1d')]=_[_0x1b96('0x1e')](_0x3ec93c['query']);_0x2cd699[_0x1b96('0x1f')]=_[_0x1b96('0x20')](_0x2cd699[_0x1b96('0x1c')],_0x2cd699[_0x1b96('0x1d')]);_0x155f83[_0x1b96('0x21')]=_[_0x1b96('0x20')](_0x2cd699[_0x1b96('0x1c')],qs[_0x1b96('0x22')](_0x3ec93c[_0x1b96('0x1d')][_0x1b96('0x22')]));_0x155f83[_0x1b96('0x21')]=_0x155f83[_0x1b96('0x21')][_0x1b96('0x23')]?_0x155f83[_0x1b96('0x21')]:_0x2cd699[_0x1b96('0x1c')];if(!_0x3ec93c[_0x1b96('0x1d')][_0x1b96('0x24')]('nolimit')){_0x155f83['limit']=qs[_0x1b96('0x10')](_0x3ec93c['query'][_0x1b96('0x10')]);_0x155f83[_0x1b96('0xe')]=qs[_0x1b96('0xe')](_0x3ec93c[_0x1b96('0x1d')][_0x1b96('0xe')]);}_0x155f83[_0x1b96('0x25')]=qs[_0x1b96('0x26')](_0x3ec93c[_0x1b96('0x1d')][_0x1b96('0x26')]);_0x155f83[_0x1b96('0x27')]=qs[_0x1b96('0x1f')](_['pick'](_0x3ec93c[_0x1b96('0x1d')],_0x2cd699[_0x1b96('0x1f')]),_0x43851f);if(_0x3ec93c[_0x1b96('0x1d')]['filter']){_0x155f83[_0x1b96('0x27')]=_[_0x1b96('0x28')](_0x155f83[_0x1b96('0x27')],{'$or':_[_0x1b96('0x19')](_0x43851f,function(_0x587657){if(_0x587657[_0x1b96('0x1a')]!==_0x1b96('0x29')){var _0x177982={};_0x177982[_0x587657[_0x1b96('0x16')]]={'$like':'%'+_0x3ec93c['query'][_0x1b96('0x2a')]+'%'};return _0x177982;}})});}_0x155f83=_['merge']({},_0x155f83,_0x3ec93c[_0x1b96('0x2b')]);var _0x5086cf={'where':_0x155f83['where']};return db[_0x1b96('0x2c')]['count'](_0x5086cf)['then'](function(_0x40b566){_0x3b7f03[_0x1b96('0xf')]=_0x40b566;if(_0x3ec93c[_0x1b96('0x1d')][_0x1b96('0x2d')]){_0x155f83[_0x1b96('0x2e')]=[{'all':!![]}];}return db[_0x1b96('0x2c')][_0x1b96('0x2f')](_0x155f83);})[_0x1b96('0x30')](function(_0x3592fa){_0x3b7f03[_0x1b96('0x31')]=_['map'](_0x3592fa,function(_0x201097){if(_0x201097[_0x1b96('0x32')]===_0x1b96('0x33')){var _0x599cd4=encryptor[_0x1b96('0x34')](_0x201097['data3']);_0x201097[_0x1b96('0x35')]=maskClientSecret(_0x599cd4);}return _0x201097;});return _0x3b7f03;})[_0x1b96('0x30')](respondWithFilteredResult(_0x589b40,_0x155f83))[_0x1b96('0x36')](handleError(_0x589b40,null));};exports[_0x1b96('0x37')]=function(_0x2034a0,_0x37a45e){var _0x43e39c={'raw':!![],'where':{'id':_0x2034a0[_0x1b96('0x38')]['id']}},_0x53c811={};_0x53c811['model']=_['keys'](db[_0x1b96('0x2c')][_0x1b96('0x39')]);_0x53c811['query']=_[_0x1b96('0x1e')](_0x2034a0[_0x1b96('0x1d')]);_0x53c811['filters']=_['intersection'](_0x53c811[_0x1b96('0x1c')],_0x53c811[_0x1b96('0x1d')]);_0x43e39c[_0x1b96('0x21')]=_[_0x1b96('0x20')](_0x53c811[_0x1b96('0x1c')],qs[_0x1b96('0x22')](_0x2034a0[_0x1b96('0x1d')][_0x1b96('0x22')]));_0x43e39c[_0x1b96('0x21')]=_0x43e39c[_0x1b96('0x21')][_0x1b96('0x23')]?_0x43e39c[_0x1b96('0x21')]:_0x53c811[_0x1b96('0x1c')];if(_0x2034a0[_0x1b96('0x1d')][_0x1b96('0x2d')]){_0x43e39c['include']=[{'all':!![]}];}_0x43e39c=_['merge']({},_0x43e39c,_0x2034a0[_0x1b96('0x2b')]);return db[_0x1b96('0x2c')][_0x1b96('0x3a')](_0x43e39c)[_0x1b96('0x30')](handleEntityNotFound(_0x37a45e,null))[_0x1b96('0x30')](function(_0x3aa7ae){if(_0x3aa7ae[_0x1b96('0x32')]===_0x1b96('0x33')){var _0x201642=encryptor[_0x1b96('0x34')](_0x3aa7ae[_0x1b96('0x35')]);_0x3aa7ae[_0x1b96('0x35')]=maskClientSecret(_0x201642);}return _0x3aa7ae;})[_0x1b96('0x30')](respondWithResult(_0x37a45e,null))['catch'](handleError(_0x37a45e,null));};exports[_0x1b96('0x3b')]=function(_0x3a45d9,_0x9c5069){if(!_0x3a45d9[_0x1b96('0x3c')][_0x1b96('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3a45d9['body'][_0x1b96('0x32')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x362caa=db['CloudProvider'][_0x1b96('0x39')][_0x1b96('0x32')][_0x1b96('0x3d')];if(!_0x362caa[_0x1b96('0x3e')](_0x3a45d9[_0x1b96('0x3c')][_0x1b96('0x32')]))throw new Error(_0x1b96('0x3f')+_0x362caa[_0x1b96('0x40')](',\x20'));if(_0x3a45d9[_0x1b96('0x3c')][_0x1b96('0x32')]===_0x1b96('0x33')&&_0x3a45d9[_0x1b96('0x3c')][_0x1b96('0x35')]){_0x3a45d9[_0x1b96('0x3c')][_0x1b96('0x35')]=encryptor['encryptString'](_0x3a45d9[_0x1b96('0x3c')]['data3']);}return db[_0x1b96('0x2c')][_0x1b96('0x3b')](_0x3a45d9[_0x1b96('0x3c')],{})['then'](respondWithResult(_0x9c5069,0xc9))[_0x1b96('0x36')](handleError(_0x9c5069,null));};exports[_0x1b96('0x12')]=function(_0xbad15f,_0x3117ad){if(_0xbad15f[_0x1b96('0x3c')]['id']){delete _0xbad15f[_0x1b96('0x3c')]['id'];}return db[_0x1b96('0x2c')]['find']({'where':{'id':_0xbad15f[_0x1b96('0x38')]['id']}})[_0x1b96('0x30')](handleEntityNotFound(_0x3117ad,null))[_0x1b96('0x30')](function(_0x190e34){if(_0x190e34[_0x1b96('0x32')]===_0x1b96('0x33')&&_0xbad15f[_0x1b96('0x3c')][_0x1b96('0x35')]){_0xbad15f[_0x1b96('0x3c')][_0x1b96('0x35')]=encryptor[_0x1b96('0x41')](_0xbad15f[_0x1b96('0x3c')][_0x1b96('0x35')]);}return _0x190e34;})['then'](saveUpdates(_0xbad15f[_0x1b96('0x3c')],null))['then'](respondWithResult(_0x3117ad,null))[_0x1b96('0x36')](handleError(_0x3117ad,null));};exports[_0x1b96('0x42')]=function(_0x10c63c,_0x40a8f2){return db['CloudProvider']['find']({'where':{'id':_0x10c63c[_0x1b96('0x38')]['id']}})[_0x1b96('0x30')](handleEntityNotFound(_0x40a8f2,null))['then'](removeEntity(_0x40a8f2,null))[_0x1b96('0x36')](handleError(_0x40a8f2,null));};exports['oauth2MicrosoftAuthorize']=function(_0x42ef9d,_0x16b092){return db[_0x1b96('0x2c')][_0x1b96('0x43')]({'where':{'id':_0x42ef9d[_0x1b96('0x38')]['id']},'raw':!![]})[_0x1b96('0x30')](function(_0x3e45e9){if(!_0x3e45e9)return _0x16b092[_0x1b96('0xa')](0x194);return{'url':oauth[_0x1b96('0x44')](_0x3e45e9,_0x42ef9d[_0x1b96('0x45')]['id'])};})[_0x1b96('0x30')](respondWithResult(_0x16b092,null))[_0x1b96('0x36')](handleError(_0x16b092,null));};exports[_0x1b96('0x46')]=function(_0x4ba8a6,_0x374cdb){var _0x21c2b0=_0x4ba8a6[_0x1b96('0x3c')];var _0x5abaeb;var _0x1ab2e2;if(_0x21c2b0[_0x1b96('0x14')])throw _0x21c2b0;redis[_0x1b96('0x47')](_0x21c2b0['state'])[_0x1b96('0x30')](function(_0x462a29){if(!_0x462a29)throw new Error(_0x1b96('0x48'));_0x5abaeb=JSON[_0x1b96('0x49')](_0x462a29);var _0x5c5276=Buffer[_0x1b96('0x4a')](_0x21c2b0[_0x1b96('0x4b')],_0x1b96('0x4c'))[_0x1b96('0x4d')](_0x1b96('0x4e'));_0x1ab2e2=JSON[_0x1b96('0x49')](_0x5c5276);if(!oauth[_0x1b96('0x4f')](_0x21c2b0[_0x1b96('0x50')],_0x5abaeb['oauth2Claims']))throw new Error(_0x1b96('0x51'));redis['del'](_0x21c2b0[_0x1b96('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0x21c2b0[_0x1b96('0x52')],_0x5abaeb);})['then'](function(_0x57de33){_0x5abaeb[_0x1b96('0x53')]=_0x57de33['access_token'];_0x5abaeb[_0x1b96('0x54')]=_0x57de33[_0x1b96('0x55')];return db[_0x1b96('0x2c')][_0x1b96('0x12')]({'data5':_0x5abaeb[_0x1b96('0x53')],'data6':_0x5abaeb[_0x1b96('0x54')]},{'where':{'id':_0x5abaeb['id']}});})[_0x1b96('0x30')](function(){oauth[_0x1b96('0x56')](_0x5abaeb);socket[_0x1b96('0x57')]('microsoftAuthorization:success',{'id':_0x1ab2e2['id']});return;})[_0x1b96('0x30')](respondWithStatusCode(_0x374cdb,null))[_0x1b96('0x36')](function(_0x8f000c){if(_0x1ab2e2){socket[_0x1b96('0x57')](_0x1b96('0x58'),{'id':_0x1ab2e2['id']});}if(!_0x5abaeb){logger[_0x1b96('0x14')](_0x1b96('0x59'),_0x8f000c);return _0x374cdb[_0x1b96('0xb')](0x1f4)['send'](_0x8f000c['message']);}logger[_0x1b96('0x14')](_0x1b96('0x5a'),_0x5abaeb['id'],JSON[_0x1b96('0x5b')](_0x8f000c));});}; \ No newline at end of file +var _0x7c38=['lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','limit','Content-Range','then','end','error','stack','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','params','find','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','destroy','oauth2MicrosoftAuthorize','findOne','user','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','update','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c38,0x1e0));var _0x87c3=function(_0x2d5d9d,_0x38a071){_0x2d5d9d=_0x2d5d9d-0x0;var _0x547338=_0x7c38[_0x2d5d9d];return _0x547338;};'use strict';var _=require(_0x87c3('0x0'));var Redis=require(_0x87c3('0x1'));var qs=require(_0x87c3('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x87c3('0x3'));var logger=require(_0x87c3('0x4'))(_0x87c3('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x87c3('0x6'));config[_0x87c3('0x7')]=_[_0x87c3('0x8')](config[_0x87c3('0x7')],{'host':_0x87c3('0x9'),'port':0x18eb});var socket=require(_0x87c3('0xa'))(new Redis(config[_0x87c3('0x7')]));var redis=new Redis(config[_0x87c3('0x7')]);function respondWithStatusCode(_0x4490af,_0x546ade){_0x546ade=_0x546ade||0xcc;return function(_0x391b7f){if(_0x391b7f){return _0x4490af[_0x87c3('0xb')](_0x546ade);}return _0x4490af[_0x87c3('0xc')](_0x546ade)['end']();};}function respondWithResult(_0x43edce,_0x9f4952){_0x9f4952=_0x9f4952||0xc8;return function(_0x296783){if(_0x296783){return _0x43edce['status'](_0x9f4952)[_0x87c3('0xd')](_0x296783);}};}function respondWithFilteredResult(_0x5829bd,_0x5db77f){return function(_0x103762){if(_0x103762){var _0x503d58=typeof _0x5db77f['offset']==='undefined'&&typeof _0x5db77f['limit']==='undefined';var _0x4d236b=_0x103762[_0x87c3('0xe')];var _0x405f05=_0x503d58?0x0:_0x5db77f['offset'];var _0x195ebb=_0x503d58?_0x103762[_0x87c3('0xe')]:_0x5db77f[_0x87c3('0xf')]+_0x5db77f[_0x87c3('0x10')];var _0x2ad09f;if(_0x195ebb>=_0x4d236b){_0x195ebb=_0x4d236b;_0x2ad09f=0xc8;}else{_0x2ad09f=0xce;}_0x5829bd[_0x87c3('0xc')](_0x2ad09f);return _0x5829bd['set'](_0x87c3('0x11'),_0x405f05+'-'+_0x195ebb+'/'+_0x4d236b)[_0x87c3('0xd')](_0x103762);}return null;};}function saveUpdates(_0x1a6409){return function(_0x332439){if(_0x332439){return _0x332439['update'](_0x1a6409)[_0x87c3('0x12')](function(_0x178036){return _0x178036;});}return null;};}function removeEntity(_0x380db5){return function(_0x2ad266){if(_0x2ad266){return _0x2ad266['destroy']()['then'](function(){_0x380db5['status'](0xcc)[_0x87c3('0x13')]();});}};}function handleEntityNotFound(_0x1a9b78){return function(_0x2a04c4){if(!_0x2a04c4){_0x1a9b78[_0x87c3('0xb')](0x194);}return _0x2a04c4;};}function handleError(_0x5a0bd2,_0x26b01a){_0x26b01a=_0x26b01a||0x1f4;return function(_0x2195d8){logger[_0x87c3('0x14')](_0x2195d8[_0x87c3('0x15')]);if(_0x2195d8[_0x87c3('0x16')]){delete _0x2195d8['name'];}_0x5a0bd2[_0x87c3('0xc')](_0x26b01a)[_0x87c3('0x17')](_0x2195d8);};}function maskClientSecret(_0x2b0a77){return _[_0x87c3('0x18')](_0x2b0a77['slice'](0x0,0x3),0x14,'*');}exports[_0x87c3('0x19')]=function(_0x79865e,_0x421dcf){var _0x34a449={},_0x123135={},_0x16c009={'count':0x0,'rows':[]};var _0x75698d=_['map'](db[_0x87c3('0x1a')][_0x87c3('0x1b')],function(_0xa7baba){return{'name':_0xa7baba[_0x87c3('0x1c')],'type':_0xa7baba[_0x87c3('0x1d')][_0x87c3('0x1e')]};});_0x123135[_0x87c3('0x1f')]=_[_0x87c3('0x20')](_0x75698d,'name');_0x123135[_0x87c3('0x21')]=_['keys'](_0x79865e[_0x87c3('0x21')]);_0x123135['filters']=_[_0x87c3('0x22')](_0x123135[_0x87c3('0x1f')],_0x123135[_0x87c3('0x21')]);_0x34a449['attributes']=_[_0x87c3('0x22')](_0x123135[_0x87c3('0x1f')],qs['fields'](_0x79865e[_0x87c3('0x21')][_0x87c3('0x23')]));_0x34a449[_0x87c3('0x24')]=_0x34a449[_0x87c3('0x24')][_0x87c3('0x25')]?_0x34a449[_0x87c3('0x24')]:_0x123135[_0x87c3('0x1f')];if(!_0x79865e[_0x87c3('0x21')][_0x87c3('0x26')](_0x87c3('0x27'))){_0x34a449['limit']=qs[_0x87c3('0x10')](_0x79865e[_0x87c3('0x21')][_0x87c3('0x10')]);_0x34a449['offset']=qs[_0x87c3('0xf')](_0x79865e[_0x87c3('0x21')][_0x87c3('0xf')]);}_0x34a449[_0x87c3('0x28')]=qs[_0x87c3('0x29')](_0x79865e[_0x87c3('0x21')]['sort']);_0x34a449[_0x87c3('0x2a')]=qs[_0x87c3('0x2b')](_[_0x87c3('0x2c')](_0x79865e[_0x87c3('0x21')],_0x123135['filters']),_0x75698d);if(_0x79865e[_0x87c3('0x21')][_0x87c3('0x2d')]){_0x34a449[_0x87c3('0x2a')]=_[_0x87c3('0x2e')](_0x34a449[_0x87c3('0x2a')],{'$or':_['map'](_0x75698d,function(_0x453a4f){if(_0x453a4f[_0x87c3('0x1d')]!==_0x87c3('0x2f')){var _0x5a0f31={};_0x5a0f31[_0x453a4f[_0x87c3('0x16')]]={'$like':'%'+_0x79865e[_0x87c3('0x21')][_0x87c3('0x2d')]+'%'};return _0x5a0f31;}})});}_0x34a449=_[_0x87c3('0x2e')]({},_0x34a449,_0x79865e[_0x87c3('0x30')]);var _0x9e1908={'where':_0x34a449[_0x87c3('0x2a')]};return db[_0x87c3('0x1a')][_0x87c3('0xe')](_0x9e1908)[_0x87c3('0x12')](function(_0x382e3c){_0x16c009[_0x87c3('0xe')]=_0x382e3c;if(_0x79865e[_0x87c3('0x21')][_0x87c3('0x31')]){_0x34a449[_0x87c3('0x32')]=[{'all':!![]}];}return db[_0x87c3('0x1a')][_0x87c3('0x33')](_0x34a449);})[_0x87c3('0x12')](function(_0x5e2063){_0x16c009[_0x87c3('0x34')]=_[_0x87c3('0x20')](_0x5e2063,function(_0x2c5468){if(_0x2c5468[_0x87c3('0x35')]==='MicrosoftAzure'){var _0x52d4a4=encryptor[_0x87c3('0x36')](_0x2c5468[_0x87c3('0x37')]);_0x2c5468[_0x87c3('0x37')]=maskClientSecret(_0x52d4a4);}return _0x2c5468;});return _0x16c009;})[_0x87c3('0x12')](respondWithFilteredResult(_0x421dcf,_0x34a449))[_0x87c3('0x38')](handleError(_0x421dcf,null));};exports[_0x87c3('0x39')]=function(_0x1bc67a,_0x46f901){var _0xc678b9={'raw':!![],'where':{'id':_0x1bc67a[_0x87c3('0x3a')]['id']}},_0x12ff6c={};_0x12ff6c[_0x87c3('0x1f')]=_['keys'](db['CloudProvider'][_0x87c3('0x1b')]);_0x12ff6c[_0x87c3('0x21')]=_['keys'](_0x1bc67a[_0x87c3('0x21')]);_0x12ff6c['filters']=_[_0x87c3('0x22')](_0x12ff6c['model'],_0x12ff6c[_0x87c3('0x21')]);_0xc678b9[_0x87c3('0x24')]=_[_0x87c3('0x22')](_0x12ff6c[_0x87c3('0x1f')],qs[_0x87c3('0x23')](_0x1bc67a[_0x87c3('0x21')][_0x87c3('0x23')]));_0xc678b9[_0x87c3('0x24')]=_0xc678b9['attributes'][_0x87c3('0x25')]?_0xc678b9[_0x87c3('0x24')]:_0x12ff6c[_0x87c3('0x1f')];if(_0x1bc67a[_0x87c3('0x21')][_0x87c3('0x31')]){_0xc678b9[_0x87c3('0x32')]=[{'all':!![]}];}_0xc678b9=_[_0x87c3('0x2e')]({},_0xc678b9,_0x1bc67a[_0x87c3('0x30')]);return db[_0x87c3('0x1a')][_0x87c3('0x3b')](_0xc678b9)['then'](handleEntityNotFound(_0x46f901,null))[_0x87c3('0x12')](function(_0x30c72c){if(_0x30c72c[_0x87c3('0x35')]===_0x87c3('0x3c')){var _0x590365=encryptor[_0x87c3('0x36')](_0x30c72c[_0x87c3('0x37')]);_0x30c72c[_0x87c3('0x37')]=maskClientSecret(_0x590365);}return _0x30c72c;})[_0x87c3('0x12')](respondWithResult(_0x46f901,null))[_0x87c3('0x38')](handleError(_0x46f901,null));};exports['create']=function(_0xe5638c,_0x207768){if(!_0xe5638c[_0x87c3('0x3d')][_0x87c3('0x16')])throw new Error(_0x87c3('0x3e'));if(!_0xe5638c[_0x87c3('0x3d')][_0x87c3('0x35')])throw new Error(_0x87c3('0x3f'));var _0x56b65e=db[_0x87c3('0x1a')][_0x87c3('0x1b')][_0x87c3('0x35')][_0x87c3('0x40')];if(!_0x56b65e[_0x87c3('0x41')](_0xe5638c[_0x87c3('0x3d')]['service']))throw new Error(_0x87c3('0x42')+_0x56b65e['join'](',\x20'));if(_0xe5638c['body']['service']===_0x87c3('0x3c')&&_0xe5638c[_0x87c3('0x3d')]['data3']){_0xe5638c[_0x87c3('0x3d')]['data3']=encryptor[_0x87c3('0x43')](_0xe5638c[_0x87c3('0x3d')]['data3']);}return db[_0x87c3('0x1a')][_0x87c3('0x44')](_0xe5638c['body'],{})[_0x87c3('0x12')](respondWithResult(_0x207768,0xc9))[_0x87c3('0x38')](handleError(_0x207768,null));};exports['update']=function(_0x324c29,_0xbf6dbc){if(_0x324c29['body']['id']){delete _0x324c29[_0x87c3('0x3d')]['id'];}return db[_0x87c3('0x1a')][_0x87c3('0x3b')]({'where':{'id':_0x324c29[_0x87c3('0x3a')]['id']}})[_0x87c3('0x12')](handleEntityNotFound(_0xbf6dbc,null))[_0x87c3('0x12')](function(_0x3e6410){if(_0x3e6410[_0x87c3('0x35')]===_0x87c3('0x3c')&&_0x324c29[_0x87c3('0x3d')][_0x87c3('0x37')]){_0x324c29[_0x87c3('0x3d')][_0x87c3('0x37')]=encryptor[_0x87c3('0x43')](_0x324c29[_0x87c3('0x3d')][_0x87c3('0x37')]);}return _0x3e6410;})['then'](saveUpdates(_0x324c29[_0x87c3('0x3d')],null))[_0x87c3('0x12')](respondWithResult(_0xbf6dbc,null))[_0x87c3('0x38')](handleError(_0xbf6dbc,null));};exports[_0x87c3('0x45')]=function(_0x1fab0e,_0x2fc0ab){return db['CloudProvider']['find']({'where':{'id':_0x1fab0e['params']['id']}})[_0x87c3('0x12')](handleEntityNotFound(_0x2fc0ab,null))['then'](removeEntity(_0x2fc0ab,null))[_0x87c3('0x38')](handleError(_0x2fc0ab,null));};exports[_0x87c3('0x46')]=function(_0x3b5bb4,_0x1dc85c){return db[_0x87c3('0x1a')][_0x87c3('0x47')]({'where':{'id':_0x3b5bb4['params']['id']},'raw':!![]})['then'](function(_0x225483){if(!_0x225483)return _0x1dc85c[_0x87c3('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x225483,_0x3b5bb4[_0x87c3('0x48')]['id'])};})['then'](respondWithResult(_0x1dc85c,null))['catch'](handleError(_0x1dc85c,null));};exports['oauth2MicrosoftCallback']=function(_0x4c7cc3,_0x45a5cf){var _0x46e2a4=_0x4c7cc3[_0x87c3('0x3d')];var _0x2d1725;var _0x1f7f99;if(_0x46e2a4[_0x87c3('0x14')])throw _0x46e2a4;redis['get'](_0x46e2a4[_0x87c3('0x49')])[_0x87c3('0x12')](function(_0x359f95){if(!_0x359f95)throw new Error(_0x87c3('0x4a'));_0x2d1725=JSON[_0x87c3('0x4b')](_0x359f95);var _0x3a4047=Buffer['from'](_0x46e2a4[_0x87c3('0x49')],_0x87c3('0x4c'))[_0x87c3('0x4d')](_0x87c3('0x4e'));_0x1f7f99=JSON[_0x87c3('0x4b')](_0x3a4047);if(!oauth[_0x87c3('0x4f')](_0x46e2a4['id_token'],_0x2d1725['oauth2Claims']))throw new Error(_0x87c3('0x50'));redis[_0x87c3('0x51')](_0x46e2a4[_0x87c3('0x49')]);return oauth[_0x87c3('0x52')](_0x46e2a4[_0x87c3('0x53')],_0x2d1725);})[_0x87c3('0x12')](function(_0x490d6c){_0x2d1725[_0x87c3('0x54')]=_0x490d6c[_0x87c3('0x55')];_0x2d1725[_0x87c3('0x56')]=_0x490d6c[_0x87c3('0x57')];return db[_0x87c3('0x1a')][_0x87c3('0x58')]({'data5':_0x2d1725['data5'],'data6':_0x2d1725[_0x87c3('0x56')]},{'where':{'id':_0x2d1725['id']}});})[_0x87c3('0x12')](function(){oauth[_0x87c3('0x59')](_0x2d1725);socket['emit'](_0x87c3('0x5a'),{'id':_0x1f7f99['id']});return;})[_0x87c3('0x12')](respondWithStatusCode(_0x45a5cf,null))[_0x87c3('0x38')](function(_0x5cd3a3){if(_0x1f7f99){socket[_0x87c3('0x5b')](_0x87c3('0x5c'),{'id':_0x1f7f99['id']});}if(!_0x2d1725){logger[_0x87c3('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x5cd3a3);return _0x45a5cf[_0x87c3('0xc')](0x1f4)[_0x87c3('0x17')](_0x5cd3a3[_0x87c3('0x5d')]);}logger['error'](_0x87c3('0x5e'),_0x2d1725['id'],JSON[_0x87c3('0x5f')](_0x5cd3a3));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a344655..132f0a3 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 _0xdab7=['moment','bluebird','path','rimraf','../../config/environment','exports','define','cloud_providers','lodash','util','../../config/logger'];(function(_0x5b366e,_0x54990a){var _0x6cd6a3=function(_0x2b08bb){while(--_0x2b08bb){_0x5b366e['push'](_0x5b366e['shift']());}};_0x6cd6a3(++_0x54990a);}(_0xdab7,0x189));var _0x7dab=function(_0x264705,_0x9791f6){_0x264705=_0x264705-0x0;var _0x4875ff=_0xdab7[_0x264705];return _0x4875ff;};'use strict';var _=require(_0x7dab('0x0'));var util=require(_0x7dab('0x1'));var logger=require(_0x7dab('0x2'))('api');var moment=require(_0x7dab('0x3'));var BPromise=require(_0x7dab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7dab('0x5'));var rimraf=require(_0x7dab('0x6'));var config=require(_0x7dab('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x7dab('0x8')]=function(_0x595007,_0x454a41){return _0x595007[_0x7dab('0x9')]('CloudProvider',attributes,{'tableName':_0x7dab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84bb=['../../config/environment','exports','CloudProvider','cloud_providers','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0x84bb,0x138));var _0xb84b=function(_0x4287cb,_0xe75c02){_0x4287cb=_0x4287cb-0x0;var _0x2b5fd3=_0x84bb[_0x4287cb];return _0x2b5fd3;};'use strict';var _=require(_0xb84b('0x0'));var util=require(_0xb84b('0x1'));var logger=require('../../config/logger')(_0xb84b('0x2'));var moment=require('moment');var BPromise=require(_0xb84b('0x3'));var rp=require(_0xb84b('0x4'));var fs=require('fs');var path=require(_0xb84b('0x5'));var rimraf=require(_0xb84b('0x6'));var config=require(_0xb84b('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xb84b('0x8')]=function(_0x5b3f54,_0x418b14){return _0x5b3f54['define'](_0xb84b('0x9'),attributes,{'tableName':_0xb84b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 269b65d..a253b3c 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13c8=['value','set','stringify','decode','payload','iss','issuer','isAfter','exp','then','data3','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','error','authorization_code','data2','intervals','bind','CloudProvider','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','code','id_token','from','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','key'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x13c8,0x10e));var _0x813c=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x13c8[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0x813c('0x0'));var crypto=require(_0x813c('0x1'));var jwt=require(_0x813c('0x2'));var moment=require(_0x813c('0x3'));var Redis=require(_0x813c('0x4'));var rp=require('request-promise');var util=require(_0x813c('0x5'));var encryptor=require(_0x813c('0x6'));var config=require(_0x813c('0x7'));var logger=require(_0x813c('0x8'))(_0x813c('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x813c('0xa'))['db'];config['redis']=_[_0x813c('0xb')](config[_0x813c('0xc')],{'host':_0x813c('0xd'),'port':0x18eb});var redis=new Redis(config[_0x813c('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x813c('0xe'),'profile',_0x813c('0xf'),_0x813c('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x813c('0x11'),_0x813c('0x12')],'Dynamics365':[_0x813c('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x813c('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x8011cc){var _0x18d920=_[_0x813c('0x14')](AZURE_AUTH_SCOPES[_0x8011cc[_0x813c('0x15')]]);if(_0x8011cc[_0x813c('0x15')]===_0x813c('0x16'))_0x18d920[_0x813c('0x17')](_0x8011cc[_0x813c('0x18')]+_0x813c('0x19'));return _0x18d920[_0x813c('0x1a')]('\x20');}function getAccessTokenScope(_0x2fae71){if(_0x2fae71[_0x813c('0x15')]===_0x813c('0x1b'))return _0x813c('0x1c');if(_0x2fae71['type']===_0x813c('0x16'))return _0x2fae71[_0x813c('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4ae6eb,_0x280840){var _0x5da1eb=MICROSOFT_AUTH_URL[_0x813c('0x1d')](_0x813c('0x1e'),_0x4ae6eb['data2']);var _0x4eb597=[_0x813c('0x1f'),_0x813c('0x20')];var _0x454c59=Buffer[_0x813c('0x21')](JSON['stringify']({'id':_0x280840}))[_0x813c('0x22')](_0x813c('0x23'));var _0x29b719=crypto[_0x813c('0x24')](0x10)['toString'](_0x813c('0x25'));var _0x5c6332=getAuthorizationScopes(_0x4ae6eb);var _0x364285=[{'key':_0x813c('0x26'),'value':_0x4ae6eb[_0x813c('0x27')]},{'key':_0x813c('0x28'),'value':encodeURIComponent(_0x4eb597[_0x813c('0x1a')]('\x20'))},{'key':_0x813c('0x29'),'value':_0x4ae6eb[_0x813c('0x2a')]},{'key':_0x813c('0x2b'),'value':_0x813c('0x2c')},{'key':_0x813c('0x2d'),'value':encodeURIComponent(_0x5c6332)},{'key':_0x813c('0x2e'),'value':_0x454c59},{'key':_0x813c('0x2f'),'value':_0x29b719},{'key':_0x813c('0x30'),'value':'login'}];var _0x510a4f=_0x5da1eb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x813c('0x14')](_0x364285,function(_0xb04974){return _0xb04974[_0x813c('0x31')]+'='+_0xb04974[_0x813c('0x32')];})[_0x813c('0x1a')]('&');_0x4ae6eb['oauth2Claims']={'issuer':_0x5da1eb['replace']('oauth2/',''),'audience':_0x4ae6eb[_0x813c('0x27')],'state':_0x454c59,'nonce':_0x29b719};redis[_0x813c('0x33')](_0x454c59,JSON[_0x813c('0x34')](_0x4ae6eb));return _0x510a4f;}function isValidIdToken(_0x5675ea,_0x3b2006){try{var _0x5cbef3=jwt[_0x813c('0x35')](_0x5675ea,{'complete':!![]});var _0x333754=_0x5cbef3[_0x813c('0x36')];if(_0x333754[_0x813c('0x37')]!==_0x3b2006[_0x813c('0x38')])return![];if(_0x333754['aud']!==_0x3b2006['audience'])return![];if(_0x333754[_0x813c('0x2f')]!==_0x3b2006[_0x813c('0x2f')])return![];if(moment()[_0x813c('0x39')](moment['unix'](_0x333754[_0x813c('0x3a')])))return![];return!![];}catch(_0x273849){throw _0x273849;}}function refreshOauth2MicrosoftAccessToken(_0x2b98d2){return Promise['resolve']()[_0x813c('0x3b')](function(){if(_0x2b98d2[_0x813c('0x3c')])return _0x2b98d2;return db['CloudProvider'][_0x813c('0x3d')]({'where':{'id':_0x2b98d2['id']},'raw':!![]});})[_0x813c('0x3b')](function(_0x9f96d1){var _0x44e748={'grant_type':_0x813c('0x3e'),'refresh_token':_0x9f96d1[_0x813c('0x3f')],'scope':getAccessTokenScope(_0x9f96d1),'redirect_uri':_0x9f96d1[_0x813c('0x2a')],'client_id':_0x9f96d1[_0x813c('0x27')],'client_secret':encryptor[_0x813c('0x40')](_0x9f96d1[_0x813c('0x3c')])};var _0x4c3946={'method':_0x813c('0x41'),'uri':MICROSOFT_AUTH_URL[_0x813c('0x1d')](_0x813c('0x1e'),_0x9f96d1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x44e748,'json':!![]};return rp(_0x4c3946);})[_0x813c('0x3b')](function(_0x357441){_0x2b98d2[_0x813c('0x42')]=_0x357441[_0x813c('0x43')];_0x2b98d2[_0x813c('0x3f')]=_0x357441[_0x813c('0x3e')];return db['CloudProvider'][_0x813c('0x44')]({'data5':_0x2b98d2[_0x813c('0x42')],'data6':_0x2b98d2[_0x813c('0x3f')]},{'where':{'id':_0x2b98d2['id']}});})['then'](function(){return _0x2b98d2;})['catch'](function(_0x5a5e18){logger[_0x813c('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2b98d2['id'],_0x5a5e18);});}function getOauth2MicrosoftAccessToken(_0x230106,_0x4ed106){var _0x2846f3={'grant_type':_0x813c('0x46'),'code':_0x230106,'scope':getAccessTokenScope(_0x4ed106),'redirect_uri':_0x4ed106[_0x813c('0x2a')],'client_id':_0x4ed106['data1'],'client_secret':encryptor[_0x813c('0x40')](_0x4ed106[_0x813c('0x3c')])};var _0x178f60={'method':_0x813c('0x41'),'uri':MICROSOFT_AUTH_URL[_0x813c('0x1d')](_0x813c('0x1e'),_0x4ed106[_0x813c('0x47')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2846f3,'json':!![]};return rp(_0x178f60);}function startRefreshInterval(_0x463e83){var _0x14a537=schedule[_0x813c('0x48')];if(_0x14a537[_0x463e83['id']])clearInterval(_0x14a537[_0x463e83['id']]);_0x14a537[_0x463e83['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x813c('0x49')](this,{'id':_0x463e83['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x813c('0x48')]=_0x14a537;}function startAllRefreshIntervals(){return db[_0x813c('0x4a')][_0x813c('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x813c('0x3b')](function(_0x5f55c6){var _0x93b1de=_0x5f55c6[_0x813c('0x14')](function(_0x549e1e){return refreshOauth2MicrosoftAccessToken(_0x549e1e)['then'](function(_0x51d8de){startRefreshInterval(_0x51d8de);});});return Promise[_0x813c('0x4c')](_0x93b1de);})[_0x813c('0x4d')](function(_0x55d733){var _0x3043cd=_0x55d733?util[_0x813c('0x4e')](_0x55d733,{'showHidden':![],'depth':null}):'';logger[_0x813c('0x45')](_0x813c('0x4f'),_0x3043cd);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x05cd=['bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../config/logger','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','join','Outlook365','code','from','stringify','toString','base64','hex','data1','redirect_uri','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','data4','decryptString','POST','replace','{TENANT_ID}','data2','data5','access_token','data6','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x05cd,0x1da));var _0xd05c=function(_0x57bdce,_0x579631){_0x57bdce=_0x57bdce-0x0;var _0x35cbd3=_0x05cd[_0x57bdce];return _0x35cbd3;};'use strict';var _=require(_0xd05c('0x0'));var crypto=require(_0xd05c('0x1'));var jwt=require(_0xd05c('0x2'));var moment=require(_0xd05c('0x3'));var Redis=require('ioredis');var rp=require(_0xd05c('0x4'));var util=require(_0xd05c('0x5'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xd05c('0x6'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xd05c('0x7')]=_[_0xd05c('0x8')](config[_0xd05c('0x7')],{'host':_0xd05c('0x9'),'port':0x18eb});var redis=new Redis(config[_0xd05c('0x7')]);var MICROSOFT_AUTH_URL=_0xd05c('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0xd05c('0xb'),_0xd05c('0xc'),_0xd05c('0xd'),_0xd05c('0xe'),_0xd05c('0xf'),_0xd05c('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xd05c('0xb'),_0xd05c('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xd05c('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x26c9b2){var _0x18731f=_[_0xd05c('0x12')](AZURE_AUTH_SCOPES[_0x26c9b2[_0xd05c('0x13')]]);if(_0x26c9b2[_0xd05c('0x13')]===_0xd05c('0x14'))_0x18731f[_0xd05c('0x15')](_0x26c9b2[_0xd05c('0x16')]+'/.default');return _0x18731f[_0xd05c('0x17')]('\x20');}function getAccessTokenScope(_0x38baee){if(_0x38baee[_0xd05c('0x13')]===_0xd05c('0x18'))return _0xd05c('0xf');if(_0x38baee[_0xd05c('0x13')]===_0xd05c('0x14'))return _0x38baee[_0xd05c('0x16')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x3a6375,_0x11b94a){var _0x4b3b53=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x3a6375['data2']);var _0x24e003=[_0xd05c('0x19'),'id_token'];var _0x13a00e=Buffer[_0xd05c('0x1a')](JSON[_0xd05c('0x1b')]({'id':_0x11b94a}))[_0xd05c('0x1c')](_0xd05c('0x1d'));var _0x17a2dd=crypto['randomBytes'](0x10)[_0xd05c('0x1c')](_0xd05c('0x1e'));var _0x2e010e=getAuthorizationScopes(_0x3a6375);var _0x1ae043=[{'key':'client_id','value':_0x3a6375[_0xd05c('0x1f')]},{'key':'response_type','value':encodeURIComponent(_0x24e003['join']('\x20'))},{'key':_0xd05c('0x20'),'value':_0x3a6375['data4']},{'key':_0xd05c('0x21'),'value':_0xd05c('0x22')},{'key':'scope','value':encodeURIComponent(_0x2e010e)},{'key':_0xd05c('0x23'),'value':_0x13a00e},{'key':_0xd05c('0x24'),'value':_0x17a2dd},{'key':_0xd05c('0x25'),'value':'login'}];var _0x431486=_0x4b3b53+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd05c('0x12')](_0x1ae043,function(_0x3bf7b9){return _0x3bf7b9[_0xd05c('0x26')]+'='+_0x3bf7b9[_0xd05c('0x27')];})[_0xd05c('0x17')]('&');_0x3a6375[_0xd05c('0x28')]={'issuer':_0x4b3b53['replace'](_0xd05c('0x29'),''),'audience':_0x3a6375[_0xd05c('0x1f')],'state':_0x13a00e,'nonce':_0x17a2dd};redis[_0xd05c('0x2a')](_0x13a00e,JSON[_0xd05c('0x1b')](_0x3a6375));return _0x431486;}function isValidIdToken(_0x456baa,_0x1eca1b){try{var _0x545e90=jwt[_0xd05c('0x2b')](_0x456baa,{'complete':!![]});var _0x489a3d=_0x545e90[_0xd05c('0x2c')];if(_0x489a3d[_0xd05c('0x2d')]!==_0x1eca1b[_0xd05c('0x2e')])return![];if(_0x489a3d[_0xd05c('0x2f')]!==_0x1eca1b[_0xd05c('0x30')])return![];if(_0x489a3d[_0xd05c('0x24')]!==_0x1eca1b[_0xd05c('0x24')])return![];if(moment()[_0xd05c('0x31')](moment[_0xd05c('0x32')](_0x489a3d[_0xd05c('0x33')])))return![];return!![];}catch(_0x4a9783){throw _0x4a9783;}}function refreshOauth2MicrosoftAccessToken(_0x17badf){return Promise[_0xd05c('0x34')]()[_0xd05c('0x35')](function(){if(_0x17badf[_0xd05c('0x36')])return _0x17badf;return db[_0xd05c('0x37')]['findOne']({'where':{'id':_0x17badf['id']},'raw':!![]});})[_0xd05c('0x35')](function(_0x24acc2){var _0x2b6f71={'grant_type':'refresh_token','refresh_token':_0x24acc2['data6'],'scope':getAccessTokenScope(_0x24acc2),'redirect_uri':_0x24acc2[_0xd05c('0x38')],'client_id':_0x24acc2[_0xd05c('0x1f')],'client_secret':encryptor[_0xd05c('0x39')](_0x24acc2[_0xd05c('0x36')])};var _0x1b7164={'method':_0xd05c('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xd05c('0x3b')](_0xd05c('0x3c'),_0x24acc2[_0xd05c('0x3d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b6f71,'json':!![]};return rp(_0x1b7164);})[_0xd05c('0x35')](function(_0x101609){_0x17badf[_0xd05c('0x3e')]=_0x101609[_0xd05c('0x3f')];_0x17badf[_0xd05c('0x40')]=_0x101609[_0xd05c('0x41')];return db[_0xd05c('0x37')][_0xd05c('0x42')]({'data5':_0x17badf[_0xd05c('0x3e')],'data6':_0x17badf[_0xd05c('0x40')]},{'where':{'id':_0x17badf['id']}});})[_0xd05c('0x35')](function(){return _0x17badf;})[_0xd05c('0x43')](function(_0xdb2243){logger[_0xd05c('0x44')](_0xd05c('0x45'),_0x17badf['id'],_0xdb2243);});}function getOauth2MicrosoftAccessToken(_0x56ccfa,_0x5d8f25){var _0x263b6a={'grant_type':_0xd05c('0x46'),'code':_0x56ccfa,'scope':getAccessTokenScope(_0x5d8f25),'redirect_uri':_0x5d8f25['data4'],'client_id':_0x5d8f25[_0xd05c('0x1f')],'client_secret':encryptor[_0xd05c('0x39')](_0x5d8f25['data3'])};var _0x2f4882={'method':_0xd05c('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xd05c('0x3b')](_0xd05c('0x3c'),_0x5d8f25[_0xd05c('0x3d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x263b6a,'json':!![]};return rp(_0x2f4882);}function startRefreshInterval(_0x3ec11d){var _0x1797e6=schedule[_0xd05c('0x47')];if(_0x1797e6[_0x3ec11d['id']])clearInterval(_0x1797e6[_0x3ec11d['id']]);_0x1797e6[_0x3ec11d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd05c('0x48')](this,{'id':_0x3ec11d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1797e6;}function startAllRefreshIntervals(){return db[_0xd05c('0x37')][_0xd05c('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xd05c('0x35')](function(_0x479af5){var _0x443c32=_0x479af5[_0xd05c('0x12')](function(_0x3ff9f0){return refreshOauth2MicrosoftAccessToken(_0x3ff9f0)['then'](function(_0x558404){startRefreshInterval(_0x558404);});});return Promise[_0xd05c('0x4a')](_0x443c32);})['catch'](function(_0x3274f3){var _0x524657=_0x3274f3?util[_0xd05c('0x4b')](_0x3274f3,{'showHidden':![],'depth':null}):'';logger['error'](_0xd05c('0x4c'),_0x524657);});}module[_0xd05c('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1176e80..5e53f98 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 _0x887b=['request','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5a168a,_0x2aa6e8){var _0x7dbbcc=function(_0x231f97){while(--_0x231f97){_0x5a168a['push'](_0x5a168a['shift']());}};_0x7dbbcc(++_0x2aa6e8);}(_0x887b,0x185));var _0xb887=function(_0x1dfe26,_0x35dbcf){_0x1dfe26=_0x1dfe26-0x0;var _0xfcb5ff=_0x887b[_0x1dfe26];return _0xfcb5ff;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var moment=require(_0xb887('0x2'));var BPromise=require(_0xb887('0x3'));var rs=require(_0xb887('0x4'));var fs=require('fs');var Redis=require(_0xb887('0x5'));var db=require(_0xb887('0x6'))['db'];var utils=require(_0xb887('0x7'));var logger=require(_0xb887('0x8'))('rpc');var config=require(_0xb887('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x332507,_0x353587,_0x59707f){return new BPromise(function(_0x4a1c1e,_0x32ace2){return client[_0xb887('0xa')](_0x332507,_0x59707f)['then'](function(_0x49962f){logger['info'](_0xb887('0xb'),_0x353587,_0xb887('0xc'));logger['debug'](_0xb887('0xd'),_0x353587,'request\x20sent',JSON[_0xb887('0xe')](_0x49962f));if(_0x49962f[_0xb887('0xf')]){if(_0x49962f[_0xb887('0xf')][_0xb887('0x10')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x32ace2(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}logger[_0xb887('0xf')]('CloudProvider,\x20%s,\x20%s',_0x353587,_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);return _0x4a1c1e(_0x49962f[_0xb887('0xf')][_0xb887('0x11')]);}else{logger[_0xb887('0x12')](_0xb887('0xb'),_0x353587,_0xb887('0xc'));_0x4a1c1e(_0x49962f[_0xb887('0x13')][_0xb887('0x11')]);}})[_0xb887('0x14')](function(_0x2f4e2d){logger[_0xb887('0xf')]('CloudProvider,\x20%s,\x20%s',_0x353587,_0x2f4e2d);_0x32ace2(_0x2f4e2d);});});} \ No newline at end of file +var _0x3070=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x49ed32,_0x573235){var _0x5f04c1=function(_0x35e88b){while(--_0x35e88b){_0x49ed32['push'](_0x49ed32['shift']());}};_0x5f04c1(++_0x573235);}(_0x3070,0x75));var _0x0307=function(_0x5cf121,_0x48b19c){_0x5cf121=_0x5cf121-0x0;var _0x5bb99c=_0x3070[_0x5cf121];return _0x5bb99c;};'use strict';var _=require('lodash');var util=require(_0x0307('0x0'));var moment=require('moment');var BPromise=require(_0x0307('0x1'));var rs=require(_0x0307('0x2'));var fs=require('fs');var Redis=require(_0x0307('0x3'));var db=require(_0x0307('0x4'))['db'];var utils=require(_0x0307('0x5'));var logger=require(_0x0307('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0307('0x7'));var client=jayson[_0x0307('0x8')][_0x0307('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc1dc51,_0x4fbe3e,_0x3ecfb6){return new BPromise(function(_0x41e638,_0x53e6b7){return client[_0x0307('0xa')](_0xc1dc51,_0x3ecfb6)[_0x0307('0xb')](function(_0x187fb3){logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,_0x0307('0xe'));logger[_0x0307('0xf')](_0x0307('0x10'),_0x4fbe3e,_0x0307('0xe'),JSON['stringify'](_0x187fb3));if(_0x187fb3[_0x0307('0x11')]){if(_0x187fb3['error'][_0x0307('0x12')]===0x1f4){logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x53e6b7(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}logger[_0x0307('0x11')](_0x0307('0xd'),_0x4fbe3e,_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);return _0x41e638(_0x187fb3[_0x0307('0x11')][_0x0307('0x13')]);}else{logger[_0x0307('0xc')](_0x0307('0xd'),_0x4fbe3e,'request\x20sent');_0x41e638(_0x187fb3[_0x0307('0x14')][_0x0307('0x13')]);}})[_0x0307('0x15')](function(_0x5f11a5){logger['error'](_0x0307('0xd'),_0x4fbe3e,_0x5f11a5);_0x53e6b7(_0x5f11a5);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index cd9e697..4f049b3 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x1261,0x144));var _0x1126=function(_0xf58288,_0x35333c){_0xf58288=_0xf58288-0x0;var _0x196e87=_0x1261[_0xf58288];return _0x196e87;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5bade4,_0x392912){var _0x111177=function(_0x21b25e){while(--_0x21b25e){_0x5bade4['push'](_0x5bade4['shift']());}};_0x111177(++_0x392912);}(_0x2ef3,0xba));var _0x32ef=function(_0x44de74,_0x310731){_0x44de74=_0x44de74-0x0;var _0x3811db=_0x2ef3[_0x44de74];return _0x3811db;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('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 da95566..f063e92 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 _0xfa7e=['STRING','sequelize','exports'];(function(_0x1b8bda,_0x43ad31){var _0x1f7050=function(_0x1d8dc6){while(--_0x1d8dc6){_0x1b8bda['push'](_0x1b8bda['shift']());}};_0x1f7050(++_0x43ad31);}(_0xfa7e,0xfd));var _0xefa7=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xfa7e[_0x412e27];return _0x53da42;};'use strict';var Sequelize=require(_0xefa7('0x0'));module[_0xefa7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xefa7('0x2')]},'companyId':{'type':Sequelize[_0xefa7('0x2')]},'website':{'type':Sequelize[_0xefa7('0x2')]},'phone':{'type':Sequelize[_0xefa7('0x2')]},'fax':{'type':Sequelize[_0xefa7('0x2')]},'type':{'type':Sequelize[_0xefa7('0x2')]},'street':{'type':Sequelize[_0xefa7('0x2')]},'postalCode':{'type':Sequelize[_0xefa7('0x2')]},'city':{'type':Sequelize[_0xefa7('0x2')]},'country':{'type':Sequelize[_0xefa7('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xefa7('0x2')]},'sPostalCode':{'type':Sequelize[_0xefa7('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xefa7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe023=['name','STRING','sequelize','exports'];(function(_0x50a008,_0x46083e){var _0x165d01=function(_0x54c50f){while(--_0x54c50f){_0x50a008['push'](_0x50a008['shift']());}};_0x165d01(++_0x46083e);}(_0xe023,0x1da));var _0x3e02=function(_0x41cc0d,_0x3f4045){_0x41cc0d=_0x41cc0d-0x0;var _0x11e7c3=_0xe023[_0x41cc0d];return _0x11e7c3;};'use strict';var Sequelize=require(_0x3e02('0x0'));module[_0x3e02('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3e02('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3e02('0x3')]},'companyId':{'type':Sequelize[_0x3e02('0x3')]},'website':{'type':Sequelize[_0x3e02('0x3')]},'phone':{'type':Sequelize[_0x3e02('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x3e02('0x3')]},'city':{'type':Sequelize[_0x3e02('0x3')]},'country':{'type':Sequelize[_0x3e02('0x3')]},'email':{'type':Sequelize[_0x3e02('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3e02('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x3e02('0x3')]},'sCountry':{'type':Sequelize['STRING']},'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 7806c0b..d95bf6a 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 _0x7141=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Companies','UserProfileResource','end','error','stack','send','index','describe','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','keys','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring'];(function(_0x376262,_0x51db10){var _0x1be2a4=function(_0x5629fe){while(--_0x5629fe){_0x376262['push'](_0x376262['shift']());}};_0x1be2a4(++_0x51db10);}(_0x7141,0x108));var _0x1714=function(_0x25f458,_0x1adf3e){_0x25f458=_0x25f458-0x0;var _0x28d182=_0x7141[_0x25f458];return _0x28d182;};'use strict';var emlformat=require(_0x1714('0x0'));var rimraf=require(_0x1714('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1714('0x2'));var rp=require(_0x1714('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1714('0x4'));var util=require(_0x1714('0x5'));var path=require(_0x1714('0x6'));var sox=require(_0x1714('0x7'));var csv=require('to-csv');var ejs=require(_0x1714('0x8'));var fs=require('fs');var fs_extra=require(_0x1714('0x9'));var _=require('lodash');var squel=require(_0x1714('0xa'));var crypto=require(_0x1714('0xb'));var jsforce=require(_0x1714('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1714('0xd'));var querystring=require(_0x1714('0xe'));var Papa=require('papaparse');var Redis=require(_0x1714('0xf'));var authService=require(_0x1714('0x10'));var qs=require(_0x1714('0x11'));var as=require(_0x1714('0x12'));var hardwareService=require(_0x1714('0x13'));var logger=require(_0x1714('0x14'))(_0x1714('0x15'));var utils=require(_0x1714('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1714('0x17'));var db=require(_0x1714('0x18'))['db'];function respondWithStatusCode(_0x3f1fca,_0x165fe7){_0x165fe7=_0x165fe7||0xcc;return function(_0x10b38a){if(_0x10b38a){return _0x3f1fca[_0x1714('0x19')](_0x165fe7);}return _0x3f1fca['status'](_0x165fe7)['end']();};}function respondWithResult(_0x25ea5c,_0xdd2dd7){_0xdd2dd7=_0xdd2dd7||0xc8;return function(_0x6ca5dd){if(_0x6ca5dd){return _0x25ea5c[_0x1714('0x1a')](_0xdd2dd7)[_0x1714('0x1b')](_0x6ca5dd);}};}function respondWithFilteredResult(_0x126bec,_0x2c2ec3){return function(_0x11959b){if(_0x11959b){var _0x48f003=typeof _0x2c2ec3[_0x1714('0x1c')]===_0x1714('0x1d')&&typeof _0x2c2ec3[_0x1714('0x1e')]===_0x1714('0x1d');var _0x5786b4=_0x11959b['count'];var _0x14b78c=_0x48f003?0x0:_0x2c2ec3[_0x1714('0x1c')];var _0x36ea8a=_0x48f003?_0x11959b[_0x1714('0x1f')]:_0x2c2ec3[_0x1714('0x1c')]+_0x2c2ec3[_0x1714('0x1e')];var _0x4b9e93;if(_0x36ea8a>=_0x5786b4){_0x36ea8a=_0x5786b4;_0x4b9e93=0xc8;}else{_0x4b9e93=0xce;}_0x126bec[_0x1714('0x1a')](_0x4b9e93);return _0x126bec[_0x1714('0x20')](_0x1714('0x21'),_0x14b78c+'-'+_0x36ea8a+'/'+_0x5786b4)[_0x1714('0x1b')](_0x11959b);}return null;};}function patchUpdates(_0x329945){return function(_0x60de8e){try{jsonpatch[_0x1714('0x22')](_0x60de8e,_0x329945,!![]);}catch(_0x235486){return BPromise[_0x1714('0x23')](_0x235486);}return _0x60de8e[_0x1714('0x24')]();};}function saveUpdates(_0x414ec8,_0x926323){return function(_0x4a4449){if(_0x4a4449){return _0x4a4449['update'](_0x414ec8)['then'](function(_0x5e2e60){return _0x5e2e60;});}return null;};}function removeEntity(_0x928d8f,_0x3ab34d){return function(_0x9f88d4){if(_0x9f88d4){return _0x9f88d4[_0x1714('0x25')]()[_0x1714('0x26')](function(){var _0x36edba=_0x9f88d4[_0x1714('0x27')]({'plain':!![]});var _0x870cdc=_0x1714('0x28');return db[_0x1714('0x29')]['destroy']({'where':{'type':_0x870cdc,'resourceId':_0x36edba['id']}})[_0x1714('0x26')](function(){return _0x9f88d4;});})[_0x1714('0x26')](function(){_0x928d8f[_0x1714('0x1a')](0xcc)[_0x1714('0x2a')]();});}};}function handleEntityNotFound(_0x5a5cd3,_0xcc2bf4){return function(_0x47b8de){if(!_0x47b8de){_0x5a5cd3[_0x1714('0x19')](0x194);}return _0x47b8de;};}function handleError(_0x32fb1a,_0x222bbc){_0x222bbc=_0x222bbc||0x1f4;return function(_0x511c99){logger[_0x1714('0x2b')](_0x511c99[_0x1714('0x2c')]);if(_0x511c99['name']){delete _0x511c99['name'];}_0x32fb1a[_0x1714('0x1a')](_0x222bbc)[_0x1714('0x2d')](_0x511c99);};}exports[_0x1714('0x2e')]=function(_0x5aaf7d,_0x404833){var _0x57708a={},_0x2941f2={},_0x36c515={'count':0x0,'rows':[]};return db['CmCompany'][_0x1714('0x2f')]()['then'](function(_0xdd69f0){_0x2941f2['model']=_['keys'](_0xdd69f0);_0x2941f2[_0x1714('0x30')]=_['keys'](_0x5aaf7d[_0x1714('0x30')]);_0x2941f2[_0x1714('0x31')]=_[_0x1714('0x32')](_0x2941f2[_0x1714('0x33')],_0x2941f2[_0x1714('0x30')]);_0x57708a[_0x1714('0x34')]=_[_0x1714('0x32')](_0x2941f2['model'],qs[_0x1714('0x35')](_0x5aaf7d[_0x1714('0x30')]['fields']));_0x57708a[_0x1714('0x34')]=_0x57708a['attributes'][_0x1714('0x36')]?_0x57708a[_0x1714('0x34')]:_0x2941f2[_0x1714('0x33')];if(!_0x5aaf7d[_0x1714('0x30')][_0x1714('0x37')](_0x1714('0x38'))){_0x57708a[_0x1714('0x1e')]=qs[_0x1714('0x1e')](_0x5aaf7d[_0x1714('0x30')]['limit']);_0x57708a[_0x1714('0x1c')]=qs[_0x1714('0x1c')](_0x5aaf7d[_0x1714('0x30')][_0x1714('0x1c')]);}_0x57708a[_0x1714('0x39')]=qs[_0x1714('0x3a')](_0x5aaf7d[_0x1714('0x30')][_0x1714('0x3a')]);_0x57708a[_0x1714('0x3b')]=qs['filters'](_[_0x1714('0x3c')](_0x5aaf7d[_0x1714('0x30')],_0x2941f2[_0x1714('0x31')]),_0xdd69f0);if(_0x5aaf7d[_0x1714('0x30')]['filter']){_0x57708a[_0x1714('0x3b')]=_[_0x1714('0x3d')](_0x57708a[_0x1714('0x3b')],{'$or':_[_0x1714('0x3e')](_0x57708a[_0x1714('0x34')],function(_0x4dc3b9){var _0x4df2dd={};_0x4df2dd[_0x4dc3b9]={'$like':'%'+_0x5aaf7d[_0x1714('0x30')][_0x1714('0x3f')]+'%'};return _0x4df2dd;})});}_0x57708a=_['merge']({},_0x57708a,_0x5aaf7d[_0x1714('0x40')]);var _0x34bfdc={'where':_0x57708a[_0x1714('0x3b')]};return db[_0x1714('0x41')]['count'](_0x34bfdc)[_0x1714('0x26')](function(_0x234f9c){_0x36c515[_0x1714('0x1f')]=_0x234f9c;if(_0x5aaf7d['query'][_0x1714('0x42')]){_0x57708a[_0x1714('0x43')]=[{'all':!![]}];}return db[_0x1714('0x41')][_0x1714('0x44')](_0x57708a);})[_0x1714('0x26')](function(_0x47f3c1){_0x36c515[_0x1714('0x45')]=_0x47f3c1;return _0x36c515;})[_0x1714('0x26')](respondWithFilteredResult(_0x404833,_0x57708a))['catch'](handleError(_0x404833,null));})[_0x1714('0x46')](handleError(_0x404833,null));};exports[_0x1714('0x47')]=function(_0x5541d8,_0x227779){var _0x36671e={'raw':![],'where':{'id':_0x5541d8[_0x1714('0x48')]['id']}},_0x13efc5={};_0x13efc5[_0x1714('0x33')]=_['keys'](db[_0x1714('0x41')][_0x1714('0x49')]);_0x13efc5[_0x1714('0x30')]=_['keys'](_0x5541d8['query']);_0x13efc5[_0x1714('0x31')]=_[_0x1714('0x32')](_0x13efc5[_0x1714('0x33')],_0x13efc5[_0x1714('0x30')]);_0x36671e[_0x1714('0x34')]=_[_0x1714('0x32')](_0x13efc5[_0x1714('0x33')],qs[_0x1714('0x35')](_0x5541d8['query']['fields']));_0x36671e['attributes']=_0x36671e[_0x1714('0x34')][_0x1714('0x36')]?_0x36671e[_0x1714('0x34')]:_0x13efc5[_0x1714('0x33')];if(_0x5541d8[_0x1714('0x30')][_0x1714('0x42')]){_0x36671e[_0x1714('0x43')]=[{'all':!![]}];}_0x36671e=_[_0x1714('0x3d')]({},_0x36671e,_0x5541d8[_0x1714('0x40')]);return db[_0x1714('0x41')][_0x1714('0x4a')](_0x36671e)[_0x1714('0x26')](handleEntityNotFound(_0x227779,null))[_0x1714('0x26')](respondWithResult(_0x227779,null))[_0x1714('0x46')](handleError(_0x227779,null));};exports[_0x1714('0x4b')]=function(_0x226a0b,_0x432014){return db[_0x1714('0x41')][_0x1714('0x4b')](_0x226a0b[_0x1714('0x4c')],{})[_0x1714('0x26')](function(_0x2aba0f){var _0x1b5a0d=_0x226a0b[_0x1714('0x4d')][_0x1714('0x27')]({'plain':!![]});if(!_0x1b5a0d)throw new Error(_0x1714('0x4e'));if(_0x1b5a0d[_0x1714('0x4f')]===_0x1714('0x4d')){var _0x116ebe=_0x2aba0f[_0x1714('0x27')]({'plain':!![]});var _0x441925=_0x1714('0x28');return db[_0x1714('0x50')][_0x1714('0x4a')]({'where':{'name':_0x441925,'userProfileId':_0x1b5a0d[_0x1714('0x51')]},'raw':!![]})[_0x1714('0x26')](function(_0x3b5e16){if(_0x3b5e16&&_0x3b5e16[_0x1714('0x52')]===0x0){return db[_0x1714('0x29')]['create']({'name':_0x116ebe[_0x1714('0x53')],'resourceId':_0x116ebe['id'],'type':_0x3b5e16[_0x1714('0x53')],'sectionId':_0x3b5e16['id']},{})[_0x1714('0x26')](function(){return _0x2aba0f;});}else{return _0x2aba0f;}})[_0x1714('0x46')](function(_0x40351d){logger[_0x1714('0x2b')](_0x1714('0x54'),_0x40351d);throw _0x40351d;});}return _0x2aba0f;})['then'](respondWithResult(_0x432014,0xc9))['catch'](handleError(_0x432014,null));};exports[_0x1714('0x55')]=function(_0x6c8ecd,_0x5ef143){if(_0x6c8ecd[_0x1714('0x4c')]['id']){delete _0x6c8ecd[_0x1714('0x4c')]['id'];}return db[_0x1714('0x41')][_0x1714('0x4a')]({'where':{'id':_0x6c8ecd['params']['id']}})[_0x1714('0x26')](handleEntityNotFound(_0x5ef143,null))[_0x1714('0x26')](saveUpdates(_0x6c8ecd['body'],null))['then'](respondWithResult(_0x5ef143,null))[_0x1714('0x46')](handleError(_0x5ef143,null));};exports['destroy']=function(_0x54abd4,_0x1ded23){return db[_0x1714('0x41')]['find']({'where':{'id':_0x54abd4[_0x1714('0x48')]['id']}})[_0x1714('0x26')](handleEntityNotFound(_0x1ded23,null))[_0x1714('0x26')](removeEntity(_0x1ded23,null))[_0x1714('0x46')](handleError(_0x1ded23,null));};exports['describe']=function(_0x3f10fa,_0x41d41a){return db[_0x1714('0x41')][_0x1714('0x2f')]()[_0x1714('0x26')](respondWithResult(_0x41d41a,null))['catch'](handleError(_0x41d41a,null));};exports[_0x1714('0x56')]=function(_0x1211a8,_0x4399c2,_0x55b36d){return db[_0x1714('0x57')][_0x1714('0x4a')]({'where':{'id':_0x1211a8['params']['id']}})[_0x1714('0x26')](handleEntityNotFound(_0x4399c2,null))['then'](function(_0x59bd74){if(_0x59bd74){return _0x59bd74['addContacts'](_0x1211a8['body'][_0x1714('0x58')],_[_0x1714('0x59')](_0x1211a8[_0x1714('0x4c')],[_0x1714('0x58'),'id'])||{});}})[_0x1714('0x26')](respondWithResult(_0x4399c2,null))[_0x1714('0x46')](handleError(_0x4399c2,null));};exports[_0x1714('0x5a')]=function(_0x40639c,_0x18f3a0,_0x3d7cd4){var _0x40c054={};var _0xc36bc2={};var _0x54f9af;var _0x3e2437;return db[_0x1714('0x41')][_0x1714('0x5b')]({'where':{'id':_0x40639c[_0x1714('0x48')]['id']}})[_0x1714('0x26')](handleEntityNotFound(_0x18f3a0,null))['then'](function(_0x5977bb){if(_0x5977bb){_0x54f9af=_0x5977bb;_0xc36bc2[_0x1714('0x33')]=_['keys'](db[_0x1714('0x57')][_0x1714('0x49')]);_0xc36bc2[_0x1714('0x30')]=_[_0x1714('0x5c')](_0x40639c[_0x1714('0x30')]);_0xc36bc2[_0x1714('0x31')]=_[_0x1714('0x32')](_0xc36bc2[_0x1714('0x33')],_0xc36bc2[_0x1714('0x30')]);_0x40c054['attributes']=_['intersection'](_0xc36bc2[_0x1714('0x33')],qs['fields'](_0x40639c[_0x1714('0x30')]['fields']));_0x40c054[_0x1714('0x34')]=_0x40c054['attributes'][_0x1714('0x36')]?_0x40c054[_0x1714('0x34')]:_0xc36bc2[_0x1714('0x33')];_0x40c054['order']=qs[_0x1714('0x3a')](_0x40639c[_0x1714('0x30')][_0x1714('0x3a')]);_0x40c054[_0x1714('0x3b')]=qs[_0x1714('0x31')](_[_0x1714('0x3c')](_0x40639c[_0x1714('0x30')],_0xc36bc2[_0x1714('0x31')]));if(_0x40639c[_0x1714('0x30')][_0x1714('0x3f')]){_0x40c054[_0x1714('0x3b')]=_[_0x1714('0x3d')](_0x40c054[_0x1714('0x3b')],{'$or':_['map'](_0x40c054[_0x1714('0x34')],function(_0x26db73){var _0x5dac64={};_0x5dac64[_0x26db73]={'$like':'%'+_0x40639c[_0x1714('0x30')][_0x1714('0x3f')]+'%'};return _0x5dac64;})});}_0x40c054=_[_0x1714('0x3d')]({},_0x40c054,_0x40639c[_0x1714('0x40')]);return _0x54f9af[_0x1714('0x5a')](_0x40c054);}})[_0x1714('0x26')](function(_0x2146b5){if(_0x2146b5){_0x3e2437=_0x2146b5[_0x1714('0x36')];if(!_0x40639c[_0x1714('0x30')][_0x1714('0x37')](_0x1714('0x38'))){_0x40c054['limit']=qs['limit'](_0x40639c[_0x1714('0x30')][_0x1714('0x1e')]);_0x40c054['offset']=qs[_0x1714('0x1c')](_0x40639c[_0x1714('0x30')][_0x1714('0x1c')]);}return _0x54f9af['getContacts'](_0x40c054);}})[_0x1714('0x26')](function(_0x42d896){if(_0x42d896){return _0x42d896?{'count':_0x3e2437,'rows':_0x42d896}:null;}})[_0x1714('0x26')](respondWithResult(_0x18f3a0,null))[_0x1714('0x46')](handleError(_0x18f3a0,null));}; \ No newline at end of file +var _0xb5ca=['UserProfileResource','stack','name','index','CmCompany','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','catch','show','params','model','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','omit','ids','findOne','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','get','Companies'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0xb5ca,0x121));var _0xab5c=function(_0x58cd03,_0x233a86){_0x58cd03=_0x58cd03-0x0;var _0xee0802=_0xb5ca[_0x58cd03];return _0xee0802;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab5c('0x0'));var zipdir=require(_0xab5c('0x1'));var jsonpatch=require(_0xab5c('0x2'));var rp=require('request-promise');var moment=require(_0xab5c('0x3'));var BPromise=require(_0xab5c('0x4'));var Mustache=require(_0xab5c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xab5c('0x6'));var ejs=require(_0xab5c('0x7'));var fs=require('fs');var fs_extra=require(_0xab5c('0x8'));var _=require('lodash');var squel=require(_0xab5c('0x9'));var crypto=require('crypto');var jsforce=require(_0xab5c('0xa'));var deskjs=require(_0xab5c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xab5c('0xc'));var Papa=require(_0xab5c('0xd'));var Redis=require(_0xab5c('0xe'));var authService=require(_0xab5c('0xf'));var qs=require(_0xab5c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab5c('0x11'))(_0xab5c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xab5c('0x13'));var db=require(_0xab5c('0x14'))['db'];function respondWithStatusCode(_0x26ff10,_0x309050){_0x309050=_0x309050||0xcc;return function(_0x5d992e){if(_0x5d992e){return _0x26ff10[_0xab5c('0x15')](_0x309050);}return _0x26ff10[_0xab5c('0x16')](_0x309050)[_0xab5c('0x17')]();};}function respondWithResult(_0x2ee54f,_0x5a2e7e){_0x5a2e7e=_0x5a2e7e||0xc8;return function(_0x489acd){if(_0x489acd){return _0x2ee54f[_0xab5c('0x16')](_0x5a2e7e)[_0xab5c('0x18')](_0x489acd);}};}function respondWithFilteredResult(_0x2b15b9,_0xde7fe6){return function(_0x383b76){if(_0x383b76){var _0x151fd2=typeof _0xde7fe6[_0xab5c('0x19')]===_0xab5c('0x1a')&&typeof _0xde7fe6[_0xab5c('0x1b')]===_0xab5c('0x1a');var _0x4a4a5c=_0x383b76['count'];var _0x2b3512=_0x151fd2?0x0:_0xde7fe6[_0xab5c('0x19')];var _0x19799f=_0x151fd2?_0x383b76['count']:_0xde7fe6['offset']+_0xde7fe6[_0xab5c('0x1b')];var _0x2d837b;if(_0x19799f>=_0x4a4a5c){_0x19799f=_0x4a4a5c;_0x2d837b=0xc8;}else{_0x2d837b=0xce;}_0x2b15b9['status'](_0x2d837b);return _0x2b15b9[_0xab5c('0x1c')]('Content-Range',_0x2b3512+'-'+_0x19799f+'/'+_0x4a4a5c)[_0xab5c('0x18')](_0x383b76);}return null;};}function patchUpdates(_0x1403b9){return function(_0x30917b){try{jsonpatch[_0xab5c('0x1d')](_0x30917b,_0x1403b9,!![]);}catch(_0x4c61cb){return BPromise['reject'](_0x4c61cb);}return _0x30917b[_0xab5c('0x1e')]();};}function saveUpdates(_0x5f0f00,_0x44e8bc){return function(_0xf5671d){if(_0xf5671d){return _0xf5671d['update'](_0x5f0f00)[_0xab5c('0x1f')](function(_0xaf0553){return _0xaf0553;});}return null;};}function removeEntity(_0x6b9d24,_0xbf95a7){return function(_0x2970f6){if(_0x2970f6){return _0x2970f6[_0xab5c('0x20')]()[_0xab5c('0x1f')](function(){var _0x48d08b=_0x2970f6[_0xab5c('0x21')]({'plain':!![]});var _0x5d7cdd=_0xab5c('0x22');return db[_0xab5c('0x23')]['destroy']({'where':{'type':_0x5d7cdd,'resourceId':_0x48d08b['id']}})[_0xab5c('0x1f')](function(){return _0x2970f6;});})[_0xab5c('0x1f')](function(){_0x6b9d24[_0xab5c('0x16')](0xcc)[_0xab5c('0x17')]();});}};}function handleEntityNotFound(_0x301a12,_0x4a84e5){return function(_0xe7e915){if(!_0xe7e915){_0x301a12[_0xab5c('0x15')](0x194);}return _0xe7e915;};}function handleError(_0xaaae34,_0x9f744b){_0x9f744b=_0x9f744b||0x1f4;return function(_0x3a1559){logger['error'](_0x3a1559[_0xab5c('0x24')]);if(_0x3a1559['name']){delete _0x3a1559[_0xab5c('0x25')];}_0xaaae34[_0xab5c('0x16')](_0x9f744b)['send'](_0x3a1559);};}exports[_0xab5c('0x26')]=function(_0x2368a3,_0x333446){var _0x342acd={},_0x19694f={},_0x220799={'count':0x0,'rows':[]};return db[_0xab5c('0x27')]['describe']()[_0xab5c('0x1f')](function(_0x173163){_0x19694f['model']=_['keys'](_0x173163);_0x19694f[_0xab5c('0x28')]=_[_0xab5c('0x29')](_0x2368a3['query']);_0x19694f[_0xab5c('0x2a')]=_[_0xab5c('0x2b')](_0x19694f['model'],_0x19694f['query']);_0x342acd[_0xab5c('0x2c')]=_[_0xab5c('0x2b')](_0x19694f['model'],qs[_0xab5c('0x2d')](_0x2368a3[_0xab5c('0x28')]['fields']));_0x342acd['attributes']=_0x342acd[_0xab5c('0x2c')][_0xab5c('0x2e')]?_0x342acd[_0xab5c('0x2c')]:_0x19694f['model'];if(!_0x2368a3['query'][_0xab5c('0x2f')](_0xab5c('0x30'))){_0x342acd[_0xab5c('0x1b')]=qs[_0xab5c('0x1b')](_0x2368a3['query'][_0xab5c('0x1b')]);_0x342acd[_0xab5c('0x19')]=qs[_0xab5c('0x19')](_0x2368a3[_0xab5c('0x28')][_0xab5c('0x19')]);}_0x342acd[_0xab5c('0x31')]=qs[_0xab5c('0x32')](_0x2368a3['query'][_0xab5c('0x32')]);_0x342acd[_0xab5c('0x33')]=qs[_0xab5c('0x2a')](_[_0xab5c('0x34')](_0x2368a3[_0xab5c('0x28')],_0x19694f[_0xab5c('0x2a')]),_0x173163);if(_0x2368a3[_0xab5c('0x28')][_0xab5c('0x35')]){_0x342acd[_0xab5c('0x33')]=_[_0xab5c('0x36')](_0x342acd[_0xab5c('0x33')],{'$or':_[_0xab5c('0x37')](_0x342acd['attributes'],function(_0x427e48){var _0x368f6a={};_0x368f6a[_0x427e48]={'$like':'%'+_0x2368a3[_0xab5c('0x28')][_0xab5c('0x35')]+'%'};return _0x368f6a;})});}_0x342acd=_[_0xab5c('0x36')]({},_0x342acd,_0x2368a3['options']);var _0x413b74={'where':_0x342acd['where']};return db['CmCompany']['count'](_0x413b74)[_0xab5c('0x1f')](function(_0x18ad48){_0x220799['count']=_0x18ad48;if(_0x2368a3[_0xab5c('0x28')][_0xab5c('0x38')]){_0x342acd['include']=[{'all':!![]}];}return db['CmCompany'][_0xab5c('0x39')](_0x342acd);})[_0xab5c('0x1f')](function(_0x5bfca5){_0x220799['rows']=_0x5bfca5;return _0x220799;})['then'](respondWithFilteredResult(_0x333446,_0x342acd))[_0xab5c('0x3a')](handleError(_0x333446,null));})['catch'](handleError(_0x333446,null));};exports[_0xab5c('0x3b')]=function(_0x2a3eae,_0x3a94f8){var _0x223a97={'raw':![],'where':{'id':_0x2a3eae[_0xab5c('0x3c')]['id']}},_0x494e04={};_0x494e04[_0xab5c('0x3d')]=_[_0xab5c('0x29')](db['CmCompany'][_0xab5c('0x3e')]);_0x494e04[_0xab5c('0x28')]=_[_0xab5c('0x29')](_0x2a3eae['query']);_0x494e04[_0xab5c('0x2a')]=_[_0xab5c('0x2b')](_0x494e04['model'],_0x494e04[_0xab5c('0x28')]);_0x223a97[_0xab5c('0x2c')]=_['intersection'](_0x494e04[_0xab5c('0x3d')],qs['fields'](_0x2a3eae[_0xab5c('0x28')][_0xab5c('0x2d')]));_0x223a97['attributes']=_0x223a97[_0xab5c('0x2c')][_0xab5c('0x2e')]?_0x223a97['attributes']:_0x494e04[_0xab5c('0x3d')];if(_0x2a3eae[_0xab5c('0x28')]['includeAll']){_0x223a97[_0xab5c('0x3f')]=[{'all':!![]}];}_0x223a97=_[_0xab5c('0x36')]({},_0x223a97,_0x2a3eae[_0xab5c('0x40')]);return db['CmCompany'][_0xab5c('0x41')](_0x223a97)[_0xab5c('0x1f')](handleEntityNotFound(_0x3a94f8,null))[_0xab5c('0x1f')](respondWithResult(_0x3a94f8,null))[_0xab5c('0x3a')](handleError(_0x3a94f8,null));};exports[_0xab5c('0x42')]=function(_0x4a447a,_0x19bce9){return db[_0xab5c('0x27')][_0xab5c('0x42')](_0x4a447a[_0xab5c('0x43')],{})[_0xab5c('0x1f')](function(_0x31ba47){var _0x4b9cb5=_0x4a447a[_0xab5c('0x44')][_0xab5c('0x21')]({'plain':!![]});if(!_0x4b9cb5)throw new Error(_0xab5c('0x45'));if(_0x4b9cb5[_0xab5c('0x46')]===_0xab5c('0x44')){var _0x335935=_0x31ba47[_0xab5c('0x21')]({'plain':!![]});var _0x26677b=_0xab5c('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x26677b,'userProfileId':_0x4b9cb5[_0xab5c('0x47')]},'raw':!![]})[_0xab5c('0x1f')](function(_0x538110){if(_0x538110&&_0x538110[_0xab5c('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x335935[_0xab5c('0x25')],'resourceId':_0x335935['id'],'type':_0x538110[_0xab5c('0x25')],'sectionId':_0x538110['id']},{})[_0xab5c('0x1f')](function(){return _0x31ba47;});}else{return _0x31ba47;}})[_0xab5c('0x3a')](function(_0x426e06){logger[_0xab5c('0x49')](_0xab5c('0x4a'),_0x426e06);throw _0x426e06;});}return _0x31ba47;})[_0xab5c('0x1f')](respondWithResult(_0x19bce9,0xc9))[_0xab5c('0x3a')](handleError(_0x19bce9,null));};exports[_0xab5c('0x4b')]=function(_0x27133d,_0x4a10a9){if(_0x27133d[_0xab5c('0x43')]['id']){delete _0x27133d['body']['id'];}return db[_0xab5c('0x27')][_0xab5c('0x41')]({'where':{'id':_0x27133d['params']['id']}})[_0xab5c('0x1f')](handleEntityNotFound(_0x4a10a9,null))[_0xab5c('0x1f')](saveUpdates(_0x27133d[_0xab5c('0x43')],null))[_0xab5c('0x1f')](respondWithResult(_0x4a10a9,null))[_0xab5c('0x3a')](handleError(_0x4a10a9,null));};exports[_0xab5c('0x20')]=function(_0x1be9f4,_0x6c9c11){return db[_0xab5c('0x27')][_0xab5c('0x41')]({'where':{'id':_0x1be9f4[_0xab5c('0x3c')]['id']}})[_0xab5c('0x1f')](handleEntityNotFound(_0x6c9c11,null))['then'](removeEntity(_0x6c9c11,null))[_0xab5c('0x3a')](handleError(_0x6c9c11,null));};exports[_0xab5c('0x4c')]=function(_0x20bef8,_0x52dbfc){return db[_0xab5c('0x27')][_0xab5c('0x4c')]()[_0xab5c('0x1f')](respondWithResult(_0x52dbfc,null))['catch'](handleError(_0x52dbfc,null));};exports[_0xab5c('0x4d')]=function(_0x57985c,_0x17414d,_0x1690a4){return db['CmContact']['find']({'where':{'id':_0x57985c['params']['id']}})['then'](handleEntityNotFound(_0x17414d,null))[_0xab5c('0x1f')](function(_0x14b0a3){if(_0x14b0a3){return _0x14b0a3[_0xab5c('0x4d')](_0x57985c['body']['ids'],_[_0xab5c('0x4e')](_0x57985c['body'],[_0xab5c('0x4f'),'id'])||{});}})[_0xab5c('0x1f')](respondWithResult(_0x17414d,null))[_0xab5c('0x3a')](handleError(_0x17414d,null));};exports['getContacts']=function(_0x3deeb6,_0x12b567,_0x131edb){var _0x32fd73={};var _0x30e158={};var _0x50a0e9;var _0xd67f13;return db[_0xab5c('0x27')][_0xab5c('0x50')]({'where':{'id':_0x3deeb6['params']['id']}})['then'](handleEntityNotFound(_0x12b567,null))['then'](function(_0x95bbfa){if(_0x95bbfa){_0x50a0e9=_0x95bbfa;_0x30e158['model']=_[_0xab5c('0x29')](db['CmContact'][_0xab5c('0x3e')]);_0x30e158[_0xab5c('0x28')]=_[_0xab5c('0x29')](_0x3deeb6[_0xab5c('0x28')]);_0x30e158['filters']=_['intersection'](_0x30e158[_0xab5c('0x3d')],_0x30e158['query']);_0x32fd73[_0xab5c('0x2c')]=_[_0xab5c('0x2b')](_0x30e158[_0xab5c('0x3d')],qs[_0xab5c('0x2d')](_0x3deeb6[_0xab5c('0x28')]['fields']));_0x32fd73[_0xab5c('0x2c')]=_0x32fd73[_0xab5c('0x2c')][_0xab5c('0x2e')]?_0x32fd73[_0xab5c('0x2c')]:_0x30e158[_0xab5c('0x3d')];_0x32fd73[_0xab5c('0x31')]=qs['sort'](_0x3deeb6[_0xab5c('0x28')][_0xab5c('0x32')]);_0x32fd73[_0xab5c('0x33')]=qs[_0xab5c('0x2a')](_[_0xab5c('0x34')](_0x3deeb6['query'],_0x30e158[_0xab5c('0x2a')]));if(_0x3deeb6['query'][_0xab5c('0x35')]){_0x32fd73['where']=_[_0xab5c('0x36')](_0x32fd73['where'],{'$or':_[_0xab5c('0x37')](_0x32fd73[_0xab5c('0x2c')],function(_0x269944){var _0x2083ca={};_0x2083ca[_0x269944]={'$like':'%'+_0x3deeb6[_0xab5c('0x28')][_0xab5c('0x35')]+'%'};return _0x2083ca;})});}_0x32fd73=_[_0xab5c('0x36')]({},_0x32fd73,_0x3deeb6[_0xab5c('0x40')]);return _0x50a0e9['getContacts'](_0x32fd73);}})['then'](function(_0x2c6ff2){if(_0x2c6ff2){_0xd67f13=_0x2c6ff2[_0xab5c('0x2e')];if(!_0x3deeb6[_0xab5c('0x28')]['hasOwnProperty'](_0xab5c('0x30'))){_0x32fd73[_0xab5c('0x1b')]=qs[_0xab5c('0x1b')](_0x3deeb6[_0xab5c('0x28')][_0xab5c('0x1b')]);_0x32fd73[_0xab5c('0x19')]=qs[_0xab5c('0x19')](_0x3deeb6[_0xab5c('0x28')][_0xab5c('0x19')]);}return _0x50a0e9['getContacts'](_0x32fd73);}})[_0xab5c('0x1f')](function(_0x5317f2){if(_0x5317f2){return _0x5317f2?{'count':_0xd67f13,'rows':_0x5317f2}:null;}})['then'](respondWithResult(_0x12b567,null))[_0xab5c('0x3a')](handleError(_0x12b567,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index e4e328e..4e36f8e 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 _0x9da7=['exports','define','CmCompany','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x9da7,0x19d));var _0x79da=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x9da7[_0x3af6d3];return _0xf0c5a8;};'use strict';var _=require(_0x79da('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x79da('0x1'));var BPromise=require(_0x79da('0x2'));var rp=require(_0x79da('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79da('0x4'));var config=require(_0x79da('0x5'));var attributes=require(_0x79da('0x6'));module[_0x79da('0x7')]=function(_0x596266,_0x4e57e8){return _0x596266[_0x79da('0x8')](_0x79da('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13bd=['moment','bluebird','request-promise','path','../../config/environment','exports','define','cm_companies','util','../../config/logger'];(function(_0x27e004,_0x4008cc){var _0x493997=function(_0x17e9ab){while(--_0x17e9ab){_0x27e004['push'](_0x27e004['shift']());}};_0x493997(++_0x4008cc);}(_0x13bd,0x94));var _0xd13b=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x13bd[_0x245c4f];return _0x3157a1;};'use strict';var _=require('lodash');var util=require(_0xd13b('0x0'));var logger=require(_0xd13b('0x1'))('api');var moment=require(_0xd13b('0x2'));var BPromise=require(_0xd13b('0x3'));var rp=require(_0xd13b('0x4'));var fs=require('fs');var path=require(_0xd13b('0x5'));var rimraf=require('rimraf');var config=require(_0xd13b('0x6'));var attributes=require('./cmCompany.attributes');module[_0xd13b('0x7')]=function(_0x10d08e,_0x57145e){return _0x10d08e[_0xd13b('0x8')]('CmCompany',attributes,{'tableName':_0xd13b('0x9'),'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 16e9e6c..361d748 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 _0xd2ee=['CmCompany,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x23622e,_0x90502c){var _0x14a39e=function(_0x296d32){while(--_0x296d32){_0x23622e['push'](_0x23622e['shift']());}};_0x14a39e(++_0x90502c);}(_0xd2ee,0x1a7));var _0xed2e=function(_0x58cda9,_0x2291d9){_0x58cda9=_0x58cda9-0x0;var _0x5739ed=_0xd2ee[_0x58cda9];return _0x5739ed;};'use strict';var _=require(_0xed2e('0x0'));var util=require(_0xed2e('0x1'));var moment=require(_0xed2e('0x2'));var BPromise=require(_0xed2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed2e('0x4'));var logger=require(_0xed2e('0x5'))(_0xed2e('0x6'));var config=require('../../config/environment');var jayson=require(_0xed2e('0x7'));var client=jayson[_0xed2e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35a3bb,_0x44ae34,_0x3bce78){return new BPromise(function(_0x319513,_0x537402){return client[_0xed2e('0x9')](_0x35a3bb,_0x3bce78)['then'](function(_0x2a8eb4){logger[_0xed2e('0xa')]('CmCompany,\x20%s,\x20%s',_0x44ae34,_0xed2e('0xb'));logger[_0xed2e('0xc')](_0xed2e('0xd'),_0x44ae34,'request\x20sent',JSON['stringify'](_0x2a8eb4));if(_0x2a8eb4[_0xed2e('0xe')]){if(_0x2a8eb4[_0xed2e('0xe')][_0xed2e('0xf')]===0x1f4){logger[_0xed2e('0xe')]('CmCompany,\x20%s,\x20%s',_0x44ae34,_0x2a8eb4[_0xed2e('0xe')][_0xed2e('0x10')]);return _0x537402(_0x2a8eb4['error'][_0xed2e('0x10')]);}logger[_0xed2e('0xe')](_0xed2e('0x11'),_0x44ae34,_0x2a8eb4[_0xed2e('0xe')][_0xed2e('0x10')]);return _0x319513(_0x2a8eb4[_0xed2e('0xe')][_0xed2e('0x10')]);}else{logger[_0xed2e('0xa')]('CmCompany,\x20%s,\x20%s',_0x44ae34,_0xed2e('0xb'));_0x319513(_0x2a8eb4[_0xed2e('0x12')]['message']);}})[_0xed2e('0x13')](function(_0x383e36){logger['error']('CmCompany,\x20%s,\x20%s',_0x44ae34,_0x383e36);_0x537402(_0x383e36);});});} \ No newline at end of file +var _0xd713=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x1eca7,_0x464b3a){var _0x529ca3=function(_0x4c1d7b){while(--_0x4c1d7b){_0x1eca7['push'](_0x1eca7['shift']());}};_0x529ca3(++_0x464b3a);}(_0xd713,0x98));var _0x3d71=function(_0xbd18d4,_0x112df4){_0xbd18d4=_0xbd18d4-0x0;var _0xec2e4a=_0xd713[_0xbd18d4];return _0xec2e4a;};'use strict';var _=require('lodash');var util=require(_0x3d71('0x0'));var moment=require(_0x3d71('0x1'));var BPromise=require(_0x3d71('0x2'));var rs=require(_0x3d71('0x3'));var fs=require('fs');var Redis=require(_0x3d71('0x4'));var db=require(_0x3d71('0x5'))['db'];var utils=require(_0x3d71('0x6'));var logger=require(_0x3d71('0x7'))(_0x3d71('0x8'));var config=require(_0x3d71('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3d71('0xa')][_0x3d71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1359b6,_0x5b046e,_0x3c5221){return new BPromise(function(_0x3b66a4,_0x51a6d5){return client['request'](_0x1359b6,_0x3c5221)[_0x3d71('0xc')](function(_0x39e154){logger[_0x3d71('0xd')]('CmCompany,\x20%s,\x20%s',_0x5b046e,_0x3d71('0xe'));logger[_0x3d71('0xf')](_0x3d71('0x10'),_0x5b046e,'request\x20sent',JSON['stringify'](_0x39e154));if(_0x39e154[_0x3d71('0x11')]){if(_0x39e154[_0x3d71('0x11')]['code']===0x1f4){logger[_0x3d71('0x11')](_0x3d71('0x12'),_0x5b046e,_0x39e154[_0x3d71('0x11')][_0x3d71('0x13')]);return _0x51a6d5(_0x39e154['error'][_0x3d71('0x13')]);}logger[_0x3d71('0x11')](_0x3d71('0x12'),_0x5b046e,_0x39e154[_0x3d71('0x11')][_0x3d71('0x13')]);return _0x3b66a4(_0x39e154[_0x3d71('0x11')][_0x3d71('0x13')]);}else{logger[_0x3d71('0xd')]('CmCompany,\x20%s,\x20%s',_0x5b046e,_0x3d71('0xe'));_0x3b66a4(_0x39e154[_0x3d71('0x14')][_0x3d71('0x13')]);}})[_0x3d71('0x15')](function(_0x159736){logger['error'](_0x3d71('0x12'),_0x5b046e,_0x159736);_0x51a6d5(_0x159736);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3406043..3e3261b 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 _0x29ae=['describe','/:id','show','/:id/contacts','post','create','addContacts','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated'];(function(_0x5365ad,_0x41ec9b){var _0x365519=function(_0x5f0cd2){while(--_0x5f0cd2){_0x5365ad['push'](_0x5365ad['shift']());}};_0x365519(++_0x41ec9b);}(_0x29ae,0x17e));var _0xe29a=function(_0x4bf374,_0x6ce396){_0x4bf374=_0x4bf374-0x0;var _0x40aa89=_0x29ae[_0x4bf374];return _0x40aa89;};'use strict';var multer=require('multer');var util=require(_0xe29a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe29a('0x1')]();var fs_extra=require(_0xe29a('0x2'));var auth=require(_0xe29a('0x3'));var interaction=require(_0xe29a('0x4'));var config=require(_0xe29a('0x5'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe29a('0x6')](_0xe29a('0x7'),auth[_0xe29a('0x8')](),controller[_0xe29a('0x9')]);router[_0xe29a('0x6')](_0xe29a('0xa'),auth[_0xe29a('0x8')](),controller[_0xe29a('0xb')]);router[_0xe29a('0x6')](_0xe29a('0xc'),auth[_0xe29a('0x8')](),controller['getContacts']);router[_0xe29a('0xd')]('/',auth['isAuthenticated'](),controller[_0xe29a('0xe')]);router['post']('/:id/contacts',auth[_0xe29a('0x8')](),controller[_0xe29a('0xf')]);router['put'](_0xe29a('0xa'),auth[_0xe29a('0x8')](),controller['update']);router['delete'](_0xe29a('0xa'),auth[_0xe29a('0x8')](),controller[_0xe29a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2395=['./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5af7ae,_0x42f37b){var _0x5166a2=function(_0x31b574){while(--_0x31b574){_0x5af7ae['push'](_0x5af7ae['shift']());}};_0x5166a2(++_0x42f37b);}(_0x2395,0x1c1));var _0x5239=function(_0x3a6f39,_0x46f8ea){_0x3a6f39=_0x3a6f39-0x0;var _0x443024=_0x2395[_0x3a6f39];return _0x443024;};'use strict';var multer=require(_0x5239('0x0'));var util=require(_0x5239('0x1'));var path=require(_0x5239('0x2'));var timeout=require(_0x5239('0x3'));var express=require(_0x5239('0x4'));var router=express[_0x5239('0x5')]();var fs_extra=require(_0x5239('0x6'));var auth=require(_0x5239('0x7'));var interaction=require(_0x5239('0x8'));var config=require(_0x5239('0x9'));var controller=require(_0x5239('0xa'));router['get']('/',auth[_0x5239('0xb')](),controller[_0x5239('0xc')]);router[_0x5239('0xd')](_0x5239('0xe'),auth['isAuthenticated'](),controller[_0x5239('0xf')]);router[_0x5239('0xd')](_0x5239('0x10'),auth[_0x5239('0xb')](),controller[_0x5239('0x11')]);router['get'](_0x5239('0x12'),auth[_0x5239('0xb')](),controller[_0x5239('0x13')]);router[_0x5239('0x14')]('/',auth[_0x5239('0xb')](),controller[_0x5239('0x15')]);router[_0x5239('0x14')](_0x5239('0x12'),auth[_0x5239('0xb')](),controller[_0x5239('0x16')]);router[_0x5239('0x17')](_0x5239('0x10'),auth[_0x5239('0xb')](),controller[_0x5239('0x18')]);router[_0x5239('0x19')](_0x5239('0x10'),auth[_0x5239('0xb')](),controller['destroy']);module[_0x5239('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3a57b13..a6624c4 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 _0x4faa=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4faa,0xcb));var _0xa4fa=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4faa[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xa4fa('0x0'));var Sequelize=require(_0xa4fa('0x1'));module[_0xa4fa('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa4fa('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa4fa('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa4fa('0x3')]},'description':{'type':Sequelize[_0xa4fa('0x4')]},'phone':{'type':Sequelize[_0xa4fa('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa4fa('0x3')]},'email':{'type':Sequelize[_0xa4fa('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa4fa('0x3')]},'fb_data':{'type':Sequelize[_0xa4fa('0x3')]},'twitter':{'type':Sequelize[_0xa4fa('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xa4fa('0x3')]},'viber':{'type':Sequelize[_0xa4fa('0x3')]},'line':{'type':Sequelize[_0xa4fa('0x3')]},'wechat':{'type':Sequelize[_0xa4fa('0x3')]},'telegram':{'type':Sequelize[_0xa4fa('0x3')]},'UserId':{'type':Sequelize[_0xa4fa('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa4fa('0x5')](0x2)[_0xa4fa('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa4fa('0x7')],'defaultValue':Sequelize[_0xa4fa('0x8')]},'dialTimezone':{'type':Sequelize[_0xa4fa('0x3')]},'utcOffset':{'type':Sequelize[_0xa4fa('0x5')]}}; \ No newline at end of file +var _0xd7ec=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x325f39,_0x279f45){var _0xbbf965=function(_0xe09bba){while(--_0xe09bba){_0x325f39['push'](_0x325f39['shift']());}};_0xbbf965(++_0x279f45);}(_0xd7ec,0xa6));var _0xcd7e=function(_0x586803,_0x201178){_0x586803=_0x586803-0x0;var _0x4d56b3=_0xd7ec[_0x586803];return _0x4d56b3;};'use strict';var _=require(_0xcd7e('0x0'));var Sequelize=require(_0xcd7e('0x1'));module[_0xcd7e('0x2')]={'firstName':{'type':Sequelize[_0xcd7e('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xcd7e('0x3')]},'street':{'type':Sequelize[_0xcd7e('0x3')]},'postalCode':{'type':Sequelize[_0xcd7e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xcd7e('0x3')]},'dateOfBirth':{'type':Sequelize[_0xcd7e('0x3')]},'description':{'type':Sequelize[_0xcd7e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xcd7e('0x3')]},'fax':{'type':Sequelize[_0xcd7e('0x3')]},'email':{'type':Sequelize[_0xcd7e('0x3')]},'url':{'type':Sequelize[_0xcd7e('0x3')]},'facebook':{'type':Sequelize[_0xcd7e('0x3')]},'fb_data':{'type':Sequelize[_0xcd7e('0x3')]},'twitter':{'type':Sequelize[_0xcd7e('0x3')]},'skype':{'type':Sequelize[_0xcd7e('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xcd7e('0x3')]},'wechat':{'type':Sequelize[_0xcd7e('0x3')]},'telegram':{'type':Sequelize[_0xcd7e('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xcd7e('0x3')]},'priority':{'type':Sequelize[_0xcd7e('0x5')](0x2)[_0xcd7e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xcd7e('0x7')],'defaultValue':Sequelize[_0xcd7e('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xcd7e('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 86200c0..6d52d82 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 _0x08e3=['ContactItemType','ItemType','literal','Phones.OrderBy','get','$and','omit','format','cf_%d','dialTimezone','pickBy','table','cm_contacts','id\x20=\x20?','toParam','rawAttributes','merge','options','getTags','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','phone','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','error\x20child\x20process','mail','chat','sms','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userThirdDisposition','fullname','alias','createdAt','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','openchannel','threadId','Interaction','flatten','sortBy','reverse','slice','moment','bluebird','path','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','socket.io-emitter','register','json','limit','undefined','count','offset','status','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','length','cf_','CmCustomField','findOne','fieldType','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','text','start','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','c.id','DESC','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.lastName','c.mobile','c.fax','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','startsWith','columnName','displayName','analytics','findAll','custom','body','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','contact','all','show','find','params','CmContactHasItem','Phones'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x08e3,0x1c1));var _0x308e=function(_0x2fd123,_0x3649e4){_0x2fd123=_0x2fd123-0x0;var _0x14686b=_0x08e3[_0x2fd123];return _0x14686b;};'use strict';var moment=require(_0x308e('0x0'));var BPromise=require(_0x308e('0x1'));var util=require('util');var path=require(_0x308e('0x2'));var fs=require('fs');var _=require(_0x308e('0x3'));var squel=require(_0x308e('0x4'));var Papa=require(_0x308e('0x5'));var Redis=require('ioredis');var qs=require(_0x308e('0x6'));var as=require(_0x308e('0x7'));var logger=require(_0x308e('0x8'))(_0x308e('0x9'));var config=require(_0x308e('0xa'));var shared=require(_0x308e('0xb'));var db=require('../../mysqldb')['db'];config[_0x308e('0xc')]=_['defaults'](config[_0x308e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x308e('0xd'))(new Redis(config[_0x308e('0xc')]));require('./cmContact.socket')[_0x308e('0xe')](socket);function respondWithResult(_0x45fd27,_0x3dc340){_0x3dc340=_0x3dc340||0xc8;return function(_0x195948){if(_0x195948){return _0x45fd27['status'](_0x3dc340)[_0x308e('0xf')](_0x195948);}};}function respondWithFilteredResult(_0x20d0b7,_0x38bd23){return function(_0x4852b1){if(_0x4852b1){var _0x40fa89=typeof _0x38bd23['offset']==='undefined'&&typeof _0x38bd23[_0x308e('0x10')]===_0x308e('0x11');var _0x1d0b3f=_0x4852b1[_0x308e('0x12')];var _0x12bdf1=_0x40fa89?0x0:_0x38bd23[_0x308e('0x13')];var _0x4a1569=_0x40fa89?_0x4852b1[_0x308e('0x12')]:_0x38bd23['offset']+_0x38bd23[_0x308e('0x10')];var _0x57f313;if(_0x4a1569>=_0x1d0b3f){_0x4a1569=_0x1d0b3f;_0x57f313=0xc8;}else{_0x57f313=0xce;}_0x20d0b7[_0x308e('0x14')](_0x57f313);return _0x20d0b7[_0x308e('0x15')]('Content-Range',_0x12bdf1+'-'+_0x4a1569+'/'+_0x1d0b3f)['json'](_0x4852b1);}return null;};}function saveUpdates(_0x3ccd55){return function(_0x74d46){if(_0x74d46){return _0x74d46[_0x308e('0x16')](_0x3ccd55)[_0x308e('0x17')](function(_0x137b18){return _0x137b18;});}return null;};}function removeEntity(_0x250910){return function(_0x299978){if(_0x299978){return _0x299978[_0x308e('0x18')]()[_0x308e('0x17')](function(){_0x250910[_0x308e('0x14')](0xcc)[_0x308e('0x19')]();});}};}function handleEntityNotFound(_0x4c3904){return function(_0x2b78c7){if(!_0x2b78c7){_0x4c3904[_0x308e('0x1a')](0x194);}return _0x2b78c7;};}function handleError(_0x5ae495,_0x373e50){_0x373e50=_0x373e50||0x1f4;return function(_0x4de37d){logger[_0x308e('0x1b')](_0x4de37d[_0x308e('0x1c')]);if(_0x4de37d[_0x308e('0x1d')]){delete _0x4de37d[_0x308e('0x1d')];}_0x5ae495[_0x308e('0x14')](_0x373e50)[_0x308e('0x1e')](_0x4de37d);};}exports[_0x308e('0x1f')]=function(_0x2e705b,_0x52c81a){var _0x5c3402={},_0x551759={},_0x245ba3={'count':0x0,'rows':[]};return db[_0x308e('0x20')][_0x308e('0x21')]()['then'](function(_0x9fab6e){var _0x186c62=[];for(var _0x4d2420=0x0;_0x4d24200x1){_0x272a00['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x308e('0x60')](_0x3fa5bf),null);}else{if(qs[_0x308e('0x61')](_0x3fa5bf)){_0x272a00['or'](_0x308e('0x62'),_0x3fa5bf+'%');_0x272a00['or'](_0x308e('0x63'),_0x3fa5bf+'%');_0x272a00['or'](_0x308e('0x64'),_0x3fa5bf+'%');_0x272a00['or'](_0x308e('0x65'),_0x3fa5bf+'%');}else if(qs[_0x308e('0x66')](_0x3fa5bf)){_0x272a00['or'](_0x308e('0x67'),_0x3fa5bf+'%');}else{_0x272a00['or'](_0x308e('0x68'),'%'+_0x3fa5bf+'%');_0x272a00['or'](_0x308e('0x69'),'%'+_0x3fa5bf+'%');_0x272a00['or'](_0x308e('0x67'),'%'+_0x3fa5bf+'%');}}}}_0x1ec897[_0x308e('0x32')](_0x272a00);_0x1ec897[_0x308e('0x6a')]('c.id');var _0x1c2246={'type':db[_0x308e('0x6b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4d3676=_0x1ec897['clone']()[_0x308e('0x36')](_0x308e('0x6c'));if(_0x5c3402['order']){_0x5c3402['order'][_0x308e('0x49')](function(_0x4ad58b){_0x1ec897['order']('c.'+_0x4ad58b[0x0],_0x4ad58b[0x1]===_0x308e('0x6d')?![]:!![]);});}if(!_[_0x308e('0x57')](_0x12fbab)){_0x1ec897['having'](_0x123aeb);_0x4d3676['where']('t.id\x20IN\x20?',_0x12fbab);}BPromise[_0x308e('0x6e')]()[_0x308e('0x17')](function(){if(!_0x5e247d)return;if(_0x2e705b[_0x308e('0x6f')][_0x308e('0x70')]!==_0x308e('0x71'))return;if(!_[_0x308e('0x72')](_0x5e247d['conditions'],[_0x308e('0x36'),'User'])){return _0x2e705b[_0x308e('0x6f')][_0x308e('0x73')]({'attributes':['id'],'raw':!![]})[_0x308e('0x17')](function(_0x16be4f){if(_['isEmpty'](_0x16be4f)){_0x4d3676[_0x308e('0x32')](_0x308e('0x74'));_0x1ec897['where'](_0x308e('0x74'));}else{_0x4d3676[_0x308e('0x32')](_0x308e('0x59'),_[_0x308e('0x48')](_0x16be4f,'id'));_0x1ec897[_0x308e('0x32')](_0x308e('0x59'),_['map'](_0x16be4f,'id'));}});}})['then'](function(){if(_0x2e705b[_0x308e('0x6f')]['role']===_0x308e('0x71')&&!_0x5e247d&&!_0x2e705b['query']['ListId'])return[];return db[_0x308e('0x75')][_0x308e('0x2a')](_0x4d3676[_0x308e('0x76')](),_0x1c2246);})['then'](function(_0x4be1d6){_0x245ba3[_0x308e('0x12')]=_0x4be1d6['length'];if(_0x245ba3['count']===0x0)return[];return db[_0x308e('0x75')]['query'](_0x311019[_0x308e('0x76')](),_0x1c2246)[_0x308e('0x17')](function(_0x48154b){_0x1278fb=_[_0x308e('0x77')](_0x48154b,'id');_0x1c2246=_['merge'](_0x1c2246,{'model':db[_0x308e('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e705b[_0x308e('0x2a')][_0x308e('0x2d')]){_0x5c3402[_0x308e('0x2c')]['forEach'](function(_0xc90fa7){_0x1ec897[_0x308e('0x36')]('c.'+_0xc90fa7);});}else{_0x1ec897[_0x308e('0x36')](_0x308e('0x6c'));_0x1ec897[_0x308e('0x36')](_0x308e('0x78'));_0x1ec897[_0x308e('0x36')](_0x308e('0x79'));_0x1ec897['field']('c.phone');_0x1ec897[_0x308e('0x36')](_0x308e('0x7a'));_0x1ec897[_0x308e('0x36')](_0x308e('0x7b'));_0x1ec897[_0x308e('0x36')]('c.email');_0x1ec897[_0x308e('0x36')]('c.ListId');_0x1ec897['field']('c.createdAt');_0x1ec897[_0x308e('0x36')](_0x308e('0x7c'));_0x1ec897['field'](_0x308e('0x7d'));_0x1ec897[_0x308e('0x36')](_0x308e('0x7e'),_0x308e('0x7f'));}if(_0x5c3402[_0x308e('0x10')])_0x1ec897[_0x308e('0x10')](_0x5c3402[_0x308e('0x10')]);if(_0x5c3402['offset'])_0x1ec897['offset'](_0x5c3402['offset']);return db[_0x308e('0x75')][_0x308e('0x2a')](_0x1ec897['toString'](),_0x1c2246);});})[_0x308e('0x17')](function(_0x4a7d24){_0x4a7d24['forEach'](function(_0x11313b){if(_0x11313b['TagIds']){_0x11313b['Tags']=[];_0x11313b['TagIds']['split'](',')[_0x308e('0x49')](function(_0xeebcc6){_0x11313b[_0x308e('0x80')]['push'](_0x1278fb[_0xeebcc6]);});}delete _0x11313b['TagIds'];});_0x245ba3[_0x308e('0x81')]=_0x4a7d24;return _0x245ba3;})[_0x308e('0x17')](respondWithFilteredResult(_0x52c81a,_0x5c3402));})[_0x308e('0x82')](handleError(_0x52c81a,null));};exports[_0x308e('0x18')]=function(_0xed7a6f,_0x47b2b4){return db[_0x308e('0x20')]['find']({'where':{'id':_0xed7a6f['params']['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x47b2b4,null))[_0x308e('0x17')](removeEntity(_0x47b2b4,null))[_0x308e('0x82')](handleError(_0x47b2b4,null));};exports['describe']=function(_0x41fd16,_0xe118ca){return db[_0x308e('0x20')][_0x308e('0x21')]()[_0x308e('0x17')](function(_0x137ac4){delete _0x137ac4[_0x308e('0x83')];for(var _0x5d4521=0x0;_0x5d45210x0){return new Promise(function(_0x40b793,_0x4929ff){var _0x25585b=[];for(var _0x596a13=0x0;_0x596a13<_0x59c367[_0x308e('0x23')];_0x596a13++){_0x25585b[_0x308e('0x56')](insertAdditionalPhones(_0x59c367[_0x596a13][_0x308e('0xac')],_0x59c367[_0x596a13][_0x308e('0xa5')]));}Promise[_0x308e('0xad')](_0x25585b)['then'](function(){_0x40b793(0x1);});})[_0x308e('0x17')](function(){return{'success':_0x23c5ee,'failure':_0x4b6c51,'duplicates':_0x1e75d2};});}else{return{'success':_0x23c5ee,'failure':_0x4b6c51,'duplicates':_0x1e75d2};}}})['then'](respondWithResult(_0x5259a7,0xc9))['catch'](handleError(_0x5259a7,null));};exports[_0x308e('0xae')]=function(_0x40a95f,_0x32e18f){var _0x4ae054;return db[_0x308e('0x20')][_0x308e('0x21')]()[_0x308e('0x17')](function(_0x58d862){return db[_0x308e('0x20')][_0x308e('0xaf')]({'where':{'id':_0x40a95f[_0x308e('0xb0')]['id']},'include':[{'model':db['Tag'],'as':_0x308e('0x80'),'attributes':['id','name',_0x308e('0x37')],'required':_0x40a95f[_0x308e('0x2a')][_0x308e('0x5e')]?!![]:![]},{'model':db[_0x308e('0xb1')],'as':_0x308e('0xb2'),'where':{'CmContactId':_0x40a95f[_0x308e('0xb0')]['id']},'required':![],'include':[{'model':db[_0x308e('0xb3')],'as':_0x308e('0xb4')}]}],'order':[db['sequelize'][_0x308e('0xb5')](_0x308e('0xb6'))],'attributes':_[_0x308e('0x22')](_0x58d862)});})[_0x308e('0x17')](function(_0x15d715){if(!_[_0x308e('0x54')](_0x15d715)){_0x4ae054=_0x15d715[_0x308e('0xb7')]({'plain':!![]});var _0x4a20fa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x15d715&&_0x15d715[_0x308e('0x58')]){if(_0x15d715['ListId']){_0x4a20fa[_0x308e('0x32')][_0x308e('0xb8')][_0x308e('0x56')]({'ListId':{'$ne':_0x15d715[_0x308e('0x58')]}});}}return db['CmCustomField'][_0x308e('0x88')](_0x4a20fa);}})[_0x308e('0x17')](function(_0x4c34a2){if(!_[_0x308e('0x54')](_0x4c34a2)){return _[_0x308e('0xb9')](_0x4ae054,_['map'](_0x4c34a2,function(_0x22fc71){return util[_0x308e('0xba')](_0x308e('0xbb'),_0x22fc71['id']);}));}})[_0x308e('0x17')](handleEntityNotFound(_0x32e18f,null))[_0x308e('0x17')](respondWithResult(_0x32e18f,null))['catch'](handleError(_0x32e18f,null));};exports[_0x308e('0x16')]=function(_0x40f59f,_0x162769){var _0x8688e1;if(_0x40f59f[_0x308e('0x8a')]['id']){delete _0x40f59f[_0x308e('0x8a')]['id'];}if(!_['isNil'](_0x40f59f[_0x308e('0x8a')]['dialTimezone'])){var _0x13f674=_0x40f59f[_0x308e('0x8a')][_0x308e('0xbc')];if(!_[_0x308e('0x54')](shared[_0x308e('0xa3')][_0x13f674]))_0x40f59f['body'][_0x308e('0xa4')]=shared['timezones'][_0x13f674]['utcOffset'];}return db[_0x308e('0x20')][_0x308e('0xaf')]({'where':{'id':_0x40f59f[_0x308e('0xb0')]['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x162769,null))[_0x308e('0x17')](saveUpdates(_0x40f59f[_0x308e('0x8a')],null))[_0x308e('0x17')](function(_0x3e165b){_0x8688e1=_0x3e165b;var _0x334101={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3e165b&&_0x3e165b['ListId']){if(_0x3e165b[_0x308e('0x58')]){_0x334101['where'][_0x308e('0xb8')][_0x308e('0x56')]({'ListId':{'$ne':_0x3e165b['ListId']}});}}return db[_0x308e('0x25')]['findAll'](_0x334101);})['then'](function(_0x921de1){if(_0x921de1){return _[_0x308e('0xb9')](_[_0x308e('0xbd')](_0x40f59f[_0x308e('0x8a')],function(_0x2e179e,_0x4420d8){return _[_0x308e('0x84')](_0x4420d8,'cf_');}),_['map'](_0x921de1,function(_0x4f22e2){return util[_0x308e('0xba')](_0x308e('0xbb'),_0x4f22e2['id']);}));}})[_0x308e('0x17')](function(_0x483fc1){if(_0x483fc1&&!_['isEmpty'](_0x483fc1)){var _0x42ae75=squel['update']()[_0x308e('0xbe')](_0x308e('0xbf'))['setFields'](_0x483fc1)[_0x308e('0x32')](_0x308e('0xc0'),_0x40f59f['params']['id'])[_0x308e('0xc1')]();return db[_0x308e('0x75')]['query'](_0x42ae75[_0x308e('0x51')],{'replacements':_0x42ae75['values']});}})['then'](function(){if(_0x40f59f['body']['phone']&&_0x8688e1){return db[_0x308e('0x8d')][_0x308e('0x16')]({'phone':_0x40f59f['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x8688e1['id']}});}})[_0x308e('0x17')](function(){return _0x8688e1;})[_0x308e('0x17')](respondWithResult(_0x162769,null))[_0x308e('0x82')](handleError(_0x162769,null));};exports['getTags']=function(_0x790697,_0x121cb7){var _0x2d6567={};var _0x1cfc29={};var _0x7bf6ae;var _0x1df21b;return db[_0x308e('0x20')][_0x308e('0x26')]({'where':{'id':_0x790697['params']['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x121cb7,null))[_0x308e('0x17')](function(_0x55cfd7){if(_0x55cfd7){_0x7bf6ae=_0x55cfd7;_0x1cfc29['model']=_[_0x308e('0x22')](db[_0x308e('0x45')][_0x308e('0xc2')]);_0x1cfc29[_0x308e('0x2a')]=_['keys'](_0x790697[_0x308e('0x2a')]);_0x1cfc29['filters']=_[_0x308e('0x2b')](_0x1cfc29[_0x308e('0x29')],_0x1cfc29[_0x308e('0x2a')]);_0x2d6567[_0x308e('0x2c')]=_[_0x308e('0x2b')](_0x1cfc29[_0x308e('0x29')],qs[_0x308e('0x2d')](_0x790697[_0x308e('0x2a')][_0x308e('0x2d')]));_0x2d6567['attributes']=_0x2d6567['attributes'][_0x308e('0x23')]?_0x2d6567['attributes']:_0x1cfc29['model'];_0x2d6567[_0x308e('0x30')]=qs[_0x308e('0x31')](_0x790697[_0x308e('0x2a')][_0x308e('0x31')]);_0x2d6567['where']=qs[_0x308e('0x33')](_[_0x308e('0x34')](_0x790697[_0x308e('0x2a')],_0x1cfc29[_0x308e('0x33')]));if(_0x790697['query'][_0x308e('0x53')]){_0x2d6567[_0x308e('0x32')]=_[_0x308e('0xc3')](_0x2d6567['where'],{'$or':_[_0x308e('0x48')](_0x2d6567['attributes'],function(_0x4442e8){var _0x25f075={};_0x25f075[_0x4442e8]={'$like':'%'+_0x790697['query'][_0x308e('0x53')]+'%'};return _0x25f075;})});}_0x2d6567=_[_0x308e('0xc3')]({},_0x2d6567,_0x790697[_0x308e('0xc4')]);return _0x7bf6ae[_0x308e('0xc5')](_0x2d6567);}})[_0x308e('0x17')](function(_0x35eb75){if(_0x35eb75){_0x1df21b=_0x35eb75[_0x308e('0x23')];if(!_0x790697[_0x308e('0x2a')][_0x308e('0x2e')](_0x308e('0x2f'))){_0x2d6567[_0x308e('0x10')]=qs[_0x308e('0x10')](_0x790697[_0x308e('0x2a')][_0x308e('0x10')]);_0x2d6567[_0x308e('0x13')]=qs[_0x308e('0x13')](_0x790697[_0x308e('0x2a')][_0x308e('0x13')]);}return _0x7bf6ae[_0x308e('0xc5')](_0x2d6567);}})[_0x308e('0x17')](function(_0x5be1c6){if(_0x5be1c6){return _0x5be1c6?{'count':_0x1df21b,'rows':_0x5be1c6}:null;}})['then'](respondWithResult(_0x121cb7,null))[_0x308e('0x82')](handleError(_0x121cb7,null));};exports[_0x308e('0xc6')]=function(_0xa028a0,_0x4df737){if(_0xa028a0[_0x308e('0x8a')]['id']){delete _0xa028a0[_0x308e('0x8a')]['id'];}return db['CmContact'][_0x308e('0x26')]({'where':{'id':_0xa028a0[_0x308e('0xb0')]['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x4df737,null))['then'](function(_0x2d62bd){if(_0x2d62bd){return _0x2d62bd[_0x308e('0xc6')](_0xa028a0['body'][_0x308e('0xc7')]||[]);}return null;})[_0x308e('0x17')](respondWithResult(_0x4df737,null))[_0x308e('0x82')](handleError(_0x4df737,null));};exports[_0x308e('0xc8')]=function(_0x3bb684,_0x60a041){var _0x19feac=[];_0x19feac[_0x308e('0x56')](addAdditionalPhones(_0x3bb684[_0x308e('0x8a')]));Promise[_0x308e('0xad')](_0x19feac)[_0x308e('0x17')](function(){_0x19feac=[];_0x19feac[_0x308e('0x56')](deleteCmHopperPhones(_0x3bb684[_0x308e('0x8a')]['id']));_0x19feac['push'](addCmHopperPhones(_0x3bb684[_0x308e('0x8a')]['id']));Promise[_0x308e('0xad')](_0x19feac)[_0x308e('0x17')](function(){return[0x1];})[_0x308e('0x17')](respondWithResult(_0x60a041,null));});};function addAdditionalPhones(_0x54321c){var _0x3d986f;return new Promise(function(_0xe0f814,_0x415706){return db[_0x308e('0xb1')]['destroy']({'where':{'CmContactId':_0x54321c['id']}})[_0x308e('0x17')](function(){db[_0x308e('0xb3')][_0x308e('0x88')]({'raw':!![],'attributes':['id','OrderBy']})[_0x308e('0x17')](function(_0x574abc){var _0x340304=[];for(var _0x5b2338=0x0;_0x5b2338<_0x54321c[_0x308e('0xc9')][_0x308e('0x23')];_0x5b2338++){var _0x91296c=_0x54321c[_0x308e('0xca')]?_[_0x308e('0x54')](_0x54321c[_0x308e('0xca')][_0x5b2338])?'':_0x54321c[_0x308e('0xca')][_0x5b2338]:_0x54321c[_0x308e('0xc9')][_0x5b2338][_0x308e('0xcb')]?_0x54321c['items'][_0x5b2338]['ItemTypeId']:'';var _0x52bf85=_[_0x308e('0x54')](_0x54321c[_0x308e('0xc9')][_0x5b2338][_0x308e('0xcc')])?'':_0x54321c['items'][_0x5b2338]['description'];var _0x4fb542=_0x91296c+':'+_0x54321c[_0x308e('0xc9')][_0x5b2338][_0x308e('0xcd')]+'§'+_0x52bf85;if(_[_0x308e('0x54')](_0x3d986f))_0x3d986f=_0x4fb542;else _0x3d986f+=';'+_0x4fb542;var _0x2982ab=null;if(_0x54321c['item_types']){if(!_[_0x308e('0x54')](_0x54321c[_0x308e('0xca')][_0x5b2338])){var _0x1b0036=_[_0x308e('0xaf')](_0x574abc,function(_0x59de2d){return _0x59de2d['id']===_0x54321c[_0x308e('0xca')][_0x5b2338];});if(!_[_0x308e('0x54')](_0x1b0036)){_0x2982ab=_0x1b0036[_0x308e('0xce')];}}}else{if(!_[_0x308e('0x54')](_0x54321c[_0x308e('0xc9')][_0x5b2338])){var _0x1b0036=_[_0x308e('0xaf')](_0x574abc,function(_0x4aff29){return _0x4aff29['id']===_0x54321c[_0x308e('0xc9')][_0x5b2338][_0x308e('0xcb')];});if(!_[_0x308e('0x54')](_0x1b0036)){_0x2982ab=_0x5b2338;}}}if(_[_0x308e('0x54')](_0x2982ab)){_0x2982ab=0x64;}_0x340304[_0x308e('0x56')](addAdditionalPhone(_0x54321c['id'],_0x54321c[_0x308e('0xc9')][_0x5b2338][_0x308e('0xcd')],_0x54321c[_0x308e('0xca')]?_[_0x308e('0x54')](_0x54321c[_0x308e('0xca')][_0x5b2338])?null:_0x54321c['item_types'][_0x5b2338]:_0x54321c['items'][_0x5b2338]['ItemTypeId']?_0x54321c[_0x308e('0xc9')][_0x5b2338]['ItemTypeId']:null,_0x2982ab,_0x52bf85));}Promise[_0x308e('0xad')](_0x340304)[_0x308e('0x17')](function(){db['CmContact'][_0x308e('0x16')]({'AdditionalPhones':_0x3d986f},{'where':{'id':_0x54321c['id']}})['then'](function(){_0xe0f814(0x1);});});});});});}function addAdditionalPhone(_0x5b9999,_0xa919e3,_0x2604a4,_0x2eb985,_0x363f56){return db[_0x308e('0xb1')][_0x308e('0xaf')]({'where':{'CmContactId':_0x5b9999,'item':_0xa919e3}})[_0x308e('0x17')](function(_0x542522){if(_0x542522)logger[_0x308e('0x8b')](_0x308e('0xcf'),_0x542522);else{db[_0x308e('0xb1')][_0x308e('0x91')]({'CmContactId':_0x5b9999,'item':_0xa919e3,'ItemTypeId':_0x2604a4,'OrderBy':_0x2eb985,'ItemClass':_0x308e('0xd0'),'description':_0x363f56});}});}function deletePhones(_0x54608a){return db[_0x308e('0xb1')][_0x308e('0x18')]({'where':{'CmContactId':_0x54608a}});}function deleteCmHopperPhones(_0x315997){return new Promise(function(_0x5ea7b6,_0x3725c2){return db[_0x308e('0x8d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x315997}})[_0x308e('0x17')](function(_0x134f12){db[_0x308e('0xd1')][_0x308e('0x18')]({'where':{'CmHopperId':{'$in':_[_0x308e('0x48')](_0x134f12,'id')}}});})[_0x308e('0x17')](function(){_0x5ea7b6(0x1);});});}function addCmHopperPhones(_0x51debb){return new Promise(function(_0x504299,_0x389eea){return db[_0x308e('0x8d')][_0x308e('0x88')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x51debb}})['then'](function(_0x49b6f9){var _0x255a52=[];_[_0x308e('0x48')](_0x49b6f9,function(_0x5562a6){_0x255a52[_0x308e('0x56')](createCmHopperPhone(_0x51debb,_0x5562a6['id']));});Promise[_0x308e('0xad')](_0x255a52)['then'](function(){_0x504299(0x1);});});});}function createCmHopperPhone(_0x35d430,_0x5e7bfc){return new Promise(function(_0x13c095,_0x358bae){db['CmContactHasItem'][_0x308e('0x88')]({'raw':!![],'attributes':[_0x308e('0xd2'),'OrderBy'],'where':{'CmContactId':_0x35d430,'ItemClass':'PHONE'},'include':[{'model':db[_0x308e('0xb3')],'attributes':[_0x308e('0xce')],'as':_0x308e('0xb4')}],'order':[_0x308e('0xce'),db[_0x308e('0x75')][_0x308e('0xb5')](_0x308e('0xd3'))]})[_0x308e('0x17')](function(_0x2e2714){var _0x224b44=0x1;var _0x5e4ecb=_[_0x308e('0x48')](_0x2e2714,function(_0x2315ca){_0x2315ca[_0x308e('0xd4')]=_0x5e7bfc;_0x2315ca[_0x308e('0xcd')]=_0x2315ca[_0x308e('0xd2')];_0x2315ca[_0x308e('0xce')]=_0x224b44;delete _0x2315ca[_0x308e('0xd5')];_0x224b44=_0x224b44+0x1;return _0x2315ca;});return db[_0x308e('0xd1')][_0x308e('0xa6')](_0x5e4ecb,{});})[_0x308e('0x17')](function(){_0x13c095(0x1);});});}function insertAdditionalPhones(_0x14108f,_0x200c69){return new Promise(function(_0x16645a,_0x547f97){var _0x186ef9=[];for(var _0x33a896=0x0;_0x33a896<_0x200c69[_0x308e('0x23')];_0x33a896++){var _0x526ed6=_0x200c69[_0x33a896];_0x186ef9[_0x308e('0x56')](parseContactItemType(_0x526ed6));}Promise[_0x308e('0xad')](_0x186ef9)[_0x308e('0x17')](function(){var _0x57caf7={'id':_0x14108f['id'],'items':_0x200c69};return addAdditionalPhones(_0x57caf7)[_0x308e('0x17')](function(_0x16f91e){return addCmHopperPhones(_0x14108f['id']);});})['then'](function(){_0x16645a(_0x14108f);});});}function parseContactItemType(_0x236fd5){return new Promise(function(_0x210cb1,_0x38e51d){if(_0x236fd5['hasOwnProperty']('ItemTypeId')){_0x210cb1(_0x236fd5);}else{return db[_0x308e('0xb3')]['find']({'where':{'name':_0x236fd5['ItemType']}})[_0x308e('0x17')](function(_0x395f5a){if(_[_0x308e('0x54')](_0x395f5a))_0x236fd5[_0x308e('0xcb')]=null;else _0x236fd5[_0x308e('0xcb')]=_0x395f5a['id'];_0x210cb1(_0x236fd5);});}});}exports['getAdditionalPhones']=function(_0x22b154,_0x38ebb1){return db['CmContactHasItem'][_0x308e('0x88')]({'raw':!![],'where':{'CmContactId':_0x22b154[_0x308e('0xb0')]['id'],'ItemClass':_0x308e('0xd0')},'include':[{'model':db[_0x308e('0xb3')],'as':'ItemType'}],'order':[[_0x308e('0xce')],[db[_0x308e('0x75')][_0x308e('0xb5')](_0x308e('0xd3'))]]})[_0x308e('0x17')](function(_0x3c4836){return _0x3c4836;})['then'](respondWithResult(_0x38ebb1,null))[_0x308e('0x82')](handleError(_0x38ebb1,null));};exports['duplicateAdditionalPhones']=function(_0x44dfc1,_0x13ab5c){return db[_0x308e('0xb1')]['findAll']({'raw':!![],'where':{'CmContactId':_0x44dfc1['body'][_0x308e('0xd6')]}})['then'](function(_0x18384f){var _0x1cc953=_[_0x308e('0x48')](_0x18384f,function(_0x3d1cd8){_0x3d1cd8[_0x308e('0xd7')]=_0x44dfc1[_0x308e('0x8a')][_0x308e('0xd8')];return _0x3d1cd8;});return db[_0x308e('0xb1')][_0x308e('0xa6')](_0x1cc953,{});})[_0x308e('0x17')](function(_0x38cc65){return addCmHopperPhones(_0x44dfc1['body']['toContactId']);})[_0x308e('0x17')](function(_0x2ede16){return['ok'];})[_0x308e('0x17')](respondWithResult(_0x13ab5c,null))[_0x308e('0x82')](handleError(_0x13ab5c,null));};exports[_0x308e('0xd9')]=function(_0x3a5aa4,_0x7156ac){var _0x22ab8d=[];_0x22ab8d[_0x308e('0x56')](createCmHopperPhone(_0x3a5aa4['body']['id'],_0x3a5aa4[_0x308e('0x8a')][_0x308e('0xda')]));Promise[_0x308e('0xad')](_0x22ab8d)[_0x308e('0x17')](function(){return[0x1];})[_0x308e('0x17')](respondWithResult(_0x7156ac,null));};exports[_0x308e('0xdb')]=function(_0x5a11a1,_0x2f5aca){var _0x163571={'raw':![],'where':{}};var _0x436854={};var _0x492912={'count':0x0,'rows':[]};return db[_0x308e('0x20')]['findOne']({'where':{'id':_0x5a11a1[_0x308e('0xb0')]['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x2f5aca,null))[_0x308e('0x17')](function(_0x2ec62d){if(_0x2ec62d){_0x436854[_0x308e('0x29')]=_[_0x308e('0x22')](db[_0x308e('0x8d')][_0x308e('0xc2')]);_0x436854['query']=_['keys'](_0x5a11a1['query']);_0x436854[_0x308e('0x33')]=_[_0x308e('0x2b')](_0x436854[_0x308e('0x29')],_0x436854['query']);_0x163571['attributes']=_[_0x308e('0x2b')](_0x436854[_0x308e('0x29')],qs[_0x308e('0x2d')](_0x5a11a1[_0x308e('0x2a')][_0x308e('0x2d')]));_0x163571[_0x308e('0x2c')]=_0x163571[_0x308e('0x2c')]['length']?_0x163571[_0x308e('0x2c')]:_0x436854[_0x308e('0x29')];if(!_0x5a11a1[_0x308e('0x2a')][_0x308e('0x2e')](_0x308e('0x2f'))){_0x163571[_0x308e('0x10')]=qs[_0x308e('0x10')](_0x5a11a1[_0x308e('0x2a')]['limit']);_0x163571[_0x308e('0x13')]=qs['offset'](_0x5a11a1['query'][_0x308e('0x13')]);}_0x163571[_0x308e('0x30')]=qs[_0x308e('0x31')](_0x5a11a1['query']['sort']);_0x163571[_0x308e('0x32')]=qs[_0x308e('0x33')](_[_0x308e('0x34')](_0x5a11a1[_0x308e('0x2a')],_0x436854[_0x308e('0x33')]));_0x163571[_0x308e('0x32')][_0x308e('0xdc')]=_0x2ec62d['id'];if(_0x5a11a1['query'][_0x308e('0x53')]){_0x163571[_0x308e('0x32')]=_[_0x308e('0xc3')](_0x163571[_0x308e('0x32')],{'$or':_[_0x308e('0x48')](_0x163571[_0x308e('0x2c')],function(_0x357ca){var _0x4c8e8b={};_0x4c8e8b[_0x357ca]={'$like':'%'+_0x5a11a1[_0x308e('0x2a')]['filter']+'%'};return _0x4c8e8b;})});}_0x163571=_[_0x308e('0xc3')]({},_0x163571,_0x5a11a1['options']);return db['CmHopper'][_0x308e('0x12')]({'where':_0x163571[_0x308e('0x32')]})[_0x308e('0x17')](function(_0x19b831){_0x492912[_0x308e('0x12')]=_0x19b831;if(_0x5a11a1[_0x308e('0x2a')][_0x308e('0xdd')]){_0x163571[_0x308e('0xde')]=[{'all':!![]}];}return db[_0x308e('0x8d')][_0x308e('0x88')](_0x163571);})[_0x308e('0x17')](function(_0x29797a){_0x492912[_0x308e('0x81')]=_0x29797a;return _0x492912;});}})[_0x308e('0x17')](respondWithFilteredResult(_0x2f5aca,_0x163571))['catch'](handleError(_0x2f5aca,null));};exports[_0x308e('0xdf')]=function(_0xcca448,_0x1e17f0){var _0x499f9b={'raw':!![],'where':{}};var _0x36db90={};var _0x4efb09={'count':0x0,'rows':[]};return db[_0x308e('0x20')][_0x308e('0x26')]({'where':{'id':_0xcca448[_0x308e('0xb0')]['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x1e17f0,null))[_0x308e('0x17')](function(_0xd09098){if(_0xd09098){_0x36db90[_0x308e('0x29')]=_[_0x308e('0x22')](db[_0x308e('0x9a')][_0x308e('0xc2')]);_0x36db90[_0x308e('0x2a')]=_[_0x308e('0x22')](_0xcca448['query']);_0x36db90[_0x308e('0x33')]=_[_0x308e('0x2b')](_0x36db90[_0x308e('0x29')],_0x36db90[_0x308e('0x2a')]);_0x499f9b[_0x308e('0x2c')]=_[_0x308e('0x2b')](_0x36db90[_0x308e('0x29')],qs[_0x308e('0x2d')](_0xcca448[_0x308e('0x2a')][_0x308e('0x2d')]));_0x499f9b['attributes']=_0x499f9b[_0x308e('0x2c')][_0x308e('0x23')]?_0x499f9b[_0x308e('0x2c')]:_0x36db90[_0x308e('0x29')];if(!_0xcca448[_0x308e('0x2a')][_0x308e('0x2e')]('nolimit')){_0x499f9b[_0x308e('0x10')]=qs[_0x308e('0x10')](_0xcca448[_0x308e('0x2a')][_0x308e('0x10')]);_0x499f9b[_0x308e('0x13')]=qs[_0x308e('0x13')](_0xcca448[_0x308e('0x2a')]['offset']);}_0x499f9b[_0x308e('0x30')]=qs[_0x308e('0x31')](_0xcca448['query'][_0x308e('0x31')]);_0x499f9b[_0x308e('0x32')]=qs[_0x308e('0x33')](_[_0x308e('0x34')](_0xcca448[_0x308e('0x2a')],_0x36db90[_0x308e('0x33')]));_0x499f9b[_0x308e('0x32')][_0x308e('0xdc')]=_0xd09098['id'];if(_0xcca448['query'][_0x308e('0x53')]){_0x499f9b[_0x308e('0x32')]=_[_0x308e('0xc3')](_0x499f9b[_0x308e('0x32')],{'$or':_[_0x308e('0x48')](_0x499f9b[_0x308e('0x2c')],function(_0x2702c7){var _0x899d56={};_0x899d56[_0x2702c7]={'$like':'%'+_0xcca448[_0x308e('0x2a')][_0x308e('0x53')]+'%'};return _0x899d56;})});}_0x499f9b=_[_0x308e('0xc3')]({},_0x499f9b,_0xcca448[_0x308e('0xc4')]);return db[_0x308e('0x9a')][_0x308e('0x12')]({'where':_0x499f9b[_0x308e('0x32')]})['then'](function(_0x1ae442){_0x4efb09[_0x308e('0x12')]=_0x1ae442;if(_0xcca448[_0x308e('0x2a')][_0x308e('0xdd')]){_0x499f9b['include']=[{'all':!![]}];}return db[_0x308e('0x9a')][_0x308e('0x88')](_0x499f9b);})[_0x308e('0x17')](function(_0x10f005){_0x4efb09[_0x308e('0x81')]=_0x10f005;return _0x4efb09;});}})['then'](respondWithFilteredResult(_0x1e17f0,_0x499f9b))[_0x308e('0x82')](handleError(_0x1e17f0,null));};exports['getHopperFinals']=function(_0x5bf4a4,_0x3544ed){var _0x21e185={'raw':!![],'where':{}};var _0x316716={};var _0x53a513={'count':0x0,'rows':[]};return db[_0x308e('0x20')]['findOne']({'where':{'id':_0x5bf4a4[_0x308e('0xb0')]['id']}})['then'](handleEntityNotFound(_0x3544ed,null))['then'](function(_0x1f90b3){if(_0x1f90b3){_0x316716[_0x308e('0x29')]=_[_0x308e('0x22')](db[_0x308e('0x99')][_0x308e('0xc2')]);_0x316716['query']=_['keys'](_0x5bf4a4['query']);_0x316716[_0x308e('0x33')]=_['intersection'](_0x316716[_0x308e('0x29')],_0x316716[_0x308e('0x2a')]);_0x21e185[_0x308e('0x2c')]=_['intersection'](_0x316716[_0x308e('0x29')],qs[_0x308e('0x2d')](_0x5bf4a4[_0x308e('0x2a')][_0x308e('0x2d')]));_0x21e185[_0x308e('0x2c')]=_0x21e185['attributes']['length']?_0x21e185[_0x308e('0x2c')]:_0x316716[_0x308e('0x29')];if(!_0x5bf4a4['query'][_0x308e('0x2e')](_0x308e('0x2f'))){_0x21e185[_0x308e('0x10')]=qs[_0x308e('0x10')](_0x5bf4a4[_0x308e('0x2a')][_0x308e('0x10')]);_0x21e185['offset']=qs[_0x308e('0x13')](_0x5bf4a4['query'][_0x308e('0x13')]);}_0x21e185[_0x308e('0x30')]=qs[_0x308e('0x31')](_0x5bf4a4['query'][_0x308e('0x31')]);_0x21e185[_0x308e('0x32')]=qs[_0x308e('0x33')](_[_0x308e('0x34')](_0x5bf4a4[_0x308e('0x2a')],_0x316716[_0x308e('0x33')]));_0x21e185[_0x308e('0x32')]['ContactId']=_0x1f90b3['id'];if(_0x5bf4a4[_0x308e('0x2a')][_0x308e('0x53')]){_0x21e185['where']=_['merge'](_0x21e185[_0x308e('0x32')],{'$or':_['map'](_0x21e185[_0x308e('0x2c')],function(_0x13025e){var _0x58fbe3={};_0x58fbe3[_0x13025e]={'$like':'%'+_0x5bf4a4['query'][_0x308e('0x53')]+'%'};return _0x58fbe3;})});}_0x21e185=_['merge']({},_0x21e185,_0x5bf4a4[_0x308e('0xc4')]);return db[_0x308e('0x99')][_0x308e('0x12')]({'where':_0x21e185[_0x308e('0x32')]})[_0x308e('0x17')](function(_0x156529){_0x53a513[_0x308e('0x12')]=_0x156529;if(_0x5bf4a4[_0x308e('0x2a')][_0x308e('0xdd')]){_0x21e185[_0x308e('0xde')]=[{'all':!![]}];}return db[_0x308e('0x99')]['findAll'](_0x21e185);})['then'](function(_0x2585d6){_0x53a513[_0x308e('0x81')]=_0x2585d6;return _0x53a513;});}})[_0x308e('0x17')](respondWithFilteredResult(_0x3544ed,_0x21e185))[_0x308e('0x82')](handleError(_0x3544ed,null));};exports['getJscriptySessions']=function(_0x5c8760,_0x6b5a92){var _0x5c071b={'raw':!![],'where':{}};var _0x22079b={};var _0x3633d1={'count':0x0,'rows':[]};return db[_0x308e('0x20')][_0x308e('0x26')]({'where':{'id':_0x5c8760[_0x308e('0xb0')]['id']}})[_0x308e('0x17')](handleEntityNotFound(_0x6b5a92,null))[_0x308e('0x17')](function(_0x4055ac){if(_0x4055ac){_0x22079b[_0x308e('0x29')]=_[_0x308e('0x22')](db[_0x308e('0xa0')]['rawAttributes']);_0x22079b[_0x308e('0x2a')]=_[_0x308e('0x22')](_0x5c8760[_0x308e('0x2a')]);_0x22079b[_0x308e('0x33')]=_[_0x308e('0x2b')](_0x22079b['model'],_0x22079b['query']);_0x5c071b[_0x308e('0x2c')]=_[_0x308e('0x2b')](_0x22079b[_0x308e('0x29')],qs[_0x308e('0x2d')](_0x5c8760[_0x308e('0x2a')][_0x308e('0x2d')]));_0x5c071b['attributes']=_0x5c071b[_0x308e('0x2c')][_0x308e('0x23')]?_0x5c071b[_0x308e('0x2c')]:_0x22079b['model'];if(!_0x5c8760[_0x308e('0x2a')][_0x308e('0x2e')]('nolimit')){_0x5c071b['limit']=qs[_0x308e('0x10')](_0x5c8760[_0x308e('0x2a')][_0x308e('0x10')]);_0x5c071b[_0x308e('0x13')]=qs[_0x308e('0x13')](_0x5c8760[_0x308e('0x2a')]['offset']);}_0x5c071b[_0x308e('0x30')]=qs[_0x308e('0x31')](_0x5c8760['query'][_0x308e('0x31')]);_0x5c071b[_0x308e('0x32')]=qs['filters'](_[_0x308e('0x34')](_0x5c8760[_0x308e('0x2a')],_0x22079b[_0x308e('0x33')]));_0x5c071b[_0x308e('0x32')][_0x308e('0xdc')]=_0x4055ac['id'];if(_0x5c8760['query'][_0x308e('0x53')]){_0x5c071b[_0x308e('0x32')]=_['merge'](_0x5c071b[_0x308e('0x32')],{'$or':_[_0x308e('0x48')](_0x5c071b[_0x308e('0x2c')],function(_0x542196){var _0x190d1e={};_0x190d1e[_0x542196]={'$like':'%'+_0x5c8760[_0x308e('0x2a')][_0x308e('0x53')]+'%'};return _0x190d1e;})});}_0x5c071b=_[_0x308e('0xc3')]({},_0x5c071b,_0x5c8760[_0x308e('0xc4')]);return db['JscriptySessionReport']['count']({'where':_0x5c071b['where']})[_0x308e('0x17')](function(_0xe82457){_0x3633d1[_0x308e('0x12')]=_0xe82457;if(_0x5c8760['query'][_0x308e('0xdd')]){_0x5c071b[_0x308e('0xde')]=[{'all':!![]}];}return db[_0x308e('0xa0')][_0x308e('0x88')](_0x5c071b);})['then'](function(_0x302ac0){_0x3633d1[_0x308e('0x81')]=_0x302ac0;return _0x3633d1;});}})['then'](respondWithFilteredResult(_0x6b5a92,_0x5c071b))[_0x308e('0x82')](handleError(_0x6b5a92,null));};exports[_0x308e('0xe0')]=function(_0x3e6ce2,_0x6411fe){try{if(!_0x3e6ce2[_0x308e('0x8a')][_0x308e('0x58')]){throw new Error(_0x308e('0xe1'));}if(!_0x3e6ce2['body'][_0x308e('0xe2')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3e6ce2[_0x308e('0x8a')][_0x308e('0xe3')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3e6ce2[_0x308e('0x8a')]['socket_timestamp']){throw new Error(_0x308e('0xe4'));}var _0x2cac1b=_0x3e6ce2[_0x308e('0x8a')]['binding_keys'][_0x308e('0x47')](',');var _0xa3ccd6=_0x3e6ce2['body'][_0x308e('0xe3')][_0x308e('0x47')](',');if(!_0x2cac1b[_0x308e('0x23')]||!_0xa3ccd6[_0x308e('0x23')]||_0x2cac1b[_0x308e('0x23')]!==_0xa3ccd6[_0x308e('0x23')]){throw new Error(_0x308e('0xe5'));}_0x3e6ce2[_0x308e('0x8a')][_0x308e('0x2d')]=_[_0x308e('0xe6')](_0x2cac1b,_0xa3ccd6);if(!_0x3e6ce2[_0x308e('0x8a')][_0x308e('0x2d')][_0x308e('0xcd')]){throw new Error(_0x308e('0xe7'));}if(!_0x3e6ce2['body'][_0x308e('0x2d')]['firstName']){throw new Error(_0x308e('0xe8'));}var _0x4d82fd=path[_0x308e('0xe9')](config[_0x308e('0xea')],_0x308e('0xeb'),_0x3e6ce2[_0x308e('0xec')][_0x308e('0xed')]);fs[_0x308e('0xee')](_0x4d82fd,parseInt(_0x308e('0xef'),0x8));var _0x5a90fb=require(_0x308e('0xf0'))[_0x308e('0xf1')](path['join'](__dirname,_0x308e('0xf2')),[_0x4d82fd,_0x3e6ce2[_0x308e('0x8a')][_0x308e('0xe2')],_0x3e6ce2['body'][_0x308e('0xe3')],_0x3e6ce2['body'][_0x308e('0x58')],_0x3e6ce2[_0x308e('0x8a')][_0x308e('0xf3')],_0x3e6ce2[_0x308e('0x8a')]['duplicates'],_0x3e6ce2[_0x308e('0x8a')][_0x308e('0xf4')]]);return _0x6411fe[_0x308e('0x14')](0xc8)[_0x308e('0xf')]({'message':_0x308e('0xf5'),'pid':_0x5a90fb[_0x308e('0xf6')]});}catch(_0x2b1a80){return _0x6411fe['status'](0x1f4)[_0x308e('0x1e')](_0x2b1a80);}};exports[_0x308e('0xf7')]=function(_0x323d16,_0x1bb737){var _0x376fa5=fs[_0x308e('0xf8')](_0x323d16['file'][_0x308e('0x2')]);Papa[_0x308e('0xf9')](_0x376fa5,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x409817){return _0x1bb737['status'](0xc8)[_0x308e('0xf')]({'file':_0x323d16[_0x308e('0xec')],'fields':_0x409817[_0x308e('0xfa')][_0x308e('0x2d')]});}});};exports[_0x308e('0xfb')]=function(_0x40871f,_0x69cfa9){return db[_0x308e('0x4c')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x308e('0x71')}})[_0x308e('0x17')](function(_0x1ef985){var _0x4b9d3d=![];if(!_0x40871f[_0x308e('0x8a')][_0x308e('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x40871f[_0x308e('0x8a')][_0x308e('0xfc')][_0x308e('0xcd')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x40871f['body'][_0x308e('0xfc')][_0x308e('0xfd')]){throw new Error(_0x308e('0xe8'));}if(!_0x40871f[_0x308e('0x8a')][_0x308e('0xf4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1ae4bd=require('child_process')[_0x308e('0xf1')](path[_0x308e('0xe9')](__dirname,_0x308e('0xfe')),[_0x40871f['params']['id'],JSON[_0x308e('0xff')](_0x40871f[_0x308e('0x8a')]),JSON[_0x308e('0xff')](_0x1ef985)]);_0x1ae4bd['on'](_0x308e('0x100'),function(){_0x4b9d3d=!![];return _0x69cfa9[_0x308e('0x14')](0xc8)[_0x308e('0xf')]({'message':_0x308e('0x101'),'pid':_0x1ae4bd['pid']});});_0x1ae4bd['on'](_0x308e('0x102'),function(_0x3f58d1){if(_0x3f58d1&&!_0x4b9d3d){return _0x69cfa9[_0x308e('0x14')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x1ae4bd['pid']});}});})[_0x308e('0x82')](handleError(_0x69cfa9,null));};exports[_0x308e('0x103')]=function(_0x23de62,_0x1f2fa7,_0x402e7a){return db[_0x308e('0x4c')][_0x308e('0x88')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x308e('0x17')](function(_0x26dc98){var _0x14b9ba=![];if(!_0x23de62[_0x308e('0x8a')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x23de62[_0x308e('0x8a')][_0x308e('0xfc')][_0x308e('0xcd')]){throw new Error(_0x308e('0xe7'));}if(!_0x23de62[_0x308e('0x8a')][_0x308e('0xfc')][_0x308e('0xfd')]){throw new Error(_0x308e('0xe8'));}if(!_0x23de62[_0x308e('0x8a')]['socket_timestamp']){throw new Error(_0x308e('0xe4'));}var _0x29681b=require(_0x308e('0xf0'))[_0x308e('0xf1')](path[_0x308e('0xe9')](__dirname,_0x308e('0x104')),[_0x23de62[_0x308e('0xb0')]['id'],JSON[_0x308e('0xff')](_0x23de62[_0x308e('0x8a')]),JSON['stringify'](_0x26dc98)]);_0x29681b['on'](_0x308e('0x100'),function(_0x52c300){_0x14b9ba=!![];return _0x1f2fa7[_0x308e('0x14')](0xc8)[_0x308e('0xf')]({'message':_0x308e('0x101'),'pid':_0x29681b[_0x308e('0xf6')]});});_0x29681b['on'](_0x308e('0x102'),function(_0x5e23a7){if(_0x5e23a7&&!_0x14b9ba){return _0x1f2fa7['status'](0x1f4)[_0x308e('0xf')]({'message':_0x308e('0x105'),'pid':_0x29681b[_0x308e('0xf6')]});}});})['catch'](handleError(_0x1f2fa7,null));};exports['getJourney']=function(_0x22c474,_0x4a491c){var _0x220393=[_0x308e('0x106'),_0x308e('0x107'),_0x308e('0x108'),'openchannel','fax','whatsapp',_0x308e('0x109')];var _0x4c40d6={'offset':0x0,'order':qs[_0x308e('0x31')](_0x308e('0x10a'))},_0x582221={'count':0x0,'rows':[]};Promise['resolve']()[_0x308e('0x17')](function(){if(_0x22c474[_0x308e('0x2a')]['channel']){if(!_[_0x308e('0x10b')](_0x220393,_0x22c474['query'][_0x308e('0x10c')][_0x308e('0x10d')]())){throw new Error(_0x308e('0x10e'));}_0x220393=[_0x22c474[_0x308e('0x2a')][_0x308e('0x10c')][_0x308e('0x10d')]()];}if(_0x22c474[_0x308e('0x2a')][_0x308e('0x10f')]){try{var _0x2fdd0c=JSON['parse'](_0x22c474[_0x308e('0x2a')][_0x308e('0x10f')]);if(!moment(_0x2fdd0c[_0x308e('0x38')])[_0x308e('0x110')]()){throw new Error(_0x308e('0x111'));}if(!moment(_0x2fdd0c['to'])['isValid']()){throw new Error(_0x308e('0x112'));}}catch(_0x41d367){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x22c474[_0x308e('0x2a')][_0x308e('0x2e')](_0x308e('0x2f'))){_0x4c40d6['limit']=qs[_0x308e('0x10')](_0x22c474[_0x308e('0x2a')][_0x308e('0x10')]||0xa);_0x4c40d6[_0x308e('0x13')]=qs[_0x308e('0x13')](_0x22c474[_0x308e('0x2a')]['offset']);}var _0x45f1ce=_0x220393[_0x308e('0x48')](function(_0x248bf1){if(_0x248bf1===_0x308e('0x109')){var _0x413085={'attributes':['id','uniqueid',_0x308e('0x28'),_0x308e('0x113'),_0x308e('0x114'),_0x308e('0x115'),_0x308e('0x116'),_0x308e('0x117'),_0x308e('0x118'),_0x308e('0x119'),'createdAt',_0x308e('0x11a'),'userSecondDisposition',_0x308e('0x11b'),'UserId'],'where':{'ContactId':_0x22c474[_0x308e('0xb0')]['id']},'include':[{'model':db['User'],'as':_0x308e('0x4c'),'attributes':['id','name',_0x308e('0x11c'),_0x308e('0x11d')]}],'order':[[_0x308e('0x11e'),_0x308e('0x6d')]]};if(_0x22c474[_0x308e('0x2a')][_0x308e('0x10f')]){_0x413085[_0x308e('0x32')]['createdAt']={'$gte':_0x2fdd0c[_0x308e('0x38')],'$lte':_0x2fdd0c['to']};}return db[_0x308e('0x9b')][_0x308e('0x11f')](_0x413085)['then'](function(_0x5e2aa9){_0x582221[_0x308e('0x12')]+=_0x5e2aa9[_0x308e('0x12')];return _['map'](_0x5e2aa9['rows'],function(_0x197dff){var _0x302a4e=_0x197dff['get']({'plain':!![]});_0x302a4e['channel']=_0x248bf1;if(_0x302a4e['User']){_0x302a4e[_0x308e('0x4c')]={'id':_0x302a4e['User']['id'],'name':_0x302a4e['User'][_0x308e('0x1d')],'fullname':_0x302a4e[_0x308e('0x4c')][_0x308e('0x11c')],'alias':_0x302a4e[_0x308e('0x4c')][_0x308e('0x11d')]};}return _0x302a4e;});});}else{var _0x158de7=_[_0x308e('0x120')](_0x248bf1)+(_0x248bf1===_0x308e('0x107')?_0x308e('0x121'):_0x308e('0x122'));var _0x4afe3f={'attributes':['id',_0x308e('0x123'),_0x308e('0x124'),_0x308e('0x11e'),'note',_0x308e('0x125'),'secondDisposition',_0x308e('0x126'),_0x308e('0x127'),_0x158de7+'Id'],'where':{'ContactId':_0x22c474['params']['id']},'include':[{'model':db[_0x158de7],'as':_0x308e('0x122'),'attributes':['id',_0x308e('0x1d'),_0x308e('0x128')]},{'model':db[_0x308e('0x4c')],'as':_0x308e('0x129'),'attributes':['id',_0x308e('0x1d'),_0x308e('0x11c')]},{'model':db[_0x308e('0x45')],'as':_0x308e('0x80'),'attributes':['id',_0x308e('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x308e('0x11e'),_0x308e('0x6d')]]};if(_0x22c474[_0x308e('0x2a')][_0x308e('0x10f')]){_0x4afe3f[_0x308e('0x32')][_0x308e('0x11e')]={'$gte':_0x2fdd0c['from'],'$lte':_0x2fdd0c['to']};}switch(_0x248bf1){case _0x308e('0x107'):_0x4afe3f[_0x308e('0x2c')][_0x308e('0x56')](_0x308e('0x12a'),_0x308e('0x12b'),_0x308e('0x12c'),_0x308e('0x12d'),_0x308e('0x12e'),_0x308e('0x12f'),_0x308e('0x130'),'ratingValue',_0x308e('0x131'));break;case _0x308e('0x106'):_0x4afe3f[_0x308e('0x2c')][_0x308e('0x56')](_0x308e('0x132'),'substatus');break;case _0x308e('0x133'):_0x4afe3f[_0x308e('0x2c')]['push']('externalUrl',_0x308e('0x134'));break;}return db[_[_0x308e('0x120')](_0x248bf1)+_0x308e('0x135')][_0x308e('0x11f')](_0x4afe3f)[_0x308e('0x17')](function(_0xf292e){_0x582221[_0x308e('0x12')]+=_0xf292e['count'];return _['map'](_0xf292e['rows'],function(_0x11f55a){var _0x12b1b6=_0x11f55a[_0x308e('0xb7')]({'plain':!![]});_0x12b1b6[_0x308e('0x10c')]=_0x248bf1;if(_0x12b1b6[_0x308e('0x129')]){_0x12b1b6[_0x308e('0x129')]={'id':_0x12b1b6['Owner']['id'],'name':_0x12b1b6['Owner'][_0x308e('0x1d')],'fullname':_0x12b1b6[_0x308e('0x129')][_0x308e('0x11c')]};}return _0x12b1b6;});});}});return Promise['all'](_0x45f1ce);})[_0x308e('0x17')](function(_0xfb1ac9){return _(_0xfb1ac9)[_0x308e('0x136')]()[_0x308e('0x137')](_0x308e('0x11e'))[_0x308e('0x138')]()[_0x308e('0x46')]();})[_0x308e('0x17')](function(_0xa4ee88){_0x582221[_0x308e('0x81')]=_0x4c40d6[_0x308e('0x10')]?_0xa4ee88[_0x308e('0x139')](_0x4c40d6[_0x308e('0x13')],_0x4c40d6[_0x308e('0x13')]+_0x4c40d6[_0x308e('0x10')]):_0xa4ee88;return _0x582221;})[_0x308e('0x17')](respondWithFilteredResult(_0x4a491c,_0x4c40d6))[_0x308e('0x82')](handleError(_0x4a491c,null));}; \ No newline at end of file +var _0x9deb=['binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','filename','chmodSync','0777','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','import','binding','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','sms','fax','whatsapp','voice','channel','includes','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','findAndCountAll','startCase','chat','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','customerPort','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','reverse','slice','moment','bluebird','path','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','status','json','undefined','count','offset','limit','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','CmContact','describe','length','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','field','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','DATE','text','start','end','filter','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','order','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','rows','catch','params','tags','columnName','displayName','analytics','alias','values','body','findAll','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','update','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','$or','findOrCreate','contact','show','Tags','Phones','ContactItemType','ItemType','literal','omit','format','cf_%d','$and','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','options','getHopperHistories','CmHopperHistory','includeAll','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys'];(function(_0x3fc7cf,_0x557782){var _0x317a93=function(_0x578278){while(--_0x578278){_0x3fc7cf['push'](_0x3fc7cf['shift']());}};_0x317a93(++_0x557782);}(_0x9deb,0x186));var _0xb9de=function(_0x2c98d9,_0x10d27f){_0x2c98d9=_0x2c98d9-0x0;var _0x4a0f83=_0x9deb[_0x2c98d9];return _0x4a0f83;};'use strict';var moment=require(_0xb9de('0x0'));var BPromise=require(_0xb9de('0x1'));var util=require('util');var path=require(_0xb9de('0x2'));var fs=require('fs');var _=require(_0xb9de('0x3'));var squel=require(_0xb9de('0x4'));var Papa=require(_0xb9de('0x5'));var Redis=require('ioredis');var qs=require(_0xb9de('0x6'));var as=require(_0xb9de('0x7'));var logger=require(_0xb9de('0x8'))(_0xb9de('0x9'));var config=require(_0xb9de('0xa'));var shared=require('../../config/environment/shared');var db=require(_0xb9de('0xb'))['db'];config[_0xb9de('0xc')]=_[_0xb9de('0xd')](config[_0xb9de('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9de('0xe'))(new Redis(config[_0xb9de('0xc')]));require(_0xb9de('0xf'))['register'](socket);function respondWithResult(_0x464095,_0x31a17f){_0x31a17f=_0x31a17f||0xc8;return function(_0x5b1820){if(_0x5b1820){return _0x464095[_0xb9de('0x10')](_0x31a17f)[_0xb9de('0x11')](_0x5b1820);}};}function respondWithFilteredResult(_0x142081,_0x3dfe74){return function(_0x48d9e5){if(_0x48d9e5){var _0x325995=typeof _0x3dfe74['offset']===_0xb9de('0x12')&&typeof _0x3dfe74['limit']==='undefined';var _0x54b4c0=_0x48d9e5[_0xb9de('0x13')];var _0x535860=_0x325995?0x0:_0x3dfe74[_0xb9de('0x14')];var _0x1a913e=_0x325995?_0x48d9e5[_0xb9de('0x13')]:_0x3dfe74[_0xb9de('0x14')]+_0x3dfe74[_0xb9de('0x15')];var _0x52da1d;if(_0x1a913e>=_0x54b4c0){_0x1a913e=_0x54b4c0;_0x52da1d=0xc8;}else{_0x52da1d=0xce;}_0x142081['status'](_0x52da1d);return _0x142081[_0xb9de('0x16')](_0xb9de('0x17'),_0x535860+'-'+_0x1a913e+'/'+_0x54b4c0)[_0xb9de('0x11')](_0x48d9e5);}return null;};}function saveUpdates(_0x394d93){return function(_0x47c737){if(_0x47c737){return _0x47c737['update'](_0x394d93)[_0xb9de('0x18')](function(_0x2950b7){return _0x2950b7;});}return null;};}function removeEntity(_0x23167d){return function(_0x33fdce){if(_0x33fdce){return _0x33fdce[_0xb9de('0x19')]()['then'](function(){_0x23167d[_0xb9de('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f2694){return function(_0x1a136b){if(!_0x1a136b){_0x2f2694[_0xb9de('0x1a')](0x194);}return _0x1a136b;};}function handleError(_0x247232,_0x501f78){_0x501f78=_0x501f78||0x1f4;return function(_0x31aec7){logger[_0xb9de('0x1b')](_0x31aec7[_0xb9de('0x1c')]);if(_0x31aec7[_0xb9de('0x1d')]){delete _0x31aec7[_0xb9de('0x1d')];}_0x247232[_0xb9de('0x10')](_0x501f78)[_0xb9de('0x1e')](_0x31aec7);};}exports['index']=function(_0x583c01,_0x867600){var _0x14f258={},_0x4297a5={},_0x5451ee={'count':0x0,'rows':[]};return db[_0xb9de('0x1f')][_0xb9de('0x20')]()['then'](function(_0x9ea518){var _0x20e4d1=[];for(var _0x86b01f=0x0;_0x86b01f0x1){_0x1fb106['or'](_0xb9de('0x61'),qs[_0xb9de('0x62')](_0x5b16cb),null);}else{if(qs[_0xb9de('0x63')](_0x5b16cb)){_0x1fb106['or']('c.id\x20LIKE\x20?',_0x5b16cb+'%');_0x1fb106['or'](_0xb9de('0x64'),_0x5b16cb+'%');_0x1fb106['or'](_0xb9de('0x65'),_0x5b16cb+'%');_0x1fb106['or'](_0xb9de('0x66'),_0x5b16cb+'%');}else if(qs[_0xb9de('0x67')](_0x5b16cb)){_0x1fb106['or']('c.email\x20LIKE\x20?',_0x5b16cb+'%');}else{_0x1fb106['or']('c.firstName\x20LIKE\x20?','%'+_0x5b16cb+'%');_0x1fb106['or']('c.lastName\x20LIKE\x20?','%'+_0x5b16cb+'%');_0x1fb106['or'](_0xb9de('0x68'),'%'+_0x5b16cb+'%');}}}}_0x20815d['where'](_0x1fb106);_0x20815d[_0xb9de('0x69')](_0xb9de('0x6a'));var _0xe4997f={'type':db[_0xb9de('0x6b')][_0xb9de('0x6c')]['SELECT'],'raw':!![]};var _0x3056c5=_0x20815d[_0xb9de('0x6d')]()[_0xb9de('0x36')]('c.id');if(_0x14f258[_0xb9de('0x6e')]){_0x14f258['order'][_0xb9de('0x4a')](function(_0x39ed9e){_0x20815d['order']('c.'+_0x39ed9e[0x0],_0x39ed9e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb9de('0x5a')](_0x2cdb37)){_0x20815d['having'](_0xd2b267);_0x3056c5[_0xb9de('0x3f')](_0xb9de('0x6f'),_0x2cdb37);}BPromise[_0xb9de('0x70')]()[_0xb9de('0x18')](function(){if(!_0x4b2d09)return;if(_0x583c01[_0xb9de('0x71')][_0xb9de('0x72')]!==_0xb9de('0x73'))return;if(!_[_0xb9de('0x74')](_0x4b2d09['conditions'],[_0xb9de('0x36'),_0xb9de('0x4d')])){return _0x583c01[_0xb9de('0x71')][_0xb9de('0x75')]({'attributes':['id'],'raw':!![]})[_0xb9de('0x18')](function(_0x263f06){if(_[_0xb9de('0x5a')](_0x263f06)){_0x3056c5[_0xb9de('0x3f')](_0xb9de('0x76'));_0x20815d['where'](_0xb9de('0x76'));}else{_0x3056c5['where'](_0xb9de('0x5b'),_[_0xb9de('0x49')](_0x263f06,'id'));_0x20815d[_0xb9de('0x3f')](_0xb9de('0x5b'),_['map'](_0x263f06,'id'));}});}})['then'](function(){if(_0x583c01['user']['role']===_0xb9de('0x73')&&!_0x4b2d09&&!_0x583c01['query'][_0xb9de('0x77')])return[];return db[_0xb9de('0x78')][_0xb9de('0x2d')](_0x3056c5[_0xb9de('0x79')](),_0xe4997f);})[_0xb9de('0x18')](function(_0x545ade){_0x5451ee['count']=_0x545ade[_0xb9de('0x21')];if(_0x5451ee[_0xb9de('0x13')]===0x0)return[];return db['sequelize']['query'](_0x11110a['toString'](),_0xe4997f)[_0xb9de('0x18')](function(_0x489522){_0x4e3adc=_[_0xb9de('0x7a')](_0x489522,'id');_0xe4997f=_[_0xb9de('0x7b')](_0xe4997f,{'model':db[_0xb9de('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x583c01[_0xb9de('0x2d')][_0xb9de('0x31')]){_0x14f258[_0xb9de('0x30')]['forEach'](function(_0x10e084){_0x20815d[_0xb9de('0x36')]('c.'+_0x10e084);});}else{_0x20815d['field']('c.id');_0x20815d[_0xb9de('0x36')]('c.firstName');_0x20815d['field'](_0xb9de('0x7c'));_0x20815d[_0xb9de('0x36')](_0xb9de('0x7d'));_0x20815d['field'](_0xb9de('0x7e'));_0x20815d[_0xb9de('0x36')]('c.fax');_0x20815d[_0xb9de('0x36')](_0xb9de('0x7f'));_0x20815d['field'](_0xb9de('0x80'));_0x20815d[_0xb9de('0x36')](_0xb9de('0x81'));_0x20815d[_0xb9de('0x36')](_0xb9de('0x82'));_0x20815d[_0xb9de('0x36')](_0xb9de('0x83'));_0x20815d[_0xb9de('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb9de('0x84'));}if(_0x14f258[_0xb9de('0x15')])_0x20815d[_0xb9de('0x15')](_0x14f258[_0xb9de('0x15')]);if(_0x14f258[_0xb9de('0x14')])_0x20815d['offset'](_0x14f258['offset']);return db['sequelize']['query'](_0x20815d['toString'](),_0xe4997f);});})[_0xb9de('0x18')](function(_0x2dc07e){_0x2dc07e[_0xb9de('0x4a')](function(_0x291613){if(_0x291613[_0xb9de('0x84')]){_0x291613['Tags']=[];_0x291613['TagIds'][_0xb9de('0x48')](',')['forEach'](function(_0x3bf44c){_0x291613['Tags']['push'](_0x4e3adc[_0x3bf44c]);});}delete _0x291613[_0xb9de('0x84')];});_0x5451ee[_0xb9de('0x85')]=_0x2dc07e;return _0x5451ee;})['then'](respondWithFilteredResult(_0x867600,_0x14f258));})[_0xb9de('0x86')](handleError(_0x867600,null));};exports[_0xb9de('0x19')]=function(_0x58c0e1,_0x131458){return db[_0xb9de('0x1f')][_0xb9de('0x46')]({'where':{'id':_0x58c0e1[_0xb9de('0x87')]['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x131458,null))['then'](removeEntity(_0x131458,null))[_0xb9de('0x86')](handleError(_0x131458,null));};exports['describe']=function(_0x11468c,_0x26e705){return db[_0xb9de('0x1f')][_0xb9de('0x20')]()[_0xb9de('0x18')](function(_0x31facd){delete _0x31facd[_0xb9de('0x88')];for(var _0x2420de=0x0;_0x2420de0x0){return new Promise(function(_0x2b3bec,_0x2c189b){var _0x4afb0d=[];for(var _0x51b2e5=0x0;_0x51b2e5<_0x264c9d['length'];_0x51b2e5++){_0x4afb0d['push'](insertAdditionalPhones(_0x264c9d[_0x51b2e5][_0xb9de('0xb4')],_0x264c9d[_0x51b2e5][_0xb9de('0xaf')]));}Promise['all'](_0x4afb0d)['then'](function(){_0x2b3bec(0x1);});})['then'](function(){return{'success':_0x2661af,'failure':_0x13b25f,'duplicates':_0x1ac851};});}else{return{'success':_0x2661af,'failure':_0x13b25f,'duplicates':_0x1ac851};}}})[_0xb9de('0x18')](respondWithResult(_0x39930d,0xc9))[_0xb9de('0x86')](handleError(_0x39930d,null));};exports[_0xb9de('0xb5')]=function(_0x4dd2b0,_0x1dee28){var _0x736150;return db[_0xb9de('0x1f')][_0xb9de('0x20')]()[_0xb9de('0x18')](function(_0x1866ad){return db['CmContact'][_0xb9de('0x46')]({'where':{'id':_0x4dd2b0[_0xb9de('0x87')]['id']},'include':[{'model':db['Tag'],'as':_0xb9de('0xb6'),'attributes':['id',_0xb9de('0x1d'),_0xb9de('0x37')],'required':_0x4dd2b0['query'][_0xb9de('0x5e')]?!![]:![]},{'model':db[_0xb9de('0xa2')],'as':_0xb9de('0xb7'),'where':{'CmContactId':_0x4dd2b0[_0xb9de('0x87')]['id']},'required':![],'include':[{'model':db[_0xb9de('0xb8')],'as':_0xb9de('0xb9')}]}],'order':[db['sequelize'][_0xb9de('0xba')]('Phones.OrderBy')],'attributes':_[_0xb9de('0x22')](_0x1866ad)});})[_0xb9de('0x18')](function(_0x2809d4){if(!_['isNil'](_0x2809d4)){_0x736150=_0x2809d4['get']({'plain':!![]});var _0x2e3eed={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2809d4&&_0x2809d4['ListId']){if(_0x2809d4[_0xb9de('0x77')]){_0x2e3eed[_0xb9de('0x3f')]['$and'][_0xb9de('0x25')]({'ListId':{'$ne':_0x2809d4[_0xb9de('0x77')]}});}}return db[_0xb9de('0x26')][_0xb9de('0x8f')](_0x2e3eed);}})[_0xb9de('0x18')](function(_0x22ef5b){if(!_['isNil'](_0x22ef5b)){return _[_0xb9de('0xbb')](_0x736150,_['map'](_0x22ef5b,function(_0x27ac7a){return util[_0xb9de('0xbc')](_0xb9de('0xbd'),_0x27ac7a['id']);}));}})[_0xb9de('0x18')](handleEntityNotFound(_0x1dee28,null))[_0xb9de('0x18')](respondWithResult(_0x1dee28,null))[_0xb9de('0x86')](handleError(_0x1dee28,null));};exports[_0xb9de('0x9d')]=function(_0x565ad6,_0x3d910a){var _0x3b8f96;if(_0x565ad6['body']['id']){delete _0x565ad6[_0xb9de('0x8e')]['id'];}if(!_[_0xb9de('0x58')](_0x565ad6[_0xb9de('0x8e')][_0xb9de('0xac')])){var _0x4981e6=_0x565ad6[_0xb9de('0x8e')][_0xb9de('0xac')];if(!_['isNil'](shared[_0xb9de('0xad')][_0x4981e6]))_0x565ad6[_0xb9de('0x8e')]['utcOffset']=shared[_0xb9de('0xad')][_0x4981e6][_0xb9de('0xae')];}return db[_0xb9de('0x1f')][_0xb9de('0x46')]({'where':{'id':_0x565ad6[_0xb9de('0x87')]['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x3d910a,null))['then'](saveUpdates(_0x565ad6[_0xb9de('0x8e')],null))[_0xb9de('0x18')](function(_0x3426f9){_0x3b8f96=_0x3426f9;var _0x2b5e02={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3426f9&&_0x3426f9[_0xb9de('0x77')]){if(_0x3426f9[_0xb9de('0x77')]){_0x2b5e02[_0xb9de('0x3f')][_0xb9de('0xbe')][_0xb9de('0x25')]({'ListId':{'$ne':_0x3426f9[_0xb9de('0x77')]}});}}return db[_0xb9de('0x26')][_0xb9de('0x8f')](_0x2b5e02);})['then'](function(_0x30e6b5){if(_0x30e6b5){return _[_0xb9de('0xbb')](_[_0xb9de('0xbf')](_0x565ad6[_0xb9de('0x8e')],function(_0x42216d,_0x261806){return _[_0xb9de('0x23')](_0x261806,_0xb9de('0x24'));}),_[_0xb9de('0x49')](_0x30e6b5,function(_0x13693d){return util[_0xb9de('0xbc')](_0xb9de('0xbd'),_0x13693d['id']);}));}})['then'](function(_0x4287c2){if(_0x4287c2&&!_[_0xb9de('0x5a')](_0x4287c2)){var _0x4d2407=squel['update']()[_0xb9de('0xc0')](_0xb9de('0x39'))[_0xb9de('0xc1')](_0x4287c2)[_0xb9de('0x3f')](_0xb9de('0xc2'),_0x565ad6[_0xb9de('0x87')]['id'])[_0xb9de('0xc3')]();return db[_0xb9de('0x78')][_0xb9de('0x2d')](_0x4d2407['text'],{'replacements':_0x4d2407[_0xb9de('0x8d')]});}})['then'](function(){if(_0x565ad6[_0xb9de('0x8e')]['phone']&&_0x3b8f96){return db[_0xb9de('0x94')][_0xb9de('0x9d')]({'phone':_0x565ad6[_0xb9de('0x8e')][_0xb9de('0xc4')],'OrderBy':0x0},{'where':{'ContactId':_0x3b8f96['id']}});}})[_0xb9de('0x18')](function(){return _0x3b8f96;})[_0xb9de('0x18')](respondWithResult(_0x3d910a,null))[_0xb9de('0x86')](handleError(_0x3d910a,null));};exports[_0xb9de('0xc5')]=function(_0x32c750,_0x37c7e2){var _0x52b933={};var _0x52b129={};var _0x5b4c6e;var _0x2e5bf4;return db[_0xb9de('0x1f')]['findOne']({'where':{'id':_0x32c750[_0xb9de('0x87')]['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x37c7e2,null))[_0xb9de('0x18')](function(_0xaf2ce0){if(_0xaf2ce0){_0x5b4c6e=_0xaf2ce0;_0x52b129[_0xb9de('0x2c')]=_[_0xb9de('0x22')](db[_0xb9de('0x47')][_0xb9de('0xc6')]);_0x52b129[_0xb9de('0x2d')]=_['keys'](_0x32c750[_0xb9de('0x2d')]);_0x52b129['filters']=_[_0xb9de('0x2f')](_0x52b129['model'],_0x52b129[_0xb9de('0x2d')]);_0x52b933['attributes']=_[_0xb9de('0x2f')](_0x52b129[_0xb9de('0x2c')],qs[_0xb9de('0x31')](_0x32c750[_0xb9de('0x2d')][_0xb9de('0x31')]));_0x52b933[_0xb9de('0x30')]=_0x52b933[_0xb9de('0x30')][_0xb9de('0x21')]?_0x52b933[_0xb9de('0x30')]:_0x52b129[_0xb9de('0x2c')];_0x52b933[_0xb9de('0x6e')]=qs['sort'](_0x32c750[_0xb9de('0x2d')][_0xb9de('0x34')]);_0x52b933['where']=qs[_0xb9de('0x2e')](_[_0xb9de('0x35')](_0x32c750[_0xb9de('0x2d')],_0x52b129[_0xb9de('0x2e')]));if(_0x32c750[_0xb9de('0x2d')][_0xb9de('0x57')]){_0x52b933['where']=_[_0xb9de('0x7b')](_0x52b933[_0xb9de('0x3f')],{'$or':_['map'](_0x52b933[_0xb9de('0x30')],function(_0x42a1b8){var _0xfee72a={};_0xfee72a[_0x42a1b8]={'$like':'%'+_0x32c750[_0xb9de('0x2d')][_0xb9de('0x57')]+'%'};return _0xfee72a;})});}_0x52b933=_[_0xb9de('0x7b')]({},_0x52b933,_0x32c750['options']);return _0x5b4c6e['getTags'](_0x52b933);}})[_0xb9de('0x18')](function(_0x293230){if(_0x293230){_0x2e5bf4=_0x293230[_0xb9de('0x21')];if(!_0x32c750[_0xb9de('0x2d')]['hasOwnProperty']('nolimit')){_0x52b933[_0xb9de('0x15')]=qs[_0xb9de('0x15')](_0x32c750[_0xb9de('0x2d')][_0xb9de('0x15')]);_0x52b933[_0xb9de('0x14')]=qs[_0xb9de('0x14')](_0x32c750[_0xb9de('0x2d')][_0xb9de('0x14')]);}return _0x5b4c6e[_0xb9de('0xc5')](_0x52b933);}})['then'](function(_0x38f6f2){if(_0x38f6f2){return _0x38f6f2?{'count':_0x2e5bf4,'rows':_0x38f6f2}:null;}})[_0xb9de('0x18')](respondWithResult(_0x37c7e2,null))[_0xb9de('0x86')](handleError(_0x37c7e2,null));};exports[_0xb9de('0xc7')]=function(_0x332fd0,_0x53a6b0){if(_0x332fd0[_0xb9de('0x8e')]['id']){delete _0x332fd0[_0xb9de('0x8e')]['id'];}return db[_0xb9de('0x1f')][_0xb9de('0x27')]({'where':{'id':_0x332fd0[_0xb9de('0x87')]['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x53a6b0,null))[_0xb9de('0x18')](function(_0x4c24c7){if(_0x4c24c7){return _0x4c24c7[_0xb9de('0xc7')](_0x332fd0[_0xb9de('0x8e')][_0xb9de('0xc8')]||[]);}return null;})[_0xb9de('0x18')](respondWithResult(_0x53a6b0,null))[_0xb9de('0x86')](handleError(_0x53a6b0,null));};exports[_0xb9de('0xc9')]=function(_0x17f98f,_0x3ff14e){var _0x4ec235=[];_0x4ec235[_0xb9de('0x25')](addAdditionalPhones(_0x17f98f[_0xb9de('0x8e')]));Promise[_0xb9de('0x29')](_0x4ec235)[_0xb9de('0x18')](function(){_0x4ec235=[];_0x4ec235[_0xb9de('0x25')](deleteCmHopperPhones(_0x17f98f[_0xb9de('0x8e')]['id']));_0x4ec235[_0xb9de('0x25')](addCmHopperPhones(_0x17f98f[_0xb9de('0x8e')]['id']));Promise[_0xb9de('0x29')](_0x4ec235)[_0xb9de('0x18')](function(){return[0x1];})[_0xb9de('0x18')](respondWithResult(_0x3ff14e,null));});};function addAdditionalPhones(_0x2f898d){var _0xc5d72d;return new Promise(function(_0x59df31,_0x1ef883){return db[_0xb9de('0xa2')][_0xb9de('0x19')]({'where':{'CmContactId':_0x2f898d['id']}})[_0xb9de('0x18')](function(){db[_0xb9de('0xb8')]['findAll']({'raw':!![],'attributes':['id',_0xb9de('0xca')]})[_0xb9de('0x18')](function(_0x362bd3){var _0x3c2491=[];for(var _0x1bf863=0x0;_0x1bf863<_0x2f898d[_0xb9de('0xcb')]['length'];_0x1bf863++){var _0x3b09b6=_0x2f898d[_0xb9de('0xcc')]?_['isNil'](_0x2f898d[_0xb9de('0xcc')][_0x1bf863])?'':_0x2f898d[_0xb9de('0xcc')][_0x1bf863]:_0x2f898d[_0xb9de('0xcb')][_0x1bf863][_0xb9de('0xcd')]?_0x2f898d[_0xb9de('0xcb')][_0x1bf863][_0xb9de('0xcd')]:'';var _0x3f5990=_[_0xb9de('0x58')](_0x2f898d[_0xb9de('0xcb')][_0x1bf863]['description'])?'':_0x2f898d[_0xb9de('0xcb')][_0x1bf863]['description'];var _0x38127f=_0x3b09b6+':'+_0x2f898d[_0xb9de('0xcb')][_0x1bf863][_0xb9de('0xc4')]+'§'+_0x3f5990;if(_[_0xb9de('0x58')](_0xc5d72d))_0xc5d72d=_0x38127f;else _0xc5d72d+=';'+_0x38127f;var _0x43f8e8=null;if(_0x2f898d['item_types']){if(!_[_0xb9de('0x58')](_0x2f898d[_0xb9de('0xcc')][_0x1bf863])){var _0x1d5164=_['find'](_0x362bd3,function(_0x2eed21){return _0x2eed21['id']===_0x2f898d[_0xb9de('0xcc')][_0x1bf863];});if(!_[_0xb9de('0x58')](_0x1d5164)){_0x43f8e8=_0x1d5164[_0xb9de('0xca')];}}}else{if(!_[_0xb9de('0x58')](_0x2f898d[_0xb9de('0xcb')][_0x1bf863])){var _0x1d5164=_[_0xb9de('0x46')](_0x362bd3,function(_0x1f926b){return _0x1f926b['id']===_0x2f898d[_0xb9de('0xcb')][_0x1bf863]['ItemTypeId'];});if(!_[_0xb9de('0x58')](_0x1d5164)){_0x43f8e8=_0x1bf863;}}}if(_[_0xb9de('0x58')](_0x43f8e8)){_0x43f8e8=0x64;}_0x3c2491[_0xb9de('0x25')](addAdditionalPhone(_0x2f898d['id'],_0x2f898d[_0xb9de('0xcb')][_0x1bf863][_0xb9de('0xc4')],_0x2f898d[_0xb9de('0xcc')]?_['isNil'](_0x2f898d['item_types'][_0x1bf863])?null:_0x2f898d[_0xb9de('0xcc')][_0x1bf863]:_0x2f898d['items'][_0x1bf863][_0xb9de('0xcd')]?_0x2f898d[_0xb9de('0xcb')][_0x1bf863][_0xb9de('0xcd')]:null,_0x43f8e8,_0x3f5990));}Promise[_0xb9de('0x29')](_0x3c2491)[_0xb9de('0x18')](function(){db[_0xb9de('0x1f')][_0xb9de('0x9d')]({'AdditionalPhones':_0xc5d72d},{'where':{'id':_0x2f898d['id']}})[_0xb9de('0x18')](function(){_0x59df31(0x1);});});});});});}function addAdditionalPhone(_0x36c4fe,_0x1e16de,_0x53ff42,_0x2d1d74,_0x4bbf78){return db['CmContactHasItem'][_0xb9de('0x46')]({'where':{'CmContactId':_0x36c4fe,'item':_0x1e16de}})[_0xb9de('0x18')](function(_0x2dd4ba){if(_0x2dd4ba)logger[_0xb9de('0x92')](_0xb9de('0xce'),_0x2dd4ba);else{db[_0xb9de('0xa2')][_0xb9de('0x98')]({'CmContactId':_0x36c4fe,'item':_0x1e16de,'ItemTypeId':_0x53ff42,'OrderBy':_0x2d1d74,'ItemClass':_0xb9de('0xcf'),'description':_0x4bbf78});}});}function deletePhones(_0x44e2dc){return db['CmContactHasItem'][_0xb9de('0x19')]({'where':{'CmContactId':_0x44e2dc}});}function deleteCmHopperPhones(_0x951c50){return new Promise(function(_0xdba02,_0x4ee36d){return db['CmHopper'][_0xb9de('0x8f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x951c50}})[_0xb9de('0x18')](function(_0x29ae1f){db[_0xb9de('0xd0')][_0xb9de('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x29ae1f,'id')}}});})[_0xb9de('0x18')](function(){_0xdba02(0x1);});});}function addCmHopperPhones(_0x8b6cf0){return new Promise(function(_0x5bd7d5,_0x37d31c){return db[_0xb9de('0x94')][_0xb9de('0x8f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x8b6cf0}})['then'](function(_0x6ca30b){var _0x9a7662=[];_['map'](_0x6ca30b,function(_0x7bcc24){_0x9a7662['push'](createCmHopperPhone(_0x8b6cf0,_0x7bcc24['id']));});Promise[_0xb9de('0x29')](_0x9a7662)[_0xb9de('0x18')](function(){_0x5bd7d5(0x1);});});});}function createCmHopperPhone(_0x1a4421,_0x110c2f){return new Promise(function(_0x217be8,_0x58a178){db[_0xb9de('0xa2')][_0xb9de('0x8f')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x1a4421,'ItemClass':_0xb9de('0xcf')},'include':[{'model':db[_0xb9de('0xb8')],'attributes':['OrderBy'],'as':_0xb9de('0xb9')}],'order':[_0xb9de('0xca'),db[_0xb9de('0x78')]['literal'](_0xb9de('0xd1'))]})['then'](function(_0x57c67a){var _0x158b00=0x1;var _0x437fdc=_[_0xb9de('0x49')](_0x57c67a,function(_0x1529da){_0x1529da[_0xb9de('0xd2')]=_0x110c2f;_0x1529da[_0xb9de('0xc4')]=_0x1529da[_0xb9de('0xd3')];_0x1529da[_0xb9de('0xca')]=_0x158b00;delete _0x1529da['ItemType.OrderBy'];_0x158b00=_0x158b00+0x1;return _0x1529da;});return db[_0xb9de('0xd0')][_0xb9de('0xb0')](_0x437fdc,{});})[_0xb9de('0x18')](function(){_0x217be8(0x1);});});}function insertAdditionalPhones(_0x4cb722,_0x3fa137){return new Promise(function(_0x216909,_0x3e453a){var _0x211c92=[];for(var _0x2b322d=0x0;_0x2b322d<_0x3fa137[_0xb9de('0x21')];_0x2b322d++){var _0x68f40e=_0x3fa137[_0x2b322d];_0x211c92[_0xb9de('0x25')](parseContactItemType(_0x68f40e));}Promise[_0xb9de('0x29')](_0x211c92)[_0xb9de('0x18')](function(){var _0x802497={'id':_0x4cb722['id'],'items':_0x3fa137};return addAdditionalPhones(_0x802497)[_0xb9de('0x18')](function(_0x251749){return addCmHopperPhones(_0x4cb722['id']);});})[_0xb9de('0x18')](function(){_0x216909(_0x4cb722);});});}function parseContactItemType(_0x597ee5){return new Promise(function(_0x3b8e03,_0x5560b0){if(_0x597ee5[_0xb9de('0x32')]('ItemTypeId')){_0x3b8e03(_0x597ee5);}else{return db[_0xb9de('0xb8')][_0xb9de('0x46')]({'where':{'name':_0x597ee5[_0xb9de('0xb9')]}})[_0xb9de('0x18')](function(_0x4a8510){if(_['isNil'](_0x4a8510))_0x597ee5[_0xb9de('0xcd')]=null;else _0x597ee5[_0xb9de('0xcd')]=_0x4a8510['id'];_0x3b8e03(_0x597ee5);});}});}exports['getAdditionalPhones']=function(_0x330676,_0xab3dda){return db['CmContactHasItem'][_0xb9de('0x8f')]({'raw':!![],'where':{'CmContactId':_0x330676[_0xb9de('0x87')]['id'],'ItemClass':_0xb9de('0xcf')},'include':[{'model':db[_0xb9de('0xb8')],'as':_0xb9de('0xb9')}],'order':[['OrderBy'],[db[_0xb9de('0x78')][_0xb9de('0xba')](_0xb9de('0xd1'))]]})[_0xb9de('0x18')](function(_0x584263){return _0x584263;})[_0xb9de('0x18')](respondWithResult(_0xab3dda,null))['catch'](handleError(_0xab3dda,null));};exports['duplicateAdditionalPhones']=function(_0x4feb23,_0xbe5840){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x4feb23[_0xb9de('0x8e')][_0xb9de('0xd4')]}})[_0xb9de('0x18')](function(_0x12e0bd){var _0x4b7709=_[_0xb9de('0x49')](_0x12e0bd,function(_0x461c4e){_0x461c4e['CmContactId']=_0x4feb23[_0xb9de('0x8e')][_0xb9de('0xd5')];return _0x461c4e;});return db[_0xb9de('0xa2')][_0xb9de('0xb0')](_0x4b7709,{});})['then'](function(_0x29d554){return addCmHopperPhones(_0x4feb23[_0xb9de('0x8e')]['toContactId']);})[_0xb9de('0x18')](function(_0x36a269){return['ok'];})[_0xb9de('0x18')](respondWithResult(_0xbe5840,null))[_0xb9de('0x86')](handleError(_0xbe5840,null));};exports[_0xb9de('0xd6')]=function(_0x213b54,_0x2e0693){var _0x25777a=[];_0x25777a[_0xb9de('0x25')](createCmHopperPhone(_0x213b54[_0xb9de('0x8e')]['id'],_0x213b54[_0xb9de('0x8e')][_0xb9de('0xd7')]));Promise['all'](_0x25777a)[_0xb9de('0x18')](function(){return[0x1];})[_0xb9de('0x18')](respondWithResult(_0x2e0693,null));};exports[_0xb9de('0xd8')]=function(_0x3ae68f,_0x193ea7){var _0x397b94={'raw':![],'where':{}};var _0x5199ec={};var _0x40c0e2={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x3ae68f[_0xb9de('0x87')]['id']}})['then'](handleEntityNotFound(_0x193ea7,null))[_0xb9de('0x18')](function(_0xb0c3c3){if(_0xb0c3c3){_0x5199ec[_0xb9de('0x2c')]=_[_0xb9de('0x22')](db[_0xb9de('0x94')]['rawAttributes']);_0x5199ec[_0xb9de('0x2d')]=_[_0xb9de('0x22')](_0x3ae68f[_0xb9de('0x2d')]);_0x5199ec[_0xb9de('0x2e')]=_[_0xb9de('0x2f')](_0x5199ec['model'],_0x5199ec[_0xb9de('0x2d')]);_0x397b94['attributes']=_['intersection'](_0x5199ec['model'],qs['fields'](_0x3ae68f[_0xb9de('0x2d')][_0xb9de('0x31')]));_0x397b94[_0xb9de('0x30')]=_0x397b94[_0xb9de('0x30')][_0xb9de('0x21')]?_0x397b94[_0xb9de('0x30')]:_0x5199ec[_0xb9de('0x2c')];if(!_0x3ae68f['query'][_0xb9de('0x32')](_0xb9de('0x33'))){_0x397b94['limit']=qs[_0xb9de('0x15')](_0x3ae68f[_0xb9de('0x2d')][_0xb9de('0x15')]);_0x397b94[_0xb9de('0x14')]=qs['offset'](_0x3ae68f['query'][_0xb9de('0x14')]);}_0x397b94[_0xb9de('0x6e')]=qs[_0xb9de('0x34')](_0x3ae68f[_0xb9de('0x2d')][_0xb9de('0x34')]);_0x397b94[_0xb9de('0x3f')]=qs['filters'](_[_0xb9de('0x35')](_0x3ae68f[_0xb9de('0x2d')],_0x5199ec['filters']));_0x397b94['where'][_0xb9de('0xd9')]=_0xb0c3c3['id'];if(_0x3ae68f[_0xb9de('0x2d')][_0xb9de('0x57')]){_0x397b94[_0xb9de('0x3f')]=_['merge'](_0x397b94[_0xb9de('0x3f')],{'$or':_[_0xb9de('0x49')](_0x397b94[_0xb9de('0x30')],function(_0x2a443b){var _0x213158={};_0x213158[_0x2a443b]={'$like':'%'+_0x3ae68f[_0xb9de('0x2d')][_0xb9de('0x57')]+'%'};return _0x213158;})});}_0x397b94=_[_0xb9de('0x7b')]({},_0x397b94,_0x3ae68f[_0xb9de('0xda')]);return db[_0xb9de('0x94')][_0xb9de('0x13')]({'where':_0x397b94[_0xb9de('0x3f')]})[_0xb9de('0x18')](function(_0x2cdceb){_0x40c0e2['count']=_0x2cdceb;if(_0x3ae68f['query']['includeAll']){_0x397b94['include']=[{'all':!![]}];}return db[_0xb9de('0x94')][_0xb9de('0x8f')](_0x397b94);})[_0xb9de('0x18')](function(_0x41141d){_0x40c0e2[_0xb9de('0x85')]=_0x41141d;return _0x40c0e2;});}})['then'](respondWithFilteredResult(_0x193ea7,_0x397b94))[_0xb9de('0x86')](handleError(_0x193ea7,null));};exports[_0xb9de('0xdb')]=function(_0x503d6c,_0x493cc3){var _0x3fcbfd={'raw':!![],'where':{}};var _0x41e252={};var _0x20b742={'count':0x0,'rows':[]};return db[_0xb9de('0x1f')][_0xb9de('0x27')]({'where':{'id':_0x503d6c['params']['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x493cc3,null))[_0xb9de('0x18')](function(_0x4489dc){if(_0x4489dc){_0x41e252[_0xb9de('0x2c')]=_[_0xb9de('0x22')](db['CmHopperHistory'][_0xb9de('0xc6')]);_0x41e252['query']=_[_0xb9de('0x22')](_0x503d6c[_0xb9de('0x2d')]);_0x41e252['filters']=_['intersection'](_0x41e252['model'],_0x41e252[_0xb9de('0x2d')]);_0x3fcbfd['attributes']=_[_0xb9de('0x2f')](_0x41e252[_0xb9de('0x2c')],qs['fields'](_0x503d6c[_0xb9de('0x2d')]['fields']));_0x3fcbfd['attributes']=_0x3fcbfd[_0xb9de('0x30')][_0xb9de('0x21')]?_0x3fcbfd[_0xb9de('0x30')]:_0x41e252[_0xb9de('0x2c')];if(!_0x503d6c[_0xb9de('0x2d')][_0xb9de('0x32')](_0xb9de('0x33'))){_0x3fcbfd['limit']=qs[_0xb9de('0x15')](_0x503d6c['query']['limit']);_0x3fcbfd['offset']=qs[_0xb9de('0x14')](_0x503d6c['query'][_0xb9de('0x14')]);}_0x3fcbfd['order']=qs[_0xb9de('0x34')](_0x503d6c[_0xb9de('0x2d')]['sort']);_0x3fcbfd['where']=qs[_0xb9de('0x2e')](_[_0xb9de('0x35')](_0x503d6c[_0xb9de('0x2d')],_0x41e252[_0xb9de('0x2e')]));_0x3fcbfd[_0xb9de('0x3f')][_0xb9de('0xd9')]=_0x4489dc['id'];if(_0x503d6c[_0xb9de('0x2d')][_0xb9de('0x57')]){_0x3fcbfd[_0xb9de('0x3f')]=_[_0xb9de('0x7b')](_0x3fcbfd[_0xb9de('0x3f')],{'$or':_[_0xb9de('0x49')](_0x3fcbfd[_0xb9de('0x30')],function(_0x6fcb2f){var _0x4378d5={};_0x4378d5[_0x6fcb2f]={'$like':'%'+_0x503d6c[_0xb9de('0x2d')][_0xb9de('0x57')]+'%'};return _0x4378d5;})});}_0x3fcbfd=_['merge']({},_0x3fcbfd,_0x503d6c['options']);return db[_0xb9de('0xdc')][_0xb9de('0x13')]({'where':_0x3fcbfd[_0xb9de('0x3f')]})[_0xb9de('0x18')](function(_0x209c1f){_0x20b742['count']=_0x209c1f;if(_0x503d6c[_0xb9de('0x2d')][_0xb9de('0xdd')]){_0x3fcbfd[_0xb9de('0xde')]=[{'all':!![]}];}return db[_0xb9de('0xdc')]['findAll'](_0x3fcbfd);})[_0xb9de('0x18')](function(_0x120871){_0x20b742[_0xb9de('0x85')]=_0x120871;return _0x20b742;});}})[_0xb9de('0x18')](respondWithFilteredResult(_0x493cc3,_0x3fcbfd))[_0xb9de('0x86')](handleError(_0x493cc3,null));};exports[_0xb9de('0xdf')]=function(_0x457053,_0xbd9db9){var _0x19b330={'raw':!![],'where':{}};var _0x4104cf={};var _0x32fe9f={'count':0x0,'rows':[]};return db[_0xb9de('0x1f')][_0xb9de('0x27')]({'where':{'id':_0x457053['params']['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0xbd9db9,null))[_0xb9de('0x18')](function(_0x16ef14){if(_0x16ef14){_0x4104cf[_0xb9de('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x4104cf[_0xb9de('0x2d')]=_[_0xb9de('0x22')](_0x457053[_0xb9de('0x2d')]);_0x4104cf[_0xb9de('0x2e')]=_['intersection'](_0x4104cf['model'],_0x4104cf[_0xb9de('0x2d')]);_0x19b330['attributes']=_[_0xb9de('0x2f')](_0x4104cf[_0xb9de('0x2c')],qs['fields'](_0x457053['query']['fields']));_0x19b330['attributes']=_0x19b330['attributes'][_0xb9de('0x21')]?_0x19b330[_0xb9de('0x30')]:_0x4104cf[_0xb9de('0x2c')];if(!_0x457053[_0xb9de('0x2d')]['hasOwnProperty'](_0xb9de('0x33'))){_0x19b330[_0xb9de('0x15')]=qs['limit'](_0x457053[_0xb9de('0x2d')]['limit']);_0x19b330[_0xb9de('0x14')]=qs[_0xb9de('0x14')](_0x457053[_0xb9de('0x2d')][_0xb9de('0x14')]);}_0x19b330[_0xb9de('0x6e')]=qs[_0xb9de('0x34')](_0x457053[_0xb9de('0x2d')][_0xb9de('0x34')]);_0x19b330[_0xb9de('0x3f')]=qs[_0xb9de('0x2e')](_[_0xb9de('0x35')](_0x457053[_0xb9de('0x2d')],_0x4104cf['filters']));_0x19b330[_0xb9de('0x3f')]['ContactId']=_0x16ef14['id'];if(_0x457053['query'][_0xb9de('0x57')]){_0x19b330[_0xb9de('0x3f')]=_[_0xb9de('0x7b')](_0x19b330['where'],{'$or':_[_0xb9de('0x49')](_0x19b330[_0xb9de('0x30')],function(_0x495bc4){var _0x402ae2={};_0x402ae2[_0x495bc4]={'$like':'%'+_0x457053[_0xb9de('0x2d')][_0xb9de('0x57')]+'%'};return _0x402ae2;})});}_0x19b330=_[_0xb9de('0x7b')]({},_0x19b330,_0x457053[_0xb9de('0xda')]);return db[_0xb9de('0xa3')][_0xb9de('0x13')]({'where':_0x19b330['where']})['then'](function(_0x230940){_0x32fe9f['count']=_0x230940;if(_0x457053[_0xb9de('0x2d')]['includeAll']){_0x19b330[_0xb9de('0xde')]=[{'all':!![]}];}return db[_0xb9de('0xa3')][_0xb9de('0x8f')](_0x19b330);})[_0xb9de('0x18')](function(_0x4535ef){_0x32fe9f[_0xb9de('0x85')]=_0x4535ef;return _0x32fe9f;});}})[_0xb9de('0x18')](respondWithFilteredResult(_0xbd9db9,_0x19b330))['catch'](handleError(_0xbd9db9,null));};exports[_0xb9de('0xe0')]=function(_0x3a799f,_0x41e8c5){var _0x311459={'raw':!![],'where':{}};var _0x47d72c={};var _0x5635ca={'count':0x0,'rows':[]};return db[_0xb9de('0x1f')][_0xb9de('0x27')]({'where':{'id':_0x3a799f[_0xb9de('0x87')]['id']}})[_0xb9de('0x18')](handleEntityNotFound(_0x41e8c5,null))[_0xb9de('0x18')](function(_0x33022a){if(_0x33022a){_0x47d72c[_0xb9de('0x2c')]=_[_0xb9de('0x22')](db[_0xb9de('0xa9')][_0xb9de('0xc6')]);_0x47d72c[_0xb9de('0x2d')]=_['keys'](_0x3a799f[_0xb9de('0x2d')]);_0x47d72c[_0xb9de('0x2e')]=_['intersection'](_0x47d72c[_0xb9de('0x2c')],_0x47d72c[_0xb9de('0x2d')]);_0x311459[_0xb9de('0x30')]=_[_0xb9de('0x2f')](_0x47d72c['model'],qs[_0xb9de('0x31')](_0x3a799f[_0xb9de('0x2d')][_0xb9de('0x31')]));_0x311459[_0xb9de('0x30')]=_0x311459['attributes'][_0xb9de('0x21')]?_0x311459[_0xb9de('0x30')]:_0x47d72c[_0xb9de('0x2c')];if(!_0x3a799f['query'][_0xb9de('0x32')](_0xb9de('0x33'))){_0x311459[_0xb9de('0x15')]=qs[_0xb9de('0x15')](_0x3a799f[_0xb9de('0x2d')][_0xb9de('0x15')]);_0x311459[_0xb9de('0x14')]=qs[_0xb9de('0x14')](_0x3a799f[_0xb9de('0x2d')]['offset']);}_0x311459[_0xb9de('0x6e')]=qs['sort'](_0x3a799f[_0xb9de('0x2d')][_0xb9de('0x34')]);_0x311459[_0xb9de('0x3f')]=qs[_0xb9de('0x2e')](_[_0xb9de('0x35')](_0x3a799f[_0xb9de('0x2d')],_0x47d72c[_0xb9de('0x2e')]));_0x311459[_0xb9de('0x3f')][_0xb9de('0xd9')]=_0x33022a['id'];if(_0x3a799f[_0xb9de('0x2d')]['filter']){_0x311459[_0xb9de('0x3f')]=_[_0xb9de('0x7b')](_0x311459[_0xb9de('0x3f')],{'$or':_[_0xb9de('0x49')](_0x311459[_0xb9de('0x30')],function(_0x121550){var _0x20ae43={};_0x20ae43[_0x121550]={'$like':'%'+_0x3a799f[_0xb9de('0x2d')][_0xb9de('0x57')]+'%'};return _0x20ae43;})});}_0x311459=_[_0xb9de('0x7b')]({},_0x311459,_0x3a799f[_0xb9de('0xda')]);return db['JscriptySessionReport'][_0xb9de('0x13')]({'where':_0x311459[_0xb9de('0x3f')]})[_0xb9de('0x18')](function(_0x27a946){_0x5635ca[_0xb9de('0x13')]=_0x27a946;if(_0x3a799f[_0xb9de('0x2d')][_0xb9de('0xdd')]){_0x311459[_0xb9de('0xde')]=[{'all':!![]}];}return db[_0xb9de('0xa9')][_0xb9de('0x8f')](_0x311459);})[_0xb9de('0x18')](function(_0x118f27){_0x5635ca['rows']=_0x118f27;return _0x5635ca;});}})[_0xb9de('0x18')](respondWithFilteredResult(_0x41e8c5,_0x311459))[_0xb9de('0x86')](handleError(_0x41e8c5,null));};exports[_0xb9de('0xe1')]=function(_0x4ece53,_0x104325){try{if(!_0x4ece53[_0xb9de('0x8e')]['ListId']){throw new Error(_0xb9de('0xe2'));}if(!_0x4ece53['body'][_0xb9de('0xe3')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xe4')]){throw new Error(_0xb9de('0xe5'));}if(!_0x4ece53['body']['socket_timestamp']){throw new Error(_0xb9de('0xe6'));}var _0x3ec5d0=_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xe3')][_0xb9de('0x48')](',');var _0x4b7ce8=_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xe4')]['split'](',');if(!_0x3ec5d0['length']||!_0x4b7ce8['length']||_0x3ec5d0[_0xb9de('0x21')]!==_0x4b7ce8[_0xb9de('0x21')]){throw new Error(_0xb9de('0xe7'));}_0x4ece53[_0xb9de('0x8e')][_0xb9de('0x31')]=_['zipObject'](_0x3ec5d0,_0x4b7ce8);if(!_0x4ece53[_0xb9de('0x8e')][_0xb9de('0x31')][_0xb9de('0xc4')]){throw new Error(_0xb9de('0xe8'));}if(!_0x4ece53[_0xb9de('0x8e')]['fields'][_0xb9de('0xe9')]){throw new Error(_0xb9de('0xea'));}var _0x206a42=path[_0xb9de('0x91')](config['root'],'server/files/tmp',_0x4ece53['file'][_0xb9de('0xeb')]);fs[_0xb9de('0xec')](_0x206a42,parseInt(_0xb9de('0xed'),0x8));var _0xd4820=require(_0xb9de('0xee'))['fork'](path[_0xb9de('0x91')](__dirname,'../../components/import/cm/csv'),[_0x206a42,_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xe3')],_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xe4')],_0x4ece53[_0xb9de('0x8e')][_0xb9de('0x77')],_0x4ece53[_0xb9de('0x8e')][_0xb9de('0xef')],_0x4ece53[_0xb9de('0x8e')]['duplicates'],_0x4ece53[_0xb9de('0x8e')]['socket_timestamp']]);return _0x104325[_0xb9de('0x10')](0xc8)[_0xb9de('0x11')]({'message':_0xb9de('0xf0'),'pid':_0xd4820[_0xb9de('0xf1')]});}catch(_0x1ffe6a){return _0x104325['status'](0x1f4)[_0xb9de('0x1e')](_0x1ffe6a);}};exports[_0xb9de('0xf2')]=function(_0x585b27,_0x3b238c){var _0x4a28d1=fs[_0xb9de('0xf3')](_0x585b27[_0xb9de('0xf4')][_0xb9de('0x2')]);Papa[_0xb9de('0xf5')](_0x4a28d1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3db7bf){return _0x3b238c[_0xb9de('0x10')](0xc8)['json']({'file':_0x585b27['file'],'fields':_0x3db7bf[_0xb9de('0xf6')][_0xb9de('0x31')]});}});};exports[_0xb9de('0xf7')]=function(_0x4f8941,_0x5954e1){return db[_0xb9de('0x4d')][_0xb9de('0x8f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb9de('0x73')}})['then'](function(_0x494d18){var _0x48cee7=![];if(!_0x4f8941['body'][_0xb9de('0x77')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4f8941[_0xb9de('0x8e')][_0xb9de('0xf8')]['phone']){throw new Error(_0xb9de('0xe8'));}if(!_0x4f8941[_0xb9de('0x8e')][_0xb9de('0xf8')][_0xb9de('0xe9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x4f8941['body'][_0xb9de('0xf9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x52e67b=require(_0xb9de('0xee'))['fork'](path[_0xb9de('0x91')](__dirname,_0xb9de('0xfa')),[_0x4f8941[_0xb9de('0x87')]['id'],JSON[_0xb9de('0xfb')](_0x4f8941[_0xb9de('0x8e')]),JSON['stringify'](_0x494d18)]);_0x52e67b['on'](_0xb9de('0xfc'),function(){_0x48cee7=!![];return _0x5954e1[_0xb9de('0x10')](0xc8)[_0xb9de('0x11')]({'message':_0xb9de('0xfd'),'pid':_0x52e67b['pid']});});_0x52e67b['on'](_0xb9de('0xfe'),function(_0x213a2b){if(_0x213a2b&&!_0x48cee7){return _0x5954e1[_0xb9de('0x10')](0x1f4)[_0xb9de('0x11')]({'message':_0xb9de('0xff'),'pid':_0x52e67b[_0xb9de('0xf1')]});}});})[_0xb9de('0x86')](handleError(_0x5954e1,null));};exports[_0xb9de('0x100')]=function(_0xcb543,_0x3b8273,_0x208923){return db[_0xb9de('0x4d')][_0xb9de('0x8f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb9de('0x73')}})[_0xb9de('0x18')](function(_0x649646){var _0x46fd33=![];if(!_0xcb543[_0xb9de('0x8e')][_0xb9de('0x77')]){throw new Error('No\x20ListId\x20specified');}if(!_0xcb543[_0xb9de('0x8e')][_0xb9de('0xf8')]['phone']){throw new Error(_0xb9de('0xe8'));}if(!_0xcb543['body'][_0xb9de('0xf8')][_0xb9de('0xe9')]){throw new Error(_0xb9de('0xea'));}if(!_0xcb543[_0xb9de('0x8e')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3566bb=require('child_process')['fork'](path[_0xb9de('0x91')](__dirname,'../../components/import/cm/csvUpdates'),[_0xcb543[_0xb9de('0x87')]['id'],JSON[_0xb9de('0xfb')](_0xcb543[_0xb9de('0x8e')]),JSON[_0xb9de('0xfb')](_0x649646)]);_0x3566bb['on'](_0xb9de('0xfc'),function(_0x54e95f){_0x46fd33=!![];return _0x3b8273['status'](0xc8)['json']({'message':_0xb9de('0xfd'),'pid':_0x3566bb[_0xb9de('0xf1')]});});_0x3566bb['on']('exit',function(_0x19175e){if(_0x19175e&&!_0x46fd33){return _0x3b8273[_0xb9de('0x10')](0x1f4)[_0xb9de('0x11')]({'message':'error\x20child\x20process','pid':_0x3566bb['pid']});}});})[_0xb9de('0x86')](handleError(_0x3b8273,null));};exports[_0xb9de('0x101')]=function(_0x34d434,_0x4189b6){var _0x736597=[_0xb9de('0x102'),'chat',_0xb9de('0x103'),'openchannel',_0xb9de('0x104'),_0xb9de('0x105'),_0xb9de('0x106')];var _0x5d5d0d={'offset':0x0,'order':qs[_0xb9de('0x34')]('-createdAt')},_0x373b12={'count':0x0,'rows':[]};Promise[_0xb9de('0x70')]()[_0xb9de('0x18')](function(){if(_0x34d434[_0xb9de('0x2d')][_0xb9de('0x107')]){if(!_[_0xb9de('0x108')](_0x736597,_0x34d434[_0xb9de('0x2d')]['channel']['toLowerCase']())){throw new Error(_0xb9de('0x109'));}_0x736597=[_0x34d434[_0xb9de('0x2d')][_0xb9de('0x107')]['toLowerCase']()];}if(_0x34d434[_0xb9de('0x2d')]['range']){try{var _0x3ca837=JSON[_0xb9de('0xf5')](_0x34d434[_0xb9de('0x2d')][_0xb9de('0x10a')]);if(!moment(_0x3ca837['from'])['isValid']()){throw new Error(_0xb9de('0x10b'));}if(!moment(_0x3ca837['to'])[_0xb9de('0x10c')]()){throw new Error(_0xb9de('0x10d'));}}catch(_0x41266b){throw new Error(_0xb9de('0x10e'));}}if(!_0x34d434[_0xb9de('0x2d')]['hasOwnProperty'](_0xb9de('0x33'))){_0x5d5d0d[_0xb9de('0x15')]=qs[_0xb9de('0x15')](_0x34d434['query'][_0xb9de('0x15')]||0xa);_0x5d5d0d[_0xb9de('0x14')]=qs[_0xb9de('0x14')](_0x34d434[_0xb9de('0x2d')][_0xb9de('0x14')]);}var _0x5f4631=_0x736597[_0xb9de('0x49')](function(_0x1c4e51){if(_0x1c4e51==='voice'){var _0x3066c6={'attributes':['id',_0xb9de('0x10f'),_0xb9de('0x2b'),_0xb9de('0x110'),_0xb9de('0x111'),_0xb9de('0x112'),_0xb9de('0x113'),_0xb9de('0x114'),_0xb9de('0x115'),_0xb9de('0x116'),_0xb9de('0x117'),'userDisposition',_0xb9de('0x118'),_0xb9de('0x119'),_0xb9de('0x11a')],'where':{'ContactId':_0x34d434[_0xb9de('0x87')]['id']},'include':[{'model':db['User'],'as':_0xb9de('0x4d'),'attributes':['id',_0xb9de('0x1d'),_0xb9de('0x11b'),_0xb9de('0x8c')]}],'order':[[_0xb9de('0x117'),_0xb9de('0x11c')]]};if(_0x34d434[_0xb9de('0x2d')][_0xb9de('0x10a')]){_0x3066c6[_0xb9de('0x3f')][_0xb9de('0x117')]={'$gte':_0x3ca837[_0xb9de('0x38')],'$lte':_0x3ca837['to']};}return db[_0xb9de('0xa5')][_0xb9de('0x11d')](_0x3066c6)['then'](function(_0x1dba8b){_0x373b12[_0xb9de('0x13')]+=_0x1dba8b[_0xb9de('0x13')];return _['map'](_0x1dba8b[_0xb9de('0x85')],function(_0x99cea7){var _0x17e8be=_0x99cea7['get']({'plain':!![]});_0x17e8be['channel']=_0x1c4e51;if(_0x17e8be['User']){_0x17e8be[_0xb9de('0x4d')]={'id':_0x17e8be[_0xb9de('0x4d')]['id'],'name':_0x17e8be[_0xb9de('0x4d')]['name'],'fullname':_0x17e8be['User'][_0xb9de('0x11b')],'alias':_0x17e8be[_0xb9de('0x4d')][_0xb9de('0x8c')]};}return _0x17e8be;});});}else{var _0x4d8e2f=_[_0xb9de('0x11e')](_0x1c4e51)+(_0x1c4e51===_0xb9de('0x11f')?_0xb9de('0x120'):_0xb9de('0x121'));var _0x3c1f2a={'attributes':['id','closed',_0xb9de('0x122'),'createdAt',_0xb9de('0x116'),_0xb9de('0x123'),_0xb9de('0x124'),_0xb9de('0x125'),'UserId',_0x4d8e2f+'Id'],'where':{'ContactId':_0x34d434['params']['id']},'include':[{'model':db[_0x4d8e2f],'as':_0xb9de('0x121'),'attributes':['id',_0xb9de('0x1d'),'key']},{'model':db[_0xb9de('0x4d')],'as':_0xb9de('0x126'),'attributes':['id',_0xb9de('0x1d'),_0xb9de('0x11b')]},{'model':db[_0xb9de('0x47')],'as':_0xb9de('0xb6'),'attributes':['id',_0xb9de('0x1d'),_0xb9de('0x37')],'through':{'attributes':[]}}],'order':[[_0xb9de('0x117'),_0xb9de('0x11c')]]};if(_0x34d434[_0xb9de('0x2d')][_0xb9de('0x10a')]){_0x3c1f2a[_0xb9de('0x3f')][_0xb9de('0x117')]={'$gte':_0x3ca837[_0xb9de('0x38')],'$lte':_0x3ca837['to']};}switch(_0x1c4e51){case'chat':_0x3c1f2a[_0xb9de('0x30')][_0xb9de('0x25')](_0xb9de('0x127'),_0xb9de('0x128'),_0xb9de('0x129'),'deviceModel',_0xb9de('0x12a'),'ratingMessage',_0xb9de('0x12b'),_0xb9de('0x12c'),_0xb9de('0x12d'));break;case _0xb9de('0x102'):_0x3c1f2a[_0xb9de('0x30')][_0xb9de('0x25')](_0xb9de('0x12e'),_0xb9de('0x12f'));break;case'openchannel':_0x3c1f2a[_0xb9de('0x30')]['push'](_0xb9de('0x130'),_0xb9de('0x131'));break;}return db[_['startCase'](_0x1c4e51)+_0xb9de('0x132')][_0xb9de('0x11d')](_0x3c1f2a)[_0xb9de('0x18')](function(_0x46e8fe){_0x373b12[_0xb9de('0x13')]+=_0x46e8fe[_0xb9de('0x13')];return _['map'](_0x46e8fe[_0xb9de('0x85')],function(_0x1e2623){var _0x1f7cfd=_0x1e2623[_0xb9de('0x90')]({'plain':!![]});_0x1f7cfd[_0xb9de('0x107')]=_0x1c4e51;if(_0x1f7cfd[_0xb9de('0x126')]){_0x1f7cfd[_0xb9de('0x126')]={'id':_0x1f7cfd['Owner']['id'],'name':_0x1f7cfd[_0xb9de('0x126')]['name'],'fullname':_0x1f7cfd[_0xb9de('0x126')][_0xb9de('0x11b')]};}return _0x1f7cfd;});});}});return Promise[_0xb9de('0x29')](_0x5f4631);})[_0xb9de('0x18')](function(_0x538fd1){return _(_0x538fd1)['flatten']()['sortBy'](_0xb9de('0x117'))[_0xb9de('0x133')]()[_0xb9de('0x50')]();})[_0xb9de('0x18')](function(_0x59faae){_0x373b12['rows']=_0x5d5d0d['limit']?_0x59faae[_0xb9de('0x134')](_0x5d5d0d[_0xb9de('0x14')],_0x5d5d0d[_0xb9de('0x14')]+_0x5d5d0d[_0xb9de('0x15')]):_0x59faae;return _0x373b12;})['then'](respondWithFilteredResult(_0x4189b6,_0x5d5d0d))[_0xb9de('0x86')](handleError(_0x4189b6,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 43401e2..dde3f72 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6912=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','remove','emit'];(function(_0x236766,_0x5ab0b9){var _0x32313d=function(_0x5d60ac){while(--_0x5d60ac){_0x236766['push'](_0x236766['shift']());}};_0x32313d(++_0x5ab0b9);}(_0x6912,0x171));var _0x2691=function(_0x1557ad,_0x5ce4ef){_0x1557ad=_0x1557ad-0x0;var _0x470817=_0x6912[_0x1557ad];return _0x470817;};'use strict';var EventEmitter=require(_0x2691('0x0'));var CmContact=require(_0x2691('0x1'))['db'][_0x2691('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2691('0x3')](0x0);var events={'afterCreate':_0x2691('0x4'),'afterUpdate':'update','afterDestroy':_0x2691('0x5')};function emitEvent(_0x10e236){return function(_0x91eb9b,_0x20561,_0x40caa2){CmContactEvents[_0x2691('0x6')](_0x10e236+':'+_0x91eb9b['id'],_0x91eb9b);CmContactEvents[_0x2691('0x6')](_0x10e236,_0x91eb9b);_0x40caa2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x2691('0x7')]=CmContactEvents; \ No newline at end of file +var _0xda35=['update','remove','emit','hasOwnProperty','events','setMaxListeners'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xda35,0xdc));var _0x5da3=function(_0x314350,_0x4433a0){_0x314350=_0x314350-0x0;var _0x2d9c1d=_0xda35[_0x314350];return _0x2d9c1d;};'use strict';var EventEmitter=require(_0x5da3('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5da3('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5da3('0x2'),'afterDestroy':_0x5da3('0x3')};function emitEvent(_0x2c7713){return function(_0x1cbcd0,_0xc251fb,_0x57c29c){CmContactEvents[_0x5da3('0x4')](_0x2c7713+':'+_0x1cbcd0['id'],_0x1cbcd0);CmContactEvents[_0x5da3('0x4')](_0x2c7713,_0x1cbcd0);_0x57c29c(null);};}for(var e in events){if(events[_0x5da3('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0db03dc..145999b 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x450a=['findOne','timezones','utcOffset','add','minutes','ret','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','firstName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue'];(function(_0x3614af,_0x504336){var _0x3ff9d2=function(_0x5c7a9d){while(--_0x5c7a9d){_0x3614af['push'](_0x3614af['shift']());}};_0x3ff9d2(++_0x504336);}(_0x450a,0x71));var _0xa450=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x450a[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var logger=require(_0xa450('0x2'))(_0xa450('0x3'));var moment=require(_0xa450('0x4'));var BPromise=require(_0xa450('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa450('0x6'));var shared=require(_0xa450('0x7'));var attributes=require(_0xa450('0x8'));module[_0xa450('0x9')]=function(_0x172e4b,_0x19c715){return _0x172e4b[_0xa450('0xa')](_0xa450('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xa450('0xc')]},{'name':'fti_cm_contacts','fields':[_0xa450('0xd'),'lastName',_0xa450('0xc'),_0xa450('0xe'),'fax',_0xa450('0xf')],'type':_0xa450('0x10')}],'timestamps':!![],'charset':_0xa450('0x11'),'collate':_0xa450('0x12'),'hooks':{'afterCreate':function(_0xefebf1,_0x2373b3,_0x5467f9){var _0x8365d=_0x172e4b[_0xa450('0x13')];var _0x5921ba=_0xefebf1[_0xa450('0x14')]({'plain':!![]});function _0x30fbfe(){return function(_0x5f4f12){logger[_0xa450('0x15')](_0xa450('0x16'),_0xa450('0x17'),util[_0xa450('0x18')](_0x5f4f12,{'showHidden':![],'depth':null}));};}function _0x309957(_0x14142b,_0x1e89c9){var _0x12a355=_0x1e89c9[_0xa450('0x19')]?_0x1e89c9['scheduledat']:moment()[_0xa450('0x1a')](_0xa450('0x1b'));return new BPromise(function(_0x204da7,_0x358ceb){if(_[_0xa450('0x1c')](_0x1e89c9[_0xa450('0x1d')])){_0x204da7({'ret':_0x12a355});}else{_0x8365d[_0xa450('0x1e')][_0xa450('0x1f')]({'where':{'id':_0x14142b['id']}})['then'](function(_0x1ff4fc){if(!_[_0xa450('0x1c')](_0x1ff4fc)){var _0x22d121=_0x1ff4fc[_0xa450('0x1d')];if(!_[_0xa450('0x1c')](_0x22d121)){var _0x5135c7=shared[_0xa450('0x20')];var _0x380211=_0x5135c7[_0x22d121];var _0xab0798=_0x5135c7[_0x1e89c9[_0xa450('0x1d')]];if(!_[_0xa450('0x1c')](_0x380211)&&!_[_0xa450('0x1c')](_0xab0798)){var _0x1e9ffe=_0x380211[_0xa450('0x21')]-_0xab0798[_0xa450('0x21')];_0x12a355=_0x1e89c9['scheduledat']?_0x1e89c9[_0xa450('0x19')]:moment();var _0x1fe576=moment(_0x12a355)[_0xa450('0x22')](_0x1e9ffe,_0xa450('0x23'));_0x204da7({'ret':_0x1fe576['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x204da7({'ret':_0x12a355});}else _0x204da7({'ret':_0x12a355});}else{_0x204da7({'ret':_0x12a355});}});}});return 0xa;}var _0x50dc98=function(_0x21b757){return new BPromise(function(_0x346a6e,_0x2d2b8d){_0x309957(_0x21b757,_0x5921ba)['then'](function(_0xaf3b74){_0x5921ba['scheduledat']=_0xaf3b74[_0xa450('0x24')];_0x8365d['CmHopper'][_0xa450('0x1f')]({'where':{'phone':_0x5921ba['phone'],'VoiceQueueId':_0x21b757['id']}})[_0xa450('0x25')](function(_0x57f0d3){if(!_['isNil'](_0x57f0d3)){throw new Error(_0xa450('0x26')+_0x5921ba[_0xa450('0xc')]+_0xa450('0x27')+_0x21b757['id']);}return _0x8365d[_0xa450('0x28')][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba[_0xa450('0x2a')],'priority':_0x5921ba[_0xa450('0x2b')]?_0x5921ba[_0xa450('0x2b')]:0x2,'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()['format'](_0xa450('0x1b')),'callback':_0x5921ba[_0xa450('0x2c')]?!![]:![],'callbackuniqueid':_0x5921ba[_0xa450('0x2c')]?_0x5921ba[_0xa450('0x2c')]:undefined,'callbackat':_0x5921ba[_0xa450('0x2c')]?moment()[_0xa450('0x1a')](_0xa450('0x1b')):undefined,'VoiceQueueId':_0x21b757['id']});})[_0xa450('0x2d')](function(_0x18f0e1){_0x2d2b8d(_0x18f0e1);});});});};var _0x46a39a=function(_0x209430){return new BPromise(function(_0x5ad721,_0xe56695){_0x309957(_0x209430,_0x5921ba)['then'](function(_0xe40dc4){_0x5921ba[_0xa450('0x19')]=_0xe40dc4['ret'];_0x8365d[_0xa450('0x28')]['findOne']({'where':{'phone':_0x5921ba[_0xa450('0xc')],'VoiceQueueId':_0x209430['id']}})[_0xa450('0x25')](function(_0x252809){if(!_[_0xa450('0x1c')](_0x252809)){throw new Error(_0xa450('0x26')+_0x5921ba['phone']+_0xa450('0x2e')+_0x209430['id']);}return _0x8365d[_0xa450('0x2f')][_0xa450('0x1f')]({'where':{'calleridnum':_0x5921ba['phone'],'VoiceQueueId':_0x209430['id']}});})[_0xa450('0x25')](function(_0x2f9ce6){if(!_['isNil'](_0x2f9ce6)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5921ba[_0xa450('0xc')]+_0xa450('0x30')+_0x209430['id']);}return _0x8365d[_0xa450('0x28')][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba['ListId'],'priority':_0x5921ba[_0xa450('0x2b')]?_0x5921ba[_0xa450('0x2b')]:0x2,'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()[_0xa450('0x1a')](_0xa450('0x1b')),'callback':_0x5921ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5921ba[_0xa450('0x2c')]?_0x5921ba['callbackUniqueid']:undefined,'callbackat':_0x5921ba[_0xa450('0x2c')]?moment()[_0xa450('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x209430['id']});})[_0xa450('0x2d')](function(_0x313749){_0xe56695(_0x313749);});});});};function _0x1a4ed0(){return function(_0xb7ca4c){logger[_0xa450('0x15')](_0xa450('0x16'),_0xa450('0x17'),util[_0xa450('0x18')](_0xb7ca4c,{'showHidden':![],'depth':null}));};}function _0x383cda(_0x4904f4,_0x36ad21){var _0x7c01bd=_0x36ad21[_0xa450('0x19')]?_0x36ad21[_0xa450('0x19')]:moment()[_0xa450('0x1a')](_0xa450('0x1b'));return new BPromise(function(_0x546549,_0x5b2d8e){if(_[_0xa450('0x1c')](_0x36ad21[_0xa450('0x1d')])){_0x546549({'ret':_0x7c01bd});}else{_0x8365d[_0xa450('0x31')][_0xa450('0x1f')]({'where':{'id':_0x4904f4['id']}})[_0xa450('0x25')](function(_0x4ccbf1){if(!_[_0xa450('0x1c')](_0x4ccbf1)){var _0x197990=_0x4ccbf1[_0xa450('0x1d')];if(!_['isNil'](_0x197990)){var _0xd13045=shared[_0xa450('0x20')];var _0x38dc49=_0xd13045[_0x197990];var _0x1f8b94=_0xd13045[_0x36ad21[_0xa450('0x1d')]];if(!_[_0xa450('0x1c')](_0x38dc49)&&!_[_0xa450('0x1c')](_0x1f8b94)){var _0x3e448d=_0x38dc49['utcOffset']-_0x1f8b94[_0xa450('0x21')];_0x7c01bd=_0x36ad21[_0xa450('0x19')]?_0x36ad21[_0xa450('0x19')]:moment();var _0x1af6e5=moment(_0x7c01bd)[_0xa450('0x22')](_0x3e448d,_0xa450('0x23'));_0x546549({'ret':_0x1af6e5[_0xa450('0x1a')](_0xa450('0x1b'))});}else _0x546549({'ret':_0x7c01bd});}else _0x546549({'ret':_0x7c01bd});}else{_0x546549({'ret':_0x7c01bd});}});}});return 0xa;}var _0x3cdf7a=function(_0x527dcd){return new BPromise(function(_0x49ee7e,_0x5f395e){_0x383cda(_0x527dcd,_0x5921ba)[_0xa450('0x25')](function(_0x122cfa){_0x5921ba['scheduledat']=_0x122cfa[_0xa450('0x24')];_0x8365d[_0xa450('0x28')][_0xa450('0x1f')]({'where':{'phone':_0x5921ba[_0xa450('0xc')],'CampaignId':_0x527dcd['id']}})['then'](function(_0x5db5ca){if(!_[_0xa450('0x1c')](_0x5db5ca)){throw new Error(_0xa450('0x26')+_0x5921ba['phone']+_0xa450('0x32')+_0x527dcd['id']);}return _0x8365d[_0xa450('0x28')][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba[_0xa450('0x2a')],'priority':_0x5921ba['priority']?_0x5921ba['priority']:0x2,'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()[_0xa450('0x1a')](_0xa450('0x1b')),'callback':_0x5921ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5921ba['callbackUniqueid']?_0x5921ba[_0xa450('0x2c')]:undefined,'callbackat':_0x5921ba['callbackUniqueid']?moment()[_0xa450('0x1a')](_0xa450('0x1b')):undefined,'CampaignId':_0x527dcd['id']});})[_0xa450('0x2d')](function(_0x48dabc){_0x5f395e(_0x48dabc);});});});};var _0x1ed165=function(_0x3f8916){return new BPromise(function(_0x2610e8,_0x3aa02e){_0x383cda(_0x3f8916,_0x5921ba)[_0xa450('0x25')](function(_0x5d6c1c){_0x5921ba[_0xa450('0x19')]=_0x5d6c1c[_0xa450('0x24')];_0x8365d['CmHopper'][_0xa450('0x1f')]({'where':{'phone':_0x5921ba[_0xa450('0xc')],'CampaignId':_0x3f8916['id']}})[_0xa450('0x25')](function(_0x5e4464){if(!_[_0xa450('0x1c')](_0x5e4464)){throw new Error(_0xa450('0x26')+_0x5921ba[_0xa450('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3f8916['id']);}return _0x8365d[_0xa450('0x2f')][_0xa450('0x1f')]({'where':{'calleridnum':_0x5921ba['phone'],'CampaignId':_0x3f8916['id']}});})['then'](function(_0x5bf5a4){if(!_[_0xa450('0x1c')](_0x5bf5a4)){throw new Error(_0xa450('0x33')+_0x5921ba[_0xa450('0xc')]+_0xa450('0x34')+_0x3f8916['id']);}return _0x8365d['CmHopper'][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba[_0xa450('0x2a')],'priority':_0x5921ba[_0xa450('0x2b')]?_0x5921ba[_0xa450('0x2b')]:0x2,'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()[_0xa450('0x1a')](_0xa450('0x1b')),'callback':_0x5921ba[_0xa450('0x2c')]?!![]:![],'callbackuniqueid':_0x5921ba['callbackUniqueid']?_0x5921ba[_0xa450('0x2c')]:undefined,'callbackat':_0x5921ba[_0xa450('0x2c')]?moment()[_0xa450('0x1a')](_0xa450('0x1b')):undefined,'CampaignId':_0x3f8916['id']});})[_0xa450('0x2d')](function(_0x2f66d0){_0x3aa02e(_0x2f66d0);});});});};if(_0x5921ba[_0xa450('0x2a')]){_0x8365d[_0xa450('0x1e')][_0xa450('0x35')]({'where':{'type':'outbound'},'attributes':['id',_0xa450('0x36'),_0xa450('0x1d')],'include':[{'model':_0x8365d[_0xa450('0x37')],'as':_0xa450('0x38'),'where':{'id':_0x5921ba[_0xa450('0x2a')]}}]})[_0xa450('0x25')](function(_0x4fdf0a){if(_0x4fdf0a){var _0x4310a4=[];for(var _0x2721b8=0x0,_0x920e88;_0x2721b8<_0x4fdf0a[_0xa450('0x39')];_0x2721b8+=0x1){_0x920e88=_0x4fdf0a[_0x2721b8][_0xa450('0x14')]({'plain':!![]});switch(_0x920e88[_0xa450('0x36')]){case _0xa450('0x3a'):_0x46a39a(_0x920e88)['catch'](_0x30fbfe());break;case _0xa450('0x3b'):_0x50dc98(_0x920e88)[_0xa450('0x2d')](_0x30fbfe());break;default:_0x383cda(_0x920e88,_0x5921ba)[_0xa450('0x25')](function(_0x82582a){_0x5921ba[_0xa450('0x19')]=_0x82582a[_0xa450('0x24')];_0x8365d[_0xa450('0x28')][_0xa450('0x29')]({'phone':_0x5921ba['phone'],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba[_0xa450('0x2a')],'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()['format'](_0xa450('0x1b')),'priority':_0x5921ba[_0xa450('0x2b')]?_0x5921ba[_0xa450('0x2b')]:0x2,'callback':_0x5921ba[_0xa450('0x2c')]?!![]:![],'callbackuniqueid':_0x5921ba[_0xa450('0x2c')]?_0x5921ba[_0xa450('0x2c')]:undefined,'callbackat':_0x5921ba[_0xa450('0x2c')]?moment()[_0xa450('0x1a')](_0xa450('0x1b')):undefined,'VoiceQueueId':_0x920e88['id']})[_0xa450('0x2d')](_0x30fbfe());});}}}})['then'](function(){return _0x8365d[_0xa450('0x1e')][_0xa450('0x35')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x8365d[_0xa450('0x37')],'as':_0xa450('0x3c'),'where':{'id':_0x5921ba[_0xa450('0x2a')]}}]})[_0xa450('0x25')](function(_0xbffce4){if(_0xbffce4){var _0x3c3699=[];for(var _0x16c62e=0x0,_0x387a02;_0x16c62e<_0xbffce4[_0xa450('0x39')];_0x16c62e+=0x1){_0x387a02=_0xbffce4[_0x16c62e]['get']({'plain':!![]});_0x8365d['CmHopperBlack'][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba['ListId'],'VoiceQueueId':_0x387a02['id']})['catch'](function(_0x4bbc71){logger[_0xa450('0x15')](_0xa450('0x3d'),'afterCreate',_0x4bbc71[_0xa450('0x3e')]);});}}});})[_0xa450('0x25')](function(){return _0x8365d[_0xa450('0x31')][_0xa450('0x35')]({'attributes':['id',_0xa450('0x36'),_0xa450('0x1d')],'include':[{'model':_0x8365d[_0xa450('0x37')],'as':_0xa450('0x38'),'where':{'id':_0x5921ba[_0xa450('0x2a')]}}]})[_0xa450('0x25')](function(_0x1c06fd){if(_0x1c06fd){var _0xc4a73c=[];for(var _0x4bb4ba=0x0,_0x18ab08;_0x4bb4ba<_0x1c06fd[_0xa450('0x39')];_0x4bb4ba+=0x1){_0x18ab08=_0x1c06fd[_0x4bb4ba]['get']({'plain':!![]});switch(_0x18ab08[_0xa450('0x36')]){case _0xa450('0x3a'):_0x1ed165(_0x18ab08)[_0xa450('0x2d')](_0x1a4ed0());break;case _0xa450('0x3b'):_0x3cdf7a(_0x18ab08)[_0xa450('0x2d')](_0x1a4ed0());break;default:_0x8365d[_0xa450('0x28')][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba[_0xa450('0x2a')],'scheduledat':_0x5921ba[_0xa450('0x19')]?_0x5921ba[_0xa450('0x19')]:moment()[_0xa450('0x1a')](_0xa450('0x1b')),'priority':_0x5921ba[_0xa450('0x2b')]?_0x5921ba[_0xa450('0x2b')]:0x2,'callback':_0x5921ba[_0xa450('0x2c')]?!![]:![],'callbackuniqueid':_0x5921ba[_0xa450('0x2c')]?_0x5921ba['callbackUniqueid']:undefined,'callbackat':_0x5921ba[_0xa450('0x2c')]?moment()[_0xa450('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x18ab08['id']})[_0xa450('0x2d')](_0x1a4ed0());}}}});})[_0xa450('0x25')](function(){return _0x8365d[_0xa450('0x31')]['findAll']({'attributes':['id'],'include':[{'model':_0x8365d[_0xa450('0x37')],'as':_0xa450('0x3c'),'where':{'id':_0x5921ba[_0xa450('0x2a')]}}]})[_0xa450('0x25')](function(_0x59e263){if(_0x59e263){var _0x47a610=[];for(var _0x2ff286=0x0,_0x5380ca;_0x2ff286<_0x59e263[_0xa450('0x39')];_0x2ff286+=0x1){_0x5380ca=_0x59e263[_0x2ff286][_0xa450('0x14')]({'plain':!![]});_0x8365d['CmHopperBlack'][_0xa450('0x29')]({'phone':_0x5921ba[_0xa450('0xc')],'ContactId':_0x5921ba['id'],'ListId':_0x5921ba['ListId'],'CampaignId':_0x5380ca['id']})[_0xa450('0x2d')](function(_0x50ad50){logger[_0xa450('0x15')](_0xa450('0x3d'),_0xa450('0x17'),_0x50ad50[_0xa450('0x3e')]);});}}});})[_0xa450('0x25')](function(){_0x5467f9();})['catch'](function(_0x499243){logger['error'](_0xa450('0x3d'),_0xa450('0x17'),_0x499243[_0xa450('0x3e')]);_0x5467f9(_0x499243);});}else{_0x5467f9(new Error(_0xa450('0x3f')));}},'afterDestroy':function(_0x3c778b,_0x4bdad1,_0x68b493){var _0x47e89a=_0x172e4b[_0xa450('0x13')];var _0x37ae7f=_0x3c778b['get']({'plain':!![]});return _0x47e89a[_0xa450('0x28')][_0xa450('0x35')]({'raw':!![],'where':{'ListId':_0x37ae7f[_0xa450('0x2a')],'ContactId':_0x37ae7f['id']}})[_0xa450('0x25')](function(_0x402dd8){if(!_['isEmpty'](_0x402dd8)){var _0x349866=[];for(var _0x7eaa1f=0x0;_0x7eaa1f<_0x402dd8[_0xa450('0x39')];_0x7eaa1f+=0x1){var _0x15cd8d=_0x47e89a[_0xa450('0x28')][_0xa450('0x40')]({'where':{'ListId':_0x402dd8[_0x7eaa1f][_0xa450('0x2a')],'ContactId':_0x402dd8[_0x7eaa1f][_0xa450('0x41')],'VoiceQueueId':_0x402dd8[_0x7eaa1f][_0xa450('0x42')],'CampaignId':_0x402dd8[_0x7eaa1f]['CampaignId']}});_0x349866[_0xa450('0x43')](_0x15cd8d);}return BPromise[_0xa450('0x44')](_0x349866);}})[_0xa450('0x25')](function(_0x807b59){logger[_0xa450('0x45')](_0xa450('0x46'),util[_0xa450('0x18')](_0x807b59,{'showHidden':![],'depth':null}));_0x68b493();})[_0xa450('0x2d')](function(_0x55c774){logger['error'](_0xa450('0x47'),util[_0xa450('0x18')](_0x55c774,{'showHidden':![],'depth':null}));_0x68b493(_0x55c774);});}}});}; \ No newline at end of file +var _0xc106=['cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','dialTimezone','timezones','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','afterCreate','CmHopperBlack','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','moment','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get'];(function(_0xba06fe,_0x291292){var _0x830f5=function(_0x3b7032){while(--_0x3b7032){_0xba06fe['push'](_0xba06fe['shift']());}};_0x830f5(++_0x291292);}(_0xc106,0x162));var _0x6c10=function(_0x1decc2,_0x5d88d3){_0x1decc2=_0x1decc2-0x0;var _0x307f4a=_0xc106[_0x1decc2];return _0x307f4a;};'use strict';var _=require(_0x6c10('0x0'));var util=require(_0x6c10('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6c10('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c10('0x3'));var rimraf=require(_0x6c10('0x4'));var config=require(_0x6c10('0x5'));var shared=require(_0x6c10('0x6'));var attributes=require(_0x6c10('0x7'));module[_0x6c10('0x8')]=function(_0x4025a6,_0xf9bc89){return _0x4025a6[_0x6c10('0x9')](_0x6c10('0xa'),attributes,{'tableName':_0x6c10('0xb'),'paranoid':!![],'indexes':[{'name':_0x6c10('0xc'),'fields':['phone']},{'name':_0x6c10('0xd'),'fields':['firstName',_0x6c10('0xe'),_0x6c10('0xc'),_0x6c10('0xf'),_0x6c10('0x10'),'email'],'type':_0x6c10('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x6c10('0x12'),'hooks':{'afterCreate':function(_0x12a7ab,_0x3472a3,_0x3375e9){var _0x12c695=_0x4025a6[_0x6c10('0x13')];var _0x5ae8d4=_0x12a7ab[_0x6c10('0x14')]({'plain':!![]});function _0x31b3a9(){return function(_0xe8c2cf){logger['error'](_0x6c10('0x15'),'afterCreate',util[_0x6c10('0x16')](_0xe8c2cf,{'showHidden':![],'depth':null}));};}function _0x10f90f(_0x30fd79,_0x1bb841){var _0x4090b7=_0x1bb841['scheduledat']?_0x1bb841[_0x6c10('0x17')]:moment()[_0x6c10('0x18')](_0x6c10('0x19'));return new BPromise(function(_0x203b7d,_0x4a94a0){if(_[_0x6c10('0x1a')](_0x1bb841['dialTimezone'])){_0x203b7d({'ret':_0x4090b7});}else{_0x12c695[_0x6c10('0x1b')][_0x6c10('0x1c')]({'where':{'id':_0x30fd79['id']}})['then'](function(_0x12f1ce){if(!_[_0x6c10('0x1a')](_0x12f1ce)){var _0x251fa6=_0x12f1ce[_0x6c10('0x1d')];if(!_['isNil'](_0x251fa6)){var _0x8b9dc=shared[_0x6c10('0x1e')];var _0x4fe474=_0x8b9dc[_0x251fa6];var _0x1df097=_0x8b9dc[_0x1bb841[_0x6c10('0x1d')]];if(!_['isNil'](_0x4fe474)&&!_['isNil'](_0x1df097)){var _0x3fe111=_0x4fe474['utcOffset']-_0x1df097[_0x6c10('0x1f')];_0x4090b7=_0x1bb841[_0x6c10('0x17')]?_0x1bb841['scheduledat']:moment();var _0x55e9bf=moment(_0x4090b7)[_0x6c10('0x20')](_0x3fe111,_0x6c10('0x21'));_0x203b7d({'ret':_0x55e9bf['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x203b7d({'ret':_0x4090b7});}else _0x203b7d({'ret':_0x4090b7});}else{_0x203b7d({'ret':_0x4090b7});}});}});return 0xa;}var _0x2fc174=function(_0x33e14d){return new BPromise(function(_0x4161d6,_0x40b814){_0x10f90f(_0x33e14d,_0x5ae8d4)[_0x6c10('0x22')](function(_0x31d1b5){_0x5ae8d4['scheduledat']=_0x31d1b5[_0x6c10('0x23')];_0x12c695[_0x6c10('0x24')]['findOne']({'where':{'phone':_0x5ae8d4[_0x6c10('0xc')],'VoiceQueueId':_0x33e14d['id']}})[_0x6c10('0x22')](function(_0x5d6941){if(!_[_0x6c10('0x1a')](_0x5d6941)){throw new Error(_0x6c10('0x25')+_0x5ae8d4['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x33e14d['id']);}return _0x12c695[_0x6c10('0x24')][_0x6c10('0x26')]({'phone':_0x5ae8d4['phone'],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4[_0x6c10('0x27')],'priority':_0x5ae8d4[_0x6c10('0x28')]?_0x5ae8d4[_0x6c10('0x28')]:0x2,'scheduledat':_0x5ae8d4[_0x6c10('0x17')]?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ae8d4[_0x6c10('0x29')]?!![]:![],'callbackuniqueid':_0x5ae8d4['callbackUniqueid']?_0x5ae8d4['callbackUniqueid']:undefined,'callbackat':_0x5ae8d4['callbackUniqueid']?moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x33e14d['id']});})[_0x6c10('0x2a')](function(_0x4c237e){_0x40b814(_0x4c237e);});});});};var _0x1a0c36=function(_0x443660){return new BPromise(function(_0x37d4c7,_0x16c1e8){_0x10f90f(_0x443660,_0x5ae8d4)[_0x6c10('0x22')](function(_0x55d435){_0x5ae8d4[_0x6c10('0x17')]=_0x55d435[_0x6c10('0x23')];_0x12c695[_0x6c10('0x24')]['findOne']({'where':{'phone':_0x5ae8d4[_0x6c10('0xc')],'VoiceQueueId':_0x443660['id']}})['then'](function(_0x297fbb){if(!_[_0x6c10('0x1a')](_0x297fbb)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5ae8d4[_0x6c10('0xc')]+_0x6c10('0x2b')+_0x443660['id']);}return _0x12c695['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x5ae8d4['phone'],'VoiceQueueId':_0x443660['id']}});})[_0x6c10('0x22')](function(_0xff589d){if(!_[_0x6c10('0x1a')](_0xff589d)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5ae8d4[_0x6c10('0xc')]+_0x6c10('0x2c')+_0x443660['id']);}return _0x12c695[_0x6c10('0x24')][_0x6c10('0x26')]({'phone':_0x5ae8d4['phone'],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4[_0x6c10('0x27')],'priority':_0x5ae8d4[_0x6c10('0x28')]?_0x5ae8d4[_0x6c10('0x28')]:0x2,'scheduledat':_0x5ae8d4['scheduledat']?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ae8d4[_0x6c10('0x29')]?!![]:![],'callbackuniqueid':_0x5ae8d4['callbackUniqueid']?_0x5ae8d4['callbackUniqueid']:undefined,'callbackat':_0x5ae8d4[_0x6c10('0x29')]?moment()[_0x6c10('0x18')](_0x6c10('0x19')):undefined,'VoiceQueueId':_0x443660['id']});})[_0x6c10('0x2a')](function(_0x1f1a17){_0x16c1e8(_0x1f1a17);});});});};function _0x3ed6b8(){return function(_0x6ec86b){logger[_0x6c10('0x2d')](_0x6c10('0x15'),'afterCreate',util[_0x6c10('0x16')](_0x6ec86b,{'showHidden':![],'depth':null}));};}function _0x4237ba(_0x5a9047,_0x128463){var _0x5581bc=_0x128463[_0x6c10('0x17')]?_0x128463['scheduledat']:moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x19f8dc,_0x2e8a46){if(_['isNil'](_0x128463[_0x6c10('0x1d')])){_0x19f8dc({'ret':_0x5581bc});}else{_0x12c695[_0x6c10('0x2e')][_0x6c10('0x1c')]({'where':{'id':_0x5a9047['id']}})[_0x6c10('0x22')](function(_0x1911ff){if(!_['isNil'](_0x1911ff)){var _0x10fd5c=_0x1911ff[_0x6c10('0x1d')];if(!_[_0x6c10('0x1a')](_0x10fd5c)){var _0x31804a=shared['timezones'];var _0x228884=_0x31804a[_0x10fd5c];var _0x5af9d5=_0x31804a[_0x128463[_0x6c10('0x1d')]];if(!_['isNil'](_0x228884)&&!_[_0x6c10('0x1a')](_0x5af9d5)){var _0x35a4bd=_0x228884[_0x6c10('0x1f')]-_0x5af9d5[_0x6c10('0x1f')];_0x5581bc=_0x128463[_0x6c10('0x17')]?_0x128463[_0x6c10('0x17')]:moment();var _0x5c638f=moment(_0x5581bc)[_0x6c10('0x20')](_0x35a4bd,'minutes');_0x19f8dc({'ret':_0x5c638f[_0x6c10('0x18')](_0x6c10('0x19'))});}else _0x19f8dc({'ret':_0x5581bc});}else _0x19f8dc({'ret':_0x5581bc});}else{_0x19f8dc({'ret':_0x5581bc});}});}});return 0xa;}var _0x51e053=function(_0x3af890){return new BPromise(function(_0x40257c,_0x5ecb4c){_0x4237ba(_0x3af890,_0x5ae8d4)['then'](function(_0x464bf3){_0x5ae8d4[_0x6c10('0x17')]=_0x464bf3[_0x6c10('0x23')];_0x12c695[_0x6c10('0x24')][_0x6c10('0x1c')]({'where':{'phone':_0x5ae8d4[_0x6c10('0xc')],'CampaignId':_0x3af890['id']}})['then'](function(_0x2e65d6){if(!_['isNil'](_0x2e65d6)){throw new Error(_0x6c10('0x25')+_0x5ae8d4[_0x6c10('0xc')]+_0x6c10('0x2f')+_0x3af890['id']);}return _0x12c695[_0x6c10('0x24')]['create']({'phone':_0x5ae8d4[_0x6c10('0xc')],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4[_0x6c10('0x27')],'priority':_0x5ae8d4[_0x6c10('0x28')]?_0x5ae8d4[_0x6c10('0x28')]:0x2,'scheduledat':_0x5ae8d4['scheduledat']?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')](_0x6c10('0x19')),'callback':_0x5ae8d4[_0x6c10('0x29')]?!![]:![],'callbackuniqueid':_0x5ae8d4['callbackUniqueid']?_0x5ae8d4['callbackUniqueid']:undefined,'callbackat':_0x5ae8d4[_0x6c10('0x29')]?moment()[_0x6c10('0x18')](_0x6c10('0x19')):undefined,'CampaignId':_0x3af890['id']});})[_0x6c10('0x2a')](function(_0x55f452){_0x5ecb4c(_0x55f452);});});});};var _0x30eeea=function(_0x20c792){return new BPromise(function(_0x3d5483,_0xf5828c){_0x4237ba(_0x20c792,_0x5ae8d4)[_0x6c10('0x22')](function(_0x130e86){_0x5ae8d4[_0x6c10('0x17')]=_0x130e86[_0x6c10('0x23')];_0x12c695['CmHopper'][_0x6c10('0x1c')]({'where':{'phone':_0x5ae8d4['phone'],'CampaignId':_0x20c792['id']}})[_0x6c10('0x22')](function(_0x245301){if(!_[_0x6c10('0x1a')](_0x245301)){throw new Error(_0x6c10('0x25')+_0x5ae8d4[_0x6c10('0xc')]+_0x6c10('0x30')+_0x20c792['id']);}return _0x12c695[_0x6c10('0x31')][_0x6c10('0x1c')]({'where':{'calleridnum':_0x5ae8d4['phone'],'CampaignId':_0x20c792['id']}});})[_0x6c10('0x22')](function(_0x125545){if(!_['isNil'](_0x125545)){throw new Error(_0x6c10('0x32')+_0x5ae8d4[_0x6c10('0xc')]+_0x6c10('0x33')+_0x20c792['id']);}return _0x12c695[_0x6c10('0x24')]['create']({'phone':_0x5ae8d4[_0x6c10('0xc')],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4[_0x6c10('0x27')],'priority':_0x5ae8d4[_0x6c10('0x28')]?_0x5ae8d4[_0x6c10('0x28')]:0x2,'scheduledat':_0x5ae8d4[_0x6c10('0x17')]?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ae8d4['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5ae8d4[_0x6c10('0x29')]?_0x5ae8d4[_0x6c10('0x29')]:undefined,'callbackat':_0x5ae8d4['callbackUniqueid']?moment()[_0x6c10('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x20c792['id']});})[_0x6c10('0x2a')](function(_0x49e12e){_0xf5828c(_0x49e12e);});});});};if(_0x5ae8d4[_0x6c10('0x27')]){_0x12c695[_0x6c10('0x1b')][_0x6c10('0x34')]({'where':{'type':_0x6c10('0x35')},'attributes':['id',_0x6c10('0x36'),_0x6c10('0x1d')],'include':[{'model':_0x12c695[_0x6c10('0x37')],'as':_0x6c10('0x38'),'where':{'id':_0x5ae8d4[_0x6c10('0x27')]}}]})[_0x6c10('0x22')](function(_0x2953b9){if(_0x2953b9){var _0x124295=[];for(var _0xbbdeb1=0x0,_0xd6a32b;_0xbbdeb1<_0x2953b9['length'];_0xbbdeb1+=0x1){_0xd6a32b=_0x2953b9[_0xbbdeb1][_0x6c10('0x14')]({'plain':!![]});switch(_0xd6a32b[_0x6c10('0x36')]){case _0x6c10('0x39'):_0x1a0c36(_0xd6a32b)[_0x6c10('0x2a')](_0x31b3a9());break;case _0x6c10('0x3a'):_0x2fc174(_0xd6a32b)['catch'](_0x31b3a9());break;default:_0x4237ba(_0xd6a32b,_0x5ae8d4)[_0x6c10('0x22')](function(_0x456d00){_0x5ae8d4[_0x6c10('0x17')]=_0x456d00[_0x6c10('0x23')];_0x12c695[_0x6c10('0x24')][_0x6c10('0x26')]({'phone':_0x5ae8d4['phone'],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4['ListId'],'scheduledat':_0x5ae8d4[_0x6c10('0x17')]?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')](_0x6c10('0x19')),'priority':_0x5ae8d4['priority']?_0x5ae8d4[_0x6c10('0x28')]:0x2,'callback':_0x5ae8d4[_0x6c10('0x29')]?!![]:![],'callbackuniqueid':_0x5ae8d4[_0x6c10('0x29')]?_0x5ae8d4['callbackUniqueid']:undefined,'callbackat':_0x5ae8d4[_0x6c10('0x29')]?moment()[_0x6c10('0x18')](_0x6c10('0x19')):undefined,'VoiceQueueId':_0xd6a32b['id']})['catch'](_0x31b3a9());});}}}})['then'](function(){return _0x12c695[_0x6c10('0x1b')][_0x6c10('0x34')]({'where':{'type':_0x6c10('0x35')},'attributes':['id'],'include':[{'model':_0x12c695[_0x6c10('0x37')],'as':_0x6c10('0x3b'),'where':{'id':_0x5ae8d4[_0x6c10('0x27')]}}]})[_0x6c10('0x22')](function(_0x1617f6){if(_0x1617f6){var _0x5853cf=[];for(var _0xda5f0=0x0,_0x6b38e0;_0xda5f0<_0x1617f6[_0x6c10('0x3c')];_0xda5f0+=0x1){_0x6b38e0=_0x1617f6[_0xda5f0][_0x6c10('0x14')]({'plain':!![]});_0x12c695['CmHopperBlack'][_0x6c10('0x26')]({'phone':_0x5ae8d4[_0x6c10('0xc')],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4[_0x6c10('0x27')],'VoiceQueueId':_0x6b38e0['id']})['catch'](function(_0x28952b){logger[_0x6c10('0x2d')](_0x6c10('0x3d'),_0x6c10('0x3e'),_0x28952b['message']);});}}});})[_0x6c10('0x22')](function(){return _0x12c695[_0x6c10('0x2e')][_0x6c10('0x34')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x12c695[_0x6c10('0x37')],'as':_0x6c10('0x38'),'where':{'id':_0x5ae8d4[_0x6c10('0x27')]}}]})['then'](function(_0x46967a){if(_0x46967a){var _0x5c92f4=[];for(var _0x4ce299=0x0,_0xca2da0;_0x4ce299<_0x46967a[_0x6c10('0x3c')];_0x4ce299+=0x1){_0xca2da0=_0x46967a[_0x4ce299][_0x6c10('0x14')]({'plain':!![]});switch(_0xca2da0[_0x6c10('0x36')]){case _0x6c10('0x39'):_0x30eeea(_0xca2da0)[_0x6c10('0x2a')](_0x3ed6b8());break;case _0x6c10('0x3a'):_0x51e053(_0xca2da0)[_0x6c10('0x2a')](_0x3ed6b8());break;default:_0x12c695['CmHopper']['create']({'phone':_0x5ae8d4[_0x6c10('0xc')],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4['ListId'],'scheduledat':_0x5ae8d4[_0x6c10('0x17')]?_0x5ae8d4[_0x6c10('0x17')]:moment()[_0x6c10('0x18')](_0x6c10('0x19')),'priority':_0x5ae8d4[_0x6c10('0x28')]?_0x5ae8d4[_0x6c10('0x28')]:0x2,'callback':_0x5ae8d4['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5ae8d4[_0x6c10('0x29')]?_0x5ae8d4[_0x6c10('0x29')]:undefined,'callbackat':_0x5ae8d4[_0x6c10('0x29')]?moment()[_0x6c10('0x18')](_0x6c10('0x19')):undefined,'CampaignId':_0xca2da0['id']})[_0x6c10('0x2a')](_0x3ed6b8());}}}});})['then'](function(){return _0x12c695['Campaign'][_0x6c10('0x34')]({'attributes':['id'],'include':[{'model':_0x12c695[_0x6c10('0x37')],'as':_0x6c10('0x3b'),'where':{'id':_0x5ae8d4[_0x6c10('0x27')]}}]})[_0x6c10('0x22')](function(_0x4f62ed){if(_0x4f62ed){var _0x2dea0d=[];for(var _0x104bd1=0x0,_0x4e7eb4;_0x104bd1<_0x4f62ed[_0x6c10('0x3c')];_0x104bd1+=0x1){_0x4e7eb4=_0x4f62ed[_0x104bd1]['get']({'plain':!![]});_0x12c695[_0x6c10('0x3f')][_0x6c10('0x26')]({'phone':_0x5ae8d4[_0x6c10('0xc')],'ContactId':_0x5ae8d4['id'],'ListId':_0x5ae8d4['ListId'],'CampaignId':_0x4e7eb4['id']})[_0x6c10('0x2a')](function(_0x467327){logger['error'](_0x6c10('0x3d'),_0x6c10('0x3e'),_0x467327[_0x6c10('0x40')]);});}}});})[_0x6c10('0x22')](function(){_0x3375e9();})[_0x6c10('0x2a')](function(_0x4742e6){logger['error'](_0x6c10('0x3d'),'afterCreate',_0x4742e6[_0x6c10('0x40')]);_0x3375e9(_0x4742e6);});}else{_0x3375e9(new Error(_0x6c10('0x41')));}},'afterDestroy':function(_0x52f10d,_0x289d34,_0x33d9c7){var _0x5131c0=_0x4025a6[_0x6c10('0x13')];var _0x3df711=_0x52f10d['get']({'plain':!![]});return _0x5131c0['CmHopper'][_0x6c10('0x34')]({'raw':!![],'where':{'ListId':_0x3df711['ListId'],'ContactId':_0x3df711['id']}})[_0x6c10('0x22')](function(_0x16cc9b){if(!_[_0x6c10('0x42')](_0x16cc9b)){var _0x4c597c=[];for(var _0x2e1714=0x0;_0x2e1714<_0x16cc9b['length'];_0x2e1714+=0x1){var _0x57a6f3=_0x5131c0['CmHopper'][_0x6c10('0x43')]({'where':{'ListId':_0x16cc9b[_0x2e1714][_0x6c10('0x27')],'ContactId':_0x16cc9b[_0x2e1714][_0x6c10('0x44')],'VoiceQueueId':_0x16cc9b[_0x2e1714][_0x6c10('0x45')],'CampaignId':_0x16cc9b[_0x2e1714][_0x6c10('0x46')]}});_0x4c597c[_0x6c10('0x47')](_0x57a6f3);}return BPromise[_0x6c10('0x48')](_0x4c597c);}})[_0x6c10('0x22')](function(_0x352036){logger[_0x6c10('0x49')]('[CmContact][afterDestroy][Succesfull]',util[_0x6c10('0x16')](_0x352036,{'showHidden':![],'depth':null}));_0x33d9c7();})[_0x6c10('0x2a')](function(_0x4953d4){logger['error'](_0x6c10('0x4a'),util[_0x6c10('0x16')](_0x4953d4,{'showHidden':![],'depth':null}));_0x33d9c7(_0x4953d4);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 70c98da..ffa609a 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x43e251,_0x552b10){var _0x530182=function(_0x534b95){while(--_0x534b95){_0x43e251['push'](_0x43e251['shift']());}};_0x530182(++_0x552b10);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x29ecbc,_0x31faf9){var _0x5f5a92=function(_0x4bb3d4){while(--_0x4bb3d4){_0x29ecbc['push'](_0x29ecbc['shift']());}};_0x5f5a92(++_0x31faf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c3df912..4c5aa7e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd66c=['STRING','sequelize','INTEGER'];(function(_0x14ee59,_0x236373){var _0x46dcd3=function(_0x163663){while(--_0x163663){_0x14ee59['push'](_0x14ee59['shift']());}};_0x46dcd3(++_0x236373);}(_0xd66c,0x106));var _0xcd66=function(_0x49c672,_0x1ae783){_0x49c672=_0x49c672-0x0;var _0x56e2a0=_0xd66c[_0x49c672];return _0x56e2a0;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xcd66('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xcd66('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xcd66('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xcd66('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xcd66('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xcd66('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xc3b0=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x121b6c,_0x40e4cc){var _0x58b8cb=function(_0xf4335c){while(--_0xf4335c){_0x121b6c['push'](_0x121b6c['shift']());}};_0x58b8cb(++_0x40e4cc);}(_0xc3b0,0x166));var _0x0c3b=function(_0x4c3b23,_0x53c84f){_0x4c3b23=_0x4c3b23-0x0;var _0x11356e=_0xc3b0[_0x4c3b23];return _0x11356e;};'use strict';var Sequelize=require(_0x0c3b('0x0'));module[_0x0c3b('0x1')]={'CmContactId':{'type':Sequelize[_0x0c3b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x0c3b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x0c3b('0x4')},'OrderBy':{'type':Sequelize[_0x0c3b('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 6009190..60b8fec 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7445=['role','autoAssociation','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','CmContactHasItems','UserProfileResource','error','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','CmContactHasItem','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7445,0x96));var _0x5744=function(_0x2c6991,_0x4b5775){_0x2c6991=_0x2c6991-0x0;var _0x4de9fa=_0x7445[_0x2c6991];return _0x4de9fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5744('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5744('0x1'));var BPromise=require(_0x5744('0x2'));var Mustache=require(_0x5744('0x3'));var util=require(_0x5744('0x4'));var path=require(_0x5744('0x5'));var sox=require(_0x5744('0x6'));var csv=require(_0x5744('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5744('0x8'));var _=require(_0x5744('0x9'));var squel=require(_0x5744('0xa'));var crypto=require(_0x5744('0xb'));var jsforce=require(_0x5744('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5744('0x7'));var querystring=require(_0x5744('0xd'));var Papa=require('papaparse');var Redis=require(_0x5744('0xe'));var authService=require(_0x5744('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5744('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5744('0x11'))(_0x5744('0x12'));var utils=require(_0x5744('0x13'));var config=require(_0x5744('0x14'));var licenseUtil=require(_0x5744('0x15'));var db=require(_0x5744('0x16'))['db'];function respondWithStatusCode(_0x2190bb,_0x3fe0cb){_0x3fe0cb=_0x3fe0cb||0xcc;return function(_0x1fd426){if(_0x1fd426){return _0x2190bb[_0x5744('0x17')](_0x3fe0cb);}return _0x2190bb[_0x5744('0x18')](_0x3fe0cb)[_0x5744('0x19')]();};}function respondWithResult(_0x4ac845,_0x219b8e){_0x219b8e=_0x219b8e||0xc8;return function(_0x141e85){if(_0x141e85){return _0x4ac845[_0x5744('0x18')](_0x219b8e)[_0x5744('0x1a')](_0x141e85);}};}function respondWithFilteredResult(_0x9afccc,_0x48a3e8){return function(_0x43319c){if(_0x43319c){var _0x1f95b1=typeof _0x48a3e8[_0x5744('0x1b')]===_0x5744('0x1c')&&typeof _0x48a3e8[_0x5744('0x1d')]===_0x5744('0x1c');var _0x4fd72a=_0x43319c[_0x5744('0x1e')];var _0x4dad14=_0x1f95b1?0x0:_0x48a3e8['offset'];var _0x2976d9=_0x1f95b1?_0x43319c[_0x5744('0x1e')]:_0x48a3e8[_0x5744('0x1b')]+_0x48a3e8[_0x5744('0x1d')];var _0x49b763;if(_0x2976d9>=_0x4fd72a){_0x2976d9=_0x4fd72a;_0x49b763=0xc8;}else{_0x49b763=0xce;}_0x9afccc[_0x5744('0x18')](_0x49b763);return _0x9afccc['set'](_0x5744('0x1f'),_0x4dad14+'-'+_0x2976d9+'/'+_0x4fd72a)[_0x5744('0x1a')](_0x43319c);}return null;};}function patchUpdates(_0xe62ba1){return function(_0x1fbdb4){try{jsonpatch[_0x5744('0x20')](_0x1fbdb4,_0xe62ba1,!![]);}catch(_0x106704){return BPromise['reject'](_0x106704);}return _0x1fbdb4[_0x5744('0x21')]();};}function saveUpdates(_0x1ffaa6,_0x566ecc){return function(_0x1fb67e){if(_0x1fb67e){return _0x1fb67e[_0x5744('0x22')](_0x1ffaa6)['then'](function(_0x3a201a){return _0x3a201a;});}return null;};}function removeEntity(_0x5370e0,_0x1f9431){return function(_0x4f18d0){if(_0x4f18d0){return _0x4f18d0[_0x5744('0x23')]()[_0x5744('0x24')](function(){var _0x5181aa=_0x4f18d0['get']({'plain':!![]});var _0x54c60c=_0x5744('0x25');return db[_0x5744('0x26')][_0x5744('0x23')]({'where':{'type':_0x54c60c,'resourceId':_0x5181aa['id']}})['then'](function(){return _0x4f18d0;});})[_0x5744('0x24')](function(){_0x5370e0[_0x5744('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4227ca,_0x3c922c){return function(_0x36c30e){if(!_0x36c30e){_0x4227ca[_0x5744('0x17')](0x194);}return _0x36c30e;};}function handleError(_0x1944c1,_0x231a84){_0x231a84=_0x231a84||0x1f4;return function(_0x41294e){logger[_0x5744('0x27')](_0x41294e['stack']);if(_0x41294e['name']){delete _0x41294e['name'];}_0x1944c1[_0x5744('0x18')](_0x231a84)['send'](_0x41294e);};}exports['index']=function(_0x3fcc70,_0x45b9e1){var _0x1adeda={},_0x2b4e74={},_0x2ea6c1={'count':0x0,'rows':[]};var _0x2d9a16=_[_0x5744('0x28')](db['CmContactHasItem'][_0x5744('0x29')],function(_0x11a09c){return{'name':_0x11a09c[_0x5744('0x2a')],'type':_0x11a09c[_0x5744('0x2b')]['key']};});_0x2b4e74[_0x5744('0x2c')]=_['map'](_0x2d9a16,_0x5744('0x2d'));_0x2b4e74[_0x5744('0x2e')]=_[_0x5744('0x2f')](_0x3fcc70[_0x5744('0x2e')]);_0x2b4e74['filters']=_[_0x5744('0x30')](_0x2b4e74[_0x5744('0x2c')],_0x2b4e74[_0x5744('0x2e')]);_0x1adeda[_0x5744('0x31')]=_[_0x5744('0x30')](_0x2b4e74[_0x5744('0x2c')],qs[_0x5744('0x32')](_0x3fcc70[_0x5744('0x2e')][_0x5744('0x32')]));_0x1adeda[_0x5744('0x31')]=_0x1adeda[_0x5744('0x31')][_0x5744('0x33')]?_0x1adeda[_0x5744('0x31')]:_0x2b4e74[_0x5744('0x2c')];if(!_0x3fcc70[_0x5744('0x2e')]['hasOwnProperty'](_0x5744('0x34'))){_0x1adeda[_0x5744('0x1d')]=qs[_0x5744('0x1d')](_0x3fcc70['query']['limit']);_0x1adeda[_0x5744('0x1b')]=qs[_0x5744('0x1b')](_0x3fcc70['query'][_0x5744('0x1b')]);}_0x1adeda[_0x5744('0x35')]=qs[_0x5744('0x36')](_0x3fcc70[_0x5744('0x2e')][_0x5744('0x36')]);_0x1adeda['where']=qs[_0x5744('0x37')](_['pick'](_0x3fcc70['query'],_0x2b4e74[_0x5744('0x37')]),_0x2d9a16);if(_0x3fcc70[_0x5744('0x2e')][_0x5744('0x38')]){_0x1adeda[_0x5744('0x39')]=_[_0x5744('0x3a')](_0x1adeda[_0x5744('0x39')],{'$or':_[_0x5744('0x28')](_0x2d9a16,function(_0x4a3e34){if(_0x4a3e34['type']!==_0x5744('0x3b')){var _0x45c21b={};_0x45c21b[_0x4a3e34['name']]={'$like':'%'+_0x3fcc70[_0x5744('0x2e')][_0x5744('0x38')]+'%'};return _0x45c21b;}})});}_0x1adeda=_[_0x5744('0x3a')]({},_0x1adeda,_0x3fcc70['options']);var _0x42e0af={'where':_0x1adeda[_0x5744('0x39')]};return db['CmContactHasItem'][_0x5744('0x1e')](_0x42e0af)['then'](function(_0x29a35a){_0x2ea6c1['count']=_0x29a35a;if(_0x3fcc70[_0x5744('0x2e')][_0x5744('0x3c')]){_0x1adeda[_0x5744('0x3d')]=[{'all':!![]}];}return db[_0x5744('0x3e')]['findAll'](_0x1adeda);})['then'](function(_0x51d4af){_0x2ea6c1[_0x5744('0x3f')]=_0x51d4af;return _0x2ea6c1;})[_0x5744('0x24')](respondWithFilteredResult(_0x45b9e1,_0x1adeda))[_0x5744('0x40')](handleError(_0x45b9e1,null));};exports['show']=function(_0x388162,_0x19992b){var _0x3dc5d2={'raw':!![],'where':{'id':_0x388162[_0x5744('0x41')]['id']}},_0x45f88a={};_0x45f88a[_0x5744('0x2c')]=_['keys'](db['CmContactHasItem'][_0x5744('0x29')]);_0x45f88a[_0x5744('0x2e')]=_[_0x5744('0x2f')](_0x388162['query']);_0x45f88a[_0x5744('0x37')]=_['intersection'](_0x45f88a[_0x5744('0x2c')],_0x45f88a[_0x5744('0x2e')]);_0x3dc5d2['attributes']=_[_0x5744('0x30')](_0x45f88a[_0x5744('0x2c')],qs[_0x5744('0x32')](_0x388162[_0x5744('0x2e')][_0x5744('0x32')]));_0x3dc5d2['attributes']=_0x3dc5d2[_0x5744('0x31')][_0x5744('0x33')]?_0x3dc5d2[_0x5744('0x31')]:_0x45f88a[_0x5744('0x2c')];if(_0x388162[_0x5744('0x2e')][_0x5744('0x3c')]){_0x3dc5d2[_0x5744('0x3d')]=[{'all':!![]}];}_0x3dc5d2=_[_0x5744('0x3a')]({},_0x3dc5d2,_0x388162['options']);return db[_0x5744('0x3e')][_0x5744('0x42')](_0x3dc5d2)['then'](handleEntityNotFound(_0x19992b,null))[_0x5744('0x24')](respondWithResult(_0x19992b,null))[_0x5744('0x40')](handleError(_0x19992b,null));};exports[_0x5744('0x43')]=function(_0xbe7655,_0x28dac4){return db['CmContactHasItem']['create'](_0xbe7655[_0x5744('0x44')],{})[_0x5744('0x24')](function(_0x11fdfa){var _0x72d64a=_0xbe7655[_0x5744('0x45')][_0x5744('0x46')]({'plain':!![]});if(!_0x72d64a)throw new Error(_0x5744('0x47'));if(_0x72d64a[_0x5744('0x48')]===_0x5744('0x45')){var _0xe2c961=_0x11fdfa[_0x5744('0x46')]({'plain':!![]});var _0x4b4d9d=_0x5744('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4b4d9d,'userProfileId':_0x72d64a['userProfileId']},'raw':!![]})['then'](function(_0x5826dc){if(_0x5826dc&&_0x5826dc[_0x5744('0x49')]===0x0){return db[_0x5744('0x26')]['create']({'name':_0xe2c961['name'],'resourceId':_0xe2c961['id'],'type':_0x5826dc[_0x5744('0x2d')],'sectionId':_0x5826dc['id']},{})[_0x5744('0x24')](function(){return _0x11fdfa;});}else{return _0x11fdfa;}})['catch'](function(_0x52337d){logger[_0x5744('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52337d);throw _0x52337d;});}return _0x11fdfa;})[_0x5744('0x24')](respondWithResult(_0x28dac4,0xc9))[_0x5744('0x40')](handleError(_0x28dac4,null));};exports[_0x5744('0x22')]=function(_0x5e00f7,_0x1ffb66){if(_0x5e00f7[_0x5744('0x44')]['id']){delete _0x5e00f7['body']['id'];}return db[_0x5744('0x3e')][_0x5744('0x42')]({'where':{'id':_0x5e00f7[_0x5744('0x41')]['id']}})['then'](handleEntityNotFound(_0x1ffb66,null))[_0x5744('0x24')](saveUpdates(_0x5e00f7[_0x5744('0x44')],null))['then'](respondWithResult(_0x1ffb66,null))[_0x5744('0x40')](handleError(_0x1ffb66,null));};exports[_0x5744('0x23')]=function(_0x3dd214,_0x3cefb6){return db[_0x5744('0x3e')][_0x5744('0x42')]({'where':{'id':_0x3dd214[_0x5744('0x41')]['id']}})[_0x5744('0x24')](handleEntityNotFound(_0x3cefb6,null))[_0x5744('0x24')](removeEntity(_0x3cefb6,null))[_0x5744('0x40')](handleError(_0x3cefb6,null));}; \ No newline at end of file +var _0x96e4=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3fd203,_0x2f78ab){var _0x5e6d58=function(_0xdf6f5c){while(--_0xdf6f5c){_0x3fd203['push'](_0x3fd203['shift']());}};_0x5e6d58(++_0x2f78ab);}(_0x96e4,0x139));var _0x496e=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x96e4[_0x483ab9];return _0x35043b;};'use strict';var emlformat=require(_0x496e('0x0'));var rimraf=require(_0x496e('0x1'));var zipdir=require(_0x496e('0x2'));var jsonpatch=require(_0x496e('0x3'));var rp=require(_0x496e('0x4'));var moment=require('moment');var BPromise=require(_0x496e('0x5'));var Mustache=require('mustache');var util=require(_0x496e('0x6'));var path=require(_0x496e('0x7'));var sox=require(_0x496e('0x8'));var csv=require(_0x496e('0x9'));var ejs=require(_0x496e('0xa'));var fs=require('fs');var fs_extra=require(_0x496e('0xb'));var _=require('lodash');var squel=require(_0x496e('0xc'));var crypto=require(_0x496e('0xd'));var jsforce=require(_0x496e('0xe'));var deskjs=require(_0x496e('0xf'));var toCsv=require(_0x496e('0x9'));var querystring=require(_0x496e('0x10'));var Papa=require(_0x496e('0x11'));var Redis=require('ioredis');var authService=require(_0x496e('0x12'));var qs=require(_0x496e('0x13'));var as=require(_0x496e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x496e('0x15'));var utils=require(_0x496e('0x16'));var config=require(_0x496e('0x17'));var licenseUtil=require(_0x496e('0x18'));var db=require(_0x496e('0x19'))['db'];function respondWithStatusCode(_0x5c03eb,_0x3ba7c7){_0x3ba7c7=_0x3ba7c7||0xcc;return function(_0x1f283e){if(_0x1f283e){return _0x5c03eb[_0x496e('0x1a')](_0x3ba7c7);}return _0x5c03eb[_0x496e('0x1b')](_0x3ba7c7)[_0x496e('0x1c')]();};}function respondWithResult(_0x17e921,_0x469962){_0x469962=_0x469962||0xc8;return function(_0x59d700){if(_0x59d700){return _0x17e921[_0x496e('0x1b')](_0x469962)[_0x496e('0x1d')](_0x59d700);}};}function respondWithFilteredResult(_0x114197,_0x2fc65d){return function(_0x5ef523){if(_0x5ef523){var _0x367ac0=typeof _0x2fc65d[_0x496e('0x1e')]===_0x496e('0x1f')&&typeof _0x2fc65d[_0x496e('0x20')]===_0x496e('0x1f');var _0x3d4658=_0x5ef523[_0x496e('0x21')];var _0x163fab=_0x367ac0?0x0:_0x2fc65d[_0x496e('0x1e')];var _0x310507=_0x367ac0?_0x5ef523[_0x496e('0x21')]:_0x2fc65d[_0x496e('0x1e')]+_0x2fc65d['limit'];var _0x4d6bc6;if(_0x310507>=_0x3d4658){_0x310507=_0x3d4658;_0x4d6bc6=0xc8;}else{_0x4d6bc6=0xce;}_0x114197[_0x496e('0x1b')](_0x4d6bc6);return _0x114197[_0x496e('0x22')](_0x496e('0x23'),_0x163fab+'-'+_0x310507+'/'+_0x3d4658)[_0x496e('0x1d')](_0x5ef523);}return null;};}function patchUpdates(_0x2a7139){return function(_0x1e38c3){try{jsonpatch[_0x496e('0x24')](_0x1e38c3,_0x2a7139,!![]);}catch(_0x37bc5a){return BPromise[_0x496e('0x25')](_0x37bc5a);}return _0x1e38c3['save']();};}function saveUpdates(_0x3d4505,_0x2f8fbf){return function(_0x1bc624){if(_0x1bc624){return _0x1bc624[_0x496e('0x26')](_0x3d4505)['then'](function(_0x301757){return _0x301757;});}return null;};}function removeEntity(_0xefd7fd,_0x6cbf89){return function(_0x149d4d){if(_0x149d4d){return _0x149d4d[_0x496e('0x27')]()[_0x496e('0x28')](function(){var _0x4a3f1d=_0x149d4d[_0x496e('0x29')]({'plain':!![]});var _0x521f7f=_0x496e('0x2a');return db[_0x496e('0x2b')][_0x496e('0x27')]({'where':{'type':_0x521f7f,'resourceId':_0x4a3f1d['id']}})[_0x496e('0x28')](function(){return _0x149d4d;});})[_0x496e('0x28')](function(){_0xefd7fd[_0x496e('0x1b')](0xcc)[_0x496e('0x1c')]();});}};}function handleEntityNotFound(_0x57fb1d,_0xb6a9c8){return function(_0x3bf93d){if(!_0x3bf93d){_0x57fb1d['sendStatus'](0x194);}return _0x3bf93d;};}function handleError(_0x54d27e,_0xecd96a){_0xecd96a=_0xecd96a||0x1f4;return function(_0x1f7498){logger[_0x496e('0x2c')](_0x1f7498[_0x496e('0x2d')]);if(_0x1f7498[_0x496e('0x2e')]){delete _0x1f7498[_0x496e('0x2e')];}_0x54d27e['status'](_0xecd96a)['send'](_0x1f7498);};}exports[_0x496e('0x2f')]=function(_0x46fe08,_0x29f791){var _0x3ecc3b={},_0x554cb6={},_0x32c06f={'count':0x0,'rows':[]};var _0x6e5632=_[_0x496e('0x30')](db[_0x496e('0x31')]['rawAttributes'],function(_0x488cde){return{'name':_0x488cde[_0x496e('0x32')],'type':_0x488cde[_0x496e('0x33')]['key']};});_0x554cb6[_0x496e('0x34')]=_['map'](_0x6e5632,_0x496e('0x2e'));_0x554cb6['query']=_[_0x496e('0x35')](_0x46fe08[_0x496e('0x36')]);_0x554cb6[_0x496e('0x37')]=_[_0x496e('0x38')](_0x554cb6[_0x496e('0x34')],_0x554cb6[_0x496e('0x36')]);_0x3ecc3b[_0x496e('0x39')]=_[_0x496e('0x38')](_0x554cb6['model'],qs['fields'](_0x46fe08[_0x496e('0x36')][_0x496e('0x3a')]));_0x3ecc3b[_0x496e('0x39')]=_0x3ecc3b[_0x496e('0x39')][_0x496e('0x3b')]?_0x3ecc3b[_0x496e('0x39')]:_0x554cb6['model'];if(!_0x46fe08['query'][_0x496e('0x3c')](_0x496e('0x3d'))){_0x3ecc3b['limit']=qs[_0x496e('0x20')](_0x46fe08[_0x496e('0x36')][_0x496e('0x20')]);_0x3ecc3b[_0x496e('0x1e')]=qs[_0x496e('0x1e')](_0x46fe08[_0x496e('0x36')][_0x496e('0x1e')]);}_0x3ecc3b[_0x496e('0x3e')]=qs['sort'](_0x46fe08[_0x496e('0x36')][_0x496e('0x3f')]);_0x3ecc3b[_0x496e('0x40')]=qs[_0x496e('0x37')](_[_0x496e('0x41')](_0x46fe08[_0x496e('0x36')],_0x554cb6['filters']),_0x6e5632);if(_0x46fe08['query']['filter']){_0x3ecc3b['where']=_[_0x496e('0x42')](_0x3ecc3b[_0x496e('0x40')],{'$or':_[_0x496e('0x30')](_0x6e5632,function(_0x311483){if(_0x311483[_0x496e('0x33')]!==_0x496e('0x43')){var _0x514a7b={};_0x514a7b[_0x311483[_0x496e('0x2e')]]={'$like':'%'+_0x46fe08[_0x496e('0x36')][_0x496e('0x44')]+'%'};return _0x514a7b;}})});}_0x3ecc3b=_[_0x496e('0x42')]({},_0x3ecc3b,_0x46fe08['options']);var _0x1be934={'where':_0x3ecc3b[_0x496e('0x40')]};return db[_0x496e('0x31')][_0x496e('0x21')](_0x1be934)['then'](function(_0x2e9195){_0x32c06f['count']=_0x2e9195;if(_0x46fe08[_0x496e('0x36')][_0x496e('0x45')]){_0x3ecc3b['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x496e('0x46')](_0x3ecc3b);})['then'](function(_0x435137){_0x32c06f[_0x496e('0x47')]=_0x435137;return _0x32c06f;})[_0x496e('0x28')](respondWithFilteredResult(_0x29f791,_0x3ecc3b))[_0x496e('0x48')](handleError(_0x29f791,null));};exports[_0x496e('0x49')]=function(_0x46255d,_0x204cc9){var _0x425d76={'raw':!![],'where':{'id':_0x46255d[_0x496e('0x4a')]['id']}},_0x3fe9cd={};_0x3fe9cd[_0x496e('0x34')]=_['keys'](db[_0x496e('0x31')][_0x496e('0x4b')]);_0x3fe9cd[_0x496e('0x36')]=_[_0x496e('0x35')](_0x46255d[_0x496e('0x36')]);_0x3fe9cd[_0x496e('0x37')]=_[_0x496e('0x38')](_0x3fe9cd[_0x496e('0x34')],_0x3fe9cd['query']);_0x425d76[_0x496e('0x39')]=_[_0x496e('0x38')](_0x3fe9cd[_0x496e('0x34')],qs['fields'](_0x46255d[_0x496e('0x36')][_0x496e('0x3a')]));_0x425d76[_0x496e('0x39')]=_0x425d76['attributes'][_0x496e('0x3b')]?_0x425d76['attributes']:_0x3fe9cd['model'];if(_0x46255d['query'][_0x496e('0x45')]){_0x425d76[_0x496e('0x4c')]=[{'all':!![]}];}_0x425d76=_['merge']({},_0x425d76,_0x46255d[_0x496e('0x4d')]);return db[_0x496e('0x31')][_0x496e('0x4e')](_0x425d76)[_0x496e('0x28')](handleEntityNotFound(_0x204cc9,null))[_0x496e('0x28')](respondWithResult(_0x204cc9,null))['catch'](handleError(_0x204cc9,null));};exports[_0x496e('0x4f')]=function(_0x717a0c,_0xd17a83){return db[_0x496e('0x31')][_0x496e('0x4f')](_0x717a0c['body'],{})[_0x496e('0x28')](function(_0x5a90ee){var _0x2ef74b=_0x717a0c[_0x496e('0x50')][_0x496e('0x29')]({'plain':!![]});if(!_0x2ef74b)throw new Error(_0x496e('0x51'));if(_0x2ef74b['role']==='user'){var _0x45a816=_0x5a90ee['get']({'plain':!![]});var _0x5a460f=_0x496e('0x2a');return db['UserProfileSection'][_0x496e('0x4e')]({'where':{'name':_0x5a460f,'userProfileId':_0x2ef74b[_0x496e('0x52')]},'raw':!![]})[_0x496e('0x28')](function(_0x53ed59){if(_0x53ed59&&_0x53ed59['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45a816['name'],'resourceId':_0x45a816['id'],'type':_0x53ed59[_0x496e('0x2e')],'sectionId':_0x53ed59['id']},{})[_0x496e('0x28')](function(){return _0x5a90ee;});}else{return _0x5a90ee;}})[_0x496e('0x48')](function(_0x1eb5c1){logger[_0x496e('0x2c')](_0x496e('0x53'),_0x1eb5c1);throw _0x1eb5c1;});}return _0x5a90ee;})[_0x496e('0x28')](respondWithResult(_0xd17a83,0xc9))[_0x496e('0x48')](handleError(_0xd17a83,null));};exports['update']=function(_0x813cdc,_0x4eb3c5){if(_0x813cdc['body']['id']){delete _0x813cdc[_0x496e('0x54')]['id'];}return db['CmContactHasItem'][_0x496e('0x4e')]({'where':{'id':_0x813cdc[_0x496e('0x4a')]['id']}})[_0x496e('0x28')](handleEntityNotFound(_0x4eb3c5,null))[_0x496e('0x28')](saveUpdates(_0x813cdc[_0x496e('0x54')],null))[_0x496e('0x28')](respondWithResult(_0x4eb3c5,null))[_0x496e('0x48')](handleError(_0x4eb3c5,null));};exports['destroy']=function(_0xecfadd,_0x55286d){return db[_0x496e('0x31')][_0x496e('0x4e')]({'where':{'id':_0xecfadd['params']['id']}})['then'](handleEntityNotFound(_0x55286d,null))[_0x496e('0x28')](removeEntity(_0x55286d,null))[_0x496e('0x48')](handleError(_0x55286d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e797ff2..0e35bbb 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f12=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x1e4176,_0x27f0c3){var _0xc9cc5c=function(_0xf39f0b){while(--_0xf39f0b){_0x1e4176['push'](_0x1e4176['shift']());}};_0xc9cc5c(++_0x27f0c3);}(_0x6f12,0x11d));var _0x26f1=function(_0x3b726c,_0x163aa2){_0x3b726c=_0x3b726c-0x0;var _0x38d420=_0x6f12[_0x3b726c];return _0x38d420;};'use strict';var _=require(_0x26f1('0x0'));var util=require(_0x26f1('0x1'));var logger=require(_0x26f1('0x2'))(_0x26f1('0x3'));var moment=require(_0x26f1('0x4'));var BPromise=require(_0x26f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26f1('0x6'));var rimraf=require(_0x26f1('0x7'));var config=require(_0x26f1('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0x26f1('0x9')]=function(_0x11ef0e,_0x3665fa){return _0x11ef0e[_0x26f1('0xa')](_0x26f1('0xb'),attributes,{'tableName':_0x26f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x495c=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmContactHasItem','util'];(function(_0x252fbc,_0x4eef08){var _0x51297f=function(_0x242775){while(--_0x242775){_0x252fbc['push'](_0x252fbc['shift']());}};_0x51297f(++_0x4eef08);}(_0x495c,0xdb));var _0xc495=function(_0x2a31d7,_0x43f3a7){_0x2a31d7=_0x2a31d7-0x0;var _0x1b6c63=_0x495c[_0x2a31d7];return _0x1b6c63;};'use strict';var _=require('lodash');var util=require(_0xc495('0x0'));var logger=require(_0xc495('0x1'))(_0xc495('0x2'));var moment=require(_0xc495('0x3'));var BPromise=require('bluebird');var rp=require(_0xc495('0x4'));var fs=require('fs');var path=require(_0xc495('0x5'));var rimraf=require(_0xc495('0x6'));var config=require(_0xc495('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0xc495('0x8')]=function(_0x2ea91f,_0x47eedb){return _0x2ea91f[_0xc495('0x9')](_0xc495('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 0f3acdd..e59e5da 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x983e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x260793,_0x49e622){var _0x1a4d7c=function(_0x203bd7){while(--_0x203bd7){_0x260793['push'](_0x260793['shift']());}};_0x1a4d7c(++_0x49e622);}(_0x983e,0x104));var _0xe983=function(_0xf0ef8c,_0x186527){_0xf0ef8c=_0xf0ef8c-0x0;var _0x488779=_0x983e[_0xf0ef8c];return _0x488779;};'use strict';var _=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var moment=require('moment');var BPromise=require(_0xe983('0x2'));var rs=require(_0xe983('0x3'));var fs=require('fs');var Redis=require(_0xe983('0x4'));var db=require(_0xe983('0x5'))['db'];var utils=require(_0xe983('0x6'));var logger=require('../../config/logger')(_0xe983('0x7'));var config=require(_0xe983('0x8'));var jayson=require(_0xe983('0x9'));var client=jayson[_0xe983('0xa')][_0xe983('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e45af,_0xffae42,_0x244c5b){return new BPromise(function(_0xb535d8,_0x75e798){return client[_0xe983('0xc')](_0x1e45af,_0x244c5b)[_0xe983('0xd')](function(_0x5b4909){logger[_0xe983('0xe')](_0xe983('0xf'),_0xffae42,'request\x20sent');logger['debug'](_0xe983('0x10'),_0xffae42,_0xe983('0x11'),JSON[_0xe983('0x12')](_0x5b4909));if(_0x5b4909[_0xe983('0x13')]){if(_0x5b4909[_0xe983('0x13')]['code']===0x1f4){logger[_0xe983('0x13')](_0xe983('0xf'),_0xffae42,_0x5b4909[_0xe983('0x13')][_0xe983('0x14')]);return _0x75e798(_0x5b4909[_0xe983('0x13')][_0xe983('0x14')]);}logger['error'](_0xe983('0xf'),_0xffae42,_0x5b4909[_0xe983('0x13')][_0xe983('0x14')]);return _0xb535d8(_0x5b4909[_0xe983('0x13')][_0xe983('0x14')]);}else{logger[_0xe983('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0xffae42,_0xe983('0x11'));_0xb535d8(_0x5b4909[_0xe983('0x15')][_0xe983('0x14')]);}})['catch'](function(_0x4a3bbb){logger[_0xe983('0x13')](_0xe983('0xf'),_0xffae42,_0x4a3bbb);_0x75e798(_0x4a3bbb);});});} \ No newline at end of file +var _0x4b87=['result','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x23a4a3,_0x52301d){var _0x594ece=function(_0x41d1c2){while(--_0x41d1c2){_0x23a4a3['push'](_0x23a4a3['shift']());}};_0x594ece(++_0x52301d);}(_0x4b87,0xe6));var _0x74b8=function(_0x4473d8,_0xe5715f){_0x4473d8=_0x4473d8-0x0;var _0x3e3623=_0x4b87[_0x4473d8];return _0x3e3623;};'use strict';var _=require('lodash');var util=require(_0x74b8('0x0'));var moment=require(_0x74b8('0x1'));var BPromise=require(_0x74b8('0x2'));var rs=require(_0x74b8('0x3'));var fs=require('fs');var Redis=require(_0x74b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x74b8('0x5'));var config=require('../../config/environment');var jayson=require(_0x74b8('0x6'));var client=jayson[_0x74b8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc41bcf,_0x357107,_0x1ecd99){return new BPromise(function(_0x244c63,_0x434238){return client[_0x74b8('0x8')](_0xc41bcf,_0x1ecd99)['then'](function(_0x1a05c6){logger[_0x74b8('0x9')](_0x74b8('0xa'),_0x357107,_0x74b8('0xb'));logger[_0x74b8('0xc')](_0x74b8('0xd'),_0x357107,'request\x20sent',JSON[_0x74b8('0xe')](_0x1a05c6));if(_0x1a05c6[_0x74b8('0xf')]){if(_0x1a05c6[_0x74b8('0xf')]['code']===0x1f4){logger[_0x74b8('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x357107,_0x1a05c6[_0x74b8('0xf')][_0x74b8('0x10')]);return _0x434238(_0x1a05c6[_0x74b8('0xf')][_0x74b8('0x10')]);}logger[_0x74b8('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x357107,_0x1a05c6[_0x74b8('0xf')][_0x74b8('0x10')]);return _0x244c63(_0x1a05c6[_0x74b8('0xf')][_0x74b8('0x10')]);}else{logger[_0x74b8('0x9')](_0x74b8('0xa'),_0x357107,'request\x20sent');_0x244c63(_0x1a05c6[_0x74b8('0x11')][_0x74b8('0x10')]);}})[_0x74b8('0x12')](function(_0x237a3c){logger['error'](_0x74b8('0xa'),_0x357107,_0x237a3c);_0x434238(_0x237a3c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8d4690e..4418bf1 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03db=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','create','put','update','delete','destroy','exports'];(function(_0x14b3e3,_0x505320){var _0x16dfab=function(_0x55bae8){while(--_0x55bae8){_0x14b3e3['push'](_0x14b3e3['shift']());}};_0x16dfab(++_0x505320);}(_0x03db,0xa0));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xb03d('0x0'));var path=require(_0xb03d('0x1'));var timeout=require(_0xb03d('0x2'));var express=require(_0xb03d('0x3'));var router=express[_0xb03d('0x4')]();var fs_extra=require(_0xb03d('0x5'));var auth=require(_0xb03d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0xb03d('0x7')]('/',auth[_0xb03d('0x8')](),controller['index']);router[_0xb03d('0x7')](_0xb03d('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb03d('0x8')](),controller[_0xb03d('0xa')]);router[_0xb03d('0xb')](_0xb03d('0x9'),auth[_0xb03d('0x8')](),controller[_0xb03d('0xc')]);router[_0xb03d('0xd')]('/:id',auth[_0xb03d('0x8')](),controller[_0xb03d('0xe')]);module[_0xb03d('0xf')]=router; \ No newline at end of file +var _0x55aa=['update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x55aa,0x113));var _0xa55a=function(_0x43ac4a,_0xa40d78){_0x43ac4a=_0x43ac4a-0x0;var _0x1d4d69=_0x55aa[_0x43ac4a];return _0x1d4d69;};'use strict';var multer=require('multer');var util=require(_0xa55a('0x0'));var path=require('path');var timeout=require(_0xa55a('0x1'));var express=require(_0xa55a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa55a('0x3'));var interaction=require(_0xa55a('0x4'));var config=require(_0xa55a('0x5'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0xa55a('0x6')](),controller[_0xa55a('0x7')]);router[_0xa55a('0x8')](_0xa55a('0x9'),auth[_0xa55a('0x6')](),controller[_0xa55a('0xa')]);router[_0xa55a('0xb')]('/',auth[_0xa55a('0x6')](),controller['create']);router[_0xa55a('0xc')](_0xa55a('0x9'),auth[_0xa55a('0x6')](),controller[_0xa55a('0xd')]);router[_0xa55a('0xe')]('/:id',auth[_0xa55a('0x6')](),controller[_0xa55a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 05cb0da..d5a8f2e 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 _0xbe64=['voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','long','values','stringify','BOOLEAN','ENUM'];(function(_0x37d3f3,_0xca010f){var _0x185c9c=function(_0x5e2bf2){while(--_0x5e2bf2){_0x37d3f3['push'](_0x37d3f3['shift']());}};_0x185c9c(++_0xca010f);}(_0xbe64,0x88));var _0x4be6=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xbe64[_0x406696];return _0x10e35c;};'use strict';var Sequelize=require(_0x4be6('0x0'));var _=require(_0x4be6('0x1'));module[_0x4be6('0x2')]={'name':{'type':Sequelize[_0x4be6('0x3')],'get':function(_0x49de03){return this[_0x4be6('0x4')]('alias');}},'alias':{'type':Sequelize[_0x4be6('0x5')],'allowNull':![],'set':function(_0x315066){this[_0x4be6('0x6')](_0x4be6('0x7'),_0x315066?_0x315066:this[_0x4be6('0x4')]('name'));}},'type':{'type':Sequelize[_0x4be6('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x4be6('0x8')](_0x4be6('0x9')),'get':function(){if(this[_0x4be6('0x4')]('type')==='select'){return JSON['parse'](this[_0x4be6('0x4')](_0x4be6('0xa')));}else{return this[_0x4be6('0x4')](_0x4be6('0xa'));}},'set':function(_0x4cfe88){if(Array['isArray'](_0x4cfe88)){this['setDataValue'](_0x4be6('0xa'),JSON[_0x4be6('0xb')](_0x4cfe88));}else{this[_0x4be6('0x6')](_0x4be6('0xa'),_0x4cfe88);}}},'required':{'type':Sequelize[_0x4be6('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4be6('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4be6('0xd')](_0x4be6('0xe'))}}; \ No newline at end of file +var _0x84e0=['exports','VIRTUAL','alias','STRING','setDataValue','name','getDataValue','select','parse','isArray','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x5ea875,_0x26adf1){var _0xb771a9=function(_0x4bf593){while(--_0x4bf593){_0x5ea875['push'](_0x5ea875['shift']());}};_0xb771a9(++_0x26adf1);}(_0x84e0,0xca));var _0x084e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x084e('0x0'));var _=require(_0x084e('0x1'));module[_0x084e('0x2')]={'name':{'type':Sequelize[_0x084e('0x3')],'get':function(_0x30ba91){return this['getDataValue'](_0x084e('0x4'));}},'alias':{'type':Sequelize[_0x084e('0x5')],'allowNull':![],'set':function(_0x2cd47e){this[_0x084e('0x6')](_0x084e('0x4'),_0x2cd47e?_0x2cd47e:this['getDataValue'](_0x084e('0x7')));}},'type':{'type':Sequelize[_0x084e('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x084e('0x8')]('type')===_0x084e('0x9')){return JSON[_0x084e('0xa')](this[_0x084e('0x8')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x4b39ea){if(Array[_0x084e('0xb')](_0x4b39ea)){this['setDataValue'](_0x084e('0xc'),JSON[_0x084e('0xd')](_0x4b39ea));}else{this[_0x084e('0x6')](_0x084e('0xc'),_0x4b39ea);}}},'required':{'type':Sequelize[_0x084e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x084e('0xf')](_0x084e('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 15f1a77..b5d1da6 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 _0x9eeb=['CmCustomField','includeAll','include','rows','show','params','find','body','catch','create','TEXT','type','text','Sequelize','INTEGER','BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','key','model','differenceBy','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options'];(function(_0x221511,_0x5f3719){var _0x3073e9=function(_0x1ff02a){while(--_0x1ff02a){_0x221511['push'](_0x221511['shift']());}};_0x3073e9(++_0x5f3719);}(_0x9eeb,0x1b3));var _0xb9ee=function(_0x5a00cb,_0x1979b4){_0x5a00cb=_0x5a00cb-0x0;var _0x1a616d=_0x9eeb[_0x5a00cb];return _0x1a616d;};'use strict';var emlformat=require(_0xb9ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9ee('0x1'));var jsonpatch=require(_0xb9ee('0x2'));var rp=require(_0xb9ee('0x3'));var moment=require(_0xb9ee('0x4'));var BPromise=require(_0xb9ee('0x5'));var Mustache=require(_0xb9ee('0x6'));var util=require(_0xb9ee('0x7'));var path=require(_0xb9ee('0x8'));var sox=require(_0xb9ee('0x9'));var csv=require(_0xb9ee('0xa'));var ejs=require(_0xb9ee('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9ee('0xc'));var squel=require('squel');var crypto=require(_0xb9ee('0xd'));var jsforce=require(_0xb9ee('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb9ee('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9ee('0xf'));var authService=require(_0xb9ee('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb9ee('0x11'));var hardwareService=require(_0xb9ee('0x12'));var logger=require(_0xb9ee('0x13'))(_0xb9ee('0x14'));var utils=require(_0xb9ee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb9ee('0x16'));var db=require(_0xb9ee('0x17'))['db'];function respondWithStatusCode(_0x2b2e39,_0x4fcc21){_0x4fcc21=_0x4fcc21||0xcc;return function(_0x234a92){if(_0x234a92){return _0x2b2e39[_0xb9ee('0x18')](_0x4fcc21);}return _0x2b2e39[_0xb9ee('0x19')](_0x4fcc21)[_0xb9ee('0x1a')]();};}function respondWithResult(_0x3eda2d,_0x417264){_0x417264=_0x417264||0xc8;return function(_0x2355c0){if(_0x2355c0){return _0x3eda2d[_0xb9ee('0x19')](_0x417264)[_0xb9ee('0x1b')](_0x2355c0);}};}function respondWithFilteredResult(_0x386d7b,_0x2b4005){return function(_0x109508){if(_0x109508){var _0x437419=typeof _0x2b4005['offset']===_0xb9ee('0x1c')&&typeof _0x2b4005[_0xb9ee('0x1d')]===_0xb9ee('0x1c');var _0x1f65bf=_0x109508[_0xb9ee('0x1e')];var _0x1c06af=_0x437419?0x0:_0x2b4005[_0xb9ee('0x1f')];var _0x3b90d0=_0x437419?_0x109508[_0xb9ee('0x1e')]:_0x2b4005[_0xb9ee('0x1f')]+_0x2b4005[_0xb9ee('0x1d')];var _0xc8e4cf;if(_0x3b90d0>=_0x1f65bf){_0x3b90d0=_0x1f65bf;_0xc8e4cf=0xc8;}else{_0xc8e4cf=0xce;}_0x386d7b[_0xb9ee('0x19')](_0xc8e4cf);return _0x386d7b['set'](_0xb9ee('0x20'),_0x1c06af+'-'+_0x3b90d0+'/'+_0x1f65bf)['json'](_0x109508);}return null;};}function patchUpdates(_0xd4d7ce){return function(_0x2efdb7){try{jsonpatch['apply'](_0x2efdb7,_0xd4d7ce,!![]);}catch(_0x3f342b){return BPromise['reject'](_0x3f342b);}return _0x2efdb7[_0xb9ee('0x21')]();};}function saveUpdates(_0x56fd72,_0x29a6f9){return function(_0x65e3fa){if(_0x65e3fa){return _0x65e3fa[_0xb9ee('0x22')](_0x56fd72)[_0xb9ee('0x23')](function(_0x59f0b8){return _0x59f0b8;});}return null;};}function removeEntity(_0x53dabe,_0x275ee1){return function(_0x36b833){if(_0x36b833){return _0x36b833[_0xb9ee('0x24')]()[_0xb9ee('0x23')](function(){_0x53dabe[_0xb9ee('0x19')](0xcc)[_0xb9ee('0x1a')]();});}};}function handleEntityNotFound(_0x59bc0c,_0x17e77f){return function(_0xe0b9ed){if(!_0xe0b9ed){_0x59bc0c[_0xb9ee('0x18')](0x194);}return _0xe0b9ed;};}function handleError(_0x11080c,_0x1b9ac4){_0x1b9ac4=_0x1b9ac4||0x1f4;return function(_0x138599){logger[_0xb9ee('0x25')](_0x138599[_0xb9ee('0x26')]);if(_0x138599['name']){delete _0x138599['name'];}_0x11080c[_0xb9ee('0x19')](_0x1b9ac4)[_0xb9ee('0x27')](_0x138599);};}exports[_0xb9ee('0x28')]=function(_0xc9a507,_0x70d4d6){var _0x2d2fed={},_0x5b11ae={},_0x337d9c={'count':0x0,'rows':[]};var _0x17763d=_['map'](db['CmCustomField'][_0xb9ee('0x29')],function(_0x1051b6){return{'name':_0x1051b6[_0xb9ee('0x2a')],'type':_0x1051b6['type'][_0xb9ee('0x2b')]};});_0x5b11ae[_0xb9ee('0x2c')]=_[_0xb9ee('0x2d')](_[_0xb9ee('0x2e')](_0x17763d,_0xb9ee('0x2f')),['name']);_0x5b11ae[_0xb9ee('0x30')]=_[_0xb9ee('0x31')](_0xc9a507['query']);_0x5b11ae[_0xb9ee('0x32')]=_[_0xb9ee('0x33')](_0x5b11ae[_0xb9ee('0x2c')],_0x5b11ae[_0xb9ee('0x30')]);_0x2d2fed[_0xb9ee('0x34')]=_[_0xb9ee('0x33')](_0x5b11ae[_0xb9ee('0x2c')],qs[_0xb9ee('0x35')](_0xc9a507[_0xb9ee('0x30')]['fields']));_0x2d2fed[_0xb9ee('0x34')]=_0x2d2fed[_0xb9ee('0x34')][_0xb9ee('0x36')]?_0x2d2fed[_0xb9ee('0x34')]:_0x5b11ae[_0xb9ee('0x2c')];if(!_0xc9a507[_0xb9ee('0x30')][_0xb9ee('0x37')](_0xb9ee('0x38'))){_0x2d2fed[_0xb9ee('0x1d')]=qs['limit'](_0xc9a507[_0xb9ee('0x30')][_0xb9ee('0x1d')]);_0x2d2fed[_0xb9ee('0x1f')]=qs[_0xb9ee('0x1f')](_0xc9a507[_0xb9ee('0x30')]['offset']);}_0x2d2fed['order']=qs[_0xb9ee('0x39')](_0xc9a507['query'][_0xb9ee('0x39')]);_0x2d2fed['where']=qs['filters'](_[_0xb9ee('0x3a')](_0xc9a507['query'],_0x5b11ae['filters']),_0x17763d);if(_0xc9a507[_0xb9ee('0x30')][_0xb9ee('0x3b')]){_0x2d2fed[_0xb9ee('0x3c')]=_[_0xb9ee('0x3d')](_0x2d2fed[_0xb9ee('0x3c')],{'$or':_[_0xb9ee('0x2e')](_0x17763d,function(_0x3c3fe1){if(_0x3c3fe1['type']!=='VIRTUAL'){var _0x5acb5c={};_0x5acb5c[_0x3c3fe1[_0xb9ee('0x2f')]]={'$like':'%'+_0xc9a507['query'][_0xb9ee('0x3b')]+'%'};return _0x5acb5c;}})});}_0x2d2fed=_[_0xb9ee('0x3d')]({},_0x2d2fed,_0xc9a507[_0xb9ee('0x3e')]);var _0x3f444d={'where':_0x2d2fed[_0xb9ee('0x3c')]};return db[_0xb9ee('0x3f')]['count'](_0x3f444d)[_0xb9ee('0x23')](function(_0x77886c){_0x337d9c['count']=_0x77886c;if(_0xc9a507['query'][_0xb9ee('0x40')]){_0x2d2fed[_0xb9ee('0x41')]=[{'all':!![]}];}return db[_0xb9ee('0x3f')]['findAll'](_0x2d2fed);})[_0xb9ee('0x23')](function(_0x376ea0){_0x337d9c[_0xb9ee('0x42')]=_0x376ea0;return _0x337d9c;})[_0xb9ee('0x23')](respondWithFilteredResult(_0x70d4d6,_0x2d2fed))['catch'](handleError(_0x70d4d6,null));};exports[_0xb9ee('0x43')]=function(_0x1eb414,_0x52f51c){var _0x234b31={'raw':!![],'where':{'id':_0x1eb414[_0xb9ee('0x44')]['id']}},_0x31401a={};_0x31401a['model']=_['keys'](db['CmCustomField'][_0xb9ee('0x29')]);_0x31401a[_0xb9ee('0x30')]=_[_0xb9ee('0x31')](_0x1eb414[_0xb9ee('0x30')]);_0x31401a[_0xb9ee('0x32')]=_[_0xb9ee('0x33')](_0x31401a[_0xb9ee('0x2c')],_0x31401a[_0xb9ee('0x30')]);_0x234b31['attributes']=_[_0xb9ee('0x33')](_0x31401a[_0xb9ee('0x2c')],qs[_0xb9ee('0x35')](_0x1eb414['query'][_0xb9ee('0x35')]));_0x234b31['attributes']=_0x234b31[_0xb9ee('0x34')]['length']?_0x234b31[_0xb9ee('0x34')]:_0x31401a[_0xb9ee('0x2c')];if(_0x1eb414[_0xb9ee('0x30')]['includeAll']){_0x234b31['include']=[{'all':!![]}];}_0x234b31=_['merge']({},_0x234b31,_0x1eb414[_0xb9ee('0x3e')]);return db[_0xb9ee('0x3f')][_0xb9ee('0x45')](_0x234b31)[_0xb9ee('0x23')](handleEntityNotFound(_0x52f51c,null))[_0xb9ee('0x23')](respondWithResult(_0x52f51c,null))['catch'](handleError(_0x52f51c,null));};exports[_0xb9ee('0x22')]=function(_0x3aeb4c,_0x1037ca){if(_0x3aeb4c[_0xb9ee('0x46')]['id']){delete _0x3aeb4c['body']['id'];}return db[_0xb9ee('0x3f')]['find']({'where':{'id':_0x3aeb4c[_0xb9ee('0x44')]['id']}})[_0xb9ee('0x23')](handleEntityNotFound(_0x1037ca,null))[_0xb9ee('0x23')](saveUpdates(_0x3aeb4c[_0xb9ee('0x46')],null))[_0xb9ee('0x23')](respondWithResult(_0x1037ca,null))[_0xb9ee('0x47')](handleError(_0x1037ca,null));};exports[_0xb9ee('0x24')]=function(_0x83a5b,_0x54b14b){return db[_0xb9ee('0x3f')][_0xb9ee('0x45')]({'where':{'id':_0x83a5b[_0xb9ee('0x44')]['id']}})[_0xb9ee('0x23')](handleEntityNotFound(_0x54b14b,null))[_0xb9ee('0x23')](removeEntity(_0x54b14b,null))[_0xb9ee('0x47')](handleError(_0x54b14b,null));};exports['create']=function(_0x34dcb8,_0x379cfe){var _0x4fef17;return db['sequelize']['transaction'](function(_0x118e60){return db[_0xb9ee('0x3f')][_0xb9ee('0x48')](_0x34dcb8['body'],{'transaction':_0x118e60})[_0xb9ee('0x23')](function(_0xc49724){_0x4fef17=_0xc49724;var _0x27412c={'type':db['Sequelize'][_0xb9ee('0x49')],'transaction':_0x118e60};switch(_0x34dcb8[_0xb9ee('0x46')][_0xb9ee('0x4a')]){case _0xb9ee('0x4b'):_0x27412c['type']=db[_0xb9ee('0x4c')][_0xb9ee('0x49')];break;case'number':_0x27412c[_0xb9ee('0x4a')]=db[_0xb9ee('0x4c')][_0xb9ee('0x4d')];break;case'switch':_0x27412c[_0xb9ee('0x4a')]=db['Sequelize'][_0xb9ee('0x4e')];_0x27412c['defaultValue']=![];break;default:}return db['sequelize'][_0xb9ee('0x4f')][_0xb9ee('0x50')]('cm_contacts',util[_0xb9ee('0x51')](_0xb9ee('0x52'),_0x4fef17['id']),_0x27412c);})['then'](function(){return _0x4fef17;});})['then'](respondWithResult(_0x379cfe,0xc9))[_0xb9ee('0x47')](handleError(_0x379cfe,null));}; \ No newline at end of file +var _0x6e7c=['save','then','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','show','merge','find','catch','update','body','params','create','transaction','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject'];(function(_0x5a7e7c,_0x36a4d3){var _0x3edbc6=function(_0xe30426){while(--_0xe30426){_0x5a7e7c['push'](_0x5a7e7c['shift']());}};_0x3edbc6(++_0x36a4d3);}(_0x6e7c,0x8e));var _0xc6e7=function(_0x50b2c7,_0x18b05e){_0x50b2c7=_0x50b2c7-0x0;var _0x2c8b75=_0x6e7c[_0x50b2c7];return _0x2c8b75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e7('0x1'));var rp=require('request-promise');var moment=require(_0xc6e7('0x2'));var BPromise=require(_0xc6e7('0x3'));var Mustache=require(_0xc6e7('0x4'));var util=require('util');var path=require(_0xc6e7('0x5'));var sox=require(_0xc6e7('0x6'));var csv=require('to-csv');var ejs=require(_0xc6e7('0x7'));var fs=require('fs');var fs_extra=require(_0xc6e7('0x8'));var _=require(_0xc6e7('0x9'));var squel=require(_0xc6e7('0xa'));var crypto=require(_0xc6e7('0xb'));var jsforce=require(_0xc6e7('0xc'));var deskjs=require(_0xc6e7('0xd'));var toCsv=require(_0xc6e7('0xe'));var querystring=require('querystring');var Papa=require(_0xc6e7('0xf'));var Redis=require(_0xc6e7('0x10'));var authService=require(_0xc6e7('0x11'));var qs=require(_0xc6e7('0x12'));var as=require(_0xc6e7('0x13'));var hardwareService=require(_0xc6e7('0x14'));var logger=require(_0xc6e7('0x15'))(_0xc6e7('0x16'));var utils=require(_0xc6e7('0x17'));var config=require(_0xc6e7('0x18'));var licenseUtil=require(_0xc6e7('0x19'));var db=require(_0xc6e7('0x1a'))['db'];function respondWithStatusCode(_0x405921,_0x4dd1f1){_0x4dd1f1=_0x4dd1f1||0xcc;return function(_0x28ffaa){if(_0x28ffaa){return _0x405921[_0xc6e7('0x1b')](_0x4dd1f1);}return _0x405921[_0xc6e7('0x1c')](_0x4dd1f1)[_0xc6e7('0x1d')]();};}function respondWithResult(_0x10c131,_0xd88efb){_0xd88efb=_0xd88efb||0xc8;return function(_0x22b506){if(_0x22b506){return _0x10c131[_0xc6e7('0x1c')](_0xd88efb)[_0xc6e7('0x1e')](_0x22b506);}};}function respondWithFilteredResult(_0x461998,_0x3d0473){return function(_0xbec8c9){if(_0xbec8c9){var _0x2c3ea6=typeof _0x3d0473[_0xc6e7('0x1f')]==='undefined'&&typeof _0x3d0473[_0xc6e7('0x20')]==='undefined';var _0x153859=_0xbec8c9[_0xc6e7('0x21')];var _0x1e59e4=_0x2c3ea6?0x0:_0x3d0473['offset'];var _0x3419fa=_0x2c3ea6?_0xbec8c9[_0xc6e7('0x21')]:_0x3d0473[_0xc6e7('0x1f')]+_0x3d0473['limit'];var _0x1a0259;if(_0x3419fa>=_0x153859){_0x3419fa=_0x153859;_0x1a0259=0xc8;}else{_0x1a0259=0xce;}_0x461998[_0xc6e7('0x1c')](_0x1a0259);return _0x461998[_0xc6e7('0x22')](_0xc6e7('0x23'),_0x1e59e4+'-'+_0x3419fa+'/'+_0x153859)[_0xc6e7('0x1e')](_0xbec8c9);}return null;};}function patchUpdates(_0x3662e7){return function(_0x13f6d8){try{jsonpatch[_0xc6e7('0x24')](_0x13f6d8,_0x3662e7,!![]);}catch(_0xc6ff83){return BPromise[_0xc6e7('0x25')](_0xc6ff83);}return _0x13f6d8[_0xc6e7('0x26')]();};}function saveUpdates(_0xdc728f,_0x3abf6f){return function(_0x292909){if(_0x292909){return _0x292909['update'](_0xdc728f)[_0xc6e7('0x27')](function(_0x1b624a){return _0x1b624a;});}return null;};}function removeEntity(_0x5ccb17,_0x1669f0){return function(_0x47e3bf){if(_0x47e3bf){return _0x47e3bf['destroy']()['then'](function(){_0x5ccb17[_0xc6e7('0x1c')](0xcc)[_0xc6e7('0x1d')]();});}};}function handleEntityNotFound(_0x100635,_0x274f18){return function(_0x5aa599){if(!_0x5aa599){_0x100635[_0xc6e7('0x1b')](0x194);}return _0x5aa599;};}function handleError(_0x11f3c0,_0x2ccfbf){_0x2ccfbf=_0x2ccfbf||0x1f4;return function(_0x477eed){logger[_0xc6e7('0x28')](_0x477eed['stack']);if(_0x477eed[_0xc6e7('0x29')]){delete _0x477eed[_0xc6e7('0x29')];}_0x11f3c0[_0xc6e7('0x1c')](_0x2ccfbf)[_0xc6e7('0x2a')](_0x477eed);};}exports[_0xc6e7('0x2b')]=function(_0x2094a6,_0x2e723b){var _0x203766={},_0x5f2a33={},_0x12de59={'count':0x0,'rows':[]};var _0x4a3fa2=_[_0xc6e7('0x2c')](db[_0xc6e7('0x2d')][_0xc6e7('0x2e')],function(_0x46dba3){return{'name':_0x46dba3[_0xc6e7('0x2f')],'type':_0x46dba3['type'][_0xc6e7('0x30')]};});_0x5f2a33[_0xc6e7('0x31')]=_[_0xc6e7('0x32')](_[_0xc6e7('0x2c')](_0x4a3fa2,'name'),['name']);_0x5f2a33[_0xc6e7('0x33')]=_[_0xc6e7('0x34')](_0x2094a6[_0xc6e7('0x33')]);_0x5f2a33[_0xc6e7('0x35')]=_[_0xc6e7('0x36')](_0x5f2a33['model'],_0x5f2a33['query']);_0x203766[_0xc6e7('0x37')]=_[_0xc6e7('0x36')](_0x5f2a33[_0xc6e7('0x31')],qs['fields'](_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x38')]));_0x203766[_0xc6e7('0x37')]=_0x203766[_0xc6e7('0x37')][_0xc6e7('0x39')]?_0x203766[_0xc6e7('0x37')]:_0x5f2a33[_0xc6e7('0x31')];if(!_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x3a')](_0xc6e7('0x3b'))){_0x203766['limit']=qs[_0xc6e7('0x20')](_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x20')]);_0x203766['offset']=qs[_0xc6e7('0x1f')](_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x1f')]);}_0x203766[_0xc6e7('0x3c')]=qs[_0xc6e7('0x3d')](_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x3d')]);_0x203766[_0xc6e7('0x3e')]=qs[_0xc6e7('0x35')](_[_0xc6e7('0x3f')](_0x2094a6['query'],_0x5f2a33[_0xc6e7('0x35')]),_0x4a3fa2);if(_0x2094a6[_0xc6e7('0x33')][_0xc6e7('0x40')]){_0x203766[_0xc6e7('0x3e')]=_['merge'](_0x203766[_0xc6e7('0x3e')],{'$or':_[_0xc6e7('0x2c')](_0x4a3fa2,function(_0x4b8aae){if(_0x4b8aae[_0xc6e7('0x41')]!==_0xc6e7('0x42')){var _0x137342={};_0x137342[_0x4b8aae['name']]={'$like':'%'+_0x2094a6['query'][_0xc6e7('0x40')]+'%'};return _0x137342;}})});}_0x203766=_['merge']({},_0x203766,_0x2094a6[_0xc6e7('0x43')]);var _0x5cb3c4={'where':_0x203766['where']};return db[_0xc6e7('0x2d')][_0xc6e7('0x21')](_0x5cb3c4)[_0xc6e7('0x27')](function(_0x2b6089){_0x12de59[_0xc6e7('0x21')]=_0x2b6089;if(_0x2094a6['query'][_0xc6e7('0x44')]){_0x203766[_0xc6e7('0x45')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x203766);})[_0xc6e7('0x27')](function(_0x47504a){_0x12de59[_0xc6e7('0x46')]=_0x47504a;return _0x12de59;})['then'](respondWithFilteredResult(_0x2e723b,_0x203766))['catch'](handleError(_0x2e723b,null));};exports[_0xc6e7('0x47')]=function(_0x54903d,_0xe02376){var _0x277a92={'raw':!![],'where':{'id':_0x54903d['params']['id']}},_0x305095={};_0x305095[_0xc6e7('0x31')]=_[_0xc6e7('0x34')](db[_0xc6e7('0x2d')]['rawAttributes']);_0x305095[_0xc6e7('0x33')]=_[_0xc6e7('0x34')](_0x54903d[_0xc6e7('0x33')]);_0x305095[_0xc6e7('0x35')]=_[_0xc6e7('0x36')](_0x305095[_0xc6e7('0x31')],_0x305095['query']);_0x277a92[_0xc6e7('0x37')]=_[_0xc6e7('0x36')](_0x305095[_0xc6e7('0x31')],qs[_0xc6e7('0x38')](_0x54903d[_0xc6e7('0x33')][_0xc6e7('0x38')]));_0x277a92[_0xc6e7('0x37')]=_0x277a92[_0xc6e7('0x37')]['length']?_0x277a92[_0xc6e7('0x37')]:_0x305095['model'];if(_0x54903d[_0xc6e7('0x33')][_0xc6e7('0x44')]){_0x277a92[_0xc6e7('0x45')]=[{'all':!![]}];}_0x277a92=_[_0xc6e7('0x48')]({},_0x277a92,_0x54903d[_0xc6e7('0x43')]);return db[_0xc6e7('0x2d')][_0xc6e7('0x49')](_0x277a92)['then'](handleEntityNotFound(_0xe02376,null))[_0xc6e7('0x27')](respondWithResult(_0xe02376,null))[_0xc6e7('0x4a')](handleError(_0xe02376,null));};exports[_0xc6e7('0x4b')]=function(_0x206b3e,_0x3c5563){if(_0x206b3e[_0xc6e7('0x4c')]['id']){delete _0x206b3e[_0xc6e7('0x4c')]['id'];}return db[_0xc6e7('0x2d')][_0xc6e7('0x49')]({'where':{'id':_0x206b3e[_0xc6e7('0x4d')]['id']}})[_0xc6e7('0x27')](handleEntityNotFound(_0x3c5563,null))[_0xc6e7('0x27')](saveUpdates(_0x206b3e['body'],null))[_0xc6e7('0x27')](respondWithResult(_0x3c5563,null))[_0xc6e7('0x4a')](handleError(_0x3c5563,null));};exports['destroy']=function(_0x30b954,_0x32783e){return db[_0xc6e7('0x2d')]['find']({'where':{'id':_0x30b954['params']['id']}})[_0xc6e7('0x27')](handleEntityNotFound(_0x32783e,null))['then'](removeEntity(_0x32783e,null))[_0xc6e7('0x4a')](handleError(_0x32783e,null));};exports[_0xc6e7('0x4e')]=function(_0x2f479c,_0x3dc0e2){var _0x1f0793;return db['sequelize'][_0xc6e7('0x4f')](function(_0x1192cd){return db[_0xc6e7('0x2d')][_0xc6e7('0x4e')](_0x2f479c[_0xc6e7('0x4c')],{'transaction':_0x1192cd})[_0xc6e7('0x27')](function(_0x6a9e5){_0x1f0793=_0x6a9e5;var _0x30312e={'type':db[_0xc6e7('0x50')][_0xc6e7('0x51')],'transaction':_0x1192cd};switch(_0x2f479c[_0xc6e7('0x4c')][_0xc6e7('0x41')]){case'text':_0x30312e['type']=db['Sequelize'][_0xc6e7('0x51')];break;case'number':_0x30312e[_0xc6e7('0x41')]=db[_0xc6e7('0x50')][_0xc6e7('0x52')];break;case _0xc6e7('0x53'):_0x30312e[_0xc6e7('0x41')]=db[_0xc6e7('0x50')][_0xc6e7('0x54')];_0x30312e[_0xc6e7('0x55')]=![];break;default:}return db[_0xc6e7('0x56')][_0xc6e7('0x57')][_0xc6e7('0x58')]('cm_contacts',util[_0xc6e7('0x59')]('cf_%d',_0x1f0793['id']),_0x30312e);})[_0xc6e7('0x27')](function(){return _0x1f0793;});})['then'](respondWithResult(_0x3dc0e2,0xc9))['catch'](handleError(_0x3dc0e2,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 4f02158..9e50bf8 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 _0xe10f=['api','moment','request-promise','path','../../config/environment','define','lodash','util','../../config/logger'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe10f,0x102));var _0xfe10=function(_0x52d26f,_0x2c6fe7){_0x52d26f=_0x52d26f-0x0;var _0x5a4501=_0xe10f[_0x52d26f];return _0x5a4501;};'use strict';var _=require(_0xfe10('0x0'));var util=require(_0xfe10('0x1'));var logger=require(_0xfe10('0x2'))(_0xfe10('0x3'));var moment=require(_0xfe10('0x4'));var BPromise=require('bluebird');var rp=require(_0xfe10('0x5'));var fs=require('fs');var path=require(_0xfe10('0x6'));var rimraf=require('rimraf');var config=require(_0xfe10('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x2858bf,_0x57f74b){return _0x2858bf[_0xfe10('0x8')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dcf=['lodash','util','../../config/logger','api','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x244b18,_0x3e8f78){var _0xf3bf67=function(_0x9aedf8){while(--_0x9aedf8){_0x244b18['push'](_0x244b18['shift']());}};_0xf3bf67(++_0x3e8f78);}(_0x6dcf,0x78));var _0xf6dc=function(_0xdf9f34,_0x1536ee){_0xdf9f34=_0xdf9f34-0x0;var _0x1a5b1f=_0x6dcf[_0xdf9f34];return _0x1a5b1f;};'use strict';var _=require(_0xf6dc('0x0'));var util=require(_0xf6dc('0x1'));var logger=require(_0xf6dc('0x2'))(_0xf6dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');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(_0xf6dc('0x4'));module[_0xf6dc('0x5')]=function(_0x193d03,_0x34a6df){return _0x193d03[_0xf6dc('0x6')](_0xf6dc('0x7'),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 f130200..7336e57 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 _0xe9e1=['result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x561c71,_0x2f2fa4){var _0x1f244e=function(_0xb73eec){while(--_0xb73eec){_0x561c71['push'](_0x561c71['shift']());}};_0x1f244e(++_0x2f2fa4);}(_0xe9e1,0xe9));var _0x1e9e=function(_0x585754,_0x306455){_0x585754=_0x585754-0x0;var _0x2039b5=_0xe9e1[_0x585754];return _0x2039b5;};'use strict';var _=require(_0x1e9e('0x0'));var util=require(_0x1e9e('0x1'));var moment=require(_0x1e9e('0x2'));var BPromise=require(_0x1e9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e9e('0x5'));var logger=require(_0x1e9e('0x6'))(_0x1e9e('0x7'));var config=require(_0x1e9e('0x8'));var jayson=require(_0x1e9e('0x9'));var client=jayson[_0x1e9e('0xa')][_0x1e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1156af,_0x46609c,_0x527c59){return new BPromise(function(_0x1a9569,_0x4414f5){return client['request'](_0x1156af,_0x527c59)['then'](function(_0x5ee861){logger['info'](_0x1e9e('0xc'),_0x46609c,_0x1e9e('0xd'));logger[_0x1e9e('0xe')](_0x1e9e('0xf'),_0x46609c,_0x1e9e('0xd'),JSON[_0x1e9e('0x10')](_0x5ee861));if(_0x5ee861[_0x1e9e('0x11')]){if(_0x5ee861[_0x1e9e('0x11')]['code']===0x1f4){logger[_0x1e9e('0x11')](_0x1e9e('0xc'),_0x46609c,_0x5ee861[_0x1e9e('0x11')][_0x1e9e('0x12')]);return _0x4414f5(_0x5ee861[_0x1e9e('0x11')][_0x1e9e('0x12')]);}logger[_0x1e9e('0x11')](_0x1e9e('0xc'),_0x46609c,_0x5ee861[_0x1e9e('0x11')]['message']);return _0x1a9569(_0x5ee861[_0x1e9e('0x11')][_0x1e9e('0x12')]);}else{logger['info'](_0x1e9e('0xc'),_0x46609c,'request\x20sent');_0x1a9569(_0x5ee861[_0x1e9e('0x13')][_0x1e9e('0x12')]);}})[_0x1e9e('0x14')](function(_0x5701db){logger[_0x1e9e('0x11')](_0x1e9e('0xc'),_0x46609c,_0x5701db);_0x4414f5(_0x5701db);});});} \ No newline at end of file +var _0x49df=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x49df,0x79));var _0xf49d=function(_0x23f0ba,_0x4a7be4){_0x23f0ba=_0x23f0ba-0x0;var _0x41bd76=_0x49df[_0x23f0ba];return _0x41bd76;};'use strict';var _=require(_0xf49d('0x0'));var util=require(_0xf49d('0x1'));var moment=require(_0xf49d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf49d('0x3'));var db=require(_0xf49d('0x4'))['db'];var utils=require(_0xf49d('0x5'));var logger=require(_0xf49d('0x6'))(_0xf49d('0x7'));var config=require('../../config/environment');var jayson=require(_0xf49d('0x8'));var client=jayson['client'][_0xf49d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b7333,_0x3621f7,_0x560df6){return new BPromise(function(_0x63e3f4,_0x2792e1){return client['request'](_0x2b7333,_0x560df6)[_0xf49d('0xa')](function(_0x23e777){logger['info'](_0xf49d('0xb'),_0x3621f7,_0xf49d('0xc'));logger[_0xf49d('0xd')](_0xf49d('0xe'),_0x3621f7,_0xf49d('0xc'),JSON[_0xf49d('0xf')](_0x23e777));if(_0x23e777[_0xf49d('0x10')]){if(_0x23e777[_0xf49d('0x10')]['code']===0x1f4){logger[_0xf49d('0x10')](_0xf49d('0xb'),_0x3621f7,_0x23e777[_0xf49d('0x10')][_0xf49d('0x11')]);return _0x2792e1(_0x23e777[_0xf49d('0x10')][_0xf49d('0x11')]);}logger[_0xf49d('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3621f7,_0x23e777['error'][_0xf49d('0x11')]);return _0x63e3f4(_0x23e777[_0xf49d('0x10')][_0xf49d('0x11')]);}else{logger[_0xf49d('0x12')]('CmCustomField,\x20%s,\x20%s',_0x3621f7,_0xf49d('0xc'));_0x63e3f4(_0x23e777[_0xf49d('0x13')][_0xf49d('0x11')]);}})[_0xf49d('0x14')](function(_0x9c288a){logger[_0xf49d('0x10')](_0xf49d('0xb'),_0x3621f7,_0x9c288a);_0x2792e1(_0x9c288a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 1a31ce9..4eb7a66 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 _0xe011=['isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x32da44,_0x221f8d){var _0x3bc20f=function(_0x1e5b1d){while(--_0x1e5b1d){_0x32da44['push'](_0x32da44['shift']());}};_0x3bc20f(++_0x221f8d);}(_0xe011,0x14c));var _0x1e01=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xe011[_0x4fdc46];return _0x2c178a;};'use strict';var multer=require(_0x1e01('0x0'));var util=require(_0x1e01('0x1'));var path=require(_0x1e01('0x2'));var timeout=require(_0x1e01('0x3'));var express=require(_0x1e01('0x4'));var router=express['Router']();var fs_extra=require(_0x1e01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e01('0x6'));var config=require(_0x1e01('0x7'));var controller=require(_0x1e01('0x8'));router[_0x1e01('0x9')]('/',auth[_0x1e01('0xa')](),controller[_0x1e01('0xb')]);router[_0x1e01('0x9')](_0x1e01('0xc'),auth[_0x1e01('0xa')](),controller[_0x1e01('0xd')]);router[_0x1e01('0xe')]('/',auth[_0x1e01('0xa')](),controller[_0x1e01('0xf')]);router['put'](_0x1e01('0xc'),auth[_0x1e01('0xa')](),controller[_0x1e01('0x10')]);router[_0x1e01('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x84e7=['delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','create','put','/:id'];(function(_0x528bb1,_0x29a193){var _0x2c138d=function(_0xf0a0c8){while(--_0xf0a0c8){_0x528bb1['push'](_0x528bb1['shift']());}};_0x2c138d(++_0x29a193);}(_0x84e7,0x122));var _0x784e=function(_0x270e94,_0x15ce09){_0x270e94=_0x270e94-0x0;var _0x198a21=_0x84e7[_0x270e94];return _0x198a21;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x784e('0x4'));var interaction=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var controller=require(_0x784e('0x7'));router[_0x784e('0x8')]('/',auth[_0x784e('0x9')](),controller['index']);router[_0x784e('0x8')]('/:id',auth[_0x784e('0x9')](),controller[_0x784e('0xa')]);router['post']('/',auth[_0x784e('0x9')](),controller[_0x784e('0xb')]);router[_0x784e('0xc')](_0x784e('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x784e('0xe')](_0x784e('0xd'),auth[_0x784e('0x9')](),controller[_0x784e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 14968dc..df8e94e 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 _0x98e5=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x1d3180,_0x2c060c){var _0x2c9470=function(_0x2beee0){while(--_0x2beee0){_0x1d3180['push'](_0x1d3180['shift']());}};_0x2c9470(++_0x2c060c);}(_0x98e5,0x132));var _0x598e=function(_0x695a98,_0x5d1bf9){_0x695a98=_0x695a98-0x0;var _0x25af96=_0x98e5[_0x695a98];return _0x25af96;};'use strict';var moment=require(_0x598e('0x0'));var Sequelize=require(_0x598e('0x1'));module[_0x598e('0x2')]={'phone':{'type':Sequelize[_0x598e('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x598e('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x598e('0x5')],'defaultValue':moment()[_0x598e('0x6')](_0x598e('0x7'))},'countbusyretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x598e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x598e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x598e('0x8')](0x2)[_0x598e('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x598e('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x598e('0x8')],'unique':_0x598e('0xa')},'ListId':{'type':Sequelize[_0x598e('0x8')],'unique':_0x598e('0xa')},'UserId':{'type':Sequelize[_0x598e('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x598e('0xa')},'CampaignId':{'type':Sequelize[_0x598e('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x598e('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x598e('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x598e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x25e4=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE'];(function(_0x49f66e,_0x3e2369){var _0x55a1e2=function(_0x50bccd){while(--_0x50bccd){_0x49f66e['push'](_0x49f66e['shift']());}};_0x55a1e2(++_0x3e2369);}(_0x25e4,0x68));var _0x425e=function(_0x170a7a,_0x4b64af){_0x170a7a=_0x170a7a-0x0;var _0x6db647=_0x25e4[_0x170a7a];return _0x6db647;};'use strict';var moment=require('moment');var Sequelize=require(_0x425e('0x0'));module['exports']={'phone':{'type':Sequelize[_0x425e('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x425e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x425e('0x3')],'defaultValue':moment()[_0x425e('0x4')](_0x425e('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x425e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x425e('0x3')]},'priority':{'type':Sequelize[_0x425e('0x6')](0x2)[_0x425e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x425e('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x425e('0x6')],'unique':_0x425e('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x425e('0x6')],'unique':_0x425e('0x8')},'CampaignId':{'type':Sequelize[_0x425e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x425e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x425e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x425e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x425e('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x425e('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x425e('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 39ba775..4524c8b 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 _0x038b=['limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','isNumber','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','status','json','offset','undefined'];(function(_0x457da5,_0x21ec27){var _0x52fed3=function(_0x28b6c1){while(--_0x28b6c1){_0x457da5['push'](_0x457da5['shift']());}};_0x52fed3(++_0x21ec27);}(_0x038b,0x114));var _0xb038=function(_0x1b22f4,_0x16f72e){_0x1b22f4=_0x1b22f4-0x0;var _0x288512=_0x038b[_0x1b22f4];return _0x288512;};'use strict';var moment=require('moment');var _=require(_0xb038('0x0'));var qs=require(_0xb038('0x1'));var logger=require(_0xb038('0x2'))('api');var shared=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x23574d,_0x3d090b){_0x3d090b=_0x3d090b||0xc8;return function(_0x4a8a30){if(_0x4a8a30){return _0x23574d[_0xb038('0x4')](_0x3d090b)[_0xb038('0x5')](_0x4a8a30);}};}function respondWithFilteredResult(_0x4fe092,_0x54e1e7){return function(_0x2e3e64){if(_0x2e3e64){var _0x1b077a=typeof _0x54e1e7[_0xb038('0x6')]==='undefined'&&typeof _0x54e1e7['limit']===_0xb038('0x7');var _0x20c102=_0x2e3e64['count'];var _0x53bcc0=_0x1b077a?0x0:_0x54e1e7[_0xb038('0x6')];var _0x2d1ae5=_0x1b077a?_0x2e3e64['count']:_0x54e1e7[_0xb038('0x6')]+_0x54e1e7[_0xb038('0x8')];var _0x3fc2c1;if(_0x2d1ae5>=_0x20c102){_0x2d1ae5=_0x20c102;_0x3fc2c1=0xc8;}else{_0x3fc2c1=0xce;}_0x4fe092[_0xb038('0x4')](_0x3fc2c1);return _0x4fe092[_0xb038('0x9')](_0xb038('0xa'),_0x53bcc0+'-'+_0x2d1ae5+'/'+_0x20c102)[_0xb038('0x5')](_0x2e3e64);}return null;};}function saveUpdates(_0x439751,_0x16e4a3){return function(_0x57acd8){if(_0x57acd8){return _0x57acd8[_0xb038('0xb')](_0x439751)[_0xb038('0xc')](function(_0x1b9686){return _0x1b9686;});}return null;};}function handleEntityNotFound(_0x3cc717,_0x3a71a6){return function(_0x13acc7){if(!_0x13acc7){_0x3cc717[_0xb038('0xd')](0x194);}return _0x13acc7;};}function handleError(_0x535109,_0xe8aa7c){_0xe8aa7c=_0xe8aa7c||0x1f4;return function(_0x26e4f2){logger[_0xb038('0xe')](_0x26e4f2[_0xb038('0xf')]);if(_0x26e4f2[_0xb038('0x10')]){delete _0x26e4f2[_0xb038('0x10')];}_0x535109['status'](_0xe8aa7c)[_0xb038('0x11')](_0x26e4f2);};}exports[_0xb038('0x12')]=function(_0xd1fae0,_0x3b095a){var _0x4aa892={},_0x49b237={},_0x20cea2={'count':0x0,'rows':[]};var _0x3f48e6=_[_0xb038('0x13')](db[_0xb038('0x14')]['rawAttributes'],function(_0x222b84){return{'name':_0x222b84[_0xb038('0x15')],'type':_0x222b84[_0xb038('0x16')][_0xb038('0x17')]};});_0x49b237[_0xb038('0x18')]=_['map'](_0x3f48e6,_0xb038('0x10'));_0x49b237[_0xb038('0x19')]=_[_0xb038('0x1a')](_0xd1fae0[_0xb038('0x19')]);_0x49b237['filters']=_[_0xb038('0x1b')](_0x49b237[_0xb038('0x18')],_0x49b237['query']);_0x49b237[_0xb038('0x1c')]=_[_0xb038('0x1d')](_0x49b237['filters'],[_0xb038('0x1e'),'$or',_0xb038('0x1f'),_0xb038('0x20'),_0xb038('0x21'),_0xb038('0x22'),_0xb038('0x23'),_0xb038('0x24'),_0xb038('0x25'),'$between',_0xb038('0x26'),_0xb038('0x27'),_0xb038('0x28'),'$like',_0xb038('0x29'),_0xb038('0x2a'),_0xb038('0x2b'),'$like',_0xb038('0x2c'),_0xb038('0x2d'),_0xb038('0x2e'),_0xb038('0x2f')]);_0x4aa892[_0xb038('0x30')]=_['intersection'](_0x49b237[_0xb038('0x18')],qs[_0xb038('0x31')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x31')]));_0x4aa892[_0xb038('0x30')]=_0x4aa892[_0xb038('0x30')][_0xb038('0x32')]?_0x4aa892[_0xb038('0x30')]:_0x49b237[_0xb038('0x18')];if(!_0xd1fae0[_0xb038('0x19')][_0xb038('0x33')](_0xb038('0x34'))){_0x4aa892[_0xb038('0x8')]=qs['limit'](_0xd1fae0[_0xb038('0x19')]['limit']);_0x4aa892[_0xb038('0x6')]=qs[_0xb038('0x6')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x6')]);}_0x4aa892[_0xb038('0x35')]=qs[_0xb038('0x36')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x36')]);_0x4aa892[_0xb038('0x37')]=qs[_0xb038('0x1c')](_['pick'](_0xd1fae0[_0xb038('0x19')],_0x49b237[_0xb038('0x1c')]),_0x3f48e6);if(_0xd1fae0[_0xb038('0x19')]['filter']){_0x4aa892['where']=_['merge'](_0x4aa892[_0xb038('0x37')],{'$or':_[_0xb038('0x13')](_0x3f48e6,function(_0x30677e){if(_0x30677e[_0xb038('0x16')]!==_0xb038('0x38')){var _0x268f1b={};_0x268f1b[_0x30677e['name']]={'$like':'%'+_0xd1fae0[_0xb038('0x19')][_0xb038('0x39')]+'%'};return _0x268f1b;}})});}_0x4aa892=_[_0xb038('0x3a')]({},_0x4aa892,_0xd1fae0[_0xb038('0x3b')]);var _0x48e70b={'where':_0x4aa892[_0xb038('0x37')]};return db[_0xb038('0x14')]['count'](_0x48e70b)['then'](function(_0x26c769){_0x20cea2[_0xb038('0x3c')]=_0x26c769;if(_0xd1fae0[_0xb038('0x19')][_0xb038('0x3d')]){_0x4aa892[_0xb038('0x3e')]=[{'all':!![]}];}return db['CmHopper'][_0xb038('0x3f')](_0x4aa892);})[_0xb038('0xc')](function(_0x26d48c){_0x20cea2[_0xb038('0x40')]=_0x26d48c;return _0x20cea2;})['then'](respondWithFilteredResult(_0x3b095a,_0x4aa892))[_0xb038('0x41')](handleError(_0x3b095a,null));};exports[_0xb038('0x42')]=function(_0x7d2f79,_0x573426){var _0x412d71={'raw':!![],'where':{'id':_0x7d2f79[_0xb038('0x43')]['id']}},_0x594c0d={};_0x594c0d[_0xb038('0x18')]=_[_0xb038('0x1a')](db['CmHopper'][_0xb038('0x44')]);_0x594c0d[_0xb038('0x19')]=_[_0xb038('0x1a')](_0x7d2f79['query']);_0x594c0d[_0xb038('0x1c')]=_[_0xb038('0x1b')](_0x594c0d[_0xb038('0x18')],_0x594c0d[_0xb038('0x19')]);_0x412d71['attributes']=_[_0xb038('0x1b')](_0x594c0d[_0xb038('0x18')],qs[_0xb038('0x31')](_0x7d2f79[_0xb038('0x19')]['fields']));_0x412d71[_0xb038('0x30')]=_0x412d71[_0xb038('0x30')]['length']?_0x412d71[_0xb038('0x30')]:_0x594c0d[_0xb038('0x18')];if(_0x7d2f79[_0xb038('0x19')]['includeAll']){_0x412d71[_0xb038('0x3e')]=[{'all':!![]}];}_0x412d71=_[_0xb038('0x3a')]({},_0x412d71,_0x7d2f79['options']);return db['CmHopper'][_0xb038('0x45')](_0x412d71)[_0xb038('0xc')](handleEntityNotFound(_0x573426,null))[_0xb038('0xc')](respondWithResult(_0x573426,null))[_0xb038('0x41')](handleError(_0x573426,null));};exports[_0xb038('0x46')]=function(_0x36e48c,_0x630aef){return db[_0xb038('0x14')]['create'](_0x36e48c['body'],{})['then'](respondWithResult(_0x630aef,0xc9))[_0xb038('0x41')](handleError(_0x630aef,null));};exports[_0xb038('0xb')]=function(_0x52f0b8,_0x46a724){if(_0x52f0b8[_0xb038('0x47')]['id']){delete _0x52f0b8[_0xb038('0x47')]['id'];}return db['CmHopper'][_0xb038('0x45')]({'where':{'id':_0x52f0b8['params']['id']}})['then'](handleEntityNotFound(_0x46a724,null))[_0xb038('0xc')](saveUpdates(_0x52f0b8[_0xb038('0x47')],null))[_0xb038('0xc')](respondWithResult(_0x46a724,null))[_0xb038('0x41')](handleError(_0x46a724,null));};exports[_0xb038('0x48')]=function(_0x3b09e3,_0x2f053a){return db[_0xb038('0x14')][_0xb038('0x48')]()[_0xb038('0xc')](respondWithResult(_0x2f053a,null))['catch'](handleError(_0x2f053a,null));};exports[_0xb038('0x49')]=function(_0x3ed968,_0x5c11d7){var _0x906c9c;var _0x19ab72=_0x3ed968['params']['id'];return db[_0xb038('0x14')][_0xb038('0x45')]({'where':{'id':_0x3ed968[_0xb038('0x43')]['id']}})[_0xb038('0xc')](handleEntityNotFound(_0x5c11d7,null))[_0xb038('0xc')](function(_0x45a1b5){if(_0x45a1b5){return _0x45a1b5[_0xb038('0x49')]()[_0xb038('0xc')](function(_0x3a291d){return _0x3a291d;});}})['then'](function(_0x62daba){_0x906c9c=_0x62daba;if(_0x62daba){if(_0x62daba[_0xb038('0x4a')]||_0x62daba[_0xb038('0x4b')]){return db[_0x62daba[_0xb038('0x4a')]?_0xb038('0x4c'):_0xb038('0x4d')]['find']({'where':{'id':_0x62daba[_0xb038('0x4a')]?_0x62daba[_0xb038('0x4a')]:_0x62daba[_0xb038('0x4b')]},'attributes':['id',_0xb038('0x10')],'raw':!![]});}}})[_0xb038('0xc')](function(_0x24198c){var _0xd7a862={};if(_0x24198c){_['merge'](_0xd7a862,_[_0xb038('0x4e')](_0x906c9c['dataValues'],[_0xb038('0x4f'),_0xb038('0x50'),'id']));_0xd7a862[_0xb038('0x51')]=0x15;_0xd7a862[_0xb038('0x52')]=_0xb038('0x53');_0xd7a862['campaign']=_0x24198c['name'];_0xd7a862['membername']=_0x3ed968[_0xb038('0x54')][_0xb038('0x10')];_0xd7a862[_0xb038('0x55')]=_0x3ed968[_0xb038('0x54')]['id'];_0xd7a862[_0xb038('0x53')]=!![];_0xd7a862[_0xb038('0x56')]=moment()['format'](_0xb038('0x57'));_0xd7a862[_0xb038('0x58')]=_0x906c9c['phone'];_0xd7a862['campaigntype']=_0x906c9c[_0xb038('0x4a')]?'queue':_0xb038('0x59');return db['CmContact'][_0xb038('0x45')]({'where':{'id':_0xd7a862[_0xb038('0x5a')]},'attributes':[_0xb038('0x5b'),_0xb038('0x5c')]})['then'](function(_0x32aea0){if(!_[_0xb038('0x5d')](_0x5c11d7)&&!_[_0xb038('0x5d')](_0x32aea0[_0xb038('0x5b')])){_0xd7a862[_0xb038('0x5e')]=_0x32aea0[_0xb038('0x5b')];if(!_[_0xb038('0x5d')](_0x32aea0[_0xb038('0x5c')])){_0xd7a862[_0xb038('0x5e')]+='\x20'+_0x32aea0[_0xb038('0x5c')];}}})[_0xb038('0x5f')](function(){return db[_0xb038('0x60')]['create'](_0xd7a862);});}})[_0xb038('0xc')](function(_0x2fc38d){return db[_0xb038('0x61')][_0xb038('0x49')]({'where':{'CmHopperId':_0x19ab72}});})[_0xb038('0xc')](function(){return _0x5c11d7['status'](0xcc)[_0xb038('0x62')]();})['catch'](handleError(_0x5c11d7,null));};exports[_0xb038('0x63')]=function(_0x170a7e,_0x47e809){var _0x15d61c=[];return db[_0xb038('0x64')][_0xb038('0x48')]()[_0xb038('0xc')](function(_0x120cc7){_0x15d61c=_[_0xb038('0x1a')](_0x120cc7);return _0x170a7e[_0xb038('0x54')][_0xb038('0x65')]({'where':{'type':_0xb038('0x66'),'dialActive':!![],'dialMethod':_0xb038('0x67')},'attributes':['id','dialOrderByScheduledAt',_0xb038('0x68')],'raw':!![]});})['then'](function(_0x189894){if(_0x189894&&_0x189894[_0xb038('0x32')]){return db[_0xb038('0x69')][_0xb038('0x6a')](function(_0x1f5f3f){var _0x23fb92={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb038('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x189894,'id')},'$or':[{'UserId':null},{'UserId':_0x170a7e[_0xb038('0x54')]['id']}]};var _0x3a7310={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x189894)[_0xb038('0x39')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xb038('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x170a7e['user']['id']}]};var _0x35da9e={'$or':[_0x23fb92,_0x3a7310]};var _0x50e078=[];if(_0x170a7e[_0xb038('0x47')]['direction']&&_0x170a7e[_0xb038('0x47')][_0xb038('0x6d')]===_0xb038('0x6e')){if(!_[_0xb038('0x6f')](_0x170a7e[_0xb038('0x47')][_0xb038('0x70')])){_0x35da9e['id']={'$in':_0x170a7e['body']['hopperIds']};}_0x50e078=[[_0xb038('0x71'),'ASC'],[_0xb038('0x72'),_0x189894[0x0][_0xb038('0x73')]===_0xb038('0x74')?'DESC':_0xb038('0x74')],db['sequelize'][_0xb038('0x75')](_0xb038('0x76')),['id',_0xb038('0x77')]];}else{if(!_[_0xb038('0x6f')](_0x170a7e[_0xb038('0x47')][_0xb038('0x70')])){_0x35da9e['id']={'$notIn':_0x170a7e[_0xb038('0x47')][_0xb038('0x70')]};}_0x50e078=[[_0xb038('0x71'),'DESC'],['scheduledAt',_0x189894[0x0]['dialOrderByScheduledAt']],db[_0xb038('0x69')]['literal'](_0xb038('0x78')),['id','ASC']];}return db[_0xb038('0x14')][_0xb038('0x79')]({'attributes':['id',_0xb038('0x7a'),_0xb038('0x7b'),_0xb038('0x7c')],'where':_0x35da9e,'order':_0x50e078,'transaction':_0x1f5f3f,'lock':_0x1f5f3f[_0xb038('0x7d')][_0xb038('0x7e')],'include':[{'model':db[_0xb038('0x64')],'as':_0xb038('0x7f'),'attributes':_0x15d61c,'include':[{'model':db[_0xb038('0x80')],'as':_0xb038('0x81'),'attributes':['id',_0xb038('0x10')]}]},{'model':db[_0xb038('0x82')],'as':_0xb038('0x83'),'attributes':['id',_0xb038('0x10')]},{'model':db[_0xb038('0x4c')],'as':_0xb038('0x84'),'attributes':['id',_0xb038('0x10'),_0xb038('0x85')]}]})['then'](function(_0x23adc3){if(_0x23adc3){return _0x23adc3[_0xb038('0xb')]({'UserId':_0x170a7e[_0xb038('0x54')]['id']},{'transaction':_0x1f5f3f});}});});}})[_0xb038('0xc')](handleEntityNotFound(_0x47e809,null))[_0xb038('0xc')](respondWithResult(_0x47e809,null))['catch'](handleError(_0x47e809,null));};exports[_0xb038('0x86')]=function(_0x1489a1,_0x297b75,_0x80d720){var _0x34e222=[];var _0x468b41=_0x1489a1[_0xb038('0x43')]['id'];var _0x2d0313=_0x1489a1[_0xb038('0x54')]['id'];return db['CmContact']['describe']()[_0xb038('0xc')](function(_0x496f1e){_0x34e222=_[_0xb038('0x1a')](_0x496f1e);return db['sequelize']['transaction'](function(_0x4aeb6b){const _0x43c4b7={'id':_0x468b41};return db[_0xb038('0x14')]['findOne']({'attributes':['id',_0xb038('0x7a'),_0xb038('0x7c')],'where':_0x43c4b7,'transaction':_0x4aeb6b,'lock':_0x4aeb6b[_0xb038('0x7d')][_0xb038('0x7e')],'include':[{'model':db[_0xb038('0x64')],'as':_0xb038('0x7f'),'attributes':_0x34e222,'include':[{'model':db[_0xb038('0x80')],'as':_0xb038('0x81'),'attributes':['id',_0xb038('0x10')]}]},{'model':db[_0xb038('0x82')],'as':'List','attributes':['id',_0xb038('0x10')]},{'model':db[_0xb038('0x4c')],'as':_0xb038('0x84'),'attributes':['id',_0xb038('0x10'),_0xb038('0x85')]}]})[_0xb038('0xc')](function(_0x425854){if(_0x425854){return _0x425854['update']({'UserId':_0x2d0313},{'transaction':_0x4aeb6b});}});});})[_0xb038('0xc')](handleEntityNotFound(_0x297b75,null))[_0xb038('0xc')](respondWithResult(_0x297b75,null))[_0xb038('0x41')](handleError(_0x297b75,null));};exports['getOpenContacts']=function(_0x551fcc,_0x2adf3b){return _0x551fcc[_0xb038('0x54')][_0xb038('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb038('0x67')},'attributes':['id'],'raw':!![]})[_0xb038('0xc')](function(_0x5b003a){if(_0x5b003a&&_0x5b003a[_0xb038('0x32')]){return db[_0xb038('0x14')][_0xb038('0x3c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb038('0x6b')](_0xb038('0x57'))},'VoiceQueueId':{'$in':_[_0xb038('0x13')](_0x5b003a,'id')},'$or':[{'UserId':null},{'UserId':_0x551fcc[_0xb038('0x54')]['id']}]}});}return 0x0;})[_0xb038('0xc')](function(_0x27a14a){if(!_[_0xb038('0x5d')](_0x27a14a)&&_[_0xb038('0x87')](_0x27a14a)){return _0x2adf3b[_0xb038('0x4')](0xc8)[_0xb038('0x5')]({'contacts':_0x27a14a});}else{logger[_0xb038('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xb038('0x88'),0x194,_0xb038('0x89'));_0x2adf3b[_0xb038('0xd')](0x194);}})[_0xb038('0x41')](handleError(_0x2adf3b,null));};exports[_0xb038('0x8a')]=function(_0x1df908,_0x3ce0a2){var _0xf9caa5=shared['timezones'];var _0x3e29d2=[];_[_0xb038('0x13')](_0xf9caa5,function(_0x4d7537){_0x3e29d2[_0xb038('0x8b')]({'id':_0x4d7537['name'],'name':_0x4d7537['name'],'utcOffset':_0x4d7537[_0xb038('0x8c')]});});return _0x3ce0a2['status'](0xc8)[_0xb038('0x5')]({'tz':_0x3e29d2});};exports['getTimezone']=function(_0x3493da,_0x1d15df){var _0x231ba1=shared[_0xb038('0x8d')];var _0x367475={};if(!_[_0xb038('0x5d')](_0x231ba1[_0x3493da[_0xb038('0x47')]['id']]))_0x367475=_0x231ba1[_0x3493da[_0xb038('0x47')]['id']];return _0x1d15df['status'](0xc8)['json'](_0x367475);}; \ No newline at end of file +var _0xb138=['deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','sequelize','format','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','priority','dialOrderByScheduledAt','ASC','literal','DESC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','CmList','List','dialActive','getPreviewRecall','transaction','Company','Queue','getOpenContacts','getVoiceQueues','outbound','preview','isNumber','entity\x20not\x20found','getTimezones','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','then','sendStatus','error','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','keys','query','intersection','filters','concat','$and','$or','$gte','$lte','$ne','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','includeAll','catch','create','body','update','find','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId'];(function(_0x2f45a7,_0x38905e){var _0x1d5a0d=function(_0x45fd5d){while(--_0x45fd5d){_0x2f45a7['push'](_0x2f45a7['shift']());}};_0x1d5a0d(++_0x38905e);}(_0xb138,0x1dd));var _0x8b13=function(_0x52e9d5,_0xc908ea){_0x52e9d5=_0x52e9d5-0x0;var _0x36b7d4=_0xb138[_0x52e9d5];return _0x36b7d4;};'use strict';var moment=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var qs=require(_0x8b13('0x2'));var logger=require(_0x8b13('0x3'))(_0x8b13('0x4'));var shared=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];function respondWithResult(_0x5369d4,_0x4411a0){_0x4411a0=_0x4411a0||0xc8;return function(_0x241acb){if(_0x241acb){return _0x5369d4[_0x8b13('0x7')](_0x4411a0)['json'](_0x241acb);}};}function respondWithFilteredResult(_0xd19a0f,_0x13f7bd){return function(_0x5d51b1){if(_0x5d51b1){var _0x3fdf4d=typeof _0x13f7bd[_0x8b13('0x8')]===_0x8b13('0x9')&&typeof _0x13f7bd['limit']===_0x8b13('0x9');var _0x1aed6f=_0x5d51b1['count'];var _0x53ae50=_0x3fdf4d?0x0:_0x13f7bd[_0x8b13('0x8')];var _0x21fcd9=_0x3fdf4d?_0x5d51b1[_0x8b13('0xa')]:_0x13f7bd[_0x8b13('0x8')]+_0x13f7bd[_0x8b13('0xb')];var _0x51f070;if(_0x21fcd9>=_0x1aed6f){_0x21fcd9=_0x1aed6f;_0x51f070=0xc8;}else{_0x51f070=0xce;}_0xd19a0f[_0x8b13('0x7')](_0x51f070);return _0xd19a0f[_0x8b13('0xc')](_0x8b13('0xd'),_0x53ae50+'-'+_0x21fcd9+'/'+_0x1aed6f)[_0x8b13('0xe')](_0x5d51b1);}return null;};}function saveUpdates(_0xb227e0,_0x1893b1){return function(_0x58f97e){if(_0x58f97e){return _0x58f97e['update'](_0xb227e0)[_0x8b13('0xf')](function(_0x130a6f){return _0x130a6f;});}return null;};}function handleEntityNotFound(_0x5f12b5,_0x51a935){return function(_0x479773){if(!_0x479773){_0x5f12b5[_0x8b13('0x10')](0x194);}return _0x479773;};}function handleError(_0x407ef4,_0xf29086){_0xf29086=_0xf29086||0x1f4;return function(_0x2c615a){logger[_0x8b13('0x11')](_0x2c615a['stack']);if(_0x2c615a[_0x8b13('0x12')]){delete _0x2c615a[_0x8b13('0x12')];}_0x407ef4[_0x8b13('0x7')](_0xf29086)[_0x8b13('0x13')](_0x2c615a);};}exports[_0x8b13('0x14')]=function(_0x1fcfe6,_0x10fbde){var _0x441ddc={},_0x4989d3={},_0x4dac71={'count':0x0,'rows':[]};var _0xae4966=_[_0x8b13('0x15')](db[_0x8b13('0x16')][_0x8b13('0x17')],function(_0x1e0fe3){return{'name':_0x1e0fe3[_0x8b13('0x18')],'type':_0x1e0fe3['type'][_0x8b13('0x19')]};});_0x4989d3[_0x8b13('0x1a')]=_[_0x8b13('0x15')](_0xae4966,'name');_0x4989d3['query']=_[_0x8b13('0x1b')](_0x1fcfe6[_0x8b13('0x1c')]);_0x4989d3['filters']=_[_0x8b13('0x1d')](_0x4989d3[_0x8b13('0x1a')],_0x4989d3[_0x8b13('0x1c')]);_0x4989d3[_0x8b13('0x1e')]=_[_0x8b13('0x1f')](_0x4989d3['filters'],[_0x8b13('0x20'),_0x8b13('0x21'),'$gt',_0x8b13('0x22'),'$lt',_0x8b13('0x23'),_0x8b13('0x24'),'$eq',_0x8b13('0x25'),_0x8b13('0x26'),'$notBetween',_0x8b13('0x27'),_0x8b13('0x28'),_0x8b13('0x29'),_0x8b13('0x2a'),_0x8b13('0x2b'),'$notILike',_0x8b13('0x29'),_0x8b13('0x2c'),_0x8b13('0x2d'),_0x8b13('0x2e'),_0x8b13('0x2f')]);_0x441ddc[_0x8b13('0x30')]=_['intersection'](_0x4989d3[_0x8b13('0x1a')],qs[_0x8b13('0x31')](_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x31')]));_0x441ddc[_0x8b13('0x30')]=_0x441ddc[_0x8b13('0x30')][_0x8b13('0x32')]?_0x441ddc[_0x8b13('0x30')]:_0x4989d3[_0x8b13('0x1a')];if(!_0x1fcfe6['query'][_0x8b13('0x33')](_0x8b13('0x34'))){_0x441ddc[_0x8b13('0xb')]=qs[_0x8b13('0xb')](_0x1fcfe6['query']['limit']);_0x441ddc[_0x8b13('0x8')]=qs['offset'](_0x1fcfe6['query'][_0x8b13('0x8')]);}_0x441ddc['order']=qs[_0x8b13('0x35')](_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x35')]);_0x441ddc[_0x8b13('0x36')]=qs[_0x8b13('0x1e')](_[_0x8b13('0x37')](_0x1fcfe6[_0x8b13('0x1c')],_0x4989d3[_0x8b13('0x1e')]),_0xae4966);if(_0x1fcfe6[_0x8b13('0x1c')][_0x8b13('0x38')]){_0x441ddc['where']=_[_0x8b13('0x39')](_0x441ddc[_0x8b13('0x36')],{'$or':_[_0x8b13('0x15')](_0xae4966,function(_0x4141db){if(_0x4141db[_0x8b13('0x3a')]!==_0x8b13('0x3b')){var _0x6b4645={};_0x6b4645[_0x4141db[_0x8b13('0x12')]]={'$like':'%'+_0x1fcfe6['query'][_0x8b13('0x38')]+'%'};return _0x6b4645;}})});}_0x441ddc=_['merge']({},_0x441ddc,_0x1fcfe6[_0x8b13('0x3c')]);var _0x37732c={'where':_0x441ddc[_0x8b13('0x36')]};return db[_0x8b13('0x16')][_0x8b13('0xa')](_0x37732c)[_0x8b13('0xf')](function(_0x4ec1a5){_0x4dac71['count']=_0x4ec1a5;if(_0x1fcfe6[_0x8b13('0x1c')]['includeAll']){_0x441ddc[_0x8b13('0x3d')]=[{'all':!![]}];}return db['CmHopper'][_0x8b13('0x3e')](_0x441ddc);})[_0x8b13('0xf')](function(_0x29a359){_0x4dac71[_0x8b13('0x3f')]=_0x29a359;return _0x4dac71;})[_0x8b13('0xf')](respondWithFilteredResult(_0x10fbde,_0x441ddc))['catch'](handleError(_0x10fbde,null));};exports['show']=function(_0x230a8c,_0x595d8d){var _0x6ba2f3={'raw':!![],'where':{'id':_0x230a8c['params']['id']}},_0x9f2d81={};_0x9f2d81[_0x8b13('0x1a')]=_[_0x8b13('0x1b')](db[_0x8b13('0x16')][_0x8b13('0x17')]);_0x9f2d81[_0x8b13('0x1c')]=_[_0x8b13('0x1b')](_0x230a8c[_0x8b13('0x1c')]);_0x9f2d81['filters']=_['intersection'](_0x9f2d81['model'],_0x9f2d81[_0x8b13('0x1c')]);_0x6ba2f3[_0x8b13('0x30')]=_[_0x8b13('0x1d')](_0x9f2d81[_0x8b13('0x1a')],qs[_0x8b13('0x31')](_0x230a8c[_0x8b13('0x1c')]['fields']));_0x6ba2f3[_0x8b13('0x30')]=_0x6ba2f3['attributes'][_0x8b13('0x32')]?_0x6ba2f3['attributes']:_0x9f2d81[_0x8b13('0x1a')];if(_0x230a8c[_0x8b13('0x1c')][_0x8b13('0x40')]){_0x6ba2f3[_0x8b13('0x3d')]=[{'all':!![]}];}_0x6ba2f3=_[_0x8b13('0x39')]({},_0x6ba2f3,_0x230a8c[_0x8b13('0x3c')]);return db[_0x8b13('0x16')]['find'](_0x6ba2f3)['then'](handleEntityNotFound(_0x595d8d,null))['then'](respondWithResult(_0x595d8d,null))[_0x8b13('0x41')](handleError(_0x595d8d,null));};exports[_0x8b13('0x42')]=function(_0x288faa,_0x288838){return db['CmHopper']['create'](_0x288faa[_0x8b13('0x43')],{})['then'](respondWithResult(_0x288838,0xc9))[_0x8b13('0x41')](handleError(_0x288838,null));};exports[_0x8b13('0x44')]=function(_0x20c363,_0x28ae75){if(_0x20c363[_0x8b13('0x43')]['id']){delete _0x20c363['body']['id'];}return db[_0x8b13('0x16')][_0x8b13('0x45')]({'where':{'id':_0x20c363[_0x8b13('0x46')]['id']}})[_0x8b13('0xf')](handleEntityNotFound(_0x28ae75,null))[_0x8b13('0xf')](saveUpdates(_0x20c363[_0x8b13('0x43')],null))[_0x8b13('0xf')](respondWithResult(_0x28ae75,null))[_0x8b13('0x41')](handleError(_0x28ae75,null));};exports[_0x8b13('0x47')]=function(_0x518298,_0x46d096){return db['CmHopper'][_0x8b13('0x47')]()[_0x8b13('0xf')](respondWithResult(_0x46d096,null))[_0x8b13('0x41')](handleError(_0x46d096,null));};exports['destroy']=function(_0x148efb,_0x35f612){var _0x257107;var _0x4129c0=_0x148efb[_0x8b13('0x46')]['id'];return db[_0x8b13('0x16')][_0x8b13('0x45')]({'where':{'id':_0x148efb['params']['id']}})[_0x8b13('0xf')](handleEntityNotFound(_0x35f612,null))['then'](function(_0x19b70b){if(_0x19b70b){return _0x19b70b[_0x8b13('0x48')]()[_0x8b13('0xf')](function(_0x435867){return _0x435867;});}})[_0x8b13('0xf')](function(_0x22e613){_0x257107=_0x22e613;if(_0x22e613){if(_0x22e613[_0x8b13('0x49')]||_0x22e613[_0x8b13('0x4a')]){return db[_0x22e613[_0x8b13('0x49')]?_0x8b13('0x4b'):_0x8b13('0x4c')][_0x8b13('0x45')]({'where':{'id':_0x22e613[_0x8b13('0x49')]?_0x22e613[_0x8b13('0x49')]:_0x22e613[_0x8b13('0x4a')]},'attributes':['id',_0x8b13('0x12')],'raw':!![]});}}})[_0x8b13('0xf')](function(_0x50c354){var _0x1699c6={};if(_0x50c354){_[_0x8b13('0x39')](_0x1699c6,_['omit'](_0x257107[_0x8b13('0x4d')],[_0x8b13('0x4e'),_0x8b13('0x4f'),'id']));_0x1699c6[_0x8b13('0x50')]=0x15;_0x1699c6[_0x8b13('0x51')]=_0x8b13('0x52');_0x1699c6[_0x8b13('0x53')]=_0x50c354[_0x8b13('0x12')];_0x1699c6[_0x8b13('0x54')]=_0x148efb[_0x8b13('0x55')][_0x8b13('0x12')];_0x1699c6[_0x8b13('0x56')]=_0x148efb[_0x8b13('0x55')]['id'];_0x1699c6[_0x8b13('0x52')]=!![];_0x1699c6[_0x8b13('0x57')]=moment()['format'](_0x8b13('0x58'));_0x1699c6[_0x8b13('0x59')]=_0x257107['phone'];_0x1699c6[_0x8b13('0x5a')]=_0x257107[_0x8b13('0x49')]?_0x8b13('0x5b'):_0x8b13('0x5c');return db[_0x8b13('0x5d')]['find']({'where':{'id':_0x1699c6[_0x8b13('0x5e')]},'attributes':[_0x8b13('0x5f'),_0x8b13('0x60')]})['then'](function(_0x5d76a7){if(!_[_0x8b13('0x61')](_0x35f612)&&!_['isNil'](_0x5d76a7[_0x8b13('0x5f')])){_0x1699c6[_0x8b13('0x62')]=_0x5d76a7[_0x8b13('0x5f')];if(!_[_0x8b13('0x61')](_0x5d76a7['lastName'])){_0x1699c6[_0x8b13('0x62')]+='\x20'+_0x5d76a7[_0x8b13('0x60')];}}})['finally'](function(){return db[_0x8b13('0x63')][_0x8b13('0x42')](_0x1699c6);});}})[_0x8b13('0xf')](function(_0x23a63c){return db['CmHopperAdditionalPhone'][_0x8b13('0x48')]({'where':{'CmHopperId':_0x4129c0}});})[_0x8b13('0xf')](function(){return _0x35f612[_0x8b13('0x7')](0xcc)[_0x8b13('0x64')]();})[_0x8b13('0x41')](handleError(_0x35f612,null));};exports[_0x8b13('0x65')]=function(_0x571e89,_0x123f52){var _0x1082d9=[];return db[_0x8b13('0x5d')]['describe']()[_0x8b13('0xf')](function(_0x576c91){_0x1082d9=_[_0x8b13('0x1b')](_0x576c91);return _0x571e89[_0x8b13('0x55')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8b13('0xf')](function(_0x1bc936){if(_0x1bc936&&_0x1bc936['length']){return db[_0x8b13('0x66')]['transaction'](function(_0x274bad){var _0x2d2fa3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b13('0x67')](_0x8b13('0x58'))},'VoiceQueueId':{'$in':_[_0x8b13('0x15')](_0x1bc936,'id')},'$or':[{'UserId':null},{'UserId':_0x571e89[_0x8b13('0x55')]['id']}]};var _0xa7c7d5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1bc936)['filter']([_0x8b13('0x68'),0x0])['map']('id')[_0x8b13('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x571e89[_0x8b13('0x55')]['id']}]};var _0x207a54={'$or':[_0x2d2fa3,_0xa7c7d5]};var _0x11a4ba=[];if(_0x571e89[_0x8b13('0x43')][_0x8b13('0x6a')]&&_0x571e89[_0x8b13('0x43')]['direction']===_0x8b13('0x6b')){if(!_['isEmpty'](_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')])){_0x207a54['id']={'$in':_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')]};}_0x11a4ba=[[_0x8b13('0x6d'),'ASC'],['scheduledAt',_0x1bc936[0x0][_0x8b13('0x6e')]===_0x8b13('0x6f')?'DESC':_0x8b13('0x6f')],db[_0x8b13('0x66')][_0x8b13('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x8b13('0x71')]];}else{if(!_[_0x8b13('0x72')](_0x571e89[_0x8b13('0x43')][_0x8b13('0x6c')])){_0x207a54['id']={'$notIn':_0x571e89['body'][_0x8b13('0x6c')]};}_0x11a4ba=[[_0x8b13('0x6d'),'DESC'],[_0x8b13('0x73'),_0x1bc936[0x0][_0x8b13('0x6e')]],db[_0x8b13('0x66')][_0x8b13('0x70')](_0x8b13('0x74')),['id',_0x8b13('0x6f')]];}return db[_0x8b13('0x16')][_0x8b13('0x75')]({'attributes':['id',_0x8b13('0x76'),_0x8b13('0x77'),_0x8b13('0x78')],'where':_0x207a54,'order':_0x11a4ba,'transaction':_0x274bad,'lock':_0x274bad[_0x8b13('0x79')][_0x8b13('0x7a')],'include':[{'model':db[_0x8b13('0x5d')],'as':'Contact','attributes':_0x1082d9,'include':[{'model':db[_0x8b13('0x7b')],'as':'Company','attributes':['id',_0x8b13('0x12')]}]},{'model':db[_0x8b13('0x7c')],'as':_0x8b13('0x7d'),'attributes':['id',_0x8b13('0x12')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x8b13('0x12'),_0x8b13('0x7e')]}]})['then'](function(_0x21b638){if(_0x21b638){return _0x21b638[_0x8b13('0x44')]({'UserId':_0x571e89[_0x8b13('0x55')]['id']},{'transaction':_0x274bad});}});});}})[_0x8b13('0xf')](handleEntityNotFound(_0x123f52,null))[_0x8b13('0xf')](respondWithResult(_0x123f52,null))[_0x8b13('0x41')](handleError(_0x123f52,null));};exports[_0x8b13('0x7f')]=function(_0xce30cc,_0xddd6f9,_0x24211c){var _0x48fd36=[];var _0x2a1fd3=_0xce30cc[_0x8b13('0x46')]['id'];var _0x5ac2c4=_0xce30cc[_0x8b13('0x55')]['id'];return db[_0x8b13('0x5d')]['describe']()[_0x8b13('0xf')](function(_0x44ca37){_0x48fd36=_[_0x8b13('0x1b')](_0x44ca37);return db[_0x8b13('0x66')][_0x8b13('0x80')](function(_0xe81c2e){const _0x142886={'id':_0x2a1fd3};return db[_0x8b13('0x16')]['findOne']({'attributes':['id',_0x8b13('0x76'),_0x8b13('0x78')],'where':_0x142886,'transaction':_0xe81c2e,'lock':_0xe81c2e[_0x8b13('0x79')]['UPDATE'],'include':[{'model':db[_0x8b13('0x5d')],'as':'Contact','attributes':_0x48fd36,'include':[{'model':db[_0x8b13('0x7b')],'as':_0x8b13('0x81'),'attributes':['id',_0x8b13('0x12')]}]},{'model':db[_0x8b13('0x7c')],'as':_0x8b13('0x7d'),'attributes':['id',_0x8b13('0x12')]},{'model':db[_0x8b13('0x4b')],'as':_0x8b13('0x82'),'attributes':['id',_0x8b13('0x12'),_0x8b13('0x7e')]}]})['then'](function(_0x3dc732){if(_0x3dc732){return _0x3dc732[_0x8b13('0x44')]({'UserId':_0x5ac2c4},{'transaction':_0xe81c2e});}});});})[_0x8b13('0xf')](handleEntityNotFound(_0xddd6f9,null))[_0x8b13('0xf')](respondWithResult(_0xddd6f9,null))[_0x8b13('0x41')](handleError(_0xddd6f9,null));};exports[_0x8b13('0x83')]=function(_0x2c69f5,_0x9173d){return _0x2c69f5[_0x8b13('0x55')][_0x8b13('0x84')]({'where':{'type':_0x8b13('0x85'),'dialActive':!![],'dialMethod':_0x8b13('0x86')},'attributes':['id'],'raw':!![]})[_0x8b13('0xf')](function(_0x4bb71a){if(_0x4bb71a&&_0x4bb71a['length']){return db[_0x8b13('0x16')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b13('0x67')](_0x8b13('0x58'))},'VoiceQueueId':{'$in':_['map'](_0x4bb71a,'id')},'$or':[{'UserId':null},{'UserId':_0x2c69f5['user']['id']}]}});}return 0x0;})[_0x8b13('0xf')](function(_0x416f9c){if(!_[_0x8b13('0x61')](_0x416f9c)&&_[_0x8b13('0x87')](_0x416f9c)){return _0x9173d[_0x8b13('0x7')](0xc8)['json']({'contacts':_0x416f9c});}else{logger[_0x8b13('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x8b13('0x83'),0x194,_0x8b13('0x88'));_0x9173d['sendStatus'](0x194);}})[_0x8b13('0x41')](handleError(_0x9173d,null));};exports[_0x8b13('0x89')]=function(_0x3f345a,_0x34cee5){var _0x2f1ddf=shared['timezones'];var _0x223765=[];_[_0x8b13('0x15')](_0x2f1ddf,function(_0x471f25){_0x223765['push']({'id':_0x471f25[_0x8b13('0x12')],'name':_0x471f25['name'],'utcOffset':_0x471f25[_0x8b13('0x8a')]});});return _0x34cee5[_0x8b13('0x7')](0xc8)[_0x8b13('0xe')]({'tz':_0x223765});};exports[_0x8b13('0x8b')]=function(_0x229009,_0xe70f1b){var _0x441173=shared[_0x8b13('0x8c')];var _0x42ea3a={};if(!_[_0x8b13('0x61')](_0x441173[_0x229009['body']['id']]))_0x42ea3a=_0x441173[_0x229009[_0x8b13('0x43')]['id']];return _0xe70f1b[_0x8b13('0x7')](0xc8)[_0x8b13('0xe')](_0x42ea3a);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ef5f6b7..36ca587 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x1967,0x173));var _0x7196=function(_0x47607f,_0x1d0f45){_0x47607f=_0x47607f-0x0;var _0x323c8d=_0x1967[_0x47607f];return _0x323c8d;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x3980d6,_0x325b84){var _0xd74ddf=function(_0x4c62f8){while(--_0x4c62f8){_0x3980d6['push'](_0x3980d6['shift']());}};_0xd74ddf(++_0x325b84);}(_0x7096,0x10c));var _0x6709=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7096[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1a258cd..0beccdd 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 _0x99e7=['code','message','result','CmHopper','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','find','catch','CreateCmHopper','create','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','findAll','LOCK','UPDATE','Contact','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','GetCmHopperPreview','keys','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d4a20,_0x204084){var _0x48de26=function(_0x3c9878){while(--_0x3c9878){_0x2d4a20['push'](_0x2d4a20['shift']());}};_0x48de26(++_0x204084);}(_0x99e7,0x1b5));var _0x799e=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x99e7[_0x8c1005];return _0x175354;};'use strict';var _=require(_0x799e('0x0'));var util=require(_0x799e('0x1'));var moment=require(_0x799e('0x2'));var BPromise=require(_0x799e('0x3'));var db=require(_0x799e('0x4'))['db'];var logger=require(_0x799e('0x5'))(_0x799e('0x6'));var jayson=require(_0x799e('0x7'));var client=jayson[_0x799e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5600e0,_0x1dfefa,_0x5eca94){return new BPromise(function(_0x43873c,_0x4f98e4){return client[_0x799e('0x9')](_0x5600e0,_0x5eca94)[_0x799e('0xa')](function(_0x3cec49){logger[_0x799e('0xb')](_0x799e('0xc'),_0x1dfefa,'request\x20sent');logger[_0x799e('0xd')](_0x799e('0xe'),_0x1dfefa,_0x799e('0xf'),JSON[_0x799e('0x10')](_0x3cec49));if(_0x3cec49['error']){if(_0x3cec49[_0x799e('0x11')][_0x799e('0x12')]===0x1f4){logger[_0x799e('0x11')](_0x799e('0xc'),_0x1dfefa,_0x3cec49[_0x799e('0x11')][_0x799e('0x13')]);return _0x4f98e4(_0x3cec49[_0x799e('0x11')]['message']);}logger[_0x799e('0x11')](_0x799e('0xc'),_0x1dfefa,_0x3cec49[_0x799e('0x11')][_0x799e('0x13')]);return _0x43873c(_0x3cec49[_0x799e('0x11')][_0x799e('0x13')]);}else{logger[_0x799e('0xb')](_0x799e('0xc'),_0x1dfefa,_0x799e('0xf'));_0x43873c(_0x3cec49[_0x799e('0x14')]['message']);}})['catch'](function(_0x4267bc){logger[_0x799e('0x11')](_0x799e('0xc'),_0x1dfefa,_0x4267bc);_0x4f98e4(_0x4267bc);});});}exports['GetCmHopper']=function(_0x3af3ec){var _0x3503da=this;return new Promise(function(_0x340fc6,_0x3633a1){return db[_0x799e('0x15')]['findAll']({'raw':_0x3af3ec[_0x799e('0x16')]?_0x3af3ec[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![],'where':_0x3af3ec[_0x799e('0x16')]?_0x3af3ec['options'][_0x799e('0x18')]||null:null,'attributes':_0x3af3ec['options']?_0x3af3ec[_0x799e('0x16')][_0x799e('0x19')]||null:null,'limit':_0x3af3ec[_0x799e('0x16')]?_0x3af3ec[_0x799e('0x16')][_0x799e('0x1a')]||null:null,'include':_0x3af3ec[_0x799e('0x16')]?_0x3af3ec[_0x799e('0x16')][_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x3af3ec[_0x799e('0x16')][_0x799e('0x1b')],function(_0x2cf17e){return{'model':db[_0x2cf17e[_0x799e('0x1d')]],'as':_0x2cf17e['as'],'attributes':_0x2cf17e['attributes'],'include':_0x2cf17e[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x2cf17e[_0x799e('0x1b')],function(_0x49ff20){return{'model':db[_0x49ff20['model']],'as':_0x49ff20['as'],'attributes':_0x49ff20[_0x799e('0x19')],'include':_0x49ff20[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x49ff20[_0x799e('0x1b')],function(_0x39c61f){return{'model':db[_0x39c61f[_0x799e('0x1d')]],'as':_0x39c61f['as'],'attributes':_0x39c61f[_0x799e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x799e('0xa')](function(_0x469160){logger[_0x799e('0xb')](_0x799e('0x1e'),_0x3af3ec);logger[_0x799e('0xd')]('GetCmHopper',_0x3af3ec,JSON[_0x799e('0x10')](_0x469160));_0x340fc6(_0x469160);})['catch'](function(_0x159c41){logger[_0x799e('0x11')](_0x799e('0x1e'),_0x159c41['message'],_0x3af3ec);_0x3633a1(_0x3503da[_0x799e('0x11')](0x1f4,_0x159c41[_0x799e('0x13')]));});});};exports[_0x799e('0x1f')]=function(_0x41e894){var _0xa3c7c6=this;return new Promise(function(_0x2561ce,_0x12ee13){return db[_0x799e('0x15')][_0x799e('0x20')]({'raw':_0x41e894[_0x799e('0x16')]?_0x41e894[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![],'where':_0x41e894[_0x799e('0x16')]?_0x41e894[_0x799e('0x16')][_0x799e('0x18')]||null:null,'attributes':_0x41e894[_0x799e('0x16')]?_0x41e894['options'][_0x799e('0x19')]||null:null,'include':_0x41e894[_0x799e('0x16')]?_0x41e894[_0x799e('0x16')][_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x41e894[_0x799e('0x16')][_0x799e('0x1b')],function(_0x1530bf){return{'model':db[_0x1530bf[_0x799e('0x1d')]],'as':_0x1530bf['as'],'attributes':_0x1530bf[_0x799e('0x19')],'include':_0x1530bf['include']?_[_0x799e('0x1c')](_0x1530bf['include'],function(_0x43aa94){return{'model':db[_0x43aa94[_0x799e('0x1d')]],'as':_0x43aa94['as'],'attributes':_0x43aa94[_0x799e('0x19')],'include':_0x43aa94['include']?_[_0x799e('0x1c')](_0x43aa94['include'],function(_0x1ff802){return{'model':db[_0x1ff802['model']],'as':_0x1ff802['as'],'attributes':_0x1ff802[_0x799e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e438e){logger[_0x799e('0xb')](_0x799e('0x1f'),_0x41e894);logger[_0x799e('0xd')]('ShowCmHopper',_0x41e894,JSON[_0x799e('0x10')](_0x2e438e));_0x2561ce(_0x2e438e);})[_0x799e('0x21')](function(_0x2391ca){logger[_0x799e('0x11')]('ShowCmHopper',_0x2391ca[_0x799e('0x13')],_0x41e894);_0x12ee13(_0xa3c7c6['error'](0x1f4,_0x2391ca['message']));});});};exports[_0x799e('0x22')]=function(_0x2ed5ba){var _0x41f7b0=this;return new Promise(function(_0x3e7a0a,_0x316e4e){return db[_0x799e('0x15')][_0x799e('0x23')](_0x2ed5ba[_0x799e('0x24')],{'raw':_0x2ed5ba['options']?_0x2ed5ba[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![]})[_0x799e('0xa')](function(_0x17fba7){logger['info'](_0x799e('0x22'),_0x2ed5ba);logger['debug']('CreateCmHopper',_0x2ed5ba,JSON[_0x799e('0x10')](_0x17fba7));_0x3e7a0a(_0x17fba7);})['catch'](function(_0x4c151f){logger[_0x799e('0x11')]('CreateCmHopper',_0x4c151f[_0x799e('0x13')],_0x2ed5ba);_0x316e4e(_0x41f7b0[_0x799e('0x11')](0x1f4,_0x4c151f[_0x799e('0x13')]));});});};exports['UpdateCmHopper']=function(_0x4c8d60){var _0x5aea48=this;return new Promise(function(_0x9c6bec,_0x3aee68){return db[_0x799e('0x15')][_0x799e('0x25')](_0x4c8d60[_0x799e('0x24')],{'raw':_0x4c8d60[_0x799e('0x16')]?_0x4c8d60[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c8d60[_0x799e('0x16')]?_0x4c8d60[_0x799e('0x16')][_0x799e('0x18')]||null:null,'attributes':_0x4c8d60[_0x799e('0x16')]?_0x4c8d60['options']['attributes']||null:null,'limit':_0x4c8d60['options']?_0x4c8d60[_0x799e('0x16')]['limit']||null:null})[_0x799e('0xa')](function(_0x55efea){logger['info'](_0x799e('0x26'),_0x4c8d60);logger[_0x799e('0xb')](_0x799e('0x27'),JSON[_0x799e('0x10')](_0x4c8d60[_0x799e('0x16')][_0x799e('0x18')]),_0x4c8d60[_0x799e('0x24')][_0x799e('0x28')]);logger['debug'](_0x799e('0x26'),_0x4c8d60,JSON[_0x799e('0x10')](_0x55efea));_0x9c6bec(_0x55efea);})[_0x799e('0x21')](function(_0x54138a){logger[_0x799e('0x11')](_0x799e('0x26'),_0x54138a[_0x799e('0x13')],_0x4c8d60);_0x3aee68(_0x5aea48['error'](0x1f4,_0x54138a[_0x799e('0x13')]));});});};exports['DestroyCmHopper']=function(_0x29c51f){var _0x29da15=this;return new Promise(function(_0x1b58eb,_0xc7c89c){return db[_0x799e('0x15')][_0x799e('0x29')]({'where':_0x29c51f['options']?_0x29c51f[_0x799e('0x16')][_0x799e('0x18')]||null:null})[_0x799e('0xa')](function(_0x4ce1a8){logger['info'](_0x799e('0x2a'),_0x29c51f);logger[_0x799e('0xd')]('DestroyCmHopper',_0x29c51f,JSON[_0x799e('0x10')](_0x4ce1a8));_0x1b58eb(_0x4ce1a8);})[_0x799e('0x21')](function(_0x46b368){logger['error']('DestroyCmHopper',_0x46b368['message'],_0x29c51f);_0xc7c89c(_0x29da15[_0x799e('0x11')](0x1f4,_0x46b368[_0x799e('0x13')]));});});};exports[_0x799e('0x2b')]=function(_0x490ec3){var _0x580f3c=this;return new Promise(function(_0x3250f4,_0x55e884){return db[_0x799e('0x2c')][_0x799e('0x2d')]()[_0x799e('0xa')](function(_0x12be45){return db['sequelize'][_0x799e('0x2e')](function(_0x5dd08e){return db['CmHopper'][_0x799e('0x2f')]({'where':_0x490ec3['options']?_0x490ec3[_0x799e('0x16')][_0x799e('0x18')]||null:null,'attributes':_0x490ec3['options']?_0x490ec3['options'][_0x799e('0x19')]||null:null,'limit':_0x490ec3[_0x799e('0x16')]?_0x490ec3[_0x799e('0x16')][_0x799e('0x1a')]||null:null,'order':_0x490ec3[_0x799e('0x16')]?_0x490ec3[_0x799e('0x16')]['order']||null:null,'transaction':_0x5dd08e,'lock':_0x5dd08e[_0x799e('0x30')][_0x799e('0x31')],'include':[{'model':db['CmContact'],'as':_0x799e('0x32'),'attributes':_['keys'](_0x12be45)},{'model':db[_0x799e('0x33')],'as':_0x799e('0x34'),'attributes':['id','name',_0x799e('0x35')]}]})[_0x799e('0xa')](function(_0xaefcaa){var _0xc62422=[];var _0x2a508f=[];for(var _0x1f748f=0x0;_0x1f748f<_0xaefcaa[_0x799e('0x36')];_0x1f748f+=0x1){var _0x88fba=_0xaefcaa[_0x1f748f][_0x799e('0x37')];if(_0x88fba===null){_0xc62422[_0x799e('0x38')](_0xaefcaa[_0x1f748f][_0x799e('0x25')](_0x490ec3[_0x799e('0x24')],{'transaction':_0x5dd08e}));}else if(!_0x2a508f[_0x799e('0x39')](_0x88fba)){_0x2a508f[_0x799e('0x38')](_0x88fba);_0xc62422['push'](_0xaefcaa[_0x1f748f]['update'](_0x490ec3[_0x799e('0x24')],{'transaction':_0x5dd08e}));}}return BPromise[_0x799e('0x3a')](_0xc62422);});})[_0x799e('0xa')](function(_0x89a25f){logger['info'](_0x799e('0x2b'),_0x490ec3);if(_0x89a25f[_0x799e('0x36')]>0x0){logger['info'](_0x799e('0x3b'),_0x89a25f[0x0]['dataValues']['id'],_0x89a25f[0x0][_0x799e('0x3c')][_0x799e('0x3d')],_0x89a25f[0x0][_0x799e('0x3c')]['active']);}logger[_0x799e('0xd')](_0x799e('0x2b'),_0x490ec3,JSON[_0x799e('0x10')](_0x89a25f));_0x3250f4(_0x89a25f);})[_0x799e('0x21')](function(_0x434e83){logger[_0x799e('0x11')](_0x799e('0x2b'),_0x434e83['message'],_0x490ec3);_0x55e884(_0x580f3c[_0x799e('0x11')](0x1f4,_0x434e83['message']));});});});};exports['MoveContactManagedDialer']=function(_0x3e03a8){var _0x2be7c0=this;return new Promise(function(_0x12f0e9,_0x1b394c){return db['sequelize'][_0x799e('0x2e')](function(_0x4ebdd8){return db['CmHopperFinal'][_0x799e('0x23')](_0x3e03a8['body'],{'raw':_0x3e03a8[_0x799e('0x16')]?_0x3e03a8[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![],'transaction':_0x4ebdd8})['then'](function(){logger['info'](_0x799e('0x3e'),JSON['stringify'](_0x3e03a8[_0x799e('0x16')][_0x799e('0x18')]),_0x3e03a8['options']['where'][_0x799e('0x28')]);return db[_0x799e('0x15')][_0x799e('0x29')]({'where':_0x3e03a8[_0x799e('0x16')]?_0x3e03a8[_0x799e('0x16')]['where']||null:null,'transaction':_0x4ebdd8});});})[_0x799e('0xa')](function(_0x3ed717){logger[_0x799e('0xb')](_0x799e('0x3f'),_0x3e03a8);logger[_0x799e('0xd')](_0x799e('0x3f'),_0x3e03a8,JSON[_0x799e('0x10')](_0x3ed717));_0x12f0e9(_0x3ed717);})[_0x799e('0x21')](function(_0xe08a70){logger[_0x799e('0x11')](_0x799e('0x3f'),_0xe08a70[_0x799e('0x13')],_0x3e03a8);_0x1b394c(_0x2be7c0[_0x799e('0x11')](0x1f4,_0xe08a70['message']));});});};exports[_0x799e('0x40')]=function(_0x4a7b45){var _0xbbb93d=this;return new Promise(function(_0x3e2e08,_0x428884){return db['CmHopper'][_0x799e('0x2f')]({'raw':_0x4a7b45[_0x799e('0x16')]?_0x4a7b45[_0x799e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4a7b45[_0x799e('0x16')]?_0x4a7b45['options'][_0x799e('0x18')]||null:null,'attributes':[[db[_0x799e('0x41')]['fn'](_0x799e('0x42'),db['sequelize']['fn']('IF',db[_0x799e('0x41')][_0x799e('0x43')](_0x799e('0x44')+util[_0x799e('0x45')](_0x799e('0x46'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x799e('0x47')))),'contactsRescheduled']]})[_0x799e('0xa')](function(_0x71a5b6){logger['info'](_0x799e('0x40'),_0x4a7b45);logger[_0x799e('0xd')](_0x799e('0x40'),_0x4a7b45,JSON[_0x799e('0x10')](_0x71a5b6));_0x3e2e08(_0x71a5b6);})[_0x799e('0x21')](function(_0x399dff){logger[_0x799e('0x11')](_0x799e('0x40'),_0x399dff['message'],_0x4a7b45);_0x428884(_0xbbb93d[_0x799e('0x11')](0x1f4,_0x399dff['message']));});});};exports[_0x799e('0x48')]=function(_0x35973b){var _0x34f31e=this;return new Promise(function(_0x4fb312,_0x388824){return db['CmContact'][_0x799e('0x2d')]()[_0x799e('0xa')](function(_0x35de6c){return db[_0x799e('0x41')][_0x799e('0x2e')](function(_0x9483be){return db['CmHopper'][_0x799e('0x2f')]({'where':_0x35973b[_0x799e('0x16')]?_0x35973b[_0x799e('0x16')][_0x799e('0x18')]||null:null,'attributes':_0x35973b[_0x799e('0x16')]?_0x35973b[_0x799e('0x16')][_0x799e('0x19')]||null:null,'limit':0x1,'order':_0x35973b['options']?_0x35973b['options'][_0x799e('0x49')]||null:null,'group':db[_0x799e('0x15')][_0x799e('0x37')],'transaction':_0x9483be,'lock':_0x9483be['LOCK'][_0x799e('0x31')],'include':_0x35973b[_0x799e('0x16')]?_0x35973b[_0x799e('0x16')][_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x35973b['options'][_0x799e('0x1b')],function(_0x1e6bf5){return{'model':db[_0x1e6bf5[_0x799e('0x1d')]],'as':_0x1e6bf5['as'],'attributes':_0x1e6bf5[_0x799e('0x19')],'include':_0x1e6bf5[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x1e6bf5[_0x799e('0x1b')],function(_0xe51005){return{'model':db[_0xe51005[_0x799e('0x1d')]],'as':_0xe51005['as'],'attributes':_0xe51005[_0x799e('0x19')],'include':_0xe51005[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0xe51005[_0x799e('0x1b')],function(_0x385bee){return{'model':db[_0x385bee[_0x799e('0x1d')]],'as':_0x385bee['as'],'attributes':_0x385bee[_0x799e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43e25d){var _0x2e575c=[];for(var _0x14cf71=0x0;_0x14cf71<_0x43e25d['length'];_0x14cf71+=0x1){_0x2e575c[_0x799e('0x38')](_0x43e25d[_0x14cf71][_0x799e('0x25')](_0x35973b['body'],{'transaction':_0x9483be}));}return BPromise[_0x799e('0x3a')](_0x2e575c);});})[_0x799e('0xa')](function(_0x33b380){logger[_0x799e('0xb')]('GetContactRecallMe',_0x35973b);logger['debug'](_0x799e('0x48'),_0x35973b,JSON[_0x799e('0x10')](_0x33b380));_0x4fb312(_0x33b380);})[_0x799e('0x21')](function(_0x2df949){logger['error'](_0x799e('0x48'),_0x2df949[_0x799e('0x13')],_0x35973b);_0x388824(_0x34f31e[_0x799e('0x11')](0x1f4,_0x2df949['message']));});});});};exports[_0x799e('0x4a')]=function(_0x2cf104){var _0x5467cd=this;return new Promise(function(_0x3708c2,_0x1f867e){db['CmContact'][_0x799e('0x2d')]()[_0x799e('0xa')](function(_0x2526d3){return db['CmHopper']['findAll']({'raw':_0x2cf104['options']?_0x2cf104[_0x799e('0x16')][_0x799e('0x17')]===undefined?!![]:![]:!![],'where':_0x2cf104[_0x799e('0x16')]?_0x2cf104['options']['where']||null:null,'attributes':_0x2cf104['options']?_0x2cf104[_0x799e('0x16')][_0x799e('0x19')]||null:null,'limit':_0x2cf104[_0x799e('0x16')]?_0x2cf104['options']['limit']||null:null,'include':_0x2cf104[_0x799e('0x16')]?_0x2cf104['options']['include']?_['map'](_0x2cf104['options'][_0x799e('0x1b')],function(_0x28b09e){return{'model':db[_0x28b09e[_0x799e('0x1d')]],'as':_0x28b09e['as'],'attributes':_0x28b09e['as']==='Contact'?_[_0x799e('0x4b')](_0x2526d3):_0x28b09e['attributes'],'include':_0x28b09e[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x28b09e[_0x799e('0x1b')],function(_0x155330){return{'model':db[_0x155330[_0x799e('0x1d')]],'as':_0x155330['as'],'attributes':_0x155330[_0x799e('0x19')],'include':_0x155330[_0x799e('0x1b')]?_[_0x799e('0x1c')](_0x155330['include'],function(_0x2f3e59){return{'model':db[_0x2f3e59['model']],'as':_0x2f3e59['as'],'attributes':_0x2f3e59[_0x799e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x799e('0xa')](function(_0x240aad){logger[_0x799e('0xb')](_0x799e('0x1e'),_0x2cf104);logger[_0x799e('0xd')](_0x799e('0x1e'),_0x2cf104,JSON['stringify'](_0x240aad));_0x3708c2(_0x240aad);})[_0x799e('0x21')](function(_0x18b550){logger[_0x799e('0x11')](_0x799e('0x1e'),_0x18b550[_0x799e('0x13')],_0x2cf104);_0x1f867e(_0x5467cd['error'](0x1f4,_0x18b550[_0x799e('0x13')]));});});});};exports['GetContactByPhone']=function(_0x3f446c){var _0x702ba4=this;return new Promise(function(_0xe620e7,_0x5ef066){return db[_0x799e('0x2c')][_0x799e('0x4c')]({'raw':!![],'where':{'phone':_0x3f446c['options'][_0x799e('0x18')][_0x799e('0x4d')]},'attributes':['id',_0x799e('0x4e')],'order':[['id',_0x799e('0x4f')]]})[_0x799e('0xa')](function(_0x59d51d){logger['info'](_0x799e('0x50'),_0x3f446c);logger[_0x799e('0xd')](_0x799e('0x50'),_0x3f446c,JSON[_0x799e('0x10')](_0x59d51d));_0xe620e7(_0x59d51d);})[_0x799e('0x21')](function(_0xe78fbb){logger[_0x799e('0x11')](_0x799e('0x50'),_0xe78fbb['message'],_0x3f446c);_0x5ef066(_0x702ba4[_0x799e('0x11')](0x1f4,_0xe78fbb['message']));});});};exports['ResetActiveCalls']=function(_0x3cc40f){var _0x5966ed=this;return new Promise(function(_0x47af7f,_0x19ab84){return db[_0x799e('0x41')]['transaction'](function(_0x5e5160){return db['CmHopper'][_0x799e('0x25')]({'active':![]},{'where':{},'transaction':_0x5e5160})[_0x799e('0xa')](function(_0x386a99){logger[_0x799e('0xb')]('ResetActiveCalls',_0x3cc40f);logger[_0x799e('0xd')](_0x799e('0x51'),_0x3cc40f,JSON[_0x799e('0x10')](_0x386a99));_0x47af7f(_0x386a99);})['catch'](function(_0x218134){logger['error'](_0x799e('0x51'),_0x218134['message'],_0x3cc40f);_0x19ab84(_0x5966ed[_0x799e('0x11')](0x1f4,_0x218134[_0x799e('0x13')]));});});});};exports[_0x799e('0x52')]=function(_0x4d36d4){var _0x43f987=this;var _0x5d1d99=_0x4d36d4[_0x799e('0x24')][_0x799e('0x18')][_0x799e('0x53')];var _0x2c23cc=_0x4d36d4['body'][_0x799e('0x18')][_0x799e('0x54')];var _0xdc4bf3=_0x4d36d4[_0x799e('0x24')]['where'][_0x799e('0x55')];return new Promise(function(_0x51b390,_0x4573f1){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x5d1d99},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x799e('0x41')]['literal'](_0x799e('0x56')+_0x2c23cc+_0x799e('0x57')),'$gt':db[_0x799e('0x41')][_0x799e('0x43')](_0x799e('0x58'))}},'UserId':{'$in':_0xdc4bf3}},'include':[{'model':db[_0x799e('0x2c')],'as':_0x799e('0x32')},{'model':db[_0x799e('0x33')],'as':'Agent','attributes':['id',_0x799e('0x59'),_0x799e('0x35')]},{'model':db['CmList'],'as':_0x799e('0x5a')}]})['then'](function(_0xb472ac){if(_0xb472ac[_0x799e('0x36')]>0x0){return db[_0x799e('0x41')]['transaction'](function(_0x47fbec){return db[_0x799e('0x15')][_0x799e('0x25')]({'recallmeNotifiedDate':db['sequelize'][_0x799e('0x43')](_0x799e('0x58'))},{'where':{'id':{'$in':_[_0x799e('0x1c')](_0xb472ac,'id')}},'transaction':_0x47fbec})[_0x799e('0xa')](function(){_0x51b390(_0xb472ac);})[_0x799e('0x21')](function(_0x5e2189){logger[_0x799e('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x5e2189[_0x799e('0x13')],_0x4d36d4);_0x4573f1(_0x43f987['error'](0x1f4,_0x5e2189[_0x799e('0x13')]));});})[_0x799e('0x21')](function(_0x8e2e22){logger[_0x799e('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x8e2e22[_0x799e('0x13')],_0x4d36d4);_0x4573f1(_0x43f987[_0x799e('0x11')](0x1f4,_0x8e2e22['message']));});}else{_0x51b390(_0xb472ac);}});});}; \ No newline at end of file +var _0x1bd1=['includes','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','create','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','moment','../../mysqldb','http','request','then','info','request\x20sent','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowCmHopper','debug','CreateCmHopper','body','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','update'];(function(_0x4c6729,_0x161c7d){var _0x544c69=function(_0x51d799){while(--_0x51d799){_0x4c6729['push'](_0x4c6729['shift']());}};_0x544c69(++_0x161c7d);}(_0x1bd1,0x123));var _0x11bd=function(_0x1a6fdd,_0xebbd98){_0x1a6fdd=_0x1a6fdd-0x0;var _0x2b49bd=_0x1bd1[_0x1a6fdd];return _0x2b49bd;};'use strict';var _=require(_0x11bd('0x0'));var util=require(_0x11bd('0x1'));var moment=require(_0x11bd('0x2'));var BPromise=require('bluebird');var db=require(_0x11bd('0x3'))['db'];var logger=require('../../config/logger')('rpc');var jayson=require('jayson/promise');var client=jayson['client'][_0x11bd('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x31869a,_0x336fd5,_0x612ff3){return new BPromise(function(_0x57c032,_0x336255){return client[_0x11bd('0x5')](_0x31869a,_0x612ff3)[_0x11bd('0x6')](function(_0x3940cf){logger[_0x11bd('0x7')]('CmHopper,\x20%s,\x20%s',_0x336fd5,_0x11bd('0x8'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x336fd5,_0x11bd('0x8'),JSON[_0x11bd('0x9')](_0x3940cf));if(_0x3940cf[_0x11bd('0xa')]){if(_0x3940cf[_0x11bd('0xa')][_0x11bd('0xb')]===0x1f4){logger[_0x11bd('0xa')](_0x11bd('0xc'),_0x336fd5,_0x3940cf[_0x11bd('0xa')]['message']);return _0x336255(_0x3940cf[_0x11bd('0xa')][_0x11bd('0xd')]);}logger[_0x11bd('0xa')](_0x11bd('0xc'),_0x336fd5,_0x3940cf[_0x11bd('0xa')][_0x11bd('0xd')]);return _0x57c032(_0x3940cf[_0x11bd('0xa')]['message']);}else{logger['info'](_0x11bd('0xc'),_0x336fd5,_0x11bd('0x8'));_0x57c032(_0x3940cf[_0x11bd('0xe')]['message']);}})[_0x11bd('0xf')](function(_0x5b78cc){logger['error'](_0x11bd('0xc'),_0x336fd5,_0x5b78cc);_0x336255(_0x5b78cc);});});}exports[_0x11bd('0x10')]=function(_0xab4cde){var _0x34ee14=this;return new Promise(function(_0xd04657,_0x5d6448){return db[_0x11bd('0x11')][_0x11bd('0x12')]({'raw':_0xab4cde[_0x11bd('0x13')]?_0xab4cde[_0x11bd('0x13')][_0x11bd('0x14')]===undefined?!![]:![]:!![],'where':_0xab4cde[_0x11bd('0x13')]?_0xab4cde[_0x11bd('0x13')][_0x11bd('0x15')]||null:null,'attributes':_0xab4cde['options']?_0xab4cde['options'][_0x11bd('0x16')]||null:null,'limit':_0xab4cde[_0x11bd('0x13')]?_0xab4cde[_0x11bd('0x13')][_0x11bd('0x17')]||null:null,'include':_0xab4cde['options']?_0xab4cde[_0x11bd('0x13')]['include']?_[_0x11bd('0x18')](_0xab4cde[_0x11bd('0x13')][_0x11bd('0x19')],function(_0x513201){return{'model':db[_0x513201[_0x11bd('0x1a')]],'as':_0x513201['as'],'attributes':_0x513201[_0x11bd('0x16')],'include':_0x513201[_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x513201[_0x11bd('0x19')],function(_0x443d2c){return{'model':db[_0x443d2c[_0x11bd('0x1a')]],'as':_0x443d2c['as'],'attributes':_0x443d2c[_0x11bd('0x16')],'include':_0x443d2c[_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x443d2c[_0x11bd('0x19')],function(_0x3c6dab){return{'model':db[_0x3c6dab['model']],'as':_0x3c6dab['as'],'attributes':_0x3c6dab[_0x11bd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x11bd('0x6')](function(_0xa08420){logger['info']('GetCmHopper',_0xab4cde);logger['debug'](_0x11bd('0x10'),_0xab4cde,JSON[_0x11bd('0x9')](_0xa08420));_0xd04657(_0xa08420);})[_0x11bd('0xf')](function(_0x274435){logger[_0x11bd('0xa')](_0x11bd('0x10'),_0x274435[_0x11bd('0xd')],_0xab4cde);_0x5d6448(_0x34ee14['error'](0x1f4,_0x274435[_0x11bd('0xd')]));});});};exports['ShowCmHopper']=function(_0x161cb1){var _0x42312c=this;return new Promise(function(_0x48bf2b,_0x20f762){return db[_0x11bd('0x11')][_0x11bd('0x1b')]({'raw':_0x161cb1[_0x11bd('0x13')]?_0x161cb1[_0x11bd('0x13')][_0x11bd('0x14')]===undefined?!![]:![]:!![],'where':_0x161cb1[_0x11bd('0x13')]?_0x161cb1[_0x11bd('0x13')]['where']||null:null,'attributes':_0x161cb1[_0x11bd('0x13')]?_0x161cb1[_0x11bd('0x13')][_0x11bd('0x16')]||null:null,'include':_0x161cb1[_0x11bd('0x13')]?_0x161cb1[_0x11bd('0x13')][_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x161cb1[_0x11bd('0x13')][_0x11bd('0x19')],function(_0x24318c){return{'model':db[_0x24318c['model']],'as':_0x24318c['as'],'attributes':_0x24318c[_0x11bd('0x16')],'include':_0x24318c[_0x11bd('0x19')]?_['map'](_0x24318c[_0x11bd('0x19')],function(_0x281f22){return{'model':db[_0x281f22[_0x11bd('0x1a')]],'as':_0x281f22['as'],'attributes':_0x281f22[_0x11bd('0x16')],'include':_0x281f22['include']?_[_0x11bd('0x18')](_0x281f22['include'],function(_0x3dc82f){return{'model':db[_0x3dc82f[_0x11bd('0x1a')]],'as':_0x3dc82f['as'],'attributes':_0x3dc82f[_0x11bd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x11bd('0x6')](function(_0x3446b9){logger[_0x11bd('0x7')](_0x11bd('0x1c'),_0x161cb1);logger[_0x11bd('0x1d')](_0x11bd('0x1c'),_0x161cb1,JSON[_0x11bd('0x9')](_0x3446b9));_0x48bf2b(_0x3446b9);})[_0x11bd('0xf')](function(_0x1c4b40){logger[_0x11bd('0xa')](_0x11bd('0x1c'),_0x1c4b40['message'],_0x161cb1);_0x20f762(_0x42312c['error'](0x1f4,_0x1c4b40['message']));});});};exports[_0x11bd('0x1e')]=function(_0xad0a08){var _0x489e23=this;return new Promise(function(_0x24005d,_0x3bfb23){return db[_0x11bd('0x11')]['create'](_0xad0a08[_0x11bd('0x1f')],{'raw':_0xad0a08[_0x11bd('0x13')]?_0xad0a08[_0x11bd('0x13')][_0x11bd('0x14')]===undefined?!![]:![]:!![]})[_0x11bd('0x6')](function(_0x2f67e1){logger['info'](_0x11bd('0x1e'),_0xad0a08);logger['debug'](_0x11bd('0x1e'),_0xad0a08,JSON['stringify'](_0x2f67e1));_0x24005d(_0x2f67e1);})[_0x11bd('0xf')](function(_0x2cfed4){logger[_0x11bd('0xa')](_0x11bd('0x1e'),_0x2cfed4[_0x11bd('0xd')],_0xad0a08);_0x3bfb23(_0x489e23[_0x11bd('0xa')](0x1f4,_0x2cfed4[_0x11bd('0xd')]));});});};exports['UpdateCmHopper']=function(_0x4e7f23){var _0x46dded=this;return new Promise(function(_0x280311,_0x5ab52f){return db[_0x11bd('0x11')]['update'](_0x4e7f23[_0x11bd('0x1f')],{'raw':_0x4e7f23[_0x11bd('0x13')]?_0x4e7f23[_0x11bd('0x13')][_0x11bd('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7f23[_0x11bd('0x13')]?_0x4e7f23[_0x11bd('0x13')]['where']||null:null,'attributes':_0x4e7f23[_0x11bd('0x13')]?_0x4e7f23[_0x11bd('0x13')][_0x11bd('0x16')]||null:null,'limit':_0x4e7f23[_0x11bd('0x13')]?_0x4e7f23[_0x11bd('0x13')]['limit']||null:null})[_0x11bd('0x6')](function(_0x5bd7a2){logger[_0x11bd('0x7')](_0x11bd('0x20'),_0x4e7f23);logger[_0x11bd('0x7')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x11bd('0x9')](_0x4e7f23[_0x11bd('0x13')][_0x11bd('0x15')]),_0x4e7f23[_0x11bd('0x1f')]['active']);logger[_0x11bd('0x1d')](_0x11bd('0x20'),_0x4e7f23,JSON[_0x11bd('0x9')](_0x5bd7a2));_0x280311(_0x5bd7a2);})[_0x11bd('0xf')](function(_0x1b9b0a){logger[_0x11bd('0xa')](_0x11bd('0x20'),_0x1b9b0a[_0x11bd('0xd')],_0x4e7f23);_0x5ab52f(_0x46dded[_0x11bd('0xa')](0x1f4,_0x1b9b0a['message']));});});};exports[_0x11bd('0x21')]=function(_0x13c991){var _0x4c6294=this;return new Promise(function(_0x16a3f9,_0x4cf9c4){return db['CmHopper']['destroy']({'where':_0x13c991[_0x11bd('0x13')]?_0x13c991[_0x11bd('0x13')][_0x11bd('0x15')]||null:null})[_0x11bd('0x6')](function(_0x4725a3){logger[_0x11bd('0x7')](_0x11bd('0x21'),_0x13c991);logger[_0x11bd('0x1d')]('DestroyCmHopper',_0x13c991,JSON['stringify'](_0x4725a3));_0x16a3f9(_0x4725a3);})[_0x11bd('0xf')](function(_0x300cab){logger[_0x11bd('0xa')](_0x11bd('0x21'),_0x300cab[_0x11bd('0xd')],_0x13c991);_0x4cf9c4(_0x4c6294[_0x11bd('0xa')](0x1f4,_0x300cab['message']));});});};exports[_0x11bd('0x22')]=function(_0x8afa46){var _0x25f258=this;return new Promise(function(_0x501dfc,_0x2e2a49){return db[_0x11bd('0x23')][_0x11bd('0x24')]()[_0x11bd('0x6')](function(_0x241b06){return db[_0x11bd('0x25')][_0x11bd('0x26')](function(_0x1127a6){return db[_0x11bd('0x11')][_0x11bd('0x12')]({'where':_0x8afa46[_0x11bd('0x13')]?_0x8afa46[_0x11bd('0x13')][_0x11bd('0x15')]||null:null,'attributes':_0x8afa46['options']?_0x8afa46[_0x11bd('0x13')][_0x11bd('0x16')]||null:null,'limit':_0x8afa46[_0x11bd('0x13')]?_0x8afa46['options'][_0x11bd('0x17')]||null:null,'order':_0x8afa46[_0x11bd('0x13')]?_0x8afa46[_0x11bd('0x13')]['order']||null:null,'transaction':_0x1127a6,'lock':_0x1127a6[_0x11bd('0x27')][_0x11bd('0x28')],'include':[{'model':db[_0x11bd('0x23')],'as':_0x11bd('0x29'),'attributes':_[_0x11bd('0x2a')](_0x241b06)},{'model':db[_0x11bd('0x2b')],'as':_0x11bd('0x2c'),'attributes':['id',_0x11bd('0x2d'),_0x11bd('0x2e')]}]})[_0x11bd('0x6')](function(_0x394b6d){var _0x5b84ef=[];var _0xe2f086=[];for(var _0x10e5ff=0x0;_0x10e5ff<_0x394b6d[_0x11bd('0x2f')];_0x10e5ff+=0x1){var _0xd21383=_0x394b6d[_0x10e5ff]['UserId'];if(_0xd21383===null){_0x5b84ef['push'](_0x394b6d[_0x10e5ff][_0x11bd('0x30')](_0x8afa46[_0x11bd('0x1f')],{'transaction':_0x1127a6}));}else if(!_0xe2f086[_0x11bd('0x31')](_0xd21383)){_0xe2f086[_0x11bd('0x32')](_0xd21383);_0x5b84ef['push'](_0x394b6d[_0x10e5ff][_0x11bd('0x30')](_0x8afa46[_0x11bd('0x1f')],{'transaction':_0x1127a6}));}}return BPromise['all'](_0x5b84ef);});})[_0x11bd('0x6')](function(_0xa5b7b4){logger[_0x11bd('0x7')](_0x11bd('0x22'),_0x8afa46);if(_0xa5b7b4[_0x11bd('0x2f')]>0x0){logger['info'](_0x11bd('0x33'),_0xa5b7b4[0x0][_0x11bd('0x34')]['id'],_0xa5b7b4[0x0][_0x11bd('0x34')][_0x11bd('0x35')],_0xa5b7b4[0x0][_0x11bd('0x34')][_0x11bd('0x36')]);}logger[_0x11bd('0x1d')](_0x11bd('0x22'),_0x8afa46,JSON[_0x11bd('0x9')](_0xa5b7b4));_0x501dfc(_0xa5b7b4);})[_0x11bd('0xf')](function(_0x877797){logger[_0x11bd('0xa')](_0x11bd('0x22'),_0x877797[_0x11bd('0xd')],_0x8afa46);_0x2e2a49(_0x25f258['error'](0x1f4,_0x877797[_0x11bd('0xd')]));});});});};exports[_0x11bd('0x37')]=function(_0x22590c){var _0x5405d9=this;return new Promise(function(_0x1bc375,_0xf3da1){return db[_0x11bd('0x25')]['transaction'](function(_0x2c9d71){return db[_0x11bd('0x38')][_0x11bd('0x39')](_0x22590c[_0x11bd('0x1f')],{'raw':_0x22590c['options']?_0x22590c[_0x11bd('0x13')][_0x11bd('0x14')]===undefined?!![]:![]:!![],'transaction':_0x2c9d71})[_0x11bd('0x6')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x11bd('0x9')](_0x22590c[_0x11bd('0x13')][_0x11bd('0x15')]),_0x22590c[_0x11bd('0x13')][_0x11bd('0x15')][_0x11bd('0x36')]);return db[_0x11bd('0x11')][_0x11bd('0x3a')]({'where':_0x22590c[_0x11bd('0x13')]?_0x22590c['options'][_0x11bd('0x15')]||null:null,'transaction':_0x2c9d71});});})['then'](function(_0x38ca06){logger[_0x11bd('0x7')](_0x11bd('0x37'),_0x22590c);logger[_0x11bd('0x1d')]('MoveContactManagedDialer',_0x22590c,JSON[_0x11bd('0x9')](_0x38ca06));_0x1bc375(_0x38ca06);})[_0x11bd('0xf')](function(_0x2b58d8){logger[_0x11bd('0xa')]('MoveContactManagedDialer',_0x2b58d8[_0x11bd('0xd')],_0x22590c);_0xf3da1(_0x5405d9['error'](0x1f4,_0x2b58d8[_0x11bd('0xd')]));});});};exports[_0x11bd('0x3b')]=function(_0x30ddb7){var _0xc8ab0f=this;return new Promise(function(_0x2eb7e3,_0x15cc76){return db['CmHopper'][_0x11bd('0x12')]({'raw':_0x30ddb7[_0x11bd('0x13')]?_0x30ddb7[_0x11bd('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x30ddb7['options']?_0x30ddb7[_0x11bd('0x13')]['where']||null:null,'attributes':[[db[_0x11bd('0x25')]['fn'](_0x11bd('0x3c'),db[_0x11bd('0x25')]['fn']('IF',db[_0x11bd('0x25')]['literal'](_0x11bd('0x3d')+util[_0x11bd('0x3e')](_0x11bd('0x3f'),moment()[_0x11bd('0x3e')](_0x11bd('0x40')))+_0x11bd('0x41')))),_0x11bd('0x42')]]})[_0x11bd('0x6')](function(_0x146db5){logger[_0x11bd('0x7')]('CountReScheduled',_0x30ddb7);logger[_0x11bd('0x1d')]('CountReScheduled',_0x30ddb7,JSON[_0x11bd('0x9')](_0x146db5));_0x2eb7e3(_0x146db5);})[_0x11bd('0xf')](function(_0x1f09ee){logger[_0x11bd('0xa')](_0x11bd('0x3b'),_0x1f09ee[_0x11bd('0xd')],_0x30ddb7);_0x15cc76(_0xc8ab0f[_0x11bd('0xa')](0x1f4,_0x1f09ee[_0x11bd('0xd')]));});});};exports['GetContactRecallMe']=function(_0x30ae60){var _0xc7a81=this;return new Promise(function(_0x57f77f,_0xc16f1c){return db[_0x11bd('0x23')][_0x11bd('0x24')]()[_0x11bd('0x6')](function(_0x41ade6){return db[_0x11bd('0x25')][_0x11bd('0x26')](function(_0x179a9d){return db[_0x11bd('0x11')][_0x11bd('0x12')]({'where':_0x30ae60[_0x11bd('0x13')]?_0x30ae60['options'][_0x11bd('0x15')]||null:null,'attributes':_0x30ae60[_0x11bd('0x13')]?_0x30ae60[_0x11bd('0x13')]['attributes']||null:null,'limit':0x1,'order':_0x30ae60[_0x11bd('0x13')]?_0x30ae60['options']['order']||null:null,'group':db[_0x11bd('0x11')][_0x11bd('0x43')],'transaction':_0x179a9d,'lock':_0x179a9d['LOCK'][_0x11bd('0x28')],'include':_0x30ae60[_0x11bd('0x13')]?_0x30ae60['options']['include']?_[_0x11bd('0x18')](_0x30ae60[_0x11bd('0x13')][_0x11bd('0x19')],function(_0x382e73){return{'model':db[_0x382e73['model']],'as':_0x382e73['as'],'attributes':_0x382e73[_0x11bd('0x16')],'include':_0x382e73['include']?_['map'](_0x382e73[_0x11bd('0x19')],function(_0x43ee2a){return{'model':db[_0x43ee2a['model']],'as':_0x43ee2a['as'],'attributes':_0x43ee2a['attributes'],'include':_0x43ee2a[_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x43ee2a[_0x11bd('0x19')],function(_0x45ab15){return{'model':db[_0x45ab15[_0x11bd('0x1a')]],'as':_0x45ab15['as'],'attributes':_0x45ab15[_0x11bd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x11bd('0x6')](function(_0x540596){var _0x424c6e=[];for(var _0x234cf2=0x0;_0x234cf2<_0x540596['length'];_0x234cf2+=0x1){_0x424c6e['push'](_0x540596[_0x234cf2][_0x11bd('0x30')](_0x30ae60[_0x11bd('0x1f')],{'transaction':_0x179a9d}));}return BPromise[_0x11bd('0x44')](_0x424c6e);});})['then'](function(_0x681358){logger['info'](_0x11bd('0x45'),_0x30ae60);logger['debug'](_0x11bd('0x45'),_0x30ae60,JSON['stringify'](_0x681358));_0x57f77f(_0x681358);})[_0x11bd('0xf')](function(_0x5f8e04){logger[_0x11bd('0xa')](_0x11bd('0x45'),_0x5f8e04[_0x11bd('0xd')],_0x30ae60);_0xc16f1c(_0xc7a81[_0x11bd('0xa')](0x1f4,_0x5f8e04[_0x11bd('0xd')]));});});});};exports[_0x11bd('0x46')]=function(_0xc631c0){var _0x5d7f74=this;return new Promise(function(_0x2bb001,_0x5556d7){db['CmContact'][_0x11bd('0x24')]()[_0x11bd('0x6')](function(_0x423bb1){return db['CmHopper']['findAll']({'raw':_0xc631c0[_0x11bd('0x13')]?_0xc631c0['options']['raw']===undefined?!![]:![]:!![],'where':_0xc631c0[_0x11bd('0x13')]?_0xc631c0[_0x11bd('0x13')][_0x11bd('0x15')]||null:null,'attributes':_0xc631c0[_0x11bd('0x13')]?_0xc631c0[_0x11bd('0x13')]['attributes']||null:null,'limit':_0xc631c0[_0x11bd('0x13')]?_0xc631c0[_0x11bd('0x13')][_0x11bd('0x17')]||null:null,'include':_0xc631c0[_0x11bd('0x13')]?_0xc631c0[_0x11bd('0x13')][_0x11bd('0x19')]?_[_0x11bd('0x18')](_0xc631c0[_0x11bd('0x13')][_0x11bd('0x19')],function(_0x29121a){return{'model':db[_0x29121a[_0x11bd('0x1a')]],'as':_0x29121a['as'],'attributes':_0x29121a['as']===_0x11bd('0x29')?_[_0x11bd('0x2a')](_0x423bb1):_0x29121a[_0x11bd('0x16')],'include':_0x29121a[_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x29121a[_0x11bd('0x19')],function(_0x58d591){return{'model':db[_0x58d591[_0x11bd('0x1a')]],'as':_0x58d591['as'],'attributes':_0x58d591['attributes'],'include':_0x58d591[_0x11bd('0x19')]?_[_0x11bd('0x18')](_0x58d591[_0x11bd('0x19')],function(_0x4727b8){return{'model':db[_0x4727b8[_0x11bd('0x1a')]],'as':_0x4727b8['as'],'attributes':_0x4727b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x11bd('0x6')](function(_0x8b7cbc){logger['info']('GetCmHopper',_0xc631c0);logger[_0x11bd('0x1d')]('GetCmHopper',_0xc631c0,JSON['stringify'](_0x8b7cbc));_0x2bb001(_0x8b7cbc);})[_0x11bd('0xf')](function(_0x1e7548){logger[_0x11bd('0xa')](_0x11bd('0x10'),_0x1e7548[_0x11bd('0xd')],_0xc631c0);_0x5556d7(_0x5d7f74[_0x11bd('0xa')](0x1f4,_0x1e7548[_0x11bd('0xd')]));});});});};exports[_0x11bd('0x47')]=function(_0x131f3f){var _0x564e52=this;return new Promise(function(_0x44f0a6,_0x336bed){return db['CmContact'][_0x11bd('0x48')]({'raw':!![],'where':{'phone':_0x131f3f[_0x11bd('0x13')]['where']['phone']},'attributes':['id',_0x11bd('0x49')],'order':[['id',_0x11bd('0x4a')]]})[_0x11bd('0x6')](function(_0x52c645){logger['info'](_0x11bd('0x4b'),_0x131f3f);logger[_0x11bd('0x1d')](_0x11bd('0x4b'),_0x131f3f,JSON[_0x11bd('0x9')](_0x52c645));_0x44f0a6(_0x52c645);})[_0x11bd('0xf')](function(_0x22c474){logger[_0x11bd('0xa')](_0x11bd('0x4b'),_0x22c474[_0x11bd('0xd')],_0x131f3f);_0x336bed(_0x564e52[_0x11bd('0xa')](0x1f4,_0x22c474[_0x11bd('0xd')]));});});};exports[_0x11bd('0x4c')]=function(_0x64d020){var _0x21d69d=this;return new Promise(function(_0x5bbd27,_0x501fae){return db['sequelize']['transaction'](function(_0x157150){return db[_0x11bd('0x11')][_0x11bd('0x30')]({'active':![]},{'where':{},'transaction':_0x157150})[_0x11bd('0x6')](function(_0xf7a148){logger[_0x11bd('0x7')](_0x11bd('0x4c'),_0x64d020);logger['debug'](_0x11bd('0x4c'),_0x64d020,JSON[_0x11bd('0x9')](_0xf7a148));_0x5bbd27(_0xf7a148);})['catch'](function(_0x59f999){logger[_0x11bd('0xa')](_0x11bd('0x4c'),_0x59f999[_0x11bd('0xd')],_0x64d020);_0x501fae(_0x21d69d['error'](0x1f4,_0x59f999[_0x11bd('0xd')]));});});});};exports[_0x11bd('0x4d')]=function(_0x108724){var _0x36c5c7=this;var _0x5dcbcb=_0x108724[_0x11bd('0x1f')][_0x11bd('0x15')][_0x11bd('0x4e')];var _0x382073=_0x108724['body'][_0x11bd('0x15')]['interval'];var _0x302c2a=_0x108724[_0x11bd('0x1f')]['where'][_0x11bd('0x4f')];return new Promise(function(_0x5b3f0c,_0x5ac460){return db['CmHopper'][_0x11bd('0x12')]({'where':{'voiceQueueId':{'$in':_0x5dcbcb},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x11bd('0x50')](_0x11bd('0x51')+_0x382073+_0x11bd('0x52')),'$gt':db['sequelize'][_0x11bd('0x50')](_0x11bd('0x53'))}},'UserId':{'$in':_0x302c2a}},'include':[{'model':db[_0x11bd('0x23')],'as':_0x11bd('0x29')},{'model':db['User'],'as':_0x11bd('0x2c'),'attributes':['id','name',_0x11bd('0x2e')]},{'model':db[_0x11bd('0x54')],'as':'List'}]})[_0x11bd('0x6')](function(_0x25fd80){if(_0x25fd80[_0x11bd('0x2f')]>0x0){return db[_0x11bd('0x25')][_0x11bd('0x26')](function(_0x2477d0){return db[_0x11bd('0x11')][_0x11bd('0x30')]({'recallmeNotifiedDate':db[_0x11bd('0x25')][_0x11bd('0x50')]('NOW()')},{'where':{'id':{'$in':_[_0x11bd('0x18')](_0x25fd80,'id')}},'transaction':_0x2477d0})[_0x11bd('0x6')](function(){_0x5b3f0c(_0x25fd80);})[_0x11bd('0xf')](function(_0x419ab3){logger[_0x11bd('0xa')](_0x11bd('0x4d'),_0x419ab3[_0x11bd('0xd')],_0x108724);_0x5ac460(_0x36c5c7[_0x11bd('0xa')](0x1f4,_0x419ab3[_0x11bd('0xd')]));});})[_0x11bd('0xf')](function(_0x3ae246){logger[_0x11bd('0xa')](_0x11bd('0x4d'),_0x3ae246[_0x11bd('0xd')],_0x108724);_0x5ac460(_0x36c5c7[_0x11bd('0xa')](0x1f4,_0x3ae246[_0x11bd('0xd')]));});}else{_0x5b3f0c(_0x25fd80);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cb5bcdf..dac1163 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 _0x3811=['../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','delete','destroy','exports','express','Router'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x3811,0x11c));var _0x1381=function(_0xb5ac10,_0x26543d){_0xb5ac10=_0xb5ac10-0x0;var _0x5dee40=_0x3811[_0xb5ac10];return _0x5dee40;};'use strict';var express=require(_0x1381('0x0'));var router=express[_0x1381('0x1')]();var auth=require(_0x1381('0x2'));var controller=require(_0x1381('0x3'));router[_0x1381('0x4')]('/',auth[_0x1381('0x5')](),controller[_0x1381('0x6')]);router[_0x1381('0x4')](_0x1381('0x7'),auth['isAuthenticated'](),controller[_0x1381('0x8')]);router[_0x1381('0x4')]('/opencontacts',auth[_0x1381('0x5')](),controller[_0x1381('0x9')]);router['get'](_0x1381('0xa'),auth[_0x1381('0x5')](),controller[_0x1381('0xb')]);router[_0x1381('0x4')](_0x1381('0xc'),auth['isAuthenticated'](),controller[_0x1381('0xd')]);router[_0x1381('0x4')](_0x1381('0xe'),auth[_0x1381('0x5')](),controller[_0x1381('0xf')]);router[_0x1381('0x10')]('/',auth['isAuthenticated'](),controller[_0x1381('0x11')]);router[_0x1381('0x10')](_0x1381('0x12'),auth[_0x1381('0x5')](),controller[_0x1381('0x13')]);router[_0x1381('0x10')](_0x1381('0x14'),auth[_0x1381('0x5')](),controller[_0x1381('0x15')]);router[_0x1381('0x16')](_0x1381('0xc'),auth[_0x1381('0x5')](),controller['update']);router[_0x1381('0x17')](_0x1381('0xc'),auth[_0x1381('0x5')](),controller[_0x1381('0x18')]);module[_0x1381('0x19')]=router; \ No newline at end of file +var _0xd0d4=['exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','getPreview','getTimezone','put','update','delete'];(function(_0xfd2123,_0x4a8b1d){var _0xea5918=function(_0x29e8dc){while(--_0x29e8dc){_0xfd2123['push'](_0xfd2123['shift']());}};_0xea5918(++_0x4a8b1d);}(_0xd0d4,0x74));var _0x4d0d=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xd0d4[_0x346737];return _0x1ade2e;};'use strict';var express=require(_0x4d0d('0x0'));var router=express[_0x4d0d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4d0d('0x2'));router[_0x4d0d('0x3')]('/',auth[_0x4d0d('0x4')](),controller[_0x4d0d('0x5')]);router[_0x4d0d('0x3')](_0x4d0d('0x6'),auth['isAuthenticated'](),controller[_0x4d0d('0x7')]);router[_0x4d0d('0x3')](_0x4d0d('0x8'),auth[_0x4d0d('0x4')](),controller[_0x4d0d('0x9')]);router[_0x4d0d('0x3')](_0x4d0d('0xa'),auth[_0x4d0d('0x4')](),controller[_0x4d0d('0xb')]);router[_0x4d0d('0x3')](_0x4d0d('0xc'),auth['isAuthenticated'](),controller[_0x4d0d('0xd')]);router[_0x4d0d('0x3')](_0x4d0d('0xe'),auth[_0x4d0d('0x4')](),controller[_0x4d0d('0xf')]);router['post']('/',auth[_0x4d0d('0x4')](),controller['create']);router[_0x4d0d('0x10')]('/preview',auth['isAuthenticated'](),controller[_0x4d0d('0x11')]);router['post']('/timezone',auth[_0x4d0d('0x4')](),controller[_0x4d0d('0x12')]);router[_0x4d0d('0x13')](_0x4d0d('0xc'),auth[_0x4d0d('0x4')](),controller[_0x4d0d('0x14')]);router[_0x4d0d('0x15')](_0x4d0d('0xc'),auth[_0x4d0d('0x4')](),controller['destroy']);module[_0x4d0d('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 873ba53..f1d2f9e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x504c=['STRING','DATE','moment','sequelize','INTEGER'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x504c,0x16a));var _0xc504=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x504c[_0x2adbeb];return _0x5e18a6;};'use strict';var moment=require(_0xc504('0x0'));var Sequelize=require(_0xc504('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xc504('0x2')]},'phone':{'type':Sequelize[_0xc504('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc504('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc504('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c3e=['DATE','moment','INTEGER'];(function(_0x16fc75,_0x5ef41f){var _0x2d79d2=function(_0x38737a){while(--_0x38737a){_0x16fc75['push'](_0x16fc75['shift']());}};_0x2d79d2(++_0x5ef41f);}(_0x1c3e,0x1ba));var _0xe1c3=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x1c3e[_0x12b683];return _0xfb150b;};'use strict';var moment=require(_0xe1c3('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe1c3('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe1c3('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 3186ade..20eb5a7 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x388a=['filter','where','merge','VIRTUAL','options','include','findAll','catch','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','sort','pick','filters'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x388a,0x64));var _0xa388=function(_0xeae303,_0x3a2953){_0xeae303=_0xeae303-0x0;var _0x4ff708=_0x388a[_0xeae303];return _0x4ff708;};'use strict';var emlformat=require(_0xa388('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa388('0x1'));var jsonpatch=require(_0xa388('0x2'));var rp=require(_0xa388('0x3'));var moment=require(_0xa388('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa388('0x5'));var sox=require(_0xa388('0x6'));var csv=require(_0xa388('0x7'));var ejs=require(_0xa388('0x8'));var fs=require('fs');var fs_extra=require(_0xa388('0x9'));var _=require(_0xa388('0xa'));var squel=require(_0xa388('0xb'));var crypto=require('crypto');var jsforce=require(_0xa388('0xc'));var deskjs=require(_0xa388('0xd'));var toCsv=require(_0xa388('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa388('0xe'));var qs=require(_0xa388('0xf'));var as=require(_0xa388('0x10'));var hardwareService=require(_0xa388('0x11'));var logger=require(_0xa388('0x12'))(_0xa388('0x13'));var utils=require(_0xa388('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa388('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24fff9,_0x4a6e19){_0x4a6e19=_0x4a6e19||0xcc;return function(_0x161284){if(_0x161284){return _0x24fff9[_0xa388('0x16')](_0x4a6e19);}return _0x24fff9[_0xa388('0x17')](_0x4a6e19)[_0xa388('0x18')]();};}function respondWithResult(_0x548b91,_0x5ad07a){_0x5ad07a=_0x5ad07a||0xc8;return function(_0x436fbd){if(_0x436fbd){return _0x548b91[_0xa388('0x17')](_0x5ad07a)[_0xa388('0x19')](_0x436fbd);}};}function respondWithFilteredResult(_0x1160de,_0x3a22b5){return function(_0x1b8f8e){if(_0x1b8f8e){var _0x2da8aa=typeof _0x3a22b5[_0xa388('0x1a')]===_0xa388('0x1b')&&typeof _0x3a22b5['limit']===_0xa388('0x1b');var _0x406c05=_0x1b8f8e[_0xa388('0x1c')];var _0x371efa=_0x2da8aa?0x0:_0x3a22b5['offset'];var _0x5f4794=_0x2da8aa?_0x1b8f8e[_0xa388('0x1c')]:_0x3a22b5[_0xa388('0x1a')]+_0x3a22b5[_0xa388('0x1d')];var _0x40300b;if(_0x5f4794>=_0x406c05){_0x5f4794=_0x406c05;_0x40300b=0xc8;}else{_0x40300b=0xce;}_0x1160de[_0xa388('0x17')](_0x40300b);return _0x1160de[_0xa388('0x1e')](_0xa388('0x1f'),_0x371efa+'-'+_0x5f4794+'/'+_0x406c05)[_0xa388('0x19')](_0x1b8f8e);}return null;};}function patchUpdates(_0xb471eb){return function(_0x2a216b){try{jsonpatch[_0xa388('0x20')](_0x2a216b,_0xb471eb,!![]);}catch(_0x19f99a){return BPromise[_0xa388('0x21')](_0x19f99a);}return _0x2a216b[_0xa388('0x22')]();};}function saveUpdates(_0x1adb32,_0x242cf8){return function(_0x4bf985){if(_0x4bf985){return _0x4bf985[_0xa388('0x23')](_0x1adb32)[_0xa388('0x24')](function(_0x284a27){return _0x284a27;});}return null;};}function removeEntity(_0x378ead,_0x2f0691){return function(_0x19e529){if(_0x19e529){return _0x19e529[_0xa388('0x25')]()[_0xa388('0x24')](function(){var _0x56cfaa=_0x19e529[_0xa388('0x26')]({'plain':!![]});var _0x250392=_0xa388('0x27');return db[_0xa388('0x28')][_0xa388('0x25')]({'where':{'type':_0x250392,'resourceId':_0x56cfaa['id']}})[_0xa388('0x24')](function(){return _0x19e529;});})['then'](function(){_0x378ead['status'](0xcc)[_0xa388('0x18')]();});}};}function handleEntityNotFound(_0x4bfe4b,_0x87260e){return function(_0x44a4d3){if(!_0x44a4d3){_0x4bfe4b[_0xa388('0x16')](0x194);}return _0x44a4d3;};}function handleError(_0x55e6ed,_0x3e3faa){_0x3e3faa=_0x3e3faa||0x1f4;return function(_0x7dabde){logger[_0xa388('0x29')](_0x7dabde[_0xa388('0x2a')]);if(_0x7dabde[_0xa388('0x2b')]){delete _0x7dabde[_0xa388('0x2b')];}_0x55e6ed[_0xa388('0x17')](_0x3e3faa)[_0xa388('0x2c')](_0x7dabde);};}exports['index']=function(_0x56e8b2,_0x1d1a45){var _0x17b355={},_0x30a40d={},_0x460bd3={'count':0x0,'rows':[]};var _0x51d943=_[_0xa388('0x2d')](db[_0xa388('0x2e')][_0xa388('0x2f')],function(_0x565eae){return{'name':_0x565eae[_0xa388('0x30')],'type':_0x565eae[_0xa388('0x31')]['key']};});_0x30a40d[_0xa388('0x32')]=_[_0xa388('0x2d')](_0x51d943,_0xa388('0x2b'));_0x30a40d[_0xa388('0x33')]=_['keys'](_0x56e8b2[_0xa388('0x33')]);_0x30a40d['filters']=_[_0xa388('0x34')](_0x30a40d[_0xa388('0x32')],_0x30a40d[_0xa388('0x33')]);_0x17b355[_0xa388('0x35')]=_['intersection'](_0x30a40d[_0xa388('0x32')],qs[_0xa388('0x36')](_0x56e8b2[_0xa388('0x33')][_0xa388('0x36')]));_0x17b355[_0xa388('0x35')]=_0x17b355['attributes'][_0xa388('0x37')]?_0x17b355['attributes']:_0x30a40d['model'];if(!_0x56e8b2[_0xa388('0x33')]['hasOwnProperty'](_0xa388('0x38'))){_0x17b355[_0xa388('0x1d')]=qs[_0xa388('0x1d')](_0x56e8b2['query'][_0xa388('0x1d')]);_0x17b355[_0xa388('0x1a')]=qs[_0xa388('0x1a')](_0x56e8b2[_0xa388('0x33')][_0xa388('0x1a')]);}_0x17b355['order']=qs['sort'](_0x56e8b2['query'][_0xa388('0x39')]);_0x17b355['where']=qs['filters'](_[_0xa388('0x3a')](_0x56e8b2[_0xa388('0x33')],_0x30a40d[_0xa388('0x3b')]),_0x51d943);if(_0x56e8b2[_0xa388('0x33')][_0xa388('0x3c')]){_0x17b355[_0xa388('0x3d')]=_[_0xa388('0x3e')](_0x17b355[_0xa388('0x3d')],{'$or':_[_0xa388('0x2d')](_0x51d943,function(_0x4010c4){if(_0x4010c4[_0xa388('0x31')]!==_0xa388('0x3f')){var _0x503cc1={};_0x503cc1[_0x4010c4['name']]={'$like':'%'+_0x56e8b2[_0xa388('0x33')][_0xa388('0x3c')]+'%'};return _0x503cc1;}})});}_0x17b355=_[_0xa388('0x3e')]({},_0x17b355,_0x56e8b2[_0xa388('0x40')]);var _0x25b298={'where':_0x17b355[_0xa388('0x3d')]};return db[_0xa388('0x2e')][_0xa388('0x1c')](_0x25b298)[_0xa388('0x24')](function(_0x396789){_0x460bd3[_0xa388('0x1c')]=_0x396789;if(_0x56e8b2[_0xa388('0x33')]['includeAll']){_0x17b355[_0xa388('0x41')]=[{'all':!![]}];}return db[_0xa388('0x2e')][_0xa388('0x42')](_0x17b355);})[_0xa388('0x24')](function(_0xb20fbf){_0x460bd3['rows']=_0xb20fbf;return _0x460bd3;})['then'](respondWithFilteredResult(_0x1d1a45,_0x17b355))[_0xa388('0x43')](handleError(_0x1d1a45,null));};exports['show']=function(_0x3f2ab2,_0x3ccc98){var _0x482356={'raw':!![],'where':{'id':_0x3f2ab2[_0xa388('0x44')]['id']}},_0x24be09={};_0x24be09[_0xa388('0x32')]=_[_0xa388('0x45')](db[_0xa388('0x2e')]['rawAttributes']);_0x24be09[_0xa388('0x33')]=_[_0xa388('0x45')](_0x3f2ab2[_0xa388('0x33')]);_0x24be09['filters']=_[_0xa388('0x34')](_0x24be09[_0xa388('0x32')],_0x24be09[_0xa388('0x33')]);_0x482356[_0xa388('0x35')]=_['intersection'](_0x24be09[_0xa388('0x32')],qs[_0xa388('0x36')](_0x3f2ab2[_0xa388('0x33')][_0xa388('0x36')]));_0x482356[_0xa388('0x35')]=_0x482356[_0xa388('0x35')]['length']?_0x482356['attributes']:_0x24be09[_0xa388('0x32')];if(_0x3f2ab2['query'][_0xa388('0x46')]){_0x482356[_0xa388('0x41')]=[{'all':!![]}];}_0x482356=_['merge']({},_0x482356,_0x3f2ab2[_0xa388('0x40')]);return db['CmHopperAdditionalPhone'][_0xa388('0x47')](_0x482356)[_0xa388('0x24')](handleEntityNotFound(_0x3ccc98,null))[_0xa388('0x24')](respondWithResult(_0x3ccc98,null))[_0xa388('0x43')](handleError(_0x3ccc98,null));};exports['create']=function(_0x3b2541,_0x30e441){return db[_0xa388('0x2e')][_0xa388('0x48')](_0x3b2541[_0xa388('0x49')],{})[_0xa388('0x24')](function(_0x48bf2e){var _0x25b2a0=_0x3b2541['user'][_0xa388('0x26')]({'plain':!![]});if(!_0x25b2a0)throw new Error(_0xa388('0x4a'));if(_0x25b2a0[_0xa388('0x4b')]===_0xa388('0x4c')){var _0x3109b6=_0x48bf2e[_0xa388('0x26')]({'plain':!![]});var _0x371acf='CmHopperAdditionalPhones';return db[_0xa388('0x4d')]['find']({'where':{'name':_0x371acf,'userProfileId':_0x25b2a0['userProfileId']},'raw':!![]})[_0xa388('0x24')](function(_0x1f86b2){if(_0x1f86b2&&_0x1f86b2[_0xa388('0x4e')]===0x0){return db['UserProfileResource'][_0xa388('0x48')]({'name':_0x3109b6['name'],'resourceId':_0x3109b6['id'],'type':_0x1f86b2[_0xa388('0x2b')],'sectionId':_0x1f86b2['id']},{})[_0xa388('0x24')](function(){return _0x48bf2e;});}else{return _0x48bf2e;}})[_0xa388('0x43')](function(_0x4c89a9){logger[_0xa388('0x29')](_0xa388('0x4f'),_0x4c89a9);throw _0x4c89a9;});}return _0x48bf2e;})[_0xa388('0x24')](respondWithResult(_0x30e441,0xc9))[_0xa388('0x43')](handleError(_0x30e441,null));};exports[_0xa388('0x23')]=function(_0x561785,_0x4d45d4){if(_0x561785[_0xa388('0x49')]['id']){delete _0x561785[_0xa388('0x49')]['id'];}return db[_0xa388('0x2e')][_0xa388('0x47')]({'where':{'id':_0x561785['params']['id']}})['then'](handleEntityNotFound(_0x4d45d4,null))[_0xa388('0x24')](saveUpdates(_0x561785[_0xa388('0x49')],null))[_0xa388('0x24')](respondWithResult(_0x4d45d4,null))[_0xa388('0x43')](handleError(_0x4d45d4,null));};exports[_0xa388('0x25')]=function(_0x4182b0,_0x4916c7){return db[_0xa388('0x2e')][_0xa388('0x47')]({'where':{'id':_0x4182b0[_0xa388('0x44')]['id']}})[_0xa388('0x24')](handleEntityNotFound(_0x4916c7,null))[_0xa388('0x24')](removeEntity(_0x4916c7,null))[_0xa388('0x43')](handleError(_0x4916c7,null));}; \ No newline at end of file +var _0xafec=['filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','stack','name','send','map','CmHopperAdditionalPhone','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x57cb39,_0x3a2fdc){var _0x335514=function(_0x93e912){while(--_0x93e912){_0x57cb39['push'](_0x57cb39['shift']());}};_0x335514(++_0x3a2fdc);}(_0xafec,0x1af));var _0xcafe=function(_0xd6e6a6,_0x10096b){_0xd6e6a6=_0xd6e6a6-0x0;var _0x4bb481=_0xafec[_0xd6e6a6];return _0x4bb481;};'use strict';var emlformat=require(_0xcafe('0x0'));var rimraf=require(_0xcafe('0x1'));var zipdir=require(_0xcafe('0x2'));var jsonpatch=require(_0xcafe('0x3'));var rp=require(_0xcafe('0x4'));var moment=require(_0xcafe('0x5'));var BPromise=require(_0xcafe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcafe('0x7'));var sox=require(_0xcafe('0x8'));var csv=require(_0xcafe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcafe('0xa'));var _=require(_0xcafe('0xb'));var squel=require(_0xcafe('0xc'));var crypto=require(_0xcafe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcafe('0xe'));var toCsv=require(_0xcafe('0x9'));var querystring=require('querystring');var Papa=require(_0xcafe('0xf'));var Redis=require(_0xcafe('0x10'));var authService=require(_0xcafe('0x11'));var qs=require(_0xcafe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcafe('0x13'));var logger=require(_0xcafe('0x14'))(_0xcafe('0x15'));var utils=require(_0xcafe('0x16'));var config=require(_0xcafe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcafe('0x18'))['db'];function respondWithStatusCode(_0x495bca,_0x4068ca){_0x4068ca=_0x4068ca||0xcc;return function(_0x45be96){if(_0x45be96){return _0x495bca['sendStatus'](_0x4068ca);}return _0x495bca[_0xcafe('0x19')](_0x4068ca)[_0xcafe('0x1a')]();};}function respondWithResult(_0x2646fc,_0x47b588){_0x47b588=_0x47b588||0xc8;return function(_0x42d97a){if(_0x42d97a){return _0x2646fc[_0xcafe('0x19')](_0x47b588)[_0xcafe('0x1b')](_0x42d97a);}};}function respondWithFilteredResult(_0x493290,_0x17412){return function(_0x4fcbcd){if(_0x4fcbcd){var _0x52008a=typeof _0x17412['offset']===_0xcafe('0x1c')&&typeof _0x17412['limit']==='undefined';var _0x401008=_0x4fcbcd[_0xcafe('0x1d')];var _0xe22397=_0x52008a?0x0:_0x17412[_0xcafe('0x1e')];var _0xad23d7=_0x52008a?_0x4fcbcd[_0xcafe('0x1d')]:_0x17412[_0xcafe('0x1e')]+_0x17412[_0xcafe('0x1f')];var _0x4a3e72;if(_0xad23d7>=_0x401008){_0xad23d7=_0x401008;_0x4a3e72=0xc8;}else{_0x4a3e72=0xce;}_0x493290[_0xcafe('0x19')](_0x4a3e72);return _0x493290[_0xcafe('0x20')]('Content-Range',_0xe22397+'-'+_0xad23d7+'/'+_0x401008)[_0xcafe('0x1b')](_0x4fcbcd);}return null;};}function patchUpdates(_0x140f58){return function(_0x2caab8){try{jsonpatch['apply'](_0x2caab8,_0x140f58,!![]);}catch(_0x30cc48){return BPromise[_0xcafe('0x21')](_0x30cc48);}return _0x2caab8[_0xcafe('0x22')]();};}function saveUpdates(_0x43ac19,_0x31eafd){return function(_0x422fd4){if(_0x422fd4){return _0x422fd4['update'](_0x43ac19)[_0xcafe('0x23')](function(_0x8fbde3){return _0x8fbde3;});}return null;};}function removeEntity(_0xfe4d80,_0x5ae119){return function(_0x2cd6b5){if(_0x2cd6b5){return _0x2cd6b5[_0xcafe('0x24')]()[_0xcafe('0x23')](function(){var _0x3c6904=_0x2cd6b5['get']({'plain':!![]});var _0x495059=_0xcafe('0x25');return db[_0xcafe('0x26')][_0xcafe('0x24')]({'where':{'type':_0x495059,'resourceId':_0x3c6904['id']}})[_0xcafe('0x23')](function(){return _0x2cd6b5;});})[_0xcafe('0x23')](function(){_0xfe4d80['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dff2c,_0x4909de){return function(_0x3e9b05){if(!_0x3e9b05){_0x1dff2c[_0xcafe('0x27')](0x194);}return _0x3e9b05;};}function handleError(_0x5e0d9b,_0x5964bc){_0x5964bc=_0x5964bc||0x1f4;return function(_0x9a6e87){logger['error'](_0x9a6e87[_0xcafe('0x28')]);if(_0x9a6e87[_0xcafe('0x29')]){delete _0x9a6e87[_0xcafe('0x29')];}_0x5e0d9b['status'](_0x5964bc)[_0xcafe('0x2a')](_0x9a6e87);};}exports['index']=function(_0x2869a6,_0x5927c6){var _0x11505d={},_0xb7f264={},_0x5b4486={'count':0x0,'rows':[]};var _0x4fdc9c=_[_0xcafe('0x2b')](db[_0xcafe('0x2c')]['rawAttributes'],function(_0x547180){return{'name':_0x547180[_0xcafe('0x2d')],'type':_0x547180[_0xcafe('0x2e')][_0xcafe('0x2f')]};});_0xb7f264['model']=_[_0xcafe('0x2b')](_0x4fdc9c,'name');_0xb7f264[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x2869a6['query']);_0xb7f264[_0xcafe('0x32')]=_[_0xcafe('0x33')](_0xb7f264[_0xcafe('0x34')],_0xb7f264[_0xcafe('0x30')]);_0x11505d['attributes']=_[_0xcafe('0x33')](_0xb7f264[_0xcafe('0x34')],qs[_0xcafe('0x35')](_0x2869a6[_0xcafe('0x30')][_0xcafe('0x35')]));_0x11505d[_0xcafe('0x36')]=_0x11505d['attributes'][_0xcafe('0x37')]?_0x11505d[_0xcafe('0x36')]:_0xb7f264[_0xcafe('0x34')];if(!_0x2869a6[_0xcafe('0x30')][_0xcafe('0x38')]('nolimit')){_0x11505d[_0xcafe('0x1f')]=qs[_0xcafe('0x1f')](_0x2869a6['query']['limit']);_0x11505d['offset']=qs['offset'](_0x2869a6['query']['offset']);}_0x11505d[_0xcafe('0x39')]=qs[_0xcafe('0x3a')](_0x2869a6[_0xcafe('0x30')]['sort']);_0x11505d[_0xcafe('0x3b')]=qs['filters'](_[_0xcafe('0x3c')](_0x2869a6[_0xcafe('0x30')],_0xb7f264[_0xcafe('0x32')]),_0x4fdc9c);if(_0x2869a6[_0xcafe('0x30')][_0xcafe('0x3d')]){_0x11505d[_0xcafe('0x3b')]=_[_0xcafe('0x3e')](_0x11505d[_0xcafe('0x3b')],{'$or':_[_0xcafe('0x2b')](_0x4fdc9c,function(_0x43b2d2){if(_0x43b2d2[_0xcafe('0x2e')]!=='VIRTUAL'){var _0x480d30={};_0x480d30[_0x43b2d2['name']]={'$like':'%'+_0x2869a6[_0xcafe('0x30')][_0xcafe('0x3d')]+'%'};return _0x480d30;}})});}_0x11505d=_[_0xcafe('0x3e')]({},_0x11505d,_0x2869a6['options']);var _0x12616b={'where':_0x11505d[_0xcafe('0x3b')]};return db[_0xcafe('0x2c')][_0xcafe('0x1d')](_0x12616b)['then'](function(_0x4d1582){_0x5b4486['count']=_0x4d1582;if(_0x2869a6[_0xcafe('0x30')][_0xcafe('0x3f')]){_0x11505d[_0xcafe('0x40')]=[{'all':!![]}];}return db[_0xcafe('0x2c')][_0xcafe('0x41')](_0x11505d);})[_0xcafe('0x23')](function(_0xa5ccb8){_0x5b4486[_0xcafe('0x42')]=_0xa5ccb8;return _0x5b4486;})[_0xcafe('0x23')](respondWithFilteredResult(_0x5927c6,_0x11505d))[_0xcafe('0x43')](handleError(_0x5927c6,null));};exports[_0xcafe('0x44')]=function(_0x142503,_0x23b7d0){var _0x15d6e5={'raw':!![],'where':{'id':_0x142503[_0xcafe('0x45')]['id']}},_0x4f2033={};_0x4f2033['model']=_[_0xcafe('0x31')](db['CmHopperAdditionalPhone'][_0xcafe('0x46')]);_0x4f2033[_0xcafe('0x30')]=_['keys'](_0x142503[_0xcafe('0x30')]);_0x4f2033[_0xcafe('0x32')]=_[_0xcafe('0x33')](_0x4f2033[_0xcafe('0x34')],_0x4f2033[_0xcafe('0x30')]);_0x15d6e5['attributes']=_[_0xcafe('0x33')](_0x4f2033[_0xcafe('0x34')],qs[_0xcafe('0x35')](_0x142503[_0xcafe('0x30')][_0xcafe('0x35')]));_0x15d6e5[_0xcafe('0x36')]=_0x15d6e5[_0xcafe('0x36')][_0xcafe('0x37')]?_0x15d6e5[_0xcafe('0x36')]:_0x4f2033[_0xcafe('0x34')];if(_0x142503['query'][_0xcafe('0x3f')]){_0x15d6e5['include']=[{'all':!![]}];}_0x15d6e5=_[_0xcafe('0x3e')]({},_0x15d6e5,_0x142503[_0xcafe('0x47')]);return db[_0xcafe('0x2c')][_0xcafe('0x48')](_0x15d6e5)['then'](handleEntityNotFound(_0x23b7d0,null))[_0xcafe('0x23')](respondWithResult(_0x23b7d0,null))['catch'](handleError(_0x23b7d0,null));};exports[_0xcafe('0x49')]=function(_0x4feeb8,_0x3b2303){return db[_0xcafe('0x2c')]['create'](_0x4feeb8['body'],{})[_0xcafe('0x23')](function(_0x45a0d1){var _0x5b2743=_0x4feeb8['user'][_0xcafe('0x4a')]({'plain':!![]});if(!_0x5b2743)throw new Error(_0xcafe('0x4b'));if(_0x5b2743[_0xcafe('0x4c')]===_0xcafe('0x4d')){var _0x4b31b8=_0x45a0d1[_0xcafe('0x4a')]({'plain':!![]});var _0x8b0f84=_0xcafe('0x25');return db[_0xcafe('0x4e')][_0xcafe('0x48')]({'where':{'name':_0x8b0f84,'userProfileId':_0x5b2743['userProfileId']},'raw':!![]})[_0xcafe('0x23')](function(_0x4ef71f){if(_0x4ef71f&&_0x4ef71f['autoAssociation']===0x0){return db['UserProfileResource'][_0xcafe('0x49')]({'name':_0x4b31b8['name'],'resourceId':_0x4b31b8['id'],'type':_0x4ef71f[_0xcafe('0x29')],'sectionId':_0x4ef71f['id']},{})[_0xcafe('0x23')](function(){return _0x45a0d1;});}else{return _0x45a0d1;}})['catch'](function(_0x2b866c){logger[_0xcafe('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b866c);throw _0x2b866c;});}return _0x45a0d1;})[_0xcafe('0x23')](respondWithResult(_0x3b2303,0xc9))[_0xcafe('0x43')](handleError(_0x3b2303,null));};exports[_0xcafe('0x50')]=function(_0x53837e,_0x1453a6){if(_0x53837e['body']['id']){delete _0x53837e['body']['id'];}return db['CmHopperAdditionalPhone'][_0xcafe('0x48')]({'where':{'id':_0x53837e[_0xcafe('0x45')]['id']}})[_0xcafe('0x23')](handleEntityNotFound(_0x1453a6,null))[_0xcafe('0x23')](saveUpdates(_0x53837e[_0xcafe('0x51')],null))[_0xcafe('0x23')](respondWithResult(_0x1453a6,null))['catch'](handleError(_0x1453a6,null));};exports[_0xcafe('0x24')]=function(_0x3d00c6,_0x16e5f2){return db[_0xcafe('0x2c')][_0xcafe('0x48')]({'where':{'id':_0x3d00c6[_0xcafe('0x45')]['id']}})['then'](handleEntityNotFound(_0x16e5f2,null))[_0xcafe('0x23')](removeEntity(_0x16e5f2,null))[_0xcafe('0x43')](handleError(_0x16e5f2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 36fb1ce..cf62a7d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c7b=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','moment','request-promise'];(function(_0xfc0ea0,_0x2a3610){var _0x4abbdd=function(_0xc66733){while(--_0xc66733){_0xfc0ea0['push'](_0xfc0ea0['shift']());}};_0x4abbdd(++_0x2a3610);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x94cd9e,_0x2b50f2){_0x94cd9e=_0x94cd9e-0x0;var _0x1bf136=_0x6c7b[_0x94cd9e];return _0x1bf136;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x459d=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x496b2a,_0x5a5db5){var _0x385b76=function(_0x11b2ec){while(--_0x11b2ec){_0x496b2a['push'](_0x496b2a['shift']());}};_0x385b76(++_0x5a5db5);}(_0x459d,0xd9));var _0xd459=function(_0x454806,_0x508c23){_0x454806=_0x454806-0x0;var _0x2ce75b=_0x459d[_0x454806];return _0x2ce75b;};'use strict';var _=require(_0xd459('0x0'));var util=require(_0xd459('0x1'));var logger=require(_0xd459('0x2'))(_0xd459('0x3'));var moment=require(_0xd459('0x4'));var BPromise=require(_0xd459('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd459('0x6'));var rimraf=require(_0xd459('0x7'));var config=require(_0xd459('0x8'));var attributes=require(_0xd459('0x9'));module[_0xd459('0xa')]=function(_0x34c0ac,_0x516c39){return _0x34c0ac['define'](_0xd459('0xb'),attributes,{'tableName':_0xd459('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9e9c607..9742f6d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3650=['CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countdropretry','waitTime','duration','isNil','scheduledat','minutes','add','createdAt','updatedAt','phone','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x3650,0xff));var _0x0365=function(_0x3319a1,_0x347b3c){_0x3319a1=_0x3319a1-0x0;var _0x27f27c=_0x3650[_0x3319a1];return _0x27f27c;};'use strict';var _=require(_0x0365('0x0'));var util=require(_0x0365('0x1'));var moment=require(_0x0365('0x2'));var BPromise=require(_0x0365('0x3'));var rs=require(_0x0365('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0365('0x5'));var logger=require('../../config/logger')(_0x0365('0x6'));var config=require(_0x0365('0x7'));var jayson=require(_0x0365('0x8'));var client=jayson[_0x0365('0x9')][_0x0365('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d2a08,_0x2bc269,_0x19b1c3){return new BPromise(function(_0x30cef3,_0x18b4e1){return client[_0x0365('0xb')](_0x2d2a08,_0x19b1c3)[_0x0365('0xc')](function(_0x605336){logger['info'](_0x0365('0xd'),_0x2bc269,'request\x20sent');logger[_0x0365('0xe')](_0x0365('0xf'),_0x2bc269,_0x0365('0x10'),JSON[_0x0365('0x11')](_0x605336));if(_0x605336['error']){if(_0x605336[_0x0365('0x12')][_0x0365('0x13')]===0x1f4){logger[_0x0365('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2bc269,_0x605336['error'][_0x0365('0x14')]);return _0x18b4e1(_0x605336[_0x0365('0x12')][_0x0365('0x14')]);}logger['error'](_0x0365('0xd'),_0x2bc269,_0x605336[_0x0365('0x12')][_0x0365('0x14')]);return _0x30cef3(_0x605336[_0x0365('0x12')]['message']);}else{logger[_0x0365('0x15')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2bc269,_0x0365('0x10'));_0x30cef3(_0x605336[_0x0365('0x16')]['message']);}})[_0x0365('0x17')](function(_0x3dc0dd){logger[_0x0365('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2bc269,_0x3dc0dd);_0x18b4e1(_0x3dc0dd);});});}exports[_0x0365('0x18')]=function(_0x2b1ba8){var _0x776682=this;return new Promise(function(_0x32943d,_0x293d6f){return db[_0x0365('0x19')][_0x0365('0x1a')]({'raw':!![],'where':{'ContactId':_0x2b1ba8[_0x0365('0x1b')][_0x0365('0x1c')],'ListId':_0x2b1ba8['body']['ListId'],'VoiceQueueId':_0x2b1ba8[_0x0365('0x1b')][_0x0365('0x1d')]===undefined?null:_0x2b1ba8[_0x0365('0x1b')][_0x0365('0x1d')],'CampaignId':_0x2b1ba8[_0x0365('0x1b')]['CampaignId']===undefined?null:_0x2b1ba8[_0x0365('0x1b')][_0x0365('0x1e')]}})['then'](function(_0x2ae51b){if(_0x2ae51b!=null){return db[_0x0365('0x1f')][_0x0365('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2ae51b['id'],'OrderBy':{'$gt':_0x2ae51b['OrderBy']}},'order':[[_0x0365('0x20'),_0x0365('0x21')]]})[_0x0365('0xc')](function(_0x44d661){var _0x36c38d=0x0;if(_0x44d661){if(_0x44d661[_0x0365('0x22')]+_0x44d661[_0x0365('0x23')]+_0x44d661[_0x0365('0x24')]+_0x44d661['countnosuchnumberretry']+_0x44d661['countdropretry']+_0x44d661[_0x0365('0x25')]+_0x44d661[_0x0365('0x26')]+_0x44d661[_0x0365('0x27')]<_0x2b1ba8[_0x0365('0x28')][_0x0365('0x29')])_0x36c38d=0x1;_0x32943d({'additional':_0x36c38d});}else{return db[_0x0365('0x1f')][_0x0365('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2ae51b['id']},'order':[[_0x0365('0x20'),'ASC']]})[_0x0365('0xc')](function(_0x161c06){var _0x1ffcd7=0x0;if(_0x161c06){if(_0x161c06[_0x0365('0x22')]+_0x161c06['countcongestionretry']+_0x161c06[_0x0365('0x24')]+_0x161c06[_0x0365('0x2a')]+_0x161c06[_0x0365('0x2b')]+_0x161c06['countabandonedretry']+_0x161c06[_0x0365('0x26')]+_0x161c06[_0x0365('0x27')]<_0x2b1ba8[_0x0365('0x28')][_0x0365('0x29')])_0x1ffcd7=0x1;_0x32943d({'additional':_0x1ffcd7});}else{_0x32943d({'additional':0x0});}})['catch'](function(_0x647eaa){logger[_0x0365('0x12')](_0x0365('0x18'),_0x647eaa['message']);_0x293d6f(_0x776682[_0x0365('0x12')](0x1f4,_0x647eaa[_0x0365('0x14')]));});}})['catch'](function(_0xc9bfe1){logger[_0x0365('0x12')](_0x0365('0x18'),_0xc9bfe1[_0x0365('0x14')]);_0x293d6f(_0x776682['error'](0x1f4,_0xc9bfe1[_0x0365('0x14')]));});}else _0x32943d({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x46b372){var _0x92873d=this;return new Promise(function(_0x4c87c6,_0x10622e){return db[_0x0365('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x46b372['body'][_0x0365('0x1c')],'ListId':_0x46b372[_0x0365('0x1b')]['ListId'],'VoiceQueueId':_0x46b372[_0x0365('0x1b')]['VoiceQueueId']===undefined?null:_0x46b372['body'][_0x0365('0x1d')],'CampaignId':_0x46b372[_0x0365('0x1b')]['CampaignId']===undefined?null:_0x46b372['body'][_0x0365('0x1e')]}})['then'](function(_0x18b062){if(_0x18b062!=null){return db[_0x0365('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x18b062['id'],'OrderBy':{'$gte':_0x18b062[_0x0365('0x20')]}},'order':[[_0x0365('0x20'),'ASC']]})[_0x0365('0xc')](function(_0x23c1c8){if(_0x23c1c8)return activateAdditionalPhone(_0x18b062,_0x46b372[_0x0365('0x1b')],_0x23c1c8,_0x46b372['duration'],_0x46b372[_0x0365('0x2c')])[_0x0365('0xc')](function(_0x12bf26){_0x4c87c6(_0x12bf26);});else{return db[_0x0365('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x18b062['id']},'order':[[_0x0365('0x20'),_0x0365('0x21')]]})[_0x0365('0xc')](function(_0x5ef5c5){if(_0x5ef5c5)return activateAdditionalPhone(_0x18b062,_0x46b372[_0x0365('0x1b')],_0x5ef5c5,_0x46b372[_0x0365('0x2d')],_0x46b372[_0x0365('0x2c')])[_0x0365('0xc')](function(_0x4cda8a){_0x4c87c6(_0x4cda8a);});else{_0x4c87c6({'id':_0x18b062['id'],'phone':''});}})[_0x0365('0x17')](function(_0x188ddc){logger['error'](_0x0365('0x18'),_0x188ddc[_0x0365('0x14')]);_0x10622e(_0x92873d[_0x0365('0x12')](0x1f4,_0x188ddc[_0x0365('0x14')]));});}})[_0x0365('0x17')](function(_0x4e5d64){logger['error'](_0x0365('0x18'),_0x4e5d64[_0x0365('0x14')]);_0x10622e(_0x92873d[_0x0365('0x12')](0x1f4,_0x4e5d64[_0x0365('0x14')]));});}else _0x4c87c6(0x1);});});};function activateAdditionalPhone(_0x448468,_0x43a3b5,_0x5191fb,_0x2f9572,_0x2e0931){return new Promise(function(_0x1f776d,_0x5b8210){var _0x5a09ec;if(_[_0x0365('0x2e')](_0x5191fb[_0x0365('0x2f')])){_0x5191fb[_0x0365('0x2f')]=moment();}if(moment()>moment(_0x5191fb[_0x0365('0x2f')])){_0x5a09ec=moment()['add'](_0x2e0931||0x3,_0x0365('0x30'));}else{if(_0x5191fb[_0x0365('0x20')]==0x0){_0x5a09ec=moment(_0x5191fb['scheduledat']);}else{_0x5a09ec=moment()[_0x0365('0x31')](_0x2e0931||0x3,'minutes');}}if(_[_0x0365('0x2e')](_0x5a09ec)){_0x5a09ec=moment()['add'](_0x2e0931||0x3,_0x0365('0x30'));}var _0x38860c={'phone':_0x448468['phone'],'active':0x0,'OrderBy':_[_0x0365('0x2e')](_0x448468['OrderBy'])?0x0:_0x448468[_0x0365('0x20')],'scheduledat':moment()[_0x0365('0x31')](_0x2f9572||0x1,'minutes'),'countbusyretry':_0x43a3b5[_0x0365('0x22')],'countcongestionretry':_0x43a3b5[_0x0365('0x23')],'countnoanswerretry':_0x43a3b5[_0x0365('0x24')],'countnosuchnumberretry':_0x43a3b5[_0x0365('0x2a')],'countdropretry':_0x43a3b5['countdropretry'],'countabandonedretry':_0x43a3b5['countabandonedretry'],'countmachineretry':_0x43a3b5[_0x0365('0x26')],'countagentrejectretry':_0x43a3b5[_0x0365('0x27')],'createdAt':_0x43a3b5[_0x0365('0x32')],'updatedAt':_0x43a3b5[_0x0365('0x33')]};var _0x27051b={'CmHopperId':_0x448468['id'],'phone':_0x5191fb[_0x0365('0x34')],'active':0x0,'OrderBy':_[_0x0365('0x2e')](_0x5191fb[_0x0365('0x20')])?0x0:_0x5191fb[_0x0365('0x20')],'scheduledat':_0x5a09ec,'countbusyretry':_0x5191fb[_0x0365('0x22')],'countcongestionretry':_0x5191fb[_0x0365('0x23')],'countnoanswerretry':_0x5191fb[_0x0365('0x24')],'countnosuchnumberretry':_0x5191fb[_0x0365('0x2a')],'countdropretry':_0x5191fb['countdropretry'],'countabandonedretry':_0x5191fb[_0x0365('0x25')],'countmachineretry':_0x5191fb[_0x0365('0x26')],'countagentrejectretry':_0x5191fb[_0x0365('0x27')],'createdAt':_0x5191fb['createdAt'],'updatedAt':_0x5191fb[_0x0365('0x33')]};return db['sequelize'][_0x0365('0x35')](function(_0x8141b5){return db[_0x0365('0x1f')][_0x0365('0x36')](_0x38860c,{'where':{'id':_0x5191fb['id']}},{'transaction':_0x8141b5})[_0x0365('0xc')](function(){return db[_0x0365('0x19')][_0x0365('0x36')](_0x27051b,{'where':{'id':_0x448468['id']}},{'transaction':_0x8141b5});});})[_0x0365('0xc')](function(_0x225f2f){_0x1f776d({'id':_0x448468['id'],'phone':_0x5191fb['phone']});})['catch'](function(_0x416eca){logger[_0x0365('0x12')](_0x0365('0x37'),_0x416eca[_0x0365('0x14')]);_0x5b8210({'error':_0x416eca[_0x0365('0x14')]});});});}exports[_0x0365('0x38')]=function(_0x95b096){var _0x3e44aa=this;return new Promise(function(_0x5e2459,_0x31e751){return db[_0x0365('0x19')][_0x0365('0x36')](_0x95b096[_0x0365('0x1b')]['field'],{'where':{'id':_0x95b096['body']['id']}})[_0x0365('0xc')](function(_0x1c9722){_0x5e2459(_0x1c9722);})[_0x0365('0x17')](function(_0x218c27){logger[_0x0365('0x12')]('IncrementPreviewCounters',_0x218c27[_0x0365('0x14')]);_0x31e751(_0x3e44aa[_0x0365('0x12')](0x1f4,_0x218c27[_0x0365('0x14')]));});});}; \ No newline at end of file +var _0x8b89=['CmHopperAdditionalPhone','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','SwapAdditionalPhones','ListId','VoiceQueueId','duration','waitTime'];(function(_0x3cbdea,_0x36121e){var _0x47d538=function(_0x291f74){while(--_0x291f74){_0x3cbdea['push'](_0x3cbdea['shift']());}};_0x47d538(++_0x36121e);}(_0x8b89,0x7e));var _0x98b8=function(_0x38c1a7,_0x1268e7){_0x38c1a7=_0x38c1a7-0x0;var _0x1b8bc8=_0x8b89[_0x38c1a7];return _0x1b8bc8;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var moment=require(_0x98b8('0x2'));var BPromise=require(_0x98b8('0x3'));var rs=require(_0x98b8('0x4'));var fs=require('fs');var Redis=require(_0x98b8('0x5'));var db=require(_0x98b8('0x6'))['db'];var utils=require(_0x98b8('0x7'));var logger=require(_0x98b8('0x8'))('rpc');var config=require(_0x98b8('0x9'));var jayson=require(_0x98b8('0xa'));var client=jayson[_0x98b8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4df9,_0x3457c0,_0x58fe04){return new BPromise(function(_0x1b6a6f,_0x5613a6){return client[_0x98b8('0xc')](_0x3b4df9,_0x58fe04)[_0x98b8('0xd')](function(_0x5afa92){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3457c0,_0x98b8('0xe'));logger['debug'](_0x98b8('0xf'),_0x3457c0,'request\x20sent',JSON[_0x98b8('0x10')](_0x5afa92));if(_0x5afa92[_0x98b8('0x11')]){if(_0x5afa92['error'][_0x98b8('0x12')]===0x1f4){logger[_0x98b8('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3457c0,_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);return _0x5613a6(_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);}logger[_0x98b8('0x11')](_0x98b8('0x14'),_0x3457c0,_0x5afa92[_0x98b8('0x11')][_0x98b8('0x13')]);return _0x1b6a6f(_0x5afa92[_0x98b8('0x11')]['message']);}else{logger['info'](_0x98b8('0x14'),_0x3457c0,_0x98b8('0xe'));_0x1b6a6f(_0x5afa92[_0x98b8('0x15')]['message']);}})[_0x98b8('0x16')](function(_0x5c49c6){logger[_0x98b8('0x11')](_0x98b8('0x14'),_0x3457c0,_0x5c49c6);_0x5613a6(_0x5c49c6);});});}exports[_0x98b8('0x17')]=function(_0x410de6){var _0x37f9af=this;return new Promise(function(_0x17e124,_0x11d2e7){return db[_0x98b8('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x410de6['body'][_0x98b8('0x19')],'ListId':_0x410de6[_0x98b8('0x1a')]['ListId'],'VoiceQueueId':_0x410de6[_0x98b8('0x1a')]['VoiceQueueId']===undefined?null:_0x410de6[_0x98b8('0x1a')]['VoiceQueueId'],'CampaignId':_0x410de6[_0x98b8('0x1a')][_0x98b8('0x1b')]===undefined?null:_0x410de6[_0x98b8('0x1a')][_0x98b8('0x1b')]}})[_0x98b8('0xd')](function(_0x510e94){if(_0x510e94!=null){return db['CmHopperAdditionalPhone'][_0x98b8('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x510e94['id'],'OrderBy':{'$gt':_0x510e94[_0x98b8('0x1d')]}},'order':[[_0x98b8('0x1d'),_0x98b8('0x1e')]]})[_0x98b8('0xd')](function(_0x228bc1){var _0x5a964d=0x0;if(_0x228bc1){if(_0x228bc1[_0x98b8('0x1f')]+_0x228bc1[_0x98b8('0x20')]+_0x228bc1['countnoanswerretry']+_0x228bc1[_0x98b8('0x21')]+_0x228bc1[_0x98b8('0x22')]+_0x228bc1[_0x98b8('0x23')]+_0x228bc1['countmachineretry']+_0x228bc1[_0x98b8('0x24')]<_0x410de6['entity']['dialGlobalMaxRetry'])_0x5a964d=0x1;_0x17e124({'additional':_0x5a964d});}else{return db['CmHopperAdditionalPhone'][_0x98b8('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x510e94['id']},'order':[[_0x98b8('0x1d'),_0x98b8('0x1e')]]})[_0x98b8('0xd')](function(_0x590f27){var _0x71323d=0x0;if(_0x590f27){if(_0x590f27[_0x98b8('0x1f')]+_0x590f27['countcongestionretry']+_0x590f27[_0x98b8('0x25')]+_0x590f27[_0x98b8('0x21')]+_0x590f27['countdropretry']+_0x590f27['countabandonedretry']+_0x590f27[_0x98b8('0x26')]+_0x590f27[_0x98b8('0x24')]<_0x410de6['entity'][_0x98b8('0x27')])_0x71323d=0x1;_0x17e124({'additional':_0x71323d});}else{_0x17e124({'additional':0x0});}})['catch'](function(_0x44921c){logger[_0x98b8('0x11')](_0x98b8('0x17'),_0x44921c[_0x98b8('0x13')]);_0x11d2e7(_0x37f9af[_0x98b8('0x11')](0x1f4,_0x44921c[_0x98b8('0x13')]));});}})[_0x98b8('0x16')](function(_0x22e1da){logger[_0x98b8('0x11')]('VerifyAdditionalPhones',_0x22e1da[_0x98b8('0x13')]);_0x11d2e7(_0x37f9af[_0x98b8('0x11')](0x1f4,_0x22e1da[_0x98b8('0x13')]));});}else _0x17e124({'additional':0x0});});});};exports[_0x98b8('0x28')]=function(_0x5f3f4f){var _0x37cb47=this;return new Promise(function(_0x3d1703,_0x5b7d35){return db['CmHopper'][_0x98b8('0x1c')]({'raw':!![],'where':{'ContactId':_0x5f3f4f[_0x98b8('0x1a')]['ContactId'],'ListId':_0x5f3f4f['body'][_0x98b8('0x29')],'VoiceQueueId':_0x5f3f4f[_0x98b8('0x1a')][_0x98b8('0x2a')]===undefined?null:_0x5f3f4f['body'][_0x98b8('0x2a')],'CampaignId':_0x5f3f4f[_0x98b8('0x1a')]['CampaignId']===undefined?null:_0x5f3f4f[_0x98b8('0x1a')]['CampaignId']}})[_0x98b8('0xd')](function(_0x58e8a0){if(_0x58e8a0!=null){return db['CmHopperAdditionalPhone'][_0x98b8('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x58e8a0['id'],'OrderBy':{'$gte':_0x58e8a0[_0x98b8('0x1d')]}},'order':[['OrderBy',_0x98b8('0x1e')]]})[_0x98b8('0xd')](function(_0x4a7752){if(_0x4a7752)return activateAdditionalPhone(_0x58e8a0,_0x5f3f4f[_0x98b8('0x1a')],_0x4a7752,_0x5f3f4f[_0x98b8('0x2b')],_0x5f3f4f[_0x98b8('0x2c')])['then'](function(_0x221931){_0x3d1703(_0x221931);});else{return db[_0x98b8('0x2d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x58e8a0['id']},'order':[['OrderBy','ASC']]})[_0x98b8('0xd')](function(_0x2949f7){if(_0x2949f7)return activateAdditionalPhone(_0x58e8a0,_0x5f3f4f[_0x98b8('0x1a')],_0x2949f7,_0x5f3f4f[_0x98b8('0x2b')],_0x5f3f4f['waitTime'])[_0x98b8('0xd')](function(_0x3eda93){_0x3d1703(_0x3eda93);});else{_0x3d1703({'id':_0x58e8a0['id'],'phone':''});}})['catch'](function(_0x40a6f8){logger[_0x98b8('0x11')](_0x98b8('0x17'),_0x40a6f8[_0x98b8('0x13')]);_0x5b7d35(_0x37cb47['error'](0x1f4,_0x40a6f8[_0x98b8('0x13')]));});}})[_0x98b8('0x16')](function(_0x37a274){logger[_0x98b8('0x11')](_0x98b8('0x17'),_0x37a274[_0x98b8('0x13')]);_0x5b7d35(_0x37cb47[_0x98b8('0x11')](0x1f4,_0x37a274[_0x98b8('0x13')]));});}else _0x3d1703(0x1);});});};function activateAdditionalPhone(_0x2100e7,_0x272fa4,_0x33c5d4,_0x6ddc5,_0x15ff3f){return new Promise(function(_0x2c5f14,_0x331bfe){var _0x5a54d8;if(_['isNil'](_0x33c5d4[_0x98b8('0x2e')])){_0x33c5d4[_0x98b8('0x2e')]=moment();}if(moment()>moment(_0x33c5d4[_0x98b8('0x2e')])){_0x5a54d8=moment()[_0x98b8('0x2f')](_0x15ff3f||0x3,_0x98b8('0x30'));}else{if(_0x33c5d4[_0x98b8('0x1d')]==0x0){_0x5a54d8=moment(_0x33c5d4['scheduledat']);}else{_0x5a54d8=moment()[_0x98b8('0x2f')](_0x15ff3f||0x3,_0x98b8('0x30'));}}if(_[_0x98b8('0x31')](_0x5a54d8)){_0x5a54d8=moment()[_0x98b8('0x2f')](_0x15ff3f||0x3,'minutes');}var _0x120d39={'phone':_0x2100e7[_0x98b8('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x2100e7['OrderBy'])?0x0:_0x2100e7['OrderBy'],'scheduledat':moment()[_0x98b8('0x2f')](_0x6ddc5||0x1,_0x98b8('0x30')),'countbusyretry':_0x272fa4['countbusyretry'],'countcongestionretry':_0x272fa4[_0x98b8('0x20')],'countnoanswerretry':_0x272fa4['countnoanswerretry'],'countnosuchnumberretry':_0x272fa4['countnosuchnumberretry'],'countdropretry':_0x272fa4[_0x98b8('0x22')],'countabandonedretry':_0x272fa4[_0x98b8('0x23')],'countmachineretry':_0x272fa4[_0x98b8('0x26')],'countagentrejectretry':_0x272fa4[_0x98b8('0x24')],'createdAt':_0x272fa4[_0x98b8('0x33')],'updatedAt':_0x272fa4[_0x98b8('0x34')]};var _0x1ac5c3={'CmHopperId':_0x2100e7['id'],'phone':_0x33c5d4[_0x98b8('0x32')],'active':0x0,'OrderBy':_[_0x98b8('0x31')](_0x33c5d4[_0x98b8('0x1d')])?0x0:_0x33c5d4['OrderBy'],'scheduledat':_0x5a54d8,'countbusyretry':_0x33c5d4[_0x98b8('0x1f')],'countcongestionretry':_0x33c5d4[_0x98b8('0x20')],'countnoanswerretry':_0x33c5d4['countnoanswerretry'],'countnosuchnumberretry':_0x33c5d4[_0x98b8('0x21')],'countdropretry':_0x33c5d4[_0x98b8('0x22')],'countabandonedretry':_0x33c5d4['countabandonedretry'],'countmachineretry':_0x33c5d4[_0x98b8('0x26')],'countagentrejectretry':_0x33c5d4[_0x98b8('0x24')],'createdAt':_0x33c5d4[_0x98b8('0x33')],'updatedAt':_0x33c5d4['updatedAt']};return db['sequelize']['transaction'](function(_0x8d18c9){return db['CmHopperAdditionalPhone']['update'](_0x120d39,{'where':{'id':_0x33c5d4['id']}},{'transaction':_0x8d18c9})[_0x98b8('0xd')](function(){return db[_0x98b8('0x18')][_0x98b8('0x35')](_0x1ac5c3,{'where':{'id':_0x2100e7['id']}},{'transaction':_0x8d18c9});});})[_0x98b8('0xd')](function(_0x399c72){_0x2c5f14({'id':_0x2100e7['id'],'phone':_0x33c5d4[_0x98b8('0x32')]});})[_0x98b8('0x16')](function(_0x4c89a7){logger[_0x98b8('0x11')](_0x98b8('0x36'),_0x4c89a7[_0x98b8('0x13')]);_0x331bfe({'error':_0x4c89a7[_0x98b8('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x2a5da2){var _0x1c4901=this;return new Promise(function(_0x3954a1,_0x361c24){return db[_0x98b8('0x18')]['update'](_0x2a5da2[_0x98b8('0x1a')][_0x98b8('0x37')],{'where':{'id':_0x2a5da2[_0x98b8('0x1a')]['id']}})['then'](function(_0x1ac514){_0x3954a1(_0x1ac514);})['catch'](function(_0x131bf5){logger[_0x98b8('0x11')](_0x98b8('0x38'),_0x131bf5[_0x98b8('0x13')]);_0x361c24(_0x1c4901[_0x98b8('0x11')](0x1f4,_0x131bf5[_0x98b8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6d839cf..18eab05 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bb4=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','show','create','isAuthenticated','update','delete','destroy','multer'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3bb4,0x87));var _0x43bb=function(_0x406c3a,_0x2f44f7){_0x406c3a=_0x406c3a-0x0;var _0xf10493=_0x3bb4[_0x406c3a];return _0xf10493;};'use strict';var multer=require(_0x43bb('0x0'));var util=require(_0x43bb('0x1'));var path=require('path');var timeout=require(_0x43bb('0x2'));var express=require(_0x43bb('0x3'));var router=express['Router']();var fs_extra=require(_0x43bb('0x4'));var auth=require(_0x43bb('0x5'));var interaction=require(_0x43bb('0x6'));var config=require(_0x43bb('0x7'));var controller=require(_0x43bb('0x8'));router[_0x43bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43bb('0x9')](_0x43bb('0xa'),auth['isAuthenticated'](),controller[_0x43bb('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43bb('0xc')]);router['put'](_0x43bb('0xa'),auth[_0x43bb('0xd')](),controller[_0x43bb('0xe')]);router[_0x43bb('0xf')](_0x43bb('0xa'),auth[_0x43bb('0xd')](),controller[_0x43bb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3b46=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x325657,_0x1a6c84){var _0x3c83c6=function(_0x5800f3){while(--_0x5800f3){_0x325657['push'](_0x325657['shift']());}};_0x3c83c6(++_0x1a6c84);}(_0x3b46,0x1a2));var _0x63b4=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x3b46[_0x127a60];return _0xc1f6a3;};'use strict';var multer=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var path=require(_0x63b4('0x2'));var timeout=require(_0x63b4('0x3'));var express=require('express');var router=express[_0x63b4('0x4')]();var fs_extra=require(_0x63b4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x63b4('0x6'));var config=require(_0x63b4('0x7'));var controller=require(_0x63b4('0x8'));router[_0x63b4('0x9')]('/',auth[_0x63b4('0xa')](),controller[_0x63b4('0xb')]);router['get']('/:id',auth[_0x63b4('0xa')](),controller['show']);router[_0x63b4('0xc')]('/',auth[_0x63b4('0xa')](),controller[_0x63b4('0xd')]);router[_0x63b4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x63b4('0xf')]);router[_0x63b4('0x10')](_0x63b4('0x11'),auth[_0x63b4('0xa')](),controller[_0x63b4('0x12')]);module[_0x63b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index dfaff2e..40b5c96 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 _0x1da9=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x43ecef,_0x24c5ed){var _0x2bc0a1=function(_0x3b5180){while(--_0x3b5180){_0x43ecef['push'](_0x43ecef['shift']());}};_0x2bc0a1(++_0x24c5ed);}(_0x1da9,0x141));var _0x91da=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1da9[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x91da('0x0'));var Sequelize=require(_0x91da('0x1'));module[_0x91da('0x2')]={'phone':{'type':Sequelize[_0x91da('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x91da('0x4')],'unique':_0x91da('0x5')},'ListId':{'type':Sequelize[_0x91da('0x4')],'unique':_0x91da('0x5')},'VoiceQueueId':{'type':Sequelize[_0x91da('0x4')],'unique':_0x91da('0x5')}}; \ No newline at end of file +var _0x1298=['INTEGER','contactListQueue','sequelize','STRING'];(function(_0x2acb5a,_0x4c4957){var _0x40c7bd=function(_0x1b728d){while(--_0x1b728d){_0x2acb5a['push'](_0x2acb5a['shift']());}};_0x40c7bd(++_0x4c4957);}(_0x1298,0x19e));var _0x8129=function(_0xc5059,_0x2821a2){_0xc5059=_0xc5059-0x0;var _0x5aa505=_0x1298[_0xc5059];return _0x5aa505;};'use strict';var moment=require('moment');var Sequelize=require(_0x8129('0x0'));module['exports']={'phone':{'type':Sequelize[_0x8129('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8129('0x2')],'unique':_0x8129('0x3')},'ListId':{'type':Sequelize[_0x8129('0x2')],'unique':_0x8129('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8129('0x2')],'unique':_0x8129('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 329aa4d..868d620 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 _0xb0eb=['length','options','body','find','describe','rimraf','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','params','keys'];(function(_0x5a7356,_0x59d6d7){var _0x29ec8b=function(_0x4bd9ed){while(--_0x4bd9ed){_0x5a7356['push'](_0x5a7356['shift']());}};_0x29ec8b(++_0x59d6d7);}(_0xb0eb,0x18b));var _0xbb0e=function(_0x5a1cdb,_0x1922d6){_0x5a1cdb=_0x5a1cdb-0x0;var _0x16ec2e=_0xb0eb[_0x5a1cdb];return _0x16ec2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbb0e('0x1'));var util=require(_0xbb0e('0x2'));var path=require(_0xbb0e('0x3'));var sox=require(_0xbb0e('0x4'));var csv=require('to-csv');var ejs=require(_0xbb0e('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbb0e('0x6'));var crypto=require(_0xbb0e('0x7'));var jsforce=require(_0xbb0e('0x8'));var deskjs=require(_0xbb0e('0x9'));var toCsv=require(_0xbb0e('0xa'));var querystring=require('querystring');var Papa=require(_0xbb0e('0xb'));var Redis=require(_0xbb0e('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb0e('0xd'));var logger=require(_0xbb0e('0xe'))(_0xbb0e('0xf'));var utils=require(_0xbb0e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xbb0e('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c90e5,_0x577e03){_0x577e03=_0x577e03||0xcc;return function(_0x1ba0c7){if(_0x1ba0c7){return _0x2c90e5[_0xbb0e('0x12')](_0x577e03);}return _0x2c90e5[_0xbb0e('0x13')](_0x577e03)['end']();};}function respondWithResult(_0x1873d3,_0x30f8ec){_0x30f8ec=_0x30f8ec||0xc8;return function(_0x23c1bb){if(_0x23c1bb){return _0x1873d3['status'](_0x30f8ec)[_0xbb0e('0x14')](_0x23c1bb);}};}function respondWithFilteredResult(_0x3e48b2,_0x3c7696){return function(_0x2e918e){if(_0x2e918e){var _0x5059e1=typeof _0x3c7696['offset']===_0xbb0e('0x15')&&typeof _0x3c7696['limit']===_0xbb0e('0x15');var _0x19ac21=_0x2e918e[_0xbb0e('0x16')];var _0x3981c3=_0x5059e1?0x0:_0x3c7696[_0xbb0e('0x17')];var _0x5b0c70=_0x5059e1?_0x2e918e[_0xbb0e('0x16')]:_0x3c7696[_0xbb0e('0x17')]+_0x3c7696[_0xbb0e('0x18')];var _0x2b787b;if(_0x5b0c70>=_0x19ac21){_0x5b0c70=_0x19ac21;_0x2b787b=0xc8;}else{_0x2b787b=0xce;}_0x3e48b2[_0xbb0e('0x13')](_0x2b787b);return _0x3e48b2[_0xbb0e('0x19')](_0xbb0e('0x1a'),_0x3981c3+'-'+_0x5b0c70+'/'+_0x19ac21)[_0xbb0e('0x14')](_0x2e918e);}return null;};}function patchUpdates(_0x251e74){return function(_0xb398a2){try{jsonpatch['apply'](_0xb398a2,_0x251e74,!![]);}catch(_0x5d564f){return BPromise[_0xbb0e('0x1b')](_0x5d564f);}return _0xb398a2[_0xbb0e('0x1c')]();};}function saveUpdates(_0x1b0f00,_0x1444a9){return function(_0x19b89b){if(_0x19b89b){return _0x19b89b['update'](_0x1b0f00)[_0xbb0e('0x1d')](function(_0x3d1860){return _0x3d1860;});}return null;};}function removeEntity(_0x1329cf,_0x2e44d5){return function(_0x435d8e){if(_0x435d8e){return _0x435d8e[_0xbb0e('0x1e')]()['then'](function(){_0x1329cf['status'](0xcc)[_0xbb0e('0x1f')]();});}};}function handleEntityNotFound(_0x4a99f2,_0x104c73){return function(_0x431d75){if(!_0x431d75){_0x4a99f2['sendStatus'](0x194);}return _0x431d75;};}function handleError(_0x268503,_0x24d80b){_0x24d80b=_0x24d80b||0x1f4;return function(_0x21571f){logger[_0xbb0e('0x20')](_0x21571f[_0xbb0e('0x21')]);if(_0x21571f['name']){delete _0x21571f[_0xbb0e('0x22')];}_0x268503[_0xbb0e('0x13')](_0x24d80b)['send'](_0x21571f);};}exports[_0xbb0e('0x23')]=function(_0x5baca6,_0x29b668){var _0x5a2074={},_0x121f63={},_0x40d3e1={'count':0x0,'rows':[]};var _0x46bb53=_[_0xbb0e('0x24')](db[_0xbb0e('0x25')][_0xbb0e('0x26')],function(_0x24411e){return{'name':_0x24411e[_0xbb0e('0x27')],'type':_0x24411e[_0xbb0e('0x28')][_0xbb0e('0x29')]};});_0x121f63[_0xbb0e('0x2a')]=_['map'](_0x46bb53,_0xbb0e('0x22'));_0x121f63['query']=_['keys'](_0x5baca6['query']);_0x121f63[_0xbb0e('0x2b')]=_[_0xbb0e('0x2c')](_0x121f63[_0xbb0e('0x2a')],_0x121f63[_0xbb0e('0x2d')]);_0x5a2074[_0xbb0e('0x2e')]=_[_0xbb0e('0x2c')](_0x121f63[_0xbb0e('0x2a')],qs[_0xbb0e('0x2f')](_0x5baca6[_0xbb0e('0x2d')][_0xbb0e('0x2f')]));_0x5a2074[_0xbb0e('0x2e')]=_0x5a2074[_0xbb0e('0x2e')]['length']?_0x5a2074[_0xbb0e('0x2e')]:_0x121f63['model'];if(!_0x5baca6['query']['hasOwnProperty'](_0xbb0e('0x30'))){_0x5a2074[_0xbb0e('0x18')]=qs[_0xbb0e('0x18')](_0x5baca6[_0xbb0e('0x2d')]['limit']);_0x5a2074[_0xbb0e('0x17')]=qs['offset'](_0x5baca6[_0xbb0e('0x2d')]['offset']);}_0x5a2074['order']=qs[_0xbb0e('0x31')](_0x5baca6['query'][_0xbb0e('0x31')]);_0x5a2074[_0xbb0e('0x32')]=qs[_0xbb0e('0x2b')](_[_0xbb0e('0x33')](_0x5baca6[_0xbb0e('0x2d')],_0x121f63['filters']),_0x46bb53);if(_0x5baca6[_0xbb0e('0x2d')]['filter']){_0x5a2074[_0xbb0e('0x32')]=_[_0xbb0e('0x34')](_0x5a2074[_0xbb0e('0x32')],{'$or':_[_0xbb0e('0x24')](_0x46bb53,function(_0x7985e){if(_0x7985e[_0xbb0e('0x28')]!==_0xbb0e('0x35')){var _0x5c1247={};_0x5c1247[_0x7985e[_0xbb0e('0x22')]]={'$like':'%'+_0x5baca6[_0xbb0e('0x2d')][_0xbb0e('0x36')]+'%'};return _0x5c1247;}})});}_0x5a2074=_[_0xbb0e('0x34')]({},_0x5a2074,_0x5baca6['options']);var _0x2d6e41={'where':_0x5a2074[_0xbb0e('0x32')]};return db[_0xbb0e('0x25')][_0xbb0e('0x16')](_0x2d6e41)[_0xbb0e('0x1d')](function(_0x9f3dd0){_0x40d3e1[_0xbb0e('0x16')]=_0x9f3dd0;if(_0x5baca6[_0xbb0e('0x2d')][_0xbb0e('0x37')]){_0x5a2074[_0xbb0e('0x38')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5a2074);})[_0xbb0e('0x1d')](function(_0x14c60c){_0x40d3e1['rows']=_0x14c60c;return _0x40d3e1;})['then'](respondWithFilteredResult(_0x29b668,_0x5a2074))[_0xbb0e('0x39')](handleError(_0x29b668,null));};exports['show']=function(_0x1895fd,_0x4e15d0){var _0x142753={'raw':!![],'where':{'id':_0x1895fd[_0xbb0e('0x3a')]['id']}},_0x40cadf={};_0x40cadf[_0xbb0e('0x2a')]=_[_0xbb0e('0x3b')](db[_0xbb0e('0x25')][_0xbb0e('0x26')]);_0x40cadf[_0xbb0e('0x2d')]=_[_0xbb0e('0x3b')](_0x1895fd['query']);_0x40cadf[_0xbb0e('0x2b')]=_[_0xbb0e('0x2c')](_0x40cadf['model'],_0x40cadf[_0xbb0e('0x2d')]);_0x142753[_0xbb0e('0x2e')]=_[_0xbb0e('0x2c')](_0x40cadf[_0xbb0e('0x2a')],qs[_0xbb0e('0x2f')](_0x1895fd[_0xbb0e('0x2d')][_0xbb0e('0x2f')]));_0x142753['attributes']=_0x142753[_0xbb0e('0x2e')][_0xbb0e('0x3c')]?_0x142753[_0xbb0e('0x2e')]:_0x40cadf['model'];if(_0x1895fd['query'][_0xbb0e('0x37')]){_0x142753['include']=[{'all':!![]}];}_0x142753=_[_0xbb0e('0x34')]({},_0x142753,_0x1895fd[_0xbb0e('0x3d')]);return db[_0xbb0e('0x25')]['find'](_0x142753)[_0xbb0e('0x1d')](handleEntityNotFound(_0x4e15d0,null))[_0xbb0e('0x1d')](respondWithResult(_0x4e15d0,null))[_0xbb0e('0x39')](handleError(_0x4e15d0,null));};exports['update']=function(_0x27ad43,_0x58b859){if(_0x27ad43[_0xbb0e('0x3e')]['id']){delete _0x27ad43[_0xbb0e('0x3e')]['id'];}return db[_0xbb0e('0x25')][_0xbb0e('0x3f')]({'where':{'id':_0x27ad43[_0xbb0e('0x3a')]['id']}})[_0xbb0e('0x1d')](handleEntityNotFound(_0x58b859,null))[_0xbb0e('0x1d')](saveUpdates(_0x27ad43[_0xbb0e('0x3e')],null))[_0xbb0e('0x1d')](respondWithResult(_0x58b859,null))[_0xbb0e('0x39')](handleError(_0x58b859,null));};exports[_0xbb0e('0x1e')]=function(_0x41ec65,_0x236b6d){return db[_0xbb0e('0x25')][_0xbb0e('0x3f')]({'where':{'id':_0x41ec65[_0xbb0e('0x3a')]['id']}})[_0xbb0e('0x1d')](handleEntityNotFound(_0x236b6d,null))['then'](removeEntity(_0x236b6d,null))['catch'](handleError(_0x236b6d,null));};exports[_0xbb0e('0x40')]=function(_0x3b8c53,_0x753adb){return db['CmHopperBlack'][_0xbb0e('0x40')]()[_0xbb0e('0x1d')](respondWithResult(_0x753adb,null))['catch'](handleError(_0x753adb,null));}; \ No newline at end of file +var _0xaac2=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','name','send','map','CmHopperBlack','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','body'];(function(_0xfb019d,_0x5d079a){var _0x27373a=function(_0x1ad1f4){while(--_0x1ad1f4){_0xfb019d['push'](_0xfb019d['shift']());}};_0x27373a(++_0x5d079a);}(_0xaac2,0x1eb));var _0x2aac=function(_0x19d7bb,_0x8628b5){_0x19d7bb=_0x19d7bb-0x0;var _0xfd2104=_0xaac2[_0x19d7bb];return _0xfd2104;};'use strict';var emlformat=require(_0x2aac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2aac('0x1'));var jsonpatch=require(_0x2aac('0x2'));var rp=require(_0x2aac('0x3'));var moment=require(_0x2aac('0x4'));var BPromise=require(_0x2aac('0x5'));var Mustache=require(_0x2aac('0x6'));var util=require(_0x2aac('0x7'));var path=require(_0x2aac('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2aac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2aac('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2aac('0xb'));var toCsv=require(_0x2aac('0xc'));var querystring=require(_0x2aac('0xd'));var Papa=require(_0x2aac('0xe'));var Redis=require('ioredis');var authService=require(_0x2aac('0xf'));var qs=require(_0x2aac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2aac('0x11'));var logger=require(_0x2aac('0x12'))(_0x2aac('0x13'));var utils=require(_0x2aac('0x14'));var config=require(_0x2aac('0x15'));var licenseUtil=require(_0x2aac('0x16'));var db=require(_0x2aac('0x17'))['db'];function respondWithStatusCode(_0x1ada60,_0x4c69ff){_0x4c69ff=_0x4c69ff||0xcc;return function(_0xcc85d){if(_0xcc85d){return _0x1ada60['sendStatus'](_0x4c69ff);}return _0x1ada60[_0x2aac('0x18')](_0x4c69ff)[_0x2aac('0x19')]();};}function respondWithResult(_0x2a4958,_0x5c0d3a){_0x5c0d3a=_0x5c0d3a||0xc8;return function(_0x6edb40){if(_0x6edb40){return _0x2a4958[_0x2aac('0x18')](_0x5c0d3a)[_0x2aac('0x1a')](_0x6edb40);}};}function respondWithFilteredResult(_0x1bc998,_0xd35aa7){return function(_0x3b7e4){if(_0x3b7e4){var _0x3f1c95=typeof _0xd35aa7['offset']===_0x2aac('0x1b')&&typeof _0xd35aa7[_0x2aac('0x1c')]===_0x2aac('0x1b');var _0x138f6e=_0x3b7e4[_0x2aac('0x1d')];var _0x4e8be9=_0x3f1c95?0x0:_0xd35aa7[_0x2aac('0x1e')];var _0x2b2bf4=_0x3f1c95?_0x3b7e4['count']:_0xd35aa7['offset']+_0xd35aa7[_0x2aac('0x1c')];var _0x5c1cfc;if(_0x2b2bf4>=_0x138f6e){_0x2b2bf4=_0x138f6e;_0x5c1cfc=0xc8;}else{_0x5c1cfc=0xce;}_0x1bc998[_0x2aac('0x18')](_0x5c1cfc);return _0x1bc998[_0x2aac('0x1f')]('Content-Range',_0x4e8be9+'-'+_0x2b2bf4+'/'+_0x138f6e)[_0x2aac('0x1a')](_0x3b7e4);}return null;};}function patchUpdates(_0x55c112){return function(_0xe99ee){try{jsonpatch[_0x2aac('0x20')](_0xe99ee,_0x55c112,!![]);}catch(_0x5541b7){return BPromise['reject'](_0x5541b7);}return _0xe99ee[_0x2aac('0x21')]();};}function saveUpdates(_0x184632,_0x560237){return function(_0x31fd18){if(_0x31fd18){return _0x31fd18[_0x2aac('0x22')](_0x184632)[_0x2aac('0x23')](function(_0x2ac338){return _0x2ac338;});}return null;};}function removeEntity(_0x57f482,_0x5a9798){return function(_0x213cbe){if(_0x213cbe){return _0x213cbe[_0x2aac('0x24')]()[_0x2aac('0x23')](function(){_0x57f482['status'](0xcc)[_0x2aac('0x19')]();});}};}function handleEntityNotFound(_0xdcc112,_0x102be9){return function(_0x5bf1b3){if(!_0x5bf1b3){_0xdcc112[_0x2aac('0x25')](0x194);}return _0x5bf1b3;};}function handleError(_0x4d12d8,_0xb8d97f){_0xb8d97f=_0xb8d97f||0x1f4;return function(_0x1b9719){logger['error'](_0x1b9719['stack']);if(_0x1b9719[_0x2aac('0x26')]){delete _0x1b9719[_0x2aac('0x26')];}_0x4d12d8[_0x2aac('0x18')](_0xb8d97f)[_0x2aac('0x27')](_0x1b9719);};}exports['index']=function(_0x170c0f,_0x4dfdd4){var _0x4ec1d0={},_0x21f371={},_0x289138={'count':0x0,'rows':[]};var _0x71eb6b=_[_0x2aac('0x28')](db[_0x2aac('0x29')][_0x2aac('0x2a')],function(_0x2f7ee8){return{'name':_0x2f7ee8['fieldName'],'type':_0x2f7ee8[_0x2aac('0x2b')]['key']};});_0x21f371[_0x2aac('0x2c')]=_[_0x2aac('0x28')](_0x71eb6b,_0x2aac('0x26'));_0x21f371[_0x2aac('0x2d')]=_[_0x2aac('0x2e')](_0x170c0f[_0x2aac('0x2d')]);_0x21f371[_0x2aac('0x2f')]=_['intersection'](_0x21f371[_0x2aac('0x2c')],_0x21f371[_0x2aac('0x2d')]);_0x4ec1d0[_0x2aac('0x30')]=_[_0x2aac('0x31')](_0x21f371['model'],qs[_0x2aac('0x32')](_0x170c0f[_0x2aac('0x2d')]['fields']));_0x4ec1d0[_0x2aac('0x30')]=_0x4ec1d0[_0x2aac('0x30')][_0x2aac('0x33')]?_0x4ec1d0['attributes']:_0x21f371[_0x2aac('0x2c')];if(!_0x170c0f['query']['hasOwnProperty'](_0x2aac('0x34'))){_0x4ec1d0['limit']=qs[_0x2aac('0x1c')](_0x170c0f['query']['limit']);_0x4ec1d0[_0x2aac('0x1e')]=qs[_0x2aac('0x1e')](_0x170c0f['query']['offset']);}_0x4ec1d0[_0x2aac('0x35')]=qs[_0x2aac('0x36')](_0x170c0f[_0x2aac('0x2d')][_0x2aac('0x36')]);_0x4ec1d0['where']=qs[_0x2aac('0x2f')](_[_0x2aac('0x37')](_0x170c0f[_0x2aac('0x2d')],_0x21f371[_0x2aac('0x2f')]),_0x71eb6b);if(_0x170c0f['query'][_0x2aac('0x38')]){_0x4ec1d0[_0x2aac('0x39')]=_[_0x2aac('0x3a')](_0x4ec1d0[_0x2aac('0x39')],{'$or':_[_0x2aac('0x28')](_0x71eb6b,function(_0x29fe4d){if(_0x29fe4d[_0x2aac('0x2b')]!==_0x2aac('0x3b')){var _0x28d9a5={};_0x28d9a5[_0x29fe4d[_0x2aac('0x26')]]={'$like':'%'+_0x170c0f[_0x2aac('0x2d')][_0x2aac('0x38')]+'%'};return _0x28d9a5;}})});}_0x4ec1d0=_[_0x2aac('0x3a')]({},_0x4ec1d0,_0x170c0f[_0x2aac('0x3c')]);var _0x44003d={'where':_0x4ec1d0[_0x2aac('0x39')]};return db[_0x2aac('0x29')][_0x2aac('0x1d')](_0x44003d)[_0x2aac('0x23')](function(_0x4d19d2){_0x289138['count']=_0x4d19d2;if(_0x170c0f[_0x2aac('0x2d')][_0x2aac('0x3d')]){_0x4ec1d0['include']=[{'all':!![]}];}return db[_0x2aac('0x29')][_0x2aac('0x3e')](_0x4ec1d0);})[_0x2aac('0x23')](function(_0x567948){_0x289138[_0x2aac('0x3f')]=_0x567948;return _0x289138;})[_0x2aac('0x23')](respondWithFilteredResult(_0x4dfdd4,_0x4ec1d0))[_0x2aac('0x40')](handleError(_0x4dfdd4,null));};exports[_0x2aac('0x41')]=function(_0x42bf7d,_0x3f0a97){var _0xaca181={'raw':!![],'where':{'id':_0x42bf7d[_0x2aac('0x42')]['id']}},_0x1eb26d={};_0x1eb26d[_0x2aac('0x2c')]=_['keys'](db['CmHopperBlack'][_0x2aac('0x2a')]);_0x1eb26d[_0x2aac('0x2d')]=_[_0x2aac('0x2e')](_0x42bf7d['query']);_0x1eb26d[_0x2aac('0x2f')]=_[_0x2aac('0x31')](_0x1eb26d[_0x2aac('0x2c')],_0x1eb26d[_0x2aac('0x2d')]);_0xaca181[_0x2aac('0x30')]=_['intersection'](_0x1eb26d[_0x2aac('0x2c')],qs[_0x2aac('0x32')](_0x42bf7d[_0x2aac('0x2d')][_0x2aac('0x32')]));_0xaca181[_0x2aac('0x30')]=_0xaca181[_0x2aac('0x30')][_0x2aac('0x33')]?_0xaca181[_0x2aac('0x30')]:_0x1eb26d[_0x2aac('0x2c')];if(_0x42bf7d['query'][_0x2aac('0x3d')]){_0xaca181['include']=[{'all':!![]}];}_0xaca181=_['merge']({},_0xaca181,_0x42bf7d[_0x2aac('0x3c')]);return db[_0x2aac('0x29')][_0x2aac('0x43')](_0xaca181)[_0x2aac('0x23')](handleEntityNotFound(_0x3f0a97,null))['then'](respondWithResult(_0x3f0a97,null))['catch'](handleError(_0x3f0a97,null));};exports[_0x2aac('0x22')]=function(_0x25eb7d,_0x1e589b){if(_0x25eb7d[_0x2aac('0x44')]['id']){delete _0x25eb7d[_0x2aac('0x44')]['id'];}return db['CmHopperBlack'][_0x2aac('0x43')]({'where':{'id':_0x25eb7d[_0x2aac('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e589b,null))[_0x2aac('0x23')](saveUpdates(_0x25eb7d[_0x2aac('0x44')],null))[_0x2aac('0x23')](respondWithResult(_0x1e589b,null))[_0x2aac('0x40')](handleError(_0x1e589b,null));};exports[_0x2aac('0x24')]=function(_0x408c4f,_0x1f96df){return db[_0x2aac('0x29')][_0x2aac('0x43')]({'where':{'id':_0x408c4f[_0x2aac('0x42')]['id']}})[_0x2aac('0x23')](handleEntityNotFound(_0x1f96df,null))[_0x2aac('0x23')](removeEntity(_0x1f96df,null))[_0x2aac('0x40')](handleError(_0x1f96df,null));};exports['describe']=function(_0x447da8,_0x52499d){return db['CmHopperBlack'][_0x2aac('0x45')]()[_0x2aac('0x23')](respondWithResult(_0x52499d,null))[_0x2aac('0x40')](handleError(_0x52499d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 0fb0e5b..51278b5 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 _0x668e=['path','rimraf','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x25045,_0x3a98c3){var _0x544884=function(_0x2a25da){while(--_0x2a25da){_0x25045['push'](_0x25045['shift']());}};_0x544884(++_0x3a98c3);}(_0x668e,0x132));var _0xe668=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x668e[_0x44216d];return _0xeca523;};'use strict';var _=require(_0xe668('0x0'));var util=require(_0xe668('0x1'));var logger=require(_0xe668('0x2'))(_0xe668('0x3'));var moment=require('moment');var BPromise=require(_0xe668('0x4'));var rp=require(_0xe668('0x5'));var fs=require('fs');var path=require(_0xe668('0x6'));var rimraf=require(_0xe668('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xe668('0x8')]=function(_0x39ba9d,_0x47f2d1){return _0x39ba9d[_0xe668('0x9')](_0xe668('0xa'),attributes,{'tableName':_0xe668('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74b2=['define','cm_hopper_black','api','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0x74b2,0xb6));var _0x274b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x274b('0x0'));var moment=require('moment');var BPromise=require(_0x274b('0x1'));var rp=require(_0x274b('0x2'));var fs=require('fs');var path=require(_0x274b('0x3'));var rimraf=require('rimraf');var config=require(_0x274b('0x4'));var attributes=require(_0x274b('0x5'));module[_0x274b('0x6')]=function(_0x240448,_0x1cfeeb){return _0x240448[_0x274b('0x7')]('CmHopperBlack',attributes,{'tableName':_0x274b('0x8'),'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 9be6ea2..53df974 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 _0x601b=['CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','then','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3a7077,_0x1f9d15){var _0x3ad27d=function(_0x3e2ece){while(--_0x3e2ece){_0x3a7077['push'](_0x3a7077['shift']());}};_0x3ad27d(++_0x1f9d15);}(_0x601b,0x10f));var _0xb601=function(_0x1ab557,_0x2a2075){_0x1ab557=_0x1ab557-0x0;var _0x4f62dd=_0x601b[_0x1ab557];return _0x4f62dd;};'use strict';var _=require('lodash');var util=require(_0xb601('0x0'));var moment=require(_0xb601('0x1'));var BPromise=require(_0xb601('0x2'));var rs=require(_0xb601('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb601('0x4'));var logger=require(_0xb601('0x5'))(_0xb601('0x6'));var config=require(_0xb601('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb601('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154c6f,_0x543920,_0xa74a69){return new BPromise(function(_0x56e9e7,_0x15a217){return client['request'](_0x154c6f,_0xa74a69)['then'](function(_0x9d0c3e){logger['info'](_0xb601('0x9'),_0x543920,'request\x20sent');logger[_0xb601('0xa')](_0xb601('0xb'),_0x543920,'request\x20sent',JSON[_0xb601('0xc')](_0x9d0c3e));if(_0x9d0c3e['error']){if(_0x9d0c3e['error']['code']===0x1f4){logger[_0xb601('0xd')](_0xb601('0x9'),_0x543920,_0x9d0c3e[_0xb601('0xd')][_0xb601('0xe')]);return _0x15a217(_0x9d0c3e['error'][_0xb601('0xe')]);}logger[_0xb601('0xd')](_0xb601('0x9'),_0x543920,_0x9d0c3e['error'][_0xb601('0xe')]);return _0x56e9e7(_0x9d0c3e['error'][_0xb601('0xe')]);}else{logger[_0xb601('0xf')](_0xb601('0x9'),_0x543920,_0xb601('0x10'));_0x56e9e7(_0x9d0c3e[_0xb601('0x11')]['message']);}})[_0xb601('0x12')](function(_0x932bef){logger[_0xb601('0xd')](_0xb601('0x9'),_0x543920,_0x932bef);_0x15a217(_0x932bef);});});}exports['GetCmHopperBlack']=function(_0x48298d){var _0x11545c=this;return new Promise(function(_0x166878,_0x275cc2){return db[_0xb601('0x13')]['findAll']({'raw':_0x48298d[_0xb601('0x14')]?_0x48298d[_0xb601('0x14')][_0xb601('0x15')]===undefined?!![]:![]:!![],'where':_0x48298d['options']?_0x48298d[_0xb601('0x14')][_0xb601('0x16')]||null:null,'attributes':_0x48298d['options']?_0x48298d[_0xb601('0x14')][_0xb601('0x17')]||null:null,'limit':_0x48298d['options']?_0x48298d[_0xb601('0x14')][_0xb601('0x18')]||null:null,'include':_0x48298d['options']?_0x48298d[_0xb601('0x14')]['include']?_['map'](_0x48298d['options'][_0xb601('0x19')],function(_0x3afdd1){return{'model':db[_0x3afdd1[_0xb601('0x1a')]],'as':_0x3afdd1['as'],'attributes':_0x3afdd1[_0xb601('0x17')],'include':_0x3afdd1[_0xb601('0x19')]?_['map'](_0x3afdd1[_0xb601('0x19')],function(_0x20e744){return{'model':db[_0x20e744[_0xb601('0x1a')]],'as':_0x20e744['as'],'attributes':_0x20e744[_0xb601('0x17')],'include':_0x20e744[_0xb601('0x19')]?_[_0xb601('0x1b')](_0x20e744[_0xb601('0x19')],function(_0x571115){return{'model':db[_0x571115[_0xb601('0x1a')]],'as':_0x571115['as'],'attributes':_0x571115[_0xb601('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb601('0x1c')](function(_0x83863d){logger['info'](_0xb601('0x1d'),_0x48298d);logger[_0xb601('0xa')](_0xb601('0x1d'),_0x48298d,JSON[_0xb601('0xc')](_0x83863d));_0x166878(_0x83863d);})[_0xb601('0x12')](function(_0x24f14f){logger['error'](_0xb601('0x1d'),_0x24f14f['message'],_0x48298d);_0x275cc2(_0x11545c[_0xb601('0xd')](0x1f4,_0x24f14f[_0xb601('0xe')]));});});};exports[_0xb601('0x1e')]=function(_0x1274a5){var _0x3149c1=this;return new Promise(function(_0x180150,_0xaf81e6){return db[_0xb601('0x13')][_0xb601('0x1f')](_0x1274a5[_0xb601('0x20')],{'raw':_0x1274a5['options']?_0x1274a5[_0xb601('0x14')][_0xb601('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1274a5[_0xb601('0x14')]?_0x1274a5[_0xb601('0x14')]['where']||null:null,'attributes':_0x1274a5[_0xb601('0x14')]?_0x1274a5[_0xb601('0x14')][_0xb601('0x17')]||null:null,'limit':_0x1274a5[_0xb601('0x14')]?_0x1274a5[_0xb601('0x14')]['limit']||null:null})[_0xb601('0x1c')](function(_0x37abaf){logger['info'](_0xb601('0x1e'),_0x1274a5);logger[_0xb601('0xa')](_0xb601('0x1e'),_0x1274a5,JSON[_0xb601('0xc')](_0x37abaf));_0x180150(_0x37abaf);})['catch'](function(_0x40751f){logger[_0xb601('0xd')](_0xb601('0x1e'),_0x40751f[_0xb601('0xe')],_0x1274a5);_0xaf81e6(_0x3149c1[_0xb601('0xd')](0x1f4,_0x40751f[_0xb601('0xe')]));});});};exports[_0xb601('0x21')]=function(_0x4c45a6){var _0x1edad4=this;return new Promise(function(_0x474936,_0x20279f){return db[_0xb601('0x13')][_0xb601('0x22')]({'where':_0x4c45a6['options']?_0x4c45a6[_0xb601('0x14')][_0xb601('0x16')]||null:null})[_0xb601('0x1c')](function(_0x489e82){logger[_0xb601('0xf')]('DestroyCmHopperBlack',_0x4c45a6);logger[_0xb601('0xa')](_0xb601('0x21'),_0x4c45a6,JSON[_0xb601('0xc')](_0x489e82));_0x474936(_0x489e82);})[_0xb601('0x12')](function(_0x4bbd97){logger[_0xb601('0xd')]('DestroyCmHopperBlack',_0x4bbd97[_0xb601('0xe')],_0x4c45a6);_0x20279f(_0x1edad4[_0xb601('0xd')](0x1f4,_0x4bbd97[_0xb601('0xe')]));});});}; \ No newline at end of file +var _0xdfb7=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','findAll','options','raw','attributes','include','map','model','UpdateCmHopperBlack','update','body','where','limit','DestroyCmHopperBlack','CmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2579fb,_0x2bd680){var _0x3da8f9=function(_0x5973f3){while(--_0x5973f3){_0x2579fb['push'](_0x2579fb['shift']());}};_0x3da8f9(++_0x2bd680);}(_0xdfb7,0x138));var _0x7dfb=function(_0x235a0e,_0x129b67){_0x235a0e=_0x235a0e-0x0;var _0x18d453=_0xdfb7[_0x235a0e];return _0x18d453;};'use strict';var _=require(_0x7dfb('0x0'));var util=require(_0x7dfb('0x1'));var moment=require(_0x7dfb('0x2'));var BPromise=require(_0x7dfb('0x3'));var rs=require(_0x7dfb('0x4'));var fs=require('fs');var Redis=require(_0x7dfb('0x5'));var db=require(_0x7dfb('0x6'))['db'];var utils=require(_0x7dfb('0x7'));var logger=require(_0x7dfb('0x8'))(_0x7dfb('0x9'));var config=require(_0x7dfb('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7dfb('0xb')][_0x7dfb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42e737,_0x2077e7,_0x19b379){return new BPromise(function(_0x18bcc9,_0x23069c){return client['request'](_0x42e737,_0x19b379)[_0x7dfb('0xd')](function(_0x238354){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2077e7,_0x7dfb('0xe'));logger[_0x7dfb('0xf')](_0x7dfb('0x10'),_0x2077e7,_0x7dfb('0xe'),JSON[_0x7dfb('0x11')](_0x238354));if(_0x238354[_0x7dfb('0x12')]){if(_0x238354[_0x7dfb('0x12')][_0x7dfb('0x13')]===0x1f4){logger[_0x7dfb('0x12')](_0x7dfb('0x14'),_0x2077e7,_0x238354[_0x7dfb('0x12')][_0x7dfb('0x15')]);return _0x23069c(_0x238354[_0x7dfb('0x12')]['message']);}logger['error'](_0x7dfb('0x14'),_0x2077e7,_0x238354[_0x7dfb('0x12')][_0x7dfb('0x15')]);return _0x18bcc9(_0x238354[_0x7dfb('0x12')][_0x7dfb('0x15')]);}else{logger[_0x7dfb('0x16')](_0x7dfb('0x14'),_0x2077e7,_0x7dfb('0xe'));_0x18bcc9(_0x238354['result'][_0x7dfb('0x15')]);}})[_0x7dfb('0x17')](function(_0x89407){logger[_0x7dfb('0x12')](_0x7dfb('0x14'),_0x2077e7,_0x89407);_0x23069c(_0x89407);});});}exports[_0x7dfb('0x18')]=function(_0x3d37e3){var _0x3047fe=this;return new Promise(function(_0x860ff6,_0x27a1af){return db['CmHopperBlack'][_0x7dfb('0x19')]({'raw':_0x3d37e3[_0x7dfb('0x1a')]?_0x3d37e3[_0x7dfb('0x1a')][_0x7dfb('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d37e3[_0x7dfb('0x1a')]?_0x3d37e3[_0x7dfb('0x1a')]['where']||null:null,'attributes':_0x3d37e3[_0x7dfb('0x1a')]?_0x3d37e3[_0x7dfb('0x1a')][_0x7dfb('0x1c')]||null:null,'limit':_0x3d37e3[_0x7dfb('0x1a')]?_0x3d37e3[_0x7dfb('0x1a')]['limit']||null:null,'include':_0x3d37e3[_0x7dfb('0x1a')]?_0x3d37e3[_0x7dfb('0x1a')][_0x7dfb('0x1d')]?_[_0x7dfb('0x1e')](_0x3d37e3[_0x7dfb('0x1a')][_0x7dfb('0x1d')],function(_0x3c18fa){return{'model':db[_0x3c18fa[_0x7dfb('0x1f')]],'as':_0x3c18fa['as'],'attributes':_0x3c18fa[_0x7dfb('0x1c')],'include':_0x3c18fa[_0x7dfb('0x1d')]?_['map'](_0x3c18fa[_0x7dfb('0x1d')],function(_0x1bbd70){return{'model':db[_0x1bbd70[_0x7dfb('0x1f')]],'as':_0x1bbd70['as'],'attributes':_0x1bbd70[_0x7dfb('0x1c')],'include':_0x1bbd70[_0x7dfb('0x1d')]?_[_0x7dfb('0x1e')](_0x1bbd70[_0x7dfb('0x1d')],function(_0x28b4ee){return{'model':db[_0x28b4ee[_0x7dfb('0x1f')]],'as':_0x28b4ee['as'],'attributes':_0x28b4ee[_0x7dfb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7dfb('0xd')](function(_0x4794a4){logger[_0x7dfb('0x16')]('GetCmHopperBlack',_0x3d37e3);logger[_0x7dfb('0xf')](_0x7dfb('0x18'),_0x3d37e3,JSON[_0x7dfb('0x11')](_0x4794a4));_0x860ff6(_0x4794a4);})[_0x7dfb('0x17')](function(_0x12cc19){logger[_0x7dfb('0x12')](_0x7dfb('0x18'),_0x12cc19[_0x7dfb('0x15')],_0x3d37e3);_0x27a1af(_0x3047fe[_0x7dfb('0x12')](0x1f4,_0x12cc19['message']));});});};exports[_0x7dfb('0x20')]=function(_0xa387e6){var _0x20d24c=this;return new Promise(function(_0x1ce9ec,_0x2c55c4){return db['CmHopperBlack'][_0x7dfb('0x21')](_0xa387e6[_0x7dfb('0x22')],{'raw':_0xa387e6[_0x7dfb('0x1a')]?_0xa387e6[_0x7dfb('0x1a')][_0x7dfb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa387e6['options']?_0xa387e6[_0x7dfb('0x1a')][_0x7dfb('0x23')]||null:null,'attributes':_0xa387e6[_0x7dfb('0x1a')]?_0xa387e6[_0x7dfb('0x1a')][_0x7dfb('0x1c')]||null:null,'limit':_0xa387e6[_0x7dfb('0x1a')]?_0xa387e6['options'][_0x7dfb('0x24')]||null:null})[_0x7dfb('0xd')](function(_0xf02078){logger['info'](_0x7dfb('0x20'),_0xa387e6);logger[_0x7dfb('0xf')](_0x7dfb('0x20'),_0xa387e6,JSON['stringify'](_0xf02078));_0x1ce9ec(_0xf02078);})[_0x7dfb('0x17')](function(_0x37a6fe){logger[_0x7dfb('0x12')]('UpdateCmHopperBlack',_0x37a6fe['message'],_0xa387e6);_0x2c55c4(_0x20d24c[_0x7dfb('0x12')](0x1f4,_0x37a6fe[_0x7dfb('0x15')]));});});};exports[_0x7dfb('0x25')]=function(_0x4f5158){var _0x10734b=this;return new Promise(function(_0x4f666b,_0x40108e){return db[_0x7dfb('0x26')][_0x7dfb('0x27')]({'where':_0x4f5158['options']?_0x4f5158[_0x7dfb('0x1a')][_0x7dfb('0x23')]||null:null})['then'](function(_0x183b6b){logger[_0x7dfb('0x16')](_0x7dfb('0x25'),_0x4f5158);logger['debug'](_0x7dfb('0x25'),_0x4f5158,JSON[_0x7dfb('0x11')](_0x183b6b));_0x4f666b(_0x183b6b);})[_0x7dfb('0x17')](function(_0xc128ff){logger['error'](_0x7dfb('0x25'),_0xc128ff[_0x7dfb('0x15')],_0x4f5158);_0x40108e(_0x10734b[_0x7dfb('0x12')](0x1f4,_0xc128ff[_0x7dfb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c241ac2..b30770e 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 _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x2e65cb,_0x5818d7){var _0x3489d6=function(_0x2a3c0c){while(--_0x2a3c0c){_0x2e65cb['push'](_0x2e65cb['shift']());}};_0x3489d6(++_0x5818d7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'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['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router'];(function(_0x5a46ca,_0x3f30a5){var _0x1606db=function(_0x48a0a3){while(--_0x48a0a3){_0x5a46ca['push'](_0x5a46ca['shift']());}};_0x1606db(++_0x3f30a5);}(_0x53ec,0x192));var _0xc53e=function(_0x477aab,_0x4d08fd){_0x477aab=_0x477aab-0x0;var _0x2cd294=_0x53ec[_0x477aab];return _0x2cd294;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9d84ecf..022fb90 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 _0x2fb8=['sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','followuptime','BOOLEAN'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x2fb8,0x190));var _0x82fb=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2fb8[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x82fb('0x0'));var moment=require(_0x82fb('0x1'));module[_0x82fb('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x82fb('0x3')]},'scheduledat':{'type':Sequelize[_0x82fb('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x82fb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x82fb('0x3')]},'originatecalleridname':{'type':Sequelize[_0x82fb('0x3')]},'calleridnum':{'type':Sequelize[_0x82fb('0x3')]},'calleridname':{'type':Sequelize[_0x82fb('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x82fb('0x4')]},'answertime':{'type':Sequelize[_0x82fb('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x82fb('0x3')]},'campaigntype':{'type':Sequelize[_0x82fb('0x3')]},'membername':{'type':Sequelize[_0x82fb('0x3')]},'reason':{'type':Sequelize[_0x82fb('0x3')]},'disposition':{'type':Sequelize[_0x82fb('0x3')]},'secondDisposition':{'type':Sequelize[_0x82fb('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82fb('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x150aa0){var _0x41e45a=this[_0x82fb('0x6')](_0x82fb('0x7'));if(_0x41e45a&&_0x150aa0){this['setDataValue'](_0x82fb('0x8'),moment(_0x150aa0)['diff'](moment(_0x41e45a),'seconds'));}}},'amd':{'type':Sequelize[_0x82fb('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x82fb('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x82fb('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x82fb('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82fb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x82fb('0x4')]},'deleted':{'type':Sequelize[_0x82fb('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x82fb('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x82fb('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x82fb('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4711=['sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x19a19c,_0x30d470){var _0x565c21=function(_0x5315bd){while(--_0x5315bd){_0x19a19c['push'](_0x19a19c['shift']());}};_0x565c21(++_0x30d470);}(_0x4711,0xf0));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1471('0x0'));var moment=require(_0x1471('0x1'));module[_0x1471('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1471('0x3')]},'scheduledat':{'type':Sequelize[_0x1471('0x4')]},'countbusyretry':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1471('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1471('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1471('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1471('0x3')]},'starttime':{'type':Sequelize[_0x1471('0x4')]},'responsetime':{'type':Sequelize[_0x1471('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1471('0x4')]},'endtime':{'type':Sequelize[_0x1471('0x4')]},'ringtime':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1471('0x3')]},'campaign':{'type':Sequelize[_0x1471('0x3')]},'campaigntype':{'type':Sequelize[_0x1471('0x3')]},'membername':{'type':Sequelize[_0x1471('0x3')]},'reason':{'type':Sequelize[_0x1471('0x3')]},'disposition':{'type':Sequelize[_0x1471('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1471('0x3')]},'dispositionat':{'type':Sequelize[_0x1471('0x4')],'set':function(_0x220726){var _0x48d4f3=this[_0x1471('0x6')]('endtime');if(_0x48d4f3&&_0x220726){this[_0x1471('0x7')](_0x1471('0x8'),moment(_0x220726)[_0x1471('0x9')](moment(_0x48d4f3),_0x1471('0xa')));}}},'amd':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1471('0x4')]},'callback':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1471('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1471('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1471('0x4')]},'recallme':{'type':Sequelize[_0x1471('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1471('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1471('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1471('0x5')],'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 f040040..9ddf3e3 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 _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x3779e9,_0x29238e){var _0x313d78=function(_0x1a48e2){while(--_0x1a48e2){_0x3779e9['push'](_0x3779e9['shift']());}};_0x313d78(++_0x29238e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x59eb6d,_0x2655c2){_0x59eb6d=_0x59eb6d-0x0;var _0x4b0c1f=_0xc6ac[_0x59eb6d];return _0x4b0c1f;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':!![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file +var _0xfcf0=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null'];(function(_0x4becb8,_0x4ad3d3){var _0x5c8a37=function(_0x3d52da){while(--_0x3d52da){_0x4becb8['push'](_0x4becb8['shift']());}};_0x5c8a37(++_0x4ad3d3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xfcf0[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')]()[_0x0fcf('0x24')](respondWithResult(_0x345188,null))['catch'](handleError(_0x345188,null));};exports['update']=function(_0x259c91,_0x243699){if(_0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')]){delete _0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')];}return db['CmHopperFinal'][_0x0fcf('0x49')]({'where':{'uniqueid':_0x259c91[_0x0fcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x243699,null))[_0x0fcf('0x24')](saveUpdates(_0x259c91[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x243699,null))[_0x0fcf('0x42')](handleError(_0x243699,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xc514bf,_0x382448,_0x1bb062){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0xc514bf[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x4e')))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')]['literal'](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fcf('0x56')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),'abandonedContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0fcf('0x58')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x59')))),_0x0fcf('0x5a')]]})[_0x0fcf('0x24')](handleEntityNotFound(_0x382448,null))[_0x0fcf('0x24')](respondWithResult(_0x382448,null))[_0x0fcf('0x42')](handleError(_0x382448,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x62d12e,_0x1dda2e,_0x6af0f5){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'CampaignId':_0x62d12e[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x5b')))),_0x0fcf('0x56')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),_0x0fcf('0x5c')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0fcf('0x24')](handleEntityNotFound(_0x1dda2e,null))[_0x0fcf('0x24')](respondWithResult(_0x1dda2e,null))['catch'](handleError(_0x1dda2e,null));};exports[_0x0fcf('0x5d')]=function(_0x3cb75a,_0x5936a6,_0x3d02c1){return db[_0x0fcf('0x5e')][_0x0fcf('0x49')]({'where':{'id':_0x3cb75a[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x5936a6,null))[_0x0fcf('0x24')](function(_0x4704c9){var _0x4b1f10;if(_0x4704c9){_0x4b1f10=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),'ContactId','ListId',_0x0fcf('0x65'),_0x0fcf('0x66'),_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),_0x0fcf('0x63'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x64'))['field']('ANY_VALUE(ContactId)',_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),'ListId')[_0x0fcf('0x6a')](_0x0fcf('0x6e'),_0x0fcf('0x65'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'createdAt')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')]('cm_hopper_final')[_0x0fcf('0x3d')]('VoiceQueueId\x20=\x20?',_0x3cb75a[_0x0fcf('0x43')]['id']['toString']())[_0x0fcf('0x3d')](_0x0fcf('0x70'),_0x3cb75a['body'][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()[_0x0fcf('0x6a')](_0x0fcf('0x75'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]())['where'](_0x0fcf('0x77')))[_0x0fcf('0x78')](_0x0fcf('0x6c')))[_0x0fcf('0x72')]();return db[_0x0fcf('0x4b')][_0x0fcf('0x33')](_0x4b1f10);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x5936a6,null))['catch'](handleError(_0x5936a6,null));};exports[_0x0fcf('0x79')]=function(_0x489c6d,_0x18645d,_0x9e933e){return db[_0x0fcf('0x7a')]['find']({'where':{'id':_0x489c6d['params']['id']}})['then'](handleEntityNotFound(_0x18645d,null))['then'](function(_0x301991){var _0x46bcc2;if(_0x301991){_0x46bcc2=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x6c'),_0x0fcf('0x7b'),_0x0fcf('0x7c'),'createdAt',_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),'phone')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'scheduledAt')['field'](_0x0fcf('0x7d'),_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),_0x0fcf('0x7b'))[_0x0fcf('0x6a')](_0x0fcf('0x7e'),_0x0fcf('0x7c'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x66'))['field'](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))['where'](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x70'),_0x489c6d[_0x0fcf('0x47')][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')](_0x0fcf('0x80'))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()['field']('calleridnum')[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x77')))['group'](_0x0fcf('0x6c')))['toString']();return db[_0x0fcf('0x4b')]['query'](_0x46bcc2);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x18645d,null))['catch'](handleError(_0x18645d,null));};exports['checkContactHopper']=function(_0x426625,_0x4ccae3,_0x2905fa){return db[_0x0fcf('0x81')][_0x0fcf('0x82')]({'where':{'VoiceQueueId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x65')],'CampaignId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x7c')],'ContactId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x6c')]}})[_0x0fcf('0x24')](handleEntityNotFound(_0x4ccae3,null))[_0x0fcf('0x24')](function(_0x274aa9){if(_0x274aa9){return _0x274aa9;}return null;})[_0x0fcf('0x24')](respondWithResult(_0x4ccae3,null))['catch'](handleError(_0x4ccae3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 75f90a3..51a7b79 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 _0x3c8f=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x51b078,_0x483ae3){var _0x1cd28e=function(_0x1a1a75){while(--_0x1a1a75){_0x51b078['push'](_0x51b078['shift']());}};_0x1cd28e(++_0x483ae3);}(_0x3c8f,0xb1));var _0xf3c8=function(_0x44cc08,_0x5edb12){_0x44cc08=_0x44cc08-0x0;var _0x11f441=_0x3c8f[_0x44cc08];return _0x11f441;};'use strict';var _=require(_0xf3c8('0x0'));var util=require(_0xf3c8('0x1'));var logger=require(_0xf3c8('0x2'))(_0xf3c8('0x3'));var moment=require('moment');var BPromise=require(_0xf3c8('0x4'));var rp=require(_0xf3c8('0x5'));var fs=require('fs');var path=require(_0xf3c8('0x6'));var rimraf=require(_0xf3c8('0x7'));var config=require(_0xf3c8('0x8'));var attributes=require(_0xf3c8('0x9'));module[_0xf3c8('0xa')]=function(_0x581e93,_0x324da9){return _0x581e93[_0xf3c8('0xb')](_0xf3c8('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf3c8('0xd'),'fields':['calleridnum']},{'name':_0xf3c8('0xe'),'fields':[_0xf3c8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0542=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','cm_hopper_final','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x0542,0xbd));var _0x2054=function(_0x22c2b3,_0x3f00de){_0x22c2b3=_0x22c2b3-0x0;var _0x639ea0=_0x0542[_0x22c2b3];return _0x639ea0;};'use strict';var _=require('lodash');var util=require(_0x2054('0x0'));var logger=require(_0x2054('0x1'))(_0x2054('0x2'));var moment=require(_0x2054('0x3'));var BPromise=require(_0x2054('0x4'));var rp=require(_0x2054('0x5'));var fs=require('fs');var path=require(_0x2054('0x6'));var rimraf=require(_0x2054('0x7'));var config=require(_0x2054('0x8'));var attributes=require(_0x2054('0x9'));module[_0x2054('0xa')]=function(_0x8046eb,_0x1bcdf0){return _0x8046eb['define']('CmHopperFinal',attributes,{'tableName':_0x2054('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x2054('0xc'),'fields':[_0x2054('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 69a5ef5..7576f12 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x407296,_0x37c17b){var _0x4594ff=function(_0x4a7038){while(--_0x4a7038){_0x407296['push'](_0x407296['shift']());}};_0x4594ff(++_0x37c17b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ecbfd,_0x5bacbc){_0x2ecbfd=_0x2ecbfd-0x0;var _0x2c65a2=_0xb10b[_0x2ecbfd];return _0x2c65a2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xeca2f4,_0x3aeb73){var _0x14b8ab=function(_0x5c9af9){while(--_0x5c9af9){_0xeca2f4['push'](_0xeca2f4['shift']());}};_0x14b8ab(++_0x3aeb73);}(_0x7a54,0x106));var _0x47a5=function(_0x305926,_0x150508){_0x305926=_0x305926-0x0;var _0x5a1893=_0x7a54[_0x305926];return _0x5a1893;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ac81e09..cf7bbcd 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 _0xfa4d=['./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e08c5,_0x265c3f){var _0x248155=function(_0x6cbb02){while(--_0x6cbb02){_0x1e08c5['push'](_0x1e08c5['shift']());}};_0x248155(++_0x265c3f);}(_0xfa4d,0x90));var _0xdfa4=function(_0x3b852e,_0x554866){_0x3b852e=_0x3b852e-0x0;var _0x51ae6f=_0xfa4d[_0x3b852e];return _0x51ae6f;};'use strict';var multer=require(_0xdfa4('0x0'));var util=require(_0xdfa4('0x1'));var path=require('path');var timeout=require(_0xdfa4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdfa4('0x3'));var interaction=require(_0xdfa4('0x4'));var config=require(_0xdfa4('0x5'));var controller=require(_0xdfa4('0x6'));router[_0xdfa4('0x7')]('/',auth[_0xdfa4('0x8')](),controller[_0xdfa4('0x9')]);router[_0xdfa4('0x7')](_0xdfa4('0xa'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0xb')]);router[_0xdfa4('0x7')](_0xdfa4('0xc'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0xd')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xdfa4('0x8')](),controller[_0xdfa4('0xe')]);router['get'](_0xdfa4('0xf'),auth['isAuthenticated'](),controller[_0xdfa4('0x10')]);router[_0xdfa4('0x11')](_0xdfa4('0x12'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0x13')]);router[_0xdfa4('0x11')](_0xdfa4('0x14'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0x15')]);router[_0xdfa4('0x11')](_0xdfa4('0x16'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0x17')]);router['put'](_0xdfa4('0xc'),auth[_0xdfa4('0x8')](),controller[_0xdfa4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x3afb=['/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3afb,0xc1));var _0xb3af=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x3afb[_0x2962b4];return _0x411b7d;};'use strict';var multer=require(_0xb3af('0x0'));var util=require(_0xb3af('0x1'));var path=require(_0xb3af('0x2'));var timeout=require(_0xb3af('0x3'));var express=require(_0xb3af('0x4'));var router=express[_0xb3af('0x5')]();var fs_extra=require(_0xb3af('0x6'));var auth=require(_0xb3af('0x7'));var interaction=require(_0xb3af('0x8'));var config=require(_0xb3af('0x9'));var controller=require('./cmHopperFinal.controller');router[_0xb3af('0xa')]('/',auth[_0xb3af('0xb')](),controller[_0xb3af('0xc')]);router[_0xb3af('0xa')](_0xb3af('0xd'),auth[_0xb3af('0xb')](),controller[_0xb3af('0xe')]);router[_0xb3af('0xa')](_0xb3af('0xf'),auth[_0xb3af('0xb')](),controller[_0xb3af('0x10')]);router['get'](_0xb3af('0x11'),auth[_0xb3af('0xb')](),controller[_0xb3af('0x12')]);router[_0xb3af('0xa')](_0xb3af('0x13'),auth[_0xb3af('0xb')](),controller[_0xb3af('0x14')]);router[_0xb3af('0x15')]('/voice/queue/moveContacts/:id',auth[_0xb3af('0xb')](),controller[_0xb3af('0x16')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xb3af('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xb3af('0x15')](_0xb3af('0x17'),auth[_0xb3af('0xb')](),controller[_0xb3af('0x18')]);router['put'](_0xb3af('0xf'),auth[_0xb3af('0xb')](),controller[_0xb3af('0x19')]);module[_0xb3af('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1ceee3d..fab71a6 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 _0x09a7=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0xea046b,_0xe5834e){var _0x481a80=function(_0x304d8f){while(--_0x304d8f){_0xea046b['push'](_0xea046b['shift']());}};_0x481a80(++_0xe5834e);}(_0x09a7,0x15d));var _0x709a=function(_0x39ea62,_0x2e8e37){_0x39ea62=_0x39ea62-0x0;var _0x394022=_0x09a7[_0x39ea62];return _0x394022;};'use strict';var Sequelize=require(_0x709a('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x709a('0x1')]},'scheduledat':{'type':Sequelize[_0x709a('0x2')]},'countbusyretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x709a('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x709a('0x1')]},'calleridnum':{'type':Sequelize[_0x709a('0x1')]},'calleridname':{'type':Sequelize[_0x709a('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x709a('0x2')]},'answertime':{'type':Sequelize[_0x709a('0x2')]},'droptime':{'type':Sequelize[_0x709a('0x2')]},'endtime':{'type':Sequelize[_0x709a('0x2')]},'ringtime':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x709a('0x1')]},'campaign':{'type':Sequelize[_0x709a('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x709a('0x1')]},'reason':{'type':Sequelize[_0x709a('0x1')]},'amd':{'type':Sequelize[_0x709a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x709a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x709a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x709a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x709a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x709a('0x2')]},'edited':{'type':Sequelize[_0x709a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x709a('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1893=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0xe92a5f,_0x3084b3){var _0x2dbbd7=function(_0x4d1504){while(--_0x4d1504){_0xe92a5f['push'](_0xe92a5f['shift']());}};_0x2dbbd7(++_0x3084b3);}(_0x1893,0xa2));var _0x3189=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x1893[_0x344adc];return _0x4014b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x3189('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x3189('0x1')]},'scheduledat':{'type':Sequelize[_0x3189('0x2')]},'countbusyretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3189('0x1')]},'originatecalleridname':{'type':Sequelize[_0x3189('0x1')]},'calleridnum':{'type':Sequelize[_0x3189('0x1')]},'calleridname':{'type':Sequelize[_0x3189('0x1')]},'starttime':{'type':Sequelize[_0x3189('0x2')]},'responsetime':{'type':Sequelize[_0x3189('0x2')]},'answertime':{'type':Sequelize[_0x3189('0x2')]},'droptime':{'type':Sequelize[_0x3189('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3189('0x1')]},'campaign':{'type':Sequelize[_0x3189('0x1')]},'campaigntype':{'type':Sequelize[_0x3189('0x1')]},'membername':{'type':Sequelize[_0x3189('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x3189('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3189('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3189('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3189('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3189('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3189('0x2')]},'edited':{'type':Sequelize[_0x3189('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3189('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3189('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8357840..8b5bfe5 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 _0xcc52=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','error','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','rows','params','create','body','catch','describe','uniqueid','eml-format','rimraf'];(function(_0x110c83,_0x5c49f2){var _0x32b9fd=function(_0x2aaea1){while(--_0x2aaea1){_0x110c83['push'](_0x110c83['shift']());}};_0x32b9fd(++_0x5c49f2);}(_0xcc52,0x17a));var _0x2cc5=function(_0x2f6724,_0x1035c7){_0x2f6724=_0x2f6724-0x0;var _0x19d85d=_0xcc52[_0x2f6724];return _0x19d85d;};'use strict';var emlformat=require(_0x2cc5('0x0'));var rimraf=require(_0x2cc5('0x1'));var zipdir=require(_0x2cc5('0x2'));var jsonpatch=require(_0x2cc5('0x3'));var rp=require(_0x2cc5('0x4'));var moment=require(_0x2cc5('0x5'));var BPromise=require(_0x2cc5('0x6'));var Mustache=require(_0x2cc5('0x7'));var util=require('util');var path=require(_0x2cc5('0x8'));var sox=require(_0x2cc5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cc5('0xa'));var squel=require(_0x2cc5('0xb'));var crypto=require(_0x2cc5('0xc'));var jsforce=require(_0x2cc5('0xd'));var deskjs=require(_0x2cc5('0xe'));var toCsv=require(_0x2cc5('0xf'));var querystring=require(_0x2cc5('0x10'));var Papa=require(_0x2cc5('0x11'));var Redis=require(_0x2cc5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2cc5('0x13'));var as=require(_0x2cc5('0x14'));var hardwareService=require(_0x2cc5('0x15'));var logger=require(_0x2cc5('0x16'))(_0x2cc5('0x17'));var utils=require('../../config/utils');var config=require(_0x2cc5('0x18'));var licenseUtil=require(_0x2cc5('0x19'));var db=require(_0x2cc5('0x1a'))['db'];function respondWithStatusCode(_0x3ac900,_0x4aac13){_0x4aac13=_0x4aac13||0xcc;return function(_0x5abbfe){if(_0x5abbfe){return _0x3ac900[_0x2cc5('0x1b')](_0x4aac13);}return _0x3ac900[_0x2cc5('0x1c')](_0x4aac13)[_0x2cc5('0x1d')]();};}function respondWithResult(_0x1e350d,_0x2eb987){_0x2eb987=_0x2eb987||0xc8;return function(_0x22e4f1){if(_0x22e4f1){return _0x1e350d[_0x2cc5('0x1c')](_0x2eb987)[_0x2cc5('0x1e')](_0x22e4f1);}};}function respondWithFilteredResult(_0x4be970,_0x11939f){return function(_0x39ab42){if(_0x39ab42){var _0x5677fb=typeof _0x11939f['offset']==='undefined'&&typeof _0x11939f[_0x2cc5('0x1f')]===_0x2cc5('0x20');var _0x4fd0d6=_0x39ab42[_0x2cc5('0x21')];var _0x23bc11=_0x5677fb?0x0:_0x11939f[_0x2cc5('0x22')];var _0x1aead7=_0x5677fb?_0x39ab42[_0x2cc5('0x21')]:_0x11939f[_0x2cc5('0x22')]+_0x11939f[_0x2cc5('0x1f')];var _0x3b5bca;if(_0x1aead7>=_0x4fd0d6){_0x1aead7=_0x4fd0d6;_0x3b5bca=0xc8;}else{_0x3b5bca=0xce;}_0x4be970['status'](_0x3b5bca);return _0x4be970['set']('Content-Range',_0x23bc11+'-'+_0x1aead7+'/'+_0x4fd0d6)['json'](_0x39ab42);}return null;};}function patchUpdates(_0x3314cc){return function(_0x44a265){try{jsonpatch[_0x2cc5('0x23')](_0x44a265,_0x3314cc,!![]);}catch(_0x58b4d3){return BPromise[_0x2cc5('0x24')](_0x58b4d3);}return _0x44a265[_0x2cc5('0x25')]();};}function saveUpdates(_0x50b769,_0x1ce9fc){return function(_0x568f6e){if(_0x568f6e){return _0x568f6e[_0x2cc5('0x26')](_0x50b769)[_0x2cc5('0x27')](function(_0x2dac26){return _0x2dac26;});}return null;};}function removeEntity(_0x15b421,_0x19d574){return function(_0x32b690){if(_0x32b690){return _0x32b690['destroy']()['then'](function(){_0x15b421[_0x2cc5('0x1c')](0xcc)[_0x2cc5('0x1d')]();});}};}function handleEntityNotFound(_0x59a0a4,_0x573248){return function(_0x37b466){if(!_0x37b466){_0x59a0a4['sendStatus'](0x194);}return _0x37b466;};}function handleError(_0x245885,_0x328468){_0x328468=_0x328468||0x1f4;return function(_0x2512bb){logger[_0x2cc5('0x28')](_0x2512bb['stack']);if(_0x2512bb['name']){delete _0x2512bb['name'];}_0x245885['status'](_0x328468)[_0x2cc5('0x29')](_0x2512bb);};}exports[_0x2cc5('0x2a')]=function(_0x43459b,_0x3c510d){var _0x147b28={},_0xb7a692={},_0x308027={'count':0x0,'rows':[]};var _0x9c8456=_[_0x2cc5('0x2b')](db['CmHopperHistory'][_0x2cc5('0x2c')],function(_0x2ae787){return{'name':_0x2ae787[_0x2cc5('0x2d')],'type':_0x2ae787[_0x2cc5('0x2e')][_0x2cc5('0x2f')]};});_0xb7a692[_0x2cc5('0x30')]=_['map'](_0x9c8456,_0x2cc5('0x31'));_0xb7a692['query']=_[_0x2cc5('0x32')](_0x43459b[_0x2cc5('0x33')]);_0xb7a692[_0x2cc5('0x34')]=_[_0x2cc5('0x35')](_0xb7a692[_0x2cc5('0x30')],_0xb7a692[_0x2cc5('0x33')]);_0x147b28[_0x2cc5('0x36')]=_[_0x2cc5('0x35')](_0xb7a692['model'],qs[_0x2cc5('0x37')](_0x43459b[_0x2cc5('0x33')][_0x2cc5('0x37')]));_0x147b28['attributes']=_0x147b28['attributes'][_0x2cc5('0x38')]?_0x147b28[_0x2cc5('0x36')]:_0xb7a692['model'];if(!_0x43459b[_0x2cc5('0x33')][_0x2cc5('0x39')](_0x2cc5('0x3a'))){_0x147b28['limit']=qs[_0x2cc5('0x1f')](_0x43459b['query'][_0x2cc5('0x1f')]);_0x147b28['offset']=qs[_0x2cc5('0x22')](_0x43459b[_0x2cc5('0x33')]['offset']);}_0x147b28['order']=qs[_0x2cc5('0x3b')](_0x43459b[_0x2cc5('0x33')][_0x2cc5('0x3b')]);_0x147b28[_0x2cc5('0x3c')]=qs[_0x2cc5('0x34')](_[_0x2cc5('0x3d')](_0x43459b[_0x2cc5('0x33')],_0xb7a692[_0x2cc5('0x34')]),_0x9c8456);if(_0x43459b[_0x2cc5('0x33')][_0x2cc5('0x3e')]){_0x147b28[_0x2cc5('0x3c')]=_[_0x2cc5('0x3f')](_0x147b28[_0x2cc5('0x3c')],{'$or':_['map'](_0x9c8456,function(_0x378d02){if(_0x378d02[_0x2cc5('0x2e')]!==_0x2cc5('0x40')){var _0x888591={};_0x888591[_0x378d02[_0x2cc5('0x31')]]={'$like':'%'+_0x43459b[_0x2cc5('0x33')][_0x2cc5('0x3e')]+'%'};return _0x888591;}})});}_0x147b28=_['merge']({},_0x147b28,_0x43459b[_0x2cc5('0x41')]);var _0x5ddd80={'where':_0x147b28[_0x2cc5('0x3c')]};return db[_0x2cc5('0x42')][_0x2cc5('0x21')](_0x5ddd80)['then'](function(_0x4117c5){_0x308027[_0x2cc5('0x21')]=_0x4117c5;if(_0x43459b['query'][_0x2cc5('0x43')]){_0x147b28[_0x2cc5('0x44')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x147b28);})[_0x2cc5('0x27')](function(_0x1bb795){_0x308027[_0x2cc5('0x45')]=_0x1bb795;return _0x308027;})['then'](respondWithFilteredResult(_0x3c510d,_0x147b28))['catch'](handleError(_0x3c510d,null));};exports['show']=function(_0x341ba4,_0x52255b){var _0x10fab2={'raw':!![],'where':{'id':_0x341ba4[_0x2cc5('0x46')]['id']}},_0x31a475={};_0x31a475[_0x2cc5('0x30')]=_[_0x2cc5('0x32')](db[_0x2cc5('0x42')][_0x2cc5('0x2c')]);_0x31a475['query']=_[_0x2cc5('0x32')](_0x341ba4['query']);_0x31a475[_0x2cc5('0x34')]=_[_0x2cc5('0x35')](_0x31a475[_0x2cc5('0x30')],_0x31a475[_0x2cc5('0x33')]);_0x10fab2['attributes']=_[_0x2cc5('0x35')](_0x31a475[_0x2cc5('0x30')],qs[_0x2cc5('0x37')](_0x341ba4[_0x2cc5('0x33')]['fields']));_0x10fab2[_0x2cc5('0x36')]=_0x10fab2[_0x2cc5('0x36')][_0x2cc5('0x38')]?_0x10fab2[_0x2cc5('0x36')]:_0x31a475[_0x2cc5('0x30')];if(_0x341ba4[_0x2cc5('0x33')]['includeAll']){_0x10fab2[_0x2cc5('0x44')]=[{'all':!![]}];}_0x10fab2=_[_0x2cc5('0x3f')]({},_0x10fab2,_0x341ba4[_0x2cc5('0x41')]);return db[_0x2cc5('0x42')]['find'](_0x10fab2)[_0x2cc5('0x27')](handleEntityNotFound(_0x52255b,null))['then'](respondWithResult(_0x52255b,null))['catch'](handleError(_0x52255b,null));};exports['create']=function(_0xd006f1,_0x15b880){return db[_0x2cc5('0x42')][_0x2cc5('0x47')](_0xd006f1[_0x2cc5('0x48')],{})[_0x2cc5('0x27')](respondWithResult(_0x15b880,0xc9))[_0x2cc5('0x49')](handleError(_0x15b880,null));};exports[_0x2cc5('0x4a')]=function(_0x3cd7aa,_0x3e18af){return db[_0x2cc5('0x42')][_0x2cc5('0x4a')]()[_0x2cc5('0x27')](respondWithResult(_0x3e18af,null))['catch'](handleError(_0x3e18af,null));};exports[_0x2cc5('0x26')]=function(_0x4eb549,_0x3a8dca){if(_0x4eb549[_0x2cc5('0x48')][_0x2cc5('0x4b')]){delete _0x4eb549[_0x2cc5('0x48')][_0x2cc5('0x4b')];}return db[_0x2cc5('0x42')]['find']({'where':{'uniqueid':_0x4eb549[_0x2cc5('0x46')]['id']}})[_0x2cc5('0x27')](handleEntityNotFound(_0x3a8dca,null))[_0x2cc5('0x27')](saveUpdates(_0x4eb549[_0x2cc5('0x48')],null))[_0x2cc5('0x27')](respondWithResult(_0x3a8dca,null))[_0x2cc5('0x49')](handleError(_0x3a8dca,null));}; \ No newline at end of file +var _0x081a=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x4fa32d,_0x4782b5){var _0x3f7311=function(_0x23cab8){while(--_0x23cab8){_0x4fa32d['push'](_0x4fa32d['shift']());}};_0x3f7311(++_0x4782b5);}(_0x081a,0x1bb));var _0xa081=function(_0x5f0225,_0x52631a){_0x5f0225=_0x5f0225-0x0;var _0x2cef4b=_0x081a[_0x5f0225];return _0x2cef4b;};'use strict';var emlformat=require(_0xa081('0x0'));var rimraf=require(_0xa081('0x1'));var zipdir=require(_0xa081('0x2'));var jsonpatch=require(_0xa081('0x3'));var rp=require('request-promise');var moment=require(_0xa081('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa081('0x5'));var util=require(_0xa081('0x6'));var path=require('path');var sox=require(_0xa081('0x7'));var csv=require(_0xa081('0x8'));var ejs=require(_0xa081('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa081('0xa'));var squel=require(_0xa081('0xb'));var crypto=require(_0xa081('0xc'));var jsforce=require(_0xa081('0xd'));var deskjs=require(_0xa081('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa081('0xf'));var Redis=require(_0xa081('0x10'));var authService=require(_0xa081('0x11'));var qs=require(_0xa081('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa081('0x13'))(_0xa081('0x14'));var utils=require('../../config/utils');var config=require(_0xa081('0x15'));var licenseUtil=require(_0xa081('0x16'));var db=require(_0xa081('0x17'))['db'];function respondWithStatusCode(_0xa43b70,_0x3cdedd){_0x3cdedd=_0x3cdedd||0xcc;return function(_0x501ef4){if(_0x501ef4){return _0xa43b70['sendStatus'](_0x3cdedd);}return _0xa43b70[_0xa081('0x18')](_0x3cdedd)[_0xa081('0x19')]();};}function respondWithResult(_0x3960a8,_0x1c9caa){_0x1c9caa=_0x1c9caa||0xc8;return function(_0x44a8de){if(_0x44a8de){return _0x3960a8[_0xa081('0x18')](_0x1c9caa)['json'](_0x44a8de);}};}function respondWithFilteredResult(_0x42f3c4,_0x3970c0){return function(_0x4ba6c9){if(_0x4ba6c9){var _0x2dedd3=typeof _0x3970c0[_0xa081('0x1a')]==='undefined'&&typeof _0x3970c0[_0xa081('0x1b')]===_0xa081('0x1c');var _0x273bcb=_0x4ba6c9[_0xa081('0x1d')];var _0x21a91a=_0x2dedd3?0x0:_0x3970c0[_0xa081('0x1a')];var _0x4b9936=_0x2dedd3?_0x4ba6c9['count']:_0x3970c0[_0xa081('0x1a')]+_0x3970c0[_0xa081('0x1b')];var _0xe2c303;if(_0x4b9936>=_0x273bcb){_0x4b9936=_0x273bcb;_0xe2c303=0xc8;}else{_0xe2c303=0xce;}_0x42f3c4[_0xa081('0x18')](_0xe2c303);return _0x42f3c4[_0xa081('0x1e')](_0xa081('0x1f'),_0x21a91a+'-'+_0x4b9936+'/'+_0x273bcb)['json'](_0x4ba6c9);}return null;};}function patchUpdates(_0xd60abf){return function(_0x5b1d4b){try{jsonpatch['apply'](_0x5b1d4b,_0xd60abf,!![]);}catch(_0xa61526){return BPromise[_0xa081('0x20')](_0xa61526);}return _0x5b1d4b[_0xa081('0x21')]();};}function saveUpdates(_0x1bca59,_0x1931bd){return function(_0x238a99){if(_0x238a99){return _0x238a99[_0xa081('0x22')](_0x1bca59)['then'](function(_0x2c966c){return _0x2c966c;});}return null;};}function removeEntity(_0xf33f9a,_0xc1471d){return function(_0x56949d){if(_0x56949d){return _0x56949d[_0xa081('0x23')]()[_0xa081('0x24')](function(){_0xf33f9a['status'](0xcc)[_0xa081('0x19')]();});}};}function handleEntityNotFound(_0xe18403,_0x1713d6){return function(_0x32ea6f){if(!_0x32ea6f){_0xe18403['sendStatus'](0x194);}return _0x32ea6f;};}function handleError(_0x5453af,_0xae7d9f){_0xae7d9f=_0xae7d9f||0x1f4;return function(_0xfc94e8){logger[_0xa081('0x25')](_0xfc94e8[_0xa081('0x26')]);if(_0xfc94e8[_0xa081('0x27')]){delete _0xfc94e8[_0xa081('0x27')];}_0x5453af[_0xa081('0x18')](_0xae7d9f)[_0xa081('0x28')](_0xfc94e8);};}exports[_0xa081('0x29')]=function(_0x18824b,_0x5eacb2){var _0x459343={},_0x69605d={},_0x1f8672={'count':0x0,'rows':[]};var _0x5b9aed=_[_0xa081('0x2a')](db['CmHopperHistory'][_0xa081('0x2b')],function(_0x1b5bd0){return{'name':_0x1b5bd0[_0xa081('0x2c')],'type':_0x1b5bd0['type'][_0xa081('0x2d')]};});_0x69605d['model']=_[_0xa081('0x2a')](_0x5b9aed,'name');_0x69605d['query']=_[_0xa081('0x2e')](_0x18824b[_0xa081('0x2f')]);_0x69605d['filters']=_[_0xa081('0x30')](_0x69605d['model'],_0x69605d[_0xa081('0x2f')]);_0x459343[_0xa081('0x31')]=_[_0xa081('0x30')](_0x69605d[_0xa081('0x32')],qs['fields'](_0x18824b['query']['fields']));_0x459343[_0xa081('0x31')]=_0x459343[_0xa081('0x31')][_0xa081('0x33')]?_0x459343[_0xa081('0x31')]:_0x69605d['model'];if(!_0x18824b[_0xa081('0x2f')][_0xa081('0x34')](_0xa081('0x35'))){_0x459343['limit']=qs[_0xa081('0x1b')](_0x18824b[_0xa081('0x2f')][_0xa081('0x1b')]);_0x459343[_0xa081('0x1a')]=qs[_0xa081('0x1a')](_0x18824b[_0xa081('0x2f')][_0xa081('0x1a')]);}_0x459343[_0xa081('0x36')]=qs[_0xa081('0x37')](_0x18824b['query'][_0xa081('0x37')]);_0x459343[_0xa081('0x38')]=qs[_0xa081('0x39')](_['pick'](_0x18824b[_0xa081('0x2f')],_0x69605d[_0xa081('0x39')]),_0x5b9aed);if(_0x18824b['query'][_0xa081('0x3a')]){_0x459343[_0xa081('0x38')]=_[_0xa081('0x3b')](_0x459343[_0xa081('0x38')],{'$or':_[_0xa081('0x2a')](_0x5b9aed,function(_0x5728e3){if(_0x5728e3[_0xa081('0x3c')]!=='VIRTUAL'){var _0x531e7c={};_0x531e7c[_0x5728e3[_0xa081('0x27')]]={'$like':'%'+_0x18824b[_0xa081('0x2f')][_0xa081('0x3a')]+'%'};return _0x531e7c;}})});}_0x459343=_[_0xa081('0x3b')]({},_0x459343,_0x18824b['options']);var _0x1ecaf4={'where':_0x459343[_0xa081('0x38')]};return db[_0xa081('0x3d')]['count'](_0x1ecaf4)[_0xa081('0x24')](function(_0x7710da){_0x1f8672[_0xa081('0x1d')]=_0x7710da;if(_0x18824b[_0xa081('0x2f')][_0xa081('0x3e')]){_0x459343[_0xa081('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xa081('0x40')](_0x459343);})[_0xa081('0x24')](function(_0x2bb167){_0x1f8672[_0xa081('0x41')]=_0x2bb167;return _0x1f8672;})[_0xa081('0x24')](respondWithFilteredResult(_0x5eacb2,_0x459343))[_0xa081('0x42')](handleError(_0x5eacb2,null));};exports[_0xa081('0x43')]=function(_0x3f657c,_0x3b9b2b){var _0x5925cb={'raw':!![],'where':{'id':_0x3f657c[_0xa081('0x44')]['id']}},_0x1b32cb={};_0x1b32cb[_0xa081('0x32')]=_[_0xa081('0x2e')](db[_0xa081('0x3d')][_0xa081('0x2b')]);_0x1b32cb['query']=_[_0xa081('0x2e')](_0x3f657c[_0xa081('0x2f')]);_0x1b32cb[_0xa081('0x39')]=_[_0xa081('0x30')](_0x1b32cb[_0xa081('0x32')],_0x1b32cb['query']);_0x5925cb[_0xa081('0x31')]=_[_0xa081('0x30')](_0x1b32cb['model'],qs[_0xa081('0x45')](_0x3f657c['query'][_0xa081('0x45')]));_0x5925cb[_0xa081('0x31')]=_0x5925cb[_0xa081('0x31')]['length']?_0x5925cb[_0xa081('0x31')]:_0x1b32cb['model'];if(_0x3f657c[_0xa081('0x2f')][_0xa081('0x3e')]){_0x5925cb[_0xa081('0x3f')]=[{'all':!![]}];}_0x5925cb=_[_0xa081('0x3b')]({},_0x5925cb,_0x3f657c[_0xa081('0x46')]);return db[_0xa081('0x3d')][_0xa081('0x47')](_0x5925cb)['then'](handleEntityNotFound(_0x3b9b2b,null))[_0xa081('0x24')](respondWithResult(_0x3b9b2b,null))[_0xa081('0x42')](handleError(_0x3b9b2b,null));};exports[_0xa081('0x48')]=function(_0x3cecc4,_0x7415bc){return db[_0xa081('0x3d')]['create'](_0x3cecc4[_0xa081('0x49')],{})['then'](respondWithResult(_0x7415bc,0xc9))['catch'](handleError(_0x7415bc,null));};exports[_0xa081('0x4a')]=function(_0x386635,_0x4f2f45){return db['CmHopperHistory'][_0xa081('0x4a')]()[_0xa081('0x24')](respondWithResult(_0x4f2f45,null))[_0xa081('0x42')](handleError(_0x4f2f45,null));};exports[_0xa081('0x22')]=function(_0x17dfde,_0x5bc122){if(_0x17dfde[_0xa081('0x49')][_0xa081('0x4b')]){delete _0x17dfde['body'][_0xa081('0x4b')];}return db[_0xa081('0x3d')][_0xa081('0x47')]({'where':{'uniqueid':_0x17dfde[_0xa081('0x44')]['id']}})[_0xa081('0x24')](handleEntityNotFound(_0x5bc122,null))[_0xa081('0x24')](saveUpdates(_0x17dfde[_0xa081('0x49')],null))[_0xa081('0x24')](respondWithResult(_0x5bc122,null))['catch'](handleError(_0x5bc122,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8cd44b9..2e4a1fe 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 _0x2272=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x2227('0x8')]=function(_0x3b8661,_0xb33647){return _0x3b8661[_0x2227('0x9')](_0x2227('0xa'),attributes,{'tableName':_0x2227('0xb'),'paranoid':![],'indexes':[{'name':_0x2227('0xc'),'fields':[_0x2227('0xc')]},{'name':_0x2227('0xd'),'fields':[_0x2227('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0xe8554f,_0x4d11de){var _0x45c795=function(_0x30cb99){while(--_0x30cb99){_0xe8554f['push'](_0xe8554f['shift']());}};_0x45c795(++_0x4d11de);}(_0x583c,0x12b));var _0xc583=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x583c[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc583('0xa'),'fields':[_0xc583('0xa')]},{'name':'uniqueid','fields':[_0xc583('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 39eb109..56c026a 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 _0x4a5a=['then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','findAll','predictiveIntervalTotalCalls','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e520d,_0x26c538){var _0x553d34=function(_0x50c3ca){while(--_0x50c3ca){_0x2e520d['push'](_0x2e520d['shift']());}};_0x553d34(++_0x26c538);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x221640,_0x15f0be){_0x221640=_0x221640-0x0;var _0x41a7f3=_0x4a5a[_0x221640];return _0x41a7f3;};'use strict';var _=require(_0xa4a5('0x0'));var util=require('util');var moment=require(_0xa4a5('0x1'));var BPromise=require(_0xa4a5('0x2'));var rs=require(_0xa4a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4a5('0x4'))['db'];var utils=require(_0xa4a5('0x5'));var logger=require(_0xa4a5('0x6'))(_0xa4a5('0x7'));var config=require(_0xa4a5('0x8'));var jayson=require(_0xa4a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a5a2b,_0x4a3df4,_0xb24c42){return new BPromise(function(_0x161489,_0x1e4550){return client['request'](_0x3a5a2b,_0xb24c42)[_0xa4a5('0xa')](function(_0x4eb5ad){logger[_0xa4a5('0xb')](_0xa4a5('0xc'),_0x4a3df4,_0xa4a5('0xd'));logger[_0xa4a5('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4a3df4,'request\x20sent',JSON[_0xa4a5('0xf')](_0x4eb5ad));if(_0x4eb5ad[_0xa4a5('0x10')]){if(_0x4eb5ad['error']['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4a3df4,_0x4eb5ad['error'][_0xa4a5('0x11')]);return _0x1e4550(_0x4eb5ad[_0xa4a5('0x10')][_0xa4a5('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4a3df4,_0x4eb5ad['error']['message']);return _0x161489(_0x4eb5ad[_0xa4a5('0x10')][_0xa4a5('0x11')]);}else{logger[_0xa4a5('0xb')](_0xa4a5('0xc'),_0x4a3df4,'request\x20sent');_0x161489(_0x4eb5ad[_0xa4a5('0x12')][_0xa4a5('0x11')]);}})[_0xa4a5('0x13')](function(_0x32d781){logger[_0xa4a5('0x10')](_0xa4a5('0xc'),_0x4a3df4,_0x32d781);_0x1e4550(_0x32d781);});});}exports[_0xa4a5('0x14')]=function(_0x3251a5){var _0x205c22=this;return new Promise(function(_0x1549fb,_0x5f1bad){return db[_0xa4a5('0x15')]['create'](_0x3251a5[_0xa4a5('0x16')],{'raw':_0x3251a5[_0xa4a5('0x17')]?_0x3251a5[_0xa4a5('0x17')][_0xa4a5('0x18')]===undefined?!![]:![]:!![]})[_0xa4a5('0xa')](function(_0x4e9f7f){logger[_0xa4a5('0xb')]('CreateCmHopperHistory',_0x3251a5);logger['debug'](_0xa4a5('0x14'),_0x3251a5,JSON[_0xa4a5('0xf')](_0x4e9f7f));_0x1549fb(_0x4e9f7f);})[_0xa4a5('0x13')](function(_0x212dc2){logger[_0xa4a5('0x10')](_0xa4a5('0x14'),_0x212dc2[_0xa4a5('0x11')],_0x3251a5);_0x5f1bad(_0x205c22[_0xa4a5('0x10')](0x1f4,_0x212dc2['message']));});});};exports[_0xa4a5('0x19')]=function(_0x18b4ee){var _0x33e053=this;return new Promise(function(_0x1137bc,_0x250000){return db[_0xa4a5('0x15')][_0xa4a5('0x1a')]({'raw':_0x18b4ee[_0xa4a5('0x17')]?_0x18b4ee['options'][_0xa4a5('0x18')]===undefined?!![]:![]:!![],'where':_0x18b4ee[_0xa4a5('0x17')]?_0x18b4ee[_0xa4a5('0x17')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['col']('id')),_0xa4a5('0x1b')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')]['literal'](_0xa4a5('0x1e')))),_0xa4a5('0x1f')],[db['sequelize']['fn']('COUNT',db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0xa4a5('0x21')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0xa4a5('0x22')],[db[_0xa4a5('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0xa4a5('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x23'),db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')]['literal'](_0xa4a5('0x24')))),_0xa4a5('0x25')]]})[_0xa4a5('0xa')](function(_0x120669){logger[_0xa4a5('0xb')]('AvgHandleTime',_0x18b4ee);logger[_0xa4a5('0xe')](_0xa4a5('0x19'),_0x18b4ee,JSON[_0xa4a5('0xf')](_0x120669));_0x1137bc(_0x120669);})[_0xa4a5('0x13')](function(_0x4cbf60){logger['error'](_0xa4a5('0x19'),_0x4cbf60['message'],_0x18b4ee);_0x250000(_0x33e053['error'](0x1f4,_0x4cbf60[_0xa4a5('0x11')]));});});};exports[_0xa4a5('0x26')]=function(_0x19484d){var _0x31888a=this;return new Promise(function(_0x573c40,_0xa75dd3){return db['CmHopperHistory']['findAll']({'raw':_0x19484d[_0xa4a5('0x17')]?_0x19484d[_0xa4a5('0x17')][_0xa4a5('0x18')]===undefined?!![]:![]:!![],'where':_0x19484d[_0xa4a5('0x17')]?_0x19484d[_0xa4a5('0x17')][_0xa4a5('0x27')]||null:null,'attributes':[['campaign',_0xa4a5('0x28')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db['sequelize'][_0xa4a5('0x20')](_0xa4a5('0x29')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xa4a5('0x1d'),db['sequelize']['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')](_0xa4a5('0x2a')))),'outboundNoAnswerCallsDay'],[db[_0xa4a5('0x1c')]['fn']('COUNT',db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')](_0xa4a5('0x1e')))),_0xa4a5('0x2b')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db['sequelize'][_0xa4a5('0x20')](_0xa4a5('0x2c')))),_0xa4a5('0x2d')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0xa4a5('0x2e')],[db['sequelize']['fn']('COUNT',db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')]['literal'](_0xa4a5('0x2f')))),'outboundDropCallsDayTimeout'],[db[_0xa4a5('0x1c')]['fn']('COUNT',db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')](_0xa4a5('0x30')))),'outboundDropCallsDayCallersExit'],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')](_0xa4a5('0x31')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xa4a5('0x32')))),_0xa4a5('0x33')],[db['sequelize']['fn']('COUNT',db[_0xa4a5('0x1c')]['fn']('IF',db['sequelize'][_0xa4a5('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0xa4a5('0x34')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xa4a5('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa4a5('0x35')],[db[_0xa4a5('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa4a5('0x36')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')](_0xa4a5('0x37')))),_0xa4a5('0x35')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db[_0xa4a5('0x1c')][_0xa4a5('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0xa4a5('0x38')]})[_0xa4a5('0xa')](function(_0x1664c8){logger[_0xa4a5('0xb')](_0xa4a5('0x26'),_0x19484d);logger[_0xa4a5('0xe')]('GetVoiceQueueHopperHistory',_0x19484d,JSON['stringify'](_0x1664c8));_0x573c40(_0x1664c8);})[_0xa4a5('0x13')](function(_0x834211){logger['error'](_0xa4a5('0x26'),_0x834211['message'],_0x19484d);_0xa75dd3(_0x31888a[_0xa4a5('0x10')](0x1f4,_0x834211[_0xa4a5('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x27b93a){var _0x58ab31=this;return new Promise(function(_0x1c92bc,_0x57052e){return db['CmHopperHistory'][_0xa4a5('0x1a')]({'raw':_0x27b93a['options']?_0x27b93a[_0xa4a5('0x17')][_0xa4a5('0x18')]===undefined?!![]:![]:!![],'where':_0x27b93a['options']?_0x27b93a[_0xa4a5('0x17')][_0xa4a5('0x27')]||null:null,'attributes':[['campaign','name'],[db[_0xa4a5('0x1c')]['fn']('COUNT',db[_0xa4a5('0x1c')]['col']('id')),_0xa4a5('0x39')],[db[_0xa4a5('0x1c')]['fn'](_0xa4a5('0x1d'),db[_0xa4a5('0x1c')]['fn']('IF',db['sequelize'][_0xa4a5('0x20')](_0xa4a5('0x1e')))),_0xa4a5('0x3a')]],'group':[_0xa4a5('0x38')]})[_0xa4a5('0xa')](function(_0x160151){logger[_0xa4a5('0xb')]('GetCampaignHopperHistory',_0x27b93a);logger[_0xa4a5('0xe')](_0xa4a5('0x3b'),_0x27b93a,JSON[_0xa4a5('0xf')](_0x160151));_0x1c92bc(_0x160151);})[_0xa4a5('0x13')](function(_0xb23c60){logger['error'](_0xa4a5('0x3b'),_0xb23c60[_0xa4a5('0x11')],_0x27b93a);_0x57052e(_0x58ab31[_0xa4a5('0x10')](0x1f4,_0xb23c60[_0xa4a5('0x11')]));});});}; \ No newline at end of file +var _0x91ff=['`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','stringify','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x91ff,0x15b));var _0xf91f=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x91ff[_0x1780f8];return _0x33a410;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf91f('0x0'));var BPromise=require('bluebird');var rs=require(_0xf91f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf91f('0x2'))['db'];var utils=require(_0xf91f('0x3'));var logger=require(_0xf91f('0x4'))(_0xf91f('0x5'));var config=require(_0xf91f('0x6'));var jayson=require(_0xf91f('0x7'));var client=jayson[_0xf91f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xccccac,_0x12f7f6,_0x580d9a){return new BPromise(function(_0x161d5e,_0x5876ca){return client[_0xf91f('0x9')](_0xccccac,_0x580d9a)[_0xf91f('0xa')](function(_0x59b699){logger[_0xf91f('0xb')](_0xf91f('0xc'),_0x12f7f6,_0xf91f('0xd'));logger[_0xf91f('0xe')](_0xf91f('0xf'),_0x12f7f6,_0xf91f('0xd'),JSON['stringify'](_0x59b699));if(_0x59b699[_0xf91f('0x10')]){if(_0x59b699[_0xf91f('0x10')][_0xf91f('0x11')]===0x1f4){logger[_0xf91f('0x10')](_0xf91f('0xc'),_0x12f7f6,_0x59b699[_0xf91f('0x10')][_0xf91f('0x12')]);return _0x5876ca(_0x59b699[_0xf91f('0x10')][_0xf91f('0x12')]);}logger[_0xf91f('0x10')](_0xf91f('0xc'),_0x12f7f6,_0x59b699[_0xf91f('0x10')][_0xf91f('0x12')]);return _0x161d5e(_0x59b699[_0xf91f('0x10')]['message']);}else{logger['info'](_0xf91f('0xc'),_0x12f7f6,_0xf91f('0xd'));_0x161d5e(_0x59b699[_0xf91f('0x13')]['message']);}})[_0xf91f('0x14')](function(_0x411ce4){logger[_0xf91f('0x10')](_0xf91f('0xc'),_0x12f7f6,_0x411ce4);_0x5876ca(_0x411ce4);});});}exports[_0xf91f('0x15')]=function(_0x368041){var _0x3f4178=this;return new Promise(function(_0x2b56f6,_0x5b1f11){return db[_0xf91f('0x16')][_0xf91f('0x17')](_0x368041['body'],{'raw':_0x368041[_0xf91f('0x18')]?_0x368041[_0xf91f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf91f('0xa')](function(_0x4ceec7){logger[_0xf91f('0xb')]('CreateCmHopperHistory',_0x368041);logger[_0xf91f('0xe')](_0xf91f('0x15'),_0x368041,JSON[_0xf91f('0x19')](_0x4ceec7));_0x2b56f6(_0x4ceec7);})[_0xf91f('0x14')](function(_0x186558){logger[_0xf91f('0x10')](_0xf91f('0x15'),_0x186558[_0xf91f('0x12')],_0x368041);_0x5b1f11(_0x3f4178[_0xf91f('0x10')](0x1f4,_0x186558[_0xf91f('0x12')]));});});};exports['AvgHandleTime']=function(_0xd76db2){var _0x164a4a=this;return new Promise(function(_0x3b8f63,_0x3fce38){return db[_0xf91f('0x16')][_0xf91f('0x1a')]({'raw':_0xd76db2['options']?_0xd76db2[_0xf91f('0x18')][_0xf91f('0x1b')]===undefined?!![]:![]:!![],'where':_0xd76db2[_0xf91f('0x18')]?_0xd76db2[_0xf91f('0x18')][_0xf91f('0x1c')]||null:null,'attributes':[[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')][_0xf91f('0x1f')]('id')),_0xf91f('0x20')],[db[_0xf91f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf91f('0x21')](_0xf91f('0x22')))),_0xf91f('0x23')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0xf91f('0x24')],[db['sequelize']['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xf91f('0x25')],[db['sequelize']['fn'](_0xf91f('0x26'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x27')))),_0xf91f('0x28')],[db[_0xf91f('0x1d')]['fn']('AVG',db[_0xf91f('0x1d')]['fn']('IF',db['sequelize'][_0xf91f('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xf91f('0x29')]]})[_0xf91f('0xa')](function(_0x1444cb){logger[_0xf91f('0xb')](_0xf91f('0x2a'),_0xd76db2);logger[_0xf91f('0xe')](_0xf91f('0x2a'),_0xd76db2,JSON['stringify'](_0x1444cb));_0x3b8f63(_0x1444cb);})[_0xf91f('0x14')](function(_0x69bade){logger[_0xf91f('0x10')]('AvgHandleTime',_0x69bade['message'],_0xd76db2);_0x3fce38(_0x164a4a['error'](0x1f4,_0x69bade[_0xf91f('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x159093){var _0x28e63e=this;return new Promise(function(_0x3fa522,_0x241b1c){return db[_0xf91f('0x16')][_0xf91f('0x1a')]({'raw':_0x159093['options']?_0x159093[_0xf91f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x159093[_0xf91f('0x18')]?_0x159093[_0xf91f('0x18')][_0xf91f('0x1c')]||null:null,'attributes':[[_0xf91f('0x2b'),'name'],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xf91f('0x2c')],[db['sequelize']['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xf91f('0x2d')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x2e')))),_0xf91f('0x2f')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db['sequelize'][_0xf91f('0x21')](_0xf91f('0x30')))),_0xf91f('0x31')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xf91f('0x32')))),_0xf91f('0x33')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x34')))),_0xf91f('0x35')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xf91f('0x36')],[db[_0xf91f('0x1d')]['fn']('COUNT',db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xf91f('0x37')],[db['sequelize']['fn']('COUNT',db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xf91f('0x38')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x39')))),_0xf91f('0x3a')],[db['sequelize']['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')]['literal'](_0xf91f('0x3b')))),_0xf91f('0x3c')],[db['sequelize']['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')](_0xf91f('0x3d')))),'outboundRejectCallsDay'],[db[_0xf91f('0x1d')]['fn']('COUNT',db[_0xf91f('0x1d')]['fn']('IF',db[_0xf91f('0x1d')][_0xf91f('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xf91f('0x3e')]],'group':[_0xf91f('0x2b')]})[_0xf91f('0xa')](function(_0x589d10){logger['info'](_0xf91f('0x3f'),_0x159093);logger[_0xf91f('0xe')]('GetVoiceQueueHopperHistory',_0x159093,JSON[_0xf91f('0x19')](_0x589d10));_0x3fa522(_0x589d10);})[_0xf91f('0x14')](function(_0x799319){logger[_0xf91f('0x10')](_0xf91f('0x3f'),_0x799319[_0xf91f('0x12')],_0x159093);_0x241b1c(_0x28e63e[_0xf91f('0x10')](0x1f4,_0x799319[_0xf91f('0x12')]));});});};exports[_0xf91f('0x40')]=function(_0x204b52){var _0xc312c0=this;return new Promise(function(_0xcf73eb,_0x38fa42){return db[_0xf91f('0x16')]['findAll']({'raw':_0x204b52[_0xf91f('0x18')]?_0x204b52['options'][_0xf91f('0x1b')]===undefined?!![]:![]:!![],'where':_0x204b52[_0xf91f('0x18')]?_0x204b52[_0xf91f('0x18')][_0xf91f('0x1c')]||null:null,'attributes':[[_0xf91f('0x2b'),_0xf91f('0x41')],[db['sequelize']['fn']('COUNT',db[_0xf91f('0x1d')][_0xf91f('0x1f')]('id')),_0xf91f('0x42')],[db[_0xf91f('0x1d')]['fn'](_0xf91f('0x1e'),db[_0xf91f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xf91f('0x22')))),_0xf91f('0x43')]],'group':[_0xf91f('0x2b')]})[_0xf91f('0xa')](function(_0x33c56a){logger[_0xf91f('0xb')](_0xf91f('0x40'),_0x204b52);logger[_0xf91f('0xe')]('GetCampaignHopperHistory',_0x204b52,JSON[_0xf91f('0x19')](_0x33c56a));_0xcf73eb(_0x33c56a);})[_0xf91f('0x14')](function(_0x2bebf7){logger[_0xf91f('0x10')](_0xf91f('0x40'),_0x2bebf7[_0xf91f('0x12')],_0x204b52);_0x38fa42(_0xc312c0[_0xf91f('0x10')](0x1f4,_0x2bebf7[_0xf91f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 3c731f2..fdf7b9d 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 _0x1800=['./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4678c4,_0x44e6fd){var _0x532cb0=function(_0x2923f9){while(--_0x2923f9){_0x4678c4['push'](_0x4678c4['shift']());}};_0x532cb0(++_0x44e6fd);}(_0x1800,0x174));var _0x0180=function(_0x48bd63,_0x5f8e86){_0x48bd63=_0x48bd63-0x0;var _0x4eaade=_0x1800[_0x48bd63];return _0x4eaade;};'use strict';var multer=require(_0x0180('0x0'));var util=require(_0x0180('0x1'));var path=require(_0x0180('0x2'));var timeout=require(_0x0180('0x3'));var express=require(_0x0180('0x4'));var router=express['Router']();var fs_extra=require(_0x0180('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0180('0x6'));var config=require(_0x0180('0x7'));var controller=require(_0x0180('0x8'));router[_0x0180('0x9')]('/',auth['isAuthenticated'](),controller[_0x0180('0xa')]);router[_0x0180('0x9')](_0x0180('0xb'),auth[_0x0180('0xc')](),controller[_0x0180('0xd')]);router[_0x0180('0x9')](_0x0180('0xe'),auth[_0x0180('0xc')](),controller['show']);router[_0x0180('0xf')]('/',auth['isAuthenticated'](),controller[_0x0180('0x10')]);router[_0x0180('0x11')]('/:id',auth[_0x0180('0xc')](),controller[_0x0180('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3625=['/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','get'];(function(_0x4495d5,_0x54a117){var _0x2c4769=function(_0x3c59c6){while(--_0x3c59c6){_0x4495d5['push'](_0x4495d5['shift']());}};_0x2c4769(++_0x54a117);}(_0x3625,0x14a));var _0x5362=function(_0x50871e,_0x1a41fe){_0x50871e=_0x50871e-0x0;var _0x4cd4c9=_0x3625[_0x50871e];return _0x4cd4c9;};'use strict';var multer=require(_0x5362('0x0'));var util=require(_0x5362('0x1'));var path=require(_0x5362('0x2'));var timeout=require(_0x5362('0x3'));var express=require('express');var router=express[_0x5362('0x4')]();var fs_extra=require(_0x5362('0x5'));var auth=require(_0x5362('0x6'));var interaction=require(_0x5362('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x5362('0x8')](),controller[_0x5362('0x9')]);router['get']('/describe',auth[_0x5362('0x8')](),controller[_0x5362('0xa')]);router[_0x5362('0xb')](_0x5362('0xc'),auth[_0x5362('0x8')](),controller[_0x5362('0xd')]);router[_0x5362('0xe')]('/',auth[_0x5362('0x8')](),controller[_0x5362('0xf')]);router[_0x5362('0x10')](_0x5362('0xc'),auth[_0x5362('0x8')](),controller[_0x5362('0x11')]);module[_0x5362('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 6d5cd32..0940216 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 _0x6e12=['sequelize','exports','STRING','name'];(function(_0x5d2f1d,_0x4f1c29){var _0x1803fb=function(_0x3d099d){while(--_0x3d099d){_0x5d2f1d['push'](_0x5d2f1d['shift']());}};_0x1803fb(++_0x4f1c29);}(_0x6e12,0x154));var _0x26e1=function(_0x25e6a8,_0x3999b7){_0x25e6a8=_0x25e6a8-0x0;var _0x39c111=_0x6e12[_0x25e6a8];return _0x39c111;};'use strict';var Sequelize=require(_0x26e1('0x0'));module[_0x26e1('0x1')]={'name':{'type':Sequelize[_0x26e1('0x2')],'unique':_0x26e1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26e1('0x2')]}}; \ No newline at end of file +var _0xd58c=['exports','STRING','sequelize'];(function(_0x21a84c,_0x4b76ef){var _0x1d32ae=function(_0x4d42d8){while(--_0x4d42d8){_0x21a84c['push'](_0x21a84c['shift']());}};_0x1d32ae(++_0x4b76ef);}(_0xd58c,0xb6));var _0xcd58=function(_0x3c3a40,_0xd1c276){_0x3c3a40=_0x3c3a40-0x0;var _0xebca29=_0xd58c[_0x3c3a40];return _0xebca29;};'use strict';var Sequelize=require(_0xcd58('0x0'));module[_0xcd58('0x1')]={'name':{'type':Sequelize[_0xcd58('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcd58('0x2')]},'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 7a5164f..37c0f34 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 _0x10fd=['push','each','omit','ids','success','dataValues','errors','message','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','rimraf','zip-dir','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','findOne','nolimit','ListId','findAll','removeDispositions','CmContact','tags','join','isArray'];(function(_0x2451ce,_0x29506b){var _0x256d05=function(_0x31220e){while(--_0x31220e){_0x2451ce['push'](_0x2451ce['shift']());}};_0x256d05(++_0x29506b);}(_0x10fd,0xe6));var _0xd10f=function(_0x3e5325,_0x55af33){_0x3e5325=_0x3e5325-0x0;var _0x5a1c63=_0x10fd[_0x3e5325];return _0x5a1c63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd10f('0x0'));var zipdir=require(_0xd10f('0x1'));var jsonpatch=require(_0xd10f('0x2'));var rp=require(_0xd10f('0x3'));var moment=require('moment');var BPromise=require(_0xd10f('0x4'));var Mustache=require(_0xd10f('0x5'));var util=require(_0xd10f('0x6'));var path=require(_0xd10f('0x7'));var sox=require(_0xd10f('0x8'));var csv=require(_0xd10f('0x9'));var ejs=require(_0xd10f('0xa'));var fs=require('fs');var fs_extra=require(_0xd10f('0xb'));var _=require(_0xd10f('0xc'));var squel=require(_0xd10f('0xd'));var crypto=require(_0xd10f('0xe'));var jsforce=require(_0xd10f('0xf'));var deskjs=require(_0xd10f('0x10'));var toCsv=require(_0xd10f('0x9'));var querystring=require(_0xd10f('0x11'));var Papa=require(_0xd10f('0x12'));var Redis=require(_0xd10f('0x13'));var authService=require(_0xd10f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd10f('0x15'));var hardwareService=require(_0xd10f('0x16'));var logger=require(_0xd10f('0x17'))('api');var utils=require(_0xd10f('0x18'));var config=require(_0xd10f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd10f('0x1a'))['db'];var csv_results;config[_0xd10f('0x1b')]=_[_0xd10f('0x1c')](config[_0xd10f('0x1b')],{'host':_0xd10f('0x1d'),'port':0x18eb});var socket=require(_0xd10f('0x1e'))(new Redis(config[_0xd10f('0x1b')]));require(_0xd10f('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2223,_0xace232){_0xace232=_0xace232||0xcc;return function(_0x1302f8){if(_0x1302f8){return _0x2d2223[_0xd10f('0x20')](_0xace232);}return _0x2d2223['status'](_0xace232)[_0xd10f('0x21')]();};}function respondWithResult(_0x4984f3,_0x243071){_0x243071=_0x243071||0xc8;return function(_0x3066d7){if(_0x3066d7){return _0x4984f3[_0xd10f('0x22')](_0x243071)['json'](_0x3066d7);}};}function respondWithFilteredResult(_0x296344,_0x59bc9d){return function(_0x1bba08){if(_0x1bba08){var _0x523fcf=typeof _0x59bc9d[_0xd10f('0x23')]===_0xd10f('0x24')&&typeof _0x59bc9d[_0xd10f('0x25')]===_0xd10f('0x24');var _0x2225a8=_0x1bba08[_0xd10f('0x26')];var _0x12f368=_0x523fcf?0x0:_0x59bc9d[_0xd10f('0x23')];var _0x16b3a5=_0x523fcf?_0x1bba08[_0xd10f('0x26')]:_0x59bc9d[_0xd10f('0x23')]+_0x59bc9d[_0xd10f('0x25')];var _0x4ba6f3;if(_0x16b3a5>=_0x2225a8){_0x16b3a5=_0x2225a8;_0x4ba6f3=0xc8;}else{_0x4ba6f3=0xce;}_0x296344[_0xd10f('0x22')](_0x4ba6f3);return _0x296344[_0xd10f('0x27')](_0xd10f('0x28'),_0x12f368+'-'+_0x16b3a5+'/'+_0x2225a8)[_0xd10f('0x29')](_0x1bba08);}return null;};}function patchUpdates(_0xb9c2e2){return function(_0xa703f1){try{jsonpatch[_0xd10f('0x2a')](_0xa703f1,_0xb9c2e2,!![]);}catch(_0x541233){return BPromise[_0xd10f('0x2b')](_0x541233);}return _0xa703f1[_0xd10f('0x2c')]();};}function saveUpdates(_0x4db48a,_0x467ce4){return function(_0x553c11){if(_0x553c11){return _0x553c11[_0xd10f('0x2d')](_0x4db48a)[_0xd10f('0x2e')](function(_0x12ed8d){return _0x12ed8d;});}return null;};}function removeEntity(_0x3b0b19,_0x20e552){return function(_0x5a6165){if(_0x5a6165){return _0x5a6165[_0xd10f('0x2f')]()[_0xd10f('0x2e')](function(){var _0x5d64bb=_0x5a6165[_0xd10f('0x30')]({'plain':!![]});var _0x2c00c8=_0xd10f('0x31');return db[_0xd10f('0x32')][_0xd10f('0x2f')]({'where':{'type':_0x2c00c8,'resourceId':_0x5d64bb['id']}})[_0xd10f('0x2e')](function(){return _0x5a6165;});})[_0xd10f('0x2e')](function(){_0x3b0b19[_0xd10f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x130004,_0x5828a1){return function(_0x3d07ba){if(!_0x3d07ba){_0x130004[_0xd10f('0x20')](0x194);}return _0x3d07ba;};}function handleError(_0x5ec2d9,_0x6e855){_0x6e855=_0x6e855||0x1f4;return function(_0x553902){logger[_0xd10f('0x33')](_0x553902[_0xd10f('0x34')]);if(_0x553902['name']){delete _0x553902[_0xd10f('0x35')];}_0x5ec2d9[_0xd10f('0x22')](_0x6e855)[_0xd10f('0x36')](_0x553902);};}exports[_0xd10f('0x37')]=function(_0x8a8054,_0x18bab4){var _0x48da06={},_0xeba5f5={},_0x5a7754={'count':0x0,'rows':[]};var _0x1be99a=_[_0xd10f('0x38')](db[_0xd10f('0x39')][_0xd10f('0x3a')],function(_0x141d1e){return{'name':_0x141d1e[_0xd10f('0x3b')],'type':_0x141d1e[_0xd10f('0x3c')][_0xd10f('0x3d')]};});_0xeba5f5[_0xd10f('0x3e')]=_[_0xd10f('0x38')](_0x1be99a,_0xd10f('0x35'));_0xeba5f5[_0xd10f('0x3f')]=_[_0xd10f('0x40')](_0x8a8054[_0xd10f('0x3f')]);_0xeba5f5[_0xd10f('0x41')]=_[_0xd10f('0x42')](_0xeba5f5[_0xd10f('0x3e')],_0xeba5f5[_0xd10f('0x3f')]);_0x48da06[_0xd10f('0x43')]=_[_0xd10f('0x42')](_0xeba5f5[_0xd10f('0x3e')],qs[_0xd10f('0x44')](_0x8a8054[_0xd10f('0x3f')]['fields']));_0x48da06[_0xd10f('0x43')]=_0x48da06[_0xd10f('0x43')][_0xd10f('0x45')]?_0x48da06[_0xd10f('0x43')]:_0xeba5f5[_0xd10f('0x3e')];if(!_0x8a8054[_0xd10f('0x3f')]['hasOwnProperty']('nolimit')){_0x48da06['limit']=qs[_0xd10f('0x25')](_0x8a8054[_0xd10f('0x3f')]['limit']);_0x48da06[_0xd10f('0x23')]=qs[_0xd10f('0x23')](_0x8a8054[_0xd10f('0x3f')]['offset']);}_0x48da06[_0xd10f('0x46')]=qs[_0xd10f('0x47')](_0x8a8054[_0xd10f('0x3f')][_0xd10f('0x47')]);_0x48da06[_0xd10f('0x48')]=qs[_0xd10f('0x41')](_[_0xd10f('0x49')](_0x8a8054[_0xd10f('0x3f')],_0xeba5f5['filters']),_0x1be99a);if(_0x8a8054[_0xd10f('0x3f')]['filter']){_0x48da06[_0xd10f('0x48')]=_[_0xd10f('0x4a')](_0x48da06[_0xd10f('0x48')],{'$or':_[_0xd10f('0x38')](_0x1be99a,function(_0x3f6a6c){if(_0x3f6a6c[_0xd10f('0x3c')]!==_0xd10f('0x4b')){var _0x42de46={};_0x42de46[_0x3f6a6c['name']]={'$like':'%'+_0x8a8054['query'][_0xd10f('0x4c')]+'%'};return _0x42de46;}})});}_0x48da06=_[_0xd10f('0x4a')]({},_0x48da06,_0x8a8054[_0xd10f('0x4d')]);var _0x1ff9b6={'where':_0x48da06[_0xd10f('0x48')]};return db[_0xd10f('0x39')][_0xd10f('0x26')](_0x1ff9b6)['then'](function(_0x41f532){_0x5a7754[_0xd10f('0x26')]=_0x41f532;if(_0x8a8054[_0xd10f('0x3f')]['includeAll']){_0x48da06[_0xd10f('0x4e')]=[{'all':!![]}];}return db[_0xd10f('0x39')]['findAll'](_0x48da06);})[_0xd10f('0x2e')](function(_0x1de794){_0x5a7754[_0xd10f('0x4f')]=_0x1de794;return _0x5a7754;})[_0xd10f('0x2e')](respondWithFilteredResult(_0x18bab4,_0x48da06))[_0xd10f('0x50')](handleError(_0x18bab4,null));};exports[_0xd10f('0x51')]=function(_0x18fff6,_0x19c472){var _0x492b64={'raw':![],'where':{'id':_0x18fff6[_0xd10f('0x52')]['id']}},_0x31ed0c={};_0x31ed0c[_0xd10f('0x3e')]=_[_0xd10f('0x40')](db[_0xd10f('0x39')][_0xd10f('0x3a')]);_0x31ed0c[_0xd10f('0x3f')]=_[_0xd10f('0x40')](_0x18fff6[_0xd10f('0x3f')]);_0x31ed0c['filters']=_['intersection'](_0x31ed0c[_0xd10f('0x3e')],_0x31ed0c[_0xd10f('0x3f')]);_0x492b64['attributes']=_['intersection'](_0x31ed0c[_0xd10f('0x3e')],qs[_0xd10f('0x44')](_0x18fff6[_0xd10f('0x3f')][_0xd10f('0x44')]));_0x492b64['attributes']=_0x492b64[_0xd10f('0x43')][_0xd10f('0x45')]?_0x492b64['attributes']:_0x31ed0c[_0xd10f('0x3e')];if(_0x18fff6['query'][_0xd10f('0x53')]){_0x492b64[_0xd10f('0x4e')]=[{'all':!![]}];}_0x492b64=_[_0xd10f('0x4a')]({},_0x492b64,_0x18fff6['options']);return db[_0xd10f('0x39')][_0xd10f('0x54')](_0x492b64)[_0xd10f('0x2e')](handleEntityNotFound(_0x19c472,null))[_0xd10f('0x2e')](respondWithResult(_0x19c472,null))[_0xd10f('0x50')](handleError(_0x19c472,null));};exports[_0xd10f('0x55')]=function(_0x366c5a,_0x2ca4bc){return db['CmList'][_0xd10f('0x55')](_0x366c5a[_0xd10f('0x56')],{})[_0xd10f('0x2e')](function(_0xca1747){var _0x4fd99d=_0x366c5a[_0xd10f('0x57')][_0xd10f('0x30')]({'plain':!![]});if(!_0x4fd99d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fd99d['role']===_0xd10f('0x57')){var _0x80bf4c=_0xca1747[_0xd10f('0x30')]({'plain':!![]});var _0x99865f='Lists';return db['UserProfileSection'][_0xd10f('0x54')]({'where':{'name':_0x99865f,'userProfileId':_0x4fd99d['userProfileId']},'raw':!![]})['then'](function(_0x19e809){if(_0x19e809&&_0x19e809['autoAssociation']===0x0){return db[_0xd10f('0x32')][_0xd10f('0x55')]({'name':_0x80bf4c['name'],'resourceId':_0x80bf4c['id'],'type':_0x19e809[_0xd10f('0x35')],'sectionId':_0x19e809['id']},{})[_0xd10f('0x2e')](function(){return _0xca1747;});}else{return _0xca1747;}})[_0xd10f('0x50')](function(_0x516166){logger[_0xd10f('0x33')](_0xd10f('0x58'),_0x516166);throw _0x516166;});}return _0xca1747;})[_0xd10f('0x2e')](respondWithResult(_0x2ca4bc,0xc9))['catch'](handleError(_0x2ca4bc,null));};exports['update']=function(_0x245cbd,_0x1f0f2e){if(_0x245cbd[_0xd10f('0x56')]['id']){delete _0x245cbd[_0xd10f('0x56')]['id'];}return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0x245cbd['params']['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x1f0f2e,null))['then'](saveUpdates(_0x245cbd['body'],null))['then'](respondWithResult(_0x1f0f2e,null))[_0xd10f('0x50')](handleError(_0x1f0f2e,null));};exports['destroy']=function(_0x183e75,_0x568299){return db['CmList'][_0xd10f('0x54')]({'where':{'id':_0x183e75['params']['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x568299,null))[_0xd10f('0x2e')](removeEntity(_0x568299,null))[_0xd10f('0x50')](handleError(_0x568299,null));};exports[_0xd10f('0x59')]=function(_0x77d30,_0x4239d7){return db[_0xd10f('0x39')][_0xd10f('0x59')]()[_0xd10f('0x2e')](respondWithResult(_0x4239d7,null))[_0xd10f('0x50')](handleError(_0x4239d7,null));};exports['addDisposition']=function(_0x48b2de,_0x1b0b9f,_0x481cf1){if(_0x48b2de[_0xd10f('0x56')]['id']){delete _0x48b2de[_0xd10f('0x56')]['id'];}return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0x48b2de[_0xd10f('0x52')]['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x1b0b9f,null))[_0xd10f('0x2e')](function(_0x3f7e3d){if(_0x3f7e3d){_0x48b2de['body']['ListId']=_0x3f7e3d['id'];return db[_0xd10f('0x5a')][_0xd10f('0x55')](_0x48b2de[_0xd10f('0x56')]);}})[_0xd10f('0x2e')](respondWithResult(_0x1b0b9f,null))[_0xd10f('0x50')](handleError(_0x1b0b9f,null));};exports['getDispositions']=function(_0x42bfb5,_0x1da1c2,_0x249aa8){var _0x4babc7={'raw':![],'where':{}};var _0x1378f6={};var _0x5df96b={'count':0x0,'rows':[]};return db[_0xd10f('0x39')][_0xd10f('0x5b')]({'where':{'id':_0x42bfb5[_0xd10f('0x52')]['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x1da1c2,null))[_0xd10f('0x2e')](function(_0xb0c4c4){if(_0xb0c4c4){_0x1378f6[_0xd10f('0x3e')]=_['keys'](db[_0xd10f('0x5a')]['rawAttributes']);_0x1378f6[_0xd10f('0x3f')]=_[_0xd10f('0x40')](_0x42bfb5['query']);_0x1378f6[_0xd10f('0x41')]=_[_0xd10f('0x42')](_0x1378f6[_0xd10f('0x3e')],_0x1378f6[_0xd10f('0x3f')]);_0x4babc7['attributes']=_['intersection'](_0x1378f6[_0xd10f('0x3e')],qs['fields'](_0x42bfb5[_0xd10f('0x3f')][_0xd10f('0x44')]));_0x4babc7[_0xd10f('0x43')]=_0x4babc7['attributes'][_0xd10f('0x45')]?_0x4babc7[_0xd10f('0x43')]:_0x1378f6[_0xd10f('0x3e')];if(!_0x42bfb5[_0xd10f('0x3f')]['hasOwnProperty'](_0xd10f('0x5c'))){_0x4babc7[_0xd10f('0x25')]=qs['limit'](_0x42bfb5[_0xd10f('0x3f')]['limit']);_0x4babc7[_0xd10f('0x23')]=qs['offset'](_0x42bfb5[_0xd10f('0x3f')][_0xd10f('0x23')]);}_0x4babc7[_0xd10f('0x46')]=qs[_0xd10f('0x47')](_0x42bfb5[_0xd10f('0x3f')][_0xd10f('0x47')]);_0x4babc7['where']=qs[_0xd10f('0x41')](_[_0xd10f('0x49')](_0x42bfb5['query'],_0x1378f6[_0xd10f('0x41')]));_0x4babc7[_0xd10f('0x48')][_0xd10f('0x5d')]=_0xb0c4c4['id'];if(_0x42bfb5[_0xd10f('0x3f')][_0xd10f('0x4c')]){_0x4babc7['where']=_[_0xd10f('0x4a')](_0x4babc7[_0xd10f('0x48')],{'$or':_[_0xd10f('0x38')](_0x4babc7['attributes'],function(_0x2a7084){var _0xcf9026={};_0xcf9026[_0x2a7084]={'$like':'%'+_0x42bfb5[_0xd10f('0x3f')][_0xd10f('0x4c')]+'%'};return _0xcf9026;})});}_0x4babc7=_['merge']({},_0x4babc7,_0x42bfb5[_0xd10f('0x4d')]);return db[_0xd10f('0x5a')][_0xd10f('0x26')]({'where':_0x4babc7[_0xd10f('0x48')]})[_0xd10f('0x2e')](function(_0x5afcd6){_0x5df96b[_0xd10f('0x26')]=_0x5afcd6;if(_0x42bfb5[_0xd10f('0x3f')]['includeAll']){_0x4babc7[_0xd10f('0x4e')]=[{'all':!![]}];}return db[_0xd10f('0x5a')][_0xd10f('0x5e')](_0x4babc7);})[_0xd10f('0x2e')](function(_0x48c30e){_0x5df96b[_0xd10f('0x4f')]=_0x48c30e;return _0x5df96b;});}})[_0xd10f('0x2e')](respondWithFilteredResult(_0x1da1c2,_0x4babc7))['catch'](handleError(_0x1da1c2,null));};exports[_0xd10f('0x5f')]=function(_0xb25e04,_0x106cff,_0x45d5b2){return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0xb25e04[_0xd10f('0x52')]['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x106cff,null))[_0xd10f('0x2e')](function(_0x4e5e4e){if(_0x4e5e4e){return _0x4e5e4e[_0xd10f('0x5f')](_0xb25e04['query']['ids']);}})[_0xd10f('0x2e')](respondWithStatusCode(_0x106cff,null))[_0xd10f('0x50')](handleError(_0x106cff,null));};exports['addContacts']=function(_0x36dcaa,_0x4cd866,_0x207ba8){return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0x36dcaa['params']['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x4cd866,null))[_0xd10f('0x2e')](function(_0xd0db76){if(_0xd0db76){var _0x30e4e6=[];var _0x1179bb={'success':[],'errors':[]};return db[_0xd10f('0x60')][_0xd10f('0x59')]()[_0xd10f('0x2e')](function(_0x109210){if(_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')]&&_['isArray'](_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')])){if(_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')][_0xd10f('0x45')]){_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')]=_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')][_0xd10f('0x62')](';')+';';}else{_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')]=null;}}else{_0x36dcaa[_0xd10f('0x56')][_0xd10f('0x61')]=null;}if(_0x36dcaa['body']&&_[_0xd10f('0x63')](_0x36dcaa[_0xd10f('0x56')])){for(var _0x5ae475=0x0;_0x5ae475<_0x36dcaa['body']['length'];_0x5ae475+=0x1){_0x36dcaa[_0xd10f('0x56')][_0x5ae475][_0xd10f('0x5d')]=_0x36dcaa[_0xd10f('0x52')]['id'];_0x30e4e6[_0xd10f('0x64')](_0x36dcaa[_0xd10f('0x56')][_0x5ae475]);}return BPromise[_0xd10f('0x65')](_0x30e4e6,function(_0x327621){return db[_0xd10f('0x60')][_0xd10f('0x55')](_[_0xd10f('0x66')](_0x327621,[_0xd10f('0x67'),'id'])||{},{'fields':_['keys'](_0x109210),'raw':!![]})[_0xd10f('0x2e')](function(_0x1a0e19){_0x1179bb[_0xd10f('0x68')][_0xd10f('0x64')](_0x1a0e19[_0xd10f('0x69')]);})[_0xd10f('0x50')](function(_0x5312d4){_0x1179bb[_0xd10f('0x6a')][_0xd10f('0x64')]({'data':_0x327621,'error':_0x5312d4[_0xd10f('0x6b')]});});})[_0xd10f('0x2e')](function(_0x521105){return _0x1179bb;})[_0xd10f('0x50')](function(_0xea20bd){return _0xea20bd;});}else{_0x4cd866[_0xd10f('0x22')](0x190)[_0xd10f('0x29')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd10f('0x2e')](respondWithResult(_0x4cd866,null))[_0xd10f('0x50')](handleError(_0x4cd866,null));};exports['getContacts']=function(_0x457ada,_0x1d3fe0,_0x1063b8){var _0x3ac975;return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0x457ada[_0xd10f('0x52')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xd10f('0x6c')}]})[_0xd10f('0x2e')](handleEntityNotFound(_0x1d3fe0,null))[_0xd10f('0x2e')](function(_0x17e4f0){if(_0x17e4f0){_0x3ac975=_0x17e4f0;return db[_0xd10f('0x60')][_0xd10f('0x3a')];}})['then'](function(_0x4533cc){if(_0x4533cc){var _0x4f0566={};var _0x130441={};_0x130441[_0xd10f('0x3e')]=_[_0xd10f('0x6d')](_['keys'](_0x4533cc),_[_0xd10f('0x38')](_0x3ac975[_0xd10f('0x6c')],function(_0x5168c8){return util[_0xd10f('0x6e')](_0xd10f('0x6f'),_0x5168c8['id']);}));_0x130441[_0xd10f('0x3f')]=_[_0xd10f('0x40')](_0x457ada[_0xd10f('0x3f')]);_0x130441['filters']=_[_0xd10f('0x42')](_0x130441[_0xd10f('0x3e')],_0x130441[_0xd10f('0x3f')]);_0x4f0566['attributes']=_[_0xd10f('0x42')](_0x130441[_0xd10f('0x3e')],qs[_0xd10f('0x44')](_0x457ada[_0xd10f('0x3f')][_0xd10f('0x44')]));_0x4f0566[_0xd10f('0x43')]=_0x4f0566[_0xd10f('0x43')][_0xd10f('0x45')]?_0x4f0566[_0xd10f('0x43')]:_0x130441[_0xd10f('0x3e')];if(!_0x457ada[_0xd10f('0x3f')][_0xd10f('0x70')]('nolimit')){_0x4f0566[_0xd10f('0x25')]=qs[_0xd10f('0x25')](_0x457ada[_0xd10f('0x3f')][_0xd10f('0x25')]);_0x4f0566['offset']=qs[_0xd10f('0x23')](_0x457ada[_0xd10f('0x3f')][_0xd10f('0x23')]);}_0x4f0566[_0xd10f('0x46')]=qs['sort'](_0x457ada[_0xd10f('0x3f')][_0xd10f('0x47')]);_0x4f0566[_0xd10f('0x48')]=qs[_0xd10f('0x41')](_[_0xd10f('0x49')](_0x457ada[_0xd10f('0x3f')],_0x130441['filters']));_0x4f0566[_0xd10f('0x71')]=!![];if(_0x457ada['query'][_0xd10f('0x4c')]){_0x4f0566[_0xd10f('0x48')]=_['merge'](_0x4f0566['where'],{'$or':_[_0xd10f('0x38')](_0x4f0566[_0xd10f('0x43')],function(_0x296834){var _0x3cf4d5={};_0x3cf4d5[_0x296834]={'$like':'%'+_0x457ada[_0xd10f('0x3f')][_0xd10f('0x4c')]+'%'};return _0x3cf4d5;})});}_0x4f0566=_['merge']({},_0x4f0566,_0x457ada[_0xd10f('0x4d')]);return _0x3ac975[_0xd10f('0x72')](_0x4f0566);}})[_0xd10f('0x2e')](respondWithResult(_0x1d3fe0,null))[_0xd10f('0x50')](handleError(_0x1d3fe0,null));};exports[_0xd10f('0x73')]=function(_0x35b2d8,_0x1e4f1d,_0x15bf14){var _0x56dfb7;var _0x24dc96;var _0x3286f8;var _0x2b6dc3=_0x35b2d8[_0xd10f('0x52')]['id'];csv_results=[];return db[_0xd10f('0x74')][_0xd10f('0x5e')]({'attributes':['id',_0xd10f('0x35')],'raw':!![],'order':[_0xd10f('0x75')]})[_0xd10f('0x2e')](function(_0x22e4ce){_0x56dfb7=_0x22e4ce;var _0xd07153=_['keys'](db[_0xd10f('0x60')][_0xd10f('0x3a')]);return db[_0xd10f('0x76')][_0xd10f('0x5e')]({'raw':!![],'attributes':['id',_0xd10f('0x77')]})['then'](function(_0x25176a){_0x24dc96=_0x25176a;var _0x5d04a6=squel[_0xd10f('0x78')]()[_0xd10f('0x44')](_0xd07153)[_0xd10f('0x79')](_0xd10f('0x7a'),'c')[_0xd10f('0x48')](_0xd10f('0x7b'),_0x2b6dc3)[_0xd10f('0x48')](_0xd10f('0x7c'))['distinct']();for(var _0x5b0548=0x0;_0x5b0548<_0x24dc96[_0xd10f('0x45')];_0x5b0548++){_0x5d04a6[_0xd10f('0x7d')](_0xd10f('0x7e')+_0x24dc96[_0x5b0548]['id'],_0xd10f('0x7f')+_0x24dc96[_0x5b0548][_0xd10f('0x77')]);}for(var _0x5b0548=0x0;_0x5b0548<_0x56dfb7[_0xd10f('0x45')];_0x5b0548++){_0x5d04a6['field'](squel[_0xd10f('0x78')]()[_0xd10f('0x7d')](_0xd10f('0x80'))[_0xd10f('0x79')](_0xd10f('0x81'))[_0xd10f('0x48')](_0xd10f('0x82'),_0x56dfb7[_0x5b0548]['id'])[_0xd10f('0x48')]('CmContactId\x20=\x20c.id'),_0xd10f('0x83')+_0x56dfb7[_0x5b0548][_0xd10f('0x35')]);_0x5d04a6[_0xd10f('0x7d')](squel[_0xd10f('0x78')]()[_0xd10f('0x7d')](_0xd10f('0x84'))[_0xd10f('0x79')](_0xd10f('0x81'))[_0xd10f('0x48')](_0xd10f('0x82'),_0x56dfb7[_0x5b0548]['id'])[_0xd10f('0x48')](_0xd10f('0x85')),_0xd10f('0x86')+_0x56dfb7[_0x5b0548][_0xd10f('0x35')]);}var _0x115c89=[];_0x115c89[_0xd10f('0x64')](_0x5d04a6[_0xd10f('0x87')]());BPromise[_0xd10f('0x65')](_0x115c89,handleQuery)[_0xd10f('0x2e')](function(_0x854f79){handleQuery(_0x5d04a6[_0xd10f('0x87')]());var _0x21091e=csv_results[0x0];if(!_['isEmpty'](_0x21091e)){var _0x3bb9f4=toCsv(_0x21091e);var _0x46a5ec=Date['now']();fs[_0xd10f('0x88')](util[_0xd10f('0x6e')](_0xd10f('0x89'),_0x2b6dc3,_0x46a5ec),_0x3bb9f4);_0x1e4f1d[_0xd10f('0x8a')](_0xd10f('0x8b'),_0xd10f('0x8c')+util[_0xd10f('0x6e')]('list_%d_%s.csv',_0x2b6dc3,_0x46a5ec));_0x1e4f1d[_0xd10f('0x8a')](_0xd10f('0x8d'),_0xd10f('0x8e'));return _0x1e4f1d['download'](util['format']('/tmp/list_%d_%s.csv',_0x2b6dc3,_0x46a5ec));}else{return _0x1e4f1d['sendStatus'](0xcc);}});});});};exports[_0xd10f('0x8f')]=function(_0x4cfb9b,_0x497989,_0x4709a6){var _0x362549;delete _0x4cfb9b[_0xd10f('0x56')]['id'];return db[_0xd10f('0x39')]['findOne']({'where':{'id':_0x4cfb9b[_0xd10f('0x52')]['id']}})['then'](handleEntityNotFound(_0x497989,null))[_0xd10f('0x2e')](function(_0x2192ab){if(_0x2192ab){return db['sequelize']['transaction'](function(_0x5b1778){return db[_0xd10f('0x76')][_0xd10f('0x55')](_0x4cfb9b['body'],{'transaction':_0x5b1778})[_0xd10f('0x2e')](function(_0x92315e){_0x362549=_0x92315e;return _0x2192ab[_0xd10f('0x90')](_0x92315e,{'transaction':_0x5b1778});})[_0xd10f('0x2e')](function(){var _0x1a9c19={'type':db[_0xd10f('0x91')][_0xd10f('0x92')],'transaction':_0x5b1778};switch(_0x4cfb9b[_0xd10f('0x56')]['type']){case _0xd10f('0x93'):_0x1a9c19['type']=db[_0xd10f('0x91')][_0xd10f('0x92')];break;case'number':_0x1a9c19[_0xd10f('0x3c')]=db[_0xd10f('0x91')][_0xd10f('0x94')];break;case'switch':_0x1a9c19['type']=db[_0xd10f('0x91')][_0xd10f('0x95')];_0x1a9c19[_0xd10f('0x96')]=![];break;default:}return db[_0xd10f('0x97')][_0xd10f('0x98')]['addColumn']('cm_contacts',util['format'](_0xd10f('0x99'),_0x362549['id']),_0x1a9c19);})[_0xd10f('0x2e')](function(){return _0x362549;});});}})['then'](respondWithResult(_0x497989,null))[_0xd10f('0x50')](handleError(_0x497989,null));};exports[_0xd10f('0x9a')]=function(_0x2966a4,_0x198e92,_0x135d49){var _0x3db716={};var _0x318104={};var _0x129b2f;var _0x1f4a1a;return db['CmList']['findOne']({'where':{'id':_0x2966a4['params']['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x198e92,null))[_0xd10f('0x2e')](function(_0x20829a){if(_0x20829a){_0x129b2f=_0x20829a;_0x318104['model']=_[_0xd10f('0x40')](db['CmCustomField'][_0xd10f('0x3a')]);_0x318104[_0xd10f('0x3f')]=_['keys'](_0x2966a4[_0xd10f('0x3f')]);_0x318104[_0xd10f('0x41')]=_[_0xd10f('0x42')](_0x318104['model'],_0x318104[_0xd10f('0x3f')]);_0x3db716[_0xd10f('0x43')]=_[_0xd10f('0x42')](_0x318104['model'],qs[_0xd10f('0x44')](_0x2966a4[_0xd10f('0x3f')][_0xd10f('0x44')]));_0x3db716['attributes']=_0x3db716[_0xd10f('0x43')][_0xd10f('0x45')]?_0x3db716[_0xd10f('0x43')]:_0x318104[_0xd10f('0x3e')];_0x3db716[_0xd10f('0x46')]=qs[_0xd10f('0x47')](_0x2966a4[_0xd10f('0x3f')][_0xd10f('0x47')]);_0x3db716[_0xd10f('0x48')]=qs[_0xd10f('0x41')](_[_0xd10f('0x49')](_0x2966a4[_0xd10f('0x3f')],_0x318104[_0xd10f('0x41')]));_0x3db716['where']=_[_0xd10f('0x4a')](_0x3db716['where'],{'$or':[{'ListId':_0x20829a['id']},{'ListId':null}]});if(_0x2966a4['query']['filter']){_0x3db716[_0xd10f('0x48')]=_['merge'](_0x3db716['where'],{'$or':_[_0xd10f('0x38')](_0x3db716[_0xd10f('0x43')],function(_0x175045){var _0x18e604={};_0x18e604[_0x175045]={'$like':'%'+_0x2966a4['query'][_0xd10f('0x4c')]+'%'};return _0x18e604;})});}_0x3db716=_[_0xd10f('0x4a')]({},_0x3db716,_0x2966a4[_0xd10f('0x4d')]);return db['CmCustomField'][_0xd10f('0x9b')](_0x3db716);}})[_0xd10f('0x2e')](respondWithResult(_0x198e92,null))['catch'](handleError(_0x198e92,null));};exports['getGlobalCustomFields']=function(_0x39e37d,_0x336e01){return db[_0xd10f('0x76')]['findAndCountAll']({'where':{'ListId':null}})[_0xd10f('0x2e')](handleEntityNotFound(_0x336e01,null))[_0xd10f('0x2e')](function(_0x2371e9){return _0x2371e9;})[_0xd10f('0x2e')](respondWithResult(_0x336e01,null))[_0xd10f('0x50')](handleError(_0x336e01,null));};exports[_0xd10f('0x9c')]=function(_0x3c1cf8,_0x599111,_0x2e5899){return db['CmList'][_0xd10f('0x54')]({'where':{'id':_0x3c1cf8[_0xd10f('0x52')]['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x599111,null))[_0xd10f('0x2e')](function(_0x102a30){if(_0x102a30){return _0x102a30[_0xd10f('0x9c')](_0x3c1cf8[_0xd10f('0x56')][_0xd10f('0x67')],_['omit'](_0x3c1cf8[_0xd10f('0x56')],[_0xd10f('0x67'),'id'])||{})[_0xd10f('0x9d')](function(_0x151fcb){for(var _0x2e6ec4=0x0;_0x2e6ec4<_0x3c1cf8[_0xd10f('0x56')][_0xd10f('0x67')][_0xd10f('0x45')];_0x2e6ec4+=0x1){socket[_0xd10f('0x9e')](_0xd10f('0x9f'),{'UserId':Number(_0x3c1cf8[_0xd10f('0x56')]['ids'][_0x2e6ec4]),'CmListId':Number(_0x3c1cf8[_0xd10f('0x52')]['id'])});}return _0x151fcb;});}})[_0xd10f('0x2e')](respondWithResult(_0x599111,null))[_0xd10f('0x50')](handleError(_0x599111,null));};exports['removeAgents']=function(_0xd99537,_0x271526,_0x17a088){return db[_0xd10f('0x39')][_0xd10f('0x54')]({'where':{'id':_0xd99537['params']['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x271526,null))[_0xd10f('0x2e')](function(_0x3c1c27){if(_0x3c1c27){return _0x3c1c27[_0xd10f('0xa0')](_0xd99537[_0xd10f('0x3f')][_0xd10f('0x67')])[_0xd10f('0x2e')](function(){if(_[_0xd10f('0x63')](_0xd99537[_0xd10f('0x3f')][_0xd10f('0x67')])){for(var _0x2c4eca=0x0;_0x2c4eca<_0xd99537[_0xd10f('0x3f')][_0xd10f('0x67')][_0xd10f('0x45')];_0x2c4eca+=0x1){socket['emit'](_0xd10f('0xa1'),{'UserId':Number(_0xd99537[_0xd10f('0x3f')]['ids'][_0x2c4eca]),'CmListId':Number(_0xd99537[_0xd10f('0x52')]['id'])});}}else{socket[_0xd10f('0x9e')](_0xd10f('0xa1'),{'UserId':Number(_0xd99537['query']['ids']),'CmListId':Number(_0xd99537[_0xd10f('0x52')]['id'])});}});}})[_0xd10f('0x2e')](respondWithStatusCode(_0x271526,null))[_0xd10f('0x50')](handleError(_0x271526,null));};exports['getAgents']=function(_0x37cda0,_0x3863af,_0x13009a){var _0xda7a2a={};var _0x476377={};var _0x41ef81;var _0x5ee847;return db[_0xd10f('0x39')][_0xd10f('0x5b')]({'where':{'id':_0x37cda0[_0xd10f('0x52')]['id']}})[_0xd10f('0x2e')](handleEntityNotFound(_0x3863af,null))[_0xd10f('0x2e')](function(_0x5f1082){if(_0x5f1082){_0x41ef81=_0x5f1082;_0x476377['model']=_[_0xd10f('0x40')](db[_0xd10f('0xa2')][_0xd10f('0x3a')]);_0x476377['query']=_[_0xd10f('0x40')](_0x37cda0[_0xd10f('0x3f')]);_0x476377['filters']=_['intersection'](_0x476377[_0xd10f('0x3e')],_0x476377[_0xd10f('0x3f')]);_0xda7a2a[_0xd10f('0x43')]=_['intersection'](_0x476377[_0xd10f('0x3e')],qs[_0xd10f('0x44')](_0x37cda0[_0xd10f('0x3f')]['fields']));_0xda7a2a[_0xd10f('0x43')]=_0xda7a2a[_0xd10f('0x43')]['length']?_0xda7a2a[_0xd10f('0x43')]:_0x476377['model'];_0xda7a2a[_0xd10f('0x46')]=qs[_0xd10f('0x47')](_0x37cda0[_0xd10f('0x3f')]['sort']);_0xda7a2a[_0xd10f('0x48')]=qs['filters'](_[_0xd10f('0x49')](_0x37cda0['query'],_0x476377[_0xd10f('0x41')]));if(_0x37cda0[_0xd10f('0x3f')][_0xd10f('0x4c')]){_0xda7a2a['where']=_[_0xd10f('0x4a')](_0xda7a2a[_0xd10f('0x48')],{'$or':_[_0xd10f('0x38')](_0xda7a2a[_0xd10f('0x43')],function(_0x40671f){var _0x4a7752={};_0x4a7752[_0x40671f]={'$like':'%'+_0x37cda0[_0xd10f('0x3f')][_0xd10f('0x4c')]+'%'};return _0x4a7752;})});}_0xda7a2a=_[_0xd10f('0x4a')]({},_0xda7a2a,_0x37cda0[_0xd10f('0x4d')]);return _0x41ef81[_0xd10f('0xa3')](_0xda7a2a);}})['then'](function(_0x59aaad){if(_0x59aaad){_0x5ee847=_0x59aaad[_0xd10f('0x45')];if(!_0x37cda0[_0xd10f('0x3f')][_0xd10f('0x70')]('nolimit')){_0xda7a2a['limit']=qs[_0xd10f('0x25')](_0x37cda0[_0xd10f('0x3f')][_0xd10f('0x25')]);_0xda7a2a['offset']=qs[_0xd10f('0x23')](_0x37cda0['query'][_0xd10f('0x23')]);}return _0x41ef81[_0xd10f('0xa3')](_0xda7a2a);}})['then'](function(_0x5e6d91){if(_0x5e6d91){return _0x5e6d91?{'count':_0x5ee847,'rows':_0x5e6d91}:null;}})[_0xd10f('0x2e')](respondWithResult(_0x3863af,null))[_0xd10f('0x50')](handleError(_0x3863af,null));};function handleQuery(_0x2ef1f7){logger[_0xd10f('0xa4')](_0x2ef1f7);return db[_0xd10f('0x97')][_0xd10f('0x3f')](_0x2ef1f7)[_0xd10f('0x9d')](function(_0x3ee87b){csv_results['push'](_0x3ee87b);})['catch'](function(_0x2b0cc6){logger[_0xd10f('0x33')](_0x2b0cc6[_0xd10f('0x6b')]);});} \ No newline at end of file +var _0x8fe7=['select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','alias','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','transaction','Sequelize','text','TEXT','number','BOOLEAN','defaultValue','queryInterface','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','ids','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','send','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmList','findAll','rows','show','params','fields','includeAll','include','options','catch','create','body','role','UserProfileSection','find','autoAssociation','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addContacts','tags','isArray','join','each','omit','success','push','dataValues','json','getContacts','CmCustomField','CustomFields','CmContact','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy'];(function(_0x110538,_0x267367){var _0x1601f3=function(_0xb90906){while(--_0xb90906){_0x110538['push'](_0x110538['shift']());}};_0x1601f3(++_0x267367);}(_0x8fe7,0xd2));var _0x78fe=function(_0x5732a1,_0x403c5d){_0x5732a1=_0x5732a1-0x0;var _0x12ec4c=_0x8fe7[_0x5732a1];return _0x12ec4c;};'use strict';var emlformat=require(_0x78fe('0x0'));var rimraf=require(_0x78fe('0x1'));var zipdir=require(_0x78fe('0x2'));var jsonpatch=require(_0x78fe('0x3'));var rp=require(_0x78fe('0x4'));var moment=require(_0x78fe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78fe('0x6'));var util=require(_0x78fe('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x78fe('0x8'));var ejs=require(_0x78fe('0x9'));var fs=require('fs');var fs_extra=require(_0x78fe('0xa'));var _=require(_0x78fe('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x78fe('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x78fe('0xd'));var Papa=require(_0x78fe('0xe'));var Redis=require(_0x78fe('0xf'));var authService=require(_0x78fe('0x10'));var qs=require(_0x78fe('0x11'));var as=require(_0x78fe('0x12'));var hardwareService=require(_0x78fe('0x13'));var logger=require(_0x78fe('0x14'))(_0x78fe('0x15'));var utils=require(_0x78fe('0x16'));var config=require(_0x78fe('0x17'));var licenseUtil=require(_0x78fe('0x18'));var db=require(_0x78fe('0x19'))['db'];var csv_results;config[_0x78fe('0x1a')]=_[_0x78fe('0x1b')](config[_0x78fe('0x1a')],{'host':_0x78fe('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78fe('0x1a')]));require(_0x78fe('0x1d'))[_0x78fe('0x1e')](socket);function respondWithStatusCode(_0x596eed,_0x5196fb){_0x5196fb=_0x5196fb||0xcc;return function(_0x39ac08){if(_0x39ac08){return _0x596eed[_0x78fe('0x1f')](_0x5196fb);}return _0x596eed[_0x78fe('0x20')](_0x5196fb)[_0x78fe('0x21')]();};}function respondWithResult(_0x546894,_0x24be65){_0x24be65=_0x24be65||0xc8;return function(_0x3d5013){if(_0x3d5013){return _0x546894[_0x78fe('0x20')](_0x24be65)['json'](_0x3d5013);}};}function respondWithFilteredResult(_0x1f58da,_0x5e6656){return function(_0x457193){if(_0x457193){var _0x3e8527=typeof _0x5e6656[_0x78fe('0x22')]===_0x78fe('0x23')&&typeof _0x5e6656[_0x78fe('0x24')]===_0x78fe('0x23');var _0x3c983b=_0x457193[_0x78fe('0x25')];var _0x31cb7d=_0x3e8527?0x0:_0x5e6656[_0x78fe('0x22')];var _0x359d7a=_0x3e8527?_0x457193[_0x78fe('0x25')]:_0x5e6656[_0x78fe('0x22')]+_0x5e6656[_0x78fe('0x24')];var _0x35c393;if(_0x359d7a>=_0x3c983b){_0x359d7a=_0x3c983b;_0x35c393=0xc8;}else{_0x35c393=0xce;}_0x1f58da['status'](_0x35c393);return _0x1f58da[_0x78fe('0x26')]('Content-Range',_0x31cb7d+'-'+_0x359d7a+'/'+_0x3c983b)['json'](_0x457193);}return null;};}function patchUpdates(_0xa1e34b){return function(_0x594aeb){try{jsonpatch['apply'](_0x594aeb,_0xa1e34b,!![]);}catch(_0x5d1947){return BPromise[_0x78fe('0x27')](_0x5d1947);}return _0x594aeb[_0x78fe('0x28')]();};}function saveUpdates(_0x2e77df,_0x1a4364){return function(_0xf5d210){if(_0xf5d210){return _0xf5d210[_0x78fe('0x29')](_0x2e77df)[_0x78fe('0x2a')](function(_0x190638){return _0x190638;});}return null;};}function removeEntity(_0x4a1a95,_0x2ed199){return function(_0x1aa13d){if(_0x1aa13d){return _0x1aa13d['destroy']()[_0x78fe('0x2a')](function(){var _0x51c4e3=_0x1aa13d[_0x78fe('0x2b')]({'plain':!![]});var _0x307f61=_0x78fe('0x2c');return db[_0x78fe('0x2d')][_0x78fe('0x2e')]({'where':{'type':_0x307f61,'resourceId':_0x51c4e3['id']}})['then'](function(){return _0x1aa13d;});})['then'](function(){_0x4a1a95[_0x78fe('0x20')](0xcc)[_0x78fe('0x21')]();});}};}function handleEntityNotFound(_0x1a77ee,_0x38116a){return function(_0x2cbcab){if(!_0x2cbcab){_0x1a77ee[_0x78fe('0x1f')](0x194);}return _0x2cbcab;};}function handleError(_0x49c958,_0x453d2d){_0x453d2d=_0x453d2d||0x1f4;return function(_0x17e807){logger[_0x78fe('0x2f')](_0x17e807[_0x78fe('0x30')]);if(_0x17e807['name']){delete _0x17e807['name'];}_0x49c958[_0x78fe('0x20')](_0x453d2d)[_0x78fe('0x31')](_0x17e807);};}exports[_0x78fe('0x32')]=function(_0x4b6806,_0x40f755){var _0x243aeb={},_0x1f95d0={},_0x568a36={'count':0x0,'rows':[]};var _0x3bc9ff=_[_0x78fe('0x33')](db['CmList'][_0x78fe('0x34')],function(_0xf7d4f7){return{'name':_0xf7d4f7['fieldName'],'type':_0xf7d4f7[_0x78fe('0x35')]['key']};});_0x1f95d0[_0x78fe('0x36')]=_['map'](_0x3bc9ff,_0x78fe('0x37'));_0x1f95d0[_0x78fe('0x38')]=_[_0x78fe('0x39')](_0x4b6806[_0x78fe('0x38')]);_0x1f95d0[_0x78fe('0x3a')]=_[_0x78fe('0x3b')](_0x1f95d0[_0x78fe('0x36')],_0x1f95d0[_0x78fe('0x38')]);_0x243aeb[_0x78fe('0x3c')]=_[_0x78fe('0x3b')](_0x1f95d0[_0x78fe('0x36')],qs['fields'](_0x4b6806['query']['fields']));_0x243aeb[_0x78fe('0x3c')]=_0x243aeb['attributes'][_0x78fe('0x3d')]?_0x243aeb[_0x78fe('0x3c')]:_0x1f95d0[_0x78fe('0x36')];if(!_0x4b6806['query']['hasOwnProperty'](_0x78fe('0x3e'))){_0x243aeb[_0x78fe('0x24')]=qs[_0x78fe('0x24')](_0x4b6806[_0x78fe('0x38')][_0x78fe('0x24')]);_0x243aeb[_0x78fe('0x22')]=qs[_0x78fe('0x22')](_0x4b6806['query'][_0x78fe('0x22')]);}_0x243aeb[_0x78fe('0x3f')]=qs[_0x78fe('0x40')](_0x4b6806[_0x78fe('0x38')][_0x78fe('0x40')]);_0x243aeb[_0x78fe('0x41')]=qs[_0x78fe('0x3a')](_[_0x78fe('0x42')](_0x4b6806[_0x78fe('0x38')],_0x1f95d0[_0x78fe('0x3a')]),_0x3bc9ff);if(_0x4b6806[_0x78fe('0x38')][_0x78fe('0x43')]){_0x243aeb['where']=_[_0x78fe('0x44')](_0x243aeb[_0x78fe('0x41')],{'$or':_[_0x78fe('0x33')](_0x3bc9ff,function(_0x4bf695){if(_0x4bf695[_0x78fe('0x35')]!==_0x78fe('0x45')){var _0x38e87a={};_0x38e87a[_0x4bf695[_0x78fe('0x37')]]={'$like':'%'+_0x4b6806[_0x78fe('0x38')]['filter']+'%'};return _0x38e87a;}})});}_0x243aeb=_[_0x78fe('0x44')]({},_0x243aeb,_0x4b6806['options']);var _0x4481f5={'where':_0x243aeb['where']};return db[_0x78fe('0x46')]['count'](_0x4481f5)[_0x78fe('0x2a')](function(_0x50f2da){_0x568a36[_0x78fe('0x25')]=_0x50f2da;if(_0x4b6806[_0x78fe('0x38')]['includeAll']){_0x243aeb['include']=[{'all':!![]}];}return db[_0x78fe('0x46')][_0x78fe('0x47')](_0x243aeb);})['then'](function(_0x1752f1){_0x568a36[_0x78fe('0x48')]=_0x1752f1;return _0x568a36;})['then'](respondWithFilteredResult(_0x40f755,_0x243aeb))['catch'](handleError(_0x40f755,null));};exports[_0x78fe('0x49')]=function(_0x393cc5,_0x3e64f8){var _0x14275f={'raw':![],'where':{'id':_0x393cc5[_0x78fe('0x4a')]['id']}},_0x19b3b4={};_0x19b3b4[_0x78fe('0x36')]=_[_0x78fe('0x39')](db[_0x78fe('0x46')]['rawAttributes']);_0x19b3b4[_0x78fe('0x38')]=_[_0x78fe('0x39')](_0x393cc5[_0x78fe('0x38')]);_0x19b3b4[_0x78fe('0x3a')]=_['intersection'](_0x19b3b4[_0x78fe('0x36')],_0x19b3b4[_0x78fe('0x38')]);_0x14275f['attributes']=_['intersection'](_0x19b3b4[_0x78fe('0x36')],qs[_0x78fe('0x4b')](_0x393cc5[_0x78fe('0x38')][_0x78fe('0x4b')]));_0x14275f[_0x78fe('0x3c')]=_0x14275f[_0x78fe('0x3c')][_0x78fe('0x3d')]?_0x14275f['attributes']:_0x19b3b4[_0x78fe('0x36')];if(_0x393cc5['query'][_0x78fe('0x4c')]){_0x14275f[_0x78fe('0x4d')]=[{'all':!![]}];}_0x14275f=_[_0x78fe('0x44')]({},_0x14275f,_0x393cc5[_0x78fe('0x4e')]);return db[_0x78fe('0x46')]['find'](_0x14275f)[_0x78fe('0x2a')](handleEntityNotFound(_0x3e64f8,null))[_0x78fe('0x2a')](respondWithResult(_0x3e64f8,null))[_0x78fe('0x4f')](handleError(_0x3e64f8,null));};exports[_0x78fe('0x50')]=function(_0x341dcd,_0x20b72f){return db[_0x78fe('0x46')]['create'](_0x341dcd[_0x78fe('0x51')],{})[_0x78fe('0x2a')](function(_0x27d139){var _0x175136=_0x341dcd['user'][_0x78fe('0x2b')]({'plain':!![]});if(!_0x175136)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175136[_0x78fe('0x52')]==='user'){var _0x593c84=_0x27d139['get']({'plain':!![]});var _0x489aa4=_0x78fe('0x2c');return db[_0x78fe('0x53')][_0x78fe('0x54')]({'where':{'name':_0x489aa4,'userProfileId':_0x175136['userProfileId']},'raw':!![]})['then'](function(_0x4a9a0a){if(_0x4a9a0a&&_0x4a9a0a[_0x78fe('0x55')]===0x0){return db[_0x78fe('0x2d')][_0x78fe('0x50')]({'name':_0x593c84[_0x78fe('0x37')],'resourceId':_0x593c84['id'],'type':_0x4a9a0a['name'],'sectionId':_0x4a9a0a['id']},{})[_0x78fe('0x2a')](function(){return _0x27d139;});}else{return _0x27d139;}})['catch'](function(_0x113532){logger[_0x78fe('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113532);throw _0x113532;});}return _0x27d139;})[_0x78fe('0x2a')](respondWithResult(_0x20b72f,0xc9))[_0x78fe('0x4f')](handleError(_0x20b72f,null));};exports[_0x78fe('0x29')]=function(_0x2327ad,_0x38e177){if(_0x2327ad[_0x78fe('0x51')]['id']){delete _0x2327ad[_0x78fe('0x51')]['id'];}return db['CmList'][_0x78fe('0x54')]({'where':{'id':_0x2327ad[_0x78fe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38e177,null))[_0x78fe('0x2a')](saveUpdates(_0x2327ad[_0x78fe('0x51')],null))[_0x78fe('0x2a')](respondWithResult(_0x38e177,null))[_0x78fe('0x4f')](handleError(_0x38e177,null));};exports['destroy']=function(_0xca3550,_0x467dee){return db[_0x78fe('0x46')][_0x78fe('0x54')]({'where':{'id':_0xca3550['params']['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x467dee,null))[_0x78fe('0x2a')](removeEntity(_0x467dee,null))[_0x78fe('0x4f')](handleError(_0x467dee,null));};exports[_0x78fe('0x56')]=function(_0x597860,_0x57abcc){return db['CmList']['describe']()['then'](respondWithResult(_0x57abcc,null))[_0x78fe('0x4f')](handleError(_0x57abcc,null));};exports['addDisposition']=function(_0x48da8b,_0x49c7d3,_0x3593fd){if(_0x48da8b['body']['id']){delete _0x48da8b[_0x78fe('0x51')]['id'];}return db[_0x78fe('0x46')][_0x78fe('0x54')]({'where':{'id':_0x48da8b[_0x78fe('0x4a')]['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x49c7d3,null))[_0x78fe('0x2a')](function(_0xa36917){if(_0xa36917){_0x48da8b['body'][_0x78fe('0x57')]=_0xa36917['id'];return db[_0x78fe('0x58')][_0x78fe('0x50')](_0x48da8b['body']);}})['then'](respondWithResult(_0x49c7d3,null))[_0x78fe('0x4f')](handleError(_0x49c7d3,null));};exports[_0x78fe('0x59')]=function(_0x346384,_0x4f7c0d,_0x5cda1a){var _0x29b110={'raw':![],'where':{}};var _0x846126={};var _0x2330d={'count':0x0,'rows':[]};return db[_0x78fe('0x46')][_0x78fe('0x5a')]({'where':{'id':_0x346384[_0x78fe('0x4a')]['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x4f7c0d,null))[_0x78fe('0x2a')](function(_0x3b9cf0){if(_0x3b9cf0){_0x846126['model']=_[_0x78fe('0x39')](db[_0x78fe('0x58')][_0x78fe('0x34')]);_0x846126['query']=_[_0x78fe('0x39')](_0x346384[_0x78fe('0x38')]);_0x846126[_0x78fe('0x3a')]=_[_0x78fe('0x3b')](_0x846126['model'],_0x846126[_0x78fe('0x38')]);_0x29b110[_0x78fe('0x3c')]=_[_0x78fe('0x3b')](_0x846126['model'],qs[_0x78fe('0x4b')](_0x346384[_0x78fe('0x38')][_0x78fe('0x4b')]));_0x29b110['attributes']=_0x29b110[_0x78fe('0x3c')]['length']?_0x29b110[_0x78fe('0x3c')]:_0x846126[_0x78fe('0x36')];if(!_0x346384[_0x78fe('0x38')][_0x78fe('0x5b')]('nolimit')){_0x29b110[_0x78fe('0x24')]=qs[_0x78fe('0x24')](_0x346384[_0x78fe('0x38')][_0x78fe('0x24')]);_0x29b110[_0x78fe('0x22')]=qs[_0x78fe('0x22')](_0x346384[_0x78fe('0x38')][_0x78fe('0x22')]);}_0x29b110[_0x78fe('0x3f')]=qs[_0x78fe('0x40')](_0x346384['query'][_0x78fe('0x40')]);_0x29b110[_0x78fe('0x41')]=qs[_0x78fe('0x3a')](_[_0x78fe('0x42')](_0x346384[_0x78fe('0x38')],_0x846126[_0x78fe('0x3a')]));_0x29b110[_0x78fe('0x41')]['ListId']=_0x3b9cf0['id'];if(_0x346384[_0x78fe('0x38')][_0x78fe('0x43')]){_0x29b110['where']=_[_0x78fe('0x44')](_0x29b110['where'],{'$or':_['map'](_0x29b110['attributes'],function(_0x4c9f3e){var _0x1505c8={};_0x1505c8[_0x4c9f3e]={'$like':'%'+_0x346384['query'][_0x78fe('0x43')]+'%'};return _0x1505c8;})});}_0x29b110=_[_0x78fe('0x44')]({},_0x29b110,_0x346384[_0x78fe('0x4e')]);return db[_0x78fe('0x58')][_0x78fe('0x25')]({'where':_0x29b110[_0x78fe('0x41')]})[_0x78fe('0x2a')](function(_0x47ecc4){_0x2330d[_0x78fe('0x25')]=_0x47ecc4;if(_0x346384['query'][_0x78fe('0x4c')]){_0x29b110[_0x78fe('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0x78fe('0x47')](_0x29b110);})[_0x78fe('0x2a')](function(_0x4046b1){_0x2330d[_0x78fe('0x48')]=_0x4046b1;return _0x2330d;});}})['then'](respondWithFilteredResult(_0x4f7c0d,_0x29b110))[_0x78fe('0x4f')](handleError(_0x4f7c0d,null));};exports[_0x78fe('0x5c')]=function(_0x47a4fc,_0x442ad8,_0x105c32){return db[_0x78fe('0x46')]['find']({'where':{'id':_0x47a4fc[_0x78fe('0x4a')]['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x442ad8,null))['then'](function(_0x47bbda){if(_0x47bbda){return _0x47bbda[_0x78fe('0x5c')](_0x47a4fc[_0x78fe('0x38')]['ids']);}})[_0x78fe('0x2a')](respondWithStatusCode(_0x442ad8,null))[_0x78fe('0x4f')](handleError(_0x442ad8,null));};exports[_0x78fe('0x5d')]=function(_0x3abe81,_0x5bf547,_0x245ee8){return db[_0x78fe('0x46')][_0x78fe('0x54')]({'where':{'id':_0x3abe81[_0x78fe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bf547,null))[_0x78fe('0x2a')](function(_0x22bb5c){if(_0x22bb5c){var _0x571adb=[];var _0x2660ee={'success':[],'errors':[]};return db['CmContact'][_0x78fe('0x56')]()['then'](function(_0x405fe3){if(_0x3abe81['body'][_0x78fe('0x5e')]&&_[_0x78fe('0x5f')](_0x3abe81['body'][_0x78fe('0x5e')])){if(_0x3abe81[_0x78fe('0x51')][_0x78fe('0x5e')]['length']){_0x3abe81['body']['tags']=_0x3abe81[_0x78fe('0x51')]['tags'][_0x78fe('0x60')](';')+';';}else{_0x3abe81[_0x78fe('0x51')][_0x78fe('0x5e')]=null;}}else{_0x3abe81[_0x78fe('0x51')][_0x78fe('0x5e')]=null;}if(_0x3abe81[_0x78fe('0x51')]&&_[_0x78fe('0x5f')](_0x3abe81[_0x78fe('0x51')])){for(var _0x3d3a67=0x0;_0x3d3a67<_0x3abe81['body'][_0x78fe('0x3d')];_0x3d3a67+=0x1){_0x3abe81[_0x78fe('0x51')][_0x3d3a67][_0x78fe('0x57')]=_0x3abe81[_0x78fe('0x4a')]['id'];_0x571adb['push'](_0x3abe81[_0x78fe('0x51')][_0x3d3a67]);}return BPromise[_0x78fe('0x61')](_0x571adb,function(_0x3a6d56){return db['CmContact'][_0x78fe('0x50')](_[_0x78fe('0x62')](_0x3a6d56,['ids','id'])||{},{'fields':_[_0x78fe('0x39')](_0x405fe3),'raw':!![]})[_0x78fe('0x2a')](function(_0x2d5f6c){_0x2660ee[_0x78fe('0x63')][_0x78fe('0x64')](_0x2d5f6c[_0x78fe('0x65')]);})['catch'](function(_0x4b148f){_0x2660ee['errors']['push']({'data':_0x3a6d56,'error':_0x4b148f['message']});});})[_0x78fe('0x2a')](function(_0xcae48){return _0x2660ee;})[_0x78fe('0x4f')](function(_0x1e3cd9){return _0x1e3cd9;});}else{_0x5bf547[_0x78fe('0x20')](0x190)[_0x78fe('0x66')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x78fe('0x2a')](respondWithResult(_0x5bf547,null))[_0x78fe('0x4f')](handleError(_0x5bf547,null));};exports[_0x78fe('0x67')]=function(_0x1eb079,_0x3e3777,_0x3c70be){var _0x3f1500;return db['CmList']['find']({'where':{'id':_0x1eb079['params']['id']},'include':[{'model':db[_0x78fe('0x68')],'as':_0x78fe('0x69')}]})[_0x78fe('0x2a')](handleEntityNotFound(_0x3e3777,null))[_0x78fe('0x2a')](function(_0x2b5e8c){if(_0x2b5e8c){_0x3f1500=_0x2b5e8c;return db[_0x78fe('0x6a')][_0x78fe('0x34')];}})['then'](function(_0x35c2e9){if(_0x35c2e9){var _0x2071fb={};var _0x38a8d6={};_0x38a8d6['model']=_[_0x78fe('0x6b')](_['keys'](_0x35c2e9),_[_0x78fe('0x33')](_0x3f1500[_0x78fe('0x69')],function(_0x4aea97){return util[_0x78fe('0x6c')](_0x78fe('0x6d'),_0x4aea97['id']);}));_0x38a8d6[_0x78fe('0x38')]=_[_0x78fe('0x39')](_0x1eb079['query']);_0x38a8d6[_0x78fe('0x3a')]=_[_0x78fe('0x3b')](_0x38a8d6[_0x78fe('0x36')],_0x38a8d6[_0x78fe('0x38')]);_0x2071fb[_0x78fe('0x3c')]=_[_0x78fe('0x3b')](_0x38a8d6['model'],qs[_0x78fe('0x4b')](_0x1eb079['query'][_0x78fe('0x4b')]));_0x2071fb[_0x78fe('0x3c')]=_0x2071fb[_0x78fe('0x3c')][_0x78fe('0x3d')]?_0x2071fb[_0x78fe('0x3c')]:_0x38a8d6[_0x78fe('0x36')];if(!_0x1eb079['query']['hasOwnProperty'](_0x78fe('0x3e'))){_0x2071fb[_0x78fe('0x24')]=qs['limit'](_0x1eb079[_0x78fe('0x38')]['limit']);_0x2071fb[_0x78fe('0x22')]=qs['offset'](_0x1eb079['query'][_0x78fe('0x22')]);}_0x2071fb['order']=qs[_0x78fe('0x40')](_0x1eb079[_0x78fe('0x38')][_0x78fe('0x40')]);_0x2071fb[_0x78fe('0x41')]=qs['filters'](_['pick'](_0x1eb079[_0x78fe('0x38')],_0x38a8d6[_0x78fe('0x3a')]));_0x2071fb[_0x78fe('0x6e')]=!![];if(_0x1eb079[_0x78fe('0x38')][_0x78fe('0x43')]){_0x2071fb[_0x78fe('0x41')]=_[_0x78fe('0x44')](_0x2071fb[_0x78fe('0x41')],{'$or':_[_0x78fe('0x33')](_0x2071fb[_0x78fe('0x3c')],function(_0x1e0e3e){var _0x25dfaa={};_0x25dfaa[_0x1e0e3e]={'$like':'%'+_0x1eb079[_0x78fe('0x38')]['filter']+'%'};return _0x25dfaa;})});}_0x2071fb=_['merge']({},_0x2071fb,_0x1eb079[_0x78fe('0x4e')]);return _0x3f1500[_0x78fe('0x67')](_0x2071fb);}})[_0x78fe('0x2a')](respondWithResult(_0x3e3777,null))['catch'](handleError(_0x3e3777,null));};exports[_0x78fe('0x6f')]=function(_0x166c6d,_0x16aebc,_0x2aabe3){var _0x382af9;var _0x301fd2;var _0x2883be;var _0x4844e6=_0x166c6d['params']['id'];csv_results=[];return db[_0x78fe('0x70')][_0x78fe('0x47')]({'attributes':['id',_0x78fe('0x37')],'raw':!![],'order':[_0x78fe('0x71')]})[_0x78fe('0x2a')](function(_0x108186){_0x382af9=_0x108186;var _0x46c783=_[_0x78fe('0x39')](db[_0x78fe('0x6a')][_0x78fe('0x34')]);return db[_0x78fe('0x68')][_0x78fe('0x47')]({'raw':!![],'attributes':['id','alias']})[_0x78fe('0x2a')](function(_0xa00dc5){_0x301fd2=_0xa00dc5;var _0x3a5bb4=squel[_0x78fe('0x72')]()[_0x78fe('0x4b')](_0x46c783)[_0x78fe('0x73')](_0x78fe('0x74'),'c')['where'](_0x78fe('0x75'),_0x4844e6)[_0x78fe('0x41')](_0x78fe('0x76'))[_0x78fe('0x77')]();for(var _0x383dfd=0x0;_0x383dfd<_0x301fd2[_0x78fe('0x3d')];_0x383dfd++){_0x3a5bb4[_0x78fe('0x78')](_0x78fe('0x79')+_0x301fd2[_0x383dfd]['id'],_0x78fe('0x7a')+_0x301fd2[_0x383dfd][_0x78fe('0x7b')]);}for(var _0x383dfd=0x0;_0x383dfd<_0x382af9[_0x78fe('0x3d')];_0x383dfd++){_0x3a5bb4[_0x78fe('0x78')](squel['select']()[_0x78fe('0x78')](_0x78fe('0x7c'))[_0x78fe('0x73')]('cm_contact_has_items')[_0x78fe('0x41')](_0x78fe('0x7d'),_0x382af9[_0x383dfd]['id'])[_0x78fe('0x41')](_0x78fe('0x7e')),_0x78fe('0x7f')+_0x382af9[_0x383dfd][_0x78fe('0x37')]);_0x3a5bb4[_0x78fe('0x78')](squel[_0x78fe('0x72')]()[_0x78fe('0x78')](_0x78fe('0x80'))[_0x78fe('0x73')]('cm_contact_has_items')[_0x78fe('0x41')](_0x78fe('0x7d'),_0x382af9[_0x383dfd]['id'])[_0x78fe('0x41')](_0x78fe('0x7e')),'description_additionalPhone_'+_0x382af9[_0x383dfd][_0x78fe('0x37')]);}var _0x3a2ddb=[];_0x3a2ddb['push'](_0x3a5bb4['toString']());BPromise['each'](_0x3a2ddb,handleQuery)[_0x78fe('0x2a')](function(_0x3f28ae){handleQuery(_0x3a5bb4[_0x78fe('0x81')]());var _0x3dca90=csv_results[0x0];if(!_['isEmpty'](_0x3dca90)){var _0x4a424f=toCsv(_0x3dca90);var _0x2288ca=Date[_0x78fe('0x82')]();fs[_0x78fe('0x83')](util['format'](_0x78fe('0x84'),_0x4844e6,_0x2288ca),_0x4a424f);_0x16aebc['setHeader'](_0x78fe('0x85'),_0x78fe('0x86')+util['format'](_0x78fe('0x87'),_0x4844e6,_0x2288ca));_0x16aebc['setHeader'](_0x78fe('0x88'),'text/csv');return _0x16aebc[_0x78fe('0x89')](util['format'](_0x78fe('0x84'),_0x4844e6,_0x2288ca));}else{return _0x16aebc[_0x78fe('0x1f')](0xcc);}});});});};exports[_0x78fe('0x8a')]=function(_0x129b80,_0xb6a440,_0x2083b2){var _0x4453c3;delete _0x129b80['body']['id'];return db[_0x78fe('0x46')][_0x78fe('0x5a')]({'where':{'id':_0x129b80[_0x78fe('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb6a440,null))[_0x78fe('0x2a')](function(_0x529271){if(_0x529271){return db['sequelize'][_0x78fe('0x8b')](function(_0x307da8){return db[_0x78fe('0x68')][_0x78fe('0x50')](_0x129b80[_0x78fe('0x51')],{'transaction':_0x307da8})[_0x78fe('0x2a')](function(_0x1266c9){_0x4453c3=_0x1266c9;return _0x529271['addCustomFields'](_0x1266c9,{'transaction':_0x307da8});})['then'](function(){var _0xf792bf={'type':db[_0x78fe('0x8c')]['TEXT'],'transaction':_0x307da8};switch(_0x129b80[_0x78fe('0x51')][_0x78fe('0x35')]){case _0x78fe('0x8d'):_0xf792bf['type']=db[_0x78fe('0x8c')][_0x78fe('0x8e')];break;case _0x78fe('0x8f'):_0xf792bf[_0x78fe('0x35')]=db[_0x78fe('0x8c')]['INTEGER'];break;case'switch':_0xf792bf['type']=db[_0x78fe('0x8c')][_0x78fe('0x90')];_0xf792bf[_0x78fe('0x91')]=![];break;default:}return db['sequelize'][_0x78fe('0x92')]['addColumn'](_0x78fe('0x74'),util[_0x78fe('0x6c')](_0x78fe('0x93'),_0x4453c3['id']),_0xf792bf);})[_0x78fe('0x2a')](function(){return _0x4453c3;});});}})[_0x78fe('0x2a')](respondWithResult(_0xb6a440,null))[_0x78fe('0x4f')](handleError(_0xb6a440,null));};exports['getCustomFields']=function(_0x20b458,_0x20d7ed,_0x436ce6){var _0x734492={};var _0x498274={};var _0x377271;var _0x16465c;return db[_0x78fe('0x46')]['findOne']({'where':{'id':_0x20b458[_0x78fe('0x4a')]['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x20d7ed,null))['then'](function(_0xc79571){if(_0xc79571){_0x377271=_0xc79571;_0x498274[_0x78fe('0x36')]=_[_0x78fe('0x39')](db[_0x78fe('0x68')][_0x78fe('0x34')]);_0x498274[_0x78fe('0x38')]=_[_0x78fe('0x39')](_0x20b458[_0x78fe('0x38')]);_0x498274[_0x78fe('0x3a')]=_[_0x78fe('0x3b')](_0x498274[_0x78fe('0x36')],_0x498274[_0x78fe('0x38')]);_0x734492[_0x78fe('0x3c')]=_[_0x78fe('0x3b')](_0x498274[_0x78fe('0x36')],qs[_0x78fe('0x4b')](_0x20b458['query'][_0x78fe('0x4b')]));_0x734492[_0x78fe('0x3c')]=_0x734492['attributes'][_0x78fe('0x3d')]?_0x734492[_0x78fe('0x3c')]:_0x498274['model'];_0x734492[_0x78fe('0x3f')]=qs[_0x78fe('0x40')](_0x20b458[_0x78fe('0x38')]['sort']);_0x734492[_0x78fe('0x41')]=qs[_0x78fe('0x3a')](_[_0x78fe('0x42')](_0x20b458[_0x78fe('0x38')],_0x498274[_0x78fe('0x3a')]));_0x734492['where']=_[_0x78fe('0x44')](_0x734492[_0x78fe('0x41')],{'$or':[{'ListId':_0xc79571['id']},{'ListId':null}]});if(_0x20b458[_0x78fe('0x38')][_0x78fe('0x43')]){_0x734492['where']=_[_0x78fe('0x44')](_0x734492['where'],{'$or':_['map'](_0x734492[_0x78fe('0x3c')],function(_0x6e1cae){var _0x5295c={};_0x5295c[_0x6e1cae]={'$like':'%'+_0x20b458['query']['filter']+'%'};return _0x5295c;})});}_0x734492=_['merge']({},_0x734492,_0x20b458[_0x78fe('0x4e')]);return db[_0x78fe('0x68')]['findAndCountAll'](_0x734492);}})[_0x78fe('0x2a')](respondWithResult(_0x20d7ed,null))['catch'](handleError(_0x20d7ed,null));};exports[_0x78fe('0x94')]=function(_0x4ba3d4,_0x76e1be){return db[_0x78fe('0x68')][_0x78fe('0x95')]({'where':{'ListId':null}})[_0x78fe('0x2a')](handleEntityNotFound(_0x76e1be,null))['then'](function(_0x4deaf6){return _0x4deaf6;})[_0x78fe('0x2a')](respondWithResult(_0x76e1be,null))[_0x78fe('0x4f')](handleError(_0x76e1be,null));};exports[_0x78fe('0x96')]=function(_0x3e99af,_0x1d85c2,_0x1de52e){return db[_0x78fe('0x46')][_0x78fe('0x54')]({'where':{'id':_0x3e99af[_0x78fe('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d85c2,null))[_0x78fe('0x2a')](function(_0x77e470){if(_0x77e470){return _0x77e470[_0x78fe('0x96')](_0x3e99af[_0x78fe('0x51')][_0x78fe('0x97')],_[_0x78fe('0x62')](_0x3e99af[_0x78fe('0x51')],[_0x78fe('0x97'),'id'])||{})[_0x78fe('0x98')](function(_0x330ade){for(var _0x1ad574=0x0;_0x1ad574<_0x3e99af['body'][_0x78fe('0x97')]['length'];_0x1ad574+=0x1){socket['emit'](_0x78fe('0x99'),{'UserId':Number(_0x3e99af[_0x78fe('0x51')][_0x78fe('0x97')][_0x1ad574]),'CmListId':Number(_0x3e99af[_0x78fe('0x4a')]['id'])});}return _0x330ade;});}})[_0x78fe('0x2a')](respondWithResult(_0x1d85c2,null))['catch'](handleError(_0x1d85c2,null));};exports[_0x78fe('0x9a')]=function(_0x4d596,_0x471b95,_0x178f94){return db[_0x78fe('0x46')]['find']({'where':{'id':_0x4d596[_0x78fe('0x4a')]['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x471b95,null))[_0x78fe('0x2a')](function(_0x10f108){if(_0x10f108){return _0x10f108[_0x78fe('0x9a')](_0x4d596[_0x78fe('0x38')][_0x78fe('0x97')])[_0x78fe('0x2a')](function(){if(_[_0x78fe('0x5f')](_0x4d596[_0x78fe('0x38')][_0x78fe('0x97')])){for(var _0xbceccb=0x0;_0xbceccb<_0x4d596['query']['ids'][_0x78fe('0x3d')];_0xbceccb+=0x1){socket[_0x78fe('0x9b')](_0x78fe('0x9c'),{'UserId':Number(_0x4d596['query'][_0x78fe('0x97')][_0xbceccb]),'CmListId':Number(_0x4d596[_0x78fe('0x4a')]['id'])});}}else{socket[_0x78fe('0x9b')]('userCmList:remove',{'UserId':Number(_0x4d596['query'][_0x78fe('0x97')]),'CmListId':Number(_0x4d596[_0x78fe('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x471b95,null))[_0x78fe('0x4f')](handleError(_0x471b95,null));};exports[_0x78fe('0x9d')]=function(_0x3e6b14,_0x4fc5bf,_0x1258e0){var _0x43353b={};var _0x30d05a={};var _0x371d04;var _0x1511c0;return db[_0x78fe('0x46')][_0x78fe('0x5a')]({'where':{'id':_0x3e6b14['params']['id']}})[_0x78fe('0x2a')](handleEntityNotFound(_0x4fc5bf,null))[_0x78fe('0x2a')](function(_0xf0138a){if(_0xf0138a){_0x371d04=_0xf0138a;_0x30d05a[_0x78fe('0x36')]=_[_0x78fe('0x39')](db[_0x78fe('0x9e')][_0x78fe('0x34')]);_0x30d05a[_0x78fe('0x38')]=_[_0x78fe('0x39')](_0x3e6b14['query']);_0x30d05a[_0x78fe('0x3a')]=_[_0x78fe('0x3b')](_0x30d05a[_0x78fe('0x36')],_0x30d05a[_0x78fe('0x38')]);_0x43353b[_0x78fe('0x3c')]=_[_0x78fe('0x3b')](_0x30d05a[_0x78fe('0x36')],qs[_0x78fe('0x4b')](_0x3e6b14[_0x78fe('0x38')][_0x78fe('0x4b')]));_0x43353b[_0x78fe('0x3c')]=_0x43353b[_0x78fe('0x3c')]['length']?_0x43353b[_0x78fe('0x3c')]:_0x30d05a['model'];_0x43353b[_0x78fe('0x3f')]=qs[_0x78fe('0x40')](_0x3e6b14['query'][_0x78fe('0x40')]);_0x43353b['where']=qs[_0x78fe('0x3a')](_[_0x78fe('0x42')](_0x3e6b14[_0x78fe('0x38')],_0x30d05a[_0x78fe('0x3a')]));if(_0x3e6b14[_0x78fe('0x38')]['filter']){_0x43353b[_0x78fe('0x41')]=_[_0x78fe('0x44')](_0x43353b[_0x78fe('0x41')],{'$or':_[_0x78fe('0x33')](_0x43353b[_0x78fe('0x3c')],function(_0x27cfd9){var _0x707193={};_0x707193[_0x27cfd9]={'$like':'%'+_0x3e6b14[_0x78fe('0x38')][_0x78fe('0x43')]+'%'};return _0x707193;})});}_0x43353b=_[_0x78fe('0x44')]({},_0x43353b,_0x3e6b14[_0x78fe('0x4e')]);return _0x371d04['getAgents'](_0x43353b);}})[_0x78fe('0x2a')](function(_0x11d2c9){if(_0x11d2c9){_0x1511c0=_0x11d2c9['length'];if(!_0x3e6b14['query'][_0x78fe('0x5b')]('nolimit')){_0x43353b[_0x78fe('0x24')]=qs[_0x78fe('0x24')](_0x3e6b14[_0x78fe('0x38')][_0x78fe('0x24')]);_0x43353b[_0x78fe('0x22')]=qs[_0x78fe('0x22')](_0x3e6b14[_0x78fe('0x38')][_0x78fe('0x22')]);}return _0x371d04[_0x78fe('0x9d')](_0x43353b);}})[_0x78fe('0x2a')](function(_0x406934){if(_0x406934){return _0x406934?{'count':_0x1511c0,'rows':_0x406934}:null;}})[_0x78fe('0x2a')](respondWithResult(_0x4fc5bf,null))[_0x78fe('0x4f')](handleError(_0x4fc5bf,null));};function handleQuery(_0x2e3d20){logger[_0x78fe('0x9f')](_0x2e3d20);return db[_0x78fe('0xa0')][_0x78fe('0x38')](_0x2e3d20)[_0x78fe('0x98')](function(_0x3f2750){csv_results[_0x78fe('0x64')](_0x3f2750);})[_0x78fe('0x4f')](function(_0x1d15e8){logger['error'](_0x1d15e8[_0x78fe('0xa1')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b31b180..5cfcc15 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x330791,_0x511c3b){_0x330791=_0x330791-0x0;var _0x2fda3d=_0x3e74[_0x330791];return _0x2fda3d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 72a4e94..7aaf557 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 _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x163864,_0x58ee4f){var _0x4fba17=function(_0x4fb909){while(--_0x4fb909){_0x163864['push'](_0x163864['shift']());}};_0x4fba17(++_0x58ee4f);}(_0xbec5,0xe5));var _0x5bec=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xbec5[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x339781,_0xe299e9){var _0x5cfb6a=function(_0x37f3de){while(--_0x37f3de){_0x339781['push'](_0x339781['shift']());}};_0x5cfb6a(++_0xe299e9);}(_0x1339,0x1ed));var _0x9133=function(_0x132723,_0x324e89){_0x132723=_0x132723-0x0;var _0x3d73e1=_0x1339[_0x132723];return _0x3d73e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'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 fc8e763..71bf8aa 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 _0x21e0=['client','redis','defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x21e0,0x1ec));var _0x021e=function(_0x376e4f,_0x1b24be){_0x376e4f=_0x376e4f-0x0;var _0x49ed37=_0x21e0[_0x376e4f];return _0x49ed37;};'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('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x021e('0x5'));var logger=require('../../config/logger')(_0x021e('0x6'));var config=require(_0x021e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x021e('0x8')]['http']({'port':0x232a});config[_0x021e('0x9')]=_[_0x021e('0xa')](config[_0x021e('0x9')],{'host':_0x021e('0xb'),'port':0x18eb});var socket=require(_0x021e('0xc'))(new Redis(config[_0x021e('0x9')]));require('./cmList.socket')[_0x021e('0xd')](socket);function respondWithRpcPromise(_0x205cf2,_0x190d0c,_0x43a086){return new BPromise(function(_0x358337,_0x264140){return client[_0x021e('0xe')](_0x205cf2,_0x43a086)[_0x021e('0xf')](function(_0x5bb699){logger['info'](_0x021e('0x10'),_0x190d0c,_0x021e('0x11'));logger['debug'](_0x021e('0x12'),_0x190d0c,_0x021e('0x11'),JSON[_0x021e('0x13')](_0x5bb699));if(_0x5bb699['error']){if(_0x5bb699[_0x021e('0x14')][_0x021e('0x15')]===0x1f4){logger[_0x021e('0x14')](_0x021e('0x10'),_0x190d0c,_0x5bb699['error'][_0x021e('0x16')]);return _0x264140(_0x5bb699['error'][_0x021e('0x16')]);}logger[_0x021e('0x14')](_0x021e('0x10'),_0x190d0c,_0x5bb699[_0x021e('0x14')]['message']);return _0x358337(_0x5bb699[_0x021e('0x14')]['message']);}else{logger['info'](_0x021e('0x10'),_0x190d0c,_0x021e('0x11'));_0x358337(_0x5bb699[_0x021e('0x17')][_0x021e('0x16')]);}})[_0x021e('0x18')](function(_0x1e5c6e){logger['error'](_0x021e('0x10'),_0x190d0c,_0x1e5c6e);_0x264140(_0x1e5c6e);});});} \ No newline at end of file +var _0x44ff=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45c656,_0x260921){var _0x4ce588=function(_0x14b917){while(--_0x14b917){_0x45c656['push'](_0x45c656['shift']());}};_0x4ce588(++_0x260921);}(_0x44ff,0x100));var _0xf44f=function(_0x44e4a1,_0x3d053a){_0x44e4a1=_0x44e4a1-0x0;var _0x546ad3=_0x44ff[_0x44e4a1];return _0x546ad3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf44f('0x0'));var BPromise=require(_0xf44f('0x1'));var rs=require(_0xf44f('0x2'));var fs=require('fs');var Redis=require(_0xf44f('0x3'));var db=require(_0xf44f('0x4'))['db'];var utils=require(_0xf44f('0x5'));var logger=require(_0xf44f('0x6'))(_0xf44f('0x7'));var config=require(_0xf44f('0x8'));var jayson=require(_0xf44f('0x9'));var client=jayson[_0xf44f('0xa')][_0xf44f('0xb')]({'port':0x232a});config[_0xf44f('0xc')]=_[_0xf44f('0xd')](config[_0xf44f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf44f('0xe'))(new Redis(config['redis']));require(_0xf44f('0xf'))[_0xf44f('0x10')](socket);function respondWithRpcPromise(_0x2cebfa,_0x2450bf,_0xb364f1){return new BPromise(function(_0x35655f,_0x111f3d){return client[_0xf44f('0x11')](_0x2cebfa,_0xb364f1)[_0xf44f('0x12')](function(_0x161920){logger[_0xf44f('0x13')](_0xf44f('0x14'),_0x2450bf,'request\x20sent');logger[_0xf44f('0x15')](_0xf44f('0x16'),_0x2450bf,_0xf44f('0x17'),JSON[_0xf44f('0x18')](_0x161920));if(_0x161920['error']){if(_0x161920[_0xf44f('0x19')][_0xf44f('0x1a')]===0x1f4){logger[_0xf44f('0x19')](_0xf44f('0x14'),_0x2450bf,_0x161920[_0xf44f('0x19')][_0xf44f('0x1b')]);return _0x111f3d(_0x161920[_0xf44f('0x19')][_0xf44f('0x1b')]);}logger[_0xf44f('0x19')]('CmList,\x20%s,\x20%s',_0x2450bf,_0x161920[_0xf44f('0x19')][_0xf44f('0x1b')]);return _0x35655f(_0x161920['error'][_0xf44f('0x1b')]);}else{logger['info'](_0xf44f('0x14'),_0x2450bf,_0xf44f('0x17'));_0x35655f(_0x161920[_0xf44f('0x1c')][_0xf44f('0x1b')]);}})['catch'](function(_0x4f65e5){logger['error']('CmList,\x20%s,\x20%s',_0x2450bf,_0x4f65e5);_0x111f3d(_0x4f65e5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index ccc5e9c..ba670fa 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 _0x8450=['remove','emit','register','length','cmList:','./cmList.events','save'];(function(_0x390264,_0x4fde3b){var _0x20e2c4=function(_0xd96926){while(--_0xd96926){_0x390264['push'](_0x390264['shift']());}};_0x20e2c4(++_0x4fde3b);}(_0x8450,0x1da));var _0x0845=function(_0x2c158e,_0xb3a3e6){_0x2c158e=_0x2c158e-0x0;var _0x32a4cc=_0x8450[_0x2c158e];return _0x32a4cc;};'use strict';var CmListEvents=require(_0x0845('0x0'));var events=[_0x0845('0x1'),_0x0845('0x2'),'update'];function createListener(_0x15dbbc,_0x28640d){return function(_0x573e6d){_0x28640d[_0x0845('0x3')](_0x15dbbc,_0x573e6d);};}function removeListener(_0x4faca3,_0xca35ae){return function(){CmListEvents['removeListener'](_0x4faca3,_0xca35ae);};}exports[_0x0845('0x4')]=function(_0x309988){for(var _0x5dc5d0=0x0,_0x418494=events[_0x0845('0x5')];_0x5dc5d0<_0x418494;_0x5dc5d0++){var _0x2d2a26=events[_0x5dc5d0];var _0x26ff68=createListener(_0x0845('0x6')+_0x2d2a26,_0x309988);CmListEvents['on'](_0x2d2a26,_0x26ff68);}}; \ No newline at end of file +var _0x8ae5=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x1f5896,_0x26f433){var _0x4b768d=function(_0x50c971){while(--_0x50c971){_0x1f5896['push'](_0x1f5896['shift']());}};_0x4b768d(++_0x26f433);}(_0x8ae5,0xab));var _0x58ae=function(_0x17f85e,_0x4ef5f5){_0x17f85e=_0x17f85e-0x0;var _0x2abad5=_0x8ae5[_0x17f85e];return _0x2abad5;};'use strict';var CmListEvents=require(_0x58ae('0x0'));var events=[_0x58ae('0x1'),_0x58ae('0x2'),_0x58ae('0x3')];function createListener(_0x392e4e,_0x2f3b82){return function(_0x2dfd1b){_0x2f3b82[_0x58ae('0x4')](_0x392e4e,_0x2dfd1b);};}function removeListener(_0x464fbb,_0x898c59){return function(){CmListEvents[_0x58ae('0x5')](_0x464fbb,_0x898c59);};}exports[_0x58ae('0x6')]=function(_0x129865){for(var _0xba23e0=0x0,_0x14a4e0=events[_0x58ae('0x7')];_0xba23e0<_0x14a4e0;_0xba23e0++){var _0x59f192=events[_0xba23e0];var _0x5b520a=createListener(_0x58ae('0x8')+_0x59f192,_0x129865);CmListEvents['on'](_0x59f192,_0x5b520a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index c4b8017..9322a1b 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 _0xfa7a=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x556aba,_0x16134a){_0x556aba=_0x556aba-0x0;var _0x2c26c9=_0xfa7a[_0x556aba];return _0x2c26c9;};'use strict';var multer=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var path=require(_0xafa7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xafa7('0x3')]();var fs_extra=require(_0xafa7('0x4'));var auth=require(_0xafa7('0x5'));var interaction=require(_0xafa7('0x6'));var config=require('../../config/environment');var controller=require(_0xafa7('0x7'));router[_0xafa7('0x8')]('/',auth[_0xafa7('0x9')](),controller[_0xafa7('0xa')]);router[_0xafa7('0x8')](_0xafa7('0xb'),auth[_0xafa7('0x9')](),controller[_0xafa7('0xc')]);router['get'](_0xafa7('0xd'),auth['isAuthenticated'](),controller[_0xafa7('0xe')]);router[_0xafa7('0x8')]('/:id',auth[_0xafa7('0x9')](),controller[_0xafa7('0xf')]);router[_0xafa7('0x8')](_0xafa7('0x10'),auth[_0xafa7('0x9')](),controller[_0xafa7('0x11')]);router[_0xafa7('0x8')](_0xafa7('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0xafa7('0x8')]('/:id/contacts/csv',auth[_0xafa7('0x9')](),controller[_0xafa7('0x13')]);router['get'](_0xafa7('0x14'),auth['isAuthenticated'](),controller[_0xafa7('0x15')]);router['get'](_0xafa7('0x16'),auth[_0xafa7('0x9')](),controller['getAgents']);router[_0xafa7('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0xafa7('0x17')]('/:id/dispositions',auth[_0xafa7('0x9')](),controller['addDisposition']);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0xafa7('0x18')]);router['post'](_0xafa7('0x14'),auth[_0xafa7('0x9')](),controller[_0xafa7('0x19')]);router['post'](_0xafa7('0x16'),auth['isAuthenticated'](),controller[_0xafa7('0x1a')]);router['put'](_0xafa7('0x1b'),auth[_0xafa7('0x9')](),controller[_0xafa7('0x1c')]);router[_0xafa7('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xafa7('0x1e')]);router[_0xafa7('0x1d')]('/:id/dispositions',auth[_0xafa7('0x9')](),controller['removeDispositions']);router['delete'](_0xafa7('0x16'),auth['isAuthenticated'](),controller[_0xafa7('0x1f')]);module[_0xafa7('0x20')]=router; \ No newline at end of file +var _0xb7a9=['describe','getGlobalCustomFields','show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','/:id','delete','destroy','/:id/dispositions','removeDispositions','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7a9,0x1a3));var _0x9b7a=function(_0x22095d,_0x235455){_0x22095d=_0x22095d-0x0;var _0x4c3ff5=_0xb7a9[_0x22095d];return _0x4c3ff5;};'use strict';var multer=require(_0x9b7a('0x0'));var util=require(_0x9b7a('0x1'));var path=require(_0x9b7a('0x2'));var timeout=require(_0x9b7a('0x3'));var express=require('express');var router=express[_0x9b7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b7a('0x5'));var interaction=require(_0x9b7a('0x6'));var config=require(_0x9b7a('0x7'));var controller=require(_0x9b7a('0x8'));router[_0x9b7a('0x9')]('/',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0xb')]);router[_0x9b7a('0x9')](_0x9b7a('0xc'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0xd')]);router[_0x9b7a('0x9')]('/global_fields',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0xe')]);router[_0x9b7a('0x9')]('/:id',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0xf')]);router['get']('/:id/dispositions',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x10')]);router[_0x9b7a('0x9')]('/:id/contacts',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x11')]);router[_0x9b7a('0x9')](_0x9b7a('0x12'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x13')]);router[_0x9b7a('0x9')](_0x9b7a('0x14'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x15')]);router[_0x9b7a('0x9')](_0x9b7a('0x16'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x17')]);router[_0x9b7a('0x18')]('/',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x19')]);router[_0x9b7a('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9b7a('0x1a')]);router[_0x9b7a('0x18')]('/:id/contacts',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x1b')]);router['post'](_0x9b7a('0x14'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x1c')]);router['post']('/:id/users',auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x1d')]);router['put'](_0x9b7a('0x1e'),auth[_0x9b7a('0xa')](),controller['update']);router[_0x9b7a('0x1f')](_0x9b7a('0x1e'),auth['isAuthenticated'](),controller[_0x9b7a('0x20')]);router[_0x9b7a('0x1f')](_0x9b7a('0x21'),auth[_0x9b7a('0xa')](),controller[_0x9b7a('0x22')]);router['delete']('/:id/users',auth[_0x9b7a('0xa')](),controller['removeAgents']);module[_0x9b7a('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1c27dd2..f4ab9e2 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 _0x203e=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x203e,0xd7));var _0xe203=function(_0x16b108,_0x49a33f){_0x16b108=_0x16b108-0x0;var _0xc1705c=_0x203e[_0x16b108];return _0xc1705c;};'use strict';var Sequelize=require(_0xe203('0x0'));module[_0xe203('0x1')]={'name':{'type':Sequelize[_0xe203('0x2')],'get':function(_0x2e1ee3){return this[_0xe203('0x3')](_0xe203('0x4'));}},'field':{'type':Sequelize[_0xe203('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe203('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x8c17=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8c17,0x10a));var _0x78c1=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x8c17[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x78c1('0x0'));module[_0x78c1('0x1')]={'name':{'type':Sequelize[_0x78c1('0x2')],'get':function(_0x12c530){return this[_0x78c1('0x3')](_0x78c1('0x4'));}},'field':{'type':Sequelize[_0x78c1('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x78c1('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index d77b3c4..f271373 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(_0x3b1b2c,_0x39d2e9){var _0xc82ae6=function(_0xd3ef59){while(--_0xd3ef59){_0x3b1b2c['push'](_0x3b1b2c['shift']());}};_0xc82ae6(++_0x39d2e9);}(_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(_0x52a33d,_0x320b11){var _0x419bfa=function(_0x4fd687){while(--_0x4fd687){_0x52a33d['push'](_0x52a33d['shift']());}};_0x419bfa(++_0x320b11);}(_0x7a54,0x106));var _0x47a5=function(_0x42c5b1,_0x2cab2b){_0x42c5b1=_0x42c5b1-0x0;var _0x222d9b=_0x7a54[_0x42c5b1];return _0x222d9b;};'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 aeee913..536c7b4 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 _0xbf56=['lodash','moment','bluebird','path','../../config/environment','exports','define','Condition'];(function(_0x4887d6,_0x4db086){var _0x3cbdfd=function(_0x38a170){while(--_0x38a170){_0x4887d6['push'](_0x4887d6['shift']());}};_0x3cbdfd(++_0x4db086);}(_0xbf56,0x160));var _0x6bf5=function(_0x17dd81,_0x265aa4){_0x17dd81=_0x17dd81-0x0;var _0x318d08=_0xbf56[_0x17dd81];return _0x318d08;};'use strict';var _=require(_0x6bf5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6bf5('0x1'));var BPromise=require(_0x6bf5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bf5('0x3'));var rimraf=require('rimraf');var config=require(_0x6bf5('0x4'));var attributes=require('./condition.attributes');module[_0x6bf5('0x5')]=function(_0x43b145,_0x23bff5){return _0x43b145[_0x6bf5('0x6')](_0x6bf5('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab14=['rimraf','../../config/environment','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x304334,_0x444fc7){var _0x475dea=function(_0x169afc){while(--_0x169afc){_0x304334['push'](_0x304334['shift']());}};_0x475dea(++_0x444fc7);}(_0xab14,0x1d2));var _0x4ab1=function(_0x1351cc,_0x44baf6){_0x1351cc=_0x1351cc-0x0;var _0x738b99=_0xab14[_0x1351cc];return _0x738b99;};'use strict';var _=require(_0x4ab1('0x0'));var util=require(_0x4ab1('0x1'));var logger=require(_0x4ab1('0x2'))(_0x4ab1('0x3'));var moment=require(_0x4ab1('0x4'));var BPromise=require(_0x4ab1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ab1('0x6'));var rimraf=require(_0x4ab1('0x7'));var config=require(_0x4ab1('0x8'));var attributes=require('./condition.attributes');module['exports']=function(_0x2d2b6d,_0x71a372){return _0x2d2b6d['define'](_0x4ab1('0x9'),attributes,{'tableName':_0x4ab1('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 3c55bd3..7a4211d 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 _0x7b90=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5e5f4c,_0x1a65c6){var _0x3b0dc5=function(_0x4b1183){while(--_0x4b1183){_0x5e5f4c['push'](_0x5e5f4c['shift']());}};_0x3b0dc5(++_0x1a65c6);}(_0x7b90,0x197));var _0x07b9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7b90[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x07b9('0x0'));var util=require(_0x07b9('0x1'));var moment=require('moment');var BPromise=require(_0x07b9('0x2'));var rs=require(_0x07b9('0x3'));var fs=require('fs');var Redis=require(_0x07b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x07b9('0x5'));var logger=require(_0x07b9('0x6'))(_0x07b9('0x7'));var config=require(_0x07b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x07b9('0x9')][_0x07b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x391bc5,_0x4b1639,_0x5c5d57){return new BPromise(function(_0x5db9c3,_0x159a6d){return client[_0x07b9('0xb')](_0x391bc5,_0x5c5d57)[_0x07b9('0xc')](function(_0x44b8c8){logger[_0x07b9('0xd')]('Condition,\x20%s,\x20%s',_0x4b1639,_0x07b9('0xe'));logger['debug'](_0x07b9('0xf'),_0x4b1639,_0x07b9('0xe'),JSON[_0x07b9('0x10')](_0x44b8c8));if(_0x44b8c8['error']){if(_0x44b8c8['error'][_0x07b9('0x11')]===0x1f4){logger[_0x07b9('0x12')](_0x07b9('0x13'),_0x4b1639,_0x44b8c8['error'][_0x07b9('0x14')]);return _0x159a6d(_0x44b8c8[_0x07b9('0x12')][_0x07b9('0x14')]);}logger[_0x07b9('0x12')](_0x07b9('0x13'),_0x4b1639,_0x44b8c8[_0x07b9('0x12')]['message']);return _0x5db9c3(_0x44b8c8['error'][_0x07b9('0x14')]);}else{logger['info'](_0x07b9('0x13'),_0x4b1639,_0x07b9('0xe'));_0x5db9c3(_0x44b8c8[_0x07b9('0x15')]['message']);}})[_0x07b9('0x16')](function(_0xaa94df){logger[_0x07b9('0x12')](_0x07b9('0x13'),_0x4b1639,_0xaa94df);_0x159a6d(_0xaa94df);});});} \ No newline at end of file +var _0x0e1b=['http','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c6225,_0x54c115){var _0x3595e6=function(_0x1292d5){while(--_0x1292d5){_0x3c6225['push'](_0x3c6225['shift']());}};_0x3595e6(++_0x54c115);}(_0x0e1b,0x1aa));var _0xb0e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e1b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb0e1('0x0'));var util=require(_0xb0e1('0x1'));var moment=require(_0xb0e1('0x2'));var BPromise=require(_0xb0e1('0x3'));var rs=require(_0xb0e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0e1('0x5'))['db'];var utils=require(_0xb0e1('0x6'));var logger=require(_0xb0e1('0x7'))(_0xb0e1('0x8'));var config=require(_0xb0e1('0x9'));var jayson=require(_0xb0e1('0xa'));var client=jayson['client'][_0xb0e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd932e,_0x4c964d,_0x3f3e9d){return new BPromise(function(_0x2a5f48,_0x265fc6){return client['request'](_0xbd932e,_0x3f3e9d)[_0xb0e1('0xc')](function(_0x4ba914){logger[_0xb0e1('0xd')](_0xb0e1('0xe'),_0x4c964d,'request\x20sent');logger[_0xb0e1('0xf')](_0xb0e1('0x10'),_0x4c964d,_0xb0e1('0x11'),JSON[_0xb0e1('0x12')](_0x4ba914));if(_0x4ba914[_0xb0e1('0x13')]){if(_0x4ba914['error']['code']===0x1f4){logger[_0xb0e1('0x13')](_0xb0e1('0xe'),_0x4c964d,_0x4ba914[_0xb0e1('0x13')][_0xb0e1('0x14')]);return _0x265fc6(_0x4ba914[_0xb0e1('0x13')][_0xb0e1('0x14')]);}logger[_0xb0e1('0x13')](_0xb0e1('0xe'),_0x4c964d,_0x4ba914['error'][_0xb0e1('0x14')]);return _0x2a5f48(_0x4ba914['error'][_0xb0e1('0x14')]);}else{logger[_0xb0e1('0xd')](_0xb0e1('0xe'),_0x4c964d,_0xb0e1('0x11'));_0x2a5f48(_0x4ba914[_0xb0e1('0x15')][_0xb0e1('0x14')]);}})[_0xb0e1('0x16')](function(_0x1e2ade){logger['error']('Condition,\x20%s,\x20%s',_0x4c964d,_0x1e2ade);_0x265fc6(_0x1e2ade);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 369c406..500dfb4 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 _0x9c67=['update','delete','/:id','isAuthenticated','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9c67,0x1e6));var _0x79c6=function(_0x281372,_0x2a5398){_0x281372=_0x281372-0x0;var _0x4957b6=_0x9c67[_0x281372];return _0x4957b6;};'use strict';var multer=require(_0x79c6('0x0'));var util=require(_0x79c6('0x1'));var path=require(_0x79c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x79c6('0x3'));var router=express['Router']();var fs_extra=require(_0x79c6('0x4'));var auth=require(_0x79c6('0x5'));var interaction=require(_0x79c6('0x6'));var config=require(_0x79c6('0x7'));var controller=require('./condition.controller');router[_0x79c6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x79c6('0x9')]);router[_0x79c6('0xa')](_0x79c6('0xb'),auth[_0x79c6('0xc')](),controller[_0x79c6('0xd')]);module[_0x79c6('0xe')]=router; \ No newline at end of file +var _0x2379=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete','destroy','exports','multer','util'];(function(_0x193d09,_0x129093){var _0x39c4ec=function(_0x472383){while(--_0x472383){_0x193d09['push'](_0x193d09['shift']());}};_0x39c4ec(++_0x129093);}(_0x2379,0x7c));var _0x9237=function(_0x2ac494,_0x3d363d){_0x2ac494=_0x2ac494-0x0;var _0x11e809=_0x2379[_0x2ac494];return _0x11e809;};'use strict';var multer=require(_0x9237('0x0'));var util=require(_0x9237('0x1'));var path=require(_0x9237('0x2'));var timeout=require(_0x9237('0x3'));var express=require('express');var router=express[_0x9237('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9237('0x5'));var interaction=require(_0x9237('0x6'));var config=require(_0x9237('0x7'));var controller=require(_0x9237('0x8'));router[_0x9237('0x9')]('/:id',auth[_0x9237('0xa')](),controller['update']);router[_0x9237('0xb')]('/:id',auth[_0x9237('0xa')](),controller[_0x9237('0xc')]);module[_0x9237('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 139cca4..56d9399 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5b1=['INTEGER','sequelize'];(function(_0x4a9992,_0x1d152){var _0x37cfbc=function(_0x568124){while(--_0x568124){_0x4a9992['push'](_0x4a9992['shift']());}};_0x37cfbc(++_0x1d152);}(_0xb5b1,0xcb));var _0x1b5b=function(_0x182b5e,_0x14038c){_0x182b5e=_0x182b5e-0x0;var _0x533f7c=_0xb5b1[_0x182b5e];return _0x533f7c;};'use strict';var Sequelize=require(_0x1b5b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x1b5b('0x1')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x3c8b=['sequelize','STRING'];(function(_0x1c3166,_0x25a4b){var _0x13a19f=function(_0x2faff6){while(--_0x2faff6){_0x1c3166['push'](_0x1c3166['shift']());}};_0x13a19f(++_0x25a4b);}(_0x3c8b,0x9c));var _0xb3c8=function(_0x14de3c,_0x507150){_0x14de3c=_0x14de3c-0x0;var _0x49d02a=_0x3c8b[_0x14de3c];return _0x49d02a;};'use strict';var Sequelize=require(_0xb3c8('0x0'));module['exports']={'name':{'type':Sequelize[_0xb3c8('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb3c8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 46edf2c..3b05b94 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3423=['../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','ContactItemTypes','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','role','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','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(_0x4c34fc,_0x4e7efb){var _0x7af05=function(_0x2dbdcf){while(--_0x2dbdcf){_0x4c34fc['push'](_0x4c34fc['shift']());}};_0x7af05(++_0x4e7efb);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){var _0x30ffc9=_0x26eb87['get']({'plain':!![]});var _0x51cf45=_0x3342('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x51cf45,'resourceId':_0x30ffc9['id']}})[_0x3342('0x21')](function(){return _0x26eb87;});})['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x524286,_0x55cddd){return function(_0x1497d9){if(!_0x1497d9){_0x524286[_0x3342('0x16')](0x194);}return _0x1497d9;};}function handleError(_0x1dd607,_0x5eef2b){_0x5eef2b=_0x5eef2b||0x1f4;return function(_0xc275a1){logger[_0x3342('0x24')](_0xc275a1[_0x3342('0x25')]);if(_0xc275a1[_0x3342('0x26')]){delete _0xc275a1['name'];}_0x1dd607[_0x3342('0x17')](_0x5eef2b)[_0x3342('0x27')](_0xc275a1);};}exports[_0x3342('0x28')]=function(_0x301114,_0xf82530){var _0x2cc691={},_0x135760={},_0x47b2a0={'count':0x0,'rows':[]};var _0x2e0bde=_['map'](db[_0x3342('0x29')][_0x3342('0x2a')],function(_0x508f87){return{'name':_0x508f87[_0x3342('0x2b')],'type':_0x508f87[_0x3342('0x2c')][_0x3342('0x2d')]};});_0x135760[_0x3342('0x2e')]=_['map'](_0x2e0bde,_0x3342('0x26'));_0x135760[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x301114[_0x3342('0x2f')]);_0x135760[_0x3342('0x31')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],_0x135760[_0x3342('0x2f')]);_0x2cc691[_0x3342('0x33')]=_[_0x3342('0x32')](_0x135760[_0x3342('0x2e')],qs[_0x3342('0x34')](_0x301114['query']['fields']));_0x2cc691[_0x3342('0x33')]=_0x2cc691['attributes'][_0x3342('0x35')]?_0x2cc691[_0x3342('0x33')]:_0x135760[_0x3342('0x2e')];if(!_0x301114[_0x3342('0x2f')][_0x3342('0x36')](_0x3342('0x37'))){_0x2cc691[_0x3342('0x1c')]=qs['limit'](_0x301114[_0x3342('0x2f')][_0x3342('0x1c')]);_0x2cc691[_0x3342('0x19')]=qs[_0x3342('0x19')](_0x301114[_0x3342('0x2f')]['offset']);}_0x2cc691[_0x3342('0x38')]=qs['sort'](_0x301114[_0x3342('0x2f')][_0x3342('0x39')]);_0x2cc691[_0x3342('0x3a')]=qs[_0x3342('0x31')](_['pick'](_0x301114[_0x3342('0x2f')],_0x135760['filters']),_0x2e0bde);if(_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]){_0x2cc691[_0x3342('0x3a')]=_[_0x3342('0x3c')](_0x2cc691[_0x3342('0x3a')],{'$or':_[_0x3342('0x3d')](_0x2e0bde,function(_0x32ef9a){if(_0x32ef9a['type']!==_0x3342('0x3e')){var _0x355e83={};_0x355e83[_0x32ef9a['name']]={'$like':'%'+_0x301114[_0x3342('0x2f')][_0x3342('0x3b')]+'%'};return _0x355e83;}})});}_0x2cc691=_['merge']({},_0x2cc691,_0x301114[_0x3342('0x3f')]);var _0x29f0a0={'where':_0x2cc691['where']};return db['ContactItemType']['count'](_0x29f0a0)[_0x3342('0x21')](function(_0x41e727){_0x47b2a0['count']=_0x41e727;if(_0x301114[_0x3342('0x2f')][_0x3342('0x40')]){_0x2cc691[_0x3342('0x41')]=[{'all':!![]}];}return db[_0x3342('0x29')][_0x3342('0x42')](_0x2cc691);})[_0x3342('0x21')](function(_0x34de7b){_0x47b2a0[_0x3342('0x43')]=_0x34de7b;return _0x47b2a0;})['then'](respondWithFilteredResult(_0xf82530,_0x2cc691))['catch'](handleError(_0xf82530,null));};exports[_0x3342('0x44')]=function(_0x7341fa,_0x474196){var _0xee717e={'raw':!![],'where':{'id':_0x7341fa[_0x3342('0x45')]['id']}},_0x717946={};_0x717946['model']=_[_0x3342('0x30')](db[_0x3342('0x29')][_0x3342('0x2a')]);_0x717946[_0x3342('0x2f')]=_[_0x3342('0x30')](_0x7341fa[_0x3342('0x2f')]);_0x717946['filters']=_[_0x3342('0x32')](_0x717946['model'],_0x717946[_0x3342('0x2f')]);_0xee717e[_0x3342('0x33')]=_[_0x3342('0x32')](_0x717946[_0x3342('0x2e')],qs['fields'](_0x7341fa[_0x3342('0x2f')][_0x3342('0x34')]));_0xee717e['attributes']=_0xee717e[_0x3342('0x33')][_0x3342('0x35')]?_0xee717e[_0x3342('0x33')]:_0x717946[_0x3342('0x2e')];if(_0x7341fa['query'][_0x3342('0x40')]){_0xee717e[_0x3342('0x41')]=[{'all':!![]}];}_0xee717e=_['merge']({},_0xee717e,_0x7341fa[_0x3342('0x3f')]);return db['ContactItemType']['find'](_0xee717e)[_0x3342('0x21')](handleEntityNotFound(_0x474196,null))[_0x3342('0x21')](respondWithResult(_0x474196,null))[_0x3342('0x46')](handleError(_0x474196,null));};exports[_0x3342('0x47')]=function(_0x23925e,_0x171387){return db[_0x3342('0x29')]['create'](_0x23925e['body'],{})[_0x3342('0x21')](function(_0x5a9e40){var _0x26251c=_0x23925e['user']['get']({'plain':!![]});if(!_0x26251c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26251c[_0x3342('0x48')]===_0x3342('0x49')){var _0x29ccb6=_0x5a9e40[_0x3342('0x4a')]({'plain':!![]});var _0x5176d7=_0x3342('0x23');return db[_0x3342('0x4b')]['find']({'where':{'name':_0x5176d7,'userProfileId':_0x26251c[_0x3342('0x4c')]},'raw':!![]})[_0x3342('0x21')](function(_0x43c27a){if(_0x43c27a&&_0x43c27a['autoAssociation']===0x0){return db[_0x3342('0x4d')][_0x3342('0x47')]({'name':_0x29ccb6[_0x3342('0x26')],'resourceId':_0x29ccb6['id'],'type':_0x43c27a[_0x3342('0x26')],'sectionId':_0x43c27a['id']},{})[_0x3342('0x21')](function(){return _0x5a9e40;});}else{return _0x5a9e40;}})['catch'](function(_0x2699d2){logger[_0x3342('0x24')](_0x3342('0x4e'),_0x2699d2);throw _0x2699d2;});}return _0x5a9e40;})[_0x3342('0x21')](respondWithResult(_0x171387,0xc9))[_0x3342('0x46')](handleError(_0x171387,null));};exports[_0x3342('0x20')]=function(_0x3db07c,_0x47cf76){if(_0x3db07c[_0x3342('0x4f')]['id']){delete _0x3db07c['body']['id'];}return db[_0x3342('0x29')]['find']({'where':{'id':_0x3db07c[_0x3342('0x45')]['id']}})['then'](handleEntityNotFound(_0x47cf76,null))['then'](saveUpdates(_0x3db07c['body'],null))['then'](respondWithResult(_0x47cf76,null))[_0x3342('0x46')](handleError(_0x47cf76,null));};exports[_0x3342('0x22')]=function(_0x3cd098,_0x476973){return db[_0x3342('0x29')][_0x3342('0x50')]({'where':{'id':_0x3cd098[_0x3342('0x45')]['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x476973,null))[_0x3342('0x21')](db[_0x3342('0x51')][_0x3342('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3cd098['params']['id']}}))['then'](removeEntity(_0x476973,null))[_0x3342('0x46')](handleError(_0x476973,null));}; \ No newline at end of file +var _0x1eba=['index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1eba[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xa1eb('0x0'));var rimraf=require(_0xa1eb('0x1'));var zipdir=require(_0xa1eb('0x2'));var jsonpatch=require(_0xa1eb('0x3'));var rp=require(_0xa1eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1eb('0x5'));var util=require(_0xa1eb('0x6'));var path=require(_0xa1eb('0x7'));var sox=require(_0xa1eb('0x8'));var csv=require(_0xa1eb('0x9'));var ejs=require(_0xa1eb('0xa'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xb'));var _=require(_0xa1eb('0xc'));var squel=require(_0xa1eb('0xd'));var crypto=require(_0xa1eb('0xe'));var jsforce=require(_0xa1eb('0xf'));var deskjs=require(_0xa1eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1eb('0x11'));var Papa=require('papaparse');var Redis=require(_0xa1eb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1eb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x14'));var logger=require('../../config/logger')(_0xa1eb('0x15'));var utils=require(_0xa1eb('0x16'));var config=require(_0xa1eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1eb('0x18'))['db'];function respondWithStatusCode(_0x39b4a3,_0x5df92d){_0x5df92d=_0x5df92d||0xcc;return function(_0x16a623){if(_0x16a623){return _0x39b4a3['sendStatus'](_0x5df92d);}return _0x39b4a3['status'](_0x5df92d)[_0xa1eb('0x19')]();};}function respondWithResult(_0x4c7983,_0x25d058){_0x25d058=_0x25d058||0xc8;return function(_0x2178e2){if(_0x2178e2){return _0x4c7983[_0xa1eb('0x1a')](_0x25d058)[_0xa1eb('0x1b')](_0x2178e2);}};}function respondWithFilteredResult(_0x3cd675,_0x44f37d){return function(_0x1c858c){if(_0x1c858c){var _0x45d6dd=typeof _0x44f37d[_0xa1eb('0x1c')]==='undefined'&&typeof _0x44f37d[_0xa1eb('0x1d')]==='undefined';var _0x1401ef=_0x1c858c[_0xa1eb('0x1e')];var _0x33c4e3=_0x45d6dd?0x0:_0x44f37d[_0xa1eb('0x1c')];var _0x49bfaa=_0x45d6dd?_0x1c858c[_0xa1eb('0x1e')]:_0x44f37d[_0xa1eb('0x1c')]+_0x44f37d[_0xa1eb('0x1d')];var _0xcf45c1;if(_0x49bfaa>=_0x1401ef){_0x49bfaa=_0x1401ef;_0xcf45c1=0xc8;}else{_0xcf45c1=0xce;}_0x3cd675[_0xa1eb('0x1a')](_0xcf45c1);return _0x3cd675[_0xa1eb('0x1f')](_0xa1eb('0x20'),_0x33c4e3+'-'+_0x49bfaa+'/'+_0x1401ef)[_0xa1eb('0x1b')](_0x1c858c);}return null;};}function patchUpdates(_0x4fc14a){return function(_0x137e2c){try{jsonpatch['apply'](_0x137e2c,_0x4fc14a,!![]);}catch(_0x2258d1){return BPromise[_0xa1eb('0x21')](_0x2258d1);}return _0x137e2c[_0xa1eb('0x22')]();};}function saveUpdates(_0x250f99,_0x5e7a34){return function(_0x539634){if(_0x539634){return _0x539634[_0xa1eb('0x23')](_0x250f99)[_0xa1eb('0x24')](function(_0x5b0903){return _0x5b0903;});}return null;};}function removeEntity(_0x437b2a,_0x250728){return function(_0x258d3a){if(_0x258d3a){return _0x258d3a[_0xa1eb('0x25')]()[_0xa1eb('0x24')](function(){var _0x1c59e1=_0x258d3a[_0xa1eb('0x26')]({'plain':!![]});var _0x364b1c=_0xa1eb('0x27');return db[_0xa1eb('0x28')][_0xa1eb('0x25')]({'where':{'type':_0x364b1c,'resourceId':_0x1c59e1['id']}})[_0xa1eb('0x24')](function(){return _0x258d3a;});})['then'](function(){_0x437b2a[_0xa1eb('0x1a')](0xcc)[_0xa1eb('0x19')]();});}};}function handleEntityNotFound(_0x491f37,_0x2680c0){return function(_0x4e2aa7){if(!_0x4e2aa7){_0x491f37[_0xa1eb('0x29')](0x194);}return _0x4e2aa7;};}function handleError(_0x2d31d1,_0x53a890){_0x53a890=_0x53a890||0x1f4;return function(_0x45ff0d){logger[_0xa1eb('0x2a')](_0x45ff0d[_0xa1eb('0x2b')]);if(_0x45ff0d['name']){delete _0x45ff0d[_0xa1eb('0x2c')];}_0x2d31d1[_0xa1eb('0x1a')](_0x53a890)['send'](_0x45ff0d);};}exports[_0xa1eb('0x2d')]=function(_0xb27bf9,_0x401510){var _0x2e281a={},_0x5a6544={},_0x52f9c7={'count':0x0,'rows':[]};var _0x9d49d8=_[_0xa1eb('0x2e')](db[_0xa1eb('0x2f')][_0xa1eb('0x30')],function(_0x383e26){return{'name':_0x383e26[_0xa1eb('0x31')],'type':_0x383e26[_0xa1eb('0x32')][_0xa1eb('0x33')]};});_0x5a6544[_0xa1eb('0x34')]=_[_0xa1eb('0x2e')](_0x9d49d8,_0xa1eb('0x2c'));_0x5a6544['query']=_['keys'](_0xb27bf9[_0xa1eb('0x35')]);_0x5a6544[_0xa1eb('0x36')]=_[_0xa1eb('0x37')](_0x5a6544[_0xa1eb('0x34')],_0x5a6544[_0xa1eb('0x35')]);_0x2e281a['attributes']=_['intersection'](_0x5a6544[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0xb27bf9['query']['fields']));_0x2e281a[_0xa1eb('0x39')]=_0x2e281a['attributes'][_0xa1eb('0x3a')]?_0x2e281a['attributes']:_0x5a6544[_0xa1eb('0x34')];if(!_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3b')]('nolimit')){_0x2e281a[_0xa1eb('0x1d')]=qs[_0xa1eb('0x1d')](_0xb27bf9[_0xa1eb('0x35')]['limit']);_0x2e281a[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x1c')]);}_0x2e281a[_0xa1eb('0x3c')]=qs['sort'](_0xb27bf9[_0xa1eb('0x35')][_0xa1eb('0x3d')]);_0x2e281a[_0xa1eb('0x3e')]=qs[_0xa1eb('0x36')](_[_0xa1eb('0x3f')](_0xb27bf9[_0xa1eb('0x35')],_0x5a6544[_0xa1eb('0x36')]),_0x9d49d8);if(_0xb27bf9[_0xa1eb('0x35')]['filter']){_0x2e281a[_0xa1eb('0x3e')]=_[_0xa1eb('0x40')](_0x2e281a[_0xa1eb('0x3e')],{'$or':_[_0xa1eb('0x2e')](_0x9d49d8,function(_0x1c390c){if(_0x1c390c['type']!==_0xa1eb('0x41')){var _0x3d28dc={};_0x3d28dc[_0x1c390c[_0xa1eb('0x2c')]]={'$like':'%'+_0xb27bf9['query'][_0xa1eb('0x42')]+'%'};return _0x3d28dc;}})});}_0x2e281a=_[_0xa1eb('0x40')]({},_0x2e281a,_0xb27bf9[_0xa1eb('0x43')]);var _0x13ced7={'where':_0x2e281a[_0xa1eb('0x3e')]};return db[_0xa1eb('0x2f')][_0xa1eb('0x1e')](_0x13ced7)['then'](function(_0x3c8713){_0x52f9c7[_0xa1eb('0x1e')]=_0x3c8713;if(_0xb27bf9['query'][_0xa1eb('0x44')]){_0x2e281a['include']=[{'all':!![]}];}return db[_0xa1eb('0x2f')][_0xa1eb('0x45')](_0x2e281a);})[_0xa1eb('0x24')](function(_0x361675){_0x52f9c7[_0xa1eb('0x46')]=_0x361675;return _0x52f9c7;})[_0xa1eb('0x24')](respondWithFilteredResult(_0x401510,_0x2e281a))[_0xa1eb('0x47')](handleError(_0x401510,null));};exports[_0xa1eb('0x48')]=function(_0x9c297d,_0x44a2de){var _0xd5b217={'raw':!![],'where':{'id':_0x9c297d[_0xa1eb('0x49')]['id']}},_0x3c4690={};_0x3c4690[_0xa1eb('0x34')]=_[_0xa1eb('0x4a')](db[_0xa1eb('0x2f')]['rawAttributes']);_0x3c4690[_0xa1eb('0x35')]=_['keys'](_0x9c297d[_0xa1eb('0x35')]);_0x3c4690[_0xa1eb('0x36')]=_['intersection'](_0x3c4690['model'],_0x3c4690[_0xa1eb('0x35')]);_0xd5b217[_0xa1eb('0x39')]=_[_0xa1eb('0x37')](_0x3c4690['model'],qs[_0xa1eb('0x38')](_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x38')]));_0xd5b217[_0xa1eb('0x39')]=_0xd5b217[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0xd5b217[_0xa1eb('0x39')]:_0x3c4690[_0xa1eb('0x34')];if(_0x9c297d[_0xa1eb('0x35')][_0xa1eb('0x44')]){_0xd5b217[_0xa1eb('0x4b')]=[{'all':!![]}];}_0xd5b217=_[_0xa1eb('0x40')]({},_0xd5b217,_0x9c297d[_0xa1eb('0x43')]);return db[_0xa1eb('0x2f')]['find'](_0xd5b217)[_0xa1eb('0x24')](handleEntityNotFound(_0x44a2de,null))[_0xa1eb('0x24')](respondWithResult(_0x44a2de,null))[_0xa1eb('0x47')](handleError(_0x44a2de,null));};exports[_0xa1eb('0x4c')]=function(_0x2b0cbf,_0x12dfd4){return db[_0xa1eb('0x2f')]['create'](_0x2b0cbf[_0xa1eb('0x4d')],{})[_0xa1eb('0x24')](function(_0x27021a){var _0x10a6da=_0x2b0cbf[_0xa1eb('0x4e')][_0xa1eb('0x26')]({'plain':!![]});if(!_0x10a6da)throw new Error(_0xa1eb('0x4f'));if(_0x10a6da[_0xa1eb('0x50')]===_0xa1eb('0x4e')){var _0x4f7c05=_0x27021a[_0xa1eb('0x26')]({'plain':!![]});var _0x5c3db1=_0xa1eb('0x27');return db['UserProfileSection'][_0xa1eb('0x51')]({'where':{'name':_0x5c3db1,'userProfileId':_0x10a6da[_0xa1eb('0x52')]},'raw':!![]})[_0xa1eb('0x24')](function(_0x5cc25e){if(_0x5cc25e&&_0x5cc25e[_0xa1eb('0x53')]===0x0){return db[_0xa1eb('0x28')]['create']({'name':_0x4f7c05[_0xa1eb('0x2c')],'resourceId':_0x4f7c05['id'],'type':_0x5cc25e[_0xa1eb('0x2c')],'sectionId':_0x5cc25e['id']},{})[_0xa1eb('0x24')](function(){return _0x27021a;});}else{return _0x27021a;}})[_0xa1eb('0x47')](function(_0x11cc84){logger[_0xa1eb('0x2a')](_0xa1eb('0x54'),_0x11cc84);throw _0x11cc84;});}return _0x27021a;})[_0xa1eb('0x24')](respondWithResult(_0x12dfd4,0xc9))[_0xa1eb('0x47')](handleError(_0x12dfd4,null));};exports[_0xa1eb('0x23')]=function(_0x42519b,_0x4391be){if(_0x42519b[_0xa1eb('0x4d')]['id']){delete _0x42519b[_0xa1eb('0x4d')]['id'];}return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x42519b[_0xa1eb('0x49')]['id']}})['then'](handleEntityNotFound(_0x4391be,null))[_0xa1eb('0x24')](saveUpdates(_0x42519b[_0xa1eb('0x4d')],null))[_0xa1eb('0x24')](respondWithResult(_0x4391be,null))[_0xa1eb('0x47')](handleError(_0x4391be,null));};exports[_0xa1eb('0x25')]=function(_0x1f5da6,_0x56eeaf){return db[_0xa1eb('0x2f')][_0xa1eb('0x51')]({'where':{'id':_0x1f5da6[_0xa1eb('0x49')]['id']}})[_0xa1eb('0x24')](handleEntityNotFound(_0x56eeaf,null))[_0xa1eb('0x24')](db[_0xa1eb('0x55')][_0xa1eb('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1f5da6['params']['id']}}))[_0xa1eb('0x24')](removeEntity(_0x56eeaf,null))[_0xa1eb('0x47')](handleError(_0x56eeaf,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5666052..4abd949 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b35=['path','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10883b,_0x6fd002){var _0x3bbea4=function(_0x16d2d9){while(--_0x16d2d9){_0x10883b['push'](_0x10883b['shift']());}};_0x3bbea4(++_0x6fd002);}(_0x6b35,0x156));var _0x56b3=function(_0x2b0495,_0x1ea00a){_0x2b0495=_0x2b0495-0x0;var _0x24a724=_0x6b35[_0x2b0495];return _0x24a724;};'use strict';var _=require(_0x56b3('0x0'));var util=require(_0x56b3('0x1'));var logger=require(_0x56b3('0x2'))(_0x56b3('0x3'));var moment=require(_0x56b3('0x4'));var BPromise=require(_0x56b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56b3('0x6'));var rimraf=require('rimraf');var config=require(_0x56b3('0x7'));var attributes=require(_0x56b3('0x8'));module['exports']=function(_0x5e0d81,_0x3a189a){return _0x5e0d81[_0x56b3('0x9')](_0x56b3('0xa'),attributes,{'tableName':_0x56b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7061=['../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x35ebe7,_0x11b8e5){var _0x476af2=function(_0x29d0b8){while(--_0x29d0b8){_0x35ebe7['push'](_0x35ebe7['shift']());}};_0x476af2(++_0x11b8e5);}(_0x7061,0x1f3));var _0x1706=function(_0x4e9fef,_0xf35b60){_0x4e9fef=_0x4e9fef-0x0;var _0x5cb1ae=_0x7061[_0x4e9fef];return _0x5cb1ae;};'use strict';var _=require(_0x1706('0x0'));var util=require(_0x1706('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1706('0x2'));var BPromise=require(_0x1706('0x3'));var rp=require(_0x1706('0x4'));var fs=require('fs');var path=require(_0x1706('0x5'));var rimraf=require(_0x1706('0x6'));var config=require(_0x1706('0x7'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x15c486,_0x316a67){return _0x15c486[_0x1706('0x8')](_0x1706('0x9'),attributes,{'tableName':_0x1706('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b0c2c03..1fb37aa 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04c5=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x5b8320,_0x2ab5e5){var _0x5239ff=function(_0x4a26bf){while(--_0x4a26bf){_0x5b8320['push'](_0x5b8320['shift']());}};_0x5239ff(++_0x2ab5e5);}(_0x04c5,0x125));var _0x504c=function(_0x1d4847,_0x4dd702){_0x1d4847=_0x1d4847-0x0;var _0x2fd519=_0x04c5[_0x1d4847];return _0x2fd519;};'use strict';var _=require(_0x504c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x504c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x504c('0x2'));var logger=require(_0x504c('0x3'))('rpc');var config=require(_0x504c('0x4'));var jayson=require(_0x504c('0x5'));var client=jayson[_0x504c('0x6')][_0x504c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b6fdf,_0x43c461,_0x17ca9e){return new BPromise(function(_0x421979,_0x50a227){return client['request'](_0x4b6fdf,_0x17ca9e)[_0x504c('0x8')](function(_0x317964){logger[_0x504c('0x9')](_0x504c('0xa'),_0x43c461,_0x504c('0xb'));logger[_0x504c('0xc')](_0x504c('0xd'),_0x43c461,'request\x20sent',JSON['stringify'](_0x317964));if(_0x317964[_0x504c('0xe')]){if(_0x317964[_0x504c('0xe')][_0x504c('0xf')]===0x1f4){logger['error'](_0x504c('0xa'),_0x43c461,_0x317964[_0x504c('0xe')][_0x504c('0x10')]);return _0x50a227(_0x317964[_0x504c('0xe')][_0x504c('0x10')]);}logger['error'](_0x504c('0xa'),_0x43c461,_0x317964[_0x504c('0xe')][_0x504c('0x10')]);return _0x421979(_0x317964[_0x504c('0xe')]['message']);}else{logger['info'](_0x504c('0xa'),_0x43c461,_0x504c('0xb'));_0x421979(_0x317964[_0x504c('0x11')][_0x504c('0x10')]);}})[_0x504c('0x12')](function(_0x416232){logger[_0x504c('0xe')](_0x504c('0xa'),_0x43c461,_0x416232);_0x50a227(_0x416232);});});} \ No newline at end of file +var _0xec9e=['request\x20sent','error','ContactItemType,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xec9e,0x195));var _0xeec9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec9e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeec9('0x0'));var util=require(_0xeec9('0x1'));var moment=require('moment');var BPromise=require(_0xeec9('0x2'));var rs=require(_0xeec9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeec9('0x4'))['db'];var utils=require(_0xeec9('0x5'));var logger=require('../../config/logger')(_0xeec9('0x6'));var config=require(_0xeec9('0x7'));var jayson=require(_0xeec9('0x8'));var client=jayson[_0xeec9('0x9')][_0xeec9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5958b9,_0x166b71,_0x1d2472){return new BPromise(function(_0xcb6e82,_0x2f6ca5){return client['request'](_0x5958b9,_0x1d2472)[_0xeec9('0xb')](function(_0x23947b){logger[_0xeec9('0xc')]('ContactItemType,\x20%s,\x20%s',_0x166b71,'request\x20sent');logger[_0xeec9('0xd')](_0xeec9('0xe'),_0x166b71,_0xeec9('0xf'),JSON['stringify'](_0x23947b));if(_0x23947b[_0xeec9('0x10')]){if(_0x23947b['error']['code']===0x1f4){logger[_0xeec9('0x10')](_0xeec9('0x11'),_0x166b71,_0x23947b['error'][_0xeec9('0x12')]);return _0x2f6ca5(_0x23947b[_0xeec9('0x10')][_0xeec9('0x12')]);}logger[_0xeec9('0x10')](_0xeec9('0x11'),_0x166b71,_0x23947b[_0xeec9('0x10')]['message']);return _0xcb6e82(_0x23947b[_0xeec9('0x10')][_0xeec9('0x12')]);}else{logger[_0xeec9('0xc')]('ContactItemType,\x20%s,\x20%s',_0x166b71,_0xeec9('0xf'));_0xcb6e82(_0x23947b[_0xeec9('0x13')]['message']);}})['catch'](function(_0x1d24fe){logger[_0xeec9('0x10')](_0xeec9('0x11'),_0x166b71,_0x1d24fe);_0x2f6ca5(_0x1d24fe);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8ec8886..11db70b 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcbb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xdcbb,0xaf));var _0xbdcb=function(_0xded2fb,_0x392cbe){_0xded2fb=_0xded2fb-0x0;var _0x56941d=_0xdcbb[_0xded2fb];return _0x56941d;};'use strict';var multer=require(_0xbdcb('0x0'));var util=require(_0xbdcb('0x1'));var path=require(_0xbdcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdcb('0x3')]();var fs_extra=require(_0xbdcb('0x4'));var auth=require(_0xbdcb('0x5'));var interaction=require(_0xbdcb('0x6'));var config=require(_0xbdcb('0x7'));var controller=require(_0xbdcb('0x8'));router[_0xbdcb('0x9')]('/',auth[_0xbdcb('0xa')](),controller[_0xbdcb('0xb')]);router['get'](_0xbdcb('0xc'),auth[_0xbdcb('0xa')](),controller[_0xbdcb('0xd')]);router[_0xbdcb('0xe')]('/',auth[_0xbdcb('0xa')](),controller[_0xbdcb('0xf')]);router[_0xbdcb('0x10')](_0xbdcb('0xc'),auth[_0xbdcb('0xa')](),controller['update']);router[_0xbdcb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbdcb('0x12')]);module[_0xbdcb('0x13')]=router; \ No newline at end of file +var _0xa4a5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xa4a5,0x1c0));var _0x5a4a=function(_0x2dfc65,_0x25b5e4){_0x2dfc65=_0x2dfc65-0x0;var _0x22c9ef=_0xa4a5[_0x2dfc65];return _0x22c9ef;};'use strict';var multer=require(_0x5a4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5a4a('0x1'));var express=require('express');var router=express[_0x5a4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5a4a('0x3'));var interaction=require(_0x5a4a('0x4'));var config=require(_0x5a4a('0x5'));var controller=require(_0x5a4a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5a4a('0x7')]);router['get'](_0x5a4a('0x8'),auth[_0x5a4a('0x9')](),controller[_0x5a4a('0xa')]);router[_0x5a4a('0xb')]('/',auth[_0x5a4a('0x9')](),controller[_0x5a4a('0xc')]);router[_0x5a4a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5a4a('0xe')]);router[_0x5a4a('0xf')](_0x5a4a('0x8'),auth[_0x5a4a('0x9')](),controller[_0x5a4a('0x10')]);module[_0x5a4a('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index bf6a585..db6fa61 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 _0xbaf0=['name','exports','STRING'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x21f8b4,_0x3f31b2){var _0x4b07b8=function(_0x1fd286){while(--_0x1fd286){_0x21f8b4['push'](_0x21f8b4['shift']());}};_0x4b07b8(++_0x3f31b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 38aed5e..7ce65c9 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 _0x1bcf=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','intersection','length','catch','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x1050d3,_0x52c1f5){var _0x324f2d=function(_0x2dfa92){while(--_0x2dfa92){_0x1050d3['push'](_0x1050d3['shift']());}};_0x324f2d(++_0x52c1f5);}(_0x1bcf,0xb0));var _0xf1bc=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x1bcf[_0x5c4585];return _0x21dede;};'use strict';var emlformat=require(_0xf1bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1bc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1bc('0x2'));var moment=require(_0xf1bc('0x3'));var BPromise=require(_0xf1bc('0x4'));var Mustache=require('mustache');var util=require(_0xf1bc('0x5'));var path=require('path');var sox=require(_0xf1bc('0x6'));var csv=require(_0xf1bc('0x7'));var ejs=require(_0xf1bc('0x8'));var fs=require('fs');var fs_extra=require(_0xf1bc('0x9'));var _=require(_0xf1bc('0xa'));var squel=require(_0xf1bc('0xb'));var crypto=require(_0xf1bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf1bc('0xd'));var toCsv=require(_0xf1bc('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf1bc('0xe'));var authService=require(_0xf1bc('0xf'));var qs=require(_0xf1bc('0x10'));var as=require(_0xf1bc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf1bc('0x12'));var utils=require(_0xf1bc('0x13'));var config=require(_0xf1bc('0x14'));var licenseUtil=require(_0xf1bc('0x15'));var db=require(_0xf1bc('0x16'))['db'];config[_0xf1bc('0x17')]=_[_0xf1bc('0x18')](config[_0xf1bc('0x17')],{'host':_0xf1bc('0x19'),'port':0x18eb});var socket=require(_0xf1bc('0x1a'))(new Redis(config[_0xf1bc('0x17')]));require(_0xf1bc('0x1b'))[_0xf1bc('0x1c')](socket);function respondWithStatusCode(_0x1e181f,_0x4e548b){_0x4e548b=_0x4e548b||0xcc;return function(_0x3cf154){if(_0x3cf154){return _0x1e181f[_0xf1bc('0x1d')](_0x4e548b);}return _0x1e181f['status'](_0x4e548b)[_0xf1bc('0x1e')]();};}function respondWithResult(_0x21a379,_0x4e864b){_0x4e864b=_0x4e864b||0xc8;return function(_0x51c0c6){if(_0x51c0c6){return _0x21a379[_0xf1bc('0x1f')](_0x4e864b)[_0xf1bc('0x20')](_0x51c0c6);}};}function respondWithFilteredResult(_0x1711b6,_0x2c2565){return function(_0x136bab){if(_0x136bab){var _0x9e2df4=typeof _0x2c2565[_0xf1bc('0x21')]===_0xf1bc('0x22')&&typeof _0x2c2565[_0xf1bc('0x23')]==='undefined';var _0x4088d1=_0x136bab[_0xf1bc('0x24')];var _0x4bc6e6=_0x9e2df4?0x0:_0x2c2565['offset'];var _0x380b4f=_0x9e2df4?_0x136bab[_0xf1bc('0x24')]:_0x2c2565['offset']+_0x2c2565['limit'];var _0x30ac24;if(_0x380b4f>=_0x4088d1){_0x380b4f=_0x4088d1;_0x30ac24=0xc8;}else{_0x30ac24=0xce;}_0x1711b6[_0xf1bc('0x1f')](_0x30ac24);return _0x1711b6[_0xf1bc('0x25')](_0xf1bc('0x26'),_0x4bc6e6+'-'+_0x380b4f+'/'+_0x4088d1)[_0xf1bc('0x20')](_0x136bab);}return null;};}function patchUpdates(_0x58fcbe){return function(_0x50a546){try{jsonpatch[_0xf1bc('0x27')](_0x50a546,_0x58fcbe,!![]);}catch(_0x210e25){return BPromise[_0xf1bc('0x28')](_0x210e25);}return _0x50a546[_0xf1bc('0x29')]();};}function saveUpdates(_0x4d60e3,_0x36533d){return function(_0x377385){if(_0x377385){return _0x377385[_0xf1bc('0x2a')](_0x4d60e3)[_0xf1bc('0x2b')](function(_0x13ca2a){return _0x13ca2a;});}return null;};}function removeEntity(_0x5e6b93,_0x28f970){return function(_0x1a4bb4){if(_0x1a4bb4){return _0x1a4bb4[_0xf1bc('0x2c')]()['then'](function(){var _0x5f537b=_0x1a4bb4['get']({'plain':!![]});var _0x2269a4=_0xf1bc('0x2d');return db[_0xf1bc('0x2e')][_0xf1bc('0x2c')]({'where':{'type':_0x2269a4,'resourceId':_0x5f537b['id']}})[_0xf1bc('0x2b')](function(){return _0x1a4bb4;});})[_0xf1bc('0x2b')](function(){_0x5e6b93[_0xf1bc('0x1f')](0xcc)[_0xf1bc('0x1e')]();});}};}function handleEntityNotFound(_0x4a7d04,_0x8454bf){return function(_0x26949c){if(!_0x26949c){_0x4a7d04[_0xf1bc('0x1d')](0x194);}return _0x26949c;};}function handleError(_0x2e61cc,_0x297067){_0x297067=_0x297067||0x1f4;return function(_0x555bfd){logger['error'](_0x555bfd['stack']);if(_0x555bfd['name']){delete _0x555bfd[_0xf1bc('0x2f')];}_0x2e61cc[_0xf1bc('0x1f')](_0x297067)[_0xf1bc('0x30')](_0x555bfd);};}exports[_0xf1bc('0x31')]=function(_0x2ceff0,_0x12c4eb){var _0x363096={},_0x23d9a2={},_0x5a91e5={'count':0x0,'rows':[]};var _0x4accd6=_[_0xf1bc('0x32')](db[_0xf1bc('0x33')]['rawAttributes'],function(_0x15f517){return{'name':_0x15f517[_0xf1bc('0x34')],'type':_0x15f517[_0xf1bc('0x35')][_0xf1bc('0x36')]};});_0x23d9a2[_0xf1bc('0x37')]=_[_0xf1bc('0x32')](_0x4accd6,_0xf1bc('0x2f'));_0x23d9a2[_0xf1bc('0x38')]=_[_0xf1bc('0x39')](_0x2ceff0[_0xf1bc('0x38')]);_0x23d9a2[_0xf1bc('0x3a')]=_['intersection'](_0x23d9a2[_0xf1bc('0x37')],_0x23d9a2[_0xf1bc('0x38')]);_0x363096[_0xf1bc('0x3b')]=_['intersection'](_0x23d9a2[_0xf1bc('0x37')],qs[_0xf1bc('0x3c')](_0x2ceff0['query']['fields']));_0x363096[_0xf1bc('0x3b')]=_0x363096[_0xf1bc('0x3b')]['length']?_0x363096[_0xf1bc('0x3b')]:_0x23d9a2[_0xf1bc('0x37')];if(!_0x2ceff0[_0xf1bc('0x38')][_0xf1bc('0x3d')](_0xf1bc('0x3e'))){_0x363096[_0xf1bc('0x23')]=qs[_0xf1bc('0x23')](_0x2ceff0['query']['limit']);_0x363096['offset']=qs[_0xf1bc('0x21')](_0x2ceff0[_0xf1bc('0x38')][_0xf1bc('0x21')]);}_0x363096[_0xf1bc('0x3f')]=qs['sort'](_0x2ceff0[_0xf1bc('0x38')][_0xf1bc('0x40')]);_0x363096[_0xf1bc('0x41')]=qs[_0xf1bc('0x3a')](_[_0xf1bc('0x42')](_0x2ceff0[_0xf1bc('0x38')],_0x23d9a2[_0xf1bc('0x3a')]),_0x4accd6);if(_0x2ceff0[_0xf1bc('0x38')]['filter']){_0x363096['where']=_['merge'](_0x363096[_0xf1bc('0x41')],{'$or':_[_0xf1bc('0x32')](_0x4accd6,function(_0x32da8c){if(_0x32da8c[_0xf1bc('0x35')]!==_0xf1bc('0x43')){var _0x100683={};_0x100683[_0x32da8c[_0xf1bc('0x2f')]]={'$like':'%'+_0x2ceff0[_0xf1bc('0x38')][_0xf1bc('0x44')]+'%'};return _0x100683;}})});}_0x363096=_[_0xf1bc('0x45')]({},_0x363096,_0x2ceff0[_0xf1bc('0x46')]);var _0x1a37be={'where':_0x363096[_0xf1bc('0x41')]};return db[_0xf1bc('0x33')][_0xf1bc('0x24')](_0x1a37be)[_0xf1bc('0x2b')](function(_0x4ab6d5){_0x5a91e5[_0xf1bc('0x24')]=_0x4ab6d5;if(_0x2ceff0['query'][_0xf1bc('0x47')]){_0x363096[_0xf1bc('0x48')]=[{'all':!![]}];}return db[_0xf1bc('0x33')][_0xf1bc('0x49')](_0x363096);})[_0xf1bc('0x2b')](function(_0x5cf2e8){_0x5a91e5['rows']=_0x5cf2e8;return _0x5a91e5;})[_0xf1bc('0x2b')](respondWithFilteredResult(_0x12c4eb,_0x363096))['catch'](handleError(_0x12c4eb,null));};exports[_0xf1bc('0x4a')]=function(_0x4c90e7,_0x4ffd1d){var _0x57c12c={'raw':![],'where':{'id':_0x4c90e7[_0xf1bc('0x4b')]['id']}},_0x11ae7c={};_0x11ae7c[_0xf1bc('0x37')]=_[_0xf1bc('0x39')](db['Dashboard'][_0xf1bc('0x4c')]);_0x11ae7c['query']=_[_0xf1bc('0x39')](_0x4c90e7['query']);_0x11ae7c[_0xf1bc('0x3a')]=_[_0xf1bc('0x4d')](_0x11ae7c['model'],_0x11ae7c['query']);_0x57c12c['attributes']=_['intersection'](_0x11ae7c[_0xf1bc('0x37')],qs[_0xf1bc('0x3c')](_0x4c90e7[_0xf1bc('0x38')][_0xf1bc('0x3c')]));_0x57c12c[_0xf1bc('0x3b')]=_0x57c12c[_0xf1bc('0x3b')][_0xf1bc('0x4e')]?_0x57c12c['attributes']:_0x11ae7c[_0xf1bc('0x37')];if(_0x4c90e7['query'][_0xf1bc('0x47')]){_0x57c12c['include']=[{'all':!![]}];}_0x57c12c=_[_0xf1bc('0x45')]({},_0x57c12c,_0x4c90e7['options']);return db[_0xf1bc('0x33')]['find'](_0x57c12c)['then'](handleEntityNotFound(_0x4ffd1d,null))[_0xf1bc('0x2b')](respondWithResult(_0x4ffd1d,null))[_0xf1bc('0x4f')](handleError(_0x4ffd1d,null));};exports[_0xf1bc('0x50')]=function(_0x3195a8,_0x2a7d9a){return db[_0xf1bc('0x33')][_0xf1bc('0x50')](_0x3195a8[_0xf1bc('0x51')],{})[_0xf1bc('0x2b')](function(_0x5e271e){var _0x2ab567=_0x3195a8[_0xf1bc('0x52')][_0xf1bc('0x53')]({'plain':!![]});if(!_0x2ab567)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ab567['role']===_0xf1bc('0x52')){var _0x20acf7=_0x5e271e[_0xf1bc('0x53')]({'plain':!![]});var _0xd4a779=_0xf1bc('0x2d');return db[_0xf1bc('0x54')][_0xf1bc('0x55')]({'where':{'name':_0xd4a779,'userProfileId':_0x2ab567[_0xf1bc('0x56')]},'raw':!![]})[_0xf1bc('0x2b')](function(_0x374cab){if(_0x374cab&&_0x374cab[_0xf1bc('0x57')]===0x0){return db['UserProfileResource'][_0xf1bc('0x50')]({'name':_0x20acf7[_0xf1bc('0x2f')],'resourceId':_0x20acf7['id'],'type':_0x374cab[_0xf1bc('0x2f')],'sectionId':_0x374cab['id']},{})['then'](function(){return _0x5e271e;});}else{return _0x5e271e;}})['catch'](function(_0x517dfc){logger[_0xf1bc('0x58')](_0xf1bc('0x59'),_0x517dfc);throw _0x517dfc;});}return _0x5e271e;})[_0xf1bc('0x2b')](respondWithResult(_0x2a7d9a,0xc9))['catch'](handleError(_0x2a7d9a,null));};exports[_0xf1bc('0x5a')]=function(_0x755b0a,_0x27f40a){var _0x4579a5={'where':{'id':_0x755b0a['params']['id']}},_0x76c31c={};_0x76c31c[_0xf1bc('0x37')]=_[_0xf1bc('0x39')](db[_0xf1bc('0x33')][_0xf1bc('0x4c')]);_0x4579a5['attributes']=_[_0xf1bc('0x4d')](_0x76c31c[_0xf1bc('0x37')],qs[_0xf1bc('0x3c')](_0x755b0a[_0xf1bc('0x38')][_0xf1bc('0x3c')]));_0x4579a5[_0xf1bc('0x3b')]=_0x4579a5[_0xf1bc('0x3b')]['length']?_0x4579a5[_0xf1bc('0x3b')]:_0x76c31c['model'];if(_0x755b0a[_0xf1bc('0x38')][_0xf1bc('0x47')]){_0x4579a5['include']=[{'all':!![]}];}_0x4579a5=_[_0xf1bc('0x45')]({},_0x4579a5,_0x755b0a[_0xf1bc('0x46')]);return db[_0xf1bc('0x33')]['find'](_0x4579a5)[_0xf1bc('0x2b')](handleEntityNotFound(_0x27f40a,null))[_0xf1bc('0x2b')](function(_0x16325e){if(_0x16325e){var _0x139ead=_0x16325e[_0xf1bc('0x53')]({'plain':!![]});_0x139ead=qs[_0xf1bc('0x5b')](_0x139ead,['id',_0xf1bc('0x5c'),_0xf1bc('0x5d')]);_0x755b0a[_0xf1bc('0x51')]=_[_0xf1bc('0x5b')](_0x755b0a[_0xf1bc('0x51')],['id','createdAt',_0xf1bc('0x5d')]);return db['Dashboard'][_0xf1bc('0x50')](_[_0xf1bc('0x45')](_0x139ead,_0x755b0a['body']),{'include':_0x755b0a[_0xf1bc('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0xf1bc('0x2b')](function(_0x543763){var _0xe3b705=_0x755b0a['user']['get']({'plain':!![]});if(!_0xe3b705)throw new Error(_0xf1bc('0x5e'));if(_0xe3b705[_0xf1bc('0x5f')]===_0xf1bc('0x52')){var _0x2561be=_0x543763[_0xf1bc('0x53')]({'plain':!![]});var _0x43b047=_0xf1bc('0x2d');return db[_0xf1bc('0x54')][_0xf1bc('0x55')]({'where':{'name':_0x43b047,'userProfileId':_0xe3b705['userProfileId']},'raw':!![]})['then'](function(_0x211623){if(_0x211623&&_0x211623[_0xf1bc('0x57')]===0x0){return db['UserProfileResource'][_0xf1bc('0x50')]({'name':_0x2561be[_0xf1bc('0x2f')],'resourceId':_0x2561be['id'],'type':_0x211623[_0xf1bc('0x2f')],'sectionId':_0x211623['id']},{})[_0xf1bc('0x2b')](function(){return _0x543763;});}else{return _0x543763;}})[_0xf1bc('0x4f')](function(_0x12b515){logger[_0xf1bc('0x58')](_0xf1bc('0x59'),_0x12b515);throw _0x12b515;});}return _0x543763;});}})[_0xf1bc('0x2b')](respondWithResult(_0x27f40a,0xc9))[_0xf1bc('0x4f')](handleError(_0x27f40a,null));};exports[_0xf1bc('0x2a')]=function(_0x45d9f2,_0x79c53b){if(_0x45d9f2[_0xf1bc('0x51')]['id']){delete _0x45d9f2[_0xf1bc('0x51')]['id'];}return db['Dashboard'][_0xf1bc('0x55')]({'where':{'id':_0x45d9f2[_0xf1bc('0x4b')]['id']}})[_0xf1bc('0x2b')](handleEntityNotFound(_0x79c53b,null))['then'](saveUpdates(_0x45d9f2[_0xf1bc('0x51')],null))['then'](respondWithResult(_0x79c53b,null))['catch'](handleError(_0x79c53b,null));};exports[_0xf1bc('0x2c')]=function(_0x4dc73b,_0x170fb7){return db[_0xf1bc('0x33')][_0xf1bc('0x55')]({'where':{'id':_0x4dc73b[_0xf1bc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x170fb7,null))[_0xf1bc('0x2b')](removeEntity(_0x170fb7,null))[_0xf1bc('0x4f')](handleError(_0x170fb7,null));};function widgetAttributes(_0x24d38b){try{switch(_0x24d38b['type']){case'iframe':return[{'name':_0xf1bc('0x60'),'value':_0x24d38b[_0xf1bc('0x60')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b['attrs'][0x0][_0xf1bc('0x62')]:undefined)||_0xf1bc('0x63')}];case _0xf1bc('0x64'):return[{'name':'attrPath','value':_0x24d38b[_0xf1bc('0x65')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b[_0xf1bc('0x61')][0x0][_0xf1bc('0x62')]:undefined)||''}];case _0xf1bc('0x66'):return[{'name':_0xf1bc('0x67'),'value':_0x24d38b[_0xf1bc('0x67')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b[_0xf1bc('0x61')][0x0][_0xf1bc('0x62')]:undefined)||_0xf1bc('0x68')},{'name':_0xf1bc('0x69'),'value':_0x24d38b['attrTimezone']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x1]?_0x24d38b[_0xf1bc('0x61')][0x1][_0xf1bc('0x62')]:undefined)||_0xf1bc('0x6a')},{'name':_0xf1bc('0x6b'),'value':_0x24d38b[_0xf1bc('0x6b')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x2]?_0x24d38b[_0xf1bc('0x61')][0x2][_0xf1bc('0x62')]:undefined)||0xc}];case _0xf1bc('0x6c'):return[{'name':_0xf1bc('0x6d'),'value':_0x24d38b[_0xf1bc('0x6d')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b['attrs'][0x0]?_0x24d38b[_0xf1bc('0x61')][0x0]['value']:undefined)||_0xf1bc('0x6e')},{'name':_0xf1bc('0x6f'),'value':_0x24d38b[_0xf1bc('0x6f')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b['attrs'][0x1]?_0x24d38b[_0xf1bc('0x61')][0x1][_0xf1bc('0x62')]:undefined)||[]},{'name':_0xf1bc('0x6b'),'value':_0x24d38b[_0xf1bc('0x6b')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x2]?_0x24d38b[_0xf1bc('0x61')][0x2][_0xf1bc('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0x24d38b[_0xf1bc('0x70')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x3]?_0x24d38b[_0xf1bc('0x61')][0x3]['value']:undefined)||_0xf1bc('0x71')},{'name':'attrEmailAccounts','value':_0x24d38b[_0xf1bc('0x72')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x4]?_0x24d38b[_0xf1bc('0x61')][0x4]['value']:undefined)||''},{'name':_0xf1bc('0x73'),'value':_0x24d38b[_0xf1bc('0x73')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x5]?_0x24d38b[_0xf1bc('0x61')][0x5][_0xf1bc('0x62')]:undefined)||''},{'name':_0xf1bc('0x74'),'value':_0x24d38b[_0xf1bc('0x74')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x6]?_0x24d38b[_0xf1bc('0x61')][0x6][_0xf1bc('0x62')]:undefined)||''},{'name':_0xf1bc('0x75'),'value':_0x24d38b['attrOpenchannelAccounts']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x7]?_0x24d38b['attrs'][0x7][_0xf1bc('0x62')]:undefined)||''},{'name':_0xf1bc('0x76'),'value':_0x24d38b[_0xf1bc('0x76')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b['attrs'][0x8]?_0x24d38b[_0xf1bc('0x61')][0x8][_0xf1bc('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x24d38b[_0xf1bc('0x77')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x9]?_0x24d38b[_0xf1bc('0x61')][0x9][_0xf1bc('0x62')]:undefined)||''}];case _0xf1bc('0x78'):case'pie-chart':return[{'name':'attrSerie1','value':_0x24d38b['attrSerie1']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b[_0xf1bc('0x61')][0x0]['value']:undefined)||_0xf1bc('0x6e')},{'name':_0xf1bc('0x79'),'value':_0x24d38b[_0xf1bc('0x79')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b['attrs'][0x1]?_0x24d38b[_0xf1bc('0x61')][0x1][_0xf1bc('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x24d38b[_0xf1bc('0x7a')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x2]?_0x24d38b[_0xf1bc('0x61')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x24d38b['attrVoiceQueues']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x3]?_0x24d38b[_0xf1bc('0x61')][0x3][_0xf1bc('0x62')]:undefined)||[]},{'name':_0xf1bc('0x70'),'value':_0x24d38b[_0xf1bc('0x70')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x4]?_0x24d38b[_0xf1bc('0x61')][0x4][_0xf1bc('0x62')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x24d38b[_0xf1bc('0x72')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x5]?_0x24d38b['attrs'][0x5]['value']:undefined)||''},{'name':_0xf1bc('0x73'),'value':_0x24d38b[_0xf1bc('0x73')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x6]?_0x24d38b[_0xf1bc('0x61')][0x6]['value']:undefined)||''},{'name':_0xf1bc('0x74'),'value':_0x24d38b[_0xf1bc('0x74')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x7]?_0x24d38b[_0xf1bc('0x61')][0x7][_0xf1bc('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x24d38b['attrOpenchannelAccounts']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x8]?_0x24d38b[_0xf1bc('0x61')][0x8][_0xf1bc('0x62')]:undefined)||''},{'name':_0xf1bc('0x76'),'value':_0x24d38b[_0xf1bc('0x76')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x9]?_0x24d38b[_0xf1bc('0x61')][0x9]['value']:undefined)||''},{'name':_0xf1bc('0x77'),'value':_0x24d38b['attrChatWebsites']||(_0x24d38b['attrs']&&_0x24d38b['attrs'][0xa]?_0x24d38b['attrs'][0xa][_0xf1bc('0x62')]:undefined)||''}];case _0xf1bc('0x7b'):return[{'name':_0xf1bc('0x7c'),'type':_0x24d38b[_0xf1bc('0x7d')]||(_0x24d38b['attrs']&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b[_0xf1bc('0x61')][0x0][_0xf1bc('0x35')]:undefined)||null,'value':_0x24d38b[_0xf1bc('0x7c')]||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x0]?_0x24d38b['attrs'][0x0]['value']:undefined)||null},{'name':_0xf1bc('0x7e'),'value':_0x24d38b['attrRefresh']||(_0x24d38b[_0xf1bc('0x61')]&&_0x24d38b[_0xf1bc('0x61')][0x1]?_0x24d38b['attrs'][0x1][_0xf1bc('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x40fd0e){logger['error'](_0xf1bc('0x7f'),JSON[_0xf1bc('0x80')](_0x40fd0e));return[];}}exports[_0xf1bc('0x81')]=function(_0x2b512e,_0x312a47,_0x49f873){if(_0x2b512e[_0xf1bc('0x51')]['id']){delete _0x2b512e[_0xf1bc('0x51')]['id'];}return db[_0xf1bc('0x33')][_0xf1bc('0x55')]({'where':{'id':_0x2b512e['params']['id']}})[_0xf1bc('0x2b')](handleEntityNotFound(_0x312a47,null))['then'](function(_0x3b56f3){if(_0x3b56f3){_0x2b512e[_0xf1bc('0x51')][_0xf1bc('0x82')]=_0x3b56f3['id'];_0x2b512e['body'][_0xf1bc('0x61')]=widgetAttributes(_0x2b512e['body']);return db[_0xf1bc('0x83')][_0xf1bc('0x50')](_0x2b512e[_0xf1bc('0x51')]);}})[_0xf1bc('0x2b')](respondWithResult(_0x312a47,null))['catch'](handleError(_0x312a47,null));};exports[_0xf1bc('0x84')]=function(_0x50633d,_0x22aaa0,_0x13a281){var _0x359c93={};var _0x2b828b={};var _0x5699ab;var _0x877ecf;return db['Dashboard'][_0xf1bc('0x85')]({'where':{'id':_0x50633d[_0xf1bc('0x4b')]['id']}})[_0xf1bc('0x2b')](handleEntityNotFound(_0x22aaa0,null))['then'](function(_0x47b8d8){if(_0x47b8d8){_0x5699ab=_0x47b8d8;_0x2b828b['model']=_[_0xf1bc('0x39')](db['DashboardItem'][_0xf1bc('0x4c')]);_0x2b828b[_0xf1bc('0x38')]=_[_0xf1bc('0x39')](_0x50633d[_0xf1bc('0x38')]);_0x2b828b[_0xf1bc('0x3a')]=_[_0xf1bc('0x4d')](_0x2b828b['model'],_0x2b828b[_0xf1bc('0x38')]);_0x359c93[_0xf1bc('0x3b')]=_['intersection'](_0x2b828b['model'],qs[_0xf1bc('0x3c')](_0x50633d[_0xf1bc('0x38')][_0xf1bc('0x3c')]));_0x359c93[_0xf1bc('0x3b')]=_0x359c93[_0xf1bc('0x3b')][_0xf1bc('0x4e')]?_0x359c93[_0xf1bc('0x3b')]:_0x2b828b[_0xf1bc('0x37')];_0x359c93[_0xf1bc('0x3f')]=qs[_0xf1bc('0x40')](_0x50633d['query'][_0xf1bc('0x40')]);_0x359c93[_0xf1bc('0x41')]=qs['filters'](_[_0xf1bc('0x42')](_0x50633d[_0xf1bc('0x38')],_0x2b828b[_0xf1bc('0x3a')]));if(_0x50633d['query']['filter']){_0x359c93[_0xf1bc('0x41')]=_[_0xf1bc('0x45')](_0x359c93[_0xf1bc('0x41')],{'$or':_[_0xf1bc('0x32')](_0x359c93[_0xf1bc('0x3b')],function(_0x45f270){var _0x33edc2={};_0x33edc2[_0x45f270]={'$like':'%'+_0x50633d[_0xf1bc('0x38')][_0xf1bc('0x44')]+'%'};return _0x33edc2;})});}_0x359c93=_['merge']({},_0x359c93,_0x50633d[_0xf1bc('0x46')]);return _0x5699ab[_0xf1bc('0x84')](_0x359c93);}})[_0xf1bc('0x2b')](function(_0x157ecd){if(_0x157ecd){_0x877ecf=_0x157ecd[_0xf1bc('0x4e')];if(!_0x50633d[_0xf1bc('0x38')][_0xf1bc('0x3d')](_0xf1bc('0x3e'))){_0x359c93[_0xf1bc('0x23')]=qs[_0xf1bc('0x23')](_0x50633d['query'][_0xf1bc('0x23')]);_0x359c93['offset']=qs[_0xf1bc('0x21')](_0x50633d[_0xf1bc('0x38')][_0xf1bc('0x21')]);}return _0x5699ab[_0xf1bc('0x84')](_0x359c93);}})[_0xf1bc('0x2b')](function(_0xad8358){if(_0xad8358){return _0xad8358?{'count':_0x877ecf,'rows':_0xad8358}:null;}})[_0xf1bc('0x2b')](respondWithResult(_0x22aaa0,null))[_0xf1bc('0x4f')](handleError(_0x22aaa0,null));}; \ No newline at end of file +var _0xca04=['name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','filters','filter','where','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','show','params','length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt','updatedAt','body','iframe','attrUrl','attrs','value','https://','attrPath','clock','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','attrRefresh','stringify','getItems','findOne','order','sort','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','stack'];(function(_0x74d499,_0x3c1212){var _0x59bb6a=function(_0x7a78fb){while(--_0x7a78fb){_0x74d499['push'](_0x74d499['shift']());}};_0x59bb6a(++_0x3c1212);}(_0xca04,0x150));var _0x4ca0=function(_0x25998b,_0x1df9ad){_0x25998b=_0x25998b-0x0;var _0x7ca195=_0xca04[_0x25998b];return _0x7ca195;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ca0('0x0'));var zipdir=require(_0x4ca0('0x1'));var jsonpatch=require(_0x4ca0('0x2'));var rp=require(_0x4ca0('0x3'));var moment=require(_0x4ca0('0x4'));var BPromise=require(_0x4ca0('0x5'));var Mustache=require(_0x4ca0('0x6'));var util=require(_0x4ca0('0x7'));var path=require(_0x4ca0('0x8'));var sox=require('sox');var csv=require(_0x4ca0('0x9'));var ejs=require(_0x4ca0('0xa'));var fs=require('fs');var fs_extra=require(_0x4ca0('0xb'));var _=require(_0x4ca0('0xc'));var squel=require(_0x4ca0('0xd'));var crypto=require('crypto');var jsforce=require(_0x4ca0('0xe'));var deskjs=require(_0x4ca0('0xf'));var toCsv=require(_0x4ca0('0x9'));var querystring=require(_0x4ca0('0x10'));var Papa=require('papaparse');var Redis=require(_0x4ca0('0x11'));var authService=require(_0x4ca0('0x12'));var qs=require(_0x4ca0('0x13'));var as=require(_0x4ca0('0x14'));var hardwareService=require(_0x4ca0('0x15'));var logger=require(_0x4ca0('0x16'))(_0x4ca0('0x17'));var utils=require(_0x4ca0('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ca0('0x19'))['db'];config['redis']=_[_0x4ca0('0x1a')](config[_0x4ca0('0x1b')],{'host':_0x4ca0('0x1c'),'port':0x18eb});var socket=require(_0x4ca0('0x1d'))(new Redis(config[_0x4ca0('0x1b')]));require(_0x4ca0('0x1e'))[_0x4ca0('0x1f')](socket);function respondWithStatusCode(_0x36b5c3,_0x5960ce){_0x5960ce=_0x5960ce||0xcc;return function(_0x1f85bb){if(_0x1f85bb){return _0x36b5c3[_0x4ca0('0x20')](_0x5960ce);}return _0x36b5c3[_0x4ca0('0x21')](_0x5960ce)['end']();};}function respondWithResult(_0x3a6a28,_0x13aa7c){_0x13aa7c=_0x13aa7c||0xc8;return function(_0x2ebe0b){if(_0x2ebe0b){return _0x3a6a28['status'](_0x13aa7c)[_0x4ca0('0x22')](_0x2ebe0b);}};}function respondWithFilteredResult(_0x35a979,_0x3de661){return function(_0x3aa908){if(_0x3aa908){var _0x904aa3=typeof _0x3de661[_0x4ca0('0x23')]==='undefined'&&typeof _0x3de661['limit']===_0x4ca0('0x24');var _0x2d63ba=_0x3aa908['count'];var _0x4dfb1e=_0x904aa3?0x0:_0x3de661[_0x4ca0('0x23')];var _0x2af3d6=_0x904aa3?_0x3aa908[_0x4ca0('0x25')]:_0x3de661['offset']+_0x3de661[_0x4ca0('0x26')];var _0xdf288d;if(_0x2af3d6>=_0x2d63ba){_0x2af3d6=_0x2d63ba;_0xdf288d=0xc8;}else{_0xdf288d=0xce;}_0x35a979[_0x4ca0('0x21')](_0xdf288d);return _0x35a979['set']('Content-Range',_0x4dfb1e+'-'+_0x2af3d6+'/'+_0x2d63ba)[_0x4ca0('0x22')](_0x3aa908);}return null;};}function patchUpdates(_0x56ffe5){return function(_0x326c98){try{jsonpatch['apply'](_0x326c98,_0x56ffe5,!![]);}catch(_0x3b3040){return BPromise[_0x4ca0('0x27')](_0x3b3040);}return _0x326c98[_0x4ca0('0x28')]();};}function saveUpdates(_0x3d80c8,_0x532b17){return function(_0x2ba4d7){if(_0x2ba4d7){return _0x2ba4d7[_0x4ca0('0x29')](_0x3d80c8)[_0x4ca0('0x2a')](function(_0x334367){return _0x334367;});}return null;};}function removeEntity(_0xa6ca8c,_0x1379c0){return function(_0x340c38){if(_0x340c38){return _0x340c38[_0x4ca0('0x2b')]()[_0x4ca0('0x2a')](function(){var _0x4dedad=_0x340c38['get']({'plain':!![]});var _0x38f560=_0x4ca0('0x2c');return db[_0x4ca0('0x2d')][_0x4ca0('0x2b')]({'where':{'type':_0x38f560,'resourceId':_0x4dedad['id']}})[_0x4ca0('0x2a')](function(){return _0x340c38;});})['then'](function(){_0xa6ca8c[_0x4ca0('0x21')](0xcc)[_0x4ca0('0x2e')]();});}};}function handleEntityNotFound(_0x2a924d,_0x4289c3){return function(_0x2eb01d){if(!_0x2eb01d){_0x2a924d[_0x4ca0('0x20')](0x194);}return _0x2eb01d;};}function handleError(_0x3e92c9,_0x546599){_0x546599=_0x546599||0x1f4;return function(_0x275bb9){logger['error'](_0x275bb9[_0x4ca0('0x2f')]);if(_0x275bb9[_0x4ca0('0x30')]){delete _0x275bb9[_0x4ca0('0x30')];}_0x3e92c9[_0x4ca0('0x21')](_0x546599)[_0x4ca0('0x31')](_0x275bb9);};}exports['index']=function(_0x2dcf51,_0x3fa0d0){var _0x40a2a3={},_0x1c126d={},_0x5d7dc8={'count':0x0,'rows':[]};var _0x104ff4=_[_0x4ca0('0x32')](db['Dashboard'][_0x4ca0('0x33')],function(_0x474d88){return{'name':_0x474d88[_0x4ca0('0x34')],'type':_0x474d88[_0x4ca0('0x35')][_0x4ca0('0x36')]};});_0x1c126d[_0x4ca0('0x37')]=_[_0x4ca0('0x32')](_0x104ff4,_0x4ca0('0x30'));_0x1c126d[_0x4ca0('0x38')]=_[_0x4ca0('0x39')](_0x2dcf51[_0x4ca0('0x38')]);_0x1c126d['filters']=_[_0x4ca0('0x3a')](_0x1c126d[_0x4ca0('0x37')],_0x1c126d[_0x4ca0('0x38')]);_0x40a2a3['attributes']=_[_0x4ca0('0x3a')](_0x1c126d[_0x4ca0('0x37')],qs['fields'](_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x3b')]));_0x40a2a3[_0x4ca0('0x3c')]=_0x40a2a3[_0x4ca0('0x3c')]['length']?_0x40a2a3[_0x4ca0('0x3c')]:_0x1c126d['model'];if(!_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x3d')](_0x4ca0('0x3e'))){_0x40a2a3[_0x4ca0('0x26')]=qs[_0x4ca0('0x26')](_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x26')]);_0x40a2a3['offset']=qs['offset'](_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x23')]);}_0x40a2a3['order']=qs['sort'](_0x2dcf51[_0x4ca0('0x38')]['sort']);_0x40a2a3['where']=qs[_0x4ca0('0x3f')](_['pick'](_0x2dcf51[_0x4ca0('0x38')],_0x1c126d[_0x4ca0('0x3f')]),_0x104ff4);if(_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x40')]){_0x40a2a3[_0x4ca0('0x41')]=_[_0x4ca0('0x42')](_0x40a2a3[_0x4ca0('0x41')],{'$or':_['map'](_0x104ff4,function(_0x3cf2a0){if(_0x3cf2a0[_0x4ca0('0x35')]!==_0x4ca0('0x43')){var _0x1b597a={};_0x1b597a[_0x3cf2a0[_0x4ca0('0x30')]]={'$like':'%'+_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x40')]+'%'};return _0x1b597a;}})});}_0x40a2a3=_[_0x4ca0('0x42')]({},_0x40a2a3,_0x2dcf51[_0x4ca0('0x44')]);var _0x8bdb69={'where':_0x40a2a3[_0x4ca0('0x41')]};return db[_0x4ca0('0x45')][_0x4ca0('0x25')](_0x8bdb69)[_0x4ca0('0x2a')](function(_0x144e6d){_0x5d7dc8[_0x4ca0('0x25')]=_0x144e6d;if(_0x2dcf51[_0x4ca0('0x38')][_0x4ca0('0x46')]){_0x40a2a3[_0x4ca0('0x47')]=[{'all':!![]}];}return db[_0x4ca0('0x45')][_0x4ca0('0x48')](_0x40a2a3);})[_0x4ca0('0x2a')](function(_0x5d0ad2){_0x5d7dc8[_0x4ca0('0x49')]=_0x5d0ad2;return _0x5d7dc8;})[_0x4ca0('0x2a')](respondWithFilteredResult(_0x3fa0d0,_0x40a2a3))['catch'](handleError(_0x3fa0d0,null));};exports[_0x4ca0('0x4a')]=function(_0x4c1e30,_0x580e5b){var _0x4d7588={'raw':![],'where':{'id':_0x4c1e30[_0x4ca0('0x4b')]['id']}},_0x27fc35={};_0x27fc35[_0x4ca0('0x37')]=_[_0x4ca0('0x39')](db['Dashboard'][_0x4ca0('0x33')]);_0x27fc35[_0x4ca0('0x38')]=_[_0x4ca0('0x39')](_0x4c1e30[_0x4ca0('0x38')]);_0x27fc35[_0x4ca0('0x3f')]=_['intersection'](_0x27fc35['model'],_0x27fc35[_0x4ca0('0x38')]);_0x4d7588['attributes']=_[_0x4ca0('0x3a')](_0x27fc35[_0x4ca0('0x37')],qs[_0x4ca0('0x3b')](_0x4c1e30[_0x4ca0('0x38')]['fields']));_0x4d7588[_0x4ca0('0x3c')]=_0x4d7588[_0x4ca0('0x3c')][_0x4ca0('0x4c')]?_0x4d7588[_0x4ca0('0x3c')]:_0x27fc35[_0x4ca0('0x37')];if(_0x4c1e30[_0x4ca0('0x38')][_0x4ca0('0x46')]){_0x4d7588['include']=[{'all':!![]}];}_0x4d7588=_[_0x4ca0('0x42')]({},_0x4d7588,_0x4c1e30['options']);return db[_0x4ca0('0x45')][_0x4ca0('0x4d')](_0x4d7588)[_0x4ca0('0x2a')](handleEntityNotFound(_0x580e5b,null))[_0x4ca0('0x2a')](respondWithResult(_0x580e5b,null))[_0x4ca0('0x4e')](handleError(_0x580e5b,null));};exports[_0x4ca0('0x4f')]=function(_0x52dc2c,_0x4cd12c){return db[_0x4ca0('0x45')][_0x4ca0('0x4f')](_0x52dc2c['body'],{})[_0x4ca0('0x2a')](function(_0x59b705){var _0x1efe05=_0x52dc2c[_0x4ca0('0x50')][_0x4ca0('0x51')]({'plain':!![]});if(!_0x1efe05)throw new Error(_0x4ca0('0x52'));if(_0x1efe05[_0x4ca0('0x53')]===_0x4ca0('0x50')){var _0x2336dd=_0x59b705['get']({'plain':!![]});var _0x2b0305=_0x4ca0('0x2c');return db[_0x4ca0('0x54')][_0x4ca0('0x4d')]({'where':{'name':_0x2b0305,'userProfileId':_0x1efe05[_0x4ca0('0x55')]},'raw':!![]})[_0x4ca0('0x2a')](function(_0x4ccf86){if(_0x4ccf86&&_0x4ccf86[_0x4ca0('0x56')]===0x0){return db[_0x4ca0('0x2d')][_0x4ca0('0x4f')]({'name':_0x2336dd[_0x4ca0('0x30')],'resourceId':_0x2336dd['id'],'type':_0x4ccf86[_0x4ca0('0x30')],'sectionId':_0x4ccf86['id']},{})[_0x4ca0('0x2a')](function(){return _0x59b705;});}else{return _0x59b705;}})[_0x4ca0('0x4e')](function(_0x3c92e7){logger[_0x4ca0('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c92e7);throw _0x3c92e7;});}return _0x59b705;})[_0x4ca0('0x2a')](respondWithResult(_0x4cd12c,0xc9))['catch'](handleError(_0x4cd12c,null));};exports[_0x4ca0('0x58')]=function(_0x4b00ef,_0x1af22b){var _0x4916ba={'where':{'id':_0x4b00ef[_0x4ca0('0x4b')]['id']}},_0x46d8db={};_0x46d8db[_0x4ca0('0x37')]=_[_0x4ca0('0x39')](db[_0x4ca0('0x45')][_0x4ca0('0x33')]);_0x4916ba[_0x4ca0('0x3c')]=_[_0x4ca0('0x3a')](_0x46d8db[_0x4ca0('0x37')],qs[_0x4ca0('0x3b')](_0x4b00ef[_0x4ca0('0x38')][_0x4ca0('0x3b')]));_0x4916ba[_0x4ca0('0x3c')]=_0x4916ba[_0x4ca0('0x3c')]['length']?_0x4916ba[_0x4ca0('0x3c')]:_0x46d8db['model'];if(_0x4b00ef[_0x4ca0('0x38')][_0x4ca0('0x46')]){_0x4916ba['include']=[{'all':!![]}];}_0x4916ba=_[_0x4ca0('0x42')]({},_0x4916ba,_0x4b00ef['options']);return db[_0x4ca0('0x45')]['find'](_0x4916ba)[_0x4ca0('0x2a')](handleEntityNotFound(_0x1af22b,null))[_0x4ca0('0x2a')](function(_0x1f52e4){if(_0x1f52e4){var _0x427c9d=_0x1f52e4[_0x4ca0('0x51')]({'plain':!![]});_0x427c9d=qs[_0x4ca0('0x59')](_0x427c9d,['id',_0x4ca0('0x5a'),_0x4ca0('0x5b')]);_0x4b00ef[_0x4ca0('0x5c')]=_['omit'](_0x4b00ef['body'],['id',_0x4ca0('0x5a'),_0x4ca0('0x5b')]);return db['Dashboard'][_0x4ca0('0x4f')](_[_0x4ca0('0x42')](_0x427c9d,_0x4b00ef[_0x4ca0('0x5c')]),{'include':_0x4b00ef[_0x4ca0('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x4ca0('0x2a')](function(_0x569fe7){var _0x35bed1=_0x4b00ef['user'][_0x4ca0('0x51')]({'plain':!![]});if(!_0x35bed1)throw new Error(_0x4ca0('0x52'));if(_0x35bed1['role']===_0x4ca0('0x50')){var _0x13e0f6=_0x569fe7[_0x4ca0('0x51')]({'plain':!![]});var _0x159ac3=_0x4ca0('0x2c');return db[_0x4ca0('0x54')][_0x4ca0('0x4d')]({'where':{'name':_0x159ac3,'userProfileId':_0x35bed1[_0x4ca0('0x55')]},'raw':!![]})[_0x4ca0('0x2a')](function(_0x997116){if(_0x997116&&_0x997116[_0x4ca0('0x56')]===0x0){return db[_0x4ca0('0x2d')][_0x4ca0('0x4f')]({'name':_0x13e0f6[_0x4ca0('0x30')],'resourceId':_0x13e0f6['id'],'type':_0x997116[_0x4ca0('0x30')],'sectionId':_0x997116['id']},{})['then'](function(){return _0x569fe7;});}else{return _0x569fe7;}})[_0x4ca0('0x4e')](function(_0x569270){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x569270);throw _0x569270;});}return _0x569fe7;});}})[_0x4ca0('0x2a')](respondWithResult(_0x1af22b,0xc9))[_0x4ca0('0x4e')](handleError(_0x1af22b,null));};exports[_0x4ca0('0x29')]=function(_0x4a4f89,_0xe3bd7f){if(_0x4a4f89[_0x4ca0('0x5c')]['id']){delete _0x4a4f89['body']['id'];}return db[_0x4ca0('0x45')][_0x4ca0('0x4d')]({'where':{'id':_0x4a4f89[_0x4ca0('0x4b')]['id']}})[_0x4ca0('0x2a')](handleEntityNotFound(_0xe3bd7f,null))['then'](saveUpdates(_0x4a4f89[_0x4ca0('0x5c')],null))[_0x4ca0('0x2a')](respondWithResult(_0xe3bd7f,null))[_0x4ca0('0x4e')](handleError(_0xe3bd7f,null));};exports['destroy']=function(_0x11c8a4,_0x1ef79c){return db[_0x4ca0('0x45')]['find']({'where':{'id':_0x11c8a4[_0x4ca0('0x4b')]['id']}})[_0x4ca0('0x2a')](handleEntityNotFound(_0x1ef79c,null))[_0x4ca0('0x2a')](removeEntity(_0x1ef79c,null))[_0x4ca0('0x4e')](handleError(_0x1ef79c,null));};function widgetAttributes(_0x22cfe5){try{switch(_0x22cfe5['type']){case _0x4ca0('0x5d'):return[{'name':_0x4ca0('0x5e'),'value':_0x22cfe5[_0x4ca0('0x5e')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||_0x4ca0('0x61')}];case'custom':return[{'name':'attrPath','value':_0x22cfe5[_0x4ca0('0x62')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||''}];case _0x4ca0('0x63'):return[{'name':'attrHourFormat','value':_0x22cfe5['attrHourFormat']||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x22cfe5['attrTimezone']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x1]?_0x22cfe5[_0x4ca0('0x5f')][0x1][_0x4ca0('0x60')]:undefined)||_0x4ca0('0x64')},{'name':_0x4ca0('0x65'),'value':_0x22cfe5[_0x4ca0('0x65')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x2]?_0x22cfe5[_0x4ca0('0x5f')][0x2]['value']:undefined)||0xc}];case _0x4ca0('0x66'):return[{'name':_0x4ca0('0x67'),'value':_0x22cfe5['attrMetric']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||_0x4ca0('0x68')},{'name':_0x4ca0('0x69'),'value':_0x22cfe5[_0x4ca0('0x69')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x1]?_0x22cfe5[_0x4ca0('0x5f')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x22cfe5['attrFontSize']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x2]?_0x22cfe5[_0x4ca0('0x5f')][0x2][_0x4ca0('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x22cfe5['attrChannel']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x3]?_0x22cfe5[_0x4ca0('0x5f')][0x3]['value']:undefined)||_0x4ca0('0x6a')},{'name':_0x4ca0('0x6b'),'value':_0x22cfe5[_0x4ca0('0x6b')]||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x4]?_0x22cfe5[_0x4ca0('0x5f')][0x4][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x6c'),'value':_0x22cfe5[_0x4ca0('0x6c')]||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x5]?_0x22cfe5[_0x4ca0('0x5f')][0x5]['value']:undefined)||''},{'name':_0x4ca0('0x6d'),'value':_0x22cfe5[_0x4ca0('0x6d')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x6]?_0x22cfe5['attrs'][0x6][_0x4ca0('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x22cfe5[_0x4ca0('0x6e')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x7]?_0x22cfe5[_0x4ca0('0x5f')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x22cfe5[_0x4ca0('0x6f')]||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x8]?_0x22cfe5[_0x4ca0('0x5f')][0x8][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x70'),'value':_0x22cfe5['attrChatWebsites']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x9]?_0x22cfe5['attrs'][0x9][_0x4ca0('0x60')]:undefined)||''}];case _0x4ca0('0x71'):case _0x4ca0('0x72'):return[{'name':_0x4ca0('0x73'),'value':_0x22cfe5[_0x4ca0('0x73')]||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||_0x4ca0('0x68')},{'name':_0x4ca0('0x74'),'value':_0x22cfe5['attrSerie2']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x1]?_0x22cfe5[_0x4ca0('0x5f')][0x1][_0x4ca0('0x60')]:undefined)||null},{'name':_0x4ca0('0x75'),'value':_0x22cfe5['attrSerie3']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x2]?_0x22cfe5[_0x4ca0('0x5f')][0x2][_0x4ca0('0x60')]:undefined)||null},{'name':_0x4ca0('0x69'),'value':_0x22cfe5[_0x4ca0('0x69')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x3]?_0x22cfe5['attrs'][0x3][_0x4ca0('0x60')]:undefined)||[]},{'name':'attrChannel','value':_0x22cfe5[_0x4ca0('0x76')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x4]?_0x22cfe5[_0x4ca0('0x5f')][0x4][_0x4ca0('0x60')]:undefined)||'voice'},{'name':_0x4ca0('0x6b'),'value':_0x22cfe5['attrEmailAccounts']||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x5]?_0x22cfe5[_0x4ca0('0x5f')][0x5][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x6c'),'value':_0x22cfe5[_0x4ca0('0x6c')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x6]?_0x22cfe5[_0x4ca0('0x5f')][0x6][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x6d'),'value':_0x22cfe5[_0x4ca0('0x6d')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x7]?_0x22cfe5['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x22cfe5[_0x4ca0('0x6e')]||(_0x22cfe5['attrs']&&_0x22cfe5['attrs'][0x8]?_0x22cfe5[_0x4ca0('0x5f')][0x8][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x6f'),'value':_0x22cfe5[_0x4ca0('0x6f')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5[_0x4ca0('0x5f')][0x9]?_0x22cfe5[_0x4ca0('0x5f')][0x9][_0x4ca0('0x60')]:undefined)||''},{'name':_0x4ca0('0x70'),'value':_0x22cfe5['attrChatWebsites']||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0xa]?_0x22cfe5[_0x4ca0('0x5f')][0xa][_0x4ca0('0x60')]:undefined)||''}];case _0x4ca0('0x77'):return[{'name':_0x4ca0('0x78'),'type':_0x22cfe5['reportType']||(_0x22cfe5['attrs']&&_0x22cfe5['attrs'][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x35')]:undefined)||null,'value':_0x22cfe5[_0x4ca0('0x78')]||(_0x22cfe5[_0x4ca0('0x5f')]&&_0x22cfe5['attrs'][0x0]?_0x22cfe5[_0x4ca0('0x5f')][0x0][_0x4ca0('0x60')]:undefined)||null},{'name':_0x4ca0('0x79'),'value':_0x22cfe5[_0x4ca0('0x79')]||(_0x22cfe5['attrs']&&_0x22cfe5[_0x4ca0('0x5f')][0x1]?_0x22cfe5[_0x4ca0('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x29a480){logger[_0x4ca0('0x57')]('widgetAttributes:\x20%s',JSON[_0x4ca0('0x7a')](_0x29a480));return[];}}exports['addItem']=function(_0x4fdbc0,_0x27c9dd,_0x360044){if(_0x4fdbc0['body']['id']){delete _0x4fdbc0[_0x4ca0('0x5c')]['id'];}return db[_0x4ca0('0x45')][_0x4ca0('0x4d')]({'where':{'id':_0x4fdbc0[_0x4ca0('0x4b')]['id']}})[_0x4ca0('0x2a')](handleEntityNotFound(_0x27c9dd,null))[_0x4ca0('0x2a')](function(_0x2ad985){if(_0x2ad985){_0x4fdbc0[_0x4ca0('0x5c')]['DashboardId']=_0x2ad985['id'];_0x4fdbc0['body']['attrs']=widgetAttributes(_0x4fdbc0[_0x4ca0('0x5c')]);return db['DashboardItem'][_0x4ca0('0x4f')](_0x4fdbc0[_0x4ca0('0x5c')]);}})[_0x4ca0('0x2a')](respondWithResult(_0x27c9dd,null))[_0x4ca0('0x4e')](handleError(_0x27c9dd,null));};exports[_0x4ca0('0x7b')]=function(_0x1dbc51,_0x5ddce2,_0xb43c96){var _0x345b53={};var _0x3ddd41={};var _0x5b43ea;var _0x270f96;return db[_0x4ca0('0x45')][_0x4ca0('0x7c')]({'where':{'id':_0x1dbc51[_0x4ca0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5ddce2,null))[_0x4ca0('0x2a')](function(_0x4f0d1b){if(_0x4f0d1b){_0x5b43ea=_0x4f0d1b;_0x3ddd41['model']=_[_0x4ca0('0x39')](db['DashboardItem'][_0x4ca0('0x33')]);_0x3ddd41[_0x4ca0('0x38')]=_[_0x4ca0('0x39')](_0x1dbc51[_0x4ca0('0x38')]);_0x3ddd41['filters']=_[_0x4ca0('0x3a')](_0x3ddd41[_0x4ca0('0x37')],_0x3ddd41[_0x4ca0('0x38')]);_0x345b53[_0x4ca0('0x3c')]=_[_0x4ca0('0x3a')](_0x3ddd41[_0x4ca0('0x37')],qs['fields'](_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x3b')]));_0x345b53[_0x4ca0('0x3c')]=_0x345b53['attributes']['length']?_0x345b53[_0x4ca0('0x3c')]:_0x3ddd41[_0x4ca0('0x37')];_0x345b53[_0x4ca0('0x7d')]=qs['sort'](_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x7e')]);_0x345b53['where']=qs[_0x4ca0('0x3f')](_[_0x4ca0('0x7f')](_0x1dbc51[_0x4ca0('0x38')],_0x3ddd41[_0x4ca0('0x3f')]));if(_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x40')]){_0x345b53[_0x4ca0('0x41')]=_[_0x4ca0('0x42')](_0x345b53[_0x4ca0('0x41')],{'$or':_[_0x4ca0('0x32')](_0x345b53['attributes'],function(_0x5652ec){var _0x3fe49d={};_0x3fe49d[_0x5652ec]={'$like':'%'+_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x40')]+'%'};return _0x3fe49d;})});}_0x345b53=_['merge']({},_0x345b53,_0x1dbc51[_0x4ca0('0x44')]);return _0x5b43ea['getItems'](_0x345b53);}})['then'](function(_0x4d1223){if(_0x4d1223){_0x270f96=_0x4d1223['length'];if(!_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x3d')](_0x4ca0('0x3e'))){_0x345b53[_0x4ca0('0x26')]=qs[_0x4ca0('0x26')](_0x1dbc51[_0x4ca0('0x38')][_0x4ca0('0x26')]);_0x345b53[_0x4ca0('0x23')]=qs[_0x4ca0('0x23')](_0x1dbc51[_0x4ca0('0x38')]['offset']);}return _0x5b43ea['getItems'](_0x345b53);}})[_0x4ca0('0x2a')](function(_0x5a78bb){if(_0x5a78bb){return _0x5a78bb?{'count':_0x270f96,'rows':_0x5a78bb}:null;}})[_0x4ca0('0x2a')](respondWithResult(_0x5ddce2,null))['catch'](handleError(_0x5ddce2,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 94c2294..7673fbc 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 _0x7046=['events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x51b457,_0x4c309e){var _0x2830e=function(_0x2af9ab){while(--_0x2af9ab){_0x51b457['push'](_0x51b457['shift']());}};_0x2830e(++_0x4c309e);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require(_0x6704('0x0'));var Dashboard=require(_0x6704('0x1'))['db'][_0x6704('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6704('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6704('0x4'),'afterDestroy':_0x6704('0x5')};function emitEvent(_0x2899c5){return function(_0x5258e7,_0x1e9b2a,_0x35bcc6){DashboardEvents[_0x6704('0x6')](_0x2899c5+':'+_0x5258e7['id'],_0x5258e7);DashboardEvents[_0x6704('0x6')](_0x2899c5,_0x5258e7);_0x35bcc6(null);};}for(var e in events){if(events[_0x6704('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x6704('0x8')]=DashboardEvents; \ No newline at end of file +var _0x88f3=['../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x2b03f9,_0x5729b5){var _0x4bdc29=function(_0x2ad082){while(--_0x2ad082){_0x2b03f9['push'](_0x2b03f9['shift']());}};_0x4bdc29(++_0x5729b5);}(_0x88f3,0x70));var _0x388f=function(_0x50b80c,_0x5f24a4){_0x50b80c=_0x50b80c-0x0;var _0x56b354=_0x88f3[_0x50b80c];return _0x56b354;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x388f('0x0'))['db'][_0x388f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x388f('0x2'),'afterUpdate':_0x388f('0x3'),'afterDestroy':_0x388f('0x4')};function emitEvent(_0x1bd11d){return function(_0x47fd05,_0x4c70ce,_0x31d211){DashboardEvents[_0x388f('0x5')](_0x1bd11d+':'+_0x47fd05['id'],_0x47fd05);DashboardEvents['emit'](_0x1bd11d,_0x47fd05);_0x31d211(null);};}for(var e in events){if(events[_0x388f('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x388f('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d20d9cc..38a28e7 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 _0x2ae0=['util','../../config/logger','api','moment','bluebird','request-promise','./dashboard.attributes','exports','Dashboard','lodash'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x2ae0,0xbd));var _0x02ae=function(_0x567fb5,_0x143dde){_0x567fb5=_0x567fb5-0x0;var _0x3d3977=_0x2ae0[_0x567fb5];return _0x3d3977;};'use strict';var _=require(_0x02ae('0x0'));var util=require(_0x02ae('0x1'));var logger=require(_0x02ae('0x2'))(_0x02ae('0x3'));var moment=require(_0x02ae('0x4'));var BPromise=require(_0x02ae('0x5'));var rp=require(_0x02ae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x02ae('0x7'));module[_0x02ae('0x8')]=function(_0x3a77c0,_0x31a819){return _0x3a77c0['define'](_0x02ae('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdee8=['api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','../../config/logger'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0xdee8,0xe5));var _0x8dee=function(_0x1a38b6,_0x118210){_0x1a38b6=_0x1a38b6-0x0;var _0x1e84d3=_0xdee8[_0x1a38b6];return _0x1e84d3;};'use strict';var _=require(_0x8dee('0x0'));var util=require('util');var logger=require(_0x8dee('0x1'))(_0x8dee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8dee('0x3'));var fs=require('fs');var path=require(_0x8dee('0x4'));var rimraf=require(_0x8dee('0x5'));var config=require(_0x8dee('0x6'));var attributes=require(_0x8dee('0x7'));module['exports']=function(_0x25752d,_0x90e4ec){return _0x25752d[_0x8dee('0x8')](_0x8dee('0x9'),attributes,{'tableName':_0x8dee('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 e1f970f..8af495c 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 _0x3b1e=['defaults','localhost','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x3b1e,0x7c));var _0xe3b1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3b1e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe3b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe3b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3b1('0x2'));var db=require(_0xe3b1('0x3'))['db'];var utils=require(_0xe3b1('0x4'));var logger=require('../../config/logger')(_0xe3b1('0x5'));var config=require(_0xe3b1('0x6'));var jayson=require(_0xe3b1('0x7'));var client=jayson[_0xe3b1('0x8')][_0xe3b1('0x9')]({'port':0x232a});config[_0xe3b1('0xa')]=_[_0xe3b1('0xb')](config[_0xe3b1('0xa')],{'host':_0xe3b1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3b1('0xa')]));require(_0xe3b1('0xd'))[_0xe3b1('0xe')](socket);function respondWithRpcPromise(_0x123875,_0x14810b,_0x1e9cf0){return new BPromise(function(_0x50d3a4,_0x17030d){return client[_0xe3b1('0xf')](_0x123875,_0x1e9cf0)[_0xe3b1('0x10')](function(_0x723e47){logger[_0xe3b1('0x11')]('Dashboard,\x20%s,\x20%s',_0x14810b,_0xe3b1('0x12'));logger[_0xe3b1('0x13')](_0xe3b1('0x14'),_0x14810b,_0xe3b1('0x12'),JSON[_0xe3b1('0x15')](_0x723e47));if(_0x723e47[_0xe3b1('0x16')]){if(_0x723e47[_0xe3b1('0x16')][_0xe3b1('0x17')]===0x1f4){logger[_0xe3b1('0x16')]('Dashboard,\x20%s,\x20%s',_0x14810b,_0x723e47['error'][_0xe3b1('0x18')]);return _0x17030d(_0x723e47[_0xe3b1('0x16')][_0xe3b1('0x18')]);}logger[_0xe3b1('0x16')](_0xe3b1('0x19'),_0x14810b,_0x723e47['error'][_0xe3b1('0x18')]);return _0x50d3a4(_0x723e47['error'][_0xe3b1('0x18')]);}else{logger[_0xe3b1('0x11')](_0xe3b1('0x19'),_0x14810b,_0xe3b1('0x12'));_0x50d3a4(_0x723e47[_0xe3b1('0x1a')][_0xe3b1('0x18')]);}})['catch'](function(_0x1da993){logger['error'](_0xe3b1('0x19'),_0x14810b,_0x1da993);_0x17030d(_0x1da993);});});} \ No newline at end of file +var _0xf98b=['message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','Dashboard,\x20%s,\x20%s'];(function(_0x28c06c,_0x41f5f5){var _0x359d03=function(_0x558dac){while(--_0x558dac){_0x28c06c['push'](_0x28c06c['shift']());}};_0x359d03(++_0x41f5f5);}(_0xf98b,0x1a4));var _0xbf98=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf98b[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xbf98('0x0'));var util=require('util');var moment=require(_0xbf98('0x1'));var BPromise=require(_0xbf98('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf98('0x3'))['db'];var utils=require(_0xbf98('0x4'));var logger=require(_0xbf98('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf98('0x6')][_0xbf98('0x7')]({'port':0x232a});config[_0xbf98('0x8')]=_['defaults'](config['redis'],{'host':_0xbf98('0x9'),'port':0x18eb});var socket=require(_0xbf98('0xa'))(new Redis(config[_0xbf98('0x8')]));require('./dashboard.socket')[_0xbf98('0xb')](socket);function respondWithRpcPromise(_0x2c3f90,_0x32cb17,_0x1e69f9){return new BPromise(function(_0x280695,_0x3d9e7a){return client[_0xbf98('0xc')](_0x2c3f90,_0x1e69f9)[_0xbf98('0xd')](function(_0x489c9e){logger[_0xbf98('0xe')]('Dashboard,\x20%s,\x20%s',_0x32cb17,_0xbf98('0xf'));logger[_0xbf98('0x10')](_0xbf98('0x11'),_0x32cb17,_0xbf98('0xf'),JSON['stringify'](_0x489c9e));if(_0x489c9e[_0xbf98('0x12')]){if(_0x489c9e[_0xbf98('0x12')]['code']===0x1f4){logger['error'](_0xbf98('0x13'),_0x32cb17,_0x489c9e[_0xbf98('0x12')][_0xbf98('0x14')]);return _0x3d9e7a(_0x489c9e['error'][_0xbf98('0x14')]);}logger[_0xbf98('0x12')](_0xbf98('0x13'),_0x32cb17,_0x489c9e[_0xbf98('0x12')][_0xbf98('0x14')]);return _0x280695(_0x489c9e['error']['message']);}else{logger[_0xbf98('0xe')](_0xbf98('0x13'),_0x32cb17,_0xbf98('0xf'));_0x280695(_0x489c9e[_0xbf98('0x15')][_0xbf98('0x14')]);}})['catch'](function(_0x3b42c4){logger['error'](_0xbf98('0x13'),_0x32cb17,_0x3b42c4);_0x3d9e7a(_0x3b42c4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3028684..3662c86 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 _0xdc10=['emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0x741334,_0x4dadd8){var _0x11f9e0=function(_0x96e2a5){while(--_0x96e2a5){_0x741334['push'](_0x741334['shift']());}};_0x11f9e0(++_0x4dadd8);}(_0xdc10,0x117));var _0x0dc1=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xdc10[_0x255d5b];return _0x3e141a;};'use strict';var DashboardEvents=require(_0x0dc1('0x0'));var events=['save','remove','update'];function createListener(_0x296b4c,_0x45990d){return function(_0x23fc28){_0x45990d[_0x0dc1('0x1')](_0x296b4c,_0x23fc28);};}function removeListener(_0x3f7a5f,_0x2905ea){return function(){DashboardEvents[_0x0dc1('0x2')](_0x3f7a5f,_0x2905ea);};}exports['register']=function(_0x947a15){for(var _0x107619=0x0,_0x7c335e=events[_0x0dc1('0x3')];_0x107619<_0x7c335e;_0x107619++){var _0x48dde6=events[_0x107619];var _0x504e60=createListener(_0x0dc1('0x4')+_0x48dde6,_0x947a15);DashboardEvents['on'](_0x48dde6,_0x504e60);}}; \ No newline at end of file +var _0xd020=['remove','removeListener','register','./dashboard.events','save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd020,0x1ac));var _0x0d02=function(_0x2a5421,_0x1b2d0e){_0x2a5421=_0x2a5421-0x0;var _0x442ef4=_0xd020[_0x2a5421];return _0x442ef4;};'use strict';var DashboardEvents=require(_0x0d02('0x0'));var events=[_0x0d02('0x1'),_0x0d02('0x2'),'update'];function createListener(_0x35f6c8,_0x37eec5){return function(_0x276c6c){_0x37eec5['emit'](_0x35f6c8,_0x276c6c);};}function removeListener(_0x26a05f,_0x27aa5d){return function(){DashboardEvents[_0x0d02('0x3')](_0x26a05f,_0x27aa5d);};}exports[_0x0d02('0x4')]=function(_0x9464f){for(var _0x18bdfe=0x0,_0x47c4ec=events['length'];_0x18bdfe<_0x47c4ec;_0x18bdfe++){var _0xb3bbfc=events[_0x18bdfe];var _0x357d06=createListener('dashboard:'+_0xb3bbfc,_0x9464f);DashboardEvents['on'](_0xb3bbfc,_0x357d06);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6cf4580..259af96 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 _0xbb3f=['index','get','/:id','show','/:id/items','post','create','addItem','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated'];(function(_0x9a8878,_0x2ef1b8){var _0x5f36a8=function(_0x5b6079){while(--_0x5b6079){_0x9a8878['push'](_0x9a8878['shift']());}};_0x5f36a8(++_0x2ef1b8);}(_0xbb3f,0xfe));var _0xfbb3=function(_0x27fb87,_0x18d659){_0x27fb87=_0x27fb87-0x0;var _0x2dcdf9=_0xbb3f[_0x27fb87];return _0x2dcdf9;};'use strict';var multer=require(_0xfbb3('0x0'));var util=require(_0xfbb3('0x1'));var path=require('path');var timeout=require(_0xfbb3('0x2'));var express=require(_0xfbb3('0x3'));var router=express['Router']();var fs_extra=require(_0xfbb3('0x4'));var auth=require(_0xfbb3('0x5'));var interaction=require(_0xfbb3('0x6'));var config=require(_0xfbb3('0x7'));var controller=require(_0xfbb3('0x8'));router['get']('/',auth[_0xfbb3('0x9')](),controller[_0xfbb3('0xa')]);router[_0xfbb3('0xb')](_0xfbb3('0xc'),auth[_0xfbb3('0x9')](),controller[_0xfbb3('0xd')]);router['get'](_0xfbb3('0xe'),auth['isAuthenticated'](),controller['getItems']);router[_0xfbb3('0xf')]('/',auth[_0xfbb3('0x9')](),controller[_0xfbb3('0x10')]);router['post']('/:id/clone',auth[_0xfbb3('0x9')](),controller['clone']);router[_0xfbb3('0xf')](_0xfbb3('0xe'),auth[_0xfbb3('0x9')](),controller[_0xfbb3('0x11')]);router[_0xfbb3('0x12')](_0xfbb3('0xc'),auth[_0xfbb3('0x9')](),controller['update']);router[_0xfbb3('0x13')](_0xfbb3('0xc'),auth[_0xfbb3('0x9')](),controller[_0xfbb3('0x14')]);module[_0xfbb3('0x15')]=router; \ No newline at end of file +var _0x66bf=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','show','/:id/items','getItems','post','create','addItem','put','/:id','update','delete','destroy'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x66bf,0x121));var _0xf66b=function(_0x451b16,_0x2f49cb){_0x451b16=_0x451b16-0x0;var _0x327eab=_0x66bf[_0x451b16];return _0x327eab;};'use strict';var multer=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var path=require('path');var timeout=require(_0xf66b('0x2'));var express=require(_0xf66b('0x3'));var router=express['Router']();var fs_extra=require(_0xf66b('0x4'));var auth=require(_0xf66b('0x5'));var interaction=require(_0xf66b('0x6'));var config=require(_0xf66b('0x7'));var controller=require(_0xf66b('0x8'));router['get']('/',auth[_0xf66b('0x9')](),controller[_0xf66b('0xa')]);router[_0xf66b('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xf66b('0xc')]);router['get'](_0xf66b('0xd'),auth[_0xf66b('0x9')](),controller[_0xf66b('0xe')]);router[_0xf66b('0xf')]('/',auth[_0xf66b('0x9')](),controller[_0xf66b('0x10')]);router[_0xf66b('0xf')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router['post']('/:id/items',auth[_0xf66b('0x9')](),controller[_0xf66b('0x11')]);router[_0xf66b('0x12')](_0xf66b('0x13'),auth[_0xf66b('0x9')](),controller[_0xf66b('0x14')]);router[_0xf66b('0x15')](_0xf66b('0x13'),auth[_0xf66b('0x9')](),controller[_0xf66b('0x16')]);module[_0xf66b('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7221cd6..4215371 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x46ed,0x168));var _0xd46e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46ed[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xacf4=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xacf4,0xe7));var _0x4acf=function(_0x177db3,_0x25697a){_0x177db3=_0x177db3-0x0;var _0x28e0d0=_0xacf4[_0x177db3];return _0x28e0d0;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0x4acf('0x0'));module[_0x4acf('0x1')]={'title':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4acf('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4acf('0x3')](_0x4acf('0x4')),'get':function(){try{return JSON[_0x4acf('0x5')](this['getDataValue'](_0x4acf('0x6')));}catch(_0x2124c8){return[];}},'set':function(_0x4e0c43){try{this[_0x4acf('0x7')](_0x4acf('0x6'),JSON[_0x4acf('0x8')](_0x4e0c43));}catch(_0x45a5a4){this[_0x4acf('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x4acf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4acf('0x9')]},'col':{'type':Sequelize[_0x4acf('0x9')]},'background':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4acf('0x2')],'allowNull':![],'defaultValue':_0x4acf('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8a8fec3..62b2ee3 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 _0x31c2=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','include','merge','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end'];(function(_0x30cef8,_0x13269f){var _0x28c275=function(_0x4d62a1){while(--_0x4d62a1){_0x30cef8['push'](_0x30cef8['shift']());}};_0x28c275(++_0x13269f);}(_0x31c2,0x1e1));var _0x231c=function(_0x10bf83,_0x1f8eb9){_0x10bf83=_0x10bf83-0x0;var _0xc41bfd=_0x31c2[_0x10bf83];return _0xc41bfd;};'use strict';var emlformat=require(_0x231c('0x0'));var rimraf=require(_0x231c('0x1'));var zipdir=require(_0x231c('0x2'));var jsonpatch=require(_0x231c('0x3'));var rp=require(_0x231c('0x4'));var moment=require(_0x231c('0x5'));var BPromise=require(_0x231c('0x6'));var Mustache=require(_0x231c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x231c('0x8'));var csv=require(_0x231c('0x9'));var ejs=require(_0x231c('0xa'));var fs=require('fs');var fs_extra=require(_0x231c('0xb'));var _=require('lodash');var squel=require(_0x231c('0xc'));var crypto=require('crypto');var jsforce=require(_0x231c('0xd'));var deskjs=require(_0x231c('0xe'));var toCsv=require(_0x231c('0x9'));var querystring=require('querystring');var Papa=require(_0x231c('0xf'));var Redis=require(_0x231c('0x10'));var authService=require(_0x231c('0x11'));var qs=require(_0x231c('0x12'));var as=require(_0x231c('0x13'));var hardwareService=require(_0x231c('0x14'));var logger=require(_0x231c('0x15'))('api');var utils=require(_0x231c('0x16'));var config=require(_0x231c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x231c('0x18'))['db'];config[_0x231c('0x19')]=_[_0x231c('0x1a')](config[_0x231c('0x19')],{'host':_0x231c('0x1b'),'port':0x18eb});var socket=require(_0x231c('0x1c'))(new Redis(config[_0x231c('0x19')]));require(_0x231c('0x1d'))[_0x231c('0x1e')](socket);function respondWithStatusCode(_0x311218,_0x2d75b5){_0x2d75b5=_0x2d75b5||0xcc;return function(_0xfea7af){if(_0xfea7af){return _0x311218[_0x231c('0x1f')](_0x2d75b5);}return _0x311218[_0x231c('0x20')](_0x2d75b5)[_0x231c('0x21')]();};}function respondWithResult(_0x210f2e,_0x123f2d){_0x123f2d=_0x123f2d||0xc8;return function(_0x192bac){if(_0x192bac){return _0x210f2e[_0x231c('0x20')](_0x123f2d)[_0x231c('0x22')](_0x192bac);}};}function respondWithFilteredResult(_0x51b8ca,_0x599cd6){return function(_0x341645){if(_0x341645){var _0x17f9ce=typeof _0x599cd6[_0x231c('0x23')]===_0x231c('0x24')&&typeof _0x599cd6[_0x231c('0x25')]===_0x231c('0x24');var _0x172d50=_0x341645[_0x231c('0x26')];var _0x1c9c85=_0x17f9ce?0x0:_0x599cd6['offset'];var _0x4a0c45=_0x17f9ce?_0x341645['count']:_0x599cd6[_0x231c('0x23')]+_0x599cd6['limit'];var _0x42cca3;if(_0x4a0c45>=_0x172d50){_0x4a0c45=_0x172d50;_0x42cca3=0xc8;}else{_0x42cca3=0xce;}_0x51b8ca[_0x231c('0x20')](_0x42cca3);return _0x51b8ca[_0x231c('0x27')](_0x231c('0x28'),_0x1c9c85+'-'+_0x4a0c45+'/'+_0x172d50)[_0x231c('0x22')](_0x341645);}return null;};}function patchUpdates(_0x309393){return function(_0x1c07d6){try{jsonpatch[_0x231c('0x29')](_0x1c07d6,_0x309393,!![]);}catch(_0x54566f){return BPromise[_0x231c('0x2a')](_0x54566f);}return _0x1c07d6[_0x231c('0x2b')]();};}function saveUpdates(_0x4af49b,_0x14db88){return function(_0x141ac4){if(_0x141ac4){return _0x141ac4['update'](_0x4af49b)[_0x231c('0x2c')](function(_0x564939){return _0x564939;});}return null;};}function removeEntity(_0x3ea0cd,_0x454f70){return function(_0x40e8ff){if(_0x40e8ff){return _0x40e8ff[_0x231c('0x2d')]()[_0x231c('0x2c')](function(){_0x3ea0cd[_0x231c('0x20')](0xcc)[_0x231c('0x21')]();});}};}function handleEntityNotFound(_0x4caf68,_0x33cc46){return function(_0x1b53bc){if(!_0x1b53bc){_0x4caf68['sendStatus'](0x194);}return _0x1b53bc;};}function handleError(_0x3a0ca4,_0x40f820){_0x40f820=_0x40f820||0x1f4;return function(_0x45ced8){logger[_0x231c('0x2e')](_0x45ced8[_0x231c('0x2f')]);if(_0x45ced8[_0x231c('0x30')]){delete _0x45ced8[_0x231c('0x30')];}_0x3a0ca4['status'](_0x40f820)[_0x231c('0x31')](_0x45ced8);};}exports[_0x231c('0x32')]=function(_0x578512,_0x4be2e2){var _0x5bfc50={'raw':![],'where':{'id':_0x578512['params']['id']}},_0x9f459={};_0x9f459[_0x231c('0x33')]=_['keys'](db[_0x231c('0x34')][_0x231c('0x35')]);_0x9f459[_0x231c('0x36')]=_[_0x231c('0x37')](_0x578512['query']);_0x9f459[_0x231c('0x38')]=_[_0x231c('0x39')](_0x9f459[_0x231c('0x33')],_0x9f459[_0x231c('0x36')]);_0x5bfc50[_0x231c('0x3a')]=_[_0x231c('0x39')](_0x9f459[_0x231c('0x33')],qs[_0x231c('0x3b')](_0x578512['query']['fields']));_0x5bfc50[_0x231c('0x3a')]=_0x5bfc50[_0x231c('0x3a')][_0x231c('0x3c')]?_0x5bfc50[_0x231c('0x3a')]:_0x9f459[_0x231c('0x33')];if(_0x578512[_0x231c('0x36')]['includeAll']){_0x5bfc50[_0x231c('0x3d')]=[{'all':!![]}];}_0x5bfc50=_[_0x231c('0x3e')]({},_0x5bfc50,_0x578512['options']);return db['DashboardItem'][_0x231c('0x3f')](_0x5bfc50)['then'](handleEntityNotFound(_0x4be2e2,null))[_0x231c('0x2c')](respondWithResult(_0x4be2e2,null))['catch'](handleError(_0x4be2e2,null));};exports[_0x231c('0x2d')]=function(_0x2c7c22,_0x5e96a9){return db[_0x231c('0x34')][_0x231c('0x3f')]({'where':{'id':_0x2c7c22[_0x231c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e96a9,null))[_0x231c('0x2c')](removeEntity(_0x5e96a9,null))[_0x231c('0x41')](handleError(_0x5e96a9,null));};function widgetAttributes(_0x705dc4){try{switch(_0x705dc4[_0x231c('0x42')]){case _0x231c('0x43'):return[{'name':_0x231c('0x44'),'value':_0x705dc4[_0x231c('0x44')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x46')]:undefined)||_0x231c('0x47')}];case _0x231c('0x48'):return[{'name':'attrPath','value':_0x705dc4[_0x231c('0x49')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x46')]:undefined)||''}];case'clock':return[{'name':_0x231c('0x4a'),'value':_0x705dc4[_0x231c('0x4a')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x46')]:undefined)||_0x231c('0x4b')},{'name':_0x231c('0x4c'),'value':_0x705dc4[_0x231c('0x4c')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x1]?_0x705dc4[_0x231c('0x45')][0x1][_0x231c('0x46')]:undefined)||_0x231c('0x4d')},{'name':_0x231c('0x4e'),'value':_0x705dc4['attrFontSize']||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x2]?_0x705dc4[_0x231c('0x45')][0x2]['value']:undefined)||0xc}];case _0x231c('0x4f'):return[{'name':_0x231c('0x50'),'value':_0x705dc4[_0x231c('0x50')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x0]?_0x705dc4[_0x231c('0x45')][0x0]['value']:undefined)||_0x231c('0x51')},{'name':_0x231c('0x52'),'value':_0x705dc4[_0x231c('0x52')]||(_0x705dc4['attrs']&&_0x705dc4[_0x231c('0x45')][0x1]?_0x705dc4[_0x231c('0x45')][0x1][_0x231c('0x46')]:undefined)||[]},{'name':_0x231c('0x4e'),'value':_0x705dc4['attrFontSize']||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x2]?_0x705dc4[_0x231c('0x45')][0x2][_0x231c('0x46')]:undefined)||0x14},{'name':_0x231c('0x53'),'value':_0x705dc4[_0x231c('0x53')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x3]?_0x705dc4[_0x231c('0x45')][0x3][_0x231c('0x46')]:undefined)||_0x231c('0x54')},{'name':_0x231c('0x55'),'value':_0x705dc4[_0x231c('0x55')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x4]?_0x705dc4[_0x231c('0x45')][0x4]['value']:undefined)||''},{'name':_0x231c('0x56'),'value':_0x705dc4[_0x231c('0x56')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x5]?_0x705dc4[_0x231c('0x45')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x705dc4[_0x231c('0x57')]||(_0x705dc4['attrs']&&_0x705dc4[_0x231c('0x45')][0x6]?_0x705dc4[_0x231c('0x45')][0x6][_0x231c('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x705dc4[_0x231c('0x58')]||(_0x705dc4['attrs']&&_0x705dc4[_0x231c('0x45')][0x7]?_0x705dc4[_0x231c('0x45')][0x7]['value']:undefined)||''},{'name':_0x231c('0x59'),'value':_0x705dc4[_0x231c('0x59')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x8]?_0x705dc4['attrs'][0x8]['value']:undefined)||''},{'name':_0x231c('0x5a'),'value':_0x705dc4[_0x231c('0x5a')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x9]?_0x705dc4[_0x231c('0x45')][0x9][_0x231c('0x46')]:undefined)||''}];case _0x231c('0x5b'):case _0x231c('0x5c'):return[{'name':_0x231c('0x5d'),'value':_0x705dc4[_0x231c('0x5d')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x46')]:undefined)||_0x231c('0x51')},{'name':'attrSerie2','value':_0x705dc4[_0x231c('0x5e')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x1]?_0x705dc4[_0x231c('0x45')][0x1]['value']:undefined)||null},{'name':_0x231c('0x5f'),'value':_0x705dc4[_0x231c('0x5f')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x2]?_0x705dc4[_0x231c('0x45')][0x2][_0x231c('0x46')]:undefined)||null},{'name':_0x231c('0x52'),'value':_0x705dc4[_0x231c('0x52')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x3]?_0x705dc4['attrs'][0x3][_0x231c('0x46')]:undefined)||[]},{'name':_0x231c('0x53'),'value':_0x705dc4[_0x231c('0x53')]||(_0x705dc4['attrs']&&_0x705dc4[_0x231c('0x45')][0x4]?_0x705dc4[_0x231c('0x45')][0x4]['value']:undefined)||_0x231c('0x54')},{'name':'attrEmailAccounts','value':_0x705dc4[_0x231c('0x55')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x5]?_0x705dc4[_0x231c('0x45')][0x5][_0x231c('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x705dc4[_0x231c('0x56')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x6]?_0x705dc4[_0x231c('0x45')][0x6][_0x231c('0x46')]:undefined)||''},{'name':_0x231c('0x57'),'value':_0x705dc4[_0x231c('0x57')]||(_0x705dc4['attrs']&&_0x705dc4['attrs'][0x7]?_0x705dc4['attrs'][0x7][_0x231c('0x46')]:undefined)||''},{'name':_0x231c('0x58'),'value':_0x705dc4['attrOpenchannelAccounts']||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x8]?_0x705dc4[_0x231c('0x45')][0x8][_0x231c('0x46')]:undefined)||''},{'name':_0x231c('0x59'),'value':_0x705dc4[_0x231c('0x59')]||(_0x705dc4['attrs']&&_0x705dc4[_0x231c('0x45')][0x9]?_0x705dc4['attrs'][0x9][_0x231c('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x705dc4['attrChatWebsites']||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0xa]?_0x705dc4[_0x231c('0x45')][0xa][_0x231c('0x46')]:undefined)||''}];case'web-report':return[{'name':_0x231c('0x60'),'type':_0x705dc4[_0x231c('0x61')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4[_0x231c('0x45')][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x42')]:undefined)||null,'value':_0x705dc4['attrReport']||(_0x705dc4['attrs']&&_0x705dc4['attrs'][0x0]?_0x705dc4[_0x231c('0x45')][0x0][_0x231c('0x46')]:undefined)||null},{'name':_0x231c('0x62'),'value':_0x705dc4[_0x231c('0x62')]||(_0x705dc4[_0x231c('0x45')]&&_0x705dc4['attrs'][0x1]?_0x705dc4['attrs'][0x1][_0x231c('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x413474){logger[_0x231c('0x2e')]('widgetAttributes:\x20%s',JSON[_0x231c('0x63')](_0x413474));return[];}}exports[_0x231c('0x64')]=function(_0x26dc8e,_0x3cce20){if(_0x26dc8e['body']){_0x26dc8e['body']['attrs']=widgetAttributes(_0x26dc8e[_0x231c('0x65')]);}return db[_0x231c('0x34')]['create'](_0x26dc8e[_0x231c('0x65')],{})[_0x231c('0x2c')](respondWithResult(_0x3cce20,0xc9))[_0x231c('0x41')](handleError(_0x3cce20,null));};exports[_0x231c('0x66')]=function(_0x2e1181,_0x1fb668){if(_0x2e1181['body']['id']){delete _0x2e1181[_0x231c('0x65')]['id'];}_0x2e1181[_0x231c('0x65')][_0x231c('0x45')]=widgetAttributes(_0x2e1181['body']);return db[_0x231c('0x34')][_0x231c('0x3f')]({'where':{'id':_0x2e1181[_0x231c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fb668,null))[_0x231c('0x2c')](saveUpdates(_0x2e1181[_0x231c('0x65')],null))['then'](respondWithResult(_0x1fb668,null))['catch'](handleError(_0x1fb668,null));}; \ No newline at end of file +var _0xf603=['attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','merge','find','catch','type','attrUrl','attrs','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','value','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0xee2b5b,_0x508f9c){var _0x4150f3=function(_0x5b360b){while(--_0x5b360b){_0xee2b5b['push'](_0xee2b5b['shift']());}};_0x4150f3(++_0x508f9c);}(_0xf603,0x124));var _0x3f60=function(_0x502ca9,_0x54bcf7){_0x502ca9=_0x502ca9-0x0;var _0x3d3986=_0xf603[_0x502ca9];return _0x3d3986;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];config[_0x3f60('0x19')]=_['defaults'](config[_0x3f60('0x19')],{'host':_0x3f60('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f60('0x19')]));require(_0x3f60('0x1b'))['register'](socket);function respondWithStatusCode(_0x1ec7f4,_0x5a047a){_0x5a047a=_0x5a047a||0xcc;return function(_0x39ce92){if(_0x39ce92){return _0x1ec7f4[_0x3f60('0x1c')](_0x5a047a);}return _0x1ec7f4['status'](_0x5a047a)[_0x3f60('0x1d')]();};}function respondWithResult(_0x4e84b5,_0x2fe94a){_0x2fe94a=_0x2fe94a||0xc8;return function(_0x4fe8ee){if(_0x4fe8ee){return _0x4e84b5[_0x3f60('0x1e')](_0x2fe94a)[_0x3f60('0x1f')](_0x4fe8ee);}};}function respondWithFilteredResult(_0xbc26c,_0x2b893c){return function(_0x3ae771){if(_0x3ae771){var _0xe64a00=typeof _0x2b893c['offset']===_0x3f60('0x20')&&typeof _0x2b893c[_0x3f60('0x21')]===_0x3f60('0x20');var _0x9c845f=_0x3ae771[_0x3f60('0x22')];var _0x14f44a=_0xe64a00?0x0:_0x2b893c['offset'];var _0x35dcd8=_0xe64a00?_0x3ae771[_0x3f60('0x22')]:_0x2b893c['offset']+_0x2b893c[_0x3f60('0x21')];var _0x2dba08;if(_0x35dcd8>=_0x9c845f){_0x35dcd8=_0x9c845f;_0x2dba08=0xc8;}else{_0x2dba08=0xce;}_0xbc26c[_0x3f60('0x1e')](_0x2dba08);return _0xbc26c[_0x3f60('0x23')](_0x3f60('0x24'),_0x14f44a+'-'+_0x35dcd8+'/'+_0x9c845f)[_0x3f60('0x1f')](_0x3ae771);}return null;};}function patchUpdates(_0x44b665){return function(_0x15f705){try{jsonpatch[_0x3f60('0x25')](_0x15f705,_0x44b665,!![]);}catch(_0x31847d){return BPromise[_0x3f60('0x26')](_0x31847d);}return _0x15f705[_0x3f60('0x27')]();};}function saveUpdates(_0x1f9390,_0x39ba85){return function(_0x2e3918){if(_0x2e3918){return _0x2e3918['update'](_0x1f9390)[_0x3f60('0x28')](function(_0x3cdef4){return _0x3cdef4;});}return null;};}function removeEntity(_0x15315b,_0x4581d6){return function(_0x1e1af4){if(_0x1e1af4){return _0x1e1af4[_0x3f60('0x29')]()[_0x3f60('0x28')](function(){_0x15315b[_0x3f60('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473bd7,_0x1829f2){return function(_0x20ef1c){if(!_0x20ef1c){_0x473bd7[_0x3f60('0x1c')](0x194);}return _0x20ef1c;};}function handleError(_0xed7e00,_0xa69033){_0xa69033=_0xa69033||0x1f4;return function(_0x39e14c){logger[_0x3f60('0x2a')](_0x39e14c[_0x3f60('0x2b')]);if(_0x39e14c[_0x3f60('0x2c')]){delete _0x39e14c[_0x3f60('0x2c')];}_0xed7e00[_0x3f60('0x1e')](_0xa69033)[_0x3f60('0x2d')](_0x39e14c);};}exports[_0x3f60('0x2e')]=function(_0x25ccac,_0x14d83c){var _0x10a861={'raw':![],'where':{'id':_0x25ccac[_0x3f60('0x2f')]['id']}},_0x3dd647={};_0x3dd647[_0x3f60('0x30')]=_[_0x3f60('0x31')](db[_0x3f60('0x32')][_0x3f60('0x33')]);_0x3dd647[_0x3f60('0x34')]=_[_0x3f60('0x31')](_0x25ccac[_0x3f60('0x34')]);_0x3dd647[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3dd647[_0x3f60('0x30')],_0x3dd647[_0x3f60('0x34')]);_0x10a861[_0x3f60('0x37')]=_['intersection'](_0x3dd647[_0x3f60('0x30')],qs[_0x3f60('0x38')](_0x25ccac['query'][_0x3f60('0x38')]));_0x10a861[_0x3f60('0x37')]=_0x10a861[_0x3f60('0x37')][_0x3f60('0x39')]?_0x10a861['attributes']:_0x3dd647[_0x3f60('0x30')];if(_0x25ccac[_0x3f60('0x34')]['includeAll']){_0x10a861['include']=[{'all':!![]}];}_0x10a861=_[_0x3f60('0x3a')]({},_0x10a861,_0x25ccac['options']);return db[_0x3f60('0x32')][_0x3f60('0x3b')](_0x10a861)[_0x3f60('0x28')](handleEntityNotFound(_0x14d83c,null))[_0x3f60('0x28')](respondWithResult(_0x14d83c,null))['catch'](handleError(_0x14d83c,null));};exports['destroy']=function(_0x353969,_0x3caa2e){return db[_0x3f60('0x32')][_0x3f60('0x3b')]({'where':{'id':_0x353969[_0x3f60('0x2f')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x3caa2e,null))['then'](removeEntity(_0x3caa2e,null))[_0x3f60('0x3c')](handleError(_0x3caa2e,null));};function widgetAttributes(_0x4ae395){try{switch(_0x4ae395[_0x3f60('0x3d')]){case'iframe':return[{'name':_0x3f60('0x3e'),'value':_0x4ae395[_0x3f60('0x3e')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0]['value']:undefined)||'https://'}];case _0x3f60('0x40'):return[{'name':_0x3f60('0x41'),'value':_0x4ae395[_0x3f60('0x41')]||(_0x4ae395['attrs']&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x3f60('0x42'),'value':_0x4ae395[_0x3f60('0x42')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0]['value']:undefined)||_0x3f60('0x43')},{'name':_0x3f60('0x44'),'value':_0x4ae395[_0x3f60('0x44')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x1]?_0x4ae395[_0x3f60('0x3f')][0x1]['value']:undefined)||'0.00'},{'name':_0x3f60('0x45'),'value':_0x4ae395[_0x3f60('0x45')]||(_0x4ae395['attrs']&&_0x4ae395['attrs'][0x2]?_0x4ae395['attrs'][0x2][_0x3f60('0x46')]:undefined)||0xc}];case _0x3f60('0x47'):return[{'name':'attrMetric','value':_0x4ae395['attrMetric']||(_0x4ae395['attrs']&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395['attrs'][0x0]['value']:undefined)||_0x3f60('0x48')},{'name':_0x3f60('0x49'),'value':_0x4ae395['attrVoiceQueues']||(_0x4ae395['attrs']&&_0x4ae395[_0x3f60('0x3f')][0x1]?_0x4ae395['attrs'][0x1][_0x3f60('0x46')]:undefined)||[]},{'name':'attrFontSize','value':_0x4ae395[_0x3f60('0x45')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x2]?_0x4ae395[_0x3f60('0x3f')][0x2][_0x3f60('0x46')]:undefined)||0x14},{'name':'attrChannel','value':_0x4ae395[_0x3f60('0x4a')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x3]?_0x4ae395['attrs'][0x3][_0x3f60('0x46')]:undefined)||_0x3f60('0x4b')},{'name':_0x3f60('0x4c'),'value':_0x4ae395[_0x3f60('0x4c')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x4]?_0x4ae395[_0x3f60('0x3f')][0x4]['value']:undefined)||''},{'name':_0x3f60('0x4d'),'value':_0x4ae395[_0x3f60('0x4d')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x5]?_0x4ae395[_0x3f60('0x3f')][0x5][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x4e'),'value':_0x4ae395['attrSmsAccounts']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x6]?_0x4ae395[_0x3f60('0x3f')][0x6][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x4f'),'value':_0x4ae395[_0x3f60('0x4f')]||(_0x4ae395['attrs']&&_0x4ae395[_0x3f60('0x3f')][0x7]?_0x4ae395[_0x3f60('0x3f')][0x7]['value']:undefined)||''},{'name':_0x3f60('0x50'),'value':_0x4ae395['attrWhatsappAccounts']||(_0x4ae395['attrs']&&_0x4ae395['attrs'][0x8]?_0x4ae395['attrs'][0x8]['value']:undefined)||''},{'name':_0x3f60('0x51'),'value':_0x4ae395['attrChatWebsites']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x9]?_0x4ae395[_0x3f60('0x3f')][0x9]['value']:undefined)||''}];case _0x3f60('0x52'):case _0x3f60('0x53'):return[{'name':_0x3f60('0x54'),'value':_0x4ae395[_0x3f60('0x54')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0][_0x3f60('0x46')]:undefined)||_0x3f60('0x48')},{'name':_0x3f60('0x55'),'value':_0x4ae395['attrSerie2']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x1]?_0x4ae395[_0x3f60('0x3f')][0x1][_0x3f60('0x46')]:undefined)||null},{'name':_0x3f60('0x56'),'value':_0x4ae395[_0x3f60('0x56')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x2]?_0x4ae395[_0x3f60('0x3f')][0x2][_0x3f60('0x46')]:undefined)||null},{'name':_0x3f60('0x49'),'value':_0x4ae395[_0x3f60('0x49')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x3]?_0x4ae395[_0x3f60('0x3f')][0x3][_0x3f60('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x4ae395[_0x3f60('0x4a')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x4]?_0x4ae395[_0x3f60('0x3f')][0x4][_0x3f60('0x46')]:undefined)||_0x3f60('0x4b')},{'name':'attrEmailAccounts','value':_0x4ae395['attrEmailAccounts']||(_0x4ae395['attrs']&&_0x4ae395[_0x3f60('0x3f')][0x5]?_0x4ae395[_0x3f60('0x3f')][0x5][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x4d'),'value':_0x4ae395['attrFaxAccounts']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x6]?_0x4ae395['attrs'][0x6][_0x3f60('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4ae395[_0x3f60('0x4e')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x7]?_0x4ae395[_0x3f60('0x3f')][0x7][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x4f'),'value':_0x4ae395['attrOpenchannelAccounts']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x8]?_0x4ae395[_0x3f60('0x3f')][0x8][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x50'),'value':_0x4ae395[_0x3f60('0x50')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x9]?_0x4ae395['attrs'][0x9][_0x3f60('0x46')]:undefined)||''},{'name':_0x3f60('0x51'),'value':_0x4ae395[_0x3f60('0x51')]||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0xa]?_0x4ae395[_0x3f60('0x3f')][0xa][_0x3f60('0x46')]:undefined)||''}];case'web-report':return[{'name':_0x3f60('0x57'),'type':_0x4ae395['reportType']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395[_0x3f60('0x3f')][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0][_0x3f60('0x3d')]:undefined)||null,'value':_0x4ae395['attrReport']||(_0x4ae395[_0x3f60('0x3f')]&&_0x4ae395['attrs'][0x0]?_0x4ae395[_0x3f60('0x3f')][0x0][_0x3f60('0x46')]:undefined)||null},{'name':_0x3f60('0x58'),'value':_0x4ae395[_0x3f60('0x58')]||(_0x4ae395['attrs']&&_0x4ae395['attrs'][0x1]?_0x4ae395['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x547626){logger[_0x3f60('0x2a')](_0x3f60('0x59'),JSON['stringify'](_0x547626));return[];}}exports[_0x3f60('0x5a')]=function(_0xf5e02,_0x14a96b){if(_0xf5e02[_0x3f60('0x5b')]){_0xf5e02[_0x3f60('0x5b')][_0x3f60('0x3f')]=widgetAttributes(_0xf5e02[_0x3f60('0x5b')]);}return db['DashboardItem'][_0x3f60('0x5a')](_0xf5e02['body'],{})[_0x3f60('0x28')](respondWithResult(_0x14a96b,0xc9))['catch'](handleError(_0x14a96b,null));};exports[_0x3f60('0x5c')]=function(_0xf635bf,_0x58656f){if(_0xf635bf[_0x3f60('0x5b')]['id']){delete _0xf635bf[_0x3f60('0x5b')]['id'];}_0xf635bf[_0x3f60('0x5b')]['attrs']=widgetAttributes(_0xf635bf['body']);return db[_0x3f60('0x32')][_0x3f60('0x3b')]({'where':{'id':_0xf635bf[_0x3f60('0x2f')]['id']}})[_0x3f60('0x28')](handleEntityNotFound(_0x58656f,null))[_0x3f60('0x28')](saveUpdates(_0xf635bf['body'],null))[_0x3f60('0x28')](respondWithResult(_0x58656f,null))[_0x3f60('0x3c')](handleError(_0x58656f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 011f5dd..5e9c7cd 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 _0xce0d=['emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x34c26b,_0x5e279b){var _0x2f9f58=function(_0x273abe){while(--_0x273abe){_0x34c26b['push'](_0x34c26b['shift']());}};_0x2f9f58(++_0x5e279b);}(_0xce0d,0x143));var _0xdce0=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0xce0d[_0x546c68];return _0x4a2389;};'use strict';var EventEmitter=require(_0xdce0('0x0'));var DashboardItem=require(_0xdce0('0x1'))['db'][_0xdce0('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xdce0('0x3')](0x0);var events={'afterCreate':_0xdce0('0x4'),'afterUpdate':_0xdce0('0x5'),'afterDestroy':_0xdce0('0x6')};function emitEvent(_0x518e35){return function(_0x2e1ad4,_0x2130a8,_0x4eb285){DashboardItemEvents['emit'](_0x518e35+':'+_0x2e1ad4['id'],_0x2e1ad4);DashboardItemEvents[_0xdce0('0x7')](_0x518e35,_0x2e1ad4);_0x4eb285(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xdce0('0x8')](e,emitEvent(event));}}module[_0xdce0('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0xeb94=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x401503,_0x2279d0){var _0x298e30=function(_0x3f6f0e){while(--_0x3f6f0e){_0x401503['push'](_0x401503['shift']());}};_0x298e30(++_0x2279d0);}(_0xeb94,0x1d2));var _0x4eb9=function(_0x385669,_0x43d386){_0x385669=_0x385669-0x0;var _0x11e2d2=_0xeb94[_0x385669];return _0x11e2d2;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x4eb9('0x0'))['db'][_0x4eb9('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4eb9('0x2')](0x0);var events={'afterCreate':_0x4eb9('0x3'),'afterUpdate':_0x4eb9('0x4'),'afterDestroy':_0x4eb9('0x5')};function emitEvent(_0xd8c376){return function(_0x493d2d,_0x2c582d,_0x3b381a){DashboardItemEvents[_0x4eb9('0x6')](_0xd8c376+':'+_0x493d2d['id'],_0x493d2d);DashboardItemEvents[_0x4eb9('0x6')](_0xd8c376,_0x493d2d);_0x3b381a(null);};}for(var e in events){if(events[_0x4eb9('0x7')](e)){var event=events[e];DashboardItem[_0x4eb9('0x8')](e,emitEvent(event));}}module[_0x4eb9('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 51f5400..e90618d 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 _0xc524=['bluebird','request-promise','path','rimraf','exports','define','../../config/logger','api','moment'];(function(_0x45ac0c,_0x2f8a58){var _0x4b4074=function(_0x1ddc53){while(--_0x1ddc53){_0x45ac0c['push'](_0x45ac0c['shift']());}};_0x4b4074(++_0x2f8a58);}(_0xc524,0x1bf));var _0x4c52=function(_0x1b94fb,_0x47a346){_0x1b94fb=_0x1b94fb-0x0;var _0x34eaa4=_0xc524[_0x1b94fb];return _0x34eaa4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c52('0x0'))(_0x4c52('0x1'));var moment=require(_0x4c52('0x2'));var BPromise=require(_0x4c52('0x3'));var rp=require(_0x4c52('0x4'));var fs=require('fs');var path=require(_0x4c52('0x5'));var rimraf=require(_0x4c52('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x4c52('0x7')]=function(_0xdaf126,_0x72d0ec){return _0xdaf126[_0x4c52('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c92=['DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','define'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x0c92,0x1af));var _0x20c9=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0x0c92[_0x1ca29f];return _0x576c3b;};'use strict';var _=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var logger=require('../../config/logger')(_0x20c9('0x2'));var moment=require(_0x20c9('0x3'));var BPromise=require(_0x20c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20c9('0x5'));var rimraf=require(_0x20c9('0x6'));var config=require('../../config/environment');var attributes=require(_0x20c9('0x7'));module['exports']=function(_0x4f6afd,_0x48dcce){return _0x4f6afd[_0x20c9('0x8')](_0x20c9('0x9'),attributes,{'tableName':_0x20c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0714c29..9efd4d2 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 _0xeb1c=['stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xeb1c,0x19c));var _0xceb1=function(_0x2aed5a,_0x33a31b){_0x2aed5a=_0x2aed5a-0x0;var _0x224ebd=_0xeb1c[_0x2aed5a];return _0x224ebd;};'use strict';var _=require(_0xceb1('0x0'));var util=require('util');var moment=require(_0xceb1('0x1'));var BPromise=require(_0xceb1('0x2'));var rs=require(_0xceb1('0x3'));var fs=require('fs');var Redis=require(_0xceb1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xceb1('0x5'));var logger=require('../../config/logger')(_0xceb1('0x6'));var config=require(_0xceb1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xceb1('0x8')]({'port':0x232a});config[_0xceb1('0x9')]=_[_0xceb1('0xa')](config['redis'],{'host':_0xceb1('0xb'),'port':0x18eb});var socket=require(_0xceb1('0xc'))(new Redis(config[_0xceb1('0x9')]));require(_0xceb1('0xd'))[_0xceb1('0xe')](socket);function respondWithRpcPromise(_0x461ffd,_0x486641,_0x12eae5){return new BPromise(function(_0x31100c,_0x49eaf2){return client[_0xceb1('0xf')](_0x461ffd,_0x12eae5)['then'](function(_0x4b00f6){logger['info'](_0xceb1('0x10'),_0x486641,_0xceb1('0x11'));logger[_0xceb1('0x12')](_0xceb1('0x13'),_0x486641,_0xceb1('0x11'),JSON[_0xceb1('0x14')](_0x4b00f6));if(_0x4b00f6[_0xceb1('0x15')]){if(_0x4b00f6[_0xceb1('0x15')][_0xceb1('0x16')]===0x1f4){logger[_0xceb1('0x15')]('DashboardItem,\x20%s,\x20%s',_0x486641,_0x4b00f6[_0xceb1('0x15')][_0xceb1('0x17')]);return _0x49eaf2(_0x4b00f6[_0xceb1('0x15')][_0xceb1('0x17')]);}logger[_0xceb1('0x15')](_0xceb1('0x10'),_0x486641,_0x4b00f6[_0xceb1('0x15')][_0xceb1('0x17')]);return _0x31100c(_0x4b00f6[_0xceb1('0x15')][_0xceb1('0x17')]);}else{logger[_0xceb1('0x18')](_0xceb1('0x10'),_0x486641,'request\x20sent');_0x31100c(_0x4b00f6[_0xceb1('0x19')][_0xceb1('0x17')]);}})[_0xceb1('0x1a')](function(_0x173a37){logger['error']('DashboardItem,\x20%s,\x20%s',_0x486641,_0x173a37);_0x49eaf2(_0x173a37);});});} \ No newline at end of file +var _0x7152=['request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0x7152,0x1dd));var _0x2715=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x7152[_0x1ae491];return _0x4958a5;};'use strict';var _=require(_0x2715('0x0'));var util=require(_0x2715('0x1'));var moment=require(_0x2715('0x2'));var BPromise=require('bluebird');var rs=require(_0x2715('0x3'));var fs=require('fs');var Redis=require(_0x2715('0x4'));var db=require(_0x2715('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2715('0x6'))(_0x2715('0x7'));var config=require(_0x2715('0x8'));var jayson=require(_0x2715('0x9'));var client=jayson[_0x2715('0xa')]['http']({'port':0x232a});config[_0x2715('0xb')]=_[_0x2715('0xc')](config[_0x2715('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2715('0xd'))(new Redis(config[_0x2715('0xb')]));require(_0x2715('0xe'))[_0x2715('0xf')](socket);function respondWithRpcPromise(_0x31285c,_0x11a54a,_0x203111){return new BPromise(function(_0xb40b3e,_0x5f19c1){return client[_0x2715('0x10')](_0x31285c,_0x203111)[_0x2715('0x11')](function(_0x2a5753){logger[_0x2715('0x12')]('DashboardItem,\x20%s,\x20%s',_0x11a54a,_0x2715('0x13'));logger[_0x2715('0x14')](_0x2715('0x15'),_0x11a54a,_0x2715('0x13'),JSON[_0x2715('0x16')](_0x2a5753));if(_0x2a5753[_0x2715('0x17')]){if(_0x2a5753['error'][_0x2715('0x18')]===0x1f4){logger['error'](_0x2715('0x19'),_0x11a54a,_0x2a5753[_0x2715('0x17')][_0x2715('0x1a')]);return _0x5f19c1(_0x2a5753[_0x2715('0x17')][_0x2715('0x1a')]);}logger[_0x2715('0x17')]('DashboardItem,\x20%s,\x20%s',_0x11a54a,_0x2a5753[_0x2715('0x17')][_0x2715('0x1a')]);return _0xb40b3e(_0x2a5753['error'][_0x2715('0x1a')]);}else{logger[_0x2715('0x12')](_0x2715('0x19'),_0x11a54a,_0x2715('0x13'));_0xb40b3e(_0x2a5753[_0x2715('0x1b')][_0x2715('0x1a')]);}})[_0x2715('0x1c')](function(_0x49a48a){logger[_0x2715('0x17')]('DashboardItem,\x20%s,\x20%s',_0x11a54a,_0x49a48a);_0x5f19c1(_0x49a48a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 326e2b1..c82bc09 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 _0xc6f6=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove','emit'];(function(_0x50ca52,_0x5dc693){var _0xd755e8=function(_0x3a6b24){while(--_0x3a6b24){_0x50ca52['push'](_0x50ca52['shift']());}};_0xd755e8(++_0x5dc693);}(_0xc6f6,0x94));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var DashboardItemEvents=require(_0x6c6f('0x0'));var events=[_0x6c6f('0x1'),_0x6c6f('0x2'),'update'];function createListener(_0x3232fe,_0x560aa8){return function(_0x51400c){_0x560aa8[_0x6c6f('0x3')](_0x3232fe,_0x51400c);};}function removeListener(_0x35fec3,_0x909767){return function(){DashboardItemEvents[_0x6c6f('0x4')](_0x35fec3,_0x909767);};}exports[_0x6c6f('0x5')]=function(_0x130c5e){for(var _0x538d53=0x0,_0xa17e7=events[_0x6c6f('0x6')];_0x538d53<_0xa17e7;_0x538d53++){var _0x4d39d4=events[_0x538d53];var _0x4f28f6=createListener(_0x6c6f('0x7')+_0x4d39d4,_0x130c5e);DashboardItemEvents['on'](_0x4d39d4,_0x4f28f6);}}; \ No newline at end of file +var _0x0c1c=['./dashboardItem.events','save','remove','emit','removeListener','length','dashboardItem:'];(function(_0x20edee,_0x2c16af){var _0x1ace0f=function(_0x572853){while(--_0x572853){_0x20edee['push'](_0x20edee['shift']());}};_0x1ace0f(++_0x2c16af);}(_0x0c1c,0xfc));var _0xc0c1=function(_0x1e05c1,_0x3cffa3){_0x1e05c1=_0x1e05c1-0x0;var _0x15f1ca=_0x0c1c[_0x1e05c1];return _0x15f1ca;};'use strict';var DashboardItemEvents=require(_0xc0c1('0x0'));var events=[_0xc0c1('0x1'),_0xc0c1('0x2'),'update'];function createListener(_0x38ab34,_0x4a6628){return function(_0x59d545){_0x4a6628[_0xc0c1('0x3')](_0x38ab34,_0x59d545);};}function removeListener(_0x4391eb,_0x476222){return function(){DashboardItemEvents[_0xc0c1('0x4')](_0x4391eb,_0x476222);};}exports['register']=function(_0x119555){for(var _0x169b37=0x0,_0x2f3fb0=events[_0xc0c1('0x5')];_0x169b37<_0x2f3fb0;_0x169b37++){var _0x4778e5=events[_0x169b37];var _0xdd242e=createListener(_0xc0c1('0x6')+_0x4778e5,_0x119555);DashboardItemEvents['on'](_0x4778e5,_0xdd242e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1f82c48..ea80f6c 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 _0x2d14=['./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2d14,0x184));var _0x42d1=function(_0x3a7945,_0x9e9f72){_0x3a7945=_0x3a7945-0x0;var _0x366344=_0x2d14[_0x3a7945];return _0x366344;};'use strict';var multer=require(_0x42d1('0x0'));var util=require(_0x42d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x42d1('0x2'));var router=express[_0x42d1('0x3')]();var fs_extra=require(_0x42d1('0x4'));var auth=require(_0x42d1('0x5'));var interaction=require(_0x42d1('0x6'));var config=require(_0x42d1('0x7'));var controller=require(_0x42d1('0x8'));router[_0x42d1('0x9')](_0x42d1('0xa'),auth[_0x42d1('0xb')](),controller[_0x42d1('0xc')]);router['post']('/',auth[_0x42d1('0xb')](),controller[_0x42d1('0xd')]);router[_0x42d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x42d1('0xf')]);router[_0x42d1('0x10')](_0x42d1('0xa'),auth[_0x42d1('0xb')](),controller[_0x42d1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe4af=['fs-extra','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x2176f6,_0x151d1d){var _0x29bb6c=function(_0x152ce1){while(--_0x152ce1){_0x2176f6['push'](_0x2176f6['shift']());}};_0x29bb6c(++_0x151d1d);}(_0xe4af,0x11b));var _0xfe4a=function(_0x48cb87,_0x59fa53){_0x48cb87=_0x48cb87-0x0;var _0x4c16c9=_0xe4af[_0x48cb87];return _0x4c16c9;};'use strict';var multer=require(_0xfe4a('0x0'));var util=require(_0xfe4a('0x1'));var path=require(_0xfe4a('0x2'));var timeout=require(_0xfe4a('0x3'));var express=require(_0xfe4a('0x4'));var router=express[_0xfe4a('0x5')]();var fs_extra=require(_0xfe4a('0x6'));var auth=require(_0xfe4a('0x7'));var interaction=require(_0xfe4a('0x8'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0xfe4a('0x9'),auth[_0xfe4a('0xa')](),controller[_0xfe4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe4a('0xc')]);router[_0xfe4a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfe4a('0xe')]);router[_0xfe4a('0xf')]('/:id',auth[_0xfe4a('0xa')](),controller[_0xfe4a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 10a1df5..905dd5a 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 _0x8ba2=['STRING','ENUM','first','third','sequelize'];(function(_0x24d192,_0x27d976){var _0x4eb147=function(_0x5f14ee){while(--_0x5f14ee){_0x24d192['push'](_0x24d192['shift']());}};_0x4eb147(++_0x27d976);}(_0x8ba2,0x1e9));var _0x28ba=function(_0x569d04,_0x132147){_0x569d04=_0x569d04-0x0;var _0x4b4edd=_0x8ba2[_0x569d04];return _0x4b4edd;};'use strict';var Sequelize=require(_0x28ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x28ba('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x28ba('0x2')](_0x28ba('0x3'),'second',_0x28ba('0x4')),'allowNull':![],'defaultValue':_0x28ba('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5f03=['sequelize','STRING','ENUM','first'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x5f03,0x14c));var _0x35f0=function(_0x488771,_0x5b7a18){_0x488771=_0x488771-0x0;var _0x37dcc8=_0x5f03[_0x488771];return _0x37dcc8;};'use strict';var Sequelize=require(_0x35f0('0x0'));module['exports']={'name':{'type':Sequelize[_0x35f0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x35f0('0x2')](_0x35f0('0x3'),'second','third'),'allowNull':![],'defaultValue':_0x35f0('0x3')},'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 5629c71..c7b814c 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 _0xb77c=['update','then','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','save'];(function(_0x8559d4,_0x4d4346){var _0x54c7d5=function(_0x439e2f){while(--_0x439e2f){_0x8559d4['push'](_0x8559d4['shift']());}};_0x54c7d5(++_0x4d4346);}(_0xb77c,0x89));var _0xcb77=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb77c[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0xcb77('0x0'));var rimraf=require(_0xcb77('0x1'));var zipdir=require(_0xcb77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb77('0x3'));var moment=require(_0xcb77('0x4'));var BPromise=require(_0xcb77('0x5'));var Mustache=require('mustache');var util=require(_0xcb77('0x6'));var path=require('path');var sox=require(_0xcb77('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb77('0x8'));var _=require('lodash');var squel=require(_0xcb77('0x9'));var crypto=require(_0xcb77('0xa'));var jsforce=require(_0xcb77('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcb77('0xc'));var querystring=require(_0xcb77('0xd'));var Papa=require(_0xcb77('0xe'));var Redis=require(_0xcb77('0xf'));var authService=require(_0xcb77('0x10'));var qs=require(_0xcb77('0x11'));var as=require(_0xcb77('0x12'));var hardwareService=require(_0xcb77('0x13'));var logger=require(_0xcb77('0x14'))(_0xcb77('0x15'));var utils=require(_0xcb77('0x16'));var config=require(_0xcb77('0x17'));var licenseUtil=require(_0xcb77('0x18'));var db=require(_0xcb77('0x19'))['db'];function respondWithStatusCode(_0x56984e,_0x3cecd0){_0x3cecd0=_0x3cecd0||0xcc;return function(_0x45cc40){if(_0x45cc40){return _0x56984e['sendStatus'](_0x3cecd0);}return _0x56984e[_0xcb77('0x1a')](_0x3cecd0)[_0xcb77('0x1b')]();};}function respondWithResult(_0xf01d74,_0x2b9056){_0x2b9056=_0x2b9056||0xc8;return function(_0x4c4001){if(_0x4c4001){return _0xf01d74['status'](_0x2b9056)[_0xcb77('0x1c')](_0x4c4001);}};}function respondWithFilteredResult(_0xf5802b,_0x300f14){return function(_0x4f5f85){if(_0x4f5f85){var _0xa06eb8=typeof _0x300f14[_0xcb77('0x1d')]===_0xcb77('0x1e')&&typeof _0x300f14[_0xcb77('0x1f')]===_0xcb77('0x1e');var _0x552bc6=_0x4f5f85['count'];var _0x16b52e=_0xa06eb8?0x0:_0x300f14[_0xcb77('0x1d')];var _0x46ae3b=_0xa06eb8?_0x4f5f85['count']:_0x300f14[_0xcb77('0x1d')]+_0x300f14[_0xcb77('0x1f')];var _0x33b174;if(_0x46ae3b>=_0x552bc6){_0x46ae3b=_0x552bc6;_0x33b174=0xc8;}else{_0x33b174=0xce;}_0xf5802b[_0xcb77('0x1a')](_0x33b174);return _0xf5802b['set'](_0xcb77('0x20'),_0x16b52e+'-'+_0x46ae3b+'/'+_0x552bc6)[_0xcb77('0x1c')](_0x4f5f85);}return null;};}function patchUpdates(_0x3d39a6){return function(_0x50db11){try{jsonpatch[_0xcb77('0x21')](_0x50db11,_0x3d39a6,!![]);}catch(_0x4829f2){return BPromise['reject'](_0x4829f2);}return _0x50db11[_0xcb77('0x22')]();};}function saveUpdates(_0x14a9e2,_0x1d1507){return function(_0x5af25b){if(_0x5af25b){return _0x5af25b[_0xcb77('0x23')](_0x14a9e2)[_0xcb77('0x24')](function(_0x19fad8){return _0x19fad8;});}return null;};}function removeEntity(_0x361039,_0x1883f0){return function(_0x1782ec){if(_0x1782ec){return _0x1782ec['destroy']()['then'](function(){var _0x27dda3=_0x1782ec['get']({'plain':!![]});var _0x40fb66='Dispositions';return db[_0xcb77('0x25')][_0xcb77('0x26')]({'where':{'type':_0x40fb66,'resourceId':_0x27dda3['id']}})[_0xcb77('0x24')](function(){return _0x1782ec;});})[_0xcb77('0x24')](function(){_0x361039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d3059,_0x3cff4c){return function(_0x392bf8){if(!_0x392bf8){_0x3d3059[_0xcb77('0x27')](0x194);}return _0x392bf8;};}function handleError(_0x55df61,_0x259c7a){_0x259c7a=_0x259c7a||0x1f4;return function(_0x1d3de6){logger[_0xcb77('0x28')](_0x1d3de6[_0xcb77('0x29')]);if(_0x1d3de6[_0xcb77('0x2a')]){delete _0x1d3de6[_0xcb77('0x2a')];}_0x55df61['status'](_0x259c7a)[_0xcb77('0x2b')](_0x1d3de6);};}exports[_0xcb77('0x2c')]=function(_0xb04498,_0x29ee40){var _0x2786a0={},_0x4a137c={},_0x1e0d50={'count':0x0,'rows':[]};var _0x48f6e2=_[_0xcb77('0x2d')](db[_0xcb77('0x2e')][_0xcb77('0x2f')],function(_0x40533d){return{'name':_0x40533d[_0xcb77('0x30')],'type':_0x40533d['type'][_0xcb77('0x31')]};});_0x4a137c[_0xcb77('0x32')]=_['map'](_0x48f6e2,_0xcb77('0x2a'));_0x4a137c[_0xcb77('0x33')]=_[_0xcb77('0x34')](_0xb04498[_0xcb77('0x33')]);_0x4a137c[_0xcb77('0x35')]=_[_0xcb77('0x36')](_0x4a137c[_0xcb77('0x32')],_0x4a137c['query']);_0x2786a0[_0xcb77('0x37')]=_['intersection'](_0x4a137c[_0xcb77('0x32')],qs[_0xcb77('0x38')](_0xb04498[_0xcb77('0x33')][_0xcb77('0x38')]));_0x2786a0['attributes']=_0x2786a0[_0xcb77('0x37')][_0xcb77('0x39')]?_0x2786a0[_0xcb77('0x37')]:_0x4a137c['model'];if(!_0xb04498[_0xcb77('0x33')][_0xcb77('0x3a')]('nolimit')){_0x2786a0['limit']=qs[_0xcb77('0x1f')](_0xb04498[_0xcb77('0x33')]['limit']);_0x2786a0['offset']=qs[_0xcb77('0x1d')](_0xb04498[_0xcb77('0x33')][_0xcb77('0x1d')]);}_0x2786a0[_0xcb77('0x3b')]=qs[_0xcb77('0x3c')](_0xb04498[_0xcb77('0x33')][_0xcb77('0x3c')]);_0x2786a0[_0xcb77('0x3d')]=qs[_0xcb77('0x35')](_[_0xcb77('0x3e')](_0xb04498['query'],_0x4a137c[_0xcb77('0x35')]),_0x48f6e2);if(_0xb04498['query'][_0xcb77('0x3f')]){_0x2786a0[_0xcb77('0x3d')]=_[_0xcb77('0x40')](_0x2786a0['where'],{'$or':_[_0xcb77('0x2d')](_0x48f6e2,function(_0x5e47ad){if(_0x5e47ad[_0xcb77('0x41')]!==_0xcb77('0x42')){var _0x16816c={};_0x16816c[_0x5e47ad[_0xcb77('0x2a')]]={'$like':'%'+_0xb04498[_0xcb77('0x33')]['filter']+'%'};return _0x16816c;}})});}_0x2786a0=_[_0xcb77('0x40')]({},_0x2786a0,_0xb04498[_0xcb77('0x43')]);var _0x3ff7c8={'where':_0x2786a0[_0xcb77('0x3d')]};return db[_0xcb77('0x2e')][_0xcb77('0x44')](_0x3ff7c8)[_0xcb77('0x24')](function(_0x1cc424){_0x1e0d50['count']=_0x1cc424;if(_0xb04498[_0xcb77('0x33')][_0xcb77('0x45')]){_0x2786a0[_0xcb77('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2786a0);})[_0xcb77('0x24')](function(_0x26e433){_0x1e0d50['rows']=_0x26e433;return _0x1e0d50;})[_0xcb77('0x24')](respondWithFilteredResult(_0x29ee40,_0x2786a0))[_0xcb77('0x47')](handleError(_0x29ee40,null));};exports[_0xcb77('0x48')]=function(_0x2d0be2,_0x4a7439){var _0x4ceadc={'raw':!![],'where':{'id':_0x2d0be2[_0xcb77('0x49')]['id']}},_0x1d7098={};_0x1d7098[_0xcb77('0x32')]=_[_0xcb77('0x34')](db[_0xcb77('0x2e')][_0xcb77('0x2f')]);_0x1d7098[_0xcb77('0x33')]=_[_0xcb77('0x34')](_0x2d0be2['query']);_0x1d7098[_0xcb77('0x35')]=_[_0xcb77('0x36')](_0x1d7098['model'],_0x1d7098['query']);_0x4ceadc[_0xcb77('0x37')]=_[_0xcb77('0x36')](_0x1d7098['model'],qs[_0xcb77('0x38')](_0x2d0be2[_0xcb77('0x33')][_0xcb77('0x38')]));_0x4ceadc[_0xcb77('0x37')]=_0x4ceadc[_0xcb77('0x37')][_0xcb77('0x39')]?_0x4ceadc[_0xcb77('0x37')]:_0x1d7098[_0xcb77('0x32')];if(_0x2d0be2['query'][_0xcb77('0x45')]){_0x4ceadc[_0xcb77('0x46')]=[{'all':!![]}];}_0x4ceadc=_[_0xcb77('0x40')]({},_0x4ceadc,_0x2d0be2[_0xcb77('0x43')]);return db[_0xcb77('0x2e')][_0xcb77('0x4a')](_0x4ceadc)[_0xcb77('0x24')](handleEntityNotFound(_0x4a7439,null))[_0xcb77('0x24')](respondWithResult(_0x4a7439,null))['catch'](handleError(_0x4a7439,null));};exports[_0xcb77('0x4b')]=function(_0x1c0ebe,_0x432eaf){return db['Disposition'][_0xcb77('0x4b')](_0x1c0ebe[_0xcb77('0x4c')],{})[_0xcb77('0x24')](function(_0x3549b7){var _0x8f3ea3=_0x1c0ebe[_0xcb77('0x4d')][_0xcb77('0x4e')]({'plain':!![]});if(!_0x8f3ea3)throw new Error(_0xcb77('0x4f'));if(_0x8f3ea3[_0xcb77('0x50')]===_0xcb77('0x4d')){var _0x3949b3=_0x3549b7[_0xcb77('0x4e')]({'plain':!![]});var _0x200ece=_0xcb77('0x51');return db[_0xcb77('0x52')]['find']({'where':{'name':_0x200ece,'userProfileId':_0x8f3ea3[_0xcb77('0x53')]},'raw':!![]})['then'](function(_0x2984e6){if(_0x2984e6&&_0x2984e6[_0xcb77('0x54')]===0x0){return db[_0xcb77('0x25')][_0xcb77('0x4b')]({'name':_0x3949b3[_0xcb77('0x2a')],'resourceId':_0x3949b3['id'],'type':_0x2984e6[_0xcb77('0x2a')],'sectionId':_0x2984e6['id']},{})[_0xcb77('0x24')](function(){return _0x3549b7;});}else{return _0x3549b7;}})['catch'](function(_0x23384e){logger['error'](_0xcb77('0x55'),_0x23384e);throw _0x23384e;});}return _0x3549b7;})[_0xcb77('0x24')](respondWithResult(_0x432eaf,0xc9))['catch'](handleError(_0x432eaf,null));};exports[_0xcb77('0x23')]=function(_0xa0b53c,_0x37b1cd){if(_0xa0b53c['body']['id']){delete _0xa0b53c[_0xcb77('0x4c')]['id'];}return db[_0xcb77('0x2e')][_0xcb77('0x4a')]({'where':{'id':_0xa0b53c['params']['id']}})[_0xcb77('0x24')](handleEntityNotFound(_0x37b1cd,null))[_0xcb77('0x24')](saveUpdates(_0xa0b53c[_0xcb77('0x4c')],null))[_0xcb77('0x24')](respondWithResult(_0x37b1cd,null))[_0xcb77('0x47')](handleError(_0x37b1cd,null));};exports[_0xcb77('0x26')]=function(_0x11335f,_0x2f6b6b){return db[_0xcb77('0x2e')][_0xcb77('0x4a')]({'where':{'id':_0x11335f['params']['id']}})[_0xcb77('0x24')](handleEntityNotFound(_0x2f6b6b,null))[_0xcb77('0x24')](removeEntity(_0x2f6b6b,null))[_0xcb77('0x47')](handleError(_0x2f6b6b,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','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','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(_0x455e6e,_0x1a1d6f){var _0x3ac97b=function(_0x3aad16){while(--_0x3aad16){_0x455e6e['push'](_0x455e6e['shift']());}};_0x3ac97b(++_0x1a1d6f);}(_0xe14b,0x93));var _0xbe14=function(_0x11dfee,_0x3c7a26){_0x11dfee=_0x11dfee-0x0;var _0x9258f0=_0xe14b[_0x11dfee];return _0x9258f0;};'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['Disposition'][_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/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4537219..60a07ce 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 _0xebe4=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define','Disposition','name_voice','name','name_chat','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId'];(function(_0x39ae0a,_0x5e687f){var _0x3b1748=function(_0x52ad71){while(--_0x52ad71){_0x39ae0a['push'](_0x39ae0a['shift']());}};_0x3b1748(++_0x5e687f);}(_0xebe4,0xb4));var _0x4ebe=function(_0x3d60c1,_0x55cf96){_0x3d60c1=_0x3d60c1-0x0;var _0x590202=_0xebe4[_0x3d60c1];return _0x590202;};'use strict';var _=require(_0x4ebe('0x0'));var util=require(_0x4ebe('0x1'));var logger=require('../../config/logger')(_0x4ebe('0x2'));var moment=require(_0x4ebe('0x3'));var BPromise=require(_0x4ebe('0x4'));var rp=require(_0x4ebe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ebe('0x6'));var attributes=require('./disposition.attributes');module[_0x4ebe('0x7')]=function(_0x5ec100,_0x29f948){return _0x5ec100[_0x4ebe('0x8')](_0x4ebe('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x4ebe('0xa'),'fields':[_0x4ebe('0xb'),'ListId']},{'unique':!![],'name':_0x4ebe('0xc'),'fields':[_0x4ebe('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x4ebe('0xd'),'fields':[_0x4ebe('0xb'),_0x4ebe('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x4ebe('0xb'),_0x4ebe('0xf')]},{'unique':!![],'name':_0x4ebe('0x10'),'fields':[_0x4ebe('0xb'),_0x4ebe('0x11')]},{'unique':!![],'name':_0x4ebe('0x12'),'fields':[_0x4ebe('0xb'),_0x4ebe('0x13')]},{'unique':!![],'name':_0x4ebe('0x14'),'fields':['name',_0x4ebe('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e30=['ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','api','moment','path','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','ListId','name_chat','name'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0x7e30,0x1c1));var _0x07e3=function(_0x271316,_0x19c341){_0x271316=_0x271316-0x0;var _0x1a99b1=_0x7e30[_0x271316];return _0x1a99b1;};'use strict';var _=require(_0x07e3('0x0'));var util=require(_0x07e3('0x1'));var logger=require('../../config/logger')(_0x07e3('0x2'));var moment=require(_0x07e3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07e3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x07e3('0x5'));module[_0x07e3('0x6')]=function(_0x4a2f20,_0x561481){return _0x4a2f20['define'](_0x07e3('0x7'),attributes,{'tableName':_0x07e3('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x07e3('0x9'),'fields':['name',_0x07e3('0xa')]},{'unique':!![],'name':_0x07e3('0xb'),'fields':[_0x07e3('0xc'),_0x07e3('0xd')]},{'unique':!![],'name':_0x07e3('0xe'),'fields':[_0x07e3('0xc'),_0x07e3('0xf')]},{'unique':!![],'name':_0x07e3('0x10'),'fields':[_0x07e3('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x07e3('0x11'),'fields':['name',_0x07e3('0x12')]},{'unique':!![],'name':_0x07e3('0x13'),'fields':[_0x07e3('0xc'),_0x07e3('0x14')]},{'unique':!![],'name':_0x07e3('0x15'),'fields':[_0x07e3('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 59e8d1b..91dbf53 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(_0x43685d,_0x303886){var _0x35ea42=function(_0x15e4f3){while(--_0x15e4f3){_0x43685d['push'](_0x43685d['shift']());}};_0x35ea42(++_0x303886);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x5a6b89,_0x36973b){var _0x8219fb=function(_0x5a67d4){while(--_0x5a67d4){_0x5a6b89['push'](_0x5a6b89['shift']());}};_0x8219fb(++_0x36973b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 06458c9..d690920 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 _0x8ead=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','isAuthenticated','put','delete','/:id','multer','path'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x8ead,0x16e));var _0xd8ea=function(_0x48e636,_0x4df178){_0x48e636=_0x48e636-0x0;var _0x22398b=_0x8ead[_0x48e636];return _0x22398b;};'use strict';var multer=require(_0xd8ea('0x0'));var util=require('util');var path=require(_0xd8ea('0x1'));var timeout=require(_0xd8ea('0x2'));var express=require(_0xd8ea('0x3'));var router=express[_0xd8ea('0x4')]();var fs_extra=require(_0xd8ea('0x5'));var auth=require(_0xd8ea('0x6'));var interaction=require(_0xd8ea('0x7'));var config=require(_0xd8ea('0x8'));var controller=require(_0xd8ea('0x9'));router[_0xd8ea('0xa')]('/',auth['isAuthenticated'](),controller[_0xd8ea('0xb')]);router['get']('/:id',auth[_0xd8ea('0xc')](),controller['show']);router['post']('/',auth[_0xd8ea('0xc')](),controller['create']);router[_0xd8ea('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd8ea('0xe')](_0xd8ea('0xf'),auth[_0xd8ea('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd64f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x4ea052,_0x718c8a){var _0xac76d9=function(_0x49c698){while(--_0x49c698){_0x4ea052['push'](_0x4ea052['shift']());}};_0xac76d9(++_0x718c8a);}(_0xd64f,0x1a1));var _0xfd64=function(_0x12edf5,_0x50b8c1){_0x12edf5=_0x12edf5-0x0;var _0xfa9784=_0xd64f[_0x12edf5];return _0xfa9784;};'use strict';var multer=require(_0xfd64('0x0'));var util=require(_0xfd64('0x1'));var path=require(_0xfd64('0x2'));var timeout=require(_0xfd64('0x3'));var express=require(_0xfd64('0x4'));var router=express[_0xfd64('0x5')]();var fs_extra=require(_0xfd64('0x6'));var auth=require(_0xfd64('0x7'));var interaction=require(_0xfd64('0x8'));var config=require(_0xfd64('0x9'));var controller=require(_0xfd64('0xa'));router[_0xfd64('0xb')]('/',auth['isAuthenticated'](),controller[_0xfd64('0xc')]);router[_0xfd64('0xb')](_0xfd64('0xd'),auth[_0xfd64('0xe')](),controller['show']);router[_0xfd64('0xf')]('/',auth['isAuthenticated'](),controller[_0xfd64('0x10')]);router['put'](_0xfd64('0xd'),auth[_0xfd64('0xe')](),controller[_0xfd64('0x11')]);router[_0xfd64('0x12')](_0xfd64('0xd'),auth[_0xfd64('0xe')](),controller[_0xfd64('0x13')]);module[_0xfd64('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f68f1de..6550279 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 _0x282a=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','14400','4800','7200','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x306583,_0x4c302c){var _0x2e9bf2=function(_0x52c335){while(--_0x52c335){_0x306583['push'](_0x306583['shift']());}};_0x2e9bf2(++_0x4c302c);}(_0x282a,0x1b7));var _0xa282=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x282a[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xa282('0x0'));module[_0xa282('0x1')]={'name':{'type':Sequelize[_0xa282('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa282('0x2')]},'ecm':{'type':Sequelize[_0xa282('0x3')](_0xa282('0x4'),'no'),'defaultValue':_0xa282('0x4')},'headerinfo':{'type':Sequelize[_0xa282('0x2')],'defaultValue':_0xa282('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xa282('0x6')},'minrate':{'type':Sequelize[_0xa282('0x3')](_0xa282('0x7'),'4800','7200','9600','12000',_0xa282('0x8')),'defaultValue':_0xa282('0x9')},'maxrate':{'type':Sequelize[_0xa282('0x3')](_0xa282('0x7'),_0xa282('0x9'),_0xa282('0xa'),_0xa282('0xb'),_0xa282('0xc'),_0xa282('0x8')),'defaultValue':_0xa282('0x8')},'modem':{'type':Sequelize[_0xa282('0x2')],'defaultValue':_0xa282('0xd')},'gateway':{'type':Sequelize[_0xa282('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa282('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa282('0x3')](_0xa282('0xf'),_0xa282('0x10'),_0xa282('0x11'),_0xa282('0x12')),'defaultValue':_0xa282('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa282('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa282('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa282('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa282('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa282('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa282('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa282('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xa282('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xa282('0x14')],'defaultValue':![],'comment':_0xa282('0x16'),'set':function(_0x12c64b){if(!_0x12c64b)this[_0xa282('0x17')](_0xa282('0x18'),null);this[_0xa282('0x17')](_0xa282('0x19'),_0x12c64b);}}}; \ No newline at end of file +var _0x4cd0=['xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','14400','7200','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','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','mandatoryDispositionPauseId','sequelize','exports','STRING','yes'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0x4cd0,0xf9));var _0x04cd=function(_0x4c262d,_0x3823cb){_0x4c262d=_0x4c262d-0x0;var _0x240974=_0x4cd0[_0x4c262d];return _0x240974;};'use strict';var Sequelize=require(_0x04cd('0x0'));module[_0x04cd('0x1')]={'name':{'type':Sequelize[_0x04cd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x04cd('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x04cd('0x3'),'no'),'defaultValue':_0x04cd('0x3')},'headerinfo':{'type':Sequelize[_0x04cd('0x2')],'defaultValue':_0x04cd('0x4')},'localstationid':{'type':Sequelize[_0x04cd('0x2')],'unique':_0x04cd('0x5')},'minrate':{'type':Sequelize[_0x04cd('0x6')](_0x04cd('0x7'),_0x04cd('0x8'),'7200','9600','12000',_0x04cd('0x9')),'defaultValue':_0x04cd('0x8')},'maxrate':{'type':Sequelize[_0x04cd('0x6')]('2400',_0x04cd('0x8'),_0x04cd('0xa'),_0x04cd('0xb'),_0x04cd('0xc'),_0x04cd('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x04cd('0x2')],'defaultValue':_0x04cd('0xd')},'gateway':{'type':Sequelize[_0x04cd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x04cd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x04cd('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x04cd('0x6')](_0x04cd('0xf'),_0x04cd('0x10'),'DADHI',_0x04cd('0x11')),'defaultValue':_0x04cd('0xf')},'key':{'type':Sequelize[_0x04cd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x04cd('0x12');}},'notificationSound':{'type':Sequelize[_0x04cd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x04cd('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04cd('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04cd('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x04cd('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04cd('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04cd('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x04cd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x04cd('0x13')],'defaultValue':![],'comment':_0x04cd('0x15'),'set':function(_0x3fbaa4){if(!_0x3fbaa4)this['setDataValue'](_0x04cd('0x16'),null);this['setDataValue']('mandatoryDisposition',_0x3fbaa4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 201de86..38eff0d 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 _0xcf87=['fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','get','end','stack','name','Pause','mandatoryDispositionPause','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','FaxAccount','includeAll','findAll','rows','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','context','from-voip-provider','localstationid','app','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','transaction','tech','createdAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>'];(function(_0x22a243,_0x33e23c){var _0x417309=function(_0x5d53dc){while(--_0x5d53dc){_0x22a243['push'](_0x22a243['shift']());}};_0x417309(++_0x33e23c);}(_0xcf87,0x1a0));var _0x7cf8=function(_0x4595bf,_0x4794e2){_0x4595bf=_0x4595bf-0x0;var _0x3cdc8a=_0xcf87[_0x4595bf];return _0x3cdc8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7cf8('0x0'));var zipdir=require(_0x7cf8('0x1'));var jsonpatch=require(_0x7cf8('0x2'));var rp=require(_0x7cf8('0x3'));var moment=require(_0x7cf8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cf8('0x5'));var util=require(_0x7cf8('0x6'));var path=require(_0x7cf8('0x7'));var sox=require(_0x7cf8('0x8'));var csv=require(_0x7cf8('0x9'));var ejs=require(_0x7cf8('0xa'));var fs=require('fs');var fs_extra=require(_0x7cf8('0xb'));var _=require(_0x7cf8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7cf8('0xd'));var deskjs=require(_0x7cf8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7cf8('0xf'));var Papa=require(_0x7cf8('0x10'));var Redis=require(_0x7cf8('0x11'));var authService=require(_0x7cf8('0x12'));var qs=require(_0x7cf8('0x13'));var as=require(_0x7cf8('0x14'));var hardwareService=require(_0x7cf8('0x15'));var logger=require(_0x7cf8('0x16'))(_0x7cf8('0x17'));var utils=require(_0x7cf8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7cf8('0x19'))['db'];config[_0x7cf8('0x1a')]=_[_0x7cf8('0x1b')](config['redis'],{'host':_0x7cf8('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7cf8('0x1a')]));require(_0x7cf8('0x1d'))[_0x7cf8('0x1e')](socket);var jayson=require(_0x7cf8('0x1f'));var client=jayson[_0x7cf8('0x20')][_0x7cf8('0x21')]({'port':0x232c});var client9002=jayson[_0x7cf8('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c925,_0xfa2724,_0x14bf61,_0x1878ea){return new BPromise(function(_0x524085,_0x77f01d){var _0x41ad64=_0x1878ea||client;return _0x41ad64[_0x7cf8('0x22')](_0x10c925,_0x14bf61)[_0x7cf8('0x23')](function(_0x1d180b){logger['info'](_0x7cf8('0x24'),_0xfa2724,_0x7cf8('0x25'));logger[_0x7cf8('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xfa2724,_0x7cf8('0x25'),JSON[_0x7cf8('0x27')](_0x1d180b));if(_0x1d180b[_0x7cf8('0x28')]){if(_0x1d180b['error'][_0x7cf8('0x29')]===0x1f4){logger[_0x7cf8('0x28')](_0x7cf8('0x24'),_0xfa2724,_0x1d180b[_0x7cf8('0x28')]['message']);return _0x77f01d(_0x1d180b[_0x7cf8('0x28')][_0x7cf8('0x2a')]);}logger[_0x7cf8('0x28')](_0x7cf8('0x24'),_0xfa2724,_0x1d180b[_0x7cf8('0x28')][_0x7cf8('0x2a')]);return _0x524085(_0x1d180b['error'][_0x7cf8('0x2a')]);}else{logger[_0x7cf8('0x2b')](_0x7cf8('0x24'),_0xfa2724,'request\x20sent');_0x524085(_0x1d180b[_0x7cf8('0x2c')][_0x7cf8('0x2a')]);}})[_0x7cf8('0x2d')](function(_0x4b3412){logger[_0x7cf8('0x28')]('FaxAccount,\x20%s,\x20%s',_0xfa2724,_0x4b3412);_0x77f01d(_0x4b3412);});});}function respondWithStatusCode(_0x5c9e2f,_0x54686a){_0x54686a=_0x54686a||0xcc;return function(_0x4f71f6){if(_0x4f71f6){return _0x5c9e2f[_0x7cf8('0x2e')](_0x54686a);}return _0x5c9e2f[_0x7cf8('0x2f')](_0x54686a)['end']();};}function respondWithResult(_0x159a6b,_0x5a4e79){_0x5a4e79=_0x5a4e79||0xc8;return function(_0x4b50f0){if(_0x4b50f0){return _0x159a6b['status'](_0x5a4e79)[_0x7cf8('0x30')](_0x4b50f0);}};}function respondWithFilteredResult(_0x1cb76d,_0xcee45d){return function(_0x36a25b){if(_0x36a25b){var _0x53760a=typeof _0xcee45d['offset']==='undefined'&&typeof _0xcee45d[_0x7cf8('0x31')]===_0x7cf8('0x32');var _0x5016bf=_0x36a25b[_0x7cf8('0x33')];var _0x4031f7=_0x53760a?0x0:_0xcee45d[_0x7cf8('0x34')];var _0x28fbfc=_0x53760a?_0x36a25b[_0x7cf8('0x33')]:_0xcee45d[_0x7cf8('0x34')]+_0xcee45d[_0x7cf8('0x31')];var _0x3ed61b;if(_0x28fbfc>=_0x5016bf){_0x28fbfc=_0x5016bf;_0x3ed61b=0xc8;}else{_0x3ed61b=0xce;}_0x1cb76d[_0x7cf8('0x2f')](_0x3ed61b);return _0x1cb76d[_0x7cf8('0x35')](_0x7cf8('0x36'),_0x4031f7+'-'+_0x28fbfc+'/'+_0x5016bf)['json'](_0x36a25b);}return null;};}function patchUpdates(_0x1e409d){return function(_0x3aa32b){try{jsonpatch[_0x7cf8('0x37')](_0x3aa32b,_0x1e409d,!![]);}catch(_0x977fcb){return BPromise['reject'](_0x977fcb);}return _0x3aa32b[_0x7cf8('0x38')]();};}function saveUpdates(_0x493e3e,_0x13cc78){return function(_0x25572b){if(_0x25572b){return _0x25572b[_0x7cf8('0x39')](_0x493e3e)[_0x7cf8('0x23')](function(_0x400d52){return _0x400d52;});}return null;};}function removeEntity(_0x296383,_0x46ac47){return function(_0x5c2dc9){if(_0x5c2dc9){return _0x5c2dc9[_0x7cf8('0x3a')]()[_0x7cf8('0x23')](function(){var _0x4acdeb=_0x5c2dc9[_0x7cf8('0x3b')]({'plain':!![]});var _0x3bc8de='FaxAccounts';return db['UserProfileResource'][_0x7cf8('0x3a')]({'where':{'type':_0x3bc8de,'resourceId':_0x4acdeb['id']}})[_0x7cf8('0x23')](function(){return _0x5c2dc9;});})['then'](function(){_0x296383['status'](0xcc)[_0x7cf8('0x3c')]();});}};}function handleEntityNotFound(_0x20eaf9,_0x58a2a7){return function(_0x1be44d){if(!_0x1be44d){_0x20eaf9[_0x7cf8('0x2e')](0x194);}return _0x1be44d;};}function handleError(_0x5d3172,_0x34b62a){_0x34b62a=_0x34b62a||0x1f4;return function(_0x213480){logger[_0x7cf8('0x28')](_0x213480[_0x7cf8('0x3d')]);if(_0x213480[_0x7cf8('0x3e')]){delete _0x213480[_0x7cf8('0x3e')];}_0x5d3172[_0x7cf8('0x2f')](_0x34b62a)['send'](_0x213480);};}exports['index']=function(_0x300584,_0x1169cc){var _0x395c4a={'include':[{'model':db[_0x7cf8('0x3f')],'as':_0x7cf8('0x40')}]},_0x959f28={},_0x4bf07e={'count':0x0,'rows':[]};var _0x2ae3c5=_['map'](db['FaxAccount']['rawAttributes'],function(_0x32db9e){return{'name':_0x32db9e[_0x7cf8('0x41')],'type':_0x32db9e[_0x7cf8('0x42')][_0x7cf8('0x43')]};});_0x959f28['model']=_[_0x7cf8('0x44')](_0x2ae3c5,'name');_0x959f28['query']=_[_0x7cf8('0x45')](_0x300584[_0x7cf8('0x46')]);_0x959f28[_0x7cf8('0x47')]=_[_0x7cf8('0x48')](_0x959f28[_0x7cf8('0x49')],_0x959f28[_0x7cf8('0x46')]);_0x395c4a[_0x7cf8('0x4a')]=_['intersection'](_0x959f28[_0x7cf8('0x49')],qs[_0x7cf8('0x4b')](_0x300584[_0x7cf8('0x46')][_0x7cf8('0x4b')]));_0x395c4a['attributes']=_0x395c4a[_0x7cf8('0x4a')][_0x7cf8('0x4c')]?_0x395c4a[_0x7cf8('0x4a')]:_0x959f28[_0x7cf8('0x49')];if(!_0x300584['query'][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x395c4a[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x300584[_0x7cf8('0x46')][_0x7cf8('0x31')]);_0x395c4a[_0x7cf8('0x34')]=qs['offset'](_0x300584[_0x7cf8('0x46')][_0x7cf8('0x34')]);}_0x395c4a[_0x7cf8('0x4f')]=qs['sort'](_0x300584[_0x7cf8('0x46')][_0x7cf8('0x50')]);_0x395c4a['where']=qs[_0x7cf8('0x47')](_[_0x7cf8('0x51')](_0x300584['query'],_0x959f28['filters']),_0x2ae3c5);if(_0x300584[_0x7cf8('0x46')][_0x7cf8('0x52')]){_0x395c4a[_0x7cf8('0x53')]=_[_0x7cf8('0x54')](_0x395c4a[_0x7cf8('0x53')],{'$or':_[_0x7cf8('0x44')](_0x2ae3c5,function(_0x643434){if(_0x643434['type']!==_0x7cf8('0x55')){var _0x3610b4={};_0x3610b4[_0x643434['name']]={'$like':'%'+_0x300584[_0x7cf8('0x46')]['filter']+'%'};return _0x3610b4;}})});}_0x395c4a=_[_0x7cf8('0x54')]({},_0x395c4a,_0x300584['options']);var _0x3e5300={'where':_0x395c4a[_0x7cf8('0x53')]};return db[_0x7cf8('0x56')]['count'](_0x3e5300)[_0x7cf8('0x23')](function(_0x27be62){_0x4bf07e['count']=_0x27be62;if(_0x300584['query'][_0x7cf8('0x57')]){_0x395c4a['include']=[{'all':!![]}];}return db[_0x7cf8('0x56')][_0x7cf8('0x58')](_0x395c4a);})[_0x7cf8('0x23')](function(_0x38eac3){_0x4bf07e[_0x7cf8('0x59')]=_0x38eac3;return _0x4bf07e;})[_0x7cf8('0x23')](respondWithFilteredResult(_0x1169cc,_0x395c4a))[_0x7cf8('0x2d')](handleError(_0x1169cc,null));};exports['show']=function(_0x470371,_0x388315){var _0x2711d9={'raw':![],'where':{'id':_0x470371[_0x7cf8('0x5a')]['id']},'include':[{'model':db[_0x7cf8('0x3f')],'as':_0x7cf8('0x40')}]},_0x656fec={};_0x656fec['model']=_[_0x7cf8('0x45')](db[_0x7cf8('0x56')][_0x7cf8('0x5b')]);_0x656fec['query']=_[_0x7cf8('0x45')](_0x470371[_0x7cf8('0x46')]);_0x656fec[_0x7cf8('0x47')]=_[_0x7cf8('0x48')](_0x656fec[_0x7cf8('0x49')],_0x656fec['query']);_0x2711d9[_0x7cf8('0x4a')]=_['intersection'](_0x656fec[_0x7cf8('0x49')],qs[_0x7cf8('0x4b')](_0x470371[_0x7cf8('0x46')][_0x7cf8('0x4b')]));_0x2711d9['attributes']=_0x2711d9['attributes'][_0x7cf8('0x4c')]?_0x2711d9['attributes']:_0x656fec[_0x7cf8('0x49')];if(_0x470371[_0x7cf8('0x46')][_0x7cf8('0x57')]){_0x2711d9[_0x7cf8('0x5c')]=[{'all':!![]}];}_0x2711d9=_['merge']({},_0x2711d9,_0x470371[_0x7cf8('0x5d')]);return db[_0x7cf8('0x56')][_0x7cf8('0x5e')](_0x2711d9)[_0x7cf8('0x23')](handleEntityNotFound(_0x388315,null))[_0x7cf8('0x23')](respondWithResult(_0x388315,null))['catch'](handleError(_0x388315,null));};exports[_0x7cf8('0x5f')]=function(_0x1b6269,_0x3c9bf2){return db[_0x7cf8('0x56')][_0x7cf8('0x5f')](_0x1b6269[_0x7cf8('0x60')],{})[_0x7cf8('0x23')](function(_0x29fe54){var _0x453e6e=_0x1b6269[_0x7cf8('0x61')][_0x7cf8('0x3b')]({'plain':!![]});if(!_0x453e6e)throw new Error(_0x7cf8('0x62'));if(_0x453e6e['role']===_0x7cf8('0x61')){var _0x4e71c4=_0x29fe54[_0x7cf8('0x3b')]({'plain':!![]});var _0x4d632f='FaxAccounts';return db[_0x7cf8('0x63')]['find']({'where':{'name':_0x4d632f,'userProfileId':_0x453e6e['userProfileId']},'raw':!![]})['then'](function(_0x3696b7){if(_0x3696b7&&_0x3696b7[_0x7cf8('0x64')]===0x0){return db[_0x7cf8('0x65')][_0x7cf8('0x5f')]({'name':_0x4e71c4[_0x7cf8('0x3e')],'resourceId':_0x4e71c4['id'],'type':_0x3696b7[_0x7cf8('0x3e')],'sectionId':_0x3696b7['id']},{})[_0x7cf8('0x23')](function(){return _0x29fe54;});}else{return _0x29fe54;}})[_0x7cf8('0x2d')](function(_0x23bf4c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23bf4c);throw _0x23bf4c;});}return _0x29fe54;})[_0x7cf8('0x23')](respondWithResult(_0x3c9bf2,0xc9))[_0x7cf8('0x2d')](handleError(_0x3c9bf2,null));};exports['update']=function(_0x414d64,_0x47b100){if(_0x414d64['body']['id']){delete _0x414d64[_0x7cf8('0x60')]['id'];}return db['FaxAccount'][_0x7cf8('0x5e')]({'where':{'id':_0x414d64[_0x7cf8('0x5a')]['id']},'include':[{'model':db[_0x7cf8('0x3f')],'as':_0x7cf8('0x40')}]})[_0x7cf8('0x23')](handleEntityNotFound(_0x47b100,null))[_0x7cf8('0x23')](saveUpdates(_0x414d64[_0x7cf8('0x60')],null))[_0x7cf8('0x23')](respondWithResult(_0x47b100,null))[_0x7cf8('0x2d')](handleError(_0x47b100,null));};exports[_0x7cf8('0x3a')]=function(_0x474a1a,_0x101101){return db[_0x7cf8('0x56')][_0x7cf8('0x5e')]({'where':{'id':_0x474a1a[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x101101,null))[_0x7cf8('0x23')](removeEntity(_0x101101,null))[_0x7cf8('0x2d')](handleError(_0x101101,null));};exports[_0x7cf8('0x66')]=function(_0x67bca6,_0x1db95c){return db[_0x7cf8('0x56')][_0x7cf8('0x66')]()[_0x7cf8('0x23')](respondWithResult(_0x1db95c,null))[_0x7cf8('0x2d')](handleError(_0x1db95c,null));};exports['addDisposition']=function(_0x20b8ab,_0x1e2809,_0x5ed63d){if(_0x20b8ab[_0x7cf8('0x60')]['id']){delete _0x20b8ab[_0x7cf8('0x60')]['id'];}return db[_0x7cf8('0x56')][_0x7cf8('0x5e')]({'where':{'id':_0x20b8ab[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x1e2809,null))[_0x7cf8('0x23')](function(_0x1a9b5b){if(_0x1a9b5b){_0x20b8ab['body'][_0x7cf8('0x67')]=_0x1a9b5b['id'];return db[_0x7cf8('0x68')][_0x7cf8('0x5f')](_0x20b8ab[_0x7cf8('0x60')]);}})['then'](respondWithResult(_0x1e2809,null))[_0x7cf8('0x2d')](handleError(_0x1e2809,null));};exports[_0x7cf8('0x69')]=function(_0x5ff4eb,_0x4ed294,_0x53fab6){var _0x526e7f={'raw':![],'where':{}};var _0x59b581={};var _0x56696b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7cf8('0x6a')]({'where':{'id':_0x5ff4eb[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x4ed294,null))['then'](function(_0xd9c835){if(_0xd9c835){_0x59b581['model']=_[_0x7cf8('0x45')](db[_0x7cf8('0x68')][_0x7cf8('0x5b')]);_0x59b581[_0x7cf8('0x46')]=_[_0x7cf8('0x45')](_0x5ff4eb[_0x7cf8('0x46')]);_0x59b581['filters']=_[_0x7cf8('0x48')](_0x59b581['model'],_0x59b581[_0x7cf8('0x46')]);_0x526e7f['attributes']=_['intersection'](_0x59b581[_0x7cf8('0x49')],qs[_0x7cf8('0x4b')](_0x5ff4eb[_0x7cf8('0x46')]['fields']));_0x526e7f[_0x7cf8('0x4a')]=_0x526e7f[_0x7cf8('0x4a')][_0x7cf8('0x4c')]?_0x526e7f[_0x7cf8('0x4a')]:_0x59b581[_0x7cf8('0x49')];if(!_0x5ff4eb[_0x7cf8('0x46')][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x526e7f[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x5ff4eb['query'][_0x7cf8('0x31')]);_0x526e7f[_0x7cf8('0x34')]=qs[_0x7cf8('0x34')](_0x5ff4eb[_0x7cf8('0x46')]['offset']);}_0x526e7f[_0x7cf8('0x4f')]=qs[_0x7cf8('0x50')](_0x5ff4eb[_0x7cf8('0x46')][_0x7cf8('0x50')]);_0x526e7f[_0x7cf8('0x53')]=qs[_0x7cf8('0x47')](_['pick'](_0x5ff4eb[_0x7cf8('0x46')],_0x59b581['filters']));_0x526e7f[_0x7cf8('0x53')]['FaxAccountId']=_0xd9c835['id'];if(_0x5ff4eb['query']['filter']){_0x526e7f[_0x7cf8('0x53')]=_[_0x7cf8('0x54')](_0x526e7f['where'],{'$or':_[_0x7cf8('0x44')](_0x526e7f[_0x7cf8('0x4a')],function(_0x5b1052){var _0x235fc9={};_0x235fc9[_0x5b1052]={'$like':'%'+_0x5ff4eb['query']['filter']+'%'};return _0x235fc9;})});}_0x526e7f=_[_0x7cf8('0x54')]({},_0x526e7f,_0x5ff4eb[_0x7cf8('0x5d')]);return db[_0x7cf8('0x68')][_0x7cf8('0x33')]({'where':_0x526e7f[_0x7cf8('0x53')]})[_0x7cf8('0x23')](function(_0x2427bf){_0x56696b[_0x7cf8('0x33')]=_0x2427bf;if(_0x5ff4eb['query'][_0x7cf8('0x57')]){_0x526e7f[_0x7cf8('0x5c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x526e7f);})['then'](function(_0x118b18){_0x56696b[_0x7cf8('0x59')]=_0x118b18;return _0x56696b;});}})['then'](respondWithFilteredResult(_0x4ed294,_0x526e7f))[_0x7cf8('0x2d')](handleError(_0x4ed294,null));};exports[_0x7cf8('0x6b')]=function(_0x1d1bef,_0xb6ddc3,_0x121772){return db[_0x7cf8('0x56')]['find']({'where':{'id':_0x1d1bef[_0x7cf8('0x5a')]['id']}})['then'](handleEntityNotFound(_0xb6ddc3,null))[_0x7cf8('0x23')](function(_0x4eef18){if(_0x4eef18){return _0x4eef18[_0x7cf8('0x6b')](_0x1d1bef[_0x7cf8('0x46')]['ids']);}})[_0x7cf8('0x23')](respondWithStatusCode(_0xb6ddc3,null))[_0x7cf8('0x2d')](handleError(_0xb6ddc3,null));};exports[_0x7cf8('0x6c')]=function(_0x24a027,_0x11ce52,_0x369846){if(_0x24a027[_0x7cf8('0x60')]['id']){delete _0x24a027[_0x7cf8('0x60')]['id'];}return db[_0x7cf8('0x56')]['find']({'where':{'id':_0x24a027[_0x7cf8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x11ce52,null))[_0x7cf8('0x23')](function(_0x868f14){if(_0x868f14){_0x24a027['body'][_0x7cf8('0x67')]=_0x868f14['id'];return db[_0x7cf8('0x6d')][_0x7cf8('0x5f')](_0x24a027[_0x7cf8('0x60')]);}})['then'](respondWithResult(_0x11ce52,null))[_0x7cf8('0x2d')](handleError(_0x11ce52,null));};exports[_0x7cf8('0x6e')]=function(_0x2d0b1c,_0x40f977,_0x522db4){var _0x13c454={'raw':![],'where':{}};var _0x329d5d={};var _0x228773={'count':0x0,'rows':[]};return db[_0x7cf8('0x56')][_0x7cf8('0x6a')]({'where':{'id':_0x2d0b1c[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x40f977,null))[_0x7cf8('0x23')](function(_0x4bcb7c){if(_0x4bcb7c){_0x329d5d[_0x7cf8('0x49')]=_[_0x7cf8('0x45')](db[_0x7cf8('0x6d')][_0x7cf8('0x5b')]);_0x329d5d[_0x7cf8('0x46')]=_['keys'](_0x2d0b1c[_0x7cf8('0x46')]);_0x329d5d[_0x7cf8('0x47')]=_[_0x7cf8('0x48')](_0x329d5d[_0x7cf8('0x49')],_0x329d5d[_0x7cf8('0x46')]);_0x13c454[_0x7cf8('0x4a')]=_[_0x7cf8('0x48')](_0x329d5d[_0x7cf8('0x49')],qs[_0x7cf8('0x4b')](_0x2d0b1c[_0x7cf8('0x46')][_0x7cf8('0x4b')]));_0x13c454[_0x7cf8('0x4a')]=_0x13c454[_0x7cf8('0x4a')][_0x7cf8('0x4c')]?_0x13c454[_0x7cf8('0x4a')]:_0x329d5d[_0x7cf8('0x49')];if(!_0x2d0b1c['query'][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x13c454[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x2d0b1c[_0x7cf8('0x46')]['limit']);_0x13c454[_0x7cf8('0x34')]=qs['offset'](_0x2d0b1c['query'][_0x7cf8('0x34')]);}_0x13c454[_0x7cf8('0x4f')]=qs['sort'](_0x2d0b1c[_0x7cf8('0x46')][_0x7cf8('0x50')]);_0x13c454[_0x7cf8('0x53')]=qs[_0x7cf8('0x47')](_['pick'](_0x2d0b1c[_0x7cf8('0x46')],_0x329d5d[_0x7cf8('0x47')]));_0x13c454[_0x7cf8('0x53')][_0x7cf8('0x67')]=_0x4bcb7c['id'];if(_0x2d0b1c[_0x7cf8('0x46')][_0x7cf8('0x52')]){_0x13c454['where']=_[_0x7cf8('0x54')](_0x13c454[_0x7cf8('0x53')],{'$or':_['map'](_0x13c454[_0x7cf8('0x4a')],function(_0x34ff1d){var _0x477ca8={};_0x477ca8[_0x34ff1d]={'$like':'%'+_0x2d0b1c['query'][_0x7cf8('0x52')]+'%'};return _0x477ca8;})});}_0x13c454=_[_0x7cf8('0x54')]({},_0x13c454,_0x2d0b1c['options']);return db['CannedAnswer'][_0x7cf8('0x33')]({'where':_0x13c454[_0x7cf8('0x53')]})[_0x7cf8('0x23')](function(_0x1c88b5){_0x228773[_0x7cf8('0x33')]=_0x1c88b5;if(_0x2d0b1c['query'][_0x7cf8('0x57')]){_0x13c454['include']=[{'all':!![]}];}return db[_0x7cf8('0x6d')][_0x7cf8('0x58')](_0x13c454);})['then'](function(_0x132554){_0x228773[_0x7cf8('0x59')]=_0x132554;return _0x228773;});}})[_0x7cf8('0x23')](respondWithFilteredResult(_0x40f977,_0x13c454))[_0x7cf8('0x2d')](handleError(_0x40f977,null));};exports[_0x7cf8('0x6f')]=function(_0x3950a0,_0x52b179,_0x451518){return db[_0x7cf8('0x56')][_0x7cf8('0x5e')]({'where':{'id':_0x3950a0['params']['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x52b179,null))[_0x7cf8('0x23')](function(_0x27ebee){if(_0x27ebee){return _0x27ebee['removeAnswers'](_0x3950a0[_0x7cf8('0x46')][_0x7cf8('0x70')]);}})[_0x7cf8('0x23')](respondWithStatusCode(_0x52b179,null))[_0x7cf8('0x2d')](handleError(_0x52b179,null));};exports[_0x7cf8('0x71')]=function(_0x2100dc,_0x21bf98,_0x5d3b69){return db[_0x7cf8('0x72')]['find']({'where':{'id':_0x2100dc[_0x7cf8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21bf98,null))[_0x7cf8('0x23')](function(_0x50bbc3){if(_0x50bbc3){return _0x50bbc3[_0x7cf8('0x71')](_0x2100dc[_0x7cf8('0x60')][_0x7cf8('0x70')],_[_0x7cf8('0x73')](_0x2100dc[_0x7cf8('0x60')],[_0x7cf8('0x70'),'id'])||{});}})[_0x7cf8('0x23')](respondWithResult(_0x21bf98,null))[_0x7cf8('0x2d')](handleError(_0x21bf98,null));};exports['getInteractions']=function(_0x394d6f,_0x400499,_0x4f78a2){var _0x48e1a8={'raw':![],'where':{}};var _0x296ea5={};var _0x4a628f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7cf8('0x6a')]({'where':{'id':_0x394d6f[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x400499,null))['then'](function(_0x508283){if(_0x508283){_0x296ea5[_0x7cf8('0x49')]=_[_0x7cf8('0x45')](db[_0x7cf8('0x72')]['rawAttributes']);_0x296ea5['query']=_[_0x7cf8('0x45')](_0x394d6f[_0x7cf8('0x46')]);_0x296ea5[_0x7cf8('0x47')]=_['intersection'](_0x296ea5['model'],_0x296ea5[_0x7cf8('0x46')]);_0x48e1a8[_0x7cf8('0x4a')]=_[_0x7cf8('0x48')](_0x296ea5['model'],qs['fields'](_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x4b')]));_0x48e1a8[_0x7cf8('0x4a')]=_0x48e1a8[_0x7cf8('0x4a')]['length']?_0x48e1a8[_0x7cf8('0x4a')]:_0x296ea5[_0x7cf8('0x49')];if(!_0x394d6f['query'][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x48e1a8[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x31')]);_0x48e1a8[_0x7cf8('0x34')]=qs[_0x7cf8('0x34')](_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x34')]);}_0x48e1a8[_0x7cf8('0x4f')]=qs[_0x7cf8('0x50')](_0x394d6f[_0x7cf8('0x46')]['sort']);_0x48e1a8[_0x7cf8('0x53')]=qs[_0x7cf8('0x47')](_[_0x7cf8('0x51')](_0x394d6f[_0x7cf8('0x46')],_0x296ea5[_0x7cf8('0x47')]));_0x48e1a8[_0x7cf8('0x53')]['FaxAccountId']=_0x508283['id'];if(_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x52')]){_0x48e1a8[_0x7cf8('0x53')]=_['merge'](_0x48e1a8[_0x7cf8('0x53')],{'$or':_[_0x7cf8('0x44')](_0x48e1a8[_0x7cf8('0x4a')],function(_0x21cd70){var _0xe228cf={};_0xe228cf[_0x21cd70]={'$like':'%'+_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x52')]+'%'};return _0xe228cf;})});}_0x48e1a8=_[_0x7cf8('0x54')]({},_0x48e1a8,_0x394d6f[_0x7cf8('0x5d')]);return db['FaxInteraction'][_0x7cf8('0x33')]({'where':_0x48e1a8[_0x7cf8('0x53')]})[_0x7cf8('0x23')](function(_0x11e055){_0x4a628f['count']=_0x11e055;if(_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x57')]){_0x48e1a8[_0x7cf8('0x5c')]=[{'model':db[_0x7cf8('0x74')],'as':_0x7cf8('0x75'),'required':![]},{'model':db[_0x7cf8('0x76')],'as':_0x7cf8('0x77'),'attributes':[_0x7cf8('0x3e'),_0x7cf8('0x78'),_0x7cf8('0x79')],'required':![]},{'model':db['Tag'],'as':_0x7cf8('0x7a'),'attributes':['id','name',_0x7cf8('0x7b')],'where':_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x7c')]?{'id':_0x394d6f[_0x7cf8('0x46')][_0x7cf8('0x7c')]}:undefined,'required':_0x394d6f[_0x7cf8('0x46')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x7cf8('0x58')](_0x48e1a8);})[_0x7cf8('0x23')](function(_0x43e9a1){_0x4a628f[_0x7cf8('0x59')]=_0x43e9a1;return _0x4a628f;});}})['then'](respondWithFilteredResult(_0x400499,_0x48e1a8))[_0x7cf8('0x2d')](handleError(_0x400499,null));};exports[_0x7cf8('0x7d')]=function(_0x39b312,_0xded3fe){var _0x5710fd=_0x39b312[_0x7cf8('0x5a')]['id'];var _0x408414=_0x39b312[_0x7cf8('0x60')];var _0x4c730f=0xc8;var _0x55c9b8=null;return db[_0x7cf8('0x7e')]['transaction']({'isolationLevel':db[_0x7cf8('0x7e')]['Transaction'][_0x7cf8('0x7f')][_0x7cf8('0x80')]},function(_0x44ff19){return db['FaxAccount'][_0x7cf8('0x6a')]({'where':{'id':_0x5710fd},'transaction':_0x44ff19})[_0x7cf8('0x23')](function(_0x5c048e){if(_0x5c048e){return db[_0x7cf8('0x81')][_0x7cf8('0x3a')]({'where':{'FaxAccountId':_0x5710fd},'transaction':_0x44ff19})[_0x7cf8('0x23')](function(){var _0x272d8a=_[_0x7cf8('0x44')](_0x408414,function(_0x249025){_0x249025[_0x7cf8('0x67')]=_0x5710fd;return _0x249025;});return db['FaxApplication'][_0x7cf8('0x82')](_0x272d8a,{'transaction':_0x44ff19});});}else{_0x4c730f=0x194;_0x55c9b8=[];}});})[_0x7cf8('0x23')](function(){if(_0x4c730f!==0x194){return db[_0x7cf8('0x81')][_0x7cf8('0x83')]({'where':{'FaxAccountId':_0x5710fd},'order':_0x7cf8('0x84')})[_0x7cf8('0x23')](function(_0x2ce429){_0x55c9b8=_0x2ce429;});}})[_0x7cf8('0x2d')](function(_0xf725e8){_0x4c730f=0x1f4;logger[_0x7cf8('0x28')](_0xf725e8[_0x7cf8('0x3d')]);if(_0xf725e8[_0x7cf8('0x3e')]){delete _0xf725e8[_0x7cf8('0x3e')];}_0x55c9b8=_0xf725e8;})[_0x7cf8('0x85')](function(){if(_0x55c9b8===null){_0xded3fe[_0x7cf8('0x2e')](_0x4c730f);}else{if(_0x4c730f===0x1f4){_0xded3fe[_0x7cf8('0x2f')](_0x4c730f)[_0x7cf8('0x86')](_0x55c9b8);}else{_0xded3fe[_0x7cf8('0x2f')](_0x4c730f)[_0x7cf8('0x30')](_0x55c9b8);}}});};exports[_0x7cf8('0x87')]=function(_0x3e3e84,_0x304e5c,_0x3c07b5){var _0x170656={};var _0x33d138={};var _0x20a0ad;var _0x4b0623;return db['FaxAccount'][_0x7cf8('0x6a')]({'where':{'id':_0x3e3e84[_0x7cf8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x304e5c,null))[_0x7cf8('0x23')](function(_0x35e54e){if(_0x35e54e){_0x20a0ad=_0x35e54e;_0x33d138[_0x7cf8('0x49')]=_['keys'](db['FaxApplication'][_0x7cf8('0x5b')]);_0x33d138[_0x7cf8('0x46')]=_['keys'](_0x3e3e84[_0x7cf8('0x46')]);_0x33d138[_0x7cf8('0x47')]=_[_0x7cf8('0x48')](_0x33d138[_0x7cf8('0x49')],_0x33d138[_0x7cf8('0x46')]);_0x170656[_0x7cf8('0x4a')]=_[_0x7cf8('0x48')](_0x33d138[_0x7cf8('0x49')],qs[_0x7cf8('0x4b')](_0x3e3e84['query'][_0x7cf8('0x4b')]));_0x170656[_0x7cf8('0x4a')]=_0x170656['attributes'][_0x7cf8('0x4c')]?_0x170656[_0x7cf8('0x4a')]:_0x33d138[_0x7cf8('0x49')];_0x170656[_0x7cf8('0x4f')]=qs[_0x7cf8('0x50')](_0x3e3e84[_0x7cf8('0x46')]['sort']);_0x170656[_0x7cf8('0x53')]=qs[_0x7cf8('0x47')](_[_0x7cf8('0x51')](_0x3e3e84[_0x7cf8('0x46')],_0x33d138[_0x7cf8('0x47')]));if(_0x3e3e84['query']['filter']){_0x170656[_0x7cf8('0x53')]=_[_0x7cf8('0x54')](_0x170656[_0x7cf8('0x53')],{'$or':_[_0x7cf8('0x44')](_0x170656['attributes'],function(_0x13f236){var _0x374959={};_0x374959[_0x13f236]={'$like':'%'+_0x3e3e84[_0x7cf8('0x46')][_0x7cf8('0x52')]+'%'};return _0x374959;})});}_0x170656=_[_0x7cf8('0x54')]({},_0x170656,_0x3e3e84['options']);return _0x20a0ad[_0x7cf8('0x87')](_0x170656);}})['then'](function(_0x4f725f){if(_0x4f725f){_0x4b0623=_0x4f725f[_0x7cf8('0x4c')];if(!_0x3e3e84[_0x7cf8('0x46')][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x170656[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x3e3e84[_0x7cf8('0x46')][_0x7cf8('0x31')]);_0x170656[_0x7cf8('0x34')]=qs[_0x7cf8('0x34')](_0x3e3e84['query'][_0x7cf8('0x34')]);}return _0x20a0ad[_0x7cf8('0x87')](_0x170656);}})[_0x7cf8('0x23')](function(_0x2d9465){if(_0x2d9465){return _0x2d9465?{'count':_0x4b0623,'rows':_0x2d9465}:null;}})[_0x7cf8('0x23')](respondWithResult(_0x304e5c,null))['catch'](handleError(_0x304e5c,null));};function Extension(_0x48731b,_0x5ad434,_0x50098f,_0x126795){this[_0x7cf8('0x88')]=_0x7cf8('0x89');this['exten']=_0x48731b[_0x7cf8('0x8a')];this[_0x7cf8('0x8b')]=_0x126795;this[_0x7cf8('0x42')]='system';this['description']='Fax\x20Extension';this['FaxAccountId']=_0x48731b['id'];this[_0x7cf8('0x84')]=_0x5ad434;this[_0x7cf8('0x8c')]=_0x50098f;}function createExtensionsReciveFax(_0x46b058){var _0x4ce5a6=0x1;var _0x638855=[];_0x638855[_0x7cf8('0x8d')](new Extension(_0x46b058,_0x4ce5a6,'',_0x7cf8('0x8e')));_0x4ce5a6+=0x1;_0x638855[_0x7cf8('0x8d')](new Extension(_0x46b058,_0x4ce5a6,_0x7cf8('0x8f'),'Set'));_0x4ce5a6+=0x1;for(var _0x353371 in _0x46b058){if(_0x46b058[_0x7cf8('0x4d')](_0x353371)&&(_0x353371===_0x7cf8('0x90')||_0x353371===_0x7cf8('0x8a')||_0x353371===_0x7cf8('0x91')||_0x353371===_0x7cf8('0x92')||_0x353371==='headerinfo'||_0x353371===_0x7cf8('0x93')||_0x353371===_0x7cf8('0x94')||_0x353371===_0x7cf8('0x95')||_0x353371===_0x7cf8('0x96'))){_0x638855['push'](new Extension(_0x46b058,_0x4ce5a6,_0x7cf8('0x97')+_0x353371+')='+_0x46b058[_0x353371],_0x7cf8('0x98')));_0x4ce5a6+=0x1;}}_0x638855[_0x7cf8('0x8d')](new Extension(_0x46b058,_0x4ce5a6,'6','Wait'));_0x4ce5a6+=0x1;_0x638855[_0x7cf8('0x8d')](new Extension(_0x46b058,_0x4ce5a6,_0x7cf8('0x99'),_0x7cf8('0x9a')));_0x4ce5a6=0x0;return _0x638855;}exports['addAccountApplications']=function(_0x1205e1,_0x1eb93b,_0x3a0e22){var _0x30940f;return db[_0x7cf8('0x7e')]['transaction'](function(_0x4874bc){return db['FaxAccount'][_0x7cf8('0x5f')](_0x1205e1[_0x7cf8('0x60')],{'transaction':_0x4874bc})['then'](function(_0x45c0e7){_0x30940f=_0x45c0e7['get']({'plain':!![]});return db[_0x7cf8('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x30940f),{'transaction':_0x4874bc});});})['then'](function(){return _0x30940f;})['then'](respondWithResult(_0x1eb93b,null))[_0x7cf8('0x2d')](handleError(_0x1eb93b,null));};exports[_0x7cf8('0x9c')]=function(_0x1ceaed,_0x80c4eb,_0x2c9a90){var _0x5c7ca4;return db['sequelize'][_0x7cf8('0x9d')](function(_0xac1f74){return db[_0x7cf8('0x56')][_0x7cf8('0x39')](_0x1ceaed['body'],{'where':{'id':_0x1ceaed[_0x7cf8('0x60')]['id']},'transaction':_0xac1f74})[_0x7cf8('0x23')](function(_0x3e4a02){return db[_0x7cf8('0x9b')][_0x7cf8('0x3a')]({'where':{'FaxAccountId':_0x1ceaed[_0x7cf8('0x60')]['id']},'transaction':_0xac1f74})['then'](function(_0x4af3f0){return db[_0x7cf8('0x9b')][_0x7cf8('0x82')](createExtensionsReciveFax(_[_0x7cf8('0x73')](_0x1ceaed[_0x7cf8('0x60')],[_0x7cf8('0x9e'),'key',_0x7cf8('0x9f'),'updatedAt',_0x7cf8('0xa0'),_0x7cf8('0xa1')])),{'transaction':_0xac1f74});});});})['then'](function(){return db[_0x7cf8('0x56')]['findById'](_0x1ceaed['body']['id']);})[_0x7cf8('0x23')](respondWithResult(_0x80c4eb,null))[_0x7cf8('0x2d')](handleError(_0x80c4eb,null));};exports['getMessages']=function(_0x1ac6c8,_0x500e8f,_0x49511f){var _0x4f18e0={'raw':!![],'where':{}};var _0x957f70={};var _0x1c7649={'count':0x0,'rows':[]};return db[_0x7cf8('0x56')][_0x7cf8('0x6a')]({'where':{'id':_0x1ac6c8[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x500e8f,null))['then'](function(_0x45d4f5){if(_0x45d4f5){_0x957f70[_0x7cf8('0x49')]=_['keys'](db[_0x7cf8('0xa2')][_0x7cf8('0x5b')]);_0x957f70['query']=_[_0x7cf8('0x45')](_0x1ac6c8[_0x7cf8('0x46')]);_0x957f70['filters']=_[_0x7cf8('0x48')](_0x957f70['model'],_0x957f70[_0x7cf8('0x46')]);_0x4f18e0[_0x7cf8('0x4a')]=_[_0x7cf8('0x48')](_0x957f70[_0x7cf8('0x49')],qs['fields'](_0x1ac6c8[_0x7cf8('0x46')]['fields']));_0x4f18e0[_0x7cf8('0x4a')]=_0x4f18e0['attributes'][_0x7cf8('0x4c')]?_0x4f18e0[_0x7cf8('0x4a')]:_0x957f70[_0x7cf8('0x49')];if(!_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x4f18e0[_0x7cf8('0x31')]=qs['limit'](_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0x31')]);_0x4f18e0[_0x7cf8('0x34')]=qs[_0x7cf8('0x34')](_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0x34')]);}_0x4f18e0[_0x7cf8('0x4f')]=qs[_0x7cf8('0x50')](_0x1ac6c8['query'][_0x7cf8('0x50')]);_0x4f18e0[_0x7cf8('0x53')]=qs[_0x7cf8('0x47')](_['pick'](_0x1ac6c8['query'],_0x957f70[_0x7cf8('0x47')]));_0x4f18e0[_0x7cf8('0x53')]['FaxAccountId']=_0x45d4f5['id'];if(_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0x52')]){_0x4f18e0[_0x7cf8('0x53')]=_['merge'](_0x4f18e0['where'],{'$or':_[_0x7cf8('0x44')](_0x4f18e0[_0x7cf8('0x4a')],function(_0xbb8a89){var _0x188480={};_0x188480[_0xbb8a89]={'$like':'%'+_0x1ac6c8[_0x7cf8('0x46')]['filter']+'%'};return _0x188480;})});}if(_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0xa3')]){var _0x1c19ee=_0x1ac6c8[_0x7cf8('0x46')][_0x7cf8('0xa3')][_0x7cf8('0xa4')](',');var _0x579780={};_0x579780[_0x1c19ee[0x0]]={'$gte':moment(_0x1c19ee[0x1])[_0x7cf8('0xa5')](_0x7cf8('0xa6'))};_0x4f18e0[_0x7cf8('0x53')]=_[_0x7cf8('0x54')](_0x4f18e0[_0x7cf8('0x53')],_0x579780);}_0x4f18e0=_[_0x7cf8('0x54')]({},_0x4f18e0,_0x1ac6c8['options']);return db[_0x7cf8('0xa2')][_0x7cf8('0x33')]({'where':_0x4f18e0['where']})[_0x7cf8('0x23')](function(_0x4d7452){_0x1c7649[_0x7cf8('0x33')]=_0x4d7452;if(_0x1ac6c8['query']['includeAll']){_0x4f18e0['include']=[{'all':!![]}];}return db[_0x7cf8('0xa2')][_0x7cf8('0x58')](_0x4f18e0);})[_0x7cf8('0x23')](function(_0x1f5a7d){_0x1c7649[_0x7cf8('0x59')]=_0x1f5a7d;return _0x1c7649;});}})['then'](respondWithFilteredResult(_0x500e8f,_0x4f18e0))[_0x7cf8('0x2d')](handleError(_0x500e8f,null));};exports[_0x7cf8('0x86')]=function(_0x201699,_0xbed531,_0x3283fa){var _0x524561,_0x4f1745={},_0x16b707;if(_0x201699[_0x7cf8('0x60')]['to']){_0x16b707=_0x201699[_0x7cf8('0x60')]['to'][0x0];}return db['FaxAccount'][_0x7cf8('0x5e')]({'where':{'id':_0x201699[_0x7cf8('0x5a')]['id']},'include':[{'model':db[_0x7cf8('0xa7')],'as':_0x7cf8('0xa8'),'include':[{'model':db['CmContact'],'as':_0x7cf8('0xa9'),'where':{'fax':_0x16b707},'limit':0x1,'order':[[_0x7cf8('0xaa'),_0x7cf8('0xab')]]}]}]})[_0x7cf8('0x23')](handleEntityNotFound(_0xbed531,null))[_0x7cf8('0x23')](function(_0x5b1ce4){_0x524561=_0x5b1ce4;if(_0x201699[_0x7cf8('0x60')]['attachments']&&_0x201699['body'][_0x7cf8('0xac')][_0x7cf8('0x4c')]){for(var _0x15877b=0x0;_0x15877b<_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')]['length'];_0x15877b+=0x1){_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][_0x15877b]={'filename':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][_0x15877b][_0x7cf8('0x3e')],'id':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][_0x15877b]['id'],'path':path[_0x7cf8('0xad')](config[_0x7cf8('0xae')],_0x7cf8('0xaf'),_0x201699[_0x7cf8('0x60')]['attachments'][_0x15877b][_0x7cf8('0xb0')])};}}return respondWithRpcPromise(_0x7cf8('0xb1'),'CheckAfterSend',{'FaxAccountId':_[_0x7cf8('0xb2')](_0x201699[_0x7cf8('0x5a')]['id'])?undefined:_0x201699['params']['id'],'path':_['isNil'](_0x201699[_0x7cf8('0x60')]['attachments'][0x0][_0x7cf8('0x7')])?undefined:_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0]['path'],'fax':_[_0x7cf8('0xb2')](_0x201699[_0x7cf8('0x60')]['to'][0x0])?undefined:_0x201699[_0x7cf8('0x60')]['to'][0x0]},client9002);})[_0x7cf8('0x23')](function(){if(_0x524561){if(_[_0x7cf8('0xb2')](_0x201699['body'][_0x7cf8('0xb3')])){_0x201699[_0x7cf8('0x60')][_0x7cf8('0xb3')]=util[_0x7cf8('0xa5')](_0x7cf8('0xb4'),_0x524561[_0x7cf8('0x3e')],_0x524561[_0x7cf8('0xb5')]);}if(_0x524561[_0x7cf8('0xa8')]){if(_0x524561[_0x7cf8('0xa8')][_0x7cf8('0xa9')][_0x7cf8('0x4c')]){return _0x524561[_0x7cf8('0xa8')][_0x7cf8('0xa9')][0x0];}else{return db['CmContact'][_0x7cf8('0x5f')](_[_0x7cf8('0x1b')](_0x201699['body'],{'firstName':_0x201699[_0x7cf8('0x60')]['to'][0x0],'phone':_0x201699['body']['to'][0x0],'fax':_0x201699[_0x7cf8('0x60')]['to'][0x0],'ListId':_0x524561[_0x7cf8('0xa1')]}));}}else{throw new Error(_0x7cf8('0xb6'));}}else{throw new Error(_0x7cf8('0xb7'));}})['then'](function(_0x3465cb){if(_0x3465cb){return db[_0x7cf8('0x72')][_0x7cf8('0x5e')]({'where':{'ContactId':_0x3465cb['id'],'closed':![],'FaxAccountId':_0x524561['id']}})[_0x7cf8('0x23')](function(_0x1a17f9){if(_0x1a17f9){return[_0x1a17f9,![]];}return db[_0x7cf8('0x72')][_0x7cf8('0x5f')]({'UserId':_0x201699['user']['id'],'ContactId':_0x3465cb['id'],'FaxAccountId':_0x524561['id'],'fax':_0x201699[_0x7cf8('0x60')]['to'][0x0],'firstMsgDirection':_0x7cf8('0xb8'),'Messages':[_[_0x7cf8('0x54')](_0x201699[_0x7cf8('0x60')],{'read':![],'body':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0][_0x7cf8('0xb9')],'FaxAccountId':_0x524561['id'],'UserId':_0x201699[_0x7cf8('0x61')]['id'],'ContactId':_0x3465cb['id'],'AttachmentId':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x7cf8('0xa2')],'as':_0x7cf8('0xba')}]})[_0x7cf8('0x23')](function(_0xc03e33){return[_0xc03e33,!![]];});});}else{throw new Error(_0x7cf8('0xbb'));}})[_0x7cf8('0xbc')](function(_0x4f5cfc,_0x56b90a){if(_0x56b90a){return _0x4f5cfc;}return db['FaxMessage'][_0x7cf8('0x5f')]({'direction':_0x7cf8('0xb8'),'read':![],'body':_0x201699[_0x7cf8('0x60')]['attachments'][0x0][_0x7cf8('0xb9')],'FaxAccountId':_0x524561['id'],'FaxInteractionId':_0x4f5cfc['id'],'UserId':_0x201699[_0x7cf8('0x61')]['id'],'ContactId':_0x4f5cfc[_0x7cf8('0xbd')],'AttachmentId':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0]['id']})['then'](function(_0x2c692e){_0x4f5cfc[_0x7cf8('0xbe')][_0x7cf8('0xba')]=[];_0x4f5cfc[_0x7cf8('0xbe')][_0x7cf8('0xba')][_0x7cf8('0x8d')](_0x2c692e[_0x7cf8('0xbe')]);return _0x4f5cfc;});})[_0x7cf8('0x23')](function(_0x224e4c){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x7cf8('0xb2')](_0x201699[_0x7cf8('0x5a')]['id'])?undefined:_0x201699[_0x7cf8('0x5a')]['id'],'path':_[_0x7cf8('0xb2')](_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0][_0x7cf8('0x7')])?undefined:_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0]['path'],'fax':_['isNil'](_0x201699[_0x7cf8('0x60')]['to'][0x0])?undefined:_0x201699[_0x7cf8('0x60')]['to'][0x0],'AttachmentId':_0x201699[_0x7cf8('0x60')][_0x7cf8('0xac')][0x0]['id']},client9002)[_0x7cf8('0x23')](function(_0x127854){logger[_0x7cf8('0x2b')](_0x7cf8('0xbf'),_0x127854);})[_0x7cf8('0x2d')](function(_0xfa33ed){logger['info'](_0x7cf8('0xbf'),_0xfa33ed);});return _0x224e4c;})[_0x7cf8('0x23')](respondWithResult(_0xbed531,null))[_0x7cf8('0x2d')](handleError(_0xbed531,null));};exports[_0x7cf8('0xc0')]=function(_0x3edd1a,_0x482ae6,_0x107737){return db[_0x7cf8('0x56')]['find']({'where':{'id':_0x3edd1a[_0x7cf8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x482ae6,null))['then'](function(_0x135baa){if(_0x135baa){return _0x135baa[_0x7cf8('0xc0')](_0x3edd1a[_0x7cf8('0x60')][_0x7cf8('0x70')],_[_0x7cf8('0x73')](_0x3edd1a[_0x7cf8('0x60')],[_0x7cf8('0x70'),'id'])||{})[_0x7cf8('0xbc')](function(_0x35b59c){for(var _0x3c0a7a=0x0;_0x3c0a7a<_0x3edd1a[_0x7cf8('0x60')][_0x7cf8('0x70')][_0x7cf8('0x4c')];_0x3c0a7a+=0x1){socket[_0x7cf8('0xc1')](_0x7cf8('0xc2'),{'UserId':Number(_0x3edd1a[_0x7cf8('0x60')]['ids'][_0x3c0a7a]),'FaxAccountId':Number(_0x3edd1a[_0x7cf8('0x5a')]['id'])});}return _0x35b59c;});}})[_0x7cf8('0x23')](respondWithResult(_0x482ae6,null))[_0x7cf8('0x2d')](handleError(_0x482ae6,null));};exports[_0x7cf8('0xc3')]=function(_0x186b60,_0x1bcb94,_0x47391f){return db['FaxAccount'][_0x7cf8('0x5e')]({'where':{'id':_0x186b60[_0x7cf8('0x5a')]['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x1bcb94,null))[_0x7cf8('0x23')](function(_0x22cdc8){if(_0x22cdc8){return _0x22cdc8[_0x7cf8('0xc3')](_0x186b60[_0x7cf8('0x46')]['ids'])[_0x7cf8('0x23')](function(){if(_[_0x7cf8('0xc4')](_0x186b60[_0x7cf8('0x46')][_0x7cf8('0x70')])){for(var _0x1d106c=0x0;_0x1d106c<_0x186b60[_0x7cf8('0x46')][_0x7cf8('0x70')]['length'];_0x1d106c+=0x1){socket[_0x7cf8('0xc1')](_0x7cf8('0xc5'),{'UserId':Number(_0x186b60['query'][_0x7cf8('0x70')][_0x1d106c]),'FaxAccountId':Number(_0x186b60['params']['id'])});}}else{socket[_0x7cf8('0xc1')](_0x7cf8('0xc5'),{'UserId':Number(_0x186b60[_0x7cf8('0x46')][_0x7cf8('0x70')]),'FaxAccountId':Number(_0x186b60['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1bcb94,null))[_0x7cf8('0x2d')](handleError(_0x1bcb94,null));};exports[_0x7cf8('0xc6')]=function(_0x1dc614,_0x44d833,_0x20dd05){var _0x763f17={};var _0x4d2148={};var _0x438055;var _0x2c094e;return db[_0x7cf8('0x56')][_0x7cf8('0x6a')]({'where':{'id':_0x1dc614['params']['id']}})[_0x7cf8('0x23')](handleEntityNotFound(_0x44d833,null))['then'](function(_0x1cd3cb){if(_0x1cd3cb){_0x438055=_0x1cd3cb;_0x4d2148[_0x7cf8('0x49')]=_[_0x7cf8('0x45')](db[_0x7cf8('0x76')][_0x7cf8('0x5b')]);_0x4d2148[_0x7cf8('0x46')]=_['keys'](_0x1dc614[_0x7cf8('0x46')]);_0x4d2148[_0x7cf8('0x47')]=_[_0x7cf8('0x48')](_0x4d2148['model'],_0x4d2148[_0x7cf8('0x46')]);_0x763f17['attributes']=_['intersection'](_0x4d2148[_0x7cf8('0x49')],qs['fields'](_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x4b')]));_0x763f17[_0x7cf8('0x4a')]=_0x763f17[_0x7cf8('0x4a')][_0x7cf8('0x4c')]?_0x763f17[_0x7cf8('0x4a')]:_0x4d2148[_0x7cf8('0x49')];_0x763f17[_0x7cf8('0x4f')]=qs[_0x7cf8('0x50')](_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x50')]);_0x763f17[_0x7cf8('0x53')]=qs['filters'](_[_0x7cf8('0x51')](_0x1dc614[_0x7cf8('0x46')],_0x4d2148[_0x7cf8('0x47')]));if(_0x1dc614[_0x7cf8('0x46')]['filter']){_0x763f17['where']=_[_0x7cf8('0x54')](_0x763f17['where'],{'$or':_[_0x7cf8('0x44')](_0x763f17[_0x7cf8('0x4a')],function(_0x45bf37){var _0x5129d5={};_0x5129d5[_0x45bf37]={'$like':'%'+_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x52')]+'%'};return _0x5129d5;})});}_0x763f17=_[_0x7cf8('0x54')]({},_0x763f17,_0x1dc614[_0x7cf8('0x5d')]);return _0x438055['getAgents'](_0x763f17);}})['then'](function(_0x356793){if(_0x356793){_0x2c094e=_0x356793['length'];if(!_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x4d')](_0x7cf8('0x4e'))){_0x763f17[_0x7cf8('0x31')]=qs[_0x7cf8('0x31')](_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x31')]);_0x763f17[_0x7cf8('0x34')]=qs[_0x7cf8('0x34')](_0x1dc614[_0x7cf8('0x46')][_0x7cf8('0x34')]);}return _0x438055[_0x7cf8('0xc6')](_0x763f17);}})[_0x7cf8('0x23')](function(_0x11e172){if(_0x11e172){return _0x11e172?{'count':_0x2c094e,'rows':_0x11e172}:null;}})[_0x7cf8('0x23')](respondWithResult(_0x44d833,null))[_0x7cf8('0x2d')](handleError(_0x44d833,null));}; \ No newline at end of file +var _0x7051=['gateway','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','tech','createdAt','TrunkId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','ListId','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','isArray','emit','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','filter','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','localstationid'];(function(_0x5d96fc,_0x51495a){var _0x4bc96b=function(_0x362e93){while(--_0x362e93){_0x5d96fc['push'](_0x5d96fc['shift']());}};_0x4bc96b(++_0x51495a);}(_0x7051,0xf3));var _0x1705=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x7051[_0x7dbd65];return _0x33d551;};'use strict';var emlformat=require(_0x1705('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1705('0x1'));var rp=require(_0x1705('0x2'));var moment=require(_0x1705('0x3'));var BPromise=require(_0x1705('0x4'));var Mustache=require(_0x1705('0x5'));var util=require(_0x1705('0x6'));var path=require(_0x1705('0x7'));var sox=require('sox');var csv=require(_0x1705('0x8'));var ejs=require(_0x1705('0x9'));var fs=require('fs');var fs_extra=require(_0x1705('0xa'));var _=require(_0x1705('0xb'));var squel=require('squel');var crypto=require(_0x1705('0xc'));var jsforce=require(_0x1705('0xd'));var deskjs=require(_0x1705('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1705('0xf'));var Papa=require(_0x1705('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1705('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1705('0x12'))(_0x1705('0x13'));var utils=require(_0x1705('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1705('0x15'));var db=require(_0x1705('0x16'))['db'];config[_0x1705('0x17')]=_[_0x1705('0x18')](config['redis'],{'host':_0x1705('0x19'),'port':0x18eb});var socket=require(_0x1705('0x1a'))(new Redis(config[_0x1705('0x17')]));require(_0x1705('0x1b'))[_0x1705('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1705('0x1d')][_0x1705('0x1e')]({'port':0x232c});var client9002=jayson[_0x1705('0x1d')][_0x1705('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3723c7,_0x3db426,_0x512aae,_0x954aac){return new BPromise(function(_0x59d159,_0x5e755e){var _0x541ecd=_0x954aac||client;return _0x541ecd[_0x1705('0x1f')](_0x3723c7,_0x512aae)['then'](function(_0x92376f){logger[_0x1705('0x20')]('FaxAccount,\x20%s,\x20%s',_0x3db426,'request\x20sent');logger['debug'](_0x1705('0x21'),_0x3db426,_0x1705('0x22'),JSON[_0x1705('0x23')](_0x92376f));if(_0x92376f[_0x1705('0x24')]){if(_0x92376f['error'][_0x1705('0x25')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3db426,_0x92376f['error']['message']);return _0x5e755e(_0x92376f[_0x1705('0x24')][_0x1705('0x26')]);}logger[_0x1705('0x24')](_0x1705('0x27'),_0x3db426,_0x92376f[_0x1705('0x24')][_0x1705('0x26')]);return _0x59d159(_0x92376f[_0x1705('0x24')][_0x1705('0x26')]);}else{logger[_0x1705('0x20')](_0x1705('0x27'),_0x3db426,_0x1705('0x22'));_0x59d159(_0x92376f[_0x1705('0x28')][_0x1705('0x26')]);}})[_0x1705('0x29')](function(_0x320e45){logger[_0x1705('0x24')](_0x1705('0x27'),_0x3db426,_0x320e45);_0x5e755e(_0x320e45);});});}function respondWithStatusCode(_0x49284e,_0x40df79){_0x40df79=_0x40df79||0xcc;return function(_0x567bd7){if(_0x567bd7){return _0x49284e['sendStatus'](_0x40df79);}return _0x49284e[_0x1705('0x2a')](_0x40df79)[_0x1705('0x2b')]();};}function respondWithResult(_0x1917ea,_0x5c06f0){_0x5c06f0=_0x5c06f0||0xc8;return function(_0x2b817f){if(_0x2b817f){return _0x1917ea['status'](_0x5c06f0)[_0x1705('0x2c')](_0x2b817f);}};}function respondWithFilteredResult(_0x4adc7e,_0x144f6f){return function(_0x51bed9){if(_0x51bed9){var _0x28ccb3=typeof _0x144f6f['offset']===_0x1705('0x2d')&&typeof _0x144f6f[_0x1705('0x2e')]===_0x1705('0x2d');var _0x3410ce=_0x51bed9['count'];var _0x472981=_0x28ccb3?0x0:_0x144f6f['offset'];var _0x453ede=_0x28ccb3?_0x51bed9[_0x1705('0x2f')]:_0x144f6f[_0x1705('0x30')]+_0x144f6f[_0x1705('0x2e')];var _0xf9d28e;if(_0x453ede>=_0x3410ce){_0x453ede=_0x3410ce;_0xf9d28e=0xc8;}else{_0xf9d28e=0xce;}_0x4adc7e[_0x1705('0x2a')](_0xf9d28e);return _0x4adc7e[_0x1705('0x31')]('Content-Range',_0x472981+'-'+_0x453ede+'/'+_0x3410ce)[_0x1705('0x2c')](_0x51bed9);}return null;};}function patchUpdates(_0x5d5a9d){return function(_0x3a3b79){try{jsonpatch[_0x1705('0x32')](_0x3a3b79,_0x5d5a9d,!![]);}catch(_0x57e3d3){return BPromise['reject'](_0x57e3d3);}return _0x3a3b79[_0x1705('0x33')]();};}function saveUpdates(_0x38afb4,_0x35a4e8){return function(_0x809c5){if(_0x809c5){return _0x809c5[_0x1705('0x34')](_0x38afb4)[_0x1705('0x35')](function(_0x4b4896){return _0x4b4896;});}return null;};}function removeEntity(_0x4a30e0,_0x4e2cde){return function(_0x566abe){if(_0x566abe){return _0x566abe[_0x1705('0x36')]()['then'](function(){var _0x42101f=_0x566abe[_0x1705('0x37')]({'plain':!![]});var _0x2df55c=_0x1705('0x38');return db[_0x1705('0x39')][_0x1705('0x36')]({'where':{'type':_0x2df55c,'resourceId':_0x42101f['id']}})[_0x1705('0x35')](function(){return _0x566abe;});})[_0x1705('0x35')](function(){_0x4a30e0[_0x1705('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4530,_0x4e554d){return function(_0x352074){if(!_0x352074){_0x4a4530[_0x1705('0x3a')](0x194);}return _0x352074;};}function handleError(_0x2324f7,_0x333100){_0x333100=_0x333100||0x1f4;return function(_0x4207ef){logger[_0x1705('0x24')](_0x4207ef['stack']);if(_0x4207ef[_0x1705('0x3b')]){delete _0x4207ef[_0x1705('0x3b')];}_0x2324f7[_0x1705('0x2a')](_0x333100)[_0x1705('0x3c')](_0x4207ef);};}exports[_0x1705('0x3d')]=function(_0x269666,_0x1f9bd6){var _0x21d443={'include':[{'model':db[_0x1705('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3637c5={},_0x2fba51={'count':0x0,'rows':[]};var _0x4595a9=_[_0x1705('0x3f')](db[_0x1705('0x40')][_0x1705('0x41')],function(_0x1e8f21){return{'name':_0x1e8f21[_0x1705('0x42')],'type':_0x1e8f21[_0x1705('0x43')][_0x1705('0x44')]};});_0x3637c5[_0x1705('0x45')]=_[_0x1705('0x3f')](_0x4595a9,_0x1705('0x3b'));_0x3637c5[_0x1705('0x46')]=_[_0x1705('0x47')](_0x269666['query']);_0x3637c5[_0x1705('0x48')]=_['intersection'](_0x3637c5[_0x1705('0x45')],_0x3637c5[_0x1705('0x46')]);_0x21d443['attributes']=_['intersection'](_0x3637c5['model'],qs[_0x1705('0x49')](_0x269666[_0x1705('0x46')][_0x1705('0x49')]));_0x21d443[_0x1705('0x4a')]=_0x21d443[_0x1705('0x4a')]['length']?_0x21d443[_0x1705('0x4a')]:_0x3637c5[_0x1705('0x45')];if(!_0x269666[_0x1705('0x46')]['hasOwnProperty'](_0x1705('0x4b'))){_0x21d443['limit']=qs['limit'](_0x269666[_0x1705('0x46')]['limit']);_0x21d443[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x269666[_0x1705('0x46')][_0x1705('0x30')]);}_0x21d443[_0x1705('0x4c')]=qs[_0x1705('0x4d')](_0x269666[_0x1705('0x46')][_0x1705('0x4d')]);_0x21d443[_0x1705('0x4e')]=qs[_0x1705('0x48')](_[_0x1705('0x4f')](_0x269666[_0x1705('0x46')],_0x3637c5[_0x1705('0x48')]),_0x4595a9);if(_0x269666['query']['filter']){_0x21d443[_0x1705('0x4e')]=_[_0x1705('0x50')](_0x21d443[_0x1705('0x4e')],{'$or':_[_0x1705('0x3f')](_0x4595a9,function(_0x3b2fc2){if(_0x3b2fc2[_0x1705('0x43')]!==_0x1705('0x51')){var _0xcc02af={};_0xcc02af[_0x3b2fc2[_0x1705('0x3b')]]={'$like':'%'+_0x269666['query']['filter']+'%'};return _0xcc02af;}})});}_0x21d443=_[_0x1705('0x50')]({},_0x21d443,_0x269666[_0x1705('0x52')]);var _0x338b97={'where':_0x21d443[_0x1705('0x4e')]};return db[_0x1705('0x40')]['count'](_0x338b97)[_0x1705('0x35')](function(_0x7f480f){_0x2fba51[_0x1705('0x2f')]=_0x7f480f;if(_0x269666[_0x1705('0x46')][_0x1705('0x53')]){_0x21d443[_0x1705('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x1705('0x55')](_0x21d443);})[_0x1705('0x35')](function(_0x5b826d){_0x2fba51[_0x1705('0x56')]=_0x5b826d;return _0x2fba51;})[_0x1705('0x35')](respondWithFilteredResult(_0x1f9bd6,_0x21d443))[_0x1705('0x29')](handleError(_0x1f9bd6,null));};exports[_0x1705('0x57')]=function(_0x376d47,_0x4aadbf){var _0x27b6fd={'raw':![],'where':{'id':_0x376d47[_0x1705('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x1705('0x59')}]},_0x19d53d={};_0x19d53d['model']=_[_0x1705('0x47')](db['FaxAccount']['rawAttributes']);_0x19d53d[_0x1705('0x46')]=_[_0x1705('0x47')](_0x376d47['query']);_0x19d53d[_0x1705('0x48')]=_[_0x1705('0x5a')](_0x19d53d[_0x1705('0x45')],_0x19d53d[_0x1705('0x46')]);_0x27b6fd[_0x1705('0x4a')]=_[_0x1705('0x5a')](_0x19d53d[_0x1705('0x45')],qs[_0x1705('0x49')](_0x376d47['query']['fields']));_0x27b6fd[_0x1705('0x4a')]=_0x27b6fd[_0x1705('0x4a')][_0x1705('0x5b')]?_0x27b6fd[_0x1705('0x4a')]:_0x19d53d['model'];if(_0x376d47[_0x1705('0x46')]['includeAll']){_0x27b6fd[_0x1705('0x54')]=[{'all':!![]}];}_0x27b6fd=_['merge']({},_0x27b6fd,_0x376d47[_0x1705('0x52')]);return db[_0x1705('0x40')][_0x1705('0x5c')](_0x27b6fd)[_0x1705('0x35')](handleEntityNotFound(_0x4aadbf,null))[_0x1705('0x35')](respondWithResult(_0x4aadbf,null))['catch'](handleError(_0x4aadbf,null));};exports[_0x1705('0x5d')]=function(_0x109344,_0x4881ef){return db['FaxAccount']['create'](_0x109344[_0x1705('0x5e')],{})[_0x1705('0x35')](function(_0x172799){var _0x3370c5=_0x109344[_0x1705('0x5f')]['get']({'plain':!![]});if(!_0x3370c5)throw new Error(_0x1705('0x60'));if(_0x3370c5[_0x1705('0x61')]===_0x1705('0x5f')){var _0x1244c8=_0x172799[_0x1705('0x37')]({'plain':!![]});var _0x37a8ba=_0x1705('0x38');return db[_0x1705('0x62')][_0x1705('0x5c')]({'where':{'name':_0x37a8ba,'userProfileId':_0x3370c5[_0x1705('0x63')]},'raw':!![]})[_0x1705('0x35')](function(_0x5eaf05){if(_0x5eaf05&&_0x5eaf05[_0x1705('0x64')]===0x0){return db[_0x1705('0x39')][_0x1705('0x5d')]({'name':_0x1244c8[_0x1705('0x3b')],'resourceId':_0x1244c8['id'],'type':_0x5eaf05[_0x1705('0x3b')],'sectionId':_0x5eaf05['id']},{})[_0x1705('0x35')](function(){return _0x172799;});}else{return _0x172799;}})['catch'](function(_0x56074a){logger[_0x1705('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56074a);throw _0x56074a;});}return _0x172799;})[_0x1705('0x35')](respondWithResult(_0x4881ef,0xc9))['catch'](handleError(_0x4881ef,null));};exports['update']=function(_0x50f104,_0x6c96f6){if(_0x50f104['body']['id']){delete _0x50f104[_0x1705('0x5e')]['id'];}return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x50f104['params']['id']},'include':[{'model':db[_0x1705('0x3e')],'as':_0x1705('0x59')}]})['then'](handleEntityNotFound(_0x6c96f6,null))['then'](saveUpdates(_0x50f104['body'],null))[_0x1705('0x35')](respondWithResult(_0x6c96f6,null))[_0x1705('0x29')](handleError(_0x6c96f6,null));};exports[_0x1705('0x36')]=function(_0x89f84d,_0x43faaf){return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x89f84d['params']['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x43faaf,null))['then'](removeEntity(_0x43faaf,null))[_0x1705('0x29')](handleError(_0x43faaf,null));};exports[_0x1705('0x65')]=function(_0xf6b568,_0x192a5d){return db['FaxAccount'][_0x1705('0x65')]()['then'](respondWithResult(_0x192a5d,null))[_0x1705('0x29')](handleError(_0x192a5d,null));};exports[_0x1705('0x66')]=function(_0x476e5,_0x18b99e,_0x48cb47){if(_0x476e5[_0x1705('0x5e')]['id']){delete _0x476e5[_0x1705('0x5e')]['id'];}return db['FaxAccount'][_0x1705('0x5c')]({'where':{'id':_0x476e5[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x18b99e,null))[_0x1705('0x35')](function(_0x6d79ab){if(_0x6d79ab){_0x476e5[_0x1705('0x5e')][_0x1705('0x67')]=_0x6d79ab['id'];return db[_0x1705('0x68')][_0x1705('0x5d')](_0x476e5[_0x1705('0x5e')]);}})['then'](respondWithResult(_0x18b99e,null))['catch'](handleError(_0x18b99e,null));};exports[_0x1705('0x69')]=function(_0xdb128a,_0x13234f,_0x11a12a){var _0x590fd0={'raw':![],'where':{}};var _0xb4c03b={};var _0x5b696b={'count':0x0,'rows':[]};return db[_0x1705('0x40')]['findOne']({'where':{'id':_0xdb128a[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x13234f,null))[_0x1705('0x35')](function(_0x19b9f5){if(_0x19b9f5){_0xb4c03b[_0x1705('0x45')]=_['keys'](db['Disposition']['rawAttributes']);_0xb4c03b[_0x1705('0x46')]=_[_0x1705('0x47')](_0xdb128a[_0x1705('0x46')]);_0xb4c03b[_0x1705('0x48')]=_[_0x1705('0x5a')](_0xb4c03b[_0x1705('0x45')],_0xb4c03b[_0x1705('0x46')]);_0x590fd0[_0x1705('0x4a')]=_['intersection'](_0xb4c03b['model'],qs[_0x1705('0x49')](_0xdb128a[_0x1705('0x46')]['fields']));_0x590fd0['attributes']=_0x590fd0['attributes']['length']?_0x590fd0[_0x1705('0x4a')]:_0xb4c03b[_0x1705('0x45')];if(!_0xdb128a['query'][_0x1705('0x6a')](_0x1705('0x4b'))){_0x590fd0[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0xdb128a['query'][_0x1705('0x2e')]);_0x590fd0['offset']=qs[_0x1705('0x30')](_0xdb128a[_0x1705('0x46')][_0x1705('0x30')]);}_0x590fd0['order']=qs[_0x1705('0x4d')](_0xdb128a[_0x1705('0x46')][_0x1705('0x4d')]);_0x590fd0[_0x1705('0x4e')]=qs[_0x1705('0x48')](_[_0x1705('0x4f')](_0xdb128a[_0x1705('0x46')],_0xb4c03b[_0x1705('0x48')]));_0x590fd0[_0x1705('0x4e')][_0x1705('0x67')]=_0x19b9f5['id'];if(_0xdb128a[_0x1705('0x46')][_0x1705('0x6b')]){_0x590fd0[_0x1705('0x4e')]=_[_0x1705('0x50')](_0x590fd0[_0x1705('0x4e')],{'$or':_[_0x1705('0x3f')](_0x590fd0[_0x1705('0x4a')],function(_0x1eaa9e){var _0x4c66dc={};_0x4c66dc[_0x1eaa9e]={'$like':'%'+_0xdb128a[_0x1705('0x46')][_0x1705('0x6b')]+'%'};return _0x4c66dc;})});}_0x590fd0=_['merge']({},_0x590fd0,_0xdb128a[_0x1705('0x52')]);return db[_0x1705('0x68')][_0x1705('0x2f')]({'where':_0x590fd0[_0x1705('0x4e')]})[_0x1705('0x35')](function(_0x5f2e02){_0x5b696b[_0x1705('0x2f')]=_0x5f2e02;if(_0xdb128a[_0x1705('0x46')][_0x1705('0x53')]){_0x590fd0['include']=[{'all':!![]}];}return db[_0x1705('0x68')]['findAll'](_0x590fd0);})[_0x1705('0x35')](function(_0x5db296){_0x5b696b[_0x1705('0x56')]=_0x5db296;return _0x5b696b;});}})[_0x1705('0x35')](respondWithFilteredResult(_0x13234f,_0x590fd0))[_0x1705('0x29')](handleError(_0x13234f,null));};exports['removeDispositions']=function(_0x193499,_0x587192,_0x463704){return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x193499[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x587192,null))[_0x1705('0x35')](function(_0x7e1258){if(_0x7e1258){return _0x7e1258[_0x1705('0x6c')](_0x193499[_0x1705('0x46')][_0x1705('0x6d')]);}})['then'](respondWithStatusCode(_0x587192,null))[_0x1705('0x29')](handleError(_0x587192,null));};exports[_0x1705('0x6e')]=function(_0x2a8ef9,_0x2d4439,_0x518e5c){if(_0x2a8ef9[_0x1705('0x5e')]['id']){delete _0x2a8ef9[_0x1705('0x5e')]['id'];}return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x2a8ef9[_0x1705('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d4439,null))[_0x1705('0x35')](function(_0x5d1b80){if(_0x5d1b80){_0x2a8ef9[_0x1705('0x5e')]['FaxAccountId']=_0x5d1b80['id'];return db['CannedAnswer'][_0x1705('0x5d')](_0x2a8ef9[_0x1705('0x5e')]);}})[_0x1705('0x35')](respondWithResult(_0x2d4439,null))[_0x1705('0x29')](handleError(_0x2d4439,null));};exports[_0x1705('0x6f')]=function(_0x564420,_0x5d8d6b,_0x5e4dba){var _0x197f92={'raw':![],'where':{}};var _0x54c780={};var _0x1185ca={'count':0x0,'rows':[]};return db[_0x1705('0x40')][_0x1705('0x70')]({'where':{'id':_0x564420[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x5d8d6b,null))['then'](function(_0x48e5e7){if(_0x48e5e7){_0x54c780[_0x1705('0x45')]=_[_0x1705('0x47')](db[_0x1705('0x71')]['rawAttributes']);_0x54c780['query']=_['keys'](_0x564420[_0x1705('0x46')]);_0x54c780[_0x1705('0x48')]=_['intersection'](_0x54c780['model'],_0x54c780['query']);_0x197f92[_0x1705('0x4a')]=_['intersection'](_0x54c780[_0x1705('0x45')],qs[_0x1705('0x49')](_0x564420[_0x1705('0x46')][_0x1705('0x49')]));_0x197f92['attributes']=_0x197f92[_0x1705('0x4a')]['length']?_0x197f92[_0x1705('0x4a')]:_0x54c780[_0x1705('0x45')];if(!_0x564420[_0x1705('0x46')][_0x1705('0x6a')]('nolimit')){_0x197f92[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0x564420[_0x1705('0x46')]['limit']);_0x197f92[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x564420[_0x1705('0x46')][_0x1705('0x30')]);}_0x197f92[_0x1705('0x4c')]=qs[_0x1705('0x4d')](_0x564420[_0x1705('0x46')]['sort']);_0x197f92[_0x1705('0x4e')]=qs[_0x1705('0x48')](_[_0x1705('0x4f')](_0x564420[_0x1705('0x46')],_0x54c780[_0x1705('0x48')]));_0x197f92['where'][_0x1705('0x67')]=_0x48e5e7['id'];if(_0x564420['query'][_0x1705('0x6b')]){_0x197f92[_0x1705('0x4e')]=_[_0x1705('0x50')](_0x197f92[_0x1705('0x4e')],{'$or':_['map'](_0x197f92[_0x1705('0x4a')],function(_0x41b9ac){var _0x3955ca={};_0x3955ca[_0x41b9ac]={'$like':'%'+_0x564420[_0x1705('0x46')][_0x1705('0x6b')]+'%'};return _0x3955ca;})});}_0x197f92=_['merge']({},_0x197f92,_0x564420[_0x1705('0x52')]);return db[_0x1705('0x71')][_0x1705('0x2f')]({'where':_0x197f92['where']})[_0x1705('0x35')](function(_0x2cb073){_0x1185ca[_0x1705('0x2f')]=_0x2cb073;if(_0x564420[_0x1705('0x46')]['includeAll']){_0x197f92[_0x1705('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1705('0x55')](_0x197f92);})[_0x1705('0x35')](function(_0x219a4d){_0x1185ca[_0x1705('0x56')]=_0x219a4d;return _0x1185ca;});}})[_0x1705('0x35')](respondWithFilteredResult(_0x5d8d6b,_0x197f92))[_0x1705('0x29')](handleError(_0x5d8d6b,null));};exports[_0x1705('0x72')]=function(_0x1db0c5,_0x1b5c24,_0xc59510){return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x1db0c5['params']['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x1b5c24,null))[_0x1705('0x35')](function(_0x5a20f4){if(_0x5a20f4){return _0x5a20f4[_0x1705('0x72')](_0x1db0c5[_0x1705('0x46')][_0x1705('0x6d')]);}})[_0x1705('0x35')](respondWithStatusCode(_0x1b5c24,null))[_0x1705('0x29')](handleError(_0x1b5c24,null));};exports[_0x1705('0x73')]=function(_0x3dcf55,_0x2ba89d,_0x45738f){return db[_0x1705('0x74')][_0x1705('0x5c')]({'where':{'id':_0x3dcf55[_0x1705('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ba89d,null))[_0x1705('0x35')](function(_0x38d435){if(_0x38d435){return _0x38d435[_0x1705('0x73')](_0x3dcf55[_0x1705('0x5e')][_0x1705('0x6d')],_[_0x1705('0x75')](_0x3dcf55[_0x1705('0x5e')],[_0x1705('0x6d'),'id'])||{});}})[_0x1705('0x35')](respondWithResult(_0x2ba89d,null))[_0x1705('0x29')](handleError(_0x2ba89d,null));};exports[_0x1705('0x76')]=function(_0x2d15cb,_0x79fcab,_0x5267ac){var _0x459cab={'raw':![],'where':{}};var _0xa961={};var _0x2d1d05={'count':0x0,'rows':[]};return db['FaxAccount'][_0x1705('0x70')]({'where':{'id':_0x2d15cb[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x79fcab,null))[_0x1705('0x35')](function(_0x8a7b45){if(_0x8a7b45){_0xa961[_0x1705('0x45')]=_[_0x1705('0x47')](db[_0x1705('0x74')][_0x1705('0x41')]);_0xa961[_0x1705('0x46')]=_[_0x1705('0x47')](_0x2d15cb[_0x1705('0x46')]);_0xa961['filters']=_[_0x1705('0x5a')](_0xa961['model'],_0xa961['query']);_0x459cab[_0x1705('0x4a')]=_['intersection'](_0xa961['model'],qs[_0x1705('0x49')](_0x2d15cb['query'][_0x1705('0x49')]));_0x459cab['attributes']=_0x459cab[_0x1705('0x4a')][_0x1705('0x5b')]?_0x459cab[_0x1705('0x4a')]:_0xa961[_0x1705('0x45')];if(!_0x2d15cb['query']['hasOwnProperty']('nolimit')){_0x459cab[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0x2d15cb['query'][_0x1705('0x2e')]);_0x459cab[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x2d15cb[_0x1705('0x46')]['offset']);}_0x459cab[_0x1705('0x4c')]=qs[_0x1705('0x4d')](_0x2d15cb[_0x1705('0x46')][_0x1705('0x4d')]);_0x459cab['where']=qs['filters'](_[_0x1705('0x4f')](_0x2d15cb['query'],_0xa961[_0x1705('0x48')]));_0x459cab[_0x1705('0x4e')][_0x1705('0x67')]=_0x8a7b45['id'];if(_0x2d15cb[_0x1705('0x46')][_0x1705('0x6b')]){_0x459cab[_0x1705('0x4e')]=_[_0x1705('0x50')](_0x459cab[_0x1705('0x4e')],{'$or':_[_0x1705('0x3f')](_0x459cab[_0x1705('0x4a')],function(_0x521149){var _0x3d26b2={};_0x3d26b2[_0x521149]={'$like':'%'+_0x2d15cb['query'][_0x1705('0x6b')]+'%'};return _0x3d26b2;})});}_0x459cab=_['merge']({},_0x459cab,_0x2d15cb[_0x1705('0x52')]);return db[_0x1705('0x74')][_0x1705('0x2f')]({'where':_0x459cab['where']})[_0x1705('0x35')](function(_0x4c87d4){_0x2d1d05['count']=_0x4c87d4;if(_0x2d15cb[_0x1705('0x46')]['includeAll']){_0x459cab[_0x1705('0x54')]=[{'model':db[_0x1705('0x77')],'as':_0x1705('0x78'),'required':![]},{'model':db[_0x1705('0x79')],'as':_0x1705('0x7a'),'attributes':[_0x1705('0x3b'),_0x1705('0x7b'),_0x1705('0x7c')],'required':![]},{'model':db[_0x1705('0x7d')],'as':'Tags','attributes':['id',_0x1705('0x3b'),_0x1705('0x7e')],'where':_0x2d15cb[_0x1705('0x46')][_0x1705('0x7f')]?{'id':_0x2d15cb['query'][_0x1705('0x7f')]}:undefined,'required':_0x2d15cb[_0x1705('0x46')]['tag']?!![]:![]}];}return db[_0x1705('0x74')]['findAll'](_0x459cab);})[_0x1705('0x35')](function(_0x4a2f4e){_0x2d1d05[_0x1705('0x56')]=_0x4a2f4e;return _0x2d1d05;});}})[_0x1705('0x35')](respondWithFilteredResult(_0x79fcab,_0x459cab))['catch'](handleError(_0x79fcab,null));};exports['addApplications']=function(_0x5427e9,_0x333746){var _0x25a327=_0x5427e9[_0x1705('0x58')]['id'];var _0x16e6ce=_0x5427e9[_0x1705('0x5e')];var _0x1cd508=0xc8;var _0x4c1a36=null;return db[_0x1705('0x80')][_0x1705('0x81')]({'isolationLevel':db[_0x1705('0x80')][_0x1705('0x82')][_0x1705('0x83')][_0x1705('0x84')]},function(_0x504d65){return db['FaxAccount'][_0x1705('0x70')]({'where':{'id':_0x25a327},'transaction':_0x504d65})[_0x1705('0x35')](function(_0x275c08){if(_0x275c08){return db[_0x1705('0x85')][_0x1705('0x36')]({'where':{'FaxAccountId':_0x25a327},'transaction':_0x504d65})[_0x1705('0x35')](function(){var _0x4d365d=_[_0x1705('0x3f')](_0x16e6ce,function(_0x2ebce2){_0x2ebce2[_0x1705('0x67')]=_0x25a327;return _0x2ebce2;});return db['FaxApplication'][_0x1705('0x86')](_0x4d365d,{'transaction':_0x504d65});});}else{_0x1cd508=0x194;_0x4c1a36=[];}});})[_0x1705('0x35')](function(){if(_0x1cd508!==0x194){return db[_0x1705('0x85')][_0x1705('0x87')]({'where':{'FaxAccountId':_0x25a327},'order':_0x1705('0x88')})['then'](function(_0x3bd4ae){_0x4c1a36=_0x3bd4ae;});}})[_0x1705('0x29')](function(_0x2ce80f){_0x1cd508=0x1f4;logger[_0x1705('0x24')](_0x2ce80f['stack']);if(_0x2ce80f[_0x1705('0x3b')]){delete _0x2ce80f['name'];}_0x4c1a36=_0x2ce80f;})['finally'](function(){if(_0x4c1a36===null){_0x333746['sendStatus'](_0x1cd508);}else{if(_0x1cd508===0x1f4){_0x333746[_0x1705('0x2a')](_0x1cd508)[_0x1705('0x3c')](_0x4c1a36);}else{_0x333746[_0x1705('0x2a')](_0x1cd508)[_0x1705('0x2c')](_0x4c1a36);}}});};exports['getApplications']=function(_0x170f5b,_0x241176,_0x13a1db){var _0x1142f6={};var _0xb53135={};var _0x512918;var _0x130bca;return db[_0x1705('0x40')][_0x1705('0x70')]({'where':{'id':_0x170f5b[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x241176,null))[_0x1705('0x35')](function(_0x495da9){if(_0x495da9){_0x512918=_0x495da9;_0xb53135['model']=_[_0x1705('0x47')](db[_0x1705('0x85')]['rawAttributes']);_0xb53135[_0x1705('0x46')]=_[_0x1705('0x47')](_0x170f5b[_0x1705('0x46')]);_0xb53135[_0x1705('0x48')]=_[_0x1705('0x5a')](_0xb53135[_0x1705('0x45')],_0xb53135[_0x1705('0x46')]);_0x1142f6[_0x1705('0x4a')]=_['intersection'](_0xb53135[_0x1705('0x45')],qs[_0x1705('0x49')](_0x170f5b[_0x1705('0x46')][_0x1705('0x49')]));_0x1142f6['attributes']=_0x1142f6[_0x1705('0x4a')][_0x1705('0x5b')]?_0x1142f6['attributes']:_0xb53135[_0x1705('0x45')];_0x1142f6['order']=qs['sort'](_0x170f5b[_0x1705('0x46')][_0x1705('0x4d')]);_0x1142f6[_0x1705('0x4e')]=qs['filters'](_[_0x1705('0x4f')](_0x170f5b[_0x1705('0x46')],_0xb53135['filters']));if(_0x170f5b['query'][_0x1705('0x6b')]){_0x1142f6[_0x1705('0x4e')]=_['merge'](_0x1142f6[_0x1705('0x4e')],{'$or':_['map'](_0x1142f6[_0x1705('0x4a')],function(_0x594c96){var _0x17089c={};_0x17089c[_0x594c96]={'$like':'%'+_0x170f5b[_0x1705('0x46')][_0x1705('0x6b')]+'%'};return _0x17089c;})});}_0x1142f6=_[_0x1705('0x50')]({},_0x1142f6,_0x170f5b['options']);return _0x512918[_0x1705('0x89')](_0x1142f6);}})[_0x1705('0x35')](function(_0x3ca427){if(_0x3ca427){_0x130bca=_0x3ca427['length'];if(!_0x170f5b['query']['hasOwnProperty']('nolimit')){_0x1142f6[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0x170f5b['query']['limit']);_0x1142f6[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x170f5b[_0x1705('0x46')]['offset']);}return _0x512918['getApplications'](_0x1142f6);}})[_0x1705('0x35')](function(_0xbd50f1){if(_0xbd50f1){return _0xbd50f1?{'count':_0x130bca,'rows':_0xbd50f1}:null;}})[_0x1705('0x35')](respondWithResult(_0x241176,null))[_0x1705('0x29')](handleError(_0x241176,null));};function Extension(_0xa8970e,_0x584282,_0x27ab30,_0x217587){this[_0x1705('0x8a')]=_0x1705('0x8b');this[_0x1705('0x8c')]=_0xa8970e['localstationid'];this[_0x1705('0x8d')]=_0x217587;this[_0x1705('0x43')]='system';this[_0x1705('0x8e')]=_0x1705('0x8f');this[_0x1705('0x67')]=_0xa8970e['id'];this[_0x1705('0x88')]=_0x584282;this[_0x1705('0x90')]=_0x27ab30;}function createExtensionsReciveFax(_0x54cc27){var _0x267024=0x1;var _0x1dcf9e=[];_0x1dcf9e[_0x1705('0x91')](new Extension(_0x54cc27,_0x267024,'','Answer'));_0x267024+=0x1;_0x1dcf9e[_0x1705('0x91')](new Extension(_0x54cc27,_0x267024,_0x1705('0x92'),_0x1705('0x93')));_0x267024+=0x1;for(var _0x487ac3 in _0x54cc27){if(_0x54cc27[_0x1705('0x6a')](_0x487ac3)&&(_0x487ac3==='ecm'||_0x487ac3===_0x1705('0x94')||_0x487ac3===_0x1705('0x95')||_0x487ac3==='faxdetect'||_0x487ac3===_0x1705('0x96')||_0x487ac3===_0x1705('0x97')||_0x487ac3==='minrate'||_0x487ac3==='modem'||_0x487ac3===_0x1705('0x98'))){_0x1dcf9e[_0x1705('0x91')](new Extension(_0x54cc27,_0x267024,_0x1705('0x99')+_0x487ac3+')='+_0x54cc27[_0x487ac3],'Set'));_0x267024+=0x1;}}_0x1dcf9e['push'](new Extension(_0x54cc27,_0x267024,'6',_0x1705('0x9a')));_0x267024+=0x1;_0x1dcf9e['push'](new Extension(_0x54cc27,_0x267024,_0x1705('0x9b'),'ReceiveFax'));_0x267024=0x0;return _0x1dcf9e;}exports['addAccountApplications']=function(_0x31b89c,_0x47eac6,_0xb2f289){var _0x7046b8;return db[_0x1705('0x80')][_0x1705('0x81')](function(_0x1ed179){return db[_0x1705('0x40')]['create'](_0x31b89c[_0x1705('0x5e')],{'transaction':_0x1ed179})[_0x1705('0x35')](function(_0x17ef31){_0x7046b8=_0x17ef31[_0x1705('0x37')]({'plain':!![]});return db[_0x1705('0x9c')][_0x1705('0x86')](createExtensionsReciveFax(_0x7046b8),{'transaction':_0x1ed179});});})[_0x1705('0x35')](function(){return _0x7046b8;})['then'](respondWithResult(_0x47eac6,null))[_0x1705('0x29')](handleError(_0x47eac6,null));};exports['updateAccountApplications']=function(_0x29cb48,_0x1e43b1,_0x3940c6){var _0x3a9f80;return db['sequelize'][_0x1705('0x81')](function(_0x15d8de){return db['FaxAccount'][_0x1705('0x34')](_0x29cb48[_0x1705('0x5e')],{'where':{'id':_0x29cb48[_0x1705('0x5e')]['id']},'transaction':_0x15d8de})[_0x1705('0x35')](function(_0x654292){return db[_0x1705('0x9c')][_0x1705('0x36')]({'where':{'FaxAccountId':_0x29cb48[_0x1705('0x5e')]['id']},'transaction':_0x15d8de})[_0x1705('0x35')](function(_0x160aa5){return db[_0x1705('0x9c')][_0x1705('0x86')](createExtensionsReciveFax(_[_0x1705('0x75')](_0x29cb48['body'],[_0x1705('0x9d'),_0x1705('0x44'),_0x1705('0x9e'),'updatedAt',_0x1705('0x9f'),'ListId'])),{'transaction':_0x15d8de});});});})[_0x1705('0x35')](function(){return db[_0x1705('0x40')]['findById'](_0x29cb48[_0x1705('0x5e')]['id']);})['then'](respondWithResult(_0x1e43b1,null))[_0x1705('0x29')](handleError(_0x1e43b1,null));};exports[_0x1705('0xa0')]=function(_0x1279df,_0x41361c,_0xb8854a){var _0x5ee95d={'raw':!![],'where':{}};var _0x2e2bb4={};var _0x3feca1={'count':0x0,'rows':[]};return db[_0x1705('0x40')]['findOne']({'where':{'id':_0x1279df[_0x1705('0x58')]['id']}})['then'](handleEntityNotFound(_0x41361c,null))[_0x1705('0x35')](function(_0x57e91b){if(_0x57e91b){_0x2e2bb4[_0x1705('0x45')]=_[_0x1705('0x47')](db['FaxMessage']['rawAttributes']);_0x2e2bb4['query']=_[_0x1705('0x47')](_0x1279df[_0x1705('0x46')]);_0x2e2bb4['filters']=_['intersection'](_0x2e2bb4[_0x1705('0x45')],_0x2e2bb4[_0x1705('0x46')]);_0x5ee95d[_0x1705('0x4a')]=_[_0x1705('0x5a')](_0x2e2bb4['model'],qs[_0x1705('0x49')](_0x1279df['query'][_0x1705('0x49')]));_0x5ee95d[_0x1705('0x4a')]=_0x5ee95d[_0x1705('0x4a')][_0x1705('0x5b')]?_0x5ee95d[_0x1705('0x4a')]:_0x2e2bb4['model'];if(!_0x1279df[_0x1705('0x46')]['hasOwnProperty'](_0x1705('0x4b'))){_0x5ee95d[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0x1279df['query']['limit']);_0x5ee95d[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x1279df[_0x1705('0x46')]['offset']);}_0x5ee95d['order']=qs[_0x1705('0x4d')](_0x1279df[_0x1705('0x46')][_0x1705('0x4d')]);_0x5ee95d[_0x1705('0x4e')]=qs[_0x1705('0x48')](_['pick'](_0x1279df['query'],_0x2e2bb4[_0x1705('0x48')]));_0x5ee95d[_0x1705('0x4e')][_0x1705('0x67')]=_0x57e91b['id'];if(_0x1279df[_0x1705('0x46')]['filter']){_0x5ee95d[_0x1705('0x4e')]=_[_0x1705('0x50')](_0x5ee95d[_0x1705('0x4e')],{'$or':_[_0x1705('0x3f')](_0x5ee95d['attributes'],function(_0x22aaa7){var _0x52f5ef={};_0x52f5ef[_0x22aaa7]={'$like':'%'+_0x1279df[_0x1705('0x46')]['filter']+'%'};return _0x52f5ef;})});}if(_0x1279df[_0x1705('0x46')][_0x1705('0xa1')]){var _0x139848=_0x1279df[_0x1705('0x46')][_0x1705('0xa1')][_0x1705('0xa2')](',');var _0x4d1838={};_0x4d1838[_0x139848[0x0]]={'$gte':moment(_0x139848[0x1])[_0x1705('0xa3')](_0x1705('0xa4'))};_0x5ee95d[_0x1705('0x4e')]=_['merge'](_0x5ee95d[_0x1705('0x4e')],_0x4d1838);}_0x5ee95d=_[_0x1705('0x50')]({},_0x5ee95d,_0x1279df[_0x1705('0x52')]);return db[_0x1705('0xa5')][_0x1705('0x2f')]({'where':_0x5ee95d[_0x1705('0x4e')]})[_0x1705('0x35')](function(_0x16448e){_0x3feca1[_0x1705('0x2f')]=_0x16448e;if(_0x1279df[_0x1705('0x46')][_0x1705('0x53')]){_0x5ee95d[_0x1705('0x54')]=[{'all':!![]}];}return db[_0x1705('0xa5')][_0x1705('0x55')](_0x5ee95d);})[_0x1705('0x35')](function(_0x5620f9){_0x3feca1['rows']=_0x5620f9;return _0x3feca1;});}})['then'](respondWithFilteredResult(_0x41361c,_0x5ee95d))[_0x1705('0x29')](handleError(_0x41361c,null));};exports['send']=function(_0x36b2d1,_0x56de07,_0x2ea4a6){var _0x4b1e0f,_0xf5a591={},_0x944630;if(_0x36b2d1[_0x1705('0x5e')]['to']){_0x944630=_0x36b2d1[_0x1705('0x5e')]['to'][0x0];}return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x36b2d1[_0x1705('0x58')]['id']},'include':[{'model':db[_0x1705('0xa6')],'as':_0x1705('0xa7'),'include':[{'model':db[_0x1705('0x77')],'as':'Contacts','where':{'fax':_0x944630},'limit':0x1,'order':[[_0x1705('0xa8'),_0x1705('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x56de07,null))[_0x1705('0x35')](function(_0x294396){_0x4b1e0f=_0x294396;if(_0x36b2d1['body'][_0x1705('0xaa')]&&_0x36b2d1[_0x1705('0x5e')]['attachments']['length']){for(var _0x152cd0=0x0;_0x152cd0<_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][_0x1705('0x5b')];_0x152cd0+=0x1){_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][_0x152cd0]={'filename':_0x36b2d1['body'][_0x1705('0xaa')][_0x152cd0][_0x1705('0x3b')],'id':_0x36b2d1['body'][_0x1705('0xaa')][_0x152cd0]['id'],'path':path[_0x1705('0xab')](config[_0x1705('0xac')],_0x1705('0xad'),_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][_0x152cd0][_0x1705('0xae')])};}}return respondWithRpcPromise(_0x1705('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0x1705('0xb0')](_0x36b2d1['params']['id'])?undefined:_0x36b2d1['params']['id'],'path':_[_0x1705('0xb0')](_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0][_0x1705('0x7')])?undefined:_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0][_0x1705('0x7')],'fax':_[_0x1705('0xb0')](_0x36b2d1[_0x1705('0x5e')]['to'][0x0])?undefined:_0x36b2d1[_0x1705('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x4b1e0f){if(_['isNil'](_0x36b2d1[_0x1705('0x5e')][_0x1705('0xb1')])){_0x36b2d1[_0x1705('0x5e')]['from']=util[_0x1705('0xa3')]('\x22%s\x22\x20<%s>',_0x4b1e0f[_0x1705('0x3b')],_0x4b1e0f[_0x1705('0xb2')]);}if(_0x4b1e0f[_0x1705('0xa7')]){if(_0x4b1e0f[_0x1705('0xa7')]['Contacts'][_0x1705('0x5b')]){return _0x4b1e0f[_0x1705('0xa7')][_0x1705('0xb3')][0x0];}else{return db[_0x1705('0x77')]['create'](_[_0x1705('0x18')](_0x36b2d1[_0x1705('0x5e')],{'firstName':_0x36b2d1[_0x1705('0x5e')]['to'][0x0],'phone':_0x36b2d1[_0x1705('0x5e')]['to'][0x0],'fax':_0x36b2d1[_0x1705('0x5e')]['to'][0x0],'ListId':_0x4b1e0f[_0x1705('0xb4')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x1705('0xb5'));}})[_0x1705('0x35')](function(_0x10f98b){if(_0x10f98b){return db['FaxInteraction'][_0x1705('0x5c')]({'where':{'ContactId':_0x10f98b['id'],'closed':![],'FaxAccountId':_0x4b1e0f['id']}})[_0x1705('0x35')](function(_0x445399){if(_0x445399){return[_0x445399,![]];}return db['FaxInteraction'][_0x1705('0x5d')]({'UserId':_0x36b2d1['user']['id'],'ContactId':_0x10f98b['id'],'FaxAccountId':_0x4b1e0f['id'],'fax':_0x36b2d1[_0x1705('0x5e')]['to'][0x0],'firstMsgDirection':_0x1705('0xb6'),'Messages':[_['merge'](_0x36b2d1[_0x1705('0x5e')],{'read':![],'body':_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0][_0x1705('0xb7')],'FaxAccountId':_0x4b1e0f['id'],'UserId':_0x36b2d1[_0x1705('0x5f')]['id'],'ContactId':_0x10f98b['id'],'AttachmentId':_0x36b2d1[_0x1705('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x1705('0xa5')],'as':'Messages'}]})[_0x1705('0x35')](function(_0x14f9c0){return[_0x14f9c0,!![]];});});}else{throw new Error(_0x1705('0xb8'));}})['spread'](function(_0x1bde97,_0x3d4bb2){if(_0x3d4bb2){return _0x1bde97;}return db[_0x1705('0xa5')][_0x1705('0x5d')]({'direction':'out','read':![],'body':_0x36b2d1['body']['attachments'][0x0][_0x1705('0xb7')],'FaxAccountId':_0x4b1e0f['id'],'FaxInteractionId':_0x1bde97['id'],'UserId':_0x36b2d1['user']['id'],'ContactId':_0x1bde97[_0x1705('0xb9')],'AttachmentId':_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0]['id']})[_0x1705('0x35')](function(_0x33c683){_0x1bde97[_0x1705('0xba')][_0x1705('0xbb')]=[];_0x1bde97[_0x1705('0xba')][_0x1705('0xbb')][_0x1705('0x91')](_0x33c683[_0x1705('0xba')]);return _0x1bde97;});})['then'](function(_0x789632){respondWithRpcPromise(_0x1705('0xbc'),'SendFax',{'FaxAccountId':_[_0x1705('0xb0')](_0x36b2d1['params']['id'])?undefined:_0x36b2d1[_0x1705('0x58')]['id'],'path':_['isNil'](_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0]['path'])?undefined:_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0][_0x1705('0x7')],'fax':_[_0x1705('0xb0')](_0x36b2d1[_0x1705('0x5e')]['to'][0x0])?undefined:_0x36b2d1[_0x1705('0x5e')]['to'][0x0],'AttachmentId':_0x36b2d1[_0x1705('0x5e')][_0x1705('0xaa')][0x0]['id']},client9002)['then'](function(_0x4fdcdf){logger[_0x1705('0x20')]('SendFaxRpc,\x20%s',_0x4fdcdf);})['catch'](function(_0x1006f4){logger[_0x1705('0x20')](_0x1705('0xbd'),_0x1006f4);});return _0x789632;})['then'](respondWithResult(_0x56de07,null))['catch'](handleError(_0x56de07,null));};exports[_0x1705('0xbe')]=function(_0x1a2f9b,_0x5b3522,_0x3c631a){return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x1a2f9b[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x5b3522,null))[_0x1705('0x35')](function(_0x49753b){if(_0x49753b){return _0x49753b[_0x1705('0xbe')](_0x1a2f9b[_0x1705('0x5e')][_0x1705('0x6d')],_[_0x1705('0x75')](_0x1a2f9b[_0x1705('0x5e')],[_0x1705('0x6d'),'id'])||{})[_0x1705('0xbf')](function(_0x29c952){for(var _0x3785a8=0x0;_0x3785a8<_0x1a2f9b['body'][_0x1705('0x6d')][_0x1705('0x5b')];_0x3785a8+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x1a2f9b['body']['ids'][_0x3785a8]),'FaxAccountId':Number(_0x1a2f9b['params']['id'])});}return _0x29c952;});}})[_0x1705('0x35')](respondWithResult(_0x5b3522,null))[_0x1705('0x29')](handleError(_0x5b3522,null));};exports['removeAgents']=function(_0x2edd54,_0x5be30e,_0x2d9036){return db[_0x1705('0x40')][_0x1705('0x5c')]({'where':{'id':_0x2edd54[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x5be30e,null))[_0x1705('0x35')](function(_0x51b960){if(_0x51b960){return _0x51b960['removeAgents'](_0x2edd54[_0x1705('0x46')][_0x1705('0x6d')])[_0x1705('0x35')](function(){if(_[_0x1705('0xc0')](_0x2edd54[_0x1705('0x46')][_0x1705('0x6d')])){for(var _0x4ace08=0x0;_0x4ace08<_0x2edd54['query'][_0x1705('0x6d')][_0x1705('0x5b')];_0x4ace08+=0x1){socket[_0x1705('0xc1')](_0x1705('0xc2'),{'UserId':Number(_0x2edd54['query']['ids'][_0x4ace08]),'FaxAccountId':Number(_0x2edd54['params']['id'])});}}else{socket[_0x1705('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x2edd54[_0x1705('0x46')][_0x1705('0x6d')]),'FaxAccountId':Number(_0x2edd54[_0x1705('0x58')]['id'])});}});}})[_0x1705('0x35')](respondWithStatusCode(_0x5be30e,null))[_0x1705('0x29')](handleError(_0x5be30e,null));};exports[_0x1705('0xc3')]=function(_0x89aa3f,_0x1c3efb,_0x514515){var _0xd789a6={};var _0x1afbb4={};var _0x1e1304;var _0x17e731;return db[_0x1705('0x40')][_0x1705('0x70')]({'where':{'id':_0x89aa3f[_0x1705('0x58')]['id']}})[_0x1705('0x35')](handleEntityNotFound(_0x1c3efb,null))[_0x1705('0x35')](function(_0x48e622){if(_0x48e622){_0x1e1304=_0x48e622;_0x1afbb4[_0x1705('0x45')]=_[_0x1705('0x47')](db['User']['rawAttributes']);_0x1afbb4[_0x1705('0x46')]=_[_0x1705('0x47')](_0x89aa3f[_0x1705('0x46')]);_0x1afbb4['filters']=_[_0x1705('0x5a')](_0x1afbb4['model'],_0x1afbb4[_0x1705('0x46')]);_0xd789a6[_0x1705('0x4a')]=_[_0x1705('0x5a')](_0x1afbb4[_0x1705('0x45')],qs[_0x1705('0x49')](_0x89aa3f[_0x1705('0x46')][_0x1705('0x49')]));_0xd789a6[_0x1705('0x4a')]=_0xd789a6[_0x1705('0x4a')][_0x1705('0x5b')]?_0xd789a6[_0x1705('0x4a')]:_0x1afbb4[_0x1705('0x45')];_0xd789a6[_0x1705('0x4c')]=qs[_0x1705('0x4d')](_0x89aa3f['query'][_0x1705('0x4d')]);_0xd789a6['where']=qs[_0x1705('0x48')](_[_0x1705('0x4f')](_0x89aa3f[_0x1705('0x46')],_0x1afbb4[_0x1705('0x48')]));if(_0x89aa3f[_0x1705('0x46')][_0x1705('0x6b')]){_0xd789a6['where']=_[_0x1705('0x50')](_0xd789a6[_0x1705('0x4e')],{'$or':_['map'](_0xd789a6['attributes'],function(_0x561a9e){var _0x22ee9d={};_0x22ee9d[_0x561a9e]={'$like':'%'+_0x89aa3f[_0x1705('0x46')][_0x1705('0x6b')]+'%'};return _0x22ee9d;})});}_0xd789a6=_[_0x1705('0x50')]({},_0xd789a6,_0x89aa3f[_0x1705('0x52')]);return _0x1e1304[_0x1705('0xc3')](_0xd789a6);}})[_0x1705('0x35')](function(_0x428dc5){if(_0x428dc5){_0x17e731=_0x428dc5[_0x1705('0x5b')];if(!_0x89aa3f[_0x1705('0x46')]['hasOwnProperty'](_0x1705('0x4b'))){_0xd789a6[_0x1705('0x2e')]=qs[_0x1705('0x2e')](_0x89aa3f[_0x1705('0x46')][_0x1705('0x2e')]);_0xd789a6[_0x1705('0x30')]=qs[_0x1705('0x30')](_0x89aa3f[_0x1705('0x46')][_0x1705('0x30')]);}return _0x1e1304[_0x1705('0xc3')](_0xd789a6);}})[_0x1705('0x35')](function(_0xef664f){if(_0xef664f){return _0xef664f?{'count':_0x17e731,'rows':_0xef664f}:null;}})[_0x1705('0x35')](respondWithResult(_0x1c3efb,null))[_0x1705('0x29')](handleError(_0x1c3efb,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d7403d9..ba416a3 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 _0xd283=['emit','hook','../../mysqldb','FaxAccount','save','update','remove'];(function(_0x2313c5,_0x4cffa7){var _0x32e21f=function(_0x1d67b1){while(--_0x1d67b1){_0x2313c5['push'](_0x2313c5['shift']());}};_0x32e21f(++_0x4cffa7);}(_0xd283,0xb8));var _0x3d28=function(_0x165987,_0x57c683){_0x165987=_0x165987-0x0;var _0x581d83=_0xd283[_0x165987];return _0x581d83;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x3d28('0x0'))['db'][_0x3d28('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d28('0x2'),'afterUpdate':_0x3d28('0x3'),'afterDestroy':_0x3d28('0x4')};function emitEvent(_0x58bc5d){return function(_0xcaae9f,_0x3a71e7,_0x5a167e){FaxAccountEvents[_0x3d28('0x5')](_0x58bc5d+':'+_0xcaae9f['id'],_0xcaae9f);FaxAccountEvents[_0x3d28('0x5')](_0x58bc5d,_0xcaae9f);_0x5a167e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3d28('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x5208=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x75cc1e,_0x19e6d1){var _0x2bfb62=function(_0x34ea72){while(--_0x34ea72){_0x75cc1e['push'](_0x75cc1e['shift']());}};_0x2bfb62(++_0x19e6d1);}(_0x5208,0x1e9));var _0x8520=function(_0x1cd4d5,_0x40bd09){_0x1cd4d5=_0x1cd4d5-0x0;var _0x348028=_0x5208[_0x1cd4d5];return _0x348028;};'use strict';var EventEmitter=require(_0x8520('0x0'));var FaxAccount=require(_0x8520('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8520('0x2')](0x0);var events={'afterCreate':_0x8520('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x453e28){return function(_0x2ac743,_0x24c589,_0x20e93f){FaxAccountEvents[_0x8520('0x4')](_0x453e28+':'+_0x2ac743['id'],_0x2ac743);FaxAccountEvents['emit'](_0x453e28,_0x2ac743);_0x20e93f(null);};}for(var e in events){if(events[_0x8520('0x5')](e)){var event=events[e];FaxAccount[_0x8520('0x6')](e,emitEvent(event));}}module[_0x8520('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f435880..7f87b9c 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 _0xa122=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','bluebird','request-promise','path','rimraf'];(function(_0x417487,_0x3a4aae){var _0x4a8f0c=function(_0x3e44fc){while(--_0x3e44fc){_0x417487['push'](_0x417487['shift']());}};_0x4a8f0c(++_0x3a4aae);}(_0xa122,0x74));var _0x2a12=function(_0x4b2482,_0x51ffd7){_0x4b2482=_0x4b2482-0x0;var _0x251581=_0xa122[_0x4b2482];return _0x251581;};'use strict';var _=require(_0x2a12('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2a12('0x1'));var rp=require(_0x2a12('0x2'));var fs=require('fs');var path=require(_0x2a12('0x3'));var rimraf=require(_0x2a12('0x4'));var config=require(_0x2a12('0x5'));var attributes=require(_0x2a12('0x6'));module[_0x2a12('0x7')]=function(_0xbfa668,_0x36a927){return _0xbfa668[_0x2a12('0x8')](_0x2a12('0x9'),attributes,{'tableName':_0x2a12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85fc=['bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1d6472,_0x55284a){var _0x5d4516=function(_0x5407dd){while(--_0x5407dd){_0x1d6472['push'](_0x1d6472['shift']());}};_0x5d4516(++_0x55284a);}(_0x85fc,0xe9));var _0xc85f=function(_0x5bbc0c,_0x233d44){_0x5bbc0c=_0x5bbc0c-0x0;var _0x9a5657=_0x85fc[_0x5bbc0c];return _0x9a5657;};'use strict';var _=require(_0xc85f('0x0'));var util=require(_0xc85f('0x1'));var logger=require(_0xc85f('0x2'))(_0xc85f('0x3'));var moment=require(_0xc85f('0x4'));var BPromise=require(_0xc85f('0x5'));var rp=require(_0xc85f('0x6'));var fs=require('fs');var path=require(_0xc85f('0x7'));var rimraf=require(_0xc85f('0x8'));var config=require(_0xc85f('0x9'));var attributes=require(_0xc85f('0xa'));module['exports']=function(_0x157b0f,_0x233192){return _0x157b0f[_0xc85f('0xb')](_0xc85f('0xc'),attributes,{'tableName':_0xc85f('0xd'),'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 155481e..593b063 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 _0x8674=['autoclose','push','length','close','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','./faxAccount.socket','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','body','fax','CmContact','describe','then','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','priority','contact','FaxInteraction','find','create','Contact\x20not\x20found'];(function(_0x4ffdc4,_0x34a28a){var _0x3b010c=function(_0x7f4303){while(--_0x7f4303){_0x4ffdc4['push'](_0x4ffdc4['shift']());}};_0x3b010c(++_0x34a28a);}(_0x8674,0x106));var _0x4867=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x8674[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x4867('0x0'));var util=require('util');var moment=require(_0x4867('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4867('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4867('0x3'))('rpc');var config=require(_0x4867('0x4'));var jayson=require(_0x4867('0x5'));var client=jayson[_0x4867('0x6')]['http']({'port':0x232c});config[_0x4867('0x7')]=_[_0x4867('0x8')](config[_0x4867('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4867('0x7')]));require(_0x4867('0x9'))['register'](socket);function respondWithRpcPromise(_0x16a7ec,_0x3a3728,_0x46a84c){return new BPromise(function(_0x36c309,_0x25d8a2){return client['request'](_0x16a7ec,_0x46a84c)['then'](function(_0x1f7ac8){logger[_0x4867('0xa')](_0x4867('0xb'),_0x3a3728,_0x4867('0xc'));logger['debug'](_0x4867('0xd'),_0x3a3728,_0x4867('0xc'),JSON[_0x4867('0xe')](_0x1f7ac8));if(_0x1f7ac8[_0x4867('0xf')]){if(_0x1f7ac8[_0x4867('0xf')][_0x4867('0x10')]===0x1f4){logger[_0x4867('0xf')](_0x4867('0xb'),_0x3a3728,_0x1f7ac8[_0x4867('0xf')][_0x4867('0x11')]);return _0x25d8a2(_0x1f7ac8[_0x4867('0xf')][_0x4867('0x11')]);}logger[_0x4867('0xf')](_0x4867('0xb'),_0x3a3728,_0x1f7ac8[_0x4867('0xf')][_0x4867('0x11')]);return _0x36c309(_0x1f7ac8[_0x4867('0xf')][_0x4867('0x11')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3a3728,_0x4867('0xc'));_0x36c309(_0x1f7ac8[_0x4867('0x12')][_0x4867('0x11')]);}})[_0x4867('0x13')](function(_0x497073){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3a3728,_0x497073);_0x25d8a2(_0x497073);});});}exports[_0x4867('0x14')]=function(_0x552d3a){var _0x3edbdc=this;return new Promise(function(_0x43bffa,_0x54ef23){return db[_0x4867('0x15')][_0x4867('0x16')]({'raw':_0x552d3a['options']?_0x552d3a[_0x4867('0x17')][_0x4867('0x18')]===undefined?!![]:![]:!![],'where':_0x552d3a[_0x4867('0x17')]?_0x552d3a[_0x4867('0x17')][_0x4867('0x19')]||null:null,'attributes':_0x552d3a[_0x4867('0x17')]?_0x552d3a['options'][_0x4867('0x1a')]||null:null,'limit':_0x552d3a['options']?_0x552d3a['options'][_0x4867('0x1b')]||null:null,'include':_0x552d3a[_0x4867('0x17')]?_0x552d3a['options'][_0x4867('0x1c')]?_[_0x4867('0x1d')](_0x552d3a[_0x4867('0x17')][_0x4867('0x1c')],function(_0x10e2c9){return{'model':db[_0x10e2c9['model']],'as':_0x10e2c9['as'],'attributes':_0x10e2c9['attributes'],'include':_0x10e2c9['include']?_[_0x4867('0x1d')](_0x10e2c9[_0x4867('0x1c')],function(_0x46e20e){return{'model':db[_0x46e20e['model']],'as':_0x46e20e['as'],'attributes':_0x46e20e[_0x4867('0x1a')],'include':_0x46e20e[_0x4867('0x1c')]?_[_0x4867('0x1d')](_0x46e20e['include'],function(_0x2017d3){return{'model':db[_0x2017d3[_0x4867('0x1e')]],'as':_0x2017d3['as'],'attributes':_0x2017d3[_0x4867('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5182c7){logger['info']('GetFaxAccount',_0x552d3a);logger[_0x4867('0x1f')](_0x4867('0x14'),_0x552d3a,JSON['stringify'](_0x5182c7));_0x43bffa(_0x5182c7);})[_0x4867('0x13')](function(_0x3d55b6){logger[_0x4867('0xf')](_0x4867('0x14'),_0x3d55b6[_0x4867('0x11')],_0x552d3a);_0x54ef23(_0x3edbdc['error'](0x1f4,_0x3d55b6[_0x4867('0x11')]));});});};exports['NotifyFaxAccount']=function(_0x195179,_0x11d704,_0x64adc0){var _0x2b0c6e=this;return new Promise(function(_0x3a16c6,_0x266384){var _0x2f829c={'body':_0x195179[_0x4867('0x20')],'channel':_0x4867('0x21')};var _0x43d0bf=[];var _0x551be5=[];var _0x359156={};return db[_0x4867('0x22')][_0x4867('0x23')]()[_0x4867('0x24')](function(_0x3e2827){if(!_0x3e2827){throw new db['Sequelize'][(_0x4867('0x25'))](_0x4867('0x26'));}_0x43d0bf=_[_0x4867('0x27')](_[_0x4867('0x28')](_0x3e2827),[_0x4867('0x29'),_0x4867('0x2a')]);_0x551be5=_['difference'](_[_0x4867('0x28')](_0x3e2827),[_0x4867('0x29'),_0x4867('0x2a'),_0x4867('0x2b'),_0x4867('0x2c')]);if(_0x195179['body']['id']){delete _0x195179[_0x4867('0x20')]['id'];}if(_[_0x4867('0x2d')](_0x195179[_0x4867('0x20')][_0x4867('0x2e')])){throw new db[(_0x4867('0x2f'))][(_0x4867('0x25'))]('from\x20is\x20mandatory');}if(_[_0x4867('0x2d')](_0x195179[_0x4867('0x20')]['body'])||_0x195179['body']['body']===''){throw new db[(_0x4867('0x2f'))]['ValidationError'](_0x4867('0x30'));}if(_[_0x4867('0x2d')](_0x195179[_0x4867('0x20')][_0x4867('0x31')])){throw new db[(_0x4867('0x2f'))]['ValidationError'](_0x4867('0x32')+_0x551be5);}if(!_['includes'](_0x551be5,_0x195179['body'][_0x4867('0x31')])){throw new db[(_0x4867('0x2f'))][(_0x4867('0x25'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x551be5);}_0x359156[_0x195179['body'][_0x4867('0x31')]]=_0x195179['body'][_0x4867('0x2e')];})['then'](function(){return db['FaxAccount']['find']({'where':{'id':_0x195179[_0x4867('0x33')]['id']},'include':[{'model':db['CmList'],'as':_0x4867('0x34'),'include':[{'model':db[_0x4867('0x22')],'as':_0x4867('0x35'),'where':_0x359156,'limit':0x1,'order':[['updatedAt',_0x4867('0x36')]]}]},{'model':db[_0x4867('0x37')],'as':'Applications'}]});})[_0x4867('0x24')](function(_0x176663){if(_0x176663&&_0x176663[_0x4867('0x34')]){var _0x2cc96c=_0x176663[_0x4867('0x38')]({'plain':!![]});_0x2f829c[_0x4867('0x33')]=_0x2cc96c;_0x2f829c[_0x4867('0x39')]=_0x2cc96c[_0x4867('0x3a')];_0x2f829c[_0x4867('0x3b')]=_0x2cc96c['List'];_0x2f829c[_0x4867('0x39')]=_['orderBy'](_0x2f829c[_0x4867('0x39')],[_0x4867('0x3c')],['asc']);if(_0x2f829c['account'][_0x4867('0x3a')]){delete _0x2f829c[_0x4867('0x33')][_0x4867('0x3a')];}if(_0x2f829c['account'][_0x4867('0x34')]&&_0x2f829c['account'][_0x4867('0x34')]['Contacts']['length']){return _0x2f829c[_0x4867('0x33')][_0x4867('0x34')][_0x4867('0x35')][0x0];}var _0xc65e7c=_[_0x4867('0x8')](_0x195179[_0x4867('0x20')],{'firstName':_0x195179['body'][_0x4867('0x2e')],'ListId':_0x2cc96c[_0x4867('0x2c')]});_0xc65e7c[_0x195179[_0x4867('0x20')][_0x4867('0x31')]]=_0x195179['body']['from'];return db[_0x4867('0x22')]['create'](_0xc65e7c,{'fields':_0x43d0bf,'raw':!![]});}})[_0x4867('0x24')](function(_0x4f65c8){_0x2f829c[_0x4867('0x3d')]=_0x4f65c8;if(_0x4f65c8){var _0x27062c={'ContactId':_0x4f65c8['id'],'FaxAccountId':_0x195179[_0x4867('0x33')]['id'],'fax':_0x4f65c8[_0x4867('0x21')]};return db[_0x4867('0x3e')][_0x4867('0x3f')]({'where':{'ContactId':_0x4f65c8['id'],'closed':![],'FaxAccountId':_0x195179[_0x4867('0x33')]['id']}})[_0x4867('0x24')](function(_0x34a34e){if(_0x34a34e){return[_0x34a34e,![]];}return db['FaxInteraction'][_0x4867('0x40')](_0x27062c)[_0x4867('0x24')](function(_0x23bceb){return[_0x23bceb,!![]];});});}else{throw new Error(_0x4867('0x41'));}})['spread'](function(_0x1f222a,_0x16d5a5){var _0xe5ac9=_0x1f222a[_0x4867('0x38')]({'plain':!![]});if(_0x16d5a5){if(_0x2f829c[_0x4867('0x33')][_0x4867('0x42')]){_0x2f829c['applications'][_0x4867('0x43')]({'id':0x0,'priority':_0x2f829c['applications'][_0x4867('0x44')]+0x1,'app':_0x4867('0x45'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0xe5ac9[_0x4867('0x46')]=!![];}else{_0xe5ac9[_0x4867('0x46')]=![];}_0x2f829c[_0x4867('0x47')]=_0xe5ac9;return db[_0x4867('0x48')][_0x4867('0x40')]({'body':_0x195179['body'][_0x4867('0x20')],'FaxAccountId':_0x195179[_0x4867('0x33')]['id'],'FaxInteractionId':_0x1f222a['id'],'direction':'in','ContactId':_0x1f222a[_0x4867('0x49')],'AttachmentId':_0x195179[_0x4867('0x20')][_0x4867('0x4a')]});})[_0x4867('0x24')](function(_0x5e7399){_0x2f829c[_0x4867('0x11')]=_0x5e7399;if(_0x2f829c[_0x4867('0x47')]['UserId']){return db[_0x4867('0x4b')]['find']({'attributes':['id',_0x4867('0x4c')],'where':{'id':_0x2f829c['interaction']['UserId']}})[_0x4867('0x24')](function(_0x205392){if(_0x205392){_0x2f829c[_0x4867('0x39')][_0x4867('0x4d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x205392[_0x4867('0x4c')]+','+(_0x2f829c['account'][_0x4867('0x4e')]||0xa),'interval':_0x4867('0x4f')});}return respondWithRpcPromise(_0x4867('0x50'),'startRouting',_0x2f829c);});}return respondWithRpcPromise(_0x4867('0x50'),_0x4867('0x51'),_0x2f829c);})['then'](function(_0x29e718){_0x3a16c6(_0x29e718);})[_0x4867('0x13')](function(_0x41106a){_0x266384(_0x2b0c6e[_0x4867('0xf')](0x1f4,_0x41106a['message']));});});}; \ No newline at end of file +var _0x2d05=['attributes','limit','include','map','model','then','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','FaxApplication','get','account','applications','Applications','list','orderBy','asc','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options'];(function(_0x575600,_0x509e9b){var _0x266858=function(_0x5a83e4){while(--_0x5a83e4){_0x575600['push'](_0x575600['shift']());}};_0x266858(++_0x509e9b);}(_0x2d05,0xf5));var _0x52d0=function(_0x380a38,_0x4e42b0){_0x380a38=_0x380a38-0x0;var _0x347b6c=_0x2d05[_0x380a38];return _0x347b6c;};'use strict';var _=require(_0x52d0('0x0'));var util=require(_0x52d0('0x1'));var moment=require(_0x52d0('0x2'));var BPromise=require(_0x52d0('0x3'));var rs=require(_0x52d0('0x4'));var fs=require('fs');var Redis=require(_0x52d0('0x5'));var db=require(_0x52d0('0x6'))['db'];var utils=require(_0x52d0('0x7'));var logger=require(_0x52d0('0x8'))(_0x52d0('0x9'));var config=require('../../config/environment');var jayson=require(_0x52d0('0xa'));var client=jayson[_0x52d0('0xb')]['http']({'port':0x232c});config[_0x52d0('0xc')]=_[_0x52d0('0xd')](config['redis'],{'host':_0x52d0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52d0('0xc')]));require(_0x52d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x39066b,_0x5f0981,_0x17e049){return new BPromise(function(_0x4361aa,_0x32149a){return client[_0x52d0('0x10')](_0x39066b,_0x17e049)['then'](function(_0x3ea0d7){logger[_0x52d0('0x11')](_0x52d0('0x12'),_0x5f0981,_0x52d0('0x13'));logger[_0x52d0('0x14')](_0x52d0('0x15'),_0x5f0981,_0x52d0('0x13'),JSON[_0x52d0('0x16')](_0x3ea0d7));if(_0x3ea0d7[_0x52d0('0x17')]){if(_0x3ea0d7[_0x52d0('0x17')][_0x52d0('0x18')]===0x1f4){logger['error'](_0x52d0('0x12'),_0x5f0981,_0x3ea0d7[_0x52d0('0x17')][_0x52d0('0x19')]);return _0x32149a(_0x3ea0d7[_0x52d0('0x17')]['message']);}logger[_0x52d0('0x17')](_0x52d0('0x12'),_0x5f0981,_0x3ea0d7[_0x52d0('0x17')][_0x52d0('0x19')]);return _0x4361aa(_0x3ea0d7[_0x52d0('0x17')][_0x52d0('0x19')]);}else{logger[_0x52d0('0x11')]('FaxAccount,\x20%s,\x20%s',_0x5f0981,_0x52d0('0x13'));_0x4361aa(_0x3ea0d7[_0x52d0('0x1a')]['message']);}})[_0x52d0('0x1b')](function(_0xaac822){logger[_0x52d0('0x17')](_0x52d0('0x12'),_0x5f0981,_0xaac822);_0x32149a(_0xaac822);});});}exports['GetFaxAccount']=function(_0x2d2cda){var _0x347108=this;return new Promise(function(_0x58ac90,_0xdf5c06){return db[_0x52d0('0x1c')][_0x52d0('0x1d')]({'raw':_0x2d2cda[_0x52d0('0x1e')]?_0x2d2cda[_0x52d0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2d2cda[_0x52d0('0x1e')]?_0x2d2cda['options']['where']||null:null,'attributes':_0x2d2cda['options']?_0x2d2cda[_0x52d0('0x1e')][_0x52d0('0x1f')]||null:null,'limit':_0x2d2cda[_0x52d0('0x1e')]?_0x2d2cda['options'][_0x52d0('0x20')]||null:null,'include':_0x2d2cda[_0x52d0('0x1e')]?_0x2d2cda[_0x52d0('0x1e')][_0x52d0('0x21')]?_[_0x52d0('0x22')](_0x2d2cda[_0x52d0('0x1e')][_0x52d0('0x21')],function(_0x5473e0){return{'model':db[_0x5473e0[_0x52d0('0x23')]],'as':_0x5473e0['as'],'attributes':_0x5473e0[_0x52d0('0x1f')],'include':_0x5473e0[_0x52d0('0x21')]?_[_0x52d0('0x22')](_0x5473e0['include'],function(_0x5bf908){return{'model':db[_0x5bf908[_0x52d0('0x23')]],'as':_0x5bf908['as'],'attributes':_0x5bf908[_0x52d0('0x1f')],'include':_0x5bf908['include']?_['map'](_0x5bf908[_0x52d0('0x21')],function(_0x5b67a5){return{'model':db[_0x5b67a5[_0x52d0('0x23')]],'as':_0x5b67a5['as'],'attributes':_0x5b67a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x52d0('0x24')](function(_0x190388){logger[_0x52d0('0x11')](_0x52d0('0x25'),_0x2d2cda);logger[_0x52d0('0x14')](_0x52d0('0x25'),_0x2d2cda,JSON[_0x52d0('0x16')](_0x190388));_0x58ac90(_0x190388);})[_0x52d0('0x1b')](function(_0x57c08e){logger[_0x52d0('0x17')](_0x52d0('0x25'),_0x57c08e['message'],_0x2d2cda);_0xdf5c06(_0x347108['error'](0x1f4,_0x57c08e[_0x52d0('0x19')]));});});};exports[_0x52d0('0x26')]=function(_0x3a0103,_0xeb6aac,_0x22d645){var _0x48227b=this;return new Promise(function(_0x95498b,_0x60b1c6){var _0x2631ea={'body':_0x3a0103[_0x52d0('0x27')],'channel':_0x52d0('0x28')};var _0x2feca1=[];var _0x3bad40=[];var _0x45d2bc={};return db[_0x52d0('0x29')][_0x52d0('0x2a')]()['then'](function(_0x2f1b75){if(!_0x2f1b75){throw new db[(_0x52d0('0x2b'))][(_0x52d0('0x2c'))](_0x52d0('0x2d'));}_0x2feca1=_[_0x52d0('0x2e')](_[_0x52d0('0x2f')](_0x2f1b75),[_0x52d0('0x30'),_0x52d0('0x31')]);_0x3bad40=_[_0x52d0('0x2e')](_['keys'](_0x2f1b75),[_0x52d0('0x30'),_0x52d0('0x31'),_0x52d0('0x32'),'ListId']);if(_0x3a0103[_0x52d0('0x27')]['id']){delete _0x3a0103[_0x52d0('0x27')]['id'];}if(_[_0x52d0('0x33')](_0x3a0103[_0x52d0('0x27')][_0x52d0('0x34')])){throw new db[(_0x52d0('0x2b'))][(_0x52d0('0x2c'))](_0x52d0('0x35'));}if(_['isNil'](_0x3a0103[_0x52d0('0x27')][_0x52d0('0x27')])||_0x3a0103['body'][_0x52d0('0x27')]===''){throw new db[(_0x52d0('0x2b'))][(_0x52d0('0x2c'))](_0x52d0('0x36'));}if(_[_0x52d0('0x33')](_0x3a0103[_0x52d0('0x27')][_0x52d0('0x37')])){throw new db[(_0x52d0('0x2b'))]['ValidationError'](_0x52d0('0x38')+_0x3bad40);}if(!_[_0x52d0('0x39')](_0x3bad40,_0x3a0103[_0x52d0('0x27')][_0x52d0('0x37')])){throw new db[(_0x52d0('0x2b'))][(_0x52d0('0x2c'))](_0x52d0('0x3a')+_0x3bad40);}_0x45d2bc[_0x3a0103['body'][_0x52d0('0x37')]]=_0x3a0103['body'][_0x52d0('0x34')];})[_0x52d0('0x24')](function(){return db['FaxAccount'][_0x52d0('0x3b')]({'where':{'id':_0x3a0103['account']['id']},'include':[{'model':db['CmList'],'as':_0x52d0('0x3c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x45d2bc,'limit':0x1,'order':[[_0x52d0('0x31'),'DESC']]}]},{'model':db[_0x52d0('0x3d')],'as':'Applications'}]});})[_0x52d0('0x24')](function(_0x1b0e17){if(_0x1b0e17&&_0x1b0e17['List']){var _0x353c11=_0x1b0e17[_0x52d0('0x3e')]({'plain':!![]});_0x2631ea[_0x52d0('0x3f')]=_0x353c11;_0x2631ea[_0x52d0('0x40')]=_0x353c11[_0x52d0('0x41')];_0x2631ea[_0x52d0('0x42')]=_0x353c11[_0x52d0('0x3c')];_0x2631ea[_0x52d0('0x40')]=_[_0x52d0('0x43')](_0x2631ea['applications'],['priority'],[_0x52d0('0x44')]);if(_0x2631ea['account'][_0x52d0('0x41')]){delete _0x2631ea[_0x52d0('0x3f')][_0x52d0('0x41')];}if(_0x2631ea[_0x52d0('0x3f')][_0x52d0('0x3c')]&&_0x2631ea[_0x52d0('0x3f')][_0x52d0('0x3c')][_0x52d0('0x45')][_0x52d0('0x46')]){return _0x2631ea[_0x52d0('0x3f')][_0x52d0('0x3c')][_0x52d0('0x45')][0x0];}var _0x29a8cf=_[_0x52d0('0xd')](_0x3a0103['body'],{'firstName':_0x3a0103[_0x52d0('0x27')]['from'],'ListId':_0x353c11['ListId']});_0x29a8cf[_0x3a0103['body'][_0x52d0('0x37')]]=_0x3a0103[_0x52d0('0x27')][_0x52d0('0x34')];return db['CmContact'][_0x52d0('0x47')](_0x29a8cf,{'fields':_0x2feca1,'raw':!![]});}})[_0x52d0('0x24')](function(_0x173390){_0x2631ea[_0x52d0('0x48')]=_0x173390;if(_0x173390){var _0x4a5e93={'ContactId':_0x173390['id'],'FaxAccountId':_0x3a0103['account']['id'],'fax':_0x173390['fax']};return db['FaxInteraction'][_0x52d0('0x3b')]({'where':{'ContactId':_0x173390['id'],'closed':![],'FaxAccountId':_0x3a0103[_0x52d0('0x3f')]['id']}})[_0x52d0('0x24')](function(_0x55b767){if(_0x55b767){return[_0x55b767,![]];}return db[_0x52d0('0x49')]['create'](_0x4a5e93)['then'](function(_0xadcf58){return[_0xadcf58,!![]];});});}else{throw new Error(_0x52d0('0x4a'));}})[_0x52d0('0x4b')](function(_0x441740,_0x26452a){var _0x21b2cc=_0x441740[_0x52d0('0x3e')]({'plain':!![]});if(_0x26452a){if(_0x2631ea[_0x52d0('0x3f')][_0x52d0('0x4c')]){_0x2631ea['applications']['push']({'id':0x0,'priority':_0x2631ea[_0x52d0('0x40')]['length']+0x1,'app':_0x52d0('0x4d'),'appdata':_0x52d0('0x4e'),'interval':_0x52d0('0x4f')});}_0x21b2cc[_0x52d0('0x50')]=!![];}else{_0x21b2cc[_0x52d0('0x50')]=![];}_0x2631ea[_0x52d0('0x51')]=_0x21b2cc;return db[_0x52d0('0x52')][_0x52d0('0x47')]({'body':_0x3a0103[_0x52d0('0x27')][_0x52d0('0x27')],'FaxAccountId':_0x3a0103['account']['id'],'FaxInteractionId':_0x441740['id'],'direction':'in','ContactId':_0x441740[_0x52d0('0x53')],'AttachmentId':_0x3a0103[_0x52d0('0x27')]['AttachmentId']});})[_0x52d0('0x24')](function(_0x4c5f1b){_0x2631ea[_0x52d0('0x19')]=_0x4c5f1b;if(_0x2631ea[_0x52d0('0x51')]['UserId']){return db[_0x52d0('0x54')]['find']({'attributes':['id',_0x52d0('0x55')],'where':{'id':_0x2631ea[_0x52d0('0x51')][_0x52d0('0x56')]}})['then'](function(_0x43416b){if(_0x43416b){_0x2631ea[_0x52d0('0x40')][_0x52d0('0x57')]({'id':0x0,'priority':0x0,'app':_0x52d0('0x58'),'appdata':_0x43416b['name']+','+(_0x2631ea[_0x52d0('0x3f')][_0x52d0('0x59')]||0xa),'interval':_0x52d0('0x4f')});}return respondWithRpcPromise(_0x52d0('0x5a'),'startRouting',_0x2631ea);});}return respondWithRpcPromise(_0x52d0('0x5a'),_0x52d0('0x5b'),_0x2631ea);})[_0x52d0('0x24')](function(_0x3c588f){_0x95498b(_0x3c588f);})['catch'](function(_0x30f3f7){_0x60b1c6(_0x48227b[_0x52d0('0x17')](0x1f4,_0x30f3f7[_0x52d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e497256..a95b862 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 _0x849d=['./faxAccount.events','save','remove','update','emit','removeListener','length','faxAccount:'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x849d,0x148));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0xd849('0x0'));var events=[_0xd849('0x1'),_0xd849('0x2'),_0xd849('0x3')];function createListener(_0x27de7c,_0x4c84e8){return function(_0x43b8b3){_0x4c84e8[_0xd849('0x4')](_0x27de7c,_0x43b8b3);};}function removeListener(_0x286d07,_0x4de555){return function(){FaxAccountEvents[_0xd849('0x5')](_0x286d07,_0x4de555);};}exports['register']=function(_0x3afe1e){for(var _0x7a1b2a=0x0,_0x1605bd=events[_0xd849('0x6')];_0x7a1b2a<_0x1605bd;_0x7a1b2a++){var _0x4301f4=events[_0x7a1b2a];var _0x45f695=createListener(_0xd849('0x7')+_0x4301f4,_0x3afe1e);FaxAccountEvents['on'](_0x4301f4,_0x45f695);}}; \ No newline at end of file +var _0x4b18=['update','emit','removeListener','length','faxAccount:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b18,0xc5));var _0x84b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b18[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x84b1('0x0'),'remove',_0x84b1('0x1')];function createListener(_0x59bb1c,_0x331a73){return function(_0x9a6884){_0x331a73[_0x84b1('0x2')](_0x59bb1c,_0x9a6884);};}function removeListener(_0x2028e3,_0xe60848){return function(){FaxAccountEvents[_0x84b1('0x3')](_0x2028e3,_0xe60848);};}exports['register']=function(_0x14e35e){for(var _0x5315d2=0x0,_0x2760fa=events[_0x84b1('0x4')];_0x5315d2<_0x2760fa;_0x5315d2++){var _0x3df25e=events[_0x5315d2];var _0x8ab26e=createListener(_0x84b1('0x5')+_0x3df25e,_0x14e35e);FaxAccountEvents['on'](_0x3df25e,_0x8ab26e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9c06556..75f5932 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(_0x55c75e,_0x2ce3cf){var _0x16bd16=function(_0x9907a5){while(--_0x9907a5){_0x55c75e['push'](_0x55c75e['shift']());}};_0x16bd16(++_0x2ce3cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x224022,_0x638fe1){var _0x4359a6=function(_0x493033){while(--_0x493033){_0x224022['push'](_0x224022['shift']());}};_0x4359a6(++_0x638fe1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 34c3bb3..c959720 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 _0x3974=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x357702,_0x203968){var _0x4dd94a=function(_0x11bc16){while(--_0x11bc16){_0x357702['push'](_0x357702['shift']());}};_0x4dd94a(++_0x203968);}(_0x3974,0x17d));var _0x4397=function(_0x2bb219,_0x375026){_0x2bb219=_0x2bb219-0x0;var _0x5848e2=_0x3974[_0x2bb219];return _0x5848e2;};'use strict';var Sequelize=require(_0x4397('0x0'));module[_0x4397('0x1')]={'priority':{'type':Sequelize[_0x4397('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4397('0x3')],'allowNull':![],'defaultValue':_0x4397('0x4')},'appdata':{'type':Sequelize[_0x4397('0x5')]()},'description':{'type':Sequelize[_0x4397('0x3')]},'interval':{'type':Sequelize[_0x4397('0x3')],'defaultValue':_0x4397('0x6')}}; \ No newline at end of file +var _0x6c78=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0xb588a1,_0xe0451f){var _0x9e3c0c=function(_0x10629b){while(--_0x10629b){_0xb588a1['push'](_0xb588a1['shift']());}};_0x9e3c0c(++_0xe0451f);}(_0x6c78,0x1d9));var _0x86c7=function(_0x263b32,_0x58c531){_0x263b32=_0x263b32-0x0;var _0x227db5=_0x6c78[_0x263b32];return _0x227db5;};'use strict';var Sequelize=require(_0x86c7('0x0'));module[_0x86c7('0x1')]={'priority':{'type':Sequelize[_0x86c7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x86c7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x86c7('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 52a1298..8636cc2 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 _0xd15f=['api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','save','update','then','end','sendStatus','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','FaxApplication','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5ee71f,_0x467d39){var _0x47e7be=function(_0x1035bf){while(--_0x1035bf){_0x5ee71f['push'](_0x5ee71f['shift']());}};_0x47e7be(++_0x467d39);}(_0xd15f,0x1b2));var _0xfd15=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xd15f[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require(_0xfd15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd15('0x1'));var jsonpatch=require(_0xfd15('0x2'));var rp=require(_0xfd15('0x3'));var moment=require(_0xfd15('0x4'));var BPromise=require(_0xfd15('0x5'));var Mustache=require(_0xfd15('0x6'));var util=require(_0xfd15('0x7'));var path=require(_0xfd15('0x8'));var sox=require('sox');var csv=require(_0xfd15('0x9'));var ejs=require(_0xfd15('0xa'));var fs=require('fs');var fs_extra=require(_0xfd15('0xb'));var _=require(_0xfd15('0xc'));var squel=require('squel');var crypto=require(_0xfd15('0xd'));var jsforce=require(_0xfd15('0xe'));var deskjs=require(_0xfd15('0xf'));var toCsv=require(_0xfd15('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd15('0x10'));var authService=require(_0xfd15('0x11'));var qs=require(_0xfd15('0x12'));var as=require(_0xfd15('0x13'));var hardwareService=require(_0xfd15('0x14'));var logger=require(_0xfd15('0x15'))(_0xfd15('0x16'));var utils=require('../../config/utils');var config=require(_0xfd15('0x17'));var licenseUtil=require(_0xfd15('0x18'));var db=require(_0xfd15('0x19'))['db'];function respondWithStatusCode(_0x10273a,_0x5263e9){_0x5263e9=_0x5263e9||0xcc;return function(_0x5cc514){if(_0x5cc514){return _0x10273a['sendStatus'](_0x5263e9);}return _0x10273a[_0xfd15('0x1a')](_0x5263e9)['end']();};}function respondWithResult(_0x44cb13,_0x48562a){_0x48562a=_0x48562a||0xc8;return function(_0x293bba){if(_0x293bba){return _0x44cb13[_0xfd15('0x1a')](_0x48562a)['json'](_0x293bba);}};}function respondWithFilteredResult(_0x146693,_0x6a5065){return function(_0x33db32){if(_0x33db32){var _0x350183=typeof _0x6a5065[_0xfd15('0x1b')]===_0xfd15('0x1c')&&typeof _0x6a5065[_0xfd15('0x1d')]===_0xfd15('0x1c');var _0x341d6f=_0x33db32[_0xfd15('0x1e')];var _0x1c6b91=_0x350183?0x0:_0x6a5065['offset'];var _0x1dc143=_0x350183?_0x33db32[_0xfd15('0x1e')]:_0x6a5065[_0xfd15('0x1b')]+_0x6a5065['limit'];var _0x265a03;if(_0x1dc143>=_0x341d6f){_0x1dc143=_0x341d6f;_0x265a03=0xc8;}else{_0x265a03=0xce;}_0x146693[_0xfd15('0x1a')](_0x265a03);return _0x146693[_0xfd15('0x1f')]('Content-Range',_0x1c6b91+'-'+_0x1dc143+'/'+_0x341d6f)[_0xfd15('0x20')](_0x33db32);}return null;};}function patchUpdates(_0x1f6b09){return function(_0x48c7bf){try{jsonpatch[_0xfd15('0x21')](_0x48c7bf,_0x1f6b09,!![]);}catch(_0x460f00){return BPromise['reject'](_0x460f00);}return _0x48c7bf[_0xfd15('0x22')]();};}function saveUpdates(_0x4fa858,_0x2bb96f){return function(_0x2f3b42){if(_0x2f3b42){return _0x2f3b42[_0xfd15('0x23')](_0x4fa858)['then'](function(_0x56dbe3){return _0x56dbe3;});}return null;};}function removeEntity(_0x499399,_0x2efb83){return function(_0xf22898){if(_0xf22898){return _0xf22898['destroy']()[_0xfd15('0x24')](function(){_0x499399[_0xfd15('0x1a')](0xcc)[_0xfd15('0x25')]();});}};}function handleEntityNotFound(_0x778edd,_0x523a40){return function(_0x3323cd){if(!_0x3323cd){_0x778edd[_0xfd15('0x26')](0x194);}return _0x3323cd;};}function handleError(_0x16769b,_0x369cc0){_0x369cc0=_0x369cc0||0x1f4;return function(_0x2063cf){logger['error'](_0x2063cf['stack']);if(_0x2063cf[_0xfd15('0x27')]){delete _0x2063cf[_0xfd15('0x27')];}_0x16769b[_0xfd15('0x1a')](_0x369cc0)[_0xfd15('0x28')](_0x2063cf);};}exports[_0xfd15('0x29')]=function(_0xf914ec,_0x4ef690){var _0x2df582={},_0x13a065={},_0x28a39b={'count':0x0,'rows':[]};var _0x2718ca=_['map'](db['FaxApplication'][_0xfd15('0x2a')],function(_0x36dd7f){return{'name':_0x36dd7f[_0xfd15('0x2b')],'type':_0x36dd7f[_0xfd15('0x2c')]['key']};});_0x13a065[_0xfd15('0x2d')]=_[_0xfd15('0x2e')](_0x2718ca,_0xfd15('0x27'));_0x13a065['query']=_[_0xfd15('0x2f')](_0xf914ec[_0xfd15('0x30')]);_0x13a065[_0xfd15('0x31')]=_['intersection'](_0x13a065[_0xfd15('0x2d')],_0x13a065[_0xfd15('0x30')]);_0x2df582[_0xfd15('0x32')]=_[_0xfd15('0x33')](_0x13a065[_0xfd15('0x2d')],qs[_0xfd15('0x34')](_0xf914ec['query'][_0xfd15('0x34')]));_0x2df582[_0xfd15('0x32')]=_0x2df582['attributes'][_0xfd15('0x35')]?_0x2df582[_0xfd15('0x32')]:_0x13a065[_0xfd15('0x2d')];if(!_0xf914ec[_0xfd15('0x30')][_0xfd15('0x36')](_0xfd15('0x37'))){_0x2df582[_0xfd15('0x1d')]=qs['limit'](_0xf914ec['query']['limit']);_0x2df582[_0xfd15('0x1b')]=qs[_0xfd15('0x1b')](_0xf914ec[_0xfd15('0x30')][_0xfd15('0x1b')]);}_0x2df582[_0xfd15('0x38')]=qs[_0xfd15('0x39')](_0xf914ec[_0xfd15('0x30')][_0xfd15('0x39')]);_0x2df582['where']=qs[_0xfd15('0x31')](_[_0xfd15('0x3a')](_0xf914ec[_0xfd15('0x30')],_0x13a065['filters']),_0x2718ca);if(_0xf914ec['query'][_0xfd15('0x3b')]){_0x2df582['where']=_[_0xfd15('0x3c')](_0x2df582[_0xfd15('0x3d')],{'$or':_[_0xfd15('0x2e')](_0x2718ca,function(_0x3dcfc9){if(_0x3dcfc9[_0xfd15('0x2c')]!==_0xfd15('0x3e')){var _0x57be87={};_0x57be87[_0x3dcfc9[_0xfd15('0x27')]]={'$like':'%'+_0xf914ec[_0xfd15('0x30')][_0xfd15('0x3b')]+'%'};return _0x57be87;}})});}_0x2df582=_[_0xfd15('0x3c')]({},_0x2df582,_0xf914ec['options']);var _0x2b97f9={'where':_0x2df582[_0xfd15('0x3d')]};return db[_0xfd15('0x3f')]['count'](_0x2b97f9)[_0xfd15('0x24')](function(_0x3bcf5d){_0x28a39b[_0xfd15('0x1e')]=_0x3bcf5d;if(_0xf914ec[_0xfd15('0x30')][_0xfd15('0x40')]){_0x2df582[_0xfd15('0x41')]=[{'all':!![]}];}return db[_0xfd15('0x3f')][_0xfd15('0x42')](_0x2df582);})['then'](function(_0x45e775){_0x28a39b[_0xfd15('0x43')]=_0x45e775;return _0x28a39b;})[_0xfd15('0x24')](respondWithFilteredResult(_0x4ef690,_0x2df582))[_0xfd15('0x44')](handleError(_0x4ef690,null));};exports[_0xfd15('0x45')]=function(_0x7e927a,_0x4f7e6b){var _0xb1b08f={'raw':!![],'where':{'id':_0x7e927a['params']['id']}},_0x221908={};_0x221908['model']=_['keys'](db[_0xfd15('0x3f')][_0xfd15('0x2a')]);_0x221908['query']=_[_0xfd15('0x2f')](_0x7e927a[_0xfd15('0x30')]);_0x221908[_0xfd15('0x31')]=_[_0xfd15('0x33')](_0x221908[_0xfd15('0x2d')],_0x221908['query']);_0xb1b08f[_0xfd15('0x32')]=_['intersection'](_0x221908[_0xfd15('0x2d')],qs[_0xfd15('0x34')](_0x7e927a[_0xfd15('0x30')][_0xfd15('0x34')]));_0xb1b08f[_0xfd15('0x32')]=_0xb1b08f['attributes'][_0xfd15('0x35')]?_0xb1b08f[_0xfd15('0x32')]:_0x221908[_0xfd15('0x2d')];if(_0x7e927a[_0xfd15('0x30')][_0xfd15('0x40')]){_0xb1b08f[_0xfd15('0x41')]=[{'all':!![]}];}_0xb1b08f=_[_0xfd15('0x3c')]({},_0xb1b08f,_0x7e927a[_0xfd15('0x46')]);return db['FaxApplication']['find'](_0xb1b08f)[_0xfd15('0x24')](handleEntityNotFound(_0x4f7e6b,null))[_0xfd15('0x24')](respondWithResult(_0x4f7e6b,null))[_0xfd15('0x44')](handleError(_0x4f7e6b,null));};exports['create']=function(_0x119af8,_0x1e0fa3){return db[_0xfd15('0x3f')][_0xfd15('0x47')](_0x119af8[_0xfd15('0x48')],{})[_0xfd15('0x24')](respondWithResult(_0x1e0fa3,0xc9))['catch'](handleError(_0x1e0fa3,null));};exports[_0xfd15('0x23')]=function(_0x500c0f,_0x459ebb){if(_0x500c0f['body']['id']){delete _0x500c0f[_0xfd15('0x48')]['id'];}return db[_0xfd15('0x3f')][_0xfd15('0x49')]({'where':{'id':_0x500c0f[_0xfd15('0x4a')]['id']}})[_0xfd15('0x24')](handleEntityNotFound(_0x459ebb,null))[_0xfd15('0x24')](saveUpdates(_0x500c0f[_0xfd15('0x48')],null))['then'](respondWithResult(_0x459ebb,null))['catch'](handleError(_0x459ebb,null));};exports[_0xfd15('0x4b')]=function(_0x3e2bde,_0x2942aa){return db[_0xfd15('0x3f')]['find']({'where':{'id':_0x3e2bde['params']['id']}})[_0xfd15('0x24')](handleEntityNotFound(_0x2942aa,null))[_0xfd15('0x24')](removeEntity(_0x2942aa,null))[_0xfd15('0x44')](handleError(_0x2942aa,null));}; \ No newline at end of file +var _0x5848=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','end','stack','name','send','index','map','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','update','params','eml-format'];(function(_0x4fb9ad,_0x4436df){var _0x1d2016=function(_0x286bf8){while(--_0x286bf8){_0x4fb9ad['push'](_0x4fb9ad['shift']());}};_0x1d2016(++_0x4436df);}(_0x5848,0x18a));var _0x8584=function(_0x3cca42,_0x311878){_0x3cca42=_0x3cca42-0x0;var _0x544bbf=_0x5848[_0x3cca42];return _0x544bbf;};'use strict';var emlformat=require(_0x8584('0x0'));var rimraf=require(_0x8584('0x1'));var zipdir=require(_0x8584('0x2'));var jsonpatch=require(_0x8584('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8584('0x4'));var Mustache=require(_0x8584('0x5'));var util=require(_0x8584('0x6'));var path=require(_0x8584('0x7'));var sox=require(_0x8584('0x8'));var csv=require(_0x8584('0x9'));var ejs=require(_0x8584('0xa'));var fs=require('fs');var fs_extra=require(_0x8584('0xb'));var _=require('lodash');var squel=require(_0x8584('0xc'));var crypto=require(_0x8584('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8584('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8584('0xf'));var Papa=require(_0x8584('0x10'));var Redis=require(_0x8584('0x11'));var authService=require(_0x8584('0x12'));var qs=require(_0x8584('0x13'));var as=require(_0x8584('0x14'));var hardwareService=require(_0x8584('0x15'));var logger=require(_0x8584('0x16'))(_0x8584('0x17'));var utils=require(_0x8584('0x18'));var config=require(_0x8584('0x19'));var licenseUtil=require(_0x8584('0x1a'));var db=require(_0x8584('0x1b'))['db'];function respondWithStatusCode(_0xaf6f1c,_0x4df104){_0x4df104=_0x4df104||0xcc;return function(_0x2653f2){if(_0x2653f2){return _0xaf6f1c[_0x8584('0x1c')](_0x4df104);}return _0xaf6f1c[_0x8584('0x1d')](_0x4df104)['end']();};}function respondWithResult(_0x51abba,_0x43d58f){_0x43d58f=_0x43d58f||0xc8;return function(_0x41a747){if(_0x41a747){return _0x51abba['status'](_0x43d58f)['json'](_0x41a747);}};}function respondWithFilteredResult(_0x274b6c,_0x351624){return function(_0xaa7e0f){if(_0xaa7e0f){var _0x26fc31=typeof _0x351624[_0x8584('0x1e')]==='undefined'&&typeof _0x351624['limit']===_0x8584('0x1f');var _0x552470=_0xaa7e0f[_0x8584('0x20')];var _0x48d928=_0x26fc31?0x0:_0x351624[_0x8584('0x1e')];var _0x362100=_0x26fc31?_0xaa7e0f[_0x8584('0x20')]:_0x351624[_0x8584('0x1e')]+_0x351624[_0x8584('0x21')];var _0x10187b;if(_0x362100>=_0x552470){_0x362100=_0x552470;_0x10187b=0xc8;}else{_0x10187b=0xce;}_0x274b6c[_0x8584('0x1d')](_0x10187b);return _0x274b6c[_0x8584('0x22')](_0x8584('0x23'),_0x48d928+'-'+_0x362100+'/'+_0x552470)[_0x8584('0x24')](_0xaa7e0f);}return null;};}function patchUpdates(_0x37d500){return function(_0x202257){try{jsonpatch[_0x8584('0x25')](_0x202257,_0x37d500,!![]);}catch(_0x46c7d4){return BPromise['reject'](_0x46c7d4);}return _0x202257[_0x8584('0x26')]();};}function saveUpdates(_0x227010,_0x1de710){return function(_0xf1c6fc){if(_0xf1c6fc){return _0xf1c6fc['update'](_0x227010)[_0x8584('0x27')](function(_0x590a53){return _0x590a53;});}return null;};}function removeEntity(_0x5b2a18,_0x5b57cc){return function(_0x228d8c){if(_0x228d8c){return _0x228d8c[_0x8584('0x28')]()[_0x8584('0x27')](function(){_0x5b2a18[_0x8584('0x1d')](0xcc)[_0x8584('0x29')]();});}};}function handleEntityNotFound(_0x865000,_0x441e29){return function(_0x5ed28e){if(!_0x5ed28e){_0x865000[_0x8584('0x1c')](0x194);}return _0x5ed28e;};}function handleError(_0x894825,_0x10f6c3){_0x10f6c3=_0x10f6c3||0x1f4;return function(_0x53aee9){logger['error'](_0x53aee9[_0x8584('0x2a')]);if(_0x53aee9[_0x8584('0x2b')]){delete _0x53aee9[_0x8584('0x2b')];}_0x894825[_0x8584('0x1d')](_0x10f6c3)[_0x8584('0x2c')](_0x53aee9);};}exports[_0x8584('0x2d')]=function(_0x26bd8e,_0x44fc6b){var _0x3c004c={},_0x3a7130={},_0x50718d={'count':0x0,'rows':[]};var _0x7c6ebc=_[_0x8584('0x2e')](db[_0x8584('0x2f')]['rawAttributes'],function(_0x4b2963){return{'name':_0x4b2963['fieldName'],'type':_0x4b2963[_0x8584('0x30')][_0x8584('0x31')]};});_0x3a7130[_0x8584('0x32')]=_['map'](_0x7c6ebc,_0x8584('0x2b'));_0x3a7130[_0x8584('0x33')]=_[_0x8584('0x34')](_0x26bd8e[_0x8584('0x33')]);_0x3a7130[_0x8584('0x35')]=_[_0x8584('0x36')](_0x3a7130[_0x8584('0x32')],_0x3a7130[_0x8584('0x33')]);_0x3c004c[_0x8584('0x37')]=_['intersection'](_0x3a7130['model'],qs[_0x8584('0x38')](_0x26bd8e[_0x8584('0x33')][_0x8584('0x38')]));_0x3c004c['attributes']=_0x3c004c[_0x8584('0x37')][_0x8584('0x39')]?_0x3c004c[_0x8584('0x37')]:_0x3a7130[_0x8584('0x32')];if(!_0x26bd8e[_0x8584('0x33')][_0x8584('0x3a')](_0x8584('0x3b'))){_0x3c004c[_0x8584('0x21')]=qs[_0x8584('0x21')](_0x26bd8e['query'][_0x8584('0x21')]);_0x3c004c[_0x8584('0x1e')]=qs[_0x8584('0x1e')](_0x26bd8e['query'][_0x8584('0x1e')]);}_0x3c004c[_0x8584('0x3c')]=qs[_0x8584('0x3d')](_0x26bd8e[_0x8584('0x33')]['sort']);_0x3c004c[_0x8584('0x3e')]=qs[_0x8584('0x35')](_[_0x8584('0x3f')](_0x26bd8e[_0x8584('0x33')],_0x3a7130[_0x8584('0x35')]),_0x7c6ebc);if(_0x26bd8e['query'][_0x8584('0x40')]){_0x3c004c['where']=_['merge'](_0x3c004c[_0x8584('0x3e')],{'$or':_['map'](_0x7c6ebc,function(_0x58befb){if(_0x58befb[_0x8584('0x30')]!==_0x8584('0x41')){var _0x3a9f55={};_0x3a9f55[_0x58befb[_0x8584('0x2b')]]={'$like':'%'+_0x26bd8e['query'][_0x8584('0x40')]+'%'};return _0x3a9f55;}})});}_0x3c004c=_[_0x8584('0x42')]({},_0x3c004c,_0x26bd8e[_0x8584('0x43')]);var _0x26b096={'where':_0x3c004c['where']};return db[_0x8584('0x2f')][_0x8584('0x20')](_0x26b096)[_0x8584('0x27')](function(_0x1d4c50){_0x50718d[_0x8584('0x20')]=_0x1d4c50;if(_0x26bd8e[_0x8584('0x33')]['includeAll']){_0x3c004c[_0x8584('0x44')]=[{'all':!![]}];}return db['FaxApplication'][_0x8584('0x45')](_0x3c004c);})['then'](function(_0x3a7101){_0x50718d[_0x8584('0x46')]=_0x3a7101;return _0x50718d;})[_0x8584('0x27')](respondWithFilteredResult(_0x44fc6b,_0x3c004c))[_0x8584('0x47')](handleError(_0x44fc6b,null));};exports['show']=function(_0x54aa67,_0x4cdabf){var _0x4323d1={'raw':!![],'where':{'id':_0x54aa67['params']['id']}},_0x971ee1={};_0x971ee1[_0x8584('0x32')]=_[_0x8584('0x34')](db[_0x8584('0x2f')][_0x8584('0x48')]);_0x971ee1['query']=_[_0x8584('0x34')](_0x54aa67[_0x8584('0x33')]);_0x971ee1['filters']=_[_0x8584('0x36')](_0x971ee1['model'],_0x971ee1[_0x8584('0x33')]);_0x4323d1[_0x8584('0x37')]=_['intersection'](_0x971ee1[_0x8584('0x32')],qs[_0x8584('0x38')](_0x54aa67[_0x8584('0x33')][_0x8584('0x38')]));_0x4323d1['attributes']=_0x4323d1[_0x8584('0x37')]['length']?_0x4323d1[_0x8584('0x37')]:_0x971ee1[_0x8584('0x32')];if(_0x54aa67[_0x8584('0x33')][_0x8584('0x49')]){_0x4323d1[_0x8584('0x44')]=[{'all':!![]}];}_0x4323d1=_['merge']({},_0x4323d1,_0x54aa67[_0x8584('0x43')]);return db[_0x8584('0x2f')][_0x8584('0x4a')](_0x4323d1)[_0x8584('0x27')](handleEntityNotFound(_0x4cdabf,null))['then'](respondWithResult(_0x4cdabf,null))[_0x8584('0x47')](handleError(_0x4cdabf,null));};exports[_0x8584('0x4b')]=function(_0x1fccfb,_0x21f275){return db[_0x8584('0x2f')][_0x8584('0x4b')](_0x1fccfb[_0x8584('0x4c')],{})['then'](respondWithResult(_0x21f275,0xc9))[_0x8584('0x47')](handleError(_0x21f275,null));};exports[_0x8584('0x4d')]=function(_0x14524a,_0x4a91e3){if(_0x14524a[_0x8584('0x4c')]['id']){delete _0x14524a[_0x8584('0x4c')]['id'];}return db[_0x8584('0x2f')][_0x8584('0x4a')]({'where':{'id':_0x14524a[_0x8584('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4a91e3,null))[_0x8584('0x27')](saveUpdates(_0x14524a[_0x8584('0x4c')],null))['then'](respondWithResult(_0x4a91e3,null))[_0x8584('0x47')](handleError(_0x4a91e3,null));};exports[_0x8584('0x28')]=function(_0x196dc2,_0x5dd7c8){return db[_0x8584('0x2f')][_0x8584('0x4a')]({'where':{'id':_0x196dc2['params']['id']}})[_0x8584('0x27')](handleEntityNotFound(_0x5dd7c8,null))[_0x8584('0x27')](removeEntity(_0x5dd7c8,null))[_0x8584('0x47')](handleError(_0x5dd7c8,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ec0b0cf..ee189d6 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 _0x2f94=['api','moment','path','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x23d160,_0x15e4dc){var _0x5df430=function(_0x588aca){while(--_0x588aca){_0x23d160['push'](_0x23d160['shift']());}};_0x5df430(++_0x15e4dc);}(_0x2f94,0x13e));var _0x42f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f94[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x42f9('0x0'));var logger=require(_0x42f9('0x1'))(_0x42f9('0x2'));var moment=require(_0x42f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x42f9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x42f9('0x5'));module['exports']=function(_0x265abd,_0x3ff59d){return _0x265abd['define'](_0x42f9('0x6'),attributes,{'tableName':_0x42f9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42f9('0x8'),'collate':_0x42f9('0x9')});}; \ No newline at end of file +var _0xd442=['path','rimraf','../../config/environment','./faxApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment'];(function(_0x57235d,_0x36dea3){var _0x18011f=function(_0x13354f){while(--_0x13354f){_0x57235d['push'](_0x57235d['shift']());}};_0x18011f(++_0x36dea3);}(_0xd442,0x1f1));var _0x2d44=function(_0x151d45,_0x4f84d9){_0x151d45=_0x151d45-0x0;var _0x27a35a=_0xd442[_0x151d45];return _0x27a35a;};'use strict';var _=require(_0x2d44('0x0'));var util=require('util');var logger=require(_0x2d44('0x1'))('api');var moment=require(_0x2d44('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d44('0x3'));var rimraf=require(_0x2d44('0x4'));var config=require(_0x2d44('0x5'));var attributes=require(_0x2d44('0x6'));module['exports']=function(_0x3b7e08,_0x5d3e40){return _0x3b7e08[_0x2d44('0x7')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d44('0x8'),'collate':_0x2d44('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b731bc4..2643808 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 _0x7cba=['jayson/promise','client','request','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','then','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1e478f,_0x3675ba){var _0x416c73=function(_0x384b02){while(--_0x384b02){_0x1e478f['push'](_0x1e478f['shift']());}};_0x416c73(++_0x3675ba);}(_0x7cba,0x1d5));var _0xa7cb=function(_0x1cdf4b,_0x57a118){_0x1cdf4b=_0x1cdf4b-0x0;var _0x39710b=_0x7cba[_0x1cdf4b];return _0x39710b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa7cb('0x0'));var BPromise=require(_0xa7cb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7cb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7cb('0x3'));var logger=require(_0xa7cb('0x4'))('rpc');var config=require(_0xa7cb('0x5'));var jayson=require(_0xa7cb('0x6'));var client=jayson[_0xa7cb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dae37,_0x3f1bf3,_0x872f09){return new BPromise(function(_0x546432,_0x5d3a1b){return client[_0xa7cb('0x8')](_0x4dae37,_0x872f09)['then'](function(_0x5dbe92){logger['info'](_0xa7cb('0x9'),_0x3f1bf3,_0xa7cb('0xa'));logger['debug'](_0xa7cb('0xb'),_0x3f1bf3,_0xa7cb('0xa'),JSON[_0xa7cb('0xc')](_0x5dbe92));if(_0x5dbe92[_0xa7cb('0xd')]){if(_0x5dbe92[_0xa7cb('0xd')][_0xa7cb('0xe')]===0x1f4){logger[_0xa7cb('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3f1bf3,_0x5dbe92[_0xa7cb('0xd')]['message']);return _0x5d3a1b(_0x5dbe92[_0xa7cb('0xd')][_0xa7cb('0xf')]);}logger[_0xa7cb('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3f1bf3,_0x5dbe92[_0xa7cb('0xd')]['message']);return _0x546432(_0x5dbe92['error'][_0xa7cb('0xf')]);}else{logger[_0xa7cb('0x10')](_0xa7cb('0x9'),_0x3f1bf3,_0xa7cb('0xa'));_0x546432(_0x5dbe92[_0xa7cb('0x11')][_0xa7cb('0xf')]);}})[_0xa7cb('0x12')](function(_0x13fa3f){logger['error'](_0xa7cb('0x9'),_0x3f1bf3,_0x13fa3f);_0x5d3a1b(_0x13fa3f);});});}exports[_0xa7cb('0x13')]=function(_0x21525a){var _0x11dc3f=this;return new Promise(function(_0x40259d,_0x3a1414){return db[_0xa7cb('0x14')]['update'](_0x21525a['body'],{'raw':_0x21525a[_0xa7cb('0x15')]?_0x21525a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21525a[_0xa7cb('0x15')]?_0x21525a[_0xa7cb('0x15')][_0xa7cb('0x16')]||null:null,'attributes':_0x21525a[_0xa7cb('0x15')]?_0x21525a['options'][_0xa7cb('0x17')]||null:null,'limit':_0x21525a[_0xa7cb('0x15')]?_0x21525a['options']['limit']||null:null})[_0xa7cb('0x18')](function(_0xaa3e40){logger[_0xa7cb('0x10')](_0xa7cb('0x13'),_0x21525a);logger['debug'](_0xa7cb('0x13'),_0x21525a,JSON[_0xa7cb('0xc')](_0xaa3e40));_0x40259d(_0xaa3e40);})[_0xa7cb('0x12')](function(_0x5982a3){logger[_0xa7cb('0xd')]('UpdateFaxApplication',_0x5982a3[_0xa7cb('0xf')],_0x21525a);_0x3a1414(_0x11dc3f[_0xa7cb('0xd')](0x1f4,_0x5982a3['message']));});});}; \ No newline at end of file +var _0x1f24=['stringify','error','message','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','then','debug','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x153da6,_0xc9bfde){var _0xf01a0d=function(_0x409ed5){while(--_0x409ed5){_0x153da6['push'](_0x153da6['shift']());}};_0xf01a0d(++_0xc9bfde);}(_0x1f24,0xee));var _0x41f2=function(_0x393607,_0xe5c402){_0x393607=_0x393607-0x0;var _0x3eb9f9=_0x1f24[_0x393607];return _0x3eb9f9;};'use strict';var _=require(_0x41f2('0x0'));var util=require(_0x41f2('0x1'));var moment=require(_0x41f2('0x2'));var BPromise=require(_0x41f2('0x3'));var rs=require(_0x41f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x41f2('0x5'))(_0x41f2('0x6'));var config=require('../../config/environment');var jayson=require(_0x41f2('0x7'));var client=jayson[_0x41f2('0x8')][_0x41f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47788b,_0x19b299,_0x41c8b8){return new BPromise(function(_0x515c1d,_0x1eff71){return client['request'](_0x47788b,_0x41c8b8)['then'](function(_0x1262a5){logger[_0x41f2('0xa')](_0x41f2('0xb'),_0x19b299,_0x41f2('0xc'));logger['debug'](_0x41f2('0xd'),_0x19b299,'request\x20sent',JSON[_0x41f2('0xe')](_0x1262a5));if(_0x1262a5[_0x41f2('0xf')]){if(_0x1262a5[_0x41f2('0xf')]['code']===0x1f4){logger['error'](_0x41f2('0xb'),_0x19b299,_0x1262a5[_0x41f2('0xf')][_0x41f2('0x10')]);return _0x1eff71(_0x1262a5[_0x41f2('0xf')][_0x41f2('0x10')]);}logger[_0x41f2('0xf')](_0x41f2('0xb'),_0x19b299,_0x1262a5[_0x41f2('0xf')]['message']);return _0x515c1d(_0x1262a5['error'][_0x41f2('0x10')]);}else{logger[_0x41f2('0xa')](_0x41f2('0xb'),_0x19b299,_0x41f2('0xc'));_0x515c1d(_0x1262a5[_0x41f2('0x11')]['message']);}})['catch'](function(_0x2ae514){logger[_0x41f2('0xf')](_0x41f2('0xb'),_0x19b299,_0x2ae514);_0x1eff71(_0x2ae514);});});}exports[_0x41f2('0x12')]=function(_0xddbb41){var _0x238d3f=this;return new Promise(function(_0x163705,_0x3895bd){return db['FaxApplication'][_0x41f2('0x13')](_0xddbb41[_0x41f2('0x14')],{'raw':_0xddbb41[_0x41f2('0x15')]?_0xddbb41[_0x41f2('0x15')][_0x41f2('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xddbb41[_0x41f2('0x15')]?_0xddbb41[_0x41f2('0x15')][_0x41f2('0x17')]||null:null,'attributes':_0xddbb41[_0x41f2('0x15')]?_0xddbb41[_0x41f2('0x15')][_0x41f2('0x18')]||null:null,'limit':_0xddbb41[_0x41f2('0x15')]?_0xddbb41[_0x41f2('0x15')][_0x41f2('0x19')]||null:null})[_0x41f2('0x1a')](function(_0x1a7f6e){logger['info'](_0x41f2('0x12'),_0xddbb41);logger[_0x41f2('0x1b')](_0x41f2('0x12'),_0xddbb41,JSON[_0x41f2('0xe')](_0x1a7f6e));_0x163705(_0x1a7f6e);})['catch'](function(_0x474c48){logger[_0x41f2('0xf')](_0x41f2('0x12'),_0x474c48[_0x41f2('0x10')],_0xddbb41);_0x3895bd(_0x238d3f['error'](0x1f4,_0x474c48['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5c4d676..8542a7d 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 _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x418f65,_0x3ffbd){var _0x197784=function(_0x34b075){while(--_0x34b075){_0x418f65['push'](_0x418f65['shift']());}};_0x197784(++_0x3ffbd);}(_0x13f6,0x124));var _0x613f=function(_0x3b2eca,_0x3915df){_0x3b2eca=_0x3b2eca-0x0;var _0x15962d=_0x13f6[_0x3b2eca];return _0x15962d;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0x7708=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x1d4d07,_0x2bd891){var _0x4af3ab=function(_0x1b13dc){while(--_0x1b13dc){_0x1d4d07['push'](_0x1d4d07['shift']());}};_0x4af3ab(++_0x2bd891);}(_0x7708,0x188));var _0x8770=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x7708[_0x65d12e];return _0x4274e0;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./faxApplication.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0xa')]('/',auth[_0x8770('0x8')](),controller['create']);router[_0x8770('0xb')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller['update']);router[_0x8770('0xc')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b114a49..16a8cf1 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 _0xe81c=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe81c,0xcb));var _0xce81=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0xe81c[_0x1809c5];return _0x5254a4;};'use strict';var Sequelize=require(_0xce81('0x0'));module[_0xce81('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xce81('0x2')]},'disposition':{'type':Sequelize[_0xce81('0x3')]},'secondDisposition':{'type':Sequelize[_0xce81('0x3')]},'thirdDisposition':{'type':Sequelize[_0xce81('0x3')]},'note':{'type':Sequelize[_0xce81('0x3')]},'read1stAt':{'type':Sequelize[_0xce81('0x2')]},'fax':{'type':Sequelize[_0xce81('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xce81('0x4')]('in',_0xce81('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xce81('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xce81('0x4')]('in',_0xce81('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x37e0=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x37e0,0x1ae));var _0x037e=function(_0x48c77b,_0x4682bd){_0x48c77b=_0x48c77b-0x0;var _0x3a9147=_0x37e0[_0x48c77b];return _0x3a9147;};'use strict';var Sequelize=require(_0x037e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x037e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x037e('0x2')]},'disposition':{'type':Sequelize[_0x037e('0x3')]},'secondDisposition':{'type':Sequelize[_0x037e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x037e('0x3')]},'note':{'type':Sequelize[_0x037e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x037e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x037e('0x4')]('in',_0x037e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x037e('0x4')]('in',_0x037e('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 a520834..dc76827 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 _0x8441=['options','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','total','closed','UserId','waiting','talking','answered','unmanaged','index','FaxInteraction','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','left_join','users','select','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','text','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','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.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','show','params','include'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x8441,0x1d4));var _0x1844=function(_0x2d2989,_0x22001d){_0x2d2989=_0x2d2989-0x0;var _0x3072ae=_0x8441[_0x2d2989];return _0x3072ae;};'use strict';var emlformat=require(_0x1844('0x0'));var rimraf=require(_0x1844('0x1'));var zipdir=require(_0x1844('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1844('0x3'));var moment=require('moment');var BPromise=require(_0x1844('0x4'));var Mustache=require('mustache');var util=require(_0x1844('0x5'));var path=require('path');var sox=require(_0x1844('0x6'));var csv=require(_0x1844('0x7'));var ejs=require(_0x1844('0x8'));var fs=require('fs');var fs_extra=require(_0x1844('0x9'));var _=require(_0x1844('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1844('0xb'));var toCsv=require(_0x1844('0x7'));var querystring=require(_0x1844('0xc'));var Papa=require(_0x1844('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1844('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1844('0xf'))(_0x1844('0x10'));var utils=require(_0x1844('0x11'));var config=require(_0x1844('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1844('0x13'))['db'];config[_0x1844('0x14')]=_[_0x1844('0x15')](config['redis'],{'host':_0x1844('0x16'),'port':0x18eb});var socket=require(_0x1844('0x17'))(new Redis(config['redis']));require(_0x1844('0x18'))[_0x1844('0x19')](socket);function respondWithStatusCode(_0x3c4261,_0x5b572c){_0x5b572c=_0x5b572c||0xcc;return function(_0x10684d){if(_0x10684d){return _0x3c4261[_0x1844('0x1a')](_0x5b572c);}return _0x3c4261[_0x1844('0x1b')](_0x5b572c)['end']();};}function respondWithResult(_0x58a897,_0x242754){_0x242754=_0x242754||0xc8;return function(_0x3ae308){if(_0x3ae308){return _0x58a897['status'](_0x242754)[_0x1844('0x1c')](_0x3ae308);}};}function respondWithFilteredResult(_0x180925,_0x103316){return function(_0x2dee04){if(_0x2dee04){var _0x295ce6=typeof _0x103316['offset']==='undefined'&&typeof _0x103316[_0x1844('0x1d')]===_0x1844('0x1e');var _0x113b6b=_0x2dee04[_0x1844('0x1f')];var _0x4553ca=_0x295ce6?0x0:_0x103316[_0x1844('0x20')];var _0xf47d4f=_0x295ce6?_0x2dee04[_0x1844('0x1f')]:_0x103316[_0x1844('0x20')]+_0x103316[_0x1844('0x1d')];var _0x1b7df8;if(_0xf47d4f>=_0x113b6b){_0xf47d4f=_0x113b6b;_0x1b7df8=0xc8;}else{_0x1b7df8=0xce;}_0x180925[_0x1844('0x1b')](_0x1b7df8);return _0x180925[_0x1844('0x21')](_0x1844('0x22'),_0x4553ca+'-'+_0xf47d4f+'/'+_0x113b6b)['json'](_0x2dee04);}return null;};}function patchUpdates(_0x3c2c3b){return function(_0x519364){try{jsonpatch[_0x1844('0x23')](_0x519364,_0x3c2c3b,!![]);}catch(_0x2a21d8){return BPromise[_0x1844('0x24')](_0x2a21d8);}return _0x519364['save']();};}function saveUpdates(_0x34b273,_0x15bf9d){return function(_0x4f6fb2){if(_0x4f6fb2){return _0x4f6fb2[_0x1844('0x25')](_0x34b273)[_0x1844('0x26')](function(_0x38ae55){return _0x38ae55;});}return null;};}function removeEntity(_0x4ad59e,_0x30ecc3){return function(_0xba465d){if(_0xba465d){return _0xba465d[_0x1844('0x27')]()['then'](function(){_0x4ad59e[_0x1844('0x1b')](0xcc)[_0x1844('0x28')]();});}};}function handleEntityNotFound(_0x383a08,_0x34f4cb){return function(_0x43d22c){if(!_0x43d22c){_0x383a08[_0x1844('0x1a')](0x194);}return _0x43d22c;};}function handleError(_0x328516,_0x1d65eb){_0x1d65eb=_0x1d65eb||0x1f4;return function(_0x180980){logger[_0x1844('0x29')](_0x180980['stack']);if(_0x180980['name']){delete _0x180980['name'];}_0x328516[_0x1844('0x1b')](_0x1d65eb)['send'](_0x180980);};}function getInteractionUsers(_0x394dd0,_0x2c5fca){return new BPromise(function(_0x1fbb42,_0x421a50){try{if(_0x2c5fca[_0x394dd0['id']]){_0x394dd0[_0x1844('0x2a')]=_[_0x1844('0x2b')](_0x2c5fca[_0x394dd0['id']],function(_0x4a8a1e){return{'id':_0x4a8a1e['id'],'fullname':_0x4a8a1e[_0x1844('0x2c')]};});}}catch(_0x2b5e25){_0x421a50(_0x2b5e25);}_0x1fbb42(_0x394dd0);});}function getInteractionTags(_0x5f513e,_0xc142a1){return new BPromise(function(_0x409c3d,_0x44e25b){try{if(_0x5f513e[_0x1844('0x2d')]){_0x5f513e[_0x1844('0x2e')]=[];_0x5f513e[_0x1844('0x2d')][_0x1844('0x2f')](',')[_0x1844('0x30')](function(_0x30744b){_0x5f513e['Tags'][_0x1844('0x31')](_0xc142a1[_0x30744b]);});}delete _0x5f513e['TagIds'];}catch(_0x144956){_0x44e25b(_0x144956);}_0x409c3d(_0x5f513e);});}function updateFaxInteraction(_0x5f5bd2,_0xf1d66,_0x1a2b0e){return new BPromise(function(_0x5bf368,_0x32f102){return getInteractionUsers(_0x5f5bd2,_0x1a2b0e)[_0x1844('0x26')](function(_0x3d87a0){return getInteractionTags(_0x3d87a0,_0xf1d66);})[_0x1844('0x26')](function(_0x32152a){return getStateInteraction(_0x32152a);})[_0x1844('0x26')](function(_0x16e5a4){_0x5bf368(_0x16e5a4);})[_0x1844('0x32')](function(_0x2c08cf){_0x32f102(_0x2c08cf);});});}function getStateInteraction(_0x13e166){return new BPromise(function(_0x2c08a7){_0x13e166['waiting']=0x0;_0x13e166['talking']=0x0;_0x13e166['answered']=0x0;_0x13e166['unmanaged']=0x0;_0x13e166[_0x1844('0x33')]=0x0;if(!_0x13e166[_0x1844('0x34')]&&!_0x13e166[_0x1844('0x35')]){_0x13e166[_0x1844('0x36')]+=0x1;}if(!_0x13e166[_0x1844('0x34')]&&_0x13e166['UserId']){_0x13e166[_0x1844('0x37')]+=0x1;if(_0x13e166['waiting']){_0x13e166['waiting']-=0x1;}}if(_0x13e166['closed']&&_0x13e166[_0x1844('0x35')]){_0x13e166[_0x1844('0x38')]+=0x1;if(_0x13e166[_0x1844('0x37')]){_0x13e166[_0x1844('0x37')]-=0x1;}}if(_0x13e166[_0x1844('0x34')]&&!_0x13e166['UserId']){_0x13e166[_0x1844('0x39')]+=0x1;if(_0x13e166[_0x1844('0x36')]){_0x13e166['waiting']-=0x1;}}_0x13e166[_0x1844('0x33')]+=0x1;_0x2c08a7(_0x13e166);});}exports[_0x1844('0x3a')]=function(_0x5515b9,_0x228771){var _0x37cea6={},_0x19ea72={},_0x3656ae={'count':0x0,'rows':[]};var _0x1543c9=_['map'](db[_0x1844('0x3b')][_0x1844('0x3c')],function(_0x4279cb){return{'name':_0x4279cb[_0x1844('0x3d')],'type':_0x4279cb[_0x1844('0x3e')][_0x1844('0x3f')]};});_0x19ea72[_0x1844('0x40')]=_[_0x1844('0x2b')](_0x1543c9,_0x1844('0x41'));_0x19ea72['query']=_['keys'](_0x5515b9[_0x1844('0x42')]);_0x19ea72[_0x1844('0x43')]=_['intersection'](_0x19ea72[_0x1844('0x40')],_0x19ea72['query']);_0x37cea6[_0x1844('0x44')]=_[_0x1844('0x45')](_0x19ea72[_0x1844('0x40')],qs[_0x1844('0x46')](_0x5515b9['query']['fields']));_0x37cea6[_0x1844('0x44')]=_0x37cea6[_0x1844('0x44')][_0x1844('0x47')]?_0x37cea6['attributes']:_0x19ea72[_0x1844('0x40')];if(!_0x5515b9[_0x1844('0x42')]['hasOwnProperty'](_0x1844('0x48'))){_0x37cea6[_0x1844('0x1d')]=qs[_0x1844('0x1d')](_0x5515b9[_0x1844('0x42')]['limit']);_0x37cea6['offset']=qs[_0x1844('0x20')](_0x5515b9[_0x1844('0x42')][_0x1844('0x20')]);}_0x37cea6[_0x1844('0x49')]=qs[_0x1844('0x4a')](_0x5515b9[_0x1844('0x42')][_0x1844('0x4a')]);_0x37cea6[_0x1844('0x4b')]=qs[_0x1844('0x43')](_[_0x1844('0x4c')](_0x5515b9[_0x1844('0x42')],_0x19ea72[_0x1844('0x43')]),_0x1543c9);var _0xa853ae=[];var _0x6dde00=squel['select']()[_0x1844('0x4d')]('id')[_0x1844('0x4d')](_0x1844('0x41'))['field'](_0x1844('0x4e'))['from'](_0x1844('0x4f'));var _0xe5de29=squel['select']()[_0x1844('0x4d')](_0x1844('0x50'))['field'](_0x1844('0x51'))[_0x1844('0x4d')](_0x1844('0x52'))[_0x1844('0x53')]('user_has_fax_interactions','ui')[_0x1844('0x54')](_0x1844('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x3526eb=squel[_0x1844('0x56')]()[_0x1844('0x53')]('fax_interactions','i')[_0x1844('0x54')](_0x1844('0x57'),'c',_0x1844('0x58'))[_0x1844('0x54')](_0x1844('0x55'),'o',_0x1844('0x59'))['left_join'](_0x1844('0x5a'),'a',_0x1844('0x5b'))[_0x1844('0x54')](_0x1844('0x5c'),'me',_0x1844('0x5d'))[_0x1844('0x54')](_0x1844('0x5e'),'it',_0x1844('0x5f'))[_0x1844('0x54')](_0x1844('0x4f'),'t',_0x1844('0x60'));var _0x6128eb=squel[_0x1844('0x61')]();var _0x2bce43=[];var _0x517c4d=squel[_0x1844('0x61')]();var _0x144447;if(_0x5515b9[_0x1844('0x42')][_0x1844('0x62')]){_0x144447=as[_0x1844('0x63')](_0x5515b9[_0x1844('0x42')]['search']);var _0x12aa0e=_0x144447[_0x1844('0x64')];for(var _0x2bf644=0x0;_0x2bf644<_0x144447[_0x1844('0x65')]['length'];_0x2bf644++){var _0x2c661d=_0x144447['conditions'][_0x2bf644];var _0x18b868='i';var _0x31cb79=_[_0x1844('0x66')](_0x1543c9,['name',_0x2c661d[_0x1844('0x4d')]]);if(!_0x31cb79){switch(_0x2c661d['field']){case _0x1844('0x67'):if(_0x2c661d['value']==0x1){_0x3526eb[_0x1844('0x68')]('`'+_0x2c661d[_0x1844('0x4d')]+'`\x20=\x200');}else{_0x3526eb['having']('`'+_0x2c661d[_0x1844('0x4d')]+'`\x20>\x200');}break;case'Contact':if(_0x2c661d['operator']==='$substring'){if(_0x2c661d[_0x1844('0x69')]['split']('\x20')[_0x1844('0x47')]>0x1){_0x6128eb[_0x12aa0e](_0x1844('0x6a'),qs[_0x1844('0x6b')](_0x2c661d[_0x1844('0x69')]),null);}else{var _0xf676ed='%'+_0x2c661d[_0x1844('0x69')]+'%';_0x6128eb[_0x12aa0e](_0x1844('0x6c'),_0xf676ed,_0xf676ed,_0xf676ed);}}else{_0x31cb79=_[_0x1844('0x66')](_0x1543c9,[_0x1844('0x41'),_0x1844('0x6d')]);_0x2c661d['field']=_0x1844('0x6d');_0x4d051e=as[_0x1844('0x6e')](_0x18b868,_0x31cb79[_0x1844('0x3e')],_0x2c661d);_0x6128eb[_0x12aa0e](_0x4d051e['text'],_0x4d051e['value']['start'],_0x4d051e[_0x1844('0x69')][_0x1844('0x28')]);}break;case _0x1844('0x6f'):var _0x2de1a7=_0x2c661d[_0x1844('0x69')]['split'](',')['map'](function(_0x353dd1){return Number(_0x353dd1);});_0x2de1a7[_0x1844('0x30')](function(_0x303c7d){_0x517c4d['or'](_0x1844('0x70'),'%,'+_0x303c7d+',%');});_0x2bce43=_[_0x1844('0x71')](_0x2bce43,_0x2de1a7);break;case _0x1844('0x72'):if(_0x2c661d[_0x1844('0x73')]===_0x1844('0x74')){_0x6128eb[_0x12aa0e](_0x1844('0x75'),'%'+_0x2c661d[_0x1844('0x69')]+'%',null);}else{_0x31cb79=_['find'](_0x1543c9,[_0x1844('0x41'),_0x1844('0x35')]);_0x2c661d[_0x1844('0x4d')]=_0x1844('0x35');_0x4d051e=as[_0x1844('0x6e')](_0x18b868,_0x31cb79[_0x1844('0x3e')],_0x2c661d);_0x6128eb[_0x12aa0e](_0x4d051e['text'],_0x4d051e['value'][_0x1844('0x76')],_0x4d051e['value'][_0x1844('0x28')]);}break;case'body':_0x4d051e=as[_0x1844('0x6e')]('me',null,_0x2c661d);_0x6128eb[_0x12aa0e](_0x4d051e[_0x1844('0x77')],_0x4d051e[_0x1844('0x69')][_0x1844('0x76')],_0x4d051e[_0x1844('0x69')]['end']);break;}}else{var _0x4d051e=as[_0x1844('0x6e')](_0x18b868,_0x31cb79[_0x1844('0x3e')],_0x2c661d);_0x6128eb[_0x12aa0e](_0x4d051e[_0x1844('0x77')],_0x4d051e['value'][_0x1844('0x76')],_0x4d051e['value']['end']);}}}else{var _0x1991e3=_(_0x5515b9[_0x1844('0x42')])[_0x1844('0x78')]()[_0x1844('0x2b')](function(_0x562c44){return _[_0x1844('0x79')](_0x1543c9,[_0x1844('0x41'),_0x562c44])?_0x562c44:undefined;})[_0x1844('0x7a')]()['value']();if(!_['isEmpty'](_0x1991e3)){_0x1991e3['forEach'](function(_0x224d16){if(_0x224d16===_0x1844('0x7b')){_0x3526eb[_0x1844('0x4b')](_0x1844('0x7c'),[][_0x1844('0x7d')](_0x5515b9[_0x1844('0x42')][_0x224d16]));}else if(_0x224d16===_0x1844('0x7e')){var _0x3f5b21=JSON[_0x1844('0x7f')](_0x5515b9[_0x1844('0x42')][_0x224d16])[_0x1844('0x80')];var _0x3bbad2=JSON[_0x1844('0x7f')](_0x5515b9[_0x1844('0x42')][_0x224d16])[_0x1844('0x81')];_0x3526eb[_0x1844('0x4b')](_0x1844('0x82'),_0x3f5b21,_0x3bbad2);}else{if(_0x5515b9['query'][_0x224d16]===_0x1844('0x83')){_0x3526eb[_0x1844('0x4b')]('i.'+_0x224d16+'\x20IS\x20NULL');}else{_0x3526eb[_0x1844('0x4b')]('i.'+_0x224d16+_0x1844('0x84'),_0x5515b9[_0x1844('0x42')][_0x224d16]);}}});}if(_0x5515b9['query'][_0x1844('0x85')]){if(_0x5515b9[_0x1844('0x42')][_0x1844('0x85')]==0x1){_0x3526eb[_0x1844('0x68')](_0x1844('0x86'));}else{_0x3526eb['having'](_0x1844('0x87'));}}if(_0x5515b9[_0x1844('0x42')]['tag']){_0x2bce43=_['isArray'](_0x5515b9[_0x1844('0x42')][_0x1844('0x88')])?_0x5515b9['query'][_0x1844('0x88')]:new Array(_0x5515b9[_0x1844('0x42')]['tag']);_0x2bce43[_0x1844('0x30')](function(_0x35bbc7){_0x517c4d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35bbc7+',%');});}if(_0x5515b9['query'][_0x1844('0x89')]){var _0x1282ff=_0x5515b9[_0x1844('0x42')][_0x1844('0x89')][_0x1844('0x8a')]('\x5c','\x5c\x5c')[_0x1844('0x8a')](/'/g,'\x27\x27');if(qs[_0x1844('0x8b')](_0x1282ff)){_0x6128eb['or'](_0x1844('0x8c'),_0x1282ff+'%')['or'](_0x1844('0x8d'),_0x1282ff+'%');}_0x6128eb['or'](_0x1844('0x8e'),_0x1282ff+'%');}}_0x3526eb[_0x1844('0x4b')](_0x6128eb);_0x3526eb[_0x1844('0x8f')](_0x1844('0x90'));var _0x22df19={'type':db['Sequelize'][_0x1844('0x91')]['SELECT'],'raw':!![]};var _0x544354=_0x3526eb['clone']();_0x544354[_0x1844('0x4d')]('i.id');_0x544354['field'](_0x1844('0x92'),_0x1844('0x67'));if(_0x37cea6[_0x1844('0x49')]){_0x37cea6[_0x1844('0x49')][_0x1844('0x30')](function(_0x4c0fbb){var _0x5e4794=_0x4c0fbb[0x0]===_0x1844('0x93')?_0x4c0fbb[0x0]:'i.'+_0x4c0fbb[0x0];_0x3526eb[_0x1844('0x49')](_0x5e4794,_0x4c0fbb[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2bce43)){_0x3526eb[_0x1844('0x68')](_0x517c4d);_0x544354[_0x1844('0x4b')](_0x1844('0x94'),_0x2bce43);}BPromise[_0x1844('0x95')]()[_0x1844('0x26')](function(){if(!_0x144447){if(_0x5515b9[_0x1844('0x42')]['FaxAccountId'])return;_0x544354[_0x1844('0x4b')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3526eb[_0x1844('0x4b')](_0x1844('0x96'));return;}if(_0x5515b9[_0x1844('0x97')][_0x1844('0x98')]!==_0x1844('0x99'))return;return _0x5515b9[_0x1844('0x97')][_0x1844('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e96b3){if(_[_0x1844('0x9b')](_0x5e96b3)){_0x544354[_0x1844('0x4b')](_0x1844('0x9c'));_0x3526eb['where'](_0x1844('0x9c'));}else{_0x544354[_0x1844('0x4b')](_0x1844('0x7c'),_[_0x1844('0x2b')](_0x5e96b3,'id'));_0x3526eb[_0x1844('0x4b')](_0x1844('0x7c'),_[_0x1844('0x2b')](_0x5e96b3,'id'));}});})[_0x1844('0x26')](function(){if(_0x5515b9[_0x1844('0x97')]['role']===_0x1844('0x99')&&!_0x144447&&!_0x5515b9[_0x1844('0x42')]['FaxAccountId'])return[];return db[_0x1844('0x9d')]['query'](_0x544354[_0x1844('0x9e')](),_0x22df19);})[_0x1844('0x26')](function(_0x2bd55c){_0x3656ae['count']=_0x2bd55c[_0x1844('0x47')];if(_0x3656ae[_0x1844('0x1f')]===0x0)return[];return db[_0x1844('0x9d')][_0x1844('0x42')](_0x6dde00[_0x1844('0x9e')](),_0x22df19)['then'](function(_0x38c003){_0xa853ae=_['keyBy'](_0x38c003,'id');_0x22df19=_[_0x1844('0x9f')](_0x22df19,{'model':db[_0x1844('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5515b9['query'][_0x1844('0x46')]){_0x37cea6[_0x1844('0x44')]['forEach'](function(_0x2f87a0){_0x3526eb[_0x1844('0x4d')]('i.'+_0x2f87a0);});}else{_0x3526eb[_0x1844('0x4d')](_0x1844('0x92'),'unreadMessages');_0x3526eb['field'](_0x1844('0xa0'),'Account.key');_0x3526eb['field'](_0x1844('0xa1'),_0x1844('0xa2'));_0x3526eb[_0x1844('0x4d')](_0x1844('0xa3'),'contactName');_0x3526eb[_0x1844('0x4d')](_0x1844('0xa4'));_0x3526eb[_0x1844('0x4d')](_0x1844('0xa5'),_0x1844('0xa6'));_0x3526eb[_0x1844('0x4d')](_0x1844('0xa7'),_0x1844('0xa8'));_0x3526eb[_0x1844('0x4d')](_0x1844('0xa9'),'Contact.email');_0x3526eb['field'](_0x1844('0xaa'),_0x1844('0xab'));_0x3526eb[_0x1844('0x4d')]('c.mobile','Contact.mobile');_0x3526eb[_0x1844('0x4d')](_0x1844('0xac'),'Contact.fax');_0x3526eb[_0x1844('0x4d')](_0x1844('0xad'),_0x1844('0xae'));_0x3526eb[_0x1844('0x4d')](_0x1844('0xaf'),_0x1844('0xb0'));_0x3526eb[_0x1844('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1844('0x2d'));}if(_0x37cea6[_0x1844('0x1d')])_0x3526eb[_0x1844('0x1d')](_0x37cea6[_0x1844('0x1d')]);if(_0x37cea6[_0x1844('0x20')])_0x3526eb[_0x1844('0x20')](_0x37cea6[_0x1844('0x20')]);return db['sequelize']['query'](_0x3526eb[_0x1844('0x9e')](),_0x22df19);})[_0x1844('0x26')](function(_0x785790){if(_0x785790[_0x1844('0x47')]>0x0)_0xe5de29[_0x1844('0x4b')](_0x1844('0xb1'),_[_0x1844('0x2b')](_0x785790,'id'));return db['sequelize']['query'](_0xe5de29['toString'](),_0x22df19)[_0x1844('0x26')](function(_0x2b8c56){var _0x594e22=_['groupBy'](_0x2b8c56,_0x1844('0xb2'));var _0x1b8e8b=[];_0x785790[_0x1844('0x30')](function(_0x2fc63f){_0x1b8e8b[_0x1844('0x31')](updateFaxInteraction(_0x2fc63f,_0xa853ae,_0x594e22));});return BPromise[_0x1844('0xb3')](_0x1b8e8b);});});})['then'](function(_0x2f15ac){_0x3656ae['rows']=_0x2f15ac;return _0x3656ae;})[_0x1844('0x26')](respondWithFilteredResult(_0x228771,_0x37cea6))[_0x1844('0x32')](handleError(_0x228771,null));};exports[_0x1844('0xb4')]=function(_0x48b553,_0x57265e){var _0x33f75f={'raw':![],'where':{'id':_0x48b553[_0x1844('0xb5')]['id']}},_0x4ec69c={};_0x4ec69c['model']=_['keys'](db[_0x1844('0x3b')][_0x1844('0x3c')]);_0x4ec69c['query']=_['keys'](_0x48b553[_0x1844('0x42')]);_0x4ec69c[_0x1844('0x43')]=_[_0x1844('0x45')](_0x4ec69c['model'],_0x4ec69c['query']);_0x33f75f[_0x1844('0x44')]=_['intersection'](_0x4ec69c['model'],qs[_0x1844('0x46')](_0x48b553[_0x1844('0x42')]['fields']));_0x33f75f[_0x1844('0x44')]=_0x33f75f[_0x1844('0x44')][_0x1844('0x47')]?_0x33f75f[_0x1844('0x44')]:_0x4ec69c[_0x1844('0x40')];if(_0x48b553[_0x1844('0x42')]['includeAll']){_0x33f75f[_0x1844('0xb6')]=[{'all':!![]}];}_0x33f75f=_['merge']({},_0x33f75f,_0x48b553[_0x1844('0xb7')]);return db[_0x1844('0x3b')]['find'](_0x33f75f)['then'](handleEntityNotFound(_0x57265e,null))['then'](respondWithResult(_0x57265e,null))[_0x1844('0x32')](handleError(_0x57265e,null));};exports[_0x1844('0xb8')]=function(_0x378b4b,_0x17877e){return db[_0x1844('0x3b')]['create'](_0x378b4b['body'],{})['then'](respondWithResult(_0x17877e,0xc9))[_0x1844('0x32')](handleError(_0x17877e,null));};exports[_0x1844('0x25')]=function(_0x1cb81e,_0x23c97c){if(_0x1cb81e[_0x1844('0xb9')]['id']){delete _0x1cb81e[_0x1844('0xb9')]['id'];}return db[_0x1844('0x3b')][_0x1844('0x66')]({'where':{'id':_0x1cb81e[_0x1844('0xb5')]['id']}})[_0x1844('0x26')](handleEntityNotFound(_0x23c97c,null))['then'](saveUpdates(_0x1cb81e[_0x1844('0xb9')],null))[_0x1844('0x26')](respondWithResult(_0x23c97c,null))[_0x1844('0x32')](handleError(_0x23c97c,null));};exports[_0x1844('0x27')]=function(_0x2b5314,_0x384a78){return db[_0x1844('0x3b')][_0x1844('0x66')]({'where':{'id':_0x2b5314[_0x1844('0xb5')]['id']}})[_0x1844('0x26')](handleEntityNotFound(_0x384a78,null))[_0x1844('0x26')](removeEntity(_0x384a78,null))[_0x1844('0x32')](handleError(_0x384a78,null));};exports[_0x1844('0xba')]=function(_0x4a5959,_0x2f5ae2){return db[_0x1844('0x3b')][_0x1844('0xba')]()[_0x1844('0x26')](respondWithResult(_0x2f5ae2,null))['catch'](handleError(_0x2f5ae2,null));};exports[_0x1844('0xbb')]=function(_0x2909ba,_0x81fd37,_0x234ec6){return db[_0x1844('0xbc')][_0x1844('0x66')]({'where':{'id':_0x2909ba[_0x1844('0xb5')]['id']}})[_0x1844('0x26')](handleEntityNotFound(_0x81fd37,null))[_0x1844('0x26')](function(_0x19235b){if(_0x19235b){return _0x19235b[_0x1844('0xbb')](_0x2909ba[_0x1844('0xb9')][_0x1844('0xbd')],_[_0x1844('0xbe')](_0x2909ba[_0x1844('0xb9')],[_0x1844('0xbd'),'id'])||{});}})[_0x1844('0x26')](respondWithResult(_0x81fd37,null))[_0x1844('0x32')](handleError(_0x81fd37,null));};exports['getMessages']=function(_0x24a812,_0x13b6c6,_0x47a86a){var _0x18e00e={'raw':![],'where':{}};var _0x5b0cc4={};var _0x2e6a91={'count':0x0,'rows':[]};return db[_0x1844('0x3b')][_0x1844('0xbf')]({'where':{'id':_0x24a812[_0x1844('0xb5')]['id']}})['then'](handleEntityNotFound(_0x13b6c6,null))[_0x1844('0x26')](function(_0x1958f5){if(_0x1958f5){_0x5b0cc4['model']=_[_0x1844('0x78')](db[_0x1844('0xbc')][_0x1844('0x3c')]);_0x5b0cc4[_0x1844('0x42')]=_['keys'](_0x24a812[_0x1844('0x42')]);_0x5b0cc4[_0x1844('0x43')]=_[_0x1844('0x45')](_0x5b0cc4[_0x1844('0x40')],_0x5b0cc4[_0x1844('0x42')]);_0x18e00e[_0x1844('0x44')]=_[_0x1844('0x45')](_0x5b0cc4[_0x1844('0x40')],qs['fields'](_0x24a812[_0x1844('0x42')][_0x1844('0x46')]));_0x18e00e[_0x1844('0x44')]=_0x18e00e[_0x1844('0x44')][_0x1844('0x47')]?_0x18e00e[_0x1844('0x44')]:_0x5b0cc4[_0x1844('0x40')];if(!_0x24a812[_0x1844('0x42')][_0x1844('0xc0')](_0x1844('0x48'))){_0x18e00e[_0x1844('0x1d')]=qs[_0x1844('0x1d')](_0x24a812[_0x1844('0x42')][_0x1844('0x1d')]);_0x18e00e[_0x1844('0x20')]=qs[_0x1844('0x20')](_0x24a812[_0x1844('0x42')]['offset']);}_0x18e00e[_0x1844('0x49')]=qs[_0x1844('0x4a')](_0x24a812[_0x1844('0x42')][_0x1844('0x4a')]);_0x18e00e[_0x1844('0x4b')]=qs[_0x1844('0x43')](_[_0x1844('0x4c')](_0x24a812[_0x1844('0x42')],_0x5b0cc4[_0x1844('0x43')]));_0x18e00e[_0x1844('0x4b')][_0x1844('0xb2')]=_0x1958f5['id'];if(_0x24a812[_0x1844('0x42')][_0x1844('0x89')]){_0x18e00e[_0x1844('0x4b')]=_[_0x1844('0x9f')](_0x18e00e[_0x1844('0x4b')],{'$or':_['map'](_0x18e00e[_0x1844('0x44')],function(_0xe1129){var _0x4c5075={};_0x4c5075[_0xe1129]={'$like':'%'+_0x24a812['query'][_0x1844('0x89')]+'%'};return _0x4c5075;})});}if(_0x24a812['query'][_0x1844('0x80')]){var _0x487641=_0x24a812['query']['$gte']['split'](',');var _0x157a0c={};_0x157a0c[_0x487641[0x0]]={'$gte':moment(_0x487641[0x1])['format'](_0x1844('0xc1'))};_0x18e00e[_0x1844('0x4b')]=_['merge'](_0x18e00e[_0x1844('0x4b')],_0x157a0c);}_0x18e00e=_[_0x1844('0x9f')]({},_0x18e00e,_0x24a812['options']);return db['FaxMessage'][_0x1844('0x1f')]({'where':_0x18e00e['where']})[_0x1844('0x26')](function(_0x2b7f85){_0x2e6a91[_0x1844('0x1f')]=_0x2b7f85;if(_0x24a812[_0x1844('0x42')]['includeAll']){_0x18e00e[_0x1844('0xb6')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x18e00e);})[_0x1844('0x26')](function(_0x3bc40f){_0x2e6a91['rows']=_0x3bc40f;return _0x2e6a91;});}})[_0x1844('0x26')](respondWithFilteredResult(_0x13b6c6,_0x18e00e))[_0x1844('0x32')](handleError(_0x13b6c6,null));};exports[_0x1844('0xc2')]=function(_0x5bb920,_0x13511e,_0x1b723c){return db['FaxInteraction'][_0x1844('0x66')]({'where':{'id':_0x5bb920['params']['id']}})['then'](handleEntityNotFound(_0x13511e,null))[_0x1844('0x26')](function(_0x17f603){if(_0x17f603){return _0x17f603[_0x1844('0xc3')](_0x5bb920[_0x1844('0xb9')]['ids'],_[_0x1844('0xbe')](_0x5bb920[_0x1844('0xb9')],[_0x1844('0xbd'),'id'])||{})[_0x1844('0xc4')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1844('0x41'),'color'],'where':{'id':_0x5bb920['body'][_0x1844('0xbd')]}});})['then'](function(_0x1bc38b){socket[_0x1844('0xc5')](_0x1844('0xc6'),{'id':Number(_0x5bb920[_0x1844('0xb5')]['id']),'tags':_0x1bc38b||[]});return{'id':Number(_0x5bb920[_0x1844('0xb5')]['id']),'tags':_0x1bc38b||[]};});}})[_0x1844('0x26')](respondWithResult(_0x13511e,null))['catch'](handleError(_0x13511e,null));};exports[_0x1844('0xc7')]=function(_0x870f34,_0x41413b,_0x247cd0){return db['FaxInteraction'][_0x1844('0x66')]({'where':{'id':_0x870f34[_0x1844('0xb5')]['id']}})[_0x1844('0x26')](handleEntityNotFound(_0x41413b,null))[_0x1844('0x26')](function(_0x27aac3){if(_0x27aac3){return _0x27aac3['removeTags'](_0x870f34['query'][_0x1844('0xbd')]);}})[_0x1844('0x26')](respondWithStatusCode(_0x41413b,null))[_0x1844('0x32')](handleError(_0x41413b,null));};exports[_0x1844('0xc8')]=function(_0x537669,_0x47230e){var _0x36e656=moment()[_0x1844('0xc9')]()['toString']();var _0x281a26=path[_0x1844('0xca')](config[_0x1844('0xcb')],_0x1844('0xcc'),'files',_0x1844('0xcd'));var _0x4f2588=path[_0x1844('0xca')](config['root'],_0x1844('0xcc'),'files',_0x1844('0xce'));var _0x260f3d=path['join'](_0x281a26,_0x36e656);var _0x3fe23f=util[_0x1844('0xcf')](_0x1844('0xd0'),_0x537669[_0x1844('0xb5')]['id'],_0x36e656);var _0x380c86=path['join'](_0x281a26,_0x3fe23f);var _0x19e47a=[];_0x19e47a[_0x1844('0x31')]({'model':db['Attachment'],'as':_0x1844('0xd1'),'raw':!![]});var _0xd44d25=[{'model':db[_0x1844('0xbc')],'as':_0x1844('0xd2'),'attributes':['id',_0x1844('0xb9'),'createdAt'],'include':_0x19e47a}];return db['FaxInteraction']['find']({'where':{'id':_0x537669['params']['id']},'include':_0xd44d25})[_0x1844('0x26')](handleEntityNotFound(_0x47230e,null))[_0x1844('0x26')](function(_0x58f3e4){if(_0x58f3e4&&_0x58f3e4[_0x1844('0xd2')]){var _0x420ca5=_0x58f3e4[_0x1844('0xd3')]({'plain':!![]});fs[_0x1844('0xd4')](_0x260f3d);for(var _0x16ad00=0x0;_0x16ad00<_0x420ca5[_0x1844('0xd2')][_0x1844('0x47')];_0x16ad00++){var _0x269b0f=_0x420ca5['Messages'][_0x16ad00]['Attachment'];if(_0x269b0f){var _0x4afbba=path[_0x1844('0xca')](_0x4f2588,_0x269b0f[_0x1844('0xd5')]);if(fs[_0x1844('0xd6')](_0x4afbba)){fs[_0x1844('0xd7')](_0x4afbba)[_0x1844('0xd8')](fs['createWriteStream'](path[_0x1844('0xca')](_0x260f3d,_0x269b0f[_0x1844('0xd5')])));}}}return BPromise['resolve']()[_0x1844('0x26')](function(){return new BPromise(function(_0x11f4ac,_0x426ee6){zipdir(_0x260f3d,{'saveTo':_0x380c86},function(_0xe9a039,_0x441363){if(_0xe9a039)return _0x426ee6(_0xe9a039);return _0x11f4ac(_0x441363);});})[_0x1844('0x26')](function(){return new BPromise(function(_0x2e7d02,_0x44eabd){rimraf(_0x260f3d,function(_0x11bc40){if(_0x11bc40)_0x44eabd(_0x11bc40);return _0x2e7d02();});});})['then'](function(){return _0x47230e['download'](_0x380c86,_0x3fe23f,function(_0x55706a){if(_0x55706a){console['log']('err',_0x55706a);}else{fs['unlinkSync'](_0x380c86);}});});});}else{return _0x47230e[_0x1844('0x1a')](0xc8);}})[_0x1844('0x32')](handleError(_0x47230e,null));}; \ No newline at end of file +var _0x0da3=['UserId','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.fullname','left_join','users','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','FaxInteractionId','push','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','Users','map','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed'];(function(_0xe5cac7,_0x6c2f84){var _0x50df20=function(_0x3e4981){while(--_0x3e4981){_0xe5cac7['push'](_0xe5cac7['shift']());}};_0x50df20(++_0x6c2f84);}(_0x0da3,0xa1));var _0x30da=function(_0x11b5fe,_0x416595){_0x11b5fe=_0x11b5fe-0x0;var _0x41870c=_0x0da3[_0x11b5fe];return _0x41870c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30da('0x0'));var zipdir=require(_0x30da('0x1'));var jsonpatch=require(_0x30da('0x2'));var rp=require(_0x30da('0x3'));var moment=require(_0x30da('0x4'));var BPromise=require(_0x30da('0x5'));var Mustache=require(_0x30da('0x6'));var util=require(_0x30da('0x7'));var path=require(_0x30da('0x8'));var sox=require(_0x30da('0x9'));var csv=require(_0x30da('0xa'));var ejs=require(_0x30da('0xb'));var fs=require('fs');var fs_extra=require(_0x30da('0xc'));var _=require(_0x30da('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30da('0xe'));var deskjs=require(_0x30da('0xf'));var toCsv=require(_0x30da('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30da('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x30da('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x30da('0x12'));var config=require(_0x30da('0x13'));var licenseUtil=require(_0x30da('0x14'));var db=require('../../mysqldb')['db'];config[_0x30da('0x15')]=_[_0x30da('0x16')](config[_0x30da('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x30da('0x17'))(new Redis(config['redis']));require(_0x30da('0x18'))[_0x30da('0x19')](socket);function respondWithStatusCode(_0x4bf26b,_0x42ec1c){_0x42ec1c=_0x42ec1c||0xcc;return function(_0x194721){if(_0x194721){return _0x4bf26b['sendStatus'](_0x42ec1c);}return _0x4bf26b[_0x30da('0x1a')](_0x42ec1c)[_0x30da('0x1b')]();};}function respondWithResult(_0x42af73,_0x36206e){_0x36206e=_0x36206e||0xc8;return function(_0x1a0ef0){if(_0x1a0ef0){return _0x42af73[_0x30da('0x1a')](_0x36206e)[_0x30da('0x1c')](_0x1a0ef0);}};}function respondWithFilteredResult(_0x22ce99,_0x5b4f9a){return function(_0x288c01){if(_0x288c01){var _0x58ce53=typeof _0x5b4f9a[_0x30da('0x1d')]===_0x30da('0x1e')&&typeof _0x5b4f9a[_0x30da('0x1f')]===_0x30da('0x1e');var _0x3733bc=_0x288c01[_0x30da('0x20')];var _0x476091=_0x58ce53?0x0:_0x5b4f9a[_0x30da('0x1d')];var _0x366b9a=_0x58ce53?_0x288c01[_0x30da('0x20')]:_0x5b4f9a['offset']+_0x5b4f9a[_0x30da('0x1f')];var _0x4dccd5;if(_0x366b9a>=_0x3733bc){_0x366b9a=_0x3733bc;_0x4dccd5=0xc8;}else{_0x4dccd5=0xce;}_0x22ce99[_0x30da('0x1a')](_0x4dccd5);return _0x22ce99[_0x30da('0x21')](_0x30da('0x22'),_0x476091+'-'+_0x366b9a+'/'+_0x3733bc)['json'](_0x288c01);}return null;};}function patchUpdates(_0x1ad964){return function(_0x16889c){try{jsonpatch[_0x30da('0x23')](_0x16889c,_0x1ad964,!![]);}catch(_0x295746){return BPromise[_0x30da('0x24')](_0x295746);}return _0x16889c[_0x30da('0x25')]();};}function saveUpdates(_0x5b0105,_0x572a7b){return function(_0x48857e){if(_0x48857e){return _0x48857e[_0x30da('0x26')](_0x5b0105)[_0x30da('0x27')](function(_0x55d58b){return _0x55d58b;});}return null;};}function removeEntity(_0x2b78c5,_0xfcea44){return function(_0x4b970a){if(_0x4b970a){return _0x4b970a['destroy']()[_0x30da('0x27')](function(){_0x2b78c5[_0x30da('0x1a')](0xcc)[_0x30da('0x1b')]();});}};}function handleEntityNotFound(_0x41b8f7,_0x5b5172){return function(_0x51eb36){if(!_0x51eb36){_0x41b8f7[_0x30da('0x28')](0x194);}return _0x51eb36;};}function handleError(_0x2078f2,_0x253ed5){_0x253ed5=_0x253ed5||0x1f4;return function(_0x526f18){logger[_0x30da('0x29')](_0x526f18['stack']);if(_0x526f18[_0x30da('0x2a')]){delete _0x526f18[_0x30da('0x2a')];}_0x2078f2[_0x30da('0x1a')](_0x253ed5)[_0x30da('0x2b')](_0x526f18);};}function getInteractionUsers(_0x2fc5af,_0x54eb1c){return new BPromise(function(_0x1ce16f,_0xbf869d){try{if(_0x54eb1c[_0x2fc5af['id']]){_0x2fc5af[_0x30da('0x2c')]=_[_0x30da('0x2d')](_0x54eb1c[_0x2fc5af['id']],function(_0x56457e){return{'id':_0x56457e['id'],'fullname':_0x56457e['fullname']};});}}catch(_0x192c70){_0xbf869d(_0x192c70);}_0x1ce16f(_0x2fc5af);});}function getInteractionTags(_0x1edfeb,_0x48e392){return new BPromise(function(_0x945b99,_0xc88629){try{if(_0x1edfeb['TagIds']){_0x1edfeb[_0x30da('0x2e')]=[];_0x1edfeb['TagIds'][_0x30da('0x2f')](',')[_0x30da('0x30')](function(_0x4f88e2){_0x1edfeb[_0x30da('0x2e')]['push'](_0x48e392[_0x4f88e2]);});}delete _0x1edfeb['TagIds'];}catch(_0x2e6538){_0xc88629(_0x2e6538);}_0x945b99(_0x1edfeb);});}function updateFaxInteraction(_0x24af31,_0x1a32c3,_0x3cc774){return new BPromise(function(_0x5f1a2c,_0x481f02){return getInteractionUsers(_0x24af31,_0x3cc774)[_0x30da('0x27')](function(_0x2cdca2){return getInteractionTags(_0x2cdca2,_0x1a32c3);})['then'](function(_0x575bf1){return getStateInteraction(_0x575bf1);})['then'](function(_0x46928b){_0x5f1a2c(_0x46928b);})[_0x30da('0x31')](function(_0x4a7349){_0x481f02(_0x4a7349);});});}function getStateInteraction(_0x2a3f20){return new BPromise(function(_0x11063d){_0x2a3f20[_0x30da('0x32')]=0x0;_0x2a3f20[_0x30da('0x33')]=0x0;_0x2a3f20[_0x30da('0x34')]=0x0;_0x2a3f20[_0x30da('0x35')]=0x0;_0x2a3f20[_0x30da('0x36')]=0x0;if(!_0x2a3f20[_0x30da('0x37')]&&!_0x2a3f20['UserId']){_0x2a3f20[_0x30da('0x32')]+=0x1;}if(!_0x2a3f20[_0x30da('0x37')]&&_0x2a3f20[_0x30da('0x38')]){_0x2a3f20[_0x30da('0x33')]+=0x1;if(_0x2a3f20[_0x30da('0x32')]){_0x2a3f20[_0x30da('0x32')]-=0x1;}}if(_0x2a3f20['closed']&&_0x2a3f20['UserId']){_0x2a3f20['answered']+=0x1;if(_0x2a3f20[_0x30da('0x33')]){_0x2a3f20[_0x30da('0x33')]-=0x1;}}if(_0x2a3f20[_0x30da('0x37')]&&!_0x2a3f20['UserId']){_0x2a3f20['unmanaged']+=0x1;if(_0x2a3f20[_0x30da('0x32')]){_0x2a3f20['waiting']-=0x1;}}_0x2a3f20[_0x30da('0x36')]+=0x1;_0x11063d(_0x2a3f20);});}exports[_0x30da('0x39')]=function(_0x8e5bb8,_0x2744ea){var _0x17554d={},_0x23e199={},_0x2acde3={'count':0x0,'rows':[]};var _0x58e7eb=_['map'](db[_0x30da('0x3a')][_0x30da('0x3b')],function(_0x3e214b){return{'name':_0x3e214b[_0x30da('0x3c')],'type':_0x3e214b[_0x30da('0x3d')][_0x30da('0x3e')]};});_0x23e199[_0x30da('0x3f')]=_['map'](_0x58e7eb,_0x30da('0x2a'));_0x23e199[_0x30da('0x40')]=_[_0x30da('0x41')](_0x8e5bb8['query']);_0x23e199[_0x30da('0x42')]=_[_0x30da('0x43')](_0x23e199['model'],_0x23e199['query']);_0x17554d[_0x30da('0x44')]=_[_0x30da('0x43')](_0x23e199[_0x30da('0x3f')],qs[_0x30da('0x45')](_0x8e5bb8['query']['fields']));_0x17554d['attributes']=_0x17554d[_0x30da('0x44')][_0x30da('0x46')]?_0x17554d[_0x30da('0x44')]:_0x23e199[_0x30da('0x3f')];if(!_0x8e5bb8['query'][_0x30da('0x47')](_0x30da('0x48'))){_0x17554d[_0x30da('0x1f')]=qs[_0x30da('0x1f')](_0x8e5bb8[_0x30da('0x40')][_0x30da('0x1f')]);_0x17554d[_0x30da('0x1d')]=qs[_0x30da('0x1d')](_0x8e5bb8[_0x30da('0x40')][_0x30da('0x1d')]);}_0x17554d['order']=qs['sort'](_0x8e5bb8['query'][_0x30da('0x49')]);_0x17554d[_0x30da('0x4a')]=qs['filters'](_['pick'](_0x8e5bb8['query'],_0x23e199['filters']),_0x58e7eb);var _0x5e0a12=[];var _0x30cf62=squel[_0x30da('0x4b')]()[_0x30da('0x4c')]('id')[_0x30da('0x4c')](_0x30da('0x2a'))['field'](_0x30da('0x4d'))[_0x30da('0x4e')](_0x30da('0x4f'));var _0x385018=squel[_0x30da('0x4b')]()['field']('u.id')[_0x30da('0x4c')](_0x30da('0x50'))[_0x30da('0x4c')]('ui.FaxInteractionId')[_0x30da('0x4e')]('user_has_fax_interactions','ui')[_0x30da('0x51')](_0x30da('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x3999c4=squel[_0x30da('0x4b')]()[_0x30da('0x4e')]('fax_interactions','i')[_0x30da('0x51')](_0x30da('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x30da('0x51')]('users','o',_0x30da('0x54'))[_0x30da('0x51')](_0x30da('0x55'),'a','a.id\x20=\x20i.FaxAccountId')['left_join']('fax_messages','me',_0x30da('0x56'))['left_join'](_0x30da('0x57'),'it',_0x30da('0x58'))[_0x30da('0x51')](_0x30da('0x4f'),'t',_0x30da('0x59'));var _0x1d9d1b=squel[_0x30da('0x5a')]();var _0x572c1c=[];var _0x57f793=squel[_0x30da('0x5a')]();var _0x1273e7;if(_0x8e5bb8['query'][_0x30da('0x5b')]){_0x1273e7=as[_0x30da('0x5c')](_0x8e5bb8[_0x30da('0x40')][_0x30da('0x5b')]);var _0x375e27=_0x1273e7['sqlOperator'];for(var _0x5d5d0d=0x0;_0x5d5d0d<_0x1273e7[_0x30da('0x5d')]['length'];_0x5d5d0d++){var _0x4d0a51=_0x1273e7[_0x30da('0x5d')][_0x5d5d0d];var _0x30a783='i';var _0x38c86e=_[_0x30da('0x5e')](_0x58e7eb,['name',_0x4d0a51['field']]);if(!_0x38c86e){switch(_0x4d0a51[_0x30da('0x4c')]){case _0x30da('0x5f'):if(_0x4d0a51['value']==0x1){_0x3999c4[_0x30da('0x60')]('`'+_0x4d0a51['field']+_0x30da('0x61'));}else{_0x3999c4[_0x30da('0x60')]('`'+_0x4d0a51[_0x30da('0x4c')]+'`\x20>\x200');}break;case _0x30da('0x62'):if(_0x4d0a51[_0x30da('0x63')]===_0x30da('0x64')){if(_0x4d0a51[_0x30da('0x65')]['split']('\x20')[_0x30da('0x46')]>0x1){_0x1d9d1b[_0x375e27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4d0a51[_0x30da('0x65')]),null);}else{var _0x427e78='%'+_0x4d0a51[_0x30da('0x65')]+'%';_0x1d9d1b[_0x375e27]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x427e78,_0x427e78,_0x427e78);}}else{_0x38c86e=_['find'](_0x58e7eb,[_0x30da('0x2a'),_0x30da('0x66')]);_0x4d0a51[_0x30da('0x4c')]=_0x30da('0x66');_0x47f23e=as['buildExpression'](_0x30a783,_0x38c86e['type'],_0x4d0a51);_0x1d9d1b[_0x375e27](_0x47f23e[_0x30da('0x67')],_0x47f23e[_0x30da('0x65')][_0x30da('0x68')],_0x47f23e[_0x30da('0x65')]['end']);}break;case _0x30da('0x69'):var _0x49bee3=_0x4d0a51['value'][_0x30da('0x2f')](',')[_0x30da('0x2d')](function(_0x2a539b){return Number(_0x2a539b);});_0x49bee3[_0x30da('0x30')](function(_0x156d6a){_0x57f793['or'](_0x30da('0x6a'),'%,'+_0x156d6a+',%');});_0x572c1c=_[_0x30da('0x6b')](_0x572c1c,_0x49bee3);break;case _0x30da('0x6c'):if(_0x4d0a51[_0x30da('0x63')]===_0x30da('0x64')){_0x1d9d1b[_0x375e27](_0x30da('0x6d'),'%'+_0x4d0a51[_0x30da('0x65')]+'%',null);}else{_0x38c86e=_[_0x30da('0x5e')](_0x58e7eb,[_0x30da('0x2a'),_0x30da('0x38')]);_0x4d0a51[_0x30da('0x4c')]=_0x30da('0x38');_0x47f23e=as[_0x30da('0x6e')](_0x30a783,_0x38c86e[_0x30da('0x3d')],_0x4d0a51);_0x1d9d1b[_0x375e27](_0x47f23e[_0x30da('0x67')],_0x47f23e[_0x30da('0x65')][_0x30da('0x68')],_0x47f23e[_0x30da('0x65')]['end']);}break;case _0x30da('0x6f'):_0x47f23e=as[_0x30da('0x6e')]('me',null,_0x4d0a51);_0x1d9d1b[_0x375e27](_0x47f23e[_0x30da('0x67')],_0x47f23e[_0x30da('0x65')]['start'],_0x47f23e[_0x30da('0x65')][_0x30da('0x1b')]);break;}}else{var _0x47f23e=as['buildExpression'](_0x30a783,_0x38c86e['type'],_0x4d0a51);_0x1d9d1b[_0x375e27](_0x47f23e[_0x30da('0x67')],_0x47f23e[_0x30da('0x65')][_0x30da('0x68')],_0x47f23e['value'][_0x30da('0x1b')]);}}}else{var _0x3b47a7=_(_0x8e5bb8[_0x30da('0x40')])['keys']()[_0x30da('0x2d')](function(_0x413398){return _[_0x30da('0x70')](_0x58e7eb,[_0x30da('0x2a'),_0x413398])?_0x413398:undefined;})[_0x30da('0x71')]()[_0x30da('0x65')]();if(!_[_0x30da('0x72')](_0x3b47a7)){_0x3b47a7['forEach'](function(_0xb38725){if(_0xb38725===_0x30da('0x73')){_0x3999c4[_0x30da('0x4a')](_0x30da('0x74'),[][_0x30da('0x75')](_0x8e5bb8[_0x30da('0x40')][_0xb38725]));}else if(_0xb38725===_0x30da('0x76')){var _0x59dbf3=JSON[_0x30da('0x77')](_0x8e5bb8[_0x30da('0x40')][_0xb38725])[_0x30da('0x78')];var _0x51d9fd=JSON[_0x30da('0x77')](_0x8e5bb8[_0x30da('0x40')][_0xb38725])['$lte'];_0x3999c4[_0x30da('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x59dbf3,_0x51d9fd);}else{if(_0x8e5bb8[_0x30da('0x40')][_0xb38725]===_0x30da('0x79')){_0x3999c4[_0x30da('0x4a')]('i.'+_0xb38725+_0x30da('0x7a'));}else{_0x3999c4[_0x30da('0x4a')]('i.'+_0xb38725+_0x30da('0x7b'),_0x8e5bb8['query'][_0xb38725]);}}});}if(_0x8e5bb8[_0x30da('0x40')][_0x30da('0x7c')]){if(_0x8e5bb8[_0x30da('0x40')][_0x30da('0x7c')]==0x1){_0x3999c4['having'](_0x30da('0x7d'));}else{_0x3999c4[_0x30da('0x60')](_0x30da('0x7e'));}}if(_0x8e5bb8[_0x30da('0x40')]['tag']){_0x572c1c=_[_0x30da('0x7f')](_0x8e5bb8[_0x30da('0x40')][_0x30da('0x80')])?_0x8e5bb8[_0x30da('0x40')][_0x30da('0x80')]:new Array(_0x8e5bb8[_0x30da('0x40')][_0x30da('0x80')]);_0x572c1c[_0x30da('0x30')](function(_0x3b4eac){_0x57f793['or'](_0x30da('0x6a'),'%,'+_0x3b4eac+',%');});}if(_0x8e5bb8['query'][_0x30da('0x81')]){var _0x3b4af7=_0x8e5bb8[_0x30da('0x40')][_0x30da('0x81')][_0x30da('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x30da('0x83')](_0x3b4af7)){_0x1d9d1b['or']('i.id\x20LIKE\x20?',_0x3b4af7+'%')['or'](_0x30da('0x84'),_0x3b4af7+'%');}_0x1d9d1b['or'](_0x30da('0x85'),_0x3b4af7+'%');}}_0x3999c4['where'](_0x1d9d1b);_0x3999c4[_0x30da('0x86')](_0x30da('0x87'));var _0x514bbb={'type':db[_0x30da('0x88')][_0x30da('0x89')][_0x30da('0x8a')],'raw':!![]};var _0x563785=_0x3999c4['clone']();_0x563785[_0x30da('0x4c')](_0x30da('0x87'));_0x563785[_0x30da('0x4c')](_0x30da('0x8b'),_0x30da('0x5f'));if(_0x17554d['order']){_0x17554d[_0x30da('0x8c')][_0x30da('0x30')](function(_0x276d95){var _0x290b05=_0x276d95[0x0]===_0x30da('0x8d')?_0x276d95[0x0]:'i.'+_0x276d95[0x0];_0x3999c4['order'](_0x290b05,_0x276d95[0x1]===_0x30da('0x8e')?![]:!![]);});}if(!_[_0x30da('0x72')](_0x572c1c)){_0x3999c4[_0x30da('0x60')](_0x57f793);_0x563785[_0x30da('0x4a')](_0x30da('0x8f'),_0x572c1c);}BPromise['resolve']()['then'](function(){if(!_0x1273e7){if(_0x8e5bb8[_0x30da('0x40')][_0x30da('0x73')])return;_0x563785[_0x30da('0x4a')](_0x30da('0x90'));_0x3999c4[_0x30da('0x4a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x8e5bb8[_0x30da('0x91')][_0x30da('0x92')]!==_0x30da('0x93'))return;return _0x8e5bb8['user'][_0x30da('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x584bd6){if(_[_0x30da('0x72')](_0x584bd6)){_0x563785[_0x30da('0x4a')](_0x30da('0x95'));_0x3999c4[_0x30da('0x4a')](_0x30da('0x95'));}else{_0x563785[_0x30da('0x4a')](_0x30da('0x74'),_[_0x30da('0x2d')](_0x584bd6,'id'));_0x3999c4[_0x30da('0x4a')]('i.FaxAccountId\x20IN\x20?',_[_0x30da('0x2d')](_0x584bd6,'id'));}});})[_0x30da('0x27')](function(){if(_0x8e5bb8['user'][_0x30da('0x92')]==='agent'&&!_0x1273e7&&!_0x8e5bb8[_0x30da('0x40')]['FaxAccountId'])return[];return db[_0x30da('0x96')]['query'](_0x563785[_0x30da('0x97')](),_0x514bbb);})[_0x30da('0x27')](function(_0x425b3c){_0x2acde3[_0x30da('0x20')]=_0x425b3c[_0x30da('0x46')];if(_0x2acde3[_0x30da('0x20')]===0x0)return[];return db[_0x30da('0x96')][_0x30da('0x40')](_0x30cf62[_0x30da('0x97')](),_0x514bbb)['then'](function(_0xb44938){_0x5e0a12=_['keyBy'](_0xb44938,'id');_0x514bbb=_['merge'](_0x514bbb,{'model':db[_0x30da('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8e5bb8['query'][_0x30da('0x45')]){_0x17554d[_0x30da('0x44')]['forEach'](function(_0x3b048d){_0x3999c4[_0x30da('0x4c')]('i.'+_0x3b048d);});}else{_0x3999c4[_0x30da('0x4c')](_0x30da('0x8b'),_0x30da('0x5f'));_0x3999c4['field'](_0x30da('0x98'),_0x30da('0x99'));_0x3999c4['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3999c4['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3999c4[_0x30da('0x4c')](_0x30da('0x9a'));_0x3999c4[_0x30da('0x4c')](_0x30da('0x9b'),_0x30da('0x9c'));_0x3999c4['field'](_0x30da('0x9d'),_0x30da('0x9e'));_0x3999c4['field'](_0x30da('0x9f'),_0x30da('0xa0'));_0x3999c4['field'](_0x30da('0xa1'),'Contact.phone');_0x3999c4[_0x30da('0x4c')](_0x30da('0xa2'),_0x30da('0xa3'));_0x3999c4[_0x30da('0x4c')](_0x30da('0xa4'),_0x30da('0xa5'));_0x3999c4['field'](_0x30da('0xa6'),_0x30da('0xa7'));_0x3999c4[_0x30da('0x4c')](_0x30da('0xa8'),'Owner.internal');_0x3999c4[_0x30da('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x17554d[_0x30da('0x1f')])_0x3999c4[_0x30da('0x1f')](_0x17554d[_0x30da('0x1f')]);if(_0x17554d[_0x30da('0x1d')])_0x3999c4[_0x30da('0x1d')](_0x17554d[_0x30da('0x1d')]);return db[_0x30da('0x96')][_0x30da('0x40')](_0x3999c4[_0x30da('0x97')](),_0x514bbb);})[_0x30da('0x27')](function(_0x415eac){if(_0x415eac[_0x30da('0x46')]>0x0)_0x385018['where']('ui.FaxInteractionId\x20IN\x20?',_[_0x30da('0x2d')](_0x415eac,'id'));return db[_0x30da('0x96')]['query'](_0x385018[_0x30da('0x97')](),_0x514bbb)[_0x30da('0x27')](function(_0x2bb930){var _0x5b202e=_['groupBy'](_0x2bb930,_0x30da('0xa9'));var _0x4e02d2=[];_0x415eac['forEach'](function(_0x25ad1d){_0x4e02d2[_0x30da('0xaa')](updateFaxInteraction(_0x25ad1d,_0x5e0a12,_0x5b202e));});return BPromise[_0x30da('0xab')](_0x4e02d2);});});})[_0x30da('0x27')](function(_0x1413d1){_0x2acde3[_0x30da('0xac')]=_0x1413d1;return _0x2acde3;})[_0x30da('0x27')](respondWithFilteredResult(_0x2744ea,_0x17554d))[_0x30da('0x31')](handleError(_0x2744ea,null));};exports[_0x30da('0xad')]=function(_0x1648b9,_0x4b57bd){var _0x50688a={'raw':![],'where':{'id':_0x1648b9[_0x30da('0xae')]['id']}},_0x235fc7={};_0x235fc7[_0x30da('0x3f')]=_[_0x30da('0x41')](db[_0x30da('0x3a')][_0x30da('0x3b')]);_0x235fc7[_0x30da('0x40')]=_[_0x30da('0x41')](_0x1648b9['query']);_0x235fc7[_0x30da('0x42')]=_[_0x30da('0x43')](_0x235fc7[_0x30da('0x3f')],_0x235fc7[_0x30da('0x40')]);_0x50688a['attributes']=_['intersection'](_0x235fc7['model'],qs['fields'](_0x1648b9[_0x30da('0x40')][_0x30da('0x45')]));_0x50688a['attributes']=_0x50688a[_0x30da('0x44')]['length']?_0x50688a[_0x30da('0x44')]:_0x235fc7[_0x30da('0x3f')];if(_0x1648b9[_0x30da('0x40')][_0x30da('0xaf')]){_0x50688a[_0x30da('0xb0')]=[{'all':!![]}];}_0x50688a=_[_0x30da('0xb1')]({},_0x50688a,_0x1648b9[_0x30da('0xb2')]);return db[_0x30da('0x3a')][_0x30da('0x5e')](_0x50688a)['then'](handleEntityNotFound(_0x4b57bd,null))[_0x30da('0x27')](respondWithResult(_0x4b57bd,null))[_0x30da('0x31')](handleError(_0x4b57bd,null));};exports[_0x30da('0xb3')]=function(_0x5de1a7,_0x38a2ba){return db['FaxInteraction'][_0x30da('0xb3')](_0x5de1a7[_0x30da('0x6f')],{})[_0x30da('0x27')](respondWithResult(_0x38a2ba,0xc9))[_0x30da('0x31')](handleError(_0x38a2ba,null));};exports[_0x30da('0x26')]=function(_0x4687c2,_0x52eb96){if(_0x4687c2[_0x30da('0x6f')]['id']){delete _0x4687c2[_0x30da('0x6f')]['id'];}return db['FaxInteraction'][_0x30da('0x5e')]({'where':{'id':_0x4687c2[_0x30da('0xae')]['id']}})[_0x30da('0x27')](handleEntityNotFound(_0x52eb96,null))[_0x30da('0x27')](saveUpdates(_0x4687c2[_0x30da('0x6f')],null))[_0x30da('0x27')](respondWithResult(_0x52eb96,null))[_0x30da('0x31')](handleError(_0x52eb96,null));};exports[_0x30da('0xb4')]=function(_0x460111,_0x247ff1){return db[_0x30da('0x3a')][_0x30da('0x5e')]({'where':{'id':_0x460111[_0x30da('0xae')]['id']}})[_0x30da('0x27')](handleEntityNotFound(_0x247ff1,null))[_0x30da('0x27')](removeEntity(_0x247ff1,null))[_0x30da('0x31')](handleError(_0x247ff1,null));};exports['describe']=function(_0x31447f,_0xb720f6){return db[_0x30da('0x3a')][_0x30da('0xb5')]()[_0x30da('0x27')](respondWithResult(_0xb720f6,null))[_0x30da('0x31')](handleError(_0xb720f6,null));};exports[_0x30da('0xb6')]=function(_0x57d671,_0x1ab119,_0x3412a3){return db[_0x30da('0xb7')][_0x30da('0x5e')]({'where':{'id':_0x57d671[_0x30da('0xae')]['id']}})['then'](handleEntityNotFound(_0x1ab119,null))['then'](function(_0x50eee5){if(_0x50eee5){return _0x50eee5[_0x30da('0xb6')](_0x57d671[_0x30da('0x6f')]['ids'],_[_0x30da('0xb8')](_0x57d671[_0x30da('0x6f')],[_0x30da('0xb9'),'id'])||{});}})[_0x30da('0x27')](respondWithResult(_0x1ab119,null))['catch'](handleError(_0x1ab119,null));};exports[_0x30da('0xba')]=function(_0x531b1a,_0x193b43,_0x3305db){var _0x46ef9a={'raw':![],'where':{}};var _0x2542ad={};var _0x4f1881={'count':0x0,'rows':[]};return db[_0x30da('0x3a')]['findOne']({'where':{'id':_0x531b1a[_0x30da('0xae')]['id']}})[_0x30da('0x27')](handleEntityNotFound(_0x193b43,null))[_0x30da('0x27')](function(_0x7cc9db){if(_0x7cc9db){_0x2542ad[_0x30da('0x3f')]=_[_0x30da('0x41')](db[_0x30da('0xb7')][_0x30da('0x3b')]);_0x2542ad['query']=_['keys'](_0x531b1a['query']);_0x2542ad[_0x30da('0x42')]=_[_0x30da('0x43')](_0x2542ad['model'],_0x2542ad[_0x30da('0x40')]);_0x46ef9a['attributes']=_['intersection'](_0x2542ad[_0x30da('0x3f')],qs[_0x30da('0x45')](_0x531b1a[_0x30da('0x40')]['fields']));_0x46ef9a[_0x30da('0x44')]=_0x46ef9a[_0x30da('0x44')][_0x30da('0x46')]?_0x46ef9a[_0x30da('0x44')]:_0x2542ad[_0x30da('0x3f')];if(!_0x531b1a[_0x30da('0x40')][_0x30da('0x47')](_0x30da('0x48'))){_0x46ef9a['limit']=qs[_0x30da('0x1f')](_0x531b1a[_0x30da('0x40')][_0x30da('0x1f')]);_0x46ef9a[_0x30da('0x1d')]=qs[_0x30da('0x1d')](_0x531b1a['query']['offset']);}_0x46ef9a[_0x30da('0x8c')]=qs['sort'](_0x531b1a['query']['sort']);_0x46ef9a['where']=qs[_0x30da('0x42')](_[_0x30da('0xbb')](_0x531b1a[_0x30da('0x40')],_0x2542ad[_0x30da('0x42')]));_0x46ef9a[_0x30da('0x4a')][_0x30da('0xa9')]=_0x7cc9db['id'];if(_0x531b1a[_0x30da('0x40')][_0x30da('0x81')]){_0x46ef9a[_0x30da('0x4a')]=_['merge'](_0x46ef9a['where'],{'$or':_[_0x30da('0x2d')](_0x46ef9a[_0x30da('0x44')],function(_0x3abc72){var _0x3c1096={};_0x3c1096[_0x3abc72]={'$like':'%'+_0x531b1a[_0x30da('0x40')][_0x30da('0x81')]+'%'};return _0x3c1096;})});}if(_0x531b1a['query'][_0x30da('0x78')]){var _0x3071c2=_0x531b1a['query'][_0x30da('0x78')][_0x30da('0x2f')](',');var _0xc32f38={};_0xc32f38[_0x3071c2[0x0]]={'$gte':moment(_0x3071c2[0x1])['format'](_0x30da('0xbc'))};_0x46ef9a[_0x30da('0x4a')]=_[_0x30da('0xb1')](_0x46ef9a[_0x30da('0x4a')],_0xc32f38);}_0x46ef9a=_['merge']({},_0x46ef9a,_0x531b1a[_0x30da('0xb2')]);return db[_0x30da('0xb7')]['count']({'where':_0x46ef9a['where']})[_0x30da('0x27')](function(_0x596b27){_0x4f1881[_0x30da('0x20')]=_0x596b27;if(_0x531b1a[_0x30da('0x40')][_0x30da('0xaf')]){_0x46ef9a[_0x30da('0xb0')]=[{'all':!![]}];}return db[_0x30da('0xb7')][_0x30da('0xbd')](_0x46ef9a);})[_0x30da('0x27')](function(_0x22d651){_0x4f1881[_0x30da('0xac')]=_0x22d651;return _0x4f1881;});}})['then'](respondWithFilteredResult(_0x193b43,_0x46ef9a))[_0x30da('0x31')](handleError(_0x193b43,null));};exports[_0x30da('0xbe')]=function(_0x3e40e2,_0x2f44b4,_0x36404f){return db['FaxInteraction'][_0x30da('0x5e')]({'where':{'id':_0x3e40e2[_0x30da('0xae')]['id']}})['then'](handleEntityNotFound(_0x2f44b4,null))[_0x30da('0x27')](function(_0x5a8620){if(_0x5a8620){return _0x5a8620[_0x30da('0xbf')](_0x3e40e2[_0x30da('0x6f')][_0x30da('0xb9')],_[_0x30da('0xb8')](_0x3e40e2['body'],[_0x30da('0xb9'),'id'])||{})['spread'](function(){return db[_0x30da('0x69')][_0x30da('0xbd')]({'attributes':['id',_0x30da('0x2a'),_0x30da('0x4d')],'where':{'id':_0x3e40e2[_0x30da('0x6f')][_0x30da('0xb9')]}});})[_0x30da('0x27')](function(_0x26770c){socket['emit'](_0x30da('0xc0'),{'id':Number(_0x3e40e2[_0x30da('0xae')]['id']),'tags':_0x26770c||[]});return{'id':Number(_0x3e40e2[_0x30da('0xae')]['id']),'tags':_0x26770c||[]};});}})[_0x30da('0x27')](respondWithResult(_0x2f44b4,null))['catch'](handleError(_0x2f44b4,null));};exports[_0x30da('0xc1')]=function(_0x4077f0,_0x810200,_0x16df74){return db[_0x30da('0x3a')][_0x30da('0x5e')]({'where':{'id':_0x4077f0[_0x30da('0xae')]['id']}})[_0x30da('0x27')](handleEntityNotFound(_0x810200,null))[_0x30da('0x27')](function(_0x2d2c6f){if(_0x2d2c6f){return _0x2d2c6f[_0x30da('0xc1')](_0x4077f0[_0x30da('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x810200,null))[_0x30da('0x31')](handleError(_0x810200,null));};exports[_0x30da('0xc2')]=function(_0x136b22,_0x30e60d){var _0x1e336a=moment()[_0x30da('0xc3')]()['toString']();var _0x2acf73=path[_0x30da('0xc4')](config['root'],_0x30da('0xc5'),_0x30da('0xc6'),_0x30da('0xc7'));var _0x3e36db=path['join'](config[_0x30da('0xc8')],_0x30da('0xc5'),'files',_0x30da('0xc9'));var _0x282eda=path[_0x30da('0xc4')](_0x2acf73,_0x1e336a);var _0x5cff98=util[_0x30da('0xca')](_0x30da('0xcb'),_0x136b22[_0x30da('0xae')]['id'],_0x1e336a);var _0x2d282d=path['join'](_0x2acf73,_0x5cff98);var _0x1f784c=[];_0x1f784c['push']({'model':db[_0x30da('0xcc')],'as':_0x30da('0xcc'),'raw':!![]});var _0x2b3b71=[{'model':db[_0x30da('0xb7')],'as':_0x30da('0xcd'),'attributes':['id',_0x30da('0x6f'),'createdAt'],'include':_0x1f784c}];return db['FaxInteraction'][_0x30da('0x5e')]({'where':{'id':_0x136b22[_0x30da('0xae')]['id']},'include':_0x2b3b71})[_0x30da('0x27')](handleEntityNotFound(_0x30e60d,null))[_0x30da('0x27')](function(_0x3977be){if(_0x3977be&&_0x3977be[_0x30da('0xcd')]){var _0x2f0f9c=_0x3977be[_0x30da('0xce')]({'plain':!![]});fs[_0x30da('0xcf')](_0x282eda);for(var _0x137f03=0x0;_0x137f03<_0x2f0f9c[_0x30da('0xcd')][_0x30da('0x46')];_0x137f03++){var _0x1a9dcc=_0x2f0f9c[_0x30da('0xcd')][_0x137f03]['Attachment'];if(_0x1a9dcc){var _0x16bc53=path[_0x30da('0xc4')](_0x3e36db,_0x1a9dcc[_0x30da('0xd0')]);if(fs[_0x30da('0xd1')](_0x16bc53)){fs[_0x30da('0xd2')](_0x16bc53)[_0x30da('0xd3')](fs[_0x30da('0xd4')](path[_0x30da('0xc4')](_0x282eda,_0x1a9dcc[_0x30da('0xd0')])));}}}return BPromise[_0x30da('0xd5')]()[_0x30da('0x27')](function(){return new BPromise(function(_0xe8fc18,_0x323286){zipdir(_0x282eda,{'saveTo':_0x2d282d},function(_0x2d9fb1,_0x1f2b27){if(_0x2d9fb1)return _0x323286(_0x2d9fb1);return _0xe8fc18(_0x1f2b27);});})[_0x30da('0x27')](function(){return new BPromise(function(_0x3bde69,_0x4d8b9c){rimraf(_0x282eda,function(_0x5ca8d6){if(_0x5ca8d6)_0x4d8b9c(_0x5ca8d6);return _0x3bde69();});});})[_0x30da('0x27')](function(){return _0x30e60d[_0x30da('0xc2')](_0x2d282d,_0x5cff98,function(_0x1505a8){if(_0x1505a8){console[_0x30da('0xd6')](_0x30da('0xd7'),_0x1505a8);}else{fs[_0x30da('0xd8')](_0x2d282d);}});});});}else{return _0x30e60d['sendStatus'](0xc8);}})['catch'](handleError(_0x30e60d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 20536f0..ec5ff43 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 _0x5cae=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','length'];(function(_0x25f14d,_0x4f9cce){var _0x4c9e53=function(_0x139468){while(--_0x139468){_0x25f14d['push'](_0x25f14d['shift']());}};_0x4c9e53(++_0x4f9cce);}(_0x5cae,0x15a));var _0xe5ca=function(_0x2baf40,_0x5ebef2){_0x2baf40=_0x2baf40-0x0;var _0x2bb2cb=_0x5cae[_0x2baf40];return _0x2bb2cb;};'use strict';var EventEmitter=require(_0xe5ca('0x0'));var FaxInteraction=require(_0xe5ca('0x1'))['db'][_0xe5ca('0x2')];var FaxMessage=require(_0xe5ca('0x1'))['db'][_0xe5ca('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe5ca('0x4')](0x0);var events={'afterCreate':_0xe5ca('0x5'),'afterUpdate':_0xe5ca('0x6'),'afterDestroy':_0xe5ca('0x7')};function emitEvent(_0x7df9ed){return function(_0x45ab7e,_0x1dcba4,_0x141631){_0x45ab7e[_0xe5ca('0x8')]({'attributes':['id'],'raw':!![]})[_0xe5ca('0x9')](function(_0x14eb6f){_0x45ab7e['setDataValue'](_0xe5ca('0xa'),_0x14eb6f[_0xe5ca('0xb')](function(_0x3195a0){return{'id':_0x3195a0['id']};}));return FaxMessage[_0xe5ca('0xc')]({'where':{'FaxInteractionId':_0x45ab7e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x55f705){_0x45ab7e[_0xe5ca('0xd')]('unreadMessages',_0x55f705[_0xe5ca('0xe')]);FaxInteractionEvents['emit'](_0x7df9ed+':'+_0x45ab7e['id'],_0x45ab7e);FaxInteractionEvents[_0xe5ca('0xf')](_0x7df9ed,_0x45ab7e);_0x141631(null);})['catch'](_0x141631(null));};}for(var e in events){if(events[_0xe5ca('0x10')](e)){var event=events[e];FaxInteraction[_0xe5ca('0x11')](e,emitEvent(event));}}module[_0xe5ca('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xbe9f=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','getUsers','then','map','findAll'];(function(_0x278836,_0x141516){var _0x134a42=function(_0x12a98f){while(--_0x12a98f){_0x278836['push'](_0x278836['shift']());}};_0x134a42(++_0x141516);}(_0xbe9f,0xaa));var _0xfbe9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xbe9f[_0x1b6186];return _0x186121;};'use strict';var EventEmitter=require(_0xfbe9('0x0'));var FaxInteraction=require(_0xfbe9('0x1'))['db'][_0xfbe9('0x2')];var FaxMessage=require(_0xfbe9('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfbe9('0x3')](0x0);var events={'afterCreate':_0xfbe9('0x4'),'afterUpdate':_0xfbe9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2183f3){return function(_0x569dbd,_0x3a5d17,_0x36e8e1){_0x569dbd[_0xfbe9('0x6')]({'attributes':['id'],'raw':!![]})[_0xfbe9('0x7')](function(_0x243fed){_0x569dbd['setDataValue']('Users',_0x243fed[_0xfbe9('0x8')](function(_0x1bc0d0){return{'id':_0x1bc0d0['id']};}));return FaxMessage[_0xfbe9('0x9')]({'where':{'FaxInteractionId':_0x569dbd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbe9('0x7')](function(_0x4b9576){_0x569dbd[_0xfbe9('0xa')](_0xfbe9('0xb'),_0x4b9576['length']);FaxInteractionEvents['emit'](_0x2183f3+':'+_0x569dbd['id'],_0x569dbd);FaxInteractionEvents[_0xfbe9('0xc')](_0x2183f3,_0x569dbd);_0x36e8e1(null);})[_0xfbe9('0xd')](_0x36e8e1(null));};}for(var e in events){if(events[_0xfbe9('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 9da8d12..22cce6f 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 _0xada4=['bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x2570e2,_0x34d5f2){var _0x12dcfd=function(_0x4eb41e){while(--_0x4eb41e){_0x2570e2['push'](_0x2570e2['shift']());}};_0x12dcfd(++_0x34d5f2);}(_0xada4,0x1bc));var _0x4ada=function(_0x41633c,_0x2bfd55){_0x41633c=_0x41633c-0x0;var _0x1d72f0=_0xada4[_0x41633c];return _0x1d72f0;};'use strict';var _=require('lodash');var util=require(_0x4ada('0x0'));var logger=require(_0x4ada('0x1'))(_0x4ada('0x2'));var moment=require(_0x4ada('0x3'));var BPromise=require(_0x4ada('0x4'));var rp=require(_0x4ada('0x5'));var fs=require('fs');var path=require(_0x4ada('0x6'));var rimraf=require('rimraf');var config=require(_0x4ada('0x7'));var attributes=require(_0x4ada('0x8'));module[_0x4ada('0x9')]=function(_0x508591,_0x84040e){return _0x508591[_0x4ada('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a4fc1,_0x4e8fb6,_0x5c96a0){if(_0x3a4fc1[_0x4ada('0xb')](_0x4ada('0xc'))){_0x3a4fc1[_0x4ada('0xd')]=moment()[_0x4ada('0xe')](_0x4ada('0xf'));}_0x5c96a0(null,_0x3a4fc1);}}});}; \ No newline at end of file +var _0xb495=['fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction'];(function(_0x290d05,_0x546695){var _0x11709d=function(_0x223f5d){while(--_0x223f5d){_0x290d05['push'](_0x290d05['shift']());}};_0x11709d(++_0x546695);}(_0xb495,0x174));var _0x5b49=function(_0x357f3e,_0x50a8da){_0x357f3e=_0x357f3e-0x0;var _0x3656f1=_0xb495[_0x357f3e];return _0x3656f1;};'use strict';var _=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var logger=require(_0x5b49('0x2'))('api');var moment=require(_0x5b49('0x3'));var BPromise=require(_0x5b49('0x4'));var rp=require(_0x5b49('0x5'));var fs=require('fs');var path=require(_0x5b49('0x6'));var rimraf=require(_0x5b49('0x7'));var config=require(_0x5b49('0x8'));var attributes=require(_0x5b49('0x9'));module['exports']=function(_0x142137,_0x4bf204){return _0x142137[_0x5b49('0xa')](_0x5b49('0xb'),attributes,{'tableName':_0x5b49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa05c93,_0x34377b,_0x5db16d){if(_0xa05c93['changed'](_0x5b49('0xd'))){_0xa05c93['closedAt']=moment()[_0x5b49('0xe')](_0x5b49('0xf'));}_0x5db16d(null,_0xa05c93);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4638a32..a371622 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 _0x5b57=['addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxInteraction','update','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','then'];(function(_0x546ce8,_0x164792){var _0x3777ac=function(_0x5c4a48){while(--_0x5c4a48){_0x546ce8['push'](_0x546ce8['shift']());}};_0x3777ac(++_0x164792);}(_0x5b57,0xd7));var _0x75b5=function(_0x37fe82,_0x5e525f){_0x37fe82=_0x37fe82-0x0;var _0x1cce51=_0x5b57[_0x37fe82];return _0x1cce51;};'use strict';var _=require(_0x75b5('0x0'));var util=require(_0x75b5('0x1'));var moment=require(_0x75b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x75b5('0x3'));var fs=require('fs');var Redis=require(_0x75b5('0x4'));var db=require(_0x75b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x75b5('0x6'))('rpc');var config=require(_0x75b5('0x7'));var jayson=require(_0x75b5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x75b5('0x9')]=_[_0x75b5('0xa')](config[_0x75b5('0x9')],{'host':_0x75b5('0xb'),'port':0x18eb});var socket=require(_0x75b5('0xc'))(new Redis(config[_0x75b5('0x9')]));require('./faxInteraction.socket')[_0x75b5('0xd')](socket);function respondWithRpcPromise(_0x375f57,_0x28fff4,_0x1e3854){return new BPromise(function(_0x47f7ef,_0x43bd4f){return client[_0x75b5('0xe')](_0x375f57,_0x1e3854)['then'](function(_0x5e9e83){logger[_0x75b5('0xf')](_0x75b5('0x10'),_0x28fff4,'request\x20sent');logger[_0x75b5('0x11')](_0x75b5('0x12'),_0x28fff4,_0x75b5('0x13'),JSON['stringify'](_0x5e9e83));if(_0x5e9e83[_0x75b5('0x14')]){if(_0x5e9e83[_0x75b5('0x14')][_0x75b5('0x15')]===0x1f4){logger[_0x75b5('0x14')](_0x75b5('0x10'),_0x28fff4,_0x5e9e83[_0x75b5('0x14')]['message']);return _0x43bd4f(_0x5e9e83[_0x75b5('0x14')]['message']);}logger['error'](_0x75b5('0x10'),_0x28fff4,_0x5e9e83['error'][_0x75b5('0x16')]);return _0x47f7ef(_0x5e9e83[_0x75b5('0x14')][_0x75b5('0x16')]);}else{logger[_0x75b5('0xf')](_0x75b5('0x10'),_0x28fff4,_0x75b5('0x13'));_0x47f7ef(_0x5e9e83[_0x75b5('0x17')]['message']);}})[_0x75b5('0x18')](function(_0xabfb54){logger['error'](_0x75b5('0x10'),_0x28fff4,_0xabfb54);_0x43bd4f(_0xabfb54);});});}exports['UpdateFaxInteraction']=function(_0x41e0db){var _0x4df8a7=this;return new Promise(function(_0x1ba5b6,_0x473d83){return db[_0x75b5('0x19')][_0x75b5('0x1a')](_0x41e0db['body'],{'raw':_0x41e0db[_0x75b5('0x1b')]?_0x41e0db[_0x75b5('0x1b')][_0x75b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e0db['options']?_0x41e0db['options'][_0x75b5('0x1d')]||null:null,'attributes':_0x41e0db[_0x75b5('0x1b')]?_0x41e0db[_0x75b5('0x1b')][_0x75b5('0x1e')]||null:null,'limit':_0x41e0db[_0x75b5('0x1b')]?_0x41e0db[_0x75b5('0x1b')][_0x75b5('0x1f')]||null:null})['then'](function(_0x2d8dcf){logger[_0x75b5('0xf')](_0x75b5('0x20'),_0x41e0db);logger[_0x75b5('0x11')]('UpdateFaxInteraction',_0x41e0db,JSON[_0x75b5('0x21')](_0x2d8dcf));_0x1ba5b6(_0x2d8dcf);})['catch'](function(_0x39cdfc){logger[_0x75b5('0x14')](_0x75b5('0x20'),_0x39cdfc[_0x75b5('0x16')],_0x41e0db);_0x473d83(_0x4df8a7[_0x75b5('0x14')](0x1f4,_0x39cdfc[_0x75b5('0x16')]));});});};exports[_0x75b5('0x22')]=function(_0x371efd){return new Promise(function(_0x17fc29,_0x3196b8){return db[_0x75b5('0x19')][_0x75b5('0x23')]({'where':_0x371efd[_0x75b5('0x1b')]?_0x371efd[_0x75b5('0x1b')][_0x75b5('0x1d')]||null:null})[_0x75b5('0x24')](function(_0x3faa79){if(_0x3faa79){return _0x3faa79[_0x75b5('0x25')](_0x371efd[_0x75b5('0x26')][_0x75b5('0x27')],_['omit'](_0x371efd[_0x75b5('0x26')],[_0x75b5('0x27'),'id'])||{});}})[_0x75b5('0x28')](function(_0x378fbd){logger[_0x75b5('0xf')](_0x75b5('0x29'),_0x371efd);logger[_0x75b5('0x11')](_0x75b5('0x29'),_0x371efd,JSON[_0x75b5('0x21')](_0x378fbd));_0x17fc29(_0x378fbd);})[_0x75b5('0x18')](function(_0x55ddfd){logger['error'](_0x75b5('0x29'),_0x55ddfd[_0x75b5('0x16')],_0x371efd);_0x3196b8(_this['error'](0x1f4,_0x55ddfd[_0x75b5('0x16')]));});});}; \ No newline at end of file +var _0x21d0=['redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','stringify','catch','AddTagsToFaxInteraction','find','where','addTags','omit','ids','spread','AddTags','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x447a95,_0x478214){var _0x1c7f60=function(_0x373076){while(--_0x373076){_0x447a95['push'](_0x447a95['shift']());}};_0x1c7f60(++_0x478214);}(_0x21d0,0x1d9));var _0x021d=function(_0x113981,_0x33d50c){_0x113981=_0x113981-0x0;var _0x4f47db=_0x21d0[_0x113981];return _0x4f47db;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x021d('0x0'));var rs=require(_0x021d('0x1'));var fs=require('fs');var Redis=require(_0x021d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x021d('0x3'));var logger=require(_0x021d('0x4'))('rpc');var config=require(_0x021d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x021d('0x6')]['http']({'port':0x232a});config[_0x021d('0x7')]=_[_0x021d('0x8')](config[_0x021d('0x7')],{'host':_0x021d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x021d('0x7')]));require(_0x021d('0xa'))[_0x021d('0xb')](socket);function respondWithRpcPromise(_0x3b4721,_0x493119,_0x3c0e0c){return new BPromise(function(_0x418787,_0x4c87b7){return client[_0x021d('0xc')](_0x3b4721,_0x3c0e0c)[_0x021d('0xd')](function(_0x242fd5){logger[_0x021d('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x493119,_0x021d('0xf'));logger[_0x021d('0x10')](_0x021d('0x11'),_0x493119,_0x021d('0xf'),JSON['stringify'](_0x242fd5));if(_0x242fd5['error']){if(_0x242fd5[_0x021d('0x12')][_0x021d('0x13')]===0x1f4){logger[_0x021d('0x12')](_0x021d('0x14'),_0x493119,_0x242fd5[_0x021d('0x12')]['message']);return _0x4c87b7(_0x242fd5[_0x021d('0x12')][_0x021d('0x15')]);}logger[_0x021d('0x12')](_0x021d('0x14'),_0x493119,_0x242fd5['error'][_0x021d('0x15')]);return _0x418787(_0x242fd5[_0x021d('0x12')][_0x021d('0x15')]);}else{logger[_0x021d('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x493119,'request\x20sent');_0x418787(_0x242fd5['result'][_0x021d('0x15')]);}})['catch'](function(_0x844d2c){logger[_0x021d('0x12')](_0x021d('0x14'),_0x493119,_0x844d2c);_0x4c87b7(_0x844d2c);});});}exports[_0x021d('0x16')]=function(_0x4f40a1){var _0x5f0bdb=this;return new Promise(function(_0x3e986f,_0x3fbf7b){return db[_0x021d('0x17')][_0x021d('0x18')](_0x4f40a1[_0x021d('0x19')],{'raw':_0x4f40a1[_0x021d('0x1a')]?_0x4f40a1[_0x021d('0x1a')][_0x021d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f40a1[_0x021d('0x1a')]?_0x4f40a1[_0x021d('0x1a')]['where']||null:null,'attributes':_0x4f40a1[_0x021d('0x1a')]?_0x4f40a1[_0x021d('0x1a')][_0x021d('0x1c')]||null:null,'limit':_0x4f40a1[_0x021d('0x1a')]?_0x4f40a1['options'][_0x021d('0x1d')]||null:null})['then'](function(_0x32b45d){logger[_0x021d('0xe')](_0x021d('0x16'),_0x4f40a1);logger[_0x021d('0x10')](_0x021d('0x16'),_0x4f40a1,JSON[_0x021d('0x1e')](_0x32b45d));_0x3e986f(_0x32b45d);})[_0x021d('0x1f')](function(_0x2d8b74){logger[_0x021d('0x12')]('UpdateFaxInteraction',_0x2d8b74['message'],_0x4f40a1);_0x3fbf7b(_0x5f0bdb[_0x021d('0x12')](0x1f4,_0x2d8b74['message']));});});};exports[_0x021d('0x20')]=function(_0xc389e2){return new Promise(function(_0x234ede,_0x16f9c2){return db[_0x021d('0x17')][_0x021d('0x21')]({'where':_0xc389e2['options']?_0xc389e2[_0x021d('0x1a')][_0x021d('0x22')]||null:null})[_0x021d('0xd')](function(_0xde480b){if(_0xde480b){return _0xde480b[_0x021d('0x23')](_0xc389e2[_0x021d('0x19')]['ids'],_[_0x021d('0x24')](_0xc389e2[_0x021d('0x19')],[_0x021d('0x25'),'id'])||{});}})[_0x021d('0x26')](function(_0x59e058){logger[_0x021d('0xe')](_0x021d('0x27'),_0xc389e2);logger[_0x021d('0x10')](_0x021d('0x27'),_0xc389e2,JSON[_0x021d('0x1e')](_0x59e058));_0x234ede(_0x59e058);})[_0x021d('0x1f')](function(_0xf024c5){logger[_0x021d('0x12')](_0x021d('0x27'),_0xf024c5[_0x021d('0x15')],_0xc389e2);_0x16f9c2(_this[_0x021d('0x12')](0x1f4,_0xf024c5[_0x021d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dfd116a..612efcd 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 _0xf768=['save','remove','update','emit','length','faxInteraction:','./faxInteraction.events'];(function(_0x1e21ac,_0x48deb3){var _0x3aa512=function(_0x40bcd0){while(--_0x40bcd0){_0x1e21ac['push'](_0x1e21ac['shift']());}};_0x3aa512(++_0x48deb3);}(_0xf768,0x117));var _0x8f76=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf768[_0x6131cd];return _0x47e916;};'use strict';var FaxInteractionEvents=require(_0x8f76('0x0'));var events=[_0x8f76('0x1'),_0x8f76('0x2'),_0x8f76('0x3')];function createListener(_0x2117eb,_0x364ddc){return function(_0xbb81d4){_0x364ddc[_0x8f76('0x4')](_0x2117eb,_0xbb81d4);};}function removeListener(_0x21447f,_0x21d457){return function(){FaxInteractionEvents['removeListener'](_0x21447f,_0x21d457);};}exports['register']=function(_0x563a3d){for(var _0xf9ce2b=0x0,_0x22dfdb=events[_0x8f76('0x5')];_0xf9ce2b<_0x22dfdb;_0xf9ce2b++){var _0x2f5aa9=events[_0xf9ce2b];var _0x1e0153=createListener(_0x8f76('0x6')+_0x2f5aa9,_0x563a3d);FaxInteractionEvents['on'](_0x2f5aa9,_0x1e0153);}}; \ No newline at end of file +var _0x2ca5=['faxInteraction:','./faxInteraction.events','save','remove','removeListener','register','length'];(function(_0x18fd0b,_0xe0f9ed){var _0x3b19a3=function(_0xde37ae){while(--_0xde37ae){_0x18fd0b['push'](_0x18fd0b['shift']());}};_0x3b19a3(++_0xe0f9ed);}(_0x2ca5,0x12e));var _0x52ca=function(_0x2f5dad,_0x4313ad){_0x2f5dad=_0x2f5dad-0x0;var _0x38e02d=_0x2ca5[_0x2f5dad];return _0x38e02d;};'use strict';var FaxInteractionEvents=require(_0x52ca('0x0'));var events=[_0x52ca('0x1'),_0x52ca('0x2'),'update'];function createListener(_0x494837,_0x51216c){return function(_0xfa7646){_0x51216c['emit'](_0x494837,_0xfa7646);};}function removeListener(_0x5a901c,_0x48a11b){return function(){FaxInteractionEvents[_0x52ca('0x3')](_0x5a901c,_0x48a11b);};}exports[_0x52ca('0x4')]=function(_0x45095d){for(var _0x327ad6=0x0,_0x12c739=events[_0x52ca('0x5')];_0x327ad6<_0x12c739;_0x327ad6++){var _0x316bc4=events[_0x327ad6];var _0x5bea66=createListener(_0x52ca('0x6')+_0x316bc4,_0x45095d);FaxInteractionEvents['on'](_0x316bc4,_0x5bea66);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 377826c..a5dfe48 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 _0xd56f=['download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x36c7c9,_0x4c2ecb){var _0x1f11e9=function(_0x359afc){while(--_0x359afc){_0x36c7c9['push'](_0x36c7c9['shift']());}};_0x1f11e9(++_0x4c2ecb);}(_0xd56f,0xe8));var _0xfd56=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xd56f[_0x154983];return _0x3d1243;};'use strict';var multer=require(_0xfd56('0x0'));var util=require(_0xfd56('0x1'));var path=require(_0xfd56('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd56('0x3'));var router=express['Router']();var fs_extra=require(_0xfd56('0x4'));var auth=require(_0xfd56('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd56('0x6'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0xfd56('0x7')](),controller[_0xfd56('0x8')]);router[_0xfd56('0x9')](_0xfd56('0xa'),auth[_0xfd56('0x7')](),controller[_0xfd56('0xb')]);router[_0xfd56('0x9')](_0xfd56('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfd56('0x9')](_0xfd56('0xd'),auth[_0xfd56('0x7')](),controller[_0xfd56('0xe')]);router[_0xfd56('0x9')](_0xfd56('0xf'),auth[_0xfd56('0x7')](),controller[_0xfd56('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfd56('0x11')](_0xfd56('0xd'),auth[_0xfd56('0x7')](),controller[_0xfd56('0x12')]);router[_0xfd56('0x11')](_0xfd56('0x13'),auth[_0xfd56('0x7')](),interaction[_0xfd56('0x14')](_0xfd56('0x15'),_0xfd56('0x16')),controller['addTags']);router[_0xfd56('0x17')](_0xfd56('0xc'),auth[_0xfd56('0x7')](),interaction[_0xfd56('0x14')]('fax',_0xfd56('0x18')),controller[_0xfd56('0x19')]);router[_0xfd56('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xfd56('0x14')](_0xfd56('0x15'),_0xfd56('0x1b')),controller[_0xfd56('0x1c')]);router[_0xfd56('0x1a')](_0xfd56('0x13'),auth['isAuthenticated'](),controller[_0xfd56('0x1d')]);module[_0xfd56('0x1e')]=router; \ No newline at end of file +var _0x40e4=['./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x32ceb0,_0x3255d4){var _0x58c500=function(_0x2e2516){while(--_0x2e2516){_0x32ceb0['push'](_0x32ceb0['shift']());}};_0x58c500(++_0x3255d4);}(_0x40e4,0xf9));var _0x440e=function(_0x397d61,_0x1f2002){_0x397d61=_0x397d61-0x0;var _0x270833=_0x40e4[_0x397d61];return _0x270833;};'use strict';var multer=require(_0x440e('0x0'));var util=require(_0x440e('0x1'));var path=require(_0x440e('0x2'));var timeout=require(_0x440e('0x3'));var express=require('express');var router=express[_0x440e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x440e('0x5'));var config=require(_0x440e('0x6'));var controller=require(_0x440e('0x7'));router[_0x440e('0x8')]('/',auth[_0x440e('0x9')](),controller[_0x440e('0xa')]);router['get'](_0x440e('0xb'),auth[_0x440e('0x9')](),controller[_0x440e('0xc')]);router[_0x440e('0x8')](_0x440e('0xd'),auth['isAuthenticated'](),controller[_0x440e('0xe')]);router['get'](_0x440e('0xf'),auth[_0x440e('0x9')](),controller[_0x440e('0x10')]);router[_0x440e('0x8')](_0x440e('0x11'),auth[_0x440e('0x9')](),controller[_0x440e('0x12')]);router[_0x440e('0x13')]('/',auth[_0x440e('0x9')](),controller[_0x440e('0x14')]);router['post']('/:id/messages',auth[_0x440e('0x9')](),controller[_0x440e('0x15')]);router[_0x440e('0x13')](_0x440e('0x16'),auth[_0x440e('0x9')](),interaction[_0x440e('0x17')](_0x440e('0x18'),'faxinteraction:addtags'),controller[_0x440e('0x19')]);router[_0x440e('0x1a')](_0x440e('0xd'),auth[_0x440e('0x9')](),interaction['tracked'](_0x440e('0x18'),'faxinteraction:update'),controller[_0x440e('0x1b')]);router[_0x440e('0x1c')](_0x440e('0xd'),auth[_0x440e('0x9')](),interaction[_0x440e('0x17')](_0x440e('0x18'),_0x440e('0x1d')),controller[_0x440e('0x1e')]);router[_0x440e('0x1c')](_0x440e('0x16'),auth['isAuthenticated'](),controller[_0x440e('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 20b3299..7d12a56 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 _0x61a5=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5b2f21,_0x2fb148){var _0x2a0468=function(_0xa2e514){while(--_0xa2e514){_0x5b2f21['push'](_0x5b2f21['shift']());}};_0x2a0468(++_0x2fb148);}(_0x61a5,0xf0));var _0x561a=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x61a5[_0x416cdc];return _0x1931ce;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'body':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x561a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x561a('0x4')]('in',_0x561a('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x561a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x561a('0x6')]}}; \ No newline at end of file +var _0xf25a=['exports','TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x514ab5,_0x4782c5){var _0x68285c=function(_0x37050d){while(--_0x37050d){_0x514ab5['push'](_0x514ab5['shift']());}};_0x68285c(++_0x4782c5);}(_0xf25a,0x195));var _0xaf25=function(_0x5a3f55,_0xfbe0b9){_0x5a3f55=_0x5a3f55-0x0;var _0x529c4e=_0xf25a[_0x5a3f55];return _0x529c4e;};'use strict';var Sequelize=require(_0xaf25('0x0'));module[_0xaf25('0x1')]={'body':{'type':Sequelize[_0xaf25('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaf25('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf25('0x4')]('in',_0xaf25('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xaf25('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xaf25('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 710f95f..3cce8ef 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 _0xa3c1=['merge','VIRTUAL','includeAll','include','findAll','rows','params','find','body','describe','fax-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','interface','channel','motionChannel','event','EventManager','acceptmessage','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','attachments','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','sendStatus','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0xa3c1,0xc6));var _0x1a3c=function(_0x45bc98,_0x5af370){_0x45bc98=_0x45bc98-0x0;var _0x2c44f0=_0xa3c1[_0x45bc98];return _0x2c44f0;};'use strict';var emlformat=require(_0x1a3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a3c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a3c('0x2'));var moment=require(_0x1a3c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1a3c('0x4'));var util=require(_0x1a3c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1a3c('0x6'));var ejs=require(_0x1a3c('0x7'));var fs=require('fs');var fs_extra=require(_0x1a3c('0x8'));var _=require(_0x1a3c('0x9'));var squel=require(_0x1a3c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1a3c('0xb'));var toCsv=require(_0x1a3c('0x6'));var querystring=require(_0x1a3c('0xc'));var Papa=require(_0x1a3c('0xd'));var Redis=require('ioredis');var authService=require(_0x1a3c('0xe'));var qs=require(_0x1a3c('0xf'));var as=require(_0x1a3c('0x10'));var hardwareService=require(_0x1a3c('0x11'));var logger=require(_0x1a3c('0x12'))('api');var utils=require(_0x1a3c('0x13'));var config=require(_0x1a3c('0x14'));var licenseUtil=require(_0x1a3c('0x15'));var db=require(_0x1a3c('0x16'))['db'];config['redis']=_[_0x1a3c('0x17')](config[_0x1a3c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a3c('0x19'))(new Redis(config['redis']));require(_0x1a3c('0x1a'))[_0x1a3c('0x1b')](socket);var jayson=require(_0x1a3c('0x1c'));var client=jayson[_0x1a3c('0x1d')][_0x1a3c('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x1a3c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x29fce4,_0x1ddc8a,_0x5ec93d,_0x3aa898){return new BPromise(function(_0x5683c2,_0x28e581){var _0xe3d782=_0x3aa898||client;return _0xe3d782[_0x1a3c('0x1f')](_0x29fce4,_0x5ec93d)[_0x1a3c('0x20')](function(_0x832e9b){logger['info'](_0x1a3c('0x21'),_0x1ddc8a,_0x1a3c('0x22'));logger[_0x1a3c('0x23')](_0x1a3c('0x24'),_0x1ddc8a,_0x1a3c('0x22'),JSON[_0x1a3c('0x25')](_0x832e9b));if(_0x832e9b[_0x1a3c('0x26')]){if(_0x832e9b[_0x1a3c('0x26')][_0x1a3c('0x27')]===0x1f4){logger[_0x1a3c('0x26')](_0x1a3c('0x21'),_0x1ddc8a,_0x832e9b[_0x1a3c('0x26')][_0x1a3c('0x28')]);return _0x28e581(_0x832e9b[_0x1a3c('0x26')]['message']);}logger[_0x1a3c('0x26')]('FaxMessage,\x20%s,\x20%s',_0x1ddc8a,_0x832e9b['error'][_0x1a3c('0x28')]);return _0x5683c2(_0x832e9b['error'][_0x1a3c('0x28')]);}else{logger[_0x1a3c('0x29')](_0x1a3c('0x21'),_0x1ddc8a,_0x1a3c('0x22'));_0x5683c2(_0x832e9b['result'][_0x1a3c('0x28')]);}})[_0x1a3c('0x2a')](function(_0x47195f){logger['error'](_0x1a3c('0x21'),_0x1ddc8a,_0x47195f);_0x28e581(_0x47195f);});});}function respondWithStatusCode(_0x3bae09,_0x5cfdec){_0x5cfdec=_0x5cfdec||0xcc;return function(_0x4a53fb){if(_0x4a53fb){return _0x3bae09['sendStatus'](_0x5cfdec);}return _0x3bae09[_0x1a3c('0x2b')](_0x5cfdec)[_0x1a3c('0x2c')]();};}function respondWithResult(_0xa36f6f,_0x16613b){_0x16613b=_0x16613b||0xc8;return function(_0x16ab55){if(_0x16ab55){return _0xa36f6f['status'](_0x16613b)[_0x1a3c('0x2d')](_0x16ab55);}};}function respondWithFilteredResult(_0x16f3d4,_0x13a02b){return function(_0x437997){if(_0x437997){var _0x1c8aab=typeof _0x13a02b['offset']===_0x1a3c('0x2e')&&typeof _0x13a02b[_0x1a3c('0x2f')]===_0x1a3c('0x2e');var _0x2d21e2=_0x437997[_0x1a3c('0x30')];var _0x44927d=_0x1c8aab?0x0:_0x13a02b['offset'];var _0x476135=_0x1c8aab?_0x437997[_0x1a3c('0x30')]:_0x13a02b[_0x1a3c('0x31')]+_0x13a02b[_0x1a3c('0x2f')];var _0x333234;if(_0x476135>=_0x2d21e2){_0x476135=_0x2d21e2;_0x333234=0xc8;}else{_0x333234=0xce;}_0x16f3d4[_0x1a3c('0x2b')](_0x333234);return _0x16f3d4[_0x1a3c('0x32')]('Content-Range',_0x44927d+'-'+_0x476135+'/'+_0x2d21e2)['json'](_0x437997);}return null;};}function patchUpdates(_0x3877a9){return function(_0x1ac4fd){try{jsonpatch[_0x1a3c('0x33')](_0x1ac4fd,_0x3877a9,!![]);}catch(_0xad5a5c){return BPromise[_0x1a3c('0x34')](_0xad5a5c);}return _0x1ac4fd[_0x1a3c('0x35')]();};}function saveUpdates(_0xf34060,_0x5df056){return function(_0x29111d){if(_0x29111d){return _0x29111d[_0x1a3c('0x36')](_0xf34060)[_0x1a3c('0x20')](function(_0x7c462e){return _0x7c462e;});}return null;};}function removeEntity(_0xe14186,_0x4a4f48){return function(_0x260445){if(_0x260445){return _0x260445[_0x1a3c('0x37')]()[_0x1a3c('0x20')](function(){_0xe14186['status'](0xcc)[_0x1a3c('0x2c')]();});}};}function handleEntityNotFound(_0x1a93bb,_0x3094e0){return function(_0x26a2d7){if(!_0x26a2d7){_0x1a93bb[_0x1a3c('0x38')](0x194);}return _0x26a2d7;};}function handleError(_0xda9ae8,_0x321eb1){_0x321eb1=_0x321eb1||0x1f4;return function(_0x4f36d5){logger['error'](_0x4f36d5['stack']);if(_0x4f36d5['name']){delete _0x4f36d5[_0x1a3c('0x39')];}_0xda9ae8[_0x1a3c('0x2b')](_0x321eb1)[_0x1a3c('0x3a')](_0x4f36d5);};}exports[_0x1a3c('0x3b')]=function(_0x1cd46b,_0x2d9faf){var _0x9ab16b={},_0x4e82d3={},_0x5d2139={'count':0x0,'rows':[]};var _0x29ee33=_[_0x1a3c('0x3c')](db[_0x1a3c('0x3d')][_0x1a3c('0x3e')],function(_0x4ecfd7){return{'name':_0x4ecfd7[_0x1a3c('0x3f')],'type':_0x4ecfd7[_0x1a3c('0x40')][_0x1a3c('0x41')]};});_0x4e82d3[_0x1a3c('0x42')]=_['map'](_0x29ee33,_0x1a3c('0x39'));_0x4e82d3[_0x1a3c('0x43')]=_[_0x1a3c('0x44')](_0x1cd46b[_0x1a3c('0x43')]);_0x4e82d3[_0x1a3c('0x45')]=_[_0x1a3c('0x46')](_0x4e82d3[_0x1a3c('0x42')],_0x4e82d3[_0x1a3c('0x43')]);_0x9ab16b[_0x1a3c('0x47')]=_['intersection'](_0x4e82d3[_0x1a3c('0x42')],qs[_0x1a3c('0x48')](_0x1cd46b[_0x1a3c('0x43')]['fields']));_0x9ab16b['attributes']=_0x9ab16b[_0x1a3c('0x47')][_0x1a3c('0x49')]?_0x9ab16b[_0x1a3c('0x47')]:_0x4e82d3[_0x1a3c('0x42')];if(!_0x1cd46b['query'][_0x1a3c('0x4a')]('nolimit')){_0x9ab16b[_0x1a3c('0x2f')]=qs[_0x1a3c('0x2f')](_0x1cd46b[_0x1a3c('0x43')][_0x1a3c('0x2f')]);_0x9ab16b[_0x1a3c('0x31')]=qs[_0x1a3c('0x31')](_0x1cd46b[_0x1a3c('0x43')][_0x1a3c('0x31')]);}_0x9ab16b[_0x1a3c('0x4b')]=qs['sort'](_0x1cd46b[_0x1a3c('0x43')][_0x1a3c('0x4c')]);_0x9ab16b[_0x1a3c('0x4d')]=qs[_0x1a3c('0x45')](_[_0x1a3c('0x4e')](_0x1cd46b['query'],_0x4e82d3['filters']),_0x29ee33);if(_0x1cd46b[_0x1a3c('0x43')][_0x1a3c('0x4f')]){_0x9ab16b['where']=_[_0x1a3c('0x50')](_0x9ab16b['where'],{'$or':_[_0x1a3c('0x3c')](_0x29ee33,function(_0x2945d0){if(_0x2945d0['type']!==_0x1a3c('0x51')){var _0x35b5c5={};_0x35b5c5[_0x2945d0['name']]={'$like':'%'+_0x1cd46b['query'][_0x1a3c('0x4f')]+'%'};return _0x35b5c5;}})});}_0x9ab16b=_[_0x1a3c('0x50')]({},_0x9ab16b,_0x1cd46b['options']);var _0x16412a={'where':_0x9ab16b[_0x1a3c('0x4d')]};return db[_0x1a3c('0x3d')][_0x1a3c('0x30')](_0x16412a)['then'](function(_0x4da228){_0x5d2139[_0x1a3c('0x30')]=_0x4da228;if(_0x1cd46b[_0x1a3c('0x43')][_0x1a3c('0x52')]){_0x9ab16b[_0x1a3c('0x53')]=[{'all':!![]}];}return db[_0x1a3c('0x3d')][_0x1a3c('0x54')](_0x9ab16b);})[_0x1a3c('0x20')](function(_0x57c62c){_0x5d2139[_0x1a3c('0x55')]=_0x57c62c;return _0x5d2139;})['then'](respondWithFilteredResult(_0x2d9faf,_0x9ab16b))[_0x1a3c('0x2a')](handleError(_0x2d9faf,null));};exports['show']=function(_0x3ae1a1,_0x7ebbba){var _0x22b57c={'raw':!![],'where':{'id':_0x3ae1a1[_0x1a3c('0x56')]['id']}},_0x4de450={};_0x4de450[_0x1a3c('0x42')]=_[_0x1a3c('0x44')](db[_0x1a3c('0x3d')][_0x1a3c('0x3e')]);_0x4de450['query']=_[_0x1a3c('0x44')](_0x3ae1a1[_0x1a3c('0x43')]);_0x4de450[_0x1a3c('0x45')]=_[_0x1a3c('0x46')](_0x4de450[_0x1a3c('0x42')],_0x4de450[_0x1a3c('0x43')]);_0x22b57c[_0x1a3c('0x47')]=_[_0x1a3c('0x46')](_0x4de450[_0x1a3c('0x42')],qs[_0x1a3c('0x48')](_0x3ae1a1['query'][_0x1a3c('0x48')]));_0x22b57c[_0x1a3c('0x47')]=_0x22b57c[_0x1a3c('0x47')][_0x1a3c('0x49')]?_0x22b57c['attributes']:_0x4de450['model'];if(_0x3ae1a1[_0x1a3c('0x43')]['includeAll']){_0x22b57c[_0x1a3c('0x53')]=[{'all':!![]}];}_0x22b57c=_['merge']({},_0x22b57c,_0x3ae1a1['options']);return db[_0x1a3c('0x3d')][_0x1a3c('0x57')](_0x22b57c)[_0x1a3c('0x20')](handleEntityNotFound(_0x7ebbba,null))[_0x1a3c('0x20')](respondWithResult(_0x7ebbba,null))[_0x1a3c('0x2a')](handleError(_0x7ebbba,null));};exports[_0x1a3c('0x36')]=function(_0x2f06bd,_0x57510b){if(_0x2f06bd[_0x1a3c('0x58')]['id']){delete _0x2f06bd[_0x1a3c('0x58')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x2f06bd[_0x1a3c('0x56')]['id']}})[_0x1a3c('0x20')](handleEntityNotFound(_0x57510b,null))[_0x1a3c('0x20')](saveUpdates(_0x2f06bd['body'],null))[_0x1a3c('0x20')](respondWithResult(_0x57510b,null))['catch'](handleError(_0x57510b,null));};exports[_0x1a3c('0x37')]=function(_0x57e7f7,_0xb3e786){return db[_0x1a3c('0x3d')][_0x1a3c('0x57')]({'where':{'id':_0x57e7f7[_0x1a3c('0x56')]['id']}})[_0x1a3c('0x20')](handleEntityNotFound(_0xb3e786,null))[_0x1a3c('0x20')](removeEntity(_0xb3e786,null))[_0x1a3c('0x2a')](handleError(_0xb3e786,null));};exports[_0x1a3c('0x59')]=function(_0x2f4af0,_0x362092){return db[_0x1a3c('0x3d')][_0x1a3c('0x59')]()[_0x1a3c('0x20')](respondWithResult(_0x362092,null))[_0x1a3c('0x2a')](handleError(_0x362092,null));};var interaction_log=require(_0x1a3c('0x12'))(_0x1a3c('0x5a'));exports[_0x1a3c('0x5b')]=function(_0x329142,_0x50c99b,_0x2004f3){var _0x4e6d76={'agent':{},'channel':'fax'};if(_0x329142[_0x1a3c('0x58')]['id']){delete _0x329142[_0x1a3c('0x58')]['id'];}_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5c')]=!![];_0x329142[_0x1a3c('0x58')]['readAt']=moment()[_0x1a3c('0x5d')](_0x1a3c('0x5e'));_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')]=_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')]||_0x329142[_0x1a3c('0x60')]['id'];_0x4e6d76[_0x1a3c('0x61')]['id']=_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')];return db[_0x1a3c('0x3d')][_0x1a3c('0x57')]({'where':{'id':_0x329142[_0x1a3c('0x56')]['id'],'UserId':null}})[_0x1a3c('0x20')](handleEntityNotFound(_0x50c99b,null))['then'](saveUpdates(_0x329142[_0x1a3c('0x58')],null))[_0x1a3c('0x20')](function(_0x47eb29){if(_0x47eb29){_0x4e6d76[_0x1a3c('0x28')]=_0x47eb29[_0x1a3c('0x62')]({'plain':!![]});return db[_0x1a3c('0x63')][_0x1a3c('0x57')]({'where':{'id':_0x47eb29['FaxInteractionId']}});}return null;})[_0x1a3c('0x20')](handleEntityNotFound(_0x50c99b,null))[_0x1a3c('0x20')](function(_0x1a42ab){if(_0x1a42ab){return _0x1a42ab['update']({'UserId':_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')],'read1stAt':_[_0x1a3c('0x64')](_0x1a42ab[_0x1a3c('0x65')])?moment()[_0x1a3c('0x5d')](_0x1a3c('0x5e')):undefined});}return null;})[_0x1a3c('0x20')](function(_0x1e92ce){if(_0x1e92ce){_0x4e6d76[_0x1a3c('0x66')]=_0x1e92ce[_0x1a3c('0x62')]({'plain':!![]});interaction_log[_0x1a3c('0x29')](_0x1a3c('0x67'),_0x329142[_0x1a3c('0x60')]['id'],_0x329142['user'][_0x1a3c('0x39')],_0x329142[_0x1a3c('0x60')]['role'],_0x4e6d76[_0x1a3c('0x66')]['id'],_0x329142[_0x1a3c('0x58')]?JSON[_0x1a3c('0x25')](_0x329142[_0x1a3c('0x58')]):_0x1a3c('0x68'));return respondWithRpcPromise(_0x1a3c('0x69'),'acceptMessage',_0x4e6d76);}return null;})[_0x1a3c('0x20')](function(_0x4737f9){var _0x1d124c=_0x1a3c('0x6a')+_0x4737f9[_0x1a3c('0x28')][_0x1a3c('0x6b')];return db[_0x1a3c('0x6c')][_0x1a3c('0x43')](_0x1d124c,{'type':db[_0x1a3c('0x6d')][_0x1a3c('0x6e')][_0x1a3c('0x6f')],'raw':!![]})[_0x1a3c('0x20')](function(_0x372321){return _0x372321;});})['then'](function(_0x33237e){if(_0x33237e){_0x4e6d76['message']['contact']=_0x33237e[0x0];if(!_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')])return;return db[_0x1a3c('0x70')][_0x1a3c('0x57')]({'where':{'id':_0x329142[_0x1a3c('0x58')][_0x1a3c('0x5f')],'role':_0x1a3c('0x61')},'attributes':['id','name',_0x1a3c('0x71'),_0x1a3c('0x72'),'internal'],'raw':!![]});}return null;})[_0x1a3c('0x20')](function(_0x15342b){if(!_0x15342b)return null;_0x4e6d76[_0x1a3c('0x28')][_0x1a3c('0x61')]=_0x15342b;return _0x4e6d76;})[_0x1a3c('0x20')](function(_0x27094e){if(_0x27094e){if(_0x329142['body']['manual']){_0x4e6d76[_0x1a3c('0x28')][_0x1a3c('0x73')]=util[_0x1a3c('0x5d')]('SIP/%s',_0x329142[_0x1a3c('0x60')][_0x1a3c('0x39')]);_0x4e6d76[_0x1a3c('0x28')][_0x1a3c('0x74')]=_0x4e6d76[_0x1a3c('0x74')];_0x4e6d76['message'][_0x1a3c('0x75')]=_0x4e6d76[_0x1a3c('0x74')];_0x4e6d76[_0x1a3c('0x28')][_0x1a3c('0x76')]='accept';return respondWithRpcPromise(_0x1a3c('0x77'),'EventManager',{'event':_0x1a3c('0x78'),'message':_0x4e6d76['message']},client9002)['then'](function(){return _0x4e6d76;});}return _0x4e6d76;}return null;})['then'](respondWithResult(_0x50c99b,null))[_0x1a3c('0x2a')](handleError(_0x50c99b,null));};var interaction_log=require(_0x1a3c('0x12'))(_0x1a3c('0x5a'));exports[_0x1a3c('0x34')]=function(_0x3e0003,_0x435d4f,_0x2b1978){var _0x37a783={'agent':{},'channel':_0x1a3c('0x79')};if(_0x3e0003[_0x1a3c('0x58')]['id']){delete _0x3e0003[_0x1a3c('0x58')]['id'];}_0x3e0003['body'][_0x1a3c('0x5f')]=_0x3e0003[_0x1a3c('0x58')][_0x1a3c('0x5f')]||_0x3e0003[_0x1a3c('0x60')]['id'];_0x37a783['agent']['id']=_0x3e0003[_0x1a3c('0x58')][_0x1a3c('0x5f')];return db[_0x1a3c('0x3d')][_0x1a3c('0x57')]({'where':{'id':_0x3e0003[_0x1a3c('0x56')]['id'],'UserId':null}})[_0x1a3c('0x20')](handleEntityNotFound(_0x435d4f,null))[_0x1a3c('0x20')](function(_0x43c918){if(_0x43c918){_0x37a783[_0x1a3c('0x28')]=_0x43c918['get']({'plain':!![]});return db[_0x1a3c('0x63')]['find']({'where':{'id':_0x43c918[_0x1a3c('0x7a')]}});}return null;})[_0x1a3c('0x20')](handleEntityNotFound(_0x435d4f,null))[_0x1a3c('0x20')](function(_0x203ffe){if(_0x203ffe){_0x37a783[_0x1a3c('0x66')]=_0x203ffe[_0x1a3c('0x62')]({'plain':!![]});interaction_log[_0x1a3c('0x29')](_0x1a3c('0x7b'),_0x3e0003['user']['id'],_0x3e0003[_0x1a3c('0x60')][_0x1a3c('0x39')],_0x3e0003[_0x1a3c('0x60')][_0x1a3c('0x7c')],_0x37a783[_0x1a3c('0x66')]['id'],_0x3e0003[_0x1a3c('0x58')]?JSON['stringify'](_0x3e0003[_0x1a3c('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x1a3c('0x7d'),_0x37a783);}return null;})[_0x1a3c('0x20')](function(_0x2350e0){var _0x4f2f19=_0x1a3c('0x6a')+_0x2350e0[_0x1a3c('0x28')][_0x1a3c('0x6b')];return db[_0x1a3c('0x6c')][_0x1a3c('0x43')](_0x4f2f19,{'type':db['Sequelize'][_0x1a3c('0x6e')][_0x1a3c('0x6f')],'raw':!![]})['then'](function(_0x3f0761){return _0x3f0761;});})[_0x1a3c('0x20')](function(_0x82dd30){if(_0x82dd30){_0x37a783[_0x1a3c('0x28')]['contact']=_0x82dd30[0x0];if(!_0x3e0003[_0x1a3c('0x58')]['UserId'])return;return db[_0x1a3c('0x70')]['find']({'where':{'id':_0x3e0003['body'][_0x1a3c('0x5f')],'role':'agent'},'attributes':['id',_0x1a3c('0x39'),'fullname',_0x1a3c('0x72'),'internal'],'raw':!![]});}return null;})[_0x1a3c('0x20')](function(_0x44b541){if(!_0x44b541)return null;_0x37a783[_0x1a3c('0x28')][_0x1a3c('0x61')]=_0x44b541;return _0x37a783;})['then'](function(_0x2c19e9){if(_0x2c19e9){_0x2c19e9['message'][_0x1a3c('0x73')]=util[_0x1a3c('0x5d')](_0x1a3c('0x7e'),_0x3e0003[_0x1a3c('0x60')][_0x1a3c('0x39')]);_0x2c19e9[_0x1a3c('0x28')][_0x1a3c('0x74')]=_0x37a783[_0x1a3c('0x74')];_0x2c19e9[_0x1a3c('0x28')]['motionChannel']=_0x37a783[_0x1a3c('0x74')];_0x2c19e9['message'][_0x1a3c('0x76')]=_0x1a3c('0x34');respondWithRpcPromise(_0x1a3c('0x77'),_0x1a3c('0x77'),{'event':'rejectmessage','message':_0x2c19e9['message']},client9002);return _0x37a783;}return null;})['then'](respondWithResult(_0x435d4f,null))['catch'](handleError(_0x435d4f,null));};exports['create']=function(_0x532036,_0x33de33){var _0x4eb1ad;return db['FaxMessage'][_0x1a3c('0x7f')](_0x532036[_0x1a3c('0x58')],{})[_0x1a3c('0x20')](function(_0x156ecf){_0x4eb1ad=_0x156ecf;return db[_0x1a3c('0x80')][_0x1a3c('0x81')]({'where':{'id':_0x4eb1ad[_0x1a3c('0x6b')]}});})[_0x1a3c('0x20')](function(_0x28598b){if(_[_0x1a3c('0x64')](_0x28598b)){return;}else{_0x4eb1ad[_0x1a3c('0x79')]=_0x28598b[_0x1a3c('0x79')];return db[_0x1a3c('0x82')]['findOne']({'where':{'id':_0x4eb1ad[_0x1a3c('0x83')]}});}})[_0x1a3c('0x20')](function(_0x20913e){return respondWithRpcPromise(_0x1a3c('0x84'),_0x1a3c('0x84'),{'FaxAccountId':_[_0x1a3c('0x64')](_0x532036[_0x1a3c('0x58')])?undefined:_0x532036['body'][_0x1a3c('0x85')],'path':_[_0x1a3c('0x64')](_0x20913e)?undefined:util[_0x1a3c('0x5d')](_0x1a3c('0x86'),_0x20913e[_0x1a3c('0x87')]),'fax':_[_0x1a3c('0x64')](_0x4eb1ad[_0x1a3c('0x79')])?undefined:_0x4eb1ad['fax'],'AttachmentId':_0x4eb1ad[_0x1a3c('0x83')]},client9002);})[_0x1a3c('0x20')](respondWithResult(_0x33de33,0xc9))['catch'](handleError(_0x33de33,null));};exports[_0x1a3c('0x88')]=function(_0x5782f7,_0x3c4e0b){var _0x221a85=path[_0x1a3c('0x89')](config['root'],'server','files',_0x1a3c('0x8a'));return db[_0x1a3c('0x3d')][_0x1a3c('0x57')]({'where':{'id':_0x5782f7[_0x1a3c('0x56')]['id']},'include':[{'model':db[_0x1a3c('0x82')],'as':_0x1a3c('0x82')}]})['then'](handleEntityNotFound(_0x3c4e0b,null))[_0x1a3c('0x20')](function(_0x975930){if(_0x975930){return _0x3c4e0b[_0x1a3c('0x88')](path[_0x1a3c('0x89')](_0x221a85,_0x975930['Attachment'][_0x1a3c('0x87')]));}})[_0x1a3c('0x2a')](handleError(_0x3c4e0b,null));}; \ No newline at end of file +var _0xacc8=['interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','email','motionChannel','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','body','params','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt'];(function(_0x56fd3a,_0x3d3b03){var _0x29799d=function(_0x55bda5){while(--_0x55bda5){_0x56fd3a['push'](_0x56fd3a['shift']());}};_0x29799d(++_0x3d3b03);}(_0xacc8,0x14a));var _0x8acc=function(_0x18f80b,_0x46368a){_0x18f80b=_0x18f80b-0x0;var _0x54a62d=_0xacc8[_0x18f80b];return _0x54a62d;};'use strict';var emlformat=require(_0x8acc('0x0'));var rimraf=require(_0x8acc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8acc('0x2'));var moment=require(_0x8acc('0x3'));var BPromise=require(_0x8acc('0x4'));var Mustache=require(_0x8acc('0x5'));var util=require(_0x8acc('0x6'));var path=require('path');var sox=require(_0x8acc('0x7'));var csv=require('to-csv');var ejs=require(_0x8acc('0x8'));var fs=require('fs');var fs_extra=require(_0x8acc('0x9'));var _=require(_0x8acc('0xa'));var squel=require(_0x8acc('0xb'));var crypto=require(_0x8acc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8acc('0xd'));var toCsv=require(_0x8acc('0xe'));var querystring=require('querystring');var Papa=require(_0x8acc('0xf'));var Redis=require(_0x8acc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8acc('0x11'));var as=require(_0x8acc('0x12'));var hardwareService=require(_0x8acc('0x13'));var logger=require(_0x8acc('0x14'))(_0x8acc('0x15'));var utils=require(_0x8acc('0x16'));var config=require(_0x8acc('0x17'));var licenseUtil=require(_0x8acc('0x18'));var db=require('../../mysqldb')['db'];config[_0x8acc('0x19')]=_['defaults'](config[_0x8acc('0x19')],{'host':_0x8acc('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8acc('0x19')]));require('./faxMessage.socket')[_0x8acc('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8acc('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x8acc('0x1c')][_0x8acc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x59be8b,_0x4d470c,_0x3a9976,_0x2e3bce){return new BPromise(function(_0x52953f,_0x3c75a9){var _0x1e209d=_0x2e3bce||client;return _0x1e209d[_0x8acc('0x1e')](_0x59be8b,_0x3a9976)[_0x8acc('0x1f')](function(_0x3d4721){logger[_0x8acc('0x20')](_0x8acc('0x21'),_0x4d470c,_0x8acc('0x22'));logger[_0x8acc('0x23')](_0x8acc('0x24'),_0x4d470c,_0x8acc('0x22'),JSON[_0x8acc('0x25')](_0x3d4721));if(_0x3d4721[_0x8acc('0x26')]){if(_0x3d4721[_0x8acc('0x26')]['code']===0x1f4){logger[_0x8acc('0x26')](_0x8acc('0x21'),_0x4d470c,_0x3d4721['error'][_0x8acc('0x27')]);return _0x3c75a9(_0x3d4721[_0x8acc('0x26')][_0x8acc('0x27')]);}logger[_0x8acc('0x26')](_0x8acc('0x21'),_0x4d470c,_0x3d4721['error'][_0x8acc('0x27')]);return _0x52953f(_0x3d4721['error']['message']);}else{logger[_0x8acc('0x20')]('FaxMessage,\x20%s,\x20%s',_0x4d470c,'request\x20sent');_0x52953f(_0x3d4721[_0x8acc('0x28')][_0x8acc('0x27')]);}})['catch'](function(_0x5b6a1f){logger['error'](_0x8acc('0x21'),_0x4d470c,_0x5b6a1f);_0x3c75a9(_0x5b6a1f);});});}function respondWithStatusCode(_0x19b9ab,_0x36024a){_0x36024a=_0x36024a||0xcc;return function(_0x24ea95){if(_0x24ea95){return _0x19b9ab['sendStatus'](_0x36024a);}return _0x19b9ab[_0x8acc('0x29')](_0x36024a)[_0x8acc('0x2a')]();};}function respondWithResult(_0x1e3c11,_0x131626){_0x131626=_0x131626||0xc8;return function(_0x5e5c1d){if(_0x5e5c1d){return _0x1e3c11['status'](_0x131626)[_0x8acc('0x2b')](_0x5e5c1d);}};}function respondWithFilteredResult(_0x2cf3ca,_0xe50295){return function(_0x57997a){if(_0x57997a){var _0x1cd012=typeof _0xe50295[_0x8acc('0x2c')]===_0x8acc('0x2d')&&typeof _0xe50295[_0x8acc('0x2e')]==='undefined';var _0x58f60f=_0x57997a[_0x8acc('0x2f')];var _0x385bbc=_0x1cd012?0x0:_0xe50295[_0x8acc('0x2c')];var _0x30990c=_0x1cd012?_0x57997a[_0x8acc('0x2f')]:_0xe50295[_0x8acc('0x2c')]+_0xe50295[_0x8acc('0x2e')];var _0x28ccf7;if(_0x30990c>=_0x58f60f){_0x30990c=_0x58f60f;_0x28ccf7=0xc8;}else{_0x28ccf7=0xce;}_0x2cf3ca[_0x8acc('0x29')](_0x28ccf7);return _0x2cf3ca[_0x8acc('0x30')](_0x8acc('0x31'),_0x385bbc+'-'+_0x30990c+'/'+_0x58f60f)['json'](_0x57997a);}return null;};}function patchUpdates(_0x18f342){return function(_0x29841e){try{jsonpatch[_0x8acc('0x32')](_0x29841e,_0x18f342,!![]);}catch(_0x58067a){return BPromise[_0x8acc('0x33')](_0x58067a);}return _0x29841e['save']();};}function saveUpdates(_0x3b90e6,_0x2ead3a){return function(_0x1de80c){if(_0x1de80c){return _0x1de80c[_0x8acc('0x34')](_0x3b90e6)[_0x8acc('0x1f')](function(_0x3f153a){return _0x3f153a;});}return null;};}function removeEntity(_0x7e90e4,_0xc33758){return function(_0x26a7b6){if(_0x26a7b6){return _0x26a7b6[_0x8acc('0x35')]()[_0x8acc('0x1f')](function(){_0x7e90e4[_0x8acc('0x29')](0xcc)[_0x8acc('0x2a')]();});}};}function handleEntityNotFound(_0x37325d,_0x5e57d1){return function(_0x4a90f4){if(!_0x4a90f4){_0x37325d[_0x8acc('0x36')](0x194);}return _0x4a90f4;};}function handleError(_0x1c26af,_0x23d0dd){_0x23d0dd=_0x23d0dd||0x1f4;return function(_0x14f7d7){logger['error'](_0x14f7d7[_0x8acc('0x37')]);if(_0x14f7d7['name']){delete _0x14f7d7[_0x8acc('0x38')];}_0x1c26af[_0x8acc('0x29')](_0x23d0dd)[_0x8acc('0x39')](_0x14f7d7);};}exports[_0x8acc('0x3a')]=function(_0xa0e578,_0x26ddf0){var _0x51c604={},_0x46eb7e={},_0xb19e04={'count':0x0,'rows':[]};var _0x1b50ab=_['map'](db[_0x8acc('0x3b')][_0x8acc('0x3c')],function(_0x1da7b9){return{'name':_0x1da7b9['fieldName'],'type':_0x1da7b9[_0x8acc('0x3d')][_0x8acc('0x3e')]};});_0x46eb7e[_0x8acc('0x3f')]=_[_0x8acc('0x40')](_0x1b50ab,_0x8acc('0x38'));_0x46eb7e[_0x8acc('0x41')]=_[_0x8acc('0x42')](_0xa0e578['query']);_0x46eb7e[_0x8acc('0x43')]=_[_0x8acc('0x44')](_0x46eb7e[_0x8acc('0x3f')],_0x46eb7e[_0x8acc('0x41')]);_0x51c604['attributes']=_[_0x8acc('0x44')](_0x46eb7e[_0x8acc('0x3f')],qs['fields'](_0xa0e578[_0x8acc('0x41')][_0x8acc('0x45')]));_0x51c604[_0x8acc('0x46')]=_0x51c604[_0x8acc('0x46')][_0x8acc('0x47')]?_0x51c604['attributes']:_0x46eb7e[_0x8acc('0x3f')];if(!_0xa0e578['query'][_0x8acc('0x48')](_0x8acc('0x49'))){_0x51c604[_0x8acc('0x2e')]=qs['limit'](_0xa0e578[_0x8acc('0x41')][_0x8acc('0x2e')]);_0x51c604[_0x8acc('0x2c')]=qs[_0x8acc('0x2c')](_0xa0e578[_0x8acc('0x41')]['offset']);}_0x51c604[_0x8acc('0x4a')]=qs[_0x8acc('0x4b')](_0xa0e578['query'][_0x8acc('0x4b')]);_0x51c604[_0x8acc('0x4c')]=qs[_0x8acc('0x43')](_[_0x8acc('0x4d')](_0xa0e578['query'],_0x46eb7e[_0x8acc('0x43')]),_0x1b50ab);if(_0xa0e578['query'][_0x8acc('0x4e')]){_0x51c604[_0x8acc('0x4c')]=_[_0x8acc('0x4f')](_0x51c604[_0x8acc('0x4c')],{'$or':_[_0x8acc('0x40')](_0x1b50ab,function(_0x221c2b){if(_0x221c2b[_0x8acc('0x3d')]!==_0x8acc('0x50')){var _0x225f0c={};_0x225f0c[_0x221c2b[_0x8acc('0x38')]]={'$like':'%'+_0xa0e578['query']['filter']+'%'};return _0x225f0c;}})});}_0x51c604=_[_0x8acc('0x4f')]({},_0x51c604,_0xa0e578[_0x8acc('0x51')]);var _0x496ac1={'where':_0x51c604[_0x8acc('0x4c')]};return db[_0x8acc('0x3b')][_0x8acc('0x2f')](_0x496ac1)[_0x8acc('0x1f')](function(_0x68d8f){_0xb19e04[_0x8acc('0x2f')]=_0x68d8f;if(_0xa0e578[_0x8acc('0x41')][_0x8acc('0x52')]){_0x51c604[_0x8acc('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x8acc('0x54')](_0x51c604);})[_0x8acc('0x1f')](function(_0x30b839){_0xb19e04[_0x8acc('0x55')]=_0x30b839;return _0xb19e04;})[_0x8acc('0x1f')](respondWithFilteredResult(_0x26ddf0,_0x51c604))[_0x8acc('0x56')](handleError(_0x26ddf0,null));};exports['show']=function(_0x2fea91,_0x5d7391){var _0x33e90e={'raw':!![],'where':{'id':_0x2fea91['params']['id']}},_0x2a7a89={};_0x2a7a89['model']=_['keys'](db[_0x8acc('0x3b')][_0x8acc('0x3c')]);_0x2a7a89['query']=_[_0x8acc('0x42')](_0x2fea91[_0x8acc('0x41')]);_0x2a7a89['filters']=_[_0x8acc('0x44')](_0x2a7a89[_0x8acc('0x3f')],_0x2a7a89[_0x8acc('0x41')]);_0x33e90e[_0x8acc('0x46')]=_[_0x8acc('0x44')](_0x2a7a89['model'],qs[_0x8acc('0x45')](_0x2fea91['query']['fields']));_0x33e90e[_0x8acc('0x46')]=_0x33e90e[_0x8acc('0x46')][_0x8acc('0x47')]?_0x33e90e[_0x8acc('0x46')]:_0x2a7a89['model'];if(_0x2fea91[_0x8acc('0x41')][_0x8acc('0x52')]){_0x33e90e[_0x8acc('0x53')]=[{'all':!![]}];}_0x33e90e=_[_0x8acc('0x4f')]({},_0x33e90e,_0x2fea91['options']);return db[_0x8acc('0x3b')][_0x8acc('0x57')](_0x33e90e)[_0x8acc('0x1f')](handleEntityNotFound(_0x5d7391,null))['then'](respondWithResult(_0x5d7391,null))[_0x8acc('0x56')](handleError(_0x5d7391,null));};exports[_0x8acc('0x34')]=function(_0x845a12,_0xa4a7a4){if(_0x845a12[_0x8acc('0x58')]['id']){delete _0x845a12[_0x8acc('0x58')]['id'];}return db[_0x8acc('0x3b')][_0x8acc('0x57')]({'where':{'id':_0x845a12[_0x8acc('0x59')]['id']}})[_0x8acc('0x1f')](handleEntityNotFound(_0xa4a7a4,null))[_0x8acc('0x1f')](saveUpdates(_0x845a12[_0x8acc('0x58')],null))['then'](respondWithResult(_0xa4a7a4,null))[_0x8acc('0x56')](handleError(_0xa4a7a4,null));};exports[_0x8acc('0x35')]=function(_0x4a40ac,_0x5d697d){return db['FaxMessage'][_0x8acc('0x57')]({'where':{'id':_0x4a40ac['params']['id']}})[_0x8acc('0x1f')](handleEntityNotFound(_0x5d697d,null))[_0x8acc('0x1f')](removeEntity(_0x5d697d,null))[_0x8acc('0x56')](handleError(_0x5d697d,null));};exports[_0x8acc('0x5a')]=function(_0xd41ba1,_0x3b2788){return db[_0x8acc('0x3b')]['describe']()[_0x8acc('0x1f')](respondWithResult(_0x3b2788,null))[_0x8acc('0x56')](handleError(_0x3b2788,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x8acc('0x5b')]=function(_0x144275,_0x4c58f4,_0x50074f){var _0x482560={'agent':{},'channel':_0x8acc('0x5c')};if(_0x144275[_0x8acc('0x58')]['id']){delete _0x144275[_0x8acc('0x58')]['id'];}_0x144275[_0x8acc('0x58')][_0x8acc('0x5d')]=!![];_0x144275[_0x8acc('0x58')][_0x8acc('0x5e')]=moment()[_0x8acc('0x5f')](_0x8acc('0x60'));_0x144275['body']['UserId']=_0x144275[_0x8acc('0x58')][_0x8acc('0x61')]||_0x144275[_0x8acc('0x62')]['id'];_0x482560[_0x8acc('0x63')]['id']=_0x144275[_0x8acc('0x58')][_0x8acc('0x61')];return db['FaxMessage'][_0x8acc('0x57')]({'where':{'id':_0x144275[_0x8acc('0x59')]['id'],'UserId':null}})[_0x8acc('0x1f')](handleEntityNotFound(_0x4c58f4,null))['then'](saveUpdates(_0x144275[_0x8acc('0x58')],null))[_0x8acc('0x1f')](function(_0x133c9b){if(_0x133c9b){_0x482560['message']=_0x133c9b[_0x8acc('0x64')]({'plain':!![]});return db[_0x8acc('0x65')]['find']({'where':{'id':_0x133c9b[_0x8acc('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4c58f4,null))[_0x8acc('0x1f')](function(_0x553ce3){if(_0x553ce3){return _0x553ce3[_0x8acc('0x34')]({'UserId':_0x144275[_0x8acc('0x58')][_0x8acc('0x61')],'read1stAt':_[_0x8acc('0x67')](_0x553ce3[_0x8acc('0x68')])?moment()[_0x8acc('0x5f')](_0x8acc('0x60')):undefined});}return null;})[_0x8acc('0x1f')](function(_0x34045a){if(_0x34045a){_0x482560[_0x8acc('0x69')]=_0x34045a[_0x8acc('0x64')]({'plain':!![]});interaction_log['info'](_0x8acc('0x6a'),_0x144275[_0x8acc('0x62')]['id'],_0x144275[_0x8acc('0x62')][_0x8acc('0x38')],_0x144275[_0x8acc('0x62')][_0x8acc('0x6b')],_0x482560[_0x8acc('0x69')]['id'],_0x144275[_0x8acc('0x58')]?JSON['stringify'](_0x144275[_0x8acc('0x58')]):'null');return respondWithRpcPromise(_0x8acc('0x6c'),_0x8acc('0x6d'),_0x482560);}return null;})[_0x8acc('0x1f')](function(_0x251160){var _0x26dd3a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x251160[_0x8acc('0x27')]['ContactId'];return db[_0x8acc('0x6e')][_0x8acc('0x41')](_0x26dd3a,{'type':db['Sequelize'][_0x8acc('0x6f')][_0x8acc('0x70')],'raw':!![]})[_0x8acc('0x1f')](function(_0xd54316){return _0xd54316;});})['then'](function(_0x13e860){if(_0x13e860){_0x482560['message']['contact']=_0x13e860[0x0];if(!_0x144275[_0x8acc('0x58')]['UserId'])return;return db[_0x8acc('0x71')][_0x8acc('0x57')]({'where':{'id':_0x144275[_0x8acc('0x58')][_0x8acc('0x61')],'role':_0x8acc('0x63')},'attributes':['id',_0x8acc('0x38'),_0x8acc('0x72'),'email',_0x8acc('0x73')],'raw':!![]});}return null;})[_0x8acc('0x1f')](function(_0xbc4002){if(!_0xbc4002)return null;_0x482560[_0x8acc('0x27')][_0x8acc('0x63')]=_0xbc4002;return _0x482560;})[_0x8acc('0x1f')](function(_0x5c3dcf){if(_0x5c3dcf){if(_0x144275['body'][_0x8acc('0x74')]){_0x482560[_0x8acc('0x27')][_0x8acc('0x75')]=util[_0x8acc('0x5f')](_0x8acc('0x76'),_0x144275[_0x8acc('0x62')]['name']);_0x482560[_0x8acc('0x27')][_0x8acc('0x77')]=_0x482560[_0x8acc('0x77')];_0x482560['message']['motionChannel']=_0x482560[_0x8acc('0x77')];_0x482560[_0x8acc('0x27')]['event']=_0x8acc('0x5b');return respondWithRpcPromise(_0x8acc('0x78'),_0x8acc('0x78'),{'event':'acceptmessage','message':_0x482560[_0x8acc('0x27')]},client9002)[_0x8acc('0x1f')](function(){return _0x482560;});}return _0x482560;}return null;})[_0x8acc('0x1f')](respondWithResult(_0x4c58f4,null))['catch'](handleError(_0x4c58f4,null));};var interaction_log=require(_0x8acc('0x14'))(_0x8acc('0x79'));exports[_0x8acc('0x33')]=function(_0x5c42b5,_0x162069,_0x553b58){var _0x19163f={'agent':{},'channel':_0x8acc('0x5c')};if(_0x5c42b5[_0x8acc('0x58')]['id']){delete _0x5c42b5[_0x8acc('0x58')]['id'];}_0x5c42b5['body'][_0x8acc('0x61')]=_0x5c42b5['body'][_0x8acc('0x61')]||_0x5c42b5[_0x8acc('0x62')]['id'];_0x19163f[_0x8acc('0x63')]['id']=_0x5c42b5[_0x8acc('0x58')][_0x8acc('0x61')];return db[_0x8acc('0x3b')][_0x8acc('0x57')]({'where':{'id':_0x5c42b5['params']['id'],'UserId':null}})[_0x8acc('0x1f')](handleEntityNotFound(_0x162069,null))[_0x8acc('0x1f')](function(_0x5c344e){if(_0x5c344e){_0x19163f[_0x8acc('0x27')]=_0x5c344e[_0x8acc('0x64')]({'plain':!![]});return db[_0x8acc('0x65')][_0x8acc('0x57')]({'where':{'id':_0x5c344e[_0x8acc('0x66')]}});}return null;})[_0x8acc('0x1f')](handleEntityNotFound(_0x162069,null))[_0x8acc('0x1f')](function(_0xa2455){if(_0xa2455){_0x19163f['interaction']=_0xa2455[_0x8acc('0x64')]({'plain':!![]});interaction_log['info'](_0x8acc('0x7a'),_0x5c42b5['user']['id'],_0x5c42b5[_0x8acc('0x62')]['name'],_0x5c42b5[_0x8acc('0x62')]['role'],_0x19163f['interaction']['id'],_0x5c42b5[_0x8acc('0x58')]?JSON[_0x8acc('0x25')](_0x5c42b5[_0x8acc('0x58')]):_0x8acc('0x7b'));return respondWithRpcPromise(_0x8acc('0x7c'),'rejectMessage',_0x19163f);}return null;})[_0x8acc('0x1f')](function(_0x1e8709){var _0x29b499=_0x8acc('0x7d')+_0x1e8709['message'][_0x8acc('0x7e')];return db[_0x8acc('0x6e')][_0x8acc('0x41')](_0x29b499,{'type':db[_0x8acc('0x7f')][_0x8acc('0x6f')][_0x8acc('0x70')],'raw':!![]})[_0x8acc('0x1f')](function(_0x59a296){return _0x59a296;});})[_0x8acc('0x1f')](function(_0x42b02c){if(_0x42b02c){_0x19163f[_0x8acc('0x27')][_0x8acc('0x80')]=_0x42b02c[0x0];if(!_0x5c42b5[_0x8acc('0x58')][_0x8acc('0x61')])return;return db[_0x8acc('0x71')][_0x8acc('0x57')]({'where':{'id':_0x5c42b5[_0x8acc('0x58')][_0x8acc('0x61')],'role':'agent'},'attributes':['id',_0x8acc('0x38'),_0x8acc('0x72'),_0x8acc('0x81'),_0x8acc('0x73')],'raw':!![]});}return null;})[_0x8acc('0x1f')](function(_0x10558b){if(!_0x10558b)return null;_0x19163f['message'][_0x8acc('0x63')]=_0x10558b;return _0x19163f;})[_0x8acc('0x1f')](function(_0x594943){if(_0x594943){_0x594943[_0x8acc('0x27')][_0x8acc('0x75')]=util[_0x8acc('0x5f')](_0x8acc('0x76'),_0x5c42b5[_0x8acc('0x62')][_0x8acc('0x38')]);_0x594943['message'][_0x8acc('0x77')]=_0x19163f[_0x8acc('0x77')];_0x594943['message'][_0x8acc('0x82')]=_0x19163f[_0x8acc('0x77')];_0x594943[_0x8acc('0x27')]['event']='reject';respondWithRpcPromise(_0x8acc('0x78'),_0x8acc('0x78'),{'event':_0x8acc('0x83'),'message':_0x594943[_0x8acc('0x27')]},client9002);return _0x19163f;}return null;})[_0x8acc('0x1f')](respondWithResult(_0x162069,null))[_0x8acc('0x56')](handleError(_0x162069,null));};exports['create']=function(_0x14df65,_0x476f22){var _0x8e90de;return db[_0x8acc('0x3b')][_0x8acc('0x84')](_0x14df65['body'],{})[_0x8acc('0x1f')](function(_0x8df72b){_0x8e90de=_0x8df72b;return db['CmContact']['findOne']({'where':{'id':_0x8e90de[_0x8acc('0x7e')]}});})['then'](function(_0xac8efe){if(_[_0x8acc('0x67')](_0xac8efe)){return;}else{_0x8e90de['fax']=_0xac8efe['fax'];return db[_0x8acc('0x85')][_0x8acc('0x86')]({'where':{'id':_0x8e90de[_0x8acc('0x87')]}});}})['then'](function(_0x171921){return respondWithRpcPromise(_0x8acc('0x88'),_0x8acc('0x88'),{'FaxAccountId':_[_0x8acc('0x67')](_0x14df65[_0x8acc('0x58')])?undefined:_0x14df65[_0x8acc('0x58')][_0x8acc('0x89')],'path':_[_0x8acc('0x67')](_0x171921)?undefined:util[_0x8acc('0x5f')](_0x8acc('0x8a'),_0x171921[_0x8acc('0x8b')]),'fax':_['isNil'](_0x8e90de[_0x8acc('0x5c')])?undefined:_0x8e90de[_0x8acc('0x5c')],'AttachmentId':_0x8e90de['AttachmentId']},client9002);})[_0x8acc('0x1f')](respondWithResult(_0x476f22,0xc9))[_0x8acc('0x56')](handleError(_0x476f22,null));};exports[_0x8acc('0x8c')]=function(_0x5dab6b,_0x19cab4){var _0x18cf8e=path[_0x8acc('0x8d')](config['root'],_0x8acc('0x8e'),_0x8acc('0x8f'),_0x8acc('0x90'));return db[_0x8acc('0x3b')][_0x8acc('0x57')]({'where':{'id':_0x5dab6b[_0x8acc('0x59')]['id']},'include':[{'model':db[_0x8acc('0x85')],'as':_0x8acc('0x85')}]})[_0x8acc('0x1f')](handleEntityNotFound(_0x19cab4,null))[_0x8acc('0x1f')](function(_0x4617dd){if(_0x4617dd){return _0x19cab4['download'](path[_0x8acc('0x8d')](_0x18cf8e,_0x4617dd[_0x8acc('0x85')][_0x8acc('0x8b')]));}})[_0x8acc('0x56')](handleError(_0x19cab4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 36a07be..dc95fa8 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 _0x1488=['events','FaxMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x81d56,_0x3fcbf6){var _0x5b4608=function(_0x3bb1fb){while(--_0x3bb1fb){_0x81d56['push'](_0x81d56['shift']());}};_0x5b4608(++_0x3fcbf6);}(_0x1488,0x88));var _0x8148=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x1488[_0x290fa6];return _0x47f1f3;};'use strict';var EventEmitter=require(_0x8148('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x8148('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8148('0x2')](0x0);var events={'afterCreate':_0x8148('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2fdd7e){return function(_0x5b1a48,_0x32d78,_0x74ecbc){FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e+':'+_0x5b1a48['id'],_0x5b1a48);FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e,_0x5b1a48);_0x74ecbc(null);};}for(var e in events){if(events[_0x8148('0x5')](e)){var event=events[e];FaxMessage[_0x8148('0x6')](e,emitEvent(event));}}module[_0x8148('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xc17d=['FaxMessage','setMaxListeners','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xc17d,0x96));var _0xdc17=function(_0x431963,_0x50f80c){_0x431963=_0x431963-0x0;var _0x20ac63=_0xc17d[_0x431963];return _0x20ac63;};'use strict';var EventEmitter=require(_0xdc17('0x0'));var FaxMessage=require(_0xdc17('0x1'))['db'][_0xdc17('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdc17('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc17('0x4'),'afterDestroy':_0xdc17('0x5')};function emitEvent(_0xcbc140){return function(_0x388e27,_0x5e261e,_0x33efa9){FaxMessageEvents['emit'](_0xcbc140+':'+_0x388e27['id'],_0x388e27);FaxMessageEvents['emit'](_0xcbc140,_0x388e27);_0x33efa9(null);};}for(var e in events){if(events[_0xdc17('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xdc17('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 cc508d4..9435053 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 _0x3336=['bluebird','request-promise','path','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','catch','error','lodash','util','../../config/logger','api','moment'];(function(_0xcf018d,_0xcdd079){var _0x58cefd=function(_0x42462a){while(--_0x42462a){_0xcf018d['push'](_0xcf018d['shift']());}};_0x58cefd(++_0xcdd079);}(_0x3336,0x1ab));var _0x6333=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x3336[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x6333('0x0'));var util=require(_0x6333('0x1'));var logger=require(_0x6333('0x2'))(_0x6333('0x3'));var moment=require(_0x6333('0x4'));var BPromise=require(_0x6333('0x5'));var rp=require(_0x6333('0x6'));var fs=require('fs');var path=require(_0x6333('0x7'));var rimraf=require('rimraf');var config=require(_0x6333('0x8'));var attributes=require('./faxMessage.attributes');module[_0x6333('0x9')]=function(_0x30dc1a,_0x587daf){return _0x30dc1a['define'](_0x6333('0xa'),attributes,{'tableName':_0x6333('0xb'),'paranoid':![],'indexes':[{'name':_0x6333('0xc'),'fields':['body'],'type':_0x6333('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x300cfc,_0xeede71,_0x3219c1){var _0x4fa730=_0x30dc1a['models'];var _0x667b3c=_0x300cfc[_0x6333('0xe')]({'plain':!![]});if(_0x667b3c[_0x6333('0xf')]['toLowerCase']()==='in'||_0x667b3c[_0x6333('0xf')][_0x6333('0x10')]()===_0x6333('0x11')&&!_0x667b3c[_0x6333('0x12')]&&!_[_0x6333('0x13')](_0x667b3c[_0x6333('0x14')])){_0x4fa730[_0x6333('0x15')]['findOne']({'where':{'id':_0x667b3c[_0x6333('0x16')]}})[_0x6333('0x17')](function(_0x13abd0){if(_0x13abd0){_0x13abd0['update']({'lastMsgAt':_0x667b3c[_0x6333('0x18')],'lastMsgDirection':_0x667b3c[_0x6333('0xf')][_0x6333('0x10')]()});}})[_0x6333('0x19')](function(_0x591319){console[_0x6333('0x1a')](_0x591319);});}_0x3219c1();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x64ff=['isNil','FaxInteraction','findOne','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret'];(function(_0x277a50,_0x1b5383){var _0x47aeae=function(_0x141d7a){while(--_0x141d7a){_0x277a50['push'](_0x277a50['shift']());}};_0x47aeae(++_0x1b5383);}(_0x64ff,0xdf));var _0xf64f=function(_0x38c673,_0x22ce73){_0x38c673=_0x38c673-0x0;var _0x5efb96=_0x64ff[_0x38c673];return _0x5efb96;};'use strict';var _=require(_0xf64f('0x0'));var util=require(_0xf64f('0x1'));var logger=require(_0xf64f('0x2'))(_0xf64f('0x3'));var moment=require(_0xf64f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf64f('0x5'));var config=require('../../config/environment');var attributes=require(_0xf64f('0x6'));module[_0xf64f('0x7')]=function(_0x12bd62,_0x29c31c){return _0x12bd62[_0xf64f('0x8')]('FaxMessage',attributes,{'tableName':_0xf64f('0x9'),'paranoid':![],'indexes':[{'name':_0xf64f('0xa'),'fields':['body'],'type':_0xf64f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34afbe,_0x252adf,_0x2bcff5){var _0x5cb1d0=_0x12bd62['models'];var _0x4b871b=_0x34afbe[_0xf64f('0xc')]({'plain':!![]});if(_0x4b871b[_0xf64f('0xd')][_0xf64f('0xe')]()==='in'||_0x4b871b[_0xf64f('0xd')][_0xf64f('0xe')]()===_0xf64f('0xf')&&!_0x4b871b[_0xf64f('0x10')]&&!_[_0xf64f('0x11')](_0x4b871b['UserId'])){_0x5cb1d0[_0xf64f('0x12')][_0xf64f('0x13')]({'where':{'id':_0x4b871b['FaxInteractionId']}})['then'](function(_0x4fd56f){if(_0x4fd56f){_0x4fd56f['update']({'lastMsgAt':_0x4b871b['createdAt'],'lastMsgDirection':_0x4b871b[_0xf64f('0xd')]['toLowerCase']()});}})[_0xf64f('0x14')](function(_0x303bfc){console[_0xf64f('0x15')](_0x303bfc);});}_0x2bcff5();}},'charset':_0xf64f('0x16'),'collate':_0xf64f('0x17')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1af6f02..39a32d7 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 _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5c12,0x188));var _0x25c1=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x5c12[_0x4f4c2a];return _0xd15be6;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file +var _0xa8a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4c032b,_0x5290c1){_0x4c032b=_0x4c032b-0x0;var _0x418fb4=_0xa8a8[_0x4c032b];return _0x418fb4;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});config[_0x8a8a('0xd')]=_[_0x8a8a('0xe')](config[_0x8a8a('0xd')],{'host':_0x8a8a('0xf'),'port':0x18eb});var socket=require(_0x8a8a('0x10'))(new Redis(config[_0x8a8a('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3c01cd,_0x497b8a,_0x11788d){return new BPromise(function(_0x3d3a00,_0x532621){return client[_0x8a8a('0x11')](_0x3c01cd,_0x11788d)[_0x8a8a('0x12')](function(_0xb13fca){logger['info'](_0x8a8a('0x13'),_0x497b8a,_0x8a8a('0x14'));logger[_0x8a8a('0x15')](_0x8a8a('0x16'),_0x497b8a,'request\x20sent',JSON[_0x8a8a('0x17')](_0xb13fca));if(_0xb13fca['error']){if(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x19')]===0x1f4){logger[_0x8a8a('0x18')](_0x8a8a('0x13'),_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x532621(_0xb13fca[_0x8a8a('0x18')]['message']);}logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x3d3a00(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);}else{logger[_0x8a8a('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x8a8a('0x14'));_0x3d3a00(_0xb13fca[_0x8a8a('0x1c')][_0x8a8a('0x1a')]);}})[_0x8a8a('0x1d')](function(_0x299827){logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x299827);_0x532621(_0x299827);});});}exports['CreateFaxMessage']=function(_0x5181b2){var _0x4e3d0a=this;return new Promise(function(_0x4a6601,_0x3a9b2f){return db[_0x8a8a('0x1e')][_0x8a8a('0x1f')](_0x5181b2[_0x8a8a('0x20')],{'raw':_0x5181b2[_0x8a8a('0x21')]?_0x5181b2[_0x8a8a('0x21')][_0x8a8a('0x22')]===undefined?!![]:![]:!![]})[_0x8a8a('0x12')](function(_0x25d5d4){logger[_0x8a8a('0x1b')](_0x8a8a('0x23'),_0x5181b2);logger[_0x8a8a('0x15')](_0x8a8a('0x23'),_0x5181b2,JSON[_0x8a8a('0x17')](_0x25d5d4));_0x4a6601(_0x25d5d4);})[_0x8a8a('0x1d')](function(_0x545a38){logger[_0x8a8a('0x18')](_0x8a8a('0x23'),_0x545a38[_0x8a8a('0x1a')],_0x5181b2);_0x3a9b2f(_0x4e3d0a[_0x8a8a('0x18')](0x1f4,_0x545a38[_0x8a8a('0x1a')]));});});};exports[_0x8a8a('0x24')]=function(_0x3aa46d){var _0x5f4dcc=this;return new Promise(function(_0x31d21a,_0x38c1e0){return db[_0x8a8a('0x1e')]['update'](_0x3aa46d['body'],{'raw':_0x3aa46d[_0x8a8a('0x21')]?_0x3aa46d[_0x8a8a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa46d['options']?_0x3aa46d['options'][_0x8a8a('0x25')]||null:null,'attributes':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x26')]||null:null,'limit':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x27')]||null:null})[_0x8a8a('0x12')](function(_0x8df0cb){logger[_0x8a8a('0x1b')](_0x8a8a('0x24'),_0x3aa46d);logger[_0x8a8a('0x15')](_0x8a8a('0x24'),_0x3aa46d,JSON['stringify'](_0x8df0cb));_0x31d21a(_0x8df0cb);})['catch'](function(_0x56e79e){logger[_0x8a8a('0x18')](_0x8a8a('0x24'),_0x56e79e['message'],_0x3aa46d);_0x38c1e0(_0x5f4dcc[_0x8a8a('0x18')](0x1f4,_0x56e79e[_0x8a8a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 11cc225..7d9f74e 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 _0x93ec=['save','remove','emit','removeListener','faxMessage:','./faxMessage.events'];(function(_0x216a99,_0x31e862){var _0x11b58=function(_0x57c8dc){while(--_0x57c8dc){_0x216a99['push'](_0x216a99['shift']());}};_0x11b58(++_0x31e862);}(_0x93ec,0xc5));var _0xc93e=function(_0x7532e2,_0x3bb229){_0x7532e2=_0x7532e2-0x0;var _0xa42ad1=_0x93ec[_0x7532e2];return _0xa42ad1;};'use strict';var FaxMessageEvents=require(_0xc93e('0x0'));var events=[_0xc93e('0x1'),_0xc93e('0x2'),'update'];function createListener(_0xfdfcf0,_0x46e363){return function(_0x33054b){_0x46e363[_0xc93e('0x3')](_0xfdfcf0,_0x33054b);};}function removeListener(_0x53cc75,_0xc2cdbe){return function(){FaxMessageEvents[_0xc93e('0x4')](_0x53cc75,_0xc2cdbe);};}exports['register']=function(_0x9163f0){for(var _0x43a7a2=0x0,_0x223fc6=events['length'];_0x43a7a2<_0x223fc6;_0x43a7a2++){var _0x2b7c93=events[_0x43a7a2];var _0x4fde44=createListener(_0xc93e('0x5')+_0x2b7c93,_0x9163f0);FaxMessageEvents['on'](_0x2b7c93,_0x4fde44);}}; \ No newline at end of file +var _0x2948=['save','remove','update','emit','register','length','faxMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2948,0x150));var _0x8294=function(_0x13b1db,_0x44a359){_0x13b1db=_0x13b1db-0x0;var _0x5437f3=_0x2948[_0x13b1db];return _0x5437f3;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8294('0x0'),_0x8294('0x1'),_0x8294('0x2')];function createListener(_0x485bd9,_0x30b936){return function(_0x450ca1){_0x30b936[_0x8294('0x3')](_0x485bd9,_0x450ca1);};}function removeListener(_0x57bc5f,_0x131786){return function(){FaxMessageEvents['removeListener'](_0x57bc5f,_0x131786);};}exports[_0x8294('0x4')]=function(_0x3f4662){for(var _0x5ef92f=0x0,_0x51d9a1=events[_0x8294('0x5')];_0x5ef92f<_0x51d9a1;_0x5ef92f++){var _0x36792f=events[_0x5ef92f];var _0xa7bde1=createListener(_0x8294('0x6')+_0x36792f,_0x3f4662);FaxMessageEvents['on'](_0x36792f,_0xa7bde1);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 59e0700..3821d76 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 _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x145e97,_0x3a6e77){var _0xf25180=function(_0xb3c688){while(--_0xb3c688){_0x145e97['push'](_0x145e97['shift']());}};_0xf25180(++_0x3a6e77);}(_0x593e,0xcb));var _0xe593=function(_0x339fe7,_0x1097a6){_0x339fe7=_0x339fe7-0x0;var _0x3a91ee=_0x593e[_0x339fe7];return _0x3a91ee;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0xe5b5=['fax','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x2dd681,_0xcb649b){var _0x363821=function(_0x5eb45b){while(--_0x5eb45b){_0x2dd681['push'](_0x2dd681['shift']());}};_0x363821(++_0xcb649b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xe5b5[_0x59eefb];return _0x1a49e8;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/download',auth[_0x5e5b('0xc')](),controller['download']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x13')](_0x5e5b('0x14'),'faxmessage:create'),controller['create']);router['put'](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x18')]);router['put'](_0x5e5b('0x19'),auth[_0x5e5b('0xc')](),controller['reject']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x5e5b('0x1b')]);module[_0x5e5b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d8c7383..6aa3f63 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 _0x3a31=['rrmemory','beepall','sequelize','STRING','INTEGER','ENUM'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3a31,0x7a));var _0x13a3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3a31[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x13a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x13a3('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x13a3('0x1')]},'timeout':{'type':Sequelize[_0x13a3('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x13a3('0x3')](_0x13a3('0x4'),_0x13a3('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x13a3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7883=['roundrobin','sequelize','STRING','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7883,0x8b));var _0x3788=function(_0x3e696a,_0x511364){_0x3e696a=_0x3e696a-0x0;var _0x555bd3=_0x7883[_0x3e696a];return _0x555bd3;};'use strict';var Sequelize=require(_0x3788('0x0'));module['exports']={'name':{'type':Sequelize[_0x3788('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3788('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3788('0x2')](_0x3788('0x3'),_0x3788('0x4'),_0x3788('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index af30d19..0ad08a4 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 _0xa575=['UserProfileResource','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','faxPause','createdAt','format','SIP','getTeams','findOne','Team','ids','User','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','get','FaxQueues'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0xa575,0x182));var _0x5a57=function(_0x4396e5,_0x3fe293){_0x4396e5=_0x4396e5-0x0;var _0x2965b1=_0xa575[_0x4396e5];return _0x2965b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a57('0x0'));var zipdir=require(_0x5a57('0x1'));var jsonpatch=require(_0x5a57('0x2'));var rp=require(_0x5a57('0x3'));var moment=require(_0x5a57('0x4'));var BPromise=require(_0x5a57('0x5'));var Mustache=require(_0x5a57('0x6'));var util=require(_0x5a57('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a57('0x8'));var fs=require('fs');var fs_extra=require(_0x5a57('0x9'));var _=require(_0x5a57('0xa'));var squel=require(_0x5a57('0xb'));var crypto=require(_0x5a57('0xc'));var jsforce=require(_0x5a57('0xd'));var deskjs=require(_0x5a57('0xe'));var toCsv=require(_0x5a57('0xf'));var querystring=require(_0x5a57('0x10'));var Papa=require(_0x5a57('0x11'));var Redis=require(_0x5a57('0x12'));var authService=require(_0x5a57('0x13'));var qs=require(_0x5a57('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a57('0x15'))(_0x5a57('0x16'));var utils=require('../../config/utils');var config=require(_0x5a57('0x17'));var licenseUtil=require(_0x5a57('0x18'));var db=require(_0x5a57('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5a57('0x1a'),'port':0x18eb});var socket=require(_0x5a57('0x1b'))(new Redis(config[_0x5a57('0x1c')]));require(_0x5a57('0x1d'))[_0x5a57('0x1e')](socket);function respondWithStatusCode(_0x4471a0,_0x2e6a97){_0x2e6a97=_0x2e6a97||0xcc;return function(_0x22c791){if(_0x22c791){return _0x4471a0[_0x5a57('0x1f')](_0x2e6a97);}return _0x4471a0[_0x5a57('0x20')](_0x2e6a97)[_0x5a57('0x21')]();};}function respondWithResult(_0x47cc0,_0x2013f1){_0x2013f1=_0x2013f1||0xc8;return function(_0x4f76da){if(_0x4f76da){return _0x47cc0[_0x5a57('0x20')](_0x2013f1)[_0x5a57('0x22')](_0x4f76da);}};}function respondWithFilteredResult(_0x416568,_0x37f9e0){return function(_0x46fab3){if(_0x46fab3){var _0x3722a1=typeof _0x37f9e0[_0x5a57('0x23')]===_0x5a57('0x24')&&typeof _0x37f9e0['limit']==='undefined';var _0x322235=_0x46fab3[_0x5a57('0x25')];var _0x823697=_0x3722a1?0x0:_0x37f9e0[_0x5a57('0x23')];var _0x5f03df=_0x3722a1?_0x46fab3[_0x5a57('0x25')]:_0x37f9e0[_0x5a57('0x23')]+_0x37f9e0[_0x5a57('0x26')];var _0x954d;if(_0x5f03df>=_0x322235){_0x5f03df=_0x322235;_0x954d=0xc8;}else{_0x954d=0xce;}_0x416568[_0x5a57('0x20')](_0x954d);return _0x416568[_0x5a57('0x27')]('Content-Range',_0x823697+'-'+_0x5f03df+'/'+_0x322235)[_0x5a57('0x22')](_0x46fab3);}return null;};}function patchUpdates(_0x6ca964){return function(_0xfd62ec){try{jsonpatch[_0x5a57('0x28')](_0xfd62ec,_0x6ca964,!![]);}catch(_0x1380c8){return BPromise['reject'](_0x1380c8);}return _0xfd62ec[_0x5a57('0x29')]();};}function saveUpdates(_0x161e2d,_0x30f961){return function(_0x419ef1){if(_0x419ef1){return _0x419ef1['update'](_0x161e2d)[_0x5a57('0x2a')](function(_0x56c45e){return _0x56c45e;});}return null;};}function removeEntity(_0x2c5af0,_0x1bb232){return function(_0x1fdc4b){if(_0x1fdc4b){return _0x1fdc4b[_0x5a57('0x2b')]()['then'](function(){var _0x18a472=_0x1fdc4b[_0x5a57('0x2c')]({'plain':!![]});var _0x5d2594=_0x5a57('0x2d');return db[_0x5a57('0x2e')][_0x5a57('0x2b')]({'where':{'type':_0x5d2594,'resourceId':_0x18a472['id']}})[_0x5a57('0x2a')](function(){return _0x1fdc4b;});})[_0x5a57('0x2a')](function(){_0x2c5af0[_0x5a57('0x20')](0xcc)[_0x5a57('0x21')]();});}};}function handleEntityNotFound(_0x1d295d,_0xcc2273){return function(_0x1f334c){if(!_0x1f334c){_0x1d295d['sendStatus'](0x194);}return _0x1f334c;};}function handleError(_0x2d94b5,_0x2773d1){_0x2773d1=_0x2773d1||0x1f4;return function(_0x48edf0){logger[_0x5a57('0x2f')](_0x48edf0[_0x5a57('0x30')]);if(_0x48edf0['name']){delete _0x48edf0[_0x5a57('0x31')];}_0x2d94b5[_0x5a57('0x20')](_0x2773d1)['send'](_0x48edf0);};}exports[_0x5a57('0x32')]=function(_0x39338d,_0x77a7d7){var _0x437ef5={},_0x2c3984={},_0x770c6={'count':0x0,'rows':[]};var _0x53e3a2=_[_0x5a57('0x33')](db[_0x5a57('0x34')][_0x5a57('0x35')],function(_0x27d8f3){return{'name':_0x27d8f3[_0x5a57('0x36')],'type':_0x27d8f3['type'][_0x5a57('0x37')]};});_0x2c3984['model']=_[_0x5a57('0x33')](_0x53e3a2,'name');_0x2c3984['query']=_[_0x5a57('0x38')](_0x39338d[_0x5a57('0x39')]);_0x2c3984[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x2c3984[_0x5a57('0x3c')],_0x2c3984[_0x5a57('0x39')]);_0x437ef5[_0x5a57('0x3d')]=_[_0x5a57('0x3b')](_0x2c3984[_0x5a57('0x3c')],qs[_0x5a57('0x3e')](_0x39338d[_0x5a57('0x39')]['fields']));_0x437ef5[_0x5a57('0x3d')]=_0x437ef5['attributes']['length']?_0x437ef5[_0x5a57('0x3d')]:_0x2c3984[_0x5a57('0x3c')];if(!_0x39338d[_0x5a57('0x39')][_0x5a57('0x3f')](_0x5a57('0x40'))){_0x437ef5[_0x5a57('0x26')]=qs[_0x5a57('0x26')](_0x39338d[_0x5a57('0x39')][_0x5a57('0x26')]);_0x437ef5[_0x5a57('0x23')]=qs['offset'](_0x39338d['query']['offset']);}_0x437ef5[_0x5a57('0x41')]=qs[_0x5a57('0x42')](_0x39338d[_0x5a57('0x39')][_0x5a57('0x42')]);_0x437ef5[_0x5a57('0x43')]=qs[_0x5a57('0x3a')](_[_0x5a57('0x44')](_0x39338d[_0x5a57('0x39')],_0x2c3984[_0x5a57('0x3a')]),_0x53e3a2);if(_0x39338d['query']['filter']){_0x437ef5[_0x5a57('0x43')]=_['merge'](_0x437ef5[_0x5a57('0x43')],{'$or':_['map'](_0x53e3a2,function(_0x5d617d){if(_0x5d617d[_0x5a57('0x45')]!=='VIRTUAL'){var _0x38826d={};_0x38826d[_0x5d617d['name']]={'$like':'%'+_0x39338d['query'][_0x5a57('0x46')]+'%'};return _0x38826d;}})});}_0x437ef5=_[_0x5a57('0x47')]({},_0x437ef5,_0x39338d[_0x5a57('0x48')]);var _0x1bbced={'where':_0x437ef5[_0x5a57('0x43')]};return db[_0x5a57('0x34')][_0x5a57('0x25')](_0x1bbced)['then'](function(_0x5491fe){_0x770c6['count']=_0x5491fe;if(_0x39338d['query'][_0x5a57('0x49')]){_0x437ef5[_0x5a57('0x4a')]=[{'all':!![]}];}return db[_0x5a57('0x34')][_0x5a57('0x4b')](_0x437ef5);})[_0x5a57('0x2a')](function(_0x49f5f6){_0x770c6[_0x5a57('0x4c')]=_0x49f5f6;return _0x770c6;})[_0x5a57('0x2a')](respondWithFilteredResult(_0x77a7d7,_0x437ef5))['catch'](handleError(_0x77a7d7,null));};exports[_0x5a57('0x4d')]=function(_0x19ff17,_0x425a21){var _0x4e90a1={'raw':!![],'where':{'id':_0x19ff17[_0x5a57('0x4e')]['id']}},_0x3d6313={};_0x3d6313[_0x5a57('0x3c')]=_[_0x5a57('0x38')](db[_0x5a57('0x34')][_0x5a57('0x35')]);_0x3d6313['query']=_[_0x5a57('0x38')](_0x19ff17[_0x5a57('0x39')]);_0x3d6313[_0x5a57('0x3a')]=_['intersection'](_0x3d6313[_0x5a57('0x3c')],_0x3d6313['query']);_0x4e90a1[_0x5a57('0x3d')]=_['intersection'](_0x3d6313[_0x5a57('0x3c')],qs[_0x5a57('0x3e')](_0x19ff17['query'][_0x5a57('0x3e')]));_0x4e90a1[_0x5a57('0x3d')]=_0x4e90a1['attributes'][_0x5a57('0x4f')]?_0x4e90a1['attributes']:_0x3d6313[_0x5a57('0x3c')];if(_0x19ff17[_0x5a57('0x39')]['includeAll']){_0x4e90a1['include']=[{'all':!![]}];}_0x4e90a1=_[_0x5a57('0x47')]({},_0x4e90a1,_0x19ff17[_0x5a57('0x48')]);return db[_0x5a57('0x34')][_0x5a57('0x50')](_0x4e90a1)[_0x5a57('0x2a')](handleEntityNotFound(_0x425a21,null))[_0x5a57('0x2a')](respondWithResult(_0x425a21,null))[_0x5a57('0x51')](handleError(_0x425a21,null));};exports[_0x5a57('0x52')]=function(_0x4426a1,_0x33dc04){return db[_0x5a57('0x34')][_0x5a57('0x52')](_0x4426a1[_0x5a57('0x53')],{})[_0x5a57('0x2a')](function(_0x31f40d){var _0x10b400=_0x4426a1[_0x5a57('0x54')]['get']({'plain':!![]});if(!_0x10b400)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10b400[_0x5a57('0x55')]===_0x5a57('0x54')){var _0x6d7199=_0x31f40d[_0x5a57('0x2c')]({'plain':!![]});var _0x3a73b7=_0x5a57('0x2d');return db['UserProfileSection'][_0x5a57('0x50')]({'where':{'name':_0x3a73b7,'userProfileId':_0x10b400[_0x5a57('0x56')]},'raw':!![]})[_0x5a57('0x2a')](function(_0x3d4c24){if(_0x3d4c24&&_0x3d4c24[_0x5a57('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x6d7199['name'],'resourceId':_0x6d7199['id'],'type':_0x3d4c24[_0x5a57('0x31')],'sectionId':_0x3d4c24['id']},{})['then'](function(){return _0x31f40d;});}else{return _0x31f40d;}})[_0x5a57('0x51')](function(_0x1fa23d){logger['error'](_0x5a57('0x58'),_0x1fa23d);throw _0x1fa23d;});}return _0x31f40d;})[_0x5a57('0x2a')](respondWithResult(_0x33dc04,0xc9))['catch'](handleError(_0x33dc04,null));};exports[_0x5a57('0x59')]=function(_0x429b5f,_0x9e9aa5){if(_0x429b5f[_0x5a57('0x53')]['id']){delete _0x429b5f['body']['id'];}return db[_0x5a57('0x34')][_0x5a57('0x50')]({'where':{'id':_0x429b5f[_0x5a57('0x4e')]['id']}})[_0x5a57('0x2a')](handleEntityNotFound(_0x9e9aa5,null))[_0x5a57('0x2a')](saveUpdates(_0x429b5f[_0x5a57('0x53')],null))[_0x5a57('0x2a')](respondWithResult(_0x9e9aa5,null))[_0x5a57('0x51')](handleError(_0x9e9aa5,null));};exports[_0x5a57('0x2b')]=function(_0x2b8a1a,_0x296222){return db[_0x5a57('0x34')][_0x5a57('0x50')]({'where':{'id':_0x2b8a1a[_0x5a57('0x4e')]['id']}})['then'](handleEntityNotFound(_0x296222,null))[_0x5a57('0x2a')](removeEntity(_0x296222,null))[_0x5a57('0x51')](handleError(_0x296222,null));};exports[_0x5a57('0x5a')]=function(_0x5b2fdc,_0x5d50cf){return db[_0x5a57('0x34')][_0x5a57('0x5a')]()[_0x5a57('0x2a')](respondWithResult(_0x5d50cf,null))['catch'](handleError(_0x5d50cf,null));};exports[_0x5a57('0x5b')]=function(_0x43bd0d,_0x41b3de,_0x1ac97f){var _0x1d136f={'raw':!![],'where':{}},_0x3f8e6e={},_0x32cacd;return db[_0x5a57('0x34')]['findOne']({'where':{'id':_0x43bd0d[_0x5a57('0x4e')]['id']}})['then'](handleEntityNotFound(_0x41b3de,null))[_0x5a57('0x2a')](function(_0x5c7cd2){if(_0x5c7cd2){_0x32cacd=_0x5c7cd2['get']({'plain':!![]});_0x3f8e6e[_0x5a57('0x3c')]=_[_0x5a57('0x38')](db[_0x5a57('0x5c')]['rawAttributes']);_0x3f8e6e[_0x5a57('0x39')]=_[_0x5a57('0x38')](_0x43bd0d[_0x5a57('0x39')]);_0x3f8e6e[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x3f8e6e[_0x5a57('0x3c')],_0x3f8e6e['query']);_0x1d136f[_0x5a57('0x3d')]=_['intersection'](_0x3f8e6e[_0x5a57('0x3c')],qs[_0x5a57('0x3e')](_0x43bd0d['query']['fields']));_0x1d136f['attributes']=_0x1d136f[_0x5a57('0x3d')][_0x5a57('0x4f')]?_0x1d136f[_0x5a57('0x3d')]:_0x3f8e6e['model'];if(!_0x43bd0d['query'][_0x5a57('0x3f')](_0x5a57('0x40'))){_0x1d136f['limit']=qs['limit'](_0x43bd0d['query'][_0x5a57('0x26')]);_0x1d136f[_0x5a57('0x23')]=qs[_0x5a57('0x23')](_0x43bd0d[_0x5a57('0x39')][_0x5a57('0x23')]);}_0x1d136f[_0x5a57('0x41')]=qs[_0x5a57('0x42')](_0x43bd0d[_0x5a57('0x39')]['sort']);_0x1d136f[_0x5a57('0x43')]=qs['filters'](_[_0x5a57('0x44')](_0x43bd0d[_0x5a57('0x39')],_0x3f8e6e[_0x5a57('0x3a')]));_0x1d136f[_0x5a57('0x43')][_0x5a57('0x5d')]=_0x5c7cd2['id'];if(_0x43bd0d[_0x5a57('0x39')]['filter']){_0x1d136f[_0x5a57('0x43')]=_[_0x5a57('0x47')](_0x1d136f['where'],{'$or':_[_0x5a57('0x33')](_0x1d136f['attributes'],function(_0xe7398b){var _0x2bb373={};_0x2bb373[_0xe7398b]={'$like':'%'+_0x43bd0d[_0x5a57('0x39')][_0x5a57('0x46')]+'%'};return _0x2bb373;})});}_0x1d136f=_[_0x5a57('0x47')]({},_0x1d136f,_0x43bd0d[_0x5a57('0x48')]);return db[_0x5a57('0x5c')][_0x5a57('0x4b')](_0x1d136f);}})[_0x5a57('0x2a')](function(_0x5742ab){if(_0x5742ab){return db['User'][_0x5a57('0x5e')]({'where':{'id':_[_0x5a57('0x33')](_0x5742ab,_0x5a57('0x5f')),'role':_0x5a57('0x60')},'attributes':['id','name',_0x5a57('0x61'),'updatedAt',_0x5a57('0x62')]});}})[_0x5a57('0x2a')](function(_0x8da07d){if(_0x8da07d){return{'count':_0x8da07d[_0x5a57('0x25')],'rows':_[_0x5a57('0x33')](_0x8da07d[_0x5a57('0x4c')],function(_0x1dc406){return{'membername':_0x1dc406[_0x5a57('0x31')],'UserId':_0x1dc406['id'],'queue_name':_0x32cacd['name'],'FaxQueueId':_0x32cacd['id'],'interface':util[_0x5a57('0x63')]('%s/%s',_0x5a57('0x64'),_0x1dc406[_0x5a57('0x31')]),'penalty':0x0,'paused':_0x1dc406[_0x5a57('0x61')],'createdAt':_0x1dc406[_0x5a57('0x62')],'updatedAt':_0x1dc406['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5a57('0x2a')](respondWithFilteredResult(_0x41b3de,_0x1d136f))['catch'](handleError(_0x41b3de,null));};exports[_0x5a57('0x65')]=function(_0x2229ba,_0x2b7754,_0x3e05ff){var _0x2473f0={};var _0x13c320={};var _0x5cc2d5;var _0x4e1987;return db[_0x5a57('0x34')][_0x5a57('0x66')]({'where':{'id':_0x2229ba['params']['id']}})[_0x5a57('0x2a')](handleEntityNotFound(_0x2b7754,null))[_0x5a57('0x2a')](function(_0x7819f5){if(_0x7819f5){_0x5cc2d5=_0x7819f5;_0x13c320[_0x5a57('0x3c')]=_[_0x5a57('0x38')](db[_0x5a57('0x67')][_0x5a57('0x35')]);_0x13c320[_0x5a57('0x39')]=_[_0x5a57('0x38')](_0x2229ba[_0x5a57('0x39')]);_0x13c320[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x13c320[_0x5a57('0x3c')],_0x13c320[_0x5a57('0x39')]);_0x2473f0[_0x5a57('0x3d')]=_[_0x5a57('0x3b')](_0x13c320[_0x5a57('0x3c')],qs[_0x5a57('0x3e')](_0x2229ba[_0x5a57('0x39')][_0x5a57('0x3e')]));_0x2473f0[_0x5a57('0x3d')]=_0x2473f0[_0x5a57('0x3d')]['length']?_0x2473f0[_0x5a57('0x3d')]:_0x13c320['model'];_0x2473f0['order']=qs[_0x5a57('0x42')](_0x2229ba[_0x5a57('0x39')][_0x5a57('0x42')]);_0x2473f0[_0x5a57('0x43')]=qs[_0x5a57('0x3a')](_[_0x5a57('0x44')](_0x2229ba[_0x5a57('0x39')],_0x13c320[_0x5a57('0x3a')]));if(_0x2229ba[_0x5a57('0x39')][_0x5a57('0x46')]){_0x2473f0[_0x5a57('0x43')]=_['merge'](_0x2473f0[_0x5a57('0x43')],{'$or':_['map'](_0x2473f0['attributes'],function(_0x433cc5){var _0x46e891={};_0x46e891[_0x433cc5]={'$like':'%'+_0x2229ba['query'][_0x5a57('0x46')]+'%'};return _0x46e891;})});}_0x2473f0=_[_0x5a57('0x47')]({},_0x2473f0,_0x2229ba[_0x5a57('0x48')]);return _0x5cc2d5[_0x5a57('0x65')](_0x2473f0);}})[_0x5a57('0x2a')](function(_0x5d77ee){if(_0x5d77ee){_0x4e1987=_0x5d77ee[_0x5a57('0x4f')];if(!_0x2229ba['query'][_0x5a57('0x3f')](_0x5a57('0x40'))){_0x2473f0[_0x5a57('0x26')]=qs[_0x5a57('0x26')](_0x2229ba[_0x5a57('0x39')][_0x5a57('0x26')]);_0x2473f0['offset']=qs[_0x5a57('0x23')](_0x2229ba['query'][_0x5a57('0x23')]);}return _0x5cc2d5[_0x5a57('0x65')](_0x2473f0);}})[_0x5a57('0x2a')](function(_0xbaf66b){if(_0xbaf66b){return _0xbaf66b?{'count':_0x4e1987,'rows':_0xbaf66b}:null;}})['then'](respondWithResult(_0x2b7754,null))['catch'](handleError(_0x2b7754,null));};exports['addTeams']=function(_0x33fb80,_0x2f1e87,_0x11f2ae){var _0xcc6528=_0x33fb80[_0x5a57('0x53')][_0x5a57('0x68')];return db[_0x5a57('0x67')][_0x5a57('0x4b')]({'where':{'id':_0xcc6528},'attributes':['id'],'include':[{'model':db[_0x5a57('0x69')],'as':_0x5a57('0x6a'),'attributes':['id','name',_0x5a57('0x6b'),'voicePause',_0x5a57('0x6c')],'raw':!![]}]})[_0x5a57('0x2a')](function(_0x159456){if(_0x159456){var _0x1166ca=_[_0x5a57('0x6d')](_0x159456,function(_0x28bcb6){var _0x2ed4ff=_0x28bcb6[_0x5a57('0x2c')]({'plain':!![]});return _0x2ed4ff[_0x5a57('0x6a')];});return db[_0x5a57('0x34')]['find']({'where':{'id':_0x33fb80[_0x5a57('0x4e')]['id']}})[_0x5a57('0x2a')](function(_0x2aa33d){return db[_0x5a57('0x6e')][_0x5a57('0x6f')](function(_0x5230fe){return _0x2aa33d[_0x5a57('0x70')](_0xcc6528,{'transaction':_0x5230fe})[_0x5a57('0x2a')](function(){return BPromise[_0x5a57('0x71')](_0x1166ca,function(_0x1bc868){return db[_0x5a57('0x5c')][_0x5a57('0x72')]({'where':{'UserId':_0x1bc868['id'],'FaxQueueId':_0x33fb80[_0x5a57('0x4e')]['id']},'transaction':_0x5230fe});});})[_0x5a57('0x2a')](function(){_0x1166ca[_0x5a57('0x73')](function(_0x579c86){socket[_0x5a57('0x74')](_0x5a57('0x75'),{'UserId':_0x579c86['id'],'FaxQueueId':_0x2aa33d['id']});});});});});}})[_0x5a57('0x2a')](respondWithStatusCode(_0x2f1e87,null))['catch'](handleError(_0x2f1e87,null));};exports[_0x5a57('0x76')]=function(_0x1bc8ac,_0x272ff2,_0x26f13c){return db[_0x5a57('0x67')]['findAll']({'where':{'id':_0x1bc8ac[_0x5a57('0x39')][_0x5a57('0x68')]},'attributes':['id'],'include':[{'model':db[_0x5a57('0x69')],'as':_0x5a57('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x5a57('0x2a')](handleEntityNotFound(_0x272ff2,null))['then'](function(_0xa2cfb6){var _0x5db85d=_[_0x5a57('0x33')](_0xa2cfb6,'id');var _0x4cc151=[];var _0x16a931=[];var _0x2d0d8a=squel[_0x5a57('0x77')]();_0x2d0d8a[_0x5a57('0x78')](_0x5a57('0x79'))[_0x5a57('0x7a')](_0x5a57('0x7b'),'tq')[_0x5a57('0x7c')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('FaxQueueId\x20=\x20?',_0x1bc8ac['params']['id']);for(var _0x2044f9=0x0;_0x2044f9<_0xa2cfb6['length'];_0x2044f9+=0x1){let _0x588ae5=_0xa2cfb6[_0x2044f9];for(var _0x2231f0=0x0;_0x2231f0<_0x588ae5[_0x5a57('0x6a')][_0x5a57('0x4f')];_0x2231f0+=0x1){let _0x3f9697=_0x588ae5[_0x5a57('0x6a')][_0x2231f0];var _0x5daf85=_0x2d0d8a[_0x5a57('0x7d')]();_0x5daf85['where'](_0x5a57('0x7e'),_0x3f9697['id']);_0x16a931[_0x5a57('0x7f')](db[_0x5a57('0x6e')][_0x5a57('0x39')](_0x5daf85[_0x5a57('0x80')](),{'type':db['sequelize'][_0x5a57('0x81')][_0x5a57('0x82')]})['then'](function(_0x16be99){if(_0x16be99[_0x5a57('0x4f')]===0x1){return _0x3f9697['id'];}else{var _0x4bc7d4=_[_0x5a57('0x83')](_['map'](_0x16be99,_0x5a57('0x84')),function(_0x552f7d){return _[_0x5a57('0x85')](_0x5db85d,_0x552f7d);});if(_0x4bc7d4){return _0x3f9697['id'];}}}));}}return BPromise[_0x5a57('0x86')](_0x16a931)[_0x5a57('0x2a')](function(_0xa79ce4){_0x4cc151=_(_0x4cc151)[_0x5a57('0x87')](_0xa79ce4)[_0x5a57('0x88')]()[_0x5a57('0x89')]();return db[_0x5a57('0x34')][_0x5a57('0x50')]({'where':{'id':_0x1bc8ac[_0x5a57('0x4e')]['id']}})[_0x5a57('0x2a')](function(_0x168a01){return db['sequelize'][_0x5a57('0x6f')](function(_0x1466e3){return _0x168a01[_0x5a57('0x76')](_0x1bc8ac[_0x5a57('0x39')][_0x5a57('0x68')],{'transaction':_0x1466e3})[_0x5a57('0x2a')](function(){if(!_['isEmpty'](_0x4cc151)){return _0x168a01[_0x5a57('0x8a')](_0x4cc151,{'transaction':_0x1466e3});}})['then'](function(){_0x4cc151[_0x5a57('0x73')](function(_0x972c1b){socket['emit'](_0x5a57('0x8b'),{'UserId':_0x972c1b,'FaxQueueId':_0x168a01['id']});});});});});});})[_0x5a57('0x2a')](respondWithStatusCode(_0x272ff2,null))['catch'](handleError(_0x272ff2,null));};exports[_0x5a57('0x8c')]=function(_0x2b5341,_0x3b465d,_0x1c5f03){return db[_0x5a57('0x34')][_0x5a57('0x50')]({'where':{'id':_0x2b5341[_0x5a57('0x4e')]['id']}})[_0x5a57('0x2a')](handleEntityNotFound(_0x3b465d,null))[_0x5a57('0x2a')](function(_0xa3cbac){if(_0xa3cbac){return _0xa3cbac[_0x5a57('0x8c')](_0x2b5341[_0x5a57('0x53')][_0x5a57('0x68')],_['omit'](_0x2b5341[_0x5a57('0x53')],[_0x5a57('0x68'),'id'])||{})[_0x5a57('0x8d')](function(_0x395664){for(var _0x185f74=0x0;_0x185f74<_0x2b5341['body'][_0x5a57('0x68')]['length'];_0x185f74+=0x1){socket[_0x5a57('0x74')](_0x5a57('0x75'),{'UserId':Number(_0x2b5341[_0x5a57('0x53')][_0x5a57('0x68')][_0x185f74]),'FaxQueueId':Number(_0x2b5341[_0x5a57('0x4e')]['id'])});}return _0x395664;});}})[_0x5a57('0x2a')](respondWithResult(_0x3b465d,null))['catch'](handleError(_0x3b465d,null));};exports[_0x5a57('0x8a')]=function(_0x3f84c2,_0x881a8,_0x1fefce){return db['FaxQueue'][_0x5a57('0x50')]({'where':{'id':_0x3f84c2[_0x5a57('0x4e')]['id']}})['then'](handleEntityNotFound(_0x881a8,null))[_0x5a57('0x2a')](function(_0x4ddeaa){if(_0x4ddeaa){return _0x4ddeaa[_0x5a57('0x8a')](_0x3f84c2[_0x5a57('0x39')]['ids'])[_0x5a57('0x2a')](function(){if(_[_0x5a57('0x8e')](_0x3f84c2[_0x5a57('0x39')]['ids'])){for(var _0x47b6f5=0x0;_0x47b6f5<_0x3f84c2[_0x5a57('0x39')][_0x5a57('0x68')]['length'];_0x47b6f5+=0x1){socket[_0x5a57('0x74')](_0x5a57('0x8b'),{'UserId':Number(_0x3f84c2[_0x5a57('0x39')][_0x5a57('0x68')][_0x47b6f5]),'FaxQueueId':Number(_0x3f84c2[_0x5a57('0x4e')]['id'])});}}else{socket[_0x5a57('0x74')](_0x5a57('0x8b'),{'UserId':Number(_0x3f84c2[_0x5a57('0x39')]['ids']),'FaxQueueId':Number(_0x3f84c2[_0x5a57('0x4e')]['id'])});}});}})[_0x5a57('0x2a')](respondWithStatusCode(_0x881a8,null))[_0x5a57('0x51')](handleError(_0x881a8,null));};exports[_0x5a57('0x8f')]=function(_0x237d0e,_0x17db55,_0xdbfc1e){var _0x1575fc={};var _0x223f68={};var _0x231af8;var _0x335429;return db['FaxQueue']['findOne']({'where':{'id':_0x237d0e[_0x5a57('0x4e')]['id']}})[_0x5a57('0x2a')](handleEntityNotFound(_0x17db55,null))[_0x5a57('0x2a')](function(_0x5af105){if(_0x5af105){_0x231af8=_0x5af105;_0x223f68[_0x5a57('0x3c')]=_['keys'](db['User'][_0x5a57('0x35')]);_0x223f68[_0x5a57('0x39')]=_[_0x5a57('0x38')](_0x237d0e[_0x5a57('0x39')]);_0x223f68[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x223f68[_0x5a57('0x3c')],_0x223f68['query']);_0x1575fc[_0x5a57('0x3d')]=_[_0x5a57('0x3b')](_0x223f68[_0x5a57('0x3c')],qs['fields'](_0x237d0e[_0x5a57('0x39')][_0x5a57('0x3e')]));_0x1575fc[_0x5a57('0x3d')]=_0x1575fc[_0x5a57('0x3d')][_0x5a57('0x4f')]?_0x1575fc[_0x5a57('0x3d')]:_0x223f68[_0x5a57('0x3c')];_0x1575fc[_0x5a57('0x41')]=qs[_0x5a57('0x42')](_0x237d0e[_0x5a57('0x39')][_0x5a57('0x42')]);_0x1575fc['where']=qs[_0x5a57('0x3a')](_[_0x5a57('0x44')](_0x237d0e[_0x5a57('0x39')],_0x223f68[_0x5a57('0x3a')]));if(_0x237d0e[_0x5a57('0x39')][_0x5a57('0x46')]){_0x1575fc[_0x5a57('0x43')]=_[_0x5a57('0x47')](_0x1575fc['where'],{'$or':_[_0x5a57('0x33')](_0x1575fc[_0x5a57('0x3d')],function(_0x207c7d){var _0x3146c6={};_0x3146c6[_0x207c7d]={'$like':'%'+_0x237d0e['query']['filter']+'%'};return _0x3146c6;})});}_0x1575fc=_['merge']({},_0x1575fc,_0x237d0e[_0x5a57('0x48')]);return _0x231af8['getAgents'](_0x1575fc);}})[_0x5a57('0x2a')](function(_0x7170bd){if(_0x7170bd){_0x335429=_0x7170bd[_0x5a57('0x4f')];if(!_0x237d0e[_0x5a57('0x39')][_0x5a57('0x3f')]('nolimit')){_0x1575fc[_0x5a57('0x26')]=qs[_0x5a57('0x26')](_0x237d0e[_0x5a57('0x39')][_0x5a57('0x26')]);_0x1575fc[_0x5a57('0x23')]=qs[_0x5a57('0x23')](_0x237d0e[_0x5a57('0x39')][_0x5a57('0x23')]);}return _0x231af8['getAgents'](_0x1575fc);}})[_0x5a57('0x2a')](function(_0x77e972){if(_0x77e972){return _0x77e972?{'count':_0x335429,'rows':_0x77e972}:null;}})[_0x5a57('0x2a')](respondWithResult(_0x17db55,null))[_0x5a57('0x51')](handleError(_0x17db55,null));}; \ No newline at end of file +var _0x4b66=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','FaxQueue','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','value','removeTeams','isEmpty','removeAgents','omit','spread','userFaxQueue:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register'];(function(_0x245b57,_0x420f33){var _0x1d07d9=function(_0x3cbd7b){while(--_0x3cbd7b){_0x245b57['push'](_0x245b57['shift']());}};_0x1d07d9(++_0x420f33);}(_0x4b66,0x186));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64b6('0x0'));var jsonpatch=require(_0x64b6('0x1'));var rp=require(_0x64b6('0x2'));var moment=require(_0x64b6('0x3'));var BPromise=require(_0x64b6('0x4'));var Mustache=require(_0x64b6('0x5'));var util=require(_0x64b6('0x6'));var path=require(_0x64b6('0x7'));var sox=require(_0x64b6('0x8'));var csv=require(_0x64b6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64b6('0xa'));var _=require(_0x64b6('0xb'));var squel=require(_0x64b6('0xc'));var crypto=require('crypto');var jsforce=require(_0x64b6('0xd'));var deskjs=require(_0x64b6('0xe'));var toCsv=require(_0x64b6('0x9'));var querystring=require(_0x64b6('0xf'));var Papa=require(_0x64b6('0x10'));var Redis=require(_0x64b6('0x11'));var authService=require(_0x64b6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x64b6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64b6('0x14'))(_0x64b6('0x15'));var utils=require(_0x64b6('0x16'));var config=require(_0x64b6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x64b6('0x18'))['db'];config[_0x64b6('0x19')]=_['defaults'](config[_0x64b6('0x19')],{'host':_0x64b6('0x1a'),'port':0x18eb});var socket=require(_0x64b6('0x1b'))(new Redis(config[_0x64b6('0x19')]));require(_0x64b6('0x1c'))[_0x64b6('0x1d')](socket);function respondWithStatusCode(_0x3f50f,_0x3d07e8){_0x3d07e8=_0x3d07e8||0xcc;return function(_0x1af762){if(_0x1af762){return _0x3f50f[_0x64b6('0x1e')](_0x3d07e8);}return _0x3f50f[_0x64b6('0x1f')](_0x3d07e8)[_0x64b6('0x20')]();};}function respondWithResult(_0x19d44d,_0x1d1371){_0x1d1371=_0x1d1371||0xc8;return function(_0x5a7441){if(_0x5a7441){return _0x19d44d['status'](_0x1d1371)[_0x64b6('0x21')](_0x5a7441);}};}function respondWithFilteredResult(_0x3e287d,_0x46c595){return function(_0x2cc805){if(_0x2cc805){var _0x3978c7=typeof _0x46c595[_0x64b6('0x22')]===_0x64b6('0x23')&&typeof _0x46c595[_0x64b6('0x24')]===_0x64b6('0x23');var _0x2f7af8=_0x2cc805[_0x64b6('0x25')];var _0x1a35cb=_0x3978c7?0x0:_0x46c595[_0x64b6('0x22')];var _0x594b4c=_0x3978c7?_0x2cc805[_0x64b6('0x25')]:_0x46c595['offset']+_0x46c595['limit'];var _0x1c8d8a;if(_0x594b4c>=_0x2f7af8){_0x594b4c=_0x2f7af8;_0x1c8d8a=0xc8;}else{_0x1c8d8a=0xce;}_0x3e287d['status'](_0x1c8d8a);return _0x3e287d['set'](_0x64b6('0x26'),_0x1a35cb+'-'+_0x594b4c+'/'+_0x2f7af8)[_0x64b6('0x21')](_0x2cc805);}return null;};}function patchUpdates(_0x1a9f62){return function(_0x40b558){try{jsonpatch['apply'](_0x40b558,_0x1a9f62,!![]);}catch(_0x2936da){return BPromise[_0x64b6('0x27')](_0x2936da);}return _0x40b558[_0x64b6('0x28')]();};}function saveUpdates(_0x14964c,_0x3eef9c){return function(_0x5f39b7){if(_0x5f39b7){return _0x5f39b7[_0x64b6('0x29')](_0x14964c)[_0x64b6('0x2a')](function(_0x34d784){return _0x34d784;});}return null;};}function removeEntity(_0x58c480,_0x3ea42f){return function(_0x5833df){if(_0x5833df){return _0x5833df[_0x64b6('0x2b')]()[_0x64b6('0x2a')](function(){var _0x4170fc=_0x5833df[_0x64b6('0x2c')]({'plain':!![]});var _0x2a4514=_0x64b6('0x2d');return db[_0x64b6('0x2e')][_0x64b6('0x2b')]({'where':{'type':_0x2a4514,'resourceId':_0x4170fc['id']}})[_0x64b6('0x2a')](function(){return _0x5833df;});})['then'](function(){_0x58c480[_0x64b6('0x1f')](0xcc)[_0x64b6('0x20')]();});}};}function handleEntityNotFound(_0x14533a,_0x116ba8){return function(_0xce789e){if(!_0xce789e){_0x14533a[_0x64b6('0x1e')](0x194);}return _0xce789e;};}function handleError(_0x2a0ad7,_0x36a565){_0x36a565=_0x36a565||0x1f4;return function(_0x336e4d){logger[_0x64b6('0x2f')](_0x336e4d[_0x64b6('0x30')]);if(_0x336e4d[_0x64b6('0x31')]){delete _0x336e4d[_0x64b6('0x31')];}_0x2a0ad7['status'](_0x36a565)['send'](_0x336e4d);};}exports[_0x64b6('0x32')]=function(_0x179008,_0x35e481){var _0x1c4fca={},_0x1c7ba0={},_0x42fc0a={'count':0x0,'rows':[]};var _0x207ceb=_[_0x64b6('0x33')](db['FaxQueue'][_0x64b6('0x34')],function(_0x2f1710){return{'name':_0x2f1710['fieldName'],'type':_0x2f1710['type'][_0x64b6('0x35')]};});_0x1c7ba0[_0x64b6('0x36')]=_[_0x64b6('0x33')](_0x207ceb,_0x64b6('0x31'));_0x1c7ba0[_0x64b6('0x37')]=_['keys'](_0x179008[_0x64b6('0x37')]);_0x1c7ba0['filters']=_[_0x64b6('0x38')](_0x1c7ba0[_0x64b6('0x36')],_0x1c7ba0[_0x64b6('0x37')]);_0x1c4fca[_0x64b6('0x39')]=_[_0x64b6('0x38')](_0x1c7ba0['model'],qs['fields'](_0x179008['query'][_0x64b6('0x3a')]));_0x1c4fca[_0x64b6('0x39')]=_0x1c4fca[_0x64b6('0x39')][_0x64b6('0x3b')]?_0x1c4fca[_0x64b6('0x39')]:_0x1c7ba0['model'];if(!_0x179008[_0x64b6('0x37')][_0x64b6('0x3c')](_0x64b6('0x3d'))){_0x1c4fca[_0x64b6('0x24')]=qs['limit'](_0x179008[_0x64b6('0x37')][_0x64b6('0x24')]);_0x1c4fca['offset']=qs[_0x64b6('0x22')](_0x179008[_0x64b6('0x37')]['offset']);}_0x1c4fca[_0x64b6('0x3e')]=qs[_0x64b6('0x3f')](_0x179008[_0x64b6('0x37')][_0x64b6('0x3f')]);_0x1c4fca[_0x64b6('0x40')]=qs['filters'](_[_0x64b6('0x41')](_0x179008[_0x64b6('0x37')],_0x1c7ba0[_0x64b6('0x42')]),_0x207ceb);if(_0x179008[_0x64b6('0x37')][_0x64b6('0x43')]){_0x1c4fca[_0x64b6('0x40')]=_[_0x64b6('0x44')](_0x1c4fca['where'],{'$or':_['map'](_0x207ceb,function(_0x2b10e7){if(_0x2b10e7[_0x64b6('0x45')]!==_0x64b6('0x46')){var _0x2a093f={};_0x2a093f[_0x2b10e7[_0x64b6('0x31')]]={'$like':'%'+_0x179008[_0x64b6('0x37')][_0x64b6('0x43')]+'%'};return _0x2a093f;}})});}_0x1c4fca=_[_0x64b6('0x44')]({},_0x1c4fca,_0x179008[_0x64b6('0x47')]);var _0x31695a={'where':_0x1c4fca[_0x64b6('0x40')]};return db['FaxQueue'][_0x64b6('0x25')](_0x31695a)[_0x64b6('0x2a')](function(_0x555b8c){_0x42fc0a[_0x64b6('0x25')]=_0x555b8c;if(_0x179008[_0x64b6('0x37')]['includeAll']){_0x1c4fca[_0x64b6('0x48')]=[{'all':!![]}];}return db[_0x64b6('0x49')][_0x64b6('0x4a')](_0x1c4fca);})[_0x64b6('0x2a')](function(_0x10b944){_0x42fc0a[_0x64b6('0x4b')]=_0x10b944;return _0x42fc0a;})['then'](respondWithFilteredResult(_0x35e481,_0x1c4fca))[_0x64b6('0x4c')](handleError(_0x35e481,null));};exports[_0x64b6('0x4d')]=function(_0x24e0f7,_0x193119){var _0x4fcc83={'raw':!![],'where':{'id':_0x24e0f7['params']['id']}},_0x5da29e={};_0x5da29e[_0x64b6('0x36')]=_[_0x64b6('0x4e')](db['FaxQueue'][_0x64b6('0x34')]);_0x5da29e[_0x64b6('0x37')]=_[_0x64b6('0x4e')](_0x24e0f7[_0x64b6('0x37')]);_0x5da29e['filters']=_[_0x64b6('0x38')](_0x5da29e[_0x64b6('0x36')],_0x5da29e[_0x64b6('0x37')]);_0x4fcc83[_0x64b6('0x39')]=_[_0x64b6('0x38')](_0x5da29e[_0x64b6('0x36')],qs[_0x64b6('0x3a')](_0x24e0f7[_0x64b6('0x37')][_0x64b6('0x3a')]));_0x4fcc83[_0x64b6('0x39')]=_0x4fcc83[_0x64b6('0x39')][_0x64b6('0x3b')]?_0x4fcc83[_0x64b6('0x39')]:_0x5da29e[_0x64b6('0x36')];if(_0x24e0f7[_0x64b6('0x37')]['includeAll']){_0x4fcc83['include']=[{'all':!![]}];}_0x4fcc83=_[_0x64b6('0x44')]({},_0x4fcc83,_0x24e0f7[_0x64b6('0x47')]);return db[_0x64b6('0x49')][_0x64b6('0x4f')](_0x4fcc83)[_0x64b6('0x2a')](handleEntityNotFound(_0x193119,null))[_0x64b6('0x2a')](respondWithResult(_0x193119,null))[_0x64b6('0x4c')](handleError(_0x193119,null));};exports[_0x64b6('0x50')]=function(_0x2033a1,_0x724b77){return db[_0x64b6('0x49')][_0x64b6('0x50')](_0x2033a1[_0x64b6('0x51')],{})['then'](function(_0x4225bf){var _0x2a4aa7=_0x2033a1[_0x64b6('0x52')][_0x64b6('0x2c')]({'plain':!![]});if(!_0x2a4aa7)throw new Error(_0x64b6('0x53'));if(_0x2a4aa7[_0x64b6('0x54')]===_0x64b6('0x52')){var _0x21ec71=_0x4225bf['get']({'plain':!![]});var _0xdc00a7=_0x64b6('0x2d');return db[_0x64b6('0x55')][_0x64b6('0x4f')]({'where':{'name':_0xdc00a7,'userProfileId':_0x2a4aa7['userProfileId']},'raw':!![]})[_0x64b6('0x2a')](function(_0x3aae76){if(_0x3aae76&&_0x3aae76[_0x64b6('0x56')]===0x0){return db['UserProfileResource'][_0x64b6('0x50')]({'name':_0x21ec71[_0x64b6('0x31')],'resourceId':_0x21ec71['id'],'type':_0x3aae76[_0x64b6('0x31')],'sectionId':_0x3aae76['id']},{})[_0x64b6('0x2a')](function(){return _0x4225bf;});}else{return _0x4225bf;}})['catch'](function(_0x43af4c){logger['error'](_0x64b6('0x57'),_0x43af4c);throw _0x43af4c;});}return _0x4225bf;})[_0x64b6('0x2a')](respondWithResult(_0x724b77,0xc9))[_0x64b6('0x4c')](handleError(_0x724b77,null));};exports[_0x64b6('0x29')]=function(_0x4800a8,_0x3522cd){if(_0x4800a8[_0x64b6('0x51')]['id']){delete _0x4800a8[_0x64b6('0x51')]['id'];}return db[_0x64b6('0x49')][_0x64b6('0x4f')]({'where':{'id':_0x4800a8[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x3522cd,null))[_0x64b6('0x2a')](saveUpdates(_0x4800a8['body'],null))[_0x64b6('0x2a')](respondWithResult(_0x3522cd,null))[_0x64b6('0x4c')](handleError(_0x3522cd,null));};exports[_0x64b6('0x2b')]=function(_0x49180f,_0x1051ab){return db[_0x64b6('0x49')]['find']({'where':{'id':_0x49180f[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x1051ab,null))[_0x64b6('0x2a')](removeEntity(_0x1051ab,null))[_0x64b6('0x4c')](handleError(_0x1051ab,null));};exports[_0x64b6('0x59')]=function(_0x1c4acd,_0x19de63){return db['FaxQueue'][_0x64b6('0x59')]()[_0x64b6('0x2a')](respondWithResult(_0x19de63,null))[_0x64b6('0x4c')](handleError(_0x19de63,null));};exports['getMembers']=function(_0x215410,_0x4f486c,_0x2ff671){var _0x43ba19={'raw':!![],'where':{}},_0x59e3a6={},_0xe9be8;return db[_0x64b6('0x49')][_0x64b6('0x5a')]({'where':{'id':_0x215410[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x4f486c,null))['then'](function(_0x37d846){if(_0x37d846){_0xe9be8=_0x37d846[_0x64b6('0x2c')]({'plain':!![]});_0x59e3a6[_0x64b6('0x36')]=_['keys'](db[_0x64b6('0x5b')]['rawAttributes']);_0x59e3a6[_0x64b6('0x37')]=_[_0x64b6('0x4e')](_0x215410[_0x64b6('0x37')]);_0x59e3a6['filters']=_[_0x64b6('0x38')](_0x59e3a6[_0x64b6('0x36')],_0x59e3a6[_0x64b6('0x37')]);_0x43ba19[_0x64b6('0x39')]=_[_0x64b6('0x38')](_0x59e3a6['model'],qs[_0x64b6('0x3a')](_0x215410[_0x64b6('0x37')][_0x64b6('0x3a')]));_0x43ba19[_0x64b6('0x39')]=_0x43ba19[_0x64b6('0x39')][_0x64b6('0x3b')]?_0x43ba19[_0x64b6('0x39')]:_0x59e3a6[_0x64b6('0x36')];if(!_0x215410[_0x64b6('0x37')][_0x64b6('0x3c')](_0x64b6('0x3d'))){_0x43ba19[_0x64b6('0x24')]=qs[_0x64b6('0x24')](_0x215410[_0x64b6('0x37')][_0x64b6('0x24')]);_0x43ba19[_0x64b6('0x22')]=qs[_0x64b6('0x22')](_0x215410[_0x64b6('0x37')][_0x64b6('0x22')]);}_0x43ba19[_0x64b6('0x3e')]=qs['sort'](_0x215410['query'][_0x64b6('0x3f')]);_0x43ba19[_0x64b6('0x40')]=qs[_0x64b6('0x42')](_[_0x64b6('0x41')](_0x215410[_0x64b6('0x37')],_0x59e3a6[_0x64b6('0x42')]));_0x43ba19[_0x64b6('0x40')][_0x64b6('0x5c')]=_0x37d846['id'];if(_0x215410['query'][_0x64b6('0x43')]){_0x43ba19[_0x64b6('0x40')]=_[_0x64b6('0x44')](_0x43ba19[_0x64b6('0x40')],{'$or':_[_0x64b6('0x33')](_0x43ba19[_0x64b6('0x39')],function(_0x30484c){var _0x43e373={};_0x43e373[_0x30484c]={'$like':'%'+_0x215410[_0x64b6('0x37')]['filter']+'%'};return _0x43e373;})});}_0x43ba19=_['merge']({},_0x43ba19,_0x215410['options']);return db[_0x64b6('0x5b')][_0x64b6('0x4a')](_0x43ba19);}})[_0x64b6('0x2a')](function(_0x428c63){if(_0x428c63){return db['User'][_0x64b6('0x5d')]({'where':{'id':_[_0x64b6('0x33')](_0x428c63,_0x64b6('0x5e')),'role':_0x64b6('0x5f')},'attributes':['id','name',_0x64b6('0x60'),_0x64b6('0x61'),_0x64b6('0x62')]});}})[_0x64b6('0x2a')](function(_0x2cd12d){if(_0x2cd12d){return{'count':_0x2cd12d[_0x64b6('0x25')],'rows':_['map'](_0x2cd12d[_0x64b6('0x4b')],function(_0x1a8e46){return{'membername':_0x1a8e46[_0x64b6('0x31')],'UserId':_0x1a8e46['id'],'queue_name':_0xe9be8[_0x64b6('0x31')],'FaxQueueId':_0xe9be8['id'],'interface':util[_0x64b6('0x63')]('%s/%s',_0x64b6('0x64'),_0x1a8e46[_0x64b6('0x31')]),'penalty':0x0,'paused':_0x1a8e46[_0x64b6('0x60')],'createdAt':_0x1a8e46['createdAt'],'updatedAt':_0x1a8e46[_0x64b6('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x64b6('0x2a')](respondWithFilteredResult(_0x4f486c,_0x43ba19))[_0x64b6('0x4c')](handleError(_0x4f486c,null));};exports[_0x64b6('0x65')]=function(_0x3f0d0a,_0x123c70,_0x202684){var _0x534379={};var _0x24b53c={};var _0x1e1e28;var _0x12602b;return db[_0x64b6('0x49')][_0x64b6('0x5a')]({'where':{'id':_0x3f0d0a[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x123c70,null))[_0x64b6('0x2a')](function(_0x51c4fc){if(_0x51c4fc){_0x1e1e28=_0x51c4fc;_0x24b53c[_0x64b6('0x36')]=_[_0x64b6('0x4e')](db[_0x64b6('0x66')][_0x64b6('0x34')]);_0x24b53c[_0x64b6('0x37')]=_[_0x64b6('0x4e')](_0x3f0d0a[_0x64b6('0x37')]);_0x24b53c[_0x64b6('0x42')]=_['intersection'](_0x24b53c['model'],_0x24b53c[_0x64b6('0x37')]);_0x534379[_0x64b6('0x39')]=_[_0x64b6('0x38')](_0x24b53c[_0x64b6('0x36')],qs['fields'](_0x3f0d0a[_0x64b6('0x37')]['fields']));_0x534379['attributes']=_0x534379[_0x64b6('0x39')][_0x64b6('0x3b')]?_0x534379[_0x64b6('0x39')]:_0x24b53c['model'];_0x534379['order']=qs[_0x64b6('0x3f')](_0x3f0d0a[_0x64b6('0x37')][_0x64b6('0x3f')]);_0x534379[_0x64b6('0x40')]=qs[_0x64b6('0x42')](_[_0x64b6('0x41')](_0x3f0d0a[_0x64b6('0x37')],_0x24b53c[_0x64b6('0x42')]));if(_0x3f0d0a[_0x64b6('0x37')][_0x64b6('0x43')]){_0x534379[_0x64b6('0x40')]=_[_0x64b6('0x44')](_0x534379[_0x64b6('0x40')],{'$or':_[_0x64b6('0x33')](_0x534379['attributes'],function(_0x49e56b){var _0xe0814c={};_0xe0814c[_0x49e56b]={'$like':'%'+_0x3f0d0a[_0x64b6('0x37')][_0x64b6('0x43')]+'%'};return _0xe0814c;})});}_0x534379=_['merge']({},_0x534379,_0x3f0d0a[_0x64b6('0x47')]);return _0x1e1e28[_0x64b6('0x65')](_0x534379);}})['then'](function(_0x34d488){if(_0x34d488){_0x12602b=_0x34d488[_0x64b6('0x3b')];if(!_0x3f0d0a[_0x64b6('0x37')]['hasOwnProperty']('nolimit')){_0x534379[_0x64b6('0x24')]=qs['limit'](_0x3f0d0a['query'][_0x64b6('0x24')]);_0x534379['offset']=qs['offset'](_0x3f0d0a['query'][_0x64b6('0x22')]);}return _0x1e1e28[_0x64b6('0x65')](_0x534379);}})[_0x64b6('0x2a')](function(_0x4685eb){if(_0x4685eb){return _0x4685eb?{'count':_0x12602b,'rows':_0x4685eb}:null;}})[_0x64b6('0x2a')](respondWithResult(_0x123c70,null))[_0x64b6('0x4c')](handleError(_0x123c70,null));};exports[_0x64b6('0x67')]=function(_0x1546d4,_0x15794b,_0xaa12b){var _0x20b4dd=_0x1546d4[_0x64b6('0x51')][_0x64b6('0x68')];return db['Team'][_0x64b6('0x4a')]({'where':{'id':_0x20b4dd},'attributes':['id'],'include':[{'model':db[_0x64b6('0x69')],'as':_0x64b6('0x6a'),'attributes':['id',_0x64b6('0x31'),_0x64b6('0x6b'),_0x64b6('0x6c'),'interface'],'raw':!![]}]})[_0x64b6('0x2a')](function(_0x2cb10){if(_0x2cb10){var _0x1a1778=_[_0x64b6('0x6d')](_0x2cb10,function(_0x49ef40){var _0x1d9f9f=_0x49ef40[_0x64b6('0x2c')]({'plain':!![]});return _0x1d9f9f[_0x64b6('0x6a')];});return db[_0x64b6('0x49')][_0x64b6('0x4f')]({'where':{'id':_0x1546d4[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](function(_0x2f3f1f){return db[_0x64b6('0x6e')][_0x64b6('0x6f')](function(_0xb6f0ea){return _0x2f3f1f[_0x64b6('0x67')](_0x20b4dd,{'transaction':_0xb6f0ea})['then'](function(){return BPromise[_0x64b6('0x70')](_0x1a1778,function(_0x2f267d){return db[_0x64b6('0x5b')][_0x64b6('0x71')]({'where':{'UserId':_0x2f267d['id'],'FaxQueueId':_0x1546d4[_0x64b6('0x58')]['id']},'transaction':_0xb6f0ea});});})[_0x64b6('0x2a')](function(){_0x1a1778['forEach'](function(_0x431ad3){socket[_0x64b6('0x72')](_0x64b6('0x73'),{'UserId':_0x431ad3['id'],'FaxQueueId':_0x2f3f1f['id']});});});});});}})[_0x64b6('0x2a')](respondWithStatusCode(_0x15794b,null))['catch'](handleError(_0x15794b,null));};exports['removeTeams']=function(_0x3b9439,_0xebf9f3,_0x3d5d9a){return db[_0x64b6('0x66')][_0x64b6('0x4a')]({'where':{'id':_0x3b9439[_0x64b6('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x64b6('0x69')],'as':_0x64b6('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x64b6('0x2a')](handleEntityNotFound(_0xebf9f3,null))[_0x64b6('0x2a')](function(_0x994a8b){var _0x5ea230=_[_0x64b6('0x33')](_0x994a8b,'id');var _0x3dee6a=[];var _0xf340f0=[];var _0x3f9df4=squel[_0x64b6('0x74')]();_0x3f9df4[_0x64b6('0x75')](_0x64b6('0x76'))[_0x64b6('0x77')]('team_has_fax_queues','tq')[_0x64b6('0x78')](_0x64b6('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x64b6('0x40')](_0x64b6('0x7a'),_0x3b9439[_0x64b6('0x58')]['id']);for(var _0x5964ec=0x0;_0x5964ec<_0x994a8b[_0x64b6('0x3b')];_0x5964ec+=0x1){let _0xaa4170=_0x994a8b[_0x5964ec];for(var _0x11a217=0x0;_0x11a217<_0xaa4170[_0x64b6('0x6a')][_0x64b6('0x3b')];_0x11a217+=0x1){let _0xbb86ea=_0xaa4170['Agents'][_0x11a217];var _0x2c9be4=_0x3f9df4[_0x64b6('0x7b')]();_0x2c9be4[_0x64b6('0x40')](_0x64b6('0x7c'),_0xbb86ea['id']);_0xf340f0[_0x64b6('0x7d')](db[_0x64b6('0x6e')][_0x64b6('0x37')](_0x2c9be4[_0x64b6('0x7e')](),{'type':db[_0x64b6('0x6e')][_0x64b6('0x7f')][_0x64b6('0x80')]})['then'](function(_0x3985c2){if(_0x3985c2[_0x64b6('0x3b')]===0x1){return _0xbb86ea['id'];}else{var _0x39672b=_[_0x64b6('0x81')](_[_0x64b6('0x33')](_0x3985c2,_0x64b6('0x82')),function(_0x1bb328){return _[_0x64b6('0x83')](_0x5ea230,_0x1bb328);});if(_0x39672b){return _0xbb86ea['id'];}}}));}}return BPromise['all'](_0xf340f0)['then'](function(_0x1fed10){_0x3dee6a=_(_0x3dee6a)['union'](_0x1fed10)['compact']()[_0x64b6('0x84')]();return db[_0x64b6('0x49')][_0x64b6('0x4f')]({'where':{'id':_0x3b9439['params']['id']}})[_0x64b6('0x2a')](function(_0x3138c0){return db[_0x64b6('0x6e')][_0x64b6('0x6f')](function(_0x3ef70a){return _0x3138c0[_0x64b6('0x85')](_0x3b9439[_0x64b6('0x37')][_0x64b6('0x68')],{'transaction':_0x3ef70a})[_0x64b6('0x2a')](function(){if(!_[_0x64b6('0x86')](_0x3dee6a)){return _0x3138c0[_0x64b6('0x87')](_0x3dee6a,{'transaction':_0x3ef70a});}})[_0x64b6('0x2a')](function(){_0x3dee6a['forEach'](function(_0x187e09){socket['emit']('userFaxQueue:remove',{'UserId':_0x187e09,'FaxQueueId':_0x3138c0['id']});});});});});});})[_0x64b6('0x2a')](respondWithStatusCode(_0xebf9f3,null))[_0x64b6('0x4c')](handleError(_0xebf9f3,null));};exports['addAgents']=function(_0x4cc7f0,_0x229e0e,_0xf68a6){return db[_0x64b6('0x49')][_0x64b6('0x4f')]({'where':{'id':_0x4cc7f0['params']['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x229e0e,null))[_0x64b6('0x2a')](function(_0x18b857){if(_0x18b857){return _0x18b857['addAgents'](_0x4cc7f0[_0x64b6('0x51')][_0x64b6('0x68')],_[_0x64b6('0x88')](_0x4cc7f0[_0x64b6('0x51')],[_0x64b6('0x68'),'id'])||{})[_0x64b6('0x89')](function(_0x5ac63a){for(var _0x2ead1b=0x0;_0x2ead1b<_0x4cc7f0[_0x64b6('0x51')]['ids']['length'];_0x2ead1b+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x4cc7f0[_0x64b6('0x51')][_0x64b6('0x68')][_0x2ead1b]),'FaxQueueId':Number(_0x4cc7f0[_0x64b6('0x58')]['id'])});}return _0x5ac63a;});}})[_0x64b6('0x2a')](respondWithResult(_0x229e0e,null))[_0x64b6('0x4c')](handleError(_0x229e0e,null));};exports[_0x64b6('0x87')]=function(_0xd67e41,_0x583787,_0x494b03){return db[_0x64b6('0x49')]['find']({'where':{'id':_0xd67e41['params']['id']}})['then'](handleEntityNotFound(_0x583787,null))['then'](function(_0x456e0f){if(_0x456e0f){return _0x456e0f[_0x64b6('0x87')](_0xd67e41[_0x64b6('0x37')]['ids'])[_0x64b6('0x2a')](function(){if(_['isArray'](_0xd67e41[_0x64b6('0x37')][_0x64b6('0x68')])){for(var _0x311976=0x0;_0x311976<_0xd67e41[_0x64b6('0x37')][_0x64b6('0x68')][_0x64b6('0x3b')];_0x311976+=0x1){socket[_0x64b6('0x72')]('userFaxQueue:remove',{'UserId':Number(_0xd67e41[_0x64b6('0x37')]['ids'][_0x311976]),'FaxQueueId':Number(_0xd67e41[_0x64b6('0x58')]['id'])});}}else{socket['emit'](_0x64b6('0x8a'),{'UserId':Number(_0xd67e41[_0x64b6('0x37')][_0x64b6('0x68')]),'FaxQueueId':Number(_0xd67e41[_0x64b6('0x58')]['id'])});}});}})[_0x64b6('0x2a')](respondWithStatusCode(_0x583787,null))['catch'](handleError(_0x583787,null));};exports[_0x64b6('0x8b')]=function(_0x231586,_0x3e7cf1,_0x7125){var _0x4dea3f={};var _0x303e2d={};var _0x1894cd;var _0x10b0f8;return db[_0x64b6('0x49')][_0x64b6('0x5a')]({'where':{'id':_0x231586[_0x64b6('0x58')]['id']}})[_0x64b6('0x2a')](handleEntityNotFound(_0x3e7cf1,null))[_0x64b6('0x2a')](function(_0x71e80f){if(_0x71e80f){_0x1894cd=_0x71e80f;_0x303e2d[_0x64b6('0x36')]=_[_0x64b6('0x4e')](db[_0x64b6('0x69')][_0x64b6('0x34')]);_0x303e2d[_0x64b6('0x37')]=_[_0x64b6('0x4e')](_0x231586[_0x64b6('0x37')]);_0x303e2d[_0x64b6('0x42')]=_[_0x64b6('0x38')](_0x303e2d['model'],_0x303e2d[_0x64b6('0x37')]);_0x4dea3f[_0x64b6('0x39')]=_['intersection'](_0x303e2d['model'],qs['fields'](_0x231586[_0x64b6('0x37')]['fields']));_0x4dea3f[_0x64b6('0x39')]=_0x4dea3f[_0x64b6('0x39')][_0x64b6('0x3b')]?_0x4dea3f['attributes']:_0x303e2d[_0x64b6('0x36')];_0x4dea3f[_0x64b6('0x3e')]=qs['sort'](_0x231586[_0x64b6('0x37')]['sort']);_0x4dea3f[_0x64b6('0x40')]=qs[_0x64b6('0x42')](_['pick'](_0x231586[_0x64b6('0x37')],_0x303e2d[_0x64b6('0x42')]));if(_0x231586[_0x64b6('0x37')][_0x64b6('0x43')]){_0x4dea3f[_0x64b6('0x40')]=_[_0x64b6('0x44')](_0x4dea3f['where'],{'$or':_[_0x64b6('0x33')](_0x4dea3f['attributes'],function(_0xc8e28a){var _0x189f0c={};_0x189f0c[_0xc8e28a]={'$like':'%'+_0x231586[_0x64b6('0x37')][_0x64b6('0x43')]+'%'};return _0x189f0c;})});}_0x4dea3f=_[_0x64b6('0x44')]({},_0x4dea3f,_0x231586[_0x64b6('0x47')]);return _0x1894cd['getAgents'](_0x4dea3f);}})[_0x64b6('0x2a')](function(_0x32f3d4){if(_0x32f3d4){_0x10b0f8=_0x32f3d4[_0x64b6('0x3b')];if(!_0x231586[_0x64b6('0x37')]['hasOwnProperty'](_0x64b6('0x3d'))){_0x4dea3f[_0x64b6('0x24')]=qs[_0x64b6('0x24')](_0x231586[_0x64b6('0x37')][_0x64b6('0x24')]);_0x4dea3f[_0x64b6('0x22')]=qs['offset'](_0x231586['query']['offset']);}return _0x1894cd[_0x64b6('0x8b')](_0x4dea3f);}})[_0x64b6('0x2a')](function(_0xd398c1){if(_0xd398c1){return _0xd398c1?{'count':_0x10b0f8,'rows':_0xd398c1}:null;}})[_0x64b6('0x2a')](respondWithResult(_0x3e7cf1,null))[_0x64b6('0x4c')](handleError(_0x3e7cf1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 53d6ffe..a97c3c8 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 _0xf7f8=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','hasOwnProperty'];(function(_0x2d15f4,_0x9b0d03){var _0x216c88=function(_0x3ae656){while(--_0x3ae656){_0x2d15f4['push'](_0x2d15f4['shift']());}};_0x216c88(++_0x9b0d03);}(_0xf7f8,0x139));var _0x8f7f=function(_0x462935,_0x3914ab){_0x462935=_0x462935-0x0;var _0x386830=_0xf7f8[_0x462935];return _0x386830;};'use strict';var EventEmitter=require(_0x8f7f('0x0'));var FaxQueue=require(_0x8f7f('0x1'))['db'][_0x8f7f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8f7f('0x3')](0x0);var events={'afterCreate':_0x8f7f('0x4'),'afterUpdate':'update','afterDestroy':_0x8f7f('0x5')};function emitEvent(_0x45300d){return function(_0x19a5af,_0x301a81,_0x4de407){FaxQueueEvents['emit'](_0x45300d+':'+_0x19a5af['id'],_0x19a5af);FaxQueueEvents['emit'](_0x45300d,_0x19a5af);_0x4de407(null);};}for(var e in events){if(events[_0x8f7f('0x6')](e)){var event=events[e];FaxQueue[_0x8f7f('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x3b83=['exports','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x38979b,_0x520083){var _0x52fdad=function(_0x31ac9f){while(--_0x31ac9f){_0x38979b['push'](_0x38979b['shift']());}};_0x52fdad(++_0x520083);}(_0x3b83,0x1b9));var _0x33b8=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x3b83[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x33b8('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x33b8('0x1')](0x0);var events={'afterCreate':_0x33b8('0x2'),'afterUpdate':'update','afterDestroy':_0x33b8('0x3')};function emitEvent(_0xb0156b){return function(_0x4c03cd,_0x4ed0c5,_0x4d7dc8){FaxQueueEvents[_0x33b8('0x4')](_0xb0156b+':'+_0x4c03cd['id'],_0x4c03cd);FaxQueueEvents[_0x33b8('0x4')](_0xb0156b,_0x4c03cd);_0x4d7dc8(null);};}for(var e in events){if(events[_0x33b8('0x5')](e)){var event=events[e];FaxQueue[_0x33b8('0x6')](e,emitEvent(event));}}module[_0x33b8('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6abaae9..b033707 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 _0x53ae=['lodash','util','../../config/logger','request-promise','path','./faxQueue.attributes','exports','FaxQueue'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x53ae,0x100));var _0xe53a=function(_0x429156,_0x3e0e2f){_0x429156=_0x429156-0x0;var _0x43a0ab=_0x53ae[_0x429156];return _0x43a0ab;};'use strict';var _=require(_0xe53a('0x0'));var util=require(_0xe53a('0x1'));var logger=require(_0xe53a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe53a('0x3'));var fs=require('fs');var path=require(_0xe53a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe53a('0x5'));module[_0xe53a('0x6')]=function(_0xf124d8,_0x1d6c99){return _0xf124d8['define'](_0xe53a('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f0d=['util','../../config/logger','moment','bluebird','request-promise','path','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x569b21,_0x227c96){var _0x260687=function(_0x2cdeb1){while(--_0x2cdeb1){_0x569b21['push'](_0x569b21['shift']());}};_0x260687(++_0x227c96);}(_0x5f0d,0x196));var _0xd5f0=function(_0x2b9325,_0x526b39){_0x2b9325=_0x2b9325-0x0;var _0x23d8c7=_0x5f0d[_0x2b9325];return _0x23d8c7;};'use strict';var _=require(_0xd5f0('0x0'));var util=require(_0xd5f0('0x1'));var logger=require(_0xd5f0('0x2'))('api');var moment=require(_0xd5f0('0x3'));var BPromise=require(_0xd5f0('0x4'));var rp=require(_0xd5f0('0x5'));var fs=require('fs');var path=require(_0xd5f0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xd5f0('0x7')]=function(_0x58ecf0,_0x5ceda3){return _0x58ecf0[_0xd5f0('0x8')](_0xd5f0('0x9'),attributes,{'tableName':_0xd5f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 1612964..af51290 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 _0xc730=['then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowFaxQueue','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xc730,0x188));var _0x0c73=function(_0x32cbeb,_0x301d14){_0x32cbeb=_0x32cbeb-0x0;var _0x27f69b=_0xc730[_0x32cbeb];return _0x27f69b;};'use strict';var _=require(_0x0c73('0x0'));var util=require('util');var moment=require(_0x0c73('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c73('0x2'));var fs=require('fs');var Redis=require(_0x0c73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c73('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c73('0x5'));var jayson=require(_0x0c73('0x6'));var client=jayson[_0x0c73('0x7')][_0x0c73('0x8')]({'port':0x232a});config[_0x0c73('0x9')]=_[_0x0c73('0xa')](config[_0x0c73('0x9')],{'host':_0x0c73('0xb'),'port':0x18eb});var socket=require(_0x0c73('0xc'))(new Redis(config[_0x0c73('0x9')]));require(_0x0c73('0xd'))['register'](socket);function respondWithRpcPromise(_0xcad0ce,_0x3851e1,_0x28df0e){return new BPromise(function(_0x27da1d,_0x5e58f6){return client[_0x0c73('0xe')](_0xcad0ce,_0x28df0e)[_0x0c73('0xf')](function(_0x10229d){logger['info'](_0x0c73('0x10'),_0x3851e1,_0x0c73('0x11'));logger[_0x0c73('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3851e1,'request\x20sent',JSON[_0x0c73('0x13')](_0x10229d));if(_0x10229d['error']){if(_0x10229d[_0x0c73('0x14')][_0x0c73('0x15')]===0x1f4){logger[_0x0c73('0x14')](_0x0c73('0x10'),_0x3851e1,_0x10229d['error'][_0x0c73('0x16')]);return _0x5e58f6(_0x10229d[_0x0c73('0x14')][_0x0c73('0x16')]);}logger['error'](_0x0c73('0x10'),_0x3851e1,_0x10229d['error'][_0x0c73('0x16')]);return _0x27da1d(_0x10229d['error'][_0x0c73('0x16')]);}else{logger[_0x0c73('0x17')](_0x0c73('0x10'),_0x3851e1,_0x0c73('0x11'));_0x27da1d(_0x10229d['result'][_0x0c73('0x16')]);}})['catch'](function(_0x707623){logger[_0x0c73('0x14')](_0x0c73('0x10'),_0x3851e1,_0x707623);_0x5e58f6(_0x707623);});});}exports[_0x0c73('0x18')]=function(_0x41169a){var _0x2b1ecc=this;return new Promise(function(_0x49fbbb,_0x2b2e0e){return db[_0x0c73('0x19')]['findAll']({'raw':_0x41169a[_0x0c73('0x1a')]?_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1b')]===undefined?!![]:![]:!![],'where':_0x41169a[_0x0c73('0x1a')]?_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1c')]||null:null,'attributes':_0x41169a['options']?_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1d')]||null:null,'limit':_0x41169a[_0x0c73('0x1a')]?_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1e')]||null:null,'include':_0x41169a[_0x0c73('0x1a')]?_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1f')]?_[_0x0c73('0x20')](_0x41169a[_0x0c73('0x1a')][_0x0c73('0x1f')],function(_0x5ab3af){return{'model':db[_0x5ab3af[_0x0c73('0x21')]],'as':_0x5ab3af['as'],'attributes':_0x5ab3af[_0x0c73('0x1d')],'include':_0x5ab3af[_0x0c73('0x1f')]?_['map'](_0x5ab3af[_0x0c73('0x1f')],function(_0x194486){return{'model':db[_0x194486['model']],'as':_0x194486['as'],'attributes':_0x194486['attributes'],'include':_0x194486['include']?_['map'](_0x194486[_0x0c73('0x1f')],function(_0x5d39cf){return{'model':db[_0x5d39cf[_0x0c73('0x21')]],'as':_0x5d39cf['as'],'attributes':_0x5d39cf[_0x0c73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c73('0xf')](function(_0x2cadad){logger[_0x0c73('0x17')](_0x0c73('0x18'),_0x41169a);logger[_0x0c73('0x12')](_0x0c73('0x18'),_0x41169a,JSON[_0x0c73('0x13')](_0x2cadad));_0x49fbbb(_0x2cadad);})[_0x0c73('0x22')](function(_0x308c30){logger[_0x0c73('0x14')]('GetFaxQueue',_0x308c30[_0x0c73('0x16')],_0x41169a);_0x2b2e0e(_0x2b1ecc['error'](0x1f4,_0x308c30[_0x0c73('0x16')]));});});};exports[_0x0c73('0x23')]=function(_0x317d8c){var _0x5aa12b=this;return new Promise(function(_0x263f03,_0xb7fa07){return db[_0x0c73('0x19')][_0x0c73('0x24')]({'raw':_0x317d8c[_0x0c73('0x1a')]?_0x317d8c[_0x0c73('0x1a')][_0x0c73('0x1b')]===undefined?!![]:![]:!![],'where':_0x317d8c[_0x0c73('0x1a')]?_0x317d8c[_0x0c73('0x1a')]['where']||null:null,'attributes':_0x317d8c[_0x0c73('0x1a')]?_0x317d8c[_0x0c73('0x1a')][_0x0c73('0x1d')]||null:null,'include':_0x317d8c[_0x0c73('0x1a')]?_0x317d8c['options'][_0x0c73('0x1f')]?_['map'](_0x317d8c[_0x0c73('0x1a')][_0x0c73('0x1f')],function(_0x48cd44){return{'model':db[_0x48cd44['model']],'as':_0x48cd44['as'],'attributes':_0x48cd44[_0x0c73('0x1d')],'include':_0x48cd44[_0x0c73('0x1f')]?_[_0x0c73('0x20')](_0x48cd44[_0x0c73('0x1f')],function(_0x37550c){return{'model':db[_0x37550c[_0x0c73('0x21')]],'as':_0x37550c['as'],'attributes':_0x37550c[_0x0c73('0x1d')],'include':_0x37550c['include']?_['map'](_0x37550c['include'],function(_0xe1381d){return{'model':db[_0xe1381d[_0x0c73('0x21')]],'as':_0xe1381d['as'],'attributes':_0xe1381d[_0x0c73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c73('0xf')](function(_0x8e826e){logger['info']('ShowFaxQueue',_0x317d8c);logger[_0x0c73('0x12')](_0x0c73('0x23'),_0x317d8c,JSON[_0x0c73('0x13')](_0x8e826e));_0x263f03(_0x8e826e);})[_0x0c73('0x22')](function(_0x4dfc48){logger[_0x0c73('0x14')](_0x0c73('0x23'),_0x4dfc48[_0x0c73('0x16')],_0x317d8c);_0xb7fa07(_0x5aa12b[_0x0c73('0x14')](0x1f4,_0x4dfc48[_0x0c73('0x16')]));});});}; \ No newline at end of file +var _0x2470=['GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x23b339,_0x5c4493){var _0x5f3a1f=function(_0x9b758){while(--_0x9b758){_0x23b339['push'](_0x23b339['shift']());}};_0x5f3a1f(++_0x5c4493);}(_0x2470,0x70));var _0x0247=function(_0x4dc580,_0xf0b388){_0x4dc580=_0x4dc580-0x0;var _0x32b93b=_0x2470[_0x4dc580];return _0x32b93b;};'use strict';var _=require(_0x0247('0x0'));var util=require('util');var moment=require(_0x0247('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0247('0x2'));var db=require(_0x0247('0x3'))['db'];var utils=require(_0x0247('0x4'));var logger=require('../../config/logger')(_0x0247('0x5'));var config=require(_0x0247('0x6'));var jayson=require(_0x0247('0x7'));var client=jayson[_0x0247('0x8')]['http']({'port':0x232a});config[_0x0247('0x9')]=_[_0x0247('0xa')](config[_0x0247('0x9')],{'host':_0x0247('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1a5b22,_0x3e22bd,_0x37e230){return new BPromise(function(_0x58e146,_0x401895){return client[_0x0247('0xc')](_0x1a5b22,_0x37e230)[_0x0247('0xd')](function(_0x57849c){logger['info'](_0x0247('0xe'),_0x3e22bd,_0x0247('0xf'));logger[_0x0247('0x10')](_0x0247('0x11'),_0x3e22bd,'request\x20sent',JSON[_0x0247('0x12')](_0x57849c));if(_0x57849c['error']){if(_0x57849c['error']['code']===0x1f4){logger[_0x0247('0x13')](_0x0247('0xe'),_0x3e22bd,_0x57849c['error'][_0x0247('0x14')]);return _0x401895(_0x57849c[_0x0247('0x13')][_0x0247('0x14')]);}logger['error'](_0x0247('0xe'),_0x3e22bd,_0x57849c[_0x0247('0x13')]['message']);return _0x58e146(_0x57849c[_0x0247('0x13')][_0x0247('0x14')]);}else{logger[_0x0247('0x15')](_0x0247('0xe'),_0x3e22bd,_0x0247('0xf'));_0x58e146(_0x57849c['result'][_0x0247('0x14')]);}})[_0x0247('0x16')](function(_0x300ba6){logger[_0x0247('0x13')]('FaxQueue,\x20%s,\x20%s',_0x3e22bd,_0x300ba6);_0x401895(_0x300ba6);});});}exports['GetFaxQueue']=function(_0x3c4b34){var _0x1da4c3=this;return new Promise(function(_0x4873b7,_0x4af6f1){return db['FaxQueue'][_0x0247('0x17')]({'raw':_0x3c4b34['options']?_0x3c4b34[_0x0247('0x18')][_0x0247('0x19')]===undefined?!![]:![]:!![],'where':_0x3c4b34[_0x0247('0x18')]?_0x3c4b34[_0x0247('0x18')][_0x0247('0x1a')]||null:null,'attributes':_0x3c4b34[_0x0247('0x18')]?_0x3c4b34['options'][_0x0247('0x1b')]||null:null,'limit':_0x3c4b34['options']?_0x3c4b34[_0x0247('0x18')][_0x0247('0x1c')]||null:null,'include':_0x3c4b34[_0x0247('0x18')]?_0x3c4b34[_0x0247('0x18')][_0x0247('0x1d')]?_[_0x0247('0x1e')](_0x3c4b34['options'][_0x0247('0x1d')],function(_0x59c24c){return{'model':db[_0x59c24c[_0x0247('0x1f')]],'as':_0x59c24c['as'],'attributes':_0x59c24c[_0x0247('0x1b')],'include':_0x59c24c[_0x0247('0x1d')]?_[_0x0247('0x1e')](_0x59c24c['include'],function(_0xc7b8eb){return{'model':db[_0xc7b8eb[_0x0247('0x1f')]],'as':_0xc7b8eb['as'],'attributes':_0xc7b8eb['attributes'],'include':_0xc7b8eb['include']?_[_0x0247('0x1e')](_0xc7b8eb[_0x0247('0x1d')],function(_0x1ed796){return{'model':db[_0x1ed796['model']],'as':_0x1ed796['as'],'attributes':_0x1ed796[_0x0247('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0247('0xd')](function(_0x11103f){logger[_0x0247('0x15')](_0x0247('0x20'),_0x3c4b34);logger[_0x0247('0x10')](_0x0247('0x20'),_0x3c4b34,JSON[_0x0247('0x12')](_0x11103f));_0x4873b7(_0x11103f);})['catch'](function(_0xb09bcf){logger[_0x0247('0x13')](_0x0247('0x20'),_0xb09bcf[_0x0247('0x14')],_0x3c4b34);_0x4af6f1(_0x1da4c3[_0x0247('0x13')](0x1f4,_0xb09bcf['message']));});});};exports[_0x0247('0x21')]=function(_0xd23631){var _0x5d6cb4=this;return new Promise(function(_0x33da4c,_0x3c560b){return db[_0x0247('0x22')][_0x0247('0x23')]({'raw':_0xd23631[_0x0247('0x18')]?_0xd23631[_0x0247('0x18')][_0x0247('0x19')]===undefined?!![]:![]:!![],'where':_0xd23631[_0x0247('0x18')]?_0xd23631[_0x0247('0x18')][_0x0247('0x1a')]||null:null,'attributes':_0xd23631['options']?_0xd23631[_0x0247('0x18')][_0x0247('0x1b')]||null:null,'include':_0xd23631[_0x0247('0x18')]?_0xd23631[_0x0247('0x18')][_0x0247('0x1d')]?_['map'](_0xd23631['options'][_0x0247('0x1d')],function(_0x410c56){return{'model':db[_0x410c56[_0x0247('0x1f')]],'as':_0x410c56['as'],'attributes':_0x410c56[_0x0247('0x1b')],'include':_0x410c56['include']?_[_0x0247('0x1e')](_0x410c56[_0x0247('0x1d')],function(_0x558114){return{'model':db[_0x558114[_0x0247('0x1f')]],'as':_0x558114['as'],'attributes':_0x558114['attributes'],'include':_0x558114[_0x0247('0x1d')]?_[_0x0247('0x1e')](_0x558114[_0x0247('0x1d')],function(_0x384772){return{'model':db[_0x384772[_0x0247('0x1f')]],'as':_0x384772['as'],'attributes':_0x384772[_0x0247('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0247('0xd')](function(_0x4160f1){logger[_0x0247('0x15')](_0x0247('0x21'),_0xd23631);logger[_0x0247('0x10')](_0x0247('0x21'),_0xd23631,JSON[_0x0247('0x12')](_0x4160f1));_0x33da4c(_0x4160f1);})[_0x0247('0x16')](function(_0x24fd18){logger[_0x0247('0x13')]('ShowFaxQueue',_0x24fd18[_0x0247('0x14')],_0xd23631);_0x3c560b(_0x5d6cb4['error'](0x1f4,_0x24fd18[_0x0247('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d4171da..52e2847 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 _0x5c1f=['emit','register','length','./faxQueue.events','remove','update'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x5c1f[_0x15942a];return _0x36a9fb;};'use strict';var FaxQueueEvents=require(_0xf5c1('0x0'));var events=['save',_0xf5c1('0x1'),_0xf5c1('0x2')];function createListener(_0x5dc804,_0x245264){return function(_0xcc7e35){_0x245264[_0xf5c1('0x3')](_0x5dc804,_0xcc7e35);};}function removeListener(_0x51ea7a,_0x5c0515){return function(){FaxQueueEvents['removeListener'](_0x51ea7a,_0x5c0515);};}exports[_0xf5c1('0x4')]=function(_0x3a7475){for(var _0x52e4cb=0x0,_0x34a073=events[_0xf5c1('0x5')];_0x52e4cb<_0x34a073;_0x52e4cb++){var _0x12128b=events[_0x52e4cb];var _0x40cad7=createListener('faxQueue:'+_0x12128b,_0x3a7475);FaxQueueEvents['on'](_0x12128b,_0x40cad7);}}; \ No newline at end of file +var _0x0035=['update','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x21dd2b,_0x18591e){var _0x407d23=function(_0x28f16d){while(--_0x28f16d){_0x21dd2b['push'](_0x21dd2b['shift']());}};_0x407d23(++_0x18591e);}(_0x0035,0x14d));var _0x5003=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x0035[_0x3fa296];return _0x10b19f;};'use strict';var FaxQueueEvents=require(_0x5003('0x0'));var events=[_0x5003('0x1'),_0x5003('0x2'),_0x5003('0x3')];function createListener(_0x3386e3,_0x5ef6c8){return function(_0x59b41d){_0x5ef6c8['emit'](_0x3386e3,_0x59b41d);};}function removeListener(_0x3b3f00,_0x1523fa){return function(){FaxQueueEvents[_0x5003('0x4')](_0x3b3f00,_0x1523fa);};}exports[_0x5003('0x5')]=function(_0x568db7){for(var _0x1f39c2=0x0,_0x10c956=events[_0x5003('0x6')];_0x1f39c2<_0x10c956;_0x1f39c2++){var _0x253e37=events[_0x1f39c2];var _0x589ab8=createListener(_0x5003('0x7')+_0x253e37,_0x568db7);FaxQueueEvents['on'](_0x253e37,_0x589ab8);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 131227b..4c45b5c 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 _0xfb11=['Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout'];(function(_0x494636,_0x395312){var _0x4cfea5=function(_0x3f6aa0){while(--_0x3f6aa0){_0x494636['push'](_0x494636['shift']());}};_0x4cfea5(++_0x395312);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xfb11[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xb')](_0x1fb1('0xe'),auth[_0x1fb1('0x7')](),controller['getMembers']);router[_0x1fb1('0xb')]('/:id/teams',auth[_0x1fb1('0x7')](),controller['getTeams']);router[_0x1fb1('0xb')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x10')]);router[_0x1fb1('0x11')]('/',auth[_0x1fb1('0x7')](),controller['create']);router[_0x1fb1('0x11')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x13')]);router[_0x1fb1('0x11')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x14')]);router[_0x1fb1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1fb1('0x16')]);router[_0x1fb1('0x17')](_0x1fb1('0xc'),auth['isAuthenticated'](),controller[_0x1fb1('0x18')]);router[_0x1fb1('0x17')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x19')]);router[_0x1fb1('0x17')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x2e612a,_0x106dd7){var _0x3cb97c=function(_0x367d2f){while(--_0x367d2f){_0x2e612a['push'](_0x2e612a['shift']());}};_0x3cb97c(++_0x106dd7);}(_0xc2c7,0x134));var _0x7c2c=function(_0x67cbf6,_0x488892){_0x67cbf6=_0x67cbf6-0x0;var _0x53dc85=_0xc2c7[_0x67cbf6];return _0x53dc85;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x14')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7c2c('0x14')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['addAgents']);router[_0x7c2c('0x16')](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['delete'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x19')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1a')]);router[_0x7c2c('0x19')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1b')]);module[_0x7c2c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index e927cda..f0eced1 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 _0xe7de=['DATE','STRING','moment','sequelize','exports'];(function(_0x5a2c8f,_0xddf7d0){var _0x20daec=function(_0x624f6a){while(--_0x624f6a){_0x5a2c8f['push'](_0x5a2c8f['shift']());}};_0x20daec(++_0xddf7d0);}(_0xe7de,0x165));var _0xee7d=function(_0xa78423,_0x4639ce){_0xa78423=_0xa78423-0x0;var _0x90edcf=_0xe7de[_0xa78423];return _0x90edcf;};'use strict';var moment=require(_0xee7d('0x0'));var Sequelize=require(_0xee7d('0x1'));module[_0xee7d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xee7d('0x3')]},'leaveAt':{'type':Sequelize[_0xee7d('0x3')]},'acceptAt':{'type':Sequelize[_0xee7d('0x3')]},'exitAt':{'type':Sequelize[_0xee7d('0x3')]},'reason':{'type':Sequelize[_0xee7d('0x4')]}}; \ No newline at end of file +var _0xdbcf=['sequelize','exports','STRING','DATE','moment'];(function(_0x2f9290,_0x280267){var _0x3bd2ab=function(_0x35df8a){while(--_0x35df8a){_0x2f9290['push'](_0x2f9290['shift']());}};_0x3bd2ab(++_0x280267);}(_0xdbcf,0x158));var _0xfdbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbcf[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfdbc('0x0'));var Sequelize=require(_0xfdbc('0x1'));module[_0xfdbc('0x2')]={'uniqueid':{'type':Sequelize[_0xfdbc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfdbc('0x3')]},'joinAt':{'type':Sequelize[_0xfdbc('0x4')]},'leaveAt':{'type':Sequelize[_0xfdbc('0x4')]},'acceptAt':{'type':Sequelize[_0xfdbc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 98d8a53..18c982f 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 _0x81a4=['status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','FaxQueueReport','key','model','query','keys','intersection','fields','attributes','length','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0x81a4,0x1a6));var _0x481a=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x81a4[_0xa6cc5c];return _0x44803d;};'use strict';var emlformat=require(_0x481a('0x0'));var rimraf=require(_0x481a('0x1'));var zipdir=require(_0x481a('0x2'));var jsonpatch=require(_0x481a('0x3'));var rp=require('request-promise');var moment=require(_0x481a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require(_0x481a('0x9'));var fs=require('fs');var fs_extra=require(_0x481a('0xa'));var _=require(_0x481a('0xb'));var squel=require('squel');var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var Redis=require('ioredis');var authService=require(_0x481a('0x11'));var qs=require(_0x481a('0x12'));var as=require(_0x481a('0x13'));var hardwareService=require(_0x481a('0x14'));var logger=require(_0x481a('0x15'))(_0x481a('0x16'));var utils=require(_0x481a('0x17'));var config=require(_0x481a('0x18'));var licenseUtil=require(_0x481a('0x19'));var db=require(_0x481a('0x1a'))['db'];function respondWithStatusCode(_0x507233,_0x5838af){_0x5838af=_0x5838af||0xcc;return function(_0x28a189){if(_0x28a189){return _0x507233[_0x481a('0x1b')](_0x5838af);}return _0x507233[_0x481a('0x1c')](_0x5838af)[_0x481a('0x1d')]();};}function respondWithResult(_0x44700a,_0x2e520b){_0x2e520b=_0x2e520b||0xc8;return function(_0x5637bd){if(_0x5637bd){return _0x44700a[_0x481a('0x1c')](_0x2e520b)['json'](_0x5637bd);}};}function respondWithFilteredResult(_0x238f3d,_0x1410c1){return function(_0x40f691){if(_0x40f691){var _0x507a5b=typeof _0x1410c1['offset']===_0x481a('0x1e')&&typeof _0x1410c1[_0x481a('0x1f')]===_0x481a('0x1e');var _0x152483=_0x40f691[_0x481a('0x20')];var _0x3186e3=_0x507a5b?0x0:_0x1410c1[_0x481a('0x21')];var _0x2e6d4e=_0x507a5b?_0x40f691[_0x481a('0x20')]:_0x1410c1[_0x481a('0x21')]+_0x1410c1['limit'];var _0x243883;if(_0x2e6d4e>=_0x152483){_0x2e6d4e=_0x152483;_0x243883=0xc8;}else{_0x243883=0xce;}_0x238f3d[_0x481a('0x1c')](_0x243883);return _0x238f3d[_0x481a('0x22')](_0x481a('0x23'),_0x3186e3+'-'+_0x2e6d4e+'/'+_0x152483)[_0x481a('0x24')](_0x40f691);}return null;};}function patchUpdates(_0x4a3a10){return function(_0x2e3549){try{jsonpatch[_0x481a('0x25')](_0x2e3549,_0x4a3a10,!![]);}catch(_0x248e88){return BPromise[_0x481a('0x26')](_0x248e88);}return _0x2e3549['save']();};}function saveUpdates(_0xce4b34,_0x1afd59){return function(_0x44673f){if(_0x44673f){return _0x44673f[_0x481a('0x27')](_0xce4b34)[_0x481a('0x28')](function(_0x17534e){return _0x17534e;});}return null;};}function removeEntity(_0x336ea1,_0x6a554b){return function(_0x56dc8f){if(_0x56dc8f){return _0x56dc8f[_0x481a('0x29')]()[_0x481a('0x28')](function(){_0x336ea1['status'](0xcc)[_0x481a('0x1d')]();});}};}function handleEntityNotFound(_0x4916fa,_0x1f7c7d){return function(_0x2ab2ed){if(!_0x2ab2ed){_0x4916fa[_0x481a('0x1b')](0x194);}return _0x2ab2ed;};}function handleError(_0xa86211,_0x542639){_0x542639=_0x542639||0x1f4;return function(_0x42acf4){logger[_0x481a('0x2a')](_0x42acf4[_0x481a('0x2b')]);if(_0x42acf4[_0x481a('0x2c')]){delete _0x42acf4[_0x481a('0x2c')];}_0xa86211[_0x481a('0x1c')](_0x542639)['send'](_0x42acf4);};}exports[_0x481a('0x2d')]=function(_0x33306a,_0xde418d){var _0x428e55={},_0x4e9d26={},_0x14317e={'count':0x0,'rows':[]};var _0x39d776=_[_0x481a('0x2e')](db[_0x481a('0x2f')]['rawAttributes'],function(_0x5071f4){return{'name':_0x5071f4['fieldName'],'type':_0x5071f4['type'][_0x481a('0x30')]};});_0x4e9d26[_0x481a('0x31')]=_[_0x481a('0x2e')](_0x39d776,'name');_0x4e9d26[_0x481a('0x32')]=_[_0x481a('0x33')](_0x33306a[_0x481a('0x32')]);_0x4e9d26['filters']=_[_0x481a('0x34')](_0x4e9d26[_0x481a('0x31')],_0x4e9d26['query']);_0x428e55['attributes']=_[_0x481a('0x34')](_0x4e9d26[_0x481a('0x31')],qs[_0x481a('0x35')](_0x33306a[_0x481a('0x32')][_0x481a('0x35')]));_0x428e55['attributes']=_0x428e55[_0x481a('0x36')][_0x481a('0x37')]?_0x428e55[_0x481a('0x36')]:_0x4e9d26[_0x481a('0x31')];if(!_0x33306a['query']['hasOwnProperty']('nolimit')){_0x428e55[_0x481a('0x1f')]=qs[_0x481a('0x1f')](_0x33306a['query'][_0x481a('0x1f')]);_0x428e55[_0x481a('0x21')]=qs['offset'](_0x33306a[_0x481a('0x32')]['offset']);}_0x428e55['order']=qs['sort'](_0x33306a[_0x481a('0x32')]['sort']);_0x428e55[_0x481a('0x38')]=qs[_0x481a('0x39')](_[_0x481a('0x3a')](_0x33306a[_0x481a('0x32')],_0x4e9d26['filters']),_0x39d776);if(_0x33306a[_0x481a('0x32')][_0x481a('0x3b')]){_0x428e55[_0x481a('0x38')]=_[_0x481a('0x3c')](_0x428e55[_0x481a('0x38')],{'$or':_[_0x481a('0x2e')](_0x39d776,function(_0x58881e){if(_0x58881e[_0x481a('0x3d')]!==_0x481a('0x3e')){var _0x21b1b4={};_0x21b1b4[_0x58881e['name']]={'$like':'%'+_0x33306a['query'][_0x481a('0x3b')]+'%'};return _0x21b1b4;}})});}_0x428e55=_[_0x481a('0x3c')]({},_0x428e55,_0x33306a[_0x481a('0x3f')]);var _0x224a30={'where':_0x428e55['where']};return db['FaxQueueReport']['count'](_0x224a30)['then'](function(_0xfcac26){_0x14317e[_0x481a('0x20')]=_0xfcac26;if(_0x33306a[_0x481a('0x32')]['includeAll']){_0x428e55[_0x481a('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x481a('0x41')](_0x428e55);})['then'](function(_0x2f74ea){_0x14317e[_0x481a('0x42')]=_0x2f74ea;return _0x14317e;})[_0x481a('0x28')](respondWithFilteredResult(_0xde418d,_0x428e55))['catch'](handleError(_0xde418d,null));};exports[_0x481a('0x43')]=function(_0x584514,_0x5c25b5){var _0x4aaa5c={'raw':!![],'where':{'id':_0x584514[_0x481a('0x44')]['id']}},_0x1c77b7={};_0x1c77b7[_0x481a('0x31')]=_[_0x481a('0x33')](db[_0x481a('0x2f')][_0x481a('0x45')]);_0x1c77b7[_0x481a('0x32')]=_['keys'](_0x584514['query']);_0x1c77b7[_0x481a('0x39')]=_[_0x481a('0x34')](_0x1c77b7[_0x481a('0x31')],_0x1c77b7['query']);_0x4aaa5c[_0x481a('0x36')]=_[_0x481a('0x34')](_0x1c77b7[_0x481a('0x31')],qs['fields'](_0x584514['query'][_0x481a('0x35')]));_0x4aaa5c[_0x481a('0x36')]=_0x4aaa5c[_0x481a('0x36')][_0x481a('0x37')]?_0x4aaa5c[_0x481a('0x36')]:_0x1c77b7[_0x481a('0x31')];if(_0x584514[_0x481a('0x32')][_0x481a('0x46')]){_0x4aaa5c[_0x481a('0x40')]=[{'all':!![]}];}_0x4aaa5c=_['merge']({},_0x4aaa5c,_0x584514[_0x481a('0x3f')]);return db['FaxQueueReport'][_0x481a('0x47')](_0x4aaa5c)['then'](handleEntityNotFound(_0x5c25b5,null))[_0x481a('0x28')](respondWithResult(_0x5c25b5,null))[_0x481a('0x48')](handleError(_0x5c25b5,null));};exports[_0x481a('0x49')]=function(_0x9a4d48,_0x52fc2c){return db[_0x481a('0x2f')][_0x481a('0x49')](_0x9a4d48['body'],{})[_0x481a('0x28')](respondWithResult(_0x52fc2c,0xc9))[_0x481a('0x48')](handleError(_0x52fc2c,null));};exports['update']=function(_0x5505dd,_0x35dff1){if(_0x5505dd['body']['id']){delete _0x5505dd['body']['id'];}return db[_0x481a('0x2f')][_0x481a('0x47')]({'where':{'id':_0x5505dd[_0x481a('0x44')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x35dff1,null))[_0x481a('0x28')](saveUpdates(_0x5505dd['body'],null))['then'](respondWithResult(_0x35dff1,null))['catch'](handleError(_0x35dff1,null));};exports['destroy']=function(_0x4de00c,_0x1c8a1f){return db[_0x481a('0x2f')]['find']({'where':{'id':_0x4de00c['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x1c8a1f,null))[_0x481a('0x28')](removeEntity(_0x1c8a1f,null))[_0x481a('0x48')](handleError(_0x1c8a1f,null));};exports[_0x481a('0x4a')]=function(_0x31fa5c,_0x4b4e74){return db[_0x481a('0x2f')]['describe']()[_0x481a('0x28')](respondWithResult(_0x4b4e74,null))[_0x481a('0x48')](handleError(_0x4b4e74,null));}; \ No newline at end of file +var _0x559a=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','FaxQueueReport','then','includeAll','include','findAll','catch','show','params','keys','length','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','end','error','stack','name','index','map'];(function(_0x2c4e99,_0xf40744){var _0x2fcebf=function(_0x208354){while(--_0x208354){_0x2c4e99['push'](_0x2c4e99['shift']());}};_0x2fcebf(++_0xf40744);}(_0x559a,0xb3));var _0xa559=function(_0x514bbb,_0xd6448a){_0x514bbb=_0x514bbb-0x0;var _0x3ac8e9=_0x559a[_0x514bbb];return _0x3ac8e9;};'use strict';var emlformat=require(_0xa559('0x0'));var rimraf=require(_0xa559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa559('0x2'));var rp=require(_0xa559('0x3'));var moment=require(_0xa559('0x4'));var BPromise=require(_0xa559('0x5'));var Mustache=require(_0xa559('0x6'));var util=require(_0xa559('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa559('0x8'));var ejs=require(_0xa559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa559('0xa'));var squel=require(_0xa559('0xb'));var crypto=require('crypto');var jsforce=require(_0xa559('0xc'));var deskjs=require(_0xa559('0xd'));var toCsv=require(_0xa559('0x8'));var querystring=require(_0xa559('0xe'));var Papa=require('papaparse');var Redis=require(_0xa559('0xf'));var authService=require(_0xa559('0x10'));var qs=require(_0xa559('0x11'));var as=require(_0xa559('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa559('0x13'));var utils=require(_0xa559('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa559('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442e26,_0x5f0463){_0x5f0463=_0x5f0463||0xcc;return function(_0x2a646e){if(_0x2a646e){return _0x442e26[_0xa559('0x16')](_0x5f0463);}return _0x442e26[_0xa559('0x17')](_0x5f0463)['end']();};}function respondWithResult(_0xe93c61,_0x3853fd){_0x3853fd=_0x3853fd||0xc8;return function(_0x5ed915){if(_0x5ed915){return _0xe93c61[_0xa559('0x17')](_0x3853fd)[_0xa559('0x18')](_0x5ed915);}};}function respondWithFilteredResult(_0x369d26,_0x1e48b3){return function(_0x539a4b){if(_0x539a4b){var _0x309c27=typeof _0x1e48b3['offset']===_0xa559('0x19')&&typeof _0x1e48b3[_0xa559('0x1a')]==='undefined';var _0x2c6993=_0x539a4b[_0xa559('0x1b')];var _0x163405=_0x309c27?0x0:_0x1e48b3[_0xa559('0x1c')];var _0x1a4c42=_0x309c27?_0x539a4b[_0xa559('0x1b')]:_0x1e48b3[_0xa559('0x1c')]+_0x1e48b3[_0xa559('0x1a')];var _0x329d59;if(_0x1a4c42>=_0x2c6993){_0x1a4c42=_0x2c6993;_0x329d59=0xc8;}else{_0x329d59=0xce;}_0x369d26[_0xa559('0x17')](_0x329d59);return _0x369d26['set']('Content-Range',_0x163405+'-'+_0x1a4c42+'/'+_0x2c6993)[_0xa559('0x18')](_0x539a4b);}return null;};}function patchUpdates(_0x3aa532){return function(_0x47cb65){try{jsonpatch[_0xa559('0x1d')](_0x47cb65,_0x3aa532,!![]);}catch(_0x190a9e){return BPromise[_0xa559('0x1e')](_0x190a9e);}return _0x47cb65[_0xa559('0x1f')]();};}function saveUpdates(_0x1812ef,_0x2dd8cf){return function(_0x572046){if(_0x572046){return _0x572046[_0xa559('0x20')](_0x1812ef)['then'](function(_0x1d4370){return _0x1d4370;});}return null;};}function removeEntity(_0x396fe9,_0x314fef){return function(_0x487a60){if(_0x487a60){return _0x487a60[_0xa559('0x21')]()['then'](function(){_0x396fe9[_0xa559('0x17')](0xcc)[_0xa559('0x22')]();});}};}function handleEntityNotFound(_0x5834c6,_0x2a5181){return function(_0x552c2c){if(!_0x552c2c){_0x5834c6['sendStatus'](0x194);}return _0x552c2c;};}function handleError(_0x1581b9,_0x1914e7){_0x1914e7=_0x1914e7||0x1f4;return function(_0x3fcf7f){logger[_0xa559('0x23')](_0x3fcf7f[_0xa559('0x24')]);if(_0x3fcf7f[_0xa559('0x25')]){delete _0x3fcf7f[_0xa559('0x25')];}_0x1581b9[_0xa559('0x17')](_0x1914e7)['send'](_0x3fcf7f);};}exports[_0xa559('0x26')]=function(_0x30a781,_0x21c8a0){var _0x1c92b9={},_0x5f3fbb={},_0x1fb70f={'count':0x0,'rows':[]};var _0x32db9d=_[_0xa559('0x27')](db['FaxQueueReport'][_0xa559('0x28')],function(_0x224a3a){return{'name':_0x224a3a[_0xa559('0x29')],'type':_0x224a3a[_0xa559('0x2a')][_0xa559('0x2b')]};});_0x5f3fbb[_0xa559('0x2c')]=_[_0xa559('0x27')](_0x32db9d,_0xa559('0x25'));_0x5f3fbb[_0xa559('0x2d')]=_['keys'](_0x30a781[_0xa559('0x2d')]);_0x5f3fbb[_0xa559('0x2e')]=_[_0xa559('0x2f')](_0x5f3fbb[_0xa559('0x2c')],_0x5f3fbb['query']);_0x1c92b9[_0xa559('0x30')]=_['intersection'](_0x5f3fbb[_0xa559('0x2c')],qs[_0xa559('0x31')](_0x30a781[_0xa559('0x2d')][_0xa559('0x31')]));_0x1c92b9[_0xa559('0x30')]=_0x1c92b9[_0xa559('0x30')]['length']?_0x1c92b9[_0xa559('0x30')]:_0x5f3fbb[_0xa559('0x2c')];if(!_0x30a781[_0xa559('0x2d')][_0xa559('0x32')](_0xa559('0x33'))){_0x1c92b9[_0xa559('0x1a')]=qs[_0xa559('0x1a')](_0x30a781[_0xa559('0x2d')]['limit']);_0x1c92b9[_0xa559('0x1c')]=qs[_0xa559('0x1c')](_0x30a781[_0xa559('0x2d')][_0xa559('0x1c')]);}_0x1c92b9[_0xa559('0x34')]=qs[_0xa559('0x35')](_0x30a781[_0xa559('0x2d')]['sort']);_0x1c92b9[_0xa559('0x36')]=qs[_0xa559('0x2e')](_[_0xa559('0x37')](_0x30a781[_0xa559('0x2d')],_0x5f3fbb[_0xa559('0x2e')]),_0x32db9d);if(_0x30a781[_0xa559('0x2d')][_0xa559('0x38')]){_0x1c92b9[_0xa559('0x36')]=_[_0xa559('0x39')](_0x1c92b9[_0xa559('0x36')],{'$or':_[_0xa559('0x27')](_0x32db9d,function(_0x2e9351){if(_0x2e9351[_0xa559('0x2a')]!=='VIRTUAL'){var _0x3e58e3={};_0x3e58e3[_0x2e9351['name']]={'$like':'%'+_0x30a781[_0xa559('0x2d')]['filter']+'%'};return _0x3e58e3;}})});}_0x1c92b9=_[_0xa559('0x39')]({},_0x1c92b9,_0x30a781['options']);var _0x3873c9={'where':_0x1c92b9[_0xa559('0x36')]};return db[_0xa559('0x3a')][_0xa559('0x1b')](_0x3873c9)[_0xa559('0x3b')](function(_0x2efc09){_0x1fb70f[_0xa559('0x1b')]=_0x2efc09;if(_0x30a781['query'][_0xa559('0x3c')]){_0x1c92b9[_0xa559('0x3d')]=[{'all':!![]}];}return db[_0xa559('0x3a')][_0xa559('0x3e')](_0x1c92b9);})[_0xa559('0x3b')](function(_0x278f31){_0x1fb70f['rows']=_0x278f31;return _0x1fb70f;})[_0xa559('0x3b')](respondWithFilteredResult(_0x21c8a0,_0x1c92b9))[_0xa559('0x3f')](handleError(_0x21c8a0,null));};exports[_0xa559('0x40')]=function(_0x429249,_0x5d6325){var _0x6340d3={'raw':!![],'where':{'id':_0x429249[_0xa559('0x41')]['id']}},_0x2af622={};_0x2af622[_0xa559('0x2c')]=_[_0xa559('0x42')](db['FaxQueueReport'][_0xa559('0x28')]);_0x2af622[_0xa559('0x2d')]=_[_0xa559('0x42')](_0x429249[_0xa559('0x2d')]);_0x2af622[_0xa559('0x2e')]=_[_0xa559('0x2f')](_0x2af622[_0xa559('0x2c')],_0x2af622['query']);_0x6340d3[_0xa559('0x30')]=_[_0xa559('0x2f')](_0x2af622[_0xa559('0x2c')],qs[_0xa559('0x31')](_0x429249[_0xa559('0x2d')][_0xa559('0x31')]));_0x6340d3[_0xa559('0x30')]=_0x6340d3[_0xa559('0x30')][_0xa559('0x43')]?_0x6340d3['attributes']:_0x2af622[_0xa559('0x2c')];if(_0x429249[_0xa559('0x2d')][_0xa559('0x3c')]){_0x6340d3[_0xa559('0x3d')]=[{'all':!![]}];}_0x6340d3=_[_0xa559('0x39')]({},_0x6340d3,_0x429249[_0xa559('0x44')]);return db[_0xa559('0x3a')]['find'](_0x6340d3)[_0xa559('0x3b')](handleEntityNotFound(_0x5d6325,null))[_0xa559('0x3b')](respondWithResult(_0x5d6325,null))[_0xa559('0x3f')](handleError(_0x5d6325,null));};exports[_0xa559('0x45')]=function(_0x425dda,_0x482e46){return db[_0xa559('0x3a')][_0xa559('0x45')](_0x425dda['body'],{})[_0xa559('0x3b')](respondWithResult(_0x482e46,0xc9))[_0xa559('0x3f')](handleError(_0x482e46,null));};exports['update']=function(_0x56a722,_0x140490){if(_0x56a722[_0xa559('0x46')]['id']){delete _0x56a722[_0xa559('0x46')]['id'];}return db[_0xa559('0x3a')][_0xa559('0x47')]({'where':{'id':_0x56a722[_0xa559('0x41')]['id']}})['then'](handleEntityNotFound(_0x140490,null))[_0xa559('0x3b')](saveUpdates(_0x56a722['body'],null))['then'](respondWithResult(_0x140490,null))['catch'](handleError(_0x140490,null));};exports[_0xa559('0x21')]=function(_0x2c200e,_0x17453f){return db[_0xa559('0x3a')][_0xa559('0x47')]({'where':{'id':_0x2c200e[_0xa559('0x41')]['id']}})[_0xa559('0x3b')](handleEntityNotFound(_0x17453f,null))[_0xa559('0x3b')](removeEntity(_0x17453f,null))[_0xa559('0x3f')](handleError(_0x17453f,null));};exports[_0xa559('0x48')]=function(_0x3be912,_0x4abc17){return db[_0xa559('0x3a')][_0xa559('0x48')]()[_0xa559('0x3b')](respondWithResult(_0x4abc17,null))[_0xa559('0x3f')](handleError(_0x4abc17,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ff32810..ec94ac1 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x1b5bd4,_0xaad02b){var _0x5b72bd=function(_0x231a68){while(--_0x231a68){_0x1b5bd4['push'](_0x1b5bd4['shift']());}};_0x5b72bd(++_0xaad02b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x5fc3[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59c40a,_0x15c388){var _0x419f13=function(_0x811eb0){while(--_0x811eb0){_0x59c40a['push'](_0x59c40a['shift']());}};_0x419f13(++_0x15c388);}(_0x4975,0x86));var _0x5497=function(_0x450c5c,_0x2a380a){_0x450c5c=_0x450c5c-0x0;var _0x14217d=_0x4975[_0x450c5c];return _0x14217d;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 5925b0e..8c6da64 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 _0x667a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util'];(function(_0x1952ca,_0x334418){var _0x547172=function(_0x1194b3){while(--_0x1194b3){_0x1952ca['push'](_0x1952ca['shift']());}};_0x547172(++_0x334418);}(_0x667a,0xd0));var _0xa667=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x667a[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xa667('0x0'));var util=require(_0xa667('0x1'));var moment=require(_0xa667('0x2'));var BPromise=require(_0xa667('0x3'));var rs=require(_0xa667('0x4'));var fs=require('fs');var Redis=require(_0xa667('0x5'));var db=require(_0xa667('0x6'))['db'];var utils=require(_0xa667('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa667('0x8'));var jayson=require(_0xa667('0x9'));var client=jayson[_0xa667('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb1dc98,_0x314492,_0x2780b8){return new BPromise(function(_0x2d4092,_0x22c0b4){return client[_0xa667('0xb')](_0xb1dc98,_0x2780b8)[_0xa667('0xc')](function(_0x9aa851){logger[_0xa667('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x314492,_0xa667('0xe'));logger[_0xa667('0xf')](_0xa667('0x10'),_0x314492,_0xa667('0xe'),JSON[_0xa667('0x11')](_0x9aa851));if(_0x9aa851[_0xa667('0x12')]){if(_0x9aa851[_0xa667('0x12')][_0xa667('0x13')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x314492,_0x9aa851[_0xa667('0x12')][_0xa667('0x14')]);return _0x22c0b4(_0x9aa851[_0xa667('0x12')]['message']);}logger[_0xa667('0x12')](_0xa667('0x15'),_0x314492,_0x9aa851[_0xa667('0x12')][_0xa667('0x14')]);return _0x2d4092(_0x9aa851[_0xa667('0x12')][_0xa667('0x14')]);}else{logger[_0xa667('0xd')](_0xa667('0x15'),_0x314492,_0xa667('0xe'));_0x2d4092(_0x9aa851[_0xa667('0x16')][_0xa667('0x14')]);}})[_0xa667('0x17')](function(_0x354a44){logger[_0xa667('0x12')](_0xa667('0x15'),_0x314492,_0x354a44);_0x22c0b4(_0x354a44);});});}exports[_0xa667('0x18')]=function(_0x3adb4d){var _0x406cd0=this;return new Promise(function(_0x4abc68,_0x27a8b6){return db[_0xa667('0x19')][_0xa667('0x1a')](_0x3adb4d['body'],{'raw':_0x3adb4d[_0xa667('0x1b')]?_0x3adb4d[_0xa667('0x1b')][_0xa667('0x1c')]===undefined?!![]:![]:!![]})[_0xa667('0xc')](function(_0x2b1fd5){logger[_0xa667('0xd')](_0xa667('0x18'),_0x3adb4d);logger[_0xa667('0xf')](_0xa667('0x18'),_0x3adb4d,JSON[_0xa667('0x11')](_0x2b1fd5));_0x4abc68(_0x2b1fd5);})[_0xa667('0x17')](function(_0x4151fe){logger['error'](_0xa667('0x18'),_0x4151fe[_0xa667('0x14')],_0x3adb4d);_0x27a8b6(_0x406cd0[_0xa667('0x12')](0x1f4,_0x4151fe['message']));});});};exports[_0xa667('0x1d')]=function(_0x1ad5d3){var _0x9903dc=this;return new Promise(function(_0x1a88d7,_0x80e35d){return db[_0xa667('0x19')][_0xa667('0x1e')](_0x1ad5d3[_0xa667('0x1f')],{'raw':_0x1ad5d3['options']?_0x1ad5d3[_0xa667('0x1b')][_0xa667('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ad5d3[_0xa667('0x1b')]?_0x1ad5d3[_0xa667('0x1b')][_0xa667('0x20')]||null:null,'attributes':_0x1ad5d3['options']?_0x1ad5d3[_0xa667('0x1b')][_0xa667('0x21')]||null:null,'limit':_0x1ad5d3[_0xa667('0x1b')]?_0x1ad5d3[_0xa667('0x1b')][_0xa667('0x22')]||null:null})[_0xa667('0xc')](function(_0x39a958){logger[_0xa667('0xd')](_0xa667('0x1d'),_0x1ad5d3);logger['debug']('UpdateFaxQueueReport',_0x1ad5d3,JSON[_0xa667('0x11')](_0x39a958));_0x1a88d7(_0x39a958);})[_0xa667('0x17')](function(_0x4b648d){logger[_0xa667('0x12')](_0xa667('0x1d'),_0x4b648d[_0xa667('0x14')],_0x1ad5d3);_0x80e35d(_0x9903dc['error'](0x1f4,_0x4b648d['message']));});});}; \ No newline at end of file +var _0x2cb6=['message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','body','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../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','code'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x2cb6,0x6b));var _0x62cb=function(_0xdd5495,_0x392c56){_0xdd5495=_0xdd5495-0x0;var _0x480fdb=_0x2cb6[_0xdd5495];return _0x480fdb;};'use strict';var _=require(_0x62cb('0x0'));var util=require(_0x62cb('0x1'));var moment=require('moment');var BPromise=require(_0x62cb('0x2'));var rs=require(_0x62cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62cb('0x4'))['db'];var utils=require(_0x62cb('0x5'));var logger=require(_0x62cb('0x6'))('rpc');var config=require(_0x62cb('0x7'));var jayson=require(_0x62cb('0x8'));var client=jayson[_0x62cb('0x9')][_0x62cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6113,_0x3eac05,_0x5bed08){return new BPromise(function(_0x3f827d,_0x2e200f){return client[_0x62cb('0xb')](_0x1b6113,_0x5bed08)[_0x62cb('0xc')](function(_0x458074){logger[_0x62cb('0xd')](_0x62cb('0xe'),_0x3eac05,_0x62cb('0xf'));logger[_0x62cb('0x10')](_0x62cb('0x11'),_0x3eac05,_0x62cb('0xf'),JSON[_0x62cb('0x12')](_0x458074));if(_0x458074['error']){if(_0x458074[_0x62cb('0x13')][_0x62cb('0x14')]===0x1f4){logger[_0x62cb('0x13')](_0x62cb('0xe'),_0x3eac05,_0x458074[_0x62cb('0x13')]['message']);return _0x2e200f(_0x458074[_0x62cb('0x13')][_0x62cb('0x15')]);}logger[_0x62cb('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3eac05,_0x458074['error'][_0x62cb('0x15')]);return _0x3f827d(_0x458074[_0x62cb('0x13')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3eac05,_0x62cb('0xf'));_0x3f827d(_0x458074['result']['message']);}})[_0x62cb('0x16')](function(_0x114866){logger[_0x62cb('0x13')](_0x62cb('0xe'),_0x3eac05,_0x114866);_0x2e200f(_0x114866);});});}exports[_0x62cb('0x17')]=function(_0x4dfd61){var _0x413053=this;return new Promise(function(_0x17a541,_0x12894b){return db[_0x62cb('0x18')][_0x62cb('0x19')](_0x4dfd61['body'],{'raw':_0x4dfd61[_0x62cb('0x1a')]?_0x4dfd61[_0x62cb('0x1a')][_0x62cb('0x1b')]===undefined?!![]:![]:!![]})[_0x62cb('0xc')](function(_0x34ff70){logger[_0x62cb('0xd')](_0x62cb('0x17'),_0x4dfd61);logger[_0x62cb('0x10')](_0x62cb('0x17'),_0x4dfd61,JSON[_0x62cb('0x12')](_0x34ff70));_0x17a541(_0x34ff70);})[_0x62cb('0x16')](function(_0x426e3a){logger[_0x62cb('0x13')](_0x62cb('0x17'),_0x426e3a[_0x62cb('0x15')],_0x4dfd61);_0x12894b(_0x413053[_0x62cb('0x13')](0x1f4,_0x426e3a[_0x62cb('0x15')]));});});};exports[_0x62cb('0x1c')]=function(_0x25e77e){var _0x139019=this;return new Promise(function(_0x29a434,_0x4f3335){return db[_0x62cb('0x18')]['update'](_0x25e77e[_0x62cb('0x1d')],{'raw':_0x25e77e[_0x62cb('0x1a')]?_0x25e77e[_0x62cb('0x1a')][_0x62cb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25e77e[_0x62cb('0x1a')]?_0x25e77e['options']['where']||null:null,'attributes':_0x25e77e['options']?_0x25e77e[_0x62cb('0x1a')][_0x62cb('0x1e')]||null:null,'limit':_0x25e77e['options']?_0x25e77e[_0x62cb('0x1a')][_0x62cb('0x1f')]||null:null})[_0x62cb('0xc')](function(_0x51258b){logger[_0x62cb('0xd')](_0x62cb('0x1c'),_0x25e77e);logger[_0x62cb('0x10')]('UpdateFaxQueueReport',_0x25e77e,JSON[_0x62cb('0x12')](_0x51258b));_0x29a434(_0x51258b);})[_0x62cb('0x16')](function(_0x196774){logger[_0x62cb('0x13')](_0x62cb('0x1c'),_0x196774['message'],_0x25e77e);_0x4f3335(_0x139019['error'](0x1f4,_0x196774[_0x62cb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 879980e..fb6dbca 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 _0x1153=['Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x4f8ef6,_0x31607b){var _0x4f6880=function(_0x30efa6){while(--_0x30efa6){_0x4f8ef6['push'](_0x4f8ef6['shift']());}};_0x4f6880(++_0x31607b);}(_0x1153,0xa8));var _0x3115=function(_0x6e1b23,_0x2e2cad){_0x6e1b23=_0x6e1b23-0x0;var _0x157d13=_0x1153[_0x6e1b23];return _0x157d13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3115('0x0'));var timeout=require(_0x3115('0x1'));var express=require(_0x3115('0x2'));var router=express[_0x3115('0x3')]();var fs_extra=require(_0x3115('0x4'));var auth=require(_0x3115('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x3115('0x6')]('/',auth[_0x3115('0x7')](),controller[_0x3115('0x8')]);router['get'](_0x3115('0x9'),auth[_0x3115('0x7')](),controller[_0x3115('0xa')]);router[_0x3115('0x6')](_0x3115('0xb'),auth[_0x3115('0x7')](),controller[_0x3115('0xc')]);router[_0x3115('0xd')]('/',auth[_0x3115('0x7')](),controller[_0x3115('0xe')]);router[_0x3115('0xf')](_0x3115('0xb'),auth[_0x3115('0x7')](),controller[_0x3115('0x10')]);router['delete'](_0x3115('0xb'),auth[_0x3115('0x7')](),controller[_0x3115('0x11')]);module[_0x3115('0x12')]=router; \ No newline at end of file +var _0x39a7=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','show','post','create','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x493720,_0x2e7724){var _0x3cfc8e=function(_0x1ceb74){while(--_0x1ceb74){_0x493720['push'](_0x493720['shift']());}};_0x3cfc8e(++_0x2e7724);}(_0x39a7,0x1ca));var _0x739a=function(_0x48bd63,_0x5f8e86){_0x48bd63=_0x48bd63-0x0;var _0x4eaade=_0x39a7[_0x48bd63];return _0x4eaade;};'use strict';var multer=require(_0x739a('0x0'));var util=require(_0x739a('0x1'));var path=require(_0x739a('0x2'));var timeout=require(_0x739a('0x3'));var express=require(_0x739a('0x4'));var router=express[_0x739a('0x5')]();var fs_extra=require(_0x739a('0x6'));var auth=require(_0x739a('0x7'));var interaction=require(_0x739a('0x8'));var config=require(_0x739a('0x9'));var controller=require(_0x739a('0xa'));router[_0x739a('0xb')]('/',auth[_0x739a('0xc')](),controller['index']);router[_0x739a('0xb')](_0x739a('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x739a('0xb')]('/:id',auth[_0x739a('0xc')](),controller[_0x739a('0xe')]);router[_0x739a('0xf')]('/',auth['isAuthenticated'](),controller[_0x739a('0x10')]);router['put']('/:id',auth[_0x739a('0xc')](),controller['update']);router[_0x739a('0x11')](_0x739a('0x12'),auth[_0x739a('0xc')](),controller[_0x739a('0x13')]);module[_0x739a('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 4faf35f..82e037f 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x373daf,_0x18b9a8){var _0x1fa416=function(_0x1c40b8){while(--_0x1c40b8){_0x373daf['push'](_0x373daf['shift']());}};_0x1fa416(++_0x18b9a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x23ab40,_0x2aca7d){var _0x472c0c=function(_0x36070e){while(--_0x36070e){_0x23ab40['push'](_0x23ab40['shift']());}};_0x472c0c(++_0x2aca7d);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e2bcd,_0xd135ce){_0x5e2bcd=_0x5e2bcd-0x0;var _0x163f4e=_0xedd9[_0x5e2bcd];return _0x163f4e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c98827c..9f540a1 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 _0x8a1d=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','FaxTransferReport','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x15106b,_0x4d96f6){var _0x521203=function(_0x4dbe23){while(--_0x4dbe23){_0x15106b['push'](_0x15106b['shift']());}};_0x521203(++_0x4d96f6);}(_0x8a1d,0x65));var _0xd8a1=function(_0xad98e1,_0x587cc5){_0xad98e1=_0xad98e1-0x0;var _0x519f07=_0x8a1d[_0xad98e1];return _0x519f07;};'use strict';var emlformat=require(_0xd8a1('0x0'));var rimraf=require(_0xd8a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd8a1('0x2'));var moment=require(_0xd8a1('0x3'));var BPromise=require(_0xd8a1('0x4'));var Mustache=require(_0xd8a1('0x5'));var util=require(_0xd8a1('0x6'));var path=require(_0xd8a1('0x7'));var sox=require(_0xd8a1('0x8'));var csv=require(_0xd8a1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8a1('0xa'));var _=require(_0xd8a1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd8a1('0xc'));var deskjs=require(_0xd8a1('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd8a1('0xe'));var Papa=require(_0xd8a1('0xf'));var Redis=require(_0xd8a1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8a1('0x11'));var as=require(_0xd8a1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8a1('0x13'))(_0xd8a1('0x14'));var utils=require('../../config/utils');var config=require(_0xd8a1('0x15'));var licenseUtil=require(_0xd8a1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36fcf1,_0x12bc89){_0x12bc89=_0x12bc89||0xcc;return function(_0x57a3a5){if(_0x57a3a5){return _0x36fcf1[_0xd8a1('0x17')](_0x12bc89);}return _0x36fcf1[_0xd8a1('0x18')](_0x12bc89)[_0xd8a1('0x19')]();};}function respondWithResult(_0x4d740b,_0x81d1b3){_0x81d1b3=_0x81d1b3||0xc8;return function(_0x27a1bb){if(_0x27a1bb){return _0x4d740b[_0xd8a1('0x18')](_0x81d1b3)['json'](_0x27a1bb);}};}function respondWithFilteredResult(_0x1cb926,_0x12ca40){return function(_0xef29f3){if(_0xef29f3){var _0x2a2126=typeof _0x12ca40[_0xd8a1('0x1a')]===_0xd8a1('0x1b')&&typeof _0x12ca40[_0xd8a1('0x1c')]===_0xd8a1('0x1b');var _0x1873bf=_0xef29f3[_0xd8a1('0x1d')];var _0x3b9c61=_0x2a2126?0x0:_0x12ca40[_0xd8a1('0x1a')];var _0xd31363=_0x2a2126?_0xef29f3[_0xd8a1('0x1d')]:_0x12ca40[_0xd8a1('0x1a')]+_0x12ca40[_0xd8a1('0x1c')];var _0x1661d6;if(_0xd31363>=_0x1873bf){_0xd31363=_0x1873bf;_0x1661d6=0xc8;}else{_0x1661d6=0xce;}_0x1cb926[_0xd8a1('0x18')](_0x1661d6);return _0x1cb926[_0xd8a1('0x1e')](_0xd8a1('0x1f'),_0x3b9c61+'-'+_0xd31363+'/'+_0x1873bf)[_0xd8a1('0x20')](_0xef29f3);}return null;};}function patchUpdates(_0x577096){return function(_0x381d14){try{jsonpatch[_0xd8a1('0x21')](_0x381d14,_0x577096,!![]);}catch(_0xc780ff){return BPromise[_0xd8a1('0x22')](_0xc780ff);}return _0x381d14[_0xd8a1('0x23')]();};}function saveUpdates(_0x4ad553,_0x9e2629){return function(_0x47b04e){if(_0x47b04e){return _0x47b04e[_0xd8a1('0x24')](_0x4ad553)[_0xd8a1('0x25')](function(_0x45f1b2){return _0x45f1b2;});}return null;};}function removeEntity(_0x190cf0,_0x1b27de){return function(_0x3e21e1){if(_0x3e21e1){return _0x3e21e1[_0xd8a1('0x26')]()[_0xd8a1('0x25')](function(){_0x190cf0[_0xd8a1('0x18')](0xcc)[_0xd8a1('0x19')]();});}};}function handleEntityNotFound(_0x5e3961,_0x400712){return function(_0x208741){if(!_0x208741){_0x5e3961[_0xd8a1('0x17')](0x194);}return _0x208741;};}function handleError(_0x2f5b85,_0x57c33a){_0x57c33a=_0x57c33a||0x1f4;return function(_0x3be3d9){logger['error'](_0x3be3d9[_0xd8a1('0x27')]);if(_0x3be3d9[_0xd8a1('0x28')]){delete _0x3be3d9[_0xd8a1('0x28')];}_0x2f5b85[_0xd8a1('0x18')](_0x57c33a)[_0xd8a1('0x29')](_0x3be3d9);};}exports[_0xd8a1('0x2a')]=function(_0x3a5a4f,_0xf90206){var _0x5090b6={},_0x4763d8={},_0x22cce0={'count':0x0,'rows':[]};var _0x289e98=_['map'](db['FaxTransferReport'][_0xd8a1('0x2b')],function(_0x2ebac6){return{'name':_0x2ebac6[_0xd8a1('0x2c')],'type':_0x2ebac6[_0xd8a1('0x2d')][_0xd8a1('0x2e')]};});_0x4763d8[_0xd8a1('0x2f')]=_[_0xd8a1('0x30')](_0x289e98,_0xd8a1('0x28'));_0x4763d8[_0xd8a1('0x31')]=_[_0xd8a1('0x32')](_0x3a5a4f['query']);_0x4763d8[_0xd8a1('0x33')]=_[_0xd8a1('0x34')](_0x4763d8['model'],_0x4763d8['query']);_0x5090b6[_0xd8a1('0x35')]=_[_0xd8a1('0x34')](_0x4763d8[_0xd8a1('0x2f')],qs['fields'](_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x36')]));_0x5090b6[_0xd8a1('0x35')]=_0x5090b6['attributes'][_0xd8a1('0x37')]?_0x5090b6[_0xd8a1('0x35')]:_0x4763d8[_0xd8a1('0x2f')];if(!_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x38')](_0xd8a1('0x39'))){_0x5090b6[_0xd8a1('0x1c')]=qs[_0xd8a1('0x1c')](_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x1c')]);_0x5090b6[_0xd8a1('0x1a')]=qs[_0xd8a1('0x1a')](_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x1a')]);}_0x5090b6[_0xd8a1('0x3a')]=qs[_0xd8a1('0x3b')](_0x3a5a4f[_0xd8a1('0x31')]['sort']);_0x5090b6[_0xd8a1('0x3c')]=qs[_0xd8a1('0x33')](_[_0xd8a1('0x3d')](_0x3a5a4f[_0xd8a1('0x31')],_0x4763d8[_0xd8a1('0x33')]),_0x289e98);if(_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x3e')]){_0x5090b6[_0xd8a1('0x3c')]=_['merge'](_0x5090b6[_0xd8a1('0x3c')],{'$or':_[_0xd8a1('0x30')](_0x289e98,function(_0x29183d){if(_0x29183d[_0xd8a1('0x2d')]!=='VIRTUAL'){var _0x46636a={};_0x46636a[_0x29183d[_0xd8a1('0x28')]]={'$like':'%'+_0x3a5a4f[_0xd8a1('0x31')][_0xd8a1('0x3e')]+'%'};return _0x46636a;}})});}_0x5090b6=_[_0xd8a1('0x3f')]({},_0x5090b6,_0x3a5a4f['options']);var _0x1a3c0e={'where':_0x5090b6[_0xd8a1('0x3c')]};return db['FaxTransferReport']['count'](_0x1a3c0e)['then'](function(_0x387a37){_0x22cce0['count']=_0x387a37;if(_0x3a5a4f['query'][_0xd8a1('0x40')]){_0x5090b6[_0xd8a1('0x41')]=[{'all':!![]}];}return db[_0xd8a1('0x42')][_0xd8a1('0x43')](_0x5090b6);})[_0xd8a1('0x25')](function(_0x2360fb){_0x22cce0[_0xd8a1('0x44')]=_0x2360fb;return _0x22cce0;})['then'](respondWithFilteredResult(_0xf90206,_0x5090b6))['catch'](handleError(_0xf90206,null));};exports[_0xd8a1('0x45')]=function(_0x1d29fb,_0x4a8ab4){var _0x59ee5b={'raw':!![],'where':{'id':_0x1d29fb[_0xd8a1('0x46')]['id']}},_0x239a5c={};_0x239a5c[_0xd8a1('0x2f')]=_['keys'](db[_0xd8a1('0x42')][_0xd8a1('0x2b')]);_0x239a5c[_0xd8a1('0x31')]=_[_0xd8a1('0x32')](_0x1d29fb['query']);_0x239a5c['filters']=_[_0xd8a1('0x34')](_0x239a5c['model'],_0x239a5c[_0xd8a1('0x31')]);_0x59ee5b[_0xd8a1('0x35')]=_[_0xd8a1('0x34')](_0x239a5c[_0xd8a1('0x2f')],qs[_0xd8a1('0x36')](_0x1d29fb[_0xd8a1('0x31')][_0xd8a1('0x36')]));_0x59ee5b[_0xd8a1('0x35')]=_0x59ee5b[_0xd8a1('0x35')][_0xd8a1('0x37')]?_0x59ee5b['attributes']:_0x239a5c[_0xd8a1('0x2f')];if(_0x1d29fb[_0xd8a1('0x31')][_0xd8a1('0x40')]){_0x59ee5b[_0xd8a1('0x41')]=[{'all':!![]}];}_0x59ee5b=_[_0xd8a1('0x3f')]({},_0x59ee5b,_0x1d29fb['options']);return db['FaxTransferReport'][_0xd8a1('0x47')](_0x59ee5b)[_0xd8a1('0x25')](handleEntityNotFound(_0x4a8ab4,null))['then'](respondWithResult(_0x4a8ab4,null))[_0xd8a1('0x48')](handleError(_0x4a8ab4,null));};exports['create']=function(_0x269ba3,_0x5260ba){return db[_0xd8a1('0x42')][_0xd8a1('0x49')](_0x269ba3[_0xd8a1('0x4a')],{})[_0xd8a1('0x25')](respondWithResult(_0x5260ba,0xc9))[_0xd8a1('0x48')](handleError(_0x5260ba,null));};exports['update']=function(_0x478d5d,_0x495fff){if(_0x478d5d[_0xd8a1('0x4a')]['id']){delete _0x478d5d[_0xd8a1('0x4a')]['id'];}return db[_0xd8a1('0x42')][_0xd8a1('0x47')]({'where':{'id':_0x478d5d[_0xd8a1('0x46')]['id']}})[_0xd8a1('0x25')](handleEntityNotFound(_0x495fff,null))[_0xd8a1('0x25')](saveUpdates(_0x478d5d[_0xd8a1('0x4a')],null))[_0xd8a1('0x25')](respondWithResult(_0x495fff,null))[_0xd8a1('0x48')](handleError(_0x495fff,null));};exports['destroy']=function(_0x1c2fd,_0x1d09f6){return db['FaxTransferReport'][_0xd8a1('0x47')]({'where':{'id':_0x1c2fd[_0xd8a1('0x46')]['id']}})[_0xd8a1('0x25')](handleEntityNotFound(_0x1d09f6,null))[_0xd8a1('0x25')](removeEntity(_0x1d09f6,null))['catch'](handleError(_0x1d09f6,null));};exports[_0xd8a1('0x4b')]=function(_0x5070ea,_0x50f919){return db[_0xd8a1('0x42')][_0xd8a1('0x4b')]()[_0xd8a1('0x25')](respondWithResult(_0x50f919,null))[_0xd8a1('0x48')](handleError(_0x50f919,null));}; \ No newline at end of file +var _0xa058=['then','error','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','update','body','destroy','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x31ef5e,_0x2ab617){var _0x400b2b=function(_0x253638){while(--_0x253638){_0x31ef5e['push'](_0x31ef5e['shift']());}};_0x400b2b(++_0x2ab617);}(_0xa058,0xc8));var _0x8a05=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xa058[_0x2a67fe];return _0x57e726;};'use strict';var emlformat=require(_0x8a05('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a05('0x1'));var jsonpatch=require(_0x8a05('0x2'));var rp=require(_0x8a05('0x3'));var moment=require('moment');var BPromise=require(_0x8a05('0x4'));var Mustache=require('mustache');var util=require(_0x8a05('0x5'));var path=require(_0x8a05('0x6'));var sox=require(_0x8a05('0x7'));var csv=require(_0x8a05('0x8'));var ejs=require(_0x8a05('0x9'));var fs=require('fs');var fs_extra=require(_0x8a05('0xa'));var _=require(_0x8a05('0xb'));var squel=require(_0x8a05('0xc'));var crypto=require(_0x8a05('0xd'));var jsforce=require(_0x8a05('0xe'));var deskjs=require(_0x8a05('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8a05('0x10'));var Papa=require(_0x8a05('0x11'));var Redis=require(_0x8a05('0x12'));var authService=require(_0x8a05('0x13'));var qs=require(_0x8a05('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a05('0x15'));var logger=require(_0x8a05('0x16'))('api');var utils=require(_0x8a05('0x17'));var config=require(_0x8a05('0x18'));var licenseUtil=require(_0x8a05('0x19'));var db=require(_0x8a05('0x1a'))['db'];function respondWithStatusCode(_0x22a17e,_0x5cfe1f){_0x5cfe1f=_0x5cfe1f||0xcc;return function(_0x1ca482){if(_0x1ca482){return _0x22a17e[_0x8a05('0x1b')](_0x5cfe1f);}return _0x22a17e[_0x8a05('0x1c')](_0x5cfe1f)[_0x8a05('0x1d')]();};}function respondWithResult(_0x582fe6,_0x42683b){_0x42683b=_0x42683b||0xc8;return function(_0x5165be){if(_0x5165be){return _0x582fe6['status'](_0x42683b)[_0x8a05('0x1e')](_0x5165be);}};}function respondWithFilteredResult(_0x8a3fc3,_0xfd6d65){return function(_0x53b856){if(_0x53b856){var _0xaf80b6=typeof _0xfd6d65[_0x8a05('0x1f')]===_0x8a05('0x20')&&typeof _0xfd6d65[_0x8a05('0x21')]==='undefined';var _0x49b1bd=_0x53b856[_0x8a05('0x22')];var _0x3fde99=_0xaf80b6?0x0:_0xfd6d65[_0x8a05('0x1f')];var _0x1ec3df=_0xaf80b6?_0x53b856[_0x8a05('0x22')]:_0xfd6d65['offset']+_0xfd6d65[_0x8a05('0x21')];var _0x4ff870;if(_0x1ec3df>=_0x49b1bd){_0x1ec3df=_0x49b1bd;_0x4ff870=0xc8;}else{_0x4ff870=0xce;}_0x8a3fc3['status'](_0x4ff870);return _0x8a3fc3[_0x8a05('0x23')](_0x8a05('0x24'),_0x3fde99+'-'+_0x1ec3df+'/'+_0x49b1bd)[_0x8a05('0x1e')](_0x53b856);}return null;};}function patchUpdates(_0xfac741){return function(_0x54f899){try{jsonpatch[_0x8a05('0x25')](_0x54f899,_0xfac741,!![]);}catch(_0x4a57af){return BPromise[_0x8a05('0x26')](_0x4a57af);}return _0x54f899[_0x8a05('0x27')]();};}function saveUpdates(_0x5bf459,_0x2ae846){return function(_0x3358a7){if(_0x3358a7){return _0x3358a7['update'](_0x5bf459)[_0x8a05('0x28')](function(_0x56ec1d){return _0x56ec1d;});}return null;};}function removeEntity(_0x42de41,_0x3e9872){return function(_0x25ecc6){if(_0x25ecc6){return _0x25ecc6['destroy']()['then'](function(){_0x42de41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20aa9c,_0x2e4e23){return function(_0x1a3d11){if(!_0x1a3d11){_0x20aa9c[_0x8a05('0x1b')](0x194);}return _0x1a3d11;};}function handleError(_0x3a08c6,_0xc6018a){_0xc6018a=_0xc6018a||0x1f4;return function(_0xe2fc28){logger[_0x8a05('0x29')](_0xe2fc28[_0x8a05('0x2a')]);if(_0xe2fc28[_0x8a05('0x2b')]){delete _0xe2fc28[_0x8a05('0x2b')];}_0x3a08c6[_0x8a05('0x1c')](_0xc6018a)[_0x8a05('0x2c')](_0xe2fc28);};}exports[_0x8a05('0x2d')]=function(_0x52a351,_0x5f40a6){var _0x1a7223={},_0x53186d={},_0x49a4e8={'count':0x0,'rows':[]};var _0x490de1=_['map'](db[_0x8a05('0x2e')][_0x8a05('0x2f')],function(_0x532ac6){return{'name':_0x532ac6['fieldName'],'type':_0x532ac6[_0x8a05('0x30')][_0x8a05('0x31')]};});_0x53186d[_0x8a05('0x32')]=_[_0x8a05('0x33')](_0x490de1,'name');_0x53186d[_0x8a05('0x34')]=_[_0x8a05('0x35')](_0x52a351[_0x8a05('0x34')]);_0x53186d[_0x8a05('0x36')]=_[_0x8a05('0x37')](_0x53186d[_0x8a05('0x32')],_0x53186d['query']);_0x1a7223['attributes']=_[_0x8a05('0x37')](_0x53186d[_0x8a05('0x32')],qs[_0x8a05('0x38')](_0x52a351[_0x8a05('0x34')][_0x8a05('0x38')]));_0x1a7223[_0x8a05('0x39')]=_0x1a7223[_0x8a05('0x39')][_0x8a05('0x3a')]?_0x1a7223[_0x8a05('0x39')]:_0x53186d[_0x8a05('0x32')];if(!_0x52a351[_0x8a05('0x34')]['hasOwnProperty'](_0x8a05('0x3b'))){_0x1a7223[_0x8a05('0x21')]=qs[_0x8a05('0x21')](_0x52a351['query'][_0x8a05('0x21')]);_0x1a7223[_0x8a05('0x1f')]=qs[_0x8a05('0x1f')](_0x52a351[_0x8a05('0x34')]['offset']);}_0x1a7223[_0x8a05('0x3c')]=qs[_0x8a05('0x3d')](_0x52a351[_0x8a05('0x34')][_0x8a05('0x3d')]);_0x1a7223[_0x8a05('0x3e')]=qs[_0x8a05('0x36')](_[_0x8a05('0x3f')](_0x52a351[_0x8a05('0x34')],_0x53186d[_0x8a05('0x36')]),_0x490de1);if(_0x52a351['query'][_0x8a05('0x40')]){_0x1a7223['where']=_[_0x8a05('0x41')](_0x1a7223[_0x8a05('0x3e')],{'$or':_[_0x8a05('0x33')](_0x490de1,function(_0x713248){if(_0x713248['type']!==_0x8a05('0x42')){var _0x2ac37f={};_0x2ac37f[_0x713248[_0x8a05('0x2b')]]={'$like':'%'+_0x52a351[_0x8a05('0x34')][_0x8a05('0x40')]+'%'};return _0x2ac37f;}})});}_0x1a7223=_[_0x8a05('0x41')]({},_0x1a7223,_0x52a351[_0x8a05('0x43')]);var _0x557fe5={'where':_0x1a7223['where']};return db['FaxTransferReport']['count'](_0x557fe5)[_0x8a05('0x28')](function(_0x2bd54b){_0x49a4e8[_0x8a05('0x22')]=_0x2bd54b;if(_0x52a351['query'][_0x8a05('0x44')]){_0x1a7223['include']=[{'all':!![]}];}return db[_0x8a05('0x2e')][_0x8a05('0x45')](_0x1a7223);})[_0x8a05('0x28')](function(_0x99965a){_0x49a4e8[_0x8a05('0x46')]=_0x99965a;return _0x49a4e8;})[_0x8a05('0x28')](respondWithFilteredResult(_0x5f40a6,_0x1a7223))['catch'](handleError(_0x5f40a6,null));};exports[_0x8a05('0x47')]=function(_0x403c29,_0x21e28b){var _0x3cb136={'raw':!![],'where':{'id':_0x403c29['params']['id']}},_0x499ead={};_0x499ead[_0x8a05('0x32')]=_[_0x8a05('0x35')](db[_0x8a05('0x2e')]['rawAttributes']);_0x499ead['query']=_[_0x8a05('0x35')](_0x403c29[_0x8a05('0x34')]);_0x499ead[_0x8a05('0x36')]=_[_0x8a05('0x37')](_0x499ead['model'],_0x499ead[_0x8a05('0x34')]);_0x3cb136['attributes']=_[_0x8a05('0x37')](_0x499ead[_0x8a05('0x32')],qs['fields'](_0x403c29[_0x8a05('0x34')]['fields']));_0x3cb136['attributes']=_0x3cb136[_0x8a05('0x39')][_0x8a05('0x3a')]?_0x3cb136[_0x8a05('0x39')]:_0x499ead[_0x8a05('0x32')];if(_0x403c29[_0x8a05('0x34')][_0x8a05('0x44')]){_0x3cb136[_0x8a05('0x48')]=[{'all':!![]}];}_0x3cb136=_[_0x8a05('0x41')]({},_0x3cb136,_0x403c29[_0x8a05('0x43')]);return db['FaxTransferReport']['find'](_0x3cb136)['then'](handleEntityNotFound(_0x21e28b,null))['then'](respondWithResult(_0x21e28b,null))[_0x8a05('0x49')](handleError(_0x21e28b,null));};exports[_0x8a05('0x4a')]=function(_0x25136d,_0x392654){return db[_0x8a05('0x2e')][_0x8a05('0x4a')](_0x25136d['body'],{})[_0x8a05('0x28')](respondWithResult(_0x392654,0xc9))['catch'](handleError(_0x392654,null));};exports[_0x8a05('0x4b')]=function(_0x46bd14,_0x40a1ae){if(_0x46bd14[_0x8a05('0x4c')]['id']){delete _0x46bd14['body']['id'];}return db[_0x8a05('0x2e')]['find']({'where':{'id':_0x46bd14['params']['id']}})[_0x8a05('0x28')](handleEntityNotFound(_0x40a1ae,null))['then'](saveUpdates(_0x46bd14[_0x8a05('0x4c')],null))[_0x8a05('0x28')](respondWithResult(_0x40a1ae,null))[_0x8a05('0x49')](handleError(_0x40a1ae,null));};exports[_0x8a05('0x4d')]=function(_0x32a764,_0x5d1fbb){return db['FaxTransferReport'][_0x8a05('0x4e')]({'where':{'id':_0x32a764['params']['id']}})[_0x8a05('0x28')](handleEntityNotFound(_0x5d1fbb,null))[_0x8a05('0x28')](removeEntity(_0x5d1fbb,null))[_0x8a05('0x49')](handleError(_0x5d1fbb,null));};exports['describe']=function(_0x3bce49,_0x4f8765){return db['FaxTransferReport'][_0x8a05('0x4f')]()[_0x8a05('0x28')](respondWithResult(_0x4f8765,null))[_0x8a05('0x49')](handleError(_0x4f8765,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1dbf621..3b07ec5 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 _0x50d5=['rimraf','../../config/environment','./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x295631,_0x472caf){var _0x56a8fd=function(_0x2fa396){while(--_0x2fa396){_0x295631['push'](_0x295631['shift']());}};_0x56a8fd(++_0x472caf);}(_0x50d5,0x166));var _0x550d=function(_0x2d1808,_0x7a355a){_0x2d1808=_0x2d1808-0x0;var _0x23a9d0=_0x50d5[_0x2d1808];return _0x23a9d0;};'use strict';var _=require(_0x550d('0x0'));var util=require('util');var logger=require(_0x550d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x550d('0x2'));var rp=require(_0x550d('0x3'));var fs=require('fs');var path=require(_0x550d('0x4'));var rimraf=require(_0x550d('0x5'));var config=require(_0x550d('0x6'));var attributes=require(_0x550d('0x7'));module['exports']=function(_0x3ff1e7,_0x2b31a9){return _0x3ff1e7[_0x550d('0x8')]('FaxTransferReport',attributes,{'tableName':_0x550d('0x9'),'paranoid':![],'indexes':[{'name':_0x550d('0xa'),'fields':[_0x550d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70a8=['../../config/logger','api','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0x39129d,_0xe775e6){var _0x336a5c=function(_0x347bbc){while(--_0x347bbc){_0x39129d['push'](_0x39129d['shift']());}};_0x336a5c(++_0xe775e6);}(_0x70a8,0x1f4));var _0x870a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x70a8[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x870a('0x0'))(_0x870a('0x1'));var moment=require('moment');var BPromise=require(_0x870a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x870a('0x3'));var rimraf=require('rimraf');var config=require(_0x870a('0x4'));var attributes=require(_0x870a('0x5'));module[_0x870a('0x6')]=function(_0x14ff49,_0x321a7b){return _0x14ff49[_0x870a('0x7')]('FaxTransferReport',attributes,{'tableName':_0x870a('0x8'),'paranoid':![],'indexes':[{'name':_0x870a('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e1bd6fe..436a09e 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 _0x27b4=['error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32be09,_0x508724){var _0x1db24d=function(_0x4fbd40){while(--_0x4fbd40){_0x32be09['push'](_0x32be09['shift']());}};_0x1db24d(++_0x508724);}(_0x27b4,0x192));var _0x427b=function(_0x2adc54,_0x1bf3bd){_0x2adc54=_0x2adc54-0x0;var _0x2fcf37=_0x27b4[_0x2adc54];return _0x2fcf37;};'use strict';var _=require(_0x427b('0x0'));var util=require(_0x427b('0x1'));var moment=require(_0x427b('0x2'));var BPromise=require(_0x427b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x427b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x427b('0x5'))(_0x427b('0x6'));var config=require('../../config/environment');var jayson=require(_0x427b('0x7'));var client=jayson[_0x427b('0x8')][_0x427b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x421346,_0x3fc0e0,_0x4be538){return new BPromise(function(_0x5bd2f4,_0xebf516){return client[_0x427b('0xa')](_0x421346,_0x4be538)[_0x427b('0xb')](function(_0xe43eae){logger[_0x427b('0xc')](_0x427b('0xd'),_0x3fc0e0,_0x427b('0xe'));logger[_0x427b('0xf')](_0x427b('0x10'),_0x3fc0e0,_0x427b('0xe'),JSON[_0x427b('0x11')](_0xe43eae));if(_0xe43eae[_0x427b('0x12')]){if(_0xe43eae[_0x427b('0x12')]['code']===0x1f4){logger[_0x427b('0x12')](_0x427b('0xd'),_0x3fc0e0,_0xe43eae[_0x427b('0x12')][_0x427b('0x13')]);return _0xebf516(_0xe43eae[_0x427b('0x12')][_0x427b('0x13')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3fc0e0,_0xe43eae[_0x427b('0x12')][_0x427b('0x13')]);return _0x5bd2f4(_0xe43eae[_0x427b('0x12')]['message']);}else{logger['info'](_0x427b('0xd'),_0x3fc0e0,_0x427b('0xe'));_0x5bd2f4(_0xe43eae[_0x427b('0x14')]['message']);}})['catch'](function(_0x3eb4a6){logger['error'](_0x427b('0xd'),_0x3fc0e0,_0x3eb4a6);_0xebf516(_0x3eb4a6);});});} \ No newline at end of file +var _0xca1e=['rpc','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xca1e,0x71));var _0xeca1=function(_0x279bf7,_0x16d215){_0x279bf7=_0x279bf7-0x0;var _0x1ade2b=_0xca1e[_0x279bf7];return _0x1ade2b;};'use strict';var _=require(_0xeca1('0x0'));var util=require(_0xeca1('0x1'));var moment=require(_0xeca1('0x2'));var BPromise=require(_0xeca1('0x3'));var rs=require(_0xeca1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeca1('0x5'));var logger=require(_0xeca1('0x6'))(_0xeca1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeca1('0x8')][_0xeca1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x78530d,_0xb02c3f,_0xe2ca90){return new BPromise(function(_0x1e9592,_0x23d74f){return client[_0xeca1('0xa')](_0x78530d,_0xe2ca90)['then'](function(_0x5ee051){logger[_0xeca1('0xb')](_0xeca1('0xc'),_0xb02c3f,_0xeca1('0xd'));logger[_0xeca1('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xb02c3f,_0xeca1('0xd'),JSON['stringify'](_0x5ee051));if(_0x5ee051[_0xeca1('0xf')]){if(_0x5ee051[_0xeca1('0xf')][_0xeca1('0x10')]===0x1f4){logger[_0xeca1('0xf')](_0xeca1('0xc'),_0xb02c3f,_0x5ee051[_0xeca1('0xf')]['message']);return _0x23d74f(_0x5ee051['error'][_0xeca1('0x11')]);}logger[_0xeca1('0xf')](_0xeca1('0xc'),_0xb02c3f,_0x5ee051[_0xeca1('0xf')]['message']);return _0x1e9592(_0x5ee051['error'][_0xeca1('0x11')]);}else{logger[_0xeca1('0xb')](_0xeca1('0xc'),_0xb02c3f,_0xeca1('0xd'));_0x1e9592(_0x5ee051[_0xeca1('0x12')][_0xeca1('0x11')]);}})[_0xeca1('0x13')](function(_0x373488){logger[_0xeca1('0xf')](_0xeca1('0xc'),_0xb02c3f,_0x373488);_0x23d74f(_0x373488);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8a403df..4c99fb4 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 _0x99c1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','post','create','/:id','update','delete','exports'];(function(_0x39bd75,_0x54062e){var _0x3032fd=function(_0x29a8e4){while(--_0x29a8e4){_0x39bd75['push'](_0x39bd75['shift']());}};_0x3032fd(++_0x54062e);}(_0x99c1,0xcc));var _0x199c=function(_0x56cf1a,_0x5a4c7a){_0x56cf1a=_0x56cf1a-0x0;var _0x463e4f=_0x99c1[_0x56cf1a];return _0x463e4f;};'use strict';var multer=require(_0x199c('0x0'));var util=require(_0x199c('0x1'));var path=require(_0x199c('0x2'));var timeout=require('connect-timeout');var express=require(_0x199c('0x3'));var router=express[_0x199c('0x4')]();var fs_extra=require(_0x199c('0x5'));var auth=require(_0x199c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x199c('0x7'));var controller=require('./faxTransferReport.controller');router[_0x199c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x199c('0x8')](_0x199c('0x9'),auth[_0x199c('0xa')](),controller['describe']);router[_0x199c('0x8')]('/:id',auth[_0x199c('0xa')](),controller['show']);router[_0x199c('0xb')]('/',auth[_0x199c('0xa')](),controller[_0x199c('0xc')]);router['put'](_0x199c('0xd'),auth[_0x199c('0xa')](),controller[_0x199c('0xe')]);router[_0x199c('0xf')]('/:id',auth[_0x199c('0xa')](),controller['destroy']);module[_0x199c('0x10')]=router; \ No newline at end of file +var _0x8309=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update'];(function(_0x4e1dc6,_0x37a668){var _0x42e5fd=function(_0x794c7d){while(--_0x794c7d){_0x4e1dc6['push'](_0x4e1dc6['shift']());}};_0x42e5fd(++_0x37a668);}(_0x8309,0x9d));var _0x9830=function(_0x2e16e6,_0x5b0fbf){_0x2e16e6=_0x2e16e6-0x0;var _0x2cc54c=_0x8309[_0x2e16e6];return _0x2cc54c;};'use strict';var multer=require(_0x9830('0x0'));var util=require(_0x9830('0x1'));var path=require(_0x9830('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9830('0x3')]();var fs_extra=require(_0x9830('0x4'));var auth=require(_0x9830('0x5'));var interaction=require(_0x9830('0x6'));var config=require(_0x9830('0x7'));var controller=require(_0x9830('0x8'));router[_0x9830('0x9')]('/',auth[_0x9830('0xa')](),controller[_0x9830('0xb')]);router[_0x9830('0x9')](_0x9830('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9830('0x9')](_0x9830('0xd'),auth['isAuthenticated'](),controller[_0x9830('0xe')]);router[_0x9830('0xf')]('/',auth[_0x9830('0xa')](),controller[_0x9830('0x10')]);router[_0x9830('0x11')]('/:id',auth[_0x9830('0xa')](),controller[_0x9830('0x12')]);router[_0x9830('0x13')](_0x9830('0xd'),auth[_0x9830('0xa')](),controller[_0x9830('0x14')]);module[_0x9830('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index cea9e12..7620ad5 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 _0x0730=['addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x0730,0x14a));var _0x0073=function(_0x307a03,_0x81fd4f){_0x307a03=_0x307a03-0x0;var _0xc776af=_0x0730[_0x307a03];return _0xc776af;};'use strict';var multer=require(_0x0073('0x0'));var util=require(_0x0073('0x1'));var path=require(_0x0073('0x2'));var timeout=require(_0x0073('0x3'));var express=require(_0x0073('0x4'));var router=express[_0x0073('0x5')]();var fs_extra=require(_0x0073('0x6'));var auth=require(_0x0073('0x7'));var interaction=require(_0x0073('0x8'));var config=require(_0x0073('0x9'));var controller=require(_0x0073('0xa'));router['get']('/',auth[_0x0073('0xb')](),controller[_0x0073('0xc')]);router[_0x0073('0xd')](_0x0073('0xe'),auth['isAuthenticated'](),controller[_0x0073('0xf')]);router['get'](_0x0073('0x10'),auth[_0x0073('0xb')](),controller[_0x0073('0x11')]);router['get'](_0x0073('0x12'),auth[_0x0073('0xb')](),controller['getFields']);router['post']('/',auth[_0x0073('0xb')](),controller['create']);router[_0x0073('0x13')](_0x0073('0x10'),auth['isAuthenticated'](),controller[_0x0073('0x14')]);router[_0x0073('0x15')](_0x0073('0xe'),auth[_0x0073('0xb')](),controller['update']);router[_0x0073('0x16')]('/:id',auth[_0x0073('0xb')](),controller[_0x0073('0x17')]);module[_0x0073('0x18')]=router; \ No newline at end of file +var _0x0b4f=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index'];(function(_0x590734,_0x150a37){var _0x1c967b=function(_0x49a198){while(--_0x49a198){_0x590734['push'](_0x590734['shift']());}};_0x1c967b(++_0x150a37);}(_0x0b4f,0x12b));var _0xf0b4=function(_0x10a630,_0x282702){_0x10a630=_0x10a630-0x0;var _0xd79d95=_0x0b4f[_0x10a630];return _0xd79d95;};'use strict';var multer=require(_0xf0b4('0x0'));var util=require(_0xf0b4('0x1'));var path=require(_0xf0b4('0x2'));var timeout=require(_0xf0b4('0x3'));var express=require(_0xf0b4('0x4'));var router=express[_0xf0b4('0x5')]();var fs_extra=require(_0xf0b4('0x6'));var auth=require(_0xf0b4('0x7'));var interaction=require(_0xf0b4('0x8'));var config=require('../../config/environment');var controller=require(_0xf0b4('0x9'));router[_0xf0b4('0xa')]('/',auth[_0xf0b4('0xb')](),controller[_0xf0b4('0xc')]);router[_0xf0b4('0xa')](_0xf0b4('0xd'),auth[_0xf0b4('0xb')](),controller[_0xf0b4('0xe')]);router[_0xf0b4('0xa')](_0xf0b4('0xf'),auth[_0xf0b4('0xb')](),controller[_0xf0b4('0x10')]);router[_0xf0b4('0xa')](_0xf0b4('0x11'),auth[_0xf0b4('0xb')](),controller[_0xf0b4('0x12')]);router['post']('/',auth[_0xf0b4('0xb')](),controller['create']);router[_0xf0b4('0x13')](_0xf0b4('0xf'),auth[_0xf0b4('0xb')](),controller[_0xf0b4('0x14')]);router['put'](_0xf0b4('0xd'),auth[_0xf0b4('0xb')](),controller[_0xf0b4('0x15')]);router[_0xf0b4('0x16')](_0xf0b4('0xd'),auth[_0xf0b4('0xb')](),controller['destroy']);module[_0xf0b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 27a3af7..1625275 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 _0x00ce=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x30385b,_0x411c67){var _0x2b5d3e=function(_0x428962){while(--_0x428962){_0x30385b['push'](_0x30385b['shift']());}};_0x2b5d3e(++_0x411c67);}(_0x00ce,0xa8));var _0xe00c=function(_0x30bf3f,_0x543941){_0x30bf3f=_0x30bf3f-0x0;var _0x712a7b=_0x00ce[_0x30bf3f];return _0x712a7b;};'use strict';var Sequelize=require(_0xe00c('0x0'));module[_0xe00c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe00c('0x2')]},'username':{'type':Sequelize[_0xe00c('0x2')]},'remoteUri':{'type':Sequelize[_0xe00c('0x2')]},'authType':{'type':Sequelize[_0xe00c('0x3')](_0xe00c('0x4')),'defaultValue':_0xe00c('0x4')},'password':{'type':Sequelize[_0xe00c('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe00c('0x2')]},'token':{'type':Sequelize[_0xe00c('0x2')]},'tokenSecret':{'type':Sequelize[_0xe00c('0x2')]},'serverUrl':{'type':Sequelize[_0xe00c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe00c('0x3')]('integrationTab',_0xe00c('0x5')),'defaultValue':_0xe00c('0x6')}}; \ No newline at end of file +var _0xddf7=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x2e4e83,_0xe46755){var _0x557d7a=function(_0x3694c8){while(--_0x3694c8){_0x2e4e83['push'](_0x2e4e83['shift']());}};_0x557d7a(++_0xe46755);}(_0xddf7,0xcd));var _0x7ddf=function(_0x36cb47,_0xb4dbe){_0x36cb47=_0x36cb47-0x0;var _0x3ea2b7=_0xddf7[_0x36cb47];return _0x3ea2b7;};'use strict';var Sequelize=require(_0x7ddf('0x0'));module[_0x7ddf('0x1')]={'name':{'type':Sequelize[_0x7ddf('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7ddf('0x2')]},'remoteUri':{'type':Sequelize[_0x7ddf('0x2')]},'authType':{'type':Sequelize[_0x7ddf('0x3')]('basic'),'defaultValue':_0x7ddf('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7ddf('0x2')]},'consumerSecret':{'type':Sequelize[_0x7ddf('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7ddf('0x2')]},'serverUrl':{'type':Sequelize[_0x7ddf('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7ddf('0x5'),_0x7ddf('0x6')),'defaultValue':_0x7ddf('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b4e3608..1d4fe0a 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 _0xcf7d=['password','consumerKey','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','username','toString','base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','create','body','update','find','params','getConfigurations','findOne','order','sort','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','priority','remoteUri','authType'];(function(_0x41bbd7,_0x23ee2a){var _0x203b28=function(_0x328464){while(--_0x328464){_0x41bbd7['push'](_0x41bbd7['shift']());}};_0x203b28(++_0x23ee2a);}(_0xcf7d,0x16d));var _0xdcf7=function(_0x4c2a78,_0x36fb4c){_0x4c2a78=_0x4c2a78-0x0;var _0x54a178=_0xcf7d[_0x4c2a78];return _0x54a178;};'use strict';var emlformat=require(_0xdcf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf7('0x1'));var jsonpatch=require(_0xdcf7('0x2'));var rp=require(_0xdcf7('0x3'));var moment=require(_0xdcf7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdcf7('0x6'));var ejs=require(_0xdcf7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf7('0x8'));var squel=require('squel');var crypto=require(_0xdcf7('0x9'));var jsforce=require(_0xdcf7('0xa'));var deskjs=require(_0xdcf7('0xb'));var toCsv=require(_0xdcf7('0x6'));var querystring=require(_0xdcf7('0xc'));var Papa=require('papaparse');var Redis=require(_0xdcf7('0xd'));var authService=require(_0xdcf7('0xe'));var qs=require(_0xdcf7('0xf'));var as=require(_0xdcf7('0x10'));var hardwareService=require(_0xdcf7('0x11'));var logger=require(_0xdcf7('0x12'))(_0xdcf7('0x13'));var utils=require(_0xdcf7('0x14'));var config=require(_0xdcf7('0x15'));var licenseUtil=require(_0xdcf7('0x16'));var db=require(_0xdcf7('0x17'))['db'];var integrations=require(_0xdcf7('0x18'));function respondWithStatusCode(_0x33fcdc,_0x334369){_0x334369=_0x334369||0xcc;return function(_0x2e0157){if(_0x2e0157){return _0x33fcdc[_0xdcf7('0x19')](_0x334369);}return _0x33fcdc['status'](_0x334369)['end']();};}function respondWithResult(_0x1d6f99,_0x3fccf8){_0x3fccf8=_0x3fccf8||0xc8;return function(_0x5ef11c){if(_0x5ef11c){return _0x1d6f99[_0xdcf7('0x1a')](_0x3fccf8)[_0xdcf7('0x1b')](_0x5ef11c);}};}function respondWithFilteredResult(_0x1818fe,_0x48c480){return function(_0xd79981){if(_0xd79981){var _0x127230=typeof _0x48c480['offset']===_0xdcf7('0x1c')&&typeof _0x48c480[_0xdcf7('0x1d')]===_0xdcf7('0x1c');var _0x1dc731=_0xd79981[_0xdcf7('0x1e')];var _0x512592=_0x127230?0x0:_0x48c480[_0xdcf7('0x1f')];var _0x1737b7=_0x127230?_0xd79981[_0xdcf7('0x1e')]:_0x48c480[_0xdcf7('0x1f')]+_0x48c480[_0xdcf7('0x1d')];var _0x2f3c7a;if(_0x1737b7>=_0x1dc731){_0x1737b7=_0x1dc731;_0x2f3c7a=0xc8;}else{_0x2f3c7a=0xce;}_0x1818fe[_0xdcf7('0x1a')](_0x2f3c7a);return _0x1818fe[_0xdcf7('0x20')](_0xdcf7('0x21'),_0x512592+'-'+_0x1737b7+'/'+_0x1dc731)[_0xdcf7('0x1b')](_0xd79981);}return null;};}function patchUpdates(_0x5c9977){return function(_0x5180f0){try{jsonpatch[_0xdcf7('0x22')](_0x5180f0,_0x5c9977,!![]);}catch(_0x3ef184){return BPromise['reject'](_0x3ef184);}return _0x5180f0[_0xdcf7('0x23')]();};}function saveUpdates(_0x580c09,_0x4b432a){return function(_0x39aaa7){if(_0x39aaa7){return _0x39aaa7['update'](_0x580c09)[_0xdcf7('0x24')](function(_0xdb4610){return _0xdb4610;});}return null;};}function removeEntity(_0x4fb826,_0x1c5578){return function(_0x242454){if(_0x242454){return _0x242454[_0xdcf7('0x25')]()['then'](function(){_0x4fb826['status'](0xcc)[_0xdcf7('0x26')]();});}};}function handleEntityNotFound(_0x3a7bff,_0x2f7b86){return function(_0x494a71){if(!_0x494a71){_0x3a7bff[_0xdcf7('0x19')](0x194);}return _0x494a71;};}function handleError(_0x3b1b0d,_0x291408){_0x291408=_0x291408||0x1f4;return function(_0x3b3169){logger[_0xdcf7('0x27')](_0x3b3169[_0xdcf7('0x28')]);if(_0x3b3169[_0xdcf7('0x29')]){delete _0x3b3169['name'];}_0x3b1b0d['status'](_0x291408)[_0xdcf7('0x2a')](_0x3b3169);};}exports['index']=function(_0x366710,_0x4aff25){var _0x56ca0e={},_0xaefd44={},_0x253a74={'count':0x0,'rows':[]};var _0x17df86=_['map'](db[_0xdcf7('0x2b')][_0xdcf7('0x2c')],function(_0x488e0e){return{'name':_0x488e0e[_0xdcf7('0x2d')],'type':_0x488e0e[_0xdcf7('0x2e')]['key']};});_0xaefd44[_0xdcf7('0x2f')]=_[_0xdcf7('0x30')](_0x17df86,_0xdcf7('0x29'));_0xaefd44[_0xdcf7('0x31')]=_[_0xdcf7('0x32')](_0x366710['query']);_0xaefd44[_0xdcf7('0x33')]=_['intersection'](_0xaefd44['model'],_0xaefd44[_0xdcf7('0x31')]);_0x56ca0e[_0xdcf7('0x34')]=_[_0xdcf7('0x35')](_0xaefd44['model'],qs['fields'](_0x366710[_0xdcf7('0x31')][_0xdcf7('0x36')]));_0x56ca0e[_0xdcf7('0x34')]=_0x56ca0e[_0xdcf7('0x34')][_0xdcf7('0x37')]?_0x56ca0e[_0xdcf7('0x34')]:_0xaefd44[_0xdcf7('0x2f')];if(!_0x366710[_0xdcf7('0x31')][_0xdcf7('0x38')]('nolimit')){_0x56ca0e['limit']=qs[_0xdcf7('0x1d')](_0x366710[_0xdcf7('0x31')][_0xdcf7('0x1d')]);_0x56ca0e[_0xdcf7('0x1f')]=qs['offset'](_0x366710['query'][_0xdcf7('0x1f')]);}_0x56ca0e['order']=qs['sort'](_0x366710['query']['sort']);_0x56ca0e[_0xdcf7('0x39')]=qs[_0xdcf7('0x33')](_[_0xdcf7('0x3a')](_0x366710['query'],_0xaefd44[_0xdcf7('0x33')]),_0x17df86);if(_0x366710[_0xdcf7('0x31')][_0xdcf7('0x3b')]){_0x56ca0e[_0xdcf7('0x39')]=_[_0xdcf7('0x3c')](_0x56ca0e[_0xdcf7('0x39')],{'$or':_[_0xdcf7('0x30')](_0x17df86,function(_0x9db7a6){if(_0x9db7a6[_0xdcf7('0x2e')]!==_0xdcf7('0x3d')){var _0xee62a3={};_0xee62a3[_0x9db7a6['name']]={'$like':'%'+_0x366710[_0xdcf7('0x31')]['filter']+'%'};return _0xee62a3;}})});}_0x56ca0e=_[_0xdcf7('0x3c')]({},_0x56ca0e,_0x366710[_0xdcf7('0x3e')]);var _0x302358={'where':_0x56ca0e[_0xdcf7('0x39')]};return db[_0xdcf7('0x2b')]['count'](_0x302358)[_0xdcf7('0x24')](function(_0x2f90a6){_0x253a74[_0xdcf7('0x1e')]=_0x2f90a6;if(_0x366710[_0xdcf7('0x31')][_0xdcf7('0x3f')]){_0x56ca0e[_0xdcf7('0x40')]=[{'all':!![]}];}return db[_0xdcf7('0x2b')]['findAll'](_0x56ca0e);})[_0xdcf7('0x24')](function(_0x12fe14){_0x253a74['rows']=_0x12fe14;return _0x253a74;})[_0xdcf7('0x24')](respondWithFilteredResult(_0x4aff25,_0x56ca0e))[_0xdcf7('0x41')](handleError(_0x4aff25,null));};exports[_0xdcf7('0x42')]=function(_0x3ee053,_0x5a8e88){var _0xf8c3d9={'raw':![],'where':{'id':_0x3ee053['params']['id']}},_0x528f72={};_0x528f72[_0xdcf7('0x2f')]=_['keys'](db['DeskAccount'][_0xdcf7('0x2c')]);_0x528f72[_0xdcf7('0x31')]=_['keys'](_0x3ee053[_0xdcf7('0x31')]);_0x528f72[_0xdcf7('0x33')]=_[_0xdcf7('0x35')](_0x528f72['model'],_0x528f72[_0xdcf7('0x31')]);_0xf8c3d9['attributes']=_[_0xdcf7('0x35')](_0x528f72[_0xdcf7('0x2f')],qs[_0xdcf7('0x36')](_0x3ee053[_0xdcf7('0x31')][_0xdcf7('0x36')]));_0xf8c3d9[_0xdcf7('0x34')]=_0xf8c3d9[_0xdcf7('0x34')]['length']?_0xf8c3d9[_0xdcf7('0x34')]:_0x528f72['model'];if(_0x3ee053['query'][_0xdcf7('0x3f')]){_0xf8c3d9[_0xdcf7('0x40')]=[{'all':!![]}];}_0xf8c3d9=_[_0xdcf7('0x3c')]({},_0xf8c3d9,_0x3ee053[_0xdcf7('0x3e')]);return db[_0xdcf7('0x2b')]['find'](_0xf8c3d9)[_0xdcf7('0x24')](handleEntityNotFound(_0x5a8e88,null))['then'](respondWithResult(_0x5a8e88,null))[_0xdcf7('0x41')](handleError(_0x5a8e88,null));};exports[_0xdcf7('0x43')]=function(_0x5d1e89,_0x509131){return db[_0xdcf7('0x2b')][_0xdcf7('0x43')](_0x5d1e89[_0xdcf7('0x44')],{})[_0xdcf7('0x24')](respondWithResult(_0x509131,0xc9))['catch'](handleError(_0x509131,null));};exports[_0xdcf7('0x45')]=function(_0x20961e,_0x40189e){if(_0x20961e['body']['id']){delete _0x20961e[_0xdcf7('0x44')]['id'];}return db['DeskAccount'][_0xdcf7('0x46')]({'where':{'id':_0x20961e['params']['id']}})[_0xdcf7('0x24')](handleEntityNotFound(_0x40189e,null))['then'](saveUpdates(_0x20961e[_0xdcf7('0x44')],null))['then'](respondWithResult(_0x40189e,null))[_0xdcf7('0x41')](handleError(_0x40189e,null));};exports[_0xdcf7('0x25')]=function(_0x5ca482,_0x30fac1){return db[_0xdcf7('0x2b')][_0xdcf7('0x46')]({'where':{'id':_0x5ca482[_0xdcf7('0x47')]['id']}})[_0xdcf7('0x24')](handleEntityNotFound(_0x30fac1,null))['then'](removeEntity(_0x30fac1,null))[_0xdcf7('0x41')](handleError(_0x30fac1,null));};exports[_0xdcf7('0x48')]=function(_0x145b65,_0xf2eb06,_0xbf253c){var _0x3f399f={};var _0x33a6e5={};var _0x1289f7;var _0x34c851;return db[_0xdcf7('0x2b')][_0xdcf7('0x49')]({'where':{'id':_0x145b65[_0xdcf7('0x47')]['id']}})['then'](handleEntityNotFound(_0xf2eb06,null))['then'](function(_0x52e172){if(_0x52e172){_0x1289f7=_0x52e172;_0x33a6e5['model']=_[_0xdcf7('0x32')](db['DeskConfiguration'][_0xdcf7('0x2c')]);_0x33a6e5[_0xdcf7('0x31')]=_[_0xdcf7('0x32')](_0x145b65['query']);_0x33a6e5[_0xdcf7('0x33')]=_[_0xdcf7('0x35')](_0x33a6e5['model'],_0x33a6e5[_0xdcf7('0x31')]);_0x3f399f[_0xdcf7('0x34')]=_['intersection'](_0x33a6e5['model'],qs[_0xdcf7('0x36')](_0x145b65[_0xdcf7('0x31')][_0xdcf7('0x36')]));_0x3f399f[_0xdcf7('0x34')]=_0x3f399f[_0xdcf7('0x34')][_0xdcf7('0x37')]?_0x3f399f[_0xdcf7('0x34')]:_0x33a6e5[_0xdcf7('0x2f')];_0x3f399f[_0xdcf7('0x4a')]=qs['sort'](_0x145b65[_0xdcf7('0x31')][_0xdcf7('0x4b')]);_0x3f399f[_0xdcf7('0x39')]=qs[_0xdcf7('0x33')](_[_0xdcf7('0x3a')](_0x145b65[_0xdcf7('0x31')],_0x33a6e5[_0xdcf7('0x33')]));if(_0x145b65['query']['filter']){_0x3f399f[_0xdcf7('0x39')]=_[_0xdcf7('0x3c')](_0x3f399f[_0xdcf7('0x39')],{'$or':_[_0xdcf7('0x30')](_0x3f399f[_0xdcf7('0x34')],function(_0x2dcf5e){var _0x708267={};_0x708267[_0x2dcf5e]={'$like':'%'+_0x145b65['query'][_0xdcf7('0x3b')]+'%'};return _0x708267;})});}_0x3f399f=_[_0xdcf7('0x3c')]({},_0x3f399f,_0x145b65[_0xdcf7('0x3e')]);return _0x1289f7[_0xdcf7('0x48')](_0x3f399f);}})[_0xdcf7('0x24')](function(_0xc0b881){if(_0xc0b881){_0x34c851=_0xc0b881[_0xdcf7('0x37')];if(!_0x145b65[_0xdcf7('0x31')][_0xdcf7('0x38')](_0xdcf7('0x4c'))){_0x3f399f['limit']=qs['limit'](_0x145b65[_0xdcf7('0x31')]['limit']);_0x3f399f[_0xdcf7('0x1f')]=qs[_0xdcf7('0x1f')](_0x145b65[_0xdcf7('0x31')]['offset']);}return _0x1289f7[_0xdcf7('0x48')](_0x3f399f);}})[_0xdcf7('0x24')](function(_0x177f6d){if(_0x177f6d){return _0x177f6d?{'count':_0x34c851,'rows':_0x177f6d}:null;}})[_0xdcf7('0x24')](respondWithResult(_0xf2eb06,null))['catch'](handleError(_0xf2eb06,null));};exports['addConfiguration']=function(_0x5ba758,_0x4058a0,_0xf7776a){if(_0x5ba758[_0xdcf7('0x44')]['id']){delete _0x5ba758[_0xdcf7('0x44')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5ba758[_0xdcf7('0x47')]['id']}})[_0xdcf7('0x24')](handleEntityNotFound(_0x4058a0,null))[_0xdcf7('0x24')](function(_0x132e91){if(_0x132e91){_0x5ba758['body'][_0xdcf7('0x4d')]=_0x132e91['id'];_0x5ba758['body'][_0xdcf7('0x4e')]=integrations[_0xdcf7('0x4f')](_0x5ba758[_0xdcf7('0x44')]['channel'],_0x5ba758['body'][_0xdcf7('0x2e')]);_0x5ba758[_0xdcf7('0x44')][_0xdcf7('0x50')]=integrations[_0xdcf7('0x51')](_0x5ba758[_0xdcf7('0x44')][_0xdcf7('0x52')],_0x5ba758[_0xdcf7('0x44')][_0xdcf7('0x2e')]);return db[_0xdcf7('0x53')][_0xdcf7('0x43')](_0x5ba758['body'],{'include':[{'model':db['DeskField'],'as':_0xdcf7('0x4e')},{'model':db['DeskField'],'as':_0xdcf7('0x50')}]});}return null;})['then'](respondWithResult(_0x4058a0,null))[_0xdcf7('0x41')](handleError(_0x4058a0,null));};exports['getFields']=function(_0xec07cb,_0x5c4dc9,_0x27b17a){var _0x4594b8=[{'name':_0xdcf7('0x54'),'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 _0x58eaed='';return db['DeskAccount'][_0xdcf7('0x49')]({'where':{'id':_0xec07cb[_0xdcf7('0x47')]['id']},'attributes':['id',_0xdcf7('0x55'),_0xdcf7('0x56'),'username',_0xdcf7('0x57'),_0xdcf7('0x58'),'consumerSecret','token',_0xdcf7('0x59')]})[_0xdcf7('0x24')](handleEntityNotFound(_0x5c4dc9,null))['then'](function(_0x40dc98){if(_0x40dc98){_0x58eaed=_0x40dc98[_0xdcf7('0x55')];var _0x3c816a=_0x58eaed[_0xdcf7('0x5a')](-0x1);if(_0x3c816a==='/'){_0x58eaed=_0x58eaed[_0xdcf7('0x5b')](0x0,_0x58eaed[_0xdcf7('0x5c')](_0x3c816a));}var _0x9c07a8={'method':_0xdcf7('0x5d'),'uri':util['format'](_0xdcf7('0x5e'),_0x58eaed),'headers':{'Content-Type':'application/json','Accept':_0xdcf7('0x5f')},'json':!![]};if(_0x40dc98[_0xdcf7('0x56')]===_0xdcf7('0x60')){_0x9c07a8['headers'][_0xdcf7('0x61')]=util[_0xdcf7('0x62')](_0xdcf7('0x63'),new Buffer(util[_0xdcf7('0x62')](_0xdcf7('0x64'),_0x40dc98[_0xdcf7('0x65')],_0x40dc98[_0xdcf7('0x57')]))[_0xdcf7('0x66')](_0xdcf7('0x67')));}return rp(_0x9c07a8)[_0xdcf7('0x24')](function(_0x1f1d39){return _0x4594b8[_0xdcf7('0x68')](_[_0xdcf7('0x30')](_0x1f1d39['_embedded'][_0xdcf7('0x69')],function(_0x40c099){return{'id':_0x40c099[_0xdcf7('0x29')],'name':_0x40c099['name'],'type':_0x40c099[_0xdcf7('0x2e')],'active':_0x40c099['active'],'label':_0x40c099[_0xdcf7('0x6a')],'custom':!![]};}));});}})[_0xdcf7('0x24')](function(_0x347326){return{'count':_0x347326[_0xdcf7('0x37')],'rows':_0x347326};})[_0xdcf7('0x24')](respondWithResult(_0x5c4dc9,null))['catch'](function(_0x3d1f4b){var _0x367ffc=_0xec07cb[_0xdcf7('0x31')][_0xdcf7('0x6b')]?0x1f4:_0x3d1f4b[_0xdcf7('0x6c')]||0x1f4;logger[_0xdcf7('0x27')](_0xdcf7('0x6d'),_0xdcf7('0x6e'),_0x367ffc,JSON[_0xdcf7('0x6f')](_0x3d1f4b));delete _0x3d1f4b['name'];if(_0x367ffc===0x191){_0x367ffc=0x190;}_0x5c4dc9[_0xdcf7('0x1a')](_0x367ffc)[_0xdcf7('0x2a')](_0xec07cb['query']['test']?{'message':_0xdcf7('0x70'),'statusCode':_0x3d1f4b[_0xdcf7('0x6c')]}:_0x3d1f4b);});}; \ No newline at end of file +var _0xa0e1=['stringify','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','then','destroy','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','order','pick','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','username','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','error'];(function(_0x443364,_0xe7eada){var _0x3da3b5=function(_0x5762b5){while(--_0x5762b5){_0x443364['push'](_0x443364['shift']());}};_0x3da3b5(++_0xe7eada);}(_0xa0e1,0xe5));var _0x1a0e=function(_0x1bbbfd,_0x1c935e){_0x1bbbfd=_0x1bbbfd-0x0;var _0x4b8a5f=_0xa0e1[_0x1bbbfd];return _0x4b8a5f;};'use strict';var emlformat=require(_0x1a0e('0x0'));var rimraf=require(_0x1a0e('0x1'));var zipdir=require(_0x1a0e('0x2'));var jsonpatch=require(_0x1a0e('0x3'));var rp=require(_0x1a0e('0x4'));var moment=require(_0x1a0e('0x5'));var BPromise=require(_0x1a0e('0x6'));var Mustache=require(_0x1a0e('0x7'));var util=require(_0x1a0e('0x8'));var path=require(_0x1a0e('0x9'));var sox=require(_0x1a0e('0xa'));var csv=require('to-csv');var ejs=require(_0x1a0e('0xb'));var fs=require('fs');var fs_extra=require(_0x1a0e('0xc'));var _=require(_0x1a0e('0xd'));var squel=require('squel');var crypto=require(_0x1a0e('0xe'));var jsforce=require(_0x1a0e('0xf'));var deskjs=require(_0x1a0e('0x10'));var toCsv=require(_0x1a0e('0x11'));var querystring=require(_0x1a0e('0x12'));var Papa=require(_0x1a0e('0x13'));var Redis=require(_0x1a0e('0x14'));var authService=require(_0x1a0e('0x15'));var qs=require(_0x1a0e('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a0e('0x17'))(_0x1a0e('0x18'));var utils=require(_0x1a0e('0x19'));var config=require(_0x1a0e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1a0e('0x1b'));function respondWithStatusCode(_0x516c00,_0x5c06ea){_0x5c06ea=_0x5c06ea||0xcc;return function(_0x25cf05){if(_0x25cf05){return _0x516c00[_0x1a0e('0x1c')](_0x5c06ea);}return _0x516c00[_0x1a0e('0x1d')](_0x5c06ea)[_0x1a0e('0x1e')]();};}function respondWithResult(_0x35d857,_0x4633f4){_0x4633f4=_0x4633f4||0xc8;return function(_0x5f1522){if(_0x5f1522){return _0x35d857[_0x1a0e('0x1d')](_0x4633f4)['json'](_0x5f1522);}};}function respondWithFilteredResult(_0x15bf39,_0xfb4e85){return function(_0x5de2f2){if(_0x5de2f2){var _0x3ee3f0=typeof _0xfb4e85['offset']===_0x1a0e('0x1f')&&typeof _0xfb4e85['limit']===_0x1a0e('0x1f');var _0x4b68e0=_0x5de2f2['count'];var _0x97c2f7=_0x3ee3f0?0x0:_0xfb4e85[_0x1a0e('0x20')];var _0x21922d=_0x3ee3f0?_0x5de2f2[_0x1a0e('0x21')]:_0xfb4e85[_0x1a0e('0x20')]+_0xfb4e85[_0x1a0e('0x22')];var _0x2bfffa;if(_0x21922d>=_0x4b68e0){_0x21922d=_0x4b68e0;_0x2bfffa=0xc8;}else{_0x2bfffa=0xce;}_0x15bf39[_0x1a0e('0x1d')](_0x2bfffa);return _0x15bf39[_0x1a0e('0x23')](_0x1a0e('0x24'),_0x97c2f7+'-'+_0x21922d+'/'+_0x4b68e0)[_0x1a0e('0x25')](_0x5de2f2);}return null;};}function patchUpdates(_0x58e21c){return function(_0x11cf86){try{jsonpatch[_0x1a0e('0x26')](_0x11cf86,_0x58e21c,!![]);}catch(_0x5ae16c){return BPromise[_0x1a0e('0x27')](_0x5ae16c);}return _0x11cf86['save']();};}function saveUpdates(_0x2376f6,_0x2c7a13){return function(_0x158576){if(_0x158576){return _0x158576['update'](_0x2376f6)[_0x1a0e('0x28')](function(_0x464425){return _0x464425;});}return null;};}function removeEntity(_0x2625cb,_0x4a520b){return function(_0x218a5b){if(_0x218a5b){return _0x218a5b[_0x1a0e('0x29')]()['then'](function(){_0x2625cb[_0x1a0e('0x1d')](0xcc)[_0x1a0e('0x1e')]();});}};}function handleEntityNotFound(_0x398467,_0x335a3e){return function(_0x4d6a8e){if(!_0x4d6a8e){_0x398467[_0x1a0e('0x1c')](0x194);}return _0x4d6a8e;};}function handleError(_0x21b623,_0xdf3bb7){_0xdf3bb7=_0xdf3bb7||0x1f4;return function(_0x1e6643){logger['error'](_0x1e6643[_0x1a0e('0x2a')]);if(_0x1e6643[_0x1a0e('0x2b')]){delete _0x1e6643[_0x1a0e('0x2b')];}_0x21b623[_0x1a0e('0x1d')](_0xdf3bb7)['send'](_0x1e6643);};}exports[_0x1a0e('0x2c')]=function(_0x41c378,_0x29e12a){var _0x35b440={},_0x1e7f16={},_0xd31da6={'count':0x0,'rows':[]};var _0x219735=_[_0x1a0e('0x2d')](db[_0x1a0e('0x2e')][_0x1a0e('0x2f')],function(_0x6eb673){return{'name':_0x6eb673[_0x1a0e('0x30')],'type':_0x6eb673[_0x1a0e('0x31')][_0x1a0e('0x32')]};});_0x1e7f16['model']=_[_0x1a0e('0x2d')](_0x219735,_0x1a0e('0x2b'));_0x1e7f16[_0x1a0e('0x33')]=_[_0x1a0e('0x34')](_0x41c378['query']);_0x1e7f16[_0x1a0e('0x35')]=_[_0x1a0e('0x36')](_0x1e7f16[_0x1a0e('0x37')],_0x1e7f16['query']);_0x35b440[_0x1a0e('0x38')]=_[_0x1a0e('0x36')](_0x1e7f16['model'],qs[_0x1a0e('0x39')](_0x41c378['query'][_0x1a0e('0x39')]));_0x35b440['attributes']=_0x35b440[_0x1a0e('0x38')][_0x1a0e('0x3a')]?_0x35b440[_0x1a0e('0x38')]:_0x1e7f16['model'];if(!_0x41c378[_0x1a0e('0x33')][_0x1a0e('0x3b')](_0x1a0e('0x3c'))){_0x35b440['limit']=qs[_0x1a0e('0x22')](_0x41c378[_0x1a0e('0x33')][_0x1a0e('0x22')]);_0x35b440['offset']=qs['offset'](_0x41c378[_0x1a0e('0x33')][_0x1a0e('0x20')]);}_0x35b440['order']=qs[_0x1a0e('0x3d')](_0x41c378[_0x1a0e('0x33')][_0x1a0e('0x3d')]);_0x35b440[_0x1a0e('0x3e')]=qs[_0x1a0e('0x35')](_['pick'](_0x41c378[_0x1a0e('0x33')],_0x1e7f16[_0x1a0e('0x35')]),_0x219735);if(_0x41c378[_0x1a0e('0x33')]['filter']){_0x35b440[_0x1a0e('0x3e')]=_[_0x1a0e('0x3f')](_0x35b440[_0x1a0e('0x3e')],{'$or':_['map'](_0x219735,function(_0x29c025){if(_0x29c025[_0x1a0e('0x31')]!==_0x1a0e('0x40')){var _0x41e6fa={};_0x41e6fa[_0x29c025['name']]={'$like':'%'+_0x41c378[_0x1a0e('0x33')][_0x1a0e('0x41')]+'%'};return _0x41e6fa;}})});}_0x35b440=_[_0x1a0e('0x3f')]({},_0x35b440,_0x41c378[_0x1a0e('0x42')]);var _0x1e6949={'where':_0x35b440['where']};return db[_0x1a0e('0x2e')][_0x1a0e('0x21')](_0x1e6949)[_0x1a0e('0x28')](function(_0x470d8b){_0xd31da6['count']=_0x470d8b;if(_0x41c378[_0x1a0e('0x33')]['includeAll']){_0x35b440[_0x1a0e('0x43')]=[{'all':!![]}];}return db[_0x1a0e('0x2e')][_0x1a0e('0x44')](_0x35b440);})['then'](function(_0x240eb2){_0xd31da6[_0x1a0e('0x45')]=_0x240eb2;return _0xd31da6;})[_0x1a0e('0x28')](respondWithFilteredResult(_0x29e12a,_0x35b440))['catch'](handleError(_0x29e12a,null));};exports[_0x1a0e('0x46')]=function(_0x38845e,_0xccc796){var _0x3c9cf2={'raw':![],'where':{'id':_0x38845e[_0x1a0e('0x47')]['id']}},_0x6df3c6={};_0x6df3c6['model']=_[_0x1a0e('0x34')](db[_0x1a0e('0x2e')]['rawAttributes']);_0x6df3c6[_0x1a0e('0x33')]=_[_0x1a0e('0x34')](_0x38845e[_0x1a0e('0x33')]);_0x6df3c6['filters']=_[_0x1a0e('0x36')](_0x6df3c6[_0x1a0e('0x37')],_0x6df3c6[_0x1a0e('0x33')]);_0x3c9cf2[_0x1a0e('0x38')]=_[_0x1a0e('0x36')](_0x6df3c6[_0x1a0e('0x37')],qs[_0x1a0e('0x39')](_0x38845e[_0x1a0e('0x33')]['fields']));_0x3c9cf2['attributes']=_0x3c9cf2[_0x1a0e('0x38')][_0x1a0e('0x3a')]?_0x3c9cf2[_0x1a0e('0x38')]:_0x6df3c6['model'];if(_0x38845e[_0x1a0e('0x33')][_0x1a0e('0x48')]){_0x3c9cf2['include']=[{'all':!![]}];}_0x3c9cf2=_[_0x1a0e('0x3f')]({},_0x3c9cf2,_0x38845e[_0x1a0e('0x42')]);return db['DeskAccount'][_0x1a0e('0x49')](_0x3c9cf2)[_0x1a0e('0x28')](handleEntityNotFound(_0xccc796,null))['then'](respondWithResult(_0xccc796,null))[_0x1a0e('0x4a')](handleError(_0xccc796,null));};exports[_0x1a0e('0x4b')]=function(_0x27535e,_0x2ebc60){return db[_0x1a0e('0x2e')][_0x1a0e('0x4b')](_0x27535e[_0x1a0e('0x4c')],{})[_0x1a0e('0x28')](respondWithResult(_0x2ebc60,0xc9))['catch'](handleError(_0x2ebc60,null));};exports['update']=function(_0x57450d,_0x3fe638){if(_0x57450d['body']['id']){delete _0x57450d[_0x1a0e('0x4c')]['id'];}return db[_0x1a0e('0x2e')]['find']({'where':{'id':_0x57450d['params']['id']}})[_0x1a0e('0x28')](handleEntityNotFound(_0x3fe638,null))[_0x1a0e('0x28')](saveUpdates(_0x57450d['body'],null))[_0x1a0e('0x28')](respondWithResult(_0x3fe638,null))[_0x1a0e('0x4a')](handleError(_0x3fe638,null));};exports[_0x1a0e('0x29')]=function(_0x26a7b3,_0x31fc89){return db[_0x1a0e('0x2e')]['find']({'where':{'id':_0x26a7b3[_0x1a0e('0x47')]['id']}})[_0x1a0e('0x28')](handleEntityNotFound(_0x31fc89,null))[_0x1a0e('0x28')](removeEntity(_0x31fc89,null))[_0x1a0e('0x4a')](handleError(_0x31fc89,null));};exports[_0x1a0e('0x4d')]=function(_0x18df8e,_0x59f9a0,_0x22563a){var _0x53f0e9={};var _0x6e949a={};var _0x3d9f5d;var _0xc82cc6;return db[_0x1a0e('0x2e')][_0x1a0e('0x4e')]({'where':{'id':_0x18df8e[_0x1a0e('0x47')]['id']}})[_0x1a0e('0x28')](handleEntityNotFound(_0x59f9a0,null))[_0x1a0e('0x28')](function(_0x459258){if(_0x459258){_0x3d9f5d=_0x459258;_0x6e949a[_0x1a0e('0x37')]=_[_0x1a0e('0x34')](db[_0x1a0e('0x4f')]['rawAttributes']);_0x6e949a[_0x1a0e('0x33')]=_['keys'](_0x18df8e['query']);_0x6e949a['filters']=_[_0x1a0e('0x36')](_0x6e949a['model'],_0x6e949a[_0x1a0e('0x33')]);_0x53f0e9[_0x1a0e('0x38')]=_[_0x1a0e('0x36')](_0x6e949a[_0x1a0e('0x37')],qs[_0x1a0e('0x39')](_0x18df8e[_0x1a0e('0x33')]['fields']));_0x53f0e9['attributes']=_0x53f0e9['attributes'][_0x1a0e('0x3a')]?_0x53f0e9[_0x1a0e('0x38')]:_0x6e949a[_0x1a0e('0x37')];_0x53f0e9[_0x1a0e('0x50')]=qs[_0x1a0e('0x3d')](_0x18df8e[_0x1a0e('0x33')]['sort']);_0x53f0e9[_0x1a0e('0x3e')]=qs[_0x1a0e('0x35')](_[_0x1a0e('0x51')](_0x18df8e['query'],_0x6e949a[_0x1a0e('0x35')]));if(_0x18df8e[_0x1a0e('0x33')]['filter']){_0x53f0e9[_0x1a0e('0x3e')]=_[_0x1a0e('0x3f')](_0x53f0e9[_0x1a0e('0x3e')],{'$or':_[_0x1a0e('0x2d')](_0x53f0e9[_0x1a0e('0x38')],function(_0x28b3d1){var _0x2c9ede={};_0x2c9ede[_0x28b3d1]={'$like':'%'+_0x18df8e[_0x1a0e('0x33')]['filter']+'%'};return _0x2c9ede;})});}_0x53f0e9=_['merge']({},_0x53f0e9,_0x18df8e[_0x1a0e('0x42')]);return _0x3d9f5d[_0x1a0e('0x4d')](_0x53f0e9);}})[_0x1a0e('0x28')](function(_0x2ce0c6){if(_0x2ce0c6){_0xc82cc6=_0x2ce0c6[_0x1a0e('0x3a')];if(!_0x18df8e[_0x1a0e('0x33')]['hasOwnProperty'](_0x1a0e('0x3c'))){_0x53f0e9[_0x1a0e('0x22')]=qs[_0x1a0e('0x22')](_0x18df8e[_0x1a0e('0x33')][_0x1a0e('0x22')]);_0x53f0e9[_0x1a0e('0x20')]=qs[_0x1a0e('0x20')](_0x18df8e[_0x1a0e('0x33')][_0x1a0e('0x20')]);}return _0x3d9f5d[_0x1a0e('0x4d')](_0x53f0e9);}})['then'](function(_0x22bb4f){if(_0x22bb4f){return _0x22bb4f?{'count':_0xc82cc6,'rows':_0x22bb4f}:null;}})[_0x1a0e('0x28')](respondWithResult(_0x59f9a0,null))[_0x1a0e('0x4a')](handleError(_0x59f9a0,null));};exports['addConfiguration']=function(_0x37cdb8,_0xf6e378,_0x316f65){if(_0x37cdb8[_0x1a0e('0x4c')]['id']){delete _0x37cdb8['body']['id'];}return db[_0x1a0e('0x2e')][_0x1a0e('0x4e')]({'where':{'id':_0x37cdb8[_0x1a0e('0x47')]['id']}})[_0x1a0e('0x28')](handleEntityNotFound(_0xf6e378,null))['then'](function(_0x4a54ec){if(_0x4a54ec){_0x37cdb8[_0x1a0e('0x4c')]['AccountId']=_0x4a54ec['id'];_0x37cdb8[_0x1a0e('0x4c')][_0x1a0e('0x52')]=integrations['getSubjects'](_0x37cdb8[_0x1a0e('0x4c')][_0x1a0e('0x53')],_0x37cdb8[_0x1a0e('0x4c')]['type']);_0x37cdb8[_0x1a0e('0x4c')]['Descriptions']=integrations[_0x1a0e('0x54')](_0x37cdb8['body'][_0x1a0e('0x53')],_0x37cdb8[_0x1a0e('0x4c')][_0x1a0e('0x31')]);return db[_0x1a0e('0x4f')]['create'](_0x37cdb8[_0x1a0e('0x4c')],{'include':[{'model':db['DeskField'],'as':_0x1a0e('0x52')},{'model':db[_0x1a0e('0x55')],'as':_0x1a0e('0x56')}]});}return null;})[_0x1a0e('0x28')](respondWithResult(_0xf6e378,null))['catch'](handleError(_0xf6e378,null));};exports[_0x1a0e('0x57')]=function(_0x578459,_0x51a1bc,_0xa3dea){var _0x176834=[{'name':_0x1a0e('0x58'),'label':_0x1a0e('0x58'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3e1fa3='';return db['DeskAccount'][_0x1a0e('0x4e')]({'where':{'id':_0x578459[_0x1a0e('0x47')]['id']},'attributes':['id','remoteUri','authType',_0x1a0e('0x59'),'password','consumerKey',_0x1a0e('0x5a'),_0x1a0e('0x5b'),_0x1a0e('0x5c')]})[_0x1a0e('0x28')](handleEntityNotFound(_0x51a1bc,null))['then'](function(_0x1cd276){if(_0x1cd276){_0x3e1fa3=_0x1cd276[_0x1a0e('0x5d')];var _0x12a617=_0x3e1fa3[_0x1a0e('0x5e')](-0x1);if(_0x12a617==='/'){_0x3e1fa3=_0x3e1fa3[_0x1a0e('0x5f')](0x0,_0x3e1fa3[_0x1a0e('0x60')](_0x12a617));}var _0x172710={'method':_0x1a0e('0x61'),'uri':util[_0x1a0e('0x62')](_0x1a0e('0x63'),_0x3e1fa3),'headers':{'Content-Type':_0x1a0e('0x64'),'Accept':_0x1a0e('0x64')},'json':!![]};if(_0x1cd276['authType']===_0x1a0e('0x65')){_0x172710['headers']['Authorization']=util['format'](_0x1a0e('0x66'),new Buffer(util[_0x1a0e('0x62')](_0x1a0e('0x67'),_0x1cd276[_0x1a0e('0x59')],_0x1cd276['password']))[_0x1a0e('0x68')](_0x1a0e('0x69')));}return rp(_0x172710)['then'](function(_0x4ad892){return _0x176834['concat'](_[_0x1a0e('0x2d')](_0x4ad892[_0x1a0e('0x6a')][_0x1a0e('0x6b')],function(_0x467892){return{'id':_0x467892[_0x1a0e('0x2b')],'name':_0x467892[_0x1a0e('0x2b')],'type':_0x467892[_0x1a0e('0x31')],'active':_0x467892[_0x1a0e('0x6c')],'label':_0x467892[_0x1a0e('0x6d')],'custom':!![]};}));});}})[_0x1a0e('0x28')](function(_0x32eb11){return{'count':_0x32eb11[_0x1a0e('0x3a')],'rows':_0x32eb11};})[_0x1a0e('0x28')](respondWithResult(_0x51a1bc,null))[_0x1a0e('0x4a')](function(_0x2e9b53){var _0x2c4395=_0x578459[_0x1a0e('0x33')][_0x1a0e('0x6e')]?0x1f4:_0x2e9b53[_0x1a0e('0x6f')]||0x1f4;logger[_0x1a0e('0x70')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2c4395,JSON[_0x1a0e('0x71')](_0x2e9b53));delete _0x2e9b53[_0x1a0e('0x2b')];if(_0x2c4395===0x191){_0x2c4395=0x190;}_0x51a1bc[_0x1a0e('0x1d')](_0x2c4395)['send'](_0x578459['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2e9b53['statusCode']}:_0x2e9b53);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 57d7b00..8f40c01 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 _0x9613=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x9613,0x1df));var _0x3961=function(_0x3eb653,_0x5e5cd0){_0x3eb653=_0x3eb653-0x0;var _0x36a45d=_0x9613[_0x3eb653];return _0x36a45d;};'use strict';var _=require(_0x3961('0x0'));var util=require('util');var logger=require(_0x3961('0x1'))(_0x3961('0x2'));var moment=require(_0x3961('0x3'));var BPromise=require(_0x3961('0x4'));var rp=require(_0x3961('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3961('0x6'));var config=require(_0x3961('0x7'));var attributes=require(_0x3961('0x8'));var integrations=require(_0x3961('0x9'));module['exports']=function(_0x1ed0b5,_0x1803af){return _0x1ed0b5[_0x3961('0xa')](_0x3961('0xb'),attributes,{'tableName':_0x3961('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfae9=['../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intDeskAccount.attributes'];(function(_0x2e1d15,_0x4ca007){var _0x461717=function(_0x27c9ed){while(--_0x27c9ed){_0x2e1d15['push'](_0x2e1d15['shift']());}};_0x461717(++_0x4ca007);}(_0xfae9,0x163));var _0x9fae=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0xfae9[_0x380af2];return _0x1789dc;};'use strict';var _=require(_0x9fae('0x0'));var util=require(_0x9fae('0x1'));var logger=require(_0x9fae('0x2'))(_0x9fae('0x3'));var moment=require(_0x9fae('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fae('0x5'));var fs=require('fs');var path=require(_0x9fae('0x6'));var rimraf=require(_0x9fae('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fae('0x8'));var integrations=require(_0x9fae('0x9'));module[_0x9fae('0xa')]=function(_0x5ea80f,_0x38007f){return _0x5ea80f[_0x9fae('0xb')]('DeskAccount',attributes,{'tableName':_0x9fae('0xc'),'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 d5a1e2d..9cb02d4 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 _0x87c1=['request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes','include','model','map','stringify','ShowDeskAccount','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x5763da,_0x3cae7d){var _0x36b797=function(_0x484671){while(--_0x484671){_0x5763da['push'](_0x5763da['shift']());}};_0x36b797(++_0x3cae7d);}(_0x87c1,0x77));var _0x187c=function(_0x187507,_0x37554d){_0x187507=_0x187507-0x0;var _0x292e6f=_0x87c1[_0x187507];return _0x292e6f;};'use strict';var _=require(_0x187c('0x0'));var util=require(_0x187c('0x1'));var moment=require(_0x187c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x187c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x187c('0x4'));var logger=require(_0x187c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x187c('0x6'));var client=jayson[_0x187c('0x7')][_0x187c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509794,_0x22024f,_0x53470f){return new BPromise(function(_0x2f25af,_0x1a47f9){return client[_0x187c('0x9')](_0x509794,_0x53470f)[_0x187c('0xa')](function(_0x15690c){logger[_0x187c('0xb')](_0x187c('0xc'),_0x22024f,_0x187c('0xd'));logger[_0x187c('0xe')](_0x187c('0xf'),_0x22024f,_0x187c('0xd'),JSON['stringify'](_0x15690c));if(_0x15690c[_0x187c('0x10')]){if(_0x15690c[_0x187c('0x10')][_0x187c('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x22024f,_0x15690c[_0x187c('0x10')][_0x187c('0x12')]);return _0x1a47f9(_0x15690c[_0x187c('0x10')][_0x187c('0x12')]);}logger['error'](_0x187c('0xc'),_0x22024f,_0x15690c['error'][_0x187c('0x12')]);return _0x2f25af(_0x15690c[_0x187c('0x10')][_0x187c('0x12')]);}else{logger[_0x187c('0xb')](_0x187c('0xc'),_0x22024f,_0x187c('0xd'));_0x2f25af(_0x15690c[_0x187c('0x13')][_0x187c('0x12')]);}})[_0x187c('0x14')](function(_0x1bd6c0){logger[_0x187c('0x10')](_0x187c('0xc'),_0x22024f,_0x1bd6c0);_0x1a47f9(_0x1bd6c0);});});}exports[_0x187c('0x15')]=function(_0x123fa4){var _0x2ed167=this;return new Promise(function(_0x554ab8,_0x1d6241){return db[_0x187c('0x16')]['findAll']({'raw':_0x123fa4[_0x187c('0x17')]?_0x123fa4[_0x187c('0x17')][_0x187c('0x18')]===undefined?!![]:![]:!![],'where':_0x123fa4[_0x187c('0x17')]?_0x123fa4[_0x187c('0x17')]['where']||null:null,'attributes':_0x123fa4['options']?_0x123fa4[_0x187c('0x17')][_0x187c('0x19')]||null:null,'limit':_0x123fa4['options']?_0x123fa4[_0x187c('0x17')]['limit']||null:null,'include':_0x123fa4[_0x187c('0x17')]?_0x123fa4['options'][_0x187c('0x1a')]?_['map'](_0x123fa4[_0x187c('0x17')]['include'],function(_0xb80310){return{'model':db[_0xb80310[_0x187c('0x1b')]],'as':_0xb80310['as'],'attributes':_0xb80310[_0x187c('0x19')],'include':_0xb80310[_0x187c('0x1a')]?_[_0x187c('0x1c')](_0xb80310['include'],function(_0x4c7966){return{'model':db[_0x4c7966[_0x187c('0x1b')]],'as':_0x4c7966['as'],'attributes':_0x4c7966[_0x187c('0x19')],'include':_0x4c7966[_0x187c('0x1a')]?_[_0x187c('0x1c')](_0x4c7966['include'],function(_0x1599bf){return{'model':db[_0x1599bf['model']],'as':_0x1599bf['as'],'attributes':_0x1599bf[_0x187c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x187c('0xa')](function(_0x73eb5c){logger[_0x187c('0xb')](_0x187c('0x15'),_0x123fa4);logger['debug'](_0x187c('0x15'),_0x123fa4,JSON[_0x187c('0x1d')](_0x73eb5c));_0x554ab8(_0x73eb5c);})[_0x187c('0x14')](function(_0x41104b){logger['error']('GetDeskAccount',_0x41104b['message'],_0x123fa4);_0x1d6241(_0x2ed167[_0x187c('0x10')](0x1f4,_0x41104b['message']));});});};exports[_0x187c('0x1e')]=function(_0xd5bc31){var _0x459153=this;return new Promise(function(_0x3b9101,_0x557da4){return db[_0x187c('0x16')]['find']({'raw':_0xd5bc31['options']?_0xd5bc31[_0x187c('0x17')][_0x187c('0x18')]===undefined?!![]:![]:!![],'where':_0xd5bc31[_0x187c('0x17')]?_0xd5bc31['options'][_0x187c('0x1f')]||null:null,'attributes':_0xd5bc31[_0x187c('0x17')]?_0xd5bc31[_0x187c('0x17')][_0x187c('0x19')]||null:null,'include':_0xd5bc31[_0x187c('0x17')]?_0xd5bc31['options'][_0x187c('0x1a')]?_['map'](_0xd5bc31[_0x187c('0x17')]['include'],function(_0x286301){return{'model':db[_0x286301[_0x187c('0x1b')]],'as':_0x286301['as'],'attributes':_0x286301[_0x187c('0x19')],'include':_0x286301[_0x187c('0x1a')]?_['map'](_0x286301['include'],function(_0x2dd017){return{'model':db[_0x2dd017[_0x187c('0x1b')]],'as':_0x2dd017['as'],'attributes':_0x2dd017[_0x187c('0x19')],'include':_0x2dd017[_0x187c('0x1a')]?_['map'](_0x2dd017[_0x187c('0x1a')],function(_0x42b03d){return{'model':db[_0x42b03d[_0x187c('0x1b')]],'as':_0x42b03d['as'],'attributes':_0x42b03d[_0x187c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8587){logger[_0x187c('0xb')](_0x187c('0x1e'),_0xd5bc31);logger[_0x187c('0xe')](_0x187c('0x1e'),_0xd5bc31,JSON[_0x187c('0x1d')](_0x5d8587));_0x3b9101(_0x5d8587);})['catch'](function(_0x57fe0f){logger[_0x187c('0x10')](_0x187c('0x1e'),_0x57fe0f[_0x187c('0x12')],_0xd5bc31);_0x557da4(_0x459153[_0x187c('0x10')](0x1f4,_0x57fe0f[_0x187c('0x12')]));});});}; \ No newline at end of file +var _0xbb4b=['attributes','include','map','model','ShowDeskAccount','find','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options'];(function(_0xe91613,_0x310930){var _0x507112=function(_0x114477){while(--_0x114477){_0xe91613['push'](_0xe91613['shift']());}};_0x507112(++_0x310930);}(_0xbb4b,0xef));var _0xbbb4=function(_0x52487d,_0x113151){_0x52487d=_0x52487d-0x0;var _0x14acec=_0xbb4b[_0x52487d];return _0x14acec;};'use strict';var _=require(_0xbbb4('0x0'));var util=require(_0xbbb4('0x1'));var moment=require(_0xbbb4('0x2'));var BPromise=require(_0xbbb4('0x3'));var rs=require(_0xbbb4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbb4('0x5'))['db'];var utils=require(_0xbbb4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbbb4('0x7'));var client=jayson[_0xbbb4('0x8')][_0xbbb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c711,_0x8117a4,_0x1ca534){return new BPromise(function(_0x43d59b,_0x134cf5){return client[_0xbbb4('0xa')](_0x35c711,_0x1ca534)[_0xbbb4('0xb')](function(_0x460cc1){logger[_0xbbb4('0xc')](_0xbbb4('0xd'),_0x8117a4,_0xbbb4('0xe'));logger[_0xbbb4('0xf')](_0xbbb4('0x10'),_0x8117a4,_0xbbb4('0xe'),JSON['stringify'](_0x460cc1));if(_0x460cc1[_0xbbb4('0x11')]){if(_0x460cc1[_0xbbb4('0x11')]['code']===0x1f4){logger['error'](_0xbbb4('0xd'),_0x8117a4,_0x460cc1[_0xbbb4('0x11')]['message']);return _0x134cf5(_0x460cc1[_0xbbb4('0x11')][_0xbbb4('0x12')]);}logger[_0xbbb4('0x11')]('DeskAccount,\x20%s,\x20%s',_0x8117a4,_0x460cc1['error']['message']);return _0x43d59b(_0x460cc1[_0xbbb4('0x11')][_0xbbb4('0x12')]);}else{logger[_0xbbb4('0xc')]('DeskAccount,\x20%s,\x20%s',_0x8117a4,_0xbbb4('0xe'));_0x43d59b(_0x460cc1[_0xbbb4('0x13')][_0xbbb4('0x12')]);}})[_0xbbb4('0x14')](function(_0x8e6625){logger['error'](_0xbbb4('0xd'),_0x8117a4,_0x8e6625);_0x134cf5(_0x8e6625);});});}exports[_0xbbb4('0x15')]=function(_0x294e4e){var _0x218b34=this;return new Promise(function(_0x237c1c,_0x110080){return db[_0xbbb4('0x16')][_0xbbb4('0x17')]({'raw':_0x294e4e['options']?_0x294e4e[_0xbbb4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x294e4e['options']?_0x294e4e[_0xbbb4('0x18')]['where']||null:null,'attributes':_0x294e4e['options']?_0x294e4e[_0xbbb4('0x18')][_0xbbb4('0x19')]||null:null,'limit':_0x294e4e[_0xbbb4('0x18')]?_0x294e4e[_0xbbb4('0x18')]['limit']||null:null,'include':_0x294e4e['options']?_0x294e4e['options'][_0xbbb4('0x1a')]?_['map'](_0x294e4e[_0xbbb4('0x18')][_0xbbb4('0x1a')],function(_0x14c66e){return{'model':db[_0x14c66e['model']],'as':_0x14c66e['as'],'attributes':_0x14c66e['attributes'],'include':_0x14c66e[_0xbbb4('0x1a')]?_[_0xbbb4('0x1b')](_0x14c66e[_0xbbb4('0x1a')],function(_0x53a648){return{'model':db[_0x53a648[_0xbbb4('0x1c')]],'as':_0x53a648['as'],'attributes':_0x53a648[_0xbbb4('0x19')],'include':_0x53a648['include']?_[_0xbbb4('0x1b')](_0x53a648[_0xbbb4('0x1a')],function(_0x526f2f){return{'model':db[_0x526f2f[_0xbbb4('0x1c')]],'as':_0x526f2f['as'],'attributes':_0x526f2f[_0xbbb4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbbb4('0xb')](function(_0x1c6929){logger[_0xbbb4('0xc')](_0xbbb4('0x15'),_0x294e4e);logger[_0xbbb4('0xf')](_0xbbb4('0x15'),_0x294e4e,JSON['stringify'](_0x1c6929));_0x237c1c(_0x1c6929);})[_0xbbb4('0x14')](function(_0x3a8df1){logger['error'](_0xbbb4('0x15'),_0x3a8df1[_0xbbb4('0x12')],_0x294e4e);_0x110080(_0x218b34[_0xbbb4('0x11')](0x1f4,_0x3a8df1[_0xbbb4('0x12')]));});});};exports[_0xbbb4('0x1d')]=function(_0xc45b72){var _0x72fed9=this;return new Promise(function(_0x5b7c1a,_0x21316e){return db[_0xbbb4('0x16')][_0xbbb4('0x1e')]({'raw':_0xc45b72[_0xbbb4('0x18')]?_0xc45b72[_0xbbb4('0x18')][_0xbbb4('0x1f')]===undefined?!![]:![]:!![],'where':_0xc45b72[_0xbbb4('0x18')]?_0xc45b72[_0xbbb4('0x18')]['where']||null:null,'attributes':_0xc45b72[_0xbbb4('0x18')]?_0xc45b72['options']['attributes']||null:null,'include':_0xc45b72[_0xbbb4('0x18')]?_0xc45b72[_0xbbb4('0x18')][_0xbbb4('0x1a')]?_['map'](_0xc45b72[_0xbbb4('0x18')][_0xbbb4('0x1a')],function(_0x2b57d0){return{'model':db[_0x2b57d0[_0xbbb4('0x1c')]],'as':_0x2b57d0['as'],'attributes':_0x2b57d0[_0xbbb4('0x19')],'include':_0x2b57d0['include']?_[_0xbbb4('0x1b')](_0x2b57d0[_0xbbb4('0x1a')],function(_0x7624b5){return{'model':db[_0x7624b5[_0xbbb4('0x1c')]],'as':_0x7624b5['as'],'attributes':_0x7624b5[_0xbbb4('0x19')],'include':_0x7624b5[_0xbbb4('0x1a')]?_[_0xbbb4('0x1b')](_0x7624b5[_0xbbb4('0x1a')],function(_0x22b96d){return{'model':db[_0x22b96d[_0xbbb4('0x1c')]],'as':_0x22b96d['as'],'attributes':_0x22b96d[_0xbbb4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7b7f6d){logger[_0xbbb4('0xc')]('ShowDeskAccount',_0xc45b72);logger['debug'](_0xbbb4('0x1d'),_0xc45b72,JSON[_0xbbb4('0x20')](_0x7b7f6d));_0x5b7c1a(_0x7b7f6d);})[_0xbbb4('0x14')](function(_0xbf85b4){logger['error'](_0xbbb4('0x1d'),_0xbf85b4['message'],_0xc45b72);_0x21316e(_0x72fed9['error'](0x1f4,_0xbf85b4[_0xbbb4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index b9a5be0..2fb36da 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x55ca,0x126));var _0xa55c=function(_0x5d917c,_0x7846a){_0x5d917c=_0x5d917c-0x0;var _0x4e850f=_0x55ca[_0x5d917c];return _0x4e850f;};'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')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);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['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f27fb,_0x2d0195){var _0x3aae69=function(_0x328b9d){while(--_0x328b9d){_0x3f27fb['push'](_0x3f27fb['shift']());}};_0x3aae69(++_0x2d0195);}(_0x008c,0x188));var _0xc008=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x008c[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 81b2fdb..2c1eb3e 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 _0xd08d=['sequelize','STRING'];(function(_0x2a1f42,_0x1e24b0){var _0x86ff06=function(_0x4e8fa2){while(--_0x4e8fa2){_0x2a1f42['push'](_0x2a1f42['shift']());}};_0x86ff06(++_0x1e24b0);}(_0xd08d,0x9a));var _0xdd08=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xd08d[_0xfb0cfd];return _0x2fd8aa;};'use strict';var Sequelize=require(_0xdd08('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd08('0x1')]},'description':{'type':Sequelize[_0xdd08('0x1')]}}; \ No newline at end of file +var _0x5240=['STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5240,0x1cb));var _0x0524=function(_0x4df33d,_0x580bd7){_0x4df33d=_0x4df33d-0x0;var _0x1705f0=_0x5240[_0x4df33d];return _0x1705f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0524('0x0')]},'description':{'type':Sequelize[_0x0524('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 91862fb..a270e45 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 _0x4b79=['limit','count','set','Content-Range','json','reject','update','destroy','then','end','sendStatus','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined'];(function(_0x23e385,_0x3869ba){var _0x51ba85=function(_0x4fd598){while(--_0x4fd598){_0x23e385['push'](_0x23e385['shift']());}};_0x51ba85(++_0x3869ba);}(_0x4b79,0x1e0));var _0x94b7=function(_0x48bafe,_0x2b6214){_0x48bafe=_0x48bafe-0x0;var _0x103e10=_0x4b79[_0x48bafe];return _0x103e10;};'use strict';var emlformat=require(_0x94b7('0x0'));var rimraf=require(_0x94b7('0x1'));var zipdir=require(_0x94b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94b7('0x3'));var BPromise=require(_0x94b7('0x4'));var Mustache=require(_0x94b7('0x5'));var util=require('util');var path=require(_0x94b7('0x6'));var sox=require(_0x94b7('0x7'));var csv=require('to-csv');var ejs=require(_0x94b7('0x8'));var fs=require('fs');var fs_extra=require(_0x94b7('0x9'));var _=require(_0x94b7('0xa'));var squel=require(_0x94b7('0xb'));var crypto=require(_0x94b7('0xc'));var jsforce=require(_0x94b7('0xd'));var deskjs=require(_0x94b7('0xe'));var toCsv=require(_0x94b7('0xf'));var querystring=require(_0x94b7('0x10'));var Papa=require(_0x94b7('0x11'));var Redis=require(_0x94b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x94b7('0x13'));var as=require(_0x94b7('0x14'));var hardwareService=require(_0x94b7('0x15'));var logger=require(_0x94b7('0x16'))(_0x94b7('0x17'));var utils=require(_0x94b7('0x18'));var config=require(_0x94b7('0x19'));var licenseUtil=require(_0x94b7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a64bf,_0x18a57c){_0x18a57c=_0x18a57c||0xcc;return function(_0x49f351){if(_0x49f351){return _0x5a64bf['sendStatus'](_0x18a57c);}return _0x5a64bf[_0x94b7('0x1b')](_0x18a57c)['end']();};}function respondWithResult(_0x552a6c,_0x51e56d){_0x51e56d=_0x51e56d||0xc8;return function(_0x314a8a){if(_0x314a8a){return _0x552a6c['status'](_0x51e56d)['json'](_0x314a8a);}};}function respondWithFilteredResult(_0x7c051e,_0x2597f5){return function(_0x16509c){if(_0x16509c){var _0x23b83d=typeof _0x2597f5[_0x94b7('0x1c')]===_0x94b7('0x1d')&&typeof _0x2597f5[_0x94b7('0x1e')]===_0x94b7('0x1d');var _0x41a697=_0x16509c[_0x94b7('0x1f')];var _0x1dd458=_0x23b83d?0x0:_0x2597f5['offset'];var _0x27a598=_0x23b83d?_0x16509c[_0x94b7('0x1f')]:_0x2597f5['offset']+_0x2597f5[_0x94b7('0x1e')];var _0x32b744;if(_0x27a598>=_0x41a697){_0x27a598=_0x41a697;_0x32b744=0xc8;}else{_0x32b744=0xce;}_0x7c051e[_0x94b7('0x1b')](_0x32b744);return _0x7c051e[_0x94b7('0x20')](_0x94b7('0x21'),_0x1dd458+'-'+_0x27a598+'/'+_0x41a697)[_0x94b7('0x22')](_0x16509c);}return null;};}function patchUpdates(_0xc7c68b){return function(_0x2dfd7e){try{jsonpatch['apply'](_0x2dfd7e,_0xc7c68b,!![]);}catch(_0x1f0dfb){return BPromise[_0x94b7('0x23')](_0x1f0dfb);}return _0x2dfd7e['save']();};}function saveUpdates(_0x2ebcfb,_0x22c41f){return function(_0x5e3393){if(_0x5e3393){return _0x5e3393[_0x94b7('0x24')](_0x2ebcfb)['then'](function(_0x10d323){return _0x10d323;});}return null;};}function removeEntity(_0x45c44,_0x2fd7ab){return function(_0x51078c){if(_0x51078c){return _0x51078c[_0x94b7('0x25')]()[_0x94b7('0x26')](function(){_0x45c44[_0x94b7('0x1b')](0xcc)[_0x94b7('0x27')]();});}};}function handleEntityNotFound(_0x168900,_0x3b6837){return function(_0x4ca48b){if(!_0x4ca48b){_0x168900[_0x94b7('0x28')](0x194);}return _0x4ca48b;};}function handleError(_0x194750,_0x54ea06){_0x54ea06=_0x54ea06||0x1f4;return function(_0x182ab9){logger['error'](_0x182ab9['stack']);if(_0x182ab9[_0x94b7('0x29')]){delete _0x182ab9[_0x94b7('0x29')];}_0x194750[_0x94b7('0x1b')](_0x54ea06)[_0x94b7('0x2a')](_0x182ab9);};}exports[_0x94b7('0x2b')]=function(_0x28ab65,_0xea0178){var _0x403ef1={},_0x52482d={},_0x53bf90={'count':0x0,'rows':[]};var _0x15c08a=_[_0x94b7('0x2c')](db[_0x94b7('0x2d')][_0x94b7('0x2e')],function(_0x412d13){return{'name':_0x412d13['fieldName'],'type':_0x412d13[_0x94b7('0x2f')][_0x94b7('0x30')]};});_0x52482d[_0x94b7('0x31')]=_[_0x94b7('0x2c')](_0x15c08a,_0x94b7('0x29'));_0x52482d[_0x94b7('0x32')]=_[_0x94b7('0x33')](_0x28ab65[_0x94b7('0x32')]);_0x52482d['filters']=_[_0x94b7('0x34')](_0x52482d[_0x94b7('0x31')],_0x52482d[_0x94b7('0x32')]);_0x403ef1[_0x94b7('0x35')]=_[_0x94b7('0x34')](_0x52482d[_0x94b7('0x31')],qs['fields'](_0x28ab65['query'][_0x94b7('0x36')]));_0x403ef1['attributes']=_0x403ef1[_0x94b7('0x35')][_0x94b7('0x37')]?_0x403ef1[_0x94b7('0x35')]:_0x52482d[_0x94b7('0x31')];if(!_0x28ab65[_0x94b7('0x32')][_0x94b7('0x38')](_0x94b7('0x39'))){_0x403ef1['limit']=qs['limit'](_0x28ab65[_0x94b7('0x32')][_0x94b7('0x1e')]);_0x403ef1[_0x94b7('0x1c')]=qs[_0x94b7('0x1c')](_0x28ab65[_0x94b7('0x32')][_0x94b7('0x1c')]);}_0x403ef1['order']=qs[_0x94b7('0x3a')](_0x28ab65[_0x94b7('0x32')][_0x94b7('0x3a')]);_0x403ef1[_0x94b7('0x3b')]=qs[_0x94b7('0x3c')](_[_0x94b7('0x3d')](_0x28ab65['query'],_0x52482d['filters']),_0x15c08a);if(_0x28ab65[_0x94b7('0x32')]['filter']){_0x403ef1[_0x94b7('0x3b')]=_[_0x94b7('0x3e')](_0x403ef1['where'],{'$or':_['map'](_0x15c08a,function(_0x258ce0){if(_0x258ce0[_0x94b7('0x2f')]!=='VIRTUAL'){var _0x25d5e5={};_0x25d5e5[_0x258ce0[_0x94b7('0x29')]]={'$like':'%'+_0x28ab65[_0x94b7('0x32')][_0x94b7('0x3f')]+'%'};return _0x25d5e5;}})});}_0x403ef1=_[_0x94b7('0x3e')]({},_0x403ef1,_0x28ab65[_0x94b7('0x40')]);var _0x96d39b={'where':_0x403ef1[_0x94b7('0x3b')]};return db[_0x94b7('0x2d')][_0x94b7('0x1f')](_0x96d39b)['then'](function(_0x1296f3){_0x53bf90['count']=_0x1296f3;if(_0x28ab65[_0x94b7('0x32')][_0x94b7('0x41')]){_0x403ef1[_0x94b7('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x94b7('0x43')](_0x403ef1);})[_0x94b7('0x26')](function(_0x27cc90){_0x53bf90[_0x94b7('0x44')]=_0x27cc90;return _0x53bf90;})[_0x94b7('0x26')](respondWithFilteredResult(_0xea0178,_0x403ef1))[_0x94b7('0x45')](handleError(_0xea0178,null));};exports[_0x94b7('0x46')]=function(_0x490e2c,_0x42e772){var _0x449180={'raw':![],'where':{'id':_0x490e2c[_0x94b7('0x47')]['id']}},_0x16cd04={};_0x16cd04[_0x94b7('0x31')]=_['keys'](db[_0x94b7('0x2d')][_0x94b7('0x2e')]);_0x16cd04['query']=_[_0x94b7('0x33')](_0x490e2c[_0x94b7('0x32')]);_0x16cd04[_0x94b7('0x3c')]=_[_0x94b7('0x34')](_0x16cd04[_0x94b7('0x31')],_0x16cd04[_0x94b7('0x32')]);_0x449180[_0x94b7('0x35')]=_[_0x94b7('0x34')](_0x16cd04['model'],qs[_0x94b7('0x36')](_0x490e2c['query'][_0x94b7('0x36')]));_0x449180[_0x94b7('0x35')]=_0x449180['attributes'][_0x94b7('0x37')]?_0x449180[_0x94b7('0x35')]:_0x16cd04[_0x94b7('0x31')];if(_0x490e2c['query'][_0x94b7('0x41')]){_0x449180[_0x94b7('0x42')]=[{'all':!![]}];}_0x449180=_['merge']({},_0x449180,_0x490e2c[_0x94b7('0x40')]);return db[_0x94b7('0x2d')][_0x94b7('0x48')](_0x449180)[_0x94b7('0x26')](handleEntityNotFound(_0x42e772,null))[_0x94b7('0x26')](respondWithResult(_0x42e772,null))[_0x94b7('0x45')](handleError(_0x42e772,null));};exports[_0x94b7('0x49')]=function(_0x204683,_0xca381e){return db[_0x94b7('0x2d')][_0x94b7('0x49')](_0x204683[_0x94b7('0x4a')],{})[_0x94b7('0x26')](respondWithResult(_0xca381e,0xc9))[_0x94b7('0x45')](handleError(_0xca381e,null));};exports['update']=function(_0x2fcb28,_0x1674a4){if(_0x2fcb28['body']['id']){delete _0x2fcb28[_0x94b7('0x4a')]['id'];}return db[_0x94b7('0x2d')][_0x94b7('0x48')]({'where':{'id':_0x2fcb28[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x1674a4,null))[_0x94b7('0x26')](saveUpdates(_0x2fcb28[_0x94b7('0x4a')],null))[_0x94b7('0x26')](respondWithResult(_0x1674a4,null))['catch'](handleError(_0x1674a4,null));};exports[_0x94b7('0x25')]=function(_0x693e83,_0x433b9c){return db[_0x94b7('0x2d')]['find']({'where':{'id':_0x693e83[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x433b9c,null))[_0x94b7('0x26')](removeEntity(_0x433b9c,null))[_0x94b7('0x45')](handleError(_0x433b9c,null));};exports[_0x94b7('0x4b')]=function(_0x2eb18c,_0x2b53ae,_0x158e58){var _0x49b399={};var _0x262613={};var _0x2a2b37;var _0x340629;return db['DeskConfiguration'][_0x94b7('0x4c')]({'where':{'id':_0x2eb18c[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x2b53ae,null))['then'](function(_0x2e4493){if(_0x2e4493){_0x2a2b37=_0x2e4493;_0x262613[_0x94b7('0x31')]=_[_0x94b7('0x33')](db[_0x94b7('0x4d')]['rawAttributes']);_0x262613['query']=_[_0x94b7('0x33')](_0x2eb18c['query']);_0x262613['filters']=_[_0x94b7('0x34')](_0x262613[_0x94b7('0x31')],_0x262613[_0x94b7('0x32')]);_0x49b399['attributes']=_['intersection'](_0x262613['model'],qs[_0x94b7('0x36')](_0x2eb18c['query'][_0x94b7('0x36')]));_0x49b399[_0x94b7('0x35')]=_0x49b399[_0x94b7('0x35')][_0x94b7('0x37')]?_0x49b399[_0x94b7('0x35')]:_0x262613[_0x94b7('0x31')];_0x49b399[_0x94b7('0x4e')]=qs[_0x94b7('0x3a')](_0x2eb18c[_0x94b7('0x32')]['sort']);_0x49b399['where']=qs[_0x94b7('0x3c')](_[_0x94b7('0x3d')](_0x2eb18c['query'],_0x262613['filters']));if(_0x2eb18c['query'][_0x94b7('0x3f')]){_0x49b399[_0x94b7('0x3b')]=_[_0x94b7('0x3e')](_0x49b399[_0x94b7('0x3b')],{'$or':_[_0x94b7('0x2c')](_0x49b399['attributes'],function(_0x17eb75){var _0x55e352={};_0x55e352[_0x17eb75]={'$like':'%'+_0x2eb18c[_0x94b7('0x32')]['filter']+'%'};return _0x55e352;})});}_0x49b399=_[_0x94b7('0x3e')]({},_0x49b399,_0x2eb18c['options']);return _0x2a2b37[_0x94b7('0x4b')](_0x49b399);}})[_0x94b7('0x26')](function(_0x178d1a){if(_0x178d1a){_0x340629=_0x178d1a['length'];if(!_0x2eb18c['query']['hasOwnProperty'](_0x94b7('0x39'))){_0x49b399[_0x94b7('0x1e')]=qs[_0x94b7('0x1e')](_0x2eb18c[_0x94b7('0x32')][_0x94b7('0x1e')]);_0x49b399[_0x94b7('0x1c')]=qs['offset'](_0x2eb18c['query'][_0x94b7('0x1c')]);}return _0x2a2b37[_0x94b7('0x4b')](_0x49b399);}})['then'](function(_0xe273e5){if(_0xe273e5){return _0xe273e5?{'count':_0x340629,'rows':_0xe273e5}:null;}})['then'](respondWithResult(_0x2b53ae,null))[_0x94b7('0x45')](handleError(_0x2b53ae,null));};exports[_0x94b7('0x4f')]=function(_0x1d2abe,_0x5bdefc,_0x441cdf){var _0x5dfe07={};var _0x1a675e={};var _0x255bae;var _0x2ff4f6;return db[_0x94b7('0x2d')][_0x94b7('0x4c')]({'where':{'id':_0x1d2abe[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x5bdefc,null))[_0x94b7('0x26')](function(_0x256143){if(_0x256143){_0x255bae=_0x256143;_0x1a675e['model']=_[_0x94b7('0x33')](db[_0x94b7('0x4d')]['rawAttributes']);_0x1a675e[_0x94b7('0x32')]=_[_0x94b7('0x33')](_0x1d2abe[_0x94b7('0x32')]);_0x1a675e['filters']=_[_0x94b7('0x34')](_0x1a675e[_0x94b7('0x31')],_0x1a675e['query']);_0x5dfe07[_0x94b7('0x35')]=_['intersection'](_0x1a675e['model'],qs['fields'](_0x1d2abe[_0x94b7('0x32')]['fields']));_0x5dfe07['attributes']=_0x5dfe07['attributes']['length']?_0x5dfe07[_0x94b7('0x35')]:_0x1a675e[_0x94b7('0x31')];_0x5dfe07[_0x94b7('0x4e')]=qs[_0x94b7('0x3a')](_0x1d2abe[_0x94b7('0x32')][_0x94b7('0x3a')]);_0x5dfe07[_0x94b7('0x3b')]=qs[_0x94b7('0x3c')](_[_0x94b7('0x3d')](_0x1d2abe[_0x94b7('0x32')],_0x1a675e[_0x94b7('0x3c')]));if(_0x1d2abe[_0x94b7('0x32')][_0x94b7('0x3f')]){_0x5dfe07[_0x94b7('0x3b')]=_[_0x94b7('0x3e')](_0x5dfe07['where'],{'$or':_[_0x94b7('0x2c')](_0x5dfe07[_0x94b7('0x35')],function(_0x3be719){var _0x247d4f={};_0x247d4f[_0x3be719]={'$like':'%'+_0x1d2abe['query'][_0x94b7('0x3f')]+'%'};return _0x247d4f;})});}_0x5dfe07=_[_0x94b7('0x3e')]({},_0x5dfe07,_0x1d2abe[_0x94b7('0x40')]);return _0x255bae[_0x94b7('0x4f')](_0x5dfe07);}})[_0x94b7('0x26')](function(_0x50f3d0){if(_0x50f3d0){_0x2ff4f6=_0x50f3d0[_0x94b7('0x37')];if(!_0x1d2abe[_0x94b7('0x32')][_0x94b7('0x38')]('nolimit')){_0x5dfe07[_0x94b7('0x1e')]=qs[_0x94b7('0x1e')](_0x1d2abe[_0x94b7('0x32')][_0x94b7('0x1e')]);_0x5dfe07[_0x94b7('0x1c')]=qs[_0x94b7('0x1c')](_0x1d2abe[_0x94b7('0x32')][_0x94b7('0x1c')]);}return _0x255bae['getSubjects'](_0x5dfe07);}})[_0x94b7('0x26')](function(_0x22cc12){if(_0x22cc12){return _0x22cc12?{'count':_0x2ff4f6,'rows':_0x22cc12}:null;}})['then'](respondWithResult(_0x5bdefc,null))[_0x94b7('0x45')](handleError(_0x5bdefc,null));};exports[_0x94b7('0x50')]=function(_0x3ea568,_0x51961c,_0x54cb15){var _0x1197fd={};var _0x26af09={};var _0x4dd299;var _0x1edd55;return db[_0x94b7('0x2d')]['findOne']({'where':{'id':_0x3ea568['params']['id']}})['then'](handleEntityNotFound(_0x51961c,null))[_0x94b7('0x26')](function(_0x264bf5){if(_0x264bf5){_0x4dd299=_0x264bf5;_0x26af09[_0x94b7('0x31')]=_[_0x94b7('0x33')](db['DeskField'][_0x94b7('0x2e')]);_0x26af09[_0x94b7('0x32')]=_[_0x94b7('0x33')](_0x3ea568[_0x94b7('0x32')]);_0x26af09[_0x94b7('0x3c')]=_[_0x94b7('0x34')](_0x26af09[_0x94b7('0x31')],_0x26af09[_0x94b7('0x32')]);_0x1197fd['attributes']=_[_0x94b7('0x34')](_0x26af09[_0x94b7('0x31')],qs['fields'](_0x3ea568[_0x94b7('0x32')][_0x94b7('0x36')]));_0x1197fd[_0x94b7('0x35')]=_0x1197fd[_0x94b7('0x35')][_0x94b7('0x37')]?_0x1197fd[_0x94b7('0x35')]:_0x26af09[_0x94b7('0x31')];_0x1197fd['order']=qs['sort'](_0x3ea568[_0x94b7('0x32')][_0x94b7('0x3a')]);_0x1197fd[_0x94b7('0x3b')]=qs[_0x94b7('0x3c')](_['pick'](_0x3ea568[_0x94b7('0x32')],_0x26af09['filters']));if(_0x3ea568['query']['filter']){_0x1197fd[_0x94b7('0x3b')]=_[_0x94b7('0x3e')](_0x1197fd[_0x94b7('0x3b')],{'$or':_['map'](_0x1197fd[_0x94b7('0x35')],function(_0x5ee3b4){var _0x1f0298={};_0x1f0298[_0x5ee3b4]={'$like':'%'+_0x3ea568[_0x94b7('0x32')][_0x94b7('0x3f')]+'%'};return _0x1f0298;})});}_0x1197fd=_[_0x94b7('0x3e')]({},_0x1197fd,_0x3ea568[_0x94b7('0x40')]);return _0x4dd299[_0x94b7('0x50')](_0x1197fd);}})[_0x94b7('0x26')](function(_0x3d7303){if(_0x3d7303){_0x1edd55=_0x3d7303[_0x94b7('0x37')];if(!_0x3ea568[_0x94b7('0x32')][_0x94b7('0x38')](_0x94b7('0x39'))){_0x1197fd[_0x94b7('0x1e')]=qs[_0x94b7('0x1e')](_0x3ea568[_0x94b7('0x32')][_0x94b7('0x1e')]);_0x1197fd[_0x94b7('0x1c')]=qs[_0x94b7('0x1c')](_0x3ea568[_0x94b7('0x32')][_0x94b7('0x1c')]);}return _0x4dd299[_0x94b7('0x50')](_0x1197fd);}})['then'](function(_0x3bd66e){if(_0x3bd66e){return _0x3bd66e?{'count':_0x1edd55,'rows':_0x3bd66e}:null;}})[_0x94b7('0x26')](respondWithResult(_0x51961c,null))[_0x94b7('0x45')](handleError(_0x51961c,null));};exports[_0x94b7('0x51')]=function(_0x14ad8f,_0x324de7,_0x1b1039){var _0x35800f={};var _0x3bd711={};var _0x3db301;var _0x49054e;return db[_0x94b7('0x2d')][_0x94b7('0x4c')]({'where':{'id':_0x14ad8f[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x324de7,null))[_0x94b7('0x26')](function(_0x171d3a){if(_0x171d3a){_0x3db301=_0x171d3a;_0x3bd711['model']=_['keys'](db[_0x94b7('0x52')][_0x94b7('0x2e')]);_0x3bd711[_0x94b7('0x32')]=_['keys'](_0x14ad8f[_0x94b7('0x32')]);_0x3bd711[_0x94b7('0x3c')]=_['intersection'](_0x3bd711[_0x94b7('0x31')],_0x3bd711[_0x94b7('0x32')]);_0x35800f[_0x94b7('0x35')]=_[_0x94b7('0x34')](_0x3bd711[_0x94b7('0x31')],qs[_0x94b7('0x36')](_0x14ad8f['query']['fields']));_0x35800f['attributes']=_0x35800f[_0x94b7('0x35')][_0x94b7('0x37')]?_0x35800f['attributes']:_0x3bd711['model'];_0x35800f['order']=qs[_0x94b7('0x3a')](_0x14ad8f['query'][_0x94b7('0x3a')]);_0x35800f[_0x94b7('0x3b')]=qs[_0x94b7('0x3c')](_[_0x94b7('0x3d')](_0x14ad8f['query'],_0x3bd711[_0x94b7('0x3c')]));if(_0x14ad8f[_0x94b7('0x32')][_0x94b7('0x3f')]){_0x35800f[_0x94b7('0x3b')]=_['merge'](_0x35800f[_0x94b7('0x3b')],{'$or':_[_0x94b7('0x2c')](_0x35800f[_0x94b7('0x35')],function(_0x2a5710){var _0x2871aa={};_0x2871aa[_0x2a5710]={'$like':'%'+_0x14ad8f[_0x94b7('0x32')][_0x94b7('0x3f')]+'%'};return _0x2871aa;})});}_0x35800f=_[_0x94b7('0x3e')]({},_0x35800f,_0x14ad8f[_0x94b7('0x40')]);return _0x3db301[_0x94b7('0x51')](_0x35800f);}})[_0x94b7('0x26')](function(_0x4d9c94){if(_0x4d9c94){_0x49054e=_0x4d9c94['length'];if(!_0x14ad8f[_0x94b7('0x32')]['hasOwnProperty'](_0x94b7('0x39'))){_0x35800f['limit']=qs['limit'](_0x14ad8f['query']['limit']);_0x35800f[_0x94b7('0x1c')]=qs[_0x94b7('0x1c')](_0x14ad8f['query'][_0x94b7('0x1c')]);}return _0x3db301[_0x94b7('0x51')](_0x35800f);}})[_0x94b7('0x26')](function(_0x5e247e){if(_0x5e247e){return _0x5e247e?{'count':_0x49054e,'rows':_0x5e247e}:null;}})[_0x94b7('0x26')](respondWithResult(_0x324de7,null))[_0x94b7('0x45')](handleError(_0x324de7,null));};exports[_0x94b7('0x53')]=function(_0x36c426,_0x4e71d7,_0x2260f5){if(_0x36c426[_0x94b7('0x4a')]['id']){delete _0x36c426[_0x94b7('0x4a')]['id'];}return db[_0x94b7('0x2d')]['findOne']({'where':{'id':_0x36c426[_0x94b7('0x47')]['id']}})[_0x94b7('0x26')](handleEntityNotFound(_0x4e71d7,null))['then'](function(_0x13142d){if(_0x13142d){return _0x13142d[_0x94b7('0x53')](_0x36c426[_0x94b7('0x4a')][_0x94b7('0x54')]||[]);}return null;})[_0x94b7('0x26')](respondWithResult(_0x4e71d7,null))[_0x94b7('0x45')](handleError(_0x4e71d7,null));}; \ No newline at end of file +var _0x2223=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getFields','findOne','DeskField','intersection','order','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','eml-format','zip-dir','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x2223,0x1e5));var _0x3222=function(_0x2fdcf3,_0x4dfbea){_0x2fdcf3=_0x2fdcf3-0x0;var _0x33b113=_0x2223[_0x2fdcf3];return _0x33b113;};'use strict';var emlformat=require(_0x3222('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3222('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3222('0x2'));var BPromise=require(_0x3222('0x3'));var Mustache=require(_0x3222('0x4'));var util=require('util');var path=require(_0x3222('0x5'));var sox=require(_0x3222('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3222('0x7'));var _=require(_0x3222('0x8'));var squel=require(_0x3222('0x9'));var crypto=require(_0x3222('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3222('0xb'));var toCsv=require(_0x3222('0xc'));var querystring=require('querystring');var Papa=require(_0x3222('0xd'));var Redis=require('ioredis');var authService=require(_0x3222('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3222('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3222('0x10'))('api');var utils=require(_0x3222('0x11'));var config=require(_0x3222('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3222('0x13'))['db'];function respondWithStatusCode(_0x450619,_0x2a810e){_0x2a810e=_0x2a810e||0xcc;return function(_0xbb71fa){if(_0xbb71fa){return _0x450619[_0x3222('0x14')](_0x2a810e);}return _0x450619[_0x3222('0x15')](_0x2a810e)['end']();};}function respondWithResult(_0x486333,_0x1792c3){_0x1792c3=_0x1792c3||0xc8;return function(_0x393975){if(_0x393975){return _0x486333[_0x3222('0x15')](_0x1792c3)['json'](_0x393975);}};}function respondWithFilteredResult(_0x9a17e3,_0x563ab4){return function(_0x47d95b){if(_0x47d95b){var _0x71e0ec=typeof _0x563ab4[_0x3222('0x16')]===_0x3222('0x17')&&typeof _0x563ab4['limit']===_0x3222('0x17');var _0x3cd0ef=_0x47d95b[_0x3222('0x18')];var _0x3be3e3=_0x71e0ec?0x0:_0x563ab4[_0x3222('0x16')];var _0x4e123a=_0x71e0ec?_0x47d95b['count']:_0x563ab4[_0x3222('0x16')]+_0x563ab4['limit'];var _0x4f35d0;if(_0x4e123a>=_0x3cd0ef){_0x4e123a=_0x3cd0ef;_0x4f35d0=0xc8;}else{_0x4f35d0=0xce;}_0x9a17e3['status'](_0x4f35d0);return _0x9a17e3[_0x3222('0x19')](_0x3222('0x1a'),_0x3be3e3+'-'+_0x4e123a+'/'+_0x3cd0ef)[_0x3222('0x1b')](_0x47d95b);}return null;};}function patchUpdates(_0x3e12ca){return function(_0x57ceea){try{jsonpatch[_0x3222('0x1c')](_0x57ceea,_0x3e12ca,!![]);}catch(_0x277bb8){return BPromise[_0x3222('0x1d')](_0x277bb8);}return _0x57ceea[_0x3222('0x1e')]();};}function saveUpdates(_0x131678,_0x3bbcde){return function(_0x56644f){if(_0x56644f){return _0x56644f[_0x3222('0x1f')](_0x131678)['then'](function(_0x10311a){return _0x10311a;});}return null;};}function removeEntity(_0x5d7499,_0x42073f){return function(_0x7b911d){if(_0x7b911d){return _0x7b911d[_0x3222('0x20')]()[_0x3222('0x21')](function(){_0x5d7499[_0x3222('0x15')](0xcc)[_0x3222('0x22')]();});}};}function handleEntityNotFound(_0x42da03,_0x63989b){return function(_0x3c59a7){if(!_0x3c59a7){_0x42da03[_0x3222('0x14')](0x194);}return _0x3c59a7;};}function handleError(_0x1b3fb6,_0xfeee0a){_0xfeee0a=_0xfeee0a||0x1f4;return function(_0xc28a3c){logger[_0x3222('0x23')](_0xc28a3c[_0x3222('0x24')]);if(_0xc28a3c['name']){delete _0xc28a3c[_0x3222('0x25')];}_0x1b3fb6[_0x3222('0x15')](_0xfeee0a)[_0x3222('0x26')](_0xc28a3c);};}exports['index']=function(_0x4888ad,_0x1a15c3){var _0x410cb1={},_0x33ec10={},_0x5b7cb1={'count':0x0,'rows':[]};var _0x4bef54=_[_0x3222('0x27')](db[_0x3222('0x28')][_0x3222('0x29')],function(_0x211363){return{'name':_0x211363[_0x3222('0x2a')],'type':_0x211363['type'][_0x3222('0x2b')]};});_0x33ec10[_0x3222('0x2c')]=_[_0x3222('0x27')](_0x4bef54,'name');_0x33ec10[_0x3222('0x2d')]=_[_0x3222('0x2e')](_0x4888ad[_0x3222('0x2d')]);_0x33ec10[_0x3222('0x2f')]=_['intersection'](_0x33ec10[_0x3222('0x2c')],_0x33ec10['query']);_0x410cb1['attributes']=_['intersection'](_0x33ec10['model'],qs[_0x3222('0x30')](_0x4888ad['query'][_0x3222('0x30')]));_0x410cb1[_0x3222('0x31')]=_0x410cb1[_0x3222('0x31')]['length']?_0x410cb1[_0x3222('0x31')]:_0x33ec10['model'];if(!_0x4888ad[_0x3222('0x2d')]['hasOwnProperty'](_0x3222('0x32'))){_0x410cb1['limit']=qs[_0x3222('0x33')](_0x4888ad['query']['limit']);_0x410cb1[_0x3222('0x16')]=qs[_0x3222('0x16')](_0x4888ad[_0x3222('0x2d')][_0x3222('0x16')]);}_0x410cb1['order']=qs[_0x3222('0x34')](_0x4888ad[_0x3222('0x2d')][_0x3222('0x34')]);_0x410cb1[_0x3222('0x35')]=qs['filters'](_[_0x3222('0x36')](_0x4888ad[_0x3222('0x2d')],_0x33ec10[_0x3222('0x2f')]),_0x4bef54);if(_0x4888ad[_0x3222('0x2d')][_0x3222('0x37')]){_0x410cb1[_0x3222('0x35')]=_[_0x3222('0x38')](_0x410cb1[_0x3222('0x35')],{'$or':_['map'](_0x4bef54,function(_0x523b7c){if(_0x523b7c[_0x3222('0x39')]!==_0x3222('0x3a')){var _0x4c1a4d={};_0x4c1a4d[_0x523b7c[_0x3222('0x25')]]={'$like':'%'+_0x4888ad[_0x3222('0x2d')][_0x3222('0x37')]+'%'};return _0x4c1a4d;}})});}_0x410cb1=_[_0x3222('0x38')]({},_0x410cb1,_0x4888ad[_0x3222('0x3b')]);var _0x4dcb9e={'where':_0x410cb1[_0x3222('0x35')]};return db['DeskConfiguration']['count'](_0x4dcb9e)[_0x3222('0x21')](function(_0x28e515){_0x5b7cb1['count']=_0x28e515;if(_0x4888ad['query'][_0x3222('0x3c')]){_0x410cb1[_0x3222('0x3d')]=[{'all':!![]}];}return db[_0x3222('0x28')][_0x3222('0x3e')](_0x410cb1);})['then'](function(_0xc4731b){_0x5b7cb1[_0x3222('0x3f')]=_0xc4731b;return _0x5b7cb1;})[_0x3222('0x21')](respondWithFilteredResult(_0x1a15c3,_0x410cb1))[_0x3222('0x40')](handleError(_0x1a15c3,null));};exports[_0x3222('0x41')]=function(_0x3a9065,_0xe93306){var _0x49d7ef={'raw':![],'where':{'id':_0x3a9065[_0x3222('0x42')]['id']}},_0x12bdef={};_0x12bdef[_0x3222('0x2c')]=_[_0x3222('0x2e')](db[_0x3222('0x28')]['rawAttributes']);_0x12bdef[_0x3222('0x2d')]=_[_0x3222('0x2e')](_0x3a9065[_0x3222('0x2d')]);_0x12bdef[_0x3222('0x2f')]=_['intersection'](_0x12bdef[_0x3222('0x2c')],_0x12bdef['query']);_0x49d7ef[_0x3222('0x31')]=_['intersection'](_0x12bdef[_0x3222('0x2c')],qs[_0x3222('0x30')](_0x3a9065[_0x3222('0x2d')][_0x3222('0x30')]));_0x49d7ef[_0x3222('0x31')]=_0x49d7ef['attributes'][_0x3222('0x43')]?_0x49d7ef[_0x3222('0x31')]:_0x12bdef['model'];if(_0x3a9065[_0x3222('0x2d')][_0x3222('0x3c')]){_0x49d7ef[_0x3222('0x3d')]=[{'all':!![]}];}_0x49d7ef=_[_0x3222('0x38')]({},_0x49d7ef,_0x3a9065[_0x3222('0x3b')]);return db['DeskConfiguration']['find'](_0x49d7ef)[_0x3222('0x21')](handleEntityNotFound(_0xe93306,null))[_0x3222('0x21')](respondWithResult(_0xe93306,null))[_0x3222('0x40')](handleError(_0xe93306,null));};exports[_0x3222('0x44')]=function(_0x4016f8,_0x2dcb1a){return db[_0x3222('0x28')]['create'](_0x4016f8['body'],{})[_0x3222('0x21')](respondWithResult(_0x2dcb1a,0xc9))['catch'](handleError(_0x2dcb1a,null));};exports['update']=function(_0x25f3e7,_0x36de88){if(_0x25f3e7[_0x3222('0x45')]['id']){delete _0x25f3e7['body']['id'];}return db[_0x3222('0x28')][_0x3222('0x46')]({'where':{'id':_0x25f3e7['params']['id']}})['then'](handleEntityNotFound(_0x36de88,null))['then'](saveUpdates(_0x25f3e7[_0x3222('0x45')],null))[_0x3222('0x21')](respondWithResult(_0x36de88,null))[_0x3222('0x40')](handleError(_0x36de88,null));};exports['destroy']=function(_0x12c47f,_0x59f4b6){return db[_0x3222('0x28')][_0x3222('0x46')]({'where':{'id':_0x12c47f[_0x3222('0x42')]['id']}})[_0x3222('0x21')](handleEntityNotFound(_0x59f4b6,null))['then'](removeEntity(_0x59f4b6,null))['catch'](handleError(_0x59f4b6,null));};exports[_0x3222('0x47')]=function(_0x117734,_0x1c8c31,_0x5dc3b6){var _0x12e4dd={};var _0x4bccbb={};var _0x4d78c8;var _0x23201a;return db[_0x3222('0x28')][_0x3222('0x48')]({'where':{'id':_0x117734[_0x3222('0x42')]['id']}})[_0x3222('0x21')](handleEntityNotFound(_0x1c8c31,null))[_0x3222('0x21')](function(_0x19300a){if(_0x19300a){_0x4d78c8=_0x19300a;_0x4bccbb[_0x3222('0x2c')]=_[_0x3222('0x2e')](db[_0x3222('0x49')]['rawAttributes']);_0x4bccbb[_0x3222('0x2d')]=_[_0x3222('0x2e')](_0x117734[_0x3222('0x2d')]);_0x4bccbb[_0x3222('0x2f')]=_[_0x3222('0x4a')](_0x4bccbb[_0x3222('0x2c')],_0x4bccbb[_0x3222('0x2d')]);_0x12e4dd[_0x3222('0x31')]=_[_0x3222('0x4a')](_0x4bccbb[_0x3222('0x2c')],qs[_0x3222('0x30')](_0x117734[_0x3222('0x2d')][_0x3222('0x30')]));_0x12e4dd['attributes']=_0x12e4dd[_0x3222('0x31')][_0x3222('0x43')]?_0x12e4dd[_0x3222('0x31')]:_0x4bccbb[_0x3222('0x2c')];_0x12e4dd[_0x3222('0x4b')]=qs[_0x3222('0x34')](_0x117734[_0x3222('0x2d')]['sort']);_0x12e4dd[_0x3222('0x35')]=qs[_0x3222('0x2f')](_[_0x3222('0x36')](_0x117734[_0x3222('0x2d')],_0x4bccbb[_0x3222('0x2f')]));if(_0x117734[_0x3222('0x2d')][_0x3222('0x37')]){_0x12e4dd['where']=_[_0x3222('0x38')](_0x12e4dd['where'],{'$or':_[_0x3222('0x27')](_0x12e4dd[_0x3222('0x31')],function(_0xdaa9d1){var _0x12e1c8={};_0x12e1c8[_0xdaa9d1]={'$like':'%'+_0x117734[_0x3222('0x2d')][_0x3222('0x37')]+'%'};return _0x12e1c8;})});}_0x12e4dd=_[_0x3222('0x38')]({},_0x12e4dd,_0x117734['options']);return _0x4d78c8[_0x3222('0x47')](_0x12e4dd);}})['then'](function(_0x326315){if(_0x326315){_0x23201a=_0x326315[_0x3222('0x43')];if(!_0x117734[_0x3222('0x2d')]['hasOwnProperty'](_0x3222('0x32'))){_0x12e4dd[_0x3222('0x33')]=qs[_0x3222('0x33')](_0x117734[_0x3222('0x2d')][_0x3222('0x33')]);_0x12e4dd[_0x3222('0x16')]=qs[_0x3222('0x16')](_0x117734[_0x3222('0x2d')][_0x3222('0x16')]);}return _0x4d78c8[_0x3222('0x47')](_0x12e4dd);}})[_0x3222('0x21')](function(_0x372108){if(_0x372108){return _0x372108?{'count':_0x23201a,'rows':_0x372108}:null;}})[_0x3222('0x21')](respondWithResult(_0x1c8c31,null))[_0x3222('0x40')](handleError(_0x1c8c31,null));};exports['getSubjects']=function(_0x383189,_0x28dc13,_0xc94e50){var _0x148a79={};var _0x4f3808={};var _0xb26089;var _0x31e82d;return db['DeskConfiguration']['findOne']({'where':{'id':_0x383189[_0x3222('0x42')]['id']}})[_0x3222('0x21')](handleEntityNotFound(_0x28dc13,null))[_0x3222('0x21')](function(_0x196d38){if(_0x196d38){_0xb26089=_0x196d38;_0x4f3808[_0x3222('0x2c')]=_['keys'](db[_0x3222('0x49')][_0x3222('0x29')]);_0x4f3808[_0x3222('0x2d')]=_[_0x3222('0x2e')](_0x383189['query']);_0x4f3808[_0x3222('0x2f')]=_[_0x3222('0x4a')](_0x4f3808[_0x3222('0x2c')],_0x4f3808[_0x3222('0x2d')]);_0x148a79[_0x3222('0x31')]=_['intersection'](_0x4f3808[_0x3222('0x2c')],qs[_0x3222('0x30')](_0x383189[_0x3222('0x2d')][_0x3222('0x30')]));_0x148a79[_0x3222('0x31')]=_0x148a79[_0x3222('0x31')]['length']?_0x148a79[_0x3222('0x31')]:_0x4f3808[_0x3222('0x2c')];_0x148a79[_0x3222('0x4b')]=qs[_0x3222('0x34')](_0x383189[_0x3222('0x2d')][_0x3222('0x34')]);_0x148a79[_0x3222('0x35')]=qs[_0x3222('0x2f')](_[_0x3222('0x36')](_0x383189[_0x3222('0x2d')],_0x4f3808['filters']));if(_0x383189[_0x3222('0x2d')][_0x3222('0x37')]){_0x148a79[_0x3222('0x35')]=_[_0x3222('0x38')](_0x148a79['where'],{'$or':_[_0x3222('0x27')](_0x148a79[_0x3222('0x31')],function(_0x4b8e82){var _0x4fb67f={};_0x4fb67f[_0x4b8e82]={'$like':'%'+_0x383189[_0x3222('0x2d')][_0x3222('0x37')]+'%'};return _0x4fb67f;})});}_0x148a79=_['merge']({},_0x148a79,_0x383189[_0x3222('0x3b')]);return _0xb26089[_0x3222('0x4c')](_0x148a79);}})[_0x3222('0x21')](function(_0x1d51eb){if(_0x1d51eb){_0x31e82d=_0x1d51eb[_0x3222('0x43')];if(!_0x383189[_0x3222('0x2d')]['hasOwnProperty']('nolimit')){_0x148a79[_0x3222('0x33')]=qs[_0x3222('0x33')](_0x383189[_0x3222('0x2d')]['limit']);_0x148a79[_0x3222('0x16')]=qs['offset'](_0x383189[_0x3222('0x2d')][_0x3222('0x16')]);}return _0xb26089[_0x3222('0x4c')](_0x148a79);}})[_0x3222('0x21')](function(_0x41a364){if(_0x41a364){return _0x41a364?{'count':_0x31e82d,'rows':_0x41a364}:null;}})[_0x3222('0x21')](respondWithResult(_0x28dc13,null))[_0x3222('0x40')](handleError(_0x28dc13,null));};exports[_0x3222('0x4d')]=function(_0x393478,_0x2ffb21,_0x5a8b11){var _0x1aedd7={};var _0x32261b={};var _0x4d4659;var _0x56775f;return db[_0x3222('0x28')][_0x3222('0x48')]({'where':{'id':_0x393478['params']['id']}})['then'](handleEntityNotFound(_0x2ffb21,null))[_0x3222('0x21')](function(_0x260400){if(_0x260400){_0x4d4659=_0x260400;_0x32261b[_0x3222('0x2c')]=_[_0x3222('0x2e')](db['DeskField'][_0x3222('0x29')]);_0x32261b[_0x3222('0x2d')]=_['keys'](_0x393478[_0x3222('0x2d')]);_0x32261b[_0x3222('0x2f')]=_[_0x3222('0x4a')](_0x32261b[_0x3222('0x2c')],_0x32261b[_0x3222('0x2d')]);_0x1aedd7['attributes']=_[_0x3222('0x4a')](_0x32261b[_0x3222('0x2c')],qs[_0x3222('0x30')](_0x393478[_0x3222('0x2d')][_0x3222('0x30')]));_0x1aedd7[_0x3222('0x31')]=_0x1aedd7[_0x3222('0x31')][_0x3222('0x43')]?_0x1aedd7[_0x3222('0x31')]:_0x32261b['model'];_0x1aedd7['order']=qs[_0x3222('0x34')](_0x393478[_0x3222('0x2d')][_0x3222('0x34')]);_0x1aedd7['where']=qs['filters'](_[_0x3222('0x36')](_0x393478[_0x3222('0x2d')],_0x32261b[_0x3222('0x2f')]));if(_0x393478[_0x3222('0x2d')][_0x3222('0x37')]){_0x1aedd7[_0x3222('0x35')]=_[_0x3222('0x38')](_0x1aedd7[_0x3222('0x35')],{'$or':_['map'](_0x1aedd7[_0x3222('0x31')],function(_0x14ee4a){var _0x5b77c2={};_0x5b77c2[_0x14ee4a]={'$like':'%'+_0x393478[_0x3222('0x2d')]['filter']+'%'};return _0x5b77c2;})});}_0x1aedd7=_[_0x3222('0x38')]({},_0x1aedd7,_0x393478[_0x3222('0x3b')]);return _0x4d4659[_0x3222('0x4d')](_0x1aedd7);}})[_0x3222('0x21')](function(_0x234668){if(_0x234668){_0x56775f=_0x234668['length'];if(!_0x393478['query'][_0x3222('0x4e')]('nolimit')){_0x1aedd7['limit']=qs[_0x3222('0x33')](_0x393478[_0x3222('0x2d')][_0x3222('0x33')]);_0x1aedd7[_0x3222('0x16')]=qs[_0x3222('0x16')](_0x393478[_0x3222('0x2d')][_0x3222('0x16')]);}return _0x4d4659[_0x3222('0x4d')](_0x1aedd7);}})[_0x3222('0x21')](function(_0x3a796d){if(_0x3a796d){return _0x3a796d?{'count':_0x56775f,'rows':_0x3a796d}:null;}})['then'](respondWithResult(_0x2ffb21,null))[_0x3222('0x40')](handleError(_0x2ffb21,null));};exports[_0x3222('0x4f')]=function(_0x2b0b09,_0x4aa136,_0x1e78e5){var _0x3330e8={};var _0x2a7a90={};var _0x3f26d2;var _0x4b12c1;return db[_0x3222('0x28')][_0x3222('0x48')]({'where':{'id':_0x2b0b09[_0x3222('0x42')]['id']}})['then'](handleEntityNotFound(_0x4aa136,null))[_0x3222('0x21')](function(_0x28bdc4){if(_0x28bdc4){_0x3f26d2=_0x28bdc4;_0x2a7a90[_0x3222('0x2c')]=_[_0x3222('0x2e')](db[_0x3222('0x50')][_0x3222('0x29')]);_0x2a7a90[_0x3222('0x2d')]=_[_0x3222('0x2e')](_0x2b0b09[_0x3222('0x2d')]);_0x2a7a90[_0x3222('0x2f')]=_[_0x3222('0x4a')](_0x2a7a90[_0x3222('0x2c')],_0x2a7a90[_0x3222('0x2d')]);_0x3330e8[_0x3222('0x31')]=_[_0x3222('0x4a')](_0x2a7a90[_0x3222('0x2c')],qs[_0x3222('0x30')](_0x2b0b09[_0x3222('0x2d')]['fields']));_0x3330e8[_0x3222('0x31')]=_0x3330e8[_0x3222('0x31')][_0x3222('0x43')]?_0x3330e8[_0x3222('0x31')]:_0x2a7a90['model'];_0x3330e8[_0x3222('0x4b')]=qs[_0x3222('0x34')](_0x2b0b09[_0x3222('0x2d')][_0x3222('0x34')]);_0x3330e8[_0x3222('0x35')]=qs[_0x3222('0x2f')](_['pick'](_0x2b0b09[_0x3222('0x2d')],_0x2a7a90[_0x3222('0x2f')]));if(_0x2b0b09[_0x3222('0x2d')][_0x3222('0x37')]){_0x3330e8[_0x3222('0x35')]=_[_0x3222('0x38')](_0x3330e8[_0x3222('0x35')],{'$or':_[_0x3222('0x27')](_0x3330e8[_0x3222('0x31')],function(_0x327934){var _0x1755b8={};_0x1755b8[_0x327934]={'$like':'%'+_0x2b0b09[_0x3222('0x2d')][_0x3222('0x37')]+'%'};return _0x1755b8;})});}_0x3330e8=_[_0x3222('0x38')]({},_0x3330e8,_0x2b0b09['options']);return _0x3f26d2[_0x3222('0x4f')](_0x3330e8);}})[_0x3222('0x21')](function(_0x19b203){if(_0x19b203){_0x4b12c1=_0x19b203[_0x3222('0x43')];if(!_0x2b0b09['query']['hasOwnProperty']('nolimit')){_0x3330e8[_0x3222('0x33')]=qs['limit'](_0x2b0b09['query'][_0x3222('0x33')]);_0x3330e8['offset']=qs['offset'](_0x2b0b09[_0x3222('0x2d')][_0x3222('0x16')]);}return _0x3f26d2[_0x3222('0x4f')](_0x3330e8);}})[_0x3222('0x21')](function(_0x27bfee){if(_0x27bfee){return _0x27bfee?{'count':_0x4b12c1,'rows':_0x27bfee}:null;}})[_0x3222('0x21')](respondWithResult(_0x4aa136,null))['catch'](handleError(_0x4aa136,null));};exports[_0x3222('0x51')]=function(_0x519b08,_0x208e32,_0x27c19d){if(_0x519b08[_0x3222('0x45')]['id']){delete _0x519b08[_0x3222('0x45')]['id'];}return db[_0x3222('0x28')][_0x3222('0x48')]({'where':{'id':_0x519b08[_0x3222('0x42')]['id']}})[_0x3222('0x21')](handleEntityNotFound(_0x208e32,null))[_0x3222('0x21')](function(_0x2a0140){if(_0x2a0140){return _0x2a0140['setTags'](_0x519b08[_0x3222('0x45')][_0x3222('0x52')]||[]);}return null;})[_0x3222('0x21')](respondWithResult(_0x208e32,null))['catch'](handleError(_0x208e32,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 99f3db3..1a62ce3 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 _0x6eb8=['path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','request-promise'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x6eb8,0xeb));var _0x86eb=function(_0xa0bb9f,_0x1847a9){_0xa0bb9f=_0xa0bb9f-0x0;var _0x16f5de=_0x6eb8[_0xa0bb9f];return _0x16f5de;};'use strict';var _=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var logger=require('../../config/logger')(_0x86eb('0x2'));var moment=require(_0x86eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x86eb('0x4'));var fs=require('fs');var path=require(_0x86eb('0x5'));var rimraf=require(_0x86eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x86eb('0x7'));module[_0x86eb('0x8')]=function(_0x14c782,_0x16fc61){return _0x14c782[_0x86eb('0x9')](_0x86eb('0xa'),attributes,{'tableName':_0x86eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5949=['define','DeskConfiguration','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x4d9d54,_0x1b9bcf){var _0x489b1b=function(_0x50bf0c){while(--_0x50bf0c){_0x4d9d54['push'](_0x4d9d54['shift']());}};_0x489b1b(++_0x1b9bcf);}(_0x5949,0xb6));var _0x9594=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x5949[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x9594('0x0'));var util=require(_0x9594('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9594('0x2'));var BPromise=require(_0x9594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9594('0x4'));var rimraf=require(_0x9594('0x5'));var config=require(_0x9594('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x9594('0x7')]=function(_0xd7fb60,_0x296ddd){return _0xd7fb60[_0x9594('0x8')](_0x9594('0x9'),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 9231105..d3758c4 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 _0x6efe=['error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f601c,_0x5a94a2){var _0x50a269=function(_0x1c4680){while(--_0x1c4680){_0x2f601c['push'](_0x2f601c['shift']());}};_0x50a269(++_0x5a94a2);}(_0x6efe,0xc6));var _0xe6ef=function(_0x2ac8ab,_0x2e475b){_0x2ac8ab=_0x2ac8ab-0x0;var _0x4ebb15=_0x6efe[_0x2ac8ab];return _0x4ebb15;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var moment=require(_0xe6ef('0x2'));var BPromise=require(_0xe6ef('0x3'));var rs=require(_0xe6ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6ef('0x5'));var logger=require(_0xe6ef('0x6'))(_0xe6ef('0x7'));var config=require(_0xe6ef('0x8'));var jayson=require(_0xe6ef('0x9'));var client=jayson['client'][_0xe6ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422e13,_0x599b6c,_0x4a4bb9){return new BPromise(function(_0x51a9eb,_0x3256ff){return client[_0xe6ef('0xb')](_0x422e13,_0x4a4bb9)[_0xe6ef('0xc')](function(_0x4fca2f){logger[_0xe6ef('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x599b6c,_0xe6ef('0xe'));logger[_0xe6ef('0xf')](_0xe6ef('0x10'),_0x599b6c,_0xe6ef('0xe'),JSON[_0xe6ef('0x11')](_0x4fca2f));if(_0x4fca2f[_0xe6ef('0x12')]){if(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x13')]===0x1f4){logger['error'](_0xe6ef('0x14'),_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x3256ff(_0x4fca2f[_0xe6ef('0x12')]['message']);}logger[_0xe6ef('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x51a9eb(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);}else{logger[_0xe6ef('0xd')](_0xe6ef('0x14'),_0x599b6c,_0xe6ef('0xe'));_0x51a9eb(_0x4fca2f[_0xe6ef('0x16')][_0xe6ef('0x15')]);}})[_0xe6ef('0x17')](function(_0x5c32cc){logger[_0xe6ef('0x12')](_0xe6ef('0x14'),_0x599b6c,_0x5c32cc);_0x3256ff(_0x5c32cc);});});} \ No newline at end of file +var _0xe9f2=['request\x20sent','debug','error','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2849d3,_0x558165){var _0x39ace3=function(_0x33c311){while(--_0x33c311){_0x2849d3['push'](_0x2849d3['shift']());}};_0x39ace3(++_0x558165);}(_0xe9f2,0xba));var _0x2e9f=function(_0x46f2e7,_0x17a58f){_0x46f2e7=_0x46f2e7-0x0;var _0x3ad4e7=_0xe9f2[_0x46f2e7];return _0x3ad4e7;};'use strict';var _=require(_0x2e9f('0x0'));var util=require(_0x2e9f('0x1'));var moment=require(_0x2e9f('0x2'));var BPromise=require(_0x2e9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9f('0x4'));var db=require(_0x2e9f('0x5'))['db'];var utils=require(_0x2e9f('0x6'));var logger=require(_0x2e9f('0x7'))('rpc');var config=require(_0x2e9f('0x8'));var jayson=require(_0x2e9f('0x9'));var client=jayson[_0x2e9f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ba82,_0x3264c8,_0x52f89e){return new BPromise(function(_0x545d7c,_0x2727d2){return client[_0x2e9f('0xb')](_0x20ba82,_0x52f89e)[_0x2e9f('0xc')](function(_0x5f3c66){logger[_0x2e9f('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'));logger[_0x2e9f('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3264c8,_0x2e9f('0xe'),JSON['stringify'](_0x5f3c66));if(_0x5f3c66[_0x2e9f('0x10')]){if(_0x5f3c66[_0x2e9f('0x10')]['code']===0x1f4){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);return _0x2727d2(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x5f3c66['error']['message']);return _0x545d7c(_0x5f3c66[_0x2e9f('0x10')][_0x2e9f('0x12')]);}else{logger[_0x2e9f('0xd')](_0x2e9f('0x11'),_0x3264c8,_0x2e9f('0xe'));_0x545d7c(_0x5f3c66[_0x2e9f('0x13')][_0x2e9f('0x12')]);}})['catch'](function(_0x4969f6){logger[_0x2e9f('0x10')](_0x2e9f('0x11'),_0x3264c8,_0x4969f6);_0x2727d2(_0x4969f6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3274f78..c76323c 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 _0x2358=['put','/:id','update','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','show','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2358,0x1e0));var _0x8235=function(_0x4f8817,_0x1c4a89){_0x4f8817=_0x4f8817-0x0;var _0xabcabc=_0x2358[_0x4f8817];return _0xabcabc;};'use strict';var multer=require('multer');var util=require(_0x8235('0x0'));var path=require('path');var timeout=require(_0x8235('0x1'));var express=require('express');var router=express[_0x8235('0x2')]();var fs_extra=require(_0x8235('0x3'));var auth=require(_0x8235('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x8235('0x5')]('/',auth[_0x8235('0x6')](),controller['index']);router[_0x8235('0x5')]('/:id',auth[_0x8235('0x6')](),controller[_0x8235('0x7')]);router[_0x8235('0x8')]('/',auth[_0x8235('0x6')](),controller[_0x8235('0x9')]);router[_0x8235('0xa')](_0x8235('0xb'),auth[_0x8235('0x6')](),controller[_0x8235('0xc')]);router['delete'](_0x8235('0xb'),auth[_0x8235('0x6')](),controller['destroy']);module[_0x8235('0xd')]=router; \ No newline at end of file +var _0x92af=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','create','/:id','update','delete','multer','util'];(function(_0x5f08fd,_0x28036c){var _0x2cab24=function(_0x3619e8){while(--_0x3619e8){_0x5f08fd['push'](_0x5f08fd['shift']());}};_0x2cab24(++_0x28036c);}(_0x92af,0xee));var _0xf92a=function(_0x278850,_0x578b1d){_0x278850=_0x278850-0x0;var _0x324fea=_0x92af[_0x278850];return _0x324fea;};'use strict';var multer=require(_0xf92a('0x0'));var util=require(_0xf92a('0x1'));var path=require(_0xf92a('0x2'));var timeout=require(_0xf92a('0x3'));var express=require(_0xf92a('0x4'));var router=express[_0xf92a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf92a('0x6'));var interaction=require(_0xf92a('0x7'));var config=require(_0xf92a('0x8'));var controller=require(_0xf92a('0x9'));router[_0xf92a('0xa')]('/',auth[_0xf92a('0xb')](),controller['index']);router[_0xf92a('0xa')]('/:id',auth[_0xf92a('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf92a('0xc')]);router['put'](_0xf92a('0xd'),auth[_0xf92a('0xb')](),controller[_0xf92a('0xe')]);router[_0xf92a('0xf')](_0xf92a('0xd'),auth[_0xf92a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a0ecd8f..ddc3b67 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 _0xfc3b=['ENUM','variable','keyValue','picklist','STRING','string','customVariable','sequelize','exports'];(function(_0x4aba82,_0x4aa935){var _0x352b59=function(_0x48588c){while(--_0x48588c){_0x4aba82['push'](_0x4aba82['shift']());}};_0x352b59(++_0x4aa935);}(_0xfc3b,0x154));var _0xbfc3=function(_0x34cea1,_0x16d860){_0x34cea1=_0x34cea1-0x0;var _0x2d796a=_0xfc3b[_0x34cea1];return _0x2d796a;};'use strict';var Sequelize=require(_0xbfc3('0x0'));module[_0xbfc3('0x1')]={'type':{'type':Sequelize[_0xbfc3('0x2')]('string',_0xbfc3('0x3'),'customVariable',_0xbfc3('0x4'),_0xbfc3('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbfc3('0x6')]},'keyType':{'type':Sequelize[_0xbfc3('0x2')](_0xbfc3('0x7'),_0xbfc3('0x3'),_0xbfc3('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbfc3('0x6')]}}; \ No newline at end of file +var _0x2f1c=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x2f1c,0xe7));var _0xc2f1=function(_0x51edca,_0x18ad70){_0x51edca=_0x51edca-0x0;var _0x2b77ec=_0x2f1c[_0x51edca];return _0x2b77ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc2f1('0x0')](_0xc2f1('0x1'),_0xc2f1('0x2'),_0xc2f1('0x3'),_0xc2f1('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc2f1('0x5')]},'key':{'type':Sequelize[_0xc2f1('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xc2f1('0x2'),_0xc2f1('0x3'))},'keyContent':{'type':Sequelize[_0xc2f1('0x5')]},'idField':{'type':Sequelize[_0xc2f1('0x5')]},'nameField':{'type':Sequelize[_0xc2f1('0x5')]},'customField':{'type':Sequelize[_0xc2f1('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc2f1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b7455bb..079d748 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 _0x43ef=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','DeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x43ef,0x19a));var _0xf43e=function(_0x45e021,_0x302938){_0x45e021=_0x45e021-0x0;var _0x2fa161=_0x43ef[_0x45e021];return _0x2fa161;};'use strict';var emlformat=require(_0xf43e('0x0'));var rimraf=require(_0xf43e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf43e('0x2'));var rp=require(_0xf43e('0x3'));var moment=require(_0xf43e('0x4'));var BPromise=require(_0xf43e('0x5'));var Mustache=require(_0xf43e('0x6'));var util=require('util');var path=require(_0xf43e('0x7'));var sox=require('sox');var csv=require(_0xf43e('0x8'));var ejs=require(_0xf43e('0x9'));var fs=require('fs');var fs_extra=require(_0xf43e('0xa'));var _=require(_0xf43e('0xb'));var squel=require('squel');var crypto=require(_0xf43e('0xc'));var jsforce=require(_0xf43e('0xd'));var deskjs=require(_0xf43e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf43e('0xf'));var Papa=require(_0xf43e('0x10'));var Redis=require('ioredis');var authService=require(_0xf43e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf43e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf43e('0x13'))(_0xf43e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf43e('0x15'));var db=require(_0xf43e('0x16'))['db'];function respondWithStatusCode(_0x2b89e4,_0x2b1ac5){_0x2b1ac5=_0x2b1ac5||0xcc;return function(_0x9913cd){if(_0x9913cd){return _0x2b89e4[_0xf43e('0x17')](_0x2b1ac5);}return _0x2b89e4[_0xf43e('0x18')](_0x2b1ac5)[_0xf43e('0x19')]();};}function respondWithResult(_0x536b79,_0x5d5f97){_0x5d5f97=_0x5d5f97||0xc8;return function(_0x44ffa3){if(_0x44ffa3){return _0x536b79[_0xf43e('0x18')](_0x5d5f97)[_0xf43e('0x1a')](_0x44ffa3);}};}function respondWithFilteredResult(_0x164158,_0x4d370a){return function(_0x35292e){if(_0x35292e){var _0x4fcb8e=typeof _0x4d370a[_0xf43e('0x1b')]===_0xf43e('0x1c')&&typeof _0x4d370a[_0xf43e('0x1d')]==='undefined';var _0x3c7b6c=_0x35292e[_0xf43e('0x1e')];var _0x5b4da4=_0x4fcb8e?0x0:_0x4d370a['offset'];var _0x1be441=_0x4fcb8e?_0x35292e[_0xf43e('0x1e')]:_0x4d370a[_0xf43e('0x1b')]+_0x4d370a[_0xf43e('0x1d')];var _0x5904d9;if(_0x1be441>=_0x3c7b6c){_0x1be441=_0x3c7b6c;_0x5904d9=0xc8;}else{_0x5904d9=0xce;}_0x164158[_0xf43e('0x18')](_0x5904d9);return _0x164158['set']('Content-Range',_0x5b4da4+'-'+_0x1be441+'/'+_0x3c7b6c)[_0xf43e('0x1a')](_0x35292e);}return null;};}function patchUpdates(_0x582d06){return function(_0xc40faa){try{jsonpatch[_0xf43e('0x1f')](_0xc40faa,_0x582d06,!![]);}catch(_0x5d8102){return BPromise[_0xf43e('0x20')](_0x5d8102);}return _0xc40faa[_0xf43e('0x21')]();};}function saveUpdates(_0x2dc84f,_0x525746){return function(_0xa412d7){if(_0xa412d7){return _0xa412d7['update'](_0x2dc84f)[_0xf43e('0x22')](function(_0x5e63a5){return _0x5e63a5;});}return null;};}function removeEntity(_0x4175d1,_0x20ca07){return function(_0x1a8b58){if(_0x1a8b58){return _0x1a8b58[_0xf43e('0x23')]()['then'](function(){_0x4175d1[_0xf43e('0x18')](0xcc)[_0xf43e('0x19')]();});}};}function handleEntityNotFound(_0x30e87f,_0x2451cd){return function(_0x21ed8d){if(!_0x21ed8d){_0x30e87f[_0xf43e('0x17')](0x194);}return _0x21ed8d;};}function handleError(_0x419ae4,_0x59227c){_0x59227c=_0x59227c||0x1f4;return function(_0x35ea56){logger['error'](_0x35ea56[_0xf43e('0x24')]);if(_0x35ea56[_0xf43e('0x25')]){delete _0x35ea56['name'];}_0x419ae4[_0xf43e('0x18')](_0x59227c)[_0xf43e('0x26')](_0x35ea56);};}exports[_0xf43e('0x27')]=function(_0x22ffcc,_0x229e7e){var _0x3aebdd={},_0x17381f={},_0x3a909e={'count':0x0,'rows':[]};var _0x57ac92=_['map'](db[_0xf43e('0x28')][_0xf43e('0x29')],function(_0x2e0c2a){return{'name':_0x2e0c2a['fieldName'],'type':_0x2e0c2a[_0xf43e('0x2a')][_0xf43e('0x2b')]};});_0x17381f[_0xf43e('0x2c')]=_[_0xf43e('0x2d')](_0x57ac92,_0xf43e('0x25'));_0x17381f[_0xf43e('0x2e')]=_[_0xf43e('0x2f')](_0x22ffcc[_0xf43e('0x2e')]);_0x17381f[_0xf43e('0x30')]=_[_0xf43e('0x31')](_0x17381f[_0xf43e('0x2c')],_0x17381f[_0xf43e('0x2e')]);_0x3aebdd['attributes']=_[_0xf43e('0x31')](_0x17381f['model'],qs['fields'](_0x22ffcc[_0xf43e('0x2e')][_0xf43e('0x32')]));_0x3aebdd[_0xf43e('0x33')]=_0x3aebdd[_0xf43e('0x33')]['length']?_0x3aebdd[_0xf43e('0x33')]:_0x17381f[_0xf43e('0x2c')];if(!_0x22ffcc['query'][_0xf43e('0x34')](_0xf43e('0x35'))){_0x3aebdd[_0xf43e('0x1d')]=qs[_0xf43e('0x1d')](_0x22ffcc[_0xf43e('0x2e')]['limit']);_0x3aebdd['offset']=qs[_0xf43e('0x1b')](_0x22ffcc[_0xf43e('0x2e')][_0xf43e('0x1b')]);}_0x3aebdd[_0xf43e('0x36')]=qs[_0xf43e('0x37')](_0x22ffcc[_0xf43e('0x2e')][_0xf43e('0x37')]);_0x3aebdd[_0xf43e('0x38')]=qs[_0xf43e('0x30')](_[_0xf43e('0x39')](_0x22ffcc[_0xf43e('0x2e')],_0x17381f[_0xf43e('0x30')]),_0x57ac92);if(_0x22ffcc[_0xf43e('0x2e')]['filter']){_0x3aebdd[_0xf43e('0x38')]=_[_0xf43e('0x3a')](_0x3aebdd['where'],{'$or':_['map'](_0x57ac92,function(_0x4c76f1){if(_0x4c76f1['type']!==_0xf43e('0x3b')){var _0x232b5a={};_0x232b5a[_0x4c76f1[_0xf43e('0x25')]]={'$like':'%'+_0x22ffcc[_0xf43e('0x2e')]['filter']+'%'};return _0x232b5a;}})});}_0x3aebdd=_[_0xf43e('0x3a')]({},_0x3aebdd,_0x22ffcc[_0xf43e('0x3c')]);var _0x2d0fd1={'where':_0x3aebdd[_0xf43e('0x38')]};return db[_0xf43e('0x28')][_0xf43e('0x1e')](_0x2d0fd1)[_0xf43e('0x22')](function(_0x456da4){_0x3a909e['count']=_0x456da4;if(_0x22ffcc[_0xf43e('0x2e')]['includeAll']){_0x3aebdd[_0xf43e('0x3d')]=[{'all':!![]}];}return db['DeskField'][_0xf43e('0x3e')](_0x3aebdd);})['then'](function(_0x32f27b){_0x3a909e['rows']=_0x32f27b;return _0x3a909e;})[_0xf43e('0x22')](respondWithFilteredResult(_0x229e7e,_0x3aebdd))['catch'](handleError(_0x229e7e,null));};exports[_0xf43e('0x3f')]=function(_0x59fc0c,_0x2005d3){var _0x520dfe={'raw':!![],'where':{'id':_0x59fc0c[_0xf43e('0x40')]['id']}},_0x5a57bc={};_0x5a57bc[_0xf43e('0x2c')]=_[_0xf43e('0x2f')](db[_0xf43e('0x28')]['rawAttributes']);_0x5a57bc[_0xf43e('0x2e')]=_[_0xf43e('0x2f')](_0x59fc0c[_0xf43e('0x2e')]);_0x5a57bc[_0xf43e('0x30')]=_[_0xf43e('0x31')](_0x5a57bc[_0xf43e('0x2c')],_0x5a57bc['query']);_0x520dfe['attributes']=_[_0xf43e('0x31')](_0x5a57bc[_0xf43e('0x2c')],qs[_0xf43e('0x32')](_0x59fc0c[_0xf43e('0x2e')][_0xf43e('0x32')]));_0x520dfe[_0xf43e('0x33')]=_0x520dfe[_0xf43e('0x33')]['length']?_0x520dfe[_0xf43e('0x33')]:_0x5a57bc['model'];if(_0x59fc0c[_0xf43e('0x2e')][_0xf43e('0x41')]){_0x520dfe[_0xf43e('0x3d')]=[{'all':!![]}];}_0x520dfe=_[_0xf43e('0x3a')]({},_0x520dfe,_0x59fc0c[_0xf43e('0x3c')]);return db[_0xf43e('0x28')][_0xf43e('0x42')](_0x520dfe)['then'](handleEntityNotFound(_0x2005d3,null))[_0xf43e('0x22')](respondWithResult(_0x2005d3,null))[_0xf43e('0x43')](handleError(_0x2005d3,null));};exports[_0xf43e('0x44')]=function(_0x563c00,_0x2b4564){return db[_0xf43e('0x28')]['create'](_0x563c00[_0xf43e('0x45')],{})[_0xf43e('0x22')](respondWithResult(_0x2b4564,0xc9))[_0xf43e('0x43')](handleError(_0x2b4564,null));};exports[_0xf43e('0x46')]=function(_0x2af0ed,_0x5160e0){if(_0x2af0ed['body']['id']){delete _0x2af0ed[_0xf43e('0x45')]['id'];}return db['DeskField'][_0xf43e('0x42')]({'where':{'id':_0x2af0ed[_0xf43e('0x40')]['id']}})[_0xf43e('0x22')](handleEntityNotFound(_0x5160e0,null))[_0xf43e('0x22')](saveUpdates(_0x2af0ed[_0xf43e('0x45')],null))[_0xf43e('0x22')](respondWithResult(_0x5160e0,null))[_0xf43e('0x43')](handleError(_0x5160e0,null));};exports[_0xf43e('0x23')]=function(_0x573831,_0x32baf3){return db[_0xf43e('0x28')]['find']({'where':{'id':_0x573831['params']['id']}})[_0xf43e('0x22')](handleEntityNotFound(_0x32baf3,null))['then'](removeEntity(_0x32baf3,null))[_0xf43e('0x43')](handleError(_0x32baf3,null));}; \ No newline at end of file +var _0x1d7e=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','keys','options','create','update','body','find','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x3aa8cb,_0x2deff2){var _0x5e4114=function(_0xc72fee){while(--_0xc72fee){_0x3aa8cb['push'](_0x3aa8cb['shift']());}};_0x5e4114(++_0x2deff2);}(_0x1d7e,0x7d));var _0xe1d7=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1d7e[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];function respondWithStatusCode(_0x207502,_0x455a7a){_0x455a7a=_0x455a7a||0xcc;return function(_0x445994){if(_0x445994){return _0x207502[_0xe1d7('0x17')](_0x455a7a);}return _0x207502['status'](_0x455a7a)[_0xe1d7('0x18')]();};}function respondWithResult(_0x247286,_0x156a3f){_0x156a3f=_0x156a3f||0xc8;return function(_0x3d3d8d){if(_0x3d3d8d){return _0x247286[_0xe1d7('0x19')](_0x156a3f)[_0xe1d7('0x1a')](_0x3d3d8d);}};}function respondWithFilteredResult(_0x3c1923,_0x565278){return function(_0x391f55){if(_0x391f55){var _0x328898=typeof _0x565278[_0xe1d7('0x1b')]==='undefined'&&typeof _0x565278[_0xe1d7('0x1c')]===_0xe1d7('0x1d');var _0x800c15=_0x391f55[_0xe1d7('0x1e')];var _0x1dc61f=_0x328898?0x0:_0x565278[_0xe1d7('0x1b')];var _0xdad949=_0x328898?_0x391f55[_0xe1d7('0x1e')]:_0x565278[_0xe1d7('0x1b')]+_0x565278[_0xe1d7('0x1c')];var _0x2035e7;if(_0xdad949>=_0x800c15){_0xdad949=_0x800c15;_0x2035e7=0xc8;}else{_0x2035e7=0xce;}_0x3c1923[_0xe1d7('0x19')](_0x2035e7);return _0x3c1923['set'](_0xe1d7('0x1f'),_0x1dc61f+'-'+_0xdad949+'/'+_0x800c15)[_0xe1d7('0x1a')](_0x391f55);}return null;};}function patchUpdates(_0x1e9a1e){return function(_0x3e25e8){try{jsonpatch[_0xe1d7('0x20')](_0x3e25e8,_0x1e9a1e,!![]);}catch(_0x5f2053){return BPromise[_0xe1d7('0x21')](_0x5f2053);}return _0x3e25e8[_0xe1d7('0x22')]();};}function saveUpdates(_0x111e52,_0x13867a){return function(_0x33ac20){if(_0x33ac20){return _0x33ac20['update'](_0x111e52)[_0xe1d7('0x23')](function(_0x370c92){return _0x370c92;});}return null;};}function removeEntity(_0x2572ec,_0x3bc5c1){return function(_0x25e3c9){if(_0x25e3c9){return _0x25e3c9[_0xe1d7('0x24')]()[_0xe1d7('0x23')](function(){_0x2572ec[_0xe1d7('0x19')](0xcc)[_0xe1d7('0x18')]();});}};}function handleEntityNotFound(_0x2e47f7,_0x55446d){return function(_0x672bed){if(!_0x672bed){_0x2e47f7[_0xe1d7('0x17')](0x194);}return _0x672bed;};}function handleError(_0x3abcb3,_0x4fea12){_0x4fea12=_0x4fea12||0x1f4;return function(_0x11dde2){logger[_0xe1d7('0x25')](_0x11dde2[_0xe1d7('0x26')]);if(_0x11dde2[_0xe1d7('0x27')]){delete _0x11dde2[_0xe1d7('0x27')];}_0x3abcb3[_0xe1d7('0x19')](_0x4fea12)[_0xe1d7('0x28')](_0x11dde2);};}exports['index']=function(_0x3e8ca3,_0x4a3344){var _0xbc38f3={},_0x264481={},_0x48d17e={'count':0x0,'rows':[]};var _0x565f3a=_[_0xe1d7('0x29')](db[_0xe1d7('0x2a')][_0xe1d7('0x2b')],function(_0x329506){return{'name':_0x329506[_0xe1d7('0x2c')],'type':_0x329506['type'][_0xe1d7('0x2d')]};});_0x264481[_0xe1d7('0x2e')]=_[_0xe1d7('0x29')](_0x565f3a,_0xe1d7('0x27'));_0x264481[_0xe1d7('0x2f')]=_['keys'](_0x3e8ca3[_0xe1d7('0x2f')]);_0x264481[_0xe1d7('0x30')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],_0x264481[_0xe1d7('0x2f')]);_0xbc38f3[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],qs['fields'](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0xbc38f3[_0xe1d7('0x32')]=_0xbc38f3['attributes'][_0xe1d7('0x34')]?_0xbc38f3[_0xe1d7('0x32')]:_0x264481[_0xe1d7('0x2e')];if(!_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x35')](_0xe1d7('0x36'))){_0xbc38f3['limit']=qs[_0xe1d7('0x1c')](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0xbc38f3[_0xe1d7('0x1b')]=qs[_0xe1d7('0x1b')](_0x3e8ca3[_0xe1d7('0x2f')]['offset']);}_0xbc38f3[_0xe1d7('0x37')]=qs[_0xe1d7('0x38')](_0x3e8ca3[_0xe1d7('0x2f')]['sort']);_0xbc38f3[_0xe1d7('0x39')]=qs[_0xe1d7('0x30')](_[_0xe1d7('0x3a')](_0x3e8ca3['query'],_0x264481[_0xe1d7('0x30')]),_0x565f3a);if(_0x3e8ca3['query'][_0xe1d7('0x3b')]){_0xbc38f3[_0xe1d7('0x39')]=_['merge'](_0xbc38f3[_0xe1d7('0x39')],{'$or':_[_0xe1d7('0x29')](_0x565f3a,function(_0x412688){if(_0x412688['type']!==_0xe1d7('0x3c')){var _0xcf5b78={};_0xcf5b78[_0x412688['name']]={'$like':'%'+_0x3e8ca3[_0xe1d7('0x2f')]['filter']+'%'};return _0xcf5b78;}})});}_0xbc38f3=_[_0xe1d7('0x3d')]({},_0xbc38f3,_0x3e8ca3['options']);var _0x637d0e={'where':_0xbc38f3[_0xe1d7('0x39')]};return db[_0xe1d7('0x2a')][_0xe1d7('0x1e')](_0x637d0e)[_0xe1d7('0x23')](function(_0x285cc8){_0x48d17e[_0xe1d7('0x1e')]=_0x285cc8;if(_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0xbc38f3['include']=[{'all':!![]}];}return db[_0xe1d7('0x2a')]['findAll'](_0xbc38f3);})[_0xe1d7('0x23')](function(_0xf92029){_0x48d17e[_0xe1d7('0x3f')]=_0xf92029;return _0x48d17e;})[_0xe1d7('0x23')](respondWithFilteredResult(_0x4a3344,_0xbc38f3))[_0xe1d7('0x40')](handleError(_0x4a3344,null));};exports[_0xe1d7('0x41')]=function(_0x12eeb1,_0x5c9bb3){var _0x26d1b0={'raw':!![],'where':{'id':_0x12eeb1[_0xe1d7('0x42')]['id']}},_0x2841ce={};_0x2841ce[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db[_0xe1d7('0x2a')]['rawAttributes']);_0x2841ce[_0xe1d7('0x2f')]=_[_0xe1d7('0x43')](_0x12eeb1[_0xe1d7('0x2f')]);_0x2841ce['filters']=_[_0xe1d7('0x31')](_0x2841ce[_0xe1d7('0x2e')],_0x2841ce[_0xe1d7('0x2f')]);_0x26d1b0[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x2841ce['model'],qs[_0xe1d7('0x33')](_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x26d1b0[_0xe1d7('0x32')]=_0x26d1b0[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x26d1b0[_0xe1d7('0x32')]:_0x2841ce[_0xe1d7('0x2e')];if(_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0x26d1b0['include']=[{'all':!![]}];}_0x26d1b0=_[_0xe1d7('0x3d')]({},_0x26d1b0,_0x12eeb1[_0xe1d7('0x44')]);return db[_0xe1d7('0x2a')]['find'](_0x26d1b0)['then'](handleEntityNotFound(_0x5c9bb3,null))[_0xe1d7('0x23')](respondWithResult(_0x5c9bb3,null))[_0xe1d7('0x40')](handleError(_0x5c9bb3,null));};exports[_0xe1d7('0x45')]=function(_0x3310fe,_0x21ac67){return db['DeskField'][_0xe1d7('0x45')](_0x3310fe['body'],{})[_0xe1d7('0x23')](respondWithResult(_0x21ac67,0xc9))[_0xe1d7('0x40')](handleError(_0x21ac67,null));};exports[_0xe1d7('0x46')]=function(_0x32e4a3,_0xd48848){if(_0x32e4a3['body']['id']){delete _0x32e4a3[_0xe1d7('0x47')]['id'];}return db[_0xe1d7('0x2a')][_0xe1d7('0x48')]({'where':{'id':_0x32e4a3['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0xd48848,null))[_0xe1d7('0x23')](saveUpdates(_0x32e4a3[_0xe1d7('0x47')],null))['then'](respondWithResult(_0xd48848,null))[_0xe1d7('0x40')](handleError(_0xd48848,null));};exports['destroy']=function(_0x3bbbb0,_0x2b53e1){return db[_0xe1d7('0x2a')]['find']({'where':{'id':_0x3bbbb0['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x2b53e1,null))[_0xe1d7('0x23')](removeEntity(_0x2b53e1,null))[_0xe1d7('0x40')](handleError(_0x2b53e1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index eb2a5ad..3db88bd 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 _0xc971=['bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x46933a,_0x33b839){var _0x3eb66e=function(_0x38a848){while(--_0x38a848){_0x46933a['push'](_0x46933a['shift']());}};_0x3eb66e(++_0x33b839);}(_0xc971,0xce));var _0x1c97=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xc971[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x1c97('0x0'));var util=require(_0x1c97('0x1'));var logger=require(_0x1c97('0x2'))(_0x1c97('0x3'));var moment=require('moment');var BPromise=require(_0x1c97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c97('0x5'));var rimraf=require(_0x1c97('0x6'));var config=require(_0x1c97('0x7'));var attributes=require(_0x1c97('0x8'));module['exports']=function(_0x297853,_0x4b7cbb){return _0x297853[_0x1c97('0x9')]('DeskField',attributes,{'tableName':_0x1c97('0xa'),'paranoid':![],'indexes':[{'name':_0x1c97('0xb'),'fields':[_0x1c97('0xc'),_0x1c97('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8935=['idField','FieldId','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','DeskField'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8935,0x160));var _0x5893=function(_0x185c76,_0x534cc3){_0x185c76=_0x185c76-0x0;var _0x7820b7=_0x8935[_0x185c76];return _0x7820b7;};'use strict';var _=require(_0x5893('0x0'));var util=require('util');var logger=require(_0x5893('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5893('0x2'));var fs=require('fs');var path=require(_0x5893('0x3'));var rimraf=require(_0x5893('0x4'));var config=require(_0x5893('0x5'));var attributes=require(_0x5893('0x6'));module['exports']=function(_0x3e80fc,_0x3861ab){return _0x3e80fc['define'](_0x5893('0x7'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x5893('0x8'),_0x5893('0x9')],'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 1f6b86f..f644dc2 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 _0x8646=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x23f3fe,_0x37a19c){var _0x1b1cb1=function(_0x1a96a7){while(--_0x1a96a7){_0x23f3fe['push'](_0x23f3fe['shift']());}};_0x1b1cb1(++_0x37a19c);}(_0x8646,0x19a));var _0x6864=function(_0x256a25,_0x1ae985){_0x256a25=_0x256a25-0x0;var _0x1a5c2a=_0x8646[_0x256a25];return _0x1a5c2a;};'use strict';var _=require(_0x6864('0x0'));var util=require(_0x6864('0x1'));var moment=require(_0x6864('0x2'));var BPromise=require(_0x6864('0x3'));var rs=require(_0x6864('0x4'));var fs=require('fs');var Redis=require(_0x6864('0x5'));var db=require(_0x6864('0x6'))['db'];var utils=require(_0x6864('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6864('0x8'));var client=jayson[_0x6864('0x9')][_0x6864('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47b8e1,_0x66a5ca,_0x3761de){return new BPromise(function(_0x1c8ba3,_0x245717){return client[_0x6864('0xb')](_0x47b8e1,_0x3761de)[_0x6864('0xc')](function(_0x5953e4){logger[_0x6864('0xd')](_0x6864('0xe'),_0x66a5ca,_0x6864('0xf'));logger[_0x6864('0x10')](_0x6864('0x11'),_0x66a5ca,_0x6864('0xf'),JSON[_0x6864('0x12')](_0x5953e4));if(_0x5953e4[_0x6864('0x13')]){if(_0x5953e4['error'][_0x6864('0x14')]===0x1f4){logger['error'](_0x6864('0xe'),_0x66a5ca,_0x5953e4['error'][_0x6864('0x15')]);return _0x245717(_0x5953e4[_0x6864('0x13')]['message']);}logger[_0x6864('0x13')]('DeskField,\x20%s,\x20%s',_0x66a5ca,_0x5953e4[_0x6864('0x13')]['message']);return _0x1c8ba3(_0x5953e4[_0x6864('0x13')][_0x6864('0x15')]);}else{logger[_0x6864('0xd')](_0x6864('0xe'),_0x66a5ca,_0x6864('0xf'));_0x1c8ba3(_0x5953e4[_0x6864('0x16')]['message']);}})['catch'](function(_0x20957a){logger['error'](_0x6864('0xe'),_0x66a5ca,_0x20957a);_0x245717(_0x20957a);});});} \ No newline at end of file +var _0x1935=['client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1935,0x1ef));var _0x5193=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x1935[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x5193('0x0'));var moment=require(_0x5193('0x1'));var BPromise=require(_0x5193('0x2'));var rs=require(_0x5193('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5193('0x4'));var logger=require(_0x5193('0x5'))(_0x5193('0x6'));var config=require(_0x5193('0x7'));var jayson=require(_0x5193('0x8'));var client=jayson[_0x5193('0x9')][_0x5193('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5519db,_0x273213,_0x28a61e){return new BPromise(function(_0x4720f1,_0x459eb6){return client[_0x5193('0xb')](_0x5519db,_0x28a61e)[_0x5193('0xc')](function(_0x511c13){logger[_0x5193('0xd')](_0x5193('0xe'),_0x273213,_0x5193('0xf'));logger[_0x5193('0x10')](_0x5193('0x11'),_0x273213,_0x5193('0xf'),JSON[_0x5193('0x12')](_0x511c13));if(_0x511c13[_0x5193('0x13')]){if(_0x511c13[_0x5193('0x13')][_0x5193('0x14')]===0x1f4){logger['error'](_0x5193('0xe'),_0x273213,_0x511c13[_0x5193('0x13')][_0x5193('0x15')]);return _0x459eb6(_0x511c13['error'][_0x5193('0x15')]);}logger[_0x5193('0x13')](_0x5193('0xe'),_0x273213,_0x511c13[_0x5193('0x13')][_0x5193('0x15')]);return _0x4720f1(_0x511c13[_0x5193('0x13')][_0x5193('0x15')]);}else{logger[_0x5193('0xd')](_0x5193('0xe'),_0x273213,_0x5193('0xf'));_0x4720f1(_0x511c13[_0x5193('0x16')][_0x5193('0x15')]);}})[_0x5193('0x17')](function(_0x3812a2){logger[_0x5193('0x13')]('DeskField,\x20%s,\x20%s',_0x273213,_0x3812a2);_0x459eb6(_0x3812a2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0207ea3..6c9242a 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 _0xef3a=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef3a,0xc9));var _0xaef3=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0xef3a[_0x336376];return _0x1d2a8e;};'use strict';var multer=require(_0xaef3('0x0'));var util=require(_0xaef3('0x1'));var path=require(_0xaef3('0x2'));var timeout=require(_0xaef3('0x3'));var express=require(_0xaef3('0x4'));var router=express[_0xaef3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaef3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaef3('0x7'));var controller=require(_0xaef3('0x8'));router[_0xaef3('0x9')]('/',auth[_0xaef3('0xa')](),controller[_0xaef3('0xb')]);router[_0xaef3('0x9')]('/:id',auth[_0xaef3('0xa')](),controller['show']);router[_0xaef3('0x9')](_0xaef3('0xc'),auth[_0xaef3('0xa')](),controller[_0xaef3('0xd')]);router['get'](_0xaef3('0xe'),auth[_0xaef3('0xa')](),controller[_0xaef3('0xf')]);router[_0xaef3('0x10')]('/',auth[_0xaef3('0xa')](),controller[_0xaef3('0x11')]);router[_0xaef3('0x10')](_0xaef3('0xc'),auth[_0xaef3('0xa')](),controller[_0xaef3('0x12')]);router[_0xaef3('0x13')](_0xaef3('0x14'),auth[_0xaef3('0xa')](),controller[_0xaef3('0x15')]);router[_0xaef3('0x16')](_0xaef3('0x14'),auth['isAuthenticated'](),controller[_0xaef3('0x17')]);module[_0xaef3('0x18')]=router; \ No newline at end of file +var _0x9a43=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','destroy','exports','multer'];(function(_0x19e7d5,_0x20708e){var _0x1cbac5=function(_0xc2f113){while(--_0xc2f113){_0x19e7d5['push'](_0x19e7d5['shift']());}};_0x1cbac5(++_0x20708e);}(_0x9a43,0x1cd));var _0x39a4=function(_0x587783,_0x6296e6){_0x587783=_0x587783-0x0;var _0x1cca44=_0x9a43[_0x587783];return _0x1cca44;};'use strict';var multer=require(_0x39a4('0x0'));var util=require(_0x39a4('0x1'));var path=require(_0x39a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x39a4('0x3'));var router=express[_0x39a4('0x4')]();var fs_extra=require(_0x39a4('0x5'));var auth=require(_0x39a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x39a4('0x7'));var controller=require(_0x39a4('0x8'));router[_0x39a4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39a4('0xa'),auth[_0x39a4('0xb')](),controller[_0x39a4('0xc')]);router[_0x39a4('0x9')](_0x39a4('0xd'),auth[_0x39a4('0xb')](),controller[_0x39a4('0xe')]);router['get'](_0x39a4('0xf'),auth[_0x39a4('0xb')](),controller['getFields']);router[_0x39a4('0x10')]('/',auth[_0x39a4('0xb')](),controller[_0x39a4('0x11')]);router['post'](_0x39a4('0xd'),auth[_0x39a4('0xb')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x39a4('0x12')]);router['delete'](_0x39a4('0xa'),auth[_0x39a4('0xb')](),controller[_0x39a4('0x13')]);module[_0x39a4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e058785..2ae808e 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 _0x46cb=['STRING','BOOLEAN'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x46cb,0xd6));var _0xb46c=function(_0x1e4e1a,_0x3bdb4a){_0x1e4e1a=_0x1e4e1a-0x0;var _0x462e08=_0x46cb[_0x1e4e1a];return _0x462e08;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb46c('0x0')]},'password':{'type':Sequelize[_0xb46c('0x0')]},'remoteUri':{'type':Sequelize[_0xb46c('0x0')]},'tenantId':{'type':Sequelize[_0xb46c('0x0')]},'clientId':{'type':Sequelize[_0xb46c('0x0')]},'clientSecret':{'type':Sequelize[_0xb46c('0x0')]},'serverUrl':{'type':Sequelize[_0xb46c('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb46c('0x0')]},'modernAuthentication':{'type':Sequelize[_0xb46c('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe292=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe292,0x19e));var _0x2e29=function(_0x54399f,_0x1cf173){_0x54399f=_0x54399f-0x0;var _0x44d883=_0xe292[_0x54399f];return _0x44d883;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e29('0x0')]},'username':{'type':Sequelize[_0x2e29('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2e29('0x0')]},'clientId':{'type':Sequelize[_0x2e29('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2e29('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c0ec536..8e6b673 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 _0x6170=['TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','@odata.type','PicklistAttributeMetadata','all','forEach','isNil','push','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','LogicalName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x6170,0x17d));var _0x0617=function(_0x3faf06,_0x472db5){_0x3faf06=_0x3faf06-0x0;var _0x50d51a=_0x6170[_0x3faf06];return _0x50d51a;};'use strict';var rp=require(_0x0617('0x0'));var util=require(_0x0617('0x1'));var _=require(_0x0617('0x2'));var qs=require(_0x0617('0x3'));var logger=require('../../config/logger')(_0x0617('0x4'));var db=require(_0x0617('0x5'))['db'];var integrations=require(_0x0617('0x6'));function respondWithResult(_0x4f4584,_0x5603bf){_0x5603bf=_0x5603bf||0xc8;return function(_0x533a29){if(_0x533a29){return _0x4f4584[_0x0617('0x7')](_0x5603bf)['json'](_0x533a29);}};}function respondWithFilteredResult(_0x3bffba,_0xff6363){return function(_0x1f0aaa){if(_0x1f0aaa){var _0x3562ee=typeof _0xff6363[_0x0617('0x8')]===_0x0617('0x9')&&typeof _0xff6363[_0x0617('0xa')]===_0x0617('0x9');var _0x3a98a6=_0x1f0aaa[_0x0617('0xb')];var _0x442e9f=_0x3562ee?0x0:_0xff6363['offset'];var _0x33302c=_0x3562ee?_0x1f0aaa[_0x0617('0xb')]:_0xff6363[_0x0617('0x8')]+_0xff6363['limit'];var _0x401860;if(_0x33302c>=_0x3a98a6){_0x33302c=_0x3a98a6;_0x401860=0xc8;}else{_0x401860=0xce;}_0x3bffba[_0x0617('0x7')](_0x401860);return _0x3bffba[_0x0617('0xc')]('Content-Range',_0x442e9f+'-'+_0x33302c+'/'+_0x3a98a6)[_0x0617('0xd')](_0x1f0aaa);}return null;};}function saveUpdates(_0x3235d9){return function(_0x39436e){if(_0x39436e){return _0x39436e[_0x0617('0xe')](_0x3235d9)[_0x0617('0xf')](function(_0x330864){return _0x330864;});}return null;};}function removeEntity(_0x9229fc){return function(_0x530072){if(_0x530072){return _0x530072[_0x0617('0x10')]()['then'](function(){_0x9229fc['status'](0xcc)[_0x0617('0x11')]();});}};}function handleEntityNotFound(_0x16e870){return function(_0x188b26){if(!_0x188b26){_0x16e870[_0x0617('0x12')](0x194);}return _0x188b26;};}function handleError(_0x3d69aa,_0x5d4c03){_0x5d4c03=_0x5d4c03||0x1f4;return function(_0x4b0a56){logger[_0x0617('0x13')](_0x4b0a56[_0x0617('0x14')]);if(_0x4b0a56[_0x0617('0x15')]){delete _0x4b0a56[_0x0617('0x15')];}_0x3d69aa[_0x0617('0x7')](_0x5d4c03)[_0x0617('0x16')](_0x4b0a56);};}exports[_0x0617('0x17')]=function(_0xb235e0,_0x121705){var _0x5605be={},_0x2a4b86={},_0x2561bf={'count':0x0,'rows':[]};var _0x3efbee=_['map'](db[_0x0617('0x18')][_0x0617('0x19')],function(_0x4abcee){return{'name':_0x4abcee[_0x0617('0x1a')],'type':_0x4abcee[_0x0617('0x1b')]['key']};});_0x2a4b86[_0x0617('0x1c')]=_[_0x0617('0x1d')](_0x3efbee,'name');_0x2a4b86[_0x0617('0x1e')]=_[_0x0617('0x1f')](_0xb235e0[_0x0617('0x1e')]);_0x2a4b86[_0x0617('0x20')]=_['intersection'](_0x2a4b86['model'],_0x2a4b86[_0x0617('0x1e')]);_0x5605be[_0x0617('0x21')]=_['intersection'](_0x2a4b86[_0x0617('0x1c')],qs[_0x0617('0x22')](_0xb235e0['query'][_0x0617('0x22')]));_0x5605be['attributes']=_0x5605be[_0x0617('0x21')][_0x0617('0x23')]?_0x5605be[_0x0617('0x21')]:_0x2a4b86[_0x0617('0x1c')];if(!_0xb235e0[_0x0617('0x1e')][_0x0617('0x24')](_0x0617('0x25'))){_0x5605be[_0x0617('0xa')]=qs[_0x0617('0xa')](_0xb235e0[_0x0617('0x1e')]['limit']);_0x5605be[_0x0617('0x8')]=qs[_0x0617('0x8')](_0xb235e0[_0x0617('0x1e')][_0x0617('0x8')]);}_0x5605be[_0x0617('0x26')]=qs[_0x0617('0x27')](_0xb235e0['query'][_0x0617('0x27')]);_0x5605be[_0x0617('0x28')]=qs['filters'](_['pick'](_0xb235e0[_0x0617('0x1e')],_0x2a4b86[_0x0617('0x20')]),_0x3efbee);if(_0xb235e0[_0x0617('0x1e')][_0x0617('0x29')]){_0x5605be['where']=_['merge'](_0x5605be['where'],{'$or':_[_0x0617('0x1d')](_0x3efbee,function(_0x3eadce){if(_0x3eadce[_0x0617('0x1b')]!==_0x0617('0x2a')){var _0x2b55a0={};_0x2b55a0[_0x3eadce[_0x0617('0x15')]]={'$like':'%'+_0xb235e0['query'][_0x0617('0x29')]+'%'};return _0x2b55a0;}})});}_0x5605be=_[_0x0617('0x2b')]({},_0x5605be,_0xb235e0[_0x0617('0x2c')]);var _0x19cd31={'where':_0x5605be[_0x0617('0x28')]};return db['Dynamics365Account'][_0x0617('0xb')](_0x19cd31)[_0x0617('0xf')](function(_0x4a5bc4){_0x2561bf[_0x0617('0xb')]=_0x4a5bc4;if(_0xb235e0[_0x0617('0x1e')][_0x0617('0x2d')]){_0x5605be[_0x0617('0x2e')]=[{'all':!![]}];}return db[_0x0617('0x18')][_0x0617('0x2f')](_0x5605be);})['then'](function(_0x47fe42){_0x2561bf[_0x0617('0x30')]=_0x47fe42;return _0x2561bf;})[_0x0617('0xf')](respondWithFilteredResult(_0x121705,_0x5605be))[_0x0617('0x31')](handleError(_0x121705,null));};exports['show']=function(_0x3634d0,_0x175777){var _0x5bd03b={'raw':![],'where':{'id':_0x3634d0[_0x0617('0x32')]['id']}},_0x4fa32d={};_0x4fa32d[_0x0617('0x1c')]=_[_0x0617('0x1f')](db['Dynamics365Account'][_0x0617('0x19')]);_0x4fa32d['query']=_[_0x0617('0x1f')](_0x3634d0[_0x0617('0x1e')]);_0x4fa32d[_0x0617('0x20')]=_[_0x0617('0x33')](_0x4fa32d[_0x0617('0x1c')],_0x4fa32d[_0x0617('0x1e')]);_0x5bd03b[_0x0617('0x21')]=_[_0x0617('0x33')](_0x4fa32d[_0x0617('0x1c')],qs['fields'](_0x3634d0['query'][_0x0617('0x22')]));_0x5bd03b[_0x0617('0x21')]=_0x5bd03b[_0x0617('0x21')][_0x0617('0x23')]?_0x5bd03b[_0x0617('0x21')]:_0x4fa32d[_0x0617('0x1c')];if(_0x3634d0['query'][_0x0617('0x2d')]){_0x5bd03b[_0x0617('0x2e')]=[{'all':!![]}];}_0x5bd03b=_['merge']({},_0x5bd03b,_0x3634d0[_0x0617('0x2c')]);return db[_0x0617('0x18')][_0x0617('0x34')](_0x5bd03b)['then'](handleEntityNotFound(_0x175777,null))[_0x0617('0xf')](respondWithResult(_0x175777,null))[_0x0617('0x31')](handleError(_0x175777,null));};exports[_0x0617('0x35')]=function(_0x3acee6,_0x160239){return db[_0x0617('0x18')]['create'](_0x3acee6[_0x0617('0x36')],{})['then'](respondWithResult(_0x160239,0xc9))[_0x0617('0x31')](handleError(_0x160239,null));};exports[_0x0617('0xe')]=function(_0xf843d3,_0x14f781){if(_0xf843d3['body']['id']){delete _0xf843d3[_0x0617('0x36')]['id'];}return db[_0x0617('0x18')][_0x0617('0x34')]({'where':{'id':_0xf843d3[_0x0617('0x32')]['id']}})[_0x0617('0xf')](handleEntityNotFound(_0x14f781,null))[_0x0617('0xf')](saveUpdates(_0xf843d3[_0x0617('0x36')],null))['then'](respondWithResult(_0x14f781,null))[_0x0617('0x31')](handleError(_0x14f781,null));};exports[_0x0617('0x10')]=function(_0x44cfab,_0x3fc325){return db[_0x0617('0x18')][_0x0617('0x34')]({'where':{'id':_0x44cfab[_0x0617('0x32')]['id']}})[_0x0617('0xf')](handleEntityNotFound(_0x3fc325,null))[_0x0617('0xf')](removeEntity(_0x3fc325,null))[_0x0617('0x31')](handleError(_0x3fc325,null));};exports[_0x0617('0x37')]=function(_0x22c691,_0x560b0e){var _0x40f680={};var _0x328917={};var _0x364def;var _0x207400;return db[_0x0617('0x18')][_0x0617('0x38')]({'where':{'id':_0x22c691[_0x0617('0x32')]['id']}})['then'](handleEntityNotFound(_0x560b0e,null))[_0x0617('0xf')](function(_0x5c82c0){if(_0x5c82c0){_0x364def=_0x5c82c0;_0x328917[_0x0617('0x1c')]=_[_0x0617('0x1f')](db[_0x0617('0x39')][_0x0617('0x19')]);_0x328917['query']=_['keys'](_0x22c691['query']);_0x328917[_0x0617('0x20')]=_[_0x0617('0x33')](_0x328917[_0x0617('0x1c')],_0x328917[_0x0617('0x1e')]);_0x40f680[_0x0617('0x21')]=_['intersection'](_0x328917[_0x0617('0x1c')],qs[_0x0617('0x22')](_0x22c691['query'][_0x0617('0x22')]));_0x40f680[_0x0617('0x21')]=_0x40f680[_0x0617('0x21')][_0x0617('0x23')]?_0x40f680[_0x0617('0x21')]:_0x328917[_0x0617('0x1c')];_0x40f680[_0x0617('0x26')]=qs[_0x0617('0x27')](_0x22c691[_0x0617('0x1e')][_0x0617('0x27')]);_0x40f680[_0x0617('0x28')]=qs['filters'](_[_0x0617('0x3a')](_0x22c691[_0x0617('0x1e')],_0x328917[_0x0617('0x20')]));if(_0x22c691[_0x0617('0x1e')][_0x0617('0x29')]){_0x40f680['where']=_[_0x0617('0x2b')](_0x40f680[_0x0617('0x28')],{'$or':_[_0x0617('0x1d')](_0x40f680[_0x0617('0x21')],function(_0x5bd28b){var _0x81b244={};_0x81b244[_0x5bd28b]={'$like':'%'+_0x22c691['query'][_0x0617('0x29')]+'%'};return _0x81b244;})});}_0x40f680=_['merge']({},_0x40f680,_0x22c691[_0x0617('0x2c')]);return _0x364def[_0x0617('0x37')](_0x40f680);}})['then'](function(_0x6f8cfe){if(_0x6f8cfe){_0x207400=_0x6f8cfe['length'];if(!_0x22c691[_0x0617('0x1e')]['hasOwnProperty'](_0x0617('0x25'))){_0x40f680['limit']=qs['limit'](_0x22c691[_0x0617('0x1e')][_0x0617('0xa')]);_0x40f680[_0x0617('0x8')]=qs[_0x0617('0x8')](_0x22c691[_0x0617('0x1e')]['offset']);}return _0x364def['getConfigurations'](_0x40f680);}})['then'](function(_0x204b50){if(_0x204b50){return _0x204b50?{'count':_0x207400,'rows':_0x204b50}:null;}})[_0x0617('0xf')](respondWithResult(_0x560b0e,null))[_0x0617('0x31')](handleError(_0x560b0e,null));};exports[_0x0617('0x3b')]=function(_0x9e3c44,_0x115257){if(_0x9e3c44[_0x0617('0x36')]['id']){delete _0x9e3c44[_0x0617('0x36')]['id'];}return db[_0x0617('0x18')][_0x0617('0x38')]({'where':{'id':_0x9e3c44[_0x0617('0x32')]['id']}})['then'](handleEntityNotFound(_0x115257,null))['then'](function(_0x3a9690){if(_0x3a9690){_0x9e3c44[_0x0617('0x36')][_0x0617('0x3c')]=_0x3a9690['id'];_0x9e3c44[_0x0617('0x36')]['Subjects']=integrations['getSubjects'](_0x9e3c44[_0x0617('0x36')][_0x0617('0x3d')],_0x9e3c44[_0x0617('0x36')][_0x0617('0x1b')]);_0x9e3c44[_0x0617('0x36')][_0x0617('0x3e')]=integrations[_0x0617('0x3f')](_0x9e3c44[_0x0617('0x36')][_0x0617('0x3d')],_0x9e3c44[_0x0617('0x36')][_0x0617('0x1b')]);return db['Dynamics365Configuration'][_0x0617('0x35')](_0x9e3c44['body'],{'include':[{'model':db[_0x0617('0x40')],'as':_0x0617('0x41')},{'model':db[_0x0617('0x40')],'as':_0x0617('0x3e')}]});}return null;})[_0x0617('0xf')](respondWithResult(_0x115257,null))[_0x0617('0x31')](handleError(_0x115257,null));};function sanitizeRemoteUri(_0x5342c2){var _0x419b6e=_0x5342c2['slice'](-0x1);if(_0x419b6e==='/')return _0x5342c2[_0x0617('0x42')](0x0,_0x5342c2[_0x0617('0x43')](_0x419b6e));return _0x5342c2;}function getWebApiUrl(_0x1a8e51){return util[_0x0617('0x44')](_0x0617('0x45'),_0x1a8e51);}exports[_0x0617('0x46')]=function(_0x271f0e,_0x37b79d){var _0x531ae1=_0x271f0e[_0x0617('0x1e')][_0x0617('0x47')];var _0x49c519=_0x531ae1==='incident'?_0x0617('0x48'):_0x0617('0x49');var _0x5b53f9='';var _0x26f1ee='';var _0x3e94de='';var _0x2e872a='';var _0x2d03f3='';var _0x401643='';var _0x372682='';var _0x422042='';var _0x41ba98=['title','description','customerid',_0x0617('0x4a'),'caseorigincode',_0x0617('0x4b'),_0x0617('0x4c'),'regardingobjectid',_0x0617('0x4d'),_0x0617('0x4e')];var _0x1be11a=['accountidname',_0x0617('0x4f'),_0x0617('0x50'),_0x0617('0x51'),_0x0617('0x52'),'contactidyominame',_0x0617('0x53'),'contractidname','createdbyexternalpartyname',_0x0617('0x54'),_0x0617('0x55'),_0x0617('0x56'),_0x0617('0x57'),_0x0617('0x58'),_0x0617('0x59'),_0x0617('0x5a'),_0x0617('0x5b'),'customeridyominame',_0x0617('0x5c'),_0x0617('0x5d'),_0x0617('0x5e'),_0x0617('0x5f'),_0x0617('0x60'),_0x0617('0x61'),_0x0617('0x62'),_0x0617('0x63'),_0x0617('0x64'),_0x0617('0x65'),_0x0617('0x66'),'lastonholdtime',_0x0617('0x67'),_0x0617('0x68'),'modifiedbyexternalpartyyominame',_0x0617('0x69'),_0x0617('0x6a'),'modifiedon','modifiedonbehalfbyname',_0x0617('0x6b'),'msdyn_incidenttypename',_0x0617('0x6c'),_0x0617('0x6d'),_0x0617('0x6e'),_0x0617('0x6f'),_0x0617('0x70'),_0x0617('0x71'),_0x0617('0x72'),_0x0617('0x73'),_0x0617('0x74'),_0x0617('0x75'),_0x0617('0x76'),_0x0617('0x77'),'productserialnumber','resolveby',_0x0617('0x78'),_0x0617('0x79'),_0x0617('0x7a'),_0x0617('0x7b'),_0x0617('0x7c'),_0x0617('0x7d'),_0x0617('0x7e'),_0x0617('0x7f'),_0x0617('0x80'),_0x0617('0x81'),_0x0617('0x82'),_0x0617('0x83'),_0x0617('0x84'),'transactioncurrencyidname',_0x0617('0x85'),_0x0617('0x86'),_0x0617('0x87')];var _0x48f370=_0x41ba98[_0x0617('0x88')](_0x1be11a);return db[_0x0617('0x18')][_0x0617('0x38')]({'where':{'id':_0x271f0e['params']['id']},'attributes':['id',_0x0617('0x89'),_0x0617('0x8a'),_0x0617('0x8b'),_0x0617('0x8c'),_0x0617('0x8d'),_0x0617('0x8e'),_0x0617('0x8f')],'include':[{'model':db[_0x0617('0x90')],'as':'CloudProvider','attributes':['id',_0x0617('0x91'),_0x0617('0x92')]}]})['then'](handleEntityNotFound(_0x37b79d,null))[_0x0617('0xf')](function(_0x27d1f5){if(_0x27d1f5){if(_0x27d1f5[_0x0617('0x8f')]){_0x27d1f5[_0x0617('0x93')]=_0x27d1f5[_0x0617('0x90')][_0x0617('0x91')];_0x422042=sanitizeRemoteUri(_0x27d1f5[_0x0617('0x90')][_0x0617('0x92')]);_0x372682=getWebApiUrl(_0x422042);return _0x27d1f5;}_0x422042=sanitizeRemoteUri(_0x27d1f5[_0x0617('0x8b')]);_0x372682=getWebApiUrl(_0x422042);var _0x11df21={'method':_0x0617('0x94'),'uri':'https://login.microsoftonline.com/'+_0x27d1f5[_0x0617('0x8c')]+_0x0617('0x95'),'form':{'client_id':_0x27d1f5[_0x0617('0x8d')],'resource':_0x422042,'username':_0x27d1f5['username'],'password':_0x27d1f5['password'],'grant_type':'password','client_secret':_0x27d1f5['clientSecret']},'json':!![]};return rp(_0x11df21);}})[_0x0617('0xf')](function(_0x362d5d){_0x401643=_0x362d5d[_0x0617('0x93')];var _0x4f7682={'method':_0x0617('0x96'),'uri':encodeURI(_0x372682+_0x0617('0x97')+_0x49c519+'\x27'),'headers':{'Authorization':_0x0617('0x98')+_0x401643,'If-None-Match':null,'OData-Version':_0x0617('0x99')},'json':!![]};return rp(_0x4f7682);})[_0x0617('0xf')](function(_0x26ada5){var _0x105697=_0x26ada5['value'][0x0];var _0x21dc2e=_0x105697[_0x0617('0x9a')];var _0x10da38={'method':_0x0617('0x96'),'uri':_0x372682+_0x0617('0x9b')+_0x21dc2e+_0x0617('0x9c'),'headers':{'Authorization':'Bearer\x20'+_0x401643,'If-None-Match':null,'OData-Version':_0x0617('0x99')},'json':!![]};return rp(_0x10da38);})[_0x0617('0xf')](function(_0x21e19c){_0x5b53f9=_0x21e19c;_0x26f1ee=_0x5b53f9[_0x0617('0x9d')];_0x26f1ee=_['remove'](_0x26f1ee,function(_0x53083e){return!_0x48f370[_0x0617('0x9e')](_0x53083e['LogicalName']);});var _0x1a25b6=[];var _0x4fbf6d=[];_0x26f1ee['forEach'](function(_0x4405bd){if(_0x4405bd[_0x0617('0x9f')]){var _0x367eea=_0x4405bd[_0x0617('0x9f')]['substring'](_0x4405bd['@odata.type'][_0x0617('0x43')]('.')+0x1);if(_0x367eea===_0x0617('0xa0')){_0x1a25b6['push'](getSelectList(_0x372682,_0x531ae1,_0x4fbf6d,_0x5b53f9[_0x0617('0x9a')],_0x4405bd[_0x0617('0x9a')],_0x401643));}}});return Promise[_0x0617('0xa1')](_0x1a25b6);})[_0x0617('0xf')](function(_0x3f7754){_0x3e94de=_0x3f7754[0x0];var _0x2899f4=[];var _0x5d48e4=[];_0x26f1ee[_0x0617('0xa2')](function(_0x286272){if(!_[_0x0617('0xa3')](_0x286272[_0x0617('0x9f')])){var _0x2b7a75=_0x286272[_0x0617('0x9f')][_0x0617('0x42')](_0x286272[_0x0617('0x9f')][_0x0617('0x43')]('.')+0x1);if(_0x2b7a75==='BooleanAttributeMetadata'){_0x2899f4[_0x0617('0xa4')](getBooleanList(_0x372682,_0x531ae1,_0x5d48e4,_0x5b53f9[_0x0617('0x9a')],_0x286272[_0x0617('0x9a')],_0x401643));}}});return Promise[_0x0617('0xa1')](_0x2899f4);})[_0x0617('0xf')](function(_0x14271e){_0x2e872a=_0x14271e[0x0];var _0x3bc0ec=[];var _0x33d428=[];_0x26f1ee[_0x0617('0xa2')](function(_0x30bbb6){if(_0x30bbb6['@odata.type']){var _0xa72a38=_0x30bbb6[_0x0617('0x9f')]['substring'](_0x30bbb6[_0x0617('0x9f')][_0x0617('0x43')]('.')+0x1);if(_0xa72a38===_0x0617('0xa5')||_0xa72a38==='DoubleAttributeMetadata'||_0xa72a38===_0x0617('0xa6')||_0xa72a38==='IntegerAttributeMetadata'||_0xa72a38===_0x0617('0xa7')||_0xa72a38===_0x0617('0xa8')||_0xa72a38===_0x0617('0xa9')||_0xa72a38==='EntityNameAttributeMetadata'||_0xa72a38===_0x0617('0xaa')||_0xa72a38==='DecimalAttributeMetadata'){_0x3bc0ec['push'](getInputList(_0x372682,_0x531ae1,_0xa72a38,_0x33d428,_0x5b53f9['MetadataId'],_0x30bbb6[_0x0617('0x9a')],_0x401643));}}});return Promise[_0x0617('0xa1')](_0x3bc0ec);})['then'](function(_0x388c66){_0x2d03f3=_0x388c66[0x0];var _0x2c1a96=_0x3e94de[_0x0617('0x88')](_0x2e872a)[_0x0617('0x88')](_0x2d03f3);var _0xf16f7c={'count':_0x2c1a96[_0x0617('0x23')],'rows':_0x2c1a96};return _0xf16f7c;})[_0x0617('0xf')](respondWithResult(_0x37b79d,null))[_0x0617('0x31')](function(_0x16d059){var _0x4cfb51=_0x271f0e[_0x0617('0x1e')][_0x0617('0xab')]?0x1f4:_0x16d059['statusCode']||0x1f4;logger[_0x0617('0x13')](_0x16d059['stack']);delete _0x16d059[_0x0617('0x15')];if(_0x4cfb51===0x191){_0x4cfb51=0x190;}_0x37b79d[_0x0617('0x7')](_0x4cfb51)['send'](_0x271f0e[_0x0617('0x1e')]['test']?{'message':_0x0617('0xac'),'statusCode':_0x16d059[_0x0617('0xad')]}:_0x16d059);});};function getSelectList(_0x35b8d9,_0x33383f,_0x327999,_0x1811c2,_0x3c3559,_0xcb6f99){var _0x348d9f={'method':_0x0617('0x96'),'uri':_0x35b8d9+'EntityDefinitions('+_0x1811c2+_0x0617('0xae')+_0x3c3559+_0x0617('0xaf')+_0x0617('0xb0'),'headers':{'Authorization':_0x0617('0x98')+_0xcb6f99,'If-None-Match':null,'OData-Version':_0x0617('0x99')},'json':!![]};return rp(_0x348d9f)[_0x0617('0xf')](function(_0x1caec4){var _0x5f2229=[];var _0x5e7f3e=_0x1caec4[_0x0617('0xb1')][_0x0617('0xb2')];_0x5e7f3e['forEach'](function(_0x5dc3cb){_0x5f2229['push']({'name':_0x5dc3cb[_0x0617('0xb3')]['UserLocalizedLabel'][_0x0617('0xb3')],'value':String(_0x5dc3cb['Value'])});});var _0x4b58f5={'id':_0x33383f+'_'+_0x1caec4[_0x0617('0xb4')],'name':_0x1caec4['DisplayName'][_0x0617('0xb5')][_0x0617('0xb3')],'custom':![],'options':_0x5f2229};_0x327999[_0x0617('0xa4')](_0x4b58f5);return _0x327999;});}function getBooleanList(_0xa6b877,_0x5c16bd,_0x31afe4,_0x575119,_0x48464d,_0x36e2be){var _0x8a0fac={'method':'GET','uri':_0xa6b877+'EntityDefinitions('+_0x575119+_0x0617('0xae')+_0x48464d+_0x0617('0xb6'),'headers':{'Authorization':_0x0617('0x98')+_0x36e2be,'If-None-Match':null,'OData-Version':_0x0617('0x99')},'json':!![]};return rp(_0x8a0fac)[_0x0617('0xf')](function(_0x2f0d38){var _0x1805cd=[];_0x1805cd[_0x0617('0xa4')]({'name':_0x2f0d38[_0x0617('0xb1')][_0x0617('0xb7')][_0x0617('0xb3')]['UserLocalizedLabel'][_0x0617('0xb3')],'value':_0x0617('0xb8')},{'name':_0x2f0d38[_0x0617('0xb1')]['FalseOption']['Label'][_0x0617('0xb5')][_0x0617('0xb3')],'value':'false'});var _0xcaf586={'id':_0x5c16bd+'_'+_0x2f0d38[_0x0617('0xb4')],'name':_0x2f0d38[_0x0617('0xb9')][_0x0617('0xb5')][_0x0617('0xb3')],'custom':![],'options':_0x1805cd};_0x31afe4['push'](_0xcaf586);return _0x31afe4;});}function getInputList(_0x2de1df,_0x556948,_0x34c453,_0xbdf426,_0x3ee9e4,_0x308005,_0x53ff8d){var _0x3dabe5={'method':_0x0617('0x96'),'uri':_0x2de1df+'EntityDefinitions('+_0x3ee9e4+_0x0617('0xae')+_0x308005+_0x0617('0xba')+_0x34c453+_0x0617('0xbb'),'headers':{'Authorization':_0x0617('0x98')+_0x53ff8d,'If-None-Match':null,'OData-Version':_0x0617('0x99')},'json':!![]};return rp(_0x3dabe5)[_0x0617('0xf')](function(_0x47878d){var _0x1a63df={'id':_0x556948+'_'+_0x47878d[_0x0617('0xb4')],'name':_0x47878d[_0x0617('0xb9')][_0x0617('0xb5')]?_0x47878d[_0x0617('0xb9')][_0x0617('0xb5')][_0x0617('0xb3')]:_0x47878d[_0x0617('0xb4')],'custom':![],'options':[]};_0xbdf426[_0x0617('0xa4')](_0x1a63df);return _0xbdf426;});} \ No newline at end of file +var _0x50d5=['offset','undefined','limit','count','status','set','Content-Range','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','options','find','create','body','update','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','4.0','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','length','statusCode','send','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','api','../../mysqldb','../../components/integrations/configuration','json'];(function(_0x10942b,_0xf14d86){var _0x4e34e6=function(_0x348bb8){while(--_0x348bb8){_0x10942b['push'](_0x10942b['shift']());}};_0x4e34e6(++_0xf14d86);}(_0x50d5,0x166));var _0x550d=function(_0x510998,_0x279f38){_0x510998=_0x510998-0x0;var _0x5c8a91=_0x50d5[_0x510998];return _0x5c8a91;};'use strict';var rp=require(_0x550d('0x0'));var util=require('util');var _=require(_0x550d('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x550d('0x2'));var db=require(_0x550d('0x3'))['db'];var integrations=require(_0x550d('0x4'));function respondWithResult(_0x3a8409,_0x17eb90){_0x17eb90=_0x17eb90||0xc8;return function(_0x342ef2){if(_0x342ef2){return _0x3a8409['status'](_0x17eb90)[_0x550d('0x5')](_0x342ef2);}};}function respondWithFilteredResult(_0x2b31a9,_0x4cf7d0){return function(_0x5bad5b){if(_0x5bad5b){var _0x2dcffe=typeof _0x4cf7d0[_0x550d('0x6')]===_0x550d('0x7')&&typeof _0x4cf7d0[_0x550d('0x8')]===_0x550d('0x7');var _0x52549d=_0x5bad5b[_0x550d('0x9')];var _0x530458=_0x2dcffe?0x0:_0x4cf7d0[_0x550d('0x6')];var _0xd5dc55=_0x2dcffe?_0x5bad5b['count']:_0x4cf7d0[_0x550d('0x6')]+_0x4cf7d0[_0x550d('0x8')];var _0x41a261;if(_0xd5dc55>=_0x52549d){_0xd5dc55=_0x52549d;_0x41a261=0xc8;}else{_0x41a261=0xce;}_0x2b31a9[_0x550d('0xa')](_0x41a261);return _0x2b31a9[_0x550d('0xb')](_0x550d('0xc'),_0x530458+'-'+_0xd5dc55+'/'+_0x52549d)[_0x550d('0x5')](_0x5bad5b);}return null;};}function saveUpdates(_0x226590){return function(_0xeed0ba){if(_0xeed0ba){return _0xeed0ba['update'](_0x226590)['then'](function(_0x255f1f){return _0x255f1f;});}return null;};}function removeEntity(_0x5c90d9){return function(_0xe9851e){if(_0xe9851e){return _0xe9851e[_0x550d('0xd')]()[_0x550d('0xe')](function(){_0x5c90d9[_0x550d('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463e10){return function(_0x3c0b30){if(!_0x3c0b30){_0x463e10['sendStatus'](0x194);}return _0x3c0b30;};}function handleError(_0x3e2748,_0x430371){_0x430371=_0x430371||0x1f4;return function(_0x4214a3){logger[_0x550d('0xf')](_0x4214a3[_0x550d('0x10')]);if(_0x4214a3[_0x550d('0x11')]){delete _0x4214a3[_0x550d('0x11')];}_0x3e2748[_0x550d('0xa')](_0x430371)['send'](_0x4214a3);};}exports[_0x550d('0x12')]=function(_0x2f0018,_0x4602bd){var _0x356d5b={},_0x21c99e={},_0x4177d1={'count':0x0,'rows':[]};var _0x5e0089=_['map'](db['Dynamics365Account'][_0x550d('0x13')],function(_0x591a7e){return{'name':_0x591a7e[_0x550d('0x14')],'type':_0x591a7e[_0x550d('0x15')]['key']};});_0x21c99e[_0x550d('0x16')]=_[_0x550d('0x17')](_0x5e0089,'name');_0x21c99e['query']=_[_0x550d('0x18')](_0x2f0018[_0x550d('0x19')]);_0x21c99e[_0x550d('0x1a')]=_[_0x550d('0x1b')](_0x21c99e[_0x550d('0x16')],_0x21c99e[_0x550d('0x19')]);_0x356d5b['attributes']=_[_0x550d('0x1b')](_0x21c99e[_0x550d('0x16')],qs[_0x550d('0x1c')](_0x2f0018[_0x550d('0x19')]['fields']));_0x356d5b[_0x550d('0x1d')]=_0x356d5b[_0x550d('0x1d')]['length']?_0x356d5b['attributes']:_0x21c99e[_0x550d('0x16')];if(!_0x2f0018['query']['hasOwnProperty']('nolimit')){_0x356d5b[_0x550d('0x8')]=qs[_0x550d('0x8')](_0x2f0018[_0x550d('0x19')][_0x550d('0x8')]);_0x356d5b[_0x550d('0x6')]=qs[_0x550d('0x6')](_0x2f0018[_0x550d('0x19')]['offset']);}_0x356d5b[_0x550d('0x1e')]=qs[_0x550d('0x1f')](_0x2f0018[_0x550d('0x19')][_0x550d('0x1f')]);_0x356d5b[_0x550d('0x20')]=qs[_0x550d('0x1a')](_[_0x550d('0x21')](_0x2f0018[_0x550d('0x19')],_0x21c99e[_0x550d('0x1a')]),_0x5e0089);if(_0x2f0018[_0x550d('0x19')][_0x550d('0x22')]){_0x356d5b[_0x550d('0x20')]=_[_0x550d('0x23')](_0x356d5b[_0x550d('0x20')],{'$or':_[_0x550d('0x17')](_0x5e0089,function(_0x2ffc37){if(_0x2ffc37[_0x550d('0x15')]!==_0x550d('0x24')){var _0x50d4ac={};_0x50d4ac[_0x2ffc37['name']]={'$like':'%'+_0x2f0018[_0x550d('0x19')]['filter']+'%'};return _0x50d4ac;}})});}_0x356d5b=_['merge']({},_0x356d5b,_0x2f0018['options']);var _0x28dda7={'where':_0x356d5b[_0x550d('0x20')]};return db['Dynamics365Account'][_0x550d('0x9')](_0x28dda7)['then'](function(_0x114f60){_0x4177d1[_0x550d('0x9')]=_0x114f60;if(_0x2f0018[_0x550d('0x19')][_0x550d('0x25')]){_0x356d5b[_0x550d('0x26')]=[{'all':!![]}];}return db[_0x550d('0x27')][_0x550d('0x28')](_0x356d5b);})[_0x550d('0xe')](function(_0x523cb8){_0x4177d1[_0x550d('0x29')]=_0x523cb8;return _0x4177d1;})[_0x550d('0xe')](respondWithFilteredResult(_0x4602bd,_0x356d5b))[_0x550d('0x2a')](handleError(_0x4602bd,null));};exports[_0x550d('0x2b')]=function(_0x1a19e0,_0x39f0cb){var _0x519ef7={'raw':![],'where':{'id':_0x1a19e0[_0x550d('0x2c')]['id']}},_0x248b66={};_0x248b66[_0x550d('0x16')]=_[_0x550d('0x18')](db[_0x550d('0x27')][_0x550d('0x13')]);_0x248b66[_0x550d('0x19')]=_['keys'](_0x1a19e0['query']);_0x248b66[_0x550d('0x1a')]=_[_0x550d('0x1b')](_0x248b66['model'],_0x248b66[_0x550d('0x19')]);_0x519ef7[_0x550d('0x1d')]=_[_0x550d('0x1b')](_0x248b66[_0x550d('0x16')],qs['fields'](_0x1a19e0[_0x550d('0x19')][_0x550d('0x1c')]));_0x519ef7[_0x550d('0x1d')]=_0x519ef7['attributes']['length']?_0x519ef7['attributes']:_0x248b66[_0x550d('0x16')];if(_0x1a19e0[_0x550d('0x19')][_0x550d('0x25')]){_0x519ef7['include']=[{'all':!![]}];}_0x519ef7=_[_0x550d('0x23')]({},_0x519ef7,_0x1a19e0[_0x550d('0x2d')]);return db[_0x550d('0x27')][_0x550d('0x2e')](_0x519ef7)[_0x550d('0xe')](handleEntityNotFound(_0x39f0cb,null))[_0x550d('0xe')](respondWithResult(_0x39f0cb,null))[_0x550d('0x2a')](handleError(_0x39f0cb,null));};exports[_0x550d('0x2f')]=function(_0x4d1393,_0x1a9004){return db[_0x550d('0x27')][_0x550d('0x2f')](_0x4d1393[_0x550d('0x30')],{})['then'](respondWithResult(_0x1a9004,0xc9))[_0x550d('0x2a')](handleError(_0x1a9004,null));};exports[_0x550d('0x31')]=function(_0x39e055,_0x3b471a){if(_0x39e055[_0x550d('0x30')]['id']){delete _0x39e055[_0x550d('0x30')]['id'];}return db[_0x550d('0x27')][_0x550d('0x2e')]({'where':{'id':_0x39e055[_0x550d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3b471a,null))[_0x550d('0xe')](saveUpdates(_0x39e055[_0x550d('0x30')],null))[_0x550d('0xe')](respondWithResult(_0x3b471a,null))[_0x550d('0x2a')](handleError(_0x3b471a,null));};exports['destroy']=function(_0x475621,_0xc99765){return db[_0x550d('0x27')][_0x550d('0x2e')]({'where':{'id':_0x475621[_0x550d('0x2c')]['id']}})[_0x550d('0xe')](handleEntityNotFound(_0xc99765,null))['then'](removeEntity(_0xc99765,null))[_0x550d('0x2a')](handleError(_0xc99765,null));};exports[_0x550d('0x32')]=function(_0xbe49ae,_0x419058){var _0x3910e7={};var _0x5e3fa7={};var _0x5c2a6a;var _0x43ea32;return db['Dynamics365Account'][_0x550d('0x33')]({'where':{'id':_0xbe49ae[_0x550d('0x2c')]['id']}})[_0x550d('0xe')](handleEntityNotFound(_0x419058,null))['then'](function(_0x4c1ccd){if(_0x4c1ccd){_0x5c2a6a=_0x4c1ccd;_0x5e3fa7[_0x550d('0x16')]=_[_0x550d('0x18')](db['Dynamics365Configuration'][_0x550d('0x13')]);_0x5e3fa7[_0x550d('0x19')]=_['keys'](_0xbe49ae[_0x550d('0x19')]);_0x5e3fa7[_0x550d('0x1a')]=_[_0x550d('0x1b')](_0x5e3fa7[_0x550d('0x16')],_0x5e3fa7['query']);_0x3910e7['attributes']=_['intersection'](_0x5e3fa7[_0x550d('0x16')],qs[_0x550d('0x1c')](_0xbe49ae['query']['fields']));_0x3910e7[_0x550d('0x1d')]=_0x3910e7[_0x550d('0x1d')]['length']?_0x3910e7[_0x550d('0x1d')]:_0x5e3fa7[_0x550d('0x16')];_0x3910e7['order']=qs[_0x550d('0x1f')](_0xbe49ae[_0x550d('0x19')][_0x550d('0x1f')]);_0x3910e7[_0x550d('0x20')]=qs[_0x550d('0x1a')](_[_0x550d('0x21')](_0xbe49ae[_0x550d('0x19')],_0x5e3fa7[_0x550d('0x1a')]));if(_0xbe49ae[_0x550d('0x19')][_0x550d('0x22')]){_0x3910e7[_0x550d('0x20')]=_[_0x550d('0x23')](_0x3910e7[_0x550d('0x20')],{'$or':_['map'](_0x3910e7[_0x550d('0x1d')],function(_0x54a38e){var _0x5a9728={};_0x5a9728[_0x54a38e]={'$like':'%'+_0xbe49ae['query'][_0x550d('0x22')]+'%'};return _0x5a9728;})});}_0x3910e7=_['merge']({},_0x3910e7,_0xbe49ae[_0x550d('0x2d')]);return _0x5c2a6a[_0x550d('0x32')](_0x3910e7);}})[_0x550d('0xe')](function(_0xfc5b85){if(_0xfc5b85){_0x43ea32=_0xfc5b85['length'];if(!_0xbe49ae[_0x550d('0x19')][_0x550d('0x34')]('nolimit')){_0x3910e7[_0x550d('0x8')]=qs['limit'](_0xbe49ae['query'][_0x550d('0x8')]);_0x3910e7[_0x550d('0x6')]=qs['offset'](_0xbe49ae[_0x550d('0x19')][_0x550d('0x6')]);}return _0x5c2a6a['getConfigurations'](_0x3910e7);}})[_0x550d('0xe')](function(_0x39c889){if(_0x39c889){return _0x39c889?{'count':_0x43ea32,'rows':_0x39c889}:null;}})[_0x550d('0xe')](respondWithResult(_0x419058,null))[_0x550d('0x2a')](handleError(_0x419058,null));};exports[_0x550d('0x35')]=function(_0x7ec601,_0x4de15f){if(_0x7ec601[_0x550d('0x30')]['id']){delete _0x7ec601[_0x550d('0x30')]['id'];}return db[_0x550d('0x27')][_0x550d('0x33')]({'where':{'id':_0x7ec601[_0x550d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4de15f,null))['then'](function(_0x149ec8){if(_0x149ec8){_0x7ec601[_0x550d('0x30')][_0x550d('0x36')]=_0x149ec8['id'];_0x7ec601[_0x550d('0x30')][_0x550d('0x37')]=integrations['getSubjects'](_0x7ec601[_0x550d('0x30')]['channel'],_0x7ec601[_0x550d('0x30')][_0x550d('0x15')]);_0x7ec601['body'][_0x550d('0x38')]=integrations[_0x550d('0x39')](_0x7ec601[_0x550d('0x30')][_0x550d('0x3a')],_0x7ec601[_0x550d('0x30')][_0x550d('0x15')]);return db[_0x550d('0x3b')]['create'](_0x7ec601[_0x550d('0x30')],{'include':[{'model':db[_0x550d('0x3c')],'as':_0x550d('0x37')},{'model':db[_0x550d('0x3c')],'as':_0x550d('0x38')}]});}return null;})['then'](respondWithResult(_0x4de15f,null))[_0x550d('0x2a')](handleError(_0x4de15f,null));};function sanitizeRemoteUri(_0x340030){var _0x1c6760=_0x340030[_0x550d('0x3d')](-0x1);if(_0x1c6760==='/')return _0x340030[_0x550d('0x3e')](0x0,_0x340030[_0x550d('0x3f')](_0x1c6760));return _0x340030;}function getWebApiUrl(_0x195e9c){return util[_0x550d('0x40')](_0x550d('0x41'),_0x195e9c);}exports[_0x550d('0x42')]=function(_0x10a441,_0x9d6949){var _0x27b74a=_0x10a441['query'][_0x550d('0x43')];var _0x2f4ce3=_0x27b74a===_0x550d('0x44')?_0x550d('0x45'):_0x550d('0x46');var _0x378e60='';var _0x35bdf1='';var _0x2281fc='';var _0x1c6dfd='';var _0x429196='';var _0x3926d8='';var _0x1f5f60='';var _0x33c0eb='';var _0x5159ce=['title','description',_0x550d('0x47'),_0x550d('0x48'),'caseorigincode',_0x550d('0x49'),_0x550d('0x4a'),'regardingobjectid',_0x550d('0x4b'),_0x550d('0x4c')];var _0x5ec5c9=[_0x550d('0x4d'),_0x550d('0x4e'),'actualserviceunits','billedserviceunits',_0x550d('0x4f'),_0x550d('0x50'),_0x550d('0x51'),_0x550d('0x52'),_0x550d('0x53'),_0x550d('0x54'),_0x550d('0x55'),_0x550d('0x56'),_0x550d('0x57'),_0x550d('0x58'),_0x550d('0x59'),'customeridname','customeridtype',_0x550d('0x5a'),_0x550d('0x5b'),_0x550d('0x5c'),_0x550d('0x5d'),_0x550d('0x5e'),'escalatedon',_0x550d('0x5f'),_0x550d('0x60'),_0x550d('0x61'),'importsequencenumber','influencescore',_0x550d('0x62'),_0x550d('0x63'),'masteridname',_0x550d('0x64'),_0x550d('0x65'),_0x550d('0x66'),'modifiedbyyominame',_0x550d('0x67'),_0x550d('0x68'),_0x550d('0x69'),_0x550d('0x6a'),_0x550d('0x6b'),_0x550d('0x6c'),_0x550d('0x6d'),_0x550d('0x6e'),_0x550d('0x6f'),_0x550d('0x70'),_0x550d('0x71'),'parentcaseidname','primarycontactidname',_0x550d('0x72'),'prioritycodename',_0x550d('0x73'),_0x550d('0x74'),_0x550d('0x75'),_0x550d('0x76'),_0x550d('0x77'),_0x550d('0x78'),_0x550d('0x79'),_0x550d('0x7a'),_0x550d('0x7b'),_0x550d('0x7c'),_0x550d('0x7d'),'statecode','statuscode',_0x550d('0x7e'),_0x550d('0x7f'),_0x550d('0x80'),'transactioncurrencyidname',_0x550d('0x81'),_0x550d('0x82'),_0x550d('0x83')];var _0x1701b3=_0x5159ce['concat'](_0x5ec5c9);return db[_0x550d('0x27')][_0x550d('0x33')]({'where':{'id':_0x10a441[_0x550d('0x2c')]['id']},'attributes':['id','username',_0x550d('0x84'),_0x550d('0x85'),_0x550d('0x86'),_0x550d('0x87'),'clientSecret',_0x550d('0x88')],'include':[{'model':db[_0x550d('0x89')],'as':_0x550d('0x89'),'attributes':['id',_0x550d('0x8a'),'data7']}]})[_0x550d('0xe')](handleEntityNotFound(_0x9d6949,null))[_0x550d('0xe')](function(_0x1f7300){if(_0x1f7300){if(_0x1f7300['modernAuthentication']){_0x1f7300[_0x550d('0x8b')]=_0x1f7300[_0x550d('0x89')][_0x550d('0x8a')];_0x33c0eb=sanitizeRemoteUri(_0x1f7300['CloudProvider'][_0x550d('0x8c')]);_0x1f5f60=getWebApiUrl(_0x33c0eb);return _0x1f7300;}_0x33c0eb=sanitizeRemoteUri(_0x1f7300[_0x550d('0x85')]);_0x1f5f60=getWebApiUrl(_0x33c0eb);var _0x2aba87={'method':_0x550d('0x8d'),'uri':_0x550d('0x8e')+_0x1f7300[_0x550d('0x86')]+_0x550d('0x8f'),'form':{'client_id':_0x1f7300[_0x550d('0x87')],'resource':_0x33c0eb,'username':_0x1f7300['username'],'password':_0x1f7300[_0x550d('0x84')],'grant_type':_0x550d('0x84'),'client_secret':_0x1f7300[_0x550d('0x90')]},'json':!![]};return rp(_0x2aba87);}})[_0x550d('0xe')](function(_0xc493ea){_0x3926d8=_0xc493ea[_0x550d('0x8b')];var _0x4669e3={'method':_0x550d('0x91'),'uri':encodeURI(_0x1f5f60+_0x550d('0x92')+_0x2f4ce3+'\x27'),'headers':{'Authorization':_0x550d('0x93')+_0x3926d8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4669e3);})[_0x550d('0xe')](function(_0x33a5ec){var _0x2f77fb=_0x33a5ec['value'][0x0];var _0x337889=_0x2f77fb[_0x550d('0x94')];var _0x4d44a0={'method':'GET','uri':_0x1f5f60+'EntityDefinitions('+_0x337889+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x550d('0x93')+_0x3926d8,'If-None-Match':null,'OData-Version':_0x550d('0x95')},'json':!![]};return rp(_0x4d44a0);})[_0x550d('0xe')](function(_0x1a71b4){_0x378e60=_0x1a71b4;_0x35bdf1=_0x378e60['Attributes'];_0x35bdf1=_['remove'](_0x35bdf1,function(_0x417b8d){return!_0x1701b3['includes'](_0x417b8d[_0x550d('0x96')]);});var _0x476013=[];var _0x443a96=[];_0x35bdf1[_0x550d('0x97')](function(_0x2d67bd){if(_0x2d67bd[_0x550d('0x98')]){var _0x4d5d7c=_0x2d67bd[_0x550d('0x98')]['substring'](_0x2d67bd[_0x550d('0x98')]['lastIndexOf']('.')+0x1);if(_0x4d5d7c===_0x550d('0x99')){_0x476013[_0x550d('0x9a')](getSelectList(_0x1f5f60,_0x27b74a,_0x443a96,_0x378e60['MetadataId'],_0x2d67bd[_0x550d('0x94')],_0x3926d8));}}});return Promise['all'](_0x476013);})['then'](function(_0x37592e){_0x2281fc=_0x37592e[0x0];var _0x1c44a4=[];var _0x1c8ddd=[];_0x35bdf1[_0x550d('0x97')](function(_0x26c7c7){if(!_['isNil'](_0x26c7c7[_0x550d('0x98')])){var _0x4947f9=_0x26c7c7[_0x550d('0x98')][_0x550d('0x3e')](_0x26c7c7[_0x550d('0x98')][_0x550d('0x3f')]('.')+0x1);if(_0x4947f9===_0x550d('0x9b')){_0x1c44a4[_0x550d('0x9a')](getBooleanList(_0x1f5f60,_0x27b74a,_0x1c8ddd,_0x378e60[_0x550d('0x94')],_0x26c7c7[_0x550d('0x94')],_0x3926d8));}}});return Promise['all'](_0x1c44a4);})[_0x550d('0xe')](function(_0x3d1a44){_0x1c6dfd=_0x3d1a44[0x0];var _0x21d6fc=[];var _0x346fa8=[];_0x35bdf1[_0x550d('0x97')](function(_0x4924c7){if(_0x4924c7[_0x550d('0x98')]){var _0x4c57d2=_0x4924c7[_0x550d('0x98')][_0x550d('0x3e')](_0x4924c7[_0x550d('0x98')][_0x550d('0x3f')]('.')+0x1);if(_0x4c57d2==='StringAttributeMetadata'||_0x4c57d2===_0x550d('0x9c')||_0x4c57d2===_0x550d('0x9d')||_0x4c57d2===_0x550d('0x9e')||_0x4c57d2===_0x550d('0x9f')||_0x4c57d2===_0x550d('0xa0')||_0x4c57d2===_0x550d('0xa1')||_0x4c57d2===_0x550d('0xa2')||_0x4c57d2===_0x550d('0xa3')||_0x4c57d2===_0x550d('0xa4')){_0x21d6fc[_0x550d('0x9a')](getInputList(_0x1f5f60,_0x27b74a,_0x4c57d2,_0x346fa8,_0x378e60[_0x550d('0x94')],_0x4924c7[_0x550d('0x94')],_0x3926d8));}}});return Promise['all'](_0x21d6fc);})[_0x550d('0xe')](function(_0x2815a6){_0x429196=_0x2815a6[0x0];var _0x372b32=_0x2281fc[_0x550d('0xa5')](_0x1c6dfd)[_0x550d('0xa5')](_0x429196);var _0x228b7a={'count':_0x372b32[_0x550d('0xa6')],'rows':_0x372b32};return _0x228b7a;})['then'](respondWithResult(_0x9d6949,null))[_0x550d('0x2a')](function(_0x16257b){var _0x5da7a=_0x10a441['query']['test']?0x1f4:_0x16257b[_0x550d('0xa7')]||0x1f4;logger[_0x550d('0xf')](_0x16257b[_0x550d('0x10')]);delete _0x16257b['name'];if(_0x5da7a===0x191){_0x5da7a=0x190;}_0x9d6949[_0x550d('0xa')](_0x5da7a)[_0x550d('0xa8')](_0x10a441['query']['test']?{'message':_0x550d('0xa9'),'statusCode':_0x16257b[_0x550d('0xa7')]}:_0x16257b);});};function getSelectList(_0x515df0,_0x52bdf7,_0x100de6,_0x5ddb75,_0x14a305,_0x473d84){var _0x1a0510={'method':_0x550d('0x91'),'uri':_0x515df0+_0x550d('0xaa')+_0x5ddb75+')/Attributes('+_0x14a305+_0x550d('0xab')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x550d('0x93')+_0x473d84,'If-None-Match':null,'OData-Version':_0x550d('0x95')},'json':!![]};return rp(_0x1a0510)[_0x550d('0xe')](function(_0x3e254d){var _0x35de55=[];var _0x23bf85=_0x3e254d[_0x550d('0xac')]['Options'];_0x23bf85[_0x550d('0x97')](function(_0xb93df0){_0x35de55[_0x550d('0x9a')]({'name':_0xb93df0[_0x550d('0xad')]['UserLocalizedLabel'][_0x550d('0xad')],'value':String(_0xb93df0['Value'])});});var _0x55b0ff={'id':_0x52bdf7+'_'+_0x3e254d[_0x550d('0x96')],'name':_0x3e254d[_0x550d('0xae')][_0x550d('0xaf')][_0x550d('0xad')],'custom':![],'options':_0x35de55};_0x100de6['push'](_0x55b0ff);return _0x100de6;});}function getBooleanList(_0x3f654a,_0x4a8b91,_0x22a102,_0x22eadb,_0x44e58d,_0x2603cc){var _0xf25ebf={'method':_0x550d('0x91'),'uri':_0x3f654a+'EntityDefinitions('+_0x22eadb+_0x550d('0xb0')+_0x44e58d+_0x550d('0xb1'),'headers':{'Authorization':_0x550d('0x93')+_0x2603cc,'If-None-Match':null,'OData-Version':_0x550d('0x95')},'json':!![]};return rp(_0xf25ebf)[_0x550d('0xe')](function(_0x47e72e){var _0x387495=[];_0x387495['push']({'name':_0x47e72e[_0x550d('0xac')][_0x550d('0xb2')][_0x550d('0xad')][_0x550d('0xaf')][_0x550d('0xad')],'value':'true'},{'name':_0x47e72e['OptionSet']['FalseOption'][_0x550d('0xad')][_0x550d('0xaf')]['Label'],'value':_0x550d('0xb3')});var _0x1735dc={'id':_0x4a8b91+'_'+_0x47e72e[_0x550d('0x96')],'name':_0x47e72e[_0x550d('0xae')][_0x550d('0xaf')][_0x550d('0xad')],'custom':![],'options':_0x387495};_0x22a102[_0x550d('0x9a')](_0x1735dc);return _0x22a102;});}function getInputList(_0x5331f9,_0x4ba80b,_0x514bf9,_0x3a3104,_0x5cddcb,_0x1f2d24,_0x306a7a){var _0xeab212={'method':_0x550d('0x91'),'uri':_0x5331f9+_0x550d('0xaa')+_0x5cddcb+')/Attributes('+_0x1f2d24+_0x550d('0xb4')+_0x514bf9+_0x550d('0xb5'),'headers':{'Authorization':_0x550d('0x93')+_0x306a7a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xeab212)[_0x550d('0xe')](function(_0x2aea1c){var _0x4de5a0={'id':_0x4ba80b+'_'+_0x2aea1c[_0x550d('0x96')],'name':_0x2aea1c[_0x550d('0xae')]['UserLocalizedLabel']?_0x2aea1c['DisplayName'][_0x550d('0xaf')]['Label']:_0x2aea1c[_0x550d('0x96')],'custom':![],'options':[]};_0x3a3104['push'](_0x4de5a0);return _0x3a3104;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f1b449c..a1b6a3d 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(_0xeb502,_0x440e9d){var _0x5bcc21=function(_0x13d85b){while(--_0x13d85b){_0xeb502['push'](_0xeb502['shift']());}};_0x5bcc21(++_0x440e9d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x421ea6,_0x62b8f5){var _0x4c9f8f=function(_0x3ffa67){while(--_0x3ffa67){_0x421ea6['push'](_0x421ea6['shift']());}};_0x4c9f8f(++_0x62b8f5);}(_0x757a,0xde));var _0xa757=function(_0x2fea0b,_0xf02201){_0x2fea0b=_0x2fea0b-0x0;var _0x52e54f=_0x757a[_0x2fea0b];return _0x52e54f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2e1292d..25854d7 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 _0x15dc=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','then','debug','ShowDynamics365Account','find','lodash'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x15dc,0xed));var _0xc15d=function(_0x43c815,_0x5c85dc){_0x43c815=_0x43c815-0x0;var _0x1998d2=_0x15dc[_0x43c815];return _0x1998d2;};'use strict';var _=require(_0xc15d('0x0'));var util=require(_0xc15d('0x1'));var moment=require(_0xc15d('0x2'));var BPromise=require(_0xc15d('0x3'));var rs=require(_0xc15d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc15d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc15d('0x6'))(_0xc15d('0x7'));var config=require(_0xc15d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc15d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x162800,_0x21d90e,_0x5d7d1f){return new BPromise(function(_0x572ae0,_0x130273){return client[_0xc15d('0xa')](_0x162800,_0x5d7d1f)['then'](function(_0x1354de){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x21d90e,_0xc15d('0xb'));logger['debug'](_0xc15d('0xc'),_0x21d90e,_0xc15d('0xb'),JSON[_0xc15d('0xd')](_0x1354de));if(_0x1354de['error']){if(_0x1354de[_0xc15d('0xe')][_0xc15d('0xf')]===0x1f4){logger['error'](_0xc15d('0x10'),_0x21d90e,_0x1354de[_0xc15d('0xe')]['message']);return _0x130273(_0x1354de[_0xc15d('0xe')]['message']);}logger[_0xc15d('0xe')](_0xc15d('0x10'),_0x21d90e,_0x1354de[_0xc15d('0xe')][_0xc15d('0x11')]);return _0x572ae0(_0x1354de[_0xc15d('0xe')][_0xc15d('0x11')]);}else{logger[_0xc15d('0x12')](_0xc15d('0x10'),_0x21d90e,_0xc15d('0xb'));_0x572ae0(_0x1354de['result'][_0xc15d('0x11')]);}})[_0xc15d('0x13')](function(_0x18e1f7){logger[_0xc15d('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x21d90e,_0x18e1f7);_0x130273(_0x18e1f7);});});}exports[_0xc15d('0x14')]=function(_0x220616){var _0x44f3cf=this;return new Promise(function(_0x1e41bc,_0x46bed2){return db[_0xc15d('0x15')]['findAll']({'raw':_0x220616[_0xc15d('0x16')]?_0x220616['options'][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x220616[_0xc15d('0x16')]?_0x220616[_0xc15d('0x16')][_0xc15d('0x18')]||null:null,'attributes':_0x220616[_0xc15d('0x16')]?_0x220616[_0xc15d('0x16')][_0xc15d('0x19')]||null:null,'limit':_0x220616[_0xc15d('0x16')]?_0x220616[_0xc15d('0x16')][_0xc15d('0x1a')]||null:null,'include':_0x220616['options']?_0x220616[_0xc15d('0x16')][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x220616['options'][_0xc15d('0x1b')],function(_0x4934bb){return{'model':db[_0x4934bb[_0xc15d('0x1d')]],'as':_0x4934bb['as'],'attributes':_0x4934bb[_0xc15d('0x19')],'include':_0x4934bb[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x4934bb[_0xc15d('0x1b')],function(_0x2a203a){return{'model':db[_0x2a203a['model']],'as':_0x2a203a['as'],'attributes':_0x2a203a[_0xc15d('0x19')],'include':_0x2a203a[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x2a203a[_0xc15d('0x1b')],function(_0x438038){return{'model':db[_0x438038[_0xc15d('0x1d')]],'as':_0x438038['as'],'attributes':_0x438038['attributes']};}):[]};}):[]};}):[]:[]})[_0xc15d('0x1e')](function(_0x2bd7e6){logger[_0xc15d('0x12')](_0xc15d('0x14'),_0x220616);logger[_0xc15d('0x1f')]('GetDynamics365Account',_0x220616,JSON[_0xc15d('0xd')](_0x2bd7e6));_0x1e41bc(_0x2bd7e6);})[_0xc15d('0x13')](function(_0x7a6e77){logger[_0xc15d('0xe')]('GetDynamics365Account',_0x7a6e77[_0xc15d('0x11')],_0x220616);_0x46bed2(_0x44f3cf[_0xc15d('0xe')](0x1f4,_0x7a6e77[_0xc15d('0x11')]));});});};exports[_0xc15d('0x20')]=function(_0x57bae8){var _0x3b3625=this;return new Promise(function(_0x9d9065,_0x51ca02){return db[_0xc15d('0x15')][_0xc15d('0x21')]({'raw':_0x57bae8[_0xc15d('0x16')]?_0x57bae8[_0xc15d('0x16')][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x57bae8[_0xc15d('0x16')]?_0x57bae8[_0xc15d('0x16')]['where']||null:null,'attributes':_0x57bae8['options']?_0x57bae8[_0xc15d('0x16')][_0xc15d('0x19')]||null:null,'include':_0x57bae8[_0xc15d('0x16')]?_0x57bae8['options'][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x57bae8[_0xc15d('0x16')][_0xc15d('0x1b')],function(_0x3f9463){return{'model':db[_0x3f9463[_0xc15d('0x1d')]],'as':_0x3f9463['as'],'attributes':_0x3f9463[_0xc15d('0x19')],'include':_0x3f9463[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x3f9463['include'],function(_0x355ade){return{'model':db[_0x355ade['model']],'as':_0x355ade['as'],'attributes':_0x355ade[_0xc15d('0x19')],'include':_0x355ade[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x355ade[_0xc15d('0x1b')],function(_0x1d89b8){return{'model':db[_0x1d89b8[_0xc15d('0x1d')]],'as':_0x1d89b8['as'],'attributes':_0x1d89b8[_0xc15d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x228bc1){logger[_0xc15d('0x12')]('ShowDynamics365Account',_0x57bae8);logger[_0xc15d('0x1f')]('ShowDynamics365Account',_0x57bae8,JSON[_0xc15d('0xd')](_0x228bc1));_0x9d9065(_0x228bc1);})[_0xc15d('0x13')](function(_0x34adb7){logger[_0xc15d('0xe')]('ShowDynamics365Account',_0x34adb7[_0xc15d('0x11')],_0x57bae8);_0x51ca02(_0x3b3625[_0xc15d('0xe')](0x1f4,_0x34adb7[_0xc15d('0x11')]));});});}; \ No newline at end of file +var _0xf677=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','options','where','limit','include','map','model','attributes','debug','ShowDynamics365Account','Dynamics365Account','raw','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x18d94d,_0x37aae4){var _0x3de230=function(_0x194952){while(--_0x194952){_0x18d94d['push'](_0x18d94d['shift']());}};_0x3de230(++_0x37aae4);}(_0xf677,0xa1));var _0x7f67=function(_0x22b1b5,_0x181a1e){_0x22b1b5=_0x22b1b5-0x0;var _0x20f79d=_0xf677[_0x22b1b5];return _0x20f79d;};'use strict';var _=require('lodash');var util=require(_0x7f67('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f67('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f67('0x2'))['db'];var utils=require(_0x7f67('0x3'));var logger=require(_0x7f67('0x4'))(_0x7f67('0x5'));var config=require(_0x7f67('0x6'));var jayson=require(_0x7f67('0x7'));var client=jayson[_0x7f67('0x8')][_0x7f67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50146c,_0x553765,_0x504cde){return new BPromise(function(_0x2c65b2,_0x1475be){return client[_0x7f67('0xa')](_0x50146c,_0x504cde)[_0x7f67('0xb')](function(_0x4a8607){logger[_0x7f67('0xc')](_0x7f67('0xd'),_0x553765,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x553765,_0x7f67('0xe'),JSON[_0x7f67('0xf')](_0x4a8607));if(_0x4a8607[_0x7f67('0x10')]){if(_0x4a8607[_0x7f67('0x10')][_0x7f67('0x11')]===0x1f4){logger['error'](_0x7f67('0xd'),_0x553765,_0x4a8607[_0x7f67('0x10')][_0x7f67('0x12')]);return _0x1475be(_0x4a8607['error']['message']);}logger[_0x7f67('0x10')](_0x7f67('0xd'),_0x553765,_0x4a8607[_0x7f67('0x10')][_0x7f67('0x12')]);return _0x2c65b2(_0x4a8607[_0x7f67('0x10')][_0x7f67('0x12')]);}else{logger[_0x7f67('0xc')](_0x7f67('0xd'),_0x553765,_0x7f67('0xe'));_0x2c65b2(_0x4a8607[_0x7f67('0x13')]['message']);}})[_0x7f67('0x14')](function(_0x922e28){logger[_0x7f67('0x10')](_0x7f67('0xd'),_0x553765,_0x922e28);_0x1475be(_0x922e28);});});}exports[_0x7f67('0x15')]=function(_0x544701){var _0x1f7f34=this;return new Promise(function(_0xddb805,_0x210043){return db['Dynamics365Account']['findAll']({'raw':_0x544701[_0x7f67('0x16')]?_0x544701[_0x7f67('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x544701[_0x7f67('0x16')]?_0x544701[_0x7f67('0x16')][_0x7f67('0x17')]||null:null,'attributes':_0x544701[_0x7f67('0x16')]?_0x544701[_0x7f67('0x16')]['attributes']||null:null,'limit':_0x544701[_0x7f67('0x16')]?_0x544701['options'][_0x7f67('0x18')]||null:null,'include':_0x544701[_0x7f67('0x16')]?_0x544701[_0x7f67('0x16')][_0x7f67('0x19')]?_[_0x7f67('0x1a')](_0x544701[_0x7f67('0x16')][_0x7f67('0x19')],function(_0x58d705){return{'model':db[_0x58d705[_0x7f67('0x1b')]],'as':_0x58d705['as'],'attributes':_0x58d705[_0x7f67('0x1c')],'include':_0x58d705[_0x7f67('0x19')]?_[_0x7f67('0x1a')](_0x58d705['include'],function(_0x1ed12c){return{'model':db[_0x1ed12c[_0x7f67('0x1b')]],'as':_0x1ed12c['as'],'attributes':_0x1ed12c[_0x7f67('0x1c')],'include':_0x1ed12c[_0x7f67('0x19')]?_[_0x7f67('0x1a')](_0x1ed12c[_0x7f67('0x19')],function(_0x4fb958){return{'model':db[_0x4fb958[_0x7f67('0x1b')]],'as':_0x4fb958['as'],'attributes':_0x4fb958[_0x7f67('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f67('0xb')](function(_0x19f41b){logger[_0x7f67('0xc')](_0x7f67('0x15'),_0x544701);logger[_0x7f67('0x1d')](_0x7f67('0x15'),_0x544701,JSON['stringify'](_0x19f41b));_0xddb805(_0x19f41b);})[_0x7f67('0x14')](function(_0x251ed1){logger[_0x7f67('0x10')](_0x7f67('0x15'),_0x251ed1[_0x7f67('0x12')],_0x544701);_0x210043(_0x1f7f34[_0x7f67('0x10')](0x1f4,_0x251ed1[_0x7f67('0x12')]));});});};exports[_0x7f67('0x1e')]=function(_0x40dead){var _0x476b54=this;return new Promise(function(_0x241b86,_0x122594){return db[_0x7f67('0x1f')]['find']({'raw':_0x40dead[_0x7f67('0x16')]?_0x40dead[_0x7f67('0x16')][_0x7f67('0x20')]===undefined?!![]:![]:!![],'where':_0x40dead[_0x7f67('0x16')]?_0x40dead['options'][_0x7f67('0x17')]||null:null,'attributes':_0x40dead[_0x7f67('0x16')]?_0x40dead[_0x7f67('0x16')][_0x7f67('0x1c')]||null:null,'include':_0x40dead[_0x7f67('0x16')]?_0x40dead[_0x7f67('0x16')][_0x7f67('0x19')]?_['map'](_0x40dead[_0x7f67('0x16')][_0x7f67('0x19')],function(_0x57fc80){return{'model':db[_0x57fc80[_0x7f67('0x1b')]],'as':_0x57fc80['as'],'attributes':_0x57fc80['attributes'],'include':_0x57fc80[_0x7f67('0x19')]?_[_0x7f67('0x1a')](_0x57fc80[_0x7f67('0x19')],function(_0x3a195f){return{'model':db[_0x3a195f[_0x7f67('0x1b')]],'as':_0x3a195f['as'],'attributes':_0x3a195f[_0x7f67('0x1c')],'include':_0x3a195f[_0x7f67('0x19')]?_[_0x7f67('0x1a')](_0x3a195f['include'],function(_0x101095){return{'model':db[_0x101095[_0x7f67('0x1b')]],'as':_0x101095['as'],'attributes':_0x101095[_0x7f67('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f67('0xb')](function(_0x3c26b6){logger['info'](_0x7f67('0x1e'),_0x40dead);logger[_0x7f67('0x1d')](_0x7f67('0x1e'),_0x40dead,JSON[_0x7f67('0xf')](_0x3c26b6));_0x241b86(_0x3c26b6);})[_0x7f67('0x14')](function(_0x4c1c00){logger[_0x7f67('0x10')]('ShowDynamics365Account',_0x4c1c00[_0x7f67('0x12')],_0x40dead);_0x122594(_0x476b54['error'](0x1f4,_0x4c1c00[_0x7f67('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 455d45c..fc943e1 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 _0xd7cf=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xd7cf[_0x257841];return _0x1b87ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd7c('0x0'));var timeout=require(_0xfd7c('0x1'));var express=require('express');var router=express[_0xfd7c('0x2')]();var fs_extra=require(_0xfd7c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd7c('0x4'));var controller=require(_0xfd7c('0x5'));router[_0xfd7c('0x6')]('/',auth[_0xfd7c('0x7')](),controller['index']);router[_0xfd7c('0x6')](_0xfd7c('0x8'),auth[_0xfd7c('0x7')](),controller[_0xfd7c('0x9')]);router['get'](_0xfd7c('0xa'),auth[_0xfd7c('0x7')](),controller[_0xfd7c('0xb')]);router['get'](_0xfd7c('0xc'),auth[_0xfd7c('0x7')](),controller[_0xfd7c('0xd')]);router['get'](_0xfd7c('0xe'),auth[_0xfd7c('0x7')](),controller[_0xfd7c('0xf')]);router[_0xfd7c('0x10')]('/',auth[_0xfd7c('0x7')](),controller['create']);router[_0xfd7c('0x11')](_0xfd7c('0x8'),auth[_0xfd7c('0x7')](),controller[_0xfd7c('0x12')]);router[_0xfd7c('0x13')]('/:id',auth[_0xfd7c('0x7')](),controller[_0xfd7c('0x14')]);module[_0xfd7c('0x15')]=router; \ No newline at end of file +var _0x4f7a=['../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','/:id','update','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x317a29,_0x3590ce){var _0xb18038=function(_0x43f1b4){while(--_0x43f1b4){_0x317a29['push'](_0x317a29['shift']());}};_0xb18038(++_0x3590ce);}(_0x4f7a,0x105));var _0xa4f7=function(_0x531109,_0x39cc81){_0x531109=_0x531109-0x0;var _0x6231ea=_0x4f7a[_0x531109];return _0x6231ea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4f7('0x0'));var timeout=require(_0xa4f7('0x1'));var express=require(_0xa4f7('0x2'));var router=express['Router']();var fs_extra=require(_0xa4f7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa4f7('0x4'));var config=require(_0xa4f7('0x5'));var controller=require(_0xa4f7('0x6'));router['get']('/',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x8')]);router['get']('/:id',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x9')]);router[_0xa4f7('0xa')](_0xa4f7('0xb'),auth[_0xa4f7('0x7')](),controller['getFields']);router[_0xa4f7('0xa')](_0xa4f7('0xc'),auth[_0xa4f7('0x7')](),controller[_0xa4f7('0xd')]);router[_0xa4f7('0xa')](_0xa4f7('0xe'),auth[_0xa4f7('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0xf')]);router['put'](_0xa4f7('0x10'),auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x11')]);router['delete'](_0xa4f7('0x10'),auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x12')]);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 452a419..54afe1f 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 _0x1a75=['contact','nothing','BOOLEAN','STRING','ENUM','incident','phonecall'];(function(_0x2bfc60,_0xa254ab){var _0x44ea2c=function(_0x57ca7a){while(--_0x57ca7a){_0x2bfc60['push'](_0x2bfc60['shift']());}};_0x44ea2c(++_0xa254ab);}(_0x1a75,0x184));var _0x51a7=function(_0x32ceb8,_0x3052c7){_0x32ceb8=_0x32ceb8-0x0;var _0x3dd606=_0x1a75[_0x32ceb8];return _0x3dd606;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x51a7('0x0')]},'ticketType':{'type':Sequelize[_0x51a7('0x1')](_0x51a7('0x2'),_0x51a7('0x3')),'defaultValue':_0x51a7('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0x51a7('0x4'),_0x51a7('0x5')),'defaultValue':_0x51a7('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x51a7('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2497=['STRING','ENUM','incident','contact','nothing','exports'];(function(_0x15ce80,_0x21c992){var _0x1c0da6=function(_0x31d74e){while(--_0x31d74e){_0x15ce80['push'](_0x15ce80['shift']());}};_0x1c0da6(++_0x21c992);}(_0x2497,0x16d));var _0x7249=function(_0x2a888b,_0x3c486f){_0x2a888b=_0x2a888b-0x0;var _0x511fe6=_0x2497[_0x2a888b];return _0x511fe6;};'use strict';var Sequelize=require('sequelize');module[_0x7249('0x0')]={'name':{'type':Sequelize[_0x7249('0x1')]},'description':{'type':Sequelize[_0x7249('0x1')]},'ticketType':{'type':Sequelize[_0x7249('0x2')](_0x7249('0x3'),'phonecall'),'defaultValue':_0x7249('0x3')},'moduleCreate':{'type':Sequelize[_0x7249('0x2')](_0x7249('0x4'),_0x7249('0x5')),'defaultValue':_0x7249('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x7249('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2ed9176..2e7a79c 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 _0x246a=['to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','stack','map','rawAttributes','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','merge','filter','options','includeAll','include','Dynamics365Configuration','findAll','then','rows','catch','show','params','find','create','body','destroy','getFields','findOne','Dynamics365Field','order','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0xf53492,_0x52546a){var _0x23cc3=function(_0x413673){while(--_0x413673){_0xf53492['push'](_0xf53492['shift']());}};_0x23cc3(++_0x52546a);}(_0x246a,0x174));var _0xa246=function(_0x489fde,_0x2c98ea){_0x489fde=_0x489fde-0x0;var _0x54d0bd=_0x246a[_0x489fde];return _0x54d0bd;};'use strict';var emlformat=require(_0xa246('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa246('0x1'));var rp=require(_0xa246('0x2'));var moment=require('moment');var BPromise=require(_0xa246('0x3'));var Mustache=require(_0xa246('0x4'));var util=require(_0xa246('0x5'));var path=require(_0xa246('0x6'));var sox=require(_0xa246('0x7'));var csv=require(_0xa246('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa246('0x9'));var squel=require(_0xa246('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa246('0xb'));var toCsv=require(_0xa246('0x8'));var querystring=require(_0xa246('0xc'));var Papa=require(_0xa246('0xd'));var Redis=require('ioredis');var authService=require(_0xa246('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa246('0xf'));var logger=require(_0xa246('0x10'))(_0xa246('0x11'));var utils=require(_0xa246('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa246('0x13'));var db=require(_0xa246('0x14'))['db'];function respondWithStatusCode(_0x4917b2,_0x3a38c0){_0x3a38c0=_0x3a38c0||0xcc;return function(_0x409589){if(_0x409589){return _0x4917b2[_0xa246('0x15')](_0x3a38c0);}return _0x4917b2[_0xa246('0x16')](_0x3a38c0)[_0xa246('0x17')]();};}function respondWithResult(_0x23ce13,_0x272f9b){_0x272f9b=_0x272f9b||0xc8;return function(_0x48cbce){if(_0x48cbce){return _0x23ce13['status'](_0x272f9b)[_0xa246('0x18')](_0x48cbce);}};}function respondWithFilteredResult(_0x55ddd6,_0x3e975b){return function(_0x54c827){if(_0x54c827){var _0x1a7587=typeof _0x3e975b[_0xa246('0x19')]===_0xa246('0x1a')&&typeof _0x3e975b[_0xa246('0x1b')]===_0xa246('0x1a');var _0x528105=_0x54c827[_0xa246('0x1c')];var _0x510c8d=_0x1a7587?0x0:_0x3e975b[_0xa246('0x19')];var _0x434d82=_0x1a7587?_0x54c827[_0xa246('0x1c')]:_0x3e975b[_0xa246('0x19')]+_0x3e975b[_0xa246('0x1b')];var _0x2d1a96;if(_0x434d82>=_0x528105){_0x434d82=_0x528105;_0x2d1a96=0xc8;}else{_0x2d1a96=0xce;}_0x55ddd6['status'](_0x2d1a96);return _0x55ddd6[_0xa246('0x1d')](_0xa246('0x1e'),_0x510c8d+'-'+_0x434d82+'/'+_0x528105)['json'](_0x54c827);}return null;};}function patchUpdates(_0x241a11){return function(_0x33ea7f){try{jsonpatch[_0xa246('0x1f')](_0x33ea7f,_0x241a11,!![]);}catch(_0x1c6f54){return BPromise['reject'](_0x1c6f54);}return _0x33ea7f[_0xa246('0x20')]();};}function saveUpdates(_0x152441,_0x556d1f){return function(_0x186f10){if(_0x186f10){return _0x186f10[_0xa246('0x21')](_0x152441)['then'](function(_0x4e3c35){return _0x4e3c35;});}return null;};}function removeEntity(_0x5cd2b8,_0x55795f){return function(_0x3b2d66){if(_0x3b2d66){return _0x3b2d66['destroy']()['then'](function(){_0x5cd2b8['status'](0xcc)[_0xa246('0x17')]();});}};}function handleEntityNotFound(_0x35a892,_0x5d82ad){return function(_0x168236){if(!_0x168236){_0x35a892['sendStatus'](0x194);}return _0x168236;};}function handleError(_0x28072f,_0x1b4627){_0x1b4627=_0x1b4627||0x1f4;return function(_0x17d9f4){logger['error'](_0x17d9f4[_0xa246('0x22')]);if(_0x17d9f4['name']){delete _0x17d9f4['name'];}_0x28072f[_0xa246('0x16')](_0x1b4627)['send'](_0x17d9f4);};}exports['index']=function(_0x2466af,_0x3c90cb){var _0x5e5b9b={},_0x5b3afb={},_0x8ce248={'count':0x0,'rows':[]};var _0x46d9e8=_[_0xa246('0x23')](db['Dynamics365Configuration'][_0xa246('0x24')],function(_0x4e6012){return{'name':_0x4e6012[_0xa246('0x25')],'type':_0x4e6012[_0xa246('0x26')][_0xa246('0x27')]};});_0x5b3afb[_0xa246('0x28')]=_[_0xa246('0x23')](_0x46d9e8,_0xa246('0x29'));_0x5b3afb['query']=_[_0xa246('0x2a')](_0x2466af['query']);_0x5b3afb['filters']=_['intersection'](_0x5b3afb[_0xa246('0x28')],_0x5b3afb[_0xa246('0x2b')]);_0x5e5b9b[_0xa246('0x2c')]=_[_0xa246('0x2d')](_0x5b3afb['model'],qs[_0xa246('0x2e')](_0x2466af[_0xa246('0x2b')][_0xa246('0x2e')]));_0x5e5b9b[_0xa246('0x2c')]=_0x5e5b9b['attributes'][_0xa246('0x2f')]?_0x5e5b9b[_0xa246('0x2c')]:_0x5b3afb[_0xa246('0x28')];if(!_0x2466af['query']['hasOwnProperty'](_0xa246('0x30'))){_0x5e5b9b[_0xa246('0x1b')]=qs[_0xa246('0x1b')](_0x2466af[_0xa246('0x2b')]['limit']);_0x5e5b9b[_0xa246('0x19')]=qs[_0xa246('0x19')](_0x2466af[_0xa246('0x2b')][_0xa246('0x19')]);}_0x5e5b9b['order']=qs[_0xa246('0x31')](_0x2466af[_0xa246('0x2b')][_0xa246('0x31')]);_0x5e5b9b[_0xa246('0x32')]=qs[_0xa246('0x33')](_['pick'](_0x2466af[_0xa246('0x2b')],_0x5b3afb[_0xa246('0x33')]),_0x46d9e8);if(_0x2466af[_0xa246('0x2b')]['filter']){_0x5e5b9b[_0xa246('0x32')]=_[_0xa246('0x34')](_0x5e5b9b[_0xa246('0x32')],{'$or':_['map'](_0x46d9e8,function(_0x2a6806){if(_0x2a6806[_0xa246('0x26')]!=='VIRTUAL'){var _0x43498d={};_0x43498d[_0x2a6806['name']]={'$like':'%'+_0x2466af[_0xa246('0x2b')][_0xa246('0x35')]+'%'};return _0x43498d;}})});}_0x5e5b9b=_[_0xa246('0x34')]({},_0x5e5b9b,_0x2466af[_0xa246('0x36')]);var _0x29a2a2={'where':_0x5e5b9b[_0xa246('0x32')]};return db['Dynamics365Configuration'][_0xa246('0x1c')](_0x29a2a2)['then'](function(_0xee91fb){_0x8ce248[_0xa246('0x1c')]=_0xee91fb;if(_0x2466af[_0xa246('0x2b')][_0xa246('0x37')]){_0x5e5b9b[_0xa246('0x38')]=[{'all':!![]}];}return db[_0xa246('0x39')][_0xa246('0x3a')](_0x5e5b9b);})[_0xa246('0x3b')](function(_0x9597c8){_0x8ce248[_0xa246('0x3c')]=_0x9597c8;return _0x8ce248;})[_0xa246('0x3b')](respondWithFilteredResult(_0x3c90cb,_0x5e5b9b))[_0xa246('0x3d')](handleError(_0x3c90cb,null));};exports[_0xa246('0x3e')]=function(_0x5b1202,_0xb23f3a){var _0x40ad5a={'raw':![],'where':{'id':_0x5b1202[_0xa246('0x3f')]['id']}},_0x3283d0={};_0x3283d0['model']=_[_0xa246('0x2a')](db[_0xa246('0x39')][_0xa246('0x24')]);_0x3283d0[_0xa246('0x2b')]=_[_0xa246('0x2a')](_0x5b1202[_0xa246('0x2b')]);_0x3283d0[_0xa246('0x33')]=_[_0xa246('0x2d')](_0x3283d0[_0xa246('0x28')],_0x3283d0[_0xa246('0x2b')]);_0x40ad5a['attributes']=_[_0xa246('0x2d')](_0x3283d0[_0xa246('0x28')],qs[_0xa246('0x2e')](_0x5b1202[_0xa246('0x2b')][_0xa246('0x2e')]));_0x40ad5a['attributes']=_0x40ad5a[_0xa246('0x2c')][_0xa246('0x2f')]?_0x40ad5a['attributes']:_0x3283d0[_0xa246('0x28')];if(_0x5b1202[_0xa246('0x2b')][_0xa246('0x37')]){_0x40ad5a[_0xa246('0x38')]=[{'all':!![]}];}_0x40ad5a=_[_0xa246('0x34')]({},_0x40ad5a,_0x5b1202[_0xa246('0x36')]);return db[_0xa246('0x39')][_0xa246('0x40')](_0x40ad5a)[_0xa246('0x3b')](handleEntityNotFound(_0xb23f3a,null))['then'](respondWithResult(_0xb23f3a,null))[_0xa246('0x3d')](handleError(_0xb23f3a,null));};exports[_0xa246('0x41')]=function(_0x3f6261,_0x1044f9){return db['Dynamics365Configuration'][_0xa246('0x41')](_0x3f6261['body'],{})[_0xa246('0x3b')](respondWithResult(_0x1044f9,0xc9))[_0xa246('0x3d')](handleError(_0x1044f9,null));};exports[_0xa246('0x21')]=function(_0x4bdb15,_0x2571d7){if(_0x4bdb15[_0xa246('0x42')]['id']){delete _0x4bdb15[_0xa246('0x42')]['id'];}return db[_0xa246('0x39')][_0xa246('0x40')]({'where':{'id':_0x4bdb15[_0xa246('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2571d7,null))[_0xa246('0x3b')](saveUpdates(_0x4bdb15[_0xa246('0x42')],null))[_0xa246('0x3b')](respondWithResult(_0x2571d7,null))[_0xa246('0x3d')](handleError(_0x2571d7,null));};exports[_0xa246('0x43')]=function(_0x52ac74,_0x3ebf73){return db[_0xa246('0x39')][_0xa246('0x40')]({'where':{'id':_0x52ac74[_0xa246('0x3f')]['id']}})[_0xa246('0x3b')](handleEntityNotFound(_0x3ebf73,null))[_0xa246('0x3b')](removeEntity(_0x3ebf73,null))[_0xa246('0x3d')](handleError(_0x3ebf73,null));};exports[_0xa246('0x44')]=function(_0x348b99,_0x226e73,_0x37aa9e){var _0x1de8e7={};var _0x2c11e7={};var _0x4fa194;var _0x1168e8;return db[_0xa246('0x39')][_0xa246('0x45')]({'where':{'id':_0x348b99['params']['id']}})[_0xa246('0x3b')](handleEntityNotFound(_0x226e73,null))[_0xa246('0x3b')](function(_0x3b7e88){if(_0x3b7e88){_0x4fa194=_0x3b7e88;_0x2c11e7['model']=_[_0xa246('0x2a')](db[_0xa246('0x46')][_0xa246('0x24')]);_0x2c11e7[_0xa246('0x2b')]=_[_0xa246('0x2a')](_0x348b99[_0xa246('0x2b')]);_0x2c11e7['filters']=_[_0xa246('0x2d')](_0x2c11e7[_0xa246('0x28')],_0x2c11e7[_0xa246('0x2b')]);_0x1de8e7[_0xa246('0x2c')]=_['intersection'](_0x2c11e7['model'],qs['fields'](_0x348b99['query'][_0xa246('0x2e')]));_0x1de8e7[_0xa246('0x2c')]=_0x1de8e7[_0xa246('0x2c')][_0xa246('0x2f')]?_0x1de8e7[_0xa246('0x2c')]:_0x2c11e7[_0xa246('0x28')];_0x1de8e7[_0xa246('0x47')]=qs[_0xa246('0x31')](_0x348b99[_0xa246('0x2b')][_0xa246('0x31')]);_0x1de8e7[_0xa246('0x32')]=qs[_0xa246('0x33')](_[_0xa246('0x48')](_0x348b99[_0xa246('0x2b')],_0x2c11e7['filters']));if(_0x348b99[_0xa246('0x2b')][_0xa246('0x35')]){_0x1de8e7[_0xa246('0x32')]=_[_0xa246('0x34')](_0x1de8e7[_0xa246('0x32')],{'$or':_[_0xa246('0x23')](_0x1de8e7[_0xa246('0x2c')],function(_0x3d8182){var _0x15eba2={};_0x15eba2[_0x3d8182]={'$like':'%'+_0x348b99['query'][_0xa246('0x35')]+'%'};return _0x15eba2;})});}_0x1de8e7=_[_0xa246('0x34')]({},_0x1de8e7,_0x348b99[_0xa246('0x36')]);return _0x4fa194[_0xa246('0x44')](_0x1de8e7);}})[_0xa246('0x3b')](function(_0x255b26){if(_0x255b26){_0x1168e8=_0x255b26[_0xa246('0x2f')];if(!_0x348b99[_0xa246('0x2b')][_0xa246('0x49')]('nolimit')){_0x1de8e7[_0xa246('0x1b')]=qs[_0xa246('0x1b')](_0x348b99[_0xa246('0x2b')][_0xa246('0x1b')]);_0x1de8e7[_0xa246('0x19')]=qs[_0xa246('0x19')](_0x348b99[_0xa246('0x2b')]['offset']);}return _0x4fa194[_0xa246('0x44')](_0x1de8e7);}})[_0xa246('0x3b')](function(_0x4f0ee6){if(_0x4f0ee6){return _0x4f0ee6?{'count':_0x1168e8,'rows':_0x4f0ee6}:null;}})[_0xa246('0x3b')](respondWithResult(_0x226e73,null))[_0xa246('0x3d')](handleError(_0x226e73,null));};exports[_0xa246('0x4a')]=function(_0x2530b2,_0x2dba97,_0x1516f9){var _0x5ebb92={};var _0x48d8c9={};var _0x357047;var _0x293289;return db['Dynamics365Configuration'][_0xa246('0x45')]({'where':{'id':_0x2530b2[_0xa246('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2dba97,null))[_0xa246('0x3b')](function(_0x39010a){if(_0x39010a){_0x357047=_0x39010a;_0x48d8c9[_0xa246('0x28')]=_[_0xa246('0x2a')](db['Dynamics365Field'][_0xa246('0x24')]);_0x48d8c9['query']=_['keys'](_0x2530b2[_0xa246('0x2b')]);_0x48d8c9[_0xa246('0x33')]=_['intersection'](_0x48d8c9[_0xa246('0x28')],_0x48d8c9['query']);_0x5ebb92[_0xa246('0x2c')]=_[_0xa246('0x2d')](_0x48d8c9['model'],qs[_0xa246('0x2e')](_0x2530b2[_0xa246('0x2b')][_0xa246('0x2e')]));_0x5ebb92[_0xa246('0x2c')]=_0x5ebb92[_0xa246('0x2c')][_0xa246('0x2f')]?_0x5ebb92[_0xa246('0x2c')]:_0x48d8c9['model'];_0x5ebb92[_0xa246('0x47')]=qs[_0xa246('0x31')](_0x2530b2[_0xa246('0x2b')]['sort']);_0x5ebb92[_0xa246('0x32')]=qs['filters'](_[_0xa246('0x48')](_0x2530b2[_0xa246('0x2b')],_0x48d8c9[_0xa246('0x33')]));if(_0x2530b2['query'][_0xa246('0x35')]){_0x5ebb92[_0xa246('0x32')]=_[_0xa246('0x34')](_0x5ebb92[_0xa246('0x32')],{'$or':_[_0xa246('0x23')](_0x5ebb92[_0xa246('0x2c')],function(_0x2ae840){var _0x95ce29={};_0x95ce29[_0x2ae840]={'$like':'%'+_0x2530b2[_0xa246('0x2b')]['filter']+'%'};return _0x95ce29;})});}_0x5ebb92=_[_0xa246('0x34')]({},_0x5ebb92,_0x2530b2['options']);return _0x357047[_0xa246('0x4a')](_0x5ebb92);}})[_0xa246('0x3b')](function(_0x48ce35){if(_0x48ce35){_0x293289=_0x48ce35['length'];if(!_0x2530b2[_0xa246('0x2b')][_0xa246('0x49')]('nolimit')){_0x5ebb92['limit']=qs[_0xa246('0x1b')](_0x2530b2['query']['limit']);_0x5ebb92['offset']=qs[_0xa246('0x19')](_0x2530b2['query'][_0xa246('0x19')]);}return _0x357047[_0xa246('0x4a')](_0x5ebb92);}})[_0xa246('0x3b')](function(_0x4bef7f){if(_0x4bef7f){return _0x4bef7f?{'count':_0x293289,'rows':_0x4bef7f}:null;}})['then'](respondWithResult(_0x2dba97,null))[_0xa246('0x3d')](handleError(_0x2dba97,null));};exports['getDescriptions']=function(_0x3c2db5,_0x3260a1,_0x18b863){var _0x3dd669={};var _0x2b961f={};var _0x5ca3c4;var _0x26ddac;return db[_0xa246('0x39')][_0xa246('0x45')]({'where':{'id':_0x3c2db5[_0xa246('0x3f')]['id']}})[_0xa246('0x3b')](handleEntityNotFound(_0x3260a1,null))[_0xa246('0x3b')](function(_0x35ff05){if(_0x35ff05){_0x5ca3c4=_0x35ff05;_0x2b961f[_0xa246('0x28')]=_[_0xa246('0x2a')](db[_0xa246('0x46')][_0xa246('0x24')]);_0x2b961f[_0xa246('0x2b')]=_['keys'](_0x3c2db5[_0xa246('0x2b')]);_0x2b961f[_0xa246('0x33')]=_[_0xa246('0x2d')](_0x2b961f[_0xa246('0x28')],_0x2b961f[_0xa246('0x2b')]);_0x3dd669[_0xa246('0x2c')]=_[_0xa246('0x2d')](_0x2b961f[_0xa246('0x28')],qs[_0xa246('0x2e')](_0x3c2db5[_0xa246('0x2b')][_0xa246('0x2e')]));_0x3dd669[_0xa246('0x2c')]=_0x3dd669[_0xa246('0x2c')][_0xa246('0x2f')]?_0x3dd669[_0xa246('0x2c')]:_0x2b961f[_0xa246('0x28')];_0x3dd669[_0xa246('0x47')]=qs[_0xa246('0x31')](_0x3c2db5[_0xa246('0x2b')]['sort']);_0x3dd669[_0xa246('0x32')]=qs[_0xa246('0x33')](_['pick'](_0x3c2db5['query'],_0x2b961f['filters']));if(_0x3c2db5['query'][_0xa246('0x35')]){_0x3dd669[_0xa246('0x32')]=_[_0xa246('0x34')](_0x3dd669[_0xa246('0x32')],{'$or':_['map'](_0x3dd669[_0xa246('0x2c')],function(_0x5ef7fc){var _0x150de7={};_0x150de7[_0x5ef7fc]={'$like':'%'+_0x3c2db5['query'][_0xa246('0x35')]+'%'};return _0x150de7;})});}_0x3dd669=_[_0xa246('0x34')]({},_0x3dd669,_0x3c2db5['options']);return _0x5ca3c4[_0xa246('0x4b')](_0x3dd669);}})[_0xa246('0x3b')](function(_0x24281e){if(_0x24281e){_0x26ddac=_0x24281e['length'];if(!_0x3c2db5[_0xa246('0x2b')][_0xa246('0x49')]('nolimit')){_0x3dd669['limit']=qs[_0xa246('0x1b')](_0x3c2db5[_0xa246('0x2b')][_0xa246('0x1b')]);_0x3dd669['offset']=qs[_0xa246('0x19')](_0x3c2db5['query'][_0xa246('0x19')]);}return _0x5ca3c4[_0xa246('0x4b')](_0x3dd669);}})[_0xa246('0x3b')](function(_0x2adf9e){if(_0x2adf9e){return _0x2adf9e?{'count':_0x26ddac,'rows':_0x2adf9e}:null;}})[_0xa246('0x3b')](respondWithResult(_0x3260a1,null))['catch'](handleError(_0x3260a1,null));}; \ No newline at end of file +var _0xcbab=['Content-Range','apply','reject','save','update','destroy','then','end','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','keys','fields','find','create','params','body','getFields','findOne','Dynamics365Field','pick','options','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit'];(function(_0x6fbc80,_0x355ace){var _0x57c2ff=function(_0x2f7b5c){while(--_0x2f7b5c){_0x6fbc80['push'](_0x6fbc80['shift']());}};_0x57c2ff(++_0x355ace);}(_0xcbab,0x15b));var _0xbcba=function(_0xf83277,_0x55487e){_0xf83277=_0xf83277-0x0;var _0x361e0e=_0xcbab[_0xf83277];return _0x361e0e;};'use strict';var emlformat=require(_0xbcba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcba('0x1'));var jsonpatch=require(_0xbcba('0x2'));var rp=require(_0xbcba('0x3'));var moment=require('moment');var BPromise=require(_0xbcba('0x4'));var Mustache=require(_0xbcba('0x5'));var util=require(_0xbcba('0x6'));var path=require(_0xbcba('0x7'));var sox=require(_0xbcba('0x8'));var csv=require(_0xbcba('0x9'));var ejs=require(_0xbcba('0xa'));var fs=require('fs');var fs_extra=require(_0xbcba('0xb'));var _=require(_0xbcba('0xc'));var squel=require(_0xbcba('0xd'));var crypto=require(_0xbcba('0xe'));var jsforce=require(_0xbcba('0xf'));var deskjs=require(_0xbcba('0x10'));var toCsv=require(_0xbcba('0x9'));var querystring=require(_0xbcba('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcba('0x12'));var logger=require(_0xbcba('0x13'))('api');var utils=require(_0xbcba('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbcba('0x15'))['db'];function respondWithStatusCode(_0x491fae,_0x2a01af){_0x2a01af=_0x2a01af||0xcc;return function(_0x1bf57){if(_0x1bf57){return _0x491fae[_0xbcba('0x16')](_0x2a01af);}return _0x491fae[_0xbcba('0x17')](_0x2a01af)['end']();};}function respondWithResult(_0x49435d,_0xe11c24){_0xe11c24=_0xe11c24||0xc8;return function(_0x2fe08d){if(_0x2fe08d){return _0x49435d[_0xbcba('0x17')](_0xe11c24)['json'](_0x2fe08d);}};}function respondWithFilteredResult(_0x41e181,_0x3cfe07){return function(_0x5ae3e0){if(_0x5ae3e0){var _0xcde746=typeof _0x3cfe07[_0xbcba('0x18')]==='undefined'&&typeof _0x3cfe07['limit']===_0xbcba('0x19');var _0x328bfd=_0x5ae3e0[_0xbcba('0x1a')];var _0x192250=_0xcde746?0x0:_0x3cfe07['offset'];var _0x57f9da=_0xcde746?_0x5ae3e0[_0xbcba('0x1a')]:_0x3cfe07[_0xbcba('0x18')]+_0x3cfe07[_0xbcba('0x1b')];var _0x5cae2f;if(_0x57f9da>=_0x328bfd){_0x57f9da=_0x328bfd;_0x5cae2f=0xc8;}else{_0x5cae2f=0xce;}_0x41e181[_0xbcba('0x17')](_0x5cae2f);return _0x41e181['set'](_0xbcba('0x1c'),_0x192250+'-'+_0x57f9da+'/'+_0x328bfd)['json'](_0x5ae3e0);}return null;};}function patchUpdates(_0x3a7f4d){return function(_0x52f225){try{jsonpatch[_0xbcba('0x1d')](_0x52f225,_0x3a7f4d,!![]);}catch(_0x37d830){return BPromise[_0xbcba('0x1e')](_0x37d830);}return _0x52f225[_0xbcba('0x1f')]();};}function saveUpdates(_0x13973c,_0x5bb87e){return function(_0x375fe3){if(_0x375fe3){return _0x375fe3[_0xbcba('0x20')](_0x13973c)['then'](function(_0x2b7e45){return _0x2b7e45;});}return null;};}function removeEntity(_0x40102a,_0x8f45a1){return function(_0xf11e81){if(_0xf11e81){return _0xf11e81[_0xbcba('0x21')]()[_0xbcba('0x22')](function(){_0x40102a[_0xbcba('0x17')](0xcc)[_0xbcba('0x23')]();});}};}function handleEntityNotFound(_0x1f0376,_0x811d26){return function(_0x10e64f){if(!_0x10e64f){_0x1f0376[_0xbcba('0x16')](0x194);}return _0x10e64f;};}function handleError(_0x3e98a3,_0x2875b5){_0x2875b5=_0x2875b5||0x1f4;return function(_0xa9de2c){logger['error'](_0xa9de2c['stack']);if(_0xa9de2c[_0xbcba('0x24')]){delete _0xa9de2c[_0xbcba('0x24')];}_0x3e98a3[_0xbcba('0x17')](_0x2875b5)[_0xbcba('0x25')](_0xa9de2c);};}exports['index']=function(_0x45444f,_0x5bd2b5){var _0x33fe50={},_0x250cca={},_0x192a93={'count':0x0,'rows':[]};var _0x4a50d6=_[_0xbcba('0x26')](db[_0xbcba('0x27')][_0xbcba('0x28')],function(_0xa71265){return{'name':_0xa71265[_0xbcba('0x29')],'type':_0xa71265[_0xbcba('0x2a')][_0xbcba('0x2b')]};});_0x250cca[_0xbcba('0x2c')]=_[_0xbcba('0x26')](_0x4a50d6,_0xbcba('0x24'));_0x250cca[_0xbcba('0x2d')]=_['keys'](_0x45444f[_0xbcba('0x2d')]);_0x250cca['filters']=_[_0xbcba('0x2e')](_0x250cca[_0xbcba('0x2c')],_0x250cca['query']);_0x33fe50[_0xbcba('0x2f')]=_[_0xbcba('0x2e')](_0x250cca[_0xbcba('0x2c')],qs['fields'](_0x45444f[_0xbcba('0x2d')]['fields']));_0x33fe50[_0xbcba('0x2f')]=_0x33fe50[_0xbcba('0x2f')][_0xbcba('0x30')]?_0x33fe50[_0xbcba('0x2f')]:_0x250cca[_0xbcba('0x2c')];if(!_0x45444f[_0xbcba('0x2d')]['hasOwnProperty'](_0xbcba('0x31'))){_0x33fe50[_0xbcba('0x1b')]=qs[_0xbcba('0x1b')](_0x45444f['query']['limit']);_0x33fe50[_0xbcba('0x18')]=qs[_0xbcba('0x18')](_0x45444f['query'][_0xbcba('0x18')]);}_0x33fe50[_0xbcba('0x32')]=qs[_0xbcba('0x33')](_0x45444f[_0xbcba('0x2d')][_0xbcba('0x33')]);_0x33fe50['where']=qs['filters'](_['pick'](_0x45444f[_0xbcba('0x2d')],_0x250cca[_0xbcba('0x34')]),_0x4a50d6);if(_0x45444f['query'][_0xbcba('0x35')]){_0x33fe50[_0xbcba('0x36')]=_[_0xbcba('0x37')](_0x33fe50[_0xbcba('0x36')],{'$or':_['map'](_0x4a50d6,function(_0x52b37e){if(_0x52b37e[_0xbcba('0x2a')]!==_0xbcba('0x38')){var _0x411d56={};_0x411d56[_0x52b37e['name']]={'$like':'%'+_0x45444f['query'][_0xbcba('0x35')]+'%'};return _0x411d56;}})});}_0x33fe50=_[_0xbcba('0x37')]({},_0x33fe50,_0x45444f['options']);var _0x4f7f38={'where':_0x33fe50[_0xbcba('0x36')]};return db[_0xbcba('0x27')][_0xbcba('0x1a')](_0x4f7f38)[_0xbcba('0x22')](function(_0x2d0a86){_0x192a93[_0xbcba('0x1a')]=_0x2d0a86;if(_0x45444f['query'][_0xbcba('0x39')]){_0x33fe50['include']=[{'all':!![]}];}return db[_0xbcba('0x27')]['findAll'](_0x33fe50);})[_0xbcba('0x22')](function(_0x18fd2b){_0x192a93[_0xbcba('0x3a')]=_0x18fd2b;return _0x192a93;})[_0xbcba('0x22')](respondWithFilteredResult(_0x5bd2b5,_0x33fe50))[_0xbcba('0x3b')](handleError(_0x5bd2b5,null));};exports[_0xbcba('0x3c')]=function(_0x444d0f,_0x1048bb){var _0x5ab1a5={'raw':![],'where':{'id':_0x444d0f['params']['id']}},_0x2e0ebc={};_0x2e0ebc['model']=_[_0xbcba('0x3d')](db[_0xbcba('0x27')][_0xbcba('0x28')]);_0x2e0ebc[_0xbcba('0x2d')]=_[_0xbcba('0x3d')](_0x444d0f[_0xbcba('0x2d')]);_0x2e0ebc[_0xbcba('0x34')]=_[_0xbcba('0x2e')](_0x2e0ebc['model'],_0x2e0ebc[_0xbcba('0x2d')]);_0x5ab1a5[_0xbcba('0x2f')]=_[_0xbcba('0x2e')](_0x2e0ebc[_0xbcba('0x2c')],qs['fields'](_0x444d0f['query'][_0xbcba('0x3e')]));_0x5ab1a5[_0xbcba('0x2f')]=_0x5ab1a5[_0xbcba('0x2f')][_0xbcba('0x30')]?_0x5ab1a5[_0xbcba('0x2f')]:_0x2e0ebc[_0xbcba('0x2c')];if(_0x444d0f[_0xbcba('0x2d')][_0xbcba('0x39')]){_0x5ab1a5['include']=[{'all':!![]}];}_0x5ab1a5=_[_0xbcba('0x37')]({},_0x5ab1a5,_0x444d0f['options']);return db[_0xbcba('0x27')][_0xbcba('0x3f')](_0x5ab1a5)['then'](handleEntityNotFound(_0x1048bb,null))['then'](respondWithResult(_0x1048bb,null))[_0xbcba('0x3b')](handleError(_0x1048bb,null));};exports[_0xbcba('0x40')]=function(_0x12388f,_0x58fae8){return db['Dynamics365Configuration'][_0xbcba('0x40')](_0x12388f['body'],{})['then'](respondWithResult(_0x58fae8,0xc9))[_0xbcba('0x3b')](handleError(_0x58fae8,null));};exports[_0xbcba('0x20')]=function(_0x159f0c,_0x1777c6){if(_0x159f0c['body']['id']){delete _0x159f0c['body']['id'];}return db[_0xbcba('0x27')][_0xbcba('0x3f')]({'where':{'id':_0x159f0c[_0xbcba('0x41')]['id']}})['then'](handleEntityNotFound(_0x1777c6,null))[_0xbcba('0x22')](saveUpdates(_0x159f0c[_0xbcba('0x42')],null))[_0xbcba('0x22')](respondWithResult(_0x1777c6,null))[_0xbcba('0x3b')](handleError(_0x1777c6,null));};exports[_0xbcba('0x21')]=function(_0x1390c9,_0x3af611){return db[_0xbcba('0x27')]['find']({'where':{'id':_0x1390c9['params']['id']}})[_0xbcba('0x22')](handleEntityNotFound(_0x3af611,null))['then'](removeEntity(_0x3af611,null))['catch'](handleError(_0x3af611,null));};exports[_0xbcba('0x43')]=function(_0x538f35,_0x20adb7,_0x103231){var _0x491b1e={};var _0x2cd662={};var _0xfdcde1;var _0x2373e7;return db[_0xbcba('0x27')][_0xbcba('0x44')]({'where':{'id':_0x538f35[_0xbcba('0x41')]['id']}})['then'](handleEntityNotFound(_0x20adb7,null))[_0xbcba('0x22')](function(_0x559b08){if(_0x559b08){_0xfdcde1=_0x559b08;_0x2cd662['model']=_[_0xbcba('0x3d')](db[_0xbcba('0x45')][_0xbcba('0x28')]);_0x2cd662[_0xbcba('0x2d')]=_[_0xbcba('0x3d')](_0x538f35[_0xbcba('0x2d')]);_0x2cd662[_0xbcba('0x34')]=_['intersection'](_0x2cd662[_0xbcba('0x2c')],_0x2cd662[_0xbcba('0x2d')]);_0x491b1e[_0xbcba('0x2f')]=_[_0xbcba('0x2e')](_0x2cd662[_0xbcba('0x2c')],qs['fields'](_0x538f35[_0xbcba('0x2d')][_0xbcba('0x3e')]));_0x491b1e['attributes']=_0x491b1e[_0xbcba('0x2f')]['length']?_0x491b1e['attributes']:_0x2cd662[_0xbcba('0x2c')];_0x491b1e['order']=qs[_0xbcba('0x33')](_0x538f35[_0xbcba('0x2d')][_0xbcba('0x33')]);_0x491b1e[_0xbcba('0x36')]=qs[_0xbcba('0x34')](_[_0xbcba('0x46')](_0x538f35[_0xbcba('0x2d')],_0x2cd662[_0xbcba('0x34')]));if(_0x538f35[_0xbcba('0x2d')][_0xbcba('0x35')]){_0x491b1e[_0xbcba('0x36')]=_[_0xbcba('0x37')](_0x491b1e[_0xbcba('0x36')],{'$or':_[_0xbcba('0x26')](_0x491b1e[_0xbcba('0x2f')],function(_0x4f0c4a){var _0x50d981={};_0x50d981[_0x4f0c4a]={'$like':'%'+_0x538f35['query'][_0xbcba('0x35')]+'%'};return _0x50d981;})});}_0x491b1e=_[_0xbcba('0x37')]({},_0x491b1e,_0x538f35[_0xbcba('0x47')]);return _0xfdcde1[_0xbcba('0x43')](_0x491b1e);}})[_0xbcba('0x22')](function(_0x2ea0e9){if(_0x2ea0e9){_0x2373e7=_0x2ea0e9['length'];if(!_0x538f35[_0xbcba('0x2d')][_0xbcba('0x48')]('nolimit')){_0x491b1e['limit']=qs[_0xbcba('0x1b')](_0x538f35['query'][_0xbcba('0x1b')]);_0x491b1e[_0xbcba('0x18')]=qs[_0xbcba('0x18')](_0x538f35[_0xbcba('0x2d')][_0xbcba('0x18')]);}return _0xfdcde1[_0xbcba('0x43')](_0x491b1e);}})['then'](function(_0x39b478){if(_0x39b478){return _0x39b478?{'count':_0x2373e7,'rows':_0x39b478}:null;}})['then'](respondWithResult(_0x20adb7,null))[_0xbcba('0x3b')](handleError(_0x20adb7,null));};exports[_0xbcba('0x49')]=function(_0x1ff7fb,_0x3dbb70,_0x5cbb34){var _0x4884e3={};var _0x53b769={};var _0x109db9;var _0x2d9dbb;return db[_0xbcba('0x27')][_0xbcba('0x44')]({'where':{'id':_0x1ff7fb['params']['id']}})[_0xbcba('0x22')](handleEntityNotFound(_0x3dbb70,null))['then'](function(_0x1629dd){if(_0x1629dd){_0x109db9=_0x1629dd;_0x53b769[_0xbcba('0x2c')]=_[_0xbcba('0x3d')](db[_0xbcba('0x45')][_0xbcba('0x28')]);_0x53b769[_0xbcba('0x2d')]=_[_0xbcba('0x3d')](_0x1ff7fb[_0xbcba('0x2d')]);_0x53b769['filters']=_[_0xbcba('0x2e')](_0x53b769[_0xbcba('0x2c')],_0x53b769[_0xbcba('0x2d')]);_0x4884e3[_0xbcba('0x2f')]=_['intersection'](_0x53b769[_0xbcba('0x2c')],qs[_0xbcba('0x3e')](_0x1ff7fb['query'][_0xbcba('0x3e')]));_0x4884e3[_0xbcba('0x2f')]=_0x4884e3[_0xbcba('0x2f')]['length']?_0x4884e3[_0xbcba('0x2f')]:_0x53b769[_0xbcba('0x2c')];_0x4884e3[_0xbcba('0x32')]=qs[_0xbcba('0x33')](_0x1ff7fb[_0xbcba('0x2d')][_0xbcba('0x33')]);_0x4884e3[_0xbcba('0x36')]=qs['filters'](_[_0xbcba('0x46')](_0x1ff7fb['query'],_0x53b769[_0xbcba('0x34')]));if(_0x1ff7fb[_0xbcba('0x2d')]['filter']){_0x4884e3[_0xbcba('0x36')]=_[_0xbcba('0x37')](_0x4884e3[_0xbcba('0x36')],{'$or':_[_0xbcba('0x26')](_0x4884e3[_0xbcba('0x2f')],function(_0x16236c){var _0x13ce89={};_0x13ce89[_0x16236c]={'$like':'%'+_0x1ff7fb[_0xbcba('0x2d')][_0xbcba('0x35')]+'%'};return _0x13ce89;})});}_0x4884e3=_['merge']({},_0x4884e3,_0x1ff7fb['options']);return _0x109db9[_0xbcba('0x49')](_0x4884e3);}})['then'](function(_0x2a4fb8){if(_0x2a4fb8){_0x2d9dbb=_0x2a4fb8[_0xbcba('0x30')];if(!_0x1ff7fb[_0xbcba('0x2d')][_0xbcba('0x48')]('nolimit')){_0x4884e3[_0xbcba('0x1b')]=qs['limit'](_0x1ff7fb[_0xbcba('0x2d')]['limit']);_0x4884e3[_0xbcba('0x18')]=qs['offset'](_0x1ff7fb['query'][_0xbcba('0x18')]);}return _0x109db9[_0xbcba('0x49')](_0x4884e3);}})['then'](function(_0x50e571){if(_0x50e571){return _0x50e571?{'count':_0x2d9dbb,'rows':_0x50e571}:null;}})[_0xbcba('0x22')](respondWithResult(_0x3dbb70,null))[_0xbcba('0x3b')](handleError(_0x3dbb70,null));};exports[_0xbcba('0x4a')]=function(_0x2e2162,_0x43c293,_0x26383b){var _0x8a533a={};var _0x82b1ab={};var _0x10c2f5;var _0x222aae;return db['Dynamics365Configuration'][_0xbcba('0x44')]({'where':{'id':_0x2e2162[_0xbcba('0x41')]['id']}})[_0xbcba('0x22')](handleEntityNotFound(_0x43c293,null))[_0xbcba('0x22')](function(_0x43be83){if(_0x43be83){_0x10c2f5=_0x43be83;_0x82b1ab[_0xbcba('0x2c')]=_[_0xbcba('0x3d')](db[_0xbcba('0x45')][_0xbcba('0x28')]);_0x82b1ab[_0xbcba('0x2d')]=_[_0xbcba('0x3d')](_0x2e2162[_0xbcba('0x2d')]);_0x82b1ab['filters']=_[_0xbcba('0x2e')](_0x82b1ab[_0xbcba('0x2c')],_0x82b1ab['query']);_0x8a533a[_0xbcba('0x2f')]=_[_0xbcba('0x2e')](_0x82b1ab[_0xbcba('0x2c')],qs['fields'](_0x2e2162[_0xbcba('0x2d')][_0xbcba('0x3e')]));_0x8a533a['attributes']=_0x8a533a[_0xbcba('0x2f')][_0xbcba('0x30')]?_0x8a533a[_0xbcba('0x2f')]:_0x82b1ab[_0xbcba('0x2c')];_0x8a533a[_0xbcba('0x32')]=qs[_0xbcba('0x33')](_0x2e2162[_0xbcba('0x2d')][_0xbcba('0x33')]);_0x8a533a[_0xbcba('0x36')]=qs[_0xbcba('0x34')](_[_0xbcba('0x46')](_0x2e2162[_0xbcba('0x2d')],_0x82b1ab[_0xbcba('0x34')]));if(_0x2e2162[_0xbcba('0x2d')]['filter']){_0x8a533a[_0xbcba('0x36')]=_[_0xbcba('0x37')](_0x8a533a[_0xbcba('0x36')],{'$or':_[_0xbcba('0x26')](_0x8a533a['attributes'],function(_0x324464){var _0xfa4ffc={};_0xfa4ffc[_0x324464]={'$like':'%'+_0x2e2162[_0xbcba('0x2d')][_0xbcba('0x35')]+'%'};return _0xfa4ffc;})});}_0x8a533a=_[_0xbcba('0x37')]({},_0x8a533a,_0x2e2162[_0xbcba('0x47')]);return _0x10c2f5[_0xbcba('0x4a')](_0x8a533a);}})[_0xbcba('0x22')](function(_0x5206ab){if(_0x5206ab){_0x222aae=_0x5206ab['length'];if(!_0x2e2162[_0xbcba('0x2d')][_0xbcba('0x48')](_0xbcba('0x31'))){_0x8a533a['limit']=qs['limit'](_0x2e2162[_0xbcba('0x2d')][_0xbcba('0x1b')]);_0x8a533a[_0xbcba('0x18')]=qs['offset'](_0x2e2162['query'][_0xbcba('0x18')]);}return _0x10c2f5[_0xbcba('0x4a')](_0x8a533a);}})[_0xbcba('0x22')](function(_0x3dc8e0){if(_0x3dc8e0){return _0x3dc8e0?{'count':_0x222aae,'rows':_0x3dc8e0}:null;}})['then'](respondWithResult(_0x43c293,null))[_0xbcba('0x3b')](handleError(_0x43c293,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ca8a236..ce9bdb7 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x1cb940,_0x527bef){var _0x131614=function(_0x1a135e){while(--_0x1a135e){_0x1cb940['push'](_0x1cb940['shift']());}};_0x131614(++_0x527bef);}(_0xdace,0xc5));var _0xedac=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xdace[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5cd057,_0x334ca4){var _0x2adca5=function(_0x199596){while(--_0x199596){_0x5cd057['push'](_0x5cd057['shift']());}};_0x2adca5(++_0x334ca4);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x530eae,_0x54ebaf){_0x530eae=_0x530eae-0x0;var _0x3fd0bd=_0xd6d6[_0x530eae];return _0x3fd0bd;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index eaa261b..e713f4a 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 _0xc6bf=['client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11cde6,_0x5078c7){var _0x549d4e=function(_0xad2979){while(--_0xad2979){_0x11cde6['push'](_0x11cde6['shift']());}};_0x549d4e(++_0x5078c7);}(_0xc6bf,0xf3));var _0xfc6b=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0xc6bf[_0x2a98e3];return _0x370a71;};'use strict';var _=require(_0xfc6b('0x0'));var util=require(_0xfc6b('0x1'));var moment=require(_0xfc6b('0x2'));var BPromise=require(_0xfc6b('0x3'));var rs=require(_0xfc6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc6b('0x6'))(_0xfc6b('0x7'));var config=require(_0xfc6b('0x8'));var jayson=require(_0xfc6b('0x9'));var client=jayson[_0xfc6b('0xa')][_0xfc6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294a90,_0x2bb52e,_0xead74b){return new BPromise(function(_0x29c65e,_0x42e7d0){return client[_0xfc6b('0xc')](_0x294a90,_0xead74b)['then'](function(_0x44cba2){logger[_0xfc6b('0xd')](_0xfc6b('0xe'),_0x2bb52e,_0xfc6b('0xf'));logger[_0xfc6b('0x10')](_0xfc6b('0x11'),_0x2bb52e,_0xfc6b('0xf'),JSON[_0xfc6b('0x12')](_0x44cba2));if(_0x44cba2[_0xfc6b('0x13')]){if(_0x44cba2[_0xfc6b('0x13')]['code']===0x1f4){logger[_0xfc6b('0x13')](_0xfc6b('0xe'),_0x2bb52e,_0x44cba2[_0xfc6b('0x13')][_0xfc6b('0x14')]);return _0x42e7d0(_0x44cba2[_0xfc6b('0x13')][_0xfc6b('0x14')]);}logger[_0xfc6b('0x13')](_0xfc6b('0xe'),_0x2bb52e,_0x44cba2[_0xfc6b('0x13')][_0xfc6b('0x14')]);return _0x29c65e(_0x44cba2[_0xfc6b('0x13')][_0xfc6b('0x14')]);}else{logger['info'](_0xfc6b('0xe'),_0x2bb52e,_0xfc6b('0xf'));_0x29c65e(_0x44cba2[_0xfc6b('0x15')][_0xfc6b('0x14')]);}})[_0xfc6b('0x16')](function(_0x5ac1f7){logger[_0xfc6b('0x13')](_0xfc6b('0xe'),_0x2bb52e,_0x5ac1f7);_0x42e7d0(_0x5ac1f7);});});} \ No newline at end of file +var _0x000a=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x298538,_0x5dfe39){var _0x3ac40a=function(_0x5b20a6){while(--_0x5b20a6){_0x298538['push'](_0x298538['shift']());}};_0x3ac40a(++_0x5dfe39);}(_0x000a,0x13a));var _0xa000=function(_0x35b1de,_0x2df5b3){_0x35b1de=_0x35b1de-0x0;var _0x115f69=_0x000a[_0x35b1de];return _0x115f69;};'use strict';var _=require(_0xa000('0x0'));var util=require(_0xa000('0x1'));var moment=require('moment');var BPromise=require(_0xa000('0x2'));var rs=require(_0xa000('0x3'));var fs=require('fs');var Redis=require(_0xa000('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa000('0x5'));var config=require(_0xa000('0x6'));var jayson=require(_0xa000('0x7'));var client=jayson['client'][_0xa000('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a1a8e,_0x54cf26,_0x49eed9){return new BPromise(function(_0x2dd6cc,_0x48a342){return client[_0xa000('0x9')](_0x1a1a8e,_0x49eed9)[_0xa000('0xa')](function(_0x114717){logger[_0xa000('0xb')](_0xa000('0xc'),_0x54cf26,'request\x20sent');logger[_0xa000('0xd')](_0xa000('0xe'),_0x54cf26,_0xa000('0xf'),JSON[_0xa000('0x10')](_0x114717));if(_0x114717[_0xa000('0x11')]){if(_0x114717[_0xa000('0x11')][_0xa000('0x12')]===0x1f4){logger[_0xa000('0x11')](_0xa000('0xc'),_0x54cf26,_0x114717['error']['message']);return _0x48a342(_0x114717[_0xa000('0x11')][_0xa000('0x13')]);}logger[_0xa000('0x11')](_0xa000('0xc'),_0x54cf26,_0x114717['error'][_0xa000('0x13')]);return _0x2dd6cc(_0x114717[_0xa000('0x11')][_0xa000('0x13')]);}else{logger['info'](_0xa000('0xc'),_0x54cf26,_0xa000('0xf'));_0x2dd6cc(_0x114717[_0xa000('0x14')][_0xa000('0x13')]);}})[_0xa000('0x15')](function(_0x4a3ad7){logger[_0xa000('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x54cf26,_0x4a3ad7);_0x48a342(_0x4a3ad7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 13c688d..089ddd2 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 _0x0951=['../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x43073b,_0x26cd7c){var _0x5210e3=function(_0x12e176){while(--_0x12e176){_0x43073b['push'](_0x43073b['shift']());}};_0x5210e3(++_0x26cd7c);}(_0x0951,0x150));var _0x1095=function(_0x356386,_0x4e5408){_0x356386=_0x356386-0x0;var _0x5b2c73=_0x0951[_0x356386];return _0x5b2c73;};'use strict';var multer=require(_0x1095('0x0'));var util=require(_0x1095('0x1'));var path=require(_0x1095('0x2'));var timeout=require(_0x1095('0x3'));var express=require(_0x1095('0x4'));var router=express['Router']();var fs_extra=require(_0x1095('0x5'));var auth=require(_0x1095('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1095('0x7'));var controller=require(_0x1095('0x8'));router[_0x1095('0x9')]('/',auth[_0x1095('0xa')](),controller[_0x1095('0xb')]);router[_0x1095('0x9')](_0x1095('0xc'),auth[_0x1095('0xa')](),controller['show']);router[_0x1095('0xd')]('/',auth['isAuthenticated'](),controller[_0x1095('0xe')]);router[_0x1095('0xf')](_0x1095('0xc'),auth[_0x1095('0xa')](),controller['update']);router[_0x1095('0x10')]('/:id',auth[_0x1095('0xa')](),controller['destroy']);module[_0x1095('0x11')]=router; \ No newline at end of file +var _0xa5f1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa5f1,0x74));var _0x1a5f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa5f1[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x1a5f('0x0'));var util=require(_0x1a5f('0x1'));var path=require(_0x1a5f('0x2'));var timeout=require(_0x1a5f('0x3'));var express=require('express');var router=express[_0x1a5f('0x4')]();var fs_extra=require(_0x1a5f('0x5'));var auth=require(_0x1a5f('0x6'));var interaction=require(_0x1a5f('0x7'));var config=require(_0x1a5f('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x1a5f('0x9')]('/',auth[_0x1a5f('0xa')](),controller[_0x1a5f('0xb')]);router[_0x1a5f('0x9')](_0x1a5f('0xc'),auth['isAuthenticated'](),controller[_0x1a5f('0xd')]);router[_0x1a5f('0xe')]('/',auth[_0x1a5f('0xa')](),controller[_0x1a5f('0xf')]);router[_0x1a5f('0x10')](_0x1a5f('0xc'),auth['isAuthenticated'](),controller[_0x1a5f('0x11')]);router['delete'](_0x1a5f('0xc'),auth[_0x1a5f('0xa')](),controller[_0x1a5f('0x12')]);module[_0x1a5f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2e6fc28..b5ae086 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 _0x00bd=['customVariable','sequelize','exports','string','variable','keyValue','picklist','STRING'];(function(_0x363757,_0x320c00){var _0x29d58e=function(_0x2533ed){while(--_0x2533ed){_0x363757['push'](_0x363757['shift']());}};_0x29d58e(++_0x320c00);}(_0x00bd,0x1d9));var _0xd00b=function(_0x326d65,_0x2c6bd3){_0x326d65=_0x326d65-0x0;var _0x13b540=_0x00bd[_0x326d65];return _0x13b540;};'use strict';var Sequelize=require(_0xd00b('0x0'));module[_0xd00b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd00b('0x2'),_0xd00b('0x3'),'customVariable',_0xd00b('0x4'),_0xd00b('0x5')),'defaultValue':_0xd00b('0x2')},'content':{'type':Sequelize[_0xd00b('0x6')]},'key':{'type':Sequelize[_0xd00b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xd00b('0x7'))},'keyContent':{'type':Sequelize[_0xd00b('0x6')]},'idField':{'type':Sequelize[_0xd00b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd00b('0x6')]}}; \ No newline at end of file +var _0x7dbd=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x4a81cc,_0x3bbf50){var _0x3cc120=function(_0x422bd5){while(--_0x422bd5){_0x4a81cc['push'](_0x4a81cc['shift']());}};_0x3cc120(++_0x3bbf50);}(_0x7dbd,0xa8));var _0xd7db=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0x7dbd[_0x4498a2];return _0x411aa8;};'use strict';var Sequelize=require(_0xd7db('0x0'));module[_0xd7db('0x1')]={'type':{'type':Sequelize[_0xd7db('0x2')](_0xd7db('0x3'),_0xd7db('0x4'),_0xd7db('0x5'),_0xd7db('0x6'),_0xd7db('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd7db('0x8')]},'key':{'type':Sequelize[_0xd7db('0x8')]},'keyType':{'type':Sequelize[_0xd7db('0x2')](_0xd7db('0x3'),'variable',_0xd7db('0x5'))},'keyContent':{'type':Sequelize[_0xd7db('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd7db('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd7db('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d67fb1f..ba77e2c 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 _0xf02e=['fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','Dynamics365Field','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','then','destroy','error','stack','name','send','index','rawAttributes'];(function(_0xd59088,_0x39526f){var _0xb130b9=function(_0x22da31){while(--_0x22da31){_0xd59088['push'](_0xd59088['shift']());}};_0xb130b9(++_0x39526f);}(_0xf02e,0x14c));var _0xef02=function(_0x2ab84a,_0x24cb76){_0x2ab84a=_0x2ab84a-0x0;var _0x5330e1=_0xf02e[_0x2ab84a];return _0x5330e1;};'use strict';var emlformat=require(_0xef02('0x0'));var rimraf=require(_0xef02('0x1'));var zipdir=require(_0xef02('0x2'));var jsonpatch=require(_0xef02('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xef02('0x4'));var Mustache=require(_0xef02('0x5'));var util=require(_0xef02('0x6'));var path=require('path');var sox=require(_0xef02('0x7'));var csv=require('to-csv');var ejs=require(_0xef02('0x8'));var fs=require('fs');var fs_extra=require(_0xef02('0x9'));var _=require(_0xef02('0xa'));var squel=require('squel');var crypto=require(_0xef02('0xb'));var jsforce=require(_0xef02('0xc'));var deskjs=require(_0xef02('0xd'));var toCsv=require(_0xef02('0xe'));var querystring=require(_0xef02('0xf'));var Papa=require(_0xef02('0x10'));var Redis=require('ioredis');var authService=require(_0xef02('0x11'));var qs=require(_0xef02('0x12'));var as=require(_0xef02('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef02('0x14'))(_0xef02('0x15'));var utils=require(_0xef02('0x16'));var config=require(_0xef02('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xef02('0x18'))['db'];function respondWithStatusCode(_0x2e421d,_0x234a62){_0x234a62=_0x234a62||0xcc;return function(_0x5e5c83){if(_0x5e5c83){return _0x2e421d[_0xef02('0x19')](_0x234a62);}return _0x2e421d[_0xef02('0x1a')](_0x234a62)[_0xef02('0x1b')]();};}function respondWithResult(_0x215069,_0x138772){_0x138772=_0x138772||0xc8;return function(_0x156c87){if(_0x156c87){return _0x215069['status'](_0x138772)[_0xef02('0x1c')](_0x156c87);}};}function respondWithFilteredResult(_0xff00a6,_0x53fb1c){return function(_0x52b03b){if(_0x52b03b){var _0x4ef58e=typeof _0x53fb1c[_0xef02('0x1d')]==='undefined'&&typeof _0x53fb1c[_0xef02('0x1e')]===_0xef02('0x1f');var _0x14815a=_0x52b03b[_0xef02('0x20')];var _0x55bfe4=_0x4ef58e?0x0:_0x53fb1c['offset'];var _0x1b2961=_0x4ef58e?_0x52b03b[_0xef02('0x20')]:_0x53fb1c[_0xef02('0x1d')]+_0x53fb1c[_0xef02('0x1e')];var _0xda0bec;if(_0x1b2961>=_0x14815a){_0x1b2961=_0x14815a;_0xda0bec=0xc8;}else{_0xda0bec=0xce;}_0xff00a6[_0xef02('0x1a')](_0xda0bec);return _0xff00a6['set'](_0xef02('0x21'),_0x55bfe4+'-'+_0x1b2961+'/'+_0x14815a)[_0xef02('0x1c')](_0x52b03b);}return null;};}function patchUpdates(_0x39351c){return function(_0x3dc3ed){try{jsonpatch['apply'](_0x3dc3ed,_0x39351c,!![]);}catch(_0x393cae){return BPromise['reject'](_0x393cae);}return _0x3dc3ed[_0xef02('0x22')]();};}function saveUpdates(_0x10afec,_0x50a7d3){return function(_0x166696){if(_0x166696){return _0x166696['update'](_0x10afec)[_0xef02('0x23')](function(_0x1c78e4){return _0x1c78e4;});}return null;};}function removeEntity(_0x76db6,_0x12bdc3){return function(_0x5ad7ec){if(_0x5ad7ec){return _0x5ad7ec[_0xef02('0x24')]()[_0xef02('0x23')](function(){_0x76db6['status'](0xcc)[_0xef02('0x1b')]();});}};}function handleEntityNotFound(_0x110c7e,_0xa5a3df){return function(_0x5a13a9){if(!_0x5a13a9){_0x110c7e[_0xef02('0x19')](0x194);}return _0x5a13a9;};}function handleError(_0x4eb4ba,_0xedd3d6){_0xedd3d6=_0xedd3d6||0x1f4;return function(_0x4916c9){logger[_0xef02('0x25')](_0x4916c9[_0xef02('0x26')]);if(_0x4916c9['name']){delete _0x4916c9[_0xef02('0x27')];}_0x4eb4ba[_0xef02('0x1a')](_0xedd3d6)[_0xef02('0x28')](_0x4916c9);};}exports[_0xef02('0x29')]=function(_0x1142bc,_0x1b765c){var _0x3cf318={},_0x5064a8={},_0x23e58c={'count':0x0,'rows':[]};var _0x184e0d=_['map'](db['Dynamics365Field'][_0xef02('0x2a')],function(_0x1b0055){return{'name':_0x1b0055[_0xef02('0x2b')],'type':_0x1b0055[_0xef02('0x2c')][_0xef02('0x2d')]};});_0x5064a8[_0xef02('0x2e')]=_[_0xef02('0x2f')](_0x184e0d,_0xef02('0x27'));_0x5064a8[_0xef02('0x30')]=_[_0xef02('0x31')](_0x1142bc['query']);_0x5064a8['filters']=_[_0xef02('0x32')](_0x5064a8[_0xef02('0x2e')],_0x5064a8[_0xef02('0x30')]);_0x3cf318[_0xef02('0x33')]=_[_0xef02('0x32')](_0x5064a8[_0xef02('0x2e')],qs[_0xef02('0x34')](_0x1142bc['query'][_0xef02('0x34')]));_0x3cf318['attributes']=_0x3cf318[_0xef02('0x33')][_0xef02('0x35')]?_0x3cf318['attributes']:_0x5064a8[_0xef02('0x2e')];if(!_0x1142bc[_0xef02('0x30')][_0xef02('0x36')](_0xef02('0x37'))){_0x3cf318[_0xef02('0x1e')]=qs['limit'](_0x1142bc[_0xef02('0x30')]['limit']);_0x3cf318[_0xef02('0x1d')]=qs[_0xef02('0x1d')](_0x1142bc[_0xef02('0x30')][_0xef02('0x1d')]);}_0x3cf318[_0xef02('0x38')]=qs[_0xef02('0x39')](_0x1142bc['query'][_0xef02('0x39')]);_0x3cf318[_0xef02('0x3a')]=qs[_0xef02('0x3b')](_[_0xef02('0x3c')](_0x1142bc[_0xef02('0x30')],_0x5064a8[_0xef02('0x3b')]),_0x184e0d);if(_0x1142bc[_0xef02('0x30')][_0xef02('0x3d')]){_0x3cf318[_0xef02('0x3a')]=_['merge'](_0x3cf318[_0xef02('0x3a')],{'$or':_[_0xef02('0x2f')](_0x184e0d,function(_0x5d4012){if(_0x5d4012[_0xef02('0x2c')]!=='VIRTUAL'){var _0x16ace8={};_0x16ace8[_0x5d4012[_0xef02('0x27')]]={'$like':'%'+_0x1142bc[_0xef02('0x30')]['filter']+'%'};return _0x16ace8;}})});}_0x3cf318=_[_0xef02('0x3e')]({},_0x3cf318,_0x1142bc[_0xef02('0x3f')]);var _0x57830d={'where':_0x3cf318[_0xef02('0x3a')]};return db['Dynamics365Field'][_0xef02('0x20')](_0x57830d)[_0xef02('0x23')](function(_0x2cbf61){_0x23e58c[_0xef02('0x20')]=_0x2cbf61;if(_0x1142bc[_0xef02('0x30')][_0xef02('0x40')]){_0x3cf318['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xef02('0x41')](_0x3cf318);})['then'](function(_0x50a82d){_0x23e58c[_0xef02('0x42')]=_0x50a82d;return _0x23e58c;})['then'](respondWithFilteredResult(_0x1b765c,_0x3cf318))['catch'](handleError(_0x1b765c,null));};exports[_0xef02('0x43')]=function(_0x3fe9ef,_0x20f709){var _0x4ade6a={'raw':!![],'where':{'id':_0x3fe9ef[_0xef02('0x44')]['id']}},_0x4aac25={};_0x4aac25['model']=_[_0xef02('0x31')](db[_0xef02('0x45')][_0xef02('0x2a')]);_0x4aac25['query']=_[_0xef02('0x31')](_0x3fe9ef[_0xef02('0x30')]);_0x4aac25[_0xef02('0x3b')]=_[_0xef02('0x32')](_0x4aac25[_0xef02('0x2e')],_0x4aac25[_0xef02('0x30')]);_0x4ade6a[_0xef02('0x33')]=_[_0xef02('0x32')](_0x4aac25['model'],qs[_0xef02('0x34')](_0x3fe9ef[_0xef02('0x30')][_0xef02('0x34')]));_0x4ade6a['attributes']=_0x4ade6a[_0xef02('0x33')][_0xef02('0x35')]?_0x4ade6a['attributes']:_0x4aac25['model'];if(_0x3fe9ef[_0xef02('0x30')][_0xef02('0x40')]){_0x4ade6a[_0xef02('0x46')]=[{'all':!![]}];}_0x4ade6a=_[_0xef02('0x3e')]({},_0x4ade6a,_0x3fe9ef[_0xef02('0x3f')]);return db['Dynamics365Field'][_0xef02('0x47')](_0x4ade6a)[_0xef02('0x23')](handleEntityNotFound(_0x20f709,null))[_0xef02('0x23')](respondWithResult(_0x20f709,null))[_0xef02('0x48')](handleError(_0x20f709,null));};exports[_0xef02('0x49')]=function(_0x5277a9,_0x1d640d){return db['Dynamics365Field']['create'](_0x5277a9[_0xef02('0x4a')],{})[_0xef02('0x23')](respondWithResult(_0x1d640d,0xc9))[_0xef02('0x48')](handleError(_0x1d640d,null));};exports['update']=function(_0x314f2e,_0x107ef9){if(_0x314f2e[_0xef02('0x4a')]['id']){delete _0x314f2e[_0xef02('0x4a')]['id'];}return db[_0xef02('0x45')]['find']({'where':{'id':_0x314f2e[_0xef02('0x44')]['id']}})[_0xef02('0x23')](handleEntityNotFound(_0x107ef9,null))['then'](saveUpdates(_0x314f2e['body'],null))['then'](respondWithResult(_0x107ef9,null))[_0xef02('0x48')](handleError(_0x107ef9,null));};exports['destroy']=function(_0x2b07f7,_0xfe1742){return db[_0xef02('0x45')]['find']({'where':{'id':_0x2b07f7[_0xef02('0x44')]['id']}})['then'](handleEntityNotFound(_0xfe1742,null))['then'](removeEntity(_0xfe1742,null))[_0xef02('0x48')](handleError(_0xfe1742,null));}; \ No newline at end of file +var _0xde41=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','eml-format','zip-dir','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x43130f,_0x1fee55){var _0x2356cc=function(_0x55021d){while(--_0x55021d){_0x43130f['push'](_0x43130f['shift']());}};_0x2356cc(++_0x1fee55);}(_0xde41,0x1b3));var _0x1de4=function(_0x51c8b5,_0x59f403){_0x51c8b5=_0x51c8b5-0x0;var _0x42b474=_0xde41[_0x51c8b5];return _0x42b474;};'use strict';var emlformat=require(_0x1de4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1de4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1de4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1de4('0x3'));var util=require('util');var path=require(_0x1de4('0x4'));var sox=require(_0x1de4('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1de4('0x6'));var _=require(_0x1de4('0x7'));var squel=require(_0x1de4('0x8'));var crypto=require(_0x1de4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1de4('0xa'));var toCsv=require(_0x1de4('0xb'));var querystring=require(_0x1de4('0xc'));var Papa=require(_0x1de4('0xd'));var Redis=require(_0x1de4('0xe'));var authService=require(_0x1de4('0xf'));var qs=require(_0x1de4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1de4('0x11'));var logger=require('../../config/logger')(_0x1de4('0x12'));var utils=require(_0x1de4('0x13'));var config=require(_0x1de4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1de4('0x15'))['db'];function respondWithStatusCode(_0x2cd8d3,_0xd9f2a1){_0xd9f2a1=_0xd9f2a1||0xcc;return function(_0x10b034){if(_0x10b034){return _0x2cd8d3[_0x1de4('0x16')](_0xd9f2a1);}return _0x2cd8d3[_0x1de4('0x17')](_0xd9f2a1)[_0x1de4('0x18')]();};}function respondWithResult(_0x1d3161,_0x1c1629){_0x1c1629=_0x1c1629||0xc8;return function(_0x1fa03f){if(_0x1fa03f){return _0x1d3161[_0x1de4('0x17')](_0x1c1629)[_0x1de4('0x19')](_0x1fa03f);}};}function respondWithFilteredResult(_0x5644a9,_0x3f251a){return function(_0x46f772){if(_0x46f772){var _0x30f5fa=typeof _0x3f251a['offset']===_0x1de4('0x1a')&&typeof _0x3f251a[_0x1de4('0x1b')]===_0x1de4('0x1a');var _0x4e97c7=_0x46f772['count'];var _0x4bfae5=_0x30f5fa?0x0:_0x3f251a[_0x1de4('0x1c')];var _0x1cbd4e=_0x30f5fa?_0x46f772[_0x1de4('0x1d')]:_0x3f251a[_0x1de4('0x1c')]+_0x3f251a[_0x1de4('0x1b')];var _0x49f01a;if(_0x1cbd4e>=_0x4e97c7){_0x1cbd4e=_0x4e97c7;_0x49f01a=0xc8;}else{_0x49f01a=0xce;}_0x5644a9[_0x1de4('0x17')](_0x49f01a);return _0x5644a9[_0x1de4('0x1e')](_0x1de4('0x1f'),_0x4bfae5+'-'+_0x1cbd4e+'/'+_0x4e97c7)['json'](_0x46f772);}return null;};}function patchUpdates(_0x162b80){return function(_0x527308){try{jsonpatch[_0x1de4('0x20')](_0x527308,_0x162b80,!![]);}catch(_0x3bc45f){return BPromise[_0x1de4('0x21')](_0x3bc45f);}return _0x527308[_0x1de4('0x22')]();};}function saveUpdates(_0x2dfca5,_0x517884){return function(_0x4d7e62){if(_0x4d7e62){return _0x4d7e62[_0x1de4('0x23')](_0x2dfca5)['then'](function(_0x531840){return _0x531840;});}return null;};}function removeEntity(_0x19184e,_0x2632bd){return function(_0x13d46b){if(_0x13d46b){return _0x13d46b['destroy']()[_0x1de4('0x24')](function(){_0x19184e[_0x1de4('0x17')](0xcc)[_0x1de4('0x18')]();});}};}function handleEntityNotFound(_0x590b22,_0xd97489){return function(_0x5e65a7){if(!_0x5e65a7){_0x590b22['sendStatus'](0x194);}return _0x5e65a7;};}function handleError(_0x27e91a,_0x5efeb3){_0x5efeb3=_0x5efeb3||0x1f4;return function(_0x12563f){logger[_0x1de4('0x25')](_0x12563f[_0x1de4('0x26')]);if(_0x12563f[_0x1de4('0x27')]){delete _0x12563f['name'];}_0x27e91a['status'](_0x5efeb3)[_0x1de4('0x28')](_0x12563f);};}exports[_0x1de4('0x29')]=function(_0x444a72,_0x3ae8cb){var _0x4fec0f={},_0x1c58fa={},_0x5de5e0={'count':0x0,'rows':[]};var _0x26a641=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x14be71){return{'name':_0x14be71[_0x1de4('0x2a')],'type':_0x14be71[_0x1de4('0x2b')]['key']};});_0x1c58fa[_0x1de4('0x2c')]=_[_0x1de4('0x2d')](_0x26a641,_0x1de4('0x27'));_0x1c58fa[_0x1de4('0x2e')]=_[_0x1de4('0x2f')](_0x444a72[_0x1de4('0x2e')]);_0x1c58fa[_0x1de4('0x30')]=_[_0x1de4('0x31')](_0x1c58fa[_0x1de4('0x2c')],_0x1c58fa[_0x1de4('0x2e')]);_0x4fec0f[_0x1de4('0x32')]=_['intersection'](_0x1c58fa[_0x1de4('0x2c')],qs[_0x1de4('0x33')](_0x444a72[_0x1de4('0x2e')][_0x1de4('0x33')]));_0x4fec0f[_0x1de4('0x32')]=_0x4fec0f[_0x1de4('0x32')]['length']?_0x4fec0f['attributes']:_0x1c58fa[_0x1de4('0x2c')];if(!_0x444a72[_0x1de4('0x2e')]['hasOwnProperty'](_0x1de4('0x34'))){_0x4fec0f[_0x1de4('0x1b')]=qs['limit'](_0x444a72[_0x1de4('0x2e')][_0x1de4('0x1b')]);_0x4fec0f['offset']=qs[_0x1de4('0x1c')](_0x444a72[_0x1de4('0x2e')][_0x1de4('0x1c')]);}_0x4fec0f[_0x1de4('0x35')]=qs[_0x1de4('0x36')](_0x444a72['query'][_0x1de4('0x36')]);_0x4fec0f['where']=qs[_0x1de4('0x30')](_[_0x1de4('0x37')](_0x444a72['query'],_0x1c58fa[_0x1de4('0x30')]),_0x26a641);if(_0x444a72[_0x1de4('0x2e')][_0x1de4('0x38')]){_0x4fec0f[_0x1de4('0x39')]=_['merge'](_0x4fec0f[_0x1de4('0x39')],{'$or':_[_0x1de4('0x2d')](_0x26a641,function(_0x446db4){if(_0x446db4[_0x1de4('0x2b')]!==_0x1de4('0x3a')){var _0x25f0f6={};_0x25f0f6[_0x446db4[_0x1de4('0x27')]]={'$like':'%'+_0x444a72[_0x1de4('0x2e')][_0x1de4('0x38')]+'%'};return _0x25f0f6;}})});}_0x4fec0f=_[_0x1de4('0x3b')]({},_0x4fec0f,_0x444a72[_0x1de4('0x3c')]);var _0x1e98ab={'where':_0x4fec0f[_0x1de4('0x39')]};return db[_0x1de4('0x3d')]['count'](_0x1e98ab)[_0x1de4('0x24')](function(_0x11d45a){_0x5de5e0[_0x1de4('0x1d')]=_0x11d45a;if(_0x444a72[_0x1de4('0x2e')][_0x1de4('0x3e')]){_0x4fec0f[_0x1de4('0x3f')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x1de4('0x40')](_0x4fec0f);})['then'](function(_0x18bd74){_0x5de5e0[_0x1de4('0x41')]=_0x18bd74;return _0x5de5e0;})[_0x1de4('0x24')](respondWithFilteredResult(_0x3ae8cb,_0x4fec0f))[_0x1de4('0x42')](handleError(_0x3ae8cb,null));};exports[_0x1de4('0x43')]=function(_0x50b9ae,_0x5d3ea2){var _0xc36673={'raw':!![],'where':{'id':_0x50b9ae[_0x1de4('0x44')]['id']}},_0x37933b={};_0x37933b['model']=_['keys'](db[_0x1de4('0x3d')][_0x1de4('0x45')]);_0x37933b[_0x1de4('0x2e')]=_['keys'](_0x50b9ae[_0x1de4('0x2e')]);_0x37933b[_0x1de4('0x30')]=_['intersection'](_0x37933b['model'],_0x37933b['query']);_0xc36673[_0x1de4('0x32')]=_[_0x1de4('0x31')](_0x37933b[_0x1de4('0x2c')],qs[_0x1de4('0x33')](_0x50b9ae[_0x1de4('0x2e')][_0x1de4('0x33')]));_0xc36673[_0x1de4('0x32')]=_0xc36673[_0x1de4('0x32')][_0x1de4('0x46')]?_0xc36673[_0x1de4('0x32')]:_0x37933b[_0x1de4('0x2c')];if(_0x50b9ae['query'][_0x1de4('0x3e')]){_0xc36673[_0x1de4('0x3f')]=[{'all':!![]}];}_0xc36673=_[_0x1de4('0x3b')]({},_0xc36673,_0x50b9ae[_0x1de4('0x3c')]);return db[_0x1de4('0x3d')][_0x1de4('0x47')](_0xc36673)['then'](handleEntityNotFound(_0x5d3ea2,null))['then'](respondWithResult(_0x5d3ea2,null))[_0x1de4('0x42')](handleError(_0x5d3ea2,null));};exports[_0x1de4('0x48')]=function(_0x464838,_0x46e0c4){return db[_0x1de4('0x3d')][_0x1de4('0x48')](_0x464838[_0x1de4('0x49')],{})[_0x1de4('0x24')](respondWithResult(_0x46e0c4,0xc9))[_0x1de4('0x42')](handleError(_0x46e0c4,null));};exports[_0x1de4('0x23')]=function(_0x3d9d94,_0x32b834){if(_0x3d9d94[_0x1de4('0x49')]['id']){delete _0x3d9d94[_0x1de4('0x49')]['id'];}return db[_0x1de4('0x3d')][_0x1de4('0x47')]({'where':{'id':_0x3d9d94['params']['id']}})['then'](handleEntityNotFound(_0x32b834,null))['then'](saveUpdates(_0x3d9d94['body'],null))[_0x1de4('0x24')](respondWithResult(_0x32b834,null))[_0x1de4('0x42')](handleError(_0x32b834,null));};exports[_0x1de4('0x4a')]=function(_0x3555be,_0x3b0c4c){return db[_0x1de4('0x3d')][_0x1de4('0x47')]({'where':{'id':_0x3555be[_0x1de4('0x44')]['id']}})[_0x1de4('0x24')](handleEntityNotFound(_0x3b0c4c,null))['then'](removeEntity(_0x3b0c4c,null))[_0x1de4('0x42')](handleError(_0x3b0c4c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c5a1a64..58c9daa 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 _0x24f4=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x24f4,0x15f));var _0x424f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x424f('0x0'));var util=require(_0x424f('0x1'));var logger=require(_0x424f('0x2'))(_0x424f('0x3'));var moment=require(_0x424f('0x4'));var BPromise=require(_0x424f('0x5'));var rp=require(_0x424f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x424f('0x7'));var config=require(_0x424f('0x8'));var attributes=require(_0x424f('0x9'));module[_0x424f('0xa')]=function(_0x1ec245,_0x835b33){return _0x1ec245[_0x424f('0xb')](_0x424f('0xc'),attributes,{'tableName':_0x424f('0xd'),'paranoid':![],'indexes':[{'name':_0x424f('0xe'),'fields':['idField',_0x424f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5b0=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x4ab29e,_0x21392f){var _0x2b6d79=function(_0x1b3aa8){while(--_0x1b3aa8){_0x4ab29e['push'](_0x4ab29e['shift']());}};_0x2b6d79(++_0x21392f);}(_0xb5b0,0x1a3));var _0x0b5b=function(_0x2ebff3,_0x3542a3){_0x2ebff3=_0x2ebff3-0x0;var _0x447ab4=_0xb5b0[_0x2ebff3];return _0x447ab4;};'use strict';var _=require(_0x0b5b('0x0'));var util=require(_0x0b5b('0x1'));var logger=require(_0x0b5b('0x2'))(_0x0b5b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b5b('0x5'));var config=require(_0x0b5b('0x6'));var attributes=require(_0x0b5b('0x7'));module[_0x0b5b('0x8')]=function(_0x289e86,_0xe6fd47){return _0x289e86[_0x0b5b('0x9')](_0x0b5b('0xa'),attributes,{'tableName':_0x0b5b('0xb'),'paranoid':![],'indexes':[{'name':_0x0b5b('0xc'),'fields':[_0x0b5b('0xd'),_0x0b5b('0xe')],'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 ebd5ba1..a34f663 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 _0xfc6f=['client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfc6f,0x10b));var _0xffc6=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xfc6f[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xffc6('0x0'));var util=require('util');var moment=require(_0xffc6('0x1'));var BPromise=require(_0xffc6('0x2'));var rs=require(_0xffc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffc6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xffc6('0x5'))(_0xffc6('0x6'));var config=require(_0xffc6('0x7'));var jayson=require(_0xffc6('0x8'));var client=jayson[_0xffc6('0x9')][_0xffc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x682aa3,_0x498fa1,_0x5c6499){return new BPromise(function(_0x34da7e,_0xd9c29b){return client[_0xffc6('0xb')](_0x682aa3,_0x5c6499)[_0xffc6('0xc')](function(_0x3aa01b){logger[_0xffc6('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x498fa1,_0xffc6('0xe'));logger[_0xffc6('0xf')](_0xffc6('0x10'),_0x498fa1,_0xffc6('0xe'),JSON[_0xffc6('0x11')](_0x3aa01b));if(_0x3aa01b[_0xffc6('0x12')]){if(_0x3aa01b[_0xffc6('0x12')][_0xffc6('0x13')]===0x1f4){logger[_0xffc6('0x12')](_0xffc6('0x14'),_0x498fa1,_0x3aa01b[_0xffc6('0x12')][_0xffc6('0x15')]);return _0xd9c29b(_0x3aa01b[_0xffc6('0x12')][_0xffc6('0x15')]);}logger['error'](_0xffc6('0x14'),_0x498fa1,_0x3aa01b[_0xffc6('0x12')][_0xffc6('0x15')]);return _0x34da7e(_0x3aa01b[_0xffc6('0x12')][_0xffc6('0x15')]);}else{logger[_0xffc6('0xd')](_0xffc6('0x14'),_0x498fa1,'request\x20sent');_0x34da7e(_0x3aa01b[_0xffc6('0x16')][_0xffc6('0x15')]);}})['catch'](function(_0x485e8c){logger[_0xffc6('0x12')](_0xffc6('0x14'),_0x498fa1,_0x485e8c);_0xd9c29b(_0x485e8c);});});} \ No newline at end of file +var _0xb3d7=['code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x820843,_0x4b6f7e){var _0x2077c2=function(_0x26e103){while(--_0x26e103){_0x820843['push'](_0x820843['shift']());}};_0x2077c2(++_0x4b6f7e);}(_0xb3d7,0x72));var _0x7b3d=function(_0x3de318,_0x1d4bfe){_0x3de318=_0x3de318-0x0;var _0xce5e1a=_0xb3d7[_0x3de318];return _0xce5e1a;};'use strict';var _=require(_0x7b3d('0x0'));var util=require('util');var moment=require(_0x7b3d('0x1'));var BPromise=require(_0x7b3d('0x2'));var rs=require(_0x7b3d('0x3'));var fs=require('fs');var Redis=require(_0x7b3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b3d('0x5'));var config=require(_0x7b3d('0x6'));var jayson=require(_0x7b3d('0x7'));var client=jayson[_0x7b3d('0x8')][_0x7b3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dfe02,_0x2ad702,_0x20f737){return new BPromise(function(_0x2b0915,_0xbed890){return client[_0x7b3d('0xa')](_0x1dfe02,_0x20f737)[_0x7b3d('0xb')](function(_0x3a1642){logger[_0x7b3d('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2ad702,_0x7b3d('0xd'));logger[_0x7b3d('0xe')](_0x7b3d('0xf'),_0x2ad702,'request\x20sent',JSON[_0x7b3d('0x10')](_0x3a1642));if(_0x3a1642['error']){if(_0x3a1642[_0x7b3d('0x11')][_0x7b3d('0x12')]===0x1f4){logger[_0x7b3d('0x11')](_0x7b3d('0x13'),_0x2ad702,_0x3a1642[_0x7b3d('0x11')][_0x7b3d('0x14')]);return _0xbed890(_0x3a1642[_0x7b3d('0x11')][_0x7b3d('0x14')]);}logger[_0x7b3d('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x2ad702,_0x3a1642[_0x7b3d('0x11')][_0x7b3d('0x14')]);return _0x2b0915(_0x3a1642[_0x7b3d('0x11')][_0x7b3d('0x14')]);}else{logger[_0x7b3d('0xc')](_0x7b3d('0x13'),_0x2ad702,_0x7b3d('0xd'));_0x2b0915(_0x3a1642[_0x7b3d('0x15')][_0x7b3d('0x14')]);}})['catch'](function(_0x4ca8e9){logger[_0x7b3d('0x11')](_0x7b3d('0x13'),_0x2ad702,_0x4ca8e9);_0xbed890(_0x4ca8e9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index cd63032..f0aff79 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 _0xd7f6=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy'];(function(_0x3a6612,_0x658ec5){var _0x3315cb=function(_0x93892d){while(--_0x93892d){_0x3a6612['push'](_0x3a6612['shift']());}};_0x3315cb(++_0x658ec5);}(_0xd7f6,0xd0));var _0x6d7f=function(_0xa680be,_0x208959){_0xa680be=_0xa680be-0x0;var _0xb25cab=_0xd7f6[_0xa680be];return _0xb25cab;};'use strict';var multer=require(_0x6d7f('0x0'));var util=require(_0x6d7f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d7f('0x2'));var router=express[_0x6d7f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6d7f('0x4'));var interaction=require(_0x6d7f('0x5'));var config=require(_0x6d7f('0x6'));var controller=require(_0x6d7f('0x7'));router['get']('/',auth[_0x6d7f('0x8')](),controller[_0x6d7f('0x9')]);router[_0x6d7f('0xa')](_0x6d7f('0xb'),auth[_0x6d7f('0x8')](),controller[_0x6d7f('0xc')]);router[_0x6d7f('0xa')](_0x6d7f('0xd'),auth[_0x6d7f('0x8')](),controller[_0x6d7f('0xe')]);router[_0x6d7f('0xa')](_0x6d7f('0xf'),auth[_0x6d7f('0x8')](),controller[_0x6d7f('0x10')]);router[_0x6d7f('0x11')]('/',auth[_0x6d7f('0x8')](),controller[_0x6d7f('0x12')]);router[_0x6d7f('0x11')](_0x6d7f('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6d7f('0x13')](_0x6d7f('0xb'),auth[_0x6d7f('0x8')](),controller['update']);router[_0x6d7f('0x14')](_0x6d7f('0xb'),auth[_0x6d7f('0x8')](),controller[_0x6d7f('0x15')]);module[_0x6d7f('0x16')]=router; \ No newline at end of file +var _0xd3bc=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x4743f8,_0x291e9c){var _0x5e9976=function(_0x24eaf0){while(--_0x24eaf0){_0x4743f8['push'](_0x4743f8['shift']());}};_0x5e9976(++_0x291e9c);}(_0xd3bc,0x169));var _0xcd3b=function(_0x51488b,_0x5c2f30){_0x51488b=_0x51488b-0x0;var _0x4f1ef0=_0xd3bc[_0x51488b];return _0x4f1ef0;};'use strict';var multer=require(_0xcd3b('0x0'));var util=require(_0xcd3b('0x1'));var path=require('path');var timeout=require(_0xcd3b('0x2'));var express=require(_0xcd3b('0x3'));var router=express[_0xcd3b('0x4')]();var fs_extra=require(_0xcd3b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd3b('0x6'));var config=require(_0xcd3b('0x7'));var controller=require(_0xcd3b('0x8'));router[_0xcd3b('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd3b('0xa')]);router[_0xcd3b('0x9')]('/:id',auth[_0xcd3b('0xb')](),controller[_0xcd3b('0xc')]);router[_0xcd3b('0x9')](_0xcd3b('0xd'),auth[_0xcd3b('0xb')](),controller['getConfigurations']);router[_0xcd3b('0x9')]('/:id/fields',auth[_0xcd3b('0xb')](),controller[_0xcd3b('0xe')]);router[_0xcd3b('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd3b('0x10')]);router[_0xcd3b('0xf')](_0xcd3b('0xd'),auth[_0xcd3b('0xb')](),controller[_0xcd3b('0x11')]);router[_0xcd3b('0x12')](_0xcd3b('0x13'),auth['isAuthenticated'](),controller[_0xcd3b('0x14')]);router[_0xcd3b('0x15')](_0xcd3b('0x13'),auth[_0xcd3b('0xb')](),controller[_0xcd3b('0x16')]);module[_0xcd3b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4ef969b..23517c8 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 _0x583c=['exports','STRING','username','sequelize'];(function(_0x309d16,_0x100e7f){var _0x2b9a65=function(_0x15fecd){while(--_0x15fecd){_0x309d16['push'](_0x309d16['shift']());}};_0x2b9a65(++_0x100e7f);}(_0x583c,0x12b));var _0xc583=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x583c[_0x48f7cf];return _0xc201c0;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'name':{'type':Sequelize[_0xc583('0x2')]},'description':{'type':Sequelize[_0xc583('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc583('0x3')},'apiKey':{'type':Sequelize[_0xc583('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xc583('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xadb5,0xad));var _0x5adb=function(_0x304758,_0x5d199c){_0x304758=_0x304758-0x0;var _0x259c16=_0xadb5[_0x304758];return _0x259c16;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5adb('0x1')]},'username':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5adb('0x1')],'unique':_0x5adb('0x3')},'serverUrl':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2dd4467..ee7ccd8 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 _0xa71c=['keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','length','pick','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','agent','description','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','end','error','name','index','map','FreshdeskAccount','type','key','model','query'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa71c,0x12a));var _0xca71=function(_0x1d4ac2,_0x11330e){_0x1d4ac2=_0x1d4ac2-0x0;var _0x2c2de8=_0xa71c[_0x1d4ac2];return _0x2c2de8;};'use strict';var emlformat=require(_0xca71('0x0'));var rimraf=require(_0xca71('0x1'));var zipdir=require(_0xca71('0x2'));var jsonpatch=require(_0xca71('0x3'));var rp=require(_0xca71('0x4'));var moment=require('moment');var BPromise=require(_0xca71('0x5'));var Mustache=require(_0xca71('0x6'));var util=require('util');var path=require(_0xca71('0x7'));var sox=require(_0xca71('0x8'));var csv=require('to-csv');var ejs=require(_0xca71('0x9'));var fs=require('fs');var fs_extra=require(_0xca71('0xa'));var _=require(_0xca71('0xb'));var squel=require(_0xca71('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xca71('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca71('0xe'));var Redis=require(_0xca71('0xf'));var authService=require(_0xca71('0x10'));var qs=require(_0xca71('0x11'));var as=require(_0xca71('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca71('0x13'))(_0xca71('0x14'));var utils=require(_0xca71('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xca71('0x16'))['db'];var integrations=require(_0xca71('0x17'));function respondWithStatusCode(_0x12b439,_0x58c62a){_0x58c62a=_0x58c62a||0xcc;return function(_0x2c1386){if(_0x2c1386){return _0x12b439[_0xca71('0x18')](_0x58c62a);}return _0x12b439[_0xca71('0x19')](_0x58c62a)['end']();};}function respondWithResult(_0x2f86df,_0x29456e){_0x29456e=_0x29456e||0xc8;return function(_0x4beae3){if(_0x4beae3){return _0x2f86df[_0xca71('0x19')](_0x29456e)[_0xca71('0x1a')](_0x4beae3);}};}function respondWithFilteredResult(_0x10b932,_0x319601){return function(_0x4e4e33){if(_0x4e4e33){var _0x45231e=typeof _0x319601[_0xca71('0x1b')]===_0xca71('0x1c')&&typeof _0x319601['limit']==='undefined';var _0x541001=_0x4e4e33[_0xca71('0x1d')];var _0xd3734d=_0x45231e?0x0:_0x319601['offset'];var _0x1dcf36=_0x45231e?_0x4e4e33[_0xca71('0x1d')]:_0x319601['offset']+_0x319601[_0xca71('0x1e')];var _0x31bd43;if(_0x1dcf36>=_0x541001){_0x1dcf36=_0x541001;_0x31bd43=0xc8;}else{_0x31bd43=0xce;}_0x10b932['status'](_0x31bd43);return _0x10b932[_0xca71('0x1f')](_0xca71('0x20'),_0xd3734d+'-'+_0x1dcf36+'/'+_0x541001)[_0xca71('0x1a')](_0x4e4e33);}return null;};}function patchUpdates(_0x4b2f64){return function(_0x4059c9){try{jsonpatch[_0xca71('0x21')](_0x4059c9,_0x4b2f64,!![]);}catch(_0x1c4acb){return BPromise[_0xca71('0x22')](_0x1c4acb);}return _0x4059c9['save']();};}function saveUpdates(_0x46a6ff,_0x4a0508){return function(_0x1f4fea){if(_0x1f4fea){return _0x1f4fea[_0xca71('0x23')](_0x46a6ff)[_0xca71('0x24')](function(_0x47461b){return _0x47461b;});}return null;};}function removeEntity(_0x3bdc3b,_0x4f576e){return function(_0x1d40b8){if(_0x1d40b8){return _0x1d40b8['destroy']()['then'](function(){_0x3bdc3b[_0xca71('0x19')](0xcc)[_0xca71('0x25')]();});}};}function handleEntityNotFound(_0x375b43,_0x5eb399){return function(_0x4b23ee){if(!_0x4b23ee){_0x375b43['sendStatus'](0x194);}return _0x4b23ee;};}function handleError(_0x76d4dd,_0x47b530){_0x47b530=_0x47b530||0x1f4;return function(_0x599d1d){logger[_0xca71('0x26')](_0x599d1d['stack']);if(_0x599d1d[_0xca71('0x27')]){delete _0x599d1d['name'];}_0x76d4dd[_0xca71('0x19')](_0x47b530)['send'](_0x599d1d);};}exports[_0xca71('0x28')]=function(_0x146823,_0x3c9746){var _0x55c557={},_0x13b13e={},_0xcd055a={'count':0x0,'rows':[]};var _0x2d623c=_[_0xca71('0x29')](db[_0xca71('0x2a')]['rawAttributes'],function(_0x184b92){return{'name':_0x184b92['fieldName'],'type':_0x184b92[_0xca71('0x2b')][_0xca71('0x2c')]};});_0x13b13e[_0xca71('0x2d')]=_[_0xca71('0x29')](_0x2d623c,_0xca71('0x27'));_0x13b13e[_0xca71('0x2e')]=_[_0xca71('0x2f')](_0x146823[_0xca71('0x2e')]);_0x13b13e[_0xca71('0x30')]=_[_0xca71('0x31')](_0x13b13e[_0xca71('0x2d')],_0x13b13e['query']);_0x55c557['attributes']=_[_0xca71('0x31')](_0x13b13e['model'],qs[_0xca71('0x32')](_0x146823[_0xca71('0x2e')][_0xca71('0x32')]));_0x55c557['attributes']=_0x55c557[_0xca71('0x33')]['length']?_0x55c557['attributes']:_0x13b13e[_0xca71('0x2d')];if(!_0x146823[_0xca71('0x2e')][_0xca71('0x34')]('nolimit')){_0x55c557['limit']=qs[_0xca71('0x1e')](_0x146823[_0xca71('0x2e')][_0xca71('0x1e')]);_0x55c557['offset']=qs['offset'](_0x146823[_0xca71('0x2e')]['offset']);}_0x55c557[_0xca71('0x35')]=qs[_0xca71('0x36')](_0x146823[_0xca71('0x2e')][_0xca71('0x36')]);_0x55c557[_0xca71('0x37')]=qs[_0xca71('0x30')](_['pick'](_0x146823[_0xca71('0x2e')],_0x13b13e[_0xca71('0x30')]),_0x2d623c);if(_0x146823[_0xca71('0x2e')][_0xca71('0x38')]){_0x55c557[_0xca71('0x37')]=_[_0xca71('0x39')](_0x55c557[_0xca71('0x37')],{'$or':_[_0xca71('0x29')](_0x2d623c,function(_0x3603e7){if(_0x3603e7[_0xca71('0x2b')]!==_0xca71('0x3a')){var _0x21dbb0={};_0x21dbb0[_0x3603e7['name']]={'$like':'%'+_0x146823[_0xca71('0x2e')][_0xca71('0x38')]+'%'};return _0x21dbb0;}})});}_0x55c557=_[_0xca71('0x39')]({},_0x55c557,_0x146823['options']);var _0x4d2e24={'where':_0x55c557[_0xca71('0x37')]};return db[_0xca71('0x2a')][_0xca71('0x1d')](_0x4d2e24)[_0xca71('0x24')](function(_0x2f5980){_0xcd055a['count']=_0x2f5980;if(_0x146823[_0xca71('0x2e')][_0xca71('0x3b')]){_0x55c557[_0xca71('0x3c')]=[{'all':!![]}];}return db[_0xca71('0x2a')][_0xca71('0x3d')](_0x55c557);})['then'](function(_0x2903f9){_0xcd055a['rows']=_0x2903f9;return _0xcd055a;})[_0xca71('0x24')](respondWithFilteredResult(_0x3c9746,_0x55c557))[_0xca71('0x3e')](handleError(_0x3c9746,null));};exports[_0xca71('0x3f')]=function(_0x1b243c,_0x59af53){var _0x21cc5d={'raw':![],'where':{'id':_0x1b243c[_0xca71('0x40')]['id']}},_0x5a114c={};_0x5a114c[_0xca71('0x2d')]=_[_0xca71('0x2f')](db[_0xca71('0x2a')][_0xca71('0x41')]);_0x5a114c[_0xca71('0x2e')]=_[_0xca71('0x2f')](_0x1b243c[_0xca71('0x2e')]);_0x5a114c[_0xca71('0x30')]=_[_0xca71('0x31')](_0x5a114c[_0xca71('0x2d')],_0x5a114c['query']);_0x21cc5d['attributes']=_['intersection'](_0x5a114c[_0xca71('0x2d')],qs[_0xca71('0x32')](_0x1b243c[_0xca71('0x2e')][_0xca71('0x32')]));_0x21cc5d[_0xca71('0x33')]=_0x21cc5d[_0xca71('0x33')]['length']?_0x21cc5d['attributes']:_0x5a114c[_0xca71('0x2d')];if(_0x1b243c[_0xca71('0x2e')][_0xca71('0x3b')]){_0x21cc5d[_0xca71('0x3c')]=[{'all':!![]}];}_0x21cc5d=_['merge']({},_0x21cc5d,_0x1b243c[_0xca71('0x42')]);return db[_0xca71('0x2a')]['find'](_0x21cc5d)[_0xca71('0x24')](handleEntityNotFound(_0x59af53,null))['then'](respondWithResult(_0x59af53,null))[_0xca71('0x3e')](handleError(_0x59af53,null));};exports[_0xca71('0x43')]=function(_0xc40961,_0x438434){return db[_0xca71('0x2a')]['create'](_0xc40961['body'],{})['then'](respondWithResult(_0x438434,0xc9))[_0xca71('0x3e')](handleError(_0x438434,null));};exports[_0xca71('0x23')]=function(_0x223fbc,_0x22a0cd){if(_0x223fbc[_0xca71('0x44')]['id']){delete _0x223fbc[_0xca71('0x44')]['id'];}return db[_0xca71('0x2a')]['find']({'where':{'id':_0x223fbc[_0xca71('0x40')]['id']}})[_0xca71('0x24')](handleEntityNotFound(_0x22a0cd,null))[_0xca71('0x24')](saveUpdates(_0x223fbc[_0xca71('0x44')],null))[_0xca71('0x24')](respondWithResult(_0x22a0cd,null))[_0xca71('0x3e')](handleError(_0x22a0cd,null));};exports[_0xca71('0x45')]=function(_0x1ebb2d,_0xa161cf){return db[_0xca71('0x2a')]['find']({'where':{'id':_0x1ebb2d[_0xca71('0x40')]['id']}})[_0xca71('0x24')](handleEntityNotFound(_0xa161cf,null))[_0xca71('0x24')](removeEntity(_0xa161cf,null))[_0xca71('0x3e')](handleError(_0xa161cf,null));};exports[_0xca71('0x46')]=function(_0x38699d,_0x485a14,_0x31cea1){var _0xd94efa={};var _0x4eb4d9={};var _0x3d00a5;var _0x30c67f;return db['FreshdeskAccount'][_0xca71('0x47')]({'where':{'id':_0x38699d[_0xca71('0x40')]['id']}})['then'](handleEntityNotFound(_0x485a14,null))['then'](function(_0x405246){if(_0x405246){_0x3d00a5=_0x405246;_0x4eb4d9['model']=_[_0xca71('0x2f')](db[_0xca71('0x48')][_0xca71('0x41')]);_0x4eb4d9[_0xca71('0x2e')]=_[_0xca71('0x2f')](_0x38699d[_0xca71('0x2e')]);_0x4eb4d9[_0xca71('0x30')]=_[_0xca71('0x31')](_0x4eb4d9[_0xca71('0x2d')],_0x4eb4d9[_0xca71('0x2e')]);_0xd94efa[_0xca71('0x33')]=_[_0xca71('0x31')](_0x4eb4d9['model'],qs['fields'](_0x38699d[_0xca71('0x2e')][_0xca71('0x32')]));_0xd94efa[_0xca71('0x33')]=_0xd94efa['attributes'][_0xca71('0x49')]?_0xd94efa[_0xca71('0x33')]:_0x4eb4d9[_0xca71('0x2d')];_0xd94efa[_0xca71('0x35')]=qs[_0xca71('0x36')](_0x38699d[_0xca71('0x2e')]['sort']);_0xd94efa[_0xca71('0x37')]=qs[_0xca71('0x30')](_[_0xca71('0x4a')](_0x38699d['query'],_0x4eb4d9[_0xca71('0x30')]));if(_0x38699d[_0xca71('0x2e')]['filter']){_0xd94efa[_0xca71('0x37')]=_[_0xca71('0x39')](_0xd94efa[_0xca71('0x37')],{'$or':_[_0xca71('0x29')](_0xd94efa['attributes'],function(_0x5aec78){var _0xbded8d={};_0xbded8d[_0x5aec78]={'$like':'%'+_0x38699d[_0xca71('0x2e')][_0xca71('0x38')]+'%'};return _0xbded8d;})});}_0xd94efa=_['merge']({},_0xd94efa,_0x38699d[_0xca71('0x42')]);return _0x3d00a5[_0xca71('0x46')](_0xd94efa);}})['then'](function(_0x225faf){if(_0x225faf){_0x30c67f=_0x225faf[_0xca71('0x49')];if(!_0x38699d['query']['hasOwnProperty'](_0xca71('0x4b'))){_0xd94efa[_0xca71('0x1e')]=qs['limit'](_0x38699d[_0xca71('0x2e')]['limit']);_0xd94efa[_0xca71('0x1b')]=qs[_0xca71('0x1b')](_0x38699d[_0xca71('0x2e')][_0xca71('0x1b')]);}return _0x3d00a5[_0xca71('0x46')](_0xd94efa);}})['then'](function(_0xf27394){if(_0xf27394){return _0xf27394?{'count':_0x30c67f,'rows':_0xf27394}:null;}})[_0xca71('0x24')](respondWithResult(_0x485a14,null))['catch'](handleError(_0x485a14,null));};exports[_0xca71('0x4c')]=function(_0x3ef0c4,_0x1652f7,_0x13c11e){if(_0x3ef0c4['body']['id']){delete _0x3ef0c4[_0xca71('0x44')]['id'];}return db['FreshdeskAccount'][_0xca71('0x47')]({'where':{'id':_0x3ef0c4[_0xca71('0x40')]['id']}})[_0xca71('0x24')](handleEntityNotFound(_0x1652f7,null))[_0xca71('0x24')](function(_0x13f089){if(_0x13f089){_0x3ef0c4['body']['AccountId']=_0x13f089['id'];_0x3ef0c4['body']['Subjects']=integrations[_0xca71('0x4d')](_0x3ef0c4['body'][_0xca71('0x4e')],_0x3ef0c4[_0xca71('0x44')][_0xca71('0x2b')]);_0x3ef0c4[_0xca71('0x44')][_0xca71('0x4f')]=integrations[_0xca71('0x50')](_0x3ef0c4[_0xca71('0x44')][_0xca71('0x4e')],_0x3ef0c4[_0xca71('0x44')][_0xca71('0x2b')]);return db[_0xca71('0x48')][_0xca71('0x43')](_0x3ef0c4[_0xca71('0x44')],{'include':[{'model':db[_0xca71('0x51')],'as':_0xca71('0x52')},{'model':db[_0xca71('0x51')],'as':'Descriptions'}]});}return null;})[_0xca71('0x24')](respondWithResult(_0x1652f7,null))[_0xca71('0x3e')](handleError(_0x1652f7,null));};exports[_0xca71('0x53')]=function(_0x40f30c,_0x50d3f1,_0x3447a2){var _0x12b0ce='';return db[_0xca71('0x2a')][_0xca71('0x47')]({'where':{'id':_0x40f30c[_0xca71('0x40')]['id']},'attributes':['id',_0xca71('0x54'),'apiKey']})['then'](handleEntityNotFound(_0x50d3f1,null))[_0xca71('0x24')](function(_0x49229a){if(_0x49229a){_0x12b0ce=_0x49229a[_0xca71('0x54')];var _0x3cc230=_0x12b0ce[_0xca71('0x55')](-0x1);if(_0x3cc230==='/'){_0x12b0ce=_0x12b0ce[_0xca71('0x56')](0x0,_0x12b0ce[_0xca71('0x57')](_0x3cc230));}return rp({'method':_0xca71('0x58'),'uri':util[_0xca71('0x59')](_0xca71('0x5a'),_0x12b0ce,_0xca71('0x5b')),'headers':{'Authorization':util['format'](_0xca71('0x5c'),new Buffer(util[_0xca71('0x59')]('%s:X',_0x49229a[_0xca71('0x5d')]))[_0xca71('0x5e')](_0xca71('0x5f')))},'json':!![]});}})[_0xca71('0x24')](function(_0x5e077b){if(_0x5e077b){var _0xc50441=['requester','subject',_0xca71('0x60'),_0xca71('0x61'),_0xca71('0x19'),'priority',_0xca71('0x62'),_0xca71('0x63'),_0xca71('0x64'),_0xca71('0x62'),_0xca71('0x65')];_[_0xca71('0x66')](_0x5e077b,function(_0x459a0a){return _0xc50441[_0xca71('0x67')](_0x459a0a[_0xca71('0x27')])||!_0x459a0a[_0xca71('0x68')]&&_0x459a0a[_0xca71('0x2b')]!==_0xca71('0x69')&&_0x459a0a['type']!==_0xca71('0x6a');});return{'count':_0x5e077b['length'],'rows':_[_0xca71('0x29')](_0x5e077b,function(_0x1e24ac){return{'id':_0x1e24ac[_0xca71('0x27')],'name':_0x1e24ac[_0xca71('0x6b')],'custom':!_0x1e24ac[_0xca71('0x68')],'options':_0x1e24ac[_0xca71('0x6c')]?_[_0xca71('0x29')](_0x1e24ac['choices'],function(_0x2b4591){return{'name':_[_0xca71('0x6d')](_0x2b4591),'value':_0x2b4591};}):[]};})};}})[_0xca71('0x24')](respondWithResult(_0x50d3f1,null))['catch'](function(_0x241c33){var _0x361a94=_0x40f30c[_0xca71('0x2e')][_0xca71('0x6e')]?0x1f4:_0x241c33[_0xca71('0x6f')]||0x1f4;logger[_0xca71('0x26')](_0xca71('0x70'),_0xca71('0x53'),_0x361a94,JSON[_0xca71('0x71')](_0x241c33));delete _0x241c33[_0xca71('0x27')];if(_0x361a94===0x191){_0x361a94=0x190;}_0x50d3f1[_0xca71('0x19')](_0x361a94)[_0xca71('0x72')](_0x40f30c[_0xca71('0x2e')][_0xca71('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x241c33[_0xca71('0x6f')]}:_0x241c33);});}; \ No newline at end of file +var _0x9063=['offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','update','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','slice','substring','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','agent','description','priority','group','source','ticket_type','remove','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json'];(function(_0x424cbb,_0x213184){var _0x4fda27=function(_0x63f69a){while(--_0x63f69a){_0x424cbb['push'](_0x424cbb['shift']());}};_0x4fda27(++_0x213184);}(_0x9063,0x1a2));var _0x3906=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x9063[_0x1da04e];return _0xdd8c41;};'use strict';var emlformat=require(_0x3906('0x0'));var rimraf=require(_0x3906('0x1'));var zipdir=require(_0x3906('0x2'));var jsonpatch=require(_0x3906('0x3'));var rp=require(_0x3906('0x4'));var moment=require(_0x3906('0x5'));var BPromise=require(_0x3906('0x6'));var Mustache=require(_0x3906('0x7'));var util=require('util');var path=require(_0x3906('0x8'));var sox=require(_0x3906('0x9'));var csv=require(_0x3906('0xa'));var ejs=require(_0x3906('0xb'));var fs=require('fs');var fs_extra=require(_0x3906('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3906('0xd'));var deskjs=require(_0x3906('0xe'));var toCsv=require(_0x3906('0xa'));var querystring=require('querystring');var Papa=require(_0x3906('0xf'));var Redis=require(_0x3906('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3906('0x11'));var as=require(_0x3906('0x12'));var hardwareService=require(_0x3906('0x13'));var logger=require('../../config/logger')(_0x3906('0x14'));var utils=require(_0x3906('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3906('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc58c20,_0x2fd0ca){_0x2fd0ca=_0x2fd0ca||0xcc;return function(_0x490696){if(_0x490696){return _0xc58c20['sendStatus'](_0x2fd0ca);}return _0xc58c20[_0x3906('0x17')](_0x2fd0ca)[_0x3906('0x18')]();};}function respondWithResult(_0x4a741f,_0x57d5e4){_0x57d5e4=_0x57d5e4||0xc8;return function(_0x11c2f8){if(_0x11c2f8){return _0x4a741f[_0x3906('0x17')](_0x57d5e4)[_0x3906('0x19')](_0x11c2f8);}};}function respondWithFilteredResult(_0x28211f,_0x31774d){return function(_0x7d7401){if(_0x7d7401){var _0x39f88a=typeof _0x31774d[_0x3906('0x1a')]===_0x3906('0x1b')&&typeof _0x31774d[_0x3906('0x1c')]==='undefined';var _0x35801e=_0x7d7401['count'];var _0xf0bf50=_0x39f88a?0x0:_0x31774d[_0x3906('0x1a')];var _0x4b4221=_0x39f88a?_0x7d7401[_0x3906('0x1d')]:_0x31774d['offset']+_0x31774d[_0x3906('0x1c')];var _0x2fc1a2;if(_0x4b4221>=_0x35801e){_0x4b4221=_0x35801e;_0x2fc1a2=0xc8;}else{_0x2fc1a2=0xce;}_0x28211f[_0x3906('0x17')](_0x2fc1a2);return _0x28211f[_0x3906('0x1e')](_0x3906('0x1f'),_0xf0bf50+'-'+_0x4b4221+'/'+_0x35801e)['json'](_0x7d7401);}return null;};}function patchUpdates(_0x1495bc){return function(_0x2ea5c9){try{jsonpatch[_0x3906('0x20')](_0x2ea5c9,_0x1495bc,!![]);}catch(_0x1ef70a){return BPromise['reject'](_0x1ef70a);}return _0x2ea5c9[_0x3906('0x21')]();};}function saveUpdates(_0x472411,_0x3c3184){return function(_0x342ff9){if(_0x342ff9){return _0x342ff9['update'](_0x472411)['then'](function(_0x2027ee){return _0x2027ee;});}return null;};}function removeEntity(_0x33edf1,_0x343821){return function(_0xe5a4c8){if(_0xe5a4c8){return _0xe5a4c8['destroy']()[_0x3906('0x22')](function(){_0x33edf1[_0x3906('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2eea,_0x229b3e){return function(_0x2a3c28){if(!_0x2a3c28){_0x4a2eea[_0x3906('0x23')](0x194);}return _0x2a3c28;};}function handleError(_0x5911af,_0x150d6b){_0x150d6b=_0x150d6b||0x1f4;return function(_0x26370d){logger[_0x3906('0x24')](_0x26370d[_0x3906('0x25')]);if(_0x26370d['name']){delete _0x26370d[_0x3906('0x26')];}_0x5911af['status'](_0x150d6b)[_0x3906('0x27')](_0x26370d);};}exports['index']=function(_0x579524,_0x21f846){var _0x669f56={},_0x129ead={},_0x4878db={'count':0x0,'rows':[]};var _0x5bace2=_[_0x3906('0x28')](db[_0x3906('0x29')][_0x3906('0x2a')],function(_0x3b6bfe){return{'name':_0x3b6bfe[_0x3906('0x2b')],'type':_0x3b6bfe[_0x3906('0x2c')]['key']};});_0x129ead[_0x3906('0x2d')]=_[_0x3906('0x28')](_0x5bace2,'name');_0x129ead['query']=_[_0x3906('0x2e')](_0x579524['query']);_0x129ead[_0x3906('0x2f')]=_[_0x3906('0x30')](_0x129ead['model'],_0x129ead[_0x3906('0x31')]);_0x669f56[_0x3906('0x32')]=_[_0x3906('0x30')](_0x129ead[_0x3906('0x2d')],qs[_0x3906('0x33')](_0x579524[_0x3906('0x31')][_0x3906('0x33')]));_0x669f56[_0x3906('0x32')]=_0x669f56[_0x3906('0x32')][_0x3906('0x34')]?_0x669f56['attributes']:_0x129ead[_0x3906('0x2d')];if(!_0x579524[_0x3906('0x31')][_0x3906('0x35')](_0x3906('0x36'))){_0x669f56['limit']=qs[_0x3906('0x1c')](_0x579524[_0x3906('0x31')][_0x3906('0x1c')]);_0x669f56[_0x3906('0x1a')]=qs[_0x3906('0x1a')](_0x579524[_0x3906('0x31')][_0x3906('0x1a')]);}_0x669f56[_0x3906('0x37')]=qs[_0x3906('0x38')](_0x579524[_0x3906('0x31')][_0x3906('0x38')]);_0x669f56[_0x3906('0x39')]=qs[_0x3906('0x2f')](_[_0x3906('0x3a')](_0x579524['query'],_0x129ead['filters']),_0x5bace2);if(_0x579524[_0x3906('0x31')][_0x3906('0x3b')]){_0x669f56['where']=_[_0x3906('0x3c')](_0x669f56[_0x3906('0x39')],{'$or':_['map'](_0x5bace2,function(_0x1b99f0){if(_0x1b99f0[_0x3906('0x2c')]!==_0x3906('0x3d')){var _0x5d0489={};_0x5d0489[_0x1b99f0[_0x3906('0x26')]]={'$like':'%'+_0x579524['query'][_0x3906('0x3b')]+'%'};return _0x5d0489;}})});}_0x669f56=_['merge']({},_0x669f56,_0x579524[_0x3906('0x3e')]);var _0x4d4365={'where':_0x669f56['where']};return db[_0x3906('0x29')][_0x3906('0x1d')](_0x4d4365)[_0x3906('0x22')](function(_0x1ffd3e){_0x4878db['count']=_0x1ffd3e;if(_0x579524[_0x3906('0x31')][_0x3906('0x3f')]){_0x669f56[_0x3906('0x40')]=[{'all':!![]}];}return db[_0x3906('0x29')][_0x3906('0x41')](_0x669f56);})['then'](function(_0x310fe9){_0x4878db['rows']=_0x310fe9;return _0x4878db;})[_0x3906('0x22')](respondWithFilteredResult(_0x21f846,_0x669f56))[_0x3906('0x42')](handleError(_0x21f846,null));};exports['show']=function(_0x4d2a63,_0x42d3e8){var _0x332c4d={'raw':![],'where':{'id':_0x4d2a63[_0x3906('0x43')]['id']}},_0x4e93={};_0x4e93[_0x3906('0x2d')]=_[_0x3906('0x2e')](db[_0x3906('0x29')][_0x3906('0x2a')]);_0x4e93[_0x3906('0x31')]=_[_0x3906('0x2e')](_0x4d2a63[_0x3906('0x31')]);_0x4e93[_0x3906('0x2f')]=_[_0x3906('0x30')](_0x4e93[_0x3906('0x2d')],_0x4e93[_0x3906('0x31')]);_0x332c4d[_0x3906('0x32')]=_[_0x3906('0x30')](_0x4e93[_0x3906('0x2d')],qs['fields'](_0x4d2a63[_0x3906('0x31')][_0x3906('0x33')]));_0x332c4d[_0x3906('0x32')]=_0x332c4d['attributes']['length']?_0x332c4d[_0x3906('0x32')]:_0x4e93[_0x3906('0x2d')];if(_0x4d2a63[_0x3906('0x31')][_0x3906('0x3f')]){_0x332c4d[_0x3906('0x40')]=[{'all':!![]}];}_0x332c4d=_['merge']({},_0x332c4d,_0x4d2a63[_0x3906('0x3e')]);return db['FreshdeskAccount'][_0x3906('0x44')](_0x332c4d)[_0x3906('0x22')](handleEntityNotFound(_0x42d3e8,null))[_0x3906('0x22')](respondWithResult(_0x42d3e8,null))[_0x3906('0x42')](handleError(_0x42d3e8,null));};exports[_0x3906('0x45')]=function(_0x1fc9d2,_0x1ba612){return db['FreshdeskAccount'][_0x3906('0x45')](_0x1fc9d2['body'],{})[_0x3906('0x22')](respondWithResult(_0x1ba612,0xc9))['catch'](handleError(_0x1ba612,null));};exports[_0x3906('0x46')]=function(_0x34644b,_0x12fa22){if(_0x34644b[_0x3906('0x47')]['id']){delete _0x34644b['body']['id'];}return db[_0x3906('0x29')][_0x3906('0x44')]({'where':{'id':_0x34644b[_0x3906('0x43')]['id']}})[_0x3906('0x22')](handleEntityNotFound(_0x12fa22,null))[_0x3906('0x22')](saveUpdates(_0x34644b['body'],null))[_0x3906('0x22')](respondWithResult(_0x12fa22,null))['catch'](handleError(_0x12fa22,null));};exports['destroy']=function(_0x1ea769,_0x5a8b46){return db[_0x3906('0x29')][_0x3906('0x44')]({'where':{'id':_0x1ea769[_0x3906('0x43')]['id']}})[_0x3906('0x22')](handleEntityNotFound(_0x5a8b46,null))[_0x3906('0x22')](removeEntity(_0x5a8b46,null))[_0x3906('0x42')](handleError(_0x5a8b46,null));};exports[_0x3906('0x48')]=function(_0x47e9a7,_0x4fc20d,_0x44589a){var _0x3aa53b={};var _0x499281={};var _0xf3b199;var _0x1a385c;return db[_0x3906('0x29')][_0x3906('0x49')]({'where':{'id':_0x47e9a7['params']['id']}})[_0x3906('0x22')](handleEntityNotFound(_0x4fc20d,null))[_0x3906('0x22')](function(_0x3451d7){if(_0x3451d7){_0xf3b199=_0x3451d7;_0x499281[_0x3906('0x2d')]=_[_0x3906('0x2e')](db[_0x3906('0x4a')][_0x3906('0x2a')]);_0x499281[_0x3906('0x31')]=_[_0x3906('0x2e')](_0x47e9a7[_0x3906('0x31')]);_0x499281[_0x3906('0x2f')]=_[_0x3906('0x30')](_0x499281[_0x3906('0x2d')],_0x499281[_0x3906('0x31')]);_0x3aa53b[_0x3906('0x32')]=_[_0x3906('0x30')](_0x499281[_0x3906('0x2d')],qs[_0x3906('0x33')](_0x47e9a7['query']['fields']));_0x3aa53b[_0x3906('0x32')]=_0x3aa53b['attributes'][_0x3906('0x34')]?_0x3aa53b[_0x3906('0x32')]:_0x499281[_0x3906('0x2d')];_0x3aa53b['order']=qs[_0x3906('0x38')](_0x47e9a7[_0x3906('0x31')]['sort']);_0x3aa53b[_0x3906('0x39')]=qs[_0x3906('0x2f')](_[_0x3906('0x3a')](_0x47e9a7[_0x3906('0x31')],_0x499281['filters']));if(_0x47e9a7[_0x3906('0x31')][_0x3906('0x3b')]){_0x3aa53b[_0x3906('0x39')]=_[_0x3906('0x3c')](_0x3aa53b['where'],{'$or':_[_0x3906('0x28')](_0x3aa53b[_0x3906('0x32')],function(_0x52e8b6){var _0x3fd3ea={};_0x3fd3ea[_0x52e8b6]={'$like':'%'+_0x47e9a7[_0x3906('0x31')]['filter']+'%'};return _0x3fd3ea;})});}_0x3aa53b=_['merge']({},_0x3aa53b,_0x47e9a7['options']);return _0xf3b199[_0x3906('0x48')](_0x3aa53b);}})['then'](function(_0xed88e3){if(_0xed88e3){_0x1a385c=_0xed88e3[_0x3906('0x34')];if(!_0x47e9a7[_0x3906('0x31')]['hasOwnProperty'](_0x3906('0x36'))){_0x3aa53b['limit']=qs[_0x3906('0x1c')](_0x47e9a7[_0x3906('0x31')][_0x3906('0x1c')]);_0x3aa53b['offset']=qs['offset'](_0x47e9a7['query'][_0x3906('0x1a')]);}return _0xf3b199[_0x3906('0x48')](_0x3aa53b);}})[_0x3906('0x22')](function(_0x3dfc02){if(_0x3dfc02){return _0x3dfc02?{'count':_0x1a385c,'rows':_0x3dfc02}:null;}})['then'](respondWithResult(_0x4fc20d,null))['catch'](handleError(_0x4fc20d,null));};exports[_0x3906('0x4b')]=function(_0x2fa941,_0x35a891,_0x59a71e){if(_0x2fa941[_0x3906('0x47')]['id']){delete _0x2fa941[_0x3906('0x47')]['id'];}return db[_0x3906('0x29')][_0x3906('0x49')]({'where':{'id':_0x2fa941[_0x3906('0x43')]['id']}})[_0x3906('0x22')](handleEntityNotFound(_0x35a891,null))[_0x3906('0x22')](function(_0x70ae34){if(_0x70ae34){_0x2fa941[_0x3906('0x47')][_0x3906('0x4c')]=_0x70ae34['id'];_0x2fa941['body']['Subjects']=integrations[_0x3906('0x4d')](_0x2fa941[_0x3906('0x47')][_0x3906('0x4e')],_0x2fa941[_0x3906('0x47')][_0x3906('0x2c')]);_0x2fa941[_0x3906('0x47')][_0x3906('0x4f')]=integrations[_0x3906('0x50')](_0x2fa941[_0x3906('0x47')]['channel'],_0x2fa941[_0x3906('0x47')]['type']);return db[_0x3906('0x4a')][_0x3906('0x45')](_0x2fa941['body'],{'include':[{'model':db[_0x3906('0x51')],'as':'Subjects'},{'model':db[_0x3906('0x51')],'as':_0x3906('0x4f')}]});}return null;})[_0x3906('0x22')](respondWithResult(_0x35a891,null))[_0x3906('0x42')](handleError(_0x35a891,null));};exports[_0x3906('0x52')]=function(_0x4528ae,_0x20004d,_0x58000e){var _0x5ea887='';return db[_0x3906('0x29')]['findOne']({'where':{'id':_0x4528ae[_0x3906('0x43')]['id']},'attributes':['id','remoteUri',_0x3906('0x53')]})[_0x3906('0x22')](handleEntityNotFound(_0x20004d,null))['then'](function(_0x4fba7b){if(_0x4fba7b){_0x5ea887=_0x4fba7b['remoteUri'];var _0x5370e2=_0x5ea887[_0x3906('0x54')](-0x1);if(_0x5370e2==='/'){_0x5ea887=_0x5ea887[_0x3906('0x55')](0x0,_0x5ea887['lastIndexOf'](_0x5370e2));}return rp({'method':'GET','uri':util[_0x3906('0x56')](_0x3906('0x57'),_0x5ea887,_0x3906('0x58')),'headers':{'Authorization':util[_0x3906('0x56')](_0x3906('0x59'),new Buffer(util[_0x3906('0x56')](_0x3906('0x5a'),_0x4fba7b['apiKey']))['toString'](_0x3906('0x5b')))},'json':!![]});}})[_0x3906('0x22')](function(_0x244dd3){if(_0x244dd3){var _0x4efcc9=[_0x3906('0x5c'),'subject',_0x3906('0x5d'),_0x3906('0x5e'),'status',_0x3906('0x5f'),_0x3906('0x60'),_0x3906('0x61'),_0x3906('0x62'),_0x3906('0x60'),'company'];_[_0x3906('0x63')](_0x244dd3,function(_0x5e2e87){return _0x4efcc9['includes'](_0x5e2e87[_0x3906('0x26')])||!_0x5e2e87[_0x3906('0x64')]&&_0x5e2e87[_0x3906('0x2c')]!==_0x3906('0x65')&&_0x5e2e87[_0x3906('0x2c')]!==_0x3906('0x66');});return{'count':_0x244dd3[_0x3906('0x34')],'rows':_[_0x3906('0x28')](_0x244dd3,function(_0x1f64e7){return{'id':_0x1f64e7[_0x3906('0x26')],'name':_0x1f64e7[_0x3906('0x67')],'custom':!_0x1f64e7[_0x3906('0x64')],'options':_0x1f64e7['choices']?_[_0x3906('0x28')](_0x1f64e7[_0x3906('0x68')],function(_0x12a1f0){return{'name':_[_0x3906('0x69')](_0x12a1f0),'value':_0x12a1f0};}):[]};})};}})[_0x3906('0x22')](respondWithResult(_0x20004d,null))[_0x3906('0x42')](function(_0x5b8e14){var _0x11f7f7=_0x4528ae[_0x3906('0x31')]['test']?0x1f4:_0x5b8e14[_0x3906('0x6a')]||0x1f4;logger[_0x3906('0x24')](_0x3906('0x6b'),'getFields',_0x11f7f7,JSON[_0x3906('0x6c')](_0x5b8e14));delete _0x5b8e14[_0x3906('0x26')];if(_0x11f7f7===0x191){_0x11f7f7=0x190;}_0x20004d[_0x3906('0x17')](_0x11f7f7)[_0x3906('0x27')](_0x4528ae[_0x3906('0x31')][_0x3906('0x6d')]?{'message':_0x3906('0x6e'),'statusCode':_0x5b8e14['statusCode']}:_0x5b8e14);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a591d39..cdd57e8 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 _0xfb11=['../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x34ae76,_0x4cd562){var _0x5325eb=function(_0x29406a){while(--_0x29406a){_0x34ae76['push'](_0x34ae76['shift']());}};_0x5325eb(++_0x4cd562);}(_0xfb11,0xa1));var _0x1fb1=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xfb11[_0x32d457];return _0x338386;};'use strict';var _=require('lodash');var util=require(_0x1fb1('0x0'));var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require(_0x1fb1('0x3'));var BPromise=require(_0x1fb1('0x4'));var rp=require(_0x1fb1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fb1('0x6'));var config=require(_0x1fb1('0x7'));var attributes=require(_0x1fb1('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3b11d2,_0x5f1545){return _0x3b11d2[_0x1fb1('0x9')](_0x1fb1('0xa'),attributes,{'tableName':_0x1fb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b00=['int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x6b00,0x90));var _0x06b0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6b00[_0x432682];return _0x463d05;};'use strict';var _=require(_0x06b0('0x0'));var util=require('util');var logger=require(_0x06b0('0x1'))(_0x06b0('0x2'));var moment=require(_0x06b0('0x3'));var BPromise=require(_0x06b0('0x4'));var rp=require(_0x06b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06b0('0x6'));var config=require('../../config/environment');var attributes=require(_0x06b0('0x7'));var integrations=require(_0x06b0('0x8'));module[_0x06b0('0x9')]=function(_0x16bd63,_0x15ed4a){return _0x16bd63[_0x06b0('0xa')](_0x06b0('0xb'),attributes,{'tableName':_0x06b0('0xc'),'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 2adcd6d..ec801fe 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 _0xb3bb=['rpc','../../config/environment','jayson/promise','request','then','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','request\x20sent','result','GetFreshdeskAccount','findAll','options','where','attributes','include','model','map','ShowFreshdeskAccount','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18d5a1,_0x52d48b){var _0x3e81eb=function(_0x57e6ad){while(--_0x57e6ad){_0x18d5a1['push'](_0x18d5a1['shift']());}};_0x3e81eb(++_0x52d48b);}(_0xb3bb,0x142));var _0xbb3b=function(_0x384acd,_0x5ad107){_0x384acd=_0x384acd-0x0;var _0x579e24=_0xb3bb[_0x384acd];return _0x579e24;};'use strict';var _=require('lodash');var util=require(_0xbb3b('0x0'));var moment=require(_0xbb3b('0x1'));var BPromise=require(_0xbb3b('0x2'));var rs=require(_0xbb3b('0x3'));var fs=require('fs');var Redis=require(_0xbb3b('0x4'));var db=require(_0xbb3b('0x5'))['db'];var utils=require(_0xbb3b('0x6'));var logger=require(_0xbb3b('0x7'))(_0xbb3b('0x8'));var config=require(_0xbb3b('0x9'));var jayson=require(_0xbb3b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x90b19,_0x11c390,_0x2da65f){return new BPromise(function(_0x5bc402,_0x12e850){return client[_0xbb3b('0xb')](_0x90b19,_0x2da65f)[_0xbb3b('0xc')](function(_0x5f4806){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x11c390,'request\x20sent');logger[_0xbb3b('0xd')](_0xbb3b('0xe'),_0x11c390,'request\x20sent',JSON[_0xbb3b('0xf')](_0x5f4806));if(_0x5f4806[_0xbb3b('0x10')]){if(_0x5f4806[_0xbb3b('0x10')][_0xbb3b('0x11')]===0x1f4){logger[_0xbb3b('0x10')](_0xbb3b('0x12'),_0x11c390,_0x5f4806[_0xbb3b('0x10')][_0xbb3b('0x13')]);return _0x12e850(_0x5f4806[_0xbb3b('0x10')][_0xbb3b('0x13')]);}logger['error'](_0xbb3b('0x12'),_0x11c390,_0x5f4806[_0xbb3b('0x10')][_0xbb3b('0x13')]);return _0x5bc402(_0x5f4806['error'][_0xbb3b('0x13')]);}else{logger[_0xbb3b('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x11c390,_0xbb3b('0x15'));_0x5bc402(_0x5f4806[_0xbb3b('0x16')]['message']);}})['catch'](function(_0x514578){logger[_0xbb3b('0x10')](_0xbb3b('0x12'),_0x11c390,_0x514578);_0x12e850(_0x514578);});});}exports[_0xbb3b('0x17')]=function(_0x39c598){var _0xef4f58=this;return new Promise(function(_0x20d4b5,_0x678867){return db['FreshdeskAccount'][_0xbb3b('0x18')]({'raw':_0x39c598[_0xbb3b('0x19')]?_0x39c598[_0xbb3b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x39c598[_0xbb3b('0x19')]?_0x39c598[_0xbb3b('0x19')][_0xbb3b('0x1a')]||null:null,'attributes':_0x39c598[_0xbb3b('0x19')]?_0x39c598[_0xbb3b('0x19')][_0xbb3b('0x1b')]||null:null,'limit':_0x39c598[_0xbb3b('0x19')]?_0x39c598['options']['limit']||null:null,'include':_0x39c598['options']?_0x39c598[_0xbb3b('0x19')]['include']?_['map'](_0x39c598[_0xbb3b('0x19')][_0xbb3b('0x1c')],function(_0xde4a7f){return{'model':db[_0xde4a7f[_0xbb3b('0x1d')]],'as':_0xde4a7f['as'],'attributes':_0xde4a7f[_0xbb3b('0x1b')],'include':_0xde4a7f[_0xbb3b('0x1c')]?_[_0xbb3b('0x1e')](_0xde4a7f[_0xbb3b('0x1c')],function(_0x2eac66){return{'model':db[_0x2eac66[_0xbb3b('0x1d')]],'as':_0x2eac66['as'],'attributes':_0x2eac66['attributes'],'include':_0x2eac66[_0xbb3b('0x1c')]?_[_0xbb3b('0x1e')](_0x2eac66[_0xbb3b('0x1c')],function(_0x32fe19){return{'model':db[_0x32fe19[_0xbb3b('0x1d')]],'as':_0x32fe19['as'],'attributes':_0x32fe19['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e3cc9){logger[_0xbb3b('0x14')](_0xbb3b('0x17'),_0x39c598);logger[_0xbb3b('0xd')](_0xbb3b('0x17'),_0x39c598,JSON[_0xbb3b('0xf')](_0x1e3cc9));_0x20d4b5(_0x1e3cc9);})['catch'](function(_0x590d20){logger[_0xbb3b('0x10')](_0xbb3b('0x17'),_0x590d20[_0xbb3b('0x13')],_0x39c598);_0x678867(_0xef4f58[_0xbb3b('0x10')](0x1f4,_0x590d20['message']));});});};exports['ShowFreshdeskAccount']=function(_0x4bc916){var _0x73367=this;return new Promise(function(_0x34ada9,_0x4a1c4e){return db['FreshdeskAccount']['find']({'raw':_0x4bc916[_0xbb3b('0x19')]?_0x4bc916[_0xbb3b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4bc916[_0xbb3b('0x19')]?_0x4bc916[_0xbb3b('0x19')][_0xbb3b('0x1a')]||null:null,'attributes':_0x4bc916[_0xbb3b('0x19')]?_0x4bc916[_0xbb3b('0x19')][_0xbb3b('0x1b')]||null:null,'include':_0x4bc916['options']?_0x4bc916[_0xbb3b('0x19')]['include']?_[_0xbb3b('0x1e')](_0x4bc916['options'][_0xbb3b('0x1c')],function(_0x2812dd){return{'model':db[_0x2812dd[_0xbb3b('0x1d')]],'as':_0x2812dd['as'],'attributes':_0x2812dd['attributes'],'include':_0x2812dd[_0xbb3b('0x1c')]?_[_0xbb3b('0x1e')](_0x2812dd[_0xbb3b('0x1c')],function(_0x32c9bb){return{'model':db[_0x32c9bb['model']],'as':_0x32c9bb['as'],'attributes':_0x32c9bb['attributes'],'include':_0x32c9bb['include']?_[_0xbb3b('0x1e')](_0x32c9bb['include'],function(_0x1d50bd){return{'model':db[_0x1d50bd[_0xbb3b('0x1d')]],'as':_0x1d50bd['as'],'attributes':_0x1d50bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a58b2){logger['info'](_0xbb3b('0x1f'),_0x4bc916);logger[_0xbb3b('0xd')](_0xbb3b('0x1f'),_0x4bc916,JSON[_0xbb3b('0xf')](_0x4a58b2));_0x34ada9(_0x4a58b2);})[_0xbb3b('0x20')](function(_0x176f40){logger['error'](_0xbb3b('0x1f'),_0x176f40[_0xbb3b('0x13')],_0x4bc916);_0x4a1c4e(_0x73367[_0xbb3b('0x10')](0x1f4,_0x176f40[_0xbb3b('0x13')]));});});}; \ No newline at end of file +var _0x32c8=['include','map','model','debug','find','ShowFreshdeskAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x32c8,0x17c));var _0x832c=function(_0x214d23,_0x34f179){_0x214d23=_0x214d23-0x0;var _0x31f82a=_0x32c8[_0x214d23];return _0x31f82a;};'use strict';var _=require(_0x832c('0x0'));var util=require(_0x832c('0x1'));var moment=require('moment');var BPromise=require(_0x832c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x832c('0x3'));var db=require(_0x832c('0x4'))['db'];var utils=require(_0x832c('0x5'));var logger=require(_0x832c('0x6'))('rpc');var config=require(_0x832c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x832c('0x8')][_0x832c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20267b,_0x597eb5,_0x449d25){return new BPromise(function(_0x324ce8,_0x580bf6){return client[_0x832c('0xa')](_0x20267b,_0x449d25)[_0x832c('0xb')](function(_0x4c57c0){logger[_0x832c('0xc')](_0x832c('0xd'),_0x597eb5,_0x832c('0xe'));logger['debug'](_0x832c('0xf'),_0x597eb5,_0x832c('0xe'),JSON[_0x832c('0x10')](_0x4c57c0));if(_0x4c57c0[_0x832c('0x11')]){if(_0x4c57c0['error']['code']===0x1f4){logger[_0x832c('0x11')](_0x832c('0xd'),_0x597eb5,_0x4c57c0[_0x832c('0x11')][_0x832c('0x12')]);return _0x580bf6(_0x4c57c0[_0x832c('0x11')][_0x832c('0x12')]);}logger[_0x832c('0x11')](_0x832c('0xd'),_0x597eb5,_0x4c57c0[_0x832c('0x11')][_0x832c('0x12')]);return _0x324ce8(_0x4c57c0[_0x832c('0x11')][_0x832c('0x12')]);}else{logger[_0x832c('0xc')](_0x832c('0xd'),_0x597eb5,_0x832c('0xe'));_0x324ce8(_0x4c57c0[_0x832c('0x13')]['message']);}})[_0x832c('0x14')](function(_0x35072c){logger['error'](_0x832c('0xd'),_0x597eb5,_0x35072c);_0x580bf6(_0x35072c);});});}exports[_0x832c('0x15')]=function(_0x3b4f0e){var _0x2c8ac0=this;return new Promise(function(_0x4bb6e9,_0x4b3f0a){return db[_0x832c('0x16')][_0x832c('0x17')]({'raw':_0x3b4f0e[_0x832c('0x18')]?_0x3b4f0e[_0x832c('0x18')][_0x832c('0x19')]===undefined?!![]:![]:!![],'where':_0x3b4f0e['options']?_0x3b4f0e[_0x832c('0x18')][_0x832c('0x1a')]||null:null,'attributes':_0x3b4f0e[_0x832c('0x18')]?_0x3b4f0e[_0x832c('0x18')][_0x832c('0x1b')]||null:null,'limit':_0x3b4f0e[_0x832c('0x18')]?_0x3b4f0e[_0x832c('0x18')]['limit']||null:null,'include':_0x3b4f0e[_0x832c('0x18')]?_0x3b4f0e['options'][_0x832c('0x1c')]?_[_0x832c('0x1d')](_0x3b4f0e['options'][_0x832c('0x1c')],function(_0x2c6b58){return{'model':db[_0x2c6b58[_0x832c('0x1e')]],'as':_0x2c6b58['as'],'attributes':_0x2c6b58[_0x832c('0x1b')],'include':_0x2c6b58['include']?_['map'](_0x2c6b58[_0x832c('0x1c')],function(_0x33907f){return{'model':db[_0x33907f[_0x832c('0x1e')]],'as':_0x33907f['as'],'attributes':_0x33907f[_0x832c('0x1b')],'include':_0x33907f[_0x832c('0x1c')]?_[_0x832c('0x1d')](_0x33907f[_0x832c('0x1c')],function(_0x2bb85c){return{'model':db[_0x2bb85c[_0x832c('0x1e')]],'as':_0x2bb85c['as'],'attributes':_0x2bb85c[_0x832c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15f931){logger[_0x832c('0xc')]('GetFreshdeskAccount',_0x3b4f0e);logger[_0x832c('0x1f')](_0x832c('0x15'),_0x3b4f0e,JSON[_0x832c('0x10')](_0x15f931));_0x4bb6e9(_0x15f931);})[_0x832c('0x14')](function(_0x1e3df7){logger[_0x832c('0x11')]('GetFreshdeskAccount',_0x1e3df7[_0x832c('0x12')],_0x3b4f0e);_0x4b3f0a(_0x2c8ac0[_0x832c('0x11')](0x1f4,_0x1e3df7['message']));});});};exports['ShowFreshdeskAccount']=function(_0xf647f5){var _0x574d04=this;return new Promise(function(_0x1bf32c,_0x161c5a){return db['FreshdeskAccount'][_0x832c('0x20')]({'raw':_0xf647f5[_0x832c('0x18')]?_0xf647f5[_0x832c('0x18')][_0x832c('0x19')]===undefined?!![]:![]:!![],'where':_0xf647f5[_0x832c('0x18')]?_0xf647f5[_0x832c('0x18')][_0x832c('0x1a')]||null:null,'attributes':_0xf647f5[_0x832c('0x18')]?_0xf647f5[_0x832c('0x18')][_0x832c('0x1b')]||null:null,'include':_0xf647f5[_0x832c('0x18')]?_0xf647f5[_0x832c('0x18')][_0x832c('0x1c')]?_[_0x832c('0x1d')](_0xf647f5[_0x832c('0x18')][_0x832c('0x1c')],function(_0x2def4f){return{'model':db[_0x2def4f[_0x832c('0x1e')]],'as':_0x2def4f['as'],'attributes':_0x2def4f[_0x832c('0x1b')],'include':_0x2def4f[_0x832c('0x1c')]?_[_0x832c('0x1d')](_0x2def4f[_0x832c('0x1c')],function(_0x12b24a){return{'model':db[_0x12b24a[_0x832c('0x1e')]],'as':_0x12b24a['as'],'attributes':_0x12b24a[_0x832c('0x1b')],'include':_0x12b24a[_0x832c('0x1c')]?_[_0x832c('0x1d')](_0x12b24a[_0x832c('0x1c')],function(_0x8b4036){return{'model':db[_0x8b4036[_0x832c('0x1e')]],'as':_0x8b4036['as'],'attributes':_0x8b4036[_0x832c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x832c('0xb')](function(_0x1f9d87){logger[_0x832c('0xc')](_0x832c('0x21'),_0xf647f5);logger[_0x832c('0x1f')](_0x832c('0x21'),_0xf647f5,JSON['stringify'](_0x1f9d87));_0x1bf32c(_0x1f9d87);})['catch'](function(_0x35910e){logger[_0x832c('0x11')](_0x832c('0x21'),_0x35910e[_0x832c('0x12')],_0xf647f5);_0x161c5a(_0x574d04[_0x832c('0x11')](0x1f4,_0x35910e[_0x832c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8358293..85a2c01 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 _0x7fe4=['update','exports','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','put'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7fe4,0x13d));var _0x47fe=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7fe4[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x47fe('0x0'));var router=express['Router']();var fs_extra=require(_0x47fe('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x47fe('0x2'));var config=require(_0x47fe('0x3'));var controller=require(_0x47fe('0x4'));router[_0x47fe('0x5')]('/',auth['isAuthenticated'](),controller[_0x47fe('0x6')]);router[_0x47fe('0x5')](_0x47fe('0x7'),auth[_0x47fe('0x8')](),controller['show']);router[_0x47fe('0x5')](_0x47fe('0x9'),auth['isAuthenticated'](),controller[_0x47fe('0xa')]);router[_0x47fe('0x5')](_0x47fe('0xb'),auth[_0x47fe('0x8')](),controller['getSubjects']);router[_0x47fe('0x5')](_0x47fe('0xc'),auth['isAuthenticated'](),controller[_0x47fe('0xd')]);router[_0x47fe('0x5')]('/:id/tags',auth[_0x47fe('0x8')](),controller[_0x47fe('0xe')]);router[_0x47fe('0xf')]('/',auth[_0x47fe('0x8')](),controller['create']);router['post'](_0x47fe('0x10'),auth[_0x47fe('0x8')](),controller[_0x47fe('0x11')]);router[_0x47fe('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x47fe('0x13')]);router['delete'](_0x47fe('0x7'),auth[_0x47fe('0x8')](),controller['destroy']);module[_0x47fe('0x14')]=router; \ No newline at end of file +var _0x32ef=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','setTags','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x32ef,0x1f0));var _0xf32e=function(_0x4f06c0,_0x26a86c){_0x4f06c0=_0x4f06c0-0x0;var _0x4fe8d2=_0x32ef[_0x4f06c0];return _0x4fe8d2;};'use strict';var multer=require('multer');var util=require(_0xf32e('0x0'));var path=require(_0xf32e('0x1'));var timeout=require(_0xf32e('0x2'));var express=require('express');var router=express[_0xf32e('0x3')]();var fs_extra=require(_0xf32e('0x4'));var auth=require(_0xf32e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf32e('0x6'));var controller=require(_0xf32e('0x7'));router[_0xf32e('0x8')]('/',auth[_0xf32e('0x9')](),controller['index']);router[_0xf32e('0x8')]('/:id',auth[_0xf32e('0x9')](),controller[_0xf32e('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xf32e('0xb')]);router['get'](_0xf32e('0xc'),auth[_0xf32e('0x9')](),controller[_0xf32e('0xd')]);router['get'](_0xf32e('0xe'),auth['isAuthenticated'](),controller[_0xf32e('0xf')]);router[_0xf32e('0x8')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xf32e('0x10')]('/',auth['isAuthenticated'](),controller[_0xf32e('0x11')]);router[_0xf32e('0x10')]('/:id/tags',auth[_0xf32e('0x9')](),controller[_0xf32e('0x12')]);router[_0xf32e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf32e('0x14')]);router[_0xf32e('0x15')]('/:id',auth[_0xf32e('0x9')](),controller[_0xf32e('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 3401c7d..ecb9392 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 _0xf9b4=['STRING','exports'];(function(_0xe89459,_0x1c65d5){var _0x1b02e7=function(_0x373d1d){while(--_0x373d1d){_0xe89459['push'](_0xe89459['shift']());}};_0x1b02e7(++_0x1c65d5);}(_0xf9b4,0x95));var _0x4f9b=function(_0x17b94e,_0x1b2f59){_0x17b94e=_0x17b94e-0x0;var _0x14ab53=_0xf9b4[_0x17b94e];return _0x14ab53;};'use strict';var Sequelize=require('sequelize');module[_0x4f9b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f9b('0x1')]}}; \ No newline at end of file +var _0xfe1d=['exports','STRING'];(function(_0x4ae58a,_0x72bd08){var _0x3c0445=function(_0x15c4cb){while(--_0x15c4cb){_0x4ae58a['push'](_0x4ae58a['shift']());}};_0x3c0445(++_0x72bd08);}(_0xfe1d,0x1a6));var _0xdfe1=function(_0x286bf4,_0x1171fb){_0x286bf4=_0x286bf4-0x0;var _0x4624aa=_0xfe1d[_0x286bf4];return _0x4624aa;};'use strict';var Sequelize=require('sequelize');module[_0xdfe1('0x0')]={'name':{'type':Sequelize[_0xdfe1('0x1')]},'description':{'type':Sequelize[_0xdfe1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 94d5409..7f77118 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 _0xbee9=['../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','reject','save','then','sendStatus','error','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','show','params','include','find','catch','create','body','destroy','getFields','findOne','getSubjects','getDescriptions','FreshdeskField','getTags','setTags','ids','eml-format','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/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbee9,0x91));var _0x9bee=function(_0x2e0dfe,_0x3ff5db){_0x2e0dfe=_0x2e0dfe-0x0;var _0x349546=_0xbee9[_0x2e0dfe];return _0x349546;};'use strict';var emlformat=require(_0x9bee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9bee('0x1'));var jsonpatch=require(_0x9bee('0x2'));var rp=require(_0x9bee('0x3'));var moment=require(_0x9bee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bee('0x5'));var util=require(_0x9bee('0x6'));var path=require(_0x9bee('0x7'));var sox=require(_0x9bee('0x8'));var csv=require(_0x9bee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bee('0xa'));var _=require(_0x9bee('0xb'));var squel=require(_0x9bee('0xc'));var crypto=require(_0x9bee('0xd'));var jsforce=require(_0x9bee('0xe'));var deskjs=require(_0x9bee('0xf'));var toCsv=require(_0x9bee('0x9'));var querystring=require(_0x9bee('0x10'));var Papa=require(_0x9bee('0x11'));var Redis=require(_0x9bee('0x12'));var authService=require(_0x9bee('0x13'));var qs=require(_0x9bee('0x14'));var as=require(_0x9bee('0x15'));var hardwareService=require(_0x9bee('0x16'));var logger=require(_0x9bee('0x17'))(_0x9bee('0x18'));var utils=require(_0x9bee('0x19'));var config=require(_0x9bee('0x1a'));var licenseUtil=require(_0x9bee('0x1b'));var db=require(_0x9bee('0x1c'))['db'];function respondWithStatusCode(_0x4f4f69,_0x1c1e90){_0x1c1e90=_0x1c1e90||0xcc;return function(_0x2b6891){if(_0x2b6891){return _0x4f4f69['sendStatus'](_0x1c1e90);}return _0x4f4f69[_0x9bee('0x1d')](_0x1c1e90)[_0x9bee('0x1e')]();};}function respondWithResult(_0x37bdf8,_0x2254af){_0x2254af=_0x2254af||0xc8;return function(_0xba4808){if(_0xba4808){return _0x37bdf8['status'](_0x2254af)['json'](_0xba4808);}};}function respondWithFilteredResult(_0x5285e3,_0x323ff3){return function(_0x2187ab){if(_0x2187ab){var _0x870296=typeof _0x323ff3[_0x9bee('0x1f')]===_0x9bee('0x20')&&typeof _0x323ff3[_0x9bee('0x21')]==='undefined';var _0xfbfdcb=_0x2187ab[_0x9bee('0x22')];var _0x57206f=_0x870296?0x0:_0x323ff3['offset'];var _0x480cf9=_0x870296?_0x2187ab[_0x9bee('0x22')]:_0x323ff3['offset']+_0x323ff3[_0x9bee('0x21')];var _0x489d3c;if(_0x480cf9>=_0xfbfdcb){_0x480cf9=_0xfbfdcb;_0x489d3c=0xc8;}else{_0x489d3c=0xce;}_0x5285e3['status'](_0x489d3c);return _0x5285e3[_0x9bee('0x23')]('Content-Range',_0x57206f+'-'+_0x480cf9+'/'+_0xfbfdcb)['json'](_0x2187ab);}return null;};}function patchUpdates(_0x25fbfd){return function(_0x2083c9){try{jsonpatch['apply'](_0x2083c9,_0x25fbfd,!![]);}catch(_0x2daeae){return BPromise[_0x9bee('0x24')](_0x2daeae);}return _0x2083c9[_0x9bee('0x25')]();};}function saveUpdates(_0x2f0a00,_0xbaab9b){return function(_0xf21607){if(_0xf21607){return _0xf21607['update'](_0x2f0a00)[_0x9bee('0x26')](function(_0x31ae23){return _0x31ae23;});}return null;};}function removeEntity(_0x127022,_0x40f6bb){return function(_0x1c300c){if(_0x1c300c){return _0x1c300c['destroy']()[_0x9bee('0x26')](function(){_0x127022['status'](0xcc)[_0x9bee('0x1e')]();});}};}function handleEntityNotFound(_0x3892b6,_0x1baf4b){return function(_0x21cf99){if(!_0x21cf99){_0x3892b6[_0x9bee('0x27')](0x194);}return _0x21cf99;};}function handleError(_0x91e34c,_0x2107a1){_0x2107a1=_0x2107a1||0x1f4;return function(_0x2a4ed5){logger[_0x9bee('0x28')](_0x2a4ed5[_0x9bee('0x29')]);if(_0x2a4ed5['name']){delete _0x2a4ed5['name'];}_0x91e34c[_0x9bee('0x1d')](_0x2107a1)[_0x9bee('0x2a')](_0x2a4ed5);};}exports[_0x9bee('0x2b')]=function(_0x5dc4a1,_0x3df02a){var _0x4c2de2={},_0x37ecb6={},_0x387254={'count':0x0,'rows':[]};var _0x352272=_[_0x9bee('0x2c')](db[_0x9bee('0x2d')][_0x9bee('0x2e')],function(_0x5cdc11){return{'name':_0x5cdc11[_0x9bee('0x2f')],'type':_0x5cdc11[_0x9bee('0x30')][_0x9bee('0x31')]};});_0x37ecb6['model']=_[_0x9bee('0x2c')](_0x352272,_0x9bee('0x32'));_0x37ecb6[_0x9bee('0x33')]=_[_0x9bee('0x34')](_0x5dc4a1[_0x9bee('0x33')]);_0x37ecb6[_0x9bee('0x35')]=_['intersection'](_0x37ecb6[_0x9bee('0x36')],_0x37ecb6[_0x9bee('0x33')]);_0x4c2de2[_0x9bee('0x37')]=_[_0x9bee('0x38')](_0x37ecb6[_0x9bee('0x36')],qs['fields'](_0x5dc4a1['query'][_0x9bee('0x39')]));_0x4c2de2['attributes']=_0x4c2de2[_0x9bee('0x37')][_0x9bee('0x3a')]?_0x4c2de2[_0x9bee('0x37')]:_0x37ecb6[_0x9bee('0x36')];if(!_0x5dc4a1[_0x9bee('0x33')][_0x9bee('0x3b')](_0x9bee('0x3c'))){_0x4c2de2['limit']=qs[_0x9bee('0x21')](_0x5dc4a1['query'][_0x9bee('0x21')]);_0x4c2de2[_0x9bee('0x1f')]=qs['offset'](_0x5dc4a1['query'][_0x9bee('0x1f')]);}_0x4c2de2[_0x9bee('0x3d')]=qs['sort'](_0x5dc4a1[_0x9bee('0x33')][_0x9bee('0x3e')]);_0x4c2de2['where']=qs[_0x9bee('0x35')](_[_0x9bee('0x3f')](_0x5dc4a1['query'],_0x37ecb6[_0x9bee('0x35')]),_0x352272);if(_0x5dc4a1['query'][_0x9bee('0x40')]){_0x4c2de2[_0x9bee('0x41')]=_['merge'](_0x4c2de2[_0x9bee('0x41')],{'$or':_['map'](_0x352272,function(_0x117658){if(_0x117658[_0x9bee('0x30')]!=='VIRTUAL'){var _0x7fbfb5={};_0x7fbfb5[_0x117658[_0x9bee('0x32')]]={'$like':'%'+_0x5dc4a1[_0x9bee('0x33')][_0x9bee('0x40')]+'%'};return _0x7fbfb5;}})});}_0x4c2de2=_[_0x9bee('0x42')]({},_0x4c2de2,_0x5dc4a1[_0x9bee('0x43')]);var _0x584a25={'where':_0x4c2de2['where']};return db[_0x9bee('0x2d')][_0x9bee('0x22')](_0x584a25)[_0x9bee('0x26')](function(_0x480933){_0x387254[_0x9bee('0x22')]=_0x480933;if(_0x5dc4a1[_0x9bee('0x33')][_0x9bee('0x44')]){_0x4c2de2['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x9bee('0x45')](_0x4c2de2);})[_0x9bee('0x26')](function(_0x83cac5){_0x387254['rows']=_0x83cac5;return _0x387254;})[_0x9bee('0x26')](respondWithFilteredResult(_0x3df02a,_0x4c2de2))['catch'](handleError(_0x3df02a,null));};exports[_0x9bee('0x46')]=function(_0x222ae1,_0x411d3b){var _0x10657d={'raw':![],'where':{'id':_0x222ae1[_0x9bee('0x47')]['id']}},_0x207bd1={};_0x207bd1[_0x9bee('0x36')]=_['keys'](db[_0x9bee('0x2d')][_0x9bee('0x2e')]);_0x207bd1[_0x9bee('0x33')]=_[_0x9bee('0x34')](_0x222ae1[_0x9bee('0x33')]);_0x207bd1[_0x9bee('0x35')]=_[_0x9bee('0x38')](_0x207bd1['model'],_0x207bd1[_0x9bee('0x33')]);_0x10657d[_0x9bee('0x37')]=_[_0x9bee('0x38')](_0x207bd1[_0x9bee('0x36')],qs[_0x9bee('0x39')](_0x222ae1[_0x9bee('0x33')][_0x9bee('0x39')]));_0x10657d[_0x9bee('0x37')]=_0x10657d[_0x9bee('0x37')][_0x9bee('0x3a')]?_0x10657d[_0x9bee('0x37')]:_0x207bd1[_0x9bee('0x36')];if(_0x222ae1[_0x9bee('0x33')][_0x9bee('0x44')]){_0x10657d[_0x9bee('0x48')]=[{'all':!![]}];}_0x10657d=_[_0x9bee('0x42')]({},_0x10657d,_0x222ae1[_0x9bee('0x43')]);return db['FreshdeskConfiguration'][_0x9bee('0x49')](_0x10657d)[_0x9bee('0x26')](handleEntityNotFound(_0x411d3b,null))['then'](respondWithResult(_0x411d3b,null))[_0x9bee('0x4a')](handleError(_0x411d3b,null));};exports['create']=function(_0x4163db,_0x523332){return db[_0x9bee('0x2d')][_0x9bee('0x4b')](_0x4163db[_0x9bee('0x4c')],{})[_0x9bee('0x26')](respondWithResult(_0x523332,0xc9))[_0x9bee('0x4a')](handleError(_0x523332,null));};exports['update']=function(_0x8313f2,_0x22233a){if(_0x8313f2['body']['id']){delete _0x8313f2[_0x9bee('0x4c')]['id'];}return db[_0x9bee('0x2d')][_0x9bee('0x49')]({'where':{'id':_0x8313f2['params']['id']}})[_0x9bee('0x26')](handleEntityNotFound(_0x22233a,null))[_0x9bee('0x26')](saveUpdates(_0x8313f2['body'],null))[_0x9bee('0x26')](respondWithResult(_0x22233a,null))[_0x9bee('0x4a')](handleError(_0x22233a,null));};exports[_0x9bee('0x4d')]=function(_0x2dd0a2,_0x1c2bd9){return db[_0x9bee('0x2d')][_0x9bee('0x49')]({'where':{'id':_0x2dd0a2[_0x9bee('0x47')]['id']}})[_0x9bee('0x26')](handleEntityNotFound(_0x1c2bd9,null))['then'](removeEntity(_0x1c2bd9,null))[_0x9bee('0x4a')](handleError(_0x1c2bd9,null));};exports[_0x9bee('0x4e')]=function(_0x38435d,_0x457b0f,_0x15889b){var _0x4aa824={};var _0x4f97f2={};var _0x15cd39;var _0x4891df;return db[_0x9bee('0x2d')][_0x9bee('0x4f')]({'where':{'id':_0x38435d[_0x9bee('0x47')]['id']}})[_0x9bee('0x26')](handleEntityNotFound(_0x457b0f,null))[_0x9bee('0x26')](function(_0x7de3d3){if(_0x7de3d3){_0x15cd39=_0x7de3d3;_0x4f97f2['model']=_['keys'](db['FreshdeskField'][_0x9bee('0x2e')]);_0x4f97f2['query']=_['keys'](_0x38435d[_0x9bee('0x33')]);_0x4f97f2[_0x9bee('0x35')]=_[_0x9bee('0x38')](_0x4f97f2[_0x9bee('0x36')],_0x4f97f2[_0x9bee('0x33')]);_0x4aa824[_0x9bee('0x37')]=_[_0x9bee('0x38')](_0x4f97f2['model'],qs[_0x9bee('0x39')](_0x38435d['query'][_0x9bee('0x39')]));_0x4aa824[_0x9bee('0x37')]=_0x4aa824[_0x9bee('0x37')]['length']?_0x4aa824['attributes']:_0x4f97f2['model'];_0x4aa824['order']=qs[_0x9bee('0x3e')](_0x38435d['query'][_0x9bee('0x3e')]);_0x4aa824[_0x9bee('0x41')]=qs[_0x9bee('0x35')](_[_0x9bee('0x3f')](_0x38435d['query'],_0x4f97f2[_0x9bee('0x35')]));if(_0x38435d['query'][_0x9bee('0x40')]){_0x4aa824[_0x9bee('0x41')]=_['merge'](_0x4aa824['where'],{'$or':_[_0x9bee('0x2c')](_0x4aa824['attributes'],function(_0x49ce56){var _0x576247={};_0x576247[_0x49ce56]={'$like':'%'+_0x38435d[_0x9bee('0x33')]['filter']+'%'};return _0x576247;})});}_0x4aa824=_['merge']({},_0x4aa824,_0x38435d['options']);return _0x15cd39['getFields'](_0x4aa824);}})[_0x9bee('0x26')](function(_0x39ab78){if(_0x39ab78){_0x4891df=_0x39ab78[_0x9bee('0x3a')];if(!_0x38435d[_0x9bee('0x33')]['hasOwnProperty'](_0x9bee('0x3c'))){_0x4aa824['limit']=qs['limit'](_0x38435d[_0x9bee('0x33')]['limit']);_0x4aa824['offset']=qs['offset'](_0x38435d[_0x9bee('0x33')]['offset']);}return _0x15cd39[_0x9bee('0x4e')](_0x4aa824);}})['then'](function(_0x45123d){if(_0x45123d){return _0x45123d?{'count':_0x4891df,'rows':_0x45123d}:null;}})['then'](respondWithResult(_0x457b0f,null))[_0x9bee('0x4a')](handleError(_0x457b0f,null));};exports['getSubjects']=function(_0x47d2d6,_0x18a98b,_0x92cd7f){var _0x597770={};var _0x2c8a72={};var _0x450f74;var _0x15e977;return db[_0x9bee('0x2d')]['findOne']({'where':{'id':_0x47d2d6[_0x9bee('0x47')]['id']}})[_0x9bee('0x26')](handleEntityNotFound(_0x18a98b,null))['then'](function(_0x321006){if(_0x321006){_0x450f74=_0x321006;_0x2c8a72['model']=_[_0x9bee('0x34')](db['FreshdeskField'][_0x9bee('0x2e')]);_0x2c8a72['query']=_[_0x9bee('0x34')](_0x47d2d6[_0x9bee('0x33')]);_0x2c8a72[_0x9bee('0x35')]=_[_0x9bee('0x38')](_0x2c8a72[_0x9bee('0x36')],_0x2c8a72[_0x9bee('0x33')]);_0x597770['attributes']=_[_0x9bee('0x38')](_0x2c8a72[_0x9bee('0x36')],qs[_0x9bee('0x39')](_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x39')]));_0x597770[_0x9bee('0x37')]=_0x597770['attributes'][_0x9bee('0x3a')]?_0x597770[_0x9bee('0x37')]:_0x2c8a72[_0x9bee('0x36')];_0x597770[_0x9bee('0x3d')]=qs['sort'](_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x3e')]);_0x597770[_0x9bee('0x41')]=qs[_0x9bee('0x35')](_[_0x9bee('0x3f')](_0x47d2d6[_0x9bee('0x33')],_0x2c8a72[_0x9bee('0x35')]));if(_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x40')]){_0x597770['where']=_[_0x9bee('0x42')](_0x597770['where'],{'$or':_[_0x9bee('0x2c')](_0x597770['attributes'],function(_0x384489){var _0xd25e4d={};_0xd25e4d[_0x384489]={'$like':'%'+_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x40')]+'%'};return _0xd25e4d;})});}_0x597770=_[_0x9bee('0x42')]({},_0x597770,_0x47d2d6[_0x9bee('0x43')]);return _0x450f74['getSubjects'](_0x597770);}})[_0x9bee('0x26')](function(_0x344859){if(_0x344859){_0x15e977=_0x344859[_0x9bee('0x3a')];if(!_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x3b')]('nolimit')){_0x597770[_0x9bee('0x21')]=qs[_0x9bee('0x21')](_0x47d2d6['query'][_0x9bee('0x21')]);_0x597770[_0x9bee('0x1f')]=qs[_0x9bee('0x1f')](_0x47d2d6[_0x9bee('0x33')][_0x9bee('0x1f')]);}return _0x450f74[_0x9bee('0x50')](_0x597770);}})[_0x9bee('0x26')](function(_0x3c94aa){if(_0x3c94aa){return _0x3c94aa?{'count':_0x15e977,'rows':_0x3c94aa}:null;}})[_0x9bee('0x26')](respondWithResult(_0x18a98b,null))[_0x9bee('0x4a')](handleError(_0x18a98b,null));};exports[_0x9bee('0x51')]=function(_0x29f485,_0x419f53,_0x346d1d){var _0x4006de={};var _0x5135c3={};var _0xb984f7;var _0x460b6b;return db[_0x9bee('0x2d')][_0x9bee('0x4f')]({'where':{'id':_0x29f485['params']['id']}})['then'](handleEntityNotFound(_0x419f53,null))[_0x9bee('0x26')](function(_0x8c2b8a){if(_0x8c2b8a){_0xb984f7=_0x8c2b8a;_0x5135c3[_0x9bee('0x36')]=_[_0x9bee('0x34')](db[_0x9bee('0x52')][_0x9bee('0x2e')]);_0x5135c3['query']=_[_0x9bee('0x34')](_0x29f485[_0x9bee('0x33')]);_0x5135c3[_0x9bee('0x35')]=_[_0x9bee('0x38')](_0x5135c3['model'],_0x5135c3[_0x9bee('0x33')]);_0x4006de[_0x9bee('0x37')]=_[_0x9bee('0x38')](_0x5135c3[_0x9bee('0x36')],qs[_0x9bee('0x39')](_0x29f485[_0x9bee('0x33')][_0x9bee('0x39')]));_0x4006de['attributes']=_0x4006de[_0x9bee('0x37')][_0x9bee('0x3a')]?_0x4006de[_0x9bee('0x37')]:_0x5135c3['model'];_0x4006de[_0x9bee('0x3d')]=qs[_0x9bee('0x3e')](_0x29f485[_0x9bee('0x33')]['sort']);_0x4006de[_0x9bee('0x41')]=qs[_0x9bee('0x35')](_[_0x9bee('0x3f')](_0x29f485['query'],_0x5135c3[_0x9bee('0x35')]));if(_0x29f485[_0x9bee('0x33')][_0x9bee('0x40')]){_0x4006de[_0x9bee('0x41')]=_[_0x9bee('0x42')](_0x4006de['where'],{'$or':_['map'](_0x4006de[_0x9bee('0x37')],function(_0x291a06){var _0x4d01f6={};_0x4d01f6[_0x291a06]={'$like':'%'+_0x29f485[_0x9bee('0x33')][_0x9bee('0x40')]+'%'};return _0x4d01f6;})});}_0x4006de=_[_0x9bee('0x42')]({},_0x4006de,_0x29f485[_0x9bee('0x43')]);return _0xb984f7[_0x9bee('0x51')](_0x4006de);}})[_0x9bee('0x26')](function(_0xf76d57){if(_0xf76d57){_0x460b6b=_0xf76d57[_0x9bee('0x3a')];if(!_0x29f485[_0x9bee('0x33')][_0x9bee('0x3b')](_0x9bee('0x3c'))){_0x4006de['limit']=qs[_0x9bee('0x21')](_0x29f485[_0x9bee('0x33')]['limit']);_0x4006de[_0x9bee('0x1f')]=qs['offset'](_0x29f485['query'][_0x9bee('0x1f')]);}return _0xb984f7[_0x9bee('0x51')](_0x4006de);}})[_0x9bee('0x26')](function(_0x579163){if(_0x579163){return _0x579163?{'count':_0x460b6b,'rows':_0x579163}:null;}})['then'](respondWithResult(_0x419f53,null))[_0x9bee('0x4a')](handleError(_0x419f53,null));};exports['getTags']=function(_0x35bf1f,_0x3c3f61,_0x4e2231){var _0x17b888={};var _0x25e796={};var _0x3f5a95;var _0x55486d;return db['FreshdeskConfiguration'][_0x9bee('0x4f')]({'where':{'id':_0x35bf1f[_0x9bee('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c3f61,null))[_0x9bee('0x26')](function(_0x267f2f){if(_0x267f2f){_0x3f5a95=_0x267f2f;_0x25e796[_0x9bee('0x36')]=_['keys'](db['Tag']['rawAttributes']);_0x25e796[_0x9bee('0x33')]=_['keys'](_0x35bf1f[_0x9bee('0x33')]);_0x25e796[_0x9bee('0x35')]=_[_0x9bee('0x38')](_0x25e796[_0x9bee('0x36')],_0x25e796[_0x9bee('0x33')]);_0x17b888[_0x9bee('0x37')]=_[_0x9bee('0x38')](_0x25e796[_0x9bee('0x36')],qs[_0x9bee('0x39')](_0x35bf1f[_0x9bee('0x33')][_0x9bee('0x39')]));_0x17b888[_0x9bee('0x37')]=_0x17b888[_0x9bee('0x37')][_0x9bee('0x3a')]?_0x17b888[_0x9bee('0x37')]:_0x25e796['model'];_0x17b888[_0x9bee('0x3d')]=qs[_0x9bee('0x3e')](_0x35bf1f[_0x9bee('0x33')][_0x9bee('0x3e')]);_0x17b888[_0x9bee('0x41')]=qs[_0x9bee('0x35')](_[_0x9bee('0x3f')](_0x35bf1f[_0x9bee('0x33')],_0x25e796[_0x9bee('0x35')]));if(_0x35bf1f['query']['filter']){_0x17b888[_0x9bee('0x41')]=_['merge'](_0x17b888[_0x9bee('0x41')],{'$or':_['map'](_0x17b888[_0x9bee('0x37')],function(_0x22c02e){var _0x5d3906={};_0x5d3906[_0x22c02e]={'$like':'%'+_0x35bf1f[_0x9bee('0x33')][_0x9bee('0x40')]+'%'};return _0x5d3906;})});}_0x17b888=_[_0x9bee('0x42')]({},_0x17b888,_0x35bf1f[_0x9bee('0x43')]);return _0x3f5a95[_0x9bee('0x53')](_0x17b888);}})[_0x9bee('0x26')](function(_0x11afc3){if(_0x11afc3){_0x55486d=_0x11afc3[_0x9bee('0x3a')];if(!_0x35bf1f['query'][_0x9bee('0x3b')](_0x9bee('0x3c'))){_0x17b888[_0x9bee('0x21')]=qs['limit'](_0x35bf1f[_0x9bee('0x33')][_0x9bee('0x21')]);_0x17b888[_0x9bee('0x1f')]=qs[_0x9bee('0x1f')](_0x35bf1f['query']['offset']);}return _0x3f5a95[_0x9bee('0x53')](_0x17b888);}})[_0x9bee('0x26')](function(_0x736260){if(_0x736260){return _0x736260?{'count':_0x55486d,'rows':_0x736260}:null;}})[_0x9bee('0x26')](respondWithResult(_0x3c3f61,null))['catch'](handleError(_0x3c3f61,null));};exports[_0x9bee('0x54')]=function(_0x25df42,_0x36b7a7,_0x5069d7){if(_0x25df42[_0x9bee('0x4c')]['id']){delete _0x25df42['body']['id'];}return db['FreshdeskConfiguration'][_0x9bee('0x4f')]({'where':{'id':_0x25df42[_0x9bee('0x47')]['id']}})[_0x9bee('0x26')](handleEntityNotFound(_0x36b7a7,null))[_0x9bee('0x26')](function(_0x5d9853){if(_0x5d9853){return _0x5d9853[_0x9bee('0x54')](_0x25df42[_0x9bee('0x4c')][_0x9bee('0x55')]||[]);}return null;})[_0x9bee('0x26')](respondWithResult(_0x36b7a7,null))[_0x9bee('0x4a')](handleError(_0x36b7a7,null));}; \ No newline at end of file +var _0x52eb=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','error','stack','name','map','FreshdeskConfiguration','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','getFields','getSubjects','getDescriptions','FreshdeskField','pick','getTags','Tag','setTags','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../config/logger','api'];(function(_0xecfaeb,_0x1d6cf0){var _0x37533d=function(_0x68b5da){while(--_0x68b5da){_0xecfaeb['push'](_0xecfaeb['shift']());}};_0x37533d(++_0x1d6cf0);}(_0x52eb,0xd7));var _0xb52e=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x52eb[_0x11f249];return _0x5c3656;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb52e('0x0'));var jsonpatch=require(_0xb52e('0x1'));var rp=require(_0xb52e('0x2'));var moment=require(_0xb52e('0x3'));var BPromise=require(_0xb52e('0x4'));var Mustache=require(_0xb52e('0x5'));var util=require(_0xb52e('0x6'));var path=require(_0xb52e('0x7'));var sox=require(_0xb52e('0x8'));var csv=require(_0xb52e('0x9'));var ejs=require(_0xb52e('0xa'));var fs=require('fs');var fs_extra=require(_0xb52e('0xb'));var _=require(_0xb52e('0xc'));var squel=require(_0xb52e('0xd'));var crypto=require(_0xb52e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb52e('0xf'));var toCsv=require(_0xb52e('0x9'));var querystring=require(_0xb52e('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb52e('0x11'))(_0xb52e('0x12'));var utils=require(_0xb52e('0x13'));var config=require(_0xb52e('0x14'));var licenseUtil=require(_0xb52e('0x15'));var db=require(_0xb52e('0x16'))['db'];function respondWithStatusCode(_0x5c7395,_0x79c530){_0x79c530=_0x79c530||0xcc;return function(_0x1c4405){if(_0x1c4405){return _0x5c7395[_0xb52e('0x17')](_0x79c530);}return _0x5c7395[_0xb52e('0x18')](_0x79c530)[_0xb52e('0x19')]();};}function respondWithResult(_0x2f4e80,_0x35e815){_0x35e815=_0x35e815||0xc8;return function(_0x52943a){if(_0x52943a){return _0x2f4e80['status'](_0x35e815)[_0xb52e('0x1a')](_0x52943a);}};}function respondWithFilteredResult(_0x1fc44d,_0x4fc545){return function(_0x241364){if(_0x241364){var _0x306917=typeof _0x4fc545['offset']===_0xb52e('0x1b')&&typeof _0x4fc545['limit']==='undefined';var _0xe3429=_0x241364[_0xb52e('0x1c')];var _0x502249=_0x306917?0x0:_0x4fc545[_0xb52e('0x1d')];var _0x38e3df=_0x306917?_0x241364[_0xb52e('0x1c')]:_0x4fc545[_0xb52e('0x1d')]+_0x4fc545[_0xb52e('0x1e')];var _0x249f45;if(_0x38e3df>=_0xe3429){_0x38e3df=_0xe3429;_0x249f45=0xc8;}else{_0x249f45=0xce;}_0x1fc44d[_0xb52e('0x18')](_0x249f45);return _0x1fc44d[_0xb52e('0x1f')]('Content-Range',_0x502249+'-'+_0x38e3df+'/'+_0xe3429)[_0xb52e('0x1a')](_0x241364);}return null;};}function patchUpdates(_0x63e4df){return function(_0x3f06bf){try{jsonpatch['apply'](_0x3f06bf,_0x63e4df,!![]);}catch(_0x513a45){return BPromise[_0xb52e('0x20')](_0x513a45);}return _0x3f06bf[_0xb52e('0x21')]();};}function saveUpdates(_0x438660,_0x5bf62d){return function(_0x54b19){if(_0x54b19){return _0x54b19[_0xb52e('0x22')](_0x438660)['then'](function(_0x524657){return _0x524657;});}return null;};}function removeEntity(_0x4c3f0f,_0x38eb19){return function(_0x4152f7){if(_0x4152f7){return _0x4152f7['destroy']()[_0xb52e('0x23')](function(){_0x4c3f0f['status'](0xcc)[_0xb52e('0x19')]();});}};}function handleEntityNotFound(_0x55f037,_0x35fb05){return function(_0xf98b5b){if(!_0xf98b5b){_0x55f037['sendStatus'](0x194);}return _0xf98b5b;};}function handleError(_0x3a3832,_0x482798){_0x482798=_0x482798||0x1f4;return function(_0x394769){logger[_0xb52e('0x24')](_0x394769[_0xb52e('0x25')]);if(_0x394769['name']){delete _0x394769[_0xb52e('0x26')];}_0x3a3832[_0xb52e('0x18')](_0x482798)['send'](_0x394769);};}exports['index']=function(_0x14f74e,_0x242550){var _0x1bee4b={},_0x57a662={},_0xee106c={'count':0x0,'rows':[]};var _0x2b4ff9=_[_0xb52e('0x27')](db[_0xb52e('0x28')]['rawAttributes'],function(_0x47494f){return{'name':_0x47494f['fieldName'],'type':_0x47494f['type'][_0xb52e('0x29')]};});_0x57a662[_0xb52e('0x2a')]=_[_0xb52e('0x27')](_0x2b4ff9,'name');_0x57a662[_0xb52e('0x2b')]=_[_0xb52e('0x2c')](_0x14f74e['query']);_0x57a662[_0xb52e('0x2d')]=_[_0xb52e('0x2e')](_0x57a662['model'],_0x57a662[_0xb52e('0x2b')]);_0x1bee4b[_0xb52e('0x2f')]=_[_0xb52e('0x2e')](_0x57a662[_0xb52e('0x2a')],qs[_0xb52e('0x30')](_0x14f74e[_0xb52e('0x2b')]['fields']));_0x1bee4b['attributes']=_0x1bee4b[_0xb52e('0x2f')][_0xb52e('0x31')]?_0x1bee4b['attributes']:_0x57a662['model'];if(!_0x14f74e[_0xb52e('0x2b')][_0xb52e('0x32')](_0xb52e('0x33'))){_0x1bee4b[_0xb52e('0x1e')]=qs['limit'](_0x14f74e[_0xb52e('0x2b')][_0xb52e('0x1e')]);_0x1bee4b[_0xb52e('0x1d')]=qs[_0xb52e('0x1d')](_0x14f74e[_0xb52e('0x2b')][_0xb52e('0x1d')]);}_0x1bee4b[_0xb52e('0x34')]=qs[_0xb52e('0x35')](_0x14f74e['query']['sort']);_0x1bee4b[_0xb52e('0x36')]=qs[_0xb52e('0x2d')](_['pick'](_0x14f74e[_0xb52e('0x2b')],_0x57a662[_0xb52e('0x2d')]),_0x2b4ff9);if(_0x14f74e[_0xb52e('0x2b')]['filter']){_0x1bee4b[_0xb52e('0x36')]=_[_0xb52e('0x37')](_0x1bee4b[_0xb52e('0x36')],{'$or':_[_0xb52e('0x27')](_0x2b4ff9,function(_0x59e695){if(_0x59e695['type']!==_0xb52e('0x38')){var _0x833677={};_0x833677[_0x59e695[_0xb52e('0x26')]]={'$like':'%'+_0x14f74e[_0xb52e('0x2b')][_0xb52e('0x39')]+'%'};return _0x833677;}})});}_0x1bee4b=_[_0xb52e('0x37')]({},_0x1bee4b,_0x14f74e[_0xb52e('0x3a')]);var _0x2b6f75={'where':_0x1bee4b[_0xb52e('0x36')]};return db['FreshdeskConfiguration'][_0xb52e('0x1c')](_0x2b6f75)[_0xb52e('0x23')](function(_0x3542a8){_0xee106c[_0xb52e('0x1c')]=_0x3542a8;if(_0x14f74e['query']['includeAll']){_0x1bee4b[_0xb52e('0x3b')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb52e('0x3c')](_0x1bee4b);})['then'](function(_0x2aa1f0){_0xee106c['rows']=_0x2aa1f0;return _0xee106c;})['then'](respondWithFilteredResult(_0x242550,_0x1bee4b))[_0xb52e('0x3d')](handleError(_0x242550,null));};exports[_0xb52e('0x3e')]=function(_0x2d7827,_0x12076f){var _0x391ada={'raw':![],'where':{'id':_0x2d7827[_0xb52e('0x3f')]['id']}},_0x47b03e={};_0x47b03e[_0xb52e('0x2a')]=_['keys'](db['FreshdeskConfiguration'][_0xb52e('0x40')]);_0x47b03e[_0xb52e('0x2b')]=_[_0xb52e('0x2c')](_0x2d7827[_0xb52e('0x2b')]);_0x47b03e[_0xb52e('0x2d')]=_[_0xb52e('0x2e')](_0x47b03e[_0xb52e('0x2a')],_0x47b03e[_0xb52e('0x2b')]);_0x391ada[_0xb52e('0x2f')]=_[_0xb52e('0x2e')](_0x47b03e[_0xb52e('0x2a')],qs[_0xb52e('0x30')](_0x2d7827[_0xb52e('0x2b')][_0xb52e('0x30')]));_0x391ada[_0xb52e('0x2f')]=_0x391ada[_0xb52e('0x2f')]['length']?_0x391ada[_0xb52e('0x2f')]:_0x47b03e['model'];if(_0x2d7827[_0xb52e('0x2b')][_0xb52e('0x41')]){_0x391ada[_0xb52e('0x3b')]=[{'all':!![]}];}_0x391ada=_[_0xb52e('0x37')]({},_0x391ada,_0x2d7827[_0xb52e('0x3a')]);return db[_0xb52e('0x28')][_0xb52e('0x42')](_0x391ada)['then'](handleEntityNotFound(_0x12076f,null))[_0xb52e('0x23')](respondWithResult(_0x12076f,null))[_0xb52e('0x3d')](handleError(_0x12076f,null));};exports[_0xb52e('0x43')]=function(_0x35fd66,_0x590c7b){return db[_0xb52e('0x28')][_0xb52e('0x43')](_0x35fd66[_0xb52e('0x44')],{})['then'](respondWithResult(_0x590c7b,0xc9))['catch'](handleError(_0x590c7b,null));};exports[_0xb52e('0x22')]=function(_0x276a92,_0x3692a9){if(_0x276a92[_0xb52e('0x44')]['id']){delete _0x276a92['body']['id'];}return db['FreshdeskConfiguration'][_0xb52e('0x42')]({'where':{'id':_0x276a92[_0xb52e('0x3f')]['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x3692a9,null))[_0xb52e('0x23')](saveUpdates(_0x276a92[_0xb52e('0x44')],null))['then'](respondWithResult(_0x3692a9,null))[_0xb52e('0x3d')](handleError(_0x3692a9,null));};exports['destroy']=function(_0x22f3ca,_0x3cea35){return db[_0xb52e('0x28')]['find']({'where':{'id':_0x22f3ca[_0xb52e('0x3f')]['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x3cea35,null))[_0xb52e('0x23')](removeEntity(_0x3cea35,null))[_0xb52e('0x3d')](handleError(_0x3cea35,null));};exports['getFields']=function(_0x43e10a,_0x23ab23,_0x28bbe3){var _0x4adf20={};var _0x1dfd2d={};var _0x4c808c;var _0x5c3d5d;return db[_0xb52e('0x28')][_0xb52e('0x45')]({'where':{'id':_0x43e10a['params']['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x23ab23,null))[_0xb52e('0x23')](function(_0x43c269){if(_0x43c269){_0x4c808c=_0x43c269;_0x1dfd2d[_0xb52e('0x2a')]=_['keys'](db['FreshdeskField'][_0xb52e('0x40')]);_0x1dfd2d[_0xb52e('0x2b')]=_['keys'](_0x43e10a['query']);_0x1dfd2d[_0xb52e('0x2d')]=_[_0xb52e('0x2e')](_0x1dfd2d[_0xb52e('0x2a')],_0x1dfd2d[_0xb52e('0x2b')]);_0x4adf20[_0xb52e('0x2f')]=_[_0xb52e('0x2e')](_0x1dfd2d[_0xb52e('0x2a')],qs[_0xb52e('0x30')](_0x43e10a['query'][_0xb52e('0x30')]));_0x4adf20[_0xb52e('0x2f')]=_0x4adf20['attributes'][_0xb52e('0x31')]?_0x4adf20[_0xb52e('0x2f')]:_0x1dfd2d[_0xb52e('0x2a')];_0x4adf20[_0xb52e('0x34')]=qs['sort'](_0x43e10a[_0xb52e('0x2b')][_0xb52e('0x35')]);_0x4adf20['where']=qs['filters'](_['pick'](_0x43e10a['query'],_0x1dfd2d[_0xb52e('0x2d')]));if(_0x43e10a['query'][_0xb52e('0x39')]){_0x4adf20[_0xb52e('0x36')]=_[_0xb52e('0x37')](_0x4adf20[_0xb52e('0x36')],{'$or':_['map'](_0x4adf20['attributes'],function(_0x346c8c){var _0x5b654a={};_0x5b654a[_0x346c8c]={'$like':'%'+_0x43e10a[_0xb52e('0x2b')]['filter']+'%'};return _0x5b654a;})});}_0x4adf20=_[_0xb52e('0x37')]({},_0x4adf20,_0x43e10a[_0xb52e('0x3a')]);return _0x4c808c[_0xb52e('0x46')](_0x4adf20);}})[_0xb52e('0x23')](function(_0x5a04cc){if(_0x5a04cc){_0x5c3d5d=_0x5a04cc[_0xb52e('0x31')];if(!_0x43e10a[_0xb52e('0x2b')][_0xb52e('0x32')]('nolimit')){_0x4adf20['limit']=qs['limit'](_0x43e10a[_0xb52e('0x2b')]['limit']);_0x4adf20['offset']=qs[_0xb52e('0x1d')](_0x43e10a[_0xb52e('0x2b')][_0xb52e('0x1d')]);}return _0x4c808c[_0xb52e('0x46')](_0x4adf20);}})[_0xb52e('0x23')](function(_0x1c4267){if(_0x1c4267){return _0x1c4267?{'count':_0x5c3d5d,'rows':_0x1c4267}:null;}})[_0xb52e('0x23')](respondWithResult(_0x23ab23,null))[_0xb52e('0x3d')](handleError(_0x23ab23,null));};exports['getSubjects']=function(_0x5c51af,_0x3353cf,_0x32f99d){var _0x59b4b5={};var _0x1e93a4={};var _0x24e82b;var _0x1c5823;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5c51af[_0xb52e('0x3f')]['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x3353cf,null))[_0xb52e('0x23')](function(_0x34a619){if(_0x34a619){_0x24e82b=_0x34a619;_0x1e93a4[_0xb52e('0x2a')]=_[_0xb52e('0x2c')](db['FreshdeskField'][_0xb52e('0x40')]);_0x1e93a4['query']=_[_0xb52e('0x2c')](_0x5c51af[_0xb52e('0x2b')]);_0x1e93a4[_0xb52e('0x2d')]=_[_0xb52e('0x2e')](_0x1e93a4[_0xb52e('0x2a')],_0x1e93a4[_0xb52e('0x2b')]);_0x59b4b5['attributes']=_[_0xb52e('0x2e')](_0x1e93a4[_0xb52e('0x2a')],qs[_0xb52e('0x30')](_0x5c51af[_0xb52e('0x2b')][_0xb52e('0x30')]));_0x59b4b5[_0xb52e('0x2f')]=_0x59b4b5[_0xb52e('0x2f')]['length']?_0x59b4b5[_0xb52e('0x2f')]:_0x1e93a4[_0xb52e('0x2a')];_0x59b4b5[_0xb52e('0x34')]=qs['sort'](_0x5c51af['query'][_0xb52e('0x35')]);_0x59b4b5[_0xb52e('0x36')]=qs['filters'](_['pick'](_0x5c51af[_0xb52e('0x2b')],_0x1e93a4[_0xb52e('0x2d')]));if(_0x5c51af['query']['filter']){_0x59b4b5[_0xb52e('0x36')]=_[_0xb52e('0x37')](_0x59b4b5[_0xb52e('0x36')],{'$or':_[_0xb52e('0x27')](_0x59b4b5['attributes'],function(_0x1df371){var _0x50878d={};_0x50878d[_0x1df371]={'$like':'%'+_0x5c51af[_0xb52e('0x2b')][_0xb52e('0x39')]+'%'};return _0x50878d;})});}_0x59b4b5=_[_0xb52e('0x37')]({},_0x59b4b5,_0x5c51af['options']);return _0x24e82b[_0xb52e('0x47')](_0x59b4b5);}})[_0xb52e('0x23')](function(_0x4d368f){if(_0x4d368f){_0x1c5823=_0x4d368f[_0xb52e('0x31')];if(!_0x5c51af[_0xb52e('0x2b')][_0xb52e('0x32')](_0xb52e('0x33'))){_0x59b4b5[_0xb52e('0x1e')]=qs[_0xb52e('0x1e')](_0x5c51af[_0xb52e('0x2b')][_0xb52e('0x1e')]);_0x59b4b5['offset']=qs[_0xb52e('0x1d')](_0x5c51af['query'][_0xb52e('0x1d')]);}return _0x24e82b[_0xb52e('0x47')](_0x59b4b5);}})[_0xb52e('0x23')](function(_0x23797b){if(_0x23797b){return _0x23797b?{'count':_0x1c5823,'rows':_0x23797b}:null;}})[_0xb52e('0x23')](respondWithResult(_0x3353cf,null))[_0xb52e('0x3d')](handleError(_0x3353cf,null));};exports[_0xb52e('0x48')]=function(_0x5ee56a,_0x386491,_0x391af3){var _0x3086ae={};var _0x5f3f17={};var _0x45864c;var _0x305fbd;return db[_0xb52e('0x28')][_0xb52e('0x45')]({'where':{'id':_0x5ee56a[_0xb52e('0x3f')]['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x386491,null))[_0xb52e('0x23')](function(_0x20b1c4){if(_0x20b1c4){_0x45864c=_0x20b1c4;_0x5f3f17['model']=_[_0xb52e('0x2c')](db[_0xb52e('0x49')][_0xb52e('0x40')]);_0x5f3f17[_0xb52e('0x2b')]=_[_0xb52e('0x2c')](_0x5ee56a[_0xb52e('0x2b')]);_0x5f3f17[_0xb52e('0x2d')]=_[_0xb52e('0x2e')](_0x5f3f17[_0xb52e('0x2a')],_0x5f3f17[_0xb52e('0x2b')]);_0x3086ae[_0xb52e('0x2f')]=_[_0xb52e('0x2e')](_0x5f3f17[_0xb52e('0x2a')],qs['fields'](_0x5ee56a[_0xb52e('0x2b')][_0xb52e('0x30')]));_0x3086ae[_0xb52e('0x2f')]=_0x3086ae[_0xb52e('0x2f')][_0xb52e('0x31')]?_0x3086ae['attributes']:_0x5f3f17['model'];_0x3086ae['order']=qs[_0xb52e('0x35')](_0x5ee56a[_0xb52e('0x2b')]['sort']);_0x3086ae['where']=qs[_0xb52e('0x2d')](_[_0xb52e('0x4a')](_0x5ee56a[_0xb52e('0x2b')],_0x5f3f17['filters']));if(_0x5ee56a[_0xb52e('0x2b')]['filter']){_0x3086ae[_0xb52e('0x36')]=_[_0xb52e('0x37')](_0x3086ae[_0xb52e('0x36')],{'$or':_[_0xb52e('0x27')](_0x3086ae['attributes'],function(_0x52c6b1){var _0x5ef7c8={};_0x5ef7c8[_0x52c6b1]={'$like':'%'+_0x5ee56a['query'][_0xb52e('0x39')]+'%'};return _0x5ef7c8;})});}_0x3086ae=_['merge']({},_0x3086ae,_0x5ee56a[_0xb52e('0x3a')]);return _0x45864c[_0xb52e('0x48')](_0x3086ae);}})[_0xb52e('0x23')](function(_0x538758){if(_0x538758){_0x305fbd=_0x538758[_0xb52e('0x31')];if(!_0x5ee56a[_0xb52e('0x2b')][_0xb52e('0x32')]('nolimit')){_0x3086ae[_0xb52e('0x1e')]=qs[_0xb52e('0x1e')](_0x5ee56a[_0xb52e('0x2b')][_0xb52e('0x1e')]);_0x3086ae['offset']=qs[_0xb52e('0x1d')](_0x5ee56a[_0xb52e('0x2b')]['offset']);}return _0x45864c[_0xb52e('0x48')](_0x3086ae);}})[_0xb52e('0x23')](function(_0x3be5ae){if(_0x3be5ae){return _0x3be5ae?{'count':_0x305fbd,'rows':_0x3be5ae}:null;}})['then'](respondWithResult(_0x386491,null))[_0xb52e('0x3d')](handleError(_0x386491,null));};exports[_0xb52e('0x4b')]=function(_0x16e4c8,_0x51cd8c,_0x3241e5){var _0x5b09c3={};var _0x4869f1={};var _0x28a00b;var _0x978ed9;return db[_0xb52e('0x28')][_0xb52e('0x45')]({'where':{'id':_0x16e4c8['params']['id']}})['then'](handleEntityNotFound(_0x51cd8c,null))[_0xb52e('0x23')](function(_0xf684f7){if(_0xf684f7){_0x28a00b=_0xf684f7;_0x4869f1['model']=_[_0xb52e('0x2c')](db[_0xb52e('0x4c')][_0xb52e('0x40')]);_0x4869f1['query']=_[_0xb52e('0x2c')](_0x16e4c8[_0xb52e('0x2b')]);_0x4869f1[_0xb52e('0x2d')]=_['intersection'](_0x4869f1['model'],_0x4869f1[_0xb52e('0x2b')]);_0x5b09c3[_0xb52e('0x2f')]=_['intersection'](_0x4869f1[_0xb52e('0x2a')],qs[_0xb52e('0x30')](_0x16e4c8['query'][_0xb52e('0x30')]));_0x5b09c3[_0xb52e('0x2f')]=_0x5b09c3[_0xb52e('0x2f')][_0xb52e('0x31')]?_0x5b09c3[_0xb52e('0x2f')]:_0x4869f1[_0xb52e('0x2a')];_0x5b09c3[_0xb52e('0x34')]=qs[_0xb52e('0x35')](_0x16e4c8[_0xb52e('0x2b')][_0xb52e('0x35')]);_0x5b09c3[_0xb52e('0x36')]=qs[_0xb52e('0x2d')](_[_0xb52e('0x4a')](_0x16e4c8[_0xb52e('0x2b')],_0x4869f1['filters']));if(_0x16e4c8[_0xb52e('0x2b')][_0xb52e('0x39')]){_0x5b09c3['where']=_['merge'](_0x5b09c3['where'],{'$or':_['map'](_0x5b09c3[_0xb52e('0x2f')],function(_0xa4d98f){var _0x3f630c={};_0x3f630c[_0xa4d98f]={'$like':'%'+_0x16e4c8[_0xb52e('0x2b')][_0xb52e('0x39')]+'%'};return _0x3f630c;})});}_0x5b09c3=_[_0xb52e('0x37')]({},_0x5b09c3,_0x16e4c8['options']);return _0x28a00b[_0xb52e('0x4b')](_0x5b09c3);}})['then'](function(_0x119fe1){if(_0x119fe1){_0x978ed9=_0x119fe1[_0xb52e('0x31')];if(!_0x16e4c8[_0xb52e('0x2b')][_0xb52e('0x32')](_0xb52e('0x33'))){_0x5b09c3[_0xb52e('0x1e')]=qs[_0xb52e('0x1e')](_0x16e4c8['query']['limit']);_0x5b09c3[_0xb52e('0x1d')]=qs[_0xb52e('0x1d')](_0x16e4c8[_0xb52e('0x2b')][_0xb52e('0x1d')]);}return _0x28a00b[_0xb52e('0x4b')](_0x5b09c3);}})['then'](function(_0x3ca471){if(_0x3ca471){return _0x3ca471?{'count':_0x978ed9,'rows':_0x3ca471}:null;}})[_0xb52e('0x23')](respondWithResult(_0x51cd8c,null))[_0xb52e('0x3d')](handleError(_0x51cd8c,null));};exports[_0xb52e('0x4d')]=function(_0x4a4560,_0x1598d5,_0x38c12c){if(_0x4a4560[_0xb52e('0x44')]['id']){delete _0x4a4560['body']['id'];}return db[_0xb52e('0x28')][_0xb52e('0x45')]({'where':{'id':_0x4a4560[_0xb52e('0x3f')]['id']}})[_0xb52e('0x23')](handleEntityNotFound(_0x1598d5,null))[_0xb52e('0x23')](function(_0x553b00){if(_0x553b00){return _0x553b00[_0xb52e('0x4d')](_0x4a4560[_0xb52e('0x44')]['ids']||[]);}return null;})[_0xb52e('0x23')](respondWithResult(_0x1598d5,null))['catch'](handleError(_0x1598d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 79e5039..61ad757 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 _0x65ce=['bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0xf37447,_0x502bbf){var _0x16a977=function(_0x585d48){while(--_0x585d48){_0xf37447['push'](_0xf37447['shift']());}};_0x16a977(++_0x502bbf);}(_0x65ce,0x189));var _0xe65c=function(_0x2680a8,_0x3d4ceb){_0x2680a8=_0x2680a8-0x0;var _0x287733=_0x65ce[_0x2680a8];return _0x287733;};'use strict';var _=require(_0xe65c('0x0'));var util=require(_0xe65c('0x1'));var logger=require(_0xe65c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe65c('0x3'));var rp=require(_0xe65c('0x4'));var fs=require('fs');var path=require(_0xe65c('0x5'));var rimraf=require('rimraf');var config=require(_0xe65c('0x6'));var attributes=require(_0xe65c('0x7'));module[_0xe65c('0x8')]=function(_0x587d1f,_0x2c67cf){return _0x587d1f[_0xe65c('0x9')](_0xe65c('0xa'),attributes,{'tableName':_0xe65c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bf0=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x283f92,_0x3b6a69){var _0x550345=function(_0x26e0cb){while(--_0x26e0cb){_0x283f92['push'](_0x283f92['shift']());}};_0x550345(++_0x3b6a69);}(_0x2bf0,0x11f));var _0x02bf=function(_0xd97730,_0x142f11){_0xd97730=_0xd97730-0x0;var _0x13e62c=_0x2bf0[_0xd97730];return _0x13e62c;};'use strict';var _=require(_0x02bf('0x0'));var util=require('util');var logger=require(_0x02bf('0x1'))(_0x02bf('0x2'));var moment=require(_0x02bf('0x3'));var BPromise=require('bluebird');var rp=require(_0x02bf('0x4'));var fs=require('fs');var path=require(_0x02bf('0x5'));var rimraf=require(_0x02bf('0x6'));var config=require(_0x02bf('0x7'));var attributes=require(_0x02bf('0x8'));module['exports']=function(_0x5c1c6d,_0x1df1fb){return _0x5c1c6d[_0x02bf('0x9')](_0x02bf('0xa'),attributes,{'tableName':_0x02bf('0xb'),'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 9d6ec0c..f7d0c14 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 _0xb87d=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x3a8bd4,_0x39f5ef){var _0x11ce49=function(_0x571486){while(--_0x571486){_0x3a8bd4['push'](_0x3a8bd4['shift']());}};_0x11ce49(++_0x39f5ef);}(_0xb87d,0x111));var _0xdb87=function(_0x528f7f,_0x56cacb){_0x528f7f=_0x528f7f-0x0;var _0x108b20=_0xb87d[_0x528f7f];return _0x108b20;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require('moment');var BPromise=require(_0xdb87('0x2'));var rs=require(_0xdb87('0x3'));var fs=require('fs');var Redis=require(_0xdb87('0x4'));var db=require(_0xdb87('0x5'))['db'];var utils=require(_0xdb87('0x6'));var logger=require('../../config/logger')(_0xdb87('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb87('0x8')][_0xdb87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ab797,_0x2182ce,_0x2a49ca){return new BPromise(function(_0x2f0c99,_0x137b50){return client['request'](_0x3ab797,_0x2a49ca)['then'](function(_0x28a5ae){logger[_0xdb87('0xa')](_0xdb87('0xb'),_0x2182ce,_0xdb87('0xc'));logger[_0xdb87('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2182ce,_0xdb87('0xc'),JSON[_0xdb87('0xe')](_0x28a5ae));if(_0x28a5ae[_0xdb87('0xf')]){if(_0x28a5ae['error']['code']===0x1f4){logger[_0xdb87('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2182ce,_0x28a5ae[_0xdb87('0xf')][_0xdb87('0x10')]);return _0x137b50(_0x28a5ae[_0xdb87('0xf')]['message']);}logger[_0xdb87('0xf')](_0xdb87('0xb'),_0x2182ce,_0x28a5ae[_0xdb87('0xf')][_0xdb87('0x10')]);return _0x2f0c99(_0x28a5ae[_0xdb87('0xf')][_0xdb87('0x10')]);}else{logger['info'](_0xdb87('0xb'),_0x2182ce,_0xdb87('0xc'));_0x2f0c99(_0x28a5ae[_0xdb87('0x11')][_0xdb87('0x10')]);}})[_0xdb87('0x12')](function(_0x14547b){logger['error'](_0xdb87('0xb'),_0x2182ce,_0x14547b);_0x137b50(_0x14547b);});});} \ No newline at end of file +var _0x33d2=['rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11b792,_0x1b8e0b){var _0x16a749=function(_0x33c450){while(--_0x33c450){_0x11b792['push'](_0x11b792['shift']());}};_0x16a749(++_0x1b8e0b);}(_0x33d2,0x1dc));var _0x233d=function(_0x9e9ead,_0x1a7ff3){_0x9e9ead=_0x9e9ead-0x0;var _0x31ff57=_0x33d2[_0x9e9ead];return _0x31ff57;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var moment=require('moment');var BPromise=require(_0x233d('0x2'));var rs=require(_0x233d('0x3'));var fs=require('fs');var Redis=require(_0x233d('0x4'));var db=require(_0x233d('0x5'))['db'];var utils=require(_0x233d('0x6'));var logger=require('../../config/logger')(_0x233d('0x7'));var config=require(_0x233d('0x8'));var jayson=require(_0x233d('0x9'));var client=jayson[_0x233d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc0e46,_0x4001be,_0x1ccd5b){return new BPromise(function(_0x1a8585,_0x3793c8){return client[_0x233d('0xb')](_0xbc0e46,_0x1ccd5b)['then'](function(_0x56b547){logger[_0x233d('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4001be,'request\x20sent');logger['debug'](_0x233d('0xd'),_0x4001be,_0x233d('0xe'),JSON[_0x233d('0xf')](_0x56b547));if(_0x56b547[_0x233d('0x10')]){if(_0x56b547[_0x233d('0x10')]['code']===0x1f4){logger[_0x233d('0x10')](_0x233d('0x11'),_0x4001be,_0x56b547['error']['message']);return _0x3793c8(_0x56b547['error'][_0x233d('0x12')]);}logger[_0x233d('0x10')](_0x233d('0x11'),_0x4001be,_0x56b547[_0x233d('0x10')]['message']);return _0x1a8585(_0x56b547[_0x233d('0x10')][_0x233d('0x12')]);}else{logger[_0x233d('0xc')](_0x233d('0x11'),_0x4001be,'request\x20sent');_0x1a8585(_0x56b547[_0x233d('0x13')]['message']);}})[_0x233d('0x14')](function(_0x16dc28){logger[_0x233d('0x10')](_0x233d('0x11'),_0x4001be,_0x16dc28);_0x3793c8(_0x16dc28);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8da7aa0..6268b53 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 _0xf161=['delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x149a41,_0x3cbb44){var _0x10132c=function(_0x5109e1){while(--_0x5109e1){_0x149a41['push'](_0x149a41['shift']());}};_0x10132c(++_0x3cbb44);}(_0xf161,0x1e2));var _0x1f16=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xf161[_0x28aea5];return _0x6a55f9;};'use strict';var multer=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var path=require('path');var timeout=require(_0x1f16('0x2'));var express=require(_0x1f16('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1f16('0x4'));var interaction=require(_0x1f16('0x5'));var config=require('../../config/environment');var controller=require(_0x1f16('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f16('0x7')]);router['get'](_0x1f16('0x8'),auth[_0x1f16('0x9')](),controller[_0x1f16('0xa')]);router[_0x1f16('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f16('0xc')](_0x1f16('0x8'),auth[_0x1f16('0x9')](),controller[_0x1f16('0xd')]);router[_0x1f16('0xe')](_0x1f16('0x8'),auth[_0x1f16('0x9')](),controller['destroy']);module[_0x1f16('0xf')]=router; \ No newline at end of file +var _0x3be9=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1e8ff1,_0x11cfac){var _0x500afc=function(_0x32c76f){while(--_0x32c76f){_0x1e8ff1['push'](_0x1e8ff1['shift']());}};_0x500afc(++_0x11cfac);}(_0x3be9,0xb8));var _0x93be=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x3be9[_0x5ebf44];return _0x2fef12;};'use strict';var multer=require(_0x93be('0x0'));var util=require(_0x93be('0x1'));var path=require(_0x93be('0x2'));var timeout=require(_0x93be('0x3'));var express=require(_0x93be('0x4'));var router=express['Router']();var fs_extra=require(_0x93be('0x5'));var auth=require(_0x93be('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x93be('0x7'));var controller=require(_0x93be('0x8'));router[_0x93be('0x9')]('/',auth['isAuthenticated'](),controller[_0x93be('0xa')]);router['get'](_0x93be('0xb'),auth[_0x93be('0xc')](),controller[_0x93be('0xd')]);router[_0x93be('0xe')]('/',auth['isAuthenticated'](),controller[_0x93be('0xf')]);router['put'](_0x93be('0xb'),auth[_0x93be('0xc')](),controller[_0x93be('0x10')]);router[_0x93be('0x11')](_0x93be('0xb'),auth[_0x93be('0xc')](),controller['destroy']);module[_0x93be('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d9b62dc..f7f76eb 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 _0x2434=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x53f707,_0x51a2f7){var _0x10a9f5=function(_0x14b513){while(--_0x14b513){_0x53f707['push'](_0x53f707['shift']());}};_0x10a9f5(++_0x51a2f7);}(_0x2434,0x1d7));var _0x4243=function(_0x4f617f,_0x28248f){_0x4f617f=_0x4f617f-0x0;var _0xe56a5a=_0x2434[_0x4f617f];return _0xe56a5a;};'use strict';var Sequelize=require(_0x4243('0x0'));module[_0x4243('0x1')]={'type':{'type':Sequelize[_0x4243('0x2')](_0x4243('0x3'),_0x4243('0x4'),_0x4243('0x5'),_0x4243('0x6'),_0x4243('0x7')),'defaultValue':_0x4243('0x3')},'content':{'type':Sequelize[_0x4243('0x8')]},'key':{'type':Sequelize[_0x4243('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4243('0x3'),'variable',_0x4243('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4243('0x8')]},'customField':{'type':Sequelize[_0x4243('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4243('0x8')]}}; \ No newline at end of file +var _0xfcb0=['sequelize','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x2a4a78,_0x242721){var _0x337485=function(_0x15d5f4){while(--_0x15d5f4){_0x2a4a78['push'](_0x2a4a78['shift']());}};_0x337485(++_0x242721);}(_0xfcb0,0x88));var _0x0fcb=function(_0x2016fb,_0xc2634a){_0x2016fb=_0x2016fb-0x0;var _0x5660f5=_0xfcb0[_0x2016fb];return _0x5660f5;};'use strict';var Sequelize=require(_0x0fcb('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0fcb('0x1'),_0x0fcb('0x2'),_0x0fcb('0x3'),'keyValue',_0x0fcb('0x4')),'defaultValue':_0x0fcb('0x1')},'content':{'type':Sequelize[_0x0fcb('0x5')]},'key':{'type':Sequelize[_0x0fcb('0x5')]},'keyType':{'type':Sequelize[_0x0fcb('0x6')]('string',_0x0fcb('0x2'),_0x0fcb('0x3'))},'keyContent':{'type':Sequelize[_0x0fcb('0x5')]},'idField':{'type':Sequelize[_0x0fcb('0x5')]},'nameField':{'type':Sequelize[_0x0fcb('0x5')]},'customField':{'type':Sequelize[_0x0fcb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0fcb('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1c0ce15..612c61c 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 _0x0427=['attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','FreshdeskField','rows','catch','show','keys','includeAll','find','create','body','update','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x296db1,_0x3aa28d){var _0x3013a0=function(_0x17308e){while(--_0x17308e){_0x296db1['push'](_0x296db1['shift']());}};_0x3013a0(++_0x3aa28d);}(_0x0427,0x137));var _0x7042=function(_0x121fdb,_0x26fdcd){_0x121fdb=_0x121fdb-0x0;var _0x4f982e=_0x0427[_0x121fdb];return _0x4f982e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7042('0x0'));var jsonpatch=require(_0x7042('0x1'));var rp=require('request-promise');var moment=require(_0x7042('0x2'));var BPromise=require(_0x7042('0x3'));var Mustache=require(_0x7042('0x4'));var util=require(_0x7042('0x5'));var path=require(_0x7042('0x6'));var sox=require(_0x7042('0x7'));var csv=require(_0x7042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7042('0x9'));var _=require(_0x7042('0xa'));var squel=require(_0x7042('0xb'));var crypto=require(_0x7042('0xc'));var jsforce=require(_0x7042('0xd'));var deskjs=require(_0x7042('0xe'));var toCsv=require(_0x7042('0x8'));var querystring=require(_0x7042('0xf'));var Papa=require(_0x7042('0x10'));var Redis=require('ioredis');var authService=require(_0x7042('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7042('0x12'));var utils=require('../../config/utils');var config=require(_0x7042('0x13'));var licenseUtil=require(_0x7042('0x14'));var db=require(_0x7042('0x15'))['db'];function respondWithStatusCode(_0x5629f2,_0x5c06f0){_0x5c06f0=_0x5c06f0||0xcc;return function(_0x292c4a){if(_0x292c4a){return _0x5629f2[_0x7042('0x16')](_0x5c06f0);}return _0x5629f2[_0x7042('0x17')](_0x5c06f0)[_0x7042('0x18')]();};}function respondWithResult(_0x25dfe5,_0xee4c2){_0xee4c2=_0xee4c2||0xc8;return function(_0x5def25){if(_0x5def25){return _0x25dfe5[_0x7042('0x17')](_0xee4c2)[_0x7042('0x19')](_0x5def25);}};}function respondWithFilteredResult(_0x6ed505,_0x5c1ef0){return function(_0x4c68c4){if(_0x4c68c4){var _0xc7e44e=typeof _0x5c1ef0['offset']===_0x7042('0x1a')&&typeof _0x5c1ef0['limit']==='undefined';var _0x28add7=_0x4c68c4[_0x7042('0x1b')];var _0x1e69aa=_0xc7e44e?0x0:_0x5c1ef0[_0x7042('0x1c')];var _0x6e18fb=_0xc7e44e?_0x4c68c4['count']:_0x5c1ef0[_0x7042('0x1c')]+_0x5c1ef0[_0x7042('0x1d')];var _0x34fda6;if(_0x6e18fb>=_0x28add7){_0x6e18fb=_0x28add7;_0x34fda6=0xc8;}else{_0x34fda6=0xce;}_0x6ed505[_0x7042('0x17')](_0x34fda6);return _0x6ed505[_0x7042('0x1e')]('Content-Range',_0x1e69aa+'-'+_0x6e18fb+'/'+_0x28add7)[_0x7042('0x19')](_0x4c68c4);}return null;};}function patchUpdates(_0x580f84){return function(_0x363f3c){try{jsonpatch['apply'](_0x363f3c,_0x580f84,!![]);}catch(_0x3b8203){return BPromise[_0x7042('0x1f')](_0x3b8203);}return _0x363f3c[_0x7042('0x20')]();};}function saveUpdates(_0x456dfc,_0x484c82){return function(_0x5a224b){if(_0x5a224b){return _0x5a224b['update'](_0x456dfc)[_0x7042('0x21')](function(_0x30a722){return _0x30a722;});}return null;};}function removeEntity(_0x3af8bc,_0x1949fe){return function(_0x48d529){if(_0x48d529){return _0x48d529[_0x7042('0x22')]()[_0x7042('0x21')](function(){_0x3af8bc[_0x7042('0x17')](0xcc)[_0x7042('0x18')]();});}};}function handleEntityNotFound(_0x459ff6,_0x54445b){return function(_0xc5fed3){if(!_0xc5fed3){_0x459ff6[_0x7042('0x16')](0x194);}return _0xc5fed3;};}function handleError(_0xf3c3f9,_0x1a05d1){_0x1a05d1=_0x1a05d1||0x1f4;return function(_0x2e4dbe){logger[_0x7042('0x23')](_0x2e4dbe[_0x7042('0x24')]);if(_0x2e4dbe[_0x7042('0x25')]){delete _0x2e4dbe[_0x7042('0x25')];}_0xf3c3f9[_0x7042('0x17')](_0x1a05d1)[_0x7042('0x26')](_0x2e4dbe);};}exports[_0x7042('0x27')]=function(_0x88c156,_0x1b6a29){var _0x101b89={},_0x3203f3={},_0x477972={'count':0x0,'rows':[]};var _0xa7461d=_[_0x7042('0x28')](db['FreshdeskField']['rawAttributes'],function(_0x37cf52){return{'name':_0x37cf52[_0x7042('0x29')],'type':_0x37cf52[_0x7042('0x2a')][_0x7042('0x2b')]};});_0x3203f3[_0x7042('0x2c')]=_[_0x7042('0x28')](_0xa7461d,_0x7042('0x25'));_0x3203f3['query']=_['keys'](_0x88c156[_0x7042('0x2d')]);_0x3203f3[_0x7042('0x2e')]=_['intersection'](_0x3203f3[_0x7042('0x2c')],_0x3203f3[_0x7042('0x2d')]);_0x101b89['attributes']=_[_0x7042('0x2f')](_0x3203f3[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x88c156[_0x7042('0x2d')][_0x7042('0x30')]));_0x101b89['attributes']=_0x101b89[_0x7042('0x31')]['length']?_0x101b89['attributes']:_0x3203f3[_0x7042('0x2c')];if(!_0x88c156['query'][_0x7042('0x32')](_0x7042('0x33'))){_0x101b89['limit']=qs[_0x7042('0x1d')](_0x88c156['query'][_0x7042('0x1d')]);_0x101b89[_0x7042('0x1c')]=qs[_0x7042('0x1c')](_0x88c156[_0x7042('0x2d')][_0x7042('0x1c')]);}_0x101b89[_0x7042('0x34')]=qs[_0x7042('0x35')](_0x88c156[_0x7042('0x2d')][_0x7042('0x35')]);_0x101b89['where']=qs[_0x7042('0x2e')](_[_0x7042('0x36')](_0x88c156[_0x7042('0x2d')],_0x3203f3['filters']),_0xa7461d);if(_0x88c156['query'][_0x7042('0x37')]){_0x101b89[_0x7042('0x38')]=_['merge'](_0x101b89[_0x7042('0x38')],{'$or':_[_0x7042('0x28')](_0xa7461d,function(_0x349198){if(_0x349198[_0x7042('0x2a')]!==_0x7042('0x39')){var _0x3abd08={};_0x3abd08[_0x349198[_0x7042('0x25')]]={'$like':'%'+_0x88c156[_0x7042('0x2d')][_0x7042('0x37')]+'%'};return _0x3abd08;}})});}_0x101b89=_[_0x7042('0x3a')]({},_0x101b89,_0x88c156[_0x7042('0x3b')]);var _0x4232c2={'where':_0x101b89[_0x7042('0x38')]};return db['FreshdeskField']['count'](_0x4232c2)[_0x7042('0x21')](function(_0x43f372){_0x477972[_0x7042('0x1b')]=_0x43f372;if(_0x88c156[_0x7042('0x2d')]['includeAll']){_0x101b89[_0x7042('0x3c')]=[{'all':!![]}];}return db[_0x7042('0x3d')]['findAll'](_0x101b89);})['then'](function(_0x1f8e68){_0x477972[_0x7042('0x3e')]=_0x1f8e68;return _0x477972;})[_0x7042('0x21')](respondWithFilteredResult(_0x1b6a29,_0x101b89))[_0x7042('0x3f')](handleError(_0x1b6a29,null));};exports[_0x7042('0x40')]=function(_0x4a4e90,_0x5de476){var _0x2c8d2a={'raw':!![],'where':{'id':_0x4a4e90['params']['id']}},_0x3897fc={};_0x3897fc[_0x7042('0x2c')]=_[_0x7042('0x41')](db[_0x7042('0x3d')]['rawAttributes']);_0x3897fc['query']=_[_0x7042('0x41')](_0x4a4e90[_0x7042('0x2d')]);_0x3897fc[_0x7042('0x2e')]=_['intersection'](_0x3897fc[_0x7042('0x2c')],_0x3897fc[_0x7042('0x2d')]);_0x2c8d2a['attributes']=_[_0x7042('0x2f')](_0x3897fc[_0x7042('0x2c')],qs[_0x7042('0x30')](_0x4a4e90[_0x7042('0x2d')][_0x7042('0x30')]));_0x2c8d2a[_0x7042('0x31')]=_0x2c8d2a[_0x7042('0x31')]['length']?_0x2c8d2a[_0x7042('0x31')]:_0x3897fc[_0x7042('0x2c')];if(_0x4a4e90['query'][_0x7042('0x42')]){_0x2c8d2a[_0x7042('0x3c')]=[{'all':!![]}];}_0x2c8d2a=_[_0x7042('0x3a')]({},_0x2c8d2a,_0x4a4e90[_0x7042('0x3b')]);return db[_0x7042('0x3d')][_0x7042('0x43')](_0x2c8d2a)['then'](handleEntityNotFound(_0x5de476,null))['then'](respondWithResult(_0x5de476,null))['catch'](handleError(_0x5de476,null));};exports[_0x7042('0x44')]=function(_0x55ecfe,_0x4821d3){return db[_0x7042('0x3d')]['create'](_0x55ecfe[_0x7042('0x45')],{})[_0x7042('0x21')](respondWithResult(_0x4821d3,0xc9))[_0x7042('0x3f')](handleError(_0x4821d3,null));};exports[_0x7042('0x46')]=function(_0x1a22d5,_0x11e7ce){if(_0x1a22d5[_0x7042('0x45')]['id']){delete _0x1a22d5[_0x7042('0x45')]['id'];}return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x1a22d5[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x11e7ce,null))[_0x7042('0x21')](saveUpdates(_0x1a22d5['body'],null))[_0x7042('0x21')](respondWithResult(_0x11e7ce,null))[_0x7042('0x3f')](handleError(_0x11e7ce,null));};exports[_0x7042('0x22')]=function(_0x81b898,_0x3fcf0e){return db[_0x7042('0x3d')][_0x7042('0x43')]({'where':{'id':_0x81b898[_0x7042('0x47')]['id']}})[_0x7042('0x21')](handleEntityNotFound(_0x3fcf0e,null))[_0x7042('0x21')](removeEntity(_0x3fcf0e,null))[_0x7042('0x3f')](handleError(_0x3fcf0e,null));}; \ No newline at end of file +var _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','FreshdeskField','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa571,0x107));var _0x1a57=function(_0x3a5ee1,_0x481b9e){_0x3a5ee1=_0x3a5ee1-0x0;var _0x10e59a=_0xa571[_0x3a5ee1];return _0x10e59a;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['FreshdeskField'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 40c085c..871d2f8 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 _0x9179=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3649c5,_0x406fd0){var _0x4fc3ff=function(_0x52dd9b){while(--_0x52dd9b){_0x3649c5['push'](_0x3649c5['shift']());}};_0x4fc3ff(++_0x406fd0);}(_0x9179,0x1d2));var _0x9917=function(_0x18cc1e,_0x153c38){_0x18cc1e=_0x18cc1e-0x0;var _0x2af1cf=_0x9179[_0x18cc1e];return _0x2af1cf;};'use strict';var _=require(_0x9917('0x0'));var util=require(_0x9917('0x1'));var logger=require(_0x9917('0x2'))(_0x9917('0x3'));var moment=require('moment');var BPromise=require(_0x9917('0x4'));var rp=require(_0x9917('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x9917('0x6')]=function(_0x1e908a,_0x4c3e15){return _0x1e908a[_0x9917('0x7')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12f1=['moment','bluebird','request-promise','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x12f1,0xf4));var _0x112f=function(_0x30db95,_0x180bd6){_0x30db95=_0x30db95-0x0;var _0x24ed8d=_0x12f1[_0x30db95];return _0x24ed8d;};'use strict';var _=require(_0x112f('0x0'));var util=require('util');var logger=require(_0x112f('0x1'))(_0x112f('0x2'));var moment=require(_0x112f('0x3'));var BPromise=require(_0x112f('0x4'));var rp=require(_0x112f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x112f('0x6'));module['exports']=function(_0x21cccd,_0x2044f2){return _0x21cccd[_0x112f('0x7')](_0x112f('0x8'),attributes,{'tableName':_0x112f('0x9'),'paranoid':![],'indexes':[{'name':_0x112f('0xa'),'fields':[_0x112f('0xb'),_0x112f('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 584f904..a4d3f22 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 _0x6412=['http','request','debug','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x6ac32,_0x4259f1){var _0x42a072=function(_0x5e8182){while(--_0x5e8182){_0x6ac32['push'](_0x6ac32['shift']());}};_0x42a072(++_0x4259f1);}(_0x6412,0x187));var _0x2641=function(_0x2d6fec,_0x1b0b37){_0x2d6fec=_0x2d6fec-0x0;var _0x1612f2=_0x6412[_0x2d6fec];return _0x1612f2;};'use strict';var _=require('lodash');var util=require(_0x2641('0x0'));var moment=require('moment');var BPromise=require(_0x2641('0x1'));var rs=require(_0x2641('0x2'));var fs=require('fs');var Redis=require(_0x2641('0x3'));var db=require(_0x2641('0x4'))['db'];var utils=require(_0x2641('0x5'));var logger=require(_0x2641('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2641('0x7')][_0x2641('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ece17,_0x521084,_0x382809){return new BPromise(function(_0xba56a2,_0x53028f){return client[_0x2641('0x9')](_0x2ece17,_0x382809)['then'](function(_0x44a260){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x521084,'request\x20sent');logger[_0x2641('0xa')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x521084,_0x2641('0xb'),JSON['stringify'](_0x44a260));if(_0x44a260['error']){if(_0x44a260[_0x2641('0xc')][_0x2641('0xd')]===0x1f4){logger['error'](_0x2641('0xe'),_0x521084,_0x44a260[_0x2641('0xc')][_0x2641('0xf')]);return _0x53028f(_0x44a260[_0x2641('0xc')][_0x2641('0xf')]);}logger[_0x2641('0xc')](_0x2641('0xe'),_0x521084,_0x44a260[_0x2641('0xc')][_0x2641('0xf')]);return _0xba56a2(_0x44a260['error'][_0x2641('0xf')]);}else{logger[_0x2641('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x521084,_0x2641('0xb'));_0xba56a2(_0x44a260[_0x2641('0x11')][_0x2641('0xf')]);}})[_0x2641('0x12')](function(_0x52f852){logger[_0x2641('0xc')](_0x2641('0xe'),_0x521084,_0x52f852);_0x53028f(_0x52f852);});});} \ No newline at end of file +var _0x8a18=['../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x38b52f,_0xef1380){var _0x36d28a=function(_0x2da499){while(--_0x2da499){_0x38b52f['push'](_0x38b52f['shift']());}};_0x36d28a(++_0xef1380);}(_0x8a18,0x109));var _0x88a1=function(_0x2eb064,_0x43a176){_0x2eb064=_0x2eb064-0x0;var _0x293cc2=_0x8a18[_0x2eb064];return _0x293cc2;};'use strict';var _=require(_0x88a1('0x0'));var util=require('util');var moment=require(_0x88a1('0x1'));var BPromise=require(_0x88a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a1('0x3'));var db=require(_0x88a1('0x4'))['db'];var utils=require(_0x88a1('0x5'));var logger=require(_0x88a1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88a1('0x7'));var client=jayson['client'][_0x88a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59d535,_0x4c6e80,_0xf3ba0d){return new BPromise(function(_0x947f4,_0x244bae){return client[_0x88a1('0x9')](_0x59d535,_0xf3ba0d)['then'](function(_0x3881d5){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4c6e80,_0x88a1('0xa'));logger[_0x88a1('0xb')](_0x88a1('0xc'),_0x4c6e80,_0x88a1('0xa'),JSON[_0x88a1('0xd')](_0x3881d5));if(_0x3881d5[_0x88a1('0xe')]){if(_0x3881d5[_0x88a1('0xe')]['code']===0x1f4){logger['error'](_0x88a1('0xf'),_0x4c6e80,_0x3881d5[_0x88a1('0xe')][_0x88a1('0x10')]);return _0x244bae(_0x3881d5[_0x88a1('0xe')][_0x88a1('0x10')]);}logger['error'](_0x88a1('0xf'),_0x4c6e80,_0x3881d5[_0x88a1('0xe')][_0x88a1('0x10')]);return _0x947f4(_0x3881d5['error'][_0x88a1('0x10')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4c6e80,_0x88a1('0xa'));_0x947f4(_0x3881d5[_0x88a1('0x11')][_0x88a1('0x10')]);}})['catch'](function(_0x7e8c8d){logger[_0x88a1('0xe')](_0x88a1('0xf'),_0x4c6e80,_0x7e8c8d);_0x244bae(_0x7e8c8d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index c21c51f..b519cf7 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 _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x59298d,_0x97074d){var _0x446ec0=function(_0x183660){while(--_0x183660){_0x59298d['push'](_0x59298d['shift']());}};_0x446ec0(++_0x97074d);}(_0x2e54,0x1dd));var _0x42e5=function(_0xa8f77b,_0x1bcd7f){_0xa8f77b=_0xa8f77b-0x0;var _0x4a0a59=_0x2e54[_0xa8f77b];return _0x4a0a59;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file +var _0xe706=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x6cd760,_0x15b09a){var _0x4bd025=function(_0x3efba8){while(--_0x3efba8){_0x6cd760['push'](_0x6cd760['shift']());}};_0x4bd025(++_0x15b09a);}(_0xe706,0xa3));var _0x6e70=function(_0x87d3ec,_0x387888){_0x87d3ec=_0x87d3ec-0x0;var _0x5f3f6f=_0xe706[_0x87d3ec];return _0x5f3f6f;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),controller['create']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5514746..29923db 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 _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x388dfb,_0x57536b){var _0x95a1d2=function(_0x321a11){while(--_0x321a11){_0x388dfb['push'](_0x388dfb['shift']());}};_0x95a1d2(++_0x57536b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2c7678,_0x4da7eb){_0x2c7678=_0x2c7678-0x0;var _0x1a59bf=_0x9f0e[_0x2c7678];return _0x1a59bf;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe5af=['exports','STRING','username','remoteUri'];(function(_0x49d031,_0x4df5e3){var _0x25e0ec=function(_0x4b1c90){while(--_0x4b1c90){_0x49d031['push'](_0x49d031['shift']());}};_0x25e0ec(++_0x4df5e3);}(_0xe5af,0x9c));var _0xfe5a=function(_0x19c676,_0x3c2f8a){_0x19c676=_0x19c676-0x0;var _0x3c58b2=_0xe5af[_0x19c676];return _0x3c58b2;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3318c48..2ced5a7 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 _0x6c51=['body','destroy','getConfigurations','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','findOne','remoteUri','username','slice','substring','lastIndexOf','GET','format','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','sendStatus','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x4f1c87,_0x3886a7){var _0x46d8f9=function(_0x4b9859){while(--_0x4b9859){_0x4f1c87['push'](_0x4f1c87['shift']());}};_0x46d8f9(++_0x3886a7);}(_0x6c51,0x1bd));var _0x16c5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6c51[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x16c5('0x0'));var rimraf=require(_0x16c5('0x1'));var zipdir=require(_0x16c5('0x2'));var jsonpatch=require(_0x16c5('0x3'));var rp=require(_0x16c5('0x4'));var moment=require(_0x16c5('0x5'));var BPromise=require(_0x16c5('0x6'));var Mustache=require(_0x16c5('0x7'));var util=require(_0x16c5('0x8'));var path=require(_0x16c5('0x9'));var sox=require(_0x16c5('0xa'));var csv=require(_0x16c5('0xb'));var ejs=require(_0x16c5('0xc'));var fs=require('fs');var fs_extra=require(_0x16c5('0xd'));var _=require(_0x16c5('0xe'));var squel=require(_0x16c5('0xf'));var crypto=require(_0x16c5('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16c5('0xb'));var querystring=require(_0x16c5('0x11'));var Papa=require(_0x16c5('0x12'));var Redis=require(_0x16c5('0x13'));var authService=require(_0x16c5('0x14'));var qs=require(_0x16c5('0x15'));var as=require(_0x16c5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16c5('0x17'));var utils=require(_0x16c5('0x18'));var config=require(_0x16c5('0x19'));var licenseUtil=require(_0x16c5('0x1a'));var db=require(_0x16c5('0x1b'))['db'];var integrations=require(_0x16c5('0x1c'));function respondWithStatusCode(_0x4695c8,_0x58b355){_0x58b355=_0x58b355||0xcc;return function(_0x4874c7){if(_0x4874c7){return _0x4695c8['sendStatus'](_0x58b355);}return _0x4695c8[_0x16c5('0x1d')](_0x58b355)[_0x16c5('0x1e')]();};}function respondWithResult(_0x4c55d7,_0x5a2af5){_0x5a2af5=_0x5a2af5||0xc8;return function(_0x501a04){if(_0x501a04){return _0x4c55d7[_0x16c5('0x1d')](_0x5a2af5)['json'](_0x501a04);}};}function respondWithFilteredResult(_0x4bae6b,_0x40c057){return function(_0x51d313){if(_0x51d313){var _0x3aeabb=typeof _0x40c057[_0x16c5('0x1f')]===_0x16c5('0x20')&&typeof _0x40c057[_0x16c5('0x21')]===_0x16c5('0x20');var _0x44b264=_0x51d313[_0x16c5('0x22')];var _0x3f35ac=_0x3aeabb?0x0:_0x40c057[_0x16c5('0x1f')];var _0x2dc0a6=_0x3aeabb?_0x51d313['count']:_0x40c057['offset']+_0x40c057[_0x16c5('0x21')];var _0x26a926;if(_0x2dc0a6>=_0x44b264){_0x2dc0a6=_0x44b264;_0x26a926=0xc8;}else{_0x26a926=0xce;}_0x4bae6b['status'](_0x26a926);return _0x4bae6b['set'](_0x16c5('0x23'),_0x3f35ac+'-'+_0x2dc0a6+'/'+_0x44b264)[_0x16c5('0x24')](_0x51d313);}return null;};}function patchUpdates(_0x382232){return function(_0x2319f0){try{jsonpatch[_0x16c5('0x25')](_0x2319f0,_0x382232,!![]);}catch(_0x108d17){return BPromise[_0x16c5('0x26')](_0x108d17);}return _0x2319f0['save']();};}function saveUpdates(_0x5edcc3,_0x7467eb){return function(_0x3a797b){if(_0x3a797b){return _0x3a797b[_0x16c5('0x27')](_0x5edcc3)[_0x16c5('0x28')](function(_0x383b64){return _0x383b64;});}return null;};}function removeEntity(_0x2b7289,_0x39f65e){return function(_0x5f40ee){if(_0x5f40ee){return _0x5f40ee['destroy']()[_0x16c5('0x28')](function(){_0x2b7289[_0x16c5('0x1d')](0xcc)[_0x16c5('0x1e')]();});}};}function handleEntityNotFound(_0x5c5524,_0x164f53){return function(_0x55d15a){if(!_0x55d15a){_0x5c5524[_0x16c5('0x29')](0x194);}return _0x55d15a;};}function handleError(_0x15782d,_0x3fae19){_0x3fae19=_0x3fae19||0x1f4;return function(_0x5df0e3){logger['error'](_0x5df0e3['stack']);if(_0x5df0e3['name']){delete _0x5df0e3[_0x16c5('0x2a')];}_0x15782d[_0x16c5('0x1d')](_0x3fae19)[_0x16c5('0x2b')](_0x5df0e3);};}exports[_0x16c5('0x2c')]=function(_0x5000fc,_0x29177f){var _0x7a3e06={},_0x5e0f6b={},_0x493e44={'count':0x0,'rows':[]};var _0x1b3808=_[_0x16c5('0x2d')](db[_0x16c5('0x2e')][_0x16c5('0x2f')],function(_0x25105a){return{'name':_0x25105a[_0x16c5('0x30')],'type':_0x25105a[_0x16c5('0x31')]['key']};});_0x5e0f6b['model']=_['map'](_0x1b3808,_0x16c5('0x2a'));_0x5e0f6b[_0x16c5('0x32')]=_[_0x16c5('0x33')](_0x5000fc['query']);_0x5e0f6b[_0x16c5('0x34')]=_[_0x16c5('0x35')](_0x5e0f6b[_0x16c5('0x36')],_0x5e0f6b[_0x16c5('0x32')]);_0x7a3e06['attributes']=_[_0x16c5('0x35')](_0x5e0f6b[_0x16c5('0x36')],qs[_0x16c5('0x37')](_0x5000fc[_0x16c5('0x32')][_0x16c5('0x37')]));_0x7a3e06['attributes']=_0x7a3e06[_0x16c5('0x38')][_0x16c5('0x39')]?_0x7a3e06[_0x16c5('0x38')]:_0x5e0f6b[_0x16c5('0x36')];if(!_0x5000fc[_0x16c5('0x32')]['hasOwnProperty'](_0x16c5('0x3a'))){_0x7a3e06[_0x16c5('0x21')]=qs[_0x16c5('0x21')](_0x5000fc[_0x16c5('0x32')][_0x16c5('0x21')]);_0x7a3e06[_0x16c5('0x1f')]=qs['offset'](_0x5000fc[_0x16c5('0x32')][_0x16c5('0x1f')]);}_0x7a3e06[_0x16c5('0x3b')]=qs[_0x16c5('0x3c')](_0x5000fc[_0x16c5('0x32')][_0x16c5('0x3c')]);_0x7a3e06['where']=qs[_0x16c5('0x34')](_['pick'](_0x5000fc[_0x16c5('0x32')],_0x5e0f6b[_0x16c5('0x34')]),_0x1b3808);if(_0x5000fc[_0x16c5('0x32')]['filter']){_0x7a3e06[_0x16c5('0x3d')]=_['merge'](_0x7a3e06['where'],{'$or':_['map'](_0x1b3808,function(_0x42ecac){if(_0x42ecac[_0x16c5('0x31')]!==_0x16c5('0x3e')){var _0x549c4f={};_0x549c4f[_0x42ecac[_0x16c5('0x2a')]]={'$like':'%'+_0x5000fc[_0x16c5('0x32')][_0x16c5('0x3f')]+'%'};return _0x549c4f;}})});}_0x7a3e06=_[_0x16c5('0x40')]({},_0x7a3e06,_0x5000fc[_0x16c5('0x41')]);var _0x3a3b13={'where':_0x7a3e06[_0x16c5('0x3d')]};return db[_0x16c5('0x2e')][_0x16c5('0x22')](_0x3a3b13)['then'](function(_0x466948){_0x493e44['count']=_0x466948;if(_0x5000fc[_0x16c5('0x32')]['includeAll']){_0x7a3e06[_0x16c5('0x42')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x16c5('0x43')](_0x7a3e06);})['then'](function(_0x138399){_0x493e44[_0x16c5('0x44')]=_0x138399;return _0x493e44;})[_0x16c5('0x28')](respondWithFilteredResult(_0x29177f,_0x7a3e06))[_0x16c5('0x45')](handleError(_0x29177f,null));};exports[_0x16c5('0x46')]=function(_0x238a99,_0x2c3c41){var _0x59b1f7={'raw':![],'where':{'id':_0x238a99[_0x16c5('0x47')]['id']}},_0x467136={};_0x467136[_0x16c5('0x36')]=_[_0x16c5('0x33')](db[_0x16c5('0x2e')]['rawAttributes']);_0x467136[_0x16c5('0x32')]=_[_0x16c5('0x33')](_0x238a99[_0x16c5('0x32')]);_0x467136[_0x16c5('0x34')]=_[_0x16c5('0x35')](_0x467136[_0x16c5('0x36')],_0x467136[_0x16c5('0x32')]);_0x59b1f7[_0x16c5('0x38')]=_[_0x16c5('0x35')](_0x467136[_0x16c5('0x36')],qs[_0x16c5('0x37')](_0x238a99[_0x16c5('0x32')]['fields']));_0x59b1f7[_0x16c5('0x38')]=_0x59b1f7[_0x16c5('0x38')][_0x16c5('0x39')]?_0x59b1f7[_0x16c5('0x38')]:_0x467136[_0x16c5('0x36')];if(_0x238a99['query'][_0x16c5('0x48')]){_0x59b1f7[_0x16c5('0x42')]=[{'all':!![]}];}_0x59b1f7=_[_0x16c5('0x40')]({},_0x59b1f7,_0x238a99[_0x16c5('0x41')]);return db[_0x16c5('0x2e')][_0x16c5('0x49')](_0x59b1f7)['then'](handleEntityNotFound(_0x2c3c41,null))[_0x16c5('0x28')](respondWithResult(_0x2c3c41,null))[_0x16c5('0x45')](handleError(_0x2c3c41,null));};exports[_0x16c5('0x4a')]=function(_0x9055fc,_0x1e67f2){return db[_0x16c5('0x2e')]['create'](_0x9055fc[_0x16c5('0x4b')],{})['then'](respondWithResult(_0x1e67f2,0xc9))[_0x16c5('0x45')](handleError(_0x1e67f2,null));};exports[_0x16c5('0x27')]=function(_0x2d9a82,_0x55e7cf){if(_0x2d9a82['body']['id']){delete _0x2d9a82[_0x16c5('0x4b')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x2d9a82[_0x16c5('0x47')]['id']}})[_0x16c5('0x28')](handleEntityNotFound(_0x55e7cf,null))[_0x16c5('0x28')](saveUpdates(_0x2d9a82[_0x16c5('0x4b')],null))[_0x16c5('0x28')](respondWithResult(_0x55e7cf,null))[_0x16c5('0x45')](handleError(_0x55e7cf,null));};exports[_0x16c5('0x4c')]=function(_0x29d6d9,_0x4723df){return db[_0x16c5('0x2e')][_0x16c5('0x49')]({'where':{'id':_0x29d6d9[_0x16c5('0x47')]['id']}})[_0x16c5('0x28')](handleEntityNotFound(_0x4723df,null))['then'](removeEntity(_0x4723df,null))['catch'](handleError(_0x4723df,null));};exports[_0x16c5('0x4d')]=function(_0x549d3f,_0x2e910c,_0x475d8b){var _0x57f76c={};var _0x11014={};var _0x4d247e;var _0x4f0725;return db[_0x16c5('0x2e')]['findOne']({'where':{'id':_0x549d3f[_0x16c5('0x47')]['id']}})[_0x16c5('0x28')](handleEntityNotFound(_0x2e910c,null))['then'](function(_0x255c68){if(_0x255c68){_0x4d247e=_0x255c68;_0x11014[_0x16c5('0x36')]=_[_0x16c5('0x33')](db[_0x16c5('0x4e')][_0x16c5('0x2f')]);_0x11014[_0x16c5('0x32')]=_[_0x16c5('0x33')](_0x549d3f[_0x16c5('0x32')]);_0x11014[_0x16c5('0x34')]=_[_0x16c5('0x35')](_0x11014[_0x16c5('0x36')],_0x11014[_0x16c5('0x32')]);_0x57f76c['attributes']=_[_0x16c5('0x35')](_0x11014[_0x16c5('0x36')],qs[_0x16c5('0x37')](_0x549d3f[_0x16c5('0x32')][_0x16c5('0x37')]));_0x57f76c[_0x16c5('0x38')]=_0x57f76c[_0x16c5('0x38')][_0x16c5('0x39')]?_0x57f76c[_0x16c5('0x38')]:_0x11014[_0x16c5('0x36')];_0x57f76c[_0x16c5('0x3b')]=qs[_0x16c5('0x3c')](_0x549d3f['query'][_0x16c5('0x3c')]);_0x57f76c[_0x16c5('0x3d')]=qs[_0x16c5('0x34')](_[_0x16c5('0x4f')](_0x549d3f[_0x16c5('0x32')],_0x11014[_0x16c5('0x34')]));if(_0x549d3f['query'][_0x16c5('0x3f')]){_0x57f76c[_0x16c5('0x3d')]=_[_0x16c5('0x40')](_0x57f76c[_0x16c5('0x3d')],{'$or':_[_0x16c5('0x2d')](_0x57f76c['attributes'],function(_0x367de8){var _0x582cd3={};_0x582cd3[_0x367de8]={'$like':'%'+_0x549d3f['query'][_0x16c5('0x3f')]+'%'};return _0x582cd3;})});}_0x57f76c=_[_0x16c5('0x40')]({},_0x57f76c,_0x549d3f[_0x16c5('0x41')]);return _0x4d247e[_0x16c5('0x4d')](_0x57f76c);}})[_0x16c5('0x28')](function(_0x5d1c75){if(_0x5d1c75){_0x4f0725=_0x5d1c75['length'];if(!_0x549d3f[_0x16c5('0x32')][_0x16c5('0x50')](_0x16c5('0x3a'))){_0x57f76c[_0x16c5('0x21')]=qs[_0x16c5('0x21')](_0x549d3f['query'][_0x16c5('0x21')]);_0x57f76c[_0x16c5('0x1f')]=qs[_0x16c5('0x1f')](_0x549d3f['query'][_0x16c5('0x1f')]);}return _0x4d247e['getConfigurations'](_0x57f76c);}})[_0x16c5('0x28')](function(_0x54ec89){if(_0x54ec89){return _0x54ec89?{'count':_0x4f0725,'rows':_0x54ec89}:null;}})[_0x16c5('0x28')](respondWithResult(_0x2e910c,null))[_0x16c5('0x45')](handleError(_0x2e910c,null));};exports[_0x16c5('0x51')]=function(_0x16ac18,_0x4583e5,_0x14f0c9){if(_0x16ac18[_0x16c5('0x4b')]['id']){delete _0x16ac18['body']['id'];}return db[_0x16c5('0x2e')]['findOne']({'where':{'id':_0x16ac18[_0x16c5('0x47')]['id']}})[_0x16c5('0x28')](handleEntityNotFound(_0x4583e5,null))[_0x16c5('0x28')](function(_0x147e12){if(_0x147e12){_0x16ac18[_0x16c5('0x4b')]['AccountId']=_0x147e12['id'];_0x16ac18[_0x16c5('0x4b')][_0x16c5('0x52')]=integrations[_0x16c5('0x53')](_0x16ac18[_0x16c5('0x4b')]['channel'],_0x16ac18[_0x16c5('0x4b')][_0x16c5('0x31')]);_0x16ac18[_0x16c5('0x4b')][_0x16c5('0x54')]=integrations[_0x16c5('0x55')](_0x16ac18[_0x16c5('0x4b')][_0x16c5('0x56')],_0x16ac18[_0x16c5('0x4b')]['type']);return db[_0x16c5('0x4e')][_0x16c5('0x4a')](_0x16ac18[_0x16c5('0x4b')],{'include':[{'model':db[_0x16c5('0x57')],'as':_0x16c5('0x52')},{'model':db[_0x16c5('0x57')],'as':_0x16c5('0x54')}]});}return null;})[_0x16c5('0x28')](respondWithResult(_0x4583e5,null))['catch'](handleError(_0x4583e5,null));};exports[_0x16c5('0x58')]=function(_0x53d12c,_0x5412b9,_0x614b51){var _0x1ca00e='';var _0x5a9969='';return db[_0x16c5('0x2e')][_0x16c5('0x59')]({'where':{'id':_0x53d12c['params']['id']},'attributes':['id','username',_0x16c5('0x5a'),'apiKey']})['then'](handleEntityNotFound(_0x5412b9,null))[_0x16c5('0x28')](function(_0x2c4d1a){if(_0x2c4d1a){_0x5a9969=_0x2c4d1a[_0x16c5('0x5b')];_0x1ca00e=_0x2c4d1a[_0x16c5('0x5a')];var _0x553e4c=_0x2c4d1a[_0x16c5('0x5a')][_0x16c5('0x5c')](-0x1);if(_0x553e4c==='/'){_0x1ca00e=_0x1ca00e[_0x16c5('0x5d')](0x0,_0x1ca00e[_0x16c5('0x5e')](_0x553e4c));}return rp({'method':_0x16c5('0x5f'),'uri':util[_0x16c5('0x60')]('%s%s',_0x1ca00e,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x2c4d1a['apiKey']},'json':!![]});}})[_0x16c5('0x28')](function(_0x4ab336){if(_0x4ab336){var _0x49bb24=_0x4ab336['users'];var _0x378d2a=![];var _0x28b1e7=null;for(_0x28b1e7=0x0;_0x28b1e7<_0x49bb24['length'];_0x28b1e7++){if(_0x49bb24[_0x28b1e7][_0x16c5('0x61')]===_0x5a9969){_0x378d2a=!![];}}if(_0x378d2a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x16c5('0x62')});}}})['then'](respondWithResult(_0x5412b9,null))[_0x16c5('0x45')](function(_0x2b1564){var _0x4b902c=_0x53d12c[_0x16c5('0x32')][_0x16c5('0x63')]?0x1f4:_0x2b1564['statusCode']||0x1f4;logger[_0x16c5('0x64')](_0x16c5('0x65'),_0x16c5('0x58'),_0x4b902c,JSON[_0x16c5('0x66')](_0x2b1564));delete _0x2b1564[_0x16c5('0x2a')];if(_0x4b902c===0x191){_0x4b902c=0x190;}_0x5412b9[_0x16c5('0x1d')](_0x4b902c)[_0x16c5('0x2b')](_0x53d12c[_0x16c5('0x32')][_0x16c5('0x63')]?{'message':'Wrong\x20credentials','statusCode':_0x2b1564[_0x16c5('0x67')]}:_0x2b1564);});}; \ No newline at end of file +var _0xe038=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','destroy','findOne','FreshsalesConfiguration','getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xe038,0x19b));var _0x8e03=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xe038[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x8e03('0x0'));var rimraf=require(_0x8e03('0x1'));var zipdir=require(_0x8e03('0x2'));var jsonpatch=require(_0x8e03('0x3'));var rp=require('request-promise');var moment=require(_0x8e03('0x4'));var BPromise=require(_0x8e03('0x5'));var Mustache=require('mustache');var util=require(_0x8e03('0x6'));var path=require(_0x8e03('0x7'));var sox=require(_0x8e03('0x8'));var csv=require(_0x8e03('0x9'));var ejs=require(_0x8e03('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8e03('0xb'));var jsforce=require(_0x8e03('0xc'));var deskjs=require(_0x8e03('0xd'));var toCsv=require(_0x8e03('0x9'));var querystring=require(_0x8e03('0xe'));var Papa=require(_0x8e03('0xf'));var Redis=require(_0x8e03('0x10'));var authService=require(_0x8e03('0x11'));var qs=require(_0x8e03('0x12'));var as=require(_0x8e03('0x13'));var hardwareService=require(_0x8e03('0x14'));var logger=require(_0x8e03('0x15'))(_0x8e03('0x16'));var utils=require(_0x8e03('0x17'));var config=require(_0x8e03('0x18'));var licenseUtil=require(_0x8e03('0x19'));var db=require(_0x8e03('0x1a'))['db'];var integrations=require(_0x8e03('0x1b'));function respondWithStatusCode(_0x519347,_0x30d451){_0x30d451=_0x30d451||0xcc;return function(_0x40e3bf){if(_0x40e3bf){return _0x519347[_0x8e03('0x1c')](_0x30d451);}return _0x519347['status'](_0x30d451)[_0x8e03('0x1d')]();};}function respondWithResult(_0x16db37,_0x58f5a8){_0x58f5a8=_0x58f5a8||0xc8;return function(_0x200fa7){if(_0x200fa7){return _0x16db37['status'](_0x58f5a8)[_0x8e03('0x1e')](_0x200fa7);}};}function respondWithFilteredResult(_0x44e1e6,_0x2e617d){return function(_0x497a21){if(_0x497a21){var _0x56c4de=typeof _0x2e617d[_0x8e03('0x1f')]===_0x8e03('0x20')&&typeof _0x2e617d[_0x8e03('0x21')]===_0x8e03('0x20');var _0x2019f5=_0x497a21[_0x8e03('0x22')];var _0x1dc9e8=_0x56c4de?0x0:_0x2e617d['offset'];var _0x310754=_0x56c4de?_0x497a21[_0x8e03('0x22')]:_0x2e617d['offset']+_0x2e617d['limit'];var _0x2fe87e;if(_0x310754>=_0x2019f5){_0x310754=_0x2019f5;_0x2fe87e=0xc8;}else{_0x2fe87e=0xce;}_0x44e1e6[_0x8e03('0x23')](_0x2fe87e);return _0x44e1e6[_0x8e03('0x24')](_0x8e03('0x25'),_0x1dc9e8+'-'+_0x310754+'/'+_0x2019f5)['json'](_0x497a21);}return null;};}function patchUpdates(_0x16ccb6){return function(_0x41e111){try{jsonpatch[_0x8e03('0x26')](_0x41e111,_0x16ccb6,!![]);}catch(_0x38cb17){return BPromise[_0x8e03('0x27')](_0x38cb17);}return _0x41e111['save']();};}function saveUpdates(_0x60182a,_0x4df750){return function(_0x1948f2){if(_0x1948f2){return _0x1948f2['update'](_0x60182a)['then'](function(_0x3a2590){return _0x3a2590;});}return null;};}function removeEntity(_0x5e7ee8,_0x14e575){return function(_0x413344){if(_0x413344){return _0x413344['destroy']()[_0x8e03('0x28')](function(){_0x5e7ee8[_0x8e03('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x234f3b,_0x134e60){return function(_0x56f8fa){if(!_0x56f8fa){_0x234f3b[_0x8e03('0x1c')](0x194);}return _0x56f8fa;};}function handleError(_0x1eb9bf,_0x2c0f7a){_0x2c0f7a=_0x2c0f7a||0x1f4;return function(_0x2fb195){logger['error'](_0x2fb195[_0x8e03('0x29')]);if(_0x2fb195[_0x8e03('0x2a')]){delete _0x2fb195['name'];}_0x1eb9bf[_0x8e03('0x23')](_0x2c0f7a)['send'](_0x2fb195);};}exports[_0x8e03('0x2b')]=function(_0x3ba75a,_0xeaed81){var _0x38ef1d={},_0x3ddd92={},_0x119c6a={'count':0x0,'rows':[]};var _0x560c7b=_[_0x8e03('0x2c')](db[_0x8e03('0x2d')][_0x8e03('0x2e')],function(_0x56c3f1){return{'name':_0x56c3f1[_0x8e03('0x2f')],'type':_0x56c3f1[_0x8e03('0x30')][_0x8e03('0x31')]};});_0x3ddd92[_0x8e03('0x32')]=_[_0x8e03('0x2c')](_0x560c7b,_0x8e03('0x2a'));_0x3ddd92[_0x8e03('0x33')]=_[_0x8e03('0x34')](_0x3ba75a[_0x8e03('0x33')]);_0x3ddd92[_0x8e03('0x35')]=_[_0x8e03('0x36')](_0x3ddd92[_0x8e03('0x32')],_0x3ddd92[_0x8e03('0x33')]);_0x38ef1d['attributes']=_[_0x8e03('0x36')](_0x3ddd92[_0x8e03('0x32')],qs['fields'](_0x3ba75a['query']['fields']));_0x38ef1d['attributes']=_0x38ef1d['attributes'][_0x8e03('0x37')]?_0x38ef1d[_0x8e03('0x38')]:_0x3ddd92['model'];if(!_0x3ba75a[_0x8e03('0x33')][_0x8e03('0x39')]('nolimit')){_0x38ef1d[_0x8e03('0x21')]=qs[_0x8e03('0x21')](_0x3ba75a[_0x8e03('0x33')]['limit']);_0x38ef1d[_0x8e03('0x1f')]=qs[_0x8e03('0x1f')](_0x3ba75a['query']['offset']);}_0x38ef1d[_0x8e03('0x3a')]=qs[_0x8e03('0x3b')](_0x3ba75a[_0x8e03('0x33')]['sort']);_0x38ef1d['where']=qs[_0x8e03('0x35')](_[_0x8e03('0x3c')](_0x3ba75a[_0x8e03('0x33')],_0x3ddd92['filters']),_0x560c7b);if(_0x3ba75a[_0x8e03('0x33')][_0x8e03('0x3d')]){_0x38ef1d['where']=_['merge'](_0x38ef1d[_0x8e03('0x3e')],{'$or':_[_0x8e03('0x2c')](_0x560c7b,function(_0x49d738){if(_0x49d738['type']!=='VIRTUAL'){var _0x16202e={};_0x16202e[_0x49d738['name']]={'$like':'%'+_0x3ba75a[_0x8e03('0x33')][_0x8e03('0x3d')]+'%'};return _0x16202e;}})});}_0x38ef1d=_[_0x8e03('0x3f')]({},_0x38ef1d,_0x3ba75a[_0x8e03('0x40')]);var _0x1b723e={'where':_0x38ef1d['where']};return db[_0x8e03('0x2d')][_0x8e03('0x22')](_0x1b723e)[_0x8e03('0x28')](function(_0x11a80c){_0x119c6a[_0x8e03('0x22')]=_0x11a80c;if(_0x3ba75a[_0x8e03('0x33')][_0x8e03('0x41')]){_0x38ef1d[_0x8e03('0x42')]=[{'all':!![]}];}return db[_0x8e03('0x2d')][_0x8e03('0x43')](_0x38ef1d);})[_0x8e03('0x28')](function(_0x1bc695){_0x119c6a[_0x8e03('0x44')]=_0x1bc695;return _0x119c6a;})[_0x8e03('0x28')](respondWithFilteredResult(_0xeaed81,_0x38ef1d))[_0x8e03('0x45')](handleError(_0xeaed81,null));};exports[_0x8e03('0x46')]=function(_0x26e6db,_0x21151d){var _0x29d2c8={'raw':![],'where':{'id':_0x26e6db[_0x8e03('0x47')]['id']}},_0x283494={};_0x283494['model']=_[_0x8e03('0x34')](db[_0x8e03('0x2d')]['rawAttributes']);_0x283494[_0x8e03('0x33')]=_['keys'](_0x26e6db[_0x8e03('0x33')]);_0x283494[_0x8e03('0x35')]=_[_0x8e03('0x36')](_0x283494[_0x8e03('0x32')],_0x283494[_0x8e03('0x33')]);_0x29d2c8[_0x8e03('0x38')]=_[_0x8e03('0x36')](_0x283494[_0x8e03('0x32')],qs[_0x8e03('0x48')](_0x26e6db[_0x8e03('0x33')][_0x8e03('0x48')]));_0x29d2c8[_0x8e03('0x38')]=_0x29d2c8['attributes']['length']?_0x29d2c8['attributes']:_0x283494[_0x8e03('0x32')];if(_0x26e6db[_0x8e03('0x33')][_0x8e03('0x41')]){_0x29d2c8[_0x8e03('0x42')]=[{'all':!![]}];}_0x29d2c8=_[_0x8e03('0x3f')]({},_0x29d2c8,_0x26e6db[_0x8e03('0x40')]);return db[_0x8e03('0x2d')]['find'](_0x29d2c8)[_0x8e03('0x28')](handleEntityNotFound(_0x21151d,null))[_0x8e03('0x28')](respondWithResult(_0x21151d,null))[_0x8e03('0x45')](handleError(_0x21151d,null));};exports[_0x8e03('0x49')]=function(_0x238585,_0x51b514){return db['FreshsalesAccount'][_0x8e03('0x49')](_0x238585['body'],{})[_0x8e03('0x28')](respondWithResult(_0x51b514,0xc9))[_0x8e03('0x45')](handleError(_0x51b514,null));};exports['update']=function(_0x5249d9,_0x12cdb3){if(_0x5249d9[_0x8e03('0x4a')]['id']){delete _0x5249d9[_0x8e03('0x4a')]['id'];}return db[_0x8e03('0x2d')][_0x8e03('0x4b')]({'where':{'id':_0x5249d9[_0x8e03('0x47')]['id']}})[_0x8e03('0x28')](handleEntityNotFound(_0x12cdb3,null))[_0x8e03('0x28')](saveUpdates(_0x5249d9[_0x8e03('0x4a')],null))[_0x8e03('0x28')](respondWithResult(_0x12cdb3,null))[_0x8e03('0x45')](handleError(_0x12cdb3,null));};exports[_0x8e03('0x4c')]=function(_0x1924d2,_0x1ebf52){return db[_0x8e03('0x2d')][_0x8e03('0x4b')]({'where':{'id':_0x1924d2[_0x8e03('0x47')]['id']}})[_0x8e03('0x28')](handleEntityNotFound(_0x1ebf52,null))[_0x8e03('0x28')](removeEntity(_0x1ebf52,null))[_0x8e03('0x45')](handleError(_0x1ebf52,null));};exports['getConfigurations']=function(_0x593450,_0x246ab1,_0xe8677d){var _0x394f7f={};var _0x230067={};var _0x16f437;var _0x5d242e;return db[_0x8e03('0x2d')][_0x8e03('0x4d')]({'where':{'id':_0x593450[_0x8e03('0x47')]['id']}})[_0x8e03('0x28')](handleEntityNotFound(_0x246ab1,null))['then'](function(_0x224f94){if(_0x224f94){_0x16f437=_0x224f94;_0x230067['model']=_[_0x8e03('0x34')](db[_0x8e03('0x4e')]['rawAttributes']);_0x230067[_0x8e03('0x33')]=_['keys'](_0x593450[_0x8e03('0x33')]);_0x230067[_0x8e03('0x35')]=_[_0x8e03('0x36')](_0x230067[_0x8e03('0x32')],_0x230067[_0x8e03('0x33')]);_0x394f7f[_0x8e03('0x38')]=_[_0x8e03('0x36')](_0x230067[_0x8e03('0x32')],qs['fields'](_0x593450[_0x8e03('0x33')][_0x8e03('0x48')]));_0x394f7f[_0x8e03('0x38')]=_0x394f7f[_0x8e03('0x38')][_0x8e03('0x37')]?_0x394f7f[_0x8e03('0x38')]:_0x230067['model'];_0x394f7f[_0x8e03('0x3a')]=qs[_0x8e03('0x3b')](_0x593450[_0x8e03('0x33')][_0x8e03('0x3b')]);_0x394f7f[_0x8e03('0x3e')]=qs[_0x8e03('0x35')](_[_0x8e03('0x3c')](_0x593450[_0x8e03('0x33')],_0x230067[_0x8e03('0x35')]));if(_0x593450[_0x8e03('0x33')][_0x8e03('0x3d')]){_0x394f7f[_0x8e03('0x3e')]=_['merge'](_0x394f7f[_0x8e03('0x3e')],{'$or':_[_0x8e03('0x2c')](_0x394f7f[_0x8e03('0x38')],function(_0x2656d2){var _0x7d9b00={};_0x7d9b00[_0x2656d2]={'$like':'%'+_0x593450[_0x8e03('0x33')][_0x8e03('0x3d')]+'%'};return _0x7d9b00;})});}_0x394f7f=_[_0x8e03('0x3f')]({},_0x394f7f,_0x593450[_0x8e03('0x40')]);return _0x16f437[_0x8e03('0x4f')](_0x394f7f);}})[_0x8e03('0x28')](function(_0x2172d0){if(_0x2172d0){_0x5d242e=_0x2172d0[_0x8e03('0x37')];if(!_0x593450[_0x8e03('0x33')]['hasOwnProperty'](_0x8e03('0x50'))){_0x394f7f[_0x8e03('0x21')]=qs[_0x8e03('0x21')](_0x593450[_0x8e03('0x33')][_0x8e03('0x21')]);_0x394f7f[_0x8e03('0x1f')]=qs[_0x8e03('0x1f')](_0x593450[_0x8e03('0x33')][_0x8e03('0x1f')]);}return _0x16f437[_0x8e03('0x4f')](_0x394f7f);}})['then'](function(_0x56658b){if(_0x56658b){return _0x56658b?{'count':_0x5d242e,'rows':_0x56658b}:null;}})[_0x8e03('0x28')](respondWithResult(_0x246ab1,null))['catch'](handleError(_0x246ab1,null));};exports['addConfiguration']=function(_0xec8d9a,_0x27c0b2,_0x5688d9){if(_0xec8d9a['body']['id']){delete _0xec8d9a[_0x8e03('0x4a')]['id'];}return db[_0x8e03('0x2d')][_0x8e03('0x4d')]({'where':{'id':_0xec8d9a[_0x8e03('0x47')]['id']}})[_0x8e03('0x28')](handleEntityNotFound(_0x27c0b2,null))[_0x8e03('0x28')](function(_0x268c7b){if(_0x268c7b){_0xec8d9a[_0x8e03('0x4a')]['AccountId']=_0x268c7b['id'];_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x51')]=integrations[_0x8e03('0x52')](_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x53')],_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x30')]);_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x54')]=integrations[_0x8e03('0x55')](_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x53')],_0xec8d9a[_0x8e03('0x4a')][_0x8e03('0x30')]);return db['FreshsalesConfiguration'][_0x8e03('0x49')](_0xec8d9a[_0x8e03('0x4a')],{'include':[{'model':db[_0x8e03('0x56')],'as':_0x8e03('0x51')},{'model':db[_0x8e03('0x56')],'as':_0x8e03('0x54')}]});}return null;})[_0x8e03('0x28')](respondWithResult(_0x27c0b2,null))['catch'](handleError(_0x27c0b2,null));};exports[_0x8e03('0x57')]=function(_0x1e3152,_0x4cdd74,_0x515799){var _0x307d25='';var _0x506b75='';return db[_0x8e03('0x2d')]['findOne']({'where':{'id':_0x1e3152['params']['id']},'attributes':['id',_0x8e03('0x58'),_0x8e03('0x59'),_0x8e03('0x5a')]})[_0x8e03('0x28')](handleEntityNotFound(_0x4cdd74,null))[_0x8e03('0x28')](function(_0x17e649){if(_0x17e649){_0x506b75=_0x17e649[_0x8e03('0x58')];_0x307d25=_0x17e649[_0x8e03('0x59')];var _0x37fc57=_0x17e649[_0x8e03('0x59')][_0x8e03('0x5b')](-0x1);if(_0x37fc57==='/'){_0x307d25=_0x307d25[_0x8e03('0x5c')](0x0,_0x307d25[_0x8e03('0x5d')](_0x37fc57));}return rp({'method':_0x8e03('0x5e'),'uri':util[_0x8e03('0x5f')](_0x8e03('0x60'),_0x307d25,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x17e649[_0x8e03('0x5a')]},'json':!![]});}})[_0x8e03('0x28')](function(_0xdb51db){if(_0xdb51db){var _0x1669f5=_0xdb51db[_0x8e03('0x61')];var _0x2f2621=![];var _0x5ee936=null;for(_0x5ee936=0x0;_0x5ee936<_0x1669f5[_0x8e03('0x37')];_0x5ee936++){if(_0x1669f5[_0x5ee936][_0x8e03('0x62')]===_0x506b75){_0x2f2621=!![];}}if(_0x2f2621){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8e03('0x63')});}}})[_0x8e03('0x28')](respondWithResult(_0x4cdd74,null))[_0x8e03('0x45')](function(_0x5051aa){var _0x452685=_0x1e3152[_0x8e03('0x33')]['test']?0x1f4:_0x5051aa[_0x8e03('0x64')]||0x1f4;logger[_0x8e03('0x65')](_0x8e03('0x66'),_0x8e03('0x57'),_0x452685,JSON[_0x8e03('0x67')](_0x5051aa));delete _0x5051aa['name'];if(_0x452685===0x191){_0x452685=0x190;}_0x4cdd74[_0x8e03('0x23')](_0x452685)[_0x8e03('0x68')](_0x1e3152[_0x8e03('0x33')][_0x8e03('0x69')]?{'message':_0x8e03('0x6a'),'statusCode':_0x5051aa[_0x8e03('0x64')]}:_0x5051aa);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 866810b..2819a3b 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 _0x3d04=['bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4a16aa,_0x46f661){var _0x4e9af4=function(_0x1e7660){while(--_0x1e7660){_0x4a16aa['push'](_0x4a16aa['shift']());}};_0x4e9af4(++_0x46f661);}(_0x3d04,0xbe));var _0x43d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d04[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));var integrations=require(_0x43d0('0xa'));module[_0x43d0('0xb')]=function(_0x5e284f,_0x484271){return _0x5e284f['define']('FreshsalesAccount',attributes,{'tableName':_0x43d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_freshsales_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x1d53f3,_0x3aded0){var _0x18f6b3=function(_0x4ab88f){while(--_0x4ab88f){_0x1d53f3['push'](_0x1d53f3['shift']());}};_0x18f6b3(++_0x3aded0);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 41adad4..4ece72c 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 _0xe2fe=['find','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowFreshsalesAccount'];(function(_0x2f01c3,_0x57ad97){var _0x1bc3bd=function(_0x3f2e95){while(--_0x3f2e95){_0x2f01c3['push'](_0x2f01c3['shift']());}};_0x1bc3bd(++_0x57ad97);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')]({'raw':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options'][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x17')]||null:null,'attributes':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options']['attributes']||null:null,'limit':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x18')]||null:null,'include':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x502eb6['options'][_0xee2f('0x19')],function(_0x2c47c5){return{'model':db[_0x2c47c5[_0xee2f('0x1b')]],'as':_0x2c47c5['as'],'attributes':_0x2c47c5[_0xee2f('0x1c')],'include':_0x2c47c5[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x2c47c5[_0xee2f('0x19')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1b')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x1c')],'include':_0x13013f[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x13013f[_0xee2f('0x19')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bdbb){logger[_0xee2f('0xb')](_0xee2f('0x12'),_0x502eb6);logger[_0xee2f('0x1d')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x18bdbb));_0x40b5bc(_0x18bdbb);})['catch'](function(_0x3d3806){logger['error'](_0xee2f('0x12'),_0x3d3806[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x3d3806[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1e')]=function(_0x47d5a6){var _0x310c0b=this;return new Promise(function(_0xd16e35,_0x56706e){return db['FreshsalesAccount'][_0xee2f('0x1f')]({'raw':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')]['where']||null:null,'attributes':_0x47d5a6['options']?_0x47d5a6['options'][_0xee2f('0x1c')]||null:null,'include':_0x47d5a6[_0xee2f('0x15')]?_0x47d5a6['options'][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x19')],function(_0x1c3a01){return{'model':db[_0x1c3a01['model']],'as':_0x1c3a01['as'],'attributes':_0x1c3a01[_0xee2f('0x1c')],'include':_0x1c3a01['include']?_[_0xee2f('0x1a')](_0x1c3a01[_0xee2f('0x19')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x1c')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1a')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1b')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0xa')](function(_0x1b9f6c){logger[_0xee2f('0xb')](_0xee2f('0x1e'),_0x47d5a6);logger[_0xee2f('0x1d')](_0xee2f('0x1e'),_0x47d5a6,JSON[_0xee2f('0xd')](_0x1b9f6c));_0xd16e35(_0x1b9f6c);})[_0xee2f('0x20')](function(_0x5ad0a7){logger[_0xee2f('0xe')]('ShowFreshsalesAccount',_0x5ad0a7[_0xee2f('0xf')],_0x47d5a6);_0x56706e(_0x310c0b[_0xee2f('0xe')](0x1f4,_0x5ad0a7[_0xee2f('0xf')]));});});}; \ No newline at end of file +var _0x524e=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFreshsalesAccount','catch','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2af783,_0x260e77){var _0x4e629f=function(_0x4d5bbf){while(--_0x4d5bbf){_0x2af783['push'](_0x2af783['shift']());}};_0x4e629f(++_0x260e77);}(_0x524e,0x15e));var _0xe524=function(_0x42531d,_0x69681c){_0x42531d=_0x42531d-0x0;var _0x17e9bb=_0x524e[_0x42531d];return _0x17e9bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['GetFreshsalesAccount']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')]({'raw':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]===undefined?!![]:![]:!![],'where':_0x3a4027['options']?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1c')]||null:null,'include':_0x3a4027[_0xe524('0x18')]?_0x3a4027['options'][_0xe524('0x1d')]?_['map'](_0x3a4027['options'][_0xe524('0x1d')],function(_0x23df5e){return{'model':db[_0x23df5e[_0xe524('0x1e')]],'as':_0x23df5e['as'],'attributes':_0x23df5e[_0xe524('0x1b')],'include':_0x23df5e['include']?_[_0xe524('0x1f')](_0x23df5e['include'],function(_0x17e245){return{'model':db[_0x17e245[_0xe524('0x1e')]],'as':_0x17e245['as'],'attributes':_0x17e245[_0xe524('0x1b')],'include':_0x17e245[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x17e245[_0xe524('0x1d')],function(_0x2141db){return{'model':db[_0x2141db['model']],'as':_0x2141db['as'],'attributes':_0x2141db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x45abad){logger[_0xe524('0xd')](_0xe524('0x20'),_0x3a4027);logger[_0xe524('0x10')]('GetFreshsalesAccount',_0x3a4027,JSON['stringify'](_0x45abad));_0x11b2a1(_0x45abad);})[_0xe524('0x21')](function(_0x25e7a7){logger[_0xe524('0x13')](_0xe524('0x20'),_0x25e7a7[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x25e7a7[_0xe524('0x15')]));});});};exports[_0xe524('0x22')]=function(_0x4a4e15){var _0x5b7ded=this;return new Promise(function(_0x20688e,_0x376324){return db['FreshsalesAccount'][_0xe524('0x23')]({'raw':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'attributes':_0x4a4e15['options']?_0x4a4e15[_0xe524('0x18')]['attributes']||null:null,'include':_0x4a4e15[_0xe524('0x18')]?_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')]?_['map'](_0x4a4e15[_0xe524('0x18')][_0xe524('0x1d')],function(_0x49c43e){return{'model':db[_0x49c43e[_0xe524('0x1e')]],'as':_0x49c43e['as'],'attributes':_0x49c43e[_0xe524('0x1b')],'include':_0x49c43e[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x49c43e['include'],function(_0x415450){return{'model':db[_0x415450[_0xe524('0x1e')]],'as':_0x415450['as'],'attributes':_0x415450[_0xe524('0x1b')],'include':_0x415450[_0xe524('0x1d')]?_[_0xe524('0x1f')](_0x415450[_0xe524('0x1d')],function(_0x2741e8){return{'model':db[_0x2741e8[_0xe524('0x1e')]],'as':_0x2741e8['as'],'attributes':_0x2741e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe524('0xc')](function(_0x56f371){logger[_0xe524('0xd')](_0xe524('0x22'),_0x4a4e15);logger['debug'](_0xe524('0x22'),_0x4a4e15,JSON['stringify'](_0x56f371));_0x20688e(_0x56f371);})[_0xe524('0x21')](function(_0x41af26){logger[_0xe524('0x13')](_0xe524('0x22'),_0x41af26[_0xe524('0x15')],_0x4a4e15);_0x376324(_0x5b7ded[_0xe524('0x13')](0x1f4,_0x41af26[_0xe524('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d651776..d940c83 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 _0x5c4b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x50b83f,_0x5f4be0){var _0x5a0920=function(_0x390931){while(--_0x390931){_0x50b83f['push'](_0x50b83f['shift']());}};_0x5a0920(++_0x5f4be0);}(_0x5c4b,0x1ae));var _0xb5c4=function(_0x50f177,_0x36c061){_0x50f177=_0x50f177-0x0;var _0x16da60=_0x5c4b[_0x50f177];return _0x16da60;};'use strict';var multer=require(_0xb5c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb5c4('0x1'));var express=require(_0xb5c4('0x2'));var router=express[_0xb5c4('0x3')]();var fs_extra=require(_0xb5c4('0x4'));var auth=require(_0xb5c4('0x5'));var interaction=require(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xb5c4('0x8')]('/',auth[_0xb5c4('0x9')](),controller[_0xb5c4('0xa')]);router[_0xb5c4('0x8')](_0xb5c4('0xb'),auth['isAuthenticated'](),controller[_0xb5c4('0xc')]);router[_0xb5c4('0x8')](_0xb5c4('0xd'),auth['isAuthenticated'](),controller[_0xb5c4('0xe')]);router[_0xb5c4('0x8')](_0xb5c4('0xf'),auth['isAuthenticated'](),controller[_0xb5c4('0x10')]);router['get'](_0xb5c4('0x11'),auth['isAuthenticated'](),controller[_0xb5c4('0x12')]);router[_0xb5c4('0x13')]('/',auth[_0xb5c4('0x9')](),controller['create']);router['put'](_0xb5c4('0xb'),auth['isAuthenticated'](),controller[_0xb5c4('0x14')]);router[_0xb5c4('0x15')](_0xb5c4('0xb'),auth[_0xb5c4('0x9')](),controller[_0xb5c4('0x16')]);module[_0xb5c4('0x17')]=router; \ No newline at end of file +var _0xd3e2=['getFields','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd3e2,0x1eb));var _0x2d3e=function(_0x485171,_0x48ff8d){_0x485171=_0x485171-0x0;var _0x58ff58=_0xd3e2[_0x485171];return _0x58ff58;};'use strict';var multer=require('multer');var util=require(_0x2d3e('0x0'));var path=require(_0x2d3e('0x1'));var timeout=require(_0x2d3e('0x2'));var express=require(_0x2d3e('0x3'));var router=express[_0x2d3e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d3e('0x5'));var interaction=require(_0x2d3e('0x6'));var config=require(_0x2d3e('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x2d3e('0x8')]('/',auth[_0x2d3e('0x9')](),controller['index']);router[_0x2d3e('0x8')]('/:id',auth[_0x2d3e('0x9')](),controller[_0x2d3e('0xa')]);router[_0x2d3e('0x8')](_0x2d3e('0xb'),auth[_0x2d3e('0x9')](),controller[_0x2d3e('0xc')]);router[_0x2d3e('0x8')](_0x2d3e('0xd'),auth[_0x2d3e('0x9')](),controller['getDescriptions']);router[_0x2d3e('0x8')](_0x2d3e('0xe'),auth[_0x2d3e('0x9')](),controller[_0x2d3e('0xf')]);router[_0x2d3e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d3e('0x11')](_0x2d3e('0x12'),auth[_0x2d3e('0x9')](),controller[_0x2d3e('0x13')]);router[_0x2d3e('0x14')](_0x2d3e('0x12'),auth[_0x2d3e('0x9')](),controller[_0x2d3e('0x15')]);module[_0x2d3e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 670b8ff..32a41fd 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 _0x80cd=['STRING','exports'];(function(_0xd1d609,_0x3b251c){var _0xfa2a53=function(_0x3106ae){while(--_0x3106ae){_0xd1d609['push'](_0xd1d609['shift']());}};_0xfa2a53(++_0x3b251c);}(_0x80cd,0x1a7));var _0xd80c=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x80cd[_0x1a87b3];return _0x37e84d;};'use strict';var Sequelize=require('sequelize');module[_0xd80c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd80c('0x1')]}}; \ No newline at end of file +var _0x3a87=['sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3a87,0x19b));var _0x73a8=function(_0x437545,_0x4ab48b){_0x437545=_0x437545-0x0;var _0x408060=_0x3a87[_0x437545];return _0x408060;};'use strict';var Sequelize=require(_0x73a8('0x0'));module[_0x73a8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x73a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f1f48a5..f185ba0 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 _0x9a64=['index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','findOne','FreshsalesField','length','sort','filter','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','update','destroy','then','name','send'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x9a64,0x111));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49a6('0x0'));var rimraf=require(_0x49a6('0x1'));var zipdir=require(_0x49a6('0x2'));var jsonpatch=require(_0x49a6('0x3'));var rp=require(_0x49a6('0x4'));var moment=require('moment');var BPromise=require(_0x49a6('0x5'));var Mustache=require(_0x49a6('0x6'));var util=require(_0x49a6('0x7'));var path=require(_0x49a6('0x8'));var sox=require('sox');var csv=require(_0x49a6('0x9'));var ejs=require(_0x49a6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x49a6('0xb'));var crypto=require(_0x49a6('0xc'));var jsforce=require(_0x49a6('0xd'));var deskjs=require(_0x49a6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x49a6('0xf'));var Papa=require(_0x49a6('0x10'));var Redis=require(_0x49a6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x49a6('0x12'));var as=require(_0x49a6('0x13'));var hardwareService=require(_0x49a6('0x14'));var logger=require('../../config/logger')(_0x49a6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49a6('0x16'));var db=require(_0x49a6('0x17'))['db'];function respondWithStatusCode(_0x46dfe6,_0x5179ff){_0x5179ff=_0x5179ff||0xcc;return function(_0x5eece9){if(_0x5eece9){return _0x46dfe6[_0x49a6('0x18')](_0x5179ff);}return _0x46dfe6['status'](_0x5179ff)[_0x49a6('0x19')]();};}function respondWithResult(_0x366b26,_0x4c7296){_0x4c7296=_0x4c7296||0xc8;return function(_0x2d7dae){if(_0x2d7dae){return _0x366b26[_0x49a6('0x1a')](_0x4c7296)[_0x49a6('0x1b')](_0x2d7dae);}};}function respondWithFilteredResult(_0x27505f,_0xce5a74){return function(_0x2574bf){if(_0x2574bf){var _0x3ac1d9=typeof _0xce5a74[_0x49a6('0x1c')]==='undefined'&&typeof _0xce5a74[_0x49a6('0x1d')]===_0x49a6('0x1e');var _0x4e1945=_0x2574bf['count'];var _0xe53a69=_0x3ac1d9?0x0:_0xce5a74['offset'];var _0xe8c411=_0x3ac1d9?_0x2574bf[_0x49a6('0x1f')]:_0xce5a74[_0x49a6('0x1c')]+_0xce5a74[_0x49a6('0x1d')];var _0xfd9edd;if(_0xe8c411>=_0x4e1945){_0xe8c411=_0x4e1945;_0xfd9edd=0xc8;}else{_0xfd9edd=0xce;}_0x27505f[_0x49a6('0x1a')](_0xfd9edd);return _0x27505f[_0x49a6('0x20')]('Content-Range',_0xe53a69+'-'+_0xe8c411+'/'+_0x4e1945)[_0x49a6('0x1b')](_0x2574bf);}return null;};}function patchUpdates(_0x55a816){return function(_0x124adb){try{jsonpatch['apply'](_0x124adb,_0x55a816,!![]);}catch(_0xf04c69){return BPromise[_0x49a6('0x21')](_0xf04c69);}return _0x124adb['save']();};}function saveUpdates(_0x5dfaab,_0x134c75){return function(_0xfbdb06){if(_0xfbdb06){return _0xfbdb06[_0x49a6('0x22')](_0x5dfaab)['then'](function(_0x36af01){return _0x36af01;});}return null;};}function removeEntity(_0x35c1a4,_0x427f2d){return function(_0x370b19){if(_0x370b19){return _0x370b19[_0x49a6('0x23')]()[_0x49a6('0x24')](function(){_0x35c1a4[_0x49a6('0x1a')](0xcc)[_0x49a6('0x19')]();});}};}function handleEntityNotFound(_0x53acde,_0x5ee199){return function(_0x68f035){if(!_0x68f035){_0x53acde[_0x49a6('0x18')](0x194);}return _0x68f035;};}function handleError(_0x561ddd,_0x5f3c71){_0x5f3c71=_0x5f3c71||0x1f4;return function(_0xee5fcf){logger['error'](_0xee5fcf['stack']);if(_0xee5fcf[_0x49a6('0x25')]){delete _0xee5fcf['name'];}_0x561ddd[_0x49a6('0x1a')](_0x5f3c71)[_0x49a6('0x26')](_0xee5fcf);};}exports[_0x49a6('0x27')]=function(_0x448fed,_0x1facf7){var _0x1f1cb1={},_0x2f9d3e={},_0x3e8be0={'count':0x0,'rows':[]};var _0x53f17e=_[_0x49a6('0x28')](db[_0x49a6('0x29')][_0x49a6('0x2a')],function(_0x261067){return{'name':_0x261067['fieldName'],'type':_0x261067[_0x49a6('0x2b')][_0x49a6('0x2c')]};});_0x2f9d3e['model']=_['map'](_0x53f17e,_0x49a6('0x25'));_0x2f9d3e[_0x49a6('0x2d')]=_[_0x49a6('0x2e')](_0x448fed['query']);_0x2f9d3e[_0x49a6('0x2f')]=_[_0x49a6('0x30')](_0x2f9d3e[_0x49a6('0x31')],_0x2f9d3e[_0x49a6('0x2d')]);_0x1f1cb1[_0x49a6('0x32')]=_['intersection'](_0x2f9d3e[_0x49a6('0x31')],qs[_0x49a6('0x33')](_0x448fed[_0x49a6('0x2d')]['fields']));_0x1f1cb1[_0x49a6('0x32')]=_0x1f1cb1[_0x49a6('0x32')]['length']?_0x1f1cb1[_0x49a6('0x32')]:_0x2f9d3e[_0x49a6('0x31')];if(!_0x448fed[_0x49a6('0x2d')][_0x49a6('0x34')]('nolimit')){_0x1f1cb1[_0x49a6('0x1d')]=qs[_0x49a6('0x1d')](_0x448fed[_0x49a6('0x2d')][_0x49a6('0x1d')]);_0x1f1cb1['offset']=qs['offset'](_0x448fed[_0x49a6('0x2d')][_0x49a6('0x1c')]);}_0x1f1cb1[_0x49a6('0x35')]=qs['sort'](_0x448fed[_0x49a6('0x2d')]['sort']);_0x1f1cb1[_0x49a6('0x36')]=qs['filters'](_[_0x49a6('0x37')](_0x448fed['query'],_0x2f9d3e[_0x49a6('0x2f')]),_0x53f17e);if(_0x448fed['query']['filter']){_0x1f1cb1['where']=_['merge'](_0x1f1cb1[_0x49a6('0x36')],{'$or':_[_0x49a6('0x28')](_0x53f17e,function(_0x2444b6){if(_0x2444b6[_0x49a6('0x2b')]!==_0x49a6('0x38')){var _0x412d77={};_0x412d77[_0x2444b6[_0x49a6('0x25')]]={'$like':'%'+_0x448fed[_0x49a6('0x2d')]['filter']+'%'};return _0x412d77;}})});}_0x1f1cb1=_[_0x49a6('0x39')]({},_0x1f1cb1,_0x448fed[_0x49a6('0x3a')]);var _0x19b045={'where':_0x1f1cb1[_0x49a6('0x36')]};return db[_0x49a6('0x29')][_0x49a6('0x1f')](_0x19b045)[_0x49a6('0x24')](function(_0x5632ea){_0x3e8be0[_0x49a6('0x1f')]=_0x5632ea;if(_0x448fed['query'][_0x49a6('0x3b')]){_0x1f1cb1[_0x49a6('0x3c')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x49a6('0x3d')](_0x1f1cb1);})[_0x49a6('0x24')](function(_0x17e9ec){_0x3e8be0[_0x49a6('0x3e')]=_0x17e9ec;return _0x3e8be0;})[_0x49a6('0x24')](respondWithFilteredResult(_0x1facf7,_0x1f1cb1))[_0x49a6('0x3f')](handleError(_0x1facf7,null));};exports[_0x49a6('0x40')]=function(_0x4e3834,_0xdfd9f){var _0x3f1739={'raw':![],'where':{'id':_0x4e3834['params']['id']}},_0x4f61b2={};_0x4f61b2[_0x49a6('0x31')]=_[_0x49a6('0x2e')](db[_0x49a6('0x29')][_0x49a6('0x2a')]);_0x4f61b2['query']=_['keys'](_0x4e3834[_0x49a6('0x2d')]);_0x4f61b2[_0x49a6('0x2f')]=_[_0x49a6('0x30')](_0x4f61b2[_0x49a6('0x31')],_0x4f61b2[_0x49a6('0x2d')]);_0x3f1739[_0x49a6('0x32')]=_[_0x49a6('0x30')](_0x4f61b2[_0x49a6('0x31')],qs['fields'](_0x4e3834[_0x49a6('0x2d')][_0x49a6('0x33')]));_0x3f1739['attributes']=_0x3f1739[_0x49a6('0x32')]['length']?_0x3f1739[_0x49a6('0x32')]:_0x4f61b2['model'];if(_0x4e3834[_0x49a6('0x2d')][_0x49a6('0x3b')]){_0x3f1739[_0x49a6('0x3c')]=[{'all':!![]}];}_0x3f1739=_[_0x49a6('0x39')]({},_0x3f1739,_0x4e3834[_0x49a6('0x3a')]);return db[_0x49a6('0x29')][_0x49a6('0x41')](_0x3f1739)['then'](handleEntityNotFound(_0xdfd9f,null))[_0x49a6('0x24')](respondWithResult(_0xdfd9f,null))['catch'](handleError(_0xdfd9f,null));};exports[_0x49a6('0x42')]=function(_0x1186aa,_0x4cf5b6){return db[_0x49a6('0x29')][_0x49a6('0x42')](_0x1186aa[_0x49a6('0x43')],{})[_0x49a6('0x24')](respondWithResult(_0x4cf5b6,0xc9))[_0x49a6('0x3f')](handleError(_0x4cf5b6,null));};exports['update']=function(_0x49ddce,_0x262236){if(_0x49ddce[_0x49a6('0x43')]['id']){delete _0x49ddce[_0x49a6('0x43')]['id'];}return db[_0x49a6('0x29')][_0x49a6('0x41')]({'where':{'id':_0x49ddce['params']['id']}})[_0x49a6('0x24')](handleEntityNotFound(_0x262236,null))[_0x49a6('0x24')](saveUpdates(_0x49ddce[_0x49a6('0x43')],null))[_0x49a6('0x24')](respondWithResult(_0x262236,null))[_0x49a6('0x3f')](handleError(_0x262236,null));};exports['destroy']=function(_0x8c8a5,_0x3a683c){return db[_0x49a6('0x29')][_0x49a6('0x41')]({'where':{'id':_0x8c8a5[_0x49a6('0x44')]['id']}})[_0x49a6('0x24')](handleEntityNotFound(_0x3a683c,null))['then'](removeEntity(_0x3a683c,null))[_0x49a6('0x3f')](handleError(_0x3a683c,null));};exports[_0x49a6('0x45')]=function(_0xd98483,_0x536ff6,_0x10874a){var _0x5f24ff={};var _0x5b3848={};var _0x48c8a8;var _0x40ff0c;return db[_0x49a6('0x29')][_0x49a6('0x46')]({'where':{'id':_0xd98483[_0x49a6('0x44')]['id']}})[_0x49a6('0x24')](handleEntityNotFound(_0x536ff6,null))[_0x49a6('0x24')](function(_0x3667c6){if(_0x3667c6){_0x48c8a8=_0x3667c6;_0x5b3848[_0x49a6('0x31')]=_[_0x49a6('0x2e')](db[_0x49a6('0x47')]['rawAttributes']);_0x5b3848[_0x49a6('0x2d')]=_[_0x49a6('0x2e')](_0xd98483['query']);_0x5b3848['filters']=_[_0x49a6('0x30')](_0x5b3848['model'],_0x5b3848['query']);_0x5f24ff[_0x49a6('0x32')]=_[_0x49a6('0x30')](_0x5b3848[_0x49a6('0x31')],qs[_0x49a6('0x33')](_0xd98483[_0x49a6('0x2d')]['fields']));_0x5f24ff['attributes']=_0x5f24ff[_0x49a6('0x32')][_0x49a6('0x48')]?_0x5f24ff[_0x49a6('0x32')]:_0x5b3848[_0x49a6('0x31')];_0x5f24ff[_0x49a6('0x35')]=qs[_0x49a6('0x49')](_0xd98483[_0x49a6('0x2d')][_0x49a6('0x49')]);_0x5f24ff[_0x49a6('0x36')]=qs[_0x49a6('0x2f')](_[_0x49a6('0x37')](_0xd98483['query'],_0x5b3848[_0x49a6('0x2f')]));if(_0xd98483[_0x49a6('0x2d')]['filter']){_0x5f24ff['where']=_[_0x49a6('0x39')](_0x5f24ff[_0x49a6('0x36')],{'$or':_['map'](_0x5f24ff['attributes'],function(_0x4a5647){var _0x2e0df6={};_0x2e0df6[_0x4a5647]={'$like':'%'+_0xd98483['query'][_0x49a6('0x4a')]+'%'};return _0x2e0df6;})});}_0x5f24ff=_['merge']({},_0x5f24ff,_0xd98483[_0x49a6('0x3a')]);return _0x48c8a8['getSubjects'](_0x5f24ff);}})[_0x49a6('0x24')](function(_0x272f52){if(_0x272f52){_0x40ff0c=_0x272f52[_0x49a6('0x48')];if(!_0xd98483['query'][_0x49a6('0x34')](_0x49a6('0x4b'))){_0x5f24ff[_0x49a6('0x1d')]=qs[_0x49a6('0x1d')](_0xd98483[_0x49a6('0x2d')][_0x49a6('0x1d')]);_0x5f24ff[_0x49a6('0x1c')]=qs[_0x49a6('0x1c')](_0xd98483[_0x49a6('0x2d')][_0x49a6('0x1c')]);}return _0x48c8a8[_0x49a6('0x45')](_0x5f24ff);}})['then'](function(_0x4bb15f){if(_0x4bb15f){return _0x4bb15f?{'count':_0x40ff0c,'rows':_0x4bb15f}:null;}})[_0x49a6('0x24')](respondWithResult(_0x536ff6,null))[_0x49a6('0x3f')](handleError(_0x536ff6,null));};exports['getDescriptions']=function(_0x1e3feb,_0x3abdbc,_0x243ce0){var _0x14063a={};var _0x4fcc7b={};var _0x4c906a;var _0x549d20;return db[_0x49a6('0x29')][_0x49a6('0x46')]({'where':{'id':_0x1e3feb[_0x49a6('0x44')]['id']}})[_0x49a6('0x24')](handleEntityNotFound(_0x3abdbc,null))['then'](function(_0x4cc758){if(_0x4cc758){_0x4c906a=_0x4cc758;_0x4fcc7b[_0x49a6('0x31')]=_[_0x49a6('0x2e')](db[_0x49a6('0x47')]['rawAttributes']);_0x4fcc7b['query']=_[_0x49a6('0x2e')](_0x1e3feb['query']);_0x4fcc7b[_0x49a6('0x2f')]=_[_0x49a6('0x30')](_0x4fcc7b['model'],_0x4fcc7b['query']);_0x14063a[_0x49a6('0x32')]=_[_0x49a6('0x30')](_0x4fcc7b[_0x49a6('0x31')],qs[_0x49a6('0x33')](_0x1e3feb[_0x49a6('0x2d')][_0x49a6('0x33')]));_0x14063a[_0x49a6('0x32')]=_0x14063a[_0x49a6('0x32')][_0x49a6('0x48')]?_0x14063a[_0x49a6('0x32')]:_0x4fcc7b[_0x49a6('0x31')];_0x14063a[_0x49a6('0x35')]=qs[_0x49a6('0x49')](_0x1e3feb[_0x49a6('0x2d')][_0x49a6('0x49')]);_0x14063a[_0x49a6('0x36')]=qs[_0x49a6('0x2f')](_[_0x49a6('0x37')](_0x1e3feb[_0x49a6('0x2d')],_0x4fcc7b[_0x49a6('0x2f')]));if(_0x1e3feb['query'][_0x49a6('0x4a')]){_0x14063a[_0x49a6('0x36')]=_[_0x49a6('0x39')](_0x14063a[_0x49a6('0x36')],{'$or':_[_0x49a6('0x28')](_0x14063a['attributes'],function(_0x78ec24){var _0x59923c={};_0x59923c[_0x78ec24]={'$like':'%'+_0x1e3feb[_0x49a6('0x2d')][_0x49a6('0x4a')]+'%'};return _0x59923c;})});}_0x14063a=_[_0x49a6('0x39')]({},_0x14063a,_0x1e3feb[_0x49a6('0x3a')]);return _0x4c906a[_0x49a6('0x4c')](_0x14063a);}})[_0x49a6('0x24')](function(_0x34b34){if(_0x34b34){_0x549d20=_0x34b34['length'];if(!_0x1e3feb[_0x49a6('0x2d')][_0x49a6('0x34')](_0x49a6('0x4b'))){_0x14063a[_0x49a6('0x1d')]=qs[_0x49a6('0x1d')](_0x1e3feb[_0x49a6('0x2d')][_0x49a6('0x1d')]);_0x14063a[_0x49a6('0x1c')]=qs['offset'](_0x1e3feb[_0x49a6('0x2d')]['offset']);}return _0x4c906a['getDescriptions'](_0x14063a);}})[_0x49a6('0x24')](function(_0x505971){if(_0x505971){return _0x505971?{'count':_0x549d20,'rows':_0x505971}:null;}})[_0x49a6('0x24')](respondWithResult(_0x3abdbc,null))[_0x49a6('0x3f')](handleError(_0x3abdbc,null));};exports[_0x49a6('0x4d')]=function(_0x2e2c05,_0x24c89d,_0x290a8a){var _0x39ea30={};var _0x371dd9={};var _0x535bb6;var _0x5d6862;return db[_0x49a6('0x29')][_0x49a6('0x46')]({'where':{'id':_0x2e2c05[_0x49a6('0x44')]['id']}})[_0x49a6('0x24')](handleEntityNotFound(_0x24c89d,null))[_0x49a6('0x24')](function(_0x3c58e3){if(_0x3c58e3){_0x535bb6=_0x3c58e3;_0x371dd9[_0x49a6('0x31')]=_[_0x49a6('0x2e')](db[_0x49a6('0x47')][_0x49a6('0x2a')]);_0x371dd9[_0x49a6('0x2d')]=_[_0x49a6('0x2e')](_0x2e2c05['query']);_0x371dd9['filters']=_[_0x49a6('0x30')](_0x371dd9[_0x49a6('0x31')],_0x371dd9[_0x49a6('0x2d')]);_0x39ea30[_0x49a6('0x32')]=_[_0x49a6('0x30')](_0x371dd9[_0x49a6('0x31')],qs[_0x49a6('0x33')](_0x2e2c05['query'][_0x49a6('0x33')]));_0x39ea30['attributes']=_0x39ea30[_0x49a6('0x32')][_0x49a6('0x48')]?_0x39ea30['attributes']:_0x371dd9[_0x49a6('0x31')];_0x39ea30[_0x49a6('0x35')]=qs['sort'](_0x2e2c05[_0x49a6('0x2d')][_0x49a6('0x49')]);_0x39ea30['where']=qs[_0x49a6('0x2f')](_[_0x49a6('0x37')](_0x2e2c05[_0x49a6('0x2d')],_0x371dd9[_0x49a6('0x2f')]));if(_0x2e2c05[_0x49a6('0x2d')][_0x49a6('0x4a')]){_0x39ea30[_0x49a6('0x36')]=_[_0x49a6('0x39')](_0x39ea30[_0x49a6('0x36')],{'$or':_[_0x49a6('0x28')](_0x39ea30[_0x49a6('0x32')],function(_0x2eebf6){var _0x68da21={};_0x68da21[_0x2eebf6]={'$like':'%'+_0x2e2c05[_0x49a6('0x2d')]['filter']+'%'};return _0x68da21;})});}_0x39ea30=_[_0x49a6('0x39')]({},_0x39ea30,_0x2e2c05[_0x49a6('0x3a')]);return _0x535bb6['getFields'](_0x39ea30);}})[_0x49a6('0x24')](function(_0x3273be){if(_0x3273be){_0x5d6862=_0x3273be[_0x49a6('0x48')];if(!_0x2e2c05[_0x49a6('0x2d')][_0x49a6('0x34')](_0x49a6('0x4b'))){_0x39ea30[_0x49a6('0x1d')]=qs[_0x49a6('0x1d')](_0x2e2c05[_0x49a6('0x2d')]['limit']);_0x39ea30['offset']=qs[_0x49a6('0x1c')](_0x2e2c05[_0x49a6('0x2d')][_0x49a6('0x1c')]);}return _0x535bb6[_0x49a6('0x4d')](_0x39ea30);}})[_0x49a6('0x24')](function(_0x2c55a2){if(_0x2c55a2){return _0x2c55a2?{'count':_0x5d6862,'rows':_0x2c55a2}:null;}})[_0x49a6('0x24')](respondWithResult(_0x24c89d,null))['catch'](handleError(_0x24c89d,null));}; \ No newline at end of file +var _0xc858=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','show','params','include','find','catch','create','body','destroy','FreshsalesField','getSubjects','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc858,0x6e));var _0x8c85=function(_0x3e5bd8,_0xccabb3){_0x3e5bd8=_0x3e5bd8-0x0;var _0x451883=_0xc858[_0x3e5bd8];return _0x451883;};'use strict';var emlformat=require(_0x8c85('0x0'));var rimraf=require(_0x8c85('0x1'));var zipdir=require(_0x8c85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c85('0x3'));var moment=require(_0x8c85('0x4'));var BPromise=require(_0x8c85('0x5'));var Mustache=require(_0x8c85('0x6'));var util=require(_0x8c85('0x7'));var path=require('path');var sox=require(_0x8c85('0x8'));var csv=require(_0x8c85('0x9'));var ejs=require(_0x8c85('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c85('0xb'));var crypto=require(_0x8c85('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c85('0xd'));var toCsv=require(_0x8c85('0x9'));var querystring=require(_0x8c85('0xe'));var Papa=require(_0x8c85('0xf'));var Redis=require(_0x8c85('0x10'));var authService=require(_0x8c85('0x11'));var qs=require(_0x8c85('0x12'));var as=require(_0x8c85('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c85('0x14'))(_0x8c85('0x15'));var utils=require(_0x8c85('0x16'));var config=require(_0x8c85('0x17'));var licenseUtil=require(_0x8c85('0x18'));var db=require(_0x8c85('0x19'))['db'];function respondWithStatusCode(_0x3cc579,_0x2c8f0d){_0x2c8f0d=_0x2c8f0d||0xcc;return function(_0x4a3071){if(_0x4a3071){return _0x3cc579[_0x8c85('0x1a')](_0x2c8f0d);}return _0x3cc579[_0x8c85('0x1b')](_0x2c8f0d)[_0x8c85('0x1c')]();};}function respondWithResult(_0x42589c,_0x249950){_0x249950=_0x249950||0xc8;return function(_0x4131bf){if(_0x4131bf){return _0x42589c[_0x8c85('0x1b')](_0x249950)[_0x8c85('0x1d')](_0x4131bf);}};}function respondWithFilteredResult(_0x222a62,_0x208cb6){return function(_0x2c0ee3){if(_0x2c0ee3){var _0x29d9a5=typeof _0x208cb6[_0x8c85('0x1e')]===_0x8c85('0x1f')&&typeof _0x208cb6['limit']===_0x8c85('0x1f');var _0x19263f=_0x2c0ee3[_0x8c85('0x20')];var _0xa862ee=_0x29d9a5?0x0:_0x208cb6[_0x8c85('0x1e')];var _0x33dc53=_0x29d9a5?_0x2c0ee3['count']:_0x208cb6[_0x8c85('0x1e')]+_0x208cb6[_0x8c85('0x21')];var _0x516319;if(_0x33dc53>=_0x19263f){_0x33dc53=_0x19263f;_0x516319=0xc8;}else{_0x516319=0xce;}_0x222a62['status'](_0x516319);return _0x222a62['set'](_0x8c85('0x22'),_0xa862ee+'-'+_0x33dc53+'/'+_0x19263f)[_0x8c85('0x1d')](_0x2c0ee3);}return null;};}function patchUpdates(_0x712f4e){return function(_0x15a531){try{jsonpatch['apply'](_0x15a531,_0x712f4e,!![]);}catch(_0x56de30){return BPromise[_0x8c85('0x23')](_0x56de30);}return _0x15a531[_0x8c85('0x24')]();};}function saveUpdates(_0x34524e,_0x457300){return function(_0x5eb4fc){if(_0x5eb4fc){return _0x5eb4fc[_0x8c85('0x25')](_0x34524e)[_0x8c85('0x26')](function(_0x1e7a15){return _0x1e7a15;});}return null;};}function removeEntity(_0x3e3ec6,_0x53dbbc){return function(_0x1d0cc2){if(_0x1d0cc2){return _0x1d0cc2['destroy']()[_0x8c85('0x26')](function(){_0x3e3ec6[_0x8c85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce327,_0x13caf3){return function(_0x1f770e){if(!_0x1f770e){_0x2ce327[_0x8c85('0x1a')](0x194);}return _0x1f770e;};}function handleError(_0x2e1694,_0x2ad0ee){_0x2ad0ee=_0x2ad0ee||0x1f4;return function(_0x2284a1){logger[_0x8c85('0x27')](_0x2284a1[_0x8c85('0x28')]);if(_0x2284a1[_0x8c85('0x29')]){delete _0x2284a1[_0x8c85('0x29')];}_0x2e1694['status'](_0x2ad0ee)[_0x8c85('0x2a')](_0x2284a1);};}exports[_0x8c85('0x2b')]=function(_0x3d5f4e,_0x483d4b){var _0x34adc0={},_0x4efcb3={},_0x284920={'count':0x0,'rows':[]};var _0x2fa41a=_[_0x8c85('0x2c')](db['FreshsalesConfiguration'][_0x8c85('0x2d')],function(_0xa38951){return{'name':_0xa38951[_0x8c85('0x2e')],'type':_0xa38951[_0x8c85('0x2f')][_0x8c85('0x30')]};});_0x4efcb3['model']=_['map'](_0x2fa41a,_0x8c85('0x29'));_0x4efcb3[_0x8c85('0x31')]=_[_0x8c85('0x32')](_0x3d5f4e[_0x8c85('0x31')]);_0x4efcb3[_0x8c85('0x33')]=_['intersection'](_0x4efcb3[_0x8c85('0x34')],_0x4efcb3[_0x8c85('0x31')]);_0x34adc0[_0x8c85('0x35')]=_[_0x8c85('0x36')](_0x4efcb3[_0x8c85('0x34')],qs[_0x8c85('0x37')](_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x37')]));_0x34adc0[_0x8c85('0x35')]=_0x34adc0[_0x8c85('0x35')][_0x8c85('0x38')]?_0x34adc0[_0x8c85('0x35')]:_0x4efcb3[_0x8c85('0x34')];if(!_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x39')](_0x8c85('0x3a'))){_0x34adc0[_0x8c85('0x21')]=qs[_0x8c85('0x21')](_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x21')]);_0x34adc0[_0x8c85('0x1e')]=qs['offset'](_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x1e')]);}_0x34adc0[_0x8c85('0x3b')]=qs[_0x8c85('0x3c')](_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x3c')]);_0x34adc0['where']=qs[_0x8c85('0x33')](_[_0x8c85('0x3d')](_0x3d5f4e['query'],_0x4efcb3['filters']),_0x2fa41a);if(_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x3e')]){_0x34adc0[_0x8c85('0x3f')]=_[_0x8c85('0x40')](_0x34adc0['where'],{'$or':_['map'](_0x2fa41a,function(_0x636476){if(_0x636476[_0x8c85('0x2f')]!==_0x8c85('0x41')){var _0x15b619={};_0x15b619[_0x636476[_0x8c85('0x29')]]={'$like':'%'+_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x3e')]+'%'};return _0x15b619;}})});}_0x34adc0=_[_0x8c85('0x40')]({},_0x34adc0,_0x3d5f4e[_0x8c85('0x42')]);var _0x515551={'where':_0x34adc0[_0x8c85('0x3f')]};return db[_0x8c85('0x43')]['count'](_0x515551)[_0x8c85('0x26')](function(_0x2d2c54){_0x284920[_0x8c85('0x20')]=_0x2d2c54;if(_0x3d5f4e[_0x8c85('0x31')][_0x8c85('0x44')]){_0x34adc0['include']=[{'all':!![]}];}return db[_0x8c85('0x43')]['findAll'](_0x34adc0);})[_0x8c85('0x26')](function(_0xa7a393){_0x284920['rows']=_0xa7a393;return _0x284920;})['then'](respondWithFilteredResult(_0x483d4b,_0x34adc0))['catch'](handleError(_0x483d4b,null));};exports[_0x8c85('0x45')]=function(_0x116a23,_0x298987){var _0x63e824={'raw':![],'where':{'id':_0x116a23[_0x8c85('0x46')]['id']}},_0x23890a={};_0x23890a[_0x8c85('0x34')]=_[_0x8c85('0x32')](db[_0x8c85('0x43')][_0x8c85('0x2d')]);_0x23890a[_0x8c85('0x31')]=_[_0x8c85('0x32')](_0x116a23[_0x8c85('0x31')]);_0x23890a[_0x8c85('0x33')]=_[_0x8c85('0x36')](_0x23890a[_0x8c85('0x34')],_0x23890a[_0x8c85('0x31')]);_0x63e824[_0x8c85('0x35')]=_[_0x8c85('0x36')](_0x23890a['model'],qs[_0x8c85('0x37')](_0x116a23[_0x8c85('0x31')]['fields']));_0x63e824[_0x8c85('0x35')]=_0x63e824[_0x8c85('0x35')]['length']?_0x63e824['attributes']:_0x23890a['model'];if(_0x116a23[_0x8c85('0x31')][_0x8c85('0x44')]){_0x63e824[_0x8c85('0x47')]=[{'all':!![]}];}_0x63e824=_[_0x8c85('0x40')]({},_0x63e824,_0x116a23['options']);return db['FreshsalesConfiguration'][_0x8c85('0x48')](_0x63e824)['then'](handleEntityNotFound(_0x298987,null))[_0x8c85('0x26')](respondWithResult(_0x298987,null))[_0x8c85('0x49')](handleError(_0x298987,null));};exports['create']=function(_0x50b7c4,_0x1e6cc3){return db[_0x8c85('0x43')][_0x8c85('0x4a')](_0x50b7c4[_0x8c85('0x4b')],{})[_0x8c85('0x26')](respondWithResult(_0x1e6cc3,0xc9))['catch'](handleError(_0x1e6cc3,null));};exports[_0x8c85('0x25')]=function(_0x55c841,_0x43bc93){if(_0x55c841[_0x8c85('0x4b')]['id']){delete _0x55c841[_0x8c85('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0x8c85('0x48')]({'where':{'id':_0x55c841[_0x8c85('0x46')]['id']}})['then'](handleEntityNotFound(_0x43bc93,null))[_0x8c85('0x26')](saveUpdates(_0x55c841['body'],null))[_0x8c85('0x26')](respondWithResult(_0x43bc93,null))[_0x8c85('0x49')](handleError(_0x43bc93,null));};exports[_0x8c85('0x4c')]=function(_0x13e97d,_0xca4625){return db['FreshsalesConfiguration'][_0x8c85('0x48')]({'where':{'id':_0x13e97d[_0x8c85('0x46')]['id']}})[_0x8c85('0x26')](handleEntityNotFound(_0xca4625,null))[_0x8c85('0x26')](removeEntity(_0xca4625,null))['catch'](handleError(_0xca4625,null));};exports['getSubjects']=function(_0x1f353,_0x217b2b,_0x569869){var _0x1f89f5={};var _0x302bfe={};var _0x599dc1;var _0x2c2530;return db[_0x8c85('0x43')]['findOne']({'where':{'id':_0x1f353[_0x8c85('0x46')]['id']}})['then'](handleEntityNotFound(_0x217b2b,null))[_0x8c85('0x26')](function(_0x5c0690){if(_0x5c0690){_0x599dc1=_0x5c0690;_0x302bfe[_0x8c85('0x34')]=_[_0x8c85('0x32')](db[_0x8c85('0x4d')]['rawAttributes']);_0x302bfe[_0x8c85('0x31')]=_[_0x8c85('0x32')](_0x1f353[_0x8c85('0x31')]);_0x302bfe[_0x8c85('0x33')]=_[_0x8c85('0x36')](_0x302bfe[_0x8c85('0x34')],_0x302bfe[_0x8c85('0x31')]);_0x1f89f5['attributes']=_[_0x8c85('0x36')](_0x302bfe['model'],qs['fields'](_0x1f353['query'][_0x8c85('0x37')]));_0x1f89f5[_0x8c85('0x35')]=_0x1f89f5[_0x8c85('0x35')][_0x8c85('0x38')]?_0x1f89f5[_0x8c85('0x35')]:_0x302bfe[_0x8c85('0x34')];_0x1f89f5[_0x8c85('0x3b')]=qs[_0x8c85('0x3c')](_0x1f353[_0x8c85('0x31')][_0x8c85('0x3c')]);_0x1f89f5[_0x8c85('0x3f')]=qs['filters'](_[_0x8c85('0x3d')](_0x1f353[_0x8c85('0x31')],_0x302bfe[_0x8c85('0x33')]));if(_0x1f353['query']['filter']){_0x1f89f5[_0x8c85('0x3f')]=_[_0x8c85('0x40')](_0x1f89f5['where'],{'$or':_[_0x8c85('0x2c')](_0x1f89f5[_0x8c85('0x35')],function(_0x5e6ba3){var _0x2a3346={};_0x2a3346[_0x5e6ba3]={'$like':'%'+_0x1f353[_0x8c85('0x31')]['filter']+'%'};return _0x2a3346;})});}_0x1f89f5=_[_0x8c85('0x40')]({},_0x1f89f5,_0x1f353[_0x8c85('0x42')]);return _0x599dc1[_0x8c85('0x4e')](_0x1f89f5);}})['then'](function(_0x44eb67){if(_0x44eb67){_0x2c2530=_0x44eb67['length'];if(!_0x1f353[_0x8c85('0x31')][_0x8c85('0x39')](_0x8c85('0x3a'))){_0x1f89f5[_0x8c85('0x21')]=qs['limit'](_0x1f353[_0x8c85('0x31')]['limit']);_0x1f89f5[_0x8c85('0x1e')]=qs[_0x8c85('0x1e')](_0x1f353[_0x8c85('0x31')][_0x8c85('0x1e')]);}return _0x599dc1['getSubjects'](_0x1f89f5);}})['then'](function(_0x4c64c4){if(_0x4c64c4){return _0x4c64c4?{'count':_0x2c2530,'rows':_0x4c64c4}:null;}})[_0x8c85('0x26')](respondWithResult(_0x217b2b,null))[_0x8c85('0x49')](handleError(_0x217b2b,null));};exports[_0x8c85('0x4f')]=function(_0x29e5b8,_0x241c82,_0x47ba9b){var _0x2f3715={};var _0x2c1379={};var _0x25e2a0;var _0xda07cb;return db[_0x8c85('0x43')][_0x8c85('0x50')]({'where':{'id':_0x29e5b8[_0x8c85('0x46')]['id']}})[_0x8c85('0x26')](handleEntityNotFound(_0x241c82,null))[_0x8c85('0x26')](function(_0x10d2a9){if(_0x10d2a9){_0x25e2a0=_0x10d2a9;_0x2c1379[_0x8c85('0x34')]=_[_0x8c85('0x32')](db[_0x8c85('0x4d')]['rawAttributes']);_0x2c1379[_0x8c85('0x31')]=_[_0x8c85('0x32')](_0x29e5b8[_0x8c85('0x31')]);_0x2c1379[_0x8c85('0x33')]=_[_0x8c85('0x36')](_0x2c1379[_0x8c85('0x34')],_0x2c1379[_0x8c85('0x31')]);_0x2f3715['attributes']=_[_0x8c85('0x36')](_0x2c1379[_0x8c85('0x34')],qs[_0x8c85('0x37')](_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x37')]));_0x2f3715[_0x8c85('0x35')]=_0x2f3715[_0x8c85('0x35')][_0x8c85('0x38')]?_0x2f3715[_0x8c85('0x35')]:_0x2c1379['model'];_0x2f3715[_0x8c85('0x3b')]=qs[_0x8c85('0x3c')](_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x3c')]);_0x2f3715['where']=qs[_0x8c85('0x33')](_[_0x8c85('0x3d')](_0x29e5b8[_0x8c85('0x31')],_0x2c1379[_0x8c85('0x33')]));if(_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x3e')]){_0x2f3715['where']=_['merge'](_0x2f3715[_0x8c85('0x3f')],{'$or':_[_0x8c85('0x2c')](_0x2f3715[_0x8c85('0x35')],function(_0x1fd4e4){var _0x3a9d67={};_0x3a9d67[_0x1fd4e4]={'$like':'%'+_0x29e5b8['query'][_0x8c85('0x3e')]+'%'};return _0x3a9d67;})});}_0x2f3715=_[_0x8c85('0x40')]({},_0x2f3715,_0x29e5b8[_0x8c85('0x42')]);return _0x25e2a0[_0x8c85('0x4f')](_0x2f3715);}})['then'](function(_0xb6a080){if(_0xb6a080){_0xda07cb=_0xb6a080[_0x8c85('0x38')];if(!_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x39')]('nolimit')){_0x2f3715[_0x8c85('0x21')]=qs[_0x8c85('0x21')](_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x21')]);_0x2f3715['offset']=qs['offset'](_0x29e5b8[_0x8c85('0x31')][_0x8c85('0x1e')]);}return _0x25e2a0[_0x8c85('0x4f')](_0x2f3715);}})[_0x8c85('0x26')](function(_0x19f09b){if(_0x19f09b){return _0x19f09b?{'count':_0xda07cb,'rows':_0x19f09b}:null;}})[_0x8c85('0x26')](respondWithResult(_0x241c82,null))[_0x8c85('0x49')](handleError(_0x241c82,null));};exports['getFields']=function(_0x90dc0c,_0x11757e,_0x1cb13c){var _0x2e1e48={};var _0x10c605={};var _0x9d5ebf;var _0x5adbaf;return db['FreshsalesConfiguration'][_0x8c85('0x50')]({'where':{'id':_0x90dc0c[_0x8c85('0x46')]['id']}})['then'](handleEntityNotFound(_0x11757e,null))[_0x8c85('0x26')](function(_0x5ed49b){if(_0x5ed49b){_0x9d5ebf=_0x5ed49b;_0x10c605['model']=_[_0x8c85('0x32')](db[_0x8c85('0x4d')][_0x8c85('0x2d')]);_0x10c605['query']=_[_0x8c85('0x32')](_0x90dc0c['query']);_0x10c605[_0x8c85('0x33')]=_[_0x8c85('0x36')](_0x10c605[_0x8c85('0x34')],_0x10c605[_0x8c85('0x31')]);_0x2e1e48['attributes']=_[_0x8c85('0x36')](_0x10c605['model'],qs[_0x8c85('0x37')](_0x90dc0c[_0x8c85('0x31')][_0x8c85('0x37')]));_0x2e1e48[_0x8c85('0x35')]=_0x2e1e48[_0x8c85('0x35')][_0x8c85('0x38')]?_0x2e1e48[_0x8c85('0x35')]:_0x10c605[_0x8c85('0x34')];_0x2e1e48[_0x8c85('0x3b')]=qs['sort'](_0x90dc0c[_0x8c85('0x31')][_0x8c85('0x3c')]);_0x2e1e48['where']=qs[_0x8c85('0x33')](_['pick'](_0x90dc0c[_0x8c85('0x31')],_0x10c605['filters']));if(_0x90dc0c[_0x8c85('0x31')][_0x8c85('0x3e')]){_0x2e1e48['where']=_['merge'](_0x2e1e48[_0x8c85('0x3f')],{'$or':_['map'](_0x2e1e48[_0x8c85('0x35')],function(_0xb484cf){var _0x5790d2={};_0x5790d2[_0xb484cf]={'$like':'%'+_0x90dc0c['query']['filter']+'%'};return _0x5790d2;})});}_0x2e1e48=_['merge']({},_0x2e1e48,_0x90dc0c[_0x8c85('0x42')]);return _0x9d5ebf[_0x8c85('0x51')](_0x2e1e48);}})['then'](function(_0x928963){if(_0x928963){_0x5adbaf=_0x928963[_0x8c85('0x38')];if(!_0x90dc0c[_0x8c85('0x31')][_0x8c85('0x39')](_0x8c85('0x3a'))){_0x2e1e48[_0x8c85('0x21')]=qs[_0x8c85('0x21')](_0x90dc0c[_0x8c85('0x31')]['limit']);_0x2e1e48['offset']=qs[_0x8c85('0x1e')](_0x90dc0c[_0x8c85('0x31')][_0x8c85('0x1e')]);}return _0x9d5ebf[_0x8c85('0x51')](_0x2e1e48);}})[_0x8c85('0x26')](function(_0x1b70e3){if(_0x1b70e3){return _0x1b70e3?{'count':_0x5adbaf,'rows':_0x1b70e3}:null;}})[_0x8c85('0x26')](respondWithResult(_0x11757e,null))[_0x8c85('0x49')](handleError(_0x11757e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7c34054..984e290 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 _0xafa1=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xafa1,0x16f));var _0x1afa=function(_0x487131,_0x2c86e8){_0x487131=_0x487131-0x0;var _0xf320ff=_0xafa1[_0x487131];return _0xf320ff;};'use strict';var _=require(_0x1afa('0x0'));var util=require(_0x1afa('0x1'));var logger=require('../../config/logger')(_0x1afa('0x2'));var moment=require(_0x1afa('0x3'));var BPromise=require(_0x1afa('0x4'));var rp=require(_0x1afa('0x5'));var fs=require('fs');var path=require(_0x1afa('0x6'));var rimraf=require(_0x1afa('0x7'));var config=require(_0x1afa('0x8'));var attributes=require(_0x1afa('0x9'));module[_0x1afa('0xa')]=function(_0x2c4379,_0x2e6dfd){return _0x2c4379[_0x1afa('0xb')](_0x1afa('0xc'),attributes,{'tableName':_0x1afa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba0=['int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration'];(function(_0x405948,_0x54df87){var _0x3618a0=function(_0x3631d9){while(--_0x3631d9){_0x405948['push'](_0x405948['shift']());}};_0x3618a0(++_0x54df87);}(_0x2ba0,0x6d));var _0x02ba=function(_0x6bacfa,_0x44d3e2){_0x6bacfa=_0x6bacfa-0x0;var _0x5ed62e=_0x2ba0[_0x6bacfa];return _0x5ed62e;};'use strict';var _=require(_0x02ba('0x0'));var util=require(_0x02ba('0x1'));var logger=require(_0x02ba('0x2'))(_0x02ba('0x3'));var moment=require('moment');var BPromise=require(_0x02ba('0x4'));var rp=require(_0x02ba('0x5'));var fs=require('fs');var path=require(_0x02ba('0x6'));var rimraf=require(_0x02ba('0x7'));var config=require(_0x02ba('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x981b4d,_0x4a5dd4){return _0x981b4d[_0x02ba('0x9')](_0x02ba('0xa'),attributes,{'tableName':_0x02ba('0xb'),'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 44261a3..dbd82a0 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 _0xad91=['message','info','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36b355,_0x168752){var _0x1510d8=function(_0x58e943){while(--_0x58e943){_0x36b355['push'](_0x36b355['shift']());}};_0x1510d8(++_0x168752);}(_0xad91,0x1bb));var _0x1ad9=function(_0x22da61,_0x237ba9){_0x22da61=_0x22da61-0x0;var _0x40b728=_0xad91[_0x22da61];return _0x40b728;};'use strict';var _=require('lodash');var util=require(_0x1ad9('0x0'));var moment=require(_0x1ad9('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ad9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ad9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ad9('0x4'))('rpc');var config=require(_0x1ad9('0x5'));var jayson=require(_0x1ad9('0x6'));var client=jayson[_0x1ad9('0x7')][_0x1ad9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1881fb,_0x5e6450,_0x3e6644){return new BPromise(function(_0x14b29b,_0x26f1a8){return client[_0x1ad9('0x9')](_0x1881fb,_0x3e6644)['then'](function(_0x24cc60){logger['info'](_0x1ad9('0xa'),_0x5e6450,_0x1ad9('0xb'));logger[_0x1ad9('0xc')](_0x1ad9('0xd'),_0x5e6450,_0x1ad9('0xb'),JSON[_0x1ad9('0xe')](_0x24cc60));if(_0x24cc60['error']){if(_0x24cc60[_0x1ad9('0xf')][_0x1ad9('0x10')]===0x1f4){logger[_0x1ad9('0xf')](_0x1ad9('0xa'),_0x5e6450,_0x24cc60[_0x1ad9('0xf')]['message']);return _0x26f1a8(_0x24cc60[_0x1ad9('0xf')]['message']);}logger[_0x1ad9('0xf')](_0x1ad9('0xa'),_0x5e6450,_0x24cc60[_0x1ad9('0xf')][_0x1ad9('0x11')]);return _0x14b29b(_0x24cc60[_0x1ad9('0xf')]['message']);}else{logger[_0x1ad9('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5e6450,'request\x20sent');_0x14b29b(_0x24cc60['result'][_0x1ad9('0x11')]);}})[_0x1ad9('0x13')](function(_0x497c4f){logger[_0x1ad9('0xf')](_0x1ad9('0xa'),_0x5e6450,_0x497c4f);_0x26f1a8(_0x497c4f);});});} \ No newline at end of file +var _0xb2e6=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2cddf5,_0x4d7290){var _0x5085e3=function(_0x3f283a){while(--_0x3f283a){_0x2cddf5['push'](_0x2cddf5['shift']());}};_0x5085e3(++_0x4d7290);}(_0xb2e6,0x139));var _0x6b2e=function(_0x4a37b1,_0x190ff1){_0x4a37b1=_0x4a37b1-0x0;var _0x1eec5a=_0xb2e6[_0x4a37b1];return _0x1eec5a;};'use strict';var _=require(_0x6b2e('0x0'));var util=require(_0x6b2e('0x1'));var moment=require('moment');var BPromise=require(_0x6b2e('0x2'));var rs=require(_0x6b2e('0x3'));var fs=require('fs');var Redis=require(_0x6b2e('0x4'));var db=require(_0x6b2e('0x5'))['db'];var utils=require(_0x6b2e('0x6'));var logger=require(_0x6b2e('0x7'))('rpc');var config=require(_0x6b2e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b2e('0x9')][_0x6b2e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce1a4,_0x430ffd,_0x301e0b){return new BPromise(function(_0x44a52e,_0xde336b){return client[_0x6b2e('0xb')](_0x2ce1a4,_0x301e0b)[_0x6b2e('0xc')](function(_0x41e86b){logger[_0x6b2e('0xd')](_0x6b2e('0xe'),_0x430ffd,_0x6b2e('0xf'));logger['debug'](_0x6b2e('0x10'),_0x430ffd,'request\x20sent',JSON[_0x6b2e('0x11')](_0x41e86b));if(_0x41e86b[_0x6b2e('0x12')]){if(_0x41e86b[_0x6b2e('0x12')][_0x6b2e('0x13')]===0x1f4){logger[_0x6b2e('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x430ffd,_0x41e86b[_0x6b2e('0x12')]['message']);return _0xde336b(_0x41e86b['error'][_0x6b2e('0x14')]);}logger[_0x6b2e('0x12')](_0x6b2e('0xe'),_0x430ffd,_0x41e86b[_0x6b2e('0x12')][_0x6b2e('0x14')]);return _0x44a52e(_0x41e86b[_0x6b2e('0x12')][_0x6b2e('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x430ffd,_0x6b2e('0xf'));_0x44a52e(_0x41e86b[_0x6b2e('0x15')][_0x6b2e('0x14')]);}})[_0x6b2e('0x16')](function(_0x1dcdfb){logger[_0x6b2e('0x12')](_0x6b2e('0xe'),_0x430ffd,_0x1dcdfb);_0xde336b(_0x1dcdfb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5b4066b..fa9ed7e 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 _0x25ad=['get','/:id','show','post','isAuthenticated','create','put','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x25ad,0x1b1));var _0xd25a=function(_0x47e92b,_0x29e3b5){_0x47e92b=_0x47e92b-0x0;var _0x2da694=_0x25ad[_0x47e92b];return _0x2da694;};'use strict';var multer=require(_0xd25a('0x0'));var util=require('util');var path=require(_0xd25a('0x1'));var timeout=require(_0xd25a('0x2'));var express=require(_0xd25a('0x3'));var router=express['Router']();var fs_extra=require(_0xd25a('0x4'));var auth=require(_0xd25a('0x5'));var interaction=require(_0xd25a('0x6'));var config=require(_0xd25a('0x7'));var controller=require(_0xd25a('0x8'));router[_0xd25a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd25a('0x9')](_0xd25a('0xa'),auth['isAuthenticated'](),controller[_0xd25a('0xb')]);router[_0xd25a('0xc')]('/',auth[_0xd25a('0xd')](),controller[_0xd25a('0xe')]);router[_0xd25a('0xf')](_0xd25a('0xa'),auth[_0xd25a('0xd')](),controller['update']);router[_0xd25a('0x10')]('/:id',auth[_0xd25a('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9585=['get','/:id','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0xe5e790,_0x538acc){var _0x2f4525=function(_0x392594){while(--_0x392594){_0xe5e790['push'](_0xe5e790['shift']());}};_0x2f4525(++_0x538acc);}(_0x9585,0x15e));var _0x5958=function(_0x1e840c,_0x2aed43){_0x1e840c=_0x1e840c-0x0;var _0x56df0e=_0x9585[_0x1e840c];return _0x56df0e;};'use strict';var multer=require('multer');var util=require(_0x5958('0x0'));var path=require('path');var timeout=require(_0x5958('0x1'));var express=require(_0x5958('0x2'));var router=express[_0x5958('0x3')]();var fs_extra=require(_0x5958('0x4'));var auth=require(_0x5958('0x5'));var interaction=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var controller=require(_0x5958('0x8'));router['get']('/',auth[_0x5958('0x9')](),controller['index']);router[_0x5958('0xa')](_0x5958('0xb'),auth[_0x5958('0x9')](),controller['show']);router[_0x5958('0xc')]('/',auth['isAuthenticated'](),controller[_0x5958('0xd')]);router[_0x5958('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5958('0xf')]);router[_0x5958('0x10')](_0x5958('0xb'),auth[_0x5958('0x9')](),controller[_0x5958('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ad74e3d..581a03c 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 _0x59b2=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x59b2,0x6c));var _0x259b=function(_0x217605,_0x347798){_0x217605=_0x217605-0x0;var _0x13b50e=_0x59b2[_0x217605];return _0x13b50e;};'use strict';var Sequelize=require(_0x259b('0x0'));module[_0x259b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x259b('0x2'),_0x259b('0x3'),_0x259b('0x4'),_0x259b('0x5'),_0x259b('0x6')),'defaultValue':_0x259b('0x2')},'content':{'type':Sequelize[_0x259b('0x7')]},'key':{'type':Sequelize[_0x259b('0x7')]},'keyType':{'type':Sequelize[_0x259b('0x8')](_0x259b('0x2'),_0x259b('0x3'),_0x259b('0x4'))},'keyContent':{'type':Sequelize[_0x259b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x259b('0x7')]},'customField':{'type':Sequelize[_0x259b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5596=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x362a7e,_0x4ac361){var _0x1401db=function(_0x15fb3b){while(--_0x15fb3b){_0x362a7e['push'](_0x362a7e['shift']());}};_0x1401db(++_0x4ac361);}(_0x5596,0xa9));var _0x6559=function(_0x276b0b,_0x2651f0){_0x276b0b=_0x276b0b-0x0;var _0x2ec6c4=_0x5596[_0x276b0b];return _0x2ec6c4;};'use strict';var Sequelize=require(_0x6559('0x0'));module[_0x6559('0x1')]={'type':{'type':Sequelize[_0x6559('0x2')](_0x6559('0x3'),'variable',_0x6559('0x4'),_0x6559('0x5'),'picklist'),'defaultValue':_0x6559('0x3')},'content':{'type':Sequelize[_0x6559('0x6')]},'key':{'type':Sequelize[_0x6559('0x6')]},'keyType':{'type':Sequelize[_0x6559('0x2')](_0x6559('0x3'),'variable',_0x6559('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6559('0x6')]},'nameField':{'type':Sequelize[_0x6559('0x6')]},'customField':{'type':Sequelize[_0x6559('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 73f0915..cff2625 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 _0xa1ae=['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','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','FreshsalesField','includeAll','include','findAll','catch','show','keys','create','body','params','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xa1ae,0xd3));var _0xea1a=function(_0x16f309,_0x19750c){_0x16f309=_0x16f309-0x0;var _0x398b72=_0xa1ae[_0x16f309];return _0x398b72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea1a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea1a('0x1'));var rp=require(_0xea1a('0x2'));var moment=require(_0xea1a('0x3'));var BPromise=require(_0xea1a('0x4'));var Mustache=require(_0xea1a('0x5'));var util=require(_0xea1a('0x6'));var path=require(_0xea1a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xea1a('0x8'));var fs=require('fs');var fs_extra=require(_0xea1a('0x9'));var _=require(_0xea1a('0xa'));var squel=require('squel');var crypto=require(_0xea1a('0xb'));var jsforce=require(_0xea1a('0xc'));var deskjs=require(_0xea1a('0xd'));var toCsv=require(_0xea1a('0xe'));var querystring=require(_0xea1a('0xf'));var Papa=require(_0xea1a('0x10'));var Redis=require(_0xea1a('0x11'));var authService=require(_0xea1a('0x12'));var qs=require(_0xea1a('0x13'));var as=require(_0xea1a('0x14'));var hardwareService=require(_0xea1a('0x15'));var logger=require(_0xea1a('0x16'))(_0xea1a('0x17'));var utils=require(_0xea1a('0x18'));var config=require(_0xea1a('0x19'));var licenseUtil=require(_0xea1a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ee8d5,_0x3abf39){_0x3abf39=_0x3abf39||0xcc;return function(_0x4e9482){if(_0x4e9482){return _0x3ee8d5['sendStatus'](_0x3abf39);}return _0x3ee8d5[_0xea1a('0x1b')](_0x3abf39)[_0xea1a('0x1c')]();};}function respondWithResult(_0x5675bf,_0x1555d2){_0x1555d2=_0x1555d2||0xc8;return function(_0xb90c08){if(_0xb90c08){return _0x5675bf[_0xea1a('0x1b')](_0x1555d2)[_0xea1a('0x1d')](_0xb90c08);}};}function respondWithFilteredResult(_0x32159d,_0x1ae4bf){return function(_0x457252){if(_0x457252){var _0x3e8c98=typeof _0x1ae4bf[_0xea1a('0x1e')]===_0xea1a('0x1f')&&typeof _0x1ae4bf[_0xea1a('0x20')]===_0xea1a('0x1f');var _0x48905b=_0x457252[_0xea1a('0x21')];var _0x43d543=_0x3e8c98?0x0:_0x1ae4bf[_0xea1a('0x1e')];var _0xf63e68=_0x3e8c98?_0x457252[_0xea1a('0x21')]:_0x1ae4bf[_0xea1a('0x1e')]+_0x1ae4bf[_0xea1a('0x20')];var _0x1b7d5d;if(_0xf63e68>=_0x48905b){_0xf63e68=_0x48905b;_0x1b7d5d=0xc8;}else{_0x1b7d5d=0xce;}_0x32159d[_0xea1a('0x1b')](_0x1b7d5d);return _0x32159d[_0xea1a('0x22')]('Content-Range',_0x43d543+'-'+_0xf63e68+'/'+_0x48905b)[_0xea1a('0x1d')](_0x457252);}return null;};}function patchUpdates(_0x381f10){return function(_0x49ab65){try{jsonpatch[_0xea1a('0x23')](_0x49ab65,_0x381f10,!![]);}catch(_0x1072e3){return BPromise[_0xea1a('0x24')](_0x1072e3);}return _0x49ab65[_0xea1a('0x25')]();};}function saveUpdates(_0x570041,_0x175137){return function(_0x2ba47f){if(_0x2ba47f){return _0x2ba47f[_0xea1a('0x26')](_0x570041)['then'](function(_0x42d09f){return _0x42d09f;});}return null;};}function removeEntity(_0x41a11f,_0xf801c8){return function(_0x27cbab){if(_0x27cbab){return _0x27cbab['destroy']()[_0xea1a('0x27')](function(){_0x41a11f[_0xea1a('0x1b')](0xcc)[_0xea1a('0x1c')]();});}};}function handleEntityNotFound(_0x43898d,_0x30b0a5){return function(_0x47ff55){if(!_0x47ff55){_0x43898d['sendStatus'](0x194);}return _0x47ff55;};}function handleError(_0x42b517,_0x15b0a7){_0x15b0a7=_0x15b0a7||0x1f4;return function(_0x3302df){logger[_0xea1a('0x28')](_0x3302df[_0xea1a('0x29')]);if(_0x3302df['name']){delete _0x3302df[_0xea1a('0x2a')];}_0x42b517[_0xea1a('0x1b')](_0x15b0a7)['send'](_0x3302df);};}exports[_0xea1a('0x2b')]=function(_0x2a93e9,_0x1a135d){var _0x5edb18={},_0x18d596={},_0x404d4f={'count':0x0,'rows':[]};var _0x5efb01=_[_0xea1a('0x2c')](db['FreshsalesField'][_0xea1a('0x2d')],function(_0x54e7c5){return{'name':_0x54e7c5['fieldName'],'type':_0x54e7c5[_0xea1a('0x2e')][_0xea1a('0x2f')]};});_0x18d596[_0xea1a('0x30')]=_[_0xea1a('0x2c')](_0x5efb01,'name');_0x18d596['query']=_['keys'](_0x2a93e9[_0xea1a('0x31')]);_0x18d596[_0xea1a('0x32')]=_[_0xea1a('0x33')](_0x18d596[_0xea1a('0x30')],_0x18d596['query']);_0x5edb18[_0xea1a('0x34')]=_[_0xea1a('0x33')](_0x18d596[_0xea1a('0x30')],qs[_0xea1a('0x35')](_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x35')]));_0x5edb18[_0xea1a('0x34')]=_0x5edb18[_0xea1a('0x34')][_0xea1a('0x36')]?_0x5edb18['attributes']:_0x18d596[_0xea1a('0x30')];if(!_0x2a93e9[_0xea1a('0x31')]['hasOwnProperty'](_0xea1a('0x37'))){_0x5edb18[_0xea1a('0x20')]=qs[_0xea1a('0x20')](_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x20')]);_0x5edb18[_0xea1a('0x1e')]=qs[_0xea1a('0x1e')](_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x1e')]);}_0x5edb18[_0xea1a('0x38')]=qs[_0xea1a('0x39')](_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x39')]);_0x5edb18[_0xea1a('0x3a')]=qs[_0xea1a('0x32')](_[_0xea1a('0x3b')](_0x2a93e9[_0xea1a('0x31')],_0x18d596[_0xea1a('0x32')]),_0x5efb01);if(_0x2a93e9[_0xea1a('0x31')]['filter']){_0x5edb18[_0xea1a('0x3a')]=_['merge'](_0x5edb18[_0xea1a('0x3a')],{'$or':_[_0xea1a('0x2c')](_0x5efb01,function(_0x2ade16){if(_0x2ade16[_0xea1a('0x2e')]!==_0xea1a('0x3c')){var _0x48aab4={};_0x48aab4[_0x2ade16[_0xea1a('0x2a')]]={'$like':'%'+_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x3d')]+'%'};return _0x48aab4;}})});}_0x5edb18=_[_0xea1a('0x3e')]({},_0x5edb18,_0x2a93e9[_0xea1a('0x3f')]);var _0x558f4e={'where':_0x5edb18[_0xea1a('0x3a')]};return db[_0xea1a('0x40')][_0xea1a('0x21')](_0x558f4e)[_0xea1a('0x27')](function(_0x406e8f){_0x404d4f[_0xea1a('0x21')]=_0x406e8f;if(_0x2a93e9[_0xea1a('0x31')][_0xea1a('0x41')]){_0x5edb18[_0xea1a('0x42')]=[{'all':!![]}];}return db[_0xea1a('0x40')][_0xea1a('0x43')](_0x5edb18);})[_0xea1a('0x27')](function(_0x4ea4e2){_0x404d4f['rows']=_0x4ea4e2;return _0x404d4f;})[_0xea1a('0x27')](respondWithFilteredResult(_0x1a135d,_0x5edb18))[_0xea1a('0x44')](handleError(_0x1a135d,null));};exports[_0xea1a('0x45')]=function(_0x5df299,_0x51a5fc){var _0x74be42={'raw':!![],'where':{'id':_0x5df299['params']['id']}},_0x5a06bf={};_0x5a06bf[_0xea1a('0x30')]=_['keys'](db[_0xea1a('0x40')][_0xea1a('0x2d')]);_0x5a06bf[_0xea1a('0x31')]=_[_0xea1a('0x46')](_0x5df299[_0xea1a('0x31')]);_0x5a06bf['filters']=_[_0xea1a('0x33')](_0x5a06bf['model'],_0x5a06bf[_0xea1a('0x31')]);_0x74be42[_0xea1a('0x34')]=_[_0xea1a('0x33')](_0x5a06bf[_0xea1a('0x30')],qs['fields'](_0x5df299[_0xea1a('0x31')][_0xea1a('0x35')]));_0x74be42[_0xea1a('0x34')]=_0x74be42[_0xea1a('0x34')][_0xea1a('0x36')]?_0x74be42[_0xea1a('0x34')]:_0x5a06bf[_0xea1a('0x30')];if(_0x5df299['query'][_0xea1a('0x41')]){_0x74be42[_0xea1a('0x42')]=[{'all':!![]}];}_0x74be42=_[_0xea1a('0x3e')]({},_0x74be42,_0x5df299[_0xea1a('0x3f')]);return db[_0xea1a('0x40')]['find'](_0x74be42)[_0xea1a('0x27')](handleEntityNotFound(_0x51a5fc,null))['then'](respondWithResult(_0x51a5fc,null))[_0xea1a('0x44')](handleError(_0x51a5fc,null));};exports[_0xea1a('0x47')]=function(_0x24c53b,_0x58d5d5){return db[_0xea1a('0x40')][_0xea1a('0x47')](_0x24c53b['body'],{})[_0xea1a('0x27')](respondWithResult(_0x58d5d5,0xc9))[_0xea1a('0x44')](handleError(_0x58d5d5,null));};exports[_0xea1a('0x26')]=function(_0x70b6be,_0x57f358){if(_0x70b6be[_0xea1a('0x48')]['id']){delete _0x70b6be[_0xea1a('0x48')]['id'];}return db[_0xea1a('0x40')]['find']({'where':{'id':_0x70b6be[_0xea1a('0x49')]['id']}})[_0xea1a('0x27')](handleEntityNotFound(_0x57f358,null))[_0xea1a('0x27')](saveUpdates(_0x70b6be['body'],null))[_0xea1a('0x27')](respondWithResult(_0x57f358,null))['catch'](handleError(_0x57f358,null));};exports[_0xea1a('0x4a')]=function(_0x502e0d,_0x934112){return db['FreshsalesField']['find']({'where':{'id':_0x502e0d[_0xea1a('0x49')]['id']}})[_0xea1a('0x27')](handleEntityNotFound(_0x934112,null))[_0xea1a('0x27')](removeEntity(_0x934112,null))[_0xea1a('0x44')](handleError(_0x934112,null));}; \ No newline at end of file +var _0x1518=['filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','name','send','index','FreshsalesField','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x5d6667,_0x4ca202){var _0xd848b2=function(_0x4b30f0){while(--_0x4b30f0){_0x5d6667['push'](_0x5d6667['shift']());}};_0xd848b2(++_0x4ca202);}(_0x1518,0x1c6));var _0x8151=function(_0x4865bf,_0x20b192){_0x4865bf=_0x4865bf-0x0;var _0x334f97=_0x1518[_0x4865bf];return _0x334f97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8151('0x0'));var zipdir=require(_0x8151('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8151('0x2'));var moment=require('moment');var BPromise=require(_0x8151('0x3'));var Mustache=require(_0x8151('0x4'));var util=require(_0x8151('0x5'));var path=require(_0x8151('0x6'));var sox=require(_0x8151('0x7'));var csv=require('to-csv');var ejs=require(_0x8151('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8151('0x9'));var squel=require(_0x8151('0xa'));var crypto=require(_0x8151('0xb'));var jsforce=require(_0x8151('0xc'));var deskjs=require(_0x8151('0xd'));var toCsv=require(_0x8151('0xe'));var querystring=require('querystring');var Papa=require(_0x8151('0xf'));var Redis=require(_0x8151('0x10'));var authService=require(_0x8151('0x11'));var qs=require(_0x8151('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8151('0x13'));var logger=require(_0x8151('0x14'))(_0x8151('0x15'));var utils=require(_0x8151('0x16'));var config=require(_0x8151('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8151('0x18'))['db'];function respondWithStatusCode(_0x3da23e,_0x57e5d2){_0x57e5d2=_0x57e5d2||0xcc;return function(_0x292850){if(_0x292850){return _0x3da23e['sendStatus'](_0x57e5d2);}return _0x3da23e['status'](_0x57e5d2)[_0x8151('0x19')]();};}function respondWithResult(_0x297803,_0x362263){_0x362263=_0x362263||0xc8;return function(_0x45a780){if(_0x45a780){return _0x297803[_0x8151('0x1a')](_0x362263)[_0x8151('0x1b')](_0x45a780);}};}function respondWithFilteredResult(_0x253c57,_0x2275d8){return function(_0x2a4797){if(_0x2a4797){var _0x21d85d=typeof _0x2275d8['offset']===_0x8151('0x1c')&&typeof _0x2275d8['limit']===_0x8151('0x1c');var _0x4cac27=_0x2a4797[_0x8151('0x1d')];var _0x21cff5=_0x21d85d?0x0:_0x2275d8['offset'];var _0xba638f=_0x21d85d?_0x2a4797[_0x8151('0x1d')]:_0x2275d8[_0x8151('0x1e')]+_0x2275d8[_0x8151('0x1f')];var _0x34b20d;if(_0xba638f>=_0x4cac27){_0xba638f=_0x4cac27;_0x34b20d=0xc8;}else{_0x34b20d=0xce;}_0x253c57[_0x8151('0x1a')](_0x34b20d);return _0x253c57[_0x8151('0x20')](_0x8151('0x21'),_0x21cff5+'-'+_0xba638f+'/'+_0x4cac27)[_0x8151('0x1b')](_0x2a4797);}return null;};}function patchUpdates(_0x258778){return function(_0x480f40){try{jsonpatch[_0x8151('0x22')](_0x480f40,_0x258778,!![]);}catch(_0x4c25fc){return BPromise['reject'](_0x4c25fc);}return _0x480f40['save']();};}function saveUpdates(_0x32610f,_0xd8feb1){return function(_0x121ca6){if(_0x121ca6){return _0x121ca6[_0x8151('0x23')](_0x32610f)[_0x8151('0x24')](function(_0x1da34a){return _0x1da34a;});}return null;};}function removeEntity(_0x5842a0,_0x38eb7d){return function(_0x3d96c5){if(_0x3d96c5){return _0x3d96c5[_0x8151('0x25')]()[_0x8151('0x24')](function(){_0x5842a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9450,_0x4b9d5d){return function(_0xf24571){if(!_0xf24571){_0x2d9450[_0x8151('0x26')](0x194);}return _0xf24571;};}function handleError(_0x1959c9,_0x5177d2){_0x5177d2=_0x5177d2||0x1f4;return function(_0x57aeb5){logger['error'](_0x57aeb5['stack']);if(_0x57aeb5[_0x8151('0x27')]){delete _0x57aeb5[_0x8151('0x27')];}_0x1959c9[_0x8151('0x1a')](_0x5177d2)[_0x8151('0x28')](_0x57aeb5);};}exports[_0x8151('0x29')]=function(_0x34bb4b,_0x50b778){var _0x4ddf99={},_0x49aab3={},_0x166b30={'count':0x0,'rows':[]};var _0x50abb0=_['map'](db[_0x8151('0x2a')][_0x8151('0x2b')],function(_0x5da1fc){return{'name':_0x5da1fc['fieldName'],'type':_0x5da1fc[_0x8151('0x2c')][_0x8151('0x2d')]};});_0x49aab3[_0x8151('0x2e')]=_[_0x8151('0x2f')](_0x50abb0,_0x8151('0x27'));_0x49aab3[_0x8151('0x30')]=_['keys'](_0x34bb4b[_0x8151('0x30')]);_0x49aab3['filters']=_[_0x8151('0x31')](_0x49aab3['model'],_0x49aab3[_0x8151('0x30')]);_0x4ddf99[_0x8151('0x32')]=_[_0x8151('0x31')](_0x49aab3[_0x8151('0x2e')],qs[_0x8151('0x33')](_0x34bb4b[_0x8151('0x30')][_0x8151('0x33')]));_0x4ddf99[_0x8151('0x32')]=_0x4ddf99[_0x8151('0x32')][_0x8151('0x34')]?_0x4ddf99[_0x8151('0x32')]:_0x49aab3[_0x8151('0x2e')];if(!_0x34bb4b[_0x8151('0x30')]['hasOwnProperty'](_0x8151('0x35'))){_0x4ddf99[_0x8151('0x1f')]=qs[_0x8151('0x1f')](_0x34bb4b[_0x8151('0x30')][_0x8151('0x1f')]);_0x4ddf99[_0x8151('0x1e')]=qs[_0x8151('0x1e')](_0x34bb4b['query']['offset']);}_0x4ddf99[_0x8151('0x36')]=qs['sort'](_0x34bb4b['query'][_0x8151('0x37')]);_0x4ddf99[_0x8151('0x38')]=qs[_0x8151('0x39')](_[_0x8151('0x3a')](_0x34bb4b['query'],_0x49aab3[_0x8151('0x39')]),_0x50abb0);if(_0x34bb4b['query'][_0x8151('0x3b')]){_0x4ddf99[_0x8151('0x38')]=_[_0x8151('0x3c')](_0x4ddf99[_0x8151('0x38')],{'$or':_[_0x8151('0x2f')](_0x50abb0,function(_0x246b1f){if(_0x246b1f[_0x8151('0x2c')]!=='VIRTUAL'){var _0xf4739f={};_0xf4739f[_0x246b1f[_0x8151('0x27')]]={'$like':'%'+_0x34bb4b[_0x8151('0x30')][_0x8151('0x3b')]+'%'};return _0xf4739f;}})});}_0x4ddf99=_[_0x8151('0x3c')]({},_0x4ddf99,_0x34bb4b[_0x8151('0x3d')]);var _0x4639ec={'where':_0x4ddf99[_0x8151('0x38')]};return db[_0x8151('0x2a')][_0x8151('0x1d')](_0x4639ec)[_0x8151('0x24')](function(_0x22525f){_0x166b30[_0x8151('0x1d')]=_0x22525f;if(_0x34bb4b[_0x8151('0x30')][_0x8151('0x3e')]){_0x4ddf99['include']=[{'all':!![]}];}return db[_0x8151('0x2a')][_0x8151('0x3f')](_0x4ddf99);})[_0x8151('0x24')](function(_0x2a76bf){_0x166b30[_0x8151('0x40')]=_0x2a76bf;return _0x166b30;})['then'](respondWithFilteredResult(_0x50b778,_0x4ddf99))[_0x8151('0x41')](handleError(_0x50b778,null));};exports[_0x8151('0x42')]=function(_0x40883b,_0x58cdec){var _0x419cd9={'raw':!![],'where':{'id':_0x40883b['params']['id']}},_0x3f21ec={};_0x3f21ec['model']=_[_0x8151('0x43')](db[_0x8151('0x2a')][_0x8151('0x2b')]);_0x3f21ec['query']=_['keys'](_0x40883b[_0x8151('0x30')]);_0x3f21ec[_0x8151('0x39')]=_['intersection'](_0x3f21ec[_0x8151('0x2e')],_0x3f21ec[_0x8151('0x30')]);_0x419cd9[_0x8151('0x32')]=_['intersection'](_0x3f21ec['model'],qs[_0x8151('0x33')](_0x40883b['query'][_0x8151('0x33')]));_0x419cd9[_0x8151('0x32')]=_0x419cd9[_0x8151('0x32')][_0x8151('0x34')]?_0x419cd9[_0x8151('0x32')]:_0x3f21ec['model'];if(_0x40883b[_0x8151('0x30')][_0x8151('0x3e')]){_0x419cd9[_0x8151('0x44')]=[{'all':!![]}];}_0x419cd9=_['merge']({},_0x419cd9,_0x40883b['options']);return db[_0x8151('0x2a')]['find'](_0x419cd9)[_0x8151('0x24')](handleEntityNotFound(_0x58cdec,null))['then'](respondWithResult(_0x58cdec,null))[_0x8151('0x41')](handleError(_0x58cdec,null));};exports[_0x8151('0x45')]=function(_0x2a3d65,_0x173bf9){return db[_0x8151('0x2a')]['create'](_0x2a3d65[_0x8151('0x46')],{})[_0x8151('0x24')](respondWithResult(_0x173bf9,0xc9))[_0x8151('0x41')](handleError(_0x173bf9,null));};exports[_0x8151('0x23')]=function(_0x3b0548,_0x4dadab){if(_0x3b0548[_0x8151('0x46')]['id']){delete _0x3b0548[_0x8151('0x46')]['id'];}return db[_0x8151('0x2a')][_0x8151('0x47')]({'where':{'id':_0x3b0548[_0x8151('0x48')]['id']}})[_0x8151('0x24')](handleEntityNotFound(_0x4dadab,null))[_0x8151('0x24')](saveUpdates(_0x3b0548[_0x8151('0x46')],null))[_0x8151('0x24')](respondWithResult(_0x4dadab,null))['catch'](handleError(_0x4dadab,null));};exports['destroy']=function(_0x388b85,_0x23f2f4){return db[_0x8151('0x2a')][_0x8151('0x47')]({'where':{'id':_0x388b85[_0x8151('0x48')]['id']}})[_0x8151('0x24')](handleEntityNotFound(_0x23f2f4,null))[_0x8151('0x24')](removeEntity(_0x23f2f4,null))[_0x8151('0x41')](handleError(_0x23f2f4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4801593..508e773 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 _0x2b50=['exports','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x30a4c7,_0x173590){var _0x5603c2=function(_0x210301){while(--_0x210301){_0x30a4c7['push'](_0x30a4c7['shift']());}};_0x5603c2(++_0x173590);}(_0x2b50,0x68));var _0x02b5=function(_0x29cdf4,_0x24bbde){_0x29cdf4=_0x29cdf4-0x0;var _0x1ec29a=_0x2b50[_0x29cdf4];return _0x1ec29a;};'use strict';var _=require(_0x02b5('0x0'));var util=require('util');var logger=require(_0x02b5('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x02b5('0x2'));var fs=require('fs');var path=require(_0x02b5('0x3'));var rimraf=require(_0x02b5('0x4'));var config=require(_0x02b5('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x02b5('0x6')]=function(_0x1670e0,_0x5ac1d1){return _0x1670e0['define']('FreshsalesField',attributes,{'tableName':_0x02b5('0x7'),'paranoid':![],'indexes':[{'name':_0x02b5('0x8'),'fields':[_0x02b5('0x9'),_0x02b5('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa94=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','FieldId','lodash'];(function(_0xfc8c81,_0xe955f9){var _0x5ce3c4=function(_0xd1202b){while(--_0xd1202b){_0xfc8c81['push'](_0xfc8c81['shift']());}};_0x5ce3c4(++_0xe955f9);}(_0xfa94,0xef));var _0x4fa9=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0xfa94[_0xae282f];return _0x5f46d4;};'use strict';var _=require(_0x4fa9('0x0'));var util=require('util');var logger=require(_0x4fa9('0x1'))('api');var moment=require(_0x4fa9('0x2'));var BPromise=require(_0x4fa9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa9('0x4'));var rimraf=require(_0x4fa9('0x5'));var config=require(_0x4fa9('0x6'));var attributes=require(_0x4fa9('0x7'));module[_0x4fa9('0x8')]=function(_0x460a55,_0x3b703f){return _0x460a55['define'](_0x4fa9('0x9'),attributes,{'tableName':_0x4fa9('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x4fa9('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 394bd63..196f8e3 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 _0x46ed=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1a38aa,_0x131e6d){var _0x747c22=function(_0x31b3b4){while(--_0x31b3b4){_0x1a38aa['push'](_0x1a38aa['shift']());}};_0x747c22(++_0x131e6d);}(_0x5496,0x175));var _0x6549=function(_0x634e7d,_0x4858d2){_0x634e7d=_0x634e7d-0x0;var _0x32c336=_0x5496[_0x634e7d];return _0x32c336;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b91b2c5..0ff9d14 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x47c132,_0x5c8607){var _0x81ea7f=function(_0x413b25){while(--_0x413b25){_0x47c132['push'](_0x47c132['shift']());}};_0x81ea7f(++_0x5c8607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5b8a79,_0x1680a5){var _0x453526=function(_0x39b3dc){while(--_0x39b3dc){_0x5b8a79['push'](_0x5b8a79['shift']());}};_0x453526(++_0x1680a5);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ec39cf2..186e8fb 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 _0x2ffe=['integrationTab','exports','STRING','username','ENUM'];(function(_0x5baf1d,_0x23171f){var _0x542020=function(_0x1c4995){while(--_0x1c4995){_0x5baf1d['push'](_0x5baf1d['shift']());}};_0x542020(++_0x23171f);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x457979,_0x55b4e3){_0x457979=_0x457979-0x0;var _0x99b3ff=_0x2ffe[_0x457979];return _0x99b3ff;};'use strict';var Sequelize=require('sequelize');module[_0xe2ff('0x0')]={'name':{'type':Sequelize[_0xe2ff('0x1')]},'description':{'type':Sequelize[_0xe2ff('0x1')]},'username':{'type':Sequelize[_0xe2ff('0x1')],'unique':_0xe2ff('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe2ff('0x1')]},'clientId':{'type':Sequelize[_0xe2ff('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2ff('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe2ff('0x3')](_0xe2ff('0x4'),'newTab'),'defaultValue':_0xe2ff('0x4')}}; \ No newline at end of file +var _0xb6ff=['exports','STRING','username','integrationTab','newTab','sequelize'];(function(_0xdff7,_0x48a2fa){var _0x4c7c27=function(_0x1c9102){while(--_0x1c9102){_0xdff7['push'](_0xdff7['shift']());}};_0x4c7c27(++_0x48a2fa);}(_0xb6ff,0x185));var _0xfb6f=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xb6ff[_0x38fb8b];return _0x1ec681;};'use strict';var Sequelize=require(_0xfb6f('0x0'));module[_0xfb6f('0x1')]={'name':{'type':Sequelize[_0xfb6f('0x2')]},'description':{'type':Sequelize[_0xfb6f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xfb6f('0x3')},'remoteUri':{'type':Sequelize[_0xfb6f('0x2')]},'password':{'type':Sequelize[_0xfb6f('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xfb6f('0x2')]},'securityToken':{'type':Sequelize[_0xfb6f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfb6f('0x4'),_0xfb6f('0x5')),'defaultValue':_0xfb6f('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 50385e5..d225312 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 _0xf144=['send','index','map','SalesforceAccount','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','boolean','true','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','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','end','status','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','name'];(function(_0x479c83,_0x9af9bb){var _0x248ca6=function(_0x3e2990){while(--_0x3e2990){_0x479c83['push'](_0x479c83['shift']());}};_0x248ca6(++_0x9af9bb);}(_0xf144,0x158));var _0x4f14=function(_0x410e4e,_0x54f0ad){_0x410e4e=_0x410e4e-0x0;var _0x13e214=_0xf144[_0x410e4e];return _0x13e214;};'use strict';var emlformat=require(_0x4f14('0x0'));var rimraf=require(_0x4f14('0x1'));var zipdir=require(_0x4f14('0x2'));var jsonpatch=require(_0x4f14('0x3'));var rp=require(_0x4f14('0x4'));var moment=require(_0x4f14('0x5'));var BPromise=require(_0x4f14('0x6'));var Mustache=require(_0x4f14('0x7'));var util=require('util');var path=require(_0x4f14('0x8'));var sox=require(_0x4f14('0x9'));var csv=require(_0x4f14('0xa'));var ejs=require(_0x4f14('0xb'));var fs=require('fs');var fs_extra=require(_0x4f14('0xc'));var _=require('lodash');var squel=require(_0x4f14('0xd'));var crypto=require(_0x4f14('0xe'));var jsforce=require(_0x4f14('0xf'));var deskjs=require(_0x4f14('0x10'));var toCsv=require(_0x4f14('0xa'));var querystring=require('querystring');var Papa=require(_0x4f14('0x11'));var Redis=require(_0x4f14('0x12'));var authService=require(_0x4f14('0x13'));var qs=require(_0x4f14('0x14'));var as=require(_0x4f14('0x15'));var hardwareService=require(_0x4f14('0x16'));var logger=require('../../config/logger')(_0x4f14('0x17'));var utils=require(_0x4f14('0x18'));var config=require(_0x4f14('0x19'));var licenseUtil=require(_0x4f14('0x1a'));var db=require(_0x4f14('0x1b'))['db'];var integrations=require(_0x4f14('0x1c'));function respondWithStatusCode(_0x34312e,_0x1a6336){_0x1a6336=_0x1a6336||0xcc;return function(_0x12c46f){if(_0x12c46f){return _0x34312e[_0x4f14('0x1d')](_0x1a6336);}return _0x34312e['status'](_0x1a6336)[_0x4f14('0x1e')]();};}function respondWithResult(_0x245516,_0xd0c2e5){_0xd0c2e5=_0xd0c2e5||0xc8;return function(_0xead28d){if(_0xead28d){return _0x245516[_0x4f14('0x1f')](_0xd0c2e5)['json'](_0xead28d);}};}function respondWithFilteredResult(_0x2be772,_0x2fde3b){return function(_0x11d216){if(_0x11d216){var _0xb5857c=typeof _0x2fde3b[_0x4f14('0x20')]===_0x4f14('0x21')&&typeof _0x2fde3b['limit']===_0x4f14('0x21');var _0x5c2973=_0x11d216[_0x4f14('0x22')];var _0x2973ab=_0xb5857c?0x0:_0x2fde3b[_0x4f14('0x20')];var _0x4fb5c7=_0xb5857c?_0x11d216['count']:_0x2fde3b[_0x4f14('0x20')]+_0x2fde3b['limit'];var _0x4bada3;if(_0x4fb5c7>=_0x5c2973){_0x4fb5c7=_0x5c2973;_0x4bada3=0xc8;}else{_0x4bada3=0xce;}_0x2be772[_0x4f14('0x1f')](_0x4bada3);return _0x2be772[_0x4f14('0x23')](_0x4f14('0x24'),_0x2973ab+'-'+_0x4fb5c7+'/'+_0x5c2973)['json'](_0x11d216);}return null;};}function patchUpdates(_0x273a9a){return function(_0x2a09af){try{jsonpatch[_0x4f14('0x25')](_0x2a09af,_0x273a9a,!![]);}catch(_0x141d21){return BPromise[_0x4f14('0x26')](_0x141d21);}return _0x2a09af[_0x4f14('0x27')]();};}function saveUpdates(_0x18f596,_0x36d8fe){return function(_0x1dc9bb){if(_0x1dc9bb){return _0x1dc9bb['update'](_0x18f596)[_0x4f14('0x28')](function(_0x463b9d){return _0x463b9d;});}return null;};}function removeEntity(_0x33cdfd,_0x26551d){return function(_0x19d98c){if(_0x19d98c){return _0x19d98c['destroy']()[_0x4f14('0x28')](function(){_0x33cdfd['status'](0xcc)[_0x4f14('0x1e')]();});}};}function handleEntityNotFound(_0x1c730d,_0x46b8cf){return function(_0x59bb91){if(!_0x59bb91){_0x1c730d[_0x4f14('0x1d')](0x194);}return _0x59bb91;};}function handleError(_0x2b15d4,_0x5d0ac2){_0x5d0ac2=_0x5d0ac2||0x1f4;return function(_0x33bcb5){logger[_0x4f14('0x29')](_0x33bcb5['stack']);if(_0x33bcb5[_0x4f14('0x2a')]){delete _0x33bcb5[_0x4f14('0x2a')];}_0x2b15d4[_0x4f14('0x1f')](_0x5d0ac2)[_0x4f14('0x2b')](_0x33bcb5);};}exports[_0x4f14('0x2c')]=function(_0x10fab1,_0x399486){var _0x3db829={},_0x183394={},_0x1d1922={'count':0x0,'rows':[]};var _0x2620f1=_[_0x4f14('0x2d')](db[_0x4f14('0x2e')][_0x4f14('0x2f')],function(_0x3962a0){return{'name':_0x3962a0['fieldName'],'type':_0x3962a0[_0x4f14('0x30')]['key']};});_0x183394['model']=_[_0x4f14('0x2d')](_0x2620f1,'name');_0x183394['query']=_[_0x4f14('0x31')](_0x10fab1[_0x4f14('0x32')]);_0x183394[_0x4f14('0x33')]=_[_0x4f14('0x34')](_0x183394[_0x4f14('0x35')],_0x183394[_0x4f14('0x32')]);_0x3db829[_0x4f14('0x36')]=_[_0x4f14('0x34')](_0x183394['model'],qs[_0x4f14('0x37')](_0x10fab1[_0x4f14('0x32')]['fields']));_0x3db829[_0x4f14('0x36')]=_0x3db829[_0x4f14('0x36')][_0x4f14('0x38')]?_0x3db829[_0x4f14('0x36')]:_0x183394['model'];if(!_0x10fab1['query']['hasOwnProperty'](_0x4f14('0x39'))){_0x3db829[_0x4f14('0x3a')]=qs['limit'](_0x10fab1[_0x4f14('0x32')]['limit']);_0x3db829[_0x4f14('0x20')]=qs[_0x4f14('0x20')](_0x10fab1['query'][_0x4f14('0x20')]);}_0x3db829[_0x4f14('0x3b')]=qs['sort'](_0x10fab1[_0x4f14('0x32')][_0x4f14('0x3c')]);_0x3db829[_0x4f14('0x3d')]=qs['filters'](_[_0x4f14('0x3e')](_0x10fab1[_0x4f14('0x32')],_0x183394[_0x4f14('0x33')]),_0x2620f1);if(_0x10fab1['query'][_0x4f14('0x3f')]){_0x3db829[_0x4f14('0x3d')]=_[_0x4f14('0x40')](_0x3db829[_0x4f14('0x3d')],{'$or':_['map'](_0x2620f1,function(_0x14115e){if(_0x14115e[_0x4f14('0x30')]!==_0x4f14('0x41')){var _0x1f0f24={};_0x1f0f24[_0x14115e['name']]={'$like':'%'+_0x10fab1[_0x4f14('0x32')][_0x4f14('0x3f')]+'%'};return _0x1f0f24;}})});}_0x3db829=_[_0x4f14('0x40')]({},_0x3db829,_0x10fab1['options']);var _0x4d4821={'where':_0x3db829[_0x4f14('0x3d')]};return db[_0x4f14('0x2e')][_0x4f14('0x22')](_0x4d4821)['then'](function(_0x48dcc0){_0x1d1922[_0x4f14('0x22')]=_0x48dcc0;if(_0x10fab1[_0x4f14('0x32')][_0x4f14('0x42')]){_0x3db829[_0x4f14('0x43')]=[{'all':!![]}];}return db[_0x4f14('0x2e')][_0x4f14('0x44')](_0x3db829);})[_0x4f14('0x28')](function(_0x24ca44){_0x1d1922[_0x4f14('0x45')]=_0x24ca44;return _0x1d1922;})[_0x4f14('0x28')](respondWithFilteredResult(_0x399486,_0x3db829))[_0x4f14('0x46')](handleError(_0x399486,null));};exports[_0x4f14('0x47')]=function(_0x4bf791,_0x4b7d8c){var _0x179fef={'raw':![],'where':{'id':_0x4bf791[_0x4f14('0x48')]['id']}},_0x522a04={};_0x522a04[_0x4f14('0x35')]=_['keys'](db[_0x4f14('0x2e')][_0x4f14('0x2f')]);_0x522a04[_0x4f14('0x32')]=_[_0x4f14('0x31')](_0x4bf791[_0x4f14('0x32')]);_0x522a04[_0x4f14('0x33')]=_[_0x4f14('0x34')](_0x522a04['model'],_0x522a04['query']);_0x179fef[_0x4f14('0x36')]=_[_0x4f14('0x34')](_0x522a04[_0x4f14('0x35')],qs[_0x4f14('0x37')](_0x4bf791['query']['fields']));_0x179fef[_0x4f14('0x36')]=_0x179fef['attributes'][_0x4f14('0x38')]?_0x179fef[_0x4f14('0x36')]:_0x522a04[_0x4f14('0x35')];if(_0x4bf791['query']['includeAll']){_0x179fef[_0x4f14('0x43')]=[{'all':!![]}];}_0x179fef=_['merge']({},_0x179fef,_0x4bf791[_0x4f14('0x49')]);return db[_0x4f14('0x2e')][_0x4f14('0x4a')](_0x179fef)['then'](handleEntityNotFound(_0x4b7d8c,null))['then'](respondWithResult(_0x4b7d8c,null))[_0x4f14('0x46')](handleError(_0x4b7d8c,null));};exports[_0x4f14('0x4b')]=function(_0x2688c6,_0x5d6768){return db[_0x4f14('0x2e')][_0x4f14('0x4b')](_0x2688c6[_0x4f14('0x4c')],{})['then'](respondWithResult(_0x5d6768,0xc9))['catch'](handleError(_0x5d6768,null));};exports['update']=function(_0x1c7908,_0x74a955){if(_0x1c7908[_0x4f14('0x4c')]['id']){delete _0x1c7908[_0x4f14('0x4c')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x1c7908[_0x4f14('0x48')]['id']}})[_0x4f14('0x28')](handleEntityNotFound(_0x74a955,null))['then'](saveUpdates(_0x1c7908[_0x4f14('0x4c')],null))[_0x4f14('0x28')](respondWithResult(_0x74a955,null))['catch'](handleError(_0x74a955,null));};exports[_0x4f14('0x4d')]=function(_0x115322,_0x4efe7e){return db[_0x4f14('0x2e')][_0x4f14('0x4a')]({'where':{'id':_0x115322[_0x4f14('0x48')]['id']}})[_0x4f14('0x28')](handleEntityNotFound(_0x4efe7e,null))[_0x4f14('0x28')](removeEntity(_0x4efe7e,null))[_0x4f14('0x46')](handleError(_0x4efe7e,null));};exports[_0x4f14('0x4e')]=function(_0x538ea2,_0x1be836,_0x33c925){var _0xb329c0={};var _0x4daaea={};var _0x5d7599;var _0x25343d;return db[_0x4f14('0x2e')][_0x4f14('0x4f')]({'where':{'id':_0x538ea2[_0x4f14('0x48')]['id']}})[_0x4f14('0x28')](handleEntityNotFound(_0x1be836,null))[_0x4f14('0x28')](function(_0x252f72){if(_0x252f72){_0x5d7599=_0x252f72;_0x4daaea[_0x4f14('0x35')]=_[_0x4f14('0x31')](db[_0x4f14('0x50')]['rawAttributes']);_0x4daaea['query']=_['keys'](_0x538ea2[_0x4f14('0x32')]);_0x4daaea[_0x4f14('0x33')]=_[_0x4f14('0x34')](_0x4daaea[_0x4f14('0x35')],_0x4daaea['query']);_0xb329c0['attributes']=_[_0x4f14('0x34')](_0x4daaea[_0x4f14('0x35')],qs[_0x4f14('0x37')](_0x538ea2[_0x4f14('0x32')][_0x4f14('0x37')]));_0xb329c0[_0x4f14('0x36')]=_0xb329c0[_0x4f14('0x36')][_0x4f14('0x38')]?_0xb329c0[_0x4f14('0x36')]:_0x4daaea[_0x4f14('0x35')];_0xb329c0[_0x4f14('0x3b')]=qs[_0x4f14('0x3c')](_0x538ea2[_0x4f14('0x32')]['sort']);_0xb329c0['where']=qs[_0x4f14('0x33')](_[_0x4f14('0x3e')](_0x538ea2[_0x4f14('0x32')],_0x4daaea[_0x4f14('0x33')]));if(_0x538ea2[_0x4f14('0x32')][_0x4f14('0x3f')]){_0xb329c0[_0x4f14('0x3d')]=_[_0x4f14('0x40')](_0xb329c0[_0x4f14('0x3d')],{'$or':_[_0x4f14('0x2d')](_0xb329c0['attributes'],function(_0x46e0d7){var _0x4f62ef={};_0x4f62ef[_0x46e0d7]={'$like':'%'+_0x538ea2[_0x4f14('0x32')]['filter']+'%'};return _0x4f62ef;})});}_0xb329c0=_[_0x4f14('0x40')]({},_0xb329c0,_0x538ea2[_0x4f14('0x49')]);return _0x5d7599[_0x4f14('0x4e')](_0xb329c0);}})['then'](function(_0x36b998){if(_0x36b998){_0x25343d=_0x36b998['length'];if(!_0x538ea2['query'][_0x4f14('0x51')]('nolimit')){_0xb329c0[_0x4f14('0x3a')]=qs[_0x4f14('0x3a')](_0x538ea2['query'][_0x4f14('0x3a')]);_0xb329c0[_0x4f14('0x20')]=qs[_0x4f14('0x20')](_0x538ea2[_0x4f14('0x32')][_0x4f14('0x20')]);}return _0x5d7599[_0x4f14('0x4e')](_0xb329c0);}})[_0x4f14('0x28')](function(_0x4d34ed){if(_0x4d34ed){return _0x4d34ed?{'count':_0x25343d,'rows':_0x4d34ed}:null;}})[_0x4f14('0x28')](respondWithResult(_0x1be836,null))[_0x4f14('0x46')](handleError(_0x1be836,null));};exports[_0x4f14('0x52')]=function(_0x3fea15,_0x38d6ca,_0x304451){if(_0x3fea15[_0x4f14('0x4c')]['id']){delete _0x3fea15[_0x4f14('0x4c')]['id'];}return db['SalesforceAccount'][_0x4f14('0x4f')]({'where':{'id':_0x3fea15[_0x4f14('0x48')]['id']}})[_0x4f14('0x28')](handleEntityNotFound(_0x38d6ca,null))[_0x4f14('0x28')](function(_0x4e402a){if(_0x4e402a){_0x3fea15[_0x4f14('0x4c')][_0x4f14('0x53')]=_0x4e402a['id'];_0x3fea15[_0x4f14('0x4c')]['Subjects']=integrations[_0x4f14('0x54')](_0x3fea15[_0x4f14('0x4c')][_0x4f14('0x55')],_0x3fea15[_0x4f14('0x4c')][_0x4f14('0x30')]);_0x3fea15[_0x4f14('0x4c')][_0x4f14('0x56')]=integrations[_0x4f14('0x57')](_0x3fea15[_0x4f14('0x4c')]['channel'],_0x3fea15['body'][_0x4f14('0x30')]);return db[_0x4f14('0x50')]['create'](_0x3fea15[_0x4f14('0x4c')],{'include':[{'model':db[_0x4f14('0x58')],'as':'Subjects'},{'model':db[_0x4f14('0x58')],'as':_0x4f14('0x56')}]});}return null;})[_0x4f14('0x28')](respondWithResult(_0x38d6ca,null))[_0x4f14('0x46')](handleError(_0x38d6ca,null));};exports[_0x4f14('0x59')]=function(_0x249090,_0x2c8782,_0x1a60e2){var _0x4edc2c;var _0x5402a8='';var _0x565bc3=_0x4f14('0x5a');return db[_0x4f14('0x2e')][_0x4f14('0x4f')]({'where':{'id':_0x249090[_0x4f14('0x48')]['id']},'attributes':['id',_0x4f14('0x5b'),_0x4f14('0x5c'),'clientSecret',_0x4f14('0x5d'),_0x4f14('0x5e'),_0x4f14('0x5f')]})[_0x4f14('0x28')](handleEntityNotFound(_0x2c8782,null))[_0x4f14('0x28')](function(_0x44bfa3){if(_0x44bfa3){_0x5402a8=_0x44bfa3[_0x4f14('0x5b')];var _0x40d778=_0x5402a8[_0x4f14('0x60')](-0x1);if(_0x40d778==='/'){_0x5402a8=_0x5402a8[_0x4f14('0x61')](0x0,_0x5402a8[_0x4f14('0x62')](_0x40d778));}_0x4edc2c=new jsforce[(_0x4f14('0x63'))]({'oauth2':{'loginUrl':_0x5402a8,'clientId':_0x44bfa3[_0x4f14('0x5c')],'clientSecret':_0x44bfa3['clientSecret']}});return _0x4edc2c[_0x4f14('0x64')](_0x44bfa3[_0x4f14('0x5d')],_0x44bfa3['password'][_0x4f14('0x65')](_0x44bfa3[_0x4f14('0x5f')]));}})['then'](function(_0x42d1f2){if(_0x42d1f2){if(!_[_0x4f14('0x66')](_0x249090['query'][_0x4f14('0x67')])){_0x565bc3=_0x249090[_0x4f14('0x32')][_0x4f14('0x67')];}return _0x4edc2c[_0x4f14('0x68')](_0x565bc3)[_0x4f14('0x69')]();}})[_0x4f14('0x28')](function(_0x5f1cef){var _0x9fed2a=[_0x4f14('0x6a'),_0x4f14('0x6b'),'IsReminderSet',_0x4f14('0x6c'),_0x4f14('0x6d'),_0x4f14('0x6e')];var _0x38813b=[_0x4f14('0x6f'),_0x4f14('0x70'),_0x4f14('0x71'),'boolean',_0x4f14('0x72'),'textarea',_0x4f14('0x73')];if(_0x5f1cef){_[_0x4f14('0x74')](_0x5f1cef['fields'],function(_0x434895){return _0x9fed2a['includes'](_0x434895[_0x4f14('0x2a')])||!_0x38813b[_0x4f14('0x75')](_0x434895[_0x4f14('0x30')]);});return{'count':_0x5f1cef[_0x4f14('0x37')]['length'],'rows':_['map'](_0x5f1cef['fields'],function(_0x238c6d){return{'id':_0x238c6d['name'],'name':_0x238c6d[_0x4f14('0x76')],'custom':_0x238c6d[_0x4f14('0x77')],'options':_0x238c6d[_0x4f14('0x78')][_0x4f14('0x38')]>0x0?_[_0x4f14('0x2d')](_0x238c6d[_0x4f14('0x78')],function(_0xe98b00){return{'name':_0xe98b00['label'],'value':_0xe98b00['value']};}):_0x238c6d[_0x4f14('0x30')]==_0x4f14('0x79')?[{'name':'True','value':_0x4f14('0x7a')},{'name':'False','value':_0x4f14('0x7b')}]:[]};})};}})[_0x4f14('0x28')](respondWithResult(_0x2c8782,null))[_0x4f14('0x46')](function(_0x2f7fb5){var _0x21b134=_0x249090[_0x4f14('0x32')][_0x4f14('0x7c')]?0x1f4:_0x2f7fb5['statusCode']||0x1f4;logger[_0x4f14('0x29')](_0x4f14('0x7d'),_0x4f14('0x59'),_0x21b134,JSON[_0x4f14('0x7e')](_0x2f7fb5));delete _0x2f7fb5['name'];if(_0x21b134===0x191){_0x21b134=0x190;}_0x2c8782['status'](_0x21b134)[_0x4f14('0x2b')](_0x249090['query'][_0x4f14('0x7c')]?{'message':_0x4f14('0x7f'),'statusCode':_0x2f7fb5[_0x4f14('0x80')]}:_0x2f7fb5);});}; \ No newline at end of file +var _0x1db0=['SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','clientId','clientSecret','username','password','slice','substring','Connection','login','concat','isNil','ticketType','describe','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','options'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x1db0,0x192));var _0x01db=function(_0x1eb402,_0x164f02){_0x1eb402=_0x1eb402-0x0;var _0x577f76=_0x1db0[_0x1eb402];return _0x577f76;};'use strict';var emlformat=require(_0x01db('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(_0x01db('0x1'));var Mustache=require(_0x01db('0x2'));var util=require(_0x01db('0x3'));var path=require(_0x01db('0x4'));var sox=require(_0x01db('0x5'));var csv=require(_0x01db('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01db('0x7'));var _=require(_0x01db('0x8'));var squel=require(_0x01db('0x9'));var crypto=require(_0x01db('0xa'));var jsforce=require(_0x01db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x01db('0x6'));var querystring=require(_0x01db('0xc'));var Papa=require(_0x01db('0xd'));var Redis=require(_0x01db('0xe'));var authService=require(_0x01db('0xf'));var qs=require(_0x01db('0x10'));var as=require(_0x01db('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01db('0x12'))(_0x01db('0x13'));var utils=require(_0x01db('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x01db('0x15'));var db=require(_0x01db('0x16'))['db'];var integrations=require(_0x01db('0x17'));function respondWithStatusCode(_0x4c3179,_0x25e3b5){_0x25e3b5=_0x25e3b5||0xcc;return function(_0x5c7202){if(_0x5c7202){return _0x4c3179['sendStatus'](_0x25e3b5);}return _0x4c3179[_0x01db('0x18')](_0x25e3b5)['end']();};}function respondWithResult(_0x43adcc,_0x27f448){_0x27f448=_0x27f448||0xc8;return function(_0xbeb22f){if(_0xbeb22f){return _0x43adcc['status'](_0x27f448)[_0x01db('0x19')](_0xbeb22f);}};}function respondWithFilteredResult(_0x17da13,_0x1ec7c3){return function(_0x3d9ae8){if(_0x3d9ae8){var _0x5535ff=typeof _0x1ec7c3[_0x01db('0x1a')]==='undefined'&&typeof _0x1ec7c3[_0x01db('0x1b')]===_0x01db('0x1c');var _0x584eaf=_0x3d9ae8['count'];var _0x22d141=_0x5535ff?0x0:_0x1ec7c3[_0x01db('0x1a')];var _0x595651=_0x5535ff?_0x3d9ae8[_0x01db('0x1d')]:_0x1ec7c3[_0x01db('0x1a')]+_0x1ec7c3[_0x01db('0x1b')];var _0x2ff836;if(_0x595651>=_0x584eaf){_0x595651=_0x584eaf;_0x2ff836=0xc8;}else{_0x2ff836=0xce;}_0x17da13['status'](_0x2ff836);return _0x17da13[_0x01db('0x1e')](_0x01db('0x1f'),_0x22d141+'-'+_0x595651+'/'+_0x584eaf)[_0x01db('0x19')](_0x3d9ae8);}return null;};}function patchUpdates(_0x1a1671){return function(_0x298cc4){try{jsonpatch[_0x01db('0x20')](_0x298cc4,_0x1a1671,!![]);}catch(_0x4b68a5){return BPromise[_0x01db('0x21')](_0x4b68a5);}return _0x298cc4[_0x01db('0x22')]();};}function saveUpdates(_0x2f1a2d,_0x4e35b6){return function(_0x10976d){if(_0x10976d){return _0x10976d[_0x01db('0x23')](_0x2f1a2d)[_0x01db('0x24')](function(_0x4abb91){return _0x4abb91;});}return null;};}function removeEntity(_0x228c55,_0x2d803e){return function(_0x429561){if(_0x429561){return _0x429561[_0x01db('0x25')]()['then'](function(){_0x228c55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c0a8,_0x2c59fc){return function(_0x125d83){if(!_0x125d83){_0x52c0a8[_0x01db('0x26')](0x194);}return _0x125d83;};}function handleError(_0x4d632a,_0x4f136e){_0x4f136e=_0x4f136e||0x1f4;return function(_0x52d76d){logger[_0x01db('0x27')](_0x52d76d['stack']);if(_0x52d76d[_0x01db('0x28')]){delete _0x52d76d[_0x01db('0x28')];}_0x4d632a[_0x01db('0x18')](_0x4f136e)[_0x01db('0x29')](_0x52d76d);};}exports[_0x01db('0x2a')]=function(_0x241ee7,_0xe9c4de){var _0xb4680d={},_0x2ca685={},_0x121c98={'count':0x0,'rows':[]};var _0x494f36=_['map'](db['SalesforceAccount'][_0x01db('0x2b')],function(_0x389a27){return{'name':_0x389a27[_0x01db('0x2c')],'type':_0x389a27[_0x01db('0x2d')]['key']};});_0x2ca685[_0x01db('0x2e')]=_['map'](_0x494f36,_0x01db('0x28'));_0x2ca685[_0x01db('0x2f')]=_[_0x01db('0x30')](_0x241ee7[_0x01db('0x2f')]);_0x2ca685[_0x01db('0x31')]=_['intersection'](_0x2ca685[_0x01db('0x2e')],_0x2ca685['query']);_0xb4680d[_0x01db('0x32')]=_[_0x01db('0x33')](_0x2ca685[_0x01db('0x2e')],qs[_0x01db('0x34')](_0x241ee7['query'][_0x01db('0x34')]));_0xb4680d[_0x01db('0x32')]=_0xb4680d[_0x01db('0x32')]['length']?_0xb4680d[_0x01db('0x32')]:_0x2ca685[_0x01db('0x2e')];if(!_0x241ee7[_0x01db('0x2f')]['hasOwnProperty'](_0x01db('0x35'))){_0xb4680d['limit']=qs[_0x01db('0x1b')](_0x241ee7[_0x01db('0x2f')][_0x01db('0x1b')]);_0xb4680d[_0x01db('0x1a')]=qs[_0x01db('0x1a')](_0x241ee7['query'][_0x01db('0x1a')]);}_0xb4680d[_0x01db('0x36')]=qs[_0x01db('0x37')](_0x241ee7[_0x01db('0x2f')][_0x01db('0x37')]);_0xb4680d[_0x01db('0x38')]=qs[_0x01db('0x31')](_[_0x01db('0x39')](_0x241ee7[_0x01db('0x2f')],_0x2ca685['filters']),_0x494f36);if(_0x241ee7[_0x01db('0x2f')][_0x01db('0x3a')]){_0xb4680d[_0x01db('0x38')]=_[_0x01db('0x3b')](_0xb4680d[_0x01db('0x38')],{'$or':_[_0x01db('0x3c')](_0x494f36,function(_0x7a61dd){if(_0x7a61dd[_0x01db('0x2d')]!=='VIRTUAL'){var _0x59fc1c={};_0x59fc1c[_0x7a61dd['name']]={'$like':'%'+_0x241ee7[_0x01db('0x2f')][_0x01db('0x3a')]+'%'};return _0x59fc1c;}})});}_0xb4680d=_[_0x01db('0x3b')]({},_0xb4680d,_0x241ee7[_0x01db('0x3d')]);var _0x5b29f2={'where':_0xb4680d[_0x01db('0x38')]};return db[_0x01db('0x3e')][_0x01db('0x1d')](_0x5b29f2)[_0x01db('0x24')](function(_0x265c4a){_0x121c98[_0x01db('0x1d')]=_0x265c4a;if(_0x241ee7['query'][_0x01db('0x3f')]){_0xb4680d[_0x01db('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x01db('0x41')](_0xb4680d);})[_0x01db('0x24')](function(_0x5f1530){_0x121c98[_0x01db('0x42')]=_0x5f1530;return _0x121c98;})['then'](respondWithFilteredResult(_0xe9c4de,_0xb4680d))[_0x01db('0x43')](handleError(_0xe9c4de,null));};exports[_0x01db('0x44')]=function(_0x1a8fc7,_0x4de24b){var _0x19f7e7={'raw':![],'where':{'id':_0x1a8fc7[_0x01db('0x45')]['id']}},_0x2c310f={};_0x2c310f['model']=_['keys'](db['SalesforceAccount'][_0x01db('0x2b')]);_0x2c310f[_0x01db('0x2f')]=_[_0x01db('0x30')](_0x1a8fc7[_0x01db('0x2f')]);_0x2c310f[_0x01db('0x31')]=_['intersection'](_0x2c310f['model'],_0x2c310f[_0x01db('0x2f')]);_0x19f7e7['attributes']=_[_0x01db('0x33')](_0x2c310f[_0x01db('0x2e')],qs['fields'](_0x1a8fc7[_0x01db('0x2f')][_0x01db('0x34')]));_0x19f7e7['attributes']=_0x19f7e7[_0x01db('0x32')][_0x01db('0x46')]?_0x19f7e7[_0x01db('0x32')]:_0x2c310f[_0x01db('0x2e')];if(_0x1a8fc7[_0x01db('0x2f')][_0x01db('0x3f')]){_0x19f7e7[_0x01db('0x40')]=[{'all':!![]}];}_0x19f7e7=_[_0x01db('0x3b')]({},_0x19f7e7,_0x1a8fc7[_0x01db('0x3d')]);return db[_0x01db('0x3e')][_0x01db('0x47')](_0x19f7e7)[_0x01db('0x24')](handleEntityNotFound(_0x4de24b,null))[_0x01db('0x24')](respondWithResult(_0x4de24b,null))['catch'](handleError(_0x4de24b,null));};exports['create']=function(_0x265160,_0xa12e1f){return db[_0x01db('0x3e')][_0x01db('0x48')](_0x265160['body'],{})[_0x01db('0x24')](respondWithResult(_0xa12e1f,0xc9))[_0x01db('0x43')](handleError(_0xa12e1f,null));};exports[_0x01db('0x23')]=function(_0x20f97a,_0x3ce1d3){if(_0x20f97a[_0x01db('0x49')]['id']){delete _0x20f97a[_0x01db('0x49')]['id'];}return db[_0x01db('0x3e')][_0x01db('0x47')]({'where':{'id':_0x20f97a[_0x01db('0x45')]['id']}})[_0x01db('0x24')](handleEntityNotFound(_0x3ce1d3,null))[_0x01db('0x24')](saveUpdates(_0x20f97a['body'],null))[_0x01db('0x24')](respondWithResult(_0x3ce1d3,null))['catch'](handleError(_0x3ce1d3,null));};exports[_0x01db('0x25')]=function(_0x49cfcf,_0x568375){return db['SalesforceAccount'][_0x01db('0x47')]({'where':{'id':_0x49cfcf['params']['id']}})[_0x01db('0x24')](handleEntityNotFound(_0x568375,null))[_0x01db('0x24')](removeEntity(_0x568375,null))[_0x01db('0x43')](handleError(_0x568375,null));};exports[_0x01db('0x4a')]=function(_0x34f0bf,_0x32f9a4,_0x2f0c75){var _0x138395={};var _0x1286d0={};var _0x230750;var _0xb9a226;return db[_0x01db('0x3e')][_0x01db('0x4b')]({'where':{'id':_0x34f0bf[_0x01db('0x45')]['id']}})[_0x01db('0x24')](handleEntityNotFound(_0x32f9a4,null))[_0x01db('0x24')](function(_0x3f534c){if(_0x3f534c){_0x230750=_0x3f534c;_0x1286d0['model']=_['keys'](db[_0x01db('0x4c')][_0x01db('0x2b')]);_0x1286d0[_0x01db('0x2f')]=_[_0x01db('0x30')](_0x34f0bf[_0x01db('0x2f')]);_0x1286d0[_0x01db('0x31')]=_[_0x01db('0x33')](_0x1286d0[_0x01db('0x2e')],_0x1286d0['query']);_0x138395['attributes']=_['intersection'](_0x1286d0[_0x01db('0x2e')],qs[_0x01db('0x34')](_0x34f0bf[_0x01db('0x2f')][_0x01db('0x34')]));_0x138395['attributes']=_0x138395[_0x01db('0x32')][_0x01db('0x46')]?_0x138395[_0x01db('0x32')]:_0x1286d0['model'];_0x138395[_0x01db('0x36')]=qs['sort'](_0x34f0bf[_0x01db('0x2f')][_0x01db('0x37')]);_0x138395[_0x01db('0x38')]=qs[_0x01db('0x31')](_[_0x01db('0x39')](_0x34f0bf['query'],_0x1286d0[_0x01db('0x31')]));if(_0x34f0bf['query']['filter']){_0x138395['where']=_[_0x01db('0x3b')](_0x138395[_0x01db('0x38')],{'$or':_['map'](_0x138395[_0x01db('0x32')],function(_0x4367da){var _0x5b62d9={};_0x5b62d9[_0x4367da]={'$like':'%'+_0x34f0bf['query'][_0x01db('0x3a')]+'%'};return _0x5b62d9;})});}_0x138395=_[_0x01db('0x3b')]({},_0x138395,_0x34f0bf[_0x01db('0x3d')]);return _0x230750[_0x01db('0x4a')](_0x138395);}})[_0x01db('0x24')](function(_0x28c374){if(_0x28c374){_0xb9a226=_0x28c374[_0x01db('0x46')];if(!_0x34f0bf[_0x01db('0x2f')][_0x01db('0x4d')](_0x01db('0x35'))){_0x138395['limit']=qs[_0x01db('0x1b')](_0x34f0bf[_0x01db('0x2f')]['limit']);_0x138395['offset']=qs[_0x01db('0x1a')](_0x34f0bf[_0x01db('0x2f')][_0x01db('0x1a')]);}return _0x230750[_0x01db('0x4a')](_0x138395);}})['then'](function(_0x121d98){if(_0x121d98){return _0x121d98?{'count':_0xb9a226,'rows':_0x121d98}:null;}})[_0x01db('0x24')](respondWithResult(_0x32f9a4,null))['catch'](handleError(_0x32f9a4,null));};exports[_0x01db('0x4e')]=function(_0x2105e7,_0x4c9b05,_0x4b2fe0){if(_0x2105e7[_0x01db('0x49')]['id']){delete _0x2105e7['body']['id'];}return db[_0x01db('0x3e')][_0x01db('0x4b')]({'where':{'id':_0x2105e7[_0x01db('0x45')]['id']}})[_0x01db('0x24')](handleEntityNotFound(_0x4c9b05,null))['then'](function(_0x216b73){if(_0x216b73){_0x2105e7['body'][_0x01db('0x4f')]=_0x216b73['id'];_0x2105e7['body'][_0x01db('0x50')]=integrations[_0x01db('0x51')](_0x2105e7['body'][_0x01db('0x52')],_0x2105e7[_0x01db('0x49')][_0x01db('0x2d')]);_0x2105e7[_0x01db('0x49')]['Descriptions']=integrations['getDescriptions'](_0x2105e7[_0x01db('0x49')][_0x01db('0x52')],_0x2105e7[_0x01db('0x49')][_0x01db('0x2d')]);return db['SalesforceConfiguration']['create'](_0x2105e7['body'],{'include':[{'model':db[_0x01db('0x53')],'as':_0x01db('0x50')},{'model':db['SalesforceField'],'as':_0x01db('0x54')}]});}return null;})['then'](respondWithResult(_0x4c9b05,null))['catch'](handleError(_0x4c9b05,null));};exports[_0x01db('0x55')]=function(_0x2c6295,_0x4b98c2,_0x4931b0){var _0x373419;var _0x346eda='';var _0x1b6559='Task';return db[_0x01db('0x3e')]['findOne']({'where':{'id':_0x2c6295[_0x01db('0x45')]['id']},'attributes':['id',_0x01db('0x56'),_0x01db('0x57'),_0x01db('0x58'),_0x01db('0x59'),_0x01db('0x5a'),'securityToken']})[_0x01db('0x24')](handleEntityNotFound(_0x4b98c2,null))[_0x01db('0x24')](function(_0x3b6ee0){if(_0x3b6ee0){_0x346eda=_0x3b6ee0['remoteUri'];var _0xd7857a=_0x346eda[_0x01db('0x5b')](-0x1);if(_0xd7857a==='/'){_0x346eda=_0x346eda[_0x01db('0x5c')](0x0,_0x346eda['lastIndexOf'](_0xd7857a));}_0x373419=new jsforce[(_0x01db('0x5d'))]({'oauth2':{'loginUrl':_0x346eda,'clientId':_0x3b6ee0[_0x01db('0x57')],'clientSecret':_0x3b6ee0[_0x01db('0x58')]}});return _0x373419[_0x01db('0x5e')](_0x3b6ee0['username'],_0x3b6ee0[_0x01db('0x5a')][_0x01db('0x5f')](_0x3b6ee0['securityToken']));}})[_0x01db('0x24')](function(_0x5ef350){if(_0x5ef350){if(!_[_0x01db('0x60')](_0x2c6295['query'][_0x01db('0x61')])){_0x1b6559=_0x2c6295[_0x01db('0x2f')][_0x01db('0x61')];}return _0x373419['sobject'](_0x1b6559)[_0x01db('0x62')]();}})[_0x01db('0x24')](function(_0x533631){var _0x439258=['OwnerId','ActivityDate',_0x01db('0x63'),_0x01db('0x64'),_0x01db('0x65'),'Description'];var _0x37cb7a=[_0x01db('0x66'),'int',_0x01db('0x67'),_0x01db('0x68'),_0x01db('0x69'),_0x01db('0x6a'),_0x01db('0x6b')];if(_0x533631){_['remove'](_0x533631[_0x01db('0x34')],function(_0x4fd25f){return _0x439258[_0x01db('0x6c')](_0x4fd25f[_0x01db('0x28')])||!_0x37cb7a[_0x01db('0x6c')](_0x4fd25f[_0x01db('0x2d')]);});return{'count':_0x533631[_0x01db('0x34')][_0x01db('0x46')],'rows':_[_0x01db('0x3c')](_0x533631['fields'],function(_0x1dcc8e){return{'id':_0x1dcc8e[_0x01db('0x28')],'name':_0x1dcc8e[_0x01db('0x6d')],'custom':_0x1dcc8e['custom'],'options':_0x1dcc8e['picklistValues'][_0x01db('0x46')]>0x0?_[_0x01db('0x3c')](_0x1dcc8e[_0x01db('0x6e')],function(_0x47c4f2){return{'name':_0x47c4f2[_0x01db('0x6d')],'value':_0x47c4f2[_0x01db('0x6f')]};}):_0x1dcc8e['type']==_0x01db('0x68')?[{'name':'True','value':'true'},{'name':'False','value':'false'}]:[]};})};}})[_0x01db('0x24')](respondWithResult(_0x4b98c2,null))[_0x01db('0x43')](function(_0x3fd684){var _0x44a4a1=_0x2c6295[_0x01db('0x2f')][_0x01db('0x70')]?0x1f4:_0x3fd684[_0x01db('0x71')]||0x1f4;logger['error'](_0x01db('0x72'),_0x01db('0x55'),_0x44a4a1,JSON['stringify'](_0x3fd684));delete _0x3fd684[_0x01db('0x28')];if(_0x44a4a1===0x191){_0x44a4a1=0x190;}_0x4b98c2[_0x01db('0x18')](_0x44a4a1)[_0x01db('0x29')](_0x2c6295[_0x01db('0x2f')][_0x01db('0x70')]?{'message':_0x01db('0x73'),'statusCode':_0x3fd684[_0x01db('0x71')]}:_0x3fd684);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5c44922..1e56339 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 _0xe347=['exports','define','SalesforceAccount','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x15c38e,_0x6679ac){var _0x3d8b32=function(_0x315ea7){while(--_0x315ea7){_0x15c38e['push'](_0x15c38e['shift']());}};_0x3d8b32(++_0x6679ac);}(_0xe347,0xac));var _0x7e34=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0xe347[_0x312abc];return _0x314298;};'use strict';var _=require(_0x7e34('0x0'));var util=require('util');var logger=require(_0x7e34('0x1'))('api');var moment=require(_0x7e34('0x2'));var BPromise=require(_0x7e34('0x3'));var rp=require(_0x7e34('0x4'));var fs=require('fs');var path=require(_0x7e34('0x5'));var rimraf=require(_0x7e34('0x6'));var config=require(_0x7e34('0x7'));var attributes=require(_0x7e34('0x8'));var integrations=require(_0x7e34('0x9'));module[_0x7e34('0xa')]=function(_0x1816bb,_0x489ec3){return _0x1816bb[_0x7e34('0xb')](_0x7e34('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f7=['bluebird','path','rimraf','../../config/environment','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x4a7145,_0x14c18b){var _0x9e46d5=function(_0x1602fe){while(--_0x1602fe){_0x4a7145['push'](_0x4a7145['shift']());}};_0x9e46d5(++_0x14c18b);}(_0x13f7,0x164));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var logger=require(_0x713f('0x2'))(_0x713f('0x3'));var moment=require('moment');var BPromise=require(_0x713f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x713f('0x5'));var rimraf=require(_0x713f('0x6'));var config=require(_0x713f('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x463eea,_0x2571f6){return _0x463eea['define']('SalesforceAccount',attributes,{'tableName':_0x713f('0x8'),'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 2c74882..60dbc7c 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 _0x9805=['SalesforceAccount,\x20%s,\x20%s','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1de3af,_0x53fbed){var _0x36f4f4=function(_0x151041){while(--_0x151041){_0x1de3af['push'](_0x1de3af['shift']());}};_0x36f4f4(++_0x53fbed);}(_0x9805,0x182));var _0x5980=function(_0x5a58c,_0xd87e09){_0x5a58c=_0x5a58c-0x0;var _0x415cd7=_0x9805[_0x5a58c];return _0x415cd7;};'use strict';var _=require('lodash');var util=require(_0x5980('0x0'));var moment=require(_0x5980('0x1'));var BPromise=require(_0x5980('0x2'));var rs=require(_0x5980('0x3'));var fs=require('fs');var Redis=require(_0x5980('0x4'));var db=require(_0x5980('0x5'))['db'];var utils=require(_0x5980('0x6'));var logger=require(_0x5980('0x7'))(_0x5980('0x8'));var config=require('../../config/environment');var jayson=require(_0x5980('0x9'));var client=jayson[_0x5980('0xa')][_0x5980('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2937a8,_0x4d7d5f,_0x5982a5){return new BPromise(function(_0x47da9d,_0x365e60){return client[_0x5980('0xc')](_0x2937a8,_0x5982a5)[_0x5980('0xd')](function(_0x3c7e3a){logger[_0x5980('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x4d7d5f,_0x5980('0xf'));logger[_0x5980('0x10')](_0x5980('0x11'),_0x4d7d5f,_0x5980('0xf'),JSON[_0x5980('0x12')](_0x3c7e3a));if(_0x3c7e3a[_0x5980('0x13')]){if(_0x3c7e3a[_0x5980('0x13')]['code']===0x1f4){logger[_0x5980('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4d7d5f,_0x3c7e3a[_0x5980('0x13')]['message']);return _0x365e60(_0x3c7e3a['error'][_0x5980('0x14')]);}logger[_0x5980('0x13')](_0x5980('0x15'),_0x4d7d5f,_0x3c7e3a['error']['message']);return _0x47da9d(_0x3c7e3a[_0x5980('0x13')]['message']);}else{logger[_0x5980('0xe')](_0x5980('0x15'),_0x4d7d5f,'request\x20sent');_0x47da9d(_0x3c7e3a[_0x5980('0x16')][_0x5980('0x14')]);}})[_0x5980('0x17')](function(_0x1568ed){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4d7d5f,_0x1568ed);_0x365e60(_0x1568ed);});});}exports['GetSalesforceAccount']=function(_0x42c851){var _0x4d18d4=this;return new Promise(function(_0x2aa99d,_0x5e4f25){return db[_0x5980('0x18')][_0x5980('0x19')]({'raw':_0x42c851[_0x5980('0x1a')]?_0x42c851[_0x5980('0x1a')][_0x5980('0x1b')]===undefined?!![]:![]:!![],'where':_0x42c851['options']?_0x42c851['options'][_0x5980('0x1c')]||null:null,'attributes':_0x42c851['options']?_0x42c851[_0x5980('0x1a')][_0x5980('0x1d')]||null:null,'limit':_0x42c851[_0x5980('0x1a')]?_0x42c851[_0x5980('0x1a')][_0x5980('0x1e')]||null:null,'include':_0x42c851[_0x5980('0x1a')]?_0x42c851[_0x5980('0x1a')][_0x5980('0x1f')]?_[_0x5980('0x20')](_0x42c851[_0x5980('0x1a')][_0x5980('0x1f')],function(_0x373216){return{'model':db[_0x373216[_0x5980('0x21')]],'as':_0x373216['as'],'attributes':_0x373216['attributes'],'include':_0x373216[_0x5980('0x1f')]?_['map'](_0x373216[_0x5980('0x1f')],function(_0x5e1a42){return{'model':db[_0x5e1a42['model']],'as':_0x5e1a42['as'],'attributes':_0x5e1a42['attributes'],'include':_0x5e1a42['include']?_[_0x5980('0x20')](_0x5e1a42['include'],function(_0x2f3632){return{'model':db[_0x2f3632[_0x5980('0x21')]],'as':_0x2f3632['as'],'attributes':_0x2f3632['attributes']};}):[]};}):[]};}):[]:[]})[_0x5980('0xd')](function(_0x57a973){logger[_0x5980('0xe')](_0x5980('0x22'),_0x42c851);logger[_0x5980('0x10')](_0x5980('0x22'),_0x42c851,JSON['stringify'](_0x57a973));_0x2aa99d(_0x57a973);})[_0x5980('0x17')](function(_0x2e4f0f){logger[_0x5980('0x13')]('GetSalesforceAccount',_0x2e4f0f[_0x5980('0x14')],_0x42c851);_0x5e4f25(_0x4d18d4['error'](0x1f4,_0x2e4f0f[_0x5980('0x14')]));});});};exports[_0x5980('0x23')]=function(_0x2f42ee){var _0x62d6d3=this;return new Promise(function(_0x3bbcc3,_0x3727cd){return db[_0x5980('0x18')][_0x5980('0x24')]({'raw':_0x2f42ee[_0x5980('0x1a')]?_0x2f42ee[_0x5980('0x1a')][_0x5980('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f42ee[_0x5980('0x1a')]?_0x2f42ee['options']['where']||null:null,'attributes':_0x2f42ee[_0x5980('0x1a')]?_0x2f42ee[_0x5980('0x1a')][_0x5980('0x1d')]||null:null,'include':_0x2f42ee['options']?_0x2f42ee[_0x5980('0x1a')][_0x5980('0x1f')]?_[_0x5980('0x20')](_0x2f42ee['options']['include'],function(_0x2578a6){return{'model':db[_0x2578a6[_0x5980('0x21')]],'as':_0x2578a6['as'],'attributes':_0x2578a6['attributes'],'include':_0x2578a6[_0x5980('0x1f')]?_['map'](_0x2578a6[_0x5980('0x1f')],function(_0x10cb72){return{'model':db[_0x10cb72[_0x5980('0x21')]],'as':_0x10cb72['as'],'attributes':_0x10cb72[_0x5980('0x1d')],'include':_0x10cb72[_0x5980('0x1f')]?_['map'](_0x10cb72[_0x5980('0x1f')],function(_0x21948f){return{'model':db[_0x21948f['model']],'as':_0x21948f['as'],'attributes':_0x21948f[_0x5980('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5980('0xd')](function(_0x3f9482){logger[_0x5980('0xe')](_0x5980('0x23'),_0x2f42ee);logger[_0x5980('0x10')]('ShowSalesforceAccount',_0x2f42ee,JSON[_0x5980('0x12')](_0x3f9482));_0x3bbcc3(_0x3f9482);})['catch'](function(_0x3b3c4a){logger[_0x5980('0x13')](_0x5980('0x23'),_0x3b3c4a[_0x5980('0x14')],_0x2f42ee);_0x3727cd(_0x62d6d3['error'](0x1f4,_0x3b3c4a[_0x5980('0x14')]));});});}; \ No newline at end of file +var _0x0dd1=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SalesforceAccount','findAll','raw','options','where','attributes','limit','map','include','model','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then'];(function(_0x4cd52f,_0x8c2529){var _0x30a576=function(_0x494974){while(--_0x494974){_0x4cd52f['push'](_0x4cd52f['shift']());}};_0x30a576(++_0x8c2529);}(_0x0dd1,0x16b));var _0x10dd=function(_0x25c662,_0x2a558f){_0x25c662=_0x25c662-0x0;var _0x1389a1=_0x0dd1[_0x25c662];return _0x1389a1;};'use strict';var _=require(_0x10dd('0x0'));var util=require(_0x10dd('0x1'));var moment=require('moment');var BPromise=require(_0x10dd('0x2'));var rs=require(_0x10dd('0x3'));var fs=require('fs');var Redis=require(_0x10dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10dd('0x5'));var config=require(_0x10dd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x10dd('0x7')][_0x10dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437fb1,_0x1ea058,_0x5eacee){return new BPromise(function(_0x5758c7,_0x59117e){return client[_0x10dd('0x9')](_0x437fb1,_0x5eacee)[_0x10dd('0xa')](function(_0x298452){logger['info'](_0x10dd('0xb'),_0x1ea058,_0x10dd('0xc'));logger[_0x10dd('0xd')](_0x10dd('0xe'),_0x1ea058,_0x10dd('0xc'),JSON[_0x10dd('0xf')](_0x298452));if(_0x298452[_0x10dd('0x10')]){if(_0x298452[_0x10dd('0x10')]['code']===0x1f4){logger['error'](_0x10dd('0xb'),_0x1ea058,_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);return _0x59117e(_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);}logger[_0x10dd('0x10')](_0x10dd('0xb'),_0x1ea058,_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);return _0x5758c7(_0x298452[_0x10dd('0x10')][_0x10dd('0x11')]);}else{logger[_0x10dd('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x1ea058,'request\x20sent');_0x5758c7(_0x298452[_0x10dd('0x13')]['message']);}})[_0x10dd('0x14')](function(_0x798d5d){logger[_0x10dd('0x10')](_0x10dd('0xb'),_0x1ea058,_0x798d5d);_0x59117e(_0x798d5d);});});}exports['GetSalesforceAccount']=function(_0x3ab5bf){var _0x1e077a=this;return new Promise(function(_0x59fc8c,_0x7c29ca){return db[_0x10dd('0x15')][_0x10dd('0x16')]({'raw':_0x3ab5bf['options']?_0x3ab5bf['options'][_0x10dd('0x17')]===undefined?!![]:![]:!![],'where':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x19')]||null:null,'attributes':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf['options'][_0x10dd('0x1a')]||null:null,'limit':_0x3ab5bf['options']?_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x1b')]||null:null,'include':_0x3ab5bf[_0x10dd('0x18')]?_0x3ab5bf['options']['include']?_[_0x10dd('0x1c')](_0x3ab5bf[_0x10dd('0x18')][_0x10dd('0x1d')],function(_0x140e40){return{'model':db[_0x140e40[_0x10dd('0x1e')]],'as':_0x140e40['as'],'attributes':_0x140e40[_0x10dd('0x1a')],'include':_0x140e40[_0x10dd('0x1d')]?_[_0x10dd('0x1c')](_0x140e40[_0x10dd('0x1d')],function(_0x8bfc8){return{'model':db[_0x8bfc8[_0x10dd('0x1e')]],'as':_0x8bfc8['as'],'attributes':_0x8bfc8[_0x10dd('0x1a')],'include':_0x8bfc8[_0x10dd('0x1d')]?_[_0x10dd('0x1c')](_0x8bfc8[_0x10dd('0x1d')],function(_0x4de749){return{'model':db[_0x4de749[_0x10dd('0x1e')]],'as':_0x4de749['as'],'attributes':_0x4de749['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x211106){logger[_0x10dd('0x12')](_0x10dd('0x1f'),_0x3ab5bf);logger[_0x10dd('0xd')](_0x10dd('0x1f'),_0x3ab5bf,JSON[_0x10dd('0xf')](_0x211106));_0x59fc8c(_0x211106);})[_0x10dd('0x14')](function(_0x20bc15){logger['error'](_0x10dd('0x1f'),_0x20bc15[_0x10dd('0x11')],_0x3ab5bf);_0x7c29ca(_0x1e077a[_0x10dd('0x10')](0x1f4,_0x20bc15[_0x10dd('0x11')]));});});};exports[_0x10dd('0x20')]=function(_0x3a6935){var _0xe018c8=this;return new Promise(function(_0x3bccab,_0xb2da9){return db[_0x10dd('0x15')][_0x10dd('0x21')]({'raw':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')][_0x10dd('0x17')]===undefined?!![]:![]:!![],'where':_0x3a6935[_0x10dd('0x18')]?_0x3a6935['options']['where']||null:null,'attributes':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')][_0x10dd('0x1a')]||null:null,'include':_0x3a6935[_0x10dd('0x18')]?_0x3a6935[_0x10dd('0x18')]['include']?_['map'](_0x3a6935[_0x10dd('0x18')][_0x10dd('0x1d')],function(_0x47e52a){return{'model':db[_0x47e52a['model']],'as':_0x47e52a['as'],'attributes':_0x47e52a[_0x10dd('0x1a')],'include':_0x47e52a[_0x10dd('0x1d')]?_['map'](_0x47e52a['include'],function(_0x3d8b53){return{'model':db[_0x3d8b53['model']],'as':_0x3d8b53['as'],'attributes':_0x3d8b53[_0x10dd('0x1a')],'include':_0x3d8b53['include']?_[_0x10dd('0x1c')](_0x3d8b53[_0x10dd('0x1d')],function(_0x67c773){return{'model':db[_0x67c773[_0x10dd('0x1e')]],'as':_0x67c773['as'],'attributes':_0x67c773[_0x10dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x10dd('0xa')](function(_0x31dcdd){logger[_0x10dd('0x12')](_0x10dd('0x20'),_0x3a6935);logger[_0x10dd('0xd')](_0x10dd('0x20'),_0x3a6935,JSON[_0x10dd('0xf')](_0x31dcdd));_0x3bccab(_0x31dcdd);})[_0x10dd('0x14')](function(_0x6d2e9){logger[_0x10dd('0x10')](_0x10dd('0x20'),_0x6d2e9[_0x10dd('0x11')],_0x3a6935);_0xb2da9(_0xe018c8[_0x10dd('0x10')](0x1f4,_0x6d2e9[_0x10dd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f0a7d23..fc36e8c 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x4de2fd,_0x32579){var _0xb0ac90=function(_0x141d8a){while(--_0x141d8a){_0x4de2fd['push'](_0x4de2fd['shift']());}};_0xb0ac90(++_0x32579);}(_0x2ef3,0xba));var _0x32ef=function(_0x12c344,_0x315279){_0x12c344=_0x12c344-0x0;var _0x48601c=_0x2ef3[_0x12c344];return _0x48601c;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +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(_0x58295a,_0x4bb914){var _0x4350ea=function(_0x2d864c){while(--_0x2d864c){_0x58295a['push'](_0x58295a['shift']());}};_0x4350ea(++_0x4bb914);}(_0x7a54,0x106));var _0x47a5=function(_0x13ece8,_0xdb9dcd){_0x13ece8=_0x13ece8-0x0;var _0x5ddcd3=_0x7a54[_0x13ece8];return _0x5ddcd3;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d5f0681..c24340d 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 _0xdecb=['exports','STRING','Task','Case','ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize'];(function(_0x235c4a,_0x1175d8){var _0x105721=function(_0x13873e){while(--_0x13873e){_0x235c4a['push'](_0x235c4a['shift']());}};_0x105721(++_0x1175d8);}(_0xdecb,0x8f));var _0xbdec=function(_0xe063c1,_0x2f5043){_0xe063c1=_0xe063c1-0x0;var _0x1275f6=_0xdecb[_0xe063c1];return _0x1275f6;};'use strict';var Sequelize=require(_0xbdec('0x0'));module[_0xbdec('0x1')]={'name':{'type':Sequelize[_0xbdec('0x2')]},'description':{'type':Sequelize[_0xbdec('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xbdec('0x3'),_0xbdec('0x4')),'defaultValue':_0xbdec('0x3')},'moduleSearch':{'type':Sequelize[_0xbdec('0x5')](_0xbdec('0x6'),_0xbdec('0x7'),_0xbdec('0x8'),_0xbdec('0x9'),_0xbdec('0xa')),'defaultValue':_0xbdec('0x6')},'moduleCreate':{'type':Sequelize[_0xbdec('0x5')](_0xbdec('0xb'),'contact',_0xbdec('0x8'),'account'),'defaultValue':_0xbdec('0x8')},'leadId':{'type':Sequelize[_0xbdec('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xbdec('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x720e=['Task','ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0xcbf5a,_0x182d9b){var _0x47553f=function(_0x10944c){while(--_0x10944c){_0xcbf5a['push'](_0xcbf5a['shift']());}};_0x47553f(++_0x182d9b);}(_0x720e,0x1cb));var _0xe720=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x720e[_0x567bcb];return _0x4eebc2;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'name':{'type':Sequelize[_0xe720('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe720('0x3'),'Case'),'defaultValue':_0xe720('0x3')},'moduleSearch':{'type':Sequelize[_0xe720('0x4')](_0xe720('0x5'),_0xe720('0x6'),_0xe720('0x7'),_0xe720('0x8'),_0xe720('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe720('0x4')](_0xe720('0xa'),'contact','lead','account'),'defaultValue':_0xe720('0x7')},'leadId':{'type':Sequelize[_0xe720('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe720('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xe720('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c46a6ff..13a3e16 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 _0x7d23=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','type','VIRTUAL','merge','options','SalesforceConfiguration','include','catch','show','keys','includeAll','create','body','update','find','params','getFields','findOne','SalesforceField','order','sort','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0xa57c50,_0x1c6754){var _0x2c55b4=function(_0x31122d){while(--_0x31122d){_0xa57c50['push'](_0xa57c50['shift']());}};_0x2c55b4(++_0x1c6754);}(_0x7d23,0x136));var _0x37d2=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x7d23[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x37d2('0x0'));var rimraf=require(_0x37d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37d2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x37d2('0x3'));var Mustache=require('mustache');var util=require(_0x37d2('0x4'));var path=require(_0x37d2('0x5'));var sox=require(_0x37d2('0x6'));var csv=require(_0x37d2('0x7'));var ejs=require(_0x37d2('0x8'));var fs=require('fs');var fs_extra=require(_0x37d2('0x9'));var _=require(_0x37d2('0xa'));var squel=require(_0x37d2('0xb'));var crypto=require('crypto');var jsforce=require(_0x37d2('0xc'));var deskjs=require(_0x37d2('0xd'));var toCsv=require(_0x37d2('0x7'));var querystring=require(_0x37d2('0xe'));var Papa=require(_0x37d2('0xf'));var Redis=require(_0x37d2('0x10'));var authService=require(_0x37d2('0x11'));var qs=require(_0x37d2('0x12'));var as=require(_0x37d2('0x13'));var hardwareService=require(_0x37d2('0x14'));var logger=require(_0x37d2('0x15'))(_0x37d2('0x16'));var utils=require(_0x37d2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x37d2('0x18'));var db=require(_0x37d2('0x19'))['db'];function respondWithStatusCode(_0x465b37,_0x2638c4){_0x2638c4=_0x2638c4||0xcc;return function(_0x1f6e8b){if(_0x1f6e8b){return _0x465b37[_0x37d2('0x1a')](_0x2638c4);}return _0x465b37[_0x37d2('0x1b')](_0x2638c4)[_0x37d2('0x1c')]();};}function respondWithResult(_0x4f4727,_0x3504de){_0x3504de=_0x3504de||0xc8;return function(_0x5dbd0f){if(_0x5dbd0f){return _0x4f4727[_0x37d2('0x1b')](_0x3504de)[_0x37d2('0x1d')](_0x5dbd0f);}};}function respondWithFilteredResult(_0x2814de,_0x523165){return function(_0x5eec52){if(_0x5eec52){var _0x10e9d3=typeof _0x523165[_0x37d2('0x1e')]===_0x37d2('0x1f')&&typeof _0x523165[_0x37d2('0x20')]==='undefined';var _0x41df19=_0x5eec52[_0x37d2('0x21')];var _0x58362c=_0x10e9d3?0x0:_0x523165[_0x37d2('0x1e')];var _0xddf05e=_0x10e9d3?_0x5eec52[_0x37d2('0x21')]:_0x523165[_0x37d2('0x1e')]+_0x523165[_0x37d2('0x20')];var _0x4f35c1;if(_0xddf05e>=_0x41df19){_0xddf05e=_0x41df19;_0x4f35c1=0xc8;}else{_0x4f35c1=0xce;}_0x2814de['status'](_0x4f35c1);return _0x2814de[_0x37d2('0x22')](_0x37d2('0x23'),_0x58362c+'-'+_0xddf05e+'/'+_0x41df19)[_0x37d2('0x1d')](_0x5eec52);}return null;};}function patchUpdates(_0xfb979a){return function(_0x73121c){try{jsonpatch[_0x37d2('0x24')](_0x73121c,_0xfb979a,!![]);}catch(_0xd927b){return BPromise[_0x37d2('0x25')](_0xd927b);}return _0x73121c[_0x37d2('0x26')]();};}function saveUpdates(_0x368478,_0x29e50c){return function(_0xc3d21d){if(_0xc3d21d){return _0xc3d21d['update'](_0x368478)[_0x37d2('0x27')](function(_0x43be8d){return _0x43be8d;});}return null;};}function removeEntity(_0x114fed,_0x207e02){return function(_0x46ea1d){if(_0x46ea1d){return _0x46ea1d[_0x37d2('0x28')]()['then'](function(){_0x114fed[_0x37d2('0x1b')](0xcc)[_0x37d2('0x1c')]();});}};}function handleEntityNotFound(_0x554431,_0x1947b2){return function(_0x449b28){if(!_0x449b28){_0x554431[_0x37d2('0x1a')](0x194);}return _0x449b28;};}function handleError(_0x48d160,_0x2a0d2d){_0x2a0d2d=_0x2a0d2d||0x1f4;return function(_0x25d938){logger['error'](_0x25d938['stack']);if(_0x25d938[_0x37d2('0x29')]){delete _0x25d938[_0x37d2('0x29')];}_0x48d160['status'](_0x2a0d2d)[_0x37d2('0x2a')](_0x25d938);};}exports[_0x37d2('0x2b')]=function(_0x5a5e8b,_0x3323bf){var _0x3a1cec={},_0x411c6f={},_0xe460c={'count':0x0,'rows':[]};var _0x401fca=_[_0x37d2('0x2c')](db['SalesforceConfiguration'][_0x37d2('0x2d')],function(_0x384bbe){return{'name':_0x384bbe['fieldName'],'type':_0x384bbe['type'][_0x37d2('0x2e')]};});_0x411c6f[_0x37d2('0x2f')]=_['map'](_0x401fca,_0x37d2('0x29'));_0x411c6f['query']=_['keys'](_0x5a5e8b[_0x37d2('0x30')]);_0x411c6f[_0x37d2('0x31')]=_[_0x37d2('0x32')](_0x411c6f['model'],_0x411c6f['query']);_0x3a1cec[_0x37d2('0x33')]=_[_0x37d2('0x32')](_0x411c6f[_0x37d2('0x2f')],qs[_0x37d2('0x34')](_0x5a5e8b[_0x37d2('0x30')][_0x37d2('0x34')]));_0x3a1cec[_0x37d2('0x33')]=_0x3a1cec[_0x37d2('0x33')][_0x37d2('0x35')]?_0x3a1cec[_0x37d2('0x33')]:_0x411c6f[_0x37d2('0x2f')];if(!_0x5a5e8b[_0x37d2('0x30')][_0x37d2('0x36')](_0x37d2('0x37'))){_0x3a1cec[_0x37d2('0x20')]=qs[_0x37d2('0x20')](_0x5a5e8b[_0x37d2('0x30')]['limit']);_0x3a1cec[_0x37d2('0x1e')]=qs[_0x37d2('0x1e')](_0x5a5e8b[_0x37d2('0x30')][_0x37d2('0x1e')]);}_0x3a1cec['order']=qs['sort'](_0x5a5e8b[_0x37d2('0x30')]['sort']);_0x3a1cec['where']=qs[_0x37d2('0x31')](_[_0x37d2('0x38')](_0x5a5e8b['query'],_0x411c6f[_0x37d2('0x31')]),_0x401fca);if(_0x5a5e8b[_0x37d2('0x30')][_0x37d2('0x39')]){_0x3a1cec[_0x37d2('0x3a')]=_['merge'](_0x3a1cec[_0x37d2('0x3a')],{'$or':_[_0x37d2('0x2c')](_0x401fca,function(_0x2f8a12){if(_0x2f8a12[_0x37d2('0x3b')]!==_0x37d2('0x3c')){var _0x1012f1={};_0x1012f1[_0x2f8a12[_0x37d2('0x29')]]={'$like':'%'+_0x5a5e8b['query'][_0x37d2('0x39')]+'%'};return _0x1012f1;}})});}_0x3a1cec=_[_0x37d2('0x3d')]({},_0x3a1cec,_0x5a5e8b[_0x37d2('0x3e')]);var _0x1dc1d8={'where':_0x3a1cec['where']};return db[_0x37d2('0x3f')][_0x37d2('0x21')](_0x1dc1d8)['then'](function(_0x2889f8){_0xe460c[_0x37d2('0x21')]=_0x2889f8;if(_0x5a5e8b[_0x37d2('0x30')]['includeAll']){_0x3a1cec[_0x37d2('0x40')]=[{'all':!![]}];}return db[_0x37d2('0x3f')]['findAll'](_0x3a1cec);})['then'](function(_0x4d9575){_0xe460c['rows']=_0x4d9575;return _0xe460c;})['then'](respondWithFilteredResult(_0x3323bf,_0x3a1cec))[_0x37d2('0x41')](handleError(_0x3323bf,null));};exports[_0x37d2('0x42')]=function(_0x2014fb,_0x204b86){var _0x27a768={'raw':![],'where':{'id':_0x2014fb['params']['id']}},_0x280f52={};_0x280f52[_0x37d2('0x2f')]=_[_0x37d2('0x43')](db[_0x37d2('0x3f')]['rawAttributes']);_0x280f52[_0x37d2('0x30')]=_[_0x37d2('0x43')](_0x2014fb[_0x37d2('0x30')]);_0x280f52[_0x37d2('0x31')]=_[_0x37d2('0x32')](_0x280f52[_0x37d2('0x2f')],_0x280f52['query']);_0x27a768[_0x37d2('0x33')]=_[_0x37d2('0x32')](_0x280f52[_0x37d2('0x2f')],qs[_0x37d2('0x34')](_0x2014fb['query']['fields']));_0x27a768[_0x37d2('0x33')]=_0x27a768[_0x37d2('0x33')][_0x37d2('0x35')]?_0x27a768[_0x37d2('0x33')]:_0x280f52[_0x37d2('0x2f')];if(_0x2014fb[_0x37d2('0x30')][_0x37d2('0x44')]){_0x27a768[_0x37d2('0x40')]=[{'all':!![]}];}_0x27a768=_[_0x37d2('0x3d')]({},_0x27a768,_0x2014fb[_0x37d2('0x3e')]);return db[_0x37d2('0x3f')]['find'](_0x27a768)[_0x37d2('0x27')](handleEntityNotFound(_0x204b86,null))[_0x37d2('0x27')](respondWithResult(_0x204b86,null))['catch'](handleError(_0x204b86,null));};exports[_0x37d2('0x45')]=function(_0x4d3a8a,_0x3ada32){return db[_0x37d2('0x3f')]['create'](_0x4d3a8a[_0x37d2('0x46')],{})[_0x37d2('0x27')](respondWithResult(_0x3ada32,0xc9))['catch'](handleError(_0x3ada32,null));};exports[_0x37d2('0x47')]=function(_0x4b3029,_0x44e6cf){if(_0x4b3029[_0x37d2('0x46')]['id']){delete _0x4b3029[_0x37d2('0x46')]['id'];}return db[_0x37d2('0x3f')]['find']({'where':{'id':_0x4b3029['params']['id']}})[_0x37d2('0x27')](handleEntityNotFound(_0x44e6cf,null))[_0x37d2('0x27')](saveUpdates(_0x4b3029[_0x37d2('0x46')],null))[_0x37d2('0x27')](respondWithResult(_0x44e6cf,null))[_0x37d2('0x41')](handleError(_0x44e6cf,null));};exports[_0x37d2('0x28')]=function(_0x262591,_0x5274c6){return db[_0x37d2('0x3f')][_0x37d2('0x48')]({'where':{'id':_0x262591[_0x37d2('0x49')]['id']}})[_0x37d2('0x27')](handleEntityNotFound(_0x5274c6,null))[_0x37d2('0x27')](removeEntity(_0x5274c6,null))[_0x37d2('0x41')](handleError(_0x5274c6,null));};exports[_0x37d2('0x4a')]=function(_0x5cb9ae,_0x2cced8,_0x220a43){var _0x4b6b34={};var _0x4f74ee={};var _0x490f88;var _0x2f9dc3;return db[_0x37d2('0x3f')][_0x37d2('0x4b')]({'where':{'id':_0x5cb9ae['params']['id']}})[_0x37d2('0x27')](handleEntityNotFound(_0x2cced8,null))[_0x37d2('0x27')](function(_0x172ce4){if(_0x172ce4){_0x490f88=_0x172ce4;_0x4f74ee[_0x37d2('0x2f')]=_[_0x37d2('0x43')](db[_0x37d2('0x4c')][_0x37d2('0x2d')]);_0x4f74ee[_0x37d2('0x30')]=_['keys'](_0x5cb9ae[_0x37d2('0x30')]);_0x4f74ee[_0x37d2('0x31')]=_[_0x37d2('0x32')](_0x4f74ee[_0x37d2('0x2f')],_0x4f74ee[_0x37d2('0x30')]);_0x4b6b34[_0x37d2('0x33')]=_['intersection'](_0x4f74ee['model'],qs['fields'](_0x5cb9ae['query']['fields']));_0x4b6b34['attributes']=_0x4b6b34[_0x37d2('0x33')]['length']?_0x4b6b34[_0x37d2('0x33')]:_0x4f74ee[_0x37d2('0x2f')];_0x4b6b34[_0x37d2('0x4d')]=qs['sort'](_0x5cb9ae[_0x37d2('0x30')][_0x37d2('0x4e')]);_0x4b6b34[_0x37d2('0x3a')]=qs[_0x37d2('0x31')](_['pick'](_0x5cb9ae[_0x37d2('0x30')],_0x4f74ee[_0x37d2('0x31')]));if(_0x5cb9ae['query'][_0x37d2('0x39')]){_0x4b6b34[_0x37d2('0x3a')]=_[_0x37d2('0x3d')](_0x4b6b34[_0x37d2('0x3a')],{'$or':_[_0x37d2('0x2c')](_0x4b6b34[_0x37d2('0x33')],function(_0x53138c){var _0x57b7a3={};_0x57b7a3[_0x53138c]={'$like':'%'+_0x5cb9ae['query'][_0x37d2('0x39')]+'%'};return _0x57b7a3;})});}_0x4b6b34=_[_0x37d2('0x3d')]({},_0x4b6b34,_0x5cb9ae[_0x37d2('0x3e')]);return _0x490f88[_0x37d2('0x4a')](_0x4b6b34);}})['then'](function(_0x1b8c88){if(_0x1b8c88){_0x2f9dc3=_0x1b8c88[_0x37d2('0x35')];if(!_0x5cb9ae[_0x37d2('0x30')]['hasOwnProperty'](_0x37d2('0x37'))){_0x4b6b34[_0x37d2('0x20')]=qs[_0x37d2('0x20')](_0x5cb9ae[_0x37d2('0x30')][_0x37d2('0x20')]);_0x4b6b34[_0x37d2('0x1e')]=qs[_0x37d2('0x1e')](_0x5cb9ae[_0x37d2('0x30')][_0x37d2('0x1e')]);}return _0x490f88[_0x37d2('0x4a')](_0x4b6b34);}})['then'](function(_0x5ccea9){if(_0x5ccea9){return _0x5ccea9?{'count':_0x2f9dc3,'rows':_0x5ccea9}:null;}})[_0x37d2('0x27')](respondWithResult(_0x2cced8,null))[_0x37d2('0x41')](handleError(_0x2cced8,null));};exports[_0x37d2('0x4f')]=function(_0x557a3c,_0x15f5c6,_0x5009d9){var _0x4158ce={};var _0xb2207f={};var _0x7acdfd;var _0x152b5b;return db['SalesforceConfiguration'][_0x37d2('0x4b')]({'where':{'id':_0x557a3c[_0x37d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x15f5c6,null))[_0x37d2('0x27')](function(_0x208b52){if(_0x208b52){_0x7acdfd=_0x208b52;_0xb2207f[_0x37d2('0x2f')]=_[_0x37d2('0x43')](db['SalesforceField'][_0x37d2('0x2d')]);_0xb2207f[_0x37d2('0x30')]=_['keys'](_0x557a3c['query']);_0xb2207f[_0x37d2('0x31')]=_['intersection'](_0xb2207f[_0x37d2('0x2f')],_0xb2207f[_0x37d2('0x30')]);_0x4158ce['attributes']=_[_0x37d2('0x32')](_0xb2207f[_0x37d2('0x2f')],qs[_0x37d2('0x34')](_0x557a3c['query'][_0x37d2('0x34')]));_0x4158ce[_0x37d2('0x33')]=_0x4158ce[_0x37d2('0x33')][_0x37d2('0x35')]?_0x4158ce[_0x37d2('0x33')]:_0xb2207f[_0x37d2('0x2f')];_0x4158ce[_0x37d2('0x4d')]=qs['sort'](_0x557a3c[_0x37d2('0x30')][_0x37d2('0x4e')]);_0x4158ce[_0x37d2('0x3a')]=qs[_0x37d2('0x31')](_['pick'](_0x557a3c[_0x37d2('0x30')],_0xb2207f['filters']));if(_0x557a3c[_0x37d2('0x30')]['filter']){_0x4158ce[_0x37d2('0x3a')]=_[_0x37d2('0x3d')](_0x4158ce[_0x37d2('0x3a')],{'$or':_['map'](_0x4158ce[_0x37d2('0x33')],function(_0x2eaa4d){var _0x2d2a53={};_0x2d2a53[_0x2eaa4d]={'$like':'%'+_0x557a3c['query']['filter']+'%'};return _0x2d2a53;})});}_0x4158ce=_[_0x37d2('0x3d')]({},_0x4158ce,_0x557a3c[_0x37d2('0x3e')]);return _0x7acdfd[_0x37d2('0x4f')](_0x4158ce);}})[_0x37d2('0x27')](function(_0x4d4991){if(_0x4d4991){_0x152b5b=_0x4d4991[_0x37d2('0x35')];if(!_0x557a3c[_0x37d2('0x30')][_0x37d2('0x36')]('nolimit')){_0x4158ce['limit']=qs['limit'](_0x557a3c['query'][_0x37d2('0x20')]);_0x4158ce[_0x37d2('0x1e')]=qs['offset'](_0x557a3c[_0x37d2('0x30')][_0x37d2('0x1e')]);}return _0x7acdfd[_0x37d2('0x4f')](_0x4158ce);}})['then'](function(_0x4ab1ab){if(_0x4ab1ab){return _0x4ab1ab?{'count':_0x152b5b,'rows':_0x4ab1ab}:null;}})['then'](respondWithResult(_0x15f5c6,null))['catch'](handleError(_0x15f5c6,null));};exports['getDescriptions']=function(_0x5681df,_0x177bce,_0x55c6b0){var _0xbe3e91={};var _0x5371a7={};var _0x1dd82f;var _0x467eda;return db['SalesforceConfiguration'][_0x37d2('0x4b')]({'where':{'id':_0x5681df[_0x37d2('0x49')]['id']}})[_0x37d2('0x27')](handleEntityNotFound(_0x177bce,null))[_0x37d2('0x27')](function(_0x2bd73d){if(_0x2bd73d){_0x1dd82f=_0x2bd73d;_0x5371a7[_0x37d2('0x2f')]=_[_0x37d2('0x43')](db[_0x37d2('0x4c')]['rawAttributes']);_0x5371a7[_0x37d2('0x30')]=_[_0x37d2('0x43')](_0x5681df[_0x37d2('0x30')]);_0x5371a7[_0x37d2('0x31')]=_[_0x37d2('0x32')](_0x5371a7['model'],_0x5371a7[_0x37d2('0x30')]);_0xbe3e91[_0x37d2('0x33')]=_['intersection'](_0x5371a7[_0x37d2('0x2f')],qs['fields'](_0x5681df[_0x37d2('0x30')][_0x37d2('0x34')]));_0xbe3e91[_0x37d2('0x33')]=_0xbe3e91[_0x37d2('0x33')]['length']?_0xbe3e91[_0x37d2('0x33')]:_0x5371a7['model'];_0xbe3e91['order']=qs[_0x37d2('0x4e')](_0x5681df['query']['sort']);_0xbe3e91[_0x37d2('0x3a')]=qs[_0x37d2('0x31')](_[_0x37d2('0x38')](_0x5681df[_0x37d2('0x30')],_0x5371a7[_0x37d2('0x31')]));if(_0x5681df[_0x37d2('0x30')][_0x37d2('0x39')]){_0xbe3e91[_0x37d2('0x3a')]=_[_0x37d2('0x3d')](_0xbe3e91[_0x37d2('0x3a')],{'$or':_['map'](_0xbe3e91[_0x37d2('0x33')],function(_0x53b620){var _0x4f4d5a={};_0x4f4d5a[_0x53b620]={'$like':'%'+_0x5681df[_0x37d2('0x30')]['filter']+'%'};return _0x4f4d5a;})});}_0xbe3e91=_[_0x37d2('0x3d')]({},_0xbe3e91,_0x5681df['options']);return _0x1dd82f[_0x37d2('0x50')](_0xbe3e91);}})[_0x37d2('0x27')](function(_0x5bf169){if(_0x5bf169){_0x467eda=_0x5bf169[_0x37d2('0x35')];if(!_0x5681df[_0x37d2('0x30')][_0x37d2('0x36')](_0x37d2('0x37'))){_0xbe3e91[_0x37d2('0x20')]=qs[_0x37d2('0x20')](_0x5681df['query'][_0x37d2('0x20')]);_0xbe3e91[_0x37d2('0x1e')]=qs[_0x37d2('0x1e')](_0x5681df[_0x37d2('0x30')][_0x37d2('0x1e')]);}return _0x1dd82f[_0x37d2('0x50')](_0xbe3e91);}})[_0x37d2('0x27')](function(_0x381ab0){if(_0x381ab0){return _0x381ab0?{'count':_0x467eda,'rows':_0x381ab0}:null;}})[_0x37d2('0x27')](respondWithResult(_0x177bce,null))[_0x37d2('0x41')](handleError(_0x177bce,null));}; \ No newline at end of file +var _0xe29d=['getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','merge','where','type','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','getFields','findOne','SalesforceField','order'];(function(_0x3e5b05,_0x29f673){var _0x5a8e38=function(_0x17b72f){while(--_0x17b72f){_0x3e5b05['push'](_0x3e5b05['shift']());}};_0x5a8e38(++_0x29f673);}(_0xe29d,0x1a7));var _0xde29=function(_0x5911f3,_0x234926){_0x5911f3=_0x5911f3-0x0;var _0x3eb7fc=_0xe29d[_0x5911f3];return _0x3eb7fc;};'use strict';var emlformat=require(_0xde29('0x0'));var rimraf=require(_0xde29('0x1'));var zipdir=require(_0xde29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde29('0x3'));var moment=require('moment');var BPromise=require(_0xde29('0x4'));var Mustache=require(_0xde29('0x5'));var util=require(_0xde29('0x6'));var path=require('path');var sox=require(_0xde29('0x7'));var csv=require('to-csv');var ejs=require(_0xde29('0x8'));var fs=require('fs');var fs_extra=require(_0xde29('0x9'));var _=require(_0xde29('0xa'));var squel=require(_0xde29('0xb'));var crypto=require(_0xde29('0xc'));var jsforce=require(_0xde29('0xd'));var deskjs=require(_0xde29('0xe'));var toCsv=require(_0xde29('0xf'));var querystring=require(_0xde29('0x10'));var Papa=require(_0xde29('0x11'));var Redis=require(_0xde29('0x12'));var authService=require(_0xde29('0x13'));var qs=require(_0xde29('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde29('0x15'));var logger=require(_0xde29('0x16'))(_0xde29('0x17'));var utils=require(_0xde29('0x18'));var config=require(_0xde29('0x19'));var licenseUtil=require(_0xde29('0x1a'));var db=require(_0xde29('0x1b'))['db'];function respondWithStatusCode(_0x53c8dd,_0x4202b3){_0x4202b3=_0x4202b3||0xcc;return function(_0xfa1642){if(_0xfa1642){return _0x53c8dd[_0xde29('0x1c')](_0x4202b3);}return _0x53c8dd[_0xde29('0x1d')](_0x4202b3)['end']();};}function respondWithResult(_0x484a0b,_0xf1d587){_0xf1d587=_0xf1d587||0xc8;return function(_0x5f38e0){if(_0x5f38e0){return _0x484a0b[_0xde29('0x1d')](_0xf1d587)[_0xde29('0x1e')](_0x5f38e0);}};}function respondWithFilteredResult(_0x1bf145,_0x1451d4){return function(_0x37d997){if(_0x37d997){var _0x4f5db5=typeof _0x1451d4[_0xde29('0x1f')]===_0xde29('0x20')&&typeof _0x1451d4[_0xde29('0x21')]===_0xde29('0x20');var _0x26e1c0=_0x37d997[_0xde29('0x22')];var _0x41f259=_0x4f5db5?0x0:_0x1451d4[_0xde29('0x1f')];var _0x3f6a49=_0x4f5db5?_0x37d997[_0xde29('0x22')]:_0x1451d4[_0xde29('0x1f')]+_0x1451d4[_0xde29('0x21')];var _0x23a707;if(_0x3f6a49>=_0x26e1c0){_0x3f6a49=_0x26e1c0;_0x23a707=0xc8;}else{_0x23a707=0xce;}_0x1bf145[_0xde29('0x1d')](_0x23a707);return _0x1bf145[_0xde29('0x23')](_0xde29('0x24'),_0x41f259+'-'+_0x3f6a49+'/'+_0x26e1c0)['json'](_0x37d997);}return null;};}function patchUpdates(_0x4e45f0){return function(_0x45731a){try{jsonpatch[_0xde29('0x25')](_0x45731a,_0x4e45f0,!![]);}catch(_0x9fece2){return BPromise[_0xde29('0x26')](_0x9fece2);}return _0x45731a[_0xde29('0x27')]();};}function saveUpdates(_0x1e4e57,_0x481c9c){return function(_0x88f6dd){if(_0x88f6dd){return _0x88f6dd[_0xde29('0x28')](_0x1e4e57)[_0xde29('0x29')](function(_0x56bc3b){return _0x56bc3b;});}return null;};}function removeEntity(_0x2ffabb,_0x43bde9){return function(_0x4c6020){if(_0x4c6020){return _0x4c6020['destroy']()[_0xde29('0x29')](function(){_0x2ffabb['status'](0xcc)[_0xde29('0x2a')]();});}};}function handleEntityNotFound(_0x2b146f,_0x2b5e1e){return function(_0x52f118){if(!_0x52f118){_0x2b146f[_0xde29('0x1c')](0x194);}return _0x52f118;};}function handleError(_0x5f411f,_0x30d993){_0x30d993=_0x30d993||0x1f4;return function(_0x70c2b2){logger['error'](_0x70c2b2['stack']);if(_0x70c2b2[_0xde29('0x2b')]){delete _0x70c2b2[_0xde29('0x2b')];}_0x5f411f['status'](_0x30d993)[_0xde29('0x2c')](_0x70c2b2);};}exports[_0xde29('0x2d')]=function(_0xd1b4c8,_0x2a11ee){var _0x39a4ce={},_0x213ea5={},_0x1b0029={'count':0x0,'rows':[]};var _0x271594=_[_0xde29('0x2e')](db[_0xde29('0x2f')][_0xde29('0x30')],function(_0xd00e14){return{'name':_0xd00e14[_0xde29('0x31')],'type':_0xd00e14['type'][_0xde29('0x32')]};});_0x213ea5[_0xde29('0x33')]=_[_0xde29('0x2e')](_0x271594,'name');_0x213ea5[_0xde29('0x34')]=_[_0xde29('0x35')](_0xd1b4c8['query']);_0x213ea5[_0xde29('0x36')]=_[_0xde29('0x37')](_0x213ea5[_0xde29('0x33')],_0x213ea5['query']);_0x39a4ce[_0xde29('0x38')]=_[_0xde29('0x37')](_0x213ea5[_0xde29('0x33')],qs[_0xde29('0x39')](_0xd1b4c8['query'][_0xde29('0x39')]));_0x39a4ce['attributes']=_0x39a4ce[_0xde29('0x38')]['length']?_0x39a4ce[_0xde29('0x38')]:_0x213ea5[_0xde29('0x33')];if(!_0xd1b4c8[_0xde29('0x34')]['hasOwnProperty'](_0xde29('0x3a'))){_0x39a4ce['limit']=qs['limit'](_0xd1b4c8['query'][_0xde29('0x21')]);_0x39a4ce[_0xde29('0x1f')]=qs['offset'](_0xd1b4c8[_0xde29('0x34')][_0xde29('0x1f')]);}_0x39a4ce['order']=qs['sort'](_0xd1b4c8[_0xde29('0x34')][_0xde29('0x3b')]);_0x39a4ce['where']=qs['filters'](_[_0xde29('0x3c')](_0xd1b4c8[_0xde29('0x34')],_0x213ea5[_0xde29('0x36')]),_0x271594);if(_0xd1b4c8[_0xde29('0x34')]['filter']){_0x39a4ce['where']=_[_0xde29('0x3d')](_0x39a4ce[_0xde29('0x3e')],{'$or':_[_0xde29('0x2e')](_0x271594,function(_0x2a98ca){if(_0x2a98ca[_0xde29('0x3f')]!=='VIRTUAL'){var _0x2f3eb1={};_0x2f3eb1[_0x2a98ca[_0xde29('0x2b')]]={'$like':'%'+_0xd1b4c8[_0xde29('0x34')][_0xde29('0x40')]+'%'};return _0x2f3eb1;}})});}_0x39a4ce=_[_0xde29('0x3d')]({},_0x39a4ce,_0xd1b4c8['options']);var _0x1b036d={'where':_0x39a4ce[_0xde29('0x3e')]};return db[_0xde29('0x2f')][_0xde29('0x22')](_0x1b036d)['then'](function(_0x28c9c1){_0x1b0029[_0xde29('0x22')]=_0x28c9c1;if(_0xd1b4c8['query'][_0xde29('0x41')]){_0x39a4ce[_0xde29('0x42')]=[{'all':!![]}];}return db[_0xde29('0x2f')][_0xde29('0x43')](_0x39a4ce);})[_0xde29('0x29')](function(_0x5eb6a8){_0x1b0029[_0xde29('0x44')]=_0x5eb6a8;return _0x1b0029;})['then'](respondWithFilteredResult(_0x2a11ee,_0x39a4ce))[_0xde29('0x45')](handleError(_0x2a11ee,null));};exports[_0xde29('0x46')]=function(_0x20d567,_0x30a038){var _0x278fff={'raw':![],'where':{'id':_0x20d567[_0xde29('0x47')]['id']}},_0x4eb9af={};_0x4eb9af['model']=_[_0xde29('0x35')](db[_0xde29('0x2f')][_0xde29('0x30')]);_0x4eb9af['query']=_[_0xde29('0x35')](_0x20d567['query']);_0x4eb9af['filters']=_[_0xde29('0x37')](_0x4eb9af[_0xde29('0x33')],_0x4eb9af['query']);_0x278fff[_0xde29('0x38')]=_[_0xde29('0x37')](_0x4eb9af[_0xde29('0x33')],qs[_0xde29('0x39')](_0x20d567['query'][_0xde29('0x39')]));_0x278fff[_0xde29('0x38')]=_0x278fff[_0xde29('0x38')][_0xde29('0x48')]?_0x278fff[_0xde29('0x38')]:_0x4eb9af[_0xde29('0x33')];if(_0x20d567['query']['includeAll']){_0x278fff[_0xde29('0x42')]=[{'all':!![]}];}_0x278fff=_[_0xde29('0x3d')]({},_0x278fff,_0x20d567[_0xde29('0x49')]);return db[_0xde29('0x2f')][_0xde29('0x4a')](_0x278fff)[_0xde29('0x29')](handleEntityNotFound(_0x30a038,null))[_0xde29('0x29')](respondWithResult(_0x30a038,null))[_0xde29('0x45')](handleError(_0x30a038,null));};exports[_0xde29('0x4b')]=function(_0x4c32dc,_0x1acc3b){return db['SalesforceConfiguration'][_0xde29('0x4b')](_0x4c32dc['body'],{})[_0xde29('0x29')](respondWithResult(_0x1acc3b,0xc9))['catch'](handleError(_0x1acc3b,null));};exports['update']=function(_0x27e4f0,_0x112a40){if(_0x27e4f0[_0xde29('0x4c')]['id']){delete _0x27e4f0[_0xde29('0x4c')]['id'];}return db[_0xde29('0x2f')][_0xde29('0x4a')]({'where':{'id':_0x27e4f0[_0xde29('0x47')]['id']}})[_0xde29('0x29')](handleEntityNotFound(_0x112a40,null))['then'](saveUpdates(_0x27e4f0['body'],null))[_0xde29('0x29')](respondWithResult(_0x112a40,null))[_0xde29('0x45')](handleError(_0x112a40,null));};exports['destroy']=function(_0x359a86,_0x146454){return db[_0xde29('0x2f')][_0xde29('0x4a')]({'where':{'id':_0x359a86[_0xde29('0x47')]['id']}})['then'](handleEntityNotFound(_0x146454,null))[_0xde29('0x29')](removeEntity(_0x146454,null))[_0xde29('0x45')](handleError(_0x146454,null));};exports[_0xde29('0x4d')]=function(_0x1eacec,_0x41d4cb,_0x2fd4af){var _0x101b7b={};var _0x34c3fb={};var _0x56890c;var _0x1064f2;return db[_0xde29('0x2f')][_0xde29('0x4e')]({'where':{'id':_0x1eacec[_0xde29('0x47')]['id']}})[_0xde29('0x29')](handleEntityNotFound(_0x41d4cb,null))[_0xde29('0x29')](function(_0x48c4d2){if(_0x48c4d2){_0x56890c=_0x48c4d2;_0x34c3fb[_0xde29('0x33')]=_[_0xde29('0x35')](db[_0xde29('0x4f')][_0xde29('0x30')]);_0x34c3fb[_0xde29('0x34')]=_[_0xde29('0x35')](_0x1eacec['query']);_0x34c3fb[_0xde29('0x36')]=_[_0xde29('0x37')](_0x34c3fb[_0xde29('0x33')],_0x34c3fb['query']);_0x101b7b[_0xde29('0x38')]=_[_0xde29('0x37')](_0x34c3fb[_0xde29('0x33')],qs[_0xde29('0x39')](_0x1eacec['query'][_0xde29('0x39')]));_0x101b7b[_0xde29('0x38')]=_0x101b7b['attributes'][_0xde29('0x48')]?_0x101b7b[_0xde29('0x38')]:_0x34c3fb[_0xde29('0x33')];_0x101b7b[_0xde29('0x50')]=qs['sort'](_0x1eacec[_0xde29('0x34')][_0xde29('0x3b')]);_0x101b7b[_0xde29('0x3e')]=qs[_0xde29('0x36')](_[_0xde29('0x3c')](_0x1eacec['query'],_0x34c3fb[_0xde29('0x36')]));if(_0x1eacec[_0xde29('0x34')][_0xde29('0x40')]){_0x101b7b[_0xde29('0x3e')]=_[_0xde29('0x3d')](_0x101b7b['where'],{'$or':_['map'](_0x101b7b[_0xde29('0x38')],function(_0x93a5){var _0x14dbc6={};_0x14dbc6[_0x93a5]={'$like':'%'+_0x1eacec[_0xde29('0x34')][_0xde29('0x40')]+'%'};return _0x14dbc6;})});}_0x101b7b=_[_0xde29('0x3d')]({},_0x101b7b,_0x1eacec[_0xde29('0x49')]);return _0x56890c['getFields'](_0x101b7b);}})[_0xde29('0x29')](function(_0x53e3cc){if(_0x53e3cc){_0x1064f2=_0x53e3cc[_0xde29('0x48')];if(!_0x1eacec[_0xde29('0x34')]['hasOwnProperty'](_0xde29('0x3a'))){_0x101b7b[_0xde29('0x21')]=qs[_0xde29('0x21')](_0x1eacec[_0xde29('0x34')][_0xde29('0x21')]);_0x101b7b[_0xde29('0x1f')]=qs['offset'](_0x1eacec[_0xde29('0x34')]['offset']);}return _0x56890c[_0xde29('0x4d')](_0x101b7b);}})['then'](function(_0x285d21){if(_0x285d21){return _0x285d21?{'count':_0x1064f2,'rows':_0x285d21}:null;}})[_0xde29('0x29')](respondWithResult(_0x41d4cb,null))['catch'](handleError(_0x41d4cb,null));};exports[_0xde29('0x51')]=function(_0x510067,_0x15e267,_0xd60bcd){var _0x19d0d9={};var _0x79faeb={};var _0x34aa53;var _0x19131b;return db[_0xde29('0x2f')][_0xde29('0x4e')]({'where':{'id':_0x510067['params']['id']}})[_0xde29('0x29')](handleEntityNotFound(_0x15e267,null))[_0xde29('0x29')](function(_0x43e66b){if(_0x43e66b){_0x34aa53=_0x43e66b;_0x79faeb['model']=_[_0xde29('0x35')](db['SalesforceField'][_0xde29('0x30')]);_0x79faeb[_0xde29('0x34')]=_[_0xde29('0x35')](_0x510067['query']);_0x79faeb['filters']=_[_0xde29('0x37')](_0x79faeb[_0xde29('0x33')],_0x79faeb[_0xde29('0x34')]);_0x19d0d9[_0xde29('0x38')]=_[_0xde29('0x37')](_0x79faeb[_0xde29('0x33')],qs[_0xde29('0x39')](_0x510067[_0xde29('0x34')]['fields']));_0x19d0d9['attributes']=_0x19d0d9[_0xde29('0x38')][_0xde29('0x48')]?_0x19d0d9[_0xde29('0x38')]:_0x79faeb[_0xde29('0x33')];_0x19d0d9[_0xde29('0x50')]=qs['sort'](_0x510067['query'][_0xde29('0x3b')]);_0x19d0d9[_0xde29('0x3e')]=qs[_0xde29('0x36')](_[_0xde29('0x3c')](_0x510067['query'],_0x79faeb['filters']));if(_0x510067[_0xde29('0x34')][_0xde29('0x40')]){_0x19d0d9[_0xde29('0x3e')]=_[_0xde29('0x3d')](_0x19d0d9[_0xde29('0x3e')],{'$or':_[_0xde29('0x2e')](_0x19d0d9[_0xde29('0x38')],function(_0x4b6c77){var _0x562b5c={};_0x562b5c[_0x4b6c77]={'$like':'%'+_0x510067[_0xde29('0x34')][_0xde29('0x40')]+'%'};return _0x562b5c;})});}_0x19d0d9=_[_0xde29('0x3d')]({},_0x19d0d9,_0x510067[_0xde29('0x49')]);return _0x34aa53[_0xde29('0x51')](_0x19d0d9);}})[_0xde29('0x29')](function(_0x4de56b){if(_0x4de56b){_0x19131b=_0x4de56b[_0xde29('0x48')];if(!_0x510067[_0xde29('0x34')][_0xde29('0x52')]('nolimit')){_0x19d0d9[_0xde29('0x21')]=qs[_0xde29('0x21')](_0x510067[_0xde29('0x34')][_0xde29('0x21')]);_0x19d0d9[_0xde29('0x1f')]=qs['offset'](_0x510067[_0xde29('0x34')][_0xde29('0x1f')]);}return _0x34aa53['getSubjects'](_0x19d0d9);}})[_0xde29('0x29')](function(_0x4ffb83){if(_0x4ffb83){return _0x4ffb83?{'count':_0x19131b,'rows':_0x4ffb83}:null;}})[_0xde29('0x29')](respondWithResult(_0x15e267,null))[_0xde29('0x45')](handleError(_0x15e267,null));};exports['getDescriptions']=function(_0x213ff2,_0x23be6c,_0x344e13){var _0x1e1b81={};var _0x4a7641={};var _0x1fd3c0;var _0x5fbc55;return db[_0xde29('0x2f')][_0xde29('0x4e')]({'where':{'id':_0x213ff2[_0xde29('0x47')]['id']}})[_0xde29('0x29')](handleEntityNotFound(_0x23be6c,null))['then'](function(_0x33b3e3){if(_0x33b3e3){_0x1fd3c0=_0x33b3e3;_0x4a7641[_0xde29('0x33')]=_['keys'](db[_0xde29('0x4f')][_0xde29('0x30')]);_0x4a7641['query']=_[_0xde29('0x35')](_0x213ff2[_0xde29('0x34')]);_0x4a7641[_0xde29('0x36')]=_['intersection'](_0x4a7641[_0xde29('0x33')],_0x4a7641[_0xde29('0x34')]);_0x1e1b81[_0xde29('0x38')]=_[_0xde29('0x37')](_0x4a7641['model'],qs[_0xde29('0x39')](_0x213ff2['query'][_0xde29('0x39')]));_0x1e1b81[_0xde29('0x38')]=_0x1e1b81[_0xde29('0x38')][_0xde29('0x48')]?_0x1e1b81[_0xde29('0x38')]:_0x4a7641['model'];_0x1e1b81[_0xde29('0x50')]=qs[_0xde29('0x3b')](_0x213ff2['query'][_0xde29('0x3b')]);_0x1e1b81[_0xde29('0x3e')]=qs[_0xde29('0x36')](_[_0xde29('0x3c')](_0x213ff2[_0xde29('0x34')],_0x4a7641[_0xde29('0x36')]));if(_0x213ff2[_0xde29('0x34')][_0xde29('0x40')]){_0x1e1b81[_0xde29('0x3e')]=_['merge'](_0x1e1b81['where'],{'$or':_[_0xde29('0x2e')](_0x1e1b81['attributes'],function(_0x45363c){var _0x201ee5={};_0x201ee5[_0x45363c]={'$like':'%'+_0x213ff2[_0xde29('0x34')][_0xde29('0x40')]+'%'};return _0x201ee5;})});}_0x1e1b81=_[_0xde29('0x3d')]({},_0x1e1b81,_0x213ff2['options']);return _0x1fd3c0['getDescriptions'](_0x1e1b81);}})[_0xde29('0x29')](function(_0x86e19b){if(_0x86e19b){_0x5fbc55=_0x86e19b[_0xde29('0x48')];if(!_0x213ff2[_0xde29('0x34')][_0xde29('0x52')](_0xde29('0x3a'))){_0x1e1b81[_0xde29('0x21')]=qs[_0xde29('0x21')](_0x213ff2[_0xde29('0x34')][_0xde29('0x21')]);_0x1e1b81[_0xde29('0x1f')]=qs['offset'](_0x213ff2[_0xde29('0x34')]['offset']);}return _0x1fd3c0[_0xde29('0x53')](_0x1e1b81);}})[_0xde29('0x29')](function(_0x2d54c7){if(_0x2d54c7){return _0x2d54c7?{'count':_0x5fbc55,'rows':_0x2d54c7}:null;}})[_0xde29('0x29')](respondWithResult(_0x23be6c,null))[_0xde29('0x45')](handleError(_0x23be6c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index be127d9..3eff23f 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 _0xf514=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x4d6bfd,_0x8d79ff){var _0x243a46=function(_0x3883b1){while(--_0x3883b1){_0x4d6bfd['push'](_0x4d6bfd['shift']());}};_0x243a46(++_0x8d79ff);}(_0xf514,0xcc));var _0x4f51=function(_0x5e5c4a,_0xdfedb9){_0x5e5c4a=_0x5e5c4a-0x0;var _0x28e578=_0xf514[_0x5e5c4a];return _0x28e578;};'use strict';var _=require(_0x4f51('0x0'));var util=require(_0x4f51('0x1'));var logger=require(_0x4f51('0x2'))(_0x4f51('0x3'));var moment=require('moment');var BPromise=require(_0x4f51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4f51('0x5'));var attributes=require(_0x4f51('0x6'));module[_0x4f51('0x7')]=function(_0x8d7f58,_0x4f2b57){return _0x8d7f58[_0x4f51('0x8')](_0x4f51('0x9'),attributes,{'tableName':_0x4f51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x019f=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','../../config/logger','bluebird','request-promise'];(function(_0x576a09,_0xa88bac){var _0x3bec24=function(_0x1dc25a){while(--_0x1dc25a){_0x576a09['push'](_0x576a09['shift']());}};_0x3bec24(++_0xa88bac);}(_0x019f,0xb5));var _0xf019=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0x019f[_0x57b38f];return _0x6aa12c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf019('0x0'))('api');var moment=require('moment');var BPromise=require(_0xf019('0x1'));var rp=require(_0xf019('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf019('0x3'));var config=require(_0xf019('0x4'));var attributes=require(_0xf019('0x5'));module['exports']=function(_0x33115b,_0xd997a2){return _0x33115b[_0xf019('0x6')]('SalesforceConfiguration',attributes,{'tableName':_0xf019('0x7'),'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 6aefc34..0cc4a7d 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 _0x2be9=['../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2be9,0x172));var _0x92be=function(_0x4e68aa,_0x77632d){_0x4e68aa=_0x4e68aa-0x0;var _0xfe0a56=_0x2be9[_0x4e68aa];return _0xfe0a56;};'use strict';var _=require(_0x92be('0x0'));var util=require(_0x92be('0x1'));var moment=require(_0x92be('0x2'));var BPromise=require('bluebird');var rs=require(_0x92be('0x3'));var fs=require('fs');var Redis=require(_0x92be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x92be('0x5'));var logger=require(_0x92be('0x6'))(_0x92be('0x7'));var config=require(_0x92be('0x8'));var jayson=require(_0x92be('0x9'));var client=jayson[_0x92be('0xa')][_0x92be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x534b31,_0x416109,_0x2355f4){return new BPromise(function(_0x878c0a,_0x242db7){return client[_0x92be('0xc')](_0x534b31,_0x2355f4)[_0x92be('0xd')](function(_0x3e521a){logger[_0x92be('0xe')](_0x92be('0xf'),_0x416109,'request\x20sent');logger[_0x92be('0x10')](_0x92be('0x11'),_0x416109,'request\x20sent',JSON['stringify'](_0x3e521a));if(_0x3e521a['error']){if(_0x3e521a[_0x92be('0x12')]['code']===0x1f4){logger[_0x92be('0x12')](_0x92be('0xf'),_0x416109,_0x3e521a['error'][_0x92be('0x13')]);return _0x242db7(_0x3e521a[_0x92be('0x12')][_0x92be('0x13')]);}logger[_0x92be('0x12')](_0x92be('0xf'),_0x416109,_0x3e521a[_0x92be('0x12')][_0x92be('0x13')]);return _0x878c0a(_0x3e521a[_0x92be('0x12')][_0x92be('0x13')]);}else{logger[_0x92be('0xe')](_0x92be('0xf'),_0x416109,'request\x20sent');_0x878c0a(_0x3e521a[_0x92be('0x14')][_0x92be('0x13')]);}})['catch'](function(_0x132f18){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x416109,_0x132f18);_0x242db7(_0x132f18);});});} \ No newline at end of file +var _0xf3b1=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xf3b1,0x181));var _0x1f3b=function(_0x5c7695,_0x4c660f){_0x5c7695=_0x5c7695-0x0;var _0x45b3c0=_0xf3b1[_0x5c7695];return _0x45b3c0;};'use strict';var _=require(_0x1f3b('0x0'));var util=require(_0x1f3b('0x1'));var moment=require(_0x1f3b('0x2'));var BPromise=require(_0x1f3b('0x3'));var rs=require(_0x1f3b('0x4'));var fs=require('fs');var Redis=require(_0x1f3b('0x5'));var db=require(_0x1f3b('0x6'))['db'];var utils=require(_0x1f3b('0x7'));var logger=require(_0x1f3b('0x8'))('rpc');var config=require(_0x1f3b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1f3b('0xa')][_0x1f3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184c63,_0x50d201,_0x5e1ff9){return new BPromise(function(_0x1afe0e,_0x2652b){return client[_0x1f3b('0xc')](_0x184c63,_0x5e1ff9)[_0x1f3b('0xd')](function(_0x180faf){logger[_0x1f3b('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x50d201,_0x1f3b('0xf'));logger[_0x1f3b('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x50d201,_0x1f3b('0xf'),JSON['stringify'](_0x180faf));if(_0x180faf[_0x1f3b('0x11')]){if(_0x180faf['error'][_0x1f3b('0x12')]===0x1f4){logger[_0x1f3b('0x11')](_0x1f3b('0x13'),_0x50d201,_0x180faf[_0x1f3b('0x11')]['message']);return _0x2652b(_0x180faf['error']['message']);}logger[_0x1f3b('0x11')](_0x1f3b('0x13'),_0x50d201,_0x180faf['error'][_0x1f3b('0x14')]);return _0x1afe0e(_0x180faf[_0x1f3b('0x11')][_0x1f3b('0x14')]);}else{logger[_0x1f3b('0xe')](_0x1f3b('0x13'),_0x50d201,'request\x20sent');_0x1afe0e(_0x180faf[_0x1f3b('0x15')]['message']);}})[_0x1f3b('0x16')](function(_0x4f5b9b){logger[_0x1f3b('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x50d201,_0x4f5b9b);_0x2652b(_0x4f5b9b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 80b3e3d..48061db 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 _0x02d8=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','post','isAuthenticated','create','put'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x02d8,0xb7));var _0x802d=function(_0x450930,_0x222331){_0x450930=_0x450930-0x0;var _0x38e443=_0x02d8[_0x450930];return _0x38e443;};'use strict';var multer=require(_0x802d('0x0'));var util=require(_0x802d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x802d('0x2')]();var fs_extra=require(_0x802d('0x3'));var auth=require(_0x802d('0x4'));var interaction=require(_0x802d('0x5'));var config=require(_0x802d('0x6'));var controller=require(_0x802d('0x7'));router[_0x802d('0x8')]('/',auth['isAuthenticated'](),controller[_0x802d('0x9')]);router[_0x802d('0x8')](_0x802d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x802d('0xb')]('/',auth[_0x802d('0xc')](),controller[_0x802d('0xd')]);router[_0x802d('0xe')](_0x802d('0xa'),auth['isAuthenticated'](),controller[_0x802d('0xf')]);router[_0x802d('0x10')]('/:id',auth[_0x802d('0xc')](),controller[_0x802d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x94c3=['../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x50109a,_0x1e6333){var _0x39b547=function(_0x517d1e){while(--_0x517d1e){_0x50109a['push'](_0x50109a['shift']());}};_0x39b547(++_0x1e6333);}(_0x94c3,0x1f3));var _0x394c=function(_0x35cd12,_0x3bc1d0){_0x35cd12=_0x35cd12-0x0;var _0x53852c=_0x94c3[_0x35cd12];return _0x53852c;};'use strict';var multer=require(_0x394c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x394c('0x1'));var express=require('express');var router=express[_0x394c('0x2')]();var fs_extra=require(_0x394c('0x3'));var auth=require(_0x394c('0x4'));var interaction=require(_0x394c('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x394c('0x6')]('/',auth['isAuthenticated'](),controller[_0x394c('0x7')]);router[_0x394c('0x6')](_0x394c('0x8'),auth[_0x394c('0x9')](),controller[_0x394c('0xa')]);router[_0x394c('0xb')]('/',auth[_0x394c('0x9')](),controller[_0x394c('0xc')]);router[_0x394c('0xd')](_0x394c('0x8'),auth['isAuthenticated'](),controller[_0x394c('0xe')]);router[_0x394c('0xf')](_0x394c('0x8'),auth[_0x394c('0x9')](),controller[_0x394c('0x10')]);module[_0x394c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 967d831..405f777 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 _0xda18=['keyValue','picklist','STRING','ENUM','variable','exports','string','customVariable'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xda18,0x185));var _0x8da1=function(_0xfb279,_0x1cee2c){_0xfb279=_0xfb279-0x0;var _0x5c1270=_0xda18[_0xfb279];return _0x5c1270;};'use strict';var Sequelize=require('sequelize');module[_0x8da1('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8da1('0x1'),'variable',_0x8da1('0x2'),_0x8da1('0x3'),_0x8da1('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8da1('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8da1('0x6')](_0x8da1('0x1'),_0x8da1('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8da1('0x5')]},'variableName':{'type':Sequelize[_0x8da1('0x5')]}}; \ No newline at end of file +var _0x325a=['sequelize','variable','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x2c204a,_0x1439c4){var _0x2479f7=function(_0x1ab7be){while(--_0x1ab7be){_0x2c204a['push'](_0x2c204a['shift']());}};_0x2479f7(++_0x1439c4);}(_0x325a,0xf0));var _0xa325=function(_0x82d10f,_0x4e1886){_0x82d10f=_0x82d10f-0x0;var _0x1139f6=_0x325a[_0x82d10f];return _0x1139f6;};'use strict';var Sequelize=require(_0xa325('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xa325('0x1'),_0xa325('0x2'),_0xa325('0x3'),_0xa325('0x4')),'defaultValue':_0xa325('0x5')},'content':{'type':Sequelize[_0xa325('0x6')]},'key':{'type':Sequelize[_0xa325('0x6')]},'keyType':{'type':Sequelize[_0xa325('0x7')](_0xa325('0x5'),_0xa325('0x1'),_0xa325('0x2'))},'keyContent':{'type':Sequelize[_0xa325('0x6')]},'idField':{'type':Sequelize[_0xa325('0x6')]},'variableName':{'type':Sequelize[_0xa325('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6542fa6..f699b69 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 _0xb45e=['update','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','rows','catch','fields','includeAll','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','json','apply','save'];(function(_0x466de4,_0x3fc4a0){var _0x3d016a=function(_0x58dd27){while(--_0x58dd27){_0x466de4['push'](_0x466de4['shift']());}};_0x3d016a(++_0x3fc4a0);}(_0xb45e,0xb7));var _0xeb45=function(_0x63e1a5,_0xcdcce0){_0x63e1a5=_0x63e1a5-0x0;var _0x17c339=_0xb45e[_0x63e1a5];return _0x17c339;};'use strict';var emlformat=require(_0xeb45('0x0'));var rimraf=require(_0xeb45('0x1'));var zipdir=require(_0xeb45('0x2'));var jsonpatch=require(_0xeb45('0x3'));var rp=require(_0xeb45('0x4'));var moment=require(_0xeb45('0x5'));var BPromise=require(_0xeb45('0x6'));var Mustache=require(_0xeb45('0x7'));var util=require(_0xeb45('0x8'));var path=require(_0xeb45('0x9'));var sox=require(_0xeb45('0xa'));var csv=require('to-csv');var ejs=require(_0xeb45('0xb'));var fs=require('fs');var fs_extra=require(_0xeb45('0xc'));var _=require('lodash');var squel=require(_0xeb45('0xd'));var crypto=require(_0xeb45('0xe'));var jsforce=require(_0xeb45('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeb45('0x10'));var querystring=require(_0xeb45('0x11'));var Papa=require(_0xeb45('0x12'));var Redis=require(_0xeb45('0x13'));var authService=require(_0xeb45('0x14'));var qs=require(_0xeb45('0x15'));var as=require(_0xeb45('0x16'));var hardwareService=require(_0xeb45('0x17'));var logger=require(_0xeb45('0x18'))(_0xeb45('0x19'));var utils=require(_0xeb45('0x1a'));var config=require(_0xeb45('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb45('0x1c'))['db'];function respondWithStatusCode(_0x380f18,_0x12dcc0){_0x12dcc0=_0x12dcc0||0xcc;return function(_0x3bf44b){if(_0x3bf44b){return _0x380f18[_0xeb45('0x1d')](_0x12dcc0);}return _0x380f18['status'](_0x12dcc0)[_0xeb45('0x1e')]();};}function respondWithResult(_0xe6eed1,_0x2bd3b2){_0x2bd3b2=_0x2bd3b2||0xc8;return function(_0x6fa17f){if(_0x6fa17f){return _0xe6eed1[_0xeb45('0x1f')](_0x2bd3b2)['json'](_0x6fa17f);}};}function respondWithFilteredResult(_0x3ffc89,_0x9907d1){return function(_0xa12a04){if(_0xa12a04){var _0x5a9a81=typeof _0x9907d1['offset']==='undefined'&&typeof _0x9907d1[_0xeb45('0x20')]===_0xeb45('0x21');var _0x9ae8ca=_0xa12a04['count'];var _0xc71c42=_0x5a9a81?0x0:_0x9907d1[_0xeb45('0x22')];var _0x10b352=_0x5a9a81?_0xa12a04[_0xeb45('0x23')]:_0x9907d1[_0xeb45('0x22')]+_0x9907d1[_0xeb45('0x20')];var _0x2b2bdd;if(_0x10b352>=_0x9ae8ca){_0x10b352=_0x9ae8ca;_0x2b2bdd=0xc8;}else{_0x2b2bdd=0xce;}_0x3ffc89[_0xeb45('0x1f')](_0x2b2bdd);return _0x3ffc89['set']('Content-Range',_0xc71c42+'-'+_0x10b352+'/'+_0x9ae8ca)[_0xeb45('0x24')](_0xa12a04);}return null;};}function patchUpdates(_0x3c78b8){return function(_0x3d05c8){try{jsonpatch[_0xeb45('0x25')](_0x3d05c8,_0x3c78b8,!![]);}catch(_0x5ef916){return BPromise['reject'](_0x5ef916);}return _0x3d05c8[_0xeb45('0x26')]();};}function saveUpdates(_0x5f390c,_0x3de85a){return function(_0x587a7e){if(_0x587a7e){return _0x587a7e[_0xeb45('0x27')](_0x5f390c)[_0xeb45('0x28')](function(_0x21f857){return _0x21f857;});}return null;};}function removeEntity(_0x570cda,_0x19644b){return function(_0x171a46){if(_0x171a46){return _0x171a46['destroy']()[_0xeb45('0x28')](function(){_0x570cda[_0xeb45('0x1f')](0xcc)[_0xeb45('0x1e')]();});}};}function handleEntityNotFound(_0x13fbb6,_0x40fd71){return function(_0x4b3676){if(!_0x4b3676){_0x13fbb6[_0xeb45('0x1d')](0x194);}return _0x4b3676;};}function handleError(_0x238f25,_0x44329d){_0x44329d=_0x44329d||0x1f4;return function(_0x4e21ba){logger['error'](_0x4e21ba[_0xeb45('0x29')]);if(_0x4e21ba[_0xeb45('0x2a')]){delete _0x4e21ba[_0xeb45('0x2a')];}_0x238f25[_0xeb45('0x1f')](_0x44329d)['send'](_0x4e21ba);};}exports['index']=function(_0x5dfc4a,_0x926b8d){var _0x451245={},_0x422228={},_0x46fb97={'count':0x0,'rows':[]};var _0x379d3b=_[_0xeb45('0x2b')](db['SalesforceField'][_0xeb45('0x2c')],function(_0x4415ed){return{'name':_0x4415ed[_0xeb45('0x2d')],'type':_0x4415ed[_0xeb45('0x2e')][_0xeb45('0x2f')]};});_0x422228[_0xeb45('0x30')]=_[_0xeb45('0x2b')](_0x379d3b,'name');_0x422228[_0xeb45('0x31')]=_[_0xeb45('0x32')](_0x5dfc4a[_0xeb45('0x31')]);_0x422228['filters']=_[_0xeb45('0x33')](_0x422228[_0xeb45('0x30')],_0x422228[_0xeb45('0x31')]);_0x451245[_0xeb45('0x34')]=_[_0xeb45('0x33')](_0x422228[_0xeb45('0x30')],qs['fields'](_0x5dfc4a[_0xeb45('0x31')]['fields']));_0x451245[_0xeb45('0x34')]=_0x451245[_0xeb45('0x34')][_0xeb45('0x35')]?_0x451245[_0xeb45('0x34')]:_0x422228[_0xeb45('0x30')];if(!_0x5dfc4a['query'][_0xeb45('0x36')]('nolimit')){_0x451245[_0xeb45('0x20')]=qs[_0xeb45('0x20')](_0x5dfc4a[_0xeb45('0x31')]['limit']);_0x451245['offset']=qs[_0xeb45('0x22')](_0x5dfc4a[_0xeb45('0x31')][_0xeb45('0x22')]);}_0x451245['order']=qs[_0xeb45('0x37')](_0x5dfc4a[_0xeb45('0x31')]['sort']);_0x451245[_0xeb45('0x38')]=qs[_0xeb45('0x39')](_['pick'](_0x5dfc4a[_0xeb45('0x31')],_0x422228[_0xeb45('0x39')]),_0x379d3b);if(_0x5dfc4a[_0xeb45('0x31')][_0xeb45('0x3a')]){_0x451245['where']=_[_0xeb45('0x3b')](_0x451245[_0xeb45('0x38')],{'$or':_[_0xeb45('0x2b')](_0x379d3b,function(_0x2340eb){if(_0x2340eb['type']!==_0xeb45('0x3c')){var _0x2116c6={};_0x2116c6[_0x2340eb['name']]={'$like':'%'+_0x5dfc4a[_0xeb45('0x31')][_0xeb45('0x3a')]+'%'};return _0x2116c6;}})});}_0x451245=_[_0xeb45('0x3b')]({},_0x451245,_0x5dfc4a[_0xeb45('0x3d')]);var _0x371522={'where':_0x451245['where']};return db[_0xeb45('0x3e')][_0xeb45('0x23')](_0x371522)['then'](function(_0xdfaf9a){_0x46fb97[_0xeb45('0x23')]=_0xdfaf9a;if(_0x5dfc4a['query']['includeAll']){_0x451245[_0xeb45('0x3f')]=[{'all':!![]}];}return db[_0xeb45('0x3e')][_0xeb45('0x40')](_0x451245);})['then'](function(_0x512be2){_0x46fb97[_0xeb45('0x41')]=_0x512be2;return _0x46fb97;})[_0xeb45('0x28')](respondWithFilteredResult(_0x926b8d,_0x451245))[_0xeb45('0x42')](handleError(_0x926b8d,null));};exports['show']=function(_0x1ed191,_0x5b7fad){var _0x2babc0={'raw':!![],'where':{'id':_0x1ed191['params']['id']}},_0x166141={};_0x166141[_0xeb45('0x30')]=_['keys'](db[_0xeb45('0x3e')][_0xeb45('0x2c')]);_0x166141[_0xeb45('0x31')]=_[_0xeb45('0x32')](_0x1ed191[_0xeb45('0x31')]);_0x166141['filters']=_[_0xeb45('0x33')](_0x166141[_0xeb45('0x30')],_0x166141['query']);_0x2babc0[_0xeb45('0x34')]=_[_0xeb45('0x33')](_0x166141[_0xeb45('0x30')],qs[_0xeb45('0x43')](_0x1ed191[_0xeb45('0x31')][_0xeb45('0x43')]));_0x2babc0[_0xeb45('0x34')]=_0x2babc0[_0xeb45('0x34')][_0xeb45('0x35')]?_0x2babc0['attributes']:_0x166141[_0xeb45('0x30')];if(_0x1ed191[_0xeb45('0x31')][_0xeb45('0x44')]){_0x2babc0['include']=[{'all':!![]}];}_0x2babc0=_[_0xeb45('0x3b')]({},_0x2babc0,_0x1ed191[_0xeb45('0x3d')]);return db[_0xeb45('0x3e')][_0xeb45('0x45')](_0x2babc0)['then'](handleEntityNotFound(_0x5b7fad,null))[_0xeb45('0x28')](respondWithResult(_0x5b7fad,null))[_0xeb45('0x42')](handleError(_0x5b7fad,null));};exports[_0xeb45('0x46')]=function(_0x3d3f12,_0x300c74){return db[_0xeb45('0x3e')][_0xeb45('0x46')](_0x3d3f12[_0xeb45('0x47')],{})[_0xeb45('0x28')](respondWithResult(_0x300c74,0xc9))[_0xeb45('0x42')](handleError(_0x300c74,null));};exports[_0xeb45('0x27')]=function(_0x3b8f9f,_0x4af356){if(_0x3b8f9f[_0xeb45('0x47')]['id']){delete _0x3b8f9f[_0xeb45('0x47')]['id'];}return db[_0xeb45('0x3e')][_0xeb45('0x45')]({'where':{'id':_0x3b8f9f['params']['id']}})[_0xeb45('0x28')](handleEntityNotFound(_0x4af356,null))[_0xeb45('0x28')](saveUpdates(_0x3b8f9f['body'],null))[_0xeb45('0x28')](respondWithResult(_0x4af356,null))['catch'](handleError(_0x4af356,null));};exports[_0xeb45('0x48')]=function(_0x4e189c,_0x4947b9){return db[_0xeb45('0x3e')][_0xeb45('0x45')]({'where':{'id':_0x4e189c[_0xeb45('0x49')]['id']}})[_0xeb45('0x28')](handleEntityNotFound(_0x4947b9,null))[_0xeb45('0x28')](removeEntity(_0x4947b9,null))['catch'](handleError(_0x4947b9,null));}; \ No newline at end of file +var _0x5f98=['ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x15d4e6,_0x3330c6){var _0x452ea2=function(_0x2c2972){while(--_0x2c2972){_0x15d4e6['push'](_0x15d4e6['shift']());}};_0x452ea2(++_0x3330c6);}(_0x5f98,0x11b));var _0x85f9=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5f98[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0x85f9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85f9('0x1'));var rp=require(_0x85f9('0x2'));var moment=require(_0x85f9('0x3'));var BPromise=require(_0x85f9('0x4'));var Mustache=require(_0x85f9('0x5'));var util=require(_0x85f9('0x6'));var path=require(_0x85f9('0x7'));var sox=require(_0x85f9('0x8'));var csv=require('to-csv');var ejs=require(_0x85f9('0x9'));var fs=require('fs');var fs_extra=require(_0x85f9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x85f9('0xb'));var jsforce=require(_0x85f9('0xc'));var deskjs=require(_0x85f9('0xd'));var toCsv=require(_0x85f9('0xe'));var querystring=require(_0x85f9('0xf'));var Papa=require(_0x85f9('0x10'));var Redis=require(_0x85f9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x85f9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85f9('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x85f9('0x14'));var config=require(_0x85f9('0x15'));var licenseUtil=require(_0x85f9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b1f6,_0x15537b){_0x15537b=_0x15537b||0xcc;return function(_0x1dd822){if(_0x1dd822){return _0x13b1f6[_0x85f9('0x17')](_0x15537b);}return _0x13b1f6[_0x85f9('0x18')](_0x15537b)[_0x85f9('0x19')]();};}function respondWithResult(_0x126e73,_0x1f59d5){_0x1f59d5=_0x1f59d5||0xc8;return function(_0x36e7eb){if(_0x36e7eb){return _0x126e73['status'](_0x1f59d5)[_0x85f9('0x1a')](_0x36e7eb);}};}function respondWithFilteredResult(_0x1efd25,_0x52146f){return function(_0x2c7642){if(_0x2c7642){var _0x85b910=typeof _0x52146f[_0x85f9('0x1b')]===_0x85f9('0x1c')&&typeof _0x52146f[_0x85f9('0x1d')]===_0x85f9('0x1c');var _0x4a6aaa=_0x2c7642[_0x85f9('0x1e')];var _0x18a993=_0x85b910?0x0:_0x52146f[_0x85f9('0x1b')];var _0xa7dedd=_0x85b910?_0x2c7642[_0x85f9('0x1e')]:_0x52146f[_0x85f9('0x1b')]+_0x52146f[_0x85f9('0x1d')];var _0x484743;if(_0xa7dedd>=_0x4a6aaa){_0xa7dedd=_0x4a6aaa;_0x484743=0xc8;}else{_0x484743=0xce;}_0x1efd25[_0x85f9('0x18')](_0x484743);return _0x1efd25[_0x85f9('0x1f')](_0x85f9('0x20'),_0x18a993+'-'+_0xa7dedd+'/'+_0x4a6aaa)['json'](_0x2c7642);}return null;};}function patchUpdates(_0x4b00f0){return function(_0x2d29df){try{jsonpatch[_0x85f9('0x21')](_0x2d29df,_0x4b00f0,!![]);}catch(_0x17715a){return BPromise[_0x85f9('0x22')](_0x17715a);}return _0x2d29df[_0x85f9('0x23')]();};}function saveUpdates(_0x47f8df,_0x1355e6){return function(_0x3ca68e){if(_0x3ca68e){return _0x3ca68e['update'](_0x47f8df)[_0x85f9('0x24')](function(_0x1fec3f){return _0x1fec3f;});}return null;};}function removeEntity(_0x414b23,_0xa249bf){return function(_0x5532b9){if(_0x5532b9){return _0x5532b9[_0x85f9('0x25')]()[_0x85f9('0x24')](function(){_0x414b23[_0x85f9('0x18')](0xcc)[_0x85f9('0x19')]();});}};}function handleEntityNotFound(_0x3cbb70,_0x38c31f){return function(_0x4e8de6){if(!_0x4e8de6){_0x3cbb70[_0x85f9('0x17')](0x194);}return _0x4e8de6;};}function handleError(_0x107977,_0x2b9b27){_0x2b9b27=_0x2b9b27||0x1f4;return function(_0x3185bf){logger[_0x85f9('0x26')](_0x3185bf[_0x85f9('0x27')]);if(_0x3185bf[_0x85f9('0x28')]){delete _0x3185bf[_0x85f9('0x28')];}_0x107977['status'](_0x2b9b27)[_0x85f9('0x29')](_0x3185bf);};}exports['index']=function(_0x23bae1,_0x4e1cbe){var _0x158d07={},_0x257811={},_0x45d00f={'count':0x0,'rows':[]};var _0x101459=_[_0x85f9('0x2a')](db[_0x85f9('0x2b')][_0x85f9('0x2c')],function(_0x522e2b){return{'name':_0x522e2b[_0x85f9('0x2d')],'type':_0x522e2b[_0x85f9('0x2e')][_0x85f9('0x2f')]};});_0x257811[_0x85f9('0x30')]=_[_0x85f9('0x2a')](_0x101459,_0x85f9('0x28'));_0x257811[_0x85f9('0x31')]=_[_0x85f9('0x32')](_0x23bae1[_0x85f9('0x31')]);_0x257811['filters']=_[_0x85f9('0x33')](_0x257811[_0x85f9('0x30')],_0x257811[_0x85f9('0x31')]);_0x158d07[_0x85f9('0x34')]=_[_0x85f9('0x33')](_0x257811[_0x85f9('0x30')],qs[_0x85f9('0x35')](_0x23bae1[_0x85f9('0x31')][_0x85f9('0x35')]));_0x158d07['attributes']=_0x158d07[_0x85f9('0x34')][_0x85f9('0x36')]?_0x158d07['attributes']:_0x257811[_0x85f9('0x30')];if(!_0x23bae1['query']['hasOwnProperty'](_0x85f9('0x37'))){_0x158d07[_0x85f9('0x1d')]=qs[_0x85f9('0x1d')](_0x23bae1[_0x85f9('0x31')][_0x85f9('0x1d')]);_0x158d07[_0x85f9('0x1b')]=qs[_0x85f9('0x1b')](_0x23bae1[_0x85f9('0x31')][_0x85f9('0x1b')]);}_0x158d07[_0x85f9('0x38')]=qs[_0x85f9('0x39')](_0x23bae1[_0x85f9('0x31')][_0x85f9('0x39')]);_0x158d07[_0x85f9('0x3a')]=qs[_0x85f9('0x3b')](_[_0x85f9('0x3c')](_0x23bae1[_0x85f9('0x31')],_0x257811[_0x85f9('0x3b')]),_0x101459);if(_0x23bae1[_0x85f9('0x31')][_0x85f9('0x3d')]){_0x158d07[_0x85f9('0x3a')]=_[_0x85f9('0x3e')](_0x158d07[_0x85f9('0x3a')],{'$or':_[_0x85f9('0x2a')](_0x101459,function(_0x2968e8){if(_0x2968e8[_0x85f9('0x2e')]!=='VIRTUAL'){var _0x34e849={};_0x34e849[_0x2968e8[_0x85f9('0x28')]]={'$like':'%'+_0x23bae1[_0x85f9('0x31')]['filter']+'%'};return _0x34e849;}})});}_0x158d07=_[_0x85f9('0x3e')]({},_0x158d07,_0x23bae1['options']);var _0xe7c8b3={'where':_0x158d07[_0x85f9('0x3a')]};return db[_0x85f9('0x2b')][_0x85f9('0x1e')](_0xe7c8b3)[_0x85f9('0x24')](function(_0x204021){_0x45d00f['count']=_0x204021;if(_0x23bae1[_0x85f9('0x31')][_0x85f9('0x3f')]){_0x158d07[_0x85f9('0x40')]=[{'all':!![]}];}return db[_0x85f9('0x2b')][_0x85f9('0x41')](_0x158d07);})[_0x85f9('0x24')](function(_0x4228a3){_0x45d00f[_0x85f9('0x42')]=_0x4228a3;return _0x45d00f;})[_0x85f9('0x24')](respondWithFilteredResult(_0x4e1cbe,_0x158d07))[_0x85f9('0x43')](handleError(_0x4e1cbe,null));};exports['show']=function(_0xe9535e,_0x305690){var _0x349102={'raw':!![],'where':{'id':_0xe9535e[_0x85f9('0x44')]['id']}},_0x43a542={};_0x43a542[_0x85f9('0x30')]=_['keys'](db['SalesforceField'][_0x85f9('0x2c')]);_0x43a542[_0x85f9('0x31')]=_[_0x85f9('0x32')](_0xe9535e['query']);_0x43a542[_0x85f9('0x3b')]=_[_0x85f9('0x33')](_0x43a542[_0x85f9('0x30')],_0x43a542[_0x85f9('0x31')]);_0x349102[_0x85f9('0x34')]=_[_0x85f9('0x33')](_0x43a542[_0x85f9('0x30')],qs[_0x85f9('0x35')](_0xe9535e[_0x85f9('0x31')][_0x85f9('0x35')]));_0x349102[_0x85f9('0x34')]=_0x349102[_0x85f9('0x34')]['length']?_0x349102['attributes']:_0x43a542[_0x85f9('0x30')];if(_0xe9535e[_0x85f9('0x31')][_0x85f9('0x3f')]){_0x349102[_0x85f9('0x40')]=[{'all':!![]}];}_0x349102=_[_0x85f9('0x3e')]({},_0x349102,_0xe9535e[_0x85f9('0x45')]);return db[_0x85f9('0x2b')][_0x85f9('0x46')](_0x349102)[_0x85f9('0x24')](handleEntityNotFound(_0x305690,null))[_0x85f9('0x24')](respondWithResult(_0x305690,null))[_0x85f9('0x43')](handleError(_0x305690,null));};exports[_0x85f9('0x47')]=function(_0x1d0639,_0x163fda){return db['SalesforceField'][_0x85f9('0x47')](_0x1d0639[_0x85f9('0x48')],{})[_0x85f9('0x24')](respondWithResult(_0x163fda,0xc9))[_0x85f9('0x43')](handleError(_0x163fda,null));};exports['update']=function(_0x28ab8c,_0x372af8){if(_0x28ab8c[_0x85f9('0x48')]['id']){delete _0x28ab8c[_0x85f9('0x48')]['id'];}return db[_0x85f9('0x2b')]['find']({'where':{'id':_0x28ab8c[_0x85f9('0x44')]['id']}})[_0x85f9('0x24')](handleEntityNotFound(_0x372af8,null))[_0x85f9('0x24')](saveUpdates(_0x28ab8c[_0x85f9('0x48')],null))[_0x85f9('0x24')](respondWithResult(_0x372af8,null))[_0x85f9('0x43')](handleError(_0x372af8,null));};exports[_0x85f9('0x25')]=function(_0x414afe,_0x1420c3){return db[_0x85f9('0x2b')]['find']({'where':{'id':_0x414afe['params']['id']}})[_0x85f9('0x24')](handleEntityNotFound(_0x1420c3,null))['then'](removeEntity(_0x1420c3,null))[_0x85f9('0x43')](handleError(_0x1420c3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 86042c7..db12e3b 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 _0x8d81=['../../config/logger','api','moment','path','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8d81,0x66));var _0x18d8=function(_0x4ced88,_0x24098d){_0x4ced88=_0x4ced88-0x0;var _0x205ffe=_0x8d81[_0x4ced88];return _0x205ffe;};'use strict';var _=require(_0x18d8('0x0'));var util=require(_0x18d8('0x1'));var logger=require(_0x18d8('0x2'))(_0x18d8('0x3'));var moment=require(_0x18d8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x18d8('0x5'));var rimraf=require('rimraf');var config=require(_0x18d8('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x18d8('0x7')]=function(_0x1f61ec,_0xe689){return _0x1f61ec[_0x18d8('0x8')](_0x18d8('0x9'),attributes,{'tableName':_0x18d8('0xa'),'paranoid':![],'indexes':[{'name':_0x18d8('0xb'),'fields':[_0x18d8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31e8=['idField','FieldId','util','api','bluebird','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index'];(function(_0x24f69c,_0x1fd71f){var _0x2674a5=function(_0x373c63){while(--_0x373c63){_0x24f69c['push'](_0x24f69c['shift']());}};_0x2674a5(++_0x1fd71f);}(_0x31e8,0x7a));var _0x831e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x31e8[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x831e('0x0'));var logger=require('../../config/logger')(_0x831e('0x1'));var moment=require('moment');var BPromise=require(_0x831e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x831e('0x3'));var config=require(_0x831e('0x4'));var attributes=require(_0x831e('0x5'));module[_0x831e('0x6')]=function(_0x255d85,_0x4ced11){return _0x255d85[_0x831e('0x7')]('SalesforceField',attributes,{'tableName':_0x831e('0x8'),'paranoid':![],'indexes':[{'name':_0x831e('0x9'),'fields':[_0x831e('0xa'),_0x831e('0xb')],'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 e6bc27f..3e60082 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 _0x674f=['../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x674f,0x1db));var _0xf674=function(_0xf3a49f,_0x1f2306){_0xf3a49f=_0xf3a49f-0x0;var _0x1c37f3=_0x674f[_0xf3a49f];return _0x1c37f3;};'use strict';var _=require('lodash');var util=require(_0xf674('0x0'));var moment=require(_0xf674('0x1'));var BPromise=require(_0xf674('0x2'));var rs=require(_0xf674('0x3'));var fs=require('fs');var Redis=require(_0xf674('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf674('0x5'))(_0xf674('0x6'));var config=require('../../config/environment');var jayson=require(_0xf674('0x7'));var client=jayson[_0xf674('0x8')][_0xf674('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59ed5c,_0x1b4639,_0x5033c2){return new BPromise(function(_0x1b6c2c,_0x458b30){return client['request'](_0x59ed5c,_0x5033c2)[_0xf674('0xa')](function(_0x387970){logger[_0xf674('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1b4639,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1b4639,_0xf674('0xc'),JSON[_0xf674('0xd')](_0x387970));if(_0x387970['error']){if(_0x387970[_0xf674('0xe')][_0xf674('0xf')]===0x1f4){logger[_0xf674('0xe')](_0xf674('0x10'),_0x1b4639,_0x387970['error'][_0xf674('0x11')]);return _0x458b30(_0x387970['error'][_0xf674('0x11')]);}logger[_0xf674('0xe')](_0xf674('0x10'),_0x1b4639,_0x387970[_0xf674('0xe')][_0xf674('0x11')]);return _0x1b6c2c(_0x387970[_0xf674('0xe')][_0xf674('0x11')]);}else{logger[_0xf674('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1b4639,'request\x20sent');_0x1b6c2c(_0x387970[_0xf674('0x12')][_0xf674('0x11')]);}})[_0xf674('0x13')](function(_0x3b997b){logger[_0xf674('0xe')](_0xf674('0x10'),_0x1b4639,_0x3b997b);_0x458b30(_0x3b997b);});});} \ No newline at end of file +var _0x57d4=['http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x57d4,0x6e));var _0x457d=function(_0xdb24d3,_0xb3dddb){_0xdb24d3=_0xdb24d3-0x0;var _0x4a7143=_0x57d4[_0xdb24d3];return _0x4a7143;};'use strict';var _=require('lodash');var util=require(_0x457d('0x0'));var moment=require(_0x457d('0x1'));var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x457d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d01f3,_0x292462,_0x56509e){return new BPromise(function(_0x5cc03c,_0xddda63){return client[_0x457d('0xb')](_0x5d01f3,_0x56509e)[_0x457d('0xc')](function(_0x4419fd){logger[_0x457d('0xd')]('SalesforceField,\x20%s,\x20%s',_0x292462,_0x457d('0xe'));logger[_0x457d('0xf')](_0x457d('0x10'),_0x292462,_0x457d('0xe'),JSON[_0x457d('0x11')](_0x4419fd));if(_0x4419fd[_0x457d('0x12')]){if(_0x4419fd[_0x457d('0x12')][_0x457d('0x13')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x292462,_0x4419fd[_0x457d('0x12')]['message']);return _0xddda63(_0x4419fd[_0x457d('0x12')]['message']);}logger['error'](_0x457d('0x14'),_0x292462,_0x4419fd[_0x457d('0x12')][_0x457d('0x15')]);return _0x5cc03c(_0x4419fd[_0x457d('0x12')][_0x457d('0x15')]);}else{logger[_0x457d('0xd')]('SalesforceField,\x20%s,\x20%s',_0x292462,_0x457d('0xe'));_0x5cc03c(_0x4419fd[_0x457d('0x16')][_0x457d('0x15')]);}})[_0x457d('0x17')](function(_0x306571){logger['error'](_0x457d('0x14'),_0x292462,_0x306571);_0xddda63(_0x306571);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a9fdad5..d5a061c 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 _0xd030=['index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated'];(function(_0xbdc78e,_0xe980e9){var _0x523461=function(_0x24a1f1){while(--_0x24a1f1){_0xbdc78e['push'](_0xbdc78e['shift']());}};_0x523461(++_0xe980e9);}(_0xd030,0x16c));var _0x0d03=function(_0x284fca,_0x3c8229){_0x284fca=_0x284fca-0x0;var _0x2373aa=_0xd030[_0x284fca];return _0x2373aa;};'use strict';var multer=require('multer');var util=require(_0x0d03('0x0'));var path=require('path');var timeout=require(_0x0d03('0x1'));var express=require(_0x0d03('0x2'));var router=express[_0x0d03('0x3')]();var fs_extra=require(_0x0d03('0x4'));var auth=require(_0x0d03('0x5'));var interaction=require(_0x0d03('0x6'));var config=require(_0x0d03('0x7'));var controller=require(_0x0d03('0x8'));router['get']('/',auth[_0x0d03('0x9')](),controller[_0x0d03('0xa')]);router['get'](_0x0d03('0xb'),auth['isAuthenticated'](),controller[_0x0d03('0xc')]);router[_0x0d03('0xd')](_0x0d03('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x0d03('0xf'),auth[_0x0d03('0x9')](),controller[_0x0d03('0x10')]);router[_0x0d03('0x11')]('/',auth[_0x0d03('0x9')](),controller[_0x0d03('0x12')]);router[_0x0d03('0x11')](_0x0d03('0xe'),auth[_0x0d03('0x9')](),controller[_0x0d03('0x13')]);router['put'](_0x0d03('0xb'),auth[_0x0d03('0x9')](),controller[_0x0d03('0x14')]);router['delete'](_0x0d03('0xb'),auth[_0x0d03('0x9')](),controller[_0x0d03('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb248=['/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','index','isAuthenticated','/:id/configurations'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xb248,0xc6));var _0x8b24=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb248[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0x8b24('0x0'));var util=require('util');var path=require(_0x8b24('0x1'));var timeout=require(_0x8b24('0x2'));var express=require(_0x8b24('0x3'));var router=express[_0x8b24('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b24('0x5'));var interaction=require(_0x8b24('0x6'));var config=require('../../config/environment');var controller=require(_0x8b24('0x7'));router[_0x8b24('0x8')]('/',auth['isAuthenticated'](),controller[_0x8b24('0x9')]);router[_0x8b24('0x8')]('/:id',auth[_0x8b24('0xa')](),controller['show']);router[_0x8b24('0x8')](_0x8b24('0xb'),auth[_0x8b24('0xa')](),controller['getConfigurations']);router[_0x8b24('0x8')](_0x8b24('0xc'),auth[_0x8b24('0xa')](),controller[_0x8b24('0xd')]);router[_0x8b24('0xe')]('/',auth[_0x8b24('0xa')](),controller[_0x8b24('0xf')]);router[_0x8b24('0xe')](_0x8b24('0xb'),auth[_0x8b24('0xa')](),controller[_0x8b24('0x10')]);router[_0x8b24('0x11')](_0x8b24('0x12'),auth[_0x8b24('0xa')](),controller['update']);router['delete'](_0x8b24('0x12'),auth[_0x8b24('0xa')](),controller[_0x8b24('0x13')]);module[_0x8b24('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8514da6..e96a556 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 _0xbf8d=['remoteUri','exports','STRING','username'];(function(_0xa6c61a,_0x5f26a8){var _0x13be07=function(_0x395855){while(--_0x395855){_0xa6c61a['push'](_0xa6c61a['shift']());}};_0x13be07(++_0x5f26a8);}(_0xbf8d,0x7d));var _0xdbf8=function(_0x41c63b,_0x5be343){_0x41c63b=_0x41c63b-0x0;var _0x16ca9f=_0xbf8d[_0x41c63b];return _0x16ca9f;};'use strict';var Sequelize=require('sequelize');module[_0xdbf8('0x0')]={'name':{'type':Sequelize[_0xdbf8('0x1')]},'description':{'type':Sequelize[_0xdbf8('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xdbf8('0x2')},'password':{'type':Sequelize[_0xdbf8('0x1')]},'email':{'type':Sequelize[_0xdbf8('0x1')]},'remoteUri':{'type':Sequelize[_0xdbf8('0x1')],'unique':_0xdbf8('0x3')},'serverUrl':{'type':Sequelize[_0xdbf8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1b98=['STRING','username','remoteUri','sequelize'];(function(_0x270aaa,_0x4d27f3){var _0xd6a202=function(_0x473393){while(--_0x473393){_0x270aaa['push'](_0x270aaa['shift']());}};_0xd6a202(++_0x4d27f3);}(_0x1b98,0x163));var _0x81b9=function(_0x28646f,_0x22a217){_0x28646f=_0x28646f-0x0;var _0x6d5e8c=_0x1b98[_0x28646f];return _0x6d5e8c;};'use strict';var Sequelize=require(_0x81b9('0x0'));module['exports']={'name':{'type':Sequelize[_0x81b9('0x1')]},'description':{'type':Sequelize[_0x81b9('0x1')]},'username':{'type':Sequelize[_0x81b9('0x1')],'unique':_0x81b9('0x2')},'password':{'type':Sequelize[_0x81b9('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x81b9('0x1')],'unique':_0x81b9('0x3')},'serverUrl':{'type':Sequelize[_0x81b9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 606b2b1..98b10e4 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 _0xca0e=['getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','category','parent','watch_list','upon_reject','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','severity','sla_due','comments_and_work_notes','due_date','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','statusCode','send','boolean','True','true','False','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getConfigurations','findOne','ServicenowConfiguration','nolimit','addConfiguration','AccountId','channel','Descriptions'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0xca0e,0x65));var _0xeca0=function(_0x14863c,_0x56ee4b){_0x14863c=_0x14863c-0x0;var _0x2ea58f=_0xca0e[_0x14863c];return _0x2ea58f;};'use strict';var emlformat=require(_0xeca0('0x0'));var rimraf=require(_0xeca0('0x1'));var zipdir=require(_0xeca0('0x2'));var jsonpatch=require(_0xeca0('0x3'));var rp=require(_0xeca0('0x4'));var moment=require(_0xeca0('0x5'));var BPromise=require(_0xeca0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeca0('0x7'));var sox=require(_0xeca0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeca0('0x9'));var _=require(_0xeca0('0xa'));var squel=require(_0xeca0('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeca0('0xc'));var toCsv=require(_0xeca0('0xd'));var querystring=require('querystring');var Papa=require(_0xeca0('0xe'));var Redis=require(_0xeca0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeca0('0x10'));var as=require(_0xeca0('0x11'));var hardwareService=require(_0xeca0('0x12'));var logger=require(_0xeca0('0x13'))(_0xeca0('0x14'));var utils=require(_0xeca0('0x15'));var config=require(_0xeca0('0x16'));var licenseUtil=require(_0xeca0('0x17'));var db=require(_0xeca0('0x18'))['db'];var integrations=require(_0xeca0('0x19'));function respondWithStatusCode(_0x44f873,_0x14543f){_0x14543f=_0x14543f||0xcc;return function(_0x20752c){if(_0x20752c){return _0x44f873[_0xeca0('0x1a')](_0x14543f);}return _0x44f873[_0xeca0('0x1b')](_0x14543f)[_0xeca0('0x1c')]();};}function respondWithResult(_0x49f0b7,_0x3d17f7){_0x3d17f7=_0x3d17f7||0xc8;return function(_0xb435de){if(_0xb435de){return _0x49f0b7['status'](_0x3d17f7)[_0xeca0('0x1d')](_0xb435de);}};}function respondWithFilteredResult(_0x237deb,_0x96fdaf){return function(_0x59d126){if(_0x59d126){var _0x187bfa=typeof _0x96fdaf[_0xeca0('0x1e')]===_0xeca0('0x1f')&&typeof _0x96fdaf[_0xeca0('0x20')]===_0xeca0('0x1f');var _0x8c141a=_0x59d126[_0xeca0('0x21')];var _0x4e1d2c=_0x187bfa?0x0:_0x96fdaf[_0xeca0('0x1e')];var _0x505ece=_0x187bfa?_0x59d126[_0xeca0('0x21')]:_0x96fdaf[_0xeca0('0x1e')]+_0x96fdaf[_0xeca0('0x20')];var _0x4d1531;if(_0x505ece>=_0x8c141a){_0x505ece=_0x8c141a;_0x4d1531=0xc8;}else{_0x4d1531=0xce;}_0x237deb[_0xeca0('0x1b')](_0x4d1531);return _0x237deb['set'](_0xeca0('0x22'),_0x4e1d2c+'-'+_0x505ece+'/'+_0x8c141a)['json'](_0x59d126);}return null;};}function patchUpdates(_0x20a4ef){return function(_0x423e87){try{jsonpatch[_0xeca0('0x23')](_0x423e87,_0x20a4ef,!![]);}catch(_0xf3a794){return BPromise[_0xeca0('0x24')](_0xf3a794);}return _0x423e87[_0xeca0('0x25')]();};}function saveUpdates(_0x415d98,_0xe907c){return function(_0x1d5206){if(_0x1d5206){return _0x1d5206[_0xeca0('0x26')](_0x415d98)[_0xeca0('0x27')](function(_0x366c75){return _0x366c75;});}return null;};}function removeEntity(_0x429376,_0x336850){return function(_0x4e084f){if(_0x4e084f){return _0x4e084f[_0xeca0('0x28')]()[_0xeca0('0x27')](function(){_0x429376[_0xeca0('0x1b')](0xcc)[_0xeca0('0x1c')]();});}};}function handleEntityNotFound(_0x49d610,_0x166cc0){return function(_0xadb273){if(!_0xadb273){_0x49d610[_0xeca0('0x1a')](0x194);}return _0xadb273;};}function handleError(_0xdffaaa,_0x5302fb){_0x5302fb=_0x5302fb||0x1f4;return function(_0xe56d77){logger[_0xeca0('0x29')](_0xe56d77[_0xeca0('0x2a')]);if(_0xe56d77['name']){delete _0xe56d77[_0xeca0('0x2b')];}_0xdffaaa[_0xeca0('0x1b')](_0x5302fb)['send'](_0xe56d77);};}exports['index']=function(_0x531678,_0x24768c){var _0x1f3d80={},_0x342d0c={},_0x2c2155={'count':0x0,'rows':[]};var _0x5ba4ec=_[_0xeca0('0x2c')](db[_0xeca0('0x2d')][_0xeca0('0x2e')],function(_0x58712d){return{'name':_0x58712d[_0xeca0('0x2f')],'type':_0x58712d[_0xeca0('0x30')][_0xeca0('0x31')]};});_0x342d0c[_0xeca0('0x32')]=_[_0xeca0('0x2c')](_0x5ba4ec,_0xeca0('0x2b'));_0x342d0c[_0xeca0('0x33')]=_['keys'](_0x531678['query']);_0x342d0c[_0xeca0('0x34')]=_[_0xeca0('0x35')](_0x342d0c[_0xeca0('0x32')],_0x342d0c['query']);_0x1f3d80[_0xeca0('0x36')]=_[_0xeca0('0x35')](_0x342d0c['model'],qs[_0xeca0('0x37')](_0x531678[_0xeca0('0x33')][_0xeca0('0x37')]));_0x1f3d80['attributes']=_0x1f3d80[_0xeca0('0x36')][_0xeca0('0x38')]?_0x1f3d80[_0xeca0('0x36')]:_0x342d0c[_0xeca0('0x32')];if(!_0x531678[_0xeca0('0x33')][_0xeca0('0x39')]('nolimit')){_0x1f3d80[_0xeca0('0x20')]=qs[_0xeca0('0x20')](_0x531678[_0xeca0('0x33')]['limit']);_0x1f3d80[_0xeca0('0x1e')]=qs[_0xeca0('0x1e')](_0x531678['query'][_0xeca0('0x1e')]);}_0x1f3d80[_0xeca0('0x3a')]=qs['sort'](_0x531678[_0xeca0('0x33')][_0xeca0('0x3b')]);_0x1f3d80[_0xeca0('0x3c')]=qs['filters'](_[_0xeca0('0x3d')](_0x531678[_0xeca0('0x33')],_0x342d0c[_0xeca0('0x34')]),_0x5ba4ec);if(_0x531678[_0xeca0('0x33')][_0xeca0('0x3e')]){_0x1f3d80[_0xeca0('0x3c')]=_[_0xeca0('0x3f')](_0x1f3d80[_0xeca0('0x3c')],{'$or':_[_0xeca0('0x2c')](_0x5ba4ec,function(_0x1aa821){if(_0x1aa821[_0xeca0('0x30')]!==_0xeca0('0x40')){var _0x309776={};_0x309776[_0x1aa821[_0xeca0('0x2b')]]={'$like':'%'+_0x531678[_0xeca0('0x33')]['filter']+'%'};return _0x309776;}})});}_0x1f3d80=_[_0xeca0('0x3f')]({},_0x1f3d80,_0x531678[_0xeca0('0x41')]);var _0x223d9d={'where':_0x1f3d80['where']};return db['ServicenowAccount'][_0xeca0('0x21')](_0x223d9d)[_0xeca0('0x27')](function(_0x49a922){_0x2c2155[_0xeca0('0x21')]=_0x49a922;if(_0x531678[_0xeca0('0x33')][_0xeca0('0x42')]){_0x1f3d80[_0xeca0('0x43')]=[{'all':!![]}];}return db[_0xeca0('0x2d')][_0xeca0('0x44')](_0x1f3d80);})[_0xeca0('0x27')](function(_0x181322){_0x2c2155['rows']=_0x181322;return _0x2c2155;})[_0xeca0('0x27')](respondWithFilteredResult(_0x24768c,_0x1f3d80))[_0xeca0('0x45')](handleError(_0x24768c,null));};exports[_0xeca0('0x46')]=function(_0x3c3ef8,_0x13ca7c){var _0x16bce1={'raw':![],'where':{'id':_0x3c3ef8[_0xeca0('0x47')]['id']}},_0x34c7a1={};_0x34c7a1['model']=_[_0xeca0('0x48')](db['ServicenowAccount'][_0xeca0('0x2e')]);_0x34c7a1[_0xeca0('0x33')]=_['keys'](_0x3c3ef8[_0xeca0('0x33')]);_0x34c7a1['filters']=_[_0xeca0('0x35')](_0x34c7a1['model'],_0x34c7a1[_0xeca0('0x33')]);_0x16bce1[_0xeca0('0x36')]=_['intersection'](_0x34c7a1['model'],qs[_0xeca0('0x37')](_0x3c3ef8[_0xeca0('0x33')][_0xeca0('0x37')]));_0x16bce1['attributes']=_0x16bce1[_0xeca0('0x36')][_0xeca0('0x38')]?_0x16bce1[_0xeca0('0x36')]:_0x34c7a1[_0xeca0('0x32')];if(_0x3c3ef8[_0xeca0('0x33')][_0xeca0('0x42')]){_0x16bce1[_0xeca0('0x43')]=[{'all':!![]}];}_0x16bce1=_['merge']({},_0x16bce1,_0x3c3ef8[_0xeca0('0x41')]);return db[_0xeca0('0x2d')][_0xeca0('0x49')](_0x16bce1)['then'](handleEntityNotFound(_0x13ca7c,null))[_0xeca0('0x27')](respondWithResult(_0x13ca7c,null))['catch'](handleError(_0x13ca7c,null));};exports['create']=function(_0x140670,_0x269451){return db[_0xeca0('0x2d')][_0xeca0('0x4a')](_0x140670['body'],{})[_0xeca0('0x27')](respondWithResult(_0x269451,0xc9))[_0xeca0('0x45')](handleError(_0x269451,null));};exports[_0xeca0('0x26')]=function(_0x1bf865,_0x16878b){if(_0x1bf865['body']['id']){delete _0x1bf865[_0xeca0('0x4b')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x1bf865[_0xeca0('0x47')]['id']}})[_0xeca0('0x27')](handleEntityNotFound(_0x16878b,null))[_0xeca0('0x27')](saveUpdates(_0x1bf865['body'],null))[_0xeca0('0x27')](respondWithResult(_0x16878b,null))[_0xeca0('0x45')](handleError(_0x16878b,null));};exports['destroy']=function(_0x277027,_0x492fb6){return db[_0xeca0('0x2d')][_0xeca0('0x49')]({'where':{'id':_0x277027[_0xeca0('0x47')]['id']}})[_0xeca0('0x27')](handleEntityNotFound(_0x492fb6,null))[_0xeca0('0x27')](removeEntity(_0x492fb6,null))[_0xeca0('0x45')](handleError(_0x492fb6,null));};exports[_0xeca0('0x4c')]=function(_0xf1e83c,_0x5a3a22,_0x302600){var _0x5241f2={};var _0x170e2e={};var _0xbcee6e;var _0x343194;return db[_0xeca0('0x2d')][_0xeca0('0x4d')]({'where':{'id':_0xf1e83c[_0xeca0('0x47')]['id']}})[_0xeca0('0x27')](handleEntityNotFound(_0x5a3a22,null))[_0xeca0('0x27')](function(_0x2798ee){if(_0x2798ee){_0xbcee6e=_0x2798ee;_0x170e2e['model']=_['keys'](db[_0xeca0('0x4e')][_0xeca0('0x2e')]);_0x170e2e['query']=_['keys'](_0xf1e83c[_0xeca0('0x33')]);_0x170e2e['filters']=_['intersection'](_0x170e2e[_0xeca0('0x32')],_0x170e2e[_0xeca0('0x33')]);_0x5241f2[_0xeca0('0x36')]=_['intersection'](_0x170e2e[_0xeca0('0x32')],qs['fields'](_0xf1e83c[_0xeca0('0x33')][_0xeca0('0x37')]));_0x5241f2[_0xeca0('0x36')]=_0x5241f2['attributes'][_0xeca0('0x38')]?_0x5241f2[_0xeca0('0x36')]:_0x170e2e[_0xeca0('0x32')];_0x5241f2[_0xeca0('0x3a')]=qs['sort'](_0xf1e83c['query'][_0xeca0('0x3b')]);_0x5241f2[_0xeca0('0x3c')]=qs[_0xeca0('0x34')](_[_0xeca0('0x3d')](_0xf1e83c[_0xeca0('0x33')],_0x170e2e[_0xeca0('0x34')]));if(_0xf1e83c['query']['filter']){_0x5241f2['where']=_['merge'](_0x5241f2[_0xeca0('0x3c')],{'$or':_[_0xeca0('0x2c')](_0x5241f2[_0xeca0('0x36')],function(_0x30d79b){var _0x521f86={};_0x521f86[_0x30d79b]={'$like':'%'+_0xf1e83c[_0xeca0('0x33')]['filter']+'%'};return _0x521f86;})});}_0x5241f2=_[_0xeca0('0x3f')]({},_0x5241f2,_0xf1e83c[_0xeca0('0x41')]);return _0xbcee6e[_0xeca0('0x4c')](_0x5241f2);}})[_0xeca0('0x27')](function(_0xa26b60){if(_0xa26b60){_0x343194=_0xa26b60['length'];if(!_0xf1e83c[_0xeca0('0x33')][_0xeca0('0x39')](_0xeca0('0x4f'))){_0x5241f2[_0xeca0('0x20')]=qs[_0xeca0('0x20')](_0xf1e83c[_0xeca0('0x33')][_0xeca0('0x20')]);_0x5241f2[_0xeca0('0x1e')]=qs[_0xeca0('0x1e')](_0xf1e83c[_0xeca0('0x33')][_0xeca0('0x1e')]);}return _0xbcee6e['getConfigurations'](_0x5241f2);}})[_0xeca0('0x27')](function(_0x2e2de0){if(_0x2e2de0){return _0x2e2de0?{'count':_0x343194,'rows':_0x2e2de0}:null;}})['then'](respondWithResult(_0x5a3a22,null))[_0xeca0('0x45')](handleError(_0x5a3a22,null));};exports[_0xeca0('0x50')]=function(_0x4043a3,_0x7169ae,_0x122c72){if(_0x4043a3[_0xeca0('0x4b')]['id']){delete _0x4043a3[_0xeca0('0x4b')]['id'];}return db[_0xeca0('0x2d')][_0xeca0('0x4d')]({'where':{'id':_0x4043a3['params']['id']}})[_0xeca0('0x27')](handleEntityNotFound(_0x7169ae,null))['then'](function(_0x56e77c){if(_0x56e77c){_0x4043a3['body'][_0xeca0('0x51')]=_0x56e77c['id'];_0x4043a3[_0xeca0('0x4b')]['Subjects']=integrations['getSubjects'](_0x4043a3[_0xeca0('0x4b')][_0xeca0('0x52')],_0x4043a3[_0xeca0('0x4b')][_0xeca0('0x30')]);_0x4043a3['body'][_0xeca0('0x53')]=integrations[_0xeca0('0x54')](_0x4043a3[_0xeca0('0x4b')][_0xeca0('0x52')],_0x4043a3[_0xeca0('0x4b')]['type']);return db['ServicenowConfiguration'][_0xeca0('0x4a')](_0x4043a3[_0xeca0('0x4b')],{'include':[{'model':db[_0xeca0('0x55')],'as':_0xeca0('0x56')},{'model':db[_0xeca0('0x55')],'as':_0xeca0('0x53')}]});}return null;})[_0xeca0('0x27')](respondWithResult(_0x7169ae,null))[_0xeca0('0x45')](handleError(_0x7169ae,null));};exports[_0xeca0('0x57')]=function(_0xb77946,_0x2ae03d,_0x7186df){var _0x37833c=[_0xeca0('0x58'),_0xeca0('0x59'),_0xeca0('0x5a'),_0xeca0('0x5b'),_0xeca0('0x5c'),_0xeca0('0x5d'),'incident_state','severity',_0xeca0('0x5e')];var _0x26648a=[_0xeca0('0x5f'),_0xeca0('0x58'),'caused_by',_0xeca0('0x60'),_0xeca0('0x61'),'sys_updated_on','child_incidents',_0xeca0('0x59'),_0xeca0('0x62'),_0xeca0('0x63'),'resolved_by',_0xeca0('0x64'),_0xeca0('0x65'),_0xeca0('0x66'),_0xeca0('0x67'),_0xeca0('0x68'),'state',_0xeca0('0x69'),_0xeca0('0x5a'),_0xeca0('0x3a'),'calendar_stc',_0xeca0('0x6a'),'cmdb_ci',_0xeca0('0x6b'),_0xeca0('0x6c'),_0xeca0('0x6d'),_0xeca0('0x6e'),_0xeca0('0x6f'),'priority',_0xeca0('0x70'),_0xeca0('0x71'),_0xeca0('0x72'),_0xeca0('0x73'),_0xeca0('0x74'),_0xeca0('0x75'),_0xeca0('0x76'),_0xeca0('0x77'),_0xeca0('0x78'),_0xeca0('0x79'),_0xeca0('0x7a'),_0xeca0('0x7b'),'subcategory',_0xeca0('0x7c'),'short_description','close_code',_0xeca0('0x7d'),_0xeca0('0x7e'),_0xeca0('0x7f'),_0xeca0('0x80'),'business_stc',_0xeca0('0x81'),'description',_0xeca0('0x82'),_0xeca0('0x5d'),'sys_class_name',_0xeca0('0x83'),'closed_by',_0xeca0('0x84'),_0xeca0('0x85'),_0xeca0('0x86'),_0xeca0('0x87'),_0xeca0('0x88'),'incident_state',_0xeca0('0x89'),_0xeca0('0x8a'),_0xeca0('0x8b'),_0xeca0('0x8c'),_0xeca0('0x8d'),'assigned_to',_0xeca0('0x8e'),'comments',_0xeca0('0x8f'),'approval',_0xeca0('0x90'),_0xeca0('0x91'),'sys_mod_count','reopen_count','sys_tags',_0xeca0('0x92'),_0xeca0('0x93'),_0xeca0('0x94'),_0xeca0('0x95'),_0xeca0('0x5e')];var _0x191fdd='';var _0x2d4fd4='';var _0xd46e7c=[];var _0x295213='';var _0x49f3dd='';var _0x33c881=[];var _0x76e441='';var _0x22d7c1='';var _0x44f99c={};var _0xa8ad94='';return db[_0xeca0('0x2d')][_0xeca0('0x4d')]({'where':{'id':_0xb77946['params']['id']},'attributes':['id',_0xeca0('0x96'),_0xeca0('0x97'),_0xeca0('0x98'),_0xeca0('0x99'),'serverUrl']})['then'](handleEntityNotFound(_0x2ae03d,null))['then'](function(_0x1be425){if(_0x1be425){_0xa8ad94=_0x1be425[_0xeca0('0x99')];var _0x335584=_0xa8ad94[_0xeca0('0x9a')](-0x1);if(_0x335584==='/'){_0xa8ad94=_0xa8ad94[_0xeca0('0x9b')](0x0,_0xa8ad94[_0xeca0('0x9c')](_0x335584));}_0x22d7c1=util[_0xeca0('0x9d')](_0xeca0('0x9e'),_0xa8ad94);_0x76e441=util[_0xeca0('0x9d')]('%s/api/now/table/',_0xa8ad94);_0x44f99c={'user':_0x1be425[_0xeca0('0x96')],'pass':_0x1be425[_0xeca0('0x97')]};var _0xb07e7e={'method':_0xeca0('0x9f'),'uri':_0x22d7c1+_0xeca0('0xa0'),'auth':_0x44f99c,'json':!![]};return rp(_0xb07e7e);}})[_0xeca0('0x27')](function(_0x40eb02){if(_0x40eb02[_0xeca0('0xa1')][_0xeca0('0x38')]>0x0){_0x191fdd=_0x40eb02['result'];}console[_0xeca0('0xa2')](_0xeca0('0xa3'),_0x191fdd);_0x33c881=[];_0x2d4fd4=Object[_0xeca0('0xa4')]([],_0x191fdd);_[_0xeca0('0xa5')](_0x2d4fd4,function(_0x85f852){return!_0x37833c[_0xeca0('0xa6')](_0x85f852['name']);});_0x2d4fd4[_0xeca0('0xa7')](function(_0x52620a){var _0x27380b=createFieldObject(_0x76e441,_0x44f99c,_0x52620a[_0xeca0('0xa8')],_0x52620a['name'],_0x52620a['label'],![]);_0x33c881[_0xeca0('0xa9')](_0x27380b);});return Promise[_0xeca0('0xaa')](_0x33c881);})[_0xeca0('0x27')](function(_0x24e2e0){_0xd46e7c=_0x24e2e0;_0x295213=Object['assign']([],_0x191fdd);console['log'](_0xeca0('0xab'),_0x191fdd);_[_0xeca0('0xa5')](_0x295213,function(_0xefb648){return _0x26648a[_0xeca0('0xa6')](_0xefb648[_0xeca0('0x2b')]);});console[_0xeca0('0xa2')](_0xeca0('0xac'),_0x295213);_0x33c881=[];_0x295213['forEach'](function(_0x4ae0ae){var _0x2cc3d3=createFieldObject(_0x76e441,_0x44f99c,_0x4ae0ae['internalType'],_0x4ae0ae[_0xeca0('0x2b')],_0x4ae0ae[_0xeca0('0xad')],!![]);_0x33c881[_0xeca0('0xa9')](_0x2cc3d3);});return Promise[_0xeca0('0xaa')](_0x33c881);})['then'](function(_0x212308){_0x49f3dd=_0x212308;var _0xccb5a7=_0xd46e7c[_0xeca0('0xae')](_0x49f3dd);return{'count':_0xccb5a7[_0xeca0('0x38')],'rows':_0xccb5a7};})[_0xeca0('0x27')](respondWithResult(_0x2ae03d,null))[_0xeca0('0x45')](function(_0x35f728){console['log'](_0xeca0('0xaf')+_0x35f728);var _0x14b23b=_0xb77946[_0xeca0('0x33')][_0xeca0('0xb0')]?0x1f4:_0x35f728[_0xeca0('0xb1')]||0x1f4;logger[_0xeca0('0x29')](_0x35f728[_0xeca0('0x2a')]);delete _0x35f728[_0xeca0('0x2b')];if(_0x14b23b===0x191){_0x14b23b=0x190;}_0x2ae03d['status'](_0x14b23b)[_0xeca0('0xb2')](_0xb77946[_0xeca0('0x33')][_0xeca0('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x35f728[_0xeca0('0xb1')]}:_0x35f728);});};function createFieldObject(_0x348db4,_0x249ed9,_0x194c14,_0x2bc611,_0x6a8c52,_0x2cbb69){return new Promise(function(_0x47e17f,_0x3a17a1){var _0xb89ad3={'id':_0x2bc611,'name':_0x6a8c52,'custom':_0x2cbb69};if(_0x194c14===_0xeca0('0xb3')){_0xb89ad3[_0xeca0('0x41')]=[{'name':_0xeca0('0xb4'),'value':_0xeca0('0xb5')},{'name':_0xeca0('0xb6'),'value':'false'}];_0x47e17f(_0xb89ad3);}else{var _0x293877={'method':_0xeca0('0x9f'),'uri':_0x348db4+'sys_choice?sysparm_query=name=incident^element='+_0x2bc611,'auth':_0x249ed9,'json':!![]};return rp(_0x293877)[_0xeca0('0x27')](function(_0xf2a91c){var _0x1dd491=[];if(_0xf2a91c[_0xeca0('0xa1')][_0xeca0('0x38')]>0x0){_0xf2a91c[_0xeca0('0xa1')][_0xeca0('0xa7')](function(_0x58fd32){if(_0x58fd32[_0xeca0('0xb7')]==='false'){var _0x203839={'name':_0x58fd32['label'],'value':_0x58fd32[_0xeca0('0xb8')]};_0x1dd491[_0xeca0('0xa9')](_0x203839);}});}_0xb89ad3[_0xeca0('0x41')]=_0x1dd491;if(_0xb89ad3['options'][_0xeca0('0x38')]>0x0){_0x47e17f(_0xb89ad3);}else{if(_0x2cbb69==![]){_0x47e17f();}else{_0x47e17f(_0xb89ad3);}}});}});} \ No newline at end of file +var _0x190e=['priority','time_worked','business_duration','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','remove','internalType','label','all','assign','log','forEach','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','ServicenowConfiguration','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','caused_by','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service'];(function(_0x1a7f92,_0x197dd2){var _0x533446=function(_0x528074){while(--_0x528074){_0x1a7f92['push'](_0x1a7f92['shift']());}};_0x533446(++_0x197dd2);}(_0x190e,0x1a8));var _0xe190=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x190e[_0x3b0912];return _0xa8f339;};'use strict';var emlformat=require(_0xe190('0x0'));var rimraf=require(_0xe190('0x1'));var zipdir=require(_0xe190('0x2'));var jsonpatch=require(_0xe190('0x3'));var rp=require(_0xe190('0x4'));var moment=require('moment');var BPromise=require(_0xe190('0x5'));var Mustache=require(_0xe190('0x6'));var util=require('util');var path=require(_0xe190('0x7'));var sox=require(_0xe190('0x8'));var csv=require(_0xe190('0x9'));var ejs=require(_0xe190('0xa'));var fs=require('fs');var fs_extra=require(_0xe190('0xb'));var _=require('lodash');var squel=require(_0xe190('0xc'));var crypto=require(_0xe190('0xd'));var jsforce=require(_0xe190('0xe'));var deskjs=require(_0xe190('0xf'));var toCsv=require(_0xe190('0x9'));var querystring=require(_0xe190('0x10'));var Papa=require(_0xe190('0x11'));var Redis=require('ioredis');var authService=require(_0xe190('0x12'));var qs=require(_0xe190('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe190('0x14'));var logger=require('../../config/logger')(_0xe190('0x15'));var utils=require(_0xe190('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1aa678,_0x2ac35e){_0x2ac35e=_0x2ac35e||0xcc;return function(_0x3a204d){if(_0x3a204d){return _0x1aa678[_0xe190('0x17')](_0x2ac35e);}return _0x1aa678[_0xe190('0x18')](_0x2ac35e)[_0xe190('0x19')]();};}function respondWithResult(_0x327502,_0xa4508e){_0xa4508e=_0xa4508e||0xc8;return function(_0x5d4492){if(_0x5d4492){return _0x327502[_0xe190('0x18')](_0xa4508e)['json'](_0x5d4492);}};}function respondWithFilteredResult(_0x5e4980,_0x233fa6){return function(_0x42d892){if(_0x42d892){var _0xdff061=typeof _0x233fa6[_0xe190('0x1a')]===_0xe190('0x1b')&&typeof _0x233fa6[_0xe190('0x1c')]==='undefined';var _0x4eab20=_0x42d892[_0xe190('0x1d')];var _0x1b7129=_0xdff061?0x0:_0x233fa6[_0xe190('0x1a')];var _0x55f6f6=_0xdff061?_0x42d892[_0xe190('0x1d')]:_0x233fa6[_0xe190('0x1a')]+_0x233fa6[_0xe190('0x1c')];var _0x2fc98e;if(_0x55f6f6>=_0x4eab20){_0x55f6f6=_0x4eab20;_0x2fc98e=0xc8;}else{_0x2fc98e=0xce;}_0x5e4980[_0xe190('0x18')](_0x2fc98e);return _0x5e4980[_0xe190('0x1e')](_0xe190('0x1f'),_0x1b7129+'-'+_0x55f6f6+'/'+_0x4eab20)['json'](_0x42d892);}return null;};}function patchUpdates(_0x679b2b){return function(_0x13a474){try{jsonpatch['apply'](_0x13a474,_0x679b2b,!![]);}catch(_0x215c23){return BPromise[_0xe190('0x20')](_0x215c23);}return _0x13a474[_0xe190('0x21')]();};}function saveUpdates(_0x53c776,_0x4fee08){return function(_0x308fe5){if(_0x308fe5){return _0x308fe5[_0xe190('0x22')](_0x53c776)[_0xe190('0x23')](function(_0x391452){return _0x391452;});}return null;};}function removeEntity(_0x45059a,_0x14b712){return function(_0x393836){if(_0x393836){return _0x393836[_0xe190('0x24')]()[_0xe190('0x23')](function(){_0x45059a[_0xe190('0x18')](0xcc)[_0xe190('0x19')]();});}};}function handleEntityNotFound(_0x2f71b3,_0x19989a){return function(_0x4ad172){if(!_0x4ad172){_0x2f71b3['sendStatus'](0x194);}return _0x4ad172;};}function handleError(_0xe6df6d,_0x40748f){_0x40748f=_0x40748f||0x1f4;return function(_0x7616bd){logger[_0xe190('0x25')](_0x7616bd[_0xe190('0x26')]);if(_0x7616bd[_0xe190('0x27')]){delete _0x7616bd[_0xe190('0x27')];}_0xe6df6d[_0xe190('0x18')](_0x40748f)['send'](_0x7616bd);};}exports[_0xe190('0x28')]=function(_0x512f6e,_0x52af61){var _0x10fcd3={},_0x581882={},_0x357929={'count':0x0,'rows':[]};var _0x44731b=_[_0xe190('0x29')](db[_0xe190('0x2a')][_0xe190('0x2b')],function(_0x407f15){return{'name':_0x407f15[_0xe190('0x2c')],'type':_0x407f15['type'][_0xe190('0x2d')]};});_0x581882['model']=_[_0xe190('0x29')](_0x44731b,'name');_0x581882[_0xe190('0x2e')]=_['keys'](_0x512f6e[_0xe190('0x2e')]);_0x581882[_0xe190('0x2f')]=_[_0xe190('0x30')](_0x581882[_0xe190('0x31')],_0x581882[_0xe190('0x2e')]);_0x10fcd3[_0xe190('0x32')]=_['intersection'](_0x581882['model'],qs[_0xe190('0x33')](_0x512f6e[_0xe190('0x2e')][_0xe190('0x33')]));_0x10fcd3[_0xe190('0x32')]=_0x10fcd3[_0xe190('0x32')]['length']?_0x10fcd3[_0xe190('0x32')]:_0x581882[_0xe190('0x31')];if(!_0x512f6e[_0xe190('0x2e')][_0xe190('0x34')](_0xe190('0x35'))){_0x10fcd3[_0xe190('0x1c')]=qs['limit'](_0x512f6e[_0xe190('0x2e')]['limit']);_0x10fcd3[_0xe190('0x1a')]=qs[_0xe190('0x1a')](_0x512f6e[_0xe190('0x2e')]['offset']);}_0x10fcd3[_0xe190('0x36')]=qs['sort'](_0x512f6e[_0xe190('0x2e')][_0xe190('0x37')]);_0x10fcd3['where']=qs[_0xe190('0x2f')](_[_0xe190('0x38')](_0x512f6e['query'],_0x581882[_0xe190('0x2f')]),_0x44731b);if(_0x512f6e['query'][_0xe190('0x39')]){_0x10fcd3[_0xe190('0x3a')]=_['merge'](_0x10fcd3[_0xe190('0x3a')],{'$or':_[_0xe190('0x29')](_0x44731b,function(_0x51f46f){if(_0x51f46f['type']!==_0xe190('0x3b')){var _0x2ed307={};_0x2ed307[_0x51f46f[_0xe190('0x27')]]={'$like':'%'+_0x512f6e['query']['filter']+'%'};return _0x2ed307;}})});}_0x10fcd3=_[_0xe190('0x3c')]({},_0x10fcd3,_0x512f6e['options']);var _0x397a43={'where':_0x10fcd3[_0xe190('0x3a')]};return db['ServicenowAccount'][_0xe190('0x1d')](_0x397a43)[_0xe190('0x23')](function(_0x2bea95){_0x357929[_0xe190('0x1d')]=_0x2bea95;if(_0x512f6e[_0xe190('0x2e')][_0xe190('0x3d')]){_0x10fcd3[_0xe190('0x3e')]=[{'all':!![]}];}return db[_0xe190('0x2a')][_0xe190('0x3f')](_0x10fcd3);})[_0xe190('0x23')](function(_0x276aad){_0x357929[_0xe190('0x40')]=_0x276aad;return _0x357929;})[_0xe190('0x23')](respondWithFilteredResult(_0x52af61,_0x10fcd3))[_0xe190('0x41')](handleError(_0x52af61,null));};exports[_0xe190('0x42')]=function(_0x57d804,_0x11d843){var _0x4a3f8b={'raw':![],'where':{'id':_0x57d804[_0xe190('0x43')]['id']}},_0x2b9895={};_0x2b9895['model']=_['keys'](db[_0xe190('0x2a')][_0xe190('0x2b')]);_0x2b9895[_0xe190('0x2e')]=_[_0xe190('0x44')](_0x57d804[_0xe190('0x2e')]);_0x2b9895[_0xe190('0x2f')]=_[_0xe190('0x30')](_0x2b9895[_0xe190('0x31')],_0x2b9895[_0xe190('0x2e')]);_0x4a3f8b[_0xe190('0x32')]=_[_0xe190('0x30')](_0x2b9895[_0xe190('0x31')],qs[_0xe190('0x33')](_0x57d804['query']['fields']));_0x4a3f8b[_0xe190('0x32')]=_0x4a3f8b[_0xe190('0x32')][_0xe190('0x45')]?_0x4a3f8b[_0xe190('0x32')]:_0x2b9895[_0xe190('0x31')];if(_0x57d804[_0xe190('0x2e')][_0xe190('0x3d')]){_0x4a3f8b[_0xe190('0x3e')]=[{'all':!![]}];}_0x4a3f8b=_['merge']({},_0x4a3f8b,_0x57d804[_0xe190('0x46')]);return db['ServicenowAccount']['find'](_0x4a3f8b)[_0xe190('0x23')](handleEntityNotFound(_0x11d843,null))['then'](respondWithResult(_0x11d843,null))['catch'](handleError(_0x11d843,null));};exports[_0xe190('0x47')]=function(_0x429570,_0x3c5487){return db['ServicenowAccount'][_0xe190('0x47')](_0x429570['body'],{})[_0xe190('0x23')](respondWithResult(_0x3c5487,0xc9))[_0xe190('0x41')](handleError(_0x3c5487,null));};exports[_0xe190('0x22')]=function(_0x575b3c,_0x4b6337){if(_0x575b3c[_0xe190('0x48')]['id']){delete _0x575b3c[_0xe190('0x48')]['id'];}return db['ServicenowAccount'][_0xe190('0x49')]({'where':{'id':_0x575b3c['params']['id']}})[_0xe190('0x23')](handleEntityNotFound(_0x4b6337,null))[_0xe190('0x23')](saveUpdates(_0x575b3c[_0xe190('0x48')],null))[_0xe190('0x23')](respondWithResult(_0x4b6337,null))[_0xe190('0x41')](handleError(_0x4b6337,null));};exports[_0xe190('0x24')]=function(_0x59716f,_0x369492){return db[_0xe190('0x2a')][_0xe190('0x49')]({'where':{'id':_0x59716f['params']['id']}})[_0xe190('0x23')](handleEntityNotFound(_0x369492,null))[_0xe190('0x23')](removeEntity(_0x369492,null))[_0xe190('0x41')](handleError(_0x369492,null));};exports[_0xe190('0x4a')]=function(_0xf85f5d,_0x57b058,_0x536b70){var _0x4a2871={};var _0x5e7ec9={};var _0x1c30cc;var _0x3f1d4e;return db[_0xe190('0x2a')][_0xe190('0x4b')]({'where':{'id':_0xf85f5d[_0xe190('0x43')]['id']}})['then'](handleEntityNotFound(_0x57b058,null))[_0xe190('0x23')](function(_0x16b65e){if(_0x16b65e){_0x1c30cc=_0x16b65e;_0x5e7ec9[_0xe190('0x31')]=_[_0xe190('0x44')](db['ServicenowConfiguration'][_0xe190('0x2b')]);_0x5e7ec9['query']=_[_0xe190('0x44')](_0xf85f5d['query']);_0x5e7ec9[_0xe190('0x2f')]=_['intersection'](_0x5e7ec9['model'],_0x5e7ec9[_0xe190('0x2e')]);_0x4a2871['attributes']=_['intersection'](_0x5e7ec9[_0xe190('0x31')],qs[_0xe190('0x33')](_0xf85f5d[_0xe190('0x2e')][_0xe190('0x33')]));_0x4a2871[_0xe190('0x32')]=_0x4a2871[_0xe190('0x32')][_0xe190('0x45')]?_0x4a2871[_0xe190('0x32')]:_0x5e7ec9[_0xe190('0x31')];_0x4a2871[_0xe190('0x36')]=qs[_0xe190('0x37')](_0xf85f5d[_0xe190('0x2e')][_0xe190('0x37')]);_0x4a2871[_0xe190('0x3a')]=qs[_0xe190('0x2f')](_['pick'](_0xf85f5d[_0xe190('0x2e')],_0x5e7ec9['filters']));if(_0xf85f5d['query'][_0xe190('0x39')]){_0x4a2871['where']=_[_0xe190('0x3c')](_0x4a2871[_0xe190('0x3a')],{'$or':_['map'](_0x4a2871[_0xe190('0x32')],function(_0xe49698){var _0x30427b={};_0x30427b[_0xe49698]={'$like':'%'+_0xf85f5d[_0xe190('0x2e')][_0xe190('0x39')]+'%'};return _0x30427b;})});}_0x4a2871=_['merge']({},_0x4a2871,_0xf85f5d[_0xe190('0x46')]);return _0x1c30cc[_0xe190('0x4a')](_0x4a2871);}})[_0xe190('0x23')](function(_0x3ac412){if(_0x3ac412){_0x3f1d4e=_0x3ac412['length'];if(!_0xf85f5d[_0xe190('0x2e')][_0xe190('0x34')](_0xe190('0x35'))){_0x4a2871[_0xe190('0x1c')]=qs[_0xe190('0x1c')](_0xf85f5d['query']['limit']);_0x4a2871[_0xe190('0x1a')]=qs[_0xe190('0x1a')](_0xf85f5d[_0xe190('0x2e')]['offset']);}return _0x1c30cc['getConfigurations'](_0x4a2871);}})[_0xe190('0x23')](function(_0x179ddd){if(_0x179ddd){return _0x179ddd?{'count':_0x3f1d4e,'rows':_0x179ddd}:null;}})['then'](respondWithResult(_0x57b058,null))['catch'](handleError(_0x57b058,null));};exports[_0xe190('0x4c')]=function(_0x3dc1f0,_0x52b313,_0x120d79){if(_0x3dc1f0['body']['id']){delete _0x3dc1f0[_0xe190('0x48')]['id'];}return db[_0xe190('0x2a')][_0xe190('0x4b')]({'where':{'id':_0x3dc1f0[_0xe190('0x43')]['id']}})['then'](handleEntityNotFound(_0x52b313,null))[_0xe190('0x23')](function(_0x301446){if(_0x301446){_0x3dc1f0['body']['AccountId']=_0x301446['id'];_0x3dc1f0[_0xe190('0x48')][_0xe190('0x4d')]=integrations[_0xe190('0x4e')](_0x3dc1f0[_0xe190('0x48')][_0xe190('0x4f')],_0x3dc1f0[_0xe190('0x48')][_0xe190('0x50')]);_0x3dc1f0['body'][_0xe190('0x51')]=integrations['getDescriptions'](_0x3dc1f0[_0xe190('0x48')][_0xe190('0x4f')],_0x3dc1f0[_0xe190('0x48')]['type']);return db[_0xe190('0x52')]['create'](_0x3dc1f0[_0xe190('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xe190('0x4d')},{'model':db['ServicenowField'],'as':_0xe190('0x51')}]});}return null;})['then'](respondWithResult(_0x52b313,null))[_0xe190('0x41')](handleError(_0x52b313,null));};exports['getFields']=function(_0x4b0664,_0x39d2d3,_0xfe2f7d){var _0x16c78a=[_0xe190('0x53'),_0xe190('0x54'),'knowledge',_0xe190('0x55'),_0xe190('0x56'),'notify',_0xe190('0x57'),_0xe190('0x58'),_0xe190('0x59')];var _0x5b8155=[_0xe190('0x5a'),_0xe190('0x53'),_0xe190('0x5b'),'watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason',_0xe190('0x5c'),'number',_0xe190('0x5d'),_0xe190('0x5e'),_0xe190('0x5f'),_0xe190('0x60'),_0xe190('0x61'),_0xe190('0x62'),_0xe190('0x63'),_0xe190('0x64'),_0xe190('0x65'),_0xe190('0x36'),_0xe190('0x66'),_0xe190('0x67'),_0xe190('0x68'),_0xe190('0x69'),_0xe190('0x6a'),_0xe190('0x6b'),_0xe190('0x6c'),_0xe190('0x6d'),_0xe190('0x6e'),'sys_domain_path','rfc',_0xe190('0x6f'),'expected_start','opened_at',_0xe190('0x70'),'group_list','work_end',_0xe190('0x71'),_0xe190('0x72'),'caller_id',_0xe190('0x73'),_0xe190('0x55'),_0xe190('0x74'),_0xe190('0x75'),_0xe190('0x56'),_0xe190('0x76'),'delivery_task','work_start','assignment_group','business_stc',_0xe190('0x77'),_0xe190('0x78'),'calendar_duration',_0xe190('0x79'),_0xe190('0x7a'),_0xe190('0x7b'),_0xe190('0x7c'),_0xe190('0x7d'),_0xe190('0x7e'),_0xe190('0x7f'),_0xe190('0x80'),_0xe190('0x81'),_0xe190('0x57'),_0xe190('0x82'),_0xe190('0x83'),_0xe190('0x84'),_0xe190('0x85'),_0xe190('0x86'),_0xe190('0x87'),'severity','comments',_0xe190('0x88'),_0xe190('0x89'),'comments_and_work_notes',_0xe190('0x8a'),_0xe190('0x8b'),_0xe190('0x8c'),_0xe190('0x8d'),_0xe190('0x8e'),_0xe190('0x8f'),_0xe190('0x90'),_0xe190('0x91'),'category'];var _0x86058c='';var _0x3a87f0='';var _0x2b3062=[];var _0xa3318='';var _0x547cc1='';var _0x4ddfba=[];var _0x2984d3='';var _0x12e6b1='';var _0x1c5e99={};var _0x49c365='';return db[_0xe190('0x2a')]['findOne']({'where':{'id':_0x4b0664[_0xe190('0x43')]['id']},'attributes':['id',_0xe190('0x92'),_0xe190('0x93'),'email',_0xe190('0x94'),_0xe190('0x95')]})[_0xe190('0x23')](handleEntityNotFound(_0x39d2d3,null))[_0xe190('0x23')](function(_0x14c280){if(_0x14c280){_0x49c365=_0x14c280[_0xe190('0x94')];var _0x143a1a=_0x49c365[_0xe190('0x96')](-0x1);if(_0x143a1a==='/'){_0x49c365=_0x49c365[_0xe190('0x97')](0x0,_0x49c365[_0xe190('0x98')](_0x143a1a));}_0x12e6b1=util[_0xe190('0x99')](_0xe190('0x9a'),_0x49c365);_0x2984d3=util[_0xe190('0x99')]('%s/api/now/table/',_0x49c365);_0x1c5e99={'user':_0x14c280[_0xe190('0x92')],'pass':_0x14c280[_0xe190('0x93')]};var _0x2abf0e={'method':'GET','uri':_0x12e6b1+_0xe190('0x9b'),'auth':_0x1c5e99,'json':!![]};return rp(_0x2abf0e);}})[_0xe190('0x23')](function(_0x3fd6e7){if(_0x3fd6e7[_0xe190('0x9c')][_0xe190('0x45')]>0x0){_0x86058c=_0x3fd6e7[_0xe190('0x9c')];}console['log']('incident\x20table\x20objects',_0x86058c);_0x4ddfba=[];_0x3a87f0=Object['assign']([],_0x86058c);_[_0xe190('0x9d')](_0x3a87f0,function(_0x3b1369){return!_0x16c78a['includes'](_0x3b1369['name']);});_0x3a87f0['forEach'](function(_0x314b53){var _0x48942b=createFieldObject(_0x2984d3,_0x1c5e99,_0x314b53[_0xe190('0x9e')],_0x314b53[_0xe190('0x27')],_0x314b53[_0xe190('0x9f')],![]);_0x4ddfba['push'](_0x48942b);});return Promise[_0xe190('0xa0')](_0x4ddfba);})[_0xe190('0x23')](function(_0x66ccca){_0x2b3062=_0x66ccca;_0xa3318=Object[_0xe190('0xa1')]([],_0x86058c);console[_0xe190('0xa2')]('TCL:\x20_object',_0x86058c);_[_0xe190('0x9d')](_0xa3318,function(_0x285173){return _0x5b8155['includes'](_0x285173[_0xe190('0x27')]);});console[_0xe190('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xa3318);_0x4ddfba=[];_0xa3318[_0xe190('0xa3')](function(_0x566405){var _0x283e6f=createFieldObject(_0x2984d3,_0x1c5e99,_0x566405[_0xe190('0x9e')],_0x566405[_0xe190('0x27')],_0x566405[_0xe190('0x9f')],!![]);_0x4ddfba['push'](_0x283e6f);});return Promise[_0xe190('0xa0')](_0x4ddfba);})[_0xe190('0x23')](function(_0x32bf12){_0x547cc1=_0x32bf12;var _0x4b54dc=_0x2b3062['concat'](_0x547cc1);return{'count':_0x4b54dc[_0xe190('0x45')],'rows':_0x4b54dc};})[_0xe190('0x23')](respondWithResult(_0x39d2d3,null))[_0xe190('0x41')](function(_0x693e16){console[_0xe190('0xa2')](_0xe190('0xa4')+_0x693e16);var _0x3b343c=_0x4b0664['query'][_0xe190('0xa5')]?0x1f4:_0x693e16[_0xe190('0xa6')]||0x1f4;logger['error'](_0x693e16[_0xe190('0x26')]);delete _0x693e16[_0xe190('0x27')];if(_0x3b343c===0x191){_0x3b343c=0x190;}_0x39d2d3['status'](_0x3b343c)['send'](_0x4b0664['query'][_0xe190('0xa5')]?{'message':_0xe190('0xa7'),'statusCode':_0x693e16['statusCode']}:_0x693e16);});};function createFieldObject(_0xd3aab5,_0x4f7c9a,_0x2318a4,_0x3087e9,_0x3c4afd,_0x53afb4){return new Promise(function(_0x65da0,_0x234344){var _0x7c23ce={'id':_0x3087e9,'name':_0x3c4afd,'custom':_0x53afb4};if(_0x2318a4===_0xe190('0xa8')){_0x7c23ce[_0xe190('0x46')]=[{'name':_0xe190('0xa9'),'value':_0xe190('0xaa')},{'name':_0xe190('0xab'),'value':_0xe190('0xac')}];_0x65da0(_0x7c23ce);}else{var _0x12e908={'method':_0xe190('0xad'),'uri':_0xd3aab5+_0xe190('0xae')+_0x3087e9,'auth':_0x4f7c9a,'json':!![]};return rp(_0x12e908)['then'](function(_0x407078){var _0x4e7d5f=[];if(_0x407078[_0xe190('0x9c')][_0xe190('0x45')]>0x0){_0x407078['result']['forEach'](function(_0x38dce3){if(_0x38dce3[_0xe190('0xaf')]===_0xe190('0xac')){var _0x347373={'name':_0x38dce3['label'],'value':_0x38dce3[_0xe190('0xb0')]};_0x4e7d5f[_0xe190('0xb1')](_0x347373);}});}_0x7c23ce['options']=_0x4e7d5f;if(_0x7c23ce[_0xe190('0x46')][_0xe190('0x45')]>0x0){_0x65da0(_0x7c23ce);}else{if(_0x53afb4==![]){_0x65da0();}else{_0x65da0(_0x7c23ce);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b0cc7c5..04f8bca 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 _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0xf2ca[_0x1aa13e];return _0x1144bd;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da7=['../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7da7,0x10d));var _0x77da=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x7da7[_0x5e2cb4];return _0x282902;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x77da('0x7'));module[_0x77da('0x8')]=function(_0x47da81,_0x30afe0){return _0x47da81['define'](_0x77da('0x9'),attributes,{'tableName':_0x77da('0xa'),'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 db798a9..eaa0dc6 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 _0x025f=['map','model','include','debug','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit'];(function(_0xc06594,_0x3e9cd1){var _0x437131=function(_0xb5472b){while(--_0xb5472b){_0xc06594['push'](_0xc06594['shift']());}};_0x437131(++_0x3e9cd1);}(_0x025f,0x66));var _0xf025=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x025f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xf025('0x0'));var moment=require(_0xf025('0x1'));var BPromise=require(_0xf025('0x2'));var rs=require(_0xf025('0x3'));var fs=require('fs');var Redis=require(_0xf025('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf025('0x5'))(_0xf025('0x6'));var config=require('../../config/environment');var jayson=require(_0xf025('0x7'));var client=jayson[_0xf025('0x8')][_0xf025('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f405,_0x34beeb,_0x323e12){return new BPromise(function(_0x15e9fe,_0x3cbb22){return client[_0xf025('0xa')](_0x45f405,_0x323e12)[_0xf025('0xb')](function(_0x5d7120){logger['info'](_0xf025('0xc'),_0x34beeb,_0xf025('0xd'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x34beeb,_0xf025('0xd'),JSON[_0xf025('0xe')](_0x5d7120));if(_0x5d7120['error']){if(_0x5d7120[_0xf025('0xf')]['code']===0x1f4){logger[_0xf025('0xf')](_0xf025('0xc'),_0x34beeb,_0x5d7120[_0xf025('0xf')][_0xf025('0x10')]);return _0x3cbb22(_0x5d7120[_0xf025('0xf')][_0xf025('0x10')]);}logger[_0xf025('0xf')](_0xf025('0xc'),_0x34beeb,_0x5d7120[_0xf025('0xf')][_0xf025('0x10')]);return _0x15e9fe(_0x5d7120['error'][_0xf025('0x10')]);}else{logger[_0xf025('0x11')](_0xf025('0xc'),_0x34beeb,'request\x20sent');_0x15e9fe(_0x5d7120['result'][_0xf025('0x10')]);}})[_0xf025('0x12')](function(_0x239baa){logger['error'](_0xf025('0xc'),_0x34beeb,_0x239baa);_0x3cbb22(_0x239baa);});});}exports[_0xf025('0x13')]=function(_0x590270){var _0x90d47b=this;return new Promise(function(_0x3fba91,_0x262f7){return db['ServicenowAccount'][_0xf025('0x14')]({'raw':_0x590270[_0xf025('0x15')]?_0x590270['options'][_0xf025('0x16')]===undefined?!![]:![]:!![],'where':_0x590270[_0xf025('0x15')]?_0x590270[_0xf025('0x15')][_0xf025('0x17')]||null:null,'attributes':_0x590270[_0xf025('0x15')]?_0x590270[_0xf025('0x15')][_0xf025('0x18')]||null:null,'limit':_0x590270[_0xf025('0x15')]?_0x590270['options'][_0xf025('0x19')]||null:null,'include':_0x590270[_0xf025('0x15')]?_0x590270[_0xf025('0x15')]['include']?_[_0xf025('0x1a')](_0x590270[_0xf025('0x15')]['include'],function(_0x135735){return{'model':db[_0x135735[_0xf025('0x1b')]],'as':_0x135735['as'],'attributes':_0x135735[_0xf025('0x18')],'include':_0x135735[_0xf025('0x1c')]?_[_0xf025('0x1a')](_0x135735[_0xf025('0x1c')],function(_0x755e3e){return{'model':db[_0x755e3e[_0xf025('0x1b')]],'as':_0x755e3e['as'],'attributes':_0x755e3e[_0xf025('0x18')],'include':_0x755e3e[_0xf025('0x1c')]?_[_0xf025('0x1a')](_0x755e3e[_0xf025('0x1c')],function(_0x4966b0){return{'model':db[_0x4966b0[_0xf025('0x1b')]],'as':_0x4966b0['as'],'attributes':_0x4966b0[_0xf025('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf025('0xb')](function(_0x5a77e1){logger[_0xf025('0x11')](_0xf025('0x13'),_0x590270);logger[_0xf025('0x1d')]('GetServicenowAccount',_0x590270,JSON[_0xf025('0xe')](_0x5a77e1));_0x3fba91(_0x5a77e1);})['catch'](function(_0x4c44b8){logger[_0xf025('0xf')](_0xf025('0x13'),_0x4c44b8[_0xf025('0x10')],_0x590270);_0x262f7(_0x90d47b[_0xf025('0xf')](0x1f4,_0x4c44b8[_0xf025('0x10')]));});});};exports[_0xf025('0x1e')]=function(_0x295242){var _0xe3bc14=this;return new Promise(function(_0x36af9a,_0x40dfe7){return db['ServicenowAccount'][_0xf025('0x1f')]({'raw':_0x295242['options']?_0x295242['options'][_0xf025('0x16')]===undefined?!![]:![]:!![],'where':_0x295242[_0xf025('0x15')]?_0x295242[_0xf025('0x15')]['where']||null:null,'attributes':_0x295242['options']?_0x295242[_0xf025('0x15')][_0xf025('0x18')]||null:null,'include':_0x295242['options']?_0x295242[_0xf025('0x15')][_0xf025('0x1c')]?_['map'](_0x295242[_0xf025('0x15')][_0xf025('0x1c')],function(_0x4776aa){return{'model':db[_0x4776aa['model']],'as':_0x4776aa['as'],'attributes':_0x4776aa[_0xf025('0x18')],'include':_0x4776aa[_0xf025('0x1c')]?_['map'](_0x4776aa['include'],function(_0x30d6d7){return{'model':db[_0x30d6d7[_0xf025('0x1b')]],'as':_0x30d6d7['as'],'attributes':_0x30d6d7[_0xf025('0x18')],'include':_0x30d6d7[_0xf025('0x1c')]?_[_0xf025('0x1a')](_0x30d6d7[_0xf025('0x1c')],function(_0x1055ff){return{'model':db[_0x1055ff['model']],'as':_0x1055ff['as'],'attributes':_0x1055ff[_0xf025('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac8e1){logger[_0xf025('0x11')]('ShowServicenowAccount',_0x295242);logger[_0xf025('0x1d')](_0xf025('0x1e'),_0x295242,JSON[_0xf025('0xe')](_0x3ac8e1));_0x36af9a(_0x3ac8e1);})[_0xf025('0x12')](function(_0x51fa80){logger[_0xf025('0xf')]('ShowServicenowAccount',_0x51fa80[_0xf025('0x10')],_0x295242);_0x40dfe7(_0xe3bc14[_0xf025('0xf')](0x1f4,_0x51fa80[_0xf025('0x10')]));});});}; \ No newline at end of file +var _0x72c3=['model','then','ShowServicenowAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','attributes','map'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0x72c3,0x108));var _0x372c=function(_0x33fd4c,_0x26fad0){_0x33fd4c=_0x33fd4c-0x0;var _0x428d3b=_0x72c3[_0x33fd4c];return _0x428d3b;};'use strict';var _=require(_0x372c('0x0'));var util=require(_0x372c('0x1'));var moment=require('moment');var BPromise=require(_0x372c('0x2'));var rs=require(_0x372c('0x3'));var fs=require('fs');var Redis=require(_0x372c('0x4'));var db=require(_0x372c('0x5'))['db'];var utils=require(_0x372c('0x6'));var logger=require('../../config/logger')(_0x372c('0x7'));var config=require(_0x372c('0x8'));var jayson=require(_0x372c('0x9'));var client=jayson[_0x372c('0xa')][_0x372c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x686537,_0x4c741b,_0x1ba22a){return new BPromise(function(_0x721868,_0x1fafdf){return client[_0x372c('0xc')](_0x686537,_0x1ba22a)['then'](function(_0x428152){logger[_0x372c('0xd')](_0x372c('0xe'),_0x4c741b,'request\x20sent');logger[_0x372c('0xf')](_0x372c('0x10'),_0x4c741b,_0x372c('0x11'),JSON[_0x372c('0x12')](_0x428152));if(_0x428152[_0x372c('0x13')]){if(_0x428152[_0x372c('0x13')]['code']===0x1f4){logger[_0x372c('0x13')](_0x372c('0xe'),_0x4c741b,_0x428152[_0x372c('0x13')]['message']);return _0x1fafdf(_0x428152[_0x372c('0x13')][_0x372c('0x14')]);}logger[_0x372c('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x4c741b,_0x428152[_0x372c('0x13')][_0x372c('0x14')]);return _0x721868(_0x428152[_0x372c('0x13')][_0x372c('0x14')]);}else{logger[_0x372c('0xd')](_0x372c('0xe'),_0x4c741b,_0x372c('0x11'));_0x721868(_0x428152[_0x372c('0x15')][_0x372c('0x14')]);}})[_0x372c('0x16')](function(_0x3bb9ed){logger[_0x372c('0x13')](_0x372c('0xe'),_0x4c741b,_0x3bb9ed);_0x1fafdf(_0x3bb9ed);});});}exports[_0x372c('0x17')]=function(_0x212363){var _0x416c9c=this;return new Promise(function(_0x528cb6,_0x226222){return db[_0x372c('0x18')][_0x372c('0x19')]({'raw':_0x212363[_0x372c('0x1a')]?_0x212363[_0x372c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x212363['options']?_0x212363[_0x372c('0x1a')][_0x372c('0x1b')]||null:null,'attributes':_0x212363[_0x372c('0x1a')]?_0x212363[_0x372c('0x1a')]['attributes']||null:null,'limit':_0x212363[_0x372c('0x1a')]?_0x212363[_0x372c('0x1a')][_0x372c('0x1c')]||null:null,'include':_0x212363[_0x372c('0x1a')]?_0x212363['options'][_0x372c('0x1d')]?_['map'](_0x212363[_0x372c('0x1a')]['include'],function(_0x46ff79){return{'model':db[_0x46ff79['model']],'as':_0x46ff79['as'],'attributes':_0x46ff79[_0x372c('0x1e')],'include':_0x46ff79[_0x372c('0x1d')]?_[_0x372c('0x1f')](_0x46ff79['include'],function(_0x4792e0){return{'model':db[_0x4792e0[_0x372c('0x20')]],'as':_0x4792e0['as'],'attributes':_0x4792e0[_0x372c('0x1e')],'include':_0x4792e0[_0x372c('0x1d')]?_['map'](_0x4792e0[_0x372c('0x1d')],function(_0x5242db){return{'model':db[_0x5242db[_0x372c('0x20')]],'as':_0x5242db['as'],'attributes':_0x5242db['attributes']};}):[]};}):[]};}):[]:[]})[_0x372c('0x21')](function(_0x453d99){logger[_0x372c('0xd')](_0x372c('0x17'),_0x212363);logger[_0x372c('0xf')](_0x372c('0x17'),_0x212363,JSON[_0x372c('0x12')](_0x453d99));_0x528cb6(_0x453d99);})[_0x372c('0x16')](function(_0x5ade7f){logger[_0x372c('0x13')](_0x372c('0x17'),_0x5ade7f[_0x372c('0x14')],_0x212363);_0x226222(_0x416c9c[_0x372c('0x13')](0x1f4,_0x5ade7f[_0x372c('0x14')]));});});};exports[_0x372c('0x22')]=function(_0x13cc94){var _0x25e87d=this;return new Promise(function(_0x10c487,_0x26e17a){return db[_0x372c('0x18')][_0x372c('0x23')]({'raw':_0x13cc94[_0x372c('0x1a')]?_0x13cc94[_0x372c('0x1a')][_0x372c('0x24')]===undefined?!![]:![]:!![],'where':_0x13cc94['options']?_0x13cc94[_0x372c('0x1a')][_0x372c('0x1b')]||null:null,'attributes':_0x13cc94[_0x372c('0x1a')]?_0x13cc94[_0x372c('0x1a')][_0x372c('0x1e')]||null:null,'include':_0x13cc94['options']?_0x13cc94[_0x372c('0x1a')]['include']?_[_0x372c('0x1f')](_0x13cc94[_0x372c('0x1a')]['include'],function(_0x2416e7){return{'model':db[_0x2416e7[_0x372c('0x20')]],'as':_0x2416e7['as'],'attributes':_0x2416e7['attributes'],'include':_0x2416e7['include']?_['map'](_0x2416e7[_0x372c('0x1d')],function(_0x2fdd71){return{'model':db[_0x2fdd71[_0x372c('0x20')]],'as':_0x2fdd71['as'],'attributes':_0x2fdd71[_0x372c('0x1e')],'include':_0x2fdd71['include']?_[_0x372c('0x1f')](_0x2fdd71['include'],function(_0x415799){return{'model':db[_0x415799[_0x372c('0x20')]],'as':_0x415799['as'],'attributes':_0x415799[_0x372c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x372c('0x21')](function(_0x130ce3){logger[_0x372c('0xd')](_0x372c('0x22'),_0x13cc94);logger[_0x372c('0xf')]('ShowServicenowAccount',_0x13cc94,JSON[_0x372c('0x12')](_0x130ce3));_0x10c487(_0x130ce3);})['catch'](function(_0x7e45c0){logger[_0x372c('0x13')]('ShowServicenowAccount',_0x7e45c0[_0x372c('0x14')],_0x13cc94);_0x26e17a(_0x25e87d[_0x372c('0x13')](0x1f4,_0x7e45c0['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3ef8e01..eac3efd 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 _0x8763=['update','delete','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','getDescriptions','post','put'];(function(_0x54c734,_0xc5cf3a){var _0x6bdb37=function(_0x1cd617){while(--_0x1cd617){_0x54c734['push'](_0x54c734['shift']());}};_0x6bdb37(++_0xc5cf3a);}(_0x8763,0x1dd));var _0x3876=function(_0x9d6a54,_0x57213e){_0x9d6a54=_0x9d6a54-0x0;var _0xc3f8cc=_0x8763[_0x9d6a54];return _0xc3f8cc;};'use strict';var multer=require(_0x3876('0x0'));var util=require(_0x3876('0x1'));var path=require(_0x3876('0x2'));var timeout=require(_0x3876('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3876('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3876('0x5'));var controller=require(_0x3876('0x6'));router[_0x3876('0x7')]('/',auth[_0x3876('0x8')](),controller[_0x3876('0x9')]);router[_0x3876('0x7')](_0x3876('0xa'),auth[_0x3876('0x8')](),controller[_0x3876('0xb')]);router[_0x3876('0x7')](_0x3876('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x3876('0xd')]);router[_0x3876('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x3876('0xe')]);router[_0x3876('0xf')]('/',auth[_0x3876('0x8')](),controller['create']);router[_0x3876('0x10')](_0x3876('0xa'),auth[_0x3876('0x8')](),controller[_0x3876('0x11')]);router[_0x3876('0x12')](_0x3876('0xa'),auth[_0x3876('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x650e=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','exports','multer','path','express','Router','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x650e,0x84));var _0xe650=function(_0x10f7f1,_0x421f77){_0x10f7f1=_0x10f7f1-0x0;var _0x1f6925=_0x650e[_0x10f7f1];return _0x1f6925;};'use strict';var multer=require(_0xe650('0x0'));var util=require('util');var path=require(_0xe650('0x1'));var timeout=require('connect-timeout');var express=require(_0xe650('0x2'));var router=express[_0xe650('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe650('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe650('0x5'));router[_0xe650('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe650('0x6')]('/:id',auth[_0xe650('0x7')](),controller[_0xe650('0x8')]);router[_0xe650('0x6')](_0xe650('0x9'),auth[_0xe650('0x7')](),controller[_0xe650('0xa')]);router[_0xe650('0x6')](_0xe650('0xb'),auth[_0xe650('0x7')](),controller[_0xe650('0xc')]);router[_0xe650('0x6')](_0xe650('0xd'),auth[_0xe650('0x7')](),controller[_0xe650('0xe')]);router[_0xe650('0xf')]('/',auth[_0xe650('0x7')](),controller['create']);router[_0xe650('0x10')](_0xe650('0x11'),auth[_0xe650('0x7')](),controller[_0xe650('0x12')]);router['delete'](_0xe650('0x11'),auth[_0xe650('0x7')](),controller['destroy']);module[_0xe650('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8431840..a55ac3a 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 _0xd676=['STRING','sequelize','exports'];(function(_0x6e2d0f,_0x47d893){var _0x4234d4=function(_0x7a37c7){while(--_0x7a37c7){_0x6e2d0f['push'](_0x6e2d0f['shift']());}};_0x4234d4(++_0x47d893);}(_0xd676,0x1c6));var _0x6d67=function(_0xd598e9,_0x20cb54){_0xd598e9=_0xd598e9-0x0;var _0x12c224=_0xd676[_0xd598e9];return _0x12c224;};'use strict';var Sequelize=require(_0x6d67('0x0'));module[_0x6d67('0x1')]={'name':{'type':Sequelize[_0x6d67('0x2')]},'description':{'type':Sequelize[_0x6d67('0x2')]}}; \ No newline at end of file +var _0x0a1a=['sequelize','STRING'];(function(_0x53f52c,_0x2444e3){var _0x5899a3=function(_0x1a7b3c){while(--_0x1a7b3c){_0x53f52c['push'](_0x53f52c['shift']());}};_0x5899a3(++_0x2444e3);}(_0x0a1a,0x112));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa0a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa0a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 623601c..743ecf1 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 _0x7f43=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','update','params','getFields','findOne','ServicenowField','rawAttributes','order','hasOwnProperty','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','then','destroy','end','error','stack','name','send','ServicenowConfiguration'];(function(_0x1e14f6,_0x2bab0e){var _0xa8d17f=function(_0x4cbe03){while(--_0x4cbe03){_0x1e14f6['push'](_0x1e14f6['shift']());}};_0xa8d17f(++_0x2bab0e);}(_0x7f43,0x115));var _0x37f4=function(_0xa90865,_0x3031de){_0xa90865=_0xa90865-0x0;var _0x3a81a3=_0x7f43[_0xa90865];return _0x3a81a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37f4('0x0'));var zipdir=require(_0x37f4('0x1'));var jsonpatch=require(_0x37f4('0x2'));var rp=require(_0x37f4('0x3'));var moment=require(_0x37f4('0x4'));var BPromise=require(_0x37f4('0x5'));var Mustache=require(_0x37f4('0x6'));var util=require(_0x37f4('0x7'));var path=require('path');var sox=require(_0x37f4('0x8'));var csv=require(_0x37f4('0x9'));var ejs=require(_0x37f4('0xa'));var fs=require('fs');var fs_extra=require(_0x37f4('0xb'));var _=require('lodash');var squel=require(_0x37f4('0xc'));var crypto=require(_0x37f4('0xd'));var jsforce=require(_0x37f4('0xe'));var deskjs=require(_0x37f4('0xf'));var toCsv=require(_0x37f4('0x9'));var querystring=require(_0x37f4('0x10'));var Papa=require(_0x37f4('0x11'));var Redis=require(_0x37f4('0x12'));var authService=require(_0x37f4('0x13'));var qs=require(_0x37f4('0x14'));var as=require(_0x37f4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37f4('0x16'))(_0x37f4('0x17'));var utils=require(_0x37f4('0x18'));var config=require(_0x37f4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x37f4('0x1a'))['db'];function respondWithStatusCode(_0x5916b3,_0x3fa7b8){_0x3fa7b8=_0x3fa7b8||0xcc;return function(_0x2de657){if(_0x2de657){return _0x5916b3[_0x37f4('0x1b')](_0x3fa7b8);}return _0x5916b3['status'](_0x3fa7b8)['end']();};}function respondWithResult(_0xc62a36,_0x5affc5){_0x5affc5=_0x5affc5||0xc8;return function(_0x1c2a11){if(_0x1c2a11){return _0xc62a36['status'](_0x5affc5)[_0x37f4('0x1c')](_0x1c2a11);}};}function respondWithFilteredResult(_0x4f9798,_0x239908){return function(_0x57fc82){if(_0x57fc82){var _0x47a117=typeof _0x239908[_0x37f4('0x1d')]===_0x37f4('0x1e')&&typeof _0x239908[_0x37f4('0x1f')]==='undefined';var _0x2edcd6=_0x57fc82['count'];var _0x4c4cf0=_0x47a117?0x0:_0x239908['offset'];var _0x3aa90d=_0x47a117?_0x57fc82[_0x37f4('0x20')]:_0x239908[_0x37f4('0x1d')]+_0x239908[_0x37f4('0x1f')];var _0x4e70b5;if(_0x3aa90d>=_0x2edcd6){_0x3aa90d=_0x2edcd6;_0x4e70b5=0xc8;}else{_0x4e70b5=0xce;}_0x4f9798[_0x37f4('0x21')](_0x4e70b5);return _0x4f9798['set'](_0x37f4('0x22'),_0x4c4cf0+'-'+_0x3aa90d+'/'+_0x2edcd6)[_0x37f4('0x1c')](_0x57fc82);}return null;};}function patchUpdates(_0x1373a2){return function(_0xc739c6){try{jsonpatch['apply'](_0xc739c6,_0x1373a2,!![]);}catch(_0x7b2639){return BPromise['reject'](_0x7b2639);}return _0xc739c6['save']();};}function saveUpdates(_0x43aad2,_0x35469a){return function(_0x46c241){if(_0x46c241){return _0x46c241['update'](_0x43aad2)[_0x37f4('0x23')](function(_0xa67034){return _0xa67034;});}return null;};}function removeEntity(_0x325b63,_0x5c5913){return function(_0x52e55a){if(_0x52e55a){return _0x52e55a[_0x37f4('0x24')]()[_0x37f4('0x23')](function(){_0x325b63[_0x37f4('0x21')](0xcc)[_0x37f4('0x25')]();});}};}function handleEntityNotFound(_0x3f2276,_0x588c21){return function(_0x5ac545){if(!_0x5ac545){_0x3f2276[_0x37f4('0x1b')](0x194);}return _0x5ac545;};}function handleError(_0x1764a8,_0x32fd0b){_0x32fd0b=_0x32fd0b||0x1f4;return function(_0x1f6a80){logger[_0x37f4('0x26')](_0x1f6a80[_0x37f4('0x27')]);if(_0x1f6a80[_0x37f4('0x28')]){delete _0x1f6a80['name'];}_0x1764a8[_0x37f4('0x21')](_0x32fd0b)[_0x37f4('0x29')](_0x1f6a80);};}exports['index']=function(_0x598092,_0x4b92c3){var _0x9c9206={},_0x3f60b6={},_0x136896={'count':0x0,'rows':[]};var _0xd24cc9=_['map'](db[_0x37f4('0x2a')]['rawAttributes'],function(_0x3a3fbd){return{'name':_0x3a3fbd[_0x37f4('0x2b')],'type':_0x3a3fbd[_0x37f4('0x2c')][_0x37f4('0x2d')]};});_0x3f60b6[_0x37f4('0x2e')]=_['map'](_0xd24cc9,_0x37f4('0x28'));_0x3f60b6['query']=_[_0x37f4('0x2f')](_0x598092['query']);_0x3f60b6[_0x37f4('0x30')]=_[_0x37f4('0x31')](_0x3f60b6['model'],_0x3f60b6[_0x37f4('0x32')]);_0x9c9206[_0x37f4('0x33')]=_[_0x37f4('0x31')](_0x3f60b6['model'],qs['fields'](_0x598092[_0x37f4('0x32')][_0x37f4('0x34')]));_0x9c9206[_0x37f4('0x33')]=_0x9c9206[_0x37f4('0x33')][_0x37f4('0x35')]?_0x9c9206[_0x37f4('0x33')]:_0x3f60b6[_0x37f4('0x2e')];if(!_0x598092[_0x37f4('0x32')]['hasOwnProperty']('nolimit')){_0x9c9206[_0x37f4('0x1f')]=qs[_0x37f4('0x1f')](_0x598092[_0x37f4('0x32')][_0x37f4('0x1f')]);_0x9c9206[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x598092['query'][_0x37f4('0x1d')]);}_0x9c9206['order']=qs[_0x37f4('0x36')](_0x598092['query'][_0x37f4('0x36')]);_0x9c9206['where']=qs[_0x37f4('0x30')](_[_0x37f4('0x37')](_0x598092['query'],_0x3f60b6[_0x37f4('0x30')]),_0xd24cc9);if(_0x598092['query'][_0x37f4('0x38')]){_0x9c9206[_0x37f4('0x39')]=_[_0x37f4('0x3a')](_0x9c9206[_0x37f4('0x39')],{'$or':_[_0x37f4('0x3b')](_0xd24cc9,function(_0x5529ee){if(_0x5529ee[_0x37f4('0x2c')]!==_0x37f4('0x3c')){var _0x54933f={};_0x54933f[_0x5529ee['name']]={'$like':'%'+_0x598092['query'][_0x37f4('0x38')]+'%'};return _0x54933f;}})});}_0x9c9206=_['merge']({},_0x9c9206,_0x598092['options']);var _0x323932={'where':_0x9c9206[_0x37f4('0x39')]};return db[_0x37f4('0x2a')][_0x37f4('0x20')](_0x323932)[_0x37f4('0x23')](function(_0x3e98de){_0x136896[_0x37f4('0x20')]=_0x3e98de;if(_0x598092[_0x37f4('0x32')][_0x37f4('0x3d')]){_0x9c9206[_0x37f4('0x3e')]=[{'all':!![]}];}return db[_0x37f4('0x2a')][_0x37f4('0x3f')](_0x9c9206);})[_0x37f4('0x23')](function(_0x3f10f7){_0x136896[_0x37f4('0x40')]=_0x3f10f7;return _0x136896;})[_0x37f4('0x23')](respondWithFilteredResult(_0x4b92c3,_0x9c9206))[_0x37f4('0x41')](handleError(_0x4b92c3,null));};exports['show']=function(_0x2c4ba3,_0x9b8e53){var _0x6dc3cf={'raw':![],'where':{'id':_0x2c4ba3['params']['id']}},_0x4c5fd9={};_0x4c5fd9[_0x37f4('0x2e')]=_[_0x37f4('0x2f')](db[_0x37f4('0x2a')]['rawAttributes']);_0x4c5fd9[_0x37f4('0x32')]=_[_0x37f4('0x2f')](_0x2c4ba3['query']);_0x4c5fd9[_0x37f4('0x30')]=_[_0x37f4('0x31')](_0x4c5fd9[_0x37f4('0x2e')],_0x4c5fd9[_0x37f4('0x32')]);_0x6dc3cf['attributes']=_[_0x37f4('0x31')](_0x4c5fd9[_0x37f4('0x2e')],qs[_0x37f4('0x34')](_0x2c4ba3[_0x37f4('0x32')][_0x37f4('0x34')]));_0x6dc3cf[_0x37f4('0x33')]=_0x6dc3cf[_0x37f4('0x33')][_0x37f4('0x35')]?_0x6dc3cf[_0x37f4('0x33')]:_0x4c5fd9[_0x37f4('0x2e')];if(_0x2c4ba3[_0x37f4('0x32')]['includeAll']){_0x6dc3cf['include']=[{'all':!![]}];}_0x6dc3cf=_[_0x37f4('0x3a')]({},_0x6dc3cf,_0x2c4ba3[_0x37f4('0x42')]);return db[_0x37f4('0x2a')][_0x37f4('0x43')](_0x6dc3cf)[_0x37f4('0x23')](handleEntityNotFound(_0x9b8e53,null))[_0x37f4('0x23')](respondWithResult(_0x9b8e53,null))[_0x37f4('0x41')](handleError(_0x9b8e53,null));};exports['create']=function(_0x5265ba,_0x5ee617){return db[_0x37f4('0x2a')][_0x37f4('0x44')](_0x5265ba[_0x37f4('0x45')],{})['then'](respondWithResult(_0x5ee617,0xc9))[_0x37f4('0x41')](handleError(_0x5ee617,null));};exports[_0x37f4('0x46')]=function(_0x5f285e,_0x17e2cf){if(_0x5f285e[_0x37f4('0x45')]['id']){delete _0x5f285e['body']['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x5f285e['params']['id']}})[_0x37f4('0x23')](handleEntityNotFound(_0x17e2cf,null))[_0x37f4('0x23')](saveUpdates(_0x5f285e[_0x37f4('0x45')],null))[_0x37f4('0x23')](respondWithResult(_0x17e2cf,null))[_0x37f4('0x41')](handleError(_0x17e2cf,null));};exports[_0x37f4('0x24')]=function(_0x31fb3b,_0x20488e){return db[_0x37f4('0x2a')][_0x37f4('0x43')]({'where':{'id':_0x31fb3b[_0x37f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x20488e,null))[_0x37f4('0x23')](removeEntity(_0x20488e,null))[_0x37f4('0x41')](handleError(_0x20488e,null));};exports[_0x37f4('0x48')]=function(_0x3a645c,_0x1607ef,_0x532a20){var _0x4a8d21={};var _0x6b486c={};var _0x22519f;var _0x67dc26;return db[_0x37f4('0x2a')][_0x37f4('0x49')]({'where':{'id':_0x3a645c[_0x37f4('0x47')]['id']}})[_0x37f4('0x23')](handleEntityNotFound(_0x1607ef,null))[_0x37f4('0x23')](function(_0x3c4b94){if(_0x3c4b94){_0x22519f=_0x3c4b94;_0x6b486c[_0x37f4('0x2e')]=_[_0x37f4('0x2f')](db[_0x37f4('0x4a')][_0x37f4('0x4b')]);_0x6b486c[_0x37f4('0x32')]=_[_0x37f4('0x2f')](_0x3a645c[_0x37f4('0x32')]);_0x6b486c['filters']=_[_0x37f4('0x31')](_0x6b486c[_0x37f4('0x2e')],_0x6b486c['query']);_0x4a8d21['attributes']=_[_0x37f4('0x31')](_0x6b486c[_0x37f4('0x2e')],qs[_0x37f4('0x34')](_0x3a645c[_0x37f4('0x32')][_0x37f4('0x34')]));_0x4a8d21[_0x37f4('0x33')]=_0x4a8d21['attributes']['length']?_0x4a8d21['attributes']:_0x6b486c[_0x37f4('0x2e')];_0x4a8d21[_0x37f4('0x4c')]=qs[_0x37f4('0x36')](_0x3a645c['query']['sort']);_0x4a8d21[_0x37f4('0x39')]=qs[_0x37f4('0x30')](_['pick'](_0x3a645c[_0x37f4('0x32')],_0x6b486c[_0x37f4('0x30')]));if(_0x3a645c['query'][_0x37f4('0x38')]){_0x4a8d21[_0x37f4('0x39')]=_[_0x37f4('0x3a')](_0x4a8d21[_0x37f4('0x39')],{'$or':_[_0x37f4('0x3b')](_0x4a8d21[_0x37f4('0x33')],function(_0x4cea96){var _0x3f41cb={};_0x3f41cb[_0x4cea96]={'$like':'%'+_0x3a645c[_0x37f4('0x32')][_0x37f4('0x38')]+'%'};return _0x3f41cb;})});}_0x4a8d21=_['merge']({},_0x4a8d21,_0x3a645c[_0x37f4('0x42')]);return _0x22519f[_0x37f4('0x48')](_0x4a8d21);}})[_0x37f4('0x23')](function(_0x53d1b6){if(_0x53d1b6){_0x67dc26=_0x53d1b6[_0x37f4('0x35')];if(!_0x3a645c[_0x37f4('0x32')][_0x37f4('0x4d')]('nolimit')){_0x4a8d21[_0x37f4('0x1f')]=qs[_0x37f4('0x1f')](_0x3a645c[_0x37f4('0x32')][_0x37f4('0x1f')]);_0x4a8d21[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x3a645c[_0x37f4('0x32')]['offset']);}return _0x22519f['getFields'](_0x4a8d21);}})[_0x37f4('0x23')](function(_0x50a324){if(_0x50a324){return _0x50a324?{'count':_0x67dc26,'rows':_0x50a324}:null;}})[_0x37f4('0x23')](respondWithResult(_0x1607ef,null))[_0x37f4('0x41')](handleError(_0x1607ef,null));};exports['getSubjects']=function(_0x42a231,_0x449dee,_0x4d06f3){var _0x46c5bf={};var _0x3405f5={};var _0x75dae0;var _0x329bb0;return db[_0x37f4('0x2a')]['findOne']({'where':{'id':_0x42a231[_0x37f4('0x47')]['id']}})[_0x37f4('0x23')](handleEntityNotFound(_0x449dee,null))[_0x37f4('0x23')](function(_0xfa323d){if(_0xfa323d){_0x75dae0=_0xfa323d;_0x3405f5[_0x37f4('0x2e')]=_[_0x37f4('0x2f')](db[_0x37f4('0x4a')]['rawAttributes']);_0x3405f5['query']=_[_0x37f4('0x2f')](_0x42a231['query']);_0x3405f5[_0x37f4('0x30')]=_[_0x37f4('0x31')](_0x3405f5[_0x37f4('0x2e')],_0x3405f5[_0x37f4('0x32')]);_0x46c5bf[_0x37f4('0x33')]=_[_0x37f4('0x31')](_0x3405f5[_0x37f4('0x2e')],qs[_0x37f4('0x34')](_0x42a231[_0x37f4('0x32')][_0x37f4('0x34')]));_0x46c5bf['attributes']=_0x46c5bf[_0x37f4('0x33')][_0x37f4('0x35')]?_0x46c5bf[_0x37f4('0x33')]:_0x3405f5[_0x37f4('0x2e')];_0x46c5bf[_0x37f4('0x4c')]=qs[_0x37f4('0x36')](_0x42a231[_0x37f4('0x32')][_0x37f4('0x36')]);_0x46c5bf[_0x37f4('0x39')]=qs[_0x37f4('0x30')](_[_0x37f4('0x37')](_0x42a231[_0x37f4('0x32')],_0x3405f5[_0x37f4('0x30')]));if(_0x42a231[_0x37f4('0x32')][_0x37f4('0x38')]){_0x46c5bf['where']=_[_0x37f4('0x3a')](_0x46c5bf[_0x37f4('0x39')],{'$or':_['map'](_0x46c5bf[_0x37f4('0x33')],function(_0xcb910f){var _0x5a1bf3={};_0x5a1bf3[_0xcb910f]={'$like':'%'+_0x42a231[_0x37f4('0x32')][_0x37f4('0x38')]+'%'};return _0x5a1bf3;})});}_0x46c5bf=_[_0x37f4('0x3a')]({},_0x46c5bf,_0x42a231['options']);return _0x75dae0['getSubjects'](_0x46c5bf);}})[_0x37f4('0x23')](function(_0x38c694){if(_0x38c694){_0x329bb0=_0x38c694[_0x37f4('0x35')];if(!_0x42a231['query']['hasOwnProperty'](_0x37f4('0x4e'))){_0x46c5bf[_0x37f4('0x1f')]=qs[_0x37f4('0x1f')](_0x42a231[_0x37f4('0x32')][_0x37f4('0x1f')]);_0x46c5bf['offset']=qs[_0x37f4('0x1d')](_0x42a231[_0x37f4('0x32')][_0x37f4('0x1d')]);}return _0x75dae0['getSubjects'](_0x46c5bf);}})[_0x37f4('0x23')](function(_0x41632f){if(_0x41632f){return _0x41632f?{'count':_0x329bb0,'rows':_0x41632f}:null;}})[_0x37f4('0x23')](respondWithResult(_0x449dee,null))['catch'](handleError(_0x449dee,null));};exports[_0x37f4('0x4f')]=function(_0x47e47e,_0x2ef4ac,_0x1b1e99){var _0x43655a={};var _0x3139b1={};var _0x27b1b5;var _0x3e14b1;return db['ServicenowConfiguration'][_0x37f4('0x49')]({'where':{'id':_0x47e47e[_0x37f4('0x47')]['id']}})[_0x37f4('0x23')](handleEntityNotFound(_0x2ef4ac,null))[_0x37f4('0x23')](function(_0x50b20e){if(_0x50b20e){_0x27b1b5=_0x50b20e;_0x3139b1[_0x37f4('0x2e')]=_[_0x37f4('0x2f')](db[_0x37f4('0x4a')]['rawAttributes']);_0x3139b1[_0x37f4('0x32')]=_[_0x37f4('0x2f')](_0x47e47e[_0x37f4('0x32')]);_0x3139b1[_0x37f4('0x30')]=_['intersection'](_0x3139b1[_0x37f4('0x2e')],_0x3139b1[_0x37f4('0x32')]);_0x43655a[_0x37f4('0x33')]=_['intersection'](_0x3139b1[_0x37f4('0x2e')],qs[_0x37f4('0x34')](_0x47e47e[_0x37f4('0x32')][_0x37f4('0x34')]));_0x43655a[_0x37f4('0x33')]=_0x43655a[_0x37f4('0x33')][_0x37f4('0x35')]?_0x43655a[_0x37f4('0x33')]:_0x3139b1['model'];_0x43655a[_0x37f4('0x4c')]=qs[_0x37f4('0x36')](_0x47e47e[_0x37f4('0x32')][_0x37f4('0x36')]);_0x43655a['where']=qs[_0x37f4('0x30')](_[_0x37f4('0x37')](_0x47e47e[_0x37f4('0x32')],_0x3139b1['filters']));if(_0x47e47e[_0x37f4('0x32')][_0x37f4('0x38')]){_0x43655a[_0x37f4('0x39')]=_['merge'](_0x43655a[_0x37f4('0x39')],{'$or':_[_0x37f4('0x3b')](_0x43655a[_0x37f4('0x33')],function(_0x13b340){var _0x5a8937={};_0x5a8937[_0x13b340]={'$like':'%'+_0x47e47e['query'][_0x37f4('0x38')]+'%'};return _0x5a8937;})});}_0x43655a=_[_0x37f4('0x3a')]({},_0x43655a,_0x47e47e[_0x37f4('0x42')]);return _0x27b1b5['getDescriptions'](_0x43655a);}})[_0x37f4('0x23')](function(_0x424baa){if(_0x424baa){_0x3e14b1=_0x424baa[_0x37f4('0x35')];if(!_0x47e47e[_0x37f4('0x32')][_0x37f4('0x4d')](_0x37f4('0x4e'))){_0x43655a[_0x37f4('0x1f')]=qs['limit'](_0x47e47e['query'][_0x37f4('0x1f')]);_0x43655a[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x47e47e[_0x37f4('0x32')][_0x37f4('0x1d')]);}return _0x27b1b5[_0x37f4('0x4f')](_0x43655a);}})[_0x37f4('0x23')](function(_0x19fef2){if(_0x19fef2){return _0x19fef2?{'count':_0x3e14b1,'rows':_0x19fef2}:null;}})[_0x37f4('0x23')](respondWithResult(_0x2ef4ac,null))[_0x37f4('0x41')](handleError(_0x2ef4ac,null));}; \ No newline at end of file +var _0x1ea1=['VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','findOne','ServicenowField','options','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','util','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','../../config/environment','../../mysqldb','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','map'];(function(_0x20b510,_0x48caf7){var _0x507561=function(_0x2eb2e0){while(--_0x2eb2e0){_0x20b510['push'](_0x20b510['shift']());}};_0x507561(++_0x48caf7);}(_0x1ea1,0x154));var _0x11ea=function(_0x3a2942,_0xdc3983){_0x3a2942=_0x3a2942-0x0;var _0x246f0a=_0x1ea1[_0x3a2942];return _0x246f0a;};'use strict';var emlformat=require(_0x11ea('0x0'));var rimraf=require(_0x11ea('0x1'));var zipdir=require(_0x11ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11ea('0x4'));var path=require(_0x11ea('0x5'));var sox=require(_0x11ea('0x6'));var csv=require('to-csv');var ejs=require(_0x11ea('0x7'));var fs=require('fs');var fs_extra=require(_0x11ea('0x8'));var _=require(_0x11ea('0x9'));var squel=require(_0x11ea('0xa'));var crypto=require(_0x11ea('0xb'));var jsforce=require(_0x11ea('0xc'));var deskjs=require(_0x11ea('0xd'));var toCsv=require(_0x11ea('0xe'));var querystring=require(_0x11ea('0xf'));var Papa=require(_0x11ea('0x10'));var Redis=require(_0x11ea('0x11'));var authService=require(_0x11ea('0x12'));var qs=require(_0x11ea('0x13'));var as=require(_0x11ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11ea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x11ea('0x16'))['db'];function respondWithStatusCode(_0x3dd421,_0x9414fa){_0x9414fa=_0x9414fa||0xcc;return function(_0x3f0f9c){if(_0x3f0f9c){return _0x3dd421['sendStatus'](_0x9414fa);}return _0x3dd421[_0x11ea('0x17')](_0x9414fa)[_0x11ea('0x18')]();};}function respondWithResult(_0x1a6566,_0x1f0572){_0x1f0572=_0x1f0572||0xc8;return function(_0x40933b){if(_0x40933b){return _0x1a6566[_0x11ea('0x17')](_0x1f0572)['json'](_0x40933b);}};}function respondWithFilteredResult(_0x4105aa,_0x1f4af4){return function(_0x145a35){if(_0x145a35){var _0x4f9821=typeof _0x1f4af4['offset']===_0x11ea('0x19')&&typeof _0x1f4af4[_0x11ea('0x1a')]===_0x11ea('0x19');var _0x44d076=_0x145a35['count'];var _0x554f1d=_0x4f9821?0x0:_0x1f4af4[_0x11ea('0x1b')];var _0x4e8ff5=_0x4f9821?_0x145a35['count']:_0x1f4af4['offset']+_0x1f4af4[_0x11ea('0x1a')];var _0x5dbb74;if(_0x4e8ff5>=_0x44d076){_0x4e8ff5=_0x44d076;_0x5dbb74=0xc8;}else{_0x5dbb74=0xce;}_0x4105aa[_0x11ea('0x17')](_0x5dbb74);return _0x4105aa[_0x11ea('0x1c')](_0x11ea('0x1d'),_0x554f1d+'-'+_0x4e8ff5+'/'+_0x44d076)[_0x11ea('0x1e')](_0x145a35);}return null;};}function patchUpdates(_0x2a51d6){return function(_0x8de350){try{jsonpatch[_0x11ea('0x1f')](_0x8de350,_0x2a51d6,!![]);}catch(_0x5ec5a7){return BPromise[_0x11ea('0x20')](_0x5ec5a7);}return _0x8de350[_0x11ea('0x21')]();};}function saveUpdates(_0x53c0d6,_0x113b7b){return function(_0x596516){if(_0x596516){return _0x596516['update'](_0x53c0d6)['then'](function(_0x1e9e2b){return _0x1e9e2b;});}return null;};}function removeEntity(_0x187312,_0xae2b92){return function(_0x730304){if(_0x730304){return _0x730304[_0x11ea('0x22')]()[_0x11ea('0x23')](function(){_0x187312[_0x11ea('0x17')](0xcc)[_0x11ea('0x18')]();});}};}function handleEntityNotFound(_0x1919e4,_0x3cd7cd){return function(_0x3e1d7a){if(!_0x3e1d7a){_0x1919e4[_0x11ea('0x24')](0x194);}return _0x3e1d7a;};}function handleError(_0x4e8e34,_0x289e95){_0x289e95=_0x289e95||0x1f4;return function(_0x5e73fe){logger[_0x11ea('0x25')](_0x5e73fe['stack']);if(_0x5e73fe[_0x11ea('0x26')]){delete _0x5e73fe['name'];}_0x4e8e34[_0x11ea('0x17')](_0x289e95)[_0x11ea('0x27')](_0x5e73fe);};}exports[_0x11ea('0x28')]=function(_0x4d9f96,_0x379201){var _0x33e070={},_0x4a410c={},_0x43c1cc={'count':0x0,'rows':[]};var _0x91914c=_['map'](db[_0x11ea('0x29')][_0x11ea('0x2a')],function(_0x471e58){return{'name':_0x471e58[_0x11ea('0x2b')],'type':_0x471e58[_0x11ea('0x2c')]['key']};});_0x4a410c[_0x11ea('0x2d')]=_['map'](_0x91914c,'name');_0x4a410c[_0x11ea('0x2e')]=_[_0x11ea('0x2f')](_0x4d9f96[_0x11ea('0x2e')]);_0x4a410c[_0x11ea('0x30')]=_[_0x11ea('0x31')](_0x4a410c[_0x11ea('0x2d')],_0x4a410c[_0x11ea('0x2e')]);_0x33e070[_0x11ea('0x32')]=_['intersection'](_0x4a410c['model'],qs[_0x11ea('0x33')](_0x4d9f96[_0x11ea('0x2e')][_0x11ea('0x33')]));_0x33e070[_0x11ea('0x32')]=_0x33e070[_0x11ea('0x32')][_0x11ea('0x34')]?_0x33e070[_0x11ea('0x32')]:_0x4a410c[_0x11ea('0x2d')];if(!_0x4d9f96[_0x11ea('0x2e')]['hasOwnProperty'](_0x11ea('0x35'))){_0x33e070[_0x11ea('0x1a')]=qs[_0x11ea('0x1a')](_0x4d9f96[_0x11ea('0x2e')]['limit']);_0x33e070['offset']=qs[_0x11ea('0x1b')](_0x4d9f96[_0x11ea('0x2e')][_0x11ea('0x1b')]);}_0x33e070[_0x11ea('0x36')]=qs[_0x11ea('0x37')](_0x4d9f96['query'][_0x11ea('0x37')]);_0x33e070['where']=qs[_0x11ea('0x30')](_[_0x11ea('0x38')](_0x4d9f96[_0x11ea('0x2e')],_0x4a410c['filters']),_0x91914c);if(_0x4d9f96[_0x11ea('0x2e')]['filter']){_0x33e070[_0x11ea('0x39')]=_[_0x11ea('0x3a')](_0x33e070['where'],{'$or':_[_0x11ea('0x3b')](_0x91914c,function(_0x2ccaab){if(_0x2ccaab['type']!==_0x11ea('0x3c')){var _0x516cdb={};_0x516cdb[_0x2ccaab[_0x11ea('0x26')]]={'$like':'%'+_0x4d9f96['query'][_0x11ea('0x3d')]+'%'};return _0x516cdb;}})});}_0x33e070=_['merge']({},_0x33e070,_0x4d9f96['options']);var _0x4a4e6f={'where':_0x33e070[_0x11ea('0x39')]};return db['ServicenowConfiguration'][_0x11ea('0x3e')](_0x4a4e6f)[_0x11ea('0x23')](function(_0x39ab71){_0x43c1cc[_0x11ea('0x3e')]=_0x39ab71;if(_0x4d9f96[_0x11ea('0x2e')][_0x11ea('0x3f')]){_0x33e070[_0x11ea('0x40')]=[{'all':!![]}];}return db[_0x11ea('0x29')][_0x11ea('0x41')](_0x33e070);})[_0x11ea('0x23')](function(_0x4dcfce){_0x43c1cc[_0x11ea('0x42')]=_0x4dcfce;return _0x43c1cc;})[_0x11ea('0x23')](respondWithFilteredResult(_0x379201,_0x33e070))['catch'](handleError(_0x379201,null));};exports[_0x11ea('0x43')]=function(_0x5b9b07,_0x3cc8ef){var _0x1b681d={'raw':![],'where':{'id':_0x5b9b07[_0x11ea('0x44')]['id']}},_0x1fa243={};_0x1fa243['model']=_[_0x11ea('0x2f')](db[_0x11ea('0x29')][_0x11ea('0x2a')]);_0x1fa243[_0x11ea('0x2e')]=_[_0x11ea('0x2f')](_0x5b9b07[_0x11ea('0x2e')]);_0x1fa243[_0x11ea('0x30')]=_[_0x11ea('0x31')](_0x1fa243['model'],_0x1fa243[_0x11ea('0x2e')]);_0x1b681d[_0x11ea('0x32')]=_[_0x11ea('0x31')](_0x1fa243[_0x11ea('0x2d')],qs[_0x11ea('0x33')](_0x5b9b07['query'][_0x11ea('0x33')]));_0x1b681d[_0x11ea('0x32')]=_0x1b681d[_0x11ea('0x32')][_0x11ea('0x34')]?_0x1b681d['attributes']:_0x1fa243[_0x11ea('0x2d')];if(_0x5b9b07[_0x11ea('0x2e')][_0x11ea('0x3f')]){_0x1b681d[_0x11ea('0x40')]=[{'all':!![]}];}_0x1b681d=_[_0x11ea('0x3a')]({},_0x1b681d,_0x5b9b07['options']);return db[_0x11ea('0x29')]['find'](_0x1b681d)[_0x11ea('0x23')](handleEntityNotFound(_0x3cc8ef,null))[_0x11ea('0x23')](respondWithResult(_0x3cc8ef,null))[_0x11ea('0x45')](handleError(_0x3cc8ef,null));};exports[_0x11ea('0x46')]=function(_0xc4cc63,_0x1f2010){return db[_0x11ea('0x29')][_0x11ea('0x46')](_0xc4cc63[_0x11ea('0x47')],{})[_0x11ea('0x23')](respondWithResult(_0x1f2010,0xc9))[_0x11ea('0x45')](handleError(_0x1f2010,null));};exports['update']=function(_0x1cb987,_0x3eddda){if(_0x1cb987['body']['id']){delete _0x1cb987[_0x11ea('0x47')]['id'];}return db[_0x11ea('0x29')]['find']({'where':{'id':_0x1cb987[_0x11ea('0x44')]['id']}})[_0x11ea('0x23')](handleEntityNotFound(_0x3eddda,null))['then'](saveUpdates(_0x1cb987['body'],null))[_0x11ea('0x23')](respondWithResult(_0x3eddda,null))[_0x11ea('0x45')](handleError(_0x3eddda,null));};exports[_0x11ea('0x22')]=function(_0x468606,_0x4da72c){return db[_0x11ea('0x29')][_0x11ea('0x48')]({'where':{'id':_0x468606[_0x11ea('0x44')]['id']}})[_0x11ea('0x23')](handleEntityNotFound(_0x4da72c,null))[_0x11ea('0x23')](removeEntity(_0x4da72c,null))[_0x11ea('0x45')](handleError(_0x4da72c,null));};exports['getFields']=function(_0x247a09,_0x196a09,_0x2c8265){var _0x12738d={};var _0x340c6d={};var _0x2b7fb6;var _0x1dff4d;return db['ServicenowConfiguration'][_0x11ea('0x49')]({'where':{'id':_0x247a09[_0x11ea('0x44')]['id']}})[_0x11ea('0x23')](handleEntityNotFound(_0x196a09,null))[_0x11ea('0x23')](function(_0x18da77){if(_0x18da77){_0x2b7fb6=_0x18da77;_0x340c6d[_0x11ea('0x2d')]=_[_0x11ea('0x2f')](db[_0x11ea('0x4a')][_0x11ea('0x2a')]);_0x340c6d['query']=_['keys'](_0x247a09[_0x11ea('0x2e')]);_0x340c6d[_0x11ea('0x30')]=_[_0x11ea('0x31')](_0x340c6d['model'],_0x340c6d['query']);_0x12738d[_0x11ea('0x32')]=_[_0x11ea('0x31')](_0x340c6d['model'],qs['fields'](_0x247a09[_0x11ea('0x2e')][_0x11ea('0x33')]));_0x12738d['attributes']=_0x12738d[_0x11ea('0x32')]['length']?_0x12738d[_0x11ea('0x32')]:_0x340c6d['model'];_0x12738d['order']=qs[_0x11ea('0x37')](_0x247a09[_0x11ea('0x2e')][_0x11ea('0x37')]);_0x12738d['where']=qs[_0x11ea('0x30')](_[_0x11ea('0x38')](_0x247a09['query'],_0x340c6d['filters']));if(_0x247a09[_0x11ea('0x2e')]['filter']){_0x12738d['where']=_[_0x11ea('0x3a')](_0x12738d[_0x11ea('0x39')],{'$or':_[_0x11ea('0x3b')](_0x12738d[_0x11ea('0x32')],function(_0x39efbb){var _0x34c6d4={};_0x34c6d4[_0x39efbb]={'$like':'%'+_0x247a09[_0x11ea('0x2e')]['filter']+'%'};return _0x34c6d4;})});}_0x12738d=_[_0x11ea('0x3a')]({},_0x12738d,_0x247a09[_0x11ea('0x4b')]);return _0x2b7fb6[_0x11ea('0x4c')](_0x12738d);}})[_0x11ea('0x23')](function(_0x269509){if(_0x269509){_0x1dff4d=_0x269509[_0x11ea('0x34')];if(!_0x247a09[_0x11ea('0x2e')][_0x11ea('0x4d')]('nolimit')){_0x12738d[_0x11ea('0x1a')]=qs[_0x11ea('0x1a')](_0x247a09[_0x11ea('0x2e')]['limit']);_0x12738d['offset']=qs[_0x11ea('0x1b')](_0x247a09[_0x11ea('0x2e')][_0x11ea('0x1b')]);}return _0x2b7fb6[_0x11ea('0x4c')](_0x12738d);}})[_0x11ea('0x23')](function(_0x353fba){if(_0x353fba){return _0x353fba?{'count':_0x1dff4d,'rows':_0x353fba}:null;}})[_0x11ea('0x23')](respondWithResult(_0x196a09,null))[_0x11ea('0x45')](handleError(_0x196a09,null));};exports[_0x11ea('0x4e')]=function(_0x11a810,_0x4a9a87,_0x4ec90e){var _0x39b9ad={};var _0x50ccd2={};var _0x5249da;var _0x15ab9d;return db[_0x11ea('0x29')][_0x11ea('0x49')]({'where':{'id':_0x11a810[_0x11ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a9a87,null))[_0x11ea('0x23')](function(_0x84584f){if(_0x84584f){_0x5249da=_0x84584f;_0x50ccd2[_0x11ea('0x2d')]=_['keys'](db[_0x11ea('0x4a')][_0x11ea('0x2a')]);_0x50ccd2[_0x11ea('0x2e')]=_[_0x11ea('0x2f')](_0x11a810[_0x11ea('0x2e')]);_0x50ccd2[_0x11ea('0x30')]=_[_0x11ea('0x31')](_0x50ccd2[_0x11ea('0x2d')],_0x50ccd2[_0x11ea('0x2e')]);_0x39b9ad[_0x11ea('0x32')]=_[_0x11ea('0x31')](_0x50ccd2['model'],qs[_0x11ea('0x33')](_0x11a810[_0x11ea('0x2e')][_0x11ea('0x33')]));_0x39b9ad[_0x11ea('0x32')]=_0x39b9ad['attributes']['length']?_0x39b9ad[_0x11ea('0x32')]:_0x50ccd2[_0x11ea('0x2d')];_0x39b9ad['order']=qs['sort'](_0x11a810[_0x11ea('0x2e')][_0x11ea('0x37')]);_0x39b9ad[_0x11ea('0x39')]=qs['filters'](_['pick'](_0x11a810[_0x11ea('0x2e')],_0x50ccd2[_0x11ea('0x30')]));if(_0x11a810[_0x11ea('0x2e')][_0x11ea('0x3d')]){_0x39b9ad['where']=_[_0x11ea('0x3a')](_0x39b9ad[_0x11ea('0x39')],{'$or':_[_0x11ea('0x3b')](_0x39b9ad[_0x11ea('0x32')],function(_0x2877e9){var _0x4972a9={};_0x4972a9[_0x2877e9]={'$like':'%'+_0x11a810[_0x11ea('0x2e')][_0x11ea('0x3d')]+'%'};return _0x4972a9;})});}_0x39b9ad=_['merge']({},_0x39b9ad,_0x11a810[_0x11ea('0x4b')]);return _0x5249da[_0x11ea('0x4e')](_0x39b9ad);}})[_0x11ea('0x23')](function(_0xf6dcad){if(_0xf6dcad){_0x15ab9d=_0xf6dcad[_0x11ea('0x34')];if(!_0x11a810['query'][_0x11ea('0x4d')](_0x11ea('0x35'))){_0x39b9ad[_0x11ea('0x1a')]=qs[_0x11ea('0x1a')](_0x11a810[_0x11ea('0x2e')]['limit']);_0x39b9ad['offset']=qs[_0x11ea('0x1b')](_0x11a810[_0x11ea('0x2e')][_0x11ea('0x1b')]);}return _0x5249da['getSubjects'](_0x39b9ad);}})[_0x11ea('0x23')](function(_0x45d69a){if(_0x45d69a){return _0x45d69a?{'count':_0x15ab9d,'rows':_0x45d69a}:null;}})[_0x11ea('0x23')](respondWithResult(_0x4a9a87,null))[_0x11ea('0x45')](handleError(_0x4a9a87,null));};exports[_0x11ea('0x4f')]=function(_0x55685f,_0x42f78b,_0x5ac3f6){var _0xd7e056={};var _0x116c21={};var _0x2e6e7;var _0x4d5a82;return db['ServicenowConfiguration'][_0x11ea('0x49')]({'where':{'id':_0x55685f['params']['id']}})[_0x11ea('0x23')](handleEntityNotFound(_0x42f78b,null))[_0x11ea('0x23')](function(_0x3320ba){if(_0x3320ba){_0x2e6e7=_0x3320ba;_0x116c21['model']=_[_0x11ea('0x2f')](db[_0x11ea('0x4a')][_0x11ea('0x2a')]);_0x116c21['query']=_[_0x11ea('0x2f')](_0x55685f[_0x11ea('0x2e')]);_0x116c21[_0x11ea('0x30')]=_[_0x11ea('0x31')](_0x116c21[_0x11ea('0x2d')],_0x116c21[_0x11ea('0x2e')]);_0xd7e056[_0x11ea('0x32')]=_[_0x11ea('0x31')](_0x116c21[_0x11ea('0x2d')],qs[_0x11ea('0x33')](_0x55685f[_0x11ea('0x2e')]['fields']));_0xd7e056[_0x11ea('0x32')]=_0xd7e056[_0x11ea('0x32')][_0x11ea('0x34')]?_0xd7e056[_0x11ea('0x32')]:_0x116c21['model'];_0xd7e056[_0x11ea('0x36')]=qs[_0x11ea('0x37')](_0x55685f[_0x11ea('0x2e')][_0x11ea('0x37')]);_0xd7e056[_0x11ea('0x39')]=qs[_0x11ea('0x30')](_['pick'](_0x55685f[_0x11ea('0x2e')],_0x116c21[_0x11ea('0x30')]));if(_0x55685f['query'][_0x11ea('0x3d')]){_0xd7e056[_0x11ea('0x39')]=_[_0x11ea('0x3a')](_0xd7e056[_0x11ea('0x39')],{'$or':_[_0x11ea('0x3b')](_0xd7e056[_0x11ea('0x32')],function(_0xb891c4){var _0x4d4c18={};_0x4d4c18[_0xb891c4]={'$like':'%'+_0x55685f[_0x11ea('0x2e')][_0x11ea('0x3d')]+'%'};return _0x4d4c18;})});}_0xd7e056=_[_0x11ea('0x3a')]({},_0xd7e056,_0x55685f['options']);return _0x2e6e7[_0x11ea('0x4f')](_0xd7e056);}})[_0x11ea('0x23')](function(_0x3301b1){if(_0x3301b1){_0x4d5a82=_0x3301b1['length'];if(!_0x55685f['query'][_0x11ea('0x4d')](_0x11ea('0x35'))){_0xd7e056[_0x11ea('0x1a')]=qs[_0x11ea('0x1a')](_0x55685f[_0x11ea('0x2e')]['limit']);_0xd7e056[_0x11ea('0x1b')]=qs[_0x11ea('0x1b')](_0x55685f[_0x11ea('0x2e')][_0x11ea('0x1b')]);}return _0x2e6e7[_0x11ea('0x4f')](_0xd7e056);}})[_0x11ea('0x23')](function(_0xf9b0d3){if(_0xf9b0d3){return _0xf9b0d3?{'count':_0x4d5a82,'rows':_0xf9b0d3}:null;}})['then'](respondWithResult(_0x42f78b,null))[_0x11ea('0x45')](handleError(_0x42f78b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9b7b08b..dc58aeb 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 _0x4af8=['path','../../config/environment','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','moment','bluebird','request-promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4af8,0x1ad));var _0x84af=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4af8[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x84af('0x0'));var BPromise=require(_0x84af('0x1'));var rp=require(_0x84af('0x2'));var fs=require('fs');var path=require(_0x84af('0x3'));var rimraf=require('rimraf');var config=require(_0x84af('0x4'));var attributes=require(_0x84af('0x5'));module['exports']=function(_0x37c4f9,_0x3971f1){return _0x37c4f9['define'](_0x84af('0x6'),attributes,{'tableName':_0x84af('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ffa=['rimraf','../../config/environment','exports','ServicenowConfiguration','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x336c21,_0x5439de){var _0xb87533=function(_0x4e3c50){while(--_0x4e3c50){_0x336c21['push'](_0x336c21['shift']());}};_0xb87533(++_0x5439de);}(_0x4ffa,0x124));var _0xa4ff=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4ffa[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4ff('0x0'))('api');var moment=require(_0xa4ff('0x1'));var BPromise=require(_0xa4ff('0x2'));var rp=require(_0xa4ff('0x3'));var fs=require('fs');var path=require(_0xa4ff('0x4'));var rimraf=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xa4ff('0x7')]=function(_0x1d6a4c,_0x2bf21d){return _0x1d6a4c['define'](_0xa4ff('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b0c4106..5f972d1 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 _0x29b3=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x5bb95a,_0x50ea0f){var _0x2a75d5=function(_0x2fb00b){while(--_0x2fb00b){_0x5bb95a['push'](_0x5bb95a['shift']());}};_0x2a75d5(++_0x50ea0f);}(_0x29b3,0x160));var _0x329b=function(_0x5ef4cf,_0x940184){_0x5ef4cf=_0x5ef4cf-0x0;var _0x3f6007=_0x29b3[_0x5ef4cf];return _0x3f6007;};'use strict';var _=require(_0x329b('0x0'));var util=require(_0x329b('0x1'));var moment=require(_0x329b('0x2'));var BPromise=require('bluebird');var rs=require(_0x329b('0x3'));var fs=require('fs');var Redis=require(_0x329b('0x4'));var db=require(_0x329b('0x5'))['db'];var utils=require(_0x329b('0x6'));var logger=require(_0x329b('0x7'))(_0x329b('0x8'));var config=require(_0x329b('0x9'));var jayson=require(_0x329b('0xa'));var client=jayson[_0x329b('0xb')][_0x329b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x267eed,_0x4c0cc4,_0x1745a2){return new BPromise(function(_0x3f822c,_0xc733b4){return client['request'](_0x267eed,_0x1745a2)[_0x329b('0xd')](function(_0x4ea6e1){logger[_0x329b('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0cc4,_0x329b('0xf'));logger[_0x329b('0x10')](_0x329b('0x11'),_0x4c0cc4,'request\x20sent',JSON[_0x329b('0x12')](_0x4ea6e1));if(_0x4ea6e1['error']){if(_0x4ea6e1[_0x329b('0x13')][_0x329b('0x14')]===0x1f4){logger[_0x329b('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0cc4,_0x4ea6e1[_0x329b('0x13')][_0x329b('0x15')]);return _0xc733b4(_0x4ea6e1['error'][_0x329b('0x15')]);}logger[_0x329b('0x13')](_0x329b('0x16'),_0x4c0cc4,_0x4ea6e1[_0x329b('0x13')][_0x329b('0x15')]);return _0x3f822c(_0x4ea6e1[_0x329b('0x13')]['message']);}else{logger[_0x329b('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0cc4,_0x329b('0xf'));_0x3f822c(_0x4ea6e1[_0x329b('0x17')][_0x329b('0x15')]);}})[_0x329b('0x18')](function(_0x36ac18){logger[_0x329b('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4c0cc4,_0x36ac18);_0xc733b4(_0x36ac18);});});} \ No newline at end of file +var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x27c24c,_0x5a5295){_0x27c24c=_0x27c24c-0x0;var _0x38c985=_0x3f8a[_0x27c24c];return _0x38c985;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('ServicenowConfiguration,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6760722..6007bf8 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 _0x175a=['get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x3198fd,_0x3729d8){var _0x2dd0b=function(_0x94b525){while(--_0x94b525){_0x3198fd['push'](_0x3198fd['shift']());}};_0x2dd0b(++_0x3729d8);}(_0x175a,0x186));var _0xa175=function(_0x211d73,_0x4642c1){_0x211d73=_0x211d73-0x0;var _0x6046b3=_0x175a[_0x211d73];return _0x6046b3;};'use strict';var multer=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var path=require(_0xa175('0x2'));var timeout=require(_0xa175('0x3'));var express=require(_0xa175('0x4'));var router=express[_0xa175('0x5')]();var fs_extra=require(_0xa175('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa175('0x7'));var config=require(_0xa175('0x8'));var controller=require(_0xa175('0x9'));router[_0xa175('0xa')]('/',auth[_0xa175('0xb')](),controller[_0xa175('0xc')]);router['get'](_0xa175('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa175('0xe')]('/',auth[_0xa175('0xb')](),controller[_0xa175('0xf')]);router[_0xa175('0x10')](_0xa175('0xd'),auth[_0xa175('0xb')](),controller[_0xa175('0x11')]);router[_0xa175('0x12')]('/:id',auth[_0xa175('0xb')](),controller[_0xa175('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc41c=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x6ac5e3,_0x407615){var _0x1b878c=function(_0x2b730f){while(--_0x2b730f){_0x6ac5e3['push'](_0x6ac5e3['shift']());}};_0x1b878c(++_0x407615);}(_0xc41c,0xdb));var _0xcc41=function(_0x54d197,_0x5c5884){_0x54d197=_0x54d197-0x0;var _0x5aa343=_0xc41c[_0x54d197];return _0x5aa343;};'use strict';var multer=require(_0xcc41('0x0'));var util=require(_0xcc41('0x1'));var path=require(_0xcc41('0x2'));var timeout=require(_0xcc41('0x3'));var express=require(_0xcc41('0x4'));var router=express[_0xcc41('0x5')]();var fs_extra=require(_0xcc41('0x6'));var auth=require(_0xcc41('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcc41('0x8'));var controller=require(_0xcc41('0x9'));router[_0xcc41('0xa')]('/',auth[_0xcc41('0xb')](),controller[_0xcc41('0xc')]);router[_0xcc41('0xa')](_0xcc41('0xd'),auth[_0xcc41('0xb')](),controller[_0xcc41('0xe')]);router[_0xcc41('0xf')]('/',auth[_0xcc41('0xb')](),controller['create']);router[_0xcc41('0x10')](_0xcc41('0xd'),auth[_0xcc41('0xb')](),controller[_0xcc41('0x11')]);router[_0xcc41('0x12')](_0xcc41('0xd'),auth['isAuthenticated'](),controller[_0xcc41('0x13')]);module[_0xcc41('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9e5ec16..aba9e54 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 _0x3331=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x1f46e2,_0x38ec90){var _0x24e31c=function(_0x13f8b4){while(--_0x13f8b4){_0x1f46e2['push'](_0x1f46e2['shift']());}};_0x24e31c(++_0x38ec90);}(_0x3331,0x108));var _0x1333=function(_0x33af22,_0x531219){_0x33af22=_0x33af22-0x0;var _0x501478=_0x3331[_0x33af22];return _0x501478;};'use strict';var Sequelize=require(_0x1333('0x0'));module[_0x1333('0x1')]={'type':{'type':Sequelize[_0x1333('0x2')](_0x1333('0x3'),_0x1333('0x4'),'customVariable',_0x1333('0x5'),'picklist'),'defaultValue':_0x1333('0x3')},'content':{'type':Sequelize[_0x1333('0x6')]},'key':{'type':Sequelize[_0x1333('0x6')]},'keyType':{'type':Sequelize[_0x1333('0x2')](_0x1333('0x3'),_0x1333('0x4'),_0x1333('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1333('0x6')]},'nameField':{'type':Sequelize[_0x1333('0x6')]},'customField':{'type':Sequelize[_0x1333('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1333('0x6')]}}; \ No newline at end of file +var _0x6fb3=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x30d67a,_0x18d377){var _0x53a7a1=function(_0x1432c3){while(--_0x1432c3){_0x30d67a['push'](_0x30d67a['shift']());}};_0x53a7a1(++_0x18d377);}(_0x6fb3,0x1ba));var _0x36fb=function(_0x52d1e5,_0x565286){_0x52d1e5=_0x52d1e5-0x0;var _0x30c9af=_0x6fb3[_0x52d1e5];return _0x30c9af;};'use strict';var Sequelize=require(_0x36fb('0x0'));module[_0x36fb('0x1')]={'type':{'type':Sequelize[_0x36fb('0x2')]('string',_0x36fb('0x3'),'customVariable',_0x36fb('0x4'),_0x36fb('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x36fb('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x36fb('0x2')](_0x36fb('0x7'),'variable',_0x36fb('0x8'))},'keyContent':{'type':Sequelize[_0x36fb('0x6')]},'idField':{'type':Sequelize[_0x36fb('0x6')]},'nameField':{'type':Sequelize[_0x36fb('0x6')]},'customField':{'type':Sequelize[_0x36fb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36fb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index add0894..7add4ac 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 _0x9416=['../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','ServicenowField','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3abd09,_0x464673){var _0x5a88f2=function(_0x370fa0){while(--_0x370fa0){_0x3abd09['push'](_0x3abd09['shift']());}};_0x5a88f2(++_0x464673);}(_0x9416,0x84));var _0x6941=function(_0x559005,_0x200dc8){_0x559005=_0x559005-0x0;var _0x38a0ed=_0x9416[_0x559005];return _0x38a0ed;};'use strict';var emlformat=require(_0x6941('0x0'));var rimraf=require(_0x6941('0x1'));var zipdir=require(_0x6941('0x2'));var jsonpatch=require(_0x6941('0x3'));var rp=require(_0x6941('0x4'));var moment=require(_0x6941('0x5'));var BPromise=require(_0x6941('0x6'));var Mustache=require(_0x6941('0x7'));var util=require(_0x6941('0x8'));var path=require('path');var sox=require(_0x6941('0x9'));var csv=require(_0x6941('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6941('0xb'));var _=require(_0x6941('0xc'));var squel=require(_0x6941('0xd'));var crypto=require(_0x6941('0xe'));var jsforce=require(_0x6941('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6941('0x10'));var Papa=require(_0x6941('0x11'));var Redis=require(_0x6941('0x12'));var authService=require(_0x6941('0x13'));var qs=require(_0x6941('0x14'));var as=require(_0x6941('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6941('0x16'))(_0x6941('0x17'));var utils=require(_0x6941('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6941('0x19'));var db=require(_0x6941('0x1a'))['db'];function respondWithStatusCode(_0x25bf0c,_0x5b2540){_0x5b2540=_0x5b2540||0xcc;return function(_0x3c154e){if(_0x3c154e){return _0x25bf0c[_0x6941('0x1b')](_0x5b2540);}return _0x25bf0c[_0x6941('0x1c')](_0x5b2540)[_0x6941('0x1d')]();};}function respondWithResult(_0x238de2,_0x405bbf){_0x405bbf=_0x405bbf||0xc8;return function(_0x524f33){if(_0x524f33){return _0x238de2['status'](_0x405bbf)['json'](_0x524f33);}};}function respondWithFilteredResult(_0x18d782,_0x266dd2){return function(_0x5f224d){if(_0x5f224d){var _0x3cc664=typeof _0x266dd2[_0x6941('0x1e')]===_0x6941('0x1f')&&typeof _0x266dd2['limit']===_0x6941('0x1f');var _0x454819=_0x5f224d[_0x6941('0x20')];var _0x4d7671=_0x3cc664?0x0:_0x266dd2[_0x6941('0x1e')];var _0x30d262=_0x3cc664?_0x5f224d[_0x6941('0x20')]:_0x266dd2['offset']+_0x266dd2['limit'];var _0x3ac068;if(_0x30d262>=_0x454819){_0x30d262=_0x454819;_0x3ac068=0xc8;}else{_0x3ac068=0xce;}_0x18d782[_0x6941('0x1c')](_0x3ac068);return _0x18d782[_0x6941('0x21')](_0x6941('0x22'),_0x4d7671+'-'+_0x30d262+'/'+_0x454819)[_0x6941('0x23')](_0x5f224d);}return null;};}function patchUpdates(_0xc2dbe3){return function(_0x403745){try{jsonpatch[_0x6941('0x24')](_0x403745,_0xc2dbe3,!![]);}catch(_0x2d8a41){return BPromise[_0x6941('0x25')](_0x2d8a41);}return _0x403745[_0x6941('0x26')]();};}function saveUpdates(_0x4da510,_0x2b9052){return function(_0x54db0f){if(_0x54db0f){return _0x54db0f[_0x6941('0x27')](_0x4da510)[_0x6941('0x28')](function(_0x5ec793){return _0x5ec793;});}return null;};}function removeEntity(_0x5d48cc,_0x7902d8){return function(_0x4bc8c6){if(_0x4bc8c6){return _0x4bc8c6[_0x6941('0x29')]()[_0x6941('0x28')](function(){_0x5d48cc[_0x6941('0x1c')](0xcc)[_0x6941('0x1d')]();});}};}function handleEntityNotFound(_0x381b42,_0x42f0fb){return function(_0x54073e){if(!_0x54073e){_0x381b42[_0x6941('0x1b')](0x194);}return _0x54073e;};}function handleError(_0x328278,_0x365838){_0x365838=_0x365838||0x1f4;return function(_0x18e4d3){logger[_0x6941('0x2a')](_0x18e4d3[_0x6941('0x2b')]);if(_0x18e4d3['name']){delete _0x18e4d3[_0x6941('0x2c')];}_0x328278[_0x6941('0x1c')](_0x365838)[_0x6941('0x2d')](_0x18e4d3);};}exports['index']=function(_0x558b81,_0x2ee7b1){var _0x5bcb4f={},_0xc0058e={},_0x25ba3a={'count':0x0,'rows':[]};var _0x5daa0d=_['map'](db[_0x6941('0x2e')]['rawAttributes'],function(_0xab6984){return{'name':_0xab6984[_0x6941('0x2f')],'type':_0xab6984[_0x6941('0x30')][_0x6941('0x31')]};});_0xc0058e[_0x6941('0x32')]=_[_0x6941('0x33')](_0x5daa0d,'name');_0xc0058e[_0x6941('0x34')]=_[_0x6941('0x35')](_0x558b81[_0x6941('0x34')]);_0xc0058e['filters']=_[_0x6941('0x36')](_0xc0058e[_0x6941('0x32')],_0xc0058e[_0x6941('0x34')]);_0x5bcb4f[_0x6941('0x37')]=_['intersection'](_0xc0058e[_0x6941('0x32')],qs[_0x6941('0x38')](_0x558b81[_0x6941('0x34')][_0x6941('0x38')]));_0x5bcb4f[_0x6941('0x37')]=_0x5bcb4f[_0x6941('0x37')][_0x6941('0x39')]?_0x5bcb4f[_0x6941('0x37')]:_0xc0058e['model'];if(!_0x558b81[_0x6941('0x34')][_0x6941('0x3a')]('nolimit')){_0x5bcb4f[_0x6941('0x3b')]=qs['limit'](_0x558b81[_0x6941('0x34')][_0x6941('0x3b')]);_0x5bcb4f[_0x6941('0x1e')]=qs[_0x6941('0x1e')](_0x558b81[_0x6941('0x34')][_0x6941('0x1e')]);}_0x5bcb4f[_0x6941('0x3c')]=qs['sort'](_0x558b81[_0x6941('0x34')][_0x6941('0x3d')]);_0x5bcb4f[_0x6941('0x3e')]=qs[_0x6941('0x3f')](_[_0x6941('0x40')](_0x558b81[_0x6941('0x34')],_0xc0058e[_0x6941('0x3f')]),_0x5daa0d);if(_0x558b81[_0x6941('0x34')][_0x6941('0x41')]){_0x5bcb4f[_0x6941('0x3e')]=_[_0x6941('0x42')](_0x5bcb4f['where'],{'$or':_['map'](_0x5daa0d,function(_0x31f409){if(_0x31f409['type']!==_0x6941('0x43')){var _0x38cd52={};_0x38cd52[_0x31f409[_0x6941('0x2c')]]={'$like':'%'+_0x558b81[_0x6941('0x34')][_0x6941('0x41')]+'%'};return _0x38cd52;}})});}_0x5bcb4f=_[_0x6941('0x42')]({},_0x5bcb4f,_0x558b81['options']);var _0x485535={'where':_0x5bcb4f['where']};return db[_0x6941('0x2e')][_0x6941('0x20')](_0x485535)['then'](function(_0x9ce1e9){_0x25ba3a[_0x6941('0x20')]=_0x9ce1e9;if(_0x558b81[_0x6941('0x34')][_0x6941('0x44')]){_0x5bcb4f['include']=[{'all':!![]}];}return db[_0x6941('0x2e')][_0x6941('0x45')](_0x5bcb4f);})[_0x6941('0x28')](function(_0x3ca7e2){_0x25ba3a['rows']=_0x3ca7e2;return _0x25ba3a;})['then'](respondWithFilteredResult(_0x2ee7b1,_0x5bcb4f))[_0x6941('0x46')](handleError(_0x2ee7b1,null));};exports[_0x6941('0x47')]=function(_0x454299,_0x3f22a5){var _0x28b450={'raw':!![],'where':{'id':_0x454299[_0x6941('0x48')]['id']}},_0x3997ed={};_0x3997ed[_0x6941('0x32')]=_[_0x6941('0x35')](db[_0x6941('0x2e')][_0x6941('0x49')]);_0x3997ed[_0x6941('0x34')]=_[_0x6941('0x35')](_0x454299['query']);_0x3997ed['filters']=_[_0x6941('0x36')](_0x3997ed[_0x6941('0x32')],_0x3997ed['query']);_0x28b450[_0x6941('0x37')]=_[_0x6941('0x36')](_0x3997ed['model'],qs[_0x6941('0x38')](_0x454299[_0x6941('0x34')][_0x6941('0x38')]));_0x28b450['attributes']=_0x28b450[_0x6941('0x37')][_0x6941('0x39')]?_0x28b450[_0x6941('0x37')]:_0x3997ed[_0x6941('0x32')];if(_0x454299[_0x6941('0x34')][_0x6941('0x44')]){_0x28b450[_0x6941('0x4a')]=[{'all':!![]}];}_0x28b450=_[_0x6941('0x42')]({},_0x28b450,_0x454299[_0x6941('0x4b')]);return db[_0x6941('0x2e')]['find'](_0x28b450)['then'](handleEntityNotFound(_0x3f22a5,null))['then'](respondWithResult(_0x3f22a5,null))['catch'](handleError(_0x3f22a5,null));};exports['create']=function(_0xb8d695,_0x315c78){return db['ServicenowField'][_0x6941('0x4c')](_0xb8d695[_0x6941('0x4d')],{})[_0x6941('0x28')](respondWithResult(_0x315c78,0xc9))[_0x6941('0x46')](handleError(_0x315c78,null));};exports[_0x6941('0x27')]=function(_0x1e7b4a,_0x43d852){if(_0x1e7b4a['body']['id']){delete _0x1e7b4a[_0x6941('0x4d')]['id'];}return db[_0x6941('0x2e')][_0x6941('0x4e')]({'where':{'id':_0x1e7b4a[_0x6941('0x48')]['id']}})[_0x6941('0x28')](handleEntityNotFound(_0x43d852,null))['then'](saveUpdates(_0x1e7b4a[_0x6941('0x4d')],null))[_0x6941('0x28')](respondWithResult(_0x43d852,null))[_0x6941('0x46')](handleError(_0x43d852,null));};exports[_0x6941('0x29')]=function(_0x2e6dc7,_0xa875e1){return db[_0x6941('0x2e')][_0x6941('0x4e')]({'where':{'id':_0x2e6dc7[_0x6941('0x48')]['id']}})[_0x6941('0x28')](handleEntityNotFound(_0xa875e1,null))[_0x6941('0x28')](removeEntity(_0xa875e1,null))[_0x6941('0x46')](handleError(_0xa875e1,null));}; \ No newline at end of file +var _0xff29=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','ServicenowField','include','findAll','rows','catch','rawAttributes','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xbe8313,_0x1e28b0){var _0x2d6709=function(_0x5902d0){while(--_0x5902d0){_0xbe8313['push'](_0xbe8313['shift']());}};_0x2d6709(++_0x1e28b0);}(_0xff29,0x100));var _0x9ff2=function(_0x1bd146,_0x56a46e){_0x1bd146=_0x1bd146-0x0;var _0x4b8b79=_0xff29[_0x1bd146];return _0x4b8b79;};'use strict';var emlformat=require(_0x9ff2('0x0'));var rimraf=require(_0x9ff2('0x1'));var zipdir=require(_0x9ff2('0x2'));var jsonpatch=require(_0x9ff2('0x3'));var rp=require('request-promise');var moment=require(_0x9ff2('0x4'));var BPromise=require(_0x9ff2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ff2('0x6'));var sox=require(_0x9ff2('0x7'));var csv=require('to-csv');var ejs=require(_0x9ff2('0x8'));var fs=require('fs');var fs_extra=require(_0x9ff2('0x9'));var _=require(_0x9ff2('0xa'));var squel=require(_0x9ff2('0xb'));var crypto=require(_0x9ff2('0xc'));var jsforce=require(_0x9ff2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ff2('0xe'));var Papa=require('papaparse');var Redis=require(_0x9ff2('0xf'));var authService=require(_0x9ff2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9ff2('0x11'));var hardwareService=require(_0x9ff2('0x12'));var logger=require(_0x9ff2('0x13'))(_0x9ff2('0x14'));var utils=require(_0x9ff2('0x15'));var config=require(_0x9ff2('0x16'));var licenseUtil=require(_0x9ff2('0x17'));var db=require(_0x9ff2('0x18'))['db'];function respondWithStatusCode(_0x3af04f,_0x20d545){_0x20d545=_0x20d545||0xcc;return function(_0x536961){if(_0x536961){return _0x3af04f['sendStatus'](_0x20d545);}return _0x3af04f[_0x9ff2('0x19')](_0x20d545)[_0x9ff2('0x1a')]();};}function respondWithResult(_0x446b88,_0x18f764){_0x18f764=_0x18f764||0xc8;return function(_0x285dc5){if(_0x285dc5){return _0x446b88['status'](_0x18f764)[_0x9ff2('0x1b')](_0x285dc5);}};}function respondWithFilteredResult(_0x11bfa4,_0x1e5819){return function(_0x255745){if(_0x255745){var _0x580732=typeof _0x1e5819['offset']===_0x9ff2('0x1c')&&typeof _0x1e5819[_0x9ff2('0x1d')]==='undefined';var _0x273633=_0x255745[_0x9ff2('0x1e')];var _0x6feff3=_0x580732?0x0:_0x1e5819[_0x9ff2('0x1f')];var _0x274dff=_0x580732?_0x255745['count']:_0x1e5819[_0x9ff2('0x1f')]+_0x1e5819[_0x9ff2('0x1d')];var _0x1acba9;if(_0x274dff>=_0x273633){_0x274dff=_0x273633;_0x1acba9=0xc8;}else{_0x1acba9=0xce;}_0x11bfa4[_0x9ff2('0x19')](_0x1acba9);return _0x11bfa4[_0x9ff2('0x20')](_0x9ff2('0x21'),_0x6feff3+'-'+_0x274dff+'/'+_0x273633)[_0x9ff2('0x1b')](_0x255745);}return null;};}function patchUpdates(_0x5e1eef){return function(_0x5872f9){try{jsonpatch['apply'](_0x5872f9,_0x5e1eef,!![]);}catch(_0x54f1be){return BPromise['reject'](_0x54f1be);}return _0x5872f9[_0x9ff2('0x22')]();};}function saveUpdates(_0x5900bf,_0x2b4ac7){return function(_0x489a35){if(_0x489a35){return _0x489a35['update'](_0x5900bf)[_0x9ff2('0x23')](function(_0x544d28){return _0x544d28;});}return null;};}function removeEntity(_0x767463,_0x478dbc){return function(_0x39c951){if(_0x39c951){return _0x39c951[_0x9ff2('0x24')]()[_0x9ff2('0x23')](function(){_0x767463[_0x9ff2('0x19')](0xcc)[_0x9ff2('0x1a')]();});}};}function handleEntityNotFound(_0x3cb518,_0x4cdb1f){return function(_0x476764){if(!_0x476764){_0x3cb518['sendStatus'](0x194);}return _0x476764;};}function handleError(_0x530b6f,_0x48c58a){_0x48c58a=_0x48c58a||0x1f4;return function(_0x36e913){logger[_0x9ff2('0x25')](_0x36e913[_0x9ff2('0x26')]);if(_0x36e913[_0x9ff2('0x27')]){delete _0x36e913['name'];}_0x530b6f[_0x9ff2('0x19')](_0x48c58a)[_0x9ff2('0x28')](_0x36e913);};}exports[_0x9ff2('0x29')]=function(_0x3c9c46,_0x4ed405){var _0x1b8499={},_0x59c079={},_0x491e9b={'count':0x0,'rows':[]};var _0x1806b0=_['map'](db['ServicenowField']['rawAttributes'],function(_0x430cb1){return{'name':_0x430cb1[_0x9ff2('0x2a')],'type':_0x430cb1[_0x9ff2('0x2b')][_0x9ff2('0x2c')]};});_0x59c079[_0x9ff2('0x2d')]=_[_0x9ff2('0x2e')](_0x1806b0,_0x9ff2('0x27'));_0x59c079[_0x9ff2('0x2f')]=_[_0x9ff2('0x30')](_0x3c9c46['query']);_0x59c079[_0x9ff2('0x31')]=_[_0x9ff2('0x32')](_0x59c079[_0x9ff2('0x2d')],_0x59c079['query']);_0x1b8499[_0x9ff2('0x33')]=_['intersection'](_0x59c079[_0x9ff2('0x2d')],qs[_0x9ff2('0x34')](_0x3c9c46['query'][_0x9ff2('0x34')]));_0x1b8499[_0x9ff2('0x33')]=_0x1b8499[_0x9ff2('0x33')][_0x9ff2('0x35')]?_0x1b8499[_0x9ff2('0x33')]:_0x59c079[_0x9ff2('0x2d')];if(!_0x3c9c46[_0x9ff2('0x2f')][_0x9ff2('0x36')]('nolimit')){_0x1b8499[_0x9ff2('0x1d')]=qs['limit'](_0x3c9c46[_0x9ff2('0x2f')][_0x9ff2('0x1d')]);_0x1b8499[_0x9ff2('0x1f')]=qs[_0x9ff2('0x1f')](_0x3c9c46[_0x9ff2('0x2f')][_0x9ff2('0x1f')]);}_0x1b8499['order']=qs['sort'](_0x3c9c46['query']['sort']);_0x1b8499[_0x9ff2('0x37')]=qs['filters'](_[_0x9ff2('0x38')](_0x3c9c46['query'],_0x59c079[_0x9ff2('0x31')]),_0x1806b0);if(_0x3c9c46[_0x9ff2('0x2f')][_0x9ff2('0x39')]){_0x1b8499[_0x9ff2('0x37')]=_[_0x9ff2('0x3a')](_0x1b8499[_0x9ff2('0x37')],{'$or':_['map'](_0x1806b0,function(_0x3c9087){if(_0x3c9087[_0x9ff2('0x2b')]!=='VIRTUAL'){var _0x44a7b7={};_0x44a7b7[_0x3c9087['name']]={'$like':'%'+_0x3c9c46[_0x9ff2('0x2f')][_0x9ff2('0x39')]+'%'};return _0x44a7b7;}})});}_0x1b8499=_[_0x9ff2('0x3a')]({},_0x1b8499,_0x3c9c46['options']);var _0x2fd7c9={'where':_0x1b8499[_0x9ff2('0x37')]};return db[_0x9ff2('0x3b')][_0x9ff2('0x1e')](_0x2fd7c9)[_0x9ff2('0x23')](function(_0x45660a){_0x491e9b['count']=_0x45660a;if(_0x3c9c46[_0x9ff2('0x2f')]['includeAll']){_0x1b8499[_0x9ff2('0x3c')]=[{'all':!![]}];}return db[_0x9ff2('0x3b')][_0x9ff2('0x3d')](_0x1b8499);})[_0x9ff2('0x23')](function(_0x57a094){_0x491e9b[_0x9ff2('0x3e')]=_0x57a094;return _0x491e9b;})[_0x9ff2('0x23')](respondWithFilteredResult(_0x4ed405,_0x1b8499))[_0x9ff2('0x3f')](handleError(_0x4ed405,null));};exports['show']=function(_0x3cb10e,_0x29b6d2){var _0x55845f={'raw':!![],'where':{'id':_0x3cb10e['params']['id']}},_0x456ea8={};_0x456ea8[_0x9ff2('0x2d')]=_['keys'](db[_0x9ff2('0x3b')][_0x9ff2('0x40')]);_0x456ea8['query']=_[_0x9ff2('0x30')](_0x3cb10e[_0x9ff2('0x2f')]);_0x456ea8[_0x9ff2('0x31')]=_[_0x9ff2('0x32')](_0x456ea8[_0x9ff2('0x2d')],_0x456ea8[_0x9ff2('0x2f')]);_0x55845f['attributes']=_[_0x9ff2('0x32')](_0x456ea8[_0x9ff2('0x2d')],qs[_0x9ff2('0x34')](_0x3cb10e[_0x9ff2('0x2f')]['fields']));_0x55845f[_0x9ff2('0x33')]=_0x55845f[_0x9ff2('0x33')][_0x9ff2('0x35')]?_0x55845f[_0x9ff2('0x33')]:_0x456ea8[_0x9ff2('0x2d')];if(_0x3cb10e[_0x9ff2('0x2f')][_0x9ff2('0x41')]){_0x55845f[_0x9ff2('0x3c')]=[{'all':!![]}];}_0x55845f=_[_0x9ff2('0x3a')]({},_0x55845f,_0x3cb10e[_0x9ff2('0x42')]);return db[_0x9ff2('0x3b')]['find'](_0x55845f)[_0x9ff2('0x23')](handleEntityNotFound(_0x29b6d2,null))[_0x9ff2('0x23')](respondWithResult(_0x29b6d2,null))['catch'](handleError(_0x29b6d2,null));};exports[_0x9ff2('0x43')]=function(_0x3fdf43,_0x40d41b){return db[_0x9ff2('0x3b')][_0x9ff2('0x43')](_0x3fdf43[_0x9ff2('0x44')],{})[_0x9ff2('0x23')](respondWithResult(_0x40d41b,0xc9))['catch'](handleError(_0x40d41b,null));};exports['update']=function(_0x2cac9c,_0x3d1565){if(_0x2cac9c[_0x9ff2('0x44')]['id']){delete _0x2cac9c['body']['id'];}return db[_0x9ff2('0x3b')][_0x9ff2('0x45')]({'where':{'id':_0x2cac9c['params']['id']}})[_0x9ff2('0x23')](handleEntityNotFound(_0x3d1565,null))[_0x9ff2('0x23')](saveUpdates(_0x2cac9c['body'],null))[_0x9ff2('0x23')](respondWithResult(_0x3d1565,null))[_0x9ff2('0x3f')](handleError(_0x3d1565,null));};exports[_0x9ff2('0x24')]=function(_0x16ba6f,_0x214bc5){return db['ServicenowField'][_0x9ff2('0x45')]({'where':{'id':_0x16ba6f['params']['id']}})[_0x9ff2('0x23')](handleEntityNotFound(_0x214bc5,null))['then'](removeEntity(_0x214bc5,null))[_0x9ff2('0x3f')](handleError(_0x214bc5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 205ae9a..459c6c7 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 _0xa2c8=['api','moment','bluebird','path','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger'];(function(_0xa528e5,_0xfbf573){var _0x43923c=function(_0x1b40fc){while(--_0x1b40fc){_0xa528e5['push'](_0xa528e5['shift']());}};_0x43923c(++_0xfbf573);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var logger=require(_0x8a2c('0x2'))(_0x8a2c('0x3'));var moment=require(_0x8a2c('0x4'));var BPromise=require(_0x8a2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x8a2c('0x7')]=function(_0x40fb26,_0x3f754a){return _0x40fb26[_0x8a2c('0x8')]('ServicenowField',attributes,{'tableName':_0x8a2c('0x9'),'paranoid':![],'indexes':[{'name':_0x8a2c('0xa'),'fields':[_0x8a2c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9adb=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ServicenowField'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x9adb,0xf2));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xb9ad('0x0'));var logger=require(_0xb9ad('0x1'))(_0xb9ad('0x2'));var moment=require(_0xb9ad('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9ad('0x4'));var rimraf=require(_0xb9ad('0x5'));var config=require(_0xb9ad('0x6'));var attributes=require('./intServicenowField.attributes');module[_0xb9ad('0x7')]=function(_0x520e39,_0x5da579){return _0x520e39[_0xb9ad('0x8')](_0xb9ad('0x9'),attributes,{'tableName':_0xb9ad('0xa'),'paranoid':![],'indexes':[{'name':_0xb9ad('0xb'),'fields':[_0xb9ad('0xc'),_0xb9ad('0xd')],'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 86e4cd6..6eaf10e 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x28240d,_0x419a72){var _0x52725f=function(_0x233aa0){while(--_0x233aa0){_0x28240d['push'](_0x28240d['shift']());}};_0x52725f(++_0x419a72);}(_0xaa88,0x137));var _0x8aa8=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0xaa88[_0x2f227c];return _0x5032bc;};'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')]('ServicenowField,\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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xac4a,0x13f));var _0xaac4=function(_0x235dc9,_0x2342ba){_0x235dc9=_0x235dc9-0x0;var _0x452fce=_0xac4a[_0x235dc9];return _0x452fce;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c09388d..0271b5a 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(_0x53263b,_0x44af11){var _0x6d3690=function(_0x75f4c2){while(--_0x75f4c2){_0x53263b['push'](_0x53263b['shift']());}};_0x6d3690(++_0x44af11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x436043,_0x5a258f){var _0x25a997=function(_0x228108){while(--_0x228108){_0x436043['push'](_0x436043['shift']());}};_0x25a997(++_0x5a258f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a7452ae..d5d1ae5 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(_0x118266,_0x4f3547){var _0x452669=function(_0x3a567b){while(--_0x3a567b){_0x118266['push'](_0x118266['shift']());}};_0x452669(++_0x4f3547);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x17b3bc,_0x14ed24){var _0xccb449=function(_0x124e2c){while(--_0x124e2c){_0x17b3bc['push'](_0x17b3bc['shift']());}};_0xccb449(++_0x14ed24);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 91cf7e2..c552e8d 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 _0xe348=['Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','direction','remoteUri','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','endsWith','test','error','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe348,0x9e));var _0x8e34=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xe348[_0x1b4b23];return _0x2a325b;};'use strict';var emlformat=require(_0x8e34('0x0'));var rimraf=require(_0x8e34('0x1'));var zipdir=require(_0x8e34('0x2'));var jsonpatch=require(_0x8e34('0x3'));var rp=require(_0x8e34('0x4'));var moment=require(_0x8e34('0x5'));var BPromise=require(_0x8e34('0x6'));var Mustache=require(_0x8e34('0x7'));var util=require('util');var path=require(_0x8e34('0x8'));var sox=require('sox');var csv=require(_0x8e34('0x9'));var ejs=require(_0x8e34('0xa'));var fs=require('fs');var fs_extra=require(_0x8e34('0xb'));var _=require(_0x8e34('0xc'));var squel=require(_0x8e34('0xd'));var crypto=require(_0x8e34('0xe'));var jsforce=require(_0x8e34('0xf'));var deskjs=require(_0x8e34('0x10'));var toCsv=require(_0x8e34('0x9'));var querystring=require(_0x8e34('0x11'));var Papa=require('papaparse');var Redis=require(_0x8e34('0x12'));var authService=require(_0x8e34('0x13'));var qs=require(_0x8e34('0x14'));var as=require(_0x8e34('0x15'));var hardwareService=require(_0x8e34('0x16'));var logger=require(_0x8e34('0x17'))(_0x8e34('0x18'));var utils=require(_0x8e34('0x19'));var config=require(_0x8e34('0x1a'));var licenseUtil=require(_0x8e34('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8e34('0x1c'));function respondWithStatusCode(_0x3f38db,_0x2d6f6b){_0x2d6f6b=_0x2d6f6b||0xcc;return function(_0x376068){if(_0x376068){return _0x3f38db['sendStatus'](_0x2d6f6b);}return _0x3f38db[_0x8e34('0x1d')](_0x2d6f6b)[_0x8e34('0x1e')]();};}function respondWithResult(_0x472efa,_0x9517ca){_0x9517ca=_0x9517ca||0xc8;return function(_0x1e96d5){if(_0x1e96d5){return _0x472efa[_0x8e34('0x1d')](_0x9517ca)['json'](_0x1e96d5);}};}function respondWithFilteredResult(_0x5d64a1,_0x469393){return function(_0x336532){if(_0x336532){var _0x216c34=typeof _0x469393[_0x8e34('0x1f')]===_0x8e34('0x20')&&typeof _0x469393[_0x8e34('0x21')]===_0x8e34('0x20');var _0xdf256e=_0x336532['count'];var _0x6487ab=_0x216c34?0x0:_0x469393['offset'];var _0x16a0d5=_0x216c34?_0x336532[_0x8e34('0x22')]:_0x469393[_0x8e34('0x1f')]+_0x469393[_0x8e34('0x21')];var _0x1d2203;if(_0x16a0d5>=_0xdf256e){_0x16a0d5=_0xdf256e;_0x1d2203=0xc8;}else{_0x1d2203=0xce;}_0x5d64a1[_0x8e34('0x1d')](_0x1d2203);return _0x5d64a1[_0x8e34('0x23')](_0x8e34('0x24'),_0x6487ab+'-'+_0x16a0d5+'/'+_0xdf256e)[_0x8e34('0x25')](_0x336532);}return null;};}function patchUpdates(_0x5ee394){return function(_0x2f10da){try{jsonpatch[_0x8e34('0x26')](_0x2f10da,_0x5ee394,!![]);}catch(_0x236d5a){return BPromise[_0x8e34('0x27')](_0x236d5a);}return _0x2f10da['save']();};}function saveUpdates(_0x8857e5,_0x3b5a15){return function(_0xe4d6db){if(_0xe4d6db){return _0xe4d6db[_0x8e34('0x28')](_0x8857e5)[_0x8e34('0x29')](function(_0x1ec0e8){return _0x1ec0e8;});}return null;};}function removeEntity(_0x3b4c1e,_0x1b71e4){return function(_0x508dee){if(_0x508dee){return _0x508dee[_0x8e34('0x2a')]()[_0x8e34('0x29')](function(){_0x3b4c1e[_0x8e34('0x1d')](0xcc)[_0x8e34('0x1e')]();});}};}function handleEntityNotFound(_0x1958f1,_0x3dcbff){return function(_0x4866a8){if(!_0x4866a8){_0x1958f1[_0x8e34('0x2b')](0x194);}return _0x4866a8;};}function handleError(_0x2f6627,_0x465f7d){_0x465f7d=_0x465f7d||0x1f4;return function(_0x13d972){logger['error'](_0x13d972['stack']);if(_0x13d972[_0x8e34('0x2c')]){delete _0x13d972[_0x8e34('0x2c')];}_0x2f6627[_0x8e34('0x1d')](_0x465f7d)[_0x8e34('0x2d')](_0x13d972);};}exports[_0x8e34('0x2e')]=function(_0x50ab04,_0x24c1d3){var _0x1b60b0={},_0x28f823={},_0x280557={'count':0x0,'rows':[]};var _0x1a1567=_[_0x8e34('0x2f')](db[_0x8e34('0x30')][_0x8e34('0x31')],function(_0x2dd43a){return{'name':_0x2dd43a[_0x8e34('0x32')],'type':_0x2dd43a[_0x8e34('0x33')][_0x8e34('0x34')]};});_0x28f823[_0x8e34('0x35')]=_['map'](_0x1a1567,'name');_0x28f823['query']=_['keys'](_0x50ab04['query']);_0x28f823[_0x8e34('0x36')]=_[_0x8e34('0x37')](_0x28f823[_0x8e34('0x35')],_0x28f823[_0x8e34('0x38')]);_0x1b60b0[_0x8e34('0x39')]=_['intersection'](_0x28f823[_0x8e34('0x35')],qs[_0x8e34('0x3a')](_0x50ab04[_0x8e34('0x38')][_0x8e34('0x3a')]));_0x1b60b0[_0x8e34('0x39')]=_0x1b60b0[_0x8e34('0x39')]['length']?_0x1b60b0[_0x8e34('0x39')]:_0x28f823[_0x8e34('0x35')];if(!_0x50ab04[_0x8e34('0x38')][_0x8e34('0x3b')](_0x8e34('0x3c'))){_0x1b60b0['limit']=qs[_0x8e34('0x21')](_0x50ab04[_0x8e34('0x38')][_0x8e34('0x21')]);_0x1b60b0['offset']=qs[_0x8e34('0x1f')](_0x50ab04[_0x8e34('0x38')][_0x8e34('0x1f')]);}_0x1b60b0[_0x8e34('0x3d')]=qs[_0x8e34('0x3e')](_0x50ab04[_0x8e34('0x38')]['sort']);_0x1b60b0['where']=qs[_0x8e34('0x36')](_[_0x8e34('0x3f')](_0x50ab04['query'],_0x28f823[_0x8e34('0x36')]),_0x1a1567);if(_0x50ab04['query']['filter']){_0x1b60b0[_0x8e34('0x40')]=_[_0x8e34('0x41')](_0x1b60b0[_0x8e34('0x40')],{'$or':_[_0x8e34('0x2f')](_0x1a1567,function(_0x5aa9ee){if(_0x5aa9ee[_0x8e34('0x33')]!=='VIRTUAL'){var _0x39976f={};_0x39976f[_0x5aa9ee[_0x8e34('0x2c')]]={'$like':'%'+_0x50ab04[_0x8e34('0x38')][_0x8e34('0x42')]+'%'};return _0x39976f;}})});}_0x1b60b0=_[_0x8e34('0x41')]({},_0x1b60b0,_0x50ab04[_0x8e34('0x43')]);var _0x1df9f2={'where':_0x1b60b0['where']};return db[_0x8e34('0x30')][_0x8e34('0x22')](_0x1df9f2)[_0x8e34('0x29')](function(_0x29f262){_0x280557[_0x8e34('0x22')]=_0x29f262;if(_0x50ab04['query'][_0x8e34('0x44')]){_0x1b60b0[_0x8e34('0x45')]=[{'all':!![]}];}return db[_0x8e34('0x30')][_0x8e34('0x46')](_0x1b60b0);})[_0x8e34('0x29')](function(_0x4ab773){_0x280557[_0x8e34('0x47')]=_0x4ab773;return _0x280557;})[_0x8e34('0x29')](respondWithFilteredResult(_0x24c1d3,_0x1b60b0))[_0x8e34('0x48')](handleError(_0x24c1d3,null));};exports[_0x8e34('0x49')]=function(_0xd0e32,_0x19f77f){var _0x156ff8={'raw':![],'where':{'id':_0xd0e32[_0x8e34('0x4a')]['id']}},_0x5d3886={};_0x5d3886[_0x8e34('0x35')]=_[_0x8e34('0x4b')](db[_0x8e34('0x30')][_0x8e34('0x31')]);_0x5d3886[_0x8e34('0x38')]=_['keys'](_0xd0e32['query']);_0x5d3886[_0x8e34('0x36')]=_[_0x8e34('0x37')](_0x5d3886['model'],_0x5d3886[_0x8e34('0x38')]);_0x156ff8[_0x8e34('0x39')]=_[_0x8e34('0x37')](_0x5d3886[_0x8e34('0x35')],qs[_0x8e34('0x3a')](_0xd0e32[_0x8e34('0x38')][_0x8e34('0x3a')]));_0x156ff8[_0x8e34('0x39')]=_0x156ff8[_0x8e34('0x39')]['length']?_0x156ff8[_0x8e34('0x39')]:_0x5d3886[_0x8e34('0x35')];if(_0xd0e32['query'][_0x8e34('0x44')]){_0x156ff8[_0x8e34('0x45')]=[{'all':!![]}];}_0x156ff8=_[_0x8e34('0x41')]({},_0x156ff8,_0xd0e32[_0x8e34('0x43')]);return db[_0x8e34('0x30')][_0x8e34('0x4c')](_0x156ff8)[_0x8e34('0x29')](handleEntityNotFound(_0x19f77f,null))[_0x8e34('0x29')](respondWithResult(_0x19f77f,null))[_0x8e34('0x48')](handleError(_0x19f77f,null));};exports['create']=function(_0x563ab2,_0x1f727a){return db[_0x8e34('0x30')][_0x8e34('0x4d')](_0x563ab2['body'],{})['then'](respondWithResult(_0x1f727a,0xc9))['catch'](handleError(_0x1f727a,null));};exports[_0x8e34('0x28')]=function(_0x4341f9,_0xf5c6fb){if(_0x4341f9['body']['id']){delete _0x4341f9[_0x8e34('0x4e')]['id'];}return db[_0x8e34('0x30')]['find']({'where':{'id':_0x4341f9[_0x8e34('0x4a')]['id']}})[_0x8e34('0x29')](handleEntityNotFound(_0xf5c6fb,null))[_0x8e34('0x29')](saveUpdates(_0x4341f9[_0x8e34('0x4e')],null))['then'](respondWithResult(_0xf5c6fb,null))[_0x8e34('0x48')](handleError(_0xf5c6fb,null));};exports[_0x8e34('0x2a')]=function(_0xdbfcde,_0x51190f){return db[_0x8e34('0x30')]['find']({'where':{'id':_0xdbfcde[_0x8e34('0x4a')]['id']}})[_0x8e34('0x29')](handleEntityNotFound(_0x51190f,null))[_0x8e34('0x29')](removeEntity(_0x51190f,null))[_0x8e34('0x48')](handleError(_0x51190f,null));};exports[_0x8e34('0x4f')]=function(_0x4f6e76,_0x33e23f,_0x2f8f39){var _0x10d3c7={};var _0x11e1a1={};var _0x1413aa;var _0x3d7d8f;return db[_0x8e34('0x30')][_0x8e34('0x50')]({'where':{'id':_0x4f6e76[_0x8e34('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33e23f,null))[_0x8e34('0x29')](function(_0x32ed18){if(_0x32ed18){_0x1413aa=_0x32ed18;_0x11e1a1['model']=_[_0x8e34('0x4b')](db['SugarcrmConfiguration'][_0x8e34('0x31')]);_0x11e1a1['query']=_[_0x8e34('0x4b')](_0x4f6e76[_0x8e34('0x38')]);_0x11e1a1[_0x8e34('0x36')]=_[_0x8e34('0x37')](_0x11e1a1[_0x8e34('0x35')],_0x11e1a1[_0x8e34('0x38')]);_0x10d3c7[_0x8e34('0x39')]=_[_0x8e34('0x37')](_0x11e1a1['model'],qs[_0x8e34('0x3a')](_0x4f6e76[_0x8e34('0x38')][_0x8e34('0x3a')]));_0x10d3c7[_0x8e34('0x39')]=_0x10d3c7['attributes'][_0x8e34('0x51')]?_0x10d3c7[_0x8e34('0x39')]:_0x11e1a1['model'];_0x10d3c7['order']=qs[_0x8e34('0x3e')](_0x4f6e76['query'][_0x8e34('0x3e')]);_0x10d3c7[_0x8e34('0x40')]=qs[_0x8e34('0x36')](_['pick'](_0x4f6e76[_0x8e34('0x38')],_0x11e1a1[_0x8e34('0x36')]));if(_0x4f6e76[_0x8e34('0x38')][_0x8e34('0x42')]){_0x10d3c7[_0x8e34('0x40')]=_['merge'](_0x10d3c7['where'],{'$or':_[_0x8e34('0x2f')](_0x10d3c7['attributes'],function(_0x35ad57){var _0xa4ece7={};_0xa4ece7[_0x35ad57]={'$like':'%'+_0x4f6e76[_0x8e34('0x38')]['filter']+'%'};return _0xa4ece7;})});}_0x10d3c7=_[_0x8e34('0x41')]({},_0x10d3c7,_0x4f6e76['options']);return _0x1413aa[_0x8e34('0x4f')](_0x10d3c7);}})[_0x8e34('0x29')](function(_0x209a2f){if(_0x209a2f){_0x3d7d8f=_0x209a2f[_0x8e34('0x51')];if(!_0x4f6e76[_0x8e34('0x38')]['hasOwnProperty'](_0x8e34('0x3c'))){_0x10d3c7['limit']=qs[_0x8e34('0x21')](_0x4f6e76['query']['limit']);_0x10d3c7[_0x8e34('0x1f')]=qs[_0x8e34('0x1f')](_0x4f6e76[_0x8e34('0x38')][_0x8e34('0x1f')]);}return _0x1413aa['getConfigurations'](_0x10d3c7);}})[_0x8e34('0x29')](function(_0x25116c){if(_0x25116c){return _0x25116c?{'count':_0x3d7d8f,'rows':_0x25116c}:null;}})[_0x8e34('0x29')](respondWithResult(_0x33e23f,null))[_0x8e34('0x48')](handleError(_0x33e23f,null));};exports['addConfiguration']=function(_0x469a54,_0x573e2e,_0x41d070){if(_0x469a54['body']['id']){delete _0x469a54[_0x8e34('0x4e')]['id'];}return db[_0x8e34('0x30')][_0x8e34('0x50')]({'where':{'id':_0x469a54['params']['id']}})[_0x8e34('0x29')](handleEntityNotFound(_0x573e2e,null))[_0x8e34('0x29')](function(_0x16ee15){if(_0x16ee15){_0x469a54[_0x8e34('0x4e')]['AccountId']=_0x16ee15['id'];_0x469a54['body'][_0x8e34('0x52')]=integrations[_0x8e34('0x53')](_0x469a54[_0x8e34('0x4e')][_0x8e34('0x54')],_0x469a54[_0x8e34('0x4e')][_0x8e34('0x33')]);_0x469a54[_0x8e34('0x4e')][_0x8e34('0x55')]=integrations[_0x8e34('0x56')](_0x469a54['body']['channel'],_0x469a54[_0x8e34('0x4e')][_0x8e34('0x33')]);return db[_0x8e34('0x57')][_0x8e34('0x4d')](_0x469a54[_0x8e34('0x4e')],{'include':[{'model':db[_0x8e34('0x58')],'as':_0x8e34('0x52')},{'model':db[_0x8e34('0x58')],'as':'Descriptions'}]});}return null;})[_0x8e34('0x29')](respondWithResult(_0x573e2e,null))['catch'](handleError(_0x573e2e,null));};exports[_0x8e34('0x59')]=function(_0x4ad093,_0x4d08cd,_0x454381){var _0x50cf84='';var _0xf5daf4=['id',_0x8e34('0x2c'),'assigned_user_id',_0x8e34('0x5a'),_0x8e34('0x5b'),_0x8e34('0x5c'),_0x8e34('0x5d'),_0x8e34('0x5e'),'parent_id',_0x8e34('0x5f'),'parent_name',_0x8e34('0x60')];return db[_0x8e34('0x30')][_0x8e34('0x50')]({'where':{'id':_0x4ad093['params']['id']},'attributes':['id','username','password',_0x8e34('0x61')]})[_0x8e34('0x29')](handleEntityNotFound(_0x4d08cd,null))[_0x8e34('0x29')](function(_0x588cdf){if(_0x588cdf){_0x50cf84=_0x588cdf['remoteUri'];var _0x3bed98=_0x50cf84['slice'](-0x1);if(_0x3bed98==='/'){_0x50cf84=_0x50cf84[_0x8e34('0x62')](0x0,_0x50cf84[_0x8e34('0x63')](_0x3bed98));}return rp({'method':_0x8e34('0x64'),'uri':util[_0x8e34('0x65')](_0x8e34('0x66'),_0x50cf84,_0x8e34('0x67')),'json':!![],'form':{'method':'login','input_type':_0x8e34('0x68'),'response_type':_0x8e34('0x68'),'rest_data':JSON[_0x8e34('0x69')]({'user_auth':{'user_name':_0x588cdf[_0x8e34('0x6a')],'password':_0x588cdf['password'],'encryption':_0x8e34('0x6b')},'application':_0x8e34('0x6c')})}});}})[_0x8e34('0x29')](function(_0x2e614a){if(_0x2e614a&&_0x2e614a[_0x8e34('0x2c')]!==_0x8e34('0x6d')&&_0x2e614a[_0x8e34('0x2c')]!==_0x8e34('0x6e')){return rp({'method':'POST','uri':util[_0x8e34('0x65')](_0x8e34('0x66'),_0x50cf84,_0x8e34('0x67')),'json':!![],'form':{'method':_0x8e34('0x6f'),'input_type':_0x8e34('0x68'),'response_type':_0x8e34('0x68'),'rest_data':JSON[_0x8e34('0x69')]({'session':_0x2e614a['id'],'module_name':_0x8e34('0x70')})}})[_0x8e34('0x29')](function(_0x5dd9d3){if(_0x5dd9d3){var _0x46f10e=_[_0x8e34('0x71')](_0x5dd9d3[_0x8e34('0x72')]);_['remove'](_0x46f10e,function(_0x120bfa){return _0xf5daf4['includes'](_0x120bfa[_0x8e34('0x2c')]);});return{'count':_0x46f10e[_0x8e34('0x51')],'rows':_[_0x8e34('0x2f')](_0x46f10e,function(_0x79aad0){return{'id':_0x79aad0[_0x8e34('0x2c')],'name':_0x79aad0['label'],'custom':_[_0x8e34('0x73')](_0x79aad0[_0x8e34('0x2c')],'_c')?!![]:![],'options':_0x79aad0[_0x8e34('0x43')]?_[_0x8e34('0x2f')](_[_0x8e34('0x71')](_0x79aad0[_0x8e34('0x43')]),function(_0x389846){return{'name':_0x389846['value'],'value':_0x389846['name']};}):[]};})};}})[_0x8e34('0x29')](respondWithResult(_0x4d08cd,null))[_0x8e34('0x48')](function(_0x523728){var _0x1ce97e=_0x4ad093['query'][_0x8e34('0x74')]?0x1f4:_0x523728['statusCode']||0x1f4;logger[_0x8e34('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0x8e34('0x59'),_0x1ce97e,JSON[_0x8e34('0x69')](_0x523728));delete _0x523728[_0x8e34('0x2c')];if(_0x1ce97e===0x191){_0x1ce97e=0x190;}_0x4d08cd[_0x8e34('0x1d')](_0x1ce97e)[_0x8e34('0x2d')](_0x4ad093[_0x8e34('0x38')][_0x8e34('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x523728[_0x8e34('0x76')]}:_0x523728);});}else{var _0x44d304=0x1f4;_0x4d08cd[_0x8e34('0x1d')](_0x44d304)[_0x8e34('0x2d')]({'message':_0x8e34('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x03a0=['Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','order'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03a0,0xa7));var _0x003a=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x03a0[_0x384231];return _0x2480bf;};'use strict';var emlformat=require(_0x003a('0x0'));var rimraf=require(_0x003a('0x1'));var zipdir=require(_0x003a('0x2'));var jsonpatch=require(_0x003a('0x3'));var rp=require(_0x003a('0x4'));var moment=require('moment');var BPromise=require(_0x003a('0x5'));var Mustache=require(_0x003a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x003a('0x7'));var csv=require(_0x003a('0x8'));var ejs=require(_0x003a('0x9'));var fs=require('fs');var fs_extra=require(_0x003a('0xa'));var _=require(_0x003a('0xb'));var squel=require(_0x003a('0xc'));var crypto=require(_0x003a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x003a('0xe'));var toCsv=require(_0x003a('0x8'));var querystring=require('querystring');var Papa=require(_0x003a('0xf'));var Redis=require(_0x003a('0x10'));var authService=require(_0x003a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x003a('0x12'));var hardwareService=require(_0x003a('0x13'));var logger=require('../../config/logger')(_0x003a('0x14'));var utils=require(_0x003a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x003a('0x16'));var db=require(_0x003a('0x17'))['db'];var integrations=require(_0x003a('0x18'));function respondWithStatusCode(_0x37ead1,_0x5d062a){_0x5d062a=_0x5d062a||0xcc;return function(_0xdc0004){if(_0xdc0004){return _0x37ead1[_0x003a('0x19')](_0x5d062a);}return _0x37ead1['status'](_0x5d062a)[_0x003a('0x1a')]();};}function respondWithResult(_0x23c975,_0x514ae0){_0x514ae0=_0x514ae0||0xc8;return function(_0x2aac09){if(_0x2aac09){return _0x23c975[_0x003a('0x1b')](_0x514ae0)[_0x003a('0x1c')](_0x2aac09);}};}function respondWithFilteredResult(_0x5d3392,_0x16d821){return function(_0x18d489){if(_0x18d489){var _0x1874dc=typeof _0x16d821[_0x003a('0x1d')]===_0x003a('0x1e')&&typeof _0x16d821[_0x003a('0x1f')]===_0x003a('0x1e');var _0x518acd=_0x18d489[_0x003a('0x20')];var _0xa024fb=_0x1874dc?0x0:_0x16d821[_0x003a('0x1d')];var _0x1647f9=_0x1874dc?_0x18d489['count']:_0x16d821[_0x003a('0x1d')]+_0x16d821['limit'];var _0x46b83d;if(_0x1647f9>=_0x518acd){_0x1647f9=_0x518acd;_0x46b83d=0xc8;}else{_0x46b83d=0xce;}_0x5d3392['status'](_0x46b83d);return _0x5d3392[_0x003a('0x21')](_0x003a('0x22'),_0xa024fb+'-'+_0x1647f9+'/'+_0x518acd)['json'](_0x18d489);}return null;};}function patchUpdates(_0x3b367b){return function(_0x32f047){try{jsonpatch[_0x003a('0x23')](_0x32f047,_0x3b367b,!![]);}catch(_0x2169ba){return BPromise[_0x003a('0x24')](_0x2169ba);}return _0x32f047[_0x003a('0x25')]();};}function saveUpdates(_0x172b70,_0x913698){return function(_0x5c2b73){if(_0x5c2b73){return _0x5c2b73[_0x003a('0x26')](_0x172b70)[_0x003a('0x27')](function(_0x5eb8a5){return _0x5eb8a5;});}return null;};}function removeEntity(_0x52e700,_0x3ebb90){return function(_0x258c15){if(_0x258c15){return _0x258c15[_0x003a('0x28')]()[_0x003a('0x27')](function(){_0x52e700['status'](0xcc)[_0x003a('0x1a')]();});}};}function handleEntityNotFound(_0x116e75,_0x2a3ab5){return function(_0xb879e2){if(!_0xb879e2){_0x116e75[_0x003a('0x19')](0x194);}return _0xb879e2;};}function handleError(_0x537c0a,_0x2f3fc8){_0x2f3fc8=_0x2f3fc8||0x1f4;return function(_0x3dc81f){logger['error'](_0x3dc81f[_0x003a('0x29')]);if(_0x3dc81f[_0x003a('0x2a')]){delete _0x3dc81f[_0x003a('0x2a')];}_0x537c0a['status'](_0x2f3fc8)['send'](_0x3dc81f);};}exports['index']=function(_0x552d7a,_0x2a48f9){var _0x43129e={},_0x31d7ef={},_0x444d33={'count':0x0,'rows':[]};var _0x5cf3e0=_[_0x003a('0x2b')](db[_0x003a('0x2c')][_0x003a('0x2d')],function(_0x122998){return{'name':_0x122998[_0x003a('0x2e')],'type':_0x122998[_0x003a('0x2f')][_0x003a('0x30')]};});_0x31d7ef['model']=_[_0x003a('0x2b')](_0x5cf3e0,_0x003a('0x2a'));_0x31d7ef[_0x003a('0x31')]=_[_0x003a('0x32')](_0x552d7a[_0x003a('0x31')]);_0x31d7ef[_0x003a('0x33')]=_['intersection'](_0x31d7ef[_0x003a('0x34')],_0x31d7ef[_0x003a('0x31')]);_0x43129e[_0x003a('0x35')]=_[_0x003a('0x36')](_0x31d7ef[_0x003a('0x34')],qs[_0x003a('0x37')](_0x552d7a[_0x003a('0x31')][_0x003a('0x37')]));_0x43129e[_0x003a('0x35')]=_0x43129e[_0x003a('0x35')][_0x003a('0x38')]?_0x43129e[_0x003a('0x35')]:_0x31d7ef[_0x003a('0x34')];if(!_0x552d7a[_0x003a('0x31')][_0x003a('0x39')](_0x003a('0x3a'))){_0x43129e[_0x003a('0x1f')]=qs[_0x003a('0x1f')](_0x552d7a['query'][_0x003a('0x1f')]);_0x43129e['offset']=qs[_0x003a('0x1d')](_0x552d7a[_0x003a('0x31')]['offset']);}_0x43129e['order']=qs[_0x003a('0x3b')](_0x552d7a['query'][_0x003a('0x3b')]);_0x43129e[_0x003a('0x3c')]=qs[_0x003a('0x33')](_[_0x003a('0x3d')](_0x552d7a[_0x003a('0x31')],_0x31d7ef['filters']),_0x5cf3e0);if(_0x552d7a[_0x003a('0x31')][_0x003a('0x3e')]){_0x43129e[_0x003a('0x3c')]=_[_0x003a('0x3f')](_0x43129e[_0x003a('0x3c')],{'$or':_['map'](_0x5cf3e0,function(_0x363349){if(_0x363349[_0x003a('0x2f')]!==_0x003a('0x40')){var _0x3431ee={};_0x3431ee[_0x363349[_0x003a('0x2a')]]={'$like':'%'+_0x552d7a['query'][_0x003a('0x3e')]+'%'};return _0x3431ee;}})});}_0x43129e=_[_0x003a('0x3f')]({},_0x43129e,_0x552d7a[_0x003a('0x41')]);var _0x577ac2={'where':_0x43129e['where']};return db['SugarcrmAccount'][_0x003a('0x20')](_0x577ac2)[_0x003a('0x27')](function(_0xb84071){_0x444d33[_0x003a('0x20')]=_0xb84071;if(_0x552d7a[_0x003a('0x31')][_0x003a('0x42')]){_0x43129e[_0x003a('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x43129e);})[_0x003a('0x27')](function(_0x41201a){_0x444d33[_0x003a('0x44')]=_0x41201a;return _0x444d33;})[_0x003a('0x27')](respondWithFilteredResult(_0x2a48f9,_0x43129e))[_0x003a('0x45')](handleError(_0x2a48f9,null));};exports[_0x003a('0x46')]=function(_0xffeee1,_0x27edc8){var _0x53194d={'raw':![],'where':{'id':_0xffeee1['params']['id']}},_0x5ebc9f={};_0x5ebc9f[_0x003a('0x34')]=_[_0x003a('0x32')](db[_0x003a('0x2c')][_0x003a('0x2d')]);_0x5ebc9f[_0x003a('0x31')]=_[_0x003a('0x32')](_0xffeee1[_0x003a('0x31')]);_0x5ebc9f['filters']=_['intersection'](_0x5ebc9f[_0x003a('0x34')],_0x5ebc9f[_0x003a('0x31')]);_0x53194d[_0x003a('0x35')]=_['intersection'](_0x5ebc9f['model'],qs[_0x003a('0x37')](_0xffeee1[_0x003a('0x31')][_0x003a('0x37')]));_0x53194d['attributes']=_0x53194d['attributes'][_0x003a('0x38')]?_0x53194d['attributes']:_0x5ebc9f['model'];if(_0xffeee1[_0x003a('0x31')]['includeAll']){_0x53194d['include']=[{'all':!![]}];}_0x53194d=_[_0x003a('0x3f')]({},_0x53194d,_0xffeee1[_0x003a('0x41')]);return db['SugarcrmAccount']['find'](_0x53194d)[_0x003a('0x27')](handleEntityNotFound(_0x27edc8,null))[_0x003a('0x27')](respondWithResult(_0x27edc8,null))['catch'](handleError(_0x27edc8,null));};exports[_0x003a('0x47')]=function(_0x5e64a9,_0x52d6f){return db[_0x003a('0x2c')][_0x003a('0x47')](_0x5e64a9[_0x003a('0x48')],{})[_0x003a('0x27')](respondWithResult(_0x52d6f,0xc9))['catch'](handleError(_0x52d6f,null));};exports[_0x003a('0x26')]=function(_0x432a7c,_0x20aa90){if(_0x432a7c[_0x003a('0x48')]['id']){delete _0x432a7c[_0x003a('0x48')]['id'];}return db[_0x003a('0x2c')][_0x003a('0x49')]({'where':{'id':_0x432a7c[_0x003a('0x4a')]['id']}})[_0x003a('0x27')](handleEntityNotFound(_0x20aa90,null))[_0x003a('0x27')](saveUpdates(_0x432a7c['body'],null))[_0x003a('0x27')](respondWithResult(_0x20aa90,null))[_0x003a('0x45')](handleError(_0x20aa90,null));};exports[_0x003a('0x28')]=function(_0x5d421c,_0x54cac7){return db[_0x003a('0x2c')]['find']({'where':{'id':_0x5d421c[_0x003a('0x4a')]['id']}})[_0x003a('0x27')](handleEntityNotFound(_0x54cac7,null))[_0x003a('0x27')](removeEntity(_0x54cac7,null))[_0x003a('0x45')](handleError(_0x54cac7,null));};exports[_0x003a('0x4b')]=function(_0xa35fe9,_0x4e135b,_0x3b39ee){var _0xee98c={};var _0x373e1d={};var _0x200428;var _0x599490;return db[_0x003a('0x2c')][_0x003a('0x4c')]({'where':{'id':_0xa35fe9[_0x003a('0x4a')]['id']}})[_0x003a('0x27')](handleEntityNotFound(_0x4e135b,null))[_0x003a('0x27')](function(_0x47712e){if(_0x47712e){_0x200428=_0x47712e;_0x373e1d['model']=_[_0x003a('0x32')](db[_0x003a('0x4d')]['rawAttributes']);_0x373e1d[_0x003a('0x31')]=_[_0x003a('0x32')](_0xa35fe9['query']);_0x373e1d[_0x003a('0x33')]=_[_0x003a('0x36')](_0x373e1d[_0x003a('0x34')],_0x373e1d[_0x003a('0x31')]);_0xee98c[_0x003a('0x35')]=_['intersection'](_0x373e1d[_0x003a('0x34')],qs[_0x003a('0x37')](_0xa35fe9['query'][_0x003a('0x37')]));_0xee98c[_0x003a('0x35')]=_0xee98c[_0x003a('0x35')][_0x003a('0x38')]?_0xee98c[_0x003a('0x35')]:_0x373e1d[_0x003a('0x34')];_0xee98c[_0x003a('0x4e')]=qs[_0x003a('0x3b')](_0xa35fe9[_0x003a('0x31')][_0x003a('0x3b')]);_0xee98c[_0x003a('0x3c')]=qs[_0x003a('0x33')](_['pick'](_0xa35fe9[_0x003a('0x31')],_0x373e1d[_0x003a('0x33')]));if(_0xa35fe9[_0x003a('0x31')][_0x003a('0x3e')]){_0xee98c[_0x003a('0x3c')]=_[_0x003a('0x3f')](_0xee98c[_0x003a('0x3c')],{'$or':_[_0x003a('0x2b')](_0xee98c[_0x003a('0x35')],function(_0x2f5ff7){var _0x9cf8a3={};_0x9cf8a3[_0x2f5ff7]={'$like':'%'+_0xa35fe9['query'][_0x003a('0x3e')]+'%'};return _0x9cf8a3;})});}_0xee98c=_[_0x003a('0x3f')]({},_0xee98c,_0xa35fe9['options']);return _0x200428[_0x003a('0x4b')](_0xee98c);}})[_0x003a('0x27')](function(_0x13dec6){if(_0x13dec6){_0x599490=_0x13dec6['length'];if(!_0xa35fe9[_0x003a('0x31')][_0x003a('0x39')](_0x003a('0x3a'))){_0xee98c[_0x003a('0x1f')]=qs[_0x003a('0x1f')](_0xa35fe9[_0x003a('0x31')][_0x003a('0x1f')]);_0xee98c[_0x003a('0x1d')]=qs[_0x003a('0x1d')](_0xa35fe9[_0x003a('0x31')][_0x003a('0x1d')]);}return _0x200428[_0x003a('0x4b')](_0xee98c);}})[_0x003a('0x27')](function(_0x4c7b40){if(_0x4c7b40){return _0x4c7b40?{'count':_0x599490,'rows':_0x4c7b40}:null;}})[_0x003a('0x27')](respondWithResult(_0x4e135b,null))[_0x003a('0x45')](handleError(_0x4e135b,null));};exports['addConfiguration']=function(_0x544f4b,_0x18da35,_0xcc6a6a){if(_0x544f4b[_0x003a('0x48')]['id']){delete _0x544f4b[_0x003a('0x48')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x544f4b[_0x003a('0x4a')]['id']}})[_0x003a('0x27')](handleEntityNotFound(_0x18da35,null))[_0x003a('0x27')](function(_0x2f21be){if(_0x2f21be){_0x544f4b[_0x003a('0x48')]['AccountId']=_0x2f21be['id'];_0x544f4b[_0x003a('0x48')][_0x003a('0x4f')]=integrations[_0x003a('0x50')](_0x544f4b[_0x003a('0x48')][_0x003a('0x51')],_0x544f4b['body'][_0x003a('0x2f')]);_0x544f4b['body']['Descriptions']=integrations[_0x003a('0x52')](_0x544f4b[_0x003a('0x48')]['channel'],_0x544f4b['body']['type']);return db[_0x003a('0x4d')][_0x003a('0x47')](_0x544f4b[_0x003a('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0x003a('0x4f')},{'model':db[_0x003a('0x53')],'as':_0x003a('0x54')}]});}return null;})['then'](respondWithResult(_0x18da35,null))[_0x003a('0x45')](handleError(_0x18da35,null));};exports['getFields']=function(_0x42c5d3,_0x80fae,_0x494f97){var _0x28da99='';var _0x2fbc4c=['id','name',_0x003a('0x55'),_0x003a('0x56'),_0x003a('0x57'),_0x003a('0x58'),_0x003a('0x59'),_0x003a('0x5a'),_0x003a('0x5b'),_0x003a('0x5c'),_0x003a('0x5d'),'direction'];return db['SugarcrmAccount'][_0x003a('0x4c')]({'where':{'id':_0x42c5d3['params']['id']},'attributes':['id',_0x003a('0x5e'),_0x003a('0x5f'),_0x003a('0x60')]})[_0x003a('0x27')](handleEntityNotFound(_0x80fae,null))[_0x003a('0x27')](function(_0x9daa1d){if(_0x9daa1d){_0x28da99=_0x9daa1d[_0x003a('0x60')];var _0x3e4467=_0x28da99[_0x003a('0x61')](-0x1);if(_0x3e4467==='/'){_0x28da99=_0x28da99[_0x003a('0x62')](0x0,_0x28da99['lastIndexOf'](_0x3e4467));}return rp({'method':_0x003a('0x63'),'uri':util[_0x003a('0x64')](_0x003a('0x65'),_0x28da99,_0x003a('0x66')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x003a('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x9daa1d[_0x003a('0x5e')],'password':_0x9daa1d[_0x003a('0x5f')],'encryption':_0x003a('0x68')},'application':_0x003a('0x69')})}});}})[_0x003a('0x27')](function(_0x219c38){if(_0x219c38&&_0x219c38[_0x003a('0x2a')]!=='Invalid\x20Login'&&_0x219c38['name']!==_0x003a('0x6a')){return rp({'method':_0x003a('0x63'),'uri':util[_0x003a('0x64')](_0x003a('0x65'),_0x28da99,_0x003a('0x66')),'json':!![],'form':{'method':_0x003a('0x6b'),'input_type':'JSON','response_type':_0x003a('0x67'),'rest_data':JSON['stringify']({'session':_0x219c38['id'],'module_name':'Calls'})}})[_0x003a('0x27')](function(_0x33cdd6){if(_0x33cdd6){var _0x5e2957=_[_0x003a('0x6c')](_0x33cdd6[_0x003a('0x6d')]);_[_0x003a('0x6e')](_0x5e2957,function(_0x495518){return _0x2fbc4c[_0x003a('0x6f')](_0x495518[_0x003a('0x2a')]);});return{'count':_0x5e2957[_0x003a('0x38')],'rows':_[_0x003a('0x2b')](_0x5e2957,function(_0x10cd12){return{'id':_0x10cd12['name'],'name':_0x10cd12[_0x003a('0x70')],'custom':_[_0x003a('0x71')](_0x10cd12[_0x003a('0x2a')],'_c')?!![]:![],'options':_0x10cd12[_0x003a('0x41')]?_[_0x003a('0x2b')](_[_0x003a('0x6c')](_0x10cd12[_0x003a('0x41')]),function(_0x55b8d6){return{'name':_0x55b8d6[_0x003a('0x72')],'value':_0x55b8d6[_0x003a('0x2a')]};}):[]};})};}})[_0x003a('0x27')](respondWithResult(_0x80fae,null))['catch'](function(_0x24f2fe){var _0x2b1af5=_0x42c5d3['query'][_0x003a('0x73')]?0x1f4:_0x24f2fe[_0x003a('0x74')]||0x1f4;logger[_0x003a('0x75')](_0x003a('0x76'),_0x003a('0x77'),_0x2b1af5,JSON[_0x003a('0x78')](_0x24f2fe));delete _0x24f2fe['name'];if(_0x2b1af5===0x191){_0x2b1af5=0x190;}_0x80fae[_0x003a('0x1b')](_0x2b1af5)[_0x003a('0x79')](_0x42c5d3['query'][_0x003a('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x24f2fe[_0x003a('0x74')]}:_0x24f2fe);});}else{var _0x36d3c4=0x1f4;_0x80fae[_0x003a('0x1b')](_0x36d3c4)[_0x003a('0x79')]({'message':_0x003a('0x7a'),'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 c09cbf0..5d352d8 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 _0x8ac0=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0x8ac0,0x9e));var _0x08ac=function(_0x8b3dbb,_0x44b151){_0x8b3dbb=_0x8b3dbb-0x0;var _0x4680c1=_0x8ac0[_0x8b3dbb];return _0x4680c1;};'use strict';var _=require(_0x08ac('0x0'));var util=require(_0x08ac('0x1'));var logger=require(_0x08ac('0x2'))(_0x08ac('0x3'));var moment=require('moment');var BPromise=require(_0x08ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08ac('0x5'));var config=require(_0x08ac('0x6'));var attributes=require(_0x08ac('0x7'));var integrations=require(_0x08ac('0x8'));module[_0x08ac('0x9')]=function(_0x5a7808,_0x5c5a4b){return _0x5a7808['define'](_0x08ac('0xa'),attributes,{'tableName':_0x08ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eae=['request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3eae,0x126));var _0xe3ea=function(_0x4a5f6c,_0x4f532e){_0x4a5f6c=_0x4a5f6c-0x0;var _0x281ffd=_0x3eae[_0x4a5f6c];return _0x281ffd;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var logger=require(_0xe3ea('0x2'))(_0xe3ea('0x3'));var moment=require('moment');var BPromise=require(_0xe3ea('0x4'));var rp=require(_0xe3ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3ea('0x6'));var config=require(_0xe3ea('0x7'));var attributes=require(_0xe3ea('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xe3ea('0x9')]=function(_0x345ccd,_0x216558){return _0x345ccd[_0xe3ea('0xa')](_0xe3ea('0xb'),attributes,{'tableName':_0xe3ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0cd0673..12935a4 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 _0x396c=['ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x425eb2,_0x2679c1){var _0x516ed8=function(_0x2cfda3){while(--_0x2cfda3){_0x425eb2['push'](_0x425eb2['shift']());}};_0x516ed8(++_0x2679c1);}(_0x396c,0x1f0));var _0xc396=function(_0x11bb60,_0x3ee729){_0x11bb60=_0x11bb60-0x0;var _0x558c2b=_0x396c[_0x11bb60];return _0x558c2b;};'use strict';var _=require(_0xc396('0x0'));var util=require('util');var moment=require(_0xc396('0x1'));var BPromise=require(_0xc396('0x2'));var rs=require(_0xc396('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc396('0x4'))['db'];var utils=require(_0xc396('0x5'));var logger=require(_0xc396('0x6'))(_0xc396('0x7'));var config=require('../../config/environment');var jayson=require(_0xc396('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2636c2,_0x5510d8,_0x21d6a8){return new BPromise(function(_0x152f6c,_0x4f4c23){return client[_0xc396('0x9')](_0x2636c2,_0x21d6a8)[_0xc396('0xa')](function(_0x43e2b0){logger[_0xc396('0xb')](_0xc396('0xc'),_0x5510d8,_0xc396('0xd'));logger[_0xc396('0xe')](_0xc396('0xf'),_0x5510d8,_0xc396('0xd'),JSON['stringify'](_0x43e2b0));if(_0x43e2b0['error']){if(_0x43e2b0['error'][_0xc396('0x10')]===0x1f4){logger[_0xc396('0x11')](_0xc396('0xc'),_0x5510d8,_0x43e2b0[_0xc396('0x11')]['message']);return _0x4f4c23(_0x43e2b0[_0xc396('0x11')][_0xc396('0x12')]);}logger[_0xc396('0x11')](_0xc396('0xc'),_0x5510d8,_0x43e2b0['error'][_0xc396('0x12')]);return _0x152f6c(_0x43e2b0['error'][_0xc396('0x12')]);}else{logger[_0xc396('0xb')](_0xc396('0xc'),_0x5510d8,'request\x20sent');_0x152f6c(_0x43e2b0[_0xc396('0x13')][_0xc396('0x12')]);}})[_0xc396('0x14')](function(_0x2ba03a){logger[_0xc396('0x11')](_0xc396('0xc'),_0x5510d8,_0x2ba03a);_0x4f4c23(_0x2ba03a);});});}exports[_0xc396('0x15')]=function(_0x166470){var _0x6b4331=this;return new Promise(function(_0x27ea96,_0x3a2ea1){return db[_0xc396('0x16')][_0xc396('0x17')]({'raw':_0x166470[_0xc396('0x18')]?_0x166470[_0xc396('0x18')][_0xc396('0x19')]===undefined?!![]:![]:!![],'where':_0x166470['options']?_0x166470[_0xc396('0x18')][_0xc396('0x1a')]||null:null,'attributes':_0x166470[_0xc396('0x18')]?_0x166470['options'][_0xc396('0x1b')]||null:null,'limit':_0x166470[_0xc396('0x18')]?_0x166470[_0xc396('0x18')][_0xc396('0x1c')]||null:null,'include':_0x166470['options']?_0x166470[_0xc396('0x18')]['include']?_[_0xc396('0x1d')](_0x166470[_0xc396('0x18')][_0xc396('0x1e')],function(_0x757fe7){return{'model':db[_0x757fe7[_0xc396('0x1f')]],'as':_0x757fe7['as'],'attributes':_0x757fe7[_0xc396('0x1b')],'include':_0x757fe7['include']?_[_0xc396('0x1d')](_0x757fe7[_0xc396('0x1e')],function(_0xf10623){return{'model':db[_0xf10623['model']],'as':_0xf10623['as'],'attributes':_0xf10623[_0xc396('0x1b')],'include':_0xf10623[_0xc396('0x1e')]?_[_0xc396('0x1d')](_0xf10623[_0xc396('0x1e')],function(_0x35a0d2){return{'model':db[_0x35a0d2['model']],'as':_0x35a0d2['as'],'attributes':_0x35a0d2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x96439f){logger[_0xc396('0xb')](_0xc396('0x15'),_0x166470);logger[_0xc396('0xe')](_0xc396('0x15'),_0x166470,JSON['stringify'](_0x96439f));_0x27ea96(_0x96439f);})[_0xc396('0x14')](function(_0x5ee5b6){logger[_0xc396('0x11')](_0xc396('0x15'),_0x5ee5b6['message'],_0x166470);_0x3a2ea1(_0x6b4331[_0xc396('0x11')](0x1f4,_0x5ee5b6[_0xc396('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x46cc70){var _0x2491f5=this;return new Promise(function(_0xbd3714,_0x30b085){return db[_0xc396('0x16')]['find']({'raw':_0x46cc70['options']?_0x46cc70['options']['raw']===undefined?!![]:![]:!![],'where':_0x46cc70[_0xc396('0x18')]?_0x46cc70[_0xc396('0x18')][_0xc396('0x1a')]||null:null,'attributes':_0x46cc70[_0xc396('0x18')]?_0x46cc70[_0xc396('0x18')][_0xc396('0x1b')]||null:null,'include':_0x46cc70[_0xc396('0x18')]?_0x46cc70[_0xc396('0x18')][_0xc396('0x1e')]?_[_0xc396('0x1d')](_0x46cc70[_0xc396('0x18')]['include'],function(_0x43cc57){return{'model':db[_0x43cc57[_0xc396('0x1f')]],'as':_0x43cc57['as'],'attributes':_0x43cc57['attributes'],'include':_0x43cc57[_0xc396('0x1e')]?_[_0xc396('0x1d')](_0x43cc57['include'],function(_0x53a948){return{'model':db[_0x53a948[_0xc396('0x1f')]],'as':_0x53a948['as'],'attributes':_0x53a948[_0xc396('0x1b')],'include':_0x53a948['include']?_['map'](_0x53a948[_0xc396('0x1e')],function(_0x31baf3){return{'model':db[_0x31baf3[_0xc396('0x1f')]],'as':_0x31baf3['as'],'attributes':_0x31baf3[_0xc396('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc396('0xa')](function(_0x141f27){logger[_0xc396('0xb')]('ShowSugarcrmAccount',_0x46cc70);logger['debug'](_0xc396('0x20'),_0x46cc70,JSON['stringify'](_0x141f27));_0xbd3714(_0x141f27);})[_0xc396('0x14')](function(_0x5560ab){logger[_0xc396('0x11')]('ShowSugarcrmAccount',_0x5560ab['message'],_0x46cc70);_0x30b085(_0x2491f5['error'](0x1f4,_0x5560ab['message']));});});}; \ No newline at end of file +var _0x548e=['../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','include','map','model','debug','catch','ShowSugarcrmAccount','util','moment','randomstring','ioredis'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x548e,0x1af));var _0xe548=function(_0x1ff240,_0x3929d5){_0x1ff240=_0x1ff240-0x0;var _0x2cfbcc=_0x548e[_0x1ff240];return _0x2cfbcc;};'use strict';var _=require('lodash');var util=require(_0xe548('0x0'));var moment=require(_0xe548('0x1'));var BPromise=require('bluebird');var rs=require(_0xe548('0x2'));var fs=require('fs');var Redis=require(_0xe548('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe548('0x4'));var logger=require(_0xe548('0x5'))(_0xe548('0x6'));var config=require('../../config/environment');var jayson=require(_0xe548('0x7'));var client=jayson[_0xe548('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1962b2,_0x1cedcb,_0x21cfe8){return new BPromise(function(_0x4879ae,_0x144345){return client['request'](_0x1962b2,_0x21cfe8)[_0xe548('0x9')](function(_0x101bbd){logger[_0xe548('0xa')](_0xe548('0xb'),_0x1cedcb,_0xe548('0xc'));logger['debug'](_0xe548('0xd'),_0x1cedcb,_0xe548('0xc'),JSON['stringify'](_0x101bbd));if(_0x101bbd['error']){if(_0x101bbd[_0xe548('0xe')][_0xe548('0xf')]===0x1f4){logger[_0xe548('0xe')](_0xe548('0xb'),_0x1cedcb,_0x101bbd[_0xe548('0xe')][_0xe548('0x10')]);return _0x144345(_0x101bbd[_0xe548('0xe')]['message']);}logger['error'](_0xe548('0xb'),_0x1cedcb,_0x101bbd[_0xe548('0xe')]['message']);return _0x4879ae(_0x101bbd[_0xe548('0xe')][_0xe548('0x10')]);}else{logger[_0xe548('0xa')](_0xe548('0xb'),_0x1cedcb,'request\x20sent');_0x4879ae(_0x101bbd['result'][_0xe548('0x10')]);}})['catch'](function(_0x3bfe12){logger[_0xe548('0xe')](_0xe548('0xb'),_0x1cedcb,_0x3bfe12);_0x144345(_0x3bfe12);});});}exports[_0xe548('0x11')]=function(_0x93dff4){var _0x31c437=this;return new Promise(function(_0xf17bf7,_0x2e1b76){return db[_0xe548('0x12')]['findAll']({'raw':_0x93dff4[_0xe548('0x13')]?_0x93dff4[_0xe548('0x13')][_0xe548('0x14')]===undefined?!![]:![]:!![],'where':_0x93dff4[_0xe548('0x13')]?_0x93dff4[_0xe548('0x13')][_0xe548('0x15')]||null:null,'attributes':_0x93dff4[_0xe548('0x13')]?_0x93dff4[_0xe548('0x13')][_0xe548('0x16')]||null:null,'limit':_0x93dff4[_0xe548('0x13')]?_0x93dff4[_0xe548('0x13')]['limit']||null:null,'include':_0x93dff4['options']?_0x93dff4[_0xe548('0x13')][_0xe548('0x17')]?_[_0xe548('0x18')](_0x93dff4['options'][_0xe548('0x17')],function(_0x4da803){return{'model':db[_0x4da803[_0xe548('0x19')]],'as':_0x4da803['as'],'attributes':_0x4da803[_0xe548('0x16')],'include':_0x4da803['include']?_[_0xe548('0x18')](_0x4da803[_0xe548('0x17')],function(_0xafa394){return{'model':db[_0xafa394[_0xe548('0x19')]],'as':_0xafa394['as'],'attributes':_0xafa394[_0xe548('0x16')],'include':_0xafa394[_0xe548('0x17')]?_[_0xe548('0x18')](_0xafa394['include'],function(_0x1111e4){return{'model':db[_0x1111e4[_0xe548('0x19')]],'as':_0x1111e4['as'],'attributes':_0x1111e4[_0xe548('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe548('0x9')](function(_0x2bc59d){logger[_0xe548('0xa')](_0xe548('0x11'),_0x93dff4);logger[_0xe548('0x1a')](_0xe548('0x11'),_0x93dff4,JSON['stringify'](_0x2bc59d));_0xf17bf7(_0x2bc59d);})[_0xe548('0x1b')](function(_0x2417b0){logger[_0xe548('0xe')]('GetSugarcrmAccount',_0x2417b0[_0xe548('0x10')],_0x93dff4);_0x2e1b76(_0x31c437['error'](0x1f4,_0x2417b0[_0xe548('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x39c605){var _0x149d35=this;return new Promise(function(_0x2e52fa,_0xe30fd0){return db[_0xe548('0x12')]['find']({'raw':_0x39c605[_0xe548('0x13')]?_0x39c605[_0xe548('0x13')][_0xe548('0x14')]===undefined?!![]:![]:!![],'where':_0x39c605[_0xe548('0x13')]?_0x39c605[_0xe548('0x13')][_0xe548('0x15')]||null:null,'attributes':_0x39c605[_0xe548('0x13')]?_0x39c605[_0xe548('0x13')][_0xe548('0x16')]||null:null,'include':_0x39c605[_0xe548('0x13')]?_0x39c605['options']['include']?_['map'](_0x39c605[_0xe548('0x13')][_0xe548('0x17')],function(_0x4044e1){return{'model':db[_0x4044e1[_0xe548('0x19')]],'as':_0x4044e1['as'],'attributes':_0x4044e1[_0xe548('0x16')],'include':_0x4044e1[_0xe548('0x17')]?_[_0xe548('0x18')](_0x4044e1[_0xe548('0x17')],function(_0x4f240b){return{'model':db[_0x4f240b['model']],'as':_0x4f240b['as'],'attributes':_0x4f240b[_0xe548('0x16')],'include':_0x4f240b[_0xe548('0x17')]?_[_0xe548('0x18')](_0x4f240b[_0xe548('0x17')],function(_0x5dae19){return{'model':db[_0x5dae19['model']],'as':_0x5dae19['as'],'attributes':_0x5dae19[_0xe548('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe548('0x9')](function(_0x444937){logger[_0xe548('0xa')](_0xe548('0x1c'),_0x39c605);logger['debug'](_0xe548('0x1c'),_0x39c605,JSON['stringify'](_0x444937));_0x2e52fa(_0x444937);})[_0xe548('0x1b')](function(_0x3a5e70){logger[_0xe548('0xe')]('ShowSugarcrmAccount',_0x3a5e70[_0xe548('0x10')],_0x39c605);_0xe30fd0(_0x149d35['error'](0x1f4,_0x3a5e70[_0xe548('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 1264bff..0e0fcfd 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 _0x65d1=['delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','put','update'];(function(_0x1c2b12,_0x10b2e6){var _0x2eda1d=function(_0x4e9ed3){while(--_0x4e9ed3){_0x1c2b12['push'](_0x1c2b12['shift']());}};_0x2eda1d(++_0x10b2e6);}(_0x65d1,0x1d0));var _0x165d=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x65d1[_0x230951];return _0xeb26b1;};'use strict';var multer=require(_0x165d('0x0'));var util=require(_0x165d('0x1'));var path=require(_0x165d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x165d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x165d('0x4'));var interaction=require(_0x165d('0x5'));var config=require(_0x165d('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x165d('0x7')]('/',auth[_0x165d('0x8')](),controller[_0x165d('0x9')]);router['get'](_0x165d('0xa'),auth[_0x165d('0x8')](),controller[_0x165d('0xb')]);router[_0x165d('0x7')](_0x165d('0xc'),auth['isAuthenticated'](),controller[_0x165d('0xd')]);router[_0x165d('0x7')](_0x165d('0xe'),auth[_0x165d('0x8')](),controller[_0x165d('0xf')]);router[_0x165d('0x7')]('/:id/descriptions',auth[_0x165d('0x8')](),controller[_0x165d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x165d('0x11')](_0x165d('0xa'),auth[_0x165d('0x8')](),controller[_0x165d('0x12')]);router[_0x165d('0x13')](_0x165d('0xa'),auth[_0x165d('0x8')](),controller[_0x165d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc009=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','connect-timeout'];(function(_0x86ff9b,_0x589877){var _0x23f3a4=function(_0x334ea3){while(--_0x334ea3){_0x86ff9b['push'](_0x86ff9b['shift']());}};_0x23f3a4(++_0x589877);}(_0xc009,0x1c7));var _0x9c00=function(_0x10e5b7,_0x16dcb6){_0x10e5b7=_0x10e5b7-0x0;var _0xa85281=_0xc009[_0x10e5b7];return _0xa85281;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9c00('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c00('0x1'));var interaction=require(_0x9c00('0x2'));var config=require(_0x9c00('0x3'));var controller=require(_0x9c00('0x4'));router['get']('/',auth[_0x9c00('0x5')](),controller[_0x9c00('0x6')]);router[_0x9c00('0x7')](_0x9c00('0x8'),auth['isAuthenticated'](),controller[_0x9c00('0x9')]);router[_0x9c00('0x7')](_0x9c00('0xa'),auth[_0x9c00('0x5')](),controller[_0x9c00('0xb')]);router[_0x9c00('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x9c00('0x7')](_0x9c00('0xc'),auth[_0x9c00('0x5')](),controller[_0x9c00('0xd')]);router['post']('/',auth[_0x9c00('0x5')](),controller[_0x9c00('0xe')]);router[_0x9c00('0xf')]('/:id',auth[_0x9c00('0x5')](),controller[_0x9c00('0x10')]);router[_0x9c00('0x11')]('/:id',auth[_0x9c00('0x5')](),controller[_0x9c00('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4472cfb..c30f6c8 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 _0x8eca=['STRING','sequelize','exports'];(function(_0x52671b,_0x34f6cf){var _0x136da3=function(_0x1d708f){while(--_0x1d708f){_0x52671b['push'](_0x52671b['shift']());}};_0x136da3(++_0x34f6cf);}(_0x8eca,0x15a));var _0xa8ec=function(_0x22f2c8,_0x105f32){_0x22f2c8=_0x22f2c8-0x0;var _0x58b13d=_0x8eca[_0x22f2c8];return _0x58b13d;};'use strict';var Sequelize=require(_0xa8ec('0x0'));module[_0xa8ec('0x1')]={'name':{'type':Sequelize[_0xa8ec('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd872=['STRING'];(function(_0x22b714,_0x3adf6d){var _0x378f01=function(_0x1d3b0f){while(--_0x1d3b0f){_0x22b714['push'](_0x22b714['shift']());}};_0x378f01(++_0x3adf6d);}(_0xd872,0xc4));var _0x2d87=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd872[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2d87('0x0')]},'description':{'type':Sequelize[_0x2d87('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c2e4cf2..9097d8c 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 _0x41a2=['keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','SugarcrmField','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','model','map'];(function(_0x4511fe,_0xa210f2){var _0x42b220=function(_0x82d0aa){while(--_0x82d0aa){_0x4511fe['push'](_0x4511fe['shift']());}};_0x42b220(++_0xa210f2);}(_0x41a2,0x76));var _0x241a=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0x41a2[_0x3f5f08];return _0x566dd9;};'use strict';var emlformat=require(_0x241a('0x0'));var rimraf=require(_0x241a('0x1'));var zipdir=require(_0x241a('0x2'));var jsonpatch=require(_0x241a('0x3'));var rp=require(_0x241a('0x4'));var moment=require('moment');var BPromise=require(_0x241a('0x5'));var Mustache=require(_0x241a('0x6'));var util=require(_0x241a('0x7'));var path=require(_0x241a('0x8'));var sox=require(_0x241a('0x9'));var csv=require(_0x241a('0xa'));var ejs=require(_0x241a('0xb'));var fs=require('fs');var fs_extra=require(_0x241a('0xc'));var _=require(_0x241a('0xd'));var squel=require('squel');var crypto=require(_0x241a('0xe'));var jsforce=require(_0x241a('0xf'));var deskjs=require(_0x241a('0x10'));var toCsv=require(_0x241a('0xa'));var querystring=require(_0x241a('0x11'));var Papa=require(_0x241a('0x12'));var Redis=require(_0x241a('0x13'));var authService=require(_0x241a('0x14'));var qs=require(_0x241a('0x15'));var as=require(_0x241a('0x16'));var hardwareService=require(_0x241a('0x17'));var logger=require('../../config/logger')(_0x241a('0x18'));var utils=require(_0x241a('0x19'));var config=require(_0x241a('0x1a'));var licenseUtil=require(_0x241a('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16735c,_0x3f017e){_0x3f017e=_0x3f017e||0xcc;return function(_0x3335d3){if(_0x3335d3){return _0x16735c[_0x241a('0x1c')](_0x3f017e);}return _0x16735c['status'](_0x3f017e)[_0x241a('0x1d')]();};}function respondWithResult(_0x5a07a8,_0x1bbdad){_0x1bbdad=_0x1bbdad||0xc8;return function(_0x4ceb27){if(_0x4ceb27){return _0x5a07a8['status'](_0x1bbdad)['json'](_0x4ceb27);}};}function respondWithFilteredResult(_0x4459a4,_0x4b8a2f){return function(_0xdb184){if(_0xdb184){var _0x54c19c=typeof _0x4b8a2f[_0x241a('0x1e')]==='undefined'&&typeof _0x4b8a2f['limit']==='undefined';var _0x4dd0e0=_0xdb184[_0x241a('0x1f')];var _0x6406c1=_0x54c19c?0x0:_0x4b8a2f['offset'];var _0x58f1b8=_0x54c19c?_0xdb184[_0x241a('0x1f')]:_0x4b8a2f[_0x241a('0x1e')]+_0x4b8a2f['limit'];var _0x5e3258;if(_0x58f1b8>=_0x4dd0e0){_0x58f1b8=_0x4dd0e0;_0x5e3258=0xc8;}else{_0x5e3258=0xce;}_0x4459a4[_0x241a('0x20')](_0x5e3258);return _0x4459a4[_0x241a('0x21')](_0x241a('0x22'),_0x6406c1+'-'+_0x58f1b8+'/'+_0x4dd0e0)[_0x241a('0x23')](_0xdb184);}return null;};}function patchUpdates(_0xcbd016){return function(_0x4ed21d){try{jsonpatch[_0x241a('0x24')](_0x4ed21d,_0xcbd016,!![]);}catch(_0x543396){return BPromise[_0x241a('0x25')](_0x543396);}return _0x4ed21d[_0x241a('0x26')]();};}function saveUpdates(_0x454fe7,_0x3759a4){return function(_0x598b0d){if(_0x598b0d){return _0x598b0d[_0x241a('0x27')](_0x454fe7)[_0x241a('0x28')](function(_0x5dcf18){return _0x5dcf18;});}return null;};}function removeEntity(_0x395920,_0xb37423){return function(_0x122e28){if(_0x122e28){return _0x122e28[_0x241a('0x29')]()['then'](function(){_0x395920[_0x241a('0x20')](0xcc)[_0x241a('0x1d')]();});}};}function handleEntityNotFound(_0x1eebe4,_0x3d64f4){return function(_0xbe2c2b){if(!_0xbe2c2b){_0x1eebe4['sendStatus'](0x194);}return _0xbe2c2b;};}function handleError(_0x54a45b,_0x5cff9e){_0x5cff9e=_0x5cff9e||0x1f4;return function(_0x11d11a){logger[_0x241a('0x2a')](_0x11d11a[_0x241a('0x2b')]);if(_0x11d11a[_0x241a('0x2c')]){delete _0x11d11a['name'];}_0x54a45b[_0x241a('0x20')](_0x5cff9e)[_0x241a('0x2d')](_0x11d11a);};}exports[_0x241a('0x2e')]=function(_0x31b80f,_0x40971){var _0x5225c3={},_0x7ca3af={},_0x272cb8={'count':0x0,'rows':[]};var _0x2772c5=_['map'](db[_0x241a('0x2f')][_0x241a('0x30')],function(_0x2fdebe){return{'name':_0x2fdebe['fieldName'],'type':_0x2fdebe[_0x241a('0x31')]['key']};});_0x7ca3af[_0x241a('0x32')]=_[_0x241a('0x33')](_0x2772c5,_0x241a('0x2c'));_0x7ca3af['query']=_[_0x241a('0x34')](_0x31b80f['query']);_0x7ca3af['filters']=_[_0x241a('0x35')](_0x7ca3af['model'],_0x7ca3af[_0x241a('0x36')]);_0x5225c3['attributes']=_[_0x241a('0x35')](_0x7ca3af[_0x241a('0x32')],qs[_0x241a('0x37')](_0x31b80f['query'][_0x241a('0x37')]));_0x5225c3['attributes']=_0x5225c3[_0x241a('0x38')][_0x241a('0x39')]?_0x5225c3[_0x241a('0x38')]:_0x7ca3af[_0x241a('0x32')];if(!_0x31b80f['query'][_0x241a('0x3a')](_0x241a('0x3b'))){_0x5225c3[_0x241a('0x3c')]=qs[_0x241a('0x3c')](_0x31b80f[_0x241a('0x36')][_0x241a('0x3c')]);_0x5225c3[_0x241a('0x1e')]=qs['offset'](_0x31b80f[_0x241a('0x36')][_0x241a('0x1e')]);}_0x5225c3[_0x241a('0x3d')]=qs[_0x241a('0x3e')](_0x31b80f[_0x241a('0x36')][_0x241a('0x3e')]);_0x5225c3['where']=qs[_0x241a('0x3f')](_[_0x241a('0x40')](_0x31b80f[_0x241a('0x36')],_0x7ca3af[_0x241a('0x3f')]),_0x2772c5);if(_0x31b80f[_0x241a('0x36')]['filter']){_0x5225c3[_0x241a('0x41')]=_[_0x241a('0x42')](_0x5225c3[_0x241a('0x41')],{'$or':_[_0x241a('0x33')](_0x2772c5,function(_0x7afd80){if(_0x7afd80[_0x241a('0x31')]!==_0x241a('0x43')){var _0x1ceddb={};_0x1ceddb[_0x7afd80[_0x241a('0x2c')]]={'$like':'%'+_0x31b80f[_0x241a('0x36')][_0x241a('0x44')]+'%'};return _0x1ceddb;}})});}_0x5225c3=_[_0x241a('0x42')]({},_0x5225c3,_0x31b80f['options']);var _0x5bb3bb={'where':_0x5225c3['where']};return db[_0x241a('0x2f')][_0x241a('0x1f')](_0x5bb3bb)[_0x241a('0x28')](function(_0x107996){_0x272cb8[_0x241a('0x1f')]=_0x107996;if(_0x31b80f[_0x241a('0x36')][_0x241a('0x45')]){_0x5225c3[_0x241a('0x46')]=[{'all':!![]}];}return db[_0x241a('0x2f')][_0x241a('0x47')](_0x5225c3);})[_0x241a('0x28')](function(_0x1ea35d){_0x272cb8[_0x241a('0x48')]=_0x1ea35d;return _0x272cb8;})[_0x241a('0x28')](respondWithFilteredResult(_0x40971,_0x5225c3))[_0x241a('0x49')](handleError(_0x40971,null));};exports[_0x241a('0x4a')]=function(_0x3e00e0,_0x56372b){var _0x17d05a={'raw':![],'where':{'id':_0x3e00e0[_0x241a('0x4b')]['id']}},_0x7e25dd={};_0x7e25dd['model']=_[_0x241a('0x34')](db[_0x241a('0x2f')][_0x241a('0x30')]);_0x7e25dd[_0x241a('0x36')]=_['keys'](_0x3e00e0[_0x241a('0x36')]);_0x7e25dd[_0x241a('0x3f')]=_[_0x241a('0x35')](_0x7e25dd[_0x241a('0x32')],_0x7e25dd[_0x241a('0x36')]);_0x17d05a[_0x241a('0x38')]=_['intersection'](_0x7e25dd[_0x241a('0x32')],qs[_0x241a('0x37')](_0x3e00e0[_0x241a('0x36')][_0x241a('0x37')]));_0x17d05a[_0x241a('0x38')]=_0x17d05a['attributes'][_0x241a('0x39')]?_0x17d05a[_0x241a('0x38')]:_0x7e25dd['model'];if(_0x3e00e0[_0x241a('0x36')]['includeAll']){_0x17d05a[_0x241a('0x46')]=[{'all':!![]}];}_0x17d05a=_['merge']({},_0x17d05a,_0x3e00e0[_0x241a('0x4c')]);return db[_0x241a('0x2f')][_0x241a('0x4d')](_0x17d05a)[_0x241a('0x28')](handleEntityNotFound(_0x56372b,null))[_0x241a('0x28')](respondWithResult(_0x56372b,null))[_0x241a('0x49')](handleError(_0x56372b,null));};exports[_0x241a('0x4e')]=function(_0x5c3674,_0x448c12){return db[_0x241a('0x2f')]['create'](_0x5c3674['body'],{})[_0x241a('0x28')](respondWithResult(_0x448c12,0xc9))[_0x241a('0x49')](handleError(_0x448c12,null));};exports['update']=function(_0x110dcb,_0x2af1a0){if(_0x110dcb[_0x241a('0x4f')]['id']){delete _0x110dcb[_0x241a('0x4f')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x110dcb['params']['id']}})[_0x241a('0x28')](handleEntityNotFound(_0x2af1a0,null))[_0x241a('0x28')](saveUpdates(_0x110dcb['body'],null))[_0x241a('0x28')](respondWithResult(_0x2af1a0,null))[_0x241a('0x49')](handleError(_0x2af1a0,null));};exports['destroy']=function(_0x15fbbf,_0x2c788b){return db[_0x241a('0x2f')][_0x241a('0x4d')]({'where':{'id':_0x15fbbf[_0x241a('0x4b')]['id']}})[_0x241a('0x28')](handleEntityNotFound(_0x2c788b,null))[_0x241a('0x28')](removeEntity(_0x2c788b,null))[_0x241a('0x49')](handleError(_0x2c788b,null));};exports[_0x241a('0x50')]=function(_0x212ebc,_0x268cbf,_0x38f654){var _0x437dcf={};var _0x11e9d5={};var _0x5eb7e6;var _0x5a0cab;return db[_0x241a('0x2f')]['findOne']({'where':{'id':_0x212ebc[_0x241a('0x4b')]['id']}})[_0x241a('0x28')](handleEntityNotFound(_0x268cbf,null))[_0x241a('0x28')](function(_0x19aa69){if(_0x19aa69){_0x5eb7e6=_0x19aa69;_0x11e9d5[_0x241a('0x32')]=_[_0x241a('0x34')](db[_0x241a('0x51')][_0x241a('0x30')]);_0x11e9d5[_0x241a('0x36')]=_[_0x241a('0x34')](_0x212ebc['query']);_0x11e9d5[_0x241a('0x3f')]=_['intersection'](_0x11e9d5[_0x241a('0x32')],_0x11e9d5[_0x241a('0x36')]);_0x437dcf[_0x241a('0x38')]=_[_0x241a('0x35')](_0x11e9d5[_0x241a('0x32')],qs[_0x241a('0x37')](_0x212ebc[_0x241a('0x36')][_0x241a('0x37')]));_0x437dcf[_0x241a('0x38')]=_0x437dcf[_0x241a('0x38')][_0x241a('0x39')]?_0x437dcf[_0x241a('0x38')]:_0x11e9d5[_0x241a('0x32')];_0x437dcf[_0x241a('0x3d')]=qs[_0x241a('0x3e')](_0x212ebc['query']['sort']);_0x437dcf[_0x241a('0x41')]=qs[_0x241a('0x3f')](_[_0x241a('0x40')](_0x212ebc[_0x241a('0x36')],_0x11e9d5[_0x241a('0x3f')]));if(_0x212ebc[_0x241a('0x36')][_0x241a('0x44')]){_0x437dcf['where']=_[_0x241a('0x42')](_0x437dcf[_0x241a('0x41')],{'$or':_[_0x241a('0x33')](_0x437dcf[_0x241a('0x38')],function(_0x22e7eb){var _0x54839f={};_0x54839f[_0x22e7eb]={'$like':'%'+_0x212ebc[_0x241a('0x36')][_0x241a('0x44')]+'%'};return _0x54839f;})});}_0x437dcf=_[_0x241a('0x42')]({},_0x437dcf,_0x212ebc[_0x241a('0x4c')]);return _0x5eb7e6[_0x241a('0x50')](_0x437dcf);}})[_0x241a('0x28')](function(_0x1b1784){if(_0x1b1784){_0x5a0cab=_0x1b1784[_0x241a('0x39')];if(!_0x212ebc['query'][_0x241a('0x3a')](_0x241a('0x3b'))){_0x437dcf[_0x241a('0x3c')]=qs['limit'](_0x212ebc[_0x241a('0x36')][_0x241a('0x3c')]);_0x437dcf[_0x241a('0x1e')]=qs['offset'](_0x212ebc[_0x241a('0x36')]['offset']);}return _0x5eb7e6['getFields'](_0x437dcf);}})[_0x241a('0x28')](function(_0x55d31d){if(_0x55d31d){return _0x55d31d?{'count':_0x5a0cab,'rows':_0x55d31d}:null;}})[_0x241a('0x28')](respondWithResult(_0x268cbf,null))[_0x241a('0x49')](handleError(_0x268cbf,null));};exports['getSubjects']=function(_0x688457,_0x33c3af,_0x22e795){var _0x4522db={};var _0x21548e={};var _0x23601b;var _0x5279a4;return db[_0x241a('0x2f')][_0x241a('0x52')]({'where':{'id':_0x688457[_0x241a('0x4b')]['id']}})[_0x241a('0x28')](handleEntityNotFound(_0x33c3af,null))['then'](function(_0x527f4b){if(_0x527f4b){_0x23601b=_0x527f4b;_0x21548e[_0x241a('0x32')]=_[_0x241a('0x34')](db[_0x241a('0x51')][_0x241a('0x30')]);_0x21548e['query']=_[_0x241a('0x34')](_0x688457['query']);_0x21548e[_0x241a('0x3f')]=_[_0x241a('0x35')](_0x21548e[_0x241a('0x32')],_0x21548e['query']);_0x4522db['attributes']=_[_0x241a('0x35')](_0x21548e[_0x241a('0x32')],qs[_0x241a('0x37')](_0x688457[_0x241a('0x36')][_0x241a('0x37')]));_0x4522db[_0x241a('0x38')]=_0x4522db[_0x241a('0x38')][_0x241a('0x39')]?_0x4522db[_0x241a('0x38')]:_0x21548e[_0x241a('0x32')];_0x4522db['order']=qs['sort'](_0x688457['query'][_0x241a('0x3e')]);_0x4522db[_0x241a('0x41')]=qs[_0x241a('0x3f')](_[_0x241a('0x40')](_0x688457[_0x241a('0x36')],_0x21548e['filters']));if(_0x688457['query']['filter']){_0x4522db[_0x241a('0x41')]=_['merge'](_0x4522db[_0x241a('0x41')],{'$or':_['map'](_0x4522db['attributes'],function(_0xa901fd){var _0x18246d={};_0x18246d[_0xa901fd]={'$like':'%'+_0x688457['query']['filter']+'%'};return _0x18246d;})});}_0x4522db=_[_0x241a('0x42')]({},_0x4522db,_0x688457[_0x241a('0x4c')]);return _0x23601b[_0x241a('0x53')](_0x4522db);}})[_0x241a('0x28')](function(_0xc0f56){if(_0xc0f56){_0x5279a4=_0xc0f56[_0x241a('0x39')];if(!_0x688457[_0x241a('0x36')][_0x241a('0x3a')]('nolimit')){_0x4522db[_0x241a('0x3c')]=qs[_0x241a('0x3c')](_0x688457[_0x241a('0x36')][_0x241a('0x3c')]);_0x4522db[_0x241a('0x1e')]=qs[_0x241a('0x1e')](_0x688457[_0x241a('0x36')][_0x241a('0x1e')]);}return _0x23601b[_0x241a('0x53')](_0x4522db);}})[_0x241a('0x28')](function(_0x370174){if(_0x370174){return _0x370174?{'count':_0x5279a4,'rows':_0x370174}:null;}})[_0x241a('0x28')](respondWithResult(_0x33c3af,null))[_0x241a('0x49')](handleError(_0x33c3af,null));};exports['getDescriptions']=function(_0x583aec,_0x2c1c83,_0x5b0ff0){var _0xd32dd3={};var _0x5b55c0={};var _0x103be7;var _0x83265d;return db[_0x241a('0x2f')][_0x241a('0x52')]({'where':{'id':_0x583aec[_0x241a('0x4b')]['id']}})[_0x241a('0x28')](handleEntityNotFound(_0x2c1c83,null))[_0x241a('0x28')](function(_0x3b35f9){if(_0x3b35f9){_0x103be7=_0x3b35f9;_0x5b55c0[_0x241a('0x32')]=_['keys'](db[_0x241a('0x51')][_0x241a('0x30')]);_0x5b55c0['query']=_['keys'](_0x583aec[_0x241a('0x36')]);_0x5b55c0[_0x241a('0x3f')]=_['intersection'](_0x5b55c0[_0x241a('0x32')],_0x5b55c0[_0x241a('0x36')]);_0xd32dd3[_0x241a('0x38')]=_[_0x241a('0x35')](_0x5b55c0[_0x241a('0x32')],qs['fields'](_0x583aec[_0x241a('0x36')][_0x241a('0x37')]));_0xd32dd3[_0x241a('0x38')]=_0xd32dd3[_0x241a('0x38')][_0x241a('0x39')]?_0xd32dd3[_0x241a('0x38')]:_0x5b55c0[_0x241a('0x32')];_0xd32dd3['order']=qs[_0x241a('0x3e')](_0x583aec['query']['sort']);_0xd32dd3[_0x241a('0x41')]=qs[_0x241a('0x3f')](_[_0x241a('0x40')](_0x583aec[_0x241a('0x36')],_0x5b55c0['filters']));if(_0x583aec[_0x241a('0x36')][_0x241a('0x44')]){_0xd32dd3['where']=_[_0x241a('0x42')](_0xd32dd3['where'],{'$or':_[_0x241a('0x33')](_0xd32dd3[_0x241a('0x38')],function(_0x166c91){var _0x591f04={};_0x591f04[_0x166c91]={'$like':'%'+_0x583aec['query'][_0x241a('0x44')]+'%'};return _0x591f04;})});}_0xd32dd3=_[_0x241a('0x42')]({},_0xd32dd3,_0x583aec[_0x241a('0x4c')]);return _0x103be7[_0x241a('0x54')](_0xd32dd3);}})['then'](function(_0x1ab939){if(_0x1ab939){_0x83265d=_0x1ab939[_0x241a('0x39')];if(!_0x583aec[_0x241a('0x36')]['hasOwnProperty'](_0x241a('0x3b'))){_0xd32dd3[_0x241a('0x3c')]=qs[_0x241a('0x3c')](_0x583aec['query']['limit']);_0xd32dd3['offset']=qs['offset'](_0x583aec[_0x241a('0x36')][_0x241a('0x1e')]);}return _0x103be7[_0x241a('0x54')](_0xd32dd3);}})['then'](function(_0x32f1f8){if(_0x32f1f8){return _0x32f1f8?{'count':_0x83265d,'rows':_0x32f1f8}:null;}})['then'](respondWithResult(_0x2c1c83,null))[_0x241a('0x49')](handleError(_0x2c1c83,null));}; \ No newline at end of file +var _0x174a=['then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','SugarcrmField','sort','getSubjects','getDescriptions','eml-format','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0x2f8687,_0x4787dd){var _0x106379=function(_0x52590a){while(--_0x52590a){_0x2f8687['push'](_0x2f8687['shift']());}};_0x106379(++_0x4787dd);}(_0x174a,0x15c));var _0xa174=function(_0x313993,_0x1865bd){_0x313993=_0x313993-0x0;var _0x1f2465=_0x174a[_0x313993];return _0x1f2465;};'use strict';var emlformat=require(_0xa174('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa174('0x1'));var BPromise=require(_0xa174('0x2'));var Mustache=require('mustache');var util=require(_0xa174('0x3'));var path=require(_0xa174('0x4'));var sox=require('sox');var csv=require(_0xa174('0x5'));var ejs=require(_0xa174('0x6'));var fs=require('fs');var fs_extra=require(_0xa174('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa174('0x8'));var deskjs=require(_0xa174('0x9'));var toCsv=require(_0xa174('0x5'));var querystring=require(_0xa174('0xa'));var Papa=require(_0xa174('0xb'));var Redis=require('ioredis');var authService=require(_0xa174('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa174('0xd'));var hardwareService=require(_0xa174('0xe'));var logger=require('../../config/logger')(_0xa174('0xf'));var utils=require(_0xa174('0x10'));var config=require(_0xa174('0x11'));var licenseUtil=require(_0xa174('0x12'));var db=require(_0xa174('0x13'))['db'];function respondWithStatusCode(_0x482764,_0x50d35d){_0x50d35d=_0x50d35d||0xcc;return function(_0x4504b0){if(_0x4504b0){return _0x482764[_0xa174('0x14')](_0x50d35d);}return _0x482764[_0xa174('0x15')](_0x50d35d)[_0xa174('0x16')]();};}function respondWithResult(_0x56f39d,_0x518b05){_0x518b05=_0x518b05||0xc8;return function(_0x2ae649){if(_0x2ae649){return _0x56f39d[_0xa174('0x15')](_0x518b05)[_0xa174('0x17')](_0x2ae649);}};}function respondWithFilteredResult(_0x5413ba,_0x5047b9){return function(_0x172b78){if(_0x172b78){var _0x1fd09b=typeof _0x5047b9[_0xa174('0x18')]===_0xa174('0x19')&&typeof _0x5047b9[_0xa174('0x1a')]===_0xa174('0x19');var _0xd34f52=_0x172b78[_0xa174('0x1b')];var _0x5b579e=_0x1fd09b?0x0:_0x5047b9[_0xa174('0x18')];var _0x130bf2=_0x1fd09b?_0x172b78[_0xa174('0x1b')]:_0x5047b9['offset']+_0x5047b9[_0xa174('0x1a')];var _0x30d527;if(_0x130bf2>=_0xd34f52){_0x130bf2=_0xd34f52;_0x30d527=0xc8;}else{_0x30d527=0xce;}_0x5413ba[_0xa174('0x15')](_0x30d527);return _0x5413ba['set']('Content-Range',_0x5b579e+'-'+_0x130bf2+'/'+_0xd34f52)[_0xa174('0x17')](_0x172b78);}return null;};}function patchUpdates(_0x2348d6){return function(_0xdcf5ea){try{jsonpatch[_0xa174('0x1c')](_0xdcf5ea,_0x2348d6,!![]);}catch(_0x4b59ab){return BPromise[_0xa174('0x1d')](_0x4b59ab);}return _0xdcf5ea[_0xa174('0x1e')]();};}function saveUpdates(_0x428ee7,_0x1c71af){return function(_0x34066f){if(_0x34066f){return _0x34066f[_0xa174('0x1f')](_0x428ee7)[_0xa174('0x20')](function(_0x25ea2c){return _0x25ea2c;});}return null;};}function removeEntity(_0x2ea7ff,_0x300960){return function(_0x307617){if(_0x307617){return _0x307617['destroy']()['then'](function(){_0x2ea7ff[_0xa174('0x15')](0xcc)[_0xa174('0x16')]();});}};}function handleEntityNotFound(_0x5487df,_0x87b9c5){return function(_0x310114){if(!_0x310114){_0x5487df[_0xa174('0x14')](0x194);}return _0x310114;};}function handleError(_0x1927ac,_0x3fc4d3){_0x3fc4d3=_0x3fc4d3||0x1f4;return function(_0x5d6d66){logger[_0xa174('0x21')](_0x5d6d66['stack']);if(_0x5d6d66[_0xa174('0x22')]){delete _0x5d6d66[_0xa174('0x22')];}_0x1927ac[_0xa174('0x15')](_0x3fc4d3)[_0xa174('0x23')](_0x5d6d66);};}exports[_0xa174('0x24')]=function(_0x198489,_0x12579e){var _0x57d300={},_0x5cc2bf={},_0x463725={'count':0x0,'rows':[]};var _0x479a17=_[_0xa174('0x25')](db['SugarcrmConfiguration'][_0xa174('0x26')],function(_0x46b287){return{'name':_0x46b287[_0xa174('0x27')],'type':_0x46b287[_0xa174('0x28')][_0xa174('0x29')]};});_0x5cc2bf[_0xa174('0x2a')]=_[_0xa174('0x25')](_0x479a17,_0xa174('0x22'));_0x5cc2bf[_0xa174('0x2b')]=_[_0xa174('0x2c')](_0x198489[_0xa174('0x2b')]);_0x5cc2bf[_0xa174('0x2d')]=_[_0xa174('0x2e')](_0x5cc2bf[_0xa174('0x2a')],_0x5cc2bf[_0xa174('0x2b')]);_0x57d300[_0xa174('0x2f')]=_[_0xa174('0x2e')](_0x5cc2bf['model'],qs[_0xa174('0x30')](_0x198489[_0xa174('0x2b')][_0xa174('0x30')]));_0x57d300[_0xa174('0x2f')]=_0x57d300[_0xa174('0x2f')]['length']?_0x57d300['attributes']:_0x5cc2bf[_0xa174('0x2a')];if(!_0x198489[_0xa174('0x2b')][_0xa174('0x31')](_0xa174('0x32'))){_0x57d300[_0xa174('0x1a')]=qs[_0xa174('0x1a')](_0x198489['query'][_0xa174('0x1a')]);_0x57d300['offset']=qs['offset'](_0x198489[_0xa174('0x2b')][_0xa174('0x18')]);}_0x57d300[_0xa174('0x33')]=qs['sort'](_0x198489[_0xa174('0x2b')]['sort']);_0x57d300[_0xa174('0x34')]=qs['filters'](_[_0xa174('0x35')](_0x198489[_0xa174('0x2b')],_0x5cc2bf[_0xa174('0x2d')]),_0x479a17);if(_0x198489['query'][_0xa174('0x36')]){_0x57d300[_0xa174('0x34')]=_[_0xa174('0x37')](_0x57d300['where'],{'$or':_['map'](_0x479a17,function(_0x32bf05){if(_0x32bf05[_0xa174('0x28')]!=='VIRTUAL'){var _0x73fab8={};_0x73fab8[_0x32bf05[_0xa174('0x22')]]={'$like':'%'+_0x198489[_0xa174('0x2b')][_0xa174('0x36')]+'%'};return _0x73fab8;}})});}_0x57d300=_[_0xa174('0x37')]({},_0x57d300,_0x198489[_0xa174('0x38')]);var _0x36e052={'where':_0x57d300[_0xa174('0x34')]};return db[_0xa174('0x39')][_0xa174('0x1b')](_0x36e052)[_0xa174('0x20')](function(_0x59f818){_0x463725[_0xa174('0x1b')]=_0x59f818;if(_0x198489['query'][_0xa174('0x3a')]){_0x57d300[_0xa174('0x3b')]=[{'all':!![]}];}return db[_0xa174('0x39')][_0xa174('0x3c')](_0x57d300);})[_0xa174('0x20')](function(_0x1c0db8){_0x463725[_0xa174('0x3d')]=_0x1c0db8;return _0x463725;})[_0xa174('0x20')](respondWithFilteredResult(_0x12579e,_0x57d300))[_0xa174('0x3e')](handleError(_0x12579e,null));};exports[_0xa174('0x3f')]=function(_0xae718c,_0x1fea1f){var _0x58c070={'raw':![],'where':{'id':_0xae718c[_0xa174('0x40')]['id']}},_0x1137c1={};_0x1137c1[_0xa174('0x2a')]=_[_0xa174('0x2c')](db['SugarcrmConfiguration'][_0xa174('0x26')]);_0x1137c1[_0xa174('0x2b')]=_[_0xa174('0x2c')](_0xae718c[_0xa174('0x2b')]);_0x1137c1[_0xa174('0x2d')]=_[_0xa174('0x2e')](_0x1137c1[_0xa174('0x2a')],_0x1137c1[_0xa174('0x2b')]);_0x58c070[_0xa174('0x2f')]=_[_0xa174('0x2e')](_0x1137c1[_0xa174('0x2a')],qs[_0xa174('0x30')](_0xae718c[_0xa174('0x2b')][_0xa174('0x30')]));_0x58c070[_0xa174('0x2f')]=_0x58c070[_0xa174('0x2f')][_0xa174('0x41')]?_0x58c070[_0xa174('0x2f')]:_0x1137c1[_0xa174('0x2a')];if(_0xae718c[_0xa174('0x2b')][_0xa174('0x3a')]){_0x58c070[_0xa174('0x3b')]=[{'all':!![]}];}_0x58c070=_[_0xa174('0x37')]({},_0x58c070,_0xae718c[_0xa174('0x38')]);return db[_0xa174('0x39')][_0xa174('0x42')](_0x58c070)[_0xa174('0x20')](handleEntityNotFound(_0x1fea1f,null))[_0xa174('0x20')](respondWithResult(_0x1fea1f,null))[_0xa174('0x3e')](handleError(_0x1fea1f,null));};exports[_0xa174('0x43')]=function(_0x1e33bb,_0x104bf4){return db[_0xa174('0x39')][_0xa174('0x43')](_0x1e33bb[_0xa174('0x44')],{})[_0xa174('0x20')](respondWithResult(_0x104bf4,0xc9))[_0xa174('0x3e')](handleError(_0x104bf4,null));};exports[_0xa174('0x1f')]=function(_0x58b5ab,_0x1ccc94){if(_0x58b5ab[_0xa174('0x44')]['id']){delete _0x58b5ab['body']['id'];}return db[_0xa174('0x39')]['find']({'where':{'id':_0x58b5ab[_0xa174('0x40')]['id']}})[_0xa174('0x20')](handleEntityNotFound(_0x1ccc94,null))[_0xa174('0x20')](saveUpdates(_0x58b5ab[_0xa174('0x44')],null))[_0xa174('0x20')](respondWithResult(_0x1ccc94,null))[_0xa174('0x3e')](handleError(_0x1ccc94,null));};exports[_0xa174('0x45')]=function(_0x41d1ab,_0x4cfa4c){return db[_0xa174('0x39')]['find']({'where':{'id':_0x41d1ab[_0xa174('0x40')]['id']}})[_0xa174('0x20')](handleEntityNotFound(_0x4cfa4c,null))['then'](removeEntity(_0x4cfa4c,null))[_0xa174('0x3e')](handleError(_0x4cfa4c,null));};exports[_0xa174('0x46')]=function(_0x341ba5,_0x4bf95b,_0x94bd09){var _0x46cb77={};var _0x39a058={};var _0x3425b2;var _0x386185;return db[_0xa174('0x39')][_0xa174('0x47')]({'where':{'id':_0x341ba5[_0xa174('0x40')]['id']}})[_0xa174('0x20')](handleEntityNotFound(_0x4bf95b,null))['then'](function(_0x4cfffd){if(_0x4cfffd){_0x3425b2=_0x4cfffd;_0x39a058['model']=_[_0xa174('0x2c')](db[_0xa174('0x48')][_0xa174('0x26')]);_0x39a058['query']=_['keys'](_0x341ba5[_0xa174('0x2b')]);_0x39a058[_0xa174('0x2d')]=_[_0xa174('0x2e')](_0x39a058[_0xa174('0x2a')],_0x39a058[_0xa174('0x2b')]);_0x46cb77['attributes']=_['intersection'](_0x39a058[_0xa174('0x2a')],qs[_0xa174('0x30')](_0x341ba5[_0xa174('0x2b')]['fields']));_0x46cb77['attributes']=_0x46cb77['attributes']['length']?_0x46cb77['attributes']:_0x39a058[_0xa174('0x2a')];_0x46cb77[_0xa174('0x33')]=qs[_0xa174('0x49')](_0x341ba5[_0xa174('0x2b')][_0xa174('0x49')]);_0x46cb77[_0xa174('0x34')]=qs[_0xa174('0x2d')](_[_0xa174('0x35')](_0x341ba5[_0xa174('0x2b')],_0x39a058['filters']));if(_0x341ba5[_0xa174('0x2b')]['filter']){_0x46cb77[_0xa174('0x34')]=_[_0xa174('0x37')](_0x46cb77['where'],{'$or':_[_0xa174('0x25')](_0x46cb77[_0xa174('0x2f')],function(_0x357a63){var _0xef90eb={};_0xef90eb[_0x357a63]={'$like':'%'+_0x341ba5[_0xa174('0x2b')][_0xa174('0x36')]+'%'};return _0xef90eb;})});}_0x46cb77=_[_0xa174('0x37')]({},_0x46cb77,_0x341ba5[_0xa174('0x38')]);return _0x3425b2[_0xa174('0x46')](_0x46cb77);}})[_0xa174('0x20')](function(_0x398b05){if(_0x398b05){_0x386185=_0x398b05[_0xa174('0x41')];if(!_0x341ba5['query'][_0xa174('0x31')](_0xa174('0x32'))){_0x46cb77[_0xa174('0x1a')]=qs['limit'](_0x341ba5[_0xa174('0x2b')][_0xa174('0x1a')]);_0x46cb77['offset']=qs['offset'](_0x341ba5[_0xa174('0x2b')][_0xa174('0x18')]);}return _0x3425b2[_0xa174('0x46')](_0x46cb77);}})['then'](function(_0x2f9e08){if(_0x2f9e08){return _0x2f9e08?{'count':_0x386185,'rows':_0x2f9e08}:null;}})['then'](respondWithResult(_0x4bf95b,null))[_0xa174('0x3e')](handleError(_0x4bf95b,null));};exports['getSubjects']=function(_0x4d11c2,_0x4b8603,_0xe2ca4e){var _0x1a71a9={};var _0x3d5902={};var _0x47597b;var _0x340174;return db[_0xa174('0x39')][_0xa174('0x47')]({'where':{'id':_0x4d11c2[_0xa174('0x40')]['id']}})[_0xa174('0x20')](handleEntityNotFound(_0x4b8603,null))[_0xa174('0x20')](function(_0x57bfcb){if(_0x57bfcb){_0x47597b=_0x57bfcb;_0x3d5902['model']=_['keys'](db[_0xa174('0x48')][_0xa174('0x26')]);_0x3d5902[_0xa174('0x2b')]=_[_0xa174('0x2c')](_0x4d11c2[_0xa174('0x2b')]);_0x3d5902[_0xa174('0x2d')]=_[_0xa174('0x2e')](_0x3d5902['model'],_0x3d5902[_0xa174('0x2b')]);_0x1a71a9[_0xa174('0x2f')]=_[_0xa174('0x2e')](_0x3d5902[_0xa174('0x2a')],qs['fields'](_0x4d11c2[_0xa174('0x2b')][_0xa174('0x30')]));_0x1a71a9[_0xa174('0x2f')]=_0x1a71a9[_0xa174('0x2f')][_0xa174('0x41')]?_0x1a71a9[_0xa174('0x2f')]:_0x3d5902[_0xa174('0x2a')];_0x1a71a9[_0xa174('0x33')]=qs[_0xa174('0x49')](_0x4d11c2[_0xa174('0x2b')]['sort']);_0x1a71a9['where']=qs['filters'](_[_0xa174('0x35')](_0x4d11c2['query'],_0x3d5902['filters']));if(_0x4d11c2[_0xa174('0x2b')][_0xa174('0x36')]){_0x1a71a9[_0xa174('0x34')]=_['merge'](_0x1a71a9['where'],{'$or':_[_0xa174('0x25')](_0x1a71a9[_0xa174('0x2f')],function(_0x1a2137){var _0x3856d2={};_0x3856d2[_0x1a2137]={'$like':'%'+_0x4d11c2[_0xa174('0x2b')][_0xa174('0x36')]+'%'};return _0x3856d2;})});}_0x1a71a9=_[_0xa174('0x37')]({},_0x1a71a9,_0x4d11c2[_0xa174('0x38')]);return _0x47597b[_0xa174('0x4a')](_0x1a71a9);}})['then'](function(_0x25ea9a){if(_0x25ea9a){_0x340174=_0x25ea9a[_0xa174('0x41')];if(!_0x4d11c2['query']['hasOwnProperty'](_0xa174('0x32'))){_0x1a71a9[_0xa174('0x1a')]=qs[_0xa174('0x1a')](_0x4d11c2['query'][_0xa174('0x1a')]);_0x1a71a9[_0xa174('0x18')]=qs[_0xa174('0x18')](_0x4d11c2[_0xa174('0x2b')][_0xa174('0x18')]);}return _0x47597b[_0xa174('0x4a')](_0x1a71a9);}})[_0xa174('0x20')](function(_0x4a3976){if(_0x4a3976){return _0x4a3976?{'count':_0x340174,'rows':_0x4a3976}:null;}})['then'](respondWithResult(_0x4b8603,null))[_0xa174('0x3e')](handleError(_0x4b8603,null));};exports[_0xa174('0x4b')]=function(_0x5c6850,_0x5bc6bd,_0x4b1932){var _0x29cf77={};var _0xf996b={};var _0x4782dd;var _0x863208;return db[_0xa174('0x39')]['findOne']({'where':{'id':_0x5c6850[_0xa174('0x40')]['id']}})[_0xa174('0x20')](handleEntityNotFound(_0x5bc6bd,null))[_0xa174('0x20')](function(_0x41a1d7){if(_0x41a1d7){_0x4782dd=_0x41a1d7;_0xf996b[_0xa174('0x2a')]=_[_0xa174('0x2c')](db[_0xa174('0x48')][_0xa174('0x26')]);_0xf996b[_0xa174('0x2b')]=_[_0xa174('0x2c')](_0x5c6850[_0xa174('0x2b')]);_0xf996b[_0xa174('0x2d')]=_[_0xa174('0x2e')](_0xf996b[_0xa174('0x2a')],_0xf996b[_0xa174('0x2b')]);_0x29cf77[_0xa174('0x2f')]=_[_0xa174('0x2e')](_0xf996b['model'],qs[_0xa174('0x30')](_0x5c6850['query']['fields']));_0x29cf77[_0xa174('0x2f')]=_0x29cf77[_0xa174('0x2f')]['length']?_0x29cf77[_0xa174('0x2f')]:_0xf996b[_0xa174('0x2a')];_0x29cf77[_0xa174('0x33')]=qs[_0xa174('0x49')](_0x5c6850[_0xa174('0x2b')][_0xa174('0x49')]);_0x29cf77['where']=qs[_0xa174('0x2d')](_[_0xa174('0x35')](_0x5c6850[_0xa174('0x2b')],_0xf996b[_0xa174('0x2d')]));if(_0x5c6850[_0xa174('0x2b')][_0xa174('0x36')]){_0x29cf77['where']=_['merge'](_0x29cf77['where'],{'$or':_[_0xa174('0x25')](_0x29cf77['attributes'],function(_0x4028f4){var _0xeada32={};_0xeada32[_0x4028f4]={'$like':'%'+_0x5c6850[_0xa174('0x2b')][_0xa174('0x36')]+'%'};return _0xeada32;})});}_0x29cf77=_[_0xa174('0x37')]({},_0x29cf77,_0x5c6850['options']);return _0x4782dd[_0xa174('0x4b')](_0x29cf77);}})[_0xa174('0x20')](function(_0x56ba95){if(_0x56ba95){_0x863208=_0x56ba95[_0xa174('0x41')];if(!_0x5c6850[_0xa174('0x2b')][_0xa174('0x31')](_0xa174('0x32'))){_0x29cf77[_0xa174('0x1a')]=qs['limit'](_0x5c6850['query']['limit']);_0x29cf77[_0xa174('0x18')]=qs['offset'](_0x5c6850[_0xa174('0x2b')]['offset']);}return _0x4782dd[_0xa174('0x4b')](_0x29cf77);}})[_0xa174('0x20')](function(_0x236651){if(_0x236651){return _0x236651?{'count':_0x863208,'rows':_0x236651}:null;}})[_0xa174('0x20')](respondWithResult(_0x5bc6bd,null))[_0xa174('0x3e')](handleError(_0x5bc6bd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6dca5fb..c871049 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 _0x54c4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','util'];(function(_0x21508d,_0x4bed92){var _0x4dadfe=function(_0x54111a){while(--_0x54111a){_0x21508d['push'](_0x21508d['shift']());}};_0x4dadfe(++_0x4bed92);}(_0x54c4,0xde));var _0x454c=function(_0x4f5124,_0x98bdf9){_0x4f5124=_0x4f5124-0x0;var _0x1fe0da=_0x54c4[_0x4f5124];return _0x1fe0da;};'use strict';var _=require(_0x454c('0x0'));var util=require(_0x454c('0x1'));var logger=require(_0x454c('0x2'))(_0x454c('0x3'));var moment=require(_0x454c('0x4'));var BPromise=require(_0x454c('0x5'));var rp=require(_0x454c('0x6'));var fs=require('fs');var path=require(_0x454c('0x7'));var rimraf=require(_0x454c('0x8'));var config=require(_0x454c('0x9'));var attributes=require(_0x454c('0xa'));module[_0x454c('0xb')]=function(_0x386e9b,_0x5399db){return _0x386e9b[_0x454c('0xc')](_0x454c('0xd'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef2=['api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x0ef2,0x169));var _0x20ef=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x0ef2[_0x5ad771];return _0x5b5dce;};'use strict';var _=require(_0x20ef('0x0'));var util=require(_0x20ef('0x1'));var logger=require(_0x20ef('0x2'))(_0x20ef('0x3'));var moment=require('moment');var BPromise=require(_0x20ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20ef('0x5'));var rimraf=require(_0x20ef('0x6'));var config=require(_0x20ef('0x7'));var attributes=require(_0x20ef('0x8'));module[_0x20ef('0x9')]=function(_0x2d503e,_0xe139ab){return _0x2d503e[_0x20ef('0xa')](_0x20ef('0xb'),attributes,{'tableName':_0x20ef('0xc'),'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 e7a35d7..d526a9b 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 _0xde17=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','SugarcrmConfiguration,\x20%s,\x20%s','result'];(function(_0x3990b2,_0x3937a9){var _0x5b5ad4=function(_0x211970){while(--_0x211970){_0x3990b2['push'](_0x3990b2['shift']());}};_0x5b5ad4(++_0x3937a9);}(_0xde17,0x191));var _0x7de1=function(_0x52f17b,_0x307c2e){_0x52f17b=_0x52f17b-0x0;var _0x15381e=_0xde17[_0x52f17b];return _0x15381e;};'use strict';var _=require(_0x7de1('0x0'));var util=require(_0x7de1('0x1'));var moment=require(_0x7de1('0x2'));var BPromise=require(_0x7de1('0x3'));var rs=require(_0x7de1('0x4'));var fs=require('fs');var Redis=require(_0x7de1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7de1('0x6'));var logger=require(_0x7de1('0x7'))(_0x7de1('0x8'));var config=require(_0x7de1('0x9'));var jayson=require(_0x7de1('0xa'));var client=jayson['client'][_0x7de1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130348,_0x193ce8,_0x3cf70d){return new BPromise(function(_0x3ee9dd,_0xc25ddd){return client[_0x7de1('0xc')](_0x130348,_0x3cf70d)[_0x7de1('0xd')](function(_0x49e52e){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x193ce8,_0x7de1('0xe'));logger[_0x7de1('0xf')](_0x7de1('0x10'),_0x193ce8,_0x7de1('0xe'),JSON[_0x7de1('0x11')](_0x49e52e));if(_0x49e52e['error']){if(_0x49e52e['error'][_0x7de1('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x193ce8,_0x49e52e[_0x7de1('0x13')][_0x7de1('0x14')]);return _0xc25ddd(_0x49e52e['error'][_0x7de1('0x14')]);}logger[_0x7de1('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x193ce8,_0x49e52e['error'][_0x7de1('0x14')]);return _0x3ee9dd(_0x49e52e[_0x7de1('0x13')][_0x7de1('0x14')]);}else{logger[_0x7de1('0x15')](_0x7de1('0x16'),_0x193ce8,_0x7de1('0xe'));_0x3ee9dd(_0x49e52e[_0x7de1('0x17')][_0x7de1('0x14')]);}})[_0x7de1('0x18')](function(_0x4508d0){logger['error'](_0x7de1('0x16'),_0x193ce8,_0x4508d0);_0xc25ddd(_0x4508d0);});});} \ No newline at end of file +var _0x6c6d=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4fd60f,_0x4475ec){var _0x310d18=function(_0x52f7ca){while(--_0x52f7ca){_0x4fd60f['push'](_0x4fd60f['shift']());}};_0x310d18(++_0x4475ec);}(_0x6c6d,0xb9));var _0xd6c6=function(_0x49ae1b,_0x237cf1){_0x49ae1b=_0x49ae1b-0x0;var _0x3081b1=_0x6c6d[_0x49ae1b];return _0x3081b1;};'use strict';var _=require(_0xd6c6('0x0'));var util=require('util');var moment=require(_0xd6c6('0x1'));var BPromise=require(_0xd6c6('0x2'));var rs=require(_0xd6c6('0x3'));var fs=require('fs');var Redis=require(_0xd6c6('0x4'));var db=require(_0xd6c6('0x5'))['db'];var utils=require(_0xd6c6('0x6'));var logger=require(_0xd6c6('0x7'))(_0xd6c6('0x8'));var config=require(_0xd6c6('0x9'));var jayson=require(_0xd6c6('0xa'));var client=jayson[_0xd6c6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fce4e,_0x15d6da,_0x2d6109){return new BPromise(function(_0xfc0494,_0x35f31d){return client['request'](_0x1fce4e,_0x2d6109)[_0xd6c6('0xc')](function(_0x3aff03){logger['info'](_0xd6c6('0xd'),_0x15d6da,_0xd6c6('0xe'));logger[_0xd6c6('0xf')](_0xd6c6('0x10'),_0x15d6da,_0xd6c6('0xe'),JSON['stringify'](_0x3aff03));if(_0x3aff03['error']){if(_0x3aff03[_0xd6c6('0x11')][_0xd6c6('0x12')]===0x1f4){logger[_0xd6c6('0x11')](_0xd6c6('0xd'),_0x15d6da,_0x3aff03[_0xd6c6('0x11')][_0xd6c6('0x13')]);return _0x35f31d(_0x3aff03[_0xd6c6('0x11')][_0xd6c6('0x13')]);}logger[_0xd6c6('0x11')](_0xd6c6('0xd'),_0x15d6da,_0x3aff03['error'][_0xd6c6('0x13')]);return _0xfc0494(_0x3aff03['error'][_0xd6c6('0x13')]);}else{logger['info'](_0xd6c6('0xd'),_0x15d6da,_0xd6c6('0xe'));_0xfc0494(_0x3aff03[_0xd6c6('0x14')]['message']);}})[_0xd6c6('0x15')](function(_0x4b4fd8){logger[_0xd6c6('0x11')](_0xd6c6('0xd'),_0x15d6da,_0x4b4fd8);_0x35f31d(_0x4b4fd8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9bc0764..b09c8d6 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 _0x7aaf=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xc9bc97,_0x3317b1){var _0x54e9fe=function(_0x11a783){while(--_0x11a783){_0xc9bc97['push'](_0xc9bc97['shift']());}};_0x54e9fe(++_0x3317b1);}(_0x7aaf,0x14d));var _0xf7aa=function(_0x223ca4,_0x50179d){_0x223ca4=_0x223ca4-0x0;var _0x2c5199=_0x7aaf[_0x223ca4];return _0x2c5199;};'use strict';var multer=require('multer');var util=require(_0xf7aa('0x0'));var path=require(_0xf7aa('0x1'));var timeout=require(_0xf7aa('0x2'));var express=require(_0xf7aa('0x3'));var router=express[_0xf7aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7aa('0x5'));var interaction=require(_0xf7aa('0x6'));var config=require(_0xf7aa('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf7aa('0x8')]('/',auth[_0xf7aa('0x9')](),controller[_0xf7aa('0xa')]);router[_0xf7aa('0x8')](_0xf7aa('0xb'),auth[_0xf7aa('0x9')](),controller[_0xf7aa('0xc')]);router[_0xf7aa('0xd')]('/',auth[_0xf7aa('0x9')](),controller['create']);router[_0xf7aa('0xe')](_0xf7aa('0xb'),auth[_0xf7aa('0x9')](),controller[_0xf7aa('0xf')]);router[_0xf7aa('0x10')](_0xf7aa('0xb'),auth[_0xf7aa('0x9')](),controller[_0xf7aa('0x11')]);module[_0xf7aa('0x12')]=router; \ No newline at end of file +var _0xd889=['./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xd889,0x9c));var _0x9d88=function(_0x1a6658,_0x1930c7){_0x1a6658=_0x1a6658-0x0;var _0x56fa28=_0xd889[_0x1a6658];return _0x56fa28;};'use strict';var multer=require('multer');var util=require(_0x9d88('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d88('0x1'));var router=express[_0x9d88('0x2')]();var fs_extra=require(_0x9d88('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9d88('0x4'));var config=require(_0x9d88('0x5'));var controller=require(_0x9d88('0x6'));router[_0x9d88('0x7')]('/',auth[_0x9d88('0x8')](),controller[_0x9d88('0x9')]);router[_0x9d88('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9d88('0xa')]);router[_0x9d88('0xb')]('/',auth[_0x9d88('0x8')](),controller[_0x9d88('0xc')]);router[_0x9d88('0xd')](_0x9d88('0xe'),auth[_0x9d88('0x8')](),controller[_0x9d88('0xf')]);router[_0x9d88('0x10')](_0x9d88('0xe'),auth[_0x9d88('0x8')](),controller[_0x9d88('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 93fe986..1f03d4d 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 _0x08cc=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x525290,_0x493c29){var _0x1231ca=function(_0x2aaded){while(--_0x2aaded){_0x525290['push'](_0x525290['shift']());}};_0x1231ca(++_0x493c29);}(_0x08cc,0x12f));var _0xc08c=function(_0x118a92,_0x3812bf){_0x118a92=_0x118a92-0x0;var _0x545b48=_0x08cc[_0x118a92];return _0x545b48;};'use strict';var Sequelize=require(_0xc08c('0x0'));module[_0xc08c('0x1')]={'type':{'type':Sequelize[_0xc08c('0x2')](_0xc08c('0x3'),_0xc08c('0x4'),_0xc08c('0x5'),_0xc08c('0x6'),_0xc08c('0x7')),'defaultValue':_0xc08c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc08c('0x2')](_0xc08c('0x3'),_0xc08c('0x4'),_0xc08c('0x5'))},'keyContent':{'type':Sequelize[_0xc08c('0x8')]},'idField':{'type':Sequelize[_0xc08c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc08c('0x8')]}}; \ No newline at end of file +var _0x47ea=['customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47ea,0x1eb));var _0xa47e=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x47ea[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0xa47e('0x0'));module[_0xa47e('0x1')]={'type':{'type':Sequelize[_0xa47e('0x2')]('string',_0xa47e('0x3'),_0xa47e('0x4'),'keyValue',_0xa47e('0x5')),'defaultValue':_0xa47e('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa47e('0x7')]},'keyType':{'type':Sequelize[_0xa47e('0x2')]('string',_0xa47e('0x3'),_0xa47e('0x4'))},'keyContent':{'type':Sequelize[_0xa47e('0x7')]},'idField':{'type':Sequelize[_0xa47e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa47e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa47e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5586175..79060ea 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 _0x10a0=['bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','error','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','name','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0x10a0,0x1b1));var _0x010a=function(_0x5373d5,_0x2aacd1){_0x5373d5=_0x5373d5-0x0;var _0x39cdeb=_0x10a0[_0x5373d5];return _0x39cdeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x010a('0x0'));var zipdir=require(_0x010a('0x1'));var jsonpatch=require(_0x010a('0x2'));var rp=require(_0x010a('0x3'));var moment=require(_0x010a('0x4'));var BPromise=require(_0x010a('0x5'));var Mustache=require('mustache');var util=require(_0x010a('0x6'));var path=require(_0x010a('0x7'));var sox=require(_0x010a('0x8'));var csv=require(_0x010a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x010a('0xa'));var squel=require(_0x010a('0xb'));var crypto=require(_0x010a('0xc'));var jsforce=require(_0x010a('0xd'));var deskjs=require(_0x010a('0xe'));var toCsv=require(_0x010a('0x9'));var querystring=require(_0x010a('0xf'));var Papa=require('papaparse');var Redis=require(_0x010a('0x10'));var authService=require(_0x010a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x010a('0x12'));var logger=require(_0x010a('0x13'))(_0x010a('0x14'));var utils=require(_0x010a('0x15'));var config=require(_0x010a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x010a('0x17'))['db'];function respondWithStatusCode(_0x561230,_0x4a5294){_0x4a5294=_0x4a5294||0xcc;return function(_0x223207){if(_0x223207){return _0x561230['sendStatus'](_0x4a5294);}return _0x561230[_0x010a('0x18')](_0x4a5294)[_0x010a('0x19')]();};}function respondWithResult(_0x31b0ab,_0x13de8d){_0x13de8d=_0x13de8d||0xc8;return function(_0x518225){if(_0x518225){return _0x31b0ab['status'](_0x13de8d)['json'](_0x518225);}};}function respondWithFilteredResult(_0x4e7f4d,_0x19935a){return function(_0x5b8a3f){if(_0x5b8a3f){var _0x1ce5e8=typeof _0x19935a[_0x010a('0x1a')]===_0x010a('0x1b')&&typeof _0x19935a[_0x010a('0x1c')]===_0x010a('0x1b');var _0x76c95e=_0x5b8a3f['count'];var _0x1024b0=_0x1ce5e8?0x0:_0x19935a[_0x010a('0x1a')];var _0x21ec2d=_0x1ce5e8?_0x5b8a3f['count']:_0x19935a[_0x010a('0x1a')]+_0x19935a[_0x010a('0x1c')];var _0x3a5ba9;if(_0x21ec2d>=_0x76c95e){_0x21ec2d=_0x76c95e;_0x3a5ba9=0xc8;}else{_0x3a5ba9=0xce;}_0x4e7f4d[_0x010a('0x18')](_0x3a5ba9);return _0x4e7f4d[_0x010a('0x1d')]('Content-Range',_0x1024b0+'-'+_0x21ec2d+'/'+_0x76c95e)[_0x010a('0x1e')](_0x5b8a3f);}return null;};}function patchUpdates(_0x221282){return function(_0x4fb558){try{jsonpatch[_0x010a('0x1f')](_0x4fb558,_0x221282,!![]);}catch(_0x289901){return BPromise[_0x010a('0x20')](_0x289901);}return _0x4fb558[_0x010a('0x21')]();};}function saveUpdates(_0x4daf39,_0x49880d){return function(_0xfd1d3a){if(_0xfd1d3a){return _0xfd1d3a[_0x010a('0x22')](_0x4daf39)[_0x010a('0x23')](function(_0x5b9fbf){return _0x5b9fbf;});}return null;};}function removeEntity(_0x596eb7,_0x13b4a5){return function(_0x32b280){if(_0x32b280){return _0x32b280[_0x010a('0x24')]()[_0x010a('0x23')](function(){_0x596eb7[_0x010a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d1e8,_0x3a5cfe){return function(_0x48b718){if(!_0x48b718){_0x21d1e8['sendStatus'](0x194);}return _0x48b718;};}function handleError(_0xdb566b,_0x5896fe){_0x5896fe=_0x5896fe||0x1f4;return function(_0x262797){logger[_0x010a('0x25')](_0x262797['stack']);if(_0x262797['name']){delete _0x262797['name'];}_0xdb566b[_0x010a('0x18')](_0x5896fe)[_0x010a('0x26')](_0x262797);};}exports[_0x010a('0x27')]=function(_0x11ecdc,_0x158c91){var _0x1dd89e={},_0x326418={},_0x678e2b={'count':0x0,'rows':[]};var _0x43b242=_[_0x010a('0x28')](db[_0x010a('0x29')][_0x010a('0x2a')],function(_0x12ea1f){return{'name':_0x12ea1f[_0x010a('0x2b')],'type':_0x12ea1f[_0x010a('0x2c')]['key']};});_0x326418[_0x010a('0x2d')]=_['map'](_0x43b242,_0x010a('0x2e'));_0x326418['query']=_[_0x010a('0x2f')](_0x11ecdc['query']);_0x326418[_0x010a('0x30')]=_['intersection'](_0x326418[_0x010a('0x2d')],_0x326418[_0x010a('0x31')]);_0x1dd89e[_0x010a('0x32')]=_[_0x010a('0x33')](_0x326418[_0x010a('0x2d')],qs[_0x010a('0x34')](_0x11ecdc[_0x010a('0x31')][_0x010a('0x34')]));_0x1dd89e[_0x010a('0x32')]=_0x1dd89e[_0x010a('0x32')][_0x010a('0x35')]?_0x1dd89e['attributes']:_0x326418[_0x010a('0x2d')];if(!_0x11ecdc[_0x010a('0x31')][_0x010a('0x36')](_0x010a('0x37'))){_0x1dd89e[_0x010a('0x1c')]=qs[_0x010a('0x1c')](_0x11ecdc[_0x010a('0x31')][_0x010a('0x1c')]);_0x1dd89e[_0x010a('0x1a')]=qs[_0x010a('0x1a')](_0x11ecdc['query'][_0x010a('0x1a')]);}_0x1dd89e[_0x010a('0x38')]=qs['sort'](_0x11ecdc['query']['sort']);_0x1dd89e['where']=qs[_0x010a('0x30')](_['pick'](_0x11ecdc[_0x010a('0x31')],_0x326418[_0x010a('0x30')]),_0x43b242);if(_0x11ecdc[_0x010a('0x31')][_0x010a('0x39')]){_0x1dd89e[_0x010a('0x3a')]=_[_0x010a('0x3b')](_0x1dd89e[_0x010a('0x3a')],{'$or':_[_0x010a('0x28')](_0x43b242,function(_0xbb42ec){if(_0xbb42ec[_0x010a('0x2c')]!==_0x010a('0x3c')){var _0x327ec0={};_0x327ec0[_0xbb42ec[_0x010a('0x2e')]]={'$like':'%'+_0x11ecdc[_0x010a('0x31')][_0x010a('0x39')]+'%'};return _0x327ec0;}})});}_0x1dd89e=_[_0x010a('0x3b')]({},_0x1dd89e,_0x11ecdc[_0x010a('0x3d')]);var _0xc31ff0={'where':_0x1dd89e[_0x010a('0x3a')]};return db[_0x010a('0x29')][_0x010a('0x3e')](_0xc31ff0)[_0x010a('0x23')](function(_0x567cdd){_0x678e2b[_0x010a('0x3e')]=_0x567cdd;if(_0x11ecdc[_0x010a('0x31')][_0x010a('0x3f')]){_0x1dd89e[_0x010a('0x40')]=[{'all':!![]}];}return db[_0x010a('0x29')][_0x010a('0x41')](_0x1dd89e);})['then'](function(_0x29346d){_0x678e2b[_0x010a('0x42')]=_0x29346d;return _0x678e2b;})[_0x010a('0x23')](respondWithFilteredResult(_0x158c91,_0x1dd89e))[_0x010a('0x43')](handleError(_0x158c91,null));};exports[_0x010a('0x44')]=function(_0xe8d9fd,_0x31bb8d){var _0x47cd93={'raw':!![],'where':{'id':_0xe8d9fd[_0x010a('0x45')]['id']}},_0x517bb0={};_0x517bb0[_0x010a('0x2d')]=_['keys'](db[_0x010a('0x29')]['rawAttributes']);_0x517bb0[_0x010a('0x31')]=_['keys'](_0xe8d9fd['query']);_0x517bb0[_0x010a('0x30')]=_[_0x010a('0x33')](_0x517bb0[_0x010a('0x2d')],_0x517bb0[_0x010a('0x31')]);_0x47cd93[_0x010a('0x32')]=_[_0x010a('0x33')](_0x517bb0[_0x010a('0x2d')],qs[_0x010a('0x34')](_0xe8d9fd[_0x010a('0x31')][_0x010a('0x34')]));_0x47cd93[_0x010a('0x32')]=_0x47cd93[_0x010a('0x32')][_0x010a('0x35')]?_0x47cd93[_0x010a('0x32')]:_0x517bb0['model'];if(_0xe8d9fd['query'][_0x010a('0x3f')]){_0x47cd93[_0x010a('0x40')]=[{'all':!![]}];}_0x47cd93=_[_0x010a('0x3b')]({},_0x47cd93,_0xe8d9fd[_0x010a('0x3d')]);return db[_0x010a('0x29')][_0x010a('0x46')](_0x47cd93)[_0x010a('0x23')](handleEntityNotFound(_0x31bb8d,null))['then'](respondWithResult(_0x31bb8d,null))[_0x010a('0x43')](handleError(_0x31bb8d,null));};exports[_0x010a('0x47')]=function(_0x4ca42a,_0x586083){return db[_0x010a('0x29')][_0x010a('0x47')](_0x4ca42a[_0x010a('0x48')],{})[_0x010a('0x23')](respondWithResult(_0x586083,0xc9))['catch'](handleError(_0x586083,null));};exports[_0x010a('0x22')]=function(_0x58c72b,_0x2f9c38){if(_0x58c72b[_0x010a('0x48')]['id']){delete _0x58c72b[_0x010a('0x48')]['id'];}return db[_0x010a('0x29')][_0x010a('0x46')]({'where':{'id':_0x58c72b[_0x010a('0x45')]['id']}})[_0x010a('0x23')](handleEntityNotFound(_0x2f9c38,null))['then'](saveUpdates(_0x58c72b[_0x010a('0x48')],null))[_0x010a('0x23')](respondWithResult(_0x2f9c38,null))['catch'](handleError(_0x2f9c38,null));};exports['destroy']=function(_0x4edced,_0x2350e0){return db[_0x010a('0x29')][_0x010a('0x46')]({'where':{'id':_0x4edced['params']['id']}})[_0x010a('0x23')](handleEntityNotFound(_0x2350e0,null))[_0x010a('0x23')](removeEntity(_0x2350e0,null))['catch'](handleError(_0x2350e0,null));}; \ No newline at end of file +var _0xf26c=['rawAttributes','options','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SugarcrmField','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','includeAll','findAll','rows','show','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf26c,0x173));var _0xcf26=function(_0x19830d,_0x430863){_0x19830d=_0x19830d-0x0;var _0x1d0b82=_0xf26c[_0x19830d];return _0x1d0b82;};'use strict';var emlformat=require(_0xcf26('0x0'));var rimraf=require(_0xcf26('0x1'));var zipdir=require(_0xcf26('0x2'));var jsonpatch=require(_0xcf26('0x3'));var rp=require(_0xcf26('0x4'));var moment=require('moment');var BPromise=require(_0xcf26('0x5'));var Mustache=require(_0xcf26('0x6'));var util=require(_0xcf26('0x7'));var path=require(_0xcf26('0x8'));var sox=require(_0xcf26('0x9'));var csv=require(_0xcf26('0xa'));var ejs=require(_0xcf26('0xb'));var fs=require('fs');var fs_extra=require(_0xcf26('0xc'));var _=require('lodash');var squel=require(_0xcf26('0xd'));var crypto=require(_0xcf26('0xe'));var jsforce=require(_0xcf26('0xf'));var deskjs=require(_0xcf26('0x10'));var toCsv=require(_0xcf26('0xa'));var querystring=require(_0xcf26('0x11'));var Papa=require('papaparse');var Redis=require(_0xcf26('0x12'));var authService=require(_0xcf26('0x13'));var qs=require(_0xcf26('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf26('0x15'));var logger=require(_0xcf26('0x16'))(_0xcf26('0x17'));var utils=require(_0xcf26('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb05540,_0x157bc9){_0x157bc9=_0x157bc9||0xcc;return function(_0x1bb435){if(_0x1bb435){return _0xb05540[_0xcf26('0x19')](_0x157bc9);}return _0xb05540[_0xcf26('0x1a')](_0x157bc9)[_0xcf26('0x1b')]();};}function respondWithResult(_0x3c580f,_0x1ad763){_0x1ad763=_0x1ad763||0xc8;return function(_0x980c8f){if(_0x980c8f){return _0x3c580f[_0xcf26('0x1a')](_0x1ad763)[_0xcf26('0x1c')](_0x980c8f);}};}function respondWithFilteredResult(_0x5e7699,_0xc3ee66){return function(_0x29e0d4){if(_0x29e0d4){var _0x3df52d=typeof _0xc3ee66[_0xcf26('0x1d')]===_0xcf26('0x1e')&&typeof _0xc3ee66['limit']===_0xcf26('0x1e');var _0x5ba065=_0x29e0d4[_0xcf26('0x1f')];var _0x5c3af3=_0x3df52d?0x0:_0xc3ee66[_0xcf26('0x1d')];var _0x2bc392=_0x3df52d?_0x29e0d4[_0xcf26('0x1f')]:_0xc3ee66['offset']+_0xc3ee66[_0xcf26('0x20')];var _0x1c6004;if(_0x2bc392>=_0x5ba065){_0x2bc392=_0x5ba065;_0x1c6004=0xc8;}else{_0x1c6004=0xce;}_0x5e7699['status'](_0x1c6004);return _0x5e7699[_0xcf26('0x21')](_0xcf26('0x22'),_0x5c3af3+'-'+_0x2bc392+'/'+_0x5ba065)['json'](_0x29e0d4);}return null;};}function patchUpdates(_0xc3acf5){return function(_0x3ce4ed){try{jsonpatch[_0xcf26('0x23')](_0x3ce4ed,_0xc3acf5,!![]);}catch(_0x44a4ce){return BPromise[_0xcf26('0x24')](_0x44a4ce);}return _0x3ce4ed[_0xcf26('0x25')]();};}function saveUpdates(_0xed056,_0x34b19c){return function(_0x3cb377){if(_0x3cb377){return _0x3cb377[_0xcf26('0x26')](_0xed056)[_0xcf26('0x27')](function(_0x2f7973){return _0x2f7973;});}return null;};}function removeEntity(_0x5a013f,_0x4f0e09){return function(_0x429e2b){if(_0x429e2b){return _0x429e2b['destroy']()['then'](function(){_0x5a013f['status'](0xcc)[_0xcf26('0x1b')]();});}};}function handleEntityNotFound(_0x137d4e,_0x101581){return function(_0xa377ad){if(!_0xa377ad){_0x137d4e['sendStatus'](0x194);}return _0xa377ad;};}function handleError(_0x18ce7e,_0x11de1b){_0x11de1b=_0x11de1b||0x1f4;return function(_0x2e8fa9){logger[_0xcf26('0x28')](_0x2e8fa9['stack']);if(_0x2e8fa9[_0xcf26('0x29')]){delete _0x2e8fa9[_0xcf26('0x29')];}_0x18ce7e[_0xcf26('0x1a')](_0x11de1b)[_0xcf26('0x2a')](_0x2e8fa9);};}exports[_0xcf26('0x2b')]=function(_0x508889,_0x8c9f68){var _0x2dd545={},_0x180cbb={},_0x169f89={'count':0x0,'rows':[]};var _0x6b2b06=_[_0xcf26('0x2c')](db[_0xcf26('0x2d')]['rawAttributes'],function(_0x21ac7e){return{'name':_0x21ac7e['fieldName'],'type':_0x21ac7e['type'][_0xcf26('0x2e')]};});_0x180cbb[_0xcf26('0x2f')]=_[_0xcf26('0x2c')](_0x6b2b06,_0xcf26('0x29'));_0x180cbb[_0xcf26('0x30')]=_[_0xcf26('0x31')](_0x508889['query']);_0x180cbb[_0xcf26('0x32')]=_[_0xcf26('0x33')](_0x180cbb['model'],_0x180cbb[_0xcf26('0x30')]);_0x2dd545[_0xcf26('0x34')]=_[_0xcf26('0x33')](_0x180cbb[_0xcf26('0x2f')],qs[_0xcf26('0x35')](_0x508889[_0xcf26('0x30')][_0xcf26('0x35')]));_0x2dd545[_0xcf26('0x34')]=_0x2dd545[_0xcf26('0x34')][_0xcf26('0x36')]?_0x2dd545[_0xcf26('0x34')]:_0x180cbb['model'];if(!_0x508889['query'][_0xcf26('0x37')]('nolimit')){_0x2dd545['limit']=qs[_0xcf26('0x20')](_0x508889[_0xcf26('0x30')][_0xcf26('0x20')]);_0x2dd545['offset']=qs[_0xcf26('0x1d')](_0x508889[_0xcf26('0x30')][_0xcf26('0x1d')]);}_0x2dd545[_0xcf26('0x38')]=qs[_0xcf26('0x39')](_0x508889[_0xcf26('0x30')][_0xcf26('0x39')]);_0x2dd545[_0xcf26('0x3a')]=qs['filters'](_[_0xcf26('0x3b')](_0x508889['query'],_0x180cbb[_0xcf26('0x32')]),_0x6b2b06);if(_0x508889[_0xcf26('0x30')]['filter']){_0x2dd545[_0xcf26('0x3a')]=_['merge'](_0x2dd545[_0xcf26('0x3a')],{'$or':_[_0xcf26('0x2c')](_0x6b2b06,function(_0x2bc820){if(_0x2bc820['type']!==_0xcf26('0x3c')){var _0xbc3f9b={};_0xbc3f9b[_0x2bc820[_0xcf26('0x29')]]={'$like':'%'+_0x508889[_0xcf26('0x30')]['filter']+'%'};return _0xbc3f9b;}})});}_0x2dd545=_[_0xcf26('0x3d')]({},_0x2dd545,_0x508889['options']);var _0x42d23f={'where':_0x2dd545[_0xcf26('0x3a')]};return db[_0xcf26('0x2d')][_0xcf26('0x1f')](_0x42d23f)['then'](function(_0x584b91){_0x169f89[_0xcf26('0x1f')]=_0x584b91;if(_0x508889[_0xcf26('0x30')][_0xcf26('0x3e')]){_0x2dd545['include']=[{'all':!![]}];}return db[_0xcf26('0x2d')][_0xcf26('0x3f')](_0x2dd545);})[_0xcf26('0x27')](function(_0x538f8b){_0x169f89[_0xcf26('0x40')]=_0x538f8b;return _0x169f89;})[_0xcf26('0x27')](respondWithFilteredResult(_0x8c9f68,_0x2dd545))['catch'](handleError(_0x8c9f68,null));};exports[_0xcf26('0x41')]=function(_0x3ec663,_0x28e635){var _0x2a3930={'raw':!![],'where':{'id':_0x3ec663[_0xcf26('0x42')]['id']}},_0x3ecba9={};_0x3ecba9['model']=_[_0xcf26('0x31')](db[_0xcf26('0x2d')][_0xcf26('0x43')]);_0x3ecba9['query']=_['keys'](_0x3ec663[_0xcf26('0x30')]);_0x3ecba9[_0xcf26('0x32')]=_[_0xcf26('0x33')](_0x3ecba9[_0xcf26('0x2f')],_0x3ecba9[_0xcf26('0x30')]);_0x2a3930[_0xcf26('0x34')]=_[_0xcf26('0x33')](_0x3ecba9[_0xcf26('0x2f')],qs[_0xcf26('0x35')](_0x3ec663[_0xcf26('0x30')][_0xcf26('0x35')]));_0x2a3930[_0xcf26('0x34')]=_0x2a3930[_0xcf26('0x34')][_0xcf26('0x36')]?_0x2a3930[_0xcf26('0x34')]:_0x3ecba9[_0xcf26('0x2f')];if(_0x3ec663[_0xcf26('0x30')]['includeAll']){_0x2a3930['include']=[{'all':!![]}];}_0x2a3930=_['merge']({},_0x2a3930,_0x3ec663[_0xcf26('0x44')]);return db[_0xcf26('0x2d')][_0xcf26('0x45')](_0x2a3930)['then'](handleEntityNotFound(_0x28e635,null))[_0xcf26('0x27')](respondWithResult(_0x28e635,null))[_0xcf26('0x46')](handleError(_0x28e635,null));};exports['create']=function(_0x59dd1f,_0x4da46c){return db[_0xcf26('0x2d')]['create'](_0x59dd1f[_0xcf26('0x47')],{})[_0xcf26('0x27')](respondWithResult(_0x4da46c,0xc9))[_0xcf26('0x46')](handleError(_0x4da46c,null));};exports[_0xcf26('0x26')]=function(_0x1569f9,_0x57ac9c){if(_0x1569f9[_0xcf26('0x47')]['id']){delete _0x1569f9['body']['id'];}return db[_0xcf26('0x2d')][_0xcf26('0x45')]({'where':{'id':_0x1569f9[_0xcf26('0x42')]['id']}})[_0xcf26('0x27')](handleEntityNotFound(_0x57ac9c,null))[_0xcf26('0x27')](saveUpdates(_0x1569f9[_0xcf26('0x47')],null))[_0xcf26('0x27')](respondWithResult(_0x57ac9c,null))[_0xcf26('0x46')](handleError(_0x57ac9c,null));};exports[_0xcf26('0x48')]=function(_0x316866,_0x170301){return db[_0xcf26('0x2d')][_0xcf26('0x45')]({'where':{'id':_0x316866['params']['id']}})['then'](handleEntityNotFound(_0x170301,null))['then'](removeEntity(_0x170301,null))[_0xcf26('0x46')](handleError(_0x170301,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0291906..eae1c52 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 _0x8ddb=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0xa8b151,_0x29dea2){var _0x565495=function(_0x12feaa){while(--_0x12feaa){_0xa8b151['push'](_0xa8b151['shift']());}};_0x565495(++_0x29dea2);}(_0x8ddb,0x139));var _0xb8dd=function(_0x352108,_0xb5cdc3){_0x352108=_0x352108-0x0;var _0x2c901c=_0x8ddb[_0x352108];return _0x2c901c;};'use strict';var _=require(_0xb8dd('0x0'));var util=require('util');var logger=require(_0xb8dd('0x1'))(_0xb8dd('0x2'));var moment=require(_0xb8dd('0x3'));var BPromise=require(_0xb8dd('0x4'));var rp=require(_0xb8dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb8dd('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x341bef,_0x24aef6){return _0x341bef[_0xb8dd('0x7')](_0xb8dd('0x8'),attributes,{'tableName':_0xb8dd('0x9'),'paranoid':![],'indexes':[{'name':_0xb8dd('0xa'),'fields':[_0xb8dd('0xb'),_0xb8dd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25ba=['path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','idField','api','moment','bluebird','request-promise'];(function(_0x359255,_0x567200){var _0x49569a=function(_0x3f6898){while(--_0x3f6898){_0x359255['push'](_0x359255['shift']());}};_0x49569a(++_0x567200);}(_0x25ba,0xa1));var _0xa25b=function(_0xd04c70,_0x2893f0){_0xd04c70=_0xd04c70-0x0;var _0x2729a7=_0x25ba[_0xd04c70];return _0x2729a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa25b('0x0'));var moment=require(_0xa25b('0x1'));var BPromise=require(_0xa25b('0x2'));var rp=require(_0xa25b('0x3'));var fs=require('fs');var path=require(_0xa25b('0x4'));var rimraf=require(_0xa25b('0x5'));var config=require('../../config/environment');var attributes=require(_0xa25b('0x6'));module[_0xa25b('0x7')]=function(_0x4af879,_0x134b97){return _0x4af879[_0xa25b('0x8')](_0xa25b('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xa25b('0xa'),'FieldId'],'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 44e3f7f..a21fa7d 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 _0x90d1=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18ba8d,_0x37594f){var _0x178551=function(_0x4e17ce){while(--_0x4e17ce){_0x18ba8d['push'](_0x18ba8d['shift']());}};_0x178551(++_0x37594f);}(_0x90d1,0x162));var _0x190d=function(_0x321df4,_0x3efec5){_0x321df4=_0x321df4-0x0;var _0x50d06c=_0x90d1[_0x321df4];return _0x50d06c;};'use strict';var _=require(_0x190d('0x0'));var util=require(_0x190d('0x1'));var moment=require(_0x190d('0x2'));var BPromise=require(_0x190d('0x3'));var rs=require(_0x190d('0x4'));var fs=require('fs');var Redis=require(_0x190d('0x5'));var db=require(_0x190d('0x6'))['db'];var utils=require(_0x190d('0x7'));var logger=require('../../config/logger')(_0x190d('0x8'));var config=require(_0x190d('0x9'));var jayson=require(_0x190d('0xa'));var client=jayson['client'][_0x190d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5293ec,_0x304d1e,_0x464133){return new BPromise(function(_0x32665e,_0x411fac){return client['request'](_0x5293ec,_0x464133)[_0x190d('0xc')](function(_0x5d0a03){logger[_0x190d('0xd')](_0x190d('0xe'),_0x304d1e,'request\x20sent');logger[_0x190d('0xf')](_0x190d('0x10'),_0x304d1e,_0x190d('0x11'),JSON[_0x190d('0x12')](_0x5d0a03));if(_0x5d0a03[_0x190d('0x13')]){if(_0x5d0a03[_0x190d('0x13')]['code']===0x1f4){logger['error'](_0x190d('0xe'),_0x304d1e,_0x5d0a03[_0x190d('0x13')][_0x190d('0x14')]);return _0x411fac(_0x5d0a03['error'][_0x190d('0x14')]);}logger[_0x190d('0x13')](_0x190d('0xe'),_0x304d1e,_0x5d0a03[_0x190d('0x13')][_0x190d('0x14')]);return _0x32665e(_0x5d0a03['error'][_0x190d('0x14')]);}else{logger[_0x190d('0xd')](_0x190d('0xe'),_0x304d1e,_0x190d('0x11'));_0x32665e(_0x5d0a03[_0x190d('0x15')][_0x190d('0x14')]);}})['catch'](function(_0x5ca2cf){logger[_0x190d('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x304d1e,_0x5ca2cf);_0x411fac(_0x5ca2cf);});});} \ No newline at end of file +var _0x4df1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','code','error','message','result','lodash','util','bluebird','randomstring'];(function(_0x367d4c,_0xf03c8a){var _0x53298c=function(_0x31e0bf){while(--_0x31e0bf){_0x367d4c['push'](_0x367d4c['shift']());}};_0x53298c(++_0xf03c8a);}(_0x4df1,0x13f));var _0x14df=function(_0x4e339e,_0x2b1843){_0x4e339e=_0x4e339e-0x0;var _0xb4782a=_0x4df1[_0x4e339e];return _0xb4782a;};'use strict';var _=require(_0x14df('0x0'));var util=require(_0x14df('0x1'));var moment=require('moment');var BPromise=require(_0x14df('0x2'));var rs=require(_0x14df('0x3'));var fs=require('fs');var Redis=require(_0x14df('0x4'));var db=require(_0x14df('0x5'))['db'];var utils=require(_0x14df('0x6'));var logger=require(_0x14df('0x7'))(_0x14df('0x8'));var config=require(_0x14df('0x9'));var jayson=require(_0x14df('0xa'));var client=jayson[_0x14df('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9011,_0x9a4294,_0x543aa3){return new BPromise(function(_0x1c772f,_0x4a62fc){return client[_0x14df('0xc')](_0x1a9011,_0x543aa3)['then'](function(_0x4ad5fc){logger['info'](_0x14df('0xd'),_0x9a4294,_0x14df('0xe'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x9a4294,_0x14df('0xe'),JSON['stringify'](_0x4ad5fc));if(_0x4ad5fc['error']){if(_0x4ad5fc['error'][_0x14df('0xf')]===0x1f4){logger[_0x14df('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x9a4294,_0x4ad5fc[_0x14df('0x10')][_0x14df('0x11')]);return _0x4a62fc(_0x4ad5fc[_0x14df('0x10')][_0x14df('0x11')]);}logger[_0x14df('0x10')](_0x14df('0xd'),_0x9a4294,_0x4ad5fc[_0x14df('0x10')][_0x14df('0x11')]);return _0x1c772f(_0x4ad5fc[_0x14df('0x10')][_0x14df('0x11')]);}else{logger['info'](_0x14df('0xd'),_0x9a4294,_0x14df('0xe'));_0x1c772f(_0x4ad5fc[_0x14df('0x12')][_0x14df('0x11')]);}})['catch'](function(_0x21d8f5){logger[_0x14df('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x9a4294,_0x21d8f5);_0x4a62fc(_0x21d8f5);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f511978..9ebd099 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 _0x84ab=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','/:id','show','isAuthenticated','/:id/fields','create','post','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x390c42,_0x10e1ae){var _0x43894c=function(_0x510bd0){while(--_0x510bd0){_0x390c42['push'](_0x390c42['shift']());}};_0x43894c(++_0x10e1ae);}(_0x84ab,0x12f));var _0xb84a=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x84ab[_0x1c8c28];return _0x1f59b4;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id/configurations',auth[_0xb84a('0xc')](),controller['getConfigurations']);router[_0xb84a('0x9')](_0xb84a('0xd'),auth[_0xb84a('0xc')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xb84a('0xe')]);router[_0xb84a('0xf')](_0xb84a('0x10'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x11')]);router['put'](_0xb84a('0xa'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);router[_0xb84a('0x13')](_0xb84a('0xa'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x14')]);module[_0xb84a('0x15')]=router; \ No newline at end of file +var _0x3140=['get','isAuthenticated','index','/:id','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x5a8269,_0xfb2f54){var _0x539ed7=function(_0x31ce98){while(--_0x31ce98){_0x5a8269['push'](_0x5a8269['shift']());}};_0x539ed7(++_0xfb2f54);}(_0x3140,0xaf));var _0x0314=function(_0x83e4d9,_0x3b9bb6){_0x83e4d9=_0x83e4d9-0x0;var _0x36a145=_0x3140[_0x83e4d9];return _0x36a145;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['show']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0314('0x9')]('/:id/fields',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0x10')]);router[_0x0314('0xf')]('/:id/configurations',auth[_0x0314('0xa')](),controller[_0x0314('0x11')]);router[_0x0314('0x12')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller[_0x0314('0x13')]);router[_0x0314('0x14')]('/:id',auth[_0x0314('0xa')](),controller[_0x0314('0x15')]);module[_0x0314('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 59a6a09..9364a16 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 _0x7eac=['HelpDesk','sequelize','exports','STRING'];(function(_0x3dc377,_0x2a9bf7){var _0x175956=function(_0x566ccd){while(--_0x566ccd){_0x3dc377['push'](_0x3dc377['shift']());}};_0x175956(++_0x2a9bf7);}(_0x7eac,0x14d));var _0xc7ea=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7eac[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0xc7ea('0x0'));module[_0xc7ea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc7ea('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc7ea('0x2')],'allowNull':![],'defaultValue':_0xc7ea('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc7ea('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2770=['exports','STRING','HelpDesk','sequelize'];(function(_0x5e22f7,_0xc0c7c3){var _0x3f6e48=function(_0x3673d0){while(--_0x3673d0){_0x5e22f7['push'](_0x5e22f7['shift']());}};_0x3f6e48(++_0xc0c7c3);}(_0x2770,0x12f));var _0x0277=function(_0x4e90f0,_0x3b7e3c){_0x4e90f0=_0x4e90f0-0x0;var _0x1a2cee=_0x2770[_0x4e90f0];return _0x1a2cee;};'use strict';var Sequelize=require(_0x0277('0x0'));module[_0x0277('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0277('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0277('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0277('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0277('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 1b7bbc4..3f5b26d 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 _0xd50a=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','show','params','create','body','find','VtigerConfiguration','hasOwnProperty','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','findOne','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','includes','false','label','startsWith','cf_','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x2cd79a,_0x2a964b){var _0x51833a=function(_0x1480c5){while(--_0x1480c5){_0x2cd79a['push'](_0x2cd79a['shift']());}};_0x51833a(++_0x2a964b);}(_0xd50a,0x1e5));var _0xad50=function(_0x438831,_0x4016ea){_0x438831=_0x438831-0x0;var _0x49efc6=_0xd50a[_0x438831];return _0x49efc6;};'use strict';var emlformat=require(_0xad50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad50('0x1'));var jsonpatch=require(_0xad50('0x2'));var rp=require('request-promise');var moment=require(_0xad50('0x3'));var BPromise=require(_0xad50('0x4'));var Mustache=require(_0xad50('0x5'));var util=require(_0xad50('0x6'));var path=require('path');var sox=require(_0xad50('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad50('0x8'));var _=require('lodash');var squel=require(_0xad50('0x9'));var crypto=require('crypto');var jsforce=require(_0xad50('0xa'));var deskjs=require(_0xad50('0xb'));var toCsv=require('to-csv');var querystring=require(_0xad50('0xc'));var Papa=require(_0xad50('0xd'));var Redis=require(_0xad50('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xad50('0xf'));var as=require(_0xad50('0x10'));var hardwareService=require(_0xad50('0x11'));var logger=require(_0xad50('0x12'))(_0xad50('0x13'));var utils=require(_0xad50('0x14'));var config=require(_0xad50('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad50('0x16'))['db'];var integrations=require(_0xad50('0x17'));function respondWithStatusCode(_0x19c025,_0x3f8326){_0x3f8326=_0x3f8326||0xcc;return function(_0x32dca7){if(_0x32dca7){return _0x19c025[_0xad50('0x18')](_0x3f8326);}return _0x19c025[_0xad50('0x19')](_0x3f8326)[_0xad50('0x1a')]();};}function respondWithResult(_0x130042,_0x518782){_0x518782=_0x518782||0xc8;return function(_0x4b49e7){if(_0x4b49e7){return _0x130042['status'](_0x518782)[_0xad50('0x1b')](_0x4b49e7);}};}function respondWithFilteredResult(_0x4e46e3,_0x55e4ab){return function(_0x1d6e16){if(_0x1d6e16){var _0xe0b423=typeof _0x55e4ab[_0xad50('0x1c')]===_0xad50('0x1d')&&typeof _0x55e4ab[_0xad50('0x1e')]===_0xad50('0x1d');var _0x20aea4=_0x1d6e16[_0xad50('0x1f')];var _0x3c1c2d=_0xe0b423?0x0:_0x55e4ab[_0xad50('0x1c')];var _0x20c0b3=_0xe0b423?_0x1d6e16[_0xad50('0x1f')]:_0x55e4ab[_0xad50('0x1c')]+_0x55e4ab['limit'];var _0x2c52e3;if(_0x20c0b3>=_0x20aea4){_0x20c0b3=_0x20aea4;_0x2c52e3=0xc8;}else{_0x2c52e3=0xce;}_0x4e46e3['status'](_0x2c52e3);return _0x4e46e3[_0xad50('0x20')](_0xad50('0x21'),_0x3c1c2d+'-'+_0x20c0b3+'/'+_0x20aea4)[_0xad50('0x1b')](_0x1d6e16);}return null;};}function patchUpdates(_0x5ab5bf){return function(_0x42cbdc){try{jsonpatch['apply'](_0x42cbdc,_0x5ab5bf,!![]);}catch(_0x5983ba){return BPromise[_0xad50('0x22')](_0x5983ba);}return _0x42cbdc[_0xad50('0x23')]();};}function saveUpdates(_0x2e1e74,_0x18160b){return function(_0x3fda94){if(_0x3fda94){return _0x3fda94[_0xad50('0x24')](_0x2e1e74)[_0xad50('0x25')](function(_0x396d51){return _0x396d51;});}return null;};}function removeEntity(_0x4a2d16,_0x927a3f){return function(_0x818ae4){if(_0x818ae4){return _0x818ae4[_0xad50('0x26')]()['then'](function(){_0x4a2d16[_0xad50('0x19')](0xcc)[_0xad50('0x1a')]();});}};}function handleEntityNotFound(_0x21774a,_0x2b5c4a){return function(_0x4338e5){if(!_0x4338e5){_0x21774a[_0xad50('0x18')](0x194);}return _0x4338e5;};}function handleError(_0x4fa2d8,_0x3d0117){_0x3d0117=_0x3d0117||0x1f4;return function(_0x3d80a6){logger[_0xad50('0x27')](_0x3d80a6['stack']);if(_0x3d80a6['name']){delete _0x3d80a6[_0xad50('0x28')];}_0x4fa2d8['status'](_0x3d0117)[_0xad50('0x29')](_0x3d80a6);};}exports['index']=function(_0x104f5a,_0x3e0b34){var _0x4a4aa9={},_0x5536a7={},_0x30765a={'count':0x0,'rows':[]};var _0xb5af95=_[_0xad50('0x2a')](db[_0xad50('0x2b')][_0xad50('0x2c')],function(_0x41efb2){return{'name':_0x41efb2[_0xad50('0x2d')],'type':_0x41efb2['type'][_0xad50('0x2e')]};});_0x5536a7['model']=_[_0xad50('0x2a')](_0xb5af95,_0xad50('0x28'));_0x5536a7[_0xad50('0x2f')]=_[_0xad50('0x30')](_0x104f5a[_0xad50('0x2f')]);_0x5536a7[_0xad50('0x31')]=_[_0xad50('0x32')](_0x5536a7['model'],_0x5536a7[_0xad50('0x2f')]);_0x4a4aa9[_0xad50('0x33')]=_[_0xad50('0x32')](_0x5536a7['model'],qs[_0xad50('0x34')](_0x104f5a['query'][_0xad50('0x34')]));_0x4a4aa9[_0xad50('0x33')]=_0x4a4aa9[_0xad50('0x33')][_0xad50('0x35')]?_0x4a4aa9[_0xad50('0x33')]:_0x5536a7[_0xad50('0x36')];if(!_0x104f5a[_0xad50('0x2f')]['hasOwnProperty'](_0xad50('0x37'))){_0x4a4aa9['limit']=qs[_0xad50('0x1e')](_0x104f5a[_0xad50('0x2f')][_0xad50('0x1e')]);_0x4a4aa9[_0xad50('0x1c')]=qs['offset'](_0x104f5a[_0xad50('0x2f')]['offset']);}_0x4a4aa9[_0xad50('0x38')]=qs['sort'](_0x104f5a[_0xad50('0x2f')][_0xad50('0x39')]);_0x4a4aa9['where']=qs[_0xad50('0x31')](_[_0xad50('0x3a')](_0x104f5a['query'],_0x5536a7[_0xad50('0x31')]),_0xb5af95);if(_0x104f5a[_0xad50('0x2f')][_0xad50('0x3b')]){_0x4a4aa9[_0xad50('0x3c')]=_[_0xad50('0x3d')](_0x4a4aa9[_0xad50('0x3c')],{'$or':_[_0xad50('0x2a')](_0xb5af95,function(_0x3e80a0){if(_0x3e80a0[_0xad50('0x3e')]!=='VIRTUAL'){var _0x104d38={};_0x104d38[_0x3e80a0[_0xad50('0x28')]]={'$like':'%'+_0x104f5a[_0xad50('0x2f')][_0xad50('0x3b')]+'%'};return _0x104d38;}})});}_0x4a4aa9=_[_0xad50('0x3d')]({},_0x4a4aa9,_0x104f5a[_0xad50('0x3f')]);var _0x13bb9e={'where':_0x4a4aa9[_0xad50('0x3c')]};return db[_0xad50('0x2b')]['count'](_0x13bb9e)['then'](function(_0x29f4cc){_0x30765a[_0xad50('0x1f')]=_0x29f4cc;if(_0x104f5a[_0xad50('0x2f')][_0xad50('0x40')]){_0x4a4aa9[_0xad50('0x41')]=[{'all':!![]}];}return db[_0xad50('0x2b')][_0xad50('0x42')](_0x4a4aa9);})[_0xad50('0x25')](function(_0x43e035){_0x30765a['rows']=_0x43e035;return _0x30765a;})[_0xad50('0x25')](respondWithFilteredResult(_0x3e0b34,_0x4a4aa9))[_0xad50('0x43')](handleError(_0x3e0b34,null));};exports[_0xad50('0x44')]=function(_0x37a855,_0x5214fc){var _0x26a59f={'raw':![],'where':{'id':_0x37a855[_0xad50('0x45')]['id']}},_0x492ed6={};_0x492ed6['model']=_['keys'](db[_0xad50('0x2b')]['rawAttributes']);_0x492ed6[_0xad50('0x2f')]=_[_0xad50('0x30')](_0x37a855['query']);_0x492ed6['filters']=_[_0xad50('0x32')](_0x492ed6[_0xad50('0x36')],_0x492ed6[_0xad50('0x2f')]);_0x26a59f['attributes']=_['intersection'](_0x492ed6['model'],qs[_0xad50('0x34')](_0x37a855[_0xad50('0x2f')][_0xad50('0x34')]));_0x26a59f[_0xad50('0x33')]=_0x26a59f[_0xad50('0x33')][_0xad50('0x35')]?_0x26a59f[_0xad50('0x33')]:_0x492ed6['model'];if(_0x37a855[_0xad50('0x2f')][_0xad50('0x40')]){_0x26a59f[_0xad50('0x41')]=[{'all':!![]}];}_0x26a59f=_['merge']({},_0x26a59f,_0x37a855['options']);return db[_0xad50('0x2b')]['find'](_0x26a59f)[_0xad50('0x25')](handleEntityNotFound(_0x5214fc,null))[_0xad50('0x25')](respondWithResult(_0x5214fc,null))[_0xad50('0x43')](handleError(_0x5214fc,null));};exports['create']=function(_0x9b73a4,_0x4a360a){return db['VtigerAccount'][_0xad50('0x46')](_0x9b73a4[_0xad50('0x47')],{})[_0xad50('0x25')](respondWithResult(_0x4a360a,0xc9))[_0xad50('0x43')](handleError(_0x4a360a,null));};exports[_0xad50('0x24')]=function(_0x3258ae,_0x8f6a10){if(_0x3258ae[_0xad50('0x47')]['id']){delete _0x3258ae['body']['id'];}return db[_0xad50('0x2b')][_0xad50('0x48')]({'where':{'id':_0x3258ae[_0xad50('0x45')]['id']}})[_0xad50('0x25')](handleEntityNotFound(_0x8f6a10,null))[_0xad50('0x25')](saveUpdates(_0x3258ae[_0xad50('0x47')],null))[_0xad50('0x25')](respondWithResult(_0x8f6a10,null))[_0xad50('0x43')](handleError(_0x8f6a10,null));};exports[_0xad50('0x26')]=function(_0x3c1bfa,_0x20d275){return db[_0xad50('0x2b')]['find']({'where':{'id':_0x3c1bfa[_0xad50('0x45')]['id']}})[_0xad50('0x25')](handleEntityNotFound(_0x20d275,null))[_0xad50('0x25')](removeEntity(_0x20d275,null))[_0xad50('0x43')](handleError(_0x20d275,null));};exports['getConfigurations']=function(_0x518c95,_0x3862a8,_0x434acb){var _0x17df0c={};var _0x3bce8a={};var _0xcea921;var _0x59b0ea;return db[_0xad50('0x2b')]['findOne']({'where':{'id':_0x518c95[_0xad50('0x45')]['id']}})['then'](handleEntityNotFound(_0x3862a8,null))['then'](function(_0x11760c){if(_0x11760c){_0xcea921=_0x11760c;_0x3bce8a[_0xad50('0x36')]=_[_0xad50('0x30')](db[_0xad50('0x49')][_0xad50('0x2c')]);_0x3bce8a[_0xad50('0x2f')]=_['keys'](_0x518c95[_0xad50('0x2f')]);_0x3bce8a[_0xad50('0x31')]=_[_0xad50('0x32')](_0x3bce8a[_0xad50('0x36')],_0x3bce8a['query']);_0x17df0c['attributes']=_[_0xad50('0x32')](_0x3bce8a[_0xad50('0x36')],qs[_0xad50('0x34')](_0x518c95[_0xad50('0x2f')][_0xad50('0x34')]));_0x17df0c[_0xad50('0x33')]=_0x17df0c[_0xad50('0x33')][_0xad50('0x35')]?_0x17df0c[_0xad50('0x33')]:_0x3bce8a[_0xad50('0x36')];_0x17df0c['order']=qs['sort'](_0x518c95[_0xad50('0x2f')][_0xad50('0x39')]);_0x17df0c['where']=qs['filters'](_[_0xad50('0x3a')](_0x518c95[_0xad50('0x2f')],_0x3bce8a[_0xad50('0x31')]));if(_0x518c95[_0xad50('0x2f')]['filter']){_0x17df0c[_0xad50('0x3c')]=_[_0xad50('0x3d')](_0x17df0c[_0xad50('0x3c')],{'$or':_['map'](_0x17df0c['attributes'],function(_0x22e922){var _0x22c342={};_0x22c342[_0x22e922]={'$like':'%'+_0x518c95[_0xad50('0x2f')][_0xad50('0x3b')]+'%'};return _0x22c342;})});}_0x17df0c=_[_0xad50('0x3d')]({},_0x17df0c,_0x518c95[_0xad50('0x3f')]);return _0xcea921['getConfigurations'](_0x17df0c);}})[_0xad50('0x25')](function(_0x3ea280){if(_0x3ea280){_0x59b0ea=_0x3ea280[_0xad50('0x35')];if(!_0x518c95[_0xad50('0x2f')][_0xad50('0x4a')](_0xad50('0x37'))){_0x17df0c[_0xad50('0x1e')]=qs[_0xad50('0x1e')](_0x518c95[_0xad50('0x2f')][_0xad50('0x1e')]);_0x17df0c[_0xad50('0x1c')]=qs[_0xad50('0x1c')](_0x518c95['query'][_0xad50('0x1c')]);}return _0xcea921[_0xad50('0x4b')](_0x17df0c);}})[_0xad50('0x25')](function(_0x4d85cc){if(_0x4d85cc){return _0x4d85cc?{'count':_0x59b0ea,'rows':_0x4d85cc}:null;}})['then'](respondWithResult(_0x3862a8,null))['catch'](handleError(_0x3862a8,null));};exports[_0xad50('0x4c')]=function(_0x273775,_0x4f62dd,_0x4d75e6){if(_0x273775[_0xad50('0x47')]['id']){delete _0x273775[_0xad50('0x47')]['id'];}return db[_0xad50('0x2b')]['findOne']({'where':{'id':_0x273775[_0xad50('0x45')]['id']}})[_0xad50('0x25')](handleEntityNotFound(_0x4f62dd,null))[_0xad50('0x25')](function(_0x137e8f){if(_0x137e8f){_0x273775['body']['AccountId']=_0x137e8f['id'];_0x273775[_0xad50('0x47')][_0xad50('0x4d')]=integrations[_0xad50('0x4e')](_0x273775[_0xad50('0x47')][_0xad50('0x4f')],_0x273775[_0xad50('0x47')][_0xad50('0x3e')]);_0x273775[_0xad50('0x47')][_0xad50('0x50')]=integrations[_0xad50('0x51')](_0x273775[_0xad50('0x47')][_0xad50('0x4f')],_0x273775[_0xad50('0x47')]['type']);return db[_0xad50('0x49')][_0xad50('0x46')](_0x273775[_0xad50('0x47')],{'include':[{'model':db['VtigerField'],'as':_0xad50('0x4d')},{'model':db[_0xad50('0x52')],'as':'Descriptions'}]});}return null;})[_0xad50('0x25')](respondWithResult(_0x4f62dd,null))['catch'](handleError(_0x4f62dd,null));};var md5=require('md5');exports[_0xad50('0x53')]=function(_0x2a1de1,_0x45cb30,_0x13918d){var _0x51a5f5=null;var _0x3da2f9=null;var _0x46a773=null;var _0x29250a=null;var _0x4c99a2='';return db[_0xad50('0x2b')][_0xad50('0x54')]({'where':{'id':_0x2a1de1[_0xad50('0x45')]['id']},'attributes':['id',_0xad50('0x28'),'username',_0xad50('0x55'),_0xad50('0x56'),_0xad50('0x57'),_0xad50('0x58'),_0xad50('0x59')]})['then'](handleEntityNotFound(_0x45cb30,null))[_0xad50('0x25')](function(_0x1beb45){if(_0x1beb45){_0x51a5f5=_0x1beb45[_0xad50('0x5a')];_0x3da2f9=_0x1beb45[_0xad50('0x59')];_0x46a773=_0x1beb45['moduleName'];_0x4c99a2=_0x1beb45[_0xad50('0x57')];var _0x526322=_0x4c99a2[_0xad50('0x5b')](-0x1);if(_0x526322==='/'){_0x4c99a2=_0x4c99a2[_0xad50('0x5c')](0x0,_0x4c99a2['lastIndexOf'](_0x526322));}_0x29250a=util[_0xad50('0x5d')](_0xad50('0x5e'),_0x4c99a2);var _0x4d7bf8={'method':_0xad50('0x5f'),'uri':_0x29250a,'qs':{'operation':_0xad50('0x60'),'username':_0x1beb45[_0xad50('0x5a')]},'json':!![]};return rp(_0x4d7bf8);}})[_0xad50('0x25')](function(_0x537159){if(_0x537159['success']){var _0x530340={'method':_0xad50('0x61'),'uri':_0x29250a,'form':{'operation':_0xad50('0x62'),'username':_0x51a5f5,'accessKey':md5(_0x537159[_0xad50('0x63')][_0xad50('0x64')]+_0x3da2f9)},'json':!![]};return rp(_0x530340);}})[_0xad50('0x25')](function(_0x2e37f0){if(_0x2e37f0[_0xad50('0x65')]){var _0x19a751={'method':_0xad50('0x5f'),'uri':_0x29250a,'qs':{'operation':_0xad50('0x66'),'username':_0x51a5f5,'sessionName':_0x2e37f0[_0xad50('0x63')][_0xad50('0x67')],'elementType':_0x46a773},'json':!![]};return rp(_0x19a751);}})[_0xad50('0x25')](function(_0x3cd9fe){if(_0x3cd9fe['success']){var _0x22e502=[_0xad50('0x68'),_0xad50('0x69'),_0xad50('0x6a')];_[_0xad50('0x6b')](_0x3cd9fe['result'][_0xad50('0x34')],function(_0x26b695){return _0x22e502[_0xad50('0x6c')](_0x26b695[_0xad50('0x3e')][_0xad50('0x28')]);});_[_0xad50('0x6b')](_0x3cd9fe[_0xad50('0x63')][_0xad50('0x34')],function(_0x3e3ceb){return _0x3e3ceb['editable']===_0xad50('0x6d');});return{'count':_0x3cd9fe[_0xad50('0x63')][_0xad50('0x34')][_0xad50('0x35')],'rows':_[_0xad50('0x2a')](_0x3cd9fe[_0xad50('0x63')][_0xad50('0x34')],function(_0x2a73c7){return{'id':_0x2a73c7[_0xad50('0x28')],'name':_0x2a73c7[_0xad50('0x6e')],'custom':_[_0xad50('0x6f')](_0x2a73c7[_0xad50('0x28')],_0xad50('0x70'))?!![]:![],'options':_0x2a73c7[_0xad50('0x3e')][_0xad50('0x28')]==='picklist'&&_0x2a73c7[_0xad50('0x3e')][_0xad50('0x71')]['length']>0x0?_[_0xad50('0x2a')](_0x2a73c7[_0xad50('0x3e')][_0xad50('0x71')],function(_0x4d5f8b){return{'name':_0x4d5f8b['label'],'value':_0x4d5f8b['value']};}):[]};})};}})[_0xad50('0x25')](respondWithResult(_0x45cb30,null))[_0xad50('0x43')](function(_0x435c39){console[_0xad50('0x72')](_0xad50('0x73')+_0x435c39);var _0x1a12d0=_0x2a1de1[_0xad50('0x2f')]['test']?0x1f4:_0x435c39[_0xad50('0x74')]||0x1f4;logger[_0xad50('0x27')](_0xad50('0x75'),_0xad50('0x53'),_0x1a12d0,JSON[_0xad50('0x76')](_0x435c39));delete _0x435c39[_0xad50('0x28')];if(_0x1a12d0===0x191){_0x1a12d0=0x190;}_0x45cb30[_0xad50('0x19')](_0x1a12d0)[_0xad50('0x29')](_0x2a1de1[_0xad50('0x2f')][_0xad50('0x77')]?{'message':_0xad50('0x78'),'statusCode':_0x435c39[_0xad50('0x74')]}:_0x435c39);});}; \ No newline at end of file +var _0xda26=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VtigerAccount','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','catch','findOne','VtigerConfiguration','pick','getConfigurations','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','getchallenge','success','login','result','token','GET','describe','sessionName','autogenerated','reference','owner','includes','remove','editable','false','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','fieldName','type','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda26,0x142));var _0x6da2=function(_0x38d70b,_0x143a4c){_0x38d70b=_0x38d70b-0x0;var _0x2f3749=_0xda26[_0x38d70b];return _0x2f3749;};'use strict';var emlformat=require(_0x6da2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6da2('0x1'));var jsonpatch=require(_0x6da2('0x2'));var rp=require('request-promise');var moment=require(_0x6da2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6da2('0x4'));var util=require(_0x6da2('0x5'));var path=require(_0x6da2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6da2('0x7'));var fs=require('fs');var fs_extra=require(_0x6da2('0x8'));var _=require('lodash');var squel=require(_0x6da2('0x9'));var crypto=require(_0x6da2('0xa'));var jsforce=require(_0x6da2('0xb'));var deskjs=require(_0x6da2('0xc'));var toCsv=require(_0x6da2('0xd'));var querystring=require(_0x6da2('0xe'));var Papa=require(_0x6da2('0xf'));var Redis=require(_0x6da2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6da2('0x11'));var as=require(_0x6da2('0x12'));var hardwareService=require(_0x6da2('0x13'));var logger=require(_0x6da2('0x14'))(_0x6da2('0x15'));var utils=require(_0x6da2('0x16'));var config=require(_0x6da2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6da2('0x18'))['db'];var integrations=require(_0x6da2('0x19'));function respondWithStatusCode(_0x18635e,_0x2bf3b7){_0x2bf3b7=_0x2bf3b7||0xcc;return function(_0x49e855){if(_0x49e855){return _0x18635e['sendStatus'](_0x2bf3b7);}return _0x18635e['status'](_0x2bf3b7)[_0x6da2('0x1a')]();};}function respondWithResult(_0x43aa34,_0x818481){_0x818481=_0x818481||0xc8;return function(_0x2031c5){if(_0x2031c5){return _0x43aa34[_0x6da2('0x1b')](_0x818481)[_0x6da2('0x1c')](_0x2031c5);}};}function respondWithFilteredResult(_0x5a5e83,_0x131b6a){return function(_0x1d9a98){if(_0x1d9a98){var _0x444524=typeof _0x131b6a['offset']==='undefined'&&typeof _0x131b6a[_0x6da2('0x1d')]===_0x6da2('0x1e');var _0x3792bd=_0x1d9a98[_0x6da2('0x1f')];var _0x508717=_0x444524?0x0:_0x131b6a[_0x6da2('0x20')];var _0x47e29e=_0x444524?_0x1d9a98[_0x6da2('0x1f')]:_0x131b6a[_0x6da2('0x20')]+_0x131b6a[_0x6da2('0x1d')];var _0xe90452;if(_0x47e29e>=_0x3792bd){_0x47e29e=_0x3792bd;_0xe90452=0xc8;}else{_0xe90452=0xce;}_0x5a5e83[_0x6da2('0x1b')](_0xe90452);return _0x5a5e83[_0x6da2('0x21')](_0x6da2('0x22'),_0x508717+'-'+_0x47e29e+'/'+_0x3792bd)[_0x6da2('0x1c')](_0x1d9a98);}return null;};}function patchUpdates(_0x187cad){return function(_0x138456){try{jsonpatch[_0x6da2('0x23')](_0x138456,_0x187cad,!![]);}catch(_0xae2829){return BPromise[_0x6da2('0x24')](_0xae2829);}return _0x138456[_0x6da2('0x25')]();};}function saveUpdates(_0x1f4c0a,_0x5200f4){return function(_0x8c0835){if(_0x8c0835){return _0x8c0835[_0x6da2('0x26')](_0x1f4c0a)[_0x6da2('0x27')](function(_0x328c4f){return _0x328c4f;});}return null;};}function removeEntity(_0x4778d1,_0x86f9d7){return function(_0x442980){if(_0x442980){return _0x442980[_0x6da2('0x28')]()[_0x6da2('0x27')](function(){_0x4778d1[_0x6da2('0x1b')](0xcc)[_0x6da2('0x1a')]();});}};}function handleEntityNotFound(_0x3bba48,_0x2ef2d4){return function(_0x532394){if(!_0x532394){_0x3bba48[_0x6da2('0x29')](0x194);}return _0x532394;};}function handleError(_0x4fc321,_0x191e5f){_0x191e5f=_0x191e5f||0x1f4;return function(_0x3c6216){logger[_0x6da2('0x2a')](_0x3c6216[_0x6da2('0x2b')]);if(_0x3c6216[_0x6da2('0x2c')]){delete _0x3c6216[_0x6da2('0x2c')];}_0x4fc321[_0x6da2('0x1b')](_0x191e5f)['send'](_0x3c6216);};}exports[_0x6da2('0x2d')]=function(_0x15ad53,_0x442e3e){var _0x4d28a0={},_0x3071a3={},_0x1399da={'count':0x0,'rows':[]};var _0x24fdbd=_[_0x6da2('0x2e')](db['VtigerAccount']['rawAttributes'],function(_0x2a2e23){return{'name':_0x2a2e23[_0x6da2('0x2f')],'type':_0x2a2e23[_0x6da2('0x30')]['key']};});_0x3071a3[_0x6da2('0x31')]=_[_0x6da2('0x2e')](_0x24fdbd,'name');_0x3071a3[_0x6da2('0x32')]=_[_0x6da2('0x33')](_0x15ad53[_0x6da2('0x32')]);_0x3071a3[_0x6da2('0x34')]=_[_0x6da2('0x35')](_0x3071a3[_0x6da2('0x31')],_0x3071a3[_0x6da2('0x32')]);_0x4d28a0[_0x6da2('0x36')]=_[_0x6da2('0x35')](_0x3071a3[_0x6da2('0x31')],qs['fields'](_0x15ad53['query'][_0x6da2('0x37')]));_0x4d28a0[_0x6da2('0x36')]=_0x4d28a0[_0x6da2('0x36')][_0x6da2('0x38')]?_0x4d28a0['attributes']:_0x3071a3[_0x6da2('0x31')];if(!_0x15ad53[_0x6da2('0x32')][_0x6da2('0x39')](_0x6da2('0x3a'))){_0x4d28a0[_0x6da2('0x1d')]=qs[_0x6da2('0x1d')](_0x15ad53[_0x6da2('0x32')][_0x6da2('0x1d')]);_0x4d28a0[_0x6da2('0x20')]=qs[_0x6da2('0x20')](_0x15ad53[_0x6da2('0x32')][_0x6da2('0x20')]);}_0x4d28a0[_0x6da2('0x3b')]=qs[_0x6da2('0x3c')](_0x15ad53[_0x6da2('0x32')]['sort']);_0x4d28a0['where']=qs[_0x6da2('0x34')](_['pick'](_0x15ad53['query'],_0x3071a3[_0x6da2('0x34')]),_0x24fdbd);if(_0x15ad53[_0x6da2('0x32')][_0x6da2('0x3d')]){_0x4d28a0[_0x6da2('0x3e')]=_[_0x6da2('0x3f')](_0x4d28a0[_0x6da2('0x3e')],{'$or':_['map'](_0x24fdbd,function(_0x2cd9c3){if(_0x2cd9c3[_0x6da2('0x30')]!==_0x6da2('0x40')){var _0x4bfd85={};_0x4bfd85[_0x2cd9c3[_0x6da2('0x2c')]]={'$like':'%'+_0x15ad53[_0x6da2('0x32')][_0x6da2('0x3d')]+'%'};return _0x4bfd85;}})});}_0x4d28a0=_[_0x6da2('0x3f')]({},_0x4d28a0,_0x15ad53[_0x6da2('0x41')]);var _0x127e62={'where':_0x4d28a0[_0x6da2('0x3e')]};return db[_0x6da2('0x42')][_0x6da2('0x1f')](_0x127e62)['then'](function(_0x3a1345){_0x1399da[_0x6da2('0x1f')]=_0x3a1345;if(_0x15ad53[_0x6da2('0x32')]['includeAll']){_0x4d28a0['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x6da2('0x43')](_0x4d28a0);})[_0x6da2('0x27')](function(_0x4fcc68){_0x1399da[_0x6da2('0x44')]=_0x4fcc68;return _0x1399da;})[_0x6da2('0x27')](respondWithFilteredResult(_0x442e3e,_0x4d28a0))['catch'](handleError(_0x442e3e,null));};exports[_0x6da2('0x45')]=function(_0x7ffc71,_0x5efd93){var _0x4ad18c={'raw':![],'where':{'id':_0x7ffc71[_0x6da2('0x46')]['id']}},_0x19ecd5={};_0x19ecd5[_0x6da2('0x31')]=_[_0x6da2('0x33')](db[_0x6da2('0x42')][_0x6da2('0x47')]);_0x19ecd5['query']=_[_0x6da2('0x33')](_0x7ffc71[_0x6da2('0x32')]);_0x19ecd5[_0x6da2('0x34')]=_[_0x6da2('0x35')](_0x19ecd5['model'],_0x19ecd5[_0x6da2('0x32')]);_0x4ad18c[_0x6da2('0x36')]=_[_0x6da2('0x35')](_0x19ecd5[_0x6da2('0x31')],qs[_0x6da2('0x37')](_0x7ffc71['query'][_0x6da2('0x37')]));_0x4ad18c['attributes']=_0x4ad18c[_0x6da2('0x36')][_0x6da2('0x38')]?_0x4ad18c[_0x6da2('0x36')]:_0x19ecd5['model'];if(_0x7ffc71[_0x6da2('0x32')][_0x6da2('0x48')]){_0x4ad18c[_0x6da2('0x49')]=[{'all':!![]}];}_0x4ad18c=_[_0x6da2('0x3f')]({},_0x4ad18c,_0x7ffc71['options']);return db[_0x6da2('0x42')][_0x6da2('0x4a')](_0x4ad18c)[_0x6da2('0x27')](handleEntityNotFound(_0x5efd93,null))[_0x6da2('0x27')](respondWithResult(_0x5efd93,null))['catch'](handleError(_0x5efd93,null));};exports[_0x6da2('0x4b')]=function(_0x1b8923,_0x920a15){return db[_0x6da2('0x42')][_0x6da2('0x4b')](_0x1b8923[_0x6da2('0x4c')],{})[_0x6da2('0x27')](respondWithResult(_0x920a15,0xc9))['catch'](handleError(_0x920a15,null));};exports[_0x6da2('0x26')]=function(_0x761651,_0x213662){if(_0x761651[_0x6da2('0x4c')]['id']){delete _0x761651[_0x6da2('0x4c')]['id'];}return db[_0x6da2('0x42')][_0x6da2('0x4a')]({'where':{'id':_0x761651[_0x6da2('0x46')]['id']}})[_0x6da2('0x27')](handleEntityNotFound(_0x213662,null))[_0x6da2('0x27')](saveUpdates(_0x761651[_0x6da2('0x4c')],null))[_0x6da2('0x27')](respondWithResult(_0x213662,null))['catch'](handleError(_0x213662,null));};exports[_0x6da2('0x28')]=function(_0x378792,_0x2e3a9d){return db[_0x6da2('0x42')][_0x6da2('0x4a')]({'where':{'id':_0x378792[_0x6da2('0x46')]['id']}})[_0x6da2('0x27')](handleEntityNotFound(_0x2e3a9d,null))[_0x6da2('0x27')](removeEntity(_0x2e3a9d,null))[_0x6da2('0x4d')](handleError(_0x2e3a9d,null));};exports['getConfigurations']=function(_0x450d9e,_0xb04b44,_0x4ef433){var _0x59fa92={};var _0x2e17eb={};var _0x491eab;var _0x2104ce;return db[_0x6da2('0x42')][_0x6da2('0x4e')]({'where':{'id':_0x450d9e[_0x6da2('0x46')]['id']}})['then'](handleEntityNotFound(_0xb04b44,null))[_0x6da2('0x27')](function(_0x39720b){if(_0x39720b){_0x491eab=_0x39720b;_0x2e17eb[_0x6da2('0x31')]=_[_0x6da2('0x33')](db[_0x6da2('0x4f')][_0x6da2('0x47')]);_0x2e17eb[_0x6da2('0x32')]=_[_0x6da2('0x33')](_0x450d9e[_0x6da2('0x32')]);_0x2e17eb['filters']=_[_0x6da2('0x35')](_0x2e17eb[_0x6da2('0x31')],_0x2e17eb[_0x6da2('0x32')]);_0x59fa92['attributes']=_[_0x6da2('0x35')](_0x2e17eb[_0x6da2('0x31')],qs[_0x6da2('0x37')](_0x450d9e[_0x6da2('0x32')][_0x6da2('0x37')]));_0x59fa92[_0x6da2('0x36')]=_0x59fa92[_0x6da2('0x36')][_0x6da2('0x38')]?_0x59fa92[_0x6da2('0x36')]:_0x2e17eb['model'];_0x59fa92[_0x6da2('0x3b')]=qs[_0x6da2('0x3c')](_0x450d9e[_0x6da2('0x32')]['sort']);_0x59fa92['where']=qs[_0x6da2('0x34')](_[_0x6da2('0x50')](_0x450d9e[_0x6da2('0x32')],_0x2e17eb[_0x6da2('0x34')]));if(_0x450d9e[_0x6da2('0x32')][_0x6da2('0x3d')]){_0x59fa92[_0x6da2('0x3e')]=_[_0x6da2('0x3f')](_0x59fa92[_0x6da2('0x3e')],{'$or':_[_0x6da2('0x2e')](_0x59fa92[_0x6da2('0x36')],function(_0x544f18){var _0x2bbbeb={};_0x2bbbeb[_0x544f18]={'$like':'%'+_0x450d9e[_0x6da2('0x32')][_0x6da2('0x3d')]+'%'};return _0x2bbbeb;})});}_0x59fa92=_[_0x6da2('0x3f')]({},_0x59fa92,_0x450d9e[_0x6da2('0x41')]);return _0x491eab[_0x6da2('0x51')](_0x59fa92);}})[_0x6da2('0x27')](function(_0x4baec2){if(_0x4baec2){_0x2104ce=_0x4baec2['length'];if(!_0x450d9e[_0x6da2('0x32')][_0x6da2('0x39')](_0x6da2('0x3a'))){_0x59fa92[_0x6da2('0x1d')]=qs['limit'](_0x450d9e[_0x6da2('0x32')]['limit']);_0x59fa92[_0x6da2('0x20')]=qs[_0x6da2('0x20')](_0x450d9e[_0x6da2('0x32')][_0x6da2('0x20')]);}return _0x491eab['getConfigurations'](_0x59fa92);}})[_0x6da2('0x27')](function(_0x39ce84){if(_0x39ce84){return _0x39ce84?{'count':_0x2104ce,'rows':_0x39ce84}:null;}})[_0x6da2('0x27')](respondWithResult(_0xb04b44,null))[_0x6da2('0x4d')](handleError(_0xb04b44,null));};exports['addConfiguration']=function(_0x2d67ec,_0x588090,_0x5f1124){if(_0x2d67ec[_0x6da2('0x4c')]['id']){delete _0x2d67ec[_0x6da2('0x4c')]['id'];}return db[_0x6da2('0x42')][_0x6da2('0x4e')]({'where':{'id':_0x2d67ec[_0x6da2('0x46')]['id']}})['then'](handleEntityNotFound(_0x588090,null))[_0x6da2('0x27')](function(_0x348446){if(_0x348446){_0x2d67ec[_0x6da2('0x4c')]['AccountId']=_0x348446['id'];_0x2d67ec[_0x6da2('0x4c')]['Subjects']=integrations[_0x6da2('0x52')](_0x2d67ec[_0x6da2('0x4c')][_0x6da2('0x53')],_0x2d67ec['body']['type']);_0x2d67ec[_0x6da2('0x4c')]['Descriptions']=integrations[_0x6da2('0x54')](_0x2d67ec[_0x6da2('0x4c')]['channel'],_0x2d67ec[_0x6da2('0x4c')][_0x6da2('0x30')]);return db['VtigerConfiguration'][_0x6da2('0x4b')](_0x2d67ec[_0x6da2('0x4c')],{'include':[{'model':db[_0x6da2('0x55')],'as':_0x6da2('0x56')},{'model':db['VtigerField'],'as':_0x6da2('0x57')}]});}return null;})[_0x6da2('0x27')](respondWithResult(_0x588090,null))[_0x6da2('0x4d')](handleError(_0x588090,null));};var md5=require('md5');exports[_0x6da2('0x58')]=function(_0x46a0ca,_0x5d59d7,_0x4a3c4b){var _0x175cbd=null;var _0x2ab01f=null;var _0x2df0dc=null;var _0x5f132f=null;var _0x5a547f='';return db['VtigerAccount'][_0x6da2('0x4e')]({'where':{'id':_0x46a0ca[_0x6da2('0x46')]['id']},'attributes':['id','name',_0x6da2('0x59'),_0x6da2('0x5a'),_0x6da2('0x5b'),_0x6da2('0x5c'),_0x6da2('0x5d'),_0x6da2('0x5e')]})['then'](handleEntityNotFound(_0x5d59d7,null))[_0x6da2('0x27')](function(_0x5211a0){if(_0x5211a0){_0x175cbd=_0x5211a0['username'];_0x2ab01f=_0x5211a0[_0x6da2('0x5e')];_0x2df0dc=_0x5211a0[_0x6da2('0x5b')];_0x5a547f=_0x5211a0['remoteUri'];var _0xec125f=_0x5a547f[_0x6da2('0x5f')](-0x1);if(_0xec125f==='/'){_0x5a547f=_0x5a547f['substring'](0x0,_0x5a547f['lastIndexOf'](_0xec125f));}_0x5f132f=util[_0x6da2('0x60')](_0x6da2('0x61'),_0x5a547f);var _0x49ea6e={'method':'GET','uri':_0x5f132f,'qs':{'operation':_0x6da2('0x62'),'username':_0x5211a0[_0x6da2('0x59')]},'json':!![]};return rp(_0x49ea6e);}})[_0x6da2('0x27')](function(_0x2fe5bb){if(_0x2fe5bb[_0x6da2('0x63')]){var _0x3f9e4f={'method':'POST','uri':_0x5f132f,'form':{'operation':_0x6da2('0x64'),'username':_0x175cbd,'accessKey':md5(_0x2fe5bb[_0x6da2('0x65')][_0x6da2('0x66')]+_0x2ab01f)},'json':!![]};return rp(_0x3f9e4f);}})[_0x6da2('0x27')](function(_0x1b8086){if(_0x1b8086[_0x6da2('0x63')]){var _0x11944c={'method':_0x6da2('0x67'),'uri':_0x5f132f,'qs':{'operation':_0x6da2('0x68'),'username':_0x175cbd,'sessionName':_0x1b8086[_0x6da2('0x65')][_0x6da2('0x69')],'elementType':_0x2df0dc},'json':!![]};return rp(_0x11944c);}})[_0x6da2('0x27')](function(_0x338f40){if(_0x338f40['success']){var _0x8a9fef=[_0x6da2('0x6a'),_0x6da2('0x6b'),_0x6da2('0x6c')];_['remove'](_0x338f40[_0x6da2('0x65')][_0x6da2('0x37')],function(_0x12e1c2){return _0x8a9fef[_0x6da2('0x6d')](_0x12e1c2[_0x6da2('0x30')][_0x6da2('0x2c')]);});_[_0x6da2('0x6e')](_0x338f40[_0x6da2('0x65')][_0x6da2('0x37')],function(_0x134a25){return _0x134a25[_0x6da2('0x6f')]===_0x6da2('0x70');});return{'count':_0x338f40['result'][_0x6da2('0x37')]['length'],'rows':_['map'](_0x338f40[_0x6da2('0x65')][_0x6da2('0x37')],function(_0x101c1e){return{'id':_0x101c1e['name'],'name':_0x101c1e['label'],'custom':_[_0x6da2('0x71')](_0x101c1e[_0x6da2('0x2c')],_0x6da2('0x72'))?!![]:![],'options':_0x101c1e[_0x6da2('0x30')][_0x6da2('0x2c')]===_0x6da2('0x73')&&_0x101c1e[_0x6da2('0x30')][_0x6da2('0x74')][_0x6da2('0x38')]>0x0?_[_0x6da2('0x2e')](_0x101c1e[_0x6da2('0x30')][_0x6da2('0x74')],function(_0x48a732){return{'name':_0x48a732['label'],'value':_0x48a732['value']};}):[]};})};}})[_0x6da2('0x27')](respondWithResult(_0x5d59d7,null))[_0x6da2('0x4d')](function(_0x16522f){console[_0x6da2('0x75')](_0x6da2('0x76')+_0x16522f);var _0x36e74d=_0x46a0ca[_0x6da2('0x32')][_0x6da2('0x77')]?0x1f4:_0x16522f[_0x6da2('0x78')]||0x1f4;logger[_0x6da2('0x2a')](_0x6da2('0x79'),_0x6da2('0x58'),_0x36e74d,JSON[_0x6da2('0x7a')](_0x16522f));delete _0x16522f[_0x6da2('0x2c')];if(_0x36e74d===0x191){_0x36e74d=0x190;}_0x5d59d7[_0x6da2('0x1b')](_0x36e74d)['send'](_0x46a0ca[_0x6da2('0x32')][_0x6da2('0x77')]?{'message':_0x6da2('0x7b'),'statusCode':_0x16522f[_0x6da2('0x78')]}:_0x16522f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ddbf2bf..e234e13 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 _0x8591=['../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x563b8f,_0xa5c47c){var _0x10658b=function(_0x2a940e){while(--_0x2a940e){_0x563b8f['push'](_0x563b8f['shift']());}};_0x10658b(++_0xa5c47c);}(_0x8591,0xd3));var _0x1859=function(_0x59cbcd,_0x21b978){_0x59cbcd=_0x59cbcd-0x0;var _0x226ca6=_0x8591[_0x59cbcd];return _0x226ca6;};'use strict';var _=require(_0x1859('0x0'));var util=require(_0x1859('0x1'));var logger=require(_0x1859('0x2'))(_0x1859('0x3'));var moment=require(_0x1859('0x4'));var BPromise=require(_0x1859('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1859('0x6'));var rimraf=require(_0x1859('0x7'));var config=require(_0x1859('0x8'));var attributes=require(_0x1859('0x9'));var integrations=require(_0x1859('0xa'));module['exports']=function(_0x50c823,_0x3efcdd){return _0x50c823[_0x1859('0xb')](_0x1859('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe756=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x19c64f,_0x2ae7d2){var _0x47bac7=function(_0x5a3fad){while(--_0x5a3fad){_0x19c64f['push'](_0x19c64f['shift']());}};_0x47bac7(++_0x2ae7d2);}(_0xe756,0x64));var _0x6e75=function(_0x17598a,_0x53b3c4){_0x17598a=_0x17598a-0x0;var _0x1d443e=_0xe756[_0x17598a];return _0x1d443e;};'use strict';var _=require(_0x6e75('0x0'));var util=require(_0x6e75('0x1'));var logger=require(_0x6e75('0x2'))(_0x6e75('0x3'));var moment=require('moment');var BPromise=require(_0x6e75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e75('0x5'));var rimraf=require(_0x6e75('0x6'));var config=require(_0x6e75('0x7'));var attributes=require(_0x6e75('0x8'));var integrations=require(_0x6e75('0x9'));module[_0x6e75('0xa')]=function(_0x2058bb,_0x23ca82){return _0x2058bb[_0x6e75('0xb')](_0x6e75('0xc'),attributes,{'tableName':_0x6e75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index a931b63..94e28fb 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 _0xb9be=['VtigerAccount','findAll','options','limit','include','map','model','attributes','ShowVtigerAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','GetVtigerAccount'];(function(_0x272a8d,_0x50cec4){var _0x251088=function(_0x2fe105){while(--_0x2fe105){_0x272a8d['push'](_0x272a8d['shift']());}};_0x251088(++_0x50cec4);}(_0xb9be,0xc5));var _0xeb9b=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xb9be[_0x22ffbf];return _0x360c17;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')]({'raw':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6['options']['where']||null:null,'attributes':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['attributes']||null:null,'limit':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1c')]||null:null,'include':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x46df93){return{'model':db[_0x46df93[_0xeb9b('0x1f')]],'as':_0x46df93['as'],'attributes':_0x46df93[_0xeb9b('0x20')],'include':_0x46df93[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x46df93[_0xeb9b('0x1d')],function(_0x434461){return{'model':db[_0x434461['model']],'as':_0x434461['as'],'attributes':_0x434461[_0xeb9b('0x20')],'include':_0x434461['include']?_[_0xeb9b('0x1e')](_0x434461['include'],function(_0x347ec1){return{'model':db[_0x347ec1[_0xeb9b('0x1f')]],'as':_0x347ec1['as'],'attributes':_0x347ec1[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb9b('0xd')](function(_0x52f6c1){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x52f6c1));_0x3cbe3e(_0x52f6c1);})['catch'](function(_0x2a4b51){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x2a4b51['message'],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x2a4b51['message']));});});};exports[_0xeb9b('0x21')]=function(_0x4c1331){var _0x411467=this;return new Promise(function(_0x54c659,_0x27578d){return db['VtigerAccount'][_0xeb9b('0x22')]({'raw':_0x4c1331['options']?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x23')]===undefined?!![]:![]:!![],'where':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x24')]||null:null,'attributes':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x20')]||null:null,'include':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')]['include']?_[_0xeb9b('0x1e')](_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x21ecfd){return{'model':db[_0x21ecfd[_0xeb9b('0x1f')]],'as':_0x21ecfd['as'],'attributes':_0x21ecfd[_0xeb9b('0x20')],'include':_0x21ecfd[_0xeb9b('0x1d')]?_['map'](_0x21ecfd[_0xeb9b('0x1d')],function(_0x2f3179){return{'model':db[_0x2f3179[_0xeb9b('0x1f')]],'as':_0x2f3179['as'],'attributes':_0x2f3179['attributes'],'include':_0x2f3179[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x2f3179[_0xeb9b('0x1d')],function(_0xab9ad5){return{'model':db[_0xab9ad5[_0xeb9b('0x1f')]],'as':_0xab9ad5['as'],'attributes':_0xab9ad5[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d235){logger[_0xeb9b('0xe')]('ShowVtigerAccount',_0x4c1331);logger[_0xeb9b('0x10')](_0xeb9b('0x21'),_0x4c1331,JSON[_0xeb9b('0x11')](_0x24d235));_0x54c659(_0x24d235);})[_0xeb9b('0x17')](function(_0x37c678){logger[_0xeb9b('0x12')](_0xeb9b('0x21'),_0x37c678['message'],_0x4c1331);_0x27578d(_0x411467[_0xeb9b('0x12')](0x1f4,_0x37c678[_0xeb9b('0x16')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll'];(function(_0x47780f,_0x195712){var _0x3da085=function(_0x51c253){while(--_0x51c253){_0x47780f['push'](_0x47780f['shift']());}};_0x3da085(++_0x195712);}(_0xe706,0xa3));var _0x6e70=function(_0x230dd3,_0x26024b){_0x230dd3=_0x230dd3-0x0;var _0x7987fa=_0xe706[_0x230dd3];return _0x7987fa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['VtigerAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetVtigerAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9c070a6..6629bee 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 _0x42ce=['getDescriptions','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x42ce,0x6e));var _0xe42c=function(_0x2344d7,_0x1fe3c6){_0x2344d7=_0x2344d7-0x0;var _0x3e738c=_0x42ce[_0x2344d7];return _0x3e738c;};'use strict';var multer=require(_0xe42c('0x0'));var util=require('util');var path=require(_0xe42c('0x1'));var timeout=require(_0xe42c('0x2'));var express=require(_0xe42c('0x3'));var router=express[_0xe42c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe42c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe42c('0x6'));var controller=require(_0xe42c('0x7'));router[_0xe42c('0x8')]('/',auth[_0xe42c('0x9')](),controller[_0xe42c('0xa')]);router[_0xe42c('0x8')](_0xe42c('0xb'),auth[_0xe42c('0x9')](),controller[_0xe42c('0xc')]);router[_0xe42c('0x8')]('/:id/fields',auth[_0xe42c('0x9')](),controller['getFields']);router['get'](_0xe42c('0xd'),auth[_0xe42c('0x9')](),controller[_0xe42c('0xe')]);router[_0xe42c('0x8')](_0xe42c('0xf'),auth[_0xe42c('0x9')](),controller[_0xe42c('0x10')]);router['post']('/',auth[_0xe42c('0x9')](),controller[_0xe42c('0x11')]);router[_0xe42c('0x12')](_0xe42c('0xb'),auth[_0xe42c('0x9')](),controller[_0xe42c('0x13')]);router[_0xe42c('0x14')](_0xe42c('0xb'),auth[_0xe42c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfed4=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports'];(function(_0x161741,_0x209d32){var _0xd2bc3f=function(_0x34d730){while(--_0x34d730){_0x161741['push'](_0x161741['shift']());}};_0xd2bc3f(++_0x209d32);}(_0xfed4,0x1a2));var _0x4fed=function(_0x4c7c84,_0x7a0d5b){_0x4c7c84=_0x4c7c84-0x0;var _0x47579b=_0xfed4[_0x4c7c84];return _0x47579b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4fed('0x0'));var timeout=require(_0x4fed('0x1'));var express=require('express');var router=express[_0x4fed('0x2')]();var fs_extra=require(_0x4fed('0x3'));var auth=require(_0x4fed('0x4'));var interaction=require(_0x4fed('0x5'));var config=require(_0x4fed('0x6'));var controller=require(_0x4fed('0x7'));router[_0x4fed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4fed('0x9'),auth[_0x4fed('0xa')](),controller[_0x4fed('0xb')]);router['get'](_0x4fed('0xc'),auth[_0x4fed('0xa')](),controller[_0x4fed('0xd')]);router[_0x4fed('0x8')]('/:id/subjects',auth[_0x4fed('0xa')](),controller[_0x4fed('0xe')]);router[_0x4fed('0x8')](_0x4fed('0xf'),auth[_0x4fed('0xa')](),controller[_0x4fed('0x10')]);router['post']('/',auth[_0x4fed('0xa')](),controller['create']);router[_0x4fed('0x11')](_0x4fed('0x9'),auth[_0x4fed('0xa')](),controller[_0x4fed('0x12')]);router[_0x4fed('0x13')](_0x4fed('0x9'),auth['isAuthenticated'](),controller[_0x4fed('0x14')]);module[_0x4fed('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0d035da..eb901c6 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 _0x1dd4=['STRING','sequelize','exports'];(function(_0x3800d3,_0x428dfd){var _0x491c71=function(_0x55a174){while(--_0x55a174){_0x3800d3['push'](_0x3800d3['shift']());}};_0x491c71(++_0x428dfd);}(_0x1dd4,0x7c));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41dd('0x0'));module[_0x41dd('0x1')]={'name':{'type':Sequelize[_0x41dd('0x2')]},'description':{'type':Sequelize[_0x41dd('0x2')]}}; \ No newline at end of file +var _0x7273=['sequelize','exports'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x7273,0x9a));var _0x3727=function(_0x578af0,_0x393418){_0x578af0=_0x578af0-0x0;var _0x2916b7=_0x7273[_0x578af0];return _0x2916b7;};'use strict';var Sequelize=require(_0x3727('0x0'));module[_0x3727('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1096908..7fdf88a 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 _0x5d06=['merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','getFields','VtigerField','getSubjects','findOne','getDescriptions','pick','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','fieldName','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x268e38,_0x27ae6b){var _0x3f3165=function(_0xd98cce){while(--_0xd98cce){_0x268e38['push'](_0x268e38['shift']());}};_0x3f3165(++_0x27ae6b);}(_0x5d06,0xb3));var _0x65d0=function(_0x73129a,_0x2e96dd){_0x73129a=_0x73129a-0x0;var _0x501e94=_0x5d06[_0x73129a];return _0x501e94;};'use strict';var emlformat=require(_0x65d0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x65d0('0x1'));var rp=require(_0x65d0('0x2'));var moment=require(_0x65d0('0x3'));var BPromise=require(_0x65d0('0x4'));var Mustache=require(_0x65d0('0x5'));var util=require(_0x65d0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x65d0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65d0('0x8'));var _=require(_0x65d0('0x9'));var squel=require(_0x65d0('0xa'));var crypto=require(_0x65d0('0xb'));var jsforce=require(_0x65d0('0xc'));var deskjs=require(_0x65d0('0xd'));var toCsv=require(_0x65d0('0x7'));var querystring=require('querystring');var Papa=require(_0x65d0('0xe'));var Redis=require(_0x65d0('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d0('0x10'))(_0x65d0('0x11'));var utils=require(_0x65d0('0x12'));var config=require(_0x65d0('0x13'));var licenseUtil=require(_0x65d0('0x14'));var db=require(_0x65d0('0x15'))['db'];function respondWithStatusCode(_0x326df0,_0x5f29d8){_0x5f29d8=_0x5f29d8||0xcc;return function(_0x61e773){if(_0x61e773){return _0x326df0['sendStatus'](_0x5f29d8);}return _0x326df0[_0x65d0('0x16')](_0x5f29d8)[_0x65d0('0x17')]();};}function respondWithResult(_0x455986,_0x4c11e3){_0x4c11e3=_0x4c11e3||0xc8;return function(_0x401cef){if(_0x401cef){return _0x455986['status'](_0x4c11e3)[_0x65d0('0x18')](_0x401cef);}};}function respondWithFilteredResult(_0x3fcc91,_0x233f81){return function(_0xcd94ca){if(_0xcd94ca){var _0x230baf=typeof _0x233f81[_0x65d0('0x19')]===_0x65d0('0x1a')&&typeof _0x233f81[_0x65d0('0x1b')]===_0x65d0('0x1a');var _0x2ec5d1=_0xcd94ca[_0x65d0('0x1c')];var _0x117633=_0x230baf?0x0:_0x233f81[_0x65d0('0x19')];var _0x42c2dc=_0x230baf?_0xcd94ca[_0x65d0('0x1c')]:_0x233f81[_0x65d0('0x19')]+_0x233f81[_0x65d0('0x1b')];var _0x57a4e9;if(_0x42c2dc>=_0x2ec5d1){_0x42c2dc=_0x2ec5d1;_0x57a4e9=0xc8;}else{_0x57a4e9=0xce;}_0x3fcc91['status'](_0x57a4e9);return _0x3fcc91['set'](_0x65d0('0x1d'),_0x117633+'-'+_0x42c2dc+'/'+_0x2ec5d1)[_0x65d0('0x18')](_0xcd94ca);}return null;};}function patchUpdates(_0x2f7b04){return function(_0x511c68){try{jsonpatch['apply'](_0x511c68,_0x2f7b04,!![]);}catch(_0x3fa893){return BPromise[_0x65d0('0x1e')](_0x3fa893);}return _0x511c68[_0x65d0('0x1f')]();};}function saveUpdates(_0x38f671,_0x44e7f8){return function(_0x30f105){if(_0x30f105){return _0x30f105['update'](_0x38f671)[_0x65d0('0x20')](function(_0x1438f7){return _0x1438f7;});}return null;};}function removeEntity(_0x3b3b45,_0x176057){return function(_0x15207e){if(_0x15207e){return _0x15207e[_0x65d0('0x21')]()[_0x65d0('0x20')](function(){_0x3b3b45[_0x65d0('0x16')](0xcc)[_0x65d0('0x17')]();});}};}function handleEntityNotFound(_0x366fe0,_0x13f681){return function(_0x3cafe4){if(!_0x3cafe4){_0x366fe0[_0x65d0('0x22')](0x194);}return _0x3cafe4;};}function handleError(_0x141172,_0xd2cf12){_0xd2cf12=_0xd2cf12||0x1f4;return function(_0x1293ae){logger[_0x65d0('0x23')](_0x1293ae[_0x65d0('0x24')]);if(_0x1293ae['name']){delete _0x1293ae[_0x65d0('0x25')];}_0x141172[_0x65d0('0x16')](_0xd2cf12)[_0x65d0('0x26')](_0x1293ae);};}exports[_0x65d0('0x27')]=function(_0x952d7e,_0x391447){var _0x51a898={},_0x7fa78f={},_0x2c32cd={'count':0x0,'rows':[]};var _0x3e7d62=_[_0x65d0('0x28')](db[_0x65d0('0x29')]['rawAttributes'],function(_0x3ad594){return{'name':_0x3ad594[_0x65d0('0x2a')],'type':_0x3ad594['type'][_0x65d0('0x2b')]};});_0x7fa78f['model']=_[_0x65d0('0x28')](_0x3e7d62,_0x65d0('0x25'));_0x7fa78f[_0x65d0('0x2c')]=_[_0x65d0('0x2d')](_0x952d7e[_0x65d0('0x2c')]);_0x7fa78f[_0x65d0('0x2e')]=_['intersection'](_0x7fa78f['model'],_0x7fa78f[_0x65d0('0x2c')]);_0x51a898[_0x65d0('0x2f')]=_[_0x65d0('0x30')](_0x7fa78f['model'],qs[_0x65d0('0x31')](_0x952d7e[_0x65d0('0x2c')]['fields']));_0x51a898[_0x65d0('0x2f')]=_0x51a898['attributes'][_0x65d0('0x32')]?_0x51a898[_0x65d0('0x2f')]:_0x7fa78f[_0x65d0('0x33')];if(!_0x952d7e[_0x65d0('0x2c')][_0x65d0('0x34')](_0x65d0('0x35'))){_0x51a898['limit']=qs[_0x65d0('0x1b')](_0x952d7e['query'][_0x65d0('0x1b')]);_0x51a898[_0x65d0('0x19')]=qs[_0x65d0('0x19')](_0x952d7e['query'][_0x65d0('0x19')]);}_0x51a898[_0x65d0('0x36')]=qs[_0x65d0('0x37')](_0x952d7e['query'][_0x65d0('0x37')]);_0x51a898[_0x65d0('0x38')]=qs[_0x65d0('0x2e')](_['pick'](_0x952d7e[_0x65d0('0x2c')],_0x7fa78f['filters']),_0x3e7d62);if(_0x952d7e[_0x65d0('0x2c')][_0x65d0('0x39')]){_0x51a898[_0x65d0('0x38')]=_[_0x65d0('0x3a')](_0x51a898[_0x65d0('0x38')],{'$or':_[_0x65d0('0x28')](_0x3e7d62,function(_0xa149f9){if(_0xa149f9[_0x65d0('0x3b')]!==_0x65d0('0x3c')){var _0x58b159={};_0x58b159[_0xa149f9[_0x65d0('0x25')]]={'$like':'%'+_0x952d7e['query'][_0x65d0('0x39')]+'%'};return _0x58b159;}})});}_0x51a898=_['merge']({},_0x51a898,_0x952d7e[_0x65d0('0x3d')]);var _0x3e65e6={'where':_0x51a898[_0x65d0('0x38')]};return db[_0x65d0('0x29')][_0x65d0('0x1c')](_0x3e65e6)['then'](function(_0x3eeeaa){_0x2c32cd['count']=_0x3eeeaa;if(_0x952d7e[_0x65d0('0x2c')][_0x65d0('0x3e')]){_0x51a898[_0x65d0('0x3f')]=[{'all':!![]}];}return db[_0x65d0('0x29')][_0x65d0('0x40')](_0x51a898);})[_0x65d0('0x20')](function(_0x2a164a){_0x2c32cd[_0x65d0('0x41')]=_0x2a164a;return _0x2c32cd;})[_0x65d0('0x20')](respondWithFilteredResult(_0x391447,_0x51a898))[_0x65d0('0x42')](handleError(_0x391447,null));};exports['show']=function(_0x1b7218,_0x1b277b){var _0x47eff4={'raw':![],'where':{'id':_0x1b7218[_0x65d0('0x43')]['id']}},_0x283b62={};_0x283b62[_0x65d0('0x33')]=_[_0x65d0('0x2d')](db[_0x65d0('0x29')][_0x65d0('0x44')]);_0x283b62['query']=_[_0x65d0('0x2d')](_0x1b7218[_0x65d0('0x2c')]);_0x283b62['filters']=_['intersection'](_0x283b62[_0x65d0('0x33')],_0x283b62['query']);_0x47eff4['attributes']=_[_0x65d0('0x30')](_0x283b62[_0x65d0('0x33')],qs[_0x65d0('0x31')](_0x1b7218['query'][_0x65d0('0x31')]));_0x47eff4[_0x65d0('0x2f')]=_0x47eff4[_0x65d0('0x2f')][_0x65d0('0x32')]?_0x47eff4[_0x65d0('0x2f')]:_0x283b62[_0x65d0('0x33')];if(_0x1b7218[_0x65d0('0x2c')][_0x65d0('0x3e')]){_0x47eff4[_0x65d0('0x3f')]=[{'all':!![]}];}_0x47eff4=_[_0x65d0('0x3a')]({},_0x47eff4,_0x1b7218[_0x65d0('0x3d')]);return db[_0x65d0('0x29')][_0x65d0('0x45')](_0x47eff4)[_0x65d0('0x20')](handleEntityNotFound(_0x1b277b,null))[_0x65d0('0x20')](respondWithResult(_0x1b277b,null))[_0x65d0('0x42')](handleError(_0x1b277b,null));};exports[_0x65d0('0x46')]=function(_0x4e62e5,_0x192b5d){return db['VtigerConfiguration'][_0x65d0('0x46')](_0x4e62e5[_0x65d0('0x47')],{})['then'](respondWithResult(_0x192b5d,0xc9))[_0x65d0('0x42')](handleError(_0x192b5d,null));};exports[_0x65d0('0x48')]=function(_0x154397,_0x3f0236){if(_0x154397[_0x65d0('0x47')]['id']){delete _0x154397[_0x65d0('0x47')]['id'];}return db[_0x65d0('0x29')][_0x65d0('0x45')]({'where':{'id':_0x154397[_0x65d0('0x43')]['id']}})[_0x65d0('0x20')](handleEntityNotFound(_0x3f0236,null))[_0x65d0('0x20')](saveUpdates(_0x154397[_0x65d0('0x47')],null))[_0x65d0('0x20')](respondWithResult(_0x3f0236,null))['catch'](handleError(_0x3f0236,null));};exports['destroy']=function(_0x2968d1,_0x59c8ed){return db[_0x65d0('0x29')][_0x65d0('0x45')]({'where':{'id':_0x2968d1[_0x65d0('0x43')]['id']}})[_0x65d0('0x20')](handleEntityNotFound(_0x59c8ed,null))[_0x65d0('0x20')](removeEntity(_0x59c8ed,null))[_0x65d0('0x42')](handleError(_0x59c8ed,null));};exports[_0x65d0('0x49')]=function(_0x4b531b,_0x4a25c4,_0xaab1b4){var _0x572859={};var _0x5365a6={};var _0xf2e349;var _0x6fe089;return db[_0x65d0('0x29')]['findOne']({'where':{'id':_0x4b531b[_0x65d0('0x43')]['id']}})[_0x65d0('0x20')](handleEntityNotFound(_0x4a25c4,null))[_0x65d0('0x20')](function(_0x44c212){if(_0x44c212){_0xf2e349=_0x44c212;_0x5365a6[_0x65d0('0x33')]=_['keys'](db[_0x65d0('0x4a')][_0x65d0('0x44')]);_0x5365a6[_0x65d0('0x2c')]=_[_0x65d0('0x2d')](_0x4b531b[_0x65d0('0x2c')]);_0x5365a6[_0x65d0('0x2e')]=_[_0x65d0('0x30')](_0x5365a6[_0x65d0('0x33')],_0x5365a6[_0x65d0('0x2c')]);_0x572859['attributes']=_[_0x65d0('0x30')](_0x5365a6[_0x65d0('0x33')],qs[_0x65d0('0x31')](_0x4b531b['query'][_0x65d0('0x31')]));_0x572859[_0x65d0('0x2f')]=_0x572859[_0x65d0('0x2f')][_0x65d0('0x32')]?_0x572859[_0x65d0('0x2f')]:_0x5365a6['model'];_0x572859[_0x65d0('0x36')]=qs[_0x65d0('0x37')](_0x4b531b['query'][_0x65d0('0x37')]);_0x572859[_0x65d0('0x38')]=qs['filters'](_['pick'](_0x4b531b[_0x65d0('0x2c')],_0x5365a6[_0x65d0('0x2e')]));if(_0x4b531b['query'][_0x65d0('0x39')]){_0x572859[_0x65d0('0x38')]=_[_0x65d0('0x3a')](_0x572859[_0x65d0('0x38')],{'$or':_[_0x65d0('0x28')](_0x572859['attributes'],function(_0x353884){var _0xd68d69={};_0xd68d69[_0x353884]={'$like':'%'+_0x4b531b[_0x65d0('0x2c')][_0x65d0('0x39')]+'%'};return _0xd68d69;})});}_0x572859=_[_0x65d0('0x3a')]({},_0x572859,_0x4b531b['options']);return _0xf2e349[_0x65d0('0x49')](_0x572859);}})[_0x65d0('0x20')](function(_0x46ca55){if(_0x46ca55){_0x6fe089=_0x46ca55[_0x65d0('0x32')];if(!_0x4b531b[_0x65d0('0x2c')][_0x65d0('0x34')](_0x65d0('0x35'))){_0x572859['limit']=qs[_0x65d0('0x1b')](_0x4b531b[_0x65d0('0x2c')][_0x65d0('0x1b')]);_0x572859[_0x65d0('0x19')]=qs[_0x65d0('0x19')](_0x4b531b['query'][_0x65d0('0x19')]);}return _0xf2e349['getFields'](_0x572859);}})[_0x65d0('0x20')](function(_0x5caf06){if(_0x5caf06){return _0x5caf06?{'count':_0x6fe089,'rows':_0x5caf06}:null;}})[_0x65d0('0x20')](respondWithResult(_0x4a25c4,null))[_0x65d0('0x42')](handleError(_0x4a25c4,null));};exports[_0x65d0('0x4b')]=function(_0x30e2bd,_0x54a4e0,_0x1dbfab){var _0x597638={};var _0x423c28={};var _0x25c573;var _0x3062a3;return db[_0x65d0('0x29')][_0x65d0('0x4c')]({'where':{'id':_0x30e2bd[_0x65d0('0x43')]['id']}})[_0x65d0('0x20')](handleEntityNotFound(_0x54a4e0,null))[_0x65d0('0x20')](function(_0x5beaae){if(_0x5beaae){_0x25c573=_0x5beaae;_0x423c28['model']=_[_0x65d0('0x2d')](db[_0x65d0('0x4a')][_0x65d0('0x44')]);_0x423c28[_0x65d0('0x2c')]=_['keys'](_0x30e2bd[_0x65d0('0x2c')]);_0x423c28[_0x65d0('0x2e')]=_[_0x65d0('0x30')](_0x423c28[_0x65d0('0x33')],_0x423c28[_0x65d0('0x2c')]);_0x597638[_0x65d0('0x2f')]=_[_0x65d0('0x30')](_0x423c28[_0x65d0('0x33')],qs[_0x65d0('0x31')](_0x30e2bd[_0x65d0('0x2c')]['fields']));_0x597638['attributes']=_0x597638[_0x65d0('0x2f')][_0x65d0('0x32')]?_0x597638['attributes']:_0x423c28[_0x65d0('0x33')];_0x597638[_0x65d0('0x36')]=qs[_0x65d0('0x37')](_0x30e2bd[_0x65d0('0x2c')]['sort']);_0x597638[_0x65d0('0x38')]=qs[_0x65d0('0x2e')](_['pick'](_0x30e2bd[_0x65d0('0x2c')],_0x423c28[_0x65d0('0x2e')]));if(_0x30e2bd[_0x65d0('0x2c')][_0x65d0('0x39')]){_0x597638[_0x65d0('0x38')]=_[_0x65d0('0x3a')](_0x597638['where'],{'$or':_[_0x65d0('0x28')](_0x597638[_0x65d0('0x2f')],function(_0x3aac36){var _0x11b8a3={};_0x11b8a3[_0x3aac36]={'$like':'%'+_0x30e2bd[_0x65d0('0x2c')][_0x65d0('0x39')]+'%'};return _0x11b8a3;})});}_0x597638=_['merge']({},_0x597638,_0x30e2bd[_0x65d0('0x3d')]);return _0x25c573['getSubjects'](_0x597638);}})[_0x65d0('0x20')](function(_0x545f99){if(_0x545f99){_0x3062a3=_0x545f99[_0x65d0('0x32')];if(!_0x30e2bd[_0x65d0('0x2c')][_0x65d0('0x34')]('nolimit')){_0x597638[_0x65d0('0x1b')]=qs[_0x65d0('0x1b')](_0x30e2bd['query'][_0x65d0('0x1b')]);_0x597638[_0x65d0('0x19')]=qs[_0x65d0('0x19')](_0x30e2bd[_0x65d0('0x2c')][_0x65d0('0x19')]);}return _0x25c573[_0x65d0('0x4b')](_0x597638);}})[_0x65d0('0x20')](function(_0x55b0a0){if(_0x55b0a0){return _0x55b0a0?{'count':_0x3062a3,'rows':_0x55b0a0}:null;}})[_0x65d0('0x20')](respondWithResult(_0x54a4e0,null))[_0x65d0('0x42')](handleError(_0x54a4e0,null));};exports[_0x65d0('0x4d')]=function(_0x4e953c,_0x38f851,_0x3b028b){var _0x4005c4={};var _0x52efcf={};var _0x2231be;var _0x9f09a4;return db[_0x65d0('0x29')][_0x65d0('0x4c')]({'where':{'id':_0x4e953c[_0x65d0('0x43')]['id']}})[_0x65d0('0x20')](handleEntityNotFound(_0x38f851,null))['then'](function(_0x51d4b5){if(_0x51d4b5){_0x2231be=_0x51d4b5;_0x52efcf[_0x65d0('0x33')]=_[_0x65d0('0x2d')](db['VtigerField']['rawAttributes']);_0x52efcf[_0x65d0('0x2c')]=_['keys'](_0x4e953c[_0x65d0('0x2c')]);_0x52efcf['filters']=_[_0x65d0('0x30')](_0x52efcf[_0x65d0('0x33')],_0x52efcf[_0x65d0('0x2c')]);_0x4005c4[_0x65d0('0x2f')]=_[_0x65d0('0x30')](_0x52efcf['model'],qs['fields'](_0x4e953c[_0x65d0('0x2c')]['fields']));_0x4005c4[_0x65d0('0x2f')]=_0x4005c4[_0x65d0('0x2f')]['length']?_0x4005c4[_0x65d0('0x2f')]:_0x52efcf['model'];_0x4005c4[_0x65d0('0x36')]=qs[_0x65d0('0x37')](_0x4e953c[_0x65d0('0x2c')][_0x65d0('0x37')]);_0x4005c4['where']=qs['filters'](_[_0x65d0('0x4e')](_0x4e953c['query'],_0x52efcf[_0x65d0('0x2e')]));if(_0x4e953c[_0x65d0('0x2c')][_0x65d0('0x39')]){_0x4005c4[_0x65d0('0x38')]=_[_0x65d0('0x3a')](_0x4005c4[_0x65d0('0x38')],{'$or':_[_0x65d0('0x28')](_0x4005c4['attributes'],function(_0x4d101e){var _0x3c71ad={};_0x3c71ad[_0x4d101e]={'$like':'%'+_0x4e953c['query'][_0x65d0('0x39')]+'%'};return _0x3c71ad;})});}_0x4005c4=_['merge']({},_0x4005c4,_0x4e953c[_0x65d0('0x3d')]);return _0x2231be[_0x65d0('0x4d')](_0x4005c4);}})[_0x65d0('0x20')](function(_0x379a2e){if(_0x379a2e){_0x9f09a4=_0x379a2e['length'];if(!_0x4e953c[_0x65d0('0x2c')][_0x65d0('0x34')](_0x65d0('0x35'))){_0x4005c4[_0x65d0('0x1b')]=qs[_0x65d0('0x1b')](_0x4e953c[_0x65d0('0x2c')][_0x65d0('0x1b')]);_0x4005c4[_0x65d0('0x19')]=qs[_0x65d0('0x19')](_0x4e953c[_0x65d0('0x2c')][_0x65d0('0x19')]);}return _0x2231be['getDescriptions'](_0x4005c4);}})[_0x65d0('0x20')](function(_0xe808e6){if(_0xe808e6){return _0xe808e6?{'count':_0x9f09a4,'rows':_0xe808e6}:null;}})['then'](respondWithResult(_0x38f851,null))[_0x65d0('0x42')](handleError(_0x38f851,null));}; \ No newline at end of file +var _0xcc5f=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','reject','save','then','sendStatus','error','name','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','include','rows','catch','show','keys','includeAll','options','create','body','update','find','params','destroy','getFields','getSubjects','findOne','VtigerField','getDescriptions','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xcc5f,0xd7));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcc5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc5('0x1'));var rp=require('request-promise');var moment=require(_0xfcc5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfcc5('0x3'));var util=require(_0xfcc5('0x4'));var path=require(_0xfcc5('0x5'));var sox=require(_0xfcc5('0x6'));var csv=require(_0xfcc5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcc5('0x8'));var squel=require(_0xfcc5('0x9'));var crypto=require(_0xfcc5('0xa'));var jsforce=require(_0xfcc5('0xb'));var deskjs=require(_0xfcc5('0xc'));var toCsv=require(_0xfcc5('0x7'));var querystring=require(_0xfcc5('0xd'));var Papa=require(_0xfcc5('0xe'));var Redis=require('ioredis');var authService=require(_0xfcc5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfcc5('0x10'));var hardwareService=require(_0xfcc5('0x11'));var logger=require(_0xfcc5('0x12'))(_0xfcc5('0x13'));var utils=require(_0xfcc5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfcc5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a53b0,_0x4ae48f){_0x4ae48f=_0x4ae48f||0xcc;return function(_0x60449d){if(_0x60449d){return _0x3a53b0['sendStatus'](_0x4ae48f);}return _0x3a53b0[_0xfcc5('0x16')](_0x4ae48f)[_0xfcc5('0x17')]();};}function respondWithResult(_0x11e4db,_0x211d02){_0x211d02=_0x211d02||0xc8;return function(_0x2aa294){if(_0x2aa294){return _0x11e4db[_0xfcc5('0x16')](_0x211d02)[_0xfcc5('0x18')](_0x2aa294);}};}function respondWithFilteredResult(_0x21d522,_0x2b8066){return function(_0x2fa7aa){if(_0x2fa7aa){var _0x48d6a9=typeof _0x2b8066['offset']===_0xfcc5('0x19')&&typeof _0x2b8066['limit']===_0xfcc5('0x19');var _0x1fe2e2=_0x2fa7aa[_0xfcc5('0x1a')];var _0x56ec08=_0x48d6a9?0x0:_0x2b8066['offset'];var _0x4542ef=_0x48d6a9?_0x2fa7aa[_0xfcc5('0x1a')]:_0x2b8066[_0xfcc5('0x1b')]+_0x2b8066[_0xfcc5('0x1c')];var _0x504845;if(_0x4542ef>=_0x1fe2e2){_0x4542ef=_0x1fe2e2;_0x504845=0xc8;}else{_0x504845=0xce;}_0x21d522[_0xfcc5('0x16')](_0x504845);return _0x21d522[_0xfcc5('0x1d')]('Content-Range',_0x56ec08+'-'+_0x4542ef+'/'+_0x1fe2e2)[_0xfcc5('0x18')](_0x2fa7aa);}return null;};}function patchUpdates(_0x2d62f2){return function(_0x32b3d5){try{jsonpatch['apply'](_0x32b3d5,_0x2d62f2,!![]);}catch(_0x1ac21f){return BPromise[_0xfcc5('0x1e')](_0x1ac21f);}return _0x32b3d5[_0xfcc5('0x1f')]();};}function saveUpdates(_0xbe35b4,_0xb44f3b){return function(_0x48015c){if(_0x48015c){return _0x48015c['update'](_0xbe35b4)[_0xfcc5('0x20')](function(_0x5bcda4){return _0x5bcda4;});}return null;};}function removeEntity(_0xae2ea0,_0x50fb73){return function(_0x17dffb){if(_0x17dffb){return _0x17dffb['destroy']()[_0xfcc5('0x20')](function(){_0xae2ea0[_0xfcc5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6de2e,_0x14940c){return function(_0x3af47a){if(!_0x3af47a){_0xa6de2e[_0xfcc5('0x21')](0x194);}return _0x3af47a;};}function handleError(_0x1b872b,_0x4e39f1){_0x4e39f1=_0x4e39f1||0x1f4;return function(_0x2221a3){logger[_0xfcc5('0x22')](_0x2221a3['stack']);if(_0x2221a3[_0xfcc5('0x23')]){delete _0x2221a3[_0xfcc5('0x23')];}_0x1b872b[_0xfcc5('0x16')](_0x4e39f1)['send'](_0x2221a3);};}exports['index']=function(_0xb0f2bf,_0x200b76){var _0x91dc0d={},_0x2a6393={},_0x251170={'count':0x0,'rows':[]};var _0x51089c=_['map'](db[_0xfcc5('0x24')][_0xfcc5('0x25')],function(_0x3ae62c){return{'name':_0x3ae62c[_0xfcc5('0x26')],'type':_0x3ae62c[_0xfcc5('0x27')][_0xfcc5('0x28')]};});_0x2a6393[_0xfcc5('0x29')]=_[_0xfcc5('0x2a')](_0x51089c,_0xfcc5('0x23'));_0x2a6393['query']=_['keys'](_0xb0f2bf[_0xfcc5('0x2b')]);_0x2a6393['filters']=_[_0xfcc5('0x2c')](_0x2a6393[_0xfcc5('0x29')],_0x2a6393[_0xfcc5('0x2b')]);_0x91dc0d[_0xfcc5('0x2d')]=_[_0xfcc5('0x2c')](_0x2a6393[_0xfcc5('0x29')],qs['fields'](_0xb0f2bf['query'][_0xfcc5('0x2e')]));_0x91dc0d[_0xfcc5('0x2d')]=_0x91dc0d[_0xfcc5('0x2d')][_0xfcc5('0x2f')]?_0x91dc0d[_0xfcc5('0x2d')]:_0x2a6393[_0xfcc5('0x29')];if(!_0xb0f2bf[_0xfcc5('0x2b')][_0xfcc5('0x30')](_0xfcc5('0x31'))){_0x91dc0d[_0xfcc5('0x1c')]=qs[_0xfcc5('0x1c')](_0xb0f2bf[_0xfcc5('0x2b')]['limit']);_0x91dc0d[_0xfcc5('0x1b')]=qs[_0xfcc5('0x1b')](_0xb0f2bf['query'][_0xfcc5('0x1b')]);}_0x91dc0d[_0xfcc5('0x32')]=qs[_0xfcc5('0x33')](_0xb0f2bf['query'][_0xfcc5('0x33')]);_0x91dc0d[_0xfcc5('0x34')]=qs[_0xfcc5('0x35')](_[_0xfcc5('0x36')](_0xb0f2bf[_0xfcc5('0x2b')],_0x2a6393['filters']),_0x51089c);if(_0xb0f2bf[_0xfcc5('0x2b')][_0xfcc5('0x37')]){_0x91dc0d[_0xfcc5('0x34')]=_[_0xfcc5('0x38')](_0x91dc0d[_0xfcc5('0x34')],{'$or':_[_0xfcc5('0x2a')](_0x51089c,function(_0x326aab){if(_0x326aab[_0xfcc5('0x27')]!=='VIRTUAL'){var _0x5ba131={};_0x5ba131[_0x326aab[_0xfcc5('0x23')]]={'$like':'%'+_0xb0f2bf[_0xfcc5('0x2b')][_0xfcc5('0x37')]+'%'};return _0x5ba131;}})});}_0x91dc0d=_[_0xfcc5('0x38')]({},_0x91dc0d,_0xb0f2bf['options']);var _0xee8294={'where':_0x91dc0d[_0xfcc5('0x34')]};return db[_0xfcc5('0x24')][_0xfcc5('0x1a')](_0xee8294)[_0xfcc5('0x20')](function(_0x161fb8){_0x251170[_0xfcc5('0x1a')]=_0x161fb8;if(_0xb0f2bf[_0xfcc5('0x2b')]['includeAll']){_0x91dc0d[_0xfcc5('0x39')]=[{'all':!![]}];}return db[_0xfcc5('0x24')]['findAll'](_0x91dc0d);})['then'](function(_0xbb9167){_0x251170[_0xfcc5('0x3a')]=_0xbb9167;return _0x251170;})[_0xfcc5('0x20')](respondWithFilteredResult(_0x200b76,_0x91dc0d))[_0xfcc5('0x3b')](handleError(_0x200b76,null));};exports[_0xfcc5('0x3c')]=function(_0x4eb9fb,_0x1802af){var _0x55d64c={'raw':![],'where':{'id':_0x4eb9fb['params']['id']}},_0x1bf54d={};_0x1bf54d['model']=_[_0xfcc5('0x3d')](db[_0xfcc5('0x24')][_0xfcc5('0x25')]);_0x1bf54d[_0xfcc5('0x2b')]=_[_0xfcc5('0x3d')](_0x4eb9fb[_0xfcc5('0x2b')]);_0x1bf54d[_0xfcc5('0x35')]=_[_0xfcc5('0x2c')](_0x1bf54d[_0xfcc5('0x29')],_0x1bf54d[_0xfcc5('0x2b')]);_0x55d64c[_0xfcc5('0x2d')]=_['intersection'](_0x1bf54d[_0xfcc5('0x29')],qs[_0xfcc5('0x2e')](_0x4eb9fb[_0xfcc5('0x2b')]['fields']));_0x55d64c[_0xfcc5('0x2d')]=_0x55d64c['attributes'][_0xfcc5('0x2f')]?_0x55d64c['attributes']:_0x1bf54d['model'];if(_0x4eb9fb[_0xfcc5('0x2b')][_0xfcc5('0x3e')]){_0x55d64c[_0xfcc5('0x39')]=[{'all':!![]}];}_0x55d64c=_[_0xfcc5('0x38')]({},_0x55d64c,_0x4eb9fb[_0xfcc5('0x3f')]);return db[_0xfcc5('0x24')]['find'](_0x55d64c)[_0xfcc5('0x20')](handleEntityNotFound(_0x1802af,null))['then'](respondWithResult(_0x1802af,null))['catch'](handleError(_0x1802af,null));};exports[_0xfcc5('0x40')]=function(_0x3f0d7b,_0x2ac50){return db[_0xfcc5('0x24')][_0xfcc5('0x40')](_0x3f0d7b[_0xfcc5('0x41')],{})[_0xfcc5('0x20')](respondWithResult(_0x2ac50,0xc9))[_0xfcc5('0x3b')](handleError(_0x2ac50,null));};exports[_0xfcc5('0x42')]=function(_0x125fc0,_0x2bd9d4){if(_0x125fc0[_0xfcc5('0x41')]['id']){delete _0x125fc0[_0xfcc5('0x41')]['id'];}return db['VtigerConfiguration'][_0xfcc5('0x43')]({'where':{'id':_0x125fc0[_0xfcc5('0x44')]['id']}})[_0xfcc5('0x20')](handleEntityNotFound(_0x2bd9d4,null))[_0xfcc5('0x20')](saveUpdates(_0x125fc0[_0xfcc5('0x41')],null))[_0xfcc5('0x20')](respondWithResult(_0x2bd9d4,null))['catch'](handleError(_0x2bd9d4,null));};exports[_0xfcc5('0x45')]=function(_0x113a27,_0x421cf7){return db[_0xfcc5('0x24')][_0xfcc5('0x43')]({'where':{'id':_0x113a27[_0xfcc5('0x44')]['id']}})[_0xfcc5('0x20')](handleEntityNotFound(_0x421cf7,null))[_0xfcc5('0x20')](removeEntity(_0x421cf7,null))[_0xfcc5('0x3b')](handleError(_0x421cf7,null));};exports[_0xfcc5('0x46')]=function(_0x1e4ac6,_0x488c87,_0x2bafc8){var _0x4902f3={};var _0x2c948f={};var _0x5ac3e1;var _0x53af4b;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1e4ac6['params']['id']}})[_0xfcc5('0x20')](handleEntityNotFound(_0x488c87,null))['then'](function(_0x678567){if(_0x678567){_0x5ac3e1=_0x678567;_0x2c948f[_0xfcc5('0x29')]=_[_0xfcc5('0x3d')](db['VtigerField'][_0xfcc5('0x25')]);_0x2c948f[_0xfcc5('0x2b')]=_['keys'](_0x1e4ac6[_0xfcc5('0x2b')]);_0x2c948f[_0xfcc5('0x35')]=_[_0xfcc5('0x2c')](_0x2c948f[_0xfcc5('0x29')],_0x2c948f[_0xfcc5('0x2b')]);_0x4902f3['attributes']=_['intersection'](_0x2c948f[_0xfcc5('0x29')],qs[_0xfcc5('0x2e')](_0x1e4ac6[_0xfcc5('0x2b')][_0xfcc5('0x2e')]));_0x4902f3['attributes']=_0x4902f3[_0xfcc5('0x2d')][_0xfcc5('0x2f')]?_0x4902f3[_0xfcc5('0x2d')]:_0x2c948f[_0xfcc5('0x29')];_0x4902f3[_0xfcc5('0x32')]=qs['sort'](_0x1e4ac6[_0xfcc5('0x2b')][_0xfcc5('0x33')]);_0x4902f3[_0xfcc5('0x34')]=qs[_0xfcc5('0x35')](_['pick'](_0x1e4ac6[_0xfcc5('0x2b')],_0x2c948f[_0xfcc5('0x35')]));if(_0x1e4ac6[_0xfcc5('0x2b')]['filter']){_0x4902f3['where']=_[_0xfcc5('0x38')](_0x4902f3[_0xfcc5('0x34')],{'$or':_[_0xfcc5('0x2a')](_0x4902f3[_0xfcc5('0x2d')],function(_0x3fdab1){var _0x47f1aa={};_0x47f1aa[_0x3fdab1]={'$like':'%'+_0x1e4ac6[_0xfcc5('0x2b')][_0xfcc5('0x37')]+'%'};return _0x47f1aa;})});}_0x4902f3=_[_0xfcc5('0x38')]({},_0x4902f3,_0x1e4ac6['options']);return _0x5ac3e1[_0xfcc5('0x46')](_0x4902f3);}})['then'](function(_0x4af7a2){if(_0x4af7a2){_0x53af4b=_0x4af7a2[_0xfcc5('0x2f')];if(!_0x1e4ac6[_0xfcc5('0x2b')][_0xfcc5('0x30')](_0xfcc5('0x31'))){_0x4902f3[_0xfcc5('0x1c')]=qs[_0xfcc5('0x1c')](_0x1e4ac6['query'][_0xfcc5('0x1c')]);_0x4902f3['offset']=qs[_0xfcc5('0x1b')](_0x1e4ac6[_0xfcc5('0x2b')][_0xfcc5('0x1b')]);}return _0x5ac3e1[_0xfcc5('0x46')](_0x4902f3);}})[_0xfcc5('0x20')](function(_0x24a00e){if(_0x24a00e){return _0x24a00e?{'count':_0x53af4b,'rows':_0x24a00e}:null;}})[_0xfcc5('0x20')](respondWithResult(_0x488c87,null))[_0xfcc5('0x3b')](handleError(_0x488c87,null));};exports[_0xfcc5('0x47')]=function(_0x4f56b8,_0x39841f,_0x14ccf3){var _0x18e5ab={};var _0x14a744={};var _0x904f2c;var _0x296e0b;return db[_0xfcc5('0x24')][_0xfcc5('0x48')]({'where':{'id':_0x4f56b8[_0xfcc5('0x44')]['id']}})[_0xfcc5('0x20')](handleEntityNotFound(_0x39841f,null))[_0xfcc5('0x20')](function(_0x20f936){if(_0x20f936){_0x904f2c=_0x20f936;_0x14a744[_0xfcc5('0x29')]=_[_0xfcc5('0x3d')](db[_0xfcc5('0x49')][_0xfcc5('0x25')]);_0x14a744['query']=_[_0xfcc5('0x3d')](_0x4f56b8[_0xfcc5('0x2b')]);_0x14a744[_0xfcc5('0x35')]=_[_0xfcc5('0x2c')](_0x14a744[_0xfcc5('0x29')],_0x14a744['query']);_0x18e5ab[_0xfcc5('0x2d')]=_[_0xfcc5('0x2c')](_0x14a744[_0xfcc5('0x29')],qs[_0xfcc5('0x2e')](_0x4f56b8[_0xfcc5('0x2b')][_0xfcc5('0x2e')]));_0x18e5ab[_0xfcc5('0x2d')]=_0x18e5ab[_0xfcc5('0x2d')][_0xfcc5('0x2f')]?_0x18e5ab[_0xfcc5('0x2d')]:_0x14a744['model'];_0x18e5ab[_0xfcc5('0x32')]=qs[_0xfcc5('0x33')](_0x4f56b8['query']['sort']);_0x18e5ab[_0xfcc5('0x34')]=qs['filters'](_[_0xfcc5('0x36')](_0x4f56b8[_0xfcc5('0x2b')],_0x14a744['filters']));if(_0x4f56b8[_0xfcc5('0x2b')][_0xfcc5('0x37')]){_0x18e5ab[_0xfcc5('0x34')]=_['merge'](_0x18e5ab[_0xfcc5('0x34')],{'$or':_[_0xfcc5('0x2a')](_0x18e5ab[_0xfcc5('0x2d')],function(_0x1ee81a){var _0x36a858={};_0x36a858[_0x1ee81a]={'$like':'%'+_0x4f56b8[_0xfcc5('0x2b')][_0xfcc5('0x37')]+'%'};return _0x36a858;})});}_0x18e5ab=_['merge']({},_0x18e5ab,_0x4f56b8[_0xfcc5('0x3f')]);return _0x904f2c[_0xfcc5('0x47')](_0x18e5ab);}})[_0xfcc5('0x20')](function(_0x11388d){if(_0x11388d){_0x296e0b=_0x11388d[_0xfcc5('0x2f')];if(!_0x4f56b8['query']['hasOwnProperty'](_0xfcc5('0x31'))){_0x18e5ab['limit']=qs[_0xfcc5('0x1c')](_0x4f56b8[_0xfcc5('0x2b')]['limit']);_0x18e5ab[_0xfcc5('0x1b')]=qs[_0xfcc5('0x1b')](_0x4f56b8[_0xfcc5('0x2b')][_0xfcc5('0x1b')]);}return _0x904f2c['getSubjects'](_0x18e5ab);}})[_0xfcc5('0x20')](function(_0x2018f3){if(_0x2018f3){return _0x2018f3?{'count':_0x296e0b,'rows':_0x2018f3}:null;}})['then'](respondWithResult(_0x39841f,null))[_0xfcc5('0x3b')](handleError(_0x39841f,null));};exports[_0xfcc5('0x4a')]=function(_0x2a9095,_0x434e5c,_0x5f17b1){var _0x5cb277={};var _0x5b23d7={};var _0x126f8d;var _0x49c118;return db[_0xfcc5('0x24')][_0xfcc5('0x48')]({'where':{'id':_0x2a9095['params']['id']}})[_0xfcc5('0x20')](handleEntityNotFound(_0x434e5c,null))[_0xfcc5('0x20')](function(_0x27a22b){if(_0x27a22b){_0x126f8d=_0x27a22b;_0x5b23d7[_0xfcc5('0x29')]=_[_0xfcc5('0x3d')](db[_0xfcc5('0x49')][_0xfcc5('0x25')]);_0x5b23d7[_0xfcc5('0x2b')]=_[_0xfcc5('0x3d')](_0x2a9095[_0xfcc5('0x2b')]);_0x5b23d7[_0xfcc5('0x35')]=_[_0xfcc5('0x2c')](_0x5b23d7[_0xfcc5('0x29')],_0x5b23d7[_0xfcc5('0x2b')]);_0x5cb277[_0xfcc5('0x2d')]=_[_0xfcc5('0x2c')](_0x5b23d7[_0xfcc5('0x29')],qs[_0xfcc5('0x2e')](_0x2a9095['query'][_0xfcc5('0x2e')]));_0x5cb277[_0xfcc5('0x2d')]=_0x5cb277['attributes']['length']?_0x5cb277[_0xfcc5('0x2d')]:_0x5b23d7[_0xfcc5('0x29')];_0x5cb277[_0xfcc5('0x32')]=qs['sort'](_0x2a9095['query'][_0xfcc5('0x33')]);_0x5cb277[_0xfcc5('0x34')]=qs[_0xfcc5('0x35')](_['pick'](_0x2a9095[_0xfcc5('0x2b')],_0x5b23d7['filters']));if(_0x2a9095[_0xfcc5('0x2b')]['filter']){_0x5cb277[_0xfcc5('0x34')]=_['merge'](_0x5cb277[_0xfcc5('0x34')],{'$or':_[_0xfcc5('0x2a')](_0x5cb277['attributes'],function(_0x17c683){var _0x450a5a={};_0x450a5a[_0x17c683]={'$like':'%'+_0x2a9095[_0xfcc5('0x2b')][_0xfcc5('0x37')]+'%'};return _0x450a5a;})});}_0x5cb277=_['merge']({},_0x5cb277,_0x2a9095[_0xfcc5('0x3f')]);return _0x126f8d[_0xfcc5('0x4a')](_0x5cb277);}})[_0xfcc5('0x20')](function(_0x2d395d){if(_0x2d395d){_0x49c118=_0x2d395d['length'];if(!_0x2a9095[_0xfcc5('0x2b')][_0xfcc5('0x30')](_0xfcc5('0x31'))){_0x5cb277[_0xfcc5('0x1c')]=qs[_0xfcc5('0x1c')](_0x2a9095[_0xfcc5('0x2b')][_0xfcc5('0x1c')]);_0x5cb277['offset']=qs[_0xfcc5('0x1b')](_0x2a9095[_0xfcc5('0x2b')]['offset']);}return _0x126f8d[_0xfcc5('0x4a')](_0x5cb277);}})['then'](function(_0x390575){if(_0x390575){return _0x390575?{'count':_0x49c118,'rows':_0x390575}:null;}})[_0xfcc5('0x20')](respondWithResult(_0x434e5c,null))[_0xfcc5('0x3b')](handleError(_0x434e5c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 05904a0..0cd9177 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 _0x2230=['moment','request-promise','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x2df3b1,_0x528212){var _0xdf18cf=function(_0x409155){while(--_0x409155){_0x2df3b1['push'](_0x2df3b1['shift']());}};_0xdf18cf(++_0x528212);}(_0x2230,0x188));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0223('0x0'));var util=require(_0x0223('0x1'));var logger=require(_0x0223('0x2'))(_0x0223('0x3'));var moment=require(_0x0223('0x4'));var BPromise=require('bluebird');var rp=require(_0x0223('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0223('0x6'));module[_0x0223('0x7')]=function(_0x26ef8b,_0x34875d){return _0x26ef8b[_0x0223('0x8')](_0x0223('0x9'),attributes,{'tableName':_0x0223('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9de8=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9de8,0x147));var _0x89de=function(_0x3ebfb5,_0x1772fa){_0x3ebfb5=_0x3ebfb5-0x0;var _0x183bfb=_0x9de8[_0x3ebfb5];return _0x183bfb;};'use strict';var _=require(_0x89de('0x0'));var util=require(_0x89de('0x1'));var logger=require(_0x89de('0x2'))(_0x89de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x89de('0x4'));var fs=require('fs');var path=require(_0x89de('0x5'));var rimraf=require(_0x89de('0x6'));var config=require(_0x89de('0x7'));var attributes=require(_0x89de('0x8'));module['exports']=function(_0x220248,_0x4e47f4){return _0x220248[_0x89de('0x9')](_0x89de('0xa'),attributes,{'tableName':_0x89de('0xb'),'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 a7a62b5..cc8fd41 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 _0xc8da=['request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2ac35b,_0x2c6706){var _0xb4f304=function(_0x8e9c32){while(--_0x8e9c32){_0x2ac35b['push'](_0x2ac35b['shift']());}};_0xb4f304(++_0x2c6706);}(_0xc8da,0x1ad));var _0xac8d=function(_0x2fc6b5,_0x37e51c){_0x2fc6b5=_0x2fc6b5-0x0;var _0x2b73cd=_0xc8da[_0x2fc6b5];return _0x2b73cd;};'use strict';var _=require(_0xac8d('0x0'));var util=require(_0xac8d('0x1'));var moment=require('moment');var BPromise=require(_0xac8d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac8d('0x3'));var db=require(_0xac8d('0x4'))['db'];var utils=require(_0xac8d('0x5'));var logger=require(_0xac8d('0x6'))(_0xac8d('0x7'));var config=require(_0xac8d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xac8d('0x9')][_0xac8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539e36,_0x86d0ce,_0x5bb75f){return new BPromise(function(_0x28438c,_0x1a969a){return client[_0xac8d('0xb')](_0x539e36,_0x5bb75f)[_0xac8d('0xc')](function(_0x3a0555){logger['info'](_0xac8d('0xd'),_0x86d0ce,_0xac8d('0xe'));logger[_0xac8d('0xf')](_0xac8d('0x10'),_0x86d0ce,_0xac8d('0xe'),JSON['stringify'](_0x3a0555));if(_0x3a0555[_0xac8d('0x11')]){if(_0x3a0555['error']['code']===0x1f4){logger['error'](_0xac8d('0xd'),_0x86d0ce,_0x3a0555[_0xac8d('0x11')]['message']);return _0x1a969a(_0x3a0555['error'][_0xac8d('0x12')]);}logger[_0xac8d('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x86d0ce,_0x3a0555['error']['message']);return _0x28438c(_0x3a0555[_0xac8d('0x11')][_0xac8d('0x12')]);}else{logger[_0xac8d('0x13')](_0xac8d('0xd'),_0x86d0ce,_0xac8d('0xe'));_0x28438c(_0x3a0555[_0xac8d('0x14')][_0xac8d('0x12')]);}})[_0xac8d('0x15')](function(_0x4aef97){logger[_0xac8d('0x11')](_0xac8d('0xd'),_0x86d0ce,_0x4aef97);_0x1a969a(_0x4aef97);});});} \ No newline at end of file +var _0xfe6b=['error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x156a77,_0x522c13){var _0x32398a=function(_0x55a47a){while(--_0x55a47a){_0x156a77['push'](_0x156a77['shift']());}};_0x32398a(++_0x522c13);}(_0xfe6b,0x129));var _0xbfe6=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0xfe6b[_0x9ace37];return _0x23ecc0;};'use strict';var _=require('lodash');var util=require(_0xbfe6('0x0'));var moment=require(_0xbfe6('0x1'));var BPromise=require(_0xbfe6('0x2'));var rs=require(_0xbfe6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfe6('0x4'))['db'];var utils=require(_0xbfe6('0x5'));var logger=require(_0xbfe6('0x6'))('rpc');var config=require(_0xbfe6('0x7'));var jayson=require(_0xbfe6('0x8'));var client=jayson[_0xbfe6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e30ac,_0x24acd2,_0x53e172){return new BPromise(function(_0x3afad8,_0xd602d1){return client[_0xbfe6('0xa')](_0x5e30ac,_0x53e172)[_0xbfe6('0xb')](function(_0x41d3e6){logger[_0xbfe6('0xc')](_0xbfe6('0xd'),_0x24acd2,_0xbfe6('0xe'));logger[_0xbfe6('0xf')](_0xbfe6('0x10'),_0x24acd2,_0xbfe6('0xe'),JSON[_0xbfe6('0x11')](_0x41d3e6));if(_0x41d3e6[_0xbfe6('0x12')]){if(_0x41d3e6[_0xbfe6('0x12')]['code']===0x1f4){logger[_0xbfe6('0x12')](_0xbfe6('0xd'),_0x24acd2,_0x41d3e6[_0xbfe6('0x12')][_0xbfe6('0x13')]);return _0xd602d1(_0x41d3e6[_0xbfe6('0x12')][_0xbfe6('0x13')]);}logger[_0xbfe6('0x12')](_0xbfe6('0xd'),_0x24acd2,_0x41d3e6[_0xbfe6('0x12')][_0xbfe6('0x13')]);return _0x3afad8(_0x41d3e6[_0xbfe6('0x12')][_0xbfe6('0x13')]);}else{logger[_0xbfe6('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x24acd2,_0xbfe6('0xe'));_0x3afad8(_0x41d3e6['result'][_0xbfe6('0x13')]);}})[_0xbfe6('0x14')](function(_0x397e97){logger[_0xbfe6('0x12')](_0xbfe6('0xd'),_0x24acd2,_0x397e97);_0xd602d1(_0x397e97);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 972df9a..14b8cf3 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 _0xf91e=['index','/:id','show','post','create','put','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x44c805,_0x38ee84){var _0x1f0942=function(_0x3e1690){while(--_0x3e1690){_0x44c805['push'](_0x44c805['shift']());}};_0x1f0942(++_0x38ee84);}(_0xf91e,0x177));var _0xef91=function(_0x24546b,_0x5e1726){_0x24546b=_0x24546b-0x0;var _0x3f90f4=_0xf91e[_0x24546b];return _0x3f90f4;};'use strict';var multer=require(_0xef91('0x0'));var util=require(_0xef91('0x1'));var path=require(_0xef91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xef91('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef91('0x4'));var interaction=require(_0xef91('0x5'));var config=require(_0xef91('0x6'));var controller=require('./intVtigerField.controller');router[_0xef91('0x7')]('/',auth[_0xef91('0x8')](),controller[_0xef91('0x9')]);router[_0xef91('0x7')](_0xef91('0xa'),auth['isAuthenticated'](),controller[_0xef91('0xb')]);router[_0xef91('0xc')]('/',auth[_0xef91('0x8')](),controller[_0xef91('0xd')]);router[_0xef91('0xe')]('/:id',auth[_0xef91('0x8')](),controller[_0xef91('0xf')]);router['delete']('/:id',auth[_0xef91('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb427=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x25372f,_0x58abff){var _0x3820ef=function(_0x2dd197){while(--_0x2dd197){_0x25372f['push'](_0x25372f['shift']());}};_0x3820ef(++_0x58abff);}(_0xb427,0x178));var _0x7b42=function(_0x426c9f,_0x45931b){_0x426c9f=_0x426c9f-0x0;var _0x387490=_0xb427[_0x426c9f];return _0x387490;};'use strict';var multer=require(_0x7b42('0x0'));var util=require(_0x7b42('0x1'));var path=require(_0x7b42('0x2'));var timeout=require(_0x7b42('0x3'));var express=require(_0x7b42('0x4'));var router=express[_0x7b42('0x5')]();var fs_extra=require(_0x7b42('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7b42('0x7'));var config=require(_0x7b42('0x8'));var controller=require(_0x7b42('0x9'));router[_0x7b42('0xa')]('/',auth[_0x7b42('0xb')](),controller['index']);router[_0x7b42('0xa')](_0x7b42('0xc'),auth['isAuthenticated'](),controller[_0x7b42('0xd')]);router[_0x7b42('0xe')]('/',auth[_0x7b42('0xb')](),controller[_0x7b42('0xf')]);router['put']('/:id',auth[_0x7b42('0xb')](),controller[_0x7b42('0x10')]);router[_0x7b42('0x11')](_0x7b42('0xc'),auth[_0x7b42('0xb')](),controller[_0x7b42('0x12')]);module[_0x7b42('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 18ccd42..def536a 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 _0xb604=['customVariable','keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xb604,0x19d));var _0x4b60=function(_0x313e3d,_0x2d149f){_0x313e3d=_0x313e3d-0x0;var _0x3989d0=_0xb604[_0x313e3d];return _0x3989d0;};'use strict';var Sequelize=require(_0x4b60('0x0'));module['exports']={'type':{'type':Sequelize[_0x4b60('0x1')]('string',_0x4b60('0x2'),_0x4b60('0x3'),_0x4b60('0x4'),'picklist'),'defaultValue':_0x4b60('0x5')},'content':{'type':Sequelize[_0x4b60('0x6')]},'key':{'type':Sequelize[_0x4b60('0x6')]},'keyType':{'type':Sequelize[_0x4b60('0x1')](_0x4b60('0x5'),'variable',_0x4b60('0x3'))},'keyContent':{'type':Sequelize[_0x4b60('0x6')]},'idField':{'type':Sequelize[_0x4b60('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4b60('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf226=['STRING','ENUM','exports','string','variable','keyValue','picklist'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xf226,0xe9));var _0x6f22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf226[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6f22('0x0')]={'type':{'type':Sequelize['ENUM'](_0x6f22('0x1'),_0x6f22('0x2'),'customVariable',_0x6f22('0x3'),_0x6f22('0x4')),'defaultValue':_0x6f22('0x1')},'content':{'type':Sequelize[_0x6f22('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6f22('0x6')](_0x6f22('0x1'),_0x6f22('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x6f22('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6f22('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'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 93c003a..d5ad611 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 _0x4a5c=['sendStatus','error','stack','name','send','VtigerField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','map','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','end'];(function(_0x26abbc,_0x3f1ccd){var _0x5b2766=function(_0x179738){while(--_0x179738){_0x26abbc['push'](_0x26abbc['shift']());}};_0x5b2766(++_0x3f1ccd);}(_0x4a5c,0x19d));var _0xc4a5=function(_0x3c3eb7,_0x55343d){_0x3c3eb7=_0x3c3eb7-0x0;var _0x108733=_0x4a5c[_0x3c3eb7];return _0x108733;};'use strict';var emlformat=require(_0xc4a5('0x0'));var rimraf=require(_0xc4a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4a5('0x2'));var rp=require('request-promise');var moment=require(_0xc4a5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc4a5('0x4'));var util=require(_0xc4a5('0x5'));var path=require('path');var sox=require(_0xc4a5('0x6'));var csv=require('to-csv');var ejs=require(_0xc4a5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4a5('0x8'));var squel=require(_0xc4a5('0x9'));var crypto=require('crypto');var jsforce=require(_0xc4a5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc4a5('0xb'));var querystring=require(_0xc4a5('0xc'));var Papa=require(_0xc4a5('0xd'));var Redis=require(_0xc4a5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc4a5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4a5('0x10'));var logger=require(_0xc4a5('0x11'))(_0xc4a5('0x12'));var utils=require(_0xc4a5('0x13'));var config=require(_0xc4a5('0x14'));var licenseUtil=require(_0xc4a5('0x15'));var db=require(_0xc4a5('0x16'))['db'];function respondWithStatusCode(_0x1ba5e1,_0x1f5706){_0x1f5706=_0x1f5706||0xcc;return function(_0x79a645){if(_0x79a645){return _0x1ba5e1['sendStatus'](_0x1f5706);}return _0x1ba5e1['status'](_0x1f5706)['end']();};}function respondWithResult(_0x4353a0,_0x58baf1){_0x58baf1=_0x58baf1||0xc8;return function(_0xa8613a){if(_0xa8613a){return _0x4353a0[_0xc4a5('0x17')](_0x58baf1)['json'](_0xa8613a);}};}function respondWithFilteredResult(_0x16cf91,_0x4a68fe){return function(_0x6cacda){if(_0x6cacda){var _0x125494=typeof _0x4a68fe['offset']===_0xc4a5('0x18')&&typeof _0x4a68fe[_0xc4a5('0x19')]==='undefined';var _0x2f6788=_0x6cacda[_0xc4a5('0x1a')];var _0xa2105=_0x125494?0x0:_0x4a68fe[_0xc4a5('0x1b')];var _0x2961d6=_0x125494?_0x6cacda[_0xc4a5('0x1a')]:_0x4a68fe[_0xc4a5('0x1b')]+_0x4a68fe['limit'];var _0x541d88;if(_0x2961d6>=_0x2f6788){_0x2961d6=_0x2f6788;_0x541d88=0xc8;}else{_0x541d88=0xce;}_0x16cf91[_0xc4a5('0x17')](_0x541d88);return _0x16cf91[_0xc4a5('0x1c')](_0xc4a5('0x1d'),_0xa2105+'-'+_0x2961d6+'/'+_0x2f6788)[_0xc4a5('0x1e')](_0x6cacda);}return null;};}function patchUpdates(_0x3334ad){return function(_0x449205){try{jsonpatch[_0xc4a5('0x1f')](_0x449205,_0x3334ad,!![]);}catch(_0x13ed6b){return BPromise[_0xc4a5('0x20')](_0x13ed6b);}return _0x449205[_0xc4a5('0x21')]();};}function saveUpdates(_0x4666f0,_0x292ed2){return function(_0x2d708b){if(_0x2d708b){return _0x2d708b[_0xc4a5('0x22')](_0x4666f0)[_0xc4a5('0x23')](function(_0x1d275d){return _0x1d275d;});}return null;};}function removeEntity(_0x36c7b6,_0x37345e){return function(_0x3933b7){if(_0x3933b7){return _0x3933b7['destroy']()[_0xc4a5('0x23')](function(){_0x36c7b6[_0xc4a5('0x17')](0xcc)[_0xc4a5('0x24')]();});}};}function handleEntityNotFound(_0x4d7d0e,_0x1703a3){return function(_0xc5c73f){if(!_0xc5c73f){_0x4d7d0e[_0xc4a5('0x25')](0x194);}return _0xc5c73f;};}function handleError(_0x14a5cc,_0x3742ad){_0x3742ad=_0x3742ad||0x1f4;return function(_0x1f72c4){logger[_0xc4a5('0x26')](_0x1f72c4[_0xc4a5('0x27')]);if(_0x1f72c4[_0xc4a5('0x28')]){delete _0x1f72c4[_0xc4a5('0x28')];}_0x14a5cc['status'](_0x3742ad)[_0xc4a5('0x29')](_0x1f72c4);};}exports['index']=function(_0x206c2b,_0x2c6f8e){var _0x9ff869={},_0x4d9657={},_0x294e51={'count':0x0,'rows':[]};var _0x2bfd78=_['map'](db[_0xc4a5('0x2a')][_0xc4a5('0x2b')],function(_0x5a1c11){return{'name':_0x5a1c11[_0xc4a5('0x2c')],'type':_0x5a1c11['type']['key']};});_0x4d9657[_0xc4a5('0x2d')]=_['map'](_0x2bfd78,_0xc4a5('0x28'));_0x4d9657[_0xc4a5('0x2e')]=_[_0xc4a5('0x2f')](_0x206c2b[_0xc4a5('0x2e')]);_0x4d9657['filters']=_[_0xc4a5('0x30')](_0x4d9657[_0xc4a5('0x2d')],_0x4d9657[_0xc4a5('0x2e')]);_0x9ff869[_0xc4a5('0x31')]=_[_0xc4a5('0x30')](_0x4d9657['model'],qs[_0xc4a5('0x32')](_0x206c2b[_0xc4a5('0x2e')][_0xc4a5('0x32')]));_0x9ff869[_0xc4a5('0x31')]=_0x9ff869[_0xc4a5('0x31')][_0xc4a5('0x33')]?_0x9ff869[_0xc4a5('0x31')]:_0x4d9657['model'];if(!_0x206c2b[_0xc4a5('0x2e')]['hasOwnProperty'](_0xc4a5('0x34'))){_0x9ff869[_0xc4a5('0x19')]=qs[_0xc4a5('0x19')](_0x206c2b[_0xc4a5('0x2e')][_0xc4a5('0x19')]);_0x9ff869[_0xc4a5('0x1b')]=qs[_0xc4a5('0x1b')](_0x206c2b['query'][_0xc4a5('0x1b')]);}_0x9ff869[_0xc4a5('0x35')]=qs['sort'](_0x206c2b[_0xc4a5('0x2e')][_0xc4a5('0x36')]);_0x9ff869[_0xc4a5('0x37')]=qs['filters'](_[_0xc4a5('0x38')](_0x206c2b['query'],_0x4d9657[_0xc4a5('0x39')]),_0x2bfd78);if(_0x206c2b['query']['filter']){_0x9ff869[_0xc4a5('0x37')]=_[_0xc4a5('0x3a')](_0x9ff869[_0xc4a5('0x37')],{'$or':_[_0xc4a5('0x3b')](_0x2bfd78,function(_0x168ef1){if(_0x168ef1[_0xc4a5('0x3c')]!==_0xc4a5('0x3d')){var _0xcac2f1={};_0xcac2f1[_0x168ef1[_0xc4a5('0x28')]]={'$like':'%'+_0x206c2b[_0xc4a5('0x2e')][_0xc4a5('0x3e')]+'%'};return _0xcac2f1;}})});}_0x9ff869=_[_0xc4a5('0x3a')]({},_0x9ff869,_0x206c2b['options']);var _0x169947={'where':_0x9ff869[_0xc4a5('0x37')]};return db[_0xc4a5('0x2a')][_0xc4a5('0x1a')](_0x169947)['then'](function(_0x5cbaf3){_0x294e51[_0xc4a5('0x1a')]=_0x5cbaf3;if(_0x206c2b[_0xc4a5('0x2e')][_0xc4a5('0x3f')]){_0x9ff869[_0xc4a5('0x40')]=[{'all':!![]}];}return db[_0xc4a5('0x2a')][_0xc4a5('0x41')](_0x9ff869);})['then'](function(_0x166a3d){_0x294e51[_0xc4a5('0x42')]=_0x166a3d;return _0x294e51;})[_0xc4a5('0x23')](respondWithFilteredResult(_0x2c6f8e,_0x9ff869))[_0xc4a5('0x43')](handleError(_0x2c6f8e,null));};exports[_0xc4a5('0x44')]=function(_0x7831d1,_0x5d1fa1){var _0x2092fd={'raw':!![],'where':{'id':_0x7831d1[_0xc4a5('0x45')]['id']}},_0x4241c0={};_0x4241c0['model']=_[_0xc4a5('0x2f')](db[_0xc4a5('0x2a')][_0xc4a5('0x2b')]);_0x4241c0[_0xc4a5('0x2e')]=_[_0xc4a5('0x2f')](_0x7831d1[_0xc4a5('0x2e')]);_0x4241c0[_0xc4a5('0x39')]=_['intersection'](_0x4241c0[_0xc4a5('0x2d')],_0x4241c0['query']);_0x2092fd['attributes']=_[_0xc4a5('0x30')](_0x4241c0['model'],qs[_0xc4a5('0x32')](_0x7831d1[_0xc4a5('0x2e')]['fields']));_0x2092fd[_0xc4a5('0x31')]=_0x2092fd['attributes'][_0xc4a5('0x33')]?_0x2092fd['attributes']:_0x4241c0[_0xc4a5('0x2d')];if(_0x7831d1[_0xc4a5('0x2e')][_0xc4a5('0x3f')]){_0x2092fd[_0xc4a5('0x40')]=[{'all':!![]}];}_0x2092fd=_[_0xc4a5('0x3a')]({},_0x2092fd,_0x7831d1[_0xc4a5('0x46')]);return db[_0xc4a5('0x2a')][_0xc4a5('0x47')](_0x2092fd)[_0xc4a5('0x23')](handleEntityNotFound(_0x5d1fa1,null))[_0xc4a5('0x23')](respondWithResult(_0x5d1fa1,null))[_0xc4a5('0x43')](handleError(_0x5d1fa1,null));};exports[_0xc4a5('0x48')]=function(_0x2e2b4a,_0x4452d1){return db['VtigerField'][_0xc4a5('0x48')](_0x2e2b4a[_0xc4a5('0x49')],{})['then'](respondWithResult(_0x4452d1,0xc9))['catch'](handleError(_0x4452d1,null));};exports['update']=function(_0x436c04,_0xc781c3){if(_0x436c04['body']['id']){delete _0x436c04['body']['id'];}return db['VtigerField'][_0xc4a5('0x47')]({'where':{'id':_0x436c04[_0xc4a5('0x45')]['id']}})['then'](handleEntityNotFound(_0xc781c3,null))[_0xc4a5('0x23')](saveUpdates(_0x436c04[_0xc4a5('0x49')],null))[_0xc4a5('0x23')](respondWithResult(_0xc781c3,null))[_0xc4a5('0x43')](handleError(_0xc781c3,null));};exports[_0xc4a5('0x4a')]=function(_0x1f0c9c,_0x82541d){return db['VtigerField'][_0xc4a5('0x47')]({'where':{'id':_0x1f0c9c[_0xc4a5('0x45')]['id']}})[_0xc4a5('0x23')](handleEntityNotFound(_0x82541d,null))['then'](removeEntity(_0x82541d,null))[_0xc4a5('0x43')](handleError(_0x82541d,null));}; \ No newline at end of file +var _0x6816=['name','send','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','merge','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x6816,0x10a));var _0x6681=function(_0x2c61ba,_0x2a1984){_0x2c61ba=_0x2c61ba-0x0;var _0x4ccb65=_0x6816[_0x2c61ba];return _0x4ccb65;};'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('mustache');var util=require(_0x6681('0x5'));var path=require(_0x6681('0x6'));var sox=require(_0x6681('0x7'));var csv=require(_0x6681('0x8'));var ejs=require(_0x6681('0x9'));var fs=require('fs');var fs_extra=require(_0x6681('0xa'));var _=require(_0x6681('0xb'));var squel=require(_0x6681('0xc'));var crypto=require(_0x6681('0xd'));var jsforce=require(_0x6681('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6681('0x8'));var querystring=require('querystring');var Papa=require(_0x6681('0xf'));var Redis=require(_0x6681('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6681('0x11'));var as=require(_0x6681('0x12'));var hardwareService=require(_0x6681('0x13'));var logger=require(_0x6681('0x14'))('api');var utils=require(_0x6681('0x15'));var config=require(_0x6681('0x16'));var licenseUtil=require(_0x6681('0x17'));var db=require(_0x6681('0x18'))['db'];function respondWithStatusCode(_0x4082ee,_0x23c76e){_0x23c76e=_0x23c76e||0xcc;return function(_0x378699){if(_0x378699){return _0x4082ee[_0x6681('0x19')](_0x23c76e);}return _0x4082ee[_0x6681('0x1a')](_0x23c76e)[_0x6681('0x1b')]();};}function respondWithResult(_0x26d564,_0x414f32){_0x414f32=_0x414f32||0xc8;return function(_0x434034){if(_0x434034){return _0x26d564[_0x6681('0x1a')](_0x414f32)[_0x6681('0x1c')](_0x434034);}};}function respondWithFilteredResult(_0x3ab1e9,_0x573602){return function(_0x2f6b32){if(_0x2f6b32){var _0x1d6ed6=typeof _0x573602[_0x6681('0x1d')]===_0x6681('0x1e')&&typeof _0x573602[_0x6681('0x1f')]===_0x6681('0x1e');var _0xd4daa9=_0x2f6b32[_0x6681('0x20')];var _0x429c0e=_0x1d6ed6?0x0:_0x573602[_0x6681('0x1d')];var _0x16595c=_0x1d6ed6?_0x2f6b32['count']:_0x573602[_0x6681('0x1d')]+_0x573602[_0x6681('0x1f')];var _0x520cad;if(_0x16595c>=_0xd4daa9){_0x16595c=_0xd4daa9;_0x520cad=0xc8;}else{_0x520cad=0xce;}_0x3ab1e9[_0x6681('0x1a')](_0x520cad);return _0x3ab1e9[_0x6681('0x21')](_0x6681('0x22'),_0x429c0e+'-'+_0x16595c+'/'+_0xd4daa9)[_0x6681('0x1c')](_0x2f6b32);}return null;};}function patchUpdates(_0x173bcb){return function(_0x53ac7d){try{jsonpatch[_0x6681('0x23')](_0x53ac7d,_0x173bcb,!![]);}catch(_0x4a298a){return BPromise[_0x6681('0x24')](_0x4a298a);}return _0x53ac7d[_0x6681('0x25')]();};}function saveUpdates(_0x33c09b,_0xcb120b){return function(_0x108fa9){if(_0x108fa9){return _0x108fa9['update'](_0x33c09b)[_0x6681('0x26')](function(_0x2dd649){return _0x2dd649;});}return null;};}function removeEntity(_0x52ac44,_0x35337e){return function(_0x2bf4b5){if(_0x2bf4b5){return _0x2bf4b5[_0x6681('0x27')]()['then'](function(){_0x52ac44['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ad6f,_0x24b6b1){return function(_0x19f8b2){if(!_0x19f8b2){_0x43ad6f[_0x6681('0x19')](0x194);}return _0x19f8b2;};}function handleError(_0xa4fb57,_0x51b906){_0x51b906=_0x51b906||0x1f4;return function(_0x59c85c){logger[_0x6681('0x28')](_0x59c85c[_0x6681('0x29')]);if(_0x59c85c['name']){delete _0x59c85c[_0x6681('0x2a')];}_0xa4fb57[_0x6681('0x1a')](_0x51b906)[_0x6681('0x2b')](_0x59c85c);};}exports['index']=function(_0x517b27,_0x3727a7){var _0xc7ffeb={},_0x2097b3={},_0x4e2ebb={'count':0x0,'rows':[]};var _0x5ef489=_[_0x6681('0x2c')](db[_0x6681('0x2d')]['rawAttributes'],function(_0x3e4992){return{'name':_0x3e4992[_0x6681('0x2e')],'type':_0x3e4992[_0x6681('0x2f')][_0x6681('0x30')]};});_0x2097b3[_0x6681('0x31')]=_[_0x6681('0x2c')](_0x5ef489,_0x6681('0x2a'));_0x2097b3[_0x6681('0x32')]=_[_0x6681('0x33')](_0x517b27[_0x6681('0x32')]);_0x2097b3['filters']=_[_0x6681('0x34')](_0x2097b3[_0x6681('0x31')],_0x2097b3[_0x6681('0x32')]);_0xc7ffeb[_0x6681('0x35')]=_[_0x6681('0x34')](_0x2097b3[_0x6681('0x31')],qs['fields'](_0x517b27[_0x6681('0x32')][_0x6681('0x36')]));_0xc7ffeb['attributes']=_0xc7ffeb[_0x6681('0x35')][_0x6681('0x37')]?_0xc7ffeb[_0x6681('0x35')]:_0x2097b3[_0x6681('0x31')];if(!_0x517b27[_0x6681('0x32')][_0x6681('0x38')](_0x6681('0x39'))){_0xc7ffeb[_0x6681('0x1f')]=qs[_0x6681('0x1f')](_0x517b27[_0x6681('0x32')][_0x6681('0x1f')]);_0xc7ffeb[_0x6681('0x1d')]=qs[_0x6681('0x1d')](_0x517b27['query'][_0x6681('0x1d')]);}_0xc7ffeb[_0x6681('0x3a')]=qs['sort'](_0x517b27['query']['sort']);_0xc7ffeb[_0x6681('0x3b')]=qs[_0x6681('0x3c')](_[_0x6681('0x3d')](_0x517b27['query'],_0x2097b3[_0x6681('0x3c')]),_0x5ef489);if(_0x517b27[_0x6681('0x32')][_0x6681('0x3e')]){_0xc7ffeb[_0x6681('0x3b')]=_['merge'](_0xc7ffeb[_0x6681('0x3b')],{'$or':_[_0x6681('0x2c')](_0x5ef489,function(_0x2517e7){if(_0x2517e7[_0x6681('0x2f')]!==_0x6681('0x3f')){var _0x5895b9={};_0x5895b9[_0x2517e7['name']]={'$like':'%'+_0x517b27[_0x6681('0x32')][_0x6681('0x3e')]+'%'};return _0x5895b9;}})});}_0xc7ffeb=_['merge']({},_0xc7ffeb,_0x517b27[_0x6681('0x40')]);var _0x12405c={'where':_0xc7ffeb['where']};return db[_0x6681('0x2d')][_0x6681('0x20')](_0x12405c)[_0x6681('0x26')](function(_0x348849){_0x4e2ebb[_0x6681('0x20')]=_0x348849;if(_0x517b27[_0x6681('0x32')][_0x6681('0x41')]){_0xc7ffeb['include']=[{'all':!![]}];}return db[_0x6681('0x2d')][_0x6681('0x42')](_0xc7ffeb);})['then'](function(_0x4e0b94){_0x4e2ebb[_0x6681('0x43')]=_0x4e0b94;return _0x4e2ebb;})[_0x6681('0x26')](respondWithFilteredResult(_0x3727a7,_0xc7ffeb))[_0x6681('0x44')](handleError(_0x3727a7,null));};exports[_0x6681('0x45')]=function(_0x16d380,_0x4b2b18){var _0x1c5ced={'raw':!![],'where':{'id':_0x16d380['params']['id']}},_0x5d640b={};_0x5d640b['model']=_[_0x6681('0x33')](db[_0x6681('0x2d')][_0x6681('0x46')]);_0x5d640b[_0x6681('0x32')]=_[_0x6681('0x33')](_0x16d380[_0x6681('0x32')]);_0x5d640b['filters']=_['intersection'](_0x5d640b[_0x6681('0x31')],_0x5d640b[_0x6681('0x32')]);_0x1c5ced['attributes']=_[_0x6681('0x34')](_0x5d640b['model'],qs[_0x6681('0x36')](_0x16d380[_0x6681('0x32')][_0x6681('0x36')]));_0x1c5ced[_0x6681('0x35')]=_0x1c5ced['attributes']['length']?_0x1c5ced['attributes']:_0x5d640b[_0x6681('0x31')];if(_0x16d380['query'][_0x6681('0x41')]){_0x1c5ced['include']=[{'all':!![]}];}_0x1c5ced=_[_0x6681('0x47')]({},_0x1c5ced,_0x16d380[_0x6681('0x40')]);return db[_0x6681('0x2d')][_0x6681('0x48')](_0x1c5ced)[_0x6681('0x26')](handleEntityNotFound(_0x4b2b18,null))[_0x6681('0x26')](respondWithResult(_0x4b2b18,null))['catch'](handleError(_0x4b2b18,null));};exports[_0x6681('0x49')]=function(_0x12f37a,_0x2bc5cd){return db['VtigerField'][_0x6681('0x49')](_0x12f37a[_0x6681('0x4a')],{})[_0x6681('0x26')](respondWithResult(_0x2bc5cd,0xc9))['catch'](handleError(_0x2bc5cd,null));};exports[_0x6681('0x4b')]=function(_0x31d51b,_0x5093bf){if(_0x31d51b[_0x6681('0x4a')]['id']){delete _0x31d51b[_0x6681('0x4a')]['id'];}return db[_0x6681('0x2d')]['find']({'where':{'id':_0x31d51b[_0x6681('0x4c')]['id']}})[_0x6681('0x26')](handleEntityNotFound(_0x5093bf,null))[_0x6681('0x26')](saveUpdates(_0x31d51b[_0x6681('0x4a')],null))[_0x6681('0x26')](respondWithResult(_0x5093bf,null))[_0x6681('0x44')](handleError(_0x5093bf,null));};exports[_0x6681('0x27')]=function(_0x19d5ae,_0x34fafe){return db['VtigerField']['find']({'where':{'id':_0x19d5ae[_0x6681('0x4c')]['id']}})[_0x6681('0x26')](handleEntityNotFound(_0x34fafe,null))[_0x6681('0x26')](removeEntity(_0x34fafe,null))[_0x6681('0x44')](handleError(_0x34fafe,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index bde1280..c445ae8 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 _0x410a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','idField','lodash','util'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x410a,0x67));var _0xa410=function(_0x174309,_0x3b138b){_0x174309=_0x174309-0x0;var _0x40b51e=_0x410a[_0x174309];return _0x40b51e;};'use strict';var _=require(_0xa410('0x0'));var util=require(_0xa410('0x1'));var logger=require(_0xa410('0x2'))(_0xa410('0x3'));var moment=require(_0xa410('0x4'));var BPromise=require(_0xa410('0x5'));var rp=require(_0xa410('0x6'));var fs=require('fs');var path=require(_0xa410('0x7'));var rimraf=require(_0xa410('0x8'));var config=require(_0xa410('0x9'));var attributes=require(_0xa410('0xa'));module[_0xa410('0xb')]=function(_0x3ea48d,_0x3f85ba){return _0x3ea48d[_0xa410('0xc')]('VtigerField',attributes,{'tableName':_0xa410('0xd'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xa410('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3920=['./intVtigerField.attributes','VtigerField','int_vtiger_fields','idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x576c61,_0x4cb386){var _0x4ffa12=function(_0x183180){while(--_0x183180){_0x576c61['push'](_0x576c61['shift']());}};_0x4ffa12(++_0x4cb386);}(_0x3920,0x1bc));var _0x0392=function(_0x377bb6,_0xafbe){_0x377bb6=_0x377bb6-0x0;var _0x1a09f8=_0x3920[_0x377bb6];return _0x1a09f8;};'use strict';var _=require('lodash');var util=require(_0x0392('0x0'));var logger=require(_0x0392('0x1'))(_0x0392('0x2'));var moment=require(_0x0392('0x3'));var BPromise=require(_0x0392('0x4'));var rp=require(_0x0392('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0392('0x6'));var config=require('../../config/environment');var attributes=require(_0x0392('0x7'));module['exports']=function(_0x2671a0,_0x213a98){return _0x2671a0['define'](_0x0392('0x8'),attributes,{'tableName':_0x0392('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0392('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6cd4b1c..3b4356d 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 _0x5283=['request','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','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x47b104,_0x1addfd){var _0xb339c1=function(_0x17bf07){while(--_0x17bf07){_0x47b104['push'](_0x47b104['shift']());}};_0xb339c1(++_0x1addfd);}(_0x5283,0x1c4));var _0x3528=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x5283[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x3528('0x0'));var util=require(_0x3528('0x1'));var moment=require(_0x3528('0x2'));var BPromise=require(_0x3528('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3528('0x4'));var logger=require(_0x3528('0x5'))(_0x3528('0x6'));var config=require(_0x3528('0x7'));var jayson=require(_0x3528('0x8'));var client=jayson[_0x3528('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dafd4,_0x489d52,_0x307708){return new BPromise(function(_0x11cc71,_0x1328bb){return client[_0x3528('0xa')](_0x2dafd4,_0x307708)['then'](function(_0x2f2996){logger[_0x3528('0xb')](_0x3528('0xc'),_0x489d52,_0x3528('0xd'));logger[_0x3528('0xe')](_0x3528('0xf'),_0x489d52,_0x3528('0xd'),JSON[_0x3528('0x10')](_0x2f2996));if(_0x2f2996[_0x3528('0x11')]){if(_0x2f2996[_0x3528('0x11')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x489d52,_0x2f2996[_0x3528('0x11')][_0x3528('0x12')]);return _0x1328bb(_0x2f2996['error']['message']);}logger[_0x3528('0x11')](_0x3528('0xc'),_0x489d52,_0x2f2996['error'][_0x3528('0x12')]);return _0x11cc71(_0x2f2996[_0x3528('0x11')][_0x3528('0x12')]);}else{logger[_0x3528('0xb')](_0x3528('0xc'),_0x489d52,'request\x20sent');_0x11cc71(_0x2f2996[_0x3528('0x13')][_0x3528('0x12')]);}})[_0x3528('0x14')](function(_0x2d065b){logger[_0x3528('0x11')]('VtigerField,\x20%s,\x20%s',_0x489d52,_0x2d065b);_0x1328bb(_0x2d065b);});});} \ No newline at end of file +var _0xc384=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc384,0x1e9));var _0x4c38=function(_0x4e2d7c,_0x48ccc2){_0x4e2d7c=_0x4e2d7c-0x0;var _0x120b43=_0xc384[_0x4e2d7c];return _0x120b43;};'use strict';var _=require('lodash');var util=require(_0x4c38('0x0'));var moment=require(_0x4c38('0x1'));var BPromise=require(_0x4c38('0x2'));var rs=require(_0x4c38('0x3'));var fs=require('fs');var Redis=require(_0x4c38('0x4'));var db=require(_0x4c38('0x5'))['db'];var utils=require(_0x4c38('0x6'));var logger=require(_0x4c38('0x7'))(_0x4c38('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c38('0x9'));var client=jayson[_0x4c38('0xa')][_0x4c38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5813ad,_0x2fa087,_0x41294c){return new BPromise(function(_0x22d168,_0x2e6257){return client[_0x4c38('0xc')](_0x5813ad,_0x41294c)['then'](function(_0x3d6f18){logger[_0x4c38('0xd')](_0x4c38('0xe'),_0x2fa087,_0x4c38('0xf'));logger[_0x4c38('0x10')](_0x4c38('0x11'),_0x2fa087,_0x4c38('0xf'),JSON[_0x4c38('0x12')](_0x3d6f18));if(_0x3d6f18[_0x4c38('0x13')]){if(_0x3d6f18[_0x4c38('0x13')][_0x4c38('0x14')]===0x1f4){logger[_0x4c38('0x13')](_0x4c38('0xe'),_0x2fa087,_0x3d6f18[_0x4c38('0x13')][_0x4c38('0x15')]);return _0x2e6257(_0x3d6f18[_0x4c38('0x13')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2fa087,_0x3d6f18['error'][_0x4c38('0x15')]);return _0x22d168(_0x3d6f18[_0x4c38('0x13')][_0x4c38('0x15')]);}else{logger[_0x4c38('0xd')](_0x4c38('0xe'),_0x2fa087,_0x4c38('0xf'));_0x22d168(_0x3d6f18[_0x4c38('0x16')][_0x4c38('0x15')]);}})[_0x4c38('0x17')](function(_0x2ea017){logger[_0x4c38('0x13')](_0x4c38('0xe'),_0x2fa087,_0x2ea017);_0x2e6257(_0x2ea017);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6b30034..edf5cf1 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 _0xf072=['create','/:id/configurations','addConfiguration','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','post'];(function(_0x27ed41,_0xb780a1){var _0x507934=function(_0x1f09ab){while(--_0x1f09ab){_0x27ed41['push'](_0x27ed41['shift']());}};_0x507934(++_0xb780a1);}(_0xf072,0x131));var _0x2f07=function(_0x1aced8,_0x4ef9a9){_0x1aced8=_0x1aced8-0x0;var _0x564b1b=_0xf072[_0x1aced8];return _0x564b1b;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require(_0x2f07('0x3'));var express=require('express');var router=express[_0x2f07('0x4')]();var fs_extra=require(_0x2f07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f07('0x6'));var config=require(_0x2f07('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2f07('0xb')]);router[_0x2f07('0x8')]('/:id/configurations',auth[_0x2f07('0x9')](),controller['getConfigurations']);router[_0x2f07('0x8')](_0x2f07('0xc'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xd')]);router[_0x2f07('0xe')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xf')]);router['post'](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router['put'](_0x2f07('0x12'),auth[_0x2f07('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2f07('0x9')](),controller['destroy']);module[_0x2f07('0x13')]=router; \ No newline at end of file +var _0x469e=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x469e,0xe1));var _0xe469=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x469e[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0xe469('0x0'));var util=require(_0xe469('0x1'));var path=require(_0xe469('0x2'));var timeout=require('connect-timeout');var express=require(_0xe469('0x3'));var router=express[_0xe469('0x4')]();var fs_extra=require(_0xe469('0x5'));var auth=require(_0xe469('0x6'));var interaction=require(_0xe469('0x7'));var config=require('../../config/environment');var controller=require(_0xe469('0x8'));router[_0xe469('0x9')]('/',auth[_0xe469('0xa')](),controller[_0xe469('0xb')]);router[_0xe469('0x9')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller[_0xe469('0xd')]);router[_0xe469('0x9')](_0xe469('0xe'),auth[_0xe469('0xa')](),controller[_0xe469('0xf')]);router[_0xe469('0x9')](_0xe469('0x10'),auth['isAuthenticated'](),controller[_0xe469('0x11')]);router[_0xe469('0x12')]('/',auth[_0xe469('0xa')](),controller[_0xe469('0x13')]);router[_0xe469('0x12')](_0xe469('0xe'),auth[_0xe469('0xa')](),controller[_0xe469('0x14')]);router[_0xe469('0x15')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller[_0xe469('0x16')]);router[_0xe469('0x17')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller['destroy']);module[_0xe469('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9a4ec6d..59acc10 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 _0xde81=['integrationTab','sequelize','exports','STRING','username','ENUM','password','token'];(function(_0x164c6e,_0x25abdb){var _0xe3731a=function(_0x53a71e){while(--_0x53a71e){_0x164c6e['push'](_0x164c6e['shift']());}};_0xe3731a(++_0x25abdb);}(_0xde81,0x109));var _0x1de8=function(_0x2519f8,_0x5af458){_0x2519f8=_0x2519f8-0x0;var _0x3cba8f=_0xde81[_0x2519f8];return _0x3cba8f;};'use strict';var Sequelize=require(_0x1de8('0x0'));module[_0x1de8('0x1')]={'name':{'type':Sequelize[_0x1de8('0x2')]},'description':{'type':Sequelize[_0x1de8('0x2')]},'username':{'type':Sequelize[_0x1de8('0x2')],'unique':_0x1de8('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1de8('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x1de8('0x4')](_0x1de8('0x5'),_0x1de8('0x6')),'defaultValue':_0x1de8('0x5')},'serverUrl':{'type':Sequelize[_0x1de8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1de8('0x4')](_0x1de8('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfc46=['sequelize','STRING','remoteUri','password','token','ENUM','integrationTab'];(function(_0x324e6b,_0x5427c2){var _0x42a8ab=function(_0x3c338b){while(--_0x3c338b){_0x324e6b['push'](_0x324e6b['shift']());}};_0x42a8ab(++_0x5427c2);}(_0xfc46,0x9a));var _0x6fc4=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xfc46[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')]},'description':{'type':Sequelize[_0x6fc4('0x1')]},'username':{'type':Sequelize[_0x6fc4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x6fc4('0x1')]},'token':{'type':Sequelize[_0x6fc4('0x1')]},'remoteUri':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2')},'authType':{'type':Sequelize['ENUM'](_0x6fc4('0x3'),_0x6fc4('0x4')),'defaultValue':_0x6fc4('0x3')},'serverUrl':{'type':Sequelize[_0x6fc4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6fc4('0x5')](_0x6fc4('0x6'),'newTab'),'defaultValue':_0x6fc4('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f80ed01..2c5f283 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 _0xb574=['slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','toString','base64','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','position','title','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','ZendeskConfiguration','options','length','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','remoteUri'];(function(_0x1908aa,_0x2c0338){var _0x1fb891=function(_0xf5ccca){while(--_0xf5ccca){_0x1908aa['push'](_0x1908aa['shift']());}};_0x1fb891(++_0x2c0338);}(_0xb574,0x106));var _0x4b57=function(_0x313f66,_0xdaa784){_0x313f66=_0x313f66-0x0;var _0x9a8191=_0xb574[_0x313f66];return _0x9a8191;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];var integrations=require(_0x4b57('0x16'));function respondWithStatusCode(_0x43d066,_0xf8a6fc){_0xf8a6fc=_0xf8a6fc||0xcc;return function(_0x607276){if(_0x607276){return _0x43d066[_0x4b57('0x17')](_0xf8a6fc);}return _0x43d066[_0x4b57('0x18')](_0xf8a6fc)[_0x4b57('0x19')]();};}function respondWithResult(_0x31cced,_0x4e15be){_0x4e15be=_0x4e15be||0xc8;return function(_0x4a58dc){if(_0x4a58dc){return _0x31cced[_0x4b57('0x18')](_0x4e15be)[_0x4b57('0x1a')](_0x4a58dc);}};}function respondWithFilteredResult(_0x10b9ff,_0x58d6bd){return function(_0x284640){if(_0x284640){var _0x48bd13=typeof _0x58d6bd[_0x4b57('0x1b')]===_0x4b57('0x1c')&&typeof _0x58d6bd[_0x4b57('0x1d')]===_0x4b57('0x1c');var _0x20cf5e=_0x284640[_0x4b57('0x1e')];var _0x4ede42=_0x48bd13?0x0:_0x58d6bd[_0x4b57('0x1b')];var _0x1a0b72=_0x48bd13?_0x284640[_0x4b57('0x1e')]:_0x58d6bd[_0x4b57('0x1b')]+_0x58d6bd['limit'];var _0xb62450;if(_0x1a0b72>=_0x20cf5e){_0x1a0b72=_0x20cf5e;_0xb62450=0xc8;}else{_0xb62450=0xce;}_0x10b9ff[_0x4b57('0x18')](_0xb62450);return _0x10b9ff[_0x4b57('0x1f')](_0x4b57('0x20'),_0x4ede42+'-'+_0x1a0b72+'/'+_0x20cf5e)[_0x4b57('0x1a')](_0x284640);}return null;};}function patchUpdates(_0x4454c8){return function(_0x4f407d){try{jsonpatch[_0x4b57('0x21')](_0x4f407d,_0x4454c8,!![]);}catch(_0x131fed){return BPromise[_0x4b57('0x22')](_0x131fed);}return _0x4f407d['save']();};}function saveUpdates(_0x380554,_0x4a34b2){return function(_0x286c7d){if(_0x286c7d){return _0x286c7d[_0x4b57('0x23')](_0x380554)['then'](function(_0x271361){return _0x271361;});}return null;};}function removeEntity(_0x368c5f,_0x4d07c9){return function(_0x3e7b96){if(_0x3e7b96){return _0x3e7b96[_0x4b57('0x24')]()[_0x4b57('0x25')](function(){_0x368c5f[_0x4b57('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156962,_0x51d0c3){return function(_0x131dab){if(!_0x131dab){_0x156962['sendStatus'](0x194);}return _0x131dab;};}function handleError(_0x36ceb1,_0x2dc9d8){_0x2dc9d8=_0x2dc9d8||0x1f4;return function(_0x4af2c8){logger[_0x4b57('0x26')](_0x4af2c8[_0x4b57('0x27')]);if(_0x4af2c8[_0x4b57('0x28')]){delete _0x4af2c8['name'];}_0x36ceb1['status'](_0x2dc9d8)[_0x4b57('0x29')](_0x4af2c8);};}exports['index']=function(_0x1ea0cb,_0x458f70){var _0x874cf7={},_0x3af22f={},_0x249461={'count':0x0,'rows':[]};var _0x2c20d2=_['map'](db[_0x4b57('0x2a')][_0x4b57('0x2b')],function(_0x68be27){return{'name':_0x68be27[_0x4b57('0x2c')],'type':_0x68be27['type'][_0x4b57('0x2d')]};});_0x3af22f[_0x4b57('0x2e')]=_['map'](_0x2c20d2,_0x4b57('0x28'));_0x3af22f[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x1ea0cb[_0x4b57('0x2f')]);_0x3af22f['filters']=_['intersection'](_0x3af22f['model'],_0x3af22f[_0x4b57('0x2f')]);_0x874cf7[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x3af22f[_0x4b57('0x2e')],qs[_0x4b57('0x33')](_0x1ea0cb['query'][_0x4b57('0x33')]));_0x874cf7[_0x4b57('0x31')]=_0x874cf7[_0x4b57('0x31')]['length']?_0x874cf7[_0x4b57('0x31')]:_0x3af22f[_0x4b57('0x2e')];if(!_0x1ea0cb[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x34'))){_0x874cf7[_0x4b57('0x1d')]=qs['limit'](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1d')]);_0x874cf7[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1b')]);}_0x874cf7['order']=qs[_0x4b57('0x35')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x35')]);_0x874cf7[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x1ea0cb[_0x4b57('0x2f')],_0x3af22f['filters']),_0x2c20d2);if(_0x1ea0cb['query'][_0x4b57('0x39')]){_0x874cf7[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x874cf7['where'],{'$or':_[_0x4b57('0x3b')](_0x2c20d2,function(_0x1a3c3a){if(_0x1a3c3a[_0x4b57('0x3c')]!==_0x4b57('0x3d')){var _0x5487cc={};_0x5487cc[_0x1a3c3a[_0x4b57('0x28')]]={'$like':'%'+_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x39')]+'%'};return _0x5487cc;}})});}_0x874cf7=_[_0x4b57('0x3a')]({},_0x874cf7,_0x1ea0cb['options']);var _0x5766a6={'where':_0x874cf7['where']};return db[_0x4b57('0x2a')][_0x4b57('0x1e')](_0x5766a6)[_0x4b57('0x25')](function(_0x2e23d3){_0x249461['count']=_0x2e23d3;if(_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x3e')]){_0x874cf7[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x2a')][_0x4b57('0x40')](_0x874cf7);})[_0x4b57('0x25')](function(_0x2d5a0c){_0x249461[_0x4b57('0x41')]=_0x2d5a0c;return _0x249461;})[_0x4b57('0x25')](respondWithFilteredResult(_0x458f70,_0x874cf7))['catch'](handleError(_0x458f70,null));};exports[_0x4b57('0x42')]=function(_0x3685fd,_0x3c5095){var _0x5b2f50={'raw':![],'where':{'id':_0x3685fd['params']['id']}},_0x44f988={};_0x44f988[_0x4b57('0x2e')]=_[_0x4b57('0x30')](db[_0x4b57('0x2a')][_0x4b57('0x2b')]);_0x44f988[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x3685fd[_0x4b57('0x2f')]);_0x44f988[_0x4b57('0x37')]=_[_0x4b57('0x32')](_0x44f988[_0x4b57('0x2e')],_0x44f988[_0x4b57('0x2f')]);_0x5b2f50[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x44f988['model'],qs['fields'](_0x3685fd[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x5b2f50[_0x4b57('0x31')]=_0x5b2f50[_0x4b57('0x31')]['length']?_0x5b2f50[_0x4b57('0x31')]:_0x44f988[_0x4b57('0x2e')];if(_0x3685fd['query'][_0x4b57('0x3e')]){_0x5b2f50['include']=[{'all':!![]}];}_0x5b2f50=_[_0x4b57('0x3a')]({},_0x5b2f50,_0x3685fd['options']);return db['ZendeskAccount'][_0x4b57('0x43')](_0x5b2f50)[_0x4b57('0x25')](handleEntityNotFound(_0x3c5095,null))['then'](respondWithResult(_0x3c5095,null))[_0x4b57('0x44')](handleError(_0x3c5095,null));};exports[_0x4b57('0x45')]=function(_0x2732ff,_0x1cf1f3){return db[_0x4b57('0x2a')][_0x4b57('0x45')](_0x2732ff['body'],{})[_0x4b57('0x25')](respondWithResult(_0x1cf1f3,0xc9))[_0x4b57('0x44')](handleError(_0x1cf1f3,null));};exports['update']=function(_0xd529fb,_0x23e852){if(_0xd529fb[_0x4b57('0x46')]['id']){delete _0xd529fb['body']['id'];}return db[_0x4b57('0x2a')]['find']({'where':{'id':_0xd529fb[_0x4b57('0x47')]['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x23e852,null))[_0x4b57('0x25')](saveUpdates(_0xd529fb[_0x4b57('0x46')],null))[_0x4b57('0x25')](respondWithResult(_0x23e852,null))[_0x4b57('0x44')](handleError(_0x23e852,null));};exports[_0x4b57('0x24')]=function(_0x3ec6ba,_0x5ab120){return db[_0x4b57('0x2a')][_0x4b57('0x43')]({'where':{'id':_0x3ec6ba[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ab120,null))[_0x4b57('0x25')](removeEntity(_0x5ab120,null))[_0x4b57('0x44')](handleError(_0x5ab120,null));};exports[_0x4b57('0x48')]=function(_0x488bea,_0x1579d1,_0x3d2336){var _0x343cec={};var _0xb56bf0={};var _0x44494f;var _0xb7c37c;return db[_0x4b57('0x2a')]['findOne']({'where':{'id':_0x488bea['params']['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x1579d1,null))[_0x4b57('0x25')](function(_0x3b4cbf){if(_0x3b4cbf){_0x44494f=_0x3b4cbf;_0xb56bf0[_0x4b57('0x2e')]=_['keys'](db[_0x4b57('0x49')][_0x4b57('0x2b')]);_0xb56bf0[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x488bea['query']);_0xb56bf0['filters']=_[_0x4b57('0x32')](_0xb56bf0[_0x4b57('0x2e')],_0xb56bf0['query']);_0x343cec['attributes']=_[_0x4b57('0x32')](_0xb56bf0['model'],qs[_0x4b57('0x33')](_0x488bea[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x343cec[_0x4b57('0x31')]=_0x343cec[_0x4b57('0x31')]['length']?_0x343cec['attributes']:_0xb56bf0['model'];_0x343cec['order']=qs[_0x4b57('0x35')](_0x488bea[_0x4b57('0x2f')]['sort']);_0x343cec[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x488bea[_0x4b57('0x2f')],_0xb56bf0[_0x4b57('0x37')]));if(_0x488bea[_0x4b57('0x2f')][_0x4b57('0x39')]){_0x343cec[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x343cec['where'],{'$or':_[_0x4b57('0x3b')](_0x343cec['attributes'],function(_0x10bd32){var _0x2f684b={};_0x2f684b[_0x10bd32]={'$like':'%'+_0x488bea['query'][_0x4b57('0x39')]+'%'};return _0x2f684b;})});}_0x343cec=_[_0x4b57('0x3a')]({},_0x343cec,_0x488bea[_0x4b57('0x4a')]);return _0x44494f[_0x4b57('0x48')](_0x343cec);}})[_0x4b57('0x25')](function(_0xc24706){if(_0xc24706){_0xb7c37c=_0xc24706[_0x4b57('0x4b')];if(!_0x488bea[_0x4b57('0x2f')][_0x4b57('0x4c')](_0x4b57('0x34'))){_0x343cec[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x488bea['query'][_0x4b57('0x1d')]);_0x343cec[_0x4b57('0x1b')]=qs['offset'](_0x488bea[_0x4b57('0x2f')]['offset']);}return _0x44494f['getConfigurations'](_0x343cec);}})['then'](function(_0x1004ac){if(_0x1004ac){return _0x1004ac?{'count':_0xb7c37c,'rows':_0x1004ac}:null;}})['then'](respondWithResult(_0x1579d1,null))[_0x4b57('0x44')](handleError(_0x1579d1,null));};exports[_0x4b57('0x4d')]=function(_0x5e093a,_0x4cc278,_0x264c9f){if(_0x5e093a[_0x4b57('0x46')]['id']){delete _0x5e093a[_0x4b57('0x46')]['id'];}return db['ZendeskAccount'][_0x4b57('0x4e')]({'where':{'id':_0x5e093a[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cc278,null))[_0x4b57('0x25')](function(_0x119933){if(_0x119933){_0x5e093a['body'][_0x4b57('0x4f')]=_0x119933['id'];_0x5e093a[_0x4b57('0x46')][_0x4b57('0x50')]=integrations[_0x4b57('0x51')](_0x5e093a[_0x4b57('0x46')][_0x4b57('0x52')],_0x5e093a[_0x4b57('0x46')]['type']);_0x5e093a['body'][_0x4b57('0x53')]=integrations[_0x4b57('0x54')](_0x5e093a['body']['channel'],_0x5e093a[_0x4b57('0x46')][_0x4b57('0x3c')]);return db['ZendeskConfiguration']['create'](_0x5e093a['body'],{'include':[{'model':db[_0x4b57('0x55')],'as':_0x4b57('0x50')},{'model':db[_0x4b57('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4cc278,null))['catch'](handleError(_0x4cc278,null));};exports[_0x4b57('0x56')]=function(_0x59cd7c,_0x40cabe,_0x502313){var _0x13c680='';return db[_0x4b57('0x2a')][_0x4b57('0x4e')]({'where':{'id':_0x59cd7c[_0x4b57('0x47')]['id']},'attributes':['id','username',_0x4b57('0x57'),'token','authType',_0x4b57('0x58')]})[_0x4b57('0x25')](handleEntityNotFound(_0x40cabe,null))['then'](function(_0xf54f38){if(_0xf54f38){_0x13c680=_0xf54f38[_0x4b57('0x58')];var _0x355b5b=_0x13c680[_0x4b57('0x59')](-0x1);if(_0x355b5b==='/'){_0x13c680=_0x13c680[_0x4b57('0x5a')](0x0,_0x13c680[_0x4b57('0x5b')](_0x355b5b));}var _0x57e9eb={'method':_0x4b57('0x5c'),'uri':util[_0x4b57('0x5d')](_0x4b57('0x5e'),_0x13c680,_0x4b57('0x5f')),'json':!![]};switch(_0xf54f38[_0x4b57('0x60')]){case'password':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util[_0x4b57('0x5d')](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x57')]))[_0x4b57('0x63')](_0x4b57('0x64')))};break;case'token':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util['format'](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s/token:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x65')]))['toString'](_0x4b57('0x64')))};break;default:throw new db[(_0x4b57('0x66'))][(_0x4b57('0x67'))](_0x4b57('0x68'));}return rp(_0x57e9eb);}})[_0x4b57('0x25')](function(_0x489f3c){if(_0x489f3c){var _0x137532=[_0x4b57('0x69'),_0x4b57('0x6a'),'group','assignee'];_[_0x4b57('0x6b')](_0x489f3c[_0x4b57('0x5f')],function(_0x540a0a){return _0x137532[_0x4b57('0x6c')](_0x540a0a[_0x4b57('0x3c')]);});return{'count':_0x489f3c['ticket_fields'][_0x4b57('0x4b')],'rows':_[_0x4b57('0x3b')](_0x489f3c['ticket_fields'],function(_0xdef470){return{'id':_0xdef470['id'],'name':_0xdef470[_0x4b57('0x6d')]>0x7?_0xdef470[_0x4b57('0x6e')]:_0xdef470['type'],'custom':_0xdef470[_0x4b57('0x6d')]>0x7?!![]:![],'options':_0xdef470[_0x4b57('0x6f')]?_0xdef470[_0x4b57('0x6f')]:_0xdef470[_0x4b57('0x70')]?_0xdef470[_0x4b57('0x70')]:[]};})};}})[_0x4b57('0x25')](respondWithResult(_0x40cabe,null))[_0x4b57('0x44')](function(_0x4e4bbd){var _0x183b8c=_0x59cd7c[_0x4b57('0x2f')]['test']?0x1f4:_0x4e4bbd[_0x4b57('0x71')]||0x1f4;logger[_0x4b57('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4b57('0x56'),_0x183b8c,JSON[_0x4b57('0x72')](_0x4e4bbd));delete _0x4e4bbd[_0x4b57('0x28')];if(_0x183b8c===0x191){_0x183b8c=0x190;}_0x40cabe[_0x4b57('0x18')](_0x183b8c)[_0x4b57('0x29')](_0x59cd7c[_0x4b57('0x2f')][_0x4b57('0x73')]?{'message':_0x4b57('0x74'),'statusCode':_0x4e4bbd[_0x4b57('0x71')]}:_0x4e4bbd);});}; \ No newline at end of file +var _0x96cc=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','ZendeskAccount','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','body','ZendeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee'];(function(_0x2166a5,_0x1c16d4){var _0x54af95=function(_0x2fc2be){while(--_0x2fc2be){_0x2166a5['push'](_0x2166a5['shift']());}};_0x54af95(++_0x1c16d4);}(_0x96cc,0x16c));var _0xc96c=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x96cc[_0xbc346f];return _0x9f9260;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];var integrations=require(_0xc96c('0x19'));function respondWithStatusCode(_0x5f27f3,_0x3fe3d5){_0x3fe3d5=_0x3fe3d5||0xcc;return function(_0x43fcaa){if(_0x43fcaa){return _0x5f27f3[_0xc96c('0x1a')](_0x3fe3d5);}return _0x5f27f3[_0xc96c('0x1b')](_0x3fe3d5)['end']();};}function respondWithResult(_0x35da94,_0xbed0c9){_0xbed0c9=_0xbed0c9||0xc8;return function(_0x399267){if(_0x399267){return _0x35da94[_0xc96c('0x1b')](_0xbed0c9)[_0xc96c('0x1c')](_0x399267);}};}function respondWithFilteredResult(_0x46455a,_0x1765d9){return function(_0x23e357){if(_0x23e357){var _0x174852=typeof _0x1765d9[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x1765d9['limit']==='undefined';var _0x406791=_0x23e357[_0xc96c('0x1f')];var _0x16b6ce=_0x174852?0x0:_0x1765d9[_0xc96c('0x1d')];var _0x4aa6a3=_0x174852?_0x23e357[_0xc96c('0x1f')]:_0x1765d9[_0xc96c('0x1d')]+_0x1765d9[_0xc96c('0x20')];var _0x3c0864;if(_0x4aa6a3>=_0x406791){_0x4aa6a3=_0x406791;_0x3c0864=0xc8;}else{_0x3c0864=0xce;}_0x46455a[_0xc96c('0x1b')](_0x3c0864);return _0x46455a[_0xc96c('0x21')](_0xc96c('0x22'),_0x16b6ce+'-'+_0x4aa6a3+'/'+_0x406791)[_0xc96c('0x1c')](_0x23e357);}return null;};}function patchUpdates(_0x28d762){return function(_0x2f25a3){try{jsonpatch[_0xc96c('0x23')](_0x2f25a3,_0x28d762,!![]);}catch(_0x1203a1){return BPromise[_0xc96c('0x24')](_0x1203a1);}return _0x2f25a3[_0xc96c('0x25')]();};}function saveUpdates(_0x325c54,_0x3b5c6c){return function(_0x3e2615){if(_0x3e2615){return _0x3e2615['update'](_0x325c54)[_0xc96c('0x26')](function(_0x4be783){return _0x4be783;});}return null;};}function removeEntity(_0x4456bf,_0x10ae21){return function(_0x2b1df9){if(_0x2b1df9){return _0x2b1df9[_0xc96c('0x27')]()[_0xc96c('0x26')](function(){_0x4456bf[_0xc96c('0x1b')](0xcc)[_0xc96c('0x28')]();});}};}function handleEntityNotFound(_0x14f171,_0x50fc07){return function(_0x3a23cb){if(!_0x3a23cb){_0x14f171[_0xc96c('0x1a')](0x194);}return _0x3a23cb;};}function handleError(_0x3f87cc,_0x294fee){_0x294fee=_0x294fee||0x1f4;return function(_0x58fab3){logger['error'](_0x58fab3[_0xc96c('0x29')]);if(_0x58fab3[_0xc96c('0x2a')]){delete _0x58fab3[_0xc96c('0x2a')];}_0x3f87cc[_0xc96c('0x1b')](_0x294fee)[_0xc96c('0x2b')](_0x58fab3);};}exports[_0xc96c('0x2c')]=function(_0x427cb2,_0x1c911b){var _0xa0efbc={},_0x27925f={},_0x325cda={'count':0x0,'rows':[]};var _0x40c72b=_[_0xc96c('0x2d')](db[_0xc96c('0x2e')]['rawAttributes'],function(_0x3aa436){return{'name':_0x3aa436['fieldName'],'type':_0x3aa436[_0xc96c('0x2f')][_0xc96c('0x30')]};});_0x27925f[_0xc96c('0x31')]=_['map'](_0x40c72b,_0xc96c('0x2a'));_0x27925f[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x427cb2[_0xc96c('0x32')]);_0x27925f['filters']=_['intersection'](_0x27925f[_0xc96c('0x31')],_0x27925f[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0x27925f[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x35')]));_0xa0efbc['attributes']=_0xa0efbc[_0xc96c('0x34')][_0xc96c('0x36')]?_0xa0efbc['attributes']:_0x27925f[_0xc96c('0x31')];if(!_0x427cb2[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0xa0efbc[_0xc96c('0x20')]=qs[_0xc96c('0x20')](_0x427cb2['query'][_0xc96c('0x20')]);_0xa0efbc[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0xa0efbc[_0xc96c('0x39')]=qs['sort'](_0x427cb2['query'][_0xc96c('0x3a')]);_0xa0efbc[_0xc96c('0x3b')]=qs['filters'](_['pick'](_0x427cb2[_0xc96c('0x32')],_0x27925f[_0xc96c('0x3c')]),_0x40c72b);if(_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]){_0xa0efbc[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0xa0efbc[_0xc96c('0x3b')],{'$or':_[_0xc96c('0x2d')](_0x40c72b,function(_0x3fc40d){if(_0x3fc40d[_0xc96c('0x2f')]!==_0xc96c('0x3f')){var _0x5ed343={};_0x5ed343[_0x3fc40d[_0xc96c('0x2a')]]={'$like':'%'+_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]+'%'};return _0x5ed343;}})});}_0xa0efbc=_[_0xc96c('0x3e')]({},_0xa0efbc,_0x427cb2['options']);var _0x167671={'where':_0xa0efbc[_0xc96c('0x3b')]};return db[_0xc96c('0x2e')]['count'](_0x167671)['then'](function(_0x311a9e){_0x325cda[_0xc96c('0x1f')]=_0x311a9e;if(_0x427cb2[_0xc96c('0x32')]['includeAll']){_0xa0efbc[_0xc96c('0x40')]=[{'all':!![]}];}return db[_0xc96c('0x2e')][_0xc96c('0x41')](_0xa0efbc);})[_0xc96c('0x26')](function(_0x1790a8){_0x325cda[_0xc96c('0x42')]=_0x1790a8;return _0x325cda;})[_0xc96c('0x26')](respondWithFilteredResult(_0x1c911b,_0xa0efbc))[_0xc96c('0x43')](handleError(_0x1c911b,null));};exports[_0xc96c('0x44')]=function(_0x4d5a1b,_0x4c3088){var _0x30b3ac={'raw':![],'where':{'id':_0x4d5a1b[_0xc96c('0x45')]['id']}},_0x2199c4={};_0x2199c4[_0xc96c('0x31')]=_['keys'](db['ZendeskAccount'][_0xc96c('0x46')]);_0x2199c4[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x4d5a1b[_0xc96c('0x32')]);_0x2199c4[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],_0x2199c4['query']);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x4d5a1b['query']['fields']));_0x30b3ac[_0xc96c('0x34')]=_0x30b3ac[_0xc96c('0x34')][_0xc96c('0x36')]?_0x30b3ac[_0xc96c('0x34')]:_0x2199c4[_0xc96c('0x31')];if(_0x4d5a1b[_0xc96c('0x32')][_0xc96c('0x48')]){_0x30b3ac[_0xc96c('0x40')]=[{'all':!![]}];}_0x30b3ac=_[_0xc96c('0x3e')]({},_0x30b3ac,_0x4d5a1b[_0xc96c('0x49')]);return db[_0xc96c('0x2e')][_0xc96c('0x4a')](_0x30b3ac)[_0xc96c('0x26')](handleEntityNotFound(_0x4c3088,null))['then'](respondWithResult(_0x4c3088,null))[_0xc96c('0x43')](handleError(_0x4c3088,null));};exports[_0xc96c('0x4b')]=function(_0x307d58,_0x305ebd){return db['ZendeskAccount'][_0xc96c('0x4b')](_0x307d58['body'],{})[_0xc96c('0x26')](respondWithResult(_0x305ebd,0xc9))[_0xc96c('0x43')](handleError(_0x305ebd,null));};exports['update']=function(_0x2581ae,_0x400fe6){if(_0x2581ae[_0xc96c('0x4c')]['id']){delete _0x2581ae[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x2581ae['params']['id']}})['then'](handleEntityNotFound(_0x400fe6,null))['then'](saveUpdates(_0x2581ae[_0xc96c('0x4c')],null))['then'](respondWithResult(_0x400fe6,null))[_0xc96c('0x43')](handleError(_0x400fe6,null));};exports[_0xc96c('0x27')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x65a0a7[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x17c764,null))[_0xc96c('0x26')](removeEntity(_0x17c764,null))[_0xc96c('0x43')](handleError(_0x17c764,null));};exports['getConfigurations']=function(_0x3adefb,_0x15367d,_0x2b58c1){var _0x215cad={};var _0x1c7ea7={};var _0xcde9;var _0xad88c3;return db[_0xc96c('0x2e')]['findOne']({'where':{'id':_0x3adefb['params']['id']}})['then'](handleEntityNotFound(_0x15367d,null))['then'](function(_0x356ef3){if(_0x356ef3){_0xcde9=_0x356ef3;_0x1c7ea7[_0xc96c('0x31')]=_[_0xc96c('0x33')](db[_0xc96c('0x4d')][_0xc96c('0x46')]);_0x1c7ea7[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x3adefb['query']);_0x1c7ea7[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],_0x1c7ea7[_0xc96c('0x32')]);_0x215cad[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],qs['fields'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x35')]));_0x215cad[_0xc96c('0x34')]=_0x215cad[_0xc96c('0x34')][_0xc96c('0x36')]?_0x215cad[_0xc96c('0x34')]:_0x1c7ea7[_0xc96c('0x31')];_0x215cad[_0xc96c('0x39')]=qs[_0xc96c('0x3a')](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3a')]);_0x215cad[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_[_0xc96c('0x4e')](_0x3adefb['query'],_0x1c7ea7[_0xc96c('0x3c')]));if(_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3d')]){_0x215cad[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0x215cad['where'],{'$or':_[_0xc96c('0x2d')](_0x215cad[_0xc96c('0x34')],function(_0x9cd1fd){var _0x12bf27={};_0x12bf27[_0x9cd1fd]={'$like':'%'+_0x3adefb['query'][_0xc96c('0x3d')]+'%'};return _0x12bf27;})});}_0x215cad=_[_0xc96c('0x3e')]({},_0x215cad,_0x3adefb['options']);return _0xcde9['getConfigurations'](_0x215cad);}})['then'](function(_0x46de63){if(_0x46de63){_0xad88c3=_0x46de63[_0xc96c('0x36')];if(!_0x3adefb[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0x215cad['limit']=qs['limit'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x20')]);_0x215cad[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x3adefb[_0xc96c('0x32')]['offset']);}return _0xcde9[_0xc96c('0x4f')](_0x215cad);}})[_0xc96c('0x26')](function(_0x3a31bd){if(_0x3a31bd){return _0x3a31bd?{'count':_0xad88c3,'rows':_0x3a31bd}:null;}})[_0xc96c('0x26')](respondWithResult(_0x15367d,null))['catch'](handleError(_0x15367d,null));};exports['addConfiguration']=function(_0x443ed5,_0x229fae,_0x55bab7){if(_0x443ed5[_0xc96c('0x4c')]['id']){delete _0x443ed5['body']['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x50')]({'where':{'id':_0x443ed5[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x229fae,null))[_0xc96c('0x26')](function(_0x296e7d){if(_0x296e7d){_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x51')]=_0x296e7d['id'];_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x52')]=integrations['getSubjects'](_0x443ed5[_0xc96c('0x4c')]['channel'],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);_0x443ed5['body'][_0xc96c('0x53')]=integrations['getDescriptions'](_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x54')],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);return db[_0xc96c('0x4d')][_0xc96c('0x4b')](_0x443ed5[_0xc96c('0x4c')],{'include':[{'model':db[_0xc96c('0x55')],'as':_0xc96c('0x52')},{'model':db['ZendeskField'],'as':_0xc96c('0x53')}]});}return null;})[_0xc96c('0x26')](respondWithResult(_0x229fae,null))[_0xc96c('0x43')](handleError(_0x229fae,null));};exports[_0xc96c('0x56')]=function(_0x5282cb,_0x4667f6,_0x1e927d){var _0x54f3fe='';return db['ZendeskAccount'][_0xc96c('0x50')]({'where':{'id':_0x5282cb['params']['id']},'attributes':['id',_0xc96c('0x57'),_0xc96c('0x58'),_0xc96c('0x59'),_0xc96c('0x5a'),_0xc96c('0x5b')]})[_0xc96c('0x26')](handleEntityNotFound(_0x4667f6,null))[_0xc96c('0x26')](function(_0x3fb9b9){if(_0x3fb9b9){_0x54f3fe=_0x3fb9b9[_0xc96c('0x5b')];var _0x54e2d3=_0x54f3fe[_0xc96c('0x5c')](-0x1);if(_0x54e2d3==='/'){_0x54f3fe=_0x54f3fe[_0xc96c('0x5d')](0x0,_0x54f3fe[_0xc96c('0x5e')](_0x54e2d3));}var _0x4831d3={'method':'GET','uri':util[_0xc96c('0x5f')](_0xc96c('0x60'),_0x54f3fe,_0xc96c('0x61')),'json':!![]};switch(_0x3fb9b9[_0xc96c('0x5a')]){case _0xc96c('0x58'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')]('Basic\x20%s',new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x63'),_0x3fb9b9['username'],_0x3fb9b9[_0xc96c('0x58')]))['toString'](_0xc96c('0x64')))};break;case _0xc96c('0x59'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')](_0xc96c('0x65'),new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x66'),_0x3fb9b9[_0xc96c('0x57')],_0x3fb9b9[_0xc96c('0x59')]))['toString'](_0xc96c('0x64')))};break;default:throw new db[(_0xc96c('0x67'))]['ValidationError'](_0xc96c('0x68'));}return rp(_0x4831d3);}})['then'](function(_0x3c0363){if(_0x3c0363){var _0x669dec=[_0xc96c('0x69'),'description',_0xc96c('0x6a'),_0xc96c('0x6b')];_['remove'](_0x3c0363[_0xc96c('0x61')],function(_0x46bf83){return _0x669dec[_0xc96c('0x6c')](_0x46bf83['type']);});return{'count':_0x3c0363[_0xc96c('0x61')][_0xc96c('0x36')],'rows':_[_0xc96c('0x2d')](_0x3c0363[_0xc96c('0x61')],function(_0x2f4254){return{'id':_0x2f4254['id'],'name':_0x2f4254[_0xc96c('0x6d')]>0x7?_0x2f4254[_0xc96c('0x6e')]:_0x2f4254[_0xc96c('0x2f')],'custom':_0x2f4254[_0xc96c('0x6d')]>0x7?!![]:![],'options':_0x2f4254[_0xc96c('0x6f')]?_0x2f4254[_0xc96c('0x6f')]:_0x2f4254[_0xc96c('0x70')]?_0x2f4254[_0xc96c('0x70')]:[]};})};}})[_0xc96c('0x26')](respondWithResult(_0x4667f6,null))[_0xc96c('0x43')](function(_0x54c9ad){var _0x2c5134=_0x5282cb[_0xc96c('0x32')][_0xc96c('0x71')]?0x1f4:_0x54c9ad[_0xc96c('0x72')]||0x1f4;logger[_0xc96c('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xc96c('0x56'),_0x2c5134,JSON[_0xc96c('0x74')](_0x54c9ad));delete _0x54c9ad[_0xc96c('0x2a')];if(_0x2c5134===0x191){_0x2c5134=0x190;}_0x4667f6[_0xc96c('0x1b')](_0x2c5134)[_0xc96c('0x2b')](_0x5282cb['query']['test']?{'message':_0xc96c('0x75'),'statusCode':_0x54c9ad[_0xc96c('0x72')]}:_0x54c9ad);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a53d6ba..ac59c75 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 _0x775b=['int_zendesk_accounts','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x775b,0x1c9));var _0xb775=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0x775b[_0x26c12e];return _0xbab0c7;};'use strict';var _=require('lodash');var util=require(_0xb775('0x0'));var logger=require(_0xb775('0x1'))('api');var moment=require(_0xb775('0x2'));var BPromise=require(_0xb775('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb775('0x4'));var rimraf=require(_0xb775('0x5'));var config=require(_0xb775('0x6'));var attributes=require(_0xb775('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb775('0x8')]=function(_0x524a5a,_0x5af045){return _0x524a5a[_0xb775('0x9')](_0xb775('0xa'),attributes,{'tableName':_0xb775('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x128c=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x128c,0x104));var _0xc128=function(_0x391632,_0x417830){_0x391632=_0x391632-0x0;var _0xf34d79=_0x128c[_0x391632];return _0xf34d79;};'use strict';var _=require('lodash');var util=require(_0xc128('0x0'));var logger=require(_0xc128('0x1'))('api');var moment=require(_0xc128('0x2'));var BPromise=require(_0xc128('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc128('0x4'));var config=require(_0xc128('0x5'));var attributes=require(_0xc128('0x6'));var integrations=require(_0xc128('0x7'));module['exports']=function(_0x33632d,_0x51291b){return _0x33632d[_0xc128('0x8')]('ZendeskAccount',attributes,{'tableName':_0xc128('0x9'),'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 16e64a3..7e3373f 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 _0xe66c=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','raw','options','attributes','limit','include','map','model','ShowZendeskAccount','find','where','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe66c,0x12b));var _0xce66=function(_0x3d5dbf,_0x451103){_0x3d5dbf=_0x3d5dbf-0x0;var _0x5bcf9a=_0xe66c[_0x3d5dbf];return _0x5bcf9a;};'use strict';var _=require('lodash');var util=require(_0xce66('0x0'));var moment=require(_0xce66('0x1'));var BPromise=require(_0xce66('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce66('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce66('0x4'));var logger=require('../../config/logger')(_0xce66('0x5'));var config=require('../../config/environment');var jayson=require(_0xce66('0x6'));var client=jayson[_0xce66('0x7')][_0xce66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2767d7,_0x2a6df9,_0x5a38a4){return new BPromise(function(_0x156d97,_0x155ad3){return client[_0xce66('0x9')](_0x2767d7,_0x5a38a4)[_0xce66('0xa')](function(_0x8f77e1){logger[_0xce66('0xb')](_0xce66('0xc'),_0x2a6df9,_0xce66('0xd'));logger[_0xce66('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6df9,_0xce66('0xd'),JSON[_0xce66('0xf')](_0x8f77e1));if(_0x8f77e1[_0xce66('0x10')]){if(_0x8f77e1['error'][_0xce66('0x11')]===0x1f4){logger[_0xce66('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x2a6df9,_0x8f77e1[_0xce66('0x10')]['message']);return _0x155ad3(_0x8f77e1[_0xce66('0x10')][_0xce66('0x12')]);}logger[_0xce66('0x10')](_0xce66('0xc'),_0x2a6df9,_0x8f77e1[_0xce66('0x10')][_0xce66('0x12')]);return _0x156d97(_0x8f77e1['error'][_0xce66('0x12')]);}else{logger[_0xce66('0xb')](_0xce66('0xc'),_0x2a6df9,_0xce66('0xd'));_0x156d97(_0x8f77e1[_0xce66('0x13')][_0xce66('0x12')]);}})[_0xce66('0x14')](function(_0x338984){logger[_0xce66('0x10')](_0xce66('0xc'),_0x2a6df9,_0x338984);_0x155ad3(_0x338984);});});}exports[_0xce66('0x15')]=function(_0x54492d){var _0x24de0d=this;return new Promise(function(_0x366257,_0x29e384){return db[_0xce66('0x16')][_0xce66('0x17')]({'raw':_0x54492d['options']?_0x54492d['options'][_0xce66('0x18')]===undefined?!![]:![]:!![],'where':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')]['where']||null:null,'attributes':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')][_0xce66('0x1a')]||null:null,'limit':_0x54492d['options']?_0x54492d[_0xce66('0x19')][_0xce66('0x1b')]||null:null,'include':_0x54492d[_0xce66('0x19')]?_0x54492d[_0xce66('0x19')][_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x54492d[_0xce66('0x19')]['include'],function(_0x3ebef3){return{'model':db[_0x3ebef3[_0xce66('0x1e')]],'as':_0x3ebef3['as'],'attributes':_0x3ebef3['attributes'],'include':_0x3ebef3[_0xce66('0x1c')]?_['map'](_0x3ebef3['include'],function(_0x553adb){return{'model':db[_0x553adb['model']],'as':_0x553adb['as'],'attributes':_0x553adb[_0xce66('0x1a')],'include':_0x553adb['include']?_[_0xce66('0x1d')](_0x553adb[_0xce66('0x1c')],function(_0x1b3d6b){return{'model':db[_0x1b3d6b[_0xce66('0x1e')]],'as':_0x1b3d6b['as'],'attributes':_0x1b3d6b[_0xce66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xce66('0xa')](function(_0x47b2d0){logger['info'](_0xce66('0x15'),_0x54492d);logger[_0xce66('0xe')](_0xce66('0x15'),_0x54492d,JSON[_0xce66('0xf')](_0x47b2d0));_0x366257(_0x47b2d0);})[_0xce66('0x14')](function(_0x542c09){logger[_0xce66('0x10')](_0xce66('0x15'),_0x542c09[_0xce66('0x12')],_0x54492d);_0x29e384(_0x24de0d['error'](0x1f4,_0x542c09['message']));});});};exports[_0xce66('0x1f')]=function(_0x1ad10b){var _0x18aa03=this;return new Promise(function(_0x40ea81,_0x29b6f3){return db[_0xce66('0x16')][_0xce66('0x20')]({'raw':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b[_0xce66('0x19')][_0xce66('0x18')]===undefined?!![]:![]:!![],'where':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b['options'][_0xce66('0x21')]||null:null,'attributes':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b[_0xce66('0x19')][_0xce66('0x1a')]||null:null,'include':_0x1ad10b[_0xce66('0x19')]?_0x1ad10b['options'][_0xce66('0x1c')]?_['map'](_0x1ad10b['options'][_0xce66('0x1c')],function(_0x623e68){return{'model':db[_0x623e68[_0xce66('0x1e')]],'as':_0x623e68['as'],'attributes':_0x623e68[_0xce66('0x1a')],'include':_0x623e68[_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x623e68[_0xce66('0x1c')],function(_0x137844){return{'model':db[_0x137844[_0xce66('0x1e')]],'as':_0x137844['as'],'attributes':_0x137844[_0xce66('0x1a')],'include':_0x137844[_0xce66('0x1c')]?_[_0xce66('0x1d')](_0x137844[_0xce66('0x1c')],function(_0x905fac){return{'model':db[_0x905fac[_0xce66('0x1e')]],'as':_0x905fac['as'],'attributes':_0x905fac[_0xce66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xce66('0xa')](function(_0x51733b){logger[_0xce66('0xb')](_0xce66('0x1f'),_0x1ad10b);logger['debug'](_0xce66('0x1f'),_0x1ad10b,JSON[_0xce66('0xf')](_0x51733b));_0x40ea81(_0x51733b);})[_0xce66('0x14')](function(_0x593aea){logger[_0xce66('0x10')](_0xce66('0x1f'),_0x593aea[_0xce66('0x12')],_0x1ad10b);_0x29b6f3(_0x18aa03[_0xce66('0x10')](0x1f4,_0x593aea[_0xce66('0x12')]));});});}; \ No newline at end of file +var _0x7b70=['model','debug','GetZendeskAccount','stringify','catch','find','where','then','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','ZendeskAccount','options','raw','attributes','limit','include','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b70,0x1f3));var _0x07b7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7b70[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var moment=require(_0x07b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x07b7('0x3'));var fs=require('fs');var Redis=require(_0x07b7('0x4'));var db=require(_0x07b7('0x5'))['db'];var utils=require(_0x07b7('0x6'));var logger=require(_0x07b7('0x7'))(_0x07b7('0x8'));var config=require(_0x07b7('0x9'));var jayson=require(_0x07b7('0xa'));var client=jayson[_0x07b7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58519f,_0x491352,_0x3340fd){return new BPromise(function(_0x278847,_0x53e711){return client['request'](_0x58519f,_0x3340fd)['then'](function(_0x3a1990){logger[_0x07b7('0xc')](_0x07b7('0xd'),_0x491352,_0x07b7('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x491352,_0x07b7('0xe'),JSON['stringify'](_0x3a1990));if(_0x3a1990[_0x07b7('0xf')]){if(_0x3a1990[_0x07b7('0xf')][_0x07b7('0x10')]===0x1f4){logger[_0x07b7('0xf')](_0x07b7('0xd'),_0x491352,_0x3a1990[_0x07b7('0xf')][_0x07b7('0x11')]);return _0x53e711(_0x3a1990['error'][_0x07b7('0x11')]);}logger[_0x07b7('0xf')](_0x07b7('0xd'),_0x491352,_0x3a1990[_0x07b7('0xf')][_0x07b7('0x11')]);return _0x278847(_0x3a1990['error']['message']);}else{logger[_0x07b7('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x491352,_0x07b7('0xe'));_0x278847(_0x3a1990[_0x07b7('0x12')][_0x07b7('0x11')]);}})['catch'](function(_0x80d0a8){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x491352,_0x80d0a8);_0x53e711(_0x80d0a8);});});}exports['GetZendeskAccount']=function(_0x57de21){var _0xabb34a=this;return new Promise(function(_0xe1ee81,_0x452522){return db[_0x07b7('0x13')]['findAll']({'raw':_0x57de21[_0x07b7('0x14')]?_0x57de21[_0x07b7('0x14')][_0x07b7('0x15')]===undefined?!![]:![]:!![],'where':_0x57de21[_0x07b7('0x14')]?_0x57de21[_0x07b7('0x14')]['where']||null:null,'attributes':_0x57de21[_0x07b7('0x14')]?_0x57de21['options'][_0x07b7('0x16')]||null:null,'limit':_0x57de21[_0x07b7('0x14')]?_0x57de21[_0x07b7('0x14')][_0x07b7('0x17')]||null:null,'include':_0x57de21[_0x07b7('0x14')]?_0x57de21[_0x07b7('0x14')][_0x07b7('0x18')]?_[_0x07b7('0x19')](_0x57de21[_0x07b7('0x14')][_0x07b7('0x18')],function(_0x33f8db){return{'model':db[_0x33f8db[_0x07b7('0x1a')]],'as':_0x33f8db['as'],'attributes':_0x33f8db[_0x07b7('0x16')],'include':_0x33f8db[_0x07b7('0x18')]?_[_0x07b7('0x19')](_0x33f8db[_0x07b7('0x18')],function(_0x5e1828){return{'model':db[_0x5e1828['model']],'as':_0x5e1828['as'],'attributes':_0x5e1828[_0x07b7('0x16')],'include':_0x5e1828[_0x07b7('0x18')]?_[_0x07b7('0x19')](_0x5e1828[_0x07b7('0x18')],function(_0x320ef4){return{'model':db[_0x320ef4[_0x07b7('0x1a')]],'as':_0x320ef4['as'],'attributes':_0x320ef4[_0x07b7('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52bbbe){logger[_0x07b7('0xc')]('GetZendeskAccount',_0x57de21);logger[_0x07b7('0x1b')](_0x07b7('0x1c'),_0x57de21,JSON[_0x07b7('0x1d')](_0x52bbbe));_0xe1ee81(_0x52bbbe);})[_0x07b7('0x1e')](function(_0x3805c8){logger[_0x07b7('0xf')]('GetZendeskAccount',_0x3805c8[_0x07b7('0x11')],_0x57de21);_0x452522(_0xabb34a[_0x07b7('0xf')](0x1f4,_0x3805c8[_0x07b7('0x11')]));});});};exports['ShowZendeskAccount']=function(_0xf69b8f){var _0xeed7e4=this;return new Promise(function(_0x474445,_0x8499fa){return db[_0x07b7('0x13')][_0x07b7('0x1f')]({'raw':_0xf69b8f[_0x07b7('0x14')]?_0xf69b8f[_0x07b7('0x14')][_0x07b7('0x15')]===undefined?!![]:![]:!![],'where':_0xf69b8f[_0x07b7('0x14')]?_0xf69b8f[_0x07b7('0x14')][_0x07b7('0x20')]||null:null,'attributes':_0xf69b8f[_0x07b7('0x14')]?_0xf69b8f['options']['attributes']||null:null,'include':_0xf69b8f['options']?_0xf69b8f[_0x07b7('0x14')][_0x07b7('0x18')]?_['map'](_0xf69b8f['options'][_0x07b7('0x18')],function(_0x1cd397){return{'model':db[_0x1cd397['model']],'as':_0x1cd397['as'],'attributes':_0x1cd397[_0x07b7('0x16')],'include':_0x1cd397['include']?_['map'](_0x1cd397[_0x07b7('0x18')],function(_0x22d2f6){return{'model':db[_0x22d2f6[_0x07b7('0x1a')]],'as':_0x22d2f6['as'],'attributes':_0x22d2f6[_0x07b7('0x16')],'include':_0x22d2f6['include']?_[_0x07b7('0x19')](_0x22d2f6[_0x07b7('0x18')],function(_0x39b07e){return{'model':db[_0x39b07e['model']],'as':_0x39b07e['as'],'attributes':_0x39b07e[_0x07b7('0x16')]};}):[]};}):[]};}):[]:[]})[_0x07b7('0x21')](function(_0x4e3824){logger[_0x07b7('0xc')](_0x07b7('0x22'),_0xf69b8f);logger[_0x07b7('0x1b')](_0x07b7('0x22'),_0xf69b8f,JSON[_0x07b7('0x1d')](_0x4e3824));_0x474445(_0x4e3824);})[_0x07b7('0x1e')](function(_0x274dbf){logger[_0x07b7('0xf')]('ShowZendeskAccount',_0x274dbf['message'],_0xf69b8f);_0x8499fa(_0xeed7e4[_0x07b7('0xf')](0x1f4,_0x274dbf[_0x07b7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index f0395f5..f1d12a4 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 _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0x4024,0x89));var _0x4402=function(_0x58b920,_0x204a5d){_0x58b920=_0x58b920-0x0;var _0x22a99b=_0x4024[_0x58b920];return _0x22a99b;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x1751a5,_0x2e7a8b){var _0x2d5c76=function(_0x3f49b9){while(--_0x3f49b9){_0x1751a5['push'](_0x1751a5['shift']());}};_0x2d5c76(++_0x2e7a8b);}(_0x087b,0x11a));var _0xb087=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x087b[_0x24f31b];return _0x488401;};'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/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 76afd63..480278c 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 _0xd453=['exports','STRING','sequelize'];(function(_0x44025b,_0x51e124){var _0x3d62d5=function(_0x23dc38){while(--_0x23dc38){_0x44025b['push'](_0x44025b['shift']());}};_0x3d62d5(++_0x51e124);}(_0xd453,0xce));var _0x3d45=function(_0x35863f,_0x4f3a04){_0x35863f=_0x35863f-0x0;var _0x35a567=_0xd453[_0x35863f];return _0x35a567;};'use strict';var Sequelize=require(_0x3d45('0x0'));module[_0x3d45('0x1')]={'name':{'type':Sequelize[_0x3d45('0x2')]},'description':{'type':Sequelize[_0x3d45('0x2')]}}; \ No newline at end of file +var _0xb48a=['exports','STRING','sequelize'];(function(_0x4c91e3,_0x234e6c){var _0x3a8e1b=function(_0x4b80bf){while(--_0x4b80bf){_0x4c91e3['push'](_0x4c91e3['shift']());}};_0x3a8e1b(++_0x234e6c);}(_0xb48a,0xfb));var _0xab48=function(_0x4b4adf,_0x4707ff){_0x4b4adf=_0x4b4adf-0x0;var _0x49d5a8=_0xb48a[_0x4b4adf];return _0x49d5a8;};'use strict';var Sequelize=require(_0xab48('0x0'));module[_0xab48('0x1')]={'name':{'type':Sequelize[_0xab48('0x2')]},'description':{'type':Sequelize[_0xab48('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7f10fcf..1bc8231 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 _0x6704=['Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','rows','show','params','options','find','catch','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6704,0x12e));var _0x4670=function(_0x3b1413,_0x308e98){_0x3b1413=_0x3b1413-0x0;var _0x2cafbc=_0x6704[_0x3b1413];return _0x2cafbc;};'use strict';var emlformat=require(_0x4670('0x0'));var rimraf=require(_0x4670('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4670('0x2'));var rp=require(_0x4670('0x3'));var moment=require(_0x4670('0x4'));var BPromise=require(_0x4670('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4670('0x6'));var sox=require('sox');var csv=require(_0x4670('0x7'));var ejs=require(_0x4670('0x8'));var fs=require('fs');var fs_extra=require(_0x4670('0x9'));var _=require(_0x4670('0xa'));var squel=require(_0x4670('0xb'));var crypto=require(_0x4670('0xc'));var jsforce=require(_0x4670('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4670('0x7'));var querystring=require(_0x4670('0xe'));var Papa=require('papaparse');var Redis=require(_0x4670('0xf'));var authService=require(_0x4670('0x10'));var qs=require(_0x4670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4670('0x12'));var logger=require(_0x4670('0x13'))(_0x4670('0x14'));var utils=require(_0x4670('0x15'));var config=require(_0x4670('0x16'));var licenseUtil=require(_0x4670('0x17'));var db=require(_0x4670('0x18'))['db'];function respondWithStatusCode(_0x443956,_0x33b3ed){_0x33b3ed=_0x33b3ed||0xcc;return function(_0x2871dd){if(_0x2871dd){return _0x443956[_0x4670('0x19')](_0x33b3ed);}return _0x443956[_0x4670('0x1a')](_0x33b3ed)[_0x4670('0x1b')]();};}function respondWithResult(_0x48847b,_0x545787){_0x545787=_0x545787||0xc8;return function(_0x3b5b65){if(_0x3b5b65){return _0x48847b['status'](_0x545787)[_0x4670('0x1c')](_0x3b5b65);}};}function respondWithFilteredResult(_0x35e38a,_0x29903a){return function(_0x5dfb83){if(_0x5dfb83){var _0xf0aaa6=typeof _0x29903a[_0x4670('0x1d')]===_0x4670('0x1e')&&typeof _0x29903a[_0x4670('0x1f')]===_0x4670('0x1e');var _0x1257ff=_0x5dfb83[_0x4670('0x20')];var _0x40a825=_0xf0aaa6?0x0:_0x29903a['offset'];var _0x2b405b=_0xf0aaa6?_0x5dfb83['count']:_0x29903a['offset']+_0x29903a['limit'];var _0x5cde0f;if(_0x2b405b>=_0x1257ff){_0x2b405b=_0x1257ff;_0x5cde0f=0xc8;}else{_0x5cde0f=0xce;}_0x35e38a[_0x4670('0x1a')](_0x5cde0f);return _0x35e38a[_0x4670('0x21')](_0x4670('0x22'),_0x40a825+'-'+_0x2b405b+'/'+_0x1257ff)[_0x4670('0x1c')](_0x5dfb83);}return null;};}function patchUpdates(_0x6fff10){return function(_0x25e865){try{jsonpatch[_0x4670('0x23')](_0x25e865,_0x6fff10,!![]);}catch(_0x60275b){return BPromise[_0x4670('0x24')](_0x60275b);}return _0x25e865[_0x4670('0x25')]();};}function saveUpdates(_0x493cee,_0x2965a9){return function(_0x3faf01){if(_0x3faf01){return _0x3faf01[_0x4670('0x26')](_0x493cee)[_0x4670('0x27')](function(_0x2ea318){return _0x2ea318;});}return null;};}function removeEntity(_0x43d840,_0x2b8b52){return function(_0x2cb138){if(_0x2cb138){return _0x2cb138[_0x4670('0x28')]()[_0x4670('0x27')](function(){_0x43d840['status'](0xcc)[_0x4670('0x1b')]();});}};}function handleEntityNotFound(_0x45e8f3,_0xa8c9f8){return function(_0xef3c8c){if(!_0xef3c8c){_0x45e8f3[_0x4670('0x19')](0x194);}return _0xef3c8c;};}function handleError(_0x21e5ae,_0x2b6887){_0x2b6887=_0x2b6887||0x1f4;return function(_0x508411){logger[_0x4670('0x29')](_0x508411['stack']);if(_0x508411[_0x4670('0x2a')]){delete _0x508411[_0x4670('0x2a')];}_0x21e5ae[_0x4670('0x1a')](_0x2b6887)[_0x4670('0x2b')](_0x508411);};}exports[_0x4670('0x2c')]=function(_0x45d8ef,_0xc4906e){var _0x647a4c={},_0x53efdb={},_0x167746={'count':0x0,'rows':[]};var _0x35237f=_[_0x4670('0x2d')](db[_0x4670('0x2e')][_0x4670('0x2f')],function(_0x503220){return{'name':_0x503220[_0x4670('0x30')],'type':_0x503220[_0x4670('0x31')]['key']};});_0x53efdb[_0x4670('0x32')]=_['map'](_0x35237f,_0x4670('0x2a'));_0x53efdb[_0x4670('0x33')]=_[_0x4670('0x34')](_0x45d8ef[_0x4670('0x33')]);_0x53efdb['filters']=_['intersection'](_0x53efdb[_0x4670('0x32')],_0x53efdb[_0x4670('0x33')]);_0x647a4c['attributes']=_[_0x4670('0x35')](_0x53efdb[_0x4670('0x32')],qs[_0x4670('0x36')](_0x45d8ef['query'][_0x4670('0x36')]));_0x647a4c[_0x4670('0x37')]=_0x647a4c['attributes'][_0x4670('0x38')]?_0x647a4c[_0x4670('0x37')]:_0x53efdb[_0x4670('0x32')];if(!_0x45d8ef[_0x4670('0x33')][_0x4670('0x39')](_0x4670('0x3a'))){_0x647a4c[_0x4670('0x1f')]=qs[_0x4670('0x1f')](_0x45d8ef['query'][_0x4670('0x1f')]);_0x647a4c[_0x4670('0x1d')]=qs[_0x4670('0x1d')](_0x45d8ef[_0x4670('0x33')][_0x4670('0x1d')]);}_0x647a4c[_0x4670('0x3b')]=qs[_0x4670('0x3c')](_0x45d8ef[_0x4670('0x33')][_0x4670('0x3c')]);_0x647a4c[_0x4670('0x3d')]=qs[_0x4670('0x3e')](_[_0x4670('0x3f')](_0x45d8ef[_0x4670('0x33')],_0x53efdb[_0x4670('0x3e')]),_0x35237f);if(_0x45d8ef[_0x4670('0x33')]['filter']){_0x647a4c[_0x4670('0x3d')]=_[_0x4670('0x40')](_0x647a4c[_0x4670('0x3d')],{'$or':_[_0x4670('0x2d')](_0x35237f,function(_0x2b5a9){if(_0x2b5a9[_0x4670('0x31')]!=='VIRTUAL'){var _0x312aee={};_0x312aee[_0x2b5a9[_0x4670('0x2a')]]={'$like':'%'+_0x45d8ef[_0x4670('0x33')][_0x4670('0x41')]+'%'};return _0x312aee;}})});}_0x647a4c=_[_0x4670('0x40')]({},_0x647a4c,_0x45d8ef['options']);var _0x45dff1={'where':_0x647a4c[_0x4670('0x3d')]};return db[_0x4670('0x2e')][_0x4670('0x20')](_0x45dff1)[_0x4670('0x27')](function(_0x1b30d4){_0x167746[_0x4670('0x20')]=_0x1b30d4;if(_0x45d8ef['query'][_0x4670('0x42')]){_0x647a4c[_0x4670('0x43')]=[{'all':!![]}];}return db[_0x4670('0x2e')]['findAll'](_0x647a4c);})[_0x4670('0x27')](function(_0x1dd383){_0x167746[_0x4670('0x44')]=_0x1dd383;return _0x167746;})[_0x4670('0x27')](respondWithFilteredResult(_0xc4906e,_0x647a4c))['catch'](handleError(_0xc4906e,null));};exports[_0x4670('0x45')]=function(_0x4993b0,_0x2e82f3){var _0x5f05c4={'raw':![],'where':{'id':_0x4993b0[_0x4670('0x46')]['id']}},_0x2b6992={};_0x2b6992[_0x4670('0x32')]=_[_0x4670('0x34')](db[_0x4670('0x2e')][_0x4670('0x2f')]);_0x2b6992[_0x4670('0x33')]=_[_0x4670('0x34')](_0x4993b0[_0x4670('0x33')]);_0x2b6992[_0x4670('0x3e')]=_[_0x4670('0x35')](_0x2b6992[_0x4670('0x32')],_0x2b6992[_0x4670('0x33')]);_0x5f05c4[_0x4670('0x37')]=_[_0x4670('0x35')](_0x2b6992[_0x4670('0x32')],qs['fields'](_0x4993b0[_0x4670('0x33')][_0x4670('0x36')]));_0x5f05c4[_0x4670('0x37')]=_0x5f05c4[_0x4670('0x37')][_0x4670('0x38')]?_0x5f05c4[_0x4670('0x37')]:_0x2b6992[_0x4670('0x32')];if(_0x4993b0[_0x4670('0x33')][_0x4670('0x42')]){_0x5f05c4['include']=[{'all':!![]}];}_0x5f05c4=_['merge']({},_0x5f05c4,_0x4993b0[_0x4670('0x47')]);return db[_0x4670('0x2e')][_0x4670('0x48')](_0x5f05c4)[_0x4670('0x27')](handleEntityNotFound(_0x2e82f3,null))[_0x4670('0x27')](respondWithResult(_0x2e82f3,null))[_0x4670('0x49')](handleError(_0x2e82f3,null));};exports['create']=function(_0x1102b7,_0x56ac68){return db[_0x4670('0x2e')]['create'](_0x1102b7[_0x4670('0x4a')],{})[_0x4670('0x27')](respondWithResult(_0x56ac68,0xc9))[_0x4670('0x49')](handleError(_0x56ac68,null));};exports[_0x4670('0x26')]=function(_0x3304ab,_0x3b8488){if(_0x3304ab[_0x4670('0x4a')]['id']){delete _0x3304ab[_0x4670('0x4a')]['id'];}return db[_0x4670('0x2e')]['find']({'where':{'id':_0x3304ab['params']['id']}})[_0x4670('0x27')](handleEntityNotFound(_0x3b8488,null))[_0x4670('0x27')](saveUpdates(_0x3304ab[_0x4670('0x4a')],null))[_0x4670('0x27')](respondWithResult(_0x3b8488,null))[_0x4670('0x49')](handleError(_0x3b8488,null));};exports[_0x4670('0x28')]=function(_0x515981,_0x223e84){return db[_0x4670('0x2e')][_0x4670('0x48')]({'where':{'id':_0x515981[_0x4670('0x46')]['id']}})['then'](handleEntityNotFound(_0x223e84,null))[_0x4670('0x27')](removeEntity(_0x223e84,null))['catch'](handleError(_0x223e84,null));};exports['getFields']=function(_0x2e0b06,_0x22d5d2,_0x44c977){var _0x2db59b={};var _0xedcb58={};var _0x28436b;var _0x392294;return db[_0x4670('0x2e')][_0x4670('0x4b')]({'where':{'id':_0x2e0b06['params']['id']}})[_0x4670('0x27')](handleEntityNotFound(_0x22d5d2,null))[_0x4670('0x27')](function(_0x3b0f12){if(_0x3b0f12){_0x28436b=_0x3b0f12;_0xedcb58[_0x4670('0x32')]=_[_0x4670('0x34')](db[_0x4670('0x4c')][_0x4670('0x2f')]);_0xedcb58[_0x4670('0x33')]=_[_0x4670('0x34')](_0x2e0b06['query']);_0xedcb58[_0x4670('0x3e')]=_['intersection'](_0xedcb58[_0x4670('0x32')],_0xedcb58[_0x4670('0x33')]);_0x2db59b[_0x4670('0x37')]=_[_0x4670('0x35')](_0xedcb58['model'],qs['fields'](_0x2e0b06[_0x4670('0x33')]['fields']));_0x2db59b[_0x4670('0x37')]=_0x2db59b[_0x4670('0x37')][_0x4670('0x38')]?_0x2db59b[_0x4670('0x37')]:_0xedcb58[_0x4670('0x32')];_0x2db59b[_0x4670('0x3b')]=qs[_0x4670('0x3c')](_0x2e0b06[_0x4670('0x33')]['sort']);_0x2db59b[_0x4670('0x3d')]=qs['filters'](_['pick'](_0x2e0b06[_0x4670('0x33')],_0xedcb58[_0x4670('0x3e')]));if(_0x2e0b06['query'][_0x4670('0x41')]){_0x2db59b[_0x4670('0x3d')]=_[_0x4670('0x40')](_0x2db59b['where'],{'$or':_[_0x4670('0x2d')](_0x2db59b[_0x4670('0x37')],function(_0xd1f1f0){var _0x1fda73={};_0x1fda73[_0xd1f1f0]={'$like':'%'+_0x2e0b06[_0x4670('0x33')][_0x4670('0x41')]+'%'};return _0x1fda73;})});}_0x2db59b=_[_0x4670('0x40')]({},_0x2db59b,_0x2e0b06[_0x4670('0x47')]);return _0x28436b[_0x4670('0x4d')](_0x2db59b);}})[_0x4670('0x27')](function(_0x1256c9){if(_0x1256c9){_0x392294=_0x1256c9[_0x4670('0x38')];if(!_0x2e0b06['query']['hasOwnProperty']('nolimit')){_0x2db59b['limit']=qs['limit'](_0x2e0b06[_0x4670('0x33')][_0x4670('0x1f')]);_0x2db59b[_0x4670('0x1d')]=qs[_0x4670('0x1d')](_0x2e0b06[_0x4670('0x33')][_0x4670('0x1d')]);}return _0x28436b[_0x4670('0x4d')](_0x2db59b);}})[_0x4670('0x27')](function(_0xf9f866){if(_0xf9f866){return _0xf9f866?{'count':_0x392294,'rows':_0xf9f866}:null;}})[_0x4670('0x27')](respondWithResult(_0x22d5d2,null))[_0x4670('0x49')](handleError(_0x22d5d2,null));};exports[_0x4670('0x4e')]=function(_0x46fff8,_0x23a4d5,_0x15d5bd){var _0x338d40={};var _0x2b07ef={};var _0x55af52;var _0x47667;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x46fff8[_0x4670('0x46')]['id']}})[_0x4670('0x27')](handleEntityNotFound(_0x23a4d5,null))[_0x4670('0x27')](function(_0x2a9df0){if(_0x2a9df0){_0x55af52=_0x2a9df0;_0x2b07ef[_0x4670('0x32')]=_['keys'](db[_0x4670('0x4c')][_0x4670('0x2f')]);_0x2b07ef['query']=_[_0x4670('0x34')](_0x46fff8[_0x4670('0x33')]);_0x2b07ef[_0x4670('0x3e')]=_[_0x4670('0x35')](_0x2b07ef[_0x4670('0x32')],_0x2b07ef[_0x4670('0x33')]);_0x338d40[_0x4670('0x37')]=_[_0x4670('0x35')](_0x2b07ef[_0x4670('0x32')],qs['fields'](_0x46fff8[_0x4670('0x33')]['fields']));_0x338d40[_0x4670('0x37')]=_0x338d40[_0x4670('0x37')][_0x4670('0x38')]?_0x338d40[_0x4670('0x37')]:_0x2b07ef[_0x4670('0x32')];_0x338d40[_0x4670('0x3b')]=qs['sort'](_0x46fff8[_0x4670('0x33')]['sort']);_0x338d40['where']=qs['filters'](_['pick'](_0x46fff8[_0x4670('0x33')],_0x2b07ef[_0x4670('0x3e')]));if(_0x46fff8[_0x4670('0x33')][_0x4670('0x41')]){_0x338d40[_0x4670('0x3d')]=_[_0x4670('0x40')](_0x338d40[_0x4670('0x3d')],{'$or':_[_0x4670('0x2d')](_0x338d40[_0x4670('0x37')],function(_0x2e37c4){var _0x3af7ee={};_0x3af7ee[_0x2e37c4]={'$like':'%'+_0x46fff8[_0x4670('0x33')][_0x4670('0x41')]+'%'};return _0x3af7ee;})});}_0x338d40=_['merge']({},_0x338d40,_0x46fff8[_0x4670('0x47')]);return _0x55af52[_0x4670('0x4e')](_0x338d40);}})[_0x4670('0x27')](function(_0x58ec27){if(_0x58ec27){_0x47667=_0x58ec27[_0x4670('0x38')];if(!_0x46fff8['query'][_0x4670('0x39')](_0x4670('0x3a'))){_0x338d40[_0x4670('0x1f')]=qs[_0x4670('0x1f')](_0x46fff8[_0x4670('0x33')][_0x4670('0x1f')]);_0x338d40[_0x4670('0x1d')]=qs['offset'](_0x46fff8['query'][_0x4670('0x1d')]);}return _0x55af52[_0x4670('0x4e')](_0x338d40);}})['then'](function(_0x55d0e9){if(_0x55d0e9){return _0x55d0e9?{'count':_0x47667,'rows':_0x55d0e9}:null;}})[_0x4670('0x27')](respondWithResult(_0x23a4d5,null))[_0x4670('0x49')](handleError(_0x23a4d5,null));};exports[_0x4670('0x4f')]=function(_0xe12f65,_0x13c13a,_0x84f8ca){var _0x4ca01b={};var _0x95f0ce={};var _0x15e973;var _0x4acf79;return db['ZendeskConfiguration'][_0x4670('0x4b')]({'where':{'id':_0xe12f65[_0x4670('0x46')]['id']}})[_0x4670('0x27')](handleEntityNotFound(_0x13c13a,null))[_0x4670('0x27')](function(_0x2f56cd){if(_0x2f56cd){_0x15e973=_0x2f56cd;_0x95f0ce[_0x4670('0x32')]=_['keys'](db['ZendeskField'][_0x4670('0x2f')]);_0x95f0ce[_0x4670('0x33')]=_[_0x4670('0x34')](_0xe12f65[_0x4670('0x33')]);_0x95f0ce['filters']=_[_0x4670('0x35')](_0x95f0ce[_0x4670('0x32')],_0x95f0ce[_0x4670('0x33')]);_0x4ca01b[_0x4670('0x37')]=_['intersection'](_0x95f0ce[_0x4670('0x32')],qs[_0x4670('0x36')](_0xe12f65[_0x4670('0x33')][_0x4670('0x36')]));_0x4ca01b[_0x4670('0x37')]=_0x4ca01b['attributes'][_0x4670('0x38')]?_0x4ca01b[_0x4670('0x37')]:_0x95f0ce[_0x4670('0x32')];_0x4ca01b[_0x4670('0x3b')]=qs[_0x4670('0x3c')](_0xe12f65[_0x4670('0x33')]['sort']);_0x4ca01b['where']=qs[_0x4670('0x3e')](_['pick'](_0xe12f65['query'],_0x95f0ce['filters']));if(_0xe12f65[_0x4670('0x33')][_0x4670('0x41')]){_0x4ca01b[_0x4670('0x3d')]=_[_0x4670('0x40')](_0x4ca01b[_0x4670('0x3d')],{'$or':_[_0x4670('0x2d')](_0x4ca01b[_0x4670('0x37')],function(_0x1a0ca3){var _0x5a068d={};_0x5a068d[_0x1a0ca3]={'$like':'%'+_0xe12f65[_0x4670('0x33')][_0x4670('0x41')]+'%'};return _0x5a068d;})});}_0x4ca01b=_['merge']({},_0x4ca01b,_0xe12f65[_0x4670('0x47')]);return _0x15e973['getDescriptions'](_0x4ca01b);}})[_0x4670('0x27')](function(_0x494688){if(_0x494688){_0x4acf79=_0x494688[_0x4670('0x38')];if(!_0xe12f65[_0x4670('0x33')][_0x4670('0x39')](_0x4670('0x3a'))){_0x4ca01b[_0x4670('0x1f')]=qs['limit'](_0xe12f65[_0x4670('0x33')][_0x4670('0x1f')]);_0x4ca01b[_0x4670('0x1d')]=qs[_0x4670('0x1d')](_0xe12f65[_0x4670('0x33')]['offset']);}return _0x15e973[_0x4670('0x4f')](_0x4ca01b);}})[_0x4670('0x27')](function(_0x5ad2c5){if(_0x5ad2c5){return _0x5ad2c5?{'count':_0x4acf79,'rows':_0x5ad2c5}:null;}})['then'](respondWithResult(_0x13c13a,null))[_0x4670('0x49')](handleError(_0x13c13a,null));};exports[_0x4670('0x50')]=function(_0x30e6ed,_0xd708f2,_0x23afe4){var _0x3c77a7={};var _0xf4d9c2={};var _0x42a03d;var _0x2f2c80;return db[_0x4670('0x2e')][_0x4670('0x4b')]({'where':{'id':_0x30e6ed['params']['id']}})[_0x4670('0x27')](handleEntityNotFound(_0xd708f2,null))[_0x4670('0x27')](function(_0x3ff9f7){if(_0x3ff9f7){_0x42a03d=_0x3ff9f7;_0xf4d9c2[_0x4670('0x32')]=_[_0x4670('0x34')](db[_0x4670('0x51')][_0x4670('0x2f')]);_0xf4d9c2[_0x4670('0x33')]=_[_0x4670('0x34')](_0x30e6ed['query']);_0xf4d9c2['filters']=_[_0x4670('0x35')](_0xf4d9c2['model'],_0xf4d9c2[_0x4670('0x33')]);_0x3c77a7[_0x4670('0x37')]=_[_0x4670('0x35')](_0xf4d9c2[_0x4670('0x32')],qs[_0x4670('0x36')](_0x30e6ed[_0x4670('0x33')][_0x4670('0x36')]));_0x3c77a7['attributes']=_0x3c77a7[_0x4670('0x37')]['length']?_0x3c77a7[_0x4670('0x37')]:_0xf4d9c2['model'];_0x3c77a7[_0x4670('0x3b')]=qs[_0x4670('0x3c')](_0x30e6ed[_0x4670('0x33')][_0x4670('0x3c')]);_0x3c77a7[_0x4670('0x3d')]=qs[_0x4670('0x3e')](_[_0x4670('0x3f')](_0x30e6ed[_0x4670('0x33')],_0xf4d9c2[_0x4670('0x3e')]));if(_0x30e6ed['query'][_0x4670('0x41')]){_0x3c77a7[_0x4670('0x3d')]=_['merge'](_0x3c77a7[_0x4670('0x3d')],{'$or':_[_0x4670('0x2d')](_0x3c77a7[_0x4670('0x37')],function(_0x6119e8){var _0x59f0b3={};_0x59f0b3[_0x6119e8]={'$like':'%'+_0x30e6ed['query'][_0x4670('0x41')]+'%'};return _0x59f0b3;})});}_0x3c77a7=_[_0x4670('0x40')]({},_0x3c77a7,_0x30e6ed[_0x4670('0x47')]);return _0x42a03d['getTags'](_0x3c77a7);}})['then'](function(_0x596b3a){if(_0x596b3a){_0x2f2c80=_0x596b3a[_0x4670('0x38')];if(!_0x30e6ed[_0x4670('0x33')][_0x4670('0x39')](_0x4670('0x3a'))){_0x3c77a7['limit']=qs[_0x4670('0x1f')](_0x30e6ed[_0x4670('0x33')][_0x4670('0x1f')]);_0x3c77a7['offset']=qs[_0x4670('0x1d')](_0x30e6ed['query']['offset']);}return _0x42a03d['getTags'](_0x3c77a7);}})[_0x4670('0x27')](function(_0x543223){if(_0x543223){return _0x543223?{'count':_0x2f2c80,'rows':_0x543223}:null;}})[_0x4670('0x27')](respondWithResult(_0xd708f2,null))['catch'](handleError(_0xd708f2,null));};exports[_0x4670('0x52')]=function(_0x464120,_0x5240a4,_0x236f3a){if(_0x464120[_0x4670('0x4a')]['id']){delete _0x464120[_0x4670('0x4a')]['id'];}return db[_0x4670('0x2e')][_0x4670('0x4b')]({'where':{'id':_0x464120[_0x4670('0x46')]['id']}})[_0x4670('0x27')](handleEntityNotFound(_0x5240a4,null))['then'](function(_0x2f6c18){if(_0x2f6c18){return _0x2f6c18[_0x4670('0x52')](_0x464120['body'][_0x4670('0x53')]||[]);}return null;})[_0x4670('0x27')](respondWithResult(_0x5240a4,null))[_0x4670('0x49')](handleError(_0x5240a4,null));}; \ No newline at end of file +var _0xec83=['query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','getFields','findOne','ZendeskField','pick','filter','nolimit','limit','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','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','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model'];(function(_0x41bc69,_0x56de9f){var _0x4c4742=function(_0xde1c91){while(--_0xde1c91){_0x41bc69['push'](_0x41bc69['shift']());}};_0x4c4742(++_0x56de9f);}(_0xec83,0x1d7));var _0x3ec8=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xec83[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ec8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ec8('0x1'));var rp=require(_0x3ec8('0x2'));var moment=require('moment');var BPromise=require(_0x3ec8('0x3'));var Mustache=require(_0x3ec8('0x4'));var util=require(_0x3ec8('0x5'));var path=require(_0x3ec8('0x6'));var sox=require(_0x3ec8('0x7'));var csv=require(_0x3ec8('0x8'));var ejs=require(_0x3ec8('0x9'));var fs=require('fs');var fs_extra=require(_0x3ec8('0xa'));var _=require(_0x3ec8('0xb'));var squel=require(_0x3ec8('0xc'));var crypto=require(_0x3ec8('0xd'));var jsforce=require(_0x3ec8('0xe'));var deskjs=require(_0x3ec8('0xf'));var toCsv=require(_0x3ec8('0x8'));var querystring=require('querystring');var Papa=require(_0x3ec8('0x10'));var Redis=require(_0x3ec8('0x11'));var authService=require(_0x3ec8('0x12'));var qs=require(_0x3ec8('0x13'));var as=require(_0x3ec8('0x14'));var hardwareService=require(_0x3ec8('0x15'));var logger=require(_0x3ec8('0x16'))(_0x3ec8('0x17'));var utils=require(_0x3ec8('0x18'));var config=require(_0x3ec8('0x19'));var licenseUtil=require(_0x3ec8('0x1a'));var db=require(_0x3ec8('0x1b'))['db'];function respondWithStatusCode(_0x14d927,_0x24ee46){_0x24ee46=_0x24ee46||0xcc;return function(_0x1dea35){if(_0x1dea35){return _0x14d927[_0x3ec8('0x1c')](_0x24ee46);}return _0x14d927['status'](_0x24ee46)[_0x3ec8('0x1d')]();};}function respondWithResult(_0x4422ff,_0x45a268){_0x45a268=_0x45a268||0xc8;return function(_0x9a2fe6){if(_0x9a2fe6){return _0x4422ff[_0x3ec8('0x1e')](_0x45a268)[_0x3ec8('0x1f')](_0x9a2fe6);}};}function respondWithFilteredResult(_0x68098d,_0x50d48c){return function(_0x2176fb){if(_0x2176fb){var _0xfe2582=typeof _0x50d48c[_0x3ec8('0x20')]==='undefined'&&typeof _0x50d48c['limit']===_0x3ec8('0x21');var _0x468ea0=_0x2176fb[_0x3ec8('0x22')];var _0x3006ac=_0xfe2582?0x0:_0x50d48c['offset'];var _0x5e8ff2=_0xfe2582?_0x2176fb[_0x3ec8('0x22')]:_0x50d48c['offset']+_0x50d48c['limit'];var _0xb399d5;if(_0x5e8ff2>=_0x468ea0){_0x5e8ff2=_0x468ea0;_0xb399d5=0xc8;}else{_0xb399d5=0xce;}_0x68098d[_0x3ec8('0x1e')](_0xb399d5);return _0x68098d[_0x3ec8('0x23')](_0x3ec8('0x24'),_0x3006ac+'-'+_0x5e8ff2+'/'+_0x468ea0)[_0x3ec8('0x1f')](_0x2176fb);}return null;};}function patchUpdates(_0x34b556){return function(_0x543c6f){try{jsonpatch[_0x3ec8('0x25')](_0x543c6f,_0x34b556,!![]);}catch(_0x268769){return BPromise[_0x3ec8('0x26')](_0x268769);}return _0x543c6f['save']();};}function saveUpdates(_0x13f7cf,_0x1bebc0){return function(_0x2d7861){if(_0x2d7861){return _0x2d7861[_0x3ec8('0x27')](_0x13f7cf)[_0x3ec8('0x28')](function(_0x858f6a){return _0x858f6a;});}return null;};}function removeEntity(_0x20ab3c,_0x2543ff){return function(_0x2c3053){if(_0x2c3053){return _0x2c3053['destroy']()['then'](function(){_0x20ab3c[_0x3ec8('0x1e')](0xcc)[_0x3ec8('0x1d')]();});}};}function handleEntityNotFound(_0x5a7761,_0x4d8c7c){return function(_0x29b629){if(!_0x29b629){_0x5a7761[_0x3ec8('0x1c')](0x194);}return _0x29b629;};}function handleError(_0x54fcfa,_0xe142f5){_0xe142f5=_0xe142f5||0x1f4;return function(_0x281c27){logger['error'](_0x281c27[_0x3ec8('0x29')]);if(_0x281c27[_0x3ec8('0x2a')]){delete _0x281c27[_0x3ec8('0x2a')];}_0x54fcfa[_0x3ec8('0x1e')](_0xe142f5)[_0x3ec8('0x2b')](_0x281c27);};}exports[_0x3ec8('0x2c')]=function(_0x41bb76,_0x13420e){var _0x3373a6={},_0x5a4a86={},_0x10f7b2={'count':0x0,'rows':[]};var _0x1f14d8=_[_0x3ec8('0x2d')](db[_0x3ec8('0x2e')][_0x3ec8('0x2f')],function(_0x4d2cdd){return{'name':_0x4d2cdd['fieldName'],'type':_0x4d2cdd[_0x3ec8('0x30')][_0x3ec8('0x31')]};});_0x5a4a86[_0x3ec8('0x32')]=_[_0x3ec8('0x2d')](_0x1f14d8,_0x3ec8('0x2a'));_0x5a4a86[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x41bb76[_0x3ec8('0x33')]);_0x5a4a86[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x5a4a86[_0x3ec8('0x32')],_0x5a4a86[_0x3ec8('0x33')]);_0x3373a6[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x5a4a86[_0x3ec8('0x32')],qs[_0x3ec8('0x38')](_0x41bb76[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x3373a6[_0x3ec8('0x37')]=_0x3373a6['attributes'][_0x3ec8('0x39')]?_0x3373a6[_0x3ec8('0x37')]:_0x5a4a86['model'];if(!_0x41bb76[_0x3ec8('0x33')]['hasOwnProperty']('nolimit')){_0x3373a6['limit']=qs['limit'](_0x41bb76[_0x3ec8('0x33')]['limit']);_0x3373a6[_0x3ec8('0x20')]=qs[_0x3ec8('0x20')](_0x41bb76[_0x3ec8('0x33')][_0x3ec8('0x20')]);}_0x3373a6[_0x3ec8('0x3a')]=qs[_0x3ec8('0x3b')](_0x41bb76['query'][_0x3ec8('0x3b')]);_0x3373a6[_0x3ec8('0x3c')]=qs[_0x3ec8('0x35')](_['pick'](_0x41bb76['query'],_0x5a4a86['filters']),_0x1f14d8);if(_0x41bb76[_0x3ec8('0x33')]['filter']){_0x3373a6[_0x3ec8('0x3c')]=_[_0x3ec8('0x3d')](_0x3373a6[_0x3ec8('0x3c')],{'$or':_[_0x3ec8('0x2d')](_0x1f14d8,function(_0x3c9471){if(_0x3c9471[_0x3ec8('0x30')]!==_0x3ec8('0x3e')){var _0x1b9922={};_0x1b9922[_0x3c9471[_0x3ec8('0x2a')]]={'$like':'%'+_0x41bb76['query']['filter']+'%'};return _0x1b9922;}})});}_0x3373a6=_[_0x3ec8('0x3d')]({},_0x3373a6,_0x41bb76[_0x3ec8('0x3f')]);var _0x3eb0a4={'where':_0x3373a6[_0x3ec8('0x3c')]};return db[_0x3ec8('0x2e')][_0x3ec8('0x22')](_0x3eb0a4)[_0x3ec8('0x28')](function(_0x22d516){_0x10f7b2[_0x3ec8('0x22')]=_0x22d516;if(_0x41bb76[_0x3ec8('0x33')][_0x3ec8('0x40')]){_0x3373a6[_0x3ec8('0x41')]=[{'all':!![]}];}return db[_0x3ec8('0x2e')]['findAll'](_0x3373a6);})['then'](function(_0xb0d60e){_0x10f7b2[_0x3ec8('0x42')]=_0xb0d60e;return _0x10f7b2;})[_0x3ec8('0x28')](respondWithFilteredResult(_0x13420e,_0x3373a6))[_0x3ec8('0x43')](handleError(_0x13420e,null));};exports[_0x3ec8('0x44')]=function(_0x21fb4f,_0x307e8e){var _0x4bd024={'raw':![],'where':{'id':_0x21fb4f['params']['id']}},_0x5e4da1={};_0x5e4da1[_0x3ec8('0x32')]=_['keys'](db[_0x3ec8('0x2e')][_0x3ec8('0x2f')]);_0x5e4da1[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x21fb4f[_0x3ec8('0x33')]);_0x5e4da1[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x5e4da1[_0x3ec8('0x32')],_0x5e4da1[_0x3ec8('0x33')]);_0x4bd024[_0x3ec8('0x37')]=_['intersection'](_0x5e4da1[_0x3ec8('0x32')],qs[_0x3ec8('0x38')](_0x21fb4f[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x4bd024[_0x3ec8('0x37')]=_0x4bd024[_0x3ec8('0x37')][_0x3ec8('0x39')]?_0x4bd024[_0x3ec8('0x37')]:_0x5e4da1[_0x3ec8('0x32')];if(_0x21fb4f[_0x3ec8('0x33')][_0x3ec8('0x40')]){_0x4bd024[_0x3ec8('0x41')]=[{'all':!![]}];}_0x4bd024=_['merge']({},_0x4bd024,_0x21fb4f[_0x3ec8('0x3f')]);return db[_0x3ec8('0x2e')][_0x3ec8('0x45')](_0x4bd024)[_0x3ec8('0x28')](handleEntityNotFound(_0x307e8e,null))[_0x3ec8('0x28')](respondWithResult(_0x307e8e,null))['catch'](handleError(_0x307e8e,null));};exports[_0x3ec8('0x46')]=function(_0x5d01f1,_0x32de0f){return db[_0x3ec8('0x2e')][_0x3ec8('0x46')](_0x5d01f1['body'],{})[_0x3ec8('0x28')](respondWithResult(_0x32de0f,0xc9))[_0x3ec8('0x43')](handleError(_0x32de0f,null));};exports['update']=function(_0x2bf95b,_0x5df276){if(_0x2bf95b[_0x3ec8('0x47')]['id']){delete _0x2bf95b[_0x3ec8('0x47')]['id'];}return db['ZendeskConfiguration'][_0x3ec8('0x45')]({'where':{'id':_0x2bf95b[_0x3ec8('0x48')]['id']}})['then'](handleEntityNotFound(_0x5df276,null))[_0x3ec8('0x28')](saveUpdates(_0x2bf95b[_0x3ec8('0x47')],null))[_0x3ec8('0x28')](respondWithResult(_0x5df276,null))['catch'](handleError(_0x5df276,null));};exports['destroy']=function(_0x385219,_0x8d1c88){return db[_0x3ec8('0x2e')]['find']({'where':{'id':_0x385219['params']['id']}})[_0x3ec8('0x28')](handleEntityNotFound(_0x8d1c88,null))[_0x3ec8('0x28')](removeEntity(_0x8d1c88,null))[_0x3ec8('0x43')](handleError(_0x8d1c88,null));};exports[_0x3ec8('0x49')]=function(_0x5276a6,_0x36e60b,_0x47fb05){var _0x5ae16e={};var _0x5539b2={};var _0x1568ed;var _0xdaab59;return db[_0x3ec8('0x2e')][_0x3ec8('0x4a')]({'where':{'id':_0x5276a6[_0x3ec8('0x48')]['id']}})[_0x3ec8('0x28')](handleEntityNotFound(_0x36e60b,null))[_0x3ec8('0x28')](function(_0x1961e4){if(_0x1961e4){_0x1568ed=_0x1961e4;_0x5539b2[_0x3ec8('0x32')]=_['keys'](db[_0x3ec8('0x4b')]['rawAttributes']);_0x5539b2[_0x3ec8('0x33')]=_['keys'](_0x5276a6[_0x3ec8('0x33')]);_0x5539b2[_0x3ec8('0x35')]=_['intersection'](_0x5539b2[_0x3ec8('0x32')],_0x5539b2[_0x3ec8('0x33')]);_0x5ae16e[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x5539b2['model'],qs[_0x3ec8('0x38')](_0x5276a6[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x5ae16e[_0x3ec8('0x37')]=_0x5ae16e[_0x3ec8('0x37')][_0x3ec8('0x39')]?_0x5ae16e['attributes']:_0x5539b2['model'];_0x5ae16e[_0x3ec8('0x3a')]=qs[_0x3ec8('0x3b')](_0x5276a6[_0x3ec8('0x33')][_0x3ec8('0x3b')]);_0x5ae16e['where']=qs['filters'](_[_0x3ec8('0x4c')](_0x5276a6[_0x3ec8('0x33')],_0x5539b2[_0x3ec8('0x35')]));if(_0x5276a6[_0x3ec8('0x33')][_0x3ec8('0x4d')]){_0x5ae16e[_0x3ec8('0x3c')]=_[_0x3ec8('0x3d')](_0x5ae16e[_0x3ec8('0x3c')],{'$or':_['map'](_0x5ae16e[_0x3ec8('0x37')],function(_0x342766){var _0x46712f={};_0x46712f[_0x342766]={'$like':'%'+_0x5276a6['query'][_0x3ec8('0x4d')]+'%'};return _0x46712f;})});}_0x5ae16e=_['merge']({},_0x5ae16e,_0x5276a6['options']);return _0x1568ed['getFields'](_0x5ae16e);}})[_0x3ec8('0x28')](function(_0x532d91){if(_0x532d91){_0xdaab59=_0x532d91[_0x3ec8('0x39')];if(!_0x5276a6[_0x3ec8('0x33')]['hasOwnProperty'](_0x3ec8('0x4e'))){_0x5ae16e[_0x3ec8('0x4f')]=qs['limit'](_0x5276a6[_0x3ec8('0x33')]['limit']);_0x5ae16e[_0x3ec8('0x20')]=qs[_0x3ec8('0x20')](_0x5276a6['query'][_0x3ec8('0x20')]);}return _0x1568ed['getFields'](_0x5ae16e);}})[_0x3ec8('0x28')](function(_0x421598){if(_0x421598){return _0x421598?{'count':_0xdaab59,'rows':_0x421598}:null;}})[_0x3ec8('0x28')](respondWithResult(_0x36e60b,null))[_0x3ec8('0x43')](handleError(_0x36e60b,null));};exports[_0x3ec8('0x50')]=function(_0x2ec6dc,_0x2f174a,_0x310b88){var _0x22d7cb={};var _0x397240={};var _0xda14d7;var _0x45a06b;return db[_0x3ec8('0x2e')][_0x3ec8('0x4a')]({'where':{'id':_0x2ec6dc[_0x3ec8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f174a,null))[_0x3ec8('0x28')](function(_0x37b901){if(_0x37b901){_0xda14d7=_0x37b901;_0x397240['model']=_[_0x3ec8('0x34')](db['ZendeskField']['rawAttributes']);_0x397240[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x2ec6dc['query']);_0x397240[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x397240['model'],_0x397240[_0x3ec8('0x33')]);_0x22d7cb[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x397240[_0x3ec8('0x32')],qs[_0x3ec8('0x38')](_0x2ec6dc[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x22d7cb[_0x3ec8('0x37')]=_0x22d7cb[_0x3ec8('0x37')][_0x3ec8('0x39')]?_0x22d7cb['attributes']:_0x397240['model'];_0x22d7cb[_0x3ec8('0x3a')]=qs['sort'](_0x2ec6dc['query'][_0x3ec8('0x3b')]);_0x22d7cb['where']=qs[_0x3ec8('0x35')](_[_0x3ec8('0x4c')](_0x2ec6dc[_0x3ec8('0x33')],_0x397240['filters']));if(_0x2ec6dc[_0x3ec8('0x33')][_0x3ec8('0x4d')]){_0x22d7cb[_0x3ec8('0x3c')]=_[_0x3ec8('0x3d')](_0x22d7cb[_0x3ec8('0x3c')],{'$or':_[_0x3ec8('0x2d')](_0x22d7cb['attributes'],function(_0x430968){var _0x2bdc78={};_0x2bdc78[_0x430968]={'$like':'%'+_0x2ec6dc[_0x3ec8('0x33')][_0x3ec8('0x4d')]+'%'};return _0x2bdc78;})});}_0x22d7cb=_[_0x3ec8('0x3d')]({},_0x22d7cb,_0x2ec6dc[_0x3ec8('0x3f')]);return _0xda14d7['getSubjects'](_0x22d7cb);}})[_0x3ec8('0x28')](function(_0x5eaad0){if(_0x5eaad0){_0x45a06b=_0x5eaad0[_0x3ec8('0x39')];if(!_0x2ec6dc[_0x3ec8('0x33')]['hasOwnProperty'](_0x3ec8('0x4e'))){_0x22d7cb[_0x3ec8('0x4f')]=qs[_0x3ec8('0x4f')](_0x2ec6dc[_0x3ec8('0x33')]['limit']);_0x22d7cb['offset']=qs[_0x3ec8('0x20')](_0x2ec6dc[_0x3ec8('0x33')][_0x3ec8('0x20')]);}return _0xda14d7['getSubjects'](_0x22d7cb);}})['then'](function(_0x25db93){if(_0x25db93){return _0x25db93?{'count':_0x45a06b,'rows':_0x25db93}:null;}})[_0x3ec8('0x28')](respondWithResult(_0x2f174a,null))[_0x3ec8('0x43')](handleError(_0x2f174a,null));};exports[_0x3ec8('0x51')]=function(_0x32f82a,_0x13bc84,_0x26d8de){var _0x42ef69={};var _0x28747a={};var _0x2818ad;var _0xb7d1c2;return db[_0x3ec8('0x2e')][_0x3ec8('0x4a')]({'where':{'id':_0x32f82a[_0x3ec8('0x48')]['id']}})[_0x3ec8('0x28')](handleEntityNotFound(_0x13bc84,null))[_0x3ec8('0x28')](function(_0x47c061){if(_0x47c061){_0x2818ad=_0x47c061;_0x28747a[_0x3ec8('0x32')]=_[_0x3ec8('0x34')](db[_0x3ec8('0x4b')][_0x3ec8('0x2f')]);_0x28747a[_0x3ec8('0x33')]=_['keys'](_0x32f82a[_0x3ec8('0x33')]);_0x28747a['filters']=_[_0x3ec8('0x36')](_0x28747a[_0x3ec8('0x32')],_0x28747a[_0x3ec8('0x33')]);_0x42ef69['attributes']=_[_0x3ec8('0x36')](_0x28747a[_0x3ec8('0x32')],qs[_0x3ec8('0x38')](_0x32f82a[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x42ef69[_0x3ec8('0x37')]=_0x42ef69[_0x3ec8('0x37')][_0x3ec8('0x39')]?_0x42ef69[_0x3ec8('0x37')]:_0x28747a['model'];_0x42ef69[_0x3ec8('0x3a')]=qs['sort'](_0x32f82a[_0x3ec8('0x33')][_0x3ec8('0x3b')]);_0x42ef69[_0x3ec8('0x3c')]=qs['filters'](_[_0x3ec8('0x4c')](_0x32f82a[_0x3ec8('0x33')],_0x28747a[_0x3ec8('0x35')]));if(_0x32f82a['query'][_0x3ec8('0x4d')]){_0x42ef69[_0x3ec8('0x3c')]=_[_0x3ec8('0x3d')](_0x42ef69[_0x3ec8('0x3c')],{'$or':_['map'](_0x42ef69['attributes'],function(_0x5d2df3){var _0x2d121b={};_0x2d121b[_0x5d2df3]={'$like':'%'+_0x32f82a[_0x3ec8('0x33')][_0x3ec8('0x4d')]+'%'};return _0x2d121b;})});}_0x42ef69=_[_0x3ec8('0x3d')]({},_0x42ef69,_0x32f82a['options']);return _0x2818ad[_0x3ec8('0x51')](_0x42ef69);}})[_0x3ec8('0x28')](function(_0x11b917){if(_0x11b917){_0xb7d1c2=_0x11b917[_0x3ec8('0x39')];if(!_0x32f82a['query'][_0x3ec8('0x52')](_0x3ec8('0x4e'))){_0x42ef69[_0x3ec8('0x4f')]=qs[_0x3ec8('0x4f')](_0x32f82a['query']['limit']);_0x42ef69[_0x3ec8('0x20')]=qs[_0x3ec8('0x20')](_0x32f82a[_0x3ec8('0x33')][_0x3ec8('0x20')]);}return _0x2818ad[_0x3ec8('0x51')](_0x42ef69);}})[_0x3ec8('0x28')](function(_0x5713fe){if(_0x5713fe){return _0x5713fe?{'count':_0xb7d1c2,'rows':_0x5713fe}:null;}})[_0x3ec8('0x28')](respondWithResult(_0x13bc84,null))[_0x3ec8('0x43')](handleError(_0x13bc84,null));};exports[_0x3ec8('0x53')]=function(_0x687043,_0x3288a9,_0x22806f){var _0x4b154a={};var _0x45359b={};var _0x1b0bfe;var _0x1c2bda;return db[_0x3ec8('0x2e')]['findOne']({'where':{'id':_0x687043['params']['id']}})[_0x3ec8('0x28')](handleEntityNotFound(_0x3288a9,null))[_0x3ec8('0x28')](function(_0x11514e){if(_0x11514e){_0x1b0bfe=_0x11514e;_0x45359b[_0x3ec8('0x32')]=_[_0x3ec8('0x34')](db[_0x3ec8('0x54')][_0x3ec8('0x2f')]);_0x45359b[_0x3ec8('0x33')]=_[_0x3ec8('0x34')](_0x687043[_0x3ec8('0x33')]);_0x45359b[_0x3ec8('0x35')]=_[_0x3ec8('0x36')](_0x45359b[_0x3ec8('0x32')],_0x45359b[_0x3ec8('0x33')]);_0x4b154a[_0x3ec8('0x37')]=_[_0x3ec8('0x36')](_0x45359b[_0x3ec8('0x32')],qs[_0x3ec8('0x38')](_0x687043[_0x3ec8('0x33')][_0x3ec8('0x38')]));_0x4b154a[_0x3ec8('0x37')]=_0x4b154a[_0x3ec8('0x37')][_0x3ec8('0x39')]?_0x4b154a[_0x3ec8('0x37')]:_0x45359b[_0x3ec8('0x32')];_0x4b154a[_0x3ec8('0x3a')]=qs[_0x3ec8('0x3b')](_0x687043[_0x3ec8('0x33')]['sort']);_0x4b154a[_0x3ec8('0x3c')]=qs['filters'](_[_0x3ec8('0x4c')](_0x687043['query'],_0x45359b['filters']));if(_0x687043[_0x3ec8('0x33')][_0x3ec8('0x4d')]){_0x4b154a['where']=_[_0x3ec8('0x3d')](_0x4b154a[_0x3ec8('0x3c')],{'$or':_[_0x3ec8('0x2d')](_0x4b154a[_0x3ec8('0x37')],function(_0x437179){var _0x2c7569={};_0x2c7569[_0x437179]={'$like':'%'+_0x687043[_0x3ec8('0x33')][_0x3ec8('0x4d')]+'%'};return _0x2c7569;})});}_0x4b154a=_[_0x3ec8('0x3d')]({},_0x4b154a,_0x687043[_0x3ec8('0x3f')]);return _0x1b0bfe[_0x3ec8('0x53')](_0x4b154a);}})[_0x3ec8('0x28')](function(_0x574da6){if(_0x574da6){_0x1c2bda=_0x574da6['length'];if(!_0x687043[_0x3ec8('0x33')]['hasOwnProperty']('nolimit')){_0x4b154a[_0x3ec8('0x4f')]=qs[_0x3ec8('0x4f')](_0x687043[_0x3ec8('0x33')][_0x3ec8('0x4f')]);_0x4b154a[_0x3ec8('0x20')]=qs[_0x3ec8('0x20')](_0x687043[_0x3ec8('0x33')][_0x3ec8('0x20')]);}return _0x1b0bfe['getTags'](_0x4b154a);}})[_0x3ec8('0x28')](function(_0xdac718){if(_0xdac718){return _0xdac718?{'count':_0x1c2bda,'rows':_0xdac718}:null;}})['then'](respondWithResult(_0x3288a9,null))[_0x3ec8('0x43')](handleError(_0x3288a9,null));};exports[_0x3ec8('0x55')]=function(_0x2863cb,_0x562cf0,_0x48ca9a){if(_0x2863cb[_0x3ec8('0x47')]['id']){delete _0x2863cb[_0x3ec8('0x47')]['id'];}return db[_0x3ec8('0x2e')][_0x3ec8('0x4a')]({'where':{'id':_0x2863cb[_0x3ec8('0x48')]['id']}})[_0x3ec8('0x28')](handleEntityNotFound(_0x562cf0,null))[_0x3ec8('0x28')](function(_0x1ebfaf){if(_0x1ebfaf){return _0x1ebfaf[_0x3ec8('0x55')](_0x2863cb['body'][_0x3ec8('0x56')]||[]);}return null;})['then'](respondWithResult(_0x562cf0,null))['catch'](handleError(_0x562cf0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cf3ed66..5245710 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 _0x1c7c=['./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x788a54,_0x12450b){var _0x8b73a4=function(_0x3b6271){while(--_0x3b6271){_0x788a54['push'](_0x788a54['shift']());}};_0x8b73a4(++_0x12450b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1fbc5f,_0x4dd334){_0x1fbc5f=_0x1fbc5f-0x0;var _0x19225e=_0x1c7c[_0x1fbc5f];return _0x19225e;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require(_0xc1c7('0x2'))(_0xc1c7('0x3'));var moment=require('moment');var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var attributes=require(_0xc1c7('0x8'));module[_0xc1c7('0x9')]=function(_0x364dde,_0x1f3e21){return _0x364dde[_0xc1c7('0xa')](_0xc1c7('0xb'),attributes,{'tableName':_0xc1c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ee=['ZendeskConfiguration','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x554d9b,_0x2ff157){var _0x24c6dd=function(_0x5f1070){while(--_0x5f1070){_0x554d9b['push'](_0x554d9b['shift']());}};_0x24c6dd(++_0x2ff157);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 8ac3863..d24d149 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 _0xa9ad=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa9ad,0x12b));var _0xda9a=function(_0x2a63ad,_0x34289d){_0x2a63ad=_0x2a63ad-0x0;var _0x39a69b=_0xa9ad[_0x2a63ad];return _0x39a69b;};'use strict';var _=require(_0xda9a('0x0'));var util=require(_0xda9a('0x1'));var moment=require(_0xda9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda9a('0x3'));var db=require(_0xda9a('0x4'))['db'];var utils=require(_0xda9a('0x5'));var logger=require(_0xda9a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda9a('0x7'));var client=jayson[_0xda9a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cbf88,_0x1d88ff,_0x4b38ef){return new BPromise(function(_0x260d50,_0x4e87a9){return client[_0xda9a('0x9')](_0x1cbf88,_0x4b38ef)[_0xda9a('0xa')](function(_0x3b4101){logger[_0xda9a('0xb')](_0xda9a('0xc'),_0x1d88ff,_0xda9a('0xd'));logger[_0xda9a('0xe')](_0xda9a('0xf'),_0x1d88ff,_0xda9a('0xd'),JSON[_0xda9a('0x10')](_0x3b4101));if(_0x3b4101[_0xda9a('0x11')]){if(_0x3b4101['error'][_0xda9a('0x12')]===0x1f4){logger[_0xda9a('0x11')](_0xda9a('0xc'),_0x1d88ff,_0x3b4101[_0xda9a('0x11')]['message']);return _0x4e87a9(_0x3b4101['error'][_0xda9a('0x13')]);}logger[_0xda9a('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d88ff,_0x3b4101[_0xda9a('0x11')][_0xda9a('0x13')]);return _0x260d50(_0x3b4101[_0xda9a('0x11')][_0xda9a('0x13')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x1d88ff,'request\x20sent');_0x260d50(_0x3b4101[_0xda9a('0x14')][_0xda9a('0x13')]);}})[_0xda9a('0x15')](function(_0x52011b){logger['error'](_0xda9a('0xc'),_0x1d88ff,_0x52011b);_0x4e87a9(_0x52011b);});});} \ No newline at end of file +var _0x5cff=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x250036,_0x29119e){var _0x413154=function(_0x4f11f1){while(--_0x4f11f1){_0x250036['push'](_0x250036['shift']());}};_0x413154(++_0x29119e);}(_0x5cff,0x19d));var _0xf5cf=function(_0x19b51d,_0x34c337){_0x19b51d=_0x19b51d-0x0;var _0x200ff8=_0x5cff[_0x19b51d];return _0x200ff8;};'use strict';var _=require(_0xf5cf('0x0'));var util=require(_0xf5cf('0x1'));var moment=require('moment');var BPromise=require(_0xf5cf('0x2'));var rs=require(_0xf5cf('0x3'));var fs=require('fs');var Redis=require(_0xf5cf('0x4'));var db=require(_0xf5cf('0x5'))['db'];var utils=require(_0xf5cf('0x6'));var logger=require(_0xf5cf('0x7'))('rpc');var config=require(_0xf5cf('0x8'));var jayson=require(_0xf5cf('0x9'));var client=jayson[_0xf5cf('0xa')][_0xf5cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x449f86,_0x1b8082,_0x167ad7){return new BPromise(function(_0x1b7c48,_0x5ad97f){return client['request'](_0x449f86,_0x167ad7)[_0xf5cf('0xc')](function(_0x417b06){logger[_0xf5cf('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1b8082,_0xf5cf('0xe'));logger[_0xf5cf('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1b8082,_0xf5cf('0xe'),JSON['stringify'](_0x417b06));if(_0x417b06[_0xf5cf('0x10')]){if(_0x417b06[_0xf5cf('0x10')][_0xf5cf('0x11')]===0x1f4){logger[_0xf5cf('0x10')](_0xf5cf('0x12'),_0x1b8082,_0x417b06[_0xf5cf('0x10')][_0xf5cf('0x13')]);return _0x5ad97f(_0x417b06[_0xf5cf('0x10')][_0xf5cf('0x13')]);}logger['error'](_0xf5cf('0x12'),_0x1b8082,_0x417b06[_0xf5cf('0x10')][_0xf5cf('0x13')]);return _0x1b7c48(_0x417b06['error'][_0xf5cf('0x13')]);}else{logger[_0xf5cf('0xd')](_0xf5cf('0x12'),_0x1b8082,_0xf5cf('0xe'));_0x1b7c48(_0x417b06['result'][_0xf5cf('0x13')]);}})[_0xf5cf('0x14')](function(_0x2f2988){logger[_0xf5cf('0x10')](_0xf5cf('0x12'),_0x1b8082,_0x2f2988);_0x5ad97f(_0x2f2988);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f7fdc25..c2f273e 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 _0x404d=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa32fd,_0x1f2bae){var _0x3747aa=function(_0x3e58c1){while(--_0x3e58c1){_0xa32fd['push'](_0xa32fd['shift']());}};_0x3747aa(++_0x1f2bae);}(_0x404d,0x103));var _0xd404=function(_0x3386db,_0x471bf2){_0x3386db=_0x3386db-0x0;var _0x409a3f=_0x404d[_0x3386db];return _0x409a3f;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd404('0x4'));var auth=require(_0xd404('0x5'));var interaction=require(_0xd404('0x6'));var config=require(_0xd404('0x7'));var controller=require(_0xd404('0x8'));router[_0xd404('0x9')]('/',auth[_0xd404('0xa')](),controller[_0xd404('0xb')]);router['get']('/:id',auth[_0xd404('0xa')](),controller[_0xd404('0xc')]);router['post']('/',auth[_0xd404('0xa')](),controller[_0xd404('0xd')]);router[_0xd404('0xe')]('/:id',auth[_0xd404('0xa')](),controller[_0xd404('0xf')]);router['delete'](_0xd404('0x10'),auth['isAuthenticated'](),controller[_0xd404('0x11')]);module[_0xd404('0x12')]=router; \ No newline at end of file +var _0xacec=['show','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x5681ea,_0x3901ad){var _0x5cb0e6=function(_0x569260){while(--_0x569260){_0x5681ea['push'](_0x5681ea['shift']());}};_0x5cb0e6(++_0x3901ad);}(_0xacec,0xee));var _0xcace=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0xacec[_0x5cf3c0];return _0x39a680;};'use strict';var multer=require(_0xcace('0x0'));var util=require(_0xcace('0x1'));var path=require(_0xcace('0x2'));var timeout=require('connect-timeout');var express=require(_0xcace('0x3'));var router=express[_0xcace('0x4')]();var fs_extra=require(_0xcace('0x5'));var auth=require(_0xcace('0x6'));var interaction=require(_0xcace('0x7'));var config=require(_0xcace('0x8'));var controller=require(_0xcace('0x9'));router[_0xcace('0xa')]('/',auth[_0xcace('0xb')](),controller[_0xcace('0xc')]);router[_0xcace('0xa')](_0xcace('0xd'),auth[_0xcace('0xb')](),controller[_0xcace('0xe')]);router[_0xcace('0xf')]('/',auth[_0xcace('0xb')](),controller[_0xcace('0x10')]);router[_0xcace('0x11')]('/:id',auth[_0xcace('0xb')](),controller[_0xcace('0x12')]);router[_0xcace('0x13')](_0xcace('0xd'),auth[_0xcace('0xb')](),controller[_0xcace('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8261d24..30ac6ba 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 _0xcaf3=['string','STRING','customVariable','exports','ENUM','variable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaf3,0x10d));var _0x3caf=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0xcaf3[_0x2bc1fe];return _0x1a47a5;};'use strict';var Sequelize=require('sequelize');module[_0x3caf('0x0')]={'type':{'type':Sequelize[_0x3caf('0x1')]('string',_0x3caf('0x2'),'customVariable','keyValue',_0x3caf('0x3')),'defaultValue':_0x3caf('0x4')},'content':{'type':Sequelize[_0x3caf('0x5')]},'key':{'type':Sequelize[_0x3caf('0x5')]},'keyType':{'type':Sequelize[_0x3caf('0x1')](_0x3caf('0x4'),_0x3caf('0x2'),_0x3caf('0x6'))},'keyContent':{'type':Sequelize[_0x3caf('0x5')]},'idField':{'type':Sequelize[_0x3caf('0x5')]},'nameField':{'type':Sequelize[_0x3caf('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x127f=['picklist','STRING','ENUM','sequelize','exports','string','variable','keyValue'];(function(_0x509d2e,_0x307fde){var _0x292a85=function(_0x1e3731){while(--_0x1e3731){_0x509d2e['push'](_0x509d2e['shift']());}};_0x292a85(++_0x307fde);}(_0x127f,0xcb));var _0xf127=function(_0x1d810b,_0xe84392){_0x1d810b=_0x1d810b-0x0;var _0x5b7387=_0x127f[_0x1d810b];return _0x5b7387;};'use strict';var Sequelize=require(_0xf127('0x0'));module[_0xf127('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf127('0x2'),_0xf127('0x3'),'customVariable',_0xf127('0x4'),_0xf127('0x5')),'defaultValue':_0xf127('0x2')},'content':{'type':Sequelize[_0xf127('0x6')]},'key':{'type':Sequelize[_0xf127('0x6')]},'keyType':{'type':Sequelize[_0xf127('0x7')]('string',_0xf127('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xf127('0x6')]},'idField':{'type':Sequelize[_0xf127('0x6')]},'nameField':{'type':Sequelize[_0xf127('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf127('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 53c4bfd..e3ff225 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 _0x9f1b=['index','map','ZendeskField','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','merge','find','create','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','send'];(function(_0xb9eb4b,_0x24a040){var _0x1c2a8c=function(_0x1f3e12){while(--_0x1f3e12){_0xb9eb4b['push'](_0xb9eb4b['shift']());}};_0x1c2a8c(++_0x24a040);}(_0x9f1b,0xbd));var _0xb9f1=function(_0x2ac6ff,_0x33b7d8){_0x2ac6ff=_0x2ac6ff-0x0;var _0x315ca5=_0x9f1b[_0x2ac6ff];return _0x315ca5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9f1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9f1('0x1'));var rp=require(_0xb9f1('0x2'));var moment=require('moment');var BPromise=require(_0xb9f1('0x3'));var Mustache=require(_0xb9f1('0x4'));var util=require(_0xb9f1('0x5'));var path=require(_0xb9f1('0x6'));var sox=require(_0xb9f1('0x7'));var csv=require(_0xb9f1('0x8'));var ejs=require(_0xb9f1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9f1('0xa'));var squel=require(_0xb9f1('0xb'));var crypto=require(_0xb9f1('0xc'));var jsforce=require(_0xb9f1('0xd'));var deskjs=require(_0xb9f1('0xe'));var toCsv=require(_0xb9f1('0x8'));var querystring=require(_0xb9f1('0xf'));var Papa=require(_0xb9f1('0x10'));var Redis=require('ioredis');var authService=require(_0xb9f1('0x11'));var qs=require(_0xb9f1('0x12'));var as=require(_0xb9f1('0x13'));var hardwareService=require(_0xb9f1('0x14'));var logger=require(_0xb9f1('0x15'))(_0xb9f1('0x16'));var utils=require(_0xb9f1('0x17'));var config=require(_0xb9f1('0x18'));var licenseUtil=require(_0xb9f1('0x19'));var db=require(_0xb9f1('0x1a'))['db'];function respondWithStatusCode(_0x2206dd,_0x53f617){_0x53f617=_0x53f617||0xcc;return function(_0x86c04){if(_0x86c04){return _0x2206dd[_0xb9f1('0x1b')](_0x53f617);}return _0x2206dd[_0xb9f1('0x1c')](_0x53f617)[_0xb9f1('0x1d')]();};}function respondWithResult(_0xf54090,_0x4960b4){_0x4960b4=_0x4960b4||0xc8;return function(_0x350add){if(_0x350add){return _0xf54090['status'](_0x4960b4)[_0xb9f1('0x1e')](_0x350add);}};}function respondWithFilteredResult(_0x54edaa,_0xfbf69b){return function(_0x3078a5){if(_0x3078a5){var _0x25e2df=typeof _0xfbf69b['offset']===_0xb9f1('0x1f')&&typeof _0xfbf69b[_0xb9f1('0x20')]==='undefined';var _0x53e6e6=_0x3078a5[_0xb9f1('0x21')];var _0x5b29d8=_0x25e2df?0x0:_0xfbf69b[_0xb9f1('0x22')];var _0x28936c=_0x25e2df?_0x3078a5[_0xb9f1('0x21')]:_0xfbf69b['offset']+_0xfbf69b[_0xb9f1('0x20')];var _0x1f1b73;if(_0x28936c>=_0x53e6e6){_0x28936c=_0x53e6e6;_0x1f1b73=0xc8;}else{_0x1f1b73=0xce;}_0x54edaa[_0xb9f1('0x1c')](_0x1f1b73);return _0x54edaa[_0xb9f1('0x23')]('Content-Range',_0x5b29d8+'-'+_0x28936c+'/'+_0x53e6e6)[_0xb9f1('0x1e')](_0x3078a5);}return null;};}function patchUpdates(_0xf06cf0){return function(_0x2db88b){try{jsonpatch[_0xb9f1('0x24')](_0x2db88b,_0xf06cf0,!![]);}catch(_0x2bb540){return BPromise[_0xb9f1('0x25')](_0x2bb540);}return _0x2db88b[_0xb9f1('0x26')]();};}function saveUpdates(_0x4646a0,_0x59b0a0){return function(_0x158dc3){if(_0x158dc3){return _0x158dc3[_0xb9f1('0x27')](_0x4646a0)['then'](function(_0x197b4c){return _0x197b4c;});}return null;};}function removeEntity(_0x21ad00,_0x4e9935){return function(_0x422f80){if(_0x422f80){return _0x422f80[_0xb9f1('0x28')]()[_0xb9f1('0x29')](function(){_0x21ad00['status'](0xcc)[_0xb9f1('0x1d')]();});}};}function handleEntityNotFound(_0x1c0c9d,_0x5bbd52){return function(_0x231ad4){if(!_0x231ad4){_0x1c0c9d['sendStatus'](0x194);}return _0x231ad4;};}function handleError(_0x5e88d3,_0x18d283){_0x18d283=_0x18d283||0x1f4;return function(_0x5793dc){logger[_0xb9f1('0x2a')](_0x5793dc[_0xb9f1('0x2b')]);if(_0x5793dc['name']){delete _0x5793dc['name'];}_0x5e88d3[_0xb9f1('0x1c')](_0x18d283)[_0xb9f1('0x2c')](_0x5793dc);};}exports[_0xb9f1('0x2d')]=function(_0x89ad8d,_0x2313bf){var _0x468346={},_0x45e8c4={},_0x52efa5={'count':0x0,'rows':[]};var _0x2576d3=_[_0xb9f1('0x2e')](db[_0xb9f1('0x2f')][_0xb9f1('0x30')],function(_0x36d3c7){return{'name':_0x36d3c7[_0xb9f1('0x31')],'type':_0x36d3c7[_0xb9f1('0x32')][_0xb9f1('0x33')]};});_0x45e8c4[_0xb9f1('0x34')]=_[_0xb9f1('0x2e')](_0x2576d3,_0xb9f1('0x35'));_0x45e8c4[_0xb9f1('0x36')]=_['keys'](_0x89ad8d[_0xb9f1('0x36')]);_0x45e8c4[_0xb9f1('0x37')]=_[_0xb9f1('0x38')](_0x45e8c4['model'],_0x45e8c4[_0xb9f1('0x36')]);_0x468346[_0xb9f1('0x39')]=_[_0xb9f1('0x38')](_0x45e8c4[_0xb9f1('0x34')],qs[_0xb9f1('0x3a')](_0x89ad8d[_0xb9f1('0x36')]['fields']));_0x468346[_0xb9f1('0x39')]=_0x468346[_0xb9f1('0x39')][_0xb9f1('0x3b')]?_0x468346[_0xb9f1('0x39')]:_0x45e8c4['model'];if(!_0x89ad8d[_0xb9f1('0x36')][_0xb9f1('0x3c')](_0xb9f1('0x3d'))){_0x468346[_0xb9f1('0x20')]=qs['limit'](_0x89ad8d[_0xb9f1('0x36')][_0xb9f1('0x20')]);_0x468346[_0xb9f1('0x22')]=qs['offset'](_0x89ad8d[_0xb9f1('0x36')][_0xb9f1('0x22')]);}_0x468346['order']=qs[_0xb9f1('0x3e')](_0x89ad8d['query'][_0xb9f1('0x3e')]);_0x468346[_0xb9f1('0x3f')]=qs['filters'](_[_0xb9f1('0x40')](_0x89ad8d[_0xb9f1('0x36')],_0x45e8c4[_0xb9f1('0x37')]),_0x2576d3);if(_0x89ad8d[_0xb9f1('0x36')][_0xb9f1('0x41')]){_0x468346[_0xb9f1('0x3f')]=_['merge'](_0x468346[_0xb9f1('0x3f')],{'$or':_[_0xb9f1('0x2e')](_0x2576d3,function(_0x182259){if(_0x182259['type']!==_0xb9f1('0x42')){var _0x5ac399={};_0x5ac399[_0x182259[_0xb9f1('0x35')]]={'$like':'%'+_0x89ad8d[_0xb9f1('0x36')]['filter']+'%'};return _0x5ac399;}})});}_0x468346=_['merge']({},_0x468346,_0x89ad8d[_0xb9f1('0x43')]);var _0x56c5f1={'where':_0x468346[_0xb9f1('0x3f')]};return db['ZendeskField']['count'](_0x56c5f1)['then'](function(_0x10bf44){_0x52efa5[_0xb9f1('0x21')]=_0x10bf44;if(_0x89ad8d['query'][_0xb9f1('0x44')]){_0x468346['include']=[{'all':!![]}];}return db[_0xb9f1('0x2f')][_0xb9f1('0x45')](_0x468346);})[_0xb9f1('0x29')](function(_0x5c3dff){_0x52efa5[_0xb9f1('0x46')]=_0x5c3dff;return _0x52efa5;})[_0xb9f1('0x29')](respondWithFilteredResult(_0x2313bf,_0x468346))[_0xb9f1('0x47')](handleError(_0x2313bf,null));};exports['show']=function(_0x407c6e,_0x5dcef4){var _0x3f3526={'raw':!![],'where':{'id':_0x407c6e[_0xb9f1('0x48')]['id']}},_0x397c81={};_0x397c81['model']=_[_0xb9f1('0x49')](db[_0xb9f1('0x2f')]['rawAttributes']);_0x397c81[_0xb9f1('0x36')]=_[_0xb9f1('0x49')](_0x407c6e[_0xb9f1('0x36')]);_0x397c81[_0xb9f1('0x37')]=_[_0xb9f1('0x38')](_0x397c81[_0xb9f1('0x34')],_0x397c81[_0xb9f1('0x36')]);_0x3f3526[_0xb9f1('0x39')]=_[_0xb9f1('0x38')](_0x397c81[_0xb9f1('0x34')],qs[_0xb9f1('0x3a')](_0x407c6e[_0xb9f1('0x36')][_0xb9f1('0x3a')]));_0x3f3526['attributes']=_0x3f3526[_0xb9f1('0x39')][_0xb9f1('0x3b')]?_0x3f3526[_0xb9f1('0x39')]:_0x397c81[_0xb9f1('0x34')];if(_0x407c6e[_0xb9f1('0x36')][_0xb9f1('0x44')]){_0x3f3526['include']=[{'all':!![]}];}_0x3f3526=_[_0xb9f1('0x4a')]({},_0x3f3526,_0x407c6e[_0xb9f1('0x43')]);return db['ZendeskField'][_0xb9f1('0x4b')](_0x3f3526)[_0xb9f1('0x29')](handleEntityNotFound(_0x5dcef4,null))[_0xb9f1('0x29')](respondWithResult(_0x5dcef4,null))['catch'](handleError(_0x5dcef4,null));};exports[_0xb9f1('0x4c')]=function(_0x41ba43,_0x60031e){return db[_0xb9f1('0x2f')][_0xb9f1('0x4c')](_0x41ba43[_0xb9f1('0x4d')],{})[_0xb9f1('0x29')](respondWithResult(_0x60031e,0xc9))[_0xb9f1('0x47')](handleError(_0x60031e,null));};exports['update']=function(_0x4e12c5,_0x2989b3){if(_0x4e12c5[_0xb9f1('0x4d')]['id']){delete _0x4e12c5[_0xb9f1('0x4d')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x4e12c5[_0xb9f1('0x48')]['id']}})[_0xb9f1('0x29')](handleEntityNotFound(_0x2989b3,null))[_0xb9f1('0x29')](saveUpdates(_0x4e12c5['body'],null))[_0xb9f1('0x29')](respondWithResult(_0x2989b3,null))[_0xb9f1('0x47')](handleError(_0x2989b3,null));};exports[_0xb9f1('0x28')]=function(_0x3dec3a,_0x3abdec){return db[_0xb9f1('0x2f')][_0xb9f1('0x4b')]({'where':{'id':_0x3dec3a[_0xb9f1('0x48')]['id']}})[_0xb9f1('0x29')](handleEntityNotFound(_0x3abdec,null))[_0xb9f1('0x29')](removeEntity(_0x3abdec,null))[_0xb9f1('0x47')](handleError(_0x3abdec,null));}; \ No newline at end of file +var _0x0b1e=['error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus'];(function(_0x268f40,_0x31e32e){var _0x862f20=function(_0x58a68a){while(--_0x58a68a){_0x268f40['push'](_0x268f40['shift']());}};_0x862f20(++_0x31e32e);}(_0x0b1e,0x1ef));var _0xe0b1=function(_0x5c6c64,_0x12d4cb){_0x5c6c64=_0x5c6c64-0x0;var _0x172174=_0x0b1e[_0x5c6c64];return _0x172174;};'use strict';var emlformat=require(_0xe0b1('0x0'));var rimraf=require(_0xe0b1('0x1'));var zipdir=require(_0xe0b1('0x2'));var jsonpatch=require(_0xe0b1('0x3'));var rp=require(_0xe0b1('0x4'));var moment=require(_0xe0b1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe0b1('0x6'));var util=require(_0xe0b1('0x7'));var path=require(_0xe0b1('0x8'));var sox=require('sox');var csv=require(_0xe0b1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0b1('0xa'));var _=require(_0xe0b1('0xb'));var squel=require('squel');var crypto=require(_0xe0b1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe0b1('0x9'));var querystring=require('querystring');var Papa=require(_0xe0b1('0xd'));var Redis=require(_0xe0b1('0xe'));var authService=require(_0xe0b1('0xf'));var qs=require(_0xe0b1('0x10'));var as=require(_0xe0b1('0x11'));var hardwareService=require(_0xe0b1('0x12'));var logger=require('../../config/logger')(_0xe0b1('0x13'));var utils=require(_0xe0b1('0x14'));var config=require(_0xe0b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b1('0x16'))['db'];function respondWithStatusCode(_0x1581ce,_0x45ba96){_0x45ba96=_0x45ba96||0xcc;return function(_0x2d4d1c){if(_0x2d4d1c){return _0x1581ce['sendStatus'](_0x45ba96);}return _0x1581ce['status'](_0x45ba96)['end']();};}function respondWithResult(_0x545ac1,_0x260c09){_0x260c09=_0x260c09||0xc8;return function(_0x1f4608){if(_0x1f4608){return _0x545ac1[_0xe0b1('0x17')](_0x260c09)[_0xe0b1('0x18')](_0x1f4608);}};}function respondWithFilteredResult(_0xa602c7,_0x28ae83){return function(_0x225f55){if(_0x225f55){var _0x1ce086=typeof _0x28ae83['offset']===_0xe0b1('0x19')&&typeof _0x28ae83['limit']===_0xe0b1('0x19');var _0x1879c9=_0x225f55[_0xe0b1('0x1a')];var _0x4ee632=_0x1ce086?0x0:_0x28ae83[_0xe0b1('0x1b')];var _0x59e1df=_0x1ce086?_0x225f55[_0xe0b1('0x1a')]:_0x28ae83['offset']+_0x28ae83['limit'];var _0x252acc;if(_0x59e1df>=_0x1879c9){_0x59e1df=_0x1879c9;_0x252acc=0xc8;}else{_0x252acc=0xce;}_0xa602c7[_0xe0b1('0x17')](_0x252acc);return _0xa602c7[_0xe0b1('0x1c')]('Content-Range',_0x4ee632+'-'+_0x59e1df+'/'+_0x1879c9)[_0xe0b1('0x18')](_0x225f55);}return null;};}function patchUpdates(_0x270c0f){return function(_0x32e021){try{jsonpatch[_0xe0b1('0x1d')](_0x32e021,_0x270c0f,!![]);}catch(_0x2c4c0){return BPromise[_0xe0b1('0x1e')](_0x2c4c0);}return _0x32e021[_0xe0b1('0x1f')]();};}function saveUpdates(_0x2bf70a,_0x44b43d){return function(_0xf184aa){if(_0xf184aa){return _0xf184aa[_0xe0b1('0x20')](_0x2bf70a)[_0xe0b1('0x21')](function(_0x1b1a78){return _0x1b1a78;});}return null;};}function removeEntity(_0x53b6d2,_0x39732a){return function(_0x3a4f1e){if(_0x3a4f1e){return _0x3a4f1e[_0xe0b1('0x22')]()[_0xe0b1('0x21')](function(){_0x53b6d2[_0xe0b1('0x17')](0xcc)[_0xe0b1('0x23')]();});}};}function handleEntityNotFound(_0x489568,_0x7d2d29){return function(_0xa42ad4){if(!_0xa42ad4){_0x489568[_0xe0b1('0x24')](0x194);}return _0xa42ad4;};}function handleError(_0x1a3831,_0x275c30){_0x275c30=_0x275c30||0x1f4;return function(_0x283811){logger[_0xe0b1('0x25')](_0x283811[_0xe0b1('0x26')]);if(_0x283811[_0xe0b1('0x27')]){delete _0x283811['name'];}_0x1a3831[_0xe0b1('0x17')](_0x275c30)[_0xe0b1('0x28')](_0x283811);};}exports[_0xe0b1('0x29')]=function(_0x4e181d,_0x478d87){var _0xb972a4={},_0x2f6411={},_0xb6431={'count':0x0,'rows':[]};var _0x8f40f9=_[_0xe0b1('0x2a')](db[_0xe0b1('0x2b')][_0xe0b1('0x2c')],function(_0x396863){return{'name':_0x396863[_0xe0b1('0x2d')],'type':_0x396863[_0xe0b1('0x2e')][_0xe0b1('0x2f')]};});_0x2f6411[_0xe0b1('0x30')]=_[_0xe0b1('0x2a')](_0x8f40f9,_0xe0b1('0x27'));_0x2f6411[_0xe0b1('0x31')]=_[_0xe0b1('0x32')](_0x4e181d[_0xe0b1('0x31')]);_0x2f6411[_0xe0b1('0x33')]=_['intersection'](_0x2f6411[_0xe0b1('0x30')],_0x2f6411[_0xe0b1('0x31')]);_0xb972a4[_0xe0b1('0x34')]=_[_0xe0b1('0x35')](_0x2f6411[_0xe0b1('0x30')],qs[_0xe0b1('0x36')](_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x36')]));_0xb972a4[_0xe0b1('0x34')]=_0xb972a4['attributes'][_0xe0b1('0x37')]?_0xb972a4[_0xe0b1('0x34')]:_0x2f6411[_0xe0b1('0x30')];if(!_0x4e181d['query'][_0xe0b1('0x38')](_0xe0b1('0x39'))){_0xb972a4[_0xe0b1('0x3a')]=qs[_0xe0b1('0x3a')](_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x3a')]);_0xb972a4[_0xe0b1('0x1b')]=qs[_0xe0b1('0x1b')](_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x1b')]);}_0xb972a4[_0xe0b1('0x3b')]=qs[_0xe0b1('0x3c')](_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x3c')]);_0xb972a4[_0xe0b1('0x3d')]=qs[_0xe0b1('0x33')](_[_0xe0b1('0x3e')](_0x4e181d[_0xe0b1('0x31')],_0x2f6411[_0xe0b1('0x33')]),_0x8f40f9);if(_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x3f')]){_0xb972a4[_0xe0b1('0x3d')]=_[_0xe0b1('0x40')](_0xb972a4[_0xe0b1('0x3d')],{'$or':_[_0xe0b1('0x2a')](_0x8f40f9,function(_0x9989e7){if(_0x9989e7[_0xe0b1('0x2e')]!==_0xe0b1('0x41')){var _0x24eedb={};_0x24eedb[_0x9989e7['name']]={'$like':'%'+_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x3f')]+'%'};return _0x24eedb;}})});}_0xb972a4=_[_0xe0b1('0x40')]({},_0xb972a4,_0x4e181d[_0xe0b1('0x42')]);var _0x1d604d={'where':_0xb972a4[_0xe0b1('0x3d')]};return db[_0xe0b1('0x2b')][_0xe0b1('0x1a')](_0x1d604d)['then'](function(_0x25f4f2){_0xb6431['count']=_0x25f4f2;if(_0x4e181d[_0xe0b1('0x31')][_0xe0b1('0x43')]){_0xb972a4['include']=[{'all':!![]}];}return db[_0xe0b1('0x2b')][_0xe0b1('0x44')](_0xb972a4);})[_0xe0b1('0x21')](function(_0x2bfa8a){_0xb6431[_0xe0b1('0x45')]=_0x2bfa8a;return _0xb6431;})[_0xe0b1('0x21')](respondWithFilteredResult(_0x478d87,_0xb972a4))[_0xe0b1('0x46')](handleError(_0x478d87,null));};exports[_0xe0b1('0x47')]=function(_0x557104,_0x5e52d7){var _0x5eb4fb={'raw':!![],'where':{'id':_0x557104['params']['id']}},_0x582624={};_0x582624[_0xe0b1('0x30')]=_['keys'](db[_0xe0b1('0x2b')]['rawAttributes']);_0x582624['query']=_[_0xe0b1('0x32')](_0x557104[_0xe0b1('0x31')]);_0x582624[_0xe0b1('0x33')]=_[_0xe0b1('0x35')](_0x582624[_0xe0b1('0x30')],_0x582624['query']);_0x5eb4fb[_0xe0b1('0x34')]=_[_0xe0b1('0x35')](_0x582624[_0xe0b1('0x30')],qs[_0xe0b1('0x36')](_0x557104[_0xe0b1('0x31')][_0xe0b1('0x36')]));_0x5eb4fb[_0xe0b1('0x34')]=_0x5eb4fb[_0xe0b1('0x34')]['length']?_0x5eb4fb[_0xe0b1('0x34')]:_0x582624[_0xe0b1('0x30')];if(_0x557104['query'][_0xe0b1('0x43')]){_0x5eb4fb['include']=[{'all':!![]}];}_0x5eb4fb=_[_0xe0b1('0x40')]({},_0x5eb4fb,_0x557104['options']);return db[_0xe0b1('0x2b')]['find'](_0x5eb4fb)['then'](handleEntityNotFound(_0x5e52d7,null))[_0xe0b1('0x21')](respondWithResult(_0x5e52d7,null))[_0xe0b1('0x46')](handleError(_0x5e52d7,null));};exports[_0xe0b1('0x48')]=function(_0x270c9c,_0x25ad1e){return db[_0xe0b1('0x2b')]['create'](_0x270c9c['body'],{})[_0xe0b1('0x21')](respondWithResult(_0x25ad1e,0xc9))[_0xe0b1('0x46')](handleError(_0x25ad1e,null));};exports['update']=function(_0x3f755c,_0x59af48){if(_0x3f755c[_0xe0b1('0x49')]['id']){delete _0x3f755c[_0xe0b1('0x49')]['id'];}return db[_0xe0b1('0x2b')][_0xe0b1('0x4a')]({'where':{'id':_0x3f755c['params']['id']}})[_0xe0b1('0x21')](handleEntityNotFound(_0x59af48,null))[_0xe0b1('0x21')](saveUpdates(_0x3f755c['body'],null))['then'](respondWithResult(_0x59af48,null))[_0xe0b1('0x46')](handleError(_0x59af48,null));};exports['destroy']=function(_0x10d6e0,_0x4260e4){return db[_0xe0b1('0x2b')][_0xe0b1('0x4a')]({'where':{'id':_0x10d6e0[_0xe0b1('0x4b')]['id']}})[_0xe0b1('0x21')](handleEntityNotFound(_0x4260e4,null))[_0xe0b1('0x21')](removeEntity(_0x4260e4,null))[_0xe0b1('0x46')](handleError(_0x4260e4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c8d575d..9a35c4e 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 _0xa543=['idField','FieldId','lodash','../../config/logger','api','moment','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa543,0xb8));var _0x3a54=function(_0x40daf8,_0x328697){_0x40daf8=_0x40daf8-0x0;var _0xe1d5b4=_0xa543[_0x40daf8];return _0xe1d5b4;};'use strict';var _=require(_0x3a54('0x0'));var util=require('util');var logger=require(_0x3a54('0x1'))(_0x3a54('0x2'));var moment=require(_0x3a54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a54('0x4'));var rimraf=require('rimraf');var config=require(_0x3a54('0x5'));var attributes=require(_0x3a54('0x6'));module[_0x3a54('0x7')]=function(_0x38b2ad,_0x42b00f){return _0x38b2ad[_0x3a54('0x8')](_0x3a54('0x9'),attributes,{'tableName':_0x3a54('0xa'),'paranoid':![],'indexes':[{'name':_0x3a54('0xb'),'fields':[_0x3a54('0xc'),_0x3a54('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34e3=['idField','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','int_zendesk_fields','zendesk_unique_index'];(function(_0x4cc3c0,_0x894350){var _0x485e8f=function(_0x4955a9){while(--_0x4955a9){_0x4cc3c0['push'](_0x4cc3c0['shift']());}};_0x485e8f(++_0x894350);}(_0x34e3,0x12c));var _0x334e=function(_0x167183,_0x283e18){_0x167183=_0x167183-0x0;var _0x2dee08=_0x34e3[_0x167183];return _0x2dee08;};'use strict';var _=require(_0x334e('0x0'));var util=require(_0x334e('0x1'));var logger=require(_0x334e('0x2'))(_0x334e('0x3'));var moment=require('moment');var BPromise=require(_0x334e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x334e('0x5'));var rimraf=require(_0x334e('0x6'));var config=require(_0x334e('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x334e('0x8')]=function(_0x45cda1,_0x596060){return _0x45cda1[_0x334e('0x9')]('ZendeskField',attributes,{'tableName':_0x334e('0xa'),'paranoid':![],'indexes':[{'name':_0x334e('0xb'),'fields':[_0x334e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index fa1ac4e..8d55e98 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 _0xc95d=['info','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc95d,0x71));var _0xdc95=function(_0x1366d2,_0xf898d8){_0x1366d2=_0x1366d2-0x0;var _0x1f6b95=_0xc95d[_0x1366d2];return _0x1f6b95;};'use strict';var _=require('lodash');var util=require(_0xdc95('0x0'));var moment=require(_0xdc95('0x1'));var BPromise=require(_0xdc95('0x2'));var rs=require(_0xdc95('0x3'));var fs=require('fs');var Redis=require(_0xdc95('0x4'));var db=require(_0xdc95('0x5'))['db'];var utils=require(_0xdc95('0x6'));var logger=require(_0xdc95('0x7'))(_0xdc95('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdc95('0x9')][_0xdc95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230d4f,_0x2f309a,_0x19bc5d){return new BPromise(function(_0x199390,_0xa9b697){return client[_0xdc95('0xb')](_0x230d4f,_0x19bc5d)[_0xdc95('0xc')](function(_0x421472){logger['info'](_0xdc95('0xd'),_0x2f309a,'request\x20sent');logger['debug'](_0xdc95('0xe'),_0x2f309a,'request\x20sent',JSON[_0xdc95('0xf')](_0x421472));if(_0x421472[_0xdc95('0x10')]){if(_0x421472['error'][_0xdc95('0x11')]===0x1f4){logger[_0xdc95('0x10')](_0xdc95('0xd'),_0x2f309a,_0x421472[_0xdc95('0x10')][_0xdc95('0x12')]);return _0xa9b697(_0x421472['error'][_0xdc95('0x12')]);}logger[_0xdc95('0x10')](_0xdc95('0xd'),_0x2f309a,_0x421472[_0xdc95('0x10')][_0xdc95('0x12')]);return _0x199390(_0x421472[_0xdc95('0x10')][_0xdc95('0x12')]);}else{logger[_0xdc95('0x13')](_0xdc95('0xd'),_0x2f309a,_0xdc95('0x14'));_0x199390(_0x421472[_0xdc95('0x15')]['message']);}})['catch'](function(_0x193358){logger[_0xdc95('0x10')](_0xdc95('0xd'),_0x2f309a,_0x193358);_0xa9b697(_0x193358);});});} \ No newline at end of file +var _0x80bd=['client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x80bd,0x12f));var _0xd80b=function(_0x41da0d,_0x127bc1){_0x41da0d=_0x41da0d-0x0;var _0x1c6ec9=_0x80bd[_0x41da0d];return _0x1c6ec9;};'use strict';var _=require(_0xd80b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd80b('0x1'));var rs=require(_0xd80b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80b('0x3'))['db'];var utils=require(_0xd80b('0x4'));var logger=require(_0xd80b('0x5'))(_0xd80b('0x6'));var config=require(_0xd80b('0x7'));var jayson=require(_0xd80b('0x8'));var client=jayson[_0xd80b('0x9')][_0xd80b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52cf58,_0x4803aa,_0x2a6b79){return new BPromise(function(_0x3612a9,_0x356b5a){return client[_0xd80b('0xb')](_0x52cf58,_0x2a6b79)[_0xd80b('0xc')](function(_0x3dca83){logger[_0xd80b('0xd')]('ZendeskField,\x20%s,\x20%s',_0x4803aa,_0xd80b('0xe'));logger[_0xd80b('0xf')](_0xd80b('0x10'),_0x4803aa,'request\x20sent',JSON[_0xd80b('0x11')](_0x3dca83));if(_0x3dca83[_0xd80b('0x12')]){if(_0x3dca83[_0xd80b('0x12')][_0xd80b('0x13')]===0x1f4){logger[_0xd80b('0x12')](_0xd80b('0x14'),_0x4803aa,_0x3dca83[_0xd80b('0x12')][_0xd80b('0x15')]);return _0x356b5a(_0x3dca83['error'][_0xd80b('0x15')]);}logger[_0xd80b('0x12')](_0xd80b('0x14'),_0x4803aa,_0x3dca83['error'][_0xd80b('0x15')]);return _0x3612a9(_0x3dca83['error'][_0xd80b('0x15')]);}else{logger[_0xd80b('0xd')](_0xd80b('0x14'),_0x4803aa,_0xd80b('0xe'));_0x3612a9(_0x3dca83[_0xd80b('0x16')][_0xd80b('0x15')]);}})[_0xd80b('0x17')](function(_0x83d84d){logger[_0xd80b('0x12')](_0xd80b('0x14'),_0x4803aa,_0x83d84d);_0x356b5a(_0x83d84d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2dc570c..f954882 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 _0x2985=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','getConfigurations','getFields','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x43fca2,_0xdf46ce){var _0x5ea4ca=function(_0x317c40){while(--_0x317c40){_0x43fca2['push'](_0x43fca2['shift']());}};_0x5ea4ca(++_0xdf46ce);}(_0x2985,0xc3));var _0x5298=function(_0x1cf7c4,_0x5d000d){_0x1cf7c4=_0x1cf7c4-0x0;var _0x1413c0=_0x2985[_0x1cf7c4];return _0x1413c0;};'use strict';var multer=require(_0x5298('0x0'));var util=require(_0x5298('0x1'));var path=require(_0x5298('0x2'));var timeout=require(_0x5298('0x3'));var express=require(_0x5298('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5298('0x5'));var config=require(_0x5298('0x6'));var controller=require(_0x5298('0x7'));router['get']('/',auth[_0x5298('0x8')](),controller[_0x5298('0x9')]);router[_0x5298('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5298('0xb')]);router[_0x5298('0xa')]('/:id/configurations',auth[_0x5298('0x8')](),controller[_0x5298('0xc')]);router[_0x5298('0xa')]('/:id/fields',auth[_0x5298('0x8')](),controller[_0x5298('0xd')]);router[_0x5298('0xe')]('/',auth['isAuthenticated'](),controller[_0x5298('0xf')]);router['post']('/:id/configurations',auth[_0x5298('0x8')](),controller['addConfiguration']);router['put'](_0x5298('0x10'),auth[_0x5298('0x8')](),controller['update']);router[_0x5298('0x11')](_0x5298('0x10'),auth[_0x5298('0x8')](),controller[_0x5298('0x12')]);module[_0x5298('0x13')]=router; \ No newline at end of file +var _0xcf91=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations'];(function(_0x511095,_0x1d269a){var _0x230293=function(_0x55cca4){while(--_0x55cca4){_0x511095['push'](_0x511095['shift']());}};_0x230293(++_0x1d269a);}(_0xcf91,0x1d5));var _0x1cf9=function(_0x57a6b5,_0x2cde27){_0x57a6b5=_0x57a6b5-0x0;var _0x42f6a9=_0xcf91[_0x57a6b5];return _0x42f6a9;};'use strict';var multer=require(_0x1cf9('0x0'));var util=require(_0x1cf9('0x1'));var path=require(_0x1cf9('0x2'));var timeout=require(_0x1cf9('0x3'));var express=require(_0x1cf9('0x4'));var router=express['Router']();var fs_extra=require(_0x1cf9('0x5'));var auth=require(_0x1cf9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1cf9('0x7'));var controller=require(_0x1cf9('0x8'));router['get']('/',auth[_0x1cf9('0x9')](),controller['index']);router[_0x1cf9('0xa')](_0x1cf9('0xb'),auth[_0x1cf9('0x9')](),controller[_0x1cf9('0xc')]);router[_0x1cf9('0xa')](_0x1cf9('0xd'),auth['isAuthenticated'](),controller[_0x1cf9('0xe')]);router[_0x1cf9('0xa')](_0x1cf9('0xf'),auth[_0x1cf9('0x9')](),controller[_0x1cf9('0x10')]);router[_0x1cf9('0x11')]('/',auth[_0x1cf9('0x9')](),controller[_0x1cf9('0x12')]);router[_0x1cf9('0x11')](_0x1cf9('0xd'),auth[_0x1cf9('0x9')](),controller[_0x1cf9('0x13')]);router[_0x1cf9('0x14')]('/:id',auth[_0x1cf9('0x9')](),controller['update']);router[_0x1cf9('0x15')](_0x1cf9('0xb'),auth[_0x1cf9('0x9')](),controller[_0x1cf9('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 acdb52a..c10fc8f 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 _0xf3cd=['exports','STRING','sequelize'];(function(_0x1f086a,_0x553ae1){var _0x1a20b7=function(_0x3732d1){while(--_0x3732d1){_0x1f086a['push'](_0x1f086a['shift']());}};_0x1a20b7(++_0x553ae1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xf3cd[_0x237da8];return _0x558825;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]},'host':{'type':Sequelize[_0xdf3c('0x2')]},'zone':{'type':Sequelize[_0xdf3c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdf3c('0x2')]},'serverUrl':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xdf3c('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2750=['STRING','sequelize'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x2750,0x13b));var _0x0275=function(_0x5b52e3,_0x5da761){_0x5b52e3=_0x5b52e3-0x0;var _0x55ca38=_0x2750[_0x5b52e3];return _0x55ca38;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')]},'description':{'type':Sequelize[_0x0275('0x1')]},'host':{'type':Sequelize[_0x0275('0x1')]},'zone':{'type':Sequelize[_0x0275('0x1')]},'clientId':{'type':Sequelize[_0x0275('0x1')]},'clientSecret':{'type':Sequelize[_0x0275('0x1')]},'serverUrl':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x0275('0x1')]},'refreshToken':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3d959e2..794bbcf 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 _0xfa35=['keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','find','create','params','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','body','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','serverUrl','code','host','com','slice','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','path','sox','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','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0xfa35,0xc5));var _0x5fa3=function(_0x57ebed,_0xfac0ac){_0x57ebed=_0x57ebed-0x0;var _0x3a0874=_0xfa35[_0x57ebed];return _0x3a0874;};'use strict';var emlformat=require(_0x5fa3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5fa3('0x1'));var moment=require(_0x5fa3('0x2'));var BPromise=require(_0x5fa3('0x3'));var Mustache=require(_0x5fa3('0x4'));var util=require('util');var path=require(_0x5fa3('0x5'));var sox=require(_0x5fa3('0x6'));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(_0x5fa3('0x7'));var crypto=require(_0x5fa3('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5fa3('0x9'));var toCsv=require(_0x5fa3('0xa'));var querystring=require(_0x5fa3('0xb'));var Papa=require(_0x5fa3('0xc'));var Redis=require(_0x5fa3('0xd'));var authService=require(_0x5fa3('0xe'));var qs=require(_0x5fa3('0xf'));var as=require(_0x5fa3('0x10'));var hardwareService=require(_0x5fa3('0x11'));var logger=require(_0x5fa3('0x12'))(_0x5fa3('0x13'));var utils=require(_0x5fa3('0x14'));var config=require(_0x5fa3('0x15'));var licenseUtil=require(_0x5fa3('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5fa3('0x17'));function respondWithStatusCode(_0xeac4b3,_0x28170c){_0x28170c=_0x28170c||0xcc;return function(_0x4bbac6){if(_0x4bbac6){return _0xeac4b3[_0x5fa3('0x18')](_0x28170c);}return _0xeac4b3['status'](_0x28170c)[_0x5fa3('0x19')]();};}function respondWithResult(_0xe569ad,_0x638421){_0x638421=_0x638421||0xc8;return function(_0x3af76f){if(_0x3af76f){return _0xe569ad[_0x5fa3('0x1a')](_0x638421)[_0x5fa3('0x1b')](_0x3af76f);}};}function respondWithFilteredResult(_0x582e71,_0x2fdc75){return function(_0x3245ca){if(_0x3245ca){var _0x1d9804=typeof _0x2fdc75[_0x5fa3('0x1c')]===_0x5fa3('0x1d')&&typeof _0x2fdc75[_0x5fa3('0x1e')]===_0x5fa3('0x1d');var _0x562efe=_0x3245ca[_0x5fa3('0x1f')];var _0x48bbeb=_0x1d9804?0x0:_0x2fdc75[_0x5fa3('0x1c')];var _0x145c8b=_0x1d9804?_0x3245ca[_0x5fa3('0x1f')]:_0x2fdc75[_0x5fa3('0x1c')]+_0x2fdc75[_0x5fa3('0x1e')];var _0x4b476b;if(_0x145c8b>=_0x562efe){_0x145c8b=_0x562efe;_0x4b476b=0xc8;}else{_0x4b476b=0xce;}_0x582e71[_0x5fa3('0x1a')](_0x4b476b);return _0x582e71['set'](_0x5fa3('0x20'),_0x48bbeb+'-'+_0x145c8b+'/'+_0x562efe)[_0x5fa3('0x1b')](_0x3245ca);}return null;};}function patchUpdates(_0x42b92e){return function(_0x692bc4){try{jsonpatch[_0x5fa3('0x21')](_0x692bc4,_0x42b92e,!![]);}catch(_0x177fc8){return BPromise['reject'](_0x177fc8);}return _0x692bc4[_0x5fa3('0x22')]();};}function saveUpdates(_0xda9673,_0x4f52e2){return function(_0x5c3ff5){if(_0x5c3ff5){return _0x5c3ff5[_0x5fa3('0x23')](_0xda9673)[_0x5fa3('0x24')](function(_0x21b35e){return _0x21b35e;});}return null;};}function removeEntity(_0x25dde3,_0x497463){return function(_0x54efaf){if(_0x54efaf){return _0x54efaf[_0x5fa3('0x25')]()[_0x5fa3('0x24')](function(){_0x25dde3['status'](0xcc)[_0x5fa3('0x19')]();});}};}function handleEntityNotFound(_0x412c37,_0x27a817){return function(_0x2bc9de){if(!_0x2bc9de){_0x412c37[_0x5fa3('0x18')](0x194);}return _0x2bc9de;};}function handleError(_0x97f3c9,_0x4ddeef){_0x4ddeef=_0x4ddeef||0x1f4;return function(_0x389016){logger[_0x5fa3('0x26')](_0x389016['stack']);if(_0x389016[_0x5fa3('0x27')]){delete _0x389016[_0x5fa3('0x27')];}_0x97f3c9[_0x5fa3('0x1a')](_0x4ddeef)[_0x5fa3('0x28')](_0x389016);};}exports[_0x5fa3('0x29')]=function(_0x32f682,_0x5a66de){var _0x3b0281={},_0x2e8b8a={},_0x339c40={'count':0x0,'rows':[]};var _0x7c961d=_[_0x5fa3('0x2a')](db[_0x5fa3('0x2b')][_0x5fa3('0x2c')],function(_0x43ed27){return{'name':_0x43ed27[_0x5fa3('0x2d')],'type':_0x43ed27[_0x5fa3('0x2e')][_0x5fa3('0x2f')]};});_0x2e8b8a[_0x5fa3('0x30')]=_[_0x5fa3('0x2a')](_0x7c961d,_0x5fa3('0x27'));_0x2e8b8a['query']=_[_0x5fa3('0x31')](_0x32f682[_0x5fa3('0x32')]);_0x2e8b8a[_0x5fa3('0x33')]=_['intersection'](_0x2e8b8a[_0x5fa3('0x30')],_0x2e8b8a[_0x5fa3('0x32')]);_0x3b0281[_0x5fa3('0x34')]=_[_0x5fa3('0x35')](_0x2e8b8a[_0x5fa3('0x30')],qs[_0x5fa3('0x36')](_0x32f682[_0x5fa3('0x32')][_0x5fa3('0x36')]));_0x3b0281[_0x5fa3('0x34')]=_0x3b0281[_0x5fa3('0x34')][_0x5fa3('0x37')]?_0x3b0281[_0x5fa3('0x34')]:_0x2e8b8a[_0x5fa3('0x30')];if(!_0x32f682[_0x5fa3('0x32')][_0x5fa3('0x38')]('nolimit')){_0x3b0281['limit']=qs[_0x5fa3('0x1e')](_0x32f682['query'][_0x5fa3('0x1e')]);_0x3b0281['offset']=qs[_0x5fa3('0x1c')](_0x32f682['query'][_0x5fa3('0x1c')]);}_0x3b0281[_0x5fa3('0x39')]=qs[_0x5fa3('0x3a')](_0x32f682[_0x5fa3('0x32')]['sort']);_0x3b0281[_0x5fa3('0x3b')]=qs[_0x5fa3('0x33')](_[_0x5fa3('0x3c')](_0x32f682[_0x5fa3('0x32')],_0x2e8b8a[_0x5fa3('0x33')]),_0x7c961d);if(_0x32f682['query'][_0x5fa3('0x3d')]){_0x3b0281[_0x5fa3('0x3b')]=_[_0x5fa3('0x3e')](_0x3b0281['where'],{'$or':_['map'](_0x7c961d,function(_0x2dde45){if(_0x2dde45[_0x5fa3('0x2e')]!==_0x5fa3('0x3f')){var _0x43189c={};_0x43189c[_0x2dde45[_0x5fa3('0x27')]]={'$like':'%'+_0x32f682[_0x5fa3('0x32')]['filter']+'%'};return _0x43189c;}})});}_0x3b0281=_[_0x5fa3('0x3e')]({},_0x3b0281,_0x32f682[_0x5fa3('0x40')]);var _0x2b2f38={'where':_0x3b0281['where']};return db[_0x5fa3('0x2b')][_0x5fa3('0x1f')](_0x2b2f38)[_0x5fa3('0x24')](function(_0x406531){_0x339c40[_0x5fa3('0x1f')]=_0x406531;if(_0x32f682['query'][_0x5fa3('0x41')]){_0x3b0281['include']=[{'all':!![]}];}return db[_0x5fa3('0x2b')][_0x5fa3('0x42')](_0x3b0281);})['then'](function(_0x26dfba){_0x339c40[_0x5fa3('0x43')]=_0x26dfba;return _0x339c40;})[_0x5fa3('0x24')](respondWithFilteredResult(_0x5a66de,_0x3b0281))[_0x5fa3('0x44')](handleError(_0x5a66de,null));};exports['show']=function(_0x4f5a81,_0x1af3e5){var _0x320ba5={'raw':![],'where':{'id':_0x4f5a81['params']['id']}},_0x2ee34c={};_0x2ee34c['model']=_[_0x5fa3('0x31')](db[_0x5fa3('0x2b')][_0x5fa3('0x2c')]);_0x2ee34c[_0x5fa3('0x32')]=_['keys'](_0x4f5a81['query']);_0x2ee34c[_0x5fa3('0x33')]=_[_0x5fa3('0x35')](_0x2ee34c['model'],_0x2ee34c['query']);_0x320ba5['attributes']=_['intersection'](_0x2ee34c[_0x5fa3('0x30')],qs[_0x5fa3('0x36')](_0x4f5a81[_0x5fa3('0x32')][_0x5fa3('0x36')]));_0x320ba5[_0x5fa3('0x34')]=_0x320ba5[_0x5fa3('0x34')]['length']?_0x320ba5[_0x5fa3('0x34')]:_0x2ee34c[_0x5fa3('0x30')];if(_0x4f5a81[_0x5fa3('0x32')][_0x5fa3('0x41')]){_0x320ba5['include']=[{'all':!![]}];}_0x320ba5=_[_0x5fa3('0x3e')]({},_0x320ba5,_0x4f5a81[_0x5fa3('0x40')]);return db[_0x5fa3('0x2b')][_0x5fa3('0x45')](_0x320ba5)['then'](handleEntityNotFound(_0x1af3e5,null))[_0x5fa3('0x24')](respondWithResult(_0x1af3e5,null))[_0x5fa3('0x44')](handleError(_0x1af3e5,null));};exports['create']=function(_0x769efc,_0x2a015e){return db['ZohoAccount'][_0x5fa3('0x46')](_0x769efc['body'],{})['then'](respondWithResult(_0x2a015e,0xc9))['catch'](handleError(_0x2a015e,null));};exports[_0x5fa3('0x23')]=function(_0x48d357,_0x249885){if(_0x48d357['body']['id']){delete _0x48d357['body']['id'];}return db[_0x5fa3('0x2b')]['find']({'where':{'id':_0x48d357[_0x5fa3('0x47')]['id']}})[_0x5fa3('0x24')](handleEntityNotFound(_0x249885,null))['then'](saveUpdates(_0x48d357['body'],null))[_0x5fa3('0x24')](respondWithResult(_0x249885,null))[_0x5fa3('0x44')](handleError(_0x249885,null));};exports[_0x5fa3('0x25')]=function(_0x364477,_0x1139e5){return db[_0x5fa3('0x2b')][_0x5fa3('0x45')]({'where':{'id':_0x364477[_0x5fa3('0x47')]['id']}})[_0x5fa3('0x24')](handleEntityNotFound(_0x1139e5,null))[_0x5fa3('0x24')](removeEntity(_0x1139e5,null))[_0x5fa3('0x44')](handleError(_0x1139e5,null));};exports[_0x5fa3('0x48')]=function(_0x1c9218,_0x5cbbbf,_0x3cde32){var _0x3fc913={};var _0x2deb3d={};var _0x52f18f;var _0x17e1f0;return db[_0x5fa3('0x2b')]['findOne']({'where':{'id':_0x1c9218[_0x5fa3('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cbbbf,null))[_0x5fa3('0x24')](function(_0xfc1bd2){if(_0xfc1bd2){_0x52f18f=_0xfc1bd2;_0x2deb3d['model']=_[_0x5fa3('0x31')](db[_0x5fa3('0x49')][_0x5fa3('0x2c')]);_0x2deb3d[_0x5fa3('0x32')]=_[_0x5fa3('0x31')](_0x1c9218['query']);_0x2deb3d[_0x5fa3('0x33')]=_[_0x5fa3('0x35')](_0x2deb3d['model'],_0x2deb3d['query']);_0x3fc913[_0x5fa3('0x34')]=_[_0x5fa3('0x35')](_0x2deb3d[_0x5fa3('0x30')],qs[_0x5fa3('0x36')](_0x1c9218[_0x5fa3('0x32')][_0x5fa3('0x36')]));_0x3fc913[_0x5fa3('0x34')]=_0x3fc913['attributes'][_0x5fa3('0x37')]?_0x3fc913[_0x5fa3('0x34')]:_0x2deb3d['model'];_0x3fc913['order']=qs[_0x5fa3('0x3a')](_0x1c9218[_0x5fa3('0x32')][_0x5fa3('0x3a')]);_0x3fc913[_0x5fa3('0x3b')]=qs[_0x5fa3('0x33')](_[_0x5fa3('0x3c')](_0x1c9218[_0x5fa3('0x32')],_0x2deb3d[_0x5fa3('0x33')]));if(_0x1c9218[_0x5fa3('0x32')][_0x5fa3('0x3d')]){_0x3fc913[_0x5fa3('0x3b')]=_['merge'](_0x3fc913[_0x5fa3('0x3b')],{'$or':_['map'](_0x3fc913[_0x5fa3('0x34')],function(_0x3bd380){var _0x4b9eae={};_0x4b9eae[_0x3bd380]={'$like':'%'+_0x1c9218[_0x5fa3('0x32')][_0x5fa3('0x3d')]+'%'};return _0x4b9eae;})});}_0x3fc913=_['merge']({},_0x3fc913,_0x1c9218[_0x5fa3('0x40')]);return _0x52f18f['getConfigurations'](_0x3fc913);}})['then'](function(_0x53a0ff){if(_0x53a0ff){_0x17e1f0=_0x53a0ff[_0x5fa3('0x37')];if(!_0x1c9218[_0x5fa3('0x32')]['hasOwnProperty'](_0x5fa3('0x4a'))){_0x3fc913[_0x5fa3('0x1e')]=qs[_0x5fa3('0x1e')](_0x1c9218['query'][_0x5fa3('0x1e')]);_0x3fc913[_0x5fa3('0x1c')]=qs[_0x5fa3('0x1c')](_0x1c9218[_0x5fa3('0x32')]['offset']);}return _0x52f18f['getConfigurations'](_0x3fc913);}})[_0x5fa3('0x24')](function(_0x12cbad){if(_0x12cbad){return _0x12cbad?{'count':_0x17e1f0,'rows':_0x12cbad}:null;}})['then'](respondWithResult(_0x5cbbbf,null))[_0x5fa3('0x44')](handleError(_0x5cbbbf,null));};exports[_0x5fa3('0x4b')]=function(_0xf04ee8,_0xa55e96,_0x4173ed){if(_0xf04ee8[_0x5fa3('0x4c')]['id']){delete _0xf04ee8[_0x5fa3('0x4c')]['id'];}return db['ZohoAccount'][_0x5fa3('0x4d')]({'where':{'id':_0xf04ee8['params']['id']}})['then'](handleEntityNotFound(_0xa55e96,null))[_0x5fa3('0x24')](function(_0x403ded){if(_0x403ded){_0xf04ee8['body'][_0x5fa3('0x4e')]=_0x403ded['id'];_0xf04ee8[_0x5fa3('0x4c')]['Subjects']=integrations[_0x5fa3('0x4f')](_0xf04ee8[_0x5fa3('0x4c')]['channel'],_0xf04ee8['body'][_0x5fa3('0x2e')]);_0xf04ee8[_0x5fa3('0x4c')][_0x5fa3('0x50')]=integrations[_0x5fa3('0x51')](_0xf04ee8[_0x5fa3('0x4c')]['channel'],_0xf04ee8[_0x5fa3('0x4c')][_0x5fa3('0x2e')]);return db[_0x5fa3('0x49')][_0x5fa3('0x46')](_0xf04ee8[_0x5fa3('0x4c')],{'include':[{'model':db[_0x5fa3('0x52')],'as':_0x5fa3('0x53')},{'model':db['ZohoField'],'as':_0x5fa3('0x50')}]});}return null;})[_0x5fa3('0x24')](respondWithResult(_0xa55e96,null))[_0x5fa3('0x44')](handleError(_0xa55e96,null));};function getAccessToken(_0x1d7074){return new Promise(function(_0x3cad98,_0x4c4158){var _0x4c3b0a;switch(_0x1d7074[_0x5fa3('0x54')]){case'US':_0x4c3b0a=_0x5fa3('0x55');break;case'AU':_0x4c3b0a='https://accounts.zoho.com.au';break;case'EU':_0x4c3b0a=_0x5fa3('0x56');break;case'IN':_0x4c3b0a=_0x5fa3('0x57');break;case'CN':_0x4c3b0a=_0x5fa3('0x58');break;default:_0x4c3b0a=_0x5fa3('0x56');break;}var _0x1972a6={'method':_0x5fa3('0x59'),'uri':_0x4c3b0a+_0x5fa3('0x5a'),'qs':{'refresh_token':_0x1d7074[_0x5fa3('0x5b')],'client_id':_0x1d7074[_0x5fa3('0x5c')],'client_secret':_0x1d7074[_0x5fa3('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1972a6)[_0x5fa3('0x24')](function(_0x29147f){if(_0x29147f[_0x5fa3('0x5e')]){_0x3cad98(_0x29147f[_0x5fa3('0x5e')]);}else{_0x4c4158('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x5fa3('0x44')](function(_0xc14a21){_0x4c4158(_0xc14a21);});});}exports[_0x5fa3('0x5f')]=function(_0x18d3a3,_0x428f81,_0xbf661){var _0x4572c5,_0x1f3076,_0x31b977,_0x1f184f,_0x2c9f4a;return db[_0x5fa3('0x2b')][_0x5fa3('0x4d')]({'where':{'id':_0x18d3a3[_0x5fa3('0x47')]['id']},'attributes':['id','host',_0x5fa3('0x54'),_0x5fa3('0x5c'),_0x5fa3('0x5d'),_0x5fa3('0x60'),_0x5fa3('0x61'),_0x5fa3('0x5b')]})[_0x5fa3('0x24')](handleEntityNotFound(_0x428f81,null))[_0x5fa3('0x24')](function(_0x2858b1){_0x2c9f4a=_0x2858b1;_0x4572c5=_0x2c9f4a[_0x5fa3('0x62')];_0x1f3076=_0x4572c5==='zoho.eu'?'eu':_0x5fa3('0x63');_0x31b977=_0x2c9f4a[_0x5fa3('0x60')];var _0x177617=_0x31b977[_0x5fa3('0x64')](-0x1);if(_0x177617==='/'||_0x177617==='\x5c'||_0x177617===':'){_0x31b977=_0x31b977['substring'](0x0,_0x31b977['lastIndexOf'](_0x177617));}if(!_0x2c9f4a['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2c9f4a);})[_0x5fa3('0x24')](function(_0x4a0a9e){if(_0x4a0a9e){return rp({'method':_0x5fa3('0x65'),'uri':util[_0x5fa3('0x66')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x1f3076),'qs':{'module':_0x5fa3('0x67')},'headers':{'Authorization':_0x5fa3('0x68')+_0x4a0a9e},'json':!![]});}})[_0x5fa3('0x24')](function(_0x438aa4){if(_0x438aa4){if(_0x438aa4[_0x5fa3('0x69')]&&_0x438aa4[_0x5fa3('0x69')][_0x5fa3('0x26')]){throw new Error(_0x438aa4['response'][_0x5fa3('0x26')][_0x5fa3('0x6a')]);}var _0x33f236=[];var _0x5cfd60=[];var _0xead1ee=['Owner',_0x5fa3('0x6b'),_0x5fa3('0x6c'),_0x5fa3('0x6d'),_0x5fa3('0x6e'),_0x5fa3('0x6f'),_0x5fa3('0x70'),'Call_Type'];_0x5cfd60=_['remove'](_0x438aa4['fields'],function(_0x3bea3a){return _0xead1ee['includes'](_0x3bea3a[_0x5fa3('0x71')]);});for(var _0x210013=0x0;_0x210013<_0x5cfd60[_0x5fa3('0x37')];_0x210013++){if(_0x5cfd60[_0x210013][_0x5fa3('0x72')]===![]){_0x33f236['push']({'id':_0x5cfd60[_0x210013]['id'],'name':_0x5cfd60[_0x210013][_0x5fa3('0x73')],'custom':_0x5cfd60[_0x210013][_0x5fa3('0x74')],'options':_0x5cfd60[_0x210013][_0x5fa3('0x75')]==='picklist'&&_0x5cfd60[_0x210013][_0x5fa3('0x76')][_0x5fa3('0x37')]>-0x1?_[_0x5fa3('0x2a')](_0x5cfd60[_0x210013]['pick_list_values'],function(_0x11d5a8){return{'name':_0x11d5a8,'value':_0x11d5a8};}):[]});}}return{'count':_0x33f236[_0x5fa3('0x37')],'rows':_0x33f236};}else{return{'count':0x0,'rows':[]};}})[_0x5fa3('0x24')](respondWithResult(_0x428f81,null))[_0x5fa3('0x44')](function(_0x3bae68){var _0x593347=_0x18d3a3['query'][_0x5fa3('0x77')]?0x1f4:_0x3bae68[_0x5fa3('0x78')]||0x1f4;logger['error'](_0x5fa3('0x79'),'getFields',_0x593347,JSON['stringify'](_0x3bae68));delete _0x3bae68[_0x5fa3('0x27')];if(_0x593347===0x191){_0x593347=0x190;}_0x428f81[_0x5fa3('0x1a')](_0x593347)[_0x5fa3('0x28')](_0x18d3a3['query']['test']?{'message':_0x5fa3('0x7a'),'statusCode':_0x3bae68[_0x5fa3('0x78')]}:_0x3bae68);});}; \ No newline at end of file +var _0xcea0=['type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','order','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','refreshToken','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','remove','includes','length','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','end','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge'];(function(_0x64de5f,_0x581672){var _0x30e076=function(_0x42f727){while(--_0x42f727){_0x64de5f['push'](_0x64de5f['shift']());}};_0x30e076(++_0x581672);}(_0xcea0,0x1c2));var _0x0cea=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xcea0[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0x0cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cea('0x1'));var jsonpatch=require(_0x0cea('0x2'));var rp=require(_0x0cea('0x3'));var moment=require(_0x0cea('0x4'));var BPromise=require(_0x0cea('0x5'));var Mustache=require('mustache');var util=require(_0x0cea('0x6'));var path=require(_0x0cea('0x7'));var sox=require('sox');var csv=require(_0x0cea('0x8'));var ejs=require(_0x0cea('0x9'));var fs=require('fs');var fs_extra=require(_0x0cea('0xa'));var _=require(_0x0cea('0xb'));var squel=require(_0x0cea('0xc'));var crypto=require(_0x0cea('0xd'));var jsforce=require(_0x0cea('0xe'));var deskjs=require(_0x0cea('0xf'));var toCsv=require(_0x0cea('0x8'));var querystring=require('querystring');var Papa=require(_0x0cea('0x10'));var Redis=require('ioredis');var authService=require(_0x0cea('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cea('0x12'));var logger=require(_0x0cea('0x13'))(_0x0cea('0x14'));var utils=require(_0x0cea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0cea('0x16'));var db=require(_0x0cea('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x38625f,_0x20b4e0){_0x20b4e0=_0x20b4e0||0xcc;return function(_0x3950d1){if(_0x3950d1){return _0x38625f[_0x0cea('0x18')](_0x20b4e0);}return _0x38625f['status'](_0x20b4e0)['end']();};}function respondWithResult(_0x415527,_0x5d8fe3){_0x5d8fe3=_0x5d8fe3||0xc8;return function(_0x27f83c){if(_0x27f83c){return _0x415527[_0x0cea('0x19')](_0x5d8fe3)[_0x0cea('0x1a')](_0x27f83c);}};}function respondWithFilteredResult(_0x42660f,_0x3e6ddc){return function(_0x2dcd62){if(_0x2dcd62){var _0x177759=typeof _0x3e6ddc[_0x0cea('0x1b')]===_0x0cea('0x1c')&&typeof _0x3e6ddc[_0x0cea('0x1d')]==='undefined';var _0x312c06=_0x2dcd62[_0x0cea('0x1e')];var _0x5e325d=_0x177759?0x0:_0x3e6ddc[_0x0cea('0x1b')];var _0x5b2c80=_0x177759?_0x2dcd62[_0x0cea('0x1e')]:_0x3e6ddc[_0x0cea('0x1b')]+_0x3e6ddc['limit'];var _0x275b67;if(_0x5b2c80>=_0x312c06){_0x5b2c80=_0x312c06;_0x275b67=0xc8;}else{_0x275b67=0xce;}_0x42660f['status'](_0x275b67);return _0x42660f[_0x0cea('0x1f')]('Content-Range',_0x5e325d+'-'+_0x5b2c80+'/'+_0x312c06)[_0x0cea('0x1a')](_0x2dcd62);}return null;};}function patchUpdates(_0x34eea0){return function(_0x22ac81){try{jsonpatch['apply'](_0x22ac81,_0x34eea0,!![]);}catch(_0x5efab1){return BPromise[_0x0cea('0x20')](_0x5efab1);}return _0x22ac81['save']();};}function saveUpdates(_0x21fec5,_0x3bad1b){return function(_0x188695){if(_0x188695){return _0x188695[_0x0cea('0x21')](_0x21fec5)[_0x0cea('0x22')](function(_0x533665){return _0x533665;});}return null;};}function removeEntity(_0x271a15,_0x13b228){return function(_0x56d7a8){if(_0x56d7a8){return _0x56d7a8[_0x0cea('0x23')]()[_0x0cea('0x22')](function(){_0x271a15[_0x0cea('0x19')](0xcc)[_0x0cea('0x24')]();});}};}function handleEntityNotFound(_0x230fe9,_0x1ccd2b){return function(_0x1a4844){if(!_0x1a4844){_0x230fe9[_0x0cea('0x18')](0x194);}return _0x1a4844;};}function handleError(_0x4bfe96,_0x1226cb){_0x1226cb=_0x1226cb||0x1f4;return function(_0x217ea8){logger['error'](_0x217ea8[_0x0cea('0x25')]);if(_0x217ea8[_0x0cea('0x26')]){delete _0x217ea8[_0x0cea('0x26')];}_0x4bfe96['status'](_0x1226cb)[_0x0cea('0x27')](_0x217ea8);};}exports[_0x0cea('0x28')]=function(_0x17458f,_0x4b817d){var _0xb6e394={},_0x5ba6c2={},_0x29dac0={'count':0x0,'rows':[]};var _0x21372f=_['map'](db[_0x0cea('0x29')][_0x0cea('0x2a')],function(_0x5ceffc){return{'name':_0x5ceffc[_0x0cea('0x2b')],'type':_0x5ceffc['type'][_0x0cea('0x2c')]};});_0x5ba6c2[_0x0cea('0x2d')]=_[_0x0cea('0x2e')](_0x21372f,_0x0cea('0x26'));_0x5ba6c2[_0x0cea('0x2f')]=_['keys'](_0x17458f[_0x0cea('0x2f')]);_0x5ba6c2[_0x0cea('0x30')]=_[_0x0cea('0x31')](_0x5ba6c2[_0x0cea('0x2d')],_0x5ba6c2[_0x0cea('0x2f')]);_0xb6e394[_0x0cea('0x32')]=_[_0x0cea('0x31')](_0x5ba6c2[_0x0cea('0x2d')],qs[_0x0cea('0x33')](_0x17458f[_0x0cea('0x2f')][_0x0cea('0x33')]));_0xb6e394[_0x0cea('0x32')]=_0xb6e394[_0x0cea('0x32')]['length']?_0xb6e394[_0x0cea('0x32')]:_0x5ba6c2[_0x0cea('0x2d')];if(!_0x17458f[_0x0cea('0x2f')]['hasOwnProperty'](_0x0cea('0x34'))){_0xb6e394['limit']=qs['limit'](_0x17458f[_0x0cea('0x2f')][_0x0cea('0x1d')]);_0xb6e394[_0x0cea('0x1b')]=qs[_0x0cea('0x1b')](_0x17458f[_0x0cea('0x2f')][_0x0cea('0x1b')]);}_0xb6e394['order']=qs[_0x0cea('0x35')](_0x17458f['query'][_0x0cea('0x35')]);_0xb6e394[_0x0cea('0x36')]=qs['filters'](_[_0x0cea('0x37')](_0x17458f[_0x0cea('0x2f')],_0x5ba6c2[_0x0cea('0x30')]),_0x21372f);if(_0x17458f[_0x0cea('0x2f')][_0x0cea('0x38')]){_0xb6e394[_0x0cea('0x36')]=_[_0x0cea('0x39')](_0xb6e394[_0x0cea('0x36')],{'$or':_['map'](_0x21372f,function(_0x5d174d){if(_0x5d174d[_0x0cea('0x3a')]!==_0x0cea('0x3b')){var _0x4c0435={};_0x4c0435[_0x5d174d[_0x0cea('0x26')]]={'$like':'%'+_0x17458f['query'][_0x0cea('0x38')]+'%'};return _0x4c0435;}})});}_0xb6e394=_[_0x0cea('0x39')]({},_0xb6e394,_0x17458f[_0x0cea('0x3c')]);var _0xb6bca5={'where':_0xb6e394[_0x0cea('0x36')]};return db['ZohoAccount'][_0x0cea('0x1e')](_0xb6bca5)[_0x0cea('0x22')](function(_0x25873c){_0x29dac0[_0x0cea('0x1e')]=_0x25873c;if(_0x17458f[_0x0cea('0x2f')][_0x0cea('0x3d')]){_0xb6e394[_0x0cea('0x3e')]=[{'all':!![]}];}return db[_0x0cea('0x29')][_0x0cea('0x3f')](_0xb6e394);})['then'](function(_0x555d4e){_0x29dac0[_0x0cea('0x40')]=_0x555d4e;return _0x29dac0;})[_0x0cea('0x22')](respondWithFilteredResult(_0x4b817d,_0xb6e394))[_0x0cea('0x41')](handleError(_0x4b817d,null));};exports[_0x0cea('0x42')]=function(_0x2477ae,_0x25302e){var _0x1079c7={'raw':![],'where':{'id':_0x2477ae['params']['id']}},_0x36ae57={};_0x36ae57[_0x0cea('0x2d')]=_['keys'](db['ZohoAccount'][_0x0cea('0x2a')]);_0x36ae57[_0x0cea('0x2f')]=_[_0x0cea('0x43')](_0x2477ae['query']);_0x36ae57['filters']=_[_0x0cea('0x31')](_0x36ae57[_0x0cea('0x2d')],_0x36ae57[_0x0cea('0x2f')]);_0x1079c7['attributes']=_[_0x0cea('0x31')](_0x36ae57['model'],qs[_0x0cea('0x33')](_0x2477ae[_0x0cea('0x2f')][_0x0cea('0x33')]));_0x1079c7[_0x0cea('0x32')]=_0x1079c7[_0x0cea('0x32')]['length']?_0x1079c7['attributes']:_0x36ae57['model'];if(_0x2477ae[_0x0cea('0x2f')][_0x0cea('0x3d')]){_0x1079c7[_0x0cea('0x3e')]=[{'all':!![]}];}_0x1079c7=_[_0x0cea('0x39')]({},_0x1079c7,_0x2477ae[_0x0cea('0x3c')]);return db['ZohoAccount'][_0x0cea('0x44')](_0x1079c7)[_0x0cea('0x22')](handleEntityNotFound(_0x25302e,null))[_0x0cea('0x22')](respondWithResult(_0x25302e,null))['catch'](handleError(_0x25302e,null));};exports[_0x0cea('0x45')]=function(_0x1fe24d,_0x5377b7){return db['ZohoAccount'][_0x0cea('0x45')](_0x1fe24d['body'],{})[_0x0cea('0x22')](respondWithResult(_0x5377b7,0xc9))[_0x0cea('0x41')](handleError(_0x5377b7,null));};exports[_0x0cea('0x21')]=function(_0x5535e8,_0x3b79fe){if(_0x5535e8['body']['id']){delete _0x5535e8[_0x0cea('0x46')]['id'];}return db[_0x0cea('0x29')][_0x0cea('0x44')]({'where':{'id':_0x5535e8['params']['id']}})['then'](handleEntityNotFound(_0x3b79fe,null))[_0x0cea('0x22')](saveUpdates(_0x5535e8['body'],null))[_0x0cea('0x22')](respondWithResult(_0x3b79fe,null))[_0x0cea('0x41')](handleError(_0x3b79fe,null));};exports['destroy']=function(_0x4f11c8,_0x2a4b52){return db['ZohoAccount']['find']({'where':{'id':_0x4f11c8[_0x0cea('0x47')]['id']}})[_0x0cea('0x22')](handleEntityNotFound(_0x2a4b52,null))[_0x0cea('0x22')](removeEntity(_0x2a4b52,null))[_0x0cea('0x41')](handleError(_0x2a4b52,null));};exports[_0x0cea('0x48')]=function(_0x3dc25e,_0x1a8819,_0x1a5ae6){var _0xa8011e={};var _0x11e331={};var _0x566738;var _0x122fa8;return db[_0x0cea('0x29')]['findOne']({'where':{'id':_0x3dc25e[_0x0cea('0x47')]['id']}})[_0x0cea('0x22')](handleEntityNotFound(_0x1a8819,null))[_0x0cea('0x22')](function(_0x3a0f68){if(_0x3a0f68){_0x566738=_0x3a0f68;_0x11e331['model']=_['keys'](db['ZohoConfiguration'][_0x0cea('0x2a')]);_0x11e331[_0x0cea('0x2f')]=_[_0x0cea('0x43')](_0x3dc25e[_0x0cea('0x2f')]);_0x11e331['filters']=_[_0x0cea('0x31')](_0x11e331[_0x0cea('0x2d')],_0x11e331['query']);_0xa8011e[_0x0cea('0x32')]=_[_0x0cea('0x31')](_0x11e331[_0x0cea('0x2d')],qs[_0x0cea('0x33')](_0x3dc25e[_0x0cea('0x2f')][_0x0cea('0x33')]));_0xa8011e[_0x0cea('0x32')]=_0xa8011e[_0x0cea('0x32')]['length']?_0xa8011e[_0x0cea('0x32')]:_0x11e331['model'];_0xa8011e[_0x0cea('0x49')]=qs[_0x0cea('0x35')](_0x3dc25e['query'][_0x0cea('0x35')]);_0xa8011e[_0x0cea('0x36')]=qs[_0x0cea('0x30')](_[_0x0cea('0x37')](_0x3dc25e[_0x0cea('0x2f')],_0x11e331[_0x0cea('0x30')]));if(_0x3dc25e[_0x0cea('0x2f')][_0x0cea('0x38')]){_0xa8011e['where']=_[_0x0cea('0x39')](_0xa8011e['where'],{'$or':_[_0x0cea('0x2e')](_0xa8011e[_0x0cea('0x32')],function(_0x2be29a){var _0x8b6ce2={};_0x8b6ce2[_0x2be29a]={'$like':'%'+_0x3dc25e[_0x0cea('0x2f')][_0x0cea('0x38')]+'%'};return _0x8b6ce2;})});}_0xa8011e=_[_0x0cea('0x39')]({},_0xa8011e,_0x3dc25e[_0x0cea('0x3c')]);return _0x566738['getConfigurations'](_0xa8011e);}})[_0x0cea('0x22')](function(_0x22561b){if(_0x22561b){_0x122fa8=_0x22561b['length'];if(!_0x3dc25e[_0x0cea('0x2f')][_0x0cea('0x4a')]('nolimit')){_0xa8011e[_0x0cea('0x1d')]=qs['limit'](_0x3dc25e[_0x0cea('0x2f')]['limit']);_0xa8011e['offset']=qs[_0x0cea('0x1b')](_0x3dc25e['query'][_0x0cea('0x1b')]);}return _0x566738[_0x0cea('0x48')](_0xa8011e);}})[_0x0cea('0x22')](function(_0x416938){if(_0x416938){return _0x416938?{'count':_0x122fa8,'rows':_0x416938}:null;}})[_0x0cea('0x22')](respondWithResult(_0x1a8819,null))['catch'](handleError(_0x1a8819,null));};exports[_0x0cea('0x4b')]=function(_0x452d70,_0x57565e,_0x443447){if(_0x452d70[_0x0cea('0x46')]['id']){delete _0x452d70[_0x0cea('0x46')]['id'];}return db[_0x0cea('0x29')][_0x0cea('0x4c')]({'where':{'id':_0x452d70[_0x0cea('0x47')]['id']}})[_0x0cea('0x22')](handleEntityNotFound(_0x57565e,null))[_0x0cea('0x22')](function(_0xba90d5){if(_0xba90d5){_0x452d70[_0x0cea('0x46')][_0x0cea('0x4d')]=_0xba90d5['id'];_0x452d70['body']['Subjects']=integrations[_0x0cea('0x4e')](_0x452d70[_0x0cea('0x46')][_0x0cea('0x4f')],_0x452d70['body']['type']);_0x452d70['body']['Descriptions']=integrations[_0x0cea('0x50')](_0x452d70['body'][_0x0cea('0x4f')],_0x452d70[_0x0cea('0x46')][_0x0cea('0x3a')]);return db[_0x0cea('0x51')][_0x0cea('0x45')](_0x452d70[_0x0cea('0x46')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x0cea('0x52')],'as':_0x0cea('0x53')}]});}return null;})['then'](respondWithResult(_0x57565e,null))['catch'](handleError(_0x57565e,null));};function getAccessToken(_0x10fb2f){return new Promise(function(_0x48ca25,_0x6a8638){var _0x27f7d7;switch(_0x10fb2f[_0x0cea('0x54')]){case'US':_0x27f7d7='https://accounts.zoho.com';break;case'AU':_0x27f7d7=_0x0cea('0x55');break;case'EU':_0x27f7d7=_0x0cea('0x56');break;case'IN':_0x27f7d7=_0x0cea('0x57');break;case'CN':_0x27f7d7=_0x0cea('0x58');break;default:_0x27f7d7=_0x0cea('0x56');break;}var _0x598fc9={'method':'POST','uri':_0x27f7d7+_0x0cea('0x59'),'qs':{'refresh_token':_0x10fb2f['refreshToken'],'client_id':_0x10fb2f[_0x0cea('0x5a')],'client_secret':_0x10fb2f[_0x0cea('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x598fc9)[_0x0cea('0x22')](function(_0x4c7bfd){if(_0x4c7bfd[_0x0cea('0x5c')]){_0x48ca25(_0x4c7bfd[_0x0cea('0x5c')]);}else{_0x6a8638(_0x0cea('0x5d'));}})[_0x0cea('0x41')](function(_0x5af06a){_0x6a8638(_0x5af06a);});});}exports[_0x0cea('0x5e')]=function(_0x192e71,_0x5f5634,_0x175aeb){var _0x509ed8,_0x578e17,_0x294792,_0x2a9d82,_0x4e08b9;return db[_0x0cea('0x29')][_0x0cea('0x4c')]({'where':{'id':_0x192e71[_0x0cea('0x47')]['id']},'attributes':['id','host','zone','clientId',_0x0cea('0x5b'),_0x0cea('0x5f'),_0x0cea('0x60'),_0x0cea('0x61')]})[_0x0cea('0x22')](handleEntityNotFound(_0x5f5634,null))[_0x0cea('0x22')](function(_0x5420f8){_0x4e08b9=_0x5420f8;_0x509ed8=_0x4e08b9[_0x0cea('0x62')];_0x578e17=_0x509ed8==='zoho.eu'?'eu':_0x0cea('0x63');_0x294792=_0x4e08b9[_0x0cea('0x5f')];var _0x459f0b=_0x294792[_0x0cea('0x64')](-0x1);if(_0x459f0b==='/'||_0x459f0b==='\x5c'||_0x459f0b===':'){_0x294792=_0x294792[_0x0cea('0x65')](0x0,_0x294792[_0x0cea('0x66')](_0x459f0b));}if(!_0x4e08b9['refreshToken']){throw new Error(_0x0cea('0x67'));}return getAccessToken(_0x4e08b9);})[_0x0cea('0x22')](function(_0x59a811){if(_0x59a811){return rp({'method':_0x0cea('0x68'),'uri':util['format'](_0x0cea('0x69'),_0x578e17),'qs':{'module':_0x0cea('0x6a')},'headers':{'Authorization':_0x0cea('0x6b')+_0x59a811},'json':!![]});}})[_0x0cea('0x22')](function(_0x17c8e2){if(_0x17c8e2){if(_0x17c8e2[_0x0cea('0x6c')]&&_0x17c8e2['response'][_0x0cea('0x6d')]){throw new Error(_0x17c8e2[_0x0cea('0x6c')][_0x0cea('0x6d')][_0x0cea('0x6e')]);}var _0x464c89=[];var _0x361328=[];var _0x3fb961=['Owner',_0x0cea('0x6f'),_0x0cea('0x70'),'WhoId',_0x0cea('0x71'),'Call_Result',_0x0cea('0x72'),_0x0cea('0x73')];_0x361328=_[_0x0cea('0x74')](_0x17c8e2[_0x0cea('0x33')],function(_0x2b9fd2){return _0x3fb961[_0x0cea('0x75')](_0x2b9fd2['api_name']);});for(var _0x3989f9=0x0;_0x3989f9<_0x361328[_0x0cea('0x76')];_0x3989f9++){if(_0x361328[_0x3989f9][_0x0cea('0x77')]===![]){_0x464c89[_0x0cea('0x78')]({'id':_0x361328[_0x3989f9]['id'],'name':_0x361328[_0x3989f9]['display_label'],'custom':_0x361328[_0x3989f9][_0x0cea('0x79')],'options':_0x361328[_0x3989f9][_0x0cea('0x7a')]===_0x0cea('0x7b')&&_0x361328[_0x3989f9][_0x0cea('0x7c')]['length']>-0x1?_[_0x0cea('0x2e')](_0x361328[_0x3989f9][_0x0cea('0x7c')],function(_0x186cfe){return{'name':_0x186cfe,'value':_0x186cfe};}):[]});}}return{'count':_0x464c89['length'],'rows':_0x464c89};}else{return{'count':0x0,'rows':[]};}})[_0x0cea('0x22')](respondWithResult(_0x5f5634,null))[_0x0cea('0x41')](function(_0x6c718e){var _0x1b35f9=_0x192e71[_0x0cea('0x2f')][_0x0cea('0x7d')]?0x1f4:_0x6c718e[_0x0cea('0x7e')]||0x1f4;logger[_0x0cea('0x6d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0cea('0x5e'),_0x1b35f9,JSON['stringify'](_0x6c718e));delete _0x6c718e[_0x0cea('0x26')];if(_0x1b35f9===0x191){_0x1b35f9=0x190;}_0x5f5634[_0x0cea('0x19')](_0x1b35f9)[_0x0cea('0x27')](_0x192e71[_0x0cea('0x2f')][_0x0cea('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x6c718e['statusCode']}:_0x6c718e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index eb3a814..e1ffe28 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 _0xb1a9=['POST','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','code','substring','/oauth/v2/token','authorization_code','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x40a8a1,_0x5835e0){var _0x1393e9=function(_0x1b0a47){while(--_0x1b0a47){_0x40a8a1['push'](_0x40a8a1['shift']());}};_0x1393e9(++_0x5835e0);}(_0xb1a9,0x145));var _0x9b1a=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0xb1a9[_0x2ba740];return _0x358bda;};'use strict';var _=require(_0x9b1a('0x0'));var util=require(_0x9b1a('0x1'));var logger=require(_0x9b1a('0x2'))(_0x9b1a('0x3'));var moment=require(_0x9b1a('0x4'));var BPromise=require(_0x9b1a('0x5'));var rp=require(_0x9b1a('0x6'));var fs=require('fs');var path=require(_0x9b1a('0x7'));var rimraf=require('rimraf');var config=require(_0x9b1a('0x8'));var attributes=require(_0x9b1a('0x9'));var integrations=require(_0x9b1a('0xa'));module[_0x9b1a('0xb')]=function(_0x23bde8,_0xc6a313){return _0x23bde8['define'](_0x9b1a('0xc'),attributes,{'tableName':_0x9b1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24d50d,_0x44b205,_0x118512){if(_0x24d50d[_0x9b1a('0xe')](_0x9b1a('0xf'))||_0x24d50d[_0x9b1a('0xe')]('serverUrl')||_0x24d50d[_0x9b1a('0xe')](_0x9b1a('0x10'))||_0x24d50d[_0x9b1a('0xe')](_0x9b1a('0x11'))||_0x24d50d[_0x9b1a('0xe')]('code')||_0x24d50d[_0x9b1a('0xe')](_0x9b1a('0x12'))){var _0x233988,_0x525aa5;_0x233988=_0x24d50d[_0x9b1a('0x13')];var _0x246aaa=_0x233988[_0x9b1a('0x14')](-0x1);if(_0x246aaa==='/'||_0x246aaa==='\x5c'||_0x246aaa===':'){_0x233988=_0x233988['substring'](0x0,_0x233988[_0x9b1a('0x15')](_0x246aaa));}switch(_0x24d50d[_0x9b1a('0xf')]){case'US':_0x525aa5=_0x9b1a('0x16');break;case'AU':_0x525aa5=_0x9b1a('0x17');break;case'IN':_0x525aa5=_0x9b1a('0x18');break;case'CN':_0x525aa5=_0x9b1a('0x19');break;default:_0x525aa5=_0x9b1a('0x1a');break;}var _0x4ed281={'method':_0x9b1a('0x1b'),'uri':_0x525aa5+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x24d50d['clientId'],'client_secret':_0x24d50d[_0x9b1a('0x11')],'redirect_uri':_0x24d50d['serverUrl'],'code':_0x24d50d['code']},'headers':{'Content-Type':_0x9b1a('0x1c')}};return rp(_0x4ed281)[_0x9b1a('0x1d')](function(_0x179596){var _0x430cf2=JSON[_0x9b1a('0x1e')](_0x179596);if(_0x430cf2[_0x9b1a('0x1f')]){_0x24d50d[_0x9b1a('0x20')]=_0x430cf2['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x24d50d[_0x9b1a('0x21')],_0x24d50d['id']));}else{logger['error'](util[_0x9b1a('0x22')](_0x9b1a('0x23'),_0x24d50d[_0x9b1a('0x21')],_0x24d50d['id']),util[_0x9b1a('0x24')](_0x430cf2,{'showHidden':![],'depth':null}));}return _0x118512(null,_0x44b205);})['catch'](function(_0x1c21a9){logger[_0x9b1a('0x25')](util[_0x9b1a('0x22')](_0x9b1a('0x23'),_0x24d50d['name'],_0x24d50d['id']),util[_0x9b1a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x118512(_0x1c21a9);});}else{return _0x118512(null,_0x44b205);}},'beforeUpdate':function(_0x183676,_0xb37940,_0x55b91a){if(_0x183676['changed'](_0x9b1a('0xf'))||_0x183676['changed']('serverUrl')||_0x183676[_0x9b1a('0xe')](_0x9b1a('0x10'))||_0x183676[_0x9b1a('0xe')]('clientSecret')||_0x183676[_0x9b1a('0xe')](_0x9b1a('0x26'))||_0x183676[_0x9b1a('0xe')](_0x9b1a('0x12'))){var _0x1528e6,_0x1a4c1b;_0x1528e6=_0x183676[_0x9b1a('0x13')];var _0x173aa9=_0x1528e6[_0x9b1a('0x14')](-0x1);if(_0x173aa9==='/'||_0x173aa9==='\x5c'||_0x173aa9===':'){_0x1528e6=_0x1528e6[_0x9b1a('0x27')](0x0,_0x1528e6[_0x9b1a('0x15')](_0x173aa9));}switch(_0x183676[_0x9b1a('0xf')]){case'US':_0x1a4c1b=_0x9b1a('0x16');break;case'AU':_0x1a4c1b=_0x9b1a('0x17');break;case'IN':_0x1a4c1b='https://accounts.zoho.in';break;case'CN':_0x1a4c1b=_0x9b1a('0x19');break;default:_0x1a4c1b=_0x9b1a('0x1a');break;}var _0x29aa48={'method':'POST','uri':_0x1a4c1b+_0x9b1a('0x28'),'form':{'grant_type':_0x9b1a('0x29'),'client_id':_0x183676[_0x9b1a('0x10')],'client_secret':_0x183676[_0x9b1a('0x11')],'redirect_uri':_0x183676[_0x9b1a('0x13')],'code':_0x183676['code']},'headers':{'Content-Type':_0x9b1a('0x1c')}};return rp(_0x29aa48)[_0x9b1a('0x1d')](function(_0x564a91){var _0x3e370b=JSON[_0x9b1a('0x1e')](_0x564a91);if(_0x3e370b[_0x9b1a('0x1f')]){_0x183676[_0x9b1a('0x20')]=_0x3e370b[_0x9b1a('0x1f')];logger[_0x9b1a('0x2a')](util[_0x9b1a('0x22')](_0x9b1a('0x2b'),_0x183676[_0x9b1a('0x21')],_0x183676['id']));}else{logger['error'](util[_0x9b1a('0x22')](_0x9b1a('0x23'),_0x183676[_0x9b1a('0x21')],_0x183676['id']),util[_0x9b1a('0x24')](_0x3e370b,{'showHidden':![],'depth':null}));}return _0x55b91a(null,_0xb37940);})['catch'](function(_0x501b3c){logger[_0x9b1a('0x25')](util[_0x9b1a('0x22')](_0x9b1a('0x23'),_0x183676[_0x9b1a('0x21')],_0x183676['id']),util[_0x9b1a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x55b91a(_0x501b3c);});}else{return _0x55b91a(null,_0xb37940);}}}});}; \ No newline at end of file +var _0xdb26=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','refresh_token','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','code','host','slice','substring','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refreshToken','info'];(function(_0x56bad1,_0x2fd451){var _0x50ec6b=function(_0x4d0864){while(--_0x4d0864){_0x56bad1['push'](_0x56bad1['shift']());}};_0x50ec6b(++_0x2fd451);}(_0xdb26,0xdd));var _0x6db2=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xdb26[_0x1ca890];return _0x3f8e01;};'use strict';var _=require(_0x6db2('0x0'));var util=require(_0x6db2('0x1'));var logger=require(_0x6db2('0x2'))('api');var moment=require(_0x6db2('0x3'));var BPromise=require(_0x6db2('0x4'));var rp=require(_0x6db2('0x5'));var fs=require('fs');var path=require(_0x6db2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x6db2('0x7'));module[_0x6db2('0x8')]=function(_0xf69000,_0x428dff){return _0xf69000[_0x6db2('0x9')](_0x6db2('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4059f7,_0x5ea37f,_0x59e3e8){if(_0x4059f7[_0x6db2('0xb')]('zone')||_0x4059f7[_0x6db2('0xb')](_0x6db2('0xc'))||_0x4059f7['changed'](_0x6db2('0xd'))||_0x4059f7[_0x6db2('0xb')]('clientSecret')||_0x4059f7['changed'](_0x6db2('0xe'))||_0x4059f7[_0x6db2('0xb')](_0x6db2('0xf'))){var _0x10ca1b,_0x29949b;_0x10ca1b=_0x4059f7['serverUrl'];var _0x1be18d=_0x10ca1b[_0x6db2('0x10')](-0x1);if(_0x1be18d==='/'||_0x1be18d==='\x5c'||_0x1be18d===':'){_0x10ca1b=_0x10ca1b[_0x6db2('0x11')](0x0,_0x10ca1b['lastIndexOf'](_0x1be18d));}switch(_0x4059f7[_0x6db2('0x12')]){case'US':_0x29949b='https://accounts.zoho.com';break;case'AU':_0x29949b=_0x6db2('0x13');break;case'IN':_0x29949b=_0x6db2('0x14');break;case'CN':_0x29949b='https://accounts.zoho.com.cn';break;default:_0x29949b=_0x6db2('0x15');break;}var _0x2d803c={'method':_0x6db2('0x16'),'uri':_0x29949b+_0x6db2('0x17'),'form':{'grant_type':_0x6db2('0x18'),'client_id':_0x4059f7[_0x6db2('0xd')],'client_secret':_0x4059f7[_0x6db2('0x19')],'redirect_uri':_0x4059f7[_0x6db2('0xc')],'code':_0x4059f7[_0x6db2('0xe')]},'headers':{'Content-Type':_0x6db2('0x1a')}};return rp(_0x2d803c)[_0x6db2('0x1b')](function(_0x2cfb6d){var _0x1e5793=JSON[_0x6db2('0x1c')](_0x2cfb6d);if(_0x1e5793['refresh_token']){_0x4059f7[_0x6db2('0x1d')]=_0x1e5793['refresh_token'];logger[_0x6db2('0x1e')](util['format'](_0x6db2('0x1f'),_0x4059f7[_0x6db2('0x20')],_0x4059f7['id']));}else{logger['error'](util[_0x6db2('0x21')](_0x6db2('0x22'),_0x4059f7[_0x6db2('0x20')],_0x4059f7['id']),util[_0x6db2('0x23')](_0x1e5793,{'showHidden':![],'depth':null}));}return _0x59e3e8(null,_0x5ea37f);})[_0x6db2('0x24')](function(_0xd9b29c){logger[_0x6db2('0x25')](util[_0x6db2('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4059f7[_0x6db2('0x20')],_0x4059f7['id']),util[_0x6db2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x59e3e8(_0xd9b29c);});}else{return _0x59e3e8(null,_0x5ea37f);}},'beforeUpdate':function(_0x41052e,_0x4f500e,_0x501c62){if(_0x41052e[_0x6db2('0xb')](_0x6db2('0x12'))||_0x41052e[_0x6db2('0xb')](_0x6db2('0xc'))||_0x41052e[_0x6db2('0xb')](_0x6db2('0xd'))||_0x41052e[_0x6db2('0xb')](_0x6db2('0x19'))||_0x41052e[_0x6db2('0xb')](_0x6db2('0xe'))||_0x41052e[_0x6db2('0xb')](_0x6db2('0xf'))){var _0x3d8639,_0x13c213;_0x3d8639=_0x41052e[_0x6db2('0xc')];var _0x3c6283=_0x3d8639['slice'](-0x1);if(_0x3c6283==='/'||_0x3c6283==='\x5c'||_0x3c6283===':'){_0x3d8639=_0x3d8639[_0x6db2('0x11')](0x0,_0x3d8639[_0x6db2('0x26')](_0x3c6283));}switch(_0x41052e[_0x6db2('0x12')]){case'US':_0x13c213=_0x6db2('0x27');break;case'AU':_0x13c213='https://accounts.zoho.com.au';break;case'IN':_0x13c213=_0x6db2('0x14');break;case'CN':_0x13c213=_0x6db2('0x28');break;default:_0x13c213=_0x6db2('0x15');break;}var _0x471c09={'method':_0x6db2('0x16'),'uri':_0x13c213+_0x6db2('0x17'),'form':{'grant_type':_0x6db2('0x18'),'client_id':_0x41052e[_0x6db2('0xd')],'client_secret':_0x41052e[_0x6db2('0x19')],'redirect_uri':_0x41052e[_0x6db2('0xc')],'code':_0x41052e[_0x6db2('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x471c09)[_0x6db2('0x1b')](function(_0x418a21){var _0x127919=JSON[_0x6db2('0x1c')](_0x418a21);if(_0x127919[_0x6db2('0x29')]){_0x41052e['refreshToken']=_0x127919['refresh_token'];logger[_0x6db2('0x1e')](util['format'](_0x6db2('0x1f'),_0x41052e[_0x6db2('0x20')],_0x41052e['id']));}else{logger[_0x6db2('0x25')](util[_0x6db2('0x21')](_0x6db2('0x22'),_0x41052e[_0x6db2('0x20')],_0x41052e['id']),util[_0x6db2('0x23')](_0x127919,{'showHidden':![],'depth':null}));}return _0x501c62(null,_0x4f500e);})[_0x6db2('0x24')](function(_0x3a1d94){logger[_0x6db2('0x25')](util[_0x6db2('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x41052e[_0x6db2('0x20')],_0x41052e['id']),util[_0x6db2('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x501c62(_0x3a1d94);});}else{return _0x501c62(null,_0x4f500e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0246b8d..0ee93e2 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 _0xd117=['message','request\x20sent','catch','ZohoAccount','options','raw','where','attributes','limit','map','include','model','GetZohoAccount','ShowZohoAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','code','error'];(function(_0x70ca91,_0x174463){var _0x3e9784=function(_0x3246d7){while(--_0x3246d7){_0x70ca91['push'](_0x70ca91['shift']());}};_0x3e9784(++_0x174463);}(_0xd117,0x182));var _0x7d11=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xd117[_0x36b400];return _0x4d47bf;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['GetZohoAccount']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['findAll']({'raw':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1b')]||null:null,'attributes':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1c')]||null:null,'limit':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1d')]||null:null,'include':_0x456cb9['options']?_0x456cb9['options']['include']?_[_0x7d11('0x1e')](_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1f')],function(_0x1a7853){return{'model':db[_0x1a7853[_0x7d11('0x20')]],'as':_0x1a7853['as'],'attributes':_0x1a7853[_0x7d11('0x1c')],'include':_0x1a7853[_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0x1a7853['include'],function(_0x36c2b4){return{'model':db[_0x36c2b4['model']],'as':_0x36c2b4['as'],'attributes':_0x36c2b4['attributes'],'include':_0x36c2b4['include']?_[_0x7d11('0x1e')](_0x36c2b4['include'],function(_0x180e1e){return{'model':db[_0x180e1e[_0x7d11('0x20')]],'as':_0x180e1e['as'],'attributes':_0x180e1e[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f76a){logger[_0x7d11('0xf')](_0x7d11('0x21'),_0x456cb9);logger['debug'](_0x7d11('0x21'),_0x456cb9,JSON[_0x7d11('0x12')](_0x46f76a));_0x4d1306(_0x46f76a);})[_0x7d11('0x17')](function(_0x38f1be){logger['error'](_0x7d11('0x21'),_0x38f1be['message'],_0x456cb9);_0x5459df(_0x49a34b[_0x7d11('0x14')](0x1f4,_0x38f1be['message']));});});};exports[_0x7d11('0x22')]=function(_0xba4e80){var _0x1e32f6=this;return new Promise(function(_0x4831ed,_0x5e721f){return db[_0x7d11('0x18')][_0x7d11('0x23')]({'raw':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0xba4e80[_0x7d11('0x19')]?_0xba4e80['options'][_0x7d11('0x1b')]||null:null,'attributes':_0xba4e80['options']?_0xba4e80['options'][_0x7d11('0x1c')]||null:null,'include':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0xba4e80[_0x7d11('0x19')]['include'],function(_0x11d9e2){return{'model':db[_0x11d9e2[_0x7d11('0x20')]],'as':_0x11d9e2['as'],'attributes':_0x11d9e2['attributes'],'include':_0x11d9e2['include']?_[_0x7d11('0x1e')](_0x11d9e2[_0x7d11('0x1f')],function(_0x5b7d3a){return{'model':db[_0x5b7d3a[_0x7d11('0x20')]],'as':_0x5b7d3a['as'],'attributes':_0x5b7d3a['attributes'],'include':_0x5b7d3a['include']?_[_0x7d11('0x1e')](_0x5b7d3a['include'],function(_0x4e53be){return{'model':db[_0x4e53be[_0x7d11('0x20')]],'as':_0x4e53be['as'],'attributes':_0x4e53be[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x24')](function(_0x2e426b){logger[_0x7d11('0xf')](_0x7d11('0x22'),_0xba4e80);logger[_0x7d11('0x11')](_0x7d11('0x22'),_0xba4e80,JSON[_0x7d11('0x12')](_0x2e426b));_0x4831ed(_0x2e426b);})[_0x7d11('0x17')](function(_0x1a9f18){logger[_0x7d11('0x14')]('ShowZohoAccount',_0x1a9f18[_0x7d11('0x15')],_0xba4e80);_0x5e721f(_0x1e32f6['error'](0x1f4,_0x1a9f18[_0x7d11('0x15')]));});});}; \ No newline at end of file +var _0x42c3=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error'];(function(_0x2d6d30,_0x39f519){var _0x110922=function(_0x56dee3){while(--_0x56dee3){_0x2d6d30['push'](_0x2d6d30['shift']());}};_0x110922(++_0x39f519);}(_0x42c3,0x1bc));var _0x342c=function(_0xf26c91,_0x201b14){_0xf26c91=_0xf26c91-0x0;var _0x58aad1=_0x42c3[_0xf26c91];return _0x58aad1;};'use strict';var _=require(_0x342c('0x0'));var util=require(_0x342c('0x1'));var moment=require(_0x342c('0x2'));var BPromise=require('bluebird');var rs=require(_0x342c('0x3'));var fs=require('fs');var Redis=require(_0x342c('0x4'));var db=require(_0x342c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x342c('0x6'))('rpc');var config=require(_0x342c('0x7'));var jayson=require(_0x342c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6d68,_0x364f48,_0x1da228){return new BPromise(function(_0xe659b6,_0x53e9a8){return client[_0x342c('0x9')](_0x3f6d68,_0x1da228)[_0x342c('0xa')](function(_0x3bc287){logger[_0x342c('0xb')](_0x342c('0xc'),_0x364f48,'request\x20sent');logger[_0x342c('0xd')](_0x342c('0xe'),_0x364f48,_0x342c('0xf'),JSON['stringify'](_0x3bc287));if(_0x3bc287['error']){if(_0x3bc287['error'][_0x342c('0x10')]===0x1f4){logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);return _0x53e9a8(_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);}logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);return _0xe659b6(_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);}else{logger[_0x342c('0xb')](_0x342c('0xc'),_0x364f48,_0x342c('0xf'));_0xe659b6(_0x3bc287[_0x342c('0x13')]['message']);}})[_0x342c('0x14')](function(_0x50a286){logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x50a286);_0x53e9a8(_0x50a286);});});}exports[_0x342c('0x15')]=function(_0x4e1355){var _0x32de0a=this;return new Promise(function(_0x2b8ce3,_0x3df147){return db[_0x342c('0x16')][_0x342c('0x17')]({'raw':_0x4e1355['options']?_0x4e1355[_0x342c('0x18')][_0x342c('0x19')]===undefined?!![]:![]:!![],'where':_0x4e1355[_0x342c('0x18')]?_0x4e1355['options'][_0x342c('0x1a')]||null:null,'attributes':_0x4e1355['options']?_0x4e1355[_0x342c('0x18')][_0x342c('0x1b')]||null:null,'limit':_0x4e1355[_0x342c('0x18')]?_0x4e1355[_0x342c('0x18')]['limit']||null:null,'include':_0x4e1355['options']?_0x4e1355['options'][_0x342c('0x1c')]?_[_0x342c('0x1d')](_0x4e1355['options'][_0x342c('0x1c')],function(_0x4c0cac){return{'model':db[_0x4c0cac['model']],'as':_0x4c0cac['as'],'attributes':_0x4c0cac[_0x342c('0x1b')],'include':_0x4c0cac['include']?_[_0x342c('0x1d')](_0x4c0cac[_0x342c('0x1c')],function(_0x1d4747){return{'model':db[_0x1d4747[_0x342c('0x1e')]],'as':_0x1d4747['as'],'attributes':_0x1d4747['attributes'],'include':_0x1d4747[_0x342c('0x1c')]?_[_0x342c('0x1d')](_0x1d4747[_0x342c('0x1c')],function(_0x204a23){return{'model':db[_0x204a23[_0x342c('0x1e')]],'as':_0x204a23['as'],'attributes':_0x204a23['attributes']};}):[]};}):[]};}):[]:[]})[_0x342c('0xa')](function(_0x15bd62){logger[_0x342c('0xb')](_0x342c('0x15'),_0x4e1355);logger[_0x342c('0xd')]('GetZohoAccount',_0x4e1355,JSON[_0x342c('0x1f')](_0x15bd62));_0x2b8ce3(_0x15bd62);})['catch'](function(_0x2189ac){logger[_0x342c('0x11')](_0x342c('0x15'),_0x2189ac[_0x342c('0x12')],_0x4e1355);_0x3df147(_0x32de0a[_0x342c('0x11')](0x1f4,_0x2189ac[_0x342c('0x12')]));});});};exports[_0x342c('0x20')]=function(_0x3d9912){var _0x56c9b1=this;return new Promise(function(_0x32783e,_0x316684){return db[_0x342c('0x16')]['find']({'raw':_0x3d9912[_0x342c('0x18')]?_0x3d9912[_0x342c('0x18')][_0x342c('0x19')]===undefined?!![]:![]:!![],'where':_0x3d9912[_0x342c('0x18')]?_0x3d9912['options'][_0x342c('0x1a')]||null:null,'attributes':_0x3d9912['options']?_0x3d9912[_0x342c('0x18')]['attributes']||null:null,'include':_0x3d9912['options']?_0x3d9912[_0x342c('0x18')][_0x342c('0x1c')]?_[_0x342c('0x1d')](_0x3d9912[_0x342c('0x18')][_0x342c('0x1c')],function(_0x34dc44){return{'model':db[_0x34dc44[_0x342c('0x1e')]],'as':_0x34dc44['as'],'attributes':_0x34dc44[_0x342c('0x1b')],'include':_0x34dc44['include']?_[_0x342c('0x1d')](_0x34dc44[_0x342c('0x1c')],function(_0x5c1fd1){return{'model':db[_0x5c1fd1[_0x342c('0x1e')]],'as':_0x5c1fd1['as'],'attributes':_0x5c1fd1['attributes'],'include':_0x5c1fd1[_0x342c('0x1c')]?_[_0x342c('0x1d')](_0x5c1fd1['include'],function(_0x4803e1){return{'model':db[_0x4803e1[_0x342c('0x1e')]],'as':_0x4803e1['as'],'attributes':_0x4803e1[_0x342c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x342c('0xa')](function(_0x5ee1e0){logger[_0x342c('0xb')]('ShowZohoAccount',_0x3d9912);logger[_0x342c('0xd')](_0x342c('0x20'),_0x3d9912,JSON[_0x342c('0x1f')](_0x5ee1e0));_0x32783e(_0x5ee1e0);})[_0x342c('0x14')](function(_0x4b0d34){logger['error'](_0x342c('0x20'),_0x4b0d34[_0x342c('0x12')],_0x3d9912);_0x316684(_0x56c9b1[_0x342c('0x11')](0x1f4,_0x4b0d34['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 10a01d7..103e169 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 _0x2b0a=['./intZohoConfiguration.controller','index','/:id','isAuthenticated','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x468267,_0x4f5e8e){var _0x506b4b=function(_0x467cef){while(--_0x467cef){_0x468267['push'](_0x468267['shift']());}};_0x506b4b(++_0x4f5e8e);}(_0x2b0a,0x1db));var _0xa2b0=function(_0x371c04,_0x25b877){_0x371c04=_0x371c04-0x0;var _0x395e0f=_0x2b0a[_0x371c04];return _0x395e0f;};'use strict';var multer=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var path=require('path');var timeout=require(_0xa2b0('0x2'));var express=require(_0xa2b0('0x3'));var router=express[_0xa2b0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa2b0('0x5'));var interaction=require(_0xa2b0('0x6'));var config=require(_0xa2b0('0x7'));var controller=require(_0xa2b0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa2b0('0x9')]);router['get'](_0xa2b0('0xa'),auth[_0xa2b0('0xb')](),controller['show']);router[_0xa2b0('0xc')](_0xa2b0('0xd'),auth['isAuthenticated'](),controller[_0xa2b0('0xe')]);router[_0xa2b0('0xc')]('/:id/subjects',auth[_0xa2b0('0xb')](),controller[_0xa2b0('0xf')]);router[_0xa2b0('0xc')](_0xa2b0('0x10'),auth[_0xa2b0('0xb')](),controller[_0xa2b0('0x11')]);router[_0xa2b0('0x12')]('/',auth[_0xa2b0('0xb')](),controller['create']);router[_0xa2b0('0x13')](_0xa2b0('0xa'),auth[_0xa2b0('0xb')](),controller[_0xa2b0('0x14')]);router[_0xa2b0('0x15')](_0xa2b0('0xa'),auth[_0xa2b0('0xb')](),controller['destroy']);module[_0xa2b0('0x16')]=router; \ No newline at end of file +var _0x9c10=['index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1c013,_0x238b38){var _0x257b08=function(_0x18a211){while(--_0x18a211){_0x1c013['push'](_0x1c013['shift']());}};_0x257b08(++_0x238b38);}(_0x9c10,0xab));var _0x09c1=function(_0x7be21,_0x46c866){_0x7be21=_0x7be21-0x0;var _0x2ab76b=_0x9c10[_0x7be21];return _0x2ab76b;};'use strict';var multer=require(_0x09c1('0x0'));var util=require(_0x09c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c1('0x2'));var router=express[_0x09c1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c1('0x4'));var interaction=require(_0x09c1('0x5'));var config=require(_0x09c1('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x09c1('0x7')]('/',auth[_0x09c1('0x8')](),controller[_0x09c1('0x9')]);router[_0x09c1('0x7')](_0x09c1('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x09c1('0xb'),auth[_0x09c1('0x8')](),controller[_0x09c1('0xc')]);router[_0x09c1('0x7')]('/:id/subjects',auth[_0x09c1('0x8')](),controller[_0x09c1('0xd')]);router[_0x09c1('0x7')](_0x09c1('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x09c1('0xf')]('/',auth['isAuthenticated'](),controller[_0x09c1('0x10')]);router[_0x09c1('0x11')](_0x09c1('0xa'),auth[_0x09c1('0x8')](),controller[_0x09c1('0x12')]);router['delete']('/:id',auth[_0x09c1('0x8')](),controller['destroy']);module[_0x09c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 306ae25..f3fdaac 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 _0x5baa=['nothing','contact_lead','sequelize','STRING','ENUM','lead'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5baa,0x1b2));var _0xa5ba=function(_0x31beef,_0x4c5d07){_0x31beef=_0x31beef-0x0;var _0x308e7d=_0x5baa[_0x31beef];return _0x308e7d;};'use strict';var Sequelize=require(_0xa5ba('0x0'));module['exports']={'name':{'type':Sequelize[_0xa5ba('0x1')]},'moduleCreate':{'type':Sequelize[_0xa5ba('0x2')](_0xa5ba('0x3'),'contact',_0xa5ba('0x4')),'defaultValue':_0xa5ba('0x3')},'moduleSearch':{'type':Sequelize[_0xa5ba('0x2')](_0xa5ba('0x5'),'contact','lead'),'defaultValue':_0xa5ba('0x5')},'description':{'type':Sequelize[_0xa5ba('0x1')]}}; \ No newline at end of file +var _0x590b=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x47a671,_0x31d4f9){var _0x570ccf=function(_0x243993){while(--_0x243993){_0x47a671['push'](_0x47a671['shift']());}};_0x570ccf(++_0x31d4f9);}(_0x590b,0x1cc));var _0xb590=function(_0x57fea6,_0x1aa480){_0x57fea6=_0x57fea6-0x0;var _0x500568=_0x590b[_0x57fea6];return _0x500568;};'use strict';var Sequelize=require(_0xb590('0x0'));module[_0xb590('0x1')]={'name':{'type':Sequelize[_0xb590('0x2')]},'moduleCreate':{'type':Sequelize[_0xb590('0x3')](_0xb590('0x4'),_0xb590('0x5'),_0xb590('0x6')),'defaultValue':_0xb590('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xb590('0x5'),_0xb590('0x4')),'defaultValue':_0xb590('0x7')},'description':{'type':Sequelize[_0xb590('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 38e1bfa..4000d78 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 _0xf90f=['moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','getFields','ZohoField','order','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xf90f,0x9b));var _0xff90=function(_0x502da7,_0xf735f){_0x502da7=_0x502da7-0x0;var _0x169c3b=_0xf90f[_0x502da7];return _0x169c3b;};'use strict';var emlformat=require(_0xff90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff90('0x1'));var jsonpatch=require(_0xff90('0x2'));var rp=require('request-promise');var moment=require(_0xff90('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff90('0x4'));var path=require(_0xff90('0x5'));var sox=require('sox');var csv=require(_0xff90('0x6'));var ejs=require(_0xff90('0x7'));var fs=require('fs');var fs_extra=require(_0xff90('0x8'));var _=require(_0xff90('0x9'));var squel=require(_0xff90('0xa'));var crypto=require('crypto');var jsforce=require(_0xff90('0xb'));var deskjs=require(_0xff90('0xc'));var toCsv=require(_0xff90('0x6'));var querystring=require(_0xff90('0xd'));var Papa=require(_0xff90('0xe'));var Redis=require(_0xff90('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xff90('0x10'));var as=require(_0xff90('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff90('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xff90('0x13'));var licenseUtil=require(_0xff90('0x14'));var db=require(_0xff90('0x15'))['db'];function respondWithStatusCode(_0x3f1cfc,_0x6263b7){_0x6263b7=_0x6263b7||0xcc;return function(_0x3f4634){if(_0x3f4634){return _0x3f1cfc[_0xff90('0x16')](_0x6263b7);}return _0x3f1cfc[_0xff90('0x17')](_0x6263b7)['end']();};}function respondWithResult(_0x1e1e05,_0x437e7a){_0x437e7a=_0x437e7a||0xc8;return function(_0x1d7f22){if(_0x1d7f22){return _0x1e1e05[_0xff90('0x17')](_0x437e7a)[_0xff90('0x18')](_0x1d7f22);}};}function respondWithFilteredResult(_0x3c7134,_0x15da0f){return function(_0x23c3a9){if(_0x23c3a9){var _0x3da408=typeof _0x15da0f['offset']===_0xff90('0x19')&&typeof _0x15da0f['limit']===_0xff90('0x19');var _0x48ee90=_0x23c3a9['count'];var _0x32c2e8=_0x3da408?0x0:_0x15da0f[_0xff90('0x1a')];var _0x53f114=_0x3da408?_0x23c3a9[_0xff90('0x1b')]:_0x15da0f[_0xff90('0x1a')]+_0x15da0f[_0xff90('0x1c')];var _0x2b119b;if(_0x53f114>=_0x48ee90){_0x53f114=_0x48ee90;_0x2b119b=0xc8;}else{_0x2b119b=0xce;}_0x3c7134['status'](_0x2b119b);return _0x3c7134[_0xff90('0x1d')](_0xff90('0x1e'),_0x32c2e8+'-'+_0x53f114+'/'+_0x48ee90)[_0xff90('0x18')](_0x23c3a9);}return null;};}function patchUpdates(_0x2963ea){return function(_0x6fb6e8){try{jsonpatch['apply'](_0x6fb6e8,_0x2963ea,!![]);}catch(_0x4d84d5){return BPromise[_0xff90('0x1f')](_0x4d84d5);}return _0x6fb6e8[_0xff90('0x20')]();};}function saveUpdates(_0x3b62d9,_0x4865f2){return function(_0x3d82f8){if(_0x3d82f8){return _0x3d82f8[_0xff90('0x21')](_0x3b62d9)[_0xff90('0x22')](function(_0x31b5f5){return _0x31b5f5;});}return null;};}function removeEntity(_0x169d38,_0x5efb6d){return function(_0x439e89){if(_0x439e89){return _0x439e89[_0xff90('0x23')]()['then'](function(){_0x169d38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x824084,_0x433bdb){return function(_0x1c9df9){if(!_0x1c9df9){_0x824084[_0xff90('0x16')](0x194);}return _0x1c9df9;};}function handleError(_0x50e7e5,_0x3918a2){_0x3918a2=_0x3918a2||0x1f4;return function(_0x220dd2){logger[_0xff90('0x24')](_0x220dd2[_0xff90('0x25')]);if(_0x220dd2['name']){delete _0x220dd2[_0xff90('0x26')];}_0x50e7e5[_0xff90('0x17')](_0x3918a2)['send'](_0x220dd2);};}exports[_0xff90('0x27')]=function(_0x15644,_0x34e024){var _0x352730={},_0x12f31a={},_0xe27648={'count':0x0,'rows':[]};var _0x59da26=_[_0xff90('0x28')](db['ZohoConfiguration']['rawAttributes'],function(_0x406745){return{'name':_0x406745[_0xff90('0x29')],'type':_0x406745[_0xff90('0x2a')][_0xff90('0x2b')]};});_0x12f31a[_0xff90('0x2c')]=_[_0xff90('0x28')](_0x59da26,_0xff90('0x26'));_0x12f31a['query']=_[_0xff90('0x2d')](_0x15644['query']);_0x12f31a['filters']=_[_0xff90('0x2e')](_0x12f31a[_0xff90('0x2c')],_0x12f31a[_0xff90('0x2f')]);_0x352730[_0xff90('0x30')]=_[_0xff90('0x2e')](_0x12f31a[_0xff90('0x2c')],qs['fields'](_0x15644[_0xff90('0x2f')][_0xff90('0x31')]));_0x352730[_0xff90('0x30')]=_0x352730[_0xff90('0x30')][_0xff90('0x32')]?_0x352730[_0xff90('0x30')]:_0x12f31a[_0xff90('0x2c')];if(!_0x15644[_0xff90('0x2f')][_0xff90('0x33')](_0xff90('0x34'))){_0x352730[_0xff90('0x1c')]=qs['limit'](_0x15644[_0xff90('0x2f')][_0xff90('0x1c')]);_0x352730[_0xff90('0x1a')]=qs[_0xff90('0x1a')](_0x15644[_0xff90('0x2f')][_0xff90('0x1a')]);}_0x352730['order']=qs[_0xff90('0x35')](_0x15644[_0xff90('0x2f')]['sort']);_0x352730[_0xff90('0x36')]=qs['filters'](_[_0xff90('0x37')](_0x15644[_0xff90('0x2f')],_0x12f31a[_0xff90('0x38')]),_0x59da26);if(_0x15644['query'][_0xff90('0x39')]){_0x352730[_0xff90('0x36')]=_['merge'](_0x352730['where'],{'$or':_[_0xff90('0x28')](_0x59da26,function(_0x43cca0){if(_0x43cca0[_0xff90('0x2a')]!==_0xff90('0x3a')){var _0x14a4cb={};_0x14a4cb[_0x43cca0[_0xff90('0x26')]]={'$like':'%'+_0x15644[_0xff90('0x2f')][_0xff90('0x39')]+'%'};return _0x14a4cb;}})});}_0x352730=_['merge']({},_0x352730,_0x15644[_0xff90('0x3b')]);var _0x1c3faf={'where':_0x352730[_0xff90('0x36')]};return db[_0xff90('0x3c')][_0xff90('0x1b')](_0x1c3faf)[_0xff90('0x22')](function(_0x2db446){_0xe27648['count']=_0x2db446;if(_0x15644[_0xff90('0x2f')][_0xff90('0x3d')]){_0x352730[_0xff90('0x3e')]=[{'all':!![]}];}return db[_0xff90('0x3c')][_0xff90('0x3f')](_0x352730);})['then'](function(_0x4c72ff){_0xe27648[_0xff90('0x40')]=_0x4c72ff;return _0xe27648;})['then'](respondWithFilteredResult(_0x34e024,_0x352730))[_0xff90('0x41')](handleError(_0x34e024,null));};exports[_0xff90('0x42')]=function(_0x47a587,_0x202ef7){var _0x4e350f={'raw':![],'where':{'id':_0x47a587[_0xff90('0x43')]['id']}},_0x174d2b={};_0x174d2b[_0xff90('0x2c')]=_['keys'](db['ZohoConfiguration'][_0xff90('0x44')]);_0x174d2b[_0xff90('0x2f')]=_['keys'](_0x47a587[_0xff90('0x2f')]);_0x174d2b[_0xff90('0x38')]=_[_0xff90('0x2e')](_0x174d2b[_0xff90('0x2c')],_0x174d2b[_0xff90('0x2f')]);_0x4e350f[_0xff90('0x30')]=_['intersection'](_0x174d2b[_0xff90('0x2c')],qs[_0xff90('0x31')](_0x47a587[_0xff90('0x2f')]['fields']));_0x4e350f[_0xff90('0x30')]=_0x4e350f['attributes'][_0xff90('0x32')]?_0x4e350f['attributes']:_0x174d2b['model'];if(_0x47a587[_0xff90('0x2f')][_0xff90('0x3d')]){_0x4e350f[_0xff90('0x3e')]=[{'all':!![]}];}_0x4e350f=_[_0xff90('0x45')]({},_0x4e350f,_0x47a587[_0xff90('0x3b')]);return db[_0xff90('0x3c')][_0xff90('0x46')](_0x4e350f)[_0xff90('0x22')](handleEntityNotFound(_0x202ef7,null))['then'](respondWithResult(_0x202ef7,null))[_0xff90('0x41')](handleError(_0x202ef7,null));};exports[_0xff90('0x47')]=function(_0x15f046,_0x21b643){return db[_0xff90('0x3c')][_0xff90('0x47')](_0x15f046[_0xff90('0x48')],{})[_0xff90('0x22')](respondWithResult(_0x21b643,0xc9))[_0xff90('0x41')](handleError(_0x21b643,null));};exports['update']=function(_0x49fb3e,_0x410ab5){if(_0x49fb3e[_0xff90('0x48')]['id']){delete _0x49fb3e[_0xff90('0x48')]['id'];}return db[_0xff90('0x3c')][_0xff90('0x46')]({'where':{'id':_0x49fb3e[_0xff90('0x43')]['id']}})[_0xff90('0x22')](handleEntityNotFound(_0x410ab5,null))[_0xff90('0x22')](saveUpdates(_0x49fb3e[_0xff90('0x48')],null))[_0xff90('0x22')](respondWithResult(_0x410ab5,null))[_0xff90('0x41')](handleError(_0x410ab5,null));};exports[_0xff90('0x23')]=function(_0xc18d43,_0x4b5569){return db[_0xff90('0x3c')][_0xff90('0x46')]({'where':{'id':_0xc18d43[_0xff90('0x43')]['id']}})[_0xff90('0x22')](handleEntityNotFound(_0x4b5569,null))[_0xff90('0x22')](removeEntity(_0x4b5569,null))[_0xff90('0x41')](handleError(_0x4b5569,null));};exports[_0xff90('0x49')]=function(_0x3e487f,_0x5c9a41,_0x264888){var _0x4a1b9d={};var _0x2bfd6c={};var _0x272da8;var _0x375d55;return db[_0xff90('0x3c')]['findOne']({'where':{'id':_0x3e487f['params']['id']}})['then'](handleEntityNotFound(_0x5c9a41,null))[_0xff90('0x22')](function(_0x215a75){if(_0x215a75){_0x272da8=_0x215a75;_0x2bfd6c[_0xff90('0x2c')]=_[_0xff90('0x2d')](db[_0xff90('0x4a')]['rawAttributes']);_0x2bfd6c['query']=_[_0xff90('0x2d')](_0x3e487f[_0xff90('0x2f')]);_0x2bfd6c[_0xff90('0x38')]=_[_0xff90('0x2e')](_0x2bfd6c[_0xff90('0x2c')],_0x2bfd6c[_0xff90('0x2f')]);_0x4a1b9d[_0xff90('0x30')]=_[_0xff90('0x2e')](_0x2bfd6c[_0xff90('0x2c')],qs[_0xff90('0x31')](_0x3e487f['query'][_0xff90('0x31')]));_0x4a1b9d[_0xff90('0x30')]=_0x4a1b9d['attributes'][_0xff90('0x32')]?_0x4a1b9d[_0xff90('0x30')]:_0x2bfd6c['model'];_0x4a1b9d['order']=qs[_0xff90('0x35')](_0x3e487f[_0xff90('0x2f')][_0xff90('0x35')]);_0x4a1b9d[_0xff90('0x36')]=qs[_0xff90('0x38')](_[_0xff90('0x37')](_0x3e487f[_0xff90('0x2f')],_0x2bfd6c[_0xff90('0x38')]));if(_0x3e487f[_0xff90('0x2f')][_0xff90('0x39')]){_0x4a1b9d['where']=_[_0xff90('0x45')](_0x4a1b9d[_0xff90('0x36')],{'$or':_[_0xff90('0x28')](_0x4a1b9d['attributes'],function(_0x59067a){var _0x1bcf4f={};_0x1bcf4f[_0x59067a]={'$like':'%'+_0x3e487f[_0xff90('0x2f')][_0xff90('0x39')]+'%'};return _0x1bcf4f;})});}_0x4a1b9d=_[_0xff90('0x45')]({},_0x4a1b9d,_0x3e487f['options']);return _0x272da8[_0xff90('0x49')](_0x4a1b9d);}})[_0xff90('0x22')](function(_0xbbada){if(_0xbbada){_0x375d55=_0xbbada[_0xff90('0x32')];if(!_0x3e487f[_0xff90('0x2f')][_0xff90('0x33')](_0xff90('0x34'))){_0x4a1b9d[_0xff90('0x1c')]=qs[_0xff90('0x1c')](_0x3e487f['query']['limit']);_0x4a1b9d['offset']=qs[_0xff90('0x1a')](_0x3e487f[_0xff90('0x2f')]['offset']);}return _0x272da8[_0xff90('0x49')](_0x4a1b9d);}})[_0xff90('0x22')](function(_0x1a3c84){if(_0x1a3c84){return _0x1a3c84?{'count':_0x375d55,'rows':_0x1a3c84}:null;}})[_0xff90('0x22')](respondWithResult(_0x5c9a41,null))[_0xff90('0x41')](handleError(_0x5c9a41,null));};exports['getSubjects']=function(_0x7a1320,_0x4c3ba4,_0xc2890f){var _0x2fd3a0={};var _0x2ff76f={};var _0x41dd45;var _0x261fed;return db[_0xff90('0x3c')]['findOne']({'where':{'id':_0x7a1320[_0xff90('0x43')]['id']}})[_0xff90('0x22')](handleEntityNotFound(_0x4c3ba4,null))[_0xff90('0x22')](function(_0xd5330a){if(_0xd5330a){_0x41dd45=_0xd5330a;_0x2ff76f[_0xff90('0x2c')]=_[_0xff90('0x2d')](db['ZohoField']['rawAttributes']);_0x2ff76f[_0xff90('0x2f')]=_[_0xff90('0x2d')](_0x7a1320[_0xff90('0x2f')]);_0x2ff76f['filters']=_[_0xff90('0x2e')](_0x2ff76f['model'],_0x2ff76f['query']);_0x2fd3a0[_0xff90('0x30')]=_[_0xff90('0x2e')](_0x2ff76f[_0xff90('0x2c')],qs[_0xff90('0x31')](_0x7a1320[_0xff90('0x2f')][_0xff90('0x31')]));_0x2fd3a0[_0xff90('0x30')]=_0x2fd3a0[_0xff90('0x30')][_0xff90('0x32')]?_0x2fd3a0[_0xff90('0x30')]:_0x2ff76f[_0xff90('0x2c')];_0x2fd3a0[_0xff90('0x4b')]=qs[_0xff90('0x35')](_0x7a1320[_0xff90('0x2f')]['sort']);_0x2fd3a0[_0xff90('0x36')]=qs[_0xff90('0x38')](_[_0xff90('0x37')](_0x7a1320[_0xff90('0x2f')],_0x2ff76f[_0xff90('0x38')]));if(_0x7a1320[_0xff90('0x2f')][_0xff90('0x39')]){_0x2fd3a0[_0xff90('0x36')]=_[_0xff90('0x45')](_0x2fd3a0[_0xff90('0x36')],{'$or':_[_0xff90('0x28')](_0x2fd3a0['attributes'],function(_0x9d1dc4){var _0x5ebfc7={};_0x5ebfc7[_0x9d1dc4]={'$like':'%'+_0x7a1320[_0xff90('0x2f')][_0xff90('0x39')]+'%'};return _0x5ebfc7;})});}_0x2fd3a0=_[_0xff90('0x45')]({},_0x2fd3a0,_0x7a1320[_0xff90('0x3b')]);return _0x41dd45['getSubjects'](_0x2fd3a0);}})['then'](function(_0x38bb57){if(_0x38bb57){_0x261fed=_0x38bb57['length'];if(!_0x7a1320['query'][_0xff90('0x33')](_0xff90('0x34'))){_0x2fd3a0['limit']=qs['limit'](_0x7a1320[_0xff90('0x2f')][_0xff90('0x1c')]);_0x2fd3a0[_0xff90('0x1a')]=qs[_0xff90('0x1a')](_0x7a1320['query'][_0xff90('0x1a')]);}return _0x41dd45[_0xff90('0x4c')](_0x2fd3a0);}})[_0xff90('0x22')](function(_0x409337){if(_0x409337){return _0x409337?{'count':_0x261fed,'rows':_0x409337}:null;}})[_0xff90('0x22')](respondWithResult(_0x4c3ba4,null))[_0xff90('0x41')](handleError(_0x4c3ba4,null));};exports[_0xff90('0x4d')]=function(_0x5684b2,_0xd06cbb,_0x3b0f99){var _0x1d7936={};var _0x4a41a4={};var _0x3fae6b;var _0x14a7e9;return db[_0xff90('0x3c')][_0xff90('0x4e')]({'where':{'id':_0x5684b2[_0xff90('0x43')]['id']}})['then'](handleEntityNotFound(_0xd06cbb,null))[_0xff90('0x22')](function(_0x5c7acf){if(_0x5c7acf){_0x3fae6b=_0x5c7acf;_0x4a41a4[_0xff90('0x2c')]=_[_0xff90('0x2d')](db['ZohoField'][_0xff90('0x44')]);_0x4a41a4[_0xff90('0x2f')]=_[_0xff90('0x2d')](_0x5684b2['query']);_0x4a41a4['filters']=_[_0xff90('0x2e')](_0x4a41a4[_0xff90('0x2c')],_0x4a41a4['query']);_0x1d7936['attributes']=_['intersection'](_0x4a41a4[_0xff90('0x2c')],qs[_0xff90('0x31')](_0x5684b2[_0xff90('0x2f')][_0xff90('0x31')]));_0x1d7936[_0xff90('0x30')]=_0x1d7936[_0xff90('0x30')][_0xff90('0x32')]?_0x1d7936[_0xff90('0x30')]:_0x4a41a4['model'];_0x1d7936['order']=qs[_0xff90('0x35')](_0x5684b2[_0xff90('0x2f')][_0xff90('0x35')]);_0x1d7936[_0xff90('0x36')]=qs[_0xff90('0x38')](_[_0xff90('0x37')](_0x5684b2['query'],_0x4a41a4[_0xff90('0x38')]));if(_0x5684b2[_0xff90('0x2f')]['filter']){_0x1d7936[_0xff90('0x36')]=_[_0xff90('0x45')](_0x1d7936[_0xff90('0x36')],{'$or':_[_0xff90('0x28')](_0x1d7936[_0xff90('0x30')],function(_0x3017d4){var _0x33ae2a={};_0x33ae2a[_0x3017d4]={'$like':'%'+_0x5684b2['query'][_0xff90('0x39')]+'%'};return _0x33ae2a;})});}_0x1d7936=_[_0xff90('0x45')]({},_0x1d7936,_0x5684b2[_0xff90('0x3b')]);return _0x3fae6b[_0xff90('0x4d')](_0x1d7936);}})[_0xff90('0x22')](function(_0x3f35c8){if(_0x3f35c8){_0x14a7e9=_0x3f35c8[_0xff90('0x32')];if(!_0x5684b2['query'][_0xff90('0x33')](_0xff90('0x34'))){_0x1d7936[_0xff90('0x1c')]=qs['limit'](_0x5684b2[_0xff90('0x2f')][_0xff90('0x1c')]);_0x1d7936[_0xff90('0x1a')]=qs['offset'](_0x5684b2[_0xff90('0x2f')][_0xff90('0x1a')]);}return _0x3fae6b['getDescriptions'](_0x1d7936);}})['then'](function(_0x21df2a){if(_0x21df2a){return _0x21df2a?{'count':_0x14a7e9,'rows':_0x21df2a}:null;}})['then'](respondWithResult(_0xd06cbb,null))[_0xff90('0x41')](handleError(_0xd06cbb,null));}; \ No newline at end of file +var _0x6a2c=['index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','merge','find','create','body','getFields','ZohoField','sort','where','hasOwnProperty','nolimit','getSubjects','findOne','order','getDescriptions','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send'];(function(_0x1fa422,_0x9a0ac9){var _0x46d341=function(_0x314c35){while(--_0x314c35){_0x1fa422['push'](_0x1fa422['shift']());}};_0x46d341(++_0x9a0ac9);}(_0x6a2c,0xc5));var _0xc6a2=function(_0x548ea2,_0x323b5f){_0x548ea2=_0x548ea2-0x0;var _0x5f4041=_0x6a2c[_0x548ea2];return _0x5f4041;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6a2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc6a2('0x1'));var moment=require(_0xc6a2('0x2'));var BPromise=require(_0xc6a2('0x3'));var Mustache=require(_0xc6a2('0x4'));var util=require(_0xc6a2('0x5'));var path=require(_0xc6a2('0x6'));var sox=require('sox');var csv=require(_0xc6a2('0x7'));var ejs=require(_0xc6a2('0x8'));var fs=require('fs');var fs_extra=require(_0xc6a2('0x9'));var _=require(_0xc6a2('0xa'));var squel=require(_0xc6a2('0xb'));var crypto=require(_0xc6a2('0xc'));var jsforce=require(_0xc6a2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6a2('0xe'));var Papa=require(_0xc6a2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6a2('0x10'));var logger=require(_0xc6a2('0x11'))(_0xc6a2('0x12'));var utils=require(_0xc6a2('0x13'));var config=require(_0xc6a2('0x14'));var licenseUtil=require(_0xc6a2('0x15'));var db=require(_0xc6a2('0x16'))['db'];function respondWithStatusCode(_0x498a38,_0x242c6f){_0x242c6f=_0x242c6f||0xcc;return function(_0x4446b4){if(_0x4446b4){return _0x498a38[_0xc6a2('0x17')](_0x242c6f);}return _0x498a38[_0xc6a2('0x18')](_0x242c6f)[_0xc6a2('0x19')]();};}function respondWithResult(_0x170c61,_0x35fd2c){_0x35fd2c=_0x35fd2c||0xc8;return function(_0x1d4022){if(_0x1d4022){return _0x170c61[_0xc6a2('0x18')](_0x35fd2c)['json'](_0x1d4022);}};}function respondWithFilteredResult(_0x5b233b,_0x393825){return function(_0x274a82){if(_0x274a82){var _0x8ade2c=typeof _0x393825[_0xc6a2('0x1a')]===_0xc6a2('0x1b')&&typeof _0x393825[_0xc6a2('0x1c')]===_0xc6a2('0x1b');var _0x3744dd=_0x274a82[_0xc6a2('0x1d')];var _0x4d695d=_0x8ade2c?0x0:_0x393825[_0xc6a2('0x1a')];var _0xb81aa1=_0x8ade2c?_0x274a82[_0xc6a2('0x1d')]:_0x393825[_0xc6a2('0x1a')]+_0x393825[_0xc6a2('0x1c')];var _0x2ddcb1;if(_0xb81aa1>=_0x3744dd){_0xb81aa1=_0x3744dd;_0x2ddcb1=0xc8;}else{_0x2ddcb1=0xce;}_0x5b233b[_0xc6a2('0x18')](_0x2ddcb1);return _0x5b233b[_0xc6a2('0x1e')]('Content-Range',_0x4d695d+'-'+_0xb81aa1+'/'+_0x3744dd)['json'](_0x274a82);}return null;};}function patchUpdates(_0x3d28f0){return function(_0x46c9d7){try{jsonpatch[_0xc6a2('0x1f')](_0x46c9d7,_0x3d28f0,!![]);}catch(_0x1c77d0){return BPromise[_0xc6a2('0x20')](_0x1c77d0);}return _0x46c9d7[_0xc6a2('0x21')]();};}function saveUpdates(_0x6c931,_0x59284){return function(_0x351493){if(_0x351493){return _0x351493[_0xc6a2('0x22')](_0x6c931)['then'](function(_0xa3da0a){return _0xa3da0a;});}return null;};}function removeEntity(_0x132986,_0x336058){return function(_0x2724fb){if(_0x2724fb){return _0x2724fb[_0xc6a2('0x23')]()[_0xc6a2('0x24')](function(){_0x132986[_0xc6a2('0x18')](0xcc)[_0xc6a2('0x19')]();});}};}function handleEntityNotFound(_0x4b7ea7,_0x48da8c){return function(_0x5cea34){if(!_0x5cea34){_0x4b7ea7[_0xc6a2('0x17')](0x194);}return _0x5cea34;};}function handleError(_0x438711,_0x127603){_0x127603=_0x127603||0x1f4;return function(_0x1fcd30){logger[_0xc6a2('0x25')](_0x1fcd30['stack']);if(_0x1fcd30[_0xc6a2('0x26')]){delete _0x1fcd30[_0xc6a2('0x26')];}_0x438711['status'](_0x127603)[_0xc6a2('0x27')](_0x1fcd30);};}exports[_0xc6a2('0x28')]=function(_0x5eb3c5,_0x401ecf){var _0x193b97={},_0x1a44b4={},_0x2a58d3={'count':0x0,'rows':[]};var _0x17b3ba=_[_0xc6a2('0x29')](db[_0xc6a2('0x2a')][_0xc6a2('0x2b')],function(_0x1239ff){return{'name':_0x1239ff['fieldName'],'type':_0x1239ff[_0xc6a2('0x2c')][_0xc6a2('0x2d')]};});_0x1a44b4[_0xc6a2('0x2e')]=_['map'](_0x17b3ba,_0xc6a2('0x26'));_0x1a44b4[_0xc6a2('0x2f')]=_[_0xc6a2('0x30')](_0x5eb3c5[_0xc6a2('0x2f')]);_0x1a44b4[_0xc6a2('0x31')]=_[_0xc6a2('0x32')](_0x1a44b4[_0xc6a2('0x2e')],_0x1a44b4[_0xc6a2('0x2f')]);_0x193b97[_0xc6a2('0x33')]=_[_0xc6a2('0x32')](_0x1a44b4['model'],qs['fields'](_0x5eb3c5[_0xc6a2('0x2f')]['fields']));_0x193b97[_0xc6a2('0x33')]=_0x193b97[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x193b97[_0xc6a2('0x33')]:_0x1a44b4[_0xc6a2('0x2e')];if(!_0x5eb3c5[_0xc6a2('0x2f')]['hasOwnProperty']('nolimit')){_0x193b97[_0xc6a2('0x1c')]=qs['limit'](_0x5eb3c5[_0xc6a2('0x2f')]['limit']);_0x193b97[_0xc6a2('0x1a')]=qs['offset'](_0x5eb3c5['query'][_0xc6a2('0x1a')]);}_0x193b97['order']=qs['sort'](_0x5eb3c5[_0xc6a2('0x2f')]['sort']);_0x193b97['where']=qs[_0xc6a2('0x31')](_[_0xc6a2('0x35')](_0x5eb3c5['query'],_0x1a44b4[_0xc6a2('0x31')]),_0x17b3ba);if(_0x5eb3c5['query'][_0xc6a2('0x36')]){_0x193b97['where']=_['merge'](_0x193b97['where'],{'$or':_['map'](_0x17b3ba,function(_0x47f895){if(_0x47f895[_0xc6a2('0x2c')]!==_0xc6a2('0x37')){var _0x4fad95={};_0x4fad95[_0x47f895[_0xc6a2('0x26')]]={'$like':'%'+_0x5eb3c5['query']['filter']+'%'};return _0x4fad95;}})});}_0x193b97=_['merge']({},_0x193b97,_0x5eb3c5[_0xc6a2('0x38')]);var _0x517f99={'where':_0x193b97['where']};return db['ZohoConfiguration'][_0xc6a2('0x1d')](_0x517f99)[_0xc6a2('0x24')](function(_0x1631ec){_0x2a58d3[_0xc6a2('0x1d')]=_0x1631ec;if(_0x5eb3c5[_0xc6a2('0x2f')][_0xc6a2('0x39')]){_0x193b97[_0xc6a2('0x3a')]=[{'all':!![]}];}return db[_0xc6a2('0x2a')][_0xc6a2('0x3b')](_0x193b97);})['then'](function(_0x3b2042){_0x2a58d3[_0xc6a2('0x3c')]=_0x3b2042;return _0x2a58d3;})['then'](respondWithFilteredResult(_0x401ecf,_0x193b97))[_0xc6a2('0x3d')](handleError(_0x401ecf,null));};exports[_0xc6a2('0x3e')]=function(_0x50f919,_0x51d824){var _0x326620={'raw':![],'where':{'id':_0x50f919[_0xc6a2('0x3f')]['id']}},_0x2602db={};_0x2602db['model']=_[_0xc6a2('0x30')](db[_0xc6a2('0x2a')]['rawAttributes']);_0x2602db[_0xc6a2('0x2f')]=_[_0xc6a2('0x30')](_0x50f919[_0xc6a2('0x2f')]);_0x2602db[_0xc6a2('0x31')]=_['intersection'](_0x2602db[_0xc6a2('0x2e')],_0x2602db['query']);_0x326620[_0xc6a2('0x33')]=_[_0xc6a2('0x32')](_0x2602db['model'],qs['fields'](_0x50f919[_0xc6a2('0x2f')][_0xc6a2('0x40')]));_0x326620[_0xc6a2('0x33')]=_0x326620[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x326620[_0xc6a2('0x33')]:_0x2602db[_0xc6a2('0x2e')];if(_0x50f919[_0xc6a2('0x2f')][_0xc6a2('0x39')]){_0x326620['include']=[{'all':!![]}];}_0x326620=_[_0xc6a2('0x41')]({},_0x326620,_0x50f919['options']);return db[_0xc6a2('0x2a')][_0xc6a2('0x42')](_0x326620)['then'](handleEntityNotFound(_0x51d824,null))[_0xc6a2('0x24')](respondWithResult(_0x51d824,null))['catch'](handleError(_0x51d824,null));};exports[_0xc6a2('0x43')]=function(_0x284285,_0x1b72c7){return db[_0xc6a2('0x2a')][_0xc6a2('0x43')](_0x284285['body'],{})['then'](respondWithResult(_0x1b72c7,0xc9))[_0xc6a2('0x3d')](handleError(_0x1b72c7,null));};exports['update']=function(_0x3ac72b,_0x58096e){if(_0x3ac72b['body']['id']){delete _0x3ac72b[_0xc6a2('0x44')]['id'];}return db[_0xc6a2('0x2a')]['find']({'where':{'id':_0x3ac72b[_0xc6a2('0x3f')]['id']}})[_0xc6a2('0x24')](handleEntityNotFound(_0x58096e,null))[_0xc6a2('0x24')](saveUpdates(_0x3ac72b[_0xc6a2('0x44')],null))[_0xc6a2('0x24')](respondWithResult(_0x58096e,null))[_0xc6a2('0x3d')](handleError(_0x58096e,null));};exports[_0xc6a2('0x23')]=function(_0x944ecb,_0x407e49){return db[_0xc6a2('0x2a')][_0xc6a2('0x42')]({'where':{'id':_0x944ecb[_0xc6a2('0x3f')]['id']}})[_0xc6a2('0x24')](handleEntityNotFound(_0x407e49,null))[_0xc6a2('0x24')](removeEntity(_0x407e49,null))[_0xc6a2('0x3d')](handleError(_0x407e49,null));};exports[_0xc6a2('0x45')]=function(_0x137fb9,_0x396833,_0x2d53e6){var _0x53231e={};var _0x1c7d5a={};var _0x3df81b;var _0xe8a7a7;return db[_0xc6a2('0x2a')]['findOne']({'where':{'id':_0x137fb9['params']['id']}})[_0xc6a2('0x24')](handleEntityNotFound(_0x396833,null))[_0xc6a2('0x24')](function(_0xa8be60){if(_0xa8be60){_0x3df81b=_0xa8be60;_0x1c7d5a['model']=_['keys'](db[_0xc6a2('0x46')][_0xc6a2('0x2b')]);_0x1c7d5a[_0xc6a2('0x2f')]=_[_0xc6a2('0x30')](_0x137fb9[_0xc6a2('0x2f')]);_0x1c7d5a['filters']=_[_0xc6a2('0x32')](_0x1c7d5a[_0xc6a2('0x2e')],_0x1c7d5a[_0xc6a2('0x2f')]);_0x53231e[_0xc6a2('0x33')]=_[_0xc6a2('0x32')](_0x1c7d5a[_0xc6a2('0x2e')],qs[_0xc6a2('0x40')](_0x137fb9[_0xc6a2('0x2f')][_0xc6a2('0x40')]));_0x53231e['attributes']=_0x53231e[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x53231e[_0xc6a2('0x33')]:_0x1c7d5a['model'];_0x53231e['order']=qs['sort'](_0x137fb9['query'][_0xc6a2('0x47')]);_0x53231e[_0xc6a2('0x48')]=qs['filters'](_[_0xc6a2('0x35')](_0x137fb9['query'],_0x1c7d5a['filters']));if(_0x137fb9['query'][_0xc6a2('0x36')]){_0x53231e[_0xc6a2('0x48')]=_[_0xc6a2('0x41')](_0x53231e[_0xc6a2('0x48')],{'$or':_['map'](_0x53231e['attributes'],function(_0x4cf8b3){var _0x1c0cf4={};_0x1c0cf4[_0x4cf8b3]={'$like':'%'+_0x137fb9[_0xc6a2('0x2f')][_0xc6a2('0x36')]+'%'};return _0x1c0cf4;})});}_0x53231e=_[_0xc6a2('0x41')]({},_0x53231e,_0x137fb9[_0xc6a2('0x38')]);return _0x3df81b['getFields'](_0x53231e);}})['then'](function(_0x4e6e19){if(_0x4e6e19){_0xe8a7a7=_0x4e6e19[_0xc6a2('0x34')];if(!_0x137fb9[_0xc6a2('0x2f')][_0xc6a2('0x49')](_0xc6a2('0x4a'))){_0x53231e['limit']=qs[_0xc6a2('0x1c')](_0x137fb9['query'][_0xc6a2('0x1c')]);_0x53231e[_0xc6a2('0x1a')]=qs[_0xc6a2('0x1a')](_0x137fb9[_0xc6a2('0x2f')][_0xc6a2('0x1a')]);}return _0x3df81b['getFields'](_0x53231e);}})[_0xc6a2('0x24')](function(_0x51092a){if(_0x51092a){return _0x51092a?{'count':_0xe8a7a7,'rows':_0x51092a}:null;}})[_0xc6a2('0x24')](respondWithResult(_0x396833,null))[_0xc6a2('0x3d')](handleError(_0x396833,null));};exports[_0xc6a2('0x4b')]=function(_0x4cfd4b,_0x10e05a,_0x3980a8){var _0x8bc36e={};var _0x167820={};var _0x1f73b9;var _0x36caa7;return db['ZohoConfiguration'][_0xc6a2('0x4c')]({'where':{'id':_0x4cfd4b[_0xc6a2('0x3f')]['id']}})[_0xc6a2('0x24')](handleEntityNotFound(_0x10e05a,null))['then'](function(_0x31156e){if(_0x31156e){_0x1f73b9=_0x31156e;_0x167820[_0xc6a2('0x2e')]=_[_0xc6a2('0x30')](db[_0xc6a2('0x46')][_0xc6a2('0x2b')]);_0x167820[_0xc6a2('0x2f')]=_[_0xc6a2('0x30')](_0x4cfd4b[_0xc6a2('0x2f')]);_0x167820['filters']=_[_0xc6a2('0x32')](_0x167820[_0xc6a2('0x2e')],_0x167820[_0xc6a2('0x2f')]);_0x8bc36e['attributes']=_['intersection'](_0x167820[_0xc6a2('0x2e')],qs['fields'](_0x4cfd4b['query'][_0xc6a2('0x40')]));_0x8bc36e['attributes']=_0x8bc36e[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x8bc36e[_0xc6a2('0x33')]:_0x167820['model'];_0x8bc36e[_0xc6a2('0x4d')]=qs[_0xc6a2('0x47')](_0x4cfd4b[_0xc6a2('0x2f')]['sort']);_0x8bc36e[_0xc6a2('0x48')]=qs[_0xc6a2('0x31')](_[_0xc6a2('0x35')](_0x4cfd4b[_0xc6a2('0x2f')],_0x167820[_0xc6a2('0x31')]));if(_0x4cfd4b[_0xc6a2('0x2f')][_0xc6a2('0x36')]){_0x8bc36e[_0xc6a2('0x48')]=_[_0xc6a2('0x41')](_0x8bc36e[_0xc6a2('0x48')],{'$or':_[_0xc6a2('0x29')](_0x8bc36e[_0xc6a2('0x33')],function(_0x3bc45d){var _0x42d89d={};_0x42d89d[_0x3bc45d]={'$like':'%'+_0x4cfd4b[_0xc6a2('0x2f')]['filter']+'%'};return _0x42d89d;})});}_0x8bc36e=_['merge']({},_0x8bc36e,_0x4cfd4b[_0xc6a2('0x38')]);return _0x1f73b9[_0xc6a2('0x4b')](_0x8bc36e);}})[_0xc6a2('0x24')](function(_0xc50104){if(_0xc50104){_0x36caa7=_0xc50104['length'];if(!_0x4cfd4b[_0xc6a2('0x2f')][_0xc6a2('0x49')](_0xc6a2('0x4a'))){_0x8bc36e[_0xc6a2('0x1c')]=qs['limit'](_0x4cfd4b[_0xc6a2('0x2f')]['limit']);_0x8bc36e[_0xc6a2('0x1a')]=qs[_0xc6a2('0x1a')](_0x4cfd4b[_0xc6a2('0x2f')][_0xc6a2('0x1a')]);}return _0x1f73b9['getSubjects'](_0x8bc36e);}})['then'](function(_0xaa414c){if(_0xaa414c){return _0xaa414c?{'count':_0x36caa7,'rows':_0xaa414c}:null;}})[_0xc6a2('0x24')](respondWithResult(_0x10e05a,null))[_0xc6a2('0x3d')](handleError(_0x10e05a,null));};exports[_0xc6a2('0x4e')]=function(_0x538aca,_0x23755f,_0x5e256f){var _0x13e27b={};var _0xaaafc8={};var _0x4682c5;var _0x5f548d;return db[_0xc6a2('0x2a')]['findOne']({'where':{'id':_0x538aca[_0xc6a2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x23755f,null))['then'](function(_0x293842){if(_0x293842){_0x4682c5=_0x293842;_0xaaafc8[_0xc6a2('0x2e')]=_[_0xc6a2('0x30')](db[_0xc6a2('0x46')][_0xc6a2('0x2b')]);_0xaaafc8['query']=_['keys'](_0x538aca[_0xc6a2('0x2f')]);_0xaaafc8[_0xc6a2('0x31')]=_[_0xc6a2('0x32')](_0xaaafc8[_0xc6a2('0x2e')],_0xaaafc8[_0xc6a2('0x2f')]);_0x13e27b[_0xc6a2('0x33')]=_[_0xc6a2('0x32')](_0xaaafc8['model'],qs[_0xc6a2('0x40')](_0x538aca[_0xc6a2('0x2f')]['fields']));_0x13e27b['attributes']=_0x13e27b[_0xc6a2('0x33')]['length']?_0x13e27b[_0xc6a2('0x33')]:_0xaaafc8[_0xc6a2('0x2e')];_0x13e27b[_0xc6a2('0x4d')]=qs[_0xc6a2('0x47')](_0x538aca[_0xc6a2('0x2f')][_0xc6a2('0x47')]);_0x13e27b[_0xc6a2('0x48')]=qs[_0xc6a2('0x31')](_[_0xc6a2('0x35')](_0x538aca['query'],_0xaaafc8[_0xc6a2('0x31')]));if(_0x538aca[_0xc6a2('0x2f')][_0xc6a2('0x36')]){_0x13e27b[_0xc6a2('0x48')]=_[_0xc6a2('0x41')](_0x13e27b[_0xc6a2('0x48')],{'$or':_[_0xc6a2('0x29')](_0x13e27b[_0xc6a2('0x33')],function(_0x15443e){var _0x235641={};_0x235641[_0x15443e]={'$like':'%'+_0x538aca[_0xc6a2('0x2f')][_0xc6a2('0x36')]+'%'};return _0x235641;})});}_0x13e27b=_[_0xc6a2('0x41')]({},_0x13e27b,_0x538aca[_0xc6a2('0x38')]);return _0x4682c5[_0xc6a2('0x4e')](_0x13e27b);}})[_0xc6a2('0x24')](function(_0x1c1d35){if(_0x1c1d35){_0x5f548d=_0x1c1d35[_0xc6a2('0x34')];if(!_0x538aca[_0xc6a2('0x2f')][_0xc6a2('0x49')]('nolimit')){_0x13e27b[_0xc6a2('0x1c')]=qs['limit'](_0x538aca[_0xc6a2('0x2f')]['limit']);_0x13e27b[_0xc6a2('0x1a')]=qs[_0xc6a2('0x1a')](_0x538aca[_0xc6a2('0x2f')][_0xc6a2('0x1a')]);}return _0x4682c5[_0xc6a2('0x4e')](_0x13e27b);}})['then'](function(_0xe25bf4){if(_0xe25bf4){return _0xe25bf4?{'count':_0x5f548d,'rows':_0xe25bf4}:null;}})['then'](respondWithResult(_0x23755f,null))[_0xc6a2('0x3d')](handleError(_0x23755f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e630b29..8b38634 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 _0x6938=['path','rimraf','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','request-promise'];(function(_0x13033f,_0x2045af){var _0x2ed576=function(_0x491a78){while(--_0x491a78){_0x13033f['push'](_0x13033f['shift']());}};_0x2ed576(++_0x2045af);}(_0x6938,0x1c7));var _0x8693=function(_0x24f925,_0x58e0cf){_0x24f925=_0x24f925-0x0;var _0x29547d=_0x6938[_0x24f925];return _0x29547d;};'use strict';var _=require(_0x8693('0x0'));var util=require(_0x8693('0x1'));var logger=require(_0x8693('0x2'))(_0x8693('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8693('0x4'));var fs=require('fs');var path=require(_0x8693('0x5'));var rimraf=require(_0x8693('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x52d026,_0x2a3926){return _0x52d026[_0x8693('0x7')](_0x8693('0x8'),attributes,{'tableName':_0x8693('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3888=['moment','bluebird','path','../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x7ac2cd,_0x185786){var _0x23f84e=function(_0x151e07){while(--_0x151e07){_0x7ac2cd['push'](_0x7ac2cd['shift']());}};_0x23f84e(++_0x185786);}(_0x3888,0x75));var _0x8388=function(_0x5187f4,_0x329f1c){_0x5187f4=_0x5187f4-0x0;var _0x1a5891=_0x3888[_0x5187f4];return _0x1a5891;};'use strict';var _=require(_0x8388('0x0'));var util=require(_0x8388('0x1'));var logger=require(_0x8388('0x2'))(_0x8388('0x3'));var moment=require(_0x8388('0x4'));var BPromise=require(_0x8388('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8388('0x6'));var rimraf=require('rimraf');var config=require(_0x8388('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x8388('0x8')]=function(_0xb0d8d6,_0x1b2fb5){return _0xb0d8d6['define'](_0x8388('0x9'),attributes,{'tableName':_0x8388('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 2250456..8fd46c3 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 _0x81b6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x5c6bc9,_0x4276f7){var _0x5b1fa5=function(_0x351e82){while(--_0x351e82){_0x5c6bc9['push'](_0x5c6bc9['shift']());}};_0x5b1fa5(++_0x4276f7);}(_0x81b6,0x106));var _0x681b=function(_0x3d4fd2,_0x5e65fc){_0x3d4fd2=_0x3d4fd2-0x0;var _0x410865=_0x81b6[_0x3d4fd2];return _0x410865;};'use strict';var _=require(_0x681b('0x0'));var util=require(_0x681b('0x1'));var moment=require(_0x681b('0x2'));var BPromise=require(_0x681b('0x3'));var rs=require(_0x681b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x681b('0x5'))['db'];var utils=require(_0x681b('0x6'));var logger=require(_0x681b('0x7'))(_0x681b('0x8'));var config=require(_0x681b('0x9'));var jayson=require(_0x681b('0xa'));var client=jayson[_0x681b('0xb')][_0x681b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x217d38,_0x3d3746,_0x7122f1){return new BPromise(function(_0x4c9dd7,_0x365d54){return client[_0x681b('0xd')](_0x217d38,_0x7122f1)[_0x681b('0xe')](function(_0x498959){logger[_0x681b('0xf')](_0x681b('0x10'),_0x3d3746,_0x681b('0x11'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3d3746,_0x681b('0x11'),JSON[_0x681b('0x12')](_0x498959));if(_0x498959['error']){if(_0x498959[_0x681b('0x13')][_0x681b('0x14')]===0x1f4){logger[_0x681b('0x13')](_0x681b('0x10'),_0x3d3746,_0x498959['error'][_0x681b('0x15')]);return _0x365d54(_0x498959[_0x681b('0x13')][_0x681b('0x15')]);}logger[_0x681b('0x13')](_0x681b('0x10'),_0x3d3746,_0x498959[_0x681b('0x13')][_0x681b('0x15')]);return _0x4c9dd7(_0x498959[_0x681b('0x13')][_0x681b('0x15')]);}else{logger[_0x681b('0xf')](_0x681b('0x10'),_0x3d3746,_0x681b('0x11'));_0x4c9dd7(_0x498959[_0x681b('0x16')][_0x681b('0x15')]);}})[_0x681b('0x17')](function(_0x364a2a){logger[_0x681b('0x13')](_0x681b('0x10'),_0x3d3746,_0x364a2a);_0x365d54(_0x364a2a);});});} \ No newline at end of file +var _0xf15b=['result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0xf15b,0xd4));var _0xbf15=function(_0x33793a,_0x515635){_0x33793a=_0x33793a-0x0;var _0x242389=_0xf15b[_0x33793a];return _0x242389;};'use strict';var _=require(_0xbf15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf15('0x1'));var rs=require(_0xbf15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf15('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf15('0x4'))(_0xbf15('0x5'));var config=require(_0xbf15('0x6'));var jayson=require(_0xbf15('0x7'));var client=jayson[_0xbf15('0x8')][_0xbf15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4daf72,_0x3cddb3,_0x416b2d){return new BPromise(function(_0x4bab6e,_0x31b3fe){return client[_0xbf15('0xa')](_0x4daf72,_0x416b2d)[_0xbf15('0xb')](function(_0x21263a){logger[_0xbf15('0xc')](_0xbf15('0xd'),_0x3cddb3,_0xbf15('0xe'));logger[_0xbf15('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3cddb3,_0xbf15('0xe'),JSON[_0xbf15('0x10')](_0x21263a));if(_0x21263a[_0xbf15('0x11')]){if(_0x21263a[_0xbf15('0x11')]['code']===0x1f4){logger[_0xbf15('0x11')](_0xbf15('0xd'),_0x3cddb3,_0x21263a[_0xbf15('0x11')][_0xbf15('0x12')]);return _0x31b3fe(_0x21263a[_0xbf15('0x11')][_0xbf15('0x12')]);}logger['error'](_0xbf15('0xd'),_0x3cddb3,_0x21263a[_0xbf15('0x11')][_0xbf15('0x12')]);return _0x4bab6e(_0x21263a[_0xbf15('0x11')][_0xbf15('0x12')]);}else{logger[_0xbf15('0xc')](_0xbf15('0xd'),_0x3cddb3,_0xbf15('0xe'));_0x4bab6e(_0x21263a[_0xbf15('0x13')]['message']);}})[_0xbf15('0x14')](function(_0x12cb92){logger[_0xbf15('0x11')](_0xbf15('0xd'),_0x3cddb3,_0x12cb92);_0x31b3fe(_0x12cb92);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 03b840f..a33fc3a 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 _0xec44=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x25791e,_0x52fd2c){var _0x3c5d4a=function(_0x43765c){while(--_0x43765c){_0x25791e['push'](_0x25791e['shift']());}};_0x3c5d4a(++_0x52fd2c);}(_0xec44,0x14e));var _0x4ec4=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xec44[_0xcfeff4];return _0xb2fadc;};'use strict';var multer=require(_0x4ec4('0x0'));var util=require(_0x4ec4('0x1'));var path=require(_0x4ec4('0x2'));var timeout=require(_0x4ec4('0x3'));var express=require(_0x4ec4('0x4'));var router=express[_0x4ec4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ec4('0x6'));var interaction=require(_0x4ec4('0x7'));var config=require(_0x4ec4('0x8'));var controller=require(_0x4ec4('0x9'));router[_0x4ec4('0xa')]('/',auth[_0x4ec4('0xb')](),controller[_0x4ec4('0xc')]);router['get'](_0x4ec4('0xd'),auth[_0x4ec4('0xb')](),controller[_0x4ec4('0xe')]);router[_0x4ec4('0xf')]('/',auth[_0x4ec4('0xb')](),controller[_0x4ec4('0x10')]);router[_0x4ec4('0x11')]('/:id',auth[_0x4ec4('0xb')](),controller[_0x4ec4('0x12')]);router[_0x4ec4('0x13')](_0x4ec4('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4ec4('0x14')]=router; \ No newline at end of file +var _0xc3ba=['isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intZohoField.controller','get','index','/:id'];(function(_0x261f67,_0x283ce2){var _0x4947c7=function(_0x44a067){while(--_0x44a067){_0x261f67['push'](_0x261f67['shift']());}};_0x4947c7(++_0x283ce2);}(_0xc3ba,0xf5));var _0xac3b=function(_0x2edc6c,_0x544e16){_0x2edc6c=_0x2edc6c-0x0;var _0x58d50b=_0xc3ba[_0x2edc6c];return _0x58d50b;};'use strict';var multer=require(_0xac3b('0x0'));var util=require(_0xac3b('0x1'));var path=require(_0xac3b('0x2'));var timeout=require(_0xac3b('0x3'));var express=require('express');var router=express[_0xac3b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac3b('0x5'));var config=require('../../config/environment');var controller=require(_0xac3b('0x6'));router[_0xac3b('0x7')]('/',auth['isAuthenticated'](),controller[_0xac3b('0x8')]);router['get'](_0xac3b('0x9'),auth[_0xac3b('0xa')](),controller['show']);router[_0xac3b('0xb')]('/',auth[_0xac3b('0xa')](),controller[_0xac3b('0xc')]);router[_0xac3b('0xd')](_0xac3b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xac3b('0xe')](_0xac3b('0x9'),auth[_0xac3b('0xa')](),controller[_0xac3b('0xf')]);module[_0xac3b('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 af0cb10..906fb16 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 _0x13ec=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x2560d9,_0x1f80a6){var _0x42654b=function(_0x36be15){while(--_0x36be15){_0x2560d9['push'](_0x2560d9['shift']());}};_0x42654b(++_0x1f80a6);}(_0x13ec,0x1ec));var _0xc13e=function(_0x561b28,_0x20a15a){_0x561b28=_0x561b28-0x0;var _0x169c61=_0x13ec[_0x561b28];return _0x169c61;};'use strict';var Sequelize=require(_0xc13e('0x0'));module[_0xc13e('0x1')]={'type':{'type':Sequelize[_0xc13e('0x2')]('string',_0xc13e('0x3'),_0xc13e('0x4'),_0xc13e('0x5'),_0xc13e('0x6')),'defaultValue':_0xc13e('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc13e('0x8')]},'keyType':{'type':Sequelize[_0xc13e('0x2')]('string',_0xc13e('0x3'),_0xc13e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc13e('0x8')]},'nameField':{'type':Sequelize[_0xc13e('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb5c5=['picklist','STRING','ENUM','customVariable','BOOLEAN','exports','string','variable','keyValue'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xb5c5,0x10a));var _0x5b5c=function(_0x27a07f,_0x332286){_0x27a07f=_0x27a07f-0x0;var _0x3eddf9=_0xb5c5[_0x27a07f];return _0x3eddf9;};'use strict';var Sequelize=require('sequelize');module[_0x5b5c('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5b5c('0x1'),_0x5b5c('0x2'),'customVariable',_0x5b5c('0x3'),_0x5b5c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5b5c('0x5')]},'key':{'type':Sequelize[_0x5b5c('0x5')]},'keyType':{'type':Sequelize[_0x5b5c('0x6')](_0x5b5c('0x1'),_0x5b5c('0x2'),_0x5b5c('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5b5c('0x5')]},'customField':{'type':Sequelize[_0x5b5c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b5c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8c314f2..4a27442 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 _0x9369=['ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','save','update','then','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x49aa60,_0x2b1ce1){var _0x354423=function(_0xe4bc17){while(--_0xe4bc17){_0x49aa60['push'](_0x49aa60['shift']());}};_0x354423(++_0x2b1ce1);}(_0x9369,0x1b9));var _0x9936=function(_0x4d82bb,_0x37b7be){_0x4d82bb=_0x4d82bb-0x0;var _0x17cf48=_0x9369[_0x4d82bb];return _0x17cf48;};'use strict';var emlformat=require(_0x9936('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9936('0x1'));var jsonpatch=require(_0x9936('0x2'));var rp=require(_0x9936('0x3'));var moment=require(_0x9936('0x4'));var BPromise=require(_0x9936('0x5'));var Mustache=require(_0x9936('0x6'));var util=require(_0x9936('0x7'));var path=require(_0x9936('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9936('0x9'));var fs=require('fs');var fs_extra=require(_0x9936('0xa'));var _=require('lodash');var squel=require(_0x9936('0xb'));var crypto=require(_0x9936('0xc'));var jsforce=require(_0x9936('0xd'));var deskjs=require(_0x9936('0xe'));var toCsv=require(_0x9936('0xf'));var querystring=require(_0x9936('0x10'));var Papa=require('papaparse');var Redis=require(_0x9936('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9936('0x12'));var logger=require(_0x9936('0x13'))(_0x9936('0x14'));var utils=require(_0x9936('0x15'));var config=require(_0x9936('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9936('0x17'))['db'];function respondWithStatusCode(_0x1c8b0c,_0x5da2fa){_0x5da2fa=_0x5da2fa||0xcc;return function(_0x4f390e){if(_0x4f390e){return _0x1c8b0c[_0x9936('0x18')](_0x5da2fa);}return _0x1c8b0c[_0x9936('0x19')](_0x5da2fa)[_0x9936('0x1a')]();};}function respondWithResult(_0x3c40dd,_0x285693){_0x285693=_0x285693||0xc8;return function(_0x5ee84a){if(_0x5ee84a){return _0x3c40dd[_0x9936('0x19')](_0x285693)[_0x9936('0x1b')](_0x5ee84a);}};}function respondWithFilteredResult(_0x3deb95,_0x37e2fd){return function(_0x5f47a7){if(_0x5f47a7){var _0x1266d1=typeof _0x37e2fd[_0x9936('0x1c')]==='undefined'&&typeof _0x37e2fd['limit']==='undefined';var _0x435639=_0x5f47a7[_0x9936('0x1d')];var _0x55ad40=_0x1266d1?0x0:_0x37e2fd[_0x9936('0x1c')];var _0x95da6c=_0x1266d1?_0x5f47a7[_0x9936('0x1d')]:_0x37e2fd['offset']+_0x37e2fd[_0x9936('0x1e')];var _0xe46f54;if(_0x95da6c>=_0x435639){_0x95da6c=_0x435639;_0xe46f54=0xc8;}else{_0xe46f54=0xce;}_0x3deb95['status'](_0xe46f54);return _0x3deb95[_0x9936('0x1f')](_0x9936('0x20'),_0x55ad40+'-'+_0x95da6c+'/'+_0x435639)[_0x9936('0x1b')](_0x5f47a7);}return null;};}function patchUpdates(_0x12d53f){return function(_0x331abd){try{jsonpatch['apply'](_0x331abd,_0x12d53f,!![]);}catch(_0x22b1ea){return BPromise['reject'](_0x22b1ea);}return _0x331abd[_0x9936('0x21')]();};}function saveUpdates(_0x34967b,_0x1cb19b){return function(_0x3d1b00){if(_0x3d1b00){return _0x3d1b00[_0x9936('0x22')](_0x34967b)[_0x9936('0x23')](function(_0xd8ca35){return _0xd8ca35;});}return null;};}function removeEntity(_0x16606a,_0x147216){return function(_0xc266dc){if(_0xc266dc){return _0xc266dc['destroy']()[_0x9936('0x23')](function(){_0x16606a[_0x9936('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21fc04,_0x1cde72){return function(_0x58ecf9){if(!_0x58ecf9){_0x21fc04[_0x9936('0x18')](0x194);}return _0x58ecf9;};}function handleError(_0x2ec069,_0x3cf2f3){_0x3cf2f3=_0x3cf2f3||0x1f4;return function(_0x38c7c8){logger[_0x9936('0x24')](_0x38c7c8[_0x9936('0x25')]);if(_0x38c7c8[_0x9936('0x26')]){delete _0x38c7c8[_0x9936('0x26')];}_0x2ec069[_0x9936('0x19')](_0x3cf2f3)[_0x9936('0x27')](_0x38c7c8);};}exports[_0x9936('0x28')]=function(_0x805293,_0x57e59e){var _0x29441c={},_0x55ffb5={},_0x2bd692={'count':0x0,'rows':[]};var _0x26046c=_[_0x9936('0x29')](db[_0x9936('0x2a')][_0x9936('0x2b')],function(_0x169582){return{'name':_0x169582[_0x9936('0x2c')],'type':_0x169582['type'][_0x9936('0x2d')]};});_0x55ffb5['model']=_[_0x9936('0x29')](_0x26046c,'name');_0x55ffb5['query']=_[_0x9936('0x2e')](_0x805293[_0x9936('0x2f')]);_0x55ffb5[_0x9936('0x30')]=_[_0x9936('0x31')](_0x55ffb5[_0x9936('0x32')],_0x55ffb5['query']);_0x29441c[_0x9936('0x33')]=_[_0x9936('0x31')](_0x55ffb5[_0x9936('0x32')],qs[_0x9936('0x34')](_0x805293[_0x9936('0x2f')][_0x9936('0x34')]));_0x29441c[_0x9936('0x33')]=_0x29441c[_0x9936('0x33')][_0x9936('0x35')]?_0x29441c['attributes']:_0x55ffb5[_0x9936('0x32')];if(!_0x805293[_0x9936('0x2f')][_0x9936('0x36')](_0x9936('0x37'))){_0x29441c[_0x9936('0x1e')]=qs[_0x9936('0x1e')](_0x805293['query']['limit']);_0x29441c[_0x9936('0x1c')]=qs[_0x9936('0x1c')](_0x805293[_0x9936('0x2f')][_0x9936('0x1c')]);}_0x29441c[_0x9936('0x38')]=qs[_0x9936('0x39')](_0x805293[_0x9936('0x2f')]['sort']);_0x29441c[_0x9936('0x3a')]=qs[_0x9936('0x30')](_[_0x9936('0x3b')](_0x805293[_0x9936('0x2f')],_0x55ffb5[_0x9936('0x30')]),_0x26046c);if(_0x805293[_0x9936('0x2f')][_0x9936('0x3c')]){_0x29441c[_0x9936('0x3a')]=_[_0x9936('0x3d')](_0x29441c[_0x9936('0x3a')],{'$or':_[_0x9936('0x29')](_0x26046c,function(_0x19de72){if(_0x19de72[_0x9936('0x3e')]!=='VIRTUAL'){var _0x2a62b5={};_0x2a62b5[_0x19de72['name']]={'$like':'%'+_0x805293[_0x9936('0x2f')][_0x9936('0x3c')]+'%'};return _0x2a62b5;}})});}_0x29441c=_[_0x9936('0x3d')]({},_0x29441c,_0x805293['options']);var _0x3982b2={'where':_0x29441c[_0x9936('0x3a')]};return db[_0x9936('0x2a')][_0x9936('0x1d')](_0x3982b2)['then'](function(_0x5f27c7){_0x2bd692['count']=_0x5f27c7;if(_0x805293[_0x9936('0x2f')][_0x9936('0x3f')]){_0x29441c[_0x9936('0x40')]=[{'all':!![]}];}return db[_0x9936('0x2a')][_0x9936('0x41')](_0x29441c);})[_0x9936('0x23')](function(_0x482560){_0x2bd692[_0x9936('0x42')]=_0x482560;return _0x2bd692;})[_0x9936('0x23')](respondWithFilteredResult(_0x57e59e,_0x29441c))[_0x9936('0x43')](handleError(_0x57e59e,null));};exports[_0x9936('0x44')]=function(_0x4f8244,_0x398c82){var _0x22b5d2={'raw':!![],'where':{'id':_0x4f8244[_0x9936('0x45')]['id']}},_0x196acd={};_0x196acd['model']=_[_0x9936('0x2e')](db[_0x9936('0x2a')]['rawAttributes']);_0x196acd[_0x9936('0x2f')]=_[_0x9936('0x2e')](_0x4f8244[_0x9936('0x2f')]);_0x196acd[_0x9936('0x30')]=_[_0x9936('0x31')](_0x196acd[_0x9936('0x32')],_0x196acd[_0x9936('0x2f')]);_0x22b5d2[_0x9936('0x33')]=_[_0x9936('0x31')](_0x196acd[_0x9936('0x32')],qs['fields'](_0x4f8244['query'][_0x9936('0x34')]));_0x22b5d2['attributes']=_0x22b5d2[_0x9936('0x33')][_0x9936('0x35')]?_0x22b5d2[_0x9936('0x33')]:_0x196acd[_0x9936('0x32')];if(_0x4f8244[_0x9936('0x2f')]['includeAll']){_0x22b5d2[_0x9936('0x40')]=[{'all':!![]}];}_0x22b5d2=_[_0x9936('0x3d')]({},_0x22b5d2,_0x4f8244[_0x9936('0x46')]);return db[_0x9936('0x2a')]['find'](_0x22b5d2)['then'](handleEntityNotFound(_0x398c82,null))['then'](respondWithResult(_0x398c82,null))[_0x9936('0x43')](handleError(_0x398c82,null));};exports[_0x9936('0x47')]=function(_0x535c16,_0x4b7b62){return db['ZohoField'][_0x9936('0x47')](_0x535c16[_0x9936('0x48')],{})[_0x9936('0x23')](respondWithResult(_0x4b7b62,0xc9))[_0x9936('0x43')](handleError(_0x4b7b62,null));};exports[_0x9936('0x22')]=function(_0x14e218,_0x445f2c){if(_0x14e218[_0x9936('0x48')]['id']){delete _0x14e218[_0x9936('0x48')]['id'];}return db[_0x9936('0x2a')][_0x9936('0x49')]({'where':{'id':_0x14e218[_0x9936('0x45')]['id']}})[_0x9936('0x23')](handleEntityNotFound(_0x445f2c,null))['then'](saveUpdates(_0x14e218['body'],null))['then'](respondWithResult(_0x445f2c,null))['catch'](handleError(_0x445f2c,null));};exports[_0x9936('0x4a')]=function(_0x25da42,_0x2801f5){return db[_0x9936('0x2a')]['find']({'where':{'id':_0x25da42[_0x9936('0x45')]['id']}})[_0x9936('0x23')](handleEntityNotFound(_0x2801f5,null))[_0x9936('0x23')](removeEntity(_0x2801f5,null))[_0x9936('0x43')](handleError(_0x2801f5,null));}; \ No newline at end of file +var _0xedb7=['fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','filter','options','includeAll','include','ZohoField','findAll','catch','show','create','body','find','params','rimraf'];(function(_0x391e6d,_0x93a758){var _0x23a475=function(_0x1086c7){while(--_0x1086c7){_0x391e6d['push'](_0x391e6d['shift']());}};_0x23a475(++_0x93a758);}(_0xedb7,0x8b));var _0x7edb=function(_0x386727,_0x1f33c8){_0x386727=_0x386727-0x0;var _0x26b9fd=_0xedb7[_0x386727];return _0x26b9fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7edb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7edb('0x1'));var rp=require(_0x7edb('0x2'));var moment=require(_0x7edb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7edb('0x4'));var util=require(_0x7edb('0x5'));var path=require(_0x7edb('0x6'));var sox=require(_0x7edb('0x7'));var csv=require('to-csv');var ejs=require(_0x7edb('0x8'));var fs=require('fs');var fs_extra=require(_0x7edb('0x9'));var _=require(_0x7edb('0xa'));var squel=require('squel');var crypto=require(_0x7edb('0xb'));var jsforce=require(_0x7edb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7edb('0xd'));var Papa=require(_0x7edb('0xe'));var Redis=require('ioredis');var authService=require(_0x7edb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7edb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7edb('0x11'))(_0x7edb('0x12'));var utils=require('../../config/utils');var config=require(_0x7edb('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7edb('0x14'))['db'];function respondWithStatusCode(_0x233c54,_0x3ab32a){_0x3ab32a=_0x3ab32a||0xcc;return function(_0x188a2a){if(_0x188a2a){return _0x233c54[_0x7edb('0x15')](_0x3ab32a);}return _0x233c54[_0x7edb('0x16')](_0x3ab32a)[_0x7edb('0x17')]();};}function respondWithResult(_0x329b7c,_0x53ed58){_0x53ed58=_0x53ed58||0xc8;return function(_0x303e5f){if(_0x303e5f){return _0x329b7c[_0x7edb('0x16')](_0x53ed58)[_0x7edb('0x18')](_0x303e5f);}};}function respondWithFilteredResult(_0x3dc351,_0x2e9f32){return function(_0xf2edf1){if(_0xf2edf1){var _0xf8cdc8=typeof _0x2e9f32[_0x7edb('0x19')]===_0x7edb('0x1a')&&typeof _0x2e9f32[_0x7edb('0x1b')]==='undefined';var _0x44ef0e=_0xf2edf1[_0x7edb('0x1c')];var _0x2819ab=_0xf8cdc8?0x0:_0x2e9f32[_0x7edb('0x19')];var _0x4f7c55=_0xf8cdc8?_0xf2edf1[_0x7edb('0x1c')]:_0x2e9f32[_0x7edb('0x19')]+_0x2e9f32['limit'];var _0x5b586a;if(_0x4f7c55>=_0x44ef0e){_0x4f7c55=_0x44ef0e;_0x5b586a=0xc8;}else{_0x5b586a=0xce;}_0x3dc351[_0x7edb('0x16')](_0x5b586a);return _0x3dc351['set'](_0x7edb('0x1d'),_0x2819ab+'-'+_0x4f7c55+'/'+_0x44ef0e)['json'](_0xf2edf1);}return null;};}function patchUpdates(_0x105eba){return function(_0x5b2a23){try{jsonpatch[_0x7edb('0x1e')](_0x5b2a23,_0x105eba,!![]);}catch(_0x57a191){return BPromise[_0x7edb('0x1f')](_0x57a191);}return _0x5b2a23[_0x7edb('0x20')]();};}function saveUpdates(_0x1505de,_0x16b6e9){return function(_0x3abf95){if(_0x3abf95){return _0x3abf95[_0x7edb('0x21')](_0x1505de)[_0x7edb('0x22')](function(_0x21f2e2){return _0x21f2e2;});}return null;};}function removeEntity(_0x352f4d,_0x2cc47f){return function(_0x3be0ce){if(_0x3be0ce){return _0x3be0ce[_0x7edb('0x23')]()[_0x7edb('0x22')](function(){_0x352f4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x97aa70,_0x301066){return function(_0x53655f){if(!_0x53655f){_0x97aa70[_0x7edb('0x15')](0x194);}return _0x53655f;};}function handleError(_0xb40816,_0x20c836){_0x20c836=_0x20c836||0x1f4;return function(_0x88f635){logger[_0x7edb('0x24')](_0x88f635[_0x7edb('0x25')]);if(_0x88f635[_0x7edb('0x26')]){delete _0x88f635[_0x7edb('0x26')];}_0xb40816[_0x7edb('0x16')](_0x20c836)[_0x7edb('0x27')](_0x88f635);};}exports[_0x7edb('0x28')]=function(_0x2e7bdd,_0x5b196e){var _0x6c9ca7={},_0x535667={},_0x4c4a1a={'count':0x0,'rows':[]};var _0x27551=_[_0x7edb('0x29')](db['ZohoField']['rawAttributes'],function(_0x43e9c9){return{'name':_0x43e9c9[_0x7edb('0x2a')],'type':_0x43e9c9[_0x7edb('0x2b')][_0x7edb('0x2c')]};});_0x535667[_0x7edb('0x2d')]=_['map'](_0x27551,_0x7edb('0x26'));_0x535667['query']=_[_0x7edb('0x2e')](_0x2e7bdd[_0x7edb('0x2f')]);_0x535667[_0x7edb('0x30')]=_[_0x7edb('0x31')](_0x535667['model'],_0x535667['query']);_0x6c9ca7[_0x7edb('0x32')]=_[_0x7edb('0x31')](_0x535667[_0x7edb('0x2d')],qs[_0x7edb('0x33')](_0x2e7bdd[_0x7edb('0x2f')]['fields']));_0x6c9ca7['attributes']=_0x6c9ca7[_0x7edb('0x32')][_0x7edb('0x34')]?_0x6c9ca7[_0x7edb('0x32')]:_0x535667[_0x7edb('0x2d')];if(!_0x2e7bdd[_0x7edb('0x2f')]['hasOwnProperty'](_0x7edb('0x35'))){_0x6c9ca7[_0x7edb('0x1b')]=qs['limit'](_0x2e7bdd[_0x7edb('0x2f')][_0x7edb('0x1b')]);_0x6c9ca7[_0x7edb('0x19')]=qs[_0x7edb('0x19')](_0x2e7bdd[_0x7edb('0x2f')][_0x7edb('0x19')]);}_0x6c9ca7['order']=qs[_0x7edb('0x36')](_0x2e7bdd[_0x7edb('0x2f')][_0x7edb('0x36')]);_0x6c9ca7['where']=qs[_0x7edb('0x30')](_[_0x7edb('0x37')](_0x2e7bdd[_0x7edb('0x2f')],_0x535667[_0x7edb('0x30')]),_0x27551);if(_0x2e7bdd[_0x7edb('0x2f')]['filter']){_0x6c9ca7[_0x7edb('0x38')]=_[_0x7edb('0x39')](_0x6c9ca7[_0x7edb('0x38')],{'$or':_[_0x7edb('0x29')](_0x27551,function(_0x1dd9bc){if(_0x1dd9bc[_0x7edb('0x2b')]!=='VIRTUAL'){var _0x282849={};_0x282849[_0x1dd9bc[_0x7edb('0x26')]]={'$like':'%'+_0x2e7bdd[_0x7edb('0x2f')][_0x7edb('0x3a')]+'%'};return _0x282849;}})});}_0x6c9ca7=_[_0x7edb('0x39')]({},_0x6c9ca7,_0x2e7bdd[_0x7edb('0x3b')]);var _0x4b38b9={'where':_0x6c9ca7[_0x7edb('0x38')]};return db['ZohoField'][_0x7edb('0x1c')](_0x4b38b9)['then'](function(_0x203043){_0x4c4a1a[_0x7edb('0x1c')]=_0x203043;if(_0x2e7bdd[_0x7edb('0x2f')][_0x7edb('0x3c')]){_0x6c9ca7[_0x7edb('0x3d')]=[{'all':!![]}];}return db[_0x7edb('0x3e')][_0x7edb('0x3f')](_0x6c9ca7);})[_0x7edb('0x22')](function(_0x129b7e){_0x4c4a1a['rows']=_0x129b7e;return _0x4c4a1a;})[_0x7edb('0x22')](respondWithFilteredResult(_0x5b196e,_0x6c9ca7))[_0x7edb('0x40')](handleError(_0x5b196e,null));};exports[_0x7edb('0x41')]=function(_0xead774,_0x43262c){var _0x46c163={'raw':!![],'where':{'id':_0xead774['params']['id']}},_0x1f5b4f={};_0x1f5b4f['model']=_[_0x7edb('0x2e')](db[_0x7edb('0x3e')]['rawAttributes']);_0x1f5b4f['query']=_[_0x7edb('0x2e')](_0xead774[_0x7edb('0x2f')]);_0x1f5b4f[_0x7edb('0x30')]=_['intersection'](_0x1f5b4f[_0x7edb('0x2d')],_0x1f5b4f[_0x7edb('0x2f')]);_0x46c163['attributes']=_['intersection'](_0x1f5b4f[_0x7edb('0x2d')],qs[_0x7edb('0x33')](_0xead774[_0x7edb('0x2f')][_0x7edb('0x33')]));_0x46c163[_0x7edb('0x32')]=_0x46c163['attributes'][_0x7edb('0x34')]?_0x46c163[_0x7edb('0x32')]:_0x1f5b4f[_0x7edb('0x2d')];if(_0xead774[_0x7edb('0x2f')][_0x7edb('0x3c')]){_0x46c163[_0x7edb('0x3d')]=[{'all':!![]}];}_0x46c163=_[_0x7edb('0x39')]({},_0x46c163,_0xead774[_0x7edb('0x3b')]);return db[_0x7edb('0x3e')]['find'](_0x46c163)['then'](handleEntityNotFound(_0x43262c,null))[_0x7edb('0x22')](respondWithResult(_0x43262c,null))['catch'](handleError(_0x43262c,null));};exports[_0x7edb('0x42')]=function(_0xf1838f,_0x5ea9cd){return db[_0x7edb('0x3e')]['create'](_0xf1838f[_0x7edb('0x43')],{})[_0x7edb('0x22')](respondWithResult(_0x5ea9cd,0xc9))[_0x7edb('0x40')](handleError(_0x5ea9cd,null));};exports['update']=function(_0xd20e33,_0x2b7d7f){if(_0xd20e33['body']['id']){delete _0xd20e33[_0x7edb('0x43')]['id'];}return db['ZohoField'][_0x7edb('0x44')]({'where':{'id':_0xd20e33[_0x7edb('0x45')]['id']}})[_0x7edb('0x22')](handleEntityNotFound(_0x2b7d7f,null))[_0x7edb('0x22')](saveUpdates(_0xd20e33[_0x7edb('0x43')],null))[_0x7edb('0x22')](respondWithResult(_0x2b7d7f,null))[_0x7edb('0x40')](handleError(_0x2b7d7f,null));};exports[_0x7edb('0x23')]=function(_0x458a13,_0x401b9a){return db[_0x7edb('0x3e')]['find']({'where':{'id':_0x458a13[_0x7edb('0x45')]['id']}})[_0x7edb('0x22')](handleEntityNotFound(_0x401b9a,null))[_0x7edb('0x22')](removeEntity(_0x401b9a,null))[_0x7edb('0x40')](handleError(_0x401b9a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b4aee69..3e698c2 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 _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x277b3b,_0x21e31e){var _0x485b29=function(_0x4331d8){while(--_0x4331d8){_0x277b3b['push'](_0x277b3b['shift']());}};_0x485b29(++_0x21e31e);}(_0x82c4,0x1ca));var _0x482c=function(_0x148d64,_0x55b931){_0x148d64=_0x148d64-0x0;var _0x7a914e=_0x82c4[_0x148d64];return _0x7a914e;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0xd2493b,_0x59acd2){var _0x11fac1=function(_0x34c6d1){while(--_0x34c6d1){_0xd2493b['push'](_0xd2493b['shift']());}};_0x11fac1(++_0x59acd2);}(_0x90b1,0x1bb));var _0x190b=function(_0x5489c4,_0x1e7a17){_0x5489c4=_0x5489c4-0x0;var _0x2c4624=_0x90b1[_0x5489c4];return _0x2c4624;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xb'),_0x190b('0xc')],'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 7e61e21..569393a 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 _0x71b6=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','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','result'];(function(_0x46814d,_0x1df6bd){var _0x17dbb0=function(_0x3e672d){while(--_0x3e672d){_0x46814d['push'](_0x46814d['shift']());}};_0x17dbb0(++_0x1df6bd);}(_0x71b6,0x146));var _0x671b=function(_0x144279,_0x1ac61c){_0x144279=_0x144279-0x0;var _0x50563c=_0x71b6[_0x144279];return _0x50563c;};'use strict';var _=require(_0x671b('0x0'));var util=require(_0x671b('0x1'));var moment=require('moment');var BPromise=require(_0x671b('0x2'));var rs=require(_0x671b('0x3'));var fs=require('fs');var Redis=require(_0x671b('0x4'));var db=require(_0x671b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x671b('0x6'))(_0x671b('0x7'));var config=require(_0x671b('0x8'));var jayson=require(_0x671b('0x9'));var client=jayson[_0x671b('0xa')][_0x671b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e1c3f,_0x2ab141,_0x31b4d8){return new BPromise(function(_0x4d102f,_0x4a230b){return client[_0x671b('0xc')](_0x3e1c3f,_0x31b4d8)[_0x671b('0xd')](function(_0x5acfac){logger[_0x671b('0xe')](_0x671b('0xf'),_0x2ab141,'request\x20sent');logger[_0x671b('0x10')](_0x671b('0x11'),_0x2ab141,_0x671b('0x12'),JSON[_0x671b('0x13')](_0x5acfac));if(_0x5acfac[_0x671b('0x14')]){if(_0x5acfac['error'][_0x671b('0x15')]===0x1f4){logger['error'](_0x671b('0xf'),_0x2ab141,_0x5acfac[_0x671b('0x14')][_0x671b('0x16')]);return _0x4a230b(_0x5acfac[_0x671b('0x14')][_0x671b('0x16')]);}logger[_0x671b('0x14')](_0x671b('0xf'),_0x2ab141,_0x5acfac[_0x671b('0x14')][_0x671b('0x16')]);return _0x4d102f(_0x5acfac[_0x671b('0x14')][_0x671b('0x16')]);}else{logger[_0x671b('0xe')](_0x671b('0xf'),_0x2ab141,'request\x20sent');_0x4d102f(_0x5acfac[_0x671b('0x17')][_0x671b('0x16')]);}})[_0x671b('0x18')](function(_0x325529){logger[_0x671b('0x14')](_0x671b('0xf'),_0x2ab141,_0x325529);_0x4a230b(_0x325529);});});} \ No newline at end of file +var _0x3318=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x59ab5a,_0x5db26f){var _0x5e0279=function(_0x198e49){while(--_0x198e49){_0x59ab5a['push'](_0x59ab5a['shift']());}};_0x5e0279(++_0x5db26f);}(_0x3318,0x117));var _0x8331=function(_0x5a193b,_0x36cc34){_0x5a193b=_0x5a193b-0x0;var _0x167e8d=_0x3318[_0x5a193b];return _0x167e8d;};'use strict';var _=require(_0x8331('0x0'));var util=require(_0x8331('0x1'));var moment=require(_0x8331('0x2'));var BPromise=require(_0x8331('0x3'));var rs=require(_0x8331('0x4'));var fs=require('fs');var Redis=require(_0x8331('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8331('0x6'));var logger=require(_0x8331('0x7'))(_0x8331('0x8'));var config=require(_0x8331('0x9'));var jayson=require(_0x8331('0xa'));var client=jayson[_0x8331('0xb')][_0x8331('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x149c1c,_0x39e95b,_0x28ad0f){return new BPromise(function(_0x2f7b7f,_0x340836){return client[_0x8331('0xd')](_0x149c1c,_0x28ad0f)[_0x8331('0xe')](function(_0xb0dc54){logger[_0x8331('0xf')](_0x8331('0x10'),_0x39e95b,_0x8331('0x11'));logger[_0x8331('0x12')](_0x8331('0x13'),_0x39e95b,'request\x20sent',JSON[_0x8331('0x14')](_0xb0dc54));if(_0xb0dc54[_0x8331('0x15')]){if(_0xb0dc54[_0x8331('0x15')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x39e95b,_0xb0dc54[_0x8331('0x15')]['message']);return _0x340836(_0xb0dc54[_0x8331('0x15')][_0x8331('0x16')]);}logger['error'](_0x8331('0x10'),_0x39e95b,_0xb0dc54[_0x8331('0x15')][_0x8331('0x16')]);return _0x2f7b7f(_0xb0dc54[_0x8331('0x15')]['message']);}else{logger[_0x8331('0xf')]('ZohoField,\x20%s,\x20%s',_0x39e95b,'request\x20sent');_0x2f7b7f(_0xb0dc54[_0x8331('0x17')][_0x8331('0x16')]);}})[_0x8331('0x18')](function(_0x24e8ab){logger[_0x8331('0x15')]('ZohoField,\x20%s,\x20%s',_0x39e95b,_0x24e8ab);_0x340836(_0x24e8ab);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f9188ae..95042ee 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x268b47,_0x3b965e){var _0x2daa1f=function(_0xc65559){while(--_0xc65559){_0x268b47['push'](_0x268b47['shift']());}};_0x2daa1f(++_0x3b965e);}(_0x70e0,0x17b));var _0x070e=function(_0x10e957,_0x245bd9){_0x10e957=_0x10e957-0x0;var _0x46e4f8=_0x70e0[_0x10e957];return _0x46e4f8;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 51d61b1..e28afe6 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 _0x4274=['unique_name_and_version','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x58ef68,_0x275204){var _0x169a7f=function(_0x479c79){while(--_0x479c79){_0x58ef68['push'](_0x58ef68['shift']());}};_0x169a7f(++_0x275204);}(_0x4274,0x94));var _0x4427=function(_0x39c8d5,_0xec3c20){_0x39c8d5=_0x39c8d5-0x0;var _0xeb77f7=_0x4274[_0x39c8d5];return _0xeb77f7;};'use strict';var Sequelize=require('sequelize');module[_0x4427('0x0')]={'name':{'type':Sequelize[_0x4427('0x1')],'allowNull':![],'unique':_0x4427('0x2')},'version':{'type':Sequelize[_0x4427('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x4427('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x4427('0x1')]},'path':{'type':Sequelize[_0x4427('0x1')]},'type':{'type':Sequelize[_0x4427('0x1')]},'size':{'type':Sequelize[_0x4427('0x3')]},'active':{'type':Sequelize[_0x4427('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x4427('0x1')]},'logo':{'type':Sequelize[_0x4427('0x1')]},'state':{'type':Sequelize[_0x4427('0x1')],'unique':_0x4427('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x4427('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x4427('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0da2=['sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state'];(function(_0x1d34e7,_0x276e3e){var _0x4c94ba=function(_0x48bd2f){while(--_0x48bd2f){_0x1d34e7['push'](_0x1d34e7['shift']());}};_0x4c94ba(++_0x276e3e);}(_0x0da2,0x85));var _0x20da=function(_0xfab214,_0x5d88a2){_0xfab214=_0xfab214-0x0;var _0x46c646=_0x0da2[_0xfab214];return _0x46c646;};'use strict';var Sequelize=require(_0x20da('0x0'));module[_0x20da('0x1')]={'name':{'type':Sequelize[_0x20da('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x20da('0x2')],'allowNull':![],'unique':_0x20da('0x3')},'main':{'type':Sequelize[_0x20da('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x20da('0x2')]},'path':{'type':Sequelize[_0x20da('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x20da('0x4')]},'active':{'type':Sequelize[_0x20da('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x20da('0x2')]},'logo':{'type':Sequelize[_0x20da('0x2')]},'state':{'type':Sequelize[_0x20da('0x2')],'unique':_0x20da('0x6')},'description':{'type':Sequelize[_0x20da('0x2')]},'title':{'type':Sequelize[_0x20da('0x2')]},'remoteUri':{'type':Sequelize[_0x20da('0x2')]},'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 1467afd..906b7c7 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 _0x7880=['set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit'];(function(_0x3e568c,_0x4fdcd1){var _0x4dd8ba=function(_0x7fb20f){while(--_0x7fb20f){_0x3e568c['push'](_0x3e568c['shift']());}};_0x4dd8ba(++_0x4fdcd1);}(_0x7880,0x1f4));var _0x0788=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0x7880[_0x40de6f];return _0x44a887;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['Integration'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));}; \ No newline at end of file +var _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x34cceb,_0x553b94){var _0xe1dee7=function(_0x3c6f44){while(--_0x3c6f44){_0x34cceb['push'](_0x34cceb['shift']());}};_0xe1dee7(++_0x553b94);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xfcf0[_0x4bb581];return _0x316bf5;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5f3ff78..127ac1c 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 _0xff23=['../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4080f6,_0x226615){var _0x1b4417=function(_0x99089c){while(--_0x99089c){_0x4080f6['push'](_0x4080f6['shift']());}};_0x1b4417(++_0x226615);}(_0xff23,0x1f4));var _0x3ff2=function(_0x4eeb0a,_0x5c8852){_0x4eeb0a=_0x4eeb0a-0x0;var _0x21b49b=_0xff23[_0x4eeb0a];return _0x21b49b;};'use strict';var _=require(_0x3ff2('0x0'));var util=require(_0x3ff2('0x1'));var logger=require(_0x3ff2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ff2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ff2('0x4'));var rimraf=require(_0x3ff2('0x5'));var config=require(_0x3ff2('0x6'));var attributes=require(_0x3ff2('0x7'));module[_0x3ff2('0x8')]=function(_0x22f7ea,_0x40aac4){return _0x22f7ea['define'](_0x3ff2('0x9'),attributes,{'tableName':_0x3ff2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','Integration','integrations','lodash','util','../../config/logger'];(function(_0x5b8648,_0x1e3351){var _0x3d6d49=function(_0x3a50cd){while(--_0x3a50cd){_0x5b8648['push'](_0x5b8648['shift']());}};_0x3d6d49(++_0x1e3351);}(_0xcdf7,0x1de));var _0x7cdf=function(_0x525b56,_0xdaac84){_0x525b56=_0x525b56-0x0;var _0x4b82ef=_0xcdf7[_0x525b56];return _0x4b82ef;};'use strict';var _=require(_0x7cdf('0x0'));var util=require(_0x7cdf('0x1'));var logger=require(_0x7cdf('0x2'))(_0x7cdf('0x3'));var moment=require(_0x7cdf('0x4'));var BPromise=require(_0x7cdf('0x5'));var rp=require(_0x7cdf('0x6'));var fs=require('fs');var path=require(_0x7cdf('0x7'));var rimraf=require(_0x7cdf('0x8'));var config=require(_0x7cdf('0x9'));var attributes=require(_0x7cdf('0xa'));module['exports']=function(_0x10d566,_0x179099){return _0x10d566['define'](_0x7cdf('0xb'),attributes,{'tableName':_0x7cdf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index d5ba380..5b86c2f 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 _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x350f66,_0x125b68){var _0x2801ab=function(_0x58fd69){while(--_0x58fd69){_0x350f66['push'](_0x350f66['shift']());}};_0x2801ab(++_0x125b68);}(_0x0295,0x1f0));var _0x5029=function(_0x437abe,_0x3e33a8){_0x437abe=_0x437abe-0x0;var _0x51189b=_0x0295[_0x437abe];return _0x51189b;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x66595b,_0x47fd99){var _0x2e5943=function(_0x56221d){while(--_0x56221d){_0x66595b['push'](_0x66595b['shift']());}};_0x2e5943(++_0x47fd99);}(_0x66fa,0x117));var _0xa66f=function(_0x47d251,_0x46867c){_0x47d251=_0x47d251-0x0;var _0x71b542=_0x66fa[_0x47d251];return _0x71b542;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1e581b3..e2391b1 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(_0x443479,_0x5e60a4){var _0x1fb3a6=function(_0x174272){while(--_0x174272){_0x443479['push'](_0x443479['shift']());}};_0x1fb3a6(++_0x5e60a4);}(_0x4975,0x86));var _0x5497=function(_0x2e3359,_0x55dd00){_0x2e3359=_0x2e3359-0x0;var _0xa45214=_0x4975[_0x2e3359];return _0xa45214;};'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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5d8026,_0x442de8){var _0x2e6113=function(_0x2397d8){while(--_0x2397d8){_0x5d8026['push'](_0x5d8026['shift']());}};_0x2e6113(++_0x442de8);}(_0x955f,0x1eb));var _0xf955=function(_0x1adf59,_0x4fb84){_0x1adf59=_0x1adf59-0x0;var _0x219266=_0x955f[_0x1adf59];return _0x219266;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7278b80..9d3450c 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 _0x2082=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2082,0xa0));var _0x2208=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x2082[_0x3d2e4b];return _0x509e78;};'use strict';var Sequelize=require(_0x2208('0x0'));module[_0x2208('0x1')]={'integration':{'type':Sequelize[_0x2208('0x2')]},'eventChannel':{'type':Sequelize[_0x2208('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2208('0x2')]},'integrationId':{'type':Sequelize[_0x2208('0x3')]},'contacts':{'type':Sequelize[_0x2208('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2208('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2208('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2208('0x4')]},'holdtime':{'type':Sequelize[_0x2208('0x3')]},'agentcomplete':{'type':Sequelize[_0x2208('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2208('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2208('0x3')]},'reason':{'type':Sequelize[_0x2208('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x2208('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2208('0x4')]},'agentdump':{'type':Sequelize[_0x2208('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2208('0x4')]},'lastevent':{'type':Sequelize[_0x2208('0x2')]},'channel':{'type':Sequelize[_0x2208('0x2')]},'channelstate':{'type':Sequelize[_0x2208('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2208('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2208('0x2')]},'connectedlinename':{'type':Sequelize[_0x2208('0x2')]},'language':{'type':Sequelize[_0x2208('0x2')]},'accountcode':{'type':Sequelize[_0x2208('0x2')]},'context':{'type':Sequelize[_0x2208('0x2')]},'exten':{'type':Sequelize[_0x2208('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2208('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x2208('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2208('0x2')]},'destlanguage':{'type':Sequelize[_0x2208('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2208('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2208('0x2')]},'subject':{'type':Sequelize[_0x2208('0x2')]},'from':{'type':Sequelize[_0x2208('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2208('0x2')]},'attachment':{'type':Sequelize[_0x2208('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x2208('0x7')](_0x2208('0x8'),_0x2208('0x9'),_0x2208('0xa'),_0x2208('0xb'))},'url':{'type':Sequelize[_0x2208('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x2208('0x2')]},'projectId':{'type':Sequelize[_0x2208('0x3')]}}; \ No newline at end of file +var _0x3ed2=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x2d554f,_0x284acd){var _0x579473=function(_0x4f155c){while(--_0x4f155c){_0x2d554f['push'](_0x2d554f['shift']());}};_0x579473(++_0x284acd);}(_0x3ed2,0x1f1));var _0x23ed=function(_0x25140e,_0x256029){_0x25140e=_0x25140e-0x0;var _0x157586=_0x3ed2[_0x25140e];return _0x157586;};'use strict';var Sequelize=require(_0x23ed('0x0'));module[_0x23ed('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x23ed('0x2')]},'ticketId':{'type':Sequelize[_0x23ed('0x2')]},'integrationId':{'type':Sequelize[_0x23ed('0x3')]},'contacts':{'type':Sequelize[_0x23ed('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x23ed('0x2')]},'calleridname':{'type':Sequelize[_0x23ed('0x2')]},'queue':{'type':Sequelize[_0x23ed('0x2')]},'interface':{'type':Sequelize[_0x23ed('0x2')]},'membername':{'type':Sequelize[_0x23ed('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x23ed('0x4')]},'holdtime':{'type':Sequelize[_0x23ed('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x23ed('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x23ed('0x3')]},'reason':{'type':Sequelize[_0x23ed('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x23ed('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x23ed('0x4')]},'agentdump':{'type':Sequelize[_0x23ed('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x23ed('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x23ed('0x2')]},'channelstate':{'type':Sequelize[_0x23ed('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x23ed('0x2')]},'connectedlinename':{'type':Sequelize[_0x23ed('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x23ed('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x23ed('0x2')]},'priority':{'type':Sequelize[_0x23ed('0x2')]},'destchannel':{'type':Sequelize[_0x23ed('0x2')]},'destchannelstate':{'type':Sequelize[_0x23ed('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x23ed('0x2')]},'destcalleridnum':{'type':Sequelize[_0x23ed('0x2')]},'destcalleridname':{'type':Sequelize[_0x23ed('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x23ed('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x23ed('0x2')]},'destlanguage':{'type':Sequelize[_0x23ed('0x2')]},'destaccountcode':{'type':Sequelize[_0x23ed('0x2')]},'destcontext':{'type':Sequelize[_0x23ed('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x23ed('0x2')]},'destuniqueid':{'type':Sequelize[_0x23ed('0x2')]},'messageId':{'type':Sequelize[_0x23ed('0x2')]},'inReplyTo':{'type':Sequelize[_0x23ed('0x2')]},'subject':{'type':Sequelize[_0x23ed('0x2')]},'from':{'type':Sequelize[_0x23ed('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x23ed('0x2')]},'attachment':{'type':Sequelize[_0x23ed('0x6')]},'html':{'type':Sequelize[_0x23ed('0x6')]},'text':{'type':Sequelize[_0x23ed('0x6')]},'status':{'type':Sequelize[_0x23ed('0x7')]('SENT',_0x23ed('0x8'),_0x23ed('0x9'),_0x23ed('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x23ed('0x2')]},'appdata':{'type':Sequelize[_0x23ed('0x2')]},'projectId':{'type':Sequelize[_0x23ed('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b74592f..057dff8 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 _0xf684=['map','IntegrationReport','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','length','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf684,0x13e));var _0x4f68=function(_0xcc30a5,_0x1a1b45){_0xcc30a5=_0xcc30a5-0x0;var _0x17a28f=_0xf684[_0xcc30a5];return _0x17a28f;};'use strict';var emlformat=require(_0x4f68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f68('0x1'));var jsonpatch=require(_0x4f68('0x2'));var rp=require('request-promise');var moment=require(_0x4f68('0x3'));var BPromise=require(_0x4f68('0x4'));var Mustache=require(_0x4f68('0x5'));var util=require('util');var path=require(_0x4f68('0x6'));var sox=require('sox');var csv=require(_0x4f68('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f68('0x8'));var _=require('lodash');var squel=require(_0x4f68('0x9'));var crypto=require(_0x4f68('0xa'));var jsforce=require(_0x4f68('0xb'));var deskjs=require(_0x4f68('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4f68('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f68('0xe'));var authService=require(_0x4f68('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4f68('0x10'));var hardwareService=require(_0x4f68('0x11'));var logger=require(_0x4f68('0x12'))(_0x4f68('0x13'));var utils=require('../../config/utils');var config=require(_0x4f68('0x14'));var licenseUtil=require(_0x4f68('0x15'));var db=require(_0x4f68('0x16'))['db'];function respondWithStatusCode(_0x203ec3,_0x2a4595){_0x2a4595=_0x2a4595||0xcc;return function(_0x1b3bd5){if(_0x1b3bd5){return _0x203ec3[_0x4f68('0x17')](_0x2a4595);}return _0x203ec3[_0x4f68('0x18')](_0x2a4595)['end']();};}function respondWithResult(_0x580587,_0x45a4fd){_0x45a4fd=_0x45a4fd||0xc8;return function(_0x7934b7){if(_0x7934b7){return _0x580587[_0x4f68('0x18')](_0x45a4fd)[_0x4f68('0x19')](_0x7934b7);}};}function respondWithFilteredResult(_0x26d10d,_0x2d9f48){return function(_0x305489){if(_0x305489){var _0x2cdfc6=typeof _0x2d9f48[_0x4f68('0x1a')]===_0x4f68('0x1b')&&typeof _0x2d9f48[_0x4f68('0x1c')]===_0x4f68('0x1b');var _0xb78d80=_0x305489[_0x4f68('0x1d')];var _0x389ddc=_0x2cdfc6?0x0:_0x2d9f48['offset'];var _0x2f9fd3=_0x2cdfc6?_0x305489[_0x4f68('0x1d')]:_0x2d9f48[_0x4f68('0x1a')]+_0x2d9f48[_0x4f68('0x1c')];var _0x2e78f1;if(_0x2f9fd3>=_0xb78d80){_0x2f9fd3=_0xb78d80;_0x2e78f1=0xc8;}else{_0x2e78f1=0xce;}_0x26d10d[_0x4f68('0x18')](_0x2e78f1);return _0x26d10d[_0x4f68('0x1e')](_0x4f68('0x1f'),_0x389ddc+'-'+_0x2f9fd3+'/'+_0xb78d80)[_0x4f68('0x19')](_0x305489);}return null;};}function patchUpdates(_0xf38f18){return function(_0x278415){try{jsonpatch[_0x4f68('0x20')](_0x278415,_0xf38f18,!![]);}catch(_0x4da352){return BPromise[_0x4f68('0x21')](_0x4da352);}return _0x278415[_0x4f68('0x22')]();};}function saveUpdates(_0x4ac66b,_0x59c418){return function(_0x4745c2){if(_0x4745c2){return _0x4745c2['update'](_0x4ac66b)[_0x4f68('0x23')](function(_0x35d455){return _0x35d455;});}return null;};}function removeEntity(_0x48749d,_0xaec973){return function(_0x5b79d9){if(_0x5b79d9){return _0x5b79d9[_0x4f68('0x24')]()[_0x4f68('0x23')](function(){_0x48749d['status'](0xcc)[_0x4f68('0x25')]();});}};}function handleEntityNotFound(_0x51a70d,_0x5cf6ff){return function(_0x30140a){if(!_0x30140a){_0x51a70d['sendStatus'](0x194);}return _0x30140a;};}function handleError(_0x2ee910,_0x245b7e){_0x245b7e=_0x245b7e||0x1f4;return function(_0xf13733){logger[_0x4f68('0x26')](_0xf13733[_0x4f68('0x27')]);if(_0xf13733[_0x4f68('0x28')]){delete _0xf13733[_0x4f68('0x28')];}_0x2ee910[_0x4f68('0x18')](_0x245b7e)[_0x4f68('0x29')](_0xf13733);};}exports['index']=function(_0x536977,_0x749522){var _0x37fd1d={},_0x5e5d8f={},_0x2632c3={'count':0x0,'rows':[]};var _0x35cbc9=_[_0x4f68('0x2a')](db[_0x4f68('0x2b')][_0x4f68('0x2c')],function(_0x5e3729){return{'name':_0x5e3729['fieldName'],'type':_0x5e3729[_0x4f68('0x2d')][_0x4f68('0x2e')]};});_0x5e5d8f[_0x4f68('0x2f')]=_[_0x4f68('0x2a')](_0x35cbc9,'name');_0x5e5d8f['query']=_[_0x4f68('0x30')](_0x536977[_0x4f68('0x31')]);_0x5e5d8f[_0x4f68('0x32')]=_['intersection'](_0x5e5d8f[_0x4f68('0x2f')],_0x5e5d8f[_0x4f68('0x31')]);_0x37fd1d['attributes']=_[_0x4f68('0x33')](_0x5e5d8f[_0x4f68('0x2f')],qs[_0x4f68('0x34')](_0x536977['query'][_0x4f68('0x34')]));_0x37fd1d[_0x4f68('0x35')]=_0x37fd1d[_0x4f68('0x35')]['length']?_0x37fd1d[_0x4f68('0x35')]:_0x5e5d8f[_0x4f68('0x2f')];if(!_0x536977[_0x4f68('0x31')][_0x4f68('0x36')]('nolimit')){_0x37fd1d[_0x4f68('0x1c')]=qs['limit'](_0x536977[_0x4f68('0x31')][_0x4f68('0x1c')]);_0x37fd1d[_0x4f68('0x1a')]=qs[_0x4f68('0x1a')](_0x536977[_0x4f68('0x31')][_0x4f68('0x1a')]);}_0x37fd1d[_0x4f68('0x37')]=qs[_0x4f68('0x38')](_0x536977[_0x4f68('0x31')][_0x4f68('0x38')]);_0x37fd1d[_0x4f68('0x39')]=qs[_0x4f68('0x32')](_['pick'](_0x536977['query'],_0x5e5d8f['filters']),_0x35cbc9);if(_0x536977['query'][_0x4f68('0x3a')]){_0x37fd1d[_0x4f68('0x39')]=_[_0x4f68('0x3b')](_0x37fd1d[_0x4f68('0x39')],{'$or':_['map'](_0x35cbc9,function(_0x3fdf8c){if(_0x3fdf8c[_0x4f68('0x2d')]!==_0x4f68('0x3c')){var _0x933b2={};_0x933b2[_0x3fdf8c['name']]={'$like':'%'+_0x536977['query']['filter']+'%'};return _0x933b2;}})});}_0x37fd1d=_[_0x4f68('0x3b')]({},_0x37fd1d,_0x536977[_0x4f68('0x3d')]);var _0x13a47e={'where':_0x37fd1d[_0x4f68('0x39')]};return db['IntegrationReport'][_0x4f68('0x1d')](_0x13a47e)[_0x4f68('0x23')](function(_0x2748e1){_0x2632c3[_0x4f68('0x1d')]=_0x2748e1;if(_0x536977[_0x4f68('0x31')]['includeAll']){_0x37fd1d[_0x4f68('0x3e')]=[{'all':!![]}];}return db[_0x4f68('0x2b')]['findAll'](_0x37fd1d);})[_0x4f68('0x23')](function(_0x1b419c){_0x2632c3[_0x4f68('0x3f')]=_0x1b419c;return _0x2632c3;})[_0x4f68('0x23')](respondWithFilteredResult(_0x749522,_0x37fd1d))[_0x4f68('0x40')](handleError(_0x749522,null));};exports['show']=function(_0x5314e4,_0x43f48d){var _0x450b7a={'raw':![],'where':{'id':_0x5314e4[_0x4f68('0x41')]['id']}},_0x4fd059={};_0x4fd059[_0x4f68('0x2f')]=_[_0x4f68('0x30')](db[_0x4f68('0x2b')][_0x4f68('0x2c')]);_0x4fd059[_0x4f68('0x31')]=_[_0x4f68('0x30')](_0x5314e4[_0x4f68('0x31')]);_0x4fd059[_0x4f68('0x32')]=_[_0x4f68('0x33')](_0x4fd059[_0x4f68('0x2f')],_0x4fd059[_0x4f68('0x31')]);_0x450b7a[_0x4f68('0x35')]=_[_0x4f68('0x33')](_0x4fd059[_0x4f68('0x2f')],qs[_0x4f68('0x34')](_0x5314e4['query'][_0x4f68('0x34')]));_0x450b7a['attributes']=_0x450b7a[_0x4f68('0x35')][_0x4f68('0x42')]?_0x450b7a[_0x4f68('0x35')]:_0x4fd059[_0x4f68('0x2f')];if(_0x5314e4['query']['includeAll']){_0x450b7a['include']=[{'all':!![]}];}_0x450b7a=_['merge']({},_0x450b7a,_0x5314e4[_0x4f68('0x3d')]);return db['IntegrationReport'][_0x4f68('0x43')](_0x450b7a)[_0x4f68('0x23')](handleEntityNotFound(_0x43f48d,null))[_0x4f68('0x23')](respondWithResult(_0x43f48d,null))['catch'](handleError(_0x43f48d,null));};exports[_0x4f68('0x44')]=function(_0x16ba58,_0x53a0a6){return db['IntegrationReport'][_0x4f68('0x44')](_0x16ba58['body'],{})[_0x4f68('0x23')](respondWithResult(_0x53a0a6,0xc9))[_0x4f68('0x40')](handleError(_0x53a0a6,null));};exports[_0x4f68('0x45')]=function(_0x9a87d2,_0x5710dc){if(_0x9a87d2[_0x4f68('0x46')]['id']){delete _0x9a87d2[_0x4f68('0x46')]['id'];}return db['IntegrationReport'][_0x4f68('0x43')]({'where':{'id':_0x9a87d2['params']['id']}})[_0x4f68('0x23')](handleEntityNotFound(_0x5710dc,null))['then'](saveUpdates(_0x9a87d2[_0x4f68('0x46')],null))[_0x4f68('0x23')](respondWithResult(_0x5710dc,null))[_0x4f68('0x40')](handleError(_0x5710dc,null));};exports[_0x4f68('0x24')]=function(_0x3dfba8,_0xf669b2){return db[_0x4f68('0x2b')][_0x4f68('0x43')]({'where':{'id':_0x3dfba8[_0x4f68('0x41')]['id']}})['then'](handleEntityNotFound(_0xf669b2,null))[_0x4f68('0x23')](removeEntity(_0xf669b2,null))['catch'](handleError(_0xf669b2,null));};exports[_0x4f68('0x47')]=function(_0x5cc10d,_0x77c81b){return db['IntegrationReport'][_0x4f68('0x47')]()[_0x4f68('0x23')](respondWithResult(_0x77c81b,null))[_0x4f68('0x40')](handleError(_0x77c81b,null));}; \ No newline at end of file +var _0xad41=['merge','type','VIRTUAL','filter','includeAll','rows','params','keys','length','include','options','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where'];(function(_0x3b101e,_0x46b405){var _0x21ba9e=function(_0x288d41){while(--_0x288d41){_0x3b101e['push'](_0x3b101e['shift']());}};_0x21ba9e(++_0x46b405);}(_0xad41,0x188));var _0x1ad4=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xad41[_0x1b64dd];return _0xeb464c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ad4('0x0'));var zipdir=require(_0x1ad4('0x1'));var jsonpatch=require(_0x1ad4('0x2'));var rp=require(_0x1ad4('0x3'));var moment=require(_0x1ad4('0x4'));var BPromise=require(_0x1ad4('0x5'));var Mustache=require('mustache');var util=require(_0x1ad4('0x6'));var path=require(_0x1ad4('0x7'));var sox=require(_0x1ad4('0x8'));var csv=require(_0x1ad4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1ad4('0xa'));var crypto=require(_0x1ad4('0xb'));var jsforce=require(_0x1ad4('0xc'));var deskjs=require(_0x1ad4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1ad4('0xe'));var Papa=require(_0x1ad4('0xf'));var Redis=require(_0x1ad4('0x10'));var authService=require(_0x1ad4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ad4('0x12'));var hardwareService=require(_0x1ad4('0x13'));var logger=require(_0x1ad4('0x14'))(_0x1ad4('0x15'));var utils=require(_0x1ad4('0x16'));var config=require(_0x1ad4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ad4('0x18'))['db'];function respondWithStatusCode(_0x219411,_0x5ca2c5){_0x5ca2c5=_0x5ca2c5||0xcc;return function(_0xc33109){if(_0xc33109){return _0x219411[_0x1ad4('0x19')](_0x5ca2c5);}return _0x219411[_0x1ad4('0x1a')](_0x5ca2c5)[_0x1ad4('0x1b')]();};}function respondWithResult(_0x1d1b93,_0x1a8077){_0x1a8077=_0x1a8077||0xc8;return function(_0x523987){if(_0x523987){return _0x1d1b93[_0x1ad4('0x1a')](_0x1a8077)['json'](_0x523987);}};}function respondWithFilteredResult(_0x4e2367,_0x5499b2){return function(_0x1be64d){if(_0x1be64d){var _0x513a1a=typeof _0x5499b2[_0x1ad4('0x1c')]===_0x1ad4('0x1d')&&typeof _0x5499b2[_0x1ad4('0x1e')]===_0x1ad4('0x1d');var _0x51b343=_0x1be64d[_0x1ad4('0x1f')];var _0x59886c=_0x513a1a?0x0:_0x5499b2[_0x1ad4('0x1c')];var _0x1a42b9=_0x513a1a?_0x1be64d['count']:_0x5499b2[_0x1ad4('0x1c')]+_0x5499b2['limit'];var _0x4f0553;if(_0x1a42b9>=_0x51b343){_0x1a42b9=_0x51b343;_0x4f0553=0xc8;}else{_0x4f0553=0xce;}_0x4e2367[_0x1ad4('0x1a')](_0x4f0553);return _0x4e2367[_0x1ad4('0x20')](_0x1ad4('0x21'),_0x59886c+'-'+_0x1a42b9+'/'+_0x51b343)['json'](_0x1be64d);}return null;};}function patchUpdates(_0x17bf8a){return function(_0x11e88a){try{jsonpatch[_0x1ad4('0x22')](_0x11e88a,_0x17bf8a,!![]);}catch(_0x22ccf3){return BPromise[_0x1ad4('0x23')](_0x22ccf3);}return _0x11e88a[_0x1ad4('0x24')]();};}function saveUpdates(_0x30b667,_0x884af4){return function(_0x4023ce){if(_0x4023ce){return _0x4023ce['update'](_0x30b667)[_0x1ad4('0x25')](function(_0x30918a){return _0x30918a;});}return null;};}function removeEntity(_0x230540,_0x1eb62d){return function(_0x24337e){if(_0x24337e){return _0x24337e[_0x1ad4('0x26')]()[_0x1ad4('0x25')](function(){_0x230540['status'](0xcc)[_0x1ad4('0x1b')]();});}};}function handleEntityNotFound(_0x540db6,_0x125d55){return function(_0x299221){if(!_0x299221){_0x540db6[_0x1ad4('0x19')](0x194);}return _0x299221;};}function handleError(_0x1b7c31,_0x585b9a){_0x585b9a=_0x585b9a||0x1f4;return function(_0x234124){logger[_0x1ad4('0x27')](_0x234124[_0x1ad4('0x28')]);if(_0x234124[_0x1ad4('0x29')]){delete _0x234124[_0x1ad4('0x29')];}_0x1b7c31[_0x1ad4('0x1a')](_0x585b9a)['send'](_0x234124);};}exports[_0x1ad4('0x2a')]=function(_0xc24c1d,_0x46dc31){var _0x5c2b17={},_0x4c2ece={},_0x337101={'count':0x0,'rows':[]};var _0x534edb=_[_0x1ad4('0x2b')](db[_0x1ad4('0x2c')][_0x1ad4('0x2d')],function(_0x5d10c8){return{'name':_0x5d10c8[_0x1ad4('0x2e')],'type':_0x5d10c8['type']['key']};});_0x4c2ece[_0x1ad4('0x2f')]=_[_0x1ad4('0x2b')](_0x534edb,_0x1ad4('0x29'));_0x4c2ece[_0x1ad4('0x30')]=_['keys'](_0xc24c1d[_0x1ad4('0x30')]);_0x4c2ece[_0x1ad4('0x31')]=_[_0x1ad4('0x32')](_0x4c2ece[_0x1ad4('0x2f')],_0x4c2ece['query']);_0x5c2b17[_0x1ad4('0x33')]=_[_0x1ad4('0x32')](_0x4c2ece['model'],qs[_0x1ad4('0x34')](_0xc24c1d[_0x1ad4('0x30')]['fields']));_0x5c2b17[_0x1ad4('0x33')]=_0x5c2b17[_0x1ad4('0x33')]['length']?_0x5c2b17[_0x1ad4('0x33')]:_0x4c2ece[_0x1ad4('0x2f')];if(!_0xc24c1d[_0x1ad4('0x30')]['hasOwnProperty'](_0x1ad4('0x35'))){_0x5c2b17[_0x1ad4('0x1e')]=qs[_0x1ad4('0x1e')](_0xc24c1d[_0x1ad4('0x30')]['limit']);_0x5c2b17[_0x1ad4('0x1c')]=qs['offset'](_0xc24c1d[_0x1ad4('0x30')][_0x1ad4('0x1c')]);}_0x5c2b17[_0x1ad4('0x36')]=qs[_0x1ad4('0x37')](_0xc24c1d[_0x1ad4('0x30')][_0x1ad4('0x37')]);_0x5c2b17['where']=qs[_0x1ad4('0x31')](_[_0x1ad4('0x38')](_0xc24c1d['query'],_0x4c2ece[_0x1ad4('0x31')]),_0x534edb);if(_0xc24c1d[_0x1ad4('0x30')]['filter']){_0x5c2b17[_0x1ad4('0x39')]=_[_0x1ad4('0x3a')](_0x5c2b17[_0x1ad4('0x39')],{'$or':_[_0x1ad4('0x2b')](_0x534edb,function(_0x83f08d){if(_0x83f08d[_0x1ad4('0x3b')]!==_0x1ad4('0x3c')){var _0x1b2af2={};_0x1b2af2[_0x83f08d['name']]={'$like':'%'+_0xc24c1d[_0x1ad4('0x30')][_0x1ad4('0x3d')]+'%'};return _0x1b2af2;}})});}_0x5c2b17=_[_0x1ad4('0x3a')]({},_0x5c2b17,_0xc24c1d['options']);var _0x12f88d={'where':_0x5c2b17['where']};return db[_0x1ad4('0x2c')][_0x1ad4('0x1f')](_0x12f88d)[_0x1ad4('0x25')](function(_0x41f764){_0x337101[_0x1ad4('0x1f')]=_0x41f764;if(_0xc24c1d[_0x1ad4('0x30')][_0x1ad4('0x3e')]){_0x5c2b17['include']=[{'all':!![]}];}return db[_0x1ad4('0x2c')]['findAll'](_0x5c2b17);})[_0x1ad4('0x25')](function(_0x55a771){_0x337101[_0x1ad4('0x3f')]=_0x55a771;return _0x337101;})[_0x1ad4('0x25')](respondWithFilteredResult(_0x46dc31,_0x5c2b17))['catch'](handleError(_0x46dc31,null));};exports['show']=function(_0x330108,_0x176376){var _0x49c3df={'raw':![],'where':{'id':_0x330108[_0x1ad4('0x40')]['id']}},_0x442a99={};_0x442a99[_0x1ad4('0x2f')]=_[_0x1ad4('0x41')](db[_0x1ad4('0x2c')][_0x1ad4('0x2d')]);_0x442a99[_0x1ad4('0x30')]=_[_0x1ad4('0x41')](_0x330108[_0x1ad4('0x30')]);_0x442a99[_0x1ad4('0x31')]=_[_0x1ad4('0x32')](_0x442a99['model'],_0x442a99[_0x1ad4('0x30')]);_0x49c3df['attributes']=_[_0x1ad4('0x32')](_0x442a99['model'],qs[_0x1ad4('0x34')](_0x330108[_0x1ad4('0x30')][_0x1ad4('0x34')]));_0x49c3df[_0x1ad4('0x33')]=_0x49c3df[_0x1ad4('0x33')][_0x1ad4('0x42')]?_0x49c3df[_0x1ad4('0x33')]:_0x442a99['model'];if(_0x330108[_0x1ad4('0x30')][_0x1ad4('0x3e')]){_0x49c3df[_0x1ad4('0x43')]=[{'all':!![]}];}_0x49c3df=_[_0x1ad4('0x3a')]({},_0x49c3df,_0x330108[_0x1ad4('0x44')]);return db['IntegrationReport'][_0x1ad4('0x45')](_0x49c3df)[_0x1ad4('0x25')](handleEntityNotFound(_0x176376,null))[_0x1ad4('0x25')](respondWithResult(_0x176376,null))[_0x1ad4('0x46')](handleError(_0x176376,null));};exports[_0x1ad4('0x47')]=function(_0x112a82,_0x599a85){return db[_0x1ad4('0x2c')][_0x1ad4('0x47')](_0x112a82[_0x1ad4('0x48')],{})[_0x1ad4('0x25')](respondWithResult(_0x599a85,0xc9))[_0x1ad4('0x46')](handleError(_0x599a85,null));};exports[_0x1ad4('0x49')]=function(_0x59ed3a,_0x341d73){if(_0x59ed3a['body']['id']){delete _0x59ed3a[_0x1ad4('0x48')]['id'];}return db[_0x1ad4('0x2c')][_0x1ad4('0x45')]({'where':{'id':_0x59ed3a[_0x1ad4('0x40')]['id']}})['then'](handleEntityNotFound(_0x341d73,null))[_0x1ad4('0x25')](saveUpdates(_0x59ed3a['body'],null))[_0x1ad4('0x25')](respondWithResult(_0x341d73,null))['catch'](handleError(_0x341d73,null));};exports[_0x1ad4('0x26')]=function(_0xe5423,_0x477821){return db[_0x1ad4('0x2c')][_0x1ad4('0x45')]({'where':{'id':_0xe5423[_0x1ad4('0x40')]['id']}})[_0x1ad4('0x25')](handleEntityNotFound(_0x477821,null))['then'](removeEntity(_0x477821,null))[_0x1ad4('0x46')](handleError(_0x477821,null));};exports[_0x1ad4('0x4a')]=function(_0x32a22b,_0x468725){return db['IntegrationReport'][_0x1ad4('0x4a')]()['then'](respondWithResult(_0x468725,null))[_0x1ad4('0x46')](handleError(_0x468725,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 12a75ea..7e3e5e7 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 _0xf0b2=['bluebird','request-promise','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0xf0b2,0xd8));var _0x2f0b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf0b2[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x2f0b('0x0'));var util=require(_0x2f0b('0x1'));var logger=require(_0x2f0b('0x2'))(_0x2f0b('0x3'));var moment=require(_0x2f0b('0x4'));var BPromise=require(_0x2f0b('0x5'));var rp=require(_0x2f0b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f0b('0x7'));var attributes=require(_0x2f0b('0x8'));module[_0x2f0b('0x9')]=function(_0x108dd2,_0x5cb859){return _0x108dd2[_0x2f0b('0xa')](_0x2f0b('0xb'),attributes,{'tableName':_0x2f0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0912=['exports','define','report_integration','util','moment','bluebird','path','rimraf','./integrationReport.attributes'];(function(_0x1ba1bd,_0x24c5de){var _0x50d617=function(_0x4b4872){while(--_0x4b4872){_0x1ba1bd['push'](_0x1ba1bd['shift']());}};_0x50d617(++_0x24c5de);}(_0x0912,0xc0));var _0x2091=function(_0x41ee08,_0x7ecf4a){_0x41ee08=_0x41ee08-0x0;var _0x5f3863=_0x0912[_0x41ee08];return _0x5f3863;};'use strict';var _=require('lodash');var util=require(_0x2091('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2091('0x1'));var BPromise=require(_0x2091('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2091('0x3'));var rimraf=require(_0x2091('0x4'));var config=require('../../config/environment');var attributes=require(_0x2091('0x5'));module[_0x2091('0x6')]=function(_0x30c097,_0x45d038){return _0x30c097[_0x2091('0x7')]('IntegrationReport',attributes,{'tableName':_0x2091('0x8'),'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 e97d775..815fb7e 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1967,0x173));var _0x7196=function(_0x558dbd,_0x38f533){_0x558dbd=_0x558dbd-0x0;var _0x10eb8f=_0x1967[_0x558dbd];return _0x10eb8f;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1b4779,_0x590c11){var _0x4ed57b=function(_0x3602c7){while(--_0x3602c7){_0x1b4779['push'](_0x1b4779['shift']());}};_0x4ed57b(++_0x590c11);}(_0x1261,0x144));var _0x1126=function(_0x41d2d4,_0x12bcf4){_0x41d2d4=_0x41d2d4-0x0;var _0x225e0f=_0x1261[_0x41d2d4];return _0x225e0f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1344d15..35d78ba 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 _0xcdb1=['get','isAuthenticated','index','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fc7e5,_0x108fac){var _0x1bcd9e=function(_0x40cc0e){while(--_0x40cc0e){_0x4fc7e5['push'](_0x4fc7e5['shift']());}};_0x1bcd9e(++_0x108fac);}(_0xcdb1,0x1eb));var _0x1cdb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdb1[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x1cdb('0x0'));var path=require(_0x1cdb('0x1'));var timeout=require(_0x1cdb('0x2'));var express=require(_0x1cdb('0x3'));var router=express[_0x1cdb('0x4')]();var fs_extra=require(_0x1cdb('0x5'));var auth=require(_0x1cdb('0x6'));var interaction=require(_0x1cdb('0x7'));var config=require(_0x1cdb('0x8'));var controller=require('./interval.controller');router[_0x1cdb('0x9')]('/',auth[_0x1cdb('0xa')](),controller[_0x1cdb('0xb')]);router[_0x1cdb('0x9')]('/:id',auth[_0x1cdb('0xa')](),controller[_0x1cdb('0xc')]);router[_0x1cdb('0x9')](_0x1cdb('0xd'),auth[_0x1cdb('0xa')](),controller['getIntervals']);router[_0x1cdb('0xe')]('/',auth[_0x1cdb('0xa')](),controller[_0x1cdb('0xf')]);router[_0x1cdb('0xe')](_0x1cdb('0xd'),auth['isAuthenticated'](),controller[_0x1cdb('0x10')]);router[_0x1cdb('0xe')](_0x1cdb('0x11'),auth[_0x1cdb('0xa')](),controller[_0x1cdb('0x12')]);router[_0x1cdb('0x13')](_0x1cdb('0x14'),auth['isAuthenticated'](),controller[_0x1cdb('0x15')]);router[_0x1cdb('0x16')](_0x1cdb('0x14'),auth[_0x1cdb('0xa')](),controller[_0x1cdb('0x17')]);module[_0x1cdb('0x18')]=router; \ No newline at end of file +var _0x4af9=['post','create','/:id/sub_intervals/create_many','addIntervals','put','update','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4af9,0x12c));var _0x94af=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4af9[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94af('0x2'));var router=express[_0x94af('0x3')]();var fs_extra=require(_0x94af('0x4'));var auth=require(_0x94af('0x5'));var interaction=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var controller=require(_0x94af('0x8'));router['get']('/',auth[_0x94af('0x9')](),controller[_0x94af('0xa')]);router[_0x94af('0xb')](_0x94af('0xc'),auth['isAuthenticated'](),controller[_0x94af('0xd')]);router[_0x94af('0xb')](_0x94af('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0x94af('0xf')]('/',auth[_0x94af('0x9')](),controller[_0x94af('0x10')]);router[_0x94af('0xf')](_0x94af('0xe'),auth[_0x94af('0x9')](),controller['addInterval']);router[_0x94af('0xf')](_0x94af('0x11'),auth['isAuthenticated'](),controller[_0x94af('0x12')]);router[_0x94af('0x13')](_0x94af('0xc'),auth[_0x94af('0x9')](),controller[_0x94af('0x14')]);router['delete'](_0x94af('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 152e170..1691c3c 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 _0xb7be=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb7be,0x12e));var _0xeb7b=function(_0x49f03f,_0x280f41){_0x49f03f=_0x49f03f-0x0;var _0x2794c4=_0xb7be[_0x49f03f];return _0x2794c4;};'use strict';var Sequelize=require(_0xeb7b('0x0'));module[_0xeb7b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb7b('0x2')]},'interval':{'type':Sequelize[_0xeb7b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2944=['STRING','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2944,0xb2));var _0x4294=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2944[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x4294('0x0'));module[_0x4294('0x1')]={'name':{'type':Sequelize[_0x4294('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4294('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 397697d..650854c 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 _0xeeee=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filters','filter','VIRTUAL','Interval','includeAll','include','findAll','catch','show','params','intersection','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','order','getIntervals','nolimit','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset'];(function(_0x192e27,_0x5119c3){var _0x50e1bf=function(_0x8e7c7e){while(--_0x8e7c7e){_0x192e27['push'](_0x192e27['shift']());}};_0x50e1bf(++_0x5119c3);}(_0xeeee,0x143));var _0xeeee=function(_0x2aa2a4,_0x54b77a){_0x2aa2a4=_0x2aa2a4-0x0;var _0x15d40f=_0xeeee[_0x2aa2a4];return _0x15d40f;};'use strict';var emlformat=require(_0xeeee('0x0'));var rimraf=require(_0xeeee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeeee('0x2'));var rp=require(_0xeeee('0x3'));var moment=require(_0xeeee('0x4'));var BPromise=require(_0xeeee('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeeee('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeeee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeeee('0x8'));var squel=require(_0xeeee('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeeee('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeeee('0xb'));var Papa=require(_0xeeee('0xc'));var Redis=require(_0xeeee('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeeee('0xe'));var hardwareService=require(_0xeeee('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xeeee('0x10'));var licenseUtil=require(_0xeeee('0x11'));var db=require(_0xeeee('0x12'))['db'];var extensions=require(_0xeeee('0x13'));function respondWithStatusCode(_0x21a5e4,_0x2811c9){_0x2811c9=_0x2811c9||0xcc;return function(_0x4fce6a){if(_0x4fce6a){return _0x21a5e4[_0xeeee('0x14')](_0x2811c9);}return _0x21a5e4['status'](_0x2811c9)[_0xeeee('0x15')]();};}function respondWithResult(_0x16d1ca,_0x4a5932){_0x4a5932=_0x4a5932||0xc8;return function(_0x3ba384){if(_0x3ba384){return _0x16d1ca[_0xeeee('0x16')](_0x4a5932)[_0xeeee('0x17')](_0x3ba384);}};}function respondWithFilteredResult(_0x53b8aa,_0x1c21d3){return function(_0x4d45d6){if(_0x4d45d6){var _0x53665e=typeof _0x1c21d3[_0xeeee('0x18')]==='undefined'&&typeof _0x1c21d3['limit']===_0xeeee('0x19');var _0x1dbb39=_0x4d45d6[_0xeeee('0x1a')];var _0x3849bf=_0x53665e?0x0:_0x1c21d3[_0xeeee('0x18')];var _0x241178=_0x53665e?_0x4d45d6['count']:_0x1c21d3[_0xeeee('0x18')]+_0x1c21d3['limit'];var _0x46fc3a;if(_0x241178>=_0x1dbb39){_0x241178=_0x1dbb39;_0x46fc3a=0xc8;}else{_0x46fc3a=0xce;}_0x53b8aa[_0xeeee('0x16')](_0x46fc3a);return _0x53b8aa[_0xeeee('0x1b')](_0xeeee('0x1c'),_0x3849bf+'-'+_0x241178+'/'+_0x1dbb39)['json'](_0x4d45d6);}return null;};}function patchUpdates(_0xab05ac){return function(_0x583ee8){try{jsonpatch[_0xeeee('0x1d')](_0x583ee8,_0xab05ac,!![]);}catch(_0x4aa62b){return BPromise[_0xeeee('0x1e')](_0x4aa62b);}return _0x583ee8[_0xeeee('0x1f')]();};}function saveUpdates(_0x97ee5e,_0x5e7baf){return function(_0x49f8aa){if(_0x49f8aa){return _0x49f8aa[_0xeeee('0x20')](_0x97ee5e)[_0xeeee('0x21')](function(_0x73c948){return _0x73c948;});}return null;};}function removeEntity(_0x144d2d,_0x28c237){return function(_0x455a79){if(_0x455a79){return _0x455a79[_0xeeee('0x22')]()[_0xeeee('0x21')](function(){var _0x10e009=_0x455a79[_0xeeee('0x23')]({'plain':!![]});var _0x38e385=_0xeeee('0x24');return db[_0xeeee('0x25')][_0xeeee('0x22')]({'where':{'type':_0x38e385,'resourceId':_0x10e009['id']}})[_0xeeee('0x21')](function(){return _0x455a79;});})['then'](function(){_0x144d2d[_0xeeee('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff564,_0x20b15e){return function(_0x330c85){if(!_0x330c85){_0x1ff564[_0xeeee('0x14')](0x194);}return _0x330c85;};}function handleError(_0x407b23,_0x3dfb10){_0x3dfb10=_0x3dfb10||0x1f4;return function(_0x50b91b){logger[_0xeeee('0x26')](_0x50b91b[_0xeeee('0x27')]);if(_0x50b91b[_0xeeee('0x28')]){delete _0x50b91b['name'];}_0x407b23[_0xeeee('0x16')](_0x3dfb10)['send'](_0x50b91b);};}exports['index']=function(_0x59ebb9,_0x42f24c){var _0x2a40c2={},_0x4024da={},_0x5642dc={'count':0x0,'rows':[]};var _0x561f23=_[_0xeeee('0x29')](db['Interval'][_0xeeee('0x2a')],function(_0x114ae6){return{'name':_0x114ae6[_0xeeee('0x2b')],'type':_0x114ae6[_0xeeee('0x2c')][_0xeeee('0x2d')]};});_0x4024da['model']=_['map'](_0x561f23,_0xeeee('0x28'));_0x4024da[_0xeeee('0x2e')]=_[_0xeeee('0x2f')](_0x59ebb9[_0xeeee('0x2e')]);_0x4024da['filters']=_['intersection'](_0x4024da[_0xeeee('0x30')],_0x4024da[_0xeeee('0x2e')]);_0x2a40c2['attributes']=_['intersection'](_0x4024da['model'],qs[_0xeeee('0x31')](_0x59ebb9['query']['fields']));_0x2a40c2[_0xeeee('0x32')]=_0x2a40c2[_0xeeee('0x32')][_0xeeee('0x33')]?_0x2a40c2[_0xeeee('0x32')]:_0x4024da['model'];if(!_0x59ebb9[_0xeeee('0x2e')][_0xeeee('0x34')]('nolimit')){_0x2a40c2[_0xeeee('0x35')]=qs[_0xeeee('0x35')](_0x59ebb9[_0xeeee('0x2e')]['limit']);_0x2a40c2[_0xeeee('0x18')]=qs[_0xeeee('0x18')](_0x59ebb9[_0xeeee('0x2e')][_0xeeee('0x18')]);}_0x2a40c2['order']=qs[_0xeeee('0x36')](_0x59ebb9['query'][_0xeeee('0x36')]);_0x2a40c2[_0xeeee('0x37')]=qs['filters'](_[_0xeeee('0x38')](_0x59ebb9[_0xeeee('0x2e')],_0x4024da[_0xeeee('0x39')]),_0x561f23);if(_0x59ebb9[_0xeeee('0x2e')][_0xeeee('0x3a')]){_0x2a40c2[_0xeeee('0x37')]=_['merge'](_0x2a40c2[_0xeeee('0x37')],{'$or':_[_0xeeee('0x29')](_0x561f23,function(_0x41abe5){if(_0x41abe5[_0xeeee('0x2c')]!==_0xeeee('0x3b')){var _0x116af6={};_0x116af6[_0x41abe5[_0xeeee('0x28')]]={'$like':'%'+_0x59ebb9[_0xeeee('0x2e')][_0xeeee('0x3a')]+'%'};return _0x116af6;}})});}_0x2a40c2=_['merge']({},_0x2a40c2,_0x59ebb9['options']);var _0x3c4888={'where':_0x2a40c2['where']};return db[_0xeeee('0x3c')]['count'](_0x3c4888)[_0xeeee('0x21')](function(_0x2b768d){_0x5642dc[_0xeeee('0x1a')]=_0x2b768d;if(_0x59ebb9[_0xeeee('0x2e')][_0xeeee('0x3d')]){_0x2a40c2[_0xeeee('0x3e')]=[{'all':!![]}];}return db['Interval'][_0xeeee('0x3f')](_0x2a40c2);})[_0xeeee('0x21')](function(_0x1c7eef){_0x5642dc['rows']=_0x1c7eef;return _0x5642dc;})[_0xeeee('0x21')](respondWithFilteredResult(_0x42f24c,_0x2a40c2))[_0xeeee('0x40')](handleError(_0x42f24c,null));};exports[_0xeeee('0x41')]=function(_0x56d0e9,_0x4ffede){var _0x48ceff={'raw':!![],'where':{'id':_0x56d0e9[_0xeeee('0x42')]['id']}},_0x3de4c6={};_0x3de4c6[_0xeeee('0x30')]=_[_0xeeee('0x2f')](db[_0xeeee('0x3c')]['rawAttributes']);_0x3de4c6['query']=_[_0xeeee('0x2f')](_0x56d0e9['query']);_0x3de4c6[_0xeeee('0x39')]=_[_0xeeee('0x43')](_0x3de4c6[_0xeeee('0x30')],_0x3de4c6[_0xeeee('0x2e')]);_0x48ceff[_0xeeee('0x32')]=_[_0xeeee('0x43')](_0x3de4c6[_0xeeee('0x30')],qs[_0xeeee('0x31')](_0x56d0e9['query'][_0xeeee('0x31')]));_0x48ceff[_0xeeee('0x32')]=_0x48ceff['attributes'][_0xeeee('0x33')]?_0x48ceff[_0xeeee('0x32')]:_0x3de4c6[_0xeeee('0x30')];if(_0x56d0e9[_0xeeee('0x2e')][_0xeeee('0x3d')]){_0x48ceff[_0xeeee('0x3e')]=[{'all':!![]}];}_0x48ceff=_[_0xeeee('0x44')]({},_0x48ceff,_0x56d0e9[_0xeeee('0x45')]);return db[_0xeeee('0x3c')][_0xeeee('0x46')](_0x48ceff)[_0xeeee('0x21')](handleEntityNotFound(_0x4ffede,null))[_0xeeee('0x21')](respondWithResult(_0x4ffede,null))['catch'](handleError(_0x4ffede,null));};exports[_0xeeee('0x47')]=function(_0x4f46e6,_0x1f475e){return db[_0xeeee('0x3c')][_0xeeee('0x47')](_0x4f46e6[_0xeeee('0x48')],{})[_0xeeee('0x21')](function(_0x2347f0){var _0x2aa5a7=_0x4f46e6[_0xeeee('0x49')]['get']({'plain':!![]});if(!_0x2aa5a7)throw new Error(_0xeeee('0x4a'));if(_0x2aa5a7['role']===_0xeeee('0x49')){var _0x1700c0=_0x2347f0[_0xeeee('0x23')]({'plain':!![]});var _0x4e622f=_0xeeee('0x24');return db[_0xeeee('0x4b')]['find']({'where':{'name':_0x4e622f,'userProfileId':_0x2aa5a7[_0xeeee('0x4c')]},'raw':!![]})[_0xeeee('0x21')](function(_0x15fd00){if(_0x15fd00&&_0x15fd00[_0xeeee('0x4d')]===0x0){return db[_0xeeee('0x25')]['create']({'name':_0x1700c0[_0xeeee('0x28')],'resourceId':_0x1700c0['id'],'type':_0x15fd00[_0xeeee('0x28')],'sectionId':_0x15fd00['id']},{})[_0xeeee('0x21')](function(){return _0x2347f0;});}else{return _0x2347f0;}})[_0xeeee('0x40')](function(_0x28f7d8){logger[_0xeeee('0x26')](_0xeeee('0x4e'),_0x28f7d8);throw _0x28f7d8;});}return _0x2347f0;})[_0xeeee('0x21')](respondWithResult(_0x1f475e,0xc9))[_0xeeee('0x40')](handleError(_0x1f475e,null));};exports[_0xeeee('0x20')]=function(_0x3b7218,_0x222e96){if(_0x3b7218[_0xeeee('0x48')]['id']){delete _0x3b7218[_0xeeee('0x48')]['id'];}return db['Interval']['find']({'where':{'id':_0x3b7218[_0xeeee('0x42')]['id']}})[_0xeeee('0x21')](handleEntityNotFound(_0x222e96,null))[_0xeeee('0x21')](saveUpdates(_0x3b7218[_0xeeee('0x48')],null))[_0xeeee('0x21')](respondWithResult(_0x222e96,null))[_0xeeee('0x40')](handleError(_0x222e96,null));};exports['destroy']=function(_0x4918e8,_0x1af8de){return db[_0xeeee('0x3c')][_0xeeee('0x46')]({'where':{'id':_0x4918e8[_0xeeee('0x42')]['id']}})['then'](handleEntityNotFound(_0x1af8de,null))['then'](removeEntity(_0x1af8de,null))[_0xeeee('0x40')](handleError(_0x1af8de,null));};exports[_0xeeee('0x4f')]=function(_0x1bc06,_0x41149a,_0x5415f0){if(_0x1bc06[_0xeeee('0x48')]['id']){delete _0x1bc06[_0xeeee('0x48')]['id'];}return db['Interval'][_0xeeee('0x46')]({'where':{'id':_0x1bc06[_0xeeee('0x42')]['id']}})[_0xeeee('0x21')](handleEntityNotFound(_0x41149a,null))[_0xeeee('0x21')](function(_0x44d69f){if(_0x44d69f){_0x1bc06[_0xeeee('0x48')][_0xeeee('0x50')]=_0x44d69f['id'];return db[_0xeeee('0x3c')]['create'](_0x1bc06[_0xeeee('0x48')]);}})['then'](respondWithResult(_0x41149a,null))['catch'](handleError(_0x41149a,null));};exports['getIntervals']=function(_0x3df7ab,_0x535eee,_0x1d3ec0){var _0x139587={};var _0x2c4cbf={};var _0x4c23a3;var _0x129f77;return db[_0xeeee('0x3c')][_0xeeee('0x51')]({'where':{'id':_0x3df7ab[_0xeeee('0x42')]['id']}})[_0xeeee('0x21')](handleEntityNotFound(_0x535eee,null))[_0xeeee('0x21')](function(_0x2cbeaa){if(_0x2cbeaa){_0x4c23a3=_0x2cbeaa;_0x2c4cbf[_0xeeee('0x30')]=_[_0xeeee('0x2f')](db['Interval'][_0xeeee('0x2a')]);_0x2c4cbf['query']=_[_0xeeee('0x2f')](_0x3df7ab[_0xeeee('0x2e')]);_0x2c4cbf['filters']=_[_0xeeee('0x43')](_0x2c4cbf['model'],_0x2c4cbf[_0xeeee('0x2e')]);_0x139587[_0xeeee('0x32')]=_[_0xeeee('0x43')](_0x2c4cbf[_0xeeee('0x30')],qs[_0xeeee('0x31')](_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x31')]));_0x139587[_0xeeee('0x32')]=_0x139587[_0xeeee('0x32')][_0xeeee('0x33')]?_0x139587[_0xeeee('0x32')]:_0x2c4cbf[_0xeeee('0x30')];_0x139587[_0xeeee('0x52')]=qs['sort'](_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x36')]);_0x139587[_0xeeee('0x37')]=qs[_0xeeee('0x39')](_[_0xeeee('0x38')](_0x3df7ab[_0xeeee('0x2e')],_0x2c4cbf[_0xeeee('0x39')]));if(_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x3a')]){_0x139587[_0xeeee('0x37')]=_[_0xeeee('0x44')](_0x139587[_0xeeee('0x37')],{'$or':_[_0xeeee('0x29')](_0x139587[_0xeeee('0x32')],function(_0x2dd431){var _0x2785fa={};_0x2785fa[_0x2dd431]={'$like':'%'+_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x3a')]+'%'};return _0x2785fa;})});}_0x139587=_[_0xeeee('0x44')]({},_0x139587,_0x3df7ab[_0xeeee('0x45')]);return _0x4c23a3[_0xeeee('0x53')](_0x139587);}})[_0xeeee('0x21')](function(_0x5057af){if(_0x5057af){_0x129f77=_0x5057af[_0xeeee('0x33')];if(!_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x34')](_0xeeee('0x54'))){_0x139587[_0xeeee('0x35')]=qs[_0xeeee('0x35')](_0x3df7ab['query'][_0xeeee('0x35')]);_0x139587[_0xeeee('0x18')]=qs[_0xeeee('0x18')](_0x3df7ab[_0xeeee('0x2e')][_0xeeee('0x18')]);}return _0x4c23a3[_0xeeee('0x53')](_0x139587);}})['then'](function(_0x2d8bc1){if(_0x2d8bc1){return _0x2d8bc1?{'count':_0x129f77,'rows':_0x2d8bc1}:null;}})[_0xeeee('0x21')](respondWithResult(_0x535eee,null))[_0xeeee('0x40')](handleError(_0x535eee,null));};exports['addIntervals']=function(_0x116535,_0x1fb242,_0x4fd955){return db[_0xeeee('0x3c')][_0xeeee('0x51')]({'where':{'id':_0x116535[_0xeeee('0x42')]['id']}})[_0xeeee('0x21')](handleEntityNotFound(_0x1fb242,null))['then'](function(_0xd63d79){if(_0xd63d79){return db[_0xeeee('0x55')][_0xeeee('0x56')](function(_0x5036c3){return db[_0xeeee('0x3c')][_0xeeee('0x22')]({'where':{'IntervalId':_0x116535['params']['id']},'transaction':_0x5036c3})[_0xeeee('0x21')](function(_0x4f174a){var _0x449bc0=_[_0xeeee('0x29')](_0x116535[_0xeeee('0x48')],function(_0x339990){delete _0x339990['id'];_0x339990[_0xeeee('0x50')]=_0x116535[_0xeeee('0x42')]['id'];return _0x339990;});return db[_0xeeee('0x3c')]['bulkCreate'](_0x449bc0,{'transaction':_0x5036c3});});})[_0xeeee('0x21')](function(){return db[_0xeeee('0x3c')][_0xeeee('0x3f')]({'where':{'IntervalId':_0x116535[_0xeeee('0x42')]['id']}});});}})['then'](respondWithResult(_0x1fb242,null))[_0xeeee('0x40')](handleError(_0x1fb242,null));}; \ No newline at end of file +var _0xf613=['to-csv','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','json','limit','count','offset','status','set','apply','save','update','destroy','then','get','Intervals','sendStatus','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addInterval','IntervalId','getIntervals','findOne','order','sequelize','transaction','findAll','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x92217,_0x46c644){var _0x401a14=function(_0x552d12){while(--_0x552d12){_0x92217['push'](_0x92217['shift']());}};_0x401a14(++_0x46c644);}(_0xf613,0x141));var _0x3f61=function(_0x483a68,_0x2acc85){_0x483a68=_0x483a68-0x0;var _0x5d8176=_0xf613[_0x483a68];return _0x5d8176;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f61('0x0'));var moment=require(_0x3f61('0x1'));var BPromise=require(_0x3f61('0x2'));var Mustache=require(_0x3f61('0x3'));var util=require(_0x3f61('0x4'));var path=require(_0x3f61('0x5'));var sox=require(_0x3f61('0x6'));var csv=require(_0x3f61('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f61('0x8'));var _=require(_0x3f61('0x9'));var squel=require(_0x3f61('0xa'));var crypto=require('crypto');var jsforce=require(_0x3f61('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f61('0xc'));var authService=require(_0x3f61('0xd'));var qs=require(_0x3f61('0xe'));var as=require(_0x3f61('0xf'));var hardwareService=require(_0x3f61('0x10'));var logger=require(_0x3f61('0x11'))('api');var utils=require(_0x3f61('0x12'));var config=require(_0x3f61('0x13'));var licenseUtil=require(_0x3f61('0x14'));var db=require(_0x3f61('0x15'))['db'];var extensions=require(_0x3f61('0x16'));function respondWithStatusCode(_0x46175c,_0x45080e){_0x45080e=_0x45080e||0xcc;return function(_0x2156f3){if(_0x2156f3){return _0x46175c['sendStatus'](_0x45080e);}return _0x46175c['status'](_0x45080e)['end']();};}function respondWithResult(_0x4bd27b,_0x18fdfa){_0x18fdfa=_0x18fdfa||0xc8;return function(_0x452edf){if(_0x452edf){return _0x4bd27b['status'](_0x18fdfa)[_0x3f61('0x17')](_0x452edf);}};}function respondWithFilteredResult(_0x321d9a,_0xbb016){return function(_0x2c254c){if(_0x2c254c){var _0x3c7d95=typeof _0xbb016['offset']==='undefined'&&typeof _0xbb016[_0x3f61('0x18')]==='undefined';var _0xf244ce=_0x2c254c[_0x3f61('0x19')];var _0x59a2cd=_0x3c7d95?0x0:_0xbb016['offset'];var _0x24fc58=_0x3c7d95?_0x2c254c[_0x3f61('0x19')]:_0xbb016[_0x3f61('0x1a')]+_0xbb016['limit'];var _0x14e8d1;if(_0x24fc58>=_0xf244ce){_0x24fc58=_0xf244ce;_0x14e8d1=0xc8;}else{_0x14e8d1=0xce;}_0x321d9a[_0x3f61('0x1b')](_0x14e8d1);return _0x321d9a[_0x3f61('0x1c')]('Content-Range',_0x59a2cd+'-'+_0x24fc58+'/'+_0xf244ce)[_0x3f61('0x17')](_0x2c254c);}return null;};}function patchUpdates(_0x2f8388){return function(_0x6efa7d){try{jsonpatch[_0x3f61('0x1d')](_0x6efa7d,_0x2f8388,!![]);}catch(_0x446f64){return BPromise['reject'](_0x446f64);}return _0x6efa7d[_0x3f61('0x1e')]();};}function saveUpdates(_0x568882,_0x193db1){return function(_0x3cae86){if(_0x3cae86){return _0x3cae86[_0x3f61('0x1f')](_0x568882)['then'](function(_0x4d040c){return _0x4d040c;});}return null;};}function removeEntity(_0x578a87,_0xe91df5){return function(_0x2beba5){if(_0x2beba5){return _0x2beba5[_0x3f61('0x20')]()[_0x3f61('0x21')](function(){var _0x52f379=_0x2beba5[_0x3f61('0x22')]({'plain':!![]});var _0x2f1b2e=_0x3f61('0x23');return db['UserProfileResource'][_0x3f61('0x20')]({'where':{'type':_0x2f1b2e,'resourceId':_0x52f379['id']}})[_0x3f61('0x21')](function(){return _0x2beba5;});})['then'](function(){_0x578a87[_0x3f61('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398ba0,_0x106b27){return function(_0x508346){if(!_0x508346){_0x398ba0[_0x3f61('0x24')](0x194);}return _0x508346;};}function handleError(_0x29d64a,_0x1f88d1){_0x1f88d1=_0x1f88d1||0x1f4;return function(_0x1f9da0){logger[_0x3f61('0x25')](_0x1f9da0['stack']);if(_0x1f9da0[_0x3f61('0x26')]){delete _0x1f9da0[_0x3f61('0x26')];}_0x29d64a[_0x3f61('0x1b')](_0x1f88d1)[_0x3f61('0x27')](_0x1f9da0);};}exports[_0x3f61('0x28')]=function(_0x2e2d70,_0x37b8e3){var _0x2a5ca3={},_0x2f772a={},_0x56de73={'count':0x0,'rows':[]};var _0x164c71=_[_0x3f61('0x29')](db[_0x3f61('0x2a')][_0x3f61('0x2b')],function(_0x5ca9b2){return{'name':_0x5ca9b2[_0x3f61('0x2c')],'type':_0x5ca9b2[_0x3f61('0x2d')][_0x3f61('0x2e')]};});_0x2f772a[_0x3f61('0x2f')]=_['map'](_0x164c71,_0x3f61('0x26'));_0x2f772a[_0x3f61('0x30')]=_[_0x3f61('0x31')](_0x2e2d70[_0x3f61('0x30')]);_0x2f772a[_0x3f61('0x32')]=_[_0x3f61('0x33')](_0x2f772a[_0x3f61('0x2f')],_0x2f772a[_0x3f61('0x30')]);_0x2a5ca3['attributes']=_[_0x3f61('0x33')](_0x2f772a[_0x3f61('0x2f')],qs[_0x3f61('0x34')](_0x2e2d70[_0x3f61('0x30')][_0x3f61('0x34')]));_0x2a5ca3[_0x3f61('0x35')]=_0x2a5ca3[_0x3f61('0x35')][_0x3f61('0x36')]?_0x2a5ca3[_0x3f61('0x35')]:_0x2f772a[_0x3f61('0x2f')];if(!_0x2e2d70['query']['hasOwnProperty'](_0x3f61('0x37'))){_0x2a5ca3[_0x3f61('0x18')]=qs[_0x3f61('0x18')](_0x2e2d70[_0x3f61('0x30')]['limit']);_0x2a5ca3[_0x3f61('0x1a')]=qs[_0x3f61('0x1a')](_0x2e2d70['query'][_0x3f61('0x1a')]);}_0x2a5ca3['order']=qs[_0x3f61('0x38')](_0x2e2d70[_0x3f61('0x30')]['sort']);_0x2a5ca3[_0x3f61('0x39')]=qs[_0x3f61('0x32')](_[_0x3f61('0x3a')](_0x2e2d70[_0x3f61('0x30')],_0x2f772a[_0x3f61('0x32')]),_0x164c71);if(_0x2e2d70[_0x3f61('0x30')][_0x3f61('0x3b')]){_0x2a5ca3[_0x3f61('0x39')]=_[_0x3f61('0x3c')](_0x2a5ca3[_0x3f61('0x39')],{'$or':_[_0x3f61('0x29')](_0x164c71,function(_0x26b8f9){if(_0x26b8f9[_0x3f61('0x2d')]!=='VIRTUAL'){var _0x4bec92={};_0x4bec92[_0x26b8f9[_0x3f61('0x26')]]={'$like':'%'+_0x2e2d70[_0x3f61('0x30')]['filter']+'%'};return _0x4bec92;}})});}_0x2a5ca3=_[_0x3f61('0x3c')]({},_0x2a5ca3,_0x2e2d70[_0x3f61('0x3d')]);var _0x498d62={'where':_0x2a5ca3['where']};return db[_0x3f61('0x2a')][_0x3f61('0x19')](_0x498d62)[_0x3f61('0x21')](function(_0x248240){_0x56de73[_0x3f61('0x19')]=_0x248240;if(_0x2e2d70[_0x3f61('0x30')][_0x3f61('0x3e')]){_0x2a5ca3['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x2a5ca3);})[_0x3f61('0x21')](function(_0x210f94){_0x56de73['rows']=_0x210f94;return _0x56de73;})[_0x3f61('0x21')](respondWithFilteredResult(_0x37b8e3,_0x2a5ca3))[_0x3f61('0x3f')](handleError(_0x37b8e3,null));};exports['show']=function(_0x53d2fc,_0x55fabf){var _0x38d40f={'raw':!![],'where':{'id':_0x53d2fc[_0x3f61('0x40')]['id']}},_0x2f3cef={};_0x2f3cef[_0x3f61('0x2f')]=_['keys'](db['Interval'][_0x3f61('0x2b')]);_0x2f3cef[_0x3f61('0x30')]=_[_0x3f61('0x31')](_0x53d2fc[_0x3f61('0x30')]);_0x2f3cef[_0x3f61('0x32')]=_[_0x3f61('0x33')](_0x2f3cef[_0x3f61('0x2f')],_0x2f3cef['query']);_0x38d40f['attributes']=_[_0x3f61('0x33')](_0x2f3cef[_0x3f61('0x2f')],qs['fields'](_0x53d2fc[_0x3f61('0x30')][_0x3f61('0x34')]));_0x38d40f[_0x3f61('0x35')]=_0x38d40f[_0x3f61('0x35')][_0x3f61('0x36')]?_0x38d40f[_0x3f61('0x35')]:_0x2f3cef[_0x3f61('0x2f')];if(_0x53d2fc[_0x3f61('0x30')][_0x3f61('0x3e')]){_0x38d40f[_0x3f61('0x41')]=[{'all':!![]}];}_0x38d40f=_[_0x3f61('0x3c')]({},_0x38d40f,_0x53d2fc['options']);return db['Interval'][_0x3f61('0x42')](_0x38d40f)[_0x3f61('0x21')](handleEntityNotFound(_0x55fabf,null))[_0x3f61('0x21')](respondWithResult(_0x55fabf,null))['catch'](handleError(_0x55fabf,null));};exports[_0x3f61('0x43')]=function(_0x3a8e7d,_0x2e46c7){return db[_0x3f61('0x2a')]['create'](_0x3a8e7d[_0x3f61('0x44')],{})[_0x3f61('0x21')](function(_0xc3b017){var _0x17b1d3=_0x3a8e7d['user']['get']({'plain':!![]});if(!_0x17b1d3)throw new Error(_0x3f61('0x45'));if(_0x17b1d3['role']==='user'){var _0x6ab0f7=_0xc3b017[_0x3f61('0x22')]({'plain':!![]});var _0x5aad5f=_0x3f61('0x23');return db[_0x3f61('0x46')][_0x3f61('0x42')]({'where':{'name':_0x5aad5f,'userProfileId':_0x17b1d3[_0x3f61('0x47')]},'raw':!![]})['then'](function(_0x22cc50){if(_0x22cc50&&_0x22cc50[_0x3f61('0x48')]===0x0){return db[_0x3f61('0x49')][_0x3f61('0x43')]({'name':_0x6ab0f7[_0x3f61('0x26')],'resourceId':_0x6ab0f7['id'],'type':_0x22cc50[_0x3f61('0x26')],'sectionId':_0x22cc50['id']},{})[_0x3f61('0x21')](function(){return _0xc3b017;});}else{return _0xc3b017;}})[_0x3f61('0x3f')](function(_0x489d84){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x489d84);throw _0x489d84;});}return _0xc3b017;})[_0x3f61('0x21')](respondWithResult(_0x2e46c7,0xc9))[_0x3f61('0x3f')](handleError(_0x2e46c7,null));};exports['update']=function(_0x93aa7,_0x4592b8){if(_0x93aa7['body']['id']){delete _0x93aa7['body']['id'];}return db[_0x3f61('0x2a')]['find']({'where':{'id':_0x93aa7[_0x3f61('0x40')]['id']}})[_0x3f61('0x21')](handleEntityNotFound(_0x4592b8,null))['then'](saveUpdates(_0x93aa7[_0x3f61('0x44')],null))[_0x3f61('0x21')](respondWithResult(_0x4592b8,null))['catch'](handleError(_0x4592b8,null));};exports[_0x3f61('0x20')]=function(_0x33a56b,_0x10e24c){return db[_0x3f61('0x2a')]['find']({'where':{'id':_0x33a56b[_0x3f61('0x40')]['id']}})['then'](handleEntityNotFound(_0x10e24c,null))[_0x3f61('0x21')](removeEntity(_0x10e24c,null))['catch'](handleError(_0x10e24c,null));};exports[_0x3f61('0x4a')]=function(_0x53ccd3,_0x520025,_0x3afba0){if(_0x53ccd3[_0x3f61('0x44')]['id']){delete _0x53ccd3['body']['id'];}return db[_0x3f61('0x2a')][_0x3f61('0x42')]({'where':{'id':_0x53ccd3[_0x3f61('0x40')]['id']}})['then'](handleEntityNotFound(_0x520025,null))['then'](function(_0x249c7f){if(_0x249c7f){_0x53ccd3[_0x3f61('0x44')][_0x3f61('0x4b')]=_0x249c7f['id'];return db[_0x3f61('0x2a')][_0x3f61('0x43')](_0x53ccd3['body']);}})[_0x3f61('0x21')](respondWithResult(_0x520025,null))['catch'](handleError(_0x520025,null));};exports[_0x3f61('0x4c')]=function(_0x206534,_0x3e5ff9,_0x392e9b){var _0x192258={};var _0x56ddf4={};var _0x235308;var _0x2c10ad;return db['Interval'][_0x3f61('0x4d')]({'where':{'id':_0x206534[_0x3f61('0x40')]['id']}})[_0x3f61('0x21')](handleEntityNotFound(_0x3e5ff9,null))[_0x3f61('0x21')](function(_0x2a8566){if(_0x2a8566){_0x235308=_0x2a8566;_0x56ddf4['model']=_[_0x3f61('0x31')](db['Interval'][_0x3f61('0x2b')]);_0x56ddf4[_0x3f61('0x30')]=_['keys'](_0x206534[_0x3f61('0x30')]);_0x56ddf4[_0x3f61('0x32')]=_[_0x3f61('0x33')](_0x56ddf4['model'],_0x56ddf4[_0x3f61('0x30')]);_0x192258[_0x3f61('0x35')]=_[_0x3f61('0x33')](_0x56ddf4[_0x3f61('0x2f')],qs[_0x3f61('0x34')](_0x206534['query'][_0x3f61('0x34')]));_0x192258['attributes']=_0x192258['attributes'][_0x3f61('0x36')]?_0x192258['attributes']:_0x56ddf4[_0x3f61('0x2f')];_0x192258[_0x3f61('0x4e')]=qs[_0x3f61('0x38')](_0x206534[_0x3f61('0x30')]['sort']);_0x192258[_0x3f61('0x39')]=qs['filters'](_['pick'](_0x206534[_0x3f61('0x30')],_0x56ddf4[_0x3f61('0x32')]));if(_0x206534[_0x3f61('0x30')][_0x3f61('0x3b')]){_0x192258[_0x3f61('0x39')]=_[_0x3f61('0x3c')](_0x192258[_0x3f61('0x39')],{'$or':_[_0x3f61('0x29')](_0x192258['attributes'],function(_0x1e526e){var _0x472c8e={};_0x472c8e[_0x1e526e]={'$like':'%'+_0x206534[_0x3f61('0x30')][_0x3f61('0x3b')]+'%'};return _0x472c8e;})});}_0x192258=_[_0x3f61('0x3c')]({},_0x192258,_0x206534[_0x3f61('0x3d')]);return _0x235308['getIntervals'](_0x192258);}})[_0x3f61('0x21')](function(_0x51bcd7){if(_0x51bcd7){_0x2c10ad=_0x51bcd7[_0x3f61('0x36')];if(!_0x206534['query']['hasOwnProperty']('nolimit')){_0x192258['limit']=qs[_0x3f61('0x18')](_0x206534[_0x3f61('0x30')][_0x3f61('0x18')]);_0x192258[_0x3f61('0x1a')]=qs[_0x3f61('0x1a')](_0x206534[_0x3f61('0x30')][_0x3f61('0x1a')]);}return _0x235308[_0x3f61('0x4c')](_0x192258);}})['then'](function(_0xbe3470){if(_0xbe3470){return _0xbe3470?{'count':_0x2c10ad,'rows':_0xbe3470}:null;}})[_0x3f61('0x21')](respondWithResult(_0x3e5ff9,null))[_0x3f61('0x3f')](handleError(_0x3e5ff9,null));};exports['addIntervals']=function(_0x237ba2,_0x2f7cb3,_0xbbe6fc){return db[_0x3f61('0x2a')][_0x3f61('0x4d')]({'where':{'id':_0x237ba2[_0x3f61('0x40')]['id']}})[_0x3f61('0x21')](handleEntityNotFound(_0x2f7cb3,null))[_0x3f61('0x21')](function(_0xe7e584){if(_0xe7e584){return db[_0x3f61('0x4f')][_0x3f61('0x50')](function(_0x4a3be4){return db[_0x3f61('0x2a')]['destroy']({'where':{'IntervalId':_0x237ba2[_0x3f61('0x40')]['id']},'transaction':_0x4a3be4})['then'](function(_0x132bf0){var _0x19442b=_['map'](_0x237ba2[_0x3f61('0x44')],function(_0x2d6bdf){delete _0x2d6bdf['id'];_0x2d6bdf[_0x3f61('0x4b')]=_0x237ba2['params']['id'];return _0x2d6bdf;});return db[_0x3f61('0x2a')]['bulkCreate'](_0x19442b,{'transaction':_0x4a3be4});});})[_0x3f61('0x21')](function(){return db[_0x3f61('0x2a')][_0x3f61('0x51')]({'where':{'IntervalId':_0x237ba2[_0x3f61('0x40')]['id']}});});}})[_0x3f61('0x21')](respondWithResult(_0x2f7cb3,null))['catch'](handleError(_0x2f7cb3,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ce294ab..8de2393 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 _0xf651=['api','moment','bluebird','rimraf','../../config/environment','./interval.attributes','Interval','tools_intervals','rewrite','util','../../config/logger'];(function(_0x5ec7e2,_0x5b67df){var _0x506515=function(_0xfe6f22){while(--_0xfe6f22){_0x5ec7e2['push'](_0x5ec7e2['shift']());}};_0x506515(++_0x5b67df);}(_0xf651,0x169));var _0x1f65=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xf651[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0x1f65('0x0'));var logger=require(_0x1f65('0x1'))(_0x1f65('0x2'));var moment=require(_0x1f65('0x3'));var BPromise=require(_0x1f65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f65('0x5'));var config=require(_0x1f65('0x6'));var attributes=require(_0x1f65('0x7'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x5ed75c,_0x51e0c9){return _0x5ed75c['define'](_0x1f65('0x8'),attributes,{'tableName':_0x1f65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b6c2f,_0x23ceed){extensions[_0x1f65('0xa')](_0x5ed75c,_0x5b6c2f);},'afterBulkCreate':function(_0x58f18c,_0x430808,_0x29d8ed){_0x29d8ed();extensions[_0x1f65('0xa')](_0x5ed75c,_0x58f18c[0x0]);},'afterUpdate':function(_0x1a40fe,_0x1f0554){extensions[_0x1f65('0xa')](_0x5ed75c,_0x1a40fe);},'afterDestroy':function(_0x5c5489,_0x738b08){extensions['rewrite'](_0x5ed75c,_0x5c5489);}}});}; \ No newline at end of file +var _0x1629=['../../components/extensions/rewrite','define','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3202d3,_0x1ac67f){var _0x330f62=function(_0x64ab42){while(--_0x64ab42){_0x3202d3['push'](_0x3202d3['shift']());}};_0x330f62(++_0x1ac67f);}(_0x1629,0x1cb));var _0x9162=function(_0x3c0f17,_0x46562d){_0x3c0f17=_0x3c0f17-0x0;var _0x2b1a36=_0x1629[_0x3c0f17];return _0x2b1a36;};'use strict';var _=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var logger=require(_0x9162('0x2'))(_0x9162('0x3'));var moment=require(_0x9162('0x4'));var BPromise=require(_0x9162('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9162('0x6'));var rimraf=require(_0x9162('0x7'));var config=require(_0x9162('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x9162('0x9'));module['exports']=function(_0x350fe6,_0xc2a27d){return _0x350fe6[_0x9162('0xa')](_0x9162('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4826a1,_0x1fa02e){extensions[_0x9162('0xc')](_0x350fe6,_0x4826a1);},'afterBulkCreate':function(_0x23da83,_0x17a988,_0x5be5a4){_0x5be5a4();extensions[_0x9162('0xc')](_0x350fe6,_0x23da83[0x0]);},'afterUpdate':function(_0x11929d,_0x1c7dee){extensions[_0x9162('0xc')](_0x350fe6,_0x11929d);},'afterDestroy':function(_0x15ab17,_0x5b7d17){extensions[_0x9162('0xc')](_0x350fe6,_0x15ab17);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5f1167a..711c2dc 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(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 3a1479f..785986c 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x232312,_0x5f3792){var _0x26a305=function(_0x33db05){while(--_0x33db05){_0x232312['push'](_0x232312['shift']());}};_0x26a305(++_0x5f3792);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4492a7,_0x34d6ad){_0x4492a7=_0x4492a7-0x0;var _0x523950=_0x5f2f[_0x4492a7];return _0x523950;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 646faa1..38f7fd2 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 _0x1587=['error','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x1587,0x103));var _0x7158=function(_0x3e10b0,_0xb3025a){_0x3e10b0=_0x3e10b0-0x0;var _0x1b8132=_0x1587[_0x3e10b0];return _0x1b8132;};'use strict';var BPromise=require(_0x7158('0x0'));var https=require('https');var logger=require(_0x7158('0x1'))(_0x7158('0x2'));var USERNAME=_0x7158('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x51a71f,_0x2a90d7){var _0x1bca56={'fields':{'project':{'key':_0x51a71f['key']||_0x7158('0x4')},'summary':(_0x51a71f[_0x7158('0x5')]||_0x7158('0x6'))+_0x7158('0x7')+_0x51a71f['ip'],'description':_0x51a71f[_0x7158('0x8')]||JSON['stringify'](_0x51a71f),'issuetype':{'name':_0x51a71f[_0x7158('0x9')]||_0x7158('0xa')}}};_0x1bca56[_0x7158('0xb')]['customfield_11500']=_0x51a71f['email'];_0x1bca56[_0x7158('0xb')][_0x7158('0xc')]=_0x51a71f[_0x7158('0xd')];_0x1bca56['fields'][_0x7158('0xe')]=_0x51a71f[_0x7158('0xf')];_0x1bca56[_0x7158('0xb')]['customfield_11503']=_0x51a71f[_0x7158('0x10')];_0x1bca56[_0x7158('0xb')][_0x7158('0x11')]=_0x51a71f['reason'];_0x1bca56[_0x7158('0xb')][_0x7158('0x12')]=_0x51a71f['ip'];var _0x270e74={'host':_0x7158('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x7158('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x7158('0x15'),'Authorization':_0x7158('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x7158('0x17')](_0x7158('0x18'))}};var _0x29594a=JSON[_0x7158('0x19')](_0x1bca56);var _0x7aba78=https[_0x7158('0x1a')](_0x270e74,function(_0x22e91c){_0x22e91c[_0x7158('0x1b')](_0x7158('0x1c'));var _0x52822f='';_0x22e91c['on'](_0x7158('0x1d'),function(_0x2c9f45){_0x52822f+=_0x2c9f45;});_0x22e91c['on'](_0x7158('0x1e'),function(){if(_0x2a90d7){return _0x2a90d7[_0x7158('0x1f')](_0x22e91c[_0x7158('0x20')])[_0x7158('0x21')](JSON[_0x7158('0x22')](_0x52822f));}});});_0x7aba78['on'](_0x7158('0x23'),function(_0x5a8879){if(_0x2a90d7){return _0x2a90d7[_0x7158('0x1f')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x7aba78['write'](_0x29594a);_0x7aba78['end']();}exports[_0x7158('0x24')]=openIssue;exports['send']=function(_0x2b97d4,_0x4fc838){_0x2b97d4[_0x7158('0x25')]['ip']=_0x2b97d4['headers'][_0x7158('0x26')]||_0x2b97d4[_0x7158('0x27')][_0x7158('0x28')]||_0x2b97d4[_0x7158('0x29')][_0x7158('0x28')]||_0x2b97d4['connection']['socket'][_0x7158('0x28')];return openIssue(_0x2b97d4[_0x7158('0x25')],_0x4fc838);}; \ No newline at end of file +var _0x78de=['oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','\x20from\x20','stringify','issuetype','Bug','fields','email','customfield_11501'];(function(_0x56f3aa,_0x2e4b03){var _0xb9c54e=function(_0x128c04){while(--_0x128c04){_0x56f3aa['push'](_0x56f3aa['shift']());}};_0xb9c54e(++_0x2e4b03);}(_0x78de,0x1c7));var _0xe78d=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x78de[_0x56e0e8];return _0x2dab50;};'use strict';var BPromise=require(_0xe78d('0x0'));var https=require(_0xe78d('0x1'));var logger=require(_0xe78d('0x2'))(_0xe78d('0x3'));var USERNAME=_0xe78d('0x4');var PASSWORD=_0xe78d('0x5');function openIssue(_0x2ae747,_0x5d7b28){var _0xa12f77={'fields':{'project':{'key':_0x2ae747[_0xe78d('0x6')]||'MOTGUI'},'summary':(_0x2ae747[_0xe78d('0x7')]||'Report')+_0xe78d('0x8')+_0x2ae747['ip'],'description':_0x2ae747['description']||JSON[_0xe78d('0x9')](_0x2ae747),'issuetype':{'name':_0x2ae747[_0xe78d('0xa')]||_0xe78d('0xb')}}};_0xa12f77[_0xe78d('0xc')]['customfield_11500']=_0x2ae747[_0xe78d('0xd')];_0xa12f77[_0xe78d('0xc')][_0xe78d('0xe')]=_0x2ae747[_0xe78d('0xf')];_0xa12f77[_0xe78d('0xc')][_0xe78d('0x10')]=_0x2ae747[_0xe78d('0x11')];_0xa12f77['fields'][_0xe78d('0x12')]=_0x2ae747['name'];_0xa12f77['fields'][_0xe78d('0x13')]=_0x2ae747[_0xe78d('0x14')];_0xa12f77[_0xe78d('0xc')][_0xe78d('0x15')]=_0x2ae747['ip'];var _0x5a1d4b={'host':_0xe78d('0x16'),'port':0x1bb,'path':_0xe78d('0x17'),'method':_0xe78d('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xe78d('0x19'),'Authorization':_0xe78d('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xe78d('0x1b')](_0xe78d('0x1c'))}};var _0x207a04=JSON['stringify'](_0xa12f77);var _0xa22b90=https['request'](_0x5a1d4b,function(_0x231927){_0x231927[_0xe78d('0x1d')](_0xe78d('0x1e'));var _0x23db4a='';_0x231927['on']('data',function(_0x38459b){_0x23db4a+=_0x38459b;});_0x231927['on']('end',function(){if(_0x5d7b28){return _0x5d7b28[_0xe78d('0x1f')](_0x231927[_0xe78d('0x20')])[_0xe78d('0x21')](JSON[_0xe78d('0x22')](_0x23db4a));}});});_0xa22b90['on'](_0xe78d('0x23'),function(_0x442266){if(_0x5d7b28){return _0x5d7b28[_0xe78d('0x1f')](0x1f4)[_0xe78d('0x21')]({'errors':[{'message':_0xe78d('0x24'),'type':_0xe78d('0x25')}]});}});_0xa22b90[_0xe78d('0x26')](_0x207a04);_0xa22b90[_0xe78d('0x27')]();}exports['openIssue']=openIssue;exports[_0xe78d('0x28')]=function(_0x15ff9f,_0x4a611f){_0x15ff9f[_0xe78d('0x29')]['ip']=_0x15ff9f[_0xe78d('0x2a')][_0xe78d('0x2b')]||_0x15ff9f[_0xe78d('0x2c')][_0xe78d('0x2d')]||_0x15ff9f[_0xe78d('0x2e')]['remoteAddress']||_0x15ff9f['connection'][_0xe78d('0x2e')][_0xe78d('0x2d')];return openIssue(_0x15ff9f[_0xe78d('0x29')],_0x4a611f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3c5b77d..fb4534e 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x589c9a,_0x5de7df){var _0x4fffdd=function(_0x14971e){while(--_0x14971e){_0x589c9a['push'](_0x589c9a['shift']());}};_0x4fffdd(++_0x5de7df);}(_0x1be1,0x192));var _0x11be=function(_0x428c2b,_0x11f232){_0x428c2b=_0x428c2b-0x0;var _0x3de0bf=_0x1be1[_0x428c2b];return _0x3de0bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file +var _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x532d5b,_0x4b6047){var _0x523f05=function(_0x130c20){while(--_0x130c20){_0x532d5b['push'](_0x532d5b['shift']());}};_0x523f05(++_0x4b6047);}(_0x22fb,0x192));var _0xb22f=function(_0x136d98,_0x5c2d31){_0x136d98=_0x136d98-0x0;var _0x17d24b=_0x22fb[_0x136d98];return _0x17d24b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);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 f62f8a9..c2d8544 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x3f4579,_0x23e80d){_0x3f4579=_0x3f4579-0x0;var _0x2e8fd7=_0x7a54[_0x3f4579];return _0x2e8fd7;};'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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x320e4b,_0x50187a){_0x320e4b=_0x320e4b-0x0;var _0x2e9f76=_0x7a54[_0x320e4b];return _0x2e9f76;};'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 218e70c..b02fb13 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 _0x4491=['path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x2f681b,_0x50d092){var _0x134413=function(_0x24e808){while(--_0x24e808){_0x2f681b['push'](_0x2f681b['shift']());}};_0x134413(++_0x50d092);}(_0x4491,0x1bb));var _0x1449=function(_0x20178f,_0x56c343){_0x20178f=_0x20178f-0x0;var _0x3523c7=_0x4491[_0x20178f];return _0x3523c7;};'use strict';var emlformat=require(_0x1449('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1449('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1449('0x2'));var moment=require(_0x1449('0x3'));var BPromise=require(_0x1449('0x4'));var Mustache=require(_0x1449('0x5'));var util=require(_0x1449('0x6'));var path=require(_0x1449('0x7'));var sox=require('sox');var csv=require(_0x1449('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1449('0x9'));var _=require(_0x1449('0xa'));var squel=require(_0x1449('0xb'));var crypto=require(_0x1449('0xc'));var jsforce=require(_0x1449('0xd'));var deskjs=require(_0x1449('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1449('0xf'));var Papa=require(_0x1449('0x10'));var Redis=require('ioredis');var authService=require(_0x1449('0x11'));var qs=require(_0x1449('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1449('0x13'));var logger=require(_0x1449('0x14'))('api');var utils=require(_0x1449('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1449('0x16'))['db'];function respondWithStatusCode(_0x3f5424,_0x399815){_0x399815=_0x399815||0xcc;return function(_0x25bce3){if(_0x25bce3){return _0x3f5424[_0x1449('0x17')](_0x399815);}return _0x3f5424[_0x1449('0x18')](_0x399815)[_0x1449('0x19')]();};}function respondWithResult(_0x377c96,_0x267d9a){_0x267d9a=_0x267d9a||0xc8;return function(_0x41b34d){if(_0x41b34d){return _0x377c96[_0x1449('0x18')](_0x267d9a)[_0x1449('0x1a')](_0x41b34d);}};}function respondWithFilteredResult(_0x441344,_0x2cf76c){return function(_0x1ec7e8){if(_0x1ec7e8){var _0x59b128=typeof _0x2cf76c[_0x1449('0x1b')]===_0x1449('0x1c')&&typeof _0x2cf76c['limit']===_0x1449('0x1c');var _0x290b72=_0x1ec7e8[_0x1449('0x1d')];var _0x364878=_0x59b128?0x0:_0x2cf76c[_0x1449('0x1b')];var _0x30a65f=_0x59b128?_0x1ec7e8[_0x1449('0x1d')]:_0x2cf76c[_0x1449('0x1b')]+_0x2cf76c[_0x1449('0x1e')];var _0x2dbae1;if(_0x30a65f>=_0x290b72){_0x30a65f=_0x290b72;_0x2dbae1=0xc8;}else{_0x2dbae1=0xce;}_0x441344[_0x1449('0x18')](_0x2dbae1);return _0x441344[_0x1449('0x1f')](_0x1449('0x20'),_0x364878+'-'+_0x30a65f+'/'+_0x290b72)['json'](_0x1ec7e8);}return null;};}function patchUpdates(_0x108f41){return function(_0x49c4d6){try{jsonpatch[_0x1449('0x21')](_0x49c4d6,_0x108f41,!![]);}catch(_0xaaea1d){return BPromise[_0x1449('0x22')](_0xaaea1d);}return _0x49c4d6[_0x1449('0x23')]();};}function saveUpdates(_0x3a2c85,_0x4dcc1b){return function(_0x4c86b9){if(_0x4c86b9){return _0x4c86b9[_0x1449('0x24')](_0x3a2c85)[_0x1449('0x25')](function(_0x100ac6){return _0x100ac6;});}return null;};}function removeEntity(_0x356d6b,_0x545cee){return function(_0x29e254){if(_0x29e254){return _0x29e254['destroy']()[_0x1449('0x25')](function(){_0x356d6b[_0x1449('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8cf0,_0x507a14){return function(_0x1ef1e3){if(!_0x1ef1e3){_0x5a8cf0[_0x1449('0x17')](0x194);}return _0x1ef1e3;};}function handleError(_0x39ad3c,_0x529dae){_0x529dae=_0x529dae||0x1f4;return function(_0x40e7d5){logger['error'](_0x40e7d5[_0x1449('0x26')]);if(_0x40e7d5['name']){delete _0x40e7d5['name'];}_0x39ad3c[_0x1449('0x18')](_0x529dae)[_0x1449('0x27')](_0x40e7d5);};}exports['index']=function(_0xe6900c,_0x5c3fdf){var _0x2836a1={},_0x36a74a={},_0x5d51dd={'count':0x0,'rows':[]};var _0x4b6530=_[_0x1449('0x28')](db['JscriptyAnswerReport'][_0x1449('0x29')],function(_0x22b207){return{'name':_0x22b207[_0x1449('0x2a')],'type':_0x22b207[_0x1449('0x2b')][_0x1449('0x2c')]};});_0x36a74a[_0x1449('0x2d')]=_[_0x1449('0x28')](_0x4b6530,_0x1449('0x2e'));_0x36a74a[_0x1449('0x2f')]=_[_0x1449('0x30')](_0xe6900c[_0x1449('0x2f')]);_0x36a74a[_0x1449('0x31')]=_[_0x1449('0x32')](_0x36a74a[_0x1449('0x2d')],_0x36a74a[_0x1449('0x2f')]);_0x2836a1[_0x1449('0x33')]=_[_0x1449('0x32')](_0x36a74a['model'],qs[_0x1449('0x34')](_0xe6900c['query'][_0x1449('0x34')]));_0x2836a1[_0x1449('0x33')]=_0x2836a1[_0x1449('0x33')][_0x1449('0x35')]?_0x2836a1[_0x1449('0x33')]:_0x36a74a[_0x1449('0x2d')];if(!_0xe6900c[_0x1449('0x2f')][_0x1449('0x36')]('nolimit')){_0x2836a1['limit']=qs['limit'](_0xe6900c[_0x1449('0x2f')][_0x1449('0x1e')]);_0x2836a1[_0x1449('0x1b')]=qs[_0x1449('0x1b')](_0xe6900c[_0x1449('0x2f')][_0x1449('0x1b')]);}_0x2836a1[_0x1449('0x37')]=qs[_0x1449('0x38')](_0xe6900c['query'][_0x1449('0x38')]);_0x2836a1[_0x1449('0x39')]=qs[_0x1449('0x31')](_[_0x1449('0x3a')](_0xe6900c[_0x1449('0x2f')],_0x36a74a[_0x1449('0x31')]),_0x4b6530);if(_0xe6900c['query'][_0x1449('0x3b')]){_0x2836a1[_0x1449('0x39')]=_['merge'](_0x2836a1[_0x1449('0x39')],{'$or':_['map'](_0x4b6530,function(_0x2ccb90){if(_0x2ccb90[_0x1449('0x2b')]!==_0x1449('0x3c')){var _0x759c1f={};_0x759c1f[_0x2ccb90['name']]={'$like':'%'+_0xe6900c[_0x1449('0x2f')][_0x1449('0x3b')]+'%'};return _0x759c1f;}})});}_0x2836a1=_[_0x1449('0x3d')]({},_0x2836a1,_0xe6900c[_0x1449('0x3e')]);var _0xcc47b={'where':_0x2836a1[_0x1449('0x39')]};return db[_0x1449('0x3f')][_0x1449('0x1d')](_0xcc47b)[_0x1449('0x25')](function(_0x73e53b){_0x5d51dd['count']=_0x73e53b;if(_0xe6900c[_0x1449('0x2f')][_0x1449('0x40')]){_0x2836a1[_0x1449('0x41')]=[{'all':!![]}];}return db[_0x1449('0x3f')][_0x1449('0x42')](_0x2836a1);})[_0x1449('0x25')](function(_0x599cf1){_0x5d51dd[_0x1449('0x43')]=_0x599cf1;return _0x5d51dd;})[_0x1449('0x25')](respondWithFilteredResult(_0x5c3fdf,_0x2836a1))['catch'](handleError(_0x5c3fdf,null));};exports[_0x1449('0x44')]=function(_0xc6d28a,_0x37cc94){var _0x123a9c={'raw':!![],'where':{'id':_0xc6d28a[_0x1449('0x45')]['id']}},_0xc542dd={};_0xc542dd[_0x1449('0x2d')]=_[_0x1449('0x30')](db['JscriptyAnswerReport']['rawAttributes']);_0xc542dd['query']=_[_0x1449('0x30')](_0xc6d28a[_0x1449('0x2f')]);_0xc542dd['filters']=_[_0x1449('0x32')](_0xc542dd[_0x1449('0x2d')],_0xc542dd[_0x1449('0x2f')]);_0x123a9c[_0x1449('0x33')]=_[_0x1449('0x32')](_0xc542dd[_0x1449('0x2d')],qs[_0x1449('0x34')](_0xc6d28a['query']['fields']));_0x123a9c[_0x1449('0x33')]=_0x123a9c[_0x1449('0x33')][_0x1449('0x35')]?_0x123a9c[_0x1449('0x33')]:_0xc542dd[_0x1449('0x2d')];if(_0xc6d28a[_0x1449('0x2f')][_0x1449('0x40')]){_0x123a9c['include']=[{'all':!![]}];}_0x123a9c=_['merge']({},_0x123a9c,_0xc6d28a['options']);return db[_0x1449('0x3f')][_0x1449('0x46')](_0x123a9c)[_0x1449('0x25')](handleEntityNotFound(_0x37cc94,null))['then'](respondWithResult(_0x37cc94,null))['catch'](handleError(_0x37cc94,null));};exports['create']=function(_0x4354b4,_0x3ea728){return db[_0x1449('0x3f')][_0x1449('0x47')](_0x4354b4[_0x1449('0x48')],{})[_0x1449('0x25')](respondWithResult(_0x3ea728,0xc9))[_0x1449('0x49')](handleError(_0x3ea728,null));};exports[_0x1449('0x24')]=function(_0x521b42,_0x58b2ca){if(_0x521b42['body']['id']){delete _0x521b42[_0x1449('0x48')]['id'];}return db[_0x1449('0x3f')][_0x1449('0x46')]({'where':{'id':_0x521b42[_0x1449('0x45')]['id']}})['then'](handleEntityNotFound(_0x58b2ca,null))[_0x1449('0x25')](saveUpdates(_0x521b42[_0x1449('0x48')],null))['then'](respondWithResult(_0x58b2ca,null))[_0x1449('0x49')](handleError(_0x58b2ca,null));};exports[_0x1449('0x4a')]=function(_0x113165,_0x2125df){return db[_0x1449('0x3f')][_0x1449('0x46')]({'where':{'id':_0x113165[_0x1449('0x45')]['id']}})[_0x1449('0x25')](handleEntityNotFound(_0x2125df,null))[_0x1449('0x25')](removeEntity(_0x2125df,null))[_0x1449('0x49')](handleError(_0x2125df,null));};exports['describe']=function(_0x941737,_0x54e529){return db[_0x1449('0x3f')]['describe']()[_0x1449('0x25')](respondWithResult(_0x54e529,null))[_0x1449('0x49')](handleError(_0x54e529,null));}; \ No newline at end of file +var _0x7da7=['count','limit','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x7da7[_0x38622b];return _0x2c1a7a;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={},_0x2258e9={},_0x30456a={'count':0x0,'rows':[]};var _0x410d09=_[_0x77da('0x29')](db[_0x77da('0x2a')]['rawAttributes'],function(_0x350b4e){return{'name':_0x350b4e[_0x77da('0x2b')],'type':_0x350b4e[_0x77da('0x2c')][_0x77da('0x2d')]};});_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x29')](_0x410d09,'name');_0x2258e9[_0x77da('0x2f')]=_[_0x77da('0x30')](_0x496ecd[_0x77da('0x2f')]);_0x2258e9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x2258e9[_0x77da('0x2e')],_0x2258e9[_0x77da('0x2f')]);_0x4d395a[_0x77da('0x33')]=_['intersection'](_0x2258e9['model'],qs[_0x77da('0x34')](_0x496ecd[_0x77da('0x2f')]['fields']));_0x4d395a[_0x77da('0x33')]=_0x4d395a[_0x77da('0x33')][_0x77da('0x35')]?_0x4d395a[_0x77da('0x33')]:_0x2258e9[_0x77da('0x2e')];if(!_0x496ecd[_0x77da('0x2f')][_0x77da('0x36')]('nolimit')){_0x4d395a[_0x77da('0x1c')]=qs['limit'](_0x496ecd['query']['limit']);_0x4d395a[_0x77da('0x19')]=qs['offset'](_0x496ecd[_0x77da('0x2f')][_0x77da('0x19')]);}_0x4d395a[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x496ecd[_0x77da('0x2f')][_0x77da('0x38')]);_0x4d395a[_0x77da('0x39')]=qs['filters'](_[_0x77da('0x3a')](_0x496ecd[_0x77da('0x2f')],_0x2258e9[_0x77da('0x31')]),_0x410d09);if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3b')]){_0x4d395a[_0x77da('0x39')]=_['merge'](_0x4d395a[_0x77da('0x39')],{'$or':_[_0x77da('0x29')](_0x410d09,function(_0x2cd190){if(_0x2cd190['type']!==_0x77da('0x3c')){var _0x505ffb={};_0x505ffb[_0x2cd190['name']]={'$like':'%'+_0x496ecd['query']['filter']+'%'};return _0x505ffb;}})});}_0x4d395a=_[_0x77da('0x3d')]({},_0x4d395a,_0x496ecd[_0x77da('0x3e')]);var _0xebdea1={'where':_0x4d395a['where']};return db[_0x77da('0x2a')]['count'](_0xebdea1)[_0x77da('0x21')](function(_0x517bd0){_0x30456a[_0x77da('0x1b')]=_0x517bd0;if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3f')]){_0x4d395a[_0x77da('0x40')]=[{'all':!![]}];}return db[_0x77da('0x2a')]['findAll'](_0x4d395a);})[_0x77da('0x21')](function(_0x1f48bd){_0x30456a[_0x77da('0x41')]=_0x1f48bd;return _0x30456a;})[_0x77da('0x21')](respondWithFilteredResult(_0x5b4638,_0x4d395a))[_0x77da('0x42')](handleError(_0x5b4638,null));};exports[_0x77da('0x43')]=function(_0x4ea24c,_0x319625){var _0x2f0495={'raw':!![],'where':{'id':_0x4ea24c[_0x77da('0x44')]['id']}},_0x21de41={};_0x21de41[_0x77da('0x2e')]=_[_0x77da('0x30')](db['JscriptyAnswerReport'][_0x77da('0x45')]);_0x21de41['query']=_[_0x77da('0x30')](_0x4ea24c[_0x77da('0x2f')]);_0x21de41[_0x77da('0x31')]=_['intersection'](_0x21de41[_0x77da('0x2e')],_0x21de41[_0x77da('0x2f')]);_0x2f0495[_0x77da('0x33')]=_[_0x77da('0x32')](_0x21de41[_0x77da('0x2e')],qs[_0x77da('0x34')](_0x4ea24c[_0x77da('0x2f')][_0x77da('0x34')]));_0x2f0495[_0x77da('0x33')]=_0x2f0495['attributes'][_0x77da('0x35')]?_0x2f0495[_0x77da('0x33')]:_0x21de41[_0x77da('0x2e')];if(_0x4ea24c[_0x77da('0x2f')][_0x77da('0x3f')]){_0x2f0495[_0x77da('0x40')]=[{'all':!![]}];}_0x2f0495=_['merge']({},_0x2f0495,_0x4ea24c['options']);return db[_0x77da('0x2a')][_0x77da('0x46')](_0x2f0495)[_0x77da('0x21')](handleEntityNotFound(_0x319625,null))[_0x77da('0x21')](respondWithResult(_0x319625,null))[_0x77da('0x42')](handleError(_0x319625,null));};exports[_0x77da('0x47')]=function(_0x4e811e,_0x6ccb8f){return db[_0x77da('0x2a')][_0x77da('0x47')](_0x4e811e[_0x77da('0x48')],{})['then'](respondWithResult(_0x6ccb8f,0xc9))[_0x77da('0x42')](handleError(_0x6ccb8f,null));};exports['update']=function(_0x518fd5,_0x36263b){if(_0x518fd5[_0x77da('0x48')]['id']){delete _0x518fd5[_0x77da('0x48')]['id'];}return db[_0x77da('0x2a')]['find']({'where':{'id':_0x518fd5[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x36263b,null))['then'](saveUpdates(_0x518fd5[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x36263b,null))['catch'](handleError(_0x36263b,null));};exports[_0x77da('0x22')]=function(_0x3aaf5b,_0x2b73d3){return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':{'id':_0x3aaf5b[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x2b73d3,null))[_0x77da('0x21')](removeEntity(_0x2b73d3,null))[_0x77da('0x42')](handleError(_0x2b73d3,null));};exports[_0x77da('0x49')]=function(_0x52aa0a,_0x3d04a3){return db['JscriptyAnswerReport'][_0x77da('0x49')]()[_0x77da('0x21')](respondWithResult(_0x3d04a3,null))[_0x77da('0x42')](handleError(_0x3d04a3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4cab6bb..2b7c2e0 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 _0x976d=['exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x5d31d5,_0x55d644){var _0x28fea5=function(_0x180c4d){while(--_0x180c4d){_0x5d31d5['push'](_0x5d31d5['shift']());}};_0x28fea5(++_0x55d644);}(_0x976d,0x1a3));var _0xd976=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x976d[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xd976('0x0'));var util=require(_0xd976('0x1'));var logger=require(_0xd976('0x2'))(_0xd976('0x3'));var moment=require(_0xd976('0x4'));var BPromise=require(_0xd976('0x5'));var rp=require(_0xd976('0x6'));var fs=require('fs');var path=require(_0xd976('0x7'));var rimraf=require(_0xd976('0x8'));var config=require('../../config/environment');var attributes=require(_0xd976('0x9'));module[_0xd976('0xa')]=function(_0x4e59af,_0x5617d9){return _0x4e59af[_0xd976('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xd976('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf6=['./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1416b8,_0x239a15){var _0x59f9c7=function(_0x21c7ad){while(--_0x21c7ad){_0x1416b8['push'](_0x1416b8['shift']());}};_0x59f9c7(++_0x239a15);}(_0xfdf6,0xa0));var _0x6fdf=function(_0x248abf,_0x41fc15){_0x248abf=_0x248abf-0x0;var _0x39fdf2=_0xfdf6[_0x248abf];return _0x39fdf2;};'use strict';var _=require(_0x6fdf('0x0'));var util=require('util');var logger=require(_0x6fdf('0x1'))(_0x6fdf('0x2'));var moment=require(_0x6fdf('0x3'));var BPromise=require(_0x6fdf('0x4'));var rp=require(_0x6fdf('0x5'));var fs=require('fs');var path=require(_0x6fdf('0x6'));var rimraf=require(_0x6fdf('0x7'));var config=require('../../config/environment');var attributes=require(_0x6fdf('0x8'));module[_0x6fdf('0x9')]=function(_0x2abeab,_0x5088c3){return _0x2abeab[_0x6fdf('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x6fdf('0xb'),'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 1c8d3ad..202b2b3 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 _0x2705=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','code','error','message','result'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x2705,0xfd));var _0x5270=function(_0x45ad41,_0x16e471){_0x45ad41=_0x45ad41-0x0;var _0x1ded74=_0x2705[_0x45ad41];return _0x1ded74;};'use strict';var _=require(_0x5270('0x0'));var util=require('util');var moment=require(_0x5270('0x1'));var BPromise=require(_0x5270('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5270('0x3'));var db=require(_0x5270('0x4'))['db'];var utils=require(_0x5270('0x5'));var logger=require(_0x5270('0x6'))(_0x5270('0x7'));var config=require(_0x5270('0x8'));var jayson=require(_0x5270('0x9'));var client=jayson[_0x5270('0xa')][_0x5270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb24141,_0x487d87,_0x3541ba){return new BPromise(function(_0x3138e7,_0x4c3ef1){return client[_0x5270('0xc')](_0xb24141,_0x3541ba)['then'](function(_0x2ed1f5){logger[_0x5270('0xd')](_0x5270('0xe'),_0x487d87,_0x5270('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x487d87,_0x5270('0xf'),JSON['stringify'](_0x2ed1f5));if(_0x2ed1f5['error']){if(_0x2ed1f5['error'][_0x5270('0x10')]===0x1f4){logger[_0x5270('0x11')](_0x5270('0xe'),_0x487d87,_0x2ed1f5[_0x5270('0x11')]['message']);return _0x4c3ef1(_0x2ed1f5[_0x5270('0x11')][_0x5270('0x12')]);}logger[_0x5270('0x11')](_0x5270('0xe'),_0x487d87,_0x2ed1f5[_0x5270('0x11')][_0x5270('0x12')]);return _0x3138e7(_0x2ed1f5['error']['message']);}else{logger[_0x5270('0xd')](_0x5270('0xe'),_0x487d87,_0x5270('0xf'));_0x3138e7(_0x2ed1f5[_0x5270('0x13')][_0x5270('0x12')]);}})[_0x5270('0x14')](function(_0x3ca35c){logger['error'](_0x5270('0xe'),_0x487d87,_0x3ca35c);_0x4c3ef1(_0x3ca35c);});});} \ No newline at end of file +var _0x001b=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x39d38e,_0x3da1f7){var _0x18e737=function(_0x373eef){while(--_0x373eef){_0x39d38e['push'](_0x39d38e['shift']());}};_0x18e737(++_0x3da1f7);}(_0x001b,0x1dd));var _0xb001=function(_0x1c4f71,_0x5413dd){_0x1c4f71=_0x1c4f71-0x0;var _0x3e88a7=_0x001b[_0x1c4f71];return _0x3e88a7;};'use strict';var _=require(_0xb001('0x0'));var util=require(_0xb001('0x1'));var moment=require(_0xb001('0x2'));var BPromise=require(_0xb001('0x3'));var rs=require(_0xb001('0x4'));var fs=require('fs');var Redis=require(_0xb001('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb001('0x6'))(_0xb001('0x7'));var config=require(_0xb001('0x8'));var jayson=require(_0xb001('0x9'));var client=jayson['client'][_0xb001('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55297d,_0x335748,_0x5b306f){return new BPromise(function(_0xd6fd9a,_0x5a61e3){return client[_0xb001('0xb')](_0x55297d,_0x5b306f)[_0xb001('0xc')](function(_0x3d0eb7){logger[_0xb001('0xd')](_0xb001('0xe'),_0x335748,_0xb001('0xf'));logger[_0xb001('0x10')](_0xb001('0x11'),_0x335748,_0xb001('0xf'),JSON[_0xb001('0x12')](_0x3d0eb7));if(_0x3d0eb7[_0xb001('0x13')]){if(_0x3d0eb7['error'][_0xb001('0x14')]===0x1f4){logger[_0xb001('0x13')](_0xb001('0xe'),_0x335748,_0x3d0eb7[_0xb001('0x13')][_0xb001('0x15')]);return _0x5a61e3(_0x3d0eb7[_0xb001('0x13')][_0xb001('0x15')]);}logger[_0xb001('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x335748,_0x3d0eb7[_0xb001('0x13')][_0xb001('0x15')]);return _0xd6fd9a(_0x3d0eb7[_0xb001('0x13')][_0xb001('0x15')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x335748,'request\x20sent');_0xd6fd9a(_0x3d0eb7[_0xb001('0x16')][_0xb001('0x15')]);}})[_0xb001('0x17')](function(_0x3305e6){logger[_0xb001('0x13')](_0xb001('0xe'),_0x335748,_0x3305e6);_0x5a61e3(_0x3305e6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index f131bfa..4415863 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 _0x833f=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','getSessions','/:id/answers','getAnswers','30s','getSummary','create','post','/:id/clone','clone','put','update','destroy','exports','express','fs-extra','../../components/auth/service'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x833f,0x81));var _0xf833=function(_0x19c315,_0x2b2e84){_0x19c315=_0x19c315-0x0;var _0x3dc378=_0x833f[_0x19c315];return _0x3dc378;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf833('0x0'));var router=express['Router']();var fs_extra=require(_0xf833('0x1'));var auth=require(_0xf833('0x2'));var interaction=require(_0xf833('0x3'));var config=require(_0xf833('0x4'));var controller=require(_0xf833('0x5'));router[_0xf833('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf833('0x6')](_0xf833('0x7'),auth[_0xf833('0x8')](),controller['show']);router['get']('/:id/sessions',auth['isAuthenticated'](),controller[_0xf833('0x9')]);router[_0xf833('0x6')](_0xf833('0xa'),auth[_0xf833('0x8')](),controller[_0xf833('0xb')]);router[_0xf833('0x6')]('/:id/summary',auth['isAuthenticated'](),timeout(_0xf833('0xc')),controller[_0xf833('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf833('0xe')]);router[_0xf833('0xf')](_0xf833('0x10'),auth[_0xf833('0x8')](),controller[_0xf833('0x11')]);router[_0xf833('0x12')]('/:id',auth[_0xf833('0x8')](),controller[_0xf833('0x13')]);router['delete']('/:id',auth[_0xf833('0x8')](),controller[_0xf833('0x14')]);module[_0xf833('0x15')]=router; \ No newline at end of file +var _0x64c9=['/:id/clone','clone','put','delete','destroy','exports','util','express','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','/:id/sessions','getSessions','/:id/answers','getSummary','post','create'];(function(_0x39dabd,_0x15e682){var _0x5ddfa6=function(_0xdbd601){while(--_0xdbd601){_0x39dabd['push'](_0x39dabd['shift']());}};_0x5ddfa6(++_0x15e682);}(_0x64c9,0x1d2));var _0x964c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64c9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x964c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x964c('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x964c('0x2'));var config=require('../../config/environment');var controller=require(_0x964c('0x3'));router['get']('/',auth[_0x964c('0x4')](),controller[_0x964c('0x5')]);router[_0x964c('0x6')](_0x964c('0x7'),auth[_0x964c('0x4')](),controller['show']);router['get'](_0x964c('0x8'),auth[_0x964c('0x4')](),controller[_0x964c('0x9')]);router[_0x964c('0x6')](_0x964c('0xa'),auth[_0x964c('0x4')](),controller['getAnswers']);router['get']('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0x964c('0xb')]);router[_0x964c('0xc')]('/',auth[_0x964c('0x4')](),controller[_0x964c('0xd')]);router['post'](_0x964c('0xe'),auth[_0x964c('0x4')](),controller[_0x964c('0xf')]);router[_0x964c('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x964c('0x11')]('/:id',auth[_0x964c('0x4')](),controller[_0x964c('0x12')]);module[_0x964c('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6e326a2..281f4f7 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 _0x2cd9=['STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0x2c8be2,_0x16dc35){var _0x4543fa=function(_0x2b7d24){while(--_0x2b7d24){_0x2c8be2['push'](_0x2c8be2['shift']());}};_0x4543fa(++_0x16dc35);}(_0x2cd9,0x93));var _0x92cd=function(_0x286acf,_0x5098fe){_0x286acf=_0x286acf-0x0;var _0x122632=_0x2cd9[_0x286acf];return _0x122632;};'use strict';var Sequelize=require(_0x92cd('0x0'));var _=require('lodash');var util=require(_0x92cd('0x1'));module[_0x92cd('0x2')]={'name':{'type':Sequelize[_0x92cd('0x3')],'unique':_0x92cd('0x4')},'description':{'type':Sequelize[_0x92cd('0x3')]},'formData':{'type':Sequelize[_0x92cd('0x5')](_0x92cd('0x6')),'set':function(_0x3d66b8){if(_[_0x92cd('0x7')](_0x3d66b8)){this[_0x92cd('0x8')](_0x92cd('0x9'),JSON[_0x92cd('0xa')](_0x3d66b8));}else if(_['isString'](_0x3d66b8)){this[_0x92cd('0x8')](_0x92cd('0x9'),_0x3d66b8);}else{this[_0x92cd('0x8')]('formData',util[_0x92cd('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x92cd('0xc')](_0x92cd('0x4'))||'',this[_0x92cd('0xc')](_0x92cd('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x92cd('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x92cd('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xbf7a=['util','exports','STRING','name','TEXT','isObjectLike','formData','stringify','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xbf7a,0x193));var _0xabf7=function(_0x56254d,_0x517d7d){_0x56254d=_0x56254d-0x0;var _0x2ba6ec=_0xbf7a[_0x56254d];return _0x2ba6ec;};'use strict';var Sequelize=require(_0xabf7('0x0'));var _=require(_0xabf7('0x1'));var util=require(_0xabf7('0x2'));module[_0xabf7('0x3')]={'name':{'type':Sequelize[_0xabf7('0x4')],'unique':_0xabf7('0x5')},'description':{'type':Sequelize[_0xabf7('0x4')]},'formData':{'type':Sequelize[_0xabf7('0x6')]('long'),'set':function(_0x29d26c){if(_[_0xabf7('0x7')](_0x29d26c)){this['setDataValue'](_0xabf7('0x8'),JSON[_0xabf7('0x9')](_0x29d26c));}else if(_[_0xabf7('0xa')](_0x29d26c)){this[_0xabf7('0xb')](_0xabf7('0x8'),_0x29d26c);}else{this[_0xabf7('0xb')]('formData',util['format'](_0xabf7('0xc'),this['getDataValue']('name')||'',this[_0xabf7('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xabf7('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index bd29752..f39377d 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 _0x281d=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','omit','UserProfileSection','getSessions','findOne','JscriptySessionReport','order','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','hasOwnProperty','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','sendStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','rows','show','include'];(function(_0x67c7f5,_0x167843){var _0x48dc46=function(_0xa91709){while(--_0xa91709){_0x67c7f5['push'](_0x67c7f5['shift']());}};_0x48dc46(++_0x167843);}(_0x281d,0x195));var _0xd281=function(_0x15f774,_0x53de2f){_0x15f774=_0x15f774-0x0;var _0x158ef6=_0x281d[_0x15f774];return _0x158ef6;};'use strict';var emlformat=require(_0xd281('0x0'));var rimraf=require(_0xd281('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd281('0x2'));var rp=require(_0xd281('0x3'));var moment=require(_0xd281('0x4'));var BPromise=require(_0xd281('0x5'));var Mustache=require(_0xd281('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd281('0x7'));var csv=require(_0xd281('0x8'));var ejs=require(_0xd281('0x9'));var fs=require('fs');var fs_extra=require(_0xd281('0xa'));var _=require('lodash');var squel=require(_0xd281('0xb'));var crypto=require('crypto');var jsforce=require(_0xd281('0xc'));var deskjs=require(_0xd281('0xd'));var toCsv=require(_0xd281('0x8'));var querystring=require(_0xd281('0xe'));var Papa=require(_0xd281('0xf'));var Redis=require(_0xd281('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd281('0x11'));var as=require(_0xd281('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd281('0x13'))(_0xd281('0x14'));var utils=require(_0xd281('0x15'));var config=require(_0xd281('0x16'));var licenseUtil=require(_0xd281('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f9785,_0x34f63a){_0x34f63a=_0x34f63a||0xcc;return function(_0x1f3000){if(_0x1f3000){return _0x2f9785['sendStatus'](_0x34f63a);}return _0x2f9785[_0xd281('0x18')](_0x34f63a)[_0xd281('0x19')]();};}function respondWithResult(_0x14765e,_0x2e12f4){_0x2e12f4=_0x2e12f4||0xc8;return function(_0x4de9e9){if(_0x4de9e9){return _0x14765e[_0xd281('0x18')](_0x2e12f4)[_0xd281('0x1a')](_0x4de9e9);}};}function respondWithFilteredResult(_0x46f573,_0x2bd07c){return function(_0x22d167){if(_0x22d167){var _0x3a1609=typeof _0x2bd07c[_0xd281('0x1b')]===_0xd281('0x1c')&&typeof _0x2bd07c[_0xd281('0x1d')]===_0xd281('0x1c');var _0x4993fb=_0x22d167[_0xd281('0x1e')];var _0x537002=_0x3a1609?0x0:_0x2bd07c[_0xd281('0x1b')];var _0x3e9ee0=_0x3a1609?_0x22d167['count']:_0x2bd07c[_0xd281('0x1b')]+_0x2bd07c[_0xd281('0x1d')];var _0x2144b1;if(_0x3e9ee0>=_0x4993fb){_0x3e9ee0=_0x4993fb;_0x2144b1=0xc8;}else{_0x2144b1=0xce;}_0x46f573[_0xd281('0x18')](_0x2144b1);return _0x46f573[_0xd281('0x1f')](_0xd281('0x20'),_0x537002+'-'+_0x3e9ee0+'/'+_0x4993fb)['json'](_0x22d167);}return null;};}function patchUpdates(_0xcf20e6){return function(_0x13e796){try{jsonpatch[_0xd281('0x21')](_0x13e796,_0xcf20e6,!![]);}catch(_0x6f1f58){return BPromise[_0xd281('0x22')](_0x6f1f58);}return _0x13e796['save']();};}function saveUpdates(_0x1d6b91,_0x5a2416){return function(_0x1ec197){if(_0x1ec197){return _0x1ec197[_0xd281('0x23')](_0x1d6b91)[_0xd281('0x24')](function(_0x2e1798){return _0x2e1798;});}return null;};}function removeEntity(_0x67e9b6,_0x352c3b){return function(_0x3a15ce){if(_0x3a15ce){return _0x3a15ce[_0xd281('0x25')]()[_0xd281('0x24')](function(){var _0xa7165b=_0x3a15ce[_0xd281('0x26')]({'plain':!![]});var _0x4998b5=_0xd281('0x27');return db[_0xd281('0x28')][_0xd281('0x25')]({'where':{'type':_0x4998b5,'resourceId':_0xa7165b['id']}})[_0xd281('0x24')](function(){return _0x3a15ce;});})['then'](function(){_0x67e9b6[_0xd281('0x18')](0xcc)[_0xd281('0x19')]();});}};}function handleEntityNotFound(_0x3df7e5,_0x4b9e04){return function(_0x41ae36){if(!_0x41ae36){_0x3df7e5['sendStatus'](0x194);}return _0x41ae36;};}function handleError(_0x59862c,_0x21ad56){_0x21ad56=_0x21ad56||0x1f4;return function(_0x2172a4){logger[_0xd281('0x29')](_0x2172a4[_0xd281('0x2a')]);if(_0x2172a4['name']){delete _0x2172a4[_0xd281('0x2b')];}_0x59862c[_0xd281('0x18')](_0x21ad56)[_0xd281('0x2c')](_0x2172a4);};}exports[_0xd281('0x2d')]=function(_0x49c656,_0x5ef27d){var _0x113c75={},_0x4b2d64={},_0x548984={'count':0x0,'rows':[]};var _0x35690b=_[_0xd281('0x2e')](db[_0xd281('0x2f')][_0xd281('0x30')],function(_0x5d08c0){return{'name':_0x5d08c0[_0xd281('0x31')],'type':_0x5d08c0['type'][_0xd281('0x32')]};});_0x4b2d64[_0xd281('0x33')]=_['map'](_0x35690b,_0xd281('0x2b'));_0x4b2d64[_0xd281('0x34')]=_[_0xd281('0x35')](_0x49c656['query']);_0x4b2d64[_0xd281('0x36')]=_[_0xd281('0x37')](_0x4b2d64[_0xd281('0x33')],_0x4b2d64[_0xd281('0x34')]);_0x113c75[_0xd281('0x38')]=_[_0xd281('0x37')](_0x4b2d64['model'],qs[_0xd281('0x39')](_0x49c656[_0xd281('0x34')][_0xd281('0x39')]));_0x113c75[_0xd281('0x38')]=_0x113c75[_0xd281('0x38')][_0xd281('0x3a')]?_0x113c75['attributes']:_0x4b2d64[_0xd281('0x33')];if(!_0x49c656[_0xd281('0x34')]['hasOwnProperty'](_0xd281('0x3b'))){_0x113c75[_0xd281('0x1d')]=qs['limit'](_0x49c656[_0xd281('0x34')][_0xd281('0x1d')]);_0x113c75['offset']=qs[_0xd281('0x1b')](_0x49c656[_0xd281('0x34')][_0xd281('0x1b')]);}_0x113c75['order']=qs[_0xd281('0x3c')](_0x49c656['query'][_0xd281('0x3c')]);_0x113c75[_0xd281('0x3d')]=qs['filters'](_[_0xd281('0x3e')](_0x49c656['query'],_0x4b2d64[_0xd281('0x36')]),_0x35690b);if(_0x49c656[_0xd281('0x34')][_0xd281('0x3f')]){_0x113c75[_0xd281('0x3d')]=_[_0xd281('0x40')](_0x113c75[_0xd281('0x3d')],{'$or':_[_0xd281('0x2e')](_0x35690b,function(_0x29769c){if(_0x29769c[_0xd281('0x41')]!=='VIRTUAL'){var _0x151b69={};_0x151b69[_0x29769c['name']]={'$like':'%'+_0x49c656[_0xd281('0x34')][_0xd281('0x3f')]+'%'};return _0x151b69;}})});}_0x113c75=_['merge']({},_0x113c75,_0x49c656[_0xd281('0x42')]);var _0x3bcc8b={'where':_0x113c75[_0xd281('0x3d')]};return db['JscriptyProject'][_0xd281('0x1e')](_0x3bcc8b)[_0xd281('0x24')](function(_0xbc05a2){_0x548984[_0xd281('0x1e')]=_0xbc05a2;if(_0x49c656[_0xd281('0x34')][_0xd281('0x43')]){_0x113c75['include']=[{'all':!![]}];}return db[_0xd281('0x2f')]['findAll'](_0x113c75);})[_0xd281('0x24')](function(_0x33caaa){_0x548984[_0xd281('0x44')]=_0x33caaa;return _0x548984;})[_0xd281('0x24')](respondWithFilteredResult(_0x5ef27d,_0x113c75))['catch'](handleError(_0x5ef27d,null));};exports[_0xd281('0x45')]=function(_0x2b624a,_0x2535c3){var _0x5caff8={'raw':![],'where':{'id':_0x2b624a['params']['id']}},_0x50d958={};_0x50d958['model']=_[_0xd281('0x35')](db[_0xd281('0x2f')][_0xd281('0x30')]);_0x50d958[_0xd281('0x34')]=_['keys'](_0x2b624a[_0xd281('0x34')]);_0x50d958[_0xd281('0x36')]=_[_0xd281('0x37')](_0x50d958['model'],_0x50d958[_0xd281('0x34')]);_0x5caff8[_0xd281('0x38')]=_[_0xd281('0x37')](_0x50d958[_0xd281('0x33')],qs[_0xd281('0x39')](_0x2b624a[_0xd281('0x34')][_0xd281('0x39')]));_0x5caff8[_0xd281('0x38')]=_0x5caff8[_0xd281('0x38')]['length']?_0x5caff8[_0xd281('0x38')]:_0x50d958['model'];if(_0x2b624a[_0xd281('0x34')][_0xd281('0x43')]){_0x5caff8[_0xd281('0x46')]=[{'all':!![]}];}_0x5caff8=_[_0xd281('0x40')]({},_0x5caff8,_0x2b624a[_0xd281('0x42')]);return db[_0xd281('0x2f')]['find'](_0x5caff8)['then'](handleEntityNotFound(_0x2535c3,null))[_0xd281('0x24')](respondWithResult(_0x2535c3,null))[_0xd281('0x47')](handleError(_0x2535c3,null));};exports[_0xd281('0x48')]=function(_0x257c7b,_0xa72d34){return db['JscriptyProject'][_0xd281('0x48')](_0x257c7b[_0xd281('0x49')],{})[_0xd281('0x24')](function(_0x443582){var _0xee2a2f=_0x257c7b[_0xd281('0x4a')][_0xd281('0x26')]({'plain':!![]});if(!_0xee2a2f)throw new Error(_0xd281('0x4b'));if(_0xee2a2f[_0xd281('0x4c')]===_0xd281('0x4a')){var _0x49f580=_0x443582['get']({'plain':!![]});var _0x5d4b71='Projects';return db['UserProfileSection'][_0xd281('0x4d')]({'where':{'name':_0x5d4b71,'userProfileId':_0xee2a2f[_0xd281('0x4e')]},'raw':!![]})[_0xd281('0x24')](function(_0x50bd6f){if(_0x50bd6f&&_0x50bd6f[_0xd281('0x4f')]===0x0){return db['UserProfileResource'][_0xd281('0x48')]({'name':_0x49f580[_0xd281('0x2b')],'resourceId':_0x49f580['id'],'type':_0x50bd6f[_0xd281('0x2b')],'sectionId':_0x50bd6f['id']},{})[_0xd281('0x24')](function(){return _0x443582;});}else{return _0x443582;}})[_0xd281('0x47')](function(_0x419023){logger[_0xd281('0x29')](_0xd281('0x50'),_0x419023);throw _0x419023;});}return _0x443582;})[_0xd281('0x24')](respondWithResult(_0xa72d34,0xc9))[_0xd281('0x47')](handleError(_0xa72d34,null));};exports['clone']=function(_0x20c1b7,_0x4c3ca2){var _0x44efe0={'where':{'id':_0x20c1b7[_0xd281('0x51')]['id']}},_0x1a120c={};_0x1a120c[_0xd281('0x33')]=_[_0xd281('0x35')](db['JscriptyProject']['rawAttributes']);_0x44efe0['attributes']=_[_0xd281('0x37')](_0x1a120c[_0xd281('0x33')],qs[_0xd281('0x39')](_0x20c1b7[_0xd281('0x34')][_0xd281('0x39')]));_0x44efe0[_0xd281('0x38')]=_0x44efe0[_0xd281('0x38')]['length']?_0x44efe0[_0xd281('0x38')]:_0x1a120c[_0xd281('0x33')];if(_0x20c1b7[_0xd281('0x34')]['includeAll']){_0x44efe0[_0xd281('0x46')]=[{'all':!![]}];}_0x44efe0=_[_0xd281('0x40')]({},_0x44efe0,_0x20c1b7[_0xd281('0x42')]);return db[_0xd281('0x2f')][_0xd281('0x4d')](_0x44efe0)[_0xd281('0x24')](handleEntityNotFound(_0x4c3ca2,null))['then'](function(_0x2c7e26){if(_0x2c7e26){var _0x2ad66a=_0x2c7e26[_0xd281('0x26')]({'plain':!![]});_0x2ad66a=qs['omit'](_0x2ad66a,['id',_0xd281('0x52'),_0xd281('0x53')]);_0x20c1b7[_0xd281('0x49')]=_[_0xd281('0x54')](_0x20c1b7[_0xd281('0x49')],['id',_0xd281('0x52'),_0xd281('0x53')]);return db[_0xd281('0x2f')][_0xd281('0x48')](_['merge'](_0x2ad66a,_0x20c1b7[_0xd281('0x49')]),{'include':_0x20c1b7[_0xd281('0x34')][_0xd281('0x43')]?[{'all':!![]}]:undefined})[_0xd281('0x24')](function(_0x297fe5){var _0x17ac1b=_0x20c1b7['user'][_0xd281('0x26')]({'plain':!![]});if(!_0x17ac1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17ac1b[_0xd281('0x4c')]===_0xd281('0x4a')){var _0x3e5c1d=_0x297fe5[_0xd281('0x26')]({'plain':!![]});var _0x4c33b9=_0xd281('0x27');return db[_0xd281('0x55')][_0xd281('0x4d')]({'where':{'name':_0x4c33b9,'userProfileId':_0x17ac1b['userProfileId']},'raw':!![]})[_0xd281('0x24')](function(_0xa173ce){if(_0xa173ce&&_0xa173ce[_0xd281('0x4f')]===0x0){return db[_0xd281('0x28')][_0xd281('0x48')]({'name':_0x3e5c1d[_0xd281('0x2b')],'resourceId':_0x3e5c1d['id'],'type':_0xa173ce[_0xd281('0x2b')],'sectionId':_0xa173ce['id']},{})[_0xd281('0x24')](function(){return _0x297fe5;});}else{return _0x297fe5;}})[_0xd281('0x47')](function(_0x4fd523){logger[_0xd281('0x29')](_0xd281('0x50'),_0x4fd523);throw _0x4fd523;});}return _0x297fe5;});}})[_0xd281('0x24')](respondWithResult(_0x4c3ca2,0xc9))[_0xd281('0x47')](handleError(_0x4c3ca2,null));};exports[_0xd281('0x23')]=function(_0x1e63d5,_0x2c6ff6){if(_0x1e63d5[_0xd281('0x49')]['id']){delete _0x1e63d5['body']['id'];}return db[_0xd281('0x2f')]['find']({'where':{'id':_0x1e63d5[_0xd281('0x51')]['id']}})[_0xd281('0x24')](handleEntityNotFound(_0x2c6ff6,null))['then'](saveUpdates(_0x1e63d5[_0xd281('0x49')],null))[_0xd281('0x24')](respondWithResult(_0x2c6ff6,null))[_0xd281('0x47')](handleError(_0x2c6ff6,null));};exports[_0xd281('0x25')]=function(_0x49d9ea,_0x28632b){return db['JscriptyProject'][_0xd281('0x4d')]({'where':{'id':_0x49d9ea[_0xd281('0x51')]['id']}})['then'](handleEntityNotFound(_0x28632b,null))[_0xd281('0x24')](removeEntity(_0x28632b,null))[_0xd281('0x47')](handleError(_0x28632b,null));};exports[_0xd281('0x56')]=function(_0x6b4e5,_0x3670b5,_0x3e5ed5){var _0xf6cbcb={'raw':!![],'where':{}};var _0x2a1a8f={};var _0x2e5bf4={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd281('0x57')]({'where':{'id':_0x6b4e5[_0xd281('0x51')]['id']}})[_0xd281('0x24')](handleEntityNotFound(_0x3670b5,null))['then'](function(_0x1ca508){if(_0x1ca508){_0x2a1a8f[_0xd281('0x33')]=_['keys'](db[_0xd281('0x58')][_0xd281('0x30')]);_0x2a1a8f['query']=_[_0xd281('0x35')](_0x6b4e5[_0xd281('0x34')]);_0x2a1a8f[_0xd281('0x36')]=_[_0xd281('0x37')](_0x2a1a8f[_0xd281('0x33')],_0x2a1a8f['query']);_0xf6cbcb[_0xd281('0x38')]=_[_0xd281('0x37')](_0x2a1a8f[_0xd281('0x33')],qs[_0xd281('0x39')](_0x6b4e5[_0xd281('0x34')][_0xd281('0x39')]));_0xf6cbcb[_0xd281('0x38')]=_0xf6cbcb['attributes'][_0xd281('0x3a')]?_0xf6cbcb[_0xd281('0x38')]:_0x2a1a8f[_0xd281('0x33')];if(!_0x6b4e5[_0xd281('0x34')]['hasOwnProperty'](_0xd281('0x3b'))){_0xf6cbcb[_0xd281('0x1d')]=qs['limit'](_0x6b4e5['query'][_0xd281('0x1d')]);_0xf6cbcb[_0xd281('0x1b')]=qs['offset'](_0x6b4e5[_0xd281('0x34')][_0xd281('0x1b')]);}_0xf6cbcb[_0xd281('0x59')]=qs[_0xd281('0x3c')](_0x6b4e5[_0xd281('0x34')][_0xd281('0x3c')]);_0xf6cbcb[_0xd281('0x3d')]=qs['filters'](_[_0xd281('0x3e')](_0x6b4e5['query'],_0x2a1a8f[_0xd281('0x36')]));_0xf6cbcb[_0xd281('0x3d')][_0xd281('0x5a')]=_0x1ca508['id'];if(_0x6b4e5[_0xd281('0x34')][_0xd281('0x3f')]){_0xf6cbcb[_0xd281('0x3d')]=_[_0xd281('0x40')](_0xf6cbcb[_0xd281('0x3d')],{'$or':_['map'](_0xf6cbcb[_0xd281('0x38')],function(_0x392da4){var _0x1c56ec={};_0x1c56ec[_0x392da4]={'$like':'%'+_0x6b4e5[_0xd281('0x34')][_0xd281('0x3f')]+'%'};return _0x1c56ec;})});}_0xf6cbcb=_[_0xd281('0x40')]({},_0xf6cbcb,_0x6b4e5[_0xd281('0x42')]);return db[_0xd281('0x58')][_0xd281('0x1e')]({'where':_0xf6cbcb['where']})[_0xd281('0x24')](function(_0x2ca34c){_0x2e5bf4[_0xd281('0x1e')]=_0x2ca34c;if(_0x6b4e5[_0xd281('0x34')][_0xd281('0x43')]){_0xf6cbcb[_0xd281('0x46')]=[{'all':!![]}];}return db[_0xd281('0x58')][_0xd281('0x5b')](_0xf6cbcb);})[_0xd281('0x24')](function(_0x245831){_0x2e5bf4['rows']=_0x245831;return _0x2e5bf4;});}})[_0xd281('0x24')](respondWithFilteredResult(_0x3670b5,_0xf6cbcb))['catch'](handleError(_0x3670b5,null));};exports[_0xd281('0x5c')]=function(_0xec1a4,_0x2304b9,_0xe66e14){var _0x5b9f73={'raw':!![],'where':{}};var _0x4ab061={};var _0x2c904e={'count':0x0,'rows':[]};return db[_0xd281('0x2f')]['findOne']({'where':{'id':_0xec1a4[_0xd281('0x51')]['id']}})[_0xd281('0x24')](handleEntityNotFound(_0x2304b9,null))['then'](function(_0x973f36){if(_0x973f36){_0x4ab061[_0xd281('0x33')]=_[_0xd281('0x35')](db[_0xd281('0x5d')]['rawAttributes']);_0x4ab061['query']=_['keys'](_0xec1a4[_0xd281('0x34')]);_0x4ab061[_0xd281('0x36')]=_['intersection'](_0x4ab061[_0xd281('0x33')],_0x4ab061[_0xd281('0x34')]);_0x5b9f73['attributes']=_[_0xd281('0x37')](_0x4ab061['model'],qs['fields'](_0xec1a4[_0xd281('0x34')][_0xd281('0x39')]));_0x5b9f73['attributes']=_0x5b9f73['attributes'][_0xd281('0x3a')]?_0x5b9f73[_0xd281('0x38')]:_0x4ab061[_0xd281('0x33')];if(!_0xec1a4['query']['hasOwnProperty'](_0xd281('0x3b'))){_0x5b9f73[_0xd281('0x1d')]=qs[_0xd281('0x1d')](_0xec1a4[_0xd281('0x34')][_0xd281('0x1d')]);_0x5b9f73[_0xd281('0x1b')]=qs[_0xd281('0x1b')](_0xec1a4['query'][_0xd281('0x1b')]);}_0x5b9f73[_0xd281('0x59')]=qs[_0xd281('0x3c')](_0xec1a4[_0xd281('0x34')][_0xd281('0x3c')]);_0x5b9f73[_0xd281('0x3d')]=qs[_0xd281('0x36')](_[_0xd281('0x3e')](_0xec1a4['query'],_0x4ab061[_0xd281('0x36')]));_0x5b9f73[_0xd281('0x3d')][_0xd281('0x5a')]=_0x973f36['id'];if(_0xec1a4[_0xd281('0x34')][_0xd281('0x3f')]){_0x5b9f73[_0xd281('0x3d')]=_[_0xd281('0x40')](_0x5b9f73['where'],{'$or':_[_0xd281('0x2e')](_0x5b9f73[_0xd281('0x38')],function(_0x4f7d2a){var _0x25f076={};_0x25f076[_0x4f7d2a]={'$like':'%'+_0xec1a4[_0xd281('0x34')][_0xd281('0x3f')]+'%'};return _0x25f076;})});}_0x5b9f73=_[_0xd281('0x40')]({},_0x5b9f73,_0xec1a4[_0xd281('0x42')]);return db['JscriptyAnswerReport'][_0xd281('0x1e')]({'where':_0x5b9f73[_0xd281('0x3d')]})['then'](function(_0x5dff26){_0x2c904e[_0xd281('0x1e')]=_0x5dff26;if(_0xec1a4[_0xd281('0x34')]['includeAll']){_0x5b9f73[_0xd281('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd281('0x5b')](_0x5b9f73);})[_0xd281('0x24')](function(_0x2f2676){_0x2c904e['rows']=_0x2f2676;return _0x2c904e;});}})[_0xd281('0x24')](respondWithFilteredResult(_0x2304b9,_0x5b9f73))['catch'](handleError(_0x2304b9,null));};function char(_0x218823){return _0xd281('0x5e')===typeof _0x218823?String['fromCharCode'][_0xd281('0x21')](null,arguments):_0x218823;}function needsEncapsulation(_0x512c2e){return!!_0x512c2e&&(_0x512c2e[_0xd281('0x5f')]()[_0xd281('0x60')](char(0xd))>=0x0||_0x512c2e['toString']()[_0xd281('0x60')](char(0xa))>=0x0||_0x512c2e[_0xd281('0x5f')]()[_0xd281('0x60')](char(0x2c))>=0x0||_0x512c2e[_0xd281('0x5f')]()[_0xd281('0x60')](char(0x22))>=0x0);}function encapsulate(_0x5c9641){var _0xf7bc0d=char(0x22),_0x438145='\x5c'+char(0x22),_0x577b7f=_0x5c9641[_0xd281('0x5f')]()['replace'](new RegExp(_0xf7bc0d,'g'),_0x438145);return _0xf7bc0d+_0x577b7f+_0xf7bc0d;}exports[_0xd281('0x61')]=function(_0x3b68a8,_0x5476a7,_0x22e5e9){var _0x2443ef,_0x54dc57;var _0x8b37e1={'where':{'ProjectId':_0x3b68a8[_0xd281('0x51')]['id']}};if(_0x3b68a8[_0xd281('0x34')][_0xd281('0x62')]){_0x8b37e1[_0xd281('0x3d')][_0xd281('0x63')]=JSON[_0xd281('0x64')](_0x3b68a8[_0xd281('0x34')]['startTime']);}return db[_0xd281('0x58')]['findAll'](_0x8b37e1)[_0xd281('0x24')](handleEntityNotFound(_0x5476a7,null))['then'](function(_0x1b1dfa){if(_0x1b1dfa){_0x2443ef=_0x1b1dfa;return db[_0xd281('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0xd281('0x2e')](_0x2443ef,'id')},'ProjectId':_0x3b68a8['params']['id']},'order':_0xd281('0x66')});}})[_0xd281('0x24')](handleEntityNotFound(_0x5476a7,null))[_0xd281('0x24')](function(_0x350b9d){if(_0x350b9d){_0x54dc57=_0x350b9d;var _0x13a154={};for(var _0x1f19f1=0x0,_0x541b1c=_0x54dc57[_0xd281('0x3a')];_0x1f19f1<_0x541b1c;_0x1f19f1++){if(!_0x13a154[_0xd281('0x67')](_0x54dc57[_0x1f19f1][_0xd281('0x68')])){_0x13a154[_0x54dc57[_0x1f19f1][_0xd281('0x68')]]=needsEncapsulation(_0x54dc57[_0x1f19f1][_0xd281('0x69')])?encapsulate(_0x54dc57[_0x1f19f1][_0xd281('0x69')]):_0x54dc57[_0x1f19f1][_0xd281('0x69')];}}var _0x153fa4=[],_0x467c85={};for(var _0x5b9171=0x0,_0x3acf9f=_0x2443ef[_0xd281('0x3a')];_0x5b9171<_0x3acf9f;_0x5b9171++){_0x467c85={'ProjectId':_0x3b68a8['params']['id'],'SessionId':_0x2443ef[_0x5b9171]['id'],'StartTime':moment(_0x2443ef[_0x5b9171][_0xd281('0x63')])[_0xd281('0x6a')](_0xd281('0x6b'))};for(var _0x4568ba=0x0,_0x53b66f=_0x54dc57[_0xd281('0x3a')];_0x4568ba<_0x53b66f;_0x4568ba++){if(_0x54dc57[_0x4568ba][_0xd281('0x6c')]==_0x2443ef[_0x5b9171]['id']&&_0x13a154[_0xd281('0x67')](_0x54dc57[_0x4568ba][_0xd281('0x68')])){_0x467c85[_0x13a154[_0x54dc57[_0x4568ba][_0xd281('0x68')]]]=_0x54dc57[_0x4568ba][_0xd281('0x6d')];}}for(var _0x117538 in _0x13a154){if(!_0x467c85[_0xd281('0x67')](_0x13a154[_0x117538])){_0x467c85[_0x13a154[_0x117538]]=null;}}_0x153fa4['push'](_0x467c85);}return _0x153fa4;}})[_0xd281('0x24')](function(_0x266238){if(!_[_0xd281('0x6e')](_0x266238)){var _0x3a3bba=toCsv(_0x266238);var _0x1860b4=Date[_0xd281('0x6f')]();fs['writeFileSync'](util[_0xd281('0x6a')](_0xd281('0x70'),_0x3b68a8[_0xd281('0x51')]['id'],_0x1860b4),_0x3a3bba);_0x5476a7[_0xd281('0x71')]('Content-disposition',_0xd281('0x72')+util[_0xd281('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x3b68a8[_0xd281('0x51')]['id'],_0x1860b4));_0x5476a7['setHeader'](_0xd281('0x73'),_0xd281('0x74'));return _0x5476a7[_0xd281('0x75')](util[_0xd281('0x6a')](_0xd281('0x70'),_0x3b68a8[_0xd281('0x51')]['id'],_0x1860b4));}else{return _0x5476a7[_0xd281('0x76')](0xcc);}})[_0xd281('0x47')](handleError(_0x5476a7,null));}; \ No newline at end of file +var _0xd959=['answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','catch','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','SessionId'];(function(_0x9c8bf7,_0x1f3655){var _0x586c15=function(_0x371e6c){while(--_0x371e6c){_0x9c8bf7['push'](_0x9c8bf7['shift']());}};_0x586c15(++_0x1f3655);}(_0xd959,0x1f3));var _0x9d95=function(_0x4b6c63,_0x5b30ee){_0x4b6c63=_0x4b6c63-0x0;var _0x4e585a=_0xd959[_0x4b6c63];return _0x4e585a;};'use strict';var emlformat=require(_0x9d95('0x0'));var rimraf=require(_0x9d95('0x1'));var zipdir=require(_0x9d95('0x2'));var jsonpatch=require(_0x9d95('0x3'));var rp=require(_0x9d95('0x4'));var moment=require(_0x9d95('0x5'));var BPromise=require(_0x9d95('0x6'));var Mustache=require(_0x9d95('0x7'));var util=require(_0x9d95('0x8'));var path=require('path');var sox=require(_0x9d95('0x9'));var csv=require('to-csv');var ejs=require(_0x9d95('0xa'));var fs=require('fs');var fs_extra=require(_0x9d95('0xb'));var _=require(_0x9d95('0xc'));var squel=require(_0x9d95('0xd'));var crypto=require('crypto');var jsforce=require(_0x9d95('0xe'));var deskjs=require(_0x9d95('0xf'));var toCsv=require(_0x9d95('0x10'));var querystring=require(_0x9d95('0x11'));var Papa=require(_0x9d95('0x12'));var Redis=require(_0x9d95('0x13'));var authService=require(_0x9d95('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9d95('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d95('0x16'))(_0x9d95('0x17'));var utils=require(_0x9d95('0x18'));var config=require(_0x9d95('0x19'));var licenseUtil=require(_0x9d95('0x1a'));var db=require(_0x9d95('0x1b'))['db'];function respondWithStatusCode(_0x2f80bf,_0x569f54){_0x569f54=_0x569f54||0xcc;return function(_0x2a04cd){if(_0x2a04cd){return _0x2f80bf['sendStatus'](_0x569f54);}return _0x2f80bf[_0x9d95('0x1c')](_0x569f54)[_0x9d95('0x1d')]();};}function respondWithResult(_0x567bc6,_0x5ea357){_0x5ea357=_0x5ea357||0xc8;return function(_0x1b6b55){if(_0x1b6b55){return _0x567bc6['status'](_0x5ea357)[_0x9d95('0x1e')](_0x1b6b55);}};}function respondWithFilteredResult(_0x26fa2c,_0x292508){return function(_0x5ef39e){if(_0x5ef39e){var _0x177474=typeof _0x292508[_0x9d95('0x1f')]==='undefined'&&typeof _0x292508[_0x9d95('0x20')]===_0x9d95('0x21');var _0x44a86f=_0x5ef39e['count'];var _0xeb7839=_0x177474?0x0:_0x292508['offset'];var _0x42ec86=_0x177474?_0x5ef39e[_0x9d95('0x22')]:_0x292508['offset']+_0x292508[_0x9d95('0x20')];var _0x3aa227;if(_0x42ec86>=_0x44a86f){_0x42ec86=_0x44a86f;_0x3aa227=0xc8;}else{_0x3aa227=0xce;}_0x26fa2c['status'](_0x3aa227);return _0x26fa2c[_0x9d95('0x23')](_0x9d95('0x24'),_0xeb7839+'-'+_0x42ec86+'/'+_0x44a86f)[_0x9d95('0x1e')](_0x5ef39e);}return null;};}function patchUpdates(_0x16d7de){return function(_0x160e52){try{jsonpatch[_0x9d95('0x25')](_0x160e52,_0x16d7de,!![]);}catch(_0xaa7220){return BPromise[_0x9d95('0x26')](_0xaa7220);}return _0x160e52['save']();};}function saveUpdates(_0x8b9722,_0x5cbcd4){return function(_0x418ac6){if(_0x418ac6){return _0x418ac6[_0x9d95('0x27')](_0x8b9722)[_0x9d95('0x28')](function(_0x28d1ba){return _0x28d1ba;});}return null;};}function removeEntity(_0x2e5de7,_0x2420ad){return function(_0x3d655f){if(_0x3d655f){return _0x3d655f[_0x9d95('0x29')]()[_0x9d95('0x28')](function(){var _0x1a1347=_0x3d655f[_0x9d95('0x2a')]({'plain':!![]});var _0x29e564=_0x9d95('0x2b');return db[_0x9d95('0x2c')]['destroy']({'where':{'type':_0x29e564,'resourceId':_0x1a1347['id']}})[_0x9d95('0x28')](function(){return _0x3d655f;});})['then'](function(){_0x2e5de7[_0x9d95('0x1c')](0xcc)[_0x9d95('0x1d')]();});}};}function handleEntityNotFound(_0xe74415,_0x308710){return function(_0x58255b){if(!_0x58255b){_0xe74415[_0x9d95('0x2d')](0x194);}return _0x58255b;};}function handleError(_0x3d4a93,_0x28cbf5){_0x28cbf5=_0x28cbf5||0x1f4;return function(_0x1515ba){logger[_0x9d95('0x2e')](_0x1515ba['stack']);if(_0x1515ba[_0x9d95('0x2f')]){delete _0x1515ba['name'];}_0x3d4a93[_0x9d95('0x1c')](_0x28cbf5)[_0x9d95('0x30')](_0x1515ba);};}exports[_0x9d95('0x31')]=function(_0x55def8,_0x54ca70){var _0x31d115={},_0x16f85f={},_0x2f65ba={'count':0x0,'rows':[]};var _0x20467b=_[_0x9d95('0x32')](db[_0x9d95('0x33')][_0x9d95('0x34')],function(_0x1a2893){return{'name':_0x1a2893['fieldName'],'type':_0x1a2893[_0x9d95('0x35')][_0x9d95('0x36')]};});_0x16f85f[_0x9d95('0x37')]=_[_0x9d95('0x32')](_0x20467b,'name');_0x16f85f[_0x9d95('0x38')]=_['keys'](_0x55def8[_0x9d95('0x38')]);_0x16f85f[_0x9d95('0x39')]=_[_0x9d95('0x3a')](_0x16f85f[_0x9d95('0x37')],_0x16f85f[_0x9d95('0x38')]);_0x31d115[_0x9d95('0x3b')]=_['intersection'](_0x16f85f[_0x9d95('0x37')],qs[_0x9d95('0x3c')](_0x55def8[_0x9d95('0x38')][_0x9d95('0x3c')]));_0x31d115[_0x9d95('0x3b')]=_0x31d115[_0x9d95('0x3b')][_0x9d95('0x3d')]?_0x31d115[_0x9d95('0x3b')]:_0x16f85f[_0x9d95('0x37')];if(!_0x55def8['query'][_0x9d95('0x3e')](_0x9d95('0x3f'))){_0x31d115[_0x9d95('0x20')]=qs[_0x9d95('0x20')](_0x55def8[_0x9d95('0x38')][_0x9d95('0x20')]);_0x31d115['offset']=qs[_0x9d95('0x1f')](_0x55def8['query'][_0x9d95('0x1f')]);}_0x31d115[_0x9d95('0x40')]=qs[_0x9d95('0x41')](_0x55def8[_0x9d95('0x38')][_0x9d95('0x41')]);_0x31d115[_0x9d95('0x42')]=qs[_0x9d95('0x39')](_[_0x9d95('0x43')](_0x55def8[_0x9d95('0x38')],_0x16f85f[_0x9d95('0x39')]),_0x20467b);if(_0x55def8[_0x9d95('0x38')][_0x9d95('0x44')]){_0x31d115[_0x9d95('0x42')]=_['merge'](_0x31d115['where'],{'$or':_['map'](_0x20467b,function(_0x14f4fd){if(_0x14f4fd['type']!==_0x9d95('0x45')){var _0x1c603f={};_0x1c603f[_0x14f4fd[_0x9d95('0x2f')]]={'$like':'%'+_0x55def8[_0x9d95('0x38')]['filter']+'%'};return _0x1c603f;}})});}_0x31d115=_[_0x9d95('0x46')]({},_0x31d115,_0x55def8[_0x9d95('0x47')]);var _0x2fc413={'where':_0x31d115[_0x9d95('0x42')]};return db[_0x9d95('0x33')][_0x9d95('0x22')](_0x2fc413)['then'](function(_0x4b28b8){_0x2f65ba[_0x9d95('0x22')]=_0x4b28b8;if(_0x55def8['query']['includeAll']){_0x31d115['include']=[{'all':!![]}];}return db[_0x9d95('0x33')][_0x9d95('0x48')](_0x31d115);})[_0x9d95('0x28')](function(_0x3500d6){_0x2f65ba['rows']=_0x3500d6;return _0x2f65ba;})['then'](respondWithFilteredResult(_0x54ca70,_0x31d115))[_0x9d95('0x49')](handleError(_0x54ca70,null));};exports['show']=function(_0x40c550,_0x160d99){var _0x4a6c36={'raw':![],'where':{'id':_0x40c550[_0x9d95('0x4a')]['id']}},_0x538a5b={};_0x538a5b[_0x9d95('0x37')]=_[_0x9d95('0x4b')](db[_0x9d95('0x33')][_0x9d95('0x34')]);_0x538a5b[_0x9d95('0x38')]=_[_0x9d95('0x4b')](_0x40c550[_0x9d95('0x38')]);_0x538a5b['filters']=_[_0x9d95('0x3a')](_0x538a5b[_0x9d95('0x37')],_0x538a5b[_0x9d95('0x38')]);_0x4a6c36['attributes']=_[_0x9d95('0x3a')](_0x538a5b['model'],qs[_0x9d95('0x3c')](_0x40c550[_0x9d95('0x38')][_0x9d95('0x3c')]));_0x4a6c36[_0x9d95('0x3b')]=_0x4a6c36[_0x9d95('0x3b')][_0x9d95('0x3d')]?_0x4a6c36[_0x9d95('0x3b')]:_0x538a5b[_0x9d95('0x37')];if(_0x40c550[_0x9d95('0x38')][_0x9d95('0x4c')]){_0x4a6c36[_0x9d95('0x4d')]=[{'all':!![]}];}_0x4a6c36=_['merge']({},_0x4a6c36,_0x40c550[_0x9d95('0x47')]);return db['JscriptyProject'][_0x9d95('0x4e')](_0x4a6c36)[_0x9d95('0x28')](handleEntityNotFound(_0x160d99,null))['then'](respondWithResult(_0x160d99,null))[_0x9d95('0x49')](handleError(_0x160d99,null));};exports['create']=function(_0x593700,_0x453c6f){return db['JscriptyProject'][_0x9d95('0x4f')](_0x593700[_0x9d95('0x50')],{})['then'](function(_0x3a2e17){var _0x19bfcb=_0x593700[_0x9d95('0x51')]['get']({'plain':!![]});if(!_0x19bfcb)throw new Error(_0x9d95('0x52'));if(_0x19bfcb[_0x9d95('0x53')]===_0x9d95('0x51')){var _0x14e0e5=_0x3a2e17[_0x9d95('0x2a')]({'plain':!![]});var _0x20a421=_0x9d95('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x20a421,'userProfileId':_0x19bfcb[_0x9d95('0x54')]},'raw':!![]})[_0x9d95('0x28')](function(_0x2c320f){if(_0x2c320f&&_0x2c320f[_0x9d95('0x55')]===0x0){return db[_0x9d95('0x2c')][_0x9d95('0x4f')]({'name':_0x14e0e5[_0x9d95('0x2f')],'resourceId':_0x14e0e5['id'],'type':_0x2c320f[_0x9d95('0x2f')],'sectionId':_0x2c320f['id']},{})[_0x9d95('0x28')](function(){return _0x3a2e17;});}else{return _0x3a2e17;}})[_0x9d95('0x49')](function(_0x6a6d8e){logger[_0x9d95('0x2e')](_0x9d95('0x56'),_0x6a6d8e);throw _0x6a6d8e;});}return _0x3a2e17;})[_0x9d95('0x28')](respondWithResult(_0x453c6f,0xc9))[_0x9d95('0x49')](handleError(_0x453c6f,null));};exports['clone']=function(_0x4c576c,_0x471b3c){var _0x5d996f={'where':{'id':_0x4c576c[_0x9d95('0x4a')]['id']}},_0x253918={};_0x253918[_0x9d95('0x37')]=_['keys'](db[_0x9d95('0x33')][_0x9d95('0x34')]);_0x5d996f[_0x9d95('0x3b')]=_[_0x9d95('0x3a')](_0x253918[_0x9d95('0x37')],qs[_0x9d95('0x3c')](_0x4c576c[_0x9d95('0x38')]['fields']));_0x5d996f[_0x9d95('0x3b')]=_0x5d996f[_0x9d95('0x3b')][_0x9d95('0x3d')]?_0x5d996f[_0x9d95('0x3b')]:_0x253918[_0x9d95('0x37')];if(_0x4c576c[_0x9d95('0x38')][_0x9d95('0x4c')]){_0x5d996f['include']=[{'all':!![]}];}_0x5d996f=_[_0x9d95('0x46')]({},_0x5d996f,_0x4c576c[_0x9d95('0x47')]);return db[_0x9d95('0x33')]['find'](_0x5d996f)[_0x9d95('0x28')](handleEntityNotFound(_0x471b3c,null))['then'](function(_0x558d72){if(_0x558d72){var _0x3ba079=_0x558d72['get']({'plain':!![]});_0x3ba079=qs[_0x9d95('0x57')](_0x3ba079,['id',_0x9d95('0x58'),'updatedAt']);_0x4c576c[_0x9d95('0x50')]=_[_0x9d95('0x57')](_0x4c576c[_0x9d95('0x50')],['id',_0x9d95('0x58'),_0x9d95('0x59')]);return db[_0x9d95('0x33')][_0x9d95('0x4f')](_['merge'](_0x3ba079,_0x4c576c[_0x9d95('0x50')]),{'include':_0x4c576c[_0x9d95('0x38')][_0x9d95('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x42cf94){var _0x5dd915=_0x4c576c['user']['get']({'plain':!![]});if(!_0x5dd915)throw new Error(_0x9d95('0x52'));if(_0x5dd915[_0x9d95('0x53')]===_0x9d95('0x51')){var _0x24783c=_0x42cf94[_0x9d95('0x2a')]({'plain':!![]});var _0x47dba2='Projects';return db['UserProfileSection'][_0x9d95('0x4e')]({'where':{'name':_0x47dba2,'userProfileId':_0x5dd915[_0x9d95('0x54')]},'raw':!![]})['then'](function(_0x555548){if(_0x555548&&_0x555548[_0x9d95('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x24783c[_0x9d95('0x2f')],'resourceId':_0x24783c['id'],'type':_0x555548['name'],'sectionId':_0x555548['id']},{})[_0x9d95('0x28')](function(){return _0x42cf94;});}else{return _0x42cf94;}})[_0x9d95('0x49')](function(_0x675572){logger[_0x9d95('0x2e')](_0x9d95('0x56'),_0x675572);throw _0x675572;});}return _0x42cf94;});}})[_0x9d95('0x28')](respondWithResult(_0x471b3c,0xc9))['catch'](handleError(_0x471b3c,null));};exports[_0x9d95('0x27')]=function(_0x341ea7,_0x5c2a67){if(_0x341ea7[_0x9d95('0x50')]['id']){delete _0x341ea7[_0x9d95('0x50')]['id'];}return db[_0x9d95('0x33')]['find']({'where':{'id':_0x341ea7[_0x9d95('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c2a67,null))[_0x9d95('0x28')](saveUpdates(_0x341ea7['body'],null))['then'](respondWithResult(_0x5c2a67,null))['catch'](handleError(_0x5c2a67,null));};exports[_0x9d95('0x29')]=function(_0x2ff0e9,_0x175f04){return db[_0x9d95('0x33')][_0x9d95('0x4e')]({'where':{'id':_0x2ff0e9[_0x9d95('0x4a')]['id']}})['then'](handleEntityNotFound(_0x175f04,null))[_0x9d95('0x28')](removeEntity(_0x175f04,null))[_0x9d95('0x49')](handleError(_0x175f04,null));};exports[_0x9d95('0x5a')]=function(_0x560969,_0x2a99e1,_0x2c89e7){var _0x225b70={'raw':!![],'where':{}};var _0x49d81b={};var _0x5d785f={'count':0x0,'rows':[]};return db[_0x9d95('0x33')][_0x9d95('0x5b')]({'where':{'id':_0x560969[_0x9d95('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a99e1,null))[_0x9d95('0x28')](function(_0x5c1283){if(_0x5c1283){_0x49d81b[_0x9d95('0x37')]=_['keys'](db[_0x9d95('0x5c')][_0x9d95('0x34')]);_0x49d81b['query']=_[_0x9d95('0x4b')](_0x560969['query']);_0x49d81b[_0x9d95('0x39')]=_[_0x9d95('0x3a')](_0x49d81b[_0x9d95('0x37')],_0x49d81b[_0x9d95('0x38')]);_0x225b70['attributes']=_['intersection'](_0x49d81b[_0x9d95('0x37')],qs['fields'](_0x560969[_0x9d95('0x38')]['fields']));_0x225b70[_0x9d95('0x3b')]=_0x225b70[_0x9d95('0x3b')][_0x9d95('0x3d')]?_0x225b70[_0x9d95('0x3b')]:_0x49d81b['model'];if(!_0x560969[_0x9d95('0x38')][_0x9d95('0x3e')](_0x9d95('0x3f'))){_0x225b70['limit']=qs[_0x9d95('0x20')](_0x560969[_0x9d95('0x38')][_0x9d95('0x20')]);_0x225b70[_0x9d95('0x1f')]=qs[_0x9d95('0x1f')](_0x560969[_0x9d95('0x38')]['offset']);}_0x225b70[_0x9d95('0x40')]=qs['sort'](_0x560969['query'][_0x9d95('0x41')]);_0x225b70['where']=qs[_0x9d95('0x39')](_[_0x9d95('0x43')](_0x560969[_0x9d95('0x38')],_0x49d81b[_0x9d95('0x39')]));_0x225b70['where'][_0x9d95('0x5d')]=_0x5c1283['id'];if(_0x560969[_0x9d95('0x38')][_0x9d95('0x44')]){_0x225b70[_0x9d95('0x42')]=_['merge'](_0x225b70[_0x9d95('0x42')],{'$or':_[_0x9d95('0x32')](_0x225b70[_0x9d95('0x3b')],function(_0x4e03de){var _0x27a6bc={};_0x27a6bc[_0x4e03de]={'$like':'%'+_0x560969['query'][_0x9d95('0x44')]+'%'};return _0x27a6bc;})});}_0x225b70=_[_0x9d95('0x46')]({},_0x225b70,_0x560969[_0x9d95('0x47')]);return db[_0x9d95('0x5c')]['count']({'where':_0x225b70[_0x9d95('0x42')]})[_0x9d95('0x28')](function(_0x14cf00){_0x5d785f[_0x9d95('0x22')]=_0x14cf00;if(_0x560969['query']['includeAll']){_0x225b70['include']=[{'all':!![]}];}return db[_0x9d95('0x5c')][_0x9d95('0x48')](_0x225b70);})[_0x9d95('0x28')](function(_0x2d6c14){_0x5d785f[_0x9d95('0x5e')]=_0x2d6c14;return _0x5d785f;});}})[_0x9d95('0x28')](respondWithFilteredResult(_0x2a99e1,_0x225b70))['catch'](handleError(_0x2a99e1,null));};exports[_0x9d95('0x5f')]=function(_0x10e6c9,_0x3d4248,_0x256784){var _0x125488={'raw':!![],'where':{}};var _0xd797c4={};var _0x4b0e63={'count':0x0,'rows':[]};return db[_0x9d95('0x33')]['findOne']({'where':{'id':_0x10e6c9[_0x9d95('0x4a')]['id']}})[_0x9d95('0x28')](handleEntityNotFound(_0x3d4248,null))['then'](function(_0x139dd0){if(_0x139dd0){_0xd797c4['model']=_[_0x9d95('0x4b')](db['JscriptyAnswerReport'][_0x9d95('0x34')]);_0xd797c4[_0x9d95('0x38')]=_['keys'](_0x10e6c9[_0x9d95('0x38')]);_0xd797c4[_0x9d95('0x39')]=_[_0x9d95('0x3a')](_0xd797c4[_0x9d95('0x37')],_0xd797c4[_0x9d95('0x38')]);_0x125488[_0x9d95('0x3b')]=_['intersection'](_0xd797c4[_0x9d95('0x37')],qs[_0x9d95('0x3c')](_0x10e6c9[_0x9d95('0x38')]['fields']));_0x125488['attributes']=_0x125488[_0x9d95('0x3b')][_0x9d95('0x3d')]?_0x125488['attributes']:_0xd797c4[_0x9d95('0x37')];if(!_0x10e6c9['query'][_0x9d95('0x3e')](_0x9d95('0x3f'))){_0x125488[_0x9d95('0x20')]=qs[_0x9d95('0x20')](_0x10e6c9[_0x9d95('0x38')][_0x9d95('0x20')]);_0x125488[_0x9d95('0x1f')]=qs[_0x9d95('0x1f')](_0x10e6c9['query'][_0x9d95('0x1f')]);}_0x125488[_0x9d95('0x40')]=qs[_0x9d95('0x41')](_0x10e6c9[_0x9d95('0x38')]['sort']);_0x125488[_0x9d95('0x42')]=qs['filters'](_[_0x9d95('0x43')](_0x10e6c9[_0x9d95('0x38')],_0xd797c4[_0x9d95('0x39')]));_0x125488[_0x9d95('0x42')][_0x9d95('0x5d')]=_0x139dd0['id'];if(_0x10e6c9['query'][_0x9d95('0x44')]){_0x125488[_0x9d95('0x42')]=_['merge'](_0x125488[_0x9d95('0x42')],{'$or':_[_0x9d95('0x32')](_0x125488['attributes'],function(_0x30b07d){var _0x57b9de={};_0x57b9de[_0x30b07d]={'$like':'%'+_0x10e6c9[_0x9d95('0x38')][_0x9d95('0x44')]+'%'};return _0x57b9de;})});}_0x125488=_[_0x9d95('0x46')]({},_0x125488,_0x10e6c9[_0x9d95('0x47')]);return db[_0x9d95('0x60')][_0x9d95('0x22')]({'where':_0x125488[_0x9d95('0x42')]})[_0x9d95('0x28')](function(_0x989956){_0x4b0e63[_0x9d95('0x22')]=_0x989956;if(_0x10e6c9['query']['includeAll']){_0x125488[_0x9d95('0x4d')]=[{'all':!![]}];}return db[_0x9d95('0x60')][_0x9d95('0x48')](_0x125488);})[_0x9d95('0x28')](function(_0x501213){_0x4b0e63['rows']=_0x501213;return _0x4b0e63;});}})[_0x9d95('0x28')](respondWithFilteredResult(_0x3d4248,_0x125488))[_0x9d95('0x49')](handleError(_0x3d4248,null));};function char(_0x2bf1dd){return _0x9d95('0x61')===typeof _0x2bf1dd?String[_0x9d95('0x62')][_0x9d95('0x25')](null,arguments):_0x2bf1dd;}function needsEncapsulation(_0x54961a){return!!_0x54961a&&(_0x54961a[_0x9d95('0x63')]()['indexOf'](char(0xd))>=0x0||_0x54961a[_0x9d95('0x63')]()[_0x9d95('0x64')](char(0xa))>=0x0||_0x54961a[_0x9d95('0x63')]()[_0x9d95('0x64')](char(0x2c))>=0x0||_0x54961a[_0x9d95('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5cb1d5){var _0x36e700=char(0x22),_0x1adae7='\x5c'+char(0x22),_0x36fb8e=_0x5cb1d5['toString']()[_0x9d95('0x65')](new RegExp(_0x36e700,'g'),_0x1adae7);return _0x36e700+_0x36fb8e+_0x36e700;}exports[_0x9d95('0x66')]=function(_0x1ddb0b,_0x21209e,_0x2de033){var _0x5375ce,_0x1a720e;var _0x390fc2={'where':{'ProjectId':_0x1ddb0b[_0x9d95('0x4a')]['id']}};if(_0x1ddb0b['query'][_0x9d95('0x67')]){_0x390fc2[_0x9d95('0x42')]['starttime']=JSON[_0x9d95('0x68')](_0x1ddb0b[_0x9d95('0x38')][_0x9d95('0x67')]);}return db[_0x9d95('0x5c')][_0x9d95('0x48')](_0x390fc2)[_0x9d95('0x28')](handleEntityNotFound(_0x21209e,null))[_0x9d95('0x28')](function(_0x1f999c){if(_0x1f999c){_0x5375ce=_0x1f999c;return db[_0x9d95('0x69')][_0x9d95('0x48')]({'where':{'SessionId':{'$in':_['map'](_0x5375ce,'id')},'ProjectId':_0x1ddb0b[_0x9d95('0x4a')]['id']},'order':_0x9d95('0x6a')});}})[_0x9d95('0x28')](handleEntityNotFound(_0x21209e,null))[_0x9d95('0x28')](function(_0x32403c){if(_0x32403c){_0x1a720e=_0x32403c;var _0x3f4e1e={};for(var _0x4f7b37=0x0,_0x4a3f07=_0x1a720e['length'];_0x4f7b37<_0x4a3f07;_0x4f7b37++){if(!_0x3f4e1e[_0x9d95('0x3e')](_0x1a720e[_0x4f7b37][_0x9d95('0x6b')])){_0x3f4e1e[_0x1a720e[_0x4f7b37][_0x9d95('0x6b')]]=needsEncapsulation(_0x1a720e[_0x4f7b37][_0x9d95('0x6c')])?encapsulate(_0x1a720e[_0x4f7b37][_0x9d95('0x6c')]):_0x1a720e[_0x4f7b37]['question'];}}var _0x4519c7=[],_0x55afb9={};for(var _0x21c96e=0x0,_0x551261=_0x5375ce[_0x9d95('0x3d')];_0x21c96e<_0x551261;_0x21c96e++){_0x55afb9={'ProjectId':_0x1ddb0b[_0x9d95('0x4a')]['id'],'SessionId':_0x5375ce[_0x21c96e]['id'],'StartTime':moment(_0x5375ce[_0x21c96e][_0x9d95('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x49429f=0x0,_0x2c70df=_0x1a720e['length'];_0x49429f<_0x2c70df;_0x49429f++){if(_0x1a720e[_0x49429f][_0x9d95('0x6e')]==_0x5375ce[_0x21c96e]['id']&&_0x3f4e1e[_0x9d95('0x3e')](_0x1a720e[_0x49429f][_0x9d95('0x6b')])){_0x55afb9[_0x3f4e1e[_0x1a720e[_0x49429f]['questionId']]]=_0x1a720e[_0x49429f][_0x9d95('0x6f')];}}for(var _0x5f1fef in _0x3f4e1e){if(!_0x55afb9[_0x9d95('0x3e')](_0x3f4e1e[_0x5f1fef])){_0x55afb9[_0x3f4e1e[_0x5f1fef]]=null;}}_0x4519c7[_0x9d95('0x70')](_0x55afb9);}return _0x4519c7;}})[_0x9d95('0x28')](function(_0x3052a4){if(!_[_0x9d95('0x71')](_0x3052a4)){var _0x4be6cc=toCsv(_0x3052a4);var _0x81dffa=Date[_0x9d95('0x72')]();fs['writeFileSync'](util['format'](_0x9d95('0x73'),_0x1ddb0b[_0x9d95('0x4a')]['id'],_0x81dffa),_0x4be6cc);_0x21209e[_0x9d95('0x74')](_0x9d95('0x75'),_0x9d95('0x76')+util[_0x9d95('0x77')]('Jscripty_Project_%d_Summary_%s.csv',_0x1ddb0b['params']['id'],_0x81dffa));_0x21209e[_0x9d95('0x74')](_0x9d95('0x78'),'text/csv');return _0x21209e[_0x9d95('0x79')](util[_0x9d95('0x77')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1ddb0b[_0x9d95('0x4a')]['id'],_0x81dffa));}else{return _0x21209e[_0x9d95('0x2d')](0xcc);}})[_0x9d95('0x49')](handleError(_0x21209e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 235ce12..40d8cbd 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 _0xf483=['api','moment','bluebird','request-promise','path','rimraf','JscriptyProject','jscripty_projects','util'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0xf483,0xf2));var _0x3f48=function(_0x2f888d,_0x597d3c){_0x2f888d=_0x2f888d-0x0;var _0x40f285=_0xf483[_0x2f888d];return _0x40f285;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var moment=require(_0x3f48('0x2'));var BPromise=require(_0x3f48('0x3'));var rp=require(_0x3f48('0x4'));var fs=require('fs');var path=require(_0x3f48('0x5'));var rimraf=require(_0x3f48('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x1a3447,_0x16905e){return _0x1a3447['define'](_0x3f48('0x7'),attributes,{'tableName':_0x3f48('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc999=['./jscriptyProject.attributes','define','jscripty_projects','util','../../config/logger','api','rimraf'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xc999,0x176));var _0x9c99=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xc999[_0x1895b7];return _0x1aecdc;};'use strict';var _=require('lodash');var util=require(_0x9c99('0x0'));var logger=require(_0x9c99('0x1'))(_0x9c99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c99('0x3'));var config=require('../../config/environment');var attributes=require(_0x9c99('0x4'));module['exports']=function(_0x35f5f4,_0x1ce762){return _0x35f5f4[_0x9c99('0x5')]('JscriptyProject',attributes,{'tableName':_0x9c99('0x6'),'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 3bad6dc..9c645cb 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3a19f2,_0xd035a2){var _0x239e42=function(_0x1a5870){while(--_0x1a5870){_0x3a19f2['push'](_0x3a19f2['shift']());}};_0x239e42(++_0xd035a2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3ab095,_0x57481f){_0x3ab095=_0x3ab095-0x0;var _0x4263bd=_0xb43b[_0x3ab095];return _0x4263bd;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5e11c2,_0x569b34){var _0x2e5a36=function(_0x33c693){while(--_0x33c693){_0x5e11c2['push'](_0x5e11c2['shift']());}};_0x2e5a36(++_0x569b34);}(_0xb43b,0x1b2));var _0xbb43=function(_0x27c652,_0x23a8f4){_0x27c652=_0x27c652-0x0;var _0x158b80=_0xb43b[_0x27c652];return _0x158b80;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 16d27f3..a6336fa 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 _0xd565=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xd565,0x140));var _0x5d56=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd565[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x5d56('0x0'));var util=require(_0x5d56('0x1'));var path=require(_0x5d56('0x2'));var timeout=require(_0x5d56('0x3'));var express=require('express');var router=express[_0x5d56('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5d56('0x5'));var interaction=require(_0x5d56('0x6'));var config=require(_0x5d56('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x5d56('0x8')]('/',auth[_0x5d56('0x9')](),controller[_0x5d56('0xa')]);router[_0x5d56('0x8')]('/describe',auth[_0x5d56('0x9')](),controller['describe']);router[_0x5d56('0x8')]('/:id',auth[_0x5d56('0x9')](),controller[_0x5d56('0xb')]);router[_0x5d56('0xc')]('/',auth[_0x5d56('0x9')](),controller['create']);router[_0x5d56('0xd')]('/:id',auth[_0x5d56('0x9')](),controller[_0x5d56('0xe')]);router[_0x5d56('0xf')]('/:id',auth[_0x5d56('0x9')](),controller[_0x5d56('0x10')]);module[_0x5d56('0x11')]=router; \ No newline at end of file +var _0x110f=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x110f,0xc3));var _0xf110=function(_0x4172ea,_0x1f3435){_0x4172ea=_0x4172ea-0x0;var _0x665dc9=_0x110f[_0x4172ea];return _0x665dc9;};'use strict';var multer=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var path=require(_0xf110('0x2'));var timeout=require(_0xf110('0x3'));var express=require(_0xf110('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf110('0x5'));var config=require(_0xf110('0x6'));var controller=require(_0xf110('0x7'));router[_0xf110('0x8')]('/',auth[_0xf110('0x9')](),controller[_0xf110('0xa')]);router[_0xf110('0x8')](_0xf110('0xb'),auth[_0xf110('0x9')](),controller[_0xf110('0xc')]);router['get'](_0xf110('0xd'),auth['isAuthenticated'](),controller[_0xf110('0xe')]);router[_0xf110('0xf')]('/',auth[_0xf110('0x9')](),controller[_0xf110('0x10')]);router['put']('/:id',auth[_0xf110('0x9')](),controller[_0xf110('0x11')]);router[_0xf110('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf110('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 75dbdcb..06de5ec 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x122d1a,_0x1f2f34){_0x122d1a=_0x122d1a-0x0;var _0x18763a=_0x7a54[_0x122d1a];return _0x18763a;};'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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x3dca32,_0xa3f0f1){_0x3dca32=_0x3dca32-0x0;var _0x51882c=_0x7a54[_0x3dca32];return _0x51882c;};'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 9fe0d3b..8a747b0 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 _0x9b58=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x9b58,0x94));var _0x89b5=function(_0x3c0440,_0xf248e7){_0x3c0440=_0x3c0440-0x0;var _0xbf902f=_0x9b58[_0x3c0440];return _0xbf902f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89b5('0x0'));var zipdir=require(_0x89b5('0x1'));var jsonpatch=require(_0x89b5('0x2'));var rp=require(_0x89b5('0x3'));var moment=require('moment');var BPromise=require(_0x89b5('0x4'));var Mustache=require(_0x89b5('0x5'));var util=require(_0x89b5('0x6'));var path=require(_0x89b5('0x7'));var sox=require('sox');var csv=require(_0x89b5('0x8'));var ejs=require(_0x89b5('0x9'));var fs=require('fs');var fs_extra=require(_0x89b5('0xa'));var _=require(_0x89b5('0xb'));var squel=require(_0x89b5('0xc'));var crypto=require(_0x89b5('0xd'));var jsforce=require(_0x89b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x89b5('0x8'));var querystring=require(_0x89b5('0xf'));var Papa=require(_0x89b5('0x10'));var Redis=require('ioredis');var authService=require(_0x89b5('0x11'));var qs=require(_0x89b5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89b5('0x13'));var logger=require(_0x89b5('0x14'))('api');var utils=require(_0x89b5('0x15'));var config=require(_0x89b5('0x16'));var licenseUtil=require(_0x89b5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x418d0d,_0x5763d6){_0x5763d6=_0x5763d6||0xcc;return function(_0x3c1fb5){if(_0x3c1fb5){return _0x418d0d['sendStatus'](_0x5763d6);}return _0x418d0d[_0x89b5('0x18')](_0x5763d6)[_0x89b5('0x19')]();};}function respondWithResult(_0x315d9b,_0xf7c379){_0xf7c379=_0xf7c379||0xc8;return function(_0x49b3a1){if(_0x49b3a1){return _0x315d9b[_0x89b5('0x18')](_0xf7c379)[_0x89b5('0x1a')](_0x49b3a1);}};}function respondWithFilteredResult(_0x5b9629,_0x4c39ce){return function(_0x477e48){if(_0x477e48){var _0x35548d=typeof _0x4c39ce[_0x89b5('0x1b')]===_0x89b5('0x1c')&&typeof _0x4c39ce['limit']===_0x89b5('0x1c');var _0x42b503=_0x477e48[_0x89b5('0x1d')];var _0x4d61d3=_0x35548d?0x0:_0x4c39ce[_0x89b5('0x1b')];var _0x3881ae=_0x35548d?_0x477e48[_0x89b5('0x1d')]:_0x4c39ce[_0x89b5('0x1b')]+_0x4c39ce[_0x89b5('0x1e')];var _0x2562fa;if(_0x3881ae>=_0x42b503){_0x3881ae=_0x42b503;_0x2562fa=0xc8;}else{_0x2562fa=0xce;}_0x5b9629['status'](_0x2562fa);return _0x5b9629['set'](_0x89b5('0x1f'),_0x4d61d3+'-'+_0x3881ae+'/'+_0x42b503)[_0x89b5('0x1a')](_0x477e48);}return null;};}function patchUpdates(_0x342b8b){return function(_0x41b0da){try{jsonpatch[_0x89b5('0x20')](_0x41b0da,_0x342b8b,!![]);}catch(_0x15edb6){return BPromise['reject'](_0x15edb6);}return _0x41b0da['save']();};}function saveUpdates(_0x124196,_0x5bba62){return function(_0x7ba44){if(_0x7ba44){return _0x7ba44['update'](_0x124196)['then'](function(_0x2f563d){return _0x2f563d;});}return null;};}function removeEntity(_0x29b890,_0x5a4c36){return function(_0x413f43){if(_0x413f43){return _0x413f43[_0x89b5('0x21')]()[_0x89b5('0x22')](function(){_0x29b890[_0x89b5('0x18')](0xcc)[_0x89b5('0x19')]();});}};}function handleEntityNotFound(_0x2e1a54,_0xda1df6){return function(_0x392b1d){if(!_0x392b1d){_0x2e1a54[_0x89b5('0x23')](0x194);}return _0x392b1d;};}function handleError(_0x45d8c7,_0x5001ff){_0x5001ff=_0x5001ff||0x1f4;return function(_0x398008){logger[_0x89b5('0x24')](_0x398008[_0x89b5('0x25')]);if(_0x398008[_0x89b5('0x26')]){delete _0x398008[_0x89b5('0x26')];}_0x45d8c7[_0x89b5('0x18')](_0x5001ff)[_0x89b5('0x27')](_0x398008);};}exports['index']=function(_0x48616b,_0x1da721){var _0x58f78b={},_0x41aa88={},_0x3978e2={'count':0x0,'rows':[]};var _0xbe5fb6=_['map'](db['JscriptyQuestionReport'][_0x89b5('0x28')],function(_0x2881cb){return{'name':_0x2881cb[_0x89b5('0x29')],'type':_0x2881cb[_0x89b5('0x2a')][_0x89b5('0x2b')]};});_0x41aa88[_0x89b5('0x2c')]=_['map'](_0xbe5fb6,'name');_0x41aa88['query']=_[_0x89b5('0x2d')](_0x48616b[_0x89b5('0x2e')]);_0x41aa88[_0x89b5('0x2f')]=_[_0x89b5('0x30')](_0x41aa88[_0x89b5('0x2c')],_0x41aa88['query']);_0x58f78b[_0x89b5('0x31')]=_[_0x89b5('0x30')](_0x41aa88[_0x89b5('0x2c')],qs['fields'](_0x48616b[_0x89b5('0x2e')][_0x89b5('0x32')]));_0x58f78b['attributes']=_0x58f78b['attributes'][_0x89b5('0x33')]?_0x58f78b[_0x89b5('0x31')]:_0x41aa88[_0x89b5('0x2c')];if(!_0x48616b[_0x89b5('0x2e')][_0x89b5('0x34')](_0x89b5('0x35'))){_0x58f78b[_0x89b5('0x1e')]=qs[_0x89b5('0x1e')](_0x48616b[_0x89b5('0x2e')][_0x89b5('0x1e')]);_0x58f78b[_0x89b5('0x1b')]=qs[_0x89b5('0x1b')](_0x48616b[_0x89b5('0x2e')][_0x89b5('0x1b')]);}_0x58f78b[_0x89b5('0x36')]=qs[_0x89b5('0x37')](_0x48616b[_0x89b5('0x2e')][_0x89b5('0x37')]);_0x58f78b['where']=qs[_0x89b5('0x2f')](_['pick'](_0x48616b['query'],_0x41aa88[_0x89b5('0x2f')]),_0xbe5fb6);if(_0x48616b[_0x89b5('0x2e')][_0x89b5('0x38')]){_0x58f78b[_0x89b5('0x39')]=_[_0x89b5('0x3a')](_0x58f78b[_0x89b5('0x39')],{'$or':_[_0x89b5('0x3b')](_0xbe5fb6,function(_0x31430c){if(_0x31430c[_0x89b5('0x2a')]!==_0x89b5('0x3c')){var _0x217519={};_0x217519[_0x31430c['name']]={'$like':'%'+_0x48616b['query'][_0x89b5('0x38')]+'%'};return _0x217519;}})});}_0x58f78b=_[_0x89b5('0x3a')]({},_0x58f78b,_0x48616b['options']);var _0x1e97a2={'where':_0x58f78b[_0x89b5('0x39')]};return db[_0x89b5('0x3d')][_0x89b5('0x1d')](_0x1e97a2)[_0x89b5('0x22')](function(_0xbaa064){_0x3978e2[_0x89b5('0x1d')]=_0xbaa064;if(_0x48616b[_0x89b5('0x2e')][_0x89b5('0x3e')]){_0x58f78b[_0x89b5('0x3f')]=[{'all':!![]}];}return db[_0x89b5('0x3d')][_0x89b5('0x40')](_0x58f78b);})['then'](function(_0x516f93){_0x3978e2[_0x89b5('0x41')]=_0x516f93;return _0x3978e2;})[_0x89b5('0x22')](respondWithFilteredResult(_0x1da721,_0x58f78b))[_0x89b5('0x42')](handleError(_0x1da721,null));};exports[_0x89b5('0x43')]=function(_0x5c92ff,_0x5d384f){var _0x2cc6a1={'raw':!![],'where':{'id':_0x5c92ff[_0x89b5('0x44')]['id']}},_0x576cb7={};_0x576cb7['model']=_['keys'](db[_0x89b5('0x3d')][_0x89b5('0x28')]);_0x576cb7['query']=_[_0x89b5('0x2d')](_0x5c92ff[_0x89b5('0x2e')]);_0x576cb7['filters']=_['intersection'](_0x576cb7['model'],_0x576cb7['query']);_0x2cc6a1[_0x89b5('0x31')]=_['intersection'](_0x576cb7['model'],qs[_0x89b5('0x32')](_0x5c92ff['query']['fields']));_0x2cc6a1[_0x89b5('0x31')]=_0x2cc6a1[_0x89b5('0x31')][_0x89b5('0x33')]?_0x2cc6a1[_0x89b5('0x31')]:_0x576cb7[_0x89b5('0x2c')];if(_0x5c92ff[_0x89b5('0x2e')][_0x89b5('0x3e')]){_0x2cc6a1[_0x89b5('0x3f')]=[{'all':!![]}];}_0x2cc6a1=_[_0x89b5('0x3a')]({},_0x2cc6a1,_0x5c92ff[_0x89b5('0x45')]);return db[_0x89b5('0x3d')][_0x89b5('0x46')](_0x2cc6a1)['then'](handleEntityNotFound(_0x5d384f,null))['then'](respondWithResult(_0x5d384f,null))[_0x89b5('0x42')](handleError(_0x5d384f,null));};exports[_0x89b5('0x47')]=function(_0x47c47e,_0x186d57){return db[_0x89b5('0x3d')][_0x89b5('0x47')](_0x47c47e[_0x89b5('0x48')],{})[_0x89b5('0x22')](respondWithResult(_0x186d57,0xc9))[_0x89b5('0x42')](handleError(_0x186d57,null));};exports[_0x89b5('0x49')]=function(_0x2a0aa6,_0x118343){if(_0x2a0aa6[_0x89b5('0x48')]['id']){delete _0x2a0aa6[_0x89b5('0x48')]['id'];}return db[_0x89b5('0x3d')][_0x89b5('0x46')]({'where':{'id':_0x2a0aa6['params']['id']}})['then'](handleEntityNotFound(_0x118343,null))[_0x89b5('0x22')](saveUpdates(_0x2a0aa6[_0x89b5('0x48')],null))['then'](respondWithResult(_0x118343,null))[_0x89b5('0x42')](handleError(_0x118343,null));};exports[_0x89b5('0x21')]=function(_0x45c8af,_0x1a2e2b){return db[_0x89b5('0x3d')][_0x89b5('0x46')]({'where':{'id':_0x45c8af[_0x89b5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a2e2b,null))['then'](removeEntity(_0x1a2e2b,null))[_0x89b5('0x42')](handleError(_0x1a2e2b,null));};exports['describe']=function(_0x5073a8,_0x5ccbb9){return db[_0x89b5('0x3d')]['describe']()[_0x89b5('0x22')](respondWithResult(_0x5ccbb9,null))[_0x89b5('0x42')](handleError(_0x5ccbb9,null));}; \ No newline at end of file +var _0x262d=['squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','offset','undefined','count','status','set','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','length','include','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x38e595,_0x345259){var _0x3aad63=function(_0x41c02b){while(--_0x41c02b){_0x38e595['push'](_0x38e595['shift']());}};_0x3aad63(++_0x345259);}(_0x262d,0x1b0));var _0xd262=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x262d[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xd262('0x0'));var rimraf=require(_0xd262('0x1'));var zipdir=require(_0xd262('0x2'));var jsonpatch=require(_0xd262('0x3'));var rp=require('request-promise');var moment=require(_0xd262('0x4'));var BPromise=require(_0xd262('0x5'));var Mustache=require('mustache');var util=require(_0xd262('0x6'));var path=require(_0xd262('0x7'));var sox=require(_0xd262('0x8'));var csv=require(_0xd262('0x9'));var ejs=require(_0xd262('0xa'));var fs=require('fs');var fs_extra=require(_0xd262('0xb'));var _=require('lodash');var squel=require(_0xd262('0xc'));var crypto=require(_0xd262('0xd'));var jsforce=require(_0xd262('0xe'));var deskjs=require(_0xd262('0xf'));var toCsv=require(_0xd262('0x9'));var querystring=require(_0xd262('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd262('0x11'));var as=require(_0xd262('0x12'));var hardwareService=require(_0xd262('0x13'));var logger=require(_0xd262('0x14'))(_0xd262('0x15'));var utils=require('../../config/utils');var config=require(_0xd262('0x16'));var licenseUtil=require(_0xd262('0x17'));var db=require(_0xd262('0x18'))['db'];function respondWithStatusCode(_0x24bef4,_0x4a12d4){_0x4a12d4=_0x4a12d4||0xcc;return function(_0x452e7b){if(_0x452e7b){return _0x24bef4['sendStatus'](_0x4a12d4);}return _0x24bef4['status'](_0x4a12d4)['end']();};}function respondWithResult(_0x57dfd4,_0x285801){_0x285801=_0x285801||0xc8;return function(_0x19198f){if(_0x19198f){return _0x57dfd4['status'](_0x285801)['json'](_0x19198f);}};}function respondWithFilteredResult(_0x12a44a,_0x18eadd){return function(_0x56906d){if(_0x56906d){var _0x49753d=typeof _0x18eadd[_0xd262('0x19')]===_0xd262('0x1a')&&typeof _0x18eadd['limit']==='undefined';var _0x26f5dc=_0x56906d['count'];var _0x563fc2=_0x49753d?0x0:_0x18eadd['offset'];var _0x2f0fd5=_0x49753d?_0x56906d[_0xd262('0x1b')]:_0x18eadd[_0xd262('0x19')]+_0x18eadd['limit'];var _0x4cab9c;if(_0x2f0fd5>=_0x26f5dc){_0x2f0fd5=_0x26f5dc;_0x4cab9c=0xc8;}else{_0x4cab9c=0xce;}_0x12a44a[_0xd262('0x1c')](_0x4cab9c);return _0x12a44a[_0xd262('0x1d')]('Content-Range',_0x563fc2+'-'+_0x2f0fd5+'/'+_0x26f5dc)[_0xd262('0x1e')](_0x56906d);}return null;};}function patchUpdates(_0x12fe7){return function(_0x19d6bb){try{jsonpatch['apply'](_0x19d6bb,_0x12fe7,!![]);}catch(_0x1d4af5){return BPromise[_0xd262('0x1f')](_0x1d4af5);}return _0x19d6bb[_0xd262('0x20')]();};}function saveUpdates(_0x417644,_0x259603){return function(_0x5bdc05){if(_0x5bdc05){return _0x5bdc05[_0xd262('0x21')](_0x417644)[_0xd262('0x22')](function(_0x17d24f){return _0x17d24f;});}return null;};}function removeEntity(_0x166d1d,_0x57d892){return function(_0x30af71){if(_0x30af71){return _0x30af71[_0xd262('0x23')]()[_0xd262('0x22')](function(){_0x166d1d[_0xd262('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422c0e,_0x32b1da){return function(_0x4249f0){if(!_0x4249f0){_0x422c0e[_0xd262('0x24')](0x194);}return _0x4249f0;};}function handleError(_0x10adbc,_0x451080){_0x451080=_0x451080||0x1f4;return function(_0x377cd1){logger['error'](_0x377cd1[_0xd262('0x25')]);if(_0x377cd1[_0xd262('0x26')]){delete _0x377cd1[_0xd262('0x26')];}_0x10adbc[_0xd262('0x1c')](_0x451080)[_0xd262('0x27')](_0x377cd1);};}exports[_0xd262('0x28')]=function(_0x933cf6,_0x524d0c){var _0x22eab9={},_0x33898b={},_0x177557={'count':0x0,'rows':[]};var _0x5addc5=_[_0xd262('0x29')](db[_0xd262('0x2a')][_0xd262('0x2b')],function(_0x1741cf){return{'name':_0x1741cf[_0xd262('0x2c')],'type':_0x1741cf[_0xd262('0x2d')][_0xd262('0x2e')]};});_0x33898b['model']=_['map'](_0x5addc5,_0xd262('0x26'));_0x33898b[_0xd262('0x2f')]=_[_0xd262('0x30')](_0x933cf6[_0xd262('0x2f')]);_0x33898b['filters']=_['intersection'](_0x33898b[_0xd262('0x31')],_0x33898b['query']);_0x22eab9[_0xd262('0x32')]=_[_0xd262('0x33')](_0x33898b['model'],qs[_0xd262('0x34')](_0x933cf6[_0xd262('0x2f')][_0xd262('0x34')]));_0x22eab9[_0xd262('0x32')]=_0x22eab9[_0xd262('0x32')]['length']?_0x22eab9[_0xd262('0x32')]:_0x33898b['model'];if(!_0x933cf6[_0xd262('0x2f')][_0xd262('0x35')](_0xd262('0x36'))){_0x22eab9[_0xd262('0x37')]=qs['limit'](_0x933cf6[_0xd262('0x2f')][_0xd262('0x37')]);_0x22eab9[_0xd262('0x19')]=qs['offset'](_0x933cf6[_0xd262('0x2f')]['offset']);}_0x22eab9[_0xd262('0x38')]=qs[_0xd262('0x39')](_0x933cf6[_0xd262('0x2f')][_0xd262('0x39')]);_0x22eab9[_0xd262('0x3a')]=qs[_0xd262('0x3b')](_[_0xd262('0x3c')](_0x933cf6['query'],_0x33898b['filters']),_0x5addc5);if(_0x933cf6[_0xd262('0x2f')][_0xd262('0x3d')]){_0x22eab9['where']=_[_0xd262('0x3e')](_0x22eab9['where'],{'$or':_[_0xd262('0x29')](_0x5addc5,function(_0x564a26){if(_0x564a26[_0xd262('0x2d')]!==_0xd262('0x3f')){var _0x52efa0={};_0x52efa0[_0x564a26[_0xd262('0x26')]]={'$like':'%'+_0x933cf6[_0xd262('0x2f')]['filter']+'%'};return _0x52efa0;}})});}_0x22eab9=_[_0xd262('0x3e')]({},_0x22eab9,_0x933cf6['options']);var _0x24f7dd={'where':_0x22eab9[_0xd262('0x3a')]};return db[_0xd262('0x2a')]['count'](_0x24f7dd)[_0xd262('0x22')](function(_0x877914){_0x177557[_0xd262('0x1b')]=_0x877914;if(_0x933cf6[_0xd262('0x2f')][_0xd262('0x40')]){_0x22eab9['include']=[{'all':!![]}];}return db[_0xd262('0x2a')][_0xd262('0x41')](_0x22eab9);})[_0xd262('0x22')](function(_0x2d682f){_0x177557['rows']=_0x2d682f;return _0x177557;})[_0xd262('0x22')](respondWithFilteredResult(_0x524d0c,_0x22eab9))[_0xd262('0x42')](handleError(_0x524d0c,null));};exports[_0xd262('0x43')]=function(_0x3d03fc,_0x122a6a){var _0x351cab={'raw':!![],'where':{'id':_0x3d03fc['params']['id']}},_0xaab07e={};_0xaab07e[_0xd262('0x31')]=_['keys'](db[_0xd262('0x2a')][_0xd262('0x2b')]);_0xaab07e[_0xd262('0x2f')]=_['keys'](_0x3d03fc['query']);_0xaab07e[_0xd262('0x3b')]=_[_0xd262('0x33')](_0xaab07e[_0xd262('0x31')],_0xaab07e[_0xd262('0x2f')]);_0x351cab[_0xd262('0x32')]=_[_0xd262('0x33')](_0xaab07e['model'],qs['fields'](_0x3d03fc[_0xd262('0x2f')]['fields']));_0x351cab[_0xd262('0x32')]=_0x351cab[_0xd262('0x32')][_0xd262('0x44')]?_0x351cab[_0xd262('0x32')]:_0xaab07e[_0xd262('0x31')];if(_0x3d03fc[_0xd262('0x2f')][_0xd262('0x40')]){_0x351cab[_0xd262('0x45')]=[{'all':!![]}];}_0x351cab=_[_0xd262('0x3e')]({},_0x351cab,_0x3d03fc['options']);return db[_0xd262('0x2a')]['find'](_0x351cab)[_0xd262('0x22')](handleEntityNotFound(_0x122a6a,null))[_0xd262('0x22')](respondWithResult(_0x122a6a,null))['catch'](handleError(_0x122a6a,null));};exports['create']=function(_0x49d591,_0x51eefd){return db[_0xd262('0x2a')]['create'](_0x49d591['body'],{})['then'](respondWithResult(_0x51eefd,0xc9))[_0xd262('0x42')](handleError(_0x51eefd,null));};exports['update']=function(_0x554962,_0x405039){if(_0x554962[_0xd262('0x46')]['id']){delete _0x554962[_0xd262('0x46')]['id'];}return db[_0xd262('0x2a')][_0xd262('0x47')]({'where':{'id':_0x554962[_0xd262('0x48')]['id']}})[_0xd262('0x22')](handleEntityNotFound(_0x405039,null))[_0xd262('0x22')](saveUpdates(_0x554962[_0xd262('0x46')],null))[_0xd262('0x22')](respondWithResult(_0x405039,null))[_0xd262('0x42')](handleError(_0x405039,null));};exports[_0xd262('0x23')]=function(_0x420422,_0x25db87){return db[_0xd262('0x2a')][_0xd262('0x47')]({'where':{'id':_0x420422[_0xd262('0x48')]['id']}})[_0xd262('0x22')](handleEntityNotFound(_0x25db87,null))[_0xd262('0x22')](removeEntity(_0x25db87,null))['catch'](handleError(_0x25db87,null));};exports[_0xd262('0x49')]=function(_0x187000,_0xd4f269){return db['JscriptyQuestionReport'][_0xd262('0x49')]()[_0xd262('0x22')](respondWithResult(_0xd4f269,null))['catch'](handleError(_0xd4f269,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6608d6a..88562f7 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 _0xf3e3=['request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','bluebird'];(function(_0x4794a5,_0x4daab5){var _0x214260=function(_0xf44f0d){while(--_0xf44f0d){_0x4794a5['push'](_0x4794a5['shift']());}};_0x214260(++_0x4daab5);}(_0xf3e3,0x130));var _0x3f3e=function(_0x59787c,_0x1cf14d){_0x59787c=_0x59787c-0x0;var _0x3ad799=_0xf3e3[_0x59787c];return _0x3ad799;};'use strict';var _=require('lodash');var util=require(_0x3f3e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3f3e('0x1'));var rp=require(_0x3f3e('0x2'));var fs=require('fs');var path=require(_0x3f3e('0x3'));var rimraf=require('rimraf');var config=require(_0x3f3e('0x4'));var attributes=require(_0x3f3e('0x5'));module[_0x3f3e('0x6')]=function(_0xb5535,_0x3dd33a){return _0xb5535['define'](_0x3f3e('0x7'),attributes,{'tableName':_0x3f3e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5279=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','path'];(function(_0x2c06cc,_0x5773f2){var _0x173cda=function(_0x49a7be){while(--_0x49a7be){_0x2c06cc['push'](_0x2c06cc['shift']());}};_0x173cda(++_0x5773f2);}(_0x5279,0x1e2));var _0x9527=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x5279[_0x3c51d4];return _0x53c45f;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var logger=require(_0x9527('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9527('0x3'));var rimraf=require(_0x9527('0x4'));var config=require(_0x9527('0x5'));var attributes=require(_0x9527('0x6'));module['exports']=function(_0x57405f,_0x155c2d){return _0x57405f[_0x9527('0x7')](_0x9527('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index e40f289..e126d96 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 _0x4c8f=['client','request','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c8f,0x1d5));var _0xf4c8=function(_0x1932a3,_0x39a548){_0x1932a3=_0x1932a3-0x0;var _0x2a5cf8=_0x4c8f[_0x1932a3];return _0x2a5cf8;};'use strict';var _=require(_0xf4c8('0x0'));var util=require(_0xf4c8('0x1'));var moment=require(_0xf4c8('0x2'));var BPromise=require(_0xf4c8('0x3'));var rs=require(_0xf4c8('0x4'));var fs=require('fs');var Redis=require(_0xf4c8('0x5'));var db=require(_0xf4c8('0x6'))['db'];var utils=require(_0xf4c8('0x7'));var logger=require(_0xf4c8('0x8'))(_0xf4c8('0x9'));var config=require(_0xf4c8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf4c8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c72c8,_0xee7d02,_0x271318){return new BPromise(function(_0x549de2,_0x4a610a){return client[_0xf4c8('0xc')](_0x3c72c8,_0x271318)['then'](function(_0x359f08){logger[_0xf4c8('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xee7d02,'request\x20sent');logger[_0xf4c8('0xe')](_0xf4c8('0xf'),_0xee7d02,_0xf4c8('0x10'),JSON[_0xf4c8('0x11')](_0x359f08));if(_0x359f08[_0xf4c8('0x12')]){if(_0x359f08[_0xf4c8('0x12')][_0xf4c8('0x13')]===0x1f4){logger[_0xf4c8('0x12')](_0xf4c8('0x14'),_0xee7d02,_0x359f08[_0xf4c8('0x12')][_0xf4c8('0x15')]);return _0x4a610a(_0x359f08['error'][_0xf4c8('0x15')]);}logger[_0xf4c8('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xee7d02,_0x359f08['error'][_0xf4c8('0x15')]);return _0x549de2(_0x359f08[_0xf4c8('0x12')][_0xf4c8('0x15')]);}else{logger['info'](_0xf4c8('0x14'),_0xee7d02,_0xf4c8('0x10'));_0x549de2(_0x359f08[_0xf4c8('0x16')][_0xf4c8('0x15')]);}})[_0xf4c8('0x17')](function(_0x45e067){logger[_0xf4c8('0x12')](_0xf4c8('0x14'),_0xee7d02,_0x45e067);_0x4a610a(_0x45e067);});});} \ No newline at end of file +var _0x971d=['rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x971d,0xe0));var _0xd971=function(_0x5f30a1,_0x490b59){_0x5f30a1=_0x5f30a1-0x0;var _0x1e797e=_0x971d[_0x5f30a1];return _0x1e797e;};'use strict';var _=require(_0xd971('0x0'));var util=require('util');var moment=require(_0xd971('0x1'));var BPromise=require(_0xd971('0x2'));var rs=require(_0xd971('0x3'));var fs=require('fs');var Redis=require(_0xd971('0x4'));var db=require(_0xd971('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd971('0x6'))(_0xd971('0x7'));var config=require(_0xd971('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd971('0x9')][_0xd971('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12b5ac,_0x14db20,_0x14463a){return new BPromise(function(_0x1e2b9c,_0x31e8d2){return client[_0xd971('0xb')](_0x12b5ac,_0x14463a)[_0xd971('0xc')](function(_0x452b70){logger[_0xd971('0xd')](_0xd971('0xe'),_0x14db20,_0xd971('0xf'));logger['debug'](_0xd971('0x10'),_0x14db20,_0xd971('0xf'),JSON[_0xd971('0x11')](_0x452b70));if(_0x452b70[_0xd971('0x12')]){if(_0x452b70[_0xd971('0x12')][_0xd971('0x13')]===0x1f4){logger[_0xd971('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x14db20,_0x452b70[_0xd971('0x12')][_0xd971('0x14')]);return _0x31e8d2(_0x452b70[_0xd971('0x12')][_0xd971('0x14')]);}logger[_0xd971('0x12')](_0xd971('0xe'),_0x14db20,_0x452b70[_0xd971('0x12')][_0xd971('0x14')]);return _0x1e2b9c(_0x452b70['error'][_0xd971('0x14')]);}else{logger[_0xd971('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x14db20,_0xd971('0xf'));_0x1e2b9c(_0x452b70['result'][_0xd971('0x14')]);}})['catch'](function(_0xc0be45){logger[_0xd971('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x14db20,_0xc0be45);_0x31e8d2(_0xc0be45);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ee3f082..6febd21 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 _0x1678=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe','describe','isAuthenticated','show','/:id/questions','getQuestions','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x5d2c27,_0x3effc7){var _0x5d73fb=function(_0x37dc2c){while(--_0x37dc2c){_0x5d2c27['push'](_0x5d2c27['shift']());}};_0x5d73fb(++_0x3effc7);}(_0x1678,0x107));var _0x8167=function(_0x6a0893,_0x15892d){_0x6a0893=_0x6a0893-0x0;var _0x1fbf42=_0x1678[_0x6a0893];return _0x1fbf42;};'use strict';var multer=require('multer');var util=require(_0x8167('0x0'));var path=require('path');var timeout=require(_0x8167('0x1'));var express=require(_0x8167('0x2'));var router=express[_0x8167('0x3')]();var fs_extra=require(_0x8167('0x4'));var auth=require(_0x8167('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8167('0x6'));var controller=require(_0x8167('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8167('0x8')]);router[_0x8167('0x9')](_0x8167('0xa'),auth['isAuthenticated'](),controller[_0x8167('0xb')]);router[_0x8167('0x9')]('/:id',auth[_0x8167('0xc')](),controller[_0x8167('0xd')]);router['get'](_0x8167('0xe'),auth['isAuthenticated'](),controller[_0x8167('0xf')]);router[_0x8167('0x10')]('/',auth[_0x8167('0xc')](),controller[_0x8167('0x11')]);router[_0x8167('0x12')](_0x8167('0x13'),auth[_0x8167('0xc')](),controller[_0x8167('0x14')]);router[_0x8167('0x15')](_0x8167('0x13'),auth[_0x8167('0xc')](),controller[_0x8167('0x16')]);module[_0x8167('0x17')]=router; \ No newline at end of file +var _0x7e78=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','show','post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dbc2f,_0x467390){var _0x353184=function(_0x5738c5){while(--_0x5738c5){_0x3dbc2f['push'](_0x3dbc2f['shift']());}};_0x353184(++_0x467390);}(_0x7e78,0x7f));var _0x87e7=function(_0x277466,_0x2bdc10){_0x277466=_0x277466-0x0;var _0x49ea4e=_0x7e78[_0x277466];return _0x49ea4e;};'use strict';var multer=require(_0x87e7('0x0'));var util=require(_0x87e7('0x1'));var path=require(_0x87e7('0x2'));var timeout=require(_0x87e7('0x3'));var express=require(_0x87e7('0x4'));var router=express[_0x87e7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x87e7('0x6'));var interaction=require(_0x87e7('0x7'));var config=require(_0x87e7('0x8'));var controller=require(_0x87e7('0x9'));router[_0x87e7('0xa')]('/',auth[_0x87e7('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x87e7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x87e7('0xc')]);router[_0x87e7('0xa')]('/:id/questions',auth['isAuthenticated'](),controller['getQuestions']);router[_0x87e7('0xd')]('/',auth[_0x87e7('0xb')](),controller[_0x87e7('0xe')]);router['put'](_0x87e7('0xf'),auth[_0x87e7('0xb')](),controller[_0x87e7('0x10')]);router[_0x87e7('0x11')](_0x87e7('0xf'),auth[_0x87e7('0xb')](),controller['destroy']);module[_0x87e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5ab5512..869132e 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 _0x23ce=['STRING','BOOLEAN','moment','sequelize','DATE','starttime','endtime','format'];(function(_0x1b05b0,_0x1b4bdb){var _0xaae986=function(_0x2eba88){while(--_0x2eba88){_0x1b05b0['push'](_0x1b05b0['shift']());}};_0xaae986(++_0x1b4bdb);}(_0x23ce,0x1e2));var _0xe23c=function(_0x282e46,_0x35ca99){_0x282e46=_0x282e46-0x0;var _0x5107e6=_0x23ce[_0x282e46];return _0x5107e6;};'use strict';var moment=require(_0xe23c('0x0'));var Sequelize=require(_0xe23c('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xe23c('0x2')],'set':function(_0x3eef00){this['setDataValue'](_0xe23c('0x3'),_0x3eef00);this['setDataValue'](_0xe23c('0x4'),moment()[_0xe23c('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xe23c('0x2')]},'membername':{'type':Sequelize[_0xe23c('0x6')]},'projectname':{'type':Sequelize[_0xe23c('0x6')]},'queue':{'type':Sequelize[_0xe23c('0x6')]},'uniqueid':{'type':Sequelize[_0xe23c('0x6')]},'calleridname':{'type':Sequelize[_0xe23c('0x6')]},'calleridnum':{'type':Sequelize[_0xe23c('0x6')]},'completed':{'type':Sequelize[_0xe23c('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xeb9f=['setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE'];(function(_0x5a09f3,_0x9ce907){var _0x3665c2=function(_0x3a8581){while(--_0x3a8581){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x3665c2(++_0x9ce907);}(_0xeb9f,0x1d1));var _0xfeb9=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xeb9f[_0x280f4a];return _0x1bb157;};'use strict';var moment=require(_0xfeb9('0x0'));var Sequelize=require(_0xfeb9('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xfeb9('0x2')],'set':function(_0x4b15b1){this[_0xfeb9('0x3')](_0xfeb9('0x4'),_0x4b15b1);this[_0xfeb9('0x3')]('endtime',moment()[_0xfeb9('0x5')](_0xfeb9('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xfeb9('0x7')]},'queue':{'type':Sequelize[_0xfeb9('0x7')]},'uniqueid':{'type':Sequelize[_0xfeb9('0x7')]},'calleridname':{'type':Sequelize[_0xfeb9('0x7')]},'calleridnum':{'type':Sequelize[_0xfeb9('0x7')]},'completed':{'type':Sequelize[_0xfeb9('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bd6ef4a..99fd4db 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 _0x640b=['catch','show','keys','include','create','body','find','params','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','order','SessionId','eml-format','rimraf','zip-dir','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/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','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','key','query','attributes','intersection','model','fields','length','sort','filters','pick','filter','where','merge','type','options','includeAll','findAll','rows'];(function(_0x293a16,_0xd06c9b){var _0x3bdb10=function(_0x1e0745){while(--_0x1e0745){_0x293a16['push'](_0x293a16['shift']());}};_0x3bdb10(++_0xd06c9b);}(_0x640b,0xfe));var _0xb640=function(_0xcf5536,_0x4518f0){_0xcf5536=_0xcf5536-0x0;var _0x3dc63e=_0x640b[_0xcf5536];return _0x3dc63e;};'use strict';var emlformat=require(_0xb640('0x0'));var rimraf=require(_0xb640('0x1'));var zipdir=require(_0xb640('0x2'));var jsonpatch=require(_0xb640('0x3'));var rp=require(_0xb640('0x4'));var moment=require(_0xb640('0x5'));var BPromise=require(_0xb640('0x6'));var Mustache=require(_0xb640('0x7'));var util=require(_0xb640('0x8'));var path=require('path');var sox=require(_0xb640('0x9'));var csv=require(_0xb640('0xa'));var ejs=require(_0xb640('0xb'));var fs=require('fs');var fs_extra=require(_0xb640('0xc'));var _=require(_0xb640('0xd'));var squel=require(_0xb640('0xe'));var crypto=require(_0xb640('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb640('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb640('0x11'));var Papa=require(_0xb640('0x12'));var Redis=require(_0xb640('0x13'));var authService=require(_0xb640('0x14'));var qs=require(_0xb640('0x15'));var as=require(_0xb640('0x16'));var hardwareService=require(_0xb640('0x17'));var logger=require(_0xb640('0x18'))(_0xb640('0x19'));var utils=require(_0xb640('0x1a'));var config=require(_0xb640('0x1b'));var licenseUtil=require(_0xb640('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31e3dd,_0x174b10){_0x174b10=_0x174b10||0xcc;return function(_0x56e1e5){if(_0x56e1e5){return _0x31e3dd[_0xb640('0x1d')](_0x174b10);}return _0x31e3dd[_0xb640('0x1e')](_0x174b10)[_0xb640('0x1f')]();};}function respondWithResult(_0x34d4a7,_0x3f22d8){_0x3f22d8=_0x3f22d8||0xc8;return function(_0x2af0bc){if(_0x2af0bc){return _0x34d4a7[_0xb640('0x1e')](_0x3f22d8)[_0xb640('0x20')](_0x2af0bc);}};}function respondWithFilteredResult(_0x276e45,_0x8e6ece){return function(_0x3cea54){if(_0x3cea54){var _0x337394=typeof _0x8e6ece[_0xb640('0x21')]===_0xb640('0x22')&&typeof _0x8e6ece[_0xb640('0x23')]==='undefined';var _0x4fbbfe=_0x3cea54[_0xb640('0x24')];var _0x6c18ba=_0x337394?0x0:_0x8e6ece[_0xb640('0x21')];var _0x2c6c71=_0x337394?_0x3cea54[_0xb640('0x24')]:_0x8e6ece[_0xb640('0x21')]+_0x8e6ece[_0xb640('0x23')];var _0x16d194;if(_0x2c6c71>=_0x4fbbfe){_0x2c6c71=_0x4fbbfe;_0x16d194=0xc8;}else{_0x16d194=0xce;}_0x276e45[_0xb640('0x1e')](_0x16d194);return _0x276e45['set'](_0xb640('0x25'),_0x6c18ba+'-'+_0x2c6c71+'/'+_0x4fbbfe)[_0xb640('0x20')](_0x3cea54);}return null;};}function patchUpdates(_0x1bd7c1){return function(_0x4fa955){try{jsonpatch[_0xb640('0x26')](_0x4fa955,_0x1bd7c1,!![]);}catch(_0x5f4eae){return BPromise['reject'](_0x5f4eae);}return _0x4fa955['save']();};}function saveUpdates(_0x17d3cb,_0x3b6733){return function(_0x68fb13){if(_0x68fb13){return _0x68fb13['update'](_0x17d3cb)[_0xb640('0x27')](function(_0x19dfec){return _0x19dfec;});}return null;};}function removeEntity(_0x21a92f,_0x2b5acd){return function(_0x1f3466){if(_0x1f3466){return _0x1f3466[_0xb640('0x28')]()['then'](function(){_0x21a92f[_0xb640('0x1e')](0xcc)[_0xb640('0x1f')]();});}};}function handleEntityNotFound(_0xba92a7,_0x3e8b55){return function(_0x2c0c95){if(!_0x2c0c95){_0xba92a7[_0xb640('0x1d')](0x194);}return _0x2c0c95;};}function handleError(_0xb6b61a,_0x178177){_0x178177=_0x178177||0x1f4;return function(_0x4bee6f){logger[_0xb640('0x29')](_0x4bee6f[_0xb640('0x2a')]);if(_0x4bee6f[_0xb640('0x2b')]){delete _0x4bee6f[_0xb640('0x2b')];}_0xb6b61a[_0xb640('0x1e')](_0x178177)['send'](_0x4bee6f);};}exports[_0xb640('0x2c')]=function(_0x4aeffc,_0x19fed6){var _0x54ca61={},_0xf8e8a6={},_0x4b91ba={'count':0x0,'rows':[]};var _0x5bd002=_[_0xb640('0x2d')](db[_0xb640('0x2e')][_0xb640('0x2f')],function(_0x3c3bd4){return{'name':_0x3c3bd4['fieldName'],'type':_0x3c3bd4['type'][_0xb640('0x30')]};});_0xf8e8a6['model']=_['map'](_0x5bd002,_0xb640('0x2b'));_0xf8e8a6[_0xb640('0x31')]=_['keys'](_0x4aeffc[_0xb640('0x31')]);_0xf8e8a6['filters']=_['intersection'](_0xf8e8a6['model'],_0xf8e8a6['query']);_0x54ca61[_0xb640('0x32')]=_[_0xb640('0x33')](_0xf8e8a6[_0xb640('0x34')],qs[_0xb640('0x35')](_0x4aeffc[_0xb640('0x31')][_0xb640('0x35')]));_0x54ca61[_0xb640('0x32')]=_0x54ca61[_0xb640('0x32')][_0xb640('0x36')]?_0x54ca61['attributes']:_0xf8e8a6[_0xb640('0x34')];if(!_0x4aeffc[_0xb640('0x31')]['hasOwnProperty']('nolimit')){_0x54ca61[_0xb640('0x23')]=qs['limit'](_0x4aeffc[_0xb640('0x31')][_0xb640('0x23')]);_0x54ca61[_0xb640('0x21')]=qs[_0xb640('0x21')](_0x4aeffc[_0xb640('0x31')][_0xb640('0x21')]);}_0x54ca61['order']=qs[_0xb640('0x37')](_0x4aeffc[_0xb640('0x31')][_0xb640('0x37')]);_0x54ca61['where']=qs[_0xb640('0x38')](_[_0xb640('0x39')](_0x4aeffc['query'],_0xf8e8a6[_0xb640('0x38')]),_0x5bd002);if(_0x4aeffc[_0xb640('0x31')][_0xb640('0x3a')]){_0x54ca61[_0xb640('0x3b')]=_[_0xb640('0x3c')](_0x54ca61[_0xb640('0x3b')],{'$or':_[_0xb640('0x2d')](_0x5bd002,function(_0x29a54f){if(_0x29a54f[_0xb640('0x3d')]!=='VIRTUAL'){var _0x447d1b={};_0x447d1b[_0x29a54f[_0xb640('0x2b')]]={'$like':'%'+_0x4aeffc[_0xb640('0x31')][_0xb640('0x3a')]+'%'};return _0x447d1b;}})});}_0x54ca61=_[_0xb640('0x3c')]({},_0x54ca61,_0x4aeffc[_0xb640('0x3e')]);var _0xc2f1db={'where':_0x54ca61[_0xb640('0x3b')]};return db[_0xb640('0x2e')]['count'](_0xc2f1db)[_0xb640('0x27')](function(_0x299a06){_0x4b91ba[_0xb640('0x24')]=_0x299a06;if(_0x4aeffc[_0xb640('0x31')][_0xb640('0x3f')]){_0x54ca61['include']=[{'all':!![]}];}return db[_0xb640('0x2e')][_0xb640('0x40')](_0x54ca61);})['then'](function(_0x274274){_0x4b91ba[_0xb640('0x41')]=_0x274274;return _0x4b91ba;})[_0xb640('0x27')](respondWithFilteredResult(_0x19fed6,_0x54ca61))[_0xb640('0x42')](handleError(_0x19fed6,null));};exports[_0xb640('0x43')]=function(_0x15b9ac,_0x28a716){var _0x43f91c={'raw':!![],'where':{'id':_0x15b9ac['params']['id']}},_0x2fbcf1={};_0x2fbcf1[_0xb640('0x34')]=_[_0xb640('0x44')](db[_0xb640('0x2e')]['rawAttributes']);_0x2fbcf1[_0xb640('0x31')]=_[_0xb640('0x44')](_0x15b9ac[_0xb640('0x31')]);_0x2fbcf1[_0xb640('0x38')]=_[_0xb640('0x33')](_0x2fbcf1[_0xb640('0x34')],_0x2fbcf1[_0xb640('0x31')]);_0x43f91c['attributes']=_[_0xb640('0x33')](_0x2fbcf1[_0xb640('0x34')],qs[_0xb640('0x35')](_0x15b9ac[_0xb640('0x31')]['fields']));_0x43f91c[_0xb640('0x32')]=_0x43f91c['attributes'][_0xb640('0x36')]?_0x43f91c['attributes']:_0x2fbcf1['model'];if(_0x15b9ac['query']['includeAll']){_0x43f91c[_0xb640('0x45')]=[{'all':!![]}];}_0x43f91c=_[_0xb640('0x3c')]({},_0x43f91c,_0x15b9ac[_0xb640('0x3e')]);return db[_0xb640('0x2e')]['find'](_0x43f91c)[_0xb640('0x27')](handleEntityNotFound(_0x28a716,null))[_0xb640('0x27')](respondWithResult(_0x28a716,null))[_0xb640('0x42')](handleError(_0x28a716,null));};exports[_0xb640('0x46')]=function(_0xc60ea8,_0x30a1c5){return db['JscriptySessionReport']['create'](_0xc60ea8[_0xb640('0x47')],{})[_0xb640('0x27')](respondWithResult(_0x30a1c5,0xc9))[_0xb640('0x42')](handleError(_0x30a1c5,null));};exports['update']=function(_0x27ad66,_0x1115d4){if(_0x27ad66['body']['id']){delete _0x27ad66[_0xb640('0x47')]['id'];}return db[_0xb640('0x2e')][_0xb640('0x48')]({'where':{'id':_0x27ad66[_0xb640('0x49')]['id']}})[_0xb640('0x27')](handleEntityNotFound(_0x1115d4,null))[_0xb640('0x27')](saveUpdates(_0x27ad66[_0xb640('0x47')],null))[_0xb640('0x27')](respondWithResult(_0x1115d4,null))[_0xb640('0x42')](handleError(_0x1115d4,null));};exports[_0xb640('0x28')]=function(_0x49360a,_0x3417ca){return db[_0xb640('0x2e')]['find']({'where':{'id':_0x49360a[_0xb640('0x49')]['id']}})[_0xb640('0x27')](handleEntityNotFound(_0x3417ca,null))[_0xb640('0x27')](removeEntity(_0x3417ca,null))[_0xb640('0x42')](handleError(_0x3417ca,null));};exports['describe']=function(_0x3244f8,_0x3f77a6){return db[_0xb640('0x2e')]['describe']()[_0xb640('0x27')](respondWithResult(_0x3f77a6,null))['catch'](handleError(_0x3f77a6,null));};exports['getQuestions']=function(_0x29f25b,_0x1ffd77,_0x40e988){var _0x41ce7f={'raw':!![],'where':{}};var _0x165814={};var _0x10a78d={'count':0x0,'rows':[]};return db[_0xb640('0x2e')][_0xb640('0x4a')]({'where':{'id':_0x29f25b[_0xb640('0x49')]['id']}})[_0xb640('0x27')](handleEntityNotFound(_0x1ffd77,null))['then'](function(_0x409d31){if(_0x409d31){_0x165814['model']=_['keys'](db[_0xb640('0x4b')][_0xb640('0x2f')]);_0x165814['query']=_[_0xb640('0x44')](_0x29f25b['query']);_0x165814[_0xb640('0x38')]=_[_0xb640('0x33')](_0x165814['model'],_0x165814['query']);_0x41ce7f['attributes']=_[_0xb640('0x33')](_0x165814['model'],qs['fields'](_0x29f25b['query'][_0xb640('0x35')]));_0x41ce7f[_0xb640('0x32')]=_0x41ce7f[_0xb640('0x32')][_0xb640('0x36')]?_0x41ce7f['attributes']:_0x165814[_0xb640('0x34')];if(!_0x29f25b[_0xb640('0x31')][_0xb640('0x4c')](_0xb640('0x4d'))){_0x41ce7f[_0xb640('0x23')]=qs['limit'](_0x29f25b[_0xb640('0x31')][_0xb640('0x23')]);_0x41ce7f[_0xb640('0x21')]=qs['offset'](_0x29f25b[_0xb640('0x31')][_0xb640('0x21')]);}_0x41ce7f[_0xb640('0x4e')]=qs[_0xb640('0x37')](_0x29f25b[_0xb640('0x31')][_0xb640('0x37')]);_0x41ce7f[_0xb640('0x3b')]=qs[_0xb640('0x38')](_[_0xb640('0x39')](_0x29f25b[_0xb640('0x31')],_0x165814['filters']));_0x41ce7f[_0xb640('0x3b')][_0xb640('0x4f')]=_0x409d31['id'];if(_0x29f25b[_0xb640('0x31')]['filter']){_0x41ce7f[_0xb640('0x3b')]=_[_0xb640('0x3c')](_0x41ce7f[_0xb640('0x3b')],{'$or':_[_0xb640('0x2d')](_0x41ce7f[_0xb640('0x32')],function(_0x2292e1){var _0x1d5800={};_0x1d5800[_0x2292e1]={'$like':'%'+_0x29f25b['query']['filter']+'%'};return _0x1d5800;})});}_0x41ce7f=_[_0xb640('0x3c')]({},_0x41ce7f,_0x29f25b[_0xb640('0x3e')]);return db['JscriptyQuestionReport']['count']({'where':_0x41ce7f['where']})[_0xb640('0x27')](function(_0x344589){_0x10a78d[_0xb640('0x24')]=_0x344589;if(_0x29f25b[_0xb640('0x31')][_0xb640('0x3f')]){_0x41ce7f[_0xb640('0x45')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xb640('0x40')](_0x41ce7f);})[_0xb640('0x27')](function(_0x346354){_0x10a78d[_0xb640('0x41')]=_0x346354;return _0x10a78d;});}})['then'](respondWithFilteredResult(_0x1ffd77,_0x41ce7f))[_0xb640('0x42')](handleError(_0x1ffd77,null));}; \ No newline at end of file +var _0x359e=['status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','catch','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xec1182,_0x5e70a0){var _0x2d9ae2=function(_0x2eb3d8){while(--_0x2eb3d8){_0xec1182['push'](_0xec1182['shift']());}};_0x2d9ae2(++_0x5e70a0);}(_0x359e,0x11e));var _0xe359=function(_0x3c21c4,_0x4a6e5b){_0x3c21c4=_0x3c21c4-0x0;var _0x1d13dc=_0x359e[_0x3c21c4];return _0x1d13dc;};'use strict';var emlformat=require(_0xe359('0x0'));var rimraf=require(_0xe359('0x1'));var zipdir=require(_0xe359('0x2'));var jsonpatch=require(_0xe359('0x3'));var rp=require(_0xe359('0x4'));var moment=require('moment');var BPromise=require(_0xe359('0x5'));var Mustache=require(_0xe359('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe359('0x7'));var csv=require(_0xe359('0x8'));var ejs=require(_0xe359('0x9'));var fs=require('fs');var fs_extra=require(_0xe359('0xa'));var _=require('lodash');var squel=require(_0xe359('0xb'));var crypto=require(_0xe359('0xc'));var jsforce=require(_0xe359('0xd'));var deskjs=require(_0xe359('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe359('0xf'));var Papa=require('papaparse');var Redis=require(_0xe359('0x10'));var authService=require(_0xe359('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe359('0x12'));var hardwareService=require(_0xe359('0x13'));var logger=require(_0xe359('0x14'))('api');var utils=require(_0xe359('0x15'));var config=require(_0xe359('0x16'));var licenseUtil=require(_0xe359('0x17'));var db=require(_0xe359('0x18'))['db'];function respondWithStatusCode(_0x43af75,_0x25001d){_0x25001d=_0x25001d||0xcc;return function(_0x40611e){if(_0x40611e){return _0x43af75[_0xe359('0x19')](_0x25001d);}return _0x43af75[_0xe359('0x1a')](_0x25001d)[_0xe359('0x1b')]();};}function respondWithResult(_0x3e0b1f,_0x107b4d){_0x107b4d=_0x107b4d||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x3e0b1f[_0xe359('0x1a')](_0x107b4d)[_0xe359('0x1c')](_0x26b2bc);}};}function respondWithFilteredResult(_0x3bcc8f,_0x55827a){return function(_0x32f2e5){if(_0x32f2e5){var _0x249b84=typeof _0x55827a[_0xe359('0x1d')]===_0xe359('0x1e')&&typeof _0x55827a[_0xe359('0x1f')]===_0xe359('0x1e');var _0x2d9665=_0x32f2e5['count'];var _0x828220=_0x249b84?0x0:_0x55827a[_0xe359('0x1d')];var _0x5939c6=_0x249b84?_0x32f2e5[_0xe359('0x20')]:_0x55827a[_0xe359('0x1d')]+_0x55827a[_0xe359('0x1f')];var _0xb57782;if(_0x5939c6>=_0x2d9665){_0x5939c6=_0x2d9665;_0xb57782=0xc8;}else{_0xb57782=0xce;}_0x3bcc8f['status'](_0xb57782);return _0x3bcc8f['set'](_0xe359('0x21'),_0x828220+'-'+_0x5939c6+'/'+_0x2d9665)[_0xe359('0x1c')](_0x32f2e5);}return null;};}function patchUpdates(_0x598d31){return function(_0x1e73cc){try{jsonpatch['apply'](_0x1e73cc,_0x598d31,!![]);}catch(_0x3be949){return BPromise['reject'](_0x3be949);}return _0x1e73cc[_0xe359('0x22')]();};}function saveUpdates(_0x11e325,_0xdcfda0){return function(_0x3c514b){if(_0x3c514b){return _0x3c514b['update'](_0x11e325)[_0xe359('0x23')](function(_0x3dbe8f){return _0x3dbe8f;});}return null;};}function removeEntity(_0xdba46f,_0x4e494d){return function(_0x1da295){if(_0x1da295){return _0x1da295[_0xe359('0x24')]()[_0xe359('0x23')](function(){_0xdba46f[_0xe359('0x1a')](0xcc)[_0xe359('0x1b')]();});}};}function handleEntityNotFound(_0x4be24e,_0x4ea105){return function(_0x4fa636){if(!_0x4fa636){_0x4be24e[_0xe359('0x19')](0x194);}return _0x4fa636;};}function handleError(_0xdfa8ab,_0x817068){_0x817068=_0x817068||0x1f4;return function(_0x11ff69){logger['error'](_0x11ff69[_0xe359('0x25')]);if(_0x11ff69[_0xe359('0x26')]){delete _0x11ff69[_0xe359('0x26')];}_0xdfa8ab[_0xe359('0x1a')](_0x817068)[_0xe359('0x27')](_0x11ff69);};}exports[_0xe359('0x28')]=function(_0x23093f,_0x58b4a9){var _0xc90fdf={},_0x9e57e0={},_0x3582be={'count':0x0,'rows':[]};var _0x4055bf=_[_0xe359('0x29')](db[_0xe359('0x2a')][_0xe359('0x2b')],function(_0x6de31a){return{'name':_0x6de31a['fieldName'],'type':_0x6de31a[_0xe359('0x2c')][_0xe359('0x2d')]};});_0x9e57e0[_0xe359('0x2e')]=_[_0xe359('0x29')](_0x4055bf,_0xe359('0x26'));_0x9e57e0[_0xe359('0x2f')]=_[_0xe359('0x30')](_0x23093f[_0xe359('0x2f')]);_0x9e57e0['filters']=_['intersection'](_0x9e57e0['model'],_0x9e57e0[_0xe359('0x2f')]);_0xc90fdf[_0xe359('0x31')]=_[_0xe359('0x32')](_0x9e57e0['model'],qs[_0xe359('0x33')](_0x23093f[_0xe359('0x2f')][_0xe359('0x33')]));_0xc90fdf[_0xe359('0x31')]=_0xc90fdf[_0xe359('0x31')][_0xe359('0x34')]?_0xc90fdf['attributes']:_0x9e57e0['model'];if(!_0x23093f[_0xe359('0x2f')][_0xe359('0x35')](_0xe359('0x36'))){_0xc90fdf[_0xe359('0x1f')]=qs[_0xe359('0x1f')](_0x23093f['query'][_0xe359('0x1f')]);_0xc90fdf['offset']=qs[_0xe359('0x1d')](_0x23093f[_0xe359('0x2f')]['offset']);}_0xc90fdf[_0xe359('0x37')]=qs[_0xe359('0x38')](_0x23093f[_0xe359('0x2f')][_0xe359('0x38')]);_0xc90fdf[_0xe359('0x39')]=qs[_0xe359('0x3a')](_[_0xe359('0x3b')](_0x23093f[_0xe359('0x2f')],_0x9e57e0[_0xe359('0x3a')]),_0x4055bf);if(_0x23093f[_0xe359('0x2f')][_0xe359('0x3c')]){_0xc90fdf[_0xe359('0x39')]=_[_0xe359('0x3d')](_0xc90fdf[_0xe359('0x39')],{'$or':_[_0xe359('0x29')](_0x4055bf,function(_0x4ad14d){if(_0x4ad14d[_0xe359('0x2c')]!==_0xe359('0x3e')){var _0x2b67d7={};_0x2b67d7[_0x4ad14d['name']]={'$like':'%'+_0x23093f[_0xe359('0x2f')][_0xe359('0x3c')]+'%'};return _0x2b67d7;}})});}_0xc90fdf=_[_0xe359('0x3d')]({},_0xc90fdf,_0x23093f['options']);var _0x21df11={'where':_0xc90fdf[_0xe359('0x39')]};return db[_0xe359('0x2a')]['count'](_0x21df11)['then'](function(_0x1d0c2b){_0x3582be[_0xe359('0x20')]=_0x1d0c2b;if(_0x23093f[_0xe359('0x2f')][_0xe359('0x3f')]){_0xc90fdf['include']=[{'all':!![]}];}return db[_0xe359('0x2a')][_0xe359('0x40')](_0xc90fdf);})[_0xe359('0x23')](function(_0x3c5047){_0x3582be[_0xe359('0x41')]=_0x3c5047;return _0x3582be;})[_0xe359('0x23')](respondWithFilteredResult(_0x58b4a9,_0xc90fdf))['catch'](handleError(_0x58b4a9,null));};exports[_0xe359('0x42')]=function(_0x2464f7,_0x38df70){var _0x2ae48d={'raw':!![],'where':{'id':_0x2464f7[_0xe359('0x43')]['id']}},_0x5da6da={};_0x5da6da['model']=_[_0xe359('0x30')](db[_0xe359('0x2a')][_0xe359('0x2b')]);_0x5da6da[_0xe359('0x2f')]=_[_0xe359('0x30')](_0x2464f7['query']);_0x5da6da['filters']=_['intersection'](_0x5da6da[_0xe359('0x2e')],_0x5da6da[_0xe359('0x2f')]);_0x2ae48d[_0xe359('0x31')]=_[_0xe359('0x32')](_0x5da6da[_0xe359('0x2e')],qs[_0xe359('0x33')](_0x2464f7['query'][_0xe359('0x33')]));_0x2ae48d[_0xe359('0x31')]=_0x2ae48d['attributes'][_0xe359('0x34')]?_0x2ae48d[_0xe359('0x31')]:_0x5da6da[_0xe359('0x2e')];if(_0x2464f7['query'][_0xe359('0x3f')]){_0x2ae48d[_0xe359('0x44')]=[{'all':!![]}];}_0x2ae48d=_[_0xe359('0x3d')]({},_0x2ae48d,_0x2464f7[_0xe359('0x45')]);return db['JscriptySessionReport'][_0xe359('0x46')](_0x2ae48d)[_0xe359('0x23')](handleEntityNotFound(_0x38df70,null))[_0xe359('0x23')](respondWithResult(_0x38df70,null))['catch'](handleError(_0x38df70,null));};exports['create']=function(_0x5b85e9,_0x4c3b5d){return db[_0xe359('0x2a')][_0xe359('0x47')](_0x5b85e9[_0xe359('0x48')],{})[_0xe359('0x23')](respondWithResult(_0x4c3b5d,0xc9))[_0xe359('0x49')](handleError(_0x4c3b5d,null));};exports['update']=function(_0x2eeadf,_0x10e1f4){if(_0x2eeadf[_0xe359('0x48')]['id']){delete _0x2eeadf[_0xe359('0x48')]['id'];}return db['JscriptySessionReport'][_0xe359('0x46')]({'where':{'id':_0x2eeadf[_0xe359('0x43')]['id']}})[_0xe359('0x23')](handleEntityNotFound(_0x10e1f4,null))['then'](saveUpdates(_0x2eeadf['body'],null))['then'](respondWithResult(_0x10e1f4,null))[_0xe359('0x49')](handleError(_0x10e1f4,null));};exports[_0xe359('0x24')]=function(_0x9d43c6,_0x4cb037){return db[_0xe359('0x2a')][_0xe359('0x46')]({'where':{'id':_0x9d43c6[_0xe359('0x43')]['id']}})['then'](handleEntityNotFound(_0x4cb037,null))[_0xe359('0x23')](removeEntity(_0x4cb037,null))['catch'](handleError(_0x4cb037,null));};exports[_0xe359('0x4a')]=function(_0x72d006,_0x4cf1ff){return db[_0xe359('0x2a')][_0xe359('0x4a')]()[_0xe359('0x23')](respondWithResult(_0x4cf1ff,null))[_0xe359('0x49')](handleError(_0x4cf1ff,null));};exports['getQuestions']=function(_0x2abb30,_0x136a5e,_0x5ac2b9){var _0x284f01={'raw':!![],'where':{}};var _0xa0e6f1={};var _0x2a04b5={'count':0x0,'rows':[]};return db[_0xe359('0x2a')][_0xe359('0x4b')]({'where':{'id':_0x2abb30['params']['id']}})['then'](handleEntityNotFound(_0x136a5e,null))[_0xe359('0x23')](function(_0x5e35e6){if(_0x5e35e6){_0xa0e6f1[_0xe359('0x2e')]=_[_0xe359('0x30')](db[_0xe359('0x4c')][_0xe359('0x2b')]);_0xa0e6f1['query']=_[_0xe359('0x30')](_0x2abb30[_0xe359('0x2f')]);_0xa0e6f1['filters']=_[_0xe359('0x32')](_0xa0e6f1[_0xe359('0x2e')],_0xa0e6f1['query']);_0x284f01[_0xe359('0x31')]=_[_0xe359('0x32')](_0xa0e6f1[_0xe359('0x2e')],qs['fields'](_0x2abb30[_0xe359('0x2f')][_0xe359('0x33')]));_0x284f01['attributes']=_0x284f01[_0xe359('0x31')][_0xe359('0x34')]?_0x284f01[_0xe359('0x31')]:_0xa0e6f1[_0xe359('0x2e')];if(!_0x2abb30[_0xe359('0x2f')][_0xe359('0x35')](_0xe359('0x36'))){_0x284f01[_0xe359('0x1f')]=qs['limit'](_0x2abb30[_0xe359('0x2f')]['limit']);_0x284f01[_0xe359('0x1d')]=qs[_0xe359('0x1d')](_0x2abb30[_0xe359('0x2f')][_0xe359('0x1d')]);}_0x284f01[_0xe359('0x37')]=qs['sort'](_0x2abb30['query'][_0xe359('0x38')]);_0x284f01[_0xe359('0x39')]=qs[_0xe359('0x3a')](_[_0xe359('0x3b')](_0x2abb30['query'],_0xa0e6f1[_0xe359('0x3a')]));_0x284f01[_0xe359('0x39')][_0xe359('0x4d')]=_0x5e35e6['id'];if(_0x2abb30[_0xe359('0x2f')]['filter']){_0x284f01['where']=_[_0xe359('0x3d')](_0x284f01[_0xe359('0x39')],{'$or':_[_0xe359('0x29')](_0x284f01[_0xe359('0x31')],function(_0x143c6f){var _0x48b020={};_0x48b020[_0x143c6f]={'$like':'%'+_0x2abb30['query'][_0xe359('0x3c')]+'%'};return _0x48b020;})});}_0x284f01=_['merge']({},_0x284f01,_0x2abb30[_0xe359('0x45')]);return db['JscriptyQuestionReport'][_0xe359('0x20')]({'where':_0x284f01[_0xe359('0x39')]})[_0xe359('0x23')](function(_0x9e072b){_0x2a04b5[_0xe359('0x20')]=_0x9e072b;if(_0x2abb30[_0xe359('0x2f')][_0xe359('0x3f')]){_0x284f01[_0xe359('0x44')]=[{'all':!![]}];}return db[_0xe359('0x4c')]['findAll'](_0x284f01);})[_0xe359('0x23')](function(_0x150314){_0x2a04b5['rows']=_0x150314;return _0x2a04b5;});}})[_0xe359('0x23')](respondWithFilteredResult(_0x136a5e,_0x284f01))[_0xe359('0x49')](handleError(_0x136a5e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b057cf5..fd436cf 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 _0x8958=['define','JscriptySessionReport','report_jscripty_sessions','util','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x2dc014,_0x48d290){var _0x4e8555=function(_0x385853){while(--_0x385853){_0x2dc014['push'](_0x2dc014['shift']());}};_0x4e8555(++_0x48d290);}(_0x8958,0x93));var _0x8895=function(_0x4c7578,_0xd3e61f){_0x4c7578=_0x4c7578-0x0;var _0x217613=_0x8958[_0x4c7578];return _0x217613;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x228e16,_0x4f08e2){var _0x44dbf=function(_0xa81867){while(--_0xa81867){_0x228e16['push'](_0x228e16['shift']());}};_0x44dbf(++_0x4f08e2);}(_0x6050,0x196));var _0x0605=function(_0xf2dc2,_0x4fa12f){_0xf2dc2=_0xf2dc2-0x0;var _0x1d541b=_0x6050[_0xf2dc2];return _0x1d541b;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('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 e576ea9..594ecb9 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 _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x11a1a8,_0x5775a9){var _0x2d5c24=function(_0x31d95a){while(--_0x31d95a){_0x11a1a8['push'](_0x11a1a8['shift']());}};_0x2d5c24(++_0x5775a9);}(_0x4c60,0xc1));var _0x04c6=function(_0x43b9b6,_0x15b4de){_0x43b9b6=_0x43b9b6-0x0;var _0x514428=_0x4c60[_0x43b9b6];return _0x514428;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});} \ No newline at end of file +var _0x1261=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4f7797,_0x1ead74){var _0x470335=function(_0x1a99dc){while(--_0x1a99dc){_0x4f7797['push'](_0x4f7797['shift']());}};_0x470335(++_0x1ead74);}(_0x1261,0x144));var _0x1126=function(_0x31fb16,_0x3a4f55){_0x31fb16=_0x31fb16-0x0;var _0x50f4b7=_0x1261[_0x31fb16];return _0x50f4b7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 93b39bf..d1a8538 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 _0x241a=['../../config/environment','./license.controller','put','isAuthenticated','update','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x241a,0xd7));var _0xa241=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x241a[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0xa241('0x0'));var util=require(_0xa241('0x1'));var path=require(_0xa241('0x2'));var timeout=require(_0xa241('0x3'));var express=require(_0xa241('0x4'));var router=express[_0xa241('0x5')]();var fs_extra=require(_0xa241('0x6'));var auth=require(_0xa241('0x7'));var interaction=require(_0xa241('0x8'));var config=require(_0xa241('0x9'));var controller=require(_0xa241('0xa'));router['get']('/',controller['index']);router[_0xa241('0xb')]('/:id',auth[_0xa241('0xc')](),controller[_0xa241('0xd')]);router['get']('/download_log_file',auth['isAuthenticated'](),controller[_0xa241('0xe')]);module[_0xa241('0xf')]=router; \ No newline at end of file +var _0x5d46=['./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x5d46,0x1ef));var _0x65d4=function(_0x4a9166,_0x497608){_0x4a9166=_0x4a9166-0x0;var _0x215015=_0x5d46[_0x4a9166];return _0x215015;};'use strict';var multer=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var path=require(_0x65d4('0x2'));var timeout=require(_0x65d4('0x3'));var express=require(_0x65d4('0x4'));var router=express['Router']();var fs_extra=require(_0x65d4('0x5'));var auth=require(_0x65d4('0x6'));var interaction=require(_0x65d4('0x7'));var config=require(_0x65d4('0x8'));var controller=require(_0x65d4('0x9'));router[_0x65d4('0xa')]('/',controller[_0x65d4('0xb')]);router['put'](_0x65d4('0xc'),auth[_0x65d4('0xd')](),controller[_0x65d4('0xe')]);router[_0x65d4('0xa')](_0x65d4('0xf'),auth[_0x65d4('0xd')](),controller[_0x65d4('0x10')]);module[_0x65d4('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index adf273a..6091b49 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 _0x0e05=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x278be5,_0x21f08d){var _0x4dd5ad=function(_0x4bbd77){while(--_0x4bbd77){_0x278be5['push'](_0x278be5['shift']());}};_0x4dd5ad(++_0x21f08d);}(_0x0e05,0xa5));var _0x50e0=function(_0x5be5db,_0x3b34e3){_0x5be5db=_0x5be5db-0x0;var _0x2d5161=_0x0e05[_0x5be5db];return _0x2d5161;};'use strict';var Sequelize=require(_0x50e0('0x0'));module[_0x50e0('0x1')]={'license':{'type':Sequelize[_0x50e0('0x2')]},'data1':{'type':Sequelize[_0x50e0('0x3')]},'data2':{'type':Sequelize[_0x50e0('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x50e0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0469=['INTEGER','sequelize','TEXT','STRING'];(function(_0x34c8a0,_0x3a183b){var _0x350c29=function(_0x438e46){while(--_0x438e46){_0x34c8a0['push'](_0x34c8a0['shift']());}};_0x350c29(++_0x3a183b);}(_0x0469,0x111));var _0x9046=function(_0x3246df,_0x404d23){_0x3246df=_0x3246df-0x0;var _0x2d8ed3=_0x0469[_0x3246df];return _0x2d8ed3;};'use strict';var Sequelize=require(_0x9046('0x0'));module['exports']={'license':{'type':Sequelize[_0x9046('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9046('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9046('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7196af6..ba042b2 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 _0x9a37=['filters','intersection','fields','attributes','length','merge','options','getLicense','catch','find','params','checkLicense','body','key','downloadLogFile','license-info.log','join','log','setHeader','Content-disposition','attachment;\x20filename=','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','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','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query'];(function(_0x2797c2,_0x4ae3af){var _0x15d1cf=function(_0x5f3eeb){while(--_0x5f3eeb){_0x2797c2['push'](_0x2797c2['shift']());}};_0x15d1cf(++_0x4ae3af);}(_0x9a37,0xa7));var _0x79a3=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0x9a37[_0x24c135];return _0x290c66;};'use strict';var emlformat=require(_0x79a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79a3('0x2'));var moment=require(_0x79a3('0x3'));var BPromise=require(_0x79a3('0x4'));var Mustache=require(_0x79a3('0x5'));var util=require(_0x79a3('0x6'));var path=require('path');var sox=require(_0x79a3('0x7'));var csv=require(_0x79a3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79a3('0x9'));var _=require(_0x79a3('0xa'));var squel=require(_0x79a3('0xb'));var crypto=require(_0x79a3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x79a3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x79a3('0xe'));var Papa=require(_0x79a3('0xf'));var Redis=require('ioredis');var authService=require(_0x79a3('0x10'));var qs=require(_0x79a3('0x11'));var as=require(_0x79a3('0x12'));var hardwareService=require(_0x79a3('0x13'));var logger=require(_0x79a3('0x14'))(_0x79a3('0x15'));var utils=require(_0x79a3('0x16'));var config=require(_0x79a3('0x17'));var licenseUtil=require(_0x79a3('0x18'));var db=require(_0x79a3('0x19'))['db'];function respondWithStatusCode(_0x57b6f0,_0x1b67bd){_0x1b67bd=_0x1b67bd||0xcc;return function(_0x198618){if(_0x198618){return _0x57b6f0[_0x79a3('0x1a')](_0x1b67bd);}return _0x57b6f0[_0x79a3('0x1b')](_0x1b67bd)[_0x79a3('0x1c')]();};}function respondWithResult(_0x454fbb,_0x966ce1){_0x966ce1=_0x966ce1||0xc8;return function(_0x44fe9c){if(_0x44fe9c){return _0x454fbb['status'](_0x966ce1)['json'](_0x44fe9c);}};}function respondWithFilteredResult(_0x532eb2,_0x1def04){return function(_0x5a537e){if(_0x5a537e){var _0x13be1e=typeof _0x1def04['offset']==='undefined'&&typeof _0x1def04[_0x79a3('0x1d')]===_0x79a3('0x1e');var _0x29f197=_0x5a537e[_0x79a3('0x1f')];var _0x27f862=_0x13be1e?0x0:_0x1def04['offset'];var _0x4d478c=_0x13be1e?_0x5a537e[_0x79a3('0x1f')]:_0x1def04[_0x79a3('0x20')]+_0x1def04[_0x79a3('0x1d')];var _0x27f05f;if(_0x4d478c>=_0x29f197){_0x4d478c=_0x29f197;_0x27f05f=0xc8;}else{_0x27f05f=0xce;}_0x532eb2[_0x79a3('0x1b')](_0x27f05f);return _0x532eb2[_0x79a3('0x21')](_0x79a3('0x22'),_0x27f862+'-'+_0x4d478c+'/'+_0x29f197)[_0x79a3('0x23')](_0x5a537e);}return null;};}function patchUpdates(_0x365008){return function(_0x1dbe4c){try{jsonpatch[_0x79a3('0x24')](_0x1dbe4c,_0x365008,!![]);}catch(_0x5f4c00){return BPromise[_0x79a3('0x25')](_0x5f4c00);}return _0x1dbe4c[_0x79a3('0x26')]();};}function saveUpdates(_0x2c130d,_0x3a5120){return function(_0x568f08){if(_0x568f08){return _0x568f08[_0x79a3('0x27')](_0x2c130d)[_0x79a3('0x28')](function(_0x4740fa){return _0x4740fa;});}return null;};}function removeEntity(_0x5e5319,_0x4289c8){return function(_0x249102){if(_0x249102){return _0x249102[_0x79a3('0x29')]()[_0x79a3('0x28')](function(){_0x5e5319[_0x79a3('0x1b')](0xcc)[_0x79a3('0x1c')]();});}};}function handleEntityNotFound(_0x5f2c71,_0x4b4685){return function(_0x492a76){if(!_0x492a76){_0x5f2c71[_0x79a3('0x1a')](0x194);}return _0x492a76;};}function handleError(_0x1dc5b1,_0x1b3180){_0x1b3180=_0x1b3180||0x1f4;return function(_0x28b005){logger[_0x79a3('0x2a')](_0x28b005[_0x79a3('0x2b')]);if(_0x28b005[_0x79a3('0x2c')]){delete _0x28b005[_0x79a3('0x2c')];}_0x1dc5b1[_0x79a3('0x1b')](_0x1b3180)[_0x79a3('0x2d')](_0x28b005);};}var utilLicense=require(_0x79a3('0x18'));exports[_0x79a3('0x2e')]=function(_0x37ef47,_0x9c9f57){var _0x4a7b40={'raw':!![],'where':{'id':0x1}},_0x1992ac={};_0x1992ac[_0x79a3('0x2f')]=_[_0x79a3('0x30')](db[_0x79a3('0x31')][_0x79a3('0x32')]);_0x1992ac[_0x79a3('0x33')]=_[_0x79a3('0x30')](_0x37ef47['query']);_0x1992ac[_0x79a3('0x34')]=_[_0x79a3('0x35')](_0x1992ac[_0x79a3('0x2f')],_0x1992ac['query']);_0x4a7b40['attributes']=_[_0x79a3('0x35')](_0x1992ac[_0x79a3('0x2f')],qs['fields'](_0x37ef47['query'][_0x79a3('0x36')]));_0x4a7b40[_0x79a3('0x37')]=_0x4a7b40[_0x79a3('0x37')][_0x79a3('0x38')]?_0x4a7b40[_0x79a3('0x37')]:_0x1992ac[_0x79a3('0x2f')];_0x4a7b40=_[_0x79a3('0x39')]({},_0x4a7b40,_0x37ef47[_0x79a3('0x3a')]);return utilLicense[_0x79a3('0x3b')](_0x4a7b40)[_0x79a3('0x28')](respondWithResult(_0x9c9f57,null))[_0x79a3('0x3c')](handleError(_0x9c9f57,null));};exports[_0x79a3('0x27')]=function(_0x56db08,_0x2eb1b4){if(_0x56db08['body']['id']){delete _0x56db08['body']['id'];}return db[_0x79a3('0x31')][_0x79a3('0x3d')]({'where':{'id':_0x56db08[_0x79a3('0x3e')]['id']}})[_0x79a3('0x28')](handleEntityNotFound(_0x2eb1b4,null))[_0x79a3('0x28')](function(_0x501e31){var _0x236c98=_0x501e31['get']({'plain':!![]});return utilLicense[_0x79a3('0x3f')](_0x236c98,_0x56db08[_0x79a3('0x40')][_0x79a3('0x41')]);})[_0x79a3('0x28')](function(_0x17a325){if(!_0x17a325['demo']){return saveUpdates(_0x56db08[_0x79a3('0x40')],null);}return _0x17a325;})[_0x79a3('0x28')](respondWithResult(_0x2eb1b4,null))[_0x79a3('0x3c')](handleError(_0x2eb1b4,null));};exports[_0x79a3('0x42')]=function(_0x46fd79,_0x17c805){var _0x2ca629=_0x79a3('0x43');var _0x4e16af=path[_0x79a3('0x44')]('/var',_0x79a3('0x45'),'xcally',_0x2ca629);_0x17c805[_0x79a3('0x46')](_0x79a3('0x47'),_0x79a3('0x48')+_0x2ca629);_0x17c805[_0x79a3('0x21')]('Content-Type','text/plain');_0x17c805['download'](_0x4e16af);}; \ No newline at end of file +var _0xcb76=['set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0xcb76,0x14a));var _0x6cb7=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xcb76[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0x6cb7('0x0'));var rimraf=require(_0x6cb7('0x1'));var zipdir=require(_0x6cb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cb7('0x3'));var moment=require(_0x6cb7('0x4'));var BPromise=require(_0x6cb7('0x5'));var Mustache=require('mustache');var util=require(_0x6cb7('0x6'));var path=require(_0x6cb7('0x7'));var sox=require(_0x6cb7('0x8'));var csv=require(_0x6cb7('0x9'));var ejs=require(_0x6cb7('0xa'));var fs=require('fs');var fs_extra=require(_0x6cb7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6cb7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6cb7('0xd'));var toCsv=require(_0x6cb7('0x9'));var querystring=require(_0x6cb7('0xe'));var Papa=require('papaparse');var Redis=require(_0x6cb7('0xf'));var authService=require(_0x6cb7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6cb7('0x11'));var hardwareService=require(_0x6cb7('0x12'));var logger=require(_0x6cb7('0x13'))(_0x6cb7('0x14'));var utils=require(_0x6cb7('0x15'));var config=require(_0x6cb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eb533,_0x2b3a1b){_0x2b3a1b=_0x2b3a1b||0xcc;return function(_0x39d1cb){if(_0x39d1cb){return _0x5eb533['sendStatus'](_0x2b3a1b);}return _0x5eb533[_0x6cb7('0x17')](_0x2b3a1b)[_0x6cb7('0x18')]();};}function respondWithResult(_0x5c57ab,_0x26aaf5){_0x26aaf5=_0x26aaf5||0xc8;return function(_0xcc53ea){if(_0xcc53ea){return _0x5c57ab[_0x6cb7('0x17')](_0x26aaf5)[_0x6cb7('0x19')](_0xcc53ea);}};}function respondWithFilteredResult(_0x3b794a,_0x4f8ed9){return function(_0x58bad5){if(_0x58bad5){var _0x55c62f=typeof _0x4f8ed9[_0x6cb7('0x1a')]==='undefined'&&typeof _0x4f8ed9[_0x6cb7('0x1b')]===_0x6cb7('0x1c');var _0x3cdff2=_0x58bad5[_0x6cb7('0x1d')];var _0x3f7ada=_0x55c62f?0x0:_0x4f8ed9[_0x6cb7('0x1a')];var _0x1268ad=_0x55c62f?_0x58bad5[_0x6cb7('0x1d')]:_0x4f8ed9[_0x6cb7('0x1a')]+_0x4f8ed9['limit'];var _0x4a458d;if(_0x1268ad>=_0x3cdff2){_0x1268ad=_0x3cdff2;_0x4a458d=0xc8;}else{_0x4a458d=0xce;}_0x3b794a[_0x6cb7('0x17')](_0x4a458d);return _0x3b794a[_0x6cb7('0x1e')](_0x6cb7('0x1f'),_0x3f7ada+'-'+_0x1268ad+'/'+_0x3cdff2)[_0x6cb7('0x19')](_0x58bad5);}return null;};}function patchUpdates(_0x2359a8){return function(_0x1c2f15){try{jsonpatch[_0x6cb7('0x20')](_0x1c2f15,_0x2359a8,!![]);}catch(_0x40900d){return BPromise['reject'](_0x40900d);}return _0x1c2f15[_0x6cb7('0x21')]();};}function saveUpdates(_0x307786,_0x4d10d9){return function(_0x4d7f68){if(_0x4d7f68){return _0x4d7f68[_0x6cb7('0x22')](_0x307786)[_0x6cb7('0x23')](function(_0x2d4e5e){return _0x2d4e5e;});}return null;};}function removeEntity(_0x3005d8,_0x30c184){return function(_0x2a9733){if(_0x2a9733){return _0x2a9733[_0x6cb7('0x24')]()[_0x6cb7('0x23')](function(){_0x3005d8[_0x6cb7('0x17')](0xcc)[_0x6cb7('0x18')]();});}};}function handleEntityNotFound(_0x4fb1e8,_0x3a96c4){return function(_0x25eb34){if(!_0x25eb34){_0x4fb1e8[_0x6cb7('0x25')](0x194);}return _0x25eb34;};}function handleError(_0x4c6f44,_0x430a20){_0x430a20=_0x430a20||0x1f4;return function(_0x5178c3){logger[_0x6cb7('0x26')](_0x5178c3[_0x6cb7('0x27')]);if(_0x5178c3[_0x6cb7('0x28')]){delete _0x5178c3[_0x6cb7('0x28')];}_0x4c6f44[_0x6cb7('0x17')](_0x430a20)[_0x6cb7('0x29')](_0x5178c3);};}var utilLicense=require(_0x6cb7('0x2a'));exports[_0x6cb7('0x2b')]=function(_0x338029,_0x597872){var _0x9506b6={'raw':!![],'where':{'id':0x1}},_0x2de3e8={};_0x2de3e8[_0x6cb7('0x2c')]=_['keys'](db['License'][_0x6cb7('0x2d')]);_0x2de3e8[_0x6cb7('0x2e')]=_['keys'](_0x338029[_0x6cb7('0x2e')]);_0x2de3e8[_0x6cb7('0x2f')]=_[_0x6cb7('0x30')](_0x2de3e8['model'],_0x2de3e8[_0x6cb7('0x2e')]);_0x9506b6[_0x6cb7('0x31')]=_[_0x6cb7('0x30')](_0x2de3e8[_0x6cb7('0x2c')],qs[_0x6cb7('0x32')](_0x338029['query'][_0x6cb7('0x32')]));_0x9506b6[_0x6cb7('0x31')]=_0x9506b6['attributes'][_0x6cb7('0x33')]?_0x9506b6[_0x6cb7('0x31')]:_0x2de3e8[_0x6cb7('0x2c')];_0x9506b6=_[_0x6cb7('0x34')]({},_0x9506b6,_0x338029[_0x6cb7('0x35')]);return utilLicense[_0x6cb7('0x36')](_0x9506b6)[_0x6cb7('0x23')](respondWithResult(_0x597872,null))[_0x6cb7('0x37')](handleError(_0x597872,null));};exports[_0x6cb7('0x22')]=function(_0x28b5bd,_0x44f9a9){if(_0x28b5bd['body']['id']){delete _0x28b5bd[_0x6cb7('0x38')]['id'];}return db['License']['find']({'where':{'id':_0x28b5bd[_0x6cb7('0x39')]['id']}})['then'](handleEntityNotFound(_0x44f9a9,null))[_0x6cb7('0x23')](function(_0x3f67cf){var _0x3bdef3=_0x3f67cf[_0x6cb7('0x3a')]({'plain':!![]});return utilLicense[_0x6cb7('0x3b')](_0x3bdef3,_0x28b5bd[_0x6cb7('0x38')][_0x6cb7('0x3c')]);})[_0x6cb7('0x23')](function(_0x1c514a){if(!_0x1c514a[_0x6cb7('0x3d')]){return saveUpdates(_0x28b5bd[_0x6cb7('0x38')],null);}return _0x1c514a;})['then'](respondWithResult(_0x44f9a9,null))[_0x6cb7('0x37')](handleError(_0x44f9a9,null));};exports[_0x6cb7('0x3e')]=function(_0x1a92d6,_0x4e3d54){var _0x301f28=_0x6cb7('0x3f');var _0x2e27e0=path[_0x6cb7('0x40')](_0x6cb7('0x41'),'log',_0x6cb7('0x42'),_0x301f28);_0x4e3d54[_0x6cb7('0x43')](_0x6cb7('0x44'),_0x6cb7('0x45')+_0x301f28);_0x4e3d54[_0x6cb7('0x1e')]('Content-Type',_0x6cb7('0x46'));_0x4e3d54[_0x6cb7('0x47')](_0x2e27e0);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 49fc598..c546e59 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 _0xb353=['rimraf','./license.attributes','exports','define','License','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0xb353,0x10d));var _0x3b35=function(_0x29b425,_0x24ac45){_0x29b425=_0x29b425-0x0;var _0x2b88e3=_0xb353[_0x29b425];return _0x2b88e3;};'use strict';var _=require(_0x3b35('0x0'));var util=require(_0x3b35('0x1'));var logger=require('../../config/logger')(_0x3b35('0x2'));var moment=require(_0x3b35('0x3'));var BPromise=require(_0x3b35('0x4'));var rp=require(_0x3b35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b35('0x6'));var config=require('../../config/environment');var attributes=require(_0x3b35('0x7'));module[_0x3b35('0x8')]=function(_0xc510ed,_0xc446ac){return _0xc510ed[_0x3b35('0x9')](_0x3b35('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a44=['license','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x4dca38,_0x5dfae1){var _0x44656c=function(_0x538a62){while(--_0x538a62){_0x4dca38['push'](_0x4dca38['shift']());}};_0x44656c(++_0x5dfae1);}(_0x3a44,0x1e5));var _0x43a4=function(_0x2accbb,_0x435470){_0x2accbb=_0x2accbb-0x0;var _0x4e4ff7=_0x3a44[_0x2accbb];return _0x4e4ff7;};'use strict';var _=require(_0x43a4('0x0'));var util=require(_0x43a4('0x1'));var logger=require('../../config/logger')(_0x43a4('0x2'));var moment=require(_0x43a4('0x3'));var BPromise=require(_0x43a4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43a4('0x5'));var config=require(_0x43a4('0x6'));var attributes=require(_0x43a4('0x7'));module[_0x43a4('0x8')]=function(_0x4cc1fa,_0x2f9638){return _0x4cc1fa[_0x43a4('0x9')]('License',attributes,{'tableName':_0x43a4('0xa'),'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 253e3d6..807db18 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 _0x9a6d=['jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','../../mysqldb','../../config/environment'];(function(_0x1b0ef3,_0x5a327f){var _0x57c6d3=function(_0x3a0c5a){while(--_0x3a0c5a){_0x1b0ef3['push'](_0x1b0ef3['shift']());}};_0x57c6d3(++_0x5a327f);}(_0x9a6d,0x1a0));var _0xd9a6=function(_0x5b64b8,_0x152f90){_0x5b64b8=_0x5b64b8-0x0;var _0x302173=_0x9a6d[_0x5b64b8];return _0x302173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd9a6('0x0'));var BPromise=require(_0xd9a6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9a6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd9a6('0x3'));var jayson=require(_0xd9a6('0x4'));var client=jayson[_0xd9a6('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1038f0,_0x21dd8e,_0x411ea9){return new BPromise(function(_0x48ab0f,_0x2dd38d){return client['request'](_0x1038f0,_0x411ea9)[_0xd9a6('0x6')](function(_0x1139c8){logger[_0xd9a6('0x7')](_0xd9a6('0x8'),_0x21dd8e,_0xd9a6('0x9'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x21dd8e,'request\x20sent',JSON['stringify'](_0x1139c8));if(_0x1139c8[_0xd9a6('0xa')]){if(_0x1139c8[_0xd9a6('0xa')][_0xd9a6('0xb')]===0x1f4){logger[_0xd9a6('0xa')](_0xd9a6('0x8'),_0x21dd8e,_0x1139c8[_0xd9a6('0xa')][_0xd9a6('0xc')]);return _0x2dd38d(_0x1139c8[_0xd9a6('0xa')]['message']);}logger[_0xd9a6('0xa')](_0xd9a6('0x8'),_0x21dd8e,_0x1139c8[_0xd9a6('0xa')]['message']);return _0x48ab0f(_0x1139c8[_0xd9a6('0xa')][_0xd9a6('0xc')]);}else{logger[_0xd9a6('0x7')](_0xd9a6('0x8'),_0x21dd8e,_0xd9a6('0x9'));_0x48ab0f(_0x1139c8[_0xd9a6('0xd')][_0xd9a6('0xc')]);}})[_0xd9a6('0xe')](function(_0xe6171){logger[_0xd9a6('0xa')](_0xd9a6('0x8'),_0x21dd8e,_0xe6171);_0x2dd38d(_0xe6171);});});} \ No newline at end of file +var _0x574d=['License,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x276fae,_0x1424c1){var _0x132c7e=function(_0x4bf08a){while(--_0x4bf08a){_0x276fae['push'](_0x276fae['shift']());}};_0x132c7e(++_0x1424c1);}(_0x574d,0x15c));var _0xd574=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x574d[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var moment=require('moment');var BPromise=require(_0xd574('0x2'));var rs=require(_0xd574('0x3'));var fs=require('fs');var Redis=require(_0xd574('0x4'));var db=require(_0xd574('0x5'))['db'];var utils=require(_0xd574('0x6'));var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var config=require(_0xd574('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd574('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4571fb,_0x4045f2,_0x1a1976){return new BPromise(function(_0x458f4b,_0x1553a9){return client[_0xd574('0xb')](_0x4571fb,_0x1a1976)['then'](function(_0x2c095c){logger['info'](_0xd574('0xc'),_0x4045f2,_0xd574('0xd'));logger[_0xd574('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x4045f2,'request\x20sent',JSON['stringify'](_0x2c095c));if(_0x2c095c[_0xd574('0xf')]){if(_0x2c095c[_0xd574('0xf')][_0xd574('0x10')]===0x1f4){logger[_0xd574('0xf')](_0xd574('0xc'),_0x4045f2,_0x2c095c[_0xd574('0xf')]['message']);return _0x1553a9(_0x2c095c[_0xd574('0xf')]['message']);}logger[_0xd574('0xf')](_0xd574('0xc'),_0x4045f2,_0x2c095c[_0xd574('0xf')][_0xd574('0x11')]);return _0x458f4b(_0x2c095c[_0xd574('0xf')][_0xd574('0x11')]);}else{logger[_0xd574('0x12')](_0xd574('0xc'),_0x4045f2,_0xd574('0xd'));_0x458f4b(_0x2c095c['result']['message']);}})[_0xd574('0x13')](function(_0x5cd2b4){logger[_0xd574('0xf')]('License,\x20%s,\x20%s',_0x4045f2,_0x5cd2b4);_0x1553a9(_0x5cd2b4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 48b4db5..2568878 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 _0xea67=['isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','addDisposition','post','create','addSmtp','addInteraction','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x5a001d,_0x591f45){var _0x3d0a81=function(_0x13ad2a){while(--_0x13ad2a){_0x5a001d['push'](_0x5a001d['shift']());}};_0x3d0a81(++_0x591f45);}(_0xea67,0x183));var _0x7ea6=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xea67[_0x1e5cc3];return _0x15c596;};'use strict';var multer=require(_0x7ea6('0x0'));var util=require(_0x7ea6('0x1'));var path=require(_0x7ea6('0x2'));var timeout=require(_0x7ea6('0x3'));var express=require(_0x7ea6('0x4'));var router=express[_0x7ea6('0x5')]();var fs_extra=require(_0x7ea6('0x6'));var auth=require(_0x7ea6('0x7'));var interaction=require(_0x7ea6('0x8'));var config=require(_0x7ea6('0x9'));var controller=require('./mailAccount.controller');router[_0x7ea6('0xa')]('/',auth['isAuthenticated'](),controller[_0x7ea6('0xb')]);router['get'](_0x7ea6('0xc'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0xe')]);router['get'](_0x7ea6('0xf'),auth[_0x7ea6('0xd')](),controller['show']);router[_0x7ea6('0xa')](_0x7ea6('0x10'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x11')]);router[_0x7ea6('0xa')](_0x7ea6('0x12'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x13')]);router[_0x7ea6('0xa')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x7ea6('0x14')]);router[_0x7ea6('0xa')](_0x7ea6('0x15'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x16')]);router[_0x7ea6('0xa')](_0x7ea6('0x17'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x18')]);router['get'](_0x7ea6('0x19'),auth['isAuthenticated'](),controller[_0x7ea6('0x1a')]);router[_0x7ea6('0xa')](_0x7ea6('0x1b'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x1c')]);router[_0x7ea6('0xa')](_0x7ea6('0x1d'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x1e')]);router['get'](_0x7ea6('0x1f'),auth[_0x7ea6('0xd')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x20')]);router[_0x7ea6('0x21')](_0x7ea6('0x12'),auth[_0x7ea6('0xd')](),controller['addAnswer']);router['post']('/',auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x22')]);router[_0x7ea6('0x21')]('/:id/in_servers',auth[_0x7ea6('0xd')](),controller['addImap']);router[_0x7ea6('0x21')](_0x7ea6('0x15'),auth['isAuthenticated'](),controller[_0x7ea6('0x23')]);router['post'](_0x7ea6('0x17'),auth['isAuthenticated'](),controller[_0x7ea6('0x24')]);router[_0x7ea6('0x21')](_0x7ea6('0x19'),auth['isAuthenticated'](),controller[_0x7ea6('0x25')]);router['post'](_0x7ea6('0x26'),auth['isAuthenticated'](),controller[_0x7ea6('0x27')]);router[_0x7ea6('0x21')](_0x7ea6('0x1f'),auth[_0x7ea6('0xd')](),controller['addAgents']);router[_0x7ea6('0x28')]('/:id',auth['isAuthenticated'](),controller[_0x7ea6('0x29')]);router[_0x7ea6('0x2a')](_0x7ea6('0x10'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x2b')]);router[_0x7ea6('0x2a')]('/:id/canned_answers',auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x2c')]);router[_0x7ea6('0x2a')](_0x7ea6('0x2d'),auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x2e')]);router['delete'](_0x7ea6('0x15'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x7ea6('0x2a')]('/:id',auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x2f')]);router[_0x7ea6('0x2a')]('/:id/users',auth[_0x7ea6('0xd')](),controller[_0x7ea6('0x30')]);module[_0x7ea6('0x31')]=router; \ No newline at end of file +var _0xf11d=['removeDispositions','removeAnswers','removeSmtp','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/in_servers','addImap','addApplications','send','/:id/users','addAgents','put','update','delete'];(function(_0x14d26e,_0x8da3fb){var _0x4579f0=function(_0x5eba40){while(--_0x5eba40){_0x14d26e['push'](_0x14d26e['shift']());}};_0x4579f0(++_0x8da3fb);}(_0xf11d,0x165));var _0xdf11=function(_0x2bd47b,_0x95cb5b){_0x2bd47b=_0x2bd47b-0x0;var _0x309a6b=_0xf11d[_0x2bd47b];return _0x309a6b;};'use strict';var multer=require(_0xdf11('0x0'));var util=require(_0xdf11('0x1'));var path=require('path');var timeout=require(_0xdf11('0x2'));var express=require(_0xdf11('0x3'));var router=express[_0xdf11('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf11('0x5'));var interaction=require(_0xdf11('0x6'));var config=require('../../config/environment');var controller=require(_0xdf11('0x7'));router[_0xdf11('0x8')]('/',auth[_0xdf11('0x9')](),controller[_0xdf11('0xa')]);router['get'](_0xdf11('0xb'),auth[_0xdf11('0x9')](),controller[_0xdf11('0xc')]);router[_0xdf11('0x8')](_0xdf11('0xd'),auth['isAuthenticated'](),controller[_0xdf11('0xe')]);router[_0xdf11('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xdf11('0xf')]);router[_0xdf11('0x8')]('/:id/in_servers',auth[_0xdf11('0x9')](),controller[_0xdf11('0x10')]);router[_0xdf11('0x8')](_0xdf11('0x11'),auth[_0xdf11('0x9')](),controller['getSmtp']);router[_0xdf11('0x8')](_0xdf11('0x12'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x13')]);router[_0xdf11('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0xdf11('0x14')]);router[_0xdf11('0x8')](_0xdf11('0x15'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x16')]);router[_0xdf11('0x8')](_0xdf11('0x17'),auth['isAuthenticated'](),controller[_0xdf11('0x18')]);router[_0xdf11('0x8')]('/:id/users',auth[_0xdf11('0x9')](),controller['getAgents']);router[_0xdf11('0x19')](_0xdf11('0x1a'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x1b')]);router['post'](_0xdf11('0x1c'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x1d')]);router[_0xdf11('0x19')]('/',auth[_0xdf11('0x9')](),controller['create']);router[_0xdf11('0x19')](_0xdf11('0x1e'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x1f')]);router[_0xdf11('0x19')](_0xdf11('0x11'),auth[_0xdf11('0x9')](),controller['addSmtp']);router['post'](_0xdf11('0x12'),auth[_0xdf11('0x9')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xdf11('0x20')]);router[_0xdf11('0x19')]('/:id/send',auth[_0xdf11('0x9')](),controller[_0xdf11('0x21')]);router[_0xdf11('0x19')](_0xdf11('0x22'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x23')]);router[_0xdf11('0x24')](_0xdf11('0xd'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x25')]);router[_0xdf11('0x26')](_0xdf11('0x1a'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x27')]);router[_0xdf11('0x26')]('/:id/canned_answers',auth[_0xdf11('0x9')](),controller[_0xdf11('0x28')]);router['delete'](_0xdf11('0x1e'),auth[_0xdf11('0x9')](),controller['removeImap']);router[_0xdf11('0x26')](_0xdf11('0x11'),auth[_0xdf11('0x9')](),controller[_0xdf11('0x29')]);router['delete'](_0xdf11('0xd'),auth[_0xdf11('0x9')](),controller['destroy']);router[_0xdf11('0x26')](_0xdf11('0x22'),auth['isAuthenticated'](),controller[_0xdf11('0x2a')]);module[_0xdf11('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 96ec6bd..0537aef 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 _0xcce0=['hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0xcce0,0x1bf));var _0x0cce=function(_0xefcc2e,_0x33020b){_0xefcc2e=_0xefcc2e-0x0;var _0x3cec91=_0xcce0[_0xefcc2e];return _0x3cec91;};'use strict';var Sequelize=require(_0x0cce('0x0'));module[_0x0cce('0x1')]={'description':{'type':Sequelize[_0x0cce('0x2')]},'name':{'type':Sequelize[_0x0cce('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x0cce('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0cce('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0cce('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0cce('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0cce('0x4')]},'markAsUnread':{'type':Sequelize[_0x0cce('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0cce('0x5')},'fontSize':{'type':Sequelize[_0x0cce('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0cce('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0cce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0cce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0cce('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0cce('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x0cce('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0cce('0x9'),'set':function(_0x32388f){if(!_0x32388f)this[_0x0cce('0xa')](_0x0cce('0xb'),null);this['setDataValue'](_0x0cce('0xc'),_0x32388f);}},'provider':{'type':Sequelize[_0x0cce('0xd')](_0x0cce('0xe'),_0x0cce('0xf'),_0x0cce('0x10'),_0x0cce('0x11')),'defaultValue':null,'get':function(){if(!this[_0x0cce('0x12')](_0x0cce('0x13')))return _0x0cce('0x14');return this['getDataValue'](_0x0cce('0x13'));},'set':function(_0x468095){if(_0x468095===_0x0cce('0x14'))_0x468095=null;return this[_0x0cce('0xa')](_0x0cce('0x13'),_0x468095);}}}; \ No newline at end of file +var _0x4ba5=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x4a9538,_0x4c1c2d){var _0x43aa91=function(_0x36e51d){while(--_0x36e51d){_0x4a9538['push'](_0x4a9538['shift']());}};_0x43aa91(++_0x4c1c2d);}(_0x4ba5,0x1eb));var _0x54ba=function(_0x1be611,_0x3d837a){_0x1be611=_0x1be611-0x0;var _0x22a1cb=_0x4ba5[_0x1be611];return _0x22a1cb;};'use strict';var Sequelize=require(_0x54ba('0x0'));module[_0x54ba('0x1')]={'description':{'type':Sequelize[_0x54ba('0x2')]},'name':{'type':Sequelize[_0x54ba('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x54ba('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x54ba('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x54ba('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x54ba('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x54ba('0x4')]},'markAsUnread':{'type':Sequelize[_0x54ba('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54ba('0x5')},'fontSize':{'type':Sequelize[_0x54ba('0x6')](0x2)[_0x54ba('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x54ba('0x4')],'defaultValue':function(){return _0x54ba('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x54ba('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x54ba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x54ba('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x54ba('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x54ba('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d1a39){if(!_0x2d1a39)this[_0x54ba('0x9')](_0x54ba('0xa'),null);this[_0x54ba('0x9')](_0x54ba('0xb'),_0x2d1a39);}},'provider':{'type':Sequelize[_0x54ba('0xc')](_0x54ba('0xd'),_0x54ba('0xe'),_0x54ba('0xf'),_0x54ba('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x54ba('0x11')))return _0x54ba('0x12');return this[_0x54ba('0x13')](_0x54ba('0x11'));},'set':function(_0x5dd4ea){if(_0x5dd4ea==='custom')_0x5dd4ea=null;return this[_0x54ba('0x9')](_0x54ba('0x11'),_0x5dd4ea);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index db847f9..2352685 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 _0x1fc7=['getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','messageId','subject','attach','out','Interaction','verifySmtp','CloudProvider','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','count','offset','limit','set','json','update','destroy','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','ids','CannedAnswer','hasOwnProperty','removeAnswers','email','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications'];(function(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0x1fc7,0x1c0));var _0x71fc=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x1fc7[_0x20a558];return _0x53d3f7;};'use strict';var moment=require(_0x71fc('0x0'));var BPromise=require(_0x71fc('0x1'));var util=require(_0x71fc('0x2'));var path=require(_0x71fc('0x3'));var _=require(_0x71fc('0x4'));var juice=require(_0x71fc('0x5'));var Redis=require(_0x71fc('0x6'));var qs=require(_0x71fc('0x7'));var logger=require(_0x71fc('0x8'))(_0x71fc('0x9'));var config=require(_0x71fc('0xa'));var db=require(_0x71fc('0xb'))['db'];config['redis']=_[_0x71fc('0xc')](config[_0x71fc('0xd')],{'host':_0x71fc('0xe'),'port':0x18eb});var socket=require(_0x71fc('0xf'))(new Redis(config[_0x71fc('0xd')]));require(_0x71fc('0x10'))[_0x71fc('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x71fc('0x12')][_0x71fc('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x29d51b,_0x21b0c1,_0x222946,_0x1b1811){return new BPromise(function(_0x52b7ec,_0x2277bf){var _0x164f47=_0x1b1811||client;return _0x164f47['request'](_0x29d51b,_0x222946)[_0x71fc('0x14')](function(_0x5cf86a){logger[_0x71fc('0x15')](_0x71fc('0x16'),_0x21b0c1,_0x71fc('0x17'));logger[_0x71fc('0x18')](_0x71fc('0x19'),_0x21b0c1,'request\x20sent',JSON[_0x71fc('0x1a')](_0x5cf86a));if(_0x5cf86a[_0x71fc('0x1b')]){if(_0x5cf86a['error'][_0x71fc('0x1c')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x21b0c1,_0x5cf86a['error']['message']);return _0x2277bf(_0x5cf86a[_0x71fc('0x1b')][_0x71fc('0x1d')]);}logger[_0x71fc('0x1b')](_0x71fc('0x16'),_0x21b0c1,_0x5cf86a[_0x71fc('0x1b')][_0x71fc('0x1d')]);return _0x52b7ec(_0x5cf86a[_0x71fc('0x1b')][_0x71fc('0x1d')]);}else{logger[_0x71fc('0x15')](_0x71fc('0x16'),_0x21b0c1,'request\x20sent');_0x52b7ec(_0x5cf86a[_0x71fc('0x1e')][_0x71fc('0x1d')]);}})[_0x71fc('0x1f')](function(_0x9d78ef){logger[_0x71fc('0x1b')]('MailAccount,\x20%s,\x20%s',_0x21b0c1,_0x9d78ef);_0x2277bf(_0x9d78ef);});});}function respondWithStatusCode(_0x15623c,_0x4158f4){_0x4158f4=_0x4158f4||0xcc;return function(_0x4a45be){if(_0x4a45be){return _0x15623c[_0x71fc('0x20')](_0x4158f4);}return _0x15623c['status'](_0x4158f4)[_0x71fc('0x21')]();};}function respondWithResult(_0x12dff2,_0x5b6181){_0x5b6181=_0x5b6181||0xc8;return function(_0x5a5d10){if(_0x5a5d10){return _0x12dff2[_0x71fc('0x22')](_0x5b6181)['json'](_0x5a5d10);}};}function respondWithFilteredResult(_0x357c0d,_0x3eebc6){return function(_0x11c5da){if(_0x11c5da){var _0x177cf4=typeof _0x3eebc6['offset']===_0x71fc('0x23')&&typeof _0x3eebc6['limit']===_0x71fc('0x23');var _0xdef56b=_0x11c5da['count'];var _0x42fa61=_0x177cf4?0x0:_0x3eebc6['offset'];var _0xf94855=_0x177cf4?_0x11c5da[_0x71fc('0x24')]:_0x3eebc6[_0x71fc('0x25')]+_0x3eebc6[_0x71fc('0x26')];var _0x138091;if(_0xf94855>=_0xdef56b){_0xf94855=_0xdef56b;_0x138091=0xc8;}else{_0x138091=0xce;}_0x357c0d[_0x71fc('0x22')](_0x138091);return _0x357c0d[_0x71fc('0x27')]('Content-Range',_0x42fa61+'-'+_0xf94855+'/'+_0xdef56b)[_0x71fc('0x28')](_0x11c5da);}return null;};}function saveUpdates(_0xff0d05){return function(_0x197c9c){if(_0x197c9c){return _0x197c9c[_0x71fc('0x29')](_0xff0d05)[_0x71fc('0x14')](function(_0x1c4576){return _0x1c4576;});}return null;};}function removeEntity(_0x44ad6e){return function(_0x3479ab){if(_0x3479ab){return _0x3479ab[_0x71fc('0x2a')]()[_0x71fc('0x14')](function(){var _0x5139db=_0x3479ab['get']({'plain':!![]});var _0x315326=_0x71fc('0x2b');return db['UserProfileResource'][_0x71fc('0x2a')]({'where':{'type':_0x315326,'resourceId':_0x5139db['id']}})[_0x71fc('0x14')](function(){return _0x3479ab;});})['then'](function(){_0x44ad6e[_0x71fc('0x22')](0xcc)[_0x71fc('0x21')]();});}};}function handleEntityNotFound(_0x373c06){return function(_0x1d3da8){if(!_0x1d3da8){_0x373c06[_0x71fc('0x20')](0x194);}return _0x1d3da8;};}function handleError(_0x2ba65b,_0x382b2c){_0x382b2c=_0x382b2c||0x1f4;return function(_0x148380){logger[_0x71fc('0x1b')](_0x148380[_0x71fc('0x2c')]);if(_0x148380['name']){delete _0x148380[_0x71fc('0x2d')];}_0x2ba65b[_0x71fc('0x22')](_0x382b2c)[_0x71fc('0x2e')](_0x148380);};}function getImapHost(_0x4ee219){switch(_0x4ee219){case _0x71fc('0x2f'):return _0x71fc('0x30');case _0x71fc('0x31'):return _0x71fc('0x32');case'hotmail':return _0x71fc('0x33');case _0x71fc('0x34'):return _0x71fc('0x35');}throw new Error(_0x71fc('0x36'),_0x4ee219);}function getSmtpHost(_0x430829){switch(_0x430829){case _0x71fc('0x2f'):return _0x71fc('0x37');case _0x71fc('0x31'):return'smtp.mail.yahoo.com';case _0x71fc('0x38'):return'smtp-mail.outlook.com';case _0x71fc('0x34'):return _0x71fc('0x39');}throw new Error('Unknown\x20email\x20service\x20provider',_0x430829);}function getAuthenticationOptions(_0x481a55,_0x44bec8){var _0x22645b={};var _0x3a8c30={};if(_0x481a55){_0x22645b[_0x71fc('0x3a')]=_0x3a8c30[_0x71fc('0x3a')]=_0x44bec8['username'];_0x22645b[_0x71fc('0x3b')]=_0x3a8c30[_0x71fc('0x3c')]=_0x44bec8['password'];if(_0x44bec8[_0x71fc('0x3d')]){_0x22645b[_0x71fc('0x3d')]=_0x3a8c30[_0x71fc('0x3d')]=!![];_0x22645b[_0x71fc('0x3e')]=_0x3a8c30['CloudProviderId']=_0x44bec8[_0x71fc('0x3e')];_0x22645b[_0x71fc('0x3b')]=_0x3a8c30['pass']=null;}else{_0x22645b[_0x71fc('0x3e')]=_0x3a8c30[_0x71fc('0x3e')]=null;}_0x22645b[_0x71fc('0x3f')]=getImapHost(_0x481a55);_0x22645b['port']=0x3e1;_0x3a8c30['host']=getSmtpHost(_0x481a55);_0x3a8c30[_0x71fc('0x40')]=0x24b;_0x3a8c30[_0x71fc('0x41')]=![];_0x22645b[_0x71fc('0x42')]=_0x3a8c30[_0x71fc('0x42')]=null;}else{if(_0x44bec8[_0x71fc('0x43')]){_0x22645b[_0x71fc('0x3a')]=_0x3a8c30[_0x71fc('0x3a')]=_0x44bec8[_0x71fc('0x44')];_0x22645b['password']=_0x3a8c30[_0x71fc('0x3c')]=_0x44bec8[_0x71fc('0x3b')];}else{_0x22645b['authentication']=_0x3a8c30[_0x71fc('0x43')]=![];_0x22645b[_0x71fc('0x3a')]=_0x3a8c30[_0x71fc('0x3a')]=null;_0x22645b[_0x71fc('0x3b')]=_0x3a8c30['pass']=null;}_0x22645b[_0x71fc('0x3f')]=_0x44bec8['Imap'][_0x71fc('0x3f')];_0x22645b[_0x71fc('0x40')]=_0x44bec8[_0x71fc('0x45')]['port'];_0x3a8c30['host']=_0x44bec8[_0x71fc('0x46')][_0x71fc('0x3f')];_0x3a8c30[_0x71fc('0x40')]=_0x44bec8[_0x71fc('0x46')][_0x71fc('0x40')];}return{'Imap':_0x22645b,'Smtp':_0x3a8c30};}exports[_0x71fc('0x47')]=function(_0x14981b,_0x3987e2){var _0x1631f5={'include':[{'model':db[_0x71fc('0x48')],'as':_0x71fc('0x45')},{'model':db[_0x71fc('0x49')],'as':_0x71fc('0x46')},{'model':db[_0x71fc('0x4a')],'as':'mandatoryDispositionPause'}]},_0x364ca2={},_0x76f41e={'count':0x0,'rows':[]};var _0x227806=_[_0x71fc('0x4b')](db[_0x71fc('0x4c')]['rawAttributes'],function(_0x88c8ba){return{'name':_0x88c8ba[_0x71fc('0x4d')],'type':_0x88c8ba['type'][_0x71fc('0x4e')]};});_0x364ca2[_0x71fc('0x4f')]=_[_0x71fc('0x4b')](_0x227806,_0x71fc('0x2d'));_0x364ca2[_0x71fc('0x50')]=_[_0x71fc('0x51')](_0x14981b[_0x71fc('0x50')]);_0x364ca2[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0x364ca2[_0x71fc('0x4f')],_0x364ca2[_0x71fc('0x50')]);_0x1631f5[_0x71fc('0x54')]=_['intersection'](_0x364ca2[_0x71fc('0x4f')],qs[_0x71fc('0x55')](_0x14981b[_0x71fc('0x50')][_0x71fc('0x55')]));_0x1631f5[_0x71fc('0x54')]=_0x1631f5['attributes'][_0x71fc('0x56')]?_0x1631f5['attributes']:_0x364ca2[_0x71fc('0x4f')];if(!_0x14981b['query']['hasOwnProperty']('nolimit')){_0x1631f5['limit']=qs[_0x71fc('0x26')](_0x14981b[_0x71fc('0x50')]['limit']);_0x1631f5['offset']=qs[_0x71fc('0x25')](_0x14981b[_0x71fc('0x50')][_0x71fc('0x25')]);}_0x1631f5[_0x71fc('0x57')]=qs['sort'](_0x14981b[_0x71fc('0x50')][_0x71fc('0x58')]);_0x1631f5[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_['pick'](_0x14981b[_0x71fc('0x50')],_0x364ca2['filters']),_0x227806);if(_0x14981b[_0x71fc('0x50')]['filter']){_0x1631f5[_0x71fc('0x59')]=_[_0x71fc('0x5a')](_0x1631f5[_0x71fc('0x59')],{'$or':_[_0x71fc('0x4b')](_0x227806,function(_0x1e0ffd){if(_0x1e0ffd[_0x71fc('0x5b')]!==_0x71fc('0x5c')){var _0x2e0f36={};_0x2e0f36[_0x1e0ffd[_0x71fc('0x2d')]]={'$like':'%'+_0x14981b['query'][_0x71fc('0x5d')]+'%'};return _0x2e0f36;}})});}_0x1631f5=_['merge']({},_0x1631f5,_0x14981b['options']);var _0xd72ebc={'where':_0x1631f5[_0x71fc('0x59')]};return db[_0x71fc('0x4c')]['count'](_0xd72ebc)['then'](function(_0x5d29aa){_0x76f41e[_0x71fc('0x24')]=_0x5d29aa;if(_0x14981b[_0x71fc('0x50')][_0x71fc('0x5e')]){_0x1631f5[_0x71fc('0x5f')]=[{'all':!![]}];}return db['MailAccount'][_0x71fc('0x60')](_0x1631f5);})[_0x71fc('0x14')](function(_0x46e32f){_0x76f41e[_0x71fc('0x61')]=_0x46e32f;return _0x76f41e;})[_0x71fc('0x14')](respondWithFilteredResult(_0x3987e2,_0x1631f5))[_0x71fc('0x1f')](handleError(_0x3987e2,null));};exports[_0x71fc('0x62')]=function(_0x58f202,_0x1bc0d6){var _0x52eea8={'raw':![],'where':{'id':_0x58f202[_0x71fc('0x63')]['id']},'include':[{'model':db[_0x71fc('0x48')],'as':_0x71fc('0x45')},{'model':db['MailServerOut'],'as':_0x71fc('0x46')},{'model':db['Pause'],'as':_0x71fc('0x64')}]},_0x49fb86={};_0x49fb86[_0x71fc('0x4f')]=_[_0x71fc('0x51')](db[_0x71fc('0x4c')][_0x71fc('0x65')]);_0x49fb86[_0x71fc('0x50')]=_[_0x71fc('0x51')](_0x58f202[_0x71fc('0x50')]);_0x49fb86[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0x49fb86[_0x71fc('0x4f')],_0x49fb86[_0x71fc('0x50')]);_0x52eea8['attributes']=_[_0x71fc('0x53')](_0x49fb86[_0x71fc('0x4f')],qs['fields'](_0x58f202[_0x71fc('0x50')]['fields']));_0x52eea8[_0x71fc('0x54')]=_0x52eea8[_0x71fc('0x54')][_0x71fc('0x56')]?_0x52eea8[_0x71fc('0x54')]:_0x49fb86[_0x71fc('0x4f')];if(_0x58f202[_0x71fc('0x50')][_0x71fc('0x5e')]){_0x52eea8[_0x71fc('0x5f')]=[{'all':!![]}];}_0x52eea8=_[_0x71fc('0x5a')]({},_0x52eea8,_0x58f202[_0x71fc('0x66')]);return db[_0x71fc('0x4c')][_0x71fc('0x67')](_0x52eea8)['then'](handleEntityNotFound(_0x1bc0d6,null))[_0x71fc('0x14')](respondWithResult(_0x1bc0d6,null))[_0x71fc('0x1f')](handleError(_0x1bc0d6,null));};exports[_0x71fc('0x29')]=function(_0x37d9b9,_0x5ab8dc){if(_0x37d9b9['body']['id']){delete _0x37d9b9[_0x71fc('0x68')]['id'];}var _0x1c3f58=_0x37d9b9[_0x71fc('0x68')][_0x71fc('0x69')]===_0x71fc('0x6a')?null:_0x37d9b9['body'][_0x71fc('0x69')];var _0x1f750e=_0x37d9b9[_0x71fc('0x68')]['Imap']||{};var _0x5236ef=_0x37d9b9[_0x71fc('0x68')][_0x71fc('0x46')]||{};if(_0x1c3f58){_0x1f750e['host']=getImapHost(_0x1c3f58);_0x1f750e[_0x71fc('0x40')]=0x3e1;_0x5236ef[_0x71fc('0x3f')]=getSmtpHost(_0x1c3f58);_0x5236ef[_0x71fc('0x40')]=0x24b;_0x5236ef[_0x71fc('0x41')]=![];}if(_0x5236ef[_0x71fc('0x3d')]){_0x5236ef[_0x71fc('0x41')]=![];}else{_0x5236ef[_0x71fc('0x3e')]=null;}if(!_0x1f750e[_0x71fc('0x3d')])_0x1f750e[_0x71fc('0x3e')]=null;_0x37d9b9[_0x71fc('0x68')]['Imap']=_0x1f750e;_0x37d9b9[_0x71fc('0x68')][_0x71fc('0x46')]=_0x5236ef;return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x37d9b9[_0x71fc('0x63')]['id']},'include':[{'model':db[_0x71fc('0x48')],'as':'Imap'},{'model':db[_0x71fc('0x49')],'as':_0x71fc('0x46')},{'model':db[_0x71fc('0x4a')],'as':_0x71fc('0x64')}]})['then'](handleEntityNotFound(_0x5ab8dc,null))[_0x71fc('0x14')](function(_0x65318a){if(!_0x65318a)throw new Error(_0x71fc('0x6b'));if(_0x65318a[_0x71fc('0x42')])delete _0x37d9b9[_0x71fc('0x68')][_0x71fc('0x45')];return _0x65318a;})[_0x71fc('0x14')](saveUpdates(_0x37d9b9[_0x71fc('0x68')],null))['then'](function(_0x432ddc){if(!_0x37d9b9[_0x71fc('0x68')][_0x71fc('0x45')])return _0x432ddc;return db[_0x71fc('0x48')][_0x71fc('0x29')](_0x37d9b9['body']['Imap'],{'where':{'MailAccountId':_0x432ddc['id']}})[_0x71fc('0x14')](function(){return _0x432ddc;});})[_0x71fc('0x14')](function(_0x424803){if(!_0x37d9b9['body'][_0x71fc('0x46')])return _0x424803;return db[_0x71fc('0x49')][_0x71fc('0x29')](_0x37d9b9[_0x71fc('0x68')][_0x71fc('0x46')],{'where':{'MailAccountId':_0x424803['id']}})[_0x71fc('0x14')](function(){return _0x424803;});})[_0x71fc('0x14')](respondWithResult(_0x5ab8dc,null))[_0x71fc('0x1f')](handleError(_0x5ab8dc,null));};exports[_0x71fc('0x6c')]=function(_0x336684,_0x4daabb){return db[_0x71fc('0x4c')][_0x71fc('0x6c')]()[_0x71fc('0x14')](respondWithResult(_0x4daabb,null))[_0x71fc('0x1f')](handleError(_0x4daabb,null));};exports[_0x71fc('0x6d')]=function(_0x5a7b70,_0x5424ba){if(_0x5a7b70[_0x71fc('0x68')]['id']){delete _0x5a7b70['body']['id'];}return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x5a7b70['params']['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x5424ba,null))[_0x71fc('0x14')](function(_0xb43483){if(_0xb43483){_0x5a7b70['body'][_0x71fc('0x6e')]=_0xb43483['id'];return db[_0x71fc('0x6f')][_0x71fc('0x70')](_0x5a7b70[_0x71fc('0x68')]);}})[_0x71fc('0x14')](respondWithResult(_0x5424ba,null))[_0x71fc('0x1f')](handleError(_0x5424ba,null));};exports[_0x71fc('0x71')]=function(_0x592b2b,_0x1c5d8c){var _0x599d07={'raw':![],'where':{}};var _0xf0b0c7={};var _0x54f3f6={'count':0x0,'rows':[]};return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x592b2b[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x1c5d8c,null))[_0x71fc('0x14')](function(_0x45f442){if(_0x45f442){_0xf0b0c7[_0x71fc('0x4f')]=_[_0x71fc('0x51')](db[_0x71fc('0x6f')][_0x71fc('0x65')]);_0xf0b0c7['query']=_[_0x71fc('0x51')](_0x592b2b[_0x71fc('0x50')]);_0xf0b0c7[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0xf0b0c7[_0x71fc('0x4f')],_0xf0b0c7['query']);_0x599d07['attributes']=_[_0x71fc('0x53')](_0xf0b0c7['model'],qs[_0x71fc('0x55')](_0x592b2b['query'][_0x71fc('0x55')]));_0x599d07['attributes']=_0x599d07['attributes']['length']?_0x599d07['attributes']:_0xf0b0c7[_0x71fc('0x4f')];if(!_0x592b2b[_0x71fc('0x50')]['hasOwnProperty'](_0x71fc('0x73'))){_0x599d07[_0x71fc('0x26')]=qs[_0x71fc('0x26')](_0x592b2b[_0x71fc('0x50')]['limit']);_0x599d07[_0x71fc('0x25')]=qs['offset'](_0x592b2b['query']['offset']);}_0x599d07[_0x71fc('0x57')]=qs['sort'](_0x592b2b[_0x71fc('0x50')]['sort']);_0x599d07[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_[_0x71fc('0x74')](_0x592b2b[_0x71fc('0x50')],_0xf0b0c7[_0x71fc('0x52')]));_0x599d07[_0x71fc('0x59')][_0x71fc('0x6e')]=_0x45f442['id'];if(_0x592b2b[_0x71fc('0x50')][_0x71fc('0x5d')]){_0x599d07['where']=_['merge'](_0x599d07['where'],{'$or':_[_0x71fc('0x4b')](_0x599d07[_0x71fc('0x54')],function(_0x2c144b){var _0x5734c1={};_0x5734c1[_0x2c144b]={'$like':'%'+_0x592b2b[_0x71fc('0x50')]['filter']+'%'};return _0x5734c1;})});}_0x599d07=_[_0x71fc('0x5a')]({},_0x599d07,_0x592b2b[_0x71fc('0x66')]);return db[_0x71fc('0x6f')][_0x71fc('0x24')]({'where':_0x599d07['where']})[_0x71fc('0x14')](function(_0x5ec9d4){_0x54f3f6[_0x71fc('0x24')]=_0x5ec9d4;if(_0x592b2b['query'][_0x71fc('0x5e')]){_0x599d07[_0x71fc('0x5f')]=[{'all':!![]}];}return db[_0x71fc('0x6f')][_0x71fc('0x60')](_0x599d07);})[_0x71fc('0x14')](function(_0x4b89bb){_0x54f3f6[_0x71fc('0x61')]=_0x4b89bb;return _0x54f3f6;});}})[_0x71fc('0x14')](respondWithFilteredResult(_0x1c5d8c,_0x599d07))[_0x71fc('0x1f')](handleError(_0x1c5d8c,null));};exports[_0x71fc('0x75')]=function(_0x50891d,_0x1c9068){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x50891d[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x1c9068,null))[_0x71fc('0x14')](function(_0x63d205){if(_0x63d205){return _0x63d205[_0x71fc('0x75')](_0x50891d[_0x71fc('0x50')][_0x71fc('0x76')]);}})[_0x71fc('0x14')](respondWithStatusCode(_0x1c9068,null))[_0x71fc('0x1f')](handleError(_0x1c9068,null));};exports['addAnswer']=function(_0x385fc1,_0xc2e79e){if(_0x385fc1[_0x71fc('0x68')]['id']){delete _0x385fc1['body']['id'];}return db['MailAccount'][_0x71fc('0x67')]({'where':{'id':_0x385fc1[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0xc2e79e,null))['then'](function(_0x3c2317){if(_0x3c2317){_0x385fc1[_0x71fc('0x68')][_0x71fc('0x6e')]=_0x3c2317['id'];return db['CannedAnswer']['create'](_0x385fc1[_0x71fc('0x68')]);}})[_0x71fc('0x14')](respondWithResult(_0xc2e79e,null))[_0x71fc('0x1f')](handleError(_0xc2e79e,null));};exports['getAnswers']=function(_0x5ba3da,_0x50e97b){var _0x4812a6={'raw':![],'where':{}};var _0x2948c5={};var _0x39849b={'count':0x0,'rows':[]};return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x5ba3da['params']['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x50e97b,null))[_0x71fc('0x14')](function(_0x33f00c){if(_0x33f00c){_0x2948c5['model']=_[_0x71fc('0x51')](db[_0x71fc('0x77')][_0x71fc('0x65')]);_0x2948c5[_0x71fc('0x50')]=_[_0x71fc('0x51')](_0x5ba3da[_0x71fc('0x50')]);_0x2948c5[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0x2948c5[_0x71fc('0x4f')],_0x2948c5[_0x71fc('0x50')]);_0x4812a6[_0x71fc('0x54')]=_[_0x71fc('0x53')](_0x2948c5[_0x71fc('0x4f')],qs[_0x71fc('0x55')](_0x5ba3da[_0x71fc('0x50')][_0x71fc('0x55')]));_0x4812a6[_0x71fc('0x54')]=_0x4812a6['attributes'][_0x71fc('0x56')]?_0x4812a6['attributes']:_0x2948c5[_0x71fc('0x4f')];if(!_0x5ba3da['query'][_0x71fc('0x78')](_0x71fc('0x73'))){_0x4812a6[_0x71fc('0x26')]=qs[_0x71fc('0x26')](_0x5ba3da[_0x71fc('0x50')][_0x71fc('0x26')]);_0x4812a6[_0x71fc('0x25')]=qs[_0x71fc('0x25')](_0x5ba3da['query'][_0x71fc('0x25')]);}_0x4812a6['order']=qs[_0x71fc('0x58')](_0x5ba3da['query']['sort']);_0x4812a6[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_[_0x71fc('0x74')](_0x5ba3da[_0x71fc('0x50')],_0x2948c5[_0x71fc('0x52')]));_0x4812a6['where'][_0x71fc('0x6e')]=_0x33f00c['id'];if(_0x5ba3da[_0x71fc('0x50')][_0x71fc('0x5d')]){_0x4812a6[_0x71fc('0x59')]=_[_0x71fc('0x5a')](_0x4812a6[_0x71fc('0x59')],{'$or':_['map'](_0x4812a6['attributes'],function(_0x354343){var _0x416a8f={};_0x416a8f[_0x354343]={'$like':'%'+_0x5ba3da[_0x71fc('0x50')][_0x71fc('0x5d')]+'%'};return _0x416a8f;})});}_0x4812a6=_[_0x71fc('0x5a')]({},_0x4812a6,_0x5ba3da[_0x71fc('0x66')]);return db[_0x71fc('0x77')]['count']({'where':_0x4812a6[_0x71fc('0x59')]})[_0x71fc('0x14')](function(_0xa4ff63){_0x39849b['count']=_0xa4ff63;if(_0x5ba3da[_0x71fc('0x50')]['includeAll']){_0x4812a6[_0x71fc('0x5f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4812a6);})['then'](function(_0x50dd71){_0x39849b[_0x71fc('0x61')]=_0x50dd71;return _0x39849b;});}})[_0x71fc('0x14')](respondWithFilteredResult(_0x50e97b,_0x4812a6))[_0x71fc('0x1f')](handleError(_0x50e97b,null));};exports[_0x71fc('0x79')]=function(_0x2eb000,_0x2861b6){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x2eb000[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x2861b6,null))['then'](function(_0x7f94b6){if(_0x7f94b6){return _0x7f94b6['removeAnswers'](_0x2eb000[_0x71fc('0x50')][_0x71fc('0x76')]);}})['then'](respondWithStatusCode(_0x2861b6,null))[_0x71fc('0x1f')](handleError(_0x2861b6,null));};exports[_0x71fc('0x70')]=function(_0x17db09,_0x53e103){var _0x3cad11={'name':_0x17db09[_0x71fc('0x68')][_0x71fc('0x2d')],'key':_0x17db09[_0x71fc('0x68')][_0x71fc('0x4e')],'provider':_0x17db09[_0x71fc('0x68')][_0x71fc('0x69')]===_0x71fc('0x6a')?null:_0x17db09[_0x71fc('0x68')]['provider'],'email':_0x17db09[_0x71fc('0x68')][_0x71fc('0x7a')],'ListId':_0x17db09[_0x71fc('0x68')][_0x71fc('0x7b')],'active':!_['isNil'](_0x17db09['body'][_0x71fc('0x7c')])?_0x17db09[_0x71fc('0x68')][_0x71fc('0x7c')]:!![],'description':_0x17db09['body'][_0x71fc('0x7d')]||null};var _0x28d856=getAuthenticationOptions(_0x3cad11['provider'],_0x17db09[_0x71fc('0x68')]);_0x3cad11[_0x71fc('0x45')]=_0x28d856['Imap'];_0x3cad11[_0x71fc('0x46')]=_0x28d856['Smtp'];return db[_0x71fc('0x4c')][_0x71fc('0x70')](_0x3cad11,{'include':[{'model':db[_0x71fc('0x49')],'as':'Smtp'},{'model':db[_0x71fc('0x48')],'as':_0x71fc('0x45')}]})[_0x71fc('0x14')](function(_0x75f68){var _0x4df2c7=_0x17db09[_0x71fc('0x3a')][_0x71fc('0x7e')]({'plain':!![]});if(!_0x4df2c7)throw new Error(_0x71fc('0x7f'));if(_0x4df2c7[_0x71fc('0x80')]===_0x71fc('0x3a')){var _0x5a24ed=_0x75f68[_0x71fc('0x7e')]({'plain':!![]});return db[_0x71fc('0x81')][_0x71fc('0x67')]({'where':{'name':_0x71fc('0x2b'),'userProfileId':_0x4df2c7[_0x71fc('0x82')]},'raw':!![]})[_0x71fc('0x14')](function(_0x3e2c5b){if(_0x3e2c5b&&_0x3e2c5b[_0x71fc('0x83')]===0x0){return db['UserProfileResource'][_0x71fc('0x70')]({'name':_0x5a24ed['name'],'resourceId':_0x5a24ed['id'],'type':_0x3e2c5b['name'],'sectionId':_0x3e2c5b['id']},{})[_0x71fc('0x14')](function(){return _0x75f68;});}else{return _0x75f68;}})[_0x71fc('0x1f')](function(_0x29e30b){logger['error'](_0x71fc('0x84'),_0x29e30b);throw _0x29e30b;});}return _0x75f68;})[_0x71fc('0x14')](respondWithResult(_0x53e103,0xc9))[_0x71fc('0x1f')](handleError(_0x53e103,null));};exports[_0x71fc('0x85')]=function(_0x4dec4c,_0x2a8d6d){return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x4dec4c[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x2a8d6d,null))['then'](function(_0x51f4d1){if(_0x51f4d1){return _0x51f4d1[_0x71fc('0x85')]();}return null;})[_0x71fc('0x14')](respondWithResult(_0x2a8d6d,null))['catch'](handleError(_0x2a8d6d,null));};exports[_0x71fc('0x86')]=function(_0x19e59e,_0x3dc2a4){if(_0x19e59e[_0x71fc('0x68')]['id']){delete _0x19e59e['body']['id'];}return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x19e59e['params']['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x3dc2a4,null))[_0x71fc('0x14')](function(_0x325d8e){if(_0x325d8e){_0x19e59e[_0x71fc('0x68')][_0x71fc('0x6e')]=_0x325d8e['id'];return db[_0x71fc('0x48')][_0x71fc('0x70')](_0x19e59e[_0x71fc('0x68')]);}})[_0x71fc('0x14')](respondWithResult(_0x3dc2a4,null))[_0x71fc('0x1f')](handleError(_0x3dc2a4,null));};exports[_0x71fc('0x87')]=function(_0x4f89a0,_0x4f3882){return db['MailAccount'][_0x71fc('0x72')]({'where':{'id':_0x4f89a0[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x4f3882,null))[_0x71fc('0x14')](function(_0x2c144c){if(_0x2c144c){return _0x2c144c[_0x71fc('0x88')](null);}return null;})[_0x71fc('0x14')](respondWithStatusCode(_0x4f3882,null))[_0x71fc('0x1f')](handleError(_0x4f3882,null));};exports[_0x71fc('0x89')]=function(_0x47899e,_0x1e337a){return db['MailAccount'][_0x71fc('0x72')]({'where':{'id':_0x47899e[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x1e337a,null))[_0x71fc('0x14')](function(_0x17b822){if(_0x17b822){return _0x17b822[_0x71fc('0x89')]();}return null;})[_0x71fc('0x14')](respondWithResult(_0x1e337a,null))[_0x71fc('0x1f')](handleError(_0x1e337a,null));};exports[_0x71fc('0x8a')]=function(_0x42eb8e,_0x5c225c){if(_0x42eb8e['body']['id']){delete _0x42eb8e[_0x71fc('0x68')]['id'];}return db['MailAccount'][_0x71fc('0x67')]({'where':{'id':_0x42eb8e['params']['id']}})['then'](handleEntityNotFound(_0x5c225c,null))[_0x71fc('0x14')](function(_0x3ea25c){if(_0x3ea25c){_0x42eb8e[_0x71fc('0x68')][_0x71fc('0x6e')]=_0x3ea25c['id'];return db[_0x71fc('0x49')][_0x71fc('0x70')](_0x42eb8e['body']);}})[_0x71fc('0x14')](respondWithResult(_0x5c225c,null))[_0x71fc('0x1f')](handleError(_0x5c225c,null));};exports[_0x71fc('0x8b')]=function(_0x50cc9c,_0x444c66){return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x50cc9c['params']['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x444c66,null))[_0x71fc('0x14')](function(_0x507982){if(_0x507982){return _0x507982[_0x71fc('0x8c')](null);}return null;})['then'](respondWithStatusCode(_0x444c66,null))[_0x71fc('0x1f')](handleError(_0x444c66,null));};exports[_0x71fc('0x8d')]=function(_0x4146cf,_0x4da983){return db[_0x71fc('0x8e')]['find']({'where':{'id':_0x4146cf['params']['id']}})['then'](handleEntityNotFound(_0x4da983,null))[_0x71fc('0x14')](function(_0x4ec1f6){if(_0x4ec1f6){return _0x4ec1f6['addInteraction'](_0x4146cf[_0x71fc('0x68')]['ids'],_['omit'](_0x4146cf['body'],[_0x71fc('0x76'),'id'])||{});}})[_0x71fc('0x14')](respondWithResult(_0x4da983,null))['catch'](handleError(_0x4da983,null));};exports[_0x71fc('0x8f')]=function(_0x1c1ee3,_0x4aae54){var _0x2ca267={'raw':![],'where':{}};var _0x42de5c={};var _0x15d5bb={'count':0x0,'rows':[]};return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x1c1ee3[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x4aae54,null))[_0x71fc('0x14')](function(_0x288b04){if(_0x288b04){_0x42de5c[_0x71fc('0x4f')]=_[_0x71fc('0x51')](db[_0x71fc('0x8e')][_0x71fc('0x65')]);_0x42de5c[_0x71fc('0x50')]=_[_0x71fc('0x51')](_0x1c1ee3[_0x71fc('0x50')]);_0x42de5c[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0x42de5c['model'],_0x42de5c[_0x71fc('0x50')]);_0x2ca267['attributes']=_['intersection'](_0x42de5c['model'],qs['fields'](_0x1c1ee3['query'][_0x71fc('0x55')]));_0x2ca267[_0x71fc('0x54')]=_0x2ca267[_0x71fc('0x54')][_0x71fc('0x56')]?_0x2ca267[_0x71fc('0x54')]:_0x42de5c[_0x71fc('0x4f')];if(!_0x1c1ee3['query'][_0x71fc('0x78')](_0x71fc('0x73'))){_0x2ca267[_0x71fc('0x26')]=qs[_0x71fc('0x26')](_0x1c1ee3[_0x71fc('0x50')][_0x71fc('0x26')]);_0x2ca267['offset']=qs[_0x71fc('0x25')](_0x1c1ee3[_0x71fc('0x50')]['offset']);}_0x2ca267[_0x71fc('0x57')]=qs['sort'](_0x1c1ee3['query'][_0x71fc('0x58')]);_0x2ca267[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_['pick'](_0x1c1ee3[_0x71fc('0x50')],_0x42de5c[_0x71fc('0x52')]));_0x2ca267['where'][_0x71fc('0x6e')]=_0x288b04['id'];if(_0x1c1ee3[_0x71fc('0x50')][_0x71fc('0x5d')]){_0x2ca267[_0x71fc('0x59')]=_[_0x71fc('0x5a')](_0x2ca267[_0x71fc('0x59')],{'$or':_['map'](_0x2ca267[_0x71fc('0x54')],function(_0x1ca5df){var _0x12ed7e={};_0x12ed7e[_0x1ca5df]={'$like':'%'+_0x1c1ee3[_0x71fc('0x50')][_0x71fc('0x5d')]+'%'};return _0x12ed7e;})});}_0x2ca267=_[_0x71fc('0x5a')]({},_0x2ca267,_0x1c1ee3[_0x71fc('0x66')]);return db[_0x71fc('0x8e')][_0x71fc('0x24')]({'where':_0x2ca267[_0x71fc('0x59')]})['then'](function(_0xc55ed6){_0x15d5bb[_0x71fc('0x24')]=_0xc55ed6;if(_0x1c1ee3[_0x71fc('0x50')][_0x71fc('0x5e')]){_0x2ca267['include']=[{'model':db[_0x71fc('0x90')],'as':_0x71fc('0x91'),'required':![]},{'model':db[_0x71fc('0x92')],'as':_0x71fc('0x93'),'attributes':[_0x71fc('0x2d'),_0x71fc('0x94'),_0x71fc('0x95')],'required':![]},{'model':db[_0x71fc('0x96')],'as':'Tags','attributes':['id','name',_0x71fc('0x97')],'where':_0x1c1ee3['query'][_0x71fc('0x98')]?{'id':_0x1c1ee3[_0x71fc('0x50')]['tag']}:undefined,'required':_0x1c1ee3['query']['tag']?!![]:![]}];}return db[_0x71fc('0x8e')][_0x71fc('0x60')](_0x2ca267);})['then'](function(_0x38b6e8){_0x15d5bb[_0x71fc('0x61')]=_0x38b6e8;return _0x15d5bb;});}})['then'](respondWithFilteredResult(_0x4aae54,_0x2ca267))['catch'](handleError(_0x4aae54,null));};exports[_0x71fc('0x99')]=function addApplications(_0x2a239b,_0x5571d9){var _0x1b4b62=_0x2a239b[_0x71fc('0x63')]['id'];var _0x52a054=_0x2a239b[_0x71fc('0x68')];var _0x2dfbb5=0xc8;var _0x36df19=null;return db[_0x71fc('0x9a')][_0x71fc('0x9b')]({'isolationLevel':db[_0x71fc('0x9a')]['Transaction'][_0x71fc('0x9c')][_0x71fc('0x9d')]},function(_0x45e8ec){return db['MailAccount'][_0x71fc('0x72')]({'where':{'id':_0x1b4b62},'transaction':_0x45e8ec})[_0x71fc('0x14')](function(_0x343092){if(_0x343092){return db[_0x71fc('0x9e')][_0x71fc('0x2a')]({'where':{'MailAccountId':_0x1b4b62},'transaction':_0x45e8ec})[_0x71fc('0x14')](function(){var _0x6b3c56=_[_0x71fc('0x4b')](_0x52a054,function(_0x468854){_0x468854[_0x71fc('0x6e')]=_0x1b4b62;return _0x468854;});return db[_0x71fc('0x9e')][_0x71fc('0x9f')](_0x6b3c56,{'transaction':_0x45e8ec});});}else{_0x2dfbb5=0x194;_0x36df19=[];}});})[_0x71fc('0x14')](function(){if(_0x2dfbb5!==0x194){return db[_0x71fc('0x9e')][_0x71fc('0xa0')]({'where':{'MailAccountId':_0x1b4b62},'order':_0x71fc('0xa1')})[_0x71fc('0x14')](function(_0x464a68){_0x36df19=_0x464a68;});}})['catch'](function(_0x455855){_0x2dfbb5=0x1f4;logger[_0x71fc('0x1b')](_0x455855[_0x71fc('0x2c')]);if(_0x455855[_0x71fc('0x2d')]){delete _0x455855[_0x71fc('0x2d')];}_0x36df19=_0x455855;})[_0x71fc('0xa2')](function(){if(_0x36df19===null){_0x5571d9[_0x71fc('0x20')](_0x2dfbb5);}else{if(_0x2dfbb5===0x1f4){_0x5571d9['status'](_0x2dfbb5)[_0x71fc('0x2e')](_0x36df19);}else{_0x5571d9[_0x71fc('0x22')](_0x2dfbb5)['json'](_0x36df19);}}});};exports[_0x71fc('0xa3')]=function(_0x577f2a,_0x5c0ccf){var _0x28f73d={};var _0x3b5628={};var _0x4fe4c9;var _0x3914a2;return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x577f2a[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x5c0ccf,null))['then'](function(_0xa8573e){if(_0xa8573e){_0x4fe4c9=_0xa8573e;_0x3b5628['model']=_[_0x71fc('0x51')](db[_0x71fc('0x9e')]['rawAttributes']);_0x3b5628[_0x71fc('0x50')]=_['keys'](_0x577f2a[_0x71fc('0x50')]);_0x3b5628[_0x71fc('0x52')]=_['intersection'](_0x3b5628[_0x71fc('0x4f')],_0x3b5628[_0x71fc('0x50')]);_0x28f73d[_0x71fc('0x54')]=_[_0x71fc('0x53')](_0x3b5628[_0x71fc('0x4f')],qs[_0x71fc('0x55')](_0x577f2a[_0x71fc('0x50')]['fields']));_0x28f73d[_0x71fc('0x54')]=_0x28f73d[_0x71fc('0x54')][_0x71fc('0x56')]?_0x28f73d[_0x71fc('0x54')]:_0x3b5628[_0x71fc('0x4f')];_0x28f73d['order']=qs[_0x71fc('0x58')](_0x577f2a[_0x71fc('0x50')][_0x71fc('0x58')]);_0x28f73d['where']=qs['filters'](_['pick'](_0x577f2a[_0x71fc('0x50')],_0x3b5628[_0x71fc('0x52')]));if(_0x577f2a[_0x71fc('0x50')][_0x71fc('0x5d')]){_0x28f73d[_0x71fc('0x59')]=_[_0x71fc('0x5a')](_0x28f73d[_0x71fc('0x59')],{'$or':_['map'](_0x28f73d[_0x71fc('0x54')],function(_0x2d9e19){var _0x15882e={};_0x15882e[_0x2d9e19]={'$like':'%'+_0x577f2a[_0x71fc('0x50')][_0x71fc('0x5d')]+'%'};return _0x15882e;})});}_0x28f73d=_['merge']({},_0x28f73d,_0x577f2a['options']);return _0x4fe4c9[_0x71fc('0xa3')](_0x28f73d);}})[_0x71fc('0x14')](function(_0x1ace56){if(_0x1ace56){_0x3914a2=_0x1ace56[_0x71fc('0x56')];if(!_0x577f2a['query'][_0x71fc('0x78')](_0x71fc('0x73'))){_0x28f73d['limit']=qs[_0x71fc('0x26')](_0x577f2a[_0x71fc('0x50')][_0x71fc('0x26')]);_0x28f73d['offset']=qs['offset'](_0x577f2a[_0x71fc('0x50')][_0x71fc('0x25')]);}return _0x4fe4c9[_0x71fc('0xa3')](_0x28f73d);}})[_0x71fc('0x14')](function(_0x2a4e5b){if(_0x2a4e5b){return _0x2a4e5b?{'count':_0x3914a2,'rows':_0x2a4e5b}:null;}})['then'](respondWithResult(_0x5c0ccf,null))[_0x71fc('0x1f')](handleError(_0x5c0ccf,null));};exports[_0x71fc('0xa4')]=function(_0x19ac6a,_0x2ac460){var _0x58895f={'raw':!![],'where':{}};var _0x5d1edd={};var _0x4c2f85={'count':0x0,'rows':[]};return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x19ac6a['params']['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x2ac460,null))[_0x71fc('0x14')](function(_0xd54add){if(_0xd54add){_0x5d1edd[_0x71fc('0x4f')]=_['keys'](db['MailMessage'][_0x71fc('0x65')]);_0x5d1edd[_0x71fc('0x50')]=_['keys'](_0x19ac6a[_0x71fc('0x50')]);_0x5d1edd[_0x71fc('0x52')]=_[_0x71fc('0x53')](_0x5d1edd[_0x71fc('0x4f')],_0x5d1edd['query']);_0x58895f[_0x71fc('0x54')]=_[_0x71fc('0x53')](_0x5d1edd['model'],qs[_0x71fc('0x55')](_0x19ac6a[_0x71fc('0x50')]['fields']));_0x58895f[_0x71fc('0x54')]=_0x58895f[_0x71fc('0x54')][_0x71fc('0x56')]?_0x58895f[_0x71fc('0x54')]:_0x5d1edd['model'];if(!_0x19ac6a[_0x71fc('0x50')]['hasOwnProperty'](_0x71fc('0x73'))){_0x58895f[_0x71fc('0x26')]=qs[_0x71fc('0x26')](_0x19ac6a[_0x71fc('0x50')][_0x71fc('0x26')]);_0x58895f['offset']=qs[_0x71fc('0x25')](_0x19ac6a[_0x71fc('0x50')][_0x71fc('0x25')]);}_0x58895f['order']=qs['sort'](_0x19ac6a[_0x71fc('0x50')][_0x71fc('0x58')]);_0x58895f[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_[_0x71fc('0x74')](_0x19ac6a[_0x71fc('0x50')],_0x5d1edd['filters']));_0x58895f[_0x71fc('0x59')][_0x71fc('0x6e')]=_0xd54add['id'];if(_0x19ac6a[_0x71fc('0x50')][_0x71fc('0x5d')]){_0x58895f[_0x71fc('0x59')]=_[_0x71fc('0x5a')](_0x58895f[_0x71fc('0x59')],{'$or':_[_0x71fc('0x4b')](_0x58895f[_0x71fc('0x54')],function(_0x83bbd1){var _0x46312d={};_0x46312d[_0x83bbd1]={'$like':'%'+_0x19ac6a['query'][_0x71fc('0x5d')]+'%'};return _0x46312d;})});}if(_0x19ac6a[_0x71fc('0x50')][_0x71fc('0xa5')]){var _0x2cf16f=_0x19ac6a['query'][_0x71fc('0xa5')][_0x71fc('0xa6')](',');var _0x581e8c={};_0x581e8c[_0x2cf16f[0x0]]={'$gte':moment(_0x2cf16f[0x1])['format'](_0x71fc('0xa7'))};_0x58895f[_0x71fc('0x59')]=_['merge'](_0x58895f[_0x71fc('0x59')],_0x581e8c);}_0x58895f=_[_0x71fc('0x5a')]({},_0x58895f,_0x19ac6a['options']);return db[_0x71fc('0xa8')][_0x71fc('0x24')]({'where':_0x58895f[_0x71fc('0x59')]})[_0x71fc('0x14')](function(_0x4aa9d4){_0x4c2f85[_0x71fc('0x24')]=_0x4aa9d4;if(_0x19ac6a[_0x71fc('0x50')][_0x71fc('0x5e')]){_0x58895f[_0x71fc('0x5f')]=[{'all':!![]}];}return db[_0x71fc('0xa8')][_0x71fc('0x60')](_0x58895f);})[_0x71fc('0x14')](function(_0x30236a){if(_0x19ac6a[_0x71fc('0x50')][_0x71fc('0xa9')]===_0x71fc('0xaa')){for(var _0x17a654=0x0;_0x17a654<_0x30236a[_0x71fc('0x56')];_0x17a654++){_0x30236a[_0x17a654]['body']=juice(_0x30236a[_0x17a654][_0x71fc('0x68')]);}}_0x4c2f85[_0x71fc('0x61')]=_0x30236a;return _0x4c2f85;});}})['then'](respondWithFilteredResult(_0x2ac460,_0x58895f))['catch'](handleError(_0x2ac460,null));};exports[_0x71fc('0x2e')]=function(_0x50d6ae,_0x4d6b5a){var _0x439f5a,_0x3404c3={},_0x41f6ae;if(_0x50d6ae[_0x71fc('0x68')]['to']){_0x41f6ae=_0x50d6ae['body']['to'][_0x71fc('0xa6')](',')[0x0];}return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x50d6ae[_0x71fc('0x63')]['id']},'include':[{'model':db[_0x71fc('0xab')],'as':_0x71fc('0xac'),'include':[{'model':db[_0x71fc('0x90')],'as':_0x71fc('0xad'),'where':{'email':_0x41f6ae},'limit':0x1,'order':[[_0x71fc('0xae'),_0x71fc('0xaf')]]}]},{'model':db[_0x71fc('0x49')],'as':_0x71fc('0x46'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x71fc('0x14')](handleEntityNotFound(_0x4d6b5a,null))[_0x71fc('0x14')](function(_0x53adba){if(!_0x53adba)return;_0x439f5a=_0x53adba;if(!_0x53adba[_0x71fc('0x46')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x50d6ae[_0x71fc('0x68')]['from'])){_0x50d6ae[_0x71fc('0x68')]['from']=util['format'](_0x71fc('0xb0'),_0x53adba[_0x71fc('0x2d')],_0x53adba[_0x71fc('0x7a')]||_0x53adba[_0x71fc('0x46')][_0x71fc('0x3a')]);}if(_0x50d6ae['body'][_0x71fc('0xb1')]&&_0x50d6ae['body'][_0x71fc('0xb1')][_0x71fc('0x56')]){for(var _0x549bd3=0x0;_0x549bd3<_0x50d6ae[_0x71fc('0x68')][_0x71fc('0xb1')][_0x71fc('0x56')];_0x549bd3+=0x1){_0x50d6ae[_0x71fc('0x68')][_0x71fc('0xb1')][_0x549bd3]={'filename':_0x50d6ae['body']['attachments'][_0x549bd3][_0x71fc('0x2d')],'path':path[_0x71fc('0xb2')](config[_0x71fc('0xb3')],_0x71fc('0xb4'),_0x50d6ae[_0x71fc('0x68')]['attachments'][_0x549bd3][_0x71fc('0xb5')])};}}var _0x434cb4=_0x53adba['getSmtpOptions']();return respondWithRpcPromise(_0x71fc('0xb6'),_0x71fc('0xb7'),{'account':_0x434cb4,'message':_0x50d6ae[_0x71fc('0x68')]});})['then'](function(_0x4d035c){if(!_0x4d035c)return;_0x3404c3=_0x4d035c;if(!_0x439f5a[_0x71fc('0xac')])throw new Error('List\x20not\x20found');if(_0x439f5a[_0x71fc('0xac')][_0x71fc('0xad')][_0x71fc('0x56')])return _0x439f5a[_0x71fc('0xac')]['Contacts'][0x0];return db[_0x71fc('0x90')][_0x71fc('0x70')](_[_0x71fc('0xc')](_0x50d6ae['body'],{'firstName':_0x50d6ae[_0x71fc('0x68')]['to'],'email':_0x50d6ae['body']['to'],'phone':_0x50d6ae['body']['to'],'ListId':_0x439f5a[_0x71fc('0x7b')]}));})[_0x71fc('0x14')](function(_0x320347){if(!_0x320347)return;var _0x56515a={'UserId':_0x50d6ae['user']['id'],'ContactId':_0x320347['id'],'MailAccountId':_0x439f5a['id'],'inReplyTo':_0x3404c3[_0x71fc('0xb8')],'to':_0x50d6ae[_0x71fc('0x68')]['from'],'cc':_0x50d6ae[_0x71fc('0x68')]['cc'],'subject':_0x50d6ae['body'][_0x71fc('0xb9')],'attach':_0x50d6ae[_0x71fc('0x68')][_0x71fc('0xba')],'firstMsgDirection':_0x71fc('0xbb'),'lastMsgAt':moment()['format'](_0x71fc('0xa7')),'lastMsgDirection':_0x71fc('0xbb'),'Messages':[_[_0x71fc('0x5a')](_0x50d6ae[_0x71fc('0x68')],{'messageId':_0x3404c3[_0x71fc('0xb8')],'sentAt':moment()['format'](_0x71fc('0xa7')),'read':!![],'MailAccountId':_0x439f5a['id'],'UserId':_0x50d6ae[_0x71fc('0x3a')]['id'],'ContactId':_0x320347['id']})]};if(_0x50d6ae[_0x71fc('0x68')][_0x71fc('0xbc')]){_0x56515a=_['merge'](_0x56515a,_0x50d6ae[_0x71fc('0x68')][_0x71fc('0xbc')]);}return db[_0x71fc('0x8e')][_0x71fc('0x70')](_0x56515a,{'include':[{'model':db[_0x71fc('0xa8')],'as':'Messages'}]});})[_0x71fc('0x14')](respondWithResult(_0x4d6b5a,null))[_0x71fc('0x1f')](handleError(_0x4d6b5a,null));};exports[_0x71fc('0xbd')]=function(_0xaa15eb,_0x2cf08e){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0xaa15eb[_0x71fc('0x63')]['id']},'include':[{'model':db[_0x71fc('0x49')],'as':_0x71fc('0x46'),'raw':!![],'include':[{'model':db[_0x71fc('0xbe')],'as':_0x71fc('0xbe'),'raw':!![]}]}]})[_0x71fc('0x14')](handleEntityNotFound(_0x2cf08e,null))[_0x71fc('0x14')](function(_0x5061c1){if(!_0x5061c1['Smtp'])return;var _0x4473a4=_0x5061c1[_0x71fc('0xbf')]();return respondWithRpcPromise(_0x71fc('0xc0'),_0x71fc('0xbd'),{'account':_0x4473a4});})[_0x71fc('0x14')](respondWithResult(_0x2cf08e,null))[_0x71fc('0x1f')](handleError(_0x2cf08e,null));};exports[_0x71fc('0x2a')]=function(_0xb7fc68,_0x2e184c){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0xb7fc68[_0x71fc('0x63')]['id']}})['then'](handleEntityNotFound(_0x2e184c,null))[_0x71fc('0x14')](function(_0x5cf235){if(_0x5cf235&&_0x5cf235['service']){throw new db['Sequelize'][(_0x71fc('0xc1'))](_0x71fc('0xc2'));}return _0x5cf235;})[_0x71fc('0x14')](removeEntity(_0x2e184c,null))['catch'](handleError(_0x2e184c,null));};exports[_0x71fc('0xc3')]=function(_0x2d0ab9,_0x2d73ef){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x2d0ab9['params']['id']}})['then'](handleEntityNotFound(_0x2d73ef,null))[_0x71fc('0x14')](function(_0x27cb94){if(_0x27cb94){return _0x27cb94[_0x71fc('0xc3')](_0x2d0ab9[_0x71fc('0x68')][_0x71fc('0x76')],_[_0x71fc('0xc4')](_0x2d0ab9[_0x71fc('0x68')],['ids','id'])||{})[_0x71fc('0xc5')](function(_0x2648e1){for(var _0x7965ce=0x0;_0x7965ce<_0x2d0ab9[_0x71fc('0x68')]['ids']['length'];_0x7965ce+=0x1){socket[_0x71fc('0xc6')](_0x71fc('0xc7'),{'UserId':Number(_0x2d0ab9[_0x71fc('0x68')][_0x71fc('0x76')][_0x7965ce]),'MailAccountId':Number(_0x2d0ab9[_0x71fc('0x63')]['id'])});}return _0x2648e1;});}})[_0x71fc('0x14')](respondWithResult(_0x2d73ef,null))[_0x71fc('0x1f')](handleError(_0x2d73ef,null));};exports[_0x71fc('0xc8')]=function(_0x42bed9,_0x373bf2){return db[_0x71fc('0x4c')][_0x71fc('0x67')]({'where':{'id':_0x42bed9[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x373bf2,null))['then'](function(_0x59e537){if(_0x59e537){return _0x59e537['removeAgents'](_0x42bed9[_0x71fc('0x50')][_0x71fc('0x76')])['then'](function(){if(_[_0x71fc('0xc9')](_0x42bed9[_0x71fc('0x50')]['ids'])){for(var _0x22e0d3=0x0;_0x22e0d3<_0x42bed9[_0x71fc('0x50')][_0x71fc('0x76')][_0x71fc('0x56')];_0x22e0d3+=0x1){socket['emit'](_0x71fc('0xca'),{'UserId':Number(_0x42bed9['query'][_0x71fc('0x76')][_0x22e0d3]),'MailAccountId':Number(_0x42bed9[_0x71fc('0x63')]['id'])});}}else{socket['emit'](_0x71fc('0xca'),{'UserId':Number(_0x42bed9['query']['ids']),'MailAccountId':Number(_0x42bed9[_0x71fc('0x63')]['id'])});}});}})[_0x71fc('0x14')](respondWithStatusCode(_0x373bf2,null))['catch'](handleError(_0x373bf2,null));};exports[_0x71fc('0xcb')]=function(_0x3ce1af,_0x3dbccf){var _0x49dae1={};var _0x384e7e={};var _0x119d08;var _0x406187;return db[_0x71fc('0x4c')][_0x71fc('0x72')]({'where':{'id':_0x3ce1af[_0x71fc('0x63')]['id']}})[_0x71fc('0x14')](handleEntityNotFound(_0x3dbccf,null))[_0x71fc('0x14')](function(_0x4bfcca){if(_0x4bfcca){_0x119d08=_0x4bfcca;_0x384e7e[_0x71fc('0x4f')]=_['keys'](db[_0x71fc('0x92')][_0x71fc('0x65')]);_0x384e7e[_0x71fc('0x50')]=_[_0x71fc('0x51')](_0x3ce1af['query']);_0x384e7e['filters']=_[_0x71fc('0x53')](_0x384e7e[_0x71fc('0x4f')],_0x384e7e[_0x71fc('0x50')]);_0x49dae1['attributes']=_[_0x71fc('0x53')](_0x384e7e[_0x71fc('0x4f')],qs['fields'](_0x3ce1af[_0x71fc('0x50')]['fields']));_0x49dae1[_0x71fc('0x54')]=_0x49dae1['attributes'][_0x71fc('0x56')]?_0x49dae1[_0x71fc('0x54')]:_0x384e7e['model'];_0x49dae1[_0x71fc('0x57')]=qs['sort'](_0x3ce1af['query'][_0x71fc('0x58')]);_0x49dae1[_0x71fc('0x59')]=qs[_0x71fc('0x52')](_[_0x71fc('0x74')](_0x3ce1af[_0x71fc('0x50')],_0x384e7e[_0x71fc('0x52')]));if(_0x3ce1af[_0x71fc('0x50')]['filter']){_0x49dae1['where']=_[_0x71fc('0x5a')](_0x49dae1[_0x71fc('0x59')],{'$or':_[_0x71fc('0x4b')](_0x49dae1[_0x71fc('0x54')],function(_0x3742d9){var _0x5d19dd={};_0x5d19dd[_0x3742d9]={'$like':'%'+_0x3ce1af[_0x71fc('0x50')][_0x71fc('0x5d')]+'%'};return _0x5d19dd;})});}_0x49dae1=_['merge']({},_0x49dae1,_0x3ce1af[_0x71fc('0x66')]);return _0x119d08['getAgents'](_0x49dae1);}})[_0x71fc('0x14')](function(_0x1fded8){if(_0x1fded8){_0x406187=_0x1fded8[_0x71fc('0x56')];if(!_0x3ce1af[_0x71fc('0x50')][_0x71fc('0x78')](_0x71fc('0x73'))){_0x49dae1[_0x71fc('0x26')]=qs['limit'](_0x3ce1af['query']['limit']);_0x49dae1['offset']=qs[_0x71fc('0x25')](_0x3ce1af['query'][_0x71fc('0x25')]);}return _0x119d08[_0x71fc('0xcb')](_0x49dae1);}})[_0x71fc('0x14')](function(_0x19882d){if(_0x19882d){return _0x19882d?{'count':_0x406187,'rows':_0x19882d}:null;}})[_0x71fc('0x14')](respondWithResult(_0x3dbccf,null))['catch'](handleError(_0x3dbccf,null));}; \ No newline at end of file +var _0xd047=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','out','messageId','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','defaults','redis','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','username','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','map','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','merge','options','MailAccount','includeAll','include','rows','show','params','find','update','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd047,0x1a5));var _0x7d04=function(_0x5e2857,_0x40b274){_0x5e2857=_0x5e2857-0x0;var _0xccdf47=_0xd047[_0x5e2857];return _0xccdf47;};'use strict';var moment=require(_0x7d04('0x0'));var BPromise=require(_0x7d04('0x1'));var util=require(_0x7d04('0x2'));var path=require(_0x7d04('0x3'));var _=require(_0x7d04('0x4'));var juice=require(_0x7d04('0x5'));var Redis=require(_0x7d04('0x6'));var qs=require(_0x7d04('0x7'));var logger=require('../../config/logger')(_0x7d04('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7d04('0x9')](config[_0x7d04('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d04('0xa')]));require('./mailAccount.socket')[_0x7d04('0xb')](socket);var jayson=require(_0x7d04('0xc'));var client=jayson[_0x7d04('0xd')][_0x7d04('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1e4f6a,_0x441f61,_0xf720c6,_0xe3d41){return new BPromise(function(_0x435d95,_0x221c53){var _0x5127c3=_0xe3d41||client;return _0x5127c3[_0x7d04('0xf')](_0x1e4f6a,_0xf720c6)[_0x7d04('0x10')](function(_0x5be320){logger['info'](_0x7d04('0x11'),_0x441f61,_0x7d04('0x12'));logger['debug'](_0x7d04('0x13'),_0x441f61,_0x7d04('0x12'),JSON[_0x7d04('0x14')](_0x5be320));if(_0x5be320[_0x7d04('0x15')]){if(_0x5be320[_0x7d04('0x15')][_0x7d04('0x16')]===0x1f4){logger[_0x7d04('0x15')](_0x7d04('0x11'),_0x441f61,_0x5be320['error'][_0x7d04('0x17')]);return _0x221c53(_0x5be320[_0x7d04('0x15')][_0x7d04('0x17')]);}logger[_0x7d04('0x15')](_0x7d04('0x11'),_0x441f61,_0x5be320[_0x7d04('0x15')]['message']);return _0x435d95(_0x5be320[_0x7d04('0x15')][_0x7d04('0x17')]);}else{logger[_0x7d04('0x18')](_0x7d04('0x11'),_0x441f61,_0x7d04('0x12'));_0x435d95(_0x5be320[_0x7d04('0x19')][_0x7d04('0x17')]);}})[_0x7d04('0x1a')](function(_0x10466e){logger[_0x7d04('0x15')](_0x7d04('0x11'),_0x441f61,_0x10466e);_0x221c53(_0x10466e);});});}function respondWithStatusCode(_0x2a3a9e,_0x278e7f){_0x278e7f=_0x278e7f||0xcc;return function(_0x368b58){if(_0x368b58){return _0x2a3a9e[_0x7d04('0x1b')](_0x278e7f);}return _0x2a3a9e[_0x7d04('0x1c')](_0x278e7f)[_0x7d04('0x1d')]();};}function respondWithResult(_0x2a0165,_0x58887a){_0x58887a=_0x58887a||0xc8;return function(_0x596871){if(_0x596871){return _0x2a0165[_0x7d04('0x1c')](_0x58887a)[_0x7d04('0x1e')](_0x596871);}};}function respondWithFilteredResult(_0x393262,_0x52bd07){return function(_0x52fe64){if(_0x52fe64){var _0xb151fd=typeof _0x52bd07[_0x7d04('0x1f')]===_0x7d04('0x20')&&typeof _0x52bd07[_0x7d04('0x21')]===_0x7d04('0x20');var _0x47ffee=_0x52fe64[_0x7d04('0x22')];var _0x2c42d5=_0xb151fd?0x0:_0x52bd07[_0x7d04('0x1f')];var _0x24e19a=_0xb151fd?_0x52fe64[_0x7d04('0x22')]:_0x52bd07[_0x7d04('0x1f')]+_0x52bd07['limit'];var _0x2a6caf;if(_0x24e19a>=_0x47ffee){_0x24e19a=_0x47ffee;_0x2a6caf=0xc8;}else{_0x2a6caf=0xce;}_0x393262[_0x7d04('0x1c')](_0x2a6caf);return _0x393262[_0x7d04('0x23')]('Content-Range',_0x2c42d5+'-'+_0x24e19a+'/'+_0x47ffee)['json'](_0x52fe64);}return null;};}function saveUpdates(_0x48683a){return function(_0x5cc832){if(_0x5cc832){return _0x5cc832['update'](_0x48683a)[_0x7d04('0x10')](function(_0x22fe2a){return _0x22fe2a;});}return null;};}function removeEntity(_0x31b003){return function(_0x5e5a6a){if(_0x5e5a6a){return _0x5e5a6a['destroy']()[_0x7d04('0x10')](function(){var _0x12e141=_0x5e5a6a[_0x7d04('0x24')]({'plain':!![]});var _0x278b43=_0x7d04('0x25');return db[_0x7d04('0x26')][_0x7d04('0x27')]({'where':{'type':_0x278b43,'resourceId':_0x12e141['id']}})[_0x7d04('0x10')](function(){return _0x5e5a6a;});})['then'](function(){_0x31b003[_0x7d04('0x1c')](0xcc)[_0x7d04('0x1d')]();});}};}function handleEntityNotFound(_0x283902){return function(_0x14e0be){if(!_0x14e0be){_0x283902[_0x7d04('0x1b')](0x194);}return _0x14e0be;};}function handleError(_0x431522,_0x5641c9){_0x5641c9=_0x5641c9||0x1f4;return function(_0x5cddb4){logger[_0x7d04('0x15')](_0x5cddb4[_0x7d04('0x28')]);if(_0x5cddb4[_0x7d04('0x29')]){delete _0x5cddb4[_0x7d04('0x29')];}_0x431522[_0x7d04('0x1c')](_0x5641c9)[_0x7d04('0x2a')](_0x5cddb4);};}function getImapHost(_0xb6a5e6){switch(_0xb6a5e6){case _0x7d04('0x2b'):return _0x7d04('0x2c');case _0x7d04('0x2d'):return'imap.mail.yahoo.com';case _0x7d04('0x2e'):return _0x7d04('0x2f');case _0x7d04('0x30'):return _0x7d04('0x31');}throw new Error(_0x7d04('0x32'),_0xb6a5e6);}function getSmtpHost(_0x57ed50){switch(_0x57ed50){case _0x7d04('0x2b'):return _0x7d04('0x33');case _0x7d04('0x2d'):return _0x7d04('0x34');case _0x7d04('0x2e'):return _0x7d04('0x35');case'outlook365':return'smtp.office365.com';}throw new Error(_0x7d04('0x32'),_0x57ed50);}function getAuthenticationOptions(_0x3a64f0,_0x424cf8){var _0x169a45={};var _0x29e3f7={};if(_0x3a64f0){_0x169a45[_0x7d04('0x36')]=_0x29e3f7[_0x7d04('0x36')]=_0x424cf8['username'];_0x169a45[_0x7d04('0x37')]=_0x29e3f7['pass']=_0x424cf8['password'];if(_0x424cf8[_0x7d04('0x38')]){_0x169a45[_0x7d04('0x38')]=_0x29e3f7[_0x7d04('0x38')]=!![];_0x169a45['CloudProviderId']=_0x29e3f7[_0x7d04('0x39')]=_0x424cf8[_0x7d04('0x39')];_0x169a45[_0x7d04('0x37')]=_0x29e3f7[_0x7d04('0x3a')]=null;}else{_0x169a45[_0x7d04('0x39')]=_0x29e3f7[_0x7d04('0x39')]=null;}_0x169a45['host']=getImapHost(_0x3a64f0);_0x169a45[_0x7d04('0x3b')]=0x3e1;_0x29e3f7[_0x7d04('0x3c')]=getSmtpHost(_0x3a64f0);_0x29e3f7['port']=0x24b;_0x29e3f7[_0x7d04('0x3d')]=![];_0x169a45[_0x7d04('0x3e')]=_0x29e3f7[_0x7d04('0x3e')]=null;}else{if(_0x424cf8[_0x7d04('0x3f')]){_0x169a45[_0x7d04('0x36')]=_0x29e3f7[_0x7d04('0x36')]=_0x424cf8[_0x7d04('0x40')];_0x169a45[_0x7d04('0x37')]=_0x29e3f7[_0x7d04('0x3a')]=_0x424cf8['password'];}else{_0x169a45[_0x7d04('0x3f')]=_0x29e3f7['authentication']=![];_0x169a45[_0x7d04('0x36')]=_0x29e3f7[_0x7d04('0x36')]=null;_0x169a45[_0x7d04('0x37')]=_0x29e3f7[_0x7d04('0x3a')]=null;}_0x169a45[_0x7d04('0x3c')]=_0x424cf8[_0x7d04('0x41')][_0x7d04('0x3c')];_0x169a45[_0x7d04('0x3b')]=_0x424cf8['Imap']['port'];_0x29e3f7[_0x7d04('0x3c')]=_0x424cf8['Smtp'][_0x7d04('0x3c')];_0x29e3f7[_0x7d04('0x3b')]=_0x424cf8[_0x7d04('0x42')][_0x7d04('0x3b')];}return{'Imap':_0x169a45,'Smtp':_0x29e3f7};}exports['index']=function(_0x24bb23,_0x54f72f){var _0x1e346b={'include':[{'model':db[_0x7d04('0x43')],'as':_0x7d04('0x41')},{'model':db[_0x7d04('0x44')],'as':_0x7d04('0x42')},{'model':db[_0x7d04('0x45')],'as':_0x7d04('0x46')}]},_0x526ff8={},_0x3ce897={'count':0x0,'rows':[]};var _0x4204a6=_['map'](db['MailAccount'][_0x7d04('0x47')],function(_0x989af1){return{'name':_0x989af1[_0x7d04('0x48')],'type':_0x989af1['type'][_0x7d04('0x49')]};});_0x526ff8['model']=_[_0x7d04('0x4a')](_0x4204a6,'name');_0x526ff8['query']=_[_0x7d04('0x4b')](_0x24bb23[_0x7d04('0x4c')]);_0x526ff8['filters']=_['intersection'](_0x526ff8[_0x7d04('0x4d')],_0x526ff8[_0x7d04('0x4c')]);_0x1e346b[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0x526ff8[_0x7d04('0x4d')],qs[_0x7d04('0x50')](_0x24bb23[_0x7d04('0x4c')]['fields']));_0x1e346b[_0x7d04('0x4e')]=_0x1e346b[_0x7d04('0x4e')][_0x7d04('0x51')]?_0x1e346b[_0x7d04('0x4e')]:_0x526ff8[_0x7d04('0x4d')];if(!_0x24bb23[_0x7d04('0x4c')][_0x7d04('0x52')]('nolimit')){_0x1e346b[_0x7d04('0x21')]=qs[_0x7d04('0x21')](_0x24bb23[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x1e346b[_0x7d04('0x1f')]=qs[_0x7d04('0x1f')](_0x24bb23[_0x7d04('0x4c')]['offset']);}_0x1e346b[_0x7d04('0x53')]=qs[_0x7d04('0x54')](_0x24bb23[_0x7d04('0x4c')]['sort']);_0x1e346b[_0x7d04('0x55')]=qs[_0x7d04('0x56')](_[_0x7d04('0x57')](_0x24bb23['query'],_0x526ff8[_0x7d04('0x56')]),_0x4204a6);if(_0x24bb23['query'][_0x7d04('0x58')]){_0x1e346b[_0x7d04('0x55')]=_['merge'](_0x1e346b[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x4204a6,function(_0x1acc35){if(_0x1acc35[_0x7d04('0x59')]!=='VIRTUAL'){var _0x24a100={};_0x24a100[_0x1acc35[_0x7d04('0x29')]]={'$like':'%'+_0x24bb23[_0x7d04('0x4c')]['filter']+'%'};return _0x24a100;}})});}_0x1e346b=_[_0x7d04('0x5a')]({},_0x1e346b,_0x24bb23[_0x7d04('0x5b')]);var _0x2fe075={'where':_0x1e346b[_0x7d04('0x55')]};return db[_0x7d04('0x5c')]['count'](_0x2fe075)[_0x7d04('0x10')](function(_0x5a8e7d){_0x3ce897[_0x7d04('0x22')]=_0x5a8e7d;if(_0x24bb23['query'][_0x7d04('0x5d')]){_0x1e346b[_0x7d04('0x5e')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1e346b);})[_0x7d04('0x10')](function(_0x56a272){_0x3ce897[_0x7d04('0x5f')]=_0x56a272;return _0x3ce897;})['then'](respondWithFilteredResult(_0x54f72f,_0x1e346b))[_0x7d04('0x1a')](handleError(_0x54f72f,null));};exports[_0x7d04('0x60')]=function(_0x4363a0,_0x50cf54){var _0x4bd69d={'raw':![],'where':{'id':_0x4363a0[_0x7d04('0x61')]['id']},'include':[{'model':db[_0x7d04('0x43')],'as':_0x7d04('0x41')},{'model':db[_0x7d04('0x44')],'as':_0x7d04('0x42')},{'model':db['Pause'],'as':_0x7d04('0x46')}]},_0x3aa09a={};_0x3aa09a[_0x7d04('0x4d')]=_['keys'](db[_0x7d04('0x5c')][_0x7d04('0x47')]);_0x3aa09a[_0x7d04('0x4c')]=_[_0x7d04('0x4b')](_0x4363a0[_0x7d04('0x4c')]);_0x3aa09a[_0x7d04('0x56')]=_[_0x7d04('0x4f')](_0x3aa09a[_0x7d04('0x4d')],_0x3aa09a[_0x7d04('0x4c')]);_0x4bd69d[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0x3aa09a[_0x7d04('0x4d')],qs[_0x7d04('0x50')](_0x4363a0[_0x7d04('0x4c')][_0x7d04('0x50')]));_0x4bd69d[_0x7d04('0x4e')]=_0x4bd69d[_0x7d04('0x4e')]['length']?_0x4bd69d[_0x7d04('0x4e')]:_0x3aa09a[_0x7d04('0x4d')];if(_0x4363a0[_0x7d04('0x4c')][_0x7d04('0x5d')]){_0x4bd69d[_0x7d04('0x5e')]=[{'all':!![]}];}_0x4bd69d=_[_0x7d04('0x5a')]({},_0x4bd69d,_0x4363a0[_0x7d04('0x5b')]);return db[_0x7d04('0x5c')][_0x7d04('0x62')](_0x4bd69d)[_0x7d04('0x10')](handleEntityNotFound(_0x50cf54,null))['then'](respondWithResult(_0x50cf54,null))[_0x7d04('0x1a')](handleError(_0x50cf54,null));};exports[_0x7d04('0x63')]=function(_0x4288fd,_0x33989f){if(_0x4288fd[_0x7d04('0x64')]['id']){delete _0x4288fd['body']['id'];}var _0x4316d8=_0x4288fd[_0x7d04('0x64')][_0x7d04('0x65')]===_0x7d04('0x66')?null:_0x4288fd[_0x7d04('0x64')][_0x7d04('0x65')];var _0x52297f=_0x4288fd[_0x7d04('0x64')][_0x7d04('0x41')]||{};var _0x4f0a26=_0x4288fd['body'][_0x7d04('0x42')]||{};if(_0x4316d8){_0x52297f['host']=getImapHost(_0x4316d8);_0x52297f['port']=0x3e1;_0x4f0a26[_0x7d04('0x3c')]=getSmtpHost(_0x4316d8);_0x4f0a26['port']=0x24b;_0x4f0a26[_0x7d04('0x3d')]=![];}if(_0x4f0a26[_0x7d04('0x38')]){_0x4f0a26[_0x7d04('0x3d')]=![];}else{_0x4f0a26[_0x7d04('0x39')]=null;}if(!_0x52297f[_0x7d04('0x38')])_0x52297f[_0x7d04('0x39')]=null;_0x4288fd[_0x7d04('0x64')][_0x7d04('0x41')]=_0x52297f;_0x4288fd[_0x7d04('0x64')][_0x7d04('0x42')]=_0x4f0a26;return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x4288fd['params']['id']},'include':[{'model':db[_0x7d04('0x43')],'as':_0x7d04('0x41')},{'model':db['MailServerOut'],'as':_0x7d04('0x42')},{'model':db['Pause'],'as':_0x7d04('0x46')}]})[_0x7d04('0x10')](handleEntityNotFound(_0x33989f,null))['then'](function(_0x11b906){if(!_0x11b906)throw new Error('Mail\x20Account\x20not\x20found');if(_0x11b906[_0x7d04('0x3e')])delete _0x4288fd['body'][_0x7d04('0x41')];return _0x11b906;})[_0x7d04('0x10')](saveUpdates(_0x4288fd[_0x7d04('0x64')],null))['then'](function(_0x2dbf9c){if(!_0x4288fd[_0x7d04('0x64')][_0x7d04('0x41')])return _0x2dbf9c;return db[_0x7d04('0x43')][_0x7d04('0x63')](_0x4288fd['body']['Imap'],{'where':{'MailAccountId':_0x2dbf9c['id']}})[_0x7d04('0x10')](function(){return _0x2dbf9c;});})[_0x7d04('0x10')](function(_0x47347c){if(!_0x4288fd[_0x7d04('0x64')][_0x7d04('0x42')])return _0x47347c;return db[_0x7d04('0x44')][_0x7d04('0x63')](_0x4288fd['body'][_0x7d04('0x42')],{'where':{'MailAccountId':_0x47347c['id']}})[_0x7d04('0x10')](function(){return _0x47347c;});})[_0x7d04('0x10')](respondWithResult(_0x33989f,null))[_0x7d04('0x1a')](handleError(_0x33989f,null));};exports[_0x7d04('0x67')]=function(_0x448b4e,_0x1f2329){return db[_0x7d04('0x5c')]['describe']()[_0x7d04('0x10')](respondWithResult(_0x1f2329,null))[_0x7d04('0x1a')](handleError(_0x1f2329,null));};exports[_0x7d04('0x68')]=function(_0x15d12f,_0x5b6e15){if(_0x15d12f[_0x7d04('0x64')]['id']){delete _0x15d12f[_0x7d04('0x64')]['id'];}return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x15d12f['params']['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x5b6e15,null))[_0x7d04('0x10')](function(_0xba0350){if(_0xba0350){_0x15d12f[_0x7d04('0x64')][_0x7d04('0x69')]=_0xba0350['id'];return db[_0x7d04('0x6a')][_0x7d04('0x6b')](_0x15d12f[_0x7d04('0x64')]);}})[_0x7d04('0x10')](respondWithResult(_0x5b6e15,null))[_0x7d04('0x1a')](handleError(_0x5b6e15,null));};exports['getDispositions']=function(_0xee04a,_0x499c4f){var _0x1497d4={'raw':![],'where':{}};var _0xe4a973={};var _0x4a8196={'count':0x0,'rows':[]};return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0xee04a[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x499c4f,null))[_0x7d04('0x10')](function(_0xbb2383){if(_0xbb2383){_0xe4a973['model']=_[_0x7d04('0x4b')](db[_0x7d04('0x6a')]['rawAttributes']);_0xe4a973[_0x7d04('0x4c')]=_[_0x7d04('0x4b')](_0xee04a[_0x7d04('0x4c')]);_0xe4a973['filters']=_[_0x7d04('0x4f')](_0xe4a973[_0x7d04('0x4d')],_0xe4a973[_0x7d04('0x4c')]);_0x1497d4[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0xe4a973[_0x7d04('0x4d')],qs[_0x7d04('0x50')](_0xee04a[_0x7d04('0x4c')][_0x7d04('0x50')]));_0x1497d4[_0x7d04('0x4e')]=_0x1497d4[_0x7d04('0x4e')][_0x7d04('0x51')]?_0x1497d4['attributes']:_0xe4a973[_0x7d04('0x4d')];if(!_0xee04a[_0x7d04('0x4c')][_0x7d04('0x52')](_0x7d04('0x6d'))){_0x1497d4[_0x7d04('0x21')]=qs[_0x7d04('0x21')](_0xee04a[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x1497d4[_0x7d04('0x1f')]=qs[_0x7d04('0x1f')](_0xee04a['query'][_0x7d04('0x1f')]);}_0x1497d4['order']=qs[_0x7d04('0x54')](_0xee04a['query'][_0x7d04('0x54')]);_0x1497d4[_0x7d04('0x55')]=qs['filters'](_['pick'](_0xee04a[_0x7d04('0x4c')],_0xe4a973[_0x7d04('0x56')]));_0x1497d4[_0x7d04('0x55')][_0x7d04('0x69')]=_0xbb2383['id'];if(_0xee04a[_0x7d04('0x4c')][_0x7d04('0x58')]){_0x1497d4['where']=_['merge'](_0x1497d4[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x1497d4['attributes'],function(_0x46f163){var _0x300631={};_0x300631[_0x46f163]={'$like':'%'+_0xee04a[_0x7d04('0x4c')][_0x7d04('0x58')]+'%'};return _0x300631;})});}_0x1497d4=_['merge']({},_0x1497d4,_0xee04a[_0x7d04('0x5b')]);return db['Disposition'][_0x7d04('0x22')]({'where':_0x1497d4[_0x7d04('0x55')]})[_0x7d04('0x10')](function(_0x3d96a6){_0x4a8196[_0x7d04('0x22')]=_0x3d96a6;if(_0xee04a[_0x7d04('0x4c')]['includeAll']){_0x1497d4['include']=[{'all':!![]}];}return db[_0x7d04('0x6a')][_0x7d04('0x6e')](_0x1497d4);})[_0x7d04('0x10')](function(_0x4d5843){_0x4a8196['rows']=_0x4d5843;return _0x4a8196;});}})[_0x7d04('0x10')](respondWithFilteredResult(_0x499c4f,_0x1497d4))[_0x7d04('0x1a')](handleError(_0x499c4f,null));};exports['removeDispositions']=function(_0x4eb9f4,_0x221a30){return db['MailAccount'][_0x7d04('0x62')]({'where':{'id':_0x4eb9f4[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x221a30,null))[_0x7d04('0x10')](function(_0x1695bb){if(_0x1695bb){return _0x1695bb[_0x7d04('0x6f')](_0x4eb9f4[_0x7d04('0x4c')][_0x7d04('0x70')]);}})['then'](respondWithStatusCode(_0x221a30,null))[_0x7d04('0x1a')](handleError(_0x221a30,null));};exports[_0x7d04('0x71')]=function(_0x3bcbad,_0x44cc83){if(_0x3bcbad['body']['id']){delete _0x3bcbad['body']['id'];}return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x3bcbad[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x44cc83,null))[_0x7d04('0x10')](function(_0x470aaf){if(_0x470aaf){_0x3bcbad['body'][_0x7d04('0x69')]=_0x470aaf['id'];return db[_0x7d04('0x72')][_0x7d04('0x6b')](_0x3bcbad[_0x7d04('0x64')]);}})['then'](respondWithResult(_0x44cc83,null))[_0x7d04('0x1a')](handleError(_0x44cc83,null));};exports[_0x7d04('0x73')]=function(_0x369cf7,_0x3c1f76){var _0x2628c6={'raw':![],'where':{}};var _0x2d4aaa={};var _0x1e904e={'count':0x0,'rows':[]};return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0x369cf7[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x3c1f76,null))[_0x7d04('0x10')](function(_0x26849d){if(_0x26849d){_0x2d4aaa['model']=_[_0x7d04('0x4b')](db['CannedAnswer'][_0x7d04('0x47')]);_0x2d4aaa['query']=_[_0x7d04('0x4b')](_0x369cf7[_0x7d04('0x4c')]);_0x2d4aaa[_0x7d04('0x56')]=_[_0x7d04('0x4f')](_0x2d4aaa[_0x7d04('0x4d')],_0x2d4aaa['query']);_0x2628c6[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0x2d4aaa[_0x7d04('0x4d')],qs[_0x7d04('0x50')](_0x369cf7[_0x7d04('0x4c')][_0x7d04('0x50')]));_0x2628c6[_0x7d04('0x4e')]=_0x2628c6['attributes'][_0x7d04('0x51')]?_0x2628c6[_0x7d04('0x4e')]:_0x2d4aaa['model'];if(!_0x369cf7['query'][_0x7d04('0x52')](_0x7d04('0x6d'))){_0x2628c6[_0x7d04('0x21')]=qs[_0x7d04('0x21')](_0x369cf7[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x2628c6[_0x7d04('0x1f')]=qs['offset'](_0x369cf7[_0x7d04('0x4c')]['offset']);}_0x2628c6[_0x7d04('0x53')]=qs['sort'](_0x369cf7['query'][_0x7d04('0x54')]);_0x2628c6['where']=qs[_0x7d04('0x56')](_[_0x7d04('0x57')](_0x369cf7[_0x7d04('0x4c')],_0x2d4aaa[_0x7d04('0x56')]));_0x2628c6[_0x7d04('0x55')]['MailAccountId']=_0x26849d['id'];if(_0x369cf7['query'][_0x7d04('0x58')]){_0x2628c6['where']=_[_0x7d04('0x5a')](_0x2628c6[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x2628c6['attributes'],function(_0x5f22c9){var _0x34cbed={};_0x34cbed[_0x5f22c9]={'$like':'%'+_0x369cf7[_0x7d04('0x4c')]['filter']+'%'};return _0x34cbed;})});}_0x2628c6=_[_0x7d04('0x5a')]({},_0x2628c6,_0x369cf7[_0x7d04('0x5b')]);return db[_0x7d04('0x72')][_0x7d04('0x22')]({'where':_0x2628c6[_0x7d04('0x55')]})['then'](function(_0x1ccbca){_0x1e904e[_0x7d04('0x22')]=_0x1ccbca;if(_0x369cf7['query'][_0x7d04('0x5d')]){_0x2628c6[_0x7d04('0x5e')]=[{'all':!![]}];}return db[_0x7d04('0x72')][_0x7d04('0x6e')](_0x2628c6);})[_0x7d04('0x10')](function(_0x150b7a){_0x1e904e['rows']=_0x150b7a;return _0x1e904e;});}})[_0x7d04('0x10')](respondWithFilteredResult(_0x3c1f76,_0x2628c6))[_0x7d04('0x1a')](handleError(_0x3c1f76,null));};exports[_0x7d04('0x74')]=function(_0xc6e843,_0x2864a0){return db[_0x7d04('0x5c')]['find']({'where':{'id':_0xc6e843['params']['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x2864a0,null))[_0x7d04('0x10')](function(_0x16e65d){if(_0x16e65d){return _0x16e65d[_0x7d04('0x74')](_0xc6e843[_0x7d04('0x4c')][_0x7d04('0x70')]);}})['then'](respondWithStatusCode(_0x2864a0,null))['catch'](handleError(_0x2864a0,null));};exports['create']=function(_0x5995b3,_0x22dfc5){var _0xf8c5b1={'name':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x29')],'key':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x49')],'provider':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x65')]===_0x7d04('0x66')?null:_0x5995b3['body'][_0x7d04('0x65')],'email':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x75')],'ListId':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x76')],'active':!_['isNil'](_0x5995b3['body'][_0x7d04('0x77')])?_0x5995b3['body'][_0x7d04('0x77')]:!![],'description':_0x5995b3[_0x7d04('0x64')][_0x7d04('0x78')]||null};var _0x3534c9=getAuthenticationOptions(_0xf8c5b1['provider'],_0x5995b3[_0x7d04('0x64')]);_0xf8c5b1[_0x7d04('0x41')]=_0x3534c9[_0x7d04('0x41')];_0xf8c5b1[_0x7d04('0x42')]=_0x3534c9['Smtp'];return db[_0x7d04('0x5c')][_0x7d04('0x6b')](_0xf8c5b1,{'include':[{'model':db[_0x7d04('0x44')],'as':_0x7d04('0x42')},{'model':db[_0x7d04('0x43')],'as':_0x7d04('0x41')}]})[_0x7d04('0x10')](function(_0x47102b){var _0x45a965=_0x5995b3['user'][_0x7d04('0x24')]({'plain':!![]});if(!_0x45a965)throw new Error(_0x7d04('0x79'));if(_0x45a965[_0x7d04('0x7a')]===_0x7d04('0x36')){var _0x5d5996=_0x47102b[_0x7d04('0x24')]({'plain':!![]});return db[_0x7d04('0x7b')][_0x7d04('0x62')]({'where':{'name':_0x7d04('0x25'),'userProfileId':_0x45a965[_0x7d04('0x7c')]},'raw':!![]})[_0x7d04('0x10')](function(_0x27ce0c){if(_0x27ce0c&&_0x27ce0c[_0x7d04('0x7d')]===0x0){return db[_0x7d04('0x26')][_0x7d04('0x6b')]({'name':_0x5d5996['name'],'resourceId':_0x5d5996['id'],'type':_0x27ce0c[_0x7d04('0x29')],'sectionId':_0x27ce0c['id']},{})[_0x7d04('0x10')](function(){return _0x47102b;});}else{return _0x47102b;}})[_0x7d04('0x1a')](function(_0x406b94){logger['error'](_0x7d04('0x7e'),_0x406b94);throw _0x406b94;});}return _0x47102b;})[_0x7d04('0x10')](respondWithResult(_0x22dfc5,0xc9))[_0x7d04('0x1a')](handleError(_0x22dfc5,null));};exports[_0x7d04('0x7f')]=function(_0x4c6441,_0x2b6404){return db['MailAccount'][_0x7d04('0x6c')]({'where':{'id':_0x4c6441['params']['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x2b6404,null))['then'](function(_0x219bd9){if(_0x219bd9){return _0x219bd9[_0x7d04('0x7f')]();}return null;})[_0x7d04('0x10')](respondWithResult(_0x2b6404,null))[_0x7d04('0x1a')](handleError(_0x2b6404,null));};exports[_0x7d04('0x80')]=function(_0x547a26,_0x77b597){if(_0x547a26[_0x7d04('0x64')]['id']){delete _0x547a26[_0x7d04('0x64')]['id'];}return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x547a26['params']['id']}})['then'](handleEntityNotFound(_0x77b597,null))[_0x7d04('0x10')](function(_0x2b6f75){if(_0x2b6f75){_0x547a26[_0x7d04('0x64')][_0x7d04('0x69')]=_0x2b6f75['id'];return db[_0x7d04('0x43')][_0x7d04('0x6b')](_0x547a26[_0x7d04('0x64')]);}})[_0x7d04('0x10')](respondWithResult(_0x77b597,null))[_0x7d04('0x1a')](handleError(_0x77b597,null));};exports[_0x7d04('0x81')]=function(_0x339542,_0x1a8690){return db['MailAccount'][_0x7d04('0x6c')]({'where':{'id':_0x339542[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x1a8690,null))[_0x7d04('0x10')](function(_0x25eb10){if(_0x25eb10){return _0x25eb10['setImap'](null);}return null;})[_0x7d04('0x10')](respondWithStatusCode(_0x1a8690,null))['catch'](handleError(_0x1a8690,null));};exports[_0x7d04('0x82')]=function(_0x110c01,_0x2d0074){return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0x110c01[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x2d0074,null))[_0x7d04('0x10')](function(_0x4f365e){if(_0x4f365e){return _0x4f365e[_0x7d04('0x82')]();}return null;})[_0x7d04('0x10')](respondWithResult(_0x2d0074,null))['catch'](handleError(_0x2d0074,null));};exports[_0x7d04('0x83')]=function(_0x2973f6,_0x3806b5){if(_0x2973f6[_0x7d04('0x64')]['id']){delete _0x2973f6[_0x7d04('0x64')]['id'];}return db['MailAccount'][_0x7d04('0x62')]({'where':{'id':_0x2973f6[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x3806b5,null))[_0x7d04('0x10')](function(_0x5a6694){if(_0x5a6694){_0x2973f6[_0x7d04('0x64')][_0x7d04('0x69')]=_0x5a6694['id'];return db[_0x7d04('0x44')][_0x7d04('0x6b')](_0x2973f6['body']);}})[_0x7d04('0x10')](respondWithResult(_0x3806b5,null))['catch'](handleError(_0x3806b5,null));};exports['removeSmtp']=function(_0x58968,_0x45b5bc){return db['MailAccount'][_0x7d04('0x6c')]({'where':{'id':_0x58968['params']['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x45b5bc,null))[_0x7d04('0x10')](function(_0x336a41){if(_0x336a41){return _0x336a41[_0x7d04('0x84')](null);}return null;})[_0x7d04('0x10')](respondWithStatusCode(_0x45b5bc,null))[_0x7d04('0x1a')](handleError(_0x45b5bc,null));};exports[_0x7d04('0x85')]=function(_0x32c49a,_0x385844){return db[_0x7d04('0x86')][_0x7d04('0x62')]({'where':{'id':_0x32c49a['params']['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x385844,null))[_0x7d04('0x10')](function(_0x3b9d07){if(_0x3b9d07){return _0x3b9d07[_0x7d04('0x85')](_0x32c49a[_0x7d04('0x64')][_0x7d04('0x70')],_[_0x7d04('0x87')](_0x32c49a[_0x7d04('0x64')],[_0x7d04('0x70'),'id'])||{});}})['then'](respondWithResult(_0x385844,null))[_0x7d04('0x1a')](handleError(_0x385844,null));};exports[_0x7d04('0x88')]=function(_0x185580,_0x4a9757){var _0x380b97={'raw':![],'where':{}};var _0x3919d8={};var _0x572488={'count':0x0,'rows':[]};return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0x185580[_0x7d04('0x61')]['id']}})['then'](handleEntityNotFound(_0x4a9757,null))[_0x7d04('0x10')](function(_0x4ae174){if(_0x4ae174){_0x3919d8[_0x7d04('0x4d')]=_[_0x7d04('0x4b')](db['MailInteraction'][_0x7d04('0x47')]);_0x3919d8['query']=_['keys'](_0x185580[_0x7d04('0x4c')]);_0x3919d8[_0x7d04('0x56')]=_[_0x7d04('0x4f')](_0x3919d8[_0x7d04('0x4d')],_0x3919d8['query']);_0x380b97[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0x3919d8[_0x7d04('0x4d')],qs['fields'](_0x185580[_0x7d04('0x4c')][_0x7d04('0x50')]));_0x380b97[_0x7d04('0x4e')]=_0x380b97[_0x7d04('0x4e')]['length']?_0x380b97[_0x7d04('0x4e')]:_0x3919d8[_0x7d04('0x4d')];if(!_0x185580[_0x7d04('0x4c')]['hasOwnProperty'](_0x7d04('0x6d'))){_0x380b97[_0x7d04('0x21')]=qs['limit'](_0x185580['query'][_0x7d04('0x21')]);_0x380b97['offset']=qs[_0x7d04('0x1f')](_0x185580['query'][_0x7d04('0x1f')]);}_0x380b97[_0x7d04('0x53')]=qs[_0x7d04('0x54')](_0x185580[_0x7d04('0x4c')][_0x7d04('0x54')]);_0x380b97['where']=qs[_0x7d04('0x56')](_[_0x7d04('0x57')](_0x185580['query'],_0x3919d8['filters']));_0x380b97[_0x7d04('0x55')][_0x7d04('0x69')]=_0x4ae174['id'];if(_0x185580[_0x7d04('0x4c')][_0x7d04('0x58')]){_0x380b97[_0x7d04('0x55')]=_[_0x7d04('0x5a')](_0x380b97[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x380b97['attributes'],function(_0x38e54c){var _0xcb5428={};_0xcb5428[_0x38e54c]={'$like':'%'+_0x185580[_0x7d04('0x4c')][_0x7d04('0x58')]+'%'};return _0xcb5428;})});}_0x380b97=_[_0x7d04('0x5a')]({},_0x380b97,_0x185580[_0x7d04('0x5b')]);return db[_0x7d04('0x86')][_0x7d04('0x22')]({'where':_0x380b97[_0x7d04('0x55')]})[_0x7d04('0x10')](function(_0x21d5af){_0x572488['count']=_0x21d5af;if(_0x185580['query']['includeAll']){_0x380b97['include']=[{'model':db[_0x7d04('0x89')],'as':_0x7d04('0x8a'),'required':![]},{'model':db[_0x7d04('0x8b')],'as':_0x7d04('0x8c'),'attributes':[_0x7d04('0x29'),_0x7d04('0x8d'),_0x7d04('0x8e')],'required':![]},{'model':db['Tag'],'as':_0x7d04('0x8f'),'attributes':['id',_0x7d04('0x29'),_0x7d04('0x90')],'where':_0x185580[_0x7d04('0x4c')]['tag']?{'id':_0x185580[_0x7d04('0x4c')]['tag']}:undefined,'required':_0x185580[_0x7d04('0x4c')]['tag']?!![]:![]}];}return db[_0x7d04('0x86')]['findAll'](_0x380b97);})[_0x7d04('0x10')](function(_0x1a1a2b){_0x572488['rows']=_0x1a1a2b;return _0x572488;});}})[_0x7d04('0x10')](respondWithFilteredResult(_0x4a9757,_0x380b97))['catch'](handleError(_0x4a9757,null));};exports['addApplications']=function addApplications(_0x993949,_0x4d0a81){var _0x157fc6=_0x993949[_0x7d04('0x61')]['id'];var _0x5e7204=_0x993949[_0x7d04('0x64')];var _0x4e965a=0xc8;var _0x28c437=null;return db[_0x7d04('0x91')]['transaction']({'isolationLevel':db[_0x7d04('0x91')][_0x7d04('0x92')][_0x7d04('0x93')][_0x7d04('0x94')]},function(_0x31b7fe){return db[_0x7d04('0x5c')]['findOne']({'where':{'id':_0x157fc6},'transaction':_0x31b7fe})[_0x7d04('0x10')](function(_0xa60aeb){if(_0xa60aeb){return db[_0x7d04('0x95')][_0x7d04('0x27')]({'where':{'MailAccountId':_0x157fc6},'transaction':_0x31b7fe})[_0x7d04('0x10')](function(){var _0x6854b5=_['map'](_0x5e7204,function(_0x30d1c2){_0x30d1c2[_0x7d04('0x69')]=_0x157fc6;return _0x30d1c2;});return db[_0x7d04('0x95')][_0x7d04('0x96')](_0x6854b5,{'transaction':_0x31b7fe});});}else{_0x4e965a=0x194;_0x28c437=[];}});})['then'](function(){if(_0x4e965a!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x157fc6},'order':_0x7d04('0x97')})[_0x7d04('0x10')](function(_0x21731c){_0x28c437=_0x21731c;});}})['catch'](function(_0x2d060d){_0x4e965a=0x1f4;logger[_0x7d04('0x15')](_0x2d060d['stack']);if(_0x2d060d[_0x7d04('0x29')]){delete _0x2d060d['name'];}_0x28c437=_0x2d060d;})['finally'](function(){if(_0x28c437===null){_0x4d0a81[_0x7d04('0x1b')](_0x4e965a);}else{if(_0x4e965a===0x1f4){_0x4d0a81['status'](_0x4e965a)[_0x7d04('0x2a')](_0x28c437);}else{_0x4d0a81[_0x7d04('0x1c')](_0x4e965a)[_0x7d04('0x1e')](_0x28c437);}}});};exports['getApplications']=function(_0x1b1a7d,_0x3b1ee1){var _0x3f16e9={};var _0xf580ea={};var _0x3ec9d9;var _0x338fb0;return db[_0x7d04('0x5c')]['findOne']({'where':{'id':_0x1b1a7d['params']['id']}})['then'](handleEntityNotFound(_0x3b1ee1,null))['then'](function(_0x43df0a){if(_0x43df0a){_0x3ec9d9=_0x43df0a;_0xf580ea['model']=_[_0x7d04('0x4b')](db[_0x7d04('0x95')][_0x7d04('0x47')]);_0xf580ea[_0x7d04('0x4c')]=_[_0x7d04('0x4b')](_0x1b1a7d[_0x7d04('0x4c')]);_0xf580ea['filters']=_['intersection'](_0xf580ea[_0x7d04('0x4d')],_0xf580ea[_0x7d04('0x4c')]);_0x3f16e9[_0x7d04('0x4e')]=_[_0x7d04('0x4f')](_0xf580ea['model'],qs[_0x7d04('0x50')](_0x1b1a7d['query'][_0x7d04('0x50')]));_0x3f16e9[_0x7d04('0x4e')]=_0x3f16e9[_0x7d04('0x4e')]['length']?_0x3f16e9[_0x7d04('0x4e')]:_0xf580ea[_0x7d04('0x4d')];_0x3f16e9[_0x7d04('0x53')]=qs['sort'](_0x1b1a7d[_0x7d04('0x4c')][_0x7d04('0x54')]);_0x3f16e9[_0x7d04('0x55')]=qs[_0x7d04('0x56')](_[_0x7d04('0x57')](_0x1b1a7d['query'],_0xf580ea[_0x7d04('0x56')]));if(_0x1b1a7d[_0x7d04('0x4c')][_0x7d04('0x58')]){_0x3f16e9['where']=_[_0x7d04('0x5a')](_0x3f16e9[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x3f16e9[_0x7d04('0x4e')],function(_0x34642b){var _0x4097c8={};_0x4097c8[_0x34642b]={'$like':'%'+_0x1b1a7d[_0x7d04('0x4c')][_0x7d04('0x58')]+'%'};return _0x4097c8;})});}_0x3f16e9=_[_0x7d04('0x5a')]({},_0x3f16e9,_0x1b1a7d[_0x7d04('0x5b')]);return _0x3ec9d9['getApplications'](_0x3f16e9);}})[_0x7d04('0x10')](function(_0xdd65d9){if(_0xdd65d9){_0x338fb0=_0xdd65d9[_0x7d04('0x51')];if(!_0x1b1a7d['query']['hasOwnProperty']('nolimit')){_0x3f16e9[_0x7d04('0x21')]=qs[_0x7d04('0x21')](_0x1b1a7d[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x3f16e9[_0x7d04('0x1f')]=qs['offset'](_0x1b1a7d['query'][_0x7d04('0x1f')]);}return _0x3ec9d9[_0x7d04('0x98')](_0x3f16e9);}})[_0x7d04('0x10')](function(_0x257541){if(_0x257541){return _0x257541?{'count':_0x338fb0,'rows':_0x257541}:null;}})[_0x7d04('0x10')](respondWithResult(_0x3b1ee1,null))[_0x7d04('0x1a')](handleError(_0x3b1ee1,null));};exports[_0x7d04('0x99')]=function(_0x3fd23c,_0x52d163){var _0x4178aa={'raw':!![],'where':{}};var _0x4aa44c={};var _0x18b7b3={'count':0x0,'rows':[]};return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0x3fd23c[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x52d163,null))[_0x7d04('0x10')](function(_0x111ec0){if(_0x111ec0){_0x4aa44c[_0x7d04('0x4d')]=_[_0x7d04('0x4b')](db['MailMessage'][_0x7d04('0x47')]);_0x4aa44c[_0x7d04('0x4c')]=_['keys'](_0x3fd23c[_0x7d04('0x4c')]);_0x4aa44c['filters']=_[_0x7d04('0x4f')](_0x4aa44c[_0x7d04('0x4d')],_0x4aa44c[_0x7d04('0x4c')]);_0x4178aa['attributes']=_['intersection'](_0x4aa44c['model'],qs[_0x7d04('0x50')](_0x3fd23c[_0x7d04('0x4c')]['fields']));_0x4178aa[_0x7d04('0x4e')]=_0x4178aa[_0x7d04('0x4e')][_0x7d04('0x51')]?_0x4178aa[_0x7d04('0x4e')]:_0x4aa44c[_0x7d04('0x4d')];if(!_0x3fd23c['query'][_0x7d04('0x52')]('nolimit')){_0x4178aa[_0x7d04('0x21')]=qs['limit'](_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x4178aa[_0x7d04('0x1f')]=qs[_0x7d04('0x1f')](_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x1f')]);}_0x4178aa[_0x7d04('0x53')]=qs[_0x7d04('0x54')](_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x54')]);_0x4178aa[_0x7d04('0x55')]=qs[_0x7d04('0x56')](_['pick'](_0x3fd23c[_0x7d04('0x4c')],_0x4aa44c['filters']));_0x4178aa['where'][_0x7d04('0x69')]=_0x111ec0['id'];if(_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x58')]){_0x4178aa[_0x7d04('0x55')]=_[_0x7d04('0x5a')](_0x4178aa[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x4178aa[_0x7d04('0x4e')],function(_0x483a31){var _0x5d32f5={};_0x5d32f5[_0x483a31]={'$like':'%'+_0x3fd23c['query']['filter']+'%'};return _0x5d32f5;})});}if(_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x9a')]){var _0x3d76ae=_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x9a')]['split'](',');var _0x41d71b={};_0x41d71b[_0x3d76ae[0x0]]={'$gte':moment(_0x3d76ae[0x1])[_0x7d04('0x9b')](_0x7d04('0x9c'))};_0x4178aa[_0x7d04('0x55')]=_[_0x7d04('0x5a')](_0x4178aa['where'],_0x41d71b);}_0x4178aa=_[_0x7d04('0x5a')]({},_0x4178aa,_0x3fd23c[_0x7d04('0x5b')]);return db[_0x7d04('0x9d')][_0x7d04('0x22')]({'where':_0x4178aa[_0x7d04('0x55')]})['then'](function(_0x26babc){_0x18b7b3[_0x7d04('0x22')]=_0x26babc;if(_0x3fd23c[_0x7d04('0x4c')]['includeAll']){_0x4178aa[_0x7d04('0x5e')]=[{'all':!![]}];}return db[_0x7d04('0x9d')]['findAll'](_0x4178aa);})[_0x7d04('0x10')](function(_0x2535c5){if(_0x3fd23c[_0x7d04('0x4c')][_0x7d04('0x9e')]===_0x7d04('0x9f')){for(var _0x500869=0x0;_0x500869<_0x2535c5[_0x7d04('0x51')];_0x500869++){_0x2535c5[_0x500869][_0x7d04('0x64')]=juice(_0x2535c5[_0x500869][_0x7d04('0x64')]);}}_0x18b7b3['rows']=_0x2535c5;return _0x18b7b3;});}})[_0x7d04('0x10')](respondWithFilteredResult(_0x52d163,_0x4178aa))[_0x7d04('0x1a')](handleError(_0x52d163,null));};exports[_0x7d04('0x2a')]=function(_0x5e94d7,_0x3a56e1){var _0x5f0b78,_0x1dbf5f={},_0x460de8;if(_0x5e94d7[_0x7d04('0x64')]['to']){_0x460de8=_0x5e94d7[_0x7d04('0x64')]['to'][_0x7d04('0xa0')](',')[0x0];}return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x5e94d7[_0x7d04('0x61')]['id']},'include':[{'model':db[_0x7d04('0xa1')],'as':_0x7d04('0xa2'),'include':[{'model':db['CmContact'],'as':_0x7d04('0xa3'),'where':{'email':_0x460de8},'limit':0x1,'order':[[_0x7d04('0xa4'),'DESC']]}]},{'model':db[_0x7d04('0x44')],'as':_0x7d04('0x42'),'raw':!![],'include':[{'model':db[_0x7d04('0xa5')],'as':_0x7d04('0xa5'),'raw':!![]}]}]})[_0x7d04('0x10')](handleEntityNotFound(_0x3a56e1,null))[_0x7d04('0x10')](function(_0x236010){if(!_0x236010)return;_0x5f0b78=_0x236010;if(!_0x236010[_0x7d04('0x42')])throw new Error(_0x7d04('0xa6'));if(_['isNil'](_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa7')])){_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa7')]=util['format'](_0x7d04('0xa8'),_0x236010[_0x7d04('0x29')],_0x236010[_0x7d04('0x75')]||_0x236010[_0x7d04('0x42')][_0x7d04('0x36')]);}if(_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa9')]&&_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa9')][_0x7d04('0x51')]){for(var _0x29cc9f=0x0;_0x29cc9f<_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa9')][_0x7d04('0x51')];_0x29cc9f+=0x1){_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa9')][_0x29cc9f]={'filename':_0x5e94d7['body'][_0x7d04('0xa9')][_0x29cc9f][_0x7d04('0x29')],'path':path['join'](config[_0x7d04('0xaa')],_0x7d04('0xab'),_0x5e94d7[_0x7d04('0x64')][_0x7d04('0xa9')][_0x29cc9f]['basename'])};}}var _0x593baa=_0x236010[_0x7d04('0xac')]();return respondWithRpcPromise(_0x7d04('0xad'),_0x7d04('0xae'),{'account':_0x593baa,'message':_0x5e94d7['body']});})[_0x7d04('0x10')](function(_0x4cd2f3){if(!_0x4cd2f3)return;_0x1dbf5f=_0x4cd2f3;if(!_0x5f0b78[_0x7d04('0xa2')])throw new Error(_0x7d04('0xaf'));if(_0x5f0b78[_0x7d04('0xa2')][_0x7d04('0xa3')]['length'])return _0x5f0b78[_0x7d04('0xa2')][_0x7d04('0xa3')][0x0];return db['CmContact']['create'](_['defaults'](_0x5e94d7['body'],{'firstName':_0x5e94d7[_0x7d04('0x64')]['to'],'email':_0x5e94d7[_0x7d04('0x64')]['to'],'phone':_0x5e94d7['body']['to'],'ListId':_0x5f0b78[_0x7d04('0x76')]}));})[_0x7d04('0x10')](function(_0x17ef43){if(!_0x17ef43)return;var _0x4b7d58={'UserId':_0x5e94d7[_0x7d04('0x36')]['id'],'ContactId':_0x17ef43['id'],'MailAccountId':_0x5f0b78['id'],'inReplyTo':_0x1dbf5f['messageId'],'to':_0x5e94d7[_0x7d04('0x64')]['from'],'cc':_0x5e94d7['body']['cc'],'subject':_0x5e94d7[_0x7d04('0x64')]['subject'],'attach':_0x5e94d7[_0x7d04('0x64')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x7d04('0xb0'),'Messages':[_[_0x7d04('0x5a')](_0x5e94d7['body'],{'messageId':_0x1dbf5f[_0x7d04('0xb1')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5f0b78['id'],'UserId':_0x5e94d7[_0x7d04('0x36')]['id'],'ContactId':_0x17ef43['id']})]};if(_0x5e94d7[_0x7d04('0x64')]['Interaction']){_0x4b7d58=_[_0x7d04('0x5a')](_0x4b7d58,_0x5e94d7['body']['Interaction']);}return db['MailInteraction'][_0x7d04('0x6b')](_0x4b7d58,{'include':[{'model':db[_0x7d04('0x9d')],'as':'Messages'}]});})[_0x7d04('0x10')](respondWithResult(_0x3a56e1,null))[_0x7d04('0x1a')](handleError(_0x3a56e1,null));};exports['verifySmtp']=function(_0x28d26a,_0x308453){return db['MailAccount']['find']({'where':{'id':_0x28d26a[_0x7d04('0x61')]['id']},'include':[{'model':db[_0x7d04('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7d04('0xa5')],'as':_0x7d04('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x308453,null))['then'](function(_0x35aab1){if(!_0x35aab1[_0x7d04('0x42')])return;var _0x1fdd72=_0x35aab1['getSmtpOptions']();return respondWithRpcPromise(_0x7d04('0xb2'),_0x7d04('0xb3'),{'account':_0x1fdd72});})['then'](respondWithResult(_0x308453,null))[_0x7d04('0x1a')](handleError(_0x308453,null));};exports[_0x7d04('0x27')]=function(_0x4d2111,_0x1b1bf0){return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x4d2111[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x1b1bf0,null))[_0x7d04('0x10')](function(_0x1f9ce8){if(_0x1f9ce8&&_0x1f9ce8[_0x7d04('0x3e')]){throw new db['Sequelize'][(_0x7d04('0xb4'))](_0x7d04('0xb5'));}return _0x1f9ce8;})[_0x7d04('0x10')](removeEntity(_0x1b1bf0,null))[_0x7d04('0x1a')](handleError(_0x1b1bf0,null));};exports['addAgents']=function(_0x6e7f77,_0x5025f0){return db[_0x7d04('0x5c')][_0x7d04('0x62')]({'where':{'id':_0x6e7f77[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x5025f0,null))[_0x7d04('0x10')](function(_0x31d3d8){if(_0x31d3d8){return _0x31d3d8['addAgents'](_0x6e7f77[_0x7d04('0x64')][_0x7d04('0x70')],_['omit'](_0x6e7f77[_0x7d04('0x64')],['ids','id'])||{})[_0x7d04('0xb6')](function(_0x13cf2d){for(var _0x1d5644=0x0;_0x1d5644<_0x6e7f77['body'][_0x7d04('0x70')]['length'];_0x1d5644+=0x1){socket[_0x7d04('0xb7')](_0x7d04('0xb8'),{'UserId':Number(_0x6e7f77[_0x7d04('0x64')][_0x7d04('0x70')][_0x1d5644]),'MailAccountId':Number(_0x6e7f77[_0x7d04('0x61')]['id'])});}return _0x13cf2d;});}})[_0x7d04('0x10')](respondWithResult(_0x5025f0,null))[_0x7d04('0x1a')](handleError(_0x5025f0,null));};exports[_0x7d04('0xb9')]=function(_0x543619,_0x2f1042){return db['MailAccount'][_0x7d04('0x62')]({'where':{'id':_0x543619[_0x7d04('0x61')]['id']}})[_0x7d04('0x10')](handleEntityNotFound(_0x2f1042,null))[_0x7d04('0x10')](function(_0x59876d){if(_0x59876d){return _0x59876d[_0x7d04('0xb9')](_0x543619[_0x7d04('0x4c')][_0x7d04('0x70')])[_0x7d04('0x10')](function(){if(_[_0x7d04('0xba')](_0x543619[_0x7d04('0x4c')][_0x7d04('0x70')])){for(var _0x1ce319=0x0;_0x1ce319<_0x543619['query']['ids'][_0x7d04('0x51')];_0x1ce319+=0x1){socket[_0x7d04('0xb7')](_0x7d04('0xbb'),{'UserId':Number(_0x543619[_0x7d04('0x4c')][_0x7d04('0x70')][_0x1ce319]),'MailAccountId':Number(_0x543619['params']['id'])});}}else{socket['emit'](_0x7d04('0xbb'),{'UserId':Number(_0x543619[_0x7d04('0x4c')][_0x7d04('0x70')]),'MailAccountId':Number(_0x543619[_0x7d04('0x61')]['id'])});}});}})[_0x7d04('0x10')](respondWithStatusCode(_0x2f1042,null))[_0x7d04('0x1a')](handleError(_0x2f1042,null));};exports[_0x7d04('0xbc')]=function(_0x146cbf,_0x39508d){var _0x27e15e={};var _0x5ad5a3={};var _0x351446;var _0x44caf1;return db[_0x7d04('0x5c')][_0x7d04('0x6c')]({'where':{'id':_0x146cbf[_0x7d04('0x61')]['id']}})['then'](handleEntityNotFound(_0x39508d,null))[_0x7d04('0x10')](function(_0x46043c){if(_0x46043c){_0x351446=_0x46043c;_0x5ad5a3[_0x7d04('0x4d')]=_['keys'](db[_0x7d04('0x8b')]['rawAttributes']);_0x5ad5a3[_0x7d04('0x4c')]=_[_0x7d04('0x4b')](_0x146cbf[_0x7d04('0x4c')]);_0x5ad5a3[_0x7d04('0x56')]=_[_0x7d04('0x4f')](_0x5ad5a3[_0x7d04('0x4d')],_0x5ad5a3['query']);_0x27e15e[_0x7d04('0x4e')]=_['intersection'](_0x5ad5a3[_0x7d04('0x4d')],qs[_0x7d04('0x50')](_0x146cbf[_0x7d04('0x4c')][_0x7d04('0x50')]));_0x27e15e[_0x7d04('0x4e')]=_0x27e15e['attributes']['length']?_0x27e15e['attributes']:_0x5ad5a3[_0x7d04('0x4d')];_0x27e15e['order']=qs['sort'](_0x146cbf['query'][_0x7d04('0x54')]);_0x27e15e[_0x7d04('0x55')]=qs[_0x7d04('0x56')](_['pick'](_0x146cbf['query'],_0x5ad5a3['filters']));if(_0x146cbf[_0x7d04('0x4c')][_0x7d04('0x58')]){_0x27e15e[_0x7d04('0x55')]=_['merge'](_0x27e15e[_0x7d04('0x55')],{'$or':_[_0x7d04('0x4a')](_0x27e15e[_0x7d04('0x4e')],function(_0x5f19c3){var _0x2aada1={};_0x2aada1[_0x5f19c3]={'$like':'%'+_0x146cbf[_0x7d04('0x4c')][_0x7d04('0x58')]+'%'};return _0x2aada1;})});}_0x27e15e=_[_0x7d04('0x5a')]({},_0x27e15e,_0x146cbf['options']);return _0x351446[_0x7d04('0xbc')](_0x27e15e);}})[_0x7d04('0x10')](function(_0x11b1a9){if(_0x11b1a9){_0x44caf1=_0x11b1a9[_0x7d04('0x51')];if(!_0x146cbf[_0x7d04('0x4c')]['hasOwnProperty']('nolimit')){_0x27e15e[_0x7d04('0x21')]=qs['limit'](_0x146cbf[_0x7d04('0x4c')][_0x7d04('0x21')]);_0x27e15e[_0x7d04('0x1f')]=qs['offset'](_0x146cbf[_0x7d04('0x4c')][_0x7d04('0x1f')]);}return _0x351446[_0x7d04('0xbc')](_0x27e15e);}})[_0x7d04('0x10')](function(_0x4fa18c){if(_0x4fa18c){return _0x4fa18c?{'count':_0x44caf1,'rows':_0x4fa18c}:null;}})[_0x7d04('0x10')](respondWithResult(_0x39508d,null))[_0x7d04('0x1a')](handleError(_0x39508d,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6bfe508..99b0ce4 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 _0x9e54=['update','remove','emit','exports','events','../../mysqldb'];(function(_0x45d3c6,_0x738147){var _0x3d3ae5=function(_0xdb4aa3){while(--_0xdb4aa3){_0x45d3c6['push'](_0x45d3c6['shift']());}};_0x3d3ae5(++_0x738147);}(_0x9e54,0x88));var _0x49e5=function(_0x64a811,_0x4887b7){_0x64a811=_0x64a811-0x0;var _0x3d8099=_0x9e54[_0x64a811];return _0x3d8099;};'use strict';var EventEmitter=require(_0x49e5('0x0'));var MailAccount=require(_0x49e5('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49e5('0x2'),'afterDestroy':_0x49e5('0x3')};function emitEvent(_0x36eeb6){return function(_0x5cd518,_0x377300,_0x31b5c4){MailAccountEvents['emit'](_0x36eeb6+':'+_0x5cd518['id'],_0x5cd518);MailAccountEvents[_0x49e5('0x4')](_0x36eeb6,_0x5cd518);_0x31b5c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x49e5('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x39bd=['update','remove','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x39bd,0x7c));var _0xd39b=function(_0x2288a9,_0x4068ce){_0x2288a9=_0x2288a9-0x0;var _0x37de0a=_0x39bd[_0x2288a9];return _0x37de0a;};'use strict';var EventEmitter=require(_0xd39b('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd39b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd39b('0x2'),'afterDestroy':_0xd39b('0x3')};function emitEvent(_0x268902){return function(_0x730a92,_0x447e37,_0x51610f){MailAccountEvents['emit'](_0x268902+':'+_0x730a92['id'],_0x730a92);MailAccountEvents['emit'](_0x268902,_0x730a92);_0x51610f(null);};}for(var e in events){if(events[_0xd39b('0x4')](e)){var event=events[e];MailAccount[_0xd39b('0x5')](e,emitEvent(event));}}module[_0xd39b('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d759fd1..a07a236 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 _0xa349=['./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','pass'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa349,0x1db));var _0x9a34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa349[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x9a34('0x0'));module[_0x9a34('0x1')]=function(_0x4e41ff){return _0x4e41ff['define'](_0x9a34('0x2'),attributes,{'tableName':_0x9a34('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3a7eb0=this;var _0x4638af={'id':_0x3a7eb0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3a7eb0[_0x9a34('0x4')]!==_0x9a34('0x5')){_0x4638af[_0x9a34('0x6')]=_0x3a7eb0[_0x9a34('0x4')];}else{_0x4638af['host']=_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0x8')];_0x4638af['port']=_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0x9')];_0x4638af['secure']=_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0xa')];}if(_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0xb')]){if(_0x3a7eb0['Smtp'][_0x9a34('0xc')]){if(!_0x3a7eb0['Smtp'][_0x9a34('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4638af[_0x9a34('0xe')]={'type':_0x9a34('0xf'),'user':_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0x10')],'accessToken':_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0xd')][_0x9a34('0x11')]};}else{_0x4638af[_0x9a34('0xe')]={'user':_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0x10')],'pass':_0x3a7eb0[_0x9a34('0x7')][_0x9a34('0x12')]};}}return _0x4638af;}}});}; \ No newline at end of file +var _0x79fb=['port','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','service','provider','host','Smtp'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x79fb,0x12a));var _0xb79f=function(_0x5aa019,_0x3c3770){_0x5aa019=_0x5aa019-0x0;var _0xcf4280=_0x79fb[_0x5aa019];return _0xcf4280;};'use strict';var attributes=require(_0xb79f('0x0'));module['exports']=function(_0x30f2ac){return _0x30f2ac[_0xb79f('0x1')](_0xb79f('0x2'),attributes,{'tableName':_0xb79f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x340e89=this;var _0x467f5c={'id':_0x340e89['id'],'tls':{'rejectUnauthorized':![]}};if(_0x340e89['provider']!=='custom'){_0x467f5c[_0xb79f('0x4')]=_0x340e89[_0xb79f('0x5')];}else{_0x467f5c[_0xb79f('0x6')]=_0x340e89[_0xb79f('0x7')][_0xb79f('0x6')];_0x467f5c[_0xb79f('0x8')]=_0x340e89['Smtp'][_0xb79f('0x8')];_0x467f5c[_0xb79f('0x9')]=_0x340e89['Smtp'][_0xb79f('0x9')];}if(_0x340e89[_0xb79f('0x7')]['authentication']){if(_0x340e89['Smtp'][_0xb79f('0xa')]){if(!_0x340e89[_0xb79f('0x7')]['CloudProvider'])throw new Error(_0xb79f('0xb'));_0x467f5c[_0xb79f('0xc')]={'type':_0xb79f('0xd'),'user':_0x340e89[_0xb79f('0x7')][_0xb79f('0xe')],'accessToken':_0x340e89[_0xb79f('0x7')][_0xb79f('0xf')][_0xb79f('0x10')]};}else{_0x467f5c[_0xb79f('0xc')]={'user':_0x340e89['Smtp'][_0xb79f('0xe')],'pass':_0x340e89[_0xb79f('0x7')][_0xb79f('0x11')]};}}return _0x467f5c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ce969ae..71d5a27 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 _0x66fa=['ShowMailAccount','smtp','getSmtpOptions','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','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','find','account','CmList','Contacts','Applications','MailServerOut','Smtp','List','get','omit','smtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch'];(function(_0x4c8bf8,_0x34e122){var _0x3f1056=function(_0x5149cf){while(--_0x5149cf){_0x4c8bf8['push'](_0x4c8bf8['shift']());}};_0x3f1056(++_0x34e122);}(_0x66fa,0x117));var _0xa66f=function(_0x460157,_0x5fb1ec){_0x460157=_0x460157-0x0;var _0x4934e8=_0x66fa[_0x460157];return _0x4934e8;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var logger=require(_0xa66f('0x5'))(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var jayson=require(_0xa66f('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0xa66f('0x9')]=_[_0xa66f('0xa')](config[_0xa66f('0x9')],{'host':_0xa66f('0xb'),'port':0x18eb});var socket=require(_0xa66f('0xc'))(new Redis(config['redis']));require(_0xa66f('0xd'))['register'](socket);function respondWithRpcPromise(_0x46c788,_0x597c7c,_0x101e10){return new BPromise(function(_0x53ca76,_0x52d802){return client['request'](_0x46c788,_0x101e10)[_0xa66f('0xe')](function(_0x825868){logger['info'](_0xa66f('0xf'),_0x597c7c,'request\x20sent');logger[_0xa66f('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x597c7c,_0xa66f('0x11'),JSON[_0xa66f('0x12')](_0x825868));if(_0x825868[_0xa66f('0x13')]){if(_0x825868['error']['code']===0x1f4){logger[_0xa66f('0x13')]('MailAccount,\x20%s,\x20%s',_0x597c7c,_0x825868['error']['message']);return _0x52d802(_0x825868[_0xa66f('0x13')][_0xa66f('0x14')]);}logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x825868[_0xa66f('0x13')]['message']);return _0x53ca76(_0x825868['error'][_0xa66f('0x14')]);}else{logger[_0xa66f('0x15')](_0xa66f('0xf'),_0x597c7c,_0xa66f('0x11'));_0x53ca76(_0x825868['result'][_0xa66f('0x14')]);}})['catch'](function(_0x4a28d4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x4a28d4);_0x52d802(_0x4a28d4);});});}exports[_0xa66f('0x16')]=function(_0x355ddc){var _0x2c5b76=this;return new Promise(function(_0x408bc7,_0x251f60){return db[_0xa66f('0x17')][_0xa66f('0x18')]({'raw':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x355ddc['options']?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'limit':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')]['limit']||null:null,'include':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x355ddc['options']['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x1c')],'include':_0xed98b9[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1f')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x1c')],'include':_0x4683c7[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x4683c7[_0xa66f('0x1d')],function(_0x1eb86a){return{'model':db[_0x1eb86a[_0xa66f('0x1f')]],'as':_0x1eb86a['as'],'attributes':_0x1eb86a[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xe')](function(_0x45f71c){logger[_0xa66f('0x15')](_0xa66f('0x16'),_0x355ddc);logger[_0xa66f('0x10')]('GetMailAccount',_0x355ddc,JSON['stringify'](_0x45f71c));_0x408bc7(_0x45f71c);})[_0xa66f('0x20')](function(_0x27ceae){logger['error'](_0xa66f('0x16'),_0x27ceae[_0xa66f('0x14')],_0x355ddc);_0x251f60(_0x2c5b76['error'](0x1f4,_0x27ceae[_0xa66f('0x14')]));});});};exports[_0xa66f('0x21')]=function(_0x9d78d5){var _0x2c2ace=this;return new Promise(function(_0x395623,_0x548add){return db[_0xa66f('0x17')]['find']({'raw':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'include':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1f')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1d')]?_['map'](_0x35ef27[_0xa66f('0x1d')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1f')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x1c')],'include':_0x46f6cc[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x46f6cc[_0xa66f('0x1d')],function(_0xcee582){return{'model':db[_0xcee582['model']],'as':_0xcee582['as'],'attributes':_0xcee582[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4477cf){if(_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x22')]===!![])_0x4477cf['setDataValue']('smtpOptions',_0x4477cf[_0xa66f('0x23')]());logger[_0xa66f('0x15')](_0xa66f('0x21'),_0x9d78d5);logger[_0xa66f('0x10')](_0xa66f('0x21'),_0x9d78d5,JSON['stringify'](_0x4477cf));_0x395623(_0x4477cf);})['catch'](function(_0x49b869){logger[_0xa66f('0x13')]('ShowMailAccount',_0x49b869['message'],_0x9d78d5);_0x548add(_0x2c2ace['error'](0x1f4,_0x49b869[_0xa66f('0x14')]));});});};exports['NotifyMailAccount']=function(_0x8965d3){var _0x17d942=this;return new Promise(function(_0x23a546,_0x1647a0){var _0xd65c5d={'body':_0x8965d3[_0xa66f('0x24')],'channel':_0xa66f('0x25')};var _0x261089=_[_0xa66f('0x26')](_[_0xa66f('0x27')](db[_0xa66f('0x28')][_0xa66f('0x29')]),[_0xa66f('0x2a'),_0xa66f('0x2b'),'CompanyId',_0xa66f('0x2c')]);var _0x25c2cb=![];if(_0x8965d3['body']['id']){delete _0x8965d3[_0xa66f('0x24')]['id'];}if(_['isNil'](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')])){return _0x1647a0(_0x17d942['error'](0x1f4,_0xa66f('0x2e')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')]['body'])||_0x8965d3[_0xa66f('0x24')]['body']===''){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x30')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x32')+_0x261089));}if(!_['includes'](_0x261089,_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x33')+_0x261089));}var _0x374e53={};_0x374e53[_0x8965d3['body']['mapKey']]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x17')][_0xa66f('0x34')]({'where':{'id':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x36')],'as':'List','include':[{'model':db[_0xa66f('0x28')],'as':_0xa66f('0x37'),'where':_0x374e53,'limit':0x1,'order':[[_0xa66f('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xa66f('0x38')},{'model':db[_0xa66f('0x39')],'as':_0xa66f('0x3a'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x19e7ce){if(_0x19e7ce&&_0x19e7ce[_0xa66f('0x3b')]){var _0x40d3b6=_0x19e7ce[_0xa66f('0x3c')]({'plain':!![]});_0xd65c5d[_0xa66f('0x35')]=_[_0xa66f('0x3d')](_0x40d3b6,[_0xa66f('0x38'),_0xa66f('0x3b')]);_0xd65c5d['account'][_0xa66f('0x3e')]=_0x19e7ce[_0xa66f('0x23')]();_0xd65c5d[_0xa66f('0x3f')]=_0x40d3b6[_0xa66f('0x38')];_0xd65c5d[_0xa66f('0x40')]=_0x40d3b6[_0xa66f('0x3b')];_0xd65c5d['applications']=_[_0xa66f('0x41')](_0xd65c5d[_0xa66f('0x3f')],[_0xa66f('0x42')],[_0xa66f('0x43')]);if(_0xd65c5d[_0xa66f('0x35')]&&_0xd65c5d['account'][_0xa66f('0x44')]){_0xd65c5d['applications'][_0xa66f('0x45')]({'id':0x0,'priority':_0xd65c5d['applications']['length']+0x1,'app':_0xa66f('0x46'),'appdata':_0xa66f('0x44'),'interval':_0xa66f('0x47')});}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x38')]){delete _0xd65c5d[_0xa66f('0x35')]['Applications'];}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')]){delete _0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')];}if(_0x40d3b6['List'][_0xa66f('0x37')]['length']){return _0x40d3b6[_0xa66f('0x3b')][_0xa66f('0x37')][0x0];}var _0x21482f=_[_0xa66f('0xa')](_0x8965d3[_0xa66f('0x24')],{'firstName':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')],'ListId':_0x40d3b6['ListId']});_0x21482f[_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')]]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x28')][_0xa66f('0x48')](_0x21482f);}else{throw new Error(_0xa66f('0x49'));}})[_0xa66f('0xe')](function(_0x350fce){_0xd65c5d['contact']=_0x350fce;if(_0x350fce){if(!_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')]){_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')]=rs[_0xa66f('0x4b')]()+'\x20'+_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x2d')];}var _0x11c89e={'ContactId':_0x350fce['id'],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'inReplyTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x4a')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3['body']['message'][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['attach'],'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'};return db[_0xa66f('0x4f')][_0xa66f('0x34')]({'where':{'closed':![],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x50')],'as':_0xa66f('0x51'),'attributes':[_0xa66f('0x4a')],'where':{'messageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x52')]}}]})[_0xa66f('0xe')](function(_0x235e4f){if(_0x235e4f){return[_0x235e4f,![]];}return db[_0xa66f('0x4f')][_0xa66f('0x48')](_0x11c89e)[_0xa66f('0xe')](function(_0x41ffa7){return[_0x41ffa7,!![]];});});}else{throw new Error(_0xa66f('0x53'));}})['spread'](function(_0x52f22d,_0x46327d){if(_0x52f22d){_0x25c2cb=_0x46327d;if(!_0x46327d){return _0x52f22d[_0xa66f('0x54')]({'inReplyTo':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')],'to':_0x8965d3['body'][_0xa66f('0x14')]['from'],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['subject'],'attach':_0x52f22d[_0xa66f('0x55')]?_0x52f22d[_0xa66f('0x55')]:_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x55')],'substatus':null,'substatusAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'});}else{return _0x52f22d;}}})[_0xa66f('0xe')](function(_0x290323){_0xd65c5d[_0xa66f('0x56')]=_0x290323['get']({'plain':!![]});_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x57')]=_0x25c2cb;return db[_0xa66f('0x50')][_0xa66f('0x48')]({'body':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x24')],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'MailInteractionId':_0x290323['id'],'direction':'in','ContactId':_0xd65c5d[_0xa66f('0x58')]['id'],'messageId':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')],'from':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['to'],'cc':_0x8965d3[_0xa66f('0x24')]['message']['cc'],'subject':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')]['message']['attach'],'Attachments':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x59')],'originTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5a')],'originCc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5b')],'bcc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5c')],'ChatWebsiteId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5d')]||null,'originChannel':_0x8965d3[_0xa66f('0x24')]['message']['originChannel']||_0xa66f('0x5e'),'ChatOfflineMessageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xa66f('0x60')}]});})['then'](function(_0x4feda0){_0xd65c5d['message']=_0x4feda0;if(_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]){return db[_0xa66f('0x62')][_0xa66f('0x34')]({'attributes':['id',_0xa66f('0x63')],'where':{'id':_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]}})[_0xa66f('0xe')](function(_0x1ee6e0){if(_0x1ee6e0){_0xd65c5d[_0xa66f('0x3f')][_0xa66f('0x64')]({'id':0x0,'priority':0x0,'app':_0xa66f('0x65'),'appdata':_0x1ee6e0[_0xa66f('0x63')]+','+(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x66')]||0xa),'interval':_0xa66f('0x47')});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);})['then'](function(_0xc4b32b){_0x23a546(_0xc4b32b);})[_0xa66f('0x20')](function(_0x2bb4e5){_0x1647a0(_0x17d942['error'](0x1f4,_0x2bb4e5['message']));});});}; \ No newline at end of file +var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x50dde9,_0x4ff453){var _0x1170bf=function(_0x2c97a9){while(--_0x2c97a9){_0x50dde9['push'](_0x50dde9['shift']());}};_0x1170bf(++_0x4ff453);}(_0x2ef3,0xba));var _0x32ef=function(_0x196e0a,_0x37a47c){_0x196e0a=_0x196e0a-0x0;var _0x538d50=_0x2ef3[_0x196e0a];return _0x538d50;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 169ea76..5e1de22 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 _0x81fa=['removeListener','register','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x2cbae9,_0x3b70c1){var _0x4bbf35=function(_0x3f2004){while(--_0x3f2004){_0x2cbae9['push'](_0x2cbae9['shift']());}};_0x4bbf35(++_0x3b70c1);}(_0x81fa,0xdd));var _0xa81f=function(_0x202438,_0x21f696){_0x202438=_0x202438-0x0;var _0x43a7f1=_0x81fa[_0x202438];return _0x43a7f1;};'use strict';var MailAccountEvents=require(_0xa81f('0x0'));var events=[_0xa81f('0x1'),'remove',_0xa81f('0x2')];function createListener(_0x3ec545,_0x3b20d4){return function(_0x189ff9){_0x3b20d4['emit'](_0x3ec545,_0x189ff9);};}function removeListener(_0x1c7d2f,_0x202dbf){return function(){MailAccountEvents[_0xa81f('0x3')](_0x1c7d2f,_0x202dbf);};}exports[_0xa81f('0x4')]=function(_0x1dc233){for(var _0x158719=0x0,_0x3ceca1=events[_0xa81f('0x5')];_0x158719<_0x3ceca1;_0x158719++){var _0x1f3876=events[_0x158719];var _0x3447bb=createListener(_0xa81f('0x6')+_0x1f3876,_0x1dc233);MailAccountEvents['on'](_0x1f3876,_0x3447bb);}}; \ No newline at end of file +var _0x8c2e=['length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x9a9422,_0x361813){var _0x5699ca=function(_0x2d933f){while(--_0x2d933f){_0x9a9422['push'](_0x9a9422['shift']());}};_0x5699ca(++_0x361813);}(_0x8c2e,0xec));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xe8c2('0x0'));var events=['save',_0xe8c2('0x1'),_0xe8c2('0x2')];function createListener(_0x508bb1,_0x207947){return function(_0x259d3f){_0x207947[_0xe8c2('0x3')](_0x508bb1,_0x259d3f);};}function removeListener(_0x1603a7,_0x14de48){return function(){MailAccountEvents['removeListener'](_0x1603a7,_0x14de48);};}exports['register']=function(_0x2762cc){for(var _0x9041b=0x0,_0x49f3ac=events[_0xe8c2('0x4')];_0x9041b<_0x49f3ac;_0x9041b++){var _0x4b3318=events[_0x9041b];var _0x3f191a=createListener(_0xe8c2('0x5')+_0x4b3318,_0x2762cc);MailAccountEvents['on'](_0x4b3318,_0x3f191a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index b179c7d..a857519 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 _0x544d=['../../config/environment','get','isAuthenticated','show','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5390a3,_0x4d60f7){var _0x45d220=function(_0x47904f){while(--_0x47904f){_0x5390a3['push'](_0x5390a3['shift']());}};_0x45d220(++_0x4d60f7);}(_0x544d,0xda));var _0xd544=function(_0x405092,_0x2f367b){_0x405092=_0x405092-0x0;var _0x285b03=_0x544d[_0x405092];return _0x285b03;};'use strict';var multer=require(_0xd544('0x0'));var util=require(_0xd544('0x1'));var path=require(_0xd544('0x2'));var timeout=require(_0xd544('0x3'));var express=require(_0xd544('0x4'));var router=express[_0xd544('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd544('0x6'));var controller=require('./mailApplication.controller');router[_0xd544('0x7')]('/:id',auth[_0xd544('0x8')](),controller[_0xd544('0x9')]);router['put'](_0xd544('0xa'),auth['isAuthenticated'](),controller[_0xd544('0xb')]);router[_0xd544('0xc')](_0xd544('0xa'),auth['isAuthenticated'](),controller[_0xd544('0xd')]);module['exports']=router; \ No newline at end of file +var _0x686d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','update','exports','util','path','connect-timeout','express'];(function(_0x32e2eb,_0x2f94ad){var _0x56dae2=function(_0x3b0030){while(--_0x3b0030){_0x32e2eb['push'](_0x32e2eb['shift']());}};_0x56dae2(++_0x2f94ad);}(_0x686d,0x9c));var _0xd686=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x686d[_0x4629ed];return _0x52ca04;};'use strict';var multer=require('multer');var util=require(_0xd686('0x0'));var path=require(_0xd686('0x1'));var timeout=require(_0xd686('0x2'));var express=require(_0xd686('0x3'));var router=express[_0xd686('0x4')]();var fs_extra=require(_0xd686('0x5'));var auth=require(_0xd686('0x6'));var interaction=require(_0xd686('0x7'));var config=require(_0xd686('0x8'));var controller=require(_0xd686('0x9'));router[_0xd686('0xa')]('/:id',auth[_0xd686('0xb')](),controller[_0xd686('0xc')]);router['put'](_0xd686('0xd'),auth[_0xd686('0xb')](),controller[_0xd686('0xe')]);router['delete']('/:id',auth[_0xd686('0xb')](),controller['destroy']);module[_0xd686('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a0ba783..8cc309d 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 _0x6f5a=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2b5c60,_0xddad37){var _0x40ef50=function(_0x103b03){while(--_0x103b03){_0x2b5c60['push'](_0x2b5c60['shift']());}};_0x40ef50(++_0xddad37);}(_0x6f5a,0x17e));var _0xa6f5=function(_0x44246a,_0x444c44){_0x44246a=_0x44246a-0x0;var _0x3647c1=_0x6f5a[_0x44246a];return _0x3647c1;};'use strict';var Sequelize=require(_0xa6f5('0x0'));module[_0xa6f5('0x1')]={'priority':{'type':Sequelize[_0xa6f5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa6f5('0x3')],'allowNull':![],'defaultValue':_0xa6f5('0x4')},'appdata':{'type':Sequelize[_0xa6f5('0x5')]()},'description':{'type':Sequelize[_0xa6f5('0x3')]},'interval':{'type':Sequelize[_0xa6f5('0x3')],'defaultValue':_0xa6f5('0x6')}}; \ No newline at end of file +var _0xec5b=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0xec5b,0xb0));var _0xbec5=function(_0xb1533a,_0xf92626){_0xb1533a=_0xb1533a-0x0;var _0xb0a6fd=_0xec5b[_0xb1533a];return _0xb0a6fd;};'use strict';var Sequelize=require(_0xbec5('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbec5('0x1')],'allowNull':![],'defaultValue':_0xbec5('0x2')},'appdata':{'type':Sequelize[_0xbec5('0x3')]()},'description':{'type':Sequelize[_0xbec5('0x1')]},'interval':{'type':Sequelize[_0xbec5('0x1')],'defaultValue':_0xbec5('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index bad4368..1fbef2e 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x232d36,_0x208d09){var _0x68b422=function(_0xe0e0b1){while(--_0xe0e0b1){_0x232d36['push'](_0x232d36['shift']());}};_0x68b422(++_0x208d09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x47afba,_0x290a9d){_0x47afba=_0x47afba-0x0;var _0x55d7b4=_0xbdb7[_0x47afba];return _0x55d7b4;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 143df43..024ad07 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 _0x722f=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x54301f,_0x1843a8){var _0x281d66=function(_0x4b3336){while(--_0x4b3336){_0x54301f['push'](_0x54301f['shift']());}};_0x281d66(++_0x1843a8);}(_0x722f,0x8e));var _0xf722=function(_0x595bc3,_0x273e95){_0x595bc3=_0x595bc3-0x0;var _0x2a723d=_0x722f[_0x595bc3];return _0x2a723d;};'use strict';var _=require(_0xf722('0x0'));var util=require(_0xf722('0x1'));var logger=require(_0xf722('0x2'))(_0xf722('0x3'));var moment=require(_0xf722('0x4'));var BPromise=require(_0xf722('0x5'));var rp=require(_0xf722('0x6'));var fs=require('fs');var path=require(_0xf722('0x7'));var rimraf=require('rimraf');var config=require(_0xf722('0x8'));var attributes=require(_0xf722('0x9'));module[_0xf722('0xa')]=function(_0x531e43,_0x562f27){return _0x531e43[_0xf722('0xb')](_0xf722('0xc'),attributes,{'tableName':_0xf722('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf722('0xe')});}; \ No newline at end of file +var _0xd460=['../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2cb13b,_0xbc029d){var _0x1d4c50=function(_0x2718b8){while(--_0x2718b8){_0x2cb13b['push'](_0x2cb13b['shift']());}};_0x1d4c50(++_0xbc029d);}(_0xd460,0x19d));var _0x0d46=function(_0x41f34a,_0x1fbbd6){_0x41f34a=_0x41f34a-0x0;var _0xf0d359=_0xd460[_0x41f34a];return _0xf0d359;};'use strict';var _=require(_0x0d46('0x0'));var util=require('util');var logger=require(_0x0d46('0x1'))(_0x0d46('0x2'));var moment=require(_0x0d46('0x3'));var BPromise=require(_0x0d46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d46('0x5'));var rimraf=require(_0x0d46('0x6'));var config=require(_0x0d46('0x7'));var attributes=require(_0x0d46('0x8'));module[_0x0d46('0x9')]=function(_0x30942e,_0x41b5fe){return _0x30942e['define'](_0x0d46('0xa'),attributes,{'tableName':_0x0d46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d46('0xc'),'collate':_0x0d46('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 33115a9..3690b5a 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 _0x2171=['code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0x2171,0x15c));var _0x1217=function(_0x10d44a,_0x4a421a){_0x10d44a=_0x10d44a-0x0;var _0x199e2b=_0x2171[_0x10d44a];return _0x199e2b;};'use strict';var _=require(_0x1217('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1217('0x1'));var rs=require(_0x1217('0x2'));var fs=require('fs');var Redis=require(_0x1217('0x3'));var db=require(_0x1217('0x4'))['db'];var utils=require(_0x1217('0x5'));var logger=require('../../config/logger')(_0x1217('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1217('0x7')][_0x1217('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26f219,_0x116e86,_0x577f05){return new BPromise(function(_0x45164a,_0x44b6e2){return client['request'](_0x26f219,_0x577f05)[_0x1217('0x9')](function(_0x23a9f8){logger[_0x1217('0xa')](_0x1217('0xb'),_0x116e86,_0x1217('0xc'));logger['debug'](_0x1217('0xd'),_0x116e86,_0x1217('0xc'),JSON[_0x1217('0xe')](_0x23a9f8));if(_0x23a9f8[_0x1217('0xf')]){if(_0x23a9f8[_0x1217('0xf')][_0x1217('0x10')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x116e86,_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);return _0x44b6e2(_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);}logger['error'](_0x1217('0xb'),_0x116e86,_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);return _0x45164a(_0x23a9f8[_0x1217('0xf')][_0x1217('0x11')]);}else{logger[_0x1217('0xa')](_0x1217('0xb'),_0x116e86,_0x1217('0xc'));_0x45164a(_0x23a9f8[_0x1217('0x12')][_0x1217('0x11')]);}})[_0x1217('0x13')](function(_0x52d47e){logger['error']('MailApplication,\x20%s,\x20%s',_0x116e86,_0x52d47e);_0x44b6e2(_0x52d47e);});});}exports[_0x1217('0x14')]=function(_0x43e104){var _0x56ba6f=this;return new Promise(function(_0x30eb36,_0x2dfd34){return db['MailApplication'][_0x1217('0x15')](_0x43e104['body'],{'raw':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')][_0x1217('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')]['where']||null:null,'attributes':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')][_0x1217('0x18')]||null:null,'limit':_0x43e104[_0x1217('0x16')]?_0x43e104[_0x1217('0x16')][_0x1217('0x19')]||null:null})[_0x1217('0x9')](function(_0x48d010){logger[_0x1217('0xa')](_0x1217('0x14'),_0x43e104);logger['debug']('UpdateMailApplication',_0x43e104,JSON['stringify'](_0x48d010));_0x30eb36(_0x48d010);})['catch'](function(_0x497174){logger[_0x1217('0xf')](_0x1217('0x14'),_0x497174[_0x1217('0x11')],_0x43e104);_0x2dfd34(_0x56ba6f[_0x1217('0xf')](0x1f4,_0x497174[_0x1217('0x11')]));});});}; \ No newline at end of file +var _0x7215=['jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x47ead0,_0x1b57c5){var _0x14f87a=function(_0x5a6c19){while(--_0x5a6c19){_0x47ead0['push'](_0x47ead0['shift']());}};_0x14f87a(++_0x1b57c5);}(_0x7215,0x1d7));var _0x5721=function(_0x558797,_0x387f41){_0x558797=_0x558797-0x0;var _0x29ac55=_0x7215[_0x558797];return _0x29ac55;};'use strict';var _=require(_0x5721('0x0'));var util=require(_0x5721('0x1'));var moment=require(_0x5721('0x2'));var BPromise=require(_0x5721('0x3'));var rs=require(_0x5721('0x4'));var fs=require('fs');var Redis=require(_0x5721('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5721('0x6'));var logger=require(_0x5721('0x7'))(_0x5721('0x8'));var config=require('../../config/environment');var jayson=require(_0x5721('0x9'));var client=jayson[_0x5721('0xa')][_0x5721('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf9d6a1,_0x44a6c7,_0x35cb66){return new BPromise(function(_0x131533,_0x452a8e){return client[_0x5721('0xc')](_0xf9d6a1,_0x35cb66)[_0x5721('0xd')](function(_0x1fe4d1){logger['info'](_0x5721('0xe'),_0x44a6c7,_0x5721('0xf'));logger[_0x5721('0x10')](_0x5721('0x11'),_0x44a6c7,'request\x20sent',JSON['stringify'](_0x1fe4d1));if(_0x1fe4d1[_0x5721('0x12')]){if(_0x1fe4d1[_0x5721('0x12')][_0x5721('0x13')]===0x1f4){logger[_0x5721('0x12')](_0x5721('0xe'),_0x44a6c7,_0x1fe4d1[_0x5721('0x12')][_0x5721('0x14')]);return _0x452a8e(_0x1fe4d1[_0x5721('0x12')]['message']);}logger[_0x5721('0x12')]('MailApplication,\x20%s,\x20%s',_0x44a6c7,_0x1fe4d1[_0x5721('0x12')][_0x5721('0x14')]);return _0x131533(_0x1fe4d1[_0x5721('0x12')][_0x5721('0x14')]);}else{logger['info'](_0x5721('0xe'),_0x44a6c7,_0x5721('0xf'));_0x131533(_0x1fe4d1[_0x5721('0x15')][_0x5721('0x14')]);}})[_0x5721('0x16')](function(_0x2f36ab){logger['error'](_0x5721('0xe'),_0x44a6c7,_0x2f36ab);_0x452a8e(_0x2f36ab);});});}exports[_0x5721('0x17')]=function(_0x3bb271){var _0x4f6a07=this;return new Promise(function(_0x52cd5e,_0x454344){return db['MailApplication'][_0x5721('0x18')](_0x3bb271[_0x5721('0x19')],{'raw':_0x3bb271[_0x5721('0x1a')]?_0x3bb271['options'][_0x5721('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb271[_0x5721('0x1a')]?_0x3bb271['options'][_0x5721('0x1c')]||null:null,'attributes':_0x3bb271['options']?_0x3bb271['options'][_0x5721('0x1d')]||null:null,'limit':_0x3bb271[_0x5721('0x1a')]?_0x3bb271['options'][_0x5721('0x1e')]||null:null})['then'](function(_0x363573){logger[_0x5721('0x1f')](_0x5721('0x17'),_0x3bb271);logger['debug'](_0x5721('0x17'),_0x3bb271,JSON['stringify'](_0x363573));_0x52cd5e(_0x363573);})['catch'](function(_0x107be2){logger[_0x5721('0x12')](_0x5721('0x17'),_0x107be2[_0x5721('0x14')],_0x3bb271);_0x454344(_0x4f6a07[_0x5721('0x12')](0x1f4,_0x107be2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 497f971..3856b33 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 _0x5816=['mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete'];(function(_0x47072f,_0x5cad33){var _0x396f5d=function(_0x9c5074){while(--_0x9c5074){_0x47072f['push'](_0x47072f['shift']());}};_0x396f5d(++_0x5cad33);}(_0x5816,0xf7));var _0x6581=function(_0x129b97,_0x3c4f53){_0x129b97=_0x129b97-0x0;var _0xc97dbf=_0x5816[_0x129b97];return _0xc97dbf;};'use strict';var express=require(_0x6581('0x0'));var router=express[_0x6581('0x1')]();var auth=require(_0x6581('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x6581('0x3'));router['get']('/',auth[_0x6581('0x4')](),controller[_0x6581('0x5')]);router[_0x6581('0x6')](_0x6581('0x7'),auth[_0x6581('0x4')](),controller[_0x6581('0x8')]);router[_0x6581('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6581('0x9')]);router[_0x6581('0x6')](_0x6581('0xa'),auth[_0x6581('0x4')](),controller[_0x6581('0xb')]);router['get'](_0x6581('0xc'),auth[_0x6581('0x4')](),controller['download']);router['post']('/',auth[_0x6581('0x4')](),controller['create']);router[_0x6581('0xd')](_0x6581('0xa'),auth[_0x6581('0x4')](),controller[_0x6581('0xe')]);router[_0x6581('0xd')](_0x6581('0xf'),auth['isAuthenticated'](),interaction[_0x6581('0x10')](_0x6581('0x11'),_0x6581('0x12')),controller[_0x6581('0x13')]);router[_0x6581('0x14')]('/:id',auth['isAuthenticated'](),interaction[_0x6581('0x10')](_0x6581('0x11'),_0x6581('0x15')),controller['update']);router[_0x6581('0x16')]('/:id',auth[_0x6581('0x4')](),interaction[_0x6581('0x10')](_0x6581('0x11'),_0x6581('0x17')),controller[_0x6581('0x18')]);router['delete'](_0x6581('0xf'),auth[_0x6581('0x4')](),controller[_0x6581('0x19')]);module[_0x6581('0x1a')]=router; \ No newline at end of file +var _0xe5ce=['addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','update','delete','mail','mailinteraction:destroy','destroy','exports','express','Router','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create'];(function(_0x1094fc,_0x15b669){var _0x18a34d=function(_0x40b0fc){while(--_0x40b0fc){_0x1094fc['push'](_0x1094fc['shift']());}};_0x18a34d(++_0x15b669);}(_0xe5ce,0x1e0));var _0xee5c=function(_0x15f2c4,_0x3c4f59){_0x15f2c4=_0x15f2c4-0x0;var _0x5a8b3c=_0xe5ce[_0x15f2c4];return _0x5a8b3c;};'use strict';var express=require(_0xee5c('0x0'));var router=express[_0xee5c('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xee5c('0x2'));router[_0xee5c('0x3')]('/',auth['isAuthenticated'](),controller[_0xee5c('0x4')]);router[_0xee5c('0x3')](_0xee5c('0x5'),auth[_0xee5c('0x6')](),controller[_0xee5c('0x7')]);router[_0xee5c('0x3')](_0xee5c('0x8'),auth[_0xee5c('0x6')](),controller[_0xee5c('0x9')]);router[_0xee5c('0x3')]('/:id/messages',auth[_0xee5c('0x6')](),controller['getMessages']);router[_0xee5c('0x3')](_0xee5c('0xa'),auth[_0xee5c('0x6')](),controller[_0xee5c('0xb')]);router[_0xee5c('0xc')]('/',auth[_0xee5c('0x6')](),controller[_0xee5c('0xd')]);router[_0xee5c('0xc')]('/:id/messages',auth[_0xee5c('0x6')](),controller[_0xee5c('0xe')]);router[_0xee5c('0xc')](_0xee5c('0xf'),auth[_0xee5c('0x6')](),interaction[_0xee5c('0x10')]('mail',_0xee5c('0x11')),controller[_0xee5c('0x12')]);router[_0xee5c('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0xee5c('0x10')]('mail','mailinteraction:update'),controller[_0xee5c('0x14')]);router[_0xee5c('0x15')](_0xee5c('0x8'),auth['isAuthenticated'](),interaction[_0xee5c('0x10')](_0xee5c('0x16'),_0xee5c('0x17')),controller[_0xee5c('0x18')]);router['delete']('/:id/tags',auth[_0xee5c('0x6')](),controller['removeTags']);module[_0xee5c('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b2c9fbf..cbfccbd 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 _0xe002=['DATE','STRING','TEXT','long','BOOLEAN','ENUM','out','sequelize','iconv','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xe002,0xf7));var _0x2e00=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xe002[_0x273dc5];return _0x46dae7;};'use strict';var Sequelize=require(_0x2e00('0x0'));var iconv=require(_0x2e00('0x1'));module[_0x2e00('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2e00('0x3')]},'disposition':{'type':Sequelize[_0x2e00('0x4')]},'secondDisposition':{'type':Sequelize[_0x2e00('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2e00('0x4')]},'inReplyTo':{'type':Sequelize[_0x2e00('0x4')](0x1fe)},'to':{'type':Sequelize[_0x2e00('0x4')]},'cc':{'type':Sequelize[_0x2e00('0x5')](_0x2e00('0x6'))},'subject':{'type':Sequelize[_0x2e00('0x5')]()},'attach':{'type':Sequelize[_0x2e00('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2e00('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x2e00('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2e00('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2e00('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2e00('0x8')]('in',_0x2e00('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2e00('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xef54=['BOOLEAN','STRING','long','TEXT','DATE','ENUM','out','sequelize','iconv','exports'];(function(_0x4cd462,_0x5ef77f){var _0x12ea68=function(_0x534dd0){while(--_0x534dd0){_0x4cd462['push'](_0x4cd462['shift']());}};_0x12ea68(++_0x5ef77f);}(_0xef54,0x9d));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4ef5('0x0'));var iconv=require(_0x4ef5('0x1'));module[_0x4ef5('0x2')]={'closed':{'type':Sequelize[_0x4ef5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4ef5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4ef5('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x4ef5('0x4')](0x1fe)},'to':{'type':Sequelize[_0x4ef5('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x4ef5('0x5'))},'subject':{'type':Sequelize[_0x4ef5('0x6')]()},'attach':{'type':Sequelize[_0x4ef5('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4ef5('0x7')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x4ef5('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x4ef5('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4ef5('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x4ef5('0x8')]('in',_0x4ef5('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4ef5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 151f3f7..bce4e42 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 _0x85d5=['bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','MailMessage','findOne','-id','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','select','field','from','tools_tags','u.fullname','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','compact','isEmpty','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','params','include','options','create','body','describe','addMessage','ids','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true','addTags','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages'];(function(_0x5e2231,_0x110743){var _0x1535ec=function(_0x216482){while(--_0x216482){_0x5e2231['push'](_0x5e2231['shift']());}};_0x1535ec(++_0x110743);}(_0x85d5,0x1e1));var _0x585d=function(_0x75a092,_0x4a475a){_0x75a092=_0x75a092-0x0;var _0x31be39=_0x85d5[_0x75a092];return _0x31be39;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x585d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x585d('0x1'));var BPromise=require(_0x585d('0x2'));var util=require(_0x585d('0x3'));var path=require(_0x585d('0x4'));var fs=require('fs');var _=require(_0x585d('0x5'));var squel=require(_0x585d('0x6'));var juice=require(_0x585d('0x7'));var Redis=require(_0x585d('0x8'));var qs=require(_0x585d('0x9'));var as=require(_0x585d('0xa'));var logger=require('../../config/logger')(_0x585d('0xb'));var config=require('../../config/environment');var db=require(_0x585d('0xc'))['db'];var htmlEntities=require(_0x585d('0xd'));config[_0x585d('0xe')]=_[_0x585d('0xf')](config['redis'],{'host':_0x585d('0x10'),'port':0x18eb});var socket=require(_0x585d('0x11'))(new Redis(config[_0x585d('0xe')]));require(_0x585d('0x12'))[_0x585d('0x13')](socket);function respondWithStatusCode(_0x4b6ef0,_0x396faf){_0x396faf=_0x396faf||0xcc;return function(_0x366a48){if(_0x366a48){return _0x4b6ef0[_0x585d('0x14')](_0x396faf);}return _0x4b6ef0[_0x585d('0x15')](_0x396faf)[_0x585d('0x16')]();};}function respondWithResult(_0x5ca599,_0x4d5359){_0x4d5359=_0x4d5359||0xc8;return function(_0x28963e){if(_0x28963e){return _0x5ca599[_0x585d('0x15')](_0x4d5359)[_0x585d('0x17')](_0x28963e);}};}function respondWithFilteredResult(_0x57ef6a,_0x219bf4){return function(_0x5d6af0){if(_0x5d6af0){var _0x1c011a=typeof _0x219bf4['offset']===_0x585d('0x18')&&typeof _0x219bf4[_0x585d('0x19')]===_0x585d('0x18');var _0x2e55be=_0x5d6af0[_0x585d('0x1a')];var _0x383a79=_0x1c011a?0x0:_0x219bf4[_0x585d('0x1b')];var _0x44a471=_0x1c011a?_0x5d6af0[_0x585d('0x1a')]:_0x219bf4[_0x585d('0x1b')]+_0x219bf4[_0x585d('0x19')];var _0x370cc8;if(_0x44a471>=_0x2e55be){_0x44a471=_0x2e55be;_0x370cc8=0xc8;}else{_0x370cc8=0xce;}_0x57ef6a[_0x585d('0x15')](_0x370cc8);return _0x57ef6a[_0x585d('0x1c')](_0x585d('0x1d'),_0x383a79+'-'+_0x44a471+'/'+_0x2e55be)['json'](_0x5d6af0);}return null;};}function saveUpdates(_0x3829be){return function(_0x11c7d0){if(_0x11c7d0){return _0x11c7d0[_0x585d('0x1e')](_0x3829be)[_0x585d('0x1f')](function(_0x3ce39a){return _0x3ce39a;});}return null;};}function removeEntity(_0x404063){return function(_0x53d725){if(_0x53d725){return _0x53d725[_0x585d('0x20')]()['then'](function(){_0x404063[_0x585d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c65a2){return function(_0x594ca1){if(!_0x594ca1){_0x3c65a2[_0x585d('0x14')](0x194);}return _0x594ca1;};}function handleError(_0x59eaf8,_0x537301){_0x537301=_0x537301||0x1f4;return function(_0x57c74a){logger[_0x585d('0x21')](_0x57c74a[_0x585d('0x22')]);if(_0x57c74a[_0x585d('0x23')]){delete _0x57c74a['name'];}_0x59eaf8[_0x585d('0x15')](_0x537301)[_0x585d('0x24')](_0x57c74a);};}function getInteractionUsers(_0x247995,_0x50cd78){return new BPromise(function(_0x2b419f,_0x306079){try{if(_0x50cd78[_0x247995['id']]){_0x247995[_0x585d('0x25')]=_[_0x585d('0x26')](_0x50cd78[_0x247995['id']],function(_0x567960){return{'id':_0x567960['id'],'fullname':_0x567960['fullname']};});}}catch(_0x358417){_0x306079(_0x358417);}_0x2b419f(_0x247995);});}function getInteractionTags(_0x1ae592,_0x227612){return new BPromise(function(_0x48bc94,_0xacb44b){try{if(_0x1ae592[_0x585d('0x27')]){_0x1ae592['Tags']=[];_0x1ae592['TagIds'][_0x585d('0x28')](',')[_0x585d('0x29')](function(_0x147181){_0x1ae592[_0x585d('0x2a')][_0x585d('0x2b')](_0x227612[_0x147181]);});}delete _0x1ae592[_0x585d('0x27')];}catch(_0x5f1ea0){_0xacb44b(_0x5f1ea0);}_0x48bc94(_0x1ae592);});}function getLastMessageText(_0x36ccd2){return new BPromise(function(_0x2d950c,_0x57d284){return db[_0x585d('0x2c')][_0x585d('0x2d')]({'where':{'$and':[{'MailInteractionId':_0x36ccd2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x585d('0x2e'),'raw':!![]})[_0x585d('0x1f')](function(_0x302162){if(_0x302162&&_0x302162[_0x585d('0x2f')]){_0x36ccd2[_0x585d('0x30')]=_[_0x585d('0x31')](_0x302162[_0x585d('0x2f')]);}_0x2d950c(_0x36ccd2);})[_0x585d('0x32')](function(_0x105bab){_0x57d284(_0x105bab);});});}function updateMailInteraction(_0x314130,_0x6f4967,_0x1bdb77,_0x545f4f){return new BPromise(function(_0xe61857,_0x5293b0){return getInteractionUsers(_0x314130,_0x1bdb77)[_0x585d('0x1f')](function(_0x20d76e){return getInteractionTags(_0x20d76e,_0x6f4967);})[_0x585d('0x1f')](function(_0x4bf329){return getStateInteraction(_0x4bf329);})[_0x585d('0x1f')](function(_0x13e57e){if(_0x545f4f){_0xe61857(getLastMessageText(_0x13e57e));}else{_0xe61857(_0x13e57e);}})[_0x585d('0x32')](function(_0x523d44){_0x5293b0(_0x523d44);});});}function getStateInteraction(_0x40fe46){return new BPromise(function(_0x55a0b5){_0x40fe46[_0x585d('0x33')]=0x0;_0x40fe46[_0x585d('0x34')]=0x0;_0x40fe46[_0x585d('0x35')]=0x0;_0x40fe46[_0x585d('0x36')]=0x0;_0x40fe46[_0x585d('0x37')]=0x0;if(!_0x40fe46[_0x585d('0x38')]&&!_0x40fe46['UserId']){_0x40fe46[_0x585d('0x33')]+=0x1;}if(!_0x40fe46['closed']&&_0x40fe46[_0x585d('0x39')]){_0x40fe46['talking']+=0x1;if(_0x40fe46['waiting']){_0x40fe46['waiting']-=0x1;}}if(_0x40fe46[_0x585d('0x38')]&&_0x40fe46[_0x585d('0x39')]){_0x40fe46[_0x585d('0x35')]+=0x1;if(_0x40fe46[_0x585d('0x34')]){_0x40fe46[_0x585d('0x34')]-=0x1;}}if(_0x40fe46[_0x585d('0x38')]&&!_0x40fe46[_0x585d('0x39')]){_0x40fe46[_0x585d('0x36')]+=0x1;if(_0x40fe46[_0x585d('0x33')]){_0x40fe46[_0x585d('0x33')]-=0x1;}}_0x40fe46[_0x585d('0x37')]+=0x1;_0x55a0b5(_0x40fe46);});}exports['index']=function(_0x40f02c,_0x268f77){var _0xd129a1={},_0x48d1a8={},_0x5a321b={'count':0x0,'rows':[]};var _0x31438b=_['map'](db['MailInteraction'][_0x585d('0x3a')],function(_0x5bb829){return{'name':_0x5bb829['fieldName'],'type':_0x5bb829[_0x585d('0x3b')]['key']};});_0x48d1a8['model']=_[_0x585d('0x26')](_0x31438b,'name');_0x48d1a8[_0x585d('0x3c')]=_['keys'](_0x40f02c[_0x585d('0x3c')]);_0x48d1a8[_0x585d('0x3d')]=_[_0x585d('0x3e')](_0x48d1a8[_0x585d('0x3f')],_0x48d1a8[_0x585d('0x3c')]);_0xd129a1[_0x585d('0x40')]=_[_0x585d('0x3e')](_0x48d1a8['model'],qs[_0x585d('0x41')](_0x40f02c[_0x585d('0x3c')][_0x585d('0x41')]));_0xd129a1[_0x585d('0x40')]=_0xd129a1['attributes'][_0x585d('0x42')]?_0xd129a1['attributes']:_0x48d1a8[_0x585d('0x3f')];if(!_0x40f02c[_0x585d('0x3c')][_0x585d('0x43')](_0x585d('0x44'))){_0xd129a1[_0x585d('0x19')]=qs[_0x585d('0x19')](_0x40f02c[_0x585d('0x3c')][_0x585d('0x19')]);_0xd129a1[_0x585d('0x1b')]=qs[_0x585d('0x1b')](_0x40f02c[_0x585d('0x3c')][_0x585d('0x1b')]);}_0xd129a1[_0x585d('0x45')]=qs[_0x585d('0x46')](_0x40f02c[_0x585d('0x3c')][_0x585d('0x46')]);_0xd129a1['where']=qs['filters'](_['pick'](_0x40f02c[_0x585d('0x3c')],_0x48d1a8[_0x585d('0x3d')]),_0x31438b);var _0x22a28c=[];var _0x4172cf=squel[_0x585d('0x47')]()['field']('id')[_0x585d('0x48')]('name')['field']('color')[_0x585d('0x49')](_0x585d('0x4a'));var _0x427d39=squel[_0x585d('0x47')]()[_0x585d('0x48')]('u.id')[_0x585d('0x48')](_0x585d('0x4b'))[_0x585d('0x48')]('ui.MailInteractionId')['from']('user_has_mail_interactions','ui')['left_join'](_0x585d('0x4c'),'u',_0x585d('0x4d'));var _0x562e69=squel[_0x585d('0x47')]()[_0x585d('0x49')](_0x585d('0x4e'),'i')[_0x585d('0x4f')](_0x585d('0x50'),'c',_0x585d('0x51'))['left_join'](_0x585d('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x585d('0x4f')](_0x585d('0x52'),'a','a.id\x20=\x20i.MailAccountId')['left_join']('mail_messages','me',_0x585d('0x53'))[_0x585d('0x4f')](_0x585d('0x54'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x585d('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x5c4cb8=squel[_0x585d('0x55')]();var _0x47f4cd=[];var _0x41c7b1=squel['expr']();var _0x4c8fdd;if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x56')]){_0x4c8fdd=as[_0x585d('0x57')](_0x40f02c['query'][_0x585d('0x56')]);var _0x537757=_0x4c8fdd[_0x585d('0x58')];for(var _0x458109=0x0;_0x458109<_0x4c8fdd[_0x585d('0x59')][_0x585d('0x42')];_0x458109++){var _0x6fdd8b=_0x4c8fdd[_0x585d('0x59')][_0x458109];var _0x1cc774='i';var _0xeaf6e9=_[_0x585d('0x5a')](_0x31438b,[_0x585d('0x23'),_0x6fdd8b[_0x585d('0x48')]]);if(!_0xeaf6e9){switch(_0x6fdd8b['field']){case _0x585d('0x5b'):if(_0x6fdd8b['value']==0x1){_0x562e69[_0x585d('0x5c')]('`'+_0x6fdd8b[_0x585d('0x48')]+_0x585d('0x5d'));}else{_0x562e69[_0x585d('0x5c')]('`'+_0x6fdd8b[_0x585d('0x48')]+_0x585d('0x5e'));}break;case _0x585d('0x5f'):if(_0x6fdd8b[_0x585d('0x60')]==='$substring'){if(_0x6fdd8b[_0x585d('0x61')][_0x585d('0x28')]('\x20')[_0x585d('0x42')]>0x1){_0x5c4cb8[_0x537757](_0x585d('0x62'),qs[_0x585d('0x63')](_0x6fdd8b[_0x585d('0x61')]),null);}else{var _0x3b3982='%'+_0x6fdd8b[_0x585d('0x61')]+'%';_0x5c4cb8[_0x537757]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b3982,_0x3b3982,_0x3b3982);}}else{_0xeaf6e9=_[_0x585d('0x5a')](_0x31438b,[_0x585d('0x23'),_0x585d('0x64')]);_0x6fdd8b[_0x585d('0x48')]=_0x585d('0x64');_0x4c3e49=as[_0x585d('0x65')](_0x1cc774,_0xeaf6e9[_0x585d('0x3b')],_0x6fdd8b);_0x5c4cb8[_0x537757](_0x4c3e49[_0x585d('0x66')],_0x4c3e49['value'][_0x585d('0x67')],_0x4c3e49[_0x585d('0x61')][_0x585d('0x16')]);}break;case'Tag':var _0x3ae293=_0x6fdd8b[_0x585d('0x61')][_0x585d('0x28')](',')[_0x585d('0x26')](function(_0x567e37){return Number(_0x567e37);});_0x3ae293[_0x585d('0x29')](function(_0x2361b7){_0x41c7b1['or'](_0x585d('0x68'),'%,'+_0x2361b7+',%');});_0x47f4cd=_[_0x585d('0x69')](_0x47f4cd,_0x3ae293);break;case'User':if(_0x6fdd8b[_0x585d('0x60')]===_0x585d('0x6a')){_0x5c4cb8[_0x537757](_0x585d('0x6b'),'%'+_0x6fdd8b[_0x585d('0x61')]+'%',null);}else{_0xeaf6e9=_[_0x585d('0x5a')](_0x31438b,[_0x585d('0x23'),_0x585d('0x39')]);_0x6fdd8b[_0x585d('0x48')]=_0x585d('0x39');_0x4c3e49=as[_0x585d('0x65')](_0x1cc774,_0xeaf6e9['type'],_0x6fdd8b);_0x5c4cb8[_0x537757](_0x4c3e49[_0x585d('0x66')],_0x4c3e49[_0x585d('0x61')][_0x585d('0x67')],_0x4c3e49[_0x585d('0x61')]['end']);}break;case _0x585d('0x2f'):_0x4c3e49=as[_0x585d('0x65')]('me',null,_0x6fdd8b);_0x5c4cb8[_0x537757](_0x4c3e49[_0x585d('0x66')],_0x4c3e49[_0x585d('0x61')][_0x585d('0x67')],_0x4c3e49[_0x585d('0x61')]['end']);break;}}else{var _0x4c3e49=as[_0x585d('0x65')](_0x1cc774,_0xeaf6e9[_0x585d('0x3b')],_0x6fdd8b);_0x5c4cb8[_0x537757](_0x4c3e49[_0x585d('0x66')],_0x4c3e49[_0x585d('0x61')][_0x585d('0x67')],_0x4c3e49['value'][_0x585d('0x16')]);}}}else{var _0x11cfc9=_(_0x40f02c[_0x585d('0x3c')])[_0x585d('0x6c')]()[_0x585d('0x26')](function(_0xa402f){return _['some'](_0x31438b,[_0x585d('0x23'),_0xa402f])?_0xa402f:undefined;})[_0x585d('0x6d')]()[_0x585d('0x61')]();if(!_[_0x585d('0x6e')](_0x11cfc9)){_0x11cfc9[_0x585d('0x29')](function(_0x1eb295){if(_0x1eb295==='MailAccountId'){_0x562e69[_0x585d('0x6f')](_0x585d('0x70'),[][_0x585d('0x71')](_0x40f02c[_0x585d('0x3c')][_0x1eb295]));}else if(_0x1eb295===_0x585d('0x72')){var _0x5d0bda=JSON['parse'](_0x40f02c['query'][_0x1eb295])['$gte'];var _0x4c8341=JSON[_0x585d('0x73')](_0x40f02c[_0x585d('0x3c')][_0x1eb295])['$lte'];_0x562e69['where'](_0x585d('0x74'),_0x5d0bda,_0x4c8341);}else{if(_0x40f02c[_0x585d('0x3c')][_0x1eb295]===_0x585d('0x75')){_0x562e69[_0x585d('0x6f')]('i.'+_0x1eb295+'\x20IS\x20NULL');}else{_0x562e69[_0x585d('0x6f')]('i.'+_0x1eb295+_0x585d('0x76'),_0x40f02c[_0x585d('0x3c')][_0x1eb295]);}}});}if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x77')]){if(_0x40f02c['query']['read']==0x1){_0x562e69[_0x585d('0x5c')](_0x585d('0x78'));}else{_0x562e69[_0x585d('0x5c')](_0x585d('0x79'));}}if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x7a')]){_0x47f4cd=_[_0x585d('0x7b')](_0x40f02c[_0x585d('0x3c')][_0x585d('0x7a')])?_0x40f02c[_0x585d('0x3c')][_0x585d('0x7a')]:new Array(_0x40f02c['query'][_0x585d('0x7a')]);_0x47f4cd['forEach'](function(_0x5f2c42){_0x41c7b1['or'](_0x585d('0x68'),'%,'+_0x5f2c42+',%');});}if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x7c')]){var _0x1dbd9b=_0x40f02c['query']['filter'][_0x585d('0x7d')]('\x5c','\x5c\x5c')[_0x585d('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1dbd9b)){_0x5c4cb8['or']('i.id\x20LIKE\x20?',_0x1dbd9b+'%');}else if(qs[_0x585d('0x7e')](_0x1dbd9b)){_0x5c4cb8['or'](_0x585d('0x7f'),_0x1dbd9b+'%');}else{_0x5c4cb8['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x585d('0x63')](_0x1dbd9b))['or'](_0x585d('0x80'),qs[_0x585d('0x63')](_0x1dbd9b));}}}_0x562e69[_0x585d('0x6f')](_0x5c4cb8);_0x562e69[_0x585d('0x81')](_0x585d('0x82'));var _0x436bc8={'type':db[_0x585d('0x83')][_0x585d('0x84')]['SELECT'],'raw':!![]};var _0x21dc86=_0x562e69[_0x585d('0x85')]();_0x21dc86[_0x585d('0x48')](_0x585d('0x82'));_0x21dc86[_0x585d('0x48')](_0x585d('0x86'),'unreadMessages');if(_0xd129a1[_0x585d('0x45')]){_0xd129a1[_0x585d('0x45')][_0x585d('0x29')](function(_0x3fd1b7){var _0x25c7d4=_0x3fd1b7[0x0]===_0x585d('0x87')?_0x3fd1b7[0x0]:'i.'+_0x3fd1b7[0x0];_0x562e69[_0x585d('0x45')](_0x25c7d4,_0x3fd1b7[0x1]==='DESC'?![]:!![]);});}if(!_[_0x585d('0x6e')](_0x47f4cd)){_0x562e69['having'](_0x41c7b1);_0x21dc86[_0x585d('0x6f')](_0x585d('0x88'),_0x47f4cd);}BPromise[_0x585d('0x89')]()['then'](function(){if(!_0x4c8fdd){if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x8a')])return;_0x21dc86[_0x585d('0x6f')](_0x585d('0x8b'));_0x562e69[_0x585d('0x6f')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x40f02c['user']['role']!=='agent')return;return _0x40f02c[_0x585d('0x8c')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x585d('0x1f')](function(_0x4abd6e){if(_[_0x585d('0x6e')](_0x4abd6e)){_0x21dc86[_0x585d('0x6f')](_0x585d('0x8d'));_0x562e69[_0x585d('0x6f')](_0x585d('0x8d'));}else{_0x21dc86[_0x585d('0x6f')](_0x585d('0x70'),_[_0x585d('0x26')](_0x4abd6e,'id'));_0x562e69[_0x585d('0x6f')](_0x585d('0x70'),_[_0x585d('0x26')](_0x4abd6e,'id'));}});})[_0x585d('0x1f')](function(){if(_0x40f02c[_0x585d('0x8c')]['role']==='agent'&&!_0x4c8fdd&&!_0x40f02c[_0x585d('0x3c')][_0x585d('0x8a')])return[];return db[_0x585d('0x8e')][_0x585d('0x3c')](_0x21dc86[_0x585d('0x8f')](),_0x436bc8);})['then'](function(_0x123aa5){_0x5a321b[_0x585d('0x1a')]=_0x123aa5[_0x585d('0x42')];if(_0x5a321b['count']===0x0)return[];return db[_0x585d('0x8e')][_0x585d('0x3c')](_0x4172cf[_0x585d('0x8f')](),_0x436bc8)['then'](function(_0x4c1bd0){_0x22a28c=_[_0x585d('0x90')](_0x4c1bd0,'id');_0x436bc8=_[_0x585d('0x91')](_0x436bc8,{'model':db[_0x585d('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40f02c[_0x585d('0x3c')][_0x585d('0x41')]){_0xd129a1[_0x585d('0x40')][_0x585d('0x29')](function(_0x31e2d4){_0x562e69[_0x585d('0x48')]('i.'+_0x31e2d4);});}else{_0x562e69[_0x585d('0x48')](_0x585d('0x86'),_0x585d('0x5b'));_0x562e69[_0x585d('0x48')](_0x585d('0x93'),_0x585d('0x94'));_0x562e69[_0x585d('0x48')]('a.mandatoryDisposition',_0x585d('0x95'));_0x562e69[_0x585d('0x48')](_0x585d('0x96'),_0x585d('0x97'));_0x562e69[_0x585d('0x48')](_0x585d('0x98'),_0x585d('0x87'));_0x562e69['field'](_0x585d('0x82'));_0x562e69[_0x585d('0x48')](_0x585d('0x99'));_0x562e69[_0x585d('0x48')](_0x585d('0x9a'));_0x562e69['field'](_0x585d('0x9b'));_0x562e69[_0x585d('0x48')](_0x585d('0x9c'));_0x562e69[_0x585d('0x48')](_0x585d('0x9d'));_0x562e69[_0x585d('0x48')](_0x585d('0x9e'));_0x562e69[_0x585d('0x48')](_0x585d('0x9f'));_0x562e69[_0x585d('0x48')](_0x585d('0xa0'));_0x562e69['field']('i.disposition');_0x562e69[_0x585d('0x48')](_0x585d('0xa1'));_0x562e69[_0x585d('0x48')]('i.thirdDisposition');_0x562e69['field']('i.substatus');_0x562e69[_0x585d('0x48')]('i.to');_0x562e69[_0x585d('0x48')](_0x585d('0xa2'));_0x562e69[_0x585d('0x48')](_0x585d('0xa3'));_0x562e69[_0x585d('0x48')](_0x585d('0xa4'));_0x562e69[_0x585d('0x48')](_0x585d('0xa5'),_0x585d('0xa6'));_0x562e69[_0x585d('0x48')]('c.lastName',_0x585d('0xa7'));_0x562e69[_0x585d('0x48')](_0x585d('0xa8'),_0x585d('0xa9'));_0x562e69[_0x585d('0x48')](_0x585d('0xaa'),_0x585d('0xab'));_0x562e69['field']('c.mobile','Contact.mobile');_0x562e69[_0x585d('0x48')](_0x585d('0xac'),_0x585d('0xad'));_0x562e69[_0x585d('0x48')]('o.fullname','Owner.fullname');_0x562e69[_0x585d('0x48')](_0x585d('0xae'),_0x585d('0xaf'));_0x562e69['field'](_0x585d('0xb0'),_0x585d('0x27'));}if(_0xd129a1['limit'])_0x562e69[_0x585d('0x19')](_0xd129a1['limit']);if(_0xd129a1[_0x585d('0x1b')])_0x562e69[_0x585d('0x1b')](_0xd129a1[_0x585d('0x1b')]);return db['sequelize']['query'](_0x562e69[_0x585d('0x8f')](),_0x436bc8);})[_0x585d('0x1f')](function(_0x50023d){if(_0x50023d[_0x585d('0x42')]>0x0)_0x427d39[_0x585d('0x6f')](_0x585d('0xb1'),_[_0x585d('0x26')](_0x50023d,'id'));return db[_0x585d('0x8e')]['query'](_0x427d39[_0x585d('0x8f')](),_0x436bc8)['then'](function(_0x28dccf){var _0x8c35b2=_[_0x585d('0xb2')](_0x28dccf,_0x585d('0xb3'));var _0x265ef6=[];return db[_0x585d('0xb4')]['findOne']({'attributes':[_0x585d('0xb5')],'raw':!![]})[_0x585d('0x1f')](function(_0x2d7c8f){var _0x21d313=_0x2d7c8f[_0x585d('0xb5')];_0x50023d['forEach'](function(_0x561967){_0x265ef6[_0x585d('0x2b')](updateMailInteraction(_0x561967,_0x22a28c,_0x8c35b2,_0x21d313));});return BPromise[_0x585d('0xb6')](_0x265ef6);});});});})[_0x585d('0x1f')](function(_0x156ce6){_0x5a321b[_0x585d('0xb7')]=_0x156ce6;return _0x5a321b;})[_0x585d('0x1f')](respondWithFilteredResult(_0x268f77,_0xd129a1))[_0x585d('0x32')](handleError(_0x268f77,null));};exports['show']=function(_0x33969a,_0x37f2dd){var _0x32b822={'raw':![],'where':{'id':_0x33969a[_0x585d('0xb8')]['id']}},_0x243904={};_0x243904[_0x585d('0x3f')]=_[_0x585d('0x6c')](db[_0x585d('0x92')]['rawAttributes']);_0x243904[_0x585d('0x3c')]=_[_0x585d('0x6c')](_0x33969a[_0x585d('0x3c')]);_0x243904[_0x585d('0x3d')]=_[_0x585d('0x3e')](_0x243904[_0x585d('0x3f')],_0x243904[_0x585d('0x3c')]);_0x32b822[_0x585d('0x40')]=_[_0x585d('0x3e')](_0x243904[_0x585d('0x3f')],qs[_0x585d('0x41')](_0x33969a[_0x585d('0x3c')][_0x585d('0x41')]));_0x32b822[_0x585d('0x40')]=_0x32b822[_0x585d('0x40')][_0x585d('0x42')]?_0x32b822[_0x585d('0x40')]:_0x243904[_0x585d('0x3f')];if(_0x33969a[_0x585d('0x3c')]['includeAll']){_0x32b822[_0x585d('0xb9')]=[{'all':!![]}];}_0x32b822=_[_0x585d('0x91')]({},_0x32b822,_0x33969a[_0x585d('0xba')]);return db[_0x585d('0x92')][_0x585d('0x5a')](_0x32b822)[_0x585d('0x1f')](handleEntityNotFound(_0x37f2dd,null))[_0x585d('0x1f')](respondWithResult(_0x37f2dd,null))[_0x585d('0x32')](handleError(_0x37f2dd,null));};exports[_0x585d('0xbb')]=function(_0x14e227,_0x4e526e){return db[_0x585d('0x92')][_0x585d('0xbb')](_0x14e227[_0x585d('0xbc')],{})[_0x585d('0x1f')](respondWithResult(_0x4e526e,0xc9))[_0x585d('0x32')](handleError(_0x4e526e,null));};exports[_0x585d('0x1e')]=function(_0x1fc3d2,_0x44f1ca){if(_0x1fc3d2[_0x585d('0xbc')]['id']){delete _0x1fc3d2[_0x585d('0xbc')]['id'];}return db[_0x585d('0x92')][_0x585d('0x5a')]({'where':{'id':_0x1fc3d2[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0x44f1ca,null))['then'](saveUpdates(_0x1fc3d2[_0x585d('0xbc')],null))[_0x585d('0x1f')](respondWithResult(_0x44f1ca,null))[_0x585d('0x32')](handleError(_0x44f1ca,null));};exports['destroy']=function(_0x2ec691,_0xb9f7e4){return db[_0x585d('0x92')][_0x585d('0x5a')]({'where':{'id':_0x2ec691[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0xb9f7e4,null))[_0x585d('0x1f')](removeEntity(_0xb9f7e4,null))[_0x585d('0x32')](handleError(_0xb9f7e4,null));};exports[_0x585d('0xbd')]=function(_0xccd418,_0x1064d0){return db[_0x585d('0x92')][_0x585d('0xbd')]()[_0x585d('0x1f')](respondWithResult(_0x1064d0,null))[_0x585d('0x32')](handleError(_0x1064d0,null));};exports[_0x585d('0xbe')]=function(_0x2ee9bd,_0x5d5df3){return db[_0x585d('0x2c')][_0x585d('0x5a')]({'where':{'id':_0x2ee9bd[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0x5d5df3,null))[_0x585d('0x1f')](function(_0xf6d464){if(_0xf6d464){return _0xf6d464[_0x585d('0xbe')](_0x2ee9bd[_0x585d('0xbc')][_0x585d('0xbf')],_['omit'](_0x2ee9bd[_0x585d('0xbc')],[_0x585d('0xbf'),'id'])||{});}})[_0x585d('0x1f')](respondWithResult(_0x5d5df3,null))[_0x585d('0x32')](handleError(_0x5d5df3,null));};exports[_0x585d('0xc0')]=function(_0x275425,_0x2e4ff9){var _0x1454cc={'raw':![],'where':{}};var _0x2c5cfa={};var _0x53c1f1={'count':0x0,'rows':[]};return db[_0x585d('0x92')]['findOne']({'where':{'id':_0x275425[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0x2e4ff9,null))['then'](function(_0x4d0334){if(_0x4d0334){_0x2c5cfa[_0x585d('0x3f')]=_[_0x585d('0x6c')](db[_0x585d('0x2c')][_0x585d('0x3a')]);_0x2c5cfa['query']=_['keys'](_0x275425[_0x585d('0x3c')]);_0x2c5cfa[_0x585d('0x3d')]=_[_0x585d('0x3e')](_0x2c5cfa[_0x585d('0x3f')],_0x2c5cfa['query']);_0x1454cc[_0x585d('0x40')]=_['intersection'](_0x2c5cfa[_0x585d('0x3f')],qs[_0x585d('0x41')](_0x275425[_0x585d('0x3c')][_0x585d('0x41')]));_0x1454cc[_0x585d('0x40')]=_0x1454cc[_0x585d('0x40')]['length']?_0x1454cc[_0x585d('0x40')]:_0x2c5cfa['model'];if(!_0x275425[_0x585d('0x3c')][_0x585d('0x43')](_0x585d('0x44'))){_0x1454cc[_0x585d('0x19')]=qs[_0x585d('0x19')](_0x275425['query'][_0x585d('0x19')]);_0x1454cc['offset']=qs[_0x585d('0x1b')](_0x275425['query'][_0x585d('0x1b')]);}_0x1454cc['order']=qs[_0x585d('0x46')](_0x275425[_0x585d('0x3c')][_0x585d('0x46')]);_0x1454cc[_0x585d('0x6f')]=qs[_0x585d('0x3d')](_[_0x585d('0xc1')](_0x275425['query'],_0x2c5cfa[_0x585d('0x3d')]));_0x1454cc[_0x585d('0x6f')][_0x585d('0xb3')]=_0x4d0334['id'];if(_0x275425['query'][_0x585d('0x7c')]){_0x1454cc[_0x585d('0x6f')]=_[_0x585d('0x91')](_0x1454cc[_0x585d('0x6f')],{'$or':_[_0x585d('0x26')](_0x1454cc['attributes'],function(_0x2116d7){var _0x13ff63={};_0x13ff63[_0x2116d7]={'$like':'%'+_0x275425[_0x585d('0x3c')][_0x585d('0x7c')]+'%'};return _0x13ff63;})});}if(_0x275425[_0x585d('0x3c')][_0x585d('0xc2')]){var _0xcf3e=_0x275425[_0x585d('0x3c')]['$gte'][_0x585d('0x28')](',');var _0x58c673={};_0x58c673[_0xcf3e[0x0]]={'$gte':moment(_0xcf3e[0x1])[_0x585d('0xc3')](_0x585d('0xc4'))};_0x1454cc[_0x585d('0x6f')]=_[_0x585d('0x91')](_0x1454cc[_0x585d('0x6f')],_0x58c673);}_0x1454cc=_['merge']({},_0x1454cc,_0x275425[_0x585d('0xba')]);return db['MailMessage']['count']({'where':_0x1454cc[_0x585d('0x6f')]})['then'](function(_0x38e363){_0x53c1f1[_0x585d('0x1a')]=_0x38e363;if(_0x275425['query']['includeAll']){_0x1454cc['include']=[{'all':!![]}];}return db['MailMessage'][_0x585d('0xc5')](_0x1454cc);})['then'](function(_0x57a0b5){if(_0x275425['query']['inlineCss']===_0x585d('0xc6')){for(var _0x63cb28=0x0;_0x63cb28<_0x57a0b5['length'];_0x63cb28++){_0x57a0b5[_0x63cb28][_0x585d('0xbc')]=juice(_0x57a0b5[_0x63cb28]['body']);}}_0x53c1f1[_0x585d('0xb7')]=_0x57a0b5;return _0x53c1f1;});}})[_0x585d('0x1f')](respondWithFilteredResult(_0x2e4ff9,_0x1454cc))['catch'](handleError(_0x2e4ff9,null));};exports[_0x585d('0xc7')]=function(_0x361b49,_0xe86268){return db['MailInteraction'][_0x585d('0x5a')]({'where':{'id':_0x361b49[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0xe86268,null))[_0x585d('0x1f')](function(_0x1bab7f){if(_0x1bab7f){return _0x1bab7f[_0x585d('0xc8')](_0x361b49[_0x585d('0xbc')]['ids'],_[_0x585d('0xc9')](_0x361b49[_0x585d('0xbc')],['ids','id'])||{})[_0x585d('0xca')](function(){return db['Tag'][_0x585d('0xc5')]({'attributes':['id',_0x585d('0x23'),_0x585d('0xcb')],'where':{'id':_0x361b49[_0x585d('0xbc')]['ids']}});})[_0x585d('0x1f')](function(_0x50ab04){socket[_0x585d('0xcc')](_0x585d('0xcd'),{'id':Number(_0x361b49[_0x585d('0xb8')]['id']),'tags':_0x50ab04||[]});return{'id':Number(_0x361b49['params']['id']),'tags':_0x50ab04||[]};});}})[_0x585d('0x1f')](respondWithResult(_0xe86268,null))['catch'](handleError(_0xe86268,null));};exports[_0x585d('0xce')]=function(_0x546854,_0x2c9ce6){return db[_0x585d('0x92')][_0x585d('0x5a')]({'where':{'id':_0x546854[_0x585d('0xb8')]['id']}})[_0x585d('0x1f')](handleEntityNotFound(_0x2c9ce6,null))[_0x585d('0x1f')](function(_0x2e30bf){if(_0x2e30bf){return _0x2e30bf[_0x585d('0xce')](_0x546854[_0x585d('0x3c')]['ids']);}})[_0x585d('0x1f')](respondWithStatusCode(_0x2c9ce6,null))[_0x585d('0x32')](handleError(_0x2c9ce6,null));};exports['download']=function(_0x3416f9,_0x26bd9f){var _0x779c43=moment()[_0x585d('0xcf')]()[_0x585d('0x8f')]();var _0xe866b0=path[_0x585d('0xd0')](config[_0x585d('0xd1')],_0x585d('0xd2'),_0x585d('0xd3'),_0x585d('0xd4'));var _0x37279f=path[_0x585d('0xd0')](config[_0x585d('0xd1')],_0x585d('0xd2'),_0x585d('0xd3'),_0x585d('0xd5'));var _0x2ea10d=path[_0x585d('0xd0')](_0xe866b0,_0x779c43);var _0x59c96f=util[_0x585d('0xc3')](_0x585d('0xd6'),_0x3416f9[_0x585d('0xb8')]['id'],_0x779c43);var _0x4a2a5b=path['join'](_0xe866b0,_0x59c96f);var _0x5834ad=[];if(_0x3416f9[_0x585d('0x3c')][_0x585d('0xd5')]){_0x5834ad['push']({'model':db[_0x585d('0xd7')],'as':_0x585d('0xd8'),'raw':!![]});}var _0x275884=[{'model':db[_0x585d('0x2c')],'as':_0x585d('0xd9'),'attributes':['id',_0x585d('0xbc'),_0x585d('0x49'),'to','cc',_0x585d('0xda'),_0x585d('0xdb'),_0x585d('0x72')],'where':{'secret':![]},'order':qs[_0x585d('0x46')]('id'),'include':_0x5834ad}];return db[_0x585d('0x92')]['find']({'where':{'id':_0x3416f9[_0x585d('0xb8')]['id']},'include':_0x275884})[_0x585d('0x1f')](handleEntityNotFound(_0x26bd9f,null))[_0x585d('0x1f')](function(_0x1aca96){if(_0x1aca96&&_0x1aca96[_0x585d('0xd9')]){var _0x26ec68=_0x1aca96[_0x585d('0xdc')]({'plain':!![]});fs[_0x585d('0xdd')](_0x2ea10d);return BPromise[_0x585d('0xde')](_0x26ec68['Messages'],function(_0x2c37cf,_0x1f63e2){var _0x2ab8f6={'from':_0x2c37cf[_0x585d('0x49')],'to':_0x2c37cf['to'],'subject':_0x2c37cf[_0x585d('0xdb')],'html':htmlEntities[_0x585d('0xdf')](_0x2c37cf['body']),'headers':{'Date':moment(_0x2c37cf['createdAt'])['format'](_0x585d('0xe0'))},'attachments':[]};if(_0x2c37cf['cc']){_0x2ab8f6['headers']['Cc']=_0x2c37cf['cc'];}if(_0x2c37cf[_0x585d('0xda')]){_0x2ab8f6['headers'][_0x585d('0xe1')]=_0x2c37cf['bcc'];}return new BPromise(function(_0x15ad7b,_0x593d2b){if(_0x2c37cf[_0x585d('0xd8')]){for(var _0x4df5eb=0x0;_0x4df5eb<_0x2c37cf['Attachments'][_0x585d('0x42')];_0x4df5eb++){var _0x4f17a6=_0x2c37cf['Attachments'][_0x4df5eb];var _0x5a316b=path[_0x585d('0xd0')](_0x37279f,_0x4f17a6['basename']);if(fs[_0x585d('0xe2')](_0x5a316b)){_0x2ab8f6[_0x585d('0xd5')][_0x585d('0x2b')]({'name':_0x4f17a6['name'],'contentType':_0x4f17a6[_0x585d('0x3b')],'data':fs[_0x585d('0xe3')](_0x5a316b)});}}}emlformat[_0x585d('0xe4')](_0x2ab8f6,function(_0x27fa83,_0x3dfe71){if(_0x27fa83)return _0x593d2b(_0x27fa83);fs[_0x585d('0xe5')](path[_0x585d('0xd0')](_0x2ea10d,util[_0x585d('0xc3')](_0x585d('0xe6'),_0x1f63e2)),_0x3dfe71);return _0x15ad7b(_0x3dfe71);});});})['then'](function(){return new BPromise(function(_0x2d52f8,_0x579b7c){zipdir(_0x2ea10d,{'saveTo':_0x4a2a5b},function(_0x4a1581,_0x1c7471){if(_0x4a1581)return _0x579b7c(_0x4a1581);return _0x2d52f8(_0x1c7471);});})[_0x585d('0x1f')](function(){return new BPromise(function(_0xb3d858,_0x3fcd79){rimraf(_0x2ea10d,function(_0x4816a1){if(_0x4816a1)_0x3fcd79(_0x4816a1);return _0xb3d858();});});})['then'](function(){return _0x26bd9f[_0x585d('0xe7')](_0x4a2a5b,_0x59c96f,function(_0x2a55b6){if(!_0x2a55b6)fs[_0x585d('0xe8')](_0x4a2a5b);});});});}else{return _0x26bd9f[_0x585d('0x14')](0xc8);}})[_0x585d('0x32')](handleError(_0x26bd9f,null));}; \ No newline at end of file +var _0x2831=['emit','removeTags','unix','join','root','files','server','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','createdAt','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','answered','total','closed','UserId','talking','unmanaged','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','end','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_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.closedAt','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','merge','create','body','describe','addMessage','ids','omit','format','options','inlineCss','addTags','spread','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2831,0x1ee));var _0x1283=function(_0x526f32,_0x22a205){_0x526f32=_0x526f32-0x0;var _0x4fe8af=_0x2831[_0x526f32];return _0x4fe8af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1283('0x0'));var zipdir=require(_0x1283('0x1'));var moment=require(_0x1283('0x2'));var BPromise=require('bluebird');var util=require(_0x1283('0x3'));var path=require(_0x1283('0x4'));var fs=require('fs');var _=require(_0x1283('0x5'));var squel=require(_0x1283('0x6'));var juice=require(_0x1283('0x7'));var Redis=require(_0x1283('0x8'));var qs=require(_0x1283('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x1283('0xa'))('api');var config=require(_0x1283('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x1283('0xc')]=_[_0x1283('0xd')](config[_0x1283('0xc')],{'host':_0x1283('0xe'),'port':0x18eb});var socket=require(_0x1283('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x44c1ca,_0x47ed48){_0x47ed48=_0x47ed48||0xcc;return function(_0x1710b9){if(_0x1710b9){return _0x44c1ca[_0x1283('0x10')](_0x47ed48);}return _0x44c1ca[_0x1283('0x11')](_0x47ed48)['end']();};}function respondWithResult(_0x24c437,_0x21f6dd){_0x21f6dd=_0x21f6dd||0xc8;return function(_0x2667be){if(_0x2667be){return _0x24c437[_0x1283('0x11')](_0x21f6dd)['json'](_0x2667be);}};}function respondWithFilteredResult(_0xd383b0,_0x2ebbd3){return function(_0x43a3ab){if(_0x43a3ab){var _0xb45b2c=typeof _0x2ebbd3[_0x1283('0x12')]===_0x1283('0x13')&&typeof _0x2ebbd3[_0x1283('0x14')]===_0x1283('0x13');var _0x1ed12d=_0x43a3ab[_0x1283('0x15')];var _0xa89652=_0xb45b2c?0x0:_0x2ebbd3[_0x1283('0x12')];var _0x209f7f=_0xb45b2c?_0x43a3ab[_0x1283('0x15')]:_0x2ebbd3[_0x1283('0x12')]+_0x2ebbd3[_0x1283('0x14')];var _0x56b72a;if(_0x209f7f>=_0x1ed12d){_0x209f7f=_0x1ed12d;_0x56b72a=0xc8;}else{_0x56b72a=0xce;}_0xd383b0[_0x1283('0x11')](_0x56b72a);return _0xd383b0['set'](_0x1283('0x16'),_0xa89652+'-'+_0x209f7f+'/'+_0x1ed12d)[_0x1283('0x17')](_0x43a3ab);}return null;};}function saveUpdates(_0x26ff6a){return function(_0x32769c){if(_0x32769c){return _0x32769c[_0x1283('0x18')](_0x26ff6a)[_0x1283('0x19')](function(_0x3ac651){return _0x3ac651;});}return null;};}function removeEntity(_0x448c56){return function(_0x932baf){if(_0x932baf){return _0x932baf[_0x1283('0x1a')]()[_0x1283('0x19')](function(){_0x448c56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe5ad){return function(_0x32d844){if(!_0x32d844){_0x3fe5ad[_0x1283('0x10')](0x194);}return _0x32d844;};}function handleError(_0x21f778,_0x177e74){_0x177e74=_0x177e74||0x1f4;return function(_0xc5cbaf){logger[_0x1283('0x1b')](_0xc5cbaf[_0x1283('0x1c')]);if(_0xc5cbaf[_0x1283('0x1d')]){delete _0xc5cbaf[_0x1283('0x1d')];}_0x21f778['status'](_0x177e74)[_0x1283('0x1e')](_0xc5cbaf);};}function getInteractionUsers(_0x4dfcfa,_0x5b0314){return new BPromise(function(_0x5e115e,_0x393aea){try{if(_0x5b0314[_0x4dfcfa['id']]){_0x4dfcfa[_0x1283('0x1f')]=_[_0x1283('0x20')](_0x5b0314[_0x4dfcfa['id']],function(_0x5cd6f3){return{'id':_0x5cd6f3['id'],'fullname':_0x5cd6f3[_0x1283('0x21')]};});}}catch(_0x4107f7){_0x393aea(_0x4107f7);}_0x5e115e(_0x4dfcfa);});}function getInteractionTags(_0x43b0fc,_0x22aade){return new BPromise(function(_0x466146,_0x17e52a){try{if(_0x43b0fc[_0x1283('0x22')]){_0x43b0fc[_0x1283('0x23')]=[];_0x43b0fc[_0x1283('0x22')][_0x1283('0x24')](',')['forEach'](function(_0x40f815){_0x43b0fc[_0x1283('0x23')][_0x1283('0x25')](_0x22aade[_0x40f815]);});}delete _0x43b0fc['TagIds'];}catch(_0x4ece08){_0x17e52a(_0x4ece08);}_0x466146(_0x43b0fc);});}function getLastMessageText(_0x4bf813){return new BPromise(function(_0xc39864,_0x2ad51e){return db[_0x1283('0x26')][_0x1283('0x27')]({'where':{'$and':[{'MailInteractionId':_0x4bf813['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1283('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1283('0x29')],'order':_0x1283('0x2a'),'raw':!![]})[_0x1283('0x19')](function(_0x2f8e00){if(_0x2f8e00&&_0x2f8e00['plainBody']){_0x4bf813[_0x1283('0x2b')]=_[_0x1283('0x2c')](_0x2f8e00[_0x1283('0x29')]);}_0xc39864(_0x4bf813);})[_0x1283('0x2d')](function(_0x38d7f2){_0x2ad51e(_0x38d7f2);});});}function updateMailInteraction(_0x4cd5cd,_0xf248a4,_0x5859b1,_0x4af4de){return new BPromise(function(_0x38604f,_0x2326d0){return getInteractionUsers(_0x4cd5cd,_0x5859b1)[_0x1283('0x19')](function(_0x1a5379){return getInteractionTags(_0x1a5379,_0xf248a4);})[_0x1283('0x19')](function(_0x1fd68a){return getStateInteraction(_0x1fd68a);})['then'](function(_0x173708){if(_0x4af4de){_0x38604f(getLastMessageText(_0x173708));}else{_0x38604f(_0x173708);}})['catch'](function(_0x17d597){_0x2326d0(_0x17d597);});});}function getStateInteraction(_0x50ca41){return new BPromise(function(_0x2154c6){_0x50ca41[_0x1283('0x2e')]=0x0;_0x50ca41['talking']=0x0;_0x50ca41[_0x1283('0x2f')]=0x0;_0x50ca41['unmanaged']=0x0;_0x50ca41[_0x1283('0x30')]=0x0;if(!_0x50ca41[_0x1283('0x31')]&&!_0x50ca41[_0x1283('0x32')]){_0x50ca41['waiting']+=0x1;}if(!_0x50ca41['closed']&&_0x50ca41[_0x1283('0x32')]){_0x50ca41['talking']+=0x1;if(_0x50ca41[_0x1283('0x2e')]){_0x50ca41[_0x1283('0x2e')]-=0x1;}}if(_0x50ca41[_0x1283('0x31')]&&_0x50ca41[_0x1283('0x32')]){_0x50ca41['answered']+=0x1;if(_0x50ca41[_0x1283('0x33')]){_0x50ca41[_0x1283('0x33')]-=0x1;}}if(_0x50ca41[_0x1283('0x31')]&&!_0x50ca41[_0x1283('0x32')]){_0x50ca41[_0x1283('0x34')]+=0x1;if(_0x50ca41[_0x1283('0x2e')]){_0x50ca41['waiting']-=0x1;}}_0x50ca41['total']+=0x1;_0x2154c6(_0x50ca41);});}exports['index']=function(_0x4b8d6f,_0x20fcb2){var _0x258569={},_0x2d5e29={},_0x179324={'count':0x0,'rows':[]};var _0x41d2ac=_['map'](db[_0x1283('0x35')][_0x1283('0x36')],function(_0x255607){return{'name':_0x255607[_0x1283('0x37')],'type':_0x255607[_0x1283('0x38')][_0x1283('0x39')]};});_0x2d5e29[_0x1283('0x3a')]=_[_0x1283('0x20')](_0x41d2ac,'name');_0x2d5e29[_0x1283('0x3b')]=_[_0x1283('0x3c')](_0x4b8d6f[_0x1283('0x3b')]);_0x2d5e29[_0x1283('0x3d')]=_[_0x1283('0x3e')](_0x2d5e29[_0x1283('0x3a')],_0x2d5e29[_0x1283('0x3b')]);_0x258569[_0x1283('0x3f')]=_[_0x1283('0x3e')](_0x2d5e29[_0x1283('0x3a')],qs[_0x1283('0x40')](_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x40')]));_0x258569['attributes']=_0x258569[_0x1283('0x3f')]['length']?_0x258569['attributes']:_0x2d5e29[_0x1283('0x3a')];if(!_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x41')](_0x1283('0x42'))){_0x258569[_0x1283('0x14')]=qs[_0x1283('0x14')](_0x4b8d6f['query']['limit']);_0x258569[_0x1283('0x12')]=qs[_0x1283('0x12')](_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x12')]);}_0x258569[_0x1283('0x43')]=qs[_0x1283('0x44')](_0x4b8d6f['query'][_0x1283('0x44')]);_0x258569[_0x1283('0x45')]=qs[_0x1283('0x3d')](_[_0x1283('0x46')](_0x4b8d6f[_0x1283('0x3b')],_0x2d5e29[_0x1283('0x3d')]),_0x41d2ac);var _0x3ae195=[];var _0x25102e=squel['select']()[_0x1283('0x47')]('id')[_0x1283('0x47')](_0x1283('0x1d'))[_0x1283('0x47')](_0x1283('0x48'))[_0x1283('0x49')](_0x1283('0x4a'));var _0x1b834a=squel[_0x1283('0x4b')]()[_0x1283('0x47')]('u.id')[_0x1283('0x47')](_0x1283('0x4c'))[_0x1283('0x47')](_0x1283('0x4d'))['from']('user_has_mail_interactions','ui')[_0x1283('0x4e')](_0x1283('0x4f'),'u',_0x1283('0x50'));var _0x51f750=squel[_0x1283('0x4b')]()[_0x1283('0x49')](_0x1283('0x51'),'i')[_0x1283('0x4e')](_0x1283('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1283('0x4e')](_0x1283('0x4f'),'o',_0x1283('0x53'))[_0x1283('0x4e')](_0x1283('0x54'),'a','a.id\x20=\x20i.MailAccountId')[_0x1283('0x4e')](_0x1283('0x55'),'me',_0x1283('0x56'))[_0x1283('0x4e')](_0x1283('0x57'),'it','it.MailInteractionId\x20=\x20i.id')[_0x1283('0x4e')]('tools_tags','t',_0x1283('0x58'));var _0x42eb53=squel['expr']();var _0x560645=[];var _0x55c7c8=squel[_0x1283('0x59')]();var _0x126ea2;if(_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x5a')]){_0x126ea2=as['parseSearch'](_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x5a')]);var _0x938392=_0x126ea2[_0x1283('0x5b')];for(var _0x558c0e=0x0;_0x558c0e<_0x126ea2['conditions']['length'];_0x558c0e++){var _0x31b15d=_0x126ea2[_0x1283('0x5c')][_0x558c0e];var _0x7a6b4d='i';var _0x69ad99=_[_0x1283('0x5d')](_0x41d2ac,[_0x1283('0x1d'),_0x31b15d[_0x1283('0x47')]]);if(!_0x69ad99){switch(_0x31b15d[_0x1283('0x47')]){case _0x1283('0x5e'):if(_0x31b15d[_0x1283('0x5f')]==0x1){_0x51f750[_0x1283('0x60')]('`'+_0x31b15d[_0x1283('0x47')]+'`\x20=\x200');}else{_0x51f750[_0x1283('0x60')]('`'+_0x31b15d[_0x1283('0x47')]+'`\x20>\x200');}break;case _0x1283('0x61'):if(_0x31b15d['operator']===_0x1283('0x62')){if(_0x31b15d[_0x1283('0x5f')][_0x1283('0x24')]('\x20')[_0x1283('0x63')]>0x1){_0x42eb53[_0x938392](_0x1283('0x64'),qs[_0x1283('0x65')](_0x31b15d['value']),null);}else{var _0x1c309e='%'+_0x31b15d[_0x1283('0x5f')]+'%';_0x42eb53[_0x938392](_0x1283('0x66'),_0x1c309e,_0x1c309e,_0x1c309e);}}else{_0x69ad99=_['find'](_0x41d2ac,[_0x1283('0x1d'),_0x1283('0x67')]);_0x31b15d[_0x1283('0x47')]=_0x1283('0x67');_0x598fe4=as[_0x1283('0x68')](_0x7a6b4d,_0x69ad99[_0x1283('0x38')],_0x31b15d);_0x42eb53[_0x938392](_0x598fe4['text'],_0x598fe4['value'][_0x1283('0x69')],_0x598fe4['value'][_0x1283('0x6a')]);}break;case _0x1283('0x6b'):var _0x43dc6a=_0x31b15d[_0x1283('0x5f')][_0x1283('0x24')](',')['map'](function(_0x383f26){return Number(_0x383f26);});_0x43dc6a[_0x1283('0x6c')](function(_0xb870e){_0x55c7c8['or'](_0x1283('0x6d'),'%,'+_0xb870e+',%');});_0x560645=_[_0x1283('0x6e')](_0x560645,_0x43dc6a);break;case _0x1283('0x6f'):if(_0x31b15d[_0x1283('0x70')]===_0x1283('0x62')){_0x42eb53[_0x938392](_0x1283('0x71'),'%'+_0x31b15d[_0x1283('0x5f')]+'%',null);}else{_0x69ad99=_[_0x1283('0x5d')](_0x41d2ac,[_0x1283('0x1d'),_0x1283('0x32')]);_0x31b15d[_0x1283('0x47')]='UserId';_0x598fe4=as[_0x1283('0x68')](_0x7a6b4d,_0x69ad99[_0x1283('0x38')],_0x31b15d);_0x42eb53[_0x938392](_0x598fe4['text'],_0x598fe4['value'][_0x1283('0x69')],_0x598fe4[_0x1283('0x5f')]['end']);}break;case _0x1283('0x29'):_0x598fe4=as[_0x1283('0x68')]('me',null,_0x31b15d);_0x42eb53[_0x938392](_0x598fe4[_0x1283('0x72')],_0x598fe4['value'][_0x1283('0x69')],_0x598fe4[_0x1283('0x5f')][_0x1283('0x6a')]);break;}}else{var _0x598fe4=as[_0x1283('0x68')](_0x7a6b4d,_0x69ad99[_0x1283('0x38')],_0x31b15d);_0x42eb53[_0x938392](_0x598fe4[_0x1283('0x72')],_0x598fe4[_0x1283('0x5f')]['start'],_0x598fe4['value'][_0x1283('0x6a')]);}}}else{var _0xd157c8=_(_0x4b8d6f[_0x1283('0x3b')])['keys']()[_0x1283('0x20')](function(_0xd7f995){return _['some'](_0x41d2ac,[_0x1283('0x1d'),_0xd7f995])?_0xd7f995:undefined;})['compact']()[_0x1283('0x5f')]();if(!_[_0x1283('0x73')](_0xd157c8)){_0xd157c8[_0x1283('0x6c')](function(_0x5b210c){if(_0x5b210c===_0x1283('0x74')){_0x51f750[_0x1283('0x45')](_0x1283('0x75'),[]['concat'](_0x4b8d6f[_0x1283('0x3b')][_0x5b210c]));}else if(_0x5b210c==='createdAt'){var _0x37d04a=JSON['parse'](_0x4b8d6f['query'][_0x5b210c])[_0x1283('0x76')];var _0x3569b5=JSON[_0x1283('0x77')](_0x4b8d6f['query'][_0x5b210c])[_0x1283('0x78')];_0x51f750['where'](_0x1283('0x79'),_0x37d04a,_0x3569b5);}else{if(_0x4b8d6f[_0x1283('0x3b')][_0x5b210c]===_0x1283('0x7a')){_0x51f750[_0x1283('0x45')]('i.'+_0x5b210c+_0x1283('0x7b'));}else{_0x51f750[_0x1283('0x45')]('i.'+_0x5b210c+_0x1283('0x7c'),_0x4b8d6f['query'][_0x5b210c]);}}});}if(_0x4b8d6f[_0x1283('0x3b')]['read']){if(_0x4b8d6f[_0x1283('0x3b')]['read']==0x1){_0x51f750[_0x1283('0x60')]('`unreadMessages`\x20=\x200');}else{_0x51f750[_0x1283('0x60')](_0x1283('0x7d'));}}if(_0x4b8d6f['query'][_0x1283('0x7e')]){_0x560645=_[_0x1283('0x7f')](_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x7e')])?_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x7e')]:new Array(_0x4b8d6f['query'][_0x1283('0x7e')]);_0x560645['forEach'](function(_0x56b3be){_0x55c7c8['or'](_0x1283('0x6d'),'%,'+_0x56b3be+',%');});}if(_0x4b8d6f['query'][_0x1283('0x80')]){var _0x19eb58=_0x4b8d6f['query'][_0x1283('0x80')][_0x1283('0x81')]('\x5c','\x5c\x5c')[_0x1283('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x19eb58)){_0x42eb53['or']('i.id\x20LIKE\x20?',_0x19eb58+'%');}else if(qs['isEmail'](_0x19eb58)){_0x42eb53['or'](_0x1283('0x82'),_0x19eb58+'%');}else{_0x42eb53['or'](_0x1283('0x83'),qs['getFullTextValue'](_0x19eb58))['or'](_0x1283('0x84'),qs[_0x1283('0x65')](_0x19eb58));}}}_0x51f750[_0x1283('0x45')](_0x42eb53);_0x51f750[_0x1283('0x85')](_0x1283('0x86'));var _0x25aa41={'type':db[_0x1283('0x87')][_0x1283('0x88')]['SELECT'],'raw':!![]};var _0x351b1b=_0x51f750['clone']();_0x351b1b[_0x1283('0x47')](_0x1283('0x86'));_0x351b1b[_0x1283('0x47')](_0x1283('0x89'),_0x1283('0x5e'));if(_0x258569[_0x1283('0x43')]){_0x258569[_0x1283('0x43')][_0x1283('0x6c')](function(_0x4c7744){var _0x24e1e8=_0x4c7744[0x0]==='contactName'?_0x4c7744[0x0]:'i.'+_0x4c7744[0x0];_0x51f750['order'](_0x24e1e8,_0x4c7744[0x1]===_0x1283('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x560645)){_0x51f750[_0x1283('0x60')](_0x55c7c8);_0x351b1b[_0x1283('0x45')]('t.id\x20IN\x20?',_0x560645);}BPromise[_0x1283('0x8b')]()['then'](function(){if(!_0x126ea2){if(_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x74')])return;_0x351b1b['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x51f750[_0x1283('0x45')](_0x1283('0x8c'));return;}if(_0x4b8d6f['user'][_0x1283('0x8d')]!==_0x1283('0x8e'))return;return _0x4b8d6f[_0x1283('0x8f')][_0x1283('0x90')]({'attributes':['id'],'raw':!![]})[_0x1283('0x19')](function(_0x1524c5){if(_['isEmpty'](_0x1524c5)){_0x351b1b[_0x1283('0x45')](_0x1283('0x91'));_0x51f750[_0x1283('0x45')]('i.MailAccountId\x20IS\x20NULL');}else{_0x351b1b[_0x1283('0x45')](_0x1283('0x75'),_[_0x1283('0x20')](_0x1524c5,'id'));_0x51f750[_0x1283('0x45')](_0x1283('0x75'),_[_0x1283('0x20')](_0x1524c5,'id'));}});})[_0x1283('0x19')](function(){if(_0x4b8d6f[_0x1283('0x8f')][_0x1283('0x8d')]==='agent'&&!_0x126ea2&&!_0x4b8d6f[_0x1283('0x3b')][_0x1283('0x74')])return[];return db[_0x1283('0x92')][_0x1283('0x3b')](_0x351b1b[_0x1283('0x93')](),_0x25aa41);})[_0x1283('0x19')](function(_0x30d1ec){_0x179324[_0x1283('0x15')]=_0x30d1ec[_0x1283('0x63')];if(_0x179324[_0x1283('0x15')]===0x0)return[];return db[_0x1283('0x92')]['query'](_0x25102e['toString'](),_0x25aa41)['then'](function(_0x4610ac){_0x3ae195=_[_0x1283('0x94')](_0x4610ac,'id');_0x25aa41=_['merge'](_0x25aa41,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b8d6f['query'][_0x1283('0x40')]){_0x258569['attributes'][_0x1283('0x6c')](function(_0x31c440){_0x51f750['field']('i.'+_0x31c440);});}else{_0x51f750['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1283('0x5e'));_0x51f750[_0x1283('0x47')](_0x1283('0x95'),_0x1283('0x96'));_0x51f750[_0x1283('0x47')](_0x1283('0x97'),_0x1283('0x98'));_0x51f750[_0x1283('0x47')](_0x1283('0x99'),_0x1283('0x9a'));_0x51f750[_0x1283('0x47')](_0x1283('0x9b'),_0x1283('0x9c'));_0x51f750[_0x1283('0x47')]('i.id');_0x51f750['field'](_0x1283('0x9d'));_0x51f750[_0x1283('0x47')](_0x1283('0x9e'));_0x51f750[_0x1283('0x47')](_0x1283('0x9f'));_0x51f750[_0x1283('0x47')](_0x1283('0xa0'));_0x51f750[_0x1283('0x47')]('i.attach');_0x51f750[_0x1283('0x47')](_0x1283('0xa1'));_0x51f750[_0x1283('0x47')]('i.lastMsgDirection');_0x51f750[_0x1283('0x47')](_0x1283('0xa2'));_0x51f750['field'](_0x1283('0xa3'));_0x51f750[_0x1283('0x47')](_0x1283('0xa4'));_0x51f750[_0x1283('0x47')]('i.thirdDisposition');_0x51f750[_0x1283('0x47')](_0x1283('0xa5'));_0x51f750[_0x1283('0x47')]('i.to');_0x51f750[_0x1283('0x47')](_0x1283('0xa6'));_0x51f750[_0x1283('0x47')](_0x1283('0xa7'));_0x51f750[_0x1283('0x47')](_0x1283('0xa8'));_0x51f750[_0x1283('0x47')](_0x1283('0xa9'),_0x1283('0xaa'));_0x51f750[_0x1283('0x47')](_0x1283('0xab'),_0x1283('0xac'));_0x51f750['field'](_0x1283('0xad'),'Contact.email');_0x51f750[_0x1283('0x47')](_0x1283('0xae'),_0x1283('0xaf'));_0x51f750[_0x1283('0x47')](_0x1283('0xb0'),'Contact.mobile');_0x51f750[_0x1283('0x47')](_0x1283('0xb1'),_0x1283('0xb2'));_0x51f750['field']('o.fullname','Owner.fullname');_0x51f750['field'](_0x1283('0xb3'),'Owner.internal');_0x51f750[_0x1283('0x47')](_0x1283('0xb4'),_0x1283('0x22'));}if(_0x258569[_0x1283('0x14')])_0x51f750['limit'](_0x258569['limit']);if(_0x258569[_0x1283('0x12')])_0x51f750[_0x1283('0x12')](_0x258569[_0x1283('0x12')]);return db[_0x1283('0x92')][_0x1283('0x3b')](_0x51f750[_0x1283('0x93')](),_0x25aa41);})[_0x1283('0x19')](function(_0x2abe87){if(_0x2abe87[_0x1283('0x63')]>0x0)_0x1b834a[_0x1283('0x45')](_0x1283('0xb5'),_['map'](_0x2abe87,'id'));return db[_0x1283('0x92')]['query'](_0x1b834a[_0x1283('0x93')](),_0x25aa41)[_0x1283('0x19')](function(_0x28b1aa){var _0x43a31d=_[_0x1283('0xb6')](_0x28b1aa,_0x1283('0xb7'));var _0x3d263d=[];return db[_0x1283('0xb8')][_0x1283('0x27')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x4fcb7a){var _0x1c3b88=_0x4fcb7a[_0x1283('0xb9')];_0x2abe87[_0x1283('0x6c')](function(_0x5cdcfe){_0x3d263d[_0x1283('0x25')](updateMailInteraction(_0x5cdcfe,_0x3ae195,_0x43a31d,_0x1c3b88));});return BPromise[_0x1283('0xba')](_0x3d263d);});});});})[_0x1283('0x19')](function(_0x4372dc){_0x179324[_0x1283('0xbb')]=_0x4372dc;return _0x179324;})['then'](respondWithFilteredResult(_0x20fcb2,_0x258569))[_0x1283('0x2d')](handleError(_0x20fcb2,null));};exports[_0x1283('0xbc')]=function(_0x1ce31e,_0xcbc7b9){var _0x356b15={'raw':![],'where':{'id':_0x1ce31e[_0x1283('0xbd')]['id']}},_0xa089f5={};_0xa089f5[_0x1283('0x3a')]=_['keys'](db[_0x1283('0x35')][_0x1283('0x36')]);_0xa089f5[_0x1283('0x3b')]=_[_0x1283('0x3c')](_0x1ce31e[_0x1283('0x3b')]);_0xa089f5[_0x1283('0x3d')]=_[_0x1283('0x3e')](_0xa089f5[_0x1283('0x3a')],_0xa089f5[_0x1283('0x3b')]);_0x356b15['attributes']=_['intersection'](_0xa089f5['model'],qs[_0x1283('0x40')](_0x1ce31e[_0x1283('0x3b')]['fields']));_0x356b15['attributes']=_0x356b15[_0x1283('0x3f')]['length']?_0x356b15[_0x1283('0x3f')]:_0xa089f5[_0x1283('0x3a')];if(_0x1ce31e[_0x1283('0x3b')][_0x1283('0xbe')]){_0x356b15[_0x1283('0xbf')]=[{'all':!![]}];}_0x356b15=_[_0x1283('0xc0')]({},_0x356b15,_0x1ce31e['options']);return db[_0x1283('0x35')][_0x1283('0x5d')](_0x356b15)[_0x1283('0x19')](handleEntityNotFound(_0xcbc7b9,null))['then'](respondWithResult(_0xcbc7b9,null))[_0x1283('0x2d')](handleError(_0xcbc7b9,null));};exports[_0x1283('0xc1')]=function(_0x592b06,_0x23d0a1){return db[_0x1283('0x35')]['create'](_0x592b06[_0x1283('0xc2')],{})['then'](respondWithResult(_0x23d0a1,0xc9))[_0x1283('0x2d')](handleError(_0x23d0a1,null));};exports[_0x1283('0x18')]=function(_0x3965a5,_0x37f3fd){if(_0x3965a5[_0x1283('0xc2')]['id']){delete _0x3965a5[_0x1283('0xc2')]['id'];}return db[_0x1283('0x35')][_0x1283('0x5d')]({'where':{'id':_0x3965a5[_0x1283('0xbd')]['id']}})[_0x1283('0x19')](handleEntityNotFound(_0x37f3fd,null))[_0x1283('0x19')](saveUpdates(_0x3965a5[_0x1283('0xc2')],null))[_0x1283('0x19')](respondWithResult(_0x37f3fd,null))[_0x1283('0x2d')](handleError(_0x37f3fd,null));};exports[_0x1283('0x1a')]=function(_0x13aea3,_0x33ca90){return db[_0x1283('0x35')]['find']({'where':{'id':_0x13aea3[_0x1283('0xbd')]['id']}})[_0x1283('0x19')](handleEntityNotFound(_0x33ca90,null))['then'](removeEntity(_0x33ca90,null))[_0x1283('0x2d')](handleError(_0x33ca90,null));};exports[_0x1283('0xc3')]=function(_0x24c69a,_0xd058a8){return db[_0x1283('0x35')]['describe']()[_0x1283('0x19')](respondWithResult(_0xd058a8,null))[_0x1283('0x2d')](handleError(_0xd058a8,null));};exports[_0x1283('0xc4')]=function(_0x3fd23c,_0x254f33){return db['MailMessage']['find']({'where':{'id':_0x3fd23c['params']['id']}})[_0x1283('0x19')](handleEntityNotFound(_0x254f33,null))[_0x1283('0x19')](function(_0x2ef8a4){if(_0x2ef8a4){return _0x2ef8a4[_0x1283('0xc4')](_0x3fd23c[_0x1283('0xc2')][_0x1283('0xc5')],_[_0x1283('0xc6')](_0x3fd23c[_0x1283('0xc2')],[_0x1283('0xc5'),'id'])||{});}})['then'](respondWithResult(_0x254f33,null))['catch'](handleError(_0x254f33,null));};exports['getMessages']=function(_0x3a112c,_0x48feb7){var _0x30378a={'raw':![],'where':{}};var _0x223aea={};var _0x15a9ca={'count':0x0,'rows':[]};return db[_0x1283('0x35')][_0x1283('0x27')]({'where':{'id':_0x3a112c[_0x1283('0xbd')]['id']}})[_0x1283('0x19')](handleEntityNotFound(_0x48feb7,null))['then'](function(_0x47ea27){if(_0x47ea27){_0x223aea[_0x1283('0x3a')]=_[_0x1283('0x3c')](db[_0x1283('0x26')]['rawAttributes']);_0x223aea[_0x1283('0x3b')]=_['keys'](_0x3a112c[_0x1283('0x3b')]);_0x223aea[_0x1283('0x3d')]=_[_0x1283('0x3e')](_0x223aea['model'],_0x223aea[_0x1283('0x3b')]);_0x30378a[_0x1283('0x3f')]=_[_0x1283('0x3e')](_0x223aea[_0x1283('0x3a')],qs['fields'](_0x3a112c[_0x1283('0x3b')]['fields']));_0x30378a['attributes']=_0x30378a[_0x1283('0x3f')]['length']?_0x30378a['attributes']:_0x223aea[_0x1283('0x3a')];if(!_0x3a112c[_0x1283('0x3b')][_0x1283('0x41')]('nolimit')){_0x30378a[_0x1283('0x14')]=qs['limit'](_0x3a112c[_0x1283('0x3b')][_0x1283('0x14')]);_0x30378a[_0x1283('0x12')]=qs['offset'](_0x3a112c[_0x1283('0x3b')][_0x1283('0x12')]);}_0x30378a[_0x1283('0x43')]=qs['sort'](_0x3a112c[_0x1283('0x3b')][_0x1283('0x44')]);_0x30378a[_0x1283('0x45')]=qs['filters'](_[_0x1283('0x46')](_0x3a112c['query'],_0x223aea[_0x1283('0x3d')]));_0x30378a[_0x1283('0x45')]['MailInteractionId']=_0x47ea27['id'];if(_0x3a112c[_0x1283('0x3b')]['filter']){_0x30378a[_0x1283('0x45')]=_[_0x1283('0xc0')](_0x30378a[_0x1283('0x45')],{'$or':_['map'](_0x30378a[_0x1283('0x3f')],function(_0xbb67b0){var _0x414ef7={};_0x414ef7[_0xbb67b0]={'$like':'%'+_0x3a112c[_0x1283('0x3b')][_0x1283('0x80')]+'%'};return _0x414ef7;})});}if(_0x3a112c[_0x1283('0x3b')]['$gte']){var _0x57dcc3=_0x3a112c['query'][_0x1283('0x76')]['split'](',');var _0x29f181={};_0x29f181[_0x57dcc3[0x0]]={'$gte':moment(_0x57dcc3[0x1])[_0x1283('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30378a[_0x1283('0x45')]=_[_0x1283('0xc0')](_0x30378a[_0x1283('0x45')],_0x29f181);}_0x30378a=_[_0x1283('0xc0')]({},_0x30378a,_0x3a112c[_0x1283('0xc8')]);return db['MailMessage'][_0x1283('0x15')]({'where':_0x30378a[_0x1283('0x45')]})[_0x1283('0x19')](function(_0x37dd43){_0x15a9ca[_0x1283('0x15')]=_0x37dd43;if(_0x3a112c[_0x1283('0x3b')][_0x1283('0xbe')]){_0x30378a[_0x1283('0xbf')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x30378a);})[_0x1283('0x19')](function(_0x6fb15){if(_0x3a112c[_0x1283('0x3b')][_0x1283('0xc9')]==='true'){for(var _0x38a9ba=0x0;_0x38a9ba<_0x6fb15[_0x1283('0x63')];_0x38a9ba++){_0x6fb15[_0x38a9ba][_0x1283('0xc2')]=juice(_0x6fb15[_0x38a9ba][_0x1283('0xc2')]);}}_0x15a9ca[_0x1283('0xbb')]=_0x6fb15;return _0x15a9ca;});}})[_0x1283('0x19')](respondWithFilteredResult(_0x48feb7,_0x30378a))['catch'](handleError(_0x48feb7,null));};exports[_0x1283('0xca')]=function(_0x4e1438,_0x5f5889){return db[_0x1283('0x35')]['find']({'where':{'id':_0x4e1438[_0x1283('0xbd')]['id']}})[_0x1283('0x19')](handleEntityNotFound(_0x5f5889,null))[_0x1283('0x19')](function(_0x5e45df){if(_0x5e45df){return _0x5e45df['setTags'](_0x4e1438[_0x1283('0xc2')][_0x1283('0xc5')],_[_0x1283('0xc6')](_0x4e1438[_0x1283('0xc2')],[_0x1283('0xc5'),'id'])||{})[_0x1283('0xcb')](function(){return db[_0x1283('0x6b')][_0x1283('0xcc')]({'attributes':['id',_0x1283('0x1d'),_0x1283('0x48')],'where':{'id':_0x4e1438[_0x1283('0xc2')][_0x1283('0xc5')]}});})[_0x1283('0x19')](function(_0x55c616){socket[_0x1283('0xcd')]('mailInteractionTags:save',{'id':Number(_0x4e1438[_0x1283('0xbd')]['id']),'tags':_0x55c616||[]});return{'id':Number(_0x4e1438['params']['id']),'tags':_0x55c616||[]};});}})[_0x1283('0x19')](respondWithResult(_0x5f5889,null))['catch'](handleError(_0x5f5889,null));};exports[_0x1283('0xce')]=function(_0x2c00aa,_0x867683){return db[_0x1283('0x35')][_0x1283('0x5d')]({'where':{'id':_0x2c00aa[_0x1283('0xbd')]['id']}})['then'](handleEntityNotFound(_0x867683,null))[_0x1283('0x19')](function(_0x4b4f09){if(_0x4b4f09){return _0x4b4f09[_0x1283('0xce')](_0x2c00aa[_0x1283('0x3b')][_0x1283('0xc5')]);}})[_0x1283('0x19')](respondWithStatusCode(_0x867683,null))[_0x1283('0x2d')](handleError(_0x867683,null));};exports['download']=function(_0xb78466,_0x36f741){var _0x2a11c2=moment()[_0x1283('0xcf')]()['toString']();var _0x5538a5=path[_0x1283('0xd0')](config[_0x1283('0xd1')],'server',_0x1283('0xd2'),'tmp');var _0x402e4d=path['join'](config[_0x1283('0xd1')],_0x1283('0xd3'),_0x1283('0xd2'),'attachments');var _0x224f45=path['join'](_0x5538a5,_0x2a11c2);var _0xd39c8=util['format'](_0x1283('0xd4'),_0xb78466[_0x1283('0xbd')]['id'],_0x2a11c2);var _0x280dbb=path[_0x1283('0xd0')](_0x5538a5,_0xd39c8);var _0x9af242=[];if(_0xb78466['query'][_0x1283('0xd5')]){_0x9af242[_0x1283('0x25')]({'model':db[_0x1283('0xd6')],'as':_0x1283('0xd7'),'raw':!![]});}var _0x18336a=[{'model':db[_0x1283('0x26')],'as':_0x1283('0xd8'),'attributes':['id',_0x1283('0xc2'),'from','to','cc',_0x1283('0xd9'),_0x1283('0xda'),_0x1283('0xdb')],'where':{'secret':![]},'order':qs[_0x1283('0x44')]('id'),'include':_0x9af242}];return db[_0x1283('0x35')][_0x1283('0x5d')]({'where':{'id':_0xb78466[_0x1283('0xbd')]['id']},'include':_0x18336a})[_0x1283('0x19')](handleEntityNotFound(_0x36f741,null))['then'](function(_0x558eb4){if(_0x558eb4&&_0x558eb4[_0x1283('0xd8')]){var _0x18cc06=_0x558eb4[_0x1283('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x224f45);return BPromise[_0x1283('0xdd')](_0x18cc06[_0x1283('0xd8')],function(_0x378cf6,_0x4230f9){var _0x4f5f77={'from':_0x378cf6[_0x1283('0x49')],'to':_0x378cf6['to'],'subject':_0x378cf6['subject'],'html':htmlEntities[_0x1283('0xde')](_0x378cf6['body']),'headers':{'Date':moment(_0x378cf6['createdAt'])[_0x1283('0xc7')](_0x1283('0xdf'))},'attachments':[]};if(_0x378cf6['cc']){_0x4f5f77['headers']['Cc']=_0x378cf6['cc'];}if(_0x378cf6[_0x1283('0xd9')]){_0x4f5f77[_0x1283('0xe0')][_0x1283('0xe1')]=_0x378cf6[_0x1283('0xd9')];}return new BPromise(function(_0x46ed15,_0x3571f1){if(_0x378cf6['Attachments']){for(var _0xdc0544=0x0;_0xdc0544<_0x378cf6[_0x1283('0xd7')][_0x1283('0x63')];_0xdc0544++){var _0x1c8481=_0x378cf6[_0x1283('0xd7')][_0xdc0544];var _0x459d84=path[_0x1283('0xd0')](_0x402e4d,_0x1c8481[_0x1283('0xe2')]);if(fs[_0x1283('0xe3')](_0x459d84)){_0x4f5f77[_0x1283('0xd5')][_0x1283('0x25')]({'name':_0x1c8481[_0x1283('0x1d')],'contentType':_0x1c8481['type'],'data':fs[_0x1283('0xe4')](_0x459d84)});}}}emlformat[_0x1283('0xe5')](_0x4f5f77,function(_0xaf9c82,_0x5bd700){if(_0xaf9c82)return _0x3571f1(_0xaf9c82);fs[_0x1283('0xe6')](path[_0x1283('0xd0')](_0x224f45,util[_0x1283('0xc7')](_0x1283('0xe7'),_0x4230f9)),_0x5bd700);return _0x46ed15(_0x5bd700);});});})[_0x1283('0x19')](function(){return new BPromise(function(_0x3092ea,_0xafd0d9){zipdir(_0x224f45,{'saveTo':_0x280dbb},function(_0x157848,_0x1ad0fd){if(_0x157848)return _0xafd0d9(_0x157848);return _0x3092ea(_0x1ad0fd);});})[_0x1283('0x19')](function(){return new BPromise(function(_0x2a30a2,_0x4bb09d){rimraf(_0x224f45,function(_0x50146c){if(_0x50146c)_0x4bb09d(_0x50146c);return _0x2a30a2();});});})[_0x1283('0x19')](function(){return _0x36f741[_0x1283('0xe8')](_0x280dbb,_0xd39c8,function(_0x272d16){if(!_0x272d16)fs['unlinkSync'](_0x280dbb);});});});}else{return _0x36f741['sendStatus'](0xc8);}})[_0x1283('0x2d')](handleError(_0x36f741,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e7fe57b..d334b0f 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 _0x839d=['remove','then','Users','findAll','setDataValue','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x839d,0xfa));var _0xd839=function(_0x57f733,_0x3e33f6){_0x57f733=_0x57f733-0x0;var _0x3e4525=_0x839d[_0x57f733];return _0x3e4525;};'use strict';var EventEmitter=require(_0xd839('0x0'));var MailInteraction=require(_0xd839('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xd839('0x1'))['db'][_0xd839('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd839('0x3')](0x0);var events={'afterCreate':_0xd839('0x4'),'afterUpdate':_0xd839('0x5'),'afterDestroy':_0xd839('0x6')};function emitEvent(_0x525182){return function(_0x4d52ff,_0x5482f3,_0x5b5f20){_0x4d52ff['getUsers']({'attributes':['id'],'raw':!![]})[_0xd839('0x7')](function(_0x273df6){_0x4d52ff['setDataValue'](_0xd839('0x8'),_0x273df6['map'](function(_0xa53031){return{'id':_0xa53031['id']};}));return MailMessage[_0xd839('0x9')]({'where':{'MailInteractionId':_0x4d52ff['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd839('0x7')](function(_0x30f988){_0x4d52ff[_0xd839('0xa')](_0xd839('0xb'),_0x30f988[_0xd839('0xc')]);MailInteractionEvents[_0xd839('0xd')](_0x525182+':'+_0x4d52ff['id'],_0x4d52ff);MailInteractionEvents[_0xd839('0xd')](_0x525182,_0x4d52ff);_0x5b5f20(null);})['catch'](_0x5b5f20(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd839('0xe')](e,emitEvent(event));}}module[_0xd839('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x8948=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x8948,0x145));var _0x8894=function(_0x30896d,_0x4a77f5){_0x30896d=_0x30896d-0x0;var _0x643dbf=_0x8948[_0x30896d];return _0x643dbf;};'use strict';var EventEmitter=require(_0x8894('0x0'));var MailInteraction=require(_0x8894('0x1'))['db'][_0x8894('0x2')];var MailMessage=require(_0x8894('0x1'))['db'][_0x8894('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x8894('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8894('0x5'),'afterDestroy':_0x8894('0x6')};function emitEvent(_0x3bd500){return function(_0x3cd3d8,_0x1899f8,_0x3ed530){_0x3cd3d8[_0x8894('0x7')]({'attributes':['id'],'raw':!![]})[_0x8894('0x8')](function(_0x50dd37){_0x3cd3d8[_0x8894('0x9')](_0x8894('0xa'),_0x50dd37[_0x8894('0xb')](function(_0x50d763){return{'id':_0x50d763['id']};}));return MailMessage[_0x8894('0xc')]({'where':{'MailInteractionId':_0x3cd3d8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8894('0x8')](function(_0xf974f8){_0x3cd3d8[_0x8894('0x9')](_0x8894('0xd'),_0xf974f8[_0x8894('0xe')]);MailInteractionEvents[_0x8894('0xf')](_0x3bd500+':'+_0x3cd3d8['id'],_0x3cd3d8);MailInteractionEvents['emit'](_0x3bd500,_0x3cd3d8);_0x3ed530(null);})[_0x8894('0x10')](_0x3ed530(null));};}for(var e in events){if(events[_0x8894('0x11')](e)){var event=events[e];MailInteraction[_0x8894('0x12')](e,emitEvent(event));}}module[_0x8894('0x13')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 10cb35a..744583e 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 _0xd35b=['subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','update','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailInteraction'];(function(_0x179234,_0x36f9bf){var _0x584d64=function(_0x42f54d){while(--_0x42f54d){_0x179234['push'](_0x179234['shift']());}};_0x584d64(++_0x36f9bf);}(_0xd35b,0x13a));var _0xbd35=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xd35b[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xbd35('0x0'));var util=require(_0xbd35('0x1'));var logger=require('../../config/logger')(_0xbd35('0x2'));var moment=require(_0xbd35('0x3'));var BPromise=require(_0xbd35('0x4'));var rp=require(_0xbd35('0x5'));var fs=require('fs');var path=require(_0xbd35('0x6'));var rimraf=require(_0xbd35('0x7'));var config=require(_0xbd35('0x8'));var attributes=require('./mailInteraction.attributes');module[_0xbd35('0x9')]=function(_0x2ed506,_0x114ef2){return _0x2ed506['define'](_0xbd35('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xbd35('0xb'),'to'],'type':_0xbd35('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d8dcc,_0x265d9a,_0x45d1c9){if(_0x3d8dcc[_0xbd35('0xd')]){_0x3d8dcc[_0xbd35('0xe')]=moment()['format'](_0xbd35('0xf'));}if(_0x3d8dcc['closed']){_0x3d8dcc[_0xbd35('0x10')]=moment()[_0xbd35('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x45d1c9(null,_0x265d9a);},'beforeUpdate':function(_0x359493,_0x25c340,_0x5c9852){if(_0x359493[_0xbd35('0x12')](_0xbd35('0xd'))){_0x359493[_0xbd35('0xe')]=_0x359493[_0xbd35('0xd')]?moment()[_0xbd35('0x11')](_0xbd35('0xf')):null;}if(_0x359493['changed'](_0xbd35('0x13'))){_0x359493['closedAt']=moment()['format'](_0xbd35('0xf'));_0x359493['substatus']=null;_0x359493[_0xbd35('0xe')]=null;}_0x5c9852(null,_0x359493);},'afterUpdate':function(_0x42d1d9,_0x2554da,_0xd1c4a4){var _0x30a8d4=_0x2ed506[_0xbd35('0x14')];var _0x85c99e=_0x42d1d9[_0xbd35('0x15')]({'plain':!![]});if(_0x85c99e[_0xbd35('0x13')]){return _0x30a8d4['MailMessage'][_0xbd35('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x85c99e['id']}})['then'](function(){_0xd1c4a4();})[_0xbd35('0x17')](function(_0x39dac2){_0xd1c4a4(_0x39dac2);});}else{_0xd1c4a4();}}},'charset':_0xbd35('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0954=['../../config/environment','./mailInteraction.attributes','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','closed','MailMessage','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x0954,0x197));var _0x4095=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x0954[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0x4095('0x0'));var util=require(_0x4095('0x1'));var logger=require(_0x4095('0x2'))(_0x4095('0x3'));var moment=require(_0x4095('0x4'));var BPromise=require(_0x4095('0x5'));var rp=require(_0x4095('0x6'));var fs=require('fs');var path=require(_0x4095('0x7'));var rimraf=require(_0x4095('0x8'));var config=require(_0x4095('0x9'));var attributes=require(_0x4095('0xa'));module['exports']=function(_0x22d918,_0x7979f7){return _0x22d918['define']('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x4095('0xb'),'fields':[_0x4095('0xc'),'to'],'type':_0x4095('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4dd63e,_0xb9f1ca,_0x1575ab){if(_0x4dd63e[_0x4095('0xe')]){_0x4dd63e[_0x4095('0xf')]=moment()[_0x4095('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4dd63e['closed']){_0x4dd63e[_0x4095('0x11')]=moment()[_0x4095('0x10')](_0x4095('0x12'));}_0x1575ab(null,_0xb9f1ca);},'beforeUpdate':function(_0x49b901,_0x155c13,_0x3979bd){if(_0x49b901[_0x4095('0x13')](_0x4095('0xe'))){_0x49b901[_0x4095('0xf')]=_0x49b901[_0x4095('0xe')]?moment()[_0x4095('0x10')](_0x4095('0x12')):null;}if(_0x49b901[_0x4095('0x13')]('closed')){_0x49b901[_0x4095('0x11')]=moment()['format'](_0x4095('0x12'));_0x49b901[_0x4095('0xe')]=null;_0x49b901[_0x4095('0xf')]=null;}_0x3979bd(null,_0x49b901);},'afterUpdate':function(_0x519f60,_0x485b6f,_0x1039bc){var _0x238071=_0x22d918[_0x4095('0x14')];var _0x218d6a=_0x519f60[_0x4095('0x15')]({'plain':!![]});if(_0x218d6a[_0x4095('0x16')]){return _0x238071[_0x4095('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x218d6a['id']}})['then'](function(){_0x1039bc();})[_0x4095('0x18')](function(_0x258e6d){_0x1039bc(_0x258e6d);});}else{_0x1039bc();}}},'charset':_0x4095('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3d144eb..33d6687 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 _0x2afe=['then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','addTags','omit','ids','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request'];(function(_0x1ddeba,_0x34ab53){var _0x2ad9cd=function(_0x4ec4e2){while(--_0x4ec4e2){_0x1ddeba['push'](_0x1ddeba['shift']());}};_0x2ad9cd(++_0x34ab53);}(_0x2afe,0xbb));var _0xe2af=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2afe[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe2af('0x0'));var util=require('util');var moment=require(_0xe2af('0x1'));var BPromise=require(_0xe2af('0x2'));var rs=require(_0xe2af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2af('0x4'))['db'];var utils=require(_0xe2af('0x5'));var logger=require(_0xe2af('0x6'))(_0xe2af('0x7'));var config=require(_0xe2af('0x8'));var jayson=require(_0xe2af('0x9'));var client=jayson[_0xe2af('0xa')][_0xe2af('0xb')]({'port':0x232a});config[_0xe2af('0xc')]=_[_0xe2af('0xd')](config[_0xe2af('0xc')],{'host':_0xe2af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2af('0xc')]));require(_0xe2af('0xf'))[_0xe2af('0x10')](socket);function respondWithRpcPromise(_0x3eb026,_0x164cdb,_0x45f8bb){return new BPromise(function(_0x2a7ec5,_0x673fcb){return client[_0xe2af('0x11')](_0x3eb026,_0x45f8bb)[_0xe2af('0x12')](function(_0x30e839){logger['info'](_0xe2af('0x13'),_0x164cdb,'request\x20sent');logger[_0xe2af('0x14')](_0xe2af('0x15'),_0x164cdb,'request\x20sent',JSON['stringify'](_0x30e839));if(_0x30e839['error']){if(_0x30e839['error']['code']===0x1f4){logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error'][_0xe2af('0x17')]);return _0x673fcb(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error']['message']);return _0x2a7ec5(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}else{logger[_0xe2af('0x18')](_0xe2af('0x13'),_0x164cdb,_0xe2af('0x19'));_0x2a7ec5(_0x30e839['result'][_0xe2af('0x17')]);}})[_0xe2af('0x1a')](function(_0x4076fc){logger[_0xe2af('0x16')]('MailInteraction,\x20%s,\x20%s',_0x164cdb,_0x4076fc);_0x673fcb(_0x4076fc);});});}exports[_0xe2af('0x1b')]=function(_0x135df4){var _0x30c0a4=this;return new Promise(function(_0x3980f9,_0x4bd2e5){return db[_0xe2af('0x1c')]['update'](_0x135df4[_0xe2af('0x1d')],{'raw':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null,'attributes':_0x135df4[_0xe2af('0x1e')]?_0x135df4['options'][_0xe2af('0x21')]||null:null,'limit':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x22')]||null:null})[_0xe2af('0x12')](function(_0x732f88){logger[_0xe2af('0x18')]('UpdateMailInteraction',_0x135df4);logger[_0xe2af('0x14')](_0xe2af('0x1b'),_0x135df4,JSON[_0xe2af('0x23')](_0x732f88));_0x3980f9(_0x732f88);})[_0xe2af('0x1a')](function(_0x4b0000){logger['error'](_0xe2af('0x1b'),_0x4b0000[_0xe2af('0x17')],_0x135df4);_0x4bd2e5(_0x30c0a4[_0xe2af('0x16')](0x1f4,_0x4b0000[_0xe2af('0x17')]));});});};exports[_0xe2af('0x24')]=function(_0x4a744a){return new Promise(function(_0x5857e9,_0x541e42){return db[_0xe2af('0x1c')]['find']({'where':_0x4a744a['options']?_0x4a744a[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null})[_0xe2af('0x12')](function(_0x3921ff){if(_0x3921ff){return _0x3921ff[_0xe2af('0x25')](_0x4a744a['body']['ids'],_[_0xe2af('0x26')](_0x4a744a['body'],[_0xe2af('0x27'),'id'])||{});}})['spread'](function(_0x18455e){logger[_0xe2af('0x18')]('AddTags',_0x4a744a);logger[_0xe2af('0x14')](_0xe2af('0x28'),_0x4a744a,JSON[_0xe2af('0x23')](_0x18455e));_0x5857e9(_0x18455e);})[_0xe2af('0x1a')](function(_0x28fcfd){logger[_0xe2af('0x16')](_0xe2af('0x28'),_0x28fcfd[_0xe2af('0x17')],_0x4a744a);_0x541e42(_this[_0xe2af('0x16')](0x1f4,_0x28fcfd[_0xe2af('0x17')]));});});}; \ No newline at end of file +var _0x3d1f=['raw','attributes','AddTagsToMailInteraction','where','addTags','ids','omit','body','spread','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateMailInteraction','MailInteraction','update','options'];(function(_0x46476a,_0x509aee){var _0x16eec3=function(_0x3eacba){while(--_0x3eacba){_0x46476a['push'](_0x46476a['shift']());}};_0x16eec3(++_0x509aee);}(_0x3d1f,0xfb));var _0xf3d1=function(_0x1b9e41,_0x3122c6){_0x1b9e41=_0x1b9e41-0x0;var _0x3596d4=_0x3d1f[_0x1b9e41];return _0x3596d4;};'use strict';var _=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var moment=require(_0xf3d1('0x2'));var BPromise=require(_0xf3d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3d1('0x4'));var db=require(_0xf3d1('0x5'))['db'];var utils=require(_0xf3d1('0x6'));var logger=require(_0xf3d1('0x7'))(_0xf3d1('0x8'));var config=require(_0xf3d1('0x9'));var jayson=require(_0xf3d1('0xa'));var client=jayson['client'][_0xf3d1('0xb')]({'port':0x232a});config[_0xf3d1('0xc')]=_['defaults'](config[_0xf3d1('0xc')],{'host':_0xf3d1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3d1('0xc')]));require(_0xf3d1('0xe'))['register'](socket);function respondWithRpcPromise(_0x437516,_0x436b0c,_0x5f395f){return new BPromise(function(_0x4a5938,_0x25a664){return client[_0xf3d1('0xf')](_0x437516,_0x5f395f)[_0xf3d1('0x10')](function(_0x31bbc7){logger[_0xf3d1('0x11')](_0xf3d1('0x12'),_0x436b0c,_0xf3d1('0x13'));logger[_0xf3d1('0x14')](_0xf3d1('0x15'),_0x436b0c,'request\x20sent',JSON['stringify'](_0x31bbc7));if(_0x31bbc7['error']){if(_0x31bbc7['error']['code']===0x1f4){logger[_0xf3d1('0x16')]('MailInteraction,\x20%s,\x20%s',_0x436b0c,_0x31bbc7[_0xf3d1('0x16')][_0xf3d1('0x17')]);return _0x25a664(_0x31bbc7[_0xf3d1('0x16')][_0xf3d1('0x17')]);}logger[_0xf3d1('0x16')](_0xf3d1('0x12'),_0x436b0c,_0x31bbc7[_0xf3d1('0x16')][_0xf3d1('0x17')]);return _0x4a5938(_0x31bbc7['error'][_0xf3d1('0x17')]);}else{logger['info'](_0xf3d1('0x12'),_0x436b0c,_0xf3d1('0x13'));_0x4a5938(_0x31bbc7['result'][_0xf3d1('0x17')]);}})[_0xf3d1('0x18')](function(_0x57f538){logger[_0xf3d1('0x16')](_0xf3d1('0x12'),_0x436b0c,_0x57f538);_0x25a664(_0x57f538);});});}exports[_0xf3d1('0x19')]=function(_0x5f1d96){var _0x150833=this;return new Promise(function(_0x4439ce,_0x39297e){return db[_0xf3d1('0x1a')][_0xf3d1('0x1b')](_0x5f1d96['body'],{'raw':_0x5f1d96[_0xf3d1('0x1c')]?_0x5f1d96[_0xf3d1('0x1c')][_0xf3d1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1d96['options']?_0x5f1d96[_0xf3d1('0x1c')]['where']||null:null,'attributes':_0x5f1d96['options']?_0x5f1d96[_0xf3d1('0x1c')][_0xf3d1('0x1e')]||null:null,'limit':_0x5f1d96[_0xf3d1('0x1c')]?_0x5f1d96['options']['limit']||null:null})[_0xf3d1('0x10')](function(_0x15e7d7){logger['info'](_0xf3d1('0x19'),_0x5f1d96);logger[_0xf3d1('0x14')]('UpdateMailInteraction',_0x5f1d96,JSON['stringify'](_0x15e7d7));_0x4439ce(_0x15e7d7);})[_0xf3d1('0x18')](function(_0x421f90){logger['error'](_0xf3d1('0x19'),_0x421f90[_0xf3d1('0x17')],_0x5f1d96);_0x39297e(_0x150833['error'](0x1f4,_0x421f90[_0xf3d1('0x17')]));});});};exports[_0xf3d1('0x1f')]=function(_0x7205c1){return new Promise(function(_0x43bb6c,_0x44a6f7){return db[_0xf3d1('0x1a')]['find']({'where':_0x7205c1[_0xf3d1('0x1c')]?_0x7205c1[_0xf3d1('0x1c')][_0xf3d1('0x20')]||null:null})[_0xf3d1('0x10')](function(_0x5b9762){if(_0x5b9762){return _0x5b9762[_0xf3d1('0x21')](_0x7205c1['body'][_0xf3d1('0x22')],_[_0xf3d1('0x23')](_0x7205c1[_0xf3d1('0x24')],['ids','id'])||{});}})[_0xf3d1('0x25')](function(_0x34cd6a){logger[_0xf3d1('0x11')](_0xf3d1('0x26'),_0x7205c1);logger[_0xf3d1('0x14')](_0xf3d1('0x26'),_0x7205c1,JSON[_0xf3d1('0x27')](_0x34cd6a));_0x43bb6c(_0x34cd6a);})['catch'](function(_0x4eb614){logger[_0xf3d1('0x16')](_0xf3d1('0x26'),_0x4eb614[_0xf3d1('0x17')],_0x7205c1);_0x44a6f7(_this[_0xf3d1('0x16')](0x1f4,_0x4eb614[_0xf3d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6f608d3..033a602 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 _0xa93b=['update','emit','removeListener','register','length','./mailInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa93b,0x16d));var _0xba93=function(_0x5c6abd,_0x4b1082){_0x5c6abd=_0x5c6abd-0x0;var _0x4e09e=_0xa93b[_0x5c6abd];return _0x4e09e;};'use strict';var MailInteractionEvents=require(_0xba93('0x0'));var events=[_0xba93('0x1'),_0xba93('0x2'),_0xba93('0x3')];function createListener(_0x12d284,_0x273452){return function(_0x1a2d0d){_0x273452[_0xba93('0x4')](_0x12d284,_0x1a2d0d);};}function removeListener(_0x7e3db6,_0x2da7e7){return function(){MailInteractionEvents[_0xba93('0x5')](_0x7e3db6,_0x2da7e7);};}exports[_0xba93('0x6')]=function(_0x481d9f){for(var _0x5b4c44=0x0,_0x4b167c=events[_0xba93('0x7')];_0x5b4c44<_0x4b167c;_0x5b4c44++){var _0xea00af=events[_0x5b4c44];var _0x4bbee1=createListener('mailInteraction:'+_0xea00af,_0x481d9f);MailInteractionEvents['on'](_0xea00af,_0x4bbee1);}}; \ No newline at end of file +var _0xa310=['./mailInteraction.events','update','length','mailInteraction:'];(function(_0x39d980,_0x15c127){var _0x33fcbc=function(_0x32548a){while(--_0x32548a){_0x39d980['push'](_0x39d980['shift']());}};_0x33fcbc(++_0x15c127);}(_0xa310,0x19c));var _0x0a31=function(_0x3a1c21,_0x359c23){_0x3a1c21=_0x3a1c21-0x0;var _0x42fdf7=_0xa310[_0x3a1c21];return _0x42fdf7;};'use strict';var MailInteractionEvents=require(_0x0a31('0x0'));var events=['save','remove',_0x0a31('0x1')];function createListener(_0x56e269,_0x161153){return function(_0xffaf3f){_0x161153['emit'](_0x56e269,_0xffaf3f);};}function removeListener(_0x30a59b,_0x4bdc87){return function(){MailInteractionEvents['removeListener'](_0x30a59b,_0x4bdc87);};}exports['register']=function(_0x55f143){for(var _0x4f68d8=0x0,_0xf27cb3=events[_0x0a31('0x2')];_0x4f68d8<_0xf27cb3;_0x4f68d8++){var _0x2fbe46=events[_0x4f68d8];var _0x2beafa=createListener(_0x0a31('0x3')+_0x2fbe46,_0x55f143);MailInteractionEvents['on'](_0x2fbe46,_0x2beafa);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d04d6bf..e00e05a 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 _0x63ad=['index','/describe','describe','/:id','show','/:id/download','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','exports','util','path','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated'];(function(_0x2baa81,_0x2c18db){var _0x3c4eee=function(_0x3afa9b){while(--_0x3afa9b){_0x2baa81['push'](_0x2baa81['shift']());}};_0x3c4eee(++_0x2c18db);}(_0x63ad,0x7d));var _0xd63a=function(_0x40a050,_0x1f72d6){_0x40a050=_0x40a050-0x0;var _0x2dae2d=_0x63ad[_0x40a050];return _0x2dae2d;};'use strict';var multer=require('multer');var util=require(_0xd63a('0x0'));var path=require(_0xd63a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd63a('0x2'));var interaction=require(_0xd63a('0x3'));var config=require('../../config/environment');var controller=require(_0xd63a('0x4'));router[_0xd63a('0x5')]('/',auth[_0xd63a('0x6')](),controller[_0xd63a('0x7')]);router[_0xd63a('0x5')](_0xd63a('0x8'),auth['isAuthenticated'](),controller[_0xd63a('0x9')]);router['get'](_0xd63a('0xa'),auth['isAuthenticated'](),controller[_0xd63a('0xb')]);router[_0xd63a('0x5')](_0xd63a('0xc'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xd63a('0x6')](),interaction['tracked'](_0xd63a('0xd'),_0xd63a('0xe')),controller['create']);router[_0xd63a('0xf')](_0xd63a('0xa'),auth[_0xd63a('0x6')](),controller[_0xd63a('0x10')]);router[_0xd63a('0xf')](_0xd63a('0x11'),auth[_0xd63a('0x6')](),controller['accept']);router[_0xd63a('0xf')](_0xd63a('0x12'),auth[_0xd63a('0x6')](),controller[_0xd63a('0x13')]);router[_0xd63a('0x14')](_0xd63a('0xa'),auth[_0xd63a('0x6')](),controller['destroy']);module[_0xd63a('0x15')]=router; \ No newline at end of file +var _0x641b=['/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','create','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x1b13da,_0x1b5f5c){var _0x5ca7b8=function(_0x3cca7a){while(--_0x3cca7a){_0x1b13da['push'](_0x1b13da['shift']());}};_0x5ca7b8(++_0x1b5f5c);}(_0x641b,0xca));var _0xb641=function(_0x4b8a83,_0x356366){_0x4b8a83=_0x4b8a83-0x0;var _0x7e7ac3=_0x641b[_0x4b8a83];return _0x7e7ac3;};'use strict';var multer=require(_0xb641('0x0'));var util=require('util');var path=require(_0xb641('0x1'));var timeout=require(_0xb641('0x2'));var express=require(_0xb641('0x3'));var router=express[_0xb641('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb641('0x5'));var interaction=require(_0xb641('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xb641('0x7')]('/',auth[_0xb641('0x8')](),controller[_0xb641('0x9')]);router[_0xb641('0x7')](_0xb641('0xa'),auth[_0xb641('0x8')](),controller[_0xb641('0xb')]);router[_0xb641('0x7')]('/:id',auth[_0xb641('0x8')](),controller[_0xb641('0xc')]);router[_0xb641('0x7')](_0xb641('0xd'),auth[_0xb641('0x8')](),controller[_0xb641('0xe')]);router[_0xb641('0xf')]('/',auth[_0xb641('0x8')](),interaction[_0xb641('0x10')]('mail','mailmessage:create'),controller[_0xb641('0x11')]);router[_0xb641('0x12')]('/:id',auth[_0xb641('0x8')](),controller['update']);router[_0xb641('0x12')](_0xb641('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xb641('0x14'),auth[_0xb641('0x8')](),controller[_0xb641('0x15')]);router[_0xb641('0x16')](_0xb641('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0xb641('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 884f1ab..7c26fff 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 _0xc5bc=['TEXT','medium','BOOLEAN','out','STRING','long','INTEGER','DATE','Email','sequelize','lodash','exports'];(function(_0x1d0e2b,_0x497d21){var _0x17f3a7=function(_0x22559a){while(--_0x22559a){_0x1d0e2b['push'](_0x1d0e2b['shift']());}};_0x17f3a7(++_0x497d21);}(_0xc5bc,0xf9));var _0xcc5b=function(_0x3d3563,_0x2f1971){_0x3d3563=_0x3d3563-0x0;var _0x2870c2=_0xc5bc[_0x3d3563];return _0x2870c2;};'use strict';var Sequelize=require(_0xcc5b('0x0'));var _=require(_0xcc5b('0x1'));module[_0xcc5b('0x2')]={'body':{'type':Sequelize[_0xcc5b('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcc5b('0x3')](_0xcc5b('0x4'))},'read':{'type':Sequelize[_0xcc5b('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcc5b('0x6')),'defaultValue':_0xcc5b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcc5b('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xcc5b('0x3')](_0xcc5b('0x8'))},'cc':{'type':Sequelize['TEXT'](_0xcc5b('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0xcc5b('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xcc5b('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcc5b('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcc5b('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xcc5b('0x8'))},'originCc':{'type':Sequelize[_0xcc5b('0x3')](_0xcc5b('0x8'))},'originChannel':{'type':Sequelize['ENUM'](_0xcc5b('0xb'),'Chat'),'defaultValue':_0xcc5b('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x3fbc=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT'];(function(_0x54664b,_0x3e8aa8){var _0xcb4ed5=function(_0x2d3748){while(--_0x2d3748){_0x54664b['push'](_0x54664b['shift']());}};_0xcb4ed5(++_0x3e8aa8);}(_0x3fbc,0x14e));var _0xc3fb=function(_0xd6d4fb,_0x3f0a0e){_0xd6d4fb=_0xd6d4fb-0x0;var _0x37650c=_0x3fbc[_0xd6d4fb];return _0x37650c;};'use strict';var Sequelize=require(_0xc3fb('0x0'));var _=require(_0xc3fb('0x1'));module[_0xc3fb('0x2')]={'body':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x5'))},'read':{'type':Sequelize[_0xc3fb('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc3fb('0x7')]('in',_0xc3fb('0x8')),'defaultValue':_0xc3fb('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc3fb('0x9')](0x1fe)},'from':{'type':Sequelize[_0xc3fb('0x9')]},'to':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x4'))},'cc':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x4'))},'bcc':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x4'))},'subject':{'type':Sequelize[_0xc3fb('0x3')]},'sentAt':{'type':Sequelize[_0xc3fb('0xa')]},'attach':{'type':Sequelize[_0xc3fb('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc3fb('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc3fb('0xa')]},'originTo':{'type':Sequelize[_0xc3fb('0x3')](_0xc3fb('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xc3fb('0x4'))},'originChannel':{'type':Sequelize[_0xc3fb('0x7')](_0xc3fb('0xc'),'Chat'),'defaultValue':_0xc3fb('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 98e9844..6d505c0 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 _0x2d73=['merge','options','includeAll','include','rows','show','params','rawAttributes','update','body','find','destroy','describe','create','direction','out','secret','MailAccount','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','messageId','format','stringify','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','read1stAt','interaction','get','[MAILMESSAGE: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','contact','email','internal','manual','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','MailInteraction','RejectMessage','Sequelize','QueryTypes','SELECT','User','fullname','interface','motionChannel','download','unix','toString','join','root','server','files','tmp','from','bcc','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','unlinkSync','eml-format','bluebird','util','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','client','http','request','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','json','undefined','limit','offset','count','then','end','name','send','map','MailMessage','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2d73,0x186));var _0x32d7=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x2d73[_0xa3463d];return _0x50fd67;};'use strict';var emlformat=require(_0x32d7('0x0'));var moment=require('moment');var BPromise=require(_0x32d7('0x1'));var util=require(_0x32d7('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x32d7('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x32d7('0x4'));var qs=require(_0x32d7('0x5'));var logger=require('../../config/logger')(_0x32d7('0x6'));var interaction_log=require(_0x32d7('0x7'))(_0x32d7('0x8'));var config=require(_0x32d7('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x32d7('0xa')](config[_0x32d7('0xb')],{'host':_0x32d7('0xc'),'port':0x18eb});var socket=require(_0x32d7('0xd'))(new Redis(config[_0x32d7('0xb')]));var htmlEntities=require(_0x32d7('0xe'));require(_0x32d7('0xf'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x32d7('0x10')][_0x32d7('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x32d7('0x11')]({'port':0x232b});var client9002=jayson[_0x32d7('0x10')][_0x32d7('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2f51c3,_0xb01f24,_0x55e8d5,_0x36d038){return new BPromise(function(_0x34fc85,_0x465b90){var _0x1c017b=_0x36d038||client;return _0x1c017b[_0x32d7('0x12')](_0x2f51c3,_0x55e8d5)['then'](function(_0xa3d1e8){logger['info'](_0x32d7('0x13'),_0xb01f24,'request\x20sent');logger['debug'](_0x32d7('0x14'),_0xb01f24,_0x32d7('0x15'),JSON['stringify'](_0xa3d1e8));if(_0xa3d1e8[_0x32d7('0x16')]){if(_0xa3d1e8[_0x32d7('0x16')][_0x32d7('0x17')]===0x1f4){logger[_0x32d7('0x16')]('MailMessage,\x20%s,\x20%s',_0xb01f24,_0xa3d1e8[_0x32d7('0x16')][_0x32d7('0x18')]);return _0x465b90(_0xa3d1e8['error']['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0xb01f24,_0xa3d1e8['error'][_0x32d7('0x18')]);return _0x34fc85(_0xa3d1e8[_0x32d7('0x16')][_0x32d7('0x18')]);}else{logger[_0x32d7('0x19')](_0x32d7('0x13'),_0xb01f24,_0x32d7('0x15'));_0x34fc85(_0xa3d1e8[_0x32d7('0x1a')][_0x32d7('0x18')]);}})[_0x32d7('0x1b')](function(_0xf6f90e){logger[_0x32d7('0x16')](_0x32d7('0x13'),_0xb01f24,_0xf6f90e);_0x465b90(_0xf6f90e);});});}function respondWithResult(_0x3d77a3,_0x3e5b64){_0x3e5b64=_0x3e5b64||0xc8;return function(_0x307da3){if(_0x307da3){return _0x3d77a3[_0x32d7('0x1c')](_0x3e5b64)[_0x32d7('0x1d')](_0x307da3);}};}function respondWithFilteredResult(_0x4c3a14,_0x3333c5){return function(_0xb36b3f){if(_0xb36b3f){var _0x150b33=typeof _0x3333c5['offset']===_0x32d7('0x1e')&&typeof _0x3333c5[_0x32d7('0x1f')]===_0x32d7('0x1e');var _0x581f91=_0xb36b3f['count'];var _0x205017=_0x150b33?0x0:_0x3333c5[_0x32d7('0x20')];var _0x48febe=_0x150b33?_0xb36b3f[_0x32d7('0x21')]:_0x3333c5[_0x32d7('0x20')]+_0x3333c5['limit'];var _0x28e164;if(_0x48febe>=_0x581f91){_0x48febe=_0x581f91;_0x28e164=0xc8;}else{_0x28e164=0xce;}_0x4c3a14[_0x32d7('0x1c')](_0x28e164);return _0x4c3a14['set']('Content-Range',_0x205017+'-'+_0x48febe+'/'+_0x581f91)[_0x32d7('0x1d')](_0xb36b3f);}return null;};}function saveUpdates(_0x3ea4db){return function(_0x3078fe){if(_0x3078fe){return _0x3078fe['update'](_0x3ea4db)['then'](function(_0x221a64){return _0x221a64;});}return null;};}function removeEntity(_0x57ba51){return function(_0x2d174c){if(_0x2d174c){return _0x2d174c['destroy']()[_0x32d7('0x22')](function(){_0x57ba51['status'](0xcc)[_0x32d7('0x23')]();});}};}function handleEntityNotFound(_0x325a7f){return function(_0x239fd3){if(!_0x239fd3){_0x325a7f['sendStatus'](0x194);}return _0x239fd3;};}function handleError(_0x4f3d8a,_0x477b9c){_0x477b9c=_0x477b9c||0x1f4;return function(_0x53f706){logger[_0x32d7('0x16')](_0x53f706['stack']);if(_0x53f706[_0x32d7('0x24')]){delete _0x53f706[_0x32d7('0x24')];}_0x4f3d8a['status'](_0x477b9c)[_0x32d7('0x25')](_0x53f706);};}exports['index']=function(_0x59b588,_0x9c7f0b){var _0x1c92fa={},_0x1e49cc={},_0x19aa90={'count':0x0,'rows':[]};var _0xfd7382=_[_0x32d7('0x26')](db[_0x32d7('0x27')]['rawAttributes'],function(_0x40b4e3){return{'name':_0x40b4e3[_0x32d7('0x28')],'type':_0x40b4e3[_0x32d7('0x29')][_0x32d7('0x2a')]};});_0x1e49cc[_0x32d7('0x2b')]=_[_0x32d7('0x26')](_0xfd7382,_0x32d7('0x24'));_0x1e49cc[_0x32d7('0x2c')]=_['keys'](_0x59b588[_0x32d7('0x2c')]);_0x1e49cc[_0x32d7('0x2d')]=_['intersection'](_0x1e49cc[_0x32d7('0x2b')],_0x1e49cc['query']);_0x1c92fa[_0x32d7('0x2e')]=_[_0x32d7('0x2f')](_0x1e49cc[_0x32d7('0x2b')],qs[_0x32d7('0x30')](_0x59b588[_0x32d7('0x2c')][_0x32d7('0x30')]));_0x1c92fa['attributes']=_0x1c92fa[_0x32d7('0x2e')][_0x32d7('0x31')]?_0x1c92fa[_0x32d7('0x2e')]:_0x1e49cc[_0x32d7('0x2b')];if(!_0x59b588[_0x32d7('0x2c')]['hasOwnProperty'](_0x32d7('0x32'))){_0x1c92fa[_0x32d7('0x1f')]=qs[_0x32d7('0x1f')](_0x59b588[_0x32d7('0x2c')]['limit']);_0x1c92fa['offset']=qs['offset'](_0x59b588[_0x32d7('0x2c')]['offset']);}_0x1c92fa[_0x32d7('0x33')]=qs['sort'](_0x59b588['query'][_0x32d7('0x34')]);_0x1c92fa[_0x32d7('0x35')]=qs['filters'](_[_0x32d7('0x36')](_0x59b588[_0x32d7('0x2c')],_0x1e49cc[_0x32d7('0x2d')]),_0xfd7382);if(_0x59b588[_0x32d7('0x2c')][_0x32d7('0x37')]){_0x1c92fa[_0x32d7('0x35')]=_['merge'](_0x1c92fa[_0x32d7('0x35')],{'$or':_['map'](_0xfd7382,function(_0x101c84){if(_0x101c84[_0x32d7('0x29')]!==_0x32d7('0x38')){var _0x2ee4ad={};_0x2ee4ad[_0x101c84['name']]={'$like':'%'+_0x59b588[_0x32d7('0x2c')][_0x32d7('0x37')]+'%'};return _0x2ee4ad;}})});}_0x1c92fa=_[_0x32d7('0x39')]({},_0x1c92fa,_0x59b588[_0x32d7('0x3a')]);var _0xd44e95={'where':_0x1c92fa[_0x32d7('0x35')]};return db[_0x32d7('0x27')][_0x32d7('0x21')](_0xd44e95)[_0x32d7('0x22')](function(_0x5390b8){_0x19aa90[_0x32d7('0x21')]=_0x5390b8;if(_0x59b588[_0x32d7('0x2c')][_0x32d7('0x3b')]){_0x1c92fa[_0x32d7('0x3c')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x1c92fa);})[_0x32d7('0x22')](function(_0x350932){_0x19aa90[_0x32d7('0x3d')]=_0x350932;return _0x19aa90;})[_0x32d7('0x22')](respondWithFilteredResult(_0x9c7f0b,_0x1c92fa))[_0x32d7('0x1b')](handleError(_0x9c7f0b,null));};exports[_0x32d7('0x3e')]=function(_0x41af15,_0x493264){var _0x2a7ce6={'raw':!![],'where':{'id':_0x41af15[_0x32d7('0x3f')]['id']}},_0x1ad118={};_0x1ad118[_0x32d7('0x2b')]=_['keys'](db[_0x32d7('0x27')][_0x32d7('0x40')]);_0x1ad118[_0x32d7('0x2c')]=_['keys'](_0x41af15['query']);_0x1ad118['filters']=_[_0x32d7('0x2f')](_0x1ad118[_0x32d7('0x2b')],_0x1ad118[_0x32d7('0x2c')]);_0x2a7ce6[_0x32d7('0x2e')]=_[_0x32d7('0x2f')](_0x1ad118['model'],qs['fields'](_0x41af15[_0x32d7('0x2c')][_0x32d7('0x30')]));_0x2a7ce6[_0x32d7('0x2e')]=_0x2a7ce6[_0x32d7('0x2e')]['length']?_0x2a7ce6[_0x32d7('0x2e')]:_0x1ad118['model'];if(_0x41af15['query'][_0x32d7('0x3b')]){_0x2a7ce6['include']=[{'all':!![]}];}_0x2a7ce6=_[_0x32d7('0x39')]({},_0x2a7ce6,_0x41af15[_0x32d7('0x3a')]);return db[_0x32d7('0x27')]['find'](_0x2a7ce6)[_0x32d7('0x22')](handleEntityNotFound(_0x493264,null))[_0x32d7('0x22')](respondWithResult(_0x493264,null))[_0x32d7('0x1b')](handleError(_0x493264,null));};exports[_0x32d7('0x41')]=function(_0x456090,_0x5d13a8){if(_0x456090[_0x32d7('0x42')]['id']){delete _0x456090['body']['id'];}return db[_0x32d7('0x27')][_0x32d7('0x43')]({'where':{'id':_0x456090[_0x32d7('0x3f')]['id']}})[_0x32d7('0x22')](handleEntityNotFound(_0x5d13a8,null))[_0x32d7('0x22')](saveUpdates(_0x456090[_0x32d7('0x42')],null))[_0x32d7('0x22')](respondWithResult(_0x5d13a8,null))[_0x32d7('0x1b')](handleError(_0x5d13a8,null));};exports[_0x32d7('0x44')]=function(_0x4ce9ce,_0x18ccec){return db[_0x32d7('0x27')]['find']({'where':{'id':_0x4ce9ce[_0x32d7('0x3f')]['id']}})[_0x32d7('0x22')](handleEntityNotFound(_0x18ccec,null))[_0x32d7('0x22')](removeEntity(_0x18ccec,null))[_0x32d7('0x1b')](handleError(_0x18ccec,null));};exports['describe']=function(_0x2c7771,_0x34f113){return db[_0x32d7('0x27')][_0x32d7('0x45')]()['then'](respondWithResult(_0x34f113,null))[_0x32d7('0x1b')](handleError(_0x34f113,null));};exports[_0x32d7('0x46')]=function(_0x244ac9,_0x1e7c70){return db['MailMessage'][_0x32d7('0x46')](_0x244ac9[_0x32d7('0x42')])[_0x32d7('0x22')](function(_0x7d832d){if(_0x7d832d){if(_0x7d832d[_0x32d7('0x47')]===_0x32d7('0x48')&&!_0x7d832d[_0x32d7('0x49')]){var _0x1837a7,_0x2c5cba,_0x21cb80;if(_0x244ac9[_0x32d7('0x42')]['to']){_0x2c5cba=_0x244ac9[_0x32d7('0x42')]['to']['split'](',')[0x0];}return db[_0x32d7('0x4a')]['findOne']({'where':{'id':_0x7d832d['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x32d7('0x4b'),'include':[{'model':db[_0x32d7('0x4c')],'as':_0x32d7('0x4d'),'where':{'email':_0x2c5cba},'limit':0x1,'order':[[_0x32d7('0x4e'),'DESC']]}]},{'model':db[_0x32d7('0x4f')],'as':_0x32d7('0x50'),'raw':!![],'include':[{'model':db[_0x32d7('0x51')],'as':_0x32d7('0x51'),'raw':!![]}]}]})[_0x32d7('0x22')](function(_0x4d8c31){_0x1837a7=_0x4d8c31;if(!_0x1837a7||!_0x1837a7[_0x32d7('0x50')])return;var _0x4f8b5a=_0x1837a7[_0x32d7('0x52')]();if(_0x244ac9[_0x32d7('0x42')][_0x32d7('0x53')]&&_0x244ac9[_0x32d7('0x42')][_0x32d7('0x53')][_0x32d7('0x31')]){for(var _0x217439=0x0;_0x217439<_0x244ac9['body']['attachments'][_0x32d7('0x31')];_0x217439+=0x1){_0x244ac9[_0x32d7('0x42')][_0x32d7('0x53')][_0x217439]={'filename':_0x244ac9[_0x32d7('0x42')][_0x32d7('0x53')][_0x217439]['name'],'path':path['join'](config['root'],_0x32d7('0x54'),_0x244ac9[_0x32d7('0x42')]['attachments'][_0x217439][_0x32d7('0x55')])};}}_0x21cb80={'account':_0x4f8b5a,'message':_0x244ac9[_0x32d7('0x42')]};return;})['then'](function(){if(_0x1837a7[_0x32d7('0x4b')]){if(_0x1837a7[_0x32d7('0x4b')]['Contacts']['length']){return _0x1837a7[_0x32d7('0x4b')][_0x32d7('0x4d')][0x0];}else{return db[_0x32d7('0x4c')]['create'](_[_0x32d7('0xa')](_0x244ac9[_0x32d7('0x42')],{'firstName':_0x244ac9[_0x32d7('0x42')]['to'],'email':_0x244ac9[_0x32d7('0x42')]['to'],'phone':_0x244ac9[_0x32d7('0x42')]['to'],'ListId':_0x1837a7[_0x32d7('0x56')]}));}}else{throw new Error(_0x32d7('0x57'));}})[_0x32d7('0x22')](function(){if(_0x21cb80){return respondWithRpcPromise(_0x32d7('0x58'),'sendMail',_0x21cb80,client9003)[_0x32d7('0x22')](function(_0x2ba7a4){return _0x7d832d[_0x32d7('0x41')]({'read':!![],'messageId':_0x2ba7a4[_0x32d7('0x59')],'sentAt':moment()[_0x32d7('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x32d7('0x1b')](function(_0xfaa1e6){logger[_0x32d7('0x16')]('%s',JSON[_0x32d7('0x5b')](_0xfaa1e6));return _0x7d832d;});}return _0x7d832d;});}return _0x7d832d;}})[_0x32d7('0x22')](respondWithResult(_0x1e7c70,0xc9))['catch'](handleError(_0x1e7c70,null));};exports[_0x32d7('0x5c')]=function(_0x378ec5,_0x3ebd36){var _0x274797={'agent':{},'channel':_0x32d7('0x5d')};if(_0x378ec5[_0x32d7('0x42')]['id']){delete _0x378ec5[_0x32d7('0x42')]['id'];}_0x378ec5[_0x32d7('0x42')][_0x32d7('0x5e')]=!![];_0x378ec5['body'][_0x32d7('0x5f')]=moment()[_0x32d7('0x5a')](_0x32d7('0x60'));_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')]=_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')]||_0x378ec5[_0x32d7('0x62')]['id'];_0x274797[_0x32d7('0x63')]['id']=_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')];return db[_0x32d7('0x27')][_0x32d7('0x43')]({'where':{'id':_0x378ec5['params']['id'],'UserId':null}})[_0x32d7('0x22')](handleEntityNotFound(_0x3ebd36,null))[_0x32d7('0x22')](saveUpdates(_0x378ec5['body'],null))[_0x32d7('0x22')](function(_0x2a28f4){if(_0x2a28f4){_0x274797[_0x32d7('0x18')]=_0x2a28f4['get']({'plain':!![]});return db['MailInteraction'][_0x32d7('0x43')]({'where':{'id':_0x2a28f4['MailInteractionId']}});}return null;})[_0x32d7('0x22')](handleEntityNotFound(_0x3ebd36,null))[_0x32d7('0x22')](function(_0x506cc2){if(_0x506cc2){return _0x506cc2[_0x32d7('0x41')]({'UserId':_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')],'read1stAt':_['isNil'](_0x506cc2[_0x32d7('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x32d7('0x22')](function(_0x227955){if(_0x227955){_0x274797[_0x32d7('0x65')]=_0x227955[_0x32d7('0x66')]({'plain':!![]});interaction_log[_0x32d7('0x19')](_0x32d7('0x67'),_0x378ec5[_0x32d7('0x62')]['id'],_0x378ec5[_0x32d7('0x62')][_0x32d7('0x24')],_0x378ec5[_0x32d7('0x62')][_0x32d7('0x68')],_0x274797[_0x32d7('0x65')]['id'],_0x378ec5[_0x32d7('0x42')]?JSON[_0x32d7('0x5b')](_0x378ec5[_0x32d7('0x42')]):_0x32d7('0x69'));return respondWithRpcPromise(_0x32d7('0x6a'),_0x32d7('0x6b'),_0x274797);}return null;})[_0x32d7('0x22')](function(_0x6f2474){var _0x5eb996=_0x32d7('0x6c')+_0x6f2474['message'][_0x32d7('0x6d')];return db[_0x32d7('0x6e')][_0x32d7('0x2c')](_0x5eb996,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x32d7('0x22')](function(_0x34ba67){return _0x34ba67;});})[_0x32d7('0x22')](function(_0x42d02d){if(_0x42d02d){_0x274797[_0x32d7('0x18')][_0x32d7('0x6f')]=_0x42d02d[0x0];if(!_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')])return;return db['User']['find']({'where':{'id':_0x378ec5[_0x32d7('0x42')][_0x32d7('0x61')],'role':'agent'},'attributes':['id',_0x32d7('0x24'),'fullname',_0x32d7('0x70'),_0x32d7('0x71')],'raw':!![]});}return null;})[_0x32d7('0x22')](function(_0x4794fb){if(!_0x4794fb)return null;_0x274797[_0x32d7('0x18')][_0x32d7('0x63')]=_0x4794fb;return _0x274797;})[_0x32d7('0x22')](function(_0x2beb5d){if(_0x2beb5d){if(_0x378ec5[_0x32d7('0x42')][_0x32d7('0x72')]){_0x274797[_0x32d7('0x18')]['interface']=util[_0x32d7('0x5a')](_0x32d7('0x73'),_0x378ec5[_0x32d7('0x62')]['name']);_0x274797[_0x32d7('0x18')][_0x32d7('0x74')]=_0x274797[_0x32d7('0x74')];_0x274797[_0x32d7('0x18')]['motionChannel']=_0x274797['channel'];_0x274797['message'][_0x32d7('0x75')]=_0x32d7('0x5c');_0x274797[_0x32d7('0x18')][_0x32d7('0x42')]=htmlToText[_0x32d7('0x76')](_0x274797[_0x32d7('0x18')][_0x32d7('0x42')]);return respondWithRpcPromise(_0x32d7('0x77'),_0x32d7('0x77'),{'event':_0x32d7('0x78'),'message':_0x274797['message']},client9002)[_0x32d7('0x22')](function(){return _0x274797;});}return _0x274797;}return null;})[_0x32d7('0x22')](respondWithResult(_0x3ebd36,null))[_0x32d7('0x1b')](handleError(_0x3ebd36,null));};exports[_0x32d7('0x79')]=function(_0x4cb10f,_0x4c6eff){var _0x5c8a3a={'agent':{},'channel':_0x32d7('0x5d')};if(_0x4cb10f[_0x32d7('0x42')]['id']){delete _0x4cb10f[_0x32d7('0x42')]['id'];}_0x4cb10f['body']['UserId']=_0x4cb10f[_0x32d7('0x42')][_0x32d7('0x61')]||_0x4cb10f[_0x32d7('0x62')]['id'];_0x5c8a3a[_0x32d7('0x63')]['id']=_0x4cb10f[_0x32d7('0x42')][_0x32d7('0x61')];return db['MailMessage'][_0x32d7('0x43')]({'where':{'id':_0x4cb10f[_0x32d7('0x3f')]['id'],'UserId':null}})[_0x32d7('0x22')](handleEntityNotFound(_0x4c6eff,null))['then'](function(_0x416396){if(_0x416396){_0x5c8a3a[_0x32d7('0x18')]=_0x416396[_0x32d7('0x66')]({'plain':!![]});return db[_0x32d7('0x7a')]['find']({'where':{'id':_0x416396['MailInteractionId']}});}return null;})[_0x32d7('0x22')](handleEntityNotFound(_0x4c6eff,null))[_0x32d7('0x22')](function(_0x2ae060){if(_0x2ae060){_0x5c8a3a['interaction']=_0x2ae060[_0x32d7('0x66')]({'plain':!![]});interaction_log[_0x32d7('0x19')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4cb10f[_0x32d7('0x62')]['id'],_0x4cb10f[_0x32d7('0x62')][_0x32d7('0x24')],_0x4cb10f[_0x32d7('0x62')][_0x32d7('0x68')],_0x5c8a3a['interaction']['id'],_0x4cb10f[_0x32d7('0x42')]?JSON[_0x32d7('0x5b')](_0x4cb10f[_0x32d7('0x42')]):_0x32d7('0x69'));return respondWithRpcPromise(_0x32d7('0x7b'),'rejectMessage',_0x5c8a3a);}return null;})[_0x32d7('0x22')](function(_0x3c6004){var _0x142509=_0x32d7('0x6c')+_0x3c6004[_0x32d7('0x18')][_0x32d7('0x6d')];return db[_0x32d7('0x6e')][_0x32d7('0x2c')](_0x142509,{'type':db[_0x32d7('0x7c')][_0x32d7('0x7d')][_0x32d7('0x7e')],'raw':!![]})[_0x32d7('0x22')](function(_0x2a78a1){return _0x2a78a1;});})[_0x32d7('0x22')](function(_0x39c313){if(_0x39c313){_0x5c8a3a['message']['contact']=_0x39c313[0x0];if(!_0x4cb10f['body'][_0x32d7('0x61')])return;return db[_0x32d7('0x7f')][_0x32d7('0x43')]({'where':{'id':_0x4cb10f[_0x32d7('0x42')][_0x32d7('0x61')],'role':'agent'},'attributes':['id',_0x32d7('0x24'),_0x32d7('0x80'),_0x32d7('0x70'),_0x32d7('0x71')],'raw':!![]});}return null;})['then'](function(_0x3720bc){if(!_0x3720bc)return null;_0x5c8a3a['message'][_0x32d7('0x63')]=_0x3720bc;return _0x5c8a3a;})[_0x32d7('0x22')](function(_0x1b1589){if(_0x1b1589){_0x1b1589['message'][_0x32d7('0x81')]=util[_0x32d7('0x5a')](_0x32d7('0x73'),_0x4cb10f[_0x32d7('0x62')][_0x32d7('0x24')]);_0x1b1589[_0x32d7('0x18')][_0x32d7('0x74')]=_0x5c8a3a['channel'];_0x1b1589[_0x32d7('0x18')][_0x32d7('0x82')]=_0x5c8a3a['channel'];_0x1b1589[_0x32d7('0x18')][_0x32d7('0x75')]=_0x32d7('0x79');_0x1b1589[_0x32d7('0x18')]['body']=htmlToText[_0x32d7('0x76')](_0x5c8a3a[_0x32d7('0x18')][_0x32d7('0x42')]);respondWithRpcPromise('EventManager',_0x32d7('0x77'),{'event':'rejectmessage','message':_0x1b1589[_0x32d7('0x18')]},client9002);return _0x5c8a3a;}return null;})[_0x32d7('0x22')](respondWithResult(_0x4c6eff,null))[_0x32d7('0x1b')](handleError(_0x4c6eff,null));};exports[_0x32d7('0x83')]=function(_0x326fae,_0xa0e6ca){var _0x52225c=moment()[_0x32d7('0x84')]()[_0x32d7('0x85')]();var _0x32db3a=path[_0x32d7('0x86')](config[_0x32d7('0x87')],_0x32d7('0x88'),_0x32d7('0x89'),_0x32d7('0x8a'));var _0x5c6bbc=path[_0x32d7('0x86')](config[_0x32d7('0x87')],_0x32d7('0x88'),_0x32d7('0x89'),_0x32d7('0x53'));var _0xac9ac3=util[_0x32d7('0x5a')]('message-%s.eml',_0x52225c);return db[_0x32d7('0x27')][_0x32d7('0x43')]({'where':{'id':_0x326fae['params']['id']},'attributes':['id',_0x32d7('0x42'),_0x32d7('0x8b'),'to','cc',_0x32d7('0x8c'),_0x32d7('0x8d'),_0x32d7('0x8e')],'include':_0x326fae[_0x32d7('0x2c')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x32d7('0x22')](handleEntityNotFound(_0xa0e6ca,null))[_0x32d7('0x22')](function(_0x50dd48){if(_0x50dd48){var _0x3b070b=_0x50dd48;var _0x2dcad4={'from':_0x3b070b[_0x32d7('0x8b')],'to':_0x3b070b['to'],'subject':_0x3b070b['subject'],'html':htmlEntities['decode'](_0x3b070b['body']),'headers':{'Date':moment(_0x3b070b[_0x32d7('0x8e')])[_0x32d7('0x5a')](_0x32d7('0x8f'))},'attachments':[]};if(_0x50dd48['cc']){_0x2dcad4['headers']['Cc']=_0x50dd48['cc'];}if(_0x50dd48['bcc']){_0x2dcad4[_0x32d7('0x90')][_0x32d7('0x91')]=_0x50dd48['bcc'];}return new BPromise(function(_0xe9ffb4,_0x48361b){if(_0x50dd48[_0x32d7('0x92')]){for(var _0x3d0a79=0x0;_0x3d0a79<_0x50dd48[_0x32d7('0x92')][_0x32d7('0x31')];_0x3d0a79++){var _0x5285d3=_0x50dd48[_0x32d7('0x92')][_0x3d0a79];var _0x5206da=path[_0x32d7('0x86')](_0x5c6bbc,_0x5285d3[_0x32d7('0x55')]);if(fs['existsSync'](_0x5206da)){_0x2dcad4[_0x32d7('0x53')][_0x32d7('0x93')]({'name':_0x5285d3[_0x32d7('0x24')],'contentType':_0x5285d3['type'],'data':fs['readFileSync'](_0x5206da)});}}}emlformat['build'](_0x2dcad4,function(_0x11382a,_0x4ba0e8){if(_0x11382a)return _0x48361b(_0x11382a);fs['writeFileSync'](path[_0x32d7('0x86')](_0x32db3a,_0xac9ac3),_0x4ba0e8);return _0xe9ffb4(_0x4ba0e8);});});}})[_0x32d7('0x22')](function(_0x358548){if(_0x358548){return _0xa0e6ca['download'](path[_0x32d7('0x86')](_0x32db3a,_0xac9ac3),_0xac9ac3,function(_0x1079e9){if(!_0x1079e9)fs[_0x32d7('0x94')](path[_0x32d7('0x86')](_0x32db3a,_0xac9ac3));});}})['catch'](handleError(_0xa0e6ca,null));}; \ No newline at end of file +var _0xce85=['from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Bcc','readFileSync','build','writeFileSync','download','moment','path','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','stack','name','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','length','includeAll','update','body','find','describe','create','out','MailAccount','findOne','MailAccountId','List','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','CmContact','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','User','fullname','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','contact','email','internal','motionChannel','rejectmessage','unix','server','files','tmp','message-%s.eml'];(function(_0x1e4834,_0x2ebc3b){var _0xec0040=function(_0x1e1c26){while(--_0x1e1c26){_0x1e4834['push'](_0x1e4834['shift']());}};_0xec0040(++_0x2ebc3b);}(_0xce85,0xa4));var _0x5ce8=function(_0x3021c5,_0x1980cc){_0x3021c5=_0x3021c5-0x0;var _0x170536=_0xce85[_0x3021c5];return _0x170536;};'use strict';var emlformat=require('eml-format');var moment=require(_0x5ce8('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x5ce8('0x1'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x5ce8('0x2'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x5ce8('0x3'))(_0x5ce8('0x4'));var interaction_log=require('../../config/logger')(_0x5ce8('0x5'));var config=require(_0x5ce8('0x6'));var db=require(_0x5ce8('0x7'))['db'];config[_0x5ce8('0x8')]=_[_0x5ce8('0x9')](config[_0x5ce8('0x8')],{'host':_0x5ce8('0xa'),'port':0x18eb});var socket=require(_0x5ce8('0xb'))(new Redis(config[_0x5ce8('0x8')]));var htmlEntities=require(_0x5ce8('0xc'));require(_0x5ce8('0xd'))[_0x5ce8('0xe')](socket);var jayson=require(_0x5ce8('0xf'));var client=jayson[_0x5ce8('0x10')][_0x5ce8('0x11')]({'port':0x232c});var client9003=jayson[_0x5ce8('0x10')][_0x5ce8('0x11')]({'port':0x232b});var client9002=jayson[_0x5ce8('0x10')][_0x5ce8('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x30c420,_0x24999c,_0x1efbe2,_0x4f1dd4){return new BPromise(function(_0x3aa2e7,_0x3584c8){var _0x188573=_0x4f1dd4||client;return _0x188573[_0x5ce8('0x12')](_0x30c420,_0x1efbe2)['then'](function(_0x246932){logger[_0x5ce8('0x13')](_0x5ce8('0x14'),_0x24999c,_0x5ce8('0x15'));logger[_0x5ce8('0x16')](_0x5ce8('0x17'),_0x24999c,_0x5ce8('0x15'),JSON[_0x5ce8('0x18')](_0x246932));if(_0x246932[_0x5ce8('0x19')]){if(_0x246932[_0x5ce8('0x19')][_0x5ce8('0x1a')]===0x1f4){logger[_0x5ce8('0x19')](_0x5ce8('0x14'),_0x24999c,_0x246932['error'][_0x5ce8('0x1b')]);return _0x3584c8(_0x246932[_0x5ce8('0x19')][_0x5ce8('0x1b')]);}logger['error'](_0x5ce8('0x14'),_0x24999c,_0x246932['error'][_0x5ce8('0x1b')]);return _0x3aa2e7(_0x246932[_0x5ce8('0x19')][_0x5ce8('0x1b')]);}else{logger[_0x5ce8('0x13')]('MailMessage,\x20%s,\x20%s',_0x24999c,_0x5ce8('0x15'));_0x3aa2e7(_0x246932['result'][_0x5ce8('0x1b')]);}})[_0x5ce8('0x1c')](function(_0x46cdff){logger[_0x5ce8('0x19')](_0x5ce8('0x14'),_0x24999c,_0x46cdff);_0x3584c8(_0x46cdff);});});}function respondWithResult(_0x568ed5,_0x9996fb){_0x9996fb=_0x9996fb||0xc8;return function(_0x4100e3){if(_0x4100e3){return _0x568ed5[_0x5ce8('0x1d')](_0x9996fb)[_0x5ce8('0x1e')](_0x4100e3);}};}function respondWithFilteredResult(_0xef1983,_0x1b1838){return function(_0x22ce29){if(_0x22ce29){var _0x4437e6=typeof _0x1b1838[_0x5ce8('0x1f')]===_0x5ce8('0x20')&&typeof _0x1b1838[_0x5ce8('0x21')]==='undefined';var _0x49d6dd=_0x22ce29[_0x5ce8('0x22')];var _0x4478bf=_0x4437e6?0x0:_0x1b1838[_0x5ce8('0x1f')];var _0x10b218=_0x4437e6?_0x22ce29['count']:_0x1b1838[_0x5ce8('0x1f')]+_0x1b1838[_0x5ce8('0x21')];var _0x2d7934;if(_0x10b218>=_0x49d6dd){_0x10b218=_0x49d6dd;_0x2d7934=0xc8;}else{_0x2d7934=0xce;}_0xef1983[_0x5ce8('0x1d')](_0x2d7934);return _0xef1983[_0x5ce8('0x23')](_0x5ce8('0x24'),_0x4478bf+'-'+_0x10b218+'/'+_0x49d6dd)[_0x5ce8('0x1e')](_0x22ce29);}return null;};}function saveUpdates(_0x321e6a){return function(_0x30d442){if(_0x30d442){return _0x30d442['update'](_0x321e6a)[_0x5ce8('0x25')](function(_0xcc360f){return _0xcc360f;});}return null;};}function removeEntity(_0x13f8b4){return function(_0x3c0f1d){if(_0x3c0f1d){return _0x3c0f1d[_0x5ce8('0x26')]()[_0x5ce8('0x25')](function(){_0x13f8b4[_0x5ce8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ac97){return function(_0x403092){if(!_0x403092){_0x41ac97[_0x5ce8('0x27')](0x194);}return _0x403092;};}function handleError(_0x57bbaf,_0x4a5665){_0x4a5665=_0x4a5665||0x1f4;return function(_0x522f65){logger[_0x5ce8('0x19')](_0x522f65[_0x5ce8('0x28')]);if(_0x522f65['name']){delete _0x522f65[_0x5ce8('0x29')];}_0x57bbaf[_0x5ce8('0x1d')](_0x4a5665)['send'](_0x522f65);};}exports[_0x5ce8('0x2a')]=function(_0x1b6dac,_0x172df2){var _0x36cecf={},_0x21b38f={},_0x1fe07c={'count':0x0,'rows':[]};var _0x4f4043=_[_0x5ce8('0x2b')](db[_0x5ce8('0x2c')]['rawAttributes'],function(_0x4ecee3){return{'name':_0x4ecee3[_0x5ce8('0x2d')],'type':_0x4ecee3[_0x5ce8('0x2e')][_0x5ce8('0x2f')]};});_0x21b38f[_0x5ce8('0x30')]=_['map'](_0x4f4043,'name');_0x21b38f[_0x5ce8('0x31')]=_[_0x5ce8('0x32')](_0x1b6dac[_0x5ce8('0x31')]);_0x21b38f[_0x5ce8('0x33')]=_[_0x5ce8('0x34')](_0x21b38f[_0x5ce8('0x30')],_0x21b38f[_0x5ce8('0x31')]);_0x36cecf[_0x5ce8('0x35')]=_[_0x5ce8('0x34')](_0x21b38f[_0x5ce8('0x30')],qs[_0x5ce8('0x36')](_0x1b6dac[_0x5ce8('0x31')][_0x5ce8('0x36')]));_0x36cecf[_0x5ce8('0x35')]=_0x36cecf[_0x5ce8('0x35')]['length']?_0x36cecf['attributes']:_0x21b38f[_0x5ce8('0x30')];if(!_0x1b6dac[_0x5ce8('0x31')]['hasOwnProperty'](_0x5ce8('0x37'))){_0x36cecf['limit']=qs['limit'](_0x1b6dac[_0x5ce8('0x31')][_0x5ce8('0x21')]);_0x36cecf['offset']=qs[_0x5ce8('0x1f')](_0x1b6dac[_0x5ce8('0x31')][_0x5ce8('0x1f')]);}_0x36cecf['order']=qs[_0x5ce8('0x38')](_0x1b6dac['query']['sort']);_0x36cecf['where']=qs[_0x5ce8('0x33')](_['pick'](_0x1b6dac['query'],_0x21b38f[_0x5ce8('0x33')]),_0x4f4043);if(_0x1b6dac['query']['filter']){_0x36cecf[_0x5ce8('0x39')]=_[_0x5ce8('0x3a')](_0x36cecf[_0x5ce8('0x39')],{'$or':_[_0x5ce8('0x2b')](_0x4f4043,function(_0x3727c1){if(_0x3727c1[_0x5ce8('0x2e')]!==_0x5ce8('0x3b')){var _0x503e13={};_0x503e13[_0x3727c1[_0x5ce8('0x29')]]={'$like':'%'+_0x1b6dac[_0x5ce8('0x31')][_0x5ce8('0x3c')]+'%'};return _0x503e13;}})});}_0x36cecf=_[_0x5ce8('0x3a')]({},_0x36cecf,_0x1b6dac[_0x5ce8('0x3d')]);var _0x35330c={'where':_0x36cecf[_0x5ce8('0x39')]};return db['MailMessage'][_0x5ce8('0x22')](_0x35330c)[_0x5ce8('0x25')](function(_0x559d81){_0x1fe07c['count']=_0x559d81;if(_0x1b6dac['query']['includeAll']){_0x36cecf[_0x5ce8('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0x5ce8('0x3f')](_0x36cecf);})[_0x5ce8('0x25')](function(_0x5210b7){_0x1fe07c[_0x5ce8('0x40')]=_0x5210b7;return _0x1fe07c;})[_0x5ce8('0x25')](respondWithFilteredResult(_0x172df2,_0x36cecf))[_0x5ce8('0x1c')](handleError(_0x172df2,null));};exports['show']=function(_0x3eaf2a,_0x4aded9){var _0x245191={'raw':!![],'where':{'id':_0x3eaf2a[_0x5ce8('0x41')]['id']}},_0x4e28fb={};_0x4e28fb['model']=_[_0x5ce8('0x32')](db[_0x5ce8('0x2c')][_0x5ce8('0x42')]);_0x4e28fb['query']=_[_0x5ce8('0x32')](_0x3eaf2a[_0x5ce8('0x31')]);_0x4e28fb[_0x5ce8('0x33')]=_[_0x5ce8('0x34')](_0x4e28fb['model'],_0x4e28fb[_0x5ce8('0x31')]);_0x245191[_0x5ce8('0x35')]=_[_0x5ce8('0x34')](_0x4e28fb['model'],qs['fields'](_0x3eaf2a[_0x5ce8('0x31')][_0x5ce8('0x36')]));_0x245191[_0x5ce8('0x35')]=_0x245191[_0x5ce8('0x35')][_0x5ce8('0x43')]?_0x245191['attributes']:_0x4e28fb[_0x5ce8('0x30')];if(_0x3eaf2a[_0x5ce8('0x31')][_0x5ce8('0x44')]){_0x245191['include']=[{'all':!![]}];}_0x245191=_[_0x5ce8('0x3a')]({},_0x245191,_0x3eaf2a[_0x5ce8('0x3d')]);return db[_0x5ce8('0x2c')]['find'](_0x245191)[_0x5ce8('0x25')](handleEntityNotFound(_0x4aded9,null))[_0x5ce8('0x25')](respondWithResult(_0x4aded9,null))[_0x5ce8('0x1c')](handleError(_0x4aded9,null));};exports[_0x5ce8('0x45')]=function(_0x4d35ca,_0x5d8028){if(_0x4d35ca[_0x5ce8('0x46')]['id']){delete _0x4d35ca[_0x5ce8('0x46')]['id'];}return db['MailMessage'][_0x5ce8('0x47')]({'where':{'id':_0x4d35ca[_0x5ce8('0x41')]['id']}})[_0x5ce8('0x25')](handleEntityNotFound(_0x5d8028,null))[_0x5ce8('0x25')](saveUpdates(_0x4d35ca['body'],null))[_0x5ce8('0x25')](respondWithResult(_0x5d8028,null))[_0x5ce8('0x1c')](handleError(_0x5d8028,null));};exports[_0x5ce8('0x26')]=function(_0x38907f,_0x2e95bf){return db[_0x5ce8('0x2c')][_0x5ce8('0x47')]({'where':{'id':_0x38907f[_0x5ce8('0x41')]['id']}})[_0x5ce8('0x25')](handleEntityNotFound(_0x2e95bf,null))[_0x5ce8('0x25')](removeEntity(_0x2e95bf,null))[_0x5ce8('0x1c')](handleError(_0x2e95bf,null));};exports[_0x5ce8('0x48')]=function(_0x31d5bb,_0x2e8c27){return db[_0x5ce8('0x2c')][_0x5ce8('0x48')]()[_0x5ce8('0x25')](respondWithResult(_0x2e8c27,null))[_0x5ce8('0x1c')](handleError(_0x2e8c27,null));};exports['create']=function(_0x3b7e54,_0xefe82f){return db[_0x5ce8('0x2c')][_0x5ce8('0x49')](_0x3b7e54[_0x5ce8('0x46')])['then'](function(_0x279966){if(_0x279966){if(_0x279966['direction']===_0x5ce8('0x4a')&&!_0x279966['secret']){var _0x112793,_0x3d727c,_0x16adbb;if(_0x3b7e54[_0x5ce8('0x46')]['to']){_0x3d727c=_0x3b7e54[_0x5ce8('0x46')]['to']['split'](',')[0x0];}return db[_0x5ce8('0x4b')][_0x5ce8('0x4c')]({'where':{'id':_0x279966[_0x5ce8('0x4d')]},'include':[{'model':db['CmList'],'as':_0x5ce8('0x4e'),'include':[{'model':db['CmContact'],'as':_0x5ce8('0x4f'),'where':{'email':_0x3d727c},'limit':0x1,'order':[['updatedAt',_0x5ce8('0x50')]]}]},{'model':db[_0x5ce8('0x51')],'as':_0x5ce8('0x52'),'raw':!![],'include':[{'model':db[_0x5ce8('0x53')],'as':_0x5ce8('0x53'),'raw':!![]}]}]})[_0x5ce8('0x25')](function(_0x4ef30f){_0x112793=_0x4ef30f;if(!_0x112793||!_0x112793[_0x5ce8('0x52')])return;var _0x46f58a=_0x112793['getSmtpOptions']();if(_0x3b7e54['body'][_0x5ce8('0x54')]&&_0x3b7e54[_0x5ce8('0x46')][_0x5ce8('0x54')]['length']){for(var _0x59a357=0x0;_0x59a357<_0x3b7e54[_0x5ce8('0x46')]['attachments']['length'];_0x59a357+=0x1){_0x3b7e54[_0x5ce8('0x46')][_0x5ce8('0x54')][_0x59a357]={'filename':_0x3b7e54['body']['attachments'][_0x59a357]['name'],'path':path[_0x5ce8('0x55')](config[_0x5ce8('0x56')],_0x5ce8('0x57'),_0x3b7e54[_0x5ce8('0x46')][_0x5ce8('0x54')][_0x59a357][_0x5ce8('0x58')])};}}_0x16adbb={'account':_0x46f58a,'message':_0x3b7e54[_0x5ce8('0x46')]};return;})[_0x5ce8('0x25')](function(){if(_0x112793['List']){if(_0x112793[_0x5ce8('0x4e')]['Contacts'][_0x5ce8('0x43')]){return _0x112793[_0x5ce8('0x4e')][_0x5ce8('0x4f')][0x0];}else{return db[_0x5ce8('0x59')][_0x5ce8('0x49')](_[_0x5ce8('0x9')](_0x3b7e54['body'],{'firstName':_0x3b7e54[_0x5ce8('0x46')]['to'],'email':_0x3b7e54[_0x5ce8('0x46')]['to'],'phone':_0x3b7e54[_0x5ce8('0x46')]['to'],'ListId':_0x112793['ListId']}));}}else{throw new Error(_0x5ce8('0x5a'));}})[_0x5ce8('0x25')](function(){if(_0x16adbb){return respondWithRpcPromise('SendMail',_0x5ce8('0x5b'),_0x16adbb,client9003)[_0x5ce8('0x25')](function(_0x1296a9){return _0x279966[_0x5ce8('0x45')]({'read':!![],'messageId':_0x1296a9[_0x5ce8('0x5c')],'sentAt':moment()['format'](_0x5ce8('0x5d'))});})['catch'](function(_0x13cba6){logger[_0x5ce8('0x19')]('%s',JSON[_0x5ce8('0x18')](_0x13cba6));return _0x279966;});}return _0x279966;});}return _0x279966;}})[_0x5ce8('0x25')](respondWithResult(_0xefe82f,0xc9))[_0x5ce8('0x1c')](handleError(_0xefe82f,null));};exports['accept']=function(_0x4311b7,_0x5d8447){var _0x471f88={'agent':{},'channel':_0x5ce8('0x5e')};if(_0x4311b7['body']['id']){delete _0x4311b7[_0x5ce8('0x46')]['id'];}_0x4311b7['body'][_0x5ce8('0x5f')]=!![];_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x60')]=moment()[_0x5ce8('0x61')](_0x5ce8('0x5d'));_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x62')]=_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x62')]||_0x4311b7[_0x5ce8('0x63')]['id'];_0x471f88[_0x5ce8('0x64')]['id']=_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x62')];return db['MailMessage'][_0x5ce8('0x47')]({'where':{'id':_0x4311b7[_0x5ce8('0x41')]['id'],'UserId':null}})[_0x5ce8('0x25')](handleEntityNotFound(_0x5d8447,null))[_0x5ce8('0x25')](saveUpdates(_0x4311b7[_0x5ce8('0x46')],null))['then'](function(_0x4c3c2e){if(_0x4c3c2e){_0x471f88[_0x5ce8('0x1b')]=_0x4c3c2e[_0x5ce8('0x65')]({'plain':!![]});return db[_0x5ce8('0x66')][_0x5ce8('0x47')]({'where':{'id':_0x4c3c2e[_0x5ce8('0x67')]}});}return null;})[_0x5ce8('0x25')](handleEntityNotFound(_0x5d8447,null))['then'](function(_0x286b9b){if(_0x286b9b){return _0x286b9b[_0x5ce8('0x45')]({'UserId':_0x4311b7[_0x5ce8('0x46')]['UserId'],'read1stAt':_[_0x5ce8('0x68')](_0x286b9b['read1stAt'])?moment()['format'](_0x5ce8('0x5d')):undefined});}return null;})[_0x5ce8('0x25')](function(_0x400baf){if(_0x400baf){_0x471f88['interaction']=_0x400baf[_0x5ce8('0x65')]({'plain':!![]});interaction_log['info'](_0x5ce8('0x69'),_0x4311b7[_0x5ce8('0x63')]['id'],_0x4311b7[_0x5ce8('0x63')][_0x5ce8('0x29')],_0x4311b7[_0x5ce8('0x63')][_0x5ce8('0x6a')],_0x471f88[_0x5ce8('0x6b')]['id'],_0x4311b7[_0x5ce8('0x46')]?JSON[_0x5ce8('0x18')](_0x4311b7['body']):'null');return respondWithRpcPromise(_0x5ce8('0x6c'),_0x5ce8('0x6d'),_0x471f88);}return null;})[_0x5ce8('0x25')](function(_0x2b75f5){var _0x32fb13=_0x5ce8('0x6e')+_0x2b75f5[_0x5ce8('0x1b')]['ContactId'];return db['sequelize'][_0x5ce8('0x31')](_0x32fb13,{'type':db[_0x5ce8('0x6f')][_0x5ce8('0x70')][_0x5ce8('0x71')],'raw':!![]})[_0x5ce8('0x25')](function(_0x404a0b){return _0x404a0b;});})[_0x5ce8('0x25')](function(_0x152e91){if(_0x152e91){_0x471f88['message']['contact']=_0x152e91[0x0];if(!_0x4311b7[_0x5ce8('0x46')]['UserId'])return;return db[_0x5ce8('0x72')]['find']({'where':{'id':_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x62')],'role':'agent'},'attributes':['id',_0x5ce8('0x29'),_0x5ce8('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x5ce8('0x25')](function(_0x139021){if(!_0x139021)return null;_0x471f88[_0x5ce8('0x1b')]['agent']=_0x139021;return _0x471f88;})[_0x5ce8('0x25')](function(_0x17f3da){if(_0x17f3da){if(_0x4311b7[_0x5ce8('0x46')][_0x5ce8('0x74')]){_0x471f88[_0x5ce8('0x1b')][_0x5ce8('0x75')]=util[_0x5ce8('0x61')](_0x5ce8('0x76'),_0x4311b7[_0x5ce8('0x63')][_0x5ce8('0x29')]);_0x471f88[_0x5ce8('0x1b')][_0x5ce8('0x77')]=_0x471f88['channel'];_0x471f88[_0x5ce8('0x1b')]['motionChannel']=_0x471f88[_0x5ce8('0x77')];_0x471f88[_0x5ce8('0x1b')][_0x5ce8('0x78')]=_0x5ce8('0x79');_0x471f88[_0x5ce8('0x1b')]['body']=htmlToText[_0x5ce8('0x7a')](_0x471f88['message'][_0x5ce8('0x46')]);return respondWithRpcPromise(_0x5ce8('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x471f88[_0x5ce8('0x1b')]},client9002)[_0x5ce8('0x25')](function(){return _0x471f88;});}return _0x471f88;}return null;})['then'](respondWithResult(_0x5d8447,null))[_0x5ce8('0x1c')](handleError(_0x5d8447,null));};exports[_0x5ce8('0x7c')]=function(_0x476f2d,_0x150735){var _0x176a4b={'agent':{},'channel':_0x5ce8('0x5e')};if(_0x476f2d[_0x5ce8('0x46')]['id']){delete _0x476f2d['body']['id'];}_0x476f2d['body']['UserId']=_0x476f2d['body']['UserId']||_0x476f2d['user']['id'];_0x176a4b[_0x5ce8('0x64')]['id']=_0x476f2d[_0x5ce8('0x46')]['UserId'];return db[_0x5ce8('0x2c')]['find']({'where':{'id':_0x476f2d[_0x5ce8('0x41')]['id'],'UserId':null}})[_0x5ce8('0x25')](handleEntityNotFound(_0x150735,null))[_0x5ce8('0x25')](function(_0x4593c3){if(_0x4593c3){_0x176a4b[_0x5ce8('0x1b')]=_0x4593c3[_0x5ce8('0x65')]({'plain':!![]});return db[_0x5ce8('0x66')][_0x5ce8('0x47')]({'where':{'id':_0x4593c3['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x150735,null))[_0x5ce8('0x25')](function(_0x4eec19){if(_0x4eec19){_0x176a4b[_0x5ce8('0x6b')]=_0x4eec19['get']({'plain':!![]});interaction_log[_0x5ce8('0x13')](_0x5ce8('0x7d'),_0x476f2d['user']['id'],_0x476f2d[_0x5ce8('0x63')][_0x5ce8('0x29')],_0x476f2d[_0x5ce8('0x63')][_0x5ce8('0x6a')],_0x176a4b[_0x5ce8('0x6b')]['id'],_0x476f2d['body']?JSON[_0x5ce8('0x18')](_0x476f2d[_0x5ce8('0x46')]):_0x5ce8('0x7e'));return respondWithRpcPromise(_0x5ce8('0x7f'),_0x5ce8('0x80'),_0x176a4b);}return null;})[_0x5ce8('0x25')](function(_0x4f0d1d){var _0x32959f=_0x5ce8('0x6e')+_0x4f0d1d[_0x5ce8('0x1b')][_0x5ce8('0x81')];return db['sequelize'][_0x5ce8('0x31')](_0x32959f,{'type':db[_0x5ce8('0x6f')][_0x5ce8('0x70')][_0x5ce8('0x71')],'raw':!![]})[_0x5ce8('0x25')](function(_0x54ec47){return _0x54ec47;});})['then'](function(_0x223a75){if(_0x223a75){_0x176a4b['message'][_0x5ce8('0x82')]=_0x223a75[0x0];if(!_0x476f2d[_0x5ce8('0x46')]['UserId'])return;return db[_0x5ce8('0x72')][_0x5ce8('0x47')]({'where':{'id':_0x476f2d[_0x5ce8('0x46')][_0x5ce8('0x62')],'role':_0x5ce8('0x64')},'attributes':['id','name',_0x5ce8('0x73'),_0x5ce8('0x83'),_0x5ce8('0x84')],'raw':!![]});}return null;})[_0x5ce8('0x25')](function(_0x3308bd){if(!_0x3308bd)return null;_0x176a4b[_0x5ce8('0x1b')]['agent']=_0x3308bd;return _0x176a4b;})[_0x5ce8('0x25')](function(_0x274be5){if(_0x274be5){_0x274be5[_0x5ce8('0x1b')][_0x5ce8('0x75')]=util[_0x5ce8('0x61')]('SIP/%s',_0x476f2d[_0x5ce8('0x63')][_0x5ce8('0x29')]);_0x274be5['message'][_0x5ce8('0x77')]=_0x176a4b[_0x5ce8('0x77')];_0x274be5[_0x5ce8('0x1b')][_0x5ce8('0x85')]=_0x176a4b[_0x5ce8('0x77')];_0x274be5['message'][_0x5ce8('0x78')]=_0x5ce8('0x7c');_0x274be5['message'][_0x5ce8('0x46')]=htmlToText[_0x5ce8('0x7a')](_0x176a4b[_0x5ce8('0x1b')][_0x5ce8('0x46')]);respondWithRpcPromise(_0x5ce8('0x7b'),_0x5ce8('0x7b'),{'event':_0x5ce8('0x86'),'message':_0x274be5[_0x5ce8('0x1b')]},client9002);return _0x176a4b;}return null;})['then'](respondWithResult(_0x150735,null))[_0x5ce8('0x1c')](handleError(_0x150735,null));};exports['download']=function(_0x17036d,_0x2b46bf){var _0xc93488=moment()[_0x5ce8('0x87')]()['toString']();var _0x1b92a5=path[_0x5ce8('0x55')](config[_0x5ce8('0x56')],_0x5ce8('0x88'),_0x5ce8('0x89'),_0x5ce8('0x8a'));var _0x557f85=path[_0x5ce8('0x55')](config[_0x5ce8('0x56')],'server',_0x5ce8('0x89'),_0x5ce8('0x54'));var _0x2bf492=util[_0x5ce8('0x61')](_0x5ce8('0x8b'),_0xc93488);return db[_0x5ce8('0x2c')][_0x5ce8('0x47')]({'where':{'id':_0x17036d[_0x5ce8('0x41')]['id']},'attributes':['id',_0x5ce8('0x46'),_0x5ce8('0x8c'),'to','cc','bcc','subject',_0x5ce8('0x8d')],'include':_0x17036d['query']['attachments']?[{'model':db[_0x5ce8('0x8e')],'as':_0x5ce8('0x8f')}]:undefined})[_0x5ce8('0x25')](handleEntityNotFound(_0x2b46bf,null))[_0x5ce8('0x25')](function(_0x48644a){if(_0x48644a){var _0x3b6885=_0x48644a;var _0x4f01aa={'from':_0x3b6885[_0x5ce8('0x8c')],'to':_0x3b6885['to'],'subject':_0x3b6885[_0x5ce8('0x90')],'html':htmlEntities['decode'](_0x3b6885['body']),'headers':{'Date':moment(_0x3b6885[_0x5ce8('0x8d')])[_0x5ce8('0x61')](_0x5ce8('0x91'))},'attachments':[]};if(_0x48644a['cc']){_0x4f01aa['headers']['Cc']=_0x48644a['cc'];}if(_0x48644a[_0x5ce8('0x92')]){_0x4f01aa['headers'][_0x5ce8('0x93')]=_0x48644a[_0x5ce8('0x92')];}return new BPromise(function(_0x1b70c1,_0x122851){if(_0x48644a[_0x5ce8('0x8f')]){for(var _0xdac1d0=0x0;_0xdac1d0<_0x48644a[_0x5ce8('0x8f')][_0x5ce8('0x43')];_0xdac1d0++){var _0x6bb605=_0x48644a[_0x5ce8('0x8f')][_0xdac1d0];var _0x333796=path[_0x5ce8('0x55')](_0x557f85,_0x6bb605[_0x5ce8('0x58')]);if(fs['existsSync'](_0x333796)){_0x4f01aa[_0x5ce8('0x54')]['push']({'name':_0x6bb605[_0x5ce8('0x29')],'contentType':_0x6bb605[_0x5ce8('0x2e')],'data':fs[_0x5ce8('0x94')](_0x333796)});}}}emlformat[_0x5ce8('0x95')](_0x4f01aa,function(_0x256031,_0x426021){if(_0x256031)return _0x122851(_0x256031);fs[_0x5ce8('0x96')](path[_0x5ce8('0x55')](_0x1b92a5,_0x2bf492),_0x426021);return _0x1b70c1(_0x426021);});});}})[_0x5ce8('0x25')](function(_0x819471){if(_0x819471){return _0x2b46bf[_0x5ce8('0x97')](path[_0x5ce8('0x55')](_0x1b92a5,_0x2bf492),_0x2bf492,function(_0x5499e8){if(!_0x5499e8)fs['unlinkSync'](path[_0x5ce8('0x55')](_0x1b92a5,_0x2bf492));});}})['catch'](handleError(_0x2b46bf,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index dfcb7b1..6fb26b2 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 _0x06c6=['MailMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x06c6,0xbc));var _0x606c=function(_0x3a4c94,_0x117204){_0x3a4c94=_0x3a4c94-0x0;var _0x2fddad=_0x06c6[_0x3a4c94];return _0x2fddad;};'use strict';var EventEmitter=require(_0x606c('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x606c('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x606c('0x2')](0x0);var events={'afterCreate':_0x606c('0x3'),'afterUpdate':_0x606c('0x4'),'afterDestroy':_0x606c('0x5')};function emitEvent(_0x148160){return function(_0x5ec35c,_0x530ddf,_0x3321ae){MailMessageEvents['emit'](_0x148160+':'+_0x5ec35c['id'],_0x5ec35c);MailMessageEvents['emit'](_0x148160,_0x5ec35c);_0x3321ae(null);};}for(var e in events){if(events[_0x606c('0x6')](e)){var event=events[e];MailMessage[_0x606c('0x7')](e,emitEvent(event));}}module[_0x606c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xd8fd=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3bd0d8,_0xc8228c){var _0x3d7415=function(_0x13e7e9){while(--_0x13e7e9){_0x3bd0d8['push'](_0x3bd0d8['shift']());}};_0x3d7415(++_0xc8228c);}(_0xd8fd,0x14c));var _0xdd8f=function(_0x3a1058,_0x255329){_0x3a1058=_0x3a1058-0x0;var _0x2509c5=_0xd8fd[_0x3a1058];return _0x2509c5;};'use strict';var EventEmitter=require(_0xdd8f('0x0'));var MailMessage=require(_0xdd8f('0x1'))['db'][_0xdd8f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xdd8f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd8f('0x4'),'afterDestroy':_0xdd8f('0x5')};function emitEvent(_0x433c51){return function(_0x3e253c,_0x4de5c5,_0x54fda2){MailMessageEvents[_0xdd8f('0x6')](_0x433c51+':'+_0x3e253c['id'],_0x3e253c);MailMessageEvents[_0xdd8f('0x6')](_0x433c51,_0x3e253c);_0x54fda2(null);};}for(var e in events){if(events[_0xdd8f('0x7')](e)){var event=events[e];MailMessage[_0xdd8f('0x8')](e,emitEvent(event));}}module[_0xdd8f('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index eb58514..9462861 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 _0x8f4b=['path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','UserId','MailInteractionId','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x16334a,_0x32320e){var _0x513a6c=function(_0x261651){while(--_0x261651){_0x16334a['push'](_0x16334a['shift']());}};_0x513a6c(++_0x32320e);}(_0x8f4b,0x125));var _0xb8f4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f4b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb8f4('0x0'));var util=require(_0xb8f4('0x1'));var logger=require(_0xb8f4('0x2'))(_0xb8f4('0x3'));var moment=require(_0xb8f4('0x4'));var BPromise=require(_0xb8f4('0x5'));var rp=require(_0xb8f4('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xb8f4('0x7'));var rimraf=require(_0xb8f4('0x8'));var config=require(_0xb8f4('0x9'));var attributes=require('./mailMessage.attributes');module[_0xb8f4('0xa')]=function(_0x5dbb85,_0x556ca3){return _0x5dbb85[_0xb8f4('0xb')](_0xb8f4('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb8f4('0xd'),'fields':['messageId']},{'name':_0xb8f4('0xe'),'fields':[_0xb8f4('0xf'),_0xb8f4('0x10')],'type':_0xb8f4('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2304f7,_0x4ff2ba,_0x3b64dc){if(_0x2304f7[_0xb8f4('0x12')]){_0x2304f7[_0xb8f4('0xf')]=htmlToText['fromString'](_0x2304f7[_0xb8f4('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3b64dc(null,_0x4ff2ba);},'afterCreate':function(_0xe09a3f,_0x4876da,_0x43a0ac){var _0x3ff525=_0x5dbb85[_0xb8f4('0x13')];var _0x94918f=_0xe09a3f[_0xb8f4('0x14')]({'plain':!![]});if(_0x94918f[_0xb8f4('0x15')]['toLowerCase']()==='in'||_0x94918f['direction'][_0xb8f4('0x16')]()===_0xb8f4('0x17')&&!_0x94918f['secret']&&!_['isNil'](_0x94918f[_0xb8f4('0x18')])){_0x3ff525['MailInteraction']['findOne']({'where':{'id':_0x94918f[_0xb8f4('0x19')]}})[_0xb8f4('0x1a')](function(_0x5080c8){if(_0x5080c8){_0x5080c8['update']({'lastMsgAt':_0x94918f['createdAt'],'lastMsgDirection':_0x94918f[_0xb8f4('0x15')][_0xb8f4('0x16')]()});}})['catch'](function(_0x5ab11e){console[_0xb8f4('0x1b')](_0x5ab11e);});}_0x43a0ac();}},'charset':_0xb8f4('0x1c'),'collate':_0xb8f4('0x1d')});}; \ No newline at end of file +var _0x6700=['then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId'];(function(_0x3bc962,_0x510129){var _0x9ab40e=function(_0x3b0849){while(--_0x3b0849){_0x3bc962['push'](_0x3bc962['shift']());}};_0x9ab40e(++_0x510129);}(_0x6700,0x1b3));var _0x0670=function(_0x469911,_0x45b373){_0x469911=_0x469911-0x0;var _0x35863c=_0x6700[_0x469911];return _0x35863c;};'use strict';var _=require(_0x0670('0x0'));var util=require(_0x0670('0x1'));var logger=require(_0x0670('0x2'))('api');var moment=require(_0x0670('0x3'));var BPromise=require(_0x0670('0x4'));var rp=require('request-promise');var htmlToText=require(_0x0670('0x5'));var fs=require('fs');var path=require(_0x0670('0x6'));var rimraf=require(_0x0670('0x7'));var config=require(_0x0670('0x8'));var attributes=require('./mailMessage.attributes');module[_0x0670('0x9')]=function(_0x3dd2e7,_0x592ad4){return _0x3dd2e7[_0x0670('0xa')](_0x0670('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x0670('0xc'),'fields':[_0x0670('0xc')]},{'name':_0x0670('0xd'),'fields':[_0x0670('0xe'),_0x0670('0xf')],'type':_0x0670('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c16f5,_0x49811d,_0x1a69a4){if(_0x5c16f5[_0x0670('0x11')]){_0x5c16f5['plainBody']=htmlToText[_0x0670('0x12')](_0x5c16f5[_0x0670('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1a69a4(null,_0x49811d);},'afterCreate':function(_0x43b2cd,_0x423296,_0x2cc461){var _0x36746e=_0x3dd2e7[_0x0670('0x13')];var _0x574b2a=_0x43b2cd['get']({'plain':!![]});if(_0x574b2a[_0x0670('0x14')]['toLowerCase']()==='in'||_0x574b2a[_0x0670('0x14')][_0x0670('0x15')]()===_0x0670('0x16')&&!_0x574b2a['secret']&&!_[_0x0670('0x17')](_0x574b2a[_0x0670('0x18')])){_0x36746e['MailInteraction'][_0x0670('0x19')]({'where':{'id':_0x574b2a[_0x0670('0x1a')]}})[_0x0670('0x1b')](function(_0x1c0e10){if(_0x1c0e10){_0x1c0e10[_0x0670('0x1c')]({'lastMsgAt':_0x574b2a[_0x0670('0x1d')],'lastMsgDirection':_0x574b2a[_0x0670('0x14')][_0x0670('0x15')]()});}})[_0x0670('0x1e')](function(_0x2d2381){console[_0x0670('0x1f')](_0x2d2381);});}_0x2cc461();}},'charset':_0x0670('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8ea7fb1..88d8382 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 _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x30e428,_0x2d6a19){var _0xefea40=function(_0x197e19){while(--_0x197e19){_0x30e428['push'](_0x30e428['shift']());}};_0xefea40(++_0x2d6a19);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file +var _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x2b93f2,_0x3c6b00){var _0x43900b=function(_0x222484){while(--_0x222484){_0x2b93f2['push'](_0x2b93f2['shift']());}};_0x43900b(++_0x3c6b00);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf2e3[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a7ddd64..836fa5e 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 _0x0060=['update','removeListener','length','save','remove'];(function(_0x26bf7b,_0x1d8e01){var _0x1e89d8=function(_0x5622ab){while(--_0x5622ab){_0x26bf7b['push'](_0x26bf7b['shift']());}};_0x1e89d8(++_0x1d8e01);}(_0x0060,0xda));var _0x0006=function(_0x1ae139,_0x529c60){_0x1ae139=_0x1ae139-0x0;var _0x5e0de7=_0x0060[_0x1ae139];return _0x5e0de7;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x0006('0x0'),_0x0006('0x1'),_0x0006('0x2')];function createListener(_0x35589e,_0x54dfaf){return function(_0x40cf82){_0x54dfaf['emit'](_0x35589e,_0x40cf82);};}function removeListener(_0x13ab2f,_0x24195b){return function(){MailMessageEvents[_0x0006('0x3')](_0x13ab2f,_0x24195b);};}exports['register']=function(_0x5041b3){for(var _0x101cc3=0x0,_0x3b40c8=events[_0x0006('0x4')];_0x101cc3<_0x3b40c8;_0x101cc3++){var _0x541b63=events[_0x101cc3];var _0x10e4f5=createListener('mailMessage:'+_0x541b63,_0x5041b3);MailMessageEvents['on'](_0x541b63,_0x10e4f5);}}; \ No newline at end of file +var _0x2f74=['save','remove','update','emit','register','length','mailMessage:','./mailMessage.events'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x2f74,0xb7));var _0x42f7=function(_0x3c0e33,_0x4e9903){_0x3c0e33=_0x3c0e33-0x0;var _0x48d10c=_0x2f74[_0x3c0e33];return _0x48d10c;};'use strict';var MailMessageEvents=require(_0x42f7('0x0'));var events=[_0x42f7('0x1'),_0x42f7('0x2'),_0x42f7('0x3')];function createListener(_0x414a24,_0x58d22d){return function(_0x2d74c1){_0x58d22d[_0x42f7('0x4')](_0x414a24,_0x2d74c1);};}function removeListener(_0x15c1d6,_0x499e0f){return function(){MailMessageEvents['removeListener'](_0x15c1d6,_0x499e0f);};}exports[_0x42f7('0x5')]=function(_0x64156e){for(var _0x194f53=0x0,_0x147caf=events[_0x42f7('0x6')];_0x194f53<_0x147caf;_0x194f53++){var _0x4848ac=events[_0x194f53];var _0x346d22=createListener(_0x42f7('0x7')+_0x4848ac,_0x64156e);MailMessageEvents['on'](_0x4848ac,_0x346d22);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b30efe7..cb26fa5 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 _0x1038=['put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','create','post','addAgents'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x1038,0xa3));var _0x8103=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x1038[_0x265003];return _0x33c743;};'use strict';var multer=require(_0x8103('0x0'));var util=require(_0x8103('0x1'));var path=require(_0x8103('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8103('0x3')]();var fs_extra=require(_0x8103('0x4'));var auth=require(_0x8103('0x5'));var interaction=require(_0x8103('0x6'));var config=require(_0x8103('0x7'));var controller=require(_0x8103('0x8'));router[_0x8103('0x9')]('/',auth['isAuthenticated'](),controller[_0x8103('0xa')]);router[_0x8103('0x9')](_0x8103('0xb'),auth[_0x8103('0xc')](),controller[_0x8103('0xd')]);router[_0x8103('0x9')](_0x8103('0xe'),auth[_0x8103('0xc')](),controller[_0x8103('0xf')]);router[_0x8103('0x9')](_0x8103('0x10'),auth[_0x8103('0xc')](),controller[_0x8103('0x11')]);router[_0x8103('0x9')]('/:id/teams',auth[_0x8103('0xc')](),controller['getTeams']);router[_0x8103('0x9')](_0x8103('0x12'),auth[_0x8103('0xc')](),controller[_0x8103('0x13')]);router['post']('/',auth[_0x8103('0xc')](),controller[_0x8103('0x14')]);router[_0x8103('0x15')]('/:id/teams',auth[_0x8103('0xc')](),controller['addTeams']);router['post'](_0x8103('0x12'),auth[_0x8103('0xc')](),controller[_0x8103('0x16')]);router[_0x8103('0x17')](_0x8103('0xe'),auth[_0x8103('0xc')](),controller[_0x8103('0x18')]);router[_0x8103('0x19')]('/:id',auth[_0x8103('0xc')](),controller[_0x8103('0x1a')]);router[_0x8103('0x19')](_0x8103('0x1b'),auth[_0x8103('0xc')](),controller[_0x8103('0x1c')]);router[_0x8103('0x19')](_0x8103('0x12'),auth[_0x8103('0xc')](),controller[_0x8103('0x1d')]);module[_0x8103('0x1e')]=router; \ No newline at end of file +var _0x9560=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x1271af,_0x42685d){var _0x7562d2=function(_0x233dad){while(--_0x233dad){_0x1271af['push'](_0x1271af['shift']());}};_0x7562d2(++_0x42685d);}(_0x9560,0x174));var _0x0956=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x9560[_0x16e0c8];return _0xe4b5af;};'use strict';var multer=require(_0x0956('0x0'));var util=require(_0x0956('0x1'));var path=require('path');var timeout=require(_0x0956('0x2'));var express=require(_0x0956('0x3'));var router=express[_0x0956('0x4')]();var fs_extra=require(_0x0956('0x5'));var auth=require(_0x0956('0x6'));var interaction=require(_0x0956('0x7'));var config=require('../../config/environment');var controller=require(_0x0956('0x8'));router[_0x0956('0x9')]('/',auth[_0x0956('0xa')](),controller[_0x0956('0xb')]);router[_0x0956('0x9')](_0x0956('0xc'),auth[_0x0956('0xa')](),controller['describe']);router['get'](_0x0956('0xd'),auth['isAuthenticated'](),controller[_0x0956('0xe')]);router[_0x0956('0x9')](_0x0956('0xf'),auth[_0x0956('0xa')](),controller[_0x0956('0x10')]);router[_0x0956('0x9')](_0x0956('0x11'),auth[_0x0956('0xa')](),controller[_0x0956('0x12')]);router[_0x0956('0x9')](_0x0956('0x13'),auth[_0x0956('0xa')](),controller[_0x0956('0x14')]);router['post']('/',auth[_0x0956('0xa')](),controller['create']);router[_0x0956('0x15')](_0x0956('0x11'),auth[_0x0956('0xa')](),controller['addTeams']);router[_0x0956('0x15')](_0x0956('0x13'),auth[_0x0956('0xa')](),controller[_0x0956('0x16')]);router['put'](_0x0956('0xd'),auth[_0x0956('0xa')](),controller[_0x0956('0x17')]);router['delete'](_0x0956('0xd'),auth[_0x0956('0xa')](),controller[_0x0956('0x18')]);router[_0x0956('0x19')](_0x0956('0x11'),auth['isAuthenticated'](),controller[_0x0956('0x1a')]);router['delete'](_0x0956('0x13'),auth[_0x0956('0xa')](),controller[_0x0956('0x1b')]);module[_0x0956('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 5a64ecc..2587d7f 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 _0xd4c7=['STRING','name','rrmemory','roundrobin'];(function(_0x59d8dd,_0x32c6ed){var _0x4f5d41=function(_0x248e55){while(--_0x248e55){_0x59d8dd['push'](_0x59d8dd['shift']());}};_0x4f5d41(++_0x32c6ed);}(_0xd4c7,0x174));var _0x7d4c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd4c7[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d4c('0x0')],'unique':_0x7d4c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d4c('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7d4c('0x2'),'beepall',_0x7d4c('0x3'))}}; \ No newline at end of file +var _0xb9f4=['INTEGER','ENUM','roundrobin','name','STRING'];(function(_0xd5c80e,_0x22b848){var _0x168f97=function(_0x10a6ce){while(--_0x10a6ce){_0xd5c80e['push'](_0xd5c80e['shift']());}};_0x168f97(++_0x22b848);}(_0xb9f4,0xbc));var _0x4b9f=function(_0x52e090,_0x224702){_0x52e090=_0x52e090-0x0;var _0x1cc3bb=_0xb9f4[_0x52e090];return _0x1cc3bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4b9f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4b9f('0x1')]},'timeout':{'type':Sequelize[_0x4b9f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4b9f('0x3')]('rrmemory','beepall',_0x4b9f('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 72be070..e5a85ba 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 _0x9010=['model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','rawAttributes','User','findAndCountAll','agent','mailPause','updatedAt','%s/%s','SIP','createdAt','getTeams','ids','Team','findAll','Agents','online','voicePause','flatMap','transaction','addTeams','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','SELECT','TeamId','union','compact','isEmpty','forEach','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','fieldName','type'];(function(_0x3b3094,_0x55bb1d){var _0x54e382=function(_0x900231){while(--_0x900231){_0x3b3094['push'](_0x3b3094['shift']());}};_0x54e382(++_0x55bb1d);}(_0x9010,0xdf));var _0x0901=function(_0x165135,_0x4af4e3){_0x165135=_0x165135-0x0;var _0x5a838b=_0x9010[_0x165135];return _0x5a838b;};'use strict';var emlformat=require(_0x0901('0x0'));var rimraf=require(_0x0901('0x1'));var zipdir=require(_0x0901('0x2'));var jsonpatch=require(_0x0901('0x3'));var rp=require(_0x0901('0x4'));var moment=require(_0x0901('0x5'));var BPromise=require(_0x0901('0x6'));var Mustache=require(_0x0901('0x7'));var util=require(_0x0901('0x8'));var path=require(_0x0901('0x9'));var sox=require(_0x0901('0xa'));var csv=require('to-csv');var ejs=require(_0x0901('0xb'));var fs=require('fs');var fs_extra=require(_0x0901('0xc'));var _=require(_0x0901('0xd'));var squel=require(_0x0901('0xe'));var crypto=require(_0x0901('0xf'));var jsforce=require(_0x0901('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0901('0x11'));var querystring=require('querystring');var Papa=require(_0x0901('0x12'));var Redis=require('ioredis');var authService=require(_0x0901('0x13'));var qs=require(_0x0901('0x14'));var as=require(_0x0901('0x15'));var hardwareService=require(_0x0901('0x16'));var logger=require(_0x0901('0x17'))(_0x0901('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0901('0x19'))['db'];config['redis']=_['defaults'](config[_0x0901('0x1a')],{'host':_0x0901('0x1b'),'port':0x18eb});var socket=require(_0x0901('0x1c'))(new Redis(config[_0x0901('0x1a')]));require(_0x0901('0x1d'))[_0x0901('0x1e')](socket);function respondWithStatusCode(_0x3e572e,_0x46cd56){_0x46cd56=_0x46cd56||0xcc;return function(_0x50d992){if(_0x50d992){return _0x3e572e[_0x0901('0x1f')](_0x46cd56);}return _0x3e572e[_0x0901('0x20')](_0x46cd56)['end']();};}function respondWithResult(_0x885d2c,_0x50cac0){_0x50cac0=_0x50cac0||0xc8;return function(_0x219a23){if(_0x219a23){return _0x885d2c[_0x0901('0x20')](_0x50cac0)[_0x0901('0x21')](_0x219a23);}};}function respondWithFilteredResult(_0x2d9750,_0x83e0d5){return function(_0x371e91){if(_0x371e91){var _0x2ceeb4=typeof _0x83e0d5[_0x0901('0x22')]==='undefined'&&typeof _0x83e0d5[_0x0901('0x23')]==='undefined';var _0xe89960=_0x371e91[_0x0901('0x24')];var _0xc020fc=_0x2ceeb4?0x0:_0x83e0d5[_0x0901('0x22')];var _0x1fafef=_0x2ceeb4?_0x371e91[_0x0901('0x24')]:_0x83e0d5[_0x0901('0x22')]+_0x83e0d5[_0x0901('0x23')];var _0x2125a8;if(_0x1fafef>=_0xe89960){_0x1fafef=_0xe89960;_0x2125a8=0xc8;}else{_0x2125a8=0xce;}_0x2d9750[_0x0901('0x20')](_0x2125a8);return _0x2d9750[_0x0901('0x25')](_0x0901('0x26'),_0xc020fc+'-'+_0x1fafef+'/'+_0xe89960)[_0x0901('0x21')](_0x371e91);}return null;};}function patchUpdates(_0x10180e){return function(_0x12b98d){try{jsonpatch[_0x0901('0x27')](_0x12b98d,_0x10180e,!![]);}catch(_0x1a4eed){return BPromise[_0x0901('0x28')](_0x1a4eed);}return _0x12b98d['save']();};}function saveUpdates(_0x2a3655,_0xf0442d){return function(_0x30c0c7){if(_0x30c0c7){return _0x30c0c7[_0x0901('0x29')](_0x2a3655)[_0x0901('0x2a')](function(_0x4aba00){return _0x4aba00;});}return null;};}function removeEntity(_0x49f69a,_0xeb4227){return function(_0xca15d2){if(_0xca15d2){return _0xca15d2[_0x0901('0x2b')]()['then'](function(){var _0x2a3b81=_0xca15d2[_0x0901('0x2c')]({'plain':!![]});var _0x24971a=_0x0901('0x2d');return db[_0x0901('0x2e')]['destroy']({'where':{'type':_0x24971a,'resourceId':_0x2a3b81['id']}})[_0x0901('0x2a')](function(){return _0xca15d2;});})['then'](function(){_0x49f69a[_0x0901('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13165c,_0x5012bb){return function(_0x2455f4){if(!_0x2455f4){_0x13165c[_0x0901('0x1f')](0x194);}return _0x2455f4;};}function handleError(_0x388f4a,_0x1398fd){_0x1398fd=_0x1398fd||0x1f4;return function(_0x1b7529){logger[_0x0901('0x2f')](_0x1b7529[_0x0901('0x30')]);if(_0x1b7529['name']){delete _0x1b7529[_0x0901('0x31')];}_0x388f4a['status'](_0x1398fd)[_0x0901('0x32')](_0x1b7529);};}exports[_0x0901('0x33')]=function(_0x257aef,_0x5bcfb3){var _0x3258df={},_0x4ce3cf={},_0x14b4d3={'count':0x0,'rows':[]};var _0x4a4b05=_['map'](db[_0x0901('0x34')]['rawAttributes'],function(_0x2a5a1c){return{'name':_0x2a5a1c[_0x0901('0x35')],'type':_0x2a5a1c[_0x0901('0x36')]['key']};});_0x4ce3cf[_0x0901('0x37')]=_[_0x0901('0x38')](_0x4a4b05,_0x0901('0x31'));_0x4ce3cf[_0x0901('0x39')]=_['keys'](_0x257aef['query']);_0x4ce3cf[_0x0901('0x3a')]=_[_0x0901('0x3b')](_0x4ce3cf[_0x0901('0x37')],_0x4ce3cf[_0x0901('0x39')]);_0x3258df[_0x0901('0x3c')]=_['intersection'](_0x4ce3cf[_0x0901('0x37')],qs['fields'](_0x257aef['query']['fields']));_0x3258df[_0x0901('0x3c')]=_0x3258df[_0x0901('0x3c')]['length']?_0x3258df[_0x0901('0x3c')]:_0x4ce3cf[_0x0901('0x37')];if(!_0x257aef[_0x0901('0x39')][_0x0901('0x3d')](_0x0901('0x3e'))){_0x3258df[_0x0901('0x23')]=qs[_0x0901('0x23')](_0x257aef[_0x0901('0x39')][_0x0901('0x23')]);_0x3258df[_0x0901('0x22')]=qs[_0x0901('0x22')](_0x257aef[_0x0901('0x39')][_0x0901('0x22')]);}_0x3258df[_0x0901('0x3f')]=qs[_0x0901('0x40')](_0x257aef['query'][_0x0901('0x40')]);_0x3258df[_0x0901('0x41')]=qs[_0x0901('0x3a')](_[_0x0901('0x42')](_0x257aef[_0x0901('0x39')],_0x4ce3cf[_0x0901('0x3a')]),_0x4a4b05);if(_0x257aef[_0x0901('0x39')][_0x0901('0x43')]){_0x3258df[_0x0901('0x41')]=_['merge'](_0x3258df[_0x0901('0x41')],{'$or':_[_0x0901('0x38')](_0x4a4b05,function(_0x5f306b){if(_0x5f306b[_0x0901('0x36')]!==_0x0901('0x44')){var _0x434f99={};_0x434f99[_0x5f306b['name']]={'$like':'%'+_0x257aef[_0x0901('0x39')][_0x0901('0x43')]+'%'};return _0x434f99;}})});}_0x3258df=_[_0x0901('0x45')]({},_0x3258df,_0x257aef[_0x0901('0x46')]);var _0x25596e={'where':_0x3258df[_0x0901('0x41')]};return db[_0x0901('0x34')]['count'](_0x25596e)[_0x0901('0x2a')](function(_0x518915){_0x14b4d3[_0x0901('0x24')]=_0x518915;if(_0x257aef['query'][_0x0901('0x47')]){_0x3258df[_0x0901('0x48')]=[{'all':!![]}];}return db[_0x0901('0x34')]['findAll'](_0x3258df);})[_0x0901('0x2a')](function(_0x21fcfd){_0x14b4d3[_0x0901('0x49')]=_0x21fcfd;return _0x14b4d3;})[_0x0901('0x2a')](respondWithFilteredResult(_0x5bcfb3,_0x3258df))[_0x0901('0x4a')](handleError(_0x5bcfb3,null));};exports[_0x0901('0x4b')]=function(_0x4710ac,_0x409f68){var _0x4fe2bd={'raw':!![],'where':{'id':_0x4710ac['params']['id']}},_0x5eb32a={};_0x5eb32a[_0x0901('0x37')]=_['keys'](db[_0x0901('0x34')]['rawAttributes']);_0x5eb32a[_0x0901('0x39')]=_[_0x0901('0x4c')](_0x4710ac[_0x0901('0x39')]);_0x5eb32a['filters']=_[_0x0901('0x3b')](_0x5eb32a[_0x0901('0x37')],_0x5eb32a['query']);_0x4fe2bd['attributes']=_['intersection'](_0x5eb32a[_0x0901('0x37')],qs[_0x0901('0x4d')](_0x4710ac[_0x0901('0x39')]['fields']));_0x4fe2bd[_0x0901('0x3c')]=_0x4fe2bd[_0x0901('0x3c')][_0x0901('0x4e')]?_0x4fe2bd[_0x0901('0x3c')]:_0x5eb32a['model'];if(_0x4710ac[_0x0901('0x39')]['includeAll']){_0x4fe2bd[_0x0901('0x48')]=[{'all':!![]}];}_0x4fe2bd=_[_0x0901('0x45')]({},_0x4fe2bd,_0x4710ac[_0x0901('0x46')]);return db[_0x0901('0x34')][_0x0901('0x4f')](_0x4fe2bd)[_0x0901('0x2a')](handleEntityNotFound(_0x409f68,null))[_0x0901('0x2a')](respondWithResult(_0x409f68,null))['catch'](handleError(_0x409f68,null));};exports[_0x0901('0x50')]=function(_0x1664bf,_0x422cdb){return db[_0x0901('0x34')][_0x0901('0x50')](_0x1664bf[_0x0901('0x51')],{})[_0x0901('0x2a')](function(_0x14aafd){var _0x5059f7=_0x1664bf[_0x0901('0x52')]['get']({'plain':!![]});if(!_0x5059f7)throw new Error(_0x0901('0x53'));if(_0x5059f7[_0x0901('0x54')]==='user'){var _0x2ab93b=_0x14aafd['get']({'plain':!![]});var _0x2fb4ed='MailQueues';return db['UserProfileSection'][_0x0901('0x4f')]({'where':{'name':_0x2fb4ed,'userProfileId':_0x5059f7['userProfileId']},'raw':!![]})[_0x0901('0x2a')](function(_0x5afb05){if(_0x5afb05&&_0x5afb05['autoAssociation']===0x0){return db[_0x0901('0x2e')]['create']({'name':_0x2ab93b[_0x0901('0x31')],'resourceId':_0x2ab93b['id'],'type':_0x5afb05['name'],'sectionId':_0x5afb05['id']},{})[_0x0901('0x2a')](function(){return _0x14aafd;});}else{return _0x14aafd;}})[_0x0901('0x4a')](function(_0x318c82){logger[_0x0901('0x2f')](_0x0901('0x55'),_0x318c82);throw _0x318c82;});}return _0x14aafd;})[_0x0901('0x2a')](respondWithResult(_0x422cdb,0xc9))['catch'](handleError(_0x422cdb,null));};exports['update']=function(_0x18ba42,_0x5e39b4){if(_0x18ba42[_0x0901('0x51')]['id']){delete _0x18ba42[_0x0901('0x51')]['id'];}return db[_0x0901('0x34')][_0x0901('0x4f')]({'where':{'id':_0x18ba42[_0x0901('0x56')]['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x5e39b4,null))['then'](saveUpdates(_0x18ba42[_0x0901('0x51')],null))['then'](respondWithResult(_0x5e39b4,null))[_0x0901('0x4a')](handleError(_0x5e39b4,null));};exports[_0x0901('0x2b')]=function(_0xbaf4c2,_0x370488){return db[_0x0901('0x34')][_0x0901('0x4f')]({'where':{'id':_0xbaf4c2[_0x0901('0x56')]['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x370488,null))[_0x0901('0x2a')](removeEntity(_0x370488,null))[_0x0901('0x4a')](handleError(_0x370488,null));};exports['describe']=function(_0x3c2652,_0x39e4d8){return db['MailQueue'][_0x0901('0x57')]()[_0x0901('0x2a')](respondWithResult(_0x39e4d8,null))[_0x0901('0x4a')](handleError(_0x39e4d8,null));};exports[_0x0901('0x58')]=function(_0x23aace,_0x395d37,_0xe50ea5){var _0x2839d9={'raw':!![],'where':{}},_0xbacb70={},_0x314837;return db[_0x0901('0x34')][_0x0901('0x59')]({'where':{'id':_0x23aace['params']['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x395d37,null))[_0x0901('0x2a')](function(_0x1c0305){if(_0x1c0305){_0x314837=_0x1c0305[_0x0901('0x2c')]({'plain':!![]});_0xbacb70[_0x0901('0x37')]=_[_0x0901('0x4c')](db[_0x0901('0x5a')][_0x0901('0x5b')]);_0xbacb70[_0x0901('0x39')]=_[_0x0901('0x4c')](_0x23aace[_0x0901('0x39')]);_0xbacb70[_0x0901('0x3a')]=_[_0x0901('0x3b')](_0xbacb70[_0x0901('0x37')],_0xbacb70[_0x0901('0x39')]);_0x2839d9[_0x0901('0x3c')]=_[_0x0901('0x3b')](_0xbacb70[_0x0901('0x37')],qs[_0x0901('0x4d')](_0x23aace[_0x0901('0x39')][_0x0901('0x4d')]));_0x2839d9['attributes']=_0x2839d9[_0x0901('0x3c')]['length']?_0x2839d9[_0x0901('0x3c')]:_0xbacb70[_0x0901('0x37')];if(!_0x23aace['query'][_0x0901('0x3d')](_0x0901('0x3e'))){_0x2839d9[_0x0901('0x23')]=qs[_0x0901('0x23')](_0x23aace[_0x0901('0x39')][_0x0901('0x23')]);_0x2839d9[_0x0901('0x22')]=qs[_0x0901('0x22')](_0x23aace[_0x0901('0x39')][_0x0901('0x22')]);}_0x2839d9['order']=qs['sort'](_0x23aace[_0x0901('0x39')][_0x0901('0x40')]);_0x2839d9[_0x0901('0x41')]=qs[_0x0901('0x3a')](_['pick'](_0x23aace[_0x0901('0x39')],_0xbacb70['filters']));_0x2839d9['where']['MailQueueId']=_0x1c0305['id'];if(_0x23aace['query']['filter']){_0x2839d9[_0x0901('0x41')]=_['merge'](_0x2839d9[_0x0901('0x41')],{'$or':_[_0x0901('0x38')](_0x2839d9[_0x0901('0x3c')],function(_0x4180a8){var _0x5907ce={};_0x5907ce[_0x4180a8]={'$like':'%'+_0x23aace[_0x0901('0x39')][_0x0901('0x43')]+'%'};return _0x5907ce;})});}_0x2839d9=_['merge']({},_0x2839d9,_0x23aace[_0x0901('0x46')]);return db[_0x0901('0x5a')]['findAll'](_0x2839d9);}})[_0x0901('0x2a')](function(_0x4b087a){if(_0x4b087a){return db[_0x0901('0x5c')][_0x0901('0x5d')]({'where':{'id':_[_0x0901('0x38')](_0x4b087a,'UserId'),'role':_0x0901('0x5e')},'attributes':['id','name',_0x0901('0x5f'),_0x0901('0x60'),'createdAt']});}})['then'](function(_0x145a73){if(_0x145a73){return{'count':_0x145a73[_0x0901('0x24')],'rows':_[_0x0901('0x38')](_0x145a73[_0x0901('0x49')],function(_0x168f0d){return{'membername':_0x168f0d[_0x0901('0x31')],'UserId':_0x168f0d['id'],'queue_name':_0x314837[_0x0901('0x31')],'MailQueueId':_0x314837['id'],'interface':util['format'](_0x0901('0x61'),_0x0901('0x62'),_0x168f0d['name']),'penalty':0x0,'paused':_0x168f0d['mailPause'],'createdAt':_0x168f0d[_0x0901('0x63')],'updatedAt':_0x168f0d[_0x0901('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0901('0x2a')](respondWithFilteredResult(_0x395d37,_0x2839d9))['catch'](handleError(_0x395d37,null));};exports[_0x0901('0x64')]=function(_0x770a4a,_0x2c9294,_0x521f3c){var _0x3e2cc6={};var _0x40e98c={};var _0x33983b;var _0x4daa92;return db['MailQueue'][_0x0901('0x59')]({'where':{'id':_0x770a4a[_0x0901('0x56')]['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x2c9294,null))['then'](function(_0xa1b49d){if(_0xa1b49d){_0x33983b=_0xa1b49d;_0x40e98c['model']=_[_0x0901('0x4c')](db['Team'][_0x0901('0x5b')]);_0x40e98c[_0x0901('0x39')]=_[_0x0901('0x4c')](_0x770a4a[_0x0901('0x39')]);_0x40e98c['filters']=_[_0x0901('0x3b')](_0x40e98c[_0x0901('0x37')],_0x40e98c[_0x0901('0x39')]);_0x3e2cc6[_0x0901('0x3c')]=_[_0x0901('0x3b')](_0x40e98c[_0x0901('0x37')],qs[_0x0901('0x4d')](_0x770a4a[_0x0901('0x39')]['fields']));_0x3e2cc6[_0x0901('0x3c')]=_0x3e2cc6[_0x0901('0x3c')][_0x0901('0x4e')]?_0x3e2cc6[_0x0901('0x3c')]:_0x40e98c[_0x0901('0x37')];_0x3e2cc6[_0x0901('0x3f')]=qs[_0x0901('0x40')](_0x770a4a[_0x0901('0x39')][_0x0901('0x40')]);_0x3e2cc6[_0x0901('0x41')]=qs['filters'](_[_0x0901('0x42')](_0x770a4a['query'],_0x40e98c[_0x0901('0x3a')]));if(_0x770a4a[_0x0901('0x39')][_0x0901('0x43')]){_0x3e2cc6[_0x0901('0x41')]=_['merge'](_0x3e2cc6['where'],{'$or':_[_0x0901('0x38')](_0x3e2cc6['attributes'],function(_0x269046){var _0x395900={};_0x395900[_0x269046]={'$like':'%'+_0x770a4a[_0x0901('0x39')]['filter']+'%'};return _0x395900;})});}_0x3e2cc6=_['merge']({},_0x3e2cc6,_0x770a4a[_0x0901('0x46')]);return _0x33983b[_0x0901('0x64')](_0x3e2cc6);}})['then'](function(_0x3a1b71){if(_0x3a1b71){_0x4daa92=_0x3a1b71[_0x0901('0x4e')];if(!_0x770a4a[_0x0901('0x39')]['hasOwnProperty'](_0x0901('0x3e'))){_0x3e2cc6[_0x0901('0x23')]=qs[_0x0901('0x23')](_0x770a4a[_0x0901('0x39')]['limit']);_0x3e2cc6[_0x0901('0x22')]=qs[_0x0901('0x22')](_0x770a4a['query'][_0x0901('0x22')]);}return _0x33983b[_0x0901('0x64')](_0x3e2cc6);}})[_0x0901('0x2a')](function(_0x5cd2ec){if(_0x5cd2ec){return _0x5cd2ec?{'count':_0x4daa92,'rows':_0x5cd2ec}:null;}})['then'](respondWithResult(_0x2c9294,null))[_0x0901('0x4a')](handleError(_0x2c9294,null));};exports['addTeams']=function(_0x1ce607,_0xb18208,_0x3157d7){var _0x3ef8ed=_0x1ce607['body'][_0x0901('0x65')];return db[_0x0901('0x66')][_0x0901('0x67')]({'where':{'id':_0x3ef8ed},'attributes':['id'],'include':[{'model':db[_0x0901('0x5c')],'as':_0x0901('0x68'),'attributes':['id',_0x0901('0x31'),_0x0901('0x69'),_0x0901('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0xa25b41){if(_0xa25b41){var _0xd987a8=_[_0x0901('0x6b')](_0xa25b41,function(_0x3c74c1){var _0x518046=_0x3c74c1[_0x0901('0x2c')]({'plain':!![]});return _0x518046[_0x0901('0x68')];});return db[_0x0901('0x34')][_0x0901('0x4f')]({'where':{'id':_0x1ce607[_0x0901('0x56')]['id']}})['then'](function(_0x1e0b21){return db['sequelize'][_0x0901('0x6c')](function(_0x5cc230){return _0x1e0b21[_0x0901('0x6d')](_0x3ef8ed,{'transaction':_0x5cc230})['then'](function(){return BPromise[_0x0901('0x6e')](_0xd987a8,function(_0x15b497){return db[_0x0901('0x5a')][_0x0901('0x6f')]({'where':{'UserId':_0x15b497['id'],'MailQueueId':_0x1ce607[_0x0901('0x56')]['id']},'transaction':_0x5cc230});});})[_0x0901('0x2a')](function(){_0xd987a8['forEach'](function(_0xb0064e){socket[_0x0901('0x70')]('userMailQueue:save',{'UserId':_0xb0064e['id'],'MailQueueId':_0x1e0b21['id']});});});});});}})[_0x0901('0x2a')](respondWithStatusCode(_0xb18208,null))[_0x0901('0x4a')](handleError(_0xb18208,null));};exports[_0x0901('0x71')]=function(_0x1e3056,_0x22c97d,_0x126220){return db[_0x0901('0x66')][_0x0901('0x67')]({'where':{'id':_0x1e3056[_0x0901('0x39')][_0x0901('0x65')]},'attributes':['id'],'include':[{'model':db[_0x0901('0x5c')],'as':_0x0901('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x22c97d,null))[_0x0901('0x2a')](function(_0x4ac818){var _0x4a1b59=_['map'](_0x4ac818,'id');var _0x5ec599=[];var _0x29c653=[];var _0x54f9df=squel['select']();_0x54f9df[_0x0901('0x72')](_0x0901('0x73'))[_0x0901('0x74')]('team_has_mail_queues','tq')[_0x0901('0x75')](_0x0901('0x76'),'ut',_0x0901('0x77'))[_0x0901('0x41')]('MailQueueId\x20=\x20?',_0x1e3056[_0x0901('0x56')]['id']);for(var _0x487e22=0x0;_0x487e22<_0x4ac818[_0x0901('0x4e')];_0x487e22+=0x1){let _0x314c1e=_0x4ac818[_0x487e22];for(var _0xe1dd7c=0x0;_0xe1dd7c<_0x314c1e[_0x0901('0x68')][_0x0901('0x4e')];_0xe1dd7c+=0x1){let _0x54b9f3=_0x314c1e['Agents'][_0xe1dd7c];var _0x5b0d07=_0x54f9df[_0x0901('0x78')]();_0x5b0d07[_0x0901('0x41')]('ut.UserId\x20=\x20?',_0x54b9f3['id']);_0x29c653[_0x0901('0x79')](db[_0x0901('0x7a')]['query'](_0x5b0d07[_0x0901('0x7b')](),{'type':db[_0x0901('0x7a')][_0x0901('0x7c')][_0x0901('0x7d')]})['then'](function(_0x3141fd){if(_0x3141fd['length']===0x1){return _0x54b9f3['id'];}else{var _0x48edf8=_['every'](_[_0x0901('0x38')](_0x3141fd,_0x0901('0x7e')),function(_0x3d1e76){return _['includes'](_0x4a1b59,_0x3d1e76);});if(_0x48edf8){return _0x54b9f3['id'];}}}));}}return BPromise['all'](_0x29c653)[_0x0901('0x2a')](function(_0x53f296){_0x5ec599=_(_0x5ec599)[_0x0901('0x7f')](_0x53f296)[_0x0901('0x80')]()['value']();return db[_0x0901('0x34')]['find']({'where':{'id':_0x1e3056[_0x0901('0x56')]['id']}})[_0x0901('0x2a')](function(_0x278483){return db[_0x0901('0x7a')][_0x0901('0x6c')](function(_0x206c5){return _0x278483[_0x0901('0x71')](_0x1e3056[_0x0901('0x39')]['ids'],{'transaction':_0x206c5})[_0x0901('0x2a')](function(){if(!_[_0x0901('0x81')](_0x5ec599)){return _0x278483['removeAgents'](_0x5ec599,{'transaction':_0x206c5});}})[_0x0901('0x2a')](function(){_0x5ec599[_0x0901('0x82')](function(_0x4bda88){socket[_0x0901('0x70')]('userMailQueue:remove',{'UserId':_0x4bda88,'MailQueueId':_0x278483['id']});});});});});});})[_0x0901('0x2a')](respondWithStatusCode(_0x22c97d,null))[_0x0901('0x4a')](handleError(_0x22c97d,null));};exports['addAgents']=function(_0x3c4b4f,_0x55facb,_0x132aa4){return db[_0x0901('0x34')][_0x0901('0x4f')]({'where':{'id':_0x3c4b4f['params']['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x55facb,null))[_0x0901('0x2a')](function(_0x1ec78b){if(_0x1ec78b){return _0x1ec78b[_0x0901('0x83')](_0x3c4b4f[_0x0901('0x51')][_0x0901('0x65')],_[_0x0901('0x84')](_0x3c4b4f[_0x0901('0x51')],[_0x0901('0x65'),'id'])||{})[_0x0901('0x85')](function(_0x49a1b3){for(var _0x583339=0x0;_0x583339<_0x3c4b4f['body'][_0x0901('0x65')][_0x0901('0x4e')];_0x583339+=0x1){socket[_0x0901('0x70')](_0x0901('0x86'),{'UserId':Number(_0x3c4b4f[_0x0901('0x51')][_0x0901('0x65')][_0x583339]),'MailQueueId':Number(_0x3c4b4f['params']['id'])});}return _0x49a1b3;});}})['then'](respondWithResult(_0x55facb,null))[_0x0901('0x4a')](handleError(_0x55facb,null));};exports[_0x0901('0x87')]=function(_0x1c4913,_0x3efd27,_0x51348a){return db['MailQueue'][_0x0901('0x4f')]({'where':{'id':_0x1c4913[_0x0901('0x56')]['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x3efd27,null))[_0x0901('0x2a')](function(_0x4bfd7d){if(_0x4bfd7d){return _0x4bfd7d[_0x0901('0x87')](_0x1c4913[_0x0901('0x39')]['ids'])['then'](function(){if(_[_0x0901('0x88')](_0x1c4913[_0x0901('0x39')][_0x0901('0x65')])){for(var _0x5b1204=0x0;_0x5b1204<_0x1c4913['query'][_0x0901('0x65')][_0x0901('0x4e')];_0x5b1204+=0x1){socket[_0x0901('0x70')]('userMailQueue:remove',{'UserId':Number(_0x1c4913[_0x0901('0x39')][_0x0901('0x65')][_0x5b1204]),'MailQueueId':Number(_0x1c4913[_0x0901('0x56')]['id'])});}}else{socket[_0x0901('0x70')](_0x0901('0x89'),{'UserId':Number(_0x1c4913[_0x0901('0x39')]['ids']),'MailQueueId':Number(_0x1c4913[_0x0901('0x56')]['id'])});}});}})[_0x0901('0x2a')](respondWithStatusCode(_0x3efd27,null))['catch'](handleError(_0x3efd27,null));};exports[_0x0901('0x8a')]=function(_0x3c52c2,_0x4a804d,_0x2e03ff){var _0x206c0d={};var _0x505239={};var _0x53e159;var _0x149dcc;return db[_0x0901('0x34')][_0x0901('0x59')]({'where':{'id':_0x3c52c2['params']['id']}})[_0x0901('0x2a')](handleEntityNotFound(_0x4a804d,null))[_0x0901('0x2a')](function(_0xb3c8a){if(_0xb3c8a){_0x53e159=_0xb3c8a;_0x505239[_0x0901('0x37')]=_[_0x0901('0x4c')](db[_0x0901('0x5c')][_0x0901('0x5b')]);_0x505239['query']=_[_0x0901('0x4c')](_0x3c52c2[_0x0901('0x39')]);_0x505239['filters']=_[_0x0901('0x3b')](_0x505239['model'],_0x505239[_0x0901('0x39')]);_0x206c0d[_0x0901('0x3c')]=_[_0x0901('0x3b')](_0x505239[_0x0901('0x37')],qs[_0x0901('0x4d')](_0x3c52c2[_0x0901('0x39')][_0x0901('0x4d')]));_0x206c0d[_0x0901('0x3c')]=_0x206c0d[_0x0901('0x3c')][_0x0901('0x4e')]?_0x206c0d[_0x0901('0x3c')]:_0x505239['model'];_0x206c0d[_0x0901('0x3f')]=qs[_0x0901('0x40')](_0x3c52c2[_0x0901('0x39')][_0x0901('0x40')]);_0x206c0d[_0x0901('0x41')]=qs[_0x0901('0x3a')](_[_0x0901('0x42')](_0x3c52c2[_0x0901('0x39')],_0x505239['filters']));if(_0x3c52c2[_0x0901('0x39')][_0x0901('0x43')]){_0x206c0d[_0x0901('0x41')]=_['merge'](_0x206c0d[_0x0901('0x41')],{'$or':_[_0x0901('0x38')](_0x206c0d[_0x0901('0x3c')],function(_0x6912dc){var _0x203d0e={};_0x203d0e[_0x6912dc]={'$like':'%'+_0x3c52c2[_0x0901('0x39')][_0x0901('0x43')]+'%'};return _0x203d0e;})});}_0x206c0d=_[_0x0901('0x45')]({},_0x206c0d,_0x3c52c2['options']);return _0x53e159['getAgents'](_0x206c0d);}})[_0x0901('0x2a')](function(_0x35c0cd){if(_0x35c0cd){_0x149dcc=_0x35c0cd[_0x0901('0x4e')];if(!_0x3c52c2[_0x0901('0x39')]['hasOwnProperty'](_0x0901('0x3e'))){_0x206c0d[_0x0901('0x23')]=qs['limit'](_0x3c52c2[_0x0901('0x39')]['limit']);_0x206c0d[_0x0901('0x22')]=qs[_0x0901('0x22')](_0x3c52c2[_0x0901('0x39')][_0x0901('0x22')]);}return _0x53e159[_0x0901('0x8a')](_0x206c0d);}})[_0x0901('0x2a')](function(_0x41ecd5){if(_0x41ecd5){return _0x41ecd5?{'count':_0x149dcc,'rows':_0x41ecd5}:null;}})[_0x0901('0x2a')](respondWithResult(_0x4a804d,null))[_0x0901('0x4a')](handleError(_0x4a804d,null));}; \ No newline at end of file +var _0x3eee=['addTeams','body','ids','Agents','online','interface','flatMap','sequelize','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','join','user_has_teams','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeAgents','addAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','MailQueues','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','rawAttributes','length','options','create','user','role','catch','params','find','getMembers','findOne','UserMailQueue','order','pick','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','getTeams','Team'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x3eee,0x124));var _0xe3ee=function(_0x1f7b04,_0x5a8606){_0x1f7b04=_0x1f7b04-0x0;var _0x474396=_0x3eee[_0x1f7b04];return _0x474396;};'use strict';var emlformat=require(_0xe3ee('0x0'));var rimraf=require(_0xe3ee('0x1'));var zipdir=require(_0xe3ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3ee('0x3'));var BPromise=require(_0xe3ee('0x4'));var Mustache=require('mustache');var util=require(_0xe3ee('0x5'));var path=require(_0xe3ee('0x6'));var sox=require(_0xe3ee('0x7'));var csv=require(_0xe3ee('0x8'));var ejs=require(_0xe3ee('0x9'));var fs=require('fs');var fs_extra=require(_0xe3ee('0xa'));var _=require(_0xe3ee('0xb'));var squel=require(_0xe3ee('0xc'));var crypto=require(_0xe3ee('0xd'));var jsforce=require(_0xe3ee('0xe'));var deskjs=require(_0xe3ee('0xf'));var toCsv=require(_0xe3ee('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe3ee('0x10'));var qs=require(_0xe3ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe3ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe3ee('0x13'));var db=require('../../mysqldb')['db'];config[_0xe3ee('0x14')]=_['defaults'](config[_0xe3ee('0x14')],{'host':_0xe3ee('0x15'),'port':0x18eb});var socket=require(_0xe3ee('0x16'))(new Redis(config[_0xe3ee('0x14')]));require('./mailQueue.socket')[_0xe3ee('0x17')](socket);function respondWithStatusCode(_0x434921,_0x3f22cf){_0x3f22cf=_0x3f22cf||0xcc;return function(_0xd56a56){if(_0xd56a56){return _0x434921['sendStatus'](_0x3f22cf);}return _0x434921[_0xe3ee('0x18')](_0x3f22cf)[_0xe3ee('0x19')]();};}function respondWithResult(_0x4dde43,_0x34c4bb){_0x34c4bb=_0x34c4bb||0xc8;return function(_0x4b2f49){if(_0x4b2f49){return _0x4dde43[_0xe3ee('0x18')](_0x34c4bb)['json'](_0x4b2f49);}};}function respondWithFilteredResult(_0x4d9c1a,_0x5b0fd9){return function(_0x1bfcff){if(_0x1bfcff){var _0x4b0791=typeof _0x5b0fd9[_0xe3ee('0x1a')]===_0xe3ee('0x1b')&&typeof _0x5b0fd9[_0xe3ee('0x1c')]==='undefined';var _0xc85f90=_0x1bfcff[_0xe3ee('0x1d')];var _0x2cab28=_0x4b0791?0x0:_0x5b0fd9[_0xe3ee('0x1a')];var _0x2f2fff=_0x4b0791?_0x1bfcff[_0xe3ee('0x1d')]:_0x5b0fd9[_0xe3ee('0x1a')]+_0x5b0fd9[_0xe3ee('0x1c')];var _0x54dbee;if(_0x2f2fff>=_0xc85f90){_0x2f2fff=_0xc85f90;_0x54dbee=0xc8;}else{_0x54dbee=0xce;}_0x4d9c1a['status'](_0x54dbee);return _0x4d9c1a[_0xe3ee('0x1e')](_0xe3ee('0x1f'),_0x2cab28+'-'+_0x2f2fff+'/'+_0xc85f90)[_0xe3ee('0x20')](_0x1bfcff);}return null;};}function patchUpdates(_0x1175f9){return function(_0x417361){try{jsonpatch[_0xe3ee('0x21')](_0x417361,_0x1175f9,!![]);}catch(_0x545963){return BPromise[_0xe3ee('0x22')](_0x545963);}return _0x417361[_0xe3ee('0x23')]();};}function saveUpdates(_0x1d9931,_0xd9bafd){return function(_0x203948){if(_0x203948){return _0x203948[_0xe3ee('0x24')](_0x1d9931)['then'](function(_0x29cea8){return _0x29cea8;});}return null;};}function removeEntity(_0xce6fdc,_0x344122){return function(_0x26b5b3){if(_0x26b5b3){return _0x26b5b3['destroy']()[_0xe3ee('0x25')](function(){var _0x35798a=_0x26b5b3[_0xe3ee('0x26')]({'plain':!![]});var _0x2ae493=_0xe3ee('0x27');return db[_0xe3ee('0x28')][_0xe3ee('0x29')]({'where':{'type':_0x2ae493,'resourceId':_0x35798a['id']}})['then'](function(){return _0x26b5b3;});})[_0xe3ee('0x25')](function(){_0xce6fdc[_0xe3ee('0x18')](0xcc)[_0xe3ee('0x19')]();});}};}function handleEntityNotFound(_0x112a94,_0x433559){return function(_0x3b27ff){if(!_0x3b27ff){_0x112a94[_0xe3ee('0x2a')](0x194);}return _0x3b27ff;};}function handleError(_0x36c2d3,_0x5bfed2){_0x5bfed2=_0x5bfed2||0x1f4;return function(_0x49538e){logger[_0xe3ee('0x2b')](_0x49538e[_0xe3ee('0x2c')]);if(_0x49538e[_0xe3ee('0x2d')]){delete _0x49538e[_0xe3ee('0x2d')];}_0x36c2d3[_0xe3ee('0x18')](_0x5bfed2)['send'](_0x49538e);};}exports[_0xe3ee('0x2e')]=function(_0x12adf5,_0x191210){var _0x52fde7={},_0x3d39f8={},_0x39092d={'count':0x0,'rows':[]};var _0x3d21a6=_[_0xe3ee('0x2f')](db[_0xe3ee('0x30')]['rawAttributes'],function(_0xb33362){return{'name':_0xb33362[_0xe3ee('0x31')],'type':_0xb33362['type'][_0xe3ee('0x32')]};});_0x3d39f8[_0xe3ee('0x33')]=_[_0xe3ee('0x2f')](_0x3d21a6,'name');_0x3d39f8[_0xe3ee('0x34')]=_[_0xe3ee('0x35')](_0x12adf5[_0xe3ee('0x34')]);_0x3d39f8[_0xe3ee('0x36')]=_[_0xe3ee('0x37')](_0x3d39f8[_0xe3ee('0x33')],_0x3d39f8['query']);_0x52fde7[_0xe3ee('0x38')]=_[_0xe3ee('0x37')](_0x3d39f8['model'],qs[_0xe3ee('0x39')](_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x39')]));_0x52fde7[_0xe3ee('0x38')]=_0x52fde7[_0xe3ee('0x38')]['length']?_0x52fde7[_0xe3ee('0x38')]:_0x3d39f8[_0xe3ee('0x33')];if(!_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x3a')](_0xe3ee('0x3b'))){_0x52fde7['limit']=qs[_0xe3ee('0x1c')](_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x1c')]);_0x52fde7[_0xe3ee('0x1a')]=qs[_0xe3ee('0x1a')](_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x1a')]);}_0x52fde7['order']=qs[_0xe3ee('0x3c')](_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x3c')]);_0x52fde7[_0xe3ee('0x3d')]=qs[_0xe3ee('0x36')](_['pick'](_0x12adf5['query'],_0x3d39f8['filters']),_0x3d21a6);if(_0x12adf5[_0xe3ee('0x34')][_0xe3ee('0x3e')]){_0x52fde7[_0xe3ee('0x3d')]=_[_0xe3ee('0x3f')](_0x52fde7[_0xe3ee('0x3d')],{'$or':_['map'](_0x3d21a6,function(_0x3c6938){if(_0x3c6938[_0xe3ee('0x40')]!==_0xe3ee('0x41')){var _0x3e58cc={};_0x3e58cc[_0x3c6938[_0xe3ee('0x2d')]]={'$like':'%'+_0x12adf5[_0xe3ee('0x34')]['filter']+'%'};return _0x3e58cc;}})});}_0x52fde7=_[_0xe3ee('0x3f')]({},_0x52fde7,_0x12adf5['options']);var _0x49e482={'where':_0x52fde7[_0xe3ee('0x3d')]};return db[_0xe3ee('0x30')][_0xe3ee('0x1d')](_0x49e482)[_0xe3ee('0x25')](function(_0x45e336){_0x39092d[_0xe3ee('0x1d')]=_0x45e336;if(_0x12adf5['query'][_0xe3ee('0x42')]){_0x52fde7[_0xe3ee('0x43')]=[{'all':!![]}];}return db[_0xe3ee('0x30')][_0xe3ee('0x44')](_0x52fde7);})[_0xe3ee('0x25')](function(_0x3fd9f5){_0x39092d['rows']=_0x3fd9f5;return _0x39092d;})[_0xe3ee('0x25')](respondWithFilteredResult(_0x191210,_0x52fde7))['catch'](handleError(_0x191210,null));};exports[_0xe3ee('0x45')]=function(_0x1b203c,_0x41a271){var _0xea7451={'raw':!![],'where':{'id':_0x1b203c['params']['id']}},_0x26a7b5={};_0x26a7b5[_0xe3ee('0x33')]=_[_0xe3ee('0x35')](db[_0xe3ee('0x30')][_0xe3ee('0x46')]);_0x26a7b5[_0xe3ee('0x34')]=_[_0xe3ee('0x35')](_0x1b203c[_0xe3ee('0x34')]);_0x26a7b5['filters']=_['intersection'](_0x26a7b5[_0xe3ee('0x33')],_0x26a7b5[_0xe3ee('0x34')]);_0xea7451[_0xe3ee('0x38')]=_[_0xe3ee('0x37')](_0x26a7b5[_0xe3ee('0x33')],qs[_0xe3ee('0x39')](_0x1b203c[_0xe3ee('0x34')][_0xe3ee('0x39')]));_0xea7451[_0xe3ee('0x38')]=_0xea7451['attributes'][_0xe3ee('0x47')]?_0xea7451[_0xe3ee('0x38')]:_0x26a7b5[_0xe3ee('0x33')];if(_0x1b203c[_0xe3ee('0x34')]['includeAll']){_0xea7451[_0xe3ee('0x43')]=[{'all':!![]}];}_0xea7451=_[_0xe3ee('0x3f')]({},_0xea7451,_0x1b203c[_0xe3ee('0x48')]);return db[_0xe3ee('0x30')]['find'](_0xea7451)['then'](handleEntityNotFound(_0x41a271,null))[_0xe3ee('0x25')](respondWithResult(_0x41a271,null))['catch'](handleError(_0x41a271,null));};exports[_0xe3ee('0x49')]=function(_0x14e836,_0x420743){return db[_0xe3ee('0x30')]['create'](_0x14e836['body'],{})[_0xe3ee('0x25')](function(_0x47a05f){var _0x3afd74=_0x14e836[_0xe3ee('0x4a')][_0xe3ee('0x26')]({'plain':!![]});if(!_0x3afd74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3afd74[_0xe3ee('0x4b')]===_0xe3ee('0x4a')){var _0xfdaf02=_0x47a05f[_0xe3ee('0x26')]({'plain':!![]});var _0x2cd4d9=_0xe3ee('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x2cd4d9,'userProfileId':_0x3afd74['userProfileId']},'raw':!![]})[_0xe3ee('0x25')](function(_0x113a8f){if(_0x113a8f&&_0x113a8f['autoAssociation']===0x0){return db[_0xe3ee('0x28')][_0xe3ee('0x49')]({'name':_0xfdaf02[_0xe3ee('0x2d')],'resourceId':_0xfdaf02['id'],'type':_0x113a8f['name'],'sectionId':_0x113a8f['id']},{})[_0xe3ee('0x25')](function(){return _0x47a05f;});}else{return _0x47a05f;}})[_0xe3ee('0x4c')](function(_0x5c3b11){logger[_0xe3ee('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c3b11);throw _0x5c3b11;});}return _0x47a05f;})['then'](respondWithResult(_0x420743,0xc9))[_0xe3ee('0x4c')](handleError(_0x420743,null));};exports['update']=function(_0x1031aa,_0x5a6553){if(_0x1031aa['body']['id']){delete _0x1031aa['body']['id'];}return db[_0xe3ee('0x30')]['find']({'where':{'id':_0x1031aa[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](handleEntityNotFound(_0x5a6553,null))[_0xe3ee('0x25')](saveUpdates(_0x1031aa['body'],null))[_0xe3ee('0x25')](respondWithResult(_0x5a6553,null))[_0xe3ee('0x4c')](handleError(_0x5a6553,null));};exports[_0xe3ee('0x29')]=function(_0x48f557,_0x3ab65a){return db['MailQueue'][_0xe3ee('0x4e')]({'where':{'id':_0x48f557[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](handleEntityNotFound(_0x3ab65a,null))[_0xe3ee('0x25')](removeEntity(_0x3ab65a,null))[_0xe3ee('0x4c')](handleError(_0x3ab65a,null));};exports['describe']=function(_0x3852ec,_0x16e563){return db[_0xe3ee('0x30')]['describe']()[_0xe3ee('0x25')](respondWithResult(_0x16e563,null))[_0xe3ee('0x4c')](handleError(_0x16e563,null));};exports[_0xe3ee('0x4f')]=function(_0x24cd3e,_0x36a8d8,_0x344fd2){var _0x2c79f4={'raw':!![],'where':{}},_0x37d637={},_0x2318ee;return db['MailQueue'][_0xe3ee('0x50')]({'where':{'id':_0x24cd3e[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](handleEntityNotFound(_0x36a8d8,null))['then'](function(_0x332c71){if(_0x332c71){_0x2318ee=_0x332c71[_0xe3ee('0x26')]({'plain':!![]});_0x37d637['model']=_[_0xe3ee('0x35')](db[_0xe3ee('0x51')][_0xe3ee('0x46')]);_0x37d637[_0xe3ee('0x34')]=_['keys'](_0x24cd3e[_0xe3ee('0x34')]);_0x37d637[_0xe3ee('0x36')]=_[_0xe3ee('0x37')](_0x37d637[_0xe3ee('0x33')],_0x37d637[_0xe3ee('0x34')]);_0x2c79f4['attributes']=_[_0xe3ee('0x37')](_0x37d637['model'],qs['fields'](_0x24cd3e[_0xe3ee('0x34')][_0xe3ee('0x39')]));_0x2c79f4[_0xe3ee('0x38')]=_0x2c79f4['attributes']['length']?_0x2c79f4[_0xe3ee('0x38')]:_0x37d637[_0xe3ee('0x33')];if(!_0x24cd3e['query'][_0xe3ee('0x3a')](_0xe3ee('0x3b'))){_0x2c79f4['limit']=qs[_0xe3ee('0x1c')](_0x24cd3e[_0xe3ee('0x34')]['limit']);_0x2c79f4[_0xe3ee('0x1a')]=qs[_0xe3ee('0x1a')](_0x24cd3e[_0xe3ee('0x34')]['offset']);}_0x2c79f4[_0xe3ee('0x52')]=qs[_0xe3ee('0x3c')](_0x24cd3e[_0xe3ee('0x34')][_0xe3ee('0x3c')]);_0x2c79f4[_0xe3ee('0x3d')]=qs[_0xe3ee('0x36')](_[_0xe3ee('0x53')](_0x24cd3e[_0xe3ee('0x34')],_0x37d637['filters']));_0x2c79f4[_0xe3ee('0x3d')][_0xe3ee('0x54')]=_0x332c71['id'];if(_0x24cd3e[_0xe3ee('0x34')]['filter']){_0x2c79f4['where']=_['merge'](_0x2c79f4['where'],{'$or':_['map'](_0x2c79f4['attributes'],function(_0x1b0f50){var _0xb70446={};_0xb70446[_0x1b0f50]={'$like':'%'+_0x24cd3e[_0xe3ee('0x34')][_0xe3ee('0x3e')]+'%'};return _0xb70446;})});}_0x2c79f4=_[_0xe3ee('0x3f')]({},_0x2c79f4,_0x24cd3e[_0xe3ee('0x48')]);return db[_0xe3ee('0x51')][_0xe3ee('0x44')](_0x2c79f4);}})['then'](function(_0x26ea95){if(_0x26ea95){return db[_0xe3ee('0x55')][_0xe3ee('0x56')]({'where':{'id':_[_0xe3ee('0x2f')](_0x26ea95,_0xe3ee('0x57')),'role':_0xe3ee('0x58')},'attributes':['id',_0xe3ee('0x2d'),_0xe3ee('0x59'),_0xe3ee('0x5a'),_0xe3ee('0x5b')]});}})[_0xe3ee('0x25')](function(_0x239af2){if(_0x239af2){return{'count':_0x239af2[_0xe3ee('0x1d')],'rows':_['map'](_0x239af2['rows'],function(_0x247786){return{'membername':_0x247786['name'],'UserId':_0x247786['id'],'queue_name':_0x2318ee[_0xe3ee('0x2d')],'MailQueueId':_0x2318ee['id'],'interface':util[_0xe3ee('0x5c')]('%s/%s','SIP',_0x247786[_0xe3ee('0x2d')]),'penalty':0x0,'paused':_0x247786[_0xe3ee('0x59')],'createdAt':_0x247786[_0xe3ee('0x5b')],'updatedAt':_0x247786[_0xe3ee('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe3ee('0x25')](respondWithFilteredResult(_0x36a8d8,_0x2c79f4))[_0xe3ee('0x4c')](handleError(_0x36a8d8,null));};exports[_0xe3ee('0x5d')]=function(_0x598a50,_0x3c94a,_0x259b43){var _0x49f1ef={};var _0x45728e={};var _0x4a5a7d;var _0x11024;return db[_0xe3ee('0x30')]['findOne']({'where':{'id':_0x598a50[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](handleEntityNotFound(_0x3c94a,null))['then'](function(_0x500786){if(_0x500786){_0x4a5a7d=_0x500786;_0x45728e[_0xe3ee('0x33')]=_[_0xe3ee('0x35')](db[_0xe3ee('0x5e')][_0xe3ee('0x46')]);_0x45728e[_0xe3ee('0x34')]=_[_0xe3ee('0x35')](_0x598a50[_0xe3ee('0x34')]);_0x45728e[_0xe3ee('0x36')]=_[_0xe3ee('0x37')](_0x45728e['model'],_0x45728e[_0xe3ee('0x34')]);_0x49f1ef[_0xe3ee('0x38')]=_[_0xe3ee('0x37')](_0x45728e[_0xe3ee('0x33')],qs[_0xe3ee('0x39')](_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x39')]));_0x49f1ef['attributes']=_0x49f1ef[_0xe3ee('0x38')][_0xe3ee('0x47')]?_0x49f1ef[_0xe3ee('0x38')]:_0x45728e[_0xe3ee('0x33')];_0x49f1ef[_0xe3ee('0x52')]=qs['sort'](_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x3c')]);_0x49f1ef[_0xe3ee('0x3d')]=qs[_0xe3ee('0x36')](_[_0xe3ee('0x53')](_0x598a50[_0xe3ee('0x34')],_0x45728e['filters']));if(_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x3e')]){_0x49f1ef[_0xe3ee('0x3d')]=_[_0xe3ee('0x3f')](_0x49f1ef[_0xe3ee('0x3d')],{'$or':_[_0xe3ee('0x2f')](_0x49f1ef['attributes'],function(_0x3dd35e){var _0x4d252c={};_0x4d252c[_0x3dd35e]={'$like':'%'+_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x3e')]+'%'};return _0x4d252c;})});}_0x49f1ef=_[_0xe3ee('0x3f')]({},_0x49f1ef,_0x598a50[_0xe3ee('0x48')]);return _0x4a5a7d[_0xe3ee('0x5d')](_0x49f1ef);}})[_0xe3ee('0x25')](function(_0x4b4b25){if(_0x4b4b25){_0x11024=_0x4b4b25[_0xe3ee('0x47')];if(!_0x598a50['query'][_0xe3ee('0x3a')](_0xe3ee('0x3b'))){_0x49f1ef[_0xe3ee('0x1c')]=qs['limit'](_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x1c')]);_0x49f1ef[_0xe3ee('0x1a')]=qs[_0xe3ee('0x1a')](_0x598a50[_0xe3ee('0x34')][_0xe3ee('0x1a')]);}return _0x4a5a7d[_0xe3ee('0x5d')](_0x49f1ef);}})[_0xe3ee('0x25')](function(_0x3ec1ff){if(_0x3ec1ff){return _0x3ec1ff?{'count':_0x11024,'rows':_0x3ec1ff}:null;}})[_0xe3ee('0x25')](respondWithResult(_0x3c94a,null))[_0xe3ee('0x4c')](handleError(_0x3c94a,null));};exports[_0xe3ee('0x5f')]=function(_0x5ab0c4,_0x18fdb2,_0x96122c){var _0x28ad07=_0x5ab0c4[_0xe3ee('0x60')][_0xe3ee('0x61')];return db[_0xe3ee('0x5e')][_0xe3ee('0x44')]({'where':{'id':_0x28ad07},'attributes':['id'],'include':[{'model':db[_0xe3ee('0x55')],'as':_0xe3ee('0x62'),'attributes':['id',_0xe3ee('0x2d'),_0xe3ee('0x63'),'voicePause',_0xe3ee('0x64')],'raw':!![]}]})[_0xe3ee('0x25')](function(_0x3c68cc){if(_0x3c68cc){var _0x3f015e=_[_0xe3ee('0x65')](_0x3c68cc,function(_0x6c1dd4){var _0x4fecc0=_0x6c1dd4[_0xe3ee('0x26')]({'plain':!![]});return _0x4fecc0[_0xe3ee('0x62')];});return db[_0xe3ee('0x30')][_0xe3ee('0x4e')]({'where':{'id':_0x5ab0c4[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](function(_0x3adf82){return db[_0xe3ee('0x66')]['transaction'](function(_0x35348e){return _0x3adf82['addTeams'](_0x28ad07,{'transaction':_0x35348e})[_0xe3ee('0x25')](function(){return BPromise['each'](_0x3f015e,function(_0x4ce1d0){return db[_0xe3ee('0x51')][_0xe3ee('0x67')]({'where':{'UserId':_0x4ce1d0['id'],'MailQueueId':_0x5ab0c4[_0xe3ee('0x4d')]['id']},'transaction':_0x35348e});});})[_0xe3ee('0x25')](function(){_0x3f015e[_0xe3ee('0x68')](function(_0x384bb0){socket[_0xe3ee('0x69')](_0xe3ee('0x6a'),{'UserId':_0x384bb0['id'],'MailQueueId':_0x3adf82['id']});});});});});}})['then'](respondWithStatusCode(_0x18fdb2,null))['catch'](handleError(_0x18fdb2,null));};exports['removeTeams']=function(_0x5c913e,_0xa9ef41,_0x5a1f63){return db[_0xe3ee('0x5e')][_0xe3ee('0x44')]({'where':{'id':_0x5c913e['query'][_0xe3ee('0x61')]},'attributes':['id'],'include':[{'model':db[_0xe3ee('0x55')],'as':_0xe3ee('0x62'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa9ef41,null))[_0xe3ee('0x25')](function(_0x7cdc61){var _0x48ec94=_[_0xe3ee('0x2f')](_0x7cdc61,'id');var _0x37aa6c=[];var _0x5e4836=[];var _0x4960e7=squel[_0xe3ee('0x6b')]();_0x4960e7[_0xe3ee('0x6c')](_0xe3ee('0x6d'))['from']('team_has_mail_queues','tq')[_0xe3ee('0x6e')](_0xe3ee('0x6f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe3ee('0x3d')](_0xe3ee('0x70'),_0x5c913e['params']['id']);for(var _0x2f2ad9=0x0;_0x2f2ad9<_0x7cdc61[_0xe3ee('0x47')];_0x2f2ad9+=0x1){let _0x4e4edc=_0x7cdc61[_0x2f2ad9];for(var _0x55ce3b=0x0;_0x55ce3b<_0x4e4edc['Agents']['length'];_0x55ce3b+=0x1){let _0x14ba98=_0x4e4edc[_0xe3ee('0x62')][_0x55ce3b];var _0x11b7f6=_0x4960e7['clone']();_0x11b7f6['where'](_0xe3ee('0x71'),_0x14ba98['id']);_0x5e4836['push'](db[_0xe3ee('0x66')][_0xe3ee('0x34')](_0x11b7f6[_0xe3ee('0x72')](),{'type':db[_0xe3ee('0x66')][_0xe3ee('0x73')][_0xe3ee('0x74')]})[_0xe3ee('0x25')](function(_0x11744d){if(_0x11744d[_0xe3ee('0x47')]===0x1){return _0x14ba98['id'];}else{var _0x4d8fc2=_[_0xe3ee('0x75')](_['map'](_0x11744d,'TeamId'),function(_0x4c28c7){return _[_0xe3ee('0x76')](_0x48ec94,_0x4c28c7);});if(_0x4d8fc2){return _0x14ba98['id'];}}}));}}return BPromise[_0xe3ee('0x77')](_0x5e4836)[_0xe3ee('0x25')](function(_0x45c8b4){_0x37aa6c=_(_0x37aa6c)[_0xe3ee('0x78')](_0x45c8b4)[_0xe3ee('0x79')]()[_0xe3ee('0x7a')]();return db['MailQueue'][_0xe3ee('0x4e')]({'where':{'id':_0x5c913e[_0xe3ee('0x4d')]['id']}})['then'](function(_0x157c3f){return db[_0xe3ee('0x66')][_0xe3ee('0x7b')](function(_0x1c9245){return _0x157c3f['removeTeams'](_0x5c913e[_0xe3ee('0x34')]['ids'],{'transaction':_0x1c9245})[_0xe3ee('0x25')](function(){if(!_['isEmpty'](_0x37aa6c)){return _0x157c3f[_0xe3ee('0x7c')](_0x37aa6c,{'transaction':_0x1c9245});}})[_0xe3ee('0x25')](function(){_0x37aa6c[_0xe3ee('0x68')](function(_0x130555){socket['emit']('userMailQueue:remove',{'UserId':_0x130555,'MailQueueId':_0x157c3f['id']});});});});});});})[_0xe3ee('0x25')](respondWithStatusCode(_0xa9ef41,null))[_0xe3ee('0x4c')](handleError(_0xa9ef41,null));};exports[_0xe3ee('0x7d')]=function(_0xc64a75,_0x3d824e,_0x35c48b){return db[_0xe3ee('0x30')][_0xe3ee('0x4e')]({'where':{'id':_0xc64a75[_0xe3ee('0x4d')]['id']}})[_0xe3ee('0x25')](handleEntityNotFound(_0x3d824e,null))['then'](function(_0x58c587){if(_0x58c587){return _0x58c587['addAgents'](_0xc64a75[_0xe3ee('0x60')][_0xe3ee('0x61')],_['omit'](_0xc64a75[_0xe3ee('0x60')],[_0xe3ee('0x61'),'id'])||{})['spread'](function(_0x402029){for(var _0x5d544c=0x0;_0x5d544c<_0xc64a75[_0xe3ee('0x60')][_0xe3ee('0x61')][_0xe3ee('0x47')];_0x5d544c+=0x1){socket['emit'](_0xe3ee('0x6a'),{'UserId':Number(_0xc64a75[_0xe3ee('0x60')][_0xe3ee('0x61')][_0x5d544c]),'MailQueueId':Number(_0xc64a75[_0xe3ee('0x4d')]['id'])});}return _0x402029;});}})[_0xe3ee('0x25')](respondWithResult(_0x3d824e,null))[_0xe3ee('0x4c')](handleError(_0x3d824e,null));};exports[_0xe3ee('0x7c')]=function(_0x4404c7,_0x222971,_0x3fddcf){return db[_0xe3ee('0x30')]['find']({'where':{'id':_0x4404c7['params']['id']}})['then'](handleEntityNotFound(_0x222971,null))[_0xe3ee('0x25')](function(_0x4aa223){if(_0x4aa223){return _0x4aa223[_0xe3ee('0x7c')](_0x4404c7['query'][_0xe3ee('0x61')])[_0xe3ee('0x25')](function(){if(_[_0xe3ee('0x7e')](_0x4404c7[_0xe3ee('0x34')][_0xe3ee('0x61')])){for(var _0x27c146=0x0;_0x27c146<_0x4404c7[_0xe3ee('0x34')][_0xe3ee('0x61')]['length'];_0x27c146+=0x1){socket[_0xe3ee('0x69')](_0xe3ee('0x7f'),{'UserId':Number(_0x4404c7['query']['ids'][_0x27c146]),'MailQueueId':Number(_0x4404c7[_0xe3ee('0x4d')]['id'])});}}else{socket['emit'](_0xe3ee('0x7f'),{'UserId':Number(_0x4404c7['query'][_0xe3ee('0x61')]),'MailQueueId':Number(_0x4404c7[_0xe3ee('0x4d')]['id'])});}});}})[_0xe3ee('0x25')](respondWithStatusCode(_0x222971,null))[_0xe3ee('0x4c')](handleError(_0x222971,null));};exports['getAgents']=function(_0x470799,_0x4939ff,_0x557223){var _0x202b1a={};var _0x1aeb90={};var _0x6b03d1;var _0x82da5b;return db[_0xe3ee('0x30')]['findOne']({'where':{'id':_0x470799[_0xe3ee('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4939ff,null))[_0xe3ee('0x25')](function(_0x5d0b76){if(_0x5d0b76){_0x6b03d1=_0x5d0b76;_0x1aeb90[_0xe3ee('0x33')]=_[_0xe3ee('0x35')](db[_0xe3ee('0x55')][_0xe3ee('0x46')]);_0x1aeb90[_0xe3ee('0x34')]=_['keys'](_0x470799[_0xe3ee('0x34')]);_0x1aeb90[_0xe3ee('0x36')]=_[_0xe3ee('0x37')](_0x1aeb90[_0xe3ee('0x33')],_0x1aeb90[_0xe3ee('0x34')]);_0x202b1a[_0xe3ee('0x38')]=_['intersection'](_0x1aeb90[_0xe3ee('0x33')],qs[_0xe3ee('0x39')](_0x470799[_0xe3ee('0x34')][_0xe3ee('0x39')]));_0x202b1a['attributes']=_0x202b1a['attributes'][_0xe3ee('0x47')]?_0x202b1a[_0xe3ee('0x38')]:_0x1aeb90[_0xe3ee('0x33')];_0x202b1a['order']=qs['sort'](_0x470799[_0xe3ee('0x34')][_0xe3ee('0x3c')]);_0x202b1a[_0xe3ee('0x3d')]=qs[_0xe3ee('0x36')](_[_0xe3ee('0x53')](_0x470799['query'],_0x1aeb90[_0xe3ee('0x36')]));if(_0x470799[_0xe3ee('0x34')][_0xe3ee('0x3e')]){_0x202b1a[_0xe3ee('0x3d')]=_[_0xe3ee('0x3f')](_0x202b1a[_0xe3ee('0x3d')],{'$or':_[_0xe3ee('0x2f')](_0x202b1a[_0xe3ee('0x38')],function(_0xffbb13){var _0x168b11={};_0x168b11[_0xffbb13]={'$like':'%'+_0x470799[_0xe3ee('0x34')][_0xe3ee('0x3e')]+'%'};return _0x168b11;})});}_0x202b1a=_[_0xe3ee('0x3f')]({},_0x202b1a,_0x470799[_0xe3ee('0x48')]);return _0x6b03d1[_0xe3ee('0x80')](_0x202b1a);}})[_0xe3ee('0x25')](function(_0x346325){if(_0x346325){_0x82da5b=_0x346325[_0xe3ee('0x47')];if(!_0x470799[_0xe3ee('0x34')][_0xe3ee('0x3a')](_0xe3ee('0x3b'))){_0x202b1a[_0xe3ee('0x1c')]=qs[_0xe3ee('0x1c')](_0x470799[_0xe3ee('0x34')]['limit']);_0x202b1a['offset']=qs['offset'](_0x470799['query'][_0xe3ee('0x1a')]);}return _0x6b03d1['getAgents'](_0x202b1a);}})[_0xe3ee('0x25')](function(_0x325937){if(_0x325937){return _0x325937?{'count':_0x82da5b,'rows':_0x325937}:null;}})[_0xe3ee('0x25')](respondWithResult(_0x4939ff,null))['catch'](handleError(_0x4939ff,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index bb87960..6f2421a 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 _0x6d10=['exports','events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xd1d325,_0x2dc039){var _0x296504=function(_0x3eeda4){while(--_0x3eeda4){_0xd1d325['push'](_0xd1d325['shift']());}};_0x296504(++_0x2dc039);}(_0x6d10,0x121));var _0x06d1=function(_0x1b861b,_0x3d92a9){_0x1b861b=_0x1b861b-0x0;var _0x528b48=_0x6d10[_0x1b861b];return _0x528b48;};'use strict';var EventEmitter=require(_0x06d1('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06d1('0x1'),'afterUpdate':_0x06d1('0x2'),'afterDestroy':_0x06d1('0x3')};function emitEvent(_0x3136a3){return function(_0x3193ce,_0x5137c7,_0x4403bf){MailQueueEvents[_0x06d1('0x4')](_0x3136a3+':'+_0x3193ce['id'],_0x3193ce);MailQueueEvents[_0x06d1('0x4')](_0x3136a3,_0x3193ce);_0x4403bf(null);};}for(var e in events){if(events[_0x06d1('0x5')](e)){var event=events[e];MailQueue[_0x06d1('0x6')](e,emitEvent(event));}}module[_0x06d1('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x2c5d=['emit','exports','events','../../mysqldb','save','remove'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0x2c5d,0xd4));var _0xd2c5=function(_0x5509b5,_0x4dd802){_0x5509b5=_0x5509b5-0x0;var _0x27c70c=_0x2c5d[_0x5509b5];return _0x27c70c;};'use strict';var EventEmitter=require(_0xd2c5('0x0'));var MailQueue=require(_0xd2c5('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd2c5('0x2'),'afterUpdate':'update','afterDestroy':_0xd2c5('0x3')};function emitEvent(_0x1a977d){return function(_0x36b4f9,_0x4ee2cc,_0xd1a121){MailQueueEvents[_0xd2c5('0x4')](_0x1a977d+':'+_0x36b4f9['id'],_0x36b4f9);MailQueueEvents['emit'](_0x1a977d,_0x36b4f9);_0xd1a121(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd2c5('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5ea37cf..51e28a9 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 _0x9263=['api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','../../config/logger'];(function(_0xa975bf,_0x346419){var _0x164f3f=function(_0x57b8ee){while(--_0x57b8ee){_0xa975bf['push'](_0xa975bf['shift']());}};_0x164f3f(++_0x346419);}(_0x9263,0x6d));var _0x3926=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x9263[_0x42f009];return _0x22a1e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3926('0x0'))(_0x3926('0x1'));var moment=require(_0x3926('0x2'));var BPromise=require('bluebird');var rp=require(_0x3926('0x3'));var fs=require('fs');var path=require(_0x3926('0x4'));var rimraf=require(_0x3926('0x5'));var config=require(_0x3926('0x6'));var attributes=require(_0x3926('0x7'));module[_0x3926('0x8')]=function(_0x4b183c,_0xccbdbb){return _0x4b183c['define'](_0x3926('0x9'),attributes,{'tableName':_0x3926('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad9d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','lodash'];(function(_0x31d981,_0x1c6dd0){var _0x400e99=function(_0x319ecd){while(--_0x319ecd){_0x31d981['push'](_0x31d981['shift']());}};_0x400e99(++_0x1c6dd0);}(_0xad9d,0x11d));var _0xdad9=function(_0x291c8c,_0x5c2e4f){_0x291c8c=_0x291c8c-0x0;var _0xbf0a55=_0xad9d[_0x291c8c];return _0xbf0a55;};'use strict';var _=require(_0xdad9('0x0'));var util=require(_0xdad9('0x1'));var logger=require(_0xdad9('0x2'))(_0xdad9('0x3'));var moment=require(_0xdad9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdad9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdad9('0x6'));var config=require(_0xdad9('0x7'));var attributes=require(_0xdad9('0x8'));module['exports']=function(_0x1ac1e3,_0x45c134){return _0x1ac1e3[_0xdad9('0x9')](_0xdad9('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 8e86bde..2727fa0 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 _0x0f1a=['code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowMailQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x0f1a,0x1cd));var _0xa0f1=function(_0x1ce23d,_0x25a351){_0x1ce23d=_0x1ce23d-0x0;var _0x4338d9=_0x0f1a[_0x1ce23d];return _0x4338d9;};'use strict';var _=require(_0xa0f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa0f1('0x1'));var rs=require(_0xa0f1('0x2'));var fs=require('fs');var Redis=require(_0xa0f1('0x3'));var db=require(_0xa0f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0f1('0x5'))('rpc');var config=require(_0xa0f1('0x6'));var jayson=require(_0xa0f1('0x7'));var client=jayson['client'][_0xa0f1('0x8')]({'port':0x232a});config[_0xa0f1('0x9')]=_['defaults'](config[_0xa0f1('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0f1('0x9')]));require(_0xa0f1('0xa'))[_0xa0f1('0xb')](socket);function respondWithRpcPromise(_0x1a626d,_0x368734,_0x3c4b9b){return new BPromise(function(_0x3574bb,_0x1f352c){return client['request'](_0x1a626d,_0x3c4b9b)[_0xa0f1('0xc')](function(_0x59ca57){logger[_0xa0f1('0xd')](_0xa0f1('0xe'),_0x368734,_0xa0f1('0xf'));logger[_0xa0f1('0x10')](_0xa0f1('0x11'),_0x368734,'request\x20sent',JSON[_0xa0f1('0x12')](_0x59ca57));if(_0x59ca57[_0xa0f1('0x13')]){if(_0x59ca57[_0xa0f1('0x13')][_0xa0f1('0x14')]===0x1f4){logger[_0xa0f1('0x13')](_0xa0f1('0xe'),_0x368734,_0x59ca57[_0xa0f1('0x13')][_0xa0f1('0x15')]);return _0x1f352c(_0x59ca57[_0xa0f1('0x13')]['message']);}logger[_0xa0f1('0x13')](_0xa0f1('0xe'),_0x368734,_0x59ca57[_0xa0f1('0x13')][_0xa0f1('0x15')]);return _0x3574bb(_0x59ca57[_0xa0f1('0x13')][_0xa0f1('0x15')]);}else{logger[_0xa0f1('0xd')]('MailQueue,\x20%s,\x20%s',_0x368734,_0xa0f1('0xf'));_0x3574bb(_0x59ca57[_0xa0f1('0x16')][_0xa0f1('0x15')]);}})['catch'](function(_0x231469){logger['error'](_0xa0f1('0xe'),_0x368734,_0x231469);_0x1f352c(_0x231469);});});}exports[_0xa0f1('0x17')]=function(_0x2250a9){var _0x4d838a=this;return new Promise(function(_0x435ed9,_0xf96b95){return db[_0xa0f1('0x18')][_0xa0f1('0x19')]({'raw':_0x2250a9[_0xa0f1('0x1a')]?_0x2250a9[_0xa0f1('0x1a')][_0xa0f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2250a9['options']?_0x2250a9[_0xa0f1('0x1a')][_0xa0f1('0x1c')]||null:null,'attributes':_0x2250a9[_0xa0f1('0x1a')]?_0x2250a9[_0xa0f1('0x1a')]['attributes']||null:null,'limit':_0x2250a9['options']?_0x2250a9[_0xa0f1('0x1a')][_0xa0f1('0x1d')]||null:null,'include':_0x2250a9['options']?_0x2250a9[_0xa0f1('0x1a')][_0xa0f1('0x1e')]?_[_0xa0f1('0x1f')](_0x2250a9[_0xa0f1('0x1a')][_0xa0f1('0x1e')],function(_0x152213){return{'model':db[_0x152213[_0xa0f1('0x20')]],'as':_0x152213['as'],'attributes':_0x152213[_0xa0f1('0x21')],'include':_0x152213[_0xa0f1('0x1e')]?_[_0xa0f1('0x1f')](_0x152213[_0xa0f1('0x1e')],function(_0x53e564){return{'model':db[_0x53e564[_0xa0f1('0x20')]],'as':_0x53e564['as'],'attributes':_0x53e564['attributes'],'include':_0x53e564[_0xa0f1('0x1e')]?_[_0xa0f1('0x1f')](_0x53e564[_0xa0f1('0x1e')],function(_0x4cff66){return{'model':db[_0x4cff66[_0xa0f1('0x20')]],'as':_0x4cff66['as'],'attributes':_0x4cff66[_0xa0f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa0f1('0xc')](function(_0x2b0f52){logger[_0xa0f1('0xd')](_0xa0f1('0x17'),_0x2250a9);logger[_0xa0f1('0x10')](_0xa0f1('0x17'),_0x2250a9,JSON['stringify'](_0x2b0f52));_0x435ed9(_0x2b0f52);})[_0xa0f1('0x22')](function(_0x5b2450){logger['error']('GetMailQueue',_0x5b2450[_0xa0f1('0x15')],_0x2250a9);_0xf96b95(_0x4d838a[_0xa0f1('0x13')](0x1f4,_0x5b2450[_0xa0f1('0x15')]));});});};exports[_0xa0f1('0x23')]=function(_0x442cb0){var _0x62fb89=this;return new Promise(function(_0x254c1e,_0x1a4706){return db[_0xa0f1('0x18')][_0xa0f1('0x24')]({'raw':_0x442cb0[_0xa0f1('0x1a')]?_0x442cb0[_0xa0f1('0x1a')][_0xa0f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x442cb0['options']?_0x442cb0[_0xa0f1('0x1a')][_0xa0f1('0x1c')]||null:null,'attributes':_0x442cb0[_0xa0f1('0x1a')]?_0x442cb0[_0xa0f1('0x1a')][_0xa0f1('0x21')]||null:null,'include':_0x442cb0['options']?_0x442cb0[_0xa0f1('0x1a')][_0xa0f1('0x1e')]?_[_0xa0f1('0x1f')](_0x442cb0[_0xa0f1('0x1a')][_0xa0f1('0x1e')],function(_0x505eb9){return{'model':db[_0x505eb9[_0xa0f1('0x20')]],'as':_0x505eb9['as'],'attributes':_0x505eb9[_0xa0f1('0x21')],'include':_0x505eb9[_0xa0f1('0x1e')]?_[_0xa0f1('0x1f')](_0x505eb9[_0xa0f1('0x1e')],function(_0xa2a645){return{'model':db[_0xa2a645[_0xa0f1('0x20')]],'as':_0xa2a645['as'],'attributes':_0xa2a645[_0xa0f1('0x21')],'include':_0xa2a645[_0xa0f1('0x1e')]?_['map'](_0xa2a645[_0xa0f1('0x1e')],function(_0x190102){return{'model':db[_0x190102['model']],'as':_0x190102['as'],'attributes':_0x190102[_0xa0f1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa0f1('0xc')](function(_0x1e9718){logger['info'](_0xa0f1('0x23'),_0x442cb0);logger[_0xa0f1('0x10')](_0xa0f1('0x23'),_0x442cb0,JSON['stringify'](_0x1e9718));_0x254c1e(_0x1e9718);})[_0xa0f1('0x22')](function(_0x585eab){logger[_0xa0f1('0x13')](_0xa0f1('0x23'),_0x585eab[_0xa0f1('0x15')],_0x442cb0);_0x1a4706(_0x62fb89['error'](0x1f4,_0x585eab[_0xa0f1('0x15')]));});});}; \ No newline at end of file +var _0xe1fe=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','raw','options','attributes','limit','include','map','model','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s'];(function(_0x3dde0f,_0x592bed){var _0x33ae8e=function(_0x5a3a2d){while(--_0x5a3a2d){_0x3dde0f['push'](_0x3dde0f['shift']());}};_0x33ae8e(++_0x592bed);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x1713c5,_0x98c59){_0x1713c5=_0x1713c5-0x0;var _0x2da77f=_0xe1fe[_0x1713c5];return _0x2da77f;};'use strict';var _=require(_0xee1f('0x0'));var util=require(_0xee1f('0x1'));var moment=require(_0xee1f('0x2'));var BPromise=require(_0xee1f('0x3'));var rs=require(_0xee1f('0x4'));var fs=require('fs');var Redis=require(_0xee1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee1f('0x6'))(_0xee1f('0x7'));var config=require(_0xee1f('0x8'));var jayson=require(_0xee1f('0x9'));var client=jayson[_0xee1f('0xa')][_0xee1f('0xb')]({'port':0x232a});config[_0xee1f('0xc')]=_[_0xee1f('0xd')](config[_0xee1f('0xc')],{'host':_0xee1f('0xe'),'port':0x18eb});var socket=require(_0xee1f('0xf'))(new Redis(config[_0xee1f('0xc')]));require(_0xee1f('0x10'))[_0xee1f('0x11')](socket);function respondWithRpcPromise(_0x5f2abe,_0x4e4919,_0x5eb5d9){return new BPromise(function(_0x4e227f,_0x1066ec){return client[_0xee1f('0x12')](_0x5f2abe,_0x5eb5d9)[_0xee1f('0x13')](function(_0x21d103){logger[_0xee1f('0x14')](_0xee1f('0x15'),_0x4e4919,_0xee1f('0x16'));logger[_0xee1f('0x17')](_0xee1f('0x18'),_0x4e4919,_0xee1f('0x16'),JSON[_0xee1f('0x19')](_0x21d103));if(_0x21d103[_0xee1f('0x1a')]){if(_0x21d103[_0xee1f('0x1a')][_0xee1f('0x1b')]===0x1f4){logger[_0xee1f('0x1a')]('MailQueue,\x20%s,\x20%s',_0x4e4919,_0x21d103['error'][_0xee1f('0x1c')]);return _0x1066ec(_0x21d103[_0xee1f('0x1a')][_0xee1f('0x1c')]);}logger[_0xee1f('0x1a')](_0xee1f('0x15'),_0x4e4919,_0x21d103[_0xee1f('0x1a')][_0xee1f('0x1c')]);return _0x4e227f(_0x21d103[_0xee1f('0x1a')][_0xee1f('0x1c')]);}else{logger[_0xee1f('0x14')]('MailQueue,\x20%s,\x20%s',_0x4e4919,_0xee1f('0x16'));_0x4e227f(_0x21d103['result']['message']);}})[_0xee1f('0x1d')](function(_0x247ad6){logger[_0xee1f('0x1a')](_0xee1f('0x15'),_0x4e4919,_0x247ad6);_0x1066ec(_0x247ad6);});});}exports[_0xee1f('0x1e')]=function(_0x4518ad){var _0x5055fa=this;return new Promise(function(_0x251bcf,_0x3ebe79){return db[_0xee1f('0x1f')][_0xee1f('0x20')]({'raw':_0x4518ad['options']?_0x4518ad['options'][_0xee1f('0x21')]===undefined?!![]:![]:!![],'where':_0x4518ad[_0xee1f('0x22')]?_0x4518ad[_0xee1f('0x22')]['where']||null:null,'attributes':_0x4518ad['options']?_0x4518ad[_0xee1f('0x22')][_0xee1f('0x23')]||null:null,'limit':_0x4518ad[_0xee1f('0x22')]?_0x4518ad[_0xee1f('0x22')][_0xee1f('0x24')]||null:null,'include':_0x4518ad[_0xee1f('0x22')]?_0x4518ad['options'][_0xee1f('0x25')]?_['map'](_0x4518ad['options'][_0xee1f('0x25')],function(_0x2b4f19){return{'model':db[_0x2b4f19['model']],'as':_0x2b4f19['as'],'attributes':_0x2b4f19[_0xee1f('0x23')],'include':_0x2b4f19[_0xee1f('0x25')]?_[_0xee1f('0x26')](_0x2b4f19['include'],function(_0x1b370c){return{'model':db[_0x1b370c[_0xee1f('0x27')]],'as':_0x1b370c['as'],'attributes':_0x1b370c['attributes'],'include':_0x1b370c[_0xee1f('0x25')]?_[_0xee1f('0x26')](_0x1b370c[_0xee1f('0x25')],function(_0x5be320){return{'model':db[_0x5be320[_0xee1f('0x27')]],'as':_0x5be320['as'],'attributes':_0x5be320['attributes']};}):[]};}):[]};}):[]:[]})[_0xee1f('0x13')](function(_0x4e3c47){logger[_0xee1f('0x14')](_0xee1f('0x1e'),_0x4518ad);logger[_0xee1f('0x17')](_0xee1f('0x1e'),_0x4518ad,JSON[_0xee1f('0x19')](_0x4e3c47));_0x251bcf(_0x4e3c47);})[_0xee1f('0x1d')](function(_0xdec86f){logger['error'](_0xee1f('0x1e'),_0xdec86f['message'],_0x4518ad);_0x3ebe79(_0x5055fa[_0xee1f('0x1a')](0x1f4,_0xdec86f[_0xee1f('0x1c')]));});});};exports[_0xee1f('0x28')]=function(_0x205ba4){var _0x554961=this;return new Promise(function(_0x4d2746,_0x4dd0cd){return db[_0xee1f('0x1f')][_0xee1f('0x29')]({'raw':_0x205ba4[_0xee1f('0x22')]?_0x205ba4['options'][_0xee1f('0x21')]===undefined?!![]:![]:!![],'where':_0x205ba4['options']?_0x205ba4['options'][_0xee1f('0x2a')]||null:null,'attributes':_0x205ba4[_0xee1f('0x22')]?_0x205ba4['options'][_0xee1f('0x23')]||null:null,'include':_0x205ba4[_0xee1f('0x22')]?_0x205ba4[_0xee1f('0x22')][_0xee1f('0x25')]?_[_0xee1f('0x26')](_0x205ba4['options'][_0xee1f('0x25')],function(_0x3d9209){return{'model':db[_0x3d9209[_0xee1f('0x27')]],'as':_0x3d9209['as'],'attributes':_0x3d9209[_0xee1f('0x23')],'include':_0x3d9209[_0xee1f('0x25')]?_['map'](_0x3d9209[_0xee1f('0x25')],function(_0x3bf38a){return{'model':db[_0x3bf38a['model']],'as':_0x3bf38a['as'],'attributes':_0x3bf38a['attributes'],'include':_0x3bf38a[_0xee1f('0x25')]?_[_0xee1f('0x26')](_0x3bf38a[_0xee1f('0x25')],function(_0x2ebaeb){return{'model':db[_0x2ebaeb[_0xee1f('0x27')]],'as':_0x2ebaeb['as'],'attributes':_0x2ebaeb['attributes']};}):[]};}):[]};}):[]:[]})[_0xee1f('0x13')](function(_0x11a517){logger['info'](_0xee1f('0x28'),_0x205ba4);logger[_0xee1f('0x17')](_0xee1f('0x28'),_0x205ba4,JSON[_0xee1f('0x19')](_0x11a517));_0x4d2746(_0x11a517);})[_0xee1f('0x1d')](function(_0x1f57fc){logger[_0xee1f('0x1a')](_0xee1f('0x28'),_0x1f57fc[_0xee1f('0x1c')],_0x205ba4);_0x4dd0cd(_0x554961['error'](0x1f4,_0x1f57fc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c55c8e5..8202445 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 _0x98d8=['mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x566f0a,_0x6fd898){var _0x2f2de9=function(_0x20fd8f){while(--_0x20fd8f){_0x566f0a['push'](_0x566f0a['shift']());}};_0x2f2de9(++_0x6fd898);}(_0x98d8,0xce));var _0x898d=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x98d8[_0x4f8d61];return _0x3bc078;};'use strict';var MailQueueEvents=require(_0x898d('0x0'));var events=[_0x898d('0x1'),_0x898d('0x2'),_0x898d('0x3')];function createListener(_0x2fa03d,_0x15dafc){return function(_0x114ad8){_0x15dafc['emit'](_0x2fa03d,_0x114ad8);};}function removeListener(_0x4c1cf8,_0x1058e7){return function(){MailQueueEvents['removeListener'](_0x4c1cf8,_0x1058e7);};}exports['register']=function(_0x4047bd){for(var _0x5215bf=0x0,_0x16b99a=events['length'];_0x5215bf<_0x16b99a;_0x5215bf++){var _0x1de5df=events[_0x5215bf];var _0x4fe1bf=createListener(_0x898d('0x4')+_0x1de5df,_0x4047bd);MailQueueEvents['on'](_0x1de5df,_0x4fe1bf);}}; \ No newline at end of file +var _0x3ec8=['remove','emit','removeListener','register','length','./mailQueue.events','save'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x3ec8,0x1c5));var _0x83ec=function(_0x42a8ad,_0xdc38f9){_0x42a8ad=_0x42a8ad-0x0;var _0xcb63f5=_0x3ec8[_0x42a8ad];return _0xcb63f5;};'use strict';var MailQueueEvents=require(_0x83ec('0x0'));var events=[_0x83ec('0x1'),_0x83ec('0x2'),'update'];function createListener(_0x31f417,_0x269041){return function(_0x3bb7c2){_0x269041[_0x83ec('0x3')](_0x31f417,_0x3bb7c2);};}function removeListener(_0x411e8,_0x2425db){return function(){MailQueueEvents[_0x83ec('0x4')](_0x411e8,_0x2425db);};}exports[_0x83ec('0x5')]=function(_0x49103c){for(var _0x19b9fe=0x0,_0x18c3ed=events[_0x83ec('0x6')];_0x19b9fe<_0x18c3ed;_0x19b9fe++){var _0x1cba96=events[_0x19b9fe];var _0x1db6f1=createListener('mailQueue:'+_0x1cba96,_0x49103c);MailQueueEvents['on'](_0x1cba96,_0x1db6f1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cc9e05c..4a68828 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 _0xd9d8=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x21010b,_0x226680){var _0x5dacca=function(_0x2eef40){while(--_0x2eef40){_0x21010b['push'](_0x21010b['shift']());}};_0x5dacca(++_0x226680);}(_0xd9d8,0x19b));var _0x8d9d=function(_0x4dfde7,_0x20e0b6){_0x4dfde7=_0x4dfde7-0x0;var _0x57957e=_0xd9d8[_0x4dfde7];return _0x57957e;};'use strict';var multer=require('multer');var util=require(_0x8d9d('0x0'));var path=require(_0x8d9d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d9d('0x2'));var router=express[_0x8d9d('0x3')]();var fs_extra=require(_0x8d9d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8d9d('0x5'));var config=require(_0x8d9d('0x6'));var controller=require(_0x8d9d('0x7'));router[_0x8d9d('0x8')]('/',auth[_0x8d9d('0x9')](),controller[_0x8d9d('0xa')]);router[_0x8d9d('0x8')](_0x8d9d('0xb'),auth[_0x8d9d('0x9')](),controller[_0x8d9d('0xc')]);router[_0x8d9d('0x8')](_0x8d9d('0xd'),auth['isAuthenticated'](),controller[_0x8d9d('0xe')]);router[_0x8d9d('0xf')]('/',auth[_0x8d9d('0x9')](),controller[_0x8d9d('0x10')]);router[_0x8d9d('0x11')]('/:id',auth[_0x8d9d('0x9')](),controller[_0x8d9d('0x12')]);router[_0x8d9d('0x13')](_0x8d9d('0xd'),auth[_0x8d9d('0x9')](),controller[_0x8d9d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3c6c=['create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x45487e,_0x216e8f){var _0x45ecd7=function(_0x4ea419){while(--_0x4ea419){_0x45487e['push'](_0x45487e['shift']());}};_0x45ecd7(++_0x216e8f);}(_0x3c6c,0x112));var _0xc3c6=function(_0x45dad5,_0x195d27){_0x45dad5=_0x45dad5-0x0;var _0x48172=_0x3c6c[_0x45dad5];return _0x48172;};'use strict';var multer=require('multer');var util=require(_0xc3c6('0x0'));var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc3c6('0x5'));var interaction=require(_0xc3c6('0x6'));var config=require('../../config/environment');var controller=require(_0xc3c6('0x7'));router['get']('/',auth[_0xc3c6('0x8')](),controller[_0xc3c6('0x9')]);router[_0xc3c6('0xa')]('/describe',auth[_0xc3c6('0x8')](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0x8')](),controller[_0xc3c6('0xc')]);router[_0xc3c6('0xd')]('/',auth[_0xc3c6('0x8')](),controller[_0xc3c6('0xe')]);router['put']('/:id',auth[_0xc3c6('0x8')](),controller[_0xc3c6('0xf')]);router[_0xc3c6('0x10')](_0xc3c6('0xb'),auth[_0xc3c6('0x8')](),controller['destroy']);module[_0xc3c6('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 72d9e57..ef04bc1 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 _0xa26d=['exports','STRING','DATE','moment'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0xa26d,0x1d7));var _0xda26=function(_0x79fda3,_0x59df67){_0x79fda3=_0x79fda3-0x0;var _0x4fc712=_0xa26d[_0x79fda3];return _0x4fc712;};'use strict';var moment=require(_0xda26('0x0'));var Sequelize=require('sequelize');module[_0xda26('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xda26('0x2')]},'joinAt':{'type':Sequelize[_0xda26('0x3')]},'leaveAt':{'type':Sequelize[_0xda26('0x3')]},'acceptAt':{'type':Sequelize[_0xda26('0x3')]},'exitAt':{'type':Sequelize[_0xda26('0x3')]},'reason':{'type':Sequelize[_0xda26('0x2')]}}; \ No newline at end of file +var _0x387c=['moment','sequelize','exports','STRING','DATE'];(function(_0x1de199,_0x2ab496){var _0x1bdf0d=function(_0x337649){while(--_0x337649){_0x1de199['push'](_0x1de199['shift']());}};_0x1bdf0d(++_0x2ab496);}(_0x387c,0x1a4));var _0xc387=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x387c[_0x31e29a];return _0x32d892;};'use strict';var moment=require(_0xc387('0x0'));var Sequelize=require(_0xc387('0x1'));module[_0xc387('0x2')]={'uniqueid':{'type':Sequelize[_0xc387('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc387('0x4')]},'leaveAt':{'type':Sequelize[_0xc387('0x4')]},'acceptAt':{'type':Sequelize[_0xc387('0x4')]},'exitAt':{'type':Sequelize[_0xc387('0x4')]},'reason':{'type':Sequelize[_0xc387('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6692f6c..a373c3c 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 _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x2d0100,_0x526751){var _0x5c5ab2=function(_0x425c84){while(--_0x425c84){_0x2d0100['push'](_0x2d0100['shift']());}};_0x5c5ab2(++_0x526751);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x8fa74c,_0x2276ab){_0x8fa74c=_0x8fa74c-0x0;var _0x2f00c8=_0xc1c6[_0x8fa74c];return _0x2f00c8;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['MailQueueReport'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['MailQueueReport']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0xa46e=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0x4860bc,_0x3229b8){var _0x22b4ed=function(_0x36f13a){while(--_0x36f13a){_0x4860bc['push'](_0x4860bc['shift']());}};_0x22b4ed(++_0x3229b8);}(_0xa46e,0x8a));var _0xea46=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xa46e[_0x33a694];return _0x41ff01;};'use strict';var emlformat=require(_0xea46('0x0'));var rimraf=require(_0xea46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea46('0x5'));var util=require('util');var path=require(_0xea46('0x6'));var sox=require('sox');var csv=require(_0xea46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea46('0x8'));var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0x7'));var querystring=require(_0xea46('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xe'));var as=require(_0xea46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x10'))(_0xea46('0x11'));var utils=require(_0xea46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x13'));var db=require(_0xea46('0x14'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x15')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x15')](_0x42c328)[_0xea46('0x16')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=typeof _0x81ee45['offset']===_0xea46('0x17')&&typeof _0x81ee45[_0xea46('0x18')]===_0xea46('0x17');var _0x59f28e=_0x20a79c['count'];var _0x19d5c1=_0x176ad2?0x0:_0x81ee45[_0xea46('0x19')];var _0x5cf5dd=_0x176ad2?_0x20a79c['count']:_0x81ee45[_0xea46('0x19')]+_0x81ee45[_0xea46('0x18')];var _0x4ff93d;if(_0x5cf5dd>=_0x59f28e){_0x5cf5dd=_0x59f28e;_0x4ff93d=0xc8;}else{_0x4ff93d=0xce;}_0x2ef436[_0xea46('0x15')](_0x4ff93d);return _0x2ef436[_0xea46('0x1a')](_0xea46('0x1b'),_0x19d5c1+'-'+_0x5cf5dd+'/'+_0x59f28e)[_0xea46('0x16')](_0x20a79c);}return null;};}function patchUpdates(_0x53b8db){return function(_0x2b6491){try{jsonpatch['apply'](_0x2b6491,_0x53b8db,!![]);}catch(_0x515e32){return BPromise[_0xea46('0x1c')](_0x515e32);}return _0x2b6491['save']();};}function saveUpdates(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1d')](_0x4cc673)[_0xea46('0x1e')](function(_0x5beb44){return _0x5beb44;});}return null;};}function removeEntity(_0x16f8fa,_0x59b10d){return function(_0x12e688){if(_0x12e688){return _0x12e688[_0xea46('0x1f')]()['then'](function(){_0x16f8fa[_0xea46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3a8f,_0x114bf9){return function(_0xd4cf78){if(!_0xd4cf78){_0x2b3a8f['sendStatus'](0x194);}return _0xd4cf78;};}function handleError(_0x5d2de1,_0x44e797){_0x44e797=_0x44e797||0x1f4;return function(_0x38ac07){logger['error'](_0x38ac07[_0xea46('0x20')]);if(_0x38ac07['name']){delete _0x38ac07[_0xea46('0x21')];}_0x5d2de1['status'](_0x44e797)[_0xea46('0x22')](_0x38ac07);};}exports[_0xea46('0x23')]=function(_0x6710ae,_0x44517d){var _0x146995={},_0x174345={},_0x4a5149={'count':0x0,'rows':[]};var _0x382bbc=_[_0xea46('0x24')](db[_0xea46('0x25')]['rawAttributes'],function(_0x3e7856){return{'name':_0x3e7856[_0xea46('0x26')],'type':_0x3e7856[_0xea46('0x27')]['key']};});_0x174345['model']=_['map'](_0x382bbc,_0xea46('0x21'));_0x174345[_0xea46('0x28')]=_[_0xea46('0x29')](_0x6710ae[_0xea46('0x28')]);_0x174345[_0xea46('0x2a')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],_0x174345[_0xea46('0x28')]);_0x146995[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],qs['fields'](_0x6710ae[_0xea46('0x28')][_0xea46('0x2e')]));_0x146995[_0xea46('0x2d')]=_0x146995[_0xea46('0x2d')][_0xea46('0x2f')]?_0x146995[_0xea46('0x2d')]:_0x174345[_0xea46('0x2c')];if(!_0x6710ae['query'][_0xea46('0x30')](_0xea46('0x31'))){_0x146995[_0xea46('0x18')]=qs[_0xea46('0x18')](_0x6710ae[_0xea46('0x28')]['limit']);_0x146995['offset']=qs[_0xea46('0x19')](_0x6710ae[_0xea46('0x28')]['offset']);}_0x146995[_0xea46('0x32')]=qs[_0xea46('0x33')](_0x6710ae[_0xea46('0x28')][_0xea46('0x33')]);_0x146995['where']=qs['filters'](_[_0xea46('0x34')](_0x6710ae['query'],_0x174345[_0xea46('0x2a')]),_0x382bbc);if(_0x6710ae[_0xea46('0x28')]['filter']){_0x146995[_0xea46('0x35')]=_[_0xea46('0x36')](_0x146995['where'],{'$or':_[_0xea46('0x24')](_0x382bbc,function(_0xefad3e){if(_0xefad3e['type']!==_0xea46('0x37')){var _0x41e9e8={};_0x41e9e8[_0xefad3e[_0xea46('0x21')]]={'$like':'%'+_0x6710ae[_0xea46('0x28')]['filter']+'%'};return _0x41e9e8;}})});}_0x146995=_[_0xea46('0x36')]({},_0x146995,_0x6710ae[_0xea46('0x38')]);var _0x338c2d={'where':_0x146995[_0xea46('0x35')]};return db[_0xea46('0x25')]['count'](_0x338c2d)[_0xea46('0x1e')](function(_0xdb2e11){_0x4a5149['count']=_0xdb2e11;if(_0x6710ae[_0xea46('0x28')][_0xea46('0x39')]){_0x146995[_0xea46('0x3a')]=[{'all':!![]}];}return db[_0xea46('0x25')]['findAll'](_0x146995);})[_0xea46('0x1e')](function(_0x1cc8f8){_0x4a5149[_0xea46('0x3b')]=_0x1cc8f8;return _0x4a5149;})['then'](respondWithFilteredResult(_0x44517d,_0x146995))[_0xea46('0x3c')](handleError(_0x44517d,null));};exports[_0xea46('0x3d')]=function(_0x2c9491,_0x32c81c){var _0x3164c5={'raw':!![],'where':{'id':_0x2c9491[_0xea46('0x3e')]['id']}},_0xc45d74={};_0xc45d74[_0xea46('0x2c')]=_[_0xea46('0x29')](db[_0xea46('0x25')][_0xea46('0x3f')]);_0xc45d74[_0xea46('0x28')]=_[_0xea46('0x29')](_0x2c9491[_0xea46('0x28')]);_0xc45d74[_0xea46('0x2a')]=_['intersection'](_0xc45d74['model'],_0xc45d74[_0xea46('0x28')]);_0x3164c5[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0xc45d74[_0xea46('0x2c')],qs['fields'](_0x2c9491['query']['fields']));_0x3164c5[_0xea46('0x2d')]=_0x3164c5[_0xea46('0x2d')]['length']?_0x3164c5[_0xea46('0x2d')]:_0xc45d74[_0xea46('0x2c')];if(_0x2c9491[_0xea46('0x28')][_0xea46('0x39')]){_0x3164c5[_0xea46('0x3a')]=[{'all':!![]}];}_0x3164c5=_['merge']({},_0x3164c5,_0x2c9491[_0xea46('0x38')]);return db['MailQueueReport'][_0xea46('0x40')](_0x3164c5)[_0xea46('0x1e')](handleEntityNotFound(_0x32c81c,null))[_0xea46('0x1e')](respondWithResult(_0x32c81c,null))[_0xea46('0x3c')](handleError(_0x32c81c,null));};exports[_0xea46('0x41')]=function(_0x1260d1,_0x36f697){return db['MailQueueReport'][_0xea46('0x41')](_0x1260d1[_0xea46('0x42')],{})['then'](respondWithResult(_0x36f697,0xc9))[_0xea46('0x3c')](handleError(_0x36f697,null));};exports[_0xea46('0x1d')]=function(_0x24d929,_0x548572){if(_0x24d929['body']['id']){delete _0x24d929[_0xea46('0x42')]['id'];}return db[_0xea46('0x25')][_0xea46('0x40')]({'where':{'id':_0x24d929[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x548572,null))[_0xea46('0x1e')](saveUpdates(_0x24d929[_0xea46('0x42')],null))[_0xea46('0x1e')](respondWithResult(_0x548572,null))[_0xea46('0x3c')](handleError(_0x548572,null));};exports[_0xea46('0x1f')]=function(_0x48ad1c,_0x2144a0){return db['MailQueueReport'][_0xea46('0x40')]({'where':{'id':_0x48ad1c[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x2144a0,null))['then'](removeEntity(_0x2144a0,null))[_0xea46('0x3c')](handleError(_0x2144a0,null));};exports[_0xea46('0x43')]=function(_0x334937,_0x2f49c8){return db['MailQueueReport']['describe']()[_0xea46('0x1e')](respondWithResult(_0x2f49c8,null))[_0xea46('0x3c')](handleError(_0x2f49c8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 38a4b98..c210314 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 _0x19d1=['path','rimraf','define','MailQueueReport','report_mail_queue','uniqueid','util','moment'];(function(_0x55a9c4,_0x425e82){var _0x43f090=function(_0x32c4fd){while(--_0x32c4fd){_0x55a9c4['push'](_0x55a9c4['shift']());}};_0x43f090(++_0x425e82);}(_0x19d1,0xd6));var _0x119d=function(_0x1c6c22,_0x136456){_0x1c6c22=_0x1c6c22-0x0;var _0x521cf3=_0x19d1[_0x1c6c22];return _0x521cf3;};'use strict';var _=require('lodash');var util=require(_0x119d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x119d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x119d('0x2'));var rimraf=require(_0x119d('0x3'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x3c1216,_0x246172){return _0x3c1216[_0x119d('0x4')](_0x119d('0x5'),attributes,{'tableName':_0x119d('0x6'),'paranoid':![],'indexes':[{'name':_0x119d('0x7'),'fields':[_0x119d('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c2=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x4b71cb,_0x1a5c50){var _0xa11a97=function(_0x324da4){while(--_0x324da4){_0x4b71cb['push'](_0x4b71cb['shift']());}};_0xa11a97(++_0x1a5c50);}(_0xe0c2,0x152));var _0x2e0c=function(_0x165ba6,_0x1b6fd1){_0x165ba6=_0x165ba6-0x0;var _0x48c376=_0xe0c2[_0x165ba6];return _0x48c376;};'use strict';var _=require(_0x2e0c('0x0'));var util=require(_0x2e0c('0x1'));var logger=require(_0x2e0c('0x2'))(_0x2e0c('0x3'));var moment=require(_0x2e0c('0x4'));var BPromise=require(_0x2e0c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e0c('0x6'));var rimraf=require(_0x2e0c('0x7'));var config=require(_0x2e0c('0x8'));var attributes=require(_0x2e0c('0x9'));module['exports']=function(_0x2ff260,_0x8581e5){return _0x2ff260['define'](_0x2e0c('0xa'),attributes,{'tableName':_0x2e0c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2e0c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 605501a..77160fb 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(_0x4eb908,_0x172acc){var _0x1abab3=function(_0xce0c4f){while(--_0xce0c4f){_0x4eb908['push'](_0x4eb908['shift']());}};_0x1abab3(++_0x172acc);}(_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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x35fe73,_0x2ba9f7){var _0x1562a4=function(_0xaa4df8){while(--_0xaa4df8){_0x35fe73['push'](_0x35fe73['shift']());}};_0x1562a4(++_0x2ba9f7);}(_0xdb28,0x106));var _0x8db2=function(_0x419b45,_0xd50c93){_0x419b45=_0x419b45-0x0;var _0x8c7362=_0xdb28[_0x419b45];return _0x8c7362;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2496d53..9ada67a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x69e47b,_0x2ab23b){var _0x5392a3=function(_0x4a7581){while(--_0x4a7581){_0x69e47b['push'](_0x69e47b['shift']());}};_0x5392a3(++_0x2ab23b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x7200ad,_0x237e65){var _0x19ca0f=function(_0x13ee21){while(--_0x13ee21){_0x7200ad['push'](_0x7200ad['shift']());}};_0x19ca0f(++_0x237e65);}(_0x70e0,0x17b));var _0x070e=function(_0x1e9d94,_0xdfae11){_0x1e9d94=_0x1e9d94-0x0;var _0x32263b=_0x70e0[_0x1e9d94];return _0x32263b;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 26fa8c1..6222695 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 _0xe5e3=['INTEGER','BOOLEAN','INBOX','exports','STRING'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0xe5e3,0x17a));var _0x3e5e=function(_0x441df1,_0x72af27){_0x441df1=_0x441df1-0x0;var _0xe956b8=_0xe5e3[_0x441df1];return _0xe956b8;};'use strict';var Sequelize=require('sequelize');module[_0x3e5e('0x0')]={'description':{'type':Sequelize[_0x3e5e('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3e5e('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3e5e('0x2')]},'tls':{'type':Sequelize[_0x3e5e('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x3e5e('0x4')},'connTimeout':{'type':Sequelize[_0x3e5e('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3e5e('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc7c9=['STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x5cf728,_0xb8e38c){var _0x199dc2=function(_0x6ea1f1){while(--_0x6ea1f1){_0x5cf728['push'](_0x5cf728['shift']());}};_0x199dc2(++_0xb8e38c);}(_0xc7c9,0xb8));var _0x9c7c=function(_0x42c36f,_0x20458e){_0x42c36f=_0x42c36f-0x0;var _0x16e0e9=_0xc7c9[_0x42c36f];return _0x16e0e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9c7c('0x0')]},'authentication':{'type':Sequelize[_0x9c7c('0x1')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9c7c('0x0')]},'port':{'type':Sequelize[_0x9c7c('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9c7c('0x0')],'defaultValue':_0x9c7c('0x3')},'connTimeout':{'type':Sequelize[_0x9c7c('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9c7c('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9c7c('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1200d53..5cc2f7b 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 _0xf4dd=['./mailServerIn.attributes','define','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf4dd,0x19b));var _0xdf4d=function(_0x420532,_0x43af73){_0x420532=_0x420532-0x0;var _0xbde273=_0xf4dd[_0x420532];return _0xbde273;};'use strict';var _=require('lodash');var util=require(_0xdf4d('0x0'));var logger=require(_0xdf4d('0x1'))(_0xdf4d('0x2'));var moment=require(_0xdf4d('0x3'));var BPromise=require(_0xdf4d('0x4'));var rp=require(_0xdf4d('0x5'));var fs=require('fs');var path=require(_0xdf4d('0x6'));var rimraf=require(_0xdf4d('0x7'));var config=require(_0xdf4d('0x8'));var attributes=require(_0xdf4d('0x9'));module['exports']=function(_0x3a2ab5,_0x211490){return _0x3a2ab5[_0xdf4d('0xa')]('MailServerIn',attributes,{'tableName':_0xdf4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb221=['MailServerIn','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xb221,0x1d5));var _0x1b22=function(_0x2cb58b,_0x5a879d){_0x2cb58b=_0x2cb58b-0x0;var _0xe9dd9c=_0xb221[_0x2cb58b];return _0xe9dd9c;};'use strict';var _=require(_0x1b22('0x0'));var util=require(_0x1b22('0x1'));var logger=require(_0x1b22('0x2'))(_0x1b22('0x3'));var moment=require(_0x1b22('0x4'));var BPromise=require(_0x1b22('0x5'));var rp=require(_0x1b22('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b22('0x7'));var config=require(_0x1b22('0x8'));var attributes=require(_0x1b22('0x9'));module[_0x1b22('0xa')]=function(_0x35f161,_0x20a4ad){return _0x35f161[_0x1b22('0xb')](_0x1b22('0xc'),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 0073559..79748c2 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 _0xac52=['model','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xac52,0x122));var _0x2ac5=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0xac52[_0x179b53];return _0x38a146;};'use strict';var _=require('lodash');var util=require(_0x2ac5('0x0'));var moment=require(_0x2ac5('0x1'));var BPromise=require(_0x2ac5('0x2'));var rs=require(_0x2ac5('0x3'));var fs=require('fs');var Redis=require(_0x2ac5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ac5('0x5'));var logger=require(_0x2ac5('0x6'))('rpc');var config=require(_0x2ac5('0x7'));var jayson=require(_0x2ac5('0x8'));var client=jayson[_0x2ac5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a8ed,_0x433d88,_0x197aed){return new BPromise(function(_0x1ff724,_0x3fc8b5){return client[_0x2ac5('0xa')](_0x54a8ed,_0x197aed)[_0x2ac5('0xb')](function(_0x22f28b){logger[_0x2ac5('0xc')](_0x2ac5('0xd'),_0x433d88,_0x2ac5('0xe'));logger['debug'](_0x2ac5('0xf'),_0x433d88,_0x2ac5('0xe'),JSON[_0x2ac5('0x10')](_0x22f28b));if(_0x22f28b[_0x2ac5('0x11')]){if(_0x22f28b['error']['code']===0x1f4){logger['error'](_0x2ac5('0xd'),_0x433d88,_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);return _0x3fc8b5(_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);}logger['error'](_0x2ac5('0xd'),_0x433d88,_0x22f28b['error'][_0x2ac5('0x12')]);return _0x1ff724(_0x22f28b[_0x2ac5('0x11')][_0x2ac5('0x12')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x433d88,_0x2ac5('0xe'));_0x1ff724(_0x22f28b[_0x2ac5('0x13')][_0x2ac5('0x12')]);}})[_0x2ac5('0x14')](function(_0x1741ce){logger[_0x2ac5('0x11')](_0x2ac5('0xd'),_0x433d88,_0x1741ce);_0x3fc8b5(_0x1741ce);});});}exports[_0x2ac5('0x15')]=function(_0x101a68){var _0x1011ff=this;return new Promise(function(_0x4ba2b5,_0x32a806){return db[_0x2ac5('0x16')][_0x2ac5('0x17')]({'raw':_0x101a68['options']?_0x101a68[_0x2ac5('0x18')][_0x2ac5('0x19')]===undefined?!![]:![]:!![],'where':_0x101a68['options']?_0x101a68[_0x2ac5('0x18')][_0x2ac5('0x1a')]||null:null,'attributes':_0x101a68[_0x2ac5('0x18')]?_0x101a68[_0x2ac5('0x18')][_0x2ac5('0x1b')]||null:null,'limit':_0x101a68[_0x2ac5('0x18')]?_0x101a68[_0x2ac5('0x18')]['limit']||null:null,'include':_0x101a68[_0x2ac5('0x18')]?_0x101a68[_0x2ac5('0x18')][_0x2ac5('0x1c')]?_['map'](_0x101a68[_0x2ac5('0x18')][_0x2ac5('0x1c')],function(_0x409b63){return{'model':db[_0x409b63['model']],'as':_0x409b63['as'],'attributes':_0x409b63[_0x2ac5('0x1b')],'include':_0x409b63[_0x2ac5('0x1c')]?_[_0x2ac5('0x1d')](_0x409b63[_0x2ac5('0x1c')],function(_0x388ace){return{'model':db[_0x388ace[_0x2ac5('0x1e')]],'as':_0x388ace['as'],'attributes':_0x388ace['attributes'],'include':_0x388ace[_0x2ac5('0x1c')]?_[_0x2ac5('0x1d')](_0x388ace[_0x2ac5('0x1c')],function(_0x1a103e){return{'model':db[_0x1a103e[_0x2ac5('0x1e')]],'as':_0x1a103e['as'],'attributes':_0x1a103e[_0x2ac5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2ac5('0xb')](function(_0x31780f){logger['info'](_0x2ac5('0x15'),_0x101a68);logger[_0x2ac5('0x1f')](_0x2ac5('0x15'),_0x101a68,JSON[_0x2ac5('0x10')](_0x31780f));_0x4ba2b5(_0x31780f);})[_0x2ac5('0x14')](function(_0x2b7eb6){logger['error'](_0x2ac5('0x15'),_0x2b7eb6[_0x2ac5('0x12')],_0x101a68);_0x32a806(_0x1011ff['error'](0x1f4,_0x2b7eb6[_0x2ac5('0x12')]));});});}; \ No newline at end of file +var _0x46cd=['../../config/utils','../../config/logger','../../config/environment','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailServerIn','findAll','options','raw','where','include','map','model','attributes','GetMailServerIn','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xf1f108,_0x513aa3){var _0x208983=function(_0x31b210){while(--_0x31b210){_0xf1f108['push'](_0xf1f108['shift']());}};_0x208983(++_0x513aa3);}(_0x46cd,0x181));var _0xd46c=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x46cd[_0xe73080];return _0x12cbc4;};'use strict';var _=require('lodash');var util=require(_0xd46c('0x0'));var moment=require(_0xd46c('0x1'));var BPromise=require(_0xd46c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd46c('0x3'));var db=require(_0xd46c('0x4'))['db'];var utils=require(_0xd46c('0x5'));var logger=require(_0xd46c('0x6'))('rpc');var config=require(_0xd46c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12b04e,_0xd76252,_0x1b4ab8){return new BPromise(function(_0x5321f7,_0x3dfbff){return client['request'](_0x12b04e,_0x1b4ab8)[_0xd46c('0x8')](function(_0x484f8e){logger[_0xd46c('0x9')](_0xd46c('0xa'),_0xd76252,_0xd46c('0xb'));logger[_0xd46c('0xc')](_0xd46c('0xd'),_0xd76252,'request\x20sent',JSON[_0xd46c('0xe')](_0x484f8e));if(_0x484f8e[_0xd46c('0xf')]){if(_0x484f8e[_0xd46c('0xf')][_0xd46c('0x10')]===0x1f4){logger[_0xd46c('0xf')](_0xd46c('0xa'),_0xd76252,_0x484f8e[_0xd46c('0xf')][_0xd46c('0x11')]);return _0x3dfbff(_0x484f8e[_0xd46c('0xf')][_0xd46c('0x11')]);}logger[_0xd46c('0xf')](_0xd46c('0xa'),_0xd76252,_0x484f8e[_0xd46c('0xf')]['message']);return _0x5321f7(_0x484f8e['error']['message']);}else{logger[_0xd46c('0x9')]('MailServerIn,\x20%s,\x20%s',_0xd76252,_0xd46c('0xb'));_0x5321f7(_0x484f8e[_0xd46c('0x12')][_0xd46c('0x11')]);}})['catch'](function(_0x13fb5e){logger[_0xd46c('0xf')](_0xd46c('0xa'),_0xd76252,_0x13fb5e);_0x3dfbff(_0x13fb5e);});});}exports['GetMailServerIn']=function(_0x438ead){var _0x478b3c=this;return new Promise(function(_0x13807c,_0x5352ba){return db[_0xd46c('0x13')][_0xd46c('0x14')]({'raw':_0x438ead[_0xd46c('0x15')]?_0x438ead[_0xd46c('0x15')][_0xd46c('0x16')]===undefined?!![]:![]:!![],'where':_0x438ead['options']?_0x438ead[_0xd46c('0x15')][_0xd46c('0x17')]||null:null,'attributes':_0x438ead[_0xd46c('0x15')]?_0x438ead['options']['attributes']||null:null,'limit':_0x438ead['options']?_0x438ead['options']['limit']||null:null,'include':_0x438ead[_0xd46c('0x15')]?_0x438ead[_0xd46c('0x15')][_0xd46c('0x18')]?_[_0xd46c('0x19')](_0x438ead[_0xd46c('0x15')][_0xd46c('0x18')],function(_0x5ee4a6){return{'model':db[_0x5ee4a6[_0xd46c('0x1a')]],'as':_0x5ee4a6['as'],'attributes':_0x5ee4a6[_0xd46c('0x1b')],'include':_0x5ee4a6[_0xd46c('0x18')]?_[_0xd46c('0x19')](_0x5ee4a6[_0xd46c('0x18')],function(_0x5585f8){return{'model':db[_0x5585f8[_0xd46c('0x1a')]],'as':_0x5585f8['as'],'attributes':_0x5585f8[_0xd46c('0x1b')],'include':_0x5585f8[_0xd46c('0x18')]?_[_0xd46c('0x19')](_0x5585f8[_0xd46c('0x18')],function(_0x4252ce){return{'model':db[_0x4252ce[_0xd46c('0x1a')]],'as':_0x4252ce['as'],'attributes':_0x4252ce[_0xd46c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd46c('0x8')](function(_0x277dc4){logger[_0xd46c('0x9')](_0xd46c('0x1c'),_0x438ead);logger[_0xd46c('0xc')]('GetMailServerIn',_0x438ead,JSON[_0xd46c('0xe')](_0x277dc4));_0x13807c(_0x277dc4);})[_0xd46c('0x1d')](function(_0x2ee84d){logger[_0xd46c('0xf')](_0xd46c('0x1c'),_0x2ee84d[_0xd46c('0x11')],_0x438ead);_0x5352ba(_0x478b3c[_0xd46c('0xf')](0x1f4,_0x2ee84d[_0xd46c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index a8e2e2b..544d388 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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x6aef90,_0x530cf8){_0x6aef90=_0x6aef90-0x0;var _0x5111d2=_0x7a54[_0x6aef90];return _0x5111d2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x1ed45e,_0x45714f){_0x1ed45e=_0x1ed45e-0x0;var _0xdfe754=_0x7a54[_0x1ed45e];return _0xdfe754;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 66f9ada..effdc84 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 _0x0713=['BOOLEAN','STRING','INTEGER'];(function(_0xfdf9de,_0x2b1f30){var _0x3bba74=function(_0x3b3cac){while(--_0x3b3cac){_0xfdf9de['push'](_0xfdf9de['shift']());}};_0x3bba74(++_0x2b1f30);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3071('0x0')]},'host':{'type':Sequelize[_0x3071('0x0')]},'user':{'type':Sequelize[_0x3071('0x0')]},'pass':{'type':Sequelize[_0x3071('0x0')]},'port':{'type':Sequelize[_0x3071('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3071('0x0')]},'authentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb58b=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x3250a6,_0xee4196){var _0x1c7e88=function(_0x9018d8){while(--_0x9018d8){_0x3250a6['push'](_0x3250a6['shift']());}};_0x1c7e88(++_0xee4196);}(_0xb58b,0x1f1));var _0xbb58=function(_0x27d30a,_0x252ee1){_0x27d30a=_0x27d30a-0x0;var _0x122835=_0xb58b[_0x27d30a];return _0x122835;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'description':{'type':Sequelize[_0xbb58('0x1')]},'host':{'type':Sequelize[_0xbb58('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xbb58('0x1')]},'port':{'type':Sequelize[_0xbb58('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbb58('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb58('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f416236..e150da2 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 _0xf6a0=['lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','MailServerOut','includeAll','show','include','find','create','body','catch','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x2709bb,_0x41eede){var _0x5a5bbd=function(_0x1d2f50){while(--_0x1d2f50){_0x2709bb['push'](_0x2709bb['shift']());}};_0x5a5bbd(++_0x41eede);}(_0xf6a0,0x124));var _0x0f6a=function(_0x4efe12,_0x33d35c){_0x4efe12=_0x4efe12-0x0;var _0x20a269=_0xf6a0[_0x4efe12];return _0x20a269;};'use strict';var emlformat=require(_0x0f6a('0x0'));var rimraf=require(_0x0f6a('0x1'));var zipdir=require(_0x0f6a('0x2'));var jsonpatch=require(_0x0f6a('0x3'));var rp=require(_0x0f6a('0x4'));var moment=require(_0x0f6a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f6a('0x6'));var util=require(_0x0f6a('0x7'));var path=require(_0x0f6a('0x8'));var sox=require(_0x0f6a('0x9'));var csv=require(_0x0f6a('0xa'));var ejs=require(_0x0f6a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f6a('0xc'));var squel=require(_0x0f6a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f6a('0xe'));var toCsv=require(_0x0f6a('0xa'));var querystring=require(_0x0f6a('0xf'));var Papa=require(_0x0f6a('0x10'));var Redis=require(_0x0f6a('0x11'));var authService=require(_0x0f6a('0x12'));var qs=require(_0x0f6a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f6a('0x14'))(_0x0f6a('0x15'));var utils=require(_0x0f6a('0x16'));var config=require(_0x0f6a('0x17'));var licenseUtil=require(_0x0f6a('0x18'));var db=require(_0x0f6a('0x19'))['db'];function respondWithStatusCode(_0x13fdf5,_0x1cd93b){_0x1cd93b=_0x1cd93b||0xcc;return function(_0x439f20){if(_0x439f20){return _0x13fdf5['sendStatus'](_0x1cd93b);}return _0x13fdf5[_0x0f6a('0x1a')](_0x1cd93b)['end']();};}function respondWithResult(_0x7cee77,_0x212405){_0x212405=_0x212405||0xc8;return function(_0xb981fd){if(_0xb981fd){return _0x7cee77[_0x0f6a('0x1a')](_0x212405)[_0x0f6a('0x1b')](_0xb981fd);}};}function respondWithFilteredResult(_0x20b397,_0x581739){return function(_0x55d74f){if(_0x55d74f){var _0x4418f4=typeof _0x581739['offset']===_0x0f6a('0x1c')&&typeof _0x581739[_0x0f6a('0x1d')]===_0x0f6a('0x1c');var _0x1b9c48=_0x55d74f['count'];var _0x46caef=_0x4418f4?0x0:_0x581739[_0x0f6a('0x1e')];var _0x3f6861=_0x4418f4?_0x55d74f[_0x0f6a('0x1f')]:_0x581739['offset']+_0x581739[_0x0f6a('0x1d')];var _0x311b28;if(_0x3f6861>=_0x1b9c48){_0x3f6861=_0x1b9c48;_0x311b28=0xc8;}else{_0x311b28=0xce;}_0x20b397[_0x0f6a('0x1a')](_0x311b28);return _0x20b397[_0x0f6a('0x20')](_0x0f6a('0x21'),_0x46caef+'-'+_0x3f6861+'/'+_0x1b9c48)['json'](_0x55d74f);}return null;};}function patchUpdates(_0x1851fb){return function(_0x2fc2db){try{jsonpatch[_0x0f6a('0x22')](_0x2fc2db,_0x1851fb,!![]);}catch(_0x46557a){return BPromise[_0x0f6a('0x23')](_0x46557a);}return _0x2fc2db[_0x0f6a('0x24')]();};}function saveUpdates(_0x2c0580,_0x1e8246){return function(_0x353558){if(_0x353558){return _0x353558[_0x0f6a('0x25')](_0x2c0580)[_0x0f6a('0x26')](function(_0xd77a2e){return _0xd77a2e;});}return null;};}function removeEntity(_0x5ef9d4,_0x3a2605){return function(_0x25a19e){if(_0x25a19e){return _0x25a19e['destroy']()[_0x0f6a('0x26')](function(){_0x5ef9d4[_0x0f6a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35780d,_0x349c95){return function(_0x353701){if(!_0x353701){_0x35780d[_0x0f6a('0x27')](0x194);}return _0x353701;};}function handleError(_0x5f530d,_0x4e4c8a){_0x4e4c8a=_0x4e4c8a||0x1f4;return function(_0x2dcd3f){logger[_0x0f6a('0x28')](_0x2dcd3f[_0x0f6a('0x29')]);if(_0x2dcd3f[_0x0f6a('0x2a')]){delete _0x2dcd3f[_0x0f6a('0x2a')];}_0x5f530d[_0x0f6a('0x1a')](_0x4e4c8a)[_0x0f6a('0x2b')](_0x2dcd3f);};}exports[_0x0f6a('0x2c')]=function(_0x36a170,_0x24a4d2){var _0x5e0437={},_0x312723={},_0x1d5eef={'count':0x0,'rows':[]};var _0x3b6e47=_[_0x0f6a('0x2d')](db['MailServerOut']['rawAttributes'],function(_0x577b98){return{'name':_0x577b98[_0x0f6a('0x2e')],'type':_0x577b98[_0x0f6a('0x2f')][_0x0f6a('0x30')]};});_0x312723[_0x0f6a('0x31')]=_['map'](_0x3b6e47,_0x0f6a('0x2a'));_0x312723[_0x0f6a('0x32')]=_[_0x0f6a('0x33')](_0x36a170[_0x0f6a('0x32')]);_0x312723['filters']=_[_0x0f6a('0x34')](_0x312723[_0x0f6a('0x31')],_0x312723[_0x0f6a('0x32')]);_0x5e0437[_0x0f6a('0x35')]=_[_0x0f6a('0x34')](_0x312723[_0x0f6a('0x31')],qs[_0x0f6a('0x36')](_0x36a170[_0x0f6a('0x32')]['fields']));_0x5e0437[_0x0f6a('0x35')]=_0x5e0437['attributes'][_0x0f6a('0x37')]?_0x5e0437['attributes']:_0x312723[_0x0f6a('0x31')];if(!_0x36a170[_0x0f6a('0x32')][_0x0f6a('0x38')]('nolimit')){_0x5e0437['limit']=qs[_0x0f6a('0x1d')](_0x36a170[_0x0f6a('0x32')][_0x0f6a('0x1d')]);_0x5e0437['offset']=qs[_0x0f6a('0x1e')](_0x36a170[_0x0f6a('0x32')][_0x0f6a('0x1e')]);}_0x5e0437[_0x0f6a('0x39')]=qs['sort'](_0x36a170[_0x0f6a('0x32')][_0x0f6a('0x3a')]);_0x5e0437['where']=qs[_0x0f6a('0x3b')](_[_0x0f6a('0x3c')](_0x36a170['query'],_0x312723[_0x0f6a('0x3b')]),_0x3b6e47);if(_0x36a170[_0x0f6a('0x32')]['filter']){_0x5e0437['where']=_['merge'](_0x5e0437[_0x0f6a('0x3d')],{'$or':_[_0x0f6a('0x2d')](_0x3b6e47,function(_0x360f96){if(_0x360f96['type']!==_0x0f6a('0x3e')){var _0x3602d2={};_0x3602d2[_0x360f96['name']]={'$like':'%'+_0x36a170[_0x0f6a('0x32')][_0x0f6a('0x3f')]+'%'};return _0x3602d2;}})});}_0x5e0437=_[_0x0f6a('0x40')]({},_0x5e0437,_0x36a170[_0x0f6a('0x41')]);var _0x4b3590={'where':_0x5e0437[_0x0f6a('0x3d')]};return db[_0x0f6a('0x42')][_0x0f6a('0x1f')](_0x4b3590)[_0x0f6a('0x26')](function(_0x200fb7){_0x1d5eef['count']=_0x200fb7;if(_0x36a170['query'][_0x0f6a('0x43')]){_0x5e0437['include']=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x5e0437);})[_0x0f6a('0x26')](function(_0x59f13a){_0x1d5eef['rows']=_0x59f13a;return _0x1d5eef;})[_0x0f6a('0x26')](respondWithFilteredResult(_0x24a4d2,_0x5e0437))['catch'](handleError(_0x24a4d2,null));};exports[_0x0f6a('0x44')]=function(_0x412473,_0x3c73bb){var _0xc0e2eb={'raw':!![],'where':{'id':_0x412473['params']['id']}},_0x40fca5={};_0x40fca5[_0x0f6a('0x31')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x40fca5[_0x0f6a('0x32')]=_[_0x0f6a('0x33')](_0x412473[_0x0f6a('0x32')]);_0x40fca5[_0x0f6a('0x3b')]=_[_0x0f6a('0x34')](_0x40fca5[_0x0f6a('0x31')],_0x40fca5[_0x0f6a('0x32')]);_0xc0e2eb[_0x0f6a('0x35')]=_[_0x0f6a('0x34')](_0x40fca5['model'],qs[_0x0f6a('0x36')](_0x412473['query'][_0x0f6a('0x36')]));_0xc0e2eb['attributes']=_0xc0e2eb['attributes'][_0x0f6a('0x37')]?_0xc0e2eb[_0x0f6a('0x35')]:_0x40fca5[_0x0f6a('0x31')];if(_0x412473['query'][_0x0f6a('0x43')]){_0xc0e2eb[_0x0f6a('0x45')]=[{'all':!![]}];}_0xc0e2eb=_['merge']({},_0xc0e2eb,_0x412473['options']);return db[_0x0f6a('0x42')][_0x0f6a('0x46')](_0xc0e2eb)[_0x0f6a('0x26')](handleEntityNotFound(_0x3c73bb,null))['then'](respondWithResult(_0x3c73bb,null))['catch'](handleError(_0x3c73bb,null));};exports['create']=function(_0x4a78c5,_0x400d7f){return db['MailServerOut'][_0x0f6a('0x47')](_0x4a78c5[_0x0f6a('0x48')],{})['then'](respondWithResult(_0x400d7f,0xc9))[_0x0f6a('0x49')](handleError(_0x400d7f,null));};exports[_0x0f6a('0x25')]=function(_0xe2d671,_0x20e2d5){if(_0xe2d671['body']['id']){delete _0xe2d671[_0x0f6a('0x48')]['id'];}return db[_0x0f6a('0x42')]['find']({'where':{'id':_0xe2d671[_0x0f6a('0x4a')]['id']}})[_0x0f6a('0x26')](handleEntityNotFound(_0x20e2d5,null))[_0x0f6a('0x26')](saveUpdates(_0xe2d671[_0x0f6a('0x48')],null))['then'](respondWithResult(_0x20e2d5,null))[_0x0f6a('0x49')](handleError(_0x20e2d5,null));};exports[_0x0f6a('0x4b')]=function(_0xa7b4bf,_0x25778c){return db[_0x0f6a('0x42')]['find']({'where':{'id':_0xa7b4bf[_0x0f6a('0x4a')]['id']}})[_0x0f6a('0x26')](handleEntityNotFound(_0x25778c,null))['then'](removeEntity(_0x25778c,null))[_0x0f6a('0x49')](handleError(_0x25778c,null));}; \ No newline at end of file +var _0x4110=['destroy','then','error','name','send','index','map','MailServerOut','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','count','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update'];(function(_0x132901,_0x38a9ab){var _0x52f947=function(_0x7cecb9){while(--_0x7cecb9){_0x132901['push'](_0x132901['shift']());}};_0x52f947(++_0x38a9ab);}(_0x4110,0xf8));var _0x0411=function(_0xd89cb1,_0x163d00){_0xd89cb1=_0xd89cb1-0x0;var _0x5c9c6f=_0x4110[_0xd89cb1];return _0x5c9c6f;};'use strict';var emlformat=require(_0x0411('0x0'));var rimraf=require(_0x0411('0x1'));var zipdir=require(_0x0411('0x2'));var jsonpatch=require(_0x0411('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0411('0x4'));var util=require(_0x0411('0x5'));var path=require(_0x0411('0x6'));var sox=require(_0x0411('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0411('0x8'));var _=require('lodash');var squel=require(_0x0411('0x9'));var crypto=require(_0x0411('0xa'));var jsforce=require(_0x0411('0xb'));var deskjs=require(_0x0411('0xc'));var toCsv=require(_0x0411('0xd'));var querystring=require(_0x0411('0xe'));var Papa=require(_0x0411('0xf'));var Redis=require('ioredis');var authService=require(_0x0411('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0411('0x11'));var logger=require(_0x0411('0x12'))(_0x0411('0x13'));var utils=require(_0x0411('0x14'));var config=require(_0x0411('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0411('0x16'))['db'];function respondWithStatusCode(_0x505bf2,_0x28b7f6){_0x28b7f6=_0x28b7f6||0xcc;return function(_0xdca46c){if(_0xdca46c){return _0x505bf2[_0x0411('0x17')](_0x28b7f6);}return _0x505bf2['status'](_0x28b7f6)[_0x0411('0x18')]();};}function respondWithResult(_0x2dd96a,_0xa8fbcb){_0xa8fbcb=_0xa8fbcb||0xc8;return function(_0x19afd5){if(_0x19afd5){return _0x2dd96a[_0x0411('0x19')](_0xa8fbcb)[_0x0411('0x1a')](_0x19afd5);}};}function respondWithFilteredResult(_0x58f416,_0x2f3afe){return function(_0xb83add){if(_0xb83add){var _0x5f4083=typeof _0x2f3afe[_0x0411('0x1b')]===_0x0411('0x1c')&&typeof _0x2f3afe[_0x0411('0x1d')]===_0x0411('0x1c');var _0xc26e2c=_0xb83add['count'];var _0x1cb0b4=_0x5f4083?0x0:_0x2f3afe['offset'];var _0x583fd2=_0x5f4083?_0xb83add['count']:_0x2f3afe[_0x0411('0x1b')]+_0x2f3afe[_0x0411('0x1d')];var _0x438919;if(_0x583fd2>=_0xc26e2c){_0x583fd2=_0xc26e2c;_0x438919=0xc8;}else{_0x438919=0xce;}_0x58f416[_0x0411('0x19')](_0x438919);return _0x58f416[_0x0411('0x1e')](_0x0411('0x1f'),_0x1cb0b4+'-'+_0x583fd2+'/'+_0xc26e2c)[_0x0411('0x1a')](_0xb83add);}return null;};}function patchUpdates(_0x1dbb14){return function(_0xabc38d){try{jsonpatch[_0x0411('0x20')](_0xabc38d,_0x1dbb14,!![]);}catch(_0x1a118f){return BPromise[_0x0411('0x21')](_0x1a118f);}return _0xabc38d[_0x0411('0x22')]();};}function saveUpdates(_0x403508,_0x2c6a21){return function(_0x3c7212){if(_0x3c7212){return _0x3c7212[_0x0411('0x23')](_0x403508)['then'](function(_0x47d819){return _0x47d819;});}return null;};}function removeEntity(_0x260a44,_0x19b6fb){return function(_0x1d5b32){if(_0x1d5b32){return _0x1d5b32[_0x0411('0x24')]()[_0x0411('0x25')](function(){_0x260a44[_0x0411('0x19')](0xcc)[_0x0411('0x18')]();});}};}function handleEntityNotFound(_0x1d74be,_0x311f61){return function(_0x4a75e){if(!_0x4a75e){_0x1d74be[_0x0411('0x17')](0x194);}return _0x4a75e;};}function handleError(_0x258723,_0x2653db){_0x2653db=_0x2653db||0x1f4;return function(_0x392d8c){logger[_0x0411('0x26')](_0x392d8c['stack']);if(_0x392d8c[_0x0411('0x27')]){delete _0x392d8c[_0x0411('0x27')];}_0x258723[_0x0411('0x19')](_0x2653db)[_0x0411('0x28')](_0x392d8c);};}exports[_0x0411('0x29')]=function(_0x365630,_0xba302){var _0x48ae3b={},_0x394c37={},_0x474a32={'count':0x0,'rows':[]};var _0xc963ad=_[_0x0411('0x2a')](db[_0x0411('0x2b')][_0x0411('0x2c')],function(_0x49a266){return{'name':_0x49a266['fieldName'],'type':_0x49a266[_0x0411('0x2d')]['key']};});_0x394c37['model']=_['map'](_0xc963ad,_0x0411('0x27'));_0x394c37[_0x0411('0x2e')]=_[_0x0411('0x2f')](_0x365630[_0x0411('0x2e')]);_0x394c37[_0x0411('0x30')]=_[_0x0411('0x31')](_0x394c37[_0x0411('0x32')],_0x394c37['query']);_0x48ae3b[_0x0411('0x33')]=_[_0x0411('0x31')](_0x394c37[_0x0411('0x32')],qs[_0x0411('0x34')](_0x365630['query']['fields']));_0x48ae3b['attributes']=_0x48ae3b[_0x0411('0x33')][_0x0411('0x35')]?_0x48ae3b[_0x0411('0x33')]:_0x394c37[_0x0411('0x32')];if(!_0x365630[_0x0411('0x2e')][_0x0411('0x36')]('nolimit')){_0x48ae3b[_0x0411('0x1d')]=qs['limit'](_0x365630[_0x0411('0x2e')][_0x0411('0x1d')]);_0x48ae3b[_0x0411('0x1b')]=qs[_0x0411('0x1b')](_0x365630[_0x0411('0x2e')]['offset']);}_0x48ae3b[_0x0411('0x37')]=qs['sort'](_0x365630[_0x0411('0x2e')]['sort']);_0x48ae3b[_0x0411('0x38')]=qs[_0x0411('0x30')](_[_0x0411('0x39')](_0x365630[_0x0411('0x2e')],_0x394c37['filters']),_0xc963ad);if(_0x365630[_0x0411('0x2e')][_0x0411('0x3a')]){_0x48ae3b['where']=_[_0x0411('0x3b')](_0x48ae3b[_0x0411('0x38')],{'$or':_['map'](_0xc963ad,function(_0x36c8f2){if(_0x36c8f2['type']!=='VIRTUAL'){var _0x109c84={};_0x109c84[_0x36c8f2[_0x0411('0x27')]]={'$like':'%'+_0x365630[_0x0411('0x2e')][_0x0411('0x3a')]+'%'};return _0x109c84;}})});}_0x48ae3b=_['merge']({},_0x48ae3b,_0x365630[_0x0411('0x3c')]);var _0x563d63={'where':_0x48ae3b['where']};return db[_0x0411('0x2b')][_0x0411('0x3d')](_0x563d63)['then'](function(_0x144d10){_0x474a32['count']=_0x144d10;if(_0x365630[_0x0411('0x2e')][_0x0411('0x3e')]){_0x48ae3b['include']=[{'all':!![]}];}return db[_0x0411('0x2b')][_0x0411('0x3f')](_0x48ae3b);})[_0x0411('0x25')](function(_0x18442e){_0x474a32['rows']=_0x18442e;return _0x474a32;})['then'](respondWithFilteredResult(_0xba302,_0x48ae3b))[_0x0411('0x40')](handleError(_0xba302,null));};exports[_0x0411('0x41')]=function(_0x3d0e67,_0xb4eddf){var _0x5b4e21={'raw':!![],'where':{'id':_0x3d0e67[_0x0411('0x42')]['id']}},_0x5a4428={};_0x5a4428[_0x0411('0x32')]=_[_0x0411('0x2f')](db['MailServerOut']['rawAttributes']);_0x5a4428['query']=_['keys'](_0x3d0e67[_0x0411('0x2e')]);_0x5a4428[_0x0411('0x30')]=_[_0x0411('0x31')](_0x5a4428[_0x0411('0x32')],_0x5a4428[_0x0411('0x2e')]);_0x5b4e21['attributes']=_[_0x0411('0x31')](_0x5a4428[_0x0411('0x32')],qs[_0x0411('0x34')](_0x3d0e67[_0x0411('0x2e')][_0x0411('0x34')]));_0x5b4e21[_0x0411('0x33')]=_0x5b4e21[_0x0411('0x33')][_0x0411('0x35')]?_0x5b4e21['attributes']:_0x5a4428[_0x0411('0x32')];if(_0x3d0e67[_0x0411('0x2e')]['includeAll']){_0x5b4e21[_0x0411('0x43')]=[{'all':!![]}];}_0x5b4e21=_[_0x0411('0x3b')]({},_0x5b4e21,_0x3d0e67[_0x0411('0x3c')]);return db[_0x0411('0x2b')][_0x0411('0x44')](_0x5b4e21)[_0x0411('0x25')](handleEntityNotFound(_0xb4eddf,null))[_0x0411('0x25')](respondWithResult(_0xb4eddf,null))[_0x0411('0x40')](handleError(_0xb4eddf,null));};exports['create']=function(_0xe2be25,_0xf791e1){return db[_0x0411('0x2b')][_0x0411('0x45')](_0xe2be25[_0x0411('0x46')],{})['then'](respondWithResult(_0xf791e1,0xc9))[_0x0411('0x40')](handleError(_0xf791e1,null));};exports[_0x0411('0x23')]=function(_0x3dc23a,_0x2184b6){if(_0x3dc23a['body']['id']){delete _0x3dc23a['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x3dc23a[_0x0411('0x42')]['id']}})[_0x0411('0x25')](handleEntityNotFound(_0x2184b6,null))[_0x0411('0x25')](saveUpdates(_0x3dc23a['body'],null))['then'](respondWithResult(_0x2184b6,null))[_0x0411('0x40')](handleError(_0x2184b6,null));};exports[_0x0411('0x24')]=function(_0x23711a,_0x17fa4b){return db[_0x0411('0x2b')][_0x0411('0x44')]({'where':{'id':_0x23711a[_0x0411('0x42')]['id']}})[_0x0411('0x25')](handleEntityNotFound(_0x17fa4b,null))[_0x0411('0x25')](removeEntity(_0x17fa4b,null))[_0x0411('0x40')](handleError(_0x17fa4b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 931e0c0..6d4a095 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 _0x9dd7=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports'];(function(_0x2359f7,_0x5cc854){var _0x3900e8=function(_0x63f27f){while(--_0x63f27f){_0x2359f7['push'](_0x2359f7['shift']());}};_0x3900e8(++_0x5cc854);}(_0x9dd7,0x6e));var _0x79dd=function(_0x32c1c1,_0x371b1f){_0x32c1c1=_0x32c1c1-0x0;var _0x4d9a76=_0x9dd7[_0x32c1c1];return _0x4d9a76;};'use strict';var _=require(_0x79dd('0x0'));var util=require(_0x79dd('0x1'));var logger=require(_0x79dd('0x2'))(_0x79dd('0x3'));var moment=require(_0x79dd('0x4'));var BPromise=require(_0x79dd('0x5'));var rp=require(_0x79dd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79dd('0x7'));var config=require('../../config/environment');var attributes=require(_0x79dd('0x8'));module[_0x79dd('0x9')]=function(_0x3baab6,_0x46a4dc){return _0x3baab6['define'](_0x79dd('0xa'),attributes,{'tableName':_0x79dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cf3=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1bef7b,_0x38af42){var _0x16f6b3=function(_0x38bfd8){while(--_0x38bfd8){_0x1bef7b['push'](_0x1bef7b['shift']());}};_0x16f6b3(++_0x38af42);}(_0x3cf3,0x87));var _0x33cf=function(_0x5af799,_0x11d6e3){_0x5af799=_0x5af799-0x0;var _0x2683a6=_0x3cf3[_0x5af799];return _0x2683a6;};'use strict';var _=require(_0x33cf('0x0'));var util=require(_0x33cf('0x1'));var logger=require(_0x33cf('0x2'))(_0x33cf('0x3'));var moment=require(_0x33cf('0x4'));var BPromise=require(_0x33cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33cf('0x6'));var rimraf=require(_0x33cf('0x7'));var config=require(_0x33cf('0x8'));var attributes=require('./mailServerOut.attributes');module[_0x33cf('0x9')]=function(_0x1daaa5,_0x3ebda8){return _0x1daaa5[_0x33cf('0xa')](_0x33cf('0xb'),attributes,{'tableName':_0x33cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 7b17132..329acdb 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1c9d15,_0x1b619f){var _0x3b20b3=function(_0x110099){while(--_0x110099){_0x1c9d15['push'](_0x1c9d15['shift']());}};_0x3b20b3(++_0x1b619f);}(_0xdb28,0x106));var _0x8db2=function(_0x342658,_0x1602d7){_0x342658=_0x342658-0x0;var _0x4b7241=_0xdb28[_0x342658];return _0x4b7241;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5d6fcb,_0x4d66ce){var _0x159713=function(_0x4d0634){while(--_0x4d0634){_0x5d6fcb['push'](_0x5d6fcb['shift']());}};_0x159713(++_0x4d66ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2daaf3,_0x1d714b){_0x2daaf3=_0x2daaf3-0x0;var _0x5850c8=_0x5f2f[_0x2daaf3];return _0x5850c8;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 387e7a2..dc2c8fb 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 _0xf85c=['post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf85c,0x145));var _0xcf85=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xf85c[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var path=require(_0xcf85('0x2'));var timeout=require(_0xcf85('0x3'));var express=require('express');var router=express[_0xcf85('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcf85('0x5'));var config=require(_0xcf85('0x6'));var controller=require(_0xcf85('0x7'));router[_0xcf85('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf85('0x9')]);router[_0xcf85('0x8')](_0xcf85('0xa'),auth[_0xcf85('0xb')](),controller[_0xcf85('0xc')]);router['get'](_0xcf85('0xd'),auth[_0xcf85('0xb')](),controller[_0xcf85('0xe')]);router[_0xcf85('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcf85('0x10')]('/:id',auth[_0xcf85('0xb')](),controller[_0xcf85('0x11')]);router['delete'](_0xcf85('0xd'),auth[_0xcf85('0xb')](),controller[_0xcf85('0x12')]);module[_0xcf85('0x13')]=router; \ No newline at end of file +var _0xc092=['../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','util','path','express','fs-extra'];(function(_0x15ab2d,_0x8b0531){var _0xa3837d=function(_0x25a964){while(--_0x25a964){_0x15ab2d['push'](_0x15ab2d['shift']());}};_0xa3837d(++_0x8b0531);}(_0xc092,0x1ec));var _0x2c09=function(_0x346dd1,_0x373339){_0x346dd1=_0x346dd1-0x0;var _0x3fd02e=_0xc092[_0x346dd1];return _0x3fd02e;};'use strict';var multer=require('multer');var util=require(_0x2c09('0x0'));var path=require(_0x2c09('0x1'));var timeout=require('connect-timeout');var express=require(_0x2c09('0x2'));var router=express['Router']();var fs_extra=require(_0x2c09('0x3'));var auth=require(_0x2c09('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c09('0x5'));var controller=require('./mailSubstatus.controller');router[_0x2c09('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c09('0x6')]('/describe',auth[_0x2c09('0x7')](),controller[_0x2c09('0x8')]);router[_0x2c09('0x6')](_0x2c09('0x9'),auth['isAuthenticated'](),controller[_0x2c09('0xa')]);router[_0x2c09('0xb')]('/',auth[_0x2c09('0x7')](),controller[_0x2c09('0xc')]);router[_0x2c09('0xd')](_0x2c09('0x9'),auth['isAuthenticated'](),controller[_0x2c09('0xe')]);router[_0x2c09('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 15461a3..cc3c025 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 _0xdbb1=['STRING','sequelize'];(function(_0x50a1cf,_0x3b8060){var _0x1b3ecf=function(_0x15add6){while(--_0x15add6){_0x50a1cf['push'](_0x50a1cf['shift']());}};_0x1b3ecf(++_0x3b8060);}(_0xdbb1,0x105));var _0x1dbb=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdbb1[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0x1dbb('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1dbb('0x1')]}}; \ No newline at end of file +var _0xf767=['name','exports','STRING'];(function(_0x3296c3,_0xc96c4a){var _0x1fb66a=function(_0xa92688){while(--_0xa92688){_0x3296c3['push'](_0x3296c3['shift']());}};_0x1fb66a(++_0xc96c4a);}(_0xf767,0x76));var _0x7f76=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xf767[_0x3cb3ca];return _0x214366;};'use strict';var Sequelize=require('sequelize');module[_0x7f76('0x0')]={'name':{'type':Sequelize[_0x7f76('0x1')],'unique':_0x7f76('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f76('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ffb1a7b..a1b9220 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 _0x0c9a=['crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','where','filters','filter','merge','type','VIRTUAL','options','MailSubstatus','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x379ee5,_0x336c42){var _0x114694=function(_0x55b2f5){while(--_0x55b2f5){_0x379ee5['push'](_0x379ee5['shift']());}};_0x114694(++_0x336c42);}(_0x0c9a,0x15f));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa0c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0c9('0x1'));var jsonpatch=require(_0xa0c9('0x2'));var rp=require('request-promise');var moment=require(_0xa0c9('0x3'));var BPromise=require(_0xa0c9('0x4'));var Mustache=require(_0xa0c9('0x5'));var util=require(_0xa0c9('0x6'));var path=require(_0xa0c9('0x7'));var sox=require(_0xa0c9('0x8'));var csv=require(_0xa0c9('0x9'));var ejs=require(_0xa0c9('0xa'));var fs=require('fs');var fs_extra=require(_0xa0c9('0xb'));var _=require(_0xa0c9('0xc'));var squel=require(_0xa0c9('0xd'));var crypto=require(_0xa0c9('0xe'));var jsforce=require(_0xa0c9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa0c9('0x9'));var querystring=require(_0xa0c9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa0c9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0c9('0x12'));var logger=require('../../config/logger')(_0xa0c9('0x13'));var utils=require('../../config/utils');var config=require(_0xa0c9('0x14'));var licenseUtil=require(_0xa0c9('0x15'));var db=require(_0xa0c9('0x16'))['db'];function respondWithStatusCode(_0x5b65e9,_0xa6db84){_0xa6db84=_0xa6db84||0xcc;return function(_0x85247){if(_0x85247){return _0x5b65e9[_0xa0c9('0x17')](_0xa6db84);}return _0x5b65e9[_0xa0c9('0x18')](_0xa6db84)[_0xa0c9('0x19')]();};}function respondWithResult(_0xa3cfe8,_0x15b775){_0x15b775=_0x15b775||0xc8;return function(_0x4fbab0){if(_0x4fbab0){return _0xa3cfe8[_0xa0c9('0x18')](_0x15b775)[_0xa0c9('0x1a')](_0x4fbab0);}};}function respondWithFilteredResult(_0x1f7138,_0x4c3a92){return function(_0x482881){if(_0x482881){var _0x5c254d=typeof _0x4c3a92[_0xa0c9('0x1b')]===_0xa0c9('0x1c')&&typeof _0x4c3a92[_0xa0c9('0x1d')]==='undefined';var _0xdcbd51=_0x482881['count'];var _0xd0f43b=_0x5c254d?0x0:_0x4c3a92[_0xa0c9('0x1b')];var _0x20cc5d=_0x5c254d?_0x482881['count']:_0x4c3a92[_0xa0c9('0x1b')]+_0x4c3a92['limit'];var _0x31b824;if(_0x20cc5d>=_0xdcbd51){_0x20cc5d=_0xdcbd51;_0x31b824=0xc8;}else{_0x31b824=0xce;}_0x1f7138[_0xa0c9('0x18')](_0x31b824);return _0x1f7138[_0xa0c9('0x1e')](_0xa0c9('0x1f'),_0xd0f43b+'-'+_0x20cc5d+'/'+_0xdcbd51)['json'](_0x482881);}return null;};}function patchUpdates(_0x379bb3){return function(_0x8808ac){try{jsonpatch[_0xa0c9('0x20')](_0x8808ac,_0x379bb3,!![]);}catch(_0x200f04){return BPromise['reject'](_0x200f04);}return _0x8808ac[_0xa0c9('0x21')]();};}function saveUpdates(_0x47ed7e,_0x1ff42d){return function(_0x2231b6){if(_0x2231b6){return _0x2231b6[_0xa0c9('0x22')](_0x47ed7e)[_0xa0c9('0x23')](function(_0x30aea6){return _0x30aea6;});}return null;};}function removeEntity(_0x5780f1,_0x4f3f82){return function(_0x4cd90a){if(_0x4cd90a){return _0x4cd90a[_0xa0c9('0x24')]()[_0xa0c9('0x23')](function(){_0x5780f1[_0xa0c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa853,_0x1714ec){return function(_0x1ba584){if(!_0x1ba584){_0x4fa853[_0xa0c9('0x17')](0x194);}return _0x1ba584;};}function handleError(_0x222136,_0x2dfe12){_0x2dfe12=_0x2dfe12||0x1f4;return function(_0x180c14){logger[_0xa0c9('0x25')](_0x180c14[_0xa0c9('0x26')]);if(_0x180c14[_0xa0c9('0x27')]){delete _0x180c14['name'];}_0x222136[_0xa0c9('0x18')](_0x2dfe12)['send'](_0x180c14);};}exports[_0xa0c9('0x28')]=function(_0x45f808,_0x550b3c){var _0x5c60fd={},_0x519b03={},_0x92bbb7={'count':0x0,'rows':[]};var _0x42eab5=_[_0xa0c9('0x29')](db['MailSubstatus'][_0xa0c9('0x2a')],function(_0x48a4cf){return{'name':_0x48a4cf[_0xa0c9('0x2b')],'type':_0x48a4cf['type']['key']};});_0x519b03[_0xa0c9('0x2c')]=_[_0xa0c9('0x29')](_0x42eab5,_0xa0c9('0x27'));_0x519b03[_0xa0c9('0x2d')]=_[_0xa0c9('0x2e')](_0x45f808[_0xa0c9('0x2d')]);_0x519b03['filters']=_['intersection'](_0x519b03[_0xa0c9('0x2c')],_0x519b03[_0xa0c9('0x2d')]);_0x5c60fd[_0xa0c9('0x2f')]=_[_0xa0c9('0x30')](_0x519b03[_0xa0c9('0x2c')],qs[_0xa0c9('0x31')](_0x45f808[_0xa0c9('0x2d')][_0xa0c9('0x31')]));_0x5c60fd[_0xa0c9('0x2f')]=_0x5c60fd[_0xa0c9('0x2f')][_0xa0c9('0x32')]?_0x5c60fd[_0xa0c9('0x2f')]:_0x519b03[_0xa0c9('0x2c')];if(!_0x45f808['query']['hasOwnProperty'](_0xa0c9('0x33'))){_0x5c60fd[_0xa0c9('0x1d')]=qs['limit'](_0x45f808[_0xa0c9('0x2d')][_0xa0c9('0x1d')]);_0x5c60fd[_0xa0c9('0x1b')]=qs[_0xa0c9('0x1b')](_0x45f808[_0xa0c9('0x2d')][_0xa0c9('0x1b')]);}_0x5c60fd[_0xa0c9('0x34')]=qs['sort'](_0x45f808[_0xa0c9('0x2d')]['sort']);_0x5c60fd[_0xa0c9('0x35')]=qs[_0xa0c9('0x36')](_['pick'](_0x45f808[_0xa0c9('0x2d')],_0x519b03['filters']),_0x42eab5);if(_0x45f808[_0xa0c9('0x2d')][_0xa0c9('0x37')]){_0x5c60fd[_0xa0c9('0x35')]=_[_0xa0c9('0x38')](_0x5c60fd[_0xa0c9('0x35')],{'$or':_[_0xa0c9('0x29')](_0x42eab5,function(_0x5a00b5){if(_0x5a00b5[_0xa0c9('0x39')]!==_0xa0c9('0x3a')){var _0x48f79={};_0x48f79[_0x5a00b5[_0xa0c9('0x27')]]={'$like':'%'+_0x45f808['query'][_0xa0c9('0x37')]+'%'};return _0x48f79;}})});}_0x5c60fd=_[_0xa0c9('0x38')]({},_0x5c60fd,_0x45f808[_0xa0c9('0x3b')]);var _0x5f5c3b={'where':_0x5c60fd[_0xa0c9('0x35')]};return db[_0xa0c9('0x3c')][_0xa0c9('0x3d')](_0x5f5c3b)[_0xa0c9('0x23')](function(_0x4cd36b){_0x92bbb7[_0xa0c9('0x3d')]=_0x4cd36b;if(_0x45f808[_0xa0c9('0x2d')][_0xa0c9('0x3e')]){_0x5c60fd[_0xa0c9('0x3f')]=[{'all':!![]}];}return db[_0xa0c9('0x3c')][_0xa0c9('0x40')](_0x5c60fd);})[_0xa0c9('0x23')](function(_0x29153f){_0x92bbb7[_0xa0c9('0x41')]=_0x29153f;return _0x92bbb7;})[_0xa0c9('0x23')](respondWithFilteredResult(_0x550b3c,_0x5c60fd))['catch'](handleError(_0x550b3c,null));};exports[_0xa0c9('0x42')]=function(_0x558520,_0x5879bc){var _0x5cc292={'raw':!![],'where':{'id':_0x558520[_0xa0c9('0x43')]['id']}},_0x42d260={};_0x42d260[_0xa0c9('0x2c')]=_[_0xa0c9('0x2e')](db[_0xa0c9('0x3c')][_0xa0c9('0x2a')]);_0x42d260['query']=_['keys'](_0x558520['query']);_0x42d260[_0xa0c9('0x36')]=_['intersection'](_0x42d260[_0xa0c9('0x2c')],_0x42d260[_0xa0c9('0x2d')]);_0x5cc292[_0xa0c9('0x2f')]=_['intersection'](_0x42d260[_0xa0c9('0x2c')],qs[_0xa0c9('0x31')](_0x558520['query']['fields']));_0x5cc292[_0xa0c9('0x2f')]=_0x5cc292[_0xa0c9('0x2f')]['length']?_0x5cc292['attributes']:_0x42d260[_0xa0c9('0x2c')];if(_0x558520['query'][_0xa0c9('0x3e')]){_0x5cc292['include']=[{'all':!![]}];}_0x5cc292=_['merge']({},_0x5cc292,_0x558520['options']);return db[_0xa0c9('0x3c')][_0xa0c9('0x44')](_0x5cc292)[_0xa0c9('0x23')](handleEntityNotFound(_0x5879bc,null))[_0xa0c9('0x23')](respondWithResult(_0x5879bc,null))['catch'](handleError(_0x5879bc,null));};exports[_0xa0c9('0x45')]=function(_0x2b310c,_0x3d1e94){return db['MailSubstatus'][_0xa0c9('0x45')](_0x2b310c[_0xa0c9('0x46')],{})[_0xa0c9('0x23')](respondWithResult(_0x3d1e94,0xc9))['catch'](handleError(_0x3d1e94,null));};exports['update']=function(_0x50e375,_0x4e7927){if(_0x50e375['body']['id']){delete _0x50e375[_0xa0c9('0x46')]['id'];}return db[_0xa0c9('0x3c')][_0xa0c9('0x44')]({'where':{'id':_0x50e375[_0xa0c9('0x43')]['id']}})[_0xa0c9('0x23')](handleEntityNotFound(_0x4e7927,null))[_0xa0c9('0x23')](saveUpdates(_0x50e375[_0xa0c9('0x46')],null))[_0xa0c9('0x23')](respondWithResult(_0x4e7927,null))['catch'](handleError(_0x4e7927,null));};exports[_0xa0c9('0x24')]=function(_0x2f2841,_0x247a99){return db[_0xa0c9('0x3c')][_0xa0c9('0x44')]({'where':{'id':_0x2f2841['params']['id']}})[_0xa0c9('0x23')](handleEntityNotFound(_0x247a99,null))[_0xa0c9('0x23')](removeEntity(_0x247a99,null))[_0xa0c9('0x47')](handleError(_0x247a99,null));};exports[_0xa0c9('0x48')]=function(_0x1c0935,_0x37c838){return db[_0xa0c9('0x3c')][_0xa0c9('0x48')]()[_0xa0c9('0x23')](respondWithResult(_0x37c838,null))[_0xa0c9('0x47')](handleError(_0x37c838,null));}; \ No newline at end of file +var _0x23ad=['findAll','rows','catch','params','keys','includeAll','options','find','create','body','update','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','then','destroy','sendStatus','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include'];(function(_0x40e5e7,_0x5de9fb){var _0x305d7b=function(_0x1f10cd){while(--_0x1f10cd){_0x40e5e7['push'](_0x40e5e7['shift']());}};_0x305d7b(++_0x5de9fb);}(_0x23ad,0x140));var _0xd23a=function(_0x6445e1,_0x7fe5a6){_0x6445e1=_0x6445e1-0x0;var _0x48fad5=_0x23ad[_0x6445e1];return _0x48fad5;};'use strict';var emlformat=require(_0xd23a('0x0'));var rimraf=require(_0xd23a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd23a('0x2'));var rp=require(_0xd23a('0x3'));var moment=require(_0xd23a('0x4'));var BPromise=require(_0xd23a('0x5'));var Mustache=require(_0xd23a('0x6'));var util=require(_0xd23a('0x7'));var path=require(_0xd23a('0x8'));var sox=require(_0xd23a('0x9'));var csv=require(_0xd23a('0xa'));var ejs=require(_0xd23a('0xb'));var fs=require('fs');var fs_extra=require(_0xd23a('0xc'));var _=require(_0xd23a('0xd'));var squel=require(_0xd23a('0xe'));var crypto=require(_0xd23a('0xf'));var jsforce=require(_0xd23a('0x10'));var deskjs=require(_0xd23a('0x11'));var toCsv=require(_0xd23a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd23a('0x12'));var authService=require(_0xd23a('0x13'));var qs=require(_0xd23a('0x14'));var as=require(_0xd23a('0x15'));var hardwareService=require(_0xd23a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd23a('0x17'));var config=require(_0xd23a('0x18'));var licenseUtil=require(_0xd23a('0x19'));var db=require(_0xd23a('0x1a'))['db'];function respondWithStatusCode(_0x1b38b4,_0x3651f7){_0x3651f7=_0x3651f7||0xcc;return function(_0x44def0){if(_0x44def0){return _0x1b38b4['sendStatus'](_0x3651f7);}return _0x1b38b4[_0xd23a('0x1b')](_0x3651f7)[_0xd23a('0x1c')]();};}function respondWithResult(_0x526c2f,_0x2463ae){_0x2463ae=_0x2463ae||0xc8;return function(_0x15dc08){if(_0x15dc08){return _0x526c2f[_0xd23a('0x1b')](_0x2463ae)['json'](_0x15dc08);}};}function respondWithFilteredResult(_0x789bfc,_0x4fe94e){return function(_0x12f824){if(_0x12f824){var _0x47b0aa=typeof _0x4fe94e[_0xd23a('0x1d')]===_0xd23a('0x1e')&&typeof _0x4fe94e[_0xd23a('0x1f')]===_0xd23a('0x1e');var _0x4d3706=_0x12f824[_0xd23a('0x20')];var _0x187e2f=_0x47b0aa?0x0:_0x4fe94e[_0xd23a('0x1d')];var _0x1e579c=_0x47b0aa?_0x12f824['count']:_0x4fe94e[_0xd23a('0x1d')]+_0x4fe94e[_0xd23a('0x1f')];var _0x5caa19;if(_0x1e579c>=_0x4d3706){_0x1e579c=_0x4d3706;_0x5caa19=0xc8;}else{_0x5caa19=0xce;}_0x789bfc[_0xd23a('0x1b')](_0x5caa19);return _0x789bfc[_0xd23a('0x21')](_0xd23a('0x22'),_0x187e2f+'-'+_0x1e579c+'/'+_0x4d3706)[_0xd23a('0x23')](_0x12f824);}return null;};}function patchUpdates(_0x26494b){return function(_0x376731){try{jsonpatch['apply'](_0x376731,_0x26494b,!![]);}catch(_0x5392a8){return BPromise[_0xd23a('0x24')](_0x5392a8);}return _0x376731['save']();};}function saveUpdates(_0x45001b,_0x2896b0){return function(_0x594266){if(_0x594266){return _0x594266['update'](_0x45001b)[_0xd23a('0x25')](function(_0x52976c){return _0x52976c;});}return null;};}function removeEntity(_0x3ec38e,_0x3705ef){return function(_0x5beee5){if(_0x5beee5){return _0x5beee5[_0xd23a('0x26')]()[_0xd23a('0x25')](function(){_0x3ec38e[_0xd23a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53a48d,_0x2e79a9){return function(_0x1d182a){if(!_0x1d182a){_0x53a48d[_0xd23a('0x27')](0x194);}return _0x1d182a;};}function handleError(_0x47ec97,_0x41120c){_0x41120c=_0x41120c||0x1f4;return function(_0x124c37){logger[_0xd23a('0x28')](_0x124c37['stack']);if(_0x124c37[_0xd23a('0x29')]){delete _0x124c37[_0xd23a('0x29')];}_0x47ec97[_0xd23a('0x1b')](_0x41120c)[_0xd23a('0x2a')](_0x124c37);};}exports[_0xd23a('0x2b')]=function(_0x273987,_0x55499d){var _0x1ad182={},_0x1bc690={},_0x5be0ab={'count':0x0,'rows':[]};var _0x1be0ad=_[_0xd23a('0x2c')](db[_0xd23a('0x2d')][_0xd23a('0x2e')],function(_0x4be8ad){return{'name':_0x4be8ad[_0xd23a('0x2f')],'type':_0x4be8ad[_0xd23a('0x30')]['key']};});_0x1bc690['model']=_[_0xd23a('0x2c')](_0x1be0ad,_0xd23a('0x29'));_0x1bc690[_0xd23a('0x31')]=_['keys'](_0x273987[_0xd23a('0x31')]);_0x1bc690[_0xd23a('0x32')]=_['intersection'](_0x1bc690[_0xd23a('0x33')],_0x1bc690[_0xd23a('0x31')]);_0x1ad182['attributes']=_[_0xd23a('0x34')](_0x1bc690[_0xd23a('0x33')],qs[_0xd23a('0x35')](_0x273987[_0xd23a('0x31')][_0xd23a('0x35')]));_0x1ad182[_0xd23a('0x36')]=_0x1ad182[_0xd23a('0x36')][_0xd23a('0x37')]?_0x1ad182[_0xd23a('0x36')]:_0x1bc690[_0xd23a('0x33')];if(!_0x273987[_0xd23a('0x31')][_0xd23a('0x38')]('nolimit')){_0x1ad182[_0xd23a('0x1f')]=qs[_0xd23a('0x1f')](_0x273987[_0xd23a('0x31')][_0xd23a('0x1f')]);_0x1ad182[_0xd23a('0x1d')]=qs[_0xd23a('0x1d')](_0x273987['query'][_0xd23a('0x1d')]);}_0x1ad182[_0xd23a('0x39')]=qs[_0xd23a('0x3a')](_0x273987[_0xd23a('0x31')][_0xd23a('0x3a')]);_0x1ad182['where']=qs['filters'](_[_0xd23a('0x3b')](_0x273987[_0xd23a('0x31')],_0x1bc690[_0xd23a('0x32')]),_0x1be0ad);if(_0x273987[_0xd23a('0x31')][_0xd23a('0x3c')]){_0x1ad182[_0xd23a('0x3d')]=_[_0xd23a('0x3e')](_0x1ad182['where'],{'$or':_[_0xd23a('0x2c')](_0x1be0ad,function(_0x411fb1){if(_0x411fb1[_0xd23a('0x30')]!==_0xd23a('0x3f')){var _0x3a67af={};_0x3a67af[_0x411fb1['name']]={'$like':'%'+_0x273987[_0xd23a('0x31')][_0xd23a('0x3c')]+'%'};return _0x3a67af;}})});}_0x1ad182=_[_0xd23a('0x3e')]({},_0x1ad182,_0x273987['options']);var _0x8f4dce={'where':_0x1ad182['where']};return db[_0xd23a('0x2d')][_0xd23a('0x20')](_0x8f4dce)[_0xd23a('0x25')](function(_0x313d57){_0x5be0ab[_0xd23a('0x20')]=_0x313d57;if(_0x273987[_0xd23a('0x31')]['includeAll']){_0x1ad182[_0xd23a('0x40')]=[{'all':!![]}];}return db[_0xd23a('0x2d')][_0xd23a('0x41')](_0x1ad182);})[_0xd23a('0x25')](function(_0x433ada){_0x5be0ab[_0xd23a('0x42')]=_0x433ada;return _0x5be0ab;})[_0xd23a('0x25')](respondWithFilteredResult(_0x55499d,_0x1ad182))[_0xd23a('0x43')](handleError(_0x55499d,null));};exports['show']=function(_0x262922,_0x33ced2){var _0x10da13={'raw':!![],'where':{'id':_0x262922[_0xd23a('0x44')]['id']}},_0x40d97c={};_0x40d97c[_0xd23a('0x33')]=_[_0xd23a('0x45')](db[_0xd23a('0x2d')][_0xd23a('0x2e')]);_0x40d97c[_0xd23a('0x31')]=_[_0xd23a('0x45')](_0x262922[_0xd23a('0x31')]);_0x40d97c[_0xd23a('0x32')]=_[_0xd23a('0x34')](_0x40d97c[_0xd23a('0x33')],_0x40d97c[_0xd23a('0x31')]);_0x10da13['attributes']=_[_0xd23a('0x34')](_0x40d97c[_0xd23a('0x33')],qs[_0xd23a('0x35')](_0x262922['query'][_0xd23a('0x35')]));_0x10da13[_0xd23a('0x36')]=_0x10da13[_0xd23a('0x36')]['length']?_0x10da13[_0xd23a('0x36')]:_0x40d97c['model'];if(_0x262922[_0xd23a('0x31')][_0xd23a('0x46')]){_0x10da13[_0xd23a('0x40')]=[{'all':!![]}];}_0x10da13=_[_0xd23a('0x3e')]({},_0x10da13,_0x262922[_0xd23a('0x47')]);return db[_0xd23a('0x2d')][_0xd23a('0x48')](_0x10da13)[_0xd23a('0x25')](handleEntityNotFound(_0x33ced2,null))[_0xd23a('0x25')](respondWithResult(_0x33ced2,null))[_0xd23a('0x43')](handleError(_0x33ced2,null));};exports[_0xd23a('0x49')]=function(_0x1c3654,_0x3d9598){return db[_0xd23a('0x2d')][_0xd23a('0x49')](_0x1c3654[_0xd23a('0x4a')],{})['then'](respondWithResult(_0x3d9598,0xc9))[_0xd23a('0x43')](handleError(_0x3d9598,null));};exports[_0xd23a('0x4b')]=function(_0x2d8290,_0x15bae9){if(_0x2d8290[_0xd23a('0x4a')]['id']){delete _0x2d8290[_0xd23a('0x4a')]['id'];}return db[_0xd23a('0x2d')][_0xd23a('0x48')]({'where':{'id':_0x2d8290[_0xd23a('0x44')]['id']}})[_0xd23a('0x25')](handleEntityNotFound(_0x15bae9,null))[_0xd23a('0x25')](saveUpdates(_0x2d8290[_0xd23a('0x4a')],null))[_0xd23a('0x25')](respondWithResult(_0x15bae9,null))[_0xd23a('0x43')](handleError(_0x15bae9,null));};exports[_0xd23a('0x26')]=function(_0x57dafa,_0x2a1e6b){return db[_0xd23a('0x2d')][_0xd23a('0x48')]({'where':{'id':_0x57dafa['params']['id']}})[_0xd23a('0x25')](handleEntityNotFound(_0x2a1e6b,null))[_0xd23a('0x25')](removeEntity(_0x2a1e6b,null))[_0xd23a('0x43')](handleError(_0x2a1e6b,null));};exports[_0xd23a('0x4c')]=function(_0x5ef5f0,_0xf37b43){return db['MailSubstatus'][_0xd23a('0x4c')]()['then'](respondWithResult(_0xf37b43,null))['catch'](handleError(_0xf37b43,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 791be51..7fa2d15 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8752=['events','MailSubstatus','hook','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8752,0x168));var _0x2875=function(_0x2eb326,_0x2d3894){_0x2eb326=_0x2eb326-0x0;var _0x427655=_0x8752[_0x2eb326];return _0x427655;};'use strict';var EventEmitter=require(_0x2875('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x2875('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x563776){return function(_0x19b4aa,_0x4041ee,_0x5b58ad){MailSubstatusEvents['emit'](_0x563776+':'+_0x19b4aa['id'],_0x19b4aa);MailSubstatusEvents['emit'](_0x563776,_0x19b4aa);_0x5b58ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x2875('0x2')](e,emitEvent(event));}}module[_0x2875('0x3')]=MailSubstatusEvents; \ No newline at end of file +var _0xe413=['exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2036c4,_0x4b19d5){var _0x4ca2df=function(_0x389ff4){while(--_0x389ff4){_0x2036c4['push'](_0x2036c4['shift']());}};_0x4ca2df(++_0x4b19d5);}(_0xe413,0xef));var _0x3e41=function(_0x68dfc9,_0x2cde8d){_0x68dfc9=_0x68dfc9-0x0;var _0x206a6f=_0xe413[_0x68dfc9];return _0x206a6f;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3e41('0x0'))['db'][_0x3e41('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3e41('0x2')](0x0);var events={'afterUpdate':_0x3e41('0x3')};function emitEvent(_0x2f08a3){return function(_0x3bf94a,_0x269f96,_0x3ddefb){MailSubstatusEvents[_0x3e41('0x4')](_0x2f08a3+':'+_0x3bf94a['id'],_0x3bf94a);MailSubstatusEvents[_0x3e41('0x4')](_0x2f08a3,_0x3bf94a);_0x3ddefb(null);};}for(var e in events){if(events[_0x3e41('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x3e41('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4877155..31887e9 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 _0x05d7=['./mailSubstatus.attributes','exports','models','define','Condition','update','name','then'];(function(_0x54aea8,_0x371aa6){var _0x21991c=function(_0x83e180){while(--_0x83e180){_0x54aea8['push'](_0x54aea8['shift']());}};_0x21991c(++_0x371aa6);}(_0x05d7,0x180));var _0x705d=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x05d7[_0x50a0c2];return _0x5ebadd;};'use strict';var attributes=require(_0x705d('0x0'));module[_0x705d('0x1')]=function(_0x46de7e){var _0x10c408=_0x46de7e[_0x705d('0x2')];return _0x46de7e[_0x705d('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xac4818,_0x516034,_0x103452){return _0x10c408[_0x705d('0x4')][_0x705d('0x5')]({'value':_0xac4818[_0x705d('0x6')]},{'where':{'field':'mailSubstatus','value':_0xac4818['_previousDataValues'][_0x705d('0x6')]}})[_0x705d('0x7')](function(){_0x103452();})['catch'](function(_0x5a78c7){_0x103452(_0x5a78c7);});}}});}; \ No newline at end of file +var _0xdffb=['_previousDataValues','name','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xdffb,0x148));var _0xbdff=function(_0x198c1d,_0x1cf839){_0x198c1d=_0x198c1d-0x0;var _0x3f552d=_0xdffb[_0x198c1d];return _0x3f552d;};'use strict';var attributes=require(_0xbdff('0x0'));module['exports']=function(_0x4d0c5d){var _0x574b1f=_0x4d0c5d[_0xbdff('0x1')];return _0x4d0c5d[_0xbdff('0x2')](_0xbdff('0x3'),attributes,{'tableName':_0xbdff('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4ee52b,_0x364fb8,_0x561cc4){return _0x574b1f[_0xbdff('0x5')][_0xbdff('0x6')]({'value':_0x4ee52b['name']},{'where':{'field':_0xbdff('0x7'),'value':_0x4ee52b[_0xbdff('0x8')][_0xbdff('0x9')]}})[_0xbdff('0xa')](function(){_0x561cc4();})[_0xbdff('0xb')](function(_0x8e1743){_0x561cc4(_0x8e1743);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 616ea68..fde06a7 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 _0x2691=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3391fb,_0x3b405d){var _0x2ba732=function(_0x204f30){while(--_0x204f30){_0x3391fb['push'](_0x3391fb['shift']());}};_0x2ba732(++_0x3b405d);}(_0x2691,0x132));var _0x1269=function(_0x39bff3,_0x5e4143){_0x39bff3=_0x39bff3-0x0;var _0x180813=_0x2691[_0x39bff3];return _0x180813;};'use strict';var _=require(_0x1269('0x0'));var util=require(_0x1269('0x1'));var moment=require(_0x1269('0x2'));var BPromise=require(_0x1269('0x3'));var rs=require(_0x1269('0x4'));var fs=require('fs');var Redis=require(_0x1269('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1269('0x6'));var logger=require(_0x1269('0x7'))(_0x1269('0x8'));var config=require(_0x1269('0x9'));var jayson=require(_0x1269('0xa'));var client=jayson[_0x1269('0xb')][_0x1269('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5aa5fa,_0x594b71,_0x109b11){return new BPromise(function(_0x16ea05,_0x427988){return client[_0x1269('0xd')](_0x5aa5fa,_0x109b11)[_0x1269('0xe')](function(_0x21821e){logger[_0x1269('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x594b71,'request\x20sent');logger[_0x1269('0x10')](_0x1269('0x11'),_0x594b71,_0x1269('0x12'),JSON[_0x1269('0x13')](_0x21821e));if(_0x21821e[_0x1269('0x14')]){if(_0x21821e[_0x1269('0x14')][_0x1269('0x15')]===0x1f4){logger['error'](_0x1269('0x16'),_0x594b71,_0x21821e['error']['message']);return _0x427988(_0x21821e[_0x1269('0x14')][_0x1269('0x17')]);}logger[_0x1269('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x594b71,_0x21821e[_0x1269('0x14')][_0x1269('0x17')]);return _0x16ea05(_0x21821e[_0x1269('0x14')][_0x1269('0x17')]);}else{logger[_0x1269('0xf')](_0x1269('0x16'),_0x594b71,_0x1269('0x12'));_0x16ea05(_0x21821e[_0x1269('0x18')][_0x1269('0x17')]);}})[_0x1269('0x19')](function(_0x23a9e2){logger[_0x1269('0x14')](_0x1269('0x16'),_0x594b71,_0x23a9e2);_0x427988(_0x23a9e2);});});} \ No newline at end of file +var _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x2c452d,_0xfc5f07){var _0x4fd915=function(_0x42f23b){while(--_0x42f23b){_0x2c452d['push'](_0x2c452d['shift']());}};_0x4fd915(++_0xfc5f07);}(_0x4b19,0x195));var _0x94b1=function(_0x5e0823,_0x146024){_0x5e0823=_0x5e0823-0x0;var _0x592fbb=_0x4b19[_0x5e0823];return _0x592fbb;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 34144ca..49c1713 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 _0xda50=['express','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0xda50,0x69));var _0x0da5=function(_0x43c96e,_0x41c47f){_0x43c96e=_0x43c96e-0x0;var _0x3d287e=_0xda50[_0x43c96e];return _0x3d287e;};'use strict';var multer=require(_0x0da5('0x0'));var util=require('util');var path=require(_0x0da5('0x1'));var timeout=require(_0x0da5('0x2'));var express=require(_0x0da5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0da5('0x4'));var config=require(_0x0da5('0x5'));var controller=require(_0x0da5('0x6'));router[_0x0da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x0da5('0x8')]);router[_0x0da5('0x7')](_0x0da5('0x9'),auth[_0x0da5('0xa')](),controller[_0x0da5('0xb')]);router[_0x0da5('0x7')](_0x0da5('0xc'),auth[_0x0da5('0xa')](),controller['show']);router[_0x0da5('0xd')]('/',auth[_0x0da5('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0da5('0xe')]);router[_0x0da5('0xf')](_0x0da5('0xc'),auth[_0x0da5('0xa')](),controller[_0x0da5('0x10')]);module[_0x0da5('0x11')]=router; \ No newline at end of file +var _0x06a5=['exports','util','path','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x06a5,0xd1));var _0x506a=function(_0xe61708,_0x220364){_0xe61708=_0xe61708-0x0;var _0x2b5c8a=_0x06a5[_0xe61708];return _0x2b5c8a;};'use strict';var multer=require('multer');var util=require(_0x506a('0x0'));var path=require(_0x506a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x506a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x506a('0x3'));var controller=require(_0x506a('0x4'));router[_0x506a('0x5')]('/',auth[_0x506a('0x6')](),controller['index']);router['get']('/describe',auth[_0x506a('0x6')](),controller[_0x506a('0x7')]);router[_0x506a('0x5')](_0x506a('0x8'),auth['isAuthenticated'](),controller[_0x506a('0x9')]);router['post']('/',auth[_0x506a('0x6')](),controller['create']);router[_0x506a('0xa')](_0x506a('0x8'),auth[_0x506a('0x6')](),controller[_0x506a('0xb')]);router['delete'](_0x506a('0x8'),auth[_0x506a('0x6')](),controller['destroy']);module[_0x506a('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4572ca5..cda68e1 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x126c14,_0x4790a8){var _0x5c53dc=function(_0x64c949){while(--_0x64c949){_0x126c14['push'](_0x126c14['shift']());}};_0x5c53dc(++_0x4790a8);}(_0x008c,0x188));var _0xc008=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x008c[_0x1be3b3];return _0x4f8b2d;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5b6fdc,_0x3c045d){_0x5b6fdc=_0x5b6fdc-0x0;var _0x4b8eab=_0xb43b[_0x5b6fdc];return _0x4b8eab;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3181b19..330f13c 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 _0x0bed=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','MailTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','length','include','options','find','body','update','params','describe','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'];(function(_0x539709,_0x2c9edd){var _0x73cc7e=function(_0x5d20ea){while(--_0x5d20ea){_0x539709['push'](_0x539709['shift']());}};_0x73cc7e(++_0x2c9edd);}(_0x0bed,0x1ce));var _0xd0be=function(_0x1e2a2d,_0xe60081){_0x1e2a2d=_0x1e2a2d-0x0;var _0x2f0eee=_0x0bed[_0x1e2a2d];return _0x2f0eee;};'use strict';var emlformat=require(_0xd0be('0x0'));var rimraf=require(_0xd0be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0be('0x2'));var rp=require(_0xd0be('0x3'));var moment=require(_0xd0be('0x4'));var BPromise=require(_0xd0be('0x5'));var Mustache=require(_0xd0be('0x6'));var util=require(_0xd0be('0x7'));var path=require(_0xd0be('0x8'));var sox=require(_0xd0be('0x9'));var csv=require(_0xd0be('0xa'));var ejs=require(_0xd0be('0xb'));var fs=require('fs');var fs_extra=require(_0xd0be('0xc'));var _=require(_0xd0be('0xd'));var squel=require(_0xd0be('0xe'));var crypto=require(_0xd0be('0xf'));var jsforce=require(_0xd0be('0x10'));var deskjs=require(_0xd0be('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd0be('0x12'));var authService=require(_0xd0be('0x13'));var qs=require(_0xd0be('0x14'));var as=require(_0xd0be('0x15'));var hardwareService=require(_0xd0be('0x16'));var logger=require(_0xd0be('0x17'))(_0xd0be('0x18'));var utils=require('../../config/utils');var config=require(_0xd0be('0x19'));var licenseUtil=require(_0xd0be('0x1a'));var db=require(_0xd0be('0x1b'))['db'];function respondWithStatusCode(_0x660159,_0x6d5be3){_0x6d5be3=_0x6d5be3||0xcc;return function(_0x342063){if(_0x342063){return _0x660159[_0xd0be('0x1c')](_0x6d5be3);}return _0x660159[_0xd0be('0x1d')](_0x6d5be3)['end']();};}function respondWithResult(_0x1628b0,_0x31034b){_0x31034b=_0x31034b||0xc8;return function(_0x124950){if(_0x124950){return _0x1628b0[_0xd0be('0x1d')](_0x31034b)['json'](_0x124950);}};}function respondWithFilteredResult(_0x4f3863,_0x303772){return function(_0x52c047){if(_0x52c047){var _0x2a08e4=typeof _0x303772['offset']===_0xd0be('0x1e')&&typeof _0x303772['limit']===_0xd0be('0x1e');var _0x41dd9c=_0x52c047[_0xd0be('0x1f')];var _0x50fa54=_0x2a08e4?0x0:_0x303772[_0xd0be('0x20')];var _0x9fef6b=_0x2a08e4?_0x52c047['count']:_0x303772[_0xd0be('0x20')]+_0x303772[_0xd0be('0x21')];var _0x36bcc8;if(_0x9fef6b>=_0x41dd9c){_0x9fef6b=_0x41dd9c;_0x36bcc8=0xc8;}else{_0x36bcc8=0xce;}_0x4f3863[_0xd0be('0x1d')](_0x36bcc8);return _0x4f3863[_0xd0be('0x22')](_0xd0be('0x23'),_0x50fa54+'-'+_0x9fef6b+'/'+_0x41dd9c)[_0xd0be('0x24')](_0x52c047);}return null;};}function patchUpdates(_0x5730ed){return function(_0x4ab00e){try{jsonpatch['apply'](_0x4ab00e,_0x5730ed,!![]);}catch(_0x3fbc23){return BPromise[_0xd0be('0x25')](_0x3fbc23);}return _0x4ab00e[_0xd0be('0x26')]();};}function saveUpdates(_0x484bb1,_0x20b517){return function(_0x2f8a1b){if(_0x2f8a1b){return _0x2f8a1b['update'](_0x484bb1)[_0xd0be('0x27')](function(_0x23cc4f){return _0x23cc4f;});}return null;};}function removeEntity(_0x5a3b19,_0x1248b8){return function(_0x48bcf4){if(_0x48bcf4){return _0x48bcf4[_0xd0be('0x28')]()[_0xd0be('0x27')](function(){_0x5a3b19[_0xd0be('0x1d')](0xcc)[_0xd0be('0x29')]();});}};}function handleEntityNotFound(_0x5db89b,_0x46eb17){return function(_0x31b33e){if(!_0x31b33e){_0x5db89b[_0xd0be('0x1c')](0x194);}return _0x31b33e;};}function handleError(_0x46e596,_0x48c7b2){_0x48c7b2=_0x48c7b2||0x1f4;return function(_0x3076e4){logger[_0xd0be('0x2a')](_0x3076e4[_0xd0be('0x2b')]);if(_0x3076e4[_0xd0be('0x2c')]){delete _0x3076e4['name'];}_0x46e596['status'](_0x48c7b2)[_0xd0be('0x2d')](_0x3076e4);};}exports['index']=function(_0x42556d,_0x582372){var _0x1ed18c={},_0x4b739a={},_0x17976c={'count':0x0,'rows':[]};var _0x4be0fa=_['map'](db[_0xd0be('0x2e')][_0xd0be('0x2f')],function(_0x2e93ec){return{'name':_0x2e93ec[_0xd0be('0x30')],'type':_0x2e93ec['type'][_0xd0be('0x31')]};});_0x4b739a[_0xd0be('0x32')]=_[_0xd0be('0x33')](_0x4be0fa,_0xd0be('0x2c'));_0x4b739a[_0xd0be('0x34')]=_[_0xd0be('0x35')](_0x42556d[_0xd0be('0x34')]);_0x4b739a[_0xd0be('0x36')]=_[_0xd0be('0x37')](_0x4b739a['model'],_0x4b739a[_0xd0be('0x34')]);_0x1ed18c[_0xd0be('0x38')]=_['intersection'](_0x4b739a['model'],qs[_0xd0be('0x39')](_0x42556d['query'][_0xd0be('0x39')]));_0x1ed18c[_0xd0be('0x38')]=_0x1ed18c[_0xd0be('0x38')]['length']?_0x1ed18c['attributes']:_0x4b739a[_0xd0be('0x32')];if(!_0x42556d[_0xd0be('0x34')][_0xd0be('0x3a')](_0xd0be('0x3b'))){_0x1ed18c[_0xd0be('0x21')]=qs['limit'](_0x42556d[_0xd0be('0x34')][_0xd0be('0x21')]);_0x1ed18c[_0xd0be('0x20')]=qs['offset'](_0x42556d[_0xd0be('0x34')][_0xd0be('0x20')]);}_0x1ed18c['order']=qs[_0xd0be('0x3c')](_0x42556d[_0xd0be('0x34')][_0xd0be('0x3c')]);_0x1ed18c[_0xd0be('0x3d')]=qs['filters'](_[_0xd0be('0x3e')](_0x42556d['query'],_0x4b739a[_0xd0be('0x36')]),_0x4be0fa);if(_0x42556d[_0xd0be('0x34')]['filter']){_0x1ed18c[_0xd0be('0x3d')]=_[_0xd0be('0x3f')](_0x1ed18c['where'],{'$or':_[_0xd0be('0x33')](_0x4be0fa,function(_0x3eef6a){if(_0x3eef6a[_0xd0be('0x40')]!==_0xd0be('0x41')){var _0x2d3ffa={};_0x2d3ffa[_0x3eef6a[_0xd0be('0x2c')]]={'$like':'%'+_0x42556d[_0xd0be('0x34')][_0xd0be('0x42')]+'%'};return _0x2d3ffa;}})});}_0x1ed18c=_['merge']({},_0x1ed18c,_0x42556d['options']);var _0x3e1418={'where':_0x1ed18c[_0xd0be('0x3d')]};return db[_0xd0be('0x2e')][_0xd0be('0x1f')](_0x3e1418)[_0xd0be('0x27')](function(_0xc4cab){_0x17976c[_0xd0be('0x1f')]=_0xc4cab;if(_0x42556d[_0xd0be('0x34')][_0xd0be('0x43')]){_0x1ed18c['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xd0be('0x44')](_0x1ed18c);})[_0xd0be('0x27')](function(_0x29bd04){_0x17976c[_0xd0be('0x45')]=_0x29bd04;return _0x17976c;})[_0xd0be('0x27')](respondWithFilteredResult(_0x582372,_0x1ed18c))[_0xd0be('0x46')](handleError(_0x582372,null));};exports[_0xd0be('0x47')]=function(_0x75ef4c,_0x44cec6){var _0x228c1e={'raw':!![],'where':{'id':_0x75ef4c['params']['id']}},_0x5022c2={};_0x5022c2[_0xd0be('0x32')]=_[_0xd0be('0x35')](db[_0xd0be('0x2e')][_0xd0be('0x2f')]);_0x5022c2['query']=_[_0xd0be('0x35')](_0x75ef4c[_0xd0be('0x34')]);_0x5022c2[_0xd0be('0x36')]=_[_0xd0be('0x37')](_0x5022c2[_0xd0be('0x32')],_0x5022c2[_0xd0be('0x34')]);_0x228c1e[_0xd0be('0x38')]=_['intersection'](_0x5022c2[_0xd0be('0x32')],qs[_0xd0be('0x39')](_0x75ef4c[_0xd0be('0x34')]['fields']));_0x228c1e[_0xd0be('0x38')]=_0x228c1e[_0xd0be('0x38')][_0xd0be('0x48')]?_0x228c1e[_0xd0be('0x38')]:_0x5022c2['model'];if(_0x75ef4c[_0xd0be('0x34')][_0xd0be('0x43')]){_0x228c1e[_0xd0be('0x49')]=[{'all':!![]}];}_0x228c1e=_[_0xd0be('0x3f')]({},_0x228c1e,_0x75ef4c[_0xd0be('0x4a')]);return db[_0xd0be('0x2e')][_0xd0be('0x4b')](_0x228c1e)['then'](handleEntityNotFound(_0x44cec6,null))['then'](respondWithResult(_0x44cec6,null))[_0xd0be('0x46')](handleError(_0x44cec6,null));};exports['create']=function(_0x5ad5e4,_0x4883df){return db[_0xd0be('0x2e')]['create'](_0x5ad5e4[_0xd0be('0x4c')],{})[_0xd0be('0x27')](respondWithResult(_0x4883df,0xc9))[_0xd0be('0x46')](handleError(_0x4883df,null));};exports[_0xd0be('0x4d')]=function(_0x4d4564,_0x4a5d3d){if(_0x4d4564[_0xd0be('0x4c')]['id']){delete _0x4d4564[_0xd0be('0x4c')]['id'];}return db[_0xd0be('0x2e')]['find']({'where':{'id':_0x4d4564[_0xd0be('0x4e')]['id']}})[_0xd0be('0x27')](handleEntityNotFound(_0x4a5d3d,null))[_0xd0be('0x27')](saveUpdates(_0x4d4564[_0xd0be('0x4c')],null))[_0xd0be('0x27')](respondWithResult(_0x4a5d3d,null))[_0xd0be('0x46')](handleError(_0x4a5d3d,null));};exports[_0xd0be('0x28')]=function(_0x3dcbab,_0x50f162){return db['MailTransferReport'][_0xd0be('0x4b')]({'where':{'id':_0x3dcbab['params']['id']}})[_0xd0be('0x27')](handleEntityNotFound(_0x50f162,null))[_0xd0be('0x27')](removeEntity(_0x50f162,null))[_0xd0be('0x46')](handleError(_0x50f162,null));};exports[_0xd0be('0x4f')]=function(_0x5e03d4,_0xe35e47){return db[_0xd0be('0x2e')][_0xd0be('0x4f')]()[_0xd0be('0x27')](respondWithResult(_0xe35e47,null))[_0xd0be('0x46')](handleError(_0xe35e47,null));}; \ No newline at end of file +var _0x511e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','MailTransferReport','findAll','rows','catch','params','keys','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x36c20f,_0x22ff16){var _0x5bf69a=function(_0x38659d){while(--_0x38659d){_0x36c20f['push'](_0x36c20f['shift']());}};_0x5bf69a(++_0x22ff16);}(_0x511e,0xd2));var _0xe511=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x511e[_0x419e17];return _0x1f2044;};'use strict';var emlformat=require(_0xe511('0x0'));var rimraf=require(_0xe511('0x1'));var zipdir=require(_0xe511('0x2'));var jsonpatch=require(_0xe511('0x3'));var rp=require(_0xe511('0x4'));var moment=require(_0xe511('0x5'));var BPromise=require(_0xe511('0x6'));var Mustache=require(_0xe511('0x7'));var util=require('util');var path=require(_0xe511('0x8'));var sox=require(_0xe511('0x9'));var csv=require(_0xe511('0xa'));var ejs=require(_0xe511('0xb'));var fs=require('fs');var fs_extra=require(_0xe511('0xc'));var _=require(_0xe511('0xd'));var squel=require(_0xe511('0xe'));var crypto=require(_0xe511('0xf'));var jsforce=require(_0xe511('0x10'));var deskjs=require(_0xe511('0x11'));var toCsv=require(_0xe511('0xa'));var querystring=require(_0xe511('0x12'));var Papa=require(_0xe511('0x13'));var Redis=require(_0xe511('0x14'));var authService=require(_0xe511('0x15'));var qs=require(_0xe511('0x16'));var as=require(_0xe511('0x17'));var hardwareService=require(_0xe511('0x18'));var logger=require(_0xe511('0x19'))(_0xe511('0x1a'));var utils=require('../../config/utils');var config=require(_0xe511('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xe511('0x1c'))['db'];function respondWithStatusCode(_0x2e4db2,_0x523748){_0x523748=_0x523748||0xcc;return function(_0x252b9b){if(_0x252b9b){return _0x2e4db2[_0xe511('0x1d')](_0x523748);}return _0x2e4db2[_0xe511('0x1e')](_0x523748)[_0xe511('0x1f')]();};}function respondWithResult(_0x1d4a46,_0x444634){_0x444634=_0x444634||0xc8;return function(_0x79a774){if(_0x79a774){return _0x1d4a46[_0xe511('0x1e')](_0x444634)[_0xe511('0x20')](_0x79a774);}};}function respondWithFilteredResult(_0x405d03,_0x396af1){return function(_0x40d396){if(_0x40d396){var _0x16fd9c=typeof _0x396af1[_0xe511('0x21')]===_0xe511('0x22')&&typeof _0x396af1[_0xe511('0x23')]===_0xe511('0x22');var _0x23ce4f=_0x40d396[_0xe511('0x24')];var _0x28c651=_0x16fd9c?0x0:_0x396af1['offset'];var _0x3230bc=_0x16fd9c?_0x40d396[_0xe511('0x24')]:_0x396af1['offset']+_0x396af1[_0xe511('0x23')];var _0x34c0d1;if(_0x3230bc>=_0x23ce4f){_0x3230bc=_0x23ce4f;_0x34c0d1=0xc8;}else{_0x34c0d1=0xce;}_0x405d03[_0xe511('0x1e')](_0x34c0d1);return _0x405d03['set'](_0xe511('0x25'),_0x28c651+'-'+_0x3230bc+'/'+_0x23ce4f)[_0xe511('0x20')](_0x40d396);}return null;};}function patchUpdates(_0x1c3f43){return function(_0x4264cb){try{jsonpatch[_0xe511('0x26')](_0x4264cb,_0x1c3f43,!![]);}catch(_0x585e2d){return BPromise['reject'](_0x585e2d);}return _0x4264cb['save']();};}function saveUpdates(_0x218e3b,_0x256fe5){return function(_0x1c9236){if(_0x1c9236){return _0x1c9236[_0xe511('0x27')](_0x218e3b)[_0xe511('0x28')](function(_0x3f1a6f){return _0x3f1a6f;});}return null;};}function removeEntity(_0x8fc0eb,_0x35e87d){return function(_0x5e6dc1){if(_0x5e6dc1){return _0x5e6dc1[_0xe511('0x29')]()['then'](function(){_0x8fc0eb[_0xe511('0x1e')](0xcc)[_0xe511('0x1f')]();});}};}function handleEntityNotFound(_0x2ff1fc,_0x5bb68b){return function(_0x6bfbf4){if(!_0x6bfbf4){_0x2ff1fc['sendStatus'](0x194);}return _0x6bfbf4;};}function handleError(_0x3bdb09,_0xc2c9cd){_0xc2c9cd=_0xc2c9cd||0x1f4;return function(_0x2bd8bc){logger['error'](_0x2bd8bc['stack']);if(_0x2bd8bc[_0xe511('0x2a')]){delete _0x2bd8bc[_0xe511('0x2a')];}_0x3bdb09[_0xe511('0x1e')](_0xc2c9cd)[_0xe511('0x2b')](_0x2bd8bc);};}exports[_0xe511('0x2c')]=function(_0x130977,_0x2b2dd1){var _0x158af8={},_0x3505ef={},_0xc2089b={'count':0x0,'rows':[]};var _0x15f712=_[_0xe511('0x2d')](db['MailTransferReport'][_0xe511('0x2e')],function(_0x2c30fe){return{'name':_0x2c30fe[_0xe511('0x2f')],'type':_0x2c30fe[_0xe511('0x30')]['key']};});_0x3505ef['model']=_[_0xe511('0x2d')](_0x15f712,_0xe511('0x2a'));_0x3505ef['query']=_['keys'](_0x130977[_0xe511('0x31')]);_0x3505ef[_0xe511('0x32')]=_[_0xe511('0x33')](_0x3505ef[_0xe511('0x34')],_0x3505ef[_0xe511('0x31')]);_0x158af8[_0xe511('0x35')]=_[_0xe511('0x33')](_0x3505ef[_0xe511('0x34')],qs['fields'](_0x130977[_0xe511('0x31')][_0xe511('0x36')]));_0x158af8[_0xe511('0x35')]=_0x158af8[_0xe511('0x35')][_0xe511('0x37')]?_0x158af8[_0xe511('0x35')]:_0x3505ef[_0xe511('0x34')];if(!_0x130977['query']['hasOwnProperty'](_0xe511('0x38'))){_0x158af8['limit']=qs[_0xe511('0x23')](_0x130977[_0xe511('0x31')]['limit']);_0x158af8[_0xe511('0x21')]=qs['offset'](_0x130977[_0xe511('0x31')][_0xe511('0x21')]);}_0x158af8[_0xe511('0x39')]=qs[_0xe511('0x3a')](_0x130977[_0xe511('0x31')]['sort']);_0x158af8[_0xe511('0x3b')]=qs[_0xe511('0x32')](_['pick'](_0x130977[_0xe511('0x31')],_0x3505ef[_0xe511('0x32')]),_0x15f712);if(_0x130977[_0xe511('0x31')][_0xe511('0x3c')]){_0x158af8[_0xe511('0x3b')]=_[_0xe511('0x3d')](_0x158af8[_0xe511('0x3b')],{'$or':_[_0xe511('0x2d')](_0x15f712,function(_0x100d39){if(_0x100d39[_0xe511('0x30')]!==_0xe511('0x3e')){var _0x2c0d85={};_0x2c0d85[_0x100d39[_0xe511('0x2a')]]={'$like':'%'+_0x130977[_0xe511('0x31')][_0xe511('0x3c')]+'%'};return _0x2c0d85;}})});}_0x158af8=_['merge']({},_0x158af8,_0x130977['options']);var _0x1f1168={'where':_0x158af8['where']};return db[_0xe511('0x3f')][_0xe511('0x24')](_0x1f1168)['then'](function(_0x3d3989){_0xc2089b[_0xe511('0x24')]=_0x3d3989;if(_0x130977[_0xe511('0x31')]['includeAll']){_0x158af8['include']=[{'all':!![]}];}return db[_0xe511('0x3f')][_0xe511('0x40')](_0x158af8);})[_0xe511('0x28')](function(_0x4ebc12){_0xc2089b[_0xe511('0x41')]=_0x4ebc12;return _0xc2089b;})[_0xe511('0x28')](respondWithFilteredResult(_0x2b2dd1,_0x158af8))[_0xe511('0x42')](handleError(_0x2b2dd1,null));};exports['show']=function(_0x5e46cf,_0x5281b1){var _0x4b04ac={'raw':!![],'where':{'id':_0x5e46cf[_0xe511('0x43')]['id']}},_0x37f550={};_0x37f550['model']=_['keys'](db[_0xe511('0x3f')][_0xe511('0x2e')]);_0x37f550[_0xe511('0x31')]=_[_0xe511('0x44')](_0x5e46cf[_0xe511('0x31')]);_0x37f550['filters']=_[_0xe511('0x33')](_0x37f550[_0xe511('0x34')],_0x37f550[_0xe511('0x31')]);_0x4b04ac[_0xe511('0x35')]=_['intersection'](_0x37f550[_0xe511('0x34')],qs[_0xe511('0x36')](_0x5e46cf[_0xe511('0x31')][_0xe511('0x36')]));_0x4b04ac[_0xe511('0x35')]=_0x4b04ac[_0xe511('0x35')][_0xe511('0x37')]?_0x4b04ac['attributes']:_0x37f550[_0xe511('0x34')];if(_0x5e46cf[_0xe511('0x31')][_0xe511('0x45')]){_0x4b04ac[_0xe511('0x46')]=[{'all':!![]}];}_0x4b04ac=_[_0xe511('0x3d')]({},_0x4b04ac,_0x5e46cf[_0xe511('0x47')]);return db['MailTransferReport'][_0xe511('0x48')](_0x4b04ac)[_0xe511('0x28')](handleEntityNotFound(_0x5281b1,null))[_0xe511('0x28')](respondWithResult(_0x5281b1,null))[_0xe511('0x42')](handleError(_0x5281b1,null));};exports['create']=function(_0x16f5e4,_0x3e5ecf){return db[_0xe511('0x3f')][_0xe511('0x49')](_0x16f5e4['body'],{})[_0xe511('0x28')](respondWithResult(_0x3e5ecf,0xc9))[_0xe511('0x42')](handleError(_0x3e5ecf,null));};exports['update']=function(_0x1a2eff,_0x4e74ed){if(_0x1a2eff[_0xe511('0x4a')]['id']){delete _0x1a2eff[_0xe511('0x4a')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x1a2eff['params']['id']}})[_0xe511('0x28')](handleEntityNotFound(_0x4e74ed,null))[_0xe511('0x28')](saveUpdates(_0x1a2eff['body'],null))[_0xe511('0x28')](respondWithResult(_0x4e74ed,null))['catch'](handleError(_0x4e74ed,null));};exports[_0xe511('0x29')]=function(_0x4a24d0,_0x3a1169){return db[_0xe511('0x3f')]['find']({'where':{'id':_0x4a24d0[_0xe511('0x43')]['id']}})[_0xe511('0x28')](handleEntityNotFound(_0x3a1169,null))[_0xe511('0x28')](removeEntity(_0x3a1169,null))[_0xe511('0x42')](handleError(_0x3a1169,null));};exports[_0xe511('0x4b')]=function(_0x5addeb,_0x26eb30){return db['MailTransferReport'][_0xe511('0x4b')]()[_0xe511('0x28')](respondWithResult(_0x26eb30,null))['catch'](handleError(_0x26eb30,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4f3bb93..f0261f5 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 _0x128c=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x128c,0x96));var _0xc128=function(_0x4f20fd,_0x4ae3c3){_0x4f20fd=_0x4f20fd-0x0;var _0x1f6c9a=_0x128c[_0x4f20fd];return _0x1f6c9a;};'use strict';var _=require(_0xc128('0x0'));var util=require(_0xc128('0x1'));var logger=require(_0xc128('0x2'))(_0xc128('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc128('0x4'));var fs=require('fs');var path=require(_0xc128('0x5'));var rimraf=require(_0xc128('0x6'));var config=require(_0xc128('0x7'));var attributes=require(_0xc128('0x8'));module[_0xc128('0x9')]=function(_0x579f44,_0x40690d){return _0x579f44['define'](_0xc128('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xc128('0xb'),'fields':[_0xc128('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['MailTransferReport','report_mail_transfer','uniqueid','util','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x2ecb67,_0x8ec62d){var _0x168079=function(_0x56c365){while(--_0x56c365){_0x2ecb67['push'](_0x2ecb67['shift']());}};_0x168079(++_0x8ec62d);}(_0xdace,0xc1));var _0xedac=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xdace[_0x57b432];return _0x2edf2a;};'use strict';var _=require('lodash');var util=require(_0xedac('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xedac('0x1'));var fs=require('fs');var path=require(_0xedac('0x2'));var rimraf=require(_0xedac('0x3'));var config=require('../../config/environment');var attributes=require(_0xedac('0x4'));module[_0xedac('0x5')]=function(_0x400b3b,_0x35db54){return _0x400b3b[_0xedac('0x6')](_0xedac('0x7'),attributes,{'tableName':_0xedac('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xedac('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 08a4c36..0876672 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 _0x66ee=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2ad29f,_0x3d8bd4){var _0x2cff61=function(_0x5529a5){while(--_0x5529a5){_0x2ad29f['push'](_0x2ad29f['shift']());}};_0x2cff61(++_0x3d8bd4);}(_0x66ee,0x85));var _0xe66e=function(_0x3f4e62,_0x2bb7e8){_0x3f4e62=_0x3f4e62-0x0;var _0x26430c=_0x66ee[_0x3f4e62];return _0x26430c;};'use strict';var _=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var moment=require(_0xe66e('0x2'));var BPromise=require(_0xe66e('0x3'));var rs=require(_0xe66e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe66e('0x5'))['db'];var utils=require(_0xe66e('0x6'));var logger=require(_0xe66e('0x7'))(_0xe66e('0x8'));var config=require('../../config/environment');var jayson=require(_0xe66e('0x9'));var client=jayson[_0xe66e('0xa')][_0xe66e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a67ab,_0x142888,_0x5acb44){return new BPromise(function(_0x44dae6,_0x49821d){return client['request'](_0x3a67ab,_0x5acb44)[_0xe66e('0xc')](function(_0x5dcad4){logger[_0xe66e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x142888,_0xe66e('0xe'));logger[_0xe66e('0xf')](_0xe66e('0x10'),_0x142888,_0xe66e('0xe'),JSON[_0xe66e('0x11')](_0x5dcad4));if(_0x5dcad4[_0xe66e('0x12')]){if(_0x5dcad4[_0xe66e('0x12')]['code']===0x1f4){logger[_0xe66e('0x12')](_0xe66e('0x13'),_0x142888,_0x5dcad4['error'][_0xe66e('0x14')]);return _0x49821d(_0x5dcad4[_0xe66e('0x12')][_0xe66e('0x14')]);}logger[_0xe66e('0x12')](_0xe66e('0x13'),_0x142888,_0x5dcad4[_0xe66e('0x12')][_0xe66e('0x14')]);return _0x44dae6(_0x5dcad4[_0xe66e('0x12')]['message']);}else{logger[_0xe66e('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x142888,_0xe66e('0xe'));_0x44dae6(_0x5dcad4[_0xe66e('0x15')][_0xe66e('0x14')]);}})[_0xe66e('0x16')](function(_0x386003){logger[_0xe66e('0x12')](_0xe66e('0x13'),_0x142888,_0x386003);_0x49821d(_0x386003);});});} \ No newline at end of file +var _0x69b5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x5d0d21,_0x4607c5){var _0x3b22c7=function(_0x27ece0){while(--_0x27ece0){_0x5d0d21['push'](_0x5d0d21['shift']());}};_0x3b22c7(++_0x4607c5);}(_0x69b5,0xee));var _0x569b=function(_0x266b0c,_0x4fb269){_0x266b0c=_0x266b0c-0x0;var _0xd1bfa7=_0x69b5[_0x266b0c];return _0xd1bfa7;};'use strict';var _=require(_0x569b('0x0'));var util=require(_0x569b('0x1'));var moment=require(_0x569b('0x2'));var BPromise=require(_0x569b('0x3'));var rs=require(_0x569b('0x4'));var fs=require('fs');var Redis=require(_0x569b('0x5'));var db=require(_0x569b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x569b('0x7'))(_0x569b('0x8'));var config=require('../../config/environment');var jayson=require(_0x569b('0x9'));var client=jayson[_0x569b('0xa')][_0x569b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21fa51,_0x5c05e5,_0x305548){return new BPromise(function(_0x39aaed,_0x477d23){return client[_0x569b('0xc')](_0x21fa51,_0x305548)[_0x569b('0xd')](function(_0x284b5f){logger[_0x569b('0xe')](_0x569b('0xf'),_0x5c05e5,'request\x20sent');logger[_0x569b('0x10')](_0x569b('0x11'),_0x5c05e5,'request\x20sent',JSON['stringify'](_0x284b5f));if(_0x284b5f['error']){if(_0x284b5f[_0x569b('0x12')][_0x569b('0x13')]===0x1f4){logger[_0x569b('0x12')](_0x569b('0xf'),_0x5c05e5,_0x284b5f[_0x569b('0x12')]['message']);return _0x477d23(_0x284b5f[_0x569b('0x12')][_0x569b('0x14')]);}logger[_0x569b('0x12')](_0x569b('0xf'),_0x5c05e5,_0x284b5f['error'][_0x569b('0x14')]);return _0x39aaed(_0x284b5f[_0x569b('0x12')][_0x569b('0x14')]);}else{logger[_0x569b('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5c05e5,_0x569b('0x15'));_0x39aaed(_0x284b5f[_0x569b('0x16')]['message']);}})[_0x569b('0x17')](function(_0x48c970){logger['error'](_0x569b('0xf'),_0x5c05e5,_0x48c970);_0x477d23(_0x48c970);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 98fcce9..59fbccc 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 _0xe9ac=['put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0x270d74,_0x45accf){var _0x1a403d=function(_0x455b47){while(--_0x455b47){_0x270d74['push'](_0x270d74['shift']());}};_0x1a403d(++_0x45accf);}(_0xe9ac,0x159));var _0xce9a=function(_0x16cbd6,_0xa6ad54){_0x16cbd6=_0x16cbd6-0x0;var _0x2037d5=_0xe9ac[_0x16cbd6];return _0x2037d5;};'use strict';var multer=require(_0xce9a('0x0'));var util=require('util');var path=require(_0xce9a('0x1'));var timeout=require(_0xce9a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce9a('0x3'));var interaction=require(_0xce9a('0x4'));var config=require(_0xce9a('0x5'));var controller=require(_0xce9a('0x6'));router['get']('/',auth[_0xce9a('0x7')](),controller[_0xce9a('0x8')]);router[_0xce9a('0x9')](_0xce9a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xce9a('0x9')](_0xce9a('0xb'),auth['isAuthenticated'](),controller[_0xce9a('0xc')]);router[_0xce9a('0xd')]('/',auth[_0xce9a('0x7')](),controller[_0xce9a('0xe')]);router[_0xce9a('0xf')](_0xce9a('0xb'),auth[_0xce9a('0x7')](),controller[_0xce9a('0x10')]);router[_0xce9a('0x11')](_0xce9a('0xb'),auth['isAuthenticated'](),controller[_0xce9a('0x12')]);module[_0xce9a('0x13')]=router; \ No newline at end of file +var _0xa8ff=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x4e64b0,_0x3df580){var _0x21b955=function(_0x46c28e){while(--_0x46c28e){_0x4e64b0['push'](_0x4e64b0['shift']());}};_0x21b955(++_0x3df580);}(_0xa8ff,0x13a));var _0xfa8f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa8ff[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xfa8f('0x0'));var util=require(_0xfa8f('0x1'));var path=require(_0xfa8f('0x2'));var timeout=require(_0xfa8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa8f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfa8f('0x5'));var controller=require(_0xfa8f('0x6'));router[_0xfa8f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xfa8f('0x8')](),controller[_0xfa8f('0x9')]);router[_0xfa8f('0x7')](_0xfa8f('0xa'),auth['isAuthenticated'](),controller[_0xfa8f('0xb')]);router[_0xfa8f('0xc')]('/',auth[_0xfa8f('0x8')](),controller[_0xfa8f('0xd')]);router[_0xfa8f('0xe')]('/:id',auth[_0xfa8f('0x8')](),controller[_0xfa8f('0xf')]);router[_0xfa8f('0x10')](_0xfa8f('0xa'),auth[_0xfa8f('0x8')](),controller[_0xfa8f('0x11')]);module[_0xfa8f('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 f914209..32e02d1 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 _0x823c=['setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x823c,0xb5));var _0xc823=function(_0x4f8233,_0x4f0a12){_0x4f8233=_0x4f8233-0x0;var _0x1159b2=_0x823c[_0x4f8233];return _0x1159b2;};'use strict';var Sequelize=require(_0xc823('0x0'));var moment=require(_0xc823('0x1'));module[_0xc823('0x2')]={'channel':{'type':Sequelize[_0xc823('0x3')]},'membername':{'type':Sequelize[_0xc823('0x3')]},'interface':{'type':Sequelize[_0xc823('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xc823('0x4'),'comment':_0xc823('0x5')},'duration':{'type':Sequelize[_0xc823('0x6')]},'enterAt':{'type':Sequelize[_0xc823('0x7')]},'exitAt':{'type':Sequelize[_0xc823('0x7')],'set':function(_0x3d99fb){var _0xfccc06=moment(_0x3d99fb);var _0x306468=moment(this[_0xc823('0x8')]('enterAt'));var _0x2851ec=_0xfccc06['diff'](_0x306468,_0xc823('0x9'));this['setDataValue'](_0xc823('0xa'),_0x3d99fb);this[_0xc823('0xb')](_0xc823('0xc'),_0x2851ec>=0x0?_0x2851ec:null);}},'data1':{'type':Sequelize[_0xc823('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xc823('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xc823('0xe')},'data4':{'type':Sequelize[_0xc823('0x3')],'comment':_0xc823('0xf')},'data5':{'type':Sequelize[_0xc823('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xc823('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc823('0x3')]}}; \ No newline at end of file +var _0x395f=['talk:[start]','talk:[destination]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x53127f,_0x132bcf){var _0x5f1c92=function(_0x95fa38){while(--_0x95fa38){_0x53127f['push'](_0x53127f['shift']());}};_0x5f1c92(++_0x132bcf);}(_0x395f,0x188));var _0xf395=function(_0x21b7b4,_0x54ea46){_0x21b7b4=_0x21b7b4-0x0;var _0x4b5efb=_0x395f[_0x21b7b4];return _0x4b5efb;};'use strict';var Sequelize=require(_0xf395('0x0'));var moment=require('moment');module[_0xf395('0x1')]={'channel':{'type':Sequelize[_0xf395('0x2')]},'membername':{'type':Sequelize[_0xf395('0x2')]},'interface':{'type':Sequelize[_0xf395('0x2')]},'type':{'type':Sequelize[_0xf395('0x2')],'defaultValue':_0xf395('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xf395('0x4')]},'enterAt':{'type':Sequelize[_0xf395('0x5')]},'exitAt':{'type':Sequelize[_0xf395('0x5')],'set':function(_0x3bbcef){var _0x166496=moment(_0x3bbcef);var _0x5034ad=moment(this[_0xf395('0x6')](_0xf395('0x7')));var _0x505fd=_0x166496['diff'](_0x5034ad,_0xf395('0x8'));this[_0xf395('0x9')](_0xf395('0xa'),_0x3bbcef);this[_0xf395('0x9')](_0xf395('0xb'),_0x505fd>=0x0?_0x505fd:null);}},'data1':{'type':Sequelize[_0xf395('0x2')],'comment':_0xf395('0xc')},'data2':{'type':Sequelize[_0xf395('0x2')],'comment':_0xf395('0xd')},'data3':{'type':Sequelize[_0xf395('0x2')],'comment':_0xf395('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf395('0x4')]},'uniqueid':{'type':Sequelize[_0xf395('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0de01fb..5496f51 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x3e74,0x175));var _0x43e7=function(_0x34e593,_0x40268c){_0x34e593=_0x34e593-0x0;var _0x8e23e4=_0x3e74[_0x34e593];return _0x8e23e4;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55ca,0x126));var _0xa55c=function(_0x3711e2,_0x1468e1){_0x3711e2=_0x3711e2-0x0;var _0x18a556=_0x55ca[_0x3711e2];return _0x18a556;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ecea360..a6e5856 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 _0xdfc5=['rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','api','moment','bluebird','request-promise','path'];(function(_0x32cc19,_0x970b6d){var _0x1dd682=function(_0x5a1314){while(--_0x5a1314){_0x32cc19['push'](_0x32cc19['shift']());}};_0x1dd682(++_0x970b6d);}(_0xdfc5,0x13d));var _0x5dfc=function(_0x89f81d,_0x1868ef){_0x89f81d=_0x89f81d-0x0;var _0x23ad26=_0xdfc5[_0x89f81d];return _0x23ad26;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5dfc('0x0'));var moment=require(_0x5dfc('0x1'));var BPromise=require(_0x5dfc('0x2'));var rp=require(_0x5dfc('0x3'));var fs=require('fs');var path=require(_0x5dfc('0x4'));var rimraf=require(_0x5dfc('0x5'));var config=require(_0x5dfc('0x6'));var attributes=require(_0x5dfc('0x7'));module[_0x5dfc('0x8')]=function(_0x3b8246,_0x9011b5){return _0x3b8246[_0x5dfc('0x9')](_0x5dfc('0xa'),attributes,{'tableName':_0x5dfc('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5dfc('0xc'),_0x5dfc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa59d=['../../config/logger','api','moment','bluebird','request-promise','path','./memberReport.attributes','exports','define','MemberReport','membername_interface','lodash'];(function(_0x49cc0f,_0x4970b0){var _0xa3038d=function(_0xd84e4d){while(--_0xd84e4d){_0x49cc0f['push'](_0x49cc0f['shift']());}};_0xa3038d(++_0x4970b0);}(_0xa59d,0x15b));var _0xda59=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa59d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xda59('0x0'));var util=require('util');var logger=require(_0xda59('0x1'))(_0xda59('0x2'));var moment=require(_0xda59('0x3'));var BPromise=require(_0xda59('0x4'));var rp=require(_0xda59('0x5'));var fs=require('fs');var path=require(_0xda59('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda59('0x7'));module[_0xda59('0x8')]=function(_0x305f9c,_0x582a43){return _0x305f9c[_0xda59('0x9')](_0xda59('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xda59('0xb'),'fields':['membername','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 b2edb70..7540172 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 _0x7c1a=['create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','GetMemberReport','debug','stringify','CreateMemberReport'];(function(_0x43bb6e,_0x2209d8){var _0x4361b5=function(_0x2d8d65){while(--_0x2d8d65){_0x43bb6e['push'](_0x43bb6e['shift']());}};_0x4361b5(++_0x2209d8);}(_0x7c1a,0x159));var _0xa7c1=function(_0x5b6510,_0x194455){_0x5b6510=_0x5b6510-0x0;var _0xd3e473=_0x7c1a[_0x5b6510];return _0xd3e473;};'use strict';var _=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var moment=require(_0xa7c1('0x2'));var BPromise=require(_0xa7c1('0x3'));var rs=require(_0xa7c1('0x4'));var fs=require('fs');var Redis=require(_0xa7c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7c1('0x6'));var logger=require(_0xa7c1('0x7'))('rpc');var config=require(_0xa7c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7c1('0x9')][_0xa7c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dcfe3,_0x300db9,_0x4fc287){return new BPromise(function(_0x4f97c0,_0x117323){return client[_0xa7c1('0xb')](_0x3dcfe3,_0x4fc287)[_0xa7c1('0xc')](function(_0x5bc155){logger[_0xa7c1('0xd')](_0xa7c1('0xe'),_0x300db9,_0xa7c1('0xf'));logger['debug'](_0xa7c1('0x10'),_0x300db9,_0xa7c1('0xf'),JSON['stringify'](_0x5bc155));if(_0x5bc155[_0xa7c1('0x11')]){if(_0x5bc155[_0xa7c1('0x11')]['code']===0x1f4){logger[_0xa7c1('0x11')](_0xa7c1('0xe'),_0x300db9,_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);return _0x117323(_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);}logger[_0xa7c1('0x11')](_0xa7c1('0xe'),_0x300db9,_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);return _0x4f97c0(_0x5bc155[_0xa7c1('0x11')][_0xa7c1('0x12')]);}else{logger[_0xa7c1('0xd')]('MemberReport,\x20%s,\x20%s',_0x300db9,_0xa7c1('0xf'));_0x4f97c0(_0x5bc155[_0xa7c1('0x13')][_0xa7c1('0x12')]);}})[_0xa7c1('0x14')](function(_0x84244a){logger['error'](_0xa7c1('0xe'),_0x300db9,_0x84244a);_0x117323(_0x84244a);});});}exports['GetMemberReport']=function(_0x440251){var _0x337db4=this;return new Promise(function(_0x5dc8e3,_0x2e23f8){return db[_0xa7c1('0x15')][_0xa7c1('0x16')]({'raw':_0x440251['options']?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x18')]===undefined?!![]:![]:!![],'where':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x19')]||null:null,'attributes':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')][_0xa7c1('0x1a')]||null:null,'limit':_0x440251[_0xa7c1('0x17')]?_0x440251['options'][_0xa7c1('0x1b')]||null:null,'include':_0x440251[_0xa7c1('0x17')]?_0x440251[_0xa7c1('0x17')]['include']?_[_0xa7c1('0x1c')](_0x440251[_0xa7c1('0x17')][_0xa7c1('0x1d')],function(_0x2dc42b){return{'model':db[_0x2dc42b[_0xa7c1('0x1e')]],'as':_0x2dc42b['as'],'attributes':_0x2dc42b[_0xa7c1('0x1a')],'include':_0x2dc42b[_0xa7c1('0x1d')]?_['map'](_0x2dc42b['include'],function(_0x48280a){return{'model':db[_0x48280a[_0xa7c1('0x1e')]],'as':_0x48280a['as'],'attributes':_0x48280a[_0xa7c1('0x1a')],'include':_0x48280a[_0xa7c1('0x1d')]?_[_0xa7c1('0x1c')](_0x48280a[_0xa7c1('0x1d')],function(_0x5d62cb){return{'model':db[_0x5d62cb['model']],'as':_0x5d62cb['as'],'attributes':_0x5d62cb[_0xa7c1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7c1('0xc')](function(_0xc60f7c){logger['info'](_0xa7c1('0x1f'),_0x440251);logger[_0xa7c1('0x20')](_0xa7c1('0x1f'),_0x440251,JSON[_0xa7c1('0x21')](_0xc60f7c));_0x5dc8e3(_0xc60f7c);})[_0xa7c1('0x14')](function(_0x1cc05c){logger[_0xa7c1('0x11')](_0xa7c1('0x1f'),_0x1cc05c[_0xa7c1('0x12')],_0x440251);_0x2e23f8(_0x337db4[_0xa7c1('0x11')](0x1f4,_0x1cc05c['message']));});});};exports[_0xa7c1('0x22')]=function(_0x924b93){var _0x2a5d5c=this;return new Promise(function(_0x40ad2b,_0x216fd5){return db[_0xa7c1('0x15')][_0xa7c1('0x23')](_0x924b93[_0xa7c1('0x24')],{'raw':_0x924b93[_0xa7c1('0x17')]?_0x924b93['options'][_0xa7c1('0x18')]===undefined?!![]:![]:!![]})[_0xa7c1('0xc')](function(_0x6533b2){logger[_0xa7c1('0xd')]('CreateMemberReport',_0x924b93);logger['debug'](_0xa7c1('0x22'),_0x924b93,JSON[_0xa7c1('0x21')](_0x6533b2));_0x40ad2b(_0x6533b2);})[_0xa7c1('0x14')](function(_0x57b905){logger['error'](_0xa7c1('0x22'),_0x57b905[_0xa7c1('0x12')],_0x924b93);_0x216fd5(_0x2a5d5c['error'](0x1f4,_0x57b905[_0xa7c1('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2c1569){var _0x55b3ea=this;return new Promise(function(_0x46bdb1,_0x44e732){return db['MemberReport']['update'](_0x2c1569[_0xa7c1('0x24')],{'raw':_0x2c1569[_0xa7c1('0x17')]?_0x2c1569[_0xa7c1('0x17')][_0xa7c1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1569[_0xa7c1('0x17')]?_0x2c1569[_0xa7c1('0x17')][_0xa7c1('0x19')]||null:null,'attributes':_0x2c1569['options']?_0x2c1569[_0xa7c1('0x17')][_0xa7c1('0x1a')]||null:null,'limit':_0x2c1569[_0xa7c1('0x17')]?_0x2c1569[_0xa7c1('0x17')][_0xa7c1('0x1b')]||null:null})[_0xa7c1('0xc')](function(_0x4b88d4){logger[_0xa7c1('0xd')](_0xa7c1('0x25'),_0x2c1569);logger[_0xa7c1('0x20')](_0xa7c1('0x25'),_0x2c1569,JSON[_0xa7c1('0x21')](_0x4b88d4));_0x46bdb1(_0x4b88d4);})[_0xa7c1('0x14')](function(_0x3b6f7f){logger[_0xa7c1('0x11')]('UpdateMemberReport',_0x3b6f7f[_0xa7c1('0x12')],_0x2c1569);_0x44e732(_0x55b3ea[_0xa7c1('0x11')](0x1f4,_0x3b6f7f[_0xa7c1('0x12')]));});});}; \ No newline at end of file +var _0xcfef=['options','where','include','map','attributes','model','info','CreateMemberReport','create','body','raw','UpdateMemberReport','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x5e829c,_0x2f3898){var _0x2ff4ad=function(_0x20da7a){while(--_0x20da7a){_0x5e829c['push'](_0x5e829c['shift']());}};_0x2ff4ad(++_0x2f3898);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x2a4302,_0x4f8b78){_0x2a4302=_0x2a4302-0x0;var _0x18360c=_0xcfef[_0x2a4302];return _0x18360c;};'use strict';var _=require('lodash');var util=require(_0xfcfe('0x0'));var moment=require(_0xfcfe('0x1'));var BPromise=require(_0xfcfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcfe('0x3'))(_0xfcfe('0x4'));var config=require(_0xfcfe('0x5'));var jayson=require(_0xfcfe('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2aecec,_0x584f29,_0x28fe66){return new BPromise(function(_0x1d7307,_0x39d07c){return client['request'](_0x2aecec,_0x28fe66)[_0xfcfe('0x7')](function(_0x5c6211){logger['info'](_0xfcfe('0x8'),_0x584f29,'request\x20sent');logger[_0xfcfe('0x9')](_0xfcfe('0xa'),_0x584f29,_0xfcfe('0xb'),JSON[_0xfcfe('0xc')](_0x5c6211));if(_0x5c6211[_0xfcfe('0xd')]){if(_0x5c6211[_0xfcfe('0xd')]['code']===0x1f4){logger[_0xfcfe('0xd')]('MemberReport,\x20%s,\x20%s',_0x584f29,_0x5c6211['error'][_0xfcfe('0xe')]);return _0x39d07c(_0x5c6211['error'][_0xfcfe('0xe')]);}logger[_0xfcfe('0xd')](_0xfcfe('0x8'),_0x584f29,_0x5c6211[_0xfcfe('0xd')][_0xfcfe('0xe')]);return _0x1d7307(_0x5c6211[_0xfcfe('0xd')][_0xfcfe('0xe')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x584f29,_0xfcfe('0xb'));_0x1d7307(_0x5c6211[_0xfcfe('0xf')][_0xfcfe('0xe')]);}})[_0xfcfe('0x10')](function(_0x5414b1){logger['error'](_0xfcfe('0x8'),_0x584f29,_0x5414b1);_0x39d07c(_0x5414b1);});});}exports[_0xfcfe('0x11')]=function(_0x4393e4){var _0x58dc99=this;return new Promise(function(_0x386a5d,_0x4c36b9){return db[_0xfcfe('0x12')][_0xfcfe('0x13')]({'raw':_0x4393e4['options']?_0x4393e4[_0xfcfe('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')][_0xfcfe('0x15')]||null:null,'attributes':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')]['attributes']||null:null,'limit':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4['options']['limit']||null:null,'include':_0x4393e4[_0xfcfe('0x14')]?_0x4393e4[_0xfcfe('0x14')][_0xfcfe('0x16')]?_[_0xfcfe('0x17')](_0x4393e4[_0xfcfe('0x14')]['include'],function(_0x131384){return{'model':db[_0x131384['model']],'as':_0x131384['as'],'attributes':_0x131384[_0xfcfe('0x18')],'include':_0x131384[_0xfcfe('0x16')]?_[_0xfcfe('0x17')](_0x131384['include'],function(_0x3ebd99){return{'model':db[_0x3ebd99[_0xfcfe('0x19')]],'as':_0x3ebd99['as'],'attributes':_0x3ebd99[_0xfcfe('0x18')],'include':_0x3ebd99[_0xfcfe('0x16')]?_['map'](_0x3ebd99[_0xfcfe('0x16')],function(_0x24f3a7){return{'model':db[_0x24f3a7[_0xfcfe('0x19')]],'as':_0x24f3a7['as'],'attributes':_0x24f3a7[_0xfcfe('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcfe('0x7')](function(_0x41e60d){logger[_0xfcfe('0x1a')](_0xfcfe('0x11'),_0x4393e4);logger[_0xfcfe('0x9')](_0xfcfe('0x11'),_0x4393e4,JSON[_0xfcfe('0xc')](_0x41e60d));_0x386a5d(_0x41e60d);})[_0xfcfe('0x10')](function(_0x12a91b){logger[_0xfcfe('0xd')](_0xfcfe('0x11'),_0x12a91b[_0xfcfe('0xe')],_0x4393e4);_0x4c36b9(_0x58dc99['error'](0x1f4,_0x12a91b[_0xfcfe('0xe')]));});});};exports[_0xfcfe('0x1b')]=function(_0x2c0998){var _0xa2c262=this;return new Promise(function(_0x1a7f54,_0x1d7134){return db[_0xfcfe('0x12')][_0xfcfe('0x1c')](_0x2c0998[_0xfcfe('0x1d')],{'raw':_0x2c0998[_0xfcfe('0x14')]?_0x2c0998['options'][_0xfcfe('0x1e')]===undefined?!![]:![]:!![]})[_0xfcfe('0x7')](function(_0x58e2e5){logger[_0xfcfe('0x1a')](_0xfcfe('0x1b'),_0x2c0998);logger[_0xfcfe('0x9')](_0xfcfe('0x1b'),_0x2c0998,JSON[_0xfcfe('0xc')](_0x58e2e5));_0x1a7f54(_0x58e2e5);})['catch'](function(_0x2ebb88){logger['error'](_0xfcfe('0x1b'),_0x2ebb88[_0xfcfe('0xe')],_0x2c0998);_0x1d7134(_0xa2c262[_0xfcfe('0xd')](0x1f4,_0x2ebb88[_0xfcfe('0xe')]));});});};exports[_0xfcfe('0x1f')]=function(_0x415996){var _0x46a7dc=this;return new Promise(function(_0x489709,_0x200109){return db['MemberReport']['update'](_0x415996[_0xfcfe('0x1d')],{'raw':_0x415996[_0xfcfe('0x14')]?_0x415996[_0xfcfe('0x14')][_0xfcfe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x415996[_0xfcfe('0x14')]?_0x415996[_0xfcfe('0x14')][_0xfcfe('0x15')]||null:null,'attributes':_0x415996[_0xfcfe('0x14')]?_0x415996[_0xfcfe('0x14')][_0xfcfe('0x18')]||null:null,'limit':_0x415996[_0xfcfe('0x14')]?_0x415996[_0xfcfe('0x14')]['limit']||null:null})[_0xfcfe('0x7')](function(_0x321f42){logger[_0xfcfe('0x1a')](_0xfcfe('0x1f'),_0x415996);logger[_0xfcfe('0x9')](_0xfcfe('0x1f'),_0x415996,JSON['stringify'](_0x321f42));_0x489709(_0x321f42);})[_0xfcfe('0x10')](function(_0x33b884){logger[_0xfcfe('0xd')](_0xfcfe('0x1f'),_0x33b884[_0xfcfe('0xe')],_0x415996);_0x200109(_0x46a7dc[_0xfcfe('0xd')](0x1f4,_0x33b884['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7701e7e..22f0ba2 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 _0x6ef2=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ef2,0x1c3));var _0x26ef=function(_0x2fcddb,_0xc1f1f3){_0x2fcddb=_0x2fcddb-0x0;var _0x244563=_0x6ef2[_0x2fcddb];return _0x244563;};'use strict';var multer=require('multer');var util=require(_0x26ef('0x0'));var path=require(_0x26ef('0x1'));var timeout=require(_0x26ef('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x26ef('0x3'));var auth=require(_0x26ef('0x4'));var interaction=require(_0x26ef('0x5'));var config=require(_0x26ef('0x6'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x26ef('0x7')]=router; \ No newline at end of file +var _0xd61c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','util'];(function(_0x2598f2,_0x5b7d25){var _0x463a9b=function(_0x3e7793){while(--_0x3e7793){_0x2598f2['push'](_0x2598f2['shift']());}};_0x463a9b(++_0x5b7d25);}(_0xd61c,0x6b));var _0xcd61=function(_0x53cfc8,_0x35dbea){_0x53cfc8=_0x53cfc8-0x0;var _0x115def=_0xd61c[_0x53cfc8];return _0x115def;};'use strict';var multer=require('multer');var util=require(_0xcd61('0x0'));var path=require(_0xcd61('0x1'));var timeout=require(_0xcd61('0x2'));var express=require(_0xcd61('0x3'));var router=express[_0xcd61('0x4')]();var fs_extra=require(_0xcd61('0x5'));var auth=require(_0xcd61('0x6'));var interaction=require(_0xcd61('0x7'));var config=require('../../config/environment');var controller=require(_0xcd61('0x8'));router[_0xcd61('0x9')]('/',controller[_0xcd61('0xa')]);module[_0xcd61('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 546572f..1b8441e 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 _0xe6ce=['version'];(function(_0x2af0bd,_0x30c3ac){var _0x1f52cd=function(_0x3101ee){while(--_0x3101ee){_0x2af0bd['push'](_0x2af0bd['shift']());}};_0x1f52cd(++_0x30c3ac);}(_0xe6ce,0x16d));var _0xee6c=function(_0x28a3fd,_0x31eb3d){_0x28a3fd=_0x28a3fd-0x0;var _0x46c4f8=_0xe6ce[_0x28a3fd];return _0x46c4f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xee6c('0x0')}}; \ No newline at end of file +var _0x23b0=['STRING','version','exports'];(function(_0x5a45fd,_0x1a493f){var _0x4b197a=function(_0x9e263b){while(--_0x9e263b){_0x5a45fd['push'](_0x5a45fd['shift']());}};_0x4b197a(++_0x1a493f);}(_0x23b0,0x1b5));var _0x023b=function(_0x2384d2,_0x7f5b76){_0x2384d2=_0x2384d2-0x0;var _0x799ff1=_0x23b0[_0x2384d2];return _0x799ff1;};'use strict';var Sequelize=require('sequelize');module[_0x023b('0x0')]={'version':{'type':Sequelize[_0x023b('0x1')],'unique':_0x023b('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 672ac7e..a91149a 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 _0x4075=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','Migration','findAll','catch','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x18bfcb,_0x487ea4){var _0x1192f0=function(_0x1b9921){while(--_0x1b9921){_0x18bfcb['push'](_0x18bfcb['shift']());}};_0x1192f0(++_0x487ea4);}(_0x4075,0x1a3));var _0x5407=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x4075[_0x5c78d9];return _0x69ae1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5407('0x0'));var zipdir=require(_0x5407('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5407('0x2'));var moment=require(_0x5407('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5407('0x4'));var util=require(_0x5407('0x5'));var path=require(_0x5407('0x6'));var sox=require(_0x5407('0x7'));var csv=require(_0x5407('0x8'));var ejs=require(_0x5407('0x9'));var fs=require('fs');var fs_extra=require(_0x5407('0xa'));var _=require(_0x5407('0xb'));var squel=require(_0x5407('0xc'));var crypto=require(_0x5407('0xd'));var jsforce=require(_0x5407('0xe'));var deskjs=require(_0x5407('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5407('0x10'));var Papa=require(_0x5407('0x11'));var Redis=require('ioredis');var authService=require(_0x5407('0x12'));var qs=require(_0x5407('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5407('0x14'));var logger=require('../../config/logger')(_0x5407('0x15'));var utils=require(_0x5407('0x16'));var config=require(_0x5407('0x17'));var licenseUtil=require(_0x5407('0x18'));var db=require(_0x5407('0x19'))['db'];function respondWithStatusCode(_0x37d68b,_0x2e5462){_0x2e5462=_0x2e5462||0xcc;return function(_0x2a220b){if(_0x2a220b){return _0x37d68b[_0x5407('0x1a')](_0x2e5462);}return _0x37d68b['status'](_0x2e5462)[_0x5407('0x1b')]();};}function respondWithResult(_0x2fd20d,_0x674a93){_0x674a93=_0x674a93||0xc8;return function(_0x3fb694){if(_0x3fb694){return _0x2fd20d['status'](_0x674a93)[_0x5407('0x1c')](_0x3fb694);}};}function respondWithFilteredResult(_0xb776c0,_0x11d516){return function(_0x29be80){if(_0x29be80){var _0x4df045=typeof _0x11d516[_0x5407('0x1d')]===_0x5407('0x1e')&&typeof _0x11d516[_0x5407('0x1f')]===_0x5407('0x1e');var _0x375860=_0x29be80[_0x5407('0x20')];var _0xab7c02=_0x4df045?0x0:_0x11d516[_0x5407('0x1d')];var _0xb449af=_0x4df045?_0x29be80[_0x5407('0x20')]:_0x11d516[_0x5407('0x1d')]+_0x11d516[_0x5407('0x1f')];var _0x41be14;if(_0xb449af>=_0x375860){_0xb449af=_0x375860;_0x41be14=0xc8;}else{_0x41be14=0xce;}_0xb776c0[_0x5407('0x21')](_0x41be14);return _0xb776c0[_0x5407('0x22')](_0x5407('0x23'),_0xab7c02+'-'+_0xb449af+'/'+_0x375860)[_0x5407('0x1c')](_0x29be80);}return null;};}function patchUpdates(_0x4f6b31){return function(_0x314d2b){try{jsonpatch[_0x5407('0x24')](_0x314d2b,_0x4f6b31,!![]);}catch(_0x4265c7){return BPromise[_0x5407('0x25')](_0x4265c7);}return _0x314d2b[_0x5407('0x26')]();};}function saveUpdates(_0x2524cc,_0x42e96b){return function(_0x1aaf12){if(_0x1aaf12){return _0x1aaf12[_0x5407('0x27')](_0x2524cc)[_0x5407('0x28')](function(_0x4209ba){return _0x4209ba;});}return null;};}function removeEntity(_0x5b9093,_0x44ec69){return function(_0x8e694d){if(_0x8e694d){return _0x8e694d[_0x5407('0x29')]()[_0x5407('0x28')](function(){_0x5b9093['status'](0xcc)[_0x5407('0x1b')]();});}};}function handleEntityNotFound(_0x399793,_0x2b801d){return function(_0x3d2dcc){if(!_0x3d2dcc){_0x399793[_0x5407('0x1a')](0x194);}return _0x3d2dcc;};}function handleError(_0x5981cd,_0x207f4d){_0x207f4d=_0x207f4d||0x1f4;return function(_0x48b967){logger[_0x5407('0x2a')](_0x48b967[_0x5407('0x2b')]);if(_0x48b967[_0x5407('0x2c')]){delete _0x48b967[_0x5407('0x2c')];}_0x5981cd[_0x5407('0x21')](_0x207f4d)[_0x5407('0x2d')](_0x48b967);};}exports[_0x5407('0x2e')]=function(_0x254c37,_0x2c9a85){var _0x1c9b90={},_0x1ecaba={},_0x1f7067={'count':0x0,'rows':[]};var _0x2a039a=_[_0x5407('0x2f')](db['Migration'][_0x5407('0x30')],function(_0x11e8e8){return{'name':_0x11e8e8[_0x5407('0x31')],'type':_0x11e8e8[_0x5407('0x32')][_0x5407('0x33')]};});_0x1ecaba[_0x5407('0x34')]=_[_0x5407('0x2f')](_0x2a039a,'name');_0x1ecaba[_0x5407('0x35')]=_[_0x5407('0x36')](_0x254c37[_0x5407('0x35')]);_0x1ecaba[_0x5407('0x37')]=_[_0x5407('0x38')](_0x1ecaba[_0x5407('0x34')],_0x1ecaba[_0x5407('0x35')]);_0x1c9b90[_0x5407('0x39')]=_[_0x5407('0x38')](_0x1ecaba['model'],qs[_0x5407('0x3a')](_0x254c37[_0x5407('0x35')][_0x5407('0x3a')]));_0x1c9b90['attributes']=_0x1c9b90['attributes'][_0x5407('0x3b')]?_0x1c9b90[_0x5407('0x39')]:_0x1ecaba[_0x5407('0x34')];if(!_0x254c37[_0x5407('0x35')][_0x5407('0x3c')](_0x5407('0x3d'))){_0x1c9b90[_0x5407('0x1f')]=qs['limit'](_0x254c37[_0x5407('0x35')]['limit']);_0x1c9b90[_0x5407('0x1d')]=qs['offset'](_0x254c37[_0x5407('0x35')]['offset']);}_0x1c9b90['order']=qs[_0x5407('0x3e')](_0x254c37[_0x5407('0x35')][_0x5407('0x3e')]);_0x1c9b90[_0x5407('0x3f')]=qs[_0x5407('0x37')](_[_0x5407('0x40')](_0x254c37['query'],_0x1ecaba['filters']),_0x2a039a);if(_0x254c37[_0x5407('0x35')][_0x5407('0x41')]){_0x1c9b90[_0x5407('0x3f')]=_['merge'](_0x1c9b90[_0x5407('0x3f')],{'$or':_['map'](_0x2a039a,function(_0x5d6ff1){if(_0x5d6ff1['type']!==_0x5407('0x42')){var _0x53d13c={};_0x53d13c[_0x5d6ff1[_0x5407('0x2c')]]={'$like':'%'+_0x254c37[_0x5407('0x35')]['filter']+'%'};return _0x53d13c;}})});}_0x1c9b90=_['merge']({},_0x1c9b90,_0x254c37[_0x5407('0x43')]);var _0x1d87af={'where':_0x1c9b90[_0x5407('0x3f')]};return db['Migration'][_0x5407('0x20')](_0x1d87af)[_0x5407('0x28')](function(_0x2257b1){_0x1f7067[_0x5407('0x20')]=_0x2257b1;if(_0x254c37[_0x5407('0x35')][_0x5407('0x44')]){_0x1c9b90['include']=[{'all':!![]}];}return db[_0x5407('0x45')][_0x5407('0x46')](_0x1c9b90);})[_0x5407('0x28')](function(_0x121073){_0x1f7067['rows']=_0x121073;return _0x1f7067;})['then'](respondWithFilteredResult(_0x2c9a85,_0x1c9b90))[_0x5407('0x47')](handleError(_0x2c9a85,null));}; \ No newline at end of file +var _0xfec3=['stack','name','send','index','map','Migration','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','json','apply','save','update','then','destroy','end','sendStatus','error'];(function(_0x4c3a32,_0x59e7f7){var _0x24d540=function(_0x1e5b6e){while(--_0x1e5b6e){_0x4c3a32['push'](_0x4c3a32['shift']());}};_0x24d540(++_0x59e7f7);}(_0xfec3,0x1c8));var _0x3fec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfec3[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x3fec('0x0'));var rimraf=require(_0x3fec('0x1'));var zipdir=require(_0x3fec('0x2'));var jsonpatch=require(_0x3fec('0x3'));var rp=require(_0x3fec('0x4'));var moment=require(_0x3fec('0x5'));var BPromise=require(_0x3fec('0x6'));var Mustache=require(_0x3fec('0x7'));var util=require(_0x3fec('0x8'));var path=require(_0x3fec('0x9'));var sox=require(_0x3fec('0xa'));var csv=require('to-csv');var ejs=require(_0x3fec('0xb'));var fs=require('fs');var fs_extra=require(_0x3fec('0xc'));var _=require(_0x3fec('0xd'));var squel=require('squel');var crypto=require(_0x3fec('0xe'));var jsforce=require(_0x3fec('0xf'));var deskjs=require(_0x3fec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3fec('0x11'));var Papa=require(_0x3fec('0x12'));var Redis=require(_0x3fec('0x13'));var authService=require(_0x3fec('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3fec('0x15'));var hardwareService=require(_0x3fec('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3fec('0x17'));var config=require(_0x3fec('0x18'));var licenseUtil=require(_0x3fec('0x19'));var db=require(_0x3fec('0x1a'))['db'];function respondWithStatusCode(_0x3dbab4,_0xb198fb){_0xb198fb=_0xb198fb||0xcc;return function(_0x29a591){if(_0x29a591){return _0x3dbab4['sendStatus'](_0xb198fb);}return _0x3dbab4[_0x3fec('0x1b')](_0xb198fb)['end']();};}function respondWithResult(_0x597ce8,_0x272822){_0x272822=_0x272822||0xc8;return function(_0x424ce6){if(_0x424ce6){return _0x597ce8[_0x3fec('0x1b')](_0x272822)['json'](_0x424ce6);}};}function respondWithFilteredResult(_0x471472,_0x1b0901){return function(_0x324c26){if(_0x324c26){var _0x393793=typeof _0x1b0901['offset']===_0x3fec('0x1c')&&typeof _0x1b0901[_0x3fec('0x1d')]==='undefined';var _0x43213c=_0x324c26[_0x3fec('0x1e')];var _0x15fc50=_0x393793?0x0:_0x1b0901[_0x3fec('0x1f')];var _0x37fb95=_0x393793?_0x324c26[_0x3fec('0x1e')]:_0x1b0901[_0x3fec('0x1f')]+_0x1b0901[_0x3fec('0x1d')];var _0x4f062a;if(_0x37fb95>=_0x43213c){_0x37fb95=_0x43213c;_0x4f062a=0xc8;}else{_0x4f062a=0xce;}_0x471472[_0x3fec('0x1b')](_0x4f062a);return _0x471472['set']('Content-Range',_0x15fc50+'-'+_0x37fb95+'/'+_0x43213c)[_0x3fec('0x20')](_0x324c26);}return null;};}function patchUpdates(_0x29468a){return function(_0x225d32){try{jsonpatch[_0x3fec('0x21')](_0x225d32,_0x29468a,!![]);}catch(_0x2e5dd8){return BPromise['reject'](_0x2e5dd8);}return _0x225d32[_0x3fec('0x22')]();};}function saveUpdates(_0x200094,_0x3ad193){return function(_0x113e89){if(_0x113e89){return _0x113e89[_0x3fec('0x23')](_0x200094)[_0x3fec('0x24')](function(_0x317152){return _0x317152;});}return null;};}function removeEntity(_0x315d01,_0x59f2e4){return function(_0x45a4f2){if(_0x45a4f2){return _0x45a4f2[_0x3fec('0x25')]()[_0x3fec('0x24')](function(){_0x315d01[_0x3fec('0x1b')](0xcc)[_0x3fec('0x26')]();});}};}function handleEntityNotFound(_0x2dc9c4,_0x19989c){return function(_0x568e62){if(!_0x568e62){_0x2dc9c4[_0x3fec('0x27')](0x194);}return _0x568e62;};}function handleError(_0x44adef,_0x3cf7bb){_0x3cf7bb=_0x3cf7bb||0x1f4;return function(_0x309ae1){logger[_0x3fec('0x28')](_0x309ae1[_0x3fec('0x29')]);if(_0x309ae1[_0x3fec('0x2a')]){delete _0x309ae1[_0x3fec('0x2a')];}_0x44adef['status'](_0x3cf7bb)[_0x3fec('0x2b')](_0x309ae1);};}exports[_0x3fec('0x2c')]=function(_0x2f5aa1,_0xbcd99){var _0xe4c288={},_0x367903={},_0x4a357a={'count':0x0,'rows':[]};var _0x2adac1=_[_0x3fec('0x2d')](db[_0x3fec('0x2e')][_0x3fec('0x2f')],function(_0x50a31f){return{'name':_0x50a31f['fieldName'],'type':_0x50a31f['type'][_0x3fec('0x30')]};});_0x367903[_0x3fec('0x31')]=_['map'](_0x2adac1,'name');_0x367903['query']=_[_0x3fec('0x32')](_0x2f5aa1[_0x3fec('0x33')]);_0x367903['filters']=_[_0x3fec('0x34')](_0x367903['model'],_0x367903[_0x3fec('0x33')]);_0xe4c288[_0x3fec('0x35')]=_[_0x3fec('0x34')](_0x367903[_0x3fec('0x31')],qs[_0x3fec('0x36')](_0x2f5aa1[_0x3fec('0x33')][_0x3fec('0x36')]));_0xe4c288[_0x3fec('0x35')]=_0xe4c288['attributes'][_0x3fec('0x37')]?_0xe4c288[_0x3fec('0x35')]:_0x367903[_0x3fec('0x31')];if(!_0x2f5aa1[_0x3fec('0x33')][_0x3fec('0x38')](_0x3fec('0x39'))){_0xe4c288[_0x3fec('0x1d')]=qs[_0x3fec('0x1d')](_0x2f5aa1['query'][_0x3fec('0x1d')]);_0xe4c288['offset']=qs[_0x3fec('0x1f')](_0x2f5aa1['query'][_0x3fec('0x1f')]);}_0xe4c288[_0x3fec('0x3a')]=qs[_0x3fec('0x3b')](_0x2f5aa1[_0x3fec('0x33')][_0x3fec('0x3b')]);_0xe4c288[_0x3fec('0x3c')]=qs['filters'](_[_0x3fec('0x3d')](_0x2f5aa1[_0x3fec('0x33')],_0x367903[_0x3fec('0x3e')]),_0x2adac1);if(_0x2f5aa1[_0x3fec('0x33')]['filter']){_0xe4c288['where']=_['merge'](_0xe4c288['where'],{'$or':_[_0x3fec('0x2d')](_0x2adac1,function(_0x362470){if(_0x362470['type']!==_0x3fec('0x3f')){var _0x548185={};_0x548185[_0x362470['name']]={'$like':'%'+_0x2f5aa1[_0x3fec('0x33')][_0x3fec('0x40')]+'%'};return _0x548185;}})});}_0xe4c288=_[_0x3fec('0x41')]({},_0xe4c288,_0x2f5aa1[_0x3fec('0x42')]);var _0x583f9b={'where':_0xe4c288['where']};return db[_0x3fec('0x2e')][_0x3fec('0x1e')](_0x583f9b)[_0x3fec('0x24')](function(_0xabbd98){_0x4a357a[_0x3fec('0x1e')]=_0xabbd98;if(_0x2f5aa1[_0x3fec('0x33')][_0x3fec('0x43')]){_0xe4c288[_0x3fec('0x44')]=[{'all':!![]}];}return db[_0x3fec('0x2e')][_0x3fec('0x45')](_0xe4c288);})[_0x3fec('0x24')](function(_0x159bb2){_0x4a357a['rows']=_0x159bb2;return _0x4a357a;})[_0x3fec('0x24')](respondWithFilteredResult(_0xbcd99,_0xe4c288))[_0x3fec('0x46')](handleError(_0xbcd99,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8edea2b..5292e01 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 _0x1b0c=['define','Migration','migrations','lodash','moment','request-promise','path','rimraf','./migration.attributes','exports'];(function(_0x3bd144,_0x1b6ccb){var _0x2beb55=function(_0x2049b3){while(--_0x2049b3){_0x3bd144['push'](_0x3bd144['shift']());}};_0x2beb55(++_0x1b6ccb);}(_0x1b0c,0x1cf));var _0xc1b0=function(_0x41e2af,_0x3662f8){_0x41e2af=_0x41e2af-0x0;var _0x41df19=_0x1b0c[_0x41e2af];return _0x41df19;};'use strict';var _=require(_0xc1b0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc1b0('0x1'));var BPromise=require('bluebird');var rp=require(_0xc1b0('0x2'));var fs=require('fs');var path=require(_0xc1b0('0x3'));var rimraf=require(_0xc1b0('0x4'));var config=require('../../config/environment');var attributes=require(_0xc1b0('0x5'));module[_0xc1b0('0x6')]=function(_0xd4a159,_0x5e13b0){return _0xd4a159[_0xc1b0('0x7')](_0xc1b0('0x8'),attributes,{'tableName':_0xc1b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dbf=['../../config/environment','define','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1f723d,_0x1aa12a){var _0x1477b6=function(_0x5262d2){while(--_0x5262d2){_0x1f723d['push'](_0x1f723d['shift']());}};_0x1477b6(++_0x1aa12a);}(_0x3dbf,0x122));var _0xf3db=function(_0x17403d,_0x37c6f9){_0x17403d=_0x17403d-0x0;var _0x1b130b=_0x3dbf[_0x17403d];return _0x1b130b;};'use strict';var _=require(_0xf3db('0x0'));var util=require(_0xf3db('0x1'));var logger=require(_0xf3db('0x2'))('api');var moment=require(_0xf3db('0x3'));var BPromise=require('bluebird');var rp=require(_0xf3db('0x4'));var fs=require('fs');var path=require(_0xf3db('0x5'));var rimraf=require('rimraf');var config=require(_0xf3db('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0xc1cb20,_0x24249d){return _0xc1cb20[_0xf3db('0x7')]('Migration',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 c795b5d..9e4c28e 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 _0x477a=['Migration,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x8bc472,_0x4cb826){var _0x550edd=function(_0x1cd10a){while(--_0x1cd10a){_0x8bc472['push'](_0x8bc472['shift']());}};_0x550edd(++_0x4cb826);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa477('0x0'));var util=require('util');var moment=require(_0xa477('0x1'));var BPromise=require(_0xa477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa477('0x3'));var db=require(_0xa477('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa477('0x5'));var config=require(_0xa477('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa477('0x7')][_0xa477('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x203871,_0x3463cd,_0x422a5d){return new BPromise(function(_0x788380,_0x2e9476){return client[_0xa477('0x9')](_0x203871,_0x422a5d)[_0xa477('0xa')](function(_0x512d8b){logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x3463cd,'request\x20sent',JSON['stringify'](_0x512d8b));if(_0x512d8b[_0xa477('0xd')]){if(_0x512d8b[_0xa477('0xd')][_0xa477('0xe')]===0x1f4){logger['error'](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x2e9476(_0x512d8b['error'][_0xa477('0xf')]);}logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x512d8b[_0xa477('0xd')][_0xa477('0xf')]);return _0x788380(_0x512d8b['error'][_0xa477('0xf')]);}else{logger[_0xa477('0xb')](_0xa477('0xc'),_0x3463cd,_0xa477('0x10'));_0x788380(_0x512d8b[_0xa477('0x11')][_0xa477('0xf')]);}})[_0xa477('0x12')](function(_0x90c085){logger[_0xa477('0xd')](_0xa477('0xc'),_0x3463cd,_0x90c085);_0x2e9476(_0x90c085);});});} \ No newline at end of file +var _0x31c2=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33356c,_0x53cecf){var _0x2c22bd=function(_0x44be37){while(--_0x44be37){_0x33356c['push'](_0x33356c['shift']());}};_0x2c22bd(++_0x53cecf);}(_0x31c2,0x98));var _0x231c=function(_0x5651da,_0x1f5a03){_0x5651da=_0x5651da-0x0;var _0x11a0f8=_0x31c2[_0x5651da];return _0x11a0f8;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x231c('0x1'));var rs=require(_0x231c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x231c('0x3'))['db'];var utils=require(_0x231c('0x4'));var logger=require(_0x231c('0x5'))(_0x231c('0x6'));var config=require(_0x231c('0x7'));var jayson=require(_0x231c('0x8'));var client=jayson[_0x231c('0x9')][_0x231c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5afc76,_0x1e3997,_0x4fd8b8){return new BPromise(function(_0x3dfccb,_0x396da8){return client[_0x231c('0xb')](_0x5afc76,_0x4fd8b8)[_0x231c('0xc')](function(_0x4cd3b8){logger[_0x231c('0xd')](_0x231c('0xe'),_0x1e3997,_0x231c('0xf'));logger[_0x231c('0x10')](_0x231c('0x11'),_0x1e3997,_0x231c('0xf'),JSON['stringify'](_0x4cd3b8));if(_0x4cd3b8['error']){if(_0x4cd3b8['error'][_0x231c('0x12')]===0x1f4){logger[_0x231c('0x13')](_0x231c('0xe'),_0x1e3997,_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);return _0x396da8(_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);}logger[_0x231c('0x13')](_0x231c('0xe'),_0x1e3997,_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);return _0x3dfccb(_0x4cd3b8[_0x231c('0x13')][_0x231c('0x14')]);}else{logger[_0x231c('0xd')]('Migration,\x20%s,\x20%s',_0x1e3997,_0x231c('0xf'));_0x3dfccb(_0x4cd3b8[_0x231c('0x15')][_0x231c('0x14')]);}})[_0x231c('0x16')](function(_0x40f4f6){logger['error'](_0x231c('0xe'),_0x1e3997,_0x40f4f6);_0x396da8(_0x40f4f6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7eccce5..d629739 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 _0x6237=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x6243bb,_0x269bd7){var _0x16ef17=function(_0x5771f1){while(--_0x5771f1){_0x6243bb['push'](_0x6243bb['shift']());}};_0x16ef17(++_0x269bd7);}(_0x6237,0xc4));var _0x7623=function(_0x20936e,_0x4d5283){_0x20936e=_0x20936e-0x0;var _0x50a212=_0x6237[_0x20936e];return _0x50a212;};'use strict';var multer=require(_0x7623('0x0'));var util=require(_0x7623('0x1'));var path=require(_0x7623('0x2'));var timeout=require(_0x7623('0x3'));var express=require(_0x7623('0x4'));var router=express[_0x7623('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7623('0x6'));var interaction=require(_0x7623('0x7'));var config=require(_0x7623('0x8'));var controller=require('./network.controller');router[_0x7623('0x9')]('/',auth[_0x7623('0xa')](),controller[_0x7623('0xb')]);router[_0x7623('0x9')]('/:id',auth[_0x7623('0xa')](),controller[_0x7623('0xc')]);router[_0x7623('0xd')]('/',auth['isAuthenticated'](),controller[_0x7623('0xe')]);router[_0x7623('0xf')](_0x7623('0x10'),auth[_0x7623('0xa')](),controller[_0x7623('0x11')]);router['delete'](_0x7623('0x10'),auth['isAuthenticated'](),controller[_0x7623('0x12')]);module[_0x7623('0x13')]=router; \ No newline at end of file +var _0xce14=['post','put','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1bc73b,_0x3d29b5){var _0x5e3c67=function(_0x40ab3a){while(--_0x40ab3a){_0x1bc73b['push'](_0x1bc73b['shift']());}};_0x5e3c67(++_0x3d29b5);}(_0xce14,0x17f));var _0x4ce1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xce14[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x4ce1('0x0'));var path=require('path');var timeout=require(_0x4ce1('0x1'));var express=require(_0x4ce1('0x2'));var router=express['Router']();var fs_extra=require(_0x4ce1('0x3'));var auth=require(_0x4ce1('0x4'));var interaction=require(_0x4ce1('0x5'));var config=require(_0x4ce1('0x6'));var controller=require(_0x4ce1('0x7'));router['get']('/',auth[_0x4ce1('0x8')](),controller[_0x4ce1('0x9')]);router[_0x4ce1('0xa')](_0x4ce1('0xb'),auth['isAuthenticated'](),controller[_0x4ce1('0xc')]);router[_0x4ce1('0xd')]('/',auth[_0x4ce1('0x8')](),controller['create']);router[_0x4ce1('0xe')](_0x4ce1('0xb'),auth[_0x4ce1('0x8')](),controller[_0x4ce1('0xf')]);router['delete'](_0x4ce1('0xb'),auth[_0x4ce1('0x8')](),controller[_0x4ce1('0x10')]);module[_0x4ce1('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 f0ad9f0..0070d27 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 _0x2a81=['exports','ENUM','localnet','externip','turn','STRING','sequelize'];(function(_0x349492,_0x3bde5c){var _0x32b30f=function(_0x2e1448){while(--_0x2e1448){_0x349492['push'](_0x349492['shift']());}};_0x32b30f(++_0x3bde5c);}(_0x2a81,0x18e));var _0x12a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a81[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x12a8('0x0'));module[_0x12a8('0x1')]={'type':{'type':Sequelize[_0x12a8('0x2')](_0x12a8('0x3'),_0x12a8('0x4'),'stun',_0x12a8('0x5'))},'value':{'type':Sequelize[_0x12a8('0x6')]},'username':{'type':Sequelize[_0x12a8('0x6')]},'password':{'type':Sequelize[_0x12a8('0x6')]}}; \ No newline at end of file +var _0x89d4=['STRING','sequelize','ENUM','externip','stun','turn'];(function(_0x4a8afe,_0x59363f){var _0x2cb948=function(_0x2aeb01){while(--_0x2aeb01){_0x4a8afe['push'](_0x4a8afe['shift']());}};_0x2cb948(++_0x59363f);}(_0x89d4,0x67));var _0x489d=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x89d4[_0x489b87];return _0x1823b6;};'use strict';var Sequelize=require(_0x489d('0x0'));module['exports']={'type':{'type':Sequelize[_0x489d('0x1')]('localnet',_0x489d('0x2'),_0x489d('0x3'),_0x489d('0x4'))},'value':{'type':Sequelize[_0x489d('0x5')]},'username':{'type':Sequelize[_0x489d('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 32d19c8..d5ce07c 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 _0xe886=['rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','show','params','keys','length','include','find','create','body','findAll','toUpperCase','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','join','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','readFileSync','server/files/templates/network.ejs','toLowerCase','chan_sip.so','update','STUN','/etc/asterisk/sip_xcally_%s.conf','destroy','format','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','undefined','limit','count','offset','set','Content-Range','json','then','end','sendStatus','stack','name','send','map','Network'];(function(_0x2aac44,_0x5395ce){var _0x4c5371=function(_0x45c0c8){while(--_0x45c0c8){_0x2aac44['push'](_0x2aac44['shift']());}};_0x4c5371(++_0x5395ce);}(_0xe886,0x130));var _0x6e88=function(_0x1de023,_0x17334d){_0x1de023=_0x1de023-0x0;var _0x1b25ff=_0xe886[_0x1de023];return _0x1b25ff;};'use strict';var util=require(_0x6e88('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e88('0x1'));var qs=require(_0x6e88('0x2'));var logger=require(_0x6e88('0x3'))(_0x6e88('0x4'));var config=require(_0x6e88('0x5'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6e88('0x6'));var client=jayson[_0x6e88('0x7')][_0x6e88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f0429,_0x241c9a,_0x285f50,_0x15f66a){return new Promise(function(_0x576da1,_0x23a356){var _0x26d716=_0x15f66a||client;return _0x26d716['request'](_0x2f0429,_0x285f50)['then'](function(_0x442953){logger['info'](_0x6e88('0x9'),_0x241c9a,_0x6e88('0xa'));logger['debug'](_0x6e88('0xb'),_0x241c9a,_0x6e88('0xa'),JSON[_0x6e88('0xc')](_0x442953));if(_0x442953[_0x6e88('0xd')]){if(_0x442953['error']['code']===0x1f4){logger['error'](_0x6e88('0x9'),_0x241c9a,_0x442953['error'][_0x6e88('0xe')]);return _0x23a356(_0x442953[_0x6e88('0xd')][_0x6e88('0xe')]);}logger[_0x6e88('0xd')](_0x6e88('0x9'),_0x241c9a,_0x442953[_0x6e88('0xd')][_0x6e88('0xe')]);return _0x576da1(_0x442953['error'][_0x6e88('0xe')]);}else{logger['info'](_0x6e88('0x9'),_0x241c9a,_0x6e88('0xa'));_0x576da1(_0x442953['result']['message']);}})[_0x6e88('0xf')](function(_0x24defe){logger['error'](_0x6e88('0x9'),_0x241c9a,_0x24defe);_0x23a356(_0x24defe);});});}function respondWithResult(_0x39cbaf,_0x535818){_0x535818=_0x535818||0xc8;return function(_0x389daa){if(_0x389daa){return _0x39cbaf[_0x6e88('0x10')](_0x535818)['json'](_0x389daa);}};}function respondWithFilteredResult(_0x1b1a4a,_0x6201bb){return function(_0x188359){if(_0x188359){var _0x1223e3=typeof _0x6201bb['offset']===_0x6e88('0x11')&&typeof _0x6201bb[_0x6e88('0x12')]===_0x6e88('0x11');var _0x7c270d=_0x188359[_0x6e88('0x13')];var _0x20ac32=_0x1223e3?0x0:_0x6201bb[_0x6e88('0x14')];var _0x362290=_0x1223e3?_0x188359[_0x6e88('0x13')]:_0x6201bb[_0x6e88('0x14')]+_0x6201bb['limit'];var _0x43e9bc;if(_0x362290>=_0x7c270d){_0x362290=_0x7c270d;_0x43e9bc=0xc8;}else{_0x43e9bc=0xce;}_0x1b1a4a[_0x6e88('0x10')](_0x43e9bc);return _0x1b1a4a[_0x6e88('0x15')](_0x6e88('0x16'),_0x20ac32+'-'+_0x362290+'/'+_0x7c270d)[_0x6e88('0x17')](_0x188359);}return null;};}function saveUpdates(_0x3fc4ac){return function(_0x49719e){if(_0x49719e){return _0x49719e['update'](_0x3fc4ac)[_0x6e88('0x18')](function(_0xf0554c){return _0xf0554c;});}return null;};}function removeEntity(_0x37ddb9){return function(_0xadfc2){if(_0xadfc2){return _0xadfc2['destroy']()['then'](function(){_0x37ddb9['status'](0xcc)[_0x6e88('0x19')]();});}};}function handleEntityNotFound(_0x559ea4){return function(_0x43d1b2){if(!_0x43d1b2){_0x559ea4[_0x6e88('0x1a')](0x194);}return _0x43d1b2;};}function handleError(_0x11ee1a,_0x224e23){_0x224e23=_0x224e23||0x1f4;return function(_0x3f33ed){logger[_0x6e88('0xd')](_0x3f33ed[_0x6e88('0x1b')]);if(_0x3f33ed[_0x6e88('0x1c')]){delete _0x3f33ed[_0x6e88('0x1c')];}_0x11ee1a[_0x6e88('0x10')](_0x224e23)[_0x6e88('0x1d')](_0x3f33ed);};}exports['index']=function(_0x5de4ae,_0x380369){var _0x4b8874={},_0xb3fe76={},_0x57378e={'count':0x0,'rows':[]};var _0x5414c1=_[_0x6e88('0x1e')](db[_0x6e88('0x1f')][_0x6e88('0x20')],function(_0x5c07fc){return{'name':_0x5c07fc[_0x6e88('0x21')],'type':_0x5c07fc['type'][_0x6e88('0x22')]};});_0xb3fe76[_0x6e88('0x23')]=_[_0x6e88('0x1e')](_0x5414c1,'name');_0xb3fe76[_0x6e88('0x24')]=_['keys'](_0x5de4ae['query']);_0xb3fe76[_0x6e88('0x25')]=_[_0x6e88('0x26')](_0xb3fe76[_0x6e88('0x23')],_0xb3fe76[_0x6e88('0x24')]);_0x4b8874[_0x6e88('0x27')]=_['intersection'](_0xb3fe76['model'],qs[_0x6e88('0x28')](_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x28')]));_0x4b8874[_0x6e88('0x27')]=_0x4b8874[_0x6e88('0x27')]['length']?_0x4b8874[_0x6e88('0x27')]:_0xb3fe76[_0x6e88('0x23')];if(!_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x29')](_0x6e88('0x2a'))){_0x4b8874[_0x6e88('0x12')]=qs['limit'](_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x12')]);_0x4b8874[_0x6e88('0x14')]=qs['offset'](_0x5de4ae[_0x6e88('0x24')]['offset']);}_0x4b8874[_0x6e88('0x2b')]=qs['sort'](_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x2c')]);_0x4b8874[_0x6e88('0x2d')]=qs[_0x6e88('0x25')](_[_0x6e88('0x2e')](_0x5de4ae[_0x6e88('0x24')],_0xb3fe76[_0x6e88('0x25')]),_0x5414c1);if(_0x5de4ae['query'][_0x6e88('0x2f')]){_0x4b8874[_0x6e88('0x2d')]=_[_0x6e88('0x30')](_0x4b8874[_0x6e88('0x2d')],{'$or':_['map'](_0x5414c1,function(_0x34e28d){if(_0x34e28d[_0x6e88('0x31')]!==_0x6e88('0x32')){var _0x34add2={};_0x34add2[_0x34e28d[_0x6e88('0x1c')]]={'$like':'%'+_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x2f')]+'%'};return _0x34add2;}})});}_0x4b8874=_[_0x6e88('0x30')]({},_0x4b8874,_0x5de4ae[_0x6e88('0x33')]);var _0x20349d={'where':_0x4b8874[_0x6e88('0x2d')]};return db[_0x6e88('0x1f')]['count'](_0x20349d)[_0x6e88('0x18')](function(_0x13d33f){_0x57378e[_0x6e88('0x13')]=_0x13d33f;if(_0x5de4ae[_0x6e88('0x24')][_0x6e88('0x34')]){_0x4b8874['include']=[{'all':!![]}];}return db[_0x6e88('0x1f')]['findAll'](_0x4b8874);})[_0x6e88('0x18')](function(_0xaac7ed){_0x57378e['rows']=_0xaac7ed;return _0x57378e;})[_0x6e88('0x18')](respondWithFilteredResult(_0x380369,_0x4b8874))[_0x6e88('0xf')](handleError(_0x380369,null));};exports[_0x6e88('0x35')]=function(_0x2151b9,_0x1f18d6){var _0x4f301a={'raw':!![],'where':{'id':_0x2151b9[_0x6e88('0x36')]['id']}},_0x387f5e={};_0x387f5e[_0x6e88('0x23')]=_[_0x6e88('0x37')](db[_0x6e88('0x1f')][_0x6e88('0x20')]);_0x387f5e[_0x6e88('0x24')]=_[_0x6e88('0x37')](_0x2151b9[_0x6e88('0x24')]);_0x387f5e[_0x6e88('0x25')]=_[_0x6e88('0x26')](_0x387f5e[_0x6e88('0x23')],_0x387f5e[_0x6e88('0x24')]);_0x4f301a[_0x6e88('0x27')]=_['intersection'](_0x387f5e['model'],qs[_0x6e88('0x28')](_0x2151b9['query'][_0x6e88('0x28')]));_0x4f301a['attributes']=_0x4f301a['attributes'][_0x6e88('0x38')]?_0x4f301a[_0x6e88('0x27')]:_0x387f5e[_0x6e88('0x23')];if(_0x2151b9[_0x6e88('0x24')][_0x6e88('0x34')]){_0x4f301a[_0x6e88('0x39')]=[{'all':!![]}];}_0x4f301a=_[_0x6e88('0x30')]({},_0x4f301a,_0x2151b9['options']);return db['Network'][_0x6e88('0x3a')](_0x4f301a)[_0x6e88('0x18')](handleEntityNotFound(_0x1f18d6,null))[_0x6e88('0x18')](respondWithResult(_0x1f18d6,null))['catch'](handleError(_0x1f18d6,null));};exports[_0x6e88('0x3b')]=function(_0x46dd80,_0x5737f5){var _0x26831d;return db['Network'][_0x6e88('0x3b')](_0x46dd80[_0x6e88('0x3c')],{'raw':!![]})[_0x6e88('0x18')](function(_0x34f5ba){_0x26831d=_0x34f5ba;return db[_0x6e88('0x1f')][_0x6e88('0x3d')]({'where':{'type':_0x46dd80[_0x6e88('0x3c')]['type']},'raw':!![]});})[_0x6e88('0x18')](function(_0x5bac77){if(_0x26831d[_0x6e88('0x31')][_0x6e88('0x3e')]()=='STUN'){var _0x160f1b=fs['readFileSync'](path['join'](config['root'],_0x6e88('0x3f')),_0x6e88('0x40'));var _0x5f2cfe=ejs[_0x6e88('0x41')](_0x160f1b,{'networks':_0x5bac77||[]});fs[_0x6e88('0x42')](_0x6e88('0x43'),_0x5f2cfe);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x26831d[_0x6e88('0x31')]['toUpperCase']()==_0x6e88('0x44')){var _0x25d003=fs['readFileSync'](path[_0x6e88('0x45')](config[_0x6e88('0x46')],_0x6e88('0x47')),_0x6e88('0x40'));var _0x3ea05e=ejs[_0x6e88('0x41')](_0x25d003,{'networks':_0x5bac77||[]});fs[_0x6e88('0x42')](_0x6e88('0x48'),_0x3ea05e);return respondWithRpcPromise(_0x6e88('0x49'),'create',{'module':_0x6e88('0x4a')});}else{var _0x2939f3=fs[_0x6e88('0x4b')](path[_0x6e88('0x45')](config['root'],_0x6e88('0x4c')),_0x6e88('0x40'));var _0x358ba9=ejs[_0x6e88('0x41')](_0x2939f3,{'networks':_0x5bac77||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x46dd80[_0x6e88('0x3c')]['type'][_0x6e88('0x4d')]()),_0x358ba9);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x3b'),{'module':_0x6e88('0x4e')});}})[_0x6e88('0x18')](function(){return _0x26831d;})[_0x6e88('0x18')](respondWithResult(_0x5737f5,0xc9))[_0x6e88('0xf')](handleError(_0x5737f5,null));};exports[_0x6e88('0x4f')]=function(_0x349a2f,_0x167617){var _0x5e35da;return db[_0x6e88('0x1f')][_0x6e88('0x3a')]({'where':{'id':_0x349a2f[_0x6e88('0x36')]['id']}})['then'](handleEntityNotFound(_0x167617,null))[_0x6e88('0x18')](saveUpdates(_0x349a2f[_0x6e88('0x3c')],null))[_0x6e88('0x18')](function(_0x823d7){if(_0x823d7){_0x5e35da=_0x823d7;return db['Network']['findAll']({'where':{'type':_0x5e35da[_0x6e88('0x31')]},'raw':!![]});}return null;})[_0x6e88('0x18')](function(_0x2787bb){if(_0x5e35da[_0x6e88('0x31')]['toUpperCase']()==_0x6e88('0x50')){var _0x3dc83f=fs['readFileSync'](path[_0x6e88('0x45')](config[_0x6e88('0x46')],_0x6e88('0x3f')),_0x6e88('0x40'));var _0x5b1fd0=ejs[_0x6e88('0x41')](_0x3dc83f,{'networks':_0x2787bb||[]});fs[_0x6e88('0x42')](_0x6e88('0x43'),_0x5b1fd0);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x4f'),{'module':_0x6e88('0x4a')});}else if(_0x5e35da[_0x6e88('0x31')][_0x6e88('0x3e')]()==_0x6e88('0x44')){var _0x5d6dcd=fs[_0x6e88('0x4b')](path[_0x6e88('0x45')](config[_0x6e88('0x46')],_0x6e88('0x47')),_0x6e88('0x40'));var _0x113d7d=ejs[_0x6e88('0x41')](_0x5d6dcd,{'networks':_0x2787bb||[]});fs[_0x6e88('0x42')](_0x6e88('0x48'),_0x113d7d);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x4f'),{'module':_0x6e88('0x4a')});}else{var _0x11aeb4=fs[_0x6e88('0x4b')](path['join'](config[_0x6e88('0x46')],_0x6e88('0x4c')),_0x6e88('0x40'));var _0x48d875=ejs[_0x6e88('0x41')](_0x11aeb4,{'networks':_0x2787bb||[]});fs[_0x6e88('0x42')](util['format'](_0x6e88('0x51'),_0x349a2f[_0x6e88('0x3c')][_0x6e88('0x31')][_0x6e88('0x4d')]()),_0x48d875);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x4f'),{'module':_0x6e88('0x4e')});}})[_0x6e88('0x18')](function(_0x2eac31){if(_0x2eac31){return _0x5e35da;}return null;})[_0x6e88('0x18')](respondWithResult(_0x167617,null))['catch'](handleError(_0x167617,null));};exports[_0x6e88('0x52')]=function(_0x421d0d,_0x4949e8){var _0x358374;return db[_0x6e88('0x1f')]['find']({'where':{'id':_0x421d0d[_0x6e88('0x36')]['id']}})[_0x6e88('0x18')](function(_0x2948ca){_0x358374=_0x2948ca;return _0x2948ca;})['then'](handleEntityNotFound(_0x4949e8,null))['then'](removeEntity(_0x4949e8,null))[_0x6e88('0x18')](function(){if(_0x358374){return db['Network']['findAll']({'where':{'type':_0x358374[_0x6e88('0x31')]},'raw':!![]});}})[_0x6e88('0x18')](function(_0x5ca3ec){if(_0x358374[_0x6e88('0x31')][_0x6e88('0x3e')]()==_0x6e88('0x50')){var _0xfe1851=fs[_0x6e88('0x4b')](path[_0x6e88('0x45')](config['root'],_0x6e88('0x3f')),_0x6e88('0x40'));var _0x2e1b2d=ejs['render'](_0xfe1851,{'networks':_0x5ca3ec||[]});fs['writeFileSync'](_0x6e88('0x43'),_0x2e1b2d);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x52'),{'module':_0x6e88('0x4a')});}else if(_0x358374[_0x6e88('0x31')][_0x6e88('0x3e')]()==_0x6e88('0x44')){var _0x4b4386=fs[_0x6e88('0x4b')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2ee442=ejs[_0x6e88('0x41')](_0x4b4386,{'networks':_0x5ca3ec||[]});fs[_0x6e88('0x42')](_0x6e88('0x48'),_0x2ee442);return respondWithRpcPromise('Reload',_0x6e88('0x52'),{'module':_0x6e88('0x4a')});}else{var _0x4b72d7=fs[_0x6e88('0x4b')](path['join'](config[_0x6e88('0x46')],_0x6e88('0x4c')),_0x6e88('0x40'));var _0xd48b52=ejs[_0x6e88('0x41')](_0x4b72d7,{'networks':_0x5ca3ec||[]});fs[_0x6e88('0x42')](util[_0x6e88('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x358374[_0x6e88('0x31')][_0x6e88('0x4d')]()),_0xd48b52);return respondWithRpcPromise(_0x6e88('0x49'),_0x6e88('0x52'),{'module':_0x6e88('0x4e')});}})[_0x6e88('0xf')](handleError(_0x4949e8,null));}; \ No newline at end of file +var _0xb4f3=['info','catch','status','offset','undefined','limit','count','set','Content-Range','end','sendStatus','stack','index','rawAttributes','type','model','map','name','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','Network','includeAll','findAll','rows','show','params','keys','include','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','root','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','STUN','/etc/asterisk/turn_xcally.conf','toLowerCase','destroy','ejs','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0xa3f3f7,_0x62d4a2){var _0x674200=function(_0x45d6fb){while(--_0x45d6fb){_0xa3f3f7['push'](_0xa3f3f7['shift']());}};_0x674200(++_0x62d4a2);}(_0xb4f3,0x185));var _0x3b4f=function(_0x2a3614,_0x841a31){_0x2a3614=_0x2a3614-0x0;var _0x22abbb=_0xb4f3[_0x2a3614];return _0x22abbb;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x3b4f('0x0'));var fs=require('fs');var _=require('lodash');var qs=require(_0x3b4f('0x1'));var logger=require(_0x3b4f('0x2'))('api');var config=require(_0x3b4f('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3b4f('0x4'));var client=jayson[_0x3b4f('0x5')][_0x3b4f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1df39b,_0x1d1b5f,_0x367fda,_0x595c91){return new Promise(function(_0x329adc,_0x1de3f5){var _0x30795c=_0x595c91||client;return _0x30795c[_0x3b4f('0x7')](_0x1df39b,_0x367fda)[_0x3b4f('0x8')](function(_0x11d4da){logger['info'](_0x3b4f('0x9'),_0x1d1b5f,'request\x20sent');logger[_0x3b4f('0xa')](_0x3b4f('0xb'),_0x1d1b5f,_0x3b4f('0xc'),JSON[_0x3b4f('0xd')](_0x11d4da));if(_0x11d4da[_0x3b4f('0xe')]){if(_0x11d4da[_0x3b4f('0xe')]['code']===0x1f4){logger[_0x3b4f('0xe')](_0x3b4f('0x9'),_0x1d1b5f,_0x11d4da[_0x3b4f('0xe')]['message']);return _0x1de3f5(_0x11d4da[_0x3b4f('0xe')][_0x3b4f('0xf')]);}logger[_0x3b4f('0xe')](_0x3b4f('0x9'),_0x1d1b5f,_0x11d4da[_0x3b4f('0xe')][_0x3b4f('0xf')]);return _0x329adc(_0x11d4da['error'][_0x3b4f('0xf')]);}else{logger[_0x3b4f('0x10')](_0x3b4f('0x9'),_0x1d1b5f,'request\x20sent');_0x329adc(_0x11d4da['result'][_0x3b4f('0xf')]);}})[_0x3b4f('0x11')](function(_0x55f7c0){logger['error'](_0x3b4f('0x9'),_0x1d1b5f,_0x55f7c0);_0x1de3f5(_0x55f7c0);});});}function respondWithResult(_0x53ea71,_0x56bb7c){_0x56bb7c=_0x56bb7c||0xc8;return function(_0x393438){if(_0x393438){return _0x53ea71[_0x3b4f('0x12')](_0x56bb7c)['json'](_0x393438);}};}function respondWithFilteredResult(_0x57d9bd,_0x33b9a4){return function(_0x5f05ce){if(_0x5f05ce){var _0x219dbc=typeof _0x33b9a4[_0x3b4f('0x13')]===_0x3b4f('0x14')&&typeof _0x33b9a4[_0x3b4f('0x15')]===_0x3b4f('0x14');var _0x59fb5e=_0x5f05ce[_0x3b4f('0x16')];var _0x3b195f=_0x219dbc?0x0:_0x33b9a4[_0x3b4f('0x13')];var _0x2b45f2=_0x219dbc?_0x5f05ce[_0x3b4f('0x16')]:_0x33b9a4[_0x3b4f('0x13')]+_0x33b9a4[_0x3b4f('0x15')];var _0x71bbe6;if(_0x2b45f2>=_0x59fb5e){_0x2b45f2=_0x59fb5e;_0x71bbe6=0xc8;}else{_0x71bbe6=0xce;}_0x57d9bd[_0x3b4f('0x12')](_0x71bbe6);return _0x57d9bd[_0x3b4f('0x17')](_0x3b4f('0x18'),_0x3b195f+'-'+_0x2b45f2+'/'+_0x59fb5e)['json'](_0x5f05ce);}return null;};}function saveUpdates(_0x3db4f4){return function(_0x5365df){if(_0x5365df){return _0x5365df['update'](_0x3db4f4)[_0x3b4f('0x8')](function(_0x31f6d5){return _0x31f6d5;});}return null;};}function removeEntity(_0x26f3a9){return function(_0x3367c6){if(_0x3367c6){return _0x3367c6['destroy']()[_0x3b4f('0x8')](function(){_0x26f3a9[_0x3b4f('0x12')](0xcc)[_0x3b4f('0x19')]();});}};}function handleEntityNotFound(_0x513b8c){return function(_0x164ed3){if(!_0x164ed3){_0x513b8c[_0x3b4f('0x1a')](0x194);}return _0x164ed3;};}function handleError(_0x3bb82f,_0x495f05){_0x495f05=_0x495f05||0x1f4;return function(_0x345672){logger[_0x3b4f('0xe')](_0x345672[_0x3b4f('0x1b')]);if(_0x345672['name']){delete _0x345672['name'];}_0x3bb82f[_0x3b4f('0x12')](_0x495f05)['send'](_0x345672);};}exports[_0x3b4f('0x1c')]=function(_0x37d2f6,_0x537426){var _0x25458c={},_0x54255f={},_0x3d7b07={'count':0x0,'rows':[]};var _0x343e6a=_['map'](db['Network'][_0x3b4f('0x1d')],function(_0xe9de42){return{'name':_0xe9de42['fieldName'],'type':_0xe9de42[_0x3b4f('0x1e')]['key']};});_0x54255f[_0x3b4f('0x1f')]=_[_0x3b4f('0x20')](_0x343e6a,_0x3b4f('0x21'));_0x54255f['query']=_['keys'](_0x37d2f6[_0x3b4f('0x22')]);_0x54255f['filters']=_['intersection'](_0x54255f['model'],_0x54255f[_0x3b4f('0x22')]);_0x25458c['attributes']=_[_0x3b4f('0x23')](_0x54255f[_0x3b4f('0x1f')],qs[_0x3b4f('0x24')](_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x24')]));_0x25458c['attributes']=_0x25458c[_0x3b4f('0x25')]['length']?_0x25458c[_0x3b4f('0x25')]:_0x54255f[_0x3b4f('0x1f')];if(!_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x26')]('nolimit')){_0x25458c[_0x3b4f('0x15')]=qs[_0x3b4f('0x15')](_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x15')]);_0x25458c[_0x3b4f('0x13')]=qs[_0x3b4f('0x13')](_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x13')]);}_0x25458c[_0x3b4f('0x27')]=qs[_0x3b4f('0x28')](_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x28')]);_0x25458c[_0x3b4f('0x29')]=qs['filters'](_[_0x3b4f('0x2a')](_0x37d2f6[_0x3b4f('0x22')],_0x54255f[_0x3b4f('0x2b')]),_0x343e6a);if(_0x37d2f6[_0x3b4f('0x22')]['filter']){_0x25458c['where']=_[_0x3b4f('0x2c')](_0x25458c[_0x3b4f('0x29')],{'$or':_[_0x3b4f('0x20')](_0x343e6a,function(_0x44ea5f){if(_0x44ea5f[_0x3b4f('0x1e')]!==_0x3b4f('0x2d')){var _0x591674={};_0x591674[_0x44ea5f[_0x3b4f('0x21')]]={'$like':'%'+_0x37d2f6['query'][_0x3b4f('0x2e')]+'%'};return _0x591674;}})});}_0x25458c=_[_0x3b4f('0x2c')]({},_0x25458c,_0x37d2f6[_0x3b4f('0x2f')]);var _0x12744c={'where':_0x25458c[_0x3b4f('0x29')]};return db[_0x3b4f('0x30')]['count'](_0x12744c)[_0x3b4f('0x8')](function(_0x3c8788){_0x3d7b07[_0x3b4f('0x16')]=_0x3c8788;if(_0x37d2f6[_0x3b4f('0x22')][_0x3b4f('0x31')]){_0x25458c['include']=[{'all':!![]}];}return db[_0x3b4f('0x30')][_0x3b4f('0x32')](_0x25458c);})[_0x3b4f('0x8')](function(_0xd4328f){_0x3d7b07[_0x3b4f('0x33')]=_0xd4328f;return _0x3d7b07;})[_0x3b4f('0x8')](respondWithFilteredResult(_0x537426,_0x25458c))['catch'](handleError(_0x537426,null));};exports[_0x3b4f('0x34')]=function(_0x5ad183,_0x450eff){var _0x21d2b2={'raw':!![],'where':{'id':_0x5ad183[_0x3b4f('0x35')]['id']}},_0x3ba830={};_0x3ba830['model']=_['keys'](db['Network'][_0x3b4f('0x1d')]);_0x3ba830['query']=_[_0x3b4f('0x36')](_0x5ad183['query']);_0x3ba830[_0x3b4f('0x2b')]=_[_0x3b4f('0x23')](_0x3ba830[_0x3b4f('0x1f')],_0x3ba830[_0x3b4f('0x22')]);_0x21d2b2[_0x3b4f('0x25')]=_[_0x3b4f('0x23')](_0x3ba830[_0x3b4f('0x1f')],qs[_0x3b4f('0x24')](_0x5ad183[_0x3b4f('0x22')]['fields']));_0x21d2b2[_0x3b4f('0x25')]=_0x21d2b2['attributes']['length']?_0x21d2b2[_0x3b4f('0x25')]:_0x3ba830[_0x3b4f('0x1f')];if(_0x5ad183[_0x3b4f('0x22')]['includeAll']){_0x21d2b2[_0x3b4f('0x37')]=[{'all':!![]}];}_0x21d2b2=_[_0x3b4f('0x2c')]({},_0x21d2b2,_0x5ad183[_0x3b4f('0x2f')]);return db[_0x3b4f('0x30')][_0x3b4f('0x38')](_0x21d2b2)[_0x3b4f('0x8')](handleEntityNotFound(_0x450eff,null))['then'](respondWithResult(_0x450eff,null))['catch'](handleError(_0x450eff,null));};exports[_0x3b4f('0x39')]=function(_0x3a33c3,_0x4ca6e0){var _0x1d769e;return db['Network']['create'](_0x3a33c3[_0x3b4f('0x3a')],{'raw':!![]})[_0x3b4f('0x8')](function(_0x2285f1){_0x1d769e=_0x2285f1;return db[_0x3b4f('0x30')]['findAll']({'where':{'type':_0x3a33c3[_0x3b4f('0x3a')][_0x3b4f('0x1e')]},'raw':!![]});})[_0x3b4f('0x8')](function(_0x2054e5){if(_0x1d769e[_0x3b4f('0x1e')][_0x3b4f('0x3b')]()=='STUN'){var _0x5844b9=fs[_0x3b4f('0x3c')](path[_0x3b4f('0x3d')](config['root'],_0x3b4f('0x3e')),'utf8');var _0xd44d95=ejs[_0x3b4f('0x3f')](_0x5844b9,{'networks':_0x2054e5||[]});fs[_0x3b4f('0x40')](_0x3b4f('0x41'),_0xd44d95);return respondWithRpcPromise(_0x3b4f('0x42'),'create',{'module':_0x3b4f('0x43')});}else if(_0x1d769e['type'][_0x3b4f('0x3b')]()==_0x3b4f('0x44')){var _0x3f212b=fs[_0x3b4f('0x3c')](path[_0x3b4f('0x3d')](config['root'],_0x3b4f('0x45')),_0x3b4f('0x46'));var _0x5abb43=ejs['render'](_0x3f212b,{'networks':_0x2054e5||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5abb43);return respondWithRpcPromise('Reload','create',{'module':_0x3b4f('0x43')});}else{var _0xad6086=fs['readFileSync'](path[_0x3b4f('0x3d')](config[_0x3b4f('0x47')],_0x3b4f('0x48')),'utf8');var _0x487cf4=ejs['render'](_0xad6086,{'networks':_0x2054e5||[]});fs[_0x3b4f('0x40')](util[_0x3b4f('0x49')](_0x3b4f('0x4a'),_0x3a33c3[_0x3b4f('0x3a')][_0x3b4f('0x1e')]['toLowerCase']()),_0x487cf4);return respondWithRpcPromise('Reload',_0x3b4f('0x39'),{'module':_0x3b4f('0x4b')});}})[_0x3b4f('0x8')](function(){return _0x1d769e;})[_0x3b4f('0x8')](respondWithResult(_0x4ca6e0,0xc9))['catch'](handleError(_0x4ca6e0,null));};exports[_0x3b4f('0x4c')]=function(_0x2cae99,_0x459db1){var _0x4aaa69;return db[_0x3b4f('0x30')][_0x3b4f('0x38')]({'where':{'id':_0x2cae99[_0x3b4f('0x35')]['id']}})[_0x3b4f('0x8')](handleEntityNotFound(_0x459db1,null))['then'](saveUpdates(_0x2cae99[_0x3b4f('0x3a')],null))[_0x3b4f('0x8')](function(_0x568a59){if(_0x568a59){_0x4aaa69=_0x568a59;return db[_0x3b4f('0x30')][_0x3b4f('0x32')]({'where':{'type':_0x4aaa69[_0x3b4f('0x1e')]},'raw':!![]});}return null;})[_0x3b4f('0x8')](function(_0x236c0e){if(_0x4aaa69[_0x3b4f('0x1e')][_0x3b4f('0x3b')]()==_0x3b4f('0x4d')){var _0x39c947=fs[_0x3b4f('0x3c')](path[_0x3b4f('0x3d')](config[_0x3b4f('0x47')],_0x3b4f('0x3e')),_0x3b4f('0x46'));var _0x1934d5=ejs[_0x3b4f('0x3f')](_0x39c947,{'networks':_0x236c0e||[]});fs[_0x3b4f('0x40')]('/etc/asterisk/stun_xcally.conf',_0x1934d5);return respondWithRpcPromise(_0x3b4f('0x42'),_0x3b4f('0x4c'),{'module':'res_stun_monitor.so'});}else if(_0x4aaa69[_0x3b4f('0x1e')][_0x3b4f('0x3b')]()==_0x3b4f('0x44')){var _0x239703=fs[_0x3b4f('0x3c')](path[_0x3b4f('0x3d')](config[_0x3b4f('0x47')],_0x3b4f('0x45')),_0x3b4f('0x46'));var _0x19fec1=ejs[_0x3b4f('0x3f')](_0x239703,{'networks':_0x236c0e||[]});fs[_0x3b4f('0x40')](_0x3b4f('0x4e'),_0x19fec1);return respondWithRpcPromise(_0x3b4f('0x42'),_0x3b4f('0x4c'),{'module':_0x3b4f('0x43')});}else{var _0x3eacad=fs['readFileSync'](path[_0x3b4f('0x3d')](config[_0x3b4f('0x47')],'server/files/templates/network.ejs'),_0x3b4f('0x46'));var _0x5f5d8a=ejs[_0x3b4f('0x3f')](_0x3eacad,{'networks':_0x236c0e||[]});fs[_0x3b4f('0x40')](util[_0x3b4f('0x49')](_0x3b4f('0x4a'),_0x2cae99[_0x3b4f('0x3a')][_0x3b4f('0x1e')][_0x3b4f('0x4f')]()),_0x5f5d8a);return respondWithRpcPromise(_0x3b4f('0x42'),_0x3b4f('0x4c'),{'module':_0x3b4f('0x4b')});}})['then'](function(_0x58188b){if(_0x58188b){return _0x4aaa69;}return null;})[_0x3b4f('0x8')](respondWithResult(_0x459db1,null))[_0x3b4f('0x11')](handleError(_0x459db1,null));};exports[_0x3b4f('0x50')]=function(_0x5b0f79,_0x416354){var _0x1852b7;return db['Network']['find']({'where':{'id':_0x5b0f79[_0x3b4f('0x35')]['id']}})[_0x3b4f('0x8')](function(_0x460fbb){_0x1852b7=_0x460fbb;return _0x460fbb;})[_0x3b4f('0x8')](handleEntityNotFound(_0x416354,null))[_0x3b4f('0x8')](removeEntity(_0x416354,null))[_0x3b4f('0x8')](function(){if(_0x1852b7){return db[_0x3b4f('0x30')][_0x3b4f('0x32')]({'where':{'type':_0x1852b7[_0x3b4f('0x1e')]},'raw':!![]});}})[_0x3b4f('0x8')](function(_0x502e77){if(_0x1852b7[_0x3b4f('0x1e')]['toUpperCase']()=='STUN'){var _0x442912=fs[_0x3b4f('0x3c')](path[_0x3b4f('0x3d')](config['root'],_0x3b4f('0x3e')),_0x3b4f('0x46'));var _0x1bdaae=ejs[_0x3b4f('0x3f')](_0x442912,{'networks':_0x502e77||[]});fs[_0x3b4f('0x40')](_0x3b4f('0x41'),_0x1bdaae);return respondWithRpcPromise(_0x3b4f('0x42'),_0x3b4f('0x50'),{'module':_0x3b4f('0x43')});}else if(_0x1852b7[_0x3b4f('0x1e')][_0x3b4f('0x3b')]()==_0x3b4f('0x44')){var _0x5c493f=fs[_0x3b4f('0x3c')](path['join'](config['root'],_0x3b4f('0x45')),'utf8');var _0x371390=ejs['render'](_0x5c493f,{'networks':_0x502e77||[]});fs[_0x3b4f('0x40')](_0x3b4f('0x4e'),_0x371390);return respondWithRpcPromise('Reload','destroy',{'module':_0x3b4f('0x43')});}else{var _0x2965d5=fs['readFileSync'](path[_0x3b4f('0x3d')](config[_0x3b4f('0x47')],_0x3b4f('0x48')),_0x3b4f('0x46'));var _0x46888b=ejs['render'](_0x2965d5,{'networks':_0x502e77||[]});fs['writeFileSync'](util[_0x3b4f('0x49')](_0x3b4f('0x4a'),_0x1852b7[_0x3b4f('0x1e')][_0x3b4f('0x4f')]()),_0x46888b);return respondWithRpcPromise(_0x3b4f('0x42'),_0x3b4f('0x50'),{'module':_0x3b4f('0x4b')});}})['catch'](handleError(_0x416354,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0a84085..442c771 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 _0xb688=['exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes'];(function(_0x37e12e,_0x54b9e8){var _0x26c194=function(_0x109edd){while(--_0x109edd){_0x37e12e['push'](_0x37e12e['shift']());}};_0x26c194(++_0x54b9e8);}(_0xb688,0xcf));var _0x8b68=function(_0x3877f1,_0x97f68f){_0x3877f1=_0x3877f1-0x0;var _0x167329=_0xb688[_0x3877f1];return _0x167329;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','Network','util'];(function(_0x47e9c6,_0x2fe34a){var _0x6ef772=function(_0x346f6c){while(--_0x346f6c){_0x47e9c6['push'](_0x47e9c6['shift']());}};_0x6ef772(++_0x2fe34a);}(_0xedd9,0xfc));var _0x9edd=function(_0x3606c7,_0x3c6257){_0x3606c7=_0x3606c7-0x0;var _0x1119f2=_0xedd9[_0x3606c7];return _0x1119f2;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 59daec7..10b6be7 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0xcd28fa,_0x971384){_0xcd28fa=_0xcd28fa-0x0;var _0x2cf686=_0x7a54[_0xcd28fa];return _0x2cf686;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x3b2f75,_0x35a8a7){_0x3b2f75=_0x3b2f75-0x0;var _0x51dbb2=_0x7a54[_0x3b2f75];return _0x51dbb2;};'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 24bc415..a8aefc2 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 _0x3c77=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','update','destroy','delete','removeAnswers'];(function(_0x48382f,_0x58f2b7){var _0x31ddce=function(_0x4ba7c3){while(--_0x4ba7c3){_0x48382f['push'](_0x48382f['shift']());}};_0x31ddce(++_0x58f2b7);}(_0x3c77,0x129));var _0x73c7=function(_0x26511a,_0x264a46){_0x26511a=_0x26511a-0x0;var _0x4e78d2=_0x3c77[_0x26511a];return _0x4e78d2;};'use strict';var multer=require(_0x73c7('0x0'));var util=require(_0x73c7('0x1'));var path=require(_0x73c7('0x2'));var timeout=require(_0x73c7('0x3'));var express=require(_0x73c7('0x4'));var router=express[_0x73c7('0x5')]();var fs_extra=require(_0x73c7('0x6'));var auth=require(_0x73c7('0x7'));var interaction=require(_0x73c7('0x8'));var config=require(_0x73c7('0x9'));var controller=require(_0x73c7('0xa'));router[_0x73c7('0xb')]('/',auth[_0x73c7('0xc')](),controller['index']);router['get'](_0x73c7('0xd'),auth[_0x73c7('0xc')](),controller[_0x73c7('0xe')]);router[_0x73c7('0xb')](_0x73c7('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x73c7('0xb')](_0x73c7('0x10'),auth[_0x73c7('0xc')](),controller['getDispositions']);router[_0x73c7('0xb')]('/:id/canned_answers',auth[_0x73c7('0xc')](),controller['getAnswers']);router[_0x73c7('0xb')](_0x73c7('0x11'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x73c7('0x12'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x13')]);router[_0x73c7('0xb')](_0x73c7('0x14'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x15')]);router['post']('/',auth[_0x73c7('0xc')](),controller[_0x73c7('0x16')]);router[_0x73c7('0x17')]('/:id/dispositions',auth[_0x73c7('0xc')](),controller[_0x73c7('0x18')]);router[_0x73c7('0x17')](_0x73c7('0x19'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x1a')]);router[_0x73c7('0x17')](_0x73c7('0x1b'),controller['notify']);router[_0x73c7('0x17')](_0x73c7('0x11'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x1c')]);router['post'](_0x73c7('0x14'),auth['isAuthenticated'](),controller[_0x73c7('0x1d')]);router[_0x73c7('0x17')](_0x73c7('0x1e'),auth['isAuthenticated'](),controller[_0x73c7('0x1f')]);router['put'](_0x73c7('0xf'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x20')]);router['delete'](_0x73c7('0xf'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x21')]);router['delete'](_0x73c7('0x10'),auth[_0x73c7('0xc')](),controller['removeDispositions']);router[_0x73c7('0x22')](_0x73c7('0x19'),auth[_0x73c7('0xc')](),controller[_0x73c7('0x23')]);router['delete'](_0x73c7('0x14'),auth[_0x73c7('0xc')](),controller['removeAgents']);module[_0x73c7('0x24')]=router; \ No newline at end of file +var _0x90b7=['/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','/:id/canned_answers','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','/describe','show','/:id/dispositions','getDispositions','getAnswers','getApplications','getInteractions'];(function(_0x18f32b,_0x30712e){var _0x362ffb=function(_0x3f4eed){while(--_0x3f4eed){_0x18f32b['push'](_0x18f32b['shift']());}};_0x362ffb(++_0x30712e);}(_0x90b7,0xc1));var _0x790b=function(_0xf7e6b7,_0x1095ca){_0xf7e6b7=_0xf7e6b7-0x0;var _0x7b8d95=_0x90b7[_0xf7e6b7];return _0x7b8d95;};'use strict';var multer=require(_0x790b('0x0'));var util=require(_0x790b('0x1'));var path=require(_0x790b('0x2'));var timeout=require('connect-timeout');var express=require(_0x790b('0x3'));var router=express['Router']();var fs_extra=require(_0x790b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x790b('0x5'));var config=require(_0x790b('0x6'));var controller=require(_0x790b('0x7'));router['get']('/',auth[_0x790b('0x8')](),controller['index']);router[_0x790b('0x9')](_0x790b('0xa'),auth[_0x790b('0x8')](),controller['describe']);router[_0x790b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x790b('0xb')]);router['get'](_0x790b('0xc'),auth[_0x790b('0x8')](),controller[_0x790b('0xd')]);router[_0x790b('0x9')]('/:id/canned_answers',auth[_0x790b('0x8')](),controller[_0x790b('0xe')]);router['get']('/:id/applications',auth[_0x790b('0x8')](),controller[_0x790b('0xf')]);router[_0x790b('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x790b('0x10')]);router[_0x790b('0x9')](_0x790b('0x11'),auth['isAuthenticated'](),controller[_0x790b('0x12')]);router[_0x790b('0x13')]('/',auth[_0x790b('0x8')](),controller['create']);router[_0x790b('0x13')](_0x790b('0xc'),auth[_0x790b('0x8')](),controller[_0x790b('0x14')]);router[_0x790b('0x13')]('/:id/canned_answers',auth[_0x790b('0x8')](),controller['addAnswer']);router['post'](_0x790b('0x15'),controller[_0x790b('0x16')]);router[_0x790b('0x13')](_0x790b('0x17'),auth[_0x790b('0x8')](),controller[_0x790b('0x18')]);router['post'](_0x790b('0x11'),auth[_0x790b('0x8')](),controller['addAgents']);router[_0x790b('0x13')](_0x790b('0x19'),auth[_0x790b('0x8')](),controller[_0x790b('0x1a')]);router[_0x790b('0x1b')](_0x790b('0x1c'),auth[_0x790b('0x8')](),controller[_0x790b('0x1d')]);router['delete'](_0x790b('0x1c'),auth[_0x790b('0x8')](),controller[_0x790b('0x1e')]);router[_0x790b('0x1f')]('/:id/dispositions',auth[_0x790b('0x8')](),controller[_0x790b('0x20')]);router[_0x790b('0x1f')](_0x790b('0x21'),auth[_0x790b('0x8')](),controller['removeAnswers']);router[_0x790b('0x1f')](_0x790b('0x11'),auth[_0x790b('0x8')](),controller['removeAgents']);module[_0x790b('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 25893ad..4f142d9 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 _0x17d1=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x17d1,0x89));var _0x117d=function(_0x4f0694,_0x8d01bf){_0x4f0694=_0x4f0694-0x0;var _0x3fe3db=_0x17d1[_0x4f0694];return _0x3fe3db;};'use strict';var Sequelize=require(_0x117d('0x0'));var rs=require(_0x117d('0x1'));module['exports']={'name':{'type':Sequelize[_0x117d('0x2')],'unique':_0x117d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x117d('0x2')]},'token':{'type':Sequelize[_0x117d('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x117d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x117d('0x4');}},'notificationSound':{'type':Sequelize[_0x117d('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x117d('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x117d('0x2')]},'queueTransfer':{'type':Sequelize[_0x117d('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x117d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x117d('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x117d('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x117d('0x5')],'defaultValue':![],'comment':_0x117d('0x8'),'set':function(_0x502f57){if(!_0x502f57)this[_0x117d('0x9')](_0x117d('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x502f57);}}}; \ No newline at end of file +var _0xb1c9=['STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xb1c9,0x1bc));var _0x9b1c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb1c9[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x9b1c('0x0'));var rs=require(_0x9b1c('0x1'));module[_0x9b1c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b1c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9b1c('0x4')]},'token':{'type':Sequelize[_0x9b1c('0x4')],'defaultValue':function(){return rs[_0x9b1c('0x5')]();}},'replyUri':{'type':Sequelize[_0x9b1c('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9b1c('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9b1c('0x6')],'defaultValue':function(){return _0x9b1c('0x7');}},'notificationSound':{'type':Sequelize[_0x9b1c('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9b1c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9b1c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9b1c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9b1c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9b1c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b1c('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x9b1c('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x9b1c('0x8')],'defaultValue':![],'comment':_0x9b1c('0xb'),'set':function(_0x50c746){if(!_0x50c746)this[_0x9b1c('0xc')](_0x9b1c('0xd'),null);this[_0x9b1c('0xc')]('mandatoryDisposition',_0x50c746);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 50f7b96..4b02a77 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 _0x1703=['../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','updatedAt','difference','CompanyId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','threadId','externalUrl','OpenchannelInteraction','spread','lastName','messageId','interaction','created','autoclose','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','push','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x38ac64,_0x3cc407){var _0x17f114=function(_0x4fceb4){while(--_0x4fceb4){_0x38ac64['push'](_0x38ac64['shift']());}};_0x17f114(++_0x3cc407);}(_0x1703,0x16a));var _0x3170=function(_0x6cfe96,_0x9d1bdc){_0x6cfe96=_0x6cfe96-0x0;var _0x2ddab6=_0x1703[_0x6cfe96];return _0x2ddab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3170('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3170('0x1'));var rp=require(_0x3170('0x2'));var moment=require(_0x3170('0x3'));var BPromise=require(_0x3170('0x4'));var Mustache=require(_0x3170('0x5'));var util=require('util');var path=require(_0x3170('0x6'));var sox=require('sox');var csv=require(_0x3170('0x7'));var ejs=require(_0x3170('0x8'));var fs=require('fs');var fs_extra=require(_0x3170('0x9'));var _=require('lodash');var squel=require(_0x3170('0xa'));var crypto=require(_0x3170('0xb'));var jsforce=require(_0x3170('0xc'));var deskjs=require(_0x3170('0xd'));var toCsv=require(_0x3170('0x7'));var querystring=require(_0x3170('0xe'));var Papa=require(_0x3170('0xf'));var Redis=require(_0x3170('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3170('0x11'));var as=require(_0x3170('0x12'));var hardwareService=require(_0x3170('0x13'));var logger=require(_0x3170('0x14'))('api');var utils=require(_0x3170('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3170('0x16'));var db=require(_0x3170('0x17'))['db'];config['redis']=_[_0x3170('0x18')](config['redis'],{'host':_0x3170('0x19'),'port':0x18eb});var socket=require(_0x3170('0x1a'))(new Redis(config[_0x3170('0x1b')]));require(_0x3170('0x1c'))[_0x3170('0x1d')](socket);var jayson=require(_0x3170('0x1e'));var client=jayson['client'][_0x3170('0x1f')]({'port':0x232c});var client9002=jayson[_0x3170('0x20')][_0x3170('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x49e125,_0x58eb00,_0x3a8e73,_0x20d658){return new BPromise(function(_0x337343,_0x557c1a){var _0x56476a=_0x20d658||client;return _0x56476a[_0x3170('0x21')](_0x49e125,_0x3a8e73)[_0x3170('0x22')](function(_0x316945){logger[_0x3170('0x23')](_0x3170('0x24'),_0x58eb00,_0x3170('0x25'));logger['debug'](_0x3170('0x26'),_0x58eb00,_0x3170('0x25'),JSON[_0x3170('0x27')](_0x316945));if(_0x316945[_0x3170('0x28')]){if(_0x316945['error'][_0x3170('0x29')]===0x1f4){logger[_0x3170('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x58eb00,_0x316945[_0x3170('0x28')]['message']);return _0x557c1a(_0x316945['error'][_0x3170('0x2a')]);}logger[_0x3170('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x58eb00,_0x316945[_0x3170('0x28')]['message']);return _0x337343(_0x316945['error']['message']);}else{logger['info'](_0x3170('0x24'),_0x58eb00,_0x3170('0x25'));_0x337343(_0x316945['result'][_0x3170('0x2a')]);}})[_0x3170('0x2b')](function(_0x2ceaa2){logger['error'](_0x3170('0x24'),_0x58eb00,_0x2ceaa2);_0x557c1a(_0x2ceaa2);});});}function respondWithStatusCode(_0xad5546,_0x2f3dee){_0x2f3dee=_0x2f3dee||0xcc;return function(_0x4eda85){if(_0x4eda85){return _0xad5546['sendStatus'](_0x2f3dee);}return _0xad5546[_0x3170('0x2c')](_0x2f3dee)[_0x3170('0x2d')]();};}function respondWithResult(_0x21db36,_0x364c11){_0x364c11=_0x364c11||0xc8;return function(_0x14a40c){if(_0x14a40c){return _0x21db36[_0x3170('0x2c')](_0x364c11)['json'](_0x14a40c);}};}function respondWithFilteredResult(_0xe879c8,_0x3fb53f){return function(_0x3e9dd1){if(_0x3e9dd1){var _0x143290=typeof _0x3fb53f[_0x3170('0x2e')]===_0x3170('0x2f')&&typeof _0x3fb53f[_0x3170('0x30')]==='undefined';var _0x1ee7f2=_0x3e9dd1[_0x3170('0x31')];var _0x1125b1=_0x143290?0x0:_0x3fb53f['offset'];var _0x5be547=_0x143290?_0x3e9dd1[_0x3170('0x31')]:_0x3fb53f['offset']+_0x3fb53f['limit'];var _0xaf18a6;if(_0x5be547>=_0x1ee7f2){_0x5be547=_0x1ee7f2;_0xaf18a6=0xc8;}else{_0xaf18a6=0xce;}_0xe879c8[_0x3170('0x2c')](_0xaf18a6);return _0xe879c8[_0x3170('0x32')](_0x3170('0x33'),_0x1125b1+'-'+_0x5be547+'/'+_0x1ee7f2)[_0x3170('0x34')](_0x3e9dd1);}return null;};}function patchUpdates(_0x2ad3b6){return function(_0x1d732e){try{jsonpatch[_0x3170('0x35')](_0x1d732e,_0x2ad3b6,!![]);}catch(_0x1fc7f6){return BPromise[_0x3170('0x36')](_0x1fc7f6);}return _0x1d732e['save']();};}function saveUpdates(_0x16ab75,_0x2ecae4){return function(_0x579ef6){if(_0x579ef6){return _0x579ef6['update'](_0x16ab75)[_0x3170('0x22')](function(_0x2fbdeb){return _0x2fbdeb;});}return null;};}function removeEntity(_0x580944,_0x439425){return function(_0x3ecbf1){if(_0x3ecbf1){return _0x3ecbf1['destroy']()['then'](function(){var _0x22388c=_0x3ecbf1[_0x3170('0x37')]({'plain':!![]});var _0x36b18c=_0x3170('0x38');return db[_0x3170('0x39')]['destroy']({'where':{'type':_0x36b18c,'resourceId':_0x22388c['id']}})['then'](function(){return _0x3ecbf1;});})[_0x3170('0x22')](function(){_0x580944[_0x3170('0x2c')](0xcc)[_0x3170('0x2d')]();});}};}function handleEntityNotFound(_0xd475c1,_0x1afdce){return function(_0x107dc4){if(!_0x107dc4){_0xd475c1[_0x3170('0x3a')](0x194);}return _0x107dc4;};}function handleError(_0x4ae5f9,_0x31e55b){_0x31e55b=_0x31e55b||0x1f4;return function(_0x4eeb11){logger[_0x3170('0x28')](_0x4eeb11[_0x3170('0x3b')]);if(_0x4eeb11['name']){delete _0x4eeb11['name'];}_0x4ae5f9[_0x3170('0x2c')](_0x31e55b)[_0x3170('0x3c')](_0x4eeb11);};}exports[_0x3170('0x3d')]=function(_0xe7c7cd,_0x1a2a1d){var _0x2f540c={'include':[{'model':db[_0x3170('0x3e')],'as':_0x3170('0x3f')}]},_0x2ac8bd={},_0x17f78={'count':0x0,'rows':[]};var _0x535bf7=_[_0x3170('0x40')](db[_0x3170('0x41')]['rawAttributes'],function(_0x73157e){return{'name':_0x73157e['fieldName'],'type':_0x73157e[_0x3170('0x42')]['key']};});_0x2ac8bd[_0x3170('0x43')]=_['map'](_0x535bf7,_0x3170('0x44'));_0x2ac8bd[_0x3170('0x45')]=_['keys'](_0xe7c7cd[_0x3170('0x45')]);_0x2ac8bd[_0x3170('0x46')]=_['intersection'](_0x2ac8bd[_0x3170('0x43')],_0x2ac8bd[_0x3170('0x45')]);_0x2f540c[_0x3170('0x47')]=_[_0x3170('0x48')](_0x2ac8bd[_0x3170('0x43')],qs[_0x3170('0x49')](_0xe7c7cd[_0x3170('0x45')][_0x3170('0x49')]));_0x2f540c[_0x3170('0x47')]=_0x2f540c[_0x3170('0x47')][_0x3170('0x4a')]?_0x2f540c[_0x3170('0x47')]:_0x2ac8bd[_0x3170('0x43')];if(!_0xe7c7cd['query'][_0x3170('0x4b')](_0x3170('0x4c'))){_0x2f540c[_0x3170('0x30')]=qs['limit'](_0xe7c7cd[_0x3170('0x45')][_0x3170('0x30')]);_0x2f540c[_0x3170('0x2e')]=qs['offset'](_0xe7c7cd['query'][_0x3170('0x2e')]);}_0x2f540c[_0x3170('0x4d')]=qs[_0x3170('0x4e')](_0xe7c7cd[_0x3170('0x45')]['sort']);_0x2f540c[_0x3170('0x4f')]=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0xe7c7cd[_0x3170('0x45')],_0x2ac8bd[_0x3170('0x46')]),_0x535bf7);if(_0xe7c7cd[_0x3170('0x45')][_0x3170('0x51')]){_0x2f540c[_0x3170('0x4f')]=_[_0x3170('0x52')](_0x2f540c[_0x3170('0x4f')],{'$or':_['map'](_0x535bf7,function(_0x372597){if(_0x372597['type']!==_0x3170('0x53')){var _0x5da9b7={};_0x5da9b7[_0x372597['name']]={'$like':'%'+_0xe7c7cd[_0x3170('0x45')][_0x3170('0x51')]+'%'};return _0x5da9b7;}})});}_0x2f540c=_[_0x3170('0x52')]({},_0x2f540c,_0xe7c7cd[_0x3170('0x54')]);var _0x46e11f={'where':_0x2f540c['where']};return db[_0x3170('0x41')][_0x3170('0x31')](_0x46e11f)['then'](function(_0xf63e97){_0x17f78[_0x3170('0x31')]=_0xf63e97;if(_0xe7c7cd[_0x3170('0x45')][_0x3170('0x55')]){_0x2f540c[_0x3170('0x56')]=[{'all':!![]}];}return db[_0x3170('0x41')][_0x3170('0x57')](_0x2f540c);})[_0x3170('0x22')](function(_0x5dd6b8){_0x17f78[_0x3170('0x58')]=_0x5dd6b8;return _0x17f78;})[_0x3170('0x22')](respondWithFilteredResult(_0x1a2a1d,_0x2f540c))['catch'](handleError(_0x1a2a1d,null));};exports[_0x3170('0x59')]=function(_0x3ecace,_0x1dcbee){var _0x457bf8={'raw':![],'where':{'id':_0x3ecace[_0x3170('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3170('0x3f')}]},_0x274a33={};_0x274a33[_0x3170('0x43')]=_[_0x3170('0x5b')](db[_0x3170('0x41')]['rawAttributes']);_0x274a33['query']=_[_0x3170('0x5b')](_0x3ecace['query']);_0x274a33['filters']=_[_0x3170('0x48')](_0x274a33[_0x3170('0x43')],_0x274a33[_0x3170('0x45')]);_0x457bf8[_0x3170('0x47')]=_[_0x3170('0x48')](_0x274a33[_0x3170('0x43')],qs['fields'](_0x3ecace[_0x3170('0x45')][_0x3170('0x49')]));_0x457bf8[_0x3170('0x47')]=_0x457bf8[_0x3170('0x47')][_0x3170('0x4a')]?_0x457bf8[_0x3170('0x47')]:_0x274a33[_0x3170('0x43')];if(_0x3ecace[_0x3170('0x45')]['includeAll']){_0x457bf8[_0x3170('0x56')]=[{'all':!![]}];}_0x457bf8=_[_0x3170('0x52')]({},_0x457bf8,_0x3ecace[_0x3170('0x54')]);return db[_0x3170('0x41')][_0x3170('0x5c')](_0x457bf8)[_0x3170('0x22')](handleEntityNotFound(_0x1dcbee,null))[_0x3170('0x22')](respondWithResult(_0x1dcbee,null))[_0x3170('0x2b')](handleError(_0x1dcbee,null));};exports['create']=function(_0x3f0939,_0x27b68f){return db[_0x3170('0x41')]['create'](_0x3f0939[_0x3170('0x5d')],{})[_0x3170('0x22')](function(_0x3945a8){var _0x5698cb=_0x3f0939[_0x3170('0x5e')][_0x3170('0x37')]({'plain':!![]});if(!_0x5698cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5698cb[_0x3170('0x5f')]===_0x3170('0x5e')){var _0x25d8b6=_0x3945a8['get']({'plain':!![]});var _0x5c7311=_0x3170('0x38');return db[_0x3170('0x60')][_0x3170('0x5c')]({'where':{'name':_0x5c7311,'userProfileId':_0x5698cb[_0x3170('0x61')]},'raw':!![]})['then'](function(_0x2c934c){if(_0x2c934c&&_0x2c934c['autoAssociation']===0x0){return db[_0x3170('0x39')][_0x3170('0x62')]({'name':_0x25d8b6[_0x3170('0x44')],'resourceId':_0x25d8b6['id'],'type':_0x2c934c[_0x3170('0x44')],'sectionId':_0x2c934c['id']},{})[_0x3170('0x22')](function(){return _0x3945a8;});}else{return _0x3945a8;}})['catch'](function(_0x4ba52c){logger[_0x3170('0x28')](_0x3170('0x63'),_0x4ba52c);throw _0x4ba52c;});}return _0x3945a8;})['then'](respondWithResult(_0x27b68f,0xc9))[_0x3170('0x2b')](handleError(_0x27b68f,null));};exports[_0x3170('0x64')]=function(_0x28a47b,_0x4af9ed){if(_0x28a47b[_0x3170('0x5d')]['id']){delete _0x28a47b['body']['id'];}return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x28a47b[_0x3170('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x3170('0x3f')}]})[_0x3170('0x22')](handleEntityNotFound(_0x4af9ed,null))['then'](saveUpdates(_0x28a47b[_0x3170('0x5d')],null))['then'](respondWithResult(_0x4af9ed,null))[_0x3170('0x2b')](handleError(_0x4af9ed,null));};exports[_0x3170('0x65')]=function(_0x50ed2d,_0x2d3b5d){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x50ed2d['params']['id']}})['then'](handleEntityNotFound(_0x2d3b5d,null))[_0x3170('0x22')](removeEntity(_0x2d3b5d,null))[_0x3170('0x2b')](handleError(_0x2d3b5d,null));};exports['describe']=function(_0x3f9c54,_0x7d3bbd){return db['OpenchannelAccount'][_0x3170('0x66')]()[_0x3170('0x22')](respondWithResult(_0x7d3bbd,null))['catch'](handleError(_0x7d3bbd,null));};exports[_0x3170('0x67')]=function(_0xf79354,_0x16bb6a,_0x1789ce){if(_0xf79354[_0x3170('0x5d')]['id']){delete _0xf79354[_0x3170('0x5d')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xf79354['params']['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x16bb6a,null))[_0x3170('0x22')](function(_0x1c381a){if(_0x1c381a){_0xf79354['body'][_0x3170('0x68')]=_0x1c381a['id'];return db[_0x3170('0x69')][_0x3170('0x62')](_0xf79354[_0x3170('0x5d')]);}})[_0x3170('0x22')](respondWithResult(_0x16bb6a,null))[_0x3170('0x2b')](handleError(_0x16bb6a,null));};exports[_0x3170('0x6a')]=function(_0x3183f1,_0x3ddde3,_0x1d300d){var _0x3bb127={'raw':![],'where':{}};var _0x330ce5={};var _0x56ac5f={'count':0x0,'rows':[]};return db[_0x3170('0x41')][_0x3170('0x6b')]({'where':{'id':_0x3183f1[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x3ddde3,null))[_0x3170('0x22')](function(_0x1b4d50){if(_0x1b4d50){_0x330ce5['model']=_[_0x3170('0x5b')](db[_0x3170('0x69')][_0x3170('0x6c')]);_0x330ce5[_0x3170('0x45')]=_[_0x3170('0x5b')](_0x3183f1[_0x3170('0x45')]);_0x330ce5[_0x3170('0x46')]=_[_0x3170('0x48')](_0x330ce5['model'],_0x330ce5[_0x3170('0x45')]);_0x3bb127[_0x3170('0x47')]=_[_0x3170('0x48')](_0x330ce5[_0x3170('0x43')],qs[_0x3170('0x49')](_0x3183f1[_0x3170('0x45')]['fields']));_0x3bb127['attributes']=_0x3bb127['attributes'][_0x3170('0x4a')]?_0x3bb127[_0x3170('0x47')]:_0x330ce5[_0x3170('0x43')];if(!_0x3183f1[_0x3170('0x45')]['hasOwnProperty'](_0x3170('0x4c'))){_0x3bb127['limit']=qs[_0x3170('0x30')](_0x3183f1[_0x3170('0x45')][_0x3170('0x30')]);_0x3bb127[_0x3170('0x2e')]=qs[_0x3170('0x2e')](_0x3183f1['query'][_0x3170('0x2e')]);}_0x3bb127[_0x3170('0x4d')]=qs['sort'](_0x3183f1['query'][_0x3170('0x4e')]);_0x3bb127['where']=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0x3183f1[_0x3170('0x45')],_0x330ce5[_0x3170('0x46')]));_0x3bb127[_0x3170('0x4f')]['OpenchannelAccountId']=_0x1b4d50['id'];if(_0x3183f1[_0x3170('0x45')][_0x3170('0x51')]){_0x3bb127[_0x3170('0x4f')]=_[_0x3170('0x52')](_0x3bb127[_0x3170('0x4f')],{'$or':_[_0x3170('0x40')](_0x3bb127[_0x3170('0x47')],function(_0x1cbbc2){var _0x26331e={};_0x26331e[_0x1cbbc2]={'$like':'%'+_0x3183f1[_0x3170('0x45')][_0x3170('0x51')]+'%'};return _0x26331e;})});}_0x3bb127=_[_0x3170('0x52')]({},_0x3bb127,_0x3183f1[_0x3170('0x54')]);return db[_0x3170('0x69')][_0x3170('0x31')]({'where':_0x3bb127['where']})[_0x3170('0x22')](function(_0x427cf8){_0x56ac5f[_0x3170('0x31')]=_0x427cf8;if(_0x3183f1[_0x3170('0x45')][_0x3170('0x55')]){_0x3bb127['include']=[{'all':!![]}];}return db[_0x3170('0x69')]['findAll'](_0x3bb127);})[_0x3170('0x22')](function(_0x14da32){_0x56ac5f[_0x3170('0x58')]=_0x14da32;return _0x56ac5f;});}})['then'](respondWithFilteredResult(_0x3ddde3,_0x3bb127))[_0x3170('0x2b')](handleError(_0x3ddde3,null));};exports['removeDispositions']=function(_0x563127,_0x3edce3,_0x1b88c1){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x563127[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x3edce3,null))['then'](function(_0x550f5d){if(_0x550f5d){return _0x550f5d[_0x3170('0x6d')](_0x563127[_0x3170('0x45')][_0x3170('0x6e')]);}})['then'](respondWithStatusCode(_0x3edce3,null))[_0x3170('0x2b')](handleError(_0x3edce3,null));};exports['addAnswer']=function(_0x563a76,_0x2f9d0f,_0x581820){if(_0x563a76[_0x3170('0x5d')]['id']){delete _0x563a76[_0x3170('0x5d')]['id'];}return db['OpenchannelAccount'][_0x3170('0x5c')]({'where':{'id':_0x563a76[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x2f9d0f,null))[_0x3170('0x22')](function(_0x1d8c26){if(_0x1d8c26){_0x563a76[_0x3170('0x5d')][_0x3170('0x68')]=_0x1d8c26['id'];return db[_0x3170('0x6f')][_0x3170('0x62')](_0x563a76[_0x3170('0x5d')]);}})[_0x3170('0x22')](respondWithResult(_0x2f9d0f,null))[_0x3170('0x2b')](handleError(_0x2f9d0f,null));};exports['getAnswers']=function(_0x5362f2,_0x171b14,_0x2fbfe9){var _0x11bc08={'raw':![],'where':{}};var _0x527fd4={};var _0x67fbf0={'count':0x0,'rows':[]};return db[_0x3170('0x41')]['findOne']({'where':{'id':_0x5362f2[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x171b14,null))[_0x3170('0x22')](function(_0x5bcd65){if(_0x5bcd65){_0x527fd4[_0x3170('0x43')]=_['keys'](db[_0x3170('0x6f')]['rawAttributes']);_0x527fd4[_0x3170('0x45')]=_[_0x3170('0x5b')](_0x5362f2['query']);_0x527fd4[_0x3170('0x46')]=_['intersection'](_0x527fd4['model'],_0x527fd4[_0x3170('0x45')]);_0x11bc08[_0x3170('0x47')]=_[_0x3170('0x48')](_0x527fd4[_0x3170('0x43')],qs['fields'](_0x5362f2[_0x3170('0x45')][_0x3170('0x49')]));_0x11bc08[_0x3170('0x47')]=_0x11bc08[_0x3170('0x47')][_0x3170('0x4a')]?_0x11bc08['attributes']:_0x527fd4[_0x3170('0x43')];if(!_0x5362f2[_0x3170('0x45')][_0x3170('0x4b')](_0x3170('0x4c'))){_0x11bc08[_0x3170('0x30')]=qs[_0x3170('0x30')](_0x5362f2['query']['limit']);_0x11bc08[_0x3170('0x2e')]=qs[_0x3170('0x2e')](_0x5362f2[_0x3170('0x45')][_0x3170('0x2e')]);}_0x11bc08[_0x3170('0x4d')]=qs[_0x3170('0x4e')](_0x5362f2[_0x3170('0x45')]['sort']);_0x11bc08[_0x3170('0x4f')]=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0x5362f2['query'],_0x527fd4['filters']));_0x11bc08['where'][_0x3170('0x68')]=_0x5bcd65['id'];if(_0x5362f2[_0x3170('0x45')][_0x3170('0x51')]){_0x11bc08['where']=_['merge'](_0x11bc08[_0x3170('0x4f')],{'$or':_[_0x3170('0x40')](_0x11bc08[_0x3170('0x47')],function(_0x48cc09){var _0x2643b1={};_0x2643b1[_0x48cc09]={'$like':'%'+_0x5362f2['query'][_0x3170('0x51')]+'%'};return _0x2643b1;})});}_0x11bc08=_['merge']({},_0x11bc08,_0x5362f2[_0x3170('0x54')]);return db[_0x3170('0x6f')][_0x3170('0x31')]({'where':_0x11bc08[_0x3170('0x4f')]})[_0x3170('0x22')](function(_0x35f71c){_0x67fbf0[_0x3170('0x31')]=_0x35f71c;if(_0x5362f2[_0x3170('0x45')][_0x3170('0x55')]){_0x11bc08[_0x3170('0x56')]=[{'all':!![]}];}return db[_0x3170('0x6f')][_0x3170('0x57')](_0x11bc08);})[_0x3170('0x22')](function(_0x50e706){_0x67fbf0[_0x3170('0x58')]=_0x50e706;return _0x67fbf0;});}})[_0x3170('0x22')](respondWithFilteredResult(_0x171b14,_0x11bc08))[_0x3170('0x2b')](handleError(_0x171b14,null));};exports[_0x3170('0x70')]=function(_0x583c73,_0x4f151a,_0x4d5a84){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x583c73['params']['id']}})['then'](handleEntityNotFound(_0x4f151a,null))[_0x3170('0x22')](function(_0x8aef7c){if(_0x8aef7c){return _0x8aef7c[_0x3170('0x70')](_0x583c73[_0x3170('0x45')][_0x3170('0x6e')]);}})[_0x3170('0x22')](respondWithStatusCode(_0x4f151a,null))[_0x3170('0x2b')](handleError(_0x4f151a,null));};exports[_0x3170('0x71')]=function(_0x50ba47,_0x356517,_0x4dc4e9){var _0x381ef8={'body':_0x50ba47['body'],'channel':_0x3170('0x72')};var _0x556144=[];var _0x4f1307=[];var _0x3f9463={};var _0x2fbc1f=![];return db[_0x3170('0x73')][_0x3170('0x66')]()[_0x3170('0x22')](function(_0x322d94){if(!_0x322d94){throw new db['Sequelize'][(_0x3170('0x74'))]('no\x20available\x20attributes');}_0x556144=_['difference'](_[_0x3170('0x5b')](_0x322d94),['createdAt',_0x3170('0x75')]);_0x4f1307=_[_0x3170('0x76')](_[_0x3170('0x5b')](_0x322d94),['createdAt',_0x3170('0x75'),_0x3170('0x77'),'ListId']);if(_0x50ba47[_0x3170('0x5d')]['id']){delete _0x50ba47[_0x3170('0x5d')]['id'];}if(_[_0x3170('0x78')](_0x50ba47['body']['from'])){throw new db[(_0x3170('0x79'))][(_0x3170('0x74'))](_0x3170('0x7a'));}if(_[_0x3170('0x78')](_0x50ba47[_0x3170('0x5d')]['body'])||_0x50ba47[_0x3170('0x5d')][_0x3170('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x3170('0x7b'));}if(_['isNil'](_0x50ba47['body'][_0x3170('0x7c')])){throw new db[(_0x3170('0x79'))]['ValidationError'](_0x3170('0x7d')+_0x4f1307);}if(!_[_0x3170('0x7e')](_0x4f1307,_0x50ba47[_0x3170('0x5d')][_0x3170('0x7c')])){throw new db[(_0x3170('0x79'))]['ValidationError'](_0x3170('0x7f')+_0x4f1307);}_0x3f9463[_0x50ba47[_0x3170('0x5d')][_0x3170('0x7c')]]=_0x50ba47[_0x3170('0x5d')][_0x3170('0x80')];})[_0x3170('0x22')](function(){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x50ba47[_0x3170('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x3170('0x81'),'include':[{'model':db[_0x3170('0x73')],'as':_0x3170('0x82'),'where':_0x3f9463,'limit':0x1,'order':[[_0x3170('0x75'),_0x3170('0x83')]]}]},{'model':db[_0x3170('0x84')],'as':_0x3170('0x85')}]});})[_0x3170('0x22')](handleEntityNotFound(_0x356517,null))['then'](function(_0x26e9a4){if(_0x26e9a4&&_0x26e9a4[_0x3170('0x81')]){_0x381ef8[_0x3170('0x86')]=_0x26e9a4;_0x381ef8[_0x3170('0x87')]=_0x26e9a4[_0x3170('0x85')];_0x381ef8[_0x3170('0x88')]=_0x26e9a4[_0x3170('0x81')];_0x381ef8[_0x3170('0x87')]=_[_0x3170('0x89')](_0x381ef8[_0x3170('0x87')],[_0x3170('0x8a')],[_0x3170('0x8b')]);if(_0x381ef8[_0x3170('0x86')][_0x3170('0x85')]){delete _0x381ef8[_0x3170('0x86')][_0x3170('0x85')];}if(_0x381ef8[_0x3170('0x86')][_0x3170('0x81')]&&_0x381ef8[_0x3170('0x86')][_0x3170('0x81')][_0x3170('0x82')][_0x3170('0x4a')]){return _0x381ef8['account']['List'][_0x3170('0x82')][0x0];}var _0x93a95f=_[_0x3170('0x18')](_0x50ba47[_0x3170('0x5d')],{'firstName':_0x50ba47[_0x3170('0x5d')][_0x3170('0x80')],'ListId':_0x26e9a4[_0x3170('0x8c')]});_0x93a95f[_0x50ba47[_0x3170('0x5d')][_0x3170('0x7c')]]=_0x50ba47[_0x3170('0x5d')]['from'];return db[_0x3170('0x73')][_0x3170('0x62')](_0x93a95f,{'fields':_0x556144,'raw':!![]});}})[_0x3170('0x22')](handleEntityNotFound(_0x356517,null))[_0x3170('0x22')](function(_0x2cf148){_0x381ef8[_0x3170('0x8d')]=_0x2cf148;if(_0x2cf148){var _0x56bca9={'ContactId':_0x2cf148['id'],'OpenchannelAccountId':_0x50ba47[_0x3170('0x5a')]['id'],'from':(_0x2cf148['firstName']||'')+'\x20'+(_0x2cf148['lastName']||'')};var _0x41d880={'OpenchannelAccountId':_0x50ba47[_0x3170('0x5a')]['id'],'closed':![]};if(_0x50ba47[_0x3170('0x5d')][_0x3170('0x8e')]){_0x41d880[_0x3170('0x8e')]=_0x50ba47[_0x3170('0x5d')][_0x3170('0x8e')];return db['OpenchannelInteraction'][_0x3170('0x5c')]({'where':_0x41d880})['then'](function(_0x47e931){if(_0x47e931){return[_0x47e931,![]];}_0x56bca9[_0x3170('0x8e')]=_0x50ba47[_0x3170('0x5d')][_0x3170('0x8e')];_0x56bca9['externalUrl']=_0x50ba47[_0x3170('0x5d')][_0x3170('0x8f')];return db[_0x3170('0x90')]['create'](_0x56bca9)[_0x3170('0x22')](function(_0x1a9a32){return[_0x1a9a32,!![]];});});}else{_0x41d880[_0x3170('0x8e')]=null;}_0x41d880['ContactId']=_0x2cf148['id'];return db[_0x3170('0x90')][_0x3170('0x5c')]({'where':_0x41d880})[_0x3170('0x22')](function(_0x1f82da){if(_0x1f82da){return[_0x1f82da,![]];}return db['OpenchannelInteraction'][_0x3170('0x62')](_0x56bca9)[_0x3170('0x22')](function(_0x463355){return[_0x463355,!![]];});});}})[_0x3170('0x91')](function(_0x114aff,_0x1a2cea){if(_0x114aff){_0x2fbc1f=_0x1a2cea;if(!_0x1a2cea){var _0x23a96e={'from':(_0x381ef8['contact']['firstName']||'')+'\x20'+(_0x381ef8[_0x3170('0x8d')][_0x3170('0x92')]||'')};if(_0x50ba47[_0x3170('0x5d')][_0x3170('0x8e')]&&_0x50ba47['body'][_0x3170('0x93')]&&_0x50ba47[_0x3170('0x5d')][_0x3170('0x8e')]!=_0x50ba47[_0x3170('0x5d')][_0x3170('0x93')]){_0x23a96e[_0x3170('0x8e')]=_0x50ba47['body'][_0x3170('0x93')];}return _0x114aff[_0x3170('0x64')](_0x23a96e);}else{return _0x114aff;}}})['then'](function(_0xf713ac){_0x381ef8[_0x3170('0x94')]=_0xf713ac[_0x3170('0x37')]({'plain':!![]});_0x381ef8['interaction'][_0x3170('0x95')]=_0x2fbc1f;if(_0x381ef8[_0x3170('0x94')]['created']){if(_0x381ef8[_0x3170('0x86')][_0x3170('0x96')]){_0x381ef8[_0x3170('0x87')]['push']({'id':0x0,'priority':_0x381ef8['applications'][_0x3170('0x4a')]+0x1,'app':'close','appdata':_0x3170('0x97'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x50ba47[_0x3170('0x5d')][_0x3170('0x5d')],'OpenchannelAccountId':_0x50ba47[_0x3170('0x5a')]['id'],'OpenchannelInteractionId':_0xf713ac['id'],'direction':'in','ContactId':_0x381ef8[_0x3170('0x8d')]['id'],'AttachmentId':_0x50ba47[_0x3170('0x5d')][_0x3170('0x98')]});})[_0x3170('0x22')](function(_0x243820){_0x381ef8[_0x3170('0x2a')]=_0x243820;if(_0x381ef8['interaction'][_0x3170('0x99')]){return db[_0x3170('0x9a')]['find']({'attributes':['id',_0x3170('0x44')],'where':{'id':_0x381ef8['interaction'][_0x3170('0x99')]}})[_0x3170('0x22')](function(_0xe32ede){if(_0xe32ede){_0x381ef8[_0x3170('0x87')][_0x3170('0x9b')]({'id':0x0,'priority':0x0,'app':_0x3170('0x9c'),'appdata':_0xe32ede[_0x3170('0x44')]+','+(_0x381ef8[_0x3170('0x86')][_0x3170('0x9d')]||0xa),'interval':_0x3170('0x9e')});_0x381ef8['forcedOwnership']=![];}return respondWithRpcPromise(_0x3170('0x9f'),_0x3170('0xa0'),_0x381ef8);});}return respondWithRpcPromise(_0x3170('0x9f'),'startRouting',_0x381ef8);})[_0x3170('0x22')](function(_0x145ad3){respondWithRpcPromise(_0x3170('0xa1'),_0x3170('0xa1'),{'event':_0x3170('0x71'),'message':_0x145ad3},client9002);return _0x145ad3;})[_0x3170('0x22')](respondWithResult(_0x356517,null))[_0x3170('0x2b')](handleError(_0x356517,null));};exports[_0x3170('0xa2')]=function(_0x5dacb7,_0x34916a){var _0x40f07a=_0x5dacb7[_0x3170('0x5a')]['id'];var _0x31fdfe=_0x5dacb7[_0x3170('0x5d')];var _0x5cebfb=0xc8;var _0x48bdfa=null;return db[_0x3170('0xa3')][_0x3170('0xa4')]({'isolationLevel':db['sequelize'][_0x3170('0xa5')][_0x3170('0xa6')]['READ_COMMITTED']},function(_0x24c2ca){return db[_0x3170('0x41')][_0x3170('0x6b')]({'where':{'id':_0x40f07a},'transaction':_0x24c2ca})[_0x3170('0x22')](function(_0xcb2fb3){if(_0xcb2fb3){return db[_0x3170('0x84')][_0x3170('0x65')]({'where':{'OpenchannelAccountId':_0x40f07a},'transaction':_0x24c2ca})['then'](function(){var _0x422796=_[_0x3170('0x40')](_0x31fdfe,function(_0x475465){_0x475465[_0x3170('0x68')]=_0x40f07a;return _0x475465;});return db[_0x3170('0x84')][_0x3170('0xa7')](_0x422796,{'transaction':_0x24c2ca});});}else{_0x5cebfb=0x194;_0x48bdfa=[];}});})[_0x3170('0x22')](function(){if(_0x5cebfb!==0x194){return db[_0x3170('0x84')][_0x3170('0xa8')]({'where':{'OpenchannelAccountId':_0x40f07a},'order':'priority'})[_0x3170('0x22')](function(_0x36c658){_0x48bdfa=_0x36c658;});}})[_0x3170('0x2b')](function(_0x54a964){_0x5cebfb=0x1f4;logger[_0x3170('0x28')](_0x54a964[_0x3170('0x3b')]);if(_0x54a964[_0x3170('0x44')]){delete _0x54a964[_0x3170('0x44')];}_0x48bdfa=_0x54a964;})['finally'](function(){if(_0x48bdfa===null){_0x34916a['sendStatus'](_0x5cebfb);}else{if(_0x5cebfb===0x1f4){_0x34916a[_0x3170('0x2c')](_0x5cebfb)[_0x3170('0x3c')](_0x48bdfa);}else{_0x34916a[_0x3170('0x2c')](_0x5cebfb)['json'](_0x48bdfa);}}});};exports[_0x3170('0xa9')]=function(_0x4ae07f,_0x3c4ac0,_0x3bf120){var _0x4aab21={};var _0x95ff40={};var _0x357249;var _0x57e8b1;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4ae07f['params']['id']}})['then'](handleEntityNotFound(_0x3c4ac0,null))[_0x3170('0x22')](function(_0x2e417c){if(_0x2e417c){_0x357249=_0x2e417c;_0x95ff40[_0x3170('0x43')]=_[_0x3170('0x5b')](db[_0x3170('0x84')][_0x3170('0x6c')]);_0x95ff40[_0x3170('0x45')]=_[_0x3170('0x5b')](_0x4ae07f['query']);_0x95ff40[_0x3170('0x46')]=_[_0x3170('0x48')](_0x95ff40['model'],_0x95ff40['query']);_0x4aab21[_0x3170('0x47')]=_[_0x3170('0x48')](_0x95ff40['model'],qs[_0x3170('0x49')](_0x4ae07f[_0x3170('0x45')][_0x3170('0x49')]));_0x4aab21[_0x3170('0x47')]=_0x4aab21[_0x3170('0x47')][_0x3170('0x4a')]?_0x4aab21[_0x3170('0x47')]:_0x95ff40[_0x3170('0x43')];_0x4aab21['order']=qs[_0x3170('0x4e')](_0x4ae07f['query'][_0x3170('0x4e')]);_0x4aab21['where']=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0x4ae07f[_0x3170('0x45')],_0x95ff40['filters']));if(_0x4ae07f[_0x3170('0x45')]['filter']){_0x4aab21[_0x3170('0x4f')]=_[_0x3170('0x52')](_0x4aab21[_0x3170('0x4f')],{'$or':_[_0x3170('0x40')](_0x4aab21[_0x3170('0x47')],function(_0x1710bf){var _0x1daa3b={};_0x1daa3b[_0x1710bf]={'$like':'%'+_0x4ae07f['query'][_0x3170('0x51')]+'%'};return _0x1daa3b;})});}_0x4aab21=_[_0x3170('0x52')]({},_0x4aab21,_0x4ae07f[_0x3170('0x54')]);return _0x357249[_0x3170('0xa9')](_0x4aab21);}})[_0x3170('0x22')](function(_0x1aa05d){if(_0x1aa05d){_0x57e8b1=_0x1aa05d[_0x3170('0x4a')];if(!_0x4ae07f['query'][_0x3170('0x4b')]('nolimit')){_0x4aab21[_0x3170('0x30')]=qs[_0x3170('0x30')](_0x4ae07f[_0x3170('0x45')][_0x3170('0x30')]);_0x4aab21[_0x3170('0x2e')]=qs['offset'](_0x4ae07f[_0x3170('0x45')][_0x3170('0x2e')]);}return _0x357249[_0x3170('0xa9')](_0x4aab21);}})[_0x3170('0x22')](function(_0x34d573){if(_0x34d573){return _0x34d573?{'count':_0x57e8b1,'rows':_0x34d573}:null;}})[_0x3170('0x22')](respondWithResult(_0x3c4ac0,null))[_0x3170('0x2b')](handleError(_0x3c4ac0,null));};exports[_0x3170('0xaa')]=function(_0x1d4a36,_0x4c6728,_0x3dae58){var _0xc59e07={'raw':![],'where':{}};var _0x7af231={};var _0x151023={'count':0x0,'rows':[]};return db[_0x3170('0x41')]['findOne']({'where':{'id':_0x1d4a36['params']['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x4c6728,null))['then'](function(_0x3241ae){if(_0x3241ae){_0x7af231['model']=_[_0x3170('0x5b')](db[_0x3170('0x90')][_0x3170('0x6c')]);_0x7af231['query']=_[_0x3170('0x5b')](_0x1d4a36['query']);_0x7af231['filters']=_['intersection'](_0x7af231[_0x3170('0x43')],_0x7af231[_0x3170('0x45')]);_0xc59e07['attributes']=_[_0x3170('0x48')](_0x7af231[_0x3170('0x43')],qs['fields'](_0x1d4a36['query']['fields']));_0xc59e07['attributes']=_0xc59e07[_0x3170('0x47')][_0x3170('0x4a')]?_0xc59e07[_0x3170('0x47')]:_0x7af231[_0x3170('0x43')];if(!_0x1d4a36['query'][_0x3170('0x4b')](_0x3170('0x4c'))){_0xc59e07[_0x3170('0x30')]=qs[_0x3170('0x30')](_0x1d4a36[_0x3170('0x45')]['limit']);_0xc59e07['offset']=qs[_0x3170('0x2e')](_0x1d4a36[_0x3170('0x45')][_0x3170('0x2e')]);}_0xc59e07[_0x3170('0x4d')]=qs['sort'](_0x1d4a36[_0x3170('0x45')][_0x3170('0x4e')]);_0xc59e07['where']=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0x1d4a36[_0x3170('0x45')],_0x7af231['filters']));_0xc59e07['where']['OpenchannelAccountId']=_0x3241ae['id'];if(_0x1d4a36['query'][_0x3170('0x51')]){_0xc59e07[_0x3170('0x4f')]=_[_0x3170('0x52')](_0xc59e07[_0x3170('0x4f')],{'$or':_[_0x3170('0x40')](_0xc59e07[_0x3170('0x47')],function(_0x149c50){var _0x156af={};_0x156af[_0x149c50]={'$like':'%'+_0x1d4a36[_0x3170('0x45')][_0x3170('0x51')]+'%'};return _0x156af;})});}_0xc59e07=_[_0x3170('0x52')]({},_0xc59e07,_0x1d4a36[_0x3170('0x54')]);return db[_0x3170('0x90')][_0x3170('0x31')]({'where':_0xc59e07[_0x3170('0x4f')]})['then'](function(_0xea2d6f){_0x151023[_0x3170('0x31')]=_0xea2d6f;if(_0x1d4a36[_0x3170('0x45')]['includeAll']){_0xc59e07[_0x3170('0x56')]=[{'model':db[_0x3170('0x73')],'as':_0x3170('0xab'),'required':![]},{'model':db[_0x3170('0x9a')],'as':_0x3170('0xac'),'attributes':[_0x3170('0x44'),_0x3170('0xad'),_0x3170('0xae')],'required':![]},{'model':db[_0x3170('0xaf')],'as':_0x3170('0xb0'),'attributes':['id',_0x3170('0x44'),_0x3170('0xb1')],'where':_0x1d4a36['query'][_0x3170('0xb2')]?{'id':_0x1d4a36['query'][_0x3170('0xb2')]}:undefined,'required':_0x1d4a36['query'][_0x3170('0xb2')]?!![]:![]}];}return db[_0x3170('0x90')][_0x3170('0x57')](_0xc59e07);})[_0x3170('0x22')](function(_0x2b43d7){_0x151023['rows']=_0x2b43d7;return _0x151023;});}})[_0x3170('0x22')](respondWithFilteredResult(_0x4c6728,_0xc59e07))[_0x3170('0x2b')](handleError(_0x4c6728,null));};exports[_0x3170('0xb3')]=function(_0x5b564b,_0x284bab,_0xff6589){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x5b564b[_0x3170('0x5a')]['id']}})['then'](handleEntityNotFound(_0x284bab,null))[_0x3170('0x22')](function(_0x320f85){if(_0x320f85){return _0x320f85['addAgents'](_0x5b564b['body'][_0x3170('0x6e')],_[_0x3170('0xb4')](_0x5b564b[_0x3170('0x5d')],[_0x3170('0x6e'),'id'])||{})['spread'](function(_0x1b82a3){for(var _0x3853f1=0x0;_0x3853f1<_0x5b564b[_0x3170('0x5d')][_0x3170('0x6e')]['length'];_0x3853f1+=0x1){socket[_0x3170('0xb5')](_0x3170('0xb6'),{'UserId':Number(_0x5b564b[_0x3170('0x5d')][_0x3170('0x6e')][_0x3853f1]),'OpenchannelAccountId':Number(_0x5b564b['params']['id'])});}return _0x1b82a3;});}})[_0x3170('0x22')](respondWithResult(_0x284bab,null))['catch'](handleError(_0x284bab,null));};exports[_0x3170('0xb7')]=function(_0x43cab5,_0x56d7e2,_0x26942a){return db[_0x3170('0x41')][_0x3170('0x5c')]({'where':{'id':_0x43cab5['params']['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x56d7e2,null))[_0x3170('0x22')](function(_0x2ab19f){if(_0x2ab19f){return _0x2ab19f['removeAgents'](_0x43cab5[_0x3170('0x45')][_0x3170('0x6e')])[_0x3170('0x22')](function(){if(_['isArray'](_0x43cab5[_0x3170('0x45')]['ids'])){for(var _0x4d72ce=0x0;_0x4d72ce<_0x43cab5[_0x3170('0x45')][_0x3170('0x6e')][_0x3170('0x4a')];_0x4d72ce+=0x1){socket[_0x3170('0xb5')](_0x3170('0xb8'),{'UserId':Number(_0x43cab5[_0x3170('0x45')]['ids'][_0x4d72ce]),'OpenchannelAccountId':Number(_0x43cab5[_0x3170('0x5a')]['id'])});}}else{socket[_0x3170('0xb5')](_0x3170('0xb8'),{'UserId':Number(_0x43cab5[_0x3170('0x45')][_0x3170('0x6e')]),'OpenchannelAccountId':Number(_0x43cab5[_0x3170('0x5a')]['id'])});}});}})[_0x3170('0x22')](respondWithStatusCode(_0x56d7e2,null))[_0x3170('0x2b')](handleError(_0x56d7e2,null));};exports[_0x3170('0xb9')]=function(_0x593d0d,_0x35f5c8,_0x218915){var _0x4b8ca5={};var _0x5631d6={};var _0x4d2180;var _0x442402;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x593d0d[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x35f5c8,null))['then'](function(_0x13fbff){if(_0x13fbff){_0x4d2180=_0x13fbff;_0x5631d6['model']=_[_0x3170('0x5b')](db[_0x3170('0x9a')]['rawAttributes']);_0x5631d6[_0x3170('0x45')]=_[_0x3170('0x5b')](_0x593d0d['query']);_0x5631d6[_0x3170('0x46')]=_[_0x3170('0x48')](_0x5631d6[_0x3170('0x43')],_0x5631d6[_0x3170('0x45')]);_0x4b8ca5[_0x3170('0x47')]=_[_0x3170('0x48')](_0x5631d6[_0x3170('0x43')],qs['fields'](_0x593d0d[_0x3170('0x45')][_0x3170('0x49')]));_0x4b8ca5[_0x3170('0x47')]=_0x4b8ca5[_0x3170('0x47')][_0x3170('0x4a')]?_0x4b8ca5[_0x3170('0x47')]:_0x5631d6[_0x3170('0x43')];_0x4b8ca5['order']=qs[_0x3170('0x4e')](_0x593d0d[_0x3170('0x45')][_0x3170('0x4e')]);_0x4b8ca5[_0x3170('0x4f')]=qs[_0x3170('0x46')](_[_0x3170('0x50')](_0x593d0d[_0x3170('0x45')],_0x5631d6[_0x3170('0x46')]));if(_0x593d0d[_0x3170('0x45')]['filter']){_0x4b8ca5[_0x3170('0x4f')]=_[_0x3170('0x52')](_0x4b8ca5[_0x3170('0x4f')],{'$or':_['map'](_0x4b8ca5[_0x3170('0x47')],function(_0x1f555f){var _0x491e5e={};_0x491e5e[_0x1f555f]={'$like':'%'+_0x593d0d['query'][_0x3170('0x51')]+'%'};return _0x491e5e;})});}_0x4b8ca5=_[_0x3170('0x52')]({},_0x4b8ca5,_0x593d0d['options']);return _0x4d2180[_0x3170('0xb9')](_0x4b8ca5);}})[_0x3170('0x22')](function(_0x5804f0){if(_0x5804f0){_0x442402=_0x5804f0[_0x3170('0x4a')];if(!_0x593d0d['query'][_0x3170('0x4b')](_0x3170('0x4c'))){_0x4b8ca5[_0x3170('0x30')]=qs[_0x3170('0x30')](_0x593d0d[_0x3170('0x45')][_0x3170('0x30')]);_0x4b8ca5[_0x3170('0x2e')]=qs['offset'](_0x593d0d[_0x3170('0x45')][_0x3170('0x2e')]);}return _0x4d2180['getAgents'](_0x4b8ca5);}})[_0x3170('0x22')](function(_0x391a1c){if(_0x391a1c){return _0x391a1c?{'count':_0x442402,'rows':_0x391a1c}:null;}})[_0x3170('0x22')](respondWithResult(_0x35f5c8,null))[_0x3170('0x2b')](handleError(_0x35f5c8,null));};exports[_0x3170('0x3c')]=function(_0x28c562,_0x36e41a,_0x32db6c){var _0x403dc5,_0x5c6a2e,_0x24e827;if(_['isNil'](_0x28c562[_0x3170('0x5d')][_0x3170('0x5d')])||_0x28c562[_0x3170('0x5d')][_0x3170('0x5d')]===''){throw new db[(_0x3170('0x79'))]['ValidationError'](_0x3170('0x7b'));}if(_[_0x3170('0x78')](_0x28c562['body']['to'])){}_0x403dc5=_0x28c562['body']['to'];return db[_0x3170('0x41')][_0x3170('0x6b')]({'where':{'id':_0x28c562[_0x3170('0x5a')]['id']}})[_0x3170('0x22')](handleEntityNotFound(_0x36e41a,null))['then'](function(_0x4b7883){if(_0x4b7883){return db[_0x3170('0x41')]['find']({'where':{'id':_0x4b7883['id']},'include':[{'model':db[_0x3170('0xba')],'as':_0x3170('0x81'),'include':[{'model':db[_0x3170('0x73')],'as':_0x3170('0x82'),'where':{[_0x4b7883[_0x3170('0x7c')]]:_0x403dc5},'limit':0x1,'order':[[_0x3170('0x75'),_0x3170('0x83')]]}]}]})[_0x3170('0x22')](handleEntityNotFound(_0x36e41a,null))[_0x3170('0x22')](function(_0x1689c6){if(_0x1689c6&&_0x1689c6[_0x3170('0x81')]){_0x5c6a2e=_0x1689c6['get']({'plain':!![]});if(_0x5c6a2e[_0x3170('0x81')]&&_0x5c6a2e['List'][_0x3170('0x82')][_0x3170('0x4a')]){return _0x5c6a2e[_0x3170('0x81')]['Contacts'][0x0];}return db[_0x3170('0x73')][_0x3170('0x62')](_[_0x3170('0x18')](_0x28c562[_0x3170('0x5d')],{'firstName':_0x403dc5,[_0x1689c6[_0x3170('0x7c')]]:_0x403dc5,'phone':_0x403dc5,'ListId':_0x5c6a2e['ListId']}));}})[_0x3170('0x22')](handleEntityNotFound(_0x36e41a,null))[_0x3170('0x22')](function(_0x2295fe){if(_0x2295fe){_0x24e827=_0x2295fe;return db['OpenchannelInteraction'][_0x3170('0x5c')]({'where':{'ContactId':_0x24e827['id'],'closed':![],'OpenchannelAccountId':_0x5c6a2e['id']}})[_0x3170('0x22')](function(_0x1e2144){if(_0x1e2144){return[_0x1e2144,![]];}return db[_0x3170('0x90')]['create']({'UserId':_0x28c562[_0x3170('0x5e')]['id'],'ContactId':_0x24e827['id'],'OpenchannelAccountId':_0x5c6a2e['id'],'lastMsgDirection':_0x3170('0xbb'),'firstMsgDirection':_0x3170('0xbb'),'Messages':[_[_0x3170('0x52')](_0x28c562[_0x3170('0x5d')],{'read':![],'body':_0x28c562[_0x3170('0x5d')][_0x3170('0x5d')],'OpenchannelAccountId':_0x5c6a2e['id'],'UserId':_0x28c562[_0x3170('0x5e')]['id'],'ContactId':_0x24e827['id']})]},{'include':[{'model':db[_0x3170('0xbc')],'as':_0x3170('0xbd')}]})[_0x3170('0x22')](function(_0x4708fb){return[_0x4708fb,!![]];});});}})[_0x3170('0x91')](function(_0x16e20a,_0x7575bd){if(_0x7575bd){return _0x16e20a;}return db[_0x3170('0xbc')][_0x3170('0x62')](_[_0x3170('0x52')](_0x28c562[_0x3170('0x5d')],{'read':![],'body':_0x28c562[_0x3170('0x5d')][_0x3170('0x5d')],'OpenchannelAccountId':_0x5c6a2e['id'],'OpenchannelInteractionId':_0x16e20a['id'],'UserId':_0x28c562[_0x3170('0x5e')]['id'],'ContactId':_0x24e827['id']}))[_0x3170('0x22')](function(_0x541166){_0x16e20a[_0x3170('0xbe')]['Messages']=[];_0x16e20a[_0x3170('0xbe')]['Messages'][_0x3170('0xbf')](_0x541166['dataValues']);return _0x16e20a;});});}})[_0x3170('0x22')](respondWithResult(_0x36e41a,null))[_0x3170('0x2b')](handleError(_0x36e41a,null));}; \ No newline at end of file +var _0xd6fd=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','OpenchannelAccount','includeAll','include','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','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\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','close','OpenchannelMessage','AttachmentId','UserId','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','User','Owner','fullname','internal','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','get','UserProfileResource','end','sendStatus','name','send','index','mandatoryDispositionPause','fieldName','model','map','keys'];(function(_0xf8e45b,_0x336e08){var _0xb38c41=function(_0x51f9d8){while(--_0x51f9d8){_0xf8e45b['push'](_0xf8e45b['shift']());}};_0xb38c41(++_0x336e08);}(_0xd6fd,0x7d));var _0xdd6f=function(_0x3ab0ac,_0x1ea9cf){_0x3ab0ac=_0x3ab0ac-0x0;var _0x1f743d=_0xd6fd[_0x3ab0ac];return _0x1f743d;};'use strict';var emlformat=require(_0xdd6f('0x0'));var rimraf=require(_0xdd6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd6f('0x2'));var BPromise=require(_0xdd6f('0x3'));var Mustache=require(_0xdd6f('0x4'));var util=require(_0xdd6f('0x5'));var path=require(_0xdd6f('0x6'));var sox=require(_0xdd6f('0x7'));var csv=require(_0xdd6f('0x8'));var ejs=require(_0xdd6f('0x9'));var fs=require('fs');var fs_extra=require(_0xdd6f('0xa'));var _=require(_0xdd6f('0xb'));var squel=require(_0xdd6f('0xc'));var crypto=require(_0xdd6f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd6f('0x8'));var querystring=require('querystring');var Papa=require(_0xdd6f('0xe'));var Redis=require(_0xdd6f('0xf'));var authService=require(_0xdd6f('0x10'));var qs=require(_0xdd6f('0x11'));var as=require(_0xdd6f('0x12'));var hardwareService=require(_0xdd6f('0x13'));var logger=require(_0xdd6f('0x14'))(_0xdd6f('0x15'));var utils=require(_0xdd6f('0x16'));var config=require(_0xdd6f('0x17'));var licenseUtil=require(_0xdd6f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xdd6f('0x19'),'port':0x18eb});var socket=require(_0xdd6f('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xdd6f('0x1b'));var client=jayson[_0xdd6f('0x1c')][_0xdd6f('0x1d')]({'port':0x232c});var client9002=jayson[_0xdd6f('0x1c')][_0xdd6f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x584502,_0x31c760,_0x427fb6,_0x1aeae3){return new BPromise(function(_0x5e72a6,_0x5c2904){var _0x7b14aa=_0x1aeae3||client;return _0x7b14aa['request'](_0x584502,_0x427fb6)[_0xdd6f('0x1e')](function(_0x4286ae){logger[_0xdd6f('0x1f')](_0xdd6f('0x20'),_0x31c760,_0xdd6f('0x21'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x31c760,'request\x20sent',JSON[_0xdd6f('0x22')](_0x4286ae));if(_0x4286ae[_0xdd6f('0x23')]){if(_0x4286ae['error']['code']===0x1f4){logger[_0xdd6f('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x31c760,_0x4286ae[_0xdd6f('0x23')]['message']);return _0x5c2904(_0x4286ae[_0xdd6f('0x23')][_0xdd6f('0x24')]);}logger['error'](_0xdd6f('0x20'),_0x31c760,_0x4286ae[_0xdd6f('0x23')][_0xdd6f('0x24')]);return _0x5e72a6(_0x4286ae['error'][_0xdd6f('0x24')]);}else{logger[_0xdd6f('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x31c760,_0xdd6f('0x21'));_0x5e72a6(_0x4286ae[_0xdd6f('0x25')]['message']);}})[_0xdd6f('0x26')](function(_0x5370d8){logger[_0xdd6f('0x23')](_0xdd6f('0x20'),_0x31c760,_0x5370d8);_0x5c2904(_0x5370d8);});});}function respondWithStatusCode(_0x3b8378,_0x161d29){_0x161d29=_0x161d29||0xcc;return function(_0x22f78d){if(_0x22f78d){return _0x3b8378['sendStatus'](_0x161d29);}return _0x3b8378[_0xdd6f('0x27')](_0x161d29)['end']();};}function respondWithResult(_0x2a601d,_0x59c825){_0x59c825=_0x59c825||0xc8;return function(_0x59e863){if(_0x59e863){return _0x2a601d[_0xdd6f('0x27')](_0x59c825)[_0xdd6f('0x28')](_0x59e863);}};}function respondWithFilteredResult(_0x20a235,_0x276ff4){return function(_0xcc4698){if(_0xcc4698){var _0x479696=typeof _0x276ff4['offset']===_0xdd6f('0x29')&&typeof _0x276ff4[_0xdd6f('0x2a')]===_0xdd6f('0x29');var _0x48f43a=_0xcc4698[_0xdd6f('0x2b')];var _0x3b7598=_0x479696?0x0:_0x276ff4[_0xdd6f('0x2c')];var _0x4e6509=_0x479696?_0xcc4698['count']:_0x276ff4[_0xdd6f('0x2c')]+_0x276ff4[_0xdd6f('0x2a')];var _0x10ee43;if(_0x4e6509>=_0x48f43a){_0x4e6509=_0x48f43a;_0x10ee43=0xc8;}else{_0x10ee43=0xce;}_0x20a235[_0xdd6f('0x27')](_0x10ee43);return _0x20a235[_0xdd6f('0x2d')](_0xdd6f('0x2e'),_0x3b7598+'-'+_0x4e6509+'/'+_0x48f43a)['json'](_0xcc4698);}return null;};}function patchUpdates(_0x50470e){return function(_0x1eae25){try{jsonpatch[_0xdd6f('0x2f')](_0x1eae25,_0x50470e,!![]);}catch(_0x39b5c3){return BPromise[_0xdd6f('0x30')](_0x39b5c3);}return _0x1eae25['save']();};}function saveUpdates(_0x2a56ad,_0xfb5cf6){return function(_0x4b8a78){if(_0x4b8a78){return _0x4b8a78['update'](_0x2a56ad)[_0xdd6f('0x1e')](function(_0x5ba68e){return _0x5ba68e;});}return null;};}function removeEntity(_0x1ea1a4,_0x44e58b){return function(_0x5fdc64){if(_0x5fdc64){return _0x5fdc64[_0xdd6f('0x31')]()[_0xdd6f('0x1e')](function(){var _0x2b3e7=_0x5fdc64[_0xdd6f('0x32')]({'plain':!![]});var _0x2e04e5='OpenchannelAccounts';return db[_0xdd6f('0x33')][_0xdd6f('0x31')]({'where':{'type':_0x2e04e5,'resourceId':_0x2b3e7['id']}})[_0xdd6f('0x1e')](function(){return _0x5fdc64;});})[_0xdd6f('0x1e')](function(){_0x1ea1a4['status'](0xcc)[_0xdd6f('0x34')]();});}};}function handleEntityNotFound(_0x1598ee,_0x34185d){return function(_0xbe9ae4){if(!_0xbe9ae4){_0x1598ee[_0xdd6f('0x35')](0x194);}return _0xbe9ae4;};}function handleError(_0x50d10e,_0x26fa78){_0x26fa78=_0x26fa78||0x1f4;return function(_0x22fbb2){logger[_0xdd6f('0x23')](_0x22fbb2['stack']);if(_0x22fbb2[_0xdd6f('0x36')]){delete _0x22fbb2[_0xdd6f('0x36')];}_0x50d10e[_0xdd6f('0x27')](_0x26fa78)[_0xdd6f('0x37')](_0x22fbb2);};}exports[_0xdd6f('0x38')]=function(_0x55dde0,_0x51ea3a){var _0x16d761={'include':[{'model':db['Pause'],'as':_0xdd6f('0x39')}]},_0x192e99={},_0x1894bf={'count':0x0,'rows':[]};var _0x83a6fc=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x441c5c){return{'name':_0x441c5c[_0xdd6f('0x3a')],'type':_0x441c5c['type']['key']};});_0x192e99[_0xdd6f('0x3b')]=_[_0xdd6f('0x3c')](_0x83a6fc,_0xdd6f('0x36'));_0x192e99['query']=_[_0xdd6f('0x3d')](_0x55dde0[_0xdd6f('0x3e')]);_0x192e99['filters']=_[_0xdd6f('0x3f')](_0x192e99['model'],_0x192e99[_0xdd6f('0x3e')]);_0x16d761[_0xdd6f('0x40')]=_[_0xdd6f('0x3f')](_0x192e99[_0xdd6f('0x3b')],qs[_0xdd6f('0x41')](_0x55dde0[_0xdd6f('0x3e')][_0xdd6f('0x41')]));_0x16d761[_0xdd6f('0x40')]=_0x16d761['attributes'][_0xdd6f('0x42')]?_0x16d761[_0xdd6f('0x40')]:_0x192e99['model'];if(!_0x55dde0[_0xdd6f('0x3e')]['hasOwnProperty'](_0xdd6f('0x43'))){_0x16d761[_0xdd6f('0x2a')]=qs[_0xdd6f('0x2a')](_0x55dde0['query'][_0xdd6f('0x2a')]);_0x16d761[_0xdd6f('0x2c')]=qs[_0xdd6f('0x2c')](_0x55dde0['query'][_0xdd6f('0x2c')]);}_0x16d761[_0xdd6f('0x44')]=qs[_0xdd6f('0x45')](_0x55dde0['query'][_0xdd6f('0x45')]);_0x16d761[_0xdd6f('0x46')]=qs[_0xdd6f('0x47')](_[_0xdd6f('0x48')](_0x55dde0['query'],_0x192e99['filters']),_0x83a6fc);if(_0x55dde0[_0xdd6f('0x3e')][_0xdd6f('0x49')]){_0x16d761[_0xdd6f('0x46')]=_[_0xdd6f('0x4a')](_0x16d761[_0xdd6f('0x46')],{'$or':_[_0xdd6f('0x3c')](_0x83a6fc,function(_0x5482dc){if(_0x5482dc['type']!=='VIRTUAL'){var _0x56fce8={};_0x56fce8[_0x5482dc[_0xdd6f('0x36')]]={'$like':'%'+_0x55dde0['query'][_0xdd6f('0x49')]+'%'};return _0x56fce8;}})});}_0x16d761=_[_0xdd6f('0x4a')]({},_0x16d761,_0x55dde0[_0xdd6f('0x4b')]);var _0x61de3b={'where':_0x16d761['where']};return db[_0xdd6f('0x4c')][_0xdd6f('0x2b')](_0x61de3b)[_0xdd6f('0x1e')](function(_0x2c3825){_0x1894bf['count']=_0x2c3825;if(_0x55dde0[_0xdd6f('0x3e')][_0xdd6f('0x4d')]){_0x16d761[_0xdd6f('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x16d761);})['then'](function(_0x2843dd){_0x1894bf['rows']=_0x2843dd;return _0x1894bf;})[_0xdd6f('0x1e')](respondWithFilteredResult(_0x51ea3a,_0x16d761))['catch'](handleError(_0x51ea3a,null));};exports[_0xdd6f('0x4f')]=function(_0x1ef203,_0x4a55ed){var _0x70fee6={'raw':![],'where':{'id':_0x1ef203[_0xdd6f('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xdd6f('0x39')}]},_0x3e873f={};_0x3e873f[_0xdd6f('0x3b')]=_['keys'](db[_0xdd6f('0x4c')][_0xdd6f('0x51')]);_0x3e873f[_0xdd6f('0x3e')]=_[_0xdd6f('0x3d')](_0x1ef203['query']);_0x3e873f['filters']=_[_0xdd6f('0x3f')](_0x3e873f[_0xdd6f('0x3b')],_0x3e873f[_0xdd6f('0x3e')]);_0x70fee6[_0xdd6f('0x40')]=_['intersection'](_0x3e873f[_0xdd6f('0x3b')],qs[_0xdd6f('0x41')](_0x1ef203['query'][_0xdd6f('0x41')]));_0x70fee6[_0xdd6f('0x40')]=_0x70fee6[_0xdd6f('0x40')]['length']?_0x70fee6[_0xdd6f('0x40')]:_0x3e873f['model'];if(_0x1ef203[_0xdd6f('0x3e')][_0xdd6f('0x4d')]){_0x70fee6[_0xdd6f('0x4e')]=[{'all':!![]}];}_0x70fee6=_['merge']({},_0x70fee6,_0x1ef203[_0xdd6f('0x4b')]);return db[_0xdd6f('0x4c')][_0xdd6f('0x52')](_0x70fee6)[_0xdd6f('0x1e')](handleEntityNotFound(_0x4a55ed,null))[_0xdd6f('0x1e')](respondWithResult(_0x4a55ed,null))['catch'](handleError(_0x4a55ed,null));};exports[_0xdd6f('0x53')]=function(_0x5ded06,_0x430a82){return db[_0xdd6f('0x4c')][_0xdd6f('0x53')](_0x5ded06['body'],{})[_0xdd6f('0x1e')](function(_0x37af4c){var _0x3e9e55=_0x5ded06[_0xdd6f('0x54')][_0xdd6f('0x32')]({'plain':!![]});if(!_0x3e9e55)throw new Error(_0xdd6f('0x55'));if(_0x3e9e55[_0xdd6f('0x56')]===_0xdd6f('0x54')){var _0x12212b=_0x37af4c[_0xdd6f('0x32')]({'plain':!![]});var _0x280194='OpenchannelAccounts';return db[_0xdd6f('0x57')][_0xdd6f('0x52')]({'where':{'name':_0x280194,'userProfileId':_0x3e9e55[_0xdd6f('0x58')]},'raw':!![]})[_0xdd6f('0x1e')](function(_0x3a2632){if(_0x3a2632&&_0x3a2632[_0xdd6f('0x59')]===0x0){return db[_0xdd6f('0x33')]['create']({'name':_0x12212b[_0xdd6f('0x36')],'resourceId':_0x12212b['id'],'type':_0x3a2632['name'],'sectionId':_0x3a2632['id']},{})['then'](function(){return _0x37af4c;});}else{return _0x37af4c;}})[_0xdd6f('0x26')](function(_0x178247){logger[_0xdd6f('0x23')](_0xdd6f('0x5a'),_0x178247);throw _0x178247;});}return _0x37af4c;})['then'](respondWithResult(_0x430a82,0xc9))[_0xdd6f('0x26')](handleError(_0x430a82,null));};exports[_0xdd6f('0x5b')]=function(_0xc53b3e,_0x41cd83){if(_0xc53b3e['body']['id']){delete _0xc53b3e['body']['id'];}return db[_0xdd6f('0x4c')]['find']({'where':{'id':_0xc53b3e['params']['id']},'include':[{'model':db[_0xdd6f('0x5c')],'as':_0xdd6f('0x39')}]})[_0xdd6f('0x1e')](handleEntityNotFound(_0x41cd83,null))['then'](saveUpdates(_0xc53b3e[_0xdd6f('0x5d')],null))[_0xdd6f('0x1e')](respondWithResult(_0x41cd83,null))[_0xdd6f('0x26')](handleError(_0x41cd83,null));};exports[_0xdd6f('0x31')]=function(_0x34fb87,_0x4a7908){return db[_0xdd6f('0x4c')][_0xdd6f('0x52')]({'where':{'id':_0x34fb87[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x4a7908,null))['then'](removeEntity(_0x4a7908,null))[_0xdd6f('0x26')](handleError(_0x4a7908,null));};exports[_0xdd6f('0x5e')]=function(_0x38a226,_0x4124aa){return db['OpenchannelAccount']['describe']()[_0xdd6f('0x1e')](respondWithResult(_0x4124aa,null))[_0xdd6f('0x26')](handleError(_0x4124aa,null));};exports['addDisposition']=function(_0x5c9a1b,_0x585b44,_0x4a37b3){if(_0x5c9a1b[_0xdd6f('0x5d')]['id']){delete _0x5c9a1b['body']['id'];}return db[_0xdd6f('0x4c')]['find']({'where':{'id':_0x5c9a1b[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x585b44,null))[_0xdd6f('0x1e')](function(_0x18a9a0){if(_0x18a9a0){_0x5c9a1b[_0xdd6f('0x5d')][_0xdd6f('0x5f')]=_0x18a9a0['id'];return db[_0xdd6f('0x60')][_0xdd6f('0x53')](_0x5c9a1b[_0xdd6f('0x5d')]);}})[_0xdd6f('0x1e')](respondWithResult(_0x585b44,null))[_0xdd6f('0x26')](handleError(_0x585b44,null));};exports[_0xdd6f('0x61')]=function(_0x11706e,_0x1dfac1,_0x1270ef){var _0x43096d={'raw':![],'where':{}};var _0x177942={};var _0x367961={'count':0x0,'rows':[]};return db[_0xdd6f('0x4c')][_0xdd6f('0x62')]({'where':{'id':_0x11706e[_0xdd6f('0x50')]['id']}})['then'](handleEntityNotFound(_0x1dfac1,null))[_0xdd6f('0x1e')](function(_0x3be55f){if(_0x3be55f){_0x177942[_0xdd6f('0x3b')]=_['keys'](db[_0xdd6f('0x60')][_0xdd6f('0x51')]);_0x177942[_0xdd6f('0x3e')]=_['keys'](_0x11706e['query']);_0x177942['filters']=_[_0xdd6f('0x3f')](_0x177942['model'],_0x177942['query']);_0x43096d[_0xdd6f('0x40')]=_['intersection'](_0x177942[_0xdd6f('0x3b')],qs[_0xdd6f('0x41')](_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x41')]));_0x43096d[_0xdd6f('0x40')]=_0x43096d[_0xdd6f('0x40')][_0xdd6f('0x42')]?_0x43096d[_0xdd6f('0x40')]:_0x177942[_0xdd6f('0x3b')];if(!_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x63')](_0xdd6f('0x43'))){_0x43096d[_0xdd6f('0x2a')]=qs[_0xdd6f('0x2a')](_0x11706e['query']['limit']);_0x43096d[_0xdd6f('0x2c')]=qs[_0xdd6f('0x2c')](_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x2c')]);}_0x43096d[_0xdd6f('0x44')]=qs[_0xdd6f('0x45')](_0x11706e['query'][_0xdd6f('0x45')]);_0x43096d[_0xdd6f('0x46')]=qs['filters'](_[_0xdd6f('0x48')](_0x11706e[_0xdd6f('0x3e')],_0x177942[_0xdd6f('0x47')]));_0x43096d[_0xdd6f('0x46')]['OpenchannelAccountId']=_0x3be55f['id'];if(_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x49')]){_0x43096d[_0xdd6f('0x46')]=_[_0xdd6f('0x4a')](_0x43096d['where'],{'$or':_['map'](_0x43096d[_0xdd6f('0x40')],function(_0x592013){var _0x3cae5c={};_0x3cae5c[_0x592013]={'$like':'%'+_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x49')]+'%'};return _0x3cae5c;})});}_0x43096d=_[_0xdd6f('0x4a')]({},_0x43096d,_0x11706e[_0xdd6f('0x4b')]);return db[_0xdd6f('0x60')][_0xdd6f('0x2b')]({'where':_0x43096d[_0xdd6f('0x46')]})[_0xdd6f('0x1e')](function(_0xb43290){_0x367961['count']=_0xb43290;if(_0x11706e[_0xdd6f('0x3e')][_0xdd6f('0x4d')]){_0x43096d[_0xdd6f('0x4e')]=[{'all':!![]}];}return db[_0xdd6f('0x60')][_0xdd6f('0x64')](_0x43096d);})['then'](function(_0x18dd6d){_0x367961[_0xdd6f('0x65')]=_0x18dd6d;return _0x367961;});}})[_0xdd6f('0x1e')](respondWithFilteredResult(_0x1dfac1,_0x43096d))['catch'](handleError(_0x1dfac1,null));};exports['removeDispositions']=function(_0x4d6eca,_0x5e2828,_0x223fe0){return db[_0xdd6f('0x4c')]['find']({'where':{'id':_0x4d6eca[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x5e2828,null))[_0xdd6f('0x1e')](function(_0x46768e){if(_0x46768e){return _0x46768e[_0xdd6f('0x66')](_0x4d6eca[_0xdd6f('0x3e')][_0xdd6f('0x67')]);}})[_0xdd6f('0x1e')](respondWithStatusCode(_0x5e2828,null))[_0xdd6f('0x26')](handleError(_0x5e2828,null));};exports['addAnswer']=function(_0x3d2c75,_0xddfef,_0x36e67a){if(_0x3d2c75[_0xdd6f('0x5d')]['id']){delete _0x3d2c75['body']['id'];}return db['OpenchannelAccount'][_0xdd6f('0x52')]({'where':{'id':_0x3d2c75[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0xddfef,null))[_0xdd6f('0x1e')](function(_0x4ddac8){if(_0x4ddac8){_0x3d2c75[_0xdd6f('0x5d')][_0xdd6f('0x5f')]=_0x4ddac8['id'];return db[_0xdd6f('0x68')][_0xdd6f('0x53')](_0x3d2c75[_0xdd6f('0x5d')]);}})[_0xdd6f('0x1e')](respondWithResult(_0xddfef,null))[_0xdd6f('0x26')](handleError(_0xddfef,null));};exports[_0xdd6f('0x69')]=function(_0x2e0668,_0x1877f9,_0x22f6b8){var _0x155b2e={'raw':![],'where':{}};var _0x343947={};var _0x479b57={'count':0x0,'rows':[]};return db[_0xdd6f('0x4c')][_0xdd6f('0x62')]({'where':{'id':_0x2e0668[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x1877f9,null))[_0xdd6f('0x1e')](function(_0x3d9bce){if(_0x3d9bce){_0x343947[_0xdd6f('0x3b')]=_[_0xdd6f('0x3d')](db[_0xdd6f('0x68')]['rawAttributes']);_0x343947[_0xdd6f('0x3e')]=_[_0xdd6f('0x3d')](_0x2e0668['query']);_0x343947[_0xdd6f('0x47')]=_['intersection'](_0x343947['model'],_0x343947[_0xdd6f('0x3e')]);_0x155b2e[_0xdd6f('0x40')]=_[_0xdd6f('0x3f')](_0x343947[_0xdd6f('0x3b')],qs[_0xdd6f('0x41')](_0x2e0668[_0xdd6f('0x3e')]['fields']));_0x155b2e[_0xdd6f('0x40')]=_0x155b2e[_0xdd6f('0x40')][_0xdd6f('0x42')]?_0x155b2e[_0xdd6f('0x40')]:_0x343947[_0xdd6f('0x3b')];if(!_0x2e0668[_0xdd6f('0x3e')]['hasOwnProperty'](_0xdd6f('0x43'))){_0x155b2e[_0xdd6f('0x2a')]=qs['limit'](_0x2e0668[_0xdd6f('0x3e')][_0xdd6f('0x2a')]);_0x155b2e['offset']=qs[_0xdd6f('0x2c')](_0x2e0668['query']['offset']);}_0x155b2e[_0xdd6f('0x44')]=qs[_0xdd6f('0x45')](_0x2e0668[_0xdd6f('0x3e')][_0xdd6f('0x45')]);_0x155b2e[_0xdd6f('0x46')]=qs['filters'](_[_0xdd6f('0x48')](_0x2e0668['query'],_0x343947['filters']));_0x155b2e[_0xdd6f('0x46')][_0xdd6f('0x5f')]=_0x3d9bce['id'];if(_0x2e0668['query'][_0xdd6f('0x49')]){_0x155b2e[_0xdd6f('0x46')]=_[_0xdd6f('0x4a')](_0x155b2e['where'],{'$or':_[_0xdd6f('0x3c')](_0x155b2e[_0xdd6f('0x40')],function(_0x47e9e0){var _0x29e977={};_0x29e977[_0x47e9e0]={'$like':'%'+_0x2e0668[_0xdd6f('0x3e')][_0xdd6f('0x49')]+'%'};return _0x29e977;})});}_0x155b2e=_['merge']({},_0x155b2e,_0x2e0668[_0xdd6f('0x4b')]);return db['CannedAnswer']['count']({'where':_0x155b2e[_0xdd6f('0x46')]})[_0xdd6f('0x1e')](function(_0x4d9f30){_0x479b57[_0xdd6f('0x2b')]=_0x4d9f30;if(_0x2e0668[_0xdd6f('0x3e')][_0xdd6f('0x4d')]){_0x155b2e[_0xdd6f('0x4e')]=[{'all':!![]}];}return db[_0xdd6f('0x68')][_0xdd6f('0x64')](_0x155b2e);})['then'](function(_0x187500){_0x479b57['rows']=_0x187500;return _0x479b57;});}})[_0xdd6f('0x1e')](respondWithFilteredResult(_0x1877f9,_0x155b2e))[_0xdd6f('0x26')](handleError(_0x1877f9,null));};exports['removeAnswers']=function(_0x54c7a1,_0x26834a,_0x83c868){return db[_0xdd6f('0x4c')][_0xdd6f('0x52')]({'where':{'id':_0x54c7a1[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x26834a,null))[_0xdd6f('0x1e')](function(_0x5b822d){if(_0x5b822d){return _0x5b822d['removeAnswers'](_0x54c7a1[_0xdd6f('0x3e')][_0xdd6f('0x67')]);}})[_0xdd6f('0x1e')](respondWithStatusCode(_0x26834a,null))['catch'](handleError(_0x26834a,null));};exports['notify']=function(_0xaa2489,_0x175979,_0x4a09f6){var _0x59ab25={'body':_0xaa2489[_0xdd6f('0x5d')],'channel':_0xdd6f('0x6a')};var _0x3e75eb=[];var _0x7eaf5c=[];var _0x43f2f1={};var _0x1dede8=![];return db['CmContact'][_0xdd6f('0x5e')]()['then'](function(_0x571241){if(!_0x571241){throw new db[(_0xdd6f('0x6b'))][(_0xdd6f('0x6c'))](_0xdd6f('0x6d'));}_0x3e75eb=_[_0xdd6f('0x6e')](_[_0xdd6f('0x3d')](_0x571241),[_0xdd6f('0x6f'),_0xdd6f('0x70')]);_0x7eaf5c=_[_0xdd6f('0x6e')](_[_0xdd6f('0x3d')](_0x571241),[_0xdd6f('0x6f'),'updatedAt',_0xdd6f('0x71'),_0xdd6f('0x72')]);if(_0xaa2489[_0xdd6f('0x5d')]['id']){delete _0xaa2489[_0xdd6f('0x5d')]['id'];}if(_[_0xdd6f('0x73')](_0xaa2489['body'][_0xdd6f('0x74')])){throw new db[(_0xdd6f('0x6b'))][(_0xdd6f('0x6c'))](_0xdd6f('0x75'));}if(_['isNil'](_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x5d')])||_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x5d')]===''){throw new db[(_0xdd6f('0x6b'))][(_0xdd6f('0x6c'))](_0xdd6f('0x76'));}if(_[_0xdd6f('0x73')](_0xaa2489['body']['mapKey'])){throw new db[(_0xdd6f('0x6b'))][(_0xdd6f('0x6c'))](_0xdd6f('0x77')+_0x7eaf5c);}if(!_[_0xdd6f('0x78')](_0x7eaf5c,_0xaa2489[_0xdd6f('0x5d')]['mapKey'])){throw new db[(_0xdd6f('0x6b'))][(_0xdd6f('0x6c'))](_0xdd6f('0x79')+_0x7eaf5c);}_0x43f2f1[_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x7a')]]=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x74')];})[_0xdd6f('0x1e')](function(){return db[_0xdd6f('0x4c')][_0xdd6f('0x52')]({'where':{'id':_0xaa2489[_0xdd6f('0x50')]['id']},'include':[{'model':db[_0xdd6f('0x7b')],'as':_0xdd6f('0x7c'),'include':[{'model':db[_0xdd6f('0x7d')],'as':_0xdd6f('0x7e'),'where':_0x43f2f1,'limit':0x1,'order':[['updatedAt',_0xdd6f('0x7f')]]}]},{'model':db[_0xdd6f('0x80')],'as':_0xdd6f('0x81')}]});})['then'](handleEntityNotFound(_0x175979,null))[_0xdd6f('0x1e')](function(_0x2f92ae){if(_0x2f92ae&&_0x2f92ae[_0xdd6f('0x7c')]){_0x59ab25['account']=_0x2f92ae;_0x59ab25[_0xdd6f('0x82')]=_0x2f92ae['Applications'];_0x59ab25[_0xdd6f('0x83')]=_0x2f92ae[_0xdd6f('0x7c')];_0x59ab25[_0xdd6f('0x82')]=_[_0xdd6f('0x84')](_0x59ab25[_0xdd6f('0x82')],[_0xdd6f('0x85')],[_0xdd6f('0x86')]);if(_0x59ab25[_0xdd6f('0x87')]['Applications']){delete _0x59ab25[_0xdd6f('0x87')][_0xdd6f('0x81')];}if(_0x59ab25['account'][_0xdd6f('0x7c')]&&_0x59ab25[_0xdd6f('0x87')][_0xdd6f('0x7c')][_0xdd6f('0x7e')][_0xdd6f('0x42')]){return _0x59ab25[_0xdd6f('0x87')][_0xdd6f('0x7c')][_0xdd6f('0x7e')][0x0];}var _0x21b4cc=_[_0xdd6f('0x88')](_0xaa2489[_0xdd6f('0x5d')],{'firstName':_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x74')],'ListId':_0x2f92ae['ListId']});_0x21b4cc[_0xaa2489['body'][_0xdd6f('0x7a')]]=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x74')];return db[_0xdd6f('0x7d')][_0xdd6f('0x53')](_0x21b4cc,{'fields':_0x3e75eb,'raw':!![]});}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x175979,null))[_0xdd6f('0x1e')](function(_0x35a0e6){_0x59ab25[_0xdd6f('0x89')]=_0x35a0e6;if(_0x35a0e6){var _0x1cbc29={'ContactId':_0x35a0e6['id'],'OpenchannelAccountId':_0xaa2489['params']['id'],'from':(_0x35a0e6[_0xdd6f('0x8a')]||'')+'\x20'+(_0x35a0e6[_0xdd6f('0x8b')]||'')};var _0x2efa18={'OpenchannelAccountId':_0xaa2489[_0xdd6f('0x50')]['id'],'closed':![]};if(_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x8c')]){_0x2efa18[_0xdd6f('0x8c')]=_0xaa2489['body'][_0xdd6f('0x8c')];return db[_0xdd6f('0x8d')]['find']({'where':_0x2efa18})[_0xdd6f('0x1e')](function(_0x1df812){if(_0x1df812){return[_0x1df812,![]];}_0x1cbc29[_0xdd6f('0x8c')]=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x8c')];_0x1cbc29[_0xdd6f('0x8e')]=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x8e')];return db[_0xdd6f('0x8d')][_0xdd6f('0x53')](_0x1cbc29)['then'](function(_0x21dd3b){return[_0x21dd3b,!![]];});});}else{_0x2efa18[_0xdd6f('0x8c')]=null;}_0x2efa18[_0xdd6f('0x8f')]=_0x35a0e6['id'];return db[_0xdd6f('0x8d')][_0xdd6f('0x52')]({'where':_0x2efa18})[_0xdd6f('0x1e')](function(_0xe29940){if(_0xe29940){return[_0xe29940,![]];}return db[_0xdd6f('0x8d')][_0xdd6f('0x53')](_0x1cbc29)[_0xdd6f('0x1e')](function(_0x524c0b){return[_0x524c0b,!![]];});});}})['spread'](function(_0x384ed4,_0x181b31){if(_0x384ed4){_0x1dede8=_0x181b31;if(!_0x181b31){var _0x54da34={'from':(_0x59ab25['contact']['firstName']||'')+'\x20'+(_0x59ab25[_0xdd6f('0x89')][_0xdd6f('0x8b')]||'')};if(_0xaa2489['body'][_0xdd6f('0x8c')]&&_0xaa2489['body'][_0xdd6f('0x90')]&&_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x8c')]!=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x90')]){_0x54da34['threadId']=_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x90')];}return _0x384ed4[_0xdd6f('0x5b')](_0x54da34);}else{return _0x384ed4;}}})['then'](function(_0x2d6f70){_0x59ab25[_0xdd6f('0x91')]=_0x2d6f70[_0xdd6f('0x32')]({'plain':!![]});_0x59ab25[_0xdd6f('0x91')]['created']=_0x1dede8;if(_0x59ab25[_0xdd6f('0x91')][_0xdd6f('0x92')]){if(_0x59ab25[_0xdd6f('0x87')][_0xdd6f('0x93')]){_0x59ab25[_0xdd6f('0x82')]['push']({'id':0x0,'priority':_0x59ab25['applications']['length']+0x1,'app':_0xdd6f('0x94'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xdd6f('0x95')][_0xdd6f('0x53')]({'body':_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x5d')],'OpenchannelAccountId':_0xaa2489[_0xdd6f('0x50')]['id'],'OpenchannelInteractionId':_0x2d6f70['id'],'direction':'in','ContactId':_0x59ab25[_0xdd6f('0x89')]['id'],'AttachmentId':_0xaa2489[_0xdd6f('0x5d')][_0xdd6f('0x96')]});})[_0xdd6f('0x1e')](function(_0x29105e){_0x59ab25['message']=_0x29105e;if(_0x59ab25[_0xdd6f('0x91')]['UserId']){return db['User'][_0xdd6f('0x52')]({'attributes':['id','name'],'where':{'id':_0x59ab25['interaction'][_0xdd6f('0x97')]}})[_0xdd6f('0x1e')](function(_0x381a05){if(_0x381a05){_0x59ab25[_0xdd6f('0x82')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x381a05['name']+','+(_0x59ab25['account'][_0xdd6f('0x98')]||0xa),'interval':_0xdd6f('0x99')});_0x59ab25[_0xdd6f('0x9a')]=![];}return respondWithRpcPromise(_0xdd6f('0x9b'),_0xdd6f('0x9c'),_0x59ab25);});}return respondWithRpcPromise('Start',_0xdd6f('0x9c'),_0x59ab25);})[_0xdd6f('0x1e')](function(_0x10a895){respondWithRpcPromise(_0xdd6f('0x9d'),_0xdd6f('0x9d'),{'event':'notify','message':_0x10a895},client9002);return _0x10a895;})[_0xdd6f('0x1e')](respondWithResult(_0x175979,null))[_0xdd6f('0x26')](handleError(_0x175979,null));};exports[_0xdd6f('0x9e')]=function(_0x712270,_0x9f3fe3){var _0x3dc3df=_0x712270['params']['id'];var _0x5de093=_0x712270['body'];var _0x4c60a7=0xc8;var _0x29a279=null;return db[_0xdd6f('0x9f')]['transaction']({'isolationLevel':db[_0xdd6f('0x9f')][_0xdd6f('0xa0')][_0xdd6f('0xa1')][_0xdd6f('0xa2')]},function(_0x19a10e){return db[_0xdd6f('0x4c')]['findOne']({'where':{'id':_0x3dc3df},'transaction':_0x19a10e})[_0xdd6f('0x1e')](function(_0xf6c735){if(_0xf6c735){return db[_0xdd6f('0x80')][_0xdd6f('0x31')]({'where':{'OpenchannelAccountId':_0x3dc3df},'transaction':_0x19a10e})[_0xdd6f('0x1e')](function(){var _0x142e65=_[_0xdd6f('0x3c')](_0x5de093,function(_0x230f6b){_0x230f6b[_0xdd6f('0x5f')]=_0x3dc3df;return _0x230f6b;});return db['OpenchannelApplication'][_0xdd6f('0xa3')](_0x142e65,{'transaction':_0x19a10e});});}else{_0x4c60a7=0x194;_0x29a279=[];}});})[_0xdd6f('0x1e')](function(){if(_0x4c60a7!==0x194){return db[_0xdd6f('0x80')][_0xdd6f('0xa4')]({'where':{'OpenchannelAccountId':_0x3dc3df},'order':'priority'})[_0xdd6f('0x1e')](function(_0x2bc669){_0x29a279=_0x2bc669;});}})['catch'](function(_0x557bde){_0x4c60a7=0x1f4;logger['error'](_0x557bde[_0xdd6f('0xa5')]);if(_0x557bde[_0xdd6f('0x36')]){delete _0x557bde[_0xdd6f('0x36')];}_0x29a279=_0x557bde;})[_0xdd6f('0xa6')](function(){if(_0x29a279===null){_0x9f3fe3[_0xdd6f('0x35')](_0x4c60a7);}else{if(_0x4c60a7===0x1f4){_0x9f3fe3['status'](_0x4c60a7)[_0xdd6f('0x37')](_0x29a279);}else{_0x9f3fe3[_0xdd6f('0x27')](_0x4c60a7)[_0xdd6f('0x28')](_0x29a279);}}});};exports[_0xdd6f('0xa7')]=function(_0x20b103,_0x2275ad,_0x14c03f){var _0x20ed77={};var _0x3fca2b={};var _0x5acd57;var _0x4196fc;return db[_0xdd6f('0x4c')][_0xdd6f('0x62')]({'where':{'id':_0x20b103[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x2275ad,null))[_0xdd6f('0x1e')](function(_0x24eeb8){if(_0x24eeb8){_0x5acd57=_0x24eeb8;_0x3fca2b[_0xdd6f('0x3b')]=_[_0xdd6f('0x3d')](db['OpenchannelApplication'][_0xdd6f('0x51')]);_0x3fca2b[_0xdd6f('0x3e')]=_['keys'](_0x20b103[_0xdd6f('0x3e')]);_0x3fca2b[_0xdd6f('0x47')]=_[_0xdd6f('0x3f')](_0x3fca2b[_0xdd6f('0x3b')],_0x3fca2b[_0xdd6f('0x3e')]);_0x20ed77[_0xdd6f('0x40')]=_[_0xdd6f('0x3f')](_0x3fca2b['model'],qs[_0xdd6f('0x41')](_0x20b103[_0xdd6f('0x3e')][_0xdd6f('0x41')]));_0x20ed77[_0xdd6f('0x40')]=_0x20ed77['attributes']['length']?_0x20ed77[_0xdd6f('0x40')]:_0x3fca2b[_0xdd6f('0x3b')];_0x20ed77[_0xdd6f('0x44')]=qs[_0xdd6f('0x45')](_0x20b103[_0xdd6f('0x3e')][_0xdd6f('0x45')]);_0x20ed77[_0xdd6f('0x46')]=qs[_0xdd6f('0x47')](_['pick'](_0x20b103['query'],_0x3fca2b[_0xdd6f('0x47')]));if(_0x20b103[_0xdd6f('0x3e')][_0xdd6f('0x49')]){_0x20ed77[_0xdd6f('0x46')]=_[_0xdd6f('0x4a')](_0x20ed77['where'],{'$or':_[_0xdd6f('0x3c')](_0x20ed77[_0xdd6f('0x40')],function(_0xf25528){var _0x32dc0c={};_0x32dc0c[_0xf25528]={'$like':'%'+_0x20b103[_0xdd6f('0x3e')][_0xdd6f('0x49')]+'%'};return _0x32dc0c;})});}_0x20ed77=_[_0xdd6f('0x4a')]({},_0x20ed77,_0x20b103[_0xdd6f('0x4b')]);return _0x5acd57[_0xdd6f('0xa7')](_0x20ed77);}})['then'](function(_0x44b04d){if(_0x44b04d){_0x4196fc=_0x44b04d[_0xdd6f('0x42')];if(!_0x20b103[_0xdd6f('0x3e')][_0xdd6f('0x63')]('nolimit')){_0x20ed77[_0xdd6f('0x2a')]=qs[_0xdd6f('0x2a')](_0x20b103['query'][_0xdd6f('0x2a')]);_0x20ed77[_0xdd6f('0x2c')]=qs['offset'](_0x20b103['query'][_0xdd6f('0x2c')]);}return _0x5acd57[_0xdd6f('0xa7')](_0x20ed77);}})[_0xdd6f('0x1e')](function(_0xab0ee0){if(_0xab0ee0){return _0xab0ee0?{'count':_0x4196fc,'rows':_0xab0ee0}:null;}})[_0xdd6f('0x1e')](respondWithResult(_0x2275ad,null))[_0xdd6f('0x26')](handleError(_0x2275ad,null));};exports[_0xdd6f('0xa8')]=function(_0x115cc1,_0x451d4d,_0x51037e){var _0x35e41e={'raw':![],'where':{}};var _0x2180e0={};var _0x5dd94d={'count':0x0,'rows':[]};return db[_0xdd6f('0x4c')]['findOne']({'where':{'id':_0x115cc1[_0xdd6f('0x50')]['id']}})['then'](handleEntityNotFound(_0x451d4d,null))[_0xdd6f('0x1e')](function(_0x14e994){if(_0x14e994){_0x2180e0[_0xdd6f('0x3b')]=_[_0xdd6f('0x3d')](db[_0xdd6f('0x8d')][_0xdd6f('0x51')]);_0x2180e0[_0xdd6f('0x3e')]=_[_0xdd6f('0x3d')](_0x115cc1['query']);_0x2180e0[_0xdd6f('0x47')]=_[_0xdd6f('0x3f')](_0x2180e0[_0xdd6f('0x3b')],_0x2180e0['query']);_0x35e41e[_0xdd6f('0x40')]=_[_0xdd6f('0x3f')](_0x2180e0['model'],qs[_0xdd6f('0x41')](_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x41')]));_0x35e41e['attributes']=_0x35e41e[_0xdd6f('0x40')][_0xdd6f('0x42')]?_0x35e41e['attributes']:_0x2180e0['model'];if(!_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x63')]('nolimit')){_0x35e41e[_0xdd6f('0x2a')]=qs['limit'](_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x2a')]);_0x35e41e['offset']=qs[_0xdd6f('0x2c')](_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x2c')]);}_0x35e41e[_0xdd6f('0x44')]=qs['sort'](_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x45')]);_0x35e41e[_0xdd6f('0x46')]=qs['filters'](_[_0xdd6f('0x48')](_0x115cc1[_0xdd6f('0x3e')],_0x2180e0[_0xdd6f('0x47')]));_0x35e41e[_0xdd6f('0x46')][_0xdd6f('0x5f')]=_0x14e994['id'];if(_0x115cc1[_0xdd6f('0x3e')]['filter']){_0x35e41e[_0xdd6f('0x46')]=_[_0xdd6f('0x4a')](_0x35e41e[_0xdd6f('0x46')],{'$or':_[_0xdd6f('0x3c')](_0x35e41e[_0xdd6f('0x40')],function(_0x49d332){var _0x1284b3={};_0x1284b3[_0x49d332]={'$like':'%'+_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x49')]+'%'};return _0x1284b3;})});}_0x35e41e=_[_0xdd6f('0x4a')]({},_0x35e41e,_0x115cc1[_0xdd6f('0x4b')]);return db[_0xdd6f('0x8d')][_0xdd6f('0x2b')]({'where':_0x35e41e[_0xdd6f('0x46')]})[_0xdd6f('0x1e')](function(_0xce81d6){_0x5dd94d[_0xdd6f('0x2b')]=_0xce81d6;if(_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0x4d')]){_0x35e41e[_0xdd6f('0x4e')]=[{'model':db[_0xdd6f('0x7d')],'as':'Contact','required':![]},{'model':db[_0xdd6f('0xa9')],'as':_0xdd6f('0xaa'),'attributes':[_0xdd6f('0x36'),_0xdd6f('0xab'),_0xdd6f('0xac')],'required':![]},{'model':db['Tag'],'as':_0xdd6f('0xad'),'attributes':['id',_0xdd6f('0x36'),_0xdd6f('0xae')],'where':_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0xaf')]?{'id':_0x115cc1[_0xdd6f('0x3e')][_0xdd6f('0xaf')]}:undefined,'required':_0x115cc1[_0xdd6f('0x3e')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xdd6f('0x64')](_0x35e41e);})[_0xdd6f('0x1e')](function(_0x11dba1){_0x5dd94d[_0xdd6f('0x65')]=_0x11dba1;return _0x5dd94d;});}})[_0xdd6f('0x1e')](respondWithFilteredResult(_0x451d4d,_0x35e41e))[_0xdd6f('0x26')](handleError(_0x451d4d,null));};exports[_0xdd6f('0xb0')]=function(_0x11a388,_0x4e260e,_0x1f3ac7){return db[_0xdd6f('0x4c')]['find']({'where':{'id':_0x11a388['params']['id']}})['then'](handleEntityNotFound(_0x4e260e,null))['then'](function(_0x2192ce){if(_0x2192ce){return _0x2192ce['addAgents'](_0x11a388[_0xdd6f('0x5d')][_0xdd6f('0x67')],_[_0xdd6f('0xb1')](_0x11a388[_0xdd6f('0x5d')],[_0xdd6f('0x67'),'id'])||{})[_0xdd6f('0xb2')](function(_0xddddd7){for(var _0x4abcaf=0x0;_0x4abcaf<_0x11a388[_0xdd6f('0x5d')]['ids'][_0xdd6f('0x42')];_0x4abcaf+=0x1){socket[_0xdd6f('0xb3')](_0xdd6f('0xb4'),{'UserId':Number(_0x11a388['body'][_0xdd6f('0x67')][_0x4abcaf]),'OpenchannelAccountId':Number(_0x11a388[_0xdd6f('0x50')]['id'])});}return _0xddddd7;});}})[_0xdd6f('0x1e')](respondWithResult(_0x4e260e,null))[_0xdd6f('0x26')](handleError(_0x4e260e,null));};exports[_0xdd6f('0xb5')]=function(_0x581c3f,_0x16e209,_0x1c59e5){return db[_0xdd6f('0x4c')][_0xdd6f('0x52')]({'where':{'id':_0x581c3f[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x16e209,null))[_0xdd6f('0x1e')](function(_0x308f4a){if(_0x308f4a){return _0x308f4a[_0xdd6f('0xb5')](_0x581c3f['query'][_0xdd6f('0x67')])[_0xdd6f('0x1e')](function(){if(_['isArray'](_0x581c3f['query'][_0xdd6f('0x67')])){for(var _0x2f0b9f=0x0;_0x2f0b9f<_0x581c3f[_0xdd6f('0x3e')][_0xdd6f('0x67')][_0xdd6f('0x42')];_0x2f0b9f+=0x1){socket[_0xdd6f('0xb3')](_0xdd6f('0xb6'),{'UserId':Number(_0x581c3f[_0xdd6f('0x3e')]['ids'][_0x2f0b9f]),'OpenchannelAccountId':Number(_0x581c3f[_0xdd6f('0x50')]['id'])});}}else{socket[_0xdd6f('0xb3')](_0xdd6f('0xb6'),{'UserId':Number(_0x581c3f[_0xdd6f('0x3e')]['ids']),'OpenchannelAccountId':Number(_0x581c3f[_0xdd6f('0x50')]['id'])});}});}})[_0xdd6f('0x1e')](respondWithStatusCode(_0x16e209,null))['catch'](handleError(_0x16e209,null));};exports[_0xdd6f('0xb7')]=function(_0x346bd3,_0x51d6b3,_0x15ab8d){var _0x472fbe={};var _0x328f42={};var _0x365b51;var _0x2c8fe1;return db[_0xdd6f('0x4c')]['findOne']({'where':{'id':_0x346bd3[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x51d6b3,null))[_0xdd6f('0x1e')](function(_0x11fea8){if(_0x11fea8){_0x365b51=_0x11fea8;_0x328f42[_0xdd6f('0x3b')]=_[_0xdd6f('0x3d')](db['User'][_0xdd6f('0x51')]);_0x328f42[_0xdd6f('0x3e')]=_[_0xdd6f('0x3d')](_0x346bd3['query']);_0x328f42[_0xdd6f('0x47')]=_[_0xdd6f('0x3f')](_0x328f42[_0xdd6f('0x3b')],_0x328f42['query']);_0x472fbe[_0xdd6f('0x40')]=_['intersection'](_0x328f42['model'],qs['fields'](_0x346bd3[_0xdd6f('0x3e')][_0xdd6f('0x41')]));_0x472fbe[_0xdd6f('0x40')]=_0x472fbe[_0xdd6f('0x40')]['length']?_0x472fbe[_0xdd6f('0x40')]:_0x328f42[_0xdd6f('0x3b')];_0x472fbe['order']=qs[_0xdd6f('0x45')](_0x346bd3[_0xdd6f('0x3e')][_0xdd6f('0x45')]);_0x472fbe[_0xdd6f('0x46')]=qs[_0xdd6f('0x47')](_[_0xdd6f('0x48')](_0x346bd3[_0xdd6f('0x3e')],_0x328f42['filters']));if(_0x346bd3['query'][_0xdd6f('0x49')]){_0x472fbe['where']=_['merge'](_0x472fbe[_0xdd6f('0x46')],{'$or':_[_0xdd6f('0x3c')](_0x472fbe[_0xdd6f('0x40')],function(_0x356708){var _0x14e995={};_0x14e995[_0x356708]={'$like':'%'+_0x346bd3[_0xdd6f('0x3e')][_0xdd6f('0x49')]+'%'};return _0x14e995;})});}_0x472fbe=_['merge']({},_0x472fbe,_0x346bd3[_0xdd6f('0x4b')]);return _0x365b51['getAgents'](_0x472fbe);}})[_0xdd6f('0x1e')](function(_0x14e4bb){if(_0x14e4bb){_0x2c8fe1=_0x14e4bb[_0xdd6f('0x42')];if(!_0x346bd3[_0xdd6f('0x3e')]['hasOwnProperty'](_0xdd6f('0x43'))){_0x472fbe[_0xdd6f('0x2a')]=qs[_0xdd6f('0x2a')](_0x346bd3['query'][_0xdd6f('0x2a')]);_0x472fbe[_0xdd6f('0x2c')]=qs['offset'](_0x346bd3[_0xdd6f('0x3e')][_0xdd6f('0x2c')]);}return _0x365b51[_0xdd6f('0xb7')](_0x472fbe);}})[_0xdd6f('0x1e')](function(_0x5afadb){if(_0x5afadb){return _0x5afadb?{'count':_0x2c8fe1,'rows':_0x5afadb}:null;}})['then'](respondWithResult(_0x51d6b3,null))[_0xdd6f('0x26')](handleError(_0x51d6b3,null));};exports[_0xdd6f('0x37')]=function(_0x378268,_0x4d73fd,_0x4c923c){var _0x48615e,_0x685bd2,_0x58a2be;if(_[_0xdd6f('0x73')](_0x378268[_0xdd6f('0x5d')][_0xdd6f('0x5d')])||_0x378268[_0xdd6f('0x5d')][_0xdd6f('0x5d')]===''){throw new db['Sequelize'][(_0xdd6f('0x6c'))](_0xdd6f('0x76'));}if(_[_0xdd6f('0x73')](_0x378268[_0xdd6f('0x5d')]['to'])){}_0x48615e=_0x378268['body']['to'];return db[_0xdd6f('0x4c')][_0xdd6f('0x62')]({'where':{'id':_0x378268[_0xdd6f('0x50')]['id']}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x4d73fd,null))[_0xdd6f('0x1e')](function(_0x2320f1){if(_0x2320f1){return db[_0xdd6f('0x4c')][_0xdd6f('0x52')]({'where':{'id':_0x2320f1['id']},'include':[{'model':db[_0xdd6f('0x7b')],'as':_0xdd6f('0x7c'),'include':[{'model':db[_0xdd6f('0x7d')],'as':'Contacts','where':{[_0x2320f1[_0xdd6f('0x7a')]]:_0x48615e},'limit':0x1,'order':[[_0xdd6f('0x70'),_0xdd6f('0x7f')]]}]}]})[_0xdd6f('0x1e')](handleEntityNotFound(_0x4d73fd,null))['then'](function(_0x3e4701){if(_0x3e4701&&_0x3e4701[_0xdd6f('0x7c')]){_0x685bd2=_0x3e4701[_0xdd6f('0x32')]({'plain':!![]});if(_0x685bd2[_0xdd6f('0x7c')]&&_0x685bd2[_0xdd6f('0x7c')][_0xdd6f('0x7e')][_0xdd6f('0x42')]){return _0x685bd2[_0xdd6f('0x7c')][_0xdd6f('0x7e')][0x0];}return db[_0xdd6f('0x7d')][_0xdd6f('0x53')](_['defaults'](_0x378268[_0xdd6f('0x5d')],{'firstName':_0x48615e,[_0x3e4701['mapKey']]:_0x48615e,'phone':_0x48615e,'ListId':_0x685bd2[_0xdd6f('0x72')]}));}})[_0xdd6f('0x1e')](handleEntityNotFound(_0x4d73fd,null))['then'](function(_0x5a47a3){if(_0x5a47a3){_0x58a2be=_0x5a47a3;return db['OpenchannelInteraction'][_0xdd6f('0x52')]({'where':{'ContactId':_0x58a2be['id'],'closed':![],'OpenchannelAccountId':_0x685bd2['id']}})[_0xdd6f('0x1e')](function(_0x12ad37){if(_0x12ad37){return[_0x12ad37,![]];}return db[_0xdd6f('0x8d')][_0xdd6f('0x53')]({'UserId':_0x378268['user']['id'],'ContactId':_0x58a2be['id'],'OpenchannelAccountId':_0x685bd2['id'],'lastMsgDirection':_0xdd6f('0xb8'),'firstMsgDirection':_0xdd6f('0xb8'),'Messages':[_['merge'](_0x378268['body'],{'read':![],'body':_0x378268[_0xdd6f('0x5d')][_0xdd6f('0x5d')],'OpenchannelAccountId':_0x685bd2['id'],'UserId':_0x378268['user']['id'],'ContactId':_0x58a2be['id']})]},{'include':[{'model':db[_0xdd6f('0x95')],'as':_0xdd6f('0xb9')}]})[_0xdd6f('0x1e')](function(_0x3b00ff){return[_0x3b00ff,!![]];});});}})[_0xdd6f('0xb2')](function(_0x3f0168,_0x1526e9){if(_0x1526e9){return _0x3f0168;}return db[_0xdd6f('0x95')][_0xdd6f('0x53')](_[_0xdd6f('0x4a')](_0x378268['body'],{'read':![],'body':_0x378268['body']['body'],'OpenchannelAccountId':_0x685bd2['id'],'OpenchannelInteractionId':_0x3f0168['id'],'UserId':_0x378268[_0xdd6f('0x54')]['id'],'ContactId':_0x58a2be['id']}))[_0xdd6f('0x1e')](function(_0x3f90e2){_0x3f0168[_0xdd6f('0xba')][_0xdd6f('0xb9')]=[];_0x3f0168[_0xdd6f('0xba')][_0xdd6f('0xb9')]['push'](_0x3f90e2[_0xdd6f('0xba')]);return _0x3f0168;});});}})['then'](respondWithResult(_0x4d73fd,null))[_0xdd6f('0x26')](handleError(_0x4d73fd,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8f60304..c9554d7 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 _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb903,0x185));var _0x3b90=function(_0x47a987,_0x64705e){_0x47a987=_0x47a987-0x0;var _0x495509=_0xb903[_0x47a987];return _0x495509;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xac1c72,_0x36fc35){_0xac1c72=_0xac1c72-0x0;var _0x5c7b85=_0x6f7a[_0xac1c72];return _0x5c7b85;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d47c4b1..a4c3212 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(_0x4b2160,_0x41dfeb){var _0x29341a=function(_0x55fa5a){while(--_0x55fa5a){_0x4b2160['push'](_0x4b2160['shift']());}};_0x29341a(++_0x41dfeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x3d2320,_0x5e6eb4){var _0x552ea4=function(_0x12062b){while(--_0x12062b){_0x3d2320['push'](_0x3d2320['shift']());}};_0x552ea4(++_0x5e6eb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 cf5bc5d..f9efe6e 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 _0x96cc=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a260b,_0x4f3a33){var _0x3a0381=function(_0x1cf522){while(--_0x1cf522){_0x2a260b['push'](_0x2a260b['shift']());}};_0x3a0381(++_0x4f3a33);}(_0x96cc,0x16c));var _0xc96c=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0x96cc[_0x180ac2];return _0xfcaede;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});config[_0xc96c('0xb')]=_[_0xc96c('0xc')](config[_0xc96c('0xb')],{'host':_0xc96c('0xd'),'port':0x18eb});var socket=require(_0xc96c('0xe'))(new Redis(config[_0xc96c('0xb')]));require(_0xc96c('0xf'))['register'](socket);function respondWithRpcPromise(_0x29ee7b,_0x29bd30,_0x19f599){return new BPromise(function(_0x5ceddc,_0x95ce8e){return client['request'](_0x29ee7b,_0x19f599)[_0xc96c('0x10')](function(_0x559477){logger[_0xc96c('0x11')](_0xc96c('0x12'),_0x29bd30,_0xc96c('0x13'));logger[_0xc96c('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x29bd30,_0xc96c('0x13'),JSON[_0xc96c('0x15')](_0x559477));if(_0x559477[_0xc96c('0x16')]){if(_0x559477[_0xc96c('0x16')]['code']===0x1f4){logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);return _0x95ce8e(_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);}logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x559477[_0xc96c('0x16')][_0xc96c('0x17')]);return _0x5ceddc(_0x559477[_0xc96c('0x16')]['message']);}else{logger['info'](_0xc96c('0x12'),_0x29bd30,_0xc96c('0x13'));_0x5ceddc(_0x559477[_0xc96c('0x18')][_0xc96c('0x17')]);}})['catch'](function(_0x2c4c83){logger[_0xc96c('0x16')](_0xc96c('0x12'),_0x29bd30,_0x2c4c83);_0x95ce8e(_0x2c4c83);});});} \ No newline at end of file +var _0x1339=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info'];(function(_0x50a9af,_0x24df09){var _0x3478f9=function(_0x2228ff){while(--_0x2228ff){_0x50a9af['push'](_0x50a9af['shift']());}};_0x3478f9(++_0x24df09);}(_0x1339,0x1ed));var _0x9133=function(_0x27fbbc,_0x69041c){_0x27fbbc=_0x27fbbc-0x0;var _0x2977f7=_0x1339[_0x27fbbc];return _0x2977f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});config['redis']=_[_0x9133('0xb')](config[_0x9133('0xc')],{'host':_0x9133('0xd'),'port':0x18eb});var socket=require(_0x9133('0xe'))(new Redis(config[_0x9133('0xc')]));require(_0x9133('0xf'))[_0x9133('0x10')](socket);function respondWithRpcPromise(_0x245134,_0x10a9e4,_0xd588c){return new BPromise(function(_0x4c4517,_0x3f9650){return client[_0x9133('0x11')](_0x245134,_0xd588c)[_0x9133('0x12')](function(_0x452481){logger[_0x9133('0x13')](_0x9133('0x14'),_0x10a9e4,'request\x20sent');logger[_0x9133('0x15')](_0x9133('0x16'),_0x10a9e4,'request\x20sent',JSON['stringify'](_0x452481));if(_0x452481[_0x9133('0x17')]){if(_0x452481['error'][_0x9133('0x18')]===0x1f4){logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481[_0x9133('0x17')][_0x9133('0x19')]);return _0x3f9650(_0x452481[_0x9133('0x17')]['message']);}logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481['error'][_0x9133('0x19')]);return _0x4c4517(_0x452481[_0x9133('0x17')][_0x9133('0x19')]);}else{logger[_0x9133('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x9133('0x1a'));_0x4c4517(_0x452481['result'][_0x9133('0x19')]);}})['catch'](function(_0x115ee8){logger[_0x9133('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x115ee8);_0x3f9650(_0x115ee8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c4f530b..b928ac1 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 _0x902b=['register','./openchannelAccount.events','remove','update','emit'];(function(_0x32a403,_0x4920af){var _0x14a687=function(_0x23a5bc){while(--_0x23a5bc){_0x32a403['push'](_0x32a403['shift']());}};_0x14a687(++_0x4920af);}(_0x902b,0x6a));var _0xb902=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x902b[_0x1da527];return _0x40fc7c;};'use strict';var OpenchannelAccountEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){OpenchannelAccountEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('openchannelAccount:'+_0x5b0b74,_0x5d38bb);OpenchannelAccountEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file +var _0x7eb9=['removeListener','./openchannelAccount.events','update','emit'];(function(_0xa423de,_0x2e1d48){var _0x39a50c=function(_0x33d012){while(--_0x33d012){_0xa423de['push'](_0xa423de['shift']());}};_0x39a50c(++_0x2e1d48);}(_0x7eb9,0xd9));var _0x97eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7eb9[_0x122ef9];return _0x42fba0;};'use strict';var OpenchannelAccountEvents=require(_0x97eb('0x0'));var events=['save','remove',_0x97eb('0x1')];function createListener(_0x48a73e,_0x580fd1){return function(_0x41d2c7){_0x580fd1[_0x97eb('0x2')](_0x48a73e,_0x41d2c7);};}function removeListener(_0x130bf4,_0x5066c1){return function(){OpenchannelAccountEvents[_0x97eb('0x3')](_0x130bf4,_0x5066c1);};}exports['register']=function(_0x5f78f4){for(var _0x5327d4=0x0,_0x44595e=events['length'];_0x5327d4<_0x44595e;_0x5327d4++){var _0x5227f4=events[_0x5327d4];var _0x429ed6=createListener('openchannelAccount:'+_0x5227f4,_0x5f78f4);OpenchannelAccountEvents['on'](_0x5227f4,_0x429ed6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1e3227b..ad9f5a7 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 _0x96be=['fs-extra','../../config/environment','./openchannelApplication.controller','get','index','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x96be,0xd2));var _0xe96b=function(_0x166ee4,_0x35525a){_0x166ee4=_0x166ee4-0x0;var _0x46a3b0=_0x96be[_0x166ee4];return _0x46a3b0;};'use strict';var multer=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var path=require(_0xe96b('0x2'));var timeout=require(_0xe96b('0x3'));var express=require(_0xe96b('0x4'));var router=express[_0xe96b('0x5')]();var fs_extra=require(_0xe96b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe96b('0x7'));var controller=require(_0xe96b('0x8'));router[_0xe96b('0x9')]('/',auth['isAuthenticated'](),controller[_0xe96b('0xa')]);router[_0xe96b('0x9')]('/:id',auth[_0xe96b('0xb')](),controller[_0xe96b('0xc')]);router['post']('/',auth[_0xe96b('0xb')](),controller['create']);router[_0xe96b('0xd')](_0xe96b('0xe'),auth['isAuthenticated'](),controller[_0xe96b('0xf')]);router[_0xe96b('0x10')](_0xe96b('0xe'),auth[_0xe96b('0xb')](),controller['destroy']);module[_0xe96b('0x11')]=router; \ No newline at end of file +var _0x6ae7=['isAuthenticated','/:id','show','create','put','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x48c998,_0x37d255){var _0x59c2a2=function(_0x40eaa2){while(--_0x40eaa2){_0x48c998['push'](_0x48c998['shift']());}};_0x59c2a2(++_0x37d255);}(_0x6ae7,0x6e));var _0x76ae=function(_0x5de01a,_0x1a4d2d){_0x5de01a=_0x5de01a-0x0;var _0x48fb00=_0x6ae7[_0x5de01a];return _0x48fb00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76ae('0x0'));var timeout=require(_0x76ae('0x1'));var express=require(_0x76ae('0x2'));var router=express['Router']();var fs_extra=require(_0x76ae('0x3'));var auth=require(_0x76ae('0x4'));var interaction=require(_0x76ae('0x5'));var config=require(_0x76ae('0x6'));var controller=require(_0x76ae('0x7'));router[_0x76ae('0x8')]('/',auth[_0x76ae('0x9')](),controller['index']);router['get'](_0x76ae('0xa'),auth['isAuthenticated'](),controller[_0x76ae('0xb')]);router['post']('/',auth[_0x76ae('0x9')](),controller[_0x76ae('0xc')]);router[_0x76ae('0xd')](_0x76ae('0xa'),auth[_0x76ae('0x9')](),controller['update']);router[_0x76ae('0xe')](_0x76ae('0xa'),auth[_0x76ae('0x9')](),controller[_0x76ae('0xf')]);module[_0x76ae('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 4f56d47..20d16d8 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 _0x092e=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x293dc1,_0x2257c1){var _0x305d33=function(_0x545c41){while(--_0x545c41){_0x293dc1['push'](_0x293dc1['shift']());}};_0x305d33(++_0x2257c1);}(_0x092e,0x1d6));var _0xe092=function(_0x10df9c,_0x577cf6){_0x10df9c=_0x10df9c-0x0;var _0x4cd508=_0x092e[_0x10df9c];return _0x4cd508;};'use strict';var Sequelize=require(_0xe092('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe092('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe092('0x2')],'allowNull':![],'defaultValue':_0xe092('0x3')},'appdata':{'type':Sequelize[_0xe092('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe092('0x2')],'defaultValue':_0xe092('0x5')}}; \ No newline at end of file +var _0x23c6=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x23c6,0x13d));var _0x623c=function(_0x52c6f2,_0x4127cb){_0x52c6f2=_0x52c6f2-0x0;var _0x393b5e=_0x23c6[_0x52c6f2];return _0x393b5e;};'use strict';var Sequelize=require(_0x623c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x623c('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x623c('0x2')},'appdata':{'type':Sequelize[_0x623c('0x3')]()},'description':{'type':Sequelize[_0x623c('0x4')]},'interval':{'type':Sequelize[_0x623c('0x4')],'defaultValue':_0x623c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b859efb..345c82e 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 _0x453b=['status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x310d56,_0x581328){var _0x8759c7=function(_0x2eafc5){while(--_0x2eafc5){_0x310d56['push'](_0x310d56['shift']());}};_0x8759c7(++_0x581328);}(_0x453b,0x121));var _0xb453=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x453b[_0x4392af];return _0x9fa8eb;};'use strict';var emlformat=require(_0xb453('0x0'));var rimraf=require(_0xb453('0x1'));var zipdir=require(_0xb453('0x2'));var jsonpatch=require(_0xb453('0x3'));var rp=require(_0xb453('0x4'));var moment=require(_0xb453('0x5'));var BPromise=require(_0xb453('0x6'));var Mustache=require(_0xb453('0x7'));var util=require(_0xb453('0x8'));var path=require(_0xb453('0x9'));var sox=require(_0xb453('0xa'));var csv=require('to-csv');var ejs=require(_0xb453('0xb'));var fs=require('fs');var fs_extra=require(_0xb453('0xc'));var _=require(_0xb453('0xd'));var squel=require(_0xb453('0xe'));var crypto=require(_0xb453('0xf'));var jsforce=require(_0xb453('0x10'));var deskjs=require(_0xb453('0x11'));var toCsv=require(_0xb453('0x12'));var querystring=require(_0xb453('0x13'));var Papa=require(_0xb453('0x14'));var Redis=require(_0xb453('0x15'));var authService=require(_0xb453('0x16'));var qs=require(_0xb453('0x17'));var as=require(_0xb453('0x18'));var hardwareService=require(_0xb453('0x19'));var logger=require(_0xb453('0x1a'))(_0xb453('0x1b'));var utils=require(_0xb453('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0xb453('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131b97,_0x31ecae){_0x31ecae=_0x31ecae||0xcc;return function(_0x38c6ca){if(_0x38c6ca){return _0x131b97[_0xb453('0x1e')](_0x31ecae);}return _0x131b97[_0xb453('0x1f')](_0x31ecae)[_0xb453('0x20')]();};}function respondWithResult(_0x1610a8,_0x210a34){_0x210a34=_0x210a34||0xc8;return function(_0x187505){if(_0x187505){return _0x1610a8['status'](_0x210a34)['json'](_0x187505);}};}function respondWithFilteredResult(_0x277d7d,_0x1a76d8){return function(_0x32376a){if(_0x32376a){var _0x1fcc42=typeof _0x1a76d8[_0xb453('0x21')]===_0xb453('0x22')&&typeof _0x1a76d8['limit']===_0xb453('0x22');var _0x409683=_0x32376a[_0xb453('0x23')];var _0x59bd68=_0x1fcc42?0x0:_0x1a76d8[_0xb453('0x21')];var _0x4ef3ca=_0x1fcc42?_0x32376a[_0xb453('0x23')]:_0x1a76d8[_0xb453('0x21')]+_0x1a76d8['limit'];var _0x57b153;if(_0x4ef3ca>=_0x409683){_0x4ef3ca=_0x409683;_0x57b153=0xc8;}else{_0x57b153=0xce;}_0x277d7d[_0xb453('0x1f')](_0x57b153);return _0x277d7d[_0xb453('0x24')](_0xb453('0x25'),_0x59bd68+'-'+_0x4ef3ca+'/'+_0x409683)[_0xb453('0x26')](_0x32376a);}return null;};}function patchUpdates(_0x5e9069){return function(_0x252f84){try{jsonpatch[_0xb453('0x27')](_0x252f84,_0x5e9069,!![]);}catch(_0x350bfe){return BPromise[_0xb453('0x28')](_0x350bfe);}return _0x252f84[_0xb453('0x29')]();};}function saveUpdates(_0x25727a,_0x2acfc0){return function(_0x15d24a){if(_0x15d24a){return _0x15d24a[_0xb453('0x2a')](_0x25727a)['then'](function(_0x1bae03){return _0x1bae03;});}return null;};}function removeEntity(_0x1febfc,_0x1de467){return function(_0xdf8754){if(_0xdf8754){return _0xdf8754['destroy']()[_0xb453('0x2b')](function(){_0x1febfc[_0xb453('0x1f')](0xcc)[_0xb453('0x20')]();});}};}function handleEntityNotFound(_0x1b7b99,_0x412283){return function(_0x804c3){if(!_0x804c3){_0x1b7b99[_0xb453('0x1e')](0x194);}return _0x804c3;};}function handleError(_0x35b974,_0x59ff5b){_0x59ff5b=_0x59ff5b||0x1f4;return function(_0x43e9f2){logger['error'](_0x43e9f2[_0xb453('0x2c')]);if(_0x43e9f2[_0xb453('0x2d')]){delete _0x43e9f2[_0xb453('0x2d')];}_0x35b974[_0xb453('0x1f')](_0x59ff5b)[_0xb453('0x2e')](_0x43e9f2);};}exports[_0xb453('0x2f')]=function(_0x47ecd2,_0x51d766){var _0x129937={},_0x8b27d2={},_0x40d1a1={'count':0x0,'rows':[]};var _0x6e16d7=_[_0xb453('0x30')](db['OpenchannelApplication'][_0xb453('0x31')],function(_0x726b05){return{'name':_0x726b05['fieldName'],'type':_0x726b05[_0xb453('0x32')][_0xb453('0x33')]};});_0x8b27d2['model']=_[_0xb453('0x30')](_0x6e16d7,'name');_0x8b27d2[_0xb453('0x34')]=_[_0xb453('0x35')](_0x47ecd2[_0xb453('0x34')]);_0x8b27d2[_0xb453('0x36')]=_['intersection'](_0x8b27d2[_0xb453('0x37')],_0x8b27d2[_0xb453('0x34')]);_0x129937[_0xb453('0x38')]=_[_0xb453('0x39')](_0x8b27d2[_0xb453('0x37')],qs['fields'](_0x47ecd2[_0xb453('0x34')][_0xb453('0x3a')]));_0x129937[_0xb453('0x38')]=_0x129937[_0xb453('0x38')][_0xb453('0x3b')]?_0x129937[_0xb453('0x38')]:_0x8b27d2['model'];if(!_0x47ecd2[_0xb453('0x34')][_0xb453('0x3c')](_0xb453('0x3d'))){_0x129937[_0xb453('0x3e')]=qs['limit'](_0x47ecd2['query'][_0xb453('0x3e')]);_0x129937[_0xb453('0x21')]=qs[_0xb453('0x21')](_0x47ecd2['query'][_0xb453('0x21')]);}_0x129937['order']=qs[_0xb453('0x3f')](_0x47ecd2[_0xb453('0x34')][_0xb453('0x3f')]);_0x129937['where']=qs[_0xb453('0x36')](_['pick'](_0x47ecd2[_0xb453('0x34')],_0x8b27d2[_0xb453('0x36')]),_0x6e16d7);if(_0x47ecd2[_0xb453('0x34')][_0xb453('0x40')]){_0x129937[_0xb453('0x41')]=_[_0xb453('0x42')](_0x129937[_0xb453('0x41')],{'$or':_[_0xb453('0x30')](_0x6e16d7,function(_0x59ed59){if(_0x59ed59[_0xb453('0x32')]!==_0xb453('0x43')){var _0x510649={};_0x510649[_0x59ed59['name']]={'$like':'%'+_0x47ecd2[_0xb453('0x34')]['filter']+'%'};return _0x510649;}})});}_0x129937=_[_0xb453('0x42')]({},_0x129937,_0x47ecd2[_0xb453('0x44')]);var _0x1e5f66={'where':_0x129937[_0xb453('0x41')]};return db[_0xb453('0x45')]['count'](_0x1e5f66)[_0xb453('0x2b')](function(_0x47449c){_0x40d1a1[_0xb453('0x23')]=_0x47449c;if(_0x47ecd2['query'][_0xb453('0x46')]){_0x129937[_0xb453('0x47')]=[{'all':!![]}];}return db[_0xb453('0x45')][_0xb453('0x48')](_0x129937);})['then'](function(_0xbacece){_0x40d1a1['rows']=_0xbacece;return _0x40d1a1;})[_0xb453('0x2b')](respondWithFilteredResult(_0x51d766,_0x129937))[_0xb453('0x49')](handleError(_0x51d766,null));};exports[_0xb453('0x4a')]=function(_0x4d9de5,_0x21434a){var _0x1e858e={'raw':!![],'where':{'id':_0x4d9de5[_0xb453('0x4b')]['id']}},_0x2d98f6={};_0x2d98f6[_0xb453('0x37')]=_[_0xb453('0x35')](db[_0xb453('0x45')][_0xb453('0x31')]);_0x2d98f6[_0xb453('0x34')]=_[_0xb453('0x35')](_0x4d9de5[_0xb453('0x34')]);_0x2d98f6[_0xb453('0x36')]=_[_0xb453('0x39')](_0x2d98f6[_0xb453('0x37')],_0x2d98f6['query']);_0x1e858e[_0xb453('0x38')]=_[_0xb453('0x39')](_0x2d98f6[_0xb453('0x37')],qs[_0xb453('0x3a')](_0x4d9de5[_0xb453('0x34')][_0xb453('0x3a')]));_0x1e858e[_0xb453('0x38')]=_0x1e858e[_0xb453('0x38')][_0xb453('0x3b')]?_0x1e858e[_0xb453('0x38')]:_0x2d98f6['model'];if(_0x4d9de5[_0xb453('0x34')][_0xb453('0x46')]){_0x1e858e['include']=[{'all':!![]}];}_0x1e858e=_[_0xb453('0x42')]({},_0x1e858e,_0x4d9de5[_0xb453('0x44')]);return db[_0xb453('0x45')][_0xb453('0x4c')](_0x1e858e)['then'](handleEntityNotFound(_0x21434a,null))['then'](respondWithResult(_0x21434a,null))['catch'](handleError(_0x21434a,null));};exports[_0xb453('0x4d')]=function(_0x3d28ff,_0x10c04c){return db[_0xb453('0x45')][_0xb453('0x4d')](_0x3d28ff[_0xb453('0x4e')],{})[_0xb453('0x2b')](respondWithResult(_0x10c04c,0xc9))[_0xb453('0x49')](handleError(_0x10c04c,null));};exports[_0xb453('0x2a')]=function(_0x4f17a6,_0x1499f6){if(_0x4f17a6['body']['id']){delete _0x4f17a6[_0xb453('0x4e')]['id'];}return db[_0xb453('0x45')][_0xb453('0x4c')]({'where':{'id':_0x4f17a6[_0xb453('0x4b')]['id']}})[_0xb453('0x2b')](handleEntityNotFound(_0x1499f6,null))[_0xb453('0x2b')](saveUpdates(_0x4f17a6[_0xb453('0x4e')],null))[_0xb453('0x2b')](respondWithResult(_0x1499f6,null))[_0xb453('0x49')](handleError(_0x1499f6,null));};exports[_0xb453('0x4f')]=function(_0x147664,_0x3dd576){return db['OpenchannelApplication']['find']({'where':{'id':_0x147664[_0xb453('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3dd576,null))[_0xb453('0x2b')](removeEntity(_0x3dd576,null))[_0xb453('0x49')](handleError(_0x3dd576,null));}; \ No newline at end of file +var _0x33b8=['destroy','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then'];(function(_0x3e55e5,_0x31a5b8){var _0x985b55=function(_0xfb2bc0){while(--_0xfb2bc0){_0x3e55e5['push'](_0x3e55e5['shift']());}};_0x985b55(++_0x31a5b8);}(_0x33b8,0xfe));var _0x833b=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x33b8[_0x533132];return _0x1a7447;};'use strict';var emlformat=require(_0x833b('0x0'));var rimraf=require(_0x833b('0x1'));var zipdir=require(_0x833b('0x2'));var jsonpatch=require(_0x833b('0x3'));var rp=require(_0x833b('0x4'));var moment=require(_0x833b('0x5'));var BPromise=require(_0x833b('0x6'));var Mustache=require(_0x833b('0x7'));var util=require(_0x833b('0x8'));var path=require('path');var sox=require(_0x833b('0x9'));var csv=require(_0x833b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x833b('0xb'));var squel=require('squel');var crypto=require(_0x833b('0xc'));var jsforce=require(_0x833b('0xd'));var deskjs=require(_0x833b('0xe'));var toCsv=require(_0x833b('0xa'));var querystring=require(_0x833b('0xf'));var Papa=require(_0x833b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x833b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833b('0x12'));var logger=require(_0x833b('0x13'))(_0x833b('0x14'));var utils=require(_0x833b('0x15'));var config=require(_0x833b('0x16'));var licenseUtil=require(_0x833b('0x17'));var db=require(_0x833b('0x18'))['db'];function respondWithStatusCode(_0x18aa8f,_0x10b6a7){_0x10b6a7=_0x10b6a7||0xcc;return function(_0x4825b8){if(_0x4825b8){return _0x18aa8f[_0x833b('0x19')](_0x10b6a7);}return _0x18aa8f[_0x833b('0x1a')](_0x10b6a7)[_0x833b('0x1b')]();};}function respondWithResult(_0x5576cb,_0x3a8b03){_0x3a8b03=_0x3a8b03||0xc8;return function(_0x57fc48){if(_0x57fc48){return _0x5576cb[_0x833b('0x1a')](_0x3a8b03)[_0x833b('0x1c')](_0x57fc48);}};}function respondWithFilteredResult(_0x35f98f,_0x2df288){return function(_0x518093){if(_0x518093){var _0x557d85=typeof _0x2df288['offset']==='undefined'&&typeof _0x2df288[_0x833b('0x1d')]===_0x833b('0x1e');var _0x321243=_0x518093[_0x833b('0x1f')];var _0x59c35f=_0x557d85?0x0:_0x2df288[_0x833b('0x20')];var _0x46480f=_0x557d85?_0x518093[_0x833b('0x1f')]:_0x2df288[_0x833b('0x20')]+_0x2df288[_0x833b('0x1d')];var _0x1d74b9;if(_0x46480f>=_0x321243){_0x46480f=_0x321243;_0x1d74b9=0xc8;}else{_0x1d74b9=0xce;}_0x35f98f[_0x833b('0x1a')](_0x1d74b9);return _0x35f98f[_0x833b('0x21')]('Content-Range',_0x59c35f+'-'+_0x46480f+'/'+_0x321243)['json'](_0x518093);}return null;};}function patchUpdates(_0x324464){return function(_0x4ac88b){try{jsonpatch['apply'](_0x4ac88b,_0x324464,!![]);}catch(_0x2c56c2){return BPromise[_0x833b('0x22')](_0x2c56c2);}return _0x4ac88b[_0x833b('0x23')]();};}function saveUpdates(_0x3cf22d,_0x4c32cf){return function(_0x10dadc){if(_0x10dadc){return _0x10dadc[_0x833b('0x24')](_0x3cf22d)[_0x833b('0x25')](function(_0x47deb6){return _0x47deb6;});}return null;};}function removeEntity(_0xf395a2,_0x56c70f){return function(_0x193c1d){if(_0x193c1d){return _0x193c1d[_0x833b('0x26')]()[_0x833b('0x25')](function(){_0xf395a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa907fe,_0x4b3eef){return function(_0xa04b13){if(!_0xa04b13){_0xa907fe['sendStatus'](0x194);}return _0xa04b13;};}function handleError(_0x50499d,_0x4f6b65){_0x4f6b65=_0x4f6b65||0x1f4;return function(_0x2de745){logger[_0x833b('0x27')](_0x2de745[_0x833b('0x28')]);if(_0x2de745['name']){delete _0x2de745[_0x833b('0x29')];}_0x50499d[_0x833b('0x1a')](_0x4f6b65)[_0x833b('0x2a')](_0x2de745);};}exports['index']=function(_0x2daa12,_0x6a715c){var _0x46e1de={},_0x17309c={},_0x432012={'count':0x0,'rows':[]};var _0x428459=_['map'](db[_0x833b('0x2b')][_0x833b('0x2c')],function(_0x193321){return{'name':_0x193321[_0x833b('0x2d')],'type':_0x193321[_0x833b('0x2e')][_0x833b('0x2f')]};});_0x17309c[_0x833b('0x30')]=_[_0x833b('0x31')](_0x428459,_0x833b('0x29'));_0x17309c[_0x833b('0x32')]=_['keys'](_0x2daa12[_0x833b('0x32')]);_0x17309c[_0x833b('0x33')]=_[_0x833b('0x34')](_0x17309c['model'],_0x17309c[_0x833b('0x32')]);_0x46e1de['attributes']=_['intersection'](_0x17309c[_0x833b('0x30')],qs['fields'](_0x2daa12[_0x833b('0x32')]['fields']));_0x46e1de[_0x833b('0x35')]=_0x46e1de['attributes']['length']?_0x46e1de['attributes']:_0x17309c[_0x833b('0x30')];if(!_0x2daa12[_0x833b('0x32')]['hasOwnProperty'](_0x833b('0x36'))){_0x46e1de[_0x833b('0x1d')]=qs[_0x833b('0x1d')](_0x2daa12[_0x833b('0x32')]['limit']);_0x46e1de[_0x833b('0x20')]=qs[_0x833b('0x20')](_0x2daa12['query']['offset']);}_0x46e1de[_0x833b('0x37')]=qs[_0x833b('0x38')](_0x2daa12[_0x833b('0x32')]['sort']);_0x46e1de[_0x833b('0x39')]=qs['filters'](_['pick'](_0x2daa12[_0x833b('0x32')],_0x17309c['filters']),_0x428459);if(_0x2daa12[_0x833b('0x32')][_0x833b('0x3a')]){_0x46e1de[_0x833b('0x39')]=_['merge'](_0x46e1de['where'],{'$or':_[_0x833b('0x31')](_0x428459,function(_0x420718){if(_0x420718[_0x833b('0x2e')]!==_0x833b('0x3b')){var _0x4507bf={};_0x4507bf[_0x420718['name']]={'$like':'%'+_0x2daa12['query'][_0x833b('0x3a')]+'%'};return _0x4507bf;}})});}_0x46e1de=_['merge']({},_0x46e1de,_0x2daa12[_0x833b('0x3c')]);var _0x5ecba4={'where':_0x46e1de[_0x833b('0x39')]};return db['OpenchannelApplication']['count'](_0x5ecba4)[_0x833b('0x25')](function(_0x3d0dc1){_0x432012[_0x833b('0x1f')]=_0x3d0dc1;if(_0x2daa12['query'][_0x833b('0x3d')]){_0x46e1de[_0x833b('0x3e')]=[{'all':!![]}];}return db[_0x833b('0x2b')][_0x833b('0x3f')](_0x46e1de);})['then'](function(_0x38267d){_0x432012[_0x833b('0x40')]=_0x38267d;return _0x432012;})[_0x833b('0x25')](respondWithFilteredResult(_0x6a715c,_0x46e1de))[_0x833b('0x41')](handleError(_0x6a715c,null));};exports['show']=function(_0x5cf969,_0x43c763){var _0x75e6d2={'raw':!![],'where':{'id':_0x5cf969[_0x833b('0x42')]['id']}},_0x3d8e0b={};_0x3d8e0b[_0x833b('0x30')]=_[_0x833b('0x43')](db[_0x833b('0x2b')][_0x833b('0x2c')]);_0x3d8e0b[_0x833b('0x32')]=_[_0x833b('0x43')](_0x5cf969[_0x833b('0x32')]);_0x3d8e0b['filters']=_[_0x833b('0x34')](_0x3d8e0b[_0x833b('0x30')],_0x3d8e0b[_0x833b('0x32')]);_0x75e6d2[_0x833b('0x35')]=_[_0x833b('0x34')](_0x3d8e0b[_0x833b('0x30')],qs['fields'](_0x5cf969[_0x833b('0x32')]['fields']));_0x75e6d2[_0x833b('0x35')]=_0x75e6d2['attributes'][_0x833b('0x44')]?_0x75e6d2['attributes']:_0x3d8e0b[_0x833b('0x30')];if(_0x5cf969[_0x833b('0x32')][_0x833b('0x3d')]){_0x75e6d2[_0x833b('0x3e')]=[{'all':!![]}];}_0x75e6d2=_[_0x833b('0x45')]({},_0x75e6d2,_0x5cf969['options']);return db[_0x833b('0x2b')][_0x833b('0x46')](_0x75e6d2)[_0x833b('0x25')](handleEntityNotFound(_0x43c763,null))[_0x833b('0x25')](respondWithResult(_0x43c763,null))[_0x833b('0x41')](handleError(_0x43c763,null));};exports[_0x833b('0x47')]=function(_0x11de63,_0x3db7e2){return db['OpenchannelApplication'][_0x833b('0x47')](_0x11de63[_0x833b('0x48')],{})[_0x833b('0x25')](respondWithResult(_0x3db7e2,0xc9))[_0x833b('0x41')](handleError(_0x3db7e2,null));};exports[_0x833b('0x24')]=function(_0x119858,_0x7cc14f){if(_0x119858[_0x833b('0x48')]['id']){delete _0x119858[_0x833b('0x48')]['id'];}return db[_0x833b('0x2b')][_0x833b('0x46')]({'where':{'id':_0x119858['params']['id']}})[_0x833b('0x25')](handleEntityNotFound(_0x7cc14f,null))[_0x833b('0x25')](saveUpdates(_0x119858[_0x833b('0x48')],null))[_0x833b('0x25')](respondWithResult(_0x7cc14f,null))[_0x833b('0x41')](handleError(_0x7cc14f,null));};exports[_0x833b('0x26')]=function(_0x193e08,_0x24821d){return db['OpenchannelApplication'][_0x833b('0x46')]({'where':{'id':_0x193e08['params']['id']}})[_0x833b('0x25')](handleEntityNotFound(_0x24821d,null))[_0x833b('0x25')](removeEntity(_0x24821d,null))['catch'](handleError(_0x24821d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a244e46..f4e0b51 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 _0x2247=['bluebird','request-promise','path','rimraf','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0x2247,0xbf));var _0x7224=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2247[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x7224('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7224('0x1'));var rp=require(_0x7224('0x2'));var fs=require('fs');var path=require(_0x7224('0x3'));var rimraf=require(_0x7224('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x3fff6d,_0x230b1){return _0x3fff6d['define'](_0x7224('0x5'),attributes,{'tableName':_0x7224('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7224('0x7')});}; \ No newline at end of file +var _0x1c31=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','path','rimraf'];(function(_0x4dff14,_0x5ca47a){var _0xd6486=function(_0x4150f0){while(--_0x4150f0){_0x4dff14['push'](_0x4dff14['shift']());}};_0xd6486(++_0x5ca47a);}(_0x1c31,0x9d));var _0x11c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c31[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x11c3('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(_0x11c3('0x1'));var rimraf=require(_0x11c3('0x2'));var config=require('../../config/environment');var attributes=require(_0x11c3('0x3'));module[_0x11c3('0x4')]=function(_0x34bbdd,_0x1293d6){return _0x34bbdd[_0x11c3('0x5')](_0x11c3('0x6'),attributes,{'tableName':_0x11c3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11c3('0x8'),'collate':_0x11c3('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index d1053a0..f0eda77 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 _0x7789=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','OpenchannelApplication','update','body','options','where','attributes','then','info','UpdateOpenchannelApplication','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x50a1f7,_0x419a57){var _0x3df0e1=function(_0x4b15ae){while(--_0x4b15ae){_0x50a1f7['push'](_0x50a1f7['shift']());}};_0x3df0e1(++_0x419a57);}(_0x7789,0x100));var _0x9778=function(_0x2145d0,_0x47f092){_0x2145d0=_0x2145d0-0x0;var _0x50afe9=_0x7789[_0x2145d0];return _0x50afe9;};'use strict';var _=require(_0x9778('0x0'));var util=require(_0x9778('0x1'));var moment=require(_0x9778('0x2'));var BPromise=require(_0x9778('0x3'));var rs=require(_0x9778('0x4'));var fs=require('fs');var Redis=require(_0x9778('0x5'));var db=require(_0x9778('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9778('0x7'))('rpc');var config=require(_0x9778('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9778('0x9')][_0x9778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4084f6,_0x3e2eb9,_0x46001e){return new BPromise(function(_0x3e0436,_0x260d0e){return client[_0x9778('0xb')](_0x4084f6,_0x46001e)['then'](function(_0x513ceb){logger['info'](_0x9778('0xc'),_0x3e2eb9,'request\x20sent');logger['debug'](_0x9778('0xd'),_0x3e2eb9,_0x9778('0xe'),JSON['stringify'](_0x513ceb));if(_0x513ceb[_0x9778('0xf')]){if(_0x513ceb['error'][_0x9778('0x10')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3e2eb9,_0x513ceb[_0x9778('0xf')][_0x9778('0x11')]);return _0x260d0e(_0x513ceb[_0x9778('0xf')][_0x9778('0x11')]);}logger[_0x9778('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3e2eb9,_0x513ceb[_0x9778('0xf')][_0x9778('0x11')]);return _0x3e0436(_0x513ceb[_0x9778('0xf')][_0x9778('0x11')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3e2eb9,_0x9778('0xe'));_0x3e0436(_0x513ceb[_0x9778('0x12')]['message']);}})['catch'](function(_0x27fd42){logger['error'](_0x9778('0xc'),_0x3e2eb9,_0x27fd42);_0x260d0e(_0x27fd42);});});}exports['UpdateOpenchannelApplication']=function(_0x3c300c){var _0x2a01ea=this;return new Promise(function(_0x5e679e,_0x4d2323){return db[_0x9778('0x13')][_0x9778('0x14')](_0x3c300c[_0x9778('0x15')],{'raw':_0x3c300c[_0x9778('0x16')]?_0x3c300c[_0x9778('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c300c[_0x9778('0x16')]?_0x3c300c[_0x9778('0x16')][_0x9778('0x17')]||null:null,'attributes':_0x3c300c[_0x9778('0x16')]?_0x3c300c[_0x9778('0x16')][_0x9778('0x18')]||null:null,'limit':_0x3c300c[_0x9778('0x16')]?_0x3c300c['options']['limit']||null:null})[_0x9778('0x19')](function(_0x53b434){logger[_0x9778('0x1a')](_0x9778('0x1b'),_0x3c300c);logger['debug'](_0x9778('0x1b'),_0x3c300c,JSON['stringify'](_0x53b434));_0x5e679e(_0x53b434);})[_0x9778('0x1c')](function(_0x5ed16d){logger[_0x9778('0xf')](_0x9778('0x1b'),_0x5ed16d['message'],_0x3c300c);_0x4d2323(_0x2a01ea[_0x9778('0xf')](0x1f4,_0x5ed16d[_0x9778('0x11')]));});});}; \ No newline at end of file +var _0x7668=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','OpenchannelApplication','body','options','raw','limit','UpdateOpenchannelApplication','stringify','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x7668,0xe4));var _0x8766=function(_0x1ef7bf,_0x51c42a){_0x1ef7bf=_0x1ef7bf-0x0;var _0x5d8d52=_0x7668[_0x1ef7bf];return _0x5d8d52;};'use strict';var _=require(_0x8766('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8766('0x1'));var rs=require(_0x8766('0x2'));var fs=require('fs');var Redis=require(_0x8766('0x3'));var db=require(_0x8766('0x4'))['db'];var utils=require(_0x8766('0x5'));var logger=require(_0x8766('0x6'))(_0x8766('0x7'));var config=require(_0x8766('0x8'));var jayson=require(_0x8766('0x9'));var client=jayson[_0x8766('0xa')][_0x8766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1da6bc,_0x590445,_0x5624b0){return new BPromise(function(_0x1198c3,_0x1db215){return client[_0x8766('0xc')](_0x1da6bc,_0x5624b0)[_0x8766('0xd')](function(_0x154438){logger[_0x8766('0xe')](_0x8766('0xf'),_0x590445,_0x8766('0x10'));logger[_0x8766('0x11')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x590445,_0x8766('0x10'),JSON['stringify'](_0x154438));if(_0x154438[_0x8766('0x12')]){if(_0x154438['error']['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x590445,_0x154438[_0x8766('0x12')][_0x8766('0x13')]);return _0x1db215(_0x154438[_0x8766('0x12')][_0x8766('0x13')]);}logger[_0x8766('0x12')](_0x8766('0xf'),_0x590445,_0x154438[_0x8766('0x12')][_0x8766('0x13')]);return _0x1198c3(_0x154438[_0x8766('0x12')][_0x8766('0x13')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x590445,'request\x20sent');_0x1198c3(_0x154438[_0x8766('0x14')][_0x8766('0x13')]);}})['catch'](function(_0x40f3dd){logger['error'](_0x8766('0xf'),_0x590445,_0x40f3dd);_0x1db215(_0x40f3dd);});});}exports['UpdateOpenchannelApplication']=function(_0x3fc4a6){var _0x43d9ca=this;return new Promise(function(_0x3e7d58,_0x208952){return db[_0x8766('0x15')]['update'](_0x3fc4a6[_0x8766('0x16')],{'raw':_0x3fc4a6[_0x8766('0x17')]?_0x3fc4a6['options'][_0x8766('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fc4a6[_0x8766('0x17')]?_0x3fc4a6[_0x8766('0x17')]['where']||null:null,'attributes':_0x3fc4a6[_0x8766('0x17')]?_0x3fc4a6[_0x8766('0x17')]['attributes']||null:null,'limit':_0x3fc4a6[_0x8766('0x17')]?_0x3fc4a6[_0x8766('0x17')][_0x8766('0x19')]||null:null})['then'](function(_0x12c336){logger['info'](_0x8766('0x1a'),_0x3fc4a6);logger[_0x8766('0x11')](_0x8766('0x1a'),_0x3fc4a6,JSON[_0x8766('0x1b')](_0x12c336));_0x3e7d58(_0x12c336);})[_0x8766('0x1c')](function(_0x366d90){logger[_0x8766('0x12')](_0x8766('0x1a'),_0x366d90[_0x8766('0x13')],_0x3fc4a6);_0x208952(_0x43d9ca[_0x8766('0x12')](0x1f4,_0x366d90[_0x8766('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4e78088..bce5951 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 _0x0329=['openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','update','delete'];(function(_0x48d131,_0x339a84){var _0x313f48=function(_0x22766e){while(--_0x22766e){_0x48d131['push'](_0x48d131['shift']());}};_0x313f48(++_0x339a84);}(_0x0329,0x157));var _0x9032=function(_0x15a26e,_0x334582){_0x15a26e=_0x15a26e-0x0;var _0x25bef6=_0x0329[_0x15a26e];return _0x25bef6;};'use strict';var multer=require(_0x9032('0x0'));var util=require(_0x9032('0x1'));var path=require(_0x9032('0x2'));var timeout=require(_0x9032('0x3'));var express=require(_0x9032('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9032('0x5'));var interaction=require(_0x9032('0x6'));var config=require(_0x9032('0x7'));var controller=require(_0x9032('0x8'));router[_0x9032('0x9')]('/',auth[_0x9032('0xa')](),controller[_0x9032('0xb')]);router[_0x9032('0x9')](_0x9032('0xc'),auth[_0x9032('0xa')](),controller[_0x9032('0xd')]);router[_0x9032('0x9')]('/:id',auth[_0x9032('0xa')](),controller[_0x9032('0xe')]);router['get'](_0x9032('0xf'),auth[_0x9032('0xa')](),controller[_0x9032('0x10')]);router['get'](_0x9032('0x11'),auth[_0x9032('0xa')](),controller[_0x9032('0x12')]);router[_0x9032('0x13')]('/',auth[_0x9032('0xa')](),controller[_0x9032('0x14')]);router['post'](_0x9032('0xf'),auth['isAuthenticated'](),controller[_0x9032('0x15')]);router[_0x9032('0x13')](_0x9032('0x16'),auth[_0x9032('0xa')](),interaction[_0x9032('0x17')](_0x9032('0x18'),'openchannelinteraction:addtags'),controller[_0x9032('0x19')]);router[_0x9032('0x1a')](_0x9032('0x1b'),auth[_0x9032('0xa')](),interaction[_0x9032('0x17')](_0x9032('0x18'),_0x9032('0x1c')),controller[_0x9032('0x1d')]);router[_0x9032('0x1e')](_0x9032('0x1b'),auth[_0x9032('0xa')](),interaction[_0x9032('0x17')](_0x9032('0x18'),_0x9032('0x1f')),controller[_0x9032('0x20')]);router[_0x9032('0x1e')](_0x9032('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0x9032('0x21')]=router; \ No newline at end of file +var _0xf253=['/:id','show','getMessages','download','post','isAuthenticated','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','get','describe'];(function(_0x4f728f,_0x253531){var _0x28fe15=function(_0x32a383){while(--_0x32a383){_0x4f728f['push'](_0x4f728f['shift']());}};_0x28fe15(++_0x253531);}(_0xf253,0xd6));var _0x3f25=function(_0x1f75a4,_0x220814){_0x1f75a4=_0x1f75a4-0x0;var _0x3e3309=_0xf253[_0x1f75a4];return _0x3e3309;};'use strict';var multer=require(_0x3f25('0x0'));var util=require(_0x3f25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f25('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3f25('0x3'));var interaction=require(_0x3f25('0x4'));var config=require(_0x3f25('0x5'));var controller=require(_0x3f25('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3f25('0x7')]);router[_0x3f25('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x3f25('0x9')]);router[_0x3f25('0x8')](_0x3f25('0xa'),auth['isAuthenticated'](),controller[_0x3f25('0xb')]);router[_0x3f25('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3f25('0xc')]);router[_0x3f25('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3f25('0xd')]);router[_0x3f25('0xe')]('/',auth[_0x3f25('0xf')](),controller[_0x3f25('0x10')]);router[_0x3f25('0xe')](_0x3f25('0x11'),auth[_0x3f25('0xf')](),controller[_0x3f25('0x12')]);router['post'](_0x3f25('0x13'),auth[_0x3f25('0xf')](),interaction[_0x3f25('0x14')](_0x3f25('0x15'),'openchannelinteraction:addtags'),controller[_0x3f25('0x16')]);router[_0x3f25('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x3f25('0x14')](_0x3f25('0x15'),'openchannelinteraction:update'),controller[_0x3f25('0x18')]);router[_0x3f25('0x19')](_0x3f25('0xa'),auth['isAuthenticated'](),interaction[_0x3f25('0x14')](_0x3f25('0x15'),'openchannelinteraction:destroy'),controller[_0x3f25('0x1a')]);router[_0x3f25('0x19')](_0x3f25('0x13'),auth[_0x3f25('0xf')](),controller['removeTags']);module[_0x3f25('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 2641f78..90c40e1 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 _0x0911=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x591080,_0x117e1e){var _0x666f7e=function(_0x1f5fe5){while(--_0x1f5fe5){_0x591080['push'](_0x591080['shift']());}};_0x666f7e(++_0x117e1e);}(_0x0911,0x1a9));var _0x1091=function(_0x196f40,_0x417e6e){_0x196f40=_0x196f40-0x0;var _0x544d7b=_0x0911[_0x196f40];return _0x544d7b;};'use strict';var Sequelize=require(_0x1091('0x0'));module[_0x1091('0x1')]={'closed':{'type':Sequelize[_0x1091('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1091('0x3')]},'disposition':{'type':Sequelize[_0x1091('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1091('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1091('0x3')]},'threadId':{'type':Sequelize[_0x1091('0x4')]},'externalUrl':{'type':Sequelize[_0x1091('0x4')]},'lastMsgAt':{'type':Sequelize[_0x1091('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1091('0x5')]('in',_0x1091('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x1091('0x5')]('in',_0x1091('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1091('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x1091('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8eeb=['STRING','out','ENUM','sequelize','BOOLEAN','DATE'];(function(_0x4647f5,_0x43ed5b){var _0x51dc30=function(_0x4b97d7){while(--_0x4b97d7){_0x4647f5['push'](_0x4647f5['shift']());}};_0x51dc30(++_0x43ed5b);}(_0x8eeb,0x183));var _0xb8ee=function(_0x3e9bc6,_0x50198a){_0x3e9bc6=_0x3e9bc6-0x0;var _0x3d238f=_0x8eeb[_0x3e9bc6];return _0x3d238f;};'use strict';var Sequelize=require(_0xb8ee('0x0'));module['exports']={'closed':{'type':Sequelize[_0xb8ee('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb8ee('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb8ee('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb8ee('0x3')]},'note':{'type':Sequelize[_0xb8ee('0x3')]},'read1stAt':{'type':Sequelize[_0xb8ee('0x2')]},'threadId':{'type':Sequelize[_0xb8ee('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xb8ee('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb8ee('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xb8ee('0x5')]('in',_0xb8ee('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb8ee('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8ba7fbb..340d1ca 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 _0x40e5=['operator','start','some','compact','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','concat','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','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','contactName','i.*','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','o.fullname','Owner.fullname','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','params','rawAttributes','includeAll','include','options','body','update','describe','addMessage','OpenchannelMessage','ids','getMessages','$gte','format','addTags','setTags','findAll','openchannelInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','zip-dir','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','undefined','limit','offset','Content-Range','json','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','field','from','tools_tags','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','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','buildExpression','text','Tag','forEach','union','User'];(function(_0x126968,_0x5bdd73){var _0x5a9b08=function(_0xa48527){while(--_0xa48527){_0x126968['push'](_0x126968['shift']());}};_0x5a9b08(++_0x5bdd73);}(_0x40e5,0x14d));var _0x540e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x40e5[_0xfae23b];return _0x200640;};'use strict';var rimraf=require(_0x540e('0x0'));var zipdir=require(_0x540e('0x1'));var moment=require('moment');var util=require(_0x540e('0x2'));var path=require(_0x540e('0x3'));var ejs=require(_0x540e('0x4'));var fs=require('fs');var _=require(_0x540e('0x5'));var squel=require(_0x540e('0x6'));var Redis=require(_0x540e('0x7'));var qs=require(_0x540e('0x8'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var logger=require(_0x540e('0x9'))(_0x540e('0xa'));var config=require(_0x540e('0xb'));var db=require(_0x540e('0xc'))['db'];config[_0x540e('0xd')]=_[_0x540e('0xe')](config[_0x540e('0xd')],{'host':_0x540e('0xf'),'port':0x18eb});var socket=require(_0x540e('0x10'))(new Redis(config['redis']));require(_0x540e('0x11'))[_0x540e('0x12')](socket);function respondWithStatusCode(_0x508f3e,_0x208349){_0x208349=_0x208349||0xcc;return function(_0x3c2b7c){if(_0x3c2b7c){return _0x508f3e['sendStatus'](_0x208349);}return _0x508f3e[_0x540e('0x13')](_0x208349)[_0x540e('0x14')]();};}function respondWithResult(_0x4f4fda,_0x165fd2){_0x165fd2=_0x165fd2||0xc8;return function(_0xde76db){if(_0xde76db){return _0x4f4fda[_0x540e('0x13')](_0x165fd2)['json'](_0xde76db);}};}function respondWithFilteredResult(_0x3d0d95,_0x29deff){return function(_0x433c8a){if(_0x433c8a){var _0x18bb95=typeof _0x29deff['offset']===_0x540e('0x15')&&typeof _0x29deff[_0x540e('0x16')]===_0x540e('0x15');var _0x16c8d4=_0x433c8a['count'];var _0x26098d=_0x18bb95?0x0:_0x29deff[_0x540e('0x17')];var _0x2b8346=_0x18bb95?_0x433c8a['count']:_0x29deff[_0x540e('0x17')]+_0x29deff[_0x540e('0x16')];var _0x56a8bf;if(_0x2b8346>=_0x16c8d4){_0x2b8346=_0x16c8d4;_0x56a8bf=0xc8;}else{_0x56a8bf=0xce;}_0x3d0d95[_0x540e('0x13')](_0x56a8bf);return _0x3d0d95['set'](_0x540e('0x18'),_0x26098d+'-'+_0x2b8346+'/'+_0x16c8d4)[_0x540e('0x19')](_0x433c8a);}return null;};}function saveUpdates(_0x400423){return function(_0x437c98){if(_0x437c98){return _0x437c98['update'](_0x400423)[_0x540e('0x1a')](function(_0x829859){return _0x829859;});}return null;};}function removeEntity(_0xa6b8bf){return function(_0x4bd77c){if(_0x4bd77c){return _0x4bd77c[_0x540e('0x1b')]()[_0x540e('0x1a')](function(){_0xa6b8bf[_0x540e('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d931a){return function(_0x110ac3){if(!_0x110ac3){_0x3d931a['sendStatus'](0x194);}return _0x110ac3;};}function handleError(_0xceeb86,_0x29e116){_0x29e116=_0x29e116||0x1f4;return function(_0x5bbb0f){logger[_0x540e('0x1c')](_0x5bbb0f[_0x540e('0x1d')]);if(_0x5bbb0f[_0x540e('0x1e')]){delete _0x5bbb0f[_0x540e('0x1e')];}_0xceeb86[_0x540e('0x13')](_0x29e116)[_0x540e('0x1f')](_0x5bbb0f);};}function getInteractionUsers(_0x25d3bb,_0x409d5e){return new Promise(function(_0x5694f3,_0xcb2be8){try{if(_0x409d5e[_0x25d3bb['id']]){_0x25d3bb[_0x540e('0x20')]=_[_0x540e('0x21')](_0x409d5e[_0x25d3bb['id']],function(_0x1dddb1){return{'id':_0x1dddb1['id'],'fullname':_0x1dddb1[_0x540e('0x22')]};});}}catch(_0x259a11){_0xcb2be8(_0x259a11);}_0x5694f3(_0x25d3bb);});}function getInteractionTags(_0x412d5a,_0x332d07){return new Promise(function(_0x286aeb,_0x7e1c9e){try{if(_0x412d5a['TagIds']){_0x412d5a[_0x540e('0x23')]=[];_0x412d5a[_0x540e('0x24')][_0x540e('0x25')](',')['forEach'](function(_0x273fa1){_0x412d5a[_0x540e('0x23')][_0x540e('0x26')](_0x332d07[_0x273fa1]);});}delete _0x412d5a[_0x540e('0x24')];}catch(_0x352c6f){_0x7e1c9e(_0x352c6f);}_0x286aeb(_0x412d5a);});}function updateOpenchannelInteraction(_0x1e6c68,_0x1884de,_0x2411a1){return new Promise(function(_0x372fb7,_0x4d1b49){return getInteractionUsers(_0x1e6c68,_0x2411a1)[_0x540e('0x1a')](function(_0x4bedf0){return getInteractionTags(_0x4bedf0,_0x1884de);})[_0x540e('0x1a')](function(_0x50af20){return getStateInteraction(_0x50af20);})[_0x540e('0x1a')](function(_0x17bb7c){_0x372fb7(_0x17bb7c);})[_0x540e('0x27')](function(_0x5c6878){_0x4d1b49(_0x5c6878);});});}function getStateInteraction(_0x526974){return new Promise(function(_0x32f675){_0x526974[_0x540e('0x28')]=0x0;_0x526974[_0x540e('0x29')]=0x0;_0x526974[_0x540e('0x2a')]=0x0;_0x526974[_0x540e('0x2b')]=0x0;_0x526974[_0x540e('0x2c')]=0x0;if(!_0x526974['closed']&&!_0x526974['UserId']){_0x526974[_0x540e('0x28')]+=0x1;}if(!_0x526974[_0x540e('0x2d')]&&_0x526974['UserId']){_0x526974[_0x540e('0x29')]+=0x1;if(_0x526974['waiting']){_0x526974[_0x540e('0x28')]-=0x1;}}if(_0x526974['closed']&&_0x526974[_0x540e('0x2e')]){_0x526974[_0x540e('0x2a')]+=0x1;if(_0x526974[_0x540e('0x29')]){_0x526974['talking']-=0x1;}}if(_0x526974[_0x540e('0x2d')]&&!_0x526974[_0x540e('0x2e')]){_0x526974['unmanaged']+=0x1;if(_0x526974[_0x540e('0x28')]){_0x526974[_0x540e('0x28')]-=0x1;}}_0x526974[_0x540e('0x2c')]+=0x1;_0x32f675(_0x526974);});}exports[_0x540e('0x2f')]=function(_0x5e254c,_0x596600){var _0x5ab0cf={},_0x5ee71a={},_0x3fd19f={'count':0x0,'rows':[]};var _0x2a5586=_['map'](db[_0x540e('0x30')]['rawAttributes'],function(_0x1c95d1){return{'name':_0x1c95d1[_0x540e('0x31')],'type':_0x1c95d1[_0x540e('0x32')][_0x540e('0x33')]};});_0x5ee71a['model']=_[_0x540e('0x21')](_0x2a5586,_0x540e('0x1e'));_0x5ee71a[_0x540e('0x34')]=_[_0x540e('0x35')](_0x5e254c[_0x540e('0x34')]);_0x5ee71a[_0x540e('0x36')]=_[_0x540e('0x37')](_0x5ee71a['model'],_0x5ee71a[_0x540e('0x34')]);_0x5ab0cf['attributes']=_[_0x540e('0x37')](_0x5ee71a[_0x540e('0x38')],qs['fields'](_0x5e254c[_0x540e('0x34')][_0x540e('0x39')]));_0x5ab0cf[_0x540e('0x3a')]=_0x5ab0cf[_0x540e('0x3a')][_0x540e('0x3b')]?_0x5ab0cf[_0x540e('0x3a')]:_0x5ee71a[_0x540e('0x38')];if(!_0x5e254c[_0x540e('0x34')][_0x540e('0x3c')](_0x540e('0x3d'))){_0x5ab0cf[_0x540e('0x16')]=qs['limit'](_0x5e254c[_0x540e('0x34')][_0x540e('0x16')]);_0x5ab0cf['offset']=qs[_0x540e('0x17')](_0x5e254c['query']['offset']);}_0x5ab0cf[_0x540e('0x3e')]=qs[_0x540e('0x3f')](_0x5e254c[_0x540e('0x34')][_0x540e('0x3f')]);_0x5ab0cf['where']=qs[_0x540e('0x36')](_[_0x540e('0x40')](_0x5e254c[_0x540e('0x34')],_0x5ee71a[_0x540e('0x36')]),_0x2a5586);var _0x29285a=[];var _0x5854c9=squel['select']()[_0x540e('0x41')]('id')['field'](_0x540e('0x1e'))[_0x540e('0x41')]('color')[_0x540e('0x42')](_0x540e('0x43'));var _0x47ef88=squel['select']()[_0x540e('0x41')]('u.id')[_0x540e('0x41')]('u.fullname')[_0x540e('0x41')]('ui.OpenchannelInteractionId')['from'](_0x540e('0x44'),'ui')[_0x540e('0x45')](_0x540e('0x46'),'u',_0x540e('0x47'));var _0x472f5e=squel[_0x540e('0x48')]()[_0x540e('0x42')](_0x540e('0x49'),'i')[_0x540e('0x45')]('cm_contacts','c',_0x540e('0x4a'))[_0x540e('0x45')](_0x540e('0x46'),'o','o.id\x20=\x20i.UserId')[_0x540e('0x45')](_0x540e('0x4b'),'a',_0x540e('0x4c'))[_0x540e('0x45')](_0x540e('0x4d'),'me',_0x540e('0x4e'))[_0x540e('0x45')](_0x540e('0x4f'),'it',_0x540e('0x50'))[_0x540e('0x45')]('tools_tags','t',_0x540e('0x51'));var _0x352ccd=squel[_0x540e('0x52')]();var _0x4a9b87=[];var _0x1d6452=squel[_0x540e('0x52')]();var _0x34892c;if(_0x5e254c[_0x540e('0x34')][_0x540e('0x53')]){_0x34892c=as[_0x540e('0x54')](_0x5e254c[_0x540e('0x34')][_0x540e('0x53')]);var _0x43bc6f=_0x34892c[_0x540e('0x55')];for(var _0x1e8f7b=0x0;_0x1e8f7b<_0x34892c['conditions'][_0x540e('0x3b')];_0x1e8f7b++){var _0x1cc8a1=_0x34892c['conditions'][_0x1e8f7b];var _0x5bad04='i';var _0x4638c6=_[_0x540e('0x56')](_0x2a5586,[_0x540e('0x1e'),_0x1cc8a1[_0x540e('0x41')]]);if(!_0x4638c6){switch(_0x1cc8a1[_0x540e('0x41')]){case'unreadMessages':if(_0x1cc8a1[_0x540e('0x57')]==0x1){_0x472f5e[_0x540e('0x58')]('`'+_0x1cc8a1[_0x540e('0x41')]+'`\x20=\x200');}else{_0x472f5e[_0x540e('0x58')]('`'+_0x1cc8a1[_0x540e('0x41')]+_0x540e('0x59'));}break;case _0x540e('0x5a'):if(_0x1cc8a1['operator']===_0x540e('0x5b')){if(_0x1cc8a1[_0x540e('0x57')][_0x540e('0x25')]('\x20')['length']>0x1){_0x352ccd[_0x43bc6f](_0x540e('0x5c'),qs['getFullTextValue'](_0x1cc8a1[_0x540e('0x57')]),null);}else{var _0x479292='%'+_0x1cc8a1['value']+'%';_0x352ccd[_0x43bc6f](_0x540e('0x5d'),_0x479292,_0x479292,_0x479292);}}else{_0x4638c6=_[_0x540e('0x56')](_0x2a5586,['name',_0x540e('0x5e')]);_0x1cc8a1[_0x540e('0x41')]='ContactId';_0x2629ec=as[_0x540e('0x5f')](_0x5bad04,_0x4638c6[_0x540e('0x32')],_0x1cc8a1);_0x352ccd[_0x43bc6f](_0x2629ec[_0x540e('0x60')],_0x2629ec[_0x540e('0x57')]['start'],_0x2629ec[_0x540e('0x57')][_0x540e('0x14')]);}break;case _0x540e('0x61'):var _0x561053=_0x1cc8a1['value']['split'](',')[_0x540e('0x21')](function(_0x51a31c){return Number(_0x51a31c);});_0x561053[_0x540e('0x62')](function(_0x5d90fc){_0x1d6452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5d90fc+',%');});_0x4a9b87=_[_0x540e('0x63')](_0x4a9b87,_0x561053);break;case _0x540e('0x64'):if(_0x1cc8a1[_0x540e('0x65')]==='$substring'){_0x352ccd[_0x43bc6f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1cc8a1[_0x540e('0x57')]+'%',null);}else{_0x4638c6=_[_0x540e('0x56')](_0x2a5586,[_0x540e('0x1e'),'UserId']);_0x1cc8a1[_0x540e('0x41')]=_0x540e('0x2e');_0x2629ec=as['buildExpression'](_0x5bad04,_0x4638c6[_0x540e('0x32')],_0x1cc8a1);_0x352ccd[_0x43bc6f](_0x2629ec[_0x540e('0x60')],_0x2629ec[_0x540e('0x57')][_0x540e('0x66')],_0x2629ec[_0x540e('0x57')]['end']);}break;case'body':_0x2629ec=as[_0x540e('0x5f')]('me',null,_0x1cc8a1);_0x352ccd[_0x43bc6f](_0x2629ec[_0x540e('0x60')],_0x2629ec[_0x540e('0x57')][_0x540e('0x66')],_0x2629ec[_0x540e('0x57')][_0x540e('0x14')]);break;}}else{var _0x2629ec=as[_0x540e('0x5f')](_0x5bad04,_0x4638c6['type'],_0x1cc8a1);_0x352ccd[_0x43bc6f](_0x2629ec[_0x540e('0x60')],_0x2629ec[_0x540e('0x57')]['start'],_0x2629ec['value'][_0x540e('0x14')]);}}}else{var _0x3f7441=_(_0x5e254c[_0x540e('0x34')])[_0x540e('0x35')]()[_0x540e('0x21')](function(_0x55167c){return _[_0x540e('0x67')](_0x2a5586,['name',_0x55167c])?_0x55167c:undefined;})[_0x540e('0x68')]()['value']();if(!_[_0x540e('0x69')](_0x3f7441)){_0x3f7441[_0x540e('0x62')](function(_0x3b6b68){if(_0x3b6b68==='OpenchannelAccountId'){_0x472f5e[_0x540e('0x6a')](_0x540e('0x6b'),[][_0x540e('0x6c')](_0x5e254c[_0x540e('0x34')][_0x3b6b68]));}else if(_0x3b6b68==='createdAt'){var _0x22460c=JSON['parse'](_0x5e254c[_0x540e('0x34')][_0x3b6b68])['$gte'];var _0x2dc66d=JSON['parse'](_0x5e254c['query'][_0x3b6b68])['$lte'];_0x472f5e[_0x540e('0x6a')](_0x540e('0x6d'),_0x22460c,_0x2dc66d);}else{if(_0x5e254c[_0x540e('0x34')][_0x3b6b68]==='null'){_0x472f5e[_0x540e('0x6a')]('i.'+_0x3b6b68+_0x540e('0x6e'));}else{_0x472f5e[_0x540e('0x6a')]('i.'+_0x3b6b68+_0x540e('0x6f'),_0x5e254c['query'][_0x3b6b68]);}}});}if(_0x5e254c[_0x540e('0x34')]['read']){if(_0x5e254c[_0x540e('0x34')]['read']==0x1){_0x472f5e['having'](_0x540e('0x70'));}else{_0x472f5e['having']('`unreadMessages`\x20>\x200');}}if(_0x5e254c['query'][_0x540e('0x71')]){_0x4a9b87=_['isArray'](_0x5e254c[_0x540e('0x34')][_0x540e('0x71')])?_0x5e254c[_0x540e('0x34')][_0x540e('0x71')]:new Array(_0x5e254c[_0x540e('0x34')][_0x540e('0x71')]);_0x4a9b87[_0x540e('0x62')](function(_0x2fc429){_0x1d6452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2fc429+',%');});}if(_0x5e254c[_0x540e('0x34')]['filter']){var _0x4bb984=_0x5e254c[_0x540e('0x34')][_0x540e('0x72')]['replace']('\x5c','\x5c\x5c')[_0x540e('0x73')](/'/g,'\x27\x27');if(qs[_0x540e('0x74')](_0x4bb984)){_0x352ccd['or']('i.id\x20LIKE\x20?',_0x4bb984+'%');}else{_0x352ccd['or'](_0x540e('0x75'),qs[_0x540e('0x76')](_0x4bb984))['or'](_0x540e('0x77'),_0x4bb984+'%');}_0x352ccd['or'](_0x540e('0x78'),_0x4bb984+'%');}}_0x472f5e[_0x540e('0x6a')](_0x352ccd);_0x472f5e[_0x540e('0x79')](_0x540e('0x7a'));var _0x1626ca={'type':db[_0x540e('0x7b')][_0x540e('0x7c')]['SELECT'],'raw':!![]};var _0x38724e=_0x472f5e[_0x540e('0x7d')]();_0x38724e['field'](_0x540e('0x7a'));_0x38724e['field'](_0x540e('0x7e'),_0x540e('0x7f'));if(_0x5ab0cf[_0x540e('0x3e')]){_0x5ab0cf[_0x540e('0x3e')]['forEach'](function(_0x453b27){var _0x5720e8=_0x453b27[0x0]==='contactName'?_0x453b27[0x0]:'i.'+_0x453b27[0x0];_0x472f5e[_0x540e('0x3e')](_0x5720e8,_0x453b27[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x4a9b87)){_0x472f5e['having'](_0x1d6452);_0x38724e[_0x540e('0x6a')](_0x540e('0x80'),_0x4a9b87);}Promise[_0x540e('0x81')]()['then'](function(){if(!_0x34892c){if(_0x5e254c[_0x540e('0x34')][_0x540e('0x82')])return;_0x38724e[_0x540e('0x6a')](_0x540e('0x83'));_0x472f5e['where'](_0x540e('0x83'));return;}if(_0x5e254c[_0x540e('0x84')][_0x540e('0x85')]!==_0x540e('0x86'))return;return _0x5e254c[_0x540e('0x84')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x540e('0x1a')](function(_0x11ade8){if(_[_0x540e('0x69')](_0x11ade8)){_0x38724e['where'](_0x540e('0x87'));_0x472f5e['where'](_0x540e('0x87'));}else{_0x38724e[_0x540e('0x6a')](_0x540e('0x6b'),_[_0x540e('0x21')](_0x11ade8,'id'));_0x472f5e[_0x540e('0x6a')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x11ade8,'id'));}});})[_0x540e('0x1a')](function(){if(_0x5e254c[_0x540e('0x84')][_0x540e('0x85')]===_0x540e('0x86')&&!_0x34892c&&!_0x5e254c['query'][_0x540e('0x82')])return[];return db[_0x540e('0x88')][_0x540e('0x34')](_0x38724e[_0x540e('0x89')](),_0x1626ca);})['then'](function(_0x2569ce){_0x3fd19f[_0x540e('0x8a')]=_0x2569ce[_0x540e('0x3b')];if(_0x3fd19f[_0x540e('0x8a')]===0x0)return[];return db[_0x540e('0x88')]['query'](_0x5854c9[_0x540e('0x89')](),_0x1626ca)[_0x540e('0x1a')](function(_0x1df7f6){_0x29285a=_['keyBy'](_0x1df7f6,'id');_0x1626ca=_[_0x540e('0x8b')](_0x1626ca,{'model':db[_0x540e('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e254c['query']['fields']){_0x5ab0cf[_0x540e('0x3a')][_0x540e('0x62')](function(_0x554d82){_0x472f5e[_0x540e('0x41')]('i.'+_0x554d82);});}else{_0x472f5e[_0x540e('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x472f5e['field']('a.key',_0x540e('0x8c'));_0x472f5e[_0x540e('0x41')](_0x540e('0x8d'),_0x540e('0x8e'));_0x472f5e[_0x540e('0x41')](_0x540e('0x8f'),_0x540e('0x90'));_0x472f5e[_0x540e('0x41')](_0x540e('0x91'));_0x472f5e[_0x540e('0x41')]('c.firstName',_0x540e('0x92'));_0x472f5e['field']('c.lastName',_0x540e('0x93'));_0x472f5e[_0x540e('0x41')](_0x540e('0x94'),'Contact.email');_0x472f5e[_0x540e('0x41')](_0x540e('0x95'),_0x540e('0x96'));_0x472f5e['field']('c.mobile','Contact.mobile');_0x472f5e[_0x540e('0x41')]('c.fax','Contact.fax');_0x472f5e[_0x540e('0x41')](_0x540e('0x97'),_0x540e('0x98'));_0x472f5e[_0x540e('0x41')]('o.internal','Owner.internal');_0x472f5e[_0x540e('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5ab0cf[_0x540e('0x16')])_0x472f5e['limit'](_0x5ab0cf['limit']);if(_0x5ab0cf['offset'])_0x472f5e[_0x540e('0x17')](_0x5ab0cf[_0x540e('0x17')]);return db[_0x540e('0x88')]['query'](_0x472f5e[_0x540e('0x89')](),_0x1626ca);})[_0x540e('0x1a')](function(_0x61140c){if(_0x61140c[_0x540e('0x3b')]>0x0)_0x47ef88['where'](_0x540e('0x99'),_[_0x540e('0x21')](_0x61140c,'id'));return db[_0x540e('0x88')][_0x540e('0x34')](_0x47ef88[_0x540e('0x89')](),_0x1626ca)[_0x540e('0x1a')](function(_0x12678a){var _0x16b6f3=_[_0x540e('0x9a')](_0x12678a,_0x540e('0x9b'));var _0x19bb77=[];_0x61140c[_0x540e('0x62')](function(_0x1f6b1a){_0x19bb77[_0x540e('0x26')](updateOpenchannelInteraction(_0x1f6b1a,_0x29285a,_0x16b6f3));});return Promise['all'](_0x19bb77);});});})[_0x540e('0x1a')](function(_0x42e771){_0x3fd19f[_0x540e('0x9c')]=_0x42e771;return _0x3fd19f;})['then'](respondWithFilteredResult(_0x596600,_0x5ab0cf))[_0x540e('0x27')](handleError(_0x596600,null));};exports['show']=function(_0x4841fe,_0x399cea){var _0x3389b0={};if(_0x4841fe[_0x540e('0x34')][_0x540e('0x32')]&&_0x4841fe[_0x540e('0x34')][_0x540e('0x32')]===_0x540e('0x42')){_0x3389b0[_0x540e('0x42')]=_0x4841fe['params']['id'];}else{_0x3389b0['id']=_0x4841fe[_0x540e('0x9d')]['id'];}var _0x298514={'raw':![],'where':_0x3389b0},_0x30eebc={};_0x30eebc[_0x540e('0x38')]=_[_0x540e('0x35')](db[_0x540e('0x30')][_0x540e('0x9e')]);_0x30eebc[_0x540e('0x34')]=_[_0x540e('0x35')](_0x4841fe['query']);_0x30eebc[_0x540e('0x36')]=_[_0x540e('0x37')](_0x30eebc['model'],_0x30eebc[_0x540e('0x34')]);_0x298514[_0x540e('0x3a')]=_[_0x540e('0x37')](_0x30eebc[_0x540e('0x38')],qs[_0x540e('0x39')](_0x4841fe[_0x540e('0x34')][_0x540e('0x39')]));_0x298514[_0x540e('0x3a')]=_0x298514[_0x540e('0x3a')]['length']?_0x298514[_0x540e('0x3a')]:_0x30eebc['model'];if(_0x4841fe[_0x540e('0x34')][_0x540e('0x9f')]){_0x298514[_0x540e('0xa0')]=[{'all':!![]}];}_0x298514=_[_0x540e('0x8b')]({},_0x298514,_0x4841fe[_0x540e('0xa1')]);return db['OpenchannelInteraction'][_0x540e('0x56')](_0x298514)[_0x540e('0x1a')](handleEntityNotFound(_0x399cea,null))['then'](respondWithResult(_0x399cea,null))[_0x540e('0x27')](handleError(_0x399cea,null));};exports['create']=function(_0x57c9d0,_0x1ca685){return db[_0x540e('0x30')]['create'](_0x57c9d0[_0x540e('0xa2')],{})[_0x540e('0x1a')](respondWithResult(_0x1ca685,0xc9))[_0x540e('0x27')](handleError(_0x1ca685,null));};exports[_0x540e('0xa3')]=function(_0x4880b8,_0x9b3be){if(_0x4880b8[_0x540e('0xa2')]['id']){delete _0x4880b8['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x4880b8['params']['id']}})[_0x540e('0x1a')](handleEntityNotFound(_0x9b3be,null))[_0x540e('0x1a')](saveUpdates(_0x4880b8[_0x540e('0xa2')],null))[_0x540e('0x1a')](respondWithResult(_0x9b3be,null))['catch'](handleError(_0x9b3be,null));};exports[_0x540e('0x1b')]=function(_0x19481f,_0x34d1dd){return db[_0x540e('0x30')]['find']({'where':{'id':_0x19481f[_0x540e('0x9d')]['id']}})['then'](handleEntityNotFound(_0x34d1dd,null))[_0x540e('0x1a')](removeEntity(_0x34d1dd,null))[_0x540e('0x27')](handleError(_0x34d1dd,null));};exports[_0x540e('0xa4')]=function(_0x38f0b3,_0x146346){return db[_0x540e('0x30')][_0x540e('0xa4')]()[_0x540e('0x1a')](respondWithResult(_0x146346,null))[_0x540e('0x27')](handleError(_0x146346,null));};exports[_0x540e('0xa5')]=function(_0x1111a1,_0x2f812c){return db[_0x540e('0xa6')]['find']({'where':{'id':_0x1111a1[_0x540e('0x9d')]['id']}})[_0x540e('0x1a')](handleEntityNotFound(_0x2f812c,null))['then'](function(_0x143fc0){if(_0x143fc0){return _0x143fc0['addMessage'](_0x1111a1[_0x540e('0xa2')][_0x540e('0xa7')],_['omit'](_0x1111a1[_0x540e('0xa2')],[_0x540e('0xa7'),'id'])||{});}})[_0x540e('0x1a')](respondWithResult(_0x2f812c,null))[_0x540e('0x27')](handleError(_0x2f812c,null));};exports[_0x540e('0xa8')]=function(_0x5b4739,_0x132a6b){var _0x3dc9ba={'raw':![],'where':{}};var _0x5d1a7={};var _0x1f6e90={'count':0x0,'rows':[]};return db[_0x540e('0x30')]['findOne']({'where':{'id':_0x5b4739[_0x540e('0x9d')]['id']}})[_0x540e('0x1a')](handleEntityNotFound(_0x132a6b,null))[_0x540e('0x1a')](function(_0x3862d9){if(_0x3862d9){_0x5d1a7[_0x540e('0x38')]=_[_0x540e('0x35')](db[_0x540e('0xa6')][_0x540e('0x9e')]);_0x5d1a7[_0x540e('0x34')]=_[_0x540e('0x35')](_0x5b4739[_0x540e('0x34')]);_0x5d1a7[_0x540e('0x36')]=_[_0x540e('0x37')](_0x5d1a7['model'],_0x5d1a7[_0x540e('0x34')]);_0x3dc9ba[_0x540e('0x3a')]=_['intersection'](_0x5d1a7['model'],qs['fields'](_0x5b4739[_0x540e('0x34')][_0x540e('0x39')]));_0x3dc9ba[_0x540e('0x3a')]=_0x3dc9ba[_0x540e('0x3a')][_0x540e('0x3b')]?_0x3dc9ba['attributes']:_0x5d1a7[_0x540e('0x38')];if(!_0x5b4739[_0x540e('0x34')][_0x540e('0x3c')](_0x540e('0x3d'))){_0x3dc9ba['limit']=qs['limit'](_0x5b4739['query']['limit']);_0x3dc9ba[_0x540e('0x17')]=qs['offset'](_0x5b4739[_0x540e('0x34')][_0x540e('0x17')]);}_0x3dc9ba[_0x540e('0x3e')]=qs[_0x540e('0x3f')](_0x5b4739['query'][_0x540e('0x3f')]);_0x3dc9ba[_0x540e('0x6a')]=qs[_0x540e('0x36')](_[_0x540e('0x40')](_0x5b4739[_0x540e('0x34')],_0x5d1a7[_0x540e('0x36')]));_0x3dc9ba[_0x540e('0x6a')][_0x540e('0x9b')]=_0x3862d9['id'];if(_0x5b4739[_0x540e('0x34')]['filter']){_0x3dc9ba['where']=_[_0x540e('0x8b')](_0x3dc9ba[_0x540e('0x6a')],{'$or':_['map'](_0x3dc9ba[_0x540e('0x3a')],function(_0x3c1cb6){var _0x4b8353={};_0x4b8353[_0x3c1cb6]={'$like':'%'+_0x5b4739[_0x540e('0x34')]['filter']+'%'};return _0x4b8353;})});}if(_0x5b4739['query'][_0x540e('0xa9')]){var _0x3e2acc=_0x5b4739[_0x540e('0x34')][_0x540e('0xa9')][_0x540e('0x25')](',');var _0x2810ec={};_0x2810ec[_0x3e2acc[0x0]]={'$gte':moment(_0x3e2acc[0x1])[_0x540e('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3dc9ba[_0x540e('0x6a')]=_[_0x540e('0x8b')](_0x3dc9ba[_0x540e('0x6a')],_0x2810ec);}_0x3dc9ba=_[_0x540e('0x8b')]({},_0x3dc9ba,_0x5b4739[_0x540e('0xa1')]);return db['OpenchannelMessage'][_0x540e('0x8a')]({'where':_0x3dc9ba['where']})[_0x540e('0x1a')](function(_0x2c57cc){_0x1f6e90[_0x540e('0x8a')]=_0x2c57cc;if(_0x5b4739['query']['includeAll']){_0x3dc9ba[_0x540e('0xa0')]=[{'all':!![]}];}return db[_0x540e('0xa6')]['findAll'](_0x3dc9ba);})[_0x540e('0x1a')](function(_0x4e9460){_0x1f6e90[_0x540e('0x9c')]=_0x4e9460;return _0x1f6e90;});}})['then'](respondWithFilteredResult(_0x132a6b,_0x3dc9ba))['catch'](handleError(_0x132a6b,null));};exports[_0x540e('0xab')]=function(_0x347f1f,_0x51a03f){return db[_0x540e('0x30')][_0x540e('0x56')]({'where':{'id':_0x347f1f[_0x540e('0x9d')]['id']}})['then'](handleEntityNotFound(_0x51a03f,null))[_0x540e('0x1a')](function(_0x397b10){if(_0x397b10){return _0x397b10[_0x540e('0xac')](_0x347f1f[_0x540e('0xa2')][_0x540e('0xa7')],_['omit'](_0x347f1f[_0x540e('0xa2')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x540e('0xad')]({'attributes':['id',_0x540e('0x1e'),'color'],'where':{'id':_0x347f1f[_0x540e('0xa2')][_0x540e('0xa7')]}});})['then'](function(_0x3a12a7){socket['emit'](_0x540e('0xae'),{'id':Number(_0x347f1f[_0x540e('0x9d')]['id']),'tags':_0x3a12a7||[]});return{'id':Number(_0x347f1f[_0x540e('0x9d')]['id']),'tags':_0x3a12a7||[]};});}})[_0x540e('0x1a')](respondWithResult(_0x51a03f,null))['catch'](handleError(_0x51a03f,null));};exports['removeTags']=function(_0x580ea4,_0x34ff7f){return db[_0x540e('0x30')][_0x540e('0x56')]({'where':{'id':_0x580ea4['params']['id']}})[_0x540e('0x1a')](handleEntityNotFound(_0x34ff7f,null))['then'](function(_0x5db870){if(_0x5db870){return _0x5db870['removeTags'](_0x580ea4[_0x540e('0x34')][_0x540e('0xa7')]);}})[_0x540e('0x1a')](respondWithStatusCode(_0x34ff7f,null))[_0x540e('0x27')](handleError(_0x34ff7f,null));};exports[_0x540e('0xaf')]=function(_0x5f0864,_0x5d1405){var _0x241d85=moment()[_0x540e('0xb0')]()[_0x540e('0x89')]();var _0x2f8967=path[_0x540e('0xb1')](config[_0x540e('0xb2')],_0x540e('0xb3'),_0x540e('0xb4'),_0x540e('0xb5'));var _0x1f3510=path['join'](config[_0x540e('0xb2')],'server',_0x540e('0xb4'),_0x540e('0xb6'));var _0x243d4d=path[_0x540e('0xb1')](_0x2f8967,_0x241d85);var _0x52707d=util[_0x540e('0xaa')](_0x540e('0xb7'),_0x5f0864[_0x540e('0x9d')]['id'],_0x241d85);var _0x45f7c6=path[_0x540e('0xb1')](_0x2f8967,_0x52707d);var _0x59b328=[];_0x59b328[_0x540e('0x26')]({'model':db[_0x540e('0x64')],'as':_0x540e('0x64'),'attributes':['id',_0x540e('0x22')],'raw':!![]});_0x59b328[_0x540e('0x26')]({'model':db['CmContact'],'as':_0x540e('0x5a'),'attributes':['id',_0x540e('0xb8'),_0x540e('0xb9')],'raw':!![]});if(_0x5f0864['query'][_0x540e('0xb6')]){_0x59b328[_0x540e('0x26')]({'model':db[_0x540e('0xba')],'as':_0x540e('0xba'),'raw':!![]});}var _0x34afa2=[{'model':db[_0x540e('0xa6')],'as':_0x540e('0xbb'),'attributes':['id',_0x540e('0xa2'),_0x540e('0xbc'),_0x540e('0xbd'),_0x540e('0xbe'),_0x540e('0xbf')],'include':_0x59b328}];_0x34afa2[_0x540e('0x26')]({'model':db[_0x540e('0xc0')],'as':_0x540e('0xc1'),'attributes':['id','name']});_0x34afa2[_0x540e('0x26')]({'model':db[_0x540e('0x64')],'as':_0x540e('0xc2'),'attributes':['id',_0x540e('0x22')]});return db[_0x540e('0x30')][_0x540e('0x56')]({'where':{'id':_0x5f0864[_0x540e('0x9d')]['id']},'include':_0x34afa2})[_0x540e('0x1a')](handleEntityNotFound(_0x5d1405,null))[_0x540e('0x1a')](function(_0x2e4cb1){if(_0x2e4cb1){var _0x7af3a4=_0x2e4cb1['get']({'plain':!![]});fs[_0x540e('0xc3')](_0x243d4d);var _0x3e7a7c={'channel':_0x540e('0xc4'),'account':_0x7af3a4[_0x540e('0xc1')][_0x540e('0x1e')],'agent':_0x7af3a4['Owner']?_0x7af3a4[_0x540e('0xc2')][_0x540e('0x22')]:_0x540e('0xc5'),'createdAt':moment(_0x7af3a4[_0x540e('0xbc')])[_0x540e('0xaa')](_0x540e('0xc6'))[_0x540e('0x89')](),'closedAt':_0x7af3a4['closed']?moment(_0x7af3a4[_0x540e('0xc7')])['format'](_0x540e('0xc6'))[_0x540e('0x89')]():'','disposition':_0x7af3a4['disposition'],'visibility':_0x7af3a4[_0x540e('0xc8')]?_0x540e('0xc9'):_0x540e('0xca'),'messages':_(_0x7af3a4[_0x540e('0xbb')])[_0x540e('0x72')]({'secret':![]})['map'](function(_0x1fbe25){if(_0x1fbe25['Attachment']){var _0x41b060=path[_0x540e('0xb1')](_0x1f3510,_0x1fbe25[_0x540e('0xba')][_0x540e('0xcb')]);if(fs[_0x540e('0xcc')](_0x41b060)){fs[_0x540e('0xcd')](_0x41b060)[_0x540e('0xce')](fs['createWriteStream'](path[_0x540e('0xb1')](_0x243d4d,_0x1fbe25['Attachment'][_0x540e('0xcb')])));}}return{'date':moment(_0x1fbe25[_0x540e('0xbc')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1fbe25[_0x540e('0xbd')]===_0x540e('0xcf')?_0x1fbe25[_0x540e('0x64')]?_0x1fbe25[_0x540e('0x64')][_0x540e('0x22')]:_0x540e('0xd0'):_0x1fbe25[_0x540e('0x5a')]['firstName']+(_0x1fbe25[_0x540e('0x5a')][_0x540e('0xb9')]?'\x20'+_0x1fbe25[_0x540e('0x5a')]['lastName']:''),'body':_0x1fbe25['Attachment']?_0x1fbe25[_0x540e('0xba')][_0x540e('0xcb')]:_0x1fbe25[_0x540e('0xa2')],'direction':_0x1fbe25[_0x540e('0xbd')]===_0x540e('0xcf')?'A':'C','secret':_0x1fbe25[_0x540e('0xbe')],'read':_0x1fbe25[_0x540e('0xbf')],'attachment':_0x1fbe25[_0x540e('0xba')]};})[_0x540e('0x57')]()};return ejs[_0x540e('0xd1')](path[_0x540e('0xb1')](config[_0x540e('0xb2')],'server',_0x540e('0xd2'),_0x540e('0xd3')),{'interaction':_0x3e7a7c})['then'](function(_0x32ff0f){var _0x46f4e0=path[_0x540e('0xb1')](_0x243d4d,_0x540e('0xd4')+_0x7af3a4['id']+'-'+_0x241d85+_0x540e('0xd5'));var _0xb1ab21={'path':_0x46f4e0,'channel':'Openchannel','interactionId':_0x7af3a4['id']};return pdf[_0x540e('0xd6')](_0x32ff0f,_0xb1ab21);})['then'](function(){return new Promise(function(_0x514437,_0x10d4b6){zipdir(_0x243d4d,{'saveTo':_0x45f7c6},function(_0x16041c,_0x332400){if(_0x16041c)return _0x10d4b6(_0x16041c);return _0x514437(_0x332400);});})['then'](function(){return new Promise(function(_0x317af8,_0x14afff){rimraf(_0x243d4d,function(_0xa1d8b2){if(_0xa1d8b2)_0x14afff(_0xa1d8b2);return _0x317af8();});});})['then'](function(){return _0x5d1405['download'](_0x45f7c6,_0x52707d,function(_0x1137e2){if(_0x1137e2){logger[_0x540e('0x1c')](_0x540e('0xd7'),_0x1137e2);}else{fs['unlinkSync'](_0x45f7c6);}});});});}else{return _0x5d1405[_0x540e('0xd8')](0xc8);}})[_0x540e('0x27')](handleError(_0x5d1405,null));}; \ No newline at end of file +var _0xd33b=['createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','zip-dir','util','path','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','map','fullname','TagIds','Tags','split','forEach','waiting','answered','unmanaged','UserId','talking','closed','total','index','OpenchannelInteraction','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','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?','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?','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.from\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','push','all','rows','catch','show','params','includeAll','include','options','create','describe','OpenchannelMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','unix','root','files','tmp','server','join','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','basename','out','System','lastName','views','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd33b,0xe1));var _0xbd33=function(_0x989807,_0x2828f2){_0x989807=_0x989807-0x0;var _0x4cd5b4=_0xd33b[_0x989807];return _0x4cd5b4;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xbd33('0x0'));var moment=require('moment');var util=require(_0xbd33('0x1'));var path=require(_0xbd33('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbd33('0x3'));var Redis=require(_0xbd33('0x4'));var qs=require('../../components/parsers/qs');var as=require(_0xbd33('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0xbd33('0x6'))(_0xbd33('0x7'));var config=require(_0xbd33('0x8'));var db=require(_0xbd33('0x9'))['db'];config[_0xbd33('0xa')]=_['defaults'](config[_0xbd33('0xa')],{'host':_0xbd33('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbd33('0xc'))['register'](socket);function respondWithStatusCode(_0x4be22d,_0x3a92fd){_0x3a92fd=_0x3a92fd||0xcc;return function(_0x10065b){if(_0x10065b){return _0x4be22d[_0xbd33('0xd')](_0x3a92fd);}return _0x4be22d[_0xbd33('0xe')](_0x3a92fd)[_0xbd33('0xf')]();};}function respondWithResult(_0x4ff7df,_0x5b2a0f){_0x5b2a0f=_0x5b2a0f||0xc8;return function(_0x46c45f){if(_0x46c45f){return _0x4ff7df[_0xbd33('0xe')](_0x5b2a0f)[_0xbd33('0x10')](_0x46c45f);}};}function respondWithFilteredResult(_0x32e9a9,_0x5a5482){return function(_0x1b0b80){if(_0x1b0b80){var _0x247c57=typeof _0x5a5482[_0xbd33('0x11')]==='undefined'&&typeof _0x5a5482[_0xbd33('0x12')]===_0xbd33('0x13');var _0x1b7857=_0x1b0b80[_0xbd33('0x14')];var _0x412cfd=_0x247c57?0x0:_0x5a5482[_0xbd33('0x11')];var _0x1685b7=_0x247c57?_0x1b0b80['count']:_0x5a5482[_0xbd33('0x11')]+_0x5a5482['limit'];var _0x579865;if(_0x1685b7>=_0x1b7857){_0x1685b7=_0x1b7857;_0x579865=0xc8;}else{_0x579865=0xce;}_0x32e9a9[_0xbd33('0xe')](_0x579865);return _0x32e9a9[_0xbd33('0x15')](_0xbd33('0x16'),_0x412cfd+'-'+_0x1685b7+'/'+_0x1b7857)[_0xbd33('0x10')](_0x1b0b80);}return null;};}function saveUpdates(_0x51ffdd){return function(_0x1cbf70){if(_0x1cbf70){return _0x1cbf70[_0xbd33('0x17')](_0x51ffdd)[_0xbd33('0x18')](function(_0x423fdc){return _0x423fdc;});}return null;};}function removeEntity(_0x13583c){return function(_0x438ba0){if(_0x438ba0){return _0x438ba0[_0xbd33('0x19')]()['then'](function(){_0x13583c['status'](0xcc)[_0xbd33('0xf')]();});}};}function handleEntityNotFound(_0xc58245){return function(_0x47dd83){if(!_0x47dd83){_0xc58245[_0xbd33('0xd')](0x194);}return _0x47dd83;};}function handleError(_0x244096,_0x4068be){_0x4068be=_0x4068be||0x1f4;return function(_0x1b02a1){logger[_0xbd33('0x1a')](_0x1b02a1[_0xbd33('0x1b')]);if(_0x1b02a1[_0xbd33('0x1c')]){delete _0x1b02a1['name'];}_0x244096[_0xbd33('0xe')](_0x4068be)['send'](_0x1b02a1);};}function getInteractionUsers(_0x5e88fa,_0x248e5b){return new Promise(function(_0x3070c1,_0xe0eea4){try{if(_0x248e5b[_0x5e88fa['id']]){_0x5e88fa['Users']=_[_0xbd33('0x1d')](_0x248e5b[_0x5e88fa['id']],function(_0x583404){return{'id':_0x583404['id'],'fullname':_0x583404[_0xbd33('0x1e')]};});}}catch(_0x4f6d7b){_0xe0eea4(_0x4f6d7b);}_0x3070c1(_0x5e88fa);});}function getInteractionTags(_0x486d60,_0xc9cfa4){return new Promise(function(_0x39d75d,_0x2850aa){try{if(_0x486d60[_0xbd33('0x1f')]){_0x486d60[_0xbd33('0x20')]=[];_0x486d60[_0xbd33('0x1f')][_0xbd33('0x21')](',')[_0xbd33('0x22')](function(_0x53c76d){_0x486d60['Tags']['push'](_0xc9cfa4[_0x53c76d]);});}delete _0x486d60[_0xbd33('0x1f')];}catch(_0x437ef3){_0x2850aa(_0x437ef3);}_0x39d75d(_0x486d60);});}function updateOpenchannelInteraction(_0x22f9bb,_0x2e501a,_0x470e04){return new Promise(function(_0x108020,_0xd6efa3){return getInteractionUsers(_0x22f9bb,_0x470e04)['then'](function(_0x2783e0){return getInteractionTags(_0x2783e0,_0x2e501a);})[_0xbd33('0x18')](function(_0x180a0b){return getStateInteraction(_0x180a0b);})[_0xbd33('0x18')](function(_0x436d1c){_0x108020(_0x436d1c);})['catch'](function(_0x10932a){_0xd6efa3(_0x10932a);});});}function getStateInteraction(_0x2e9a52){return new Promise(function(_0x3c6461){_0x2e9a52[_0xbd33('0x23')]=0x0;_0x2e9a52['talking']=0x0;_0x2e9a52[_0xbd33('0x24')]=0x0;_0x2e9a52[_0xbd33('0x25')]=0x0;_0x2e9a52['total']=0x0;if(!_0x2e9a52['closed']&&!_0x2e9a52['UserId']){_0x2e9a52[_0xbd33('0x23')]+=0x1;}if(!_0x2e9a52['closed']&&_0x2e9a52[_0xbd33('0x26')]){_0x2e9a52[_0xbd33('0x27')]+=0x1;if(_0x2e9a52[_0xbd33('0x23')]){_0x2e9a52['waiting']-=0x1;}}if(_0x2e9a52['closed']&&_0x2e9a52[_0xbd33('0x26')]){_0x2e9a52['answered']+=0x1;if(_0x2e9a52[_0xbd33('0x27')]){_0x2e9a52[_0xbd33('0x27')]-=0x1;}}if(_0x2e9a52[_0xbd33('0x28')]&&!_0x2e9a52['UserId']){_0x2e9a52[_0xbd33('0x25')]+=0x1;if(_0x2e9a52[_0xbd33('0x23')]){_0x2e9a52[_0xbd33('0x23')]-=0x1;}}_0x2e9a52[_0xbd33('0x29')]+=0x1;_0x3c6461(_0x2e9a52);});}exports[_0xbd33('0x2a')]=function(_0x10206b,_0x4fcb90){var _0x4a10e8={},_0x299569={},_0x328fde={'count':0x0,'rows':[]};var _0x286b14=_[_0xbd33('0x1d')](db[_0xbd33('0x2b')][_0xbd33('0x2c')],function(_0x3b782c){return{'name':_0x3b782c['fieldName'],'type':_0x3b782c[_0xbd33('0x2d')]['key']};});_0x299569[_0xbd33('0x2e')]=_['map'](_0x286b14,'name');_0x299569[_0xbd33('0x2f')]=_[_0xbd33('0x30')](_0x10206b[_0xbd33('0x2f')]);_0x299569['filters']=_[_0xbd33('0x31')](_0x299569[_0xbd33('0x2e')],_0x299569[_0xbd33('0x2f')]);_0x4a10e8[_0xbd33('0x32')]=_[_0xbd33('0x31')](_0x299569[_0xbd33('0x2e')],qs[_0xbd33('0x33')](_0x10206b['query'][_0xbd33('0x33')]));_0x4a10e8[_0xbd33('0x32')]=_0x4a10e8[_0xbd33('0x32')][_0xbd33('0x34')]?_0x4a10e8[_0xbd33('0x32')]:_0x299569[_0xbd33('0x2e')];if(!_0x10206b['query'][_0xbd33('0x35')](_0xbd33('0x36'))){_0x4a10e8[_0xbd33('0x12')]=qs[_0xbd33('0x12')](_0x10206b[_0xbd33('0x2f')]['limit']);_0x4a10e8[_0xbd33('0x11')]=qs['offset'](_0x10206b[_0xbd33('0x2f')][_0xbd33('0x11')]);}_0x4a10e8[_0xbd33('0x37')]=qs['sort'](_0x10206b[_0xbd33('0x2f')][_0xbd33('0x38')]);_0x4a10e8[_0xbd33('0x39')]=qs['filters'](_[_0xbd33('0x3a')](_0x10206b[_0xbd33('0x2f')],_0x299569[_0xbd33('0x3b')]),_0x286b14);var _0x31391f=[];var _0xee51f2=squel[_0xbd33('0x3c')]()[_0xbd33('0x3d')]('id')[_0xbd33('0x3d')](_0xbd33('0x1c'))[_0xbd33('0x3d')](_0xbd33('0x3e'))[_0xbd33('0x3f')](_0xbd33('0x40'));var _0x139a20=squel[_0xbd33('0x3c')]()[_0xbd33('0x3d')](_0xbd33('0x41'))[_0xbd33('0x3d')](_0xbd33('0x42'))[_0xbd33('0x3d')](_0xbd33('0x43'))['from'](_0xbd33('0x44'),'ui')[_0xbd33('0x45')](_0xbd33('0x46'),'u',_0xbd33('0x47'));var _0x519dc9=squel[_0xbd33('0x3c')]()[_0xbd33('0x3f')](_0xbd33('0x48'),'i')[_0xbd33('0x45')](_0xbd33('0x49'),'c',_0xbd33('0x4a'))[_0xbd33('0x45')](_0xbd33('0x46'),'o',_0xbd33('0x4b'))[_0xbd33('0x45')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0xbd33('0x45')]('openchannel_messages','me',_0xbd33('0x4c'))[_0xbd33('0x45')](_0xbd33('0x4d'),'it',_0xbd33('0x4e'))[_0xbd33('0x45')](_0xbd33('0x40'),'t','t.id\x20=\x20it.TagId');var _0x57e341=squel['expr']();var _0x54c960=[];var _0x59ce87=squel[_0xbd33('0x4f')]();var _0x3a4eb2;if(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x50')]){_0x3a4eb2=as[_0xbd33('0x51')](_0x10206b[_0xbd33('0x2f')][_0xbd33('0x50')]);var _0x3d544d=_0x3a4eb2[_0xbd33('0x52')];for(var _0xb45f9c=0x0;_0xb45f9c<_0x3a4eb2['conditions'][_0xbd33('0x34')];_0xb45f9c++){var _0x3fda03=_0x3a4eb2['conditions'][_0xb45f9c];var _0x40b57f='i';var _0x45cc68=_[_0xbd33('0x53')](_0x286b14,['name',_0x3fda03[_0xbd33('0x3d')]]);if(!_0x45cc68){switch(_0x3fda03[_0xbd33('0x3d')]){case _0xbd33('0x54'):if(_0x3fda03[_0xbd33('0x55')]==0x1){_0x519dc9[_0xbd33('0x56')]('`'+_0x3fda03['field']+_0xbd33('0x57'));}else{_0x519dc9[_0xbd33('0x56')]('`'+_0x3fda03[_0xbd33('0x3d')]+_0xbd33('0x58'));}break;case _0xbd33('0x59'):if(_0x3fda03[_0xbd33('0x5a')]===_0xbd33('0x5b')){if(_0x3fda03['value']['split']('\x20')[_0xbd33('0x34')]>0x1){_0x57e341[_0x3d544d](_0xbd33('0x5c'),qs[_0xbd33('0x5d')](_0x3fda03['value']),null);}else{var _0x5a268d='%'+_0x3fda03['value']+'%';_0x57e341[_0x3d544d](_0xbd33('0x5e'),_0x5a268d,_0x5a268d,_0x5a268d);}}else{_0x45cc68=_[_0xbd33('0x53')](_0x286b14,[_0xbd33('0x1c'),'ContactId']);_0x3fda03[_0xbd33('0x3d')]='ContactId';_0x96c892=as[_0xbd33('0x5f')](_0x40b57f,_0x45cc68[_0xbd33('0x2d')],_0x3fda03);_0x57e341[_0x3d544d](_0x96c892[_0xbd33('0x60')],_0x96c892[_0xbd33('0x55')][_0xbd33('0x61')],_0x96c892['value']['end']);}break;case _0xbd33('0x62'):var _0x3e0557=_0x3fda03[_0xbd33('0x55')]['split'](',')['map'](function(_0x7735a8){return Number(_0x7735a8);});_0x3e0557[_0xbd33('0x22')](function(_0xfb8e2e){_0x59ce87['or'](_0xbd33('0x63'),'%,'+_0xfb8e2e+',%');});_0x54c960=_[_0xbd33('0x64')](_0x54c960,_0x3e0557);break;case _0xbd33('0x65'):if(_0x3fda03['operator']==='$substring'){_0x57e341[_0x3d544d](_0xbd33('0x66'),'%'+_0x3fda03[_0xbd33('0x55')]+'%',null);}else{_0x45cc68=_[_0xbd33('0x53')](_0x286b14,['name','UserId']);_0x3fda03['field']=_0xbd33('0x26');_0x96c892=as[_0xbd33('0x5f')](_0x40b57f,_0x45cc68[_0xbd33('0x2d')],_0x3fda03);_0x57e341[_0x3d544d](_0x96c892[_0xbd33('0x60')],_0x96c892[_0xbd33('0x55')]['start'],_0x96c892[_0xbd33('0x55')][_0xbd33('0xf')]);}break;case _0xbd33('0x67'):_0x96c892=as[_0xbd33('0x5f')]('me',null,_0x3fda03);_0x57e341[_0x3d544d](_0x96c892[_0xbd33('0x60')],_0x96c892['value']['start'],_0x96c892[_0xbd33('0x55')]['end']);break;}}else{var _0x96c892=as[_0xbd33('0x5f')](_0x40b57f,_0x45cc68['type'],_0x3fda03);_0x57e341[_0x3d544d](_0x96c892[_0xbd33('0x60')],_0x96c892[_0xbd33('0x55')][_0xbd33('0x61')],_0x96c892[_0xbd33('0x55')][_0xbd33('0xf')]);}}}else{var _0x41e489=_(_0x10206b[_0xbd33('0x2f')])[_0xbd33('0x30')]()[_0xbd33('0x1d')](function(_0x53c652){return _[_0xbd33('0x68')](_0x286b14,[_0xbd33('0x1c'),_0x53c652])?_0x53c652:undefined;})[_0xbd33('0x69')]()['value']();if(!_[_0xbd33('0x6a')](_0x41e489)){_0x41e489[_0xbd33('0x22')](function(_0x144a76){if(_0x144a76==='OpenchannelAccountId'){_0x519dc9[_0xbd33('0x39')](_0xbd33('0x6b'),[][_0xbd33('0x6c')](_0x10206b[_0xbd33('0x2f')][_0x144a76]));}else if(_0x144a76===_0xbd33('0x6d')){var _0x1914d0=JSON[_0xbd33('0x6e')](_0x10206b[_0xbd33('0x2f')][_0x144a76])['$gte'];var _0x303a1f=JSON['parse'](_0x10206b[_0xbd33('0x2f')][_0x144a76])['$lte'];_0x519dc9[_0xbd33('0x39')](_0xbd33('0x6f'),_0x1914d0,_0x303a1f);}else{if(_0x10206b[_0xbd33('0x2f')][_0x144a76]===_0xbd33('0x70')){_0x519dc9[_0xbd33('0x39')]('i.'+_0x144a76+_0xbd33('0x71'));}else{_0x519dc9[_0xbd33('0x39')]('i.'+_0x144a76+'\x20=\x20?',_0x10206b[_0xbd33('0x2f')][_0x144a76]);}}});}if(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x72')]){if(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x72')]==0x1){_0x519dc9['having'](_0xbd33('0x73'));}else{_0x519dc9[_0xbd33('0x56')](_0xbd33('0x74'));}}if(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x75')]){_0x54c960=_[_0xbd33('0x76')](_0x10206b[_0xbd33('0x2f')]['tag'])?_0x10206b[_0xbd33('0x2f')][_0xbd33('0x75')]:new Array(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x75')]);_0x54c960[_0xbd33('0x22')](function(_0x28da95){_0x59ce87['or'](_0xbd33('0x63'),'%,'+_0x28da95+',%');});}if(_0x10206b[_0xbd33('0x2f')][_0xbd33('0x77')]){var _0x409744=_0x10206b[_0xbd33('0x2f')][_0xbd33('0x77')][_0xbd33('0x78')]('\x5c','\x5c\x5c')[_0xbd33('0x78')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x409744)){_0x57e341['or'](_0xbd33('0x79'),_0x409744+'%');}else{_0x57e341['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbd33('0x5d')](_0x409744))['or'](_0xbd33('0x7a'),_0x409744+'%');}_0x57e341['or'](_0xbd33('0x7b'),_0x409744+'%');}}_0x519dc9[_0xbd33('0x39')](_0x57e341);_0x519dc9['group'](_0xbd33('0x7c'));var _0x54ef90={'type':db['Sequelize'][_0xbd33('0x7d')][_0xbd33('0x7e')],'raw':!![]};var _0x3ffc3d=_0x519dc9['clone']();_0x3ffc3d[_0xbd33('0x3d')]('i.id');_0x3ffc3d[_0xbd33('0x3d')](_0xbd33('0x7f'),'unreadMessages');if(_0x4a10e8[_0xbd33('0x37')]){_0x4a10e8[_0xbd33('0x37')]['forEach'](function(_0x29f55e){var _0x4258ec=_0x29f55e[0x0]===_0xbd33('0x80')?_0x29f55e[0x0]:'i.'+_0x29f55e[0x0];_0x519dc9[_0xbd33('0x37')](_0x4258ec,_0x29f55e[0x1]===_0xbd33('0x81')?![]:!![]);});}if(!_[_0xbd33('0x6a')](_0x54c960)){_0x519dc9[_0xbd33('0x56')](_0x59ce87);_0x3ffc3d[_0xbd33('0x39')](_0xbd33('0x82'),_0x54c960);}Promise[_0xbd33('0x83')]()[_0xbd33('0x18')](function(){if(!_0x3a4eb2){if(_0x10206b['query']['OpenchannelAccountId'])return;_0x3ffc3d[_0xbd33('0x39')](_0xbd33('0x84'));_0x519dc9[_0xbd33('0x39')](_0xbd33('0x84'));return;}if(_0x10206b['user'][_0xbd33('0x85')]!==_0xbd33('0x86'))return;return _0x10206b[_0xbd33('0x87')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xbd33('0x18')](function(_0x43262b){if(_[_0xbd33('0x6a')](_0x43262b)){_0x3ffc3d[_0xbd33('0x39')](_0xbd33('0x88'));_0x519dc9[_0xbd33('0x39')](_0xbd33('0x88'));}else{_0x3ffc3d[_0xbd33('0x39')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x43262b,'id'));_0x519dc9[_0xbd33('0x39')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x43262b,'id'));}});})[_0xbd33('0x18')](function(){if(_0x10206b[_0xbd33('0x87')][_0xbd33('0x85')]==='agent'&&!_0x3a4eb2&&!_0x10206b[_0xbd33('0x2f')]['OpenchannelAccountId'])return[];return db[_0xbd33('0x89')]['query'](_0x3ffc3d[_0xbd33('0x8a')](),_0x54ef90);})[_0xbd33('0x18')](function(_0x7c106a){_0x328fde[_0xbd33('0x14')]=_0x7c106a[_0xbd33('0x34')];if(_0x328fde[_0xbd33('0x14')]===0x0)return[];return db[_0xbd33('0x89')]['query'](_0xee51f2[_0xbd33('0x8a')](),_0x54ef90)[_0xbd33('0x18')](function(_0x91054d){_0x31391f=_[_0xbd33('0x8b')](_0x91054d,'id');_0x54ef90=_[_0xbd33('0x8c')](_0x54ef90,{'model':db[_0xbd33('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10206b['query'][_0xbd33('0x33')]){_0x4a10e8[_0xbd33('0x32')][_0xbd33('0x22')](function(_0x483b12){_0x519dc9[_0xbd33('0x3d')]('i.'+_0x483b12);});}else{_0x519dc9['field'](_0xbd33('0x7f'),'unreadMessages');_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x8d'),_0xbd33('0x8e'));_0x519dc9[_0xbd33('0x3d')]('a.mandatoryDisposition',_0xbd33('0x8f'));_0x519dc9['field'](_0xbd33('0x90'),_0xbd33('0x80'));_0x519dc9['field'](_0xbd33('0x91'));_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x92'),_0xbd33('0x93'));_0x519dc9['field']('c.lastName',_0xbd33('0x94'));_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x95'),_0xbd33('0x96'));_0x519dc9[_0xbd33('0x3d')]('c.phone',_0xbd33('0x97'));_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x98'),_0xbd33('0x99'));_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x9a'),_0xbd33('0x9b'));_0x519dc9['field'](_0xbd33('0x9c'),_0xbd33('0x9d'));_0x519dc9['field']('o.internal',_0xbd33('0x9e'));_0x519dc9[_0xbd33('0x3d')](_0xbd33('0x9f'),'TagIds');}if(_0x4a10e8['limit'])_0x519dc9[_0xbd33('0x12')](_0x4a10e8[_0xbd33('0x12')]);if(_0x4a10e8[_0xbd33('0x11')])_0x519dc9[_0xbd33('0x11')](_0x4a10e8[_0xbd33('0x11')]);return db['sequelize'][_0xbd33('0x2f')](_0x519dc9[_0xbd33('0x8a')](),_0x54ef90);})[_0xbd33('0x18')](function(_0x3cd566){if(_0x3cd566[_0xbd33('0x34')]>0x0)_0x139a20['where']('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x3cd566,'id'));return db[_0xbd33('0x89')][_0xbd33('0x2f')](_0x139a20[_0xbd33('0x8a')](),_0x54ef90)[_0xbd33('0x18')](function(_0x5e7232){var _0x5de0e8=_[_0xbd33('0xa0')](_0x5e7232,_0xbd33('0xa1'));var _0x2548f4=[];_0x3cd566[_0xbd33('0x22')](function(_0x173be6){_0x2548f4[_0xbd33('0xa2')](updateOpenchannelInteraction(_0x173be6,_0x31391f,_0x5de0e8));});return Promise[_0xbd33('0xa3')](_0x2548f4);});});})['then'](function(_0x9fe409){_0x328fde[_0xbd33('0xa4')]=_0x9fe409;return _0x328fde;})[_0xbd33('0x18')](respondWithFilteredResult(_0x4fcb90,_0x4a10e8))[_0xbd33('0xa5')](handleError(_0x4fcb90,null));};exports[_0xbd33('0xa6')]=function(_0x110222,_0x2ea056){var _0x18a318={};if(_0x110222[_0xbd33('0x2f')][_0xbd33('0x2d')]&&_0x110222[_0xbd33('0x2f')][_0xbd33('0x2d')]===_0xbd33('0x3f')){_0x18a318['from']=_0x110222[_0xbd33('0xa7')]['id'];}else{_0x18a318['id']=_0x110222[_0xbd33('0xa7')]['id'];}var _0x3272cd={'raw':![],'where':_0x18a318},_0x543eab={};_0x543eab[_0xbd33('0x2e')]=_[_0xbd33('0x30')](db[_0xbd33('0x2b')][_0xbd33('0x2c')]);_0x543eab[_0xbd33('0x2f')]=_[_0xbd33('0x30')](_0x110222[_0xbd33('0x2f')]);_0x543eab[_0xbd33('0x3b')]=_[_0xbd33('0x31')](_0x543eab['model'],_0x543eab[_0xbd33('0x2f')]);_0x3272cd[_0xbd33('0x32')]=_[_0xbd33('0x31')](_0x543eab[_0xbd33('0x2e')],qs[_0xbd33('0x33')](_0x110222[_0xbd33('0x2f')][_0xbd33('0x33')]));_0x3272cd[_0xbd33('0x32')]=_0x3272cd[_0xbd33('0x32')][_0xbd33('0x34')]?_0x3272cd[_0xbd33('0x32')]:_0x543eab[_0xbd33('0x2e')];if(_0x110222[_0xbd33('0x2f')][_0xbd33('0xa8')]){_0x3272cd[_0xbd33('0xa9')]=[{'all':!![]}];}_0x3272cd=_[_0xbd33('0x8c')]({},_0x3272cd,_0x110222[_0xbd33('0xaa')]);return db['OpenchannelInteraction'][_0xbd33('0x53')](_0x3272cd)['then'](handleEntityNotFound(_0x2ea056,null))['then'](respondWithResult(_0x2ea056,null))[_0xbd33('0xa5')](handleError(_0x2ea056,null));};exports[_0xbd33('0xab')]=function(_0x470e38,_0x2afde0){return db[_0xbd33('0x2b')]['create'](_0x470e38[_0xbd33('0x67')],{})[_0xbd33('0x18')](respondWithResult(_0x2afde0,0xc9))[_0xbd33('0xa5')](handleError(_0x2afde0,null));};exports[_0xbd33('0x17')]=function(_0x103582,_0x5db1fc){if(_0x103582[_0xbd33('0x67')]['id']){delete _0x103582[_0xbd33('0x67')]['id'];}return db[_0xbd33('0x2b')][_0xbd33('0x53')]({'where':{'id':_0x103582[_0xbd33('0xa7')]['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x5db1fc,null))[_0xbd33('0x18')](saveUpdates(_0x103582[_0xbd33('0x67')],null))[_0xbd33('0x18')](respondWithResult(_0x5db1fc,null))[_0xbd33('0xa5')](handleError(_0x5db1fc,null));};exports['destroy']=function(_0xaf90a0,_0x4cece9){return db['OpenchannelInteraction']['find']({'where':{'id':_0xaf90a0[_0xbd33('0xa7')]['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x4cece9,null))[_0xbd33('0x18')](removeEntity(_0x4cece9,null))[_0xbd33('0xa5')](handleError(_0x4cece9,null));};exports['describe']=function(_0x34b8ce,_0x3742a7){return db[_0xbd33('0x2b')][_0xbd33('0xac')]()[_0xbd33('0x18')](respondWithResult(_0x3742a7,null))[_0xbd33('0xa5')](handleError(_0x3742a7,null));};exports['addMessage']=function(_0x360ad8,_0x2ccd5c){return db[_0xbd33('0xad')]['find']({'where':{'id':_0x360ad8[_0xbd33('0xa7')]['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x2ccd5c,null))['then'](function(_0x7b43c6){if(_0x7b43c6){return _0x7b43c6['addMessage'](_0x360ad8[_0xbd33('0x67')][_0xbd33('0xae')],_['omit'](_0x360ad8[_0xbd33('0x67')],[_0xbd33('0xae'),'id'])||{});}})[_0xbd33('0x18')](respondWithResult(_0x2ccd5c,null))[_0xbd33('0xa5')](handleError(_0x2ccd5c,null));};exports[_0xbd33('0xaf')]=function(_0x291fef,_0x4443ac){var _0x387726={'raw':![],'where':{}};var _0x4d361d={};var _0x1aa3d5={'count':0x0,'rows':[]};return db[_0xbd33('0x2b')][_0xbd33('0xb0')]({'where':{'id':_0x291fef['params']['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x4443ac,null))[_0xbd33('0x18')](function(_0x4c3b97){if(_0x4c3b97){_0x4d361d[_0xbd33('0x2e')]=_['keys'](db['OpenchannelMessage'][_0xbd33('0x2c')]);_0x4d361d[_0xbd33('0x2f')]=_['keys'](_0x291fef[_0xbd33('0x2f')]);_0x4d361d[_0xbd33('0x3b')]=_[_0xbd33('0x31')](_0x4d361d['model'],_0x4d361d[_0xbd33('0x2f')]);_0x387726[_0xbd33('0x32')]=_['intersection'](_0x4d361d[_0xbd33('0x2e')],qs['fields'](_0x291fef['query'][_0xbd33('0x33')]));_0x387726[_0xbd33('0x32')]=_0x387726[_0xbd33('0x32')][_0xbd33('0x34')]?_0x387726[_0xbd33('0x32')]:_0x4d361d[_0xbd33('0x2e')];if(!_0x291fef['query'][_0xbd33('0x35')](_0xbd33('0x36'))){_0x387726[_0xbd33('0x12')]=qs[_0xbd33('0x12')](_0x291fef[_0xbd33('0x2f')]['limit']);_0x387726['offset']=qs[_0xbd33('0x11')](_0x291fef[_0xbd33('0x2f')][_0xbd33('0x11')]);}_0x387726['order']=qs['sort'](_0x291fef[_0xbd33('0x2f')][_0xbd33('0x38')]);_0x387726[_0xbd33('0x39')]=qs[_0xbd33('0x3b')](_['pick'](_0x291fef[_0xbd33('0x2f')],_0x4d361d[_0xbd33('0x3b')]));_0x387726[_0xbd33('0x39')]['OpenchannelInteractionId']=_0x4c3b97['id'];if(_0x291fef[_0xbd33('0x2f')][_0xbd33('0x77')]){_0x387726[_0xbd33('0x39')]=_['merge'](_0x387726[_0xbd33('0x39')],{'$or':_[_0xbd33('0x1d')](_0x387726[_0xbd33('0x32')],function(_0x5a9eec){var _0x4bd536={};_0x4bd536[_0x5a9eec]={'$like':'%'+_0x291fef[_0xbd33('0x2f')][_0xbd33('0x77')]+'%'};return _0x4bd536;})});}if(_0x291fef[_0xbd33('0x2f')][_0xbd33('0xb1')]){var _0x3a7ab3=_0x291fef[_0xbd33('0x2f')]['$gte']['split'](',');var _0x3a5ce3={};_0x3a5ce3[_0x3a7ab3[0x0]]={'$gte':moment(_0x3a7ab3[0x1])[_0xbd33('0xb2')](_0xbd33('0xb3'))};_0x387726[_0xbd33('0x39')]=_[_0xbd33('0x8c')](_0x387726[_0xbd33('0x39')],_0x3a5ce3);}_0x387726=_[_0xbd33('0x8c')]({},_0x387726,_0x291fef[_0xbd33('0xaa')]);return db[_0xbd33('0xad')][_0xbd33('0x14')]({'where':_0x387726[_0xbd33('0x39')]})[_0xbd33('0x18')](function(_0x90ce4b){_0x1aa3d5[_0xbd33('0x14')]=_0x90ce4b;if(_0x291fef[_0xbd33('0x2f')][_0xbd33('0xa8')]){_0x387726['include']=[{'all':!![]}];}return db[_0xbd33('0xad')][_0xbd33('0xb4')](_0x387726);})[_0xbd33('0x18')](function(_0x2ff18d){_0x1aa3d5['rows']=_0x2ff18d;return _0x1aa3d5;});}})[_0xbd33('0x18')](respondWithFilteredResult(_0x4443ac,_0x387726))['catch'](handleError(_0x4443ac,null));};exports[_0xbd33('0xb5')]=function(_0x48dc7d,_0x3350ab){return db[_0xbd33('0x2b')][_0xbd33('0x53')]({'where':{'id':_0x48dc7d[_0xbd33('0xa7')]['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x3350ab,null))[_0xbd33('0x18')](function(_0x18a142){if(_0x18a142){return _0x18a142['setTags'](_0x48dc7d[_0xbd33('0x67')][_0xbd33('0xae')],_[_0xbd33('0xb6')](_0x48dc7d[_0xbd33('0x67')],[_0xbd33('0xae'),'id'])||{})[_0xbd33('0xb7')](function(){return db['Tag'][_0xbd33('0xb4')]({'attributes':['id',_0xbd33('0x1c'),_0xbd33('0x3e')],'where':{'id':_0x48dc7d[_0xbd33('0x67')][_0xbd33('0xae')]}});})[_0xbd33('0x18')](function(_0x296659){socket[_0xbd33('0xb8')](_0xbd33('0xb9'),{'id':Number(_0x48dc7d['params']['id']),'tags':_0x296659||[]});return{'id':Number(_0x48dc7d['params']['id']),'tags':_0x296659||[]};});}})[_0xbd33('0x18')](respondWithResult(_0x3350ab,null))['catch'](handleError(_0x3350ab,null));};exports[_0xbd33('0xba')]=function(_0xf57ea,_0x45cce8){return db[_0xbd33('0x2b')]['find']({'where':{'id':_0xf57ea[_0xbd33('0xa7')]['id']}})[_0xbd33('0x18')](handleEntityNotFound(_0x45cce8,null))[_0xbd33('0x18')](function(_0x58d3b3){if(_0x58d3b3){return _0x58d3b3[_0xbd33('0xba')](_0xf57ea[_0xbd33('0x2f')][_0xbd33('0xae')]);}})[_0xbd33('0x18')](respondWithStatusCode(_0x45cce8,null))[_0xbd33('0xa5')](handleError(_0x45cce8,null));};exports['download']=function(_0x577a1c,_0x7aa902){var _0xfcea8e=moment()[_0xbd33('0xbb')]()['toString']();var _0x60ba17=path['join'](config[_0xbd33('0xbc')],'server',_0xbd33('0xbd'),_0xbd33('0xbe'));var _0x44fa73=path['join'](config[_0xbd33('0xbc')],_0xbd33('0xbf'),'files','attachments');var _0x2975f7=path[_0xbd33('0xc0')](_0x60ba17,_0xfcea8e);var _0x39cbed=util['format']('transcript-%d-%s.zip',_0x577a1c[_0xbd33('0xa7')]['id'],_0xfcea8e);var _0x5a2fbe=path[_0xbd33('0xc0')](_0x60ba17,_0x39cbed);var _0x244063=[];_0x244063[_0xbd33('0xa2')]({'model':db[_0xbd33('0x65')],'as':_0xbd33('0x65'),'attributes':['id',_0xbd33('0x1e')],'raw':!![]});_0x244063[_0xbd33('0xa2')]({'model':db['CmContact'],'as':_0xbd33('0x59'),'attributes':['id',_0xbd33('0xc1'),'lastName'],'raw':!![]});if(_0x577a1c[_0xbd33('0x2f')]['attachments']){_0x244063[_0xbd33('0xa2')]({'model':db[_0xbd33('0xc2')],'as':'Attachment','raw':!![]});}var _0x275a07=[{'model':db['OpenchannelMessage'],'as':_0xbd33('0xc3'),'attributes':['id',_0xbd33('0x67'),_0xbd33('0x6d'),_0xbd33('0xc4'),_0xbd33('0xc5'),_0xbd33('0x72')],'include':_0x244063}];_0x275a07[_0xbd33('0xa2')]({'model':db[_0xbd33('0xc6')],'as':_0xbd33('0xc7'),'attributes':['id',_0xbd33('0x1c')]});_0x275a07[_0xbd33('0xa2')]({'model':db[_0xbd33('0x65')],'as':_0xbd33('0xc8'),'attributes':['id',_0xbd33('0x1e')]});return db[_0xbd33('0x2b')][_0xbd33('0x53')]({'where':{'id':_0x577a1c[_0xbd33('0xa7')]['id']},'include':_0x275a07})[_0xbd33('0x18')](handleEntityNotFound(_0x7aa902,null))[_0xbd33('0x18')](function(_0x2e55cc){if(_0x2e55cc){var _0x368565=_0x2e55cc[_0xbd33('0xc9')]({'plain':!![]});fs[_0xbd33('0xca')](_0x2975f7);var _0x43a75d={'channel':_0xbd33('0xcb'),'account':_0x368565[_0xbd33('0xc7')][_0xbd33('0x1c')],'agent':_0x368565[_0xbd33('0xc8')]?_0x368565[_0xbd33('0xc8')][_0xbd33('0x1e')]:_0xbd33('0xcc'),'createdAt':moment(_0x368565[_0xbd33('0x6d')])[_0xbd33('0xb2')](_0xbd33('0xb3'))['toString'](),'closedAt':_0x368565[_0xbd33('0x28')]?moment(_0x368565[_0xbd33('0xcd')])['format'](_0xbd33('0xb3'))['toString']():'','disposition':_0x368565[_0xbd33('0xce')],'visibility':_0x368565[_0xbd33('0xcf')]?_0xbd33('0xd0'):_0xbd33('0xd1'),'messages':_(_0x368565[_0xbd33('0xc3')])[_0xbd33('0x77')]({'secret':![]})['map'](function(_0xea542){if(_0xea542[_0xbd33('0xc2')]){var _0x18c86f=path[_0xbd33('0xc0')](_0x44fa73,_0xea542[_0xbd33('0xc2')]['basename']);if(fs[_0xbd33('0xd2')](_0x18c86f)){fs[_0xbd33('0xd3')](_0x18c86f)[_0xbd33('0xd4')](fs['createWriteStream'](path[_0xbd33('0xc0')](_0x2975f7,_0xea542[_0xbd33('0xc2')][_0xbd33('0xd5')])));}}return{'date':moment(_0xea542['createdAt'])[_0xbd33('0xb2')](_0xbd33('0xb3'))[_0xbd33('0x8a')](),'sender':_0xea542['direction']===_0xbd33('0xd6')?_0xea542[_0xbd33('0x65')]?_0xea542[_0xbd33('0x65')]['fullname']:_0xbd33('0xd7'):_0xea542[_0xbd33('0x59')][_0xbd33('0xc1')]+(_0xea542['Contact'][_0xbd33('0xd8')]?'\x20'+_0xea542['Contact'][_0xbd33('0xd8')]:''),'body':_0xea542['Attachment']?_0xea542[_0xbd33('0xc2')][_0xbd33('0xd5')]:_0xea542['body'],'direction':_0xea542[_0xbd33('0xc4')]==='out'?'A':'C','secret':_0xea542[_0xbd33('0xc5')],'read':_0xea542[_0xbd33('0x72')],'attachment':_0xea542[_0xbd33('0xc2')]};})[_0xbd33('0x55')]()};return ejs['renderFile'](path[_0xbd33('0xc0')](config[_0xbd33('0xbc')],_0xbd33('0xbf'),_0xbd33('0xd9'),_0xbd33('0xda')),{'interaction':_0x43a75d})[_0xbd33('0x18')](function(_0x56f95e){var _0x2c132a=path[_0xbd33('0xc0')](_0x2975f7,_0xbd33('0xdb')+_0x368565['id']+'-'+_0xfcea8e+_0xbd33('0xdc'));var _0x1559d5={'path':_0x2c132a,'channel':_0xbd33('0xcb'),'interactionId':_0x368565['id']};return pdf[_0xbd33('0xdd')](_0x56f95e,_0x1559d5);})[_0xbd33('0x18')](function(){return new Promise(function(_0x53aa39,_0x5abbc0){zipdir(_0x2975f7,{'saveTo':_0x5a2fbe},function(_0x4165cd,_0x4932cd){if(_0x4165cd)return _0x5abbc0(_0x4165cd);return _0x53aa39(_0x4932cd);});})['then'](function(){return new Promise(function(_0xbe8e16,_0x3089ce){rimraf(_0x2975f7,function(_0x29d1f8){if(_0x29d1f8)_0x3089ce(_0x29d1f8);return _0xbe8e16();});});})[_0xbd33('0x18')](function(){return _0x7aa902['download'](_0x5a2fbe,_0x39cbed,function(_0x2ce776){if(_0x2ce776){logger[_0xbd33('0x1a')](_0xbd33('0xde'),_0x2ce776);}else{fs['unlinkSync'](_0x5a2fbe);}});});});}else{return _0x7aa902[_0xbd33('0xd')](0xc8);}})[_0xbd33('0xa5')](handleError(_0x7aa902,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 45baa47..7017222 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 _0xecc7=['Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x90f2a1,_0x9d5e97){var _0x17b7dc=function(_0x312d28){while(--_0x312d28){_0x90f2a1['push'](_0x90f2a1['shift']());}};_0x17b7dc(++_0x9d5e97);}(_0xecc7,0x14d));var _0x7ecc=function(_0x52920b,_0xeb05b2){_0x52920b=_0x52920b-0x0;var _0x152dd0=_0xecc7[_0x52920b];return _0x152dd0;};'use strict';var EventEmitter=require(_0x7ecc('0x0'));var OpenchannelInteraction=require(_0x7ecc('0x1'))['db'][_0x7ecc('0x2')];var OpenchannelMessage=require(_0x7ecc('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7ecc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ecc('0x4'),'afterDestroy':_0x7ecc('0x5')};function emitEvent(_0x2b4859){return function(_0x86cfe,_0x3ad299,_0x393842){_0x86cfe[_0x7ecc('0x6')]({'attributes':['id'],'raw':!![]})[_0x7ecc('0x7')](function(_0x601212){_0x86cfe[_0x7ecc('0x8')](_0x7ecc('0x9'),_0x601212[_0x7ecc('0xa')](function(_0x213d9a){return{'id':_0x213d9a['id']};}));return OpenchannelMessage[_0x7ecc('0xb')]({'where':{'OpenchannelInteractionId':_0x86cfe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7ecc('0x7')](function(_0x48c829){_0x86cfe[_0x7ecc('0x8')](_0x7ecc('0xc'),_0x48c829[_0x7ecc('0xd')]);OpenchannelInteractionEvents['emit'](_0x2b4859+':'+_0x86cfe['id'],_0x86cfe);OpenchannelInteractionEvents[_0x7ecc('0xe')](_0x2b4859,_0x86cfe);_0x393842(null);})[_0x7ecc('0xf')](_0x393842(null));};}for(var e in events){if(events[_0x7ecc('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x7ecc('0x11')](e,emitEvent(event));}}module[_0x7ecc('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x891a=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','update','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x5c99e9,_0x1acc47){var _0x35f2e2=function(_0x2cb1b7){while(--_0x2cb1b7){_0x5c99e9['push'](_0x5c99e9['shift']());}};_0x35f2e2(++_0x1acc47);}(_0x891a,0xf5));var _0xa891=function(_0x3744ef,_0x34b3cf){_0x3744ef=_0x3744ef-0x0;var _0x4536e5=_0x891a[_0x3744ef];return _0x4536e5;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xa891('0x0')];var OpenchannelMessage=require(_0xa891('0x1'))['db'][_0xa891('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa891('0x3'),'afterDestroy':_0xa891('0x4')};function emitEvent(_0x3f739b){return function(_0x1b6802,_0x1184f2,_0x10adc9){_0x1b6802[_0xa891('0x5')]({'attributes':['id'],'raw':!![]})[_0xa891('0x6')](function(_0x8125af){_0x1b6802[_0xa891('0x7')]('Users',_0x8125af[_0xa891('0x8')](function(_0x21608a){return{'id':_0x21608a['id']};}));return OpenchannelMessage[_0xa891('0x9')]({'where':{'OpenchannelInteractionId':_0x1b6802['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa891('0x6')](function(_0x1ad8df){_0x1b6802['setDataValue'](_0xa891('0xa'),_0x1ad8df[_0xa891('0xb')]);OpenchannelInteractionEvents[_0xa891('0xc')](_0x3f739b+':'+_0x1b6802['id'],_0x1b6802);OpenchannelInteractionEvents[_0xa891('0xc')](_0x3f739b,_0x1b6802);_0x10adc9(null);})[_0xa891('0xd')](_0x10adc9(null));};}for(var e in events){if(events[_0xa891('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xa891('0xf')](e,emitEvent(event));}}module[_0xa891('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 47420a7..3758701 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 _0x46fa=['OpenchannelInteraction','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x46fa,0x76));var _0xa46f=function(_0x4da0b8,_0x36dde0){_0x4da0b8=_0x4da0b8-0x0;var _0x5ad961=_0x46fa[_0x4da0b8];return _0x5ad961;};'use strict';var _=require(_0xa46f('0x0'));var util=require('util');var logger=require(_0xa46f('0x1'))(_0xa46f('0x2'));var moment=require(_0xa46f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa46f('0x4'));var fs=require('fs');var path=require(_0xa46f('0x5'));var rimraf=require(_0xa46f('0x6'));var config=require(_0xa46f('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xa46f('0x8')]=function(_0x50cff6,_0x5ea799){return _0x50cff6[_0xa46f('0x9')](_0xa46f('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa46f('0xb'),'hooks':{'beforeUpdate':function(_0x1dfd5a,_0x52543a,_0x47969e){if(_0x1dfd5a[_0xa46f('0xc')](_0xa46f('0xd'))){_0x1dfd5a['closedAt']=moment()[_0xa46f('0xe')](_0xa46f('0xf'));}_0x47969e(null,_0x1dfd5a);}}});}; \ No newline at end of file +var _0x71c4=['openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelInteraction'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x71c4,0xa0));var _0x471c=function(_0x130eee,_0x1d0160){_0x130eee=_0x130eee-0x0;var _0x196f4c=_0x71c4[_0x130eee];return _0x196f4c;};'use strict';var _=require(_0x471c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x471c('0x1'));var moment=require(_0x471c('0x2'));var BPromise=require(_0x471c('0x3'));var rp=require(_0x471c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471c('0x5'));var config=require(_0x471c('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x471c('0x7')]=function(_0x46a5b3,_0x1df63d){return _0x46a5b3[_0x471c('0x8')](_0x471c('0x9'),attributes,{'tableName':_0x471c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x471c('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x305bfe,_0x3414b9,_0x212edd){if(_0x305bfe[_0x471c('0xc')](_0x471c('0xd'))){_0x305bfe[_0x471c('0xe')]=moment()[_0x471c('0xf')](_0x471c('0x10'));}_0x212edd(null,_0x305bfe);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 810ec49..d5fee7a 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 _0x15f8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','raw','options','limit','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash'];(function(_0x5f2f36,_0x1fd69a){var _0x292875=function(_0x5641ff){while(--_0x5641ff){_0x5f2f36['push'](_0x5f2f36['shift']());}};_0x292875(++_0x1fd69a);}(_0x15f8,0x86));var _0x815f=function(_0x2f2844,_0x7067b9){_0x2f2844=_0x2f2844-0x0;var _0x23ccfb=_0x15f8[_0x2f2844];return _0x23ccfb;};'use strict';var _=require(_0x815f('0x0'));var util=require('util');var moment=require(_0x815f('0x1'));var BPromise=require(_0x815f('0x2'));var rs=require(_0x815f('0x3'));var fs=require('fs');var Redis=require(_0x815f('0x4'));var db=require(_0x815f('0x5'))['db'];var utils=require(_0x815f('0x6'));var logger=require(_0x815f('0x7'))(_0x815f('0x8'));var config=require(_0x815f('0x9'));var jayson=require(_0x815f('0xa'));var client=jayson[_0x815f('0xb')][_0x815f('0xc')]({'port':0x232a});config[_0x815f('0xd')]=_[_0x815f('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x815f('0xf'))(new Redis(config[_0x815f('0xd')]));require(_0x815f('0x10'))['register'](socket);function respondWithRpcPromise(_0x150054,_0x4a5488,_0x11f7bb){return new BPromise(function(_0x61be6a,_0x4cf252){return client[_0x815f('0x11')](_0x150054,_0x11f7bb)[_0x815f('0x12')](function(_0x3e9efd){logger['info'](_0x815f('0x13'),_0x4a5488,_0x815f('0x14'));logger[_0x815f('0x15')](_0x815f('0x16'),_0x4a5488,'request\x20sent',JSON[_0x815f('0x17')](_0x3e9efd));if(_0x3e9efd[_0x815f('0x18')]){if(_0x3e9efd['error'][_0x815f('0x19')]===0x1f4){logger[_0x815f('0x18')](_0x815f('0x13'),_0x4a5488,_0x3e9efd[_0x815f('0x18')][_0x815f('0x1a')]);return _0x4cf252(_0x3e9efd[_0x815f('0x18')][_0x815f('0x1a')]);}logger[_0x815f('0x18')](_0x815f('0x13'),_0x4a5488,_0x3e9efd[_0x815f('0x18')][_0x815f('0x1a')]);return _0x61be6a(_0x3e9efd[_0x815f('0x18')]['message']);}else{logger[_0x815f('0x1b')](_0x815f('0x13'),_0x4a5488,_0x815f('0x14'));_0x61be6a(_0x3e9efd[_0x815f('0x1c')]['message']);}})[_0x815f('0x1d')](function(_0x44a6f9){logger[_0x815f('0x18')](_0x815f('0x13'),_0x4a5488,_0x44a6f9);_0x4cf252(_0x44a6f9);});});}exports[_0x815f('0x1e')]=function(_0x12c3ad){var _0x1089c8=this;return new Promise(function(_0x31fd63,_0x2fe567){return db[_0x815f('0x1f')][_0x815f('0x20')](_0x12c3ad['body'],{'raw':_0x12c3ad['options']?_0x12c3ad['options'][_0x815f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c3ad['options']?_0x12c3ad['options']['where']||null:null,'attributes':_0x12c3ad[_0x815f('0x22')]?_0x12c3ad[_0x815f('0x22')]['attributes']||null:null,'limit':_0x12c3ad['options']?_0x12c3ad[_0x815f('0x22')][_0x815f('0x23')]||null:null})[_0x815f('0x12')](function(_0x414fa0){logger['info'](_0x815f('0x1e'),_0x12c3ad);logger['debug']('UpdateOpenchannelInteraction',_0x12c3ad,JSON[_0x815f('0x17')](_0x414fa0));_0x31fd63(_0x414fa0);})[_0x815f('0x1d')](function(_0x245828){logger[_0x815f('0x18')]('UpdateOpenchannelInteraction',_0x245828['message'],_0x12c3ad);_0x2fe567(_0x1089c8[_0x815f('0x18')](0x1f4,_0x245828['message']));});});};exports[_0x815f('0x24')]=function(_0x2b4e52){return new Promise(function(_0x385a8f,_0x285381){return db[_0x815f('0x1f')][_0x815f('0x25')]({'where':_0x2b4e52['options']?_0x2b4e52[_0x815f('0x22')][_0x815f('0x26')]||null:null})[_0x815f('0x12')](function(_0x222130){if(_0x222130){return _0x222130[_0x815f('0x27')](_0x2b4e52[_0x815f('0x28')][_0x815f('0x29')],_[_0x815f('0x2a')](_0x2b4e52[_0x815f('0x28')],[_0x815f('0x29'),'id'])||{});}})[_0x815f('0x2b')](function(_0x33f532){logger[_0x815f('0x1b')](_0x815f('0x2c'),_0x2b4e52);logger[_0x815f('0x15')](_0x815f('0x2c'),_0x2b4e52,JSON['stringify'](_0x33f532));_0x385a8f(_0x33f532);})[_0x815f('0x1d')](function(_0x4ce954){logger[_0x815f('0x18')]('AddTags',_0x4ce954[_0x815f('0x1a')],_0x2b4e52);_0x285381(_this[_0x815f('0x18')](0x1f4,_0x4ce954[_0x815f('0x1a')]));});});}; \ No newline at end of file +var _0xc424=['client','http','defaults','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x40dc08,_0x5227fe){var _0x44c657=function(_0x23bd9a){while(--_0x23bd9a){_0x40dc08['push'](_0x40dc08['shift']());}};_0x44c657(++_0x5227fe);}(_0xc424,0xf4));var _0x4c42=function(_0x5739d8,_0x4d5fd0){_0x5739d8=_0x5739d8-0x0;var _0x1d220f=_0xc424[_0x5739d8];return _0x1d220f;};'use strict';var _=require('lodash');var util=require(_0x4c42('0x0'));var moment=require(_0x4c42('0x1'));var BPromise=require(_0x4c42('0x2'));var rs=require(_0x4c42('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c42('0x4'))['db'];var utils=require(_0x4c42('0x5'));var logger=require('../../config/logger')(_0x4c42('0x6'));var config=require(_0x4c42('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4c42('0x8')][_0x4c42('0x9')]({'port':0x232a});config['redis']=_[_0x4c42('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c42('0xb'))(new Redis(config[_0x4c42('0xc')]));require('./openchannelInteraction.socket')[_0x4c42('0xd')](socket);function respondWithRpcPromise(_0x49d06c,_0xb5c24c,_0xfa55f2){return new BPromise(function(_0x1b2a2d,_0x28449b){return client[_0x4c42('0xe')](_0x49d06c,_0xfa55f2)[_0x4c42('0xf')](function(_0x5aa25f){logger[_0x4c42('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb5c24c,_0x4c42('0x11'));logger[_0x4c42('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xb5c24c,_0x4c42('0x11'),JSON[_0x4c42('0x13')](_0x5aa25f));if(_0x5aa25f[_0x4c42('0x14')]){if(_0x5aa25f['error'][_0x4c42('0x15')]===0x1f4){logger[_0x4c42('0x14')](_0x4c42('0x16'),_0xb5c24c,_0x5aa25f[_0x4c42('0x14')]['message']);return _0x28449b(_0x5aa25f[_0x4c42('0x14')]['message']);}logger['error'](_0x4c42('0x16'),_0xb5c24c,_0x5aa25f[_0x4c42('0x14')][_0x4c42('0x17')]);return _0x1b2a2d(_0x5aa25f[_0x4c42('0x14')][_0x4c42('0x17')]);}else{logger[_0x4c42('0x10')](_0x4c42('0x16'),_0xb5c24c,_0x4c42('0x11'));_0x1b2a2d(_0x5aa25f[_0x4c42('0x18')][_0x4c42('0x17')]);}})['catch'](function(_0x87b790){logger[_0x4c42('0x14')](_0x4c42('0x16'),_0xb5c24c,_0x87b790);_0x28449b(_0x87b790);});});}exports[_0x4c42('0x19')]=function(_0x31af6f){var _0x216a4a=this;return new Promise(function(_0x56e15e,_0x10f379){return db[_0x4c42('0x1a')][_0x4c42('0x1b')](_0x31af6f[_0x4c42('0x1c')],{'raw':_0x31af6f[_0x4c42('0x1d')]?_0x31af6f['options'][_0x4c42('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31af6f[_0x4c42('0x1d')]?_0x31af6f['options'][_0x4c42('0x1f')]||null:null,'attributes':_0x31af6f[_0x4c42('0x1d')]?_0x31af6f['options'][_0x4c42('0x20')]||null:null,'limit':_0x31af6f[_0x4c42('0x1d')]?_0x31af6f['options'][_0x4c42('0x21')]||null:null})[_0x4c42('0xf')](function(_0x8509a8){logger[_0x4c42('0x10')](_0x4c42('0x19'),_0x31af6f);logger[_0x4c42('0x12')](_0x4c42('0x19'),_0x31af6f,JSON[_0x4c42('0x13')](_0x8509a8));_0x56e15e(_0x8509a8);})[_0x4c42('0x22')](function(_0x2257e4){logger[_0x4c42('0x14')](_0x4c42('0x19'),_0x2257e4[_0x4c42('0x17')],_0x31af6f);_0x10f379(_0x216a4a[_0x4c42('0x14')](0x1f4,_0x2257e4[_0x4c42('0x17')]));});});};exports[_0x4c42('0x23')]=function(_0x1f97c3){return new Promise(function(_0x518ea1,_0x10801a){return db[_0x4c42('0x1a')][_0x4c42('0x24')]({'where':_0x1f97c3[_0x4c42('0x1d')]?_0x1f97c3[_0x4c42('0x1d')]['where']||null:null})['then'](function(_0x26da3d){if(_0x26da3d){return _0x26da3d[_0x4c42('0x25')](_0x1f97c3[_0x4c42('0x1c')][_0x4c42('0x26')],_[_0x4c42('0x27')](_0x1f97c3[_0x4c42('0x1c')],[_0x4c42('0x26'),'id'])||{});}})[_0x4c42('0x28')](function(_0x1902c5){logger[_0x4c42('0x10')](_0x4c42('0x29'),_0x1f97c3);logger[_0x4c42('0x12')](_0x4c42('0x29'),_0x1f97c3,JSON[_0x4c42('0x13')](_0x1902c5));_0x518ea1(_0x1902c5);})[_0x4c42('0x22')](function(_0x10c8d7){logger['error'](_0x4c42('0x29'),_0x10c8d7[_0x4c42('0x17')],_0x1f97c3);_0x10801a(_this['error'](0x1f4,_0x10c8d7[_0x4c42('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9f0d8f5..327c4d5 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 _0xcbb3=['update','emit','removeListener','./openchannelInteraction.events','save'];(function(_0x1ee752,_0x2bc2ac){var _0x8b45bf=function(_0x69edc5){while(--_0x69edc5){_0x1ee752['push'](_0x1ee752['shift']());}};_0x8b45bf(++_0x2bc2ac);}(_0xcbb3,0x12a));var _0x3cbb=function(_0x31b30c,_0x2ed857){_0x31b30c=_0x31b30c-0x0;var _0x1c75bc=_0xcbb3[_0x31b30c];return _0x1c75bc;};'use strict';var OpenchannelInteractionEvents=require(_0x3cbb('0x0'));var events=[_0x3cbb('0x1'),'remove',_0x3cbb('0x2')];function createListener(_0x2d6538,_0x4a131e){return function(_0x5aab2e){_0x4a131e[_0x3cbb('0x3')](_0x2d6538,_0x5aab2e);};}function removeListener(_0x54d61d,_0x1a8453){return function(){OpenchannelInteractionEvents[_0x3cbb('0x4')](_0x54d61d,_0x1a8453);};}exports['register']=function(_0x156c8a){for(var _0x4faeec=0x0,_0x5f3883=events['length'];_0x4faeec<_0x5f3883;_0x4faeec++){var _0x231469=events[_0x4faeec];var _0x291bab=createListener('openchannelInteraction:'+_0x231469,_0x156c8a);OpenchannelInteractionEvents['on'](_0x231469,_0x291bab);}}; \ No newline at end of file +var _0x184f=['./openchannelInteraction.events','save','removeListener','register','length'];(function(_0x566216,_0x3c6aed){var _0x1bcf97=function(_0x11a5da){while(--_0x11a5da){_0x566216['push'](_0x566216['shift']());}};_0x1bcf97(++_0x3c6aed);}(_0x184f,0x82));var _0xf184=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x184f[_0x46d0c9];return _0x174506;};'use strict';var OpenchannelInteractionEvents=require(_0xf184('0x0'));var events=[_0xf184('0x1'),'remove','update'];function createListener(_0x1f756c,_0x4fec6a){return function(_0x3c08b0){_0x4fec6a['emit'](_0x1f756c,_0x3c08b0);};}function removeListener(_0x258440,_0x99a401){return function(){OpenchannelInteractionEvents[_0xf184('0x2')](_0x258440,_0x99a401);};}exports[_0xf184('0x3')]=function(_0x545d82){for(var _0x43121e=0x0,_0x3ded4b=events[_0xf184('0x4')];_0x43121e<_0x3ded4b;_0x43121e++){var _0x26a63b=events[_0x43121e];var _0x5c6ad4=createListener('openchannelInteraction:'+_0x26a63b,_0x545d82);OpenchannelInteractionEvents['on'](_0x26a63b,_0x5c6ad4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9acb64c..4527b53 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x25ba2b,_0x42f2f0){var _0x9eb6ba=function(_0x328f19){while(--_0x328f19){_0x25ba2b['push'](_0x25ba2b['shift']());}};_0x9eb6ba(++_0x42f2f0);}(_0xe706,0xa3));var _0x6e70=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0xe706[_0x5d0609];return _0xaa3fd1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x2038ae,_0x1cefce){_0x2038ae=_0x2038ae-0x0;var _0x5eb4c1=_0x70e0[_0x2038ae];return _0x5eb4c1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index def952e..d0a7107 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 _0x75dc=['DATE','STRING','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x75dc,0x1d7));var _0xc75d=function(_0x34342a,_0x3e16f5){_0x34342a=_0x34342a-0x0;var _0x427cdf=_0x75dc[_0x34342a];return _0x427cdf;};'use strict';var Sequelize=require(_0xc75d('0x0'));module[_0xc75d('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xc75d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc75d('0x3')]('in',_0xc75d('0x4')),'defaultValue':_0xc75d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc75d('0x5')]},'providerName':{'type':Sequelize[_0xc75d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x566f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x33aa9d,_0x1b9682){var _0x1893b2=function(_0xfb1126){while(--_0xfb1126){_0x33aa9d['push'](_0x33aa9d['shift']());}};_0x1893b2(++_0x1b9682);}(_0x566f,0x124));var _0xf566=function(_0x4fc384,_0x5df76c){_0x4fc384=_0x4fc384-0x0;var _0x5419c8=_0x566f[_0x4fc384];return _0x5419c8;};'use strict';var Sequelize=require(_0xf566('0x0'));module[_0xf566('0x1')]={'body':{'type':Sequelize[_0xf566('0x2')](_0xf566('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf566('0x5')]('in',_0xf566('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf566('0x7')]},'providerName':{'type':Sequelize[_0xf566('0x8')]},'providerResponse':{'type':Sequelize[_0xf566('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2b48ac4..12f6aae 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 _0x39c7=['event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','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','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','map','OpenchannelMessage','fieldName','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','order','pick','filters','filter','where','type','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','sequelize','Sequelize','fullname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39c7,0x85));var _0x739c=function(_0x1e4b2c,_0x1f9c6b){_0x1e4b2c=_0x1e4b2c-0x0;var _0x38e0b0=_0x39c7[_0x1e4b2c];return _0x38e0b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x739c('0x0'));var zipdir=require(_0x739c('0x1'));var jsonpatch=require(_0x739c('0x2'));var rp=require(_0x739c('0x3'));var moment=require(_0x739c('0x4'));var BPromise=require(_0x739c('0x5'));var Mustache=require('mustache');var util=require(_0x739c('0x6'));var path=require(_0x739c('0x7'));var sox=require(_0x739c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739c('0x9'));var _=require(_0x739c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x739c('0xb'));var deskjs=require(_0x739c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x739c('0xd'));var Papa=require(_0x739c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x739c('0xf'));var as=require(_0x739c('0x10'));var hardwareService=require(_0x739c('0x11'));var logger=require(_0x739c('0x12'))(_0x739c('0x13'));var utils=require(_0x739c('0x14'));var config=require(_0x739c('0x15'));var licenseUtil=require(_0x739c('0x16'));var db=require(_0x739c('0x17'))['db'];config[_0x739c('0x18')]=_[_0x739c('0x19')](config[_0x739c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x739c('0x1a'))(new Redis(config[_0x739c('0x18')]));require(_0x739c('0x1b'))[_0x739c('0x1c')](socket);var jayson=require(_0x739c('0x1d'));var client=jayson[_0x739c('0x1e')][_0x739c('0x1f')]({'port':0x232c});var client9002=jayson[_0x739c('0x1e')][_0x739c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1a97c1,_0x4cc36c,_0x50ee8d,_0x362095){return new BPromise(function(_0x23888d,_0x25d486){var _0x56034d=_0x362095||client;return _0x56034d[_0x739c('0x20')](_0x1a97c1,_0x50ee8d)[_0x739c('0x21')](function(_0x27141a){logger[_0x739c('0x22')](_0x739c('0x23'),_0x4cc36c,'request\x20sent');logger[_0x739c('0x24')](_0x739c('0x25'),_0x4cc36c,_0x739c('0x26'),JSON['stringify'](_0x27141a));if(_0x27141a[_0x739c('0x27')]){if(_0x27141a['error']['code']===0x1f4){logger[_0x739c('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x4cc36c,_0x27141a[_0x739c('0x27')][_0x739c('0x28')]);return _0x25d486(_0x27141a['error'][_0x739c('0x28')]);}logger['error'](_0x739c('0x23'),_0x4cc36c,_0x27141a['error'][_0x739c('0x28')]);return _0x23888d(_0x27141a[_0x739c('0x27')][_0x739c('0x28')]);}else{logger[_0x739c('0x22')](_0x739c('0x23'),_0x4cc36c,_0x739c('0x26'));_0x23888d(_0x27141a[_0x739c('0x29')][_0x739c('0x28')]);}})['catch'](function(_0x384bc5){logger[_0x739c('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x4cc36c,_0x384bc5);_0x25d486(_0x384bc5);});});}function respondWithStatusCode(_0x3dad7f,_0x54c667){_0x54c667=_0x54c667||0xcc;return function(_0x4ca46a){if(_0x4ca46a){return _0x3dad7f[_0x739c('0x2a')](_0x54c667);}return _0x3dad7f[_0x739c('0x2b')](_0x54c667)[_0x739c('0x2c')]();};}function respondWithResult(_0x141807,_0x2053a5){_0x2053a5=_0x2053a5||0xc8;return function(_0x4b81ce){if(_0x4b81ce){return _0x141807[_0x739c('0x2b')](_0x2053a5)['json'](_0x4b81ce);}};}function respondWithFilteredResult(_0x28d7a9,_0x3464d8){return function(_0x178b58){if(_0x178b58){var _0x2de5e6=typeof _0x3464d8[_0x739c('0x2d')]===_0x739c('0x2e')&&typeof _0x3464d8[_0x739c('0x2f')]==='undefined';var _0x53789c=_0x178b58['count'];var _0x570c90=_0x2de5e6?0x0:_0x3464d8[_0x739c('0x2d')];var _0x132256=_0x2de5e6?_0x178b58[_0x739c('0x30')]:_0x3464d8[_0x739c('0x2d')]+_0x3464d8[_0x739c('0x2f')];var _0x36264f;if(_0x132256>=_0x53789c){_0x132256=_0x53789c;_0x36264f=0xc8;}else{_0x36264f=0xce;}_0x28d7a9[_0x739c('0x2b')](_0x36264f);return _0x28d7a9[_0x739c('0x31')](_0x739c('0x32'),_0x570c90+'-'+_0x132256+'/'+_0x53789c)[_0x739c('0x33')](_0x178b58);}return null;};}function patchUpdates(_0x198b52){return function(_0xac8767){try{jsonpatch[_0x739c('0x34')](_0xac8767,_0x198b52,!![]);}catch(_0x2d05cf){return BPromise[_0x739c('0x35')](_0x2d05cf);}return _0xac8767[_0x739c('0x36')]();};}function saveUpdates(_0x3130e2,_0x358e9f){return function(_0x1146b2){if(_0x1146b2){return _0x1146b2[_0x739c('0x37')](_0x3130e2)[_0x739c('0x21')](function(_0x267484){return _0x267484;});}return null;};}function removeEntity(_0x1f2f1a,_0xe1b735){return function(_0x46693d){if(_0x46693d){return _0x46693d[_0x739c('0x38')]()[_0x739c('0x21')](function(){_0x1f2f1a[_0x739c('0x2b')](0xcc)[_0x739c('0x2c')]();});}};}function handleEntityNotFound(_0x37df00,_0x1ab70f){return function(_0x75c108){if(!_0x75c108){_0x37df00[_0x739c('0x2a')](0x194);}return _0x75c108;};}function handleError(_0xad3131,_0x2d339e){_0x2d339e=_0x2d339e||0x1f4;return function(_0x59b1d8){logger[_0x739c('0x27')](_0x59b1d8[_0x739c('0x39')]);if(_0x59b1d8['name']){delete _0x59b1d8[_0x739c('0x3a')];}_0xad3131[_0x739c('0x2b')](_0x2d339e)['send'](_0x59b1d8);};}exports['index']=function(_0x46f6a6,_0x30a1fe){var _0x55120d={},_0x36d96b={},_0x46872f={'count':0x0,'rows':[]};var _0x448dd6=_[_0x739c('0x3b')](db[_0x739c('0x3c')]['rawAttributes'],function(_0x475d79){return{'name':_0x475d79[_0x739c('0x3d')],'type':_0x475d79['type']['key']};});_0x36d96b['model']=_[_0x739c('0x3b')](_0x448dd6,_0x739c('0x3a'));_0x36d96b['query']=_[_0x739c('0x3e')](_0x46f6a6['query']);_0x36d96b['filters']=_[_0x739c('0x3f')](_0x36d96b[_0x739c('0x40')],_0x36d96b[_0x739c('0x41')]);_0x55120d[_0x739c('0x42')]=_[_0x739c('0x3f')](_0x36d96b[_0x739c('0x40')],qs[_0x739c('0x43')](_0x46f6a6[_0x739c('0x41')]['fields']));_0x55120d[_0x739c('0x42')]=_0x55120d[_0x739c('0x42')][_0x739c('0x44')]?_0x55120d[_0x739c('0x42')]:_0x36d96b['model'];if(!_0x46f6a6[_0x739c('0x41')][_0x739c('0x45')]('nolimit')){_0x55120d[_0x739c('0x2f')]=qs[_0x739c('0x2f')](_0x46f6a6[_0x739c('0x41')][_0x739c('0x2f')]);_0x55120d['offset']=qs[_0x739c('0x2d')](_0x46f6a6[_0x739c('0x41')][_0x739c('0x2d')]);}_0x55120d[_0x739c('0x46')]=qs['sort'](_0x46f6a6[_0x739c('0x41')]['sort']);_0x55120d['where']=qs['filters'](_[_0x739c('0x47')](_0x46f6a6[_0x739c('0x41')],_0x36d96b[_0x739c('0x48')]),_0x448dd6);if(_0x46f6a6[_0x739c('0x41')][_0x739c('0x49')]){_0x55120d[_0x739c('0x4a')]=_['merge'](_0x55120d['where'],{'$or':_['map'](_0x448dd6,function(_0x4642cc){if(_0x4642cc[_0x739c('0x4b')]!=='VIRTUAL'){var _0x1f0bb9={};_0x1f0bb9[_0x4642cc['name']]={'$like':'%'+_0x46f6a6[_0x739c('0x41')]['filter']+'%'};return _0x1f0bb9;}})});}_0x55120d=_[_0x739c('0x4c')]({},_0x55120d,_0x46f6a6[_0x739c('0x4d')]);var _0x32325b={'where':_0x55120d['where']};return db[_0x739c('0x3c')][_0x739c('0x30')](_0x32325b)['then'](function(_0x3a2169){_0x46872f[_0x739c('0x30')]=_0x3a2169;if(_0x46f6a6[_0x739c('0x41')][_0x739c('0x4e')]){_0x55120d[_0x739c('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x739c('0x50')](_0x55120d);})[_0x739c('0x21')](function(_0x592784){_0x46872f[_0x739c('0x51')]=_0x592784;return _0x46872f;})[_0x739c('0x21')](respondWithFilteredResult(_0x30a1fe,_0x55120d))['catch'](handleError(_0x30a1fe,null));};exports[_0x739c('0x52')]=function(_0x4a3c43,_0x5bbc3d){var _0xb87d01={'raw':!![],'where':{'id':_0x4a3c43['params']['id']}},_0x213853={};_0x213853[_0x739c('0x40')]=_['keys'](db[_0x739c('0x3c')][_0x739c('0x53')]);_0x213853[_0x739c('0x41')]=_[_0x739c('0x3e')](_0x4a3c43[_0x739c('0x41')]);_0x213853[_0x739c('0x48')]=_[_0x739c('0x3f')](_0x213853[_0x739c('0x40')],_0x213853['query']);_0xb87d01[_0x739c('0x42')]=_[_0x739c('0x3f')](_0x213853[_0x739c('0x40')],qs[_0x739c('0x43')](_0x4a3c43[_0x739c('0x41')][_0x739c('0x43')]));_0xb87d01[_0x739c('0x42')]=_0xb87d01[_0x739c('0x42')][_0x739c('0x44')]?_0xb87d01[_0x739c('0x42')]:_0x213853[_0x739c('0x40')];if(_0x4a3c43[_0x739c('0x41')][_0x739c('0x4e')]){_0xb87d01[_0x739c('0x4f')]=[{'all':!![]}];}_0xb87d01=_[_0x739c('0x4c')]({},_0xb87d01,_0x4a3c43['options']);return db[_0x739c('0x3c')][_0x739c('0x54')](_0xb87d01)['then'](handleEntityNotFound(_0x5bbc3d,null))[_0x739c('0x21')](respondWithResult(_0x5bbc3d,null))[_0x739c('0x55')](handleError(_0x5bbc3d,null));};exports[_0x739c('0x56')]=function(_0x2bac0c,_0x2bfbe5){return db[_0x739c('0x3c')][_0x739c('0x56')](_0x2bac0c[_0x739c('0x57')],{})[_0x739c('0x21')](respondWithResult(_0x2bfbe5,0xc9))[_0x739c('0x55')](handleError(_0x2bfbe5,null));};exports['update']=function(_0x9c2d77,_0x3b6b79){if(_0x9c2d77[_0x739c('0x57')]['id']){delete _0x9c2d77[_0x739c('0x57')]['id'];}return db[_0x739c('0x3c')][_0x739c('0x54')]({'where':{'id':_0x9c2d77[_0x739c('0x58')]['id']}})[_0x739c('0x21')](handleEntityNotFound(_0x3b6b79,null))[_0x739c('0x21')](saveUpdates(_0x9c2d77[_0x739c('0x57')],null))['then'](respondWithResult(_0x3b6b79,null))['catch'](handleError(_0x3b6b79,null));};exports[_0x739c('0x38')]=function(_0x21e03a,_0x20bdc1){return db[_0x739c('0x3c')][_0x739c('0x54')]({'where':{'id':_0x21e03a[_0x739c('0x58')]['id']}})[_0x739c('0x21')](handleEntityNotFound(_0x20bdc1,null))[_0x739c('0x21')](removeEntity(_0x20bdc1,null))[_0x739c('0x55')](handleError(_0x20bdc1,null));};exports[_0x739c('0x59')]=function(_0x1c26d0,_0x17fa22){return db[_0x739c('0x3c')][_0x739c('0x59')]()['then'](respondWithResult(_0x17fa22,null))[_0x739c('0x55')](handleError(_0x17fa22,null));};var interaction_log=require(_0x739c('0x12'))(_0x739c('0x5a'));exports[_0x739c('0x5b')]=function(_0x54cd7e,_0x1b21f7,_0x11c9c5){var _0x1f5c2f={'agent':{},'channel':'openchannel'};if(_0x54cd7e[_0x739c('0x57')]['id']){delete _0x54cd7e[_0x739c('0x57')]['id'];}_0x54cd7e[_0x739c('0x57')][_0x739c('0x5c')]=!![];_0x54cd7e[_0x739c('0x57')][_0x739c('0x5d')]=moment()[_0x739c('0x5e')](_0x739c('0x5f'));_0x54cd7e[_0x739c('0x57')][_0x739c('0x60')]=_0x54cd7e[_0x739c('0x57')][_0x739c('0x60')]||_0x54cd7e[_0x739c('0x61')]['id'];_0x1f5c2f[_0x739c('0x62')]['id']=_0x54cd7e[_0x739c('0x57')]['UserId'];return db[_0x739c('0x3c')]['find']({'where':{'id':_0x54cd7e['params']['id'],'UserId':null}})[_0x739c('0x21')](handleEntityNotFound(_0x1b21f7,null))[_0x739c('0x21')](saveUpdates(_0x54cd7e[_0x739c('0x57')],null))[_0x739c('0x21')](function(_0x3afda4){if(_0x3afda4){_0x1f5c2f[_0x739c('0x28')]=_0x3afda4[_0x739c('0x63')]({'plain':!![]});return db[_0x739c('0x64')]['find']({'where':{'id':_0x3afda4[_0x739c('0x65')]}});}return null;})[_0x739c('0x21')](handleEntityNotFound(_0x1b21f7,null))[_0x739c('0x21')](function(_0x2b0920){if(_0x2b0920){return _0x2b0920[_0x739c('0x37')]({'UserId':_0x54cd7e[_0x739c('0x57')][_0x739c('0x60')],'read1stAt':_[_0x739c('0x66')](_0x2b0920[_0x739c('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x739c('0x21')](function(_0x5c3fb2){if(_0x5c3fb2){_0x1f5c2f[_0x739c('0x68')]=_0x5c3fb2[_0x739c('0x63')]({'plain':!![]});interaction_log['info'](_0x739c('0x69'),_0x54cd7e[_0x739c('0x61')]['id'],_0x54cd7e[_0x739c('0x61')][_0x739c('0x3a')],_0x54cd7e[_0x739c('0x61')][_0x739c('0x6a')],_0x1f5c2f['interaction']['id'],_0x54cd7e['body']?JSON['stringify'](_0x54cd7e[_0x739c('0x57')]):'null');return respondWithRpcPromise(_0x739c('0x6b'),_0x739c('0x6c'),_0x1f5c2f);}return null;})[_0x739c('0x21')](function(_0x495c4f){var _0xfd1fab=_0x739c('0x6d')+_0x495c4f[_0x739c('0x28')]['ContactId'];return db['sequelize'][_0x739c('0x41')](_0xfd1fab,{'type':db['Sequelize'][_0x739c('0x6e')][_0x739c('0x6f')],'raw':!![]})[_0x739c('0x21')](function(_0x2f2a00){return _0x2f2a00;});})[_0x739c('0x21')](function(_0x5b6ac9){if(_0x5b6ac9){_0x1f5c2f[_0x739c('0x28')][_0x739c('0x70')]=_0x5b6ac9[0x0];if(!_0x54cd7e[_0x739c('0x57')][_0x739c('0x60')])return;return db[_0x739c('0x71')][_0x739c('0x54')]({'where':{'id':_0x54cd7e['body'][_0x739c('0x60')],'role':_0x739c('0x62')},'attributes':['id','name','fullname',_0x739c('0x72'),'internal'],'raw':!![]});}return null;})[_0x739c('0x21')](function(_0x4513a8){if(!_0x4513a8)return null;_0x1f5c2f[_0x739c('0x28')][_0x739c('0x62')]=_0x4513a8;return _0x1f5c2f;})[_0x739c('0x21')](function(_0x3ba7ec){if(_0x3ba7ec){if(_0x54cd7e[_0x739c('0x57')][_0x739c('0x73')]){_0x1f5c2f['message'][_0x739c('0x74')]=util[_0x739c('0x5e')](_0x739c('0x75'),_0x54cd7e['user'][_0x739c('0x3a')]);_0x1f5c2f[_0x739c('0x28')][_0x739c('0x76')]=_0x1f5c2f[_0x739c('0x76')];_0x1f5c2f['message'][_0x739c('0x77')]=_0x1f5c2f[_0x739c('0x76')];_0x1f5c2f[_0x739c('0x28')]['event']=_0x739c('0x5b');return respondWithRpcPromise(_0x739c('0x78'),_0x739c('0x78'),{'event':_0x739c('0x79'),'message':_0x1f5c2f['message']},client9002)[_0x739c('0x21')](function(){return _0x1f5c2f;});}return _0x1f5c2f;}return null;})[_0x739c('0x21')](respondWithResult(_0x1b21f7,null))['catch'](handleError(_0x1b21f7,null));};var interaction_log=require(_0x739c('0x12'))(_0x739c('0x5a'));exports[_0x739c('0x35')]=function(_0x2c74fe,_0x1e1e32,_0x1a9d01){var _0x18ea2c={'agent':{},'channel':_0x739c('0x7a')};if(_0x2c74fe['body']['id']){delete _0x2c74fe[_0x739c('0x57')]['id'];}_0x2c74fe[_0x739c('0x57')][_0x739c('0x60')]=_0x2c74fe['body'][_0x739c('0x60')]||_0x2c74fe[_0x739c('0x61')]['id'];_0x18ea2c[_0x739c('0x62')]['id']=_0x2c74fe[_0x739c('0x57')][_0x739c('0x60')];return db['OpenchannelMessage']['find']({'where':{'id':_0x2c74fe[_0x739c('0x58')]['id'],'UserId':null}})[_0x739c('0x21')](handleEntityNotFound(_0x1e1e32,null))[_0x739c('0x21')](function(_0x3b7690){if(_0x3b7690){_0x18ea2c['message']=_0x3b7690[_0x739c('0x63')]({'plain':!![]});return db[_0x739c('0x64')]['find']({'where':{'id':_0x3b7690[_0x739c('0x65')]}});}return null;})[_0x739c('0x21')](handleEntityNotFound(_0x1e1e32,null))[_0x739c('0x21')](function(_0xecd770){if(_0xecd770){_0x18ea2c[_0x739c('0x68')]=_0xecd770[_0x739c('0x63')]({'plain':!![]});interaction_log[_0x739c('0x22')](_0x739c('0x7b'),_0x2c74fe['user']['id'],_0x2c74fe[_0x739c('0x61')][_0x739c('0x3a')],_0x2c74fe['user'][_0x739c('0x6a')],_0x18ea2c[_0x739c('0x68')]['id'],_0x2c74fe[_0x739c('0x57')]?JSON['stringify'](_0x2c74fe[_0x739c('0x57')]):'null');return respondWithRpcPromise(_0x739c('0x7c'),'rejectMessage',_0x18ea2c);}return null;})['then'](function(_0x51a3a7){var _0x27a9bc=_0x739c('0x6d')+_0x51a3a7['message'][_0x739c('0x7d')];return db[_0x739c('0x7e')][_0x739c('0x41')](_0x27a9bc,{'type':db[_0x739c('0x7f')][_0x739c('0x6e')][_0x739c('0x6f')],'raw':!![]})[_0x739c('0x21')](function(_0x613020){return _0x613020;});})[_0x739c('0x21')](function(_0x13fecf){if(_0x13fecf){_0x18ea2c['message']['contact']=_0x13fecf[0x0];if(!_0x2c74fe['body'][_0x739c('0x60')])return;return db[_0x739c('0x71')][_0x739c('0x54')]({'where':{'id':_0x2c74fe[_0x739c('0x57')]['UserId'],'role':_0x739c('0x62')},'attributes':['id',_0x739c('0x3a'),_0x739c('0x80'),_0x739c('0x72'),'internal'],'raw':!![]});}return null;})[_0x739c('0x21')](function(_0x9611f7){if(!_0x9611f7)return null;_0x18ea2c['message'][_0x739c('0x62')]=_0x9611f7;return _0x18ea2c;})[_0x739c('0x21')](function(_0x870e69){if(_0x870e69){_0x870e69['message']['interface']=util['format'](_0x739c('0x75'),_0x2c74fe['user'][_0x739c('0x3a')]);_0x870e69[_0x739c('0x28')]['channel']=_0x18ea2c[_0x739c('0x76')];_0x870e69['message'][_0x739c('0x77')]=_0x18ea2c[_0x739c('0x76')];_0x870e69[_0x739c('0x28')][_0x739c('0x81')]=_0x739c('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0x739c('0x82'),'message':_0x870e69[_0x739c('0x28')]},client9002);return _0x18ea2c;}return null;})['then'](respondWithResult(_0x1e1e32,null))[_0x739c('0x55')](handleError(_0x1e1e32,null));}; \ No newline at end of file +var _0x830f=['format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','name','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil'];(function(_0x1e0402,_0x3a5721){var _0x2d8c8f=function(_0x5f3f4e){while(--_0x5f3f4e){_0x1e0402['push'](_0x1e0402['shift']());}};_0x2d8c8f(++_0x3a5721);}(_0x830f,0x1a0));var _0xf830=function(_0x5701c2,_0x575423){_0x5701c2=_0x5701c2-0x0;var _0x11c4b6=_0x830f[_0x5701c2];return _0x11c4b6;};'use strict';var emlformat=require(_0xf830('0x0'));var rimraf=require(_0xf830('0x1'));var zipdir=require(_0xf830('0x2'));var jsonpatch=require(_0xf830('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf830('0x4'));var path=require(_0xf830('0x5'));var sox=require(_0xf830('0x6'));var csv=require(_0xf830('0x7'));var ejs=require(_0xf830('0x8'));var fs=require('fs');var fs_extra=require(_0xf830('0x9'));var _=require(_0xf830('0xa'));var squel=require(_0xf830('0xb'));var crypto=require(_0xf830('0xc'));var jsforce=require(_0xf830('0xd'));var deskjs=require(_0xf830('0xe'));var toCsv=require(_0xf830('0x7'));var querystring=require(_0xf830('0xf'));var Papa=require('papaparse');var Redis=require(_0xf830('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf830('0x11'));var as=require(_0xf830('0x12'));var hardwareService=require(_0xf830('0x13'));var logger=require(_0xf830('0x14'))('api');var utils=require(_0xf830('0x15'));var config=require(_0xf830('0x16'));var licenseUtil=require(_0xf830('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf830('0x18')],{'host':_0xf830('0x19'),'port':0x18eb});var socket=require(_0xf830('0x1a'))(new Redis(config[_0xf830('0x18')]));require(_0xf830('0x1b'))[_0xf830('0x1c')](socket);var jayson=require(_0xf830('0x1d'));var client=jayson[_0xf830('0x1e')][_0xf830('0x1f')]({'port':0x232c});var client9002=jayson[_0xf830('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x443a41,_0x2948c5,_0xd0eba1,_0x5d90ac){return new BPromise(function(_0x83f112,_0x2d8aed){var _0xc56ee6=_0x5d90ac||client;return _0xc56ee6[_0xf830('0x20')](_0x443a41,_0xd0eba1)[_0xf830('0x21')](function(_0x264e4f){logger[_0xf830('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x2948c5,_0xf830('0x23'));logger[_0xf830('0x24')](_0xf830('0x25'),_0x2948c5,_0xf830('0x23'),JSON[_0xf830('0x26')](_0x264e4f));if(_0x264e4f[_0xf830('0x27')]){if(_0x264e4f[_0xf830('0x27')][_0xf830('0x28')]===0x1f4){logger[_0xf830('0x27')](_0xf830('0x29'),_0x2948c5,_0x264e4f[_0xf830('0x27')][_0xf830('0x2a')]);return _0x2d8aed(_0x264e4f[_0xf830('0x27')][_0xf830('0x2a')]);}logger['error'](_0xf830('0x29'),_0x2948c5,_0x264e4f[_0xf830('0x27')]['message']);return _0x83f112(_0x264e4f[_0xf830('0x27')]['message']);}else{logger[_0xf830('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x2948c5,'request\x20sent');_0x83f112(_0x264e4f[_0xf830('0x2b')][_0xf830('0x2a')]);}})[_0xf830('0x2c')](function(_0x3a67c9){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2948c5,_0x3a67c9);_0x2d8aed(_0x3a67c9);});});}function respondWithStatusCode(_0xfb9a81,_0xb65656){_0xb65656=_0xb65656||0xcc;return function(_0x5ba950){if(_0x5ba950){return _0xfb9a81[_0xf830('0x2d')](_0xb65656);}return _0xfb9a81['status'](_0xb65656)[_0xf830('0x2e')]();};}function respondWithResult(_0x322f6c,_0x58828f){_0x58828f=_0x58828f||0xc8;return function(_0x23f5d2){if(_0x23f5d2){return _0x322f6c[_0xf830('0x2f')](_0x58828f)[_0xf830('0x30')](_0x23f5d2);}};}function respondWithFilteredResult(_0x17ed37,_0x5aff34){return function(_0x102069){if(_0x102069){var _0x5e0d3f=typeof _0x5aff34[_0xf830('0x31')]==='undefined'&&typeof _0x5aff34[_0xf830('0x32')]===_0xf830('0x33');var _0x967728=_0x102069['count'];var _0x4f168e=_0x5e0d3f?0x0:_0x5aff34['offset'];var _0x2554de=_0x5e0d3f?_0x102069[_0xf830('0x34')]:_0x5aff34['offset']+_0x5aff34['limit'];var _0x1e8e48;if(_0x2554de>=_0x967728){_0x2554de=_0x967728;_0x1e8e48=0xc8;}else{_0x1e8e48=0xce;}_0x17ed37['status'](_0x1e8e48);return _0x17ed37[_0xf830('0x35')](_0xf830('0x36'),_0x4f168e+'-'+_0x2554de+'/'+_0x967728)[_0xf830('0x30')](_0x102069);}return null;};}function patchUpdates(_0x1f6a8a){return function(_0x454923){try{jsonpatch[_0xf830('0x37')](_0x454923,_0x1f6a8a,!![]);}catch(_0x1275b5){return BPromise[_0xf830('0x38')](_0x1275b5);}return _0x454923[_0xf830('0x39')]();};}function saveUpdates(_0x558a9f,_0x55f34d){return function(_0x277583){if(_0x277583){return _0x277583[_0xf830('0x3a')](_0x558a9f)['then'](function(_0x3154ea){return _0x3154ea;});}return null;};}function removeEntity(_0x230d1e,_0x223448){return function(_0x2d4efc){if(_0x2d4efc){return _0x2d4efc['destroy']()['then'](function(){_0x230d1e[_0xf830('0x2f')](0xcc)[_0xf830('0x2e')]();});}};}function handleEntityNotFound(_0x1d91cf,_0x4744a1){return function(_0x585bbc){if(!_0x585bbc){_0x1d91cf[_0xf830('0x2d')](0x194);}return _0x585bbc;};}function handleError(_0x32bffd,_0x209bfa){_0x209bfa=_0x209bfa||0x1f4;return function(_0x3357af){logger[_0xf830('0x27')](_0x3357af['stack']);if(_0x3357af['name']){delete _0x3357af[_0xf830('0x3b')];}_0x32bffd[_0xf830('0x2f')](_0x209bfa)['send'](_0x3357af);};}exports['index']=function(_0x5232dc,_0x363cc1){var _0x12d642={},_0x265cd6={},_0x13c80c={'count':0x0,'rows':[]};var _0x207d5b=_[_0xf830('0x3c')](db[_0xf830('0x3d')][_0xf830('0x3e')],function(_0x593292){return{'name':_0x593292['fieldName'],'type':_0x593292[_0xf830('0x3f')][_0xf830('0x40')]};});_0x265cd6[_0xf830('0x41')]=_[_0xf830('0x3c')](_0x207d5b,_0xf830('0x3b'));_0x265cd6[_0xf830('0x42')]=_[_0xf830('0x43')](_0x5232dc[_0xf830('0x42')]);_0x265cd6[_0xf830('0x44')]=_[_0xf830('0x45')](_0x265cd6[_0xf830('0x41')],_0x265cd6[_0xf830('0x42')]);_0x12d642[_0xf830('0x46')]=_['intersection'](_0x265cd6[_0xf830('0x41')],qs[_0xf830('0x47')](_0x5232dc[_0xf830('0x42')][_0xf830('0x47')]));_0x12d642[_0xf830('0x46')]=_0x12d642[_0xf830('0x46')][_0xf830('0x48')]?_0x12d642[_0xf830('0x46')]:_0x265cd6['model'];if(!_0x5232dc['query'][_0xf830('0x49')](_0xf830('0x4a'))){_0x12d642[_0xf830('0x32')]=qs[_0xf830('0x32')](_0x5232dc[_0xf830('0x42')][_0xf830('0x32')]);_0x12d642[_0xf830('0x31')]=qs[_0xf830('0x31')](_0x5232dc[_0xf830('0x42')][_0xf830('0x31')]);}_0x12d642[_0xf830('0x4b')]=qs[_0xf830('0x4c')](_0x5232dc[_0xf830('0x42')][_0xf830('0x4c')]);_0x12d642[_0xf830('0x4d')]=qs[_0xf830('0x44')](_[_0xf830('0x4e')](_0x5232dc[_0xf830('0x42')],_0x265cd6['filters']),_0x207d5b);if(_0x5232dc[_0xf830('0x42')][_0xf830('0x4f')]){_0x12d642[_0xf830('0x4d')]=_['merge'](_0x12d642[_0xf830('0x4d')],{'$or':_[_0xf830('0x3c')](_0x207d5b,function(_0x2081fe){if(_0x2081fe['type']!==_0xf830('0x50')){var _0x4eb04c={};_0x4eb04c[_0x2081fe[_0xf830('0x3b')]]={'$like':'%'+_0x5232dc[_0xf830('0x42')][_0xf830('0x4f')]+'%'};return _0x4eb04c;}})});}_0x12d642=_[_0xf830('0x51')]({},_0x12d642,_0x5232dc['options']);var _0x2388ad={'where':_0x12d642[_0xf830('0x4d')]};return db['OpenchannelMessage']['count'](_0x2388ad)[_0xf830('0x21')](function(_0x1eb148){_0x13c80c[_0xf830('0x34')]=_0x1eb148;if(_0x5232dc[_0xf830('0x42')][_0xf830('0x52')]){_0x12d642[_0xf830('0x53')]=[{'all':!![]}];}return db[_0xf830('0x3d')][_0xf830('0x54')](_0x12d642);})[_0xf830('0x21')](function(_0x53bf11){_0x13c80c[_0xf830('0x55')]=_0x53bf11;return _0x13c80c;})['then'](respondWithFilteredResult(_0x363cc1,_0x12d642))[_0xf830('0x2c')](handleError(_0x363cc1,null));};exports['show']=function(_0x438d9f,_0x36d8be){var _0x2a04de={'raw':!![],'where':{'id':_0x438d9f[_0xf830('0x56')]['id']}},_0x32a5ea={};_0x32a5ea[_0xf830('0x41')]=_[_0xf830('0x43')](db[_0xf830('0x3d')][_0xf830('0x3e')]);_0x32a5ea['query']=_[_0xf830('0x43')](_0x438d9f[_0xf830('0x42')]);_0x32a5ea['filters']=_[_0xf830('0x45')](_0x32a5ea[_0xf830('0x41')],_0x32a5ea[_0xf830('0x42')]);_0x2a04de['attributes']=_[_0xf830('0x45')](_0x32a5ea['model'],qs[_0xf830('0x47')](_0x438d9f[_0xf830('0x42')]['fields']));_0x2a04de['attributes']=_0x2a04de[_0xf830('0x46')][_0xf830('0x48')]?_0x2a04de[_0xf830('0x46')]:_0x32a5ea[_0xf830('0x41')];if(_0x438d9f['query']['includeAll']){_0x2a04de[_0xf830('0x53')]=[{'all':!![]}];}_0x2a04de=_[_0xf830('0x51')]({},_0x2a04de,_0x438d9f[_0xf830('0x57')]);return db[_0xf830('0x3d')][_0xf830('0x58')](_0x2a04de)[_0xf830('0x21')](handleEntityNotFound(_0x36d8be,null))['then'](respondWithResult(_0x36d8be,null))[_0xf830('0x2c')](handleError(_0x36d8be,null));};exports[_0xf830('0x59')]=function(_0x101d87,_0x1853da){return db['OpenchannelMessage'][_0xf830('0x59')](_0x101d87['body'],{})[_0xf830('0x21')](respondWithResult(_0x1853da,0xc9))['catch'](handleError(_0x1853da,null));};exports[_0xf830('0x3a')]=function(_0x12ba72,_0x91c5ba){if(_0x12ba72[_0xf830('0x5a')]['id']){delete _0x12ba72[_0xf830('0x5a')]['id'];}return db['OpenchannelMessage'][_0xf830('0x58')]({'where':{'id':_0x12ba72[_0xf830('0x56')]['id']}})[_0xf830('0x21')](handleEntityNotFound(_0x91c5ba,null))[_0xf830('0x21')](saveUpdates(_0x12ba72[_0xf830('0x5a')],null))[_0xf830('0x21')](respondWithResult(_0x91c5ba,null))[_0xf830('0x2c')](handleError(_0x91c5ba,null));};exports[_0xf830('0x5b')]=function(_0x334055,_0x2c4a2f){return db[_0xf830('0x3d')]['find']({'where':{'id':_0x334055[_0xf830('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c4a2f,null))[_0xf830('0x21')](removeEntity(_0x2c4a2f,null))[_0xf830('0x2c')](handleError(_0x2c4a2f,null));};exports[_0xf830('0x5c')]=function(_0x2cd278,_0x375b97){return db['OpenchannelMessage'][_0xf830('0x5c')]()[_0xf830('0x21')](respondWithResult(_0x375b97,null))[_0xf830('0x2c')](handleError(_0x375b97,null));};var interaction_log=require(_0xf830('0x14'))(_0xf830('0x5d'));exports[_0xf830('0x5e')]=function(_0x5bb61f,_0xb3e8e3,_0x3cf7a0){var _0x46af8b={'agent':{},'channel':_0xf830('0x5f')};if(_0x5bb61f['body']['id']){delete _0x5bb61f['body']['id'];}_0x5bb61f[_0xf830('0x5a')][_0xf830('0x60')]=!![];_0x5bb61f[_0xf830('0x5a')][_0xf830('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5bb61f[_0xf830('0x5a')][_0xf830('0x62')]=_0x5bb61f['body'][_0xf830('0x62')]||_0x5bb61f[_0xf830('0x63')]['id'];_0x46af8b[_0xf830('0x64')]['id']=_0x5bb61f[_0xf830('0x5a')][_0xf830('0x62')];return db[_0xf830('0x3d')][_0xf830('0x58')]({'where':{'id':_0x5bb61f[_0xf830('0x56')]['id'],'UserId':null}})[_0xf830('0x21')](handleEntityNotFound(_0xb3e8e3,null))['then'](saveUpdates(_0x5bb61f[_0xf830('0x5a')],null))[_0xf830('0x21')](function(_0x3ae38c){if(_0x3ae38c){_0x46af8b[_0xf830('0x2a')]=_0x3ae38c['get']({'plain':!![]});return db[_0xf830('0x65')][_0xf830('0x58')]({'where':{'id':_0x3ae38c[_0xf830('0x66')]}});}return null;})[_0xf830('0x21')](handleEntityNotFound(_0xb3e8e3,null))[_0xf830('0x21')](function(_0x33757f){if(_0x33757f){return _0x33757f['update']({'UserId':_0x5bb61f['body']['UserId'],'read1stAt':_[_0xf830('0x67')](_0x33757f['read1stAt'])?moment()[_0xf830('0x68')](_0xf830('0x69')):undefined});}return null;})[_0xf830('0x21')](function(_0x29abfe){if(_0x29abfe){_0x46af8b[_0xf830('0x6a')]=_0x29abfe['get']({'plain':!![]});interaction_log[_0xf830('0x22')](_0xf830('0x6b'),_0x5bb61f['user']['id'],_0x5bb61f[_0xf830('0x63')][_0xf830('0x3b')],_0x5bb61f[_0xf830('0x63')][_0xf830('0x6c')],_0x46af8b[_0xf830('0x6a')]['id'],_0x5bb61f[_0xf830('0x5a')]?JSON[_0xf830('0x26')](_0x5bb61f['body']):_0xf830('0x6d'));return respondWithRpcPromise(_0xf830('0x6e'),_0xf830('0x6f'),_0x46af8b);}return null;})[_0xf830('0x21')](function(_0x55566c){var _0x33bb71=_0xf830('0x70')+_0x55566c['message']['ContactId'];return db['sequelize'][_0xf830('0x42')](_0x33bb71,{'type':db[_0xf830('0x71')][_0xf830('0x72')][_0xf830('0x73')],'raw':!![]})[_0xf830('0x21')](function(_0x3499f7){return _0x3499f7;});})[_0xf830('0x21')](function(_0x5d16c0){if(_0x5d16c0){_0x46af8b[_0xf830('0x2a')][_0xf830('0x74')]=_0x5d16c0[0x0];if(!_0x5bb61f['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x5bb61f['body'][_0xf830('0x62')],'role':'agent'},'attributes':['id',_0xf830('0x3b'),_0xf830('0x75'),_0xf830('0x76'),_0xf830('0x77')],'raw':!![]});}return null;})[_0xf830('0x21')](function(_0x23ee68){if(!_0x23ee68)return null;_0x46af8b[_0xf830('0x2a')][_0xf830('0x64')]=_0x23ee68;return _0x46af8b;})[_0xf830('0x21')](function(_0x54e63f){if(_0x54e63f){if(_0x5bb61f[_0xf830('0x5a')]['manual']){_0x46af8b[_0xf830('0x2a')][_0xf830('0x78')]=util['format']('SIP/%s',_0x5bb61f[_0xf830('0x63')][_0xf830('0x3b')]);_0x46af8b['message'][_0xf830('0x79')]=_0x46af8b[_0xf830('0x79')];_0x46af8b[_0xf830('0x2a')][_0xf830('0x7a')]=_0x46af8b['channel'];_0x46af8b[_0xf830('0x2a')][_0xf830('0x7b')]=_0xf830('0x5e');return respondWithRpcPromise(_0xf830('0x7c'),_0xf830('0x7c'),{'event':_0xf830('0x7d'),'message':_0x46af8b[_0xf830('0x2a')]},client9002)[_0xf830('0x21')](function(){return _0x46af8b;});}return _0x46af8b;}return null;})['then'](respondWithResult(_0xb3e8e3,null))[_0xf830('0x2c')](handleError(_0xb3e8e3,null));};var interaction_log=require(_0xf830('0x14'))(_0xf830('0x5d'));exports[_0xf830('0x38')]=function(_0x1d0097,_0x1ac400,_0x2cd78d){var _0x403c6a={'agent':{},'channel':'openchannel'};if(_0x1d0097[_0xf830('0x5a')]['id']){delete _0x1d0097[_0xf830('0x5a')]['id'];}_0x1d0097[_0xf830('0x5a')][_0xf830('0x62')]=_0x1d0097[_0xf830('0x5a')]['UserId']||_0x1d0097['user']['id'];_0x403c6a[_0xf830('0x64')]['id']=_0x1d0097[_0xf830('0x5a')][_0xf830('0x62')];return db[_0xf830('0x3d')][_0xf830('0x58')]({'where':{'id':_0x1d0097[_0xf830('0x56')]['id'],'UserId':null}})[_0xf830('0x21')](handleEntityNotFound(_0x1ac400,null))[_0xf830('0x21')](function(_0x48c757){if(_0x48c757){_0x403c6a['message']=_0x48c757[_0xf830('0x7e')]({'plain':!![]});return db[_0xf830('0x65')]['find']({'where':{'id':_0x48c757[_0xf830('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1ac400,null))['then'](function(_0x3419f9){if(_0x3419f9){_0x403c6a[_0xf830('0x6a')]=_0x3419f9[_0xf830('0x7e')]({'plain':!![]});interaction_log[_0xf830('0x22')](_0xf830('0x7f'),_0x1d0097[_0xf830('0x63')]['id'],_0x1d0097['user'][_0xf830('0x3b')],_0x1d0097[_0xf830('0x63')][_0xf830('0x6c')],_0x403c6a[_0xf830('0x6a')]['id'],_0x1d0097[_0xf830('0x5a')]?JSON[_0xf830('0x26')](_0x1d0097[_0xf830('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0xf830('0x80'),_0x403c6a);}return null;})[_0xf830('0x21')](function(_0x2889f0){var _0x6226c7=_0xf830('0x70')+_0x2889f0[_0xf830('0x2a')]['ContactId'];return db['sequelize'][_0xf830('0x42')](_0x6226c7,{'type':db[_0xf830('0x71')][_0xf830('0x72')][_0xf830('0x73')],'raw':!![]})[_0xf830('0x21')](function(_0x445349){return _0x445349;});})[_0xf830('0x21')](function(_0x3e7452){if(_0x3e7452){_0x403c6a[_0xf830('0x2a')][_0xf830('0x74')]=_0x3e7452[0x0];if(!_0x1d0097[_0xf830('0x5a')]['UserId'])return;return db['User'][_0xf830('0x58')]({'where':{'id':_0x1d0097[_0xf830('0x5a')][_0xf830('0x62')],'role':_0xf830('0x64')},'attributes':['id',_0xf830('0x3b'),_0xf830('0x75'),_0xf830('0x76'),_0xf830('0x77')],'raw':!![]});}return null;})[_0xf830('0x21')](function(_0x289aab){if(!_0x289aab)return null;_0x403c6a[_0xf830('0x2a')][_0xf830('0x64')]=_0x289aab;return _0x403c6a;})['then'](function(_0x4fc55c){if(_0x4fc55c){_0x4fc55c[_0xf830('0x2a')]['interface']=util['format']('SIP/%s',_0x1d0097['user'][_0xf830('0x3b')]);_0x4fc55c[_0xf830('0x2a')]['channel']=_0x403c6a['channel'];_0x4fc55c[_0xf830('0x2a')]['motionChannel']=_0x403c6a[_0xf830('0x79')];_0x4fc55c[_0xf830('0x2a')][_0xf830('0x7b')]=_0xf830('0x38');respondWithRpcPromise(_0xf830('0x7c'),'EventManager',{'event':_0xf830('0x81'),'message':_0x4fc55c[_0xf830('0x2a')]},client9002);return _0x403c6a;}return null;})[_0xf830('0x21')](respondWithResult(_0x1ac400,null))['catch'](handleError(_0x1ac400,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 4ce45df..4e13f38 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 _0x3f74=['hook','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3f74,0xe8));var _0x43f7=function(_0x4f438c,_0xd45003){_0x4f438c=_0x4f438c-0x0;var _0x3cd183=_0x3f74[_0x4f438c];return _0x3cd183;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x43f7('0x0')](0x0);var events={'afterCreate':_0x43f7('0x1'),'afterUpdate':_0x43f7('0x2'),'afterDestroy':_0x43f7('0x3')};function emitEvent(_0x3761b6){return function(_0x934ce6,_0x3ab220,_0x4a470a){OpenchannelMessageEvents[_0x43f7('0x4')](_0x3761b6+':'+_0x934ce6['id'],_0x934ce6);OpenchannelMessageEvents[_0x43f7('0x4')](_0x3761b6,_0x934ce6);_0x4a470a(null);};}for(var e in events){if(events[_0x43f7('0x5')](e)){var event=events[e];OpenchannelMessage[_0x43f7('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x0c68=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x209e05,_0xc489b4){var _0x18ee7f=function(_0x3edc30){while(--_0x3edc30){_0x209e05['push'](_0x209e05['shift']());}};_0x18ee7f(++_0xc489b4);}(_0x0c68,0x8c));var _0x80c6=function(_0x3bcf63,_0x33b682){_0x3bcf63=_0x3bcf63-0x0;var _0xcee412=_0x0c68[_0x3bcf63];return _0xcee412;};'use strict';var EventEmitter=require(_0x80c6('0x0'));var OpenchannelMessage=require(_0x80c6('0x1'))['db'][_0x80c6('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x80c6('0x3')](0x0);var events={'afterCreate':_0x80c6('0x4'),'afterUpdate':_0x80c6('0x5'),'afterDestroy':_0x80c6('0x6')};function emitEvent(_0x2791d3){return function(_0x59825b,_0x19ee87,_0x1d33d3){OpenchannelMessageEvents[_0x80c6('0x7')](_0x2791d3+':'+_0x59825b['id'],_0x59825b);OpenchannelMessageEvents[_0x80c6('0x7')](_0x2791d3,_0x59825b);_0x1d33d3(null);};}for(var e in events){if(events[_0x80c6('0x8')](e)){var event=events[e];OpenchannelMessage[_0x80c6('0x9')](e,emitEvent(event));}}module[_0x80c6('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index d746e42..c940254 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 _0x4931=['./openchannelMessage.attributes','exports','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','describe','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x4931,0xe4));var _0x1493=function(_0x3f2c27,_0xf54a9a){_0x3f2c27=_0x3f2c27-0x0;var _0x42c37f=_0x4931[_0x3f2c27];return _0x42c37f;};'use strict';var _=require('lodash');var util=require(_0x1493('0x0'));var logger=require(_0x1493('0x1'))(_0x1493('0x2'));var moment=require(_0x1493('0x3'));var BPromise=require(_0x1493('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1493('0x5'));var rimraf=require(_0x1493('0x6'));var config=require('../../config/environment');var attributes=require(_0x1493('0x7'));module[_0x1493('0x8')]=function(_0x1e52ff,_0x449d2b){return _0x1e52ff['define']('OpenchannelMessage',attributes,{'tableName':_0x1493('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1493('0xa')],'type':_0x1493('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xba68cb,_0x14b810,_0x3f6858){var _0x4c6830=_0x1e52ff[_0x1493('0xc')];var _0x1dc652=_0xba68cb[_0x1493('0xd')]({'plain':!![]});if(_0x1dc652[_0x1493('0xe')][_0x1493('0xf')]()==='in'||_0x1dc652[_0x1493('0xe')][_0x1493('0xf')]()===_0x1493('0x10')&&!_0x1dc652[_0x1493('0x11')]&&!_[_0x1493('0x12')](_0x1dc652[_0x1493('0x13')])){_0x4c6830[_0x1493('0x14')][_0x1493('0x15')]({'where':{'id':_0x1dc652[_0x1493('0x16')]}})[_0x1493('0x17')](function(_0x3d49ed){if(_0x3d49ed){_0x3d49ed[_0x1493('0x18')]({'lastMsgAt':_0x1dc652[_0x1493('0x19')],'lastMsgDirection':_0x1dc652[_0x1493('0xe')][_0x1493('0xf')]()});}})[_0x1493('0x1a')](function(_0x5a0aec){console['error'](_0x5a0aec);});}if(_0x1dc652['direction']==='out'&&!_0x1dc652[_0x1493('0x11')]){var _0x220b35;_0x4c6830['CmContact'][_0x1493('0x1b')]()[_0x1493('0x17')](function(_0x5e1348){return _0x4c6830['OpenchannelAccount']['find']({'where':{'id':_0x1dc652[_0x1493('0x1c')]},'include':[{'model':_0x4c6830[_0x1493('0x14')],'as':_0x1493('0x1d'),'where':{'id':_0x1dc652['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4c6830[_0x1493('0x1e')],'as':_0x1493('0x1f'),'attributes':_[_0x1493('0x20')](_0x5e1348)}]}]});})[_0x1493('0x17')](function(_0x313d92){_0x220b35=_0x313d92[_0x1493('0xd')]({'plain':!![]});if(_0x220b35&&_0x220b35[_0x1493('0x21')]){logger[_0x1493('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x1493('0x23'),util[_0x1493('0x24')](_0x1493('0x25'),_0x1dc652['id'],_0x220b35[_0x1493('0x21')]));if(_0x220b35['Interactions']&&_0x220b35[_0x1493('0x1d')]['length']){_0x1dc652[_0x1493('0x26')]=_[_0x1493('0x27')](_0x220b35['Interactions'][0x0],_0x1493('0x1f'));_0x1dc652[_0x1493('0x1f')]=_0x220b35[_0x1493('0x1d')][0x0][_0x1493('0x1f')];}var _0x14b810={'method':_0x1493('0x28'),'uri':encodeURI(_0x220b35[_0x1493('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x14b810[_0x1493('0x29')]){case'GET':_0x14b810['qs']=_0x1dc652;break;case _0x1493('0x28'):_0x14b810[_0x1493('0xa')]=_0x1dc652;break;}return rp(_0x14b810)[_0x1493('0x17')](function(_0x2b41ce){logger[_0x1493('0x22')](_0x1493('0x2a'),_0x1493('0x23'),util[_0x1493('0x24')](_0x1493('0x2b'),_0x1dc652['id'],_0x220b35[_0x1493('0x21')]));if(_0x2b41ce['body'][_0x1493('0x2c')]&&_0x2b41ce['body'][_0x1493('0x2c')]!=_0x1dc652[_0x1493('0x26')][_0x1493('0x2c')]){return _0x4c6830[_0x1493('0x14')][_0x1493('0x18')]({'threadId':_0x2b41ce['body'][_0x1493('0x2c')]},{'where':{'id':_0x1dc652[_0x1493('0x26')]['id']}});}else{return;}})[_0x1493('0x17')](function(){return _0xba68cb[_0x1493('0x18')]({'read':!![]});})['catch'](function(_0x49202f){logger['error'](_0x1493('0x2a'),_0x1493('0x23'),util[_0x1493('0x2d')](_0x49202f,{'showHidden':![],'depth':null}));_0x3f6858();});}else{_0x3f6858();}})['finally'](function(){_0x3f6858();});}else{_0x3f6858();}}},'charset':_0x1493('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x61b3=['Interaction','omit','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','then','update','catch','CmContact','describe','OpenchannelAccount','OpenchannelInteraction','OpenchannelInteractionId','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x61b3,0x138));var _0x361b=function(_0x3ce34a,_0x475c3c){_0x3ce34a=_0x3ce34a-0x0;var _0x7a42c1=_0x61b3[_0x3ce34a];return _0x7a42c1;};'use strict';var _=require('lodash');var util=require(_0x361b('0x0'));var logger=require(_0x361b('0x1'))(_0x361b('0x2'));var moment=require('moment');var BPromise=require(_0x361b('0x3'));var rp=require(_0x361b('0x4'));var fs=require('fs');var path=require(_0x361b('0x5'));var rimraf=require('rimraf');var config=require(_0x361b('0x6'));var attributes=require(_0x361b('0x7'));module[_0x361b('0x8')]=function(_0x33de9c,_0x3c2fc1){return _0x33de9c[_0x361b('0x9')](_0x361b('0xa'),attributes,{'tableName':_0x361b('0xb'),'paranoid':![],'indexes':[{'name':_0x361b('0xc'),'fields':['body'],'type':_0x361b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aeddf,_0x28fe9a,_0x5f47c2){var _0x42ad8b=_0x33de9c['models'];var _0x355627=_0x3aeddf[_0x361b('0xe')]({'plain':!![]});if(_0x355627[_0x361b('0xf')][_0x361b('0x10')]()==='in'||_0x355627[_0x361b('0xf')][_0x361b('0x10')]()===_0x361b('0x11')&&!_0x355627[_0x361b('0x12')]&&!_['isNil'](_0x355627[_0x361b('0x13')])){_0x42ad8b['OpenchannelInteraction']['findOne']({'where':{'id':_0x355627['OpenchannelInteractionId']}})[_0x361b('0x14')](function(_0x2b68ba){if(_0x2b68ba){_0x2b68ba[_0x361b('0x15')]({'lastMsgAt':_0x355627['createdAt'],'lastMsgDirection':_0x355627[_0x361b('0xf')][_0x361b('0x10')]()});}})[_0x361b('0x16')](function(_0x56a3b2){console['error'](_0x56a3b2);});}if(_0x355627[_0x361b('0xf')]==='out'&&!_0x355627['secret']){var _0x12a8f0;_0x42ad8b[_0x361b('0x17')][_0x361b('0x18')]()[_0x361b('0x14')](function(_0x310da3){return _0x42ad8b[_0x361b('0x19')]['find']({'where':{'id':_0x355627['OpenchannelAccountId']},'include':[{'model':_0x42ad8b[_0x361b('0x1a')],'as':'Interactions','where':{'id':_0x355627[_0x361b('0x1b')]},'limit':0x1,'include':[{'model':_0x42ad8b[_0x361b('0x17')],'as':_0x361b('0x1c'),'attributes':_[_0x361b('0x1d')](_0x310da3)}]}]});})[_0x361b('0x14')](function(_0x58866c){_0x12a8f0=_0x58866c[_0x361b('0xe')]({'plain':!![]});if(_0x12a8f0&&_0x12a8f0['replyUri']){logger[_0x361b('0x1e')](_0x361b('0x1f'),_0x361b('0x20'),util[_0x361b('0x21')](_0x361b('0x22'),_0x355627['id'],_0x12a8f0[_0x361b('0x23')]));if(_0x12a8f0[_0x361b('0x24')]&&_0x12a8f0['Interactions'][_0x361b('0x25')]){_0x355627[_0x361b('0x26')]=_[_0x361b('0x27')](_0x12a8f0[_0x361b('0x24')][0x0],_0x361b('0x1c'));_0x355627[_0x361b('0x1c')]=_0x12a8f0[_0x361b('0x24')][0x0][_0x361b('0x1c')];}var _0x28fe9a={'method':_0x361b('0x28'),'uri':encodeURI(_0x12a8f0[_0x361b('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x28fe9a[_0x361b('0x29')]){case _0x361b('0x2a'):_0x28fe9a['qs']=_0x355627;break;case'POST':_0x28fe9a[_0x361b('0x2b')]=_0x355627;break;}return rp(_0x28fe9a)[_0x361b('0x14')](function(_0xe79e93){logger[_0x361b('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x361b('0x20'),util[_0x361b('0x21')](_0x361b('0x2c'),_0x355627['id'],_0x12a8f0[_0x361b('0x23')]));if(_0xe79e93[_0x361b('0x2b')][_0x361b('0x2d')]&&_0xe79e93[_0x361b('0x2b')][_0x361b('0x2d')]!=_0x355627[_0x361b('0x26')][_0x361b('0x2d')]){return _0x42ad8b['OpenchannelInteraction'][_0x361b('0x15')]({'threadId':_0xe79e93[_0x361b('0x2b')][_0x361b('0x2d')]},{'where':{'id':_0x355627[_0x361b('0x26')]['id']}});}else{return;}})[_0x361b('0x14')](function(){return _0x3aeddf[_0x361b('0x15')]({'read':!![]});})[_0x361b('0x16')](function(_0x152cd8){logger['error'](_0x361b('0x1f'),'afterCreate',util[_0x361b('0x2e')](_0x152cd8,{'showHidden':![],'depth':null}));_0x5f47c2();});}else{_0x5f47c2();}})[_0x361b('0x2f')](function(){_0x5f47c2();});}else{_0x5f47c2();}}},'charset':_0x361b('0x30'),'collate':_0x361b('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2db8acc..1ea5762 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x10c5e5,_0x83df3f){var _0x42d237=function(_0x1dea0f){while(--_0x1dea0f){_0x10c5e5['push'](_0x10c5e5['shift']());}};_0x42d237(++_0x83df3f);}(_0x2ef3,0xba));var _0x32ef=function(_0x47d0a8,_0x17cd41){_0x47d0a8=_0x47d0a8-0x0;var _0x1c29f0=_0x2ef3[_0x47d0a8];return _0x1c29f0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xffa302,_0xfd695c){var _0x38ea4b=function(_0xaa04c3){while(--_0xaa04c3){_0xffa302['push'](_0xffa302['shift']());}};_0x38ea4b(++_0xfd695c);}(_0xdb28,0x106));var _0x8db2=function(_0x1021ea,_0x2ab4b2){_0x1021ea=_0x1021ea-0x0;var _0x57bcc8=_0xdb28[_0x1021ea];return _0x57bcc8;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index da4edf7..17cafae 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 _0x3aa1=['register','length','openchannelMessage:','save','remove','emit'];(function(_0x43616d,_0xf7203c){var _0x5d0681=function(_0x1ccea8){while(--_0x1ccea8){_0x43616d['push'](_0x43616d['shift']());}};_0x5d0681(++_0xf7203c);}(_0x3aa1,0xdb));var _0x13aa=function(_0x20d32a,_0x236eda){_0x20d32a=_0x20d32a-0x0;var _0x5556b7=_0x3aa1[_0x20d32a];return _0x5556b7;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x13aa('0x0'),_0x13aa('0x1'),'update'];function createListener(_0x4d8772,_0x417f22){return function(_0x31df5e){_0x417f22[_0x13aa('0x2')](_0x4d8772,_0x31df5e);};}function removeListener(_0x2f37ad,_0x4e3498){return function(){OpenchannelMessageEvents['removeListener'](_0x2f37ad,_0x4e3498);};}exports[_0x13aa('0x3')]=function(_0x4e31e7){for(var _0x17d94b=0x0,_0x9700a8=events[_0x13aa('0x4')];_0x17d94b<_0x9700a8;_0x17d94b++){var _0x5c15d8=events[_0x17d94b];var _0x201b72=createListener(_0x13aa('0x5')+_0x5c15d8,_0x4e31e7);OpenchannelMessageEvents['on'](_0x5c15d8,_0x201b72);}}; \ No newline at end of file +var _0xd90b=['register','length','openchannelMessage:','./openchannelMessage.events','update','removeListener'];(function(_0x114f86,_0x23c548){var _0x3d554e=function(_0x29c4f1){while(--_0x29c4f1){_0x114f86['push'](_0x114f86['shift']());}};_0x3d554e(++_0x23c548);}(_0xd90b,0xbd));var _0xbd90=function(_0x3c87ff,_0x2eebc0){_0x3c87ff=_0x3c87ff-0x0;var _0x164f41=_0xd90b[_0x3c87ff];return _0x164f41;};'use strict';var OpenchannelMessageEvents=require(_0xbd90('0x0'));var events=['save','remove',_0xbd90('0x1')];function createListener(_0x5a9a50,_0x5e0407){return function(_0x40bb8c){_0x5e0407['emit'](_0x5a9a50,_0x40bb8c);};}function removeListener(_0x3d994c,_0x1813c7){return function(){OpenchannelMessageEvents[_0xbd90('0x2')](_0x3d994c,_0x1813c7);};}exports[_0xbd90('0x3')]=function(_0x448c24){for(var _0x257fd3=0x0,_0x524ad0=events[_0xbd90('0x4')];_0x257fd3<_0x524ad0;_0x257fd3++){var _0x2f612f=events[_0x257fd3];var _0x35be45=createListener(_0xbd90('0x5')+_0x2f612f,_0x448c24);OpenchannelMessageEvents['on'](_0x2f612f,_0x35be45);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index bb2e913..3be5a8d 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 _0x497a=['post','addAgents','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x497a,0x158));var _0xa497=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x497a[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0xa497('0x0'));var util=require(_0xa497('0x1'));var path=require('path');var timeout=require(_0xa497('0x2'));var express=require(_0xa497('0x3'));var router=express[_0xa497('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa497('0x5'));var interaction=require(_0xa497('0x6'));var config=require(_0xa497('0x7'));var controller=require('./openchannelQueue.controller');router[_0xa497('0x8')]('/',auth['isAuthenticated'](),controller[_0xa497('0x9')]);router[_0xa497('0x8')](_0xa497('0xa'),auth[_0xa497('0xb')](),controller[_0xa497('0xc')]);router['get'](_0xa497('0xd'),auth[_0xa497('0xb')](),controller[_0xa497('0xe')]);router[_0xa497('0x8')](_0xa497('0xf'),auth[_0xa497('0xb')](),controller[_0xa497('0x10')]);router['get'](_0xa497('0x11'),auth[_0xa497('0xb')](),controller[_0xa497('0x12')]);router[_0xa497('0x8')](_0xa497('0x13'),auth[_0xa497('0xb')](),controller['getAgents']);router[_0xa497('0x14')]('/',auth[_0xa497('0xb')](),controller['create']);router['post'](_0xa497('0x11'),auth[_0xa497('0xb')](),controller['addTeams']);router[_0xa497('0x14')]('/:id/users',auth[_0xa497('0xb')](),controller[_0xa497('0x15')]);router[_0xa497('0x16')](_0xa497('0xd'),auth[_0xa497('0xb')](),controller[_0xa497('0x17')]);router[_0xa497('0x18')](_0xa497('0xd'),auth[_0xa497('0xb')](),controller[_0xa497('0x19')]);router[_0xa497('0x18')](_0xa497('0x11'),auth[_0xa497('0xb')](),controller['removeTeams']);router[_0xa497('0x18')](_0xa497('0x13'),auth[_0xa497('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xaaef=['addTeams','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post'];(function(_0x174631,_0x4570dc){var _0x9592c5=function(_0xd9ce34){while(--_0xd9ce34){_0x174631['push'](_0x174631['shift']());}};_0x9592c5(++_0x4570dc);}(_0xaaef,0x1a7));var _0xfaae=function(_0x2bbaa4,_0xbda501){_0x2bbaa4=_0x2bbaa4-0x0;var _0x4d8b27=_0xaaef[_0x2bbaa4];return _0x4d8b27;};'use strict';var multer=require(_0xfaae('0x0'));var util=require('util');var path=require(_0xfaae('0x1'));var timeout=require(_0xfaae('0x2'));var express=require('express');var router=express[_0xfaae('0x3')]();var fs_extra=require(_0xfaae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfaae('0x5'));var controller=require('./openchannelQueue.controller');router[_0xfaae('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfaae('0x6')](_0xfaae('0x7'),auth[_0xfaae('0x8')](),controller[_0xfaae('0x9')]);router['get'](_0xfaae('0xa'),auth[_0xfaae('0x8')](),controller[_0xfaae('0xb')]);router[_0xfaae('0x6')](_0xfaae('0xc'),auth[_0xfaae('0x8')](),controller[_0xfaae('0xd')]);router[_0xfaae('0x6')](_0xfaae('0xe'),auth[_0xfaae('0x8')](),controller[_0xfaae('0xf')]);router['get']('/:id/users',auth[_0xfaae('0x8')](),controller[_0xfaae('0x10')]);router['post']('/',auth[_0xfaae('0x8')](),controller[_0xfaae('0x11')]);router[_0xfaae('0x12')](_0xfaae('0xe'),auth[_0xfaae('0x8')](),controller[_0xfaae('0x13')]);router[_0xfaae('0x12')]('/:id/users',auth[_0xfaae('0x8')](),controller['addAgents']);router[_0xfaae('0x14')](_0xfaae('0xa'),auth[_0xfaae('0x8')](),controller[_0xfaae('0x15')]);router[_0xfaae('0x16')](_0xfaae('0xa'),auth[_0xfaae('0x8')](),controller['destroy']);router['delete'](_0xfaae('0xe'),auth[_0xfaae('0x8')](),controller[_0xfaae('0x17')]);router[_0xfaae('0x16')]('/:id/users',auth[_0xfaae('0x8')](),controller[_0xfaae('0x18')]);module[_0xfaae('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d810169..bed16e8 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 _0x5f63=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5f63,0xa5));var _0x35f6=function(_0x2d5a03,_0x297caa){_0x2d5a03=_0x2d5a03-0x0;var _0x41eba6=_0x5f63[_0x2d5a03];return _0x41eba6;};'use strict';var Sequelize=require(_0x35f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x35f6('0x1')],'unique':_0x35f6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x35f6('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x35f6('0x3')](_0x35f6('0x4'),_0x35f6('0x5'),_0x35f6('0x6'))}}; \ No newline at end of file +var _0xa328=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa328,0x1a3));var _0x8a32=function(_0x2b84c8,_0x183d8e){_0x2b84c8=_0x2b84c8-0x0;var _0x5cea29=_0xa328[_0x2b84c8];return _0x5cea29;};'use strict';var Sequelize=require('sequelize');module[_0x8a32('0x0')]={'name':{'type':Sequelize[_0x8a32('0x1')],'unique':_0x8a32('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a32('0x1')]},'timeout':{'type':Sequelize[_0x8a32('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a32('0x4')](_0x8a32('0x5'),_0x8a32('0x6'),_0x8a32('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1162f73..f4b96f5 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 _0x8136=['merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','describe','getMembers','UserOpenchannelQueue','order','pick','OpenchannelQueueId','User','UserId','openchannelPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','flatMap','sequelize','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelQueues','UserProfileResource','then','end','error','stack','name','send','index','OpenchannelQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter'];(function(_0x56bcf2,_0x466fae){var _0x3cdbe1=function(_0x46c8bb){while(--_0x46c8bb){_0x56bcf2['push'](_0x56bcf2['shift']());}};_0x3cdbe1(++_0x466fae);}(_0x8136,0x16e));var _0x6813=function(_0x4d9915,_0x29f44){_0x4d9915=_0x4d9915-0x0;var _0x295001=_0x8136[_0x4d9915];return _0x295001;};'use strict';var emlformat=require(_0x6813('0x0'));var rimraf=require(_0x6813('0x1'));var zipdir=require(_0x6813('0x2'));var jsonpatch=require(_0x6813('0x3'));var rp=require('request-promise');var moment=require(_0x6813('0x4'));var BPromise=require(_0x6813('0x5'));var Mustache=require(_0x6813('0x6'));var util=require(_0x6813('0x7'));var path=require(_0x6813('0x8'));var sox=require(_0x6813('0x9'));var csv=require(_0x6813('0xa'));var ejs=require(_0x6813('0xb'));var fs=require('fs');var fs_extra=require(_0x6813('0xc'));var _=require(_0x6813('0xd'));var squel=require(_0x6813('0xe'));var crypto=require(_0x6813('0xf'));var jsforce=require(_0x6813('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6813('0xa'));var querystring=require('querystring');var Papa=require(_0x6813('0x11'));var Redis=require('ioredis');var authService=require(_0x6813('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6813('0x13'));var hardwareService=require(_0x6813('0x14'));var logger=require(_0x6813('0x15'))('api');var utils=require(_0x6813('0x16'));var config=require(_0x6813('0x17'));var licenseUtil=require(_0x6813('0x18'));var db=require(_0x6813('0x19'))['db'];config[_0x6813('0x1a')]=_['defaults'](config[_0x6813('0x1a')],{'host':_0x6813('0x1b'),'port':0x18eb});var socket=require(_0x6813('0x1c'))(new Redis(config[_0x6813('0x1a')]));require(_0x6813('0x1d'))[_0x6813('0x1e')](socket);function respondWithStatusCode(_0x48ca4d,_0xa5b617){_0xa5b617=_0xa5b617||0xcc;return function(_0x35a2ec){if(_0x35a2ec){return _0x48ca4d[_0x6813('0x1f')](_0xa5b617);}return _0x48ca4d[_0x6813('0x20')](_0xa5b617)['end']();};}function respondWithResult(_0x246805,_0x41240e){_0x41240e=_0x41240e||0xc8;return function(_0x25e55d){if(_0x25e55d){return _0x246805[_0x6813('0x20')](_0x41240e)[_0x6813('0x21')](_0x25e55d);}};}function respondWithFilteredResult(_0x38790d,_0x1875d7){return function(_0x34b095){if(_0x34b095){var _0x17b398=typeof _0x1875d7[_0x6813('0x22')]==='undefined'&&typeof _0x1875d7['limit']===_0x6813('0x23');var _0x5497ba=_0x34b095[_0x6813('0x24')];var _0x1a537a=_0x17b398?0x0:_0x1875d7['offset'];var _0x3d2e8a=_0x17b398?_0x34b095['count']:_0x1875d7[_0x6813('0x22')]+_0x1875d7['limit'];var _0x52a7bc;if(_0x3d2e8a>=_0x5497ba){_0x3d2e8a=_0x5497ba;_0x52a7bc=0xc8;}else{_0x52a7bc=0xce;}_0x38790d['status'](_0x52a7bc);return _0x38790d[_0x6813('0x25')](_0x6813('0x26'),_0x1a537a+'-'+_0x3d2e8a+'/'+_0x5497ba)[_0x6813('0x21')](_0x34b095);}return null;};}function patchUpdates(_0x50876f){return function(_0xd6315f){try{jsonpatch[_0x6813('0x27')](_0xd6315f,_0x50876f,!![]);}catch(_0x13e78a){return BPromise[_0x6813('0x28')](_0x13e78a);}return _0xd6315f[_0x6813('0x29')]();};}function saveUpdates(_0x134f62,_0x4e8920){return function(_0x210d18){if(_0x210d18){return _0x210d18[_0x6813('0x2a')](_0x134f62)['then'](function(_0x2e10fc){return _0x2e10fc;});}return null;};}function removeEntity(_0x1ed2b1,_0x278218){return function(_0x4af517){if(_0x4af517){return _0x4af517[_0x6813('0x2b')]()['then'](function(){var _0x1a5325=_0x4af517[_0x6813('0x2c')]({'plain':!![]});var _0x4f84e7=_0x6813('0x2d');return db[_0x6813('0x2e')][_0x6813('0x2b')]({'where':{'type':_0x4f84e7,'resourceId':_0x1a5325['id']}})[_0x6813('0x2f')](function(){return _0x4af517;});})[_0x6813('0x2f')](function(){_0x1ed2b1[_0x6813('0x20')](0xcc)[_0x6813('0x30')]();});}};}function handleEntityNotFound(_0x1aaa98,_0x4f2901){return function(_0x28b4e2){if(!_0x28b4e2){_0x1aaa98['sendStatus'](0x194);}return _0x28b4e2;};}function handleError(_0x3449e5,_0x2a0117){_0x2a0117=_0x2a0117||0x1f4;return function(_0x23f4bd){logger[_0x6813('0x31')](_0x23f4bd[_0x6813('0x32')]);if(_0x23f4bd['name']){delete _0x23f4bd[_0x6813('0x33')];}_0x3449e5[_0x6813('0x20')](_0x2a0117)[_0x6813('0x34')](_0x23f4bd);};}exports[_0x6813('0x35')]=function(_0x4f1032,_0x29c108){var _0x125d6e={},_0xf2bbb9={},_0x2ba8e1={'count':0x0,'rows':[]};var _0x3e1a18=_['map'](db[_0x6813('0x36')]['rawAttributes'],function(_0x1d94f1){return{'name':_0x1d94f1[_0x6813('0x37')],'type':_0x1d94f1[_0x6813('0x38')][_0x6813('0x39')]};});_0xf2bbb9[_0x6813('0x3a')]=_['map'](_0x3e1a18,_0x6813('0x33'));_0xf2bbb9[_0x6813('0x3b')]=_[_0x6813('0x3c')](_0x4f1032[_0x6813('0x3b')]);_0xf2bbb9[_0x6813('0x3d')]=_[_0x6813('0x3e')](_0xf2bbb9[_0x6813('0x3a')],_0xf2bbb9['query']);_0x125d6e[_0x6813('0x3f')]=_[_0x6813('0x3e')](_0xf2bbb9[_0x6813('0x3a')],qs[_0x6813('0x40')](_0x4f1032[_0x6813('0x3b')][_0x6813('0x40')]));_0x125d6e['attributes']=_0x125d6e[_0x6813('0x3f')][_0x6813('0x41')]?_0x125d6e['attributes']:_0xf2bbb9[_0x6813('0x3a')];if(!_0x4f1032[_0x6813('0x3b')][_0x6813('0x42')](_0x6813('0x43'))){_0x125d6e[_0x6813('0x44')]=qs[_0x6813('0x44')](_0x4f1032['query'][_0x6813('0x44')]);_0x125d6e[_0x6813('0x22')]=qs[_0x6813('0x22')](_0x4f1032[_0x6813('0x3b')]['offset']);}_0x125d6e['order']=qs[_0x6813('0x45')](_0x4f1032[_0x6813('0x3b')]['sort']);_0x125d6e[_0x6813('0x46')]=qs[_0x6813('0x3d')](_['pick'](_0x4f1032['query'],_0xf2bbb9['filters']),_0x3e1a18);if(_0x4f1032[_0x6813('0x3b')][_0x6813('0x47')]){_0x125d6e[_0x6813('0x46')]=_[_0x6813('0x48')](_0x125d6e[_0x6813('0x46')],{'$or':_[_0x6813('0x49')](_0x3e1a18,function(_0xc4bff1){if(_0xc4bff1[_0x6813('0x38')]!==_0x6813('0x4a')){var _0x53e019={};_0x53e019[_0xc4bff1[_0x6813('0x33')]]={'$like':'%'+_0x4f1032[_0x6813('0x3b')][_0x6813('0x47')]+'%'};return _0x53e019;}})});}_0x125d6e=_['merge']({},_0x125d6e,_0x4f1032[_0x6813('0x4b')]);var _0x801244={'where':_0x125d6e[_0x6813('0x46')]};return db['OpenchannelQueue'][_0x6813('0x24')](_0x801244)[_0x6813('0x2f')](function(_0xdecd37){_0x2ba8e1['count']=_0xdecd37;if(_0x4f1032[_0x6813('0x3b')][_0x6813('0x4c')]){_0x125d6e[_0x6813('0x4d')]=[{'all':!![]}];}return db[_0x6813('0x36')][_0x6813('0x4e')](_0x125d6e);})['then'](function(_0xbf6715){_0x2ba8e1[_0x6813('0x4f')]=_0xbf6715;return _0x2ba8e1;})[_0x6813('0x2f')](respondWithFilteredResult(_0x29c108,_0x125d6e))['catch'](handleError(_0x29c108,null));};exports[_0x6813('0x50')]=function(_0x5ae069,_0x536b1d){var _0x2eb9fd={'raw':!![],'where':{'id':_0x5ae069[_0x6813('0x51')]['id']}},_0x2dae68={};_0x2dae68[_0x6813('0x3a')]=_[_0x6813('0x3c')](db[_0x6813('0x36')][_0x6813('0x52')]);_0x2dae68[_0x6813('0x3b')]=_['keys'](_0x5ae069[_0x6813('0x3b')]);_0x2dae68[_0x6813('0x3d')]=_[_0x6813('0x3e')](_0x2dae68[_0x6813('0x3a')],_0x2dae68[_0x6813('0x3b')]);_0x2eb9fd['attributes']=_[_0x6813('0x3e')](_0x2dae68['model'],qs[_0x6813('0x40')](_0x5ae069[_0x6813('0x3b')][_0x6813('0x40')]));_0x2eb9fd['attributes']=_0x2eb9fd['attributes']['length']?_0x2eb9fd[_0x6813('0x3f')]:_0x2dae68[_0x6813('0x3a')];if(_0x5ae069[_0x6813('0x3b')][_0x6813('0x4c')]){_0x2eb9fd[_0x6813('0x4d')]=[{'all':!![]}];}_0x2eb9fd=_[_0x6813('0x48')]({},_0x2eb9fd,_0x5ae069[_0x6813('0x4b')]);return db[_0x6813('0x36')][_0x6813('0x53')](_0x2eb9fd)[_0x6813('0x2f')](handleEntityNotFound(_0x536b1d,null))[_0x6813('0x2f')](respondWithResult(_0x536b1d,null))['catch'](handleError(_0x536b1d,null));};exports[_0x6813('0x54')]=function(_0x4b0bc2,_0x45dd32){return db[_0x6813('0x36')][_0x6813('0x54')](_0x4b0bc2[_0x6813('0x55')],{})[_0x6813('0x2f')](function(_0x492a19){var _0x597436=_0x4b0bc2['user'][_0x6813('0x2c')]({'plain':!![]});if(!_0x597436)throw new Error(_0x6813('0x56'));if(_0x597436[_0x6813('0x57')]==='user'){var _0x4b90f7=_0x492a19['get']({'plain':!![]});var _0x1cd435=_0x6813('0x2d');return db[_0x6813('0x58')]['find']({'where':{'name':_0x1cd435,'userProfileId':_0x597436['userProfileId']},'raw':!![]})[_0x6813('0x2f')](function(_0x3fea5f){if(_0x3fea5f&&_0x3fea5f[_0x6813('0x59')]===0x0){return db[_0x6813('0x2e')][_0x6813('0x54')]({'name':_0x4b90f7[_0x6813('0x33')],'resourceId':_0x4b90f7['id'],'type':_0x3fea5f[_0x6813('0x33')],'sectionId':_0x3fea5f['id']},{})[_0x6813('0x2f')](function(){return _0x492a19;});}else{return _0x492a19;}})[_0x6813('0x5a')](function(_0x244bc1){logger[_0x6813('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x244bc1);throw _0x244bc1;});}return _0x492a19;})['then'](respondWithResult(_0x45dd32,0xc9))[_0x6813('0x5a')](handleError(_0x45dd32,null));};exports[_0x6813('0x2a')]=function(_0x5983f3,_0x7f9fa8){if(_0x5983f3['body']['id']){delete _0x5983f3[_0x6813('0x55')]['id'];}return db['OpenchannelQueue'][_0x6813('0x53')]({'where':{'id':_0x5983f3[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x7f9fa8,null))['then'](saveUpdates(_0x5983f3['body'],null))['then'](respondWithResult(_0x7f9fa8,null))[_0x6813('0x5a')](handleError(_0x7f9fa8,null));};exports[_0x6813('0x2b')]=function(_0x70d04c,_0x177af1){return db[_0x6813('0x36')]['find']({'where':{'id':_0x70d04c['params']['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x177af1,null))[_0x6813('0x2f')](removeEntity(_0x177af1,null))[_0x6813('0x5a')](handleError(_0x177af1,null));};exports[_0x6813('0x5b')]=function(_0x462fbb,_0x39f63f){return db[_0x6813('0x36')][_0x6813('0x5b')]()[_0x6813('0x2f')](respondWithResult(_0x39f63f,null))[_0x6813('0x5a')](handleError(_0x39f63f,null));};exports[_0x6813('0x5c')]=function(_0x250010,_0xa81d01,_0x224109){var _0x11a879={'raw':!![],'where':{}},_0x25b60d={},_0x2737c0;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x250010['params']['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0xa81d01,null))[_0x6813('0x2f')](function(_0x8cd7e8){if(_0x8cd7e8){_0x2737c0=_0x8cd7e8[_0x6813('0x2c')]({'plain':!![]});_0x25b60d[_0x6813('0x3a')]=_[_0x6813('0x3c')](db[_0x6813('0x5d')][_0x6813('0x52')]);_0x25b60d[_0x6813('0x3b')]=_[_0x6813('0x3c')](_0x250010['query']);_0x25b60d[_0x6813('0x3d')]=_[_0x6813('0x3e')](_0x25b60d[_0x6813('0x3a')],_0x25b60d[_0x6813('0x3b')]);_0x11a879[_0x6813('0x3f')]=_[_0x6813('0x3e')](_0x25b60d[_0x6813('0x3a')],qs[_0x6813('0x40')](_0x250010[_0x6813('0x3b')][_0x6813('0x40')]));_0x11a879[_0x6813('0x3f')]=_0x11a879[_0x6813('0x3f')][_0x6813('0x41')]?_0x11a879[_0x6813('0x3f')]:_0x25b60d[_0x6813('0x3a')];if(!_0x250010[_0x6813('0x3b')][_0x6813('0x42')](_0x6813('0x43'))){_0x11a879['limit']=qs[_0x6813('0x44')](_0x250010[_0x6813('0x3b')][_0x6813('0x44')]);_0x11a879[_0x6813('0x22')]=qs[_0x6813('0x22')](_0x250010[_0x6813('0x3b')][_0x6813('0x22')]);}_0x11a879[_0x6813('0x5e')]=qs[_0x6813('0x45')](_0x250010['query'][_0x6813('0x45')]);_0x11a879[_0x6813('0x46')]=qs['filters'](_[_0x6813('0x5f')](_0x250010['query'],_0x25b60d[_0x6813('0x3d')]));_0x11a879[_0x6813('0x46')][_0x6813('0x60')]=_0x8cd7e8['id'];if(_0x250010[_0x6813('0x3b')][_0x6813('0x47')]){_0x11a879[_0x6813('0x46')]=_[_0x6813('0x48')](_0x11a879[_0x6813('0x46')],{'$or':_[_0x6813('0x49')](_0x11a879[_0x6813('0x3f')],function(_0x2d5262){var _0x5e791f={};_0x5e791f[_0x2d5262]={'$like':'%'+_0x250010[_0x6813('0x3b')][_0x6813('0x47')]+'%'};return _0x5e791f;})});}_0x11a879=_['merge']({},_0x11a879,_0x250010[_0x6813('0x4b')]);return db[_0x6813('0x5d')][_0x6813('0x4e')](_0x11a879);}})['then'](function(_0x388643){if(_0x388643){return db[_0x6813('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x388643,_0x6813('0x62')),'role':'agent'},'attributes':['id',_0x6813('0x33'),_0x6813('0x63'),'updatedAt','createdAt']});}})[_0x6813('0x2f')](function(_0x3a81c5){if(_0x3a81c5){return{'count':_0x3a81c5[_0x6813('0x24')],'rows':_['map'](_0x3a81c5[_0x6813('0x4f')],function(_0x2e1559){return{'membername':_0x2e1559[_0x6813('0x33')],'UserId':_0x2e1559['id'],'queue_name':_0x2737c0['name'],'OpenchannelQueueId':_0x2737c0['id'],'interface':util[_0x6813('0x64')](_0x6813('0x65'),_0x6813('0x66'),_0x2e1559[_0x6813('0x33')]),'penalty':0x0,'paused':_0x2e1559[_0x6813('0x63')],'createdAt':_0x2e1559[_0x6813('0x67')],'updatedAt':_0x2e1559[_0x6813('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6813('0x2f')](respondWithFilteredResult(_0xa81d01,_0x11a879))[_0x6813('0x5a')](handleError(_0xa81d01,null));};exports['getTeams']=function(_0x2dbe23,_0x2b7b69,_0x17a098){var _0x2990c0={};var _0x355dd4={};var _0x40ccc7;var _0x59e253;return db[_0x6813('0x36')]['findOne']({'where':{'id':_0x2dbe23[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x2b7b69,null))[_0x6813('0x2f')](function(_0x3a92de){if(_0x3a92de){_0x40ccc7=_0x3a92de;_0x355dd4['model']=_[_0x6813('0x3c')](db[_0x6813('0x69')][_0x6813('0x52')]);_0x355dd4[_0x6813('0x3b')]=_[_0x6813('0x3c')](_0x2dbe23[_0x6813('0x3b')]);_0x355dd4[_0x6813('0x3d')]=_[_0x6813('0x3e')](_0x355dd4[_0x6813('0x3a')],_0x355dd4[_0x6813('0x3b')]);_0x2990c0[_0x6813('0x3f')]=_[_0x6813('0x3e')](_0x355dd4[_0x6813('0x3a')],qs[_0x6813('0x40')](_0x2dbe23[_0x6813('0x3b')][_0x6813('0x40')]));_0x2990c0[_0x6813('0x3f')]=_0x2990c0[_0x6813('0x3f')][_0x6813('0x41')]?_0x2990c0['attributes']:_0x355dd4[_0x6813('0x3a')];_0x2990c0[_0x6813('0x5e')]=qs[_0x6813('0x45')](_0x2dbe23[_0x6813('0x3b')][_0x6813('0x45')]);_0x2990c0[_0x6813('0x46')]=qs[_0x6813('0x3d')](_[_0x6813('0x5f')](_0x2dbe23['query'],_0x355dd4[_0x6813('0x3d')]));if(_0x2dbe23['query'][_0x6813('0x47')]){_0x2990c0[_0x6813('0x46')]=_[_0x6813('0x48')](_0x2990c0[_0x6813('0x46')],{'$or':_[_0x6813('0x49')](_0x2990c0[_0x6813('0x3f')],function(_0x4110e4){var _0x6a8e18={};_0x6a8e18[_0x4110e4]={'$like':'%'+_0x2dbe23['query'][_0x6813('0x47')]+'%'};return _0x6a8e18;})});}_0x2990c0=_[_0x6813('0x48')]({},_0x2990c0,_0x2dbe23[_0x6813('0x4b')]);return _0x40ccc7[_0x6813('0x6a')](_0x2990c0);}})[_0x6813('0x2f')](function(_0x192cde){if(_0x192cde){_0x59e253=_0x192cde[_0x6813('0x41')];if(!_0x2dbe23[_0x6813('0x3b')][_0x6813('0x42')](_0x6813('0x43'))){_0x2990c0['limit']=qs['limit'](_0x2dbe23['query'][_0x6813('0x44')]);_0x2990c0['offset']=qs[_0x6813('0x22')](_0x2dbe23[_0x6813('0x3b')][_0x6813('0x22')]);}return _0x40ccc7[_0x6813('0x6a')](_0x2990c0);}})[_0x6813('0x2f')](function(_0x4a4a7d){if(_0x4a4a7d){return _0x4a4a7d?{'count':_0x59e253,'rows':_0x4a4a7d}:null;}})['then'](respondWithResult(_0x2b7b69,null))[_0x6813('0x5a')](handleError(_0x2b7b69,null));};exports[_0x6813('0x6b')]=function(_0x419165,_0x5872cf,_0x40d1b1){var _0x2236b2=_0x419165['body'][_0x6813('0x6c')];return db['Team']['findAll']({'where':{'id':_0x2236b2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6813('0x6d'),'attributes':['id',_0x6813('0x33'),'online',_0x6813('0x6e'),'interface'],'raw':!![]}]})[_0x6813('0x2f')](function(_0x48c5c6){if(_0x48c5c6){var _0x110221=_[_0x6813('0x6f')](_0x48c5c6,function(_0x4cb3e1){var _0x1d8d16=_0x4cb3e1[_0x6813('0x2c')]({'plain':!![]});return _0x1d8d16[_0x6813('0x6d')];});return db[_0x6813('0x36')]['find']({'where':{'id':_0x419165['params']['id']}})[_0x6813('0x2f')](function(_0x24409c){return db[_0x6813('0x70')]['transaction'](function(_0xed51ec){return _0x24409c[_0x6813('0x6b')](_0x2236b2,{'transaction':_0xed51ec})['then'](function(){return BPromise[_0x6813('0x71')](_0x110221,function(_0x5b42f7){return db[_0x6813('0x5d')][_0x6813('0x72')]({'where':{'UserId':_0x5b42f7['id'],'OpenchannelQueueId':_0x419165['params']['id']},'transaction':_0xed51ec});});})['then'](function(){_0x110221[_0x6813('0x73')](function(_0x5e84d7){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x5e84d7['id'],'OpenchannelQueueId':_0x24409c['id']});});});});});}})[_0x6813('0x2f')](respondWithStatusCode(_0x5872cf,null))[_0x6813('0x5a')](handleError(_0x5872cf,null));};exports[_0x6813('0x74')]=function(_0x348a5a,_0x4588cb,_0x356c7d){return db[_0x6813('0x69')]['findAll']({'where':{'id':_0x348a5a[_0x6813('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6813('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4588cb,null))[_0x6813('0x2f')](function(_0x2c33a3){var _0x3f0af0=_[_0x6813('0x49')](_0x2c33a3,'id');var _0x593e8b=[];var _0x2a1298=[];var _0x46ce03=squel[_0x6813('0x75')]();_0x46ce03['field'](_0x6813('0x76'))['from'](_0x6813('0x77'),'tq')[_0x6813('0x78')]('user_has_teams','ut',_0x6813('0x79'))[_0x6813('0x46')](_0x6813('0x7a'),_0x348a5a['params']['id']);for(var _0x186d90=0x0;_0x186d90<_0x2c33a3['length'];_0x186d90+=0x1){let _0x5a7542=_0x2c33a3[_0x186d90];for(var _0x50e7fd=0x0;_0x50e7fd<_0x5a7542['Agents'][_0x6813('0x41')];_0x50e7fd+=0x1){let _0x60112a=_0x5a7542['Agents'][_0x50e7fd];var _0x43b2c4=_0x46ce03[_0x6813('0x7b')]();_0x43b2c4[_0x6813('0x46')](_0x6813('0x7c'),_0x60112a['id']);_0x2a1298[_0x6813('0x7d')](db[_0x6813('0x70')][_0x6813('0x3b')](_0x43b2c4[_0x6813('0x7e')](),{'type':db['sequelize'][_0x6813('0x7f')][_0x6813('0x80')]})[_0x6813('0x2f')](function(_0x4b3f7e){if(_0x4b3f7e[_0x6813('0x41')]===0x1){return _0x60112a['id'];}else{var _0x23003c=_['every'](_[_0x6813('0x49')](_0x4b3f7e,_0x6813('0x81')),function(_0x4937ca){return _[_0x6813('0x82')](_0x3f0af0,_0x4937ca);});if(_0x23003c){return _0x60112a['id'];}}}));}}return BPromise[_0x6813('0x83')](_0x2a1298)['then'](function(_0x1abfbb){_0x593e8b=_(_0x593e8b)[_0x6813('0x84')](_0x1abfbb)[_0x6813('0x85')]()[_0x6813('0x86')]();return db[_0x6813('0x36')][_0x6813('0x53')]({'where':{'id':_0x348a5a[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](function(_0xf6a0c){return db['sequelize'][_0x6813('0x87')](function(_0x370c60){return _0xf6a0c['removeTeams'](_0x348a5a['query'][_0x6813('0x6c')],{'transaction':_0x370c60})['then'](function(){if(!_[_0x6813('0x88')](_0x593e8b)){return _0xf6a0c[_0x6813('0x89')](_0x593e8b,{'transaction':_0x370c60});}})[_0x6813('0x2f')](function(){_0x593e8b['forEach'](function(_0x3f3f57){socket[_0x6813('0x8a')](_0x6813('0x8b'),{'UserId':_0x3f3f57,'OpenchannelQueueId':_0xf6a0c['id']});});});});});});})[_0x6813('0x2f')](respondWithStatusCode(_0x4588cb,null))[_0x6813('0x5a')](handleError(_0x4588cb,null));};exports[_0x6813('0x8c')]=function(_0x12e6db,_0x2d7cad,_0x21b7e5){return db[_0x6813('0x36')]['find']({'where':{'id':_0x12e6db[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x2d7cad,null))[_0x6813('0x2f')](function(_0x1a8940){if(_0x1a8940){return _0x1a8940[_0x6813('0x8c')](_0x12e6db[_0x6813('0x55')]['ids'],_['omit'](_0x12e6db[_0x6813('0x55')],[_0x6813('0x6c'),'id'])||{})[_0x6813('0x8d')](function(_0x289a05){for(var _0x348fdd=0x0;_0x348fdd<_0x12e6db[_0x6813('0x55')][_0x6813('0x6c')]['length'];_0x348fdd+=0x1){socket[_0x6813('0x8a')](_0x6813('0x8e'),{'UserId':Number(_0x12e6db[_0x6813('0x55')]['ids'][_0x348fdd]),'OpenchannelQueueId':Number(_0x12e6db[_0x6813('0x51')]['id'])});}return _0x289a05;});}})['then'](respondWithResult(_0x2d7cad,null))[_0x6813('0x5a')](handleError(_0x2d7cad,null));};exports[_0x6813('0x89')]=function(_0x1a2b81,_0x416f64,_0x2fd1cb){return db[_0x6813('0x36')][_0x6813('0x53')]({'where':{'id':_0x1a2b81[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x416f64,null))[_0x6813('0x2f')](function(_0x514ea9){if(_0x514ea9){return _0x514ea9[_0x6813('0x89')](_0x1a2b81['query'][_0x6813('0x6c')])[_0x6813('0x2f')](function(){if(_[_0x6813('0x8f')](_0x1a2b81[_0x6813('0x3b')][_0x6813('0x6c')])){for(var _0x5b1b98=0x0;_0x5b1b98<_0x1a2b81['query'][_0x6813('0x6c')][_0x6813('0x41')];_0x5b1b98+=0x1){socket['emit'](_0x6813('0x8b'),{'UserId':Number(_0x1a2b81[_0x6813('0x3b')]['ids'][_0x5b1b98]),'OpenchannelQueueId':Number(_0x1a2b81[_0x6813('0x51')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x1a2b81[_0x6813('0x3b')][_0x6813('0x6c')]),'OpenchannelQueueId':Number(_0x1a2b81[_0x6813('0x51')]['id'])});}});}})[_0x6813('0x2f')](respondWithStatusCode(_0x416f64,null))['catch'](handleError(_0x416f64,null));};exports[_0x6813('0x90')]=function(_0x463cf1,_0x268422,_0x38153c){var _0x2d7acf={};var _0x3e2670={};var _0x38c200;var _0x3e9533;return db['OpenchannelQueue'][_0x6813('0x91')]({'where':{'id':_0x463cf1[_0x6813('0x51')]['id']}})[_0x6813('0x2f')](handleEntityNotFound(_0x268422,null))[_0x6813('0x2f')](function(_0x2f3de6){if(_0x2f3de6){_0x38c200=_0x2f3de6;_0x3e2670[_0x6813('0x3a')]=_['keys'](db['User'][_0x6813('0x52')]);_0x3e2670[_0x6813('0x3b')]=_['keys'](_0x463cf1[_0x6813('0x3b')]);_0x3e2670[_0x6813('0x3d')]=_[_0x6813('0x3e')](_0x3e2670['model'],_0x3e2670[_0x6813('0x3b')]);_0x2d7acf['attributes']=_[_0x6813('0x3e')](_0x3e2670[_0x6813('0x3a')],qs['fields'](_0x463cf1[_0x6813('0x3b')][_0x6813('0x40')]));_0x2d7acf[_0x6813('0x3f')]=_0x2d7acf[_0x6813('0x3f')][_0x6813('0x41')]?_0x2d7acf[_0x6813('0x3f')]:_0x3e2670[_0x6813('0x3a')];_0x2d7acf[_0x6813('0x5e')]=qs['sort'](_0x463cf1['query'][_0x6813('0x45')]);_0x2d7acf[_0x6813('0x46')]=qs[_0x6813('0x3d')](_[_0x6813('0x5f')](_0x463cf1[_0x6813('0x3b')],_0x3e2670['filters']));if(_0x463cf1['query'][_0x6813('0x47')]){_0x2d7acf[_0x6813('0x46')]=_[_0x6813('0x48')](_0x2d7acf[_0x6813('0x46')],{'$or':_['map'](_0x2d7acf['attributes'],function(_0x491772){var _0x2a5b41={};_0x2a5b41[_0x491772]={'$like':'%'+_0x463cf1[_0x6813('0x3b')][_0x6813('0x47')]+'%'};return _0x2a5b41;})});}_0x2d7acf=_[_0x6813('0x48')]({},_0x2d7acf,_0x463cf1['options']);return _0x38c200['getAgents'](_0x2d7acf);}})[_0x6813('0x2f')](function(_0xb7b5c6){if(_0xb7b5c6){_0x3e9533=_0xb7b5c6['length'];if(!_0x463cf1[_0x6813('0x3b')][_0x6813('0x42')](_0x6813('0x43'))){_0x2d7acf[_0x6813('0x44')]=qs[_0x6813('0x44')](_0x463cf1[_0x6813('0x3b')][_0x6813('0x44')]);_0x2d7acf[_0x6813('0x22')]=qs[_0x6813('0x22')](_0x463cf1[_0x6813('0x3b')][_0x6813('0x22')]);}return _0x38c200[_0x6813('0x90')](_0x2d7acf);}})[_0x6813('0x2f')](function(_0x3e50f7){if(_0x3e50f7){return _0x3e50f7?{'count':_0x3e9533,'rows':_0x3e50f7}:null;}})[_0x6813('0x2f')](respondWithResult(_0x268422,null))[_0x6813('0x5a')](handleError(_0x268422,null));}; \ No newline at end of file +var _0x8f07=['every','includes','all','union','compact','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','status','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','getTeams','body','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x8f07,0x12c));var _0x78f0=function(_0x28e7cf,_0x3db68f){_0x28e7cf=_0x28e7cf-0x0;var _0x1cc771=_0x8f07[_0x28e7cf];return _0x1cc771;};'use strict';var emlformat=require(_0x78f0('0x0'));var rimraf=require(_0x78f0('0x1'));var zipdir=require(_0x78f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78f0('0x3'));var moment=require(_0x78f0('0x4'));var BPromise=require(_0x78f0('0x5'));var Mustache=require(_0x78f0('0x6'));var util=require(_0x78f0('0x7'));var path=require('path');var sox=require(_0x78f0('0x8'));var csv=require(_0x78f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78f0('0xa'));var _=require(_0x78f0('0xb'));var squel=require(_0x78f0('0xc'));var crypto=require(_0x78f0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x78f0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x78f0('0xf'));var Papa=require(_0x78f0('0x10'));var Redis=require('ioredis');var authService=require(_0x78f0('0x11'));var qs=require(_0x78f0('0x12'));var as=require(_0x78f0('0x13'));var hardwareService=require(_0x78f0('0x14'));var logger=require('../../config/logger')(_0x78f0('0x15'));var utils=require('../../config/utils');var config=require(_0x78f0('0x16'));var licenseUtil=require(_0x78f0('0x17'));var db=require(_0x78f0('0x18'))['db'];config['redis']=_[_0x78f0('0x19')](config[_0x78f0('0x1a')],{'host':_0x78f0('0x1b'),'port':0x18eb});var socket=require(_0x78f0('0x1c'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x78f0('0x1d')](socket);function respondWithStatusCode(_0x580278,_0x4af84b){_0x4af84b=_0x4af84b||0xcc;return function(_0x52e0a8){if(_0x52e0a8){return _0x580278[_0x78f0('0x1e')](_0x4af84b);}return _0x580278['status'](_0x4af84b)[_0x78f0('0x1f')]();};}function respondWithResult(_0x5bfaf5,_0x480fce){_0x480fce=_0x480fce||0xc8;return function(_0x650208){if(_0x650208){return _0x5bfaf5['status'](_0x480fce)[_0x78f0('0x20')](_0x650208);}};}function respondWithFilteredResult(_0x468fcc,_0x47349c){return function(_0x66824){if(_0x66824){var _0x1b4830=typeof _0x47349c[_0x78f0('0x21')]===_0x78f0('0x22')&&typeof _0x47349c[_0x78f0('0x23')]==='undefined';var _0x259830=_0x66824['count'];var _0x32ea1f=_0x1b4830?0x0:_0x47349c[_0x78f0('0x21')];var _0x469857=_0x1b4830?_0x66824[_0x78f0('0x24')]:_0x47349c[_0x78f0('0x21')]+_0x47349c[_0x78f0('0x23')];var _0x53bfa4;if(_0x469857>=_0x259830){_0x469857=_0x259830;_0x53bfa4=0xc8;}else{_0x53bfa4=0xce;}_0x468fcc['status'](_0x53bfa4);return _0x468fcc[_0x78f0('0x25')](_0x78f0('0x26'),_0x32ea1f+'-'+_0x469857+'/'+_0x259830)[_0x78f0('0x20')](_0x66824);}return null;};}function patchUpdates(_0x57bf69){return function(_0x7c76ad){try{jsonpatch[_0x78f0('0x27')](_0x7c76ad,_0x57bf69,!![]);}catch(_0x102017){return BPromise[_0x78f0('0x28')](_0x102017);}return _0x7c76ad[_0x78f0('0x29')]();};}function saveUpdates(_0x3d7f92,_0x380ebb){return function(_0x3d8478){if(_0x3d8478){return _0x3d8478[_0x78f0('0x2a')](_0x3d7f92)[_0x78f0('0x2b')](function(_0x283888){return _0x283888;});}return null;};}function removeEntity(_0x21194b,_0x52d06d){return function(_0x3ea42a){if(_0x3ea42a){return _0x3ea42a[_0x78f0('0x2c')]()[_0x78f0('0x2b')](function(){var _0x22d9e5=_0x3ea42a[_0x78f0('0x2d')]({'plain':!![]});var _0x3be9d3=_0x78f0('0x2e');return db[_0x78f0('0x2f')][_0x78f0('0x2c')]({'where':{'type':_0x3be9d3,'resourceId':_0x22d9e5['id']}})['then'](function(){return _0x3ea42a;});})[_0x78f0('0x2b')](function(){_0x21194b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x379189,_0x2d6dce){return function(_0x159732){if(!_0x159732){_0x379189['sendStatus'](0x194);}return _0x159732;};}function handleError(_0x237a52,_0x2ffdb7){_0x2ffdb7=_0x2ffdb7||0x1f4;return function(_0x85f982){logger['error'](_0x85f982[_0x78f0('0x30')]);if(_0x85f982[_0x78f0('0x31')]){delete _0x85f982[_0x78f0('0x31')];}_0x237a52[_0x78f0('0x32')](_0x2ffdb7)[_0x78f0('0x33')](_0x85f982);};}exports[_0x78f0('0x34')]=function(_0x2fb7f1,_0x450005){var _0x159332={},_0x41d6e0={},_0x2ba1ce={'count':0x0,'rows':[]};var _0xa238a3=_[_0x78f0('0x35')](db[_0x78f0('0x36')][_0x78f0('0x37')],function(_0x191524){return{'name':_0x191524[_0x78f0('0x38')],'type':_0x191524[_0x78f0('0x39')][_0x78f0('0x3a')]};});_0x41d6e0[_0x78f0('0x3b')]=_[_0x78f0('0x35')](_0xa238a3,_0x78f0('0x31'));_0x41d6e0[_0x78f0('0x3c')]=_[_0x78f0('0x3d')](_0x2fb7f1[_0x78f0('0x3c')]);_0x41d6e0[_0x78f0('0x3e')]=_[_0x78f0('0x3f')](_0x41d6e0['model'],_0x41d6e0[_0x78f0('0x3c')]);_0x159332[_0x78f0('0x40')]=_['intersection'](_0x41d6e0['model'],qs[_0x78f0('0x41')](_0x2fb7f1[_0x78f0('0x3c')][_0x78f0('0x41')]));_0x159332[_0x78f0('0x40')]=_0x159332[_0x78f0('0x40')][_0x78f0('0x42')]?_0x159332[_0x78f0('0x40')]:_0x41d6e0[_0x78f0('0x3b')];if(!_0x2fb7f1[_0x78f0('0x3c')]['hasOwnProperty'](_0x78f0('0x43'))){_0x159332['limit']=qs[_0x78f0('0x23')](_0x2fb7f1[_0x78f0('0x3c')]['limit']);_0x159332[_0x78f0('0x21')]=qs[_0x78f0('0x21')](_0x2fb7f1[_0x78f0('0x3c')][_0x78f0('0x21')]);}_0x159332[_0x78f0('0x44')]=qs[_0x78f0('0x45')](_0x2fb7f1['query'][_0x78f0('0x45')]);_0x159332[_0x78f0('0x46')]=qs[_0x78f0('0x3e')](_[_0x78f0('0x47')](_0x2fb7f1['query'],_0x41d6e0[_0x78f0('0x3e')]),_0xa238a3);if(_0x2fb7f1['query'][_0x78f0('0x48')]){_0x159332[_0x78f0('0x46')]=_[_0x78f0('0x49')](_0x159332['where'],{'$or':_[_0x78f0('0x35')](_0xa238a3,function(_0xeaa288){if(_0xeaa288['type']!==_0x78f0('0x4a')){var _0x4e97b2={};_0x4e97b2[_0xeaa288[_0x78f0('0x31')]]={'$like':'%'+_0x2fb7f1[_0x78f0('0x3c')][_0x78f0('0x48')]+'%'};return _0x4e97b2;}})});}_0x159332=_['merge']({},_0x159332,_0x2fb7f1['options']);var _0x8f6e61={'where':_0x159332[_0x78f0('0x46')]};return db[_0x78f0('0x36')][_0x78f0('0x24')](_0x8f6e61)['then'](function(_0x30b234){_0x2ba1ce[_0x78f0('0x24')]=_0x30b234;if(_0x2fb7f1[_0x78f0('0x3c')][_0x78f0('0x4b')]){_0x159332[_0x78f0('0x4c')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x78f0('0x4d')](_0x159332);})[_0x78f0('0x2b')](function(_0x2ff1a1){_0x2ba1ce[_0x78f0('0x4e')]=_0x2ff1a1;return _0x2ba1ce;})['then'](respondWithFilteredResult(_0x450005,_0x159332))[_0x78f0('0x4f')](handleError(_0x450005,null));};exports[_0x78f0('0x50')]=function(_0x45a53c,_0x30d96c){var _0x4ed6b8={'raw':!![],'where':{'id':_0x45a53c[_0x78f0('0x51')]['id']}},_0x12dd1c={};_0x12dd1c[_0x78f0('0x3b')]=_[_0x78f0('0x3d')](db['OpenchannelQueue'][_0x78f0('0x37')]);_0x12dd1c[_0x78f0('0x3c')]=_['keys'](_0x45a53c[_0x78f0('0x3c')]);_0x12dd1c[_0x78f0('0x3e')]=_[_0x78f0('0x3f')](_0x12dd1c[_0x78f0('0x3b')],_0x12dd1c[_0x78f0('0x3c')]);_0x4ed6b8[_0x78f0('0x40')]=_[_0x78f0('0x3f')](_0x12dd1c[_0x78f0('0x3b')],qs[_0x78f0('0x41')](_0x45a53c[_0x78f0('0x3c')][_0x78f0('0x41')]));_0x4ed6b8[_0x78f0('0x40')]=_0x4ed6b8[_0x78f0('0x40')][_0x78f0('0x42')]?_0x4ed6b8[_0x78f0('0x40')]:_0x12dd1c[_0x78f0('0x3b')];if(_0x45a53c['query']['includeAll']){_0x4ed6b8[_0x78f0('0x4c')]=[{'all':!![]}];}_0x4ed6b8=_[_0x78f0('0x49')]({},_0x4ed6b8,_0x45a53c[_0x78f0('0x52')]);return db[_0x78f0('0x36')][_0x78f0('0x53')](_0x4ed6b8)[_0x78f0('0x2b')](handleEntityNotFound(_0x30d96c,null))[_0x78f0('0x2b')](respondWithResult(_0x30d96c,null))[_0x78f0('0x4f')](handleError(_0x30d96c,null));};exports['create']=function(_0x15e9a3,_0x40a75c){return db[_0x78f0('0x36')][_0x78f0('0x54')](_0x15e9a3['body'],{})[_0x78f0('0x2b')](function(_0x4c8621){var _0x53456c=_0x15e9a3[_0x78f0('0x55')]['get']({'plain':!![]});if(!_0x53456c)throw new Error(_0x78f0('0x56'));if(_0x53456c['role']===_0x78f0('0x55')){var _0x2aba42=_0x4c8621['get']({'plain':!![]});var _0x3eb8b8='OpenchannelQueues';return db[_0x78f0('0x57')]['find']({'where':{'name':_0x3eb8b8,'userProfileId':_0x53456c[_0x78f0('0x58')]},'raw':!![]})['then'](function(_0x2b8364){if(_0x2b8364&&_0x2b8364[_0x78f0('0x59')]===0x0){return db[_0x78f0('0x2f')][_0x78f0('0x54')]({'name':_0x2aba42[_0x78f0('0x31')],'resourceId':_0x2aba42['id'],'type':_0x2b8364['name'],'sectionId':_0x2b8364['id']},{})[_0x78f0('0x2b')](function(){return _0x4c8621;});}else{return _0x4c8621;}})['catch'](function(_0x4a6696){logger[_0x78f0('0x5a')](_0x78f0('0x5b'),_0x4a6696);throw _0x4a6696;});}return _0x4c8621;})[_0x78f0('0x2b')](respondWithResult(_0x40a75c,0xc9))['catch'](handleError(_0x40a75c,null));};exports[_0x78f0('0x2a')]=function(_0x506023,_0x91a739){if(_0x506023['body']['id']){delete _0x506023['body']['id'];}return db[_0x78f0('0x36')][_0x78f0('0x53')]({'where':{'id':_0x506023[_0x78f0('0x51')]['id']}})['then'](handleEntityNotFound(_0x91a739,null))[_0x78f0('0x2b')](saveUpdates(_0x506023['body'],null))['then'](respondWithResult(_0x91a739,null))[_0x78f0('0x4f')](handleError(_0x91a739,null));};exports[_0x78f0('0x2c')]=function(_0x290635,_0x5aec9b){return db[_0x78f0('0x36')]['find']({'where':{'id':_0x290635[_0x78f0('0x51')]['id']}})[_0x78f0('0x2b')](handleEntityNotFound(_0x5aec9b,null))[_0x78f0('0x2b')](removeEntity(_0x5aec9b,null))[_0x78f0('0x4f')](handleError(_0x5aec9b,null));};exports[_0x78f0('0x5c')]=function(_0x1e27db,_0x5ded10){return db['OpenchannelQueue']['describe']()[_0x78f0('0x2b')](respondWithResult(_0x5ded10,null))[_0x78f0('0x4f')](handleError(_0x5ded10,null));};exports[_0x78f0('0x5d')]=function(_0x531798,_0x1dceba,_0x1c11f5){var _0x53382b={'raw':!![],'where':{}},_0xdb1b9b={},_0x14ad5d;return db[_0x78f0('0x36')][_0x78f0('0x5e')]({'where':{'id':_0x531798['params']['id']}})[_0x78f0('0x2b')](handleEntityNotFound(_0x1dceba,null))[_0x78f0('0x2b')](function(_0x4aa6b0){if(_0x4aa6b0){_0x14ad5d=_0x4aa6b0[_0x78f0('0x2d')]({'plain':!![]});_0xdb1b9b['model']=_[_0x78f0('0x3d')](db[_0x78f0('0x5f')][_0x78f0('0x37')]);_0xdb1b9b[_0x78f0('0x3c')]=_[_0x78f0('0x3d')](_0x531798['query']);_0xdb1b9b[_0x78f0('0x3e')]=_[_0x78f0('0x3f')](_0xdb1b9b['model'],_0xdb1b9b[_0x78f0('0x3c')]);_0x53382b[_0x78f0('0x40')]=_[_0x78f0('0x3f')](_0xdb1b9b[_0x78f0('0x3b')],qs[_0x78f0('0x41')](_0x531798[_0x78f0('0x3c')][_0x78f0('0x41')]));_0x53382b['attributes']=_0x53382b[_0x78f0('0x40')][_0x78f0('0x42')]?_0x53382b[_0x78f0('0x40')]:_0xdb1b9b[_0x78f0('0x3b')];if(!_0x531798[_0x78f0('0x3c')][_0x78f0('0x60')](_0x78f0('0x43'))){_0x53382b[_0x78f0('0x23')]=qs[_0x78f0('0x23')](_0x531798[_0x78f0('0x3c')][_0x78f0('0x23')]);_0x53382b[_0x78f0('0x21')]=qs[_0x78f0('0x21')](_0x531798['query'][_0x78f0('0x21')]);}_0x53382b[_0x78f0('0x44')]=qs[_0x78f0('0x45')](_0x531798[_0x78f0('0x3c')][_0x78f0('0x45')]);_0x53382b[_0x78f0('0x46')]=qs['filters'](_[_0x78f0('0x47')](_0x531798['query'],_0xdb1b9b[_0x78f0('0x3e')]));_0x53382b[_0x78f0('0x46')][_0x78f0('0x61')]=_0x4aa6b0['id'];if(_0x531798[_0x78f0('0x3c')][_0x78f0('0x48')]){_0x53382b[_0x78f0('0x46')]=_['merge'](_0x53382b[_0x78f0('0x46')],{'$or':_[_0x78f0('0x35')](_0x53382b[_0x78f0('0x40')],function(_0x253c64){var _0x4d8ef5={};_0x4d8ef5[_0x253c64]={'$like':'%'+_0x531798[_0x78f0('0x3c')][_0x78f0('0x48')]+'%'};return _0x4d8ef5;})});}_0x53382b=_['merge']({},_0x53382b,_0x531798[_0x78f0('0x52')]);return db[_0x78f0('0x5f')][_0x78f0('0x4d')](_0x53382b);}})[_0x78f0('0x2b')](function(_0x3c2c92){if(_0x3c2c92){return db['User'][_0x78f0('0x62')]({'where':{'id':_['map'](_0x3c2c92,_0x78f0('0x63')),'role':'agent'},'attributes':['id',_0x78f0('0x31'),_0x78f0('0x64'),_0x78f0('0x65'),_0x78f0('0x66')]});}})[_0x78f0('0x2b')](function(_0x73bc7d){if(_0x73bc7d){return{'count':_0x73bc7d['count'],'rows':_[_0x78f0('0x35')](_0x73bc7d[_0x78f0('0x4e')],function(_0x3e1de3){return{'membername':_0x3e1de3[_0x78f0('0x31')],'UserId':_0x3e1de3['id'],'queue_name':_0x14ad5d[_0x78f0('0x31')],'OpenchannelQueueId':_0x14ad5d['id'],'interface':util['format']('%s/%s','SIP',_0x3e1de3[_0x78f0('0x31')]),'penalty':0x0,'paused':_0x3e1de3[_0x78f0('0x64')],'createdAt':_0x3e1de3['createdAt'],'updatedAt':_0x3e1de3[_0x78f0('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x78f0('0x2b')](respondWithFilteredResult(_0x1dceba,_0x53382b))[_0x78f0('0x4f')](handleError(_0x1dceba,null));};exports[_0x78f0('0x67')]=function(_0x11266a,_0x2ce2b1,_0x9059d3){var _0x20d123={};var _0x225858={};var _0x45192f;var _0x5996cc;return db['OpenchannelQueue'][_0x78f0('0x5e')]({'where':{'id':_0x11266a[_0x78f0('0x51')]['id']}})[_0x78f0('0x2b')](handleEntityNotFound(_0x2ce2b1,null))[_0x78f0('0x2b')](function(_0x270746){if(_0x270746){_0x45192f=_0x270746;_0x225858[_0x78f0('0x3b')]=_[_0x78f0('0x3d')](db['Team'][_0x78f0('0x37')]);_0x225858['query']=_['keys'](_0x11266a['query']);_0x225858[_0x78f0('0x3e')]=_['intersection'](_0x225858[_0x78f0('0x3b')],_0x225858[_0x78f0('0x3c')]);_0x20d123[_0x78f0('0x40')]=_['intersection'](_0x225858[_0x78f0('0x3b')],qs[_0x78f0('0x41')](_0x11266a['query'][_0x78f0('0x41')]));_0x20d123[_0x78f0('0x40')]=_0x20d123[_0x78f0('0x40')]['length']?_0x20d123['attributes']:_0x225858['model'];_0x20d123[_0x78f0('0x44')]=qs[_0x78f0('0x45')](_0x11266a[_0x78f0('0x3c')][_0x78f0('0x45')]);_0x20d123[_0x78f0('0x46')]=qs[_0x78f0('0x3e')](_[_0x78f0('0x47')](_0x11266a[_0x78f0('0x3c')],_0x225858['filters']));if(_0x11266a['query'][_0x78f0('0x48')]){_0x20d123[_0x78f0('0x46')]=_['merge'](_0x20d123['where'],{'$or':_[_0x78f0('0x35')](_0x20d123[_0x78f0('0x40')],function(_0x5831d8){var _0x29eb38={};_0x29eb38[_0x5831d8]={'$like':'%'+_0x11266a['query'][_0x78f0('0x48')]+'%'};return _0x29eb38;})});}_0x20d123=_[_0x78f0('0x49')]({},_0x20d123,_0x11266a['options']);return _0x45192f[_0x78f0('0x67')](_0x20d123);}})[_0x78f0('0x2b')](function(_0x4b0c1){if(_0x4b0c1){_0x5996cc=_0x4b0c1[_0x78f0('0x42')];if(!_0x11266a['query']['hasOwnProperty'](_0x78f0('0x43'))){_0x20d123[_0x78f0('0x23')]=qs['limit'](_0x11266a[_0x78f0('0x3c')][_0x78f0('0x23')]);_0x20d123['offset']=qs['offset'](_0x11266a[_0x78f0('0x3c')]['offset']);}return _0x45192f[_0x78f0('0x67')](_0x20d123);}})[_0x78f0('0x2b')](function(_0x40dfcb){if(_0x40dfcb){return _0x40dfcb?{'count':_0x5996cc,'rows':_0x40dfcb}:null;}})['then'](respondWithResult(_0x2ce2b1,null))['catch'](handleError(_0x2ce2b1,null));};exports['addTeams']=function(_0x44ad6a,_0x2cd786,_0x494f2f){var _0x595792=_0x44ad6a[_0x78f0('0x68')]['ids'];return db[_0x78f0('0x69')][_0x78f0('0x4d')]({'where':{'id':_0x595792},'attributes':['id'],'include':[{'model':db[_0x78f0('0x6a')],'as':_0x78f0('0x6b'),'attributes':['id','name',_0x78f0('0x6c'),_0x78f0('0x6d'),_0x78f0('0x6e')],'raw':!![]}]})[_0x78f0('0x2b')](function(_0x520c4b){if(_0x520c4b){var _0x25ae2a=_[_0x78f0('0x6f')](_0x520c4b,function(_0x372a0f){var _0x5d4a7d=_0x372a0f[_0x78f0('0x2d')]({'plain':!![]});return _0x5d4a7d[_0x78f0('0x6b')];});return db[_0x78f0('0x36')][_0x78f0('0x53')]({'where':{'id':_0x44ad6a[_0x78f0('0x51')]['id']}})[_0x78f0('0x2b')](function(_0x2f7ae5){return db[_0x78f0('0x70')][_0x78f0('0x71')](function(_0x549916){return _0x2f7ae5[_0x78f0('0x72')](_0x595792,{'transaction':_0x549916})['then'](function(){return BPromise['each'](_0x25ae2a,function(_0x771f85){return db[_0x78f0('0x5f')]['findOrCreate']({'where':{'UserId':_0x771f85['id'],'OpenchannelQueueId':_0x44ad6a[_0x78f0('0x51')]['id']},'transaction':_0x549916});});})[_0x78f0('0x2b')](function(){_0x25ae2a[_0x78f0('0x73')](function(_0x52d33c){socket[_0x78f0('0x74')](_0x78f0('0x75'),{'UserId':_0x52d33c['id'],'OpenchannelQueueId':_0x2f7ae5['id']});});});});});}})[_0x78f0('0x2b')](respondWithStatusCode(_0x2cd786,null))['catch'](handleError(_0x2cd786,null));};exports[_0x78f0('0x76')]=function(_0x228b3d,_0x5ed8ed,_0x1889e9){return db[_0x78f0('0x69')][_0x78f0('0x4d')]({'where':{'id':_0x228b3d[_0x78f0('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x78f0('0x6a')],'as':_0x78f0('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x78f0('0x2b')](handleEntityNotFound(_0x5ed8ed,null))['then'](function(_0x41216e){var _0x2a0194=_[_0x78f0('0x35')](_0x41216e,'id');var _0x3f04a1=[];var _0x1db672=[];var _0x259be6=squel['select']();_0x259be6[_0x78f0('0x77')](_0x78f0('0x78'))[_0x78f0('0x79')](_0x78f0('0x7a'),'tq')[_0x78f0('0x7b')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('OpenchannelQueueId\x20=\x20?',_0x228b3d[_0x78f0('0x51')]['id']);for(var _0x16913b=0x0;_0x16913b<_0x41216e[_0x78f0('0x42')];_0x16913b+=0x1){let _0x46cc03=_0x41216e[_0x16913b];for(var _0x391677=0x0;_0x391677<_0x46cc03[_0x78f0('0x6b')][_0x78f0('0x42')];_0x391677+=0x1){let _0x11613a=_0x46cc03[_0x78f0('0x6b')][_0x391677];var _0x9f1957=_0x259be6[_0x78f0('0x7c')]();_0x9f1957[_0x78f0('0x46')](_0x78f0('0x7d'),_0x11613a['id']);_0x1db672[_0x78f0('0x7e')](db[_0x78f0('0x70')][_0x78f0('0x3c')](_0x9f1957[_0x78f0('0x7f')](),{'type':db['sequelize'][_0x78f0('0x80')]['SELECT']})[_0x78f0('0x2b')](function(_0x506585){if(_0x506585['length']===0x1){return _0x11613a['id'];}else{var _0x5a2ecd=_[_0x78f0('0x81')](_[_0x78f0('0x35')](_0x506585,'TeamId'),function(_0x49d559){return _[_0x78f0('0x82')](_0x2a0194,_0x49d559);});if(_0x5a2ecd){return _0x11613a['id'];}}}));}}return BPromise[_0x78f0('0x83')](_0x1db672)['then'](function(_0x54a7f1){_0x3f04a1=_(_0x3f04a1)[_0x78f0('0x84')](_0x54a7f1)[_0x78f0('0x85')]()[_0x78f0('0x86')]();return db[_0x78f0('0x36')][_0x78f0('0x53')]({'where':{'id':_0x228b3d[_0x78f0('0x51')]['id']}})[_0x78f0('0x2b')](function(_0x8ee593){return db['sequelize'][_0x78f0('0x71')](function(_0x32233b){return _0x8ee593[_0x78f0('0x76')](_0x228b3d[_0x78f0('0x3c')][_0x78f0('0x87')],{'transaction':_0x32233b})[_0x78f0('0x2b')](function(){if(!_[_0x78f0('0x88')](_0x3f04a1)){return _0x8ee593[_0x78f0('0x89')](_0x3f04a1,{'transaction':_0x32233b});}})['then'](function(){_0x3f04a1[_0x78f0('0x73')](function(_0x1f526f){socket[_0x78f0('0x74')](_0x78f0('0x8a'),{'UserId':_0x1f526f,'OpenchannelQueueId':_0x8ee593['id']});});});});});});})[_0x78f0('0x2b')](respondWithStatusCode(_0x5ed8ed,null))['catch'](handleError(_0x5ed8ed,null));};exports[_0x78f0('0x8b')]=function(_0x34b8df,_0x5f0e7f,_0x4300a5){return db[_0x78f0('0x36')][_0x78f0('0x53')]({'where':{'id':_0x34b8df['params']['id']}})[_0x78f0('0x2b')](handleEntityNotFound(_0x5f0e7f,null))[_0x78f0('0x2b')](function(_0x1bf29d){if(_0x1bf29d){return _0x1bf29d[_0x78f0('0x8b')](_0x34b8df['body'][_0x78f0('0x87')],_[_0x78f0('0x8c')](_0x34b8df[_0x78f0('0x68')],[_0x78f0('0x87'),'id'])||{})['spread'](function(_0xf8ea19){for(var _0x460eb6=0x0;_0x460eb6<_0x34b8df[_0x78f0('0x68')][_0x78f0('0x87')][_0x78f0('0x42')];_0x460eb6+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x34b8df[_0x78f0('0x68')]['ids'][_0x460eb6]),'OpenchannelQueueId':Number(_0x34b8df['params']['id'])});}return _0xf8ea19;});}})[_0x78f0('0x2b')](respondWithResult(_0x5f0e7f,null))[_0x78f0('0x4f')](handleError(_0x5f0e7f,null));};exports['removeAgents']=function(_0x2caf79,_0x580ba1,_0x40ed00){return db[_0x78f0('0x36')][_0x78f0('0x53')]({'where':{'id':_0x2caf79[_0x78f0('0x51')]['id']}})['then'](handleEntityNotFound(_0x580ba1,null))[_0x78f0('0x2b')](function(_0x2c688a){if(_0x2c688a){return _0x2c688a[_0x78f0('0x89')](_0x2caf79[_0x78f0('0x3c')]['ids'])['then'](function(){if(_[_0x78f0('0x8d')](_0x2caf79[_0x78f0('0x3c')][_0x78f0('0x87')])){for(var _0x1af02c=0x0;_0x1af02c<_0x2caf79[_0x78f0('0x3c')][_0x78f0('0x87')][_0x78f0('0x42')];_0x1af02c+=0x1){socket[_0x78f0('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2caf79[_0x78f0('0x3c')][_0x78f0('0x87')][_0x1af02c]),'OpenchannelQueueId':Number(_0x2caf79[_0x78f0('0x51')]['id'])});}}else{socket[_0x78f0('0x74')](_0x78f0('0x8a'),{'UserId':Number(_0x2caf79['query'][_0x78f0('0x87')]),'OpenchannelQueueId':Number(_0x2caf79[_0x78f0('0x51')]['id'])});}});}})[_0x78f0('0x2b')](respondWithStatusCode(_0x580ba1,null))[_0x78f0('0x4f')](handleError(_0x580ba1,null));};exports[_0x78f0('0x8e')]=function(_0x49fd6f,_0x106205,_0x37db2c){var _0x43785f={};var _0x3957c2={};var _0x4d7fed;var _0x29c3b8;return db[_0x78f0('0x36')][_0x78f0('0x5e')]({'where':{'id':_0x49fd6f['params']['id']}})[_0x78f0('0x2b')](handleEntityNotFound(_0x106205,null))['then'](function(_0x13f2a1){if(_0x13f2a1){_0x4d7fed=_0x13f2a1;_0x3957c2[_0x78f0('0x3b')]=_[_0x78f0('0x3d')](db['User']['rawAttributes']);_0x3957c2[_0x78f0('0x3c')]=_[_0x78f0('0x3d')](_0x49fd6f['query']);_0x3957c2[_0x78f0('0x3e')]=_[_0x78f0('0x3f')](_0x3957c2[_0x78f0('0x3b')],_0x3957c2[_0x78f0('0x3c')]);_0x43785f[_0x78f0('0x40')]=_[_0x78f0('0x3f')](_0x3957c2['model'],qs[_0x78f0('0x41')](_0x49fd6f[_0x78f0('0x3c')][_0x78f0('0x41')]));_0x43785f[_0x78f0('0x40')]=_0x43785f[_0x78f0('0x40')][_0x78f0('0x42')]?_0x43785f[_0x78f0('0x40')]:_0x3957c2[_0x78f0('0x3b')];_0x43785f[_0x78f0('0x44')]=qs[_0x78f0('0x45')](_0x49fd6f[_0x78f0('0x3c')][_0x78f0('0x45')]);_0x43785f[_0x78f0('0x46')]=qs[_0x78f0('0x3e')](_[_0x78f0('0x47')](_0x49fd6f[_0x78f0('0x3c')],_0x3957c2[_0x78f0('0x3e')]));if(_0x49fd6f[_0x78f0('0x3c')][_0x78f0('0x48')]){_0x43785f[_0x78f0('0x46')]=_[_0x78f0('0x49')](_0x43785f[_0x78f0('0x46')],{'$or':_[_0x78f0('0x35')](_0x43785f[_0x78f0('0x40')],function(_0x54610f){var _0x5627d8={};_0x5627d8[_0x54610f]={'$like':'%'+_0x49fd6f['query'][_0x78f0('0x48')]+'%'};return _0x5627d8;})});}_0x43785f=_[_0x78f0('0x49')]({},_0x43785f,_0x49fd6f[_0x78f0('0x52')]);return _0x4d7fed[_0x78f0('0x8e')](_0x43785f);}})[_0x78f0('0x2b')](function(_0x4209d2){if(_0x4209d2){_0x29c3b8=_0x4209d2['length'];if(!_0x49fd6f[_0x78f0('0x3c')][_0x78f0('0x60')](_0x78f0('0x43'))){_0x43785f[_0x78f0('0x23')]=qs['limit'](_0x49fd6f[_0x78f0('0x3c')][_0x78f0('0x23')]);_0x43785f[_0x78f0('0x21')]=qs[_0x78f0('0x21')](_0x49fd6f[_0x78f0('0x3c')]['offset']);}return _0x4d7fed[_0x78f0('0x8e')](_0x43785f);}})[_0x78f0('0x2b')](function(_0x4f6e45){if(_0x4f6e45){return _0x4f6e45?{'count':_0x29c3b8,'rows':_0x4f6e45}:null;}})[_0x78f0('0x2b')](respondWithResult(_0x106205,null))[_0x78f0('0x4f')](handleError(_0x106205,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7ab9184..49880f5 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 _0xc83e=['OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4b06b3,_0x490dab){var _0x397490=function(_0x318e86){while(--_0x318e86){_0x4b06b3['push'](_0x4b06b3['shift']());}};_0x397490(++_0x490dab);}(_0xc83e,0x139));var _0xec83=function(_0x536c1d,_0x4bac2d){_0x536c1d=_0x536c1d-0x0;var _0x399e88=_0xc83e[_0x536c1d];return _0x399e88;};'use strict';var EventEmitter=require(_0xec83('0x0'));var OpenchannelQueue=require(_0xec83('0x1'))['db'][_0xec83('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xec83('0x3')](0x0);var events={'afterCreate':_0xec83('0x4'),'afterUpdate':'update','afterDestroy':_0xec83('0x5')};function emitEvent(_0x31c5dd){return function(_0x12261a,_0x2bb365,_0x4d3941){OpenchannelQueueEvents[_0xec83('0x6')](_0x31c5dd+':'+_0x12261a['id'],_0x12261a);OpenchannelQueueEvents[_0xec83('0x6')](_0x31c5dd,_0x12261a);_0x4d3941(null);};}for(var e in events){if(events[_0xec83('0x7')](e)){var event=events[e];OpenchannelQueue[_0xec83('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xcd26=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x17362f,_0x53b35c){var _0x56da5a=function(_0x51a8f5){while(--_0x51a8f5){_0x17362f['push'](_0x17362f['shift']());}};_0x56da5a(++_0x53b35c);}(_0xcd26,0xbd));var _0x6cd2=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xcd26[_0xae7c2f];return _0x5d7001;};'use strict';var EventEmitter=require(_0x6cd2('0x0'));var OpenchannelQueue=require(_0x6cd2('0x1'))['db'][_0x6cd2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6cd2('0x3')](0x0);var events={'afterCreate':_0x6cd2('0x4'),'afterUpdate':_0x6cd2('0x5'),'afterDestroy':'remove'};function emitEvent(_0xf66c06){return function(_0x33026a,_0xeba41f,_0x2de19f){OpenchannelQueueEvents[_0x6cd2('0x6')](_0xf66c06+':'+_0x33026a['id'],_0x33026a);OpenchannelQueueEvents[_0x6cd2('0x6')](_0xf66c06,_0x33026a);_0x2de19f(null);};}for(var e in events){if(events[_0x6cd2('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x6cd2('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 f82d6f4..779f8f0 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 _0x01a2=['OpenchannelQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x1eb3f6,_0x3f8dc7){var _0x511f68=function(_0x33d351){while(--_0x33d351){_0x1eb3f6['push'](_0x1eb3f6['shift']());}};_0x511f68(++_0x3f8dc7);}(_0x01a2,0x194));var _0x201a=function(_0x2214d2,_0x313c41){_0x2214d2=_0x2214d2-0x0;var _0x3cfc67=_0x01a2[_0x2214d2];return _0x3cfc67;};'use strict';var _=require(_0x201a('0x0'));var util=require(_0x201a('0x1'));var logger=require('../../config/logger')(_0x201a('0x2'));var moment=require(_0x201a('0x3'));var BPromise=require(_0x201a('0x4'));var rp=require(_0x201a('0x5'));var fs=require('fs');var path=require(_0x201a('0x6'));var rimraf=require(_0x201a('0x7'));var config=require(_0x201a('0x8'));var attributes=require(_0x201a('0x9'));module[_0x201a('0xa')]=function(_0x1b9531,_0x918622){return _0x1b9531[_0x201a('0xb')](_0x201a('0xc'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85f7=['define','openchannel_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x85f7,0x7a));var _0x785f=function(_0x44952b,_0x4f088a){_0x44952b=_0x44952b-0x0;var _0x52f2e4=_0x85f7[_0x44952b];return _0x52f2e4;};'use strict';var _=require('lodash');var util=require(_0x785f('0x0'));var logger=require(_0x785f('0x1'))(_0x785f('0x2'));var moment=require(_0x785f('0x3'));var BPromise=require(_0x785f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x785f('0x5'));var rimraf=require(_0x785f('0x6'));var config=require(_0x785f('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0xb922ee,_0x1ae3c8){return _0xb922ee[_0x785f('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x785f('0x9'),'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 f82cb74..cf3b6e5 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 _0x3c8f=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowOpenchannelQueue','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x4d78b2,_0xd1de4){var _0x37396d=function(_0x1f3778){while(--_0x1f3778){_0x4d78b2['push'](_0x4d78b2['shift']());}};_0x37396d(++_0xd1de4);}(_0x3c8f,0xeb));var _0xf3c8=function(_0x10e6f1,_0x58617d){_0x10e6f1=_0x10e6f1-0x0;var _0x28561f=_0x3c8f[_0x10e6f1];return _0x28561f;};'use strict';var _=require('lodash');var util=require(_0xf3c8('0x0'));var moment=require(_0xf3c8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf3c8('0x2'));var fs=require('fs');var Redis=require(_0xf3c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3c8('0x4'));var logger=require('../../config/logger')(_0xf3c8('0x5'));var config=require(_0xf3c8('0x6'));var jayson=require(_0xf3c8('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf3c8('0x8')]=_[_0xf3c8('0x9')](config['redis'],{'host':_0xf3c8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3c8('0x8')]));require(_0xf3c8('0xb'))[_0xf3c8('0xc')](socket);function respondWithRpcPromise(_0x1f25ae,_0x5ce292,_0x36ccfc){return new BPromise(function(_0x41109d,_0x50c1a6){return client[_0xf3c8('0xd')](_0x1f25ae,_0x36ccfc)[_0xf3c8('0xe')](function(_0x258eb9){logger[_0xf3c8('0xf')](_0xf3c8('0x10'),_0x5ce292,_0xf3c8('0x11'));logger[_0xf3c8('0x12')](_0xf3c8('0x13'),_0x5ce292,_0xf3c8('0x11'),JSON['stringify'](_0x258eb9));if(_0x258eb9[_0xf3c8('0x14')]){if(_0x258eb9[_0xf3c8('0x14')]['code']===0x1f4){logger[_0xf3c8('0x14')](_0xf3c8('0x10'),_0x5ce292,_0x258eb9[_0xf3c8('0x14')][_0xf3c8('0x15')]);return _0x50c1a6(_0x258eb9[_0xf3c8('0x14')][_0xf3c8('0x15')]);}logger[_0xf3c8('0x14')](_0xf3c8('0x10'),_0x5ce292,_0x258eb9[_0xf3c8('0x14')][_0xf3c8('0x15')]);return _0x41109d(_0x258eb9[_0xf3c8('0x14')][_0xf3c8('0x15')]);}else{logger['info'](_0xf3c8('0x10'),_0x5ce292,_0xf3c8('0x11'));_0x41109d(_0x258eb9['result'][_0xf3c8('0x15')]);}})['catch'](function(_0x1a505d){logger[_0xf3c8('0x14')](_0xf3c8('0x10'),_0x5ce292,_0x1a505d);_0x50c1a6(_0x1a505d);});});}exports[_0xf3c8('0x16')]=function(_0x54f1fc){var _0x162f8f=this;return new Promise(function(_0x2fc71b,_0x1c3105){return db[_0xf3c8('0x17')][_0xf3c8('0x18')]({'raw':_0x54f1fc[_0xf3c8('0x19')]?_0x54f1fc[_0xf3c8('0x19')][_0xf3c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x54f1fc[_0xf3c8('0x19')]?_0x54f1fc['options'][_0xf3c8('0x1b')]||null:null,'attributes':_0x54f1fc[_0xf3c8('0x19')]?_0x54f1fc[_0xf3c8('0x19')][_0xf3c8('0x1c')]||null:null,'limit':_0x54f1fc[_0xf3c8('0x19')]?_0x54f1fc['options'][_0xf3c8('0x1d')]||null:null,'include':_0x54f1fc[_0xf3c8('0x19')]?_0x54f1fc[_0xf3c8('0x19')][_0xf3c8('0x1e')]?_[_0xf3c8('0x1f')](_0x54f1fc[_0xf3c8('0x19')]['include'],function(_0x5975c1){return{'model':db[_0x5975c1[_0xf3c8('0x20')]],'as':_0x5975c1['as'],'attributes':_0x5975c1[_0xf3c8('0x1c')],'include':_0x5975c1['include']?_['map'](_0x5975c1[_0xf3c8('0x1e')],function(_0x3cb00e){return{'model':db[_0x3cb00e['model']],'as':_0x3cb00e['as'],'attributes':_0x3cb00e[_0xf3c8('0x1c')],'include':_0x3cb00e[_0xf3c8('0x1e')]?_[_0xf3c8('0x1f')](_0x3cb00e[_0xf3c8('0x1e')],function(_0x177d5c){return{'model':db[_0x177d5c[_0xf3c8('0x20')]],'as':_0x177d5c['as'],'attributes':_0x177d5c[_0xf3c8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf3c8('0xe')](function(_0x4f630e){logger['info'](_0xf3c8('0x16'),_0x54f1fc);logger[_0xf3c8('0x12')](_0xf3c8('0x16'),_0x54f1fc,JSON[_0xf3c8('0x21')](_0x4f630e));_0x2fc71b(_0x4f630e);})[_0xf3c8('0x22')](function(_0x30bf51){logger[_0xf3c8('0x14')](_0xf3c8('0x16'),_0x30bf51[_0xf3c8('0x15')],_0x54f1fc);_0x1c3105(_0x162f8f['error'](0x1f4,_0x30bf51[_0xf3c8('0x15')]));});});};exports[_0xf3c8('0x23')]=function(_0x2d00a9){var _0x4f3610=this;return new Promise(function(_0x4dfc8b,_0x8dbdb6){return db['OpenchannelQueue']['find']({'raw':_0x2d00a9[_0xf3c8('0x19')]?_0x2d00a9[_0xf3c8('0x19')][_0xf3c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d00a9['options']?_0x2d00a9['options'][_0xf3c8('0x1b')]||null:null,'attributes':_0x2d00a9['options']?_0x2d00a9[_0xf3c8('0x19')][_0xf3c8('0x1c')]||null:null,'include':_0x2d00a9[_0xf3c8('0x19')]?_0x2d00a9['options']['include']?_['map'](_0x2d00a9['options']['include'],function(_0x390665){return{'model':db[_0x390665['model']],'as':_0x390665['as'],'attributes':_0x390665['attributes'],'include':_0x390665[_0xf3c8('0x1e')]?_[_0xf3c8('0x1f')](_0x390665['include'],function(_0x47e9e3){return{'model':db[_0x47e9e3[_0xf3c8('0x20')]],'as':_0x47e9e3['as'],'attributes':_0x47e9e3[_0xf3c8('0x1c')],'include':_0x47e9e3['include']?_[_0xf3c8('0x1f')](_0x47e9e3['include'],function(_0x2dd6f9){return{'model':db[_0x2dd6f9[_0xf3c8('0x20')]],'as':_0x2dd6f9['as'],'attributes':_0x2dd6f9[_0xf3c8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf3c8('0xe')](function(_0xce14fa){logger[_0xf3c8('0xf')]('ShowOpenchannelQueue',_0x2d00a9);logger[_0xf3c8('0x12')]('ShowOpenchannelQueue',_0x2d00a9,JSON[_0xf3c8('0x21')](_0xce14fa));_0x4dfc8b(_0xce14fa);})[_0xf3c8('0x22')](function(_0x563dd5){logger[_0xf3c8('0x14')](_0xf3c8('0x23'),_0x563dd5[_0xf3c8('0x15')],_0x2d00a9);_0x8dbdb6(_0x4f3610[_0xf3c8('0x14')](0x1f4,_0x563dd5['message']));});});}; \ No newline at end of file +var _0x020a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x020a,0x93));var _0xa020=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x020a[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa020('0x0'));var BPromise=require(_0xa020('0x1'));var rs=require(_0xa020('0x2'));var fs=require('fs');var Redis=require(_0xa020('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa020('0x4'));var logger=require(_0xa020('0x5'))(_0xa020('0x6'));var config=require(_0xa020('0x7'));var jayson=require(_0xa020('0x8'));var client=jayson[_0xa020('0x9')][_0xa020('0xa')]({'port':0x232a});config[_0xa020('0xb')]=_[_0xa020('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa020('0xb')]));require('./openchannelQueue.socket')[_0xa020('0xd')](socket);function respondWithRpcPromise(_0x5cdd77,_0xa2fc47,_0x1f85f6){return new BPromise(function(_0x3bb198,_0x5b6f9c){return client[_0xa020('0xe')](_0x5cdd77,_0x1f85f6)[_0xa020('0xf')](function(_0x591501){logger['info'](_0xa020('0x10'),_0xa2fc47,_0xa020('0x11'));logger[_0xa020('0x12')](_0xa020('0x13'),_0xa2fc47,'request\x20sent',JSON[_0xa020('0x14')](_0x591501));if(_0x591501[_0xa020('0x15')]){if(_0x591501[_0xa020('0x15')]['code']===0x1f4){logger[_0xa020('0x15')](_0xa020('0x10'),_0xa2fc47,_0x591501[_0xa020('0x15')]['message']);return _0x5b6f9c(_0x591501[_0xa020('0x15')][_0xa020('0x16')]);}logger[_0xa020('0x15')](_0xa020('0x10'),_0xa2fc47,_0x591501[_0xa020('0x15')]['message']);return _0x3bb198(_0x591501['error'][_0xa020('0x16')]);}else{logger[_0xa020('0x17')](_0xa020('0x10'),_0xa2fc47,_0xa020('0x11'));_0x3bb198(_0x591501[_0xa020('0x18')][_0xa020('0x16')]);}})[_0xa020('0x19')](function(_0x41a1f8){logger[_0xa020('0x15')](_0xa020('0x10'),_0xa2fc47,_0x41a1f8);_0x5b6f9c(_0x41a1f8);});});}exports['GetOpenchannelQueue']=function(_0x1989e0){var _0x5c5582=this;return new Promise(function(_0x300449,_0x2958d8){return db[_0xa020('0x1a')][_0xa020('0x1b')]({'raw':_0x1989e0[_0xa020('0x1c')]?_0x1989e0['options'][_0xa020('0x1d')]===undefined?!![]:![]:!![],'where':_0x1989e0[_0xa020('0x1c')]?_0x1989e0[_0xa020('0x1c')][_0xa020('0x1e')]||null:null,'attributes':_0x1989e0['options']?_0x1989e0['options'][_0xa020('0x1f')]||null:null,'limit':_0x1989e0[_0xa020('0x1c')]?_0x1989e0[_0xa020('0x1c')]['limit']||null:null,'include':_0x1989e0['options']?_0x1989e0[_0xa020('0x1c')][_0xa020('0x20')]?_[_0xa020('0x21')](_0x1989e0[_0xa020('0x1c')][_0xa020('0x20')],function(_0x31c0d5){return{'model':db[_0x31c0d5[_0xa020('0x22')]],'as':_0x31c0d5['as'],'attributes':_0x31c0d5['attributes'],'include':_0x31c0d5[_0xa020('0x20')]?_['map'](_0x31c0d5[_0xa020('0x20')],function(_0x597799){return{'model':db[_0x597799['model']],'as':_0x597799['as'],'attributes':_0x597799[_0xa020('0x1f')],'include':_0x597799[_0xa020('0x20')]?_['map'](_0x597799['include'],function(_0x24130e){return{'model':db[_0x24130e['model']],'as':_0x24130e['as'],'attributes':_0x24130e[_0xa020('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa020('0xf')](function(_0x47dac2){logger['info'](_0xa020('0x23'),_0x1989e0);logger['debug'](_0xa020('0x23'),_0x1989e0,JSON[_0xa020('0x14')](_0x47dac2));_0x300449(_0x47dac2);})[_0xa020('0x19')](function(_0x120356){logger[_0xa020('0x15')]('GetOpenchannelQueue',_0x120356[_0xa020('0x16')],_0x1989e0);_0x2958d8(_0x5c5582[_0xa020('0x15')](0x1f4,_0x120356['message']));});});};exports['ShowOpenchannelQueue']=function(_0xa6e256){var _0x165c98=this;return new Promise(function(_0x493ce3,_0x4be4d6){return db[_0xa020('0x1a')][_0xa020('0x24')]({'raw':_0xa6e256[_0xa020('0x1c')]?_0xa6e256[_0xa020('0x1c')][_0xa020('0x1d')]===undefined?!![]:![]:!![],'where':_0xa6e256['options']?_0xa6e256['options'][_0xa020('0x1e')]||null:null,'attributes':_0xa6e256['options']?_0xa6e256[_0xa020('0x1c')][_0xa020('0x1f')]||null:null,'include':_0xa6e256[_0xa020('0x1c')]?_0xa6e256['options'][_0xa020('0x20')]?_[_0xa020('0x21')](_0xa6e256[_0xa020('0x1c')][_0xa020('0x20')],function(_0x3ab625){return{'model':db[_0x3ab625[_0xa020('0x22')]],'as':_0x3ab625['as'],'attributes':_0x3ab625['attributes'],'include':_0x3ab625[_0xa020('0x20')]?_[_0xa020('0x21')](_0x3ab625[_0xa020('0x20')],function(_0x19855b){return{'model':db[_0x19855b[_0xa020('0x22')]],'as':_0x19855b['as'],'attributes':_0x19855b[_0xa020('0x1f')],'include':_0x19855b[_0xa020('0x20')]?_['map'](_0x19855b['include'],function(_0x3d9831){return{'model':db[_0x3d9831[_0xa020('0x22')]],'as':_0x3d9831['as'],'attributes':_0x3d9831[_0xa020('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa020('0xf')](function(_0x2d590a){logger[_0xa020('0x17')](_0xa020('0x25'),_0xa6e256);logger[_0xa020('0x12')](_0xa020('0x25'),_0xa6e256,JSON['stringify'](_0x2d590a));_0x493ce3(_0x2d590a);})[_0xa020('0x19')](function(_0x420622){logger['error'](_0xa020('0x25'),_0x420622['message'],_0xa6e256);_0x4be4d6(_0x165c98[_0xa020('0x15')](0x1f4,_0x420622[_0xa020('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7cec136..fef1b74 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 _0xfb09=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x6518ce,_0x5b0ee9){var _0x18f117=function(_0x25a45c){while(--_0x25a45c){_0x6518ce['push'](_0x6518ce['shift']());}};_0x18f117(++_0x5b0ee9);}(_0xfb09,0x1ae));var _0x9fb0=function(_0x32d384,_0x4442e9){_0x32d384=_0x32d384-0x0;var _0x1c7db9=_0xfb09[_0x32d384];return _0x1c7db9;};'use strict';var OpenchannelQueueEvents=require(_0x9fb0('0x0'));var events=[_0x9fb0('0x1'),_0x9fb0('0x2'),_0x9fb0('0x3')];function createListener(_0x1412ff,_0x507d32){return function(_0x41cf4a){_0x507d32[_0x9fb0('0x4')](_0x1412ff,_0x41cf4a);};}function removeListener(_0x51c1f5,_0x4b71c5){return function(){OpenchannelQueueEvents[_0x9fb0('0x5')](_0x51c1f5,_0x4b71c5);};}exports[_0x9fb0('0x6')]=function(_0x3608fc){for(var _0x51286a=0x0,_0x4d356d=events['length'];_0x51286a<_0x4d356d;_0x51286a++){var _0x1d2123=events[_0x51286a];var _0x54b61e=createListener(_0x9fb0('0x7')+_0x1d2123,_0x3608fc);OpenchannelQueueEvents['on'](_0x1d2123,_0x54b61e);}}; \ No newline at end of file +var _0x9c37=['register','save','emit'];(function(_0x2577e5,_0x237cf8){var _0xfe1e53=function(_0x1565b9){while(--_0x1565b9){_0x2577e5['push'](_0x2577e5['shift']());}};_0xfe1e53(++_0x237cf8);}(_0x9c37,0xe8));var _0x79c3=function(_0x5bdd23,_0x56adc7){_0x5bdd23=_0x5bdd23-0x0;var _0x577df4=_0x9c37[_0x5bdd23];return _0x577df4;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x79c3('0x0'),'remove','update'];function createListener(_0x504d50,_0x30ab09){return function(_0x4b89e7){_0x30ab09[_0x79c3('0x1')](_0x504d50,_0x4b89e7);};}function removeListener(_0x547123,_0x2100ed){return function(){OpenchannelQueueEvents['removeListener'](_0x547123,_0x2100ed);};}exports[_0x79c3('0x2')]=function(_0x3846f2){for(var _0x339941=0x0,_0x32fd3e=events['length'];_0x339941<_0x32fd3e;_0x339941++){var _0x13a79d=events[_0x339941];var _0x33c29d=createListener('openchannelQueue:'+_0x13a79d,_0x3846f2);OpenchannelQueueEvents['on'](_0x13a79d,_0x33c29d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 44c7ec3..7a6bcbb 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 _0x1b4c=['/:id','post','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5071e3,_0x92802d){var _0x5e89a8=function(_0xc3a48e){while(--_0xc3a48e){_0x5071e3['push'](_0x5071e3['shift']());}};_0x5e89a8(++_0x92802d);}(_0x1b4c,0xf7));var _0xc1b4=function(_0x3cdf50,_0x3e8eb2){_0x3cdf50=_0x3cdf50-0x0;var _0x22d47a=_0x1b4c[_0x3cdf50];return _0x22d47a;};'use strict';var multer=require('multer');var util=require(_0xc1b4('0x0'));var path=require('path');var timeout=require(_0xc1b4('0x1'));var express=require(_0xc1b4('0x2'));var router=express[_0xc1b4('0x3')]();var fs_extra=require(_0xc1b4('0x4'));var auth=require(_0xc1b4('0x5'));var interaction=require(_0xc1b4('0x6'));var config=require('../../config/environment');var controller=require(_0xc1b4('0x7'));router[_0xc1b4('0x8')]('/',auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xa')]);router['get'](_0xc1b4('0xb'),auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xc')]);router[_0xc1b4('0x8')](_0xc1b4('0xd'),auth[_0xc1b4('0x9')](),controller['show']);router[_0xc1b4('0xe')]('/',auth[_0xc1b4('0x9')](),controller[_0xc1b4('0xf')]);router[_0xc1b4('0x10')](_0xc1b4('0xd'),auth[_0xc1b4('0x9')](),controller[_0xc1b4('0x11')]);router[_0xc1b4('0x12')](_0xc1b4('0xd'),auth[_0xc1b4('0x9')](),controller['destroy']);module[_0xc1b4('0x13')]=router; \ No newline at end of file +var _0x21a6=['fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util','path','express'];(function(_0x16a51c,_0x135be0){var _0x312530=function(_0x39f10d){while(--_0x39f10d){_0x16a51c['push'](_0x16a51c['shift']());}};_0x312530(++_0x135be0);}(_0x21a6,0x9f));var _0x621a=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x21a6[_0x1d7037];return _0x4d6568;};'use strict';var multer=require('multer');var util=require(_0x621a('0x0'));var path=require(_0x621a('0x1'));var timeout=require('connect-timeout');var express=require(_0x621a('0x2'));var router=express['Router']();var fs_extra=require(_0x621a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x621a('0x4'));var config=require('../../config/environment');var controller=require(_0x621a('0x5'));router[_0x621a('0x6')]('/',auth['isAuthenticated'](),controller[_0x621a('0x7')]);router[_0x621a('0x6')](_0x621a('0x8'),auth[_0x621a('0x9')](),controller[_0x621a('0xa')]);router['get'](_0x621a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x621a('0xc')]('/',auth[_0x621a('0x9')](),controller[_0x621a('0xd')]);router[_0x621a('0xe')](_0x621a('0xb'),auth['isAuthenticated'](),controller[_0x621a('0xf')]);router[_0x621a('0x10')](_0x621a('0xb'),auth[_0x621a('0x9')](),controller[_0x621a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 98a0e4e..1bb62bc 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 _0x1dde=['moment','sequelize','exports','STRING','DATE'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1dde,0x16d));var _0xe1dd=function(_0xadcb5,_0x1dfa6c){_0xadcb5=_0xadcb5-0x0;var _0x5cdbc0=_0x1dde[_0xadcb5];return _0x5cdbc0;};'use strict';var moment=require(_0xe1dd('0x0'));var Sequelize=require(_0xe1dd('0x1'));module[_0xe1dd('0x2')]={'uniqueid':{'type':Sequelize[_0xe1dd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe1dd('0x3')]},'joinAt':{'type':Sequelize[_0xe1dd('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1dd('0x4')]},'exitAt':{'type':Sequelize[_0xe1dd('0x4')]},'reason':{'type':Sequelize[_0xe1dd('0x3')]}}; \ No newline at end of file +var _0x324d=['moment','sequelize','STRING','DATE'];(function(_0xbe7b1f,_0x3b3614){var _0x115dd5=function(_0x2d3702){while(--_0x2d3702){_0xbe7b1f['push'](_0xbe7b1f['shift']());}};_0x115dd5(++_0x3b3614);}(_0x324d,0x170));var _0xd324=function(_0x1b345b,_0x216466){_0x1b345b=_0x1b345b-0x0;var _0x189e50=_0x324d[_0x1b345b];return _0x189e50;};'use strict';var moment=require(_0xd324('0x0'));var Sequelize=require(_0xd324('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd324('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd324('0x2')]},'joinAt':{'type':Sequelize[_0xd324('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd324('0x3')]},'exitAt':{'type':Sequelize[_0xd324('0x3')]},'reason':{'type':Sequelize[_0xd324('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 188fbd0..90c6fe5 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 _0x5d93=['undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x5d93,0xca));var _0x35d9=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x5d93[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x35d9('0x0'));var rimraf=require(_0x35d9('0x1'));var zipdir=require(_0x35d9('0x2'));var jsonpatch=require(_0x35d9('0x3'));var rp=require(_0x35d9('0x4'));var moment=require(_0x35d9('0x5'));var BPromise=require(_0x35d9('0x6'));var Mustache=require(_0x35d9('0x7'));var util=require(_0x35d9('0x8'));var path=require(_0x35d9('0x9'));var sox=require('sox');var csv=require(_0x35d9('0xa'));var ejs=require(_0x35d9('0xb'));var fs=require('fs');var fs_extra=require(_0x35d9('0xc'));var _=require(_0x35d9('0xd'));var squel=require(_0x35d9('0xe'));var crypto=require(_0x35d9('0xf'));var jsforce=require(_0x35d9('0x10'));var deskjs=require(_0x35d9('0x11'));var toCsv=require('to-csv');var querystring=require(_0x35d9('0x12'));var Papa=require('papaparse');var Redis=require(_0x35d9('0x13'));var authService=require(_0x35d9('0x14'));var qs=require(_0x35d9('0x15'));var as=require(_0x35d9('0x16'));var hardwareService=require(_0x35d9('0x17'));var logger=require(_0x35d9('0x18'))('api');var utils=require(_0x35d9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x35d9('0x1a'));var db=require(_0x35d9('0x1b'))['db'];function respondWithStatusCode(_0x51666f,_0x1c2b47){_0x1c2b47=_0x1c2b47||0xcc;return function(_0x5aca51){if(_0x5aca51){return _0x51666f['sendStatus'](_0x1c2b47);}return _0x51666f['status'](_0x1c2b47)[_0x35d9('0x1c')]();};}function respondWithResult(_0x1d76f0,_0x174ddf){_0x174ddf=_0x174ddf||0xc8;return function(_0x2a65fa){if(_0x2a65fa){return _0x1d76f0[_0x35d9('0x1d')](_0x174ddf)[_0x35d9('0x1e')](_0x2a65fa);}};}function respondWithFilteredResult(_0x4bb7f9,_0x5bf8b2){return function(_0x141ca2){if(_0x141ca2){var _0x57bfba=typeof _0x5bf8b2[_0x35d9('0x1f')]===_0x35d9('0x20')&&typeof _0x5bf8b2[_0x35d9('0x21')]===_0x35d9('0x20');var _0x336041=_0x141ca2[_0x35d9('0x22')];var _0x1cd38c=_0x57bfba?0x0:_0x5bf8b2[_0x35d9('0x1f')];var _0x512fc8=_0x57bfba?_0x141ca2[_0x35d9('0x22')]:_0x5bf8b2[_0x35d9('0x1f')]+_0x5bf8b2[_0x35d9('0x21')];var _0x5ce75f;if(_0x512fc8>=_0x336041){_0x512fc8=_0x336041;_0x5ce75f=0xc8;}else{_0x5ce75f=0xce;}_0x4bb7f9[_0x35d9('0x1d')](_0x5ce75f);return _0x4bb7f9['set']('Content-Range',_0x1cd38c+'-'+_0x512fc8+'/'+_0x336041)[_0x35d9('0x1e')](_0x141ca2);}return null;};}function patchUpdates(_0x389166){return function(_0x4ea6ff){try{jsonpatch[_0x35d9('0x23')](_0x4ea6ff,_0x389166,!![]);}catch(_0x536dea){return BPromise['reject'](_0x536dea);}return _0x4ea6ff[_0x35d9('0x24')]();};}function saveUpdates(_0x7ad26a,_0x321403){return function(_0x1d2094){if(_0x1d2094){return _0x1d2094[_0x35d9('0x25')](_0x7ad26a)[_0x35d9('0x26')](function(_0x517d95){return _0x517d95;});}return null;};}function removeEntity(_0x46e64e,_0x5af503){return function(_0x327404){if(_0x327404){return _0x327404[_0x35d9('0x27')]()['then'](function(){_0x46e64e[_0x35d9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x400068,_0x522418){return function(_0x3e5abe){if(!_0x3e5abe){_0x400068[_0x35d9('0x28')](0x194);}return _0x3e5abe;};}function handleError(_0x1a63f5,_0x728808){_0x728808=_0x728808||0x1f4;return function(_0xf4a5b7){logger[_0x35d9('0x29')](_0xf4a5b7[_0x35d9('0x2a')]);if(_0xf4a5b7[_0x35d9('0x2b')]){delete _0xf4a5b7[_0x35d9('0x2b')];}_0x1a63f5[_0x35d9('0x1d')](_0x728808)[_0x35d9('0x2c')](_0xf4a5b7);};}exports[_0x35d9('0x2d')]=function(_0x1908a0,_0x5b70ad){var _0x13e752={},_0x19d70f={},_0xebf9ec={'count':0x0,'rows':[]};var _0x5c5e68=_['map'](db[_0x35d9('0x2e')]['rawAttributes'],function(_0x5d02bd){return{'name':_0x5d02bd['fieldName'],'type':_0x5d02bd[_0x35d9('0x2f')][_0x35d9('0x30')]};});_0x19d70f['model']=_[_0x35d9('0x31')](_0x5c5e68,_0x35d9('0x2b'));_0x19d70f[_0x35d9('0x32')]=_[_0x35d9('0x33')](_0x1908a0[_0x35d9('0x32')]);_0x19d70f[_0x35d9('0x34')]=_[_0x35d9('0x35')](_0x19d70f[_0x35d9('0x36')],_0x19d70f[_0x35d9('0x32')]);_0x13e752[_0x35d9('0x37')]=_['intersection'](_0x19d70f[_0x35d9('0x36')],qs['fields'](_0x1908a0[_0x35d9('0x32')][_0x35d9('0x38')]));_0x13e752['attributes']=_0x13e752[_0x35d9('0x37')][_0x35d9('0x39')]?_0x13e752['attributes']:_0x19d70f[_0x35d9('0x36')];if(!_0x1908a0[_0x35d9('0x32')][_0x35d9('0x3a')](_0x35d9('0x3b'))){_0x13e752[_0x35d9('0x21')]=qs[_0x35d9('0x21')](_0x1908a0[_0x35d9('0x32')][_0x35d9('0x21')]);_0x13e752[_0x35d9('0x1f')]=qs['offset'](_0x1908a0[_0x35d9('0x32')][_0x35d9('0x1f')]);}_0x13e752['order']=qs[_0x35d9('0x3c')](_0x1908a0['query'][_0x35d9('0x3c')]);_0x13e752[_0x35d9('0x3d')]=qs[_0x35d9('0x34')](_[_0x35d9('0x3e')](_0x1908a0['query'],_0x19d70f['filters']),_0x5c5e68);if(_0x1908a0[_0x35d9('0x32')][_0x35d9('0x3f')]){_0x13e752[_0x35d9('0x3d')]=_[_0x35d9('0x40')](_0x13e752[_0x35d9('0x3d')],{'$or':_[_0x35d9('0x31')](_0x5c5e68,function(_0x292858){if(_0x292858[_0x35d9('0x2f')]!=='VIRTUAL'){var _0x534c0e={};_0x534c0e[_0x292858[_0x35d9('0x2b')]]={'$like':'%'+_0x1908a0[_0x35d9('0x32')][_0x35d9('0x3f')]+'%'};return _0x534c0e;}})});}_0x13e752=_[_0x35d9('0x40')]({},_0x13e752,_0x1908a0[_0x35d9('0x41')]);var _0x19ae42={'where':_0x13e752[_0x35d9('0x3d')]};return db[_0x35d9('0x2e')]['count'](_0x19ae42)['then'](function(_0x1c72d4){_0xebf9ec[_0x35d9('0x22')]=_0x1c72d4;if(_0x1908a0[_0x35d9('0x32')][_0x35d9('0x42')]){_0x13e752[_0x35d9('0x43')]=[{'all':!![]}];}return db[_0x35d9('0x2e')][_0x35d9('0x44')](_0x13e752);})[_0x35d9('0x26')](function(_0x5163ce){_0xebf9ec[_0x35d9('0x45')]=_0x5163ce;return _0xebf9ec;})[_0x35d9('0x26')](respondWithFilteredResult(_0x5b70ad,_0x13e752))[_0x35d9('0x46')](handleError(_0x5b70ad,null));};exports[_0x35d9('0x47')]=function(_0x27f4a6,_0x2901be){var _0x4fa737={'raw':!![],'where':{'id':_0x27f4a6[_0x35d9('0x48')]['id']}},_0x4cce92={};_0x4cce92[_0x35d9('0x36')]=_[_0x35d9('0x33')](db[_0x35d9('0x2e')][_0x35d9('0x49')]);_0x4cce92[_0x35d9('0x32')]=_[_0x35d9('0x33')](_0x27f4a6[_0x35d9('0x32')]);_0x4cce92[_0x35d9('0x34')]=_[_0x35d9('0x35')](_0x4cce92[_0x35d9('0x36')],_0x4cce92[_0x35d9('0x32')]);_0x4fa737[_0x35d9('0x37')]=_[_0x35d9('0x35')](_0x4cce92[_0x35d9('0x36')],qs[_0x35d9('0x38')](_0x27f4a6[_0x35d9('0x32')][_0x35d9('0x38')]));_0x4fa737['attributes']=_0x4fa737[_0x35d9('0x37')][_0x35d9('0x39')]?_0x4fa737[_0x35d9('0x37')]:_0x4cce92[_0x35d9('0x36')];if(_0x27f4a6[_0x35d9('0x32')]['includeAll']){_0x4fa737[_0x35d9('0x43')]=[{'all':!![]}];}_0x4fa737=_[_0x35d9('0x40')]({},_0x4fa737,_0x27f4a6[_0x35d9('0x41')]);return db['OpenchannelQueueReport'][_0x35d9('0x4a')](_0x4fa737)[_0x35d9('0x26')](handleEntityNotFound(_0x2901be,null))[_0x35d9('0x26')](respondWithResult(_0x2901be,null))['catch'](handleError(_0x2901be,null));};exports[_0x35d9('0x4b')]=function(_0x3a0674,_0x57aed6){return db[_0x35d9('0x2e')][_0x35d9('0x4b')](_0x3a0674['body'],{})[_0x35d9('0x26')](respondWithResult(_0x57aed6,0xc9))['catch'](handleError(_0x57aed6,null));};exports[_0x35d9('0x25')]=function(_0xb15917,_0xdea3fe){if(_0xb15917['body']['id']){delete _0xb15917['body']['id'];}return db['OpenchannelQueueReport'][_0x35d9('0x4a')]({'where':{'id':_0xb15917['params']['id']}})[_0x35d9('0x26')](handleEntityNotFound(_0xdea3fe,null))['then'](saveUpdates(_0xb15917[_0x35d9('0x4c')],null))[_0x35d9('0x26')](respondWithResult(_0xdea3fe,null))['catch'](handleError(_0xdea3fe,null));};exports[_0x35d9('0x27')]=function(_0x4a4f49,_0x2af153){return db[_0x35d9('0x2e')][_0x35d9('0x4a')]({'where':{'id':_0x4a4f49[_0x35d9('0x48')]['id']}})[_0x35d9('0x26')](handleEntityNotFound(_0x2af153,null))[_0x35d9('0x26')](removeEntity(_0x2af153,null))[_0x35d9('0x46')](handleError(_0x2af153,null));};exports[_0x35d9('0x4d')]=function(_0x3026ab,_0x4a7b54){return db[_0x35d9('0x2e')]['describe']()[_0x35d9('0x26')](respondWithResult(_0x4a7b54,null))[_0x35d9('0x46')](handleError(_0x4a7b54,null));}; \ No newline at end of file +var _0x61c8=['error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','options','catch','create','body','destroy','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x61c8,0x78));var _0x861c=function(_0x4756d5,_0x20560a){_0x4756d5=_0x4756d5-0x0;var _0xf834a8=_0x61c8[_0x4756d5];return _0xf834a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x861c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x861c('0x1'));var moment=require(_0x861c('0x2'));var BPromise=require(_0x861c('0x3'));var Mustache=require(_0x861c('0x4'));var util=require(_0x861c('0x5'));var path=require(_0x861c('0x6'));var sox=require(_0x861c('0x7'));var csv=require(_0x861c('0x8'));var ejs=require(_0x861c('0x9'));var fs=require('fs');var fs_extra=require(_0x861c('0xa'));var _=require(_0x861c('0xb'));var squel=require(_0x861c('0xc'));var crypto=require(_0x861c('0xd'));var jsforce=require(_0x861c('0xe'));var deskjs=require(_0x861c('0xf'));var toCsv=require(_0x861c('0x8'));var querystring=require(_0x861c('0x10'));var Papa=require(_0x861c('0x11'));var Redis=require(_0x861c('0x12'));var authService=require(_0x861c('0x13'));var qs=require(_0x861c('0x14'));var as=require(_0x861c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x861c('0x16'))(_0x861c('0x17'));var utils=require(_0x861c('0x18'));var config=require(_0x861c('0x19'));var licenseUtil=require(_0x861c('0x1a'));var db=require(_0x861c('0x1b'))['db'];function respondWithStatusCode(_0x31176b,_0x20c390){_0x20c390=_0x20c390||0xcc;return function(_0x5effff){if(_0x5effff){return _0x31176b['sendStatus'](_0x20c390);}return _0x31176b[_0x861c('0x1c')](_0x20c390)[_0x861c('0x1d')]();};}function respondWithResult(_0x23a842,_0x6c4df5){_0x6c4df5=_0x6c4df5||0xc8;return function(_0x30a922){if(_0x30a922){return _0x23a842[_0x861c('0x1c')](_0x6c4df5)[_0x861c('0x1e')](_0x30a922);}};}function respondWithFilteredResult(_0x59f820,_0x5e240e){return function(_0x3b2c2a){if(_0x3b2c2a){var _0x4105b1=typeof _0x5e240e['offset']===_0x861c('0x1f')&&typeof _0x5e240e[_0x861c('0x20')]===_0x861c('0x1f');var _0x7beeaf=_0x3b2c2a[_0x861c('0x21')];var _0x4bd188=_0x4105b1?0x0:_0x5e240e[_0x861c('0x22')];var _0x487970=_0x4105b1?_0x3b2c2a['count']:_0x5e240e[_0x861c('0x22')]+_0x5e240e[_0x861c('0x20')];var _0x183bb2;if(_0x487970>=_0x7beeaf){_0x487970=_0x7beeaf;_0x183bb2=0xc8;}else{_0x183bb2=0xce;}_0x59f820[_0x861c('0x1c')](_0x183bb2);return _0x59f820[_0x861c('0x23')](_0x861c('0x24'),_0x4bd188+'-'+_0x487970+'/'+_0x7beeaf)[_0x861c('0x1e')](_0x3b2c2a);}return null;};}function patchUpdates(_0x556f28){return function(_0xb22ca3){try{jsonpatch[_0x861c('0x25')](_0xb22ca3,_0x556f28,!![]);}catch(_0x2da3fd){return BPromise[_0x861c('0x26')](_0x2da3fd);}return _0xb22ca3[_0x861c('0x27')]();};}function saveUpdates(_0x192302,_0x5152ef){return function(_0x34947c){if(_0x34947c){return _0x34947c['update'](_0x192302)[_0x861c('0x28')](function(_0x4fdbb3){return _0x4fdbb3;});}return null;};}function removeEntity(_0x23dd6a,_0x354a0e){return function(_0x5b48e4){if(_0x5b48e4){return _0x5b48e4['destroy']()[_0x861c('0x28')](function(){_0x23dd6a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d82c1,_0x4dfcc4){return function(_0x1e4479){if(!_0x1e4479){_0x1d82c1[_0x861c('0x29')](0x194);}return _0x1e4479;};}function handleError(_0x25b76e,_0x5d1258){_0x5d1258=_0x5d1258||0x1f4;return function(_0x53e95d){logger[_0x861c('0x2a')](_0x53e95d[_0x861c('0x2b')]);if(_0x53e95d[_0x861c('0x2c')]){delete _0x53e95d[_0x861c('0x2c')];}_0x25b76e[_0x861c('0x1c')](_0x5d1258)[_0x861c('0x2d')](_0x53e95d);};}exports['index']=function(_0x3911ba,_0x1abd22){var _0x4fd194={},_0x1eb4d2={},_0x4284f9={'count':0x0,'rows':[]};var _0x566357=_['map'](db[_0x861c('0x2e')][_0x861c('0x2f')],function(_0x5f0ca7){return{'name':_0x5f0ca7[_0x861c('0x30')],'type':_0x5f0ca7['type'][_0x861c('0x31')]};});_0x1eb4d2[_0x861c('0x32')]=_[_0x861c('0x33')](_0x566357,_0x861c('0x2c'));_0x1eb4d2[_0x861c('0x34')]=_['keys'](_0x3911ba[_0x861c('0x34')]);_0x1eb4d2['filters']=_[_0x861c('0x35')](_0x1eb4d2[_0x861c('0x32')],_0x1eb4d2[_0x861c('0x34')]);_0x4fd194[_0x861c('0x36')]=_[_0x861c('0x35')](_0x1eb4d2[_0x861c('0x32')],qs[_0x861c('0x37')](_0x3911ba[_0x861c('0x34')][_0x861c('0x37')]));_0x4fd194['attributes']=_0x4fd194[_0x861c('0x36')][_0x861c('0x38')]?_0x4fd194['attributes']:_0x1eb4d2[_0x861c('0x32')];if(!_0x3911ba['query'][_0x861c('0x39')](_0x861c('0x3a'))){_0x4fd194['limit']=qs[_0x861c('0x20')](_0x3911ba['query'][_0x861c('0x20')]);_0x4fd194[_0x861c('0x22')]=qs[_0x861c('0x22')](_0x3911ba[_0x861c('0x34')][_0x861c('0x22')]);}_0x4fd194[_0x861c('0x3b')]=qs[_0x861c('0x3c')](_0x3911ba['query'][_0x861c('0x3c')]);_0x4fd194[_0x861c('0x3d')]=qs[_0x861c('0x3e')](_[_0x861c('0x3f')](_0x3911ba[_0x861c('0x34')],_0x1eb4d2[_0x861c('0x3e')]),_0x566357);if(_0x3911ba['query'][_0x861c('0x40')]){_0x4fd194['where']=_[_0x861c('0x41')](_0x4fd194[_0x861c('0x3d')],{'$or':_['map'](_0x566357,function(_0x56d779){if(_0x56d779[_0x861c('0x42')]!==_0x861c('0x43')){var _0x546a7a={};_0x546a7a[_0x56d779[_0x861c('0x2c')]]={'$like':'%'+_0x3911ba[_0x861c('0x34')][_0x861c('0x40')]+'%'};return _0x546a7a;}})});}_0x4fd194=_['merge']({},_0x4fd194,_0x3911ba['options']);var _0x4c3e7e={'where':_0x4fd194[_0x861c('0x3d')]};return db['OpenchannelQueueReport']['count'](_0x4c3e7e)[_0x861c('0x28')](function(_0x5c9a4a){_0x4284f9[_0x861c('0x21')]=_0x5c9a4a;if(_0x3911ba[_0x861c('0x34')]['includeAll']){_0x4fd194[_0x861c('0x44')]=[{'all':!![]}];}return db[_0x861c('0x2e')][_0x861c('0x45')](_0x4fd194);})[_0x861c('0x28')](function(_0x10a9fe){_0x4284f9[_0x861c('0x46')]=_0x10a9fe;return _0x4284f9;})[_0x861c('0x28')](respondWithFilteredResult(_0x1abd22,_0x4fd194))['catch'](handleError(_0x1abd22,null));};exports[_0x861c('0x47')]=function(_0x155338,_0x3501f6){var _0x223e7e={'raw':!![],'where':{'id':_0x155338[_0x861c('0x48')]['id']}},_0x889c1={};_0x889c1[_0x861c('0x32')]=_[_0x861c('0x49')](db['OpenchannelQueueReport'][_0x861c('0x2f')]);_0x889c1['query']=_[_0x861c('0x49')](_0x155338[_0x861c('0x34')]);_0x889c1[_0x861c('0x3e')]=_[_0x861c('0x35')](_0x889c1[_0x861c('0x32')],_0x889c1[_0x861c('0x34')]);_0x223e7e[_0x861c('0x36')]=_[_0x861c('0x35')](_0x889c1['model'],qs[_0x861c('0x37')](_0x155338[_0x861c('0x34')][_0x861c('0x37')]));_0x223e7e[_0x861c('0x36')]=_0x223e7e[_0x861c('0x36')]['length']?_0x223e7e['attributes']:_0x889c1[_0x861c('0x32')];if(_0x155338[_0x861c('0x34')][_0x861c('0x4a')]){_0x223e7e[_0x861c('0x44')]=[{'all':!![]}];}_0x223e7e=_[_0x861c('0x41')]({},_0x223e7e,_0x155338[_0x861c('0x4b')]);return db[_0x861c('0x2e')]['find'](_0x223e7e)[_0x861c('0x28')](handleEntityNotFound(_0x3501f6,null))[_0x861c('0x28')](respondWithResult(_0x3501f6,null))[_0x861c('0x4c')](handleError(_0x3501f6,null));};exports[_0x861c('0x4d')]=function(_0x1f2ad0,_0xab98ad){return db[_0x861c('0x2e')]['create'](_0x1f2ad0['body'],{})[_0x861c('0x28')](respondWithResult(_0xab98ad,0xc9))[_0x861c('0x4c')](handleError(_0xab98ad,null));};exports['update']=function(_0x3b38eb,_0x465374){if(_0x3b38eb[_0x861c('0x4e')]['id']){delete _0x3b38eb[_0x861c('0x4e')]['id'];}return db[_0x861c('0x2e')]['find']({'where':{'id':_0x3b38eb['params']['id']}})[_0x861c('0x28')](handleEntityNotFound(_0x465374,null))[_0x861c('0x28')](saveUpdates(_0x3b38eb[_0x861c('0x4e')],null))['then'](respondWithResult(_0x465374,null))[_0x861c('0x4c')](handleError(_0x465374,null));};exports[_0x861c('0x4f')]=function(_0x441c57,_0x5bc363){return db[_0x861c('0x2e')]['find']({'where':{'id':_0x441c57[_0x861c('0x48')]['id']}})[_0x861c('0x28')](handleEntityNotFound(_0x5bc363,null))[_0x861c('0x28')](removeEntity(_0x5bc363,null))[_0x861c('0x4c')](handleError(_0x5bc363,null));};exports['describe']=function(_0x14c268,_0x3b7781){return db[_0x861c('0x2e')][_0x861c('0x50')]()[_0x861c('0x28')](respondWithResult(_0x3b7781,null))[_0x861c('0x4c')](handleError(_0x3b7781,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c9748c4..d2016ab 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x515f02,_0x5a30f3){var _0x24ed7c=function(_0x1820da){while(--_0x1820da){_0x515f02['push'](_0x515f02['shift']());}};_0x24ed7c(++_0x5a30f3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x1bed92,_0x582dbf){var _0x540241=function(_0x10e55f){while(--_0x10e55f){_0x1bed92['push'](_0x1bed92['shift']());}};_0x540241(++_0x582dbf);}(_0x326f,0xd1));var _0xf326=function(_0x588212,_0x23c08b){_0x588212=_0x588212-0x0;var _0x2669c4=_0x326f[_0x588212];return _0x2669c4;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c9a5e46..2928541 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 _0x1c3d=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x3e5608,_0x8b6979){var _0x4128d3=function(_0x137c60){while(--_0x137c60){_0x3e5608['push'](_0x3e5608['shift']());}};_0x4128d3(++_0x8b6979);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x1c3d[_0x421cf8];return _0x145c48;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var moment=require(_0xd1c3('0x1'));var BPromise=require(_0xd1c3('0x2'));var rs=require(_0xd1c3('0x3'));var fs=require('fs');var Redis=require(_0xd1c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1c3('0x5'))(_0xd1c3('0x6'));var config=require(_0xd1c3('0x7'));var jayson=require(_0xd1c3('0x8'));var client=jayson[_0xd1c3('0x9')][_0xd1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5adcb7,_0x398766,_0x420ab0){return new BPromise(function(_0x5db2f0,_0x1afc71){return client[_0xd1c3('0xb')](_0x5adcb7,_0x420ab0)[_0xd1c3('0xc')](function(_0x18556c){logger[_0xd1c3('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,'request\x20sent');logger[_0xd1c3('0xe')](_0xd1c3('0xf'),_0x398766,_0xd1c3('0x10'),JSON[_0xd1c3('0x11')](_0x18556c));if(_0x18556c[_0xd1c3('0x12')]){if(_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x13')]===0x1f4){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x18556c['error'][_0xd1c3('0x15')]);return _0x1afc71(_0x18556c['error']['message']);}logger[_0xd1c3('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x15')]);return _0x5db2f0(_0x18556c[_0xd1c3('0x12')]['message']);}else{logger[_0xd1c3('0xd')](_0xd1c3('0x14'),_0x398766,_0xd1c3('0x10'));_0x5db2f0(_0x18556c[_0xd1c3('0x16')][_0xd1c3('0x15')]);}})[_0xd1c3('0x17')](function(_0x586fa7){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x586fa7);_0x1afc71(_0x586fa7);});});}exports[_0xd1c3('0x18')]=function(_0x5d26c2){var _0x53a5e1=this;return new Promise(function(_0x14f6cb,_0x3a1a74){return db[_0xd1c3('0x19')][_0xd1c3('0x1a')](_0x5d26c2[_0xd1c3('0x1b')],{'raw':_0x5d26c2['options']?_0x5d26c2[_0xd1c3('0x1c')][_0xd1c3('0x1d')]===undefined?!![]:![]:!![]})[_0xd1c3('0xc')](function(_0x588f4e){logger['info'](_0xd1c3('0x18'),_0x5d26c2);logger[_0xd1c3('0xe')]('CreateOpenchannelQueueReport',_0x5d26c2,JSON['stringify'](_0x588f4e));_0x14f6cb(_0x588f4e);})[_0xd1c3('0x17')](function(_0xc45d5d){logger[_0xd1c3('0x12')](_0xd1c3('0x18'),_0xc45d5d[_0xd1c3('0x15')],_0x5d26c2);_0x3a1a74(_0x53a5e1[_0xd1c3('0x12')](0x1f4,_0xc45d5d[_0xd1c3('0x15')]));});});};exports[_0xd1c3('0x1e')]=function(_0x33c380){var _0x218ef1=this;return new Promise(function(_0x5a9d5d,_0x56091a){return db[_0xd1c3('0x19')][_0xd1c3('0x1f')](_0x33c380[_0xd1c3('0x1b')],{'raw':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x20')]||null:null,'attributes':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x21')]||null:null,'limit':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x22')]||null:null})['then'](function(_0x57309e){logger[_0xd1c3('0xd')](_0xd1c3('0x1e'),_0x33c380);logger[_0xd1c3('0xe')](_0xd1c3('0x1e'),_0x33c380,JSON[_0xd1c3('0x11')](_0x57309e));_0x5a9d5d(_0x57309e);})['catch'](function(_0x331bad){logger[_0xd1c3('0x12')]('UpdateOpenchannelQueueReport',_0x331bad[_0xd1c3('0x15')],_0x33c380);_0x56091a(_0x218ef1['error'](0x1f4,_0x331bad[_0xd1c3('0x15')]));});});}; \ No newline at end of file +var _0x80ed=['catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x80ed,0x11c));var _0xd80e=function(_0x8e95a4,_0x1e84ed){_0x8e95a4=_0x8e95a4-0x0;var _0x4c4223=_0x80ed[_0x8e95a4];return _0x4c4223;};'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});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['CreateOpenchannelQueueReport']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['OpenchannelQueueReport'][_0xd80e('0x17')](_0x21ceec[_0xd80e('0x18')],{'raw':_0x21ceec[_0xd80e('0x19')]?_0x21ceec['options'][_0xd80e('0x1a')]===undefined?!![]:![]:!![]})[_0xd80e('0xc')](function(_0x2765ea){logger[_0xd80e('0xd')](_0xd80e('0x1b'),_0x21ceec);logger['debug']('CreateOpenchannelQueueReport',_0x21ceec,JSON[_0xd80e('0x11')](_0x2765ea));_0x3b543d(_0x2765ea);})[_0xd80e('0x16')](function(_0x3b39bf){logger[_0xd80e('0x12')](_0xd80e('0x1b'),_0x3b39bf[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x3b39bf['message']));});});};exports[_0xd80e('0x1c')]=function(_0x57d70){var _0x170109=this;return new Promise(function(_0x5b0d6d,_0x635ce0){return db[_0xd80e('0x1d')][_0xd80e('0x1e')](_0x57d70['body'],{'raw':_0x57d70['options']?_0x57d70['options'][_0xd80e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d70['options']?_0x57d70[_0xd80e('0x19')][_0xd80e('0x1f')]||null:null,'attributes':_0x57d70['options']?_0x57d70[_0xd80e('0x19')][_0xd80e('0x20')]||null:null,'limit':_0x57d70[_0xd80e('0x19')]?_0x57d70[_0xd80e('0x19')]['limit']||null:null})[_0xd80e('0xc')](function(_0x1ad3bc){logger[_0xd80e('0xd')](_0xd80e('0x1c'),_0x57d70);logger[_0xd80e('0x21')](_0xd80e('0x1c'),_0x57d70,JSON[_0xd80e('0x11')](_0x1ad3bc));_0x5b0d6d(_0x1ad3bc);})[_0xd80e('0x16')](function(_0x5522dd){logger['error'](_0xd80e('0x1c'),_0x5522dd[_0xd80e('0x14')],_0x57d70);_0x635ce0(_0x170109[_0xd80e('0x12')](0x1f4,_0x5522dd[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1a907f9..dad9d8f 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 _0x36c5=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x36c5,0x162));var _0x536c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36c5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x536c('0x0'));var util=require('util');var path=require(_0x536c('0x1'));var timeout=require(_0x536c('0x2'));var express=require(_0x536c('0x3'));var router=express[_0x536c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x536c('0x5'));var interaction=require(_0x536c('0x6'));var config=require('../../config/environment');var controller=require(_0x536c('0x7'));router[_0x536c('0x8')]('/',auth[_0x536c('0x9')](),controller[_0x536c('0xa')]);router['get'](_0x536c('0xb'),auth[_0x536c('0x9')](),controller['describe']);router[_0x536c('0x8')]('/:id',auth[_0x536c('0x9')](),controller['show']);router['post']('/',auth[_0x536c('0x9')](),controller[_0x536c('0xc')]);router[_0x536c('0xd')](_0x536c('0xe'),auth['isAuthenticated'](),controller[_0x536c('0xf')]);router[_0x536c('0x10')](_0x536c('0xe'),auth['isAuthenticated'](),controller[_0x536c('0x11')]);module[_0x536c('0x12')]=router; \ No newline at end of file +var _0x6a03=['/describe','describe','show','post','create','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x579ffa,_0x2b271b){var _0x45cfee=function(_0x4c92fb){while(--_0x4c92fb){_0x579ffa['push'](_0x579ffa['shift']());}};_0x45cfee(++_0x2b271b);}(_0x6a03,0xfa));var _0x36a0=function(_0x1f45fe,_0x23b693){_0x1f45fe=_0x1f45fe-0x0;var _0x447823=_0x6a03[_0x1f45fe];return _0x447823;};'use strict';var multer=require(_0x36a0('0x0'));var util=require(_0x36a0('0x1'));var path=require(_0x36a0('0x2'));var timeout=require(_0x36a0('0x3'));var express=require(_0x36a0('0x4'));var router=express[_0x36a0('0x5')]();var fs_extra=require(_0x36a0('0x6'));var auth=require(_0x36a0('0x7'));var interaction=require(_0x36a0('0x8'));var config=require(_0x36a0('0x9'));var controller=require(_0x36a0('0xa'));router[_0x36a0('0xb')]('/',auth[_0x36a0('0xc')](),controller[_0x36a0('0xd')]);router[_0x36a0('0xb')](_0x36a0('0xe'),auth[_0x36a0('0xc')](),controller[_0x36a0('0xf')]);router[_0x36a0('0xb')]('/:id',auth[_0x36a0('0xc')](),controller[_0x36a0('0x10')]);router[_0x36a0('0x11')]('/',auth['isAuthenticated'](),controller[_0x36a0('0x12')]);router['put'](_0x36a0('0x13'),auth[_0x36a0('0xc')](),controller['update']);router[_0x36a0('0x14')]('/:id',auth[_0x36a0('0xc')](),controller[_0x36a0('0x15')]);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 954171c..91f513d 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x55ed38,_0x1d52f1){var _0x3ea0fd=function(_0x46fbec){while(--_0x46fbec){_0x55ed38['push'](_0x55ed38['shift']());}};_0x3ea0fd(++_0x1d52f1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5873ed,_0x127882){_0x5873ed=_0x5873ed-0x0;var _0x585800=_0x9bde[_0x5873ed];return _0x585800;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5374227..d02b9d7 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 _0xf147=['../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','apply','reject','update','then','destroy','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','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','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x112da2,_0x280cd0){var _0x268d2c=function(_0x319700){while(--_0x319700){_0x112da2['push'](_0x112da2['shift']());}};_0x268d2c(++_0x280cd0);}(_0xf147,0x1e9));var _0x7f14=function(_0x293259,_0x3e7e97){_0x293259=_0x293259-0x0;var _0x1b800b=_0xf147[_0x293259];return _0x1b800b;};'use strict';var emlformat=require(_0x7f14('0x0'));var rimraf=require(_0x7f14('0x1'));var zipdir=require(_0x7f14('0x2'));var jsonpatch=require(_0x7f14('0x3'));var rp=require(_0x7f14('0x4'));var moment=require(_0x7f14('0x5'));var BPromise=require(_0x7f14('0x6'));var Mustache=require('mustache');var util=require(_0x7f14('0x7'));var path=require(_0x7f14('0x8'));var sox=require(_0x7f14('0x9'));var csv=require(_0x7f14('0xa'));var ejs=require(_0x7f14('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f14('0xc'));var squel=require(_0x7f14('0xd'));var crypto=require(_0x7f14('0xe'));var jsforce=require('jsforce');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(_0x7f14('0xf'));var qs=require(_0x7f14('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f14('0x11'));var logger=require(_0x7f14('0x12'))(_0x7f14('0x13'));var utils=require(_0x7f14('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7f14('0x15'));var db=require(_0x7f14('0x16'))['db'];function respondWithStatusCode(_0x2c9946,_0x2da127){_0x2da127=_0x2da127||0xcc;return function(_0x2ba59d){if(_0x2ba59d){return _0x2c9946[_0x7f14('0x17')](_0x2da127);}return _0x2c9946['status'](_0x2da127)[_0x7f14('0x18')]();};}function respondWithResult(_0x505b66,_0x30d61c){_0x30d61c=_0x30d61c||0xc8;return function(_0xc026b){if(_0xc026b){return _0x505b66['status'](_0x30d61c)[_0x7f14('0x19')](_0xc026b);}};}function respondWithFilteredResult(_0x539ad1,_0x400237){return function(_0x2e5b17){if(_0x2e5b17){var _0x39e969=typeof _0x400237['offset']===_0x7f14('0x1a')&&typeof _0x400237[_0x7f14('0x1b')]===_0x7f14('0x1a');var _0x364d0e=_0x2e5b17['count'];var _0x2b9d0f=_0x39e969?0x0:_0x400237[_0x7f14('0x1c')];var _0x34c729=_0x39e969?_0x2e5b17[_0x7f14('0x1d')]:_0x400237[_0x7f14('0x1c')]+_0x400237[_0x7f14('0x1b')];var _0x5813cb;if(_0x34c729>=_0x364d0e){_0x34c729=_0x364d0e;_0x5813cb=0xc8;}else{_0x5813cb=0xce;}_0x539ad1[_0x7f14('0x1e')](_0x5813cb);return _0x539ad1[_0x7f14('0x1f')]('Content-Range',_0x2b9d0f+'-'+_0x34c729+'/'+_0x364d0e)['json'](_0x2e5b17);}return null;};}function patchUpdates(_0x133c1b){return function(_0x40d9c0){try{jsonpatch[_0x7f14('0x20')](_0x40d9c0,_0x133c1b,!![]);}catch(_0x31634f){return BPromise[_0x7f14('0x21')](_0x31634f);}return _0x40d9c0['save']();};}function saveUpdates(_0xc9981f,_0x1f357c){return function(_0x3bccbe){if(_0x3bccbe){return _0x3bccbe[_0x7f14('0x22')](_0xc9981f)[_0x7f14('0x23')](function(_0x5376a6){return _0x5376a6;});}return null;};}function removeEntity(_0x383c26,_0x40c02c){return function(_0x398bbe){if(_0x398bbe){return _0x398bbe[_0x7f14('0x24')]()[_0x7f14('0x23')](function(){_0x383c26[_0x7f14('0x1e')](0xcc)[_0x7f14('0x18')]();});}};}function handleEntityNotFound(_0x1a2d11,_0x4852d6){return function(_0x570442){if(!_0x570442){_0x1a2d11[_0x7f14('0x17')](0x194);}return _0x570442;};}function handleError(_0x50c41f,_0x24f863){_0x24f863=_0x24f863||0x1f4;return function(_0x3b1899){logger['error'](_0x3b1899['stack']);if(_0x3b1899[_0x7f14('0x25')]){delete _0x3b1899[_0x7f14('0x25')];}_0x50c41f[_0x7f14('0x1e')](_0x24f863)[_0x7f14('0x26')](_0x3b1899);};}exports[_0x7f14('0x27')]=function(_0x3e21ac,_0x1f0946){var _0x4c6dd9={},_0x43aa78={},_0x20d5ba={'count':0x0,'rows':[]};var _0x246b5e=_[_0x7f14('0x28')](db[_0x7f14('0x29')][_0x7f14('0x2a')],function(_0x20ab92){return{'name':_0x20ab92[_0x7f14('0x2b')],'type':_0x20ab92[_0x7f14('0x2c')][_0x7f14('0x2d')]};});_0x43aa78[_0x7f14('0x2e')]=_['map'](_0x246b5e,_0x7f14('0x25'));_0x43aa78[_0x7f14('0x2f')]=_[_0x7f14('0x30')](_0x3e21ac[_0x7f14('0x2f')]);_0x43aa78[_0x7f14('0x31')]=_[_0x7f14('0x32')](_0x43aa78[_0x7f14('0x2e')],_0x43aa78[_0x7f14('0x2f')]);_0x4c6dd9['attributes']=_[_0x7f14('0x32')](_0x43aa78[_0x7f14('0x2e')],qs[_0x7f14('0x33')](_0x3e21ac[_0x7f14('0x2f')]['fields']));_0x4c6dd9['attributes']=_0x4c6dd9['attributes'][_0x7f14('0x34')]?_0x4c6dd9[_0x7f14('0x35')]:_0x43aa78['model'];if(!_0x3e21ac[_0x7f14('0x2f')]['hasOwnProperty']('nolimit')){_0x4c6dd9['limit']=qs[_0x7f14('0x1b')](_0x3e21ac[_0x7f14('0x2f')][_0x7f14('0x1b')]);_0x4c6dd9[_0x7f14('0x1c')]=qs[_0x7f14('0x1c')](_0x3e21ac['query'][_0x7f14('0x1c')]);}_0x4c6dd9[_0x7f14('0x36')]=qs[_0x7f14('0x37')](_0x3e21ac['query']['sort']);_0x4c6dd9[_0x7f14('0x38')]=qs[_0x7f14('0x31')](_[_0x7f14('0x39')](_0x3e21ac[_0x7f14('0x2f')],_0x43aa78[_0x7f14('0x31')]),_0x246b5e);if(_0x3e21ac[_0x7f14('0x2f')][_0x7f14('0x3a')]){_0x4c6dd9[_0x7f14('0x38')]=_['merge'](_0x4c6dd9['where'],{'$or':_[_0x7f14('0x28')](_0x246b5e,function(_0x2d4470){if(_0x2d4470[_0x7f14('0x2c')]!==_0x7f14('0x3b')){var _0xbefcf={};_0xbefcf[_0x2d4470[_0x7f14('0x25')]]={'$like':'%'+_0x3e21ac['query'][_0x7f14('0x3a')]+'%'};return _0xbefcf;}})});}_0x4c6dd9=_[_0x7f14('0x3c')]({},_0x4c6dd9,_0x3e21ac[_0x7f14('0x3d')]);var _0xc1bbc3={'where':_0x4c6dd9[_0x7f14('0x38')]};return db['OpenchannelTransferReport'][_0x7f14('0x1d')](_0xc1bbc3)[_0x7f14('0x23')](function(_0x13267a){_0x20d5ba[_0x7f14('0x1d')]=_0x13267a;if(_0x3e21ac[_0x7f14('0x2f')][_0x7f14('0x3e')]){_0x4c6dd9[_0x7f14('0x3f')]=[{'all':!![]}];}return db[_0x7f14('0x29')][_0x7f14('0x40')](_0x4c6dd9);})[_0x7f14('0x23')](function(_0x1ad0d9){_0x20d5ba[_0x7f14('0x41')]=_0x1ad0d9;return _0x20d5ba;})[_0x7f14('0x23')](respondWithFilteredResult(_0x1f0946,_0x4c6dd9))[_0x7f14('0x42')](handleError(_0x1f0946,null));};exports[_0x7f14('0x43')]=function(_0x41e043,_0x3ebea7){var _0x1c6bd9={'raw':!![],'where':{'id':_0x41e043[_0x7f14('0x44')]['id']}},_0x5d9cc0={};_0x5d9cc0[_0x7f14('0x2e')]=_[_0x7f14('0x30')](db[_0x7f14('0x29')][_0x7f14('0x2a')]);_0x5d9cc0[_0x7f14('0x2f')]=_[_0x7f14('0x30')](_0x41e043[_0x7f14('0x2f')]);_0x5d9cc0[_0x7f14('0x31')]=_[_0x7f14('0x32')](_0x5d9cc0['model'],_0x5d9cc0['query']);_0x1c6bd9[_0x7f14('0x35')]=_[_0x7f14('0x32')](_0x5d9cc0['model'],qs[_0x7f14('0x33')](_0x41e043[_0x7f14('0x2f')][_0x7f14('0x33')]));_0x1c6bd9['attributes']=_0x1c6bd9[_0x7f14('0x35')]['length']?_0x1c6bd9['attributes']:_0x5d9cc0['model'];if(_0x41e043['query']['includeAll']){_0x1c6bd9[_0x7f14('0x3f')]=[{'all':!![]}];}_0x1c6bd9=_[_0x7f14('0x3c')]({},_0x1c6bd9,_0x41e043[_0x7f14('0x3d')]);return db[_0x7f14('0x29')][_0x7f14('0x45')](_0x1c6bd9)[_0x7f14('0x23')](handleEntityNotFound(_0x3ebea7,null))[_0x7f14('0x23')](respondWithResult(_0x3ebea7,null))['catch'](handleError(_0x3ebea7,null));};exports[_0x7f14('0x46')]=function(_0x7f5b77,_0x376661){return db[_0x7f14('0x29')][_0x7f14('0x46')](_0x7f5b77[_0x7f14('0x47')],{})['then'](respondWithResult(_0x376661,0xc9))[_0x7f14('0x42')](handleError(_0x376661,null));};exports[_0x7f14('0x22')]=function(_0x2318e1,_0x2eaae6){if(_0x2318e1['body']['id']){delete _0x2318e1[_0x7f14('0x47')]['id'];}return db[_0x7f14('0x29')][_0x7f14('0x45')]({'where':{'id':_0x2318e1[_0x7f14('0x44')]['id']}})['then'](handleEntityNotFound(_0x2eaae6,null))['then'](saveUpdates(_0x2318e1[_0x7f14('0x47')],null))[_0x7f14('0x23')](respondWithResult(_0x2eaae6,null))[_0x7f14('0x42')](handleError(_0x2eaae6,null));};exports[_0x7f14('0x24')]=function(_0x529a77,_0x5d534f){return db[_0x7f14('0x29')]['find']({'where':{'id':_0x529a77[_0x7f14('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d534f,null))['then'](removeEntity(_0x5d534f,null))['catch'](handleError(_0x5d534f,null));};exports[_0x7f14('0x48')]=function(_0x102661,_0x49fe00){return db[_0x7f14('0x29')][_0x7f14('0x48')]()[_0x7f14('0x23')](respondWithResult(_0x49fe00,null))[_0x7f14('0x42')](handleError(_0x49fe00,null));}; \ No newline at end of file +var _0x891b=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','OpenchannelTransferReport','includeAll','include','rows','find','catch','create','body','params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb891('0x0'));var jsonpatch=require(_0xb891('0x1'));var rp=require('request-promise');var moment=require(_0xb891('0x2'));var BPromise=require(_0xb891('0x3'));var Mustache=require(_0xb891('0x4'));var util=require(_0xb891('0x5'));var path=require('path');var sox=require(_0xb891('0x6'));var csv=require(_0xb891('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb891('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb891('0x9'));var deskjs=require(_0xb891('0xa'));var toCsv=require(_0xb891('0x7'));var querystring=require(_0xb891('0xb'));var Papa=require(_0xb891('0xc'));var Redis=require(_0xb891('0xd'));var authService=require(_0xb891('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb891('0xf'));var hardwareService=require(_0xb891('0x10'));var logger=require(_0xb891('0x11'))(_0xb891('0x12'));var utils=require(_0xb891('0x13'));var config=require(_0xb891('0x14'));var licenseUtil=require(_0xb891('0x15'));var db=require(_0xb891('0x16'))['db'];function respondWithStatusCode(_0x1d49b7,_0x447cee){_0x447cee=_0x447cee||0xcc;return function(_0x3629f0){if(_0x3629f0){return _0x1d49b7['sendStatus'](_0x447cee);}return _0x1d49b7[_0xb891('0x17')](_0x447cee)[_0xb891('0x18')]();};}function respondWithResult(_0x917a1b,_0x57c76b){_0x57c76b=_0x57c76b||0xc8;return function(_0x3fe2a0){if(_0x3fe2a0){return _0x917a1b[_0xb891('0x17')](_0x57c76b)['json'](_0x3fe2a0);}};}function respondWithFilteredResult(_0xca0294,_0x4c0e7c){return function(_0x423dec){if(_0x423dec){var _0x2f8fb0=typeof _0x4c0e7c[_0xb891('0x19')]===_0xb891('0x1a')&&typeof _0x4c0e7c[_0xb891('0x1b')]===_0xb891('0x1a');var _0x592f48=_0x423dec['count'];var _0x88e4ad=_0x2f8fb0?0x0:_0x4c0e7c[_0xb891('0x19')];var _0x10a1b3=_0x2f8fb0?_0x423dec[_0xb891('0x1c')]:_0x4c0e7c[_0xb891('0x19')]+_0x4c0e7c[_0xb891('0x1b')];var _0x2b1afa;if(_0x10a1b3>=_0x592f48){_0x10a1b3=_0x592f48;_0x2b1afa=0xc8;}else{_0x2b1afa=0xce;}_0xca0294[_0xb891('0x17')](_0x2b1afa);return _0xca0294['set']('Content-Range',_0x88e4ad+'-'+_0x10a1b3+'/'+_0x592f48)[_0xb891('0x1d')](_0x423dec);}return null;};}function patchUpdates(_0x5f58dc){return function(_0x2d9995){try{jsonpatch[_0xb891('0x1e')](_0x2d9995,_0x5f58dc,!![]);}catch(_0x5cd70a){return BPromise[_0xb891('0x1f')](_0x5cd70a);}return _0x2d9995['save']();};}function saveUpdates(_0x13c5fd,_0x3a233c){return function(_0x46ad5b){if(_0x46ad5b){return _0x46ad5b[_0xb891('0x20')](_0x13c5fd)[_0xb891('0x21')](function(_0x4418b3){return _0x4418b3;});}return null;};}function removeEntity(_0x14e936,_0x458354){return function(_0xa9c55a){if(_0xa9c55a){return _0xa9c55a[_0xb891('0x22')]()[_0xb891('0x21')](function(){_0x14e936[_0xb891('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2ad7,_0xda220a){return function(_0x36c5a9){if(!_0x36c5a9){_0x1c2ad7['sendStatus'](0x194);}return _0x36c5a9;};}function handleError(_0x1da83d,_0x57ee2f){_0x57ee2f=_0x57ee2f||0x1f4;return function(_0x40cbb7){logger[_0xb891('0x23')](_0x40cbb7[_0xb891('0x24')]);if(_0x40cbb7[_0xb891('0x25')]){delete _0x40cbb7[_0xb891('0x25')];}_0x1da83d['status'](_0x57ee2f)['send'](_0x40cbb7);};}exports[_0xb891('0x26')]=function(_0x54f690,_0x49e864){var _0x1291e3={},_0x27024b={},_0x2e0440={'count':0x0,'rows':[]};var _0x600154=_[_0xb891('0x27')](db['OpenchannelTransferReport'][_0xb891('0x28')],function(_0x5d355d){return{'name':_0x5d355d[_0xb891('0x29')],'type':_0x5d355d[_0xb891('0x2a')][_0xb891('0x2b')]};});_0x27024b['model']=_[_0xb891('0x27')](_0x600154,'name');_0x27024b['query']=_[_0xb891('0x2c')](_0x54f690[_0xb891('0x2d')]);_0x27024b[_0xb891('0x2e')]=_[_0xb891('0x2f')](_0x27024b['model'],_0x27024b[_0xb891('0x2d')]);_0x1291e3[_0xb891('0x30')]=_[_0xb891('0x2f')](_0x27024b[_0xb891('0x31')],qs[_0xb891('0x32')](_0x54f690['query'][_0xb891('0x32')]));_0x1291e3[_0xb891('0x30')]=_0x1291e3[_0xb891('0x30')][_0xb891('0x33')]?_0x1291e3[_0xb891('0x30')]:_0x27024b[_0xb891('0x31')];if(!_0x54f690[_0xb891('0x2d')][_0xb891('0x34')](_0xb891('0x35'))){_0x1291e3[_0xb891('0x1b')]=qs[_0xb891('0x1b')](_0x54f690['query']['limit']);_0x1291e3[_0xb891('0x19')]=qs['offset'](_0x54f690[_0xb891('0x2d')][_0xb891('0x19')]);}_0x1291e3[_0xb891('0x36')]=qs[_0xb891('0x37')](_0x54f690[_0xb891('0x2d')][_0xb891('0x37')]);_0x1291e3[_0xb891('0x38')]=qs[_0xb891('0x2e')](_[_0xb891('0x39')](_0x54f690[_0xb891('0x2d')],_0x27024b['filters']),_0x600154);if(_0x54f690[_0xb891('0x2d')]['filter']){_0x1291e3[_0xb891('0x38')]=_['merge'](_0x1291e3[_0xb891('0x38')],{'$or':_['map'](_0x600154,function(_0x137c69){if(_0x137c69[_0xb891('0x2a')]!==_0xb891('0x3a')){var _0x104e98={};_0x104e98[_0x137c69[_0xb891('0x25')]]={'$like':'%'+_0x54f690[_0xb891('0x2d')][_0xb891('0x3b')]+'%'};return _0x104e98;}})});}_0x1291e3=_[_0xb891('0x3c')]({},_0x1291e3,_0x54f690[_0xb891('0x3d')]);var _0x44d6c5={'where':_0x1291e3[_0xb891('0x38')]};return db[_0xb891('0x3e')][_0xb891('0x1c')](_0x44d6c5)[_0xb891('0x21')](function(_0x3dc26c){_0x2e0440[_0xb891('0x1c')]=_0x3dc26c;if(_0x54f690[_0xb891('0x2d')][_0xb891('0x3f')]){_0x1291e3[_0xb891('0x40')]=[{'all':!![]}];}return db[_0xb891('0x3e')]['findAll'](_0x1291e3);})[_0xb891('0x21')](function(_0x1b3447){_0x2e0440[_0xb891('0x41')]=_0x1b3447;return _0x2e0440;})[_0xb891('0x21')](respondWithFilteredResult(_0x49e864,_0x1291e3))['catch'](handleError(_0x49e864,null));};exports['show']=function(_0x5cd05d,_0x5b22c6){var _0x3f5a6f={'raw':!![],'where':{'id':_0x5cd05d['params']['id']}},_0x3e1890={};_0x3e1890[_0xb891('0x31')]=_[_0xb891('0x2c')](db[_0xb891('0x3e')][_0xb891('0x28')]);_0x3e1890[_0xb891('0x2d')]=_[_0xb891('0x2c')](_0x5cd05d[_0xb891('0x2d')]);_0x3e1890[_0xb891('0x2e')]=_[_0xb891('0x2f')](_0x3e1890['model'],_0x3e1890[_0xb891('0x2d')]);_0x3f5a6f[_0xb891('0x30')]=_['intersection'](_0x3e1890[_0xb891('0x31')],qs[_0xb891('0x32')](_0x5cd05d[_0xb891('0x2d')][_0xb891('0x32')]));_0x3f5a6f[_0xb891('0x30')]=_0x3f5a6f[_0xb891('0x30')][_0xb891('0x33')]?_0x3f5a6f[_0xb891('0x30')]:_0x3e1890[_0xb891('0x31')];if(_0x5cd05d[_0xb891('0x2d')][_0xb891('0x3f')]){_0x3f5a6f['include']=[{'all':!![]}];}_0x3f5a6f=_[_0xb891('0x3c')]({},_0x3f5a6f,_0x5cd05d[_0xb891('0x3d')]);return db['OpenchannelTransferReport'][_0xb891('0x42')](_0x3f5a6f)[_0xb891('0x21')](handleEntityNotFound(_0x5b22c6,null))['then'](respondWithResult(_0x5b22c6,null))[_0xb891('0x43')](handleError(_0x5b22c6,null));};exports[_0xb891('0x44')]=function(_0x5558ab,_0x4e40f7){return db[_0xb891('0x3e')][_0xb891('0x44')](_0x5558ab[_0xb891('0x45')],{})[_0xb891('0x21')](respondWithResult(_0x4e40f7,0xc9))[_0xb891('0x43')](handleError(_0x4e40f7,null));};exports[_0xb891('0x20')]=function(_0x279ec8,_0x472cca){if(_0x279ec8['body']['id']){delete _0x279ec8[_0xb891('0x45')]['id'];}return db[_0xb891('0x3e')]['find']({'where':{'id':_0x279ec8[_0xb891('0x46')]['id']}})[_0xb891('0x21')](handleEntityNotFound(_0x472cca,null))['then'](saveUpdates(_0x279ec8['body'],null))[_0xb891('0x21')](respondWithResult(_0x472cca,null))[_0xb891('0x43')](handleError(_0x472cca,null));};exports['destroy']=function(_0x70cdd,_0x647db7){return db[_0xb891('0x3e')][_0xb891('0x42')]({'where':{'id':_0x70cdd[_0xb891('0x46')]['id']}})[_0xb891('0x21')](handleEntityNotFound(_0x647db7,null))[_0xb891('0x21')](removeEntity(_0x647db7,null))['catch'](handleError(_0x647db7,null));};exports[_0xb891('0x47')]=function(_0x3b3263,_0x298a85){return db[_0xb891('0x3e')][_0xb891('0x47')]()['then'](respondWithResult(_0x298a85,null))[_0xb891('0x43')](handleError(_0x298a85,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0f288c8..e7f3d09 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 _0xdbb4=['moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api'];(function(_0x28007a,_0x3c13b6){var _0x5c0c68=function(_0x153340){while(--_0x153340){_0x28007a['push'](_0x28007a['shift']());}};_0x5c0c68(++_0x3c13b6);}(_0xdbb4,0x7b));var _0x4dbb=function(_0x2fb87e,_0x483324){_0x2fb87e=_0x2fb87e-0x0;var _0x5de4c1=_0xdbb4[_0x2fb87e];return _0x5de4c1;};'use strict';var _=require('lodash');var util=require(_0x4dbb('0x0'));var logger=require(_0x4dbb('0x1'))(_0x4dbb('0x2'));var moment=require(_0x4dbb('0x3'));var BPromise=require(_0x4dbb('0x4'));var rp=require(_0x4dbb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dbb('0x6'));var config=require(_0x4dbb('0x7'));var attributes=require(_0x4dbb('0x8'));module[_0x4dbb('0x9')]=function(_0xa934a1,_0x50cbfe){return _0xa934a1[_0x4dbb('0xa')](_0x4dbb('0xb'),attributes,{'tableName':_0x4dbb('0xc'),'paranoid':![],'indexes':[{'name':_0x4dbb('0xd'),'fields':[_0x4dbb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa05a=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d1e05,_0x3c2409){var _0x529bf2=function(_0x49361d){while(--_0x49361d){_0x5d1e05['push'](_0x5d1e05['shift']());}};_0x529bf2(++_0x3c2409);}(_0xa05a,0x108));var _0xaa05=function(_0x5d3e85,_0x913911){_0x5d3e85=_0x5d3e85-0x0;var _0x4b711c=_0xa05a[_0x5d3e85];return _0x4b711c;};'use strict';var _=require(_0xaa05('0x0'));var util=require(_0xaa05('0x1'));var logger=require(_0xaa05('0x2'))(_0xaa05('0x3'));var moment=require(_0xaa05('0x4'));var BPromise=require(_0xaa05('0x5'));var rp=require(_0xaa05('0x6'));var fs=require('fs');var path=require(_0xaa05('0x7'));var rimraf=require(_0xaa05('0x8'));var config=require(_0xaa05('0x9'));var attributes=require(_0xaa05('0xa'));module[_0xaa05('0xb')]=function(_0x3c6e91,_0x5de9d8){return _0x3c6e91[_0xaa05('0xc')](_0xaa05('0xd'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xaa05('0xe'),'fields':[_0xaa05('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 18e061c..dddedbf 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 _0xd9ef=['OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd9ef,0x95));var _0xfd9e=function(_0x328bf7,_0x3d7985){_0x328bf7=_0x328bf7-0x0;var _0x14cff7=_0xd9ef[_0x328bf7];return _0x14cff7;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var moment=require('moment');var BPromise=require(_0xfd9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd9e('0x3'));var logger=require(_0xfd9e('0x4'))(_0xfd9e('0x5'));var config=require(_0xfd9e('0x6'));var jayson=require(_0xfd9e('0x7'));var client=jayson[_0xfd9e('0x8')][_0xfd9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3dec,_0x261826,_0x302795){return new BPromise(function(_0xb61585,_0x1f35c7){return client[_0xfd9e('0xa')](_0x3c3dec,_0x302795)['then'](function(_0xd8d6bc){logger[_0xfd9e('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x261826,_0xfd9e('0xc'));logger[_0xfd9e('0xd')](_0xfd9e('0xe'),_0x261826,'request\x20sent',JSON[_0xfd9e('0xf')](_0xd8d6bc));if(_0xd8d6bc[_0xfd9e('0x10')]){if(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x11')]===0x1f4){logger[_0xfd9e('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0x1f35c7(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}logger[_0xfd9e('0x10')](_0xfd9e('0x13'),_0x261826,_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);return _0xb61585(_0xd8d6bc[_0xfd9e('0x10')][_0xfd9e('0x12')]);}else{logger['info'](_0xfd9e('0x13'),_0x261826,'request\x20sent');_0xb61585(_0xd8d6bc['result'][_0xfd9e('0x12')]);}})[_0xfd9e('0x14')](function(_0x144372){logger['error'](_0xfd9e('0x13'),_0x261826,_0x144372);_0x1f35c7(_0x144372);});});} \ No newline at end of file +var _0xc090=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xc090,0x112));var _0x0c09=function(_0x20363d,_0x5d477a){_0x20363d=_0x20363d-0x0;var _0xeaa105=_0xc090[_0x20363d];return _0xeaa105;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var moment=require(_0x0c09('0x2'));var BPromise=require(_0x0c09('0x3'));var rs=require(_0x0c09('0x4'));var fs=require('fs');var Redis=require(_0x0c09('0x5'));var db=require(_0x0c09('0x6'))['db'];var utils=require(_0x0c09('0x7'));var logger=require(_0x0c09('0x8'))('rpc');var config=require(_0x0c09('0x9'));var jayson=require(_0x0c09('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c2143,_0x4bfe8a,_0x1f1a58){return new BPromise(function(_0x2854d8,_0x34e5f0){return client['request'](_0x4c2143,_0x1f1a58)[_0x0c09('0xb')](function(_0x45ec93){logger['info'](_0x0c09('0xc'),_0x4bfe8a,'request\x20sent');logger[_0x0c09('0xd')](_0x0c09('0xe'),_0x4bfe8a,_0x0c09('0xf'),JSON[_0x0c09('0x10')](_0x45ec93));if(_0x45ec93['error']){if(_0x45ec93['error']['code']===0x1f4){logger[_0x0c09('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bfe8a,_0x45ec93['error'][_0x0c09('0x12')]);return _0x34e5f0(_0x45ec93['error'][_0x0c09('0x12')]);}logger[_0x0c09('0x11')](_0x0c09('0xc'),_0x4bfe8a,_0x45ec93[_0x0c09('0x11')][_0x0c09('0x12')]);return _0x2854d8(_0x45ec93[_0x0c09('0x11')][_0x0c09('0x12')]);}else{logger[_0x0c09('0x13')](_0x0c09('0xc'),_0x4bfe8a,_0x0c09('0xf'));_0x2854d8(_0x45ec93['result'][_0x0c09('0x12')]);}})[_0x0c09('0x14')](function(_0x173f4c){logger[_0x0c09('0x11')](_0x0c09('0xc'),_0x4bfe8a,_0x173f4c);_0x34e5f0(_0x173f4c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 86330e5..542d6c4 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 _0x3eb3=['index','isAuthenticated','show','post','put','/:id','delete','destroy','exports','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x4cb38a,_0x3b61c5){var _0x413b42=function(_0x1fb470){while(--_0x1fb470){_0x4cb38a['push'](_0x4cb38a['shift']());}};_0x413b42(++_0x3b61c5);}(_0x3eb3,0xf9));var _0x33eb=function(_0x26f3d1,_0x1a87d9){_0x26f3d1=_0x26f3d1-0x0;var _0x41ece7=_0x3eb3[_0x26f3d1];return _0x41ece7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x33eb('0x0')]();var fs_extra=require('fs-extra');var auth=require(_0x33eb('0x1'));var interaction=require(_0x33eb('0x2'));var config=require(_0x33eb('0x3'));var controller=require(_0x33eb('0x4'));router[_0x33eb('0x5')]('/',auth['isAuthenticated'](),controller[_0x33eb('0x6')]);router[_0x33eb('0x5')]('/:id',auth[_0x33eb('0x7')](),controller[_0x33eb('0x8')]);router[_0x33eb('0x9')]('/',auth[_0x33eb('0x7')](),controller['create']);router[_0x33eb('0xa')](_0x33eb('0xb'),auth[_0x33eb('0x7')](),controller['update']);router[_0x33eb('0xc')](_0x33eb('0xb'),auth[_0x33eb('0x7')](),controller[_0x33eb('0xd')]);module[_0x33eb('0xe')]=router; \ No newline at end of file +var _0x0d56=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','multer'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0d56,0x142));var _0x60d5=function(_0x5b29f7,_0x335b71){_0x5b29f7=_0x5b29f7-0x0;var _0x47d235=_0x0d56[_0x5b29f7];return _0x47d235;};'use strict';var multer=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60d5('0x2'));var router=express[_0x60d5('0x3')]();var fs_extra=require(_0x60d5('0x4'));var auth=require(_0x60d5('0x5'));var interaction=require(_0x60d5('0x6'));var config=require(_0x60d5('0x7'));var controller=require(_0x60d5('0x8'));router[_0x60d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x60d5('0xa')]);router['get'](_0x60d5('0xb'),auth['isAuthenticated'](),controller[_0x60d5('0xc')]);router[_0x60d5('0xd')]('/',auth[_0x60d5('0xe')](),controller[_0x60d5('0xf')]);router[_0x60d5('0x10')](_0x60d5('0xb'),auth[_0x60d5('0xe')](),controller['update']);router[_0x60d5('0x11')](_0x60d5('0xb'),auth[_0x60d5('0xe')](),controller[_0x60d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index a876f7d..d2d9254 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 _0x07f4=['name','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x07f4,0x1a8));var _0x407f=function(_0x2d9d84,_0x66d97d){_0x2d9d84=_0x2d9d84-0x0;var _0x144057=_0x07f4[_0x2d9d84];return _0x144057;};'use strict';var Sequelize=require('sequelize');module[_0x407f('0x0')]={'name':{'type':Sequelize[_0x407f('0x1')],'unique':_0x407f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x407f('0x1')]}}; \ No newline at end of file +var _0x6850=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6850,0xfd));var _0x0685=function(_0x12026f,_0x548662){_0x12026f=_0x12026f-0x0;var _0x2acc68=_0x6850[_0x12026f];return _0x2acc68;};'use strict';var Sequelize=require(_0x0685('0x0'));module[_0x0685('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0685('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f607736..fc20c7b 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 _0x5d71=['json','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','map','Pause','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','catch','show','params','keys','length','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x4a1473,_0x5237a1){var _0x17b4ab=function(_0xefd86){while(--_0xefd86){_0x4a1473['push'](_0x4a1473['shift']());}};_0x17b4ab(++_0x5237a1);}(_0x5d71,0x87));var _0x15d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d71[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x15d7('0x0'));var rimraf=require(_0x15d7('0x1'));var zipdir=require(_0x15d7('0x2'));var jsonpatch=require(_0x15d7('0x3'));var rp=require(_0x15d7('0x4'));var moment=require(_0x15d7('0x5'));var BPromise=require(_0x15d7('0x6'));var Mustache=require(_0x15d7('0x7'));var util=require(_0x15d7('0x8'));var path=require(_0x15d7('0x9'));var sox=require(_0x15d7('0xa'));var csv=require(_0x15d7('0xb'));var ejs=require(_0x15d7('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15d7('0xd'));var squel=require(_0x15d7('0xe'));var crypto=require(_0x15d7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x15d7('0x10'));var toCsv=require(_0x15d7('0xb'));var querystring=require(_0x15d7('0x11'));var Papa=require(_0x15d7('0x12'));var Redis=require(_0x15d7('0x13'));var authService=require(_0x15d7('0x14'));var qs=require(_0x15d7('0x15'));var as=require(_0x15d7('0x16'));var hardwareService=require(_0x15d7('0x17'));var logger=require(_0x15d7('0x18'))('api');var utils=require(_0x15d7('0x19'));var config=require(_0x15d7('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x15d7('0x1b'))['db'];function respondWithStatusCode(_0x4a8aeb,_0x537530){_0x537530=_0x537530||0xcc;return function(_0x18f581){if(_0x18f581){return _0x4a8aeb[_0x15d7('0x1c')](_0x537530);}return _0x4a8aeb['status'](_0x537530)[_0x15d7('0x1d')]();};}function respondWithResult(_0x5b3559,_0x22d232){_0x22d232=_0x22d232||0xc8;return function(_0x27080e){if(_0x27080e){return _0x5b3559[_0x15d7('0x1e')](_0x22d232)['json'](_0x27080e);}};}function respondWithFilteredResult(_0x4b52af,_0x1573a1){return function(_0x553e05){if(_0x553e05){var _0x5a0174=typeof _0x1573a1[_0x15d7('0x1f')]===_0x15d7('0x20')&&typeof _0x1573a1[_0x15d7('0x21')]==='undefined';var _0x4b9784=_0x553e05[_0x15d7('0x22')];var _0x3c2e9f=_0x5a0174?0x0:_0x1573a1[_0x15d7('0x1f')];var _0x151e45=_0x5a0174?_0x553e05[_0x15d7('0x22')]:_0x1573a1['offset']+_0x1573a1['limit'];var _0x81bd90;if(_0x151e45>=_0x4b9784){_0x151e45=_0x4b9784;_0x81bd90=0xc8;}else{_0x81bd90=0xce;}_0x4b52af[_0x15d7('0x1e')](_0x81bd90);return _0x4b52af[_0x15d7('0x23')](_0x15d7('0x24'),_0x3c2e9f+'-'+_0x151e45+'/'+_0x4b9784)[_0x15d7('0x25')](_0x553e05);}return null;};}function patchUpdates(_0x46cf6d){return function(_0x2135a3){try{jsonpatch[_0x15d7('0x26')](_0x2135a3,_0x46cf6d,!![]);}catch(_0x2a0e02){return BPromise[_0x15d7('0x27')](_0x2a0e02);}return _0x2135a3[_0x15d7('0x28')]();};}function saveUpdates(_0x10dbf5,_0x5b775f){return function(_0x267ff8){if(_0x267ff8){return _0x267ff8[_0x15d7('0x29')](_0x10dbf5)[_0x15d7('0x2a')](function(_0xd9605f){return _0xd9605f;});}return null;};}function removeEntity(_0x5b06d1,_0x348429){return function(_0x4db5b8){if(_0x4db5b8){return _0x4db5b8[_0x15d7('0x2b')]()[_0x15d7('0x2a')](function(){var _0x1df56d=_0x4db5b8[_0x15d7('0x2c')]({'plain':!![]});var _0x4f7f87=_0x15d7('0x2d');return db[_0x15d7('0x2e')][_0x15d7('0x2b')]({'where':{'type':_0x4f7f87,'resourceId':_0x1df56d['id']}})[_0x15d7('0x2a')](function(){return _0x4db5b8;});})['then'](function(){_0x5b06d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x438f5d,_0x44f77d){return function(_0x4cb869){if(!_0x4cb869){_0x438f5d[_0x15d7('0x1c')](0x194);}return _0x4cb869;};}function handleError(_0xea234f,_0x34c436){_0x34c436=_0x34c436||0x1f4;return function(_0x270964){logger[_0x15d7('0x2f')](_0x270964[_0x15d7('0x30')]);if(_0x270964[_0x15d7('0x31')]){delete _0x270964[_0x15d7('0x31')];}_0xea234f[_0x15d7('0x1e')](_0x34c436)['send'](_0x270964);};}exports['index']=function(_0xac3db6,_0x58e5ea){var _0x1e0bbc={},_0x2a99fe={},_0x1279e2={'count':0x0,'rows':[]};var _0x6fcbdd=_[_0x15d7('0x32')](db[_0x15d7('0x33')][_0x15d7('0x34')],function(_0x424c77){return{'name':_0x424c77[_0x15d7('0x35')],'type':_0x424c77[_0x15d7('0x36')]['key']};});_0x2a99fe[_0x15d7('0x37')]=_[_0x15d7('0x32')](_0x6fcbdd,'name');_0x2a99fe['query']=_['keys'](_0xac3db6[_0x15d7('0x38')]);_0x2a99fe['filters']=_['intersection'](_0x2a99fe['model'],_0x2a99fe[_0x15d7('0x38')]);_0x1e0bbc['attributes']=_[_0x15d7('0x39')](_0x2a99fe[_0x15d7('0x37')],qs[_0x15d7('0x3a')](_0xac3db6[_0x15d7('0x38')]['fields']));_0x1e0bbc[_0x15d7('0x3b')]=_0x1e0bbc[_0x15d7('0x3b')]['length']?_0x1e0bbc[_0x15d7('0x3b')]:_0x2a99fe['model'];if(!_0xac3db6[_0x15d7('0x38')][_0x15d7('0x3c')](_0x15d7('0x3d'))){_0x1e0bbc[_0x15d7('0x21')]=qs[_0x15d7('0x21')](_0xac3db6[_0x15d7('0x38')][_0x15d7('0x21')]);_0x1e0bbc[_0x15d7('0x1f')]=qs[_0x15d7('0x1f')](_0xac3db6['query'][_0x15d7('0x1f')]);}_0x1e0bbc[_0x15d7('0x3e')]=qs[_0x15d7('0x3f')](_0xac3db6[_0x15d7('0x38')][_0x15d7('0x3f')]);_0x1e0bbc[_0x15d7('0x40')]=qs['filters'](_[_0x15d7('0x41')](_0xac3db6[_0x15d7('0x38')],_0x2a99fe[_0x15d7('0x42')]),_0x6fcbdd);if(_0xac3db6[_0x15d7('0x38')][_0x15d7('0x43')]){_0x1e0bbc[_0x15d7('0x40')]=_['merge'](_0x1e0bbc[_0x15d7('0x40')],{'$or':_['map'](_0x6fcbdd,function(_0x6ba939){if(_0x6ba939[_0x15d7('0x36')]!=='VIRTUAL'){var _0x37cb34={};_0x37cb34[_0x6ba939[_0x15d7('0x31')]]={'$like':'%'+_0xac3db6['query'][_0x15d7('0x43')]+'%'};return _0x37cb34;}})});}_0x1e0bbc=_[_0x15d7('0x44')]({},_0x1e0bbc,_0xac3db6[_0x15d7('0x45')]);var _0x84449f={'where':_0x1e0bbc[_0x15d7('0x40')]};return db['Pause'][_0x15d7('0x22')](_0x84449f)[_0x15d7('0x2a')](function(_0x34e267){_0x1279e2[_0x15d7('0x22')]=_0x34e267;if(_0xac3db6[_0x15d7('0x38')][_0x15d7('0x46')]){_0x1e0bbc['include']=[{'all':!![]}];}return db['Pause'][_0x15d7('0x47')](_0x1e0bbc);})[_0x15d7('0x2a')](function(_0x5a7a72){_0x1279e2['rows']=_0x5a7a72;return _0x1279e2;})['then'](respondWithFilteredResult(_0x58e5ea,_0x1e0bbc))[_0x15d7('0x48')](handleError(_0x58e5ea,null));};exports[_0x15d7('0x49')]=function(_0x1c645f,_0x926f96){var _0x1d3e56={'raw':!![],'where':{'id':_0x1c645f[_0x15d7('0x4a')]['id']}},_0x12c7d4={};_0x12c7d4[_0x15d7('0x37')]=_[_0x15d7('0x4b')](db[_0x15d7('0x33')]['rawAttributes']);_0x12c7d4[_0x15d7('0x38')]=_[_0x15d7('0x4b')](_0x1c645f[_0x15d7('0x38')]);_0x12c7d4[_0x15d7('0x42')]=_[_0x15d7('0x39')](_0x12c7d4[_0x15d7('0x37')],_0x12c7d4[_0x15d7('0x38')]);_0x1d3e56[_0x15d7('0x3b')]=_[_0x15d7('0x39')](_0x12c7d4[_0x15d7('0x37')],qs[_0x15d7('0x3a')](_0x1c645f[_0x15d7('0x38')]['fields']));_0x1d3e56[_0x15d7('0x3b')]=_0x1d3e56[_0x15d7('0x3b')][_0x15d7('0x4c')]?_0x1d3e56[_0x15d7('0x3b')]:_0x12c7d4[_0x15d7('0x37')];if(_0x1c645f['query'][_0x15d7('0x46')]){_0x1d3e56[_0x15d7('0x4d')]=[{'all':!![]}];}_0x1d3e56=_[_0x15d7('0x44')]({},_0x1d3e56,_0x1c645f[_0x15d7('0x45')]);return db[_0x15d7('0x33')][_0x15d7('0x4e')](_0x1d3e56)['then'](handleEntityNotFound(_0x926f96,null))[_0x15d7('0x2a')](respondWithResult(_0x926f96,null))['catch'](handleError(_0x926f96,null));};exports['create']=function(_0x2395b9,_0x36ae07){return db[_0x15d7('0x33')]['create'](_0x2395b9[_0x15d7('0x4f')],{})[_0x15d7('0x2a')](function(_0x33693b){var _0x302ded=_0x2395b9[_0x15d7('0x50')][_0x15d7('0x2c')]({'plain':!![]});if(!_0x302ded)throw new Error(_0x15d7('0x51'));if(_0x302ded['role']===_0x15d7('0x50')){var _0x2fe2ab=_0x33693b[_0x15d7('0x2c')]({'plain':!![]});var _0x6e782='Pauses';return db[_0x15d7('0x52')][_0x15d7('0x4e')]({'where':{'name':_0x6e782,'userProfileId':_0x302ded['userProfileId']},'raw':!![]})[_0x15d7('0x2a')](function(_0x5a9a02){if(_0x5a9a02&&_0x5a9a02[_0x15d7('0x53')]===0x0){return db[_0x15d7('0x2e')][_0x15d7('0x54')]({'name':_0x2fe2ab[_0x15d7('0x31')],'resourceId':_0x2fe2ab['id'],'type':_0x5a9a02[_0x15d7('0x31')],'sectionId':_0x5a9a02['id']},{})[_0x15d7('0x2a')](function(){return _0x33693b;});}else{return _0x33693b;}})[_0x15d7('0x48')](function(_0x5205a4){logger[_0x15d7('0x2f')](_0x15d7('0x55'),_0x5205a4);throw _0x5205a4;});}return _0x33693b;})[_0x15d7('0x2a')](respondWithResult(_0x36ae07,0xc9))[_0x15d7('0x48')](handleError(_0x36ae07,null));};exports[_0x15d7('0x29')]=function(_0x54bb01,_0x4cafca){if(_0x54bb01['body']['id']){delete _0x54bb01[_0x15d7('0x4f')]['id'];}return db[_0x15d7('0x33')][_0x15d7('0x4e')]({'where':{'id':_0x54bb01[_0x15d7('0x4a')]['id']}})[_0x15d7('0x2a')](handleEntityNotFound(_0x4cafca,null))['then'](saveUpdates(_0x54bb01['body'],null))[_0x15d7('0x2a')](respondWithResult(_0x4cafca,null))[_0x15d7('0x48')](handleError(_0x4cafca,null));};exports[_0x15d7('0x2b')]=function(_0x164397,_0x42ead1){return db[_0x15d7('0x33')]['find']({'where':{'id':_0x164397[_0x15d7('0x4a')]['id']}})[_0x15d7('0x2a')](handleEntityNotFound(_0x42ead1,null))[_0x15d7('0x2a')](removeEntity(_0x42ead1,null))[_0x15d7('0x48')](handleError(_0x42ead1,null));}; \ No newline at end of file +var _0x44ed=['set','Content-Range','json','apply','reject','save','update','destroy','then','get','error','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x2b13ab,_0x3e916f){var _0x1c96ce=function(_0x17e515){while(--_0x17e515){_0x2b13ab['push'](_0x2b13ab['shift']());}};_0x1c96ce(++_0x3e916f);}(_0x44ed,0x85));var _0xd44e=function(_0x5d0c1e,_0x132dd6){_0x5d0c1e=_0x5d0c1e-0x0;var _0x3ad7b0=_0x44ed[_0x5d0c1e];return _0x3ad7b0;};'use strict';var emlformat=require(_0xd44e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd44e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd44e('0x2'));var moment=require(_0xd44e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd44e('0x4'));var util=require(_0xd44e('0x5'));var path=require(_0xd44e('0x6'));var sox=require(_0xd44e('0x7'));var csv=require(_0xd44e('0x8'));var ejs=require(_0xd44e('0x9'));var fs=require('fs');var fs_extra=require(_0xd44e('0xa'));var _=require('lodash');var squel=require(_0xd44e('0xb'));var crypto=require(_0xd44e('0xc'));var jsforce=require(_0xd44e('0xd'));var deskjs=require(_0xd44e('0xe'));var toCsv=require(_0xd44e('0x8'));var querystring=require(_0xd44e('0xf'));var Papa=require(_0xd44e('0x10'));var Redis=require(_0xd44e('0x11'));var authService=require(_0xd44e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd44e('0x13'))(_0xd44e('0x14'));var utils=require(_0xd44e('0x15'));var config=require(_0xd44e('0x16'));var licenseUtil=require(_0xd44e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x484b69,_0x193311){_0x193311=_0x193311||0xcc;return function(_0xcc1c44){if(_0xcc1c44){return _0x484b69[_0xd44e('0x18')](_0x193311);}return _0x484b69[_0xd44e('0x19')](_0x193311)[_0xd44e('0x1a')]();};}function respondWithResult(_0x3e6f0d,_0x1906ec){_0x1906ec=_0x1906ec||0xc8;return function(_0x49ea1a){if(_0x49ea1a){return _0x3e6f0d['status'](_0x1906ec)['json'](_0x49ea1a);}};}function respondWithFilteredResult(_0x13869f,_0x3e5192){return function(_0x43ecb4){if(_0x43ecb4){var _0x58dc19=typeof _0x3e5192[_0xd44e('0x1b')]===_0xd44e('0x1c')&&typeof _0x3e5192[_0xd44e('0x1d')]===_0xd44e('0x1c');var _0x1a8430=_0x43ecb4[_0xd44e('0x1e')];var _0x26ed0c=_0x58dc19?0x0:_0x3e5192[_0xd44e('0x1b')];var _0x2ff689=_0x58dc19?_0x43ecb4[_0xd44e('0x1e')]:_0x3e5192['offset']+_0x3e5192[_0xd44e('0x1d')];var _0x456a20;if(_0x2ff689>=_0x1a8430){_0x2ff689=_0x1a8430;_0x456a20=0xc8;}else{_0x456a20=0xce;}_0x13869f[_0xd44e('0x19')](_0x456a20);return _0x13869f[_0xd44e('0x1f')](_0xd44e('0x20'),_0x26ed0c+'-'+_0x2ff689+'/'+_0x1a8430)[_0xd44e('0x21')](_0x43ecb4);}return null;};}function patchUpdates(_0x5e8ed9){return function(_0x5c58b2){try{jsonpatch[_0xd44e('0x22')](_0x5c58b2,_0x5e8ed9,!![]);}catch(_0x36c812){return BPromise[_0xd44e('0x23')](_0x36c812);}return _0x5c58b2[_0xd44e('0x24')]();};}function saveUpdates(_0x2ab561,_0x4de000){return function(_0x22c70b){if(_0x22c70b){return _0x22c70b[_0xd44e('0x25')](_0x2ab561)['then'](function(_0x41d42b){return _0x41d42b;});}return null;};}function removeEntity(_0x319008,_0x492e31){return function(_0x547114){if(_0x547114){return _0x547114[_0xd44e('0x26')]()[_0xd44e('0x27')](function(){var _0x1ee49c=_0x547114[_0xd44e('0x28')]({'plain':!![]});var _0x449c77='Pauses';return db['UserProfileResource'][_0xd44e('0x26')]({'where':{'type':_0x449c77,'resourceId':_0x1ee49c['id']}})[_0xd44e('0x27')](function(){return _0x547114;});})[_0xd44e('0x27')](function(){_0x319008[_0xd44e('0x19')](0xcc)[_0xd44e('0x1a')]();});}};}function handleEntityNotFound(_0x5d1cb9,_0x5100c8){return function(_0x58d2d6){if(!_0x58d2d6){_0x5d1cb9[_0xd44e('0x18')](0x194);}return _0x58d2d6;};}function handleError(_0xb4dc35,_0x2fec10){_0x2fec10=_0x2fec10||0x1f4;return function(_0x125662){logger[_0xd44e('0x29')](_0x125662['stack']);if(_0x125662[_0xd44e('0x2a')]){delete _0x125662[_0xd44e('0x2a')];}_0xb4dc35['status'](_0x2fec10)['send'](_0x125662);};}exports[_0xd44e('0x2b')]=function(_0x39ac47,_0x317204){var _0x1a302a={},_0xf609a7={},_0xfabc2c={'count':0x0,'rows':[]};var _0x476b6c=_[_0xd44e('0x2c')](db['Pause'][_0xd44e('0x2d')],function(_0x291de8){return{'name':_0x291de8[_0xd44e('0x2e')],'type':_0x291de8[_0xd44e('0x2f')][_0xd44e('0x30')]};});_0xf609a7['model']=_[_0xd44e('0x2c')](_0x476b6c,_0xd44e('0x2a'));_0xf609a7[_0xd44e('0x31')]=_[_0xd44e('0x32')](_0x39ac47[_0xd44e('0x31')]);_0xf609a7[_0xd44e('0x33')]=_['intersection'](_0xf609a7[_0xd44e('0x34')],_0xf609a7[_0xd44e('0x31')]);_0x1a302a[_0xd44e('0x35')]=_[_0xd44e('0x36')](_0xf609a7[_0xd44e('0x34')],qs[_0xd44e('0x37')](_0x39ac47['query']['fields']));_0x1a302a[_0xd44e('0x35')]=_0x1a302a[_0xd44e('0x35')][_0xd44e('0x38')]?_0x1a302a[_0xd44e('0x35')]:_0xf609a7['model'];if(!_0x39ac47[_0xd44e('0x31')][_0xd44e('0x39')](_0xd44e('0x3a'))){_0x1a302a[_0xd44e('0x1d')]=qs['limit'](_0x39ac47[_0xd44e('0x31')][_0xd44e('0x1d')]);_0x1a302a['offset']=qs[_0xd44e('0x1b')](_0x39ac47[_0xd44e('0x31')][_0xd44e('0x1b')]);}_0x1a302a[_0xd44e('0x3b')]=qs[_0xd44e('0x3c')](_0x39ac47[_0xd44e('0x31')][_0xd44e('0x3c')]);_0x1a302a[_0xd44e('0x3d')]=qs[_0xd44e('0x33')](_['pick'](_0x39ac47[_0xd44e('0x31')],_0xf609a7['filters']),_0x476b6c);if(_0x39ac47[_0xd44e('0x31')][_0xd44e('0x3e')]){_0x1a302a[_0xd44e('0x3d')]=_[_0xd44e('0x3f')](_0x1a302a['where'],{'$or':_[_0xd44e('0x2c')](_0x476b6c,function(_0x529223){if(_0x529223[_0xd44e('0x2f')]!==_0xd44e('0x40')){var _0x44f05e={};_0x44f05e[_0x529223[_0xd44e('0x2a')]]={'$like':'%'+_0x39ac47[_0xd44e('0x31')][_0xd44e('0x3e')]+'%'};return _0x44f05e;}})});}_0x1a302a=_['merge']({},_0x1a302a,_0x39ac47[_0xd44e('0x41')]);var _0x4a4d2f={'where':_0x1a302a[_0xd44e('0x3d')]};return db[_0xd44e('0x42')]['count'](_0x4a4d2f)[_0xd44e('0x27')](function(_0x3db673){_0xfabc2c[_0xd44e('0x1e')]=_0x3db673;if(_0x39ac47['query'][_0xd44e('0x43')]){_0x1a302a[_0xd44e('0x44')]=[{'all':!![]}];}return db[_0xd44e('0x42')][_0xd44e('0x45')](_0x1a302a);})[_0xd44e('0x27')](function(_0x15a5cc){_0xfabc2c[_0xd44e('0x46')]=_0x15a5cc;return _0xfabc2c;})[_0xd44e('0x27')](respondWithFilteredResult(_0x317204,_0x1a302a))[_0xd44e('0x47')](handleError(_0x317204,null));};exports['show']=function(_0x1667eb,_0x4e45e5){var _0x59f712={'raw':!![],'where':{'id':_0x1667eb['params']['id']}},_0x48224f={};_0x48224f[_0xd44e('0x34')]=_[_0xd44e('0x32')](db[_0xd44e('0x42')][_0xd44e('0x2d')]);_0x48224f[_0xd44e('0x31')]=_[_0xd44e('0x32')](_0x1667eb[_0xd44e('0x31')]);_0x48224f[_0xd44e('0x33')]=_[_0xd44e('0x36')](_0x48224f[_0xd44e('0x34')],_0x48224f['query']);_0x59f712[_0xd44e('0x35')]=_[_0xd44e('0x36')](_0x48224f[_0xd44e('0x34')],qs['fields'](_0x1667eb[_0xd44e('0x31')]['fields']));_0x59f712[_0xd44e('0x35')]=_0x59f712['attributes'][_0xd44e('0x38')]?_0x59f712[_0xd44e('0x35')]:_0x48224f['model'];if(_0x1667eb[_0xd44e('0x31')][_0xd44e('0x43')]){_0x59f712[_0xd44e('0x44')]=[{'all':!![]}];}_0x59f712=_['merge']({},_0x59f712,_0x1667eb['options']);return db[_0xd44e('0x42')][_0xd44e('0x48')](_0x59f712)[_0xd44e('0x27')](handleEntityNotFound(_0x4e45e5,null))[_0xd44e('0x27')](respondWithResult(_0x4e45e5,null))[_0xd44e('0x47')](handleError(_0x4e45e5,null));};exports[_0xd44e('0x49')]=function(_0x43fee2,_0x4e7c33){return db['Pause'][_0xd44e('0x49')](_0x43fee2[_0xd44e('0x4a')],{})[_0xd44e('0x27')](function(_0x2dd993){var _0x58cdff=_0x43fee2[_0xd44e('0x4b')][_0xd44e('0x28')]({'plain':!![]});if(!_0x58cdff)throw new Error(_0xd44e('0x4c'));if(_0x58cdff[_0xd44e('0x4d')]===_0xd44e('0x4b')){var _0x1809be=_0x2dd993[_0xd44e('0x28')]({'plain':!![]});var _0xff5c0a=_0xd44e('0x4e');return db['UserProfileSection'][_0xd44e('0x48')]({'where':{'name':_0xff5c0a,'userProfileId':_0x58cdff['userProfileId']},'raw':!![]})[_0xd44e('0x27')](function(_0x4b3be1){if(_0x4b3be1&&_0x4b3be1[_0xd44e('0x4f')]===0x0){return db[_0xd44e('0x50')]['create']({'name':_0x1809be[_0xd44e('0x2a')],'resourceId':_0x1809be['id'],'type':_0x4b3be1[_0xd44e('0x2a')],'sectionId':_0x4b3be1['id']},{})['then'](function(){return _0x2dd993;});}else{return _0x2dd993;}})[_0xd44e('0x47')](function(_0x1be4c5){logger[_0xd44e('0x29')](_0xd44e('0x51'),_0x1be4c5);throw _0x1be4c5;});}return _0x2dd993;})[_0xd44e('0x27')](respondWithResult(_0x4e7c33,0xc9))['catch'](handleError(_0x4e7c33,null));};exports['update']=function(_0xccba24,_0x59834c){if(_0xccba24[_0xd44e('0x4a')]['id']){delete _0xccba24[_0xd44e('0x4a')]['id'];}return db[_0xd44e('0x42')]['find']({'where':{'id':_0xccba24['params']['id']}})[_0xd44e('0x27')](handleEntityNotFound(_0x59834c,null))['then'](saveUpdates(_0xccba24[_0xd44e('0x4a')],null))['then'](respondWithResult(_0x59834c,null))['catch'](handleError(_0x59834c,null));};exports[_0xd44e('0x26')]=function(_0x52591a,_0x2c617c){return db[_0xd44e('0x42')]['find']({'where':{'id':_0x52591a['params']['id']}})['then'](handleEntityNotFound(_0x2c617c,null))[_0xd44e('0x27')](removeEntity(_0x2c617c,null))[_0xd44e('0x47')](handleError(_0x2c617c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index be2493b..2530c04 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3779da,_0x4620a8){var _0x150468=function(_0xa68f37){while(--_0xa68f37){_0x3779da['push'](_0x3779da['shift']());}};_0x150468(++_0x4620a8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1626d2,_0x346ccf){_0x1626d2=_0x1626d2-0x0;var _0x30ec47=_0x1cb9[_0x1626d2];return _0x30ec47;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x23e5a7,_0x45e4e3){var _0xa716f9=function(_0x1fd4c2){while(--_0x1fd4c2){_0x23e5a7['push'](_0x23e5a7['shift']());}};_0xa716f9(++_0x45e4e3);}(_0x326f,0xd1));var _0xf326=function(_0x1c46ed,_0x4261cf){_0x1c46ed=_0x1c46ed-0x0;var _0x24cf30=_0x326f[_0x1c46ed];return _0x24cf30;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 64eb7aa..801fa8a 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xc783e7,_0x1c180b){var _0x25fad5=function(_0x40743d){while(--_0x40743d){_0xc783e7['push'](_0xc783e7['shift']());}};_0x25fad5(++_0x1c180b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aaeac,_0x30bda5){_0x2aaeac=_0x2aaeac-0x0;var _0x757741=_0xb10b[_0x2aaeac];return _0x757741;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x4f1765,_0x56b70c){var _0x394bb3=function(_0x1b28eb){while(--_0x1b28eb){_0x4f1765['push'](_0x4f1765['shift']());}};_0x394bb3(++_0x56b70c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0xb10b[_0x4cc280];return _0x16ed24;};'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 e57ca49..170b1e6 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 _0x3937=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x266850,_0x821b6b){var _0x3708bc=function(_0x3983c2){while(--_0x3983c2){_0x266850['push'](_0x266850['shift']());}};_0x3708bc(++_0x821b6b);}(_0x3937,0xbf));var _0x7393=function(_0x59fc8d,_0x1679a0){_0x59fc8d=_0x59fc8d-0x0;var _0x1212a0=_0x3937[_0x59fc8d];return _0x1212a0;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),controller[_0x7393('0xb')]);router[_0x7393('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0xc')]);router[_0x7393('0x7')](_0x7393('0xd'),auth['isAuthenticated'](),controller[_0x7393('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ed4c,_0x47c5c6,_0x497b6b){_0x497b6b(null,path[_0x7393('0xf')](config[_0x7393('0x10')],_0x7393('0x11')));},'filename':function(_0x4fb764,_0x79fc4e,_0x470f09){_0x79fc4e[_0x7393('0x12')]=_0x79fc4e[_0x7393('0x12')][_0x7393('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x470f09(null,util[_0x7393('0x14')](_0x7393('0x15'),path[_0x7393('0x16')](_0x79fc4e[_0x7393('0x12')],path['extname'](_0x79fc4e['originalname'])),Date[_0x7393('0x17')](),path['extname'](_0x79fc4e['originalname'])));}})});router['post']('/',upload[_0x7393('0x18')]('file'),controller[_0x7393('0x19')]);router[_0x7393('0x1a')]('/webhook',controller[_0x7393('0x1b')]);router['put']('/:id',auth[_0x7393('0x8')](),controller[_0x7393('0x1c')]);router[_0x7393('0x1d')](_0x7393('0x1e'),auth[_0x7393('0x8')](),controller[_0x7393('0x1d')]);module[_0x7393('0x1f')]=router; \ No newline at end of file +var _0xb821=['upload','post','update','delete','exports','util','path','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','basename','extname','single'];(function(_0x2b4f0d,_0x55cafe){var _0x2ac97c=function(_0x2f9550){while(--_0x2f9550){_0x2b4f0d['push'](_0x2b4f0d['shift']());}};_0x2ac97c(++_0x55cafe);}(_0xb821,0xa7));var _0x1b82=function(_0x292623,_0x3cf9b0){_0x292623=_0x292623-0x0;var _0x3237b3=_0xb821[_0x292623];return _0x3237b3;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),controller[_0x1b82('0x9')]);router[_0x1b82('0x6')](_0x1b82('0xa'),auth[_0x1b82('0xb')](),controller[_0x1b82('0xc')]);router[_0x1b82('0x6')]('/:id/download',auth[_0x1b82('0xb')](),controller[_0x1b82('0xd')]);var upload=multer({'storage':multer[_0x1b82('0xe')]({'destination':function(_0x14c57a,_0xcffb87,_0x17a96b){_0x17a96b(null,path[_0x1b82('0xf')](config[_0x1b82('0x10')],'server/files/plugins'));},'filename':function(_0x46007e,_0x241d11,_0x2391f5){_0x241d11[_0x1b82('0x11')]=_0x241d11['originalname'][_0x1b82('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2391f5(null,util['format']('%s-%s%s',path[_0x1b82('0x13')](_0x241d11['originalname'],path[_0x1b82('0x14')](_0x241d11[_0x1b82('0x11')])),Date['now'](),path[_0x1b82('0x14')](_0x241d11['originalname'])));}})});router['post']('/',upload[_0x1b82('0x15')]('file'),controller[_0x1b82('0x16')]);router[_0x1b82('0x17')](_0x1b82('0x8'),controller['webhookPost']);router['put'](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x18')]);router[_0x1b82('0x19')](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x19')]);module[_0x1b82('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e3b16c9..d86c13c 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 _0xa9c4=['sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x57888a,_0x1b4200){var _0x4ff109=function(_0x47eccc){while(--_0x47eccc){_0x57888a['push'](_0x57888a['shift']());}};_0x4ff109(++_0x1b4200);}(_0xa9c4,0x1c3));var _0x4a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4a9c('0x0'));module[_0x4a9c('0x1')]={'name':{'type':Sequelize[_0x4a9c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4a9c('0x3'),_0x4a9c('0x4'))},'description':{'type':Sequelize[_0x4a9c('0x5')]},'version':{'type':Sequelize[_0x4a9c('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x4a9c('0x6')},'active':{'type':Sequelize[_0x4a9c('0x7')],'defaultValue':0x0,'comment':_0x4a9c('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly',_0x4a9c('0x9'),'never'),'defaultValue':_0x4a9c('0x9'),'comment':_0x4a9c('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x4a9c('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4a9c('0x2')]},'scriptPath':{'type':Sequelize[_0x4a9c('0x2')]}}; \ No newline at end of file +var _0xbb32=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script'];(function(_0x4c71b5,_0x57f87e){var _0x24787f=function(_0x373282){while(--_0x373282){_0x4c71b5['push'](_0x4c71b5['shift']());}};_0x24787f(++_0x57f87e);}(_0xbb32,0x1a8));var _0x2bb3=function(_0x3c5cc8,_0x336027){_0x3c5cc8=_0x3c5cc8-0x0;var _0x44675c=_0xbb32[_0x3c5cc8];return _0x44675c;};'use strict';var Sequelize=require(_0x2bb3('0x0'));module[_0x2bb3('0x1')]={'name':{'type':Sequelize[_0x2bb3('0x2')]},'type':{'type':Sequelize['ENUM'](_0x2bb3('0x3'),_0x2bb3('0x4'))},'description':{'type':Sequelize[_0x2bb3('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x2bb3('0x2')],'comment':_0x2bb3('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2bb3('0x7')},'sidebar':{'type':Sequelize[_0x2bb3('0x8')]('adminOnly',_0x2bb3('0x9'),_0x2bb3('0xa'),_0x2bb3('0xb')),'defaultValue':'always','comment':_0x2bb3('0xc')},'icon':{'type':Sequelize[_0x2bb3('0x2')]},'adminUrl':{'type':Sequelize[_0x2bb3('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x2bb3('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4c0940c..4ed135b 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 _0x3a31=['attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','method','rimraf','fast-json-patch','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','extract-zip','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','download','find','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','dirname','node_modules/**/*'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3a31,0xef));var _0x13a3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3a31[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13a3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13a3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x13a3('0x2'));var path=require(_0x13a3('0x3'));var sox=require('sox');var csv=require(_0x13a3('0x4'));var ejs=require(_0x13a3('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13a3('0x6'));var squel=require(_0x13a3('0x7'));var crypto=require(_0x13a3('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x13a3('0x9'));var toCsv=require('to-csv');var querystring=require(_0x13a3('0xa'));var Papa=require('papaparse');var extract=require(_0x13a3('0xb'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x13a3('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x13a3('0xd'));var hardwareService=require(_0x13a3('0xe'));var logger=require('../../config/logger')(_0x13a3('0xf'));var utils=require(_0x13a3('0x10'));var config=require(_0x13a3('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x13a3('0x12')]=_[_0x13a3('0x13')](config[_0x13a3('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x13a3('0x14'))(new Redis(config[_0x13a3('0x12')]));require(_0x13a3('0x15'))[_0x13a3('0x16')](socket);function respondWithStatusCode(_0x128d1a,_0x4b6bc8){_0x4b6bc8=_0x4b6bc8||0xcc;return function(_0x4b0911){if(_0x4b0911){return _0x128d1a[_0x13a3('0x17')](_0x4b6bc8);}return _0x128d1a[_0x13a3('0x18')](_0x4b6bc8)[_0x13a3('0x19')]();};}function respondWithResult(_0x2c8af6,_0xa07653){_0xa07653=_0xa07653||0xc8;return function(_0x2d7242){if(_0x2d7242){return _0x2c8af6[_0x13a3('0x18')](_0xa07653)[_0x13a3('0x1a')](_0x2d7242);}};}function respondWithFilteredResult(_0x4453d3,_0x4236a7){return function(_0x1241aa){if(_0x1241aa){var _0x173edd=typeof _0x4236a7[_0x13a3('0x1b')]==='undefined'&&typeof _0x4236a7[_0x13a3('0x1c')]===_0x13a3('0x1d');var _0x3d2914=_0x1241aa['count'];var _0x2f49fc=_0x173edd?0x0:_0x4236a7['offset'];var _0xdabd9d=_0x173edd?_0x1241aa[_0x13a3('0x1e')]:_0x4236a7[_0x13a3('0x1b')]+_0x4236a7[_0x13a3('0x1c')];var _0x3432f4;if(_0xdabd9d>=_0x3d2914){_0xdabd9d=_0x3d2914;_0x3432f4=0xc8;}else{_0x3432f4=0xce;}_0x4453d3['status'](_0x3432f4);return _0x4453d3[_0x13a3('0x1f')](_0x13a3('0x20'),_0x2f49fc+'-'+_0xdabd9d+'/'+_0x3d2914)[_0x13a3('0x1a')](_0x1241aa);}return null;};}function patchUpdates(_0x25694a){return function(_0x11de68){try{jsonpatch[_0x13a3('0x21')](_0x11de68,_0x25694a,!![]);}catch(_0x95b3e1){return BPromise[_0x13a3('0x22')](_0x95b3e1);}return _0x11de68[_0x13a3('0x23')]();};}function saveUpdates(_0x2d8403,_0x37e870){return function(_0x548e01){if(_0x548e01){return _0x548e01[_0x13a3('0x24')](_0x2d8403)[_0x13a3('0x25')](function(_0x50e9dc){return _0x50e9dc;});}return null;};}function removeEntity(_0x3d041b,_0x167272){return function(_0x1e9cc4){if(_0x1e9cc4){return _0x1e9cc4[_0x13a3('0x26')]()[_0x13a3('0x25')](function(){var _0x406aec=_0x1e9cc4[_0x13a3('0x27')]({'plain':!![]});var _0x235830=_0x13a3('0x28');return db[_0x13a3('0x29')][_0x13a3('0x26')]({'where':{'type':_0x235830,'resourceId':_0x406aec['id']}})[_0x13a3('0x25')](function(){return _0x1e9cc4;});})[_0x13a3('0x25')](function(){_0x3d041b['status'](0xcc)[_0x13a3('0x19')]();});}};}function handleEntityNotFound(_0x3d1796,_0x399fe3){return function(_0x25e06a){if(!_0x25e06a){_0x3d1796[_0x13a3('0x17')](0x194);}return _0x25e06a;};}function handleError(_0x5df6e4,_0x512cb8){_0x512cb8=_0x512cb8||0x1f4;return function(_0x1933c3){logger[_0x13a3('0x2a')](_0x1933c3[_0x13a3('0x2b')]);if(_0x1933c3[_0x13a3('0x2c')]){delete _0x1933c3['name'];}_0x5df6e4['status'](_0x512cb8)[_0x13a3('0x2d')](_0x1933c3);};}exports[_0x13a3('0x2e')]=function(_0xab6edd,_0x298c05){var _0x568e80={},_0x22ac36={},_0x5ac421={'count':0x0,'rows':[]};var _0x38a1e7=_[_0x13a3('0x2f')](db[_0x13a3('0x30')][_0x13a3('0x31')],function(_0x418b0c){return{'name':_0x418b0c[_0x13a3('0x32')],'type':_0x418b0c[_0x13a3('0x33')]['key']};});_0x22ac36[_0x13a3('0x34')]=_[_0x13a3('0x2f')](_0x38a1e7,_0x13a3('0x2c'));_0x22ac36[_0x13a3('0x35')]=_[_0x13a3('0x36')](_0xab6edd['query']);_0x22ac36[_0x13a3('0x37')]=_[_0x13a3('0x38')](_0x22ac36[_0x13a3('0x34')],_0x22ac36['query']);_0x568e80[_0x13a3('0x39')]=_[_0x13a3('0x38')](_0x22ac36[_0x13a3('0x34')],qs[_0x13a3('0x3a')](_0xab6edd[_0x13a3('0x35')]['fields']));_0x568e80[_0x13a3('0x39')]=_0x568e80[_0x13a3('0x39')][_0x13a3('0x3b')]?_0x568e80[_0x13a3('0x39')]:_0x22ac36[_0x13a3('0x34')];if(!_0xab6edd[_0x13a3('0x35')][_0x13a3('0x3c')](_0x13a3('0x3d'))){_0x568e80[_0x13a3('0x1c')]=qs[_0x13a3('0x1c')](_0xab6edd[_0x13a3('0x35')]['limit']);_0x568e80[_0x13a3('0x1b')]=qs[_0x13a3('0x1b')](_0xab6edd['query'][_0x13a3('0x1b')]);}_0x568e80[_0x13a3('0x3e')]=qs[_0x13a3('0x3f')](_0xab6edd[_0x13a3('0x35')][_0x13a3('0x3f')]);_0x568e80[_0x13a3('0x40')]=qs['filters'](_['pick'](_0xab6edd[_0x13a3('0x35')],_0x22ac36[_0x13a3('0x37')]),_0x38a1e7);if(_0xab6edd[_0x13a3('0x35')][_0x13a3('0x41')]){_0x568e80[_0x13a3('0x40')]=_[_0x13a3('0x42')](_0x568e80[_0x13a3('0x40')],{'$or':_['map'](_0x38a1e7,function(_0x3fe757){if(_0x3fe757[_0x13a3('0x33')]!==_0x13a3('0x43')){var _0x349e72={};_0x349e72[_0x3fe757[_0x13a3('0x2c')]]={'$like':'%'+_0xab6edd[_0x13a3('0x35')][_0x13a3('0x41')]+'%'};return _0x349e72;}})});}_0x568e80=_[_0x13a3('0x42')]({},_0x568e80,_0xab6edd[_0x13a3('0x44')]);var _0x232ac7={'where':_0x568e80['where']};return db[_0x13a3('0x30')][_0x13a3('0x1e')](_0x232ac7)[_0x13a3('0x25')](function(_0x1e7397){_0x5ac421['count']=_0x1e7397;if(_0xab6edd[_0x13a3('0x35')]['includeAll']){_0x568e80[_0x13a3('0x45')]=[{'all':!![]}];}return db[_0x13a3('0x30')][_0x13a3('0x46')](_0x568e80);})[_0x13a3('0x25')](function(_0x522bee){_0x5ac421[_0x13a3('0x47')]=_0x522bee;return _0x5ac421;})[_0x13a3('0x25')](respondWithFilteredResult(_0x298c05,_0x568e80))['catch'](handleError(_0x298c05,null));};exports['show']=function(_0x4a9c5d,_0x51b2dd){var _0x55d791={'raw':!![],'where':{'id':_0x4a9c5d[_0x13a3('0x48')]['id']}},_0x1c6ae6={};_0x1c6ae6[_0x13a3('0x34')]=_[_0x13a3('0x36')](db[_0x13a3('0x30')][_0x13a3('0x31')]);_0x1c6ae6[_0x13a3('0x35')]=_[_0x13a3('0x36')](_0x4a9c5d['query']);_0x1c6ae6[_0x13a3('0x37')]=_[_0x13a3('0x38')](_0x1c6ae6['model'],_0x1c6ae6[_0x13a3('0x35')]);_0x55d791['attributes']=_[_0x13a3('0x38')](_0x1c6ae6['model'],qs[_0x13a3('0x3a')](_0x4a9c5d[_0x13a3('0x35')][_0x13a3('0x3a')]));_0x55d791['attributes']=_0x55d791['attributes'][_0x13a3('0x3b')]?_0x55d791['attributes']:_0x1c6ae6[_0x13a3('0x34')];if(_0x4a9c5d[_0x13a3('0x35')][_0x13a3('0x49')]){_0x55d791[_0x13a3('0x45')]=[{'all':!![]}];}_0x55d791=_[_0x13a3('0x42')]({},_0x55d791,_0x4a9c5d['options']);return db[_0x13a3('0x30')]['find'](_0x55d791)[_0x13a3('0x25')](handleEntityNotFound(_0x51b2dd,null))[_0x13a3('0x25')](respondWithResult(_0x51b2dd,null))[_0x13a3('0x4a')](handleError(_0x51b2dd,null));};exports[_0x13a3('0x4b')]=function(_0x34545f,_0x1f6f03,_0x16053a){return db[_0x13a3('0x30')][_0x13a3('0x4c')]({'where':{'id':_0x34545f[_0x13a3('0x48')]['id']},'attributes':[_0x13a3('0x2c'),'path'],'raw':!![]})[_0x13a3('0x25')](handleEntityNotFound(_0x1f6f03,null))[_0x13a3('0x25')](function(_0x35a3db){if(_0x35a3db){var _0x31085a=path['join'](config[_0x13a3('0x4d')],_0x13a3('0x4e'),util[_0x13a3('0x4f')](_0x13a3('0x50'),path[_0x13a3('0x51')](_0x35a3db[_0x13a3('0x3')])));var _0x21f3ee=fs[_0x13a3('0x52')](_0x31085a);var _0x443951=archiver(_0x13a3('0x53'),{'zlib':{'level':0x9}});_0x443951['on']('warning',function(_0x217b02){if(_0x217b02[_0x13a3('0x54')]===_0x13a3('0x55')){logger['error'](_0x217b02);}else{throw new db[(_0x13a3('0x56'))][(_0x13a3('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x443951['on']('error',function(_0x509a51){throw new db[(_0x13a3('0x56'))][(_0x13a3('0x57'))](_0x13a3('0x58'));});_0x443951[_0x13a3('0x59')](_0x21f3ee);_0x443951[_0x13a3('0x5a')](_0x13a3('0x5b'),{'cwd':path[_0x13a3('0x5c')](config[_0x13a3('0x4d')],_0x13a3('0x4e'),path[_0x13a3('0x5d')](_0x35a3db[_0x13a3('0x3')])),'ignore':[path[_0x13a3('0x5c')](path['basename'](_0x35a3db[_0x13a3('0x3')]),_0x13a3('0x5e')),path[_0x13a3('0x5c')](path['basename'](_0x35a3db[_0x13a3('0x3')]),_0x13a3('0x5f'))],'nodir':!![]})[_0x13a3('0x60')]();_0x21f3ee['on'](_0x13a3('0x61'),function(){if(!fs[_0x13a3('0x62')](_0x31085a)){throw new db['Sequelize']['Error'](_0x13a3('0x63'));}return _0x1f6f03['download'](_0x31085a,util['format'](_0x13a3('0x50'),path['basename'](_0x35a3db[_0x13a3('0x3')])),function(_0x9e4f83){if(_0x9e4f83){throw new db[(_0x13a3('0x56'))][(_0x13a3('0x57'))](_0x13a3('0x64'));}fs[_0x13a3('0x65')](_0x31085a);logger[_0x13a3('0x66')](_0x13a3('0x67'));logger['info'](_0x13a3('0x68'));});});}return null;})[_0x13a3('0x4a')](handleError(_0x1f6f03,null));};exports[_0x13a3('0x69')]=function(_0x23af34,_0x1b6725,_0x4fd675){var _0x226d89=path['basename'](_0x23af34[_0x13a3('0x6a')]['filename'],path[_0x13a3('0x6b')](_0x23af34[_0x13a3('0x6a')][_0x13a3('0x6c')]));var _0x1fcb3d=path[_0x13a3('0x5c')](config[_0x13a3('0x4d')],'server/files/plugins',_0x23af34['file'][_0x13a3('0x6c')]);var _0x1828fc=path[_0x13a3('0x5c')](config[_0x13a3('0x4d')],_0x13a3('0x4e'),_0x226d89);logger[_0x13a3('0x66')](_0x13a3('0x6d'),_0x1fcb3d);logger[_0x13a3('0x66')](_0x13a3('0x6e'),_0x1828fc);try{fs[_0x13a3('0x6f')](_0x1fcb3d,parseInt(_0x13a3('0x70'),0x8));extract(_0x1fcb3d,{'dir':_0x1828fc},function(_0x11d8b3){if(_0x11d8b3){logger[_0x13a3('0x2a')](_0x11d8b3);handleError(_0x11d8b3,!![]);};var _0x3934d6=fs[_0x13a3('0x71')](_0x1828fc);if(_0x3934d6[_0x13a3('0x3b')]>0x1){removeReferences(_0x1fcb3d,_0x1828fc);logger[_0x13a3('0x2a')](_0x13a3('0x72'));return _0x4fd675(new Error(_0x13a3('0x72')));}var _0x1c91c0=fs[_0x13a3('0x73')](path[_0x13a3('0x5c')](_0x1828fc,_0x3934d6[0x0]));if(_0x1c91c0[_0x13a3('0x74')]()){removeReferences(_0x1fcb3d,_0x1828fc);logger[_0x13a3('0x2a')]('Invalid\x20plugin\x20structure');return _0x4fd675(new Error(_0x13a3('0x72')));}if(_0x1c91c0['isDirectory']()){var _0x2cb591=fs['readdirSync'](path[_0x13a3('0x5c')](_0x1828fc,_0x3934d6[0x0]));if(_0x2cb591[_0x13a3('0x3b')]===0x0){removeReferences(_0x1fcb3d,_0x1828fc);logger[_0x13a3('0x2a')](_0x13a3('0x72'));return _0x4fd675(new Error(_0x13a3('0x72')));}var _0xb6699b=_0x2cb591['some'](function(_0x407ed2){return _0x407ed2==='manifest.json';});if(!_0xb6699b){return _0x4fd675(new Error(_0x13a3('0x75')));}var _0x2ad694=fs[_0x13a3('0x76')](path[_0x13a3('0x5c')](_0x1828fc,_0x3934d6[0x0],_0x13a3('0x77')));var _0x53fb54=JSON['parse'](_0x2ad694);if(_0x13a3('0x1d')==typeof _0x53fb54['name']){return _0x4fd675(new Error(_0x13a3('0x78')));}if('undefined'==typeof _0x53fb54[_0x13a3('0x33')]){return _0x4fd675(new Error(_0x13a3('0x79')));}if(_0x13a3('0x1d')==typeof _0x53fb54['version']){return _0x4fd675(new Error(_0x13a3('0x7a')));}if(_0x13a3('0x1d')==typeof _0x53fb54['parameters']){return _0x4fd675(new Error(_0x13a3('0x7b')));}if(_0x53fb54['type']===_0x13a3('0x7c')){if(_0x13a3('0x1d')==typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')]){return _0x4fd675(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')][_0x13a3('0x7f')]&&_0x13a3('0x1d')==typeof _0x53fb54['parameters']['views'][_0x13a3('0x80')]){return _0x4fd675(new Error(_0x13a3('0x81')));}}else if(_0x53fb54[_0x13a3('0x33')]===_0x13a3('0x82')){if(_0x13a3('0x1d')==typeof _0x53fb54[_0x13a3('0x7d')]['scriptName']){return _0x4fd675(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x13a3('0x1d')==typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x83')]){return _0x4fd675(new Error(_0x13a3('0x84')));}}else{return _0x4fd675(new Error(_0x13a3('0x85')));}var _0x421213=_0x53fb54[_0x13a3('0x2c')];var _0x3c3295=_0x53fb54[_0x13a3('0x86')];var _0x2f457c=_0x53fb54[_0x13a3('0x33')];var _0x3f0f86=_0x53fb54[_0x13a3('0x87')]?_0x53fb54[_0x13a3('0x87')]:_0x13a3('0x88');var _0x5b993a=_0x53fb54[_0x13a3('0x89')]?_0x53fb54[_0x13a3('0x89')]:_0x13a3('0x8a');var _0x555e1e='';var _0x2e51e8='';var _0x5772f9='';var _0x353962='';var _0x2080cc=_0x53fb54[_0x13a3('0x8b')];if(_0x2f457c===_0x13a3('0x7c')){if('undefined'!=typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')]['admin']){var _0x12ac85=_0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')][_0x13a3('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x13a3('0x8c')](_0x12ac85)){_0x555e1e=path[_0x13a3('0x5c')](_0x13a3('0x8d'),_0x226d89,_0x3934d6[0x0],_0x12ac85);}else{_0x555e1e=_0x12ac85;}}else{logger[_0x13a3('0x66')](_0x13a3('0x8e'));}if('undefined'!=typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')][_0x13a3('0x80')]){var _0x235874=_0x53fb54[_0x13a3('0x7d')]['views'][_0x13a3('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x13a3('0x8c')](_0x235874)){_0x2e51e8=path[_0x13a3('0x5c')](_0x13a3('0x8d'),_0x226d89,_0x3934d6[0x0],_0x235874);}else{_0x2e51e8=_0x235874;}}else{logger[_0x13a3('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2f457c===_0x13a3('0x82')){_0x5772f9=_0x53fb54[_0x13a3('0x7d')][_0x13a3('0x8f')];_0x353962=_0x53fb54[_0x13a3('0x7d')]['scriptPath'];if('undefined'!=typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')]){if(_0x13a3('0x1d')!=typeof _0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')]['admin']){var _0x12ac85=_0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')][_0x13a3('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x12ac85)){_0x555e1e=path[_0x13a3('0x5c')](_0x13a3('0x8d'),_0x226d89,_0x3934d6[0x0],_0x12ac85);}else{_0x555e1e=_0x12ac85;}}if('undefined'!=typeof _0x53fb54['parameters']['views'][_0x13a3('0x80')]){var _0x235874=_0x53fb54[_0x13a3('0x7d')][_0x13a3('0x7e')][_0x13a3('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x13a3('0x8c')](_0x235874)){_0x2e51e8=path[_0x13a3('0x5c')](_0x13a3('0x8d'),_0x226d89,_0x3934d6[0x0],_0x235874);}else{_0x2e51e8=_0x235874;}}}}var _0x49c038={'name':_0x421213,'description':_0x3c3295,'path':path['join'](_0x226d89,_0x3934d6[0x0]),'type':_0x2f457c,'sidebar':_0x3f0f86,'icon':_0x5b993a,'adminUrl':_0x555e1e,'agentUrl':_0x2e51e8,'scriptName':_0x5772f9,'scriptPath':_0x353962,'version':_0x2080cc};removeReferences(_0x1fcb3d,null);return db[_0x13a3('0x30')][_0x13a3('0x90')](_0x49c038)[_0x13a3('0x25')](function(_0x460066){var _0x3f9768={'role':_0x23af34['body'][_0x13a3('0x91')],'userProfileId':_0x23af34['body'][_0x13a3('0x92')]};if(!_0x3f9768)throw new Error(_0x13a3('0x93'));if(_0x3f9768[_0x13a3('0x91')]===_0x13a3('0x94')){var _0x1901d6=_0x460066[_0x13a3('0x27')]({'plain':!![]});return db[_0x13a3('0x95')]['find']({'where':{'name':_0x13a3('0x28'),'userProfileId':_0x3f9768['userProfileId']},'raw':!![]})['then'](function(_0x2ec71c){if(_0x2ec71c&&_0x2ec71c['autoAssociation']===0x0){return db['UserProfileResource'][_0x13a3('0x90')]({'name':_0x1901d6[_0x13a3('0x2c')],'resourceId':_0x1901d6['id'],'type':_0x2ec71c[_0x13a3('0x2c')],'sectionId':_0x2ec71c['id']},{})[_0x13a3('0x25')](function(){return _0x460066;});}else{return _0x460066;}})[_0x13a3('0x4a')](function(_0x3569ba){logger[_0x13a3('0x2a')](_0x13a3('0x96'),_0x3569ba);throw _0x3569ba;});}return _0x460066;})[_0x13a3('0x25')](respondWithResult(_0x1b6725,null))[_0x13a3('0x4a')](handleError(_0x1b6725,null));}});}catch(_0x100abe){_0x1b6725[_0x13a3('0x18')](0x1f4)[_0x13a3('0x2d')](_0x100abe);}};function removeReferences(_0x5260e7,_0x523b62){try{if(_0x5260e7){fs['unlinkSync'](_0x5260e7);logger[_0x13a3('0x66')]('Zip\x20archive\x20removed');}if(_0x523b62){rimraf(_0x523b62,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x1eda01){logger['error'](_0x1eda01);}}exports[_0x13a3('0x24')]=function(_0x4ba758,_0x3823d3,_0x167c8f){return db[_0x13a3('0x30')][_0x13a3('0x4c')]({'where':{'id':_0x4ba758[_0x13a3('0x48')]['id']}})[_0x13a3('0x25')](handleEntityNotFound(_0x3823d3,null))[_0x13a3('0x25')](saveUpdates(_0x4ba758[_0x13a3('0x97')],null))[_0x13a3('0x25')](respondWithResult(_0x3823d3,null))[_0x13a3('0x4a')](handleError(_0x3823d3,null));};exports[_0x13a3('0x98')]=function(_0x579c04,_0x446d72,_0x961949){return db[_0x13a3('0x30')]['find']({'where':{'id':_0x579c04[_0x13a3('0x48')]['id']}})[_0x13a3('0x25')](function(_0x2beb93){if(_0x2beb93){return _0x2beb93[_0x13a3('0x26')]();}})['then'](function(_0x1fdce4){rimraf(path[_0x13a3('0x5c')](config['root'],_0x13a3('0x4e'),path['dirname'](_0x1fdce4[_0x13a3('0x3')])),function(){});return _0x1fdce4;})[_0x13a3('0x25')](handleEntityNotFound(_0x446d72,null))['then'](respondWithStatusCode(_0x446d72,null))[_0x13a3('0x4a')](handleError(_0x446d72,null));};exports[_0x13a3('0x99')]=function(_0x976158,_0x5b2c03,_0x43b3e5){return BPromise[_0x13a3('0x9a')]()[_0x13a3('0x25')](function(){if(!_0x976158[_0x13a3('0x35')][_0x13a3('0x3')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x976158[_0x13a3('0x35')][_0x13a3('0x9b')]){throw new Error(_0x13a3('0x9c'));}var _0x1cef6c=_0x976158[_0x13a3('0x35')]['hostname']?_0x976158[_0x13a3('0x35')]['hostname']+':'+_0x976158[_0x13a3('0x35')][_0x13a3('0x9b')]:_0x13a3('0x9d')+_0x976158['query'][_0x13a3('0x9b')];var _0x1c7841=_0x976158[_0x13a3('0x35')]['json']?_0x976158[_0x13a3('0x35')][_0x13a3('0x1a')]:!![];var _0x5a3df5=_0x976158['query'][_0x13a3('0x9e')]?_0x976158[_0x13a3('0x35')]['encoding']:null;var _0x20905f={'method':_0x976158['method'],'uri':util[_0x13a3('0x4f')](_0x13a3('0x9f'),_0x1cef6c,_0x976158[_0x13a3('0x35')]['path']),'json':_0x1c7841,'resolveWithFullResponse':!![],'encoding':_0x5a3df5,'qs':_0x976158[_0x13a3('0x35')]};if(_0x976158[_0x13a3('0xa0')]){_0x20905f['headers']=_0x976158[_0x13a3('0xa0')];if(_0x20905f[_0x13a3('0xa0')][_0x13a3('0xa1')]){delete _0x20905f[_0x13a3('0xa0')][_0x13a3('0xa1')];}}if(_0x20905f[_0x13a3('0xa0')][_0x13a3('0xa2')]){delete _0x20905f[_0x13a3('0xa0')][_0x13a3('0xa2')];}return rp(_0x20905f);})[_0x13a3('0x25')](function(_0x38e932){if(_0x38e932){_0x5b2c03[_0x13a3('0x1f')](_0x38e932[_0x13a3('0xa0')]);logger['info'](_0x38e932[_0x13a3('0x97')]);if(_['endsWith'](_0x976158[_0x13a3('0x35')][_0x13a3('0x3')],_0x13a3('0x4b'))&&_0x38e932[_0x13a3('0xa3')]==0x1f4){return _0x5b2c03['sendStatus'](_0x38e932[_0x13a3('0xa3')]);}else{return _0x5b2c03[_0x13a3('0x18')](_0x38e932[_0x13a3('0xa3')])[_0x13a3('0x2d')](_0x38e932['body']);}}else{return _0x5b2c03['sendStatus'](0xc8);}})[_0x13a3('0x4a')](handleError(_0x5b2c03,null));};exports['webhookPost']=function(_0x57b4d9,_0xbf2880,_0x46f93e){return BPromise[_0x13a3('0x9a')]()['then'](function(){if(!_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x3')]){throw new Error(_0x13a3('0xa4'));}if(!_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x9b')]){throw new Error(_0x13a3('0x9c'));}var _0x17ce47=_0x57b4d9[_0x13a3('0x35')][_0x13a3('0xa5')]?_0x57b4d9[_0x13a3('0x35')][_0x13a3('0xa5')]+':'+_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x9b')]:_0x13a3('0x9d')+_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x9b')];var _0x372909=_0x57b4d9[_0x13a3('0x35')]['json']?_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x1a')]:!![];var _0x237f35=_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x9e')]?_0x57b4d9[_0x13a3('0x35')][_0x13a3('0x9e')]:null;var _0x42e010={'method':_0x57b4d9[_0x13a3('0xa6')],'uri':util[_0x13a3('0x4f')](_0x13a3('0x9f'),_0x17ce47,_0x57b4d9[_0x13a3('0x35')]['path']),'json':_0x372909,'resolveWithFullResponse':!![],'encoding':_0x237f35,'body':_0x57b4d9[_0x13a3('0x97')]};if(_0x57b4d9[_0x13a3('0xa0')]){_0x42e010[_0x13a3('0xa0')]=_0x57b4d9[_0x13a3('0xa0')];if(_0x42e010[_0x13a3('0xa0')][_0x13a3('0xa1')]){delete _0x42e010[_0x13a3('0xa0')]['content-length'];}}if(_0x42e010['headers'][_0x13a3('0xa2')]){delete _0x42e010[_0x13a3('0xa0')][_0x13a3('0xa2')];}return rp(_0x42e010);})[_0x13a3('0x25')](function(_0x3ceab4){if(_0x3ceab4){_0xbf2880[_0x13a3('0x1f')](_0x3ceab4['headers']);logger[_0x13a3('0x66')](_0x3ceab4[_0x13a3('0x97')]);return _0xbf2880[_0x13a3('0x18')](_0x3ceab4[_0x13a3('0xa3')])[_0x13a3('0x2d')](_0x3ceab4[_0x13a3('0x97')]);}else{return _0xbf2880[_0x13a3('0x17')](0xc8);}})['catch'](handleError(_0xbf2880,null));}; \ No newline at end of file +var _0x1f27=['limit','undefined','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','params','include','download','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','dirname','basename','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','create','body','role','userProfileId','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','destroy','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x1f27,0x1d4));var _0x71f2=function(_0x1791ab,_0x141979){_0x1791ab=_0x1791ab-0x0;var _0x5447c8=_0x1f27[_0x1791ab];return _0x5447c8;};'use strict';var emlformat=require(_0x71f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71f2('0x1'));var jsonpatch=require(_0x71f2('0x2'));var rp=require(_0x71f2('0x3'));var moment=require(_0x71f2('0x4'));var BPromise=require(_0x71f2('0x5'));var Mustache=require(_0x71f2('0x6'));var util=require('util');var path=require(_0x71f2('0x7'));var sox=require(_0x71f2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71f2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x71f2('0xa'));var jsforce=require(_0x71f2('0xb'));var deskjs=require(_0x71f2('0xc'));var toCsv=require(_0x71f2('0xd'));var querystring=require(_0x71f2('0xe'));var Papa=require(_0x71f2('0xf'));var extract=require(_0x71f2('0x10'));var rimraf=require('rimraf');var archiver=require(_0x71f2('0x11'));var Redis=require(_0x71f2('0x12'));var authService=require(_0x71f2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x71f2('0x14'));var hardwareService=require(_0x71f2('0x15'));var logger=require(_0x71f2('0x16'))(_0x71f2('0x17'));var utils=require(_0x71f2('0x18'));var config=require(_0x71f2('0x19'));var licenseUtil=require(_0x71f2('0x1a'));var db=require('../../mysqldb')['db'];config[_0x71f2('0x1b')]=_[_0x71f2('0x1c')](config[_0x71f2('0x1b')],{'host':_0x71f2('0x1d'),'port':0x18eb});var socket=require(_0x71f2('0x1e'))(new Redis(config[_0x71f2('0x1b')]));require('./plugin.socket')[_0x71f2('0x1f')](socket);function respondWithStatusCode(_0x4af85b,_0x3df867){_0x3df867=_0x3df867||0xcc;return function(_0x3ec90b){if(_0x3ec90b){return _0x4af85b[_0x71f2('0x20')](_0x3df867);}return _0x4af85b['status'](_0x3df867)['end']();};}function respondWithResult(_0x4343a7,_0x33557c){_0x33557c=_0x33557c||0xc8;return function(_0xf56513){if(_0xf56513){return _0x4343a7[_0x71f2('0x21')](_0x33557c)[_0x71f2('0x22')](_0xf56513);}};}function respondWithFilteredResult(_0x42898a,_0x4d13ea){return function(_0x22a40b){if(_0x22a40b){var _0x2dc46b=typeof _0x4d13ea[_0x71f2('0x23')]==='undefined'&&typeof _0x4d13ea[_0x71f2('0x24')]===_0x71f2('0x25');var _0x4eb09a=_0x22a40b[_0x71f2('0x26')];var _0x28272c=_0x2dc46b?0x0:_0x4d13ea[_0x71f2('0x23')];var _0x5ad4f3=_0x2dc46b?_0x22a40b[_0x71f2('0x26')]:_0x4d13ea[_0x71f2('0x23')]+_0x4d13ea[_0x71f2('0x24')];var _0x401389;if(_0x5ad4f3>=_0x4eb09a){_0x5ad4f3=_0x4eb09a;_0x401389=0xc8;}else{_0x401389=0xce;}_0x42898a[_0x71f2('0x21')](_0x401389);return _0x42898a[_0x71f2('0x27')](_0x71f2('0x28'),_0x28272c+'-'+_0x5ad4f3+'/'+_0x4eb09a)['json'](_0x22a40b);}return null;};}function patchUpdates(_0x5e5394){return function(_0x2f91db){try{jsonpatch[_0x71f2('0x29')](_0x2f91db,_0x5e5394,!![]);}catch(_0x38c019){return BPromise['reject'](_0x38c019);}return _0x2f91db[_0x71f2('0x2a')]();};}function saveUpdates(_0xd41932,_0x51b241){return function(_0x394678){if(_0x394678){return _0x394678[_0x71f2('0x2b')](_0xd41932)[_0x71f2('0x2c')](function(_0x567b4e){return _0x567b4e;});}return null;};}function removeEntity(_0x219821,_0x2e455c){return function(_0x4befde){if(_0x4befde){return _0x4befde['destroy']()[_0x71f2('0x2c')](function(){var _0x16b64f=_0x4befde[_0x71f2('0x2d')]({'plain':!![]});var _0x75a4b5=_0x71f2('0x2e');return db[_0x71f2('0x2f')]['destroy']({'where':{'type':_0x75a4b5,'resourceId':_0x16b64f['id']}})['then'](function(){return _0x4befde;});})[_0x71f2('0x2c')](function(){_0x219821[_0x71f2('0x21')](0xcc)[_0x71f2('0x30')]();});}};}function handleEntityNotFound(_0x2fcf58,_0x12e131){return function(_0x1d16fc){if(!_0x1d16fc){_0x2fcf58[_0x71f2('0x20')](0x194);}return _0x1d16fc;};}function handleError(_0x2bebe9,_0x13d8ca){_0x13d8ca=_0x13d8ca||0x1f4;return function(_0x43978a){logger[_0x71f2('0x31')](_0x43978a[_0x71f2('0x32')]);if(_0x43978a[_0x71f2('0x33')]){delete _0x43978a[_0x71f2('0x33')];}_0x2bebe9['status'](_0x13d8ca)[_0x71f2('0x34')](_0x43978a);};}exports[_0x71f2('0x35')]=function(_0xe97e69,_0x1280b7){var _0x21c9f8={},_0x472513={},_0x853749={'count':0x0,'rows':[]};var _0x5b3678=_[_0x71f2('0x36')](db[_0x71f2('0x37')][_0x71f2('0x38')],function(_0x3c713){return{'name':_0x3c713[_0x71f2('0x39')],'type':_0x3c713[_0x71f2('0x3a')][_0x71f2('0x3b')]};});_0x472513['model']=_['map'](_0x5b3678,_0x71f2('0x33'));_0x472513['query']=_[_0x71f2('0x3c')](_0xe97e69[_0x71f2('0x3d')]);_0x472513[_0x71f2('0x3e')]=_[_0x71f2('0x3f')](_0x472513[_0x71f2('0x40')],_0x472513['query']);_0x21c9f8[_0x71f2('0x41')]=_['intersection'](_0x472513[_0x71f2('0x40')],qs[_0x71f2('0x42')](_0xe97e69[_0x71f2('0x3d')][_0x71f2('0x42')]));_0x21c9f8[_0x71f2('0x41')]=_0x21c9f8['attributes'][_0x71f2('0x43')]?_0x21c9f8[_0x71f2('0x41')]:_0x472513[_0x71f2('0x40')];if(!_0xe97e69['query'][_0x71f2('0x44')]('nolimit')){_0x21c9f8[_0x71f2('0x24')]=qs[_0x71f2('0x24')](_0xe97e69[_0x71f2('0x3d')][_0x71f2('0x24')]);_0x21c9f8[_0x71f2('0x23')]=qs[_0x71f2('0x23')](_0xe97e69['query']['offset']);}_0x21c9f8[_0x71f2('0x45')]=qs[_0x71f2('0x46')](_0xe97e69[_0x71f2('0x3d')]['sort']);_0x21c9f8[_0x71f2('0x47')]=qs['filters'](_['pick'](_0xe97e69[_0x71f2('0x3d')],_0x472513[_0x71f2('0x3e')]),_0x5b3678);if(_0xe97e69[_0x71f2('0x3d')][_0x71f2('0x48')]){_0x21c9f8['where']=_['merge'](_0x21c9f8[_0x71f2('0x47')],{'$or':_['map'](_0x5b3678,function(_0x5932c1){if(_0x5932c1[_0x71f2('0x3a')]!=='VIRTUAL'){var _0x250d62={};_0x250d62[_0x5932c1[_0x71f2('0x33')]]={'$like':'%'+_0xe97e69[_0x71f2('0x3d')][_0x71f2('0x48')]+'%'};return _0x250d62;}})});}_0x21c9f8=_[_0x71f2('0x49')]({},_0x21c9f8,_0xe97e69[_0x71f2('0x4a')]);var _0x334457={'where':_0x21c9f8[_0x71f2('0x47')]};return db[_0x71f2('0x37')]['count'](_0x334457)[_0x71f2('0x2c')](function(_0x11a7a5){_0x853749[_0x71f2('0x26')]=_0x11a7a5;if(_0xe97e69[_0x71f2('0x3d')][_0x71f2('0x4b')]){_0x21c9f8['include']=[{'all':!![]}];}return db[_0x71f2('0x37')][_0x71f2('0x4c')](_0x21c9f8);})[_0x71f2('0x2c')](function(_0x1241ab){_0x853749['rows']=_0x1241ab;return _0x853749;})[_0x71f2('0x2c')](respondWithFilteredResult(_0x1280b7,_0x21c9f8))[_0x71f2('0x4d')](handleError(_0x1280b7,null));};exports[_0x71f2('0x4e')]=function(_0x471aa7,_0x3d1cd3){var _0x27b3af={'raw':!![],'where':{'id':_0x471aa7[_0x71f2('0x4f')]['id']}},_0x2d2993={};_0x2d2993['model']=_[_0x71f2('0x3c')](db[_0x71f2('0x37')][_0x71f2('0x38')]);_0x2d2993[_0x71f2('0x3d')]=_['keys'](_0x471aa7['query']);_0x2d2993['filters']=_[_0x71f2('0x3f')](_0x2d2993[_0x71f2('0x40')],_0x2d2993['query']);_0x27b3af[_0x71f2('0x41')]=_[_0x71f2('0x3f')](_0x2d2993[_0x71f2('0x40')],qs[_0x71f2('0x42')](_0x471aa7[_0x71f2('0x3d')][_0x71f2('0x42')]));_0x27b3af['attributes']=_0x27b3af[_0x71f2('0x41')][_0x71f2('0x43')]?_0x27b3af[_0x71f2('0x41')]:_0x2d2993[_0x71f2('0x40')];if(_0x471aa7[_0x71f2('0x3d')][_0x71f2('0x4b')]){_0x27b3af[_0x71f2('0x50')]=[{'all':!![]}];}_0x27b3af=_[_0x71f2('0x49')]({},_0x27b3af,_0x471aa7[_0x71f2('0x4a')]);return db['Plugin']['find'](_0x27b3af)[_0x71f2('0x2c')](handleEntityNotFound(_0x3d1cd3,null))[_0x71f2('0x2c')](respondWithResult(_0x3d1cd3,null))[_0x71f2('0x4d')](handleError(_0x3d1cd3,null));};exports[_0x71f2('0x51')]=function(_0x51bd48,_0x58a037,_0x5a28cb){return db[_0x71f2('0x37')]['find']({'where':{'id':_0x51bd48[_0x71f2('0x4f')]['id']},'attributes':[_0x71f2('0x33'),_0x71f2('0x7')],'raw':!![]})[_0x71f2('0x2c')](handleEntityNotFound(_0x58a037,null))['then'](function(_0x5a9820){if(_0x5a9820){var _0x48e831=path['join'](config[_0x71f2('0x52')],_0x71f2('0x53'),util[_0x71f2('0x54')](_0x71f2('0x55'),path['basename'](_0x5a9820[_0x71f2('0x7')])));var _0x21d0dc=fs[_0x71f2('0x56')](_0x48e831);var _0x592973=archiver(_0x71f2('0x57'),{'zlib':{'level':0x9}});_0x592973['on'](_0x71f2('0x58'),function(_0x2103a4){if(_0x2103a4['code']==='ENOENT'){logger[_0x71f2('0x31')](_0x2103a4);}else{throw new db['Sequelize'][(_0x71f2('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x592973['on']('error',function(_0x5537ed){throw new db[(_0x71f2('0x5a'))]['Error'](_0x71f2('0x5b'));});_0x592973['pipe'](_0x21d0dc);_0x592973[_0x71f2('0x5c')](_0x71f2('0x5d'),{'cwd':path[_0x71f2('0x5e')](config[_0x71f2('0x52')],_0x71f2('0x53'),path[_0x71f2('0x5f')](_0x5a9820[_0x71f2('0x7')])),'ignore':[path[_0x71f2('0x5e')](path[_0x71f2('0x60')](_0x5a9820[_0x71f2('0x7')]),'node_modules/**/*'),path['join'](path['basename'](_0x5a9820[_0x71f2('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x71f2('0x61')]();_0x21d0dc['on'](_0x71f2('0x62'),function(){if(!fs[_0x71f2('0x63')](_0x48e831)){throw new db[(_0x71f2('0x5a'))][(_0x71f2('0x59'))]('Plugin\x20not\x20found');}return _0x58a037[_0x71f2('0x51')](_0x48e831,util[_0x71f2('0x54')](_0x71f2('0x55'),path[_0x71f2('0x60')](_0x5a9820[_0x71f2('0x7')])),function(_0x55d599){if(_0x55d599){throw new db[(_0x71f2('0x5a'))][(_0x71f2('0x59'))](_0x71f2('0x64'));}fs['unlinkSync'](_0x48e831);logger[_0x71f2('0x65')](_0x71f2('0x66'));logger[_0x71f2('0x65')](_0x71f2('0x67'));});});}return null;})[_0x71f2('0x4d')](handleError(_0x58a037,null));};exports[_0x71f2('0x68')]=function(_0x214f3d,_0x2b9be2,_0x8fae71){var _0x3e6cc3=path[_0x71f2('0x60')](_0x214f3d['file'][_0x71f2('0x69')],path['extname'](_0x214f3d[_0x71f2('0x6a')][_0x71f2('0x69')]));var _0x490ed8=path['join'](config[_0x71f2('0x52')],_0x71f2('0x53'),_0x214f3d[_0x71f2('0x6a')][_0x71f2('0x69')]);var _0x485211=path[_0x71f2('0x5e')](config['root'],_0x71f2('0x53'),_0x3e6cc3);logger['info'](_0x71f2('0x6b'),_0x490ed8);logger[_0x71f2('0x65')](_0x71f2('0x6c'),_0x485211);try{fs[_0x71f2('0x6d')](_0x490ed8,parseInt(_0x71f2('0x6e'),0x8));extract(_0x490ed8,{'dir':_0x485211},function(_0x3b017b){if(_0x3b017b){logger[_0x71f2('0x31')](_0x3b017b);handleError(_0x3b017b,!![]);};var _0x13b46d=fs[_0x71f2('0x6f')](_0x485211);if(_0x13b46d[_0x71f2('0x43')]>0x1){removeReferences(_0x490ed8,_0x485211);logger[_0x71f2('0x31')](_0x71f2('0x70'));return _0x8fae71(new Error(_0x71f2('0x70')));}var _0x123173=fs['lstatSync'](path[_0x71f2('0x5e')](_0x485211,_0x13b46d[0x0]));if(_0x123173[_0x71f2('0x71')]()){removeReferences(_0x490ed8,_0x485211);logger[_0x71f2('0x31')](_0x71f2('0x70'));return _0x8fae71(new Error('Invalid\x20plugin\x20structure'));}if(_0x123173['isDirectory']()){var _0xbc4ad8=fs[_0x71f2('0x6f')](path[_0x71f2('0x5e')](_0x485211,_0x13b46d[0x0]));if(_0xbc4ad8[_0x71f2('0x43')]===0x0){removeReferences(_0x490ed8,_0x485211);logger[_0x71f2('0x31')](_0x71f2('0x70'));return _0x8fae71(new Error(_0x71f2('0x70')));}var _0xb4c9d2=_0xbc4ad8[_0x71f2('0x72')](function(_0x367c3d){return _0x367c3d===_0x71f2('0x73');});if(!_0xb4c9d2){return _0x8fae71(new Error(_0x71f2('0x74')));}var _0x5c2ab8=fs['readFileSync'](path[_0x71f2('0x5e')](_0x485211,_0x13b46d[0x0],'manifest.json'));var _0x40142c=JSON[_0x71f2('0x75')](_0x5c2ab8);if(_0x71f2('0x25')==typeof _0x40142c['name']){return _0x8fae71(new Error(_0x71f2('0x76')));}if(_0x71f2('0x25')==typeof _0x40142c['type']){return _0x8fae71(new Error(_0x71f2('0x77')));}if(_0x71f2('0x25')==typeof _0x40142c[_0x71f2('0x78')]){return _0x8fae71(new Error(_0x71f2('0x79')));}if(_0x71f2('0x25')==typeof _0x40142c[_0x71f2('0x7a')]){return _0x8fae71(new Error(_0x71f2('0x7b')));}if(_0x40142c[_0x71f2('0x3a')]===_0x71f2('0x7c')){if(_0x71f2('0x25')==typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')]){return _0x8fae71(new Error(_0x71f2('0x7e')));}if(_0x71f2('0x25')==typeof _0x40142c['parameters'][_0x71f2('0x7d')][_0x71f2('0x7f')]&&'undefined'==typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')][_0x71f2('0x80')]){return _0x8fae71(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x40142c[_0x71f2('0x3a')]===_0x71f2('0x81')){if(_0x71f2('0x25')==typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x82')]){return _0x8fae71(new Error(_0x71f2('0x83')));}if(_0x71f2('0x25')==typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x84')]){return _0x8fae71(new Error(_0x71f2('0x85')));}}else{return _0x8fae71(new Error(_0x71f2('0x86')));}var _0x40cd65=_0x40142c[_0x71f2('0x33')];var _0x2358bd=_0x40142c['description'];var _0x257dbf=_0x40142c[_0x71f2('0x3a')];var _0x156081=_0x40142c[_0x71f2('0x87')]?_0x40142c[_0x71f2('0x87')]:'always';var _0x4720e6=_0x40142c[_0x71f2('0x88')]?_0x40142c[_0x71f2('0x88')]:_0x71f2('0x89');var _0x129ac9='';var _0x2cfe72='';var _0x43c2aa='';var _0x22ad7a='';var _0x37210a=_0x40142c[_0x71f2('0x78')];if(_0x257dbf===_0x71f2('0x7c')){if(_0x71f2('0x25')!=typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')]['admin']){var _0x13c9c5=_0x40142c[_0x71f2('0x7a')]['views'][_0x71f2('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x13c9c5)){_0x129ac9=path[_0x71f2('0x5e')]('plugins',_0x3e6cc3,_0x13b46d[0x0],_0x13c9c5);}else{_0x129ac9=_0x13c9c5;}}else{logger[_0x71f2('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x40142c[_0x71f2('0x7a')]['views']['agent']){var _0x162d00=_0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x71f2('0x8a')](_0x162d00)){_0x2cfe72=path[_0x71f2('0x5e')](_0x71f2('0x8b'),_0x3e6cc3,_0x13b46d[0x0],_0x162d00);}else{_0x2cfe72=_0x162d00;}}else{logger[_0x71f2('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x257dbf===_0x71f2('0x81')){_0x43c2aa=_0x40142c[_0x71f2('0x7a')][_0x71f2('0x82')];_0x22ad7a=_0x40142c[_0x71f2('0x7a')]['scriptPath'];if(_0x71f2('0x25')!=typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')]){if(_0x71f2('0x25')!=typeof _0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')]['admin']){var _0x13c9c5=_0x40142c[_0x71f2('0x7a')][_0x71f2('0x7d')][_0x71f2('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x13c9c5)){_0x129ac9=path[_0x71f2('0x5e')](_0x71f2('0x8b'),_0x3e6cc3,_0x13b46d[0x0],_0x13c9c5);}else{_0x129ac9=_0x13c9c5;}}if(_0x71f2('0x25')!=typeof _0x40142c[_0x71f2('0x7a')]['views']['agent']){var _0x162d00=_0x40142c['parameters'][_0x71f2('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x71f2('0x8a')](_0x162d00)){_0x2cfe72=path[_0x71f2('0x5e')]('plugins',_0x3e6cc3,_0x13b46d[0x0],_0x162d00);}else{_0x2cfe72=_0x162d00;}}}}var _0x2fe490={'name':_0x40cd65,'description':_0x2358bd,'path':path[_0x71f2('0x5e')](_0x3e6cc3,_0x13b46d[0x0]),'type':_0x257dbf,'sidebar':_0x156081,'icon':_0x4720e6,'adminUrl':_0x129ac9,'agentUrl':_0x2cfe72,'scriptName':_0x43c2aa,'scriptPath':_0x22ad7a,'version':_0x37210a};removeReferences(_0x490ed8,null);return db[_0x71f2('0x37')][_0x71f2('0x8c')](_0x2fe490)[_0x71f2('0x2c')](function(_0x4950c6){var _0x17bcfc={'role':_0x214f3d[_0x71f2('0x8d')][_0x71f2('0x8e')],'userProfileId':_0x214f3d[_0x71f2('0x8d')][_0x71f2('0x8f')]};if(!_0x17bcfc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17bcfc[_0x71f2('0x8e')]===_0x71f2('0x90')){var _0x196fa5=_0x4950c6[_0x71f2('0x2d')]({'plain':!![]});return db[_0x71f2('0x91')][_0x71f2('0x92')]({'where':{'name':_0x71f2('0x2e'),'userProfileId':_0x17bcfc['userProfileId']},'raw':!![]})[_0x71f2('0x2c')](function(_0x2508f9){if(_0x2508f9&&_0x2508f9['autoAssociation']===0x0){return db['UserProfileResource'][_0x71f2('0x8c')]({'name':_0x196fa5[_0x71f2('0x33')],'resourceId':_0x196fa5['id'],'type':_0x2508f9[_0x71f2('0x33')],'sectionId':_0x2508f9['id']},{})[_0x71f2('0x2c')](function(){return _0x4950c6;});}else{return _0x4950c6;}})[_0x71f2('0x4d')](function(_0x385ef1){logger[_0x71f2('0x31')](_0x71f2('0x93'),_0x385ef1);throw _0x385ef1;});}return _0x4950c6;})['then'](respondWithResult(_0x2b9be2,null))[_0x71f2('0x4d')](handleError(_0x2b9be2,null));}});}catch(_0x7b8a36){_0x2b9be2[_0x71f2('0x21')](0x1f4)[_0x71f2('0x34')](_0x7b8a36);}};function removeReferences(_0x470122,_0x39cff5){try{if(_0x470122){fs[_0x71f2('0x94')](_0x470122);logger[_0x71f2('0x65')](_0x71f2('0x95'));}if(_0x39cff5){rimraf(_0x39cff5,function(){});logger['info'](_0x71f2('0x96'));}}catch(_0xcddc3b){logger['error'](_0xcddc3b);}}exports[_0x71f2('0x2b')]=function(_0x11e809,_0x2a48d5,_0x208a1a){return db[_0x71f2('0x37')][_0x71f2('0x92')]({'where':{'id':_0x11e809['params']['id']}})['then'](handleEntityNotFound(_0x2a48d5,null))[_0x71f2('0x2c')](saveUpdates(_0x11e809[_0x71f2('0x8d')],null))[_0x71f2('0x2c')](respondWithResult(_0x2a48d5,null))[_0x71f2('0x4d')](handleError(_0x2a48d5,null));};exports[_0x71f2('0x97')]=function(_0x37bbb7,_0x2e83f9,_0x235537){return db['Plugin']['find']({'where':{'id':_0x37bbb7[_0x71f2('0x4f')]['id']}})[_0x71f2('0x2c')](function(_0x4c8e49){if(_0x4c8e49){return _0x4c8e49[_0x71f2('0x98')]();}})[_0x71f2('0x2c')](function(_0x4a518a){rimraf(path[_0x71f2('0x5e')](config[_0x71f2('0x52')],'server/files/plugins',path[_0x71f2('0x5f')](_0x4a518a['path'])),function(){});return _0x4a518a;})[_0x71f2('0x2c')](handleEntityNotFound(_0x2e83f9,null))[_0x71f2('0x2c')](respondWithStatusCode(_0x2e83f9,null))[_0x71f2('0x4d')](handleError(_0x2e83f9,null));};exports[_0x71f2('0x99')]=function(_0x125632,_0x19d10e,_0x4f3665){return BPromise['resolve']()['then'](function(){if(!_0x125632[_0x71f2('0x3d')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x125632['query'][_0x71f2('0x9a')]){throw new Error(_0x71f2('0x9b'));}var _0xd76ef0=_0x125632[_0x71f2('0x3d')][_0x71f2('0x9c')]?_0x125632['query'][_0x71f2('0x9c')]+':'+_0x125632[_0x71f2('0x3d')][_0x71f2('0x9a')]:_0x71f2('0x9d')+_0x125632[_0x71f2('0x3d')][_0x71f2('0x9a')];var _0x119fdc=_0x125632['query']['json']?_0x125632['query']['json']:!![];var _0xc25440=_0x125632[_0x71f2('0x3d')][_0x71f2('0x9e')]?_0x125632[_0x71f2('0x3d')]['encoding']:null;var _0x15664f={'method':_0x125632[_0x71f2('0x9f')],'uri':util[_0x71f2('0x54')](_0x71f2('0xa0'),_0xd76ef0,_0x125632[_0x71f2('0x3d')][_0x71f2('0x7')]),'json':_0x119fdc,'resolveWithFullResponse':!![],'encoding':_0xc25440,'qs':_0x125632[_0x71f2('0x3d')]};if(_0x125632[_0x71f2('0xa1')]){_0x15664f['headers']=_0x125632[_0x71f2('0xa1')];if(_0x15664f[_0x71f2('0xa1')][_0x71f2('0xa2')]){delete _0x15664f[_0x71f2('0xa1')][_0x71f2('0xa2')];}}if(_0x15664f[_0x71f2('0xa1')]['content-type']){delete _0x15664f[_0x71f2('0xa1')]['content-type'];}return rp(_0x15664f);})[_0x71f2('0x2c')](function(_0x4e61cc){if(_0x4e61cc){_0x19d10e[_0x71f2('0x27')](_0x4e61cc['headers']);logger[_0x71f2('0x65')](_0x4e61cc[_0x71f2('0x8d')]);if(_[_0x71f2('0xa3')](_0x125632[_0x71f2('0x3d')]['path'],_0x71f2('0x51'))&&_0x4e61cc['statusCode']==0x1f4){return _0x19d10e[_0x71f2('0x20')](_0x4e61cc[_0x71f2('0xa4')]);}else{return _0x19d10e[_0x71f2('0x21')](_0x4e61cc[_0x71f2('0xa4')])[_0x71f2('0x34')](_0x4e61cc['body']);}}else{return _0x19d10e['sendStatus'](0xc8);}})['catch'](handleError(_0x19d10e,null));};exports[_0x71f2('0xa5')]=function(_0x44030c,_0x71d4bb,_0xafe846){return BPromise['resolve']()[_0x71f2('0x2c')](function(){if(!_0x44030c[_0x71f2('0x3d')][_0x71f2('0x7')]){throw new Error(_0x71f2('0xa6'));}if(!_0x44030c['query'][_0x71f2('0x9a')]){throw new Error(_0x71f2('0x9b'));}var _0x444c32=_0x44030c[_0x71f2('0x3d')][_0x71f2('0x9c')]?_0x44030c['query']['hostname']+':'+_0x44030c[_0x71f2('0x3d')]['port']:'http://localhost:'+_0x44030c[_0x71f2('0x3d')][_0x71f2('0x9a')];var _0x59e18c=_0x44030c[_0x71f2('0x3d')][_0x71f2('0x22')]?_0x44030c[_0x71f2('0x3d')][_0x71f2('0x22')]:!![];var _0x150bef=_0x44030c[_0x71f2('0x3d')][_0x71f2('0x9e')]?_0x44030c[_0x71f2('0x3d')][_0x71f2('0x9e')]:null;var _0x5effcd={'method':_0x44030c[_0x71f2('0x9f')],'uri':util['format']('%s%s',_0x444c32,_0x44030c[_0x71f2('0x3d')][_0x71f2('0x7')]),'json':_0x59e18c,'resolveWithFullResponse':!![],'encoding':_0x150bef,'body':_0x44030c[_0x71f2('0x8d')]};if(_0x44030c[_0x71f2('0xa1')]){_0x5effcd[_0x71f2('0xa1')]=_0x44030c[_0x71f2('0xa1')];if(_0x5effcd[_0x71f2('0xa1')][_0x71f2('0xa2')]){delete _0x5effcd[_0x71f2('0xa1')][_0x71f2('0xa2')];}}if(_0x5effcd[_0x71f2('0xa1')][_0x71f2('0xa7')]){delete _0x5effcd[_0x71f2('0xa1')][_0x71f2('0xa7')];}return rp(_0x5effcd);})[_0x71f2('0x2c')](function(_0x1830fe){if(_0x1830fe){_0x71d4bb[_0x71f2('0x27')](_0x1830fe['headers']);logger[_0x71f2('0x65')](_0x1830fe[_0x71f2('0x8d')]);return _0x71d4bb[_0x71f2('0x21')](_0x1830fe[_0x71f2('0xa4')])[_0x71f2('0x34')](_0x1830fe[_0x71f2('0x8d')]);}else{return _0x71d4bb[_0x71f2('0x20')](0xc8);}})[_0x71f2('0x4d')](handleError(_0x71d4bb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b9261cb..9775e43 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 _0x8f9d=['hasOwnProperty','hook','exports','events','Plugin','save','update','remove','emit'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x8f9d,0x93));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xd8f9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xd8f9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8f9('0x2'),'afterUpdate':_0xd8f9('0x3'),'afterDestroy':_0xd8f9('0x4')};function emitEvent(_0x354c26){return function(_0x1f9331,_0x1b82b8,_0x1d6420){PluginEvents['emit'](_0x354c26+':'+_0x1f9331['id'],_0x1f9331);PluginEvents[_0xd8f9('0x5')](_0x354c26,_0x1f9331);_0x1d6420(null);};}for(var e in events){if(events[_0xd8f9('0x6')](e)){var event=events[e];Plugin[_0xd8f9('0x7')](e,emitEvent(event));}}module[_0xd8f9('0x8')]=PluginEvents; \ No newline at end of file +var _0x4819=['save','update','remove','emit','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x4819,0xcd));var _0x9481=function(_0x363a2b,_0x2c51a2){_0x363a2b=_0x363a2b-0x0;var _0x2c720e=_0x4819[_0x363a2b];return _0x2c720e;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9481('0x0'))['db'][_0x9481('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9481('0x2')](0x0);var events={'afterCreate':_0x9481('0x3'),'afterUpdate':_0x9481('0x4'),'afterDestroy':_0x9481('0x5')};function emitEvent(_0x40a703){return function(_0x14dc10,_0xc39edf,_0x16c617){PluginEvents['emit'](_0x40a703+':'+_0x14dc10['id'],_0x14dc10);PluginEvents[_0x9481('0x6')](_0x40a703,_0x14dc10);_0x16c617(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9481('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index da31aef..d619870 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 _0x3edc=['plugins','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x5ebb4d,_0x3180ec){_0x5ebb4d=_0x5ebb4d-0x0;var _0x7e1980=_0x3edc[_0x5ebb4d];return _0x7e1980;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8837=['exports','define','plugins','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x424c46,_0x9427f7){var _0x7e6e1b=function(_0x14791f){while(--_0x14791f){_0x424c46['push'](_0x424c46['shift']());}};_0x7e6e1b(++_0x9427f7);}(_0x8837,0x184));var _0x7883=function(_0xcccbe1,_0x31d7bf){_0xcccbe1=_0xcccbe1-0x0;var _0x2fdd82=_0x8837[_0xcccbe1];return _0x2fdd82;};'use strict';var _=require(_0x7883('0x0'));var util=require('util');var logger=require(_0x7883('0x1'))(_0x7883('0x2'));var moment=require(_0x7883('0x3'));var BPromise=require('bluebird');var rp=require(_0x7883('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7883('0x5'));var config=require(_0x7883('0x6'));var attributes=require(_0x7883('0x7'));module[_0x7883('0x8')]=function(_0x2ebade,_0x5d06a2){return _0x2ebade[_0x7883('0x9')]('Plugin',attributes,{'tableName':_0x7883('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a8f552c..eda8355 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 _0x6124=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','randomstring'];(function(_0x81d02,_0x2b3da1){var _0x2457b6=function(_0x44f941){while(--_0x44f941){_0x81d02['push'](_0x81d02['shift']());}};_0x2457b6(++_0x2b3da1);}(_0x6124,0x140));var _0x4612=function(_0x56b333,_0x34a285){_0x56b333=_0x56b333-0x0;var _0xf4677=_0x6124[_0x56b333];return _0xf4677;};'use strict';var _=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var moment=require(_0x4612('0x2'));var BPromise=require('bluebird');var rs=require(_0x4612('0x3'));var fs=require('fs');var Redis=require(_0x4612('0x4'));var db=require(_0x4612('0x5'))['db'];var utils=require(_0x4612('0x6'));var logger=require(_0x4612('0x7'))(_0x4612('0x8'));var config=require(_0x4612('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4612('0xa')][_0x4612('0xb')]({'port':0x232a});config[_0x4612('0xc')]=_[_0x4612('0xd')](config['redis'],{'host':_0x4612('0xe'),'port':0x18eb});var socket=require(_0x4612('0xf'))(new Redis(config[_0x4612('0xc')]));require(_0x4612('0x10'))[_0x4612('0x11')](socket);function respondWithRpcPromise(_0x1b37a5,_0x1ce67b,_0x13fddb){return new BPromise(function(_0xfbd14a,_0xc649d1){return client[_0x4612('0x12')](_0x1b37a5,_0x13fddb)[_0x4612('0x13')](function(_0x28339f){logger[_0x4612('0x14')](_0x4612('0x15'),_0x1ce67b,_0x4612('0x16'));logger[_0x4612('0x17')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1ce67b,_0x4612('0x16'),JSON[_0x4612('0x18')](_0x28339f));if(_0x28339f[_0x4612('0x19')]){if(_0x28339f[_0x4612('0x19')][_0x4612('0x1a')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x1ce67b,_0x28339f[_0x4612('0x19')]['message']);return _0xc649d1(_0x28339f['error'][_0x4612('0x1b')]);}logger[_0x4612('0x19')](_0x4612('0x15'),_0x1ce67b,_0x28339f[_0x4612('0x19')][_0x4612('0x1b')]);return _0xfbd14a(_0x28339f[_0x4612('0x19')][_0x4612('0x1b')]);}else{logger[_0x4612('0x14')](_0x4612('0x15'),_0x1ce67b,_0x4612('0x16'));_0xfbd14a(_0x28339f[_0x4612('0x1c')][_0x4612('0x1b')]);}})[_0x4612('0x1d')](function(_0x2945e4){logger[_0x4612('0x19')]('Plugin,\x20%s,\x20%s',_0x1ce67b,_0x2945e4);_0xc649d1(_0x2945e4);});});}exports[_0x4612('0x1e')]=function(_0x1c3b97){var _0x19aa98=this;return new Promise(function(_0x125fc0,_0xe527f8){return db[_0x4612('0x1f')][_0x4612('0x20')](_0x1c3b97[_0x4612('0x21')],{'raw':_0x1c3b97[_0x4612('0x22')]?_0x1c3b97[_0x4612('0x22')][_0x4612('0x23')]===undefined?!![]:![]:!![]})[_0x4612('0x13')](function(_0x4d3a6d){logger[_0x4612('0x14')](_0x4612('0x1e'),_0x1c3b97);logger[_0x4612('0x17')]('CreatePlugin',_0x1c3b97,JSON[_0x4612('0x18')](_0x4d3a6d));_0x125fc0(_0x4d3a6d);})[_0x4612('0x1d')](function(_0x20c1fd){logger[_0x4612('0x19')](_0x4612('0x1e'),_0x20c1fd[_0x4612('0x1b')],_0x1c3b97);_0xe527f8(_0x19aa98[_0x4612('0x19')](0x1f4,_0x20c1fd[_0x4612('0x1b')]));});});}; \ No newline at end of file +var _0xb678=['socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','stringify','lodash','util','randomstring','../../config/utils','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x57003b,_0x2a1606){var _0xada57b=function(_0x3e1aa9){while(--_0x3e1aa9){_0x57003b['push'](_0x57003b['shift']());}};_0xada57b(++_0x2a1606);}(_0xb678,0x6a));var _0x8b67=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb678[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x8b67('0x0'));var util=require(_0x8b67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b67('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8b67('0x4'));var client=jayson[_0x8b67('0x5')][_0x8b67('0x6')]({'port':0x232a});config[_0x8b67('0x7')]=_[_0x8b67('0x8')](config[_0x8b67('0x7')],{'host':_0x8b67('0x9'),'port':0x18eb});var socket=require(_0x8b67('0xa'))(new Redis(config[_0x8b67('0x7')]));require('./plugin.socket')[_0x8b67('0xb')](socket);function respondWithRpcPromise(_0x6db6be,_0x277f3d,_0x5a30b8){return new BPromise(function(_0x10d727,_0x4efa00){return client[_0x8b67('0xc')](_0x6db6be,_0x5a30b8)[_0x8b67('0xd')](function(_0x46af1e){logger[_0x8b67('0xe')](_0x8b67('0xf'),_0x277f3d,_0x8b67('0x10'));logger[_0x8b67('0x11')]('Plugin,\x20%s,\x20%s,\x20%s',_0x277f3d,_0x8b67('0x10'),JSON['stringify'](_0x46af1e));if(_0x46af1e[_0x8b67('0x12')]){if(_0x46af1e['error']['code']===0x1f4){logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);return _0x4efa00(_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);}logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);return _0x10d727(_0x46af1e[_0x8b67('0x12')][_0x8b67('0x13')]);}else{logger[_0x8b67('0xe')](_0x8b67('0xf'),_0x277f3d,'request\x20sent');_0x10d727(_0x46af1e[_0x8b67('0x14')][_0x8b67('0x13')]);}})[_0x8b67('0x15')](function(_0x124016){logger[_0x8b67('0x12')](_0x8b67('0xf'),_0x277f3d,_0x124016);_0x4efa00(_0x124016);});});}exports['CreatePlugin']=function(_0x29a8da){var _0x2b0f2b=this;return new Promise(function(_0x1ce888,_0x5026a1){return db[_0x8b67('0x16')][_0x8b67('0x17')](_0x29a8da[_0x8b67('0x18')],{'raw':_0x29a8da[_0x8b67('0x19')]?_0x29a8da[_0x8b67('0x19')][_0x8b67('0x1a')]===undefined?!![]:![]:!![]})[_0x8b67('0xd')](function(_0x16ae64){logger[_0x8b67('0xe')](_0x8b67('0x1b'),_0x29a8da);logger['debug'](_0x8b67('0x1b'),_0x29a8da,JSON[_0x8b67('0x1c')](_0x16ae64));_0x1ce888(_0x16ae64);})[_0x8b67('0x15')](function(_0x29ac1e){logger['error']('CreatePlugin',_0x29ac1e['message'],_0x29a8da);_0x5026a1(_0x2b0f2b[_0x8b67('0x12')](0x1f4,_0x29ac1e[_0x8b67('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4c8f63e..8273a21 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 _0x97f5=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x97f5,0x142));var _0x597f=function(_0x16e17f,_0x318d97){_0x16e17f=_0x16e17f-0x0;var _0x3686fe=_0x97f5[_0x16e17f];return _0x3686fe;};'use strict';var PluginEvents=require(_0x597f('0x0'));var events=[_0x597f('0x1'),_0x597f('0x2'),_0x597f('0x3')];function createListener(_0x1b8e9e,_0x4d0251){return function(_0x2c9e8f){_0x4d0251[_0x597f('0x4')](_0x1b8e9e,_0x2c9e8f);};}function removeListener(_0xeab8e4,_0x11d69c){return function(){PluginEvents[_0x597f('0x5')](_0xeab8e4,_0x11d69c);};}exports[_0x597f('0x6')]=function(_0x3dcffd){for(var _0x4822f9=0x0,_0x4de78e=events[_0x597f('0x7')];_0x4822f9<_0x4de78e;_0x4822f9++){var _0x53268d=events[_0x4822f9];var _0x3a0277=createListener(_0x597f('0x8')+_0x53268d,_0x3dcffd);PluginEvents['on'](_0x53268d,_0x3a0277);}}; \ No newline at end of file +var _0xb101=['remove','update','removeListener','register','plugin:','./plugin.events','save'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb101,0xa6));var _0x1b10=function(_0x6ae3ca,_0x2b64fe){_0x6ae3ca=_0x6ae3ca-0x0;var _0x35a532=_0xb101[_0x6ae3ca];return _0x35a532;};'use strict';var PluginEvents=require(_0x1b10('0x0'));var events=[_0x1b10('0x1'),_0x1b10('0x2'),_0x1b10('0x3')];function createListener(_0x19bb40,_0x3a310){return function(_0x4d548b){_0x3a310['emit'](_0x19bb40,_0x4d548b);};}function removeListener(_0xbf7ce5,_0x924dd7){return function(){PluginEvents[_0x1b10('0x4')](_0xbf7ce5,_0x924dd7);};}exports[_0x1b10('0x5')]=function(_0x590ff6){for(var _0x34b17b=0x0,_0x4de830=events['length'];_0x34b17b<_0x4de830;_0x34b17b++){var _0x52ed97=events[_0x34b17b];var _0xaa3850=createListener(_0x1b10('0x6')+_0x52ed97,_0x590ff6);PluginEvents['on'](_0x52ed97,_0xaa3850);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 17608b6..ae2455d 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(_0x1ad09d,_0x5c4de9){var _0x30033f=function(_0x2b22cd){while(--_0x2b22cd){_0x1ad09d['push'](_0x1ad09d['shift']());}};_0x30033f(++_0x5c4de9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x173c62,_0x46b2a0){var _0x1f0d68=function(_0x871027){while(--_0x871027){_0x173c62['push'](_0x173c62['shift']());}};_0x1f0d68(++_0x46b2a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 766df10..99f4b6c 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 _0x76dc=['catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','json','stack','name','status','npm\x20install','info','error','index','list','then','reject','express','motion2','describe','params'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x76dc,0x1f2));var _0xc76d=function(_0xa66363,_0x1944fe){_0xa66363=_0xa66363-0x0;var _0x4f1161=_0x76dc[_0xa66363];return _0x4f1161;};'use strict';var _=require(_0xc76d('0x0'));var pm2=require(_0xc76d('0x1'));var logger=require(_0xc76d('0x2'))(_0xc76d('0x3'));var path=require('path');var exec=require(_0xc76d('0x4'))[_0xc76d('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x300f11,_0x50ed3a){return function(_0x507ea7){if(!_0x507ea7){_0x300f11[_0xc76d('0x6')](0x194);;}return _0x507ea7;};}function respondWithResult(_0x29ab70,_0x1c86fc){_0x1c86fc=_0x1c86fc||0xc8;return function(_0x4832bd){if(_0x4832bd){return _0x29ab70['status'](_0x1c86fc)[_0xc76d('0x7')](_0x4832bd);}return null;};}function handleError(_0x114572,_0x18574f){_0x18574f=_0x18574f||0x1f4;return function(_0x532d6a){logger['error'](_0x532d6a[_0xc76d('0x8')]);if(_0x532d6a[_0xc76d('0x9')]){delete _0x532d6a['name'];}_0x114572[_0xc76d('0xa')](_0x18574f)['send'](_0x532d6a);};}function execChildProcess(){return new BPromise(function(_0xd5c042,_0x2e1807){exec(_0xc76d('0xb'),function(_0x95e06b,_0x3f59ea,_0x193c4a){logger[_0xc76d('0xc')](_0x3f59ea);logger[_0xc76d('0xc')](_0x193c4a);if(_0x95e06b){logger[_0xc76d('0xd')](_0x95e06b);return _0x2e1807(_0x95e06b);}return _0xd5c042(_0x3f59ea);});});}exports[_0xc76d('0xe')]=function(_0x1a7b47,_0x24e88e){return pm2[_0xc76d('0xf')]()[_0xc76d('0x10')](function(_0x5cda20){if(_0x5cda20){var _0x8696db=_[_0xc76d('0x11')](_0x5cda20,function(_0x5bbed9){return _0x5bbed9[_0xc76d('0x9')]===_0xc76d('0x12')||_0x5bbed9[_0xc76d('0x9')]===_0xc76d('0x13');});return{'rows':_0x8696db,'count':_0x8696db['length']};}return null;})[_0xc76d('0x10')](respondWithResult(_0x24e88e,null))['catch'](handleError(_0x24e88e,null));};exports['show']=function(_0x45a83e,_0x31b032){return pm2[_0xc76d('0x14')](_0x45a83e[_0xc76d('0x15')]['id'])[_0xc76d('0x10')](respondWithResult(_0x31b032,null))['then'](handleEntityNotFound(_0x31b032,null))[_0xc76d('0x16')](handleError(_0x31b032,null));};exports[_0xc76d('0x17')]=function(_0xa0c5b6,_0x1c6d5b){if(_0xa0c5b6[_0xc76d('0x18')]['name']&&_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x19')]){var _0x5dffde=path[_0xc76d('0x1a')](__dirname,_0xc76d('0x1b'),_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x19')]);var _0x18f546=process[_0xc76d('0x1c')]();process[_0xc76d('0x1d')](path[_0xc76d('0x1e')](_0x5dffde));return execChildProcess()[_0xc76d('0x10')](function(_0x20e09c){process[_0xc76d('0x1d')](_0x18f546);return pm2['start']({'name':_0xa0c5b6[_0xc76d('0x18')][_0xc76d('0x9')],'script':_0x5dffde});})['then'](function(_0x637d68){pm2[_0xc76d('0x1f')]();return _0x637d68[0x0];})['then'](respondWithResult(_0x1c6d5b,0xc9))[_0xc76d('0x16')](handleError(_0x1c6d5b,null));}else{return _0x1c6d5b[_0xc76d('0xa')](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x21')});}};exports[_0xc76d('0x22')]=function(_0x1949c4,_0x89ee5){if(_0x1949c4['body']['id']){delete _0x1949c4['body']['id'];}var _0x285430={'online':_0xc76d('0x23'),'stopped':'stop'};if(_0x285430[_0xc76d('0x24')](_0x1949c4[_0xc76d('0x18')][_0xc76d('0xa')])){return pm2[_0x285430[_0x1949c4['body'][_0xc76d('0xa')]]](_0x1949c4['params']['id'])[_0xc76d('0x10')](respondWithResult(_0x89ee5,0xc8))[_0xc76d('0x16')](handleError(_0x89ee5,null));}else{return _0x89ee5['status'](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x25')});}};exports[_0xc76d('0x26')]=function(_0x2cf501,_0x4feeda){if(_0x2cf501[_0xc76d('0x18')]['id']){delete _0x2cf501['body']['id'];}if(_0x2cf501[_0xc76d('0x15')]['id']){return pm2['delete'](_0x2cf501[_0xc76d('0x15')]['id'])[_0xc76d('0x10')](function(_0x5dc369){pm2['dump']();return _0x5dc369[0x0];})['then'](respondWithResult(_0x4feeda,null))['catch'](handleError(_0x4feeda,null));}else{return _0x4feeda[_0xc76d('0xa')](0x1f4)[_0xc76d('0x20')]({'message':_0xc76d('0x27')});}}; \ No newline at end of file +var _0xcb91=['describe','create','body','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','path','child_process','bluebird','sendStatus','json','name','status','send','npm\x20install','info','list','then','reject','express','length','catch','show'];(function(_0x4d508b,_0x25c97a){var _0x1f202d=function(_0x900ac2){while(--_0x900ac2){_0x4d508b['push'](_0x4d508b['shift']());}};_0x1f202d(++_0x25c97a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0xcb91[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var path=require(_0x1cb9('0x2'));var exec=require(_0x1cb9('0x3'))['exec'];var BPromise=require(_0x1cb9('0x4'));function handleEntityNotFound(_0x2c17b8,_0x545a34){return function(_0x13d5fd){if(!_0x13d5fd){_0x2c17b8[_0x1cb9('0x5')](0x194);;}return _0x13d5fd;};}function respondWithResult(_0x53ffbd,_0x226b69){_0x226b69=_0x226b69||0xc8;return function(_0x3f7deb){if(_0x3f7deb){return _0x53ffbd['status'](_0x226b69)[_0x1cb9('0x6')](_0x3f7deb);}return null;};}function handleError(_0x12567c,_0x59d1be){_0x59d1be=_0x59d1be||0x1f4;return function(_0x3ae0f1){logger['error'](_0x3ae0f1['stack']);if(_0x3ae0f1[_0x1cb9('0x7')]){delete _0x3ae0f1[_0x1cb9('0x7')];}_0x12567c[_0x1cb9('0x8')](_0x59d1be)[_0x1cb9('0x9')](_0x3ae0f1);};}function execChildProcess(){return new BPromise(function(_0x2fc627,_0x50ce71){exec(_0x1cb9('0xa'),function(_0x44a6b4,_0x3af35f,_0x3fdd83){logger[_0x1cb9('0xb')](_0x3af35f);logger['info'](_0x3fdd83);if(_0x44a6b4){logger['error'](_0x44a6b4);return _0x50ce71(_0x44a6b4);}return _0x2fc627(_0x3af35f);});});}exports['index']=function(_0x358866,_0x282bc6){return pm2[_0x1cb9('0xc')]()[_0x1cb9('0xd')](function(_0x56884d){if(_0x56884d){var _0x397727=_[_0x1cb9('0xe')](_0x56884d,function(_0x1b3cd7){return _0x1b3cd7[_0x1cb9('0x7')]===_0x1cb9('0xf')||_0x1b3cd7['name']==='motion2';});return{'rows':_0x397727,'count':_0x397727[_0x1cb9('0x10')]};}return null;})[_0x1cb9('0xd')](respondWithResult(_0x282bc6,null))[_0x1cb9('0x11')](handleError(_0x282bc6,null));};exports[_0x1cb9('0x12')]=function(_0x3e21e0,_0xf22920){return pm2[_0x1cb9('0x13')](_0x3e21e0['params']['id'])['then'](respondWithResult(_0xf22920,null))[_0x1cb9('0xd')](handleEntityNotFound(_0xf22920,null))[_0x1cb9('0x11')](handleError(_0xf22920,null));};exports[_0x1cb9('0x14')]=function(_0x31481a,_0x280a84){if(_0x31481a[_0x1cb9('0x15')][_0x1cb9('0x7')]&&_0x31481a['body']['script']){var _0x1a5a72=path['join'](__dirname,_0x1cb9('0x16'),_0x31481a[_0x1cb9('0x15')]['script']);var _0x599275=process[_0x1cb9('0x17')]();process[_0x1cb9('0x18')](path[_0x1cb9('0x19')](_0x1a5a72));return execChildProcess()[_0x1cb9('0xd')](function(_0x45b8d3){process[_0x1cb9('0x18')](_0x599275);return pm2['start']({'name':_0x31481a['body'][_0x1cb9('0x7')],'script':_0x1a5a72});})['then'](function(_0x10a419){pm2[_0x1cb9('0x1a')]();return _0x10a419[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x280a84,0xc9))[_0x1cb9('0x11')](handleError(_0x280a84,null));}else{return _0x280a84[_0x1cb9('0x8')](0x1f4)['send']({'message':_0x1cb9('0x1b')});}};exports[_0x1cb9('0x1c')]=function(_0x4c8d76,_0xd6891c){if(_0x4c8d76[_0x1cb9('0x15')]['id']){delete _0x4c8d76[_0x1cb9('0x15')]['id'];}var _0x1804fd={'online':_0x1cb9('0x1d'),'stopped':_0x1cb9('0x1e')};if(_0x1804fd[_0x1cb9('0x1f')](_0x4c8d76[_0x1cb9('0x15')][_0x1cb9('0x8')])){return pm2[_0x1804fd[_0x4c8d76[_0x1cb9('0x15')]['status']]](_0x4c8d76[_0x1cb9('0x20')]['id'])['then'](respondWithResult(_0xd6891c,0xc8))[_0x1cb9('0x11')](handleError(_0xd6891c,null));}else{return _0xd6891c['status'](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x21')});}};exports[_0x1cb9('0x22')]=function(_0x2038aa,_0x561d89){if(_0x2038aa[_0x1cb9('0x15')]['id']){delete _0x2038aa['body']['id'];}if(_0x2038aa[_0x1cb9('0x20')]['id']){return pm2[_0x1cb9('0x23')](_0x2038aa[_0x1cb9('0x20')]['id'])['then'](function(_0xae4c7a){pm2['dump']();return _0xae4c7a[0x0];})[_0x1cb9('0xd')](respondWithResult(_0x561d89,null))['catch'](handleError(_0x561d89,null));}else{return _0x561d89[_0x1cb9('0x8')](0x1f4)[_0x1cb9('0x9')]({'message':_0x1cb9('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 0d37de5..6b117d0 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 _0xdc76=['/queues','getQueues','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xdc76,0x107));var _0x6dc7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdc76[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x6dc7('0x0'));var router=express['Router']();var auth=require(_0x6dc7('0x1'));var controller=require(_0x6dc7('0x2'));router[_0x6dc7('0x3')](_0x6dc7('0x4'),auth[_0x6dc7('0x5')](),controller[_0x6dc7('0x6')]);router[_0x6dc7('0x3')](_0x6dc7('0x7'),auth[_0x6dc7('0x5')](),controller[_0x6dc7('0x8')]);module['exports']=router; \ No newline at end of file +var _0x86b8=['/agents','getAgents','get','/queues','isAuthenticated','getQueues','../../components/auth/service'];(function(_0x268396,_0x864c1c){var _0x2d7b5d=function(_0x4a3a6a){while(--_0x4a3a6a){_0x268396['push'](_0x268396['shift']());}};_0x2d7b5d(++_0x864c1c);}(_0x86b8,0x1e9));var _0x886b=function(_0x2efdf3,_0x4b7da1){_0x2efdf3=_0x2efdf3-0x0;var _0x121a15=_0x86b8[_0x2efdf3];return _0x121a15;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x886b('0x0'));var controller=require('./realtime.controller');router['get'](_0x886b('0x1'),auth['isAuthenticated'](),controller[_0x886b('0x2')]);router[_0x886b('0x3')](_0x886b('0x4'),auth[_0x886b('0x5')](),controller[_0x886b('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index b83efde..24b2782 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 _0x638e=['whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','raw','isEmpty','where','user','nolimit','UserProfile','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','getOptions','userProfileId','QueueCampaigns','Queues','findAndCountAll','util','jayson/promise','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','status','set','Content-Range','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','available','waiting','talking','paused','outbound','push','pTalking','originated','startPredictive','startProgressive','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','pick','filter','some','connectedlinenum','internal','getMembers','length','UserId','accountcode','online','voiceStatus','User','Queue','Pause','startCase','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','mailPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','includes','toLowerCase','Invalid\x20channel','all','flatten','uniq','value','split','fields','globalStatus','order','DESC','ASC','sort','pauseType','getAgents','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity'];(function(_0x468b5d,_0x1b984e){var _0x584e30=function(_0xcb821){while(--_0xcb821){_0x468b5d['push'](_0x468b5d['shift']());}};_0x584e30(++_0x1b984e);}(_0x638e,0x173));var _0xe638=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0x638e[_0x4498a2];return _0x411aa8;};'use strict';var util=require(_0xe638('0x0'));var _=require('lodash');var jayson=require(_0xe638('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xe638('0x2'))(_0xe638('0x3'));var db=require(_0xe638('0x4'))['db'];var amiClient=jayson[_0xe638('0x5')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xe638('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x45ba8f,_0xda3013){return function(_0xff8a23){if(_0xff8a23){var _0x52c6fa=typeof _0xda3013['offset']===_0xe638('0x7')&&typeof _0xda3013[_0xe638('0x8')]===_0xe638('0x7');var _0x1e54c7=_0xff8a23[_0xe638('0x9')];var _0x57bdb8=_0x52c6fa?0x0:_0xda3013[_0xe638('0xa')];var _0x5aa5d4=_0x52c6fa?_0xff8a23[_0xe638('0x9')]:_0xda3013[_0xe638('0xa')]+_0xda3013['limit'];var _0x5c865e;if(_0x5aa5d4>=_0x1e54c7){_0x5aa5d4=_0x1e54c7;_0x5c865e=0xc8;}else{_0x5c865e=0xce;}_0x45ba8f[_0xe638('0xb')](_0x5c865e);return _0x45ba8f[_0xe638('0xc')](_0xe638('0xd'),_0x57bdb8+'-'+_0x5aa5d4+'/'+_0x1e54c7)['json'](_0xff8a23);}return null;};}function handleError(_0x2a43a,_0x4c8bd9){_0x4c8bd9=_0x4c8bd9||0x1f4;return function(_0x4c79a9){logger[_0xe638('0xe')](_0x4c79a9['stack']);if(_0x4c79a9['name']){delete _0x4c79a9[_0xe638('0xf')];}_0x2a43a['status'](_0x4c8bd9)[_0xe638('0x10')](_0x4c79a9);};}function getRealtimeAgents(){return new Promise(function(_0xea6c73,_0xceede3){return amiClient[_0xe638('0x11')](_0xe638('0x12'),{})[_0xe638('0x13')](function(_0x3ab4ef){if(_0x3ab4ef[_0xe638('0xe')])throw new Error(_0xe638('0x14'));var _0x4cefd7=_0x3ab4ef[_0xe638('0x15')];return routingClient[_0xe638('0x11')](_0xe638('0x12'),{})[_0xe638('0x13')](function(_0x2a9d82){if(_0x2a9d82[_0xe638('0xe')])throw new Error(_0xe638('0x16'));var _0x3b192f=_0x2a9d82[_0xe638('0x15')];return _0xea6c73(_[_0xe638('0x17')]({},_0x4cefd7,_0x3b192f));});})[_0xe638('0x18')](function(_0x479fce){_0xceede3(_0x479fce);});});}function getRealtimeQueues(_0x136681,_0x3afe21){return new Promise(function(_0xcc3103,_0x3f3da5){var _0x280746=_0x3afe21===_0xe638('0x19')?amiClient:routingClient;return _0x280746[_0xe638('0x11')](_['startCase'](_0x3afe21)+'Queues',_0x136681)[_0xe638('0x13')](function(_0x1f3b54){if(_0x1f3b54[_0xe638('0xe')])throw new Error(util[_0xe638('0x1a')](_0xe638('0x1b'),_0x3afe21));return _0xcc3103(_0x1f3b54[_0xe638('0x15')]);})[_0xe638('0x18')](function(_0x1c0d53){_0x3f3da5(_0x1c0d53);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5b632e,_0x29520d){return amiClient['request'](_0xe638('0x1c'),{})[_0xe638('0x13')](function(_0x591d80){if(_0x591d80[_0xe638('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x5b632e(_0x591d80['result']);})[_0xe638('0x18')](function(_0x5ded8e){_0x29520d(_0x5ded8e);});});}function initializeQueues(_0x2e09e5,_0x39af13,_0x556e3b,_0x4e5e83){var _0x40ee10=['loggedIn',_0xe638('0x1d'),_0xe638('0x1e'),_0xe638('0x1f'),_0xe638('0x20')];if(_0x556e3b===_0xe638('0x19')&&_0x4e5e83===_0xe638('0x21')){_0x40ee10[_0xe638('0x22')](_0xe638('0x23'),_0xe638('0x24'),'message','dialActive','dialMethod','Trunk',_0xe638('0x25'),_0xe638('0x26'),'erlangCalls',_0xe638('0x27'),'erlangAbandonmentRate','erlangBusyFactor',_0xe638('0x28'),_0xe638('0x29'),_0xe638('0x2a'),_0xe638('0x2b'),_0xe638('0x2c'),_0xe638('0x2d'),_0xe638('0x2e'),_0xe638('0x2f'),_0xe638('0x30'),_0xe638('0x31'));}return _0x2e09e5[_0xe638('0x32')](function(_0x470f50){var _0x119af7=_0x470f50[_0xe638('0x33')]({'plain':!![]});_0x119af7[_0xe638('0x34')]=[];_0x119af7['paused']=0x0;_0x119af7[_0xe638('0x35')]=0x0;_0x119af7['loggedIn']=0x0;_0x119af7['available']=0x0;_0x119af7[_0xe638('0x1e')]=0x0;if(_0x556e3b===_0xe638('0x19')){_0x119af7['talking']=0x0;_0x119af7[_0xe638('0x36')]=0x0;if(_0x4e5e83==='outbound'){_0x119af7[_0xe638('0x23')]=0x0;_0x119af7['originated']=0x0;}}var _0x110616=_[_0xe638('0x37')](_0x39af13,['id',_0x119af7['id']]);if(_0x110616)_[_0xe638('0x17')](_0x119af7,_[_0xe638('0x38')](_0x110616,_0x40ee10));return _0x119af7;});}function updateAgentVoiceStatus(_0x1108c8,_0xe7d01,_0x52df0c){var _0x29c523=_[_0xe638('0x39')](_0x52df0c,['queue',_0xe7d01[_0xe638('0xf')]]);if(_0x29c523['length']===0x0)return _0x1108c8['busy']=!![];if(_[_0xe638('0x3a')](_0x29c523,[_0xe638('0x3b'),_0x1108c8[_0xe638('0x3c')]['toString']()]))return _0x1108c8[_0xe638('0x1f')]=!![];if(!_0x1108c8[_0xe638('0x1f')])return _0x1108c8[_0xe638('0x36')]=!![];}function getVoiceQueueAgents(_0x134290,_0x4381ce,_0x21f65c,_0x19d0cc){var _0x25b172=_[_0xe638('0x37')](_0x4381ce,['id',_0x134290['id']]);if(!_0x25b172)return _0x134290;return _0x25b172[_0xe638('0x3d')]({'raw':!![]})[_0xe638('0x13')](function(_0x26efec){for(var _0x5b1b7b=0x0;_0x5b1b7b<_0x26efec[_0xe638('0x3e')];_0x5b1b7b++){var _0x277d32=_['find'](_0x21f65c,['id',_0x26efec[_0x5b1b7b][_0xe638('0x3f')]]);if(!_0x277d32){_0x277d32={'id':_0x26efec[_0x5b1b7b][_0xe638('0x3f')],'name':_0x26efec[_0x5b1b7b]['UserId'],'accountcode':'','online':![]};}var _0x406a03={'id':_0x277d32['id'],'name':_0x277d32[_0xe638('0xf')],'internal':_0x277d32[_0xe638('0x40')],'online':Boolean(_0x277d32[_0xe638('0x41')]),'paused':Boolean(_0x26efec[_0x5b1b7b][_0xe638('0x20')])};if(_0x277d32[_0xe638('0x42')]===_0xe638('0x1f'))updateAgentVoiceStatus(_0x406a03,_0x134290,_0x19d0cc);if(_0x406a03[_0xe638('0x41')])_0x134290[_0xe638('0x35')]++;if(_0x406a03[_0xe638('0x36')])_0x134290[_0xe638('0x36')]++;if(_0x406a03[_0xe638('0x20')]&&!_0x406a03[_0xe638('0x36')]&&!_0x406a03['talking'])_0x134290[_0xe638('0x20')]++;_0x134290[_0xe638('0x34')]['push'](_0x406a03);}return _0x134290;});}function getQueueAgents(_0x48b79f,_0x17b2b7,_0xede526){var _0x14527f=_0xe638('0x43')+_['startCase'](_0xede526)+_0xe638('0x44');var _0x157842=_0xede526+_0xe638('0x45');return db[_0x14527f]['findAll']({'where':{[_[_0xe638('0x46')](_0xede526)+_0xe638('0x47')]:_0x48b79f['id']},'raw':!![]})[_0xe638('0x13')](function(_0x4190cd){for(var _0x1b733d=0x0;_0x1b733d<_0x4190cd[_0xe638('0x3e')];_0x1b733d++){var _0x336568=_['find'](_0x17b2b7,['id',_0x4190cd[_0x1b733d][_0xe638('0x3f')]]);if(!_0x336568){_0x336568={'id':_0x4190cd[_0x1b733d][_0xe638('0x3f')],'name':_0x4190cd[_0x1b733d][_0xe638('0x3f')],'online':![],['pauseField']:![]};}var _0x3f6af0={'id':_0x336568['id'],'name':_0x336568[_0xe638('0xf')],'online':Boolean(_0x336568['online']),'paused':Boolean(_0x336568[_0x157842])};if(_0x3f6af0['online'])_0x48b79f['loggedInDb']++;_0x48b79f['agents'][_0xe638('0x22')](_0x3f6af0);}return _0x48b79f;});}function isIdle(_0x2f66bd){return _0x2f66bd===_0xe638('0x48')||_0x2f66bd===_0xe638('0x49')||_0x2f66bd===_0xe638('0x4a')||_0x2f66bd===_0xe638('0x4b')||_[_0xe638('0x4c')](_0x2f66bd);}function isAgentPaused(_0x545615,_0x2b51a4){var _0x4c886c=[_0x545615[_0xe638('0x4d')],_0x545615[_0xe638('0x4e')],_0x545615[_0xe638('0x4f')],_0x545615['openchannelPause'],_0x545615['smsPause'],_0x545615[_0xe638('0x50')],_0x545615[_0xe638('0x51')]];if(!_0x2b51a4)return _[_0xe638('0x52')](_0x4c886c);var _0x3a5bc3=_[_0xe638('0x39')](_0x4c886c);return _0x3a5bc3[_0xe638('0x3e')]>0x0&&_0x3a5bc3['length']<_0x4c886c[_0xe638('0x3e')]?!![]:![];}function isAgentIdle(_0x57ebd7){if(_0x57ebd7[_0xe638('0x42')]!==_0xe638('0x48')&&_0x57ebd7[_0xe638('0x50')]){_0x57ebd7[_0xe638('0x42')]=_0xe638('0x53');return![];}return _[_0xe638('0x52')]([_0x57ebd7[_0xe638('0x54')],_0x57ebd7[_0xe638('0x55')],_0x57ebd7[_0xe638('0x56')],_0x57ebd7[_0xe638('0x57')],_0x57ebd7[_0xe638('0x58')],_0x57ebd7['voiceStatus'],_0x57ebd7[_0xe638('0x59')]],isIdle);}function getAgentStatus(_0x3416a0){var _0x1a94b3='unknown';if(isAgentPaused(_0x3416a0))_0x1a94b3=_0xe638('0x53');else if(isAgentPaused(_0x3416a0,!![]))_0x1a94b3=_0xe638('0x5a');else if(isAgentIdle(_0x3416a0))_0x1a94b3=_0xe638('0x48');else _0x1a94b3=_0xe638('0x36');return _0x1a94b3;}function validateChannel(_0x3f5ada){var _0x2edffb=[_0xe638('0x5b'),_0xe638('0x5c'),_0xe638('0x5d'),_0xe638('0x5e'),'fax','whatsapp',_0xe638('0x19')];if(!_[_0xe638('0x5f')](_0x2edffb,_0x3f5ada[_0xe638('0x60')]()))throw new Error(_0xe638('0x61'));return _0x3f5ada[_0xe638('0x60')]();}function getFilteredAgentIds(_0x312d42,_0x139738){var _0x283bd4=_['isArray'](_0x312d42)?_0x312d42:[_0x312d42];var _0xaac160=_[_0xe638('0x32')](_0x283bd4,function(_0x3f0590){return db[_0x139738]['findOne']({'where':{'name':_0x3f0590}})[_0xe638('0x13')](function(_0x1c8bac){if(!_0x1c8bac)return[];return _0x1c8bac['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xe638('0x62')](_0xaac160)[_0xe638('0x13')](function(_0x34407a){var _0x36bfed=_(_0x34407a)[_0xe638('0x63')]()[_0xe638('0x32')]('id')[_0xe638('0x64')]()[_0xe638('0x65')]();return _0x36bfed;});}function getUpdatedSortOptions(_0x19190d){var _0x2f59f8={'fields':[],'order':null};var _0x17e51a=_0x19190d[_0xe638('0x66')](',');_0x2f59f8[_0xe638('0x67')]=_['filter'](_0x17e51a,function(_0x5753eb){if(!_0x5753eb[_0xe638('0x5f')](_0xe638('0x68')))return!![];_0x2f59f8[_0xe638('0x69')]=_['startsWith'](_0x5753eb,'-')?_0xe638('0x6a'):_0xe638('0x6b');return![];});return _0x2f59f8;}function orderAgentsByStatus(_0x401d69,_0x3488de){return _0x401d69[_0xe638('0x6c')](function(_0x42f2d4,_0x1d401c){if(_0x42f2d4[_0xe638('0x68')]===_0x1d401c[_0xe638('0x68')]&&_0x42f2d4[_0xe638('0x68')]===_0xe638('0x53')){if(_0x3488de===_0xe638('0x6a'))return(_0x42f2d4['pauseType']||'')<(_0x1d401c['pauseType']||'')?0x1:-0x1;return _0x42f2d4[_0xe638('0x6d')]<_0x1d401c[_0xe638('0x6d')]?-0x1:0x1;}else{if(_0x3488de===_0xe638('0x6a'))return _0x42f2d4[_0xe638('0x68')]<_0x1d401c[_0xe638('0x68')]?0x1:-0x1;return _0x42f2d4[_0xe638('0x68')]<_0x1d401c[_0xe638('0x68')]?-0x1:0x1;}});}exports[_0xe638('0x6e')]=function(_0x326031,_0x1c73d3){var _0x60efdb={'count':0x0,'rows':[]},_0x112f08={},_0xd8b5a4,_0x425ff7,_0x226f1b,_0x3df4a0,_0x9c8e8c=[_0xe638('0x6f'),_0xe638('0x41'),_0xe638('0x70'),_0xe638('0x71'),_0xe638('0x6d'),_0xe638('0x71'),_0xe638('0x3c'),_0xe638('0x72'),_0xe638('0x4d'),_0xe638('0x73'),_0xe638('0x4f'),_0xe638('0x74'),_0xe638('0x51'),'faxPause','voicePause',_0xe638('0x75'),_0xe638('0x76'),_0xe638('0x77'),_0xe638('0x78'),_0xe638('0x79'),_0xe638('0x7a'),_0xe638('0x7b'),'openchannelCurrentCapacity',_0xe638('0x7c'),_0xe638('0x7d'),'whatsappCurrentCapacity',_0xe638('0x7e'),_0xe638('0x54'),'openchannelStatus','mailStatus',_0xe638('0x58'),_0xe638('0x59'),_0xe638('0x55'),_0xe638('0x42'),_0xe638('0x7f'),_0xe638('0x80'),'mailStatusTime',_0xe638('0x81'),_0xe638('0x82'),'faxStatusTime',_0xe638('0x83'),_0xe638('0x84'),_0xe638('0x85'),_0xe638('0x86'),_0xe638('0x87'),_0xe638('0x88'),_0xe638('0x89')],_0x50ea44=[_0xe638('0x4d'),'openchannelPause',_0xe638('0x4f'),_0xe638('0x74'),_0xe638('0x51'),_0xe638('0x4e'),_0xe638('0x50'),'online'];Promise[_0xe638('0x8a')]()['then'](function(){if(_0x326031[_0xe638('0x8b')]['channel'])_0xd8b5a4=validateChannel(_0x326031[_0xe638('0x8b')][_0xe638('0x8c')]);if(!_0x326031[_0xe638('0x8b')][_0xe638('0x6c')]||!_0x326031[_0xe638('0x8b')]['sort']['includes'](_0xe638('0x68')))return;var _0x5d73d5=getUpdatedSortOptions(_0x326031[_0xe638('0x8b')]['sort']);_0x326031['query']['sort']=_0x5d73d5[_0xe638('0x67')]['join'](',');_0x425ff7=_0x5d73d5['order'];})[_0xe638('0x13')](function(){if(!_0x326031[_0xe638('0x8b')]['globalQueueFilter'])return[];var _0x2e1f81=_[_0xe638('0x46')](_0xd8b5a4)+_0xe638('0x44');return getFilteredAgentIds(_0x326031[_0xe638('0x8b')][_0xe638('0x8d')],_0x2e1f81);})['then'](function(_0x2ec25f){var _0x5bbb70=_[_0xe638('0x32')](db[_0xe638('0x43')][_0xe638('0x8e')],function(_0x38dee2){return{'name':_0x38dee2[_0xe638('0x8f')],'type':_0x38dee2[_0xe638('0x90')][_0xe638('0x91')]};});_0x326031[_0xe638('0x8b')][_0xe638('0x92')]=_0xe638('0x93');_0x326031['query'][_0xe638('0x41')]=!![];_0x112f08=qs['getOptions'](_0x5bbb70,_0x326031);_0x112f08[_0xe638('0x94')]=!![];if(!_[_0xe638('0x95')](_0x2ec25f)){_0x112f08[_0xe638('0x96')]=_[_0xe638('0x17')](_0x112f08[_0xe638('0x96')],{'$and':[{'id':{'$in':_0x2ec25f}}]});}else if(!_[_0xe638('0x95')](_0x326031['query'][_0xe638('0x8d')])){return _0x60efdb;}if(_0x326031[_0xe638('0x97')][_0xe638('0x92')]===_0xe638('0x97')){var _0xe19875={'params':{'id':_0x326031[_0xe638('0x97')]['userProfileId']},'query':{'section':_0xe638('0x12'),'role':_0xe638('0x93'),'online':!![],'nolimit':_0x326031[_0xe638('0x8b')][_0xe638('0x98')],'sort':_0x326031[_0xe638('0x8b')][_0xe638('0x6c')],'filter':_0x326031['query'][_0xe638('0x39')],'raw':!![],'ids':_0x2ec25f}};return db[_0xe638('0x99')]['getResources'](_0xe19875);}return db[_0xe638('0x43')]['findAndCountAll'](_0x112f08);})[_0xe638('0x13')](function(_0x3b1490){_0x60efdb[_0xe638('0x9')]=_0x3b1490[_0xe638('0x9')];_0x226f1b=_0x3b1490[_0xe638('0x9a')];return getRealtimeAgents();})[_0xe638('0x13')](function(_0x50be52){_0x3df4a0=_0x50be52[_0xe638('0x9a')];return _0x226f1b['map'](function(_0x529007){var _0x29f8c8=_[_0xe638('0x37')](_0x3df4a0,['id',_0x529007['id']]);if(_0x29f8c8)_[_0xe638('0x17')](_0x529007,_[_0xe638('0x38')](_[_0xe638('0x9b')](_0x29f8c8,_0x50ea44),_0x9c8e8c));_0x529007[_0xe638('0x68')]=getAgentStatus(_0x529007);return _0x529007;});})[_0xe638('0x13')](function(_0x11a099){var _0x5e976d;if(_0x326031[_0xe638('0x8b')][_0xe638('0x9c')]){_0x5e976d=_[_0xe638('0x39')](_0x11a099,[_0xe638('0x68'),_0x326031['query'][_0xe638('0x9c')]]);if(_0x326031[_0xe638('0x8b')][_0xe638('0x9d')]){_0x5e976d=_[_0xe638('0x39')](_0x5e976d,[_0xe638('0x6d'),_0x326031[_0xe638('0x8b')][_0xe638('0x9d')]]);}}if(_0x5e976d)_0x11a099=_0x5e976d;if(!_0x425ff7)return _0x11a099;return orderAgentsByStatus(_0x11a099,_0x425ff7);})[_0xe638('0x13')](function(_0x28748f){_0x60efdb[_0xe638('0x9a')]=_0x28748f;return _0x60efdb;})[_0xe638('0x13')](respondWithFilteredResult(_0x1c73d3,_0x112f08))['catch'](handleError(_0x1c73d3,null));};exports[_0xe638('0x9e')]=function(_0x217635,_0x35b393){var _0x307236={'count':0x0,'rows':[]},_0x2fe96d={},_0x572d3d,_0x30626b,_0x309cee,_0x1229c0,_0xb88b7d;Promise['resolve']()['then'](function(){if(_0x217635[_0xe638('0x8b')][_0xe638('0x8c')])_0x572d3d=validateChannel(_0x217635[_0xe638('0x8b')][_0xe638('0x8c')]);var _0x4994f0=_[_0xe638('0x46')](_0x572d3d)+_0xe638('0x44');var _0xed7dd0=_[_0xe638('0x32')](db[_0x4994f0]['rawAttributes'],function(_0x18deb3){return{'name':_0x18deb3[_0xe638('0x8f')],'type':_0x18deb3['type']['key']};});_0x2fe96d=qs[_0xe638('0x9f')](_0xed7dd0,_0x217635);if(_0x217635[_0xe638('0x97')][_0xe638('0x92')]===_0xe638('0x97')){var _0x2782bc={'params':{'id':_0x217635[_0xe638('0x97')][_0xe638('0xa0')]},'query':{'section':_0x572d3d===_0xe638('0x19')&&_0x217635['query'][_0xe638('0x90')]===_0xe638('0x21')?_0xe638('0xa1'):_[_0xe638('0x46')](_0x572d3d)+_0xe638('0xa2'),'type':_0x217635['query'][_0xe638('0x90')],'nolimit':!![],'sort':'name','filter':_0x217635[_0xe638('0x8b')]['filter']}};return db[_0xe638('0x99')]['getResources'](_0x2782bc);}return db[_0x4994f0][_0xe638('0xa3')](_0x2fe96d);})[_0xe638('0x13')](function(_0x33ae4d){_0x307236[_0xe638('0x9')]=_0x33ae4d[_0xe638('0x9')];_0x30626b=_0x33ae4d['rows'];return getRealtimeQueues(_0x217635,_0x572d3d);})[_0xe638('0x13')](function(_0x3968bc){_0x1229c0=_0x3968bc['rows'];return getRealtimeAgents();})[_0xe638('0x13')](function(_0x18d26b){_0x309cee=_0x18d26b['rows'];if(_0x572d3d!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xe638('0x13')](function(_0x2d4e50){_0xb88b7d=_0x2d4e50?_0x2d4e50['rows']:[];return initializeQueues(_0x30626b,_0x1229c0,_0x572d3d,_0x217635[_0xe638('0x8b')]['type']);})[_0xe638('0x13')](function(_0xc6cfa5){var _0x568d47=_0xc6cfa5['map'](function(_0x1df88c){if(_0x572d3d==='voice')return getVoiceQueueAgents(_0x1df88c,_0x30626b,_0x309cee,_0xb88b7d);else return getQueueAgents(_0x1df88c,_0x309cee,_0x572d3d);});return Promise[_0xe638('0x62')](_0x568d47);})[_0xe638('0x13')](function(_0x48c3d4){_0x307236['rows']=_0x48c3d4;return _0x307236;})[_0xe638('0x13')](respondWithFilteredResult(_0x35b393,_0x2fe96d))[_0xe638('0x18')](handleError(_0x35b393,null));}; \ No newline at end of file +var _0x9f9e=['isArray','getAgents','all','flatten','map','uniq','value','split','fields','includes','globalStatus','startsWith','DESC','ASC','pauseType','lastLoginAt','lastPauseAt','address','chatPause','chatCapacity','openchannelCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','query','channel','sort','join','order','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','isEmpty','where','user','nolimit','UserProfile','findAndCountAll','rows','globalStatusFilter','pauseTypeFilter','userProfileId','Queues','getResources','util','jayson/promise','../../components/parsers/qs','../../mysqldb','client','http','offset','limit','undefined','count','status','set','stack','name','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','paused','voice','outbound','push','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','agents','loggedInDb','busy','pick','queue','length','some','internal','find','UserId','voiceStatus','online','User','Queue','Pause','findAll','QueueId','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','idle','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','openchannel','fax','whatsapp','toLowerCase','Invalid\x20channel'];(function(_0x4ff871,_0xd2a39f){var _0x1b0b20=function(_0xd46f3c){while(--_0xd46f3c){_0x4ff871['push'](_0x4ff871['shift']());}};_0x1b0b20(++_0xd2a39f);}(_0x9f9e,0x183));var _0xe9f9=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0x9f9e[_0x72a33d];return _0x2621d5;};'use strict';var util=require(_0xe9f9('0x0'));var _=require('lodash');var jayson=require(_0xe9f9('0x1'));var qs=require(_0xe9f9('0x2'));var logger=require('../../config/logger')('api');var db=require(_0xe9f9('0x3'))['db'];var amiClient=jayson[_0xe9f9('0x4')][_0xe9f9('0x5')]({'port':0x232a});var routingClient=jayson[_0xe9f9('0x4')][_0xe9f9('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x29eece,_0x9f6b3b){return function(_0x2ec9d8){if(_0x2ec9d8){var _0x24bd97=typeof _0x9f6b3b[_0xe9f9('0x6')]==='undefined'&&typeof _0x9f6b3b[_0xe9f9('0x7')]===_0xe9f9('0x8');var _0x975540=_0x2ec9d8[_0xe9f9('0x9')];var _0x45f510=_0x24bd97?0x0:_0x9f6b3b[_0xe9f9('0x6')];var _0x4eab89=_0x24bd97?_0x2ec9d8[_0xe9f9('0x9')]:_0x9f6b3b['offset']+_0x9f6b3b['limit'];var _0x61abd1;if(_0x4eab89>=_0x975540){_0x4eab89=_0x975540;_0x61abd1=0xc8;}else{_0x61abd1=0xce;}_0x29eece[_0xe9f9('0xa')](_0x61abd1);return _0x29eece[_0xe9f9('0xb')]('Content-Range',_0x45f510+'-'+_0x4eab89+'/'+_0x975540)['json'](_0x2ec9d8);}return null;};}function handleError(_0x576ab5,_0x1eee79){_0x1eee79=_0x1eee79||0x1f4;return function(_0x8d616a){logger['error'](_0x8d616a[_0xe9f9('0xc')]);if(_0x8d616a[_0xe9f9('0xd')]){delete _0x8d616a[_0xe9f9('0xd')];}_0x576ab5[_0xe9f9('0xa')](_0x1eee79)['send'](_0x8d616a);};}function getRealtimeAgents(){return new Promise(function(_0x22b75e,_0x1a8fb3){return amiClient[_0xe9f9('0xe')](_0xe9f9('0xf'),{})['then'](function(_0x472308){if(_0x472308[_0xe9f9('0x10')])throw new Error(_0xe9f9('0x11'));var _0x3e7b7c=_0x472308[_0xe9f9('0x12')];return routingClient[_0xe9f9('0xe')](_0xe9f9('0xf'),{})[_0xe9f9('0x13')](function(_0xcf72f9){if(_0xcf72f9[_0xe9f9('0x10')])throw new Error(_0xe9f9('0x14'));var _0x233c1e=_0xcf72f9['result'];return _0x22b75e(_[_0xe9f9('0x15')]({},_0x3e7b7c,_0x233c1e));});})[_0xe9f9('0x16')](function(_0x1790db){_0x1a8fb3(_0x1790db);});});}function getRealtimeQueues(_0x42aa6e,_0x4668e6){return new Promise(function(_0x456997,_0x290aca){var _0x40e7b0=_0x4668e6==='voice'?amiClient:routingClient;return _0x40e7b0[_0xe9f9('0xe')](_[_0xe9f9('0x17')](_0x4668e6)+'Queues',_0x42aa6e)[_0xe9f9('0x13')](function(_0x59ce48){if(_0x59ce48['error'])throw new Error(util[_0xe9f9('0x18')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4668e6));return _0x456997(_0x59ce48['result']);})[_0xe9f9('0x16')](function(_0x40dd80){_0x290aca(_0x40dd80);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x103d3a,_0x5b53f7){return amiClient[_0xe9f9('0xe')]('VoiceQueuesChannels',{})[_0xe9f9('0x13')](function(_0x2bb8df){if(_0x2bb8df[_0xe9f9('0x10')])throw new Error(_0xe9f9('0x19'));return _0x103d3a(_0x2bb8df[_0xe9f9('0x12')]);})[_0xe9f9('0x16')](function(_0xe5e471){_0x5b53f7(_0xe5e471);});});}function initializeQueues(_0x4726fe,_0x3e87cb,_0x541372,_0x584a7c){var _0x5bd4e4=[_0xe9f9('0x1a'),'available',_0xe9f9('0x1b'),_0xe9f9('0x1c'),_0xe9f9('0x1d')];if(_0x541372===_0xe9f9('0x1e')&&_0x584a7c===_0xe9f9('0x1f')){_0x5bd4e4[_0xe9f9('0x20')]('pTalking',_0xe9f9('0x21'),_0xe9f9('0x22'),_0xe9f9('0x23'),_0xe9f9('0x24'),_0xe9f9('0x25'),_0xe9f9('0x26'),_0xe9f9('0x27'),_0xe9f9('0x28'),_0xe9f9('0x29'),_0xe9f9('0x2a'),_0xe9f9('0x2b'),_0xe9f9('0x2c'),_0xe9f9('0x2d'),_0xe9f9('0x2e'),_0xe9f9('0x2f'),_0xe9f9('0x30'),'predictiveIntervalAnsweredCalls',_0xe9f9('0x31'),'predictiveIntervalDroppedCallsCallersExit',_0xe9f9('0x32'),_0xe9f9('0x33'));}return _0x4726fe['map'](function(_0x3876a3){var _0x23b458=_0x3876a3[_0xe9f9('0x34')]({'plain':!![]});_0x23b458[_0xe9f9('0x35')]=[];_0x23b458[_0xe9f9('0x1d')]=0x0;_0x23b458[_0xe9f9('0x36')]=0x0;_0x23b458[_0xe9f9('0x1a')]=0x0;_0x23b458['available']=0x0;_0x23b458[_0xe9f9('0x1b')]=0x0;if(_0x541372===_0xe9f9('0x1e')){_0x23b458[_0xe9f9('0x1c')]=0x0;_0x23b458[_0xe9f9('0x37')]=0x0;if(_0x584a7c===_0xe9f9('0x1f')){_0x23b458['pTalking']=0x0;_0x23b458[_0xe9f9('0x21')]=0x0;}}var _0x314450=_['find'](_0x3e87cb,['id',_0x23b458['id']]);if(_0x314450)_[_0xe9f9('0x15')](_0x23b458,_[_0xe9f9('0x38')](_0x314450,_0x5bd4e4));return _0x23b458;});}function updateAgentVoiceStatus(_0x5ac779,_0x4063db,_0x554f09){var _0x3f3629=_['filter'](_0x554f09,[_0xe9f9('0x39'),_0x4063db[_0xe9f9('0xd')]]);if(_0x3f3629[_0xe9f9('0x3a')]===0x0)return _0x5ac779[_0xe9f9('0x37')]=!![];if(_[_0xe9f9('0x3b')](_0x3f3629,['connectedlinenum',_0x5ac779[_0xe9f9('0x3c')]['toString']()]))return _0x5ac779[_0xe9f9('0x1c')]=!![];if(!_0x5ac779[_0xe9f9('0x1c')])return _0x5ac779[_0xe9f9('0x37')]=!![];}function getVoiceQueueAgents(_0x39561e,_0x57f55b,_0x5b3466,_0x593774){var _0x44853c=_[_0xe9f9('0x3d')](_0x57f55b,['id',_0x39561e['id']]);if(!_0x44853c)return _0x39561e;return _0x44853c['getMembers']({'raw':!![]})[_0xe9f9('0x13')](function(_0x5ca322){for(var _0x105e46=0x0;_0x105e46<_0x5ca322[_0xe9f9('0x3a')];_0x105e46++){var _0x2f6624=_[_0xe9f9('0x3d')](_0x5b3466,['id',_0x5ca322[_0x105e46]['UserId']]);if(!_0x2f6624){_0x2f6624={'id':_0x5ca322[_0x105e46][_0xe9f9('0x3e')],'name':_0x5ca322[_0x105e46]['UserId'],'accountcode':'','online':![]};}var _0x271f3c={'id':_0x2f6624['id'],'name':_0x2f6624[_0xe9f9('0xd')],'internal':_0x2f6624['accountcode'],'online':Boolean(_0x2f6624['online']),'paused':Boolean(_0x5ca322[_0x105e46][_0xe9f9('0x1d')])};if(_0x2f6624[_0xe9f9('0x3f')]==='talking')updateAgentVoiceStatus(_0x271f3c,_0x39561e,_0x593774);if(_0x271f3c[_0xe9f9('0x40')])_0x39561e[_0xe9f9('0x36')]++;if(_0x271f3c['busy'])_0x39561e[_0xe9f9('0x37')]++;if(_0x271f3c['paused']&&!_0x271f3c['busy']&&!_0x271f3c[_0xe9f9('0x1c')])_0x39561e[_0xe9f9('0x1d')]++;_0x39561e['agents'][_0xe9f9('0x20')](_0x271f3c);}return _0x39561e;});}function getQueueAgents(_0xb864ce,_0x22cf2e,_0x3ed1e0){var _0x121e40=_0xe9f9('0x41')+_[_0xe9f9('0x17')](_0x3ed1e0)+_0xe9f9('0x42');var _0x1df045=_0x3ed1e0+_0xe9f9('0x43');return db[_0x121e40][_0xe9f9('0x44')]({'where':{[_[_0xe9f9('0x17')](_0x3ed1e0)+_0xe9f9('0x45')]:_0xb864ce['id']},'raw':!![]})[_0xe9f9('0x13')](function(_0x199407){for(var _0x598643=0x0;_0x598643<_0x199407[_0xe9f9('0x3a')];_0x598643++){var _0x4f74fc=_['find'](_0x22cf2e,['id',_0x199407[_0x598643][_0xe9f9('0x3e')]]);if(!_0x4f74fc){_0x4f74fc={'id':_0x199407[_0x598643][_0xe9f9('0x3e')],'name':_0x199407[_0x598643][_0xe9f9('0x3e')],'online':![],['pauseField']:![]};}var _0x118e84={'id':_0x4f74fc['id'],'name':_0x4f74fc[_0xe9f9('0xd')],'online':Boolean(_0x4f74fc['online']),'paused':Boolean(_0x4f74fc[_0x1df045])};if(_0x118e84[_0xe9f9('0x40')])_0xb864ce[_0xe9f9('0x36')]++;_0xb864ce[_0xe9f9('0x35')][_0xe9f9('0x20')](_0x118e84);}return _0xb864ce;});}function isIdle(_0x1c6402){return _0x1c6402==='idle'||_0x1c6402===_0xe9f9('0x46')||_0x1c6402===_0xe9f9('0x47')||_0x1c6402===_0xe9f9('0x48')||_[_0xe9f9('0x49')](_0x1c6402);}function isAgentPaused(_0x587a66,_0x26fe2d){var _0x5da9df=[_0x587a66['chatPause'],_0x587a66[_0xe9f9('0x4a')],_0x587a66[_0xe9f9('0x4b')],_0x587a66[_0xe9f9('0x4c')],_0x587a66[_0xe9f9('0x4d')],_0x587a66[_0xe9f9('0x4e')],_0x587a66[_0xe9f9('0x4f')]];if(!_0x26fe2d)return _[_0xe9f9('0x50')](_0x5da9df);var _0xbddfed=_[_0xe9f9('0x51')](_0x5da9df);return _0xbddfed[_0xe9f9('0x3a')]>0x0&&_0xbddfed[_0xe9f9('0x3a')]<_0x5da9df['length']?!![]:![];}function isAgentIdle(_0x110a7f){if(_0x110a7f[_0xe9f9('0x3f')]!==_0xe9f9('0x52')&&_0x110a7f[_0xe9f9('0x4e')]){_0x110a7f[_0xe9f9('0x3f')]=_0xe9f9('0x53');return![];}return _[_0xe9f9('0x50')]([_0x110a7f[_0xe9f9('0x54')],_0x110a7f['faxStatus'],_0x110a7f[_0xe9f9('0x55')],_0x110a7f[_0xe9f9('0x56')],_0x110a7f[_0xe9f9('0x57')],_0x110a7f[_0xe9f9('0x3f')],_0x110a7f[_0xe9f9('0x58')]],isIdle);}function getAgentStatus(_0x17e8a4){var _0x5c3c1b='unknown';if(isAgentPaused(_0x17e8a4))_0x5c3c1b='pause';else if(isAgentPaused(_0x17e8a4,!![]))_0x5c3c1b=_0xe9f9('0x59');else if(isAgentIdle(_0x17e8a4))_0x5c3c1b=_0xe9f9('0x52');else _0x5c3c1b=_0xe9f9('0x37');return _0x5c3c1b;}function validateChannel(_0x3b9d87){var _0x32df5f=[_0xe9f9('0x5a'),'chat','sms',_0xe9f9('0x5b'),_0xe9f9('0x5c'),_0xe9f9('0x5d'),_0xe9f9('0x1e')];if(!_['includes'](_0x32df5f,_0x3b9d87[_0xe9f9('0x5e')]()))throw new Error(_0xe9f9('0x5f'));return _0x3b9d87['toLowerCase']();}function getFilteredAgentIds(_0x742ffd,_0x4ff4e0){var _0x1f2d86=_[_0xe9f9('0x60')](_0x742ffd)?_0x742ffd:[_0x742ffd];var _0x4ca56f=_['map'](_0x1f2d86,function(_0x4001ae){return db[_0x4ff4e0]['findOne']({'where':{'name':_0x4001ae}})['then'](function(_0x33de2c){if(!_0x33de2c)return[];return _0x33de2c[_0xe9f9('0x61')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe9f9('0x62')](_0x4ca56f)[_0xe9f9('0x13')](function(_0x40e47f){var _0x537376=_(_0x40e47f)[_0xe9f9('0x63')]()[_0xe9f9('0x64')]('id')[_0xe9f9('0x65')]()[_0xe9f9('0x66')]();return _0x537376;});}function getUpdatedSortOptions(_0x5a2c81){var _0x37b5ff={'fields':[],'order':null};var _0x56d16e=_0x5a2c81[_0xe9f9('0x67')](',');_0x37b5ff[_0xe9f9('0x68')]=_['filter'](_0x56d16e,function(_0x2ff0f1){if(!_0x2ff0f1[_0xe9f9('0x69')](_0xe9f9('0x6a')))return!![];_0x37b5ff['order']=_[_0xe9f9('0x6b')](_0x2ff0f1,'-')?_0xe9f9('0x6c'):_0xe9f9('0x6d');return![];});return _0x37b5ff;}function orderAgentsByStatus(_0x197909,_0x3624b4){return _0x197909['sort'](function(_0x37c9c1,_0x40e80b){if(_0x37c9c1[_0xe9f9('0x6a')]===_0x40e80b[_0xe9f9('0x6a')]&&_0x37c9c1['globalStatus']===_0xe9f9('0x53')){if(_0x3624b4==='DESC')return(_0x37c9c1[_0xe9f9('0x6e')]||'')<(_0x40e80b[_0xe9f9('0x6e')]||'')?0x1:-0x1;return _0x37c9c1['pauseType']<_0x40e80b[_0xe9f9('0x6e')]?-0x1:0x1;}else{if(_0x3624b4===_0xe9f9('0x6c'))return _0x37c9c1[_0xe9f9('0x6a')]<_0x40e80b[_0xe9f9('0x6a')]?0x1:-0x1;return _0x37c9c1[_0xe9f9('0x6a')]<_0x40e80b['globalStatus']?-0x1:0x1;}});}exports[_0xe9f9('0x61')]=function(_0x1fa69a,_0x5d8bb4){var _0x57e884={'count':0x0,'rows':[]},_0x312be5={},_0x3e996f,_0x77194f,_0x3feec7,_0x5ba272,_0x30e3bc=['userpic',_0xe9f9('0x40'),_0xe9f9('0x6f'),'lastPauseAt',_0xe9f9('0x6e'),_0xe9f9('0x70'),'internal',_0xe9f9('0x71'),_0xe9f9('0x72'),_0xe9f9('0x4c'),'mailPause',_0xe9f9('0x4d'),'whatsappPause','faxPause',_0xe9f9('0x4e'),_0xe9f9('0x73'),_0xe9f9('0x74'),'mailCapacity','smsCapacity','whatsappCapacity',_0xe9f9('0x75'),_0xe9f9('0x76'),_0xe9f9('0x77'),_0xe9f9('0x78'),_0xe9f9('0x79'),_0xe9f9('0x7a'),_0xe9f9('0x7b'),_0xe9f9('0x54'),_0xe9f9('0x56'),_0xe9f9('0x55'),_0xe9f9('0x57'),_0xe9f9('0x58'),_0xe9f9('0x7c'),'voiceStatus',_0xe9f9('0x7d'),_0xe9f9('0x7e'),_0xe9f9('0x7f'),_0xe9f9('0x80'),'whatsappStatusTime',_0xe9f9('0x81'),_0xe9f9('0x82'),_0xe9f9('0x39'),_0xe9f9('0x83'),_0xe9f9('0x84'),_0xe9f9('0x85'),'phoneBarEnableAutomaticScreenRecording',_0xe9f9('0x86')],_0x229dea=[_0xe9f9('0x72'),_0xe9f9('0x4c'),'mailPause',_0xe9f9('0x4d'),_0xe9f9('0x4f'),_0xe9f9('0x4a'),'voicePause','online'];Promise['resolve']()[_0xe9f9('0x13')](function(){if(_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x88')])_0x3e996f=validateChannel(_0x1fa69a['query'][_0xe9f9('0x88')]);if(!_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x89')]||!_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x89')][_0xe9f9('0x69')](_0xe9f9('0x6a')))return;var _0x441c9b=getUpdatedSortOptions(_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x89')]);_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x89')]=_0x441c9b[_0xe9f9('0x68')][_0xe9f9('0x8a')](',');_0x77194f=_0x441c9b[_0xe9f9('0x8b')];})[_0xe9f9('0x13')](function(){if(!_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x8c')])return[];var _0x13f396=_[_0xe9f9('0x17')](_0x3e996f)+_0xe9f9('0x42');return getFilteredAgentIds(_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x8c')],_0x13f396);})[_0xe9f9('0x13')](function(_0x411ecc){var _0x2ca6cb=_['map'](db['User'][_0xe9f9('0x8d')],function(_0x293010){return{'name':_0x293010[_0xe9f9('0x8e')],'type':_0x293010[_0xe9f9('0x8f')][_0xe9f9('0x90')]};});_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x91')]=_0xe9f9('0x92');_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x40')]=!![];_0x312be5=qs[_0xe9f9('0x93')](_0x2ca6cb,_0x1fa69a);_0x312be5[_0xe9f9('0x94')]=!![];if(!_[_0xe9f9('0x95')](_0x411ecc)){_0x312be5[_0xe9f9('0x96')]=_[_0xe9f9('0x15')](_0x312be5['where'],{'$and':[{'id':{'$in':_0x411ecc}}]});}else if(!_[_0xe9f9('0x95')](_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x8c')])){return _0x57e884;}if(_0x1fa69a[_0xe9f9('0x97')][_0xe9f9('0x91')]===_0xe9f9('0x97')){var _0x39ff04={'params':{'id':_0x1fa69a[_0xe9f9('0x97')]['userProfileId']},'query':{'section':_0xe9f9('0xf'),'role':'agent','online':!![],'nolimit':_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x98')],'sort':_0x1fa69a['query'][_0xe9f9('0x89')],'filter':_0x1fa69a[_0xe9f9('0x87')]['filter'],'raw':!![],'ids':_0x411ecc}};return db[_0xe9f9('0x99')]['getResources'](_0x39ff04);}return db[_0xe9f9('0x41')][_0xe9f9('0x9a')](_0x312be5);})[_0xe9f9('0x13')](function(_0x22ef74){_0x57e884[_0xe9f9('0x9')]=_0x22ef74[_0xe9f9('0x9')];_0x3feec7=_0x22ef74[_0xe9f9('0x9b')];return getRealtimeAgents();})[_0xe9f9('0x13')](function(_0x4987f6){_0x5ba272=_0x4987f6['rows'];return _0x3feec7[_0xe9f9('0x64')](function(_0x277f34){var _0x265439=_['find'](_0x5ba272,['id',_0x277f34['id']]);if(_0x265439)_[_0xe9f9('0x15')](_0x277f34,_['pick'](_['omit'](_0x265439,_0x229dea),_0x30e3bc));_0x277f34['globalStatus']=getAgentStatus(_0x277f34);return _0x277f34;});})[_0xe9f9('0x13')](function(_0x1b28ea){var _0x163153;if(_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x9c')]){_0x163153=_[_0xe9f9('0x51')](_0x1b28ea,[_0xe9f9('0x6a'),_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x9c')]]);if(_0x1fa69a[_0xe9f9('0x87')][_0xe9f9('0x9d')]){_0x163153=_[_0xe9f9('0x51')](_0x163153,[_0xe9f9('0x6e'),_0x1fa69a['query'][_0xe9f9('0x9d')]]);}}if(_0x163153)_0x1b28ea=_0x163153;if(!_0x77194f)return _0x1b28ea;return orderAgentsByStatus(_0x1b28ea,_0x77194f);})[_0xe9f9('0x13')](function(_0x377a67){_0x57e884[_0xe9f9('0x9b')]=_0x377a67;return _0x57e884;})[_0xe9f9('0x13')](respondWithFilteredResult(_0x5d8bb4,_0x312be5))['catch'](handleError(_0x5d8bb4,null));};exports['getQueues']=function(_0x961929,_0x1e5299){var _0x5559cd={'count':0x0,'rows':[]},_0x5e2bf2={},_0x2ca1f0,_0x3bb9c2,_0x3e0a00,_0x49110d,_0x54cefd;Promise['resolve']()['then'](function(){if(_0x961929['query'][_0xe9f9('0x88')])_0x2ca1f0=validateChannel(_0x961929[_0xe9f9('0x87')][_0xe9f9('0x88')]);var _0x4652b5=_[_0xe9f9('0x17')](_0x2ca1f0)+'Queue';var _0x1d9415=_[_0xe9f9('0x64')](db[_0x4652b5][_0xe9f9('0x8d')],function(_0x1f1e5c){return{'name':_0x1f1e5c[_0xe9f9('0x8e')],'type':_0x1f1e5c[_0xe9f9('0x8f')][_0xe9f9('0x90')]};});_0x5e2bf2=qs[_0xe9f9('0x93')](_0x1d9415,_0x961929);if(_0x961929['user'][_0xe9f9('0x91')]==='user'){var _0x51eeab={'params':{'id':_0x961929[_0xe9f9('0x97')][_0xe9f9('0x9e')]},'query':{'section':_0x2ca1f0===_0xe9f9('0x1e')&&_0x961929[_0xe9f9('0x87')]['type']===_0xe9f9('0x1f')?'QueueCampaigns':_[_0xe9f9('0x17')](_0x2ca1f0)+_0xe9f9('0x9f'),'type':_0x961929[_0xe9f9('0x87')][_0xe9f9('0x8f')],'nolimit':!![],'sort':_0xe9f9('0xd'),'filter':_0x961929['query']['filter']}};return db[_0xe9f9('0x99')][_0xe9f9('0xa0')](_0x51eeab);}return db[_0x4652b5]['findAndCountAll'](_0x5e2bf2);})[_0xe9f9('0x13')](function(_0x20057c){_0x5559cd[_0xe9f9('0x9')]=_0x20057c[_0xe9f9('0x9')];_0x3bb9c2=_0x20057c['rows'];return getRealtimeQueues(_0x961929,_0x2ca1f0);})[_0xe9f9('0x13')](function(_0x577436){_0x49110d=_0x577436[_0xe9f9('0x9b')];return getRealtimeAgents();})[_0xe9f9('0x13')](function(_0x1b7ec1){_0x3e0a00=_0x1b7ec1['rows'];if(_0x2ca1f0!=_0xe9f9('0x1e'))return;return getRealtimeVoiceQueueChannels();})[_0xe9f9('0x13')](function(_0x3c9f20){_0x54cefd=_0x3c9f20?_0x3c9f20[_0xe9f9('0x9b')]:[];return initializeQueues(_0x3bb9c2,_0x49110d,_0x2ca1f0,_0x961929['query'][_0xe9f9('0x8f')]);})['then'](function(_0x4d4a6d){var _0x9f89ed=_0x4d4a6d['map'](function(_0x15d290){if(_0x2ca1f0===_0xe9f9('0x1e'))return getVoiceQueueAgents(_0x15d290,_0x3bb9c2,_0x3e0a00,_0x54cefd);else return getQueueAgents(_0x15d290,_0x3e0a00,_0x2ca1f0);});return Promise['all'](_0x9f89ed);})[_0xe9f9('0x13')](function(_0x2d226c){_0x5559cd[_0xe9f9('0x9b')]=_0x2d226c;return _0x5559cd;})[_0xe9f9('0x13')](respondWithFilteredResult(_0x1e5299,_0x5e2bf2))[_0xe9f9('0x16')](handleError(_0x1e5299,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 55047c4..ea6a96b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x284f58,_0x4218ca){var _0x33cbe1=function(_0x30acc3){while(--_0x30acc3){_0x284f58['push'](_0x284f58['shift']());}};_0x33cbe1(++_0x4218ca);}(_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(_0x3df289,_0x288dad){var _0x384eae=function(_0xc12a85){while(--_0xc12a85){_0x3df289['push'](_0x3df289['shift']());}};_0x384eae(++_0x288dad);}(_0xe706,0xa3));var _0x6e70=function(_0xe98508,_0x17f727){_0xe98508=_0xe98508-0x0;var _0x21f63e=_0xe706[_0xe98508];return _0x21f63e;};'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 53e1484..1dfef99 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 _0x6333=['DATE','INTEGER','STRING'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6333,0x83));var _0x3633=function(_0x23f507,_0x537be1){_0x23f507=_0x23f507-0x0;var _0x5228d7=_0x6333[_0x23f507];return _0x5228d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3633('0x0')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x3633('0x0')]},'starttime':{'type':Sequelize[_0x3633('0x1')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3633('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3633('0x0')]},'membername':{'type':Sequelize[_0x3633('0x0')]}}; \ No newline at end of file +var _0xdedd=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x218e99,_0x4a364f){var _0x47da41=function(_0x483838){while(--_0x483838){_0x218e99['push'](_0x218e99['shift']());}};_0x47da41(++_0x4a364f);}(_0xdedd,0x197));var _0xdded=function(_0x434e12,_0x27f1ff){_0x434e12=_0x434e12-0x0;var _0x5eb259=_0xdedd[_0x434e12];return _0x5eb259;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'state':{'type':Sequelize[_0xdded('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdded('0x3')]},'scheduledat':{'type':Sequelize[_0xdded('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdded('0x4')]},'responsetime':{'type':Sequelize[_0xdded('0x4')]},'ringtime':{'type':Sequelize[_0xdded('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdded('0x3')]},'campaigntype':{'type':Sequelize[_0xdded('0x3')]},'membername':{'type':Sequelize[_0xdded('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3a745b8..651dae3 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 _0x46d9=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x46d9,0x10e));var _0x946d=function(_0x100a7f,_0x142d3b){_0x100a7f=_0x100a7f-0x0;var _0x263d44=_0x46d9[_0x100a7f];return _0x263d44;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require(_0x946d('0x4'));var BPromise=require(_0x946d('0x5'));var rp=require(_0x946d('0x6'));var fs=require('fs');var path=require(_0x946d('0x7'));var rimraf=require(_0x946d('0x8'));var config=require(_0x946d('0x9'));var attributes=require(_0x946d('0xa'));module['exports']=function(_0x5de19a,_0x6ed05){return _0x5de19a[_0x946d('0xb')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e67=['request-promise','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','../../config/logger','api','moment'];(function(_0x34b545,_0x4d6171){var _0x5d3236=function(_0x17fc59){while(--_0x17fc59){_0x34b545['push'](_0x34b545['shift']());}};_0x5d3236(++_0x4d6171);}(_0x4e67,0xdd));var _0x74e6=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x4e67[_0x56608c];return _0x3c7fb0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x74e6('0x0'))(_0x74e6('0x1'));var moment=require(_0x74e6('0x2'));var BPromise=require('bluebird');var rp=require(_0x74e6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74e6('0x4'));var attributes=require(_0x74e6('0x5'));module['exports']=function(_0x2459b8,_0x308a1d){return _0x2459b8['define'](_0x74e6('0x6'),attributes,{'tableName':_0x74e6('0x7'),'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 3141f2d..9f23fc4 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 _0xa199=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','catch','create','body','options','raw','CreateReportAgentPreview','stringify'];(function(_0x50e884,_0x53a499){var _0x4ab93a=function(_0x2febf2){while(--_0x2febf2){_0x50e884['push'](_0x50e884['shift']());}};_0x4ab93a(++_0x53a499);}(_0xa199,0x138));var _0x9a19=function(_0x282e67,_0x3cdd0f){_0x282e67=_0x282e67-0x0;var _0x3a7f3b=_0xa199[_0x282e67];return _0x3a7f3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a19('0x0'));var BPromise=require('bluebird');var rs=require(_0x9a19('0x1'));var fs=require('fs');var Redis=require(_0x9a19('0x2'));var db=require(_0x9a19('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a19('0x4'))(_0x9a19('0x5'));var config=require(_0x9a19('0x6'));var jayson=require(_0x9a19('0x7'));var client=jayson[_0x9a19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19e4b8,_0x41e2ae,_0x4dece5){return new BPromise(function(_0x24dc70,_0xe752dd){return client[_0x9a19('0x9')](_0x19e4b8,_0x4dece5)['then'](function(_0x43f24e){logger[_0x9a19('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x41e2ae,'request\x20sent');logger[_0x9a19('0xb')](_0x9a19('0xc'),_0x41e2ae,'request\x20sent',JSON['stringify'](_0x43f24e));if(_0x43f24e[_0x9a19('0xd')]){if(_0x43f24e['error'][_0x9a19('0xe')]===0x1f4){logger[_0x9a19('0xd')](_0x9a19('0xf'),_0x41e2ae,_0x43f24e[_0x9a19('0xd')][_0x9a19('0x10')]);return _0xe752dd(_0x43f24e[_0x9a19('0xd')][_0x9a19('0x10')]);}logger['error'](_0x9a19('0xf'),_0x41e2ae,_0x43f24e['error'][_0x9a19('0x10')]);return _0x24dc70(_0x43f24e[_0x9a19('0xd')][_0x9a19('0x10')]);}else{logger['info'](_0x9a19('0xf'),_0x41e2ae,_0x9a19('0x11'));_0x24dc70(_0x43f24e[_0x9a19('0x12')][_0x9a19('0x10')]);}})[_0x9a19('0x13')](function(_0x6488d8){logger[_0x9a19('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x41e2ae,_0x6488d8);_0xe752dd(_0x6488d8);});});}exports['CreateReportAgentPreview']=function(_0x4a3182){var _0x3122ff=this;return new Promise(function(_0x100620,_0x4ce9be){return db['ReportAgentPreview'][_0x9a19('0x14')](_0x4a3182[_0x9a19('0x15')],{'raw':_0x4a3182[_0x9a19('0x16')]?_0x4a3182[_0x9a19('0x16')][_0x9a19('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3ba24d){logger[_0x9a19('0xa')](_0x9a19('0x18'),_0x4a3182);logger['debug'](_0x9a19('0x18'),_0x4a3182,JSON[_0x9a19('0x19')](_0x3ba24d));_0x100620(_0x3ba24d);})[_0x9a19('0x13')](function(_0xda532a){logger['error'](_0x9a19('0x18'),_0xda532a[_0x9a19('0x10')],_0x4a3182);_0x4ce9be(_0x3122ff[_0x9a19('0xd')](0x1f4,_0xda532a['message']));});});}; \ No newline at end of file +var _0xd554=['message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x2d2971,_0x59df2a){var _0x24d15e=function(_0x53d869){while(--_0x53d869){_0x2d2971['push'](_0x2d2971['shift']());}};_0x24d15e(++_0x59df2a);}(_0xd554,0x19f));var _0x4d55=function(_0xfc967d,_0x4419e6){_0xfc967d=_0xfc967d-0x0;var _0x1f9b56=_0xd554[_0xfc967d];return _0x1f9b56;};'use strict';var _=require(_0x4d55('0x0'));var util=require(_0x4d55('0x1'));var moment=require(_0x4d55('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d55('0x3'));var fs=require('fs');var Redis=require(_0x4d55('0x4'));var db=require(_0x4d55('0x5'))['db'];var utils=require(_0x4d55('0x6'));var logger=require(_0x4d55('0x7'))('rpc');var config=require(_0x4d55('0x8'));var jayson=require(_0x4d55('0x9'));var client=jayson[_0x4d55('0xa')][_0x4d55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ad311,_0x54abd3,_0x182fa1){return new BPromise(function(_0x1682e0,_0x33ba7e){return client[_0x4d55('0xc')](_0x3ad311,_0x182fa1)['then'](function(_0x208637){logger[_0x4d55('0xd')](_0x4d55('0xe'),_0x54abd3,'request\x20sent');logger[_0x4d55('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x54abd3,_0x4d55('0x10'),JSON[_0x4d55('0x11')](_0x208637));if(_0x208637[_0x4d55('0x12')]){if(_0x208637[_0x4d55('0x12')][_0x4d55('0x13')]===0x1f4){logger[_0x4d55('0x12')](_0x4d55('0xe'),_0x54abd3,_0x208637[_0x4d55('0x12')]['message']);return _0x33ba7e(_0x208637[_0x4d55('0x12')][_0x4d55('0x14')]);}logger[_0x4d55('0x12')](_0x4d55('0xe'),_0x54abd3,_0x208637[_0x4d55('0x12')]['message']);return _0x1682e0(_0x208637['error'][_0x4d55('0x14')]);}else{logger[_0x4d55('0xd')](_0x4d55('0xe'),_0x54abd3,_0x4d55('0x10'));_0x1682e0(_0x208637[_0x4d55('0x15')][_0x4d55('0x14')]);}})[_0x4d55('0x16')](function(_0x3c0449){logger[_0x4d55('0x12')](_0x4d55('0xe'),_0x54abd3,_0x3c0449);_0x33ba7e(_0x3c0449);});});}exports[_0x4d55('0x17')]=function(_0x3659db){var _0x33dc3e=this;return new Promise(function(_0x4765bc,_0x1094a6){return db[_0x4d55('0x18')]['create'](_0x3659db[_0x4d55('0x19')],{'raw':_0x3659db[_0x4d55('0x1a')]?_0x3659db['options'][_0x4d55('0x1b')]===undefined?!![]:![]:!![]})[_0x4d55('0x1c')](function(_0x26d7a7){logger[_0x4d55('0xd')]('CreateReportAgentPreview',_0x3659db);logger[_0x4d55('0xf')]('CreateReportAgentPreview',_0x3659db,JSON[_0x4d55('0x11')](_0x26d7a7));_0x4765bc(_0x26d7a7);})[_0x4d55('0x16')](function(_0x1a8d2d){logger[_0x4d55('0x12')](_0x4d55('0x17'),_0x1a8d2d['message'],_0x3659db);_0x1094a6(_0x33dc3e[_0x4d55('0x12')](0x1f4,_0x1a8d2d[_0x4d55('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6c10d0b..0ae9ff2 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 _0x4307=['/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','/outbound','outbound','/outbound/channels','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4307,0xa9));var _0x7430=function(_0x4b08f5,_0x55b405){_0x4b08f5=_0x4b08f5-0x0;var _0x252059=_0x4307[_0x4b08f5];return _0x252059;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7430('0x0'));var express=require('express');var router=express[_0x7430('0x1')]();var auth=require(_0x7430('0x2'));var controller=require(_0x7430('0x3'));router[_0x7430('0x4')](_0x7430('0x5'),auth['isAuthenticated'](),controller[_0x7430('0x6')]);router[_0x7430('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x7430('0x7')](),controller[_0x7430('0x8')]);router[_0x7430('0x4')](_0x7430('0x9'),auth[_0x7430('0x7')](),controller[_0x7430('0xa')]);router[_0x7430('0x4')](_0x7430('0xb'),auth[_0x7430('0x7')](),controller[_0x7430('0xc')]);router[_0x7430('0x4')]('/chat/queues',auth['isAuthenticated'](),controller[_0x7430('0xd')]);router[_0x7430('0x4')](_0x7430('0xe'),auth['isAuthenticated'](),controller[_0x7430('0xf')]);router[_0x7430('0x4')](_0x7430('0x10'),auth[_0x7430('0x7')](),controller[_0x7430('0x11')]);router['get'](_0x7430('0x12'),auth[_0x7430('0x7')](),controller[_0x7430('0x13')]);router[_0x7430('0x4')](_0x7430('0x14'),auth[_0x7430('0x7')](),controller['smsQueues']);router['get']('/whatsapp/queues',auth[_0x7430('0x7')](),controller['whatsappQueues']);router['get'](_0x7430('0x15'),auth[_0x7430('0x7')](),controller[_0x7430('0x16')]);router['get'](_0x7430('0x17'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x7430('0x4')](_0x7430('0x18'),auth[_0x7430('0x7')](),controller[_0x7430('0x19')]);router[_0x7430('0x4')](_0x7430('0x1a'),auth[_0x7430('0x7')](),controller[_0x7430('0x1b')]);router[_0x7430('0x4')](_0x7430('0x1c'),auth[_0x7430('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x7430('0x4')](_0x7430('0x1d'),auth['isAuthenticated'](),controller[_0x7430('0x1e')]);router[_0x7430('0x4')]('/voice/queues/:id',auth[_0x7430('0x7')](),controller[_0x7430('0x1f')]);router['put'](_0x7430('0x20'),auth[_0x7430('0x7')](),controller['updateVoiceQueue']);router[_0x7430('0x4')](_0x7430('0x21'),auth[_0x7430('0x7')](),controller[_0x7430('0x22')]);router[_0x7430('0x4')](_0x7430('0x23'),auth[_0x7430('0x7')](),controller['outboundChannels']);router[_0x7430('0x4')]('/agents',auth[_0x7430('0x7')](),controller[_0x7430('0x24')]);router[_0x7430('0x25')](_0x7430('0x26'),auth[_0x7430('0x7')](),controller[_0x7430('0x27')]);router[_0x7430('0x4')]('/telephones',auth[_0x7430('0x7')](),controller[_0x7430('0x28')]);router[_0x7430('0x4')](_0x7430('0x29'),auth[_0x7430('0x7')](),controller[_0x7430('0x2a')]);router[_0x7430('0x4')](_0x7430('0x2b'),auth[_0x7430('0x7')](),controller[_0x7430('0x2c')]);router['get'](_0x7430('0x2d'),auth[_0x7430('0x7')](),controller[_0x7430('0x2e')]);router[_0x7430('0x4')]('/chat/queues/waitinginteractions',auth[_0x7430('0x7')](),controller[_0x7430('0x2f')]);router['get'](_0x7430('0x30'),auth[_0x7430('0x7')](),controller[_0x7430('0x31')]);router['get'](_0x7430('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x7430('0x4')]('/openchannel/queues/:id/waitinginteractions',auth[_0x7430('0x7')](),controller[_0x7430('0x33')]);router[_0x7430('0x4')](_0x7430('0x34'),auth[_0x7430('0x7')](),controller[_0x7430('0x35')]);router[_0x7430('0x4')](_0x7430('0x36'),auth[_0x7430('0x7')](),controller[_0x7430('0x37')]);router[_0x7430('0x4')]('/fax/queues/waitinginteractions',auth[_0x7430('0x7')](),controller[_0x7430('0x38')]);router[_0x7430('0x39')](_0x7430('0x3a'),auth[_0x7430('0x7')](),controller[_0x7430('0x3b')]('mail'));router[_0x7430('0x4')](_0x7430('0x3c'),auth[_0x7430('0x7')](),controller[_0x7430('0x3d')]);router[_0x7430('0x39')](_0x7430('0x3e'),auth[_0x7430('0x7')](),controller['queueNotify'](_0x7430('0x3f')));router[_0x7430('0x4')](_0x7430('0x40'),auth[_0x7430('0x7')](),controller[_0x7430('0x41')]);router['post'](_0x7430('0x42'),auth[_0x7430('0x7')](),controller[_0x7430('0x3b')](_0x7430('0x43')));router[_0x7430('0x4')]('/fax/queues/:id',auth[_0x7430('0x7')](),controller['showFaxQueues']);router['post'](_0x7430('0x44'),auth[_0x7430('0x7')](),controller[_0x7430('0x3b')](_0x7430('0x45')));router[_0x7430('0x4')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x7430('0x46')]);router[_0x7430('0x39')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('sms'));router['post'](_0x7430('0x47'),auth[_0x7430('0x7')](),controller['queueNotify'](_0x7430('0x48')));router[_0x7430('0x4')](_0x7430('0x49'),auth[_0x7430('0x7')](),controller['showSmsQueues']);router[_0x7430('0x4')](_0x7430('0x4a'),auth[_0x7430('0x7')](),controller[_0x7430('0x4b')]);router['post'](_0x7430('0x4c'),auth['isAuthenticated'](),controller[_0x7430('0x4d')]);module[_0x7430('0x4e')]=router; \ No newline at end of file +var _0x8257=['/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','post','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','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','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity'];(function(_0x2e317b,_0x3dc5ec){var _0x22ac14=function(_0x3d4219){while(--_0x3d4219){_0x2e317b['push'](_0x2e317b['shift']());}};_0x22ac14(++_0x3dc5ec);}(_0x8257,0xda));var _0x7825=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x8257[_0x1cbcf1];return _0x3a06f0;};'use strict';var multer=require(_0x7825('0x0'));var util=require(_0x7825('0x1'));var path=require('path');var express=require('express');var router=express[_0x7825('0x2')]();var auth=require(_0x7825('0x3'));var controller=require('./rpc.controller');router['get'](_0x7825('0x4'),auth[_0x7825('0x5')](),controller[_0x7825('0x6')]);router['get'](_0x7825('0x7'),auth['isAuthenticated'](),controller[_0x7825('0x8')]);router[_0x7825('0x9')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x7825('0x5')](),controller[_0x7825('0xa')]);router['get'](_0x7825('0xb'),auth['isAuthenticated'](),controller[_0x7825('0xc')]);router[_0x7825('0x9')](_0x7825('0xd'),auth[_0x7825('0x5')](),controller[_0x7825('0xe')]);router[_0x7825('0x9')](_0x7825('0xf'),auth[_0x7825('0x5')](),controller['mailQueues']);router[_0x7825('0x9')](_0x7825('0x10'),auth[_0x7825('0x5')](),controller[_0x7825('0x11')]);router[_0x7825('0x9')](_0x7825('0x12'),auth[_0x7825('0x5')](),controller['openchannelQueues']);router[_0x7825('0x9')](_0x7825('0x13'),auth['isAuthenticated'](),controller['smsQueues']);router['get'](_0x7825('0x14'),auth['isAuthenticated'](),controller[_0x7825('0x15')]);router[_0x7825('0x9')](_0x7825('0x16'),auth[_0x7825('0x5')](),controller[_0x7825('0x17')]);router['get'](_0x7825('0x18'),auth[_0x7825('0x5')](),controller[_0x7825('0x19')]);router[_0x7825('0x9')](_0x7825('0x1a'),auth['isAuthenticated'](),controller[_0x7825('0x1b')]);router[_0x7825('0x9')](_0x7825('0x1c'),auth[_0x7825('0x5')](),controller[_0x7825('0x1d')]);router[_0x7825('0x9')](_0x7825('0x1e'),auth[_0x7825('0x5')](),controller['voiceQueuesChannelHangup']);router[_0x7825('0x9')](_0x7825('0x1f'),auth[_0x7825('0x5')](),controller[_0x7825('0x20')]);router['get'](_0x7825('0x21'),auth[_0x7825('0x5')](),controller[_0x7825('0x22')]);router[_0x7825('0x23')]('/voice/queues/:id',auth[_0x7825('0x5')](),controller[_0x7825('0x24')]);router['get'](_0x7825('0x25'),auth['isAuthenticated'](),controller['outbound']);router['get']('/outbound/channels',auth['isAuthenticated'](),controller[_0x7825('0x26')]);router[_0x7825('0x9')](_0x7825('0x27'),auth[_0x7825('0x5')](),controller[_0x7825('0x28')]);router[_0x7825('0x23')](_0x7825('0x29'),auth[_0x7825('0x5')](),controller[_0x7825('0x2a')]);router[_0x7825('0x9')](_0x7825('0x2b'),auth[_0x7825('0x5')](),controller[_0x7825('0x2c')]);router[_0x7825('0x9')]('/trunks',auth[_0x7825('0x5')](),controller[_0x7825('0x2d')]);router['get'](_0x7825('0x2e'),auth[_0x7825('0x5')](),controller[_0x7825('0x2f')]);router[_0x7825('0x9')](_0x7825('0x30'),auth[_0x7825('0x5')](),controller[_0x7825('0x31')]);router[_0x7825('0x9')](_0x7825('0x32'),auth[_0x7825('0x5')](),controller[_0x7825('0x33')]);router['get'](_0x7825('0x34'),auth[_0x7825('0x5')](),controller['mailQueuesWaitingInteractions']);router[_0x7825('0x9')](_0x7825('0x35'),auth[_0x7825('0x5')](),controller[_0x7825('0x36')]);router['get'](_0x7825('0x37'),auth['isAuthenticated'](),controller[_0x7825('0x38')]);router[_0x7825('0x9')](_0x7825('0x39'),auth[_0x7825('0x5')](),controller[_0x7825('0x3a')]);router[_0x7825('0x9')](_0x7825('0x3b'),auth[_0x7825('0x5')](),controller[_0x7825('0x3c')]);router[_0x7825('0x9')](_0x7825('0x3d'),auth[_0x7825('0x5')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x7825('0x3e'),auth['isAuthenticated'](),controller[_0x7825('0x3f')]('mail'));router[_0x7825('0x9')](_0x7825('0x40'),auth[_0x7825('0x5')](),controller['showMailQueues']);router[_0x7825('0x41')]('/chat/queues/:id/notify',auth[_0x7825('0x5')](),controller['queueNotify'](_0x7825('0x42')));router[_0x7825('0x9')](_0x7825('0x43'),auth['isAuthenticated'](),controller[_0x7825('0x44')]);router[_0x7825('0x41')]('/fax/queues/:id/notify',auth[_0x7825('0x5')](),controller[_0x7825('0x3f')](_0x7825('0x45')));router[_0x7825('0x9')](_0x7825('0x46'),auth['isAuthenticated'](),controller[_0x7825('0x47')]);router[_0x7825('0x41')](_0x7825('0x48'),auth[_0x7825('0x5')](),controller[_0x7825('0x3f')](_0x7825('0x49')));router[_0x7825('0x9')](_0x7825('0x4a'),auth[_0x7825('0x5')](),controller[_0x7825('0x4b')]);router[_0x7825('0x41')](_0x7825('0x4c'),auth[_0x7825('0x5')](),controller[_0x7825('0x3f')](_0x7825('0x4d')));router[_0x7825('0x41')](_0x7825('0x4e'),auth[_0x7825('0x5')](),controller['queueNotify'](_0x7825('0x4f')));router[_0x7825('0x9')](_0x7825('0x50'),auth[_0x7825('0x5')](),controller[_0x7825('0x51')]);router['get'](_0x7825('0x52'),auth[_0x7825('0x5')](),controller[_0x7825('0x53')]);router[_0x7825('0x41')](_0x7825('0x54'),auth[_0x7825('0x5')](),controller[_0x7825('0x55')]);module[_0x7825('0x56')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 91b84f1..1f8f978 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 _0x6f47=['voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','agent','internal','telephones','trunks','Trunks','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','create','moment','lodash','../../mysqldb','api','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel'];(function(_0x3d8f4d,_0x5a88a6){var _0x2d2874=function(_0x5bdc1){while(--_0x5bdc1){_0x3d8f4d['push'](_0x3d8f4d['shift']());}};_0x2d2874(++_0x5a88a6);}(_0x6f47,0xc7));var _0x76f4=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x6f47[_0x468b0f];return _0x3e74d9;};'use strict';var BPromise=require('bluebird');var moment=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));var util=require('util');var db=require(_0x76f4('0x2'))['db'];var logger=require('../../config/logger')(_0x76f4('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232a});var mailClient=jayson[_0x76f4('0x4')][_0x76f4('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x76f4('0x5')]({'port':0x232c});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){var _0x65d2c7=_0x497f99?_0x497f99:amiClient;return _0x65d2c7[_0x76f4('0x6')](_0xfc2405,_0x2176a7)[_0x76f4('0x7')](function(_0x4c6b5c){if(_0x4c6b5c['error']){if(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0x9')]===0x1f4){return _0x25656d(_0x4c6b5c['error']['message']);}return _0x1a3172(_0x4c6b5c[_0x76f4('0x8')][_0x76f4('0xa')]);}else{_0x1a3172(_0x4c6b5c[_0x76f4('0xb')]);}})[_0x76f4('0xc')](function(_0x1aee7f){_0x25656d(_0x1aee7f);});});}function respondWithResult(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xc8;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0xd')](_0xf7e347)['json'](_0x3ec740);}return _0xafd21e[_0x76f4('0xe')](0x194);};}function handleError(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0x1f4;return function(_0x4b6021){logger['error'](_0x4b6021[_0x76f4('0xf')]);if(_0x4b6021[_0x76f4('0x10')]){delete _0x4b6021[_0x76f4('0x10')];}_0x30dabf[_0x76f4('0xd')](_0x5da1ff)[_0x76f4('0x11')](_0x4b6021);};}function findById(_0x2b5e23){return function(_0x46ba51){if(!_[_0x76f4('0x12')](_0x2b5e23)&&!_[_0x76f4('0x12')](_0x46ba51)&&!_[_0x76f4('0x12')](_0x46ba51[_0x76f4('0x13')])){return _[_0x76f4('0x14')](_0x46ba51[_0x76f4('0x13')],function(_0x38450e){return _0x38450e['id']==_0x2b5e23;});}return null;};}exports[_0x76f4('0x15')]=function(_0x397360,_0xfedbe4){return respondWithRpcPromise(_0x76f4('0x16'),_0x397360[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0xfedbe4,null))[_0x76f4('0xc')](handleError(_0xfedbe4,null));};exports[_0x76f4('0x18')]=function(_0x5bf3d5,_0x262937){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x76f4('0x19')](_0x5bf3d5[_0x76f4('0x17')],_0x5bf3d5[_0x76f4('0x1a')]))['then'](respondWithResult(_0x262937,null))['catch'](handleError(_0x262937,null));};exports['voiceChannelStopMixMonitor']=function(_0x465240,_0x681d67){return respondWithRpcPromise(_0x76f4('0x1b'),_[_0x76f4('0x19')](_0x465240[_0x76f4('0x17')],_0x465240[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x681d67,null))['catch'](handleError(_0x681d67,null));};exports['voiceQueues']=function(_0x3794fa,_0x497913){return respondWithRpcPromise(_0x76f4('0x1c'),_0x3794fa['query'])['then'](respondWithResult(_0x497913,null))['catch'](handleError(_0x497913,null));};exports[_0x76f4('0x1d')]=function(_0x38300d,_0xd368a2){return respondWithRpcPromise(_0x76f4('0x1c'),_0x38300d[_0x76f4('0x17')])[_0x76f4('0x7')](findById(_0x38300d['params']['id']))[_0x76f4('0x7')](respondWithResult(_0xd368a2,null))['catch'](handleError(_0xd368a2,null));};exports['updateVoiceQueue']=function(_0x5b3f07,_0x10ddb4){return respondWithRpcPromise(_0x76f4('0x1e'),_[_0x76f4('0x19')](_0x5b3f07[_0x76f4('0x1f')],_0x5b3f07['params']))[_0x76f4('0x7')](respondWithResult(_0x10ddb4,null))['catch'](handleError(_0x10ddb4,null));};exports[_0x76f4('0x20')]=function(_0x3c7513,_0x43ac4a){return respondWithRpcPromise(_0x76f4('0x21'),_[_0x76f4('0x19')](_0x3c7513['query'],_0x3c7513['params']))[_0x76f4('0x7')](respondWithResult(_0x43ac4a,null))[_0x76f4('0xc')](handleError(_0x43ac4a,null));};exports[_0x76f4('0x22')]=function(_0x281db6,_0x1f2adf){return respondWithRpcPromise(_0x76f4('0x23'),_0x281db6[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x1f2adf,null))[_0x76f4('0xc')](handleError(_0x1f2adf,null));};exports[_0x76f4('0x24')]=function(_0x308af2,_0x2527a6){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x308af2['query'],_0x308af2['params']))[_0x76f4('0x7')](respondWithResult(_0x2527a6,null))[_0x76f4('0xc')](handleError(_0x2527a6,null));};exports[_0x76f4('0x25')]=function(_0x456b1f,_0x26fdd6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x76f4('0x19')](_0x456b1f[_0x76f4('0x17')],_0x456b1f[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x26fdd6,null))[_0x76f4('0xc')](handleError(_0x26fdd6,null));};exports[_0x76f4('0x26')]=function(_0xb806cc,_0x28d9d6){return respondWithRpcPromise(_0x76f4('0x27'),_[_0x76f4('0x19')](_0xb806cc[_0x76f4('0x17')],_0xb806cc[_0x76f4('0x1a')]))[_0x76f4('0x7')](respondWithResult(_0x28d9d6,null))[_0x76f4('0xc')](handleError(_0x28d9d6,null));};exports[_0x76f4('0x28')]=function(_0x88506b,_0x3308e3){return respondWithRpcPromise(_0x76f4('0x29'),_0x88506b['query'])[_0x76f4('0x7')](respondWithResult(_0x3308e3,null))[_0x76f4('0xc')](handleError(_0x3308e3,null));};exports[_0x76f4('0x2a')]=function(_0x589637,_0x597e83){return respondWithRpcPromise(_0x76f4('0x2b'),_0x589637['query'])[_0x76f4('0x7')](respondWithResult(_0x597e83,null))['catch'](handleError(_0x597e83,null));};exports[_0x76f4('0x2c')]=function(_0x16f36d,_0x312243){var _0x378675;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')])[_0x76f4('0x7')](function(_0x109ad9){_0x378675=_0x109ad9;return respondWithRpcPromise(_0x76f4('0x2d'),_0x16f36d[_0x76f4('0x17')],routingClient);})['then'](function(_0x5b8d2d){return _[_0x76f4('0x19')]({},_0x5b8d2d,_0x378675);})[_0x76f4('0x7')](respondWithResult(_0x312243,null))[_0x76f4('0xc')](handleError(_0x312243,null));};exports[_0x76f4('0x2e')]=function(_0x2b7dc8,_0x2d6068){if(_0x2b7dc8[_0x76f4('0x1f')]&&_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')]&&_0x2b7dc8['user']&&_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')]){for(var _0x4f0d1a in _0x2b7dc8['body'][_0x76f4('0x2f')]){if(_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x76f4('0x31')](_0x4f0d1a)){db[_0x76f4('0x32')]['findAll']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'exitAt':null,'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]&&_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x76f4('0x34')]?{'$notIn':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a]}:{'$ne':null}}})['then'](function(_0x571261){var _0x11ea58=moment()[_0x76f4('0x35')](_0x76f4('0x36'));for(var _0x2bea6d=0x0,_0x36fa03=_0x571261['length'];_0x2bea6d<_0x36fa03;_0x2bea6d+=0x1){_0x571261[_0x2bea6d]['updateAttributes']({'exitAt':_0x11ea58});}});for(var _0x8e5b60=0x0;_0x8e5b60<_0x2b7dc8['body'][_0x76f4('0x2f')][_0x4f0d1a][_0x76f4('0x34')];_0x8e5b60+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'type':_0x76f4('0x33'),'uniqueid':_0x2b7dc8[_0x76f4('0x1f')]['interaction'][_0x4f0d1a][_0x8e5b60],'exitAt':null},'defaults':{'channel':_0x4f0d1a,'membername':_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x10')],'interface':_[_0x76f4('0x12')](_0x2b7dc8['user'][_0x76f4('0x37')])?util[_0x76f4('0x35')]('SIP/%s',_0x2b7dc8['user'][_0x76f4('0x10')]):_0x2b7dc8[_0x76f4('0x30')][_0x76f4('0x37')],'type':_0x76f4('0x33'),'enterAt':moment()[_0x76f4('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x76f4('0x38'),'internal':_0x2b7dc8['user'][_0x76f4('0x39')],'uniqueid':_0x2b7dc8[_0x76f4('0x1f')][_0x76f4('0x2f')][_0x4f0d1a][_0x8e5b60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b7dc8[_0x76f4('0x1a')]['id'],'capacity':_0x2b7dc8[_0x76f4('0x1f')]['capacity']},routingClient)[_0x76f4('0x7')](respondWithResult(_0x2d6068,null))[_0x76f4('0xc')](handleError(_0x2d6068,null));};exports[_0x76f4('0x3a')]=function(_0x1c658c,_0x40ff20){return respondWithRpcPromise('Telephones',_0x1c658c[_0x76f4('0x17')])['then'](respondWithResult(_0x40ff20,null))[_0x76f4('0xc')](handleError(_0x40ff20,null));};exports[_0x76f4('0x3b')]=function(_0x154ba,_0x5121ec){return respondWithRpcPromise(_0x76f4('0x3c'),_0x154ba[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x5121ec,null))[_0x76f4('0xc')](handleError(_0x5121ec,null));};exports['campaigns']=function(_0x2028e9,_0xf11e07){return respondWithRpcPromise(_0x76f4('0x3d'),_0x2028e9[_0x76f4('0x17')])['then'](respondWithResult(_0xf11e07,null))[_0x76f4('0xc')](handleError(_0xf11e07,null));};exports['chatQueues']=function(_0x129048,_0x190c8d){return respondWithRpcPromise('ChatQueues',_0x129048['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x190c8d,null))[_0x76f4('0xc')](handleError(_0x190c8d,null));};exports[_0x76f4('0x3e')]=function(_0x596b51,_0x27ba06){return respondWithRpcPromise(_0x76f4('0x3f'),_0x596b51[_0x76f4('0x17')],routingClient)['then'](findById(_0x596b51['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x27ba06,null))[_0x76f4('0xc')](handleError(_0x27ba06,null));};exports['mailQueues']=function(_0x490ced,_0x3f1840){return respondWithRpcPromise(_0x76f4('0x40'),_0x490ced[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x3f1840,null))[_0x76f4('0xc')](handleError(_0x3f1840,null));};exports[_0x76f4('0x41')]=function(_0x97be11,_0x36a52a){return respondWithRpcPromise(_0x76f4('0x40'),_0x97be11['query'],routingClient)['then'](findById(_0x97be11['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x36a52a,null))[_0x76f4('0xc')](handleError(_0x36a52a,null));};exports[_0x76f4('0x42')]=function(_0x3b6c16,_0x4c9d64){return respondWithRpcPromise('MailAccounts',_0x3b6c16[_0x76f4('0x17')],mailClient)['then'](respondWithResult(_0x4c9d64,null))[_0x76f4('0xc')](handleError(_0x4c9d64,null));};exports['openchannelQueues']=function(_0x4285dd,_0x25e510){return respondWithRpcPromise(_0x76f4('0x43'),_0x4285dd[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x25e510,null))[_0x76f4('0xc')](handleError(_0x25e510,null));};exports[_0x76f4('0x44')]=function(_0x22a0cc,_0x40c170){return respondWithRpcPromise(_0x76f4('0x43'),_0x22a0cc[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x22a0cc['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x40c170,null))[_0x76f4('0xc')](handleError(_0x40c170,null));};exports[_0x76f4('0x45')]=function(_0x320a87,_0x28cf4c){return respondWithRpcPromise(_0x76f4('0x46'),_0x320a87[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x28cf4c,null))['catch'](handleError(_0x28cf4c,null));};exports['showSmsQueues']=function(_0xa3091a,_0x617924){return respondWithRpcPromise(_0x76f4('0x46'),_0xa3091a['query'],routingClient)[_0x76f4('0x7')](findById(_0xa3091a['params']['id']))[_0x76f4('0x7')](respondWithResult(_0x617924,null))[_0x76f4('0xc')](handleError(_0x617924,null));};exports['whatsappQueues']=function(_0xda0ac2,_0x37b7f7){return respondWithRpcPromise(_0x76f4('0x47'),_0xda0ac2[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x37b7f7,null))[_0x76f4('0xc')](handleError(_0x37b7f7,null));};exports[_0x76f4('0x48')]=function(_0x410d83,_0x1f7257){return respondWithRpcPromise('WhatsappQueues',_0x410d83[_0x76f4('0x17')],routingClient)['then'](findById(_0x410d83[_0x76f4('0x1a')]['id']))[_0x76f4('0x7')](respondWithResult(_0x1f7257,null))[_0x76f4('0xc')](handleError(_0x1f7257,null));};exports[_0x76f4('0x49')]=function(_0xfbb52c,_0x8de630){return respondWithRpcPromise(_0x76f4('0x4a'),_0xfbb52c[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x8de630,null))[_0x76f4('0xc')](handleError(_0x8de630,null));};exports['showFaxQueues']=function(_0x30f3de,_0x6f874d){return respondWithRpcPromise('FaxQueues',_0x30f3de[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](findById(_0x30f3de[_0x76f4('0x1a')]['id']))['then'](respondWithResult(_0x6f874d,null))[_0x76f4('0xc')](handleError(_0x6f874d,null));};exports[_0x76f4('0x4b')]=function(_0x3e829f,_0x52610a){return respondWithRpcPromise(_0x76f4('0x4c'),_0x3e829f[_0x76f4('0x17')])[_0x76f4('0x7')](respondWithResult(_0x52610a,null))[_0x76f4('0xc')](handleError(_0x52610a,null));};exports[_0x76f4('0x4d')]=function(_0x10ee07,_0x19b99c){return respondWithRpcPromise(_0x76f4('0x4e'),_0x10ee07[_0x76f4('0x17')],routingClient)['then'](respondWithResult(_0x19b99c,null))[_0x76f4('0xc')](handleError(_0x19b99c,null));};exports[_0x76f4('0x4f')]=function(_0x19fdc3,_0x39c9af){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19fdc3[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x39c9af,null))[_0x76f4('0xc')](handleError(_0x39c9af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x43b44d,_0x1375d5){return respondWithRpcPromise(_0x76f4('0x50'),_0x43b44d[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x1375d5,null))['catch'](handleError(_0x1375d5,null));};exports[_0x76f4('0x51')]=function(_0x4dd41f,_0x2b8467){return respondWithRpcPromise(_0x76f4('0x50'),_0x4dd41f['query'],routingClient)['then'](function(_0x58251e){if(_0x4dd41f[_0x76f4('0x17')][_0x76f4('0x52')]!==undefined){var _0x1e7b6=_(_0x58251e[_0x76f4('0x13')])[_0x76f4('0x53')]([_0x4dd41f[_0x76f4('0x17')]['type'],_0x4dd41f[_0x76f4('0x1a')]['id']])[_0x76f4('0x54')](_0x76f4('0x55'))[_0x76f4('0x56')]()[_0x76f4('0x57')]();return _0x58251e[_0x76f4('0x13')][_0x76f4('0x53')](function(_0x202fc8){return _0x1e7b6['indexOf'](_0x202fc8[_0x76f4('0x55')])>-0x1;});}else{return _0x58251e['rows'][_0x76f4('0x53')](function(_0x30358a){return _0x30358a[_0x76f4('0x55')]===parseInt(_0x4dd41f[_0x76f4('0x1a')]['id']);});}})[_0x76f4('0x7')](respondWithResult(_0x2b8467,null))[_0x76f4('0xc')](handleError(_0x2b8467,null));};exports[_0x76f4('0x58')]=function(_0x2a0491,_0x54729b){return respondWithRpcPromise(_0x76f4('0x59'),_0x2a0491['query'],routingClient)['then'](respondWithResult(_0x54729b,null))['catch'](handleError(_0x54729b,null));};exports[_0x76f4('0x5a')]=function(_0x402209,_0x279040){return respondWithRpcPromise(_0x76f4('0x5b'),_0x402209['query'],routingClient)[_0x76f4('0x7')](respondWithResult(_0x279040,null))[_0x76f4('0xc')](handleError(_0x279040,null));};exports[_0x76f4('0x5c')]=function(_0x5f5c24,_0x12f16e){return respondWithRpcPromise(_0x76f4('0x5d'),_0x5f5c24[_0x76f4('0x17')],routingClient)[_0x76f4('0x7')](respondWithResult(_0x12f16e,null))[_0x76f4('0xc')](handleError(_0x12f16e,null));};exports[_0x76f4('0x5e')]=function(_0x3b5e15){return function(_0x4b562c,_0x2e991e){var _0xa49e2a,_0x4c7307;var _0x3bc914=_[_0x76f4('0x5f')](_0x3b5e15);var _0x5e6393=_0x3b5e15===_0x76f4('0x60')?_0x76f4('0x61'):_0x76f4('0x62');return db[_0x3bc914+_0x76f4('0x63')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x4b562c[_0x76f4('0x1a')]['id']}})['then'](function(_0x2dac86){if(_[_0x76f4('0x12')](_0x2dac86)){throw new Error(_0x3bc914+_0x76f4('0x65'));}_0xa49e2a=_0x2dac86;return db[_0x3bc914+_0x76f4('0x66')]['findOne']({'where':{'id':_0x4b562c[_0x76f4('0x1f')]['messageId']},'include':[{'model':db[_0x3bc914+_0x76f4('0x67')],'as':'Interaction'},{'model':db[_0x3bc914+_0x5e6393],'as':_0x76f4('0x62')}]});})[_0x76f4('0x7')](function(_0x59e9ed){if(_['isNil'](_0x59e9ed)){throw new Error(_0x3bc914+_0x76f4('0x68'));}_0x4c7307=_0x59e9ed;return _0x59e9ed[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x76f4('0x7')](function(){var _0x4a2969={'uniqueid':_0x3b5e15+'.'+_0x4c7307['id']+'.'+_0x4c7307['Interaction']['id'],'FromUserId':_0x4b562c[_0x76f4('0x30')]['id'],'type':_0x76f4('0x6a')};_0x4a2969[_0x3bc914+_0x76f4('0x6b')]=_0x4c7307['id'];_0x4a2969[_0x3bc914+_0x76f4('0x6c')]=_0x4c7307[_0x76f4('0x67')]['id'];_0x4a2969[_0x76f4('0x6d')+_0x3bc914+_0x5e6393+'Id']=_0x4c7307[_0x76f4('0x62')]['id'];_0x4a2969['To'+_0x3bc914+_0x76f4('0x6e')]=_0xa49e2a['id'];return db[_0x3bc914+'TransferReport']['create'](_0x4a2969);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x3b5e15,'interaction':_0x4c7307[_0x76f4('0x67')],'message':_0x4c7307,'account':_0x4c7307['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x6a'),'appdata':_0xa49e2a[_0x76f4('0x10')]+','+(_0x4c7307[_0x76f4('0x62')][_0x76f4('0x70')]||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x2e991e,null))[_0x76f4('0xc')](handleError(_0x2e991e,null));};};exports['agentNotify']=function(_0x13cf2a,_0x316f86){var _0x3e537b,_0x53252e;if(_[_0x76f4('0x12')](_0x13cf2a[_0x76f4('0x1f')][_0x76f4('0x72')])){throw new Error(_0x76f4('0x73'));}var _0x5080a9=_0x13cf2a[_0x76f4('0x1f')]['channel'];var _0xc80d4c=_['capitalize'](_0x5080a9);var _0x238df3=_0x5080a9===_0x76f4('0x60')?_0x76f4('0x61'):'Account';return db[_0x76f4('0x74')][_0x76f4('0x64')]({'raw':!![],'where':{'id':_0x13cf2a[_0x76f4('0x1a')]['id'],'role':'agent'}})[_0x76f4('0x7')](function(_0x460867){if(_['isNil'](_0x460867)){throw new Error('Agent\x20not\x20found');}_0x3e537b=_0x460867;return db[_0xc80d4c+_0x76f4('0x66')][_0x76f4('0x64')]({'where':{'id':_0x13cf2a['body']['messageId']},'include':[{'model':db[_0xc80d4c+_0x76f4('0x67')],'as':_0x76f4('0x67')},{'model':db[_0xc80d4c+_0x238df3],'as':'Account'}]});})[_0x76f4('0x7')](function(_0x54ae6c){if(_['isNil'](_0x54ae6c)){throw new Error(_0xc80d4c+'\x20Message\x20not\x20found');}_0x53252e=_0x54ae6c;return _0x54ae6c[_0x76f4('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x59265d={'uniqueid':_0x5080a9+'.'+_0x53252e['id']+'.'+_0x53252e[_0x76f4('0x67')]['id'],'FromUserId':_0x13cf2a['user']['id'],'type':'queue','ToUserId':_0x3e537b['id']};_0x59265d[_0xc80d4c+_0x76f4('0x6b')]=_0x53252e['id'];_0x59265d[_0xc80d4c+'InteractionId']=_0x53252e[_0x76f4('0x67')]['id'];_0x59265d[_0x76f4('0x6d')+_0xc80d4c+_0x238df3+'Id']=_0x53252e['Account']['id'];return db[_0xc80d4c+'TransferReport'][_0x76f4('0x75')](_0x59265d);})[_0x76f4('0x7')](function(){return respondWithRpcPromise(_0x76f4('0x6f'),{'channel':_0x5080a9,'interaction':_0x53252e['Interaction'],'message':_0x53252e,'account':_0x53252e[_0x76f4('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x76f4('0x38'),'appdata':_0x3e537b[_0x76f4('0x10')]+','+(_0x53252e[_0x76f4('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x76f4('0x71')}]},routingClient);})[_0x76f4('0x7')](respondWithResult(_0x316f86,null))[_0x76f4('0xc')](handleError(_0x316f86,null));}; \ No newline at end of file +var _0x425d=['http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','query','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns','ChatQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0x425d,0x1e0));var _0xd425=function(_0x19922e,_0x3d380d){_0x19922e=_0x19922e-0x0;var _0x1fe954=_0x425d[_0x19922e];return _0x1fe954;};'use strict';var BPromise=require(_0xd425('0x0'));var moment=require('moment');var _=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var db=require(_0xd425('0x3'))['db'];var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var jayson=require(_0xd425('0x6'));var amiClient=jayson[_0xd425('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232b});var routingClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){var _0x262b02=_0x50b061?_0x50b061:amiClient;return _0x262b02[_0xd425('0x9')](_0x1d97d9,_0x1d2ed0)[_0xd425('0xa')](function(_0x2beb20){if(_0x2beb20[_0xd425('0xb')]){if(_0x2beb20[_0xd425('0xb')][_0xd425('0xc')]===0x1f4){return _0x374c3d(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}return _0xb6ba8e(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}else{_0xb6ba8e(_0x2beb20[_0xd425('0xe')]);}})[_0xd425('0xf')](function(_0x2385a5){_0x374c3d(_0x2385a5);});});}function respondWithResult(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xc8;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x10')](_0x3cacf7)['json'](_0x3b5de8);}return _0x9bb611[_0xd425('0x11')](0x194);};}function handleError(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0x1f4;return function(_0x5d3d60){logger[_0xd425('0xb')](_0x5d3d60[_0xd425('0x12')]);if(_0x5d3d60[_0xd425('0x13')]){delete _0x5d3d60[_0xd425('0x13')];}_0x17a498[_0xd425('0x10')](_0x336dc3)['send'](_0x5d3d60);};}function findById(_0x278626){return function(_0x471267){if(!_[_0xd425('0x14')](_0x278626)&&!_[_0xd425('0x14')](_0x471267)&&!_['isNil'](_0x471267[_0xd425('0x15')])){return _[_0xd425('0x16')](_0x471267[_0xd425('0x15')],function(_0x1155bc){return _0x1155bc['id']==_0x278626;});}return null;};}exports['voiceChannels']=function(_0x58a0c1,_0x5debc3){return respondWithRpcPromise('VoiceChannels',_0x58a0c1[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x5debc3,null))[_0xd425('0xf')](handleError(_0x5debc3,null));};exports['voiceChannelMixMonitor']=function(_0x355af0,_0x7e982e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd425('0x18')](_0x355af0[_0xd425('0x17')],_0x355af0[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x7e982e,null))[_0xd425('0xf')](handleError(_0x7e982e,null));};exports[_0xd425('0x1a')]=function(_0x2480a0,_0x3500bb){return respondWithRpcPromise(_0xd425('0x1b'),_[_0xd425('0x18')](_0x2480a0[_0xd425('0x17')],_0x2480a0[_0xd425('0x19')]))['then'](respondWithResult(_0x3500bb,null))[_0xd425('0xf')](handleError(_0x3500bb,null));};exports[_0xd425('0x1c')]=function(_0x398985,_0x1908a5){return respondWithRpcPromise(_0xd425('0x1d'),_0x398985[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x1908a5,null))['catch'](handleError(_0x1908a5,null));};exports[_0xd425('0x1e')]=function(_0x177de2,_0x1d8861){return respondWithRpcPromise('VoiceQueues',_0x177de2[_0xd425('0x17')])[_0xd425('0xa')](findById(_0x177de2[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x1d8861,null))[_0xd425('0xf')](handleError(_0x1d8861,null));};exports[_0xd425('0x1f')]=function(_0x2fd17a,_0x37b63c){return respondWithRpcPromise(_0xd425('0x20'),_[_0xd425('0x18')](_0x2fd17a['body'],_0x2fd17a[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x37b63c,null))[_0xd425('0xf')](handleError(_0x37b63c,null));};exports[_0xd425('0x21')]=function(_0x3275b1,_0x1abf33){return respondWithRpcPromise(_0xd425('0x22'),_[_0xd425('0x18')](_0x3275b1[_0xd425('0x17')],_0x3275b1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x1abf33,null))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x23')]=function(_0x2a2a9b,_0x3120a4){return respondWithRpcPromise(_0xd425('0x24'),_0x2a2a9b[_0xd425('0x17')])['then'](respondWithResult(_0x3120a4,null))[_0xd425('0xf')](handleError(_0x3120a4,null));};exports[_0xd425('0x25')]=function(_0x4cfcd1,_0x574962){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd425('0x18')](_0x4cfcd1[_0xd425('0x17')],_0x4cfcd1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x574962,null))['catch'](handleError(_0x574962,null));};exports[_0xd425('0x26')]=function(_0x1d4414,_0x30a9dc){return respondWithRpcPromise(_0xd425('0x27'),_[_0xd425('0x18')](_0x1d4414[_0xd425('0x17')],_0x1d4414[_0xd425('0x19')]))['then'](respondWithResult(_0x30a9dc,null))[_0xd425('0xf')](handleError(_0x30a9dc,null));};exports['voiceQueuesChannelRedirect']=function(_0x22df81,_0x29cca9){return respondWithRpcPromise(_0xd425('0x28'),_['merge'](_0x22df81[_0xd425('0x17')],_0x22df81[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x29cca9,null))[_0xd425('0xf')](handleError(_0x29cca9,null));};exports['outbound']=function(_0x1d38fa,_0x3cf540){return respondWithRpcPromise('Outbound',_0x1d38fa['query'])['then'](respondWithResult(_0x3cf540,null))[_0xd425('0xf')](handleError(_0x3cf540,null));};exports[_0xd425('0x29')]=function(_0x1f30c1,_0x588688){return respondWithRpcPromise('OutboundChannels',_0x1f30c1['query'])[_0xd425('0xa')](respondWithResult(_0x588688,null))[_0xd425('0xf')](handleError(_0x588688,null));};exports[_0xd425('0x2a')]=function(_0x1d5017,_0xa9fd7c){var _0x14f3be;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'])[_0xd425('0xa')](function(_0x3c88a8){_0x14f3be=_0x3c88a8;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'],routingClient);})[_0xd425('0xa')](function(_0x2dffc7){return _[_0xd425('0x18')]({},_0x2dffc7,_0x14f3be);})['then'](respondWithResult(_0xa9fd7c,null))[_0xd425('0xf')](handleError(_0xa9fd7c,null));};exports[_0xd425('0x2c')]=function(_0x1c5ba6,_0x2d7a2f){if(_0x1c5ba6['body']&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]&&_0x1c5ba6[_0xd425('0x2f')]&&_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]){for(var _0x2f6bf7 in _0x1c5ba6[_0xd425('0x2d')]['interaction']){if(_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]['hasOwnProperty'](_0x2f6bf7)){db[_0xd425('0x30')]['findAll']({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6['user'][_0xd425('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c5ba6[_0xd425('0x2d')]['interaction'][_0x2f6bf7]&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')]?{'$notIn':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7]}:{'$ne':null}}})['then'](function(_0x2e4b21){var _0x5f3cfd=moment()[_0xd425('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x78ed9b=0x0,_0x16f61c=_0x2e4b21[_0xd425('0x31')];_0x78ed9b<_0x16f61c;_0x78ed9b+=0x1){_0x2e4b21[_0x78ed9b][_0xd425('0x33')]({'exitAt':_0x5f3cfd});}});for(var _0x624543=0x0;_0x624543<_0x1c5ba6['body'][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')];_0x624543+=0x1){db[_0xd425('0x30')][_0xd425('0x34')]({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')]['name'],'type':_0xd425('0x35'),'uniqueid':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0x624543],'exitAt':null},'defaults':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')],'interface':_[_0xd425('0x14')](_0x1c5ba6['user'][_0xd425('0x36')])?util[_0xd425('0x32')]('SIP/%s',_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]):_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x36')],'type':'INTERACTION','enterAt':moment()[_0xd425('0x32')](_0xd425('0x37')),'role':_0xd425('0x38'),'internal':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x39')],'uniqueid':_0x1c5ba6['body']['interaction'][_0x2f6bf7][_0x624543]}});}}}}return respondWithRpcPromise(_0xd425('0x3a'),{'id':_0x1c5ba6['params']['id'],'capacity':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x3b')]},routingClient)['then'](respondWithResult(_0x2d7a2f,null))[_0xd425('0xf')](handleError(_0x2d7a2f,null));};exports['telephones']=function(_0x48d5b8,_0x39f588){return respondWithRpcPromise(_0xd425('0x3c'),_0x48d5b8[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x39f588,null))[_0xd425('0xf')](handleError(_0x39f588,null));};exports[_0xd425('0x3d')]=function(_0xeb3586,_0x4118fe){return respondWithRpcPromise('Trunks',_0xeb3586[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x4118fe,null))[_0xd425('0xf')](handleError(_0x4118fe,null));};exports[_0xd425('0x3e')]=function(_0x7b1080,_0x1c80c2){return respondWithRpcPromise(_0xd425('0x3f'),_0x7b1080[_0xd425('0x17')])['then'](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['chatQueues']=function(_0x145e76,_0x2c5d01){return respondWithRpcPromise(_0xd425('0x40'),_0x145e76[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x2c5d01,null))['catch'](handleError(_0x2c5d01,null));};exports['showChatQueues']=function(_0x5e1294,_0x254b8b){return respondWithRpcPromise(_0xd425('0x40'),_0x5e1294['query'],routingClient)[_0xd425('0xa')](findById(_0x5e1294[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x254b8b,null))['catch'](handleError(_0x254b8b,null));};exports['mailQueues']=function(_0x599cb5,_0x49d75e){return respondWithRpcPromise('MailQueues',_0x599cb5['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x49d75e,null))[_0xd425('0xf')](handleError(_0x49d75e,null));};exports[_0xd425('0x41')]=function(_0x5b2323,_0x3395d8){return respondWithRpcPromise('MailQueues',_0x5b2323[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5b2323[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x3395d8,null))[_0xd425('0xf')](handleError(_0x3395d8,null));};exports[_0xd425('0x42')]=function(_0xa21f7c,_0x3ca6a6){return respondWithRpcPromise(_0xd425('0x43'),_0xa21f7c['query'],mailClient)[_0xd425('0xa')](respondWithResult(_0x3ca6a6,null))[_0xd425('0xf')](handleError(_0x3ca6a6,null));};exports[_0xd425('0x44')]=function(_0xf22906,_0x5c4df8){return respondWithRpcPromise('OpenchannelQueues',_0xf22906[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5c4df8,null))[_0xd425('0xf')](handleError(_0x5c4df8,null));};exports[_0xd425('0x45')]=function(_0x464ed1,_0x2e0f00){return respondWithRpcPromise(_0xd425('0x46'),_0x464ed1[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x464ed1[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x2e0f00,null))[_0xd425('0xf')](handleError(_0x2e0f00,null));};exports[_0xd425('0x47')]=function(_0x28979e,_0x5e72db){return respondWithRpcPromise(_0xd425('0x48'),_0x28979e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5e72db,null))['catch'](handleError(_0x5e72db,null));};exports['showSmsQueues']=function(_0x5ade1a,_0x403cb3){return respondWithRpcPromise(_0xd425('0x48'),_0x5ade1a[_0xd425('0x17')],routingClient)['then'](findById(_0x5ade1a[_0xd425('0x19')]['id']))['then'](respondWithResult(_0x403cb3,null))[_0xd425('0xf')](handleError(_0x403cb3,null));};exports[_0xd425('0x49')]=function(_0x21d26e,_0x5113fc){return respondWithRpcPromise(_0xd425('0x4a'),_0x21d26e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5113fc,null))[_0xd425('0xf')](handleError(_0x5113fc,null));};exports[_0xd425('0x4b')]=function(_0x43b1a9,_0x38a762){return respondWithRpcPromise(_0xd425('0x4a'),_0x43b1a9[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x43b1a9[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x38a762,null))[_0xd425('0xf')](handleError(_0x38a762,null));};exports[_0xd425('0x4c')]=function(_0x445f98,_0x443126){return respondWithRpcPromise(_0xd425('0x4d'),_0x445f98[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};exports[_0xd425('0x4e')]=function(_0x5c333a,_0x135048){return respondWithRpcPromise(_0xd425('0x4d'),_0x5c333a[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5c333a['params']['id']))[_0xd425('0xa')](respondWithResult(_0x135048,null))[_0xd425('0xf')](handleError(_0x135048,null));};exports[_0xd425('0x4f')]=function(_0x689332,_0x2536bd){return respondWithRpcPromise(_0xd425('0x50'),_0x689332['query'])['then'](respondWithResult(_0x2536bd,null))[_0xd425('0xf')](handleError(_0x2536bd,null));};exports[_0xd425('0x51')]=function(_0x5e76f5,_0x174081){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e76f5[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x174081,null))[_0xd425('0xf')](handleError(_0x174081,null));};exports[_0xd425('0x52')]=function(_0x376134,_0x2514fa){return respondWithRpcPromise(_0xd425('0x53'),_0x376134['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x2514fa,null))[_0xd425('0xf')](handleError(_0x2514fa,null));};exports[_0xd425('0x54')]=function(_0x233efa,_0xfcba08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x233efa[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0xfcba08,null))['catch'](handleError(_0xfcba08,null));};exports[_0xd425('0x55')]=function(_0x4599b0,_0x48bed3){return respondWithRpcPromise(_0xd425('0x56'),_0x4599b0[_0xd425('0x17')],routingClient)[_0xd425('0xa')](function(_0xd923bb){if(_0x4599b0[_0xd425('0x17')]['type']!==undefined){var _0x454cce=_(_0xd923bb['rows'])[_0xd425('0x57')]([_0x4599b0[_0xd425('0x17')]['type'],_0x4599b0[_0xd425('0x19')]['id']])[_0xd425('0x58')](_0xd425('0x59'))[_0xd425('0x5a')]()['value']();return _0xd923bb['rows'][_0xd425('0x57')](function(_0x2312c1){return _0x454cce[_0xd425('0x5b')](_0x2312c1['queue_id'])>-0x1;});}else{return _0xd923bb[_0xd425('0x15')][_0xd425('0x57')](function(_0x5b932c){return _0x5b932c[_0xd425('0x59')]===parseInt(_0x4599b0['params']['id']);});}})[_0xd425('0xa')](respondWithResult(_0x48bed3,null))[_0xd425('0xf')](handleError(_0x48bed3,null));};exports[_0xd425('0x5c')]=function(_0x2493e7,_0x5750dc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2493e7[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5750dc,null))['catch'](handleError(_0x5750dc,null));};exports[_0xd425('0x5d')]=function(_0x389099,_0x51c9ad){return respondWithRpcPromise(_0xd425('0x5e'),_0x389099[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x51c9ad,null))[_0xd425('0xf')](handleError(_0x51c9ad,null));};exports[_0xd425('0x5f')]=function(_0xf251e6,_0x302066){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xf251e6['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x302066,null))['catch'](handleError(_0x302066,null));};exports[_0xd425('0x60')]=function(_0x236030){return function(_0x58cad5,_0x244789){var _0x1c1c77,_0x5dac05;var _0x592c40=_[_0xd425('0x61')](_0x236030);var _0x242ed8=_0x236030===_0xd425('0x62')?_0xd425('0x63'):_0xd425('0x64');return db[_0x592c40+_0xd425('0x65')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x58cad5[_0xd425('0x19')]['id']}})['then'](function(_0x2cff42){if(_[_0xd425('0x14')](_0x2cff42)){throw new Error(_0x592c40+'\x20Queue\x20not\x20found');}_0x1c1c77=_0x2cff42;return db[_0x592c40+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x58cad5[_0xd425('0x2d')][_0xd425('0x68')]},'include':[{'model':db[_0x592c40+_0xd425('0x69')],'as':_0xd425('0x69')},{'model':db[_0x592c40+_0x242ed8],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0x334062){if(_[_0xd425('0x14')](_0x334062)){throw new Error(_0x592c40+_0xd425('0x6a'));}_0x5dac05=_0x334062;return _0x334062['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd425('0xa')](function(){var _0x498e81={'uniqueid':_0x236030+'.'+_0x5dac05['id']+'.'+_0x5dac05['Interaction']['id'],'FromUserId':_0x58cad5[_0xd425('0x2f')]['id'],'type':'queue'};_0x498e81[_0x592c40+_0xd425('0x6b')]=_0x5dac05['id'];_0x498e81[_0x592c40+_0xd425('0x6c')]=_0x5dac05[_0xd425('0x69')]['id'];_0x498e81[_0xd425('0x6d')+_0x592c40+_0x242ed8+'Id']=_0x5dac05[_0xd425('0x64')]['id'];_0x498e81['To'+_0x592c40+_0xd425('0x6e')]=_0x1c1c77['id'];return db[_0x592c40+_0xd425('0x6f')]['create'](_0x498e81);})[_0xd425('0xa')](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x236030,'interaction':_0x5dac05[_0xd425('0x69')],'message':_0x5dac05,'account':_0x5dac05[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x71'),'appdata':_0x1c1c77['name']+','+(_0x5dac05[_0xd425('0x64')][_0xd425('0x72')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})[_0xd425('0xa')](respondWithResult(_0x244789,null))[_0xd425('0xf')](handleError(_0x244789,null));};};exports[_0xd425('0x74')]=function(_0x409612,_0x4147eb){var _0x433e5d,_0x334226;if(_[_0xd425('0x14')](_0x409612[_0xd425('0x2d')]['channel'])){throw new Error(_0xd425('0x75'));}var _0x5d8a47=_0x409612[_0xd425('0x2d')][_0xd425('0x76')];var _0x1c03d6=_[_0xd425('0x61')](_0x5d8a47);var _0xf06395=_0x5d8a47==='chat'?_0xd425('0x63'):_0xd425('0x64');return db[_0xd425('0x77')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x409612[_0xd425('0x19')]['id'],'role':_0xd425('0x38')}})[_0xd425('0xa')](function(_0x568a83){if(_[_0xd425('0x14')](_0x568a83)){throw new Error('Agent\x20not\x20found');}_0x433e5d=_0x568a83;return db[_0x1c03d6+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x409612['body'][_0xd425('0x68')]},'include':[{'model':db[_0x1c03d6+_0xd425('0x69')],'as':'Interaction'},{'model':db[_0x1c03d6+_0xf06395],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0xca2955){if(_[_0xd425('0x14')](_0xca2955)){throw new Error(_0x1c03d6+_0xd425('0x6a'));}_0x334226=_0xca2955;return _0xca2955[_0xd425('0x78')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3f1a48={'uniqueid':_0x5d8a47+'.'+_0x334226['id']+'.'+_0x334226['Interaction']['id'],'FromUserId':_0x409612[_0xd425('0x2f')]['id'],'type':'queue','ToUserId':_0x433e5d['id']};_0x3f1a48[_0x1c03d6+_0xd425('0x6b')]=_0x334226['id'];_0x3f1a48[_0x1c03d6+_0xd425('0x6c')]=_0x334226[_0xd425('0x69')]['id'];_0x3f1a48[_0xd425('0x6d')+_0x1c03d6+_0xf06395+'Id']=_0x334226['Account']['id'];return db[_0x1c03d6+'TransferReport']['create'](_0x3f1a48);})['then'](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x5d8a47,'interaction':_0x334226['Interaction'],'message':_0x334226,'account':_0x334226[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x38'),'appdata':_0x433e5d[_0xd425('0x13')]+','+(_0x334226[_0xd425('0x64')][_0xd425('0x79')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})['then'](respondWithResult(_0x4147eb,null))[_0xd425('0xf')](handleError(_0x4147eb,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 790e471..627aa64 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 _0x1f28=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update','delete'];(function(_0x1c880c,_0x5b65f5){var _0x49150e=function(_0x228d3b){while(--_0x228d3b){_0x1c880c['push'](_0x1c880c['shift']());}};_0x49150e(++_0x5b65f5);}(_0x1f28,0x121));var _0x81f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f28[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x81f2('0x0'));var util=require(_0x81f2('0x1'));var path=require(_0x81f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x81f2('0x3'));var router=express[_0x81f2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x81f2('0x5'));var config=require(_0x81f2('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0x81f2('0x7')](),controller[_0x81f2('0x8')]);router[_0x81f2('0x9')]('/:id',auth[_0x81f2('0x7')](),controller[_0x81f2('0xa')]);router[_0x81f2('0x9')]('/:id/run',auth[_0x81f2('0x7')](),controller['run']);router[_0x81f2('0xb')]('/',auth[_0x81f2('0x7')](),controller[_0x81f2('0xc')]);router[_0x81f2('0xd')](_0x81f2('0xe'),auth[_0x81f2('0x7')](),controller[_0x81f2('0xf')]);router[_0x81f2('0x10')](_0x81f2('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x81f2('0x11')]=router; \ No newline at end of file +var _0x2cb3=['express','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x6e8bb,_0xc736c2){var _0x328dfa=function(_0x1a1d92){while(--_0x1a1d92){_0x6e8bb['push'](_0x6e8bb['shift']());}};_0x328dfa(++_0xc736c2);}(_0x2cb3,0x1b2));var _0x32cb=function(_0x3d9296,_0x3446ef){_0x3d9296=_0x3d9296-0x0;var _0x263126=_0x2cb3[_0x3d9296];return _0x263126;};'use strict';var multer=require(_0x32cb('0x0'));var util=require(_0x32cb('0x1'));var path=require(_0x32cb('0x2'));var timeout=require('connect-timeout');var express=require(_0x32cb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x32cb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32cb('0x5'));router[_0x32cb('0x6')]('/',auth[_0x32cb('0x7')](),controller[_0x32cb('0x8')]);router[_0x32cb('0x6')](_0x32cb('0x9'),auth[_0x32cb('0x7')](),controller[_0x32cb('0xa')]);router[_0x32cb('0x6')](_0x32cb('0xb'),auth[_0x32cb('0x7')](),controller[_0x32cb('0xc')]);router[_0x32cb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32cb('0xe')](_0x32cb('0x9'),auth[_0x32cb('0x7')](),controller[_0x32cb('0xf')]);router[_0x32cb('0x10')]('/:id',auth[_0x32cb('0x7')](),controller[_0x32cb('0x11')]);module[_0x32cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b3c27d8..28b50bd 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 _0x8267=['hours','minutes','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x51cf64,_0x303dab){var _0x2c982b=function(_0x471301){while(--_0x471301){_0x51cf64['push'](_0x51cf64['shift']());}};_0x2c982b(++_0x303dab);}(_0x8267,0x14b));var _0x7826=function(_0x161db6,_0x3aef8e){_0x161db6=_0x161db6-0x0;var _0x126230=_0x8267[_0x161db6];return _0x126230;};'use strict';var Sequelize=require(_0x7826('0x0'));module[_0x7826('0x1')]={'name':{'type':Sequelize[_0x7826('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7826('0x2')]},'active':{'type':Sequelize[_0x7826('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7826('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x7826('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7826('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7826('0x7')](_0x7826('0x8'),_0x7826('0x9'),_0x7826('0xa'),'weeks','days',_0x7826('0xb'),_0x7826('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x7826('0x7')]('csv',_0x7826('0xd'),_0x7826('0xe')),'allowNull':![],'defaultValue':_0x7826('0xf')},'type':{'type':Sequelize[_0x7826('0x7')](_0x7826('0x10'),_0x7826('0x11')),'allowNull':![],'defaultValue':_0x7826('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7826('0x2')]},'cc':{'type':Sequelize[_0x7826('0x12')]},'bcc':{'type':Sequelize[_0x7826('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x7826('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4627=['csv','default','custom','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','pdf','xlsx'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4627,0x1f2));var _0x7462=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x4627[_0x19159a];return _0xa677f4;};'use strict';var Sequelize=require(_0x7462('0x0'));module[_0x7462('0x1')]={'name':{'type':Sequelize[_0x7462('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7462('0x2')],'allowNull':![],'defaultValue':_0x7462('0x3')},'startAt':{'type':Sequelize[_0x7462('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7462('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7462('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7462('0x6')](_0x7462('0x7'),_0x7462('0x8'),_0x7462('0x9'),'weeks',_0x7462('0xa'),_0x7462('0xb'),_0x7462('0xc')),'allowNull':![],'defaultValue':_0x7462('0xa')},'output':{'type':Sequelize[_0x7462('0x6')]('csv',_0x7462('0xd'),_0x7462('0xe')),'allowNull':![],'defaultValue':_0x7462('0xf')},'type':{'type':Sequelize[_0x7462('0x6')]('custom',_0x7462('0x10')),'allowNull':![],'defaultValue':_0x7462('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7462('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7462('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d84924e..990ad38 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 _0xd1a4=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','../../config/schedule','run','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','get','Scheduler','UserProfileResource','destroy','then','end','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','findAll','params','keys','intersection','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x483d14,_0x1519f4){var _0x4b493a=function(_0x1c694f){while(--_0x1c694f){_0x483d14['push'](_0x483d14['shift']());}};_0x4b493a(++_0x1519f4);}(_0xd1a4,0x1b9));var _0x4d1a=function(_0x279732,_0x2c13af){_0x279732=_0x279732-0x0;var _0x576ce2=_0xd1a4[_0x279732];return _0x576ce2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d1a('0x0'));var zipdir=require(_0x4d1a('0x1'));var jsonpatch=require(_0x4d1a('0x2'));var rp=require('request-promise');var moment=require(_0x4d1a('0x3'));var BPromise=require(_0x4d1a('0x4'));var Mustache=require(_0x4d1a('0x5'));var util=require('util');var path=require(_0x4d1a('0x6'));var sox=require(_0x4d1a('0x7'));var csv=require(_0x4d1a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d1a('0x9'));var _=require(_0x4d1a('0xa'));var squel=require(_0x4d1a('0xb'));var crypto=require(_0x4d1a('0xc'));var jsforce=require(_0x4d1a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4d1a('0x8'));var querystring=require(_0x4d1a('0xe'));var Papa=require(_0x4d1a('0xf'));var Redis=require(_0x4d1a('0x10'));var authService=require(_0x4d1a('0x11'));var qs=require(_0x4d1a('0x12'));var as=require(_0x4d1a('0x13'));var hardwareService=require(_0x4d1a('0x14'));var logger=require('../../config/logger')(_0x4d1a('0x15'));var utils=require('../../config/utils');var config=require(_0x4d1a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d1a('0x17'))['db'];function respondWithStatusCode(_0x2af82f,_0x691120){_0x691120=_0x691120||0xcc;return function(_0x22e8ab){if(_0x22e8ab){return _0x2af82f[_0x4d1a('0x18')](_0x691120);}return _0x2af82f['status'](_0x691120)['end']();};}function respondWithResult(_0x1b5500,_0x189a2d){_0x189a2d=_0x189a2d||0xc8;return function(_0x33c2e0){if(_0x33c2e0){return _0x1b5500[_0x4d1a('0x19')](_0x189a2d)[_0x4d1a('0x1a')](_0x33c2e0);}};}function respondWithFilteredResult(_0x46ac22,_0x4d3350){return function(_0x55dc3f){if(_0x55dc3f){var _0x52549a=typeof _0x4d3350['offset']==='undefined'&&typeof _0x4d3350[_0x4d1a('0x1b')]===_0x4d1a('0x1c');var _0x4ffbab=_0x55dc3f[_0x4d1a('0x1d')];var _0xfcc336=_0x52549a?0x0:_0x4d3350[_0x4d1a('0x1e')];var _0x54f526=_0x52549a?_0x55dc3f[_0x4d1a('0x1d')]:_0x4d3350[_0x4d1a('0x1e')]+_0x4d3350[_0x4d1a('0x1b')];var _0x9b9c20;if(_0x54f526>=_0x4ffbab){_0x54f526=_0x4ffbab;_0x9b9c20=0xc8;}else{_0x9b9c20=0xce;}_0x46ac22[_0x4d1a('0x19')](_0x9b9c20);return _0x46ac22[_0x4d1a('0x1f')](_0x4d1a('0x20'),_0xfcc336+'-'+_0x54f526+'/'+_0x4ffbab)[_0x4d1a('0x1a')](_0x55dc3f);}return null;};}function patchUpdates(_0x38c162){return function(_0xe010c4){try{jsonpatch[_0x4d1a('0x21')](_0xe010c4,_0x38c162,!![]);}catch(_0x1ef1cb){return BPromise[_0x4d1a('0x22')](_0x1ef1cb);}return _0xe010c4['save']();};}function saveUpdates(_0x52a972,_0x3836dc){return function(_0x5584b7){if(_0x5584b7){return _0x5584b7[_0x4d1a('0x23')](_0x52a972)['then'](function(_0x4760b7){return _0x4760b7;});}return null;};}function removeEntity(_0x5ebbf9,_0x5aabe9){return function(_0x2cd280){if(_0x2cd280){return _0x2cd280['destroy']()['then'](function(){var _0xe8c29a=_0x2cd280[_0x4d1a('0x24')]({'plain':!![]});var _0x417cff=_0x4d1a('0x25');return db[_0x4d1a('0x26')][_0x4d1a('0x27')]({'where':{'type':_0x417cff,'resourceId':_0xe8c29a['id']}})['then'](function(){return _0x2cd280;});})[_0x4d1a('0x28')](function(){_0x5ebbf9[_0x4d1a('0x19')](0xcc)[_0x4d1a('0x29')]();});}};}function handleEntityNotFound(_0x1a3f66,_0xa53818){return function(_0x3867b8){if(!_0x3867b8){_0x1a3f66[_0x4d1a('0x18')](0x194);}return _0x3867b8;};}function handleError(_0xc3c75b,_0x7a8188){_0x7a8188=_0x7a8188||0x1f4;return function(_0x262d77){logger['error'](_0x262d77[_0x4d1a('0x2a')]);if(_0x262d77[_0x4d1a('0x2b')]){delete _0x262d77[_0x4d1a('0x2b')];}_0xc3c75b[_0x4d1a('0x19')](_0x7a8188)[_0x4d1a('0x2c')](_0x262d77);};}exports[_0x4d1a('0x2d')]=function(_0x2e51ed,_0x16235d){var _0x4d9a3c={},_0x41d5fb={},_0x9bcda8={'count':0x0,'rows':[]};var _0x4487e2=_[_0x4d1a('0x2e')](db[_0x4d1a('0x2f')][_0x4d1a('0x30')],function(_0x32b8db){return{'name':_0x32b8db[_0x4d1a('0x31')],'type':_0x32b8db[_0x4d1a('0x32')][_0x4d1a('0x33')]};});_0x41d5fb[_0x4d1a('0x34')]=_['map'](_0x4487e2,'name');_0x41d5fb[_0x4d1a('0x35')]=_['keys'](_0x2e51ed['query']);_0x41d5fb['filters']=_['intersection'](_0x41d5fb[_0x4d1a('0x34')],_0x41d5fb['query']);_0x4d9a3c[_0x4d1a('0x36')]=_['intersection'](_0x41d5fb[_0x4d1a('0x34')],qs[_0x4d1a('0x37')](_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x37')]));_0x4d9a3c[_0x4d1a('0x36')]=_0x4d9a3c[_0x4d1a('0x36')]['length']?_0x4d9a3c[_0x4d1a('0x36')]:_0x41d5fb[_0x4d1a('0x34')];if(!_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x38')](_0x4d1a('0x39'))){_0x4d9a3c[_0x4d1a('0x1b')]=qs[_0x4d1a('0x1b')](_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x1b')]);_0x4d9a3c['offset']=qs[_0x4d1a('0x1e')](_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x1e')]);}_0x4d9a3c[_0x4d1a('0x3a')]=qs[_0x4d1a('0x3b')](_0x2e51ed[_0x4d1a('0x35')]['sort']);_0x4d9a3c['where']=qs[_0x4d1a('0x3c')](_[_0x4d1a('0x3d')](_0x2e51ed[_0x4d1a('0x35')],_0x41d5fb[_0x4d1a('0x3c')]),_0x4487e2);if(_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x3e')]){_0x4d9a3c[_0x4d1a('0x3f')]=_[_0x4d1a('0x40')](_0x4d9a3c[_0x4d1a('0x3f')],{'$or':_[_0x4d1a('0x2e')](_0x4487e2,function(_0x467f63){if(_0x467f63[_0x4d1a('0x32')]!==_0x4d1a('0x41')){var _0x406b77={};_0x406b77[_0x467f63[_0x4d1a('0x2b')]]={'$like':'%'+_0x2e51ed[_0x4d1a('0x35')][_0x4d1a('0x3e')]+'%'};return _0x406b77;}})});}_0x4d9a3c=_[_0x4d1a('0x40')]({},_0x4d9a3c,_0x2e51ed['options']);var _0x5c8e18={'where':_0x4d9a3c[_0x4d1a('0x3f')]};return db[_0x4d1a('0x2f')][_0x4d1a('0x1d')](_0x5c8e18)[_0x4d1a('0x28')](function(_0x125ff7){_0x9bcda8['count']=_0x125ff7;if(_0x2e51ed[_0x4d1a('0x35')]['includeAll']){_0x4d9a3c['include']=[{'all':!![]}];}return db['Schedule'][_0x4d1a('0x42')](_0x4d9a3c);})[_0x4d1a('0x28')](function(_0x1b36ef){_0x9bcda8['rows']=_0x1b36ef;return _0x9bcda8;})[_0x4d1a('0x28')](respondWithFilteredResult(_0x16235d,_0x4d9a3c))['catch'](handleError(_0x16235d,null));};exports['show']=function(_0x1c14c7,_0x2d7cb9){var _0xb42867={'raw':![],'where':{'id':_0x1c14c7[_0x4d1a('0x43')]['id']}},_0xec421f={};_0xec421f[_0x4d1a('0x34')]=_[_0x4d1a('0x44')](db['Schedule'][_0x4d1a('0x30')]);_0xec421f[_0x4d1a('0x35')]=_[_0x4d1a('0x44')](_0x1c14c7['query']);_0xec421f[_0x4d1a('0x3c')]=_[_0x4d1a('0x45')](_0xec421f[_0x4d1a('0x34')],_0xec421f[_0x4d1a('0x35')]);_0xb42867['attributes']=_[_0x4d1a('0x45')](_0xec421f[_0x4d1a('0x34')],qs['fields'](_0x1c14c7[_0x4d1a('0x35')][_0x4d1a('0x37')]));_0xb42867['attributes']=_0xb42867[_0x4d1a('0x36')]['length']?_0xb42867['attributes']:_0xec421f['model'];if(_0x1c14c7[_0x4d1a('0x35')][_0x4d1a('0x46')]){_0xb42867[_0x4d1a('0x47')]=[{'all':!![]}];}_0xb42867=_[_0x4d1a('0x40')]({},_0xb42867,_0x1c14c7[_0x4d1a('0x48')]);return db[_0x4d1a('0x2f')][_0x4d1a('0x49')](_0xb42867)[_0x4d1a('0x28')](handleEntityNotFound(_0x2d7cb9,null))[_0x4d1a('0x28')](respondWithResult(_0x2d7cb9,null))['catch'](handleError(_0x2d7cb9,null));};exports['create']=function(_0x23bd78,_0x578e60){return db['Schedule'][_0x4d1a('0x4a')](_0x23bd78[_0x4d1a('0x4b')],{})[_0x4d1a('0x28')](function(_0x28384d){var _0x479c4e=_0x23bd78[_0x4d1a('0x4c')][_0x4d1a('0x24')]({'plain':!![]});if(!_0x479c4e)throw new Error(_0x4d1a('0x4d'));if(_0x479c4e[_0x4d1a('0x4e')]==='user'){var _0x33e6bd=_0x28384d[_0x4d1a('0x24')]({'plain':!![]});var _0xeeab1=_0x4d1a('0x25');return db[_0x4d1a('0x4f')][_0x4d1a('0x49')]({'where':{'name':_0xeeab1,'userProfileId':_0x479c4e[_0x4d1a('0x50')]},'raw':!![]})[_0x4d1a('0x28')](function(_0x6c2275){if(_0x6c2275&&_0x6c2275[_0x4d1a('0x51')]===0x0){return db[_0x4d1a('0x26')][_0x4d1a('0x4a')]({'name':_0x33e6bd[_0x4d1a('0x2b')],'resourceId':_0x33e6bd['id'],'type':_0x6c2275[_0x4d1a('0x2b')],'sectionId':_0x6c2275['id']},{})[_0x4d1a('0x28')](function(){return _0x28384d;});}else{return _0x28384d;}})['catch'](function(_0x555b7e){logger[_0x4d1a('0x52')](_0x4d1a('0x53'),_0x555b7e);throw _0x555b7e;});}return _0x28384d;})['then'](respondWithResult(_0x578e60,0xc9))[_0x4d1a('0x54')](handleError(_0x578e60,null));};exports[_0x4d1a('0x23')]=function(_0x1b9707,_0x1fd873){if(_0x1b9707[_0x4d1a('0x4b')]['id']){delete _0x1b9707[_0x4d1a('0x4b')]['id'];}return db['Schedule'][_0x4d1a('0x49')]({'where':{'id':_0x1b9707[_0x4d1a('0x43')]['id']}})[_0x4d1a('0x28')](handleEntityNotFound(_0x1fd873,null))[_0x4d1a('0x28')](saveUpdates(_0x1b9707[_0x4d1a('0x4b')],null))[_0x4d1a('0x28')](respondWithResult(_0x1fd873,null))[_0x4d1a('0x54')](handleError(_0x1fd873,null));};exports[_0x4d1a('0x27')]=function(_0x6d6029,_0x1f0514){return db['Schedule']['find']({'where':{'id':_0x6d6029['params']['id']}})['then'](handleEntityNotFound(_0x1f0514,null))['then'](removeEntity(_0x1f0514,null))['catch'](handleError(_0x1f0514,null));};exports['run']=function(_0x40351c,_0x412ec2,_0x588480){var _0x5d1bea=require(_0x4d1a('0x55'));return db[_0x4d1a('0x2f')][_0x4d1a('0x49')]({'where':{'id':_0x40351c[_0x4d1a('0x43')]['id']},'raw':!![]})[_0x4d1a('0x28')](handleEntityNotFound(_0x412ec2,null))[_0x4d1a('0x28')](function(){_0x5d1bea[_0x4d1a('0x56')](_0x40351c['params']['id']);})[_0x4d1a('0x28')](respondWithStatusCode(_0x412ec2,null))[_0x4d1a('0x54')](handleError(_0x412ec2,null));}; \ No newline at end of file +var _0x9604=['to-csv','fs-extra','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','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','params','Schedule','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2b7a3e,_0x11eb3d){var _0x4f9382=function(_0x3e915d){while(--_0x3e915d){_0x2b7a3e['push'](_0x2b7a3e['shift']());}};_0x4f9382(++_0x11eb3d);}(_0x9604,0x14b));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4960('0x0'));var rimraf=require(_0x4960('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4960('0x2'));var rp=require(_0x4960('0x3'));var moment=require(_0x4960('0x4'));var BPromise=require(_0x4960('0x5'));var Mustache=require(_0x4960('0x6'));var util=require(_0x4960('0x7'));var path=require(_0x4960('0x8'));var sox=require('sox');var csv=require(_0x4960('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4960('0xa'));var _=require(_0x4960('0xb'));var squel=require(_0x4960('0xc'));var crypto=require(_0x4960('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4960('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4960('0xf'));var Redis=require(_0x4960('0x10'));var authService=require(_0x4960('0x11'));var qs=require(_0x4960('0x12'));var as=require(_0x4960('0x13'));var hardwareService=require(_0x4960('0x14'));var logger=require(_0x4960('0x15'))(_0x4960('0x16'));var utils=require(_0x4960('0x17'));var config=require(_0x4960('0x18'));var licenseUtil=require(_0x4960('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13fa65,_0x2a4d91){_0x2a4d91=_0x2a4d91||0xcc;return function(_0x462693){if(_0x462693){return _0x13fa65['sendStatus'](_0x2a4d91);}return _0x13fa65[_0x4960('0x1a')](_0x2a4d91)[_0x4960('0x1b')]();};}function respondWithResult(_0x48fb90,_0x522f96){_0x522f96=_0x522f96||0xc8;return function(_0x307d53){if(_0x307d53){return _0x48fb90[_0x4960('0x1a')](_0x522f96)[_0x4960('0x1c')](_0x307d53);}};}function respondWithFilteredResult(_0x4e0c11,_0x1544d8){return function(_0x177cf0){if(_0x177cf0){var _0x202ecb=typeof _0x1544d8[_0x4960('0x1d')]===_0x4960('0x1e')&&typeof _0x1544d8[_0x4960('0x1f')]===_0x4960('0x1e');var _0x10deb3=_0x177cf0[_0x4960('0x20')];var _0x457898=_0x202ecb?0x0:_0x1544d8['offset'];var _0x10dc48=_0x202ecb?_0x177cf0[_0x4960('0x20')]:_0x1544d8['offset']+_0x1544d8[_0x4960('0x1f')];var _0x123409;if(_0x10dc48>=_0x10deb3){_0x10dc48=_0x10deb3;_0x123409=0xc8;}else{_0x123409=0xce;}_0x4e0c11['status'](_0x123409);return _0x4e0c11[_0x4960('0x21')](_0x4960('0x22'),_0x457898+'-'+_0x10dc48+'/'+_0x10deb3)['json'](_0x177cf0);}return null;};}function patchUpdates(_0x526bfd){return function(_0x3f0cec){try{jsonpatch['apply'](_0x3f0cec,_0x526bfd,!![]);}catch(_0x5d687f){return BPromise[_0x4960('0x23')](_0x5d687f);}return _0x3f0cec[_0x4960('0x24')]();};}function saveUpdates(_0x2db4c4,_0x19c67d){return function(_0x1f46d3){if(_0x1f46d3){return _0x1f46d3['update'](_0x2db4c4)[_0x4960('0x25')](function(_0x58a4d5){return _0x58a4d5;});}return null;};}function removeEntity(_0x5a5073,_0x230fbf){return function(_0x1fc6ea){if(_0x1fc6ea){return _0x1fc6ea[_0x4960('0x26')]()[_0x4960('0x25')](function(){var _0x5054e0=_0x1fc6ea[_0x4960('0x27')]({'plain':!![]});var _0x5b1285=_0x4960('0x28');return db[_0x4960('0x29')]['destroy']({'where':{'type':_0x5b1285,'resourceId':_0x5054e0['id']}})[_0x4960('0x25')](function(){return _0x1fc6ea;});})[_0x4960('0x25')](function(){_0x5a5073[_0x4960('0x1a')](0xcc)[_0x4960('0x1b')]();});}};}function handleEntityNotFound(_0xd011df,_0x48d4c8){return function(_0x1ffff){if(!_0x1ffff){_0xd011df[_0x4960('0x2a')](0x194);}return _0x1ffff;};}function handleError(_0x4df957,_0xde3ac6){_0xde3ac6=_0xde3ac6||0x1f4;return function(_0x295447){logger[_0x4960('0x2b')](_0x295447['stack']);if(_0x295447[_0x4960('0x2c')]){delete _0x295447[_0x4960('0x2c')];}_0x4df957[_0x4960('0x1a')](_0xde3ac6)[_0x4960('0x2d')](_0x295447);};}exports[_0x4960('0x2e')]=function(_0x5dcc39,_0xafeb79){var _0x294560={},_0x2503a3={},_0x175bbf={'count':0x0,'rows':[]};var _0x3b936e=_[_0x4960('0x2f')](db['Schedule'][_0x4960('0x30')],function(_0x2d1db2){return{'name':_0x2d1db2['fieldName'],'type':_0x2d1db2['type']['key']};});_0x2503a3[_0x4960('0x31')]=_['map'](_0x3b936e,_0x4960('0x2c'));_0x2503a3['query']=_[_0x4960('0x32')](_0x5dcc39['query']);_0x2503a3['filters']=_[_0x4960('0x33')](_0x2503a3[_0x4960('0x31')],_0x2503a3[_0x4960('0x34')]);_0x294560[_0x4960('0x35')]=_[_0x4960('0x33')](_0x2503a3[_0x4960('0x31')],qs[_0x4960('0x36')](_0x5dcc39[_0x4960('0x34')][_0x4960('0x36')]));_0x294560[_0x4960('0x35')]=_0x294560[_0x4960('0x35')][_0x4960('0x37')]?_0x294560['attributes']:_0x2503a3[_0x4960('0x31')];if(!_0x5dcc39[_0x4960('0x34')][_0x4960('0x38')](_0x4960('0x39'))){_0x294560[_0x4960('0x1f')]=qs[_0x4960('0x1f')](_0x5dcc39[_0x4960('0x34')][_0x4960('0x1f')]);_0x294560[_0x4960('0x1d')]=qs[_0x4960('0x1d')](_0x5dcc39['query'][_0x4960('0x1d')]);}_0x294560[_0x4960('0x3a')]=qs[_0x4960('0x3b')](_0x5dcc39[_0x4960('0x34')][_0x4960('0x3b')]);_0x294560[_0x4960('0x3c')]=qs[_0x4960('0x3d')](_[_0x4960('0x3e')](_0x5dcc39['query'],_0x2503a3[_0x4960('0x3d')]),_0x3b936e);if(_0x5dcc39['query']['filter']){_0x294560[_0x4960('0x3c')]=_[_0x4960('0x3f')](_0x294560[_0x4960('0x3c')],{'$or':_['map'](_0x3b936e,function(_0x1bd200){if(_0x1bd200[_0x4960('0x40')]!==_0x4960('0x41')){var _0x3ba6f6={};_0x3ba6f6[_0x1bd200[_0x4960('0x2c')]]={'$like':'%'+_0x5dcc39[_0x4960('0x34')][_0x4960('0x42')]+'%'};return _0x3ba6f6;}})});}_0x294560=_[_0x4960('0x3f')]({},_0x294560,_0x5dcc39[_0x4960('0x43')]);var _0x42e245={'where':_0x294560[_0x4960('0x3c')]};return db['Schedule'][_0x4960('0x20')](_0x42e245)[_0x4960('0x25')](function(_0x5b8ef8){_0x175bbf['count']=_0x5b8ef8;if(_0x5dcc39['query']['includeAll']){_0x294560[_0x4960('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x4960('0x45')](_0x294560);})[_0x4960('0x25')](function(_0x2fe30e){_0x175bbf['rows']=_0x2fe30e;return _0x175bbf;})[_0x4960('0x25')](respondWithFilteredResult(_0xafeb79,_0x294560))[_0x4960('0x46')](handleError(_0xafeb79,null));};exports['show']=function(_0xd74dc4,_0x1b4502){var _0x2a61ee={'raw':![],'where':{'id':_0xd74dc4[_0x4960('0x47')]['id']}},_0x49092e={};_0x49092e[_0x4960('0x31')]=_[_0x4960('0x32')](db[_0x4960('0x48')][_0x4960('0x30')]);_0x49092e[_0x4960('0x34')]=_[_0x4960('0x32')](_0xd74dc4[_0x4960('0x34')]);_0x49092e['filters']=_[_0x4960('0x33')](_0x49092e[_0x4960('0x31')],_0x49092e[_0x4960('0x34')]);_0x2a61ee[_0x4960('0x35')]=_['intersection'](_0x49092e[_0x4960('0x31')],qs[_0x4960('0x36')](_0xd74dc4[_0x4960('0x34')]['fields']));_0x2a61ee['attributes']=_0x2a61ee['attributes'][_0x4960('0x37')]?_0x2a61ee['attributes']:_0x49092e['model'];if(_0xd74dc4[_0x4960('0x34')][_0x4960('0x49')]){_0x2a61ee[_0x4960('0x44')]=[{'all':!![]}];}_0x2a61ee=_['merge']({},_0x2a61ee,_0xd74dc4[_0x4960('0x43')]);return db[_0x4960('0x48')][_0x4960('0x4a')](_0x2a61ee)[_0x4960('0x25')](handleEntityNotFound(_0x1b4502,null))[_0x4960('0x25')](respondWithResult(_0x1b4502,null))['catch'](handleError(_0x1b4502,null));};exports[_0x4960('0x4b')]=function(_0x4e30f0,_0x4fe244){return db['Schedule'][_0x4960('0x4b')](_0x4e30f0[_0x4960('0x4c')],{})['then'](function(_0x4b6cf1){var _0x53b183=_0x4e30f0['user'][_0x4960('0x27')]({'plain':!![]});if(!_0x53b183)throw new Error(_0x4960('0x4d'));if(_0x53b183[_0x4960('0x4e')]===_0x4960('0x4f')){var _0x217654=_0x4b6cf1[_0x4960('0x27')]({'plain':!![]});var _0x2aff7f='Scheduler';return db[_0x4960('0x50')][_0x4960('0x4a')]({'where':{'name':_0x2aff7f,'userProfileId':_0x53b183['userProfileId']},'raw':!![]})[_0x4960('0x25')](function(_0x7816b9){if(_0x7816b9&&_0x7816b9[_0x4960('0x51')]===0x0){return db[_0x4960('0x29')]['create']({'name':_0x217654['name'],'resourceId':_0x217654['id'],'type':_0x7816b9[_0x4960('0x2c')],'sectionId':_0x7816b9['id']},{})[_0x4960('0x25')](function(){return _0x4b6cf1;});}else{return _0x4b6cf1;}})[_0x4960('0x46')](function(_0x3e9aee){logger[_0x4960('0x2b')](_0x4960('0x52'),_0x3e9aee);throw _0x3e9aee;});}return _0x4b6cf1;})[_0x4960('0x25')](respondWithResult(_0x4fe244,0xc9))[_0x4960('0x46')](handleError(_0x4fe244,null));};exports['update']=function(_0x425d7c,_0x1ac2eb){if(_0x425d7c[_0x4960('0x4c')]['id']){delete _0x425d7c['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x425d7c['params']['id']}})[_0x4960('0x25')](handleEntityNotFound(_0x1ac2eb,null))['then'](saveUpdates(_0x425d7c[_0x4960('0x4c')],null))[_0x4960('0x25')](respondWithResult(_0x1ac2eb,null))[_0x4960('0x46')](handleError(_0x1ac2eb,null));};exports[_0x4960('0x26')]=function(_0x158ec7,_0x57d296){return db[_0x4960('0x48')]['find']({'where':{'id':_0x158ec7[_0x4960('0x47')]['id']}})[_0x4960('0x25')](handleEntityNotFound(_0x57d296,null))[_0x4960('0x25')](removeEntity(_0x57d296,null))[_0x4960('0x46')](handleError(_0x57d296,null));};exports[_0x4960('0x53')]=function(_0x12989c,_0x40f871,_0x37c769){var _0xbcd66a=require(_0x4960('0x54'));return db[_0x4960('0x48')][_0x4960('0x4a')]({'where':{'id':_0x12989c[_0x4960('0x47')]['id']},'raw':!![]})[_0x4960('0x25')](handleEntityNotFound(_0x40f871,null))[_0x4960('0x25')](function(){_0xbcd66a[_0x4960('0x53')](_0x12989c[_0x4960('0x47')]['id']);})[_0x4960('0x25')](respondWithStatusCode(_0x40f871,null))[_0x4960('0x46')](handleError(_0x40f871,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0704554..df286c6 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 _0x27ec=['Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define'];(function(_0x491f70,_0x4b0cfa){var _0x2b8883=function(_0x5e6fb0){while(--_0x5e6fb0){_0x491f70['push'](_0x491f70['shift']());}};_0x2b8883(++_0x4b0cfa);}(_0x27ec,0xd2));var _0xc27e=function(_0x162479,_0x1c0687){_0x162479=_0x162479-0x0;var _0x248c72=_0x27ec[_0x162479];return _0x248c72;};'use strict';var _=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var logger=require(_0xc27e('0x2'))(_0xc27e('0x3'));var moment=require('moment');var BPromise=require(_0xc27e('0x4'));var rp=require(_0xc27e('0x5'));var fs=require('fs');var path=require(_0xc27e('0x6'));var rimraf=require('rimraf');var config=require(_0xc27e('0x7'));var attributes=require(_0xc27e('0x8'));module[_0xc27e('0x9')]=function(_0x2c43a6,_0x43e000){return _0x2c43a6[_0xc27e('0xa')](_0xc27e('0xb'),attributes,{'tableName':_0xc27e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32f1=['api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x32f1,0x72));var _0x132f=function(_0x3d5383,_0x2a80f8){_0x3d5383=_0x3d5383-0x0;var _0x4b87be=_0x32f1[_0x3d5383];return _0x4b87be;};'use strict';var _=require(_0x132f('0x0'));var util=require(_0x132f('0x1'));var logger=require(_0x132f('0x2'))(_0x132f('0x3'));var moment=require(_0x132f('0x4'));var BPromise=require('bluebird');var rp=require(_0x132f('0x5'));var fs=require('fs');var path=require(_0x132f('0x6'));var rimraf=require(_0x132f('0x7'));var config=require(_0x132f('0x8'));var attributes=require(_0x132f('0x9'));module[_0x132f('0xa')]=function(_0x3ab3fd,_0x4346a3){return _0x3ab3fd[_0x132f('0xb')]('Schedule',attributes,{'tableName':_0x132f('0xc'),'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 92fe518..ea1f36b 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 _0xa1c3=['http','then','debug','request\x20sent','stringify','error','message','Schedule,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x411dbe,_0x436cde){var _0x57efb0=function(_0xab6225){while(--_0xab6225){_0x411dbe['push'](_0x411dbe['shift']());}};_0x57efb0(++_0x436cde);}(_0xa1c3,0xc8));var _0x3a1c=function(_0x23858e,_0x369fb3){_0x23858e=_0x23858e-0x0;var _0x3c0a0d=_0xa1c3[_0x23858e];return _0x3c0a0d;};'use strict';var _=require(_0x3a1c('0x0'));var util=require(_0x3a1c('0x1'));var moment=require('moment');var BPromise=require(_0x3a1c('0x2'));var rs=require(_0x3a1c('0x3'));var fs=require('fs');var Redis=require(_0x3a1c('0x4'));var db=require(_0x3a1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a1c('0x6'))(_0x3a1c('0x7'));var config=require('../../config/environment');var jayson=require(_0x3a1c('0x8'));var client=jayson[_0x3a1c('0x9')][_0x3a1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59fec4,_0x45056f,_0x421b9c){return new BPromise(function(_0x5427e0,_0x1fba28){return client['request'](_0x59fec4,_0x421b9c)[_0x3a1c('0xb')](function(_0x2d0978){logger['info']('Schedule,\x20%s,\x20%s',_0x45056f,'request\x20sent');logger[_0x3a1c('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x45056f,_0x3a1c('0xd'),JSON[_0x3a1c('0xe')](_0x2d0978));if(_0x2d0978[_0x3a1c('0xf')]){if(_0x2d0978['error']['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x45056f,_0x2d0978[_0x3a1c('0xf')][_0x3a1c('0x10')]);return _0x1fba28(_0x2d0978['error'][_0x3a1c('0x10')]);}logger[_0x3a1c('0xf')](_0x3a1c('0x11'),_0x45056f,_0x2d0978['error'][_0x3a1c('0x10')]);return _0x5427e0(_0x2d0978[_0x3a1c('0xf')][_0x3a1c('0x10')]);}else{logger[_0x3a1c('0x12')](_0x3a1c('0x11'),_0x45056f,_0x3a1c('0xd'));_0x5427e0(_0x2d0978[_0x3a1c('0x13')][_0x3a1c('0x10')]);}})[_0x3a1c('0x14')](function(_0x55673e){logger[_0x3a1c('0xf')](_0x3a1c('0x11'),_0x45056f,_0x55673e);_0x1fba28(_0x55673e);});});} \ No newline at end of file +var _0xd898=['request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x59bd39,_0x63c2a5){var _0xf2bc65=function(_0x589710){while(--_0x589710){_0x59bd39['push'](_0x59bd39['shift']());}};_0xf2bc65(++_0x63c2a5);}(_0xd898,0x1d6));var _0x8d89=function(_0x22e46f,_0x40b83f){_0x22e46f=_0x22e46f-0x0;var _0x20e186=_0xd898[_0x22e46f];return _0x20e186;};'use strict';var _=require(_0x8d89('0x0'));var util=require(_0x8d89('0x1'));var moment=require(_0x8d89('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d89('0x4'));var logger=require(_0x8d89('0x5'))('rpc');var config=require(_0x8d89('0x6'));var jayson=require(_0x8d89('0x7'));var client=jayson[_0x8d89('0x8')][_0x8d89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42e182,_0x266db7,_0x3eea11){return new BPromise(function(_0x28f77d,_0x3ba058){return client[_0x8d89('0xa')](_0x42e182,_0x3eea11)[_0x8d89('0xb')](function(_0x36ae7e){logger[_0x8d89('0xc')](_0x8d89('0xd'),_0x266db7,_0x8d89('0xe'));logger[_0x8d89('0xf')](_0x8d89('0x10'),_0x266db7,_0x8d89('0xe'),JSON['stringify'](_0x36ae7e));if(_0x36ae7e[_0x8d89('0x11')]){if(_0x36ae7e['error'][_0x8d89('0x12')]===0x1f4){logger[_0x8d89('0x11')](_0x8d89('0xd'),_0x266db7,_0x36ae7e['error'][_0x8d89('0x13')]);return _0x3ba058(_0x36ae7e['error'][_0x8d89('0x13')]);}logger['error'](_0x8d89('0xd'),_0x266db7,_0x36ae7e[_0x8d89('0x11')][_0x8d89('0x13')]);return _0x28f77d(_0x36ae7e[_0x8d89('0x11')]['message']);}else{logger[_0x8d89('0xc')](_0x8d89('0xd'),_0x266db7,_0x8d89('0xe'));_0x28f77d(_0x36ae7e[_0x8d89('0x14')]['message']);}})[_0x8d89('0x15')](function(_0x2468e0){logger[_0x8d89('0x11')]('Schedule,\x20%s,\x20%s',_0x266db7,_0x2468e0);_0x3ba058(_0x2468e0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 208687b..4961041 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 _0x973f=['describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x307aa0,_0x28adbf){var _0x1a9b15=function(_0x3dec2d){while(--_0x3dec2d){_0x307aa0['push'](_0x307aa0['shift']());}};_0x1a9b15(++_0x28adbf);}(_0x973f,0x182));var _0xf973=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x973f[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0xf973('0x0'));var util=require('util');var path=require(_0xf973('0x1'));var timeout=require(_0xf973('0x2'));var express=require('express');var router=express[_0xf973('0x3')]();var fs_extra=require(_0xf973('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf973('0x5'));var config=require('../../config/environment');var controller=require(_0xf973('0x6'));router[_0xf973('0x7')]('/',auth[_0xf973('0x8')](),controller[_0xf973('0x9')]);router[_0xf973('0x7')]('/describe',auth[_0xf973('0x8')](),controller[_0xf973('0xa')]);router[_0xf973('0x7')](_0xf973('0xb'),auth[_0xf973('0x8')](),controller[_0xf973('0xc')]);router['get'](_0xf973('0xd'),auth[_0xf973('0x8')](),controller[_0xf973('0xe')]);router[_0xf973('0xf')]('/',auth[_0xf973('0x8')](),controller[_0xf973('0x10')]);router[_0xf973('0x11')](_0xf973('0xb'),auth[_0xf973('0x8')](),controller[_0xf973('0x12')]);router[_0xf973('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf973('0x14')]);module[_0xf973('0x15')]=router; \ No newline at end of file +var _0x52ae=['update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','download','post','create','put','/:id'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x52ae,0x18f));var _0xe52a=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0x52ae[_0x474c66];return _0xcbd9bf;};'use strict';var multer=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe52a('0x2')]();var fs_extra=require(_0xe52a('0x3'));var auth=require(_0xe52a('0x4'));var interaction=require(_0xe52a('0x5'));var config=require(_0xe52a('0x6'));var controller=require(_0xe52a('0x7'));router[_0xe52a('0x8')]('/',auth[_0xe52a('0x9')](),controller[_0xe52a('0xa')]);router['get']('/describe',auth[_0xe52a('0x9')](),controller[_0xe52a('0xb')]);router[_0xe52a('0x8')]('/:id',auth[_0xe52a('0x9')](),controller[_0xe52a('0xc')]);router[_0xe52a('0x8')](_0xe52a('0xd'),auth['isAuthenticated'](),controller[_0xe52a('0xe')]);router[_0xe52a('0xf')]('/',auth['isAuthenticated'](),controller[_0xe52a('0x10')]);router[_0xe52a('0x11')](_0xe52a('0x12'),auth['isAuthenticated'](),controller[_0xe52a('0x13')]);router['delete']('/:id',auth[_0xe52a('0x9')](),controller[_0xe52a('0x14')]);module[_0xe52a('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 01aec53..cc6e0b2 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 _0x7a52=['toString','DATE','format','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','MM-DD-YYYY\x20HH:mm'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x7a52,0x1bd));var _0x27a5=function(_0x1532a2,_0x12eb0d){_0x1532a2=_0x1532a2-0x0;var _0x1e02ac=_0x7a52[_0x1532a2];return _0x1e02ac;};'use strict';var Sequelize=require(_0x27a5('0x0'));var moment=require('moment');var path=require(_0x27a5('0x1'));var config=require(_0x27a5('0x2'));module[_0x27a5('0x3')]={'format':{'type':Sequelize[_0x27a5('0x4')],'get':function(){return this['getDataValue'](_0x27a5('0x5'))?path[_0x27a5('0x6')](this[_0x27a5('0x7')](_0x27a5('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x27a5('0x8')]},'channel':{'type':Sequelize[_0x27a5('0x8')]},'value':{'type':Sequelize[_0x27a5('0x8')],'set':function(_0x568bbe){var _0x26ddd=_0x568bbe[_0x27a5('0x9')](/\\/g,'/');this['setDataValue']('value',_0x26ddd);}},'rating':{'type':Sequelize[_0x27a5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x2e1fe4){this[_0x27a5('0xb')](_0x27a5('0xc'),moment()['subtract'](_0x2e1fe4,'ms'));this[_0x27a5('0xb')](_0x27a5('0xd'),moment());this[_0x27a5('0xb')]('duration',_0x2e1fe4);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x27a5('0x7')]('startedAt'))['format'](_0x27a5('0xe'))[_0x27a5('0xf')]();}},'closedAt':{'type':Sequelize[_0x27a5('0x10')],'get':function(){return moment(this[_0x27a5('0x7')](_0x27a5('0xd')))[_0x27a5('0x11')](_0x27a5('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0x27a5('0x10')],'get':function(){return moment(this[_0x27a5('0x7')](_0x27a5('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0x27a5('0xf')]();}},'updatedAt':{'type':Sequelize[_0x27a5('0x10')],'get':function(){return moment(this[_0x27a5('0x7')](_0x27a5('0x13')))[_0x27a5('0x11')](_0x27a5('0xe'))[_0x27a5('0xf')]();}}}; \ No newline at end of file +var _0x958a=['VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','../../config/environment','exports'];(function(_0x5aedc2,_0x4ffa55){var _0x1a7132=function(_0x4fdd1d){while(--_0x4fdd1d){_0x5aedc2['push'](_0x5aedc2['shift']());}};_0x1a7132(++_0x4ffa55);}(_0x958a,0x128));var _0xa958=function(_0x527e5e,_0x2ffe81){_0x527e5e=_0x527e5e-0x0;var _0x2e6920=_0x958a[_0x527e5e];return _0x2e6920;};'use strict';var Sequelize=require(_0xa958('0x0'));var moment=require(_0xa958('0x1'));var path=require('path');var config=require(_0xa958('0x2'));module[_0xa958('0x3')]={'format':{'type':Sequelize[_0xa958('0x4')],'get':function(){return this[_0xa958('0x5')](_0xa958('0x6'))?path['extname'](this[_0xa958('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xa958('0x7')]},'channel':{'type':Sequelize[_0xa958('0x7')]},'value':{'type':Sequelize[_0xa958('0x7')],'set':function(_0x3ddaa9){var _0x3ca01f=_0x3ddaa9[_0xa958('0x8')](/\\/g,'/');this[_0xa958('0x9')]('value',_0x3ca01f);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa958('0xa')],'set':function(_0x249764){this[_0xa958('0x9')](_0xa958('0xb'),moment()[_0xa958('0xc')](_0x249764,'ms'));this[_0xa958('0x9')](_0xa958('0xd'),moment());this[_0xa958('0x9')](_0xa958('0xe'),_0x249764);}},'startedAt':{'type':Sequelize[_0xa958('0xf')],'get':function(){return moment(this[_0xa958('0x5')](_0xa958('0xb')))[_0xa958('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa958('0x5')](_0xa958('0xd')))[_0xa958('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xa958('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xa958('0x10')](_0xa958('0x12'))[_0xa958('0x11')]();}},'updatedAt':{'type':Sequelize[_0xa958('0xf')],'get':function(){return moment(this[_0xa958('0x5')](_0xa958('0x13')))[_0xa958('0x10')](_0xa958('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 76709ae..284e83a 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 _0x84ab=['describe','download','join','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ScreenRecording','rows','params','keys','intersection','find','catch','body','createdAt','value'];(function(_0x3554b5,_0x281c4c){var _0x37b4fd=function(_0x4794a0){while(--_0x4794a0){_0x3554b5['push'](_0x3554b5['shift']());}};_0x37b4fd(++_0x281c4c);}(_0x84ab,0x12f));var _0xb84a=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x84ab[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x409df0,_0x19bdfa){return function(_0x3258a9){if(!_0x3258a9){_0x409df0[_0xb84a('0x16')](0x194);}return _0x3258a9;};}function handleError(_0x3ff0bc,_0x3b6805){_0x3b6805=_0x3b6805||0x1f4;return function(_0xd468c3){logger[_0xb84a('0x24')](_0xd468c3[_0xb84a('0x25')]);if(_0xd468c3[_0xb84a('0x26')]){delete _0xd468c3[_0xb84a('0x26')];}_0x3ff0bc[_0xb84a('0x17')](_0x3b6805)[_0xb84a('0x27')](_0xd468c3);};}exports['index']=function(_0x582954,_0x4608ce){var _0x2c30b0={},_0x4dab4e={},_0x1f690a={'count':0x0,'rows':[]};var _0x36b4f4=_['map'](db['ScreenRecording'][_0xb84a('0x28')],function(_0x8e9319){return{'name':_0x8e9319['fieldName'],'type':_0x8e9319[_0xb84a('0x29')][_0xb84a('0x2a')]};});_0x4dab4e[_0xb84a('0x2b')]=_[_0xb84a('0x2c')](_[_0xb84a('0x2d')](_0x36b4f4,_0xb84a('0x26')),[_0xb84a('0x2e')]);_0x4dab4e[_0xb84a('0x2f')]=_['keys'](_0x582954[_0xb84a('0x2f')]);_0x4dab4e['filters']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],_0x4dab4e[_0xb84a('0x2f')]);_0x2c30b0['attributes']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],qs[_0xb84a('0x30')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x2c30b0[_0xb84a('0x31')]=_0x2c30b0[_0xb84a('0x31')][_0xb84a('0x32')]?_0x2c30b0[_0xb84a('0x31')]:_0x4dab4e['model'];if(!_0x582954[_0xb84a('0x2f')][_0xb84a('0x33')](_0xb84a('0x34'))){_0x2c30b0[_0xb84a('0x1c')]=qs[_0xb84a('0x1c')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x2c30b0['offset']=qs[_0xb84a('0x1a')](_0x582954['query'][_0xb84a('0x1a')]);}_0x2c30b0[_0xb84a('0x35')]=qs[_0xb84a('0x36')](_0x582954['query']['sort']);_0x2c30b0[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_[_0xb84a('0x39')](_0x582954[_0xb84a('0x2f')],_0x4dab4e[_0xb84a('0x38')]),_0x36b4f4);if(_0x582954['query'][_0xb84a('0x3a')]){_0x2c30b0[_0xb84a('0x37')]=_['merge'](_0x2c30b0[_0xb84a('0x37')],{'$or':_[_0xb84a('0x2d')](_0x36b4f4,function(_0x19634b){if(_0x19634b[_0xb84a('0x29')]!=='VIRTUAL'){var _0x57a1a8={};_0x57a1a8[_0x19634b['name']]={'$like':'%'+_0x582954[_0xb84a('0x2f')][_0xb84a('0x3a')]+'%'};return _0x57a1a8;}})});}_0x2c30b0=_[_0xb84a('0x3b')]({},_0x2c30b0,_0x582954[_0xb84a('0x3c')]);var _0x55b0b8={'where':_0x2c30b0[_0xb84a('0x37')]};return db['ScreenRecording'][_0xb84a('0x1d')](_0x55b0b8)['then'](function(_0x48db18){_0x1f690a['count']=_0x48db18;if(_0x582954[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x2c30b0[_0xb84a('0x3e')]=[{'all':!![]}];}return db[_0xb84a('0x3f')]['findAll'](_0x2c30b0);})[_0xb84a('0x22')](function(_0x42f0b6){_0x1f690a[_0xb84a('0x40')]=_0x42f0b6;return _0x1f690a;})[_0xb84a('0x22')](respondWithFilteredResult(_0x4608ce,_0x2c30b0))['catch'](handleError(_0x4608ce,null));};exports['show']=function(_0x15a621,_0x1f3e04){var _0x541cc4={'raw':![],'where':{'id':_0x15a621[_0xb84a('0x41')]['id']}},_0x1045ee={};_0x1045ee[_0xb84a('0x2b')]=_[_0xb84a('0x42')](db[_0xb84a('0x3f')][_0xb84a('0x28')]);_0x1045ee[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x15a621[_0xb84a('0x2f')]);_0x1045ee[_0xb84a('0x38')]=_[_0xb84a('0x43')](_0x1045ee[_0xb84a('0x2b')],_0x1045ee[_0xb84a('0x2f')]);_0x541cc4[_0xb84a('0x31')]=_[_0xb84a('0x43')](_0x1045ee['model'],qs[_0xb84a('0x30')](_0x15a621[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x541cc4[_0xb84a('0x31')]=_0x541cc4[_0xb84a('0x31')][_0xb84a('0x32')]?_0x541cc4['attributes']:_0x1045ee[_0xb84a('0x2b')];if(_0x15a621['query'][_0xb84a('0x3d')]){_0x541cc4[_0xb84a('0x3e')]=[{'all':!![]}];}_0x541cc4=_[_0xb84a('0x3b')]({},_0x541cc4,_0x15a621[_0xb84a('0x3c')]);return db['ScreenRecording'][_0xb84a('0x44')](_0x541cc4)[_0xb84a('0x22')](handleEntityNotFound(_0x1f3e04,null))[_0xb84a('0x22')](respondWithResult(_0x1f3e04,null))['catch'](handleError(_0x1f3e04,null));};exports['create']=function(_0x385986,_0x10b0cc){return db[_0xb84a('0x3f')]['create'](_0x385986['body'],{})['then'](respondWithResult(_0x10b0cc,0xc9))[_0xb84a('0x45')](handleError(_0x10b0cc,null));};exports[_0xb84a('0x21')]=function(_0x38f329,_0x4476bc){if(_0x38f329[_0xb84a('0x46')]['id']){delete _0x38f329['body']['id'];}delete _0x38f329['body']['duration'];delete _0x38f329['body'][_0xb84a('0x47')];delete _0x38f329[_0xb84a('0x46')]['closedAt'];delete _0x38f329[_0xb84a('0x46')][_0xb84a('0x48')];return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x38f329[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](handleEntityNotFound(_0x4476bc,null))['then'](saveUpdates(_0x38f329['body'],null))[_0xb84a('0x22')](respondWithResult(_0x4476bc,null))['catch'](handleError(_0x4476bc,null));};exports[_0xb84a('0x49')]=function(_0x4d1a29,_0x575908){return db['ScreenRecording'][_0xb84a('0x49')]()[_0xb84a('0x22')](respondWithResult(_0x575908,null))[_0xb84a('0x45')](handleError(_0x575908,null));};exports[_0xb84a('0x4a')]=function(_0x33adfc,_0x46f7eb,_0x37ca26){var _0x29ff35=require('../../components/encryptor');var _0x5afdd0=![];var _0x4c5bdf={};if(_0x33adfc[_0xb84a('0x2f')][_0xb84a('0x29')]&&_0x33adfc['query'][_0xb84a('0x29')]==='uniqueid'){_0x4c5bdf['uniqueid']=_0x33adfc['params']['id'];}else{_0x4c5bdf['id']=_0x33adfc[_0xb84a('0x41')]['id'];}return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':_0x4c5bdf,'attributes':['id','value'],'raw':!![]})[_0xb84a('0x22')](handleEntityNotFound(_0x46f7eb,null))[_0xb84a('0x22')](function(_0x136d61){if(_0x136d61){var _0x505994=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x136d61[_0xb84a('0x48')]);var _0x47a8a2=util[_0xb84a('0x2e')]('%s.cypher',_0x505994);if(fs[_0xb84a('0x4c')](_0x47a8a2)){_0x5afdd0=!![];return _0x29ff35[_0xb84a('0x4d')](_0x47a8a2,_0x505994,config[_0xb84a('0x4e')][_0xb84a('0x4f')])['then'](function(){return _0x136d61;});}return _0x136d61;}})['then'](function(_0x4fc998){if(_0x4fc998){var _0x40b392=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x4fc998[_0xb84a('0x48')]);if(!fs[_0xb84a('0x4c')](_0x40b392)){throw new db[(_0xb84a('0x50'))]['ValidationError'](_0xb84a('0x51'));}if(_0x4fc998[_0xb84a('0x52')]){return _0x46f7eb['download'](_0x40b392,_0x4fc998[_0xb84a('0x52')]+path[_0xb84a('0x53')](_0x40b392),function(){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}else{return _0x46f7eb[_0xb84a('0x4a')](_0x40b392,function(_0x3bbc69){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}}})[_0xb84a('0x45')](function(_0x47c27f){if(_0x47c27f[_0xb84a('0x55')]===_0xb84a('0x51')){_0x46f7eb['status'](0x194)[_0xb84a('0x27')](_0xb84a('0x56'));}else{return handleError(_0x46f7eb,null);}});};exports[_0xb84a('0x23')]=function(_0x3e16d8,_0x347998){return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x3e16d8[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](function(_0x5dd660){if(_[_0xb84a('0x57')](_0x5dd660)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dd660;})['then'](function(_0x19d635){var _0x5e11c8=path[_0xb84a('0x4b')](config['root'],_0xb84a('0x58'),_0x19d635[_0xb84a('0x48')]);logger['info'](_0xb84a('0x59'),_0x5e11c8);if(!_[_0xb84a('0x57')](_0x19d635[_0xb84a('0x48')])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}_0x5e11c8=_0x5e11c8+_0xb84a('0x5d');if(!_['isNil'](_0x19d635['value'])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}return _0x19d635;})['then'](function(_0x43031f){if(!_0x43031f)throw new InternalError();return _0x43031f[_0xb84a('0x23')]();})[_0xb84a('0x22')](function(){_0x347998[_0xb84a('0x17')](0xcc)['end']();})[_0xb84a('0x45')](handleError(_0x347998,null));}; \ No newline at end of file +var _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x298064,_0x1d2bfb){var _0x2512ea=function(_0x3e5b28){while(--_0x3e5b28){_0x298064['push'](_0x298064['shift']());}};_0x2512ea(++_0x1d2bfb);}(_0xac31,0xca));var _0x1ac3=function(_0x28c130,_0x5606e6){_0x28c130=_0x28c130-0x0;var _0x55825f=_0xac31[_0x28c130];return _0x55825f;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ebde195..e3013eb 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 _0x4661=['ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4661,0xc3));var _0x1466=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4661[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1466('0x0'));var util=require(_0x1466('0x1'));var logger=require(_0x1466('0x2'))(_0x1466('0x3'));var moment=require(_0x1466('0x4'));var BPromise=require(_0x1466('0x5'));var rp=require(_0x1466('0x6'));var fs=require('fs');var path=require(_0x1466('0x7'));var rimraf=require(_0x1466('0x8'));var config=require(_0x1466('0x9'));var attributes=require(_0x1466('0xa'));module[_0x1466('0xb')]=function(_0x2571a6,_0x3180fd){return _0x2571a6[_0x1466('0xc')](_0x1466('0xd'),attributes,{'tableName':_0x1466('0xe'),'paranoid':![],'indexes':[{'name':_0x1466('0xf'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc531=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ScreenRecording'];(function(_0xcf22a8,_0x35d51c){var _0x1137eb=function(_0x22bdf6){while(--_0x22bdf6){_0xcf22a8['push'](_0xcf22a8['shift']());}};_0x1137eb(++_0x35d51c);}(_0xc531,0x154));var _0x1c53=function(_0xe02632,_0x2fd2fc){_0xe02632=_0xe02632-0x0;var _0xa35e72=_0xc531[_0xe02632];return _0xa35e72;};'use strict';var _=require(_0x1c53('0x0'));var util=require(_0x1c53('0x1'));var logger=require(_0x1c53('0x2'))(_0x1c53('0x3'));var moment=require(_0x1c53('0x4'));var BPromise=require(_0x1c53('0x5'));var rp=require(_0x1c53('0x6'));var fs=require('fs');var path=require(_0x1c53('0x7'));var rimraf=require('rimraf');var config=require(_0x1c53('0x8'));var attributes=require('./screenRecording.attributes');module[_0x1c53('0x9')]=function(_0x46a4c2,_0x2382c2){return _0x46a4c2['define'](_0x1c53('0xa'),attributes,{'tableName':_0x1c53('0xb'),'paranoid':![],'indexes':[{'name':_0x1c53('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b35618e..1a8da7f 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 _0x8640=['request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x8640,0x105));var _0x0864=function(_0x3b1203,_0x1b5e03){_0x3b1203=_0x3b1203-0x0;var _0x1d95a0=_0x8640[_0x3b1203];return _0x1d95a0;};'use strict';var _=require('lodash');var util=require(_0x0864('0x0'));var moment=require('moment');var BPromise=require(_0x0864('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0864('0x2'))['db'];var utils=require(_0x0864('0x3'));var logger=require(_0x0864('0x4'))(_0x0864('0x5'));var config=require('../../config/environment');var jayson=require(_0x0864('0x6'));var client=jayson[_0x0864('0x7')][_0x0864('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ed05b,_0x17b5f7,_0x30af19){return new BPromise(function(_0x266011,_0x2b65bc){return client['request'](_0x5ed05b,_0x30af19)[_0x0864('0x9')](function(_0x2904a6){logger[_0x0864('0xa')](_0x0864('0xb'),_0x17b5f7,_0x0864('0xc'));logger[_0x0864('0xd')](_0x0864('0xe'),_0x17b5f7,_0x0864('0xc'),JSON[_0x0864('0xf')](_0x2904a6));if(_0x2904a6['error']){if(_0x2904a6[_0x0864('0x10')][_0x0864('0x11')]===0x1f4){logger[_0x0864('0x10')](_0x0864('0xb'),_0x17b5f7,_0x2904a6[_0x0864('0x10')][_0x0864('0x12')]);return _0x2b65bc(_0x2904a6[_0x0864('0x10')][_0x0864('0x12')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x17b5f7,_0x2904a6[_0x0864('0x10')]['message']);return _0x266011(_0x2904a6[_0x0864('0x10')][_0x0864('0x12')]);}else{logger[_0x0864('0xa')](_0x0864('0xb'),_0x17b5f7,_0x0864('0xc'));_0x266011(_0x2904a6[_0x0864('0x13')]['message']);}})[_0x0864('0x14')](function(_0x1f1277){logger[_0x0864('0x10')](_0x0864('0xb'),_0x17b5f7,_0x1f1277);_0x2b65bc(_0x1f1277);});});} \ No newline at end of file +var _0x8925=['then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x210326,_0x5dd882){var _0x5511c5=function(_0x1b3fdd){while(--_0x1b3fdd){_0x210326['push'](_0x210326['shift']());}};_0x5511c5(++_0x5dd882);}(_0x8925,0x145));var _0x5892=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x8925[_0x3b2369];return _0x5a1367;};'use strict';var _=require(_0x5892('0x0'));var util=require(_0x5892('0x1'));var moment=require(_0x5892('0x2'));var BPromise=require(_0x5892('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5892('0x4'));var db=require(_0x5892('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5892('0x6'))(_0x5892('0x7'));var config=require('../../config/environment');var jayson=require(_0x5892('0x8'));var client=jayson[_0x5892('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2152e7,_0x9bf6bd,_0x50859e){return new BPromise(function(_0x40ed0e,_0x1d3862){return client[_0x5892('0xa')](_0x2152e7,_0x50859e)[_0x5892('0xb')](function(_0x2728aa){logger[_0x5892('0xc')](_0x5892('0xd'),_0x9bf6bd,_0x5892('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x9bf6bd,_0x5892('0xe'),JSON[_0x5892('0xf')](_0x2728aa));if(_0x2728aa[_0x5892('0x10')]){if(_0x2728aa['error'][_0x5892('0x11')]===0x1f4){logger[_0x5892('0x10')](_0x5892('0xd'),_0x9bf6bd,_0x2728aa[_0x5892('0x10')][_0x5892('0x12')]);return _0x1d3862(_0x2728aa[_0x5892('0x10')][_0x5892('0x12')]);}logger[_0x5892('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x9bf6bd,_0x2728aa['error']['message']);return _0x40ed0e(_0x2728aa[_0x5892('0x10')][_0x5892('0x12')]);}else{logger['info'](_0x5892('0xd'),_0x9bf6bd,_0x5892('0xe'));_0x40ed0e(_0x2728aa[_0x5892('0x13')][_0x5892('0x12')]);}})[_0x5892('0x14')](function(_0x473462){logger[_0x5892('0x10')](_0x5892('0xd'),_0x9bf6bd,_0x473462);_0x1d3862(_0x473462);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6ab0b0a..c490375 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 _0x2bf7=['getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','logologin','preferred','originalname','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bf7,0x147));var _0x72bf=function(_0x3819b7,_0xfcae12){_0x3819b7=_0x3819b7-0x0;var _0x4c4fcc=_0x2bf7[_0x3819b7];return _0x4c4fcc;};'use strict';var multer=require(_0x72bf('0x0'));var util=require(_0x72bf('0x1'));var path=require('path');var timeout=require(_0x72bf('0x2'));var express=require(_0x72bf('0x3'));var router=express[_0x72bf('0x4')]();var fs_extra=require(_0x72bf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72bf('0x6'));var config=require(_0x72bf('0x7'));var controller=require('./setting.controller');router[_0x72bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x72bf('0x9')]);router[_0x72bf('0x8')](_0x72bf('0xa'),controller[_0x72bf('0xb')]);router[_0x72bf('0x8')](_0x72bf('0xc'),controller[_0x72bf('0xd')]);router[_0x72bf('0x8')](_0x72bf('0xe'),controller[_0x72bf('0xf')]);router[_0x72bf('0x8')](_0x72bf('0x10'),controller[_0x72bf('0x11')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0x72bf('0x8')](_0x72bf('0x12'),controller[_0x72bf('0x13')]);router[_0x72bf('0x8')](_0x72bf('0x14'),controller[_0x72bf('0x15')]);var upload=multer({'storage':multer[_0x72bf('0x16')]({'destination':function(_0x18bb89,_0x2eb04c,_0x3442b3){_0x3442b3(null,path[_0x72bf('0x17')](config[_0x72bf('0x18')],_0x72bf('0x19')));},'filename':function(_0x57b6c2,_0x182c44,_0x3d3765){_0x3d3765(null,util[_0x72bf('0x1a')](_0x72bf('0x1b'),_0x72bf('0x1c'),path[_0x72bf('0x1d')](_0x182c44['originalname'])));}})});router[_0x72bf('0x1e')](_0x72bf('0xe'),upload[_0x72bf('0x1f')](_0x72bf('0x20')),controller[_0x72bf('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f3f47,_0x2adcf9,_0x523901){_0x523901(null,path[_0x72bf('0x17')](config[_0x72bf('0x18')],_0x72bf('0x19')));},'filename':function(_0x321128,_0x202295,_0x4445c2){_0x4445c2(null,util[_0x72bf('0x1a')]('%s%s',_0x72bf('0x22'),path[_0x72bf('0x1d')](_0x202295['originalname'])));}})});router[_0x72bf('0x1e')](_0x72bf('0x10'),upload['single'](_0x72bf('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x72bf('0x16')]({'destination':function(_0x9b903f,_0x377493,_0x3121b3){_0x3121b3(null,path['join'](config[_0x72bf('0x18')],_0x72bf('0x19')));},'filename':function(_0x411c45,_0x509b60,_0x155291){_0x155291(null,util[_0x72bf('0x1a')](_0x72bf('0x1b'),_0x72bf('0x23'),path[_0x72bf('0x1d')](_0x509b60[_0x72bf('0x24')])));}})});router[_0x72bf('0x1e')](_0x72bf('0x12'),upload[_0x72bf('0x1f')]('file'),controller[_0x72bf('0x25')]);var upload=multer({'storage':multer[_0x72bf('0x16')]({'destination':function(_0x1319db,_0xa4be78,_0x47c728){_0x47c728(null,path[_0x72bf('0x17')](config[_0x72bf('0x18')],_0x72bf('0x19')));},'filename':function(_0x54c96a,_0x69ec73,_0x4bc77c){_0x4bc77c(null,util[_0x72bf('0x1a')]('%s%s',_0x72bf('0x26'),path['extname'](_0x69ec73[_0x72bf('0x24')])));}})});router[_0x72bf('0x1e')](_0x72bf('0x14'),upload['single']('file'),controller[_0x72bf('0x27')]);router[_0x72bf('0x28')](_0x72bf('0xc'),auth['isAuthenticated'](),controller[_0x72bf('0x29')]);module[_0x72bf('0x2a')]=router; \ No newline at end of file +var _0x524d=['logologin','extname','post','addLogoLogin','/:id/preferred','favicon','addFavicon','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','originalname','/:id/logo','single','file','addLogo','root'];(function(_0x330d1f,_0x47c710){var _0x1df784=function(_0x3ec796){while(--_0x3ec796){_0x330d1f['push'](_0x330d1f['shift']());}};_0x1df784(++_0x47c710);}(_0x524d,0x105));var _0xd524=function(_0x446e41,_0x58d96b){_0x446e41=_0x446e41-0x0;var _0xf01d64=_0x524d[_0x446e41];return _0xf01d64;};'use strict';var multer=require(_0xd524('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd524('0x1'));var express=require(_0xd524('0x2'));var router=express[_0xd524('0x3')]();var fs_extra=require(_0xd524('0x4'));var auth=require(_0xd524('0x5'));var interaction=require(_0xd524('0x6'));var config=require(_0xd524('0x7'));var controller=require('./setting.controller');router['get']('/',auth[_0xd524('0x8')](),controller[_0xd524('0x9')]);router[_0xd524('0xa')](_0xd524('0xb'),controller['getDate']);router['get'](_0xd524('0xc'),controller[_0xd524('0xd')]);router[_0xd524('0xa')]('/:id/logo',controller[_0xd524('0xe')]);router[_0xd524('0xa')](_0xd524('0xf'),controller[_0xd524('0x10')]);router[_0xd524('0xa')](_0xd524('0x11'),controller['gdpr']);router[_0xd524('0xa')]('/:id/preferred',controller[_0xd524('0x12')]);router[_0xd524('0xa')](_0xd524('0x13'),controller[_0xd524('0x14')]);var upload=multer({'storage':multer[_0xd524('0x15')]({'destination':function(_0x1e7036,_0x2ba704,_0x3d1c7e){_0x3d1c7e(null,path[_0xd524('0x16')](config['root'],_0xd524('0x17')));},'filename':function(_0x39f944,_0x43e0d1,_0xde5659){_0xde5659(null,util[_0xd524('0x18')](_0xd524('0x19'),_0xd524('0x1a'),path['extname'](_0x43e0d1[_0xd524('0x1b')])));}})});router['post'](_0xd524('0x1c'),upload[_0xd524('0x1d')](_0xd524('0x1e')),controller[_0xd524('0x1f')]);var upload=multer({'storage':multer[_0xd524('0x15')]({'destination':function(_0x1ddcc2,_0x3f9563,_0x4ca8f1){_0x4ca8f1(null,path[_0xd524('0x16')](config[_0xd524('0x20')],'server/files/images/logos/'));},'filename':function(_0x150561,_0x471287,_0x54b1e4){_0x54b1e4(null,util[_0xd524('0x18')]('%s%s',_0xd524('0x21'),path[_0xd524('0x22')](_0x471287[_0xd524('0x1b')])));}})});router[_0xd524('0x23')](_0xd524('0xf'),upload[_0xd524('0x1d')]('file'),controller[_0xd524('0x24')]);var upload=multer({'storage':multer[_0xd524('0x15')]({'destination':function(_0x2b4fdf,_0x40ec02,_0x37bf8c){_0x37bf8c(null,path[_0xd524('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x286aa8,_0xd6c62d,_0x5a05b0){_0x5a05b0(null,util[_0xd524('0x18')](_0xd524('0x19'),'preferred',path[_0xd524('0x22')](_0xd6c62d[_0xd524('0x1b')])));}})});router[_0xd524('0x23')](_0xd524('0x25'),upload['single'](_0xd524('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0xd524('0x15')]({'destination':function(_0x2d113f,_0x3e37a4,_0x41c868){_0x41c868(null,path[_0xd524('0x16')](config[_0xd524('0x20')],_0xd524('0x17')));},'filename':function(_0x3f24aa,_0x340978,_0x2bd0f3){_0x2bd0f3(null,util[_0xd524('0x18')](_0xd524('0x19'),_0xd524('0x26'),path[_0xd524('0x22')](_0x340978[_0xd524('0x1b')])));}})});router[_0xd524('0x23')](_0xd524('0x13'),upload['single'](_0xd524('0x1e')),controller[_0xd524('0x27')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd524('0x28')]);module[_0xd524('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5a23098..3d1fd57 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x37c41f,_0x142ff3){var _0x47703e=function(_0x40c6ca){while(--_0x40c6ca){_0x37c41f['push'](_0x37c41f['shift']());}};_0x47703e(++_0x142ff3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3c7bbd,_0x487548){var _0xed4182=function(_0x5bac79){while(--_0x5bac79){_0x3c7bbd['push'](_0x3c7bbd['shift']());}};_0xed4182(++_0x487548);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6dc37f2..c559405 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 _0x5482=['getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','Setting','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','show','include','find','body','params','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','defaultFavicon','default_loginLogo.svg','upperFirst','gdpr','addPreferred'];(function(_0x52ece1,_0x425dc5){var _0x329205=function(_0xf76c47){while(--_0xf76c47){_0x52ece1['push'](_0x52ece1['shift']());}};_0x329205(++_0x425dc5);}(_0x5482,0xf8));var _0x2548=function(_0x28acd7,_0x2d7d6a){_0x28acd7=_0x28acd7-0x0;var _0x4fcc45=_0x5482[_0x28acd7];return _0x4fcc45;};'use strict';var emlformat=require(_0x2548('0x0'));var rimraf=require(_0x2548('0x1'));var zipdir=require(_0x2548('0x2'));var jsonpatch=require(_0x2548('0x3'));var rp=require(_0x2548('0x4'));var moment=require('moment');var BPromise=require(_0x2548('0x5'));var Mustache=require(_0x2548('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2548('0x7'));var ejs=require(_0x2548('0x8'));var fs=require('fs');var fs_extra=require(_0x2548('0x9'));var _=require(_0x2548('0xa'));var squel=require('squel');var crypto=require(_0x2548('0xb'));var jsforce=require(_0x2548('0xc'));var deskjs=require(_0x2548('0xd'));var toCsv=require(_0x2548('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2548('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2548('0xf'));var hardwareService=require(_0x2548('0x10'));var logger=require(_0x2548('0x11'))(_0x2548('0x12'));var utils=require(_0x2548('0x13'));var config=require(_0x2548('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2548('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2548('0x16')][_0x2548('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x51996b,_0x5c429a,_0x37d229,_0x316c81){return new BPromise(function(_0x2fe83c,_0x1b21a4){var _0x239d60=_0x316c81||client;return _0x239d60[_0x2548('0x18')](_0x51996b,_0x37d229)[_0x2548('0x19')](function(_0x5381f0){logger[_0x2548('0x1a')](_0x2548('0x1b'),_0x5c429a,'request\x20sent');logger[_0x2548('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x5c429a,'request\x20sent',JSON[_0x2548('0x1d')](_0x5381f0));if(_0x5381f0[_0x2548('0x1e')]){if(_0x5381f0[_0x2548('0x1e')][_0x2548('0x1f')]===0x1f4){logger[_0x2548('0x1e')](_0x2548('0x1b'),_0x5c429a,_0x5381f0[_0x2548('0x1e')][_0x2548('0x20')]);return _0x1b21a4(_0x5381f0['error'][_0x2548('0x20')]);}logger[_0x2548('0x1e')](_0x2548('0x1b'),_0x5c429a,_0x5381f0[_0x2548('0x1e')][_0x2548('0x20')]);return _0x2fe83c(_0x5381f0[_0x2548('0x1e')][_0x2548('0x20')]);}else{logger[_0x2548('0x1a')](_0x2548('0x1b'),_0x5c429a,_0x2548('0x21'));_0x2fe83c(_0x5381f0[_0x2548('0x22')][_0x2548('0x20')]);}})[_0x2548('0x23')](function(_0x5b5d20){logger[_0x2548('0x1e')](_0x2548('0x1b'),_0x5c429a,_0x5b5d20);_0x1b21a4(_0x5b5d20);});});}function respondWithStatusCode(_0x1bdf4e,_0x1bc2bf){_0x1bc2bf=_0x1bc2bf||0xcc;return function(_0x45a80c){if(_0x45a80c){return _0x1bdf4e['sendStatus'](_0x1bc2bf);}return _0x1bdf4e['status'](_0x1bc2bf)[_0x2548('0x24')]();};}function respondWithResult(_0x3f870c,_0x3482bb){_0x3482bb=_0x3482bb||0xc8;return function(_0x4faff9){if(_0x4faff9){return _0x3f870c['status'](_0x3482bb)[_0x2548('0x25')](_0x4faff9);}};}function respondWithFilteredResult(_0x5418f0,_0x377008){return function(_0x475cbc){if(_0x475cbc){var _0x25ff8d=typeof _0x377008['offset']===_0x2548('0x26')&&typeof _0x377008[_0x2548('0x27')]===_0x2548('0x26');var _0xdd300a=_0x475cbc[_0x2548('0x28')];var _0x5c1dc5=_0x25ff8d?0x0:_0x377008[_0x2548('0x29')];var _0x38c9d1=_0x25ff8d?_0x475cbc[_0x2548('0x28')]:_0x377008[_0x2548('0x29')]+_0x377008[_0x2548('0x27')];var _0x47ee02;if(_0x38c9d1>=_0xdd300a){_0x38c9d1=_0xdd300a;_0x47ee02=0xc8;}else{_0x47ee02=0xce;}_0x5418f0[_0x2548('0x2a')](_0x47ee02);return _0x5418f0[_0x2548('0x2b')](_0x2548('0x2c'),_0x5c1dc5+'-'+_0x38c9d1+'/'+_0xdd300a)[_0x2548('0x25')](_0x475cbc);}return null;};}function patchUpdates(_0x5524a7){return function(_0x3831a4){try{jsonpatch['apply'](_0x3831a4,_0x5524a7,!![]);}catch(_0xb91be1){return BPromise[_0x2548('0x2d')](_0xb91be1);}return _0x3831a4[_0x2548('0x2e')]();};}function saveUpdates(_0x1be5fd,_0x895db3){return function(_0x340ef7){if(_0x340ef7){return _0x340ef7[_0x2548('0x2f')](_0x1be5fd)['then'](function(_0x2060f2){return _0x2060f2;});}return null;};}function removeEntity(_0x42d37a,_0x1cf709){return function(_0x24cd57){if(_0x24cd57){return _0x24cd57[_0x2548('0x30')]()['then'](function(){_0x42d37a['status'](0xcc)[_0x2548('0x24')]();});}};}function handleEntityNotFound(_0x442630,_0x50f9de){return function(_0xa65842){if(!_0xa65842){_0x442630[_0x2548('0x31')](0x194);}return _0xa65842;};}function handleError(_0x23b500,_0x589fce){_0x589fce=_0x589fce||0x1f4;return function(_0x5484f8){logger['error'](_0x5484f8[_0x2548('0x32')]);if(_0x5484f8['name']){delete _0x5484f8[_0x2548('0x33')];}_0x23b500['status'](_0x589fce)[_0x2548('0x34')](_0x5484f8);};}exports[_0x2548('0x35')]=function(_0x2927b2,_0x3b0462){var _0x5672ee={},_0x40da2a={},_0x598383={'count':0x0,'rows':[]};var _0x232bf5=_['map'](db[_0x2548('0x36')]['rawAttributes'],function(_0x28ce09){return{'name':_0x28ce09[_0x2548('0x37')],'type':_0x28ce09[_0x2548('0x38')][_0x2548('0x39')]};});_0x40da2a['model']=_[_0x2548('0x3a')](_0x232bf5,_0x2548('0x33'));_0x40da2a['query']=_[_0x2548('0x3b')](_0x2927b2[_0x2548('0x3c')]);_0x40da2a[_0x2548('0x3d')]=_[_0x2548('0x3e')](_0x40da2a['model'],_0x40da2a[_0x2548('0x3c')]);_0x5672ee[_0x2548('0x3f')]=_[_0x2548('0x3e')](_0x40da2a[_0x2548('0x40')],qs[_0x2548('0x41')](_0x2927b2[_0x2548('0x3c')][_0x2548('0x41')]));_0x5672ee['attributes']=_0x5672ee[_0x2548('0x3f')][_0x2548('0x42')]?_0x5672ee[_0x2548('0x3f')]:_0x40da2a[_0x2548('0x40')];if(!_0x2927b2['query'][_0x2548('0x43')](_0x2548('0x44'))){_0x5672ee['limit']=qs[_0x2548('0x27')](_0x2927b2[_0x2548('0x3c')]['limit']);_0x5672ee[_0x2548('0x29')]=qs[_0x2548('0x29')](_0x2927b2[_0x2548('0x3c')][_0x2548('0x29')]);}_0x5672ee[_0x2548('0x45')]=qs['sort'](_0x2927b2[_0x2548('0x3c')][_0x2548('0x46')]);_0x5672ee[_0x2548('0x47')]=qs[_0x2548('0x3d')](_[_0x2548('0x48')](_0x2927b2[_0x2548('0x3c')],_0x40da2a['filters']),_0x232bf5);if(_0x2927b2[_0x2548('0x3c')][_0x2548('0x49')]){_0x5672ee['where']=_[_0x2548('0x4a')](_0x5672ee[_0x2548('0x47')],{'$or':_[_0x2548('0x3a')](_0x232bf5,function(_0x34148f){if(_0x34148f[_0x2548('0x38')]!=='VIRTUAL'){var _0x98f5ca={};_0x98f5ca[_0x34148f['name']]={'$like':'%'+_0x2927b2['query'][_0x2548('0x49')]+'%'};return _0x98f5ca;}})});}_0x5672ee=_[_0x2548('0x4a')]({},_0x5672ee,_0x2927b2[_0x2548('0x4b')]);var _0x3029d9={'where':_0x5672ee[_0x2548('0x47')]};return db['Setting'][_0x2548('0x28')](_0x3029d9)['then'](function(_0x28e704){_0x598383['count']=_0x28e704;if(_0x2927b2[_0x2548('0x3c')][_0x2548('0x4c')]){_0x5672ee['include']=[{'all':!![]}];}return db[_0x2548('0x36')]['findAll'](_0x5672ee);})[_0x2548('0x19')](function(_0x155f10){_0x598383['rows']=_0x155f10;return _0x598383;})['then'](respondWithFilteredResult(_0x3b0462,_0x5672ee))[_0x2548('0x23')](handleError(_0x3b0462,null));};exports[_0x2548('0x4d')]=function(_0x342e9e,_0x102625){var _0x367e4f={'raw':![],'where':{'id':_0x342e9e['params']['id']}},_0x664d40={};_0x664d40[_0x2548('0x40')]=_[_0x2548('0x3b')](db[_0x2548('0x36')]['rawAttributes']);_0x664d40[_0x2548('0x3c')]=_[_0x2548('0x3b')](_0x342e9e['query']);_0x664d40[_0x2548('0x3d')]=_['intersection'](_0x664d40[_0x2548('0x40')],_0x664d40[_0x2548('0x3c')]);_0x367e4f[_0x2548('0x3f')]=_['intersection'](_0x664d40['model'],qs[_0x2548('0x41')](_0x342e9e[_0x2548('0x3c')][_0x2548('0x41')]));_0x367e4f['attributes']=_0x367e4f[_0x2548('0x3f')]['length']?_0x367e4f[_0x2548('0x3f')]:_0x664d40[_0x2548('0x40')];if(_0x342e9e[_0x2548('0x3c')][_0x2548('0x4c')]){_0x367e4f[_0x2548('0x4e')]=[{'all':!![]}];}_0x367e4f=_[_0x2548('0x4a')]({},_0x367e4f,_0x342e9e[_0x2548('0x4b')]);return db['Setting'][_0x2548('0x4f')](_0x367e4f)[_0x2548('0x19')](handleEntityNotFound(_0x102625,null))[_0x2548('0x19')](respondWithResult(_0x102625,null))['catch'](handleError(_0x102625,null));};exports[_0x2548('0x2f')]=function(_0x12846d,_0x3ff265){if(_0x12846d[_0x2548('0x50')]['id']){delete _0x12846d[_0x2548('0x50')]['id'];}return db['Setting'][_0x2548('0x4f')]({'where':{'id':_0x12846d[_0x2548('0x51')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x3ff265,null))[_0x2548('0x19')](saveUpdates(_0x12846d['body'],null))['then'](respondWithResult(_0x3ff265,null))[_0x2548('0x23')](handleError(_0x3ff265,null));};exports['addLogo']=function(_0x1bde40,_0x489443,_0x552d8b){if(_0x1bde40[_0x2548('0x52')]&&_0x1bde40[_0x2548('0x52')][_0x2548('0x53')]){_0x1bde40['body'][_0x2548('0x54')]=_0x1bde40['file'][_0x2548('0x53')];}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x1bde40[_0x2548('0x51')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x489443,null))[_0x2548('0x19')](saveUpdates(_0x1bde40[_0x2548('0x50')],null))[_0x2548('0x19')](respondWithResult(_0x489443,null))[_0x2548('0x23')](handleError(_0x489443,null));};exports['addLogoLogin']=function(_0x427e2c,_0x38c3fb,_0x1e039c){if(_0x427e2c['file']&&_0x427e2c[_0x2548('0x52')][_0x2548('0x53')]){_0x427e2c[_0x2548('0x50')][_0x2548('0x55')]=_0x427e2c[_0x2548('0x52')][_0x2548('0x53')];}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x427e2c[_0x2548('0x51')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x38c3fb,null))[_0x2548('0x19')](saveUpdates(_0x427e2c['body'],null))[_0x2548('0x19')](respondWithResult(_0x38c3fb,null))[_0x2548('0x23')](handleError(_0x38c3fb,null));};var utilLicense=require(_0x2548('0x56'));exports[_0x2548('0x57')]=function(_0x1d6122,_0x5c2707,_0x3316cb){var _0x53a582=_0x2548('0x58');var _0x3540d9={'custom':![]};return utilLicense[_0x2548('0x59')]()['then'](function(_0x490b16){if(_0x490b16){_0x3540d9=_0x490b16;}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x1d6122[_0x2548('0x51')]['id']},'attributes':['logo',_0x2548('0x55'),_0x2548('0x5a'),_0x2548('0x5b'),_0x2548('0x5c'),_0x2548('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x2548('0x19')](handleEntityNotFound(_0x5c2707,null))[_0x2548('0x19')](function(_0x15a3b5){if(_0x15a3b5){var _0x5758c7=_0x15a3b5[_0x2548('0x54')]&&fs[_0x2548('0x5e')](path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x53a582,_['toLower'](_0x15a3b5[_0x2548('0x54')])))?path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x53a582,_['toLower'](_0x15a3b5[_0x2548('0x54')])):path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x53a582,_[_0x2548('0x61')]('default_logo.svg'));var _0x308987=_0x2548('0x62')+_['upperFirst'](_0x2548('0x54'));if(_0x15a3b5[_0x308987]||!_0x3540d9[_0x2548('0x63')]){_0x5758c7=path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x53a582,_[_0x2548('0x61')](_0x2548('0x64')));}if(!fs[_0x2548('0x5e')](_0x5758c7)){throw new db[(_0x2548('0x65'))][(_0x2548('0x66'))](_['upperFirst'](_0x2548('0x54'))+_0x2548('0x67'));}return _0x5c2707[_0x2548('0x68')](_0x5758c7);}})[_0x2548('0x23')](handleError(_0x5c2707,null));};var utilLicense=require(_0x2548('0x56'));exports[_0x2548('0x69')]=function(_0x360eb5,_0x55b32f,_0x41bc26){var _0x47cf1e=_0x2548('0x58');var _0x38af72={'custom':![]};return utilLicense[_0x2548('0x59')]()[_0x2548('0x19')](function(_0x1ea790){if(_0x1ea790){_0x38af72=_0x1ea790;}return db[_0x2548('0x36')]['find']({'where':{'id':_0x360eb5[_0x2548('0x51')]['id']},'attributes':[_0x2548('0x54'),_0x2548('0x55'),_0x2548('0x5a'),'favicon','defaultLogo',_0x2548('0x5d'),_0x2548('0x6a'),_0x2548('0x6b')],'raw':!![]});})[_0x2548('0x19')](handleEntityNotFound(_0x55b32f,null))[_0x2548('0x19')](function(_0x2a53e5){if(_0x2a53e5){var _0x3d0199=_0x2a53e5[_0x2548('0x55')]&&fs[_0x2548('0x5e')](path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x47cf1e,_[_0x2548('0x61')](_0x2a53e5['loginLogo'])))?path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x47cf1e,_[_0x2548('0x61')](_0x2a53e5[_0x2548('0x55')])):path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x47cf1e,_[_0x2548('0x61')](_0x2548('0x6c')));var _0x48de9a=_0x2548('0x62')+_[_0x2548('0x6d')](_0x2548('0x55'));if(_0x2a53e5[_0x48de9a]||!_0x38af72[_0x2548('0x63')]){_0x3d0199=path['join'](config[_0x2548('0x60')],_0x47cf1e,_[_0x2548('0x61')]('default_loginLogo.svg'));}if(!fs[_0x2548('0x5e')](_0x3d0199)){throw new db['Sequelize'][(_0x2548('0x66'))](_[_0x2548('0x6d')]('loginLogo')+_0x2548('0x67'));}return _0x55b32f['download'](_0x3d0199);}})[_0x2548('0x23')](handleError(_0x55b32f,null));};exports[_0x2548('0x6e')]=function(_0x1b8fe2,_0x3d5081){return db['Setting']['find']({'where':{'id':_0x1b8fe2['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x3d5081,null))[_0x2548('0x23')](handleError(_0x3d5081,null));};exports[_0x2548('0x6f')]=function(_0x2b5b75,_0x4d1273,_0x2d2ce8){if(_0x2b5b75[_0x2548('0x52')]&&_0x2b5b75[_0x2548('0x52')][_0x2548('0x53')]){_0x2b5b75[_0x2548('0x50')]['preferred']=_0x2b5b75[_0x2548('0x52')]['filename'];}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x2b5b75[_0x2548('0x51')]['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x4d1273,null))[_0x2548('0x19')](saveUpdates(_0x2b5b75[_0x2548('0x50')],null))[_0x2548('0x19')](respondWithResult(_0x4d1273,null))['catch'](handleError(_0x4d1273,null));};var utilLicense=require('../../config/license/util');exports[_0x2548('0x70')]=function(_0x458644,_0x45c60b,_0x16f9cd){var _0x1ecf8e=_0x2548('0x58');var _0x20eedc={'custom':![]};return utilLicense[_0x2548('0x59')]()[_0x2548('0x19')](function(_0x113acc){if(_0x113acc){_0x20eedc=_0x113acc;}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x458644['params']['id']},'attributes':['logo',_0x2548('0x55'),_0x2548('0x5a'),'favicon','defaultLogo',_0x2548('0x5d'),_0x2548('0x6a'),_0x2548('0x6b')],'raw':!![]});})[_0x2548('0x19')](handleEntityNotFound(_0x45c60b,null))[_0x2548('0x19')](function(_0x51192e){if(_0x51192e){var _0x10c180=_0x51192e[_0x2548('0x5a')]&&fs[_0x2548('0x5e')](path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x1ecf8e,_[_0x2548('0x61')](_0x51192e[_0x2548('0x5a')])))?path[_0x2548('0x5f')](config['root'],_0x1ecf8e,_[_0x2548('0x61')](_0x51192e[_0x2548('0x5a')])):path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x1ecf8e,_[_0x2548('0x61')](_0x2548('0x71')));var _0x2869c2=_0x2548('0x62')+_[_0x2548('0x6d')](_0x2548('0x5a'));if(_0x51192e[_0x2869c2]||!_0x20eedc[_0x2548('0x63')]||!_0x20eedc[_0x2548('0x5a')]){_0x10c180=path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x1ecf8e,_['toLower'](_0x2548('0x71')));}if(!fs[_0x2548('0x5e')](_0x10c180)){throw new db[(_0x2548('0x65'))]['ValidationError'](_['upperFirst'](_0x2548('0x5a'))+_0x2548('0x67'));}return _0x45c60b['download'](_0x10c180);}})[_0x2548('0x23')](handleError(_0x45c60b,null));};exports[_0x2548('0x72')]=function(_0x3d86fa,_0x44e67d,_0x1ac5cf){if(_0x3d86fa[_0x2548('0x52')]&&_0x3d86fa[_0x2548('0x52')][_0x2548('0x53')]){_0x3d86fa[_0x2548('0x50')][_0x2548('0x5b')]=_0x3d86fa[_0x2548('0x52')][_0x2548('0x53')];}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x3d86fa['params']['id']}})[_0x2548('0x19')](handleEntityNotFound(_0x44e67d,null))[_0x2548('0x19')](saveUpdates(_0x3d86fa[_0x2548('0x50')],null))['then'](respondWithResult(_0x44e67d,null))[_0x2548('0x23')](handleError(_0x44e67d,null));};var utilLicense=require(_0x2548('0x56'));exports[_0x2548('0x73')]=function(_0x29ef55,_0x256544,_0x13ac1d){var _0x8e32b5=_0x2548('0x58');var _0x51afcf={'custom':![]};return utilLicense['getLicense']()[_0x2548('0x19')](function(_0x3f0567){if(_0x3f0567){_0x51afcf=_0x3f0567;}return db[_0x2548('0x36')][_0x2548('0x4f')]({'where':{'id':_0x29ef55[_0x2548('0x51')]['id']},'attributes':['logo',_0x2548('0x55'),'preferred',_0x2548('0x5b'),_0x2548('0x5c'),_0x2548('0x5d'),_0x2548('0x6a'),_0x2548('0x6b')],'raw':!![]});})[_0x2548('0x19')](handleEntityNotFound(_0x256544,null))[_0x2548('0x19')](function(_0x152897){if(_0x152897){var _0x57a0e1=_0x152897[_0x2548('0x5b')]&&fs['existsSync'](path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x8e32b5,_[_0x2548('0x61')](_0x152897[_0x2548('0x5b')])))?path[_0x2548('0x5f')](config[_0x2548('0x60')],_0x8e32b5,_['toLower'](_0x152897[_0x2548('0x5b')])):path[_0x2548('0x5f')](config['root'],_0x8e32b5,_[_0x2548('0x61')](_0x2548('0x74')));var _0x243a69=_0x2548('0x62')+_['upperFirst']('favicon');if(_0x152897[_0x243a69]||!_0x51afcf[_0x2548('0x63')]){_0x57a0e1=path[_0x2548('0x5f')](config['root'],_0x8e32b5,_[_0x2548('0x61')](_0x2548('0x74')));}if(!fs[_0x2548('0x5e')](_0x57a0e1)){throw new db[(_0x2548('0x65'))]['ValidationError'](_[_0x2548('0x6d')]('favicon')+_0x2548('0x67'));}return _0x256544['download'](_0x57a0e1);}})['catch'](handleError(_0x256544,null));};exports['getDate']=function(_0x1bdd43,_0x516b8e){var _0x2620bb={'offset':moment()['utcOffset']()};_0x2620bb['now']=moment()[_0x2548('0x75')](_0x2620bb['offset'])[_0x2548('0x76')](_0x2548('0x77'));return _0x516b8e[_0x2548('0x2a')](0xc8)[_0x2548('0x34')](_0x2620bb);}; \ No newline at end of file +var _0x9349=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','catch','sendStatus','status','offset','undefined','count','set','Content-Range','apply','save','update','end','stack','name','send','index','map','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','options','Setting','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','default','upperFirst','custom','join','default_logo.svg','Sequelize','ValidationError','download','server/files/images/logos','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch'];(function(_0x5f3dff,_0x4e7615){var _0x53a169=function(_0x109f23){while(--_0x109f23){_0x5f3dff['push'](_0x5f3dff['shift']());}};_0x53a169(++_0x4e7615);}(_0x9349,0x16b));var _0x9934=function(_0x5e4c7d,_0x2e5b31){_0x5e4c7d=_0x5e4c7d-0x0;var _0x13aba9=_0x9349[_0x5e4c7d];return _0x13aba9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9934('0x0'));var zipdir=require(_0x9934('0x1'));var jsonpatch=require(_0x9934('0x2'));var rp=require('request-promise');var moment=require(_0x9934('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9934('0x4'));var util=require(_0x9934('0x5'));var path=require(_0x9934('0x6'));var sox=require(_0x9934('0x7'));var csv=require(_0x9934('0x8'));var ejs=require(_0x9934('0x9'));var fs=require('fs');var fs_extra=require(_0x9934('0xa'));var _=require(_0x9934('0xb'));var squel=require('squel');var crypto=require(_0x9934('0xc'));var jsforce=require(_0x9934('0xd'));var deskjs=require(_0x9934('0xe'));var toCsv=require(_0x9934('0x8'));var querystring=require(_0x9934('0xf'));var Papa=require(_0x9934('0x10'));var Redis=require(_0x9934('0x11'));var authService=require(_0x9934('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9934('0x13'));var logger=require(_0x9934('0x14'))(_0x9934('0x15'));var utils=require(_0x9934('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9934('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x9934('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x31e645,_0x2f8ac7,_0x4c566b,_0x1f55df){return new BPromise(function(_0x2feea0,_0x39f76a){var _0x332133=_0x1f55df||client;return _0x332133['request'](_0x31e645,_0x4c566b)[_0x9934('0x19')](function(_0x518578){logger[_0x9934('0x1a')]('Setting,\x20%s,\x20%s',_0x2f8ac7,_0x9934('0x1b'));logger[_0x9934('0x1c')](_0x9934('0x1d'),_0x2f8ac7,_0x9934('0x1b'),JSON[_0x9934('0x1e')](_0x518578));if(_0x518578['error']){if(_0x518578[_0x9934('0x1f')][_0x9934('0x20')]===0x1f4){logger[_0x9934('0x1f')](_0x9934('0x21'),_0x2f8ac7,_0x518578[_0x9934('0x1f')][_0x9934('0x22')]);return _0x39f76a(_0x518578[_0x9934('0x1f')][_0x9934('0x22')]);}logger[_0x9934('0x1f')](_0x9934('0x21'),_0x2f8ac7,_0x518578[_0x9934('0x1f')]['message']);return _0x2feea0(_0x518578['error']['message']);}else{logger[_0x9934('0x1a')](_0x9934('0x21'),_0x2f8ac7,'request\x20sent');_0x2feea0(_0x518578['result'][_0x9934('0x22')]);}})[_0x9934('0x23')](function(_0x35a665){logger[_0x9934('0x1f')](_0x9934('0x21'),_0x2f8ac7,_0x35a665);_0x39f76a(_0x35a665);});});}function respondWithStatusCode(_0x863e26,_0x3dafd7){_0x3dafd7=_0x3dafd7||0xcc;return function(_0x328b12){if(_0x328b12){return _0x863e26[_0x9934('0x24')](_0x3dafd7);}return _0x863e26['status'](_0x3dafd7)['end']();};}function respondWithResult(_0x505396,_0x373dfd){_0x373dfd=_0x373dfd||0xc8;return function(_0x3dfeb0){if(_0x3dfeb0){return _0x505396[_0x9934('0x25')](_0x373dfd)['json'](_0x3dfeb0);}};}function respondWithFilteredResult(_0x51cdd4,_0x55e327){return function(_0xce066a){if(_0xce066a){var _0x36fc4e=typeof _0x55e327[_0x9934('0x26')]==='undefined'&&typeof _0x55e327['limit']===_0x9934('0x27');var _0x1524a2=_0xce066a[_0x9934('0x28')];var _0x405af8=_0x36fc4e?0x0:_0x55e327[_0x9934('0x26')];var _0x4eb7b9=_0x36fc4e?_0xce066a[_0x9934('0x28')]:_0x55e327[_0x9934('0x26')]+_0x55e327['limit'];var _0x1a1204;if(_0x4eb7b9>=_0x1524a2){_0x4eb7b9=_0x1524a2;_0x1a1204=0xc8;}else{_0x1a1204=0xce;}_0x51cdd4[_0x9934('0x25')](_0x1a1204);return _0x51cdd4[_0x9934('0x29')](_0x9934('0x2a'),_0x405af8+'-'+_0x4eb7b9+'/'+_0x1524a2)['json'](_0xce066a);}return null;};}function patchUpdates(_0x2f25d7){return function(_0xb76ae3){try{jsonpatch[_0x9934('0x2b')](_0xb76ae3,_0x2f25d7,!![]);}catch(_0x5803b2){return BPromise['reject'](_0x5803b2);}return _0xb76ae3[_0x9934('0x2c')]();};}function saveUpdates(_0xcde14d,_0x2646bc){return function(_0x57794e){if(_0x57794e){return _0x57794e[_0x9934('0x2d')](_0xcde14d)['then'](function(_0x275377){return _0x275377;});}return null;};}function removeEntity(_0x21170a,_0x4b3529){return function(_0x1df524){if(_0x1df524){return _0x1df524['destroy']()[_0x9934('0x19')](function(){_0x21170a['status'](0xcc)[_0x9934('0x2e')]();});}};}function handleEntityNotFound(_0x1bd51a,_0x5a6743){return function(_0x45ca0b){if(!_0x45ca0b){_0x1bd51a['sendStatus'](0x194);}return _0x45ca0b;};}function handleError(_0x4f7592,_0x23d04d){_0x23d04d=_0x23d04d||0x1f4;return function(_0x4c6955){logger['error'](_0x4c6955[_0x9934('0x2f')]);if(_0x4c6955[_0x9934('0x30')]){delete _0x4c6955[_0x9934('0x30')];}_0x4f7592[_0x9934('0x25')](_0x23d04d)[_0x9934('0x31')](_0x4c6955);};}exports[_0x9934('0x32')]=function(_0x2945ae,_0x3d4825){var _0x13f782={},_0x12b5cf={},_0xe2b7b0={'count':0x0,'rows':[]};var _0x50fcc2=_[_0x9934('0x33')](db['Setting']['rawAttributes'],function(_0x4829c1){return{'name':_0x4829c1[_0x9934('0x34')],'type':_0x4829c1['type'][_0x9934('0x35')]};});_0x12b5cf['model']=_[_0x9934('0x33')](_0x50fcc2,_0x9934('0x30'));_0x12b5cf[_0x9934('0x36')]=_['keys'](_0x2945ae[_0x9934('0x36')]);_0x12b5cf[_0x9934('0x37')]=_[_0x9934('0x38')](_0x12b5cf[_0x9934('0x39')],_0x12b5cf[_0x9934('0x36')]);_0x13f782[_0x9934('0x3a')]=_[_0x9934('0x38')](_0x12b5cf[_0x9934('0x39')],qs[_0x9934('0x3b')](_0x2945ae[_0x9934('0x36')][_0x9934('0x3b')]));_0x13f782[_0x9934('0x3a')]=_0x13f782[_0x9934('0x3a')][_0x9934('0x3c')]?_0x13f782[_0x9934('0x3a')]:_0x12b5cf['model'];if(!_0x2945ae[_0x9934('0x36')][_0x9934('0x3d')](_0x9934('0x3e'))){_0x13f782['limit']=qs[_0x9934('0x3f')](_0x2945ae[_0x9934('0x36')]['limit']);_0x13f782[_0x9934('0x26')]=qs[_0x9934('0x26')](_0x2945ae[_0x9934('0x36')]['offset']);}_0x13f782[_0x9934('0x40')]=qs[_0x9934('0x41')](_0x2945ae['query'][_0x9934('0x41')]);_0x13f782['where']=qs[_0x9934('0x37')](_[_0x9934('0x42')](_0x2945ae[_0x9934('0x36')],_0x12b5cf[_0x9934('0x37')]),_0x50fcc2);if(_0x2945ae[_0x9934('0x36')][_0x9934('0x43')]){_0x13f782[_0x9934('0x44')]=_[_0x9934('0x45')](_0x13f782[_0x9934('0x44')],{'$or':_['map'](_0x50fcc2,function(_0x22328d){if(_0x22328d[_0x9934('0x46')]!=='VIRTUAL'){var _0x257d07={};_0x257d07[_0x22328d[_0x9934('0x30')]]={'$like':'%'+_0x2945ae['query']['filter']+'%'};return _0x257d07;}})});}_0x13f782=_['merge']({},_0x13f782,_0x2945ae[_0x9934('0x47')]);var _0x51e002={'where':_0x13f782['where']};return db[_0x9934('0x48')]['count'](_0x51e002)[_0x9934('0x19')](function(_0x338c5e){_0xe2b7b0[_0x9934('0x28')]=_0x338c5e;if(_0x2945ae[_0x9934('0x36')][_0x9934('0x49')]){_0x13f782[_0x9934('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x9934('0x4b')](_0x13f782);})[_0x9934('0x19')](function(_0x258913){_0xe2b7b0[_0x9934('0x4c')]=_0x258913;return _0xe2b7b0;})[_0x9934('0x19')](respondWithFilteredResult(_0x3d4825,_0x13f782))[_0x9934('0x23')](handleError(_0x3d4825,null));};exports[_0x9934('0x4d')]=function(_0x8848bc,_0x403f98){var _0x41c58c={'raw':![],'where':{'id':_0x8848bc[_0x9934('0x4e')]['id']}},_0x177551={};_0x177551[_0x9934('0x39')]=_[_0x9934('0x4f')](db[_0x9934('0x48')][_0x9934('0x50')]);_0x177551[_0x9934('0x36')]=_[_0x9934('0x4f')](_0x8848bc['query']);_0x177551[_0x9934('0x37')]=_[_0x9934('0x38')](_0x177551['model'],_0x177551[_0x9934('0x36')]);_0x41c58c['attributes']=_[_0x9934('0x38')](_0x177551[_0x9934('0x39')],qs[_0x9934('0x3b')](_0x8848bc[_0x9934('0x36')][_0x9934('0x3b')]));_0x41c58c['attributes']=_0x41c58c[_0x9934('0x3a')][_0x9934('0x3c')]?_0x41c58c['attributes']:_0x177551[_0x9934('0x39')];if(_0x8848bc[_0x9934('0x36')][_0x9934('0x49')]){_0x41c58c['include']=[{'all':!![]}];}_0x41c58c=_[_0x9934('0x45')]({},_0x41c58c,_0x8848bc['options']);return db[_0x9934('0x48')]['find'](_0x41c58c)[_0x9934('0x19')](handleEntityNotFound(_0x403f98,null))[_0x9934('0x19')](respondWithResult(_0x403f98,null))['catch'](handleError(_0x403f98,null));};exports['update']=function(_0x3b2a3c,_0x15320a){if(_0x3b2a3c['body']['id']){delete _0x3b2a3c['body']['id'];}return db[_0x9934('0x48')][_0x9934('0x51')]({'where':{'id':_0x3b2a3c[_0x9934('0x4e')]['id']}})[_0x9934('0x19')](handleEntityNotFound(_0x15320a,null))[_0x9934('0x19')](saveUpdates(_0x3b2a3c[_0x9934('0x52')],null))[_0x9934('0x19')](respondWithResult(_0x15320a,null))[_0x9934('0x23')](handleError(_0x15320a,null));};exports[_0x9934('0x53')]=function(_0x4b7f2c,_0x3d1c93,_0x5d4954){if(_0x4b7f2c[_0x9934('0x54')]&&_0x4b7f2c[_0x9934('0x54')][_0x9934('0x55')]){_0x4b7f2c[_0x9934('0x52')][_0x9934('0x56')]=_0x4b7f2c['file'][_0x9934('0x55')];}return db[_0x9934('0x48')][_0x9934('0x51')]({'where':{'id':_0x4b7f2c['params']['id']}})[_0x9934('0x19')](handleEntityNotFound(_0x3d1c93,null))[_0x9934('0x19')](saveUpdates(_0x4b7f2c[_0x9934('0x52')],null))[_0x9934('0x19')](respondWithResult(_0x3d1c93,null))[_0x9934('0x23')](handleError(_0x3d1c93,null));};exports[_0x9934('0x57')]=function(_0x4f486b,_0x2200bd,_0x1e7a2c){if(_0x4f486b[_0x9934('0x54')]&&_0x4f486b[_0x9934('0x54')][_0x9934('0x55')]){_0x4f486b[_0x9934('0x52')][_0x9934('0x58')]=_0x4f486b[_0x9934('0x54')][_0x9934('0x55')];}return db['Setting'][_0x9934('0x51')]({'where':{'id':_0x4f486b[_0x9934('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2200bd,null))[_0x9934('0x19')](saveUpdates(_0x4f486b[_0x9934('0x52')],null))[_0x9934('0x19')](respondWithResult(_0x2200bd,null))[_0x9934('0x23')](handleError(_0x2200bd,null));};var utilLicense=require(_0x9934('0x17'));exports[_0x9934('0x59')]=function(_0x5bbbfa,_0x31ce79,_0x1ae987){var _0x25698c='server/files/images/logos';var _0x3eb97f={'custom':![]};return utilLicense['getLicense']()[_0x9934('0x19')](function(_0x1e3758){if(_0x1e3758){_0x3eb97f=_0x1e3758;}return db[_0x9934('0x48')]['find']({'where':{'id':_0x5bbbfa['params']['id']},'attributes':[_0x9934('0x56'),_0x9934('0x58'),_0x9934('0x5a'),_0x9934('0x5b'),_0x9934('0x5c'),_0x9934('0x5d'),_0x9934('0x5e'),_0x9934('0x5f')],'raw':!![]});})[_0x9934('0x19')](handleEntityNotFound(_0x31ce79,null))[_0x9934('0x19')](function(_0x14fe32){if(_0x14fe32){var _0x37d56e=_0x14fe32[_0x9934('0x56')]&&fs[_0x9934('0x60')](path['join'](config[_0x9934('0x61')],_0x25698c,_[_0x9934('0x62')](_0x14fe32[_0x9934('0x56')])))?path['join'](config[_0x9934('0x61')],_0x25698c,_[_0x9934('0x62')](_0x14fe32[_0x9934('0x56')])):path['join'](config[_0x9934('0x61')],_0x25698c,_[_0x9934('0x62')]('default_logo.svg'));var _0x393bfa=_0x9934('0x63')+_[_0x9934('0x64')](_0x9934('0x56'));if(_0x14fe32[_0x393bfa]||!_0x3eb97f[_0x9934('0x65')]){_0x37d56e=path[_0x9934('0x66')](config[_0x9934('0x61')],_0x25698c,_[_0x9934('0x62')](_0x9934('0x67')));}if(!fs['existsSync'](_0x37d56e)){throw new db[(_0x9934('0x68'))][(_0x9934('0x69'))](_[_0x9934('0x64')](_0x9934('0x56'))+'\x20not\x20found');}return _0x31ce79[_0x9934('0x6a')](_0x37d56e);}})['catch'](handleError(_0x31ce79,null));};var utilLicense=require(_0x9934('0x17'));exports['getLogoLogin']=function(_0x2c1b1c,_0x2b7721,_0x3e2d7a){var _0xb578cf=_0x9934('0x6b');var _0x35c414={'custom':![]};return utilLicense['getLicense']()[_0x9934('0x19')](function(_0x33775f){if(_0x33775f){_0x35c414=_0x33775f;}return db['Setting'][_0x9934('0x51')]({'where':{'id':_0x2c1b1c[_0x9934('0x4e')]['id']},'attributes':[_0x9934('0x56'),_0x9934('0x58'),_0x9934('0x5a'),_0x9934('0x5b'),_0x9934('0x5c'),_0x9934('0x5d'),_0x9934('0x5e'),_0x9934('0x5f')],'raw':!![]});})[_0x9934('0x19')](handleEntityNotFound(_0x2b7721,null))[_0x9934('0x19')](function(_0x2610dc){if(_0x2610dc){var _0x50396c=_0x2610dc[_0x9934('0x58')]&&fs['existsSync'](path[_0x9934('0x66')](config['root'],_0xb578cf,_[_0x9934('0x62')](_0x2610dc[_0x9934('0x58')])))?path[_0x9934('0x66')](config['root'],_0xb578cf,_[_0x9934('0x62')](_0x2610dc[_0x9934('0x58')])):path[_0x9934('0x66')](config[_0x9934('0x61')],_0xb578cf,_['toLower'](_0x9934('0x6c')));var _0x349747=_0x9934('0x63')+_['upperFirst'](_0x9934('0x58'));if(_0x2610dc[_0x349747]||!_0x35c414[_0x9934('0x65')]){_0x50396c=path[_0x9934('0x66')](config[_0x9934('0x61')],_0xb578cf,_['toLower'](_0x9934('0x6c')));}if(!fs[_0x9934('0x60')](_0x50396c)){throw new db[(_0x9934('0x68'))][(_0x9934('0x69'))](_[_0x9934('0x64')](_0x9934('0x58'))+_0x9934('0x6d'));}return _0x2b7721[_0x9934('0x6a')](_0x50396c);}})[_0x9934('0x23')](handleError(_0x2b7721,null));};exports[_0x9934('0x6e')]=function(_0x447e35,_0x1d6af4){return db[_0x9934('0x48')][_0x9934('0x51')]({'where':{'id':_0x447e35[_0x9934('0x4e')]['id']},'attributes':[_0x9934('0x6f')]})[_0x9934('0x19')](respondWithResult(_0x1d6af4,null))[_0x9934('0x23')](handleError(_0x1d6af4,null));};exports[_0x9934('0x70')]=function(_0x3494ea,_0x10e5b8,_0x3fcf0d){if(_0x3494ea[_0x9934('0x54')]&&_0x3494ea[_0x9934('0x54')][_0x9934('0x55')]){_0x3494ea[_0x9934('0x52')][_0x9934('0x5a')]=_0x3494ea[_0x9934('0x54')][_0x9934('0x55')];}return db[_0x9934('0x48')]['find']({'where':{'id':_0x3494ea[_0x9934('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10e5b8,null))['then'](saveUpdates(_0x3494ea[_0x9934('0x52')],null))[_0x9934('0x19')](respondWithResult(_0x10e5b8,null))[_0x9934('0x23')](handleError(_0x10e5b8,null));};var utilLicense=require(_0x9934('0x17'));exports['getPreferred']=function(_0x43d72f,_0x35fc4e,_0x4254fb){var _0x22bc20=_0x9934('0x6b');var _0x3b7b65={'custom':![]};return utilLicense[_0x9934('0x71')]()[_0x9934('0x19')](function(_0x469734){if(_0x469734){_0x3b7b65=_0x469734;}return db['Setting']['find']({'where':{'id':_0x43d72f[_0x9934('0x4e')]['id']},'attributes':[_0x9934('0x56'),_0x9934('0x58'),_0x9934('0x5a'),_0x9934('0x5b'),'defaultLogo','defaultLoginLogo',_0x9934('0x5e'),_0x9934('0x5f')],'raw':!![]});})[_0x9934('0x19')](handleEntityNotFound(_0x35fc4e,null))['then'](function(_0x1a6881){if(_0x1a6881){var _0x20479a=_0x1a6881['preferred']&&fs[_0x9934('0x60')](path[_0x9934('0x66')](config[_0x9934('0x61')],_0x22bc20,_['toLower'](_0x1a6881['preferred'])))?path['join'](config['root'],_0x22bc20,_[_0x9934('0x62')](_0x1a6881[_0x9934('0x5a')])):path[_0x9934('0x66')](config['root'],_0x22bc20,_[_0x9934('0x62')](_0x9934('0x72')));var _0x414d02='default'+_[_0x9934('0x64')]('preferred');if(_0x1a6881[_0x414d02]||!_0x3b7b65[_0x9934('0x65')]||!_0x3b7b65[_0x9934('0x5a')]){_0x20479a=path[_0x9934('0x66')](config['root'],_0x22bc20,_[_0x9934('0x62')](_0x9934('0x72')));}if(!fs[_0x9934('0x60')](_0x20479a)){throw new db[(_0x9934('0x68'))][(_0x9934('0x69'))](_[_0x9934('0x64')](_0x9934('0x5a'))+'\x20not\x20found');}return _0x35fc4e['download'](_0x20479a);}})[_0x9934('0x23')](handleError(_0x35fc4e,null));};exports[_0x9934('0x73')]=function(_0x4f4937,_0x21fde2,_0x107aa6){if(_0x4f4937[_0x9934('0x54')]&&_0x4f4937[_0x9934('0x54')][_0x9934('0x55')]){_0x4f4937[_0x9934('0x52')][_0x9934('0x5b')]=_0x4f4937[_0x9934('0x54')][_0x9934('0x55')];}return db[_0x9934('0x48')]['find']({'where':{'id':_0x4f4937[_0x9934('0x4e')]['id']}})['then'](handleEntityNotFound(_0x21fde2,null))[_0x9934('0x19')](saveUpdates(_0x4f4937[_0x9934('0x52')],null))[_0x9934('0x19')](respondWithResult(_0x21fde2,null))['catch'](handleError(_0x21fde2,null));};var utilLicense=require('../../config/license/util');exports[_0x9934('0x74')]=function(_0x3df789,_0x106f0d,_0x957535){var _0x59142f='server/files/images/logos';var _0x26aa15={'custom':![]};return utilLicense[_0x9934('0x71')]()[_0x9934('0x19')](function(_0xd69242){if(_0xd69242){_0x26aa15=_0xd69242;}return db[_0x9934('0x48')][_0x9934('0x51')]({'where':{'id':_0x3df789[_0x9934('0x4e')]['id']},'attributes':['logo',_0x9934('0x58'),_0x9934('0x5a'),'favicon','defaultLogo','defaultLoginLogo',_0x9934('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x9934('0x19')](handleEntityNotFound(_0x106f0d,null))[_0x9934('0x19')](function(_0x3c4118){if(_0x3c4118){var _0x682bc9=_0x3c4118[_0x9934('0x5b')]&&fs['existsSync'](path['join'](config[_0x9934('0x61')],_0x59142f,_[_0x9934('0x62')](_0x3c4118[_0x9934('0x5b')])))?path[_0x9934('0x66')](config['root'],_0x59142f,_[_0x9934('0x62')](_0x3c4118[_0x9934('0x5b')])):path['join'](config['root'],_0x59142f,_[_0x9934('0x62')](_0x9934('0x75')));var _0x47c972=_0x9934('0x63')+_[_0x9934('0x64')](_0x9934('0x5b'));if(_0x3c4118[_0x47c972]||!_0x26aa15[_0x9934('0x65')]){_0x682bc9=path[_0x9934('0x66')](config['root'],_0x59142f,_[_0x9934('0x62')](_0x9934('0x75')));}if(!fs[_0x9934('0x60')](_0x682bc9)){throw new db[(_0x9934('0x68'))][(_0x9934('0x69'))](_[_0x9934('0x64')](_0x9934('0x5b'))+_0x9934('0x6d'));}return _0x106f0d[_0x9934('0x6a')](_0x682bc9);}})[_0x9934('0x23')](handleError(_0x106f0d,null));};exports[_0x9934('0x76')]=function(_0x44530c,_0x298bdb){var _0x152472={'offset':moment()[_0x9934('0x77')]()};_0x152472['now']=moment()[_0x9934('0x77')](_0x152472[_0x9934('0x26')])[_0x9934('0x78')](_0x9934('0x79'));return _0x298bdb[_0x9934('0x25')](0xc8)[_0x9934('0x31')](_0x152472);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5f96985..d7d9a7f 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(_0x2e3018,_0x381573){var _0x171218=function(_0x4960af){while(--_0x4960af){_0x2e3018['push'](_0x2e3018['shift']());}};_0x171218(++_0x381573);}(_0xe14b,0x93));var _0xbe14=function(_0x5e18a7,_0x1125cc){_0x5e18a7=_0x5e18a7-0x0;var _0x51978c=_0xe14b[_0x5e18a7];return _0x51978c;};'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(_0x18dedd,_0x4cb9e5){var _0x35b7e1=function(_0x429eb0){while(--_0x429eb0){_0x18dedd['push'](_0x18dedd['shift']());}};_0x35b7e1(++_0x4cb9e5);}(_0x008c,0x188));var _0xc008=function(_0x52071d,_0x1a6e5f){_0x52071d=_0x52071d-0x0;var _0x437165=_0x008c[_0x52071d];return _0x437165;};'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 8014481..08a48a6 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 _0xe63f=['stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','client','request','then','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','info','result','ShowSetting','Setting','find','options','where','attributes','map','include','model'];(function(_0x3bbfeb,_0x5137db){var _0x1787f1=function(_0x3b2878){while(--_0x3b2878){_0x3bbfeb['push'](_0x3bbfeb['shift']());}};_0x1787f1(++_0x5137db);}(_0xe63f,0xa3));var _0xfe63=function(_0x3a7d88,_0xe0a158){_0x3a7d88=_0x3a7d88-0x0;var _0x17e07e=_0xe63f[_0x3a7d88];return _0x17e07e;};'use strict';var _=require(_0xfe63('0x0'));var util=require(_0xfe63('0x1'));var moment=require('moment');var BPromise=require(_0xfe63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe63('0x3'));var db=require(_0xfe63('0x4'))['db'];var utils=require(_0xfe63('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfe63('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34b0f5,_0xe8ddba,_0x548fe9){return new BPromise(function(_0x505e24,_0x29daa7){return client[_0xfe63('0x7')](_0x34b0f5,_0x548fe9)[_0xfe63('0x8')](function(_0x3c01f0){logger['info']('Setting,\x20%s,\x20%s',_0xe8ddba,_0xfe63('0x9'));logger[_0xfe63('0xa')]('Setting,\x20%s,\x20%s,\x20%s',_0xe8ddba,_0xfe63('0x9'),JSON['stringify'](_0x3c01f0));if(_0x3c01f0[_0xfe63('0xb')]){if(_0x3c01f0[_0xfe63('0xb')][_0xfe63('0xc')]===0x1f4){logger[_0xfe63('0xb')](_0xfe63('0xd'),_0xe8ddba,_0x3c01f0[_0xfe63('0xb')][_0xfe63('0xe')]);return _0x29daa7(_0x3c01f0['error'][_0xfe63('0xe')]);}logger[_0xfe63('0xb')](_0xfe63('0xd'),_0xe8ddba,_0x3c01f0[_0xfe63('0xb')][_0xfe63('0xe')]);return _0x505e24(_0x3c01f0['error'][_0xfe63('0xe')]);}else{logger[_0xfe63('0xf')](_0xfe63('0xd'),_0xe8ddba,'request\x20sent');_0x505e24(_0x3c01f0[_0xfe63('0x10')]['message']);}})['catch'](function(_0x43fba0){logger[_0xfe63('0xb')](_0xfe63('0xd'),_0xe8ddba,_0x43fba0);_0x29daa7(_0x43fba0);});});}exports[_0xfe63('0x11')]=function(_0x2b9d21){var _0xbc8b22=this;return new Promise(function(_0x3c9baf,_0x25ccbe){return db[_0xfe63('0x12')][_0xfe63('0x13')]({'raw':_0x2b9d21[_0xfe63('0x14')]?_0x2b9d21[_0xfe63('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9d21[_0xfe63('0x14')]?_0x2b9d21[_0xfe63('0x14')][_0xfe63('0x15')]||null:null,'attributes':_0x2b9d21['options']?_0x2b9d21['options'][_0xfe63('0x16')]||null:null,'include':_0x2b9d21['options']?_0x2b9d21[_0xfe63('0x14')]['include']?_[_0xfe63('0x17')](_0x2b9d21[_0xfe63('0x14')][_0xfe63('0x18')],function(_0x35500f){return{'model':db[_0x35500f[_0xfe63('0x19')]],'as':_0x35500f['as'],'attributes':_0x35500f[_0xfe63('0x16')],'include':_0x35500f['include']?_[_0xfe63('0x17')](_0x35500f[_0xfe63('0x18')],function(_0x3147ba){return{'model':db[_0x3147ba[_0xfe63('0x19')]],'as':_0x3147ba['as'],'attributes':_0x3147ba[_0xfe63('0x16')],'include':_0x3147ba['include']?_[_0xfe63('0x17')](_0x3147ba[_0xfe63('0x18')],function(_0x10f14d){return{'model':db[_0x10f14d[_0xfe63('0x19')]],'as':_0x10f14d['as'],'attributes':_0x10f14d[_0xfe63('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b560){logger[_0xfe63('0xf')]('ShowSetting',_0x2b9d21);logger[_0xfe63('0xa')]('ShowSetting',_0x2b9d21,JSON[_0xfe63('0x1a')](_0x24b560));_0x3c9baf(_0x24b560);})['catch'](function(_0x45156d){logger[_0xfe63('0xb')](_0xfe63('0x11'),_0x45156d[_0xfe63('0xe')],_0x2b9d21);_0x25ccbe(_0xbc8b22[_0xfe63('0xb')](0x1f4,_0x45156d['message']));});});}; \ No newline at end of file +var _0x50bb=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSetting','Setting','options','raw','where','include','map','attributes','model','stringify','catch','lodash','bluebird'];(function(_0x1aa8b5,_0x198feb){var _0x1c2f60=function(_0x10412c){while(--_0x10412c){_0x1aa8b5['push'](_0x1aa8b5['shift']());}};_0x1c2f60(++_0x198feb);}(_0x50bb,0x1ee));var _0xb50b=function(_0x41ccf3,_0x94b2fc){_0x41ccf3=_0x41ccf3-0x0;var _0x5152e0=_0x50bb[_0x41ccf3];return _0x5152e0;};'use strict';var _=require(_0xb50b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb50b('0x1'));var rs=require(_0xb50b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb50b('0x3'));var logger=require(_0xb50b('0x4'))(_0xb50b('0x5'));var config=require('../../config/environment');var jayson=require(_0xb50b('0x6'));var client=jayson[_0xb50b('0x7')][_0xb50b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18ba46,_0x4e0952,_0x98b15){return new BPromise(function(_0x451812,_0x7a4159){return client[_0xb50b('0x9')](_0x18ba46,_0x98b15)[_0xb50b('0xa')](function(_0x47ba9c){logger[_0xb50b('0xb')](_0xb50b('0xc'),_0x4e0952,'request\x20sent');logger[_0xb50b('0xd')](_0xb50b('0xe'),_0x4e0952,_0xb50b('0xf'),JSON['stringify'](_0x47ba9c));if(_0x47ba9c['error']){if(_0x47ba9c[_0xb50b('0x10')][_0xb50b('0x11')]===0x1f4){logger[_0xb50b('0x10')]('Setting,\x20%s,\x20%s',_0x4e0952,_0x47ba9c['error'][_0xb50b('0x12')]);return _0x7a4159(_0x47ba9c[_0xb50b('0x10')][_0xb50b('0x12')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4e0952,_0x47ba9c['error'][_0xb50b('0x12')]);return _0x451812(_0x47ba9c['error'][_0xb50b('0x12')]);}else{logger[_0xb50b('0xb')]('Setting,\x20%s,\x20%s',_0x4e0952,_0xb50b('0xf'));_0x451812(_0x47ba9c[_0xb50b('0x13')][_0xb50b('0x12')]);}})['catch'](function(_0x5f4f1d){logger['error'](_0xb50b('0xc'),_0x4e0952,_0x5f4f1d);_0x7a4159(_0x5f4f1d);});});}exports[_0xb50b('0x14')]=function(_0x5cf91e){var _0x581b17=this;return new Promise(function(_0x296f9b,_0x2cd75f){return db[_0xb50b('0x15')]['find']({'raw':_0x5cf91e['options']?_0x5cf91e[_0xb50b('0x16')][_0xb50b('0x17')]===undefined?!![]:![]:!![],'where':_0x5cf91e[_0xb50b('0x16')]?_0x5cf91e[_0xb50b('0x16')][_0xb50b('0x18')]||null:null,'attributes':_0x5cf91e[_0xb50b('0x16')]?_0x5cf91e[_0xb50b('0x16')]['attributes']||null:null,'include':_0x5cf91e['options']?_0x5cf91e[_0xb50b('0x16')][_0xb50b('0x19')]?_[_0xb50b('0x1a')](_0x5cf91e['options']['include'],function(_0x926a91){return{'model':db[_0x926a91['model']],'as':_0x926a91['as'],'attributes':_0x926a91[_0xb50b('0x1b')],'include':_0x926a91[_0xb50b('0x19')]?_['map'](_0x926a91[_0xb50b('0x19')],function(_0x36ab30){return{'model':db[_0x36ab30[_0xb50b('0x1c')]],'as':_0x36ab30['as'],'attributes':_0x36ab30[_0xb50b('0x1b')],'include':_0x36ab30[_0xb50b('0x19')]?_[_0xb50b('0x1a')](_0x36ab30[_0xb50b('0x19')],function(_0x299334){return{'model':db[_0x299334[_0xb50b('0x1c')]],'as':_0x299334['as'],'attributes':_0x299334[_0xb50b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bfb3b){logger['info'](_0xb50b('0x14'),_0x5cf91e);logger['debug'](_0xb50b('0x14'),_0x5cf91e,JSON[_0xb50b('0x1d')](_0x5bfb3b));_0x296f9b(_0x5bfb3b);})[_0xb50b('0x1e')](function(_0x3a47b8){logger[_0xb50b('0x10')]('ShowSetting',_0x3a47b8['message'],_0x5cf91e);_0x2cd75f(_0x581b17[_0xb50b('0x10')](0x1f4,_0x3a47b8[_0xb50b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 75cd19b..b4936ad 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x330ca0,_0x363537){var _0x23ab97=function(_0x472a89){while(--_0x472a89){_0x330ca0['push'](_0x330ca0['shift']());}};_0x23ab97(++_0x363537);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x59fb9d,_0xe02a35){var _0x5da433=function(_0x54ef80){while(--_0x54ef80){_0x59fb9d['push'](_0x59fb9d['shift']());}};_0x5da433(++_0xe02a35);}(_0x6aa7,0x178));var _0x76aa=function(_0x3dc49e,_0x4eba67){_0x3dc49e=_0x3dc49e-0x0;var _0x47a48d=_0x6aa7[_0x3dc49e];return _0x47a48d;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 68d4f96..340127f 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 _0xbcb6=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc'];(function(_0x5d0b6f,_0x29cebf){var _0x41b631=function(_0x2c0e21){while(--_0x2c0e21){_0x5d0b6f['push'](_0x5d0b6f['shift']());}};_0x41b631(++_0x29cebf);}(_0xbcb6,0x83));var _0x6bcb=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0xbcb6[_0x21b36c];return _0x236627;};'use strict';var Sequelize=require(_0x6bcb('0x0'));var rs=require(_0x6bcb('0x1'));module['exports']={'name':{'type':Sequelize[_0x6bcb('0x2')],'unique':_0x6bcb('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6bcb('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6bcb('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6bcb('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6bcb('0x2')]},'type':{'type':Sequelize[_0x6bcb('0x4')](_0x6bcb('0x5'),_0x6bcb('0x6'),_0x6bcb('0x7'),_0x6bcb('0x8'),_0x6bcb('0x9'),_0x6bcb('0xa'),_0x6bcb('0xb'),_0x6bcb('0xc'),_0x6bcb('0xd'),_0x6bcb('0xe'))},'accountSid':{'type':Sequelize[_0x6bcb('0x2')]},'authId':{'type':Sequelize[_0x6bcb('0x2')]},'authToken':{'type':Sequelize[_0x6bcb('0x2')]},'smsMethod':{'type':Sequelize[_0x6bcb('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6bcb('0x2')]},'password':{'type':Sequelize[_0x6bcb('0x2')]},'apiKey':{'type':Sequelize[_0x6bcb('0x2')]},'applicationId':{'type':Sequelize[_0x6bcb('0x2')]},'accountId':{'type':Sequelize[_0x6bcb('0x2')]},'senderString':{'type':Sequelize[_0x6bcb('0x2')]},'deliveryReport':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x6bcb('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6bcb('0x10')],'defaultValue':function(){return _0x6bcb('0x11');}},'notificationSound':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6bcb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6bcb('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6bcb('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6bcb('0x12')],'comment':_0x6bcb('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x6bcb('0xf')],'defaultValue':![],'comment':_0x6bcb('0x14'),'set':function(_0x37f003){if(!_0x37f003)this[_0x6bcb('0x15')](_0x6bcb('0x16'),null);this[_0x6bcb('0x15')](_0x6bcb('0x17'),_0x37f003);}}}; \ No newline at end of file +var _0x2010=['bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','connectel','clicksend','plivo'];(function(_0x39d51a,_0x3399d2){var _0x23a9bc=function(_0x324d6f){while(--_0x324d6f){_0x39d51a['push'](_0x39d51a['shift']());}};_0x23a9bc(++_0x3399d2);}(_0x2010,0xab));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0201('0x0'));var rs=require(_0x0201('0x1'));module[_0x0201('0x2')]={'name':{'type':Sequelize[_0x0201('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x0201('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0201('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0201('0x4')](_0x0201('0x5'),'skebby',_0x0201('0x6'),_0x0201('0x7'),_0x0201('0x8'),'clickatell',_0x0201('0x9'),_0x0201('0xa'),_0x0201('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0x0201('0x3')]},'authId':{'type':Sequelize[_0x0201('0x3')]},'authToken':{'type':Sequelize[_0x0201('0x3')]},'smsMethod':{'type':Sequelize[_0x0201('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0201('0x3')]},'password':{'type':Sequelize[_0x0201('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x0201('0x3')]},'accountId':{'type':Sequelize[_0x0201('0x3')]},'senderString':{'type':Sequelize[_0x0201('0x3')]},'deliveryReport':{'type':Sequelize[_0x0201('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0201('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0201('0xd')],'defaultValue':function(){return _0x0201('0xe');}},'notificationSound':{'type':Sequelize[_0x0201('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0201('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0201('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0201('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0201('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0201('0xf')],'comment':_0x0201('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0201('0xc')],'defaultValue':![],'comment':_0x0201('0x11'),'set':function(_0x1a87fa){if(!_0x1a87fa)this[_0x0201('0x12')]('mandatoryDispositionPauseId',null);this[_0x0201('0x12')](_0x0201('0x13'),_0x1a87fa);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 99d3f73..47a57fe 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 _0xa1d3=['addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','READ_COMMITTED','bulkCreate','stack','finally','json','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','ids','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','findOne','findAll','rows','removeDispositions'];(function(_0x487982,_0x2e8ef2){var _0x2635ab=function(_0x4f431a){while(--_0x4f431a){_0x487982['push'](_0x487982['shift']());}};_0x2635ab(++_0x2e8ef2);}(_0xa1d3,0x7c));var _0x3a1d=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xa1d3[_0x5a636f];return _0x6a8cfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a1d('0x0'));var zipdir=require(_0x3a1d('0x1'));var jsonpatch=require(_0x3a1d('0x2'));var rp=require(_0x3a1d('0x3'));var moment=require(_0x3a1d('0x4'));var BPromise=require(_0x3a1d('0x5'));var Mustache=require('mustache');var util=require(_0x3a1d('0x6'));var path=require(_0x3a1d('0x7'));var sox=require(_0x3a1d('0x8'));var csv=require(_0x3a1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a1d('0xa'));var squel=require('squel');var crypto=require(_0x3a1d('0xb'));var jsforce=require(_0x3a1d('0xc'));var deskjs=require(_0x3a1d('0xd'));var toCsv=require(_0x3a1d('0x9'));var querystring=require(_0x3a1d('0xe'));var Papa=require(_0x3a1d('0xf'));var Redis=require(_0x3a1d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3a1d('0x11'));var as=require(_0x3a1d('0x12'));var hardwareService=require(_0x3a1d('0x13'));var logger=require(_0x3a1d('0x14'))(_0x3a1d('0x15'));var utils=require('../../config/utils');var config=require(_0x3a1d('0x16'));var licenseUtil=require(_0x3a1d('0x17'));var db=require(_0x3a1d('0x18'))['db'];config[_0x3a1d('0x19')]=_[_0x3a1d('0x1a')](config[_0x3a1d('0x19')],{'host':_0x3a1d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a1d('0x19')]));require(_0x3a1d('0x1c'))[_0x3a1d('0x1d')](socket);var jayson=require(_0x3a1d('0x1e'));var client=jayson[_0x3a1d('0x1f')][_0x3a1d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5d75f6,_0x68b0ae,_0x4c56a7,_0x535438){return new BPromise(function(_0x4ba8f3,_0x5c790f){var _0x395b05=_0x535438||client;return _0x395b05[_0x3a1d('0x21')](_0x5d75f6,_0x4c56a7)[_0x3a1d('0x22')](function(_0x3f9935){logger[_0x3a1d('0x23')](_0x3a1d('0x24'),_0x68b0ae,'request\x20sent');logger[_0x3a1d('0x25')](_0x3a1d('0x26'),_0x68b0ae,_0x3a1d('0x27'),JSON['stringify'](_0x3f9935));if(_0x3f9935[_0x3a1d('0x28')]){if(_0x3f9935[_0x3a1d('0x28')][_0x3a1d('0x29')]===0x1f4){logger[_0x3a1d('0x28')](_0x3a1d('0x24'),_0x68b0ae,_0x3f9935[_0x3a1d('0x28')][_0x3a1d('0x2a')]);return _0x5c790f(_0x3f9935['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x68b0ae,_0x3f9935[_0x3a1d('0x28')]['message']);return _0x4ba8f3(_0x3f9935[_0x3a1d('0x28')][_0x3a1d('0x2a')]);}else{logger['info'](_0x3a1d('0x24'),_0x68b0ae,_0x3a1d('0x27'));_0x4ba8f3(_0x3f9935[_0x3a1d('0x2b')]['message']);}})[_0x3a1d('0x2c')](function(_0x5b9118){logger[_0x3a1d('0x28')](_0x3a1d('0x24'),_0x68b0ae,_0x5b9118);_0x5c790f(_0x5b9118);});});}function respondWithStatusCode(_0x17a6e6,_0x52d897){_0x52d897=_0x52d897||0xcc;return function(_0x417a49){if(_0x417a49){return _0x17a6e6[_0x3a1d('0x2d')](_0x52d897);}return _0x17a6e6['status'](_0x52d897)['end']();};}function respondWithResult(_0x1b91cb,_0x1fffb3){_0x1fffb3=_0x1fffb3||0xc8;return function(_0x29e0aa){if(_0x29e0aa){return _0x1b91cb[_0x3a1d('0x2e')](_0x1fffb3)['json'](_0x29e0aa);}};}function respondWithFilteredResult(_0x10ee0d,_0x423f28){return function(_0x475599){if(_0x475599){var _0x2ff0be=typeof _0x423f28[_0x3a1d('0x2f')]===_0x3a1d('0x30')&&typeof _0x423f28[_0x3a1d('0x31')]===_0x3a1d('0x30');var _0x24f922=_0x475599[_0x3a1d('0x32')];var _0x12eb9e=_0x2ff0be?0x0:_0x423f28['offset'];var _0x45c604=_0x2ff0be?_0x475599[_0x3a1d('0x32')]:_0x423f28[_0x3a1d('0x2f')]+_0x423f28[_0x3a1d('0x31')];var _0x4ad2bd;if(_0x45c604>=_0x24f922){_0x45c604=_0x24f922;_0x4ad2bd=0xc8;}else{_0x4ad2bd=0xce;}_0x10ee0d[_0x3a1d('0x2e')](_0x4ad2bd);return _0x10ee0d[_0x3a1d('0x33')](_0x3a1d('0x34'),_0x12eb9e+'-'+_0x45c604+'/'+_0x24f922)['json'](_0x475599);}return null;};}function patchUpdates(_0x38260e){return function(_0x10a9a0){try{jsonpatch[_0x3a1d('0x35')](_0x10a9a0,_0x38260e,!![]);}catch(_0x159405){return BPromise['reject'](_0x159405);}return _0x10a9a0['save']();};}function saveUpdates(_0x5cfdd7,_0x5e0b0b){return function(_0x24b06f){if(_0x24b06f){return _0x24b06f[_0x3a1d('0x36')](_0x5cfdd7)[_0x3a1d('0x22')](function(_0x107edb){return _0x107edb;});}return null;};}function removeEntity(_0x553e7b,_0x372f28){return function(_0x2bdcac){if(_0x2bdcac){return _0x2bdcac[_0x3a1d('0x37')]()[_0x3a1d('0x22')](function(){var _0xa47447=_0x2bdcac[_0x3a1d('0x38')]({'plain':!![]});var _0x1a9bc3=_0x3a1d('0x39');return db[_0x3a1d('0x3a')][_0x3a1d('0x37')]({'where':{'type':_0x1a9bc3,'resourceId':_0xa47447['id']}})[_0x3a1d('0x22')](function(){return _0x2bdcac;});})[_0x3a1d('0x22')](function(){_0x553e7b[_0x3a1d('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5ee1,_0x32c3){return function(_0x4e8f95){if(!_0x4e8f95){_0x1b5ee1['sendStatus'](0x194);}return _0x4e8f95;};}function handleError(_0x19c69a,_0x25d01e){_0x25d01e=_0x25d01e||0x1f4;return function(_0x5601d4){logger['error'](_0x5601d4['stack']);if(_0x5601d4[_0x3a1d('0x3b')]){delete _0x5601d4[_0x3a1d('0x3b')];}_0x19c69a['status'](_0x25d01e)[_0x3a1d('0x3c')](_0x5601d4);};}exports['index']=function(_0x4a5111,_0x514035){var _0x1eba8e={'include':[{'model':db[_0x3a1d('0x3d')],'as':_0x3a1d('0x3e')}]},_0x167dce={},_0x4eca86={'count':0x0,'rows':[]};var _0x4ec73f=_[_0x3a1d('0x3f')](db[_0x3a1d('0x40')][_0x3a1d('0x41')],function(_0x5c9219){return{'name':_0x5c9219[_0x3a1d('0x42')],'type':_0x5c9219[_0x3a1d('0x43')][_0x3a1d('0x44')]};});_0x167dce[_0x3a1d('0x45')]=_[_0x3a1d('0x3f')](_0x4ec73f,_0x3a1d('0x3b'));_0x167dce['query']=_[_0x3a1d('0x46')](_0x4a5111[_0x3a1d('0x47')]);_0x167dce['filters']=_[_0x3a1d('0x48')](_0x167dce[_0x3a1d('0x45')],_0x167dce[_0x3a1d('0x47')]);_0x1eba8e['attributes']=_[_0x3a1d('0x48')](_0x167dce[_0x3a1d('0x45')],qs[_0x3a1d('0x49')](_0x4a5111[_0x3a1d('0x47')]['fields']));_0x1eba8e[_0x3a1d('0x4a')]=_0x1eba8e[_0x3a1d('0x4a')][_0x3a1d('0x4b')]?_0x1eba8e['attributes']:_0x167dce[_0x3a1d('0x45')];if(!_0x4a5111[_0x3a1d('0x47')][_0x3a1d('0x4c')](_0x3a1d('0x4d'))){_0x1eba8e[_0x3a1d('0x31')]=qs[_0x3a1d('0x31')](_0x4a5111[_0x3a1d('0x47')]['limit']);_0x1eba8e['offset']=qs[_0x3a1d('0x2f')](_0x4a5111['query'][_0x3a1d('0x2f')]);}_0x1eba8e[_0x3a1d('0x4e')]=qs[_0x3a1d('0x4f')](_0x4a5111['query']['sort']);_0x1eba8e['where']=qs[_0x3a1d('0x50')](_[_0x3a1d('0x51')](_0x4a5111[_0x3a1d('0x47')],_0x167dce[_0x3a1d('0x50')]),_0x4ec73f);if(_0x4a5111[_0x3a1d('0x47')][_0x3a1d('0x52')]){_0x1eba8e['where']=_['merge'](_0x1eba8e[_0x3a1d('0x53')],{'$or':_[_0x3a1d('0x3f')](_0x4ec73f,function(_0x4f004f){if(_0x4f004f[_0x3a1d('0x43')]!=='VIRTUAL'){var _0x13159f={};_0x13159f[_0x4f004f[_0x3a1d('0x3b')]]={'$like':'%'+_0x4a5111[_0x3a1d('0x47')][_0x3a1d('0x52')]+'%'};return _0x13159f;}})});}_0x1eba8e=_[_0x3a1d('0x54')]({},_0x1eba8e,_0x4a5111[_0x3a1d('0x55')]);var _0xe9f09b={'where':_0x1eba8e[_0x3a1d('0x53')]};return db[_0x3a1d('0x40')]['count'](_0xe9f09b)['then'](function(_0x4b47fe){_0x4eca86[_0x3a1d('0x32')]=_0x4b47fe;if(_0x4a5111[_0x3a1d('0x47')][_0x3a1d('0x56')]){_0x1eba8e[_0x3a1d('0x57')]=[{'all':!![]}];}return db[_0x3a1d('0x40')]['findAll'](_0x1eba8e);})[_0x3a1d('0x22')](function(_0x5980a3){_0x4eca86['rows']=_0x5980a3;return _0x4eca86;})[_0x3a1d('0x22')](respondWithFilteredResult(_0x514035,_0x1eba8e))['catch'](handleError(_0x514035,null));};exports['show']=function(_0x107119,_0x443cb5){var _0x32ceb9={'raw':![],'where':{'id':_0x107119[_0x3a1d('0x58')]['id']},'include':[{'model':db[_0x3a1d('0x3d')],'as':_0x3a1d('0x3e')}]},_0x2581e4={};_0x2581e4[_0x3a1d('0x45')]=_[_0x3a1d('0x46')](db[_0x3a1d('0x40')][_0x3a1d('0x41')]);_0x2581e4[_0x3a1d('0x47')]=_[_0x3a1d('0x46')](_0x107119[_0x3a1d('0x47')]);_0x2581e4[_0x3a1d('0x50')]=_[_0x3a1d('0x48')](_0x2581e4[_0x3a1d('0x45')],_0x2581e4[_0x3a1d('0x47')]);_0x32ceb9['attributes']=_[_0x3a1d('0x48')](_0x2581e4['model'],qs[_0x3a1d('0x49')](_0x107119[_0x3a1d('0x47')][_0x3a1d('0x49')]));_0x32ceb9['attributes']=_0x32ceb9[_0x3a1d('0x4a')]['length']?_0x32ceb9['attributes']:_0x2581e4[_0x3a1d('0x45')];if(_0x107119[_0x3a1d('0x47')]['includeAll']){_0x32ceb9[_0x3a1d('0x57')]=[{'all':!![]}];}_0x32ceb9=_[_0x3a1d('0x54')]({},_0x32ceb9,_0x107119[_0x3a1d('0x55')]);return db['SmsAccount'][_0x3a1d('0x59')](_0x32ceb9)['then'](handleEntityNotFound(_0x443cb5,null))[_0x3a1d('0x22')](respondWithResult(_0x443cb5,null))[_0x3a1d('0x2c')](handleError(_0x443cb5,null));};exports[_0x3a1d('0x5a')]=function(_0x18c74c,_0x2faf7d){return db['SmsAccount']['create'](_0x18c74c[_0x3a1d('0x5b')],{})[_0x3a1d('0x22')](function(_0x144a14){var _0x3215b1=_0x18c74c[_0x3a1d('0x5c')]['get']({'plain':!![]});if(!_0x3215b1)throw new Error(_0x3a1d('0x5d'));if(_0x3215b1[_0x3a1d('0x5e')]===_0x3a1d('0x5c')){var _0x320dfc=_0x144a14[_0x3a1d('0x38')]({'plain':!![]});var _0x477265=_0x3a1d('0x39');return db[_0x3a1d('0x5f')]['find']({'where':{'name':_0x477265,'userProfileId':_0x3215b1[_0x3a1d('0x60')]},'raw':!![]})[_0x3a1d('0x22')](function(_0x5a5fea){if(_0x5a5fea&&_0x5a5fea['autoAssociation']===0x0){return db[_0x3a1d('0x3a')][_0x3a1d('0x5a')]({'name':_0x320dfc[_0x3a1d('0x3b')],'resourceId':_0x320dfc['id'],'type':_0x5a5fea[_0x3a1d('0x3b')],'sectionId':_0x5a5fea['id']},{})[_0x3a1d('0x22')](function(){return _0x144a14;});}else{return _0x144a14;}})[_0x3a1d('0x2c')](function(_0x3a06bc){logger[_0x3a1d('0x28')](_0x3a1d('0x61'),_0x3a06bc);throw _0x3a06bc;});}return _0x144a14;})[_0x3a1d('0x22')](respondWithResult(_0x2faf7d,0xc9))[_0x3a1d('0x2c')](handleError(_0x2faf7d,null));};exports[_0x3a1d('0x36')]=function(_0x196df4,_0xf8e0e7){if(_0x196df4[_0x3a1d('0x5b')]['id']){delete _0x196df4['body']['id'];}return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x196df4[_0x3a1d('0x58')]['id']},'include':[{'model':db[_0x3a1d('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x3a1d('0x22')](handleEntityNotFound(_0xf8e0e7,null))['then'](saveUpdates(_0x196df4[_0x3a1d('0x5b')],null))[_0x3a1d('0x22')](respondWithResult(_0xf8e0e7,null))[_0x3a1d('0x2c')](handleError(_0xf8e0e7,null));};exports[_0x3a1d('0x37')]=function(_0x8f2827,_0x4446cf){return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x8f2827[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x4446cf,null))[_0x3a1d('0x22')](removeEntity(_0x4446cf,null))[_0x3a1d('0x2c')](handleError(_0x4446cf,null));};exports[_0x3a1d('0x62')]=function(_0x5b8af0,_0x52431c){return db[_0x3a1d('0x40')]['describe']()[_0x3a1d('0x22')](respondWithResult(_0x52431c,null))[_0x3a1d('0x2c')](handleError(_0x52431c,null));};exports['addDisposition']=function(_0xc9f8cb,_0x14b683,_0xc4e34a){if(_0xc9f8cb[_0x3a1d('0x5b')]['id']){delete _0xc9f8cb[_0x3a1d('0x5b')]['id'];}return db[_0x3a1d('0x40')]['find']({'where':{'id':_0xc9f8cb[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x14b683,null))[_0x3a1d('0x22')](function(_0x11a0e8){if(_0x11a0e8){_0xc9f8cb['body'][_0x3a1d('0x63')]=_0x11a0e8['id'];return db[_0x3a1d('0x64')][_0x3a1d('0x5a')](_0xc9f8cb[_0x3a1d('0x5b')]);}})['then'](respondWithResult(_0x14b683,null))[_0x3a1d('0x2c')](handleError(_0x14b683,null));};exports['getDispositions']=function(_0x2d60fe,_0x331fe0,_0x133e3a){var _0x473e36={'raw':![],'where':{}};var _0x344272={};var _0x84c1d0={'count':0x0,'rows':[]};return db[_0x3a1d('0x40')][_0x3a1d('0x65')]({'where':{'id':_0x2d60fe[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x331fe0,null))['then'](function(_0x1e9418){if(_0x1e9418){_0x344272['model']=_[_0x3a1d('0x46')](db[_0x3a1d('0x64')][_0x3a1d('0x41')]);_0x344272[_0x3a1d('0x47')]=_[_0x3a1d('0x46')](_0x2d60fe[_0x3a1d('0x47')]);_0x344272['filters']=_[_0x3a1d('0x48')](_0x344272[_0x3a1d('0x45')],_0x344272[_0x3a1d('0x47')]);_0x473e36[_0x3a1d('0x4a')]=_[_0x3a1d('0x48')](_0x344272[_0x3a1d('0x45')],qs[_0x3a1d('0x49')](_0x2d60fe[_0x3a1d('0x47')]['fields']));_0x473e36['attributes']=_0x473e36['attributes'][_0x3a1d('0x4b')]?_0x473e36[_0x3a1d('0x4a')]:_0x344272['model'];if(!_0x2d60fe['query'][_0x3a1d('0x4c')]('nolimit')){_0x473e36[_0x3a1d('0x31')]=qs[_0x3a1d('0x31')](_0x2d60fe[_0x3a1d('0x47')][_0x3a1d('0x31')]);_0x473e36[_0x3a1d('0x2f')]=qs['offset'](_0x2d60fe[_0x3a1d('0x47')]['offset']);}_0x473e36[_0x3a1d('0x4e')]=qs[_0x3a1d('0x4f')](_0x2d60fe[_0x3a1d('0x47')][_0x3a1d('0x4f')]);_0x473e36[_0x3a1d('0x53')]=qs[_0x3a1d('0x50')](_[_0x3a1d('0x51')](_0x2d60fe['query'],_0x344272['filters']));_0x473e36[_0x3a1d('0x53')][_0x3a1d('0x63')]=_0x1e9418['id'];if(_0x2d60fe[_0x3a1d('0x47')][_0x3a1d('0x52')]){_0x473e36[_0x3a1d('0x53')]=_[_0x3a1d('0x54')](_0x473e36[_0x3a1d('0x53')],{'$or':_['map'](_0x473e36[_0x3a1d('0x4a')],function(_0x79d1a3){var _0x20d1b0={};_0x20d1b0[_0x79d1a3]={'$like':'%'+_0x2d60fe[_0x3a1d('0x47')][_0x3a1d('0x52')]+'%'};return _0x20d1b0;})});}_0x473e36=_[_0x3a1d('0x54')]({},_0x473e36,_0x2d60fe['options']);return db[_0x3a1d('0x64')][_0x3a1d('0x32')]({'where':_0x473e36['where']})[_0x3a1d('0x22')](function(_0x3e0338){_0x84c1d0[_0x3a1d('0x32')]=_0x3e0338;if(_0x2d60fe[_0x3a1d('0x47')][_0x3a1d('0x56')]){_0x473e36[_0x3a1d('0x57')]=[{'all':!![]}];}return db[_0x3a1d('0x64')][_0x3a1d('0x66')](_0x473e36);})[_0x3a1d('0x22')](function(_0x5b6a9f){_0x84c1d0[_0x3a1d('0x67')]=_0x5b6a9f;return _0x84c1d0;});}})[_0x3a1d('0x22')](respondWithFilteredResult(_0x331fe0,_0x473e36))[_0x3a1d('0x2c')](handleError(_0x331fe0,null));};exports[_0x3a1d('0x68')]=function(_0x18f776,_0x50cc94,_0x19755e){return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x18f776['params']['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x50cc94,null))[_0x3a1d('0x22')](function(_0x49ae2b){if(_0x49ae2b){return _0x49ae2b[_0x3a1d('0x68')](_0x18f776[_0x3a1d('0x47')]['ids']);}})[_0x3a1d('0x22')](respondWithStatusCode(_0x50cc94,null))[_0x3a1d('0x2c')](handleError(_0x50cc94,null));};exports[_0x3a1d('0x69')]=function(_0x2f041f,_0xa44fa1,_0x46b635){if(_0x2f041f[_0x3a1d('0x5b')]['id']){delete _0x2f041f[_0x3a1d('0x5b')]['id'];}return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x2f041f['params']['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0xa44fa1,null))[_0x3a1d('0x22')](function(_0x681f79){if(_0x681f79){_0x2f041f[_0x3a1d('0x5b')][_0x3a1d('0x63')]=_0x681f79['id'];return db[_0x3a1d('0x6a')]['create'](_0x2f041f['body']);}})[_0x3a1d('0x22')](respondWithResult(_0xa44fa1,null))['catch'](handleError(_0xa44fa1,null));};exports[_0x3a1d('0x6b')]=function(_0x1b2c23,_0x1ea8a0,_0x233916){var _0x343a99={'raw':![],'where':{}};var _0x3a8b75={};var _0x1d1f56={'count':0x0,'rows':[]};return db[_0x3a1d('0x40')][_0x3a1d('0x65')]({'where':{'id':_0x1b2c23[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x1ea8a0,null))[_0x3a1d('0x22')](function(_0x172487){if(_0x172487){_0x3a8b75[_0x3a1d('0x45')]=_[_0x3a1d('0x46')](db[_0x3a1d('0x6a')]['rawAttributes']);_0x3a8b75[_0x3a1d('0x47')]=_['keys'](_0x1b2c23[_0x3a1d('0x47')]);_0x3a8b75[_0x3a1d('0x50')]=_[_0x3a1d('0x48')](_0x3a8b75[_0x3a1d('0x45')],_0x3a8b75[_0x3a1d('0x47')]);_0x343a99['attributes']=_[_0x3a1d('0x48')](_0x3a8b75[_0x3a1d('0x45')],qs[_0x3a1d('0x49')](_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x49')]));_0x343a99['attributes']=_0x343a99['attributes'][_0x3a1d('0x4b')]?_0x343a99[_0x3a1d('0x4a')]:_0x3a8b75[_0x3a1d('0x45')];if(!_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x4c')]('nolimit')){_0x343a99[_0x3a1d('0x31')]=qs['limit'](_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x31')]);_0x343a99[_0x3a1d('0x2f')]=qs[_0x3a1d('0x2f')](_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x2f')]);}_0x343a99[_0x3a1d('0x4e')]=qs[_0x3a1d('0x4f')](_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x4f')]);_0x343a99[_0x3a1d('0x53')]=qs[_0x3a1d('0x50')](_[_0x3a1d('0x51')](_0x1b2c23['query'],_0x3a8b75['filters']));_0x343a99[_0x3a1d('0x53')][_0x3a1d('0x63')]=_0x172487['id'];if(_0x1b2c23['query']['filter']){_0x343a99[_0x3a1d('0x53')]=_[_0x3a1d('0x54')](_0x343a99[_0x3a1d('0x53')],{'$or':_[_0x3a1d('0x3f')](_0x343a99[_0x3a1d('0x4a')],function(_0x33aae4){var _0x4ce85e={};_0x4ce85e[_0x33aae4]={'$like':'%'+_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x52')]+'%'};return _0x4ce85e;})});}_0x343a99=_[_0x3a1d('0x54')]({},_0x343a99,_0x1b2c23['options']);return db['CannedAnswer'][_0x3a1d('0x32')]({'where':_0x343a99[_0x3a1d('0x53')]})[_0x3a1d('0x22')](function(_0x29e3a9){_0x1d1f56[_0x3a1d('0x32')]=_0x29e3a9;if(_0x1b2c23[_0x3a1d('0x47')][_0x3a1d('0x56')]){_0x343a99[_0x3a1d('0x57')]=[{'all':!![]}];}return db[_0x3a1d('0x6a')][_0x3a1d('0x66')](_0x343a99);})[_0x3a1d('0x22')](function(_0x92ea51){_0x1d1f56[_0x3a1d('0x67')]=_0x92ea51;return _0x1d1f56;});}})[_0x3a1d('0x22')](respondWithFilteredResult(_0x1ea8a0,_0x343a99))[_0x3a1d('0x2c')](handleError(_0x1ea8a0,null));};exports[_0x3a1d('0x6c')]=function(_0x19509e,_0x1fe6cf,_0x407ea4){return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x19509e[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x1fe6cf,null))['then'](function(_0x506df8){if(_0x506df8){return _0x506df8['removeAnswers'](_0x19509e[_0x3a1d('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x1fe6cf,null))[_0x3a1d('0x2c')](handleError(_0x1fe6cf,null));};exports[_0x3a1d('0x6d')]=function(_0x5ace49,_0x15254f,_0x5187d9){var _0x593959={'channel':_0x3a1d('0x6e')};var _0x2bb0c0=[];var _0x3f27fd=[];var _0x28341d={};return db['SmsAccount']['find']({'where':{'id':_0x5ace49[_0x3a1d('0x58')]['id']},'include':[{'model':db[_0x3a1d('0x6f')],'as':_0x3a1d('0x70')}]})[_0x3a1d('0x22')](handleEntityNotFound(_0x15254f,null))[_0x3a1d('0x22')](function(_0x7660a0){_0x593959[_0x3a1d('0x71')]=_0x7660a0;_0x593959[_0x3a1d('0x72')]=_['orderBy'](_0x7660a0['Applications'],[_0x3a1d('0x73')],[_0x3a1d('0x74')]);if(_0x593959['account'][_0x3a1d('0x70')]){delete _0x593959[_0x3a1d('0x71')][_0x3a1d('0x70')];}return db[_0x3a1d('0x75')][_0x3a1d('0x62')]();})['then'](function(_0x1060c8){if(!_0x1060c8){throw new db[(_0x3a1d('0x76'))][(_0x3a1d('0x77'))](_0x3a1d('0x78'));}_0x2bb0c0=_[_0x3a1d('0x79')](_[_0x3a1d('0x46')](_0x1060c8),[_0x3a1d('0x7a'),_0x3a1d('0x7b')]);_0x3f27fd=_[_0x3a1d('0x79')](_[_0x3a1d('0x46')](_0x1060c8),[_0x3a1d('0x7a'),_0x3a1d('0x7b'),_0x3a1d('0x7c'),_0x3a1d('0x7d')]);_0x593959[_0x3a1d('0x5b')]={'mapKey':_0x3a1d('0x7e')};if(_0x593959[_0x3a1d('0x71')][_0x3a1d('0x43')]){switch(_0x593959['account'][_0x3a1d('0x43')]){case _0x3a1d('0x7f'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x81')];_0x593959[_0x3a1d('0x5b')]['body']=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x82')];_0x593959['body'][_0x3a1d('0x83')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x84')];break;case _0x3a1d('0x85'):_0x593959[_0x3a1d('0x5b')]['from']='+'+_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x86')];_0x593959['body'][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x87')];break;case _0x3a1d('0x88'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x80')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x2a')];break;case _0x3a1d('0x89'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49['body'][_0x3a1d('0x80')];_0x593959['body'][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x5b')];_0x593959['body']['messageId']=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x8a')];break;case'plivo':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x81')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x8b')];_0x593959[_0x3a1d('0x5b')]['messageId']=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x8c')];break;case _0x3a1d('0x8d'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]='+'+_0x5ace49['body']['results'][0x0][_0x3a1d('0x80')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x8e')][0x0][_0x3a1d('0x87')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x83')]=_0x5ace49['body'][_0x3a1d('0x8e')][0x0]['messageId'];break;case _0x3a1d('0x8f'):_0x593959[_0x3a1d('0x5b')]['from']=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x90')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x91')][_0x3a1d('0x2a')];break;case _0x3a1d('0x92'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x93')];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]=_0x5ace49['body'][_0x3a1d('0x87')];_0x593959[_0x3a1d('0x5b')]['messageId']=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x94')];break;case'bandwidth':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x83')]=_0x5ace49[_0x3a1d('0x5b')][0x0]['message']['id'];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][0x0][_0x3a1d('0x2a')][_0x3a1d('0x80')];_0x593959[_0x3a1d('0x5b')]['body']=_0x5ace49['body'][0x0][_0x3a1d('0x2a')]['text'];break;case _0x3a1d('0x95'):_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x80')];_0x593959[_0x3a1d('0x5b')]['body']=_0x5ace49['body']['message'];_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x83')]=_0x5ace49[_0x3a1d('0x5b')][_0x3a1d('0x96')];break;}}if(_0x593959[_0x3a1d('0x5b')]['id']){delete _0x593959[_0x3a1d('0x5b')]['id'];}if(_[_0x3a1d('0x97')](_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')])){throw new db[(_0x3a1d('0x76'))]['ValidationError'](_0x3a1d('0x98'));}if(_[_0x3a1d('0x97')](_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')])||_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')]===''){throw new db[(_0x3a1d('0x76'))]['ValidationError'](_0x3a1d('0x99'));}if(_['isNil'](_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x9a')])){throw new db[(_0x3a1d('0x76'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f27fd);}if(!_['includes'](_0x3f27fd,_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x9a')])){throw new db[(_0x3a1d('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f27fd);}_0x28341d[_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x9a')]]=_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')];return db[_0x3a1d('0x9b')][_0x3a1d('0x59')]({'where':{'id':_0x593959[_0x3a1d('0x71')][_0x3a1d('0x7d')]},'include':[{'model':db[_0x3a1d('0x75')],'as':_0x3a1d('0x9c'),'where':_0x28341d,'limit':0x1,'order':[[_0x3a1d('0x7b'),_0x3a1d('0x9d')]]}]});})[_0x3a1d('0x22')](handleEntityNotFound(_0x15254f,null))[_0x3a1d('0x22')](function(_0x4053eb){if(_0x4053eb){_0x593959[_0x3a1d('0x9e')]=_[_0x3a1d('0x9f')](_0x4053eb,['Contacts']);if(_0x4053eb[_0x3a1d('0x9c')]['length']){return _0x4053eb[_0x3a1d('0x9c')][0x0];}var _0x5da816=_[_0x3a1d('0x1a')](_0x593959[_0x3a1d('0x5b')],{'firstName':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')],'ListId':_0x4053eb['id']});_0x5da816[_0x593959[_0x3a1d('0x5b')]['mapKey']]=_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')];return db[_0x3a1d('0x75')][_0x3a1d('0x5a')](_0x5da816,{'fields':_0x2bb0c0,'raw':!![]});}})['then'](handleEntityNotFound(_0x15254f,null))['then'](function(_0x53ac25){if(_0x53ac25){_0x593959[_0x3a1d('0xa0')]=_0x53ac25;var _0x494f9d={'ContactId':_0x53ac25['id'],'phone':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x80')],'SmsAccountId':_0x5ace49[_0x3a1d('0x58')]['id']};var _0x3d27d8={'ContactId':_0x53ac25['id'],'SmsAccountId':_0x5ace49[_0x3a1d('0x58')]['id'],'closed':![]};return db[_0x3a1d('0xa1')][_0x3a1d('0x59')]({'where':_0x3d27d8})['then'](function(_0x503791){if(_0x503791){return[_0x503791,![]];}return db['SmsInteraction']['create'](_0x494f9d)[_0x3a1d('0x22')](function(_0x4e3431){return[_0x4e3431,!![]];});});}})[_0x3a1d('0xa2')](function(_0x52aac8,_0x22d17b){_0x593959['interaction']=_0x52aac8['get']({'plain':!![]});_0x593959[_0x3a1d('0xa3')][_0x3a1d('0xa4')]=![];if(_0x22d17b){if(_0x593959[_0x3a1d('0x71')][_0x3a1d('0xa5')]){_0x593959['applications']['push']({'id':0x0,'priority':_0x593959[_0x3a1d('0x72')]['length']+0x1,'app':_0x3a1d('0xa6'),'appdata':_0x3a1d('0xa7'),'interval':_0x3a1d('0xa8')});}_0x593959[_0x3a1d('0xa3')][_0x3a1d('0xa4')]=!![];}return db[_0x3a1d('0xa9')][_0x3a1d('0x5a')]({'phone':_0x593959[_0x3a1d('0x5b')]['from'],'messageId':_0x593959['body'][_0x3a1d('0x83')],'body':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0x5b')],'SmsAccountId':_0x5ace49['params']['id'],'SmsInteractionId':_0x52aac8['id'],'direction':'in','ContactId':_0x52aac8[_0x3a1d('0xaa')],'AttachmentId':_0x593959[_0x3a1d('0x5b')][_0x3a1d('0xab')]});})[_0x3a1d('0x22')](function(_0x35617d){_0x593959[_0x3a1d('0x2a')]=_0x35617d;if(_0x593959['interaction'][_0x3a1d('0xac')]){return db[_0x3a1d('0xad')][_0x3a1d('0x59')]({'attributes':['id','name'],'where':{'id':_0x593959[_0x3a1d('0xa3')][_0x3a1d('0xac')]}})['then'](function(_0x1dea55){if(_0x1dea55){_0x593959[_0x3a1d('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3a1d('0xae'),'appdata':_0x1dea55[_0x3a1d('0x3b')]+','+(_0x593959[_0x3a1d('0x71')][_0x3a1d('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x3a1d('0xb0'),_0x593959);});}return respondWithRpcPromise(_0x3a1d('0xb1'),_0x3a1d('0xb0'),_0x593959);})[_0x3a1d('0x22')](function(_0x4ab20c){if(_0x4ab20c){var _0xe51859=0xc8;var _0x4b5748=_0x3a1d('0xb2');logger[_0x3a1d('0x23')](_0x3a1d('0x26'),_0x4b5748,_0xe51859,_0x3a1d('0xb3'));logger[_0x3a1d('0x25')](_0x3a1d('0xb4'),_0x4b5748,_0xe51859,_0x3a1d('0xb3'),JSON[_0x3a1d('0xb5')](_0x4ab20c));if(_0x593959[_0x3a1d('0x71')][_0x3a1d('0x43')]===_0x3a1d('0x7f')){return _0x15254f[_0x3a1d('0x2e')](_0xe51859)[_0x3a1d('0x33')](_0x3a1d('0xb6'),_0x3a1d('0xb7'))[_0x3a1d('0x3c')](_0x3a1d('0xb8'));}else{return _0x15254f['status'](_0xe51859)['json'](_0x4ab20c);}}})['catch'](handleError(_0x15254f,null));};exports[_0x3a1d('0xb9')]=function(_0x1e2da0,_0x1a8060){var _0x1a1568=_0x1e2da0['params']['id'];var _0x13d72f=_0x1e2da0[_0x3a1d('0x5b')];var _0x2a5977=0xc8;var _0x4f916e=null;return db['sequelize'][_0x3a1d('0xba')]({'isolationLevel':db[_0x3a1d('0xbb')]['Transaction']['ISOLATION_LEVELS'][_0x3a1d('0xbc')]},function(_0x5cef6a){return db[_0x3a1d('0x40')][_0x3a1d('0x65')]({'where':{'id':_0x1a1568},'transaction':_0x5cef6a})[_0x3a1d('0x22')](function(_0x50109b){if(_0x50109b){return db[_0x3a1d('0x6f')]['destroy']({'where':{'SmsAccountId':_0x1a1568},'transaction':_0x5cef6a})[_0x3a1d('0x22')](function(){var _0x254184=_[_0x3a1d('0x3f')](_0x13d72f,function(_0xbef0d){_0xbef0d['SmsAccountId']=_0x1a1568;return _0xbef0d;});return db[_0x3a1d('0x6f')][_0x3a1d('0xbd')](_0x254184,{'transaction':_0x5cef6a});});}else{_0x2a5977=0x194;_0x4f916e=[];}});})[_0x3a1d('0x22')](function(){if(_0x2a5977!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x1a1568},'order':_0x3a1d('0x73')})[_0x3a1d('0x22')](function(_0x417adc){_0x4f916e=_0x417adc;});}})[_0x3a1d('0x2c')](function(_0x136a3f){_0x2a5977=0x1f4;logger['error'](_0x136a3f[_0x3a1d('0xbe')]);if(_0x136a3f[_0x3a1d('0x3b')]){delete _0x136a3f[_0x3a1d('0x3b')];}_0x4f916e=_0x136a3f;})[_0x3a1d('0xbf')](function(){if(_0x4f916e===null){_0x1a8060['sendStatus'](_0x2a5977);}else{if(_0x2a5977===0x1f4){_0x1a8060[_0x3a1d('0x2e')](_0x2a5977)['send'](_0x4f916e);}else{_0x1a8060[_0x3a1d('0x2e')](_0x2a5977)[_0x3a1d('0xc0')](_0x4f916e);}}});};exports['getApplications']=function(_0x144c5a,_0x307ede,_0x30b8e2){var _0x15d4a2={};var _0x3c37d4={};var _0x1be1ee;var _0x5d1042;return db[_0x3a1d('0x40')][_0x3a1d('0x65')]({'where':{'id':_0x144c5a[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x307ede,null))['then'](function(_0x11c118){if(_0x11c118){_0x1be1ee=_0x11c118;_0x3c37d4[_0x3a1d('0x45')]=_['keys'](db[_0x3a1d('0x6f')][_0x3a1d('0x41')]);_0x3c37d4[_0x3a1d('0x47')]=_['keys'](_0x144c5a['query']);_0x3c37d4['filters']=_[_0x3a1d('0x48')](_0x3c37d4[_0x3a1d('0x45')],_0x3c37d4['query']);_0x15d4a2['attributes']=_[_0x3a1d('0x48')](_0x3c37d4[_0x3a1d('0x45')],qs[_0x3a1d('0x49')](_0x144c5a[_0x3a1d('0x47')][_0x3a1d('0x49')]));_0x15d4a2[_0x3a1d('0x4a')]=_0x15d4a2['attributes'][_0x3a1d('0x4b')]?_0x15d4a2[_0x3a1d('0x4a')]:_0x3c37d4[_0x3a1d('0x45')];_0x15d4a2['order']=qs[_0x3a1d('0x4f')](_0x144c5a['query']['sort']);_0x15d4a2['where']=qs[_0x3a1d('0x50')](_[_0x3a1d('0x51')](_0x144c5a[_0x3a1d('0x47')],_0x3c37d4['filters']));if(_0x144c5a['query']['filter']){_0x15d4a2[_0x3a1d('0x53')]=_[_0x3a1d('0x54')](_0x15d4a2['where'],{'$or':_[_0x3a1d('0x3f')](_0x15d4a2['attributes'],function(_0x1b4167){var _0x464e89={};_0x464e89[_0x1b4167]={'$like':'%'+_0x144c5a[_0x3a1d('0x47')]['filter']+'%'};return _0x464e89;})});}_0x15d4a2=_[_0x3a1d('0x54')]({},_0x15d4a2,_0x144c5a[_0x3a1d('0x55')]);return _0x1be1ee[_0x3a1d('0xc1')](_0x15d4a2);}})[_0x3a1d('0x22')](function(_0x2d028c){if(_0x2d028c){_0x5d1042=_0x2d028c['length'];if(!_0x144c5a[_0x3a1d('0x47')]['hasOwnProperty'](_0x3a1d('0x4d'))){_0x15d4a2[_0x3a1d('0x31')]=qs[_0x3a1d('0x31')](_0x144c5a[_0x3a1d('0x47')][_0x3a1d('0x31')]);_0x15d4a2['offset']=qs[_0x3a1d('0x2f')](_0x144c5a[_0x3a1d('0x47')][_0x3a1d('0x2f')]);}return _0x1be1ee[_0x3a1d('0xc1')](_0x15d4a2);}})[_0x3a1d('0x22')](function(_0x4ebc6b){if(_0x4ebc6b){return _0x4ebc6b?{'count':_0x5d1042,'rows':_0x4ebc6b}:null;}})[_0x3a1d('0x22')](respondWithResult(_0x307ede,null))[_0x3a1d('0x2c')](handleError(_0x307ede,null));};exports[_0x3a1d('0xc2')]=function(_0x2d6bd3,_0x8a1baf,_0x44045c){var _0x1f22c4={'raw':![],'where':{}};var _0x298ffb={};var _0x142485={'count':0x0,'rows':[]};return db[_0x3a1d('0x40')][_0x3a1d('0x65')]({'where':{'id':_0x2d6bd3['params']['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x8a1baf,null))['then'](function(_0x52d388){if(_0x52d388){_0x298ffb[_0x3a1d('0x45')]=_['keys'](db[_0x3a1d('0xa1')][_0x3a1d('0x41')]);_0x298ffb['query']=_[_0x3a1d('0x46')](_0x2d6bd3[_0x3a1d('0x47')]);_0x298ffb['filters']=_[_0x3a1d('0x48')](_0x298ffb[_0x3a1d('0x45')],_0x298ffb[_0x3a1d('0x47')]);_0x1f22c4[_0x3a1d('0x4a')]=_[_0x3a1d('0x48')](_0x298ffb[_0x3a1d('0x45')],qs[_0x3a1d('0x49')](_0x2d6bd3['query'][_0x3a1d('0x49')]));_0x1f22c4[_0x3a1d('0x4a')]=_0x1f22c4[_0x3a1d('0x4a')]['length']?_0x1f22c4[_0x3a1d('0x4a')]:_0x298ffb[_0x3a1d('0x45')];if(!_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0x4c')](_0x3a1d('0x4d'))){_0x1f22c4[_0x3a1d('0x31')]=qs[_0x3a1d('0x31')](_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0x31')]);_0x1f22c4[_0x3a1d('0x2f')]=qs[_0x3a1d('0x2f')](_0x2d6bd3['query'][_0x3a1d('0x2f')]);}_0x1f22c4[_0x3a1d('0x4e')]=qs[_0x3a1d('0x4f')](_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0x4f')]);_0x1f22c4[_0x3a1d('0x53')]=qs[_0x3a1d('0x50')](_[_0x3a1d('0x51')](_0x2d6bd3['query'],_0x298ffb['filters']));_0x1f22c4[_0x3a1d('0x53')]['SmsAccountId']=_0x52d388['id'];if(_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0x52')]){_0x1f22c4[_0x3a1d('0x53')]=_['merge'](_0x1f22c4[_0x3a1d('0x53')],{'$or':_[_0x3a1d('0x3f')](_0x1f22c4['attributes'],function(_0x4a1923){var _0x349885={};_0x349885[_0x4a1923]={'$like':'%'+_0x2d6bd3[_0x3a1d('0x47')]['filter']+'%'};return _0x349885;})});}_0x1f22c4=_[_0x3a1d('0x54')]({},_0x1f22c4,_0x2d6bd3['options']);return db[_0x3a1d('0xa1')]['count']({'where':_0x1f22c4[_0x3a1d('0x53')]})[_0x3a1d('0x22')](function(_0x598886){_0x142485[_0x3a1d('0x32')]=_0x598886;if(_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0x56')]){_0x1f22c4['include']=[{'model':db[_0x3a1d('0x75')],'as':_0x3a1d('0xc3'),'required':![]},{'model':db[_0x3a1d('0xad')],'as':_0x3a1d('0xc4'),'attributes':[_0x3a1d('0x3b'),_0x3a1d('0xc5'),'internal'],'required':![]},{'model':db[_0x3a1d('0xc6')],'as':'Tags','attributes':['id','name',_0x3a1d('0xc7')],'where':_0x2d6bd3['query']['tag']?{'id':_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0xc8')]}:undefined,'required':_0x2d6bd3[_0x3a1d('0x47')][_0x3a1d('0xc8')]?!![]:![]}];}return db['SmsInteraction'][_0x3a1d('0x66')](_0x1f22c4);})[_0x3a1d('0x22')](function(_0x35690e){_0x142485[_0x3a1d('0x67')]=_0x35690e;return _0x142485;});}})[_0x3a1d('0x22')](respondWithFilteredResult(_0x8a1baf,_0x1f22c4))['catch'](handleError(_0x8a1baf,null));};exports[_0x3a1d('0x3c')]=function(_0x42d6c5,_0x272ee1,_0x2a4a03){var _0x11ba63,_0x389afa,_0x5e7bf8;if(_['isNil'](_0x42d6c5[_0x3a1d('0x5b')][_0x3a1d('0x5b')])||_0x42d6c5[_0x3a1d('0x5b')][_0x3a1d('0x5b')]===''){throw new db[(_0x3a1d('0x76'))][(_0x3a1d('0x77'))](_0x3a1d('0x99'));}if(_[_0x3a1d('0x97')](_0x42d6c5[_0x3a1d('0x5b')]['to'])){throw new db[(_0x3a1d('0x76'))][(_0x3a1d('0x77'))](_0x3a1d('0xc9'));}_0x11ba63=_0x42d6c5[_0x3a1d('0x5b')]['to'];return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x42d6c5[_0x3a1d('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x3a1d('0xca'),'include':[{'model':db['CmContact'],'as':_0x3a1d('0x9c'),'where':{'mobile':_0x11ba63},'limit':0x1,'order':[[_0x3a1d('0x7b'),_0x3a1d('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x272ee1,null))[_0x3a1d('0x22')](function(_0x50847a){if(_0x50847a&&_0x50847a[_0x3a1d('0xca')]){_0x389afa=_0x50847a[_0x3a1d('0x38')]({'plain':!![]});if(_0x389afa[_0x3a1d('0xca')]&&_0x389afa[_0x3a1d('0xca')]['Contacts'][_0x3a1d('0x4b')]){return _0x389afa[_0x3a1d('0xca')][_0x3a1d('0x9c')][0x0];}return db[_0x3a1d('0x75')][_0x3a1d('0x5a')](_[_0x3a1d('0x1a')](_0x42d6c5[_0x3a1d('0x5b')],{'firstName':_0x11ba63,'mobile':_0x11ba63,'phone':_0x11ba63,'ListId':_0x389afa[_0x3a1d('0x7d')]}));}})[_0x3a1d('0x22')](handleEntityNotFound(_0x272ee1,null))['then'](function(_0x4b1bbb){if(_0x4b1bbb){_0x5e7bf8=_0x4b1bbb;return db[_0x3a1d('0xa1')]['find']({'where':{'ContactId':_0x5e7bf8['id'],'closed':![],'SmsAccountId':_0x389afa['id']}})[_0x3a1d('0x22')](function(_0x15c27f){if(_0x15c27f){return[_0x15c27f,![]];}return db[_0x3a1d('0xa1')][_0x3a1d('0x5a')]({'UserId':_0x42d6c5['user']['id'],'ContactId':_0x5e7bf8['id'],'SmsAccountId':_0x389afa['id'],'phone':_0x11ba63,'firstMsgDirection':'out','Messages':[_[_0x3a1d('0x54')](_0x42d6c5['body'],{'read':![],'body':_0x42d6c5['body']['body'],'phone':_0x11ba63,'SmsAccountId':_0x389afa['id'],'UserId':_0x42d6c5['user']['id'],'ContactId':_0x5e7bf8['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x4dd7a7){return[_0x4dd7a7,!![]];});});}})[_0x3a1d('0xa2')](function(_0x5ad75b,_0xf86e3c){if(_0xf86e3c){return _0x5ad75b;}return db['SmsMessage'][_0x3a1d('0x5a')](_['merge'](_0x42d6c5[_0x3a1d('0x5b')],{'read':![],'body':_0x42d6c5['body'][_0x3a1d('0x5b')],'phone':_0x11ba63,'SmsAccountId':_0x389afa['id'],'SmsInteractionId':_0x5ad75b['id'],'UserId':_0x42d6c5['user']['id'],'ContactId':_0x5e7bf8['id']}))[_0x3a1d('0x22')](function(_0x282c0d){_0x5ad75b[_0x3a1d('0xcb')]['Messages']=[];_0x5ad75b[_0x3a1d('0xcb')]['Messages'][_0x3a1d('0xcc')](_0x282c0d['dataValues']);return _0x5ad75b;});})[_0x3a1d('0x22')](respondWithResult(_0x272ee1,null))['catch'](handleError(_0x272ee1,null));};exports['status']=function(_0x41a8aa,_0x173d15,_0x43cc1a){if(_0x41a8aa[_0x3a1d('0x5b')]['id']){delete _0x41a8aa[_0x3a1d('0x5b')]['id'];}var _0x5acb69,_0x227741,_0x47f17c;return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x41a8aa[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x173d15,null))[_0x3a1d('0x22')](function(_0x1ea5d5){if(_0x1ea5d5){_0x47f17c=_0x1ea5d5;logger[_0x3a1d('0x25')](_0x3a1d('0x26'),_0x3a1d('0x2e'),'received\x20delivery\x20report\x20from',_0x1ea5d5[_0x3a1d('0x43')],util[_0x3a1d('0xcd')](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1ea5d5['type']){case'skebby':if(_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xce')]&&_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x2e')]){_0x227741=_0x41a8aa[_0x3a1d('0x5b')]['status'];return db[_0x3a1d('0xa9')][_0x3a1d('0x59')]({'where':{'messageId':_0x41a8aa['body'][_0x3a1d('0xce')]}});}break;case'connectel':if(_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xcf')]&&_0x41a8aa['body'][_0x3a1d('0xd0')]){_0x227741=_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xd0')];return db['SmsMessage'][_0x3a1d('0x59')]({'where':{'messageId':_0x41a8aa[_0x3a1d('0x5b')]['requestid']}});}break;case'clicksend':if(_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x8a')]&&_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xd1')]){_0x227741=_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xd1')];return db[_0x3a1d('0xa9')][_0x3a1d('0x59')]({'where':{'messageId':_0x41a8aa['body'][_0x3a1d('0x8a')]}});}break;case _0x3a1d('0x8d'):var _0x1b5c3b=_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x8e')][0x0];if(_0x1b5c3b[_0x3a1d('0x83')]&&_0x1b5c3b['status'][_0x3a1d('0xd2')]===_0x3a1d('0xd3')){_0x227741=_0x1b5c3b[_0x3a1d('0x2e')]['groupName'];return db[_0x3a1d('0xa9')][_0x3a1d('0x59')]({'where':{'messageId':_0x1b5c3b[_0x3a1d('0x83')]}});}break;case _0x3a1d('0x92'):if(_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x83')]&&_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x2e')]){_0x227741=_0x41a8aa['body']['status'];return db[_0x3a1d('0xa9')][_0x3a1d('0x59')]({'where':{'messageId':_0x41a8aa['body'][_0x3a1d('0x83')]}});}break;case'bandwidth':if(_0x41a8aa[_0x3a1d('0x5b')][0x0][_0x3a1d('0x2a')]['id']){_0x227741=_0x41a8aa[_0x3a1d('0x5b')][0x0][_0x3a1d('0x43')];return db[_0x3a1d('0xa9')][_0x3a1d('0x59')]({'where':{'messageId':_0x41a8aa[_0x3a1d('0x5b')][0x0][_0x3a1d('0x2a')]['id']}});}break;case _0x3a1d('0x95'):if(_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xd4')]&&_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x2e')]){_0x227741=_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x2e')];return db[_0x3a1d('0xa9')]['find']({'where':{'messageId':_0x41a8aa['body'][_0x3a1d('0xd4')]}});}break;}}})[_0x3a1d('0x22')](handleEntityNotFound(_0x173d15,null))[_0x3a1d('0x22')](function(_0x26a2f0){if(_0x26a2f0){_0x5acb69=_0x26a2f0;switch(_0x47f17c[_0x3a1d('0x43')]){case _0x3a1d('0x85'):if(_0x227741===_0x3a1d('0xd3')){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3a1d('0x85'),util[_0x3a1d('0xcd')](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x227741==='1'){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')](_0x3a1d('0x26'),_0x3a1d('0x2e'),_0x3a1d('0x85'),util[_0x3a1d('0xcd')](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x3a1d('0x89'):if(!_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0xd5')]&&_0x227741>=0xc8&&_0x227741<=0xce){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger['error'](_0x3a1d('0x26'),_0x3a1d('0x2e'),'clicksend',util[_0x3a1d('0xcd')](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x3a1d('0x8d'):var _0x40f805=_0x41a8aa[_0x3a1d('0x5b')][_0x3a1d('0x8e')][0x0];if(_0x40f805[_0x3a1d('0x2e')][_0x3a1d('0xd2')]===_0x3a1d('0xd3')){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3a1d('0x8d'),util[_0x3a1d('0xcd')](_0x41a8aa['body'],{'showHidden':![],'depth':null}));}break;case _0x3a1d('0x92'):if(_0x227741==_0x3a1d('0xd6')||_0x227741==_0x3a1d('0xd7')){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')](_0x3a1d('0x26'),_0x3a1d('0x2e'),_0x3a1d('0x92'),util[_0x3a1d('0xcd')](_0x41a8aa['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x227741=='message-delivered'){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3a1d('0xd8'),util['inspect'](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x227741==='DELIVRD'||_0x227741===_0x3a1d('0xd9')){return _0x5acb69[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')](_0x3a1d('0x26'),_0x3a1d('0x2e'),_0x3a1d('0x95'),util[_0x3a1d('0xcd')](_0x41a8aa[_0x3a1d('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5acb69;}})[_0x3a1d('0x22')](respondWithResult(_0x173d15,null))['catch'](handleError(_0x173d15,null));};exports[_0x3a1d('0xda')]=function(_0x146be0,_0x524af6,_0x1b9d7a){var _0x1eb4c2,_0x21dbf3,_0x3d802d;return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x146be0[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x524af6,null))[_0x3a1d('0x22')](function(_0x512cfe){if(_0x512cfe){_0x3d802d=_0x512cfe;logger['debug'](_0x3a1d('0x26'),'status',_0x3a1d('0xdb'),_0x512cfe[_0x3a1d('0x43')],util[_0x3a1d('0xcd')](_0x146be0[_0x3a1d('0x47')],{'showHidden':![],'depth':null}));switch(_0x512cfe['type']){case'csc':if(_0x146be0[_0x3a1d('0x47')][_0x3a1d('0xdc')]&&_0x146be0[_0x3a1d('0x47')][_0x3a1d('0xdd')]){_0x21dbf3=_0x146be0[_0x3a1d('0x47')][_0x3a1d('0xdd')];return db[_0x3a1d('0xa9')]['find']({'where':{'messageId':_0x146be0[_0x3a1d('0x47')]['message-id']}});}break;}}})[_0x3a1d('0x22')](handleEntityNotFound(_0x524af6,null))[_0x3a1d('0x22')](function(_0x437c32){if(_0x437c32){_0x1eb4c2=_0x437c32;switch(_0x3d802d['type']){case _0x3a1d('0x8f'):if(_0x21dbf3==='2'||_0x21dbf3==='6'){return _0x1eb4c2[_0x3a1d('0x36')]({'read':!![]});}else{logger[_0x3a1d('0x28')](_0x3a1d('0x26'),_0x3a1d('0x2e'),_0x3a1d('0x8f'),util[_0x3a1d('0xcd')](_0x146be0[_0x3a1d('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1eb4c2;}})['then'](respondWithResult(_0x524af6,null))[_0x3a1d('0x2c')](handleError(_0x524af6,null));};exports['addAgents']=function(_0x5b7e3d,_0xf411f4,_0x3ac0c4){return db[_0x3a1d('0x40')]['find']({'where':{'id':_0x5b7e3d[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0xf411f4,null))[_0x3a1d('0x22')](function(_0x3991ef){if(_0x3991ef){return _0x3991ef['addAgents'](_0x5b7e3d['body'][_0x3a1d('0xde')],_[_0x3a1d('0x9f')](_0x5b7e3d[_0x3a1d('0x5b')],[_0x3a1d('0xde'),'id'])||{})[_0x3a1d('0xa2')](function(_0x3f91c7){for(var _0x234346=0x0;_0x234346<_0x5b7e3d[_0x3a1d('0x5b')]['ids']['length'];_0x234346+=0x1){socket['emit'](_0x3a1d('0xdf'),{'UserId':Number(_0x5b7e3d[_0x3a1d('0x5b')][_0x3a1d('0xde')][_0x234346]),'SmsAccountId':Number(_0x5b7e3d[_0x3a1d('0x58')]['id'])});}return _0x3f91c7;});}})['then'](respondWithResult(_0xf411f4,null))[_0x3a1d('0x2c')](handleError(_0xf411f4,null));};exports[_0x3a1d('0xe0')]=function(_0x7dc4fa,_0xd371d3,_0x414ebf){return db[_0x3a1d('0x40')][_0x3a1d('0x59')]({'where':{'id':_0x7dc4fa[_0x3a1d('0x58')]['id']}})['then'](handleEntityNotFound(_0xd371d3,null))[_0x3a1d('0x22')](function(_0x4400af){if(_0x4400af){return _0x4400af[_0x3a1d('0xe0')](_0x7dc4fa[_0x3a1d('0x47')][_0x3a1d('0xde')])[_0x3a1d('0x22')](function(){if(_[_0x3a1d('0xe1')](_0x7dc4fa[_0x3a1d('0x47')][_0x3a1d('0xde')])){for(var _0x4e3018=0x0;_0x4e3018<_0x7dc4fa[_0x3a1d('0x47')][_0x3a1d('0xde')][_0x3a1d('0x4b')];_0x4e3018+=0x1){socket[_0x3a1d('0xe2')](_0x3a1d('0xe3'),{'UserId':Number(_0x7dc4fa[_0x3a1d('0x47')][_0x3a1d('0xde')][_0x4e3018]),'SmsAccountId':Number(_0x7dc4fa['params']['id'])});}}else{socket[_0x3a1d('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x7dc4fa[_0x3a1d('0x47')][_0x3a1d('0xde')]),'SmsAccountId':Number(_0x7dc4fa[_0x3a1d('0x58')]['id'])});}});}})[_0x3a1d('0x22')](respondWithStatusCode(_0xd371d3,null))[_0x3a1d('0x2c')](handleError(_0xd371d3,null));};exports['getAgents']=function(_0x4e6009,_0x472027,_0x5baa6d){var _0x4b37c4={};var _0x1e0788={};var _0xf84732;var _0x5c93a9;return db[_0x3a1d('0x40')]['findOne']({'where':{'id':_0x4e6009[_0x3a1d('0x58')]['id']}})[_0x3a1d('0x22')](handleEntityNotFound(_0x472027,null))['then'](function(_0x2a4f9b){if(_0x2a4f9b){_0xf84732=_0x2a4f9b;_0x1e0788[_0x3a1d('0x45')]=_[_0x3a1d('0x46')](db[_0x3a1d('0xad')][_0x3a1d('0x41')]);_0x1e0788[_0x3a1d('0x47')]=_['keys'](_0x4e6009[_0x3a1d('0x47')]);_0x1e0788['filters']=_[_0x3a1d('0x48')](_0x1e0788['model'],_0x1e0788[_0x3a1d('0x47')]);_0x4b37c4[_0x3a1d('0x4a')]=_['intersection'](_0x1e0788[_0x3a1d('0x45')],qs['fields'](_0x4e6009[_0x3a1d('0x47')]['fields']));_0x4b37c4[_0x3a1d('0x4a')]=_0x4b37c4[_0x3a1d('0x4a')][_0x3a1d('0x4b')]?_0x4b37c4[_0x3a1d('0x4a')]:_0x1e0788['model'];_0x4b37c4[_0x3a1d('0x4e')]=qs[_0x3a1d('0x4f')](_0x4e6009[_0x3a1d('0x47')][_0x3a1d('0x4f')]);_0x4b37c4[_0x3a1d('0x53')]=qs['filters'](_['pick'](_0x4e6009[_0x3a1d('0x47')],_0x1e0788['filters']));if(_0x4e6009[_0x3a1d('0x47')][_0x3a1d('0x52')]){_0x4b37c4[_0x3a1d('0x53')]=_[_0x3a1d('0x54')](_0x4b37c4[_0x3a1d('0x53')],{'$or':_[_0x3a1d('0x3f')](_0x4b37c4[_0x3a1d('0x4a')],function(_0x104611){var _0x3cc80b={};_0x3cc80b[_0x104611]={'$like':'%'+_0x4e6009['query']['filter']+'%'};return _0x3cc80b;})});}_0x4b37c4=_[_0x3a1d('0x54')]({},_0x4b37c4,_0x4e6009['options']);return _0xf84732['getAgents'](_0x4b37c4);}})[_0x3a1d('0x22')](function(_0x2a2815){if(_0x2a2815){_0x5c93a9=_0x2a2815[_0x3a1d('0x4b')];if(!_0x4e6009['query'][_0x3a1d('0x4c')](_0x3a1d('0x4d'))){_0x4b37c4[_0x3a1d('0x31')]=qs['limit'](_0x4e6009[_0x3a1d('0x47')][_0x3a1d('0x31')]);_0x4b37c4['offset']=qs[_0x3a1d('0x2f')](_0x4e6009[_0x3a1d('0x47')][_0x3a1d('0x2f')]);}return _0xf84732[_0x3a1d('0xe4')](_0x4b37c4);}})['then'](function(_0x37c123){if(_0x37c123){return _0x37c123?{'count':_0x5c93a9,'rows':_0x37c123}:null;}})[_0x3a1d('0x22')](respondWithResult(_0x472027,null))[_0x3a1d('0x2c')](handleError(_0x472027,null));}; \ No newline at end of file +var _0x4ad8=['account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','bulkCreate','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','intelepeer','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','mandatoryDispositionPause','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','userProfileId','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc'];(function(_0x27ea47,_0x59a671){var _0xc16fb8=function(_0x5db732){while(--_0x5db732){_0x27ea47['push'](_0x27ea47['shift']());}};_0xc16fb8(++_0x59a671);}(_0x4ad8,0x70));var _0x84ad=function(_0x26d92f,_0x454c88){_0x26d92f=_0x26d92f-0x0;var _0x5930c3=_0x4ad8[_0x26d92f];return _0x5930c3;};'use strict';var emlformat=require(_0x84ad('0x0'));var rimraf=require(_0x84ad('0x1'));var zipdir=require(_0x84ad('0x2'));var jsonpatch=require(_0x84ad('0x3'));var rp=require('request-promise');var moment=require(_0x84ad('0x4'));var BPromise=require(_0x84ad('0x5'));var Mustache=require(_0x84ad('0x6'));var util=require(_0x84ad('0x7'));var path=require(_0x84ad('0x8'));var sox=require(_0x84ad('0x9'));var csv=require(_0x84ad('0xa'));var ejs=require(_0x84ad('0xb'));var fs=require('fs');var fs_extra=require(_0x84ad('0xc'));var _=require('lodash');var squel=require(_0x84ad('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x84ad('0xe'));var toCsv=require(_0x84ad('0xa'));var querystring=require(_0x84ad('0xf'));var Papa=require(_0x84ad('0x10'));var Redis=require(_0x84ad('0x11'));var authService=require(_0x84ad('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ad('0x13'));var logger=require('../../config/logger')(_0x84ad('0x14'));var utils=require(_0x84ad('0x15'));var config=require(_0x84ad('0x16'));var licenseUtil=require(_0x84ad('0x17'));var db=require(_0x84ad('0x18'))['db'];config['redis']=_[_0x84ad('0x19')](config[_0x84ad('0x1a')],{'host':_0x84ad('0x1b'),'port':0x18eb});var socket=require(_0x84ad('0x1c'))(new Redis(config[_0x84ad('0x1a')]));require(_0x84ad('0x1d'))[_0x84ad('0x1e')](socket);var jayson=require(_0x84ad('0x1f'));var client=jayson['client'][_0x84ad('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x42b735,_0x3fc60f,_0x21f2a6,_0x51908c){return new BPromise(function(_0x5846d5,_0x20298f){var _0x510908=_0x51908c||client;return _0x510908[_0x84ad('0x21')](_0x42b735,_0x21f2a6)[_0x84ad('0x22')](function(_0x3babc4){logger['info'](_0x84ad('0x23'),_0x3fc60f,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fc60f,_0x84ad('0x24'),JSON[_0x84ad('0x25')](_0x3babc4));if(_0x3babc4[_0x84ad('0x26')]){if(_0x3babc4['error']['code']===0x1f4){logger['error'](_0x84ad('0x23'),_0x3fc60f,_0x3babc4['error'][_0x84ad('0x27')]);return _0x20298f(_0x3babc4[_0x84ad('0x26')][_0x84ad('0x27')]);}logger[_0x84ad('0x26')]('SmsAccount,\x20%s,\x20%s',_0x3fc60f,_0x3babc4[_0x84ad('0x26')]['message']);return _0x5846d5(_0x3babc4[_0x84ad('0x26')][_0x84ad('0x27')]);}else{logger[_0x84ad('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3fc60f,_0x84ad('0x24'));_0x5846d5(_0x3babc4[_0x84ad('0x29')][_0x84ad('0x27')]);}})['catch'](function(_0x482b44){logger[_0x84ad('0x26')]('SmsAccount,\x20%s,\x20%s',_0x3fc60f,_0x482b44);_0x20298f(_0x482b44);});});}function respondWithStatusCode(_0x749962,_0x4e301d){_0x4e301d=_0x4e301d||0xcc;return function(_0x494190){if(_0x494190){return _0x749962[_0x84ad('0x2a')](_0x4e301d);}return _0x749962[_0x84ad('0x2b')](_0x4e301d)[_0x84ad('0x2c')]();};}function respondWithResult(_0x31a92,_0x10841d){_0x10841d=_0x10841d||0xc8;return function(_0x129981){if(_0x129981){return _0x31a92['status'](_0x10841d)[_0x84ad('0x2d')](_0x129981);}};}function respondWithFilteredResult(_0x2cf5d8,_0x27fb97){return function(_0x50cefe){if(_0x50cefe){var _0x40379e=typeof _0x27fb97[_0x84ad('0x2e')]==='undefined'&&typeof _0x27fb97[_0x84ad('0x2f')]===_0x84ad('0x30');var _0x11323b=_0x50cefe[_0x84ad('0x31')];var _0x3d845c=_0x40379e?0x0:_0x27fb97[_0x84ad('0x2e')];var _0x2f83e0=_0x40379e?_0x50cefe[_0x84ad('0x31')]:_0x27fb97['offset']+_0x27fb97['limit'];var _0x28186e;if(_0x2f83e0>=_0x11323b){_0x2f83e0=_0x11323b;_0x28186e=0xc8;}else{_0x28186e=0xce;}_0x2cf5d8[_0x84ad('0x2b')](_0x28186e);return _0x2cf5d8[_0x84ad('0x32')](_0x84ad('0x33'),_0x3d845c+'-'+_0x2f83e0+'/'+_0x11323b)[_0x84ad('0x2d')](_0x50cefe);}return null;};}function patchUpdates(_0x4821d1){return function(_0x54c5ec){try{jsonpatch[_0x84ad('0x34')](_0x54c5ec,_0x4821d1,!![]);}catch(_0xef660b){return BPromise['reject'](_0xef660b);}return _0x54c5ec[_0x84ad('0x35')]();};}function saveUpdates(_0x14987d,_0xfe2793){return function(_0x1a3986){if(_0x1a3986){return _0x1a3986[_0x84ad('0x36')](_0x14987d)[_0x84ad('0x22')](function(_0x25875f){return _0x25875f;});}return null;};}function removeEntity(_0x37663d,_0x2fbede){return function(_0x16ad78){if(_0x16ad78){return _0x16ad78['destroy']()[_0x84ad('0x22')](function(){var _0x556f75=_0x16ad78[_0x84ad('0x37')]({'plain':!![]});var _0x58011a='SmsAccounts';return db[_0x84ad('0x38')]['destroy']({'where':{'type':_0x58011a,'resourceId':_0x556f75['id']}})[_0x84ad('0x22')](function(){return _0x16ad78;});})[_0x84ad('0x22')](function(){_0x37663d[_0x84ad('0x2b')](0xcc)[_0x84ad('0x2c')]();});}};}function handleEntityNotFound(_0x5d3645,_0x4e860d){return function(_0x5f2661){if(!_0x5f2661){_0x5d3645[_0x84ad('0x2a')](0x194);}return _0x5f2661;};}function handleError(_0x2d9ce3,_0x120e40){_0x120e40=_0x120e40||0x1f4;return function(_0x422422){logger[_0x84ad('0x26')](_0x422422[_0x84ad('0x39')]);if(_0x422422[_0x84ad('0x3a')]){delete _0x422422[_0x84ad('0x3a')];}_0x2d9ce3[_0x84ad('0x2b')](_0x120e40)[_0x84ad('0x3b')](_0x422422);};}exports[_0x84ad('0x3c')]=function(_0x11339b,_0x1df1f5){var _0x380704={'include':[{'model':db[_0x84ad('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2010db={},_0x136bf9={'count':0x0,'rows':[]};var _0x3f91e5=_[_0x84ad('0x3e')](db[_0x84ad('0x3f')][_0x84ad('0x40')],function(_0x3e5100){return{'name':_0x3e5100[_0x84ad('0x41')],'type':_0x3e5100[_0x84ad('0x42')][_0x84ad('0x43')]};});_0x2010db[_0x84ad('0x44')]=_[_0x84ad('0x3e')](_0x3f91e5,_0x84ad('0x3a'));_0x2010db['query']=_[_0x84ad('0x45')](_0x11339b[_0x84ad('0x46')]);_0x2010db[_0x84ad('0x47')]=_[_0x84ad('0x48')](_0x2010db[_0x84ad('0x44')],_0x2010db[_0x84ad('0x46')]);_0x380704[_0x84ad('0x49')]=_[_0x84ad('0x48')](_0x2010db[_0x84ad('0x44')],qs[_0x84ad('0x4a')](_0x11339b[_0x84ad('0x46')][_0x84ad('0x4a')]));_0x380704[_0x84ad('0x49')]=_0x380704['attributes'][_0x84ad('0x4b')]?_0x380704['attributes']:_0x2010db[_0x84ad('0x44')];if(!_0x11339b[_0x84ad('0x46')][_0x84ad('0x4c')]('nolimit')){_0x380704[_0x84ad('0x2f')]=qs['limit'](_0x11339b[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x380704[_0x84ad('0x2e')]=qs[_0x84ad('0x2e')](_0x11339b[_0x84ad('0x46')][_0x84ad('0x2e')]);}_0x380704[_0x84ad('0x4d')]=qs['sort'](_0x11339b[_0x84ad('0x46')][_0x84ad('0x4e')]);_0x380704[_0x84ad('0x4f')]=qs[_0x84ad('0x47')](_[_0x84ad('0x50')](_0x11339b[_0x84ad('0x46')],_0x2010db['filters']),_0x3f91e5);if(_0x11339b[_0x84ad('0x46')]['filter']){_0x380704['where']=_[_0x84ad('0x51')](_0x380704[_0x84ad('0x4f')],{'$or':_['map'](_0x3f91e5,function(_0x24bb45){if(_0x24bb45[_0x84ad('0x42')]!==_0x84ad('0x52')){var _0x47fc2a={};_0x47fc2a[_0x24bb45[_0x84ad('0x3a')]]={'$like':'%'+_0x11339b[_0x84ad('0x46')][_0x84ad('0x53')]+'%'};return _0x47fc2a;}})});}_0x380704=_[_0x84ad('0x51')]({},_0x380704,_0x11339b[_0x84ad('0x54')]);var _0x434005={'where':_0x380704[_0x84ad('0x4f')]};return db[_0x84ad('0x3f')][_0x84ad('0x31')](_0x434005)[_0x84ad('0x22')](function(_0x398e76){_0x136bf9['count']=_0x398e76;if(_0x11339b[_0x84ad('0x46')]['includeAll']){_0x380704[_0x84ad('0x55')]=[{'all':!![]}];}return db[_0x84ad('0x3f')][_0x84ad('0x56')](_0x380704);})['then'](function(_0x5f6298){_0x136bf9[_0x84ad('0x57')]=_0x5f6298;return _0x136bf9;})[_0x84ad('0x22')](respondWithFilteredResult(_0x1df1f5,_0x380704))[_0x84ad('0x58')](handleError(_0x1df1f5,null));};exports['show']=function(_0x3e2401,_0x430083){var _0x541c61={'raw':![],'where':{'id':_0x3e2401[_0x84ad('0x59')]['id']},'include':[{'model':db[_0x84ad('0x3d')],'as':_0x84ad('0x5a')}]},_0x339ee4={};_0x339ee4['model']=_[_0x84ad('0x45')](db[_0x84ad('0x3f')]['rawAttributes']);_0x339ee4['query']=_[_0x84ad('0x45')](_0x3e2401['query']);_0x339ee4[_0x84ad('0x47')]=_[_0x84ad('0x48')](_0x339ee4[_0x84ad('0x44')],_0x339ee4[_0x84ad('0x46')]);_0x541c61['attributes']=_[_0x84ad('0x48')](_0x339ee4[_0x84ad('0x44')],qs['fields'](_0x3e2401['query'][_0x84ad('0x4a')]));_0x541c61['attributes']=_0x541c61['attributes'][_0x84ad('0x4b')]?_0x541c61[_0x84ad('0x49')]:_0x339ee4[_0x84ad('0x44')];if(_0x3e2401[_0x84ad('0x46')][_0x84ad('0x5b')]){_0x541c61[_0x84ad('0x55')]=[{'all':!![]}];}_0x541c61=_[_0x84ad('0x51')]({},_0x541c61,_0x3e2401[_0x84ad('0x54')]);return db['SmsAccount'][_0x84ad('0x5c')](_0x541c61)['then'](handleEntityNotFound(_0x430083,null))['then'](respondWithResult(_0x430083,null))[_0x84ad('0x58')](handleError(_0x430083,null));};exports[_0x84ad('0x5d')]=function(_0xddd029,_0x49a9cd){return db[_0x84ad('0x3f')][_0x84ad('0x5d')](_0xddd029[_0x84ad('0x5e')],{})['then'](function(_0x5e997a){var _0x5654a0=_0xddd029[_0x84ad('0x5f')][_0x84ad('0x37')]({'plain':!![]});if(!_0x5654a0)throw new Error(_0x84ad('0x60'));if(_0x5654a0[_0x84ad('0x61')]==='user'){var _0x34ac75=_0x5e997a[_0x84ad('0x37')]({'plain':!![]});var _0xaa34f7=_0x84ad('0x62');return db['UserProfileSection']['find']({'where':{'name':_0xaa34f7,'userProfileId':_0x5654a0[_0x84ad('0x63')]},'raw':!![]})[_0x84ad('0x22')](function(_0x215440){if(_0x215440&&_0x215440['autoAssociation']===0x0){return db[_0x84ad('0x38')][_0x84ad('0x5d')]({'name':_0x34ac75[_0x84ad('0x3a')],'resourceId':_0x34ac75['id'],'type':_0x215440[_0x84ad('0x3a')],'sectionId':_0x215440['id']},{})[_0x84ad('0x22')](function(){return _0x5e997a;});}else{return _0x5e997a;}})[_0x84ad('0x58')](function(_0xd4e32){logger[_0x84ad('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd4e32);throw _0xd4e32;});}return _0x5e997a;})[_0x84ad('0x22')](respondWithResult(_0x49a9cd,0xc9))['catch'](handleError(_0x49a9cd,null));};exports[_0x84ad('0x36')]=function(_0x2db4a7,_0x5a01f3){if(_0x2db4a7[_0x84ad('0x5e')]['id']){delete _0x2db4a7[_0x84ad('0x5e')]['id'];}return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x2db4a7[_0x84ad('0x59')]['id']},'include':[{'model':db[_0x84ad('0x3d')],'as':_0x84ad('0x5a')}]})[_0x84ad('0x22')](handleEntityNotFound(_0x5a01f3,null))[_0x84ad('0x22')](saveUpdates(_0x2db4a7[_0x84ad('0x5e')],null))[_0x84ad('0x22')](respondWithResult(_0x5a01f3,null))[_0x84ad('0x58')](handleError(_0x5a01f3,null));};exports['destroy']=function(_0x3ed0c9,_0x500476){return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x3ed0c9['params']['id']}})['then'](handleEntityNotFound(_0x500476,null))[_0x84ad('0x22')](removeEntity(_0x500476,null))[_0x84ad('0x58')](handleError(_0x500476,null));};exports[_0x84ad('0x64')]=function(_0x443d6a,_0x30811a){return db['SmsAccount'][_0x84ad('0x64')]()[_0x84ad('0x22')](respondWithResult(_0x30811a,null))[_0x84ad('0x58')](handleError(_0x30811a,null));};exports[_0x84ad('0x65')]=function(_0x1f67d0,_0x5bbdcf,_0x15e86e){if(_0x1f67d0[_0x84ad('0x5e')]['id']){delete _0x1f67d0['body']['id'];}return db['SmsAccount'][_0x84ad('0x5c')]({'where':{'id':_0x1f67d0[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x5bbdcf,null))[_0x84ad('0x22')](function(_0x1f374f){if(_0x1f374f){_0x1f67d0['body'][_0x84ad('0x66')]=_0x1f374f['id'];return db[_0x84ad('0x67')][_0x84ad('0x5d')](_0x1f67d0['body']);}})[_0x84ad('0x22')](respondWithResult(_0x5bbdcf,null))[_0x84ad('0x58')](handleError(_0x5bbdcf,null));};exports[_0x84ad('0x68')]=function(_0x106bd2,_0x3218fb,_0x5dea68){var _0x864e73={'raw':![],'where':{}};var _0x406ae8={};var _0x16dc20={'count':0x0,'rows':[]};return db[_0x84ad('0x3f')][_0x84ad('0x69')]({'where':{'id':_0x106bd2[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x3218fb,null))[_0x84ad('0x22')](function(_0x187046){if(_0x187046){_0x406ae8[_0x84ad('0x44')]=_[_0x84ad('0x45')](db[_0x84ad('0x67')][_0x84ad('0x40')]);_0x406ae8[_0x84ad('0x46')]=_[_0x84ad('0x45')](_0x106bd2[_0x84ad('0x46')]);_0x406ae8['filters']=_[_0x84ad('0x48')](_0x406ae8[_0x84ad('0x44')],_0x406ae8[_0x84ad('0x46')]);_0x864e73[_0x84ad('0x49')]=_[_0x84ad('0x48')](_0x406ae8[_0x84ad('0x44')],qs[_0x84ad('0x4a')](_0x106bd2['query']['fields']));_0x864e73[_0x84ad('0x49')]=_0x864e73[_0x84ad('0x49')][_0x84ad('0x4b')]?_0x864e73['attributes']:_0x406ae8[_0x84ad('0x44')];if(!_0x106bd2[_0x84ad('0x46')][_0x84ad('0x4c')](_0x84ad('0x6a'))){_0x864e73[_0x84ad('0x2f')]=qs[_0x84ad('0x2f')](_0x106bd2[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x864e73['offset']=qs[_0x84ad('0x2e')](_0x106bd2[_0x84ad('0x46')][_0x84ad('0x2e')]);}_0x864e73[_0x84ad('0x4d')]=qs[_0x84ad('0x4e')](_0x106bd2[_0x84ad('0x46')]['sort']);_0x864e73['where']=qs['filters'](_[_0x84ad('0x50')](_0x106bd2[_0x84ad('0x46')],_0x406ae8[_0x84ad('0x47')]));_0x864e73[_0x84ad('0x4f')][_0x84ad('0x66')]=_0x187046['id'];if(_0x106bd2[_0x84ad('0x46')][_0x84ad('0x53')]){_0x864e73[_0x84ad('0x4f')]=_[_0x84ad('0x51')](_0x864e73['where'],{'$or':_[_0x84ad('0x3e')](_0x864e73[_0x84ad('0x49')],function(_0x59e61e){var _0x926044={};_0x926044[_0x59e61e]={'$like':'%'+_0x106bd2[_0x84ad('0x46')][_0x84ad('0x53')]+'%'};return _0x926044;})});}_0x864e73=_[_0x84ad('0x51')]({},_0x864e73,_0x106bd2['options']);return db[_0x84ad('0x67')][_0x84ad('0x31')]({'where':_0x864e73['where']})[_0x84ad('0x22')](function(_0x5b7d06){_0x16dc20[_0x84ad('0x31')]=_0x5b7d06;if(_0x106bd2[_0x84ad('0x46')][_0x84ad('0x5b')]){_0x864e73['include']=[{'all':!![]}];}return db[_0x84ad('0x67')][_0x84ad('0x56')](_0x864e73);})['then'](function(_0x3972bf){_0x16dc20[_0x84ad('0x57')]=_0x3972bf;return _0x16dc20;});}})[_0x84ad('0x22')](respondWithFilteredResult(_0x3218fb,_0x864e73))[_0x84ad('0x58')](handleError(_0x3218fb,null));};exports[_0x84ad('0x6b')]=function(_0x57e948,_0x47641f,_0x234878){return db['SmsAccount'][_0x84ad('0x5c')]({'where':{'id':_0x57e948[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x47641f,null))[_0x84ad('0x22')](function(_0x36150a){if(_0x36150a){return _0x36150a[_0x84ad('0x6b')](_0x57e948[_0x84ad('0x46')][_0x84ad('0x6c')]);}})['then'](respondWithStatusCode(_0x47641f,null))['catch'](handleError(_0x47641f,null));};exports[_0x84ad('0x6d')]=function(_0x333880,_0x4524b9,_0x13b5ab){if(_0x333880['body']['id']){delete _0x333880[_0x84ad('0x5e')]['id'];}return db['SmsAccount'][_0x84ad('0x5c')]({'where':{'id':_0x333880[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x4524b9,null))[_0x84ad('0x22')](function(_0x4d25be){if(_0x4d25be){_0x333880[_0x84ad('0x5e')][_0x84ad('0x66')]=_0x4d25be['id'];return db[_0x84ad('0x6e')]['create'](_0x333880[_0x84ad('0x5e')]);}})[_0x84ad('0x22')](respondWithResult(_0x4524b9,null))['catch'](handleError(_0x4524b9,null));};exports[_0x84ad('0x6f')]=function(_0x2835e6,_0x11a0d1,_0x14d6d3){var _0x4fd0d9={'raw':![],'where':{}};var _0x417c5d={};var _0x5ee566={'count':0x0,'rows':[]};return db[_0x84ad('0x3f')][_0x84ad('0x69')]({'where':{'id':_0x2835e6[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x11a0d1,null))[_0x84ad('0x22')](function(_0x5f1480){if(_0x5f1480){_0x417c5d[_0x84ad('0x44')]=_[_0x84ad('0x45')](db['CannedAnswer'][_0x84ad('0x40')]);_0x417c5d[_0x84ad('0x46')]=_[_0x84ad('0x45')](_0x2835e6[_0x84ad('0x46')]);_0x417c5d[_0x84ad('0x47')]=_[_0x84ad('0x48')](_0x417c5d[_0x84ad('0x44')],_0x417c5d[_0x84ad('0x46')]);_0x4fd0d9[_0x84ad('0x49')]=_[_0x84ad('0x48')](_0x417c5d[_0x84ad('0x44')],qs[_0x84ad('0x4a')](_0x2835e6['query'][_0x84ad('0x4a')]));_0x4fd0d9['attributes']=_0x4fd0d9[_0x84ad('0x49')][_0x84ad('0x4b')]?_0x4fd0d9[_0x84ad('0x49')]:_0x417c5d[_0x84ad('0x44')];if(!_0x2835e6[_0x84ad('0x46')][_0x84ad('0x4c')](_0x84ad('0x6a'))){_0x4fd0d9[_0x84ad('0x2f')]=qs[_0x84ad('0x2f')](_0x2835e6[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x4fd0d9[_0x84ad('0x2e')]=qs[_0x84ad('0x2e')](_0x2835e6['query'][_0x84ad('0x2e')]);}_0x4fd0d9[_0x84ad('0x4d')]=qs[_0x84ad('0x4e')](_0x2835e6[_0x84ad('0x46')][_0x84ad('0x4e')]);_0x4fd0d9['where']=qs[_0x84ad('0x47')](_[_0x84ad('0x50')](_0x2835e6[_0x84ad('0x46')],_0x417c5d[_0x84ad('0x47')]));_0x4fd0d9[_0x84ad('0x4f')][_0x84ad('0x66')]=_0x5f1480['id'];if(_0x2835e6[_0x84ad('0x46')][_0x84ad('0x53')]){_0x4fd0d9['where']=_['merge'](_0x4fd0d9[_0x84ad('0x4f')],{'$or':_[_0x84ad('0x3e')](_0x4fd0d9[_0x84ad('0x49')],function(_0x5a4f22){var _0x5154b7={};_0x5154b7[_0x5a4f22]={'$like':'%'+_0x2835e6[_0x84ad('0x46')][_0x84ad('0x53')]+'%'};return _0x5154b7;})});}_0x4fd0d9=_[_0x84ad('0x51')]({},_0x4fd0d9,_0x2835e6[_0x84ad('0x54')]);return db[_0x84ad('0x6e')][_0x84ad('0x31')]({'where':_0x4fd0d9['where']})[_0x84ad('0x22')](function(_0x39ab24){_0x5ee566[_0x84ad('0x31')]=_0x39ab24;if(_0x2835e6['query'][_0x84ad('0x5b')]){_0x4fd0d9['include']=[{'all':!![]}];}return db[_0x84ad('0x6e')][_0x84ad('0x56')](_0x4fd0d9);})[_0x84ad('0x22')](function(_0x683ef6){_0x5ee566[_0x84ad('0x57')]=_0x683ef6;return _0x5ee566;});}})[_0x84ad('0x22')](respondWithFilteredResult(_0x11a0d1,_0x4fd0d9))[_0x84ad('0x58')](handleError(_0x11a0d1,null));};exports[_0x84ad('0x70')]=function(_0x3c1186,_0x3ec6d1,_0x4c7aaa){return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x3c1186['params']['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x3ec6d1,null))[_0x84ad('0x22')](function(_0x3c88bf){if(_0x3c88bf){return _0x3c88bf['removeAnswers'](_0x3c1186['query'][_0x84ad('0x6c')]);}})[_0x84ad('0x22')](respondWithStatusCode(_0x3ec6d1,null))['catch'](handleError(_0x3ec6d1,null));};exports[_0x84ad('0x71')]=function(_0x1f5444,_0x947d29,_0x296bb9){var _0xbb1fa3={'channel':_0x84ad('0x72')};var _0x3a0b09=[];var _0x23cd8c=[];var _0x4f3515={};return db['SmsAccount'][_0x84ad('0x5c')]({'where':{'id':_0x1f5444[_0x84ad('0x59')]['id']},'include':[{'model':db[_0x84ad('0x73')],'as':_0x84ad('0x74')}]})[_0x84ad('0x22')](handleEntityNotFound(_0x947d29,null))[_0x84ad('0x22')](function(_0x3aeafb){_0xbb1fa3['account']=_0x3aeafb;_0xbb1fa3[_0x84ad('0x75')]=_['orderBy'](_0x3aeafb['Applications'],[_0x84ad('0x76')],[_0x84ad('0x77')]);if(_0xbb1fa3[_0x84ad('0x78')]['Applications']){delete _0xbb1fa3[_0x84ad('0x78')][_0x84ad('0x74')];}return db[_0x84ad('0x79')][_0x84ad('0x64')]();})[_0x84ad('0x22')](function(_0x2cc635){if(!_0x2cc635){throw new db[(_0x84ad('0x7a'))][(_0x84ad('0x7b'))](_0x84ad('0x7c'));}_0x3a0b09=_[_0x84ad('0x7d')](_[_0x84ad('0x45')](_0x2cc635),[_0x84ad('0x7e'),_0x84ad('0x7f')]);_0x23cd8c=_[_0x84ad('0x7d')](_[_0x84ad('0x45')](_0x2cc635),[_0x84ad('0x7e'),_0x84ad('0x7f'),_0x84ad('0x80'),_0x84ad('0x81')]);_0xbb1fa3[_0x84ad('0x5e')]={'mapKey':_0x84ad('0x82')};if(_0xbb1fa3['account'][_0x84ad('0x42')]){switch(_0xbb1fa3['account'][_0x84ad('0x42')]){case _0x84ad('0x83'):_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x85')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')]['Body'];_0xbb1fa3[_0x84ad('0x5e')]['messageId']=_0x1f5444[_0x84ad('0x5e')]['MessageSid'];break;case _0x84ad('0x86'):_0xbb1fa3['body'][_0x84ad('0x84')]='+'+_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x87')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x88')];break;case _0x84ad('0x89'):_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x84')];_0xbb1fa3[_0x84ad('0x5e')]['body']=_0x1f5444[_0x84ad('0x5e')]['message'];break;case _0x84ad('0x8a'):_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x84')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x5e')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x8b')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x8c')];break;case _0x84ad('0x8d'):_0xbb1fa3[_0x84ad('0x5e')]['from']=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x85')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x8e')];_0xbb1fa3['body'][_0x84ad('0x8b')]=_0x1f5444[_0x84ad('0x5e')]['MessageUUID'];break;case'infobip':_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]='+'+_0x1f5444['body'][_0x84ad('0x8f')][0x0][_0x84ad('0x84')];_0xbb1fa3[_0x84ad('0x5e')]['body']=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x8f')][0x0]['text'];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x8b')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x8f')][0x0][_0x84ad('0x8b')];break;case _0x84ad('0x90'):_0xbb1fa3[_0x84ad('0x5e')]['from']=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x91')];_0xbb1fa3[_0x84ad('0x5e')]['body']=_0x1f5444['body'][_0x84ad('0x92')][_0x84ad('0x27')];break;case _0x84ad('0x93'):_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444[_0x84ad('0x5e')]['fromNumber'];_0xbb1fa3['body'][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x88')];_0xbb1fa3[_0x84ad('0x5e')]['messageId']=_0x1f5444[_0x84ad('0x5e')][_0x84ad('0x94')];break;case _0x84ad('0x95'):_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x8b')]=_0x1f5444[_0x84ad('0x5e')][0x0]['message']['id'];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444[_0x84ad('0x5e')][0x0][_0x84ad('0x27')][_0x84ad('0x84')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444[_0x84ad('0x5e')][0x0]['message'][_0x84ad('0x88')];break;case'intelepeer':_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')]=_0x1f5444['body'][_0x84ad('0x84')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]=_0x1f5444['body'][_0x84ad('0x27')];_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x8b')]=_0x1f5444['body'][_0x84ad('0x96')];break;}}if(_0xbb1fa3['body']['id']){delete _0xbb1fa3['body']['id'];}if(_['isNil'](_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')])){throw new db[(_0x84ad('0x7a'))]['ValidationError'](_0x84ad('0x97'));}if(_[_0x84ad('0x98')](_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')])||_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')]===''){throw new db[(_0x84ad('0x7a'))][(_0x84ad('0x7b'))](_0x84ad('0x99'));}if(_[_0x84ad('0x98')](_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x9a')])){throw new db[(_0x84ad('0x7a'))]['ValidationError'](_0x84ad('0x9b')+_0x23cd8c);}if(!_[_0x84ad('0x9c')](_0x23cd8c,_0xbb1fa3[_0x84ad('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x84ad('0x9d')+_0x23cd8c);}_0x4f3515[_0xbb1fa3[_0x84ad('0x5e')]['mapKey']]=_0xbb1fa3['body'][_0x84ad('0x84')];return db[_0x84ad('0x9e')]['find']({'where':{'id':_0xbb1fa3[_0x84ad('0x78')]['ListId']},'include':[{'model':db[_0x84ad('0x79')],'as':_0x84ad('0x9f'),'where':_0x4f3515,'limit':0x1,'order':[[_0x84ad('0x7f'),_0x84ad('0xa0')]]}]});})[_0x84ad('0x22')](handleEntityNotFound(_0x947d29,null))[_0x84ad('0x22')](function(_0x5026ce){if(_0x5026ce){_0xbb1fa3[_0x84ad('0xa1')]=_[_0x84ad('0xa2')](_0x5026ce,[_0x84ad('0x9f')]);if(_0x5026ce[_0x84ad('0x9f')]['length']){return _0x5026ce[_0x84ad('0x9f')][0x0];}var _0x3b6425=_[_0x84ad('0x19')](_0xbb1fa3[_0x84ad('0x5e')],{'firstName':_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')],'ListId':_0x5026ce['id']});_0x3b6425[_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x9a')]]=_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x84')];return db[_0x84ad('0x79')][_0x84ad('0x5d')](_0x3b6425,{'fields':_0x3a0b09,'raw':!![]});}})[_0x84ad('0x22')](handleEntityNotFound(_0x947d29,null))['then'](function(_0x4d2950){if(_0x4d2950){_0xbb1fa3[_0x84ad('0xa3')]=_0x4d2950;var _0x5219bf={'ContactId':_0x4d2950['id'],'phone':_0xbb1fa3[_0x84ad('0x5e')]['from'],'SmsAccountId':_0x1f5444['params']['id']};var _0x4f1719={'ContactId':_0x4d2950['id'],'SmsAccountId':_0x1f5444['params']['id'],'closed':![]};return db[_0x84ad('0xa4')][_0x84ad('0x5c')]({'where':_0x4f1719})[_0x84ad('0x22')](function(_0x489510){if(_0x489510){return[_0x489510,![]];}return db[_0x84ad('0xa4')][_0x84ad('0x5d')](_0x5219bf)[_0x84ad('0x22')](function(_0x361884){return[_0x361884,!![]];});});}})['spread'](function(_0x240a9a,_0x47e8f6){_0xbb1fa3['interaction']=_0x240a9a[_0x84ad('0x37')]({'plain':!![]});_0xbb1fa3[_0x84ad('0xa5')]['created']=![];if(_0x47e8f6){if(_0xbb1fa3['account'][_0x84ad('0xa6')]){_0xbb1fa3[_0x84ad('0x75')][_0x84ad('0xa7')]({'id':0x0,'priority':_0xbb1fa3[_0x84ad('0x75')][_0x84ad('0x4b')]+0x1,'app':_0x84ad('0xa8'),'appdata':_0x84ad('0xa9'),'interval':_0x84ad('0xaa')});}_0xbb1fa3['interaction'][_0x84ad('0xab')]=!![];}return db[_0x84ad('0xac')][_0x84ad('0x5d')]({'phone':_0xbb1fa3[_0x84ad('0x5e')]['from'],'messageId':_0xbb1fa3[_0x84ad('0x5e')]['messageId'],'body':_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0x5e')],'SmsAccountId':_0x1f5444[_0x84ad('0x59')]['id'],'SmsInteractionId':_0x240a9a['id'],'direction':'in','ContactId':_0x240a9a[_0x84ad('0xad')],'AttachmentId':_0xbb1fa3[_0x84ad('0x5e')][_0x84ad('0xae')]});})['then'](function(_0x126715){_0xbb1fa3[_0x84ad('0x27')]=_0x126715;if(_0xbb1fa3['interaction'][_0x84ad('0xaf')]){return db['User'][_0x84ad('0x5c')]({'attributes':['id',_0x84ad('0x3a')],'where':{'id':_0xbb1fa3[_0x84ad('0xa5')][_0x84ad('0xaf')]}})['then'](function(_0x15a520){if(_0x15a520){_0xbb1fa3[_0x84ad('0x75')][_0x84ad('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x15a520[_0x84ad('0x3a')]+','+(_0xbb1fa3['account'][_0x84ad('0xb1')]||0xa),'interval':_0x84ad('0xaa')});}return respondWithRpcPromise(_0x84ad('0xb2'),_0x84ad('0xb3'),_0xbb1fa3);});}return respondWithRpcPromise(_0x84ad('0xb2'),_0x84ad('0xb3'),_0xbb1fa3);})['then'](function(_0x2a9147){if(_0x2a9147){var _0x5508d2=0xc8;var _0x1d2df8='receiveMessage';logger['info'](_0x84ad('0xb4'),_0x1d2df8,_0x5508d2,_0x84ad('0xb5'));logger[_0x84ad('0xb6')](_0x84ad('0xb7'),_0x1d2df8,_0x5508d2,_0x84ad('0xb5'),JSON['stringify'](_0x2a9147));if(_0xbb1fa3[_0x84ad('0x78')]['type']==='twilio'){return _0x947d29['status'](_0x5508d2)[_0x84ad('0x32')]('Content-Type',_0x84ad('0xb8'))[_0x84ad('0x3b')](_0x84ad('0xb9'));}else{return _0x947d29[_0x84ad('0x2b')](_0x5508d2)[_0x84ad('0x2d')](_0x2a9147);}}})['catch'](handleError(_0x947d29,null));};exports[_0x84ad('0xba')]=function(_0x4664f1,_0x1e8be6){var _0xdc4101=_0x4664f1[_0x84ad('0x59')]['id'];var _0x58465e=_0x4664f1[_0x84ad('0x5e')];var _0x1da700=0xc8;var _0x5823ad=null;return db[_0x84ad('0xbb')]['transaction']({'isolationLevel':db[_0x84ad('0xbb')][_0x84ad('0xbc')][_0x84ad('0xbd')][_0x84ad('0xbe')]},function(_0x378378){return db[_0x84ad('0x3f')]['findOne']({'where':{'id':_0xdc4101},'transaction':_0x378378})[_0x84ad('0x22')](function(_0x310190){if(_0x310190){return db[_0x84ad('0x73')][_0x84ad('0xbf')]({'where':{'SmsAccountId':_0xdc4101},'transaction':_0x378378})[_0x84ad('0x22')](function(){var _0x1b5070=_[_0x84ad('0x3e')](_0x58465e,function(_0xf08db9){_0xf08db9[_0x84ad('0x66')]=_0xdc4101;return _0xf08db9;});return db[_0x84ad('0x73')][_0x84ad('0xc0')](_0x1b5070,{'transaction':_0x378378});});}else{_0x1da700=0x194;_0x5823ad=[];}});})[_0x84ad('0x22')](function(){if(_0x1da700!==0x194){return db[_0x84ad('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0xdc4101},'order':_0x84ad('0x76')})['then'](function(_0x173a60){_0x5823ad=_0x173a60;});}})['catch'](function(_0x20f4ab){_0x1da700=0x1f4;logger[_0x84ad('0x26')](_0x20f4ab[_0x84ad('0x39')]);if(_0x20f4ab[_0x84ad('0x3a')]){delete _0x20f4ab[_0x84ad('0x3a')];}_0x5823ad=_0x20f4ab;})[_0x84ad('0xc1')](function(){if(_0x5823ad===null){_0x1e8be6[_0x84ad('0x2a')](_0x1da700);}else{if(_0x1da700===0x1f4){_0x1e8be6[_0x84ad('0x2b')](_0x1da700)[_0x84ad('0x3b')](_0x5823ad);}else{_0x1e8be6['status'](_0x1da700)[_0x84ad('0x2d')](_0x5823ad);}}});};exports[_0x84ad('0xc2')]=function(_0x394012,_0x5c2521,_0x516efd){var _0x31f007={};var _0x132e2c={};var _0x27d26e;var _0x2e5f4b;return db[_0x84ad('0x3f')]['findOne']({'where':{'id':_0x394012[_0x84ad('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c2521,null))[_0x84ad('0x22')](function(_0x4dec10){if(_0x4dec10){_0x27d26e=_0x4dec10;_0x132e2c[_0x84ad('0x44')]=_['keys'](db[_0x84ad('0x73')][_0x84ad('0x40')]);_0x132e2c[_0x84ad('0x46')]=_[_0x84ad('0x45')](_0x394012[_0x84ad('0x46')]);_0x132e2c['filters']=_['intersection'](_0x132e2c[_0x84ad('0x44')],_0x132e2c[_0x84ad('0x46')]);_0x31f007['attributes']=_[_0x84ad('0x48')](_0x132e2c[_0x84ad('0x44')],qs['fields'](_0x394012[_0x84ad('0x46')][_0x84ad('0x4a')]));_0x31f007['attributes']=_0x31f007[_0x84ad('0x49')][_0x84ad('0x4b')]?_0x31f007['attributes']:_0x132e2c[_0x84ad('0x44')];_0x31f007[_0x84ad('0x4d')]=qs[_0x84ad('0x4e')](_0x394012[_0x84ad('0x46')]['sort']);_0x31f007[_0x84ad('0x4f')]=qs[_0x84ad('0x47')](_[_0x84ad('0x50')](_0x394012['query'],_0x132e2c[_0x84ad('0x47')]));if(_0x394012[_0x84ad('0x46')][_0x84ad('0x53')]){_0x31f007[_0x84ad('0x4f')]=_[_0x84ad('0x51')](_0x31f007[_0x84ad('0x4f')],{'$or':_['map'](_0x31f007[_0x84ad('0x49')],function(_0x1f82c4){var _0x2286c2={};_0x2286c2[_0x1f82c4]={'$like':'%'+_0x394012['query'][_0x84ad('0x53')]+'%'};return _0x2286c2;})});}_0x31f007=_[_0x84ad('0x51')]({},_0x31f007,_0x394012[_0x84ad('0x54')]);return _0x27d26e['getApplications'](_0x31f007);}})['then'](function(_0x1dda08){if(_0x1dda08){_0x2e5f4b=_0x1dda08[_0x84ad('0x4b')];if(!_0x394012[_0x84ad('0x46')]['hasOwnProperty'](_0x84ad('0x6a'))){_0x31f007['limit']=qs[_0x84ad('0x2f')](_0x394012[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x31f007[_0x84ad('0x2e')]=qs[_0x84ad('0x2e')](_0x394012[_0x84ad('0x46')][_0x84ad('0x2e')]);}return _0x27d26e[_0x84ad('0xc2')](_0x31f007);}})[_0x84ad('0x22')](function(_0x45b819){if(_0x45b819){return _0x45b819?{'count':_0x2e5f4b,'rows':_0x45b819}:null;}})[_0x84ad('0x22')](respondWithResult(_0x5c2521,null))['catch'](handleError(_0x5c2521,null));};exports[_0x84ad('0xc3')]=function(_0x5d42f9,_0x2470f3,_0x3416dd){var _0x13b5fe={'raw':![],'where':{}};var _0x281ca1={};var _0x5b95f8={'count':0x0,'rows':[]};return db[_0x84ad('0x3f')][_0x84ad('0x69')]({'where':{'id':_0x5d42f9[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x2470f3,null))[_0x84ad('0x22')](function(_0x4607c5){if(_0x4607c5){_0x281ca1[_0x84ad('0x44')]=_['keys'](db[_0x84ad('0xa4')]['rawAttributes']);_0x281ca1[_0x84ad('0x46')]=_[_0x84ad('0x45')](_0x5d42f9[_0x84ad('0x46')]);_0x281ca1[_0x84ad('0x47')]=_[_0x84ad('0x48')](_0x281ca1[_0x84ad('0x44')],_0x281ca1[_0x84ad('0x46')]);_0x13b5fe['attributes']=_[_0x84ad('0x48')](_0x281ca1[_0x84ad('0x44')],qs[_0x84ad('0x4a')](_0x5d42f9[_0x84ad('0x46')][_0x84ad('0x4a')]));_0x13b5fe[_0x84ad('0x49')]=_0x13b5fe[_0x84ad('0x49')][_0x84ad('0x4b')]?_0x13b5fe['attributes']:_0x281ca1[_0x84ad('0x44')];if(!_0x5d42f9['query'][_0x84ad('0x4c')](_0x84ad('0x6a'))){_0x13b5fe['limit']=qs['limit'](_0x5d42f9[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x13b5fe[_0x84ad('0x2e')]=qs[_0x84ad('0x2e')](_0x5d42f9['query'][_0x84ad('0x2e')]);}_0x13b5fe['order']=qs[_0x84ad('0x4e')](_0x5d42f9[_0x84ad('0x46')]['sort']);_0x13b5fe[_0x84ad('0x4f')]=qs[_0x84ad('0x47')](_[_0x84ad('0x50')](_0x5d42f9[_0x84ad('0x46')],_0x281ca1[_0x84ad('0x47')]));_0x13b5fe[_0x84ad('0x4f')][_0x84ad('0x66')]=_0x4607c5['id'];if(_0x5d42f9[_0x84ad('0x46')][_0x84ad('0x53')]){_0x13b5fe['where']=_['merge'](_0x13b5fe[_0x84ad('0x4f')],{'$or':_['map'](_0x13b5fe[_0x84ad('0x49')],function(_0x440a88){var _0x557177={};_0x557177[_0x440a88]={'$like':'%'+_0x5d42f9['query'][_0x84ad('0x53')]+'%'};return _0x557177;})});}_0x13b5fe=_[_0x84ad('0x51')]({},_0x13b5fe,_0x5d42f9[_0x84ad('0x54')]);return db[_0x84ad('0xa4')][_0x84ad('0x31')]({'where':_0x13b5fe['where']})[_0x84ad('0x22')](function(_0x1ab0bd){_0x5b95f8[_0x84ad('0x31')]=_0x1ab0bd;if(_0x5d42f9['query'][_0x84ad('0x5b')]){_0x13b5fe[_0x84ad('0x55')]=[{'model':db[_0x84ad('0x79')],'as':_0x84ad('0xc4'),'required':![]},{'model':db[_0x84ad('0xc5')],'as':_0x84ad('0xc6'),'attributes':['name','fullname',_0x84ad('0xc7')],'required':![]},{'model':db[_0x84ad('0xc8')],'as':'Tags','attributes':['id',_0x84ad('0x3a'),_0x84ad('0xc9')],'where':_0x5d42f9['query'][_0x84ad('0xca')]?{'id':_0x5d42f9[_0x84ad('0x46')][_0x84ad('0xca')]}:undefined,'required':_0x5d42f9[_0x84ad('0x46')][_0x84ad('0xca')]?!![]:![]}];}return db[_0x84ad('0xa4')][_0x84ad('0x56')](_0x13b5fe);})[_0x84ad('0x22')](function(_0x2dd682){_0x5b95f8['rows']=_0x2dd682;return _0x5b95f8;});}})[_0x84ad('0x22')](respondWithFilteredResult(_0x2470f3,_0x13b5fe))[_0x84ad('0x58')](handleError(_0x2470f3,null));};exports[_0x84ad('0x3b')]=function(_0x17d3a0,_0x1df0ce,_0xed85e4){var _0x31abbf,_0x3c4bdd,_0x2415fd;if(_['isNil'](_0x17d3a0[_0x84ad('0x5e')][_0x84ad('0x5e')])||_0x17d3a0[_0x84ad('0x5e')][_0x84ad('0x5e')]===''){throw new db['Sequelize'][(_0x84ad('0x7b'))](_0x84ad('0x99'));}if(_[_0x84ad('0x98')](_0x17d3a0[_0x84ad('0x5e')]['to'])){throw new db[(_0x84ad('0x7a'))]['ValidationError'](_0x84ad('0xcb'));}_0x31abbf=_0x17d3a0[_0x84ad('0x5e')]['to'];return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x17d3a0['params']['id']},'include':[{'model':db[_0x84ad('0x9e')],'as':_0x84ad('0xcc'),'include':[{'model':db[_0x84ad('0x79')],'as':_0x84ad('0x9f'),'where':{'mobile':_0x31abbf},'limit':0x1,'order':[[_0x84ad('0x7f'),_0x84ad('0xa0')]]}]}]})[_0x84ad('0x22')](handleEntityNotFound(_0x1df0ce,null))[_0x84ad('0x22')](function(_0x233341){if(_0x233341&&_0x233341[_0x84ad('0xcc')]){_0x3c4bdd=_0x233341['get']({'plain':!![]});if(_0x3c4bdd[_0x84ad('0xcc')]&&_0x3c4bdd[_0x84ad('0xcc')][_0x84ad('0x9f')]['length']){return _0x3c4bdd[_0x84ad('0xcc')][_0x84ad('0x9f')][0x0];}return db[_0x84ad('0x79')][_0x84ad('0x5d')](_[_0x84ad('0x19')](_0x17d3a0['body'],{'firstName':_0x31abbf,'mobile':_0x31abbf,'phone':_0x31abbf,'ListId':_0x3c4bdd[_0x84ad('0x81')]}));}})[_0x84ad('0x22')](handleEntityNotFound(_0x1df0ce,null))[_0x84ad('0x22')](function(_0x4e10eb){if(_0x4e10eb){_0x2415fd=_0x4e10eb;return db['SmsInteraction'][_0x84ad('0x5c')]({'where':{'ContactId':_0x2415fd['id'],'closed':![],'SmsAccountId':_0x3c4bdd['id']}})['then'](function(_0x1423b0){if(_0x1423b0){return[_0x1423b0,![]];}return db['SmsInteraction'][_0x84ad('0x5d')]({'UserId':_0x17d3a0[_0x84ad('0x5f')]['id'],'ContactId':_0x2415fd['id'],'SmsAccountId':_0x3c4bdd['id'],'phone':_0x31abbf,'firstMsgDirection':_0x84ad('0xcd'),'Messages':[_[_0x84ad('0x51')](_0x17d3a0[_0x84ad('0x5e')],{'read':![],'body':_0x17d3a0[_0x84ad('0x5e')]['body'],'phone':_0x31abbf,'SmsAccountId':_0x3c4bdd['id'],'UserId':_0x17d3a0[_0x84ad('0x5f')]['id'],'ContactId':_0x2415fd['id']})]},{'include':[{'model':db[_0x84ad('0xac')],'as':_0x84ad('0xce')}]})['then'](function(_0x5bfe22){return[_0x5bfe22,!![]];});});}})[_0x84ad('0xcf')](function(_0x383389,_0xd4680e){if(_0xd4680e){return _0x383389;}return db['SmsMessage']['create'](_[_0x84ad('0x51')](_0x17d3a0[_0x84ad('0x5e')],{'read':![],'body':_0x17d3a0[_0x84ad('0x5e')][_0x84ad('0x5e')],'phone':_0x31abbf,'SmsAccountId':_0x3c4bdd['id'],'SmsInteractionId':_0x383389['id'],'UserId':_0x17d3a0['user']['id'],'ContactId':_0x2415fd['id']}))[_0x84ad('0x22')](function(_0x1e884e){_0x383389[_0x84ad('0xd0')][_0x84ad('0xce')]=[];_0x383389[_0x84ad('0xd0')][_0x84ad('0xce')][_0x84ad('0xa7')](_0x1e884e[_0x84ad('0xd0')]);return _0x383389;});})[_0x84ad('0x22')](respondWithResult(_0x1df0ce,null))['catch'](handleError(_0x1df0ce,null));};exports[_0x84ad('0x2b')]=function(_0x28cf21,_0x33fb0e,_0xf15693){if(_0x28cf21[_0x84ad('0x5e')]['id']){delete _0x28cf21[_0x84ad('0x5e')]['id'];}var _0x4baf15,_0x56f17a,_0x570358;return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x28cf21[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x33fb0e,null))[_0x84ad('0x22')](function(_0x1e8e11){if(_0x1e8e11){_0x570358=_0x1e8e11;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x84ad('0x2b'),_0x84ad('0xd1'),_0x1e8e11['type'],util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));switch(_0x1e8e11[_0x84ad('0x42')]){case'skebby':if(_0x28cf21['body']['skebby_dispatch_id']&&_0x28cf21['body'][_0x84ad('0x2b')]){_0x56f17a=_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x2b')];return db[_0x84ad('0xac')][_0x84ad('0x5c')]({'where':{'messageId':_0x28cf21['body'][_0x84ad('0xd3')]}});}break;case'connectel':if(_0x28cf21[_0x84ad('0x5e')][_0x84ad('0xd4')]&&_0x28cf21['body'][_0x84ad('0xd5')]){_0x56f17a=_0x28cf21['body'][_0x84ad('0xd5')];return db[_0x84ad('0xac')][_0x84ad('0x5c')]({'where':{'messageId':_0x28cf21[_0x84ad('0x5e')][_0x84ad('0xd4')]}});}break;case _0x84ad('0x8a'):if(_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x8c')]&&_0x28cf21['body'][_0x84ad('0xd6')]){_0x56f17a=_0x28cf21[_0x84ad('0x5e')][_0x84ad('0xd6')];return db['SmsMessage'][_0x84ad('0x5c')]({'where':{'messageId':_0x28cf21['body'][_0x84ad('0x8c')]}});}break;case _0x84ad('0xd7'):var _0x210916=_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x8f')][0x0];if(_0x210916[_0x84ad('0x8b')]&&_0x210916[_0x84ad('0x2b')][_0x84ad('0xd8')]===_0x84ad('0xd9')){_0x56f17a=_0x210916[_0x84ad('0x2b')][_0x84ad('0xd8')];return db[_0x84ad('0xac')]['find']({'where':{'messageId':_0x210916[_0x84ad('0x8b')]}});}break;case _0x84ad('0x93'):if(_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x8b')]&&_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x2b')]){_0x56f17a=_0x28cf21[_0x84ad('0x5e')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x28cf21['body']['messageId']}});}break;case _0x84ad('0x95'):if(_0x28cf21[_0x84ad('0x5e')][0x0]['message']['id']){_0x56f17a=_0x28cf21[_0x84ad('0x5e')][0x0][_0x84ad('0x42')];return db[_0x84ad('0xac')][_0x84ad('0x5c')]({'where':{'messageId':_0x28cf21[_0x84ad('0x5e')][0x0][_0x84ad('0x27')]['id']}});}break;case _0x84ad('0xda'):if(_0x28cf21[_0x84ad('0x5e')][_0x84ad('0xdb')]&&_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x2b')]){_0x56f17a=_0x28cf21[_0x84ad('0x5e')][_0x84ad('0x2b')];return db[_0x84ad('0xac')][_0x84ad('0x5c')]({'where':{'messageId':_0x28cf21[_0x84ad('0x5e')][_0x84ad('0xdb')]}});}break;}}})[_0x84ad('0x22')](handleEntityNotFound(_0x33fb0e,null))['then'](function(_0x4b97da){if(_0x4b97da){_0x4baf15=_0x4b97da;switch(_0x570358[_0x84ad('0x42')]){case _0x84ad('0x86'):if(_0x56f17a===_0x84ad('0xd9')){return _0x4baf15[_0x84ad('0x36')]({'read':!![]});}else{logger['error'](_0x84ad('0xb4'),_0x84ad('0x2b'),'skebby',util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x84ad('0x89'):if(_0x56f17a==='1'){return _0x4baf15[_0x84ad('0x36')]({'read':!![]});}else{logger[_0x84ad('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util['inspect'](_0x28cf21['body'],{'showHidden':![],'depth':null}));}break;case _0x84ad('0x8a'):if(!_0x28cf21[_0x84ad('0x5e')]['error_code']&&_0x56f17a>=0xc8&&_0x56f17a<=0xce){return _0x4baf15[_0x84ad('0x36')]({'read':!![]});}else{logger[_0x84ad('0x26')](_0x84ad('0xb4'),_0x84ad('0x2b'),'clicksend',util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x84ad('0xd7'):var _0x106493=_0x28cf21['body']['results'][0x0];if(_0x106493[_0x84ad('0x2b')][_0x84ad('0xd8')]===_0x84ad('0xd9')){return _0x4baf15['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x84ad('0xd7'),util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x56f17a==_0x84ad('0xdc')||_0x56f17a==_0x84ad('0xdd')){return _0x4baf15[_0x84ad('0x36')]({'read':!![]});}else{logger[_0x84ad('0x26')](_0x84ad('0xb4'),_0x84ad('0x2b'),_0x84ad('0x93'),util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x84ad('0x95'):if(_0x56f17a==_0x84ad('0xde')){return _0x4baf15['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x84ad('0x2b'),_0x84ad('0x95'),util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x56f17a==='DELIVRD'||_0x56f17a==='ACCEPTD'){return _0x4baf15[_0x84ad('0x36')]({'read':!![]});}else{logger[_0x84ad('0x26')](_0x84ad('0xb4'),_0x84ad('0x2b'),_0x84ad('0xda'),util[_0x84ad('0xd2')](_0x28cf21[_0x84ad('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x4baf15;}})[_0x84ad('0x22')](respondWithResult(_0x33fb0e,null))[_0x84ad('0x58')](handleError(_0x33fb0e,null));};exports[_0x84ad('0xdf')]=function(_0x2160b8,_0x46e85f,_0x4c5cff){var _0x5094ca,_0x3f3c72,_0x12cedd;return db[_0x84ad('0x3f')][_0x84ad('0x5c')]({'where':{'id':_0x2160b8[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x46e85f,null))[_0x84ad('0x22')](function(_0x74f0c6){if(_0x74f0c6){_0x12cedd=_0x74f0c6;logger[_0x84ad('0xb6')](_0x84ad('0xb4'),_0x84ad('0x2b'),_0x84ad('0xd1'),_0x74f0c6[_0x84ad('0x42')],util[_0x84ad('0xd2')](_0x2160b8[_0x84ad('0x46')],{'showHidden':![],'depth':null}));switch(_0x74f0c6[_0x84ad('0x42')]){case _0x84ad('0x90'):if(_0x2160b8['query']['message-id']&&_0x2160b8[_0x84ad('0x46')][_0x84ad('0xe0')]){_0x3f3c72=_0x2160b8[_0x84ad('0x46')][_0x84ad('0xe0')];return db[_0x84ad('0xac')][_0x84ad('0x5c')]({'where':{'messageId':_0x2160b8[_0x84ad('0x46')]['message-id']}});}break;}}})[_0x84ad('0x22')](handleEntityNotFound(_0x46e85f,null))[_0x84ad('0x22')](function(_0x5e58a9){if(_0x5e58a9){_0x5094ca=_0x5e58a9;switch(_0x12cedd[_0x84ad('0x42')]){case _0x84ad('0x90'):if(_0x3f3c72==='2'||_0x3f3c72==='6'){return _0x5094ca[_0x84ad('0x36')]({'read':!![]});}else{logger[_0x84ad('0x26')](_0x84ad('0xb4'),_0x84ad('0x2b'),_0x84ad('0x90'),util[_0x84ad('0xd2')](_0x2160b8[_0x84ad('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x5094ca;}})[_0x84ad('0x22')](respondWithResult(_0x46e85f,null))[_0x84ad('0x58')](handleError(_0x46e85f,null));};exports[_0x84ad('0xe1')]=function(_0x4d6e9e,_0x59e12a,_0x42a8d1){return db[_0x84ad('0x3f')]['find']({'where':{'id':_0x4d6e9e[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x59e12a,null))[_0x84ad('0x22')](function(_0x4d84af){if(_0x4d84af){return _0x4d84af[_0x84ad('0xe1')](_0x4d6e9e[_0x84ad('0x5e')][_0x84ad('0x6c')],_[_0x84ad('0xa2')](_0x4d6e9e[_0x84ad('0x5e')],[_0x84ad('0x6c'),'id'])||{})[_0x84ad('0xcf')](function(_0x237cf7){for(var _0x3a19dc=0x0;_0x3a19dc<_0x4d6e9e['body']['ids'][_0x84ad('0x4b')];_0x3a19dc+=0x1){socket[_0x84ad('0xe2')](_0x84ad('0xe3'),{'UserId':Number(_0x4d6e9e['body']['ids'][_0x3a19dc]),'SmsAccountId':Number(_0x4d6e9e[_0x84ad('0x59')]['id'])});}return _0x237cf7;});}})['then'](respondWithResult(_0x59e12a,null))[_0x84ad('0x58')](handleError(_0x59e12a,null));};exports[_0x84ad('0xe4')]=function(_0x467193,_0x11a437,_0x5cd217){return db['SmsAccount'][_0x84ad('0x5c')]({'where':{'id':_0x467193[_0x84ad('0x59')]['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x11a437,null))[_0x84ad('0x22')](function(_0x4e58d7){if(_0x4e58d7){return _0x4e58d7[_0x84ad('0xe4')](_0x467193[_0x84ad('0x46')][_0x84ad('0x6c')])[_0x84ad('0x22')](function(){if(_[_0x84ad('0xe5')](_0x467193[_0x84ad('0x46')][_0x84ad('0x6c')])){for(var _0x4b06e8=0x0;_0x4b06e8<_0x467193[_0x84ad('0x46')][_0x84ad('0x6c')][_0x84ad('0x4b')];_0x4b06e8+=0x1){socket[_0x84ad('0xe2')](_0x84ad('0xe6'),{'UserId':Number(_0x467193[_0x84ad('0x46')][_0x84ad('0x6c')][_0x4b06e8]),'SmsAccountId':Number(_0x467193[_0x84ad('0x59')]['id'])});}}else{socket[_0x84ad('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x467193[_0x84ad('0x46')][_0x84ad('0x6c')]),'SmsAccountId':Number(_0x467193[_0x84ad('0x59')]['id'])});}});}})[_0x84ad('0x22')](respondWithStatusCode(_0x11a437,null))[_0x84ad('0x58')](handleError(_0x11a437,null));};exports[_0x84ad('0xe7')]=function(_0x2052ab,_0x3d65f9,_0x4a3292){var _0x21c9f6={};var _0x5663fc={};var _0x36871b;var _0x3eb5e6;return db[_0x84ad('0x3f')]['findOne']({'where':{'id':_0x2052ab['params']['id']}})[_0x84ad('0x22')](handleEntityNotFound(_0x3d65f9,null))['then'](function(_0x32aad3){if(_0x32aad3){_0x36871b=_0x32aad3;_0x5663fc['model']=_[_0x84ad('0x45')](db['User'][_0x84ad('0x40')]);_0x5663fc[_0x84ad('0x46')]=_[_0x84ad('0x45')](_0x2052ab[_0x84ad('0x46')]);_0x5663fc['filters']=_['intersection'](_0x5663fc[_0x84ad('0x44')],_0x5663fc[_0x84ad('0x46')]);_0x21c9f6[_0x84ad('0x49')]=_['intersection'](_0x5663fc[_0x84ad('0x44')],qs[_0x84ad('0x4a')](_0x2052ab[_0x84ad('0x46')]['fields']));_0x21c9f6[_0x84ad('0x49')]=_0x21c9f6['attributes'][_0x84ad('0x4b')]?_0x21c9f6[_0x84ad('0x49')]:_0x5663fc[_0x84ad('0x44')];_0x21c9f6[_0x84ad('0x4d')]=qs[_0x84ad('0x4e')](_0x2052ab[_0x84ad('0x46')][_0x84ad('0x4e')]);_0x21c9f6[_0x84ad('0x4f')]=qs[_0x84ad('0x47')](_[_0x84ad('0x50')](_0x2052ab[_0x84ad('0x46')],_0x5663fc[_0x84ad('0x47')]));if(_0x2052ab[_0x84ad('0x46')][_0x84ad('0x53')]){_0x21c9f6[_0x84ad('0x4f')]=_['merge'](_0x21c9f6[_0x84ad('0x4f')],{'$or':_[_0x84ad('0x3e')](_0x21c9f6[_0x84ad('0x49')],function(_0x26f433){var _0x5c17c0={};_0x5c17c0[_0x26f433]={'$like':'%'+_0x2052ab[_0x84ad('0x46')][_0x84ad('0x53')]+'%'};return _0x5c17c0;})});}_0x21c9f6=_['merge']({},_0x21c9f6,_0x2052ab['options']);return _0x36871b[_0x84ad('0xe7')](_0x21c9f6);}})['then'](function(_0x471a07){if(_0x471a07){_0x3eb5e6=_0x471a07[_0x84ad('0x4b')];if(!_0x2052ab[_0x84ad('0x46')][_0x84ad('0x4c')](_0x84ad('0x6a'))){_0x21c9f6[_0x84ad('0x2f')]=qs[_0x84ad('0x2f')](_0x2052ab[_0x84ad('0x46')][_0x84ad('0x2f')]);_0x21c9f6['offset']=qs[_0x84ad('0x2e')](_0x2052ab[_0x84ad('0x46')][_0x84ad('0x2e')]);}return _0x36871b[_0x84ad('0xe7')](_0x21c9f6);}})[_0x84ad('0x22')](function(_0x16fcba){if(_0x16fcba){return _0x16fcba?{'count':_0x3eb5e6,'rows':_0x16fcba}:null;}})[_0x84ad('0x22')](respondWithResult(_0x3d65f9,null))[_0x84ad('0x58')](handleError(_0x3d65f9,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 58d3f13..601c891 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 _0x9431=['events','../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty'];(function(_0x60fa35,_0x12abc6){var _0x2d9933=function(_0x310304){while(--_0x310304){_0x60fa35['push'](_0x60fa35['shift']());}};_0x2d9933(++_0x12abc6);}(_0x9431,0xa8));var _0x1943=function(_0x568d13,_0x3acd44){_0x568d13=_0x568d13-0x0;var _0x1918ef=_0x9431[_0x568d13];return _0x1918ef;};'use strict';var EventEmitter=require(_0x1943('0x0'));var SmsAccount=require(_0x1943('0x1'))['db'][_0x1943('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1943('0x3'),'afterDestroy':_0x1943('0x4')};function emitEvent(_0x59d0f3){return function(_0x5e74aa,_0x40ec64,_0x3e2ad1){SmsAccountEvents[_0x1943('0x5')](_0x59d0f3+':'+_0x5e74aa['id'],_0x5e74aa);SmsAccountEvents['emit'](_0x59d0f3,_0x5e74aa);_0x3e2ad1(null);};}for(var e in events){if(events[_0x1943('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x90b7=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','update','remove'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x90b7,0x16b));var _0x790b=function(_0x44c521,_0x4f11f7){_0x44c521=_0x44c521-0x0;var _0xa4b25c=_0x90b7[_0x44c521];return _0xa4b25c;};'use strict';var EventEmitter=require(_0x790b('0x0'));var SmsAccount=require(_0x790b('0x1'))['db'][_0x790b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x790b('0x3'),'afterDestroy':_0x790b('0x4')};function emitEvent(_0x22498c){return function(_0xa96d06,_0x551bda,_0x1de8a4){SmsAccountEvents['emit'](_0x22498c+':'+_0xa96d06['id'],_0xa96d06);SmsAccountEvents[_0x790b('0x5')](_0x22498c,_0xa96d06);_0x1de8a4(null);};}for(var e in events){if(events[_0x790b('0x6')](e)){var event=events[e];SmsAccount[_0x790b('0x7')](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 7fbc14f..6100263 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 _0x04d4=['sms_accounts','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','SmsAccount'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0x04d4,0x1b9));var _0x404d=function(_0x3fbf2e,_0x312c59){_0x3fbf2e=_0x3fbf2e-0x0;var _0x191173=_0x04d4[_0x3fbf2e];return _0x191173;};'use strict';var _=require('lodash');var util=require(_0x404d('0x0'));var logger=require('../../config/logger')(_0x404d('0x1'));var moment=require(_0x404d('0x2'));var BPromise=require('bluebird');var rp=require(_0x404d('0x3'));var fs=require('fs');var path=require(_0x404d('0x4'));var rimraf=require(_0x404d('0x5'));var config=require(_0x404d('0x6'));var attributes=require(_0x404d('0x7'));module['exports']=function(_0x339951,_0x10b328){return _0x339951[_0x404d('0x8')](_0x404d('0x9'),attributes,{'tableName':_0x404d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ba=['define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4db4da,_0x2750d7){var _0x4c1fdc=function(_0x22d764){while(--_0x22d764){_0x4db4da['push'](_0x4db4da['shift']());}};_0x4c1fdc(++_0x2750d7);}(_0x44ba,0xd2));var _0xa44b=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0x44ba[_0x47e3f8];return _0x4742d5;};'use strict';var _=require(_0xa44b('0x0'));var util=require(_0xa44b('0x1'));var logger=require(_0xa44b('0x2'))(_0xa44b('0x3'));var moment=require(_0xa44b('0x4'));var BPromise=require(_0xa44b('0x5'));var rp=require(_0xa44b('0x6'));var fs=require('fs');var path=require(_0xa44b('0x7'));var rimraf=require(_0xa44b('0x8'));var config=require(_0xa44b('0x9'));var attributes=require('./smsAccount.attributes');module[_0xa44b('0xa')]=function(_0x2c601d,_0x8cf6d2){return _0x2c601d[_0xa44b('0xb')]('SmsAccount',attributes,{'tableName':_0xa44b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5e03f75..755f2d4 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 _0xed87=['map','attributes','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','find','options','raw','where','include'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xed87,0x184));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ed8('0x0'));var util=require('util');var moment=require(_0x7ed8('0x1'));var BPromise=require(_0x7ed8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ed8('0x3'))['db'];var utils=require(_0x7ed8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7ed8('0x5'));var jayson=require(_0x7ed8('0x6'));var client=jayson[_0x7ed8('0x7')][_0x7ed8('0x8')]({'port':0x232a});config['redis']=_[_0x7ed8('0x9')](config[_0x7ed8('0xa')],{'host':_0x7ed8('0xb'),'port':0x18eb});var socket=require(_0x7ed8('0xc'))(new Redis(config['redis']));require(_0x7ed8('0xd'))[_0x7ed8('0xe')](socket);function respondWithRpcPromise(_0x36fb26,_0x388047,_0x4dd823){return new BPromise(function(_0xa8dc0f,_0xc62856){return client[_0x7ed8('0xf')](_0x36fb26,_0x4dd823)[_0x7ed8('0x10')](function(_0x58397b){logger[_0x7ed8('0x11')]('SmsAccount,\x20%s,\x20%s',_0x388047,_0x7ed8('0x12'));logger[_0x7ed8('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x388047,_0x7ed8('0x12'),JSON[_0x7ed8('0x14')](_0x58397b));if(_0x58397b[_0x7ed8('0x15')]){if(_0x58397b[_0x7ed8('0x15')]['code']===0x1f4){logger[_0x7ed8('0x15')](_0x7ed8('0x16'),_0x388047,_0x58397b[_0x7ed8('0x15')]['message']);return _0xc62856(_0x58397b[_0x7ed8('0x15')][_0x7ed8('0x17')]);}logger[_0x7ed8('0x15')](_0x7ed8('0x16'),_0x388047,_0x58397b[_0x7ed8('0x15')][_0x7ed8('0x17')]);return _0xa8dc0f(_0x58397b[_0x7ed8('0x15')][_0x7ed8('0x17')]);}else{logger[_0x7ed8('0x11')](_0x7ed8('0x16'),_0x388047,'request\x20sent');_0xa8dc0f(_0x58397b[_0x7ed8('0x18')][_0x7ed8('0x17')]);}})[_0x7ed8('0x19')](function(_0x6cc304){logger['error'](_0x7ed8('0x16'),_0x388047,_0x6cc304);_0xc62856(_0x6cc304);});});}exports[_0x7ed8('0x1a')]=function(_0xae3e0a){var _0x35bb62=this;return new Promise(function(_0x287472,_0x57f033){return db['SmsAccount'][_0x7ed8('0x1b')]({'raw':_0xae3e0a[_0x7ed8('0x1c')]?_0xae3e0a['options'][_0x7ed8('0x1d')]===undefined?!![]:![]:!![],'where':_0xae3e0a[_0x7ed8('0x1c')]?_0xae3e0a['options'][_0x7ed8('0x1e')]||null:null,'attributes':_0xae3e0a[_0x7ed8('0x1c')]?_0xae3e0a[_0x7ed8('0x1c')]['attributes']||null:null,'include':_0xae3e0a[_0x7ed8('0x1c')]?_0xae3e0a[_0x7ed8('0x1c')][_0x7ed8('0x1f')]?_[_0x7ed8('0x20')](_0xae3e0a[_0x7ed8('0x1c')][_0x7ed8('0x1f')],function(_0x2f8105){return{'model':db[_0x2f8105['model']],'as':_0x2f8105['as'],'attributes':_0x2f8105[_0x7ed8('0x21')],'include':_0x2f8105[_0x7ed8('0x1f')]?_['map'](_0x2f8105[_0x7ed8('0x1f')],function(_0x3e3232){return{'model':db[_0x3e3232[_0x7ed8('0x22')]],'as':_0x3e3232['as'],'attributes':_0x3e3232['attributes'],'include':_0x3e3232[_0x7ed8('0x1f')]?_[_0x7ed8('0x20')](_0x3e3232[_0x7ed8('0x1f')],function(_0x4e353b){return{'model':db[_0x4e353b[_0x7ed8('0x22')]],'as':_0x4e353b['as'],'attributes':_0x4e353b[_0x7ed8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7ed8('0x10')](function(_0x235a78){logger[_0x7ed8('0x11')](_0x7ed8('0x1a'),_0xae3e0a);logger['debug'](_0x7ed8('0x1a'),_0xae3e0a,JSON['stringify'](_0x235a78));_0x287472(_0x235a78);})[_0x7ed8('0x19')](function(_0x220eee){logger[_0x7ed8('0x15')](_0x7ed8('0x1a'),_0x220eee[_0x7ed8('0x17')],_0xae3e0a);_0x57f033(_0x35bb62[_0x7ed8('0x15')](0x1f4,_0x220eee[_0x7ed8('0x17')]));});});}; \ No newline at end of file +var _0x9549=['info','lodash','util','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model'];(function(_0x4c316a,_0xf9b472){var _0x35151f=function(_0x1b5f27){while(--_0x1b5f27){_0x4c316a['push'](_0x4c316a['shift']());}};_0x35151f(++_0xf9b472);}(_0x9549,0x1a1));var _0x9954=function(_0x53538f,_0x3b129d){_0x53538f=_0x53538f-0x0;var _0x4a5ffc=_0x9549[_0x53538f];return _0x4a5ffc;};'use strict';var _=require(_0x9954('0x0'));var util=require(_0x9954('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9954('0x2'))(_0x9954('0x3'));var config=require(_0x9954('0x4'));var jayson=require(_0x9954('0x5'));var client=jayson[_0x9954('0x6')][_0x9954('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9954('0x8')],{'host':_0x9954('0x9'),'port':0x18eb});var socket=require(_0x9954('0xa'))(new Redis(config[_0x9954('0x8')]));require(_0x9954('0xb'))['register'](socket);function respondWithRpcPromise(_0x2ceab4,_0x50df11,_0x472ee6){return new BPromise(function(_0x29aee8,_0x264130){return client[_0x9954('0xc')](_0x2ceab4,_0x472ee6)[_0x9954('0xd')](function(_0x112243){logger['info'](_0x9954('0xe'),_0x50df11,_0x9954('0xf'));logger[_0x9954('0x10')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50df11,_0x9954('0xf'),JSON[_0x9954('0x11')](_0x112243));if(_0x112243[_0x9954('0x12')]){if(_0x112243[_0x9954('0x12')][_0x9954('0x13')]===0x1f4){logger[_0x9954('0x12')](_0x9954('0xe'),_0x50df11,_0x112243[_0x9954('0x12')][_0x9954('0x14')]);return _0x264130(_0x112243[_0x9954('0x12')][_0x9954('0x14')]);}logger[_0x9954('0x12')]('SmsAccount,\x20%s,\x20%s',_0x50df11,_0x112243[_0x9954('0x12')][_0x9954('0x14')]);return _0x29aee8(_0x112243['error']['message']);}else{logger['info'](_0x9954('0xe'),_0x50df11,'request\x20sent');_0x29aee8(_0x112243['result'][_0x9954('0x14')]);}})[_0x9954('0x15')](function(_0x3c1eb4){logger[_0x9954('0x12')](_0x9954('0xe'),_0x50df11,_0x3c1eb4);_0x264130(_0x3c1eb4);});});}exports[_0x9954('0x16')]=function(_0xf1e48f){var _0x30d804=this;return new Promise(function(_0x23bb34,_0x391daa){return db[_0x9954('0x17')][_0x9954('0x18')]({'raw':_0xf1e48f[_0x9954('0x19')]?_0xf1e48f['options'][_0x9954('0x1a')]===undefined?!![]:![]:!![],'where':_0xf1e48f[_0x9954('0x19')]?_0xf1e48f[_0x9954('0x19')][_0x9954('0x1b')]||null:null,'attributes':_0xf1e48f['options']?_0xf1e48f[_0x9954('0x19')][_0x9954('0x1c')]||null:null,'include':_0xf1e48f['options']?_0xf1e48f[_0x9954('0x19')][_0x9954('0x1d')]?_['map'](_0xf1e48f['options'][_0x9954('0x1d')],function(_0x4e738f){return{'model':db[_0x4e738f[_0x9954('0x1e')]],'as':_0x4e738f['as'],'attributes':_0x4e738f[_0x9954('0x1c')],'include':_0x4e738f[_0x9954('0x1d')]?_['map'](_0x4e738f[_0x9954('0x1d')],function(_0x42815a){return{'model':db[_0x42815a[_0x9954('0x1e')]],'as':_0x42815a['as'],'attributes':_0x42815a[_0x9954('0x1c')],'include':_0x42815a['include']?_['map'](_0x42815a[_0x9954('0x1d')],function(_0x197aba){return{'model':db[_0x197aba[_0x9954('0x1e')]],'as':_0x197aba['as'],'attributes':_0x197aba[_0x9954('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9954('0xd')](function(_0x203513){logger[_0x9954('0x1f')]('ShowSmsAccount',_0xf1e48f);logger[_0x9954('0x10')](_0x9954('0x16'),_0xf1e48f,JSON[_0x9954('0x11')](_0x203513));_0x23bb34(_0x203513);})[_0x9954('0x15')](function(_0x23778b){logger[_0x9954('0x12')](_0x9954('0x16'),_0x23778b['message'],_0xf1e48f);_0x391daa(_0x30d804[_0x9954('0x12')](0x1f4,_0x23778b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 82457e6..4b18758 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 c90ddc7..3a946f3 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x246cfa,_0x255d18){var _0x52cd7a=function(_0x4fe3ab){while(--_0x4fe3ab){_0x246cfa['push'](_0x246cfa['shift']());}};_0x52cd7a(++_0x255d18);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x42fbdf,_0x32ef33){var _0x4e810a=function(_0x876b0c){while(--_0x876b0c){_0x42fbdf['push'](_0x42fbdf['shift']());}};_0x4e810a(++_0x32ef33);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xedd9[_0x3f6b1b];return _0x4a3d2b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9967ec6..116bc89 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 _0xb41f=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x153203,_0x4618a7){var _0x1aa143=function(_0x42e36a){while(--_0x42e36a){_0x153203['push'](_0x153203['shift']());}};_0x1aa143(++_0x4618a7);}(_0xb41f,0x159));var _0xfb41=function(_0x47ccce,_0x253022){_0x47ccce=_0x47ccce-0x0;var _0x58b748=_0xb41f[_0x47ccce];return _0x58b748;};'use strict';var Sequelize=require(_0xfb41('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfb41('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfb41('0x2')],'allowNull':![],'defaultValue':_0xfb41('0x3')},'appdata':{'type':Sequelize[_0xfb41('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x84a2=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84a2,0x1ec));var _0x284a=function(_0x2d283c,_0x1702d3){_0x2d283c=_0x2d283c-0x0;var _0xa8fbc0=_0x84a2[_0x2d283c];return _0xa8fbc0;};'use strict';var Sequelize=require(_0x284a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x284a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x284a('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x284a('0x3')],'defaultValue':_0x284a('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0500097..f4f0f72 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 _0x9d5c=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','status','send','index','SmsApplication','rawAttributes','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','moment'];(function(_0x48f6ae,_0x262786){var _0x1660a2=function(_0x5d9f7f){while(--_0x5d9f7f){_0x48f6ae['push'](_0x48f6ae['shift']());}};_0x1660a2(++_0x262786);}(_0x9d5c,0x1a6));var _0xc9d5=function(_0x432ae8,_0xc4512f){_0x432ae8=_0x432ae8-0x0;var _0x455948=_0x9d5c[_0x432ae8];return _0x455948;};'use strict';var emlformat=require(_0xc9d5('0x0'));var rimraf=require(_0xc9d5('0x1'));var zipdir=require(_0xc9d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9d5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc9d5('0x4'));var util=require(_0xc9d5('0x5'));var path=require(_0xc9d5('0x6'));var sox=require(_0xc9d5('0x7'));var csv=require(_0xc9d5('0x8'));var ejs=require(_0xc9d5('0x9'));var fs=require('fs');var fs_extra=require(_0xc9d5('0xa'));var _=require('lodash');var squel=require(_0xc9d5('0xb'));var crypto=require(_0xc9d5('0xc'));var jsforce=require(_0xc9d5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc9d5('0x8'));var querystring=require('querystring');var Papa=require(_0xc9d5('0xe'));var Redis=require('ioredis');var authService=require(_0xc9d5('0xf'));var qs=require(_0xc9d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9d5('0x11'))(_0xc9d5('0x12'));var utils=require(_0xc9d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc9d5('0x14'));var db=require(_0xc9d5('0x15'))['db'];function respondWithStatusCode(_0xd4cad8,_0x15e5df){_0x15e5df=_0x15e5df||0xcc;return function(_0x5eaa9d){if(_0x5eaa9d){return _0xd4cad8[_0xc9d5('0x16')](_0x15e5df);}return _0xd4cad8['status'](_0x15e5df)[_0xc9d5('0x17')]();};}function respondWithResult(_0x4f9923,_0x1b8ea2){_0x1b8ea2=_0x1b8ea2||0xc8;return function(_0xb49893){if(_0xb49893){return _0x4f9923['status'](_0x1b8ea2)[_0xc9d5('0x18')](_0xb49893);}};}function respondWithFilteredResult(_0x1483ed,_0x2a77d5){return function(_0x2f8bd3){if(_0x2f8bd3){var _0x2df18e=typeof _0x2a77d5['offset']==='undefined'&&typeof _0x2a77d5['limit']===_0xc9d5('0x19');var _0x5aada1=_0x2f8bd3[_0xc9d5('0x1a')];var _0xccabeb=_0x2df18e?0x0:_0x2a77d5[_0xc9d5('0x1b')];var _0x1bb1b3=_0x2df18e?_0x2f8bd3[_0xc9d5('0x1a')]:_0x2a77d5[_0xc9d5('0x1b')]+_0x2a77d5[_0xc9d5('0x1c')];var _0x828654;if(_0x1bb1b3>=_0x5aada1){_0x1bb1b3=_0x5aada1;_0x828654=0xc8;}else{_0x828654=0xce;}_0x1483ed['status'](_0x828654);return _0x1483ed['set']('Content-Range',_0xccabeb+'-'+_0x1bb1b3+'/'+_0x5aada1)[_0xc9d5('0x18')](_0x2f8bd3);}return null;};}function patchUpdates(_0x8d8f84){return function(_0x58a94b){try{jsonpatch[_0xc9d5('0x1d')](_0x58a94b,_0x8d8f84,!![]);}catch(_0x57d551){return BPromise[_0xc9d5('0x1e')](_0x57d551);}return _0x58a94b[_0xc9d5('0x1f')]();};}function saveUpdates(_0x14c89b,_0x410ba7){return function(_0x5d90e5){if(_0x5d90e5){return _0x5d90e5[_0xc9d5('0x20')](_0x14c89b)[_0xc9d5('0x21')](function(_0x326261){return _0x326261;});}return null;};}function removeEntity(_0x313906,_0xf3b7f4){return function(_0x183d7d){if(_0x183d7d){return _0x183d7d[_0xc9d5('0x22')]()[_0xc9d5('0x21')](function(){_0x313906[_0xc9d5('0x23')](0xcc)[_0xc9d5('0x17')]();});}};}function handleEntityNotFound(_0x22ffa5,_0x279788){return function(_0x328cbf){if(!_0x328cbf){_0x22ffa5[_0xc9d5('0x16')](0x194);}return _0x328cbf;};}function handleError(_0x3ecc73,_0x5b4b73){_0x5b4b73=_0x5b4b73||0x1f4;return function(_0x4299ee){logger['error'](_0x4299ee['stack']);if(_0x4299ee['name']){delete _0x4299ee['name'];}_0x3ecc73[_0xc9d5('0x23')](_0x5b4b73)[_0xc9d5('0x24')](_0x4299ee);};}exports[_0xc9d5('0x25')]=function(_0x19126c,_0x83e28a){var _0x186a11={},_0xcf1659={},_0x409d59={'count':0x0,'rows':[]};var _0x4651e8=_['map'](db[_0xc9d5('0x26')][_0xc9d5('0x27')],function(_0x13722b){return{'name':_0x13722b[_0xc9d5('0x28')],'type':_0x13722b['type'][_0xc9d5('0x29')]};});_0xcf1659[_0xc9d5('0x2a')]=_[_0xc9d5('0x2b')](_0x4651e8,_0xc9d5('0x2c'));_0xcf1659[_0xc9d5('0x2d')]=_[_0xc9d5('0x2e')](_0x19126c[_0xc9d5('0x2d')]);_0xcf1659['filters']=_[_0xc9d5('0x2f')](_0xcf1659['model'],_0xcf1659[_0xc9d5('0x2d')]);_0x186a11[_0xc9d5('0x30')]=_[_0xc9d5('0x2f')](_0xcf1659[_0xc9d5('0x2a')],qs[_0xc9d5('0x31')](_0x19126c[_0xc9d5('0x2d')]['fields']));_0x186a11[_0xc9d5('0x30')]=_0x186a11['attributes'][_0xc9d5('0x32')]?_0x186a11[_0xc9d5('0x30')]:_0xcf1659[_0xc9d5('0x2a')];if(!_0x19126c[_0xc9d5('0x2d')][_0xc9d5('0x33')](_0xc9d5('0x34'))){_0x186a11[_0xc9d5('0x1c')]=qs[_0xc9d5('0x1c')](_0x19126c[_0xc9d5('0x2d')][_0xc9d5('0x1c')]);_0x186a11[_0xc9d5('0x1b')]=qs[_0xc9d5('0x1b')](_0x19126c[_0xc9d5('0x2d')]['offset']);}_0x186a11[_0xc9d5('0x35')]=qs[_0xc9d5('0x36')](_0x19126c[_0xc9d5('0x2d')]['sort']);_0x186a11[_0xc9d5('0x37')]=qs[_0xc9d5('0x38')](_[_0xc9d5('0x39')](_0x19126c[_0xc9d5('0x2d')],_0xcf1659[_0xc9d5('0x38')]),_0x4651e8);if(_0x19126c[_0xc9d5('0x2d')]['filter']){_0x186a11['where']=_[_0xc9d5('0x3a')](_0x186a11[_0xc9d5('0x37')],{'$or':_['map'](_0x4651e8,function(_0x29dc2d){if(_0x29dc2d[_0xc9d5('0x3b')]!==_0xc9d5('0x3c')){var _0x41f39e={};_0x41f39e[_0x29dc2d[_0xc9d5('0x2c')]]={'$like':'%'+_0x19126c[_0xc9d5('0x2d')]['filter']+'%'};return _0x41f39e;}})});}_0x186a11=_[_0xc9d5('0x3a')]({},_0x186a11,_0x19126c[_0xc9d5('0x3d')]);var _0x11698b={'where':_0x186a11[_0xc9d5('0x37')]};return db[_0xc9d5('0x26')][_0xc9d5('0x1a')](_0x11698b)[_0xc9d5('0x21')](function(_0x4cb495){_0x409d59[_0xc9d5('0x1a')]=_0x4cb495;if(_0x19126c['query']['includeAll']){_0x186a11[_0xc9d5('0x3e')]=[{'all':!![]}];}return db[_0xc9d5('0x26')][_0xc9d5('0x3f')](_0x186a11);})[_0xc9d5('0x21')](function(_0x213ca4){_0x409d59[_0xc9d5('0x40')]=_0x213ca4;return _0x409d59;})['then'](respondWithFilteredResult(_0x83e28a,_0x186a11))[_0xc9d5('0x41')](handleError(_0x83e28a,null));};exports[_0xc9d5('0x42')]=function(_0x28006b,_0x2f1323){var _0x4be1b3={'raw':!![],'where':{'id':_0x28006b['params']['id']}},_0x516b00={};_0x516b00[_0xc9d5('0x2a')]=_['keys'](db[_0xc9d5('0x26')][_0xc9d5('0x27')]);_0x516b00[_0xc9d5('0x2d')]=_[_0xc9d5('0x2e')](_0x28006b[_0xc9d5('0x2d')]);_0x516b00[_0xc9d5('0x38')]=_[_0xc9d5('0x2f')](_0x516b00[_0xc9d5('0x2a')],_0x516b00[_0xc9d5('0x2d')]);_0x4be1b3[_0xc9d5('0x30')]=_['intersection'](_0x516b00['model'],qs['fields'](_0x28006b['query'][_0xc9d5('0x31')]));_0x4be1b3['attributes']=_0x4be1b3[_0xc9d5('0x30')][_0xc9d5('0x32')]?_0x4be1b3[_0xc9d5('0x30')]:_0x516b00['model'];if(_0x28006b[_0xc9d5('0x2d')]['includeAll']){_0x4be1b3[_0xc9d5('0x3e')]=[{'all':!![]}];}_0x4be1b3=_[_0xc9d5('0x3a')]({},_0x4be1b3,_0x28006b[_0xc9d5('0x3d')]);return db['SmsApplication'][_0xc9d5('0x43')](_0x4be1b3)['then'](handleEntityNotFound(_0x2f1323,null))[_0xc9d5('0x21')](respondWithResult(_0x2f1323,null))[_0xc9d5('0x41')](handleError(_0x2f1323,null));};exports['create']=function(_0x5deb38,_0x27917c){return db[_0xc9d5('0x26')][_0xc9d5('0x44')](_0x5deb38[_0xc9d5('0x45')],{})[_0xc9d5('0x21')](respondWithResult(_0x27917c,0xc9))[_0xc9d5('0x41')](handleError(_0x27917c,null));};exports['update']=function(_0x2ccc36,_0x12a44b){if(_0x2ccc36[_0xc9d5('0x45')]['id']){delete _0x2ccc36[_0xc9d5('0x45')]['id'];}return db[_0xc9d5('0x26')][_0xc9d5('0x43')]({'where':{'id':_0x2ccc36[_0xc9d5('0x46')]['id']}})[_0xc9d5('0x21')](handleEntityNotFound(_0x12a44b,null))[_0xc9d5('0x21')](saveUpdates(_0x2ccc36[_0xc9d5('0x45')],null))['then'](respondWithResult(_0x12a44b,null))[_0xc9d5('0x41')](handleError(_0x12a44b,null));};exports[_0xc9d5('0x22')]=function(_0x4894c2,_0x3738cc){return db['SmsApplication']['find']({'where':{'id':_0x4894c2[_0xc9d5('0x46')]['id']}})[_0xc9d5('0x21')](handleEntityNotFound(_0x3738cc,null))[_0xc9d5('0x21')](removeEntity(_0x3738cc,null))[_0xc9d5('0x41')](handleError(_0x3738cc,null));}; \ No newline at end of file +var _0xd5cc=['map','SmsApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xd5cc,0xbd));var _0xcd5c=function(_0x23da7e,_0xa83279){_0x23da7e=_0x23da7e-0x0;var _0x4a07b5=_0xd5cc[_0x23da7e];return _0x4a07b5;};'use strict';var emlformat=require(_0xcd5c('0x0'));var rimraf=require(_0xcd5c('0x1'));var zipdir=require(_0xcd5c('0x2'));var jsonpatch=require(_0xcd5c('0x3'));var rp=require('request-promise');var moment=require(_0xcd5c('0x4'));var BPromise=require(_0xcd5c('0x5'));var Mustache=require(_0xcd5c('0x6'));var util=require(_0xcd5c('0x7'));var path=require(_0xcd5c('0x8'));var sox=require(_0xcd5c('0x9'));var csv=require(_0xcd5c('0xa'));var ejs=require(_0xcd5c('0xb'));var fs=require('fs');var fs_extra=require(_0xcd5c('0xc'));var _=require(_0xcd5c('0xd'));var squel=require(_0xcd5c('0xe'));var crypto=require('crypto');var jsforce=require(_0xcd5c('0xf'));var deskjs=require(_0xcd5c('0x10'));var toCsv=require(_0xcd5c('0xa'));var querystring=require('querystring');var Papa=require(_0xcd5c('0x11'));var Redis=require(_0xcd5c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcd5c('0x13'));var as=require(_0xcd5c('0x14'));var hardwareService=require(_0xcd5c('0x15'));var logger=require('../../config/logger')(_0xcd5c('0x16'));var utils=require('../../config/utils');var config=require(_0xcd5c('0x17'));var licenseUtil=require(_0xcd5c('0x18'));var db=require(_0xcd5c('0x19'))['db'];function respondWithStatusCode(_0x2df37f,_0x181f4a){_0x181f4a=_0x181f4a||0xcc;return function(_0x2bba85){if(_0x2bba85){return _0x2df37f[_0xcd5c('0x1a')](_0x181f4a);}return _0x2df37f['status'](_0x181f4a)[_0xcd5c('0x1b')]();};}function respondWithResult(_0x1640e1,_0x2dec8a){_0x2dec8a=_0x2dec8a||0xc8;return function(_0x413fbd){if(_0x413fbd){return _0x1640e1[_0xcd5c('0x1c')](_0x2dec8a)['json'](_0x413fbd);}};}function respondWithFilteredResult(_0x1e0268,_0x13842d){return function(_0xe24d61){if(_0xe24d61){var _0x12aa24=typeof _0x13842d[_0xcd5c('0x1d')]===_0xcd5c('0x1e')&&typeof _0x13842d[_0xcd5c('0x1f')]===_0xcd5c('0x1e');var _0x5b6637=_0xe24d61[_0xcd5c('0x20')];var _0x51af49=_0x12aa24?0x0:_0x13842d[_0xcd5c('0x1d')];var _0xd9673b=_0x12aa24?_0xe24d61[_0xcd5c('0x20')]:_0x13842d[_0xcd5c('0x1d')]+_0x13842d[_0xcd5c('0x1f')];var _0x13fc17;if(_0xd9673b>=_0x5b6637){_0xd9673b=_0x5b6637;_0x13fc17=0xc8;}else{_0x13fc17=0xce;}_0x1e0268[_0xcd5c('0x1c')](_0x13fc17);return _0x1e0268[_0xcd5c('0x21')](_0xcd5c('0x22'),_0x51af49+'-'+_0xd9673b+'/'+_0x5b6637)['json'](_0xe24d61);}return null;};}function patchUpdates(_0x157c9f){return function(_0x2054e2){try{jsonpatch[_0xcd5c('0x23')](_0x2054e2,_0x157c9f,!![]);}catch(_0x519514){return BPromise['reject'](_0x519514);}return _0x2054e2[_0xcd5c('0x24')]();};}function saveUpdates(_0x372827,_0x1a2cfb){return function(_0x2532af){if(_0x2532af){return _0x2532af[_0xcd5c('0x25')](_0x372827)[_0xcd5c('0x26')](function(_0x14143b){return _0x14143b;});}return null;};}function removeEntity(_0x519e30,_0x29f402){return function(_0x582ddb){if(_0x582ddb){return _0x582ddb[_0xcd5c('0x27')]()[_0xcd5c('0x26')](function(){_0x519e30[_0xcd5c('0x1c')](0xcc)[_0xcd5c('0x1b')]();});}};}function handleEntityNotFound(_0x1bf7fa,_0x490f0b){return function(_0x164cf6){if(!_0x164cf6){_0x1bf7fa[_0xcd5c('0x1a')](0x194);}return _0x164cf6;};}function handleError(_0x47ee21,_0x10f1a5){_0x10f1a5=_0x10f1a5||0x1f4;return function(_0x4f7096){logger[_0xcd5c('0x28')](_0x4f7096[_0xcd5c('0x29')]);if(_0x4f7096[_0xcd5c('0x2a')]){delete _0x4f7096[_0xcd5c('0x2a')];}_0x47ee21['status'](_0x10f1a5)[_0xcd5c('0x2b')](_0x4f7096);};}exports[_0xcd5c('0x2c')]=function(_0x4720d6,_0x43d617){var _0x1ca680={},_0x475657={},_0x5369c6={'count':0x0,'rows':[]};var _0x22301a=_[_0xcd5c('0x2d')](db[_0xcd5c('0x2e')][_0xcd5c('0x2f')],function(_0x1befc9){return{'name':_0x1befc9[_0xcd5c('0x30')],'type':_0x1befc9[_0xcd5c('0x31')]['key']};});_0x475657[_0xcd5c('0x32')]=_[_0xcd5c('0x2d')](_0x22301a,_0xcd5c('0x2a'));_0x475657[_0xcd5c('0x33')]=_[_0xcd5c('0x34')](_0x4720d6[_0xcd5c('0x33')]);_0x475657[_0xcd5c('0x35')]=_[_0xcd5c('0x36')](_0x475657[_0xcd5c('0x32')],_0x475657[_0xcd5c('0x33')]);_0x1ca680[_0xcd5c('0x37')]=_['intersection'](_0x475657['model'],qs['fields'](_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x38')]));_0x1ca680[_0xcd5c('0x37')]=_0x1ca680[_0xcd5c('0x37')][_0xcd5c('0x39')]?_0x1ca680[_0xcd5c('0x37')]:_0x475657['model'];if(!_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x3a')](_0xcd5c('0x3b'))){_0x1ca680[_0xcd5c('0x1f')]=qs[_0xcd5c('0x1f')](_0x4720d6['query'][_0xcd5c('0x1f')]);_0x1ca680[_0xcd5c('0x1d')]=qs['offset'](_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x1d')]);}_0x1ca680[_0xcd5c('0x3c')]=qs[_0xcd5c('0x3d')](_0x4720d6[_0xcd5c('0x33')]['sort']);_0x1ca680['where']=qs[_0xcd5c('0x35')](_[_0xcd5c('0x3e')](_0x4720d6[_0xcd5c('0x33')],_0x475657['filters']),_0x22301a);if(_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x3f')]){_0x1ca680[_0xcd5c('0x40')]=_['merge'](_0x1ca680[_0xcd5c('0x40')],{'$or':_[_0xcd5c('0x2d')](_0x22301a,function(_0xc9411d){if(_0xc9411d[_0xcd5c('0x31')]!==_0xcd5c('0x41')){var _0x4d8da3={};_0x4d8da3[_0xc9411d[_0xcd5c('0x2a')]]={'$like':'%'+_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x3f')]+'%'};return _0x4d8da3;}})});}_0x1ca680=_[_0xcd5c('0x42')]({},_0x1ca680,_0x4720d6[_0xcd5c('0x43')]);var _0x430162={'where':_0x1ca680[_0xcd5c('0x40')]};return db['SmsApplication']['count'](_0x430162)[_0xcd5c('0x26')](function(_0x37aa82){_0x5369c6[_0xcd5c('0x20')]=_0x37aa82;if(_0x4720d6[_0xcd5c('0x33')][_0xcd5c('0x44')]){_0x1ca680[_0xcd5c('0x45')]=[{'all':!![]}];}return db[_0xcd5c('0x2e')][_0xcd5c('0x46')](_0x1ca680);})[_0xcd5c('0x26')](function(_0x637544){_0x5369c6[_0xcd5c('0x47')]=_0x637544;return _0x5369c6;})['then'](respondWithFilteredResult(_0x43d617,_0x1ca680))[_0xcd5c('0x48')](handleError(_0x43d617,null));};exports[_0xcd5c('0x49')]=function(_0x1383da,_0x41aba3){var _0x3bf738={'raw':!![],'where':{'id':_0x1383da[_0xcd5c('0x4a')]['id']}},_0x31986e={};_0x31986e[_0xcd5c('0x32')]=_[_0xcd5c('0x34')](db['SmsApplication'][_0xcd5c('0x2f')]);_0x31986e['query']=_[_0xcd5c('0x34')](_0x1383da[_0xcd5c('0x33')]);_0x31986e[_0xcd5c('0x35')]=_[_0xcd5c('0x36')](_0x31986e[_0xcd5c('0x32')],_0x31986e['query']);_0x3bf738[_0xcd5c('0x37')]=_[_0xcd5c('0x36')](_0x31986e[_0xcd5c('0x32')],qs[_0xcd5c('0x38')](_0x1383da[_0xcd5c('0x33')][_0xcd5c('0x38')]));_0x3bf738[_0xcd5c('0x37')]=_0x3bf738[_0xcd5c('0x37')][_0xcd5c('0x39')]?_0x3bf738[_0xcd5c('0x37')]:_0x31986e['model'];if(_0x1383da[_0xcd5c('0x33')][_0xcd5c('0x44')]){_0x3bf738[_0xcd5c('0x45')]=[{'all':!![]}];}_0x3bf738=_[_0xcd5c('0x42')]({},_0x3bf738,_0x1383da['options']);return db[_0xcd5c('0x2e')][_0xcd5c('0x4b')](_0x3bf738)[_0xcd5c('0x26')](handleEntityNotFound(_0x41aba3,null))[_0xcd5c('0x26')](respondWithResult(_0x41aba3,null))[_0xcd5c('0x48')](handleError(_0x41aba3,null));};exports['create']=function(_0x4d7eee,_0x302694){return db[_0xcd5c('0x2e')][_0xcd5c('0x4c')](_0x4d7eee[_0xcd5c('0x4d')],{})[_0xcd5c('0x26')](respondWithResult(_0x302694,0xc9))[_0xcd5c('0x48')](handleError(_0x302694,null));};exports[_0xcd5c('0x25')]=function(_0x2790dd,_0x4a5072){if(_0x2790dd['body']['id']){delete _0x2790dd['body']['id'];}return db[_0xcd5c('0x2e')][_0xcd5c('0x4b')]({'where':{'id':_0x2790dd[_0xcd5c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a5072,null))[_0xcd5c('0x26')](saveUpdates(_0x2790dd['body'],null))[_0xcd5c('0x26')](respondWithResult(_0x4a5072,null))['catch'](handleError(_0x4a5072,null));};exports[_0xcd5c('0x27')]=function(_0x48d163,_0xfae82b){return db[_0xcd5c('0x2e')][_0xcd5c('0x4b')]({'where':{'id':_0x48d163['params']['id']}})[_0xcd5c('0x26')](handleEntityNotFound(_0xfae82b,null))[_0xcd5c('0x26')](removeEntity(_0xfae82b,null))['catch'](handleError(_0xfae82b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 31a6320..8b1dd5a 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 _0x5b94=['rimraf','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e8587,_0x2915a6){var _0x20e337=function(_0x128a25){while(--_0x128a25){_0x3e8587['push'](_0x3e8587['shift']());}};_0x20e337(++_0x2915a6);}(_0x5b94,0x117));var _0x45b9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x5b94[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x45b9('0x0'));var util=require(_0x45b9('0x1'));var logger=require(_0x45b9('0x2'))('api');var moment=require(_0x45b9('0x3'));var BPromise=require(_0x45b9('0x4'));var rp=require(_0x45b9('0x5'));var fs=require('fs');var path=require(_0x45b9('0x6'));var rimraf=require(_0x45b9('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x45b9('0x8')]=function(_0x470291,_0x10b5b2){return _0x470291[_0x45b9('0x9')](_0x45b9('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x45b9('0xb'),'collate':_0x45b9('0xc')});}; \ No newline at end of file +var _0x1eb0=['api','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger'];(function(_0x2dee5b,_0x594f92){var _0x508851=function(_0x246e89){while(--_0x246e89){_0x2dee5b['push'](_0x2dee5b['shift']());}};_0x508851(++_0x594f92);}(_0x1eb0,0x13c));var _0x01eb=function(_0x3e2e57,_0x46f8ee){_0x3e2e57=_0x3e2e57-0x0;var _0x9dfca2=_0x1eb0[_0x3e2e57];return _0x9dfca2;};'use strict';var _=require(_0x01eb('0x0'));var util=require(_0x01eb('0x1'));var logger=require(_0x01eb('0x2'))(_0x01eb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01eb('0x5'));var config=require(_0x01eb('0x6'));var attributes=require(_0x01eb('0x7'));module[_0x01eb('0x8')]=function(_0x1943e4,_0x24ca59){return _0x1943e4[_0x01eb('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01eb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5fe3337..f0637f1 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 _0xcac3=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b0489,_0x599690){var _0x12fe60=function(_0x2b5844){while(--_0x2b5844){_0x4b0489['push'](_0x4b0489['shift']());}};_0x12fe60(++_0x599690);}(_0xcac3,0x193));var _0x3cac=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0xcac3[_0x42c6f1];return _0x3c7398;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var moment=require(_0x3cac('0x1'));var BPromise=require(_0x3cac('0x2'));var rs=require(_0x3cac('0x3'));var fs=require('fs');var Redis=require(_0x3cac('0x4'));var db=require(_0x3cac('0x5'))['db'];var utils=require(_0x3cac('0x6'));var logger=require(_0x3cac('0x7'))(_0x3cac('0x8'));var config=require(_0x3cac('0x9'));var jayson=require(_0x3cac('0xa'));var client=jayson[_0x3cac('0xb')][_0x3cac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2560,_0x14562c,_0x21365c){return new BPromise(function(_0x13c1b9,_0x55670d){return client[_0x3cac('0xd')](_0x1e2560,_0x21365c)[_0x3cac('0xe')](function(_0x3bcbed){logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,'request\x20sent');logger[_0x3cac('0x11')](_0x3cac('0x12'),_0x14562c,_0x3cac('0x13'),JSON[_0x3cac('0x14')](_0x3bcbed));if(_0x3bcbed[_0x3cac('0x15')]){if(_0x3bcbed['error']['code']===0x1f4){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x55670d(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}logger[_0x3cac('0x15')]('SmsApplication,\x20%s,\x20%s',_0x14562c,_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);return _0x13c1b9(_0x3bcbed[_0x3cac('0x15')][_0x3cac('0x16')]);}else{logger[_0x3cac('0xf')](_0x3cac('0x10'),_0x14562c,_0x3cac('0x13'));_0x13c1b9(_0x3bcbed[_0x3cac('0x17')][_0x3cac('0x16')]);}})[_0x3cac('0x18')](function(_0x4173ca){logger[_0x3cac('0x15')](_0x3cac('0x10'),_0x14562c,_0x4173ca);_0x55670d(_0x4173ca);});});} \ No newline at end of file +var _0xe458=['error','code','message','SmsApplication,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x558445,_0x2bd10d){var _0x1ddf13=function(_0x531498){while(--_0x531498){_0x558445['push'](_0x558445['shift']());}};_0x1ddf13(++_0x2bd10d);}(_0xe458,0x160));var _0x8e45=function(_0x5bdc12,_0x4712f5){_0x5bdc12=_0x5bdc12-0x0;var _0x5c8d37=_0xe458[_0x5bdc12];return _0x5c8d37;};'use strict';var _=require(_0x8e45('0x0'));var util=require(_0x8e45('0x1'));var moment=require('moment');var BPromise=require(_0x8e45('0x2'));var rs=require(_0x8e45('0x3'));var fs=require('fs');var Redis=require(_0x8e45('0x4'));var db=require(_0x8e45('0x5'))['db'];var utils=require(_0x8e45('0x6'));var logger=require(_0x8e45('0x7'))(_0x8e45('0x8'));var config=require(_0x8e45('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8e45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a92a1,_0x3a646f,_0x37cde4){return new BPromise(function(_0x27433a,_0x1f60da){return client[_0x8e45('0xb')](_0x3a92a1,_0x37cde4)['then'](function(_0x59886a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3a646f,_0x8e45('0xc'));logger[_0x8e45('0xd')](_0x8e45('0xe'),_0x3a646f,'request\x20sent',JSON[_0x8e45('0xf')](_0x59886a));if(_0x59886a[_0x8e45('0x10')]){if(_0x59886a['error'][_0x8e45('0x11')]===0x1f4){logger[_0x8e45('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3a646f,_0x59886a[_0x8e45('0x10')][_0x8e45('0x12')]);return _0x1f60da(_0x59886a['error'][_0x8e45('0x12')]);}logger[_0x8e45('0x10')](_0x8e45('0x13'),_0x3a646f,_0x59886a['error'][_0x8e45('0x12')]);return _0x27433a(_0x59886a[_0x8e45('0x10')][_0x8e45('0x12')]);}else{logger[_0x8e45('0x14')](_0x8e45('0x13'),_0x3a646f,_0x8e45('0xc'));_0x27433a(_0x59886a[_0x8e45('0x15')][_0x8e45('0x12')]);}})[_0x8e45('0x16')](function(_0x23071d){logger[_0x8e45('0x10')](_0x8e45('0x13'),_0x3a646f,_0x23071d);_0x1f60da(_0x23071d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ab243c2..a6d4212 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 _0x9c00=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags'];(function(_0x4cacfc,_0x56dfe0){var _0xffb88c=function(_0x3023b7){while(--_0x3023b7){_0x4cacfc['push'](_0x4cacfc['shift']());}};_0xffb88c(++_0x56dfe0);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3d075a,_0x507f04){_0x3d075a=_0x3d075a-0x0;var _0x418be1=_0x9c00[_0x3d075a];return _0x418be1;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x8')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x11')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x11')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x11')](_0x09c0('0x14'),auth[_0x09c0('0xa')](),interaction[_0x09c0('0x15')](_0x09c0('0x16'),_0x09c0('0x17')),controller[_0x09c0('0x18')]);router[_0x09c0('0x19')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x09c0('0x1b')),controller[_0x09c0('0x1c')]);router[_0x09c0('0x1d')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction[_0x09c0('0x15')]('sms','smsinteraction:destroy'),controller[_0x09c0('0x1e')]);router['delete'](_0x09c0('0x14'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x5e0ea9,_0xf6bdf2){var _0x5968c1=function(_0xfe95fd){while(--_0xfe95fd){_0x5e0ea9['push'](_0x5e0ea9['shift']());}};_0x5968c1(++_0xf6bdf2);}(_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('./smsInteraction.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('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 07b92c2..249fd59 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 _0x2bae=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x97d2e6,_0x4b5b97){var _0x236bf6=function(_0x65811e){while(--_0x65811e){_0x97d2e6['push'](_0x97d2e6['shift']());}};_0x236bf6(++_0x4b5b97);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));var moment=require(_0xe2ba('0x1'));module[_0xe2ba('0x2')]={'closed':{'type':Sequelize[_0xe2ba('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe2ba('0x4')]},'disposition':{'type':Sequelize[_0xe2ba('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe2ba('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe2ba('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe2ba('0x6')]('in',_0xe2ba('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe2ba('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe2ba('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe2ba('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x207c=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0x207c,0x1e8));var _0xc207=function(_0x1ba5ba,_0x566734){_0x1ba5ba=_0x1ba5ba-0x0;var _0x5991c6=_0x207c[_0x1ba5ba];return _0x5991c6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc207('0x0'));module[_0xc207('0x1')]={'closed':{'type':Sequelize[_0xc207('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc207('0x3')]},'disposition':{'type':Sequelize[_0xc207('0x4')]},'secondDisposition':{'type':Sequelize[_0xc207('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc207('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc207('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc207('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc207('0x5')]('in',_0xc207('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1b15b18..3639766 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 _0xb99b=['QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','keys','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Messages','createdAt','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','disposition','out','firstName','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','split','forEach','push','catch','answered','unmanaged','closed','waiting','talking','UserId','index','SmsInteraction','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','start','body','compact','isEmpty','SmsAccountId','concat','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','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'];(function(_0x3d5e01,_0x417ced){var _0x1b452b=function(_0x3c1dfa){while(--_0x3c1dfa){_0x3d5e01['push'](_0x3d5e01['shift']());}};_0x1b452b(++_0x417ced);}(_0xb99b,0x13a));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xbb99('0x0'));var rimraf=require(_0xbb99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb99('0x2'));var rp=require('request-promise');var moment=require(_0xbb99('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbb99('0x4'));var util=require('util');var path=require(_0xbb99('0x5'));var sox=require(_0xbb99('0x6'));var csv=require(_0xbb99('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb99('0x8'));var _=require(_0xbb99('0x9'));var squel=require(_0xbb99('0xa'));var crypto=require(_0xbb99('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb99('0xc'));var toCsv=require(_0xbb99('0x7'));var querystring=require(_0xbb99('0xd'));var Papa=require(_0xbb99('0xe'));var Redis=require('ioredis');var authService=require(_0xbb99('0xf'));var qs=require(_0xbb99('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbb99('0x11'));var hardwareService=require(_0xbb99('0x12'));var logger=require(_0xbb99('0x13'))('api');var utils=require(_0xbb99('0x14'));var config=require(_0xbb99('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb99('0x16'))['db'];config[_0xbb99('0x17')]=_[_0xbb99('0x18')](config[_0xbb99('0x17')],{'host':_0xbb99('0x19'),'port':0x18eb});var socket=require(_0xbb99('0x1a'))(new Redis(config[_0xbb99('0x17')]));require(_0xbb99('0x1b'))[_0xbb99('0x1c')](socket);function respondWithStatusCode(_0x588399,_0x504c9a){_0x504c9a=_0x504c9a||0xcc;return function(_0x36aa0f){if(_0x36aa0f){return _0x588399[_0xbb99('0x1d')](_0x504c9a);}return _0x588399[_0xbb99('0x1e')](_0x504c9a)['end']();};}function respondWithResult(_0x37df1d,_0x3559f9){_0x3559f9=_0x3559f9||0xc8;return function(_0x571892){if(_0x571892){return _0x37df1d[_0xbb99('0x1e')](_0x3559f9)[_0xbb99('0x1f')](_0x571892);}};}function respondWithFilteredResult(_0x2954db,_0x31db82){return function(_0x1a4603){if(_0x1a4603){var _0x491d01=typeof _0x31db82['offset']==='undefined'&&typeof _0x31db82[_0xbb99('0x20')]==='undefined';var _0x2447e6=_0x1a4603['count'];var _0x52d0fc=_0x491d01?0x0:_0x31db82[_0xbb99('0x21')];var _0x4ce9d1=_0x491d01?_0x1a4603[_0xbb99('0x22')]:_0x31db82[_0xbb99('0x21')]+_0x31db82[_0xbb99('0x20')];var _0x1747a3;if(_0x4ce9d1>=_0x2447e6){_0x4ce9d1=_0x2447e6;_0x1747a3=0xc8;}else{_0x1747a3=0xce;}_0x2954db[_0xbb99('0x1e')](_0x1747a3);return _0x2954db[_0xbb99('0x23')](_0xbb99('0x24'),_0x52d0fc+'-'+_0x4ce9d1+'/'+_0x2447e6)[_0xbb99('0x1f')](_0x1a4603);}return null;};}function patchUpdates(_0x29eb0b){return function(_0x17a0a2){try{jsonpatch['apply'](_0x17a0a2,_0x29eb0b,!![]);}catch(_0x10320f){return BPromise[_0xbb99('0x25')](_0x10320f);}return _0x17a0a2[_0xbb99('0x26')]();};}function saveUpdates(_0x314dda,_0x25c2e5){return function(_0x5e18cd){if(_0x5e18cd){return _0x5e18cd[_0xbb99('0x27')](_0x314dda)[_0xbb99('0x28')](function(_0x6b7b52){return _0x6b7b52;});}return null;};}function removeEntity(_0x555015,_0x427be0){return function(_0x36af0d){if(_0x36af0d){return _0x36af0d[_0xbb99('0x29')]()[_0xbb99('0x28')](function(){_0x555015[_0xbb99('0x1e')](0xcc)[_0xbb99('0x2a')]();});}};}function handleEntityNotFound(_0x4c5fb2,_0x13db6f){return function(_0x3491aa){if(!_0x3491aa){_0x4c5fb2[_0xbb99('0x1d')](0x194);}return _0x3491aa;};}function handleError(_0x3509f0,_0x3fe06d){_0x3fe06d=_0x3fe06d||0x1f4;return function(_0x15d91a){logger[_0xbb99('0x2b')](_0x15d91a[_0xbb99('0x2c')]);if(_0x15d91a['name']){delete _0x15d91a[_0xbb99('0x2d')];}_0x3509f0[_0xbb99('0x1e')](_0x3fe06d)[_0xbb99('0x2e')](_0x15d91a);};}function getInteractionUsers(_0x27c315,_0x7e0299){return new BPromise(function(_0x113d77,_0x4dd141){try{if(_0x7e0299[_0x27c315['id']]){_0x27c315[_0xbb99('0x2f')]=_[_0xbb99('0x30')](_0x7e0299[_0x27c315['id']],function(_0x273ca6){return{'id':_0x273ca6['id'],'fullname':_0x273ca6['fullname']};});}}catch(_0x40ee2b){_0x4dd141(_0x40ee2b);}_0x113d77(_0x27c315);});}function getInteractionTags(_0x27b7e3,_0x37a36b){return new BPromise(function(_0x7402c3,_0x2233f5){try{if(_0x27b7e3['TagIds']){_0x27b7e3['Tags']=[];_0x27b7e3[_0xbb99('0x31')][_0xbb99('0x32')](',')[_0xbb99('0x33')](function(_0x23c582){_0x27b7e3['Tags'][_0xbb99('0x34')](_0x37a36b[_0x23c582]);});}delete _0x27b7e3['TagIds'];}catch(_0x3b8aab){_0x2233f5(_0x3b8aab);}_0x7402c3(_0x27b7e3);});}function updateSmsInteraction(_0x48660,_0x4281ce,_0x32e17a){return new BPromise(function(_0x1d58a0,_0x2e4e7c){return getInteractionUsers(_0x48660,_0x32e17a)[_0xbb99('0x28')](function(_0x235a6f){return getInteractionTags(_0x235a6f,_0x4281ce);})[_0xbb99('0x28')](function(_0x586de3){return getStateInteraction(_0x586de3);})['then'](function(_0x130648){_0x1d58a0(_0x130648);})[_0xbb99('0x35')](function(_0x26f6bf){_0x2e4e7c(_0x26f6bf);});});}function getStateInteraction(_0x1438db){return new BPromise(function(_0x5f4407){_0x1438db['waiting']=0x0;_0x1438db['talking']=0x0;_0x1438db[_0xbb99('0x36')]=0x0;_0x1438db[_0xbb99('0x37')]=0x0;_0x1438db['total']=0x0;if(!_0x1438db[_0xbb99('0x38')]&&!_0x1438db['UserId']){_0x1438db[_0xbb99('0x39')]+=0x1;}if(!_0x1438db[_0xbb99('0x38')]&&_0x1438db['UserId']){_0x1438db[_0xbb99('0x3a')]+=0x1;if(_0x1438db[_0xbb99('0x39')]){_0x1438db['waiting']-=0x1;}}if(_0x1438db[_0xbb99('0x38')]&&_0x1438db[_0xbb99('0x3b')]){_0x1438db['answered']+=0x1;if(_0x1438db[_0xbb99('0x3a')]){_0x1438db[_0xbb99('0x3a')]-=0x1;}}if(_0x1438db['closed']&&!_0x1438db[_0xbb99('0x3b')]){_0x1438db[_0xbb99('0x37')]+=0x1;if(_0x1438db[_0xbb99('0x39')]){_0x1438db[_0xbb99('0x39')]-=0x1;}}_0x1438db['total']+=0x1;_0x5f4407(_0x1438db);});}exports[_0xbb99('0x3c')]=function(_0x249168,_0x4c7981){var _0x50954d={},_0x249504={},_0x8e04fa={'count':0x0,'rows':[]};var _0x259da0=_[_0xbb99('0x30')](db[_0xbb99('0x3d')][_0xbb99('0x3e')],function(_0x1d922d){return{'name':_0x1d922d['fieldName'],'type':_0x1d922d[_0xbb99('0x3f')][_0xbb99('0x40')]};});_0x249504['model']=_[_0xbb99('0x30')](_0x259da0,_0xbb99('0x2d'));_0x249504[_0xbb99('0x41')]=_['keys'](_0x249168['query']);_0x249504[_0xbb99('0x42')]=_['intersection'](_0x249504[_0xbb99('0x43')],_0x249504[_0xbb99('0x41')]);_0x50954d[_0xbb99('0x44')]=_[_0xbb99('0x45')](_0x249504[_0xbb99('0x43')],qs[_0xbb99('0x46')](_0x249168[_0xbb99('0x41')][_0xbb99('0x46')]));_0x50954d[_0xbb99('0x44')]=_0x50954d[_0xbb99('0x44')][_0xbb99('0x47')]?_0x50954d[_0xbb99('0x44')]:_0x249504['model'];if(!_0x249168[_0xbb99('0x41')][_0xbb99('0x48')](_0xbb99('0x49'))){_0x50954d[_0xbb99('0x20')]=qs[_0xbb99('0x20')](_0x249168[_0xbb99('0x41')][_0xbb99('0x20')]);_0x50954d[_0xbb99('0x21')]=qs[_0xbb99('0x21')](_0x249168[_0xbb99('0x41')][_0xbb99('0x21')]);}_0x50954d['order']=qs['sort'](_0x249168[_0xbb99('0x41')][_0xbb99('0x4a')]);_0x50954d[_0xbb99('0x4b')]=qs[_0xbb99('0x42')](_[_0xbb99('0x4c')](_0x249168[_0xbb99('0x41')],_0x249504[_0xbb99('0x42')]),_0x259da0);var _0x5d339a=[];var _0x689915=squel[_0xbb99('0x4d')]()[_0xbb99('0x4e')]('id')[_0xbb99('0x4e')](_0xbb99('0x2d'))[_0xbb99('0x4e')](_0xbb99('0x4f'))[_0xbb99('0x50')](_0xbb99('0x51'));var _0xb44a30=squel['select']()[_0xbb99('0x4e')]('u.id')[_0xbb99('0x4e')]('u.fullname')[_0xbb99('0x4e')](_0xbb99('0x52'))[_0xbb99('0x50')](_0xbb99('0x53'),'ui')[_0xbb99('0x54')]('users','u',_0xbb99('0x55'));var _0x11df81=squel[_0xbb99('0x4d')]()[_0xbb99('0x50')]('sms_interactions','i')[_0xbb99('0x54')]('cm_contacts','c',_0xbb99('0x56'))['left_join'](_0xbb99('0x57'),'o',_0xbb99('0x58'))[_0xbb99('0x54')](_0xbb99('0x59'),'a',_0xbb99('0x5a'))[_0xbb99('0x54')]('sms_messages','me',_0xbb99('0x5b'))[_0xbb99('0x54')]('sms_interaction_has_tags','it',_0xbb99('0x5c'))[_0xbb99('0x54')](_0xbb99('0x51'),'t',_0xbb99('0x5d'));var _0x25e9d1=squel['expr']();var _0x5c06b2=[];var _0x4a363d=squel['expr']();var _0x7abf4f;if(_0x249168['query'][_0xbb99('0x5e')]){_0x7abf4f=as[_0xbb99('0x5f')](_0x249168[_0xbb99('0x41')][_0xbb99('0x5e')]);var _0x210602=_0x7abf4f[_0xbb99('0x60')];for(var _0x167e6b=0x0;_0x167e6b<_0x7abf4f[_0xbb99('0x61')][_0xbb99('0x47')];_0x167e6b++){var _0x44bbd6=_0x7abf4f[_0xbb99('0x61')][_0x167e6b];var _0x20f25e='i';var _0x204e64=_[_0xbb99('0x62')](_0x259da0,[_0xbb99('0x2d'),_0x44bbd6[_0xbb99('0x4e')]]);if(!_0x204e64){switch(_0x44bbd6[_0xbb99('0x4e')]){case _0xbb99('0x63'):if(_0x44bbd6[_0xbb99('0x64')]==0x1){_0x11df81[_0xbb99('0x65')]('`'+_0x44bbd6[_0xbb99('0x4e')]+'`\x20=\x200');}else{_0x11df81[_0xbb99('0x65')]('`'+_0x44bbd6[_0xbb99('0x4e')]+_0xbb99('0x66'));}break;case _0xbb99('0x67'):if(_0x44bbd6['operator']===_0xbb99('0x68')){if(_0x44bbd6[_0xbb99('0x64')]['split']('\x20')[_0xbb99('0x47')]>0x1){_0x25e9d1[_0x210602](_0xbb99('0x69'),qs[_0xbb99('0x6a')](_0x44bbd6[_0xbb99('0x64')]),null);}else{var _0x13543e='%'+_0x44bbd6[_0xbb99('0x64')]+'%';_0x25e9d1[_0x210602](_0xbb99('0x6b'),_0x13543e,_0x13543e,_0x13543e);}}else{_0x204e64=_['find'](_0x259da0,['name',_0xbb99('0x6c')]);_0x44bbd6[_0xbb99('0x4e')]=_0xbb99('0x6c');_0x10e632=as[_0xbb99('0x6d')](_0x20f25e,_0x204e64['type'],_0x44bbd6);_0x25e9d1[_0x210602](_0x10e632[_0xbb99('0x6e')],_0x10e632[_0xbb99('0x64')]['start'],_0x10e632[_0xbb99('0x64')][_0xbb99('0x2a')]);}break;case _0xbb99('0x6f'):var _0x41a7fd=_0x44bbd6['value']['split'](',')[_0xbb99('0x30')](function(_0x2ce64c){return Number(_0x2ce64c);});_0x41a7fd[_0xbb99('0x33')](function(_0xb50801){_0x4a363d['or'](_0xbb99('0x70'),'%,'+_0xb50801+',%');});_0x5c06b2=_['union'](_0x5c06b2,_0x41a7fd);break;case _0xbb99('0x71'):if(_0x44bbd6['operator']===_0xbb99('0x68')){_0x25e9d1[_0x210602]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x44bbd6['value']+'%',null);}else{_0x204e64=_[_0xbb99('0x62')](_0x259da0,[_0xbb99('0x2d'),_0xbb99('0x3b')]);_0x44bbd6[_0xbb99('0x4e')]=_0xbb99('0x3b');_0x10e632=as['buildExpression'](_0x20f25e,_0x204e64[_0xbb99('0x3f')],_0x44bbd6);_0x25e9d1[_0x210602](_0x10e632[_0xbb99('0x6e')],_0x10e632[_0xbb99('0x64')][_0xbb99('0x72')],_0x10e632['value'][_0xbb99('0x2a')]);}break;case _0xbb99('0x73'):_0x10e632=as[_0xbb99('0x6d')]('me',null,_0x44bbd6);_0x25e9d1[_0x210602](_0x10e632['text'],_0x10e632[_0xbb99('0x64')][_0xbb99('0x72')],_0x10e632[_0xbb99('0x64')][_0xbb99('0x2a')]);break;}}else{var _0x10e632=as[_0xbb99('0x6d')](_0x20f25e,_0x204e64[_0xbb99('0x3f')],_0x44bbd6);_0x25e9d1[_0x210602](_0x10e632[_0xbb99('0x6e')],_0x10e632[_0xbb99('0x64')][_0xbb99('0x72')],_0x10e632[_0xbb99('0x64')]['end']);}}}else{var _0x5839d3=_(_0x249168['query'])['keys']()[_0xbb99('0x30')](function(_0x46d26f){return _['some'](_0x259da0,[_0xbb99('0x2d'),_0x46d26f])?_0x46d26f:undefined;})[_0xbb99('0x74')]()[_0xbb99('0x64')]();if(!_[_0xbb99('0x75')](_0x5839d3)){_0x5839d3['forEach'](function(_0x53676a){if(_0x53676a===_0xbb99('0x76')){_0x11df81[_0xbb99('0x4b')]('i.SmsAccountId\x20IN\x20?',[][_0xbb99('0x77')](_0x249168[_0xbb99('0x41')][_0x53676a]));}else if(_0x53676a==='createdAt'){var _0x1b87e2=JSON[_0xbb99('0x78')](_0x249168[_0xbb99('0x41')][_0x53676a])[_0xbb99('0x79')];var _0xb45d1c=JSON[_0xbb99('0x78')](_0x249168[_0xbb99('0x41')][_0x53676a])[_0xbb99('0x7a')];_0x11df81[_0xbb99('0x4b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1b87e2,_0xb45d1c);}else{if(_0x249168['query'][_0x53676a]==='null'){_0x11df81[_0xbb99('0x4b')]('i.'+_0x53676a+_0xbb99('0x7b'));}else{_0x11df81['where']('i.'+_0x53676a+'\x20=\x20?',_0x249168[_0xbb99('0x41')][_0x53676a]);}}});}if(_0x249168['query']['read']){if(_0x249168[_0xbb99('0x41')][_0xbb99('0x7c')]==0x1){_0x11df81[_0xbb99('0x65')](_0xbb99('0x7d'));}else{_0x11df81['having'](_0xbb99('0x7e'));}}if(_0x249168[_0xbb99('0x41')][_0xbb99('0x7f')]){_0x5c06b2=_['isArray'](_0x249168['query'][_0xbb99('0x7f')])?_0x249168[_0xbb99('0x41')][_0xbb99('0x7f')]:new Array(_0x249168[_0xbb99('0x41')][_0xbb99('0x7f')]);_0x5c06b2[_0xbb99('0x33')](function(_0x4d5ffc){_0x4a363d['or'](_0xbb99('0x70'),'%,'+_0x4d5ffc+',%');});}if(_0x249168['query'][_0xbb99('0x80')]){var _0x812551=_0x249168[_0xbb99('0x41')][_0xbb99('0x80')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x812551)){_0x25e9d1['or'](_0xbb99('0x81'),_0x812551+'%')['or']('i.phone\x20LIKE\x20?',_0x812551+'%');}else{_0x25e9d1['or'](_0xbb99('0x82'),qs[_0xbb99('0x6a')](_0x812551))['or'](_0xbb99('0x83'),_0x812551+'%');}}}_0x11df81[_0xbb99('0x4b')](_0x25e9d1);_0x11df81[_0xbb99('0x84')](_0xbb99('0x85'));var _0x2368c0={'type':db['Sequelize'][_0xbb99('0x86')][_0xbb99('0x87')],'raw':!![]};var _0x4f0dfc=_0x11df81['clone']();_0x4f0dfc[_0xbb99('0x4e')](_0xbb99('0x85'));_0x4f0dfc[_0xbb99('0x4e')](_0xbb99('0x88'),_0xbb99('0x63'));if(_0x50954d[_0xbb99('0x89')]){_0x50954d[_0xbb99('0x89')]['forEach'](function(_0x4661bc){var _0x5e93f1=_0x4661bc[0x0]===_0xbb99('0x8a')?_0x4661bc[0x0]:'i.'+_0x4661bc[0x0];_0x11df81[_0xbb99('0x89')](_0x5e93f1,_0x4661bc[0x1]==='DESC'?![]:!![]);});}if(!_[_0xbb99('0x75')](_0x5c06b2)){_0x11df81[_0xbb99('0x65')](_0x4a363d);_0x4f0dfc['where'](_0xbb99('0x8b'),_0x5c06b2);}BPromise['resolve']()['then'](function(){if(!_0x7abf4f){if(_0x249168['query']['SmsAccountId'])return;_0x4f0dfc['where'](_0xbb99('0x8c'));_0x11df81[_0xbb99('0x4b')](_0xbb99('0x8c'));return;}if(_0x249168[_0xbb99('0x8d')][_0xbb99('0x8e')]!==_0xbb99('0x8f'))return;return _0x249168[_0xbb99('0x8d')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x41c0ed){if(_['isEmpty'](_0x41c0ed)){_0x4f0dfc['where'](_0xbb99('0x90'));_0x11df81[_0xbb99('0x4b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4f0dfc[_0xbb99('0x4b')](_0xbb99('0x91'),_[_0xbb99('0x30')](_0x41c0ed,'id'));_0x11df81[_0xbb99('0x4b')](_0xbb99('0x91'),_[_0xbb99('0x30')](_0x41c0ed,'id'));}});})[_0xbb99('0x28')](function(){if(_0x249168[_0xbb99('0x8d')][_0xbb99('0x8e')]===_0xbb99('0x8f')&&!_0x7abf4f&&!_0x249168['query']['SmsAccountId'])return[];return db[_0xbb99('0x92')][_0xbb99('0x41')](_0x4f0dfc['toString'](),_0x2368c0);})['then'](function(_0x58d005){_0x8e04fa[_0xbb99('0x22')]=_0x58d005[_0xbb99('0x47')];if(_0x8e04fa[_0xbb99('0x22')]===0x0)return[];return db['sequelize']['query'](_0x689915['toString'](),_0x2368c0)['then'](function(_0x94152b){_0x5d339a=_[_0xbb99('0x93')](_0x94152b,'id');_0x2368c0=_['merge'](_0x2368c0,{'model':db[_0xbb99('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x249168[_0xbb99('0x41')]['fields']){_0x50954d[_0xbb99('0x44')][_0xbb99('0x33')](function(_0x2198b1){_0x11df81['field']('i.'+_0x2198b1);});}else{_0x11df81['field'](_0xbb99('0x88'),_0xbb99('0x63'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x94'),_0xbb99('0x95'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x96'),_0xbb99('0x97'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x98'),_0xbb99('0x8a'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x99'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x9a'),'Contact.firstName');_0x11df81[_0xbb99('0x4e')](_0xbb99('0x9b'),_0xbb99('0x9c'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x9d'),_0xbb99('0x9e'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0x9f'),_0xbb99('0xa0'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0xa1'),_0xbb99('0xa2'));_0x11df81['field']('c.fax','Contact.fax');_0x11df81[_0xbb99('0x4e')](_0xbb99('0xa3'),_0xbb99('0xa4'));_0x11df81[_0xbb99('0x4e')](_0xbb99('0xa5'),'Owner.internal');_0x11df81[_0xbb99('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbb99('0x31'));}if(_0x50954d['limit'])_0x11df81[_0xbb99('0x20')](_0x50954d[_0xbb99('0x20')]);if(_0x50954d[_0xbb99('0x21')])_0x11df81[_0xbb99('0x21')](_0x50954d[_0xbb99('0x21')]);return db[_0xbb99('0x92')][_0xbb99('0x41')](_0x11df81[_0xbb99('0xa6')](),_0x2368c0);})[_0xbb99('0x28')](function(_0x44834b){if(_0x44834b['length']>0x0)_0xb44a30[_0xbb99('0x4b')](_0xbb99('0xa7'),_[_0xbb99('0x30')](_0x44834b,'id'));return db[_0xbb99('0x92')]['query'](_0xb44a30[_0xbb99('0xa6')](),_0x2368c0)[_0xbb99('0x28')](function(_0x276857){var _0x28af41=_[_0xbb99('0xa8')](_0x276857,_0xbb99('0xa9'));var _0x5b43e4=[];_0x44834b[_0xbb99('0x33')](function(_0x1c2f4d){_0x5b43e4[_0xbb99('0x34')](updateSmsInteraction(_0x1c2f4d,_0x5d339a,_0x28af41));});return BPromise[_0xbb99('0xaa')](_0x5b43e4);});});})[_0xbb99('0x28')](function(_0x4f264f){_0x8e04fa[_0xbb99('0xab')]=_0x4f264f;return _0x8e04fa;})[_0xbb99('0x28')](respondWithFilteredResult(_0x4c7981,_0x50954d))[_0xbb99('0x35')](handleError(_0x4c7981,null));};exports['show']=function(_0x21a3b4,_0x5ebe42){var _0x49bdaf={'raw':![],'where':{'id':_0x21a3b4[_0xbb99('0xac')]['id']}},_0x3608c0={};_0x3608c0[_0xbb99('0x43')]=_['keys'](db[_0xbb99('0x3d')][_0xbb99('0x3e')]);_0x3608c0['query']=_[_0xbb99('0xad')](_0x21a3b4['query']);_0x3608c0['filters']=_['intersection'](_0x3608c0[_0xbb99('0x43')],_0x3608c0[_0xbb99('0x41')]);_0x49bdaf[_0xbb99('0x44')]=_[_0xbb99('0x45')](_0x3608c0[_0xbb99('0x43')],qs['fields'](_0x21a3b4[_0xbb99('0x41')][_0xbb99('0x46')]));_0x49bdaf['attributes']=_0x49bdaf[_0xbb99('0x44')][_0xbb99('0x47')]?_0x49bdaf[_0xbb99('0x44')]:_0x3608c0[_0xbb99('0x43')];if(_0x21a3b4[_0xbb99('0x41')][_0xbb99('0xae')]){_0x49bdaf[_0xbb99('0xaf')]=[{'all':!![]}];}_0x49bdaf=_['merge']({},_0x49bdaf,_0x21a3b4[_0xbb99('0xb0')]);return db[_0xbb99('0x3d')][_0xbb99('0x62')](_0x49bdaf)[_0xbb99('0x28')](handleEntityNotFound(_0x5ebe42,null))['then'](respondWithResult(_0x5ebe42,null))[_0xbb99('0x35')](handleError(_0x5ebe42,null));};exports[_0xbb99('0xb1')]=function(_0x227c07,_0x2ec045){return db[_0xbb99('0x3d')][_0xbb99('0xb1')](_0x227c07[_0xbb99('0x73')],{})[_0xbb99('0x28')](respondWithResult(_0x2ec045,0xc9))[_0xbb99('0x35')](handleError(_0x2ec045,null));};exports['update']=function(_0x594978,_0x3204fc){if(_0x594978[_0xbb99('0x73')]['id']){delete _0x594978[_0xbb99('0x73')]['id'];}return db['SmsInteraction'][_0xbb99('0x62')]({'where':{'id':_0x594978[_0xbb99('0xac')]['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x3204fc,null))['then'](saveUpdates(_0x594978[_0xbb99('0x73')],null))[_0xbb99('0x28')](respondWithResult(_0x3204fc,null))[_0xbb99('0x35')](handleError(_0x3204fc,null));};exports[_0xbb99('0x29')]=function(_0x31a3dc,_0x5cd36b){return db[_0xbb99('0x3d')][_0xbb99('0x62')]({'where':{'id':_0x31a3dc[_0xbb99('0xac')]['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x5cd36b,null))[_0xbb99('0x28')](removeEntity(_0x5cd36b,null))[_0xbb99('0x35')](handleError(_0x5cd36b,null));};exports[_0xbb99('0xb2')]=function(_0x4d3af6,_0xb8d418){return db[_0xbb99('0x3d')][_0xbb99('0xb2')]()[_0xbb99('0x28')](respondWithResult(_0xb8d418,null))['catch'](handleError(_0xb8d418,null));};exports[_0xbb99('0xb3')]=function(_0x5324a1,_0x952729,_0x5c0677){return db[_0xbb99('0xb4')]['find']({'where':{'id':_0x5324a1['params']['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x952729,null))[_0xbb99('0x28')](function(_0x5d0936){if(_0x5d0936){return _0x5d0936[_0xbb99('0xb3')](_0x5324a1[_0xbb99('0x73')][_0xbb99('0xb5')],_[_0xbb99('0xb6')](_0x5324a1[_0xbb99('0x73')],['ids','id'])||{});}})['then'](respondWithResult(_0x952729,null))[_0xbb99('0x35')](handleError(_0x952729,null));};exports[_0xbb99('0xb7')]=function(_0xaaa599,_0x4197e1,_0x501493){var _0x8dc83={'raw':![],'where':{}};var _0x288827={};var _0x545980={'count':0x0,'rows':[]};return db[_0xbb99('0x3d')][_0xbb99('0xb8')]({'where':{'id':_0xaaa599[_0xbb99('0xac')]['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x4197e1,null))[_0xbb99('0x28')](function(_0x1478b7){if(_0x1478b7){_0x288827[_0xbb99('0x43')]=_['keys'](db[_0xbb99('0xb4')][_0xbb99('0x3e')]);_0x288827[_0xbb99('0x41')]=_[_0xbb99('0xad')](_0xaaa599[_0xbb99('0x41')]);_0x288827[_0xbb99('0x42')]=_[_0xbb99('0x45')](_0x288827[_0xbb99('0x43')],_0x288827[_0xbb99('0x41')]);_0x8dc83['attributes']=_[_0xbb99('0x45')](_0x288827[_0xbb99('0x43')],qs[_0xbb99('0x46')](_0xaaa599[_0xbb99('0x41')][_0xbb99('0x46')]));_0x8dc83[_0xbb99('0x44')]=_0x8dc83[_0xbb99('0x44')][_0xbb99('0x47')]?_0x8dc83[_0xbb99('0x44')]:_0x288827[_0xbb99('0x43')];if(!_0xaaa599[_0xbb99('0x41')][_0xbb99('0x48')](_0xbb99('0x49'))){_0x8dc83['limit']=qs[_0xbb99('0x20')](_0xaaa599['query']['limit']);_0x8dc83[_0xbb99('0x21')]=qs[_0xbb99('0x21')](_0xaaa599[_0xbb99('0x41')][_0xbb99('0x21')]);}_0x8dc83[_0xbb99('0x89')]=qs[_0xbb99('0x4a')](_0xaaa599[_0xbb99('0x41')][_0xbb99('0x4a')]);_0x8dc83['where']=qs['filters'](_['pick'](_0xaaa599[_0xbb99('0x41')],_0x288827[_0xbb99('0x42')]));_0x8dc83[_0xbb99('0x4b')][_0xbb99('0xa9')]=_0x1478b7['id'];if(_0xaaa599[_0xbb99('0x41')][_0xbb99('0x80')]){_0x8dc83[_0xbb99('0x4b')]=_[_0xbb99('0xb9')](_0x8dc83[_0xbb99('0x4b')],{'$or':_[_0xbb99('0x30')](_0x8dc83['attributes'],function(_0x5b1b2c){var _0x3bab74={};_0x3bab74[_0x5b1b2c]={'$like':'%'+_0xaaa599[_0xbb99('0x41')]['filter']+'%'};return _0x3bab74;})});}if(_0xaaa599[_0xbb99('0x41')][_0xbb99('0x79')]){var _0x16ce59=_0xaaa599[_0xbb99('0x41')][_0xbb99('0x79')][_0xbb99('0x32')](',');var _0x22cb2d={};_0x22cb2d[_0x16ce59[0x0]]={'$gte':moment(_0x16ce59[0x1])[_0xbb99('0xba')](_0xbb99('0xbb'))};_0x8dc83[_0xbb99('0x4b')]=_[_0xbb99('0xb9')](_0x8dc83[_0xbb99('0x4b')],_0x22cb2d);}_0x8dc83=_[_0xbb99('0xb9')]({},_0x8dc83,_0xaaa599[_0xbb99('0xb0')]);return db[_0xbb99('0xb4')]['count']({'where':_0x8dc83[_0xbb99('0x4b')]})['then'](function(_0xf23da8){_0x545980[_0xbb99('0x22')]=_0xf23da8;if(_0xaaa599[_0xbb99('0x41')][_0xbb99('0xae')]){_0x8dc83[_0xbb99('0xaf')]=[{'all':!![]}];}return db[_0xbb99('0xb4')][_0xbb99('0xbc')](_0x8dc83);})[_0xbb99('0x28')](function(_0x23bb22){_0x545980[_0xbb99('0xab')]=_0x23bb22;return _0x545980;});}})[_0xbb99('0x28')](respondWithFilteredResult(_0x4197e1,_0x8dc83))[_0xbb99('0x35')](handleError(_0x4197e1,null));};exports[_0xbb99('0xbd')]=function(_0x358a2b,_0x2dc95a,_0x47d05f){return db[_0xbb99('0x3d')]['find']({'where':{'id':_0x358a2b[_0xbb99('0xac')]['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x2dc95a,null))['then'](function(_0xe105dc){if(_0xe105dc){return _0xe105dc[_0xbb99('0xbe')](_0x358a2b[_0xbb99('0x73')]['ids'],_['omit'](_0x358a2b['body'],[_0xbb99('0xb5'),'id'])||{})['spread'](function(){return db['Tag'][_0xbb99('0xbc')]({'attributes':['id',_0xbb99('0x2d'),_0xbb99('0x4f')],'where':{'id':_0x358a2b[_0xbb99('0x73')][_0xbb99('0xb5')]}});})['then'](function(_0x1ba5d6){socket['emit']('smsInteractionTags:save',{'id':Number(_0x358a2b['params']['id']),'tags':_0x1ba5d6||[]});return{'id':Number(_0x358a2b['params']['id']),'tags':_0x1ba5d6||[]};});}})[_0xbb99('0x28')](respondWithResult(_0x2dc95a,null))[_0xbb99('0x35')](handleError(_0x2dc95a,null));};exports[_0xbb99('0xbf')]=function(_0x9a34c3,_0x42bac6,_0x169c81){return db[_0xbb99('0x3d')][_0xbb99('0x62')]({'where':{'id':_0x9a34c3[_0xbb99('0xac')]['id']}})[_0xbb99('0x28')](handleEntityNotFound(_0x42bac6,null))['then'](function(_0x120eaa){if(_0x120eaa){return _0x120eaa[_0xbb99('0xbf')](_0x9a34c3['query'][_0xbb99('0xb5')]);}})['then'](respondWithStatusCode(_0x42bac6,null))[_0xbb99('0x35')](handleError(_0x42bac6,null));};exports[_0xbb99('0xc0')]=function(_0x2e99b2,_0x2ac1aa){var _0xd2b513=moment()[_0xbb99('0xc1')]()['toString']();var _0x3aa1a1=path[_0xbb99('0xc2')](config[_0xbb99('0xc3')],_0xbb99('0xc4'),_0xbb99('0xc5'),'tmp');var _0x11ae27=path[_0xbb99('0xc2')](config[_0xbb99('0xc3')],_0xbb99('0xc4'),_0xbb99('0xc5'),_0xbb99('0xc6'));var _0x216f5b=path[_0xbb99('0xc2')](_0x3aa1a1,_0xd2b513);var _0xa89f42=util['format'](_0xbb99('0xc7'),_0x2e99b2[_0xbb99('0xac')]['id'],_0xd2b513);var _0x52aeca=path[_0xbb99('0xc2')](_0x3aa1a1,_0xa89f42);var _0x5039f4=[];_0x5039f4[_0xbb99('0x34')]({'model':db[_0xbb99('0x71')],'as':_0xbb99('0x71'),'attributes':['id',_0xbb99('0xc8')],'raw':!![]});_0x5039f4[_0xbb99('0x34')]({'model':db[_0xbb99('0xc9')],'as':_0xbb99('0x67'),'attributes':['id','firstName',_0xbb99('0xca')],'raw':!![]});var _0x392e94=[{'model':db[_0xbb99('0xb4')],'as':_0xbb99('0xcb'),'attributes':['id',_0xbb99('0x73'),_0xbb99('0xcc'),_0xbb99('0xcd'),_0xbb99('0xce'),'read'],'include':_0x5039f4}];_0x392e94['push']({'model':db[_0xbb99('0xcf')],'as':'Account','attributes':['id','name']});_0x392e94[_0xbb99('0x34')]({'model':db[_0xbb99('0x71')],'as':_0xbb99('0xd0'),'attributes':['id',_0xbb99('0xc8')]});return db[_0xbb99('0x3d')]['find']({'where':{'id':_0x2e99b2[_0xbb99('0xac')]['id']},'include':_0x392e94})[_0xbb99('0x28')](handleEntityNotFound(_0x2ac1aa,null))['then'](function(_0x496386){if(_0x496386){var _0x13d2e8=_0x496386[_0xbb99('0xd1')]({'plain':!![]});fs[_0xbb99('0xd2')](_0x216f5b);var _0x4c905c={'channel':_0xbb99('0xd3'),'account':_0x13d2e8[_0xbb99('0xd4')][_0xbb99('0x2d')],'agent':_0x13d2e8[_0xbb99('0xd0')]?_0x13d2e8['Owner'][_0xbb99('0xc8')]:_0xbb99('0xd5'),'createdAt':moment(_0x13d2e8['createdAt'])[_0xbb99('0xba')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x13d2e8['closed']?moment(_0x13d2e8['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb99('0xa6')]():'','disposition':_0x13d2e8[_0xbb99('0xd6')],'messages':_(_0x13d2e8[_0xbb99('0xcb')])['filter']({'secret':![]})['map'](function(_0xf8107e){return{'date':moment(_0xf8107e[_0xbb99('0xcc')])['format'](_0xbb99('0xbb'))[_0xbb99('0xa6')](),'sender':_0xf8107e[_0xbb99('0xcd')]===_0xbb99('0xd7')?_0xf8107e[_0xbb99('0x71')]?_0xf8107e['User'][_0xbb99('0xc8')]:'System':_0xf8107e[_0xbb99('0x67')][_0xbb99('0xd8')]+(_0xf8107e['Contact'][_0xbb99('0xca')]?'\x20'+_0xf8107e[_0xbb99('0x67')][_0xbb99('0xca')]:''),'body':_0xf8107e[_0xbb99('0x73')],'direction':_0xf8107e['direction']===_0xbb99('0xd7')?'A':'C','secret':_0xf8107e[_0xbb99('0xce')],'read':_0xf8107e[_0xbb99('0x7c')]};})[_0xbb99('0x64')]()};return ejs[_0xbb99('0xd9')](path[_0xbb99('0xc2')](config['root'],'server','views',_0xbb99('0xda')),{'interaction':_0x4c905c})[_0xbb99('0x28')](function(_0x31de62){var _0x1bdb35=path[_0xbb99('0xc2')](_0x216f5b,_0xbb99('0xdb')+_0x13d2e8['id']+'-'+_0xd2b513+_0xbb99('0xdc'));var _0x9900d6={'path':_0x1bdb35,'channel':_0xbb99('0xd3'),'interactionId':_0x13d2e8['id']};return pdf[_0xbb99('0xdd')](_0x31de62,_0x9900d6);})[_0xbb99('0x28')](function(){return new BPromise(function(_0x2f23d2,_0x4e70aa){zipdir(_0x216f5b,{'saveTo':_0x52aeca},function(_0x7f0250,_0x442261){if(_0x7f0250)return _0x4e70aa(_0x7f0250);return _0x2f23d2(_0x442261);});})[_0xbb99('0x28')](function(){return new BPromise(function(_0x563454,_0x1681c6){rimraf(_0x216f5b,function(_0x21dd4e){if(_0x21dd4e)_0x1681c6(_0x21dd4e);return _0x563454();});});})[_0xbb99('0x28')](function(){return _0x2ac1aa['download'](_0x52aeca,_0xa89f42,function(_0x113daf){if(_0x113daf){console[_0xbb99('0xde')](_0xbb99('0xdf'),_0x113daf);}else{fs['unlinkSync'](_0x52aeca);}});});});}else{return _0x2ac1aa[_0xbb99('0x1d')](0xc8);}})[_0xbb99('0x35')](handleError(_0x2ac1aa,null));}; \ No newline at end of file +var _0xd96d=['pick','select','field','tools_tags','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','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?','buildExpression','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','attributes','a.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','rows','include','create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','unix','root','server','join','files','attachments','fullname','CmContact','Contact','firstName','lastName','secret','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','direction','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','SmsInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where'];(function(_0x15981d,_0x317ab9){var _0x346ad4=function(_0x25e421){while(--_0x25e421){_0x15981d['push'](_0x15981d['shift']());}};_0x346ad4(++_0x317ab9);}(_0xd96d,0x9d));var _0xdd96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd96d[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd96('0x0'));var zipdir=require(_0xdd96('0x1'));var jsonpatch=require(_0xdd96('0x2'));var rp=require(_0xdd96('0x3'));var moment=require(_0xdd96('0x4'));var BPromise=require(_0xdd96('0x5'));var Mustache=require(_0xdd96('0x6'));var util=require(_0xdd96('0x7'));var path=require(_0xdd96('0x8'));var sox=require('sox');var csv=require(_0xdd96('0x9'));var ejs=require(_0xdd96('0xa'));var fs=require('fs');var fs_extra=require(_0xdd96('0xb'));var _=require('lodash');var squel=require(_0xdd96('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd96('0xd'));var deskjs=require(_0xdd96('0xe'));var toCsv=require(_0xdd96('0x9'));var querystring=require(_0xdd96('0xf'));var Papa=require(_0xdd96('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd96('0x11'));var as=require(_0xdd96('0x12'));var pdf=require(_0xdd96('0x13'));var hardwareService=require(_0xdd96('0x14'));var logger=require(_0xdd96('0x15'))(_0xdd96('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdd96('0x17'))['db'];config[_0xdd96('0x18')]=_[_0xdd96('0x19')](config[_0xdd96('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd96('0x18')]));require('./smsInteraction.socket')[_0xdd96('0x1a')](socket);function respondWithStatusCode(_0x166646,_0x3d1a90){_0x3d1a90=_0x3d1a90||0xcc;return function(_0x9047c6){if(_0x9047c6){return _0x166646[_0xdd96('0x1b')](_0x3d1a90);}return _0x166646[_0xdd96('0x1c')](_0x3d1a90)[_0xdd96('0x1d')]();};}function respondWithResult(_0x47c098,_0x2f5d95){_0x2f5d95=_0x2f5d95||0xc8;return function(_0x5d42fe){if(_0x5d42fe){return _0x47c098[_0xdd96('0x1c')](_0x2f5d95)[_0xdd96('0x1e')](_0x5d42fe);}};}function respondWithFilteredResult(_0x144011,_0x3dd083){return function(_0x56cbe7){if(_0x56cbe7){var _0x67f747=typeof _0x3dd083[_0xdd96('0x1f')]===_0xdd96('0x20')&&typeof _0x3dd083['limit']===_0xdd96('0x20');var _0x25a28b=_0x56cbe7['count'];var _0x12bdf5=_0x67f747?0x0:_0x3dd083['offset'];var _0x436656=_0x67f747?_0x56cbe7[_0xdd96('0x21')]:_0x3dd083[_0xdd96('0x1f')]+_0x3dd083[_0xdd96('0x22')];var _0x57a56c;if(_0x436656>=_0x25a28b){_0x436656=_0x25a28b;_0x57a56c=0xc8;}else{_0x57a56c=0xce;}_0x144011[_0xdd96('0x1c')](_0x57a56c);return _0x144011[_0xdd96('0x23')](_0xdd96('0x24'),_0x12bdf5+'-'+_0x436656+'/'+_0x25a28b)[_0xdd96('0x1e')](_0x56cbe7);}return null;};}function patchUpdates(_0x1491e9){return function(_0x349295){try{jsonpatch[_0xdd96('0x25')](_0x349295,_0x1491e9,!![]);}catch(_0xba256){return BPromise[_0xdd96('0x26')](_0xba256);}return _0x349295['save']();};}function saveUpdates(_0x311993,_0x32930b){return function(_0x1c4062){if(_0x1c4062){return _0x1c4062[_0xdd96('0x27')](_0x311993)[_0xdd96('0x28')](function(_0x430015){return _0x430015;});}return null;};}function removeEntity(_0x2ddf36,_0x381067){return function(_0x5267f9){if(_0x5267f9){return _0x5267f9[_0xdd96('0x29')]()[_0xdd96('0x28')](function(){_0x2ddf36[_0xdd96('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342af9,_0x20a226){return function(_0x27afb7){if(!_0x27afb7){_0x342af9[_0xdd96('0x1b')](0x194);}return _0x27afb7;};}function handleError(_0x4eb89c,_0x16acfa){_0x16acfa=_0x16acfa||0x1f4;return function(_0xe8dcbc){logger[_0xdd96('0x2a')](_0xe8dcbc[_0xdd96('0x2b')]);if(_0xe8dcbc['name']){delete _0xe8dcbc[_0xdd96('0x2c')];}_0x4eb89c[_0xdd96('0x1c')](_0x16acfa)[_0xdd96('0x2d')](_0xe8dcbc);};}function getInteractionUsers(_0x201740,_0x28f673){return new BPromise(function(_0x4a7c1e,_0x34b2e9){try{if(_0x28f673[_0x201740['id']]){_0x201740[_0xdd96('0x2e')]=_[_0xdd96('0x2f')](_0x28f673[_0x201740['id']],function(_0x4e377b){return{'id':_0x4e377b['id'],'fullname':_0x4e377b['fullname']};});}}catch(_0xe16b54){_0x34b2e9(_0xe16b54);}_0x4a7c1e(_0x201740);});}function getInteractionTags(_0x19a2f2,_0x2e727b){return new BPromise(function(_0x374854,_0x163a85){try{if(_0x19a2f2[_0xdd96('0x30')]){_0x19a2f2[_0xdd96('0x31')]=[];_0x19a2f2[_0xdd96('0x30')][_0xdd96('0x32')](',')[_0xdd96('0x33')](function(_0x3b3398){_0x19a2f2['Tags'][_0xdd96('0x34')](_0x2e727b[_0x3b3398]);});}delete _0x19a2f2[_0xdd96('0x30')];}catch(_0x2554bd){_0x163a85(_0x2554bd);}_0x374854(_0x19a2f2);});}function updateSmsInteraction(_0x20b7c1,_0x3e687f,_0x16e642){return new BPromise(function(_0x47d722,_0x1a9f8a){return getInteractionUsers(_0x20b7c1,_0x16e642)['then'](function(_0x250bf0){return getInteractionTags(_0x250bf0,_0x3e687f);})['then'](function(_0x36acd8){return getStateInteraction(_0x36acd8);})[_0xdd96('0x28')](function(_0x57e2d3){_0x47d722(_0x57e2d3);})[_0xdd96('0x35')](function(_0x1e6bf7){_0x1a9f8a(_0x1e6bf7);});});}function getStateInteraction(_0xb8cfa1){return new BPromise(function(_0x2e8177){_0xb8cfa1['waiting']=0x0;_0xb8cfa1[_0xdd96('0x36')]=0x0;_0xb8cfa1[_0xdd96('0x37')]=0x0;_0xb8cfa1[_0xdd96('0x38')]=0x0;_0xb8cfa1[_0xdd96('0x39')]=0x0;if(!_0xb8cfa1[_0xdd96('0x3a')]&&!_0xb8cfa1[_0xdd96('0x3b')]){_0xb8cfa1[_0xdd96('0x3c')]+=0x1;}if(!_0xb8cfa1['closed']&&_0xb8cfa1[_0xdd96('0x3b')]){_0xb8cfa1['talking']+=0x1;if(_0xb8cfa1[_0xdd96('0x3c')]){_0xb8cfa1[_0xdd96('0x3c')]-=0x1;}}if(_0xb8cfa1['closed']&&_0xb8cfa1[_0xdd96('0x3b')]){_0xb8cfa1['answered']+=0x1;if(_0xb8cfa1[_0xdd96('0x36')]){_0xb8cfa1[_0xdd96('0x36')]-=0x1;}}if(_0xb8cfa1['closed']&&!_0xb8cfa1[_0xdd96('0x3b')]){_0xb8cfa1['unmanaged']+=0x1;if(_0xb8cfa1[_0xdd96('0x3c')]){_0xb8cfa1[_0xdd96('0x3c')]-=0x1;}}_0xb8cfa1[_0xdd96('0x39')]+=0x1;_0x2e8177(_0xb8cfa1);});}exports[_0xdd96('0x3d')]=function(_0x205fe9,_0xa8b331){var _0x45e921={},_0x39ef1f={},_0x14a1d3={'count':0x0,'rows':[]};var _0x13c2ca=_[_0xdd96('0x2f')](db[_0xdd96('0x3e')][_0xdd96('0x3f')],function(_0x1a34da){return{'name':_0x1a34da['fieldName'],'type':_0x1a34da[_0xdd96('0x40')][_0xdd96('0x41')]};});_0x39ef1f['model']=_[_0xdd96('0x2f')](_0x13c2ca,'name');_0x39ef1f[_0xdd96('0x42')]=_[_0xdd96('0x43')](_0x205fe9['query']);_0x39ef1f[_0xdd96('0x44')]=_[_0xdd96('0x45')](_0x39ef1f[_0xdd96('0x46')],_0x39ef1f[_0xdd96('0x42')]);_0x45e921['attributes']=_['intersection'](_0x39ef1f[_0xdd96('0x46')],qs[_0xdd96('0x47')](_0x205fe9[_0xdd96('0x42')]['fields']));_0x45e921['attributes']=_0x45e921['attributes'][_0xdd96('0x48')]?_0x45e921['attributes']:_0x39ef1f[_0xdd96('0x46')];if(!_0x205fe9[_0xdd96('0x42')][_0xdd96('0x49')]('nolimit')){_0x45e921[_0xdd96('0x22')]=qs[_0xdd96('0x22')](_0x205fe9['query'][_0xdd96('0x22')]);_0x45e921[_0xdd96('0x1f')]=qs[_0xdd96('0x1f')](_0x205fe9[_0xdd96('0x42')][_0xdd96('0x1f')]);}_0x45e921[_0xdd96('0x4a')]=qs[_0xdd96('0x4b')](_0x205fe9[_0xdd96('0x42')]['sort']);_0x45e921[_0xdd96('0x4c')]=qs[_0xdd96('0x44')](_[_0xdd96('0x4d')](_0x205fe9['query'],_0x39ef1f[_0xdd96('0x44')]),_0x13c2ca);var _0xf98dd0=[];var _0x3b43eb=squel[_0xdd96('0x4e')]()[_0xdd96('0x4f')]('id')[_0xdd96('0x4f')](_0xdd96('0x2c'))[_0xdd96('0x4f')]('color')['from'](_0xdd96('0x50'));var _0x5c615c=squel[_0xdd96('0x4e')]()[_0xdd96('0x4f')]('u.id')[_0xdd96('0x4f')](_0xdd96('0x51'))[_0xdd96('0x4f')](_0xdd96('0x52'))[_0xdd96('0x53')](_0xdd96('0x54'),'ui')[_0xdd96('0x55')](_0xdd96('0x56'),'u',_0xdd96('0x57'));var _0x119beb=squel[_0xdd96('0x4e')]()[_0xdd96('0x53')]('sms_interactions','i')[_0xdd96('0x55')](_0xdd96('0x58'),'c',_0xdd96('0x59'))['left_join'](_0xdd96('0x56'),'o',_0xdd96('0x5a'))['left_join'](_0xdd96('0x5b'),'a',_0xdd96('0x5c'))['left_join'](_0xdd96('0x5d'),'me',_0xdd96('0x5e'))['left_join'](_0xdd96('0x5f'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xdd96('0x55')](_0xdd96('0x50'),'t','t.id\x20=\x20it.TagId');var _0xea1c86=squel[_0xdd96('0x60')]();var _0x29f1a7=[];var _0x3c35d7=squel[_0xdd96('0x60')]();var _0x8856ac;if(_0x205fe9['query'][_0xdd96('0x61')]){_0x8856ac=as[_0xdd96('0x62')](_0x205fe9[_0xdd96('0x42')][_0xdd96('0x61')]);var _0x2bc733=_0x8856ac[_0xdd96('0x63')];for(var _0x3fcc8b=0x0;_0x3fcc8b<_0x8856ac[_0xdd96('0x64')][_0xdd96('0x48')];_0x3fcc8b++){var _0x16435a=_0x8856ac['conditions'][_0x3fcc8b];var _0x251a54='i';var _0x4e59b9=_[_0xdd96('0x65')](_0x13c2ca,[_0xdd96('0x2c'),_0x16435a[_0xdd96('0x4f')]]);if(!_0x4e59b9){switch(_0x16435a[_0xdd96('0x4f')]){case _0xdd96('0x66'):if(_0x16435a[_0xdd96('0x67')]==0x1){_0x119beb['having']('`'+_0x16435a[_0xdd96('0x4f')]+_0xdd96('0x68'));}else{_0x119beb['having']('`'+_0x16435a[_0xdd96('0x4f')]+_0xdd96('0x69'));}break;case'Contact':if(_0x16435a[_0xdd96('0x6a')]===_0xdd96('0x6b')){if(_0x16435a[_0xdd96('0x67')][_0xdd96('0x32')]('\x20')['length']>0x1){_0xea1c86[_0x2bc733](_0xdd96('0x6c'),qs[_0xdd96('0x6d')](_0x16435a[_0xdd96('0x67')]),null);}else{var _0x1f425f='%'+_0x16435a['value']+'%';_0xea1c86[_0x2bc733](_0xdd96('0x6e'),_0x1f425f,_0x1f425f,_0x1f425f);}}else{_0x4e59b9=_[_0xdd96('0x65')](_0x13c2ca,[_0xdd96('0x2c'),_0xdd96('0x6f')]);_0x16435a[_0xdd96('0x4f')]=_0xdd96('0x6f');_0x3e56d1=as['buildExpression'](_0x251a54,_0x4e59b9[_0xdd96('0x40')],_0x16435a);_0xea1c86[_0x2bc733](_0x3e56d1[_0xdd96('0x70')],_0x3e56d1['value'][_0xdd96('0x71')],_0x3e56d1['value']['end']);}break;case _0xdd96('0x72'):var _0x36185c=_0x16435a['value'][_0xdd96('0x32')](',')[_0xdd96('0x2f')](function(_0x4293ec){return Number(_0x4293ec);});_0x36185c['forEach'](function(_0x34aa6b){_0x3c35d7['or'](_0xdd96('0x73'),'%,'+_0x34aa6b+',%');});_0x29f1a7=_[_0xdd96('0x74')](_0x29f1a7,_0x36185c);break;case _0xdd96('0x75'):if(_0x16435a['operator']===_0xdd96('0x6b')){_0xea1c86[_0x2bc733](_0xdd96('0x76'),'%'+_0x16435a[_0xdd96('0x67')]+'%',null);}else{_0x4e59b9=_[_0xdd96('0x65')](_0x13c2ca,[_0xdd96('0x2c'),_0xdd96('0x3b')]);_0x16435a[_0xdd96('0x4f')]=_0xdd96('0x3b');_0x3e56d1=as[_0xdd96('0x77')](_0x251a54,_0x4e59b9[_0xdd96('0x40')],_0x16435a);_0xea1c86[_0x2bc733](_0x3e56d1['text'],_0x3e56d1[_0xdd96('0x67')][_0xdd96('0x71')],_0x3e56d1[_0xdd96('0x67')][_0xdd96('0x1d')]);}break;case'body':_0x3e56d1=as[_0xdd96('0x77')]('me',null,_0x16435a);_0xea1c86[_0x2bc733](_0x3e56d1[_0xdd96('0x70')],_0x3e56d1[_0xdd96('0x67')][_0xdd96('0x71')],_0x3e56d1[_0xdd96('0x67')][_0xdd96('0x1d')]);break;}}else{var _0x3e56d1=as[_0xdd96('0x77')](_0x251a54,_0x4e59b9['type'],_0x16435a);_0xea1c86[_0x2bc733](_0x3e56d1['text'],_0x3e56d1['value'][_0xdd96('0x71')],_0x3e56d1['value']['end']);}}}else{var _0x4f18c6=_(_0x205fe9[_0xdd96('0x42')])[_0xdd96('0x43')]()[_0xdd96('0x2f')](function(_0x125354){return _[_0xdd96('0x78')](_0x13c2ca,[_0xdd96('0x2c'),_0x125354])?_0x125354:undefined;})[_0xdd96('0x79')]()[_0xdd96('0x67')]();if(!_[_0xdd96('0x7a')](_0x4f18c6)){_0x4f18c6[_0xdd96('0x33')](function(_0x32695e){if(_0x32695e===_0xdd96('0x7b')){_0x119beb[_0xdd96('0x4c')](_0xdd96('0x7c'),[]['concat'](_0x205fe9['query'][_0x32695e]));}else if(_0x32695e===_0xdd96('0x7d')){var _0x680328=JSON[_0xdd96('0x7e')](_0x205fe9[_0xdd96('0x42')][_0x32695e])[_0xdd96('0x7f')];var _0x35366e=JSON[_0xdd96('0x7e')](_0x205fe9[_0xdd96('0x42')][_0x32695e])[_0xdd96('0x80')];_0x119beb[_0xdd96('0x4c')](_0xdd96('0x81'),_0x680328,_0x35366e);}else{if(_0x205fe9[_0xdd96('0x42')][_0x32695e]===_0xdd96('0x82')){_0x119beb[_0xdd96('0x4c')]('i.'+_0x32695e+_0xdd96('0x83'));}else{_0x119beb[_0xdd96('0x4c')]('i.'+_0x32695e+_0xdd96('0x84'),_0x205fe9[_0xdd96('0x42')][_0x32695e]);}}});}if(_0x205fe9['query']['read']){if(_0x205fe9[_0xdd96('0x42')][_0xdd96('0x85')]==0x1){_0x119beb[_0xdd96('0x86')](_0xdd96('0x87'));}else{_0x119beb[_0xdd96('0x86')](_0xdd96('0x88'));}}if(_0x205fe9[_0xdd96('0x42')]['tag']){_0x29f1a7=_[_0xdd96('0x89')](_0x205fe9['query'][_0xdd96('0x8a')])?_0x205fe9[_0xdd96('0x42')][_0xdd96('0x8a')]:new Array(_0x205fe9[_0xdd96('0x42')][_0xdd96('0x8a')]);_0x29f1a7['forEach'](function(_0x78995a){_0x3c35d7['or'](_0xdd96('0x73'),'%,'+_0x78995a+',%');});}if(_0x205fe9[_0xdd96('0x42')]['filter']){var _0x5c84db=_0x205fe9[_0xdd96('0x42')]['filter'][_0xdd96('0x8b')]('\x5c','\x5c\x5c')[_0xdd96('0x8b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c84db)){_0xea1c86['or'](_0xdd96('0x8c'),_0x5c84db+'%')['or'](_0xdd96('0x8d'),_0x5c84db+'%');}else{_0xea1c86['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5c84db))['or'](_0xdd96('0x8e'),_0x5c84db+'%');}}}_0x119beb['where'](_0xea1c86);_0x119beb[_0xdd96('0x8f')](_0xdd96('0x90'));var _0x31939b={'type':db[_0xdd96('0x91')][_0xdd96('0x92')][_0xdd96('0x93')],'raw':!![]};var _0x326e39=_0x119beb[_0xdd96('0x94')]();_0x326e39['field'](_0xdd96('0x90'));_0x326e39[_0xdd96('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdd96('0x66'));if(_0x45e921[_0xdd96('0x4a')]){_0x45e921[_0xdd96('0x4a')][_0xdd96('0x33')](function(_0x42b07c){var _0x332eb1=_0x42b07c[0x0]===_0xdd96('0x95')?_0x42b07c[0x0]:'i.'+_0x42b07c[0x0];_0x119beb[_0xdd96('0x4a')](_0x332eb1,_0x42b07c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdd96('0x7a')](_0x29f1a7)){_0x119beb[_0xdd96('0x86')](_0x3c35d7);_0x326e39[_0xdd96('0x4c')]('t.id\x20IN\x20?',_0x29f1a7);}BPromise[_0xdd96('0x96')]()[_0xdd96('0x28')](function(){if(!_0x8856ac){if(_0x205fe9[_0xdd96('0x42')][_0xdd96('0x7b')])return;_0x326e39[_0xdd96('0x4c')](_0xdd96('0x97'));_0x119beb[_0xdd96('0x4c')](_0xdd96('0x97'));return;}if(_0x205fe9[_0xdd96('0x98')][_0xdd96('0x99')]!==_0xdd96('0x9a'))return;return _0x205fe9[_0xdd96('0x98')][_0xdd96('0x9b')]({'attributes':['id'],'raw':!![]})[_0xdd96('0x28')](function(_0x574a54){if(_[_0xdd96('0x7a')](_0x574a54)){_0x326e39[_0xdd96('0x4c')](_0xdd96('0x9c'));_0x119beb[_0xdd96('0x4c')](_0xdd96('0x9c'));}else{_0x326e39[_0xdd96('0x4c')](_0xdd96('0x7c'),_['map'](_0x574a54,'id'));_0x119beb[_0xdd96('0x4c')](_0xdd96('0x7c'),_[_0xdd96('0x2f')](_0x574a54,'id'));}});})['then'](function(){if(_0x205fe9[_0xdd96('0x98')][_0xdd96('0x99')]===_0xdd96('0x9a')&&!_0x8856ac&&!_0x205fe9[_0xdd96('0x42')][_0xdd96('0x7b')])return[];return db[_0xdd96('0x9d')][_0xdd96('0x42')](_0x326e39[_0xdd96('0x9e')](),_0x31939b);})[_0xdd96('0x28')](function(_0x3f1766){_0x14a1d3[_0xdd96('0x21')]=_0x3f1766[_0xdd96('0x48')];if(_0x14a1d3[_0xdd96('0x21')]===0x0)return[];return db[_0xdd96('0x9d')][_0xdd96('0x42')](_0x3b43eb[_0xdd96('0x9e')](),_0x31939b)[_0xdd96('0x28')](function(_0x2f97d4){_0xf98dd0=_[_0xdd96('0x9f')](_0x2f97d4,'id');_0x31939b=_[_0xdd96('0xa0')](_0x31939b,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x205fe9[_0xdd96('0x42')][_0xdd96('0x47')]){_0x45e921[_0xdd96('0xa1')]['forEach'](function(_0x52e4ec){_0x119beb[_0xdd96('0x4f')]('i.'+_0x52e4ec);});}else{_0x119beb[_0xdd96('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa2'),'Account.key');_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa3'),'Account.mandatoryDisposition');_0x119beb[_0xdd96('0x4f')]('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');_0x119beb[_0xdd96('0x4f')]('i.*');_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa4'),_0xdd96('0xa5'));_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa6'),'Contact.lastName');_0x119beb[_0xdd96('0x4f')]('c.email','Contact.email');_0x119beb[_0xdd96('0x4f')]('c.phone',_0xdd96('0xa7'));_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa8'),'Contact.mobile');_0x119beb[_0xdd96('0x4f')](_0xdd96('0xa9'),'Contact.fax');_0x119beb[_0xdd96('0x4f')]('o.fullname',_0xdd96('0xaa'));_0x119beb[_0xdd96('0x4f')](_0xdd96('0xab'),'Owner.internal');_0x119beb[_0xdd96('0x4f')](_0xdd96('0xac'),_0xdd96('0x30'));}if(_0x45e921['limit'])_0x119beb[_0xdd96('0x22')](_0x45e921[_0xdd96('0x22')]);if(_0x45e921[_0xdd96('0x1f')])_0x119beb[_0xdd96('0x1f')](_0x45e921[_0xdd96('0x1f')]);return db[_0xdd96('0x9d')]['query'](_0x119beb[_0xdd96('0x9e')](),_0x31939b);})[_0xdd96('0x28')](function(_0x294302){if(_0x294302[_0xdd96('0x48')]>0x0)_0x5c615c[_0xdd96('0x4c')](_0xdd96('0xad'),_[_0xdd96('0x2f')](_0x294302,'id'));return db[_0xdd96('0x9d')][_0xdd96('0x42')](_0x5c615c['toString'](),_0x31939b)['then'](function(_0x575a06){var _0x63e4f=_['groupBy'](_0x575a06,_0xdd96('0xae'));var _0x1f2a22=[];_0x294302[_0xdd96('0x33')](function(_0x55ea96){_0x1f2a22[_0xdd96('0x34')](updateSmsInteraction(_0x55ea96,_0xf98dd0,_0x63e4f));});return BPromise['all'](_0x1f2a22);});});})[_0xdd96('0x28')](function(_0x4eb598){_0x14a1d3[_0xdd96('0xaf')]=_0x4eb598;return _0x14a1d3;})[_0xdd96('0x28')](respondWithFilteredResult(_0xa8b331,_0x45e921))[_0xdd96('0x35')](handleError(_0xa8b331,null));};exports['show']=function(_0x5a63ff,_0x4839ce){var _0xfa562b={'raw':![],'where':{'id':_0x5a63ff['params']['id']}},_0xfe36e4={};_0xfe36e4['model']=_[_0xdd96('0x43')](db[_0xdd96('0x3e')][_0xdd96('0x3f')]);_0xfe36e4[_0xdd96('0x42')]=_[_0xdd96('0x43')](_0x5a63ff[_0xdd96('0x42')]);_0xfe36e4[_0xdd96('0x44')]=_[_0xdd96('0x45')](_0xfe36e4[_0xdd96('0x46')],_0xfe36e4['query']);_0xfa562b[_0xdd96('0xa1')]=_[_0xdd96('0x45')](_0xfe36e4['model'],qs[_0xdd96('0x47')](_0x5a63ff['query'][_0xdd96('0x47')]));_0xfa562b['attributes']=_0xfa562b[_0xdd96('0xa1')][_0xdd96('0x48')]?_0xfa562b[_0xdd96('0xa1')]:_0xfe36e4[_0xdd96('0x46')];if(_0x5a63ff[_0xdd96('0x42')]['includeAll']){_0xfa562b[_0xdd96('0xb0')]=[{'all':!![]}];}_0xfa562b=_[_0xdd96('0xa0')]({},_0xfa562b,_0x5a63ff['options']);return db[_0xdd96('0x3e')][_0xdd96('0x65')](_0xfa562b)[_0xdd96('0x28')](handleEntityNotFound(_0x4839ce,null))[_0xdd96('0x28')](respondWithResult(_0x4839ce,null))[_0xdd96('0x35')](handleError(_0x4839ce,null));};exports[_0xdd96('0xb1')]=function(_0x41817c,_0x4072f6){return db[_0xdd96('0x3e')][_0xdd96('0xb1')](_0x41817c[_0xdd96('0xb2')],{})[_0xdd96('0x28')](respondWithResult(_0x4072f6,0xc9))['catch'](handleError(_0x4072f6,null));};exports[_0xdd96('0x27')]=function(_0x874210,_0x1c0eae){if(_0x874210[_0xdd96('0xb2')]['id']){delete _0x874210[_0xdd96('0xb2')]['id'];}return db['SmsInteraction'][_0xdd96('0x65')]({'where':{'id':_0x874210[_0xdd96('0xb3')]['id']}})[_0xdd96('0x28')](handleEntityNotFound(_0x1c0eae,null))[_0xdd96('0x28')](saveUpdates(_0x874210[_0xdd96('0xb2')],null))[_0xdd96('0x28')](respondWithResult(_0x1c0eae,null))[_0xdd96('0x35')](handleError(_0x1c0eae,null));};exports[_0xdd96('0x29')]=function(_0x12076e,_0x43745c){return db[_0xdd96('0x3e')][_0xdd96('0x65')]({'where':{'id':_0x12076e[_0xdd96('0xb3')]['id']}})['then'](handleEntityNotFound(_0x43745c,null))[_0xdd96('0x28')](removeEntity(_0x43745c,null))[_0xdd96('0x35')](handleError(_0x43745c,null));};exports['describe']=function(_0x32bbeb,_0x85b97e){return db[_0xdd96('0x3e')][_0xdd96('0xb4')]()[_0xdd96('0x28')](respondWithResult(_0x85b97e,null))[_0xdd96('0x35')](handleError(_0x85b97e,null));};exports[_0xdd96('0xb5')]=function(_0x2de711,_0x26b6f7,_0x46232a){return db[_0xdd96('0xb6')][_0xdd96('0x65')]({'where':{'id':_0x2de711[_0xdd96('0xb3')]['id']}})[_0xdd96('0x28')](handleEntityNotFound(_0x26b6f7,null))['then'](function(_0x12b456){if(_0x12b456){return _0x12b456['addMessage'](_0x2de711[_0xdd96('0xb2')][_0xdd96('0xb7')],_[_0xdd96('0xb8')](_0x2de711[_0xdd96('0xb2')],[_0xdd96('0xb7'),'id'])||{});}})[_0xdd96('0x28')](respondWithResult(_0x26b6f7,null))[_0xdd96('0x35')](handleError(_0x26b6f7,null));};exports[_0xdd96('0xb9')]=function(_0x328a8f,_0x222202,_0x417043){var _0xd197bc={'raw':![],'where':{}};var _0x401af5={};var _0x286079={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xdd96('0xba')]({'where':{'id':_0x328a8f['params']['id']}})[_0xdd96('0x28')](handleEntityNotFound(_0x222202,null))['then'](function(_0x482c61){if(_0x482c61){_0x401af5[_0xdd96('0x46')]=_[_0xdd96('0x43')](db[_0xdd96('0xb6')]['rawAttributes']);_0x401af5[_0xdd96('0x42')]=_[_0xdd96('0x43')](_0x328a8f[_0xdd96('0x42')]);_0x401af5['filters']=_[_0xdd96('0x45')](_0x401af5[_0xdd96('0x46')],_0x401af5['query']);_0xd197bc[_0xdd96('0xa1')]=_[_0xdd96('0x45')](_0x401af5[_0xdd96('0x46')],qs[_0xdd96('0x47')](_0x328a8f[_0xdd96('0x42')]['fields']));_0xd197bc[_0xdd96('0xa1')]=_0xd197bc['attributes']['length']?_0xd197bc[_0xdd96('0xa1')]:_0x401af5['model'];if(!_0x328a8f['query'][_0xdd96('0x49')](_0xdd96('0xbb'))){_0xd197bc[_0xdd96('0x22')]=qs[_0xdd96('0x22')](_0x328a8f[_0xdd96('0x42')]['limit']);_0xd197bc[_0xdd96('0x1f')]=qs['offset'](_0x328a8f[_0xdd96('0x42')][_0xdd96('0x1f')]);}_0xd197bc[_0xdd96('0x4a')]=qs[_0xdd96('0x4b')](_0x328a8f[_0xdd96('0x42')][_0xdd96('0x4b')]);_0xd197bc[_0xdd96('0x4c')]=qs[_0xdd96('0x44')](_[_0xdd96('0x4d')](_0x328a8f[_0xdd96('0x42')],_0x401af5[_0xdd96('0x44')]));_0xd197bc[_0xdd96('0x4c')]['SmsInteractionId']=_0x482c61['id'];if(_0x328a8f[_0xdd96('0x42')][_0xdd96('0xbc')]){_0xd197bc[_0xdd96('0x4c')]=_[_0xdd96('0xa0')](_0xd197bc['where'],{'$or':_[_0xdd96('0x2f')](_0xd197bc[_0xdd96('0xa1')],function(_0x6ca13e){var _0x2cc119={};_0x2cc119[_0x6ca13e]={'$like':'%'+_0x328a8f[_0xdd96('0x42')][_0xdd96('0xbc')]+'%'};return _0x2cc119;})});}if(_0x328a8f[_0xdd96('0x42')]['$gte']){var _0x2898c5=_0x328a8f['query'][_0xdd96('0x7f')]['split'](',');var _0x4a4e6d={};_0x4a4e6d[_0x2898c5[0x0]]={'$gte':moment(_0x2898c5[0x1])[_0xdd96('0xbd')](_0xdd96('0xbe'))};_0xd197bc[_0xdd96('0x4c')]=_['merge'](_0xd197bc[_0xdd96('0x4c')],_0x4a4e6d);}_0xd197bc=_[_0xdd96('0xa0')]({},_0xd197bc,_0x328a8f[_0xdd96('0xbf')]);return db[_0xdd96('0xb6')][_0xdd96('0x21')]({'where':_0xd197bc[_0xdd96('0x4c')]})[_0xdd96('0x28')](function(_0x1f0480){_0x286079[_0xdd96('0x21')]=_0x1f0480;if(_0x328a8f[_0xdd96('0x42')][_0xdd96('0xc0')]){_0xd197bc[_0xdd96('0xb0')]=[{'all':!![]}];}return db[_0xdd96('0xb6')][_0xdd96('0xc1')](_0xd197bc);})[_0xdd96('0x28')](function(_0x5ce427){_0x286079[_0xdd96('0xaf')]=_0x5ce427;return _0x286079;});}})[_0xdd96('0x28')](respondWithFilteredResult(_0x222202,_0xd197bc))[_0xdd96('0x35')](handleError(_0x222202,null));};exports[_0xdd96('0xc2')]=function(_0xadb981,_0x38c78,_0x367f1){return db[_0xdd96('0x3e')][_0xdd96('0x65')]({'where':{'id':_0xadb981[_0xdd96('0xb3')]['id']}})[_0xdd96('0x28')](handleEntityNotFound(_0x38c78,null))[_0xdd96('0x28')](function(_0x483cbe){if(_0x483cbe){return _0x483cbe[_0xdd96('0xc3')](_0xadb981[_0xdd96('0xb2')][_0xdd96('0xb7')],_[_0xdd96('0xb8')](_0xadb981['body'],[_0xdd96('0xb7'),'id'])||{})[_0xdd96('0xc4')](function(){return db['Tag'][_0xdd96('0xc1')]({'attributes':['id',_0xdd96('0x2c'),_0xdd96('0xc5')],'where':{'id':_0xadb981[_0xdd96('0xb2')]['ids']}});})[_0xdd96('0x28')](function(_0x564ef1){socket[_0xdd96('0xc6')](_0xdd96('0xc7'),{'id':Number(_0xadb981[_0xdd96('0xb3')]['id']),'tags':_0x564ef1||[]});return{'id':Number(_0xadb981[_0xdd96('0xb3')]['id']),'tags':_0x564ef1||[]};});}})[_0xdd96('0x28')](respondWithResult(_0x38c78,null))[_0xdd96('0x35')](handleError(_0x38c78,null));};exports[_0xdd96('0xc8')]=function(_0x4cf5d8,_0xc8ad74,_0x19837d){return db['SmsInteraction'][_0xdd96('0x65')]({'where':{'id':_0x4cf5d8[_0xdd96('0xb3')]['id']}})[_0xdd96('0x28')](handleEntityNotFound(_0xc8ad74,null))[_0xdd96('0x28')](function(_0x1f06b9){if(_0x1f06b9){return _0x1f06b9[_0xdd96('0xc8')](_0x4cf5d8['query'][_0xdd96('0xb7')]);}})[_0xdd96('0x28')](respondWithStatusCode(_0xc8ad74,null))[_0xdd96('0x35')](handleError(_0xc8ad74,null));};exports['download']=function(_0x454286,_0x3ee8c3){var _0x676c07=moment()[_0xdd96('0xc9')]()[_0xdd96('0x9e')]();var _0x3f9517=path['join'](config[_0xdd96('0xca')],_0xdd96('0xcb'),'files','tmp');var _0x12dad8=path[_0xdd96('0xcc')](config['root'],_0xdd96('0xcb'),_0xdd96('0xcd'),_0xdd96('0xce'));var _0x32c901=path[_0xdd96('0xcc')](_0x3f9517,_0x676c07);var _0x1f40f0=util[_0xdd96('0xbd')]('transcript-%d-%s.zip',_0x454286['params']['id'],_0x676c07);var _0x15b64f=path[_0xdd96('0xcc')](_0x3f9517,_0x1f40f0);var _0x37893e=[];_0x37893e[_0xdd96('0x34')]({'model':db[_0xdd96('0x75')],'as':_0xdd96('0x75'),'attributes':['id',_0xdd96('0xcf')],'raw':!![]});_0x37893e['push']({'model':db[_0xdd96('0xd0')],'as':_0xdd96('0xd1'),'attributes':['id',_0xdd96('0xd2'),_0xdd96('0xd3')],'raw':!![]});var _0x448b51=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xdd96('0xb2'),'createdAt','direction',_0xdd96('0xd4'),_0xdd96('0x85')],'include':_0x37893e}];_0x448b51['push']({'model':db[_0xdd96('0xd5')],'as':_0xdd96('0xd6'),'attributes':['id',_0xdd96('0x2c')]});_0x448b51[_0xdd96('0x34')]({'model':db[_0xdd96('0x75')],'as':'Owner','attributes':['id',_0xdd96('0xcf')]});return db[_0xdd96('0x3e')][_0xdd96('0x65')]({'where':{'id':_0x454286[_0xdd96('0xb3')]['id']},'include':_0x448b51})['then'](handleEntityNotFound(_0x3ee8c3,null))[_0xdd96('0x28')](function(_0x56dc5b){if(_0x56dc5b){var _0x395d2c=_0x56dc5b['get']({'plain':!![]});fs[_0xdd96('0xd7')](_0x32c901);var _0x58617b={'channel':_0xdd96('0xd8'),'account':_0x395d2c[_0xdd96('0xd6')][_0xdd96('0x2c')],'agent':_0x395d2c['Owner']?_0x395d2c[_0xdd96('0xd9')][_0xdd96('0xcf')]:_0xdd96('0xda'),'createdAt':moment(_0x395d2c[_0xdd96('0x7d')])[_0xdd96('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd96('0x9e')](),'closedAt':_0x395d2c[_0xdd96('0x3a')]?moment(_0x395d2c[_0xdd96('0xdb')])['format'](_0xdd96('0xbe'))[_0xdd96('0x9e')]():'','disposition':_0x395d2c[_0xdd96('0xdc')],'messages':_(_0x395d2c['Messages'])[_0xdd96('0xbc')]({'secret':![]})['map'](function(_0x194705){return{'date':moment(_0x194705[_0xdd96('0x7d')])[_0xdd96('0xbd')](_0xdd96('0xbe'))[_0xdd96('0x9e')](),'sender':_0x194705[_0xdd96('0xdd')]===_0xdd96('0xde')?_0x194705[_0xdd96('0x75')]?_0x194705[_0xdd96('0x75')][_0xdd96('0xcf')]:_0xdd96('0xdf'):_0x194705['Contact']['firstName']+(_0x194705[_0xdd96('0xd1')][_0xdd96('0xd3')]?'\x20'+_0x194705[_0xdd96('0xd1')][_0xdd96('0xd3')]:''),'body':_0x194705['body'],'direction':_0x194705[_0xdd96('0xdd')]===_0xdd96('0xde')?'A':'C','secret':_0x194705[_0xdd96('0xd4')],'read':_0x194705['read']};})[_0xdd96('0x67')]()};return ejs[_0xdd96('0xe0')](path['join'](config[_0xdd96('0xca')],_0xdd96('0xcb'),_0xdd96('0xe1'),_0xdd96('0xe2')),{'interaction':_0x58617b})[_0xdd96('0x28')](function(_0xaea56c){var _0x245c45=path[_0xdd96('0xcc')](_0x32c901,_0xdd96('0xe3')+_0x395d2c['id']+'-'+_0x676c07+_0xdd96('0xe4'));var _0x425cbe={'path':_0x245c45,'channel':_0xdd96('0xd8'),'interactionId':_0x395d2c['id']};return pdf[_0xdd96('0xe5')](_0xaea56c,_0x425cbe);})['then'](function(){return new BPromise(function(_0x214c8b,_0x396672){zipdir(_0x32c901,{'saveTo':_0x15b64f},function(_0x396981,_0x42513c){if(_0x396981)return _0x396672(_0x396981);return _0x214c8b(_0x42513c);});})[_0xdd96('0x28')](function(){return new BPromise(function(_0x2a8944,_0x15b0c7){rimraf(_0x32c901,function(_0x4e0173){if(_0x4e0173)_0x15b0c7(_0x4e0173);return _0x2a8944();});});})[_0xdd96('0x28')](function(){return _0x3ee8c3[_0xdd96('0xe6')](_0x15b64f,_0x1f40f0,function(_0x23ddde){if(_0x23ddde){console[_0xdd96('0xe7')](_0xdd96('0xe8'),_0x23ddde);}else{fs[_0xdd96('0xe9')](_0x15b64f);}});});});}else{return _0x3ee8c3['sendStatus'](0xc8);}})[_0xdd96('0x35')](handleError(_0x3ee8c3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c29ab86..9844c26 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 _0x5c3c=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x563891,_0x4014a9){var _0x3d2f8d=function(_0x269b76){while(--_0x269b76){_0x563891['push'](_0x563891['shift']());}};_0x3d2f8d(++_0x4014a9);}(_0x5c3c,0x132));var _0xc5c3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5c3c[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0xc5c3('0x0'));var SmsInteraction=require(_0xc5c3('0x1'))['db'][_0xc5c3('0x2')];var SmsMessage=require(_0xc5c3('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5c3('0x3')](0x0);var events={'afterCreate':_0xc5c3('0x4'),'afterUpdate':_0xc5c3('0x5'),'afterDestroy':_0xc5c3('0x6')};function emitEvent(_0x2535e0){return function(_0x36525d,_0xe85098,_0x23a6b5){_0x36525d[_0xc5c3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8404){_0x36525d['setDataValue'](_0xc5c3('0x8'),_0x4b8404[_0xc5c3('0x9')](function(_0x593b35){return{'id':_0x593b35['id']};}));return SmsMessage[_0xc5c3('0xa')]({'where':{'SmsInteractionId':_0x36525d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5c3('0xb')](function(_0x52f3eb){_0x36525d[_0xc5c3('0xc')](_0xc5c3('0xd'),_0x52f3eb['length']);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0+':'+_0x36525d['id'],_0x36525d);SmsInteractionEvents[_0xc5c3('0xe')](_0x2535e0,_0x36525d);_0x23a6b5(null);})[_0xc5c3('0xf')](_0x23a6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc5c3('0x10')](e,emitEvent(event));}}module[_0xc5c3('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x583c=['../../mysqldb','SmsInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','events'];(function(_0x9fb4e1,_0xa15557){var _0x130847=function(_0x50163c){while(--_0x50163c){_0x9fb4e1['push'](_0x9fb4e1['shift']());}};_0x130847(++_0xa15557);}(_0x583c,0x12b));var _0xc583=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x583c[_0x43b487];return _0x2f707a;};'use strict';var EventEmitter=require(_0xc583('0x0'));var SmsInteraction=require(_0xc583('0x1'))['db'][_0xc583('0x2')];var SmsMessage=require(_0xc583('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc583('0x3')](0x0);var events={'afterCreate':_0xc583('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13b8a7){return function(_0xf03852,_0x5b7292,_0xd3a750){_0xf03852[_0xc583('0x5')]({'attributes':['id'],'raw':!![]})[_0xc583('0x6')](function(_0x1dd37c){_0xf03852['setDataValue'](_0xc583('0x7'),_0x1dd37c[_0xc583('0x8')](function(_0x5b456e){return{'id':_0x5b456e['id']};}));return SmsMessage[_0xc583('0x9')]({'where':{'SmsInteractionId':_0xf03852['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc583('0x6')](function(_0x25f8d3){_0xf03852[_0xc583('0xa')](_0xc583('0xb'),_0x25f8d3['length']);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7+':'+_0xf03852['id'],_0xf03852);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7,_0xf03852);_0xd3a750(null);})['catch'](_0xd3a750(null));};}for(var e in events){if(events[_0xc583('0xd')](e)){var event=events[e];SmsInteraction[_0xc583('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8dceee8..ed31115 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 _0xa0a6=['../../config/logger','api','request-promise','path','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa0a6,0xc2));var _0x6a0a=function(_0x22be1c,_0x4ecb6c){_0x22be1c=_0x22be1c-0x0;var _0x849b70=_0xa0a6[_0x22be1c];return _0x849b70;};'use strict';var _=require(_0x6a0a('0x0'));var util=require(_0x6a0a('0x1'));var logger=require(_0x6a0a('0x2'))(_0x6a0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a0a('0x4'));var fs=require('fs');var path=require(_0x6a0a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6a0a('0x6'));module[_0x6a0a('0x7')]=function(_0x18fe70,_0xf83499){return _0x18fe70[_0x6a0a('0x8')](_0x6a0a('0x9'),attributes,{'tableName':_0x6a0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ab870,_0x3a8b1d,_0x1cba15){if(_0x2ab870['changed'](_0x6a0a('0xb'))){_0x2ab870[_0x6a0a('0xc')]=moment()['format'](_0x6a0a('0xd'));}_0x1cba15(null,_0x2ab870);}}});}; \ No newline at end of file +var _0xd7b4=['bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x23b124,_0x5b06c9){var _0x457dbc=function(_0x1caee5){while(--_0x1caee5){_0x23b124['push'](_0x23b124['shift']());}};_0x457dbc(++_0x5b06c9);}(_0xd7b4,0x183));var _0x4d7b=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0xd7b4[_0x33f2fa];return _0xe5b3b3;};'use strict';var _=require(_0x4d7b('0x0'));var util=require(_0x4d7b('0x1'));var logger=require(_0x4d7b('0x2'))('api');var moment=require(_0x4d7b('0x3'));var BPromise=require(_0x4d7b('0x4'));var rp=require(_0x4d7b('0x5'));var fs=require('fs');var path=require(_0x4d7b('0x6'));var rimraf=require('rimraf');var config=require(_0x4d7b('0x7'));var attributes=require(_0x4d7b('0x8'));module[_0x4d7b('0x9')]=function(_0x42fc62,_0x376ca6){return _0x42fc62[_0x4d7b('0xa')](_0x4d7b('0xb'),attributes,{'tableName':_0x4d7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ecb17,_0x26db49,_0x296ff6){if(_0x4ecb17['changed'](_0x4d7b('0xd'))){_0x4ecb17[_0x4d7b('0xe')]=moment()[_0x4d7b('0xf')](_0x4d7b('0x10'));}_0x296ff6(null,_0x4ecb17);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 05bd323..88d086e 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 _0x7751=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','AddTagsToSmsInteraction','ids','omit','spread','AddTags','catch','util','moment'];(function(_0x3a3da4,_0x386635){var _0x122ed0=function(_0x75fa68){while(--_0x75fa68){_0x3a3da4['push'](_0x3a3da4['shift']());}};_0x122ed0(++_0x386635);}(_0x7751,0x18e));var _0x1775=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7751[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1775('0x0'));var moment=require(_0x1775('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1775('0x2'))['db'];var utils=require(_0x1775('0x3'));var logger=require(_0x1775('0x4'))(_0x1775('0x5'));var config=require(_0x1775('0x6'));var jayson=require(_0x1775('0x7'));var client=jayson[_0x1775('0x8')][_0x1775('0x9')]({'port':0x232a});config[_0x1775('0xa')]=_[_0x1775('0xb')](config['redis'],{'host':_0x1775('0xc'),'port':0x18eb});var socket=require(_0x1775('0xd'))(new Redis(config[_0x1775('0xa')]));require('./smsInteraction.socket')[_0x1775('0xe')](socket);function respondWithRpcPromise(_0x3d842c,_0x268b8f,_0x4d38cd){return new BPromise(function(_0x4ec0d7,_0x33a17c){return client[_0x1775('0xf')](_0x3d842c,_0x4d38cd)[_0x1775('0x10')](function(_0x10e862){logger[_0x1775('0x11')](_0x1775('0x12'),_0x268b8f,'request\x20sent');logger[_0x1775('0x13')](_0x1775('0x14'),_0x268b8f,_0x1775('0x15'),JSON[_0x1775('0x16')](_0x10e862));if(_0x10e862[_0x1775('0x17')]){if(_0x10e862[_0x1775('0x17')][_0x1775('0x18')]===0x1f4){logger[_0x1775('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x268b8f,_0x10e862[_0x1775('0x17')][_0x1775('0x19')]);return _0x33a17c(_0x10e862[_0x1775('0x17')][_0x1775('0x19')]);}logger[_0x1775('0x17')](_0x1775('0x12'),_0x268b8f,_0x10e862[_0x1775('0x17')][_0x1775('0x19')]);return _0x4ec0d7(_0x10e862['error'][_0x1775('0x19')]);}else{logger[_0x1775('0x11')](_0x1775('0x12'),_0x268b8f,_0x1775('0x15'));_0x4ec0d7(_0x10e862[_0x1775('0x1a')][_0x1775('0x19')]);}})['catch'](function(_0xe14346){logger[_0x1775('0x17')](_0x1775('0x12'),_0x268b8f,_0xe14346);_0x33a17c(_0xe14346);});});}exports[_0x1775('0x1b')]=function(_0x4182fd){var _0x11dc07=this;return new Promise(function(_0x42e7f9,_0x2a22a2){return db[_0x1775('0x1c')][_0x1775('0x1d')](_0x4182fd[_0x1775('0x1e')],{'raw':_0x4182fd[_0x1775('0x1f')]?_0x4182fd[_0x1775('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4182fd['options']?_0x4182fd[_0x1775('0x1f')][_0x1775('0x20')]||null:null,'attributes':_0x4182fd[_0x1775('0x1f')]?_0x4182fd[_0x1775('0x1f')]['attributes']||null:null,'limit':_0x4182fd[_0x1775('0x1f')]?_0x4182fd[_0x1775('0x1f')][_0x1775('0x21')]||null:null})[_0x1775('0x10')](function(_0xc3efa5){logger['info'](_0x1775('0x1b'),_0x4182fd);logger[_0x1775('0x13')](_0x1775('0x1b'),_0x4182fd,JSON['stringify'](_0xc3efa5));_0x42e7f9(_0xc3efa5);})['catch'](function(_0x2e6919){logger[_0x1775('0x17')]('UpdateSmsInteraction',_0x2e6919[_0x1775('0x19')],_0x4182fd);_0x2a22a2(_0x11dc07[_0x1775('0x17')](0x1f4,_0x2e6919[_0x1775('0x19')]));});});};exports[_0x1775('0x22')]=function(_0x403d93){return new Promise(function(_0x19e720,_0x58bfbc){return db[_0x1775('0x1c')]['find']({'where':_0x403d93[_0x1775('0x1f')]?_0x403d93[_0x1775('0x1f')][_0x1775('0x20')]||null:null})[_0x1775('0x10')](function(_0x2e5b8e){if(_0x2e5b8e){return _0x2e5b8e['addTags'](_0x403d93[_0x1775('0x1e')][_0x1775('0x23')],_[_0x1775('0x24')](_0x403d93[_0x1775('0x1e')],[_0x1775('0x23'),'id'])||{});}})[_0x1775('0x25')](function(_0xfd6088){logger[_0x1775('0x11')]('AddTags',_0x403d93);logger[_0x1775('0x13')](_0x1775('0x26'),_0x403d93,JSON[_0x1775('0x16')](_0xfd6088));_0x19e720(_0xfd6088);})[_0x1775('0x27')](function(_0x31010d){logger[_0x1775('0x17')](_0x1775('0x26'),_0x31010d[_0x1775('0x19')],_0x403d93);_0x58bfbc(_this[_0x1775('0x17')](0x1f4,_0x31010d[_0x1775('0x19')]));});});}; \ No newline at end of file +var _0x66be=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','raw','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321ce4,_0x2b4d42){var _0x148ac5=function(_0x12dfa1){while(--_0x12dfa1){_0x321ce4['push'](_0x321ce4['shift']());}};_0x148ac5(++_0x2b4d42);}(_0x66be,0x184));var _0xe66b=function(_0x19f963,_0x1d6f6b){_0x19f963=_0x19f963-0x0;var _0x508149=_0x66be[_0x19f963];return _0x508149;};'use strict';var _=require(_0xe66b('0x0'));var util=require(_0xe66b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe66b('0x2'));var fs=require('fs');var Redis=require(_0xe66b('0x3'));var db=require(_0xe66b('0x4'))['db'];var utils=require(_0xe66b('0x5'));var logger=require(_0xe66b('0x6'))(_0xe66b('0x7'));var config=require(_0xe66b('0x8'));var jayson=require(_0xe66b('0x9'));var client=jayson[_0xe66b('0xa')][_0xe66b('0xb')]({'port':0x232a});config[_0xe66b('0xc')]=_[_0xe66b('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe66b('0xe'))(new Redis(config['redis']));require(_0xe66b('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ec386,_0x482fae,_0x2d8c99){return new BPromise(function(_0x2e8f01,_0xc8b6a){return client[_0xe66b('0x10')](_0x4ec386,_0x2d8c99)[_0xe66b('0x11')](function(_0x3ffcb4){logger[_0xe66b('0x12')](_0xe66b('0x13'),_0x482fae,_0xe66b('0x14'));logger[_0xe66b('0x15')](_0xe66b('0x16'),_0x482fae,_0xe66b('0x14'),JSON[_0xe66b('0x17')](_0x3ffcb4));if(_0x3ffcb4['error']){if(_0x3ffcb4[_0xe66b('0x18')][_0xe66b('0x19')]===0x1f4){logger[_0xe66b('0x18')](_0xe66b('0x13'),_0x482fae,_0x3ffcb4[_0xe66b('0x18')][_0xe66b('0x1a')]);return _0xc8b6a(_0x3ffcb4[_0xe66b('0x18')][_0xe66b('0x1a')]);}logger[_0xe66b('0x18')](_0xe66b('0x13'),_0x482fae,_0x3ffcb4[_0xe66b('0x18')][_0xe66b('0x1a')]);return _0x2e8f01(_0x3ffcb4['error']['message']);}else{logger['info'](_0xe66b('0x13'),_0x482fae,'request\x20sent');_0x2e8f01(_0x3ffcb4['result'][_0xe66b('0x1a')]);}})[_0xe66b('0x1b')](function(_0x208e33){logger[_0xe66b('0x18')](_0xe66b('0x13'),_0x482fae,_0x208e33);_0xc8b6a(_0x208e33);});});}exports['UpdateSmsInteraction']=function(_0x1b8b97){var _0x49b750=this;return new Promise(function(_0x1f46bb,_0x34fe6a){return db['SmsInteraction']['update'](_0x1b8b97[_0xe66b('0x1c')],{'raw':_0x1b8b97[_0xe66b('0x1d')]?_0x1b8b97[_0xe66b('0x1d')][_0xe66b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8b97['options']?_0x1b8b97[_0xe66b('0x1d')][_0xe66b('0x1f')]||null:null,'attributes':_0x1b8b97['options']?_0x1b8b97[_0xe66b('0x1d')]['attributes']||null:null,'limit':_0x1b8b97[_0xe66b('0x1d')]?_0x1b8b97[_0xe66b('0x1d')][_0xe66b('0x20')]||null:null})[_0xe66b('0x11')](function(_0x15400c){logger[_0xe66b('0x12')](_0xe66b('0x21'),_0x1b8b97);logger[_0xe66b('0x15')](_0xe66b('0x21'),_0x1b8b97,JSON[_0xe66b('0x17')](_0x15400c));_0x1f46bb(_0x15400c);})['catch'](function(_0x346904){logger['error'](_0xe66b('0x21'),_0x346904[_0xe66b('0x1a')],_0x1b8b97);_0x34fe6a(_0x49b750[_0xe66b('0x18')](0x1f4,_0x346904[_0xe66b('0x1a')]));});});};exports[_0xe66b('0x22')]=function(_0x5a04f9){return new Promise(function(_0x290174,_0x2a9407){return db[_0xe66b('0x23')]['find']({'where':_0x5a04f9[_0xe66b('0x1d')]?_0x5a04f9[_0xe66b('0x1d')][_0xe66b('0x1f')]||null:null})['then'](function(_0x1086ed){if(_0x1086ed){return _0x1086ed[_0xe66b('0x24')](_0x5a04f9['body'][_0xe66b('0x25')],_[_0xe66b('0x26')](_0x5a04f9[_0xe66b('0x1c')],[_0xe66b('0x25'),'id'])||{});}})[_0xe66b('0x27')](function(_0x42633f){logger[_0xe66b('0x12')]('AddTags',_0x5a04f9);logger[_0xe66b('0x15')](_0xe66b('0x28'),_0x5a04f9,JSON['stringify'](_0x42633f));_0x290174(_0x42633f);})['catch'](function(_0x221809){logger[_0xe66b('0x18')](_0xe66b('0x28'),_0x221809['message'],_0x5a04f9);_0x2a9407(_this[_0xe66b('0x18')](0x1f4,_0x221809[_0xe66b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index db836de..574e569 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 _0xd25f=['removeListener','smsInteraction:','save','remove','update'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xd25f,0x1e2));var _0xfd25=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0xd25f[_0x507597];return _0x110a0f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xfd25('0x0'),_0xfd25('0x1'),_0xfd25('0x2')];function createListener(_0x2e4f95,_0x19732a){return function(_0x3da536){_0x19732a['emit'](_0x2e4f95,_0x3da536);};}function removeListener(_0x3d0842,_0x3ce46e){return function(){SmsInteractionEvents[_0xfd25('0x3')](_0x3d0842,_0x3ce46e);};}exports['register']=function(_0x5f0675){for(var _0x127cc0=0x0,_0x472414=events['length'];_0x127cc0<_0x472414;_0x127cc0++){var _0x5eace2=events[_0x127cc0];var _0x12278d=createListener(_0xfd25('0x4')+_0x5eace2,_0x5f0675);SmsInteractionEvents['on'](_0x5eace2,_0x12278d);}}; \ No newline at end of file +var _0xf570=['update','emit','register','./smsInteraction.events','save','remove'];(function(_0x56caab,_0x5c0a27){var _0x211423=function(_0x2188a9){while(--_0x2188a9){_0x56caab['push'](_0x56caab['shift']());}};_0x211423(++_0x5c0a27);}(_0xf570,0xf9));var _0x0f57=function(_0x598600,_0xda1c6c){_0x598600=_0x598600-0x0;var _0x207695=_0xf570[_0x598600];return _0x207695;};'use strict';var SmsInteractionEvents=require(_0x0f57('0x0'));var events=[_0x0f57('0x1'),_0x0f57('0x2'),_0x0f57('0x3')];function createListener(_0x33e79a,_0x39987d){return function(_0x1bc7ec){_0x39987d[_0x0f57('0x4')](_0x33e79a,_0x1bc7ec);};}function removeListener(_0x5c57a0,_0x2f0c42){return function(){SmsInteractionEvents['removeListener'](_0x5c57a0,_0x2f0c42);};}exports[_0x0f57('0x5')]=function(_0x287dfb){for(var _0x15b63a=0x0,_0x31083e=events['length'];_0x15b63a<_0x31083e;_0x15b63a++){var _0x1ce09b=events[_0x15b63a];var _0x3edb06=createListener('smsInteraction:'+_0x1ce09b,_0x287dfb);SmsInteractionEvents['on'](_0x1ce09b,_0x3edb06);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f0eefc0..05ec16c 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 _0xd81e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','get','describe','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','multer','path'];(function(_0x256c41,_0x39ff1f){var _0x499cea=function(_0x19950a){while(--_0x19950a){_0x256c41['push'](_0x256c41['shift']());}};_0x499cea(++_0x39ff1f);}(_0xd81e,0x7b));var _0xed81=function(_0x27760d,_0x2ee6d4){_0x27760d=_0x27760d-0x0;var _0x231349=_0xd81e[_0x27760d];return _0x231349;};'use strict';var multer=require(_0xed81('0x0'));var util=require('util');var path=require(_0xed81('0x1'));var timeout=require(_0xed81('0x2'));var express=require(_0xed81('0x3'));var router=express[_0xed81('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed81('0x5'));var config=require(_0xed81('0x6'));var controller=require(_0xed81('0x7'));router['get']('/',auth[_0xed81('0x8')](),controller['index']);router[_0xed81('0x9')]('/describe',auth[_0xed81('0x8')](),controller[_0xed81('0xa')]);router[_0xed81('0x9')]('/:id',auth[_0xed81('0x8')](),controller[_0xed81('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xed81('0xc')](_0xed81('0xd'),_0xed81('0xe')),controller[_0xed81('0xf')]);router[_0xed81('0x10')](_0xed81('0x11'),controller[_0xed81('0x12')]);router[_0xed81('0x13')](_0xed81('0x14'),auth[_0xed81('0x8')](),controller[_0xed81('0x15')]);router[_0xed81('0x13')](_0xed81('0x16'),auth['isAuthenticated'](),controller[_0xed81('0x17')]);router[_0xed81('0x13')](_0xed81('0x18'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf3d9=['reject','delete','/:id','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','describe','get','show','post','sms','/:id/status','status','put','update','/:id/accept','/:id/reject'];(function(_0x2b5ae1,_0x49b4fc){var _0x24112b=function(_0x4b2157){while(--_0x4b2157){_0x2b5ae1['push'](_0x2b5ae1['shift']());}};_0x24112b(++_0x49b4fc);}(_0xf3d9,0x162));var _0x9f3d=function(_0x4ee6d5,_0x33f450){_0x4ee6d5=_0x4ee6d5-0x0;var _0x3a3cfa=_0xf3d9[_0x4ee6d5];return _0x3a3cfa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f3d('0x0'));var timeout=require(_0x9f3d('0x1'));var express=require(_0x9f3d('0x2'));var router=express['Router']();var fs_extra=require(_0x9f3d('0x3'));var auth=require(_0x9f3d('0x4'));var interaction=require(_0x9f3d('0x5'));var config=require(_0x9f3d('0x6'));var controller=require(_0x9f3d('0x7'));router['get']('/',auth[_0x9f3d('0x8')](),controller[_0x9f3d('0x9')]);router['get']('/describe',auth[_0x9f3d('0x8')](),controller[_0x9f3d('0xa')]);router[_0x9f3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x9f3d('0xc')]);router[_0x9f3d('0xd')]('/',auth[_0x9f3d('0x8')](),interaction['tracked'](_0x9f3d('0xe'),'smsmessage:create'),controller['create']);router['post'](_0x9f3d('0xf'),controller[_0x9f3d('0x10')]);router[_0x9f3d('0x11')]('/:id',auth[_0x9f3d('0x8')](),controller[_0x9f3d('0x12')]);router['put'](_0x9f3d('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x9f3d('0x11')](_0x9f3d('0x14'),auth['isAuthenticated'](),controller[_0x9f3d('0x15')]);router[_0x9f3d('0x16')](_0x9f3d('0x17'),auth[_0x9f3d('0x8')](),controller['destroy']);module[_0x9f3d('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 8f24558..b9012bd 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 _0x0e82=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e82,0x1e7));var _0x20e8=function(_0x41741e,_0x57796a){_0x41741e=_0x41741e-0x0;var _0x303470=_0x0e82[_0x41741e];return _0x303470;};'use strict';var Sequelize=require(_0x20e8('0x0'));module[_0x20e8('0x1')]={'body':{'type':Sequelize[_0x20e8('0x2')](_0x20e8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x20e8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x20e8('0x5')),'defaultValue':_0x20e8('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x20e8('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x20e8('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf5cd=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x40edd1,_0x5a6444){var _0x49de5f=function(_0x498ae3){while(--_0x498ae3){_0x40edd1['push'](_0x40edd1['shift']());}};_0x49de5f(++_0x5a6444);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x3afa3a,_0x1793fe){_0x3afa3a=_0x3afa3a-0x0;var _0xa5b64f=_0xf5cd[_0x3afa3a];return _0xa5b64f;};'use strict';var Sequelize=require(_0xdf5c('0x0'));module[_0xdf5c('0x1')]={'body':{'type':Sequelize[_0xdf5c('0x2')](_0xdf5c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdf5c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdf5c('0x5')]('in','out'),'defaultValue':_0xdf5c('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdf5c('0x7')](0xbe)},'phone':{'type':Sequelize[_0xdf5c('0x7')]},'readAt':{'type':Sequelize[_0xdf5c('0x8')]},'secret':{'type':Sequelize[_0xdf5c('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdf5c('0x7')]},'providerResponse':{'type':Sequelize[_0xdf5c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6bef192..05e8630 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 _0xb181=['acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','info','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./smsMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','stack','name','send','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','SmsMessage','includeAll','findAll','show','params','keys','rawAttributes','include','options','find','create','update','body','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage'];(function(_0x1068e1,_0x32e024){var _0x3ebdf5=function(_0x1d760e){while(--_0x1d760e){_0x1068e1['push'](_0x1068e1['shift']());}};_0x3ebdf5(++_0x32e024);}(_0xb181,0xc6));var _0x1b18=function(_0x424105,_0xe6ad4e){_0x424105=_0x424105-0x0;var _0x262f08=_0xb181[_0x424105];return _0x262f08;};'use strict';var emlformat=require(_0x1b18('0x0'));var rimraf=require(_0x1b18('0x1'));var zipdir=require(_0x1b18('0x2'));var jsonpatch=require(_0x1b18('0x3'));var rp=require('request-promise');var moment=require(_0x1b18('0x4'));var BPromise=require(_0x1b18('0x5'));var Mustache=require('mustache');var util=require(_0x1b18('0x6'));var path=require(_0x1b18('0x7'));var sox=require(_0x1b18('0x8'));var csv=require(_0x1b18('0x9'));var ejs=require(_0x1b18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b18('0xb'));var squel=require(_0x1b18('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b18('0xd'));var deskjs=require(_0x1b18('0xe'));var toCsv=require(_0x1b18('0x9'));var querystring=require(_0x1b18('0xf'));var Papa=require('papaparse');var Redis=require(_0x1b18('0x10'));var authService=require(_0x1b18('0x11'));var qs=require(_0x1b18('0x12'));var as=require(_0x1b18('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b18('0x14'))(_0x1b18('0x15'));var utils=require(_0x1b18('0x16'));var config=require(_0x1b18('0x17'));var licenseUtil=require(_0x1b18('0x18'));var db=require(_0x1b18('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1b18('0x1a'))(new Redis(config[_0x1b18('0x1b')]));require(_0x1b18('0x1c'))[_0x1b18('0x1d')](socket);var jayson=require(_0x1b18('0x1e'));var client=jayson[_0x1b18('0x1f')][_0x1b18('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b301d,_0x5b421d,_0x3c8d52,_0xa4702b){return new BPromise(function(_0x364280,_0x1c7b95){var _0x294c8f=_0xa4702b||client;return _0x294c8f[_0x1b18('0x21')](_0x1b301d,_0x3c8d52)[_0x1b18('0x22')](function(_0x1e7d32){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x1b18('0x23'));logger[_0x1b18('0x24')](_0x1b18('0x25'),_0x5b421d,_0x1b18('0x23'),JSON['stringify'](_0x1e7d32));if(_0x1e7d32['error']){if(_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x27')]===0x1f4){logger[_0x1b18('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x1e7d32['error']['message']);return _0x1c7b95(_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x28')]);}logger['error'](_0x1b18('0x29'),_0x5b421d,_0x1e7d32[_0x1b18('0x26')][_0x1b18('0x28')]);return _0x364280(_0x1e7d32[_0x1b18('0x26')]['message']);}else{logger['info'](_0x1b18('0x29'),_0x5b421d,_0x1b18('0x23'));_0x364280(_0x1e7d32[_0x1b18('0x2a')][_0x1b18('0x28')]);}})[_0x1b18('0x2b')](function(_0x3523ce){logger[_0x1b18('0x26')]('SmsMessage,\x20%s,\x20%s',_0x5b421d,_0x3523ce);_0x1c7b95(_0x3523ce);});});}function respondWithStatusCode(_0x2bf404,_0x3308b6){_0x3308b6=_0x3308b6||0xcc;return function(_0x2a80e2){if(_0x2a80e2){return _0x2bf404[_0x1b18('0x2c')](_0x3308b6);}return _0x2bf404[_0x1b18('0x2d')](_0x3308b6)[_0x1b18('0x2e')]();};}function respondWithResult(_0x467b32,_0x511c90){_0x511c90=_0x511c90||0xc8;return function(_0x189b65){if(_0x189b65){return _0x467b32['status'](_0x511c90)[_0x1b18('0x2f')](_0x189b65);}};}function respondWithFilteredResult(_0x32500e,_0x1ce4ba){return function(_0x2ecc11){if(_0x2ecc11){var _0x187c07=typeof _0x1ce4ba[_0x1b18('0x30')]==='undefined'&&typeof _0x1ce4ba[_0x1b18('0x31')]===_0x1b18('0x32');var _0x1efc7c=_0x2ecc11[_0x1b18('0x33')];var _0x1e5e3d=_0x187c07?0x0:_0x1ce4ba[_0x1b18('0x30')];var _0x53e9c2=_0x187c07?_0x2ecc11[_0x1b18('0x33')]:_0x1ce4ba[_0x1b18('0x30')]+_0x1ce4ba[_0x1b18('0x31')];var _0x35f367;if(_0x53e9c2>=_0x1efc7c){_0x53e9c2=_0x1efc7c;_0x35f367=0xc8;}else{_0x35f367=0xce;}_0x32500e['status'](_0x35f367);return _0x32500e[_0x1b18('0x34')](_0x1b18('0x35'),_0x1e5e3d+'-'+_0x53e9c2+'/'+_0x1efc7c)[_0x1b18('0x2f')](_0x2ecc11);}return null;};}function patchUpdates(_0x34cb31){return function(_0x289e4c){try{jsonpatch[_0x1b18('0x36')](_0x289e4c,_0x34cb31,!![]);}catch(_0x146b97){return BPromise['reject'](_0x146b97);}return _0x289e4c[_0x1b18('0x37')]();};}function saveUpdates(_0x5fbecf,_0x714087){return function(_0x191126){if(_0x191126){return _0x191126['update'](_0x5fbecf)[_0x1b18('0x22')](function(_0x407b20){return _0x407b20;});}return null;};}function removeEntity(_0x1c2296,_0x473be2){return function(_0x39fca1){if(_0x39fca1){return _0x39fca1[_0x1b18('0x38')]()[_0x1b18('0x22')](function(){_0x1c2296[_0x1b18('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120a58,_0x26da02){return function(_0x3f7468){if(!_0x3f7468){_0x120a58['sendStatus'](0x194);}return _0x3f7468;};}function handleError(_0x55bd28,_0x24ffde){_0x24ffde=_0x24ffde||0x1f4;return function(_0x203876){logger[_0x1b18('0x26')](_0x203876[_0x1b18('0x39')]);if(_0x203876[_0x1b18('0x3a')]){delete _0x203876['name'];}_0x55bd28[_0x1b18('0x2d')](_0x24ffde)[_0x1b18('0x3b')](_0x203876);};}exports['index']=function(_0x372b14,_0x5f193f){var _0x2b8ec6={},_0x3a8c27={},_0x486af6={'count':0x0,'rows':[]};var _0x3e6c86=_['map'](db['SmsMessage']['rawAttributes'],function(_0x261f07){return{'name':_0x261f07[_0x1b18('0x3c')],'type':_0x261f07[_0x1b18('0x3d')][_0x1b18('0x3e')]};});_0x3a8c27['model']=_[_0x1b18('0x3f')](_0x3e6c86,_0x1b18('0x3a'));_0x3a8c27[_0x1b18('0x40')]=_['keys'](_0x372b14['query']);_0x3a8c27[_0x1b18('0x41')]=_[_0x1b18('0x42')](_0x3a8c27[_0x1b18('0x43')],_0x3a8c27[_0x1b18('0x40')]);_0x2b8ec6[_0x1b18('0x44')]=_[_0x1b18('0x42')](_0x3a8c27[_0x1b18('0x43')],qs[_0x1b18('0x45')](_0x372b14[_0x1b18('0x40')][_0x1b18('0x45')]));_0x2b8ec6[_0x1b18('0x44')]=_0x2b8ec6['attributes'][_0x1b18('0x46')]?_0x2b8ec6[_0x1b18('0x44')]:_0x3a8c27['model'];if(!_0x372b14['query'][_0x1b18('0x47')]('nolimit')){_0x2b8ec6[_0x1b18('0x31')]=qs['limit'](_0x372b14[_0x1b18('0x40')][_0x1b18('0x31')]);_0x2b8ec6[_0x1b18('0x30')]=qs['offset'](_0x372b14[_0x1b18('0x40')]['offset']);}_0x2b8ec6[_0x1b18('0x48')]=qs['sort'](_0x372b14[_0x1b18('0x40')][_0x1b18('0x49')]);_0x2b8ec6[_0x1b18('0x4a')]=qs[_0x1b18('0x41')](_[_0x1b18('0x4b')](_0x372b14[_0x1b18('0x40')],_0x3a8c27[_0x1b18('0x41')]),_0x3e6c86);if(_0x372b14[_0x1b18('0x40')]['filter']){_0x2b8ec6[_0x1b18('0x4a')]=_['merge'](_0x2b8ec6['where'],{'$or':_['map'](_0x3e6c86,function(_0x105248){if(_0x105248[_0x1b18('0x3d')]!==_0x1b18('0x4c')){var _0xfd6f37={};_0xfd6f37[_0x105248[_0x1b18('0x3a')]]={'$like':'%'+_0x372b14[_0x1b18('0x40')][_0x1b18('0x4d')]+'%'};return _0xfd6f37;}})});}_0x2b8ec6=_[_0x1b18('0x4e')]({},_0x2b8ec6,_0x372b14['options']);var _0x23b1f5={'where':_0x2b8ec6[_0x1b18('0x4a')]};return db[_0x1b18('0x4f')]['count'](_0x23b1f5)[_0x1b18('0x22')](function(_0x4e4c40){_0x486af6[_0x1b18('0x33')]=_0x4e4c40;if(_0x372b14['query'][_0x1b18('0x50')]){_0x2b8ec6['include']=[{'all':!![]}];}return db[_0x1b18('0x4f')][_0x1b18('0x51')](_0x2b8ec6);})[_0x1b18('0x22')](function(_0x4fbc66){_0x486af6['rows']=_0x4fbc66;return _0x486af6;})[_0x1b18('0x22')](respondWithFilteredResult(_0x5f193f,_0x2b8ec6))[_0x1b18('0x2b')](handleError(_0x5f193f,null));};exports[_0x1b18('0x52')]=function(_0x281724,_0xfeaa07){var _0x535f2f={'raw':!![],'where':{'id':_0x281724[_0x1b18('0x53')]['id']}},_0x1cce4c={};_0x1cce4c[_0x1b18('0x43')]=_[_0x1b18('0x54')](db[_0x1b18('0x4f')][_0x1b18('0x55')]);_0x1cce4c[_0x1b18('0x40')]=_[_0x1b18('0x54')](_0x281724['query']);_0x1cce4c['filters']=_[_0x1b18('0x42')](_0x1cce4c['model'],_0x1cce4c[_0x1b18('0x40')]);_0x535f2f[_0x1b18('0x44')]=_[_0x1b18('0x42')](_0x1cce4c['model'],qs['fields'](_0x281724['query'][_0x1b18('0x45')]));_0x535f2f['attributes']=_0x535f2f['attributes'][_0x1b18('0x46')]?_0x535f2f[_0x1b18('0x44')]:_0x1cce4c[_0x1b18('0x43')];if(_0x281724[_0x1b18('0x40')][_0x1b18('0x50')]){_0x535f2f[_0x1b18('0x56')]=[{'all':!![]}];}_0x535f2f=_[_0x1b18('0x4e')]({},_0x535f2f,_0x281724[_0x1b18('0x57')]);return db['SmsMessage'][_0x1b18('0x58')](_0x535f2f)[_0x1b18('0x22')](handleEntityNotFound(_0xfeaa07,null))[_0x1b18('0x22')](respondWithResult(_0xfeaa07,null))[_0x1b18('0x2b')](handleError(_0xfeaa07,null));};exports['create']=function(_0x598788,_0x3ff1f0){return db['SmsMessage'][_0x1b18('0x59')](_0x598788['body'],{})[_0x1b18('0x22')](respondWithResult(_0x3ff1f0,0xc9))[_0x1b18('0x2b')](handleError(_0x3ff1f0,null));};exports[_0x1b18('0x5a')]=function(_0x47aa4a,_0x23d1de){if(_0x47aa4a[_0x1b18('0x5b')]['id']){delete _0x47aa4a[_0x1b18('0x5b')]['id'];}return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x47aa4a[_0x1b18('0x53')]['id']}})['then'](handleEntityNotFound(_0x23d1de,null))[_0x1b18('0x22')](saveUpdates(_0x47aa4a['body'],null))['then'](respondWithResult(_0x23d1de,null))[_0x1b18('0x2b')](handleError(_0x23d1de,null));};exports[_0x1b18('0x38')]=function(_0x5dd7f0,_0x40a6c3){return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x5dd7f0['params']['id']}})[_0x1b18('0x22')](handleEntityNotFound(_0x40a6c3,null))[_0x1b18('0x22')](removeEntity(_0x40a6c3,null))[_0x1b18('0x2b')](handleError(_0x40a6c3,null));};exports[_0x1b18('0x5c')]=function(_0x2757ad,_0x347f81){return db[_0x1b18('0x4f')][_0x1b18('0x5c')]()[_0x1b18('0x22')](respondWithResult(_0x347f81,null))['catch'](handleError(_0x347f81,null));};var interaction_log=require(_0x1b18('0x14'))(_0x1b18('0x5d'));exports[_0x1b18('0x5e')]=function(_0x14e081,_0x261eab,_0x28969c){var _0x56d1d9={'agent':{},'channel':_0x1b18('0x5f')};if(_0x14e081[_0x1b18('0x5b')]['id']){delete _0x14e081[_0x1b18('0x5b')]['id'];}_0x14e081['body'][_0x1b18('0x60')]=!![];_0x14e081['body']['readAt']=moment()['format'](_0x1b18('0x61'));_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')]=_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')]||_0x14e081[_0x1b18('0x63')]['id'];_0x56d1d9[_0x1b18('0x64')]['id']=_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x14e081[_0x1b18('0x53')]['id'],'UserId':null}})[_0x1b18('0x22')](handleEntityNotFound(_0x261eab,null))[_0x1b18('0x22')](saveUpdates(_0x14e081[_0x1b18('0x5b')],null))[_0x1b18('0x22')](function(_0xcac858){if(_0xcac858){_0x56d1d9[_0x1b18('0x28')]=_0xcac858[_0x1b18('0x65')]({'plain':!![]});return db[_0x1b18('0x66')][_0x1b18('0x58')]({'where':{'id':_0xcac858[_0x1b18('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x261eab,null))['then'](function(_0x428179){if(_0x428179){return _0x428179[_0x1b18('0x5a')]({'UserId':_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')],'read1stAt':_['isNil'](_0x428179[_0x1b18('0x68')])?moment()[_0x1b18('0x69')](_0x1b18('0x61')):undefined});}return null;})[_0x1b18('0x22')](function(_0x532c28){if(_0x532c28){_0x56d1d9['interaction']=_0x532c28[_0x1b18('0x65')]({'plain':!![]});interaction_log['info'](_0x1b18('0x6a'),_0x14e081[_0x1b18('0x63')]['id'],_0x14e081[_0x1b18('0x63')][_0x1b18('0x3a')],_0x14e081[_0x1b18('0x63')][_0x1b18('0x6b')],_0x56d1d9[_0x1b18('0x6c')]['id'],_0x14e081[_0x1b18('0x5b')]?JSON[_0x1b18('0x6d')](_0x14e081[_0x1b18('0x5b')]):_0x1b18('0x6e'));return respondWithRpcPromise(_0x1b18('0x6f'),_0x1b18('0x70'),_0x56d1d9);}return null;})[_0x1b18('0x22')](function(_0x2bde07){var _0x17fbf0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2bde07[_0x1b18('0x28')][_0x1b18('0x71')];return db[_0x1b18('0x72')]['query'](_0x17fbf0,{'type':db[_0x1b18('0x73')][_0x1b18('0x74')]['SELECT'],'raw':!![]})['then'](function(_0x27678e){return _0x27678e;});})['then'](function(_0x3d783f){if(_0x3d783f){_0x56d1d9['message']['contact']=_0x3d783f[0x0];if(!_0x14e081[_0x1b18('0x5b')]['UserId'])return;return db[_0x1b18('0x75')][_0x1b18('0x58')]({'where':{'id':_0x14e081[_0x1b18('0x5b')][_0x1b18('0x62')],'role':'agent'},'attributes':['id','name',_0x1b18('0x76'),_0x1b18('0x77'),_0x1b18('0x78')],'raw':!![]});}return null;})['then'](function(_0x3a14ed){if(!_0x3a14ed)return null;_0x56d1d9['message']['agent']=_0x3a14ed;return _0x56d1d9;})[_0x1b18('0x22')](function(_0x1454e1){if(_0x1454e1){if(_0x14e081['body'][_0x1b18('0x79')]){_0x56d1d9['message']['interface']=util[_0x1b18('0x69')](_0x1b18('0x7a'),_0x14e081[_0x1b18('0x63')][_0x1b18('0x3a')]);_0x56d1d9[_0x1b18('0x28')]['channel']=_0x56d1d9[_0x1b18('0x7b')];_0x56d1d9[_0x1b18('0x28')][_0x1b18('0x7c')]=_0x56d1d9[_0x1b18('0x7b')];_0x56d1d9['message'][_0x1b18('0x7d')]=_0x1b18('0x5e');return respondWithRpcPromise(_0x1b18('0x7e'),_0x1b18('0x7e'),{'event':_0x1b18('0x7f'),'message':_0x56d1d9['message']},client9002)[_0x1b18('0x22')](function(){return _0x56d1d9;});}return _0x56d1d9;}return null;})[_0x1b18('0x22')](respondWithResult(_0x261eab,null))[_0x1b18('0x2b')](handleError(_0x261eab,null));};var interaction_log=require('../../config/logger')(_0x1b18('0x5d'));exports[_0x1b18('0x80')]=function(_0x2f4f37,_0x40a7ba,_0xc02ba6){var _0x3ed5f4={'agent':{},'channel':_0x1b18('0x5f')};if(_0x2f4f37[_0x1b18('0x5b')]['id']){delete _0x2f4f37[_0x1b18('0x5b')]['id'];}_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')]=_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')]||_0x2f4f37['user']['id'];_0x3ed5f4[_0x1b18('0x64')]['id']=_0x2f4f37[_0x1b18('0x5b')][_0x1b18('0x62')];return db[_0x1b18('0x4f')]['find']({'where':{'id':_0x2f4f37[_0x1b18('0x53')]['id'],'UserId':null}})[_0x1b18('0x22')](handleEntityNotFound(_0x40a7ba,null))[_0x1b18('0x22')](function(_0x3b939d){if(_0x3b939d){_0x3ed5f4['message']=_0x3b939d[_0x1b18('0x65')]({'plain':!![]});return db['SmsInteraction'][_0x1b18('0x58')]({'where':{'id':_0x3b939d[_0x1b18('0x67')]}});}return null;})[_0x1b18('0x22')](handleEntityNotFound(_0x40a7ba,null))[_0x1b18('0x22')](function(_0x29b864){if(_0x29b864){_0x3ed5f4[_0x1b18('0x6c')]=_0x29b864[_0x1b18('0x65')]({'plain':!![]});interaction_log[_0x1b18('0x81')](_0x1b18('0x82'),_0x2f4f37[_0x1b18('0x63')]['id'],_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x3a')],_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x6b')],_0x3ed5f4[_0x1b18('0x6c')]['id'],_0x2f4f37['body']?JSON[_0x1b18('0x6d')](_0x2f4f37[_0x1b18('0x5b')]):_0x1b18('0x6e'));return respondWithRpcPromise(_0x1b18('0x83'),_0x1b18('0x84'),_0x3ed5f4);}return null;})[_0x1b18('0x22')](function(_0x5998c7){var _0x44c455=_0x1b18('0x85')+_0x5998c7[_0x1b18('0x28')][_0x1b18('0x71')];return db['sequelize'][_0x1b18('0x40')](_0x44c455,{'type':db[_0x1b18('0x73')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x34c90d){return _0x34c90d;});})[_0x1b18('0x22')](function(_0x2ba191){if(_0x2ba191){_0x3ed5f4['message'][_0x1b18('0x86')]=_0x2ba191[0x0];if(!_0x2f4f37['body'][_0x1b18('0x62')])return;return db[_0x1b18('0x75')][_0x1b18('0x58')]({'where':{'id':_0x2f4f37[_0x1b18('0x5b')]['UserId'],'role':_0x1b18('0x64')},'attributes':['id',_0x1b18('0x3a'),'fullname',_0x1b18('0x77'),_0x1b18('0x78')],'raw':!![]});}return null;})[_0x1b18('0x22')](function(_0x2ab4c8){if(!_0x2ab4c8)return null;_0x3ed5f4[_0x1b18('0x28')][_0x1b18('0x64')]=_0x2ab4c8;return _0x3ed5f4;})[_0x1b18('0x22')](function(_0x5b6025){if(_0x5b6025){_0x5b6025[_0x1b18('0x28')][_0x1b18('0x87')]=util['format'](_0x1b18('0x7a'),_0x2f4f37[_0x1b18('0x63')][_0x1b18('0x3a')]);_0x5b6025[_0x1b18('0x28')][_0x1b18('0x7b')]=_0x3ed5f4[_0x1b18('0x7b')];_0x5b6025[_0x1b18('0x28')][_0x1b18('0x7c')]=_0x3ed5f4[_0x1b18('0x7b')];_0x5b6025[_0x1b18('0x28')]['event']='reject';respondWithRpcPromise(_0x1b18('0x7e'),_0x1b18('0x7e'),{'event':_0x1b18('0x88'),'message':_0x5b6025[_0x1b18('0x28')]},client9002);return _0x3ed5f4;}return null;})[_0x1b18('0x22')](respondWithResult(_0x40a7ba,null))['catch'](handleError(_0x40a7ba,null));};exports['status']=function(_0x2a3ecd,_0x10ea2c,_0x19d1bd){if(_0x2a3ecd[_0x1b18('0x5b')]['id']){delete _0x2a3ecd[_0x1b18('0x5b')]['id'];}var _0x22edc9;return db[_0x1b18('0x4f')][_0x1b18('0x58')]({'where':{'id':_0x2a3ecd['params']['id']}})[_0x1b18('0x22')](handleEntityNotFound(_0x10ea2c,null))[_0x1b18('0x22')](function(_0x3f8d8f){if(_0x3f8d8f){_0x22edc9=_0x3f8d8f;return db[_0x1b18('0x89')][_0x1b18('0x58')]({'where':{'id':_0x3f8d8f[_0x1b18('0x8a')]}});}})[_0x1b18('0x22')](handleEntityNotFound(_0x10ea2c,null))[_0x1b18('0x22')](function(_0x574bed){if(_0x574bed){logger[_0x1b18('0x24')](_0x1b18('0x25'),_0x1b18('0x2d'),_0x1b18('0x8b'),_0x574bed[_0x1b18('0x3d')],util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));switch(_0x574bed[_0x1b18('0x3d')]){case _0x1b18('0x8d'):if(_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x8e')]&&_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x8e')]===_0x22edc9[_0x1b18('0x8f')]){return _0x22edc9['update']({'read':!![]});}else{logger[_0x1b18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b18('0x2d'),_0x1b18('0x8d'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x1b18('0x90'):if(_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x91')]&&_0x2a3ecd['body'][_0x1b18('0x91')]===_0x22edc9[_0x1b18('0x8f')]&&_['indexOf']([_0x1b18('0x92'),_0x1b18('0x93')],_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x94')])>=0x0){return _0x22edc9['update']({'read':!![]});}else{logger[_0x1b18('0x26')](_0x1b18('0x95'),_0x1b18('0x2d'),_0x1b18('0x96'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x25f6be=_0x2a3ecd[_0x1b18('0x5b')][_0x1b18('0x97')][0x0];if(_0x25f6be[_0x1b18('0x2d')][_0x1b18('0x98')]===_0x1b18('0x99')){return _0x22edc9[_0x1b18('0x5a')]({'read':!![]});}else{logger[_0x1b18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b18('0x2d'),_0x1b18('0x9a'),util[_0x1b18('0x8c')](_0x2a3ecd[_0x1b18('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x22edc9;}})[_0x1b18('0x22')](respondWithResult(_0x10ea2c,null))[_0x1b18('0x2b')](handleError(_0x10ea2c,null));}; \ No newline at end of file +var _0x542a=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','channel','motionChannel','EventManager','acceptmessage','sms-interactions','RejectMessage','rejectMessage','ContactId','Sequelize','User','internal','SIP/%s','event','SmsAccount','SmsAccountId','twilio','messageId','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','request'];(function(_0xb6bddf,_0x2372c3){var _0x1a7749=function(_0x3e020e){while(--_0x3e020e){_0xb6bddf['push'](_0xb6bddf['shift']());}};_0x1a7749(++_0x2372c3);}(_0x542a,0x71));var _0xa542=function(_0x3ba9ec,_0x49c244){_0x3ba9ec=_0x3ba9ec-0x0;var _0x39f681=_0x542a[_0x3ba9ec];return _0x39f681;};'use strict';var emlformat=require(_0xa542('0x0'));var rimraf=require(_0xa542('0x1'));var zipdir=require(_0xa542('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa542('0x3'));var BPromise=require(_0xa542('0x4'));var Mustache=require('mustache');var util=require(_0xa542('0x5'));var path=require(_0xa542('0x6'));var sox=require(_0xa542('0x7'));var csv=require(_0xa542('0x8'));var ejs=require(_0xa542('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa542('0xa'));var squel=require(_0xa542('0xb'));var crypto=require(_0xa542('0xc'));var jsforce=require(_0xa542('0xd'));var deskjs=require(_0xa542('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa542('0xf'));var Papa=require(_0xa542('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa542('0x11'));var as=require(_0xa542('0x12'));var hardwareService=require(_0xa542('0x13'));var logger=require(_0xa542('0x14'))(_0xa542('0x15'));var utils=require(_0xa542('0x16'));var config=require(_0xa542('0x17'));var licenseUtil=require(_0xa542('0x18'));var db=require(_0xa542('0x19'))['db'];config[_0xa542('0x1a')]=_[_0xa542('0x1b')](config[_0xa542('0x1a')],{'host':_0xa542('0x1c'),'port':0x18eb});var socket=require(_0xa542('0x1d'))(new Redis(config[_0xa542('0x1a')]));require(_0xa542('0x1e'))['register'](socket);var jayson=require(_0xa542('0x1f'));var client=jayson['client'][_0xa542('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xa542('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4fe977,_0x356930,_0x2c046c,_0x1156d4){return new BPromise(function(_0x26b928,_0x232cca){var _0x3f8b52=_0x1156d4||client;return _0x3f8b52[_0xa542('0x21')](_0x4fe977,_0x2c046c)['then'](function(_0x2edf56){logger[_0xa542('0x22')](_0xa542('0x23'),_0x356930,_0xa542('0x24'));logger[_0xa542('0x25')](_0xa542('0x26'),_0x356930,_0xa542('0x24'),JSON['stringify'](_0x2edf56));if(_0x2edf56[_0xa542('0x27')]){if(_0x2edf56['error'][_0xa542('0x28')]===0x1f4){logger[_0xa542('0x27')](_0xa542('0x23'),_0x356930,_0x2edf56[_0xa542('0x27')][_0xa542('0x29')]);return _0x232cca(_0x2edf56[_0xa542('0x27')][_0xa542('0x29')]);}logger['error'](_0xa542('0x23'),_0x356930,_0x2edf56[_0xa542('0x27')][_0xa542('0x29')]);return _0x26b928(_0x2edf56['error'][_0xa542('0x29')]);}else{logger[_0xa542('0x22')](_0xa542('0x23'),_0x356930,_0xa542('0x24'));_0x26b928(_0x2edf56['result'][_0xa542('0x29')]);}})[_0xa542('0x2a')](function(_0x466e7b){logger[_0xa542('0x27')](_0xa542('0x23'),_0x356930,_0x466e7b);_0x232cca(_0x466e7b);});});}function respondWithStatusCode(_0x4b6127,_0x476c6e){_0x476c6e=_0x476c6e||0xcc;return function(_0x4e844a){if(_0x4e844a){return _0x4b6127['sendStatus'](_0x476c6e);}return _0x4b6127[_0xa542('0x2b')](_0x476c6e)[_0xa542('0x2c')]();};}function respondWithResult(_0x454eb3,_0x33705f){_0x33705f=_0x33705f||0xc8;return function(_0x1fcf60){if(_0x1fcf60){return _0x454eb3[_0xa542('0x2b')](_0x33705f)['json'](_0x1fcf60);}};}function respondWithFilteredResult(_0x135b39,_0x48ee7b){return function(_0x4fd5ac){if(_0x4fd5ac){var _0x31f7dc=typeof _0x48ee7b['offset']===_0xa542('0x2d')&&typeof _0x48ee7b[_0xa542('0x2e')]===_0xa542('0x2d');var _0x3bc83f=_0x4fd5ac['count'];var _0x228caf=_0x31f7dc?0x0:_0x48ee7b['offset'];var _0x1a5d32=_0x31f7dc?_0x4fd5ac[_0xa542('0x2f')]:_0x48ee7b['offset']+_0x48ee7b[_0xa542('0x2e')];var _0x254848;if(_0x1a5d32>=_0x3bc83f){_0x1a5d32=_0x3bc83f;_0x254848=0xc8;}else{_0x254848=0xce;}_0x135b39[_0xa542('0x2b')](_0x254848);return _0x135b39[_0xa542('0x30')](_0xa542('0x31'),_0x228caf+'-'+_0x1a5d32+'/'+_0x3bc83f)[_0xa542('0x32')](_0x4fd5ac);}return null;};}function patchUpdates(_0xf6f222){return function(_0x4098b6){try{jsonpatch[_0xa542('0x33')](_0x4098b6,_0xf6f222,!![]);}catch(_0x2d8557){return BPromise[_0xa542('0x34')](_0x2d8557);}return _0x4098b6[_0xa542('0x35')]();};}function saveUpdates(_0x25bc27,_0x3f7c7a){return function(_0x38f12c){if(_0x38f12c){return _0x38f12c[_0xa542('0x36')](_0x25bc27)['then'](function(_0x58747e){return _0x58747e;});}return null;};}function removeEntity(_0x2e4596,_0x514b2f){return function(_0x5ca7aa){if(_0x5ca7aa){return _0x5ca7aa['destroy']()[_0xa542('0x37')](function(){_0x2e4596[_0xa542('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x129399,_0x2e5db3){return function(_0x3380ed){if(!_0x3380ed){_0x129399['sendStatus'](0x194);}return _0x3380ed;};}function handleError(_0x47a7b0,_0x989f83){_0x989f83=_0x989f83||0x1f4;return function(_0x7cb644){logger[_0xa542('0x27')](_0x7cb644['stack']);if(_0x7cb644[_0xa542('0x38')]){delete _0x7cb644[_0xa542('0x38')];}_0x47a7b0[_0xa542('0x2b')](_0x989f83)[_0xa542('0x39')](_0x7cb644);};}exports['index']=function(_0x6a24d3,_0x262678){var _0x350099={},_0x8ad84={},_0x2779be={'count':0x0,'rows':[]};var _0x5484a7=_[_0xa542('0x3a')](db[_0xa542('0x3b')][_0xa542('0x3c')],function(_0xca6425){return{'name':_0xca6425[_0xa542('0x3d')],'type':_0xca6425[_0xa542('0x3e')][_0xa542('0x3f')]};});_0x8ad84[_0xa542('0x40')]=_[_0xa542('0x3a')](_0x5484a7,_0xa542('0x38'));_0x8ad84['query']=_[_0xa542('0x41')](_0x6a24d3['query']);_0x8ad84[_0xa542('0x42')]=_['intersection'](_0x8ad84['model'],_0x8ad84[_0xa542('0x43')]);_0x350099['attributes']=_[_0xa542('0x44')](_0x8ad84[_0xa542('0x40')],qs[_0xa542('0x45')](_0x6a24d3['query'][_0xa542('0x45')]));_0x350099[_0xa542('0x46')]=_0x350099[_0xa542('0x46')][_0xa542('0x47')]?_0x350099[_0xa542('0x46')]:_0x8ad84[_0xa542('0x40')];if(!_0x6a24d3[_0xa542('0x43')]['hasOwnProperty'](_0xa542('0x48'))){_0x350099[_0xa542('0x2e')]=qs[_0xa542('0x2e')](_0x6a24d3[_0xa542('0x43')][_0xa542('0x2e')]);_0x350099[_0xa542('0x49')]=qs[_0xa542('0x49')](_0x6a24d3['query']['offset']);}_0x350099[_0xa542('0x4a')]=qs[_0xa542('0x4b')](_0x6a24d3[_0xa542('0x43')][_0xa542('0x4b')]);_0x350099[_0xa542('0x4c')]=qs[_0xa542('0x42')](_[_0xa542('0x4d')](_0x6a24d3['query'],_0x8ad84[_0xa542('0x42')]),_0x5484a7);if(_0x6a24d3[_0xa542('0x43')][_0xa542('0x4e')]){_0x350099[_0xa542('0x4c')]=_[_0xa542('0x4f')](_0x350099['where'],{'$or':_['map'](_0x5484a7,function(_0xd176b4){if(_0xd176b4[_0xa542('0x3e')]!==_0xa542('0x50')){var _0x3f2e88={};_0x3f2e88[_0xd176b4['name']]={'$like':'%'+_0x6a24d3['query'][_0xa542('0x4e')]+'%'};return _0x3f2e88;}})});}_0x350099=_['merge']({},_0x350099,_0x6a24d3['options']);var _0x19ce41={'where':_0x350099[_0xa542('0x4c')]};return db[_0xa542('0x3b')][_0xa542('0x2f')](_0x19ce41)[_0xa542('0x37')](function(_0x2ba74c){_0x2779be[_0xa542('0x2f')]=_0x2ba74c;if(_0x6a24d3['query'][_0xa542('0x51')]){_0x350099[_0xa542('0x52')]=[{'all':!![]}];}return db[_0xa542('0x3b')][_0xa542('0x53')](_0x350099);})['then'](function(_0x7fcc5){_0x2779be[_0xa542('0x54')]=_0x7fcc5;return _0x2779be;})[_0xa542('0x37')](respondWithFilteredResult(_0x262678,_0x350099))[_0xa542('0x2a')](handleError(_0x262678,null));};exports[_0xa542('0x55')]=function(_0x3bfb0e,_0x23e903){var _0xf3bc9f={'raw':!![],'where':{'id':_0x3bfb0e[_0xa542('0x56')]['id']}},_0x556a37={};_0x556a37[_0xa542('0x40')]=_[_0xa542('0x41')](db[_0xa542('0x3b')][_0xa542('0x3c')]);_0x556a37[_0xa542('0x43')]=_['keys'](_0x3bfb0e[_0xa542('0x43')]);_0x556a37[_0xa542('0x42')]=_[_0xa542('0x44')](_0x556a37[_0xa542('0x40')],_0x556a37[_0xa542('0x43')]);_0xf3bc9f[_0xa542('0x46')]=_['intersection'](_0x556a37[_0xa542('0x40')],qs[_0xa542('0x45')](_0x3bfb0e[_0xa542('0x43')][_0xa542('0x45')]));_0xf3bc9f[_0xa542('0x46')]=_0xf3bc9f[_0xa542('0x46')][_0xa542('0x47')]?_0xf3bc9f[_0xa542('0x46')]:_0x556a37[_0xa542('0x40')];if(_0x3bfb0e[_0xa542('0x43')][_0xa542('0x51')]){_0xf3bc9f['include']=[{'all':!![]}];}_0xf3bc9f=_[_0xa542('0x4f')]({},_0xf3bc9f,_0x3bfb0e[_0xa542('0x57')]);return db[_0xa542('0x3b')][_0xa542('0x58')](_0xf3bc9f)[_0xa542('0x37')](handleEntityNotFound(_0x23e903,null))[_0xa542('0x37')](respondWithResult(_0x23e903,null))[_0xa542('0x2a')](handleError(_0x23e903,null));};exports[_0xa542('0x59')]=function(_0xc6a067,_0x5d42e6){return db[_0xa542('0x3b')][_0xa542('0x59')](_0xc6a067[_0xa542('0x5a')],{})[_0xa542('0x37')](respondWithResult(_0x5d42e6,0xc9))[_0xa542('0x2a')](handleError(_0x5d42e6,null));};exports[_0xa542('0x36')]=function(_0x15c023,_0x1b3bdb){if(_0x15c023[_0xa542('0x5a')]['id']){delete _0x15c023[_0xa542('0x5a')]['id'];}return db['SmsMessage'][_0xa542('0x58')]({'where':{'id':_0x15c023['params']['id']}})[_0xa542('0x37')](handleEntityNotFound(_0x1b3bdb,null))[_0xa542('0x37')](saveUpdates(_0x15c023['body'],null))[_0xa542('0x37')](respondWithResult(_0x1b3bdb,null))[_0xa542('0x2a')](handleError(_0x1b3bdb,null));};exports['destroy']=function(_0x2ba425,_0x39af23){return db['SmsMessage']['find']({'where':{'id':_0x2ba425[_0xa542('0x56')]['id']}})[_0xa542('0x37')](handleEntityNotFound(_0x39af23,null))[_0xa542('0x37')](removeEntity(_0x39af23,null))['catch'](handleError(_0x39af23,null));};exports['describe']=function(_0x5a620c,_0x384f2c){return db[_0xa542('0x3b')][_0xa542('0x5b')]()[_0xa542('0x37')](respondWithResult(_0x384f2c,null))[_0xa542('0x2a')](handleError(_0x384f2c,null));};var interaction_log=require(_0xa542('0x14'))('sms-interactions');exports[_0xa542('0x5c')]=function(_0x29be38,_0x22a0c0,_0x509138){var _0x230aae={'agent':{},'channel':_0xa542('0x5d')};if(_0x29be38[_0xa542('0x5a')]['id']){delete _0x29be38[_0xa542('0x5a')]['id'];}_0x29be38[_0xa542('0x5a')][_0xa542('0x5e')]=!![];_0x29be38[_0xa542('0x5a')][_0xa542('0x5f')]=moment()[_0xa542('0x60')](_0xa542('0x61'));_0x29be38[_0xa542('0x5a')][_0xa542('0x62')]=_0x29be38[_0xa542('0x5a')][_0xa542('0x62')]||_0x29be38['user']['id'];_0x230aae[_0xa542('0x63')]['id']=_0x29be38[_0xa542('0x5a')][_0xa542('0x62')];return db[_0xa542('0x3b')][_0xa542('0x58')]({'where':{'id':_0x29be38[_0xa542('0x56')]['id'],'UserId':null}})[_0xa542('0x37')](handleEntityNotFound(_0x22a0c0,null))['then'](saveUpdates(_0x29be38['body'],null))[_0xa542('0x37')](function(_0xb7f91c){if(_0xb7f91c){_0x230aae[_0xa542('0x29')]=_0xb7f91c['get']({'plain':!![]});return db[_0xa542('0x64')]['find']({'where':{'id':_0xb7f91c[_0xa542('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x22a0c0,null))[_0xa542('0x37')](function(_0x1071de){if(_0x1071de){return _0x1071de[_0xa542('0x36')]({'UserId':_0x29be38[_0xa542('0x5a')]['UserId'],'read1stAt':_[_0xa542('0x66')](_0x1071de[_0xa542('0x67')])?moment()[_0xa542('0x60')](_0xa542('0x61')):undefined});}return null;})[_0xa542('0x37')](function(_0x2614ac){if(_0x2614ac){_0x230aae[_0xa542('0x68')]=_0x2614ac['get']({'plain':!![]});interaction_log[_0xa542('0x22')](_0xa542('0x69'),_0x29be38[_0xa542('0x6a')]['id'],_0x29be38[_0xa542('0x6a')][_0xa542('0x38')],_0x29be38['user'][_0xa542('0x6b')],_0x230aae[_0xa542('0x68')]['id'],_0x29be38[_0xa542('0x5a')]?JSON[_0xa542('0x6c')](_0x29be38[_0xa542('0x5a')]):_0xa542('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xa542('0x6e'),_0x230aae);}return null;})['then'](function(_0x2bc4cf){var _0x27e39f=_0xa542('0x6f')+_0x2bc4cf['message']['ContactId'];return db[_0xa542('0x70')][_0xa542('0x43')](_0x27e39f,{'type':db['Sequelize'][_0xa542('0x71')][_0xa542('0x72')],'raw':!![]})[_0xa542('0x37')](function(_0x486b5b){return _0x486b5b;});})[_0xa542('0x37')](function(_0x38bbbe){if(_0x38bbbe){_0x230aae[_0xa542('0x29')][_0xa542('0x73')]=_0x38bbbe[0x0];if(!_0x29be38[_0xa542('0x5a')][_0xa542('0x62')])return;return db['User'][_0xa542('0x58')]({'where':{'id':_0x29be38[_0xa542('0x5a')][_0xa542('0x62')],'role':_0xa542('0x63')},'attributes':['id','name',_0xa542('0x74'),_0xa542('0x75'),'internal'],'raw':!![]});}return null;})[_0xa542('0x37')](function(_0x329b14){if(!_0x329b14)return null;_0x230aae[_0xa542('0x29')][_0xa542('0x63')]=_0x329b14;return _0x230aae;})[_0xa542('0x37')](function(_0x220e8f){if(_0x220e8f){if(_0x29be38[_0xa542('0x5a')][_0xa542('0x76')]){_0x230aae['message'][_0xa542('0x77')]=util[_0xa542('0x60')]('SIP/%s',_0x29be38[_0xa542('0x6a')][_0xa542('0x38')]);_0x230aae[_0xa542('0x29')]['channel']=_0x230aae[_0xa542('0x78')];_0x230aae[_0xa542('0x29')][_0xa542('0x79')]=_0x230aae['channel'];_0x230aae[_0xa542('0x29')]['event']=_0xa542('0x5c');return respondWithRpcPromise(_0xa542('0x7a'),_0xa542('0x7a'),{'event':_0xa542('0x7b'),'message':_0x230aae[_0xa542('0x29')]},client9002)['then'](function(){return _0x230aae;});}return _0x230aae;}return null;})[_0xa542('0x37')](respondWithResult(_0x22a0c0,null))['catch'](handleError(_0x22a0c0,null));};var interaction_log=require(_0xa542('0x14'))(_0xa542('0x7c'));exports[_0xa542('0x34')]=function(_0xc8a6d5,_0x471c8f,_0x1632cc){var _0x13eb04={'agent':{},'channel':'sms'};if(_0xc8a6d5['body']['id']){delete _0xc8a6d5[_0xa542('0x5a')]['id'];}_0xc8a6d5['body'][_0xa542('0x62')]=_0xc8a6d5[_0xa542('0x5a')]['UserId']||_0xc8a6d5[_0xa542('0x6a')]['id'];_0x13eb04[_0xa542('0x63')]['id']=_0xc8a6d5['body'][_0xa542('0x62')];return db['SmsMessage'][_0xa542('0x58')]({'where':{'id':_0xc8a6d5[_0xa542('0x56')]['id'],'UserId':null}})[_0xa542('0x37')](handleEntityNotFound(_0x471c8f,null))[_0xa542('0x37')](function(_0x3f270f){if(_0x3f270f){_0x13eb04['message']=_0x3f270f['get']({'plain':!![]});return db[_0xa542('0x64')][_0xa542('0x58')]({'where':{'id':_0x3f270f[_0xa542('0x65')]}});}return null;})[_0xa542('0x37')](handleEntityNotFound(_0x471c8f,null))[_0xa542('0x37')](function(_0x2f89c6){if(_0x2f89c6){_0x13eb04['interaction']=_0x2f89c6['get']({'plain':!![]});interaction_log[_0xa542('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc8a6d5[_0xa542('0x6a')]['id'],_0xc8a6d5['user'][_0xa542('0x38')],_0xc8a6d5[_0xa542('0x6a')]['role'],_0x13eb04['interaction']['id'],_0xc8a6d5[_0xa542('0x5a')]?JSON[_0xa542('0x6c')](_0xc8a6d5[_0xa542('0x5a')]):'null');return respondWithRpcPromise(_0xa542('0x7d'),_0xa542('0x7e'),_0x13eb04);}return null;})['then'](function(_0x5c44a6){var _0x35cd8e=_0xa542('0x6f')+_0x5c44a6['message'][_0xa542('0x7f')];return db[_0xa542('0x70')][_0xa542('0x43')](_0x35cd8e,{'type':db[_0xa542('0x80')][_0xa542('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x5ece7d){return _0x5ece7d;});})[_0xa542('0x37')](function(_0x4d4941){if(_0x4d4941){_0x13eb04[_0xa542('0x29')][_0xa542('0x73')]=_0x4d4941[0x0];if(!_0xc8a6d5['body'][_0xa542('0x62')])return;return db[_0xa542('0x81')][_0xa542('0x58')]({'where':{'id':_0xc8a6d5[_0xa542('0x5a')][_0xa542('0x62')],'role':_0xa542('0x63')},'attributes':['id','name',_0xa542('0x74'),_0xa542('0x75'),_0xa542('0x82')],'raw':!![]});}return null;})[_0xa542('0x37')](function(_0x4e13cd){if(!_0x4e13cd)return null;_0x13eb04[_0xa542('0x29')][_0xa542('0x63')]=_0x4e13cd;return _0x13eb04;})['then'](function(_0x10b679){if(_0x10b679){_0x10b679[_0xa542('0x29')][_0xa542('0x77')]=util[_0xa542('0x60')](_0xa542('0x83'),_0xc8a6d5[_0xa542('0x6a')][_0xa542('0x38')]);_0x10b679[_0xa542('0x29')]['channel']=_0x13eb04['channel'];_0x10b679[_0xa542('0x29')][_0xa542('0x79')]=_0x13eb04[_0xa542('0x78')];_0x10b679[_0xa542('0x29')][_0xa542('0x84')]=_0xa542('0x34');respondWithRpcPromise(_0xa542('0x7a'),_0xa542('0x7a'),{'event':'rejectmessage','message':_0x10b679[_0xa542('0x29')]},client9002);return _0x13eb04;}return null;})[_0xa542('0x37')](respondWithResult(_0x471c8f,null))['catch'](handleError(_0x471c8f,null));};exports[_0xa542('0x2b')]=function(_0x15057b,_0x5e76d9,_0x2dc3fd){if(_0x15057b['body']['id']){delete _0x15057b[_0xa542('0x5a')]['id'];}var _0x2c7148;return db['SmsMessage'][_0xa542('0x58')]({'where':{'id':_0x15057b[_0xa542('0x56')]['id']}})[_0xa542('0x37')](handleEntityNotFound(_0x5e76d9,null))[_0xa542('0x37')](function(_0x1ba229){if(_0x1ba229){_0x2c7148=_0x1ba229;return db[_0xa542('0x85')][_0xa542('0x58')]({'where':{'id':_0x1ba229[_0xa542('0x86')]}});}})[_0xa542('0x37')](handleEntityNotFound(_0x5e76d9,null))[_0xa542('0x37')](function(_0x3279de){if(_0x3279de){logger[_0xa542('0x25')](_0xa542('0x26'),_0xa542('0x2b'),'received\x20delivery\x20report\x20from',_0x3279de[_0xa542('0x3e')],util['inspect'](_0x15057b[_0xa542('0x5a')],{'showHidden':![],'depth':null}));switch(_0x3279de[_0xa542('0x3e')]){case _0xa542('0x87'):if(_0x15057b[_0xa542('0x5a')]['MessageSid']&&_0x15057b[_0xa542('0x5a')]['MessageSid']===_0x2c7148[_0xa542('0x88')]){return _0x2c7148[_0xa542('0x36')]({'read':!![]});}else{logger[_0xa542('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa542('0x2b'),_0xa542('0x87'),util[_0xa542('0x89')](_0x15057b[_0xa542('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa542('0x8a'):if(_0x15057b[_0xa542('0x5a')][_0xa542('0x8b')]&&_0x15057b[_0xa542('0x5a')][_0xa542('0x8b')]===_0x2c7148[_0xa542('0x88')]&&_[_0xa542('0x8c')]([_0xa542('0x8d'),'delivered'],_0x15057b[_0xa542('0x5a')][_0xa542('0x8e')])>=0x0){return _0x2c7148['update']({'read':!![]});}else{logger[_0xa542('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa542('0x8f'),util[_0xa542('0x89')](_0x15057b[_0xa542('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa542('0x90'):var _0x4d9b34=_0x15057b[_0xa542('0x5a')]['results'][0x0];if(_0x4d9b34['status']['groupName']===_0xa542('0x91')){return _0x2c7148[_0xa542('0x36')]({'read':!![]});}else{logger['error'](_0xa542('0x92'),_0xa542('0x2b'),_0xa542('0x90'),util[_0xa542('0x89')](_0x15057b[_0xa542('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2c7148;}})[_0xa542('0x37')](respondWithResult(_0x5e76d9,null))[_0xa542('0x2a')](handleError(_0x5e76d9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6acdfc6..9d58f72 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 _0xda93=['remove','emit','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda93,0x1bb));var _0x3da9=function(_0x266e58,_0x1cf1ff){_0x266e58=_0x266e58-0x0;var _0x3e76e0=_0xda93[_0x266e58];return _0x3e76e0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x3da9('0x0'))['db'][_0x3da9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3da9('0x2')](0x0);var events={'afterCreate':_0x3da9('0x3'),'afterUpdate':_0x3da9('0x4'),'afterDestroy':_0x3da9('0x5')};function emitEvent(_0x194836){return function(_0x6c8edd,_0x5ba917,_0x2b7a02){SmsMessageEvents['emit'](_0x194836+':'+_0x6c8edd['id'],_0x6c8edd);SmsMessageEvents[_0x3da9('0x6')](_0x194836,_0x6c8edd);_0x2b7a02(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x3da9('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4f07=['save','remove','emit','hook','events','SmsMessage','setMaxListeners'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0x4f07,0xf2));var _0x74f0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4f07[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x74f0('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x74f0('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x74f0('0x2')](0x0);var events={'afterCreate':_0x74f0('0x3'),'afterUpdate':'update','afterDestroy':_0x74f0('0x4')};function emitEvent(_0x4daa5b){return function(_0x5062d4,_0x3f3591,_0x345335){SmsMessageEvents[_0x74f0('0x5')](_0x4daa5b+':'+_0x5062d4['id'],_0x5062d4);SmsMessageEvents[_0x74f0('0x5')](_0x4daa5b,_0x5062d4);_0x345335(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x74f0('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 5fac7ae..ea53871 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 _0x22a5=['sender','login?username=','&password=','GET','split','sms','POST','user_key','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','read','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','format','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','base64','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','secret','find','SmsAccountId','type','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x22a5,0xc1));var _0x522a=function(_0x56714d,_0x3946a6){_0x56714d=_0x56714d-0x0;var _0x553b58=_0x22a5[_0x56714d];return _0x553b58;};'use strict';var _=require(_0x522a('0x0'));var util=require(_0x522a('0x1'));var logger=require(_0x522a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x522a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x522a('0x4'));var config=require(_0x522a('0x5'));var attributes=require(_0x522a('0x6'));module['exports']=function(_0x251710,_0x5aeb63){return _0x251710[_0x522a('0x7')](_0x522a('0x8'),attributes,{'tableName':_0x522a('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x522a('0xa')]},{'name':_0x522a('0xb'),'fields':[_0x522a('0xc')],'type':_0x522a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1094b5,_0x37bbf8,_0x4d2b5d){var _0x1c2a57=_0x251710[_0x522a('0xe')];var _0x15de24=_0x1094b5['get']({'plain':!![]});if(_0x15de24['direction']['toLowerCase']()==='in'||_0x15de24[_0x522a('0xf')][_0x522a('0x10')]()===_0x522a('0x11')&&!_0x15de24['secret']&&!_[_0x522a('0x12')](_0x15de24[_0x522a('0x13')])&&!_[_0x522a('0x12')](_0x15de24[_0x522a('0x14')])){_0x1c2a57['SmsInteraction'][_0x522a('0x15')]({'where':{'id':_0x15de24[_0x522a('0x14')]}})[_0x522a('0x16')](function(_0x4f4bc7){if(_0x4f4bc7){_0x4f4bc7[_0x522a('0x17')]({'lastMsgAt':_0x15de24[_0x522a('0x18')],'lastMsgDirection':_0x15de24[_0x522a('0xf')]['toLowerCase']()});}})[_0x522a('0x19')](function(_0x5c4ae7){console[_0x522a('0x1a')](_0x5c4ae7);});}if(_0x15de24['direction']===_0x522a('0x11')&&!_0x15de24[_0x522a('0x1b')]){var _0xbb81f5;_0x1c2a57['SmsAccount'][_0x522a('0x1c')]({'where':{'id':_0x15de24[_0x522a('0x1d')]},'raw':!![]})[_0x522a('0x16')](function(_0x4064f6){_0xbb81f5=_0x4064f6;if(_0xbb81f5&&_0xbb81f5[_0x522a('0x1e')]){switch(_0xbb81f5[_0x522a('0x1e')]){case'twilio':var _0x22f6b3=require('twilio');if(_0xbb81f5[_0x522a('0x1f')]&&_0xbb81f5['authToken']&&_0xbb81f5[_0x522a('0x20')]){var _0x2b0f2f=new _0x22f6b3(_0xbb81f5['accountSid'],_0xbb81f5[_0x522a('0x21')]);_0x2b0f2f[_0x522a('0x22')][_0x522a('0x23')]({'body':_0x15de24[_0x522a('0xc')],'to':_0x15de24[_0x522a('0x20')],'from':_0xbb81f5[_0x522a('0x20')],'statusCallback':_0xbb81f5[_0x522a('0x24')]+_0x522a('0x25')+_0x15de24['id']+_0x522a('0x26')+_0xbb81f5[_0x522a('0x27')]})['then'](function(_0x2db84b){if(_0x2db84b['sid']){return _0x1094b5[_0x522a('0x17')]({'messageId':_0x2db84b['sid']});}})[_0x522a('0x19')](function(_0x575a54){logger[_0x522a('0x1a')](_0x522a('0x28'),'afterCreate',_0x522a('0x29'),util[_0x522a('0x2a')](_0x575a54,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x29'),_0x522a('0x2c'));}break;case _0x522a('0x2d'):var _0x123e22='https://api.skebby.it/API/v1.0/REST/';if(_0xbb81f5[_0x522a('0x2e')]&&_0xbb81f5[_0x522a('0x2f')]){var _0x3f91de={'recipient':[_0x15de24[_0x522a('0x20')]],'message':_0x15de24['body'],'message_type':_0xbb81f5[_0x522a('0x30')]};if(_0xbb81f5[_0x522a('0x30')]&&_0xbb81f5['smsMethod']!=='SI'){_0x3f91de[_0x522a('0x31')]=_0xbb81f5[_0x522a('0x20')];}var _0x52bd22={'url':_0x123e22+_0x522a('0x32')+_0xbb81f5[_0x522a('0x2e')]+_0x522a('0x33')+_0xbb81f5['password'],'method':_0x522a('0x34')};rp(_0x52bd22)[_0x522a('0x16')](function(_0x4922ed){var _0x471356=_0x4922ed[_0x522a('0x35')](';');var _0x2b1e3e={'user_key':_0x471356[0x0],'session_key':_0x471356[0x1]};_0x52bd22={'url':_0x123e22+_0x522a('0x36'),'method':_0x522a('0x37'),'headers':{'user_key':_0x2b1e3e[_0x522a('0x38')],'Session_key':_0x2b1e3e['session_key']},'json':!![],'body':_0x3f91de};return rp(_0x52bd22);})['then'](function(_0x110857){if(_0x110857['total_sent']>=0x1){var _0x2255fb={'messageId':_0x110857[_0x522a('0x39')]};if(_0xbb81f5[_0x522a('0x30')]!=='GP'||!_0xbb81f5[_0x522a('0x3a')]){_0x2255fb['read']=!![];}return _0x1094b5[_0x522a('0x17')](_0x2255fb);}else{return logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x2d'),util[_0x522a('0x2a')](_0x110857,{'showHidden':![],'depth':null}));}})[_0x522a('0x19')](function(_0x10e6b1){return logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),'skebby',util['inspect'](_0x10e6b1,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x2d'),_0x522a('0x3b'));}break;case _0x522a('0x3c'):if(_0xbb81f5['authToken']){var _0x1e916e={'recipient':_0x15de24[_0x522a('0x20')],'message':_0x15de24[_0x522a('0xc')],'sender':_0xbb81f5[_0x522a('0x3d')]||_0xbb81f5[_0x522a('0x20')],'authorization':_0xbb81f5[_0x522a('0x21')]};var _0x37bbf8={'method':_0x522a('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1e916e,'json':!![]};rp(_0x37bbf8)[_0x522a('0x16')](function(_0x3221da){var _0x1ed9c4={'messageId':_0x3221da[_0x522a('0x3e')]};if(!_0xbb81f5['deliveryReport']){_0x1ed9c4[_0x522a('0x3f')]=!![];}return _0x1094b5[_0x522a('0x17')](_0x1ed9c4);})[_0x522a('0x19')](function(_0x572264){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),'connectel',util[_0x522a('0x2a')](_0x572264,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0xbb81f5['username']&&_0xbb81f5['password']){var _0x1e916e={'messages':[{'source':'xCALLY\x20Motion','to':_0x15de24[_0x522a('0x20')],'body':_0x15de24[_0x522a('0xc')],'from':_0xbb81f5[_0x522a('0x3d')]||_0xbb81f5['phone']}]};var _0xd453e5=util['format'](_0x522a('0x40'),_0xbb81f5['username'],_0xbb81f5['password']);var _0x37bbf8={'method':_0x522a('0x37'),'uri':_0x522a('0x41'),'body':_0x1e916e,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xd453e5)[_0x522a('0x42')]('base64'))},'json':!![]};rp(_0x37bbf8)[_0x522a('0x16')](function(_0x489f98){if(_0x489f98[_0x522a('0x43')]>=0xc8&&_0x489f98['http_code']<=0xce){if(_0x489f98[_0x522a('0x44')]&&_0x489f98['data'][_0x522a('0x45')]>0x0){var _0x274185=_[_0x522a('0x46')](_0x489f98[_0x522a('0x44')][_0x522a('0x22')]);var _0xefa334={'messageId':_0x274185[_0x522a('0x47')]};if(!_0xbb81f5[_0x522a('0x3a')]){_0xefa334[_0x522a('0x3f')]=!![];}return _0x1094b5[_0x522a('0x17')](_0xefa334);}else{logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x48'),util['inspect'](_0x489f98,{'showHidden':![],'depth':null}));}}else{logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x48'),util['inspect'](_0x489f98,{'showHidden':![],'depth':null}));}})[_0x522a('0x19')](function(_0x19d815){logger['error'](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x48'),util[_0x522a('0x2a')](_0x19d815,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x522a('0x28'),_0x522a('0x2b'),'clickSend',_0x522a('0x3b'));}break;case _0x522a('0x49'):if(_0xbb81f5[_0x522a('0x4a')]&&_0xbb81f5[_0x522a('0x21')]){var _0x1e916e={'dst':_0x15de24[_0x522a('0x20')],'text':_0x15de24[_0x522a('0xc')],'src':_0xbb81f5['senderString']||_0xbb81f5[_0x522a('0x20')],'url':_0xbb81f5[_0x522a('0x24')]+_0x522a('0x25')+_0x15de24['id']+_0x522a('0x26')+_0xbb81f5[_0x522a('0x27')]};var _0xd453e5=util[_0x522a('0x4b')]('%s:%s',_0xbb81f5[_0x522a('0x4a')],_0xbb81f5[_0x522a('0x21')]);var _0x37bbf8={'method':_0x522a('0x37'),'uri':util[_0x522a('0x4b')](_0x522a('0x4c'),_0xbb81f5[_0x522a('0x4a')]),'body':_0x1e916e,'headers':{'Authorization':util['format'](_0x522a('0x4d'),new Buffer(_0xd453e5)['toString']('base64'))},'json':!![]};rp(_0x37bbf8)['then'](function(_0x1c27fc){var _0x58ae11={'messageId':_0x1c27fc[_0x522a('0x4e')][0x0]};return _0x1094b5[_0x522a('0x17')](_0x58ae11);})[_0x522a('0x19')](function(_0x53e710){logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x49'),util['inspect'](_0x53e710,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x49'),_0x522a('0x4f'));}break;case'infobip':if(_0xbb81f5['username']&&_0xbb81f5[_0x522a('0x2f')]){if(_0xbb81f5[_0x522a('0x50')]){var _0x1b7fbe={'method':_0x522a('0x37'),'uri':_0xbb81f5[_0x522a('0x50')]+'/auth/1/session','body':{'username':_0xbb81f5['username'],'password':_0xbb81f5[_0x522a('0x2f')]},'json':!![]};return rp(_0x1b7fbe)['then'](function(_0xaba511){var _0x4d9be9={'method':_0x522a('0x37'),'uri':_0xbb81f5[_0x522a('0x50')]+_0x522a('0x51'),'body':{'messages':[{'from':_0xbb81f5[_0x522a('0x20')],'destinations':[{'to':_0x15de24['phone']}],'text':_0x15de24[_0x522a('0xc')],'notifyUrl':_0xbb81f5[_0x522a('0x24')]+_0x522a('0x25')+_0x15de24['id']+_0x522a('0x26')+_0xbb81f5[_0x522a('0x27')],'notifyContentType':_0x522a('0x52'),'callbackData':_0xbb81f5[_0x522a('0x20')]+';'+_0x15de24[_0x522a('0xc')]}]},'headers':{'Authorization':_0x522a('0x53')+_0xaba511['token']},'json':!![]};return rp(_0x4d9be9)[_0x522a('0x16')](function(_0x2cb259){if(_0x2cb259[_0x522a('0x22')]){var _0x2c962b={'messageId':_0x2cb259[_0x522a('0x22')][0x0][_0x522a('0xa')]};if(!_0xbb81f5[_0x522a('0x3a')]){_0x2c962b[_0x522a('0x3f')]=!![];}return _0x1094b5[_0x522a('0x17')](_0x2c962b);}else{return logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),'infobip',util[_0x522a('0x2a')](_0x2cb259,{'showHidden':![],'depth':null}));}});})[_0x522a('0x19')](function(_0x7ff7b6){return logger['error'](_0x522a('0x28'),_0x522a('0x2b'),'infobip',util[_0x522a('0x2a')](_0x7ff7b6,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x522a('0x54'),_0x522a('0x55'));}}else{logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x54'),_0x522a('0x3b'));}break;case _0x522a('0x56'):var _0x5d48aa=require(_0x522a('0x57'));if(_0xbb81f5[_0x522a('0x58')]){var _0x33c7d4={};_0x33c7d4[_0x522a('0x59')]=_0xbb81f5['username'];_0x33c7d4[_0x522a('0x20')]=_0x15de24[_0x522a('0x20')];_0x33c7d4[_0x522a('0x31')]=_0xbb81f5['phone'];_0x33c7d4[_0x522a('0x5a')]=_0x15de24[_0x522a('0xc')];_0x33c7d4[_0x522a('0x5b')]=+new Date();var _0x65c4e='';var _0x226550='';var _0x243444=Object[_0x522a('0x5c')](_0x33c7d4);_0x243444[_0x522a('0x5d')]();for(var _0x9fc6fb=0x0;_0x9fc6fb<_0x243444[_0x522a('0x5e')];_0x9fc6fb++){if(_0x65c4e!=''){_0x65c4e+='&';}_0x65c4e+=_0x243444[_0x9fc6fb]+'='+encodeURIComponent(_0x33c7d4[_0x243444[_0x9fc6fb]]);_0x226550+=_0x33c7d4[_0x243444[_0x9fc6fb]];}_0x226550+=_0xbb81f5[_0x522a('0x58')];_0x226550=_0x5d48aa[_0x522a('0x5f')](_0x522a('0x60'))[_0x522a('0x17')](_0x226550)[_0x522a('0x61')]('hex');if(_0x65c4e!==''){_0x65c4e+='&';}_0x65c4e+=_0x522a('0x62')+_0x226550;var _0x52bd22={'method':_0x522a('0x34'),'uri':_0xbb81f5['baseUrl']+_0x522a('0x63')+_0x65c4e,'json':!![]};return rp(_0x52bd22)[_0x522a('0x16')](function(_0x2d1f31){var _0x5cfb74=Object[_0x522a('0x5c')](_0x2d1f31);if(_0x2d1f31[_0x5cfb74[0x0]][_0x522a('0x1a')]&&parseInt(_0x2d1f31[_0x5cfb74[0x0]]['error'])===0x0){var _0x28756c={'messageId':_0x2d1f31[_0x5cfb74[0x0]][_0x522a('0x64')]};if(!_0xbb81f5[_0x522a('0x3a')]){_0x28756c['read']=!![];}return _0x1094b5['update'](_0x28756c);}else{return logger['error'](_0x522a('0x28'),_0x522a('0x2b'),'csc',util[_0x522a('0x2a')](_0x2d1f31['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x440cf5){return logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x56'),util['inspect'](_0x440cf5,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')](_0x522a('0x28'),'afterCreate',_0x522a('0x56'),'Missing\x20parameters:\x20apiKey');}break;case _0x522a('0x65'):if(_0xbb81f5[_0x522a('0x58')]){var _0x975d16={'method':_0x522a('0x37'),'uri':_0x522a('0x66'),'headers':{'Authorization':_0xbb81f5[_0x522a('0x58')]},'body':{'content':_0x15de24[_0x522a('0xc')],'to':[_0x15de24[_0x522a('0x20')]],'from':_0xbb81f5[_0x522a('0x20')],'binary':![],'clientMessageId':_0x522a('0x67'),'charset':_0x522a('0x68')},'json':!![]};rp(_0x975d16)[_0x522a('0x16')](function(_0x30e39a){if(!_0x30e39a[_0x522a('0x1a')]){var _0x146e24={'messageId':_0x30e39a[_0x522a('0x22')][0x0][_0x522a('0x69')]};if(!_0xbb81f5[_0x522a('0x3a')]){_0x146e24[_0x522a('0x3f')]=!![];}return _0x1094b5['update'](_0x146e24);}else{return logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x65'),util[_0x522a('0x2a')](_0x30e39a[_0x522a('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5504bc){return logger['error'](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x65'),util['inspect'](_0x5504bc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x65'),_0x522a('0x6a'));}break;case _0x522a('0x6b'):if(_0xbb81f5['username']&&_0xbb81f5[_0x522a('0x2f')]){var _0xd453e5=util[_0x522a('0x4b')](_0x522a('0x40'),_0xbb81f5[_0x522a('0x2e')],_0xbb81f5[_0x522a('0x2f')]);var _0x37bbf8={'method':_0x522a('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xbb81f5[_0x522a('0x6c')]+_0x522a('0x6d'),'body':{'to':[_0x15de24[_0x522a('0x20')]],'text':_0x15de24[_0x522a('0xc')],'from':_0xbb81f5['phone'],'applicationId':_0xbb81f5['applicationId']},'headers':{'Authorization':util[_0x522a('0x4b')]('Basic\x20%s',new Buffer(_0xd453e5)[_0x522a('0x42')](_0x522a('0x6e')))},'json':!![]};rp(_0x37bbf8)[_0x522a('0x16')](function(_0x2484a6){if(_0x2484a6['id']){var _0x2b492b={'messageId':_0x2484a6['id']};return _0x1094b5[_0x522a('0x17')](_0x2b492b);}else{logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x6b'),util[_0x522a('0x2a')](_0x2484a6,{'showHidden':![],'depth':null}));}})[_0x522a('0x19')](function(_0x33a066){logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x522a('0x2a')](_0x33a066,{'showHidden':![],'depth':null}));});}else{logger[_0x522a('0x1a')](_0x522a('0x28'),'afterCreate',_0x522a('0x6b'),_0x522a('0x3b'));}break;case'intelepeer':if(_0xbb81f5[_0x522a('0x58')]){var _0x54d5f8={};var _0x52bd22={'method':_0x522a('0x37'),'uri':_0x522a('0x6f'),'headers':{'Authorization':_0x522a('0x70')+_0xbb81f5['apiKey'],'Content-Type':'application/json'},'body':{'from':_0xbb81f5['phone'],'to':_0x15de24[_0x522a('0x20')],'text':_0x15de24['body']},'json':!![]};return rp(_0x52bd22)[_0x522a('0x16')](function(_0x2e2038){if(_0x2e2038[_0x522a('0x71')]==0xca){_0x54d5f8[_0x522a('0x72')]=_0x2e2038;var _0x150ff3={'method':_0x522a('0x37'),'uri':_0x522a('0x73'),'headers':{'Authorization':_0x522a('0x70')+_0xbb81f5[_0x522a('0x58')],'Content-Type':_0x522a('0x52')},'body':{'refid':_0x54d5f8[_0x522a('0x72')][_0x522a('0x74')]},'json':!![]};return rp(_0x150ff3)[_0x522a('0x16')](function(_0x1fad98){_0x54d5f8['status']=_0x1fad98;var _0xe5835e={'messageId':_0x54d5f8[_0x522a('0x72')][_0x522a('0x74')],'read':!![]};return _0x1094b5[_0x522a('0x17')](_0xe5835e);});}else{return logger[_0x522a('0x1a')](_0x522a('0x28'),_0x522a('0x2b'),_0x522a('0x75'),util['inspect'](_0x2e2038,{'showHidden':![],'depth':null}));}})[_0x522a('0x19')](function(_0x32bc65){return logger[_0x522a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x522a('0x2b'),_0x522a('0x75'),util[_0x522a('0x2a')](_0x32bc65,{'showHidden':![],'depth':null}));});}else{return logger[_0x522a('0x1a')](_0x522a('0x28'),'afterCreate',_0x522a('0x75'),_0x522a('0x76'));}break;}}})[_0x522a('0x77')](function(){_0x4d2b5d();});}else{_0x4d2b5d();}}},'charset':_0x522a('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7ac6=['clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','csc','crypto','apiKey','text','keys','length','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','find','SmsAccountId','then','twilio','authToken','messages','create','phone','remote','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','http_code','data','queued_count','head','message_id'];(function(_0x4cb97d,_0x5e2050){var _0x2925e7=function(_0x2fca50){while(--_0x2fca50){_0x4cb97d['push'](_0x4cb97d['shift']());}};_0x2925e7(++_0x5e2050);}(_0x7ac6,0xa3));var _0x67ac=function(_0x54f8c0,_0x40ecb1){_0x54f8c0=_0x54f8c0-0x0;var _0x5d5452=_0x7ac6[_0x54f8c0];return _0x5d5452;};'use strict';var _=require(_0x67ac('0x0'));var util=require('util');var logger=require(_0x67ac('0x1'))(_0x67ac('0x2'));var moment=require(_0x67ac('0x3'));var BPromise=require(_0x67ac('0x4'));var rp=require(_0x67ac('0x5'));var fs=require('fs');var path=require(_0x67ac('0x6'));var rimraf=require(_0x67ac('0x7'));var config=require('../../config/environment');var attributes=require(_0x67ac('0x8'));module[_0x67ac('0x9')]=function(_0xa33e6b,_0x1eda36){return _0xa33e6b[_0x67ac('0xa')](_0x67ac('0xb'),attributes,{'tableName':_0x67ac('0xc'),'paranoid':![],'indexes':[{'name':_0x67ac('0xd'),'fields':[_0x67ac('0xd')]},{'name':'fti_sms_messages','fields':[_0x67ac('0xe')],'type':_0x67ac('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5378ac,_0x4692bb,_0x1091ab){var _0x4e2fd5=_0xa33e6b[_0x67ac('0x10')];var _0x1cf8db=_0x5378ac[_0x67ac('0x11')]({'plain':!![]});if(_0x1cf8db[_0x67ac('0x12')][_0x67ac('0x13')]()==='in'||_0x1cf8db[_0x67ac('0x12')][_0x67ac('0x13')]()===_0x67ac('0x14')&&!_0x1cf8db[_0x67ac('0x15')]&&!_[_0x67ac('0x16')](_0x1cf8db[_0x67ac('0x17')])&&!_['isNil'](_0x1cf8db['SmsInteractionId'])){_0x4e2fd5[_0x67ac('0x18')][_0x67ac('0x19')]({'where':{'id':_0x1cf8db[_0x67ac('0x1a')]}})['then'](function(_0x12475a){if(_0x12475a){_0x12475a[_0x67ac('0x1b')]({'lastMsgAt':_0x1cf8db[_0x67ac('0x1c')],'lastMsgDirection':_0x1cf8db[_0x67ac('0x12')]['toLowerCase']()});}})[_0x67ac('0x1d')](function(_0x14090b){console[_0x67ac('0x1e')](_0x14090b);});}if(_0x1cf8db[_0x67ac('0x12')]==='out'&&!_0x1cf8db[_0x67ac('0x15')]){var _0xbb02a5;_0x4e2fd5['SmsAccount'][_0x67ac('0x1f')]({'where':{'id':_0x1cf8db[_0x67ac('0x20')]},'raw':!![]})[_0x67ac('0x21')](function(_0x290f8c){_0xbb02a5=_0x290f8c;if(_0xbb02a5&&_0xbb02a5['type']){switch(_0xbb02a5['type']){case _0x67ac('0x22'):var _0x2ff979=require(_0x67ac('0x22'));if(_0xbb02a5['accountSid']&&_0xbb02a5['authToken']&&_0xbb02a5['phone']){var _0x457292=new _0x2ff979(_0xbb02a5['accountSid'],_0xbb02a5[_0x67ac('0x23')]);_0x457292[_0x67ac('0x24')][_0x67ac('0x25')]({'body':_0x1cf8db['body'],'to':_0x1cf8db[_0x67ac('0x26')],'from':_0xbb02a5['phone'],'statusCallback':_0xbb02a5[_0x67ac('0x27')]+'/api/sms/messages/'+_0x1cf8db['id']+_0x67ac('0x28')+_0xbb02a5[_0x67ac('0x29')]})[_0x67ac('0x21')](function(_0x42aaa2){if(_0x42aaa2[_0x67ac('0x2a')]){return _0x5378ac[_0x67ac('0x1b')]({'messageId':_0x42aaa2[_0x67ac('0x2a')]});}})[_0x67ac('0x1d')](function(_0xe4a13e){logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x22'),util[_0x67ac('0x2c')](_0xe4a13e,{'showHidden':![],'depth':null}));});}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x22'),_0x67ac('0x2e'));}break;case _0x67ac('0x2f'):var _0x1713af=_0x67ac('0x30');if(_0xbb02a5['username']&&_0xbb02a5[_0x67ac('0x31')]){var _0x30e0ac={'recipient':[_0x1cf8db[_0x67ac('0x26')]],'message':_0x1cf8db[_0x67ac('0xe')],'message_type':_0xbb02a5[_0x67ac('0x32')]};if(_0xbb02a5[_0x67ac('0x32')]&&_0xbb02a5[_0x67ac('0x32')]!=='SI'){_0x30e0ac[_0x67ac('0x33')]=_0xbb02a5[_0x67ac('0x26')];}var _0x4a0ff9={'url':_0x1713af+_0x67ac('0x34')+_0xbb02a5[_0x67ac('0x35')]+_0x67ac('0x36')+_0xbb02a5[_0x67ac('0x31')],'method':'GET'};rp(_0x4a0ff9)[_0x67ac('0x21')](function(_0x9929e4){var _0x26a025=_0x9929e4['split'](';');var _0x26985f={'user_key':_0x26a025[0x0],'session_key':_0x26a025[0x1]};_0x4a0ff9={'url':_0x1713af+_0x67ac('0x37'),'method':_0x67ac('0x38'),'headers':{'user_key':_0x26985f[_0x67ac('0x39')],'Session_key':_0x26985f[_0x67ac('0x3a')]},'json':!![],'body':_0x30e0ac};return rp(_0x4a0ff9);})[_0x67ac('0x21')](function(_0x1b666a){if(_0x1b666a[_0x67ac('0x3b')]>=0x1){var _0x575a23={'messageId':_0x1b666a[_0x67ac('0x3c')]};if(_0xbb02a5[_0x67ac('0x32')]!=='GP'||!_0xbb02a5[_0x67ac('0x3d')]){_0x575a23[_0x67ac('0x3e')]=!![];}return _0x5378ac[_0x67ac('0x1b')](_0x575a23);}else{return logger['error'](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x2f'),util[_0x67ac('0x2c')](_0x1b666a,{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x20a8a1){return logger[_0x67ac('0x1e')](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x2f'),util['inspect'](_0x20a8a1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x2f'),_0x67ac('0x3f'));}break;case _0x67ac('0x40'):if(_0xbb02a5['authToken']){var _0x150fbc={'recipient':_0x1cf8db[_0x67ac('0x26')],'message':_0x1cf8db[_0x67ac('0xe')],'sender':_0xbb02a5[_0x67ac('0x41')]||_0xbb02a5[_0x67ac('0x26')],'authorization':_0xbb02a5[_0x67ac('0x23')]};var _0x4692bb={'method':_0x67ac('0x38'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x150fbc,'json':!![]};rp(_0x4692bb)['then'](function(_0x1730e1){var _0x1f3949={'messageId':_0x1730e1[_0x67ac('0x42')]};if(!_0xbb02a5['deliveryReport']){_0x1f3949[_0x67ac('0x3e')]=!![];}return _0x5378ac[_0x67ac('0x1b')](_0x1f3949);})[_0x67ac('0x1d')](function(_0x2c67c2){logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),'connectel',util['inspect'](_0x2c67c2,{'showHidden':![],'depth':null}));});}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x67ac('0x43'):if(_0xbb02a5[_0x67ac('0x35')]&&_0xbb02a5[_0x67ac('0x31')]){var _0x150fbc={'messages':[{'source':_0x67ac('0x44'),'to':_0x1cf8db['phone'],'body':_0x1cf8db[_0x67ac('0xe')],'from':_0xbb02a5[_0x67ac('0x41')]||_0xbb02a5[_0x67ac('0x26')]}]};var _0x51a2c6=util['format'](_0x67ac('0x45'),_0xbb02a5['username'],_0xbb02a5['password']);var _0x4692bb={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x150fbc,'headers':{'Authorization':util[_0x67ac('0x46')](_0x67ac('0x47'),new Buffer(_0x51a2c6)['toString']('base64'))},'json':!![]};rp(_0x4692bb)[_0x67ac('0x21')](function(_0x3228fb){if(_0x3228fb[_0x67ac('0x48')]>=0xc8&&_0x3228fb[_0x67ac('0x48')]<=0xce){if(_0x3228fb[_0x67ac('0x49')]&&_0x3228fb[_0x67ac('0x49')][_0x67ac('0x4a')]>0x0){var _0xdd7ed9=_[_0x67ac('0x4b')](_0x3228fb['data'][_0x67ac('0x24')]);var _0x493ea8={'messageId':_0xdd7ed9[_0x67ac('0x4c')]};if(!_0xbb02a5[_0x67ac('0x3d')]){_0x493ea8[_0x67ac('0x3e')]=!![];}return _0x5378ac['update'](_0x493ea8);}else{logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x4d'),util[_0x67ac('0x2c')](_0x3228fb,{'showHidden':![],'depth':null}));}}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x4d'),util['inspect'](_0x3228fb,{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x1408a3){logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x67ac('0x2c')](_0x1408a3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x67ac('0x2d'),_0x67ac('0x2b'),'clickSend',_0x67ac('0x3f'));}break;case _0x67ac('0x4e'):if(_0xbb02a5[_0x67ac('0x4f')]&&_0xbb02a5[_0x67ac('0x23')]){var _0x150fbc={'dst':_0x1cf8db[_0x67ac('0x26')],'text':_0x1cf8db['body'],'src':_0xbb02a5[_0x67ac('0x41')]||_0xbb02a5[_0x67ac('0x26')],'url':_0xbb02a5[_0x67ac('0x27')]+_0x67ac('0x50')+_0x1cf8db['id']+_0x67ac('0x28')+_0xbb02a5['token']};var _0x51a2c6=util['format']('%s:%s',_0xbb02a5[_0x67ac('0x4f')],_0xbb02a5[_0x67ac('0x23')]);var _0x4692bb={'method':_0x67ac('0x38'),'uri':util['format'](_0x67ac('0x51'),_0xbb02a5[_0x67ac('0x4f')]),'body':_0x150fbc,'headers':{'Authorization':util[_0x67ac('0x46')]('Basic\x20%s',new Buffer(_0x51a2c6)[_0x67ac('0x52')]('base64'))},'json':!![]};rp(_0x4692bb)[_0x67ac('0x21')](function(_0x4d58e1){var _0x4072b7={'messageId':_0x4d58e1['message_uuid'][0x0]};return _0x5378ac[_0x67ac('0x1b')](_0x4072b7);})[_0x67ac('0x1d')](function(_0x352f0a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x4e'),util[_0x67ac('0x2c')](_0x352f0a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x4e'),_0x67ac('0x53'));}break;case _0x67ac('0x54'):if(_0xbb02a5[_0x67ac('0x35')]&&_0xbb02a5[_0x67ac('0x31')]){if(_0xbb02a5[_0x67ac('0x55')]){var _0x16808c={'method':_0x67ac('0x38'),'uri':_0xbb02a5[_0x67ac('0x55')]+'/auth/1/session','body':{'username':_0xbb02a5[_0x67ac('0x35')],'password':_0xbb02a5['password']},'json':!![]};return rp(_0x16808c)['then'](function(_0x5a79d7){var _0x164740={'method':_0x67ac('0x38'),'uri':_0xbb02a5[_0x67ac('0x55')]+_0x67ac('0x56'),'body':{'messages':[{'from':_0xbb02a5[_0x67ac('0x26')],'destinations':[{'to':_0x1cf8db[_0x67ac('0x26')]}],'text':_0x1cf8db[_0x67ac('0xe')],'notifyUrl':_0xbb02a5[_0x67ac('0x27')]+_0x67ac('0x50')+_0x1cf8db['id']+_0x67ac('0x28')+_0xbb02a5[_0x67ac('0x29')],'notifyContentType':_0x67ac('0x57'),'callbackData':_0xbb02a5['phone']+';'+_0x1cf8db[_0x67ac('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x5a79d7[_0x67ac('0x29')]},'json':!![]};return rp(_0x164740)[_0x67ac('0x21')](function(_0x534947){if(_0x534947[_0x67ac('0x24')]){var _0xde7d74={'messageId':_0x534947['messages'][0x0][_0x67ac('0xd')]};if(!_0xbb02a5[_0x67ac('0x3d')]){_0xde7d74[_0x67ac('0x3e')]=!![];}return _0x5378ac[_0x67ac('0x1b')](_0xde7d74);}else{return logger['error'](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x54'),util[_0x67ac('0x2c')](_0x534947,{'showHidden':![],'depth':null}));}});})[_0x67ac('0x1d')](function(_0x43ae27){return logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x54'),util[_0x67ac('0x2c')](_0x43ae27,{'showHidden':![],'depth':null}));});}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x54'),_0x67ac('0x3f'));}break;case _0x67ac('0x58'):var _0x3dd215=require(_0x67ac('0x59'));if(_0xbb02a5[_0x67ac('0x5a')]){var _0x46b84a={};_0x46b84a['login']=_0xbb02a5[_0x67ac('0x35')];_0x46b84a['phone']=_0x1cf8db['phone'];_0x46b84a[_0x67ac('0x33')]=_0xbb02a5[_0x67ac('0x26')];_0x46b84a[_0x67ac('0x5b')]=_0x1cf8db[_0x67ac('0xe')];_0x46b84a['timestamp']=+new Date();var _0x194d4f='';var _0x17b34e='';var _0xf295ed=Object[_0x67ac('0x5c')](_0x46b84a);_0xf295ed['sort']();for(var _0x7c8b6c=0x0;_0x7c8b6c<_0xf295ed[_0x67ac('0x5d')];_0x7c8b6c++){if(_0x194d4f!=''){_0x194d4f+='&';}_0x194d4f+=_0xf295ed[_0x7c8b6c]+'='+encodeURIComponent(_0x46b84a[_0xf295ed[_0x7c8b6c]]);_0x17b34e+=_0x46b84a[_0xf295ed[_0x7c8b6c]];}_0x17b34e+=_0xbb02a5[_0x67ac('0x5a')];_0x17b34e=_0x3dd215[_0x67ac('0x5e')](_0x67ac('0x5f'))[_0x67ac('0x1b')](_0x17b34e)[_0x67ac('0x60')](_0x67ac('0x61'));if(_0x194d4f!==''){_0x194d4f+='&';}_0x194d4f+=_0x67ac('0x62')+_0x17b34e;var _0x4a0ff9={'method':_0x67ac('0x63'),'uri':_0xbb02a5[_0x67ac('0x55')]+_0x67ac('0x64')+_0x194d4f,'json':!![]};return rp(_0x4a0ff9)['then'](function(_0x40beab){var _0x1fd676=Object[_0x67ac('0x5c')](_0x40beab);if(_0x40beab[_0x1fd676[0x0]][_0x67ac('0x1e')]&&parseInt(_0x40beab[_0x1fd676[0x0]][_0x67ac('0x1e')])===0x0){var _0x4fc485={'messageId':_0x40beab[_0x1fd676[0x0]][_0x67ac('0x65')]};if(!_0xbb02a5[_0x67ac('0x3d')]){_0x4fc485[_0x67ac('0x3e')]=!![];}return _0x5378ac[_0x67ac('0x1b')](_0x4fc485);}else{return logger[_0x67ac('0x1e')](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x58'),util[_0x67ac('0x2c')](_0x40beab[_0x67ac('0x1e')],{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x48757c){return logger['error'](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x58'),util[_0x67ac('0x2c')](_0x48757c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x67ac('0x2d'),'afterCreate','csc',_0x67ac('0x66'));}break;case'clickatell':if(_0xbb02a5[_0x67ac('0x5a')]){var _0x47804c={'method':'POST','uri':_0x67ac('0x67'),'headers':{'Authorization':_0xbb02a5[_0x67ac('0x5a')]},'body':{'content':_0x1cf8db['body'],'to':[_0x1cf8db[_0x67ac('0x26')]],'from':_0xbb02a5[_0x67ac('0x26')],'binary':![],'clientMessageId':_0x67ac('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x47804c)[_0x67ac('0x21')](function(_0x4f7d97){if(!_0x4f7d97[_0x67ac('0x1e')]){var _0x1f4e15={'messageId':_0x4f7d97[_0x67ac('0x24')][0x0]['apiMessageId']};if(!_0xbb02a5['deliveryReport']){_0x1f4e15[_0x67ac('0x3e')]=!![];}return _0x5378ac[_0x67ac('0x1b')](_0x1f4e15);}else{return logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x69'),util[_0x67ac('0x2c')](_0x4f7d97[_0x67ac('0x1e')],{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x18843c){return logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x69'),util['inspect'](_0x18843c,{'showHidden':![],'depth':null}));});}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),'clickatell',_0x67ac('0x66'));}break;case _0x67ac('0x6a'):if(_0xbb02a5[_0x67ac('0x35')]&&_0xbb02a5[_0x67ac('0x31')]){var _0x51a2c6=util[_0x67ac('0x46')](_0x67ac('0x45'),_0xbb02a5[_0x67ac('0x35')],_0xbb02a5['password']);var _0x4692bb={'method':_0x67ac('0x38'),'uri':_0x67ac('0x6b')+_0xbb02a5[_0x67ac('0x6c')]+_0x67ac('0x6d'),'body':{'to':[_0x1cf8db['phone']],'text':_0x1cf8db[_0x67ac('0xe')],'from':_0xbb02a5[_0x67ac('0x26')],'applicationId':_0xbb02a5['applicationId']},'headers':{'Authorization':util[_0x67ac('0x46')](_0x67ac('0x47'),new Buffer(_0x51a2c6)['toString'](_0x67ac('0x6e')))},'json':!![]};rp(_0x4692bb)['then'](function(_0x552972){if(_0x552972['id']){var _0x4a3133={'messageId':_0x552972['id']};return _0x5378ac[_0x67ac('0x1b')](_0x4a3133);}else{logger[_0x67ac('0x1e')](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x6a'),util[_0x67ac('0x2c')](_0x552972,{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x38384e){logger['error'](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x6a'),util['inspect'](_0x38384e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x67ac('0x2d'),_0x67ac('0x2b'),_0x67ac('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x67ac('0x6f'):if(_0xbb02a5[_0x67ac('0x5a')]){var _0x34aa4e={};var _0x4a0ff9={'method':_0x67ac('0x38'),'uri':_0x67ac('0x70'),'headers':{'Authorization':_0x67ac('0x71')+_0xbb02a5[_0x67ac('0x5a')],'Content-Type':'application/json'},'body':{'from':_0xbb02a5[_0x67ac('0x26')],'to':_0x1cf8db[_0x67ac('0x26')],'text':_0x1cf8db[_0x67ac('0xe')]},'json':!![]};return rp(_0x4a0ff9)['then'](function(_0x2fa9a9){if(_0x2fa9a9['code']==0xca){_0x34aa4e['message']=_0x2fa9a9;var _0x151394={'method':_0x67ac('0x38'),'uri':_0x67ac('0x72'),'headers':{'Authorization':_0x67ac('0x71')+_0xbb02a5[_0x67ac('0x5a')],'Content-Type':'application/json'},'body':{'refid':_0x34aa4e[_0x67ac('0x73')]['refid']},'json':!![]};return rp(_0x151394)[_0x67ac('0x21')](function(_0x5be192){_0x34aa4e[_0x67ac('0x74')]=_0x5be192;var _0x23bad9={'messageId':_0x34aa4e[_0x67ac('0x73')][_0x67ac('0x75')],'read':!![]};return _0x5378ac['update'](_0x23bad9);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x6f'),util['inspect'](_0x2fa9a9,{'showHidden':![],'depth':null}));}})[_0x67ac('0x1d')](function(_0x47258a){return logger[_0x67ac('0x1e')](_0x67ac('0x2d'),'afterCreate',_0x67ac('0x6f'),util['inspect'](_0x47258a,{'showHidden':![],'depth':null}));});}else{return logger[_0x67ac('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x67ac('0x2b'),_0x67ac('0x6f'),_0x67ac('0x76'));}break;}}})[_0x67ac('0x77')](function(){_0x1091ab();});}else{_0x1091ab();}}},'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 2e82e20..1b28683 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 _0x1453=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','then','catch','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xacda65,_0x3cefff){var _0x3b7b8b=function(_0x43b77d){while(--_0x43b77d){_0xacda65['push'](_0xacda65['shift']());}};_0x3b7b8b(++_0x3cefff);}(_0x1453,0x98));var _0x3145=function(_0x5b289f,_0x3c064c){_0x5b289f=_0x5b289f-0x0;var _0x5922f9=_0x1453[_0x5b289f];return _0x5922f9;};'use strict';var _=require(_0x3145('0x0'));var util=require('util');var moment=require(_0x3145('0x1'));var BPromise=require(_0x3145('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3145('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3145('0x4'));var config=require(_0x3145('0x5'));var jayson=require(_0x3145('0x6'));var client=jayson[_0x3145('0x7')][_0x3145('0x8')]({'port':0x232a});config[_0x3145('0x9')]=_['defaults'](config[_0x3145('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3145('0xa'))(new Redis(config[_0x3145('0x9')]));require('./smsMessage.socket')[_0x3145('0xb')](socket);function respondWithRpcPromise(_0x54bba3,_0x20e8b7,_0xd359f7){return new BPromise(function(_0x12685e,_0xa4942a){return client[_0x3145('0xc')](_0x54bba3,_0xd359f7)['then'](function(_0x4ecb2d){logger[_0x3145('0xd')](_0x3145('0xe'),_0x20e8b7,_0x3145('0xf'));logger[_0x3145('0x10')](_0x3145('0x11'),_0x20e8b7,'request\x20sent',JSON[_0x3145('0x12')](_0x4ecb2d));if(_0x4ecb2d[_0x3145('0x13')]){if(_0x4ecb2d[_0x3145('0x13')][_0x3145('0x14')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x20e8b7,_0x4ecb2d[_0x3145('0x13')][_0x3145('0x15')]);return _0xa4942a(_0x4ecb2d[_0x3145('0x13')]['message']);}logger[_0x3145('0x13')](_0x3145('0xe'),_0x20e8b7,_0x4ecb2d[_0x3145('0x13')][_0x3145('0x15')]);return _0x12685e(_0x4ecb2d[_0x3145('0x13')][_0x3145('0x15')]);}else{logger['info'](_0x3145('0xe'),_0x20e8b7,'request\x20sent');_0x12685e(_0x4ecb2d[_0x3145('0x16')][_0x3145('0x15')]);}})['catch'](function(_0x178f1f){logger[_0x3145('0x13')](_0x3145('0xe'),_0x20e8b7,_0x178f1f);_0xa4942a(_0x178f1f);});});}exports[_0x3145('0x17')]=function(_0x5e0559){var _0x3bb5f6=this;return new Promise(function(_0x4e0134,_0x3c8130){return db[_0x3145('0x18')][_0x3145('0x19')](_0x5e0559['body'],{'raw':_0x5e0559['options']?_0x5e0559['options']['raw']===undefined?!![]:![]:!![]})[_0x3145('0x1a')](function(_0x652e61){logger[_0x3145('0xd')]('CreateSmsMessage',_0x5e0559);logger[_0x3145('0x10')](_0x3145('0x17'),_0x5e0559,JSON[_0x3145('0x12')](_0x652e61));_0x4e0134(_0x652e61);})[_0x3145('0x1b')](function(_0x2976e4){logger[_0x3145('0x13')](_0x3145('0x17'),_0x2976e4[_0x3145('0x15')],_0x5e0559);_0x3c8130(_0x3bb5f6[_0x3145('0x13')](0x1f4,_0x2976e4[_0x3145('0x15')]));});});}; \ No newline at end of file +var _0x4115=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x17a4a3,_0x173edd){var _0x5af232=function(_0x50b847){while(--_0x50b847){_0x17a4a3['push'](_0x17a4a3['shift']());}};_0x5af232(++_0x173edd);}(_0x4115,0x7f));var _0x5411=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x4115[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x5411('0x0'));var util=require(_0x5411('0x1'));var moment=require(_0x5411('0x2'));var BPromise=require(_0x5411('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5411('0x4'));var db=require(_0x5411('0x5'))['db'];var utils=require(_0x5411('0x6'));var logger=require(_0x5411('0x7'))(_0x5411('0x8'));var config=require('../../config/environment');var jayson=require(_0x5411('0x9'));var client=jayson[_0x5411('0xa')][_0x5411('0xb')]({'port':0x232a});config[_0x5411('0xc')]=_['defaults'](config['redis'],{'host':_0x5411('0xd'),'port':0x18eb});var socket=require(_0x5411('0xe'))(new Redis(config[_0x5411('0xc')]));require(_0x5411('0xf'))['register'](socket);function respondWithRpcPromise(_0x7d72bc,_0xb81ad8,_0x24625d){return new BPromise(function(_0x198bc6,_0x21334f){return client[_0x5411('0x10')](_0x7d72bc,_0x24625d)[_0x5411('0x11')](function(_0x27215a){logger[_0x5411('0x12')](_0x5411('0x13'),_0xb81ad8,'request\x20sent');logger[_0x5411('0x14')](_0x5411('0x15'),_0xb81ad8,'request\x20sent',JSON[_0x5411('0x16')](_0x27215a));if(_0x27215a[_0x5411('0x17')]){if(_0x27215a[_0x5411('0x17')][_0x5411('0x18')]===0x1f4){logger[_0x5411('0x17')](_0x5411('0x13'),_0xb81ad8,_0x27215a[_0x5411('0x17')][_0x5411('0x19')]);return _0x21334f(_0x27215a[_0x5411('0x17')][_0x5411('0x19')]);}logger[_0x5411('0x17')](_0x5411('0x13'),_0xb81ad8,_0x27215a[_0x5411('0x17')]['message']);return _0x198bc6(_0x27215a[_0x5411('0x17')][_0x5411('0x19')]);}else{logger[_0x5411('0x12')](_0x5411('0x13'),_0xb81ad8,_0x5411('0x1a'));_0x198bc6(_0x27215a['result'][_0x5411('0x19')]);}})[_0x5411('0x1b')](function(_0x3bebfc){logger[_0x5411('0x17')]('SmsMessage,\x20%s,\x20%s',_0xb81ad8,_0x3bebfc);_0x21334f(_0x3bebfc);});});}exports[_0x5411('0x1c')]=function(_0x2c049a){var _0x3ada52=this;return new Promise(function(_0x1521e3,_0x200d45){return db[_0x5411('0x1d')]['create'](_0x2c049a[_0x5411('0x1e')],{'raw':_0x2c049a['options']?_0x2c049a[_0x5411('0x1f')][_0x5411('0x20')]===undefined?!![]:![]:!![]})[_0x5411('0x11')](function(_0x581c51){logger[_0x5411('0x12')]('CreateSmsMessage',_0x2c049a);logger[_0x5411('0x14')](_0x5411('0x1c'),_0x2c049a,JSON[_0x5411('0x16')](_0x581c51));_0x1521e3(_0x581c51);})['catch'](function(_0x3a8376){logger['error'](_0x5411('0x1c'),_0x3a8376[_0x5411('0x19')],_0x2c049a);_0x200d45(_0x3ada52[_0x5411('0x17')](0x1f4,_0x3a8376[_0x5411('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 95b73af..70e2e27 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 _0x5403=['removeListener','smsMessage:','save','remove','update','emit'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x5403,0x6e));var _0x3540=function(_0x3db643,_0x237393){_0x3db643=_0x3db643-0x0;var _0x93b0d6=_0x5403[_0x3db643];return _0x93b0d6;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x3540('0x0'),_0x3540('0x1'),_0x3540('0x2')];function createListener(_0x129e63,_0x4c3068){return function(_0x205887){_0x4c3068[_0x3540('0x3')](_0x129e63,_0x205887);};}function removeListener(_0x1cb9cc,_0x1a7f90){return function(){SmsMessageEvents[_0x3540('0x4')](_0x1cb9cc,_0x1a7f90);};}exports['register']=function(_0x2555e5){for(var _0x52a8a8=0x0,_0x59e2ad=events['length'];_0x52a8a8<_0x59e2ad;_0x52a8a8++){var _0x2e36b1=events[_0x52a8a8];var _0x5e9d53=createListener(_0x3540('0x5')+_0x2e36b1,_0x2555e5);SmsMessageEvents['on'](_0x2e36b1,_0x5e9d53);}}; \ No newline at end of file +var _0x542a=['update','removeListener','register','smsMessage:','./smsMessage.events','save','remove'];(function(_0x5f1509,_0x1c4fbf){var _0x35aeed=function(_0x3da41a){while(--_0x3da41a){_0x5f1509['push'](_0x5f1509['shift']());}};_0x35aeed(++_0x1c4fbf);}(_0x542a,0x1e0));var _0xa542=function(_0x2abe9a,_0x426745){_0x2abe9a=_0x2abe9a-0x0;var _0xdd91ac=_0x542a[_0x2abe9a];return _0xdd91ac;};'use strict';var SmsMessageEvents=require(_0xa542('0x0'));var events=[_0xa542('0x1'),_0xa542('0x2'),_0xa542('0x3')];function createListener(_0x2efd22,_0x6fd289){return function(_0x18dfd1){_0x6fd289['emit'](_0x2efd22,_0x18dfd1);};}function removeListener(_0x2f657d,_0x3d9ceb){return function(){SmsMessageEvents[_0xa542('0x4')](_0x2f657d,_0x3d9ceb);};}exports[_0xa542('0x5')]=function(_0x18b555){for(var _0x4030bb=0x0,_0x32e905=events['length'];_0x4030bb<_0x32e905;_0x4030bb++){var _0x8c844c=events[_0x4030bb];var _0x3a4eae=createListener(_0xa542('0x6')+_0x8c844c,_0x18b555);SmsMessageEvents['on'](_0x8c844c,_0x3a4eae);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 42650c4..21d7c61 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 _0xcb30=['delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','create','post','addAgents','put','update'];(function(_0x259ada,_0x51bcf1){var _0x47187d=function(_0x566939){while(--_0x566939){_0x259ada['push'](_0x259ada['shift']());}};_0x47187d(++_0x51bcf1);}(_0xcb30,0x1bd));var _0x0cb3=function(_0x438bdc,_0x45beed){_0x438bdc=_0x438bdc-0x0;var _0x3291b5=_0xcb30[_0x438bdc];return _0x3291b5;};'use strict';var multer=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var path=require(_0x0cb3('0x2'));var timeout=require(_0x0cb3('0x3'));var express=require(_0x0cb3('0x4'));var router=express[_0x0cb3('0x5')]();var fs_extra=require(_0x0cb3('0x6'));var auth=require(_0x0cb3('0x7'));var interaction=require(_0x0cb3('0x8'));var config=require(_0x0cb3('0x9'));var controller=require('./smsQueue.controller');router[_0x0cb3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0cb3('0xa')]('/describe',auth[_0x0cb3('0xb')](),controller[_0x0cb3('0xc')]);router['get'](_0x0cb3('0xd'),auth[_0x0cb3('0xb')](),controller[_0x0cb3('0xe')]);router['get']('/:id/members',auth[_0x0cb3('0xb')](),controller[_0x0cb3('0xf')]);router['get']('/:id/teams',auth[_0x0cb3('0xb')](),controller[_0x0cb3('0x10')]);router['get'](_0x0cb3('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x0cb3('0xb')](),controller[_0x0cb3('0x12')]);router[_0x0cb3('0x13')]('/:id/teams',auth[_0x0cb3('0xb')](),controller['addTeams']);router[_0x0cb3('0x13')](_0x0cb3('0x11'),auth[_0x0cb3('0xb')](),controller[_0x0cb3('0x14')]);router[_0x0cb3('0x15')](_0x0cb3('0xd'),auth[_0x0cb3('0xb')](),controller[_0x0cb3('0x16')]);router[_0x0cb3('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x0cb3('0x17')]('/:id/teams',auth[_0x0cb3('0xb')](),controller[_0x0cb3('0x18')]);router[_0x0cb3('0x17')]('/:id/users',auth[_0x0cb3('0xb')](),controller['removeAgents']);module[_0x0cb3('0x19')]=router; \ No newline at end of file +var _0x0a5c=['multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x41c4c9,_0x548b87){var _0x3e490d=function(_0x4c0935){while(--_0x4c0935){_0x41c4c9['push'](_0x41c4c9['shift']());}};_0x3e490d(++_0x548b87);}(_0x0a5c,0x1b3));var _0xc0a5=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x0a5c[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xc0a5('0x0'));var util=require(_0xc0a5('0x1'));var path=require('path');var timeout=require(_0xc0a5('0x2'));var express=require('express');var router=express[_0xc0a5('0x3')]();var fs_extra=require(_0xc0a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc0a5('0x5'));var config=require(_0xc0a5('0x6'));var controller=require('./smsQueue.controller');router[_0xc0a5('0x7')]('/',auth[_0xc0a5('0x8')](),controller['index']);router[_0xc0a5('0x7')](_0xc0a5('0x9'),auth['isAuthenticated'](),controller[_0xc0a5('0xa')]);router['get'](_0xc0a5('0xb'),auth[_0xc0a5('0x8')](),controller[_0xc0a5('0xc')]);router[_0xc0a5('0x7')](_0xc0a5('0xd'),auth[_0xc0a5('0x8')](),controller[_0xc0a5('0xe')]);router[_0xc0a5('0x7')]('/:id/teams',auth[_0xc0a5('0x8')](),controller['getTeams']);router[_0xc0a5('0x7')](_0xc0a5('0xf'),auth['isAuthenticated'](),controller[_0xc0a5('0x10')]);router['post']('/',auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x11')]);router[_0xc0a5('0x12')](_0xc0a5('0x13'),auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x14')]);router['post'](_0xc0a5('0xf'),auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x15')]);router[_0xc0a5('0x16')](_0xc0a5('0xb'),auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x17')]);router[_0xc0a5('0x18')]('/:id',auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x19')]);router[_0xc0a5('0x18')](_0xc0a5('0x13'),auth['isAuthenticated'](),controller[_0xc0a5('0x1a')]);router[_0xc0a5('0x18')]('/:id/users',auth[_0xc0a5('0x8')](),controller[_0xc0a5('0x1b')]);module[_0xc0a5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 558d493..537235d 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 _0xc1a9=['sequelize','STRING','INTEGER','roundrobin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1a9,0x19c));var _0x9c1a=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xc1a9[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0x9c1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c1a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c1a('0x1')]},'timeout':{'type':Sequelize[_0x9c1a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x9c1a('0x3'))}}; \ No newline at end of file +var _0x4afd=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x1fb2ce,_0x48301b){var _0x2999d5=function(_0x49ceef){while(--_0x49ceef){_0x1fb2ce['push'](_0x1fb2ce['shift']());}};_0x2999d5(++_0x48301b);}(_0x4afd,0x1d7));var _0xd4af=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4afd[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xd4af('0x0'));module[_0xd4af('0x1')]={'name':{'type':Sequelize[_0xd4af('0x2')],'unique':_0xd4af('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd4af('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd4af('0x4')](_0xd4af('0x5'),'beepall',_0xd4af('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e136d57..b547ccd 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 _0x2340=['params','describe','getMembers','get','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','UserSmsQueue','findOrCreate','emit','removeTeams','ids','User','select','field','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','undefined','count','offset','set','Content-Range','json','destroy','SmsQueues','UserProfileResource','then','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body'];(function(_0x137bc2,_0x1815f6){var _0x28336e=function(_0x11ebbb){while(--_0x11ebbb){_0x137bc2['push'](_0x137bc2['shift']());}};_0x28336e(++_0x1815f6);}(_0x2340,0x1e6));var _0x0234=function(_0x489945,_0x4495be){_0x489945=_0x489945-0x0;var _0x159338=_0x2340[_0x489945];return _0x159338;};'use strict';var emlformat=require(_0x0234('0x0'));var rimraf=require(_0x0234('0x1'));var zipdir=require(_0x0234('0x2'));var jsonpatch=require(_0x0234('0x3'));var rp=require('request-promise');var moment=require(_0x0234('0x4'));var BPromise=require(_0x0234('0x5'));var Mustache=require(_0x0234('0x6'));var util=require('util');var path=require(_0x0234('0x7'));var sox=require(_0x0234('0x8'));var csv=require(_0x0234('0x9'));var ejs=require(_0x0234('0xa'));var fs=require('fs');var fs_extra=require(_0x0234('0xb'));var _=require(_0x0234('0xc'));var squel=require(_0x0234('0xd'));var crypto=require(_0x0234('0xe'));var jsforce=require(_0x0234('0xf'));var deskjs=require(_0x0234('0x10'));var toCsv=require(_0x0234('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0234('0x11'));var qs=require(_0x0234('0x12'));var as=require(_0x0234('0x13'));var hardwareService=require(_0x0234('0x14'));var logger=require(_0x0234('0x15'))(_0x0234('0x16'));var utils=require(_0x0234('0x17'));var config=require(_0x0234('0x18'));var licenseUtil=require(_0x0234('0x19'));var db=require(_0x0234('0x1a'))['db'];config[_0x0234('0x1b')]=_[_0x0234('0x1c')](config[_0x0234('0x1b')],{'host':_0x0234('0x1d'),'port':0x18eb});var socket=require(_0x0234('0x1e'))(new Redis(config[_0x0234('0x1b')]));require(_0x0234('0x1f'))[_0x0234('0x20')](socket);function respondWithStatusCode(_0x19801a,_0x11a890){_0x11a890=_0x11a890||0xcc;return function(_0x2db2e8){if(_0x2db2e8){return _0x19801a[_0x0234('0x21')](_0x11a890);}return _0x19801a[_0x0234('0x22')](_0x11a890)['end']();};}function respondWithResult(_0x9d0f3b,_0x5a79ee){_0x5a79ee=_0x5a79ee||0xc8;return function(_0x50febf){if(_0x50febf){return _0x9d0f3b['status'](_0x5a79ee)['json'](_0x50febf);}};}function respondWithFilteredResult(_0x11b441,_0x18dd75){return function(_0x436369){if(_0x436369){var _0x4061ac=typeof _0x18dd75['offset']===_0x0234('0x23')&&typeof _0x18dd75['limit']===_0x0234('0x23');var _0x4f9f8e=_0x436369[_0x0234('0x24')];var _0x3f3155=_0x4061ac?0x0:_0x18dd75[_0x0234('0x25')];var _0x42aec2=_0x4061ac?_0x436369[_0x0234('0x24')]:_0x18dd75[_0x0234('0x25')]+_0x18dd75['limit'];var _0x553439;if(_0x42aec2>=_0x4f9f8e){_0x42aec2=_0x4f9f8e;_0x553439=0xc8;}else{_0x553439=0xce;}_0x11b441[_0x0234('0x22')](_0x553439);return _0x11b441[_0x0234('0x26')](_0x0234('0x27'),_0x3f3155+'-'+_0x42aec2+'/'+_0x4f9f8e)[_0x0234('0x28')](_0x436369);}return null;};}function patchUpdates(_0x2c2ba7){return function(_0x30dbf5){try{jsonpatch['apply'](_0x30dbf5,_0x2c2ba7,!![]);}catch(_0x7f4ed3){return BPromise['reject'](_0x7f4ed3);}return _0x30dbf5['save']();};}function saveUpdates(_0x1b58ff,_0x354a2c){return function(_0x67cd09){if(_0x67cd09){return _0x67cd09['update'](_0x1b58ff)['then'](function(_0x4a03bb){return _0x4a03bb;});}return null;};}function removeEntity(_0x273ae3,_0x46daf3){return function(_0x3d36da){if(_0x3d36da){return _0x3d36da[_0x0234('0x29')]()['then'](function(){var _0x3d2a48=_0x3d36da['get']({'plain':!![]});var _0x3761d7=_0x0234('0x2a');return db[_0x0234('0x2b')][_0x0234('0x29')]({'where':{'type':_0x3761d7,'resourceId':_0x3d2a48['id']}})[_0x0234('0x2c')](function(){return _0x3d36da;});})['then'](function(){_0x273ae3[_0x0234('0x22')](0xcc)[_0x0234('0x2d')]();});}};}function handleEntityNotFound(_0x462d57,_0x45468a){return function(_0x2b546d){if(!_0x2b546d){_0x462d57[_0x0234('0x21')](0x194);}return _0x2b546d;};}function handleError(_0x27179f,_0x40f265){_0x40f265=_0x40f265||0x1f4;return function(_0x196c73){logger[_0x0234('0x2e')](_0x196c73[_0x0234('0x2f')]);if(_0x196c73[_0x0234('0x30')]){delete _0x196c73[_0x0234('0x30')];}_0x27179f[_0x0234('0x22')](_0x40f265)[_0x0234('0x31')](_0x196c73);};}exports[_0x0234('0x32')]=function(_0xa38978,_0x7b6466){var _0x18851a={},_0x208e43={},_0xa5f984={'count':0x0,'rows':[]};var _0x80dfd8=_[_0x0234('0x33')](db[_0x0234('0x34')][_0x0234('0x35')],function(_0x2dbbb5){return{'name':_0x2dbbb5['fieldName'],'type':_0x2dbbb5[_0x0234('0x36')][_0x0234('0x37')]};});_0x208e43[_0x0234('0x38')]=_['map'](_0x80dfd8,_0x0234('0x30'));_0x208e43[_0x0234('0x39')]=_[_0x0234('0x3a')](_0xa38978[_0x0234('0x39')]);_0x208e43[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x208e43[_0x0234('0x38')],_0x208e43[_0x0234('0x39')]);_0x18851a[_0x0234('0x3d')]=_[_0x0234('0x3c')](_0x208e43[_0x0234('0x38')],qs[_0x0234('0x3e')](_0xa38978['query'][_0x0234('0x3e')]));_0x18851a[_0x0234('0x3d')]=_0x18851a[_0x0234('0x3d')][_0x0234('0x3f')]?_0x18851a['attributes']:_0x208e43[_0x0234('0x38')];if(!_0xa38978[_0x0234('0x39')][_0x0234('0x40')](_0x0234('0x41'))){_0x18851a[_0x0234('0x42')]=qs['limit'](_0xa38978['query'][_0x0234('0x42')]);_0x18851a['offset']=qs[_0x0234('0x25')](_0xa38978['query'][_0x0234('0x25')]);}_0x18851a[_0x0234('0x43')]=qs[_0x0234('0x44')](_0xa38978[_0x0234('0x39')][_0x0234('0x44')]);_0x18851a[_0x0234('0x45')]=qs[_0x0234('0x3b')](_[_0x0234('0x46')](_0xa38978['query'],_0x208e43[_0x0234('0x3b')]),_0x80dfd8);if(_0xa38978['query'][_0x0234('0x47')]){_0x18851a[_0x0234('0x45')]=_[_0x0234('0x48')](_0x18851a[_0x0234('0x45')],{'$or':_[_0x0234('0x33')](_0x80dfd8,function(_0x46c650){if(_0x46c650['type']!==_0x0234('0x49')){var _0x5eaab2={};_0x5eaab2[_0x46c650[_0x0234('0x30')]]={'$like':'%'+_0xa38978[_0x0234('0x39')][_0x0234('0x47')]+'%'};return _0x5eaab2;}})});}_0x18851a=_[_0x0234('0x48')]({},_0x18851a,_0xa38978[_0x0234('0x4a')]);var _0xb5a13f={'where':_0x18851a['where']};return db[_0x0234('0x34')][_0x0234('0x24')](_0xb5a13f)[_0x0234('0x2c')](function(_0x3c9fa0){_0xa5f984['count']=_0x3c9fa0;if(_0xa38978['query']['includeAll']){_0x18851a[_0x0234('0x4b')]=[{'all':!![]}];}return db[_0x0234('0x34')][_0x0234('0x4c')](_0x18851a);})[_0x0234('0x2c')](function(_0x2439eb){_0xa5f984[_0x0234('0x4d')]=_0x2439eb;return _0xa5f984;})[_0x0234('0x2c')](respondWithFilteredResult(_0x7b6466,_0x18851a))[_0x0234('0x4e')](handleError(_0x7b6466,null));};exports[_0x0234('0x4f')]=function(_0x2c73d7,_0x16274f){var _0x22528c={'raw':!![],'where':{'id':_0x2c73d7['params']['id']}},_0x507cf7={};_0x507cf7[_0x0234('0x38')]=_[_0x0234('0x3a')](db['SmsQueue'][_0x0234('0x35')]);_0x507cf7['query']=_[_0x0234('0x3a')](_0x2c73d7[_0x0234('0x39')]);_0x507cf7[_0x0234('0x3b')]=_['intersection'](_0x507cf7[_0x0234('0x38')],_0x507cf7[_0x0234('0x39')]);_0x22528c[_0x0234('0x3d')]=_[_0x0234('0x3c')](_0x507cf7['model'],qs[_0x0234('0x3e')](_0x2c73d7[_0x0234('0x39')][_0x0234('0x3e')]));_0x22528c[_0x0234('0x3d')]=_0x22528c[_0x0234('0x3d')]['length']?_0x22528c['attributes']:_0x507cf7[_0x0234('0x38')];if(_0x2c73d7[_0x0234('0x39')][_0x0234('0x50')]){_0x22528c[_0x0234('0x4b')]=[{'all':!![]}];}_0x22528c=_[_0x0234('0x48')]({},_0x22528c,_0x2c73d7[_0x0234('0x4a')]);return db[_0x0234('0x34')][_0x0234('0x51')](_0x22528c)[_0x0234('0x2c')](handleEntityNotFound(_0x16274f,null))[_0x0234('0x2c')](respondWithResult(_0x16274f,null))[_0x0234('0x4e')](handleError(_0x16274f,null));};exports[_0x0234('0x52')]=function(_0x27f8c7,_0x42a1f3){return db[_0x0234('0x34')]['create'](_0x27f8c7['body'],{})[_0x0234('0x2c')](function(_0x3b65a3){var _0x51ddb5=_0x27f8c7['user']['get']({'plain':!![]});if(!_0x51ddb5)throw new Error(_0x0234('0x53'));if(_0x51ddb5[_0x0234('0x54')]===_0x0234('0x55')){var _0x174318=_0x3b65a3['get']({'plain':!![]});var _0x43ab87=_0x0234('0x2a');return db[_0x0234('0x56')]['find']({'where':{'name':_0x43ab87,'userProfileId':_0x51ddb5[_0x0234('0x57')]},'raw':!![]})[_0x0234('0x2c')](function(_0x3fa959){if(_0x3fa959&&_0x3fa959[_0x0234('0x58')]===0x0){return db[_0x0234('0x2b')][_0x0234('0x52')]({'name':_0x174318[_0x0234('0x30')],'resourceId':_0x174318['id'],'type':_0x3fa959[_0x0234('0x30')],'sectionId':_0x3fa959['id']},{})[_0x0234('0x2c')](function(){return _0x3b65a3;});}else{return _0x3b65a3;}})[_0x0234('0x4e')](function(_0x2e9954){logger[_0x0234('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e9954);throw _0x2e9954;});}return _0x3b65a3;})['then'](respondWithResult(_0x42a1f3,0xc9))['catch'](handleError(_0x42a1f3,null));};exports['update']=function(_0x5178d6,_0x9d352b){if(_0x5178d6[_0x0234('0x59')]['id']){delete _0x5178d6['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x5178d6['params']['id']}})[_0x0234('0x2c')](handleEntityNotFound(_0x9d352b,null))['then'](saveUpdates(_0x5178d6['body'],null))[_0x0234('0x2c')](respondWithResult(_0x9d352b,null))[_0x0234('0x4e')](handleError(_0x9d352b,null));};exports[_0x0234('0x29')]=function(_0x9aa89a,_0x449f5a){return db['SmsQueue'][_0x0234('0x51')]({'where':{'id':_0x9aa89a[_0x0234('0x5a')]['id']}})[_0x0234('0x2c')](handleEntityNotFound(_0x449f5a,null))[_0x0234('0x2c')](removeEntity(_0x449f5a,null))[_0x0234('0x4e')](handleError(_0x449f5a,null));};exports[_0x0234('0x5b')]=function(_0x5d78a2,_0x3c4d6c){return db[_0x0234('0x34')][_0x0234('0x5b')]()[_0x0234('0x2c')](respondWithResult(_0x3c4d6c,null))[_0x0234('0x4e')](handleError(_0x3c4d6c,null));};exports[_0x0234('0x5c')]=function(_0x2d7654,_0x28ea70,_0x29589f){var _0x3b0998={'raw':!![],'where':{}},_0x3e6cce={},_0xe7c7cc;return db['SmsQueue']['findOne']({'where':{'id':_0x2d7654[_0x0234('0x5a')]['id']}})[_0x0234('0x2c')](handleEntityNotFound(_0x28ea70,null))[_0x0234('0x2c')](function(_0x392e33){if(_0x392e33){_0xe7c7cc=_0x392e33[_0x0234('0x5d')]({'plain':!![]});_0x3e6cce[_0x0234('0x38')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x3e6cce['query']=_[_0x0234('0x3a')](_0x2d7654['query']);_0x3e6cce[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x3e6cce[_0x0234('0x38')],_0x3e6cce[_0x0234('0x39')]);_0x3b0998[_0x0234('0x3d')]=_[_0x0234('0x3c')](_0x3e6cce[_0x0234('0x38')],qs['fields'](_0x2d7654[_0x0234('0x39')][_0x0234('0x3e')]));_0x3b0998[_0x0234('0x3d')]=_0x3b0998[_0x0234('0x3d')][_0x0234('0x3f')]?_0x3b0998['attributes']:_0x3e6cce['model'];if(!_0x2d7654['query'][_0x0234('0x40')](_0x0234('0x41'))){_0x3b0998[_0x0234('0x42')]=qs[_0x0234('0x42')](_0x2d7654[_0x0234('0x39')][_0x0234('0x42')]);_0x3b0998[_0x0234('0x25')]=qs[_0x0234('0x25')](_0x2d7654[_0x0234('0x39')]['offset']);}_0x3b0998[_0x0234('0x43')]=qs[_0x0234('0x44')](_0x2d7654['query'][_0x0234('0x44')]);_0x3b0998[_0x0234('0x45')]=qs['filters'](_[_0x0234('0x46')](_0x2d7654[_0x0234('0x39')],_0x3e6cce[_0x0234('0x3b')]));_0x3b0998[_0x0234('0x45')][_0x0234('0x5e')]=_0x392e33['id'];if(_0x2d7654[_0x0234('0x39')]['filter']){_0x3b0998[_0x0234('0x45')]=_[_0x0234('0x48')](_0x3b0998[_0x0234('0x45')],{'$or':_[_0x0234('0x33')](_0x3b0998['attributes'],function(_0x3ae584){var _0x74a52d={};_0x74a52d[_0x3ae584]={'$like':'%'+_0x2d7654[_0x0234('0x39')][_0x0234('0x47')]+'%'};return _0x74a52d;})});}_0x3b0998=_['merge']({},_0x3b0998,_0x2d7654[_0x0234('0x4a')]);return db['UserSmsQueue'][_0x0234('0x4c')](_0x3b0998);}})['then'](function(_0x2af879){if(_0x2af879){return db['User'][_0x0234('0x5f')]({'where':{'id':_[_0x0234('0x33')](_0x2af879,_0x0234('0x60')),'role':_0x0234('0x61')},'attributes':['id',_0x0234('0x30'),_0x0234('0x62'),_0x0234('0x63'),_0x0234('0x64')]});}})['then'](function(_0x147df3){if(_0x147df3){return{'count':_0x147df3['count'],'rows':_[_0x0234('0x33')](_0x147df3['rows'],function(_0x3bb67f){return{'membername':_0x3bb67f[_0x0234('0x30')],'UserId':_0x3bb67f['id'],'queue_name':_0xe7c7cc[_0x0234('0x30')],'SmsQueueId':_0xe7c7cc['id'],'interface':util['format'](_0x0234('0x65'),_0x0234('0x66'),_0x3bb67f['name']),'penalty':0x0,'paused':_0x3bb67f[_0x0234('0x62')],'createdAt':_0x3bb67f[_0x0234('0x64')],'updatedAt':_0x3bb67f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0234('0x2c')](respondWithFilteredResult(_0x28ea70,_0x3b0998))[_0x0234('0x4e')](handleError(_0x28ea70,null));};exports[_0x0234('0x67')]=function(_0x488a1d,_0x4ebee1,_0x3200ed){var _0x3fd01a={};var _0x3e952b={};var _0x8b8487;var _0x5e77d8;return db[_0x0234('0x34')]['findOne']({'where':{'id':_0x488a1d[_0x0234('0x5a')]['id']}})[_0x0234('0x2c')](handleEntityNotFound(_0x4ebee1,null))[_0x0234('0x2c')](function(_0x1c40f2){if(_0x1c40f2){_0x8b8487=_0x1c40f2;_0x3e952b['model']=_[_0x0234('0x3a')](db[_0x0234('0x68')][_0x0234('0x35')]);_0x3e952b[_0x0234('0x39')]=_[_0x0234('0x3a')](_0x488a1d['query']);_0x3e952b[_0x0234('0x3b')]=_['intersection'](_0x3e952b[_0x0234('0x38')],_0x3e952b[_0x0234('0x39')]);_0x3fd01a[_0x0234('0x3d')]=_[_0x0234('0x3c')](_0x3e952b['model'],qs[_0x0234('0x3e')](_0x488a1d['query'][_0x0234('0x3e')]));_0x3fd01a[_0x0234('0x3d')]=_0x3fd01a[_0x0234('0x3d')][_0x0234('0x3f')]?_0x3fd01a['attributes']:_0x3e952b[_0x0234('0x38')];_0x3fd01a[_0x0234('0x43')]=qs['sort'](_0x488a1d[_0x0234('0x39')][_0x0234('0x44')]);_0x3fd01a[_0x0234('0x45')]=qs[_0x0234('0x3b')](_['pick'](_0x488a1d[_0x0234('0x39')],_0x3e952b[_0x0234('0x3b')]));if(_0x488a1d[_0x0234('0x39')]['filter']){_0x3fd01a[_0x0234('0x45')]=_[_0x0234('0x48')](_0x3fd01a[_0x0234('0x45')],{'$or':_[_0x0234('0x33')](_0x3fd01a['attributes'],function(_0x3beb06){var _0x339dad={};_0x339dad[_0x3beb06]={'$like':'%'+_0x488a1d[_0x0234('0x39')]['filter']+'%'};return _0x339dad;})});}_0x3fd01a=_[_0x0234('0x48')]({},_0x3fd01a,_0x488a1d[_0x0234('0x4a')]);return _0x8b8487[_0x0234('0x67')](_0x3fd01a);}})[_0x0234('0x2c')](function(_0x2cdf8b){if(_0x2cdf8b){_0x5e77d8=_0x2cdf8b[_0x0234('0x3f')];if(!_0x488a1d[_0x0234('0x39')][_0x0234('0x40')](_0x0234('0x41'))){_0x3fd01a['limit']=qs[_0x0234('0x42')](_0x488a1d[_0x0234('0x39')][_0x0234('0x42')]);_0x3fd01a['offset']=qs[_0x0234('0x25')](_0x488a1d[_0x0234('0x39')][_0x0234('0x25')]);}return _0x8b8487['getTeams'](_0x3fd01a);}})[_0x0234('0x2c')](function(_0x544fb6){if(_0x544fb6){return _0x544fb6?{'count':_0x5e77d8,'rows':_0x544fb6}:null;}})['then'](respondWithResult(_0x4ebee1,null))['catch'](handleError(_0x4ebee1,null));};exports['addTeams']=function(_0x40e06f,_0x4bbfcb,_0x1098c7){var _0x6227ba=_0x40e06f['body']['ids'];return db[_0x0234('0x68')][_0x0234('0x4c')]({'where':{'id':_0x6227ba},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0234('0x69'),'attributes':['id','name',_0x0234('0x6a'),_0x0234('0x6b'),_0x0234('0x6c')],'raw':!![]}]})['then'](function(_0x7ea0b6){if(_0x7ea0b6){var _0x28756c=_[_0x0234('0x6d')](_0x7ea0b6,function(_0x239671){var _0x3da58a=_0x239671[_0x0234('0x5d')]({'plain':!![]});return _0x3da58a['Agents'];});return db['SmsQueue'][_0x0234('0x51')]({'where':{'id':_0x40e06f['params']['id']}})[_0x0234('0x2c')](function(_0x35107c){return db[_0x0234('0x6e')][_0x0234('0x6f')](function(_0x5c736b){return _0x35107c[_0x0234('0x70')](_0x6227ba,{'transaction':_0x5c736b})[_0x0234('0x2c')](function(){return BPromise[_0x0234('0x71')](_0x28756c,function(_0x2605d4){return db[_0x0234('0x72')][_0x0234('0x73')]({'where':{'UserId':_0x2605d4['id'],'SmsQueueId':_0x40e06f[_0x0234('0x5a')]['id']},'transaction':_0x5c736b});});})['then'](function(){_0x28756c['forEach'](function(_0x4b76ee){socket[_0x0234('0x74')]('userSmsQueue:save',{'UserId':_0x4b76ee['id'],'SmsQueueId':_0x35107c['id']});});});});});}})[_0x0234('0x2c')](respondWithStatusCode(_0x4bbfcb,null))['catch'](handleError(_0x4bbfcb,null));};exports[_0x0234('0x75')]=function(_0x294280,_0x580846,_0x48cdd2){return db[_0x0234('0x68')][_0x0234('0x4c')]({'where':{'id':_0x294280['query'][_0x0234('0x76')]},'attributes':['id'],'include':[{'model':db[_0x0234('0x77')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0234('0x2c')](handleEntityNotFound(_0x580846,null))['then'](function(_0x46e599){var _0x3788c4=_[_0x0234('0x33')](_0x46e599,'id');var _0x584578=[];var _0x4a822e=[];var _0x207bd8=squel[_0x0234('0x78')]();_0x207bd8[_0x0234('0x79')]('tq.TeamId')[_0x0234('0x7a')](_0x0234('0x7b'),'tq')['join']('user_has_teams','ut',_0x0234('0x7c'))['where']('SmsQueueId\x20=\x20?',_0x294280[_0x0234('0x5a')]['id']);for(var _0x2efc37=0x0;_0x2efc37<_0x46e599['length'];_0x2efc37+=0x1){let _0x2865c1=_0x46e599[_0x2efc37];for(var _0x3b9d08=0x0;_0x3b9d08<_0x2865c1[_0x0234('0x69')][_0x0234('0x3f')];_0x3b9d08+=0x1){let _0x34026b=_0x2865c1[_0x0234('0x69')][_0x3b9d08];var _0x44203a=_0x207bd8[_0x0234('0x7d')]();_0x44203a[_0x0234('0x45')](_0x0234('0x7e'),_0x34026b['id']);_0x4a822e[_0x0234('0x7f')](db[_0x0234('0x6e')][_0x0234('0x39')](_0x44203a[_0x0234('0x80')](),{'type':db[_0x0234('0x6e')][_0x0234('0x81')][_0x0234('0x82')]})['then'](function(_0x56fec2){if(_0x56fec2[_0x0234('0x3f')]===0x1){return _0x34026b['id'];}else{var _0x56be88=_['every'](_[_0x0234('0x33')](_0x56fec2,'TeamId'),function(_0x47c982){return _[_0x0234('0x83')](_0x3788c4,_0x47c982);});if(_0x56be88){return _0x34026b['id'];}}}));}}return BPromise[_0x0234('0x84')](_0x4a822e)[_0x0234('0x2c')](function(_0x2ca239){_0x584578=_(_0x584578)[_0x0234('0x85')](_0x2ca239)[_0x0234('0x86')]()[_0x0234('0x87')]();return db[_0x0234('0x34')][_0x0234('0x51')]({'where':{'id':_0x294280[_0x0234('0x5a')]['id']}})[_0x0234('0x2c')](function(_0x86d011){return db[_0x0234('0x6e')][_0x0234('0x6f')](function(_0x4883a9){return _0x86d011[_0x0234('0x75')](_0x294280[_0x0234('0x39')][_0x0234('0x76')],{'transaction':_0x4883a9})[_0x0234('0x2c')](function(){if(!_['isEmpty'](_0x584578)){return _0x86d011[_0x0234('0x88')](_0x584578,{'transaction':_0x4883a9});}})[_0x0234('0x2c')](function(){_0x584578[_0x0234('0x89')](function(_0x52f963){socket[_0x0234('0x74')](_0x0234('0x8a'),{'UserId':_0x52f963,'SmsQueueId':_0x86d011['id']});});});});});});})[_0x0234('0x2c')](respondWithStatusCode(_0x580846,null))['catch'](handleError(_0x580846,null));};exports[_0x0234('0x8b')]=function(_0x557ea4,_0x4bc23a,_0x18f1b6){return db[_0x0234('0x34')][_0x0234('0x51')]({'where':{'id':_0x557ea4[_0x0234('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4bc23a,null))[_0x0234('0x2c')](function(_0x448e48){if(_0x448e48){return _0x448e48[_0x0234('0x8b')](_0x557ea4[_0x0234('0x59')]['ids'],_[_0x0234('0x8c')](_0x557ea4[_0x0234('0x59')],[_0x0234('0x76'),'id'])||{})[_0x0234('0x8d')](function(_0xa89887){for(var _0x24e3ab=0x0;_0x24e3ab<_0x557ea4['body']['ids'][_0x0234('0x3f')];_0x24e3ab+=0x1){socket['emit'](_0x0234('0x8e'),{'UserId':Number(_0x557ea4[_0x0234('0x59')]['ids'][_0x24e3ab]),'SmsQueueId':Number(_0x557ea4[_0x0234('0x5a')]['id'])});}return _0xa89887;});}})['then'](respondWithResult(_0x4bc23a,null))[_0x0234('0x4e')](handleError(_0x4bc23a,null));};exports[_0x0234('0x88')]=function(_0x210816,_0x160f82,_0x377e8d){return db[_0x0234('0x34')][_0x0234('0x51')]({'where':{'id':_0x210816['params']['id']}})['then'](handleEntityNotFound(_0x160f82,null))[_0x0234('0x2c')](function(_0x4b90c0){if(_0x4b90c0){return _0x4b90c0[_0x0234('0x88')](_0x210816[_0x0234('0x39')][_0x0234('0x76')])[_0x0234('0x2c')](function(){if(_['isArray'](_0x210816[_0x0234('0x39')][_0x0234('0x76')])){for(var _0x2c985b=0x0;_0x2c985b<_0x210816[_0x0234('0x39')][_0x0234('0x76')][_0x0234('0x3f')];_0x2c985b+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x210816[_0x0234('0x39')][_0x0234('0x76')][_0x2c985b]),'SmsQueueId':Number(_0x210816[_0x0234('0x5a')]['id'])});}}else{socket[_0x0234('0x74')](_0x0234('0x8a'),{'UserId':Number(_0x210816[_0x0234('0x39')][_0x0234('0x76')]),'SmsQueueId':Number(_0x210816[_0x0234('0x5a')]['id'])});}});}})[_0x0234('0x2c')](respondWithStatusCode(_0x160f82,null))[_0x0234('0x4e')](handleError(_0x160f82,null));};exports[_0x0234('0x8f')]=function(_0x1f290c,_0x4decdc,_0x55c372){var _0x33dce9={};var _0x5da6f1={};var _0xb2572e;var _0x99676a;return db[_0x0234('0x34')]['findOne']({'where':{'id':_0x1f290c[_0x0234('0x5a')]['id']}})[_0x0234('0x2c')](handleEntityNotFound(_0x4decdc,null))['then'](function(_0x406518){if(_0x406518){_0xb2572e=_0x406518;_0x5da6f1[_0x0234('0x38')]=_[_0x0234('0x3a')](db[_0x0234('0x77')][_0x0234('0x35')]);_0x5da6f1[_0x0234('0x39')]=_[_0x0234('0x3a')](_0x1f290c['query']);_0x5da6f1['filters']=_[_0x0234('0x3c')](_0x5da6f1['model'],_0x5da6f1[_0x0234('0x39')]);_0x33dce9[_0x0234('0x3d')]=_[_0x0234('0x3c')](_0x5da6f1[_0x0234('0x38')],qs[_0x0234('0x3e')](_0x1f290c[_0x0234('0x39')][_0x0234('0x3e')]));_0x33dce9[_0x0234('0x3d')]=_0x33dce9['attributes']['length']?_0x33dce9[_0x0234('0x3d')]:_0x5da6f1[_0x0234('0x38')];_0x33dce9[_0x0234('0x43')]=qs[_0x0234('0x44')](_0x1f290c[_0x0234('0x39')][_0x0234('0x44')]);_0x33dce9[_0x0234('0x45')]=qs['filters'](_['pick'](_0x1f290c[_0x0234('0x39')],_0x5da6f1['filters']));if(_0x1f290c['query']['filter']){_0x33dce9['where']=_[_0x0234('0x48')](_0x33dce9[_0x0234('0x45')],{'$or':_['map'](_0x33dce9[_0x0234('0x3d')],function(_0x1bde7f){var _0x23fc79={};_0x23fc79[_0x1bde7f]={'$like':'%'+_0x1f290c[_0x0234('0x39')][_0x0234('0x47')]+'%'};return _0x23fc79;})});}_0x33dce9=_[_0x0234('0x48')]({},_0x33dce9,_0x1f290c[_0x0234('0x4a')]);return _0xb2572e[_0x0234('0x8f')](_0x33dce9);}})[_0x0234('0x2c')](function(_0x5009c9){if(_0x5009c9){_0x99676a=_0x5009c9[_0x0234('0x3f')];if(!_0x1f290c[_0x0234('0x39')][_0x0234('0x40')](_0x0234('0x41'))){_0x33dce9[_0x0234('0x42')]=qs[_0x0234('0x42')](_0x1f290c[_0x0234('0x39')][_0x0234('0x42')]);_0x33dce9[_0x0234('0x25')]=qs[_0x0234('0x25')](_0x1f290c[_0x0234('0x39')]['offset']);}return _0xb2572e[_0x0234('0x8f')](_0x33dce9);}})[_0x0234('0x2c')](function(_0x470f3d){if(_0x470f3d){return _0x470f3d?{'count':_0x99676a,'rows':_0x470f3d}:null;}})['then'](respondWithResult(_0x4decdc,null))[_0x0234('0x4e')](handleError(_0x4decdc,null));}; \ No newline at end of file +var _0x653b=['destroy','then','get','SmsQueues','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','filter','where','VIRTUAL','SmsQueue','includeAll','include','rows','catch','show','keys','length','merge','options','find','create','body','role','UserProfileSection','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','pick','findAll','UserId','agent','updatedAt','createdAt','format','%s/%s','smsPause','getTeams','Team','order','nolimit','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','UserSmsQueue','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x52244f,_0x4aaff6){var _0x2164ad=function(_0x2593e8){while(--_0x2593e8){_0x52244f['push'](_0x52244f['shift']());}};_0x2164ad(++_0x4aaff6);}(_0x653b,0xf4));var _0xb653=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x653b[_0x24fa1a];return _0xc5621f;};'use strict';var emlformat=require(_0xb653('0x0'));var rimraf=require(_0xb653('0x1'));var zipdir=require(_0xb653('0x2'));var jsonpatch=require(_0xb653('0x3'));var rp=require(_0xb653('0x4'));var moment=require('moment');var BPromise=require(_0xb653('0x5'));var Mustache=require(_0xb653('0x6'));var util=require(_0xb653('0x7'));var path=require(_0xb653('0x8'));var sox=require('sox');var csv=require(_0xb653('0x9'));var ejs=require(_0xb653('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb653('0xb'));var squel=require(_0xb653('0xc'));var crypto=require(_0xb653('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb653('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb653('0xf'));var Redis=require(_0xb653('0x10'));var authService=require(_0xb653('0x11'));var qs=require(_0xb653('0x12'));var as=require(_0xb653('0x13'));var hardwareService=require(_0xb653('0x14'));var logger=require(_0xb653('0x15'))('api');var utils=require(_0xb653('0x16'));var config=require(_0xb653('0x17'));var licenseUtil=require(_0xb653('0x18'));var db=require(_0xb653('0x19'))['db'];config['redis']=_[_0xb653('0x1a')](config[_0xb653('0x1b')],{'host':_0xb653('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb653('0x1b')]));require(_0xb653('0x1d'))[_0xb653('0x1e')](socket);function respondWithStatusCode(_0x27d7e0,_0x1e3310){_0x1e3310=_0x1e3310||0xcc;return function(_0x2db2f6){if(_0x2db2f6){return _0x27d7e0[_0xb653('0x1f')](_0x1e3310);}return _0x27d7e0[_0xb653('0x20')](_0x1e3310)[_0xb653('0x21')]();};}function respondWithResult(_0x554b4c,_0x3df6da){_0x3df6da=_0x3df6da||0xc8;return function(_0x2fe388){if(_0x2fe388){return _0x554b4c[_0xb653('0x20')](_0x3df6da)['json'](_0x2fe388);}};}function respondWithFilteredResult(_0x37f3ef,_0x3ffdef){return function(_0x1be387){if(_0x1be387){var _0x2636e4=typeof _0x3ffdef[_0xb653('0x22')]===_0xb653('0x23')&&typeof _0x3ffdef[_0xb653('0x24')]==='undefined';var _0x372333=_0x1be387[_0xb653('0x25')];var _0x5d2b3d=_0x2636e4?0x0:_0x3ffdef[_0xb653('0x22')];var _0x356dd1=_0x2636e4?_0x1be387[_0xb653('0x25')]:_0x3ffdef[_0xb653('0x22')]+_0x3ffdef[_0xb653('0x24')];var _0x31f5c9;if(_0x356dd1>=_0x372333){_0x356dd1=_0x372333;_0x31f5c9=0xc8;}else{_0x31f5c9=0xce;}_0x37f3ef[_0xb653('0x20')](_0x31f5c9);return _0x37f3ef[_0xb653('0x26')](_0xb653('0x27'),_0x5d2b3d+'-'+_0x356dd1+'/'+_0x372333)[_0xb653('0x28')](_0x1be387);}return null;};}function patchUpdates(_0x20d64f){return function(_0x5e8cb8){try{jsonpatch[_0xb653('0x29')](_0x5e8cb8,_0x20d64f,!![]);}catch(_0x52ad03){return BPromise[_0xb653('0x2a')](_0x52ad03);}return _0x5e8cb8[_0xb653('0x2b')]();};}function saveUpdates(_0x2725e9,_0x2c3388){return function(_0x13c419){if(_0x13c419){return _0x13c419['update'](_0x2725e9)['then'](function(_0x2baeb2){return _0x2baeb2;});}return null;};}function removeEntity(_0xab94e2,_0x5064d7){return function(_0x567ddd){if(_0x567ddd){return _0x567ddd[_0xb653('0x2c')]()[_0xb653('0x2d')](function(){var _0x501d=_0x567ddd[_0xb653('0x2e')]({'plain':!![]});var _0x401620=_0xb653('0x2f');return db[_0xb653('0x30')][_0xb653('0x2c')]({'where':{'type':_0x401620,'resourceId':_0x501d['id']}})[_0xb653('0x2d')](function(){return _0x567ddd;});})[_0xb653('0x2d')](function(){_0xab94e2['status'](0xcc)[_0xb653('0x21')]();});}};}function handleEntityNotFound(_0x65a10b,_0x1f6817){return function(_0x4140c7){if(!_0x4140c7){_0x65a10b[_0xb653('0x1f')](0x194);}return _0x4140c7;};}function handleError(_0x31e2ce,_0x4c07bf){_0x4c07bf=_0x4c07bf||0x1f4;return function(_0x351ca0){logger[_0xb653('0x31')](_0x351ca0[_0xb653('0x32')]);if(_0x351ca0['name']){delete _0x351ca0['name'];}_0x31e2ce[_0xb653('0x20')](_0x4c07bf)[_0xb653('0x33')](_0x351ca0);};}exports[_0xb653('0x34')]=function(_0xc39d2d,_0x5753fc){var _0x169d27={},_0x4db910={},_0x24571a={'count':0x0,'rows':[]};var _0x561229=_[_0xb653('0x35')](db['SmsQueue'][_0xb653('0x36')],function(_0x5ede84){return{'name':_0x5ede84[_0xb653('0x37')],'type':_0x5ede84[_0xb653('0x38')]['key']};});_0x4db910[_0xb653('0x39')]=_['map'](_0x561229,'name');_0x4db910[_0xb653('0x3a')]=_['keys'](_0xc39d2d[_0xb653('0x3a')]);_0x4db910[_0xb653('0x3b')]=_['intersection'](_0x4db910[_0xb653('0x39')],_0x4db910[_0xb653('0x3a')]);_0x169d27[_0xb653('0x3c')]=_[_0xb653('0x3d')](_0x4db910[_0xb653('0x39')],qs[_0xb653('0x3e')](_0xc39d2d['query']['fields']));_0x169d27[_0xb653('0x3c')]=_0x169d27[_0xb653('0x3c')]['length']?_0x169d27[_0xb653('0x3c')]:_0x4db910[_0xb653('0x39')];if(!_0xc39d2d[_0xb653('0x3a')][_0xb653('0x3f')]('nolimit')){_0x169d27[_0xb653('0x24')]=qs[_0xb653('0x24')](_0xc39d2d[_0xb653('0x3a')][_0xb653('0x24')]);_0x169d27[_0xb653('0x22')]=qs[_0xb653('0x22')](_0xc39d2d[_0xb653('0x3a')][_0xb653('0x22')]);}_0x169d27['order']=qs[_0xb653('0x40')](_0xc39d2d[_0xb653('0x3a')][_0xb653('0x40')]);_0x169d27['where']=qs[_0xb653('0x3b')](_['pick'](_0xc39d2d[_0xb653('0x3a')],_0x4db910[_0xb653('0x3b')]),_0x561229);if(_0xc39d2d['query'][_0xb653('0x41')]){_0x169d27[_0xb653('0x42')]=_['merge'](_0x169d27[_0xb653('0x42')],{'$or':_['map'](_0x561229,function(_0x59c74d){if(_0x59c74d['type']!==_0xb653('0x43')){var _0x433ebe={};_0x433ebe[_0x59c74d['name']]={'$like':'%'+_0xc39d2d[_0xb653('0x3a')][_0xb653('0x41')]+'%'};return _0x433ebe;}})});}_0x169d27=_['merge']({},_0x169d27,_0xc39d2d['options']);var _0x5cace5={'where':_0x169d27[_0xb653('0x42')]};return db[_0xb653('0x44')]['count'](_0x5cace5)[_0xb653('0x2d')](function(_0x5c78c7){_0x24571a[_0xb653('0x25')]=_0x5c78c7;if(_0xc39d2d[_0xb653('0x3a')][_0xb653('0x45')]){_0x169d27[_0xb653('0x46')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x169d27);})[_0xb653('0x2d')](function(_0x59a2ca){_0x24571a[_0xb653('0x47')]=_0x59a2ca;return _0x24571a;})[_0xb653('0x2d')](respondWithFilteredResult(_0x5753fc,_0x169d27))[_0xb653('0x48')](handleError(_0x5753fc,null));};exports[_0xb653('0x49')]=function(_0x29040c,_0x1f7195){var _0xf9d56a={'raw':!![],'where':{'id':_0x29040c['params']['id']}},_0x3b1041={};_0x3b1041[_0xb653('0x39')]=_[_0xb653('0x4a')](db[_0xb653('0x44')][_0xb653('0x36')]);_0x3b1041[_0xb653('0x3a')]=_['keys'](_0x29040c[_0xb653('0x3a')]);_0x3b1041['filters']=_[_0xb653('0x3d')](_0x3b1041[_0xb653('0x39')],_0x3b1041['query']);_0xf9d56a[_0xb653('0x3c')]=_[_0xb653('0x3d')](_0x3b1041[_0xb653('0x39')],qs[_0xb653('0x3e')](_0x29040c[_0xb653('0x3a')][_0xb653('0x3e')]));_0xf9d56a[_0xb653('0x3c')]=_0xf9d56a[_0xb653('0x3c')][_0xb653('0x4b')]?_0xf9d56a[_0xb653('0x3c')]:_0x3b1041[_0xb653('0x39')];if(_0x29040c[_0xb653('0x3a')][_0xb653('0x45')]){_0xf9d56a[_0xb653('0x46')]=[{'all':!![]}];}_0xf9d56a=_[_0xb653('0x4c')]({},_0xf9d56a,_0x29040c[_0xb653('0x4d')]);return db[_0xb653('0x44')][_0xb653('0x4e')](_0xf9d56a)[_0xb653('0x2d')](handleEntityNotFound(_0x1f7195,null))['then'](respondWithResult(_0x1f7195,null))[_0xb653('0x48')](handleError(_0x1f7195,null));};exports[_0xb653('0x4f')]=function(_0x43b150,_0x544118){return db['SmsQueue'][_0xb653('0x4f')](_0x43b150[_0xb653('0x50')],{})['then'](function(_0x543933){var _0x40c375=_0x43b150['user'][_0xb653('0x2e')]({'plain':!![]});if(!_0x40c375)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40c375[_0xb653('0x51')]==='user'){var _0x4c4132=_0x543933[_0xb653('0x2e')]({'plain':!![]});var _0x1d25f2=_0xb653('0x2f');return db[_0xb653('0x52')][_0xb653('0x4e')]({'where':{'name':_0x1d25f2,'userProfileId':_0x40c375[_0xb653('0x53')]},'raw':!![]})['then'](function(_0xcc2ab5){if(_0xcc2ab5&&_0xcc2ab5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4c4132[_0xb653('0x54')],'resourceId':_0x4c4132['id'],'type':_0xcc2ab5[_0xb653('0x54')],'sectionId':_0xcc2ab5['id']},{})['then'](function(){return _0x543933;});}else{return _0x543933;}})[_0xb653('0x48')](function(_0x2afeb5){logger['error'](_0xb653('0x55'),_0x2afeb5);throw _0x2afeb5;});}return _0x543933;})[_0xb653('0x2d')](respondWithResult(_0x544118,0xc9))['catch'](handleError(_0x544118,null));};exports[_0xb653('0x56')]=function(_0x45ee8d,_0x21f68f){if(_0x45ee8d[_0xb653('0x50')]['id']){delete _0x45ee8d[_0xb653('0x50')]['id'];}return db[_0xb653('0x44')][_0xb653('0x4e')]({'where':{'id':_0x45ee8d[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x21f68f,null))[_0xb653('0x2d')](saveUpdates(_0x45ee8d[_0xb653('0x50')],null))['then'](respondWithResult(_0x21f68f,null))[_0xb653('0x48')](handleError(_0x21f68f,null));};exports['destroy']=function(_0x538ee2,_0x263c78){return db['SmsQueue'][_0xb653('0x4e')]({'where':{'id':_0x538ee2[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x263c78,null))['then'](removeEntity(_0x263c78,null))[_0xb653('0x48')](handleError(_0x263c78,null));};exports[_0xb653('0x58')]=function(_0x5c7c41,_0x5da8ba){return db[_0xb653('0x44')][_0xb653('0x58')]()[_0xb653('0x2d')](respondWithResult(_0x5da8ba,null))['catch'](handleError(_0x5da8ba,null));};exports['getMembers']=function(_0xfb80f6,_0x466d0a,_0x4939d6){var _0x378299={'raw':!![],'where':{}},_0x2e418c={},_0x39d9ff;return db[_0xb653('0x44')][_0xb653('0x59')]({'where':{'id':_0xfb80f6[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x466d0a,null))[_0xb653('0x2d')](function(_0x45bd13){if(_0x45bd13){_0x39d9ff=_0x45bd13[_0xb653('0x2e')]({'plain':!![]});_0x2e418c[_0xb653('0x39')]=_[_0xb653('0x4a')](db['UserSmsQueue']['rawAttributes']);_0x2e418c[_0xb653('0x3a')]=_[_0xb653('0x4a')](_0xfb80f6[_0xb653('0x3a')]);_0x2e418c['filters']=_[_0xb653('0x3d')](_0x2e418c[_0xb653('0x39')],_0x2e418c[_0xb653('0x3a')]);_0x378299[_0xb653('0x3c')]=_['intersection'](_0x2e418c[_0xb653('0x39')],qs[_0xb653('0x3e')](_0xfb80f6[_0xb653('0x3a')]['fields']));_0x378299[_0xb653('0x3c')]=_0x378299[_0xb653('0x3c')][_0xb653('0x4b')]?_0x378299[_0xb653('0x3c')]:_0x2e418c[_0xb653('0x39')];if(!_0xfb80f6[_0xb653('0x3a')][_0xb653('0x3f')]('nolimit')){_0x378299[_0xb653('0x24')]=qs[_0xb653('0x24')](_0xfb80f6[_0xb653('0x3a')][_0xb653('0x24')]);_0x378299[_0xb653('0x22')]=qs[_0xb653('0x22')](_0xfb80f6[_0xb653('0x3a')][_0xb653('0x22')]);}_0x378299['order']=qs['sort'](_0xfb80f6[_0xb653('0x3a')][_0xb653('0x40')]);_0x378299[_0xb653('0x42')]=qs[_0xb653('0x3b')](_[_0xb653('0x5a')](_0xfb80f6[_0xb653('0x3a')],_0x2e418c[_0xb653('0x3b')]));_0x378299['where']['SmsQueueId']=_0x45bd13['id'];if(_0xfb80f6[_0xb653('0x3a')][_0xb653('0x41')]){_0x378299['where']=_[_0xb653('0x4c')](_0x378299[_0xb653('0x42')],{'$or':_[_0xb653('0x35')](_0x378299[_0xb653('0x3c')],function(_0x1ffc31){var _0x16a67d={};_0x16a67d[_0x1ffc31]={'$like':'%'+_0xfb80f6[_0xb653('0x3a')][_0xb653('0x41')]+'%'};return _0x16a67d;})});}_0x378299=_['merge']({},_0x378299,_0xfb80f6['options']);return db['UserSmsQueue'][_0xb653('0x5b')](_0x378299);}})[_0xb653('0x2d')](function(_0x588b16){if(_0x588b16){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x588b16,_0xb653('0x5c')),'role':_0xb653('0x5d')},'attributes':['id','name','smsPause',_0xb653('0x5e'),_0xb653('0x5f')]});}})['then'](function(_0x4ff680){if(_0x4ff680){return{'count':_0x4ff680[_0xb653('0x25')],'rows':_[_0xb653('0x35')](_0x4ff680['rows'],function(_0x3c7079){return{'membername':_0x3c7079[_0xb653('0x54')],'UserId':_0x3c7079['id'],'queue_name':_0x39d9ff[_0xb653('0x54')],'SmsQueueId':_0x39d9ff['id'],'interface':util[_0xb653('0x60')](_0xb653('0x61'),'SIP',_0x3c7079['name']),'penalty':0x0,'paused':_0x3c7079[_0xb653('0x62')],'createdAt':_0x3c7079[_0xb653('0x5f')],'updatedAt':_0x3c7079[_0xb653('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb653('0x2d')](respondWithFilteredResult(_0x466d0a,_0x378299))['catch'](handleError(_0x466d0a,null));};exports[_0xb653('0x63')]=function(_0x31a909,_0x4c8b9f,_0x5dc841){var _0x3a2e51={};var _0x4d7825={};var _0x2f3b40;var _0x20ee78;return db[_0xb653('0x44')][_0xb653('0x59')]({'where':{'id':_0x31a909['params']['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x4c8b9f,null))[_0xb653('0x2d')](function(_0x8cdac7){if(_0x8cdac7){_0x2f3b40=_0x8cdac7;_0x4d7825[_0xb653('0x39')]=_[_0xb653('0x4a')](db[_0xb653('0x64')]['rawAttributes']);_0x4d7825[_0xb653('0x3a')]=_[_0xb653('0x4a')](_0x31a909[_0xb653('0x3a')]);_0x4d7825['filters']=_[_0xb653('0x3d')](_0x4d7825['model'],_0x4d7825[_0xb653('0x3a')]);_0x3a2e51[_0xb653('0x3c')]=_['intersection'](_0x4d7825[_0xb653('0x39')],qs[_0xb653('0x3e')](_0x31a909['query'][_0xb653('0x3e')]));_0x3a2e51['attributes']=_0x3a2e51[_0xb653('0x3c')][_0xb653('0x4b')]?_0x3a2e51['attributes']:_0x4d7825['model'];_0x3a2e51[_0xb653('0x65')]=qs[_0xb653('0x40')](_0x31a909[_0xb653('0x3a')][_0xb653('0x40')]);_0x3a2e51[_0xb653('0x42')]=qs[_0xb653('0x3b')](_[_0xb653('0x5a')](_0x31a909['query'],_0x4d7825[_0xb653('0x3b')]));if(_0x31a909['query'][_0xb653('0x41')]){_0x3a2e51[_0xb653('0x42')]=_[_0xb653('0x4c')](_0x3a2e51[_0xb653('0x42')],{'$or':_['map'](_0x3a2e51[_0xb653('0x3c')],function(_0x381e0f){var _0x5a4aeb={};_0x5a4aeb[_0x381e0f]={'$like':'%'+_0x31a909[_0xb653('0x3a')][_0xb653('0x41')]+'%'};return _0x5a4aeb;})});}_0x3a2e51=_['merge']({},_0x3a2e51,_0x31a909[_0xb653('0x4d')]);return _0x2f3b40[_0xb653('0x63')](_0x3a2e51);}})[_0xb653('0x2d')](function(_0x9cd4ec){if(_0x9cd4ec){_0x20ee78=_0x9cd4ec[_0xb653('0x4b')];if(!_0x31a909[_0xb653('0x3a')][_0xb653('0x3f')](_0xb653('0x66'))){_0x3a2e51['limit']=qs['limit'](_0x31a909['query'][_0xb653('0x24')]);_0x3a2e51['offset']=qs[_0xb653('0x22')](_0x31a909[_0xb653('0x3a')]['offset']);}return _0x2f3b40[_0xb653('0x63')](_0x3a2e51);}})['then'](function(_0x124e9d){if(_0x124e9d){return _0x124e9d?{'count':_0x20ee78,'rows':_0x124e9d}:null;}})[_0xb653('0x2d')](respondWithResult(_0x4c8b9f,null))[_0xb653('0x48')](handleError(_0x4c8b9f,null));};exports[_0xb653('0x67')]=function(_0x2226a,_0x5d3da1,_0x6f6ac8){var _0x4e8889=_0x2226a['body'][_0xb653('0x68')];return db[_0xb653('0x64')][_0xb653('0x5b')]({'where':{'id':_0x4e8889},'attributes':['id'],'include':[{'model':db[_0xb653('0x69')],'as':_0xb653('0x6a'),'attributes':['id',_0xb653('0x54'),_0xb653('0x6b'),_0xb653('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0x151f77){if(_0x151f77){var _0x5d5da8=_[_0xb653('0x6d')](_0x151f77,function(_0x3c32e4){var _0x2e9361=_0x3c32e4[_0xb653('0x2e')]({'plain':!![]});return _0x2e9361[_0xb653('0x6a')];});return db[_0xb653('0x44')]['find']({'where':{'id':_0x2226a['params']['id']}})['then'](function(_0x1db082){return db[_0xb653('0x6e')][_0xb653('0x6f')](function(_0x4a789e){return _0x1db082['addTeams'](_0x4e8889,{'transaction':_0x4a789e})['then'](function(){return BPromise[_0xb653('0x70')](_0x5d5da8,function(_0x4c6de4){return db[_0xb653('0x71')][_0xb653('0x72')]({'where':{'UserId':_0x4c6de4['id'],'SmsQueueId':_0x2226a['params']['id']},'transaction':_0x4a789e});});})['then'](function(){_0x5d5da8['forEach'](function(_0xb2c64d){socket[_0xb653('0x73')](_0xb653('0x74'),{'UserId':_0xb2c64d['id'],'SmsQueueId':_0x1db082['id']});});});});});}})[_0xb653('0x2d')](respondWithStatusCode(_0x5d3da1,null))[_0xb653('0x48')](handleError(_0x5d3da1,null));};exports[_0xb653('0x75')]=function(_0x4ad5e4,_0x412b92,_0x28ed07){return db['Team']['findAll']({'where':{'id':_0x4ad5e4['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb653('0x69')],'as':_0xb653('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xb653('0x2d')](handleEntityNotFound(_0x412b92,null))[_0xb653('0x2d')](function(_0x3f9327){var _0x270b23=_[_0xb653('0x35')](_0x3f9327,'id');var _0x131d89=[];var _0x5cef50=[];var _0x287aa6=squel[_0xb653('0x76')]();_0x287aa6[_0xb653('0x77')](_0xb653('0x78'))[_0xb653('0x79')](_0xb653('0x7a'),'tq')[_0xb653('0x7b')](_0xb653('0x7c'),'ut',_0xb653('0x7d'))[_0xb653('0x42')](_0xb653('0x7e'),_0x4ad5e4[_0xb653('0x57')]['id']);for(var _0x493c59=0x0;_0x493c59<_0x3f9327[_0xb653('0x4b')];_0x493c59+=0x1){let _0x40edcf=_0x3f9327[_0x493c59];for(var _0x169413=0x0;_0x169413<_0x40edcf[_0xb653('0x6a')][_0xb653('0x4b')];_0x169413+=0x1){let _0x2b9bd5=_0x40edcf['Agents'][_0x169413];var _0x460ee9=_0x287aa6['clone']();_0x460ee9[_0xb653('0x42')](_0xb653('0x7f'),_0x2b9bd5['id']);_0x5cef50[_0xb653('0x80')](db['sequelize']['query'](_0x460ee9['toString'](),{'type':db[_0xb653('0x6e')][_0xb653('0x81')][_0xb653('0x82')]})[_0xb653('0x2d')](function(_0x1355e8){if(_0x1355e8[_0xb653('0x4b')]===0x1){return _0x2b9bd5['id'];}else{var _0x4f673d=_[_0xb653('0x83')](_[_0xb653('0x35')](_0x1355e8,_0xb653('0x84')),function(_0x256836){return _[_0xb653('0x85')](_0x270b23,_0x256836);});if(_0x4f673d){return _0x2b9bd5['id'];}}}));}}return BPromise[_0xb653('0x86')](_0x5cef50)['then'](function(_0x345eb3){_0x131d89=_(_0x131d89)[_0xb653('0x87')](_0x345eb3)['compact']()['value']();return db[_0xb653('0x44')][_0xb653('0x4e')]({'where':{'id':_0x4ad5e4[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](function(_0x48f7bf){return db[_0xb653('0x6e')][_0xb653('0x6f')](function(_0x2c21ca){return _0x48f7bf['removeTeams'](_0x4ad5e4[_0xb653('0x3a')][_0xb653('0x68')],{'transaction':_0x2c21ca})[_0xb653('0x2d')](function(){if(!_[_0xb653('0x88')](_0x131d89)){return _0x48f7bf[_0xb653('0x89')](_0x131d89,{'transaction':_0x2c21ca});}})[_0xb653('0x2d')](function(){_0x131d89[_0xb653('0x8a')](function(_0x41214c){socket[_0xb653('0x73')](_0xb653('0x8b'),{'UserId':_0x41214c,'SmsQueueId':_0x48f7bf['id']});});});});});});})['then'](respondWithStatusCode(_0x412b92,null))[_0xb653('0x48')](handleError(_0x412b92,null));};exports[_0xb653('0x8c')]=function(_0x26b2a9,_0x24f33e,_0x3bc29b){return db[_0xb653('0x44')][_0xb653('0x4e')]({'where':{'id':_0x26b2a9[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x24f33e,null))[_0xb653('0x2d')](function(_0x570496){if(_0x570496){return _0x570496[_0xb653('0x8c')](_0x26b2a9[_0xb653('0x50')][_0xb653('0x68')],_[_0xb653('0x8d')](_0x26b2a9[_0xb653('0x50')],[_0xb653('0x68'),'id'])||{})['spread'](function(_0x478662){for(var _0x362264=0x0;_0x362264<_0x26b2a9['body'][_0xb653('0x68')][_0xb653('0x4b')];_0x362264+=0x1){socket[_0xb653('0x73')](_0xb653('0x74'),{'UserId':Number(_0x26b2a9[_0xb653('0x50')][_0xb653('0x68')][_0x362264]),'SmsQueueId':Number(_0x26b2a9[_0xb653('0x57')]['id'])});}return _0x478662;});}})[_0xb653('0x2d')](respondWithResult(_0x24f33e,null))[_0xb653('0x48')](handleError(_0x24f33e,null));};exports[_0xb653('0x89')]=function(_0x47c13c,_0x59c305,_0x1c89a7){return db[_0xb653('0x44')][_0xb653('0x4e')]({'where':{'id':_0x47c13c['params']['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x59c305,null))[_0xb653('0x2d')](function(_0x4f27d6){if(_0x4f27d6){return _0x4f27d6[_0xb653('0x89')](_0x47c13c['query'][_0xb653('0x68')])[_0xb653('0x2d')](function(){if(_[_0xb653('0x8e')](_0x47c13c[_0xb653('0x3a')]['ids'])){for(var _0xce87e=0x0;_0xce87e<_0x47c13c['query']['ids'][_0xb653('0x4b')];_0xce87e+=0x1){socket[_0xb653('0x73')]('userSmsQueue:remove',{'UserId':Number(_0x47c13c[_0xb653('0x3a')][_0xb653('0x68')][_0xce87e]),'SmsQueueId':Number(_0x47c13c[_0xb653('0x57')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x47c13c[_0xb653('0x3a')][_0xb653('0x68')]),'SmsQueueId':Number(_0x47c13c[_0xb653('0x57')]['id'])});}});}})[_0xb653('0x2d')](respondWithStatusCode(_0x59c305,null))[_0xb653('0x48')](handleError(_0x59c305,null));};exports[_0xb653('0x8f')]=function(_0x3221df,_0x252928,_0x2380d1){var _0x1c9e3d={};var _0x2cd431={};var _0x4263f1;var _0x3914be;return db['SmsQueue'][_0xb653('0x59')]({'where':{'id':_0x3221df[_0xb653('0x57')]['id']}})[_0xb653('0x2d')](handleEntityNotFound(_0x252928,null))[_0xb653('0x2d')](function(_0x34c112){if(_0x34c112){_0x4263f1=_0x34c112;_0x2cd431[_0xb653('0x39')]=_[_0xb653('0x4a')](db[_0xb653('0x69')][_0xb653('0x36')]);_0x2cd431[_0xb653('0x3a')]=_[_0xb653('0x4a')](_0x3221df[_0xb653('0x3a')]);_0x2cd431[_0xb653('0x3b')]=_[_0xb653('0x3d')](_0x2cd431[_0xb653('0x39')],_0x2cd431[_0xb653('0x3a')]);_0x1c9e3d[_0xb653('0x3c')]=_['intersection'](_0x2cd431[_0xb653('0x39')],qs[_0xb653('0x3e')](_0x3221df[_0xb653('0x3a')]['fields']));_0x1c9e3d[_0xb653('0x3c')]=_0x1c9e3d[_0xb653('0x3c')][_0xb653('0x4b')]?_0x1c9e3d['attributes']:_0x2cd431[_0xb653('0x39')];_0x1c9e3d[_0xb653('0x65')]=qs[_0xb653('0x40')](_0x3221df['query'][_0xb653('0x40')]);_0x1c9e3d[_0xb653('0x42')]=qs[_0xb653('0x3b')](_[_0xb653('0x5a')](_0x3221df[_0xb653('0x3a')],_0x2cd431[_0xb653('0x3b')]));if(_0x3221df[_0xb653('0x3a')][_0xb653('0x41')]){_0x1c9e3d[_0xb653('0x42')]=_['merge'](_0x1c9e3d[_0xb653('0x42')],{'$or':_[_0xb653('0x35')](_0x1c9e3d[_0xb653('0x3c')],function(_0x27cbd6){var _0x3b31c3={};_0x3b31c3[_0x27cbd6]={'$like':'%'+_0x3221df[_0xb653('0x3a')][_0xb653('0x41')]+'%'};return _0x3b31c3;})});}_0x1c9e3d=_[_0xb653('0x4c')]({},_0x1c9e3d,_0x3221df[_0xb653('0x4d')]);return _0x4263f1[_0xb653('0x8f')](_0x1c9e3d);}})[_0xb653('0x2d')](function(_0x1570f5){if(_0x1570f5){_0x3914be=_0x1570f5[_0xb653('0x4b')];if(!_0x3221df['query'][_0xb653('0x3f')]('nolimit')){_0x1c9e3d[_0xb653('0x24')]=qs['limit'](_0x3221df[_0xb653('0x3a')][_0xb653('0x24')]);_0x1c9e3d[_0xb653('0x22')]=qs[_0xb653('0x22')](_0x3221df['query'][_0xb653('0x22')]);}return _0x4263f1[_0xb653('0x8f')](_0x1c9e3d);}})[_0xb653('0x2d')](function(_0x4fe5ec){if(_0x4fe5ec){return _0x4fe5ec?{'count':_0x3914be,'rows':_0x4fe5ec}:null;}})['then'](respondWithResult(_0x252928,null))['catch'](handleError(_0x252928,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 20a8e28..310658d 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 _0x05ce=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x2bf5d1,_0x14e28f){var _0x3472c6=function(_0xa369da){while(--_0xa369da){_0x2bf5d1['push'](_0x2bf5d1['shift']());}};_0x3472c6(++_0x14e28f);}(_0x05ce,0x139));var _0xe05c=function(_0x5df414,_0x5cfd1f){_0x5df414=_0x5df414-0x0;var _0x11f365=_0x05ce[_0x5df414];return _0x11f365;};'use strict';var EventEmitter=require(_0xe05c('0x0'));var SmsQueue=require(_0xe05c('0x1'))['db'][_0xe05c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe05c('0x3')](0x0);var events={'afterCreate':_0xe05c('0x4'),'afterUpdate':_0xe05c('0x5'),'afterDestroy':_0xe05c('0x6')};function emitEvent(_0x94cbbe){return function(_0x25a3ab,_0x3f6539,_0x2faecb){SmsQueueEvents[_0xe05c('0x7')](_0x94cbbe+':'+_0x25a3ab['id'],_0x25a3ab);SmsQueueEvents[_0xe05c('0x7')](_0x94cbbe,_0x25a3ab);_0x2faecb(null);};}for(var e in events){if(events[_0xe05c('0x8')](e)){var event=events[e];SmsQueue[_0xe05c('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xc10e=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0xc10e,0xba));var _0xec10=function(_0x506859,_0x24b589){_0x506859=_0x506859-0x0;var _0x31c601=_0xc10e[_0x506859];return _0x31c601;};'use strict';var EventEmitter=require(_0xec10('0x0'));var SmsQueue=require(_0xec10('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xec10('0x2')](0x0);var events={'afterCreate':_0xec10('0x3'),'afterUpdate':_0xec10('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20f8c2){return function(_0xb3b786,_0x531b98,_0x4c6532){SmsQueueEvents[_0xec10('0x5')](_0x20f8c2+':'+_0xb3b786['id'],_0xb3b786);SmsQueueEvents['emit'](_0x20f8c2,_0xb3b786);_0x4c6532(null);};}for(var e in events){if(events[_0xec10('0x6')](e)){var event=events[e];SmsQueue[_0xec10('0x7')](e,emitEvent(event));}}module[_0xec10('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e82d92d..3a1383b 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 _0xbd21=['bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api'];(function(_0x169b15,_0x3c8372){var _0x520f7c=function(_0x450676){while(--_0x450676){_0x169b15['push'](_0x169b15['shift']());}};_0x520f7c(++_0x3c8372);}(_0xbd21,0xf9));var _0x1bd2=function(_0xd538d9,_0x5ea871){_0xd538d9=_0xd538d9-0x0;var _0x4aa3b5=_0xbd21[_0xd538d9];return _0x4aa3b5;};'use strict';var _=require(_0x1bd2('0x0'));var util=require(_0x1bd2('0x1'));var logger=require('../../config/logger')(_0x1bd2('0x2'));var moment=require('moment');var BPromise=require(_0x1bd2('0x3'));var rp=require(_0x1bd2('0x4'));var fs=require('fs');var path=require(_0x1bd2('0x5'));var rimraf=require('rimraf');var config=require(_0x1bd2('0x6'));var attributes=require(_0x1bd2('0x7'));module[_0x1bd2('0x8')]=function(_0x222fb4,_0x667226){return _0x222fb4[_0x1bd2('0x9')](_0x1bd2('0xa'),attributes,{'tableName':_0x1bd2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbfc=['request-promise','path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird'];(function(_0x417849,_0x8008e5){var _0x54e727=function(_0x4650a3){while(--_0x4650a3){_0x417849['push'](_0x417849['shift']());}};_0x54e727(++_0x8008e5);}(_0xfbfc,0x14b));var _0xcfbf=function(_0x1226aa,_0x194766){_0x1226aa=_0x1226aa-0x0;var _0x32bac9=_0xfbfc[_0x1226aa];return _0x32bac9;};'use strict';var _=require(_0xcfbf('0x0'));var util=require(_0xcfbf('0x1'));var logger=require('../../config/logger')(_0xcfbf('0x2'));var moment=require(_0xcfbf('0x3'));var BPromise=require(_0xcfbf('0x4'));var rp=require(_0xcfbf('0x5'));var fs=require('fs');var path=require(_0xcfbf('0x6'));var rimraf=require('rimraf');var config=require(_0xcfbf('0x7'));var attributes=require(_0xcfbf('0x8'));module['exports']=function(_0x5c153b,_0x14098d){return _0x5c153b[_0xcfbf('0x9')](_0xcfbf('0xa'),attributes,{'tableName':_0xcfbf('0xb'),'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 8d07d57..65767b9 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 _0x7cce=['jayson/promise','client','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','attributes','include','map','model','debug','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3972d4,_0x559f40){var _0x305f12=function(_0x5e4cac){while(--_0x5e4cac){_0x3972d4['push'](_0x3972d4['shift']());}};_0x305f12(++_0x559f40);}(_0x7cce,0xb5));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7cc('0x0'));var util=require(_0xe7cc('0x1'));var moment=require(_0xe7cc('0x2'));var BPromise=require(_0xe7cc('0x3'));var rs=require(_0xe7cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7cc('0x5'))['db'];var utils=require(_0xe7cc('0x6'));var logger=require(_0xe7cc('0x7'))(_0xe7cc('0x8'));var config=require('../../config/environment');var jayson=require(_0xe7cc('0x9'));var client=jayson[_0xe7cc('0xa')]['http']({'port':0x232a});config[_0xe7cc('0xb')]=_['defaults'](config[_0xe7cc('0xb')],{'host':_0xe7cc('0xc'),'port':0x18eb});var socket=require(_0xe7cc('0xd'))(new Redis(config[_0xe7cc('0xb')]));require(_0xe7cc('0xe'))['register'](socket);function respondWithRpcPromise(_0x3152de,_0x54d2a7,_0x4e23b2){return new BPromise(function(_0x7a4d5e,_0x57917a){return client[_0xe7cc('0xf')](_0x3152de,_0x4e23b2)[_0xe7cc('0x10')](function(_0x569d92){logger[_0xe7cc('0x11')](_0xe7cc('0x12'),_0x54d2a7,_0xe7cc('0x13'));logger['debug'](_0xe7cc('0x14'),_0x54d2a7,_0xe7cc('0x13'),JSON[_0xe7cc('0x15')](_0x569d92));if(_0x569d92[_0xe7cc('0x16')]){if(_0x569d92[_0xe7cc('0x16')][_0xe7cc('0x17')]===0x1f4){logger[_0xe7cc('0x16')](_0xe7cc('0x12'),_0x54d2a7,_0x569d92['error']['message']);return _0x57917a(_0x569d92[_0xe7cc('0x16')][_0xe7cc('0x18')]);}logger[_0xe7cc('0x16')](_0xe7cc('0x12'),_0x54d2a7,_0x569d92['error']['message']);return _0x7a4d5e(_0x569d92[_0xe7cc('0x16')]['message']);}else{logger['info'](_0xe7cc('0x12'),_0x54d2a7,'request\x20sent');_0x7a4d5e(_0x569d92[_0xe7cc('0x19')][_0xe7cc('0x18')]);}})[_0xe7cc('0x1a')](function(_0x4206af){logger[_0xe7cc('0x16')](_0xe7cc('0x12'),_0x54d2a7,_0x4206af);_0x57917a(_0x4206af);});});}exports[_0xe7cc('0x1b')]=function(_0x6d3ed7){var _0x1210d9=this;return new Promise(function(_0x1730f7,_0x3bf040){return db[_0xe7cc('0x1c')]['findAll']({'raw':_0x6d3ed7[_0xe7cc('0x1d')]?_0x6d3ed7[_0xe7cc('0x1d')][_0xe7cc('0x1e')]===undefined?!![]:![]:!![],'where':_0x6d3ed7['options']?_0x6d3ed7[_0xe7cc('0x1d')]['where']||null:null,'attributes':_0x6d3ed7[_0xe7cc('0x1d')]?_0x6d3ed7[_0xe7cc('0x1d')][_0xe7cc('0x1f')]||null:null,'limit':_0x6d3ed7[_0xe7cc('0x1d')]?_0x6d3ed7[_0xe7cc('0x1d')]['limit']||null:null,'include':_0x6d3ed7[_0xe7cc('0x1d')]?_0x6d3ed7[_0xe7cc('0x1d')][_0xe7cc('0x20')]?_[_0xe7cc('0x21')](_0x6d3ed7[_0xe7cc('0x1d')][_0xe7cc('0x20')],function(_0x412501){return{'model':db[_0x412501[_0xe7cc('0x22')]],'as':_0x412501['as'],'attributes':_0x412501[_0xe7cc('0x1f')],'include':_0x412501[_0xe7cc('0x20')]?_[_0xe7cc('0x21')](_0x412501[_0xe7cc('0x20')],function(_0xf453db){return{'model':db[_0xf453db[_0xe7cc('0x22')]],'as':_0xf453db['as'],'attributes':_0xf453db['attributes'],'include':_0xf453db[_0xe7cc('0x20')]?_[_0xe7cc('0x21')](_0xf453db[_0xe7cc('0x20')],function(_0x227352){return{'model':db[_0x227352['model']],'as':_0x227352['as'],'attributes':_0x227352[_0xe7cc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe7cc('0x10')](function(_0xf66d32){logger['info'](_0xe7cc('0x1b'),_0x6d3ed7);logger[_0xe7cc('0x23')]('GetSmsQueue',_0x6d3ed7,JSON[_0xe7cc('0x15')](_0xf66d32));_0x1730f7(_0xf66d32);})[_0xe7cc('0x1a')](function(_0x3142b2){logger[_0xe7cc('0x16')](_0xe7cc('0x1b'),_0x3142b2['message'],_0x6d3ed7);_0x3bf040(_0x1210d9['error'](0x1f4,_0x3142b2[_0xe7cc('0x18')]));});});};exports['ShowSmsQueue']=function(_0x13b737){var _0x3569ef=this;return new Promise(function(_0x3e9228,_0x37dea5){return db['SmsQueue'][_0xe7cc('0x24')]({'raw':_0x13b737[_0xe7cc('0x1d')]?_0x13b737['options'][_0xe7cc('0x1e')]===undefined?!![]:![]:!![],'where':_0x13b737[_0xe7cc('0x1d')]?_0x13b737['options']['where']||null:null,'attributes':_0x13b737[_0xe7cc('0x1d')]?_0x13b737['options'][_0xe7cc('0x1f')]||null:null,'include':_0x13b737[_0xe7cc('0x1d')]?_0x13b737[_0xe7cc('0x1d')]['include']?_[_0xe7cc('0x21')](_0x13b737[_0xe7cc('0x1d')]['include'],function(_0x13e17e){return{'model':db[_0x13e17e[_0xe7cc('0x22')]],'as':_0x13e17e['as'],'attributes':_0x13e17e[_0xe7cc('0x1f')],'include':_0x13e17e[_0xe7cc('0x20')]?_[_0xe7cc('0x21')](_0x13e17e[_0xe7cc('0x20')],function(_0x431ea4){return{'model':db[_0x431ea4[_0xe7cc('0x22')]],'as':_0x431ea4['as'],'attributes':_0x431ea4[_0xe7cc('0x1f')],'include':_0x431ea4[_0xe7cc('0x20')]?_['map'](_0x431ea4['include'],function(_0x3be86c){return{'model':db[_0x3be86c[_0xe7cc('0x22')]],'as':_0x3be86c['as'],'attributes':_0x3be86c[_0xe7cc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe7cc('0x10')](function(_0x3b4b72){logger[_0xe7cc('0x11')](_0xe7cc('0x25'),_0x13b737);logger['debug']('ShowSmsQueue',_0x13b737,JSON[_0xe7cc('0x15')](_0x3b4b72));_0x3e9228(_0x3b4b72);})[_0xe7cc('0x1a')](function(_0x48694f){logger[_0xe7cc('0x16')](_0xe7cc('0x25'),_0x48694f['message'],_0x13b737);_0x37dea5(_0x3569ef['error'](0x1f4,_0x48694f[_0xe7cc('0x18')]));});});}; \ No newline at end of file +var _0x2303=['where','limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','SmsQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','findAll','options'];(function(_0x5c33cb,_0x21ec9b){var _0x5644aa=function(_0x45ec6f){while(--_0x45ec6f){_0x5c33cb['push'](_0x5c33cb['shift']());}};_0x5644aa(++_0x21ec9b);}(_0x2303,0x196));var _0x3230=function(_0x233c9a,_0x173748){_0x233c9a=_0x233c9a-0x0;var _0x68211c=_0x2303[_0x233c9a];return _0x68211c;};'use strict';var _=require(_0x3230('0x0'));var util=require(_0x3230('0x1'));var moment=require(_0x3230('0x2'));var BPromise=require(_0x3230('0x3'));var rs=require(_0x3230('0x4'));var fs=require('fs');var Redis=require(_0x3230('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3230('0x6'));var logger=require(_0x3230('0x7'))(_0x3230('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3230('0x9')]({'port':0x232a});config[_0x3230('0xa')]=_['defaults'](config[_0x3230('0xa')],{'host':_0x3230('0xb'),'port':0x18eb});var socket=require(_0x3230('0xc'))(new Redis(config[_0x3230('0xa')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x8fa865,_0x21dc4f,_0x420cd9){return new BPromise(function(_0x1ca0b1,_0x229e7f){return client[_0x3230('0xd')](_0x8fa865,_0x420cd9)[_0x3230('0xe')](function(_0x45a904){logger['info'](_0x3230('0xf'),_0x21dc4f,_0x3230('0x10'));logger[_0x3230('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x21dc4f,_0x3230('0x10'),JSON[_0x3230('0x12')](_0x45a904));if(_0x45a904[_0x3230('0x13')]){if(_0x45a904['error']['code']===0x1f4){logger[_0x3230('0x13')](_0x3230('0xf'),_0x21dc4f,_0x45a904['error'][_0x3230('0x14')]);return _0x229e7f(_0x45a904[_0x3230('0x13')][_0x3230('0x14')]);}logger[_0x3230('0x13')](_0x3230('0xf'),_0x21dc4f,_0x45a904[_0x3230('0x13')]['message']);return _0x1ca0b1(_0x45a904[_0x3230('0x13')][_0x3230('0x14')]);}else{logger[_0x3230('0x15')]('SmsQueue,\x20%s,\x20%s',_0x21dc4f,_0x3230('0x10'));_0x1ca0b1(_0x45a904[_0x3230('0x16')]['message']);}})[_0x3230('0x17')](function(_0x55e95e){logger['error'](_0x3230('0xf'),_0x21dc4f,_0x55e95e);_0x229e7f(_0x55e95e);});});}exports['GetSmsQueue']=function(_0x5a8694){var _0x1257c9=this;return new Promise(function(_0x29cfbe,_0x20f612){return db['SmsQueue'][_0x3230('0x18')]({'raw':_0x5a8694[_0x3230('0x19')]?_0x5a8694[_0x3230('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a8694['options']?_0x5a8694['options'][_0x3230('0x1a')]||null:null,'attributes':_0x5a8694[_0x3230('0x19')]?_0x5a8694['options']['attributes']||null:null,'limit':_0x5a8694[_0x3230('0x19')]?_0x5a8694[_0x3230('0x19')][_0x3230('0x1b')]||null:null,'include':_0x5a8694[_0x3230('0x19')]?_0x5a8694[_0x3230('0x19')][_0x3230('0x1c')]?_[_0x3230('0x1d')](_0x5a8694[_0x3230('0x19')]['include'],function(_0x31ae7b){return{'model':db[_0x31ae7b[_0x3230('0x1e')]],'as':_0x31ae7b['as'],'attributes':_0x31ae7b['attributes'],'include':_0x31ae7b[_0x3230('0x1c')]?_[_0x3230('0x1d')](_0x31ae7b[_0x3230('0x1c')],function(_0x16bdf4){return{'model':db[_0x16bdf4[_0x3230('0x1e')]],'as':_0x16bdf4['as'],'attributes':_0x16bdf4[_0x3230('0x1f')],'include':_0x16bdf4[_0x3230('0x1c')]?_[_0x3230('0x1d')](_0x16bdf4[_0x3230('0x1c')],function(_0x1fb5d3){return{'model':db[_0x1fb5d3['model']],'as':_0x1fb5d3['as'],'attributes':_0x1fb5d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x3230('0xe')](function(_0x568e6c){logger[_0x3230('0x15')]('GetSmsQueue',_0x5a8694);logger[_0x3230('0x11')]('GetSmsQueue',_0x5a8694,JSON[_0x3230('0x12')](_0x568e6c));_0x29cfbe(_0x568e6c);})[_0x3230('0x17')](function(_0x2aa48d){logger['error'](_0x3230('0x20'),_0x2aa48d[_0x3230('0x14')],_0x5a8694);_0x20f612(_0x1257c9['error'](0x1f4,_0x2aa48d[_0x3230('0x14')]));});});};exports[_0x3230('0x21')]=function(_0x395d36){var _0x4816d1=this;return new Promise(function(_0x5ca31e,_0x4f2f88){return db[_0x3230('0x22')]['find']({'raw':_0x395d36[_0x3230('0x19')]?_0x395d36['options'][_0x3230('0x23')]===undefined?!![]:![]:!![],'where':_0x395d36[_0x3230('0x19')]?_0x395d36[_0x3230('0x19')][_0x3230('0x1a')]||null:null,'attributes':_0x395d36['options']?_0x395d36[_0x3230('0x19')][_0x3230('0x1f')]||null:null,'include':_0x395d36[_0x3230('0x19')]?_0x395d36['options']['include']?_[_0x3230('0x1d')](_0x395d36['options'][_0x3230('0x1c')],function(_0x425519){return{'model':db[_0x425519['model']],'as':_0x425519['as'],'attributes':_0x425519[_0x3230('0x1f')],'include':_0x425519[_0x3230('0x1c')]?_[_0x3230('0x1d')](_0x425519[_0x3230('0x1c')],function(_0x1b69f7){return{'model':db[_0x1b69f7[_0x3230('0x1e')]],'as':_0x1b69f7['as'],'attributes':_0x1b69f7[_0x3230('0x1f')],'include':_0x1b69f7[_0x3230('0x1c')]?_[_0x3230('0x1d')](_0x1b69f7[_0x3230('0x1c')],function(_0x29ef8c){return{'model':db[_0x29ef8c[_0x3230('0x1e')]],'as':_0x29ef8c['as'],'attributes':_0x29ef8c[_0x3230('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a84a5){logger[_0x3230('0x15')](_0x3230('0x21'),_0x395d36);logger[_0x3230('0x11')](_0x3230('0x21'),_0x395d36,JSON[_0x3230('0x12')](_0x3a84a5));_0x5ca31e(_0x3a84a5);})[_0x3230('0x17')](function(_0x5f0276){logger[_0x3230('0x13')]('ShowSmsQueue',_0x5f0276['message'],_0x395d36);_0x4f2f88(_0x4816d1[_0x3230('0x13')](0x1f4,_0x5f0276[_0x3230('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c0a7681..ec4f797 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 _0x274c=['length','smsQueue:','save','remove','update','emit','removeListener','register'];(function(_0x20dbd2,_0x5e0ed7){var _0x323e21=function(_0x38a672){while(--_0x38a672){_0x20dbd2['push'](_0x20dbd2['shift']());}};_0x323e21(++_0x5e0ed7);}(_0x274c,0x1c2));var _0xc274=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0x274c[_0x5b7963];return _0x57f611;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xc274('0x0'),_0xc274('0x1'),_0xc274('0x2')];function createListener(_0x6f8fd,_0xdbb7cd){return function(_0x44d86d){_0xdbb7cd[_0xc274('0x3')](_0x6f8fd,_0x44d86d);};}function removeListener(_0x4b6916,_0x542fba){return function(){SmsQueueEvents[_0xc274('0x4')](_0x4b6916,_0x542fba);};}exports[_0xc274('0x5')]=function(_0xdaa490){for(var _0x38eea2=0x0,_0x84cb0e=events[_0xc274('0x6')];_0x38eea2<_0x84cb0e;_0x38eea2++){var _0x336976=events[_0x38eea2];var _0x2ea3ae=createListener(_0xc274('0x7')+_0x336976,_0xdaa490);SmsQueueEvents['on'](_0x336976,_0x2ea3ae);}}; \ No newline at end of file +var _0xaa0e=['remove','removeListener','register','length','./smsQueue.events','save'];(function(_0xa96199,_0x4801c1){var _0x98af24=function(_0x355774){while(--_0x355774){_0xa96199['push'](_0xa96199['shift']());}};_0x98af24(++_0x4801c1);}(_0xaa0e,0x154));var _0xeaa0=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xaa0e[_0x52121d];return _0x448627;};'use strict';var SmsQueueEvents=require(_0xeaa0('0x0'));var events=[_0xeaa0('0x1'),_0xeaa0('0x2'),'update'];function createListener(_0x30a937,_0x44f277){return function(_0x460cd0){_0x44f277['emit'](_0x30a937,_0x460cd0);};}function removeListener(_0x2df505,_0x41abe9){return function(){SmsQueueEvents[_0xeaa0('0x3')](_0x2df505,_0x41abe9);};}exports[_0xeaa0('0x4')]=function(_0x12f023){for(var _0x743361=0x0,_0x43a53b=events[_0xeaa0('0x5')];_0x743361<_0x43a53b;_0x743361++){var _0x52deaa=events[_0x743361];var _0x1bccec=createListener('smsQueue:'+_0x52deaa,_0x12f023);SmsQueueEvents['on'](_0x52deaa,_0x1bccec);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2b26da2..ee05218 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 _0x3c15=['./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xade77,_0x2c4440){var _0x4e3005=function(_0x1262f3){while(--_0x1262f3){_0xade77['push'](_0xade77['shift']());}};_0x4e3005(++_0x2c4440);}(_0x3c15,0x172));var _0x53c1=function(_0x39afd1,_0x5bbdb0){_0x39afd1=_0x39afd1-0x0;var _0x2d1bab=_0x3c15[_0x39afd1];return _0x2d1bab;};'use strict';var multer=require('multer');var util=require(_0x53c1('0x0'));var path=require(_0x53c1('0x1'));var timeout=require(_0x53c1('0x2'));var express=require(_0x53c1('0x3'));var router=express[_0x53c1('0x4')]();var fs_extra=require(_0x53c1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x53c1('0x6'));var config=require(_0x53c1('0x7'));var controller=require(_0x53c1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x53c1('0x9')]);router[_0x53c1('0xa')](_0x53c1('0xb'),auth[_0x53c1('0xc')](),controller[_0x53c1('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x53c1('0xe')]);router[_0x53c1('0xf')]('/',auth[_0x53c1('0xc')](),controller[_0x53c1('0x10')]);router['put'](_0x53c1('0x11'),auth[_0x53c1('0xc')](),controller['update']);router[_0x53c1('0x12')]('/:id',auth[_0x53c1('0xc')](),controller[_0x53c1('0x13')]);module[_0x53c1('0x14')]=router; \ No newline at end of file +var _0x6b4b=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','/:id','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3206b4,_0x56a83a){var _0x40d95d=function(_0x23022e){while(--_0x23022e){_0x3206b4['push'](_0x3206b4['shift']());}};_0x40d95d(++_0x56a83a);}(_0x6b4b,0x9d));var _0xb6b4=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6b4b[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require('multer');var util=require(_0xb6b4('0x0'));var path=require(_0xb6b4('0x1'));var timeout=require(_0xb6b4('0x2'));var express=require('express');var router=express[_0xb6b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb6b4('0x4'));var interaction=require(_0xb6b4('0x5'));var config=require(_0xb6b4('0x6'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xb6b4('0x7')](),controller[_0xb6b4('0x8')]);router[_0xb6b4('0x9')](_0xb6b4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb6b4('0x9')]('/:id',auth[_0xb6b4('0x7')](),controller[_0xb6b4('0xb')]);router[_0xb6b4('0xc')]('/',auth[_0xb6b4('0x7')](),controller[_0xb6b4('0xd')]);router['put'](_0xb6b4('0xe'),auth['isAuthenticated'](),controller[_0xb6b4('0xf')]);router[_0xb6b4('0x10')](_0xb6b4('0xe'),auth[_0xb6b4('0x7')](),controller['destroy']);module[_0xb6b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b212a06..4b398ca 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 _0x3820=['STRING','DATE','moment','exports'];(function(_0x43ceb7,_0x20ed3c){var _0x4bfee7=function(_0x43f666){while(--_0x43f666){_0x43ceb7['push'](_0x43ceb7['shift']());}};_0x4bfee7(++_0x20ed3c);}(_0x3820,0x92));var _0x0382=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x3820[_0x56e0e8];return _0x2dab50;};'use strict';var moment=require(_0x0382('0x0'));var Sequelize=require('sequelize');module[_0x0382('0x1')]={'uniqueid':{'type':Sequelize[_0x0382('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0382('0x3')]},'leaveAt':{'type':Sequelize[_0x0382('0x3')]},'acceptAt':{'type':Sequelize[_0x0382('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0382('0x2')]}}; \ No newline at end of file +var _0x7079=['STRING','DATE'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x7079,0x10e));var _0x9707=function(_0x3f97ab,_0x57ef1c){_0x3f97ab=_0x3f97ab-0x0;var _0xb3843=_0x7079[_0x3f97ab];return _0xb3843;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9707('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x9707('0x0')]},'joinAt':{'type':Sequelize[_0x9707('0x1')]},'leaveAt':{'type':Sequelize[_0x9707('0x1')]},'acceptAt':{'type':Sequelize[_0x9707('0x1')]},'exitAt':{'type':Sequelize[_0x9707('0x1')]},'reason':{'type':Sequelize[_0x9707('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1474070..20d2328 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 _0x9b5b=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','update','then','error','stack','name','send','index','map','SmsQueueReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x491d39,_0x300bac){var _0x5b6097=function(_0x129581){while(--_0x129581){_0x491d39['push'](_0x491d39['shift']());}};_0x5b6097(++_0x300bac);}(_0x9b5b,0x1e1));var _0xb9b5=function(_0x4f364b,_0xee2cd0){_0x4f364b=_0x4f364b-0x0;var _0xede152=_0x9b5b[_0x4f364b];return _0xede152;};'use strict';var emlformat=require(_0xb9b5('0x0'));var rimraf=require(_0xb9b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb9b5('0x2'));var BPromise=require(_0xb9b5('0x3'));var Mustache=require(_0xb9b5('0x4'));var util=require(_0xb9b5('0x5'));var path=require(_0xb9b5('0x6'));var sox=require(_0xb9b5('0x7'));var csv=require('to-csv');var ejs=require(_0xb9b5('0x8'));var fs=require('fs');var fs_extra=require(_0xb9b5('0x9'));var _=require(_0xb9b5('0xa'));var squel=require(_0xb9b5('0xb'));var crypto=require(_0xb9b5('0xc'));var jsforce=require(_0xb9b5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb9b5('0xe'));var querystring=require(_0xb9b5('0xf'));var Papa=require(_0xb9b5('0x10'));var Redis=require(_0xb9b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb9b5('0x12'));var as=require(_0xb9b5('0x13'));var hardwareService=require(_0xb9b5('0x14'));var logger=require(_0xb9b5('0x15'))(_0xb9b5('0x16'));var utils=require('../../config/utils');var config=require(_0xb9b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9b5('0x18'))['db'];function respondWithStatusCode(_0x57ea2e,_0x30be40){_0x30be40=_0x30be40||0xcc;return function(_0x43ebe4){if(_0x43ebe4){return _0x57ea2e[_0xb9b5('0x19')](_0x30be40);}return _0x57ea2e[_0xb9b5('0x1a')](_0x30be40)[_0xb9b5('0x1b')]();};}function respondWithResult(_0x29036f,_0x15fe15){_0x15fe15=_0x15fe15||0xc8;return function(_0x3e9def){if(_0x3e9def){return _0x29036f[_0xb9b5('0x1a')](_0x15fe15)['json'](_0x3e9def);}};}function respondWithFilteredResult(_0x205f1e,_0x3143d5){return function(_0x367a19){if(_0x367a19){var _0x212684=typeof _0x3143d5[_0xb9b5('0x1c')]===_0xb9b5('0x1d')&&typeof _0x3143d5['limit']===_0xb9b5('0x1d');var _0x2a23b2=_0x367a19['count'];var _0x358bce=_0x212684?0x0:_0x3143d5['offset'];var _0xdab973=_0x212684?_0x367a19[_0xb9b5('0x1e')]:_0x3143d5['offset']+_0x3143d5['limit'];var _0x1938b2;if(_0xdab973>=_0x2a23b2){_0xdab973=_0x2a23b2;_0x1938b2=0xc8;}else{_0x1938b2=0xce;}_0x205f1e[_0xb9b5('0x1a')](_0x1938b2);return _0x205f1e[_0xb9b5('0x1f')](_0xb9b5('0x20'),_0x358bce+'-'+_0xdab973+'/'+_0x2a23b2)[_0xb9b5('0x21')](_0x367a19);}return null;};}function patchUpdates(_0x16e2ae){return function(_0x2ac0f0){try{jsonpatch[_0xb9b5('0x22')](_0x2ac0f0,_0x16e2ae,!![]);}catch(_0x2a91ad){return BPromise['reject'](_0x2a91ad);}return _0x2ac0f0['save']();};}function saveUpdates(_0x310f0d,_0x48df8b){return function(_0x9afb6){if(_0x9afb6){return _0x9afb6[_0xb9b5('0x23')](_0x310f0d)[_0xb9b5('0x24')](function(_0x1ab8f2){return _0x1ab8f2;});}return null;};}function removeEntity(_0x5707b9,_0x4a8a29){return function(_0x1094cf){if(_0x1094cf){return _0x1094cf['destroy']()['then'](function(){_0x5707b9[_0xb9b5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c369,_0x2f6881){return function(_0x39d4d7){if(!_0x39d4d7){_0x13c369[_0xb9b5('0x19')](0x194);}return _0x39d4d7;};}function handleError(_0x4ea8ed,_0x3282f0){_0x3282f0=_0x3282f0||0x1f4;return function(_0x4cbaaf){logger[_0xb9b5('0x25')](_0x4cbaaf[_0xb9b5('0x26')]);if(_0x4cbaaf[_0xb9b5('0x27')]){delete _0x4cbaaf[_0xb9b5('0x27')];}_0x4ea8ed[_0xb9b5('0x1a')](_0x3282f0)[_0xb9b5('0x28')](_0x4cbaaf);};}exports[_0xb9b5('0x29')]=function(_0x4d3209,_0xdbcf6b){var _0x59e3ab={},_0xbd3618={},_0xb7ba1={'count':0x0,'rows':[]};var _0x2bb523=_[_0xb9b5('0x2a')](db[_0xb9b5('0x2b')]['rawAttributes'],function(_0x443e19){return{'name':_0x443e19['fieldName'],'type':_0x443e19[_0xb9b5('0x2c')][_0xb9b5('0x2d')]};});_0xbd3618[_0xb9b5('0x2e')]=_[_0xb9b5('0x2a')](_0x2bb523,_0xb9b5('0x27'));_0xbd3618[_0xb9b5('0x2f')]=_[_0xb9b5('0x30')](_0x4d3209[_0xb9b5('0x2f')]);_0xbd3618[_0xb9b5('0x31')]=_['intersection'](_0xbd3618[_0xb9b5('0x2e')],_0xbd3618[_0xb9b5('0x2f')]);_0x59e3ab[_0xb9b5('0x32')]=_[_0xb9b5('0x33')](_0xbd3618[_0xb9b5('0x2e')],qs['fields'](_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x34')]));_0x59e3ab[_0xb9b5('0x32')]=_0x59e3ab['attributes'][_0xb9b5('0x35')]?_0x59e3ab['attributes']:_0xbd3618['model'];if(!_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x36')](_0xb9b5('0x37'))){_0x59e3ab[_0xb9b5('0x38')]=qs[_0xb9b5('0x38')](_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x38')]);_0x59e3ab['offset']=qs['offset'](_0x4d3209[_0xb9b5('0x2f')]['offset']);}_0x59e3ab[_0xb9b5('0x39')]=qs[_0xb9b5('0x3a')](_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x3a')]);_0x59e3ab[_0xb9b5('0x3b')]=qs[_0xb9b5('0x31')](_[_0xb9b5('0x3c')](_0x4d3209['query'],_0xbd3618[_0xb9b5('0x31')]),_0x2bb523);if(_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x3d')]){_0x59e3ab[_0xb9b5('0x3b')]=_[_0xb9b5('0x3e')](_0x59e3ab[_0xb9b5('0x3b')],{'$or':_['map'](_0x2bb523,function(_0x27455d){if(_0x27455d[_0xb9b5('0x2c')]!==_0xb9b5('0x3f')){var _0x2bc60b={};_0x2bc60b[_0x27455d[_0xb9b5('0x27')]]={'$like':'%'+_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x3d')]+'%'};return _0x2bc60b;}})});}_0x59e3ab=_['merge']({},_0x59e3ab,_0x4d3209[_0xb9b5('0x40')]);var _0xa0e370={'where':_0x59e3ab[_0xb9b5('0x3b')]};return db[_0xb9b5('0x2b')][_0xb9b5('0x1e')](_0xa0e370)[_0xb9b5('0x24')](function(_0x459f61){_0xb7ba1['count']=_0x459f61;if(_0x4d3209[_0xb9b5('0x2f')][_0xb9b5('0x41')]){_0x59e3ab[_0xb9b5('0x42')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x59e3ab);})[_0xb9b5('0x24')](function(_0x479674){_0xb7ba1[_0xb9b5('0x43')]=_0x479674;return _0xb7ba1;})[_0xb9b5('0x24')](respondWithFilteredResult(_0xdbcf6b,_0x59e3ab))[_0xb9b5('0x44')](handleError(_0xdbcf6b,null));};exports[_0xb9b5('0x45')]=function(_0x450ad2,_0x218e3b){var _0x6eec08={'raw':!![],'where':{'id':_0x450ad2[_0xb9b5('0x46')]['id']}},_0x17332b={};_0x17332b[_0xb9b5('0x2e')]=_['keys'](db[_0xb9b5('0x2b')][_0xb9b5('0x47')]);_0x17332b[_0xb9b5('0x2f')]=_['keys'](_0x450ad2[_0xb9b5('0x2f')]);_0x17332b[_0xb9b5('0x31')]=_[_0xb9b5('0x33')](_0x17332b[_0xb9b5('0x2e')],_0x17332b[_0xb9b5('0x2f')]);_0x6eec08[_0xb9b5('0x32')]=_['intersection'](_0x17332b[_0xb9b5('0x2e')],qs[_0xb9b5('0x34')](_0x450ad2[_0xb9b5('0x2f')][_0xb9b5('0x34')]));_0x6eec08['attributes']=_0x6eec08[_0xb9b5('0x32')][_0xb9b5('0x35')]?_0x6eec08['attributes']:_0x17332b['model'];if(_0x450ad2[_0xb9b5('0x2f')][_0xb9b5('0x41')]){_0x6eec08[_0xb9b5('0x42')]=[{'all':!![]}];}_0x6eec08=_[_0xb9b5('0x3e')]({},_0x6eec08,_0x450ad2['options']);return db['SmsQueueReport'][_0xb9b5('0x48')](_0x6eec08)['then'](handleEntityNotFound(_0x218e3b,null))[_0xb9b5('0x24')](respondWithResult(_0x218e3b,null))[_0xb9b5('0x44')](handleError(_0x218e3b,null));};exports['create']=function(_0x449bed,_0x41e898){return db[_0xb9b5('0x2b')][_0xb9b5('0x49')](_0x449bed['body'],{})['then'](respondWithResult(_0x41e898,0xc9))[_0xb9b5('0x44')](handleError(_0x41e898,null));};exports[_0xb9b5('0x23')]=function(_0x444860,_0xe1dfb5){if(_0x444860[_0xb9b5('0x4a')]['id']){delete _0x444860[_0xb9b5('0x4a')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x444860[_0xb9b5('0x46')]['id']}})[_0xb9b5('0x24')](handleEntityNotFound(_0xe1dfb5,null))[_0xb9b5('0x24')](saveUpdates(_0x444860[_0xb9b5('0x4a')],null))[_0xb9b5('0x24')](respondWithResult(_0xe1dfb5,null))[_0xb9b5('0x44')](handleError(_0xe1dfb5,null));};exports[_0xb9b5('0x4b')]=function(_0x1d8fac,_0x2eb6f8){return db[_0xb9b5('0x2b')][_0xb9b5('0x48')]({'where':{'id':_0x1d8fac['params']['id']}})[_0xb9b5('0x24')](handleEntityNotFound(_0x2eb6f8,null))['then'](removeEntity(_0x2eb6f8,null))[_0xb9b5('0x44')](handleError(_0x2eb6f8,null));};exports[_0xb9b5('0x4c')]=function(_0x512f91,_0xb2a3b7){return db[_0xb9b5('0x2b')][_0xb9b5('0x4c')]()['then'](respondWithResult(_0xb2a3b7,null))[_0xb9b5('0x44')](handleError(_0xb2a3b7,null));}; \ No newline at end of file +var _0xffaf=['save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsQueueReport','includeAll','include','rows','catch','show','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x5816ea,_0x13508b){var _0x2fc896=function(_0x297d79){while(--_0x297d79){_0x5816ea['push'](_0x5816ea['shift']());}};_0x2fc896(++_0x13508b);}(_0xffaf,0x16a));var _0xfffa=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xffaf[_0xdeac17];return _0x33aabd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfffa('0x0'));var zipdir=require(_0xfffa('0x1'));var jsonpatch=require(_0xfffa('0x2'));var rp=require(_0xfffa('0x3'));var moment=require(_0xfffa('0x4'));var BPromise=require(_0xfffa('0x5'));var Mustache=require('mustache');var util=require(_0xfffa('0x6'));var path=require(_0xfffa('0x7'));var sox=require(_0xfffa('0x8'));var csv=require(_0xfffa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfffa('0xa'));var _=require(_0xfffa('0xb'));var squel=require(_0xfffa('0xc'));var crypto=require(_0xfffa('0xd'));var jsforce=require(_0xfffa('0xe'));var deskjs=require(_0xfffa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfffa('0x10'));var Papa=require('papaparse');var Redis=require(_0xfffa('0x11'));var authService=require(_0xfffa('0x12'));var qs=require(_0xfffa('0x13'));var as=require(_0xfffa('0x14'));var hardwareService=require(_0xfffa('0x15'));var logger=require(_0xfffa('0x16'))(_0xfffa('0x17'));var utils=require(_0xfffa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfffa('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15405f,_0x360e6b){_0x360e6b=_0x360e6b||0xcc;return function(_0x30992b){if(_0x30992b){return _0x15405f[_0xfffa('0x1a')](_0x360e6b);}return _0x15405f[_0xfffa('0x1b')](_0x360e6b)[_0xfffa('0x1c')]();};}function respondWithResult(_0x5e3ba1,_0x55b660){_0x55b660=_0x55b660||0xc8;return function(_0x87d86c){if(_0x87d86c){return _0x5e3ba1['status'](_0x55b660)[_0xfffa('0x1d')](_0x87d86c);}};}function respondWithFilteredResult(_0x564d9e,_0x24ac85){return function(_0xbdd1bc){if(_0xbdd1bc){var _0x582218=typeof _0x24ac85[_0xfffa('0x1e')]===_0xfffa('0x1f')&&typeof _0x24ac85[_0xfffa('0x20')]==='undefined';var _0x36efa2=_0xbdd1bc[_0xfffa('0x21')];var _0x21439b=_0x582218?0x0:_0x24ac85[_0xfffa('0x1e')];var _0xb41707=_0x582218?_0xbdd1bc['count']:_0x24ac85[_0xfffa('0x1e')]+_0x24ac85[_0xfffa('0x20')];var _0x459809;if(_0xb41707>=_0x36efa2){_0xb41707=_0x36efa2;_0x459809=0xc8;}else{_0x459809=0xce;}_0x564d9e[_0xfffa('0x1b')](_0x459809);return _0x564d9e[_0xfffa('0x22')](_0xfffa('0x23'),_0x21439b+'-'+_0xb41707+'/'+_0x36efa2)[_0xfffa('0x1d')](_0xbdd1bc);}return null;};}function patchUpdates(_0x20591a){return function(_0x572fa2){try{jsonpatch[_0xfffa('0x24')](_0x572fa2,_0x20591a,!![]);}catch(_0x3c63fe){return BPromise[_0xfffa('0x25')](_0x3c63fe);}return _0x572fa2[_0xfffa('0x26')]();};}function saveUpdates(_0x38cd05,_0x448b6d){return function(_0x902597){if(_0x902597){return _0x902597['update'](_0x38cd05)[_0xfffa('0x27')](function(_0xb8399){return _0xb8399;});}return null;};}function removeEntity(_0x281cc8,_0x75feb3){return function(_0x5d184f){if(_0x5d184f){return _0x5d184f[_0xfffa('0x28')]()['then'](function(){_0x281cc8[_0xfffa('0x1b')](0xcc)[_0xfffa('0x1c')]();});}};}function handleEntityNotFound(_0x418789,_0x2801bb){return function(_0x3c85d5){if(!_0x3c85d5){_0x418789[_0xfffa('0x1a')](0x194);}return _0x3c85d5;};}function handleError(_0x5b6c9c,_0xcb67c6){_0xcb67c6=_0xcb67c6||0x1f4;return function(_0x436fe7){logger[_0xfffa('0x29')](_0x436fe7[_0xfffa('0x2a')]);if(_0x436fe7[_0xfffa('0x2b')]){delete _0x436fe7[_0xfffa('0x2b')];}_0x5b6c9c[_0xfffa('0x1b')](_0xcb67c6)[_0xfffa('0x2c')](_0x436fe7);};}exports[_0xfffa('0x2d')]=function(_0x8e5b57,_0x236524){var _0x429293={},_0x1fa0cf={},_0x1061c0={'count':0x0,'rows':[]};var _0x59aad2=_[_0xfffa('0x2e')](db['SmsQueueReport'][_0xfffa('0x2f')],function(_0x1d8bf1){return{'name':_0x1d8bf1[_0xfffa('0x30')],'type':_0x1d8bf1[_0xfffa('0x31')][_0xfffa('0x32')]};});_0x1fa0cf[_0xfffa('0x33')]=_[_0xfffa('0x2e')](_0x59aad2,_0xfffa('0x2b'));_0x1fa0cf[_0xfffa('0x34')]=_[_0xfffa('0x35')](_0x8e5b57[_0xfffa('0x34')]);_0x1fa0cf['filters']=_['intersection'](_0x1fa0cf[_0xfffa('0x33')],_0x1fa0cf[_0xfffa('0x34')]);_0x429293['attributes']=_[_0xfffa('0x36')](_0x1fa0cf[_0xfffa('0x33')],qs[_0xfffa('0x37')](_0x8e5b57[_0xfffa('0x34')][_0xfffa('0x37')]));_0x429293[_0xfffa('0x38')]=_0x429293['attributes'][_0xfffa('0x39')]?_0x429293['attributes']:_0x1fa0cf[_0xfffa('0x33')];if(!_0x8e5b57[_0xfffa('0x34')][_0xfffa('0x3a')](_0xfffa('0x3b'))){_0x429293[_0xfffa('0x20')]=qs[_0xfffa('0x20')](_0x8e5b57[_0xfffa('0x34')][_0xfffa('0x20')]);_0x429293[_0xfffa('0x1e')]=qs[_0xfffa('0x1e')](_0x8e5b57[_0xfffa('0x34')]['offset']);}_0x429293[_0xfffa('0x3c')]=qs['sort'](_0x8e5b57['query'][_0xfffa('0x3d')]);_0x429293[_0xfffa('0x3e')]=qs[_0xfffa('0x3f')](_['pick'](_0x8e5b57[_0xfffa('0x34')],_0x1fa0cf[_0xfffa('0x3f')]),_0x59aad2);if(_0x8e5b57['query'][_0xfffa('0x40')]){_0x429293[_0xfffa('0x3e')]=_[_0xfffa('0x41')](_0x429293[_0xfffa('0x3e')],{'$or':_[_0xfffa('0x2e')](_0x59aad2,function(_0xf75b79){if(_0xf75b79[_0xfffa('0x31')]!==_0xfffa('0x42')){var _0x57d00a={};_0x57d00a[_0xf75b79[_0xfffa('0x2b')]]={'$like':'%'+_0x8e5b57['query'][_0xfffa('0x40')]+'%'};return _0x57d00a;}})});}_0x429293=_['merge']({},_0x429293,_0x8e5b57[_0xfffa('0x43')]);var _0x14a737={'where':_0x429293[_0xfffa('0x3e')]};return db[_0xfffa('0x44')]['count'](_0x14a737)['then'](function(_0x2e239c){_0x1061c0[_0xfffa('0x21')]=_0x2e239c;if(_0x8e5b57[_0xfffa('0x34')][_0xfffa('0x45')]){_0x429293[_0xfffa('0x46')]=[{'all':!![]}];}return db[_0xfffa('0x44')]['findAll'](_0x429293);})[_0xfffa('0x27')](function(_0x18fb50){_0x1061c0[_0xfffa('0x47')]=_0x18fb50;return _0x1061c0;})['then'](respondWithFilteredResult(_0x236524,_0x429293))[_0xfffa('0x48')](handleError(_0x236524,null));};exports[_0xfffa('0x49')]=function(_0x215bf5,_0x7453cc){var _0x1537d5={'raw':!![],'where':{'id':_0x215bf5['params']['id']}},_0x3c2233={};_0x3c2233[_0xfffa('0x33')]=_['keys'](db[_0xfffa('0x44')]['rawAttributes']);_0x3c2233[_0xfffa('0x34')]=_['keys'](_0x215bf5[_0xfffa('0x34')]);_0x3c2233[_0xfffa('0x3f')]=_[_0xfffa('0x36')](_0x3c2233['model'],_0x3c2233['query']);_0x1537d5[_0xfffa('0x38')]=_['intersection'](_0x3c2233['model'],qs[_0xfffa('0x37')](_0x215bf5['query']['fields']));_0x1537d5[_0xfffa('0x38')]=_0x1537d5[_0xfffa('0x38')][_0xfffa('0x39')]?_0x1537d5['attributes']:_0x3c2233[_0xfffa('0x33')];if(_0x215bf5['query'][_0xfffa('0x45')]){_0x1537d5[_0xfffa('0x46')]=[{'all':!![]}];}_0x1537d5=_['merge']({},_0x1537d5,_0x215bf5[_0xfffa('0x43')]);return db[_0xfffa('0x44')][_0xfffa('0x4a')](_0x1537d5)[_0xfffa('0x27')](handleEntityNotFound(_0x7453cc,null))[_0xfffa('0x27')](respondWithResult(_0x7453cc,null))[_0xfffa('0x48')](handleError(_0x7453cc,null));};exports[_0xfffa('0x4b')]=function(_0x56c267,_0x3b97c0){return db[_0xfffa('0x44')][_0xfffa('0x4b')](_0x56c267[_0xfffa('0x4c')],{})[_0xfffa('0x27')](respondWithResult(_0x3b97c0,0xc9))[_0xfffa('0x48')](handleError(_0x3b97c0,null));};exports[_0xfffa('0x4d')]=function(_0x42b665,_0x5a34bf){if(_0x42b665[_0xfffa('0x4c')]['id']){delete _0x42b665[_0xfffa('0x4c')]['id'];}return db[_0xfffa('0x44')][_0xfffa('0x4a')]({'where':{'id':_0x42b665[_0xfffa('0x4e')]['id']}})[_0xfffa('0x27')](handleEntityNotFound(_0x5a34bf,null))[_0xfffa('0x27')](saveUpdates(_0x42b665[_0xfffa('0x4c')],null))['then'](respondWithResult(_0x5a34bf,null))[_0xfffa('0x48')](handleError(_0x5a34bf,null));};exports[_0xfffa('0x28')]=function(_0x42c955,_0x495812){return db['SmsQueueReport']['find']({'where':{'id':_0x42c955[_0xfffa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x495812,null))['then'](removeEntity(_0x495812,null))[_0xfffa('0x48')](handleError(_0x495812,null));};exports[_0xfffa('0x4f')]=function(_0x478d7a,_0x3216f3){return db[_0xfffa('0x44')][_0xfffa('0x4f')]()[_0xfffa('0x27')](respondWithResult(_0x3216f3,null))[_0xfffa('0x48')](handleError(_0x3216f3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index a55dd12..9bedb58 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x29c1c0,_0x404ceb){var _0x2db934=function(_0x248257){while(--_0x248257){_0x29c1c0['push'](_0x29c1c0['shift']());}};_0x2db934(++_0x404ceb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x1c45ac,_0x235051){var _0x1dffa7=function(_0x222a4d){while(--_0x222a4d){_0x1c45ac['push'](_0x1c45ac['shift']());}};_0x1dffa7(++_0x235051);}(_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'));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 873b218..2b29379 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 _0x5327=['SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','where','attributes','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport'];(function(_0x5e92aa,_0x386d44){var _0x284dd8=function(_0x278021){while(--_0x278021){_0x5e92aa['push'](_0x5e92aa['shift']());}};_0x284dd8(++_0x386d44);}(_0x5327,0x9f));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7532('0x0'));var moment=require('moment');var BPromise=require(_0x7532('0x1'));var rs=require(_0x7532('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7532('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7532('0x4'))(_0x7532('0x5'));var config=require(_0x7532('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7532('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590e8d,_0x4be31f,_0x5ca527){return new BPromise(function(_0x2a198f,_0xddac8f){return client[_0x7532('0x8')](_0x590e8d,_0x5ca527)[_0x7532('0x9')](function(_0x43ad3a){logger[_0x7532('0xa')](_0x7532('0xb'),_0x4be31f,_0x7532('0xc'));logger[_0x7532('0xd')](_0x7532('0xe'),_0x4be31f,_0x7532('0xc'),JSON['stringify'](_0x43ad3a));if(_0x43ad3a[_0x7532('0xf')]){if(_0x43ad3a[_0x7532('0xf')][_0x7532('0x10')]===0x1f4){logger[_0x7532('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x4be31f,_0x43ad3a[_0x7532('0xf')][_0x7532('0x11')]);return _0xddac8f(_0x43ad3a[_0x7532('0xf')][_0x7532('0x11')]);}logger[_0x7532('0xf')](_0x7532('0xb'),_0x4be31f,_0x43ad3a['error']['message']);return _0x2a198f(_0x43ad3a[_0x7532('0xf')][_0x7532('0x11')]);}else{logger[_0x7532('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x4be31f,_0x7532('0xc'));_0x2a198f(_0x43ad3a[_0x7532('0x12')][_0x7532('0x11')]);}})[_0x7532('0x13')](function(_0x817dc7){logger[_0x7532('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x4be31f,_0x817dc7);_0xddac8f(_0x817dc7);});});}exports[_0x7532('0x14')]=function(_0x1e4dc5){var _0x496b59=this;return new Promise(function(_0xb344c6,_0x2058e9){return db[_0x7532('0x15')][_0x7532('0x16')](_0x1e4dc5[_0x7532('0x17')],{'raw':_0x1e4dc5[_0x7532('0x18')]?_0x1e4dc5[_0x7532('0x18')][_0x7532('0x19')]===undefined?!![]:![]:!![]})[_0x7532('0x9')](function(_0x44bdc3){logger['info'](_0x7532('0x14'),_0x1e4dc5);logger[_0x7532('0xd')](_0x7532('0x14'),_0x1e4dc5,JSON[_0x7532('0x1a')](_0x44bdc3));_0xb344c6(_0x44bdc3);})[_0x7532('0x13')](function(_0x58bd39){logger['error'](_0x7532('0x14'),_0x58bd39[_0x7532('0x11')],_0x1e4dc5);_0x2058e9(_0x496b59[_0x7532('0xf')](0x1f4,_0x58bd39[_0x7532('0x11')]));});});};exports[_0x7532('0x1b')]=function(_0x42fe07){var _0xad4e46=this;return new Promise(function(_0x28131f,_0x292d86){return db[_0x7532('0x15')]['update'](_0x42fe07[_0x7532('0x17')],{'raw':_0x42fe07[_0x7532('0x18')]?_0x42fe07[_0x7532('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42fe07['options']?_0x42fe07[_0x7532('0x18')][_0x7532('0x1c')]||null:null,'attributes':_0x42fe07[_0x7532('0x18')]?_0x42fe07[_0x7532('0x18')][_0x7532('0x1d')]||null:null,'limit':_0x42fe07[_0x7532('0x18')]?_0x42fe07[_0x7532('0x18')]['limit']||null:null})['then'](function(_0x4ddf8c){logger['info'](_0x7532('0x1b'),_0x42fe07);logger[_0x7532('0xd')](_0x7532('0x1b'),_0x42fe07,JSON[_0x7532('0x1a')](_0x4ddf8c));_0x28131f(_0x4ddf8c);})[_0x7532('0x13')](function(_0x2b1b8a){logger['error'](_0x7532('0x1b'),_0x2b1b8a[_0x7532('0x11')],_0x42fe07);_0x292d86(_0xad4e46[_0x7532('0xf')](0x1f4,_0x2b1b8a[_0x7532('0x11')]));});});}; \ No newline at end of file +var _0x7936=['stringify','error','message','catch','CreateSmsQueueReport','create','body','options','raw','SmsQueueReport','where','attributes','UpdateSmsQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7936,0x139));var _0x6793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7936[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6793('0x0'));var util=require(_0x6793('0x1'));var moment=require('moment');var BPromise=require(_0x6793('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6793('0x3'));var db=require(_0x6793('0x4'))['db'];var utils=require(_0x6793('0x5'));var logger=require(_0x6793('0x6'))(_0x6793('0x7'));var config=require(_0x6793('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6793('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bf027,_0x72b082,_0x1c3a3d){return new BPromise(function(_0x41bd83,_0x339f8f){return client[_0x6793('0xa')](_0x3bf027,_0x1c3a3d)[_0x6793('0xb')](function(_0x56dfe2){logger[_0x6793('0xc')](_0x6793('0xd'),_0x72b082,'request\x20sent');logger[_0x6793('0xe')](_0x6793('0xf'),_0x72b082,_0x6793('0x10'),JSON[_0x6793('0x11')](_0x56dfe2));if(_0x56dfe2[_0x6793('0x12')]){if(_0x56dfe2[_0x6793('0x12')]['code']===0x1f4){logger[_0x6793('0x12')](_0x6793('0xd'),_0x72b082,_0x56dfe2[_0x6793('0x12')][_0x6793('0x13')]);return _0x339f8f(_0x56dfe2['error']['message']);}logger[_0x6793('0x12')](_0x6793('0xd'),_0x72b082,_0x56dfe2[_0x6793('0x12')][_0x6793('0x13')]);return _0x41bd83(_0x56dfe2[_0x6793('0x12')][_0x6793('0x13')]);}else{logger[_0x6793('0xc')](_0x6793('0xd'),_0x72b082,_0x6793('0x10'));_0x41bd83(_0x56dfe2['result'][_0x6793('0x13')]);}})[_0x6793('0x14')](function(_0x9f70f5){logger['error'](_0x6793('0xd'),_0x72b082,_0x9f70f5);_0x339f8f(_0x9f70f5);});});}exports[_0x6793('0x15')]=function(_0x1b80e3){var _0x7c68c=this;return new Promise(function(_0x29a934,_0xdb2ea7){return db['SmsQueueReport'][_0x6793('0x16')](_0x1b80e3[_0x6793('0x17')],{'raw':_0x1b80e3[_0x6793('0x18')]?_0x1b80e3[_0x6793('0x18')][_0x6793('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4c3df5){logger[_0x6793('0xc')](_0x6793('0x15'),_0x1b80e3);logger[_0x6793('0xe')](_0x6793('0x15'),_0x1b80e3,JSON[_0x6793('0x11')](_0x4c3df5));_0x29a934(_0x4c3df5);})[_0x6793('0x14')](function(_0x266af0){logger['error'](_0x6793('0x15'),_0x266af0[_0x6793('0x13')],_0x1b80e3);_0xdb2ea7(_0x7c68c[_0x6793('0x12')](0x1f4,_0x266af0[_0x6793('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x2edc06){var _0x1921b1=this;return new Promise(function(_0x369fbf,_0x3323fd){return db[_0x6793('0x1a')]['update'](_0x2edc06[_0x6793('0x17')],{'raw':_0x2edc06[_0x6793('0x18')]?_0x2edc06[_0x6793('0x18')][_0x6793('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2edc06[_0x6793('0x18')]?_0x2edc06['options'][_0x6793('0x1b')]||null:null,'attributes':_0x2edc06[_0x6793('0x18')]?_0x2edc06[_0x6793('0x18')][_0x6793('0x1c')]||null:null,'limit':_0x2edc06[_0x6793('0x18')]?_0x2edc06[_0x6793('0x18')]['limit']||null:null})[_0x6793('0xb')](function(_0xfafa0c){logger['info'](_0x6793('0x1d'),_0x2edc06);logger['debug'](_0x6793('0x1d'),_0x2edc06,JSON[_0x6793('0x11')](_0xfafa0c));_0x369fbf(_0xfafa0c);})[_0x6793('0x14')](function(_0x5a8455){logger[_0x6793('0x12')]('UpdateSmsQueueReport',_0x5a8455[_0x6793('0x13')],_0x2edc06);_0x3323fd(_0x1921b1[_0x6793('0x12')](0x1f4,_0x5a8455['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 18f9f9f..f543403 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 _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x45bde8,_0x2c1144){var _0x3653ca=function(_0x385a47){while(--_0x385a47){_0x45bde8['push'](_0x45bde8['shift']());}};_0x3653ca(++_0x2c1144);}(_0xa630,0xbe));var _0x0a63=function(_0x45461d,_0x248e3a){_0x45461d=_0x45461d-0x0;var _0x162da6=_0xa630[_0x45461d];return _0x162da6;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file +var _0x8ef6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x13c68f,_0x1780ac){var _0x412ff7=function(_0x5f5246){while(--_0x5f5246){_0x13c68f['push'](_0x13c68f['shift']());}};_0x412ff7(++_0x1780ac);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2b3404,_0x397f19){_0x2b3404=_0x2b3404-0x0;var _0x1ccbb9=_0x8ef6[_0x2b3404];return _0x1ccbb9;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/:id',auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index dedb0a7..45c845f 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5d8329,_0x2f57ac){_0x5d8329=_0x5d8329-0x0;var _0x5b99ca=_0xb43b[_0x5d8329];return _0x5b99ca;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x20a270,_0x8b8437){var _0x49429a=function(_0x4dc00b){while(--_0x4dc00b){_0x20a270['push'](_0x20a270['shift']());}};_0x49429a(++_0x8b8437);}(_0x54ef,0x112));var _0xf54e=function(_0x3e9808,_0x125aae){_0x3e9808=_0x3e9808-0x0;var _0x108a63=_0x54ef[_0x3e9808];return _0x108a63;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 56af15c..fee71ea 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 _0xca2b=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','SmsTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x351865,_0x595cbe){var _0x28e5ff=function(_0x3093eb){while(--_0x3093eb){_0x351865['push'](_0x351865['shift']());}};_0x28e5ff(++_0x595cbe);}(_0xca2b,0xe8));var _0xbca2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca2b[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xbca2('0x0'));var rimraf=require(_0xbca2('0x1'));var zipdir=require(_0xbca2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbca2('0x3'));var moment=require(_0xbca2('0x4'));var BPromise=require(_0xbca2('0x5'));var Mustache=require(_0xbca2('0x6'));var util=require('util');var path=require(_0xbca2('0x7'));var sox=require('sox');var csv=require(_0xbca2('0x8'));var ejs=require(_0xbca2('0x9'));var fs=require('fs');var fs_extra=require(_0xbca2('0xa'));var _=require(_0xbca2('0xb'));var squel=require(_0xbca2('0xc'));var crypto=require(_0xbca2('0xd'));var jsforce=require(_0xbca2('0xe'));var deskjs=require(_0xbca2('0xf'));var toCsv=require(_0xbca2('0x8'));var querystring=require(_0xbca2('0x10'));var Papa=require(_0xbca2('0x11'));var Redis=require(_0xbca2('0x12'));var authService=require(_0xbca2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbca2('0x14'));var hardwareService=require(_0xbca2('0x15'));var logger=require(_0xbca2('0x16'))(_0xbca2('0x17'));var utils=require(_0xbca2('0x18'));var config=require(_0xbca2('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbca2('0x1a'))['db'];function respondWithStatusCode(_0xe9e7a6,_0x472923){_0x472923=_0x472923||0xcc;return function(_0x4a91ad){if(_0x4a91ad){return _0xe9e7a6['sendStatus'](_0x472923);}return _0xe9e7a6[_0xbca2('0x1b')](_0x472923)[_0xbca2('0x1c')]();};}function respondWithResult(_0xae4983,_0x1d9832){_0x1d9832=_0x1d9832||0xc8;return function(_0x3948a6){if(_0x3948a6){return _0xae4983[_0xbca2('0x1b')](_0x1d9832)[_0xbca2('0x1d')](_0x3948a6);}};}function respondWithFilteredResult(_0x567ab1,_0x4bc998){return function(_0x30b562){if(_0x30b562){var _0x46b6ea=typeof _0x4bc998[_0xbca2('0x1e')]===_0xbca2('0x1f')&&typeof _0x4bc998[_0xbca2('0x20')]===_0xbca2('0x1f');var _0x49c813=_0x30b562[_0xbca2('0x21')];var _0x3a8194=_0x46b6ea?0x0:_0x4bc998[_0xbca2('0x1e')];var _0x1235dd=_0x46b6ea?_0x30b562[_0xbca2('0x21')]:_0x4bc998[_0xbca2('0x1e')]+_0x4bc998[_0xbca2('0x20')];var _0x684a92;if(_0x1235dd>=_0x49c813){_0x1235dd=_0x49c813;_0x684a92=0xc8;}else{_0x684a92=0xce;}_0x567ab1[_0xbca2('0x1b')](_0x684a92);return _0x567ab1[_0xbca2('0x22')](_0xbca2('0x23'),_0x3a8194+'-'+_0x1235dd+'/'+_0x49c813)['json'](_0x30b562);}return null;};}function patchUpdates(_0x57f698){return function(_0x5e3371){try{jsonpatch[_0xbca2('0x24')](_0x5e3371,_0x57f698,!![]);}catch(_0x13371b){return BPromise[_0xbca2('0x25')](_0x13371b);}return _0x5e3371[_0xbca2('0x26')]();};}function saveUpdates(_0x52f70c,_0x3135c6){return function(_0x640d42){if(_0x640d42){return _0x640d42[_0xbca2('0x27')](_0x52f70c)[_0xbca2('0x28')](function(_0x414f32){return _0x414f32;});}return null;};}function removeEntity(_0x3cb7ac,_0x59371a){return function(_0x1d4e3e){if(_0x1d4e3e){return _0x1d4e3e['destroy']()[_0xbca2('0x28')](function(){_0x3cb7ac['status'](0xcc)[_0xbca2('0x1c')]();});}};}function handleEntityNotFound(_0x4dd152,_0x1d875f){return function(_0x4b914d){if(!_0x4b914d){_0x4dd152[_0xbca2('0x29')](0x194);}return _0x4b914d;};}function handleError(_0x3050f0,_0x559c26){_0x559c26=_0x559c26||0x1f4;return function(_0x40b585){logger[_0xbca2('0x2a')](_0x40b585[_0xbca2('0x2b')]);if(_0x40b585[_0xbca2('0x2c')]){delete _0x40b585[_0xbca2('0x2c')];}_0x3050f0[_0xbca2('0x1b')](_0x559c26)['send'](_0x40b585);};}exports[_0xbca2('0x2d')]=function(_0x4b68ae,_0x2d9eeb){var _0x3967f7={},_0xa36125={},_0x3847a6={'count':0x0,'rows':[]};var _0x4dd5b8=_['map'](db[_0xbca2('0x2e')][_0xbca2('0x2f')],function(_0x14a04f){return{'name':_0x14a04f['fieldName'],'type':_0x14a04f[_0xbca2('0x30')][_0xbca2('0x31')]};});_0xa36125[_0xbca2('0x32')]=_['map'](_0x4dd5b8,_0xbca2('0x2c'));_0xa36125[_0xbca2('0x33')]=_[_0xbca2('0x34')](_0x4b68ae['query']);_0xa36125['filters']=_[_0xbca2('0x35')](_0xa36125[_0xbca2('0x32')],_0xa36125['query']);_0x3967f7[_0xbca2('0x36')]=_[_0xbca2('0x35')](_0xa36125['model'],qs[_0xbca2('0x37')](_0x4b68ae['query'][_0xbca2('0x37')]));_0x3967f7[_0xbca2('0x36')]=_0x3967f7[_0xbca2('0x36')][_0xbca2('0x38')]?_0x3967f7[_0xbca2('0x36')]:_0xa36125[_0xbca2('0x32')];if(!_0x4b68ae[_0xbca2('0x33')]['hasOwnProperty'](_0xbca2('0x39'))){_0x3967f7['limit']=qs[_0xbca2('0x20')](_0x4b68ae[_0xbca2('0x33')]['limit']);_0x3967f7[_0xbca2('0x1e')]=qs[_0xbca2('0x1e')](_0x4b68ae[_0xbca2('0x33')]['offset']);}_0x3967f7[_0xbca2('0x3a')]=qs[_0xbca2('0x3b')](_0x4b68ae[_0xbca2('0x33')][_0xbca2('0x3b')]);_0x3967f7[_0xbca2('0x3c')]=qs[_0xbca2('0x3d')](_[_0xbca2('0x3e')](_0x4b68ae[_0xbca2('0x33')],_0xa36125['filters']),_0x4dd5b8);if(_0x4b68ae['query'][_0xbca2('0x3f')]){_0x3967f7[_0xbca2('0x3c')]=_['merge'](_0x3967f7[_0xbca2('0x3c')],{'$or':_['map'](_0x4dd5b8,function(_0x35a333){if(_0x35a333[_0xbca2('0x30')]!==_0xbca2('0x40')){var _0x917e={};_0x917e[_0x35a333[_0xbca2('0x2c')]]={'$like':'%'+_0x4b68ae[_0xbca2('0x33')]['filter']+'%'};return _0x917e;}})});}_0x3967f7=_['merge']({},_0x3967f7,_0x4b68ae['options']);var _0x31dabd={'where':_0x3967f7['where']};return db['SmsTransferReport'][_0xbca2('0x21')](_0x31dabd)[_0xbca2('0x28')](function(_0x1efd02){_0x3847a6[_0xbca2('0x21')]=_0x1efd02;if(_0x4b68ae['query'][_0xbca2('0x41')]){_0x3967f7[_0xbca2('0x42')]=[{'all':!![]}];}return db[_0xbca2('0x2e')][_0xbca2('0x43')](_0x3967f7);})[_0xbca2('0x28')](function(_0x5e78e3){_0x3847a6[_0xbca2('0x44')]=_0x5e78e3;return _0x3847a6;})[_0xbca2('0x28')](respondWithFilteredResult(_0x2d9eeb,_0x3967f7))['catch'](handleError(_0x2d9eeb,null));};exports[_0xbca2('0x45')]=function(_0x4bccb4,_0x1b2873){var _0x26e822={'raw':!![],'where':{'id':_0x4bccb4[_0xbca2('0x46')]['id']}},_0x332d80={};_0x332d80['model']=_[_0xbca2('0x34')](db['SmsTransferReport'][_0xbca2('0x2f')]);_0x332d80[_0xbca2('0x33')]=_[_0xbca2('0x34')](_0x4bccb4['query']);_0x332d80['filters']=_[_0xbca2('0x35')](_0x332d80[_0xbca2('0x32')],_0x332d80[_0xbca2('0x33')]);_0x26e822['attributes']=_[_0xbca2('0x35')](_0x332d80[_0xbca2('0x32')],qs[_0xbca2('0x37')](_0x4bccb4['query'][_0xbca2('0x37')]));_0x26e822[_0xbca2('0x36')]=_0x26e822[_0xbca2('0x36')][_0xbca2('0x38')]?_0x26e822[_0xbca2('0x36')]:_0x332d80['model'];if(_0x4bccb4[_0xbca2('0x33')][_0xbca2('0x41')]){_0x26e822['include']=[{'all':!![]}];}_0x26e822=_[_0xbca2('0x47')]({},_0x26e822,_0x4bccb4[_0xbca2('0x48')]);return db['SmsTransferReport'][_0xbca2('0x49')](_0x26e822)[_0xbca2('0x28')](handleEntityNotFound(_0x1b2873,null))['then'](respondWithResult(_0x1b2873,null))['catch'](handleError(_0x1b2873,null));};exports[_0xbca2('0x4a')]=function(_0x5827d0,_0x98a473){return db[_0xbca2('0x2e')]['create'](_0x5827d0[_0xbca2('0x4b')],{})[_0xbca2('0x28')](respondWithResult(_0x98a473,0xc9))[_0xbca2('0x4c')](handleError(_0x98a473,null));};exports[_0xbca2('0x27')]=function(_0x295809,_0x6685b8){if(_0x295809[_0xbca2('0x4b')]['id']){delete _0x295809[_0xbca2('0x4b')]['id'];}return db[_0xbca2('0x2e')][_0xbca2('0x49')]({'where':{'id':_0x295809[_0xbca2('0x46')]['id']}})[_0xbca2('0x28')](handleEntityNotFound(_0x6685b8,null))[_0xbca2('0x28')](saveUpdates(_0x295809[_0xbca2('0x4b')],null))[_0xbca2('0x28')](respondWithResult(_0x6685b8,null))['catch'](handleError(_0x6685b8,null));};exports[_0xbca2('0x4d')]=function(_0x1ac379,_0x5b6a1d){return db[_0xbca2('0x2e')][_0xbca2('0x49')]({'where':{'id':_0x1ac379[_0xbca2('0x46')]['id']}})[_0xbca2('0x28')](handleEntityNotFound(_0x5b6a1d,null))['then'](removeEntity(_0x5b6a1d,null))[_0xbca2('0x4c')](handleError(_0x5b6a1d,null));};exports[_0xbca2('0x4e')]=function(_0x28c4a4,_0x5f3cba){return db[_0xbca2('0x2e')]['describe']()[_0xbca2('0x28')](respondWithResult(_0x5f3cba,null))[_0xbca2('0x4c')](handleError(_0x5f3cba,null));}; \ No newline at end of file +var _0xe5a2=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','SmsTransferReport','create','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xe5a2,0x115));var _0x2e5a=function(_0x225619,_0x26de0b){_0x225619=_0x225619-0x0;var _0x12f036=_0xe5a2[_0x225619];return _0x12f036;};'use strict';var emlformat=require(_0x2e5a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e5a('0x1'));var moment=require(_0x2e5a('0x2'));var BPromise=require(_0x2e5a('0x3'));var Mustache=require(_0x2e5a('0x4'));var util=require('util');var path=require(_0x2e5a('0x5'));var sox=require(_0x2e5a('0x6'));var csv=require(_0x2e5a('0x7'));var ejs=require(_0x2e5a('0x8'));var fs=require('fs');var fs_extra=require(_0x2e5a('0x9'));var _=require(_0x2e5a('0xa'));var squel=require(_0x2e5a('0xb'));var crypto=require(_0x2e5a('0xc'));var jsforce=require(_0x2e5a('0xd'));var deskjs=require(_0x2e5a('0xe'));var toCsv=require(_0x2e5a('0x7'));var querystring=require(_0x2e5a('0xf'));var Papa=require(_0x2e5a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e5a('0x11'));var as=require(_0x2e5a('0x12'));var hardwareService=require(_0x2e5a('0x13'));var logger=require(_0x2e5a('0x14'))(_0x2e5a('0x15'));var utils=require(_0x2e5a('0x16'));var config=require(_0x2e5a('0x17'));var licenseUtil=require(_0x2e5a('0x18'));var db=require(_0x2e5a('0x19'))['db'];function respondWithStatusCode(_0x983cd7,_0x15b2fe){_0x15b2fe=_0x15b2fe||0xcc;return function(_0xc1f6){if(_0xc1f6){return _0x983cd7[_0x2e5a('0x1a')](_0x15b2fe);}return _0x983cd7[_0x2e5a('0x1b')](_0x15b2fe)[_0x2e5a('0x1c')]();};}function respondWithResult(_0x5c07f6,_0x2d6781){_0x2d6781=_0x2d6781||0xc8;return function(_0x2a2cc5){if(_0x2a2cc5){return _0x5c07f6['status'](_0x2d6781)[_0x2e5a('0x1d')](_0x2a2cc5);}};}function respondWithFilteredResult(_0x2637bc,_0x555316){return function(_0xdcdfba){if(_0xdcdfba){var _0xf1189a=typeof _0x555316[_0x2e5a('0x1e')]==='undefined'&&typeof _0x555316['limit']===_0x2e5a('0x1f');var _0x4204d6=_0xdcdfba[_0x2e5a('0x20')];var _0x5e7ca6=_0xf1189a?0x0:_0x555316[_0x2e5a('0x1e')];var _0x714179=_0xf1189a?_0xdcdfba[_0x2e5a('0x20')]:_0x555316[_0x2e5a('0x1e')]+_0x555316[_0x2e5a('0x21')];var _0x56cc2a;if(_0x714179>=_0x4204d6){_0x714179=_0x4204d6;_0x56cc2a=0xc8;}else{_0x56cc2a=0xce;}_0x2637bc[_0x2e5a('0x1b')](_0x56cc2a);return _0x2637bc[_0x2e5a('0x22')]('Content-Range',_0x5e7ca6+'-'+_0x714179+'/'+_0x4204d6)['json'](_0xdcdfba);}return null;};}function patchUpdates(_0xa2c059){return function(_0x372895){try{jsonpatch[_0x2e5a('0x23')](_0x372895,_0xa2c059,!![]);}catch(_0x5e71ad){return BPromise[_0x2e5a('0x24')](_0x5e71ad);}return _0x372895[_0x2e5a('0x25')]();};}function saveUpdates(_0x3eae25,_0x254e07){return function(_0x18c1a2){if(_0x18c1a2){return _0x18c1a2[_0x2e5a('0x26')](_0x3eae25)[_0x2e5a('0x27')](function(_0x2d4744){return _0x2d4744;});}return null;};}function removeEntity(_0x505c4f,_0x395d86){return function(_0x737c50){if(_0x737c50){return _0x737c50[_0x2e5a('0x28')]()[_0x2e5a('0x27')](function(){_0x505c4f[_0x2e5a('0x1b')](0xcc)[_0x2e5a('0x1c')]();});}};}function handleEntityNotFound(_0x5b6532,_0xdb30b9){return function(_0x1e3e19){if(!_0x1e3e19){_0x5b6532[_0x2e5a('0x1a')](0x194);}return _0x1e3e19;};}function handleError(_0x570d95,_0x50e29e){_0x50e29e=_0x50e29e||0x1f4;return function(_0x316b8b){logger[_0x2e5a('0x29')](_0x316b8b[_0x2e5a('0x2a')]);if(_0x316b8b[_0x2e5a('0x2b')]){delete _0x316b8b[_0x2e5a('0x2b')];}_0x570d95[_0x2e5a('0x1b')](_0x50e29e)[_0x2e5a('0x2c')](_0x316b8b);};}exports[_0x2e5a('0x2d')]=function(_0x4c39fd,_0x8bd236){var _0x37a362={},_0x5c065c={},_0x326500={'count':0x0,'rows':[]};var _0xc090a=_[_0x2e5a('0x2e')](db['SmsTransferReport'][_0x2e5a('0x2f')],function(_0xbcc091){return{'name':_0xbcc091[_0x2e5a('0x30')],'type':_0xbcc091[_0x2e5a('0x31')][_0x2e5a('0x32')]};});_0x5c065c[_0x2e5a('0x33')]=_[_0x2e5a('0x2e')](_0xc090a,_0x2e5a('0x2b'));_0x5c065c[_0x2e5a('0x34')]=_[_0x2e5a('0x35')](_0x4c39fd['query']);_0x5c065c[_0x2e5a('0x36')]=_[_0x2e5a('0x37')](_0x5c065c[_0x2e5a('0x33')],_0x5c065c[_0x2e5a('0x34')]);_0x37a362[_0x2e5a('0x38')]=_[_0x2e5a('0x37')](_0x5c065c[_0x2e5a('0x33')],qs['fields'](_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x39')]));_0x37a362[_0x2e5a('0x38')]=_0x37a362[_0x2e5a('0x38')][_0x2e5a('0x3a')]?_0x37a362[_0x2e5a('0x38')]:_0x5c065c[_0x2e5a('0x33')];if(!_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x3b')]('nolimit')){_0x37a362[_0x2e5a('0x21')]=qs[_0x2e5a('0x21')](_0x4c39fd[_0x2e5a('0x34')]['limit']);_0x37a362[_0x2e5a('0x1e')]=qs[_0x2e5a('0x1e')](_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x1e')]);}_0x37a362[_0x2e5a('0x3c')]=qs[_0x2e5a('0x3d')](_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x3d')]);_0x37a362[_0x2e5a('0x3e')]=qs['filters'](_[_0x2e5a('0x3f')](_0x4c39fd[_0x2e5a('0x34')],_0x5c065c['filters']),_0xc090a);if(_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x40')]){_0x37a362[_0x2e5a('0x3e')]=_['merge'](_0x37a362[_0x2e5a('0x3e')],{'$or':_[_0x2e5a('0x2e')](_0xc090a,function(_0x232ec2){if(_0x232ec2[_0x2e5a('0x31')]!==_0x2e5a('0x41')){var _0x3b972d={};_0x3b972d[_0x232ec2[_0x2e5a('0x2b')]]={'$like':'%'+_0x4c39fd['query'][_0x2e5a('0x40')]+'%'};return _0x3b972d;}})});}_0x37a362=_[_0x2e5a('0x42')]({},_0x37a362,_0x4c39fd[_0x2e5a('0x43')]);var _0xd157d6={'where':_0x37a362['where']};return db['SmsTransferReport'][_0x2e5a('0x20')](_0xd157d6)['then'](function(_0x6d714c){_0x326500[_0x2e5a('0x20')]=_0x6d714c;if(_0x4c39fd[_0x2e5a('0x34')][_0x2e5a('0x44')]){_0x37a362[_0x2e5a('0x45')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x2e5a('0x46')](_0x37a362);})['then'](function(_0x2c1b0e){_0x326500[_0x2e5a('0x47')]=_0x2c1b0e;return _0x326500;})[_0x2e5a('0x27')](respondWithFilteredResult(_0x8bd236,_0x37a362))[_0x2e5a('0x48')](handleError(_0x8bd236,null));};exports[_0x2e5a('0x49')]=function(_0x1bcac4,_0x46e98d){var _0x2c48a5={'raw':!![],'where':{'id':_0x1bcac4[_0x2e5a('0x4a')]['id']}},_0x24f0e3={};_0x24f0e3[_0x2e5a('0x33')]=_[_0x2e5a('0x35')](db[_0x2e5a('0x4b')][_0x2e5a('0x2f')]);_0x24f0e3[_0x2e5a('0x34')]=_['keys'](_0x1bcac4[_0x2e5a('0x34')]);_0x24f0e3[_0x2e5a('0x36')]=_[_0x2e5a('0x37')](_0x24f0e3[_0x2e5a('0x33')],_0x24f0e3[_0x2e5a('0x34')]);_0x2c48a5[_0x2e5a('0x38')]=_['intersection'](_0x24f0e3['model'],qs[_0x2e5a('0x39')](_0x1bcac4[_0x2e5a('0x34')]['fields']));_0x2c48a5[_0x2e5a('0x38')]=_0x2c48a5['attributes'][_0x2e5a('0x3a')]?_0x2c48a5[_0x2e5a('0x38')]:_0x24f0e3[_0x2e5a('0x33')];if(_0x1bcac4[_0x2e5a('0x34')][_0x2e5a('0x44')]){_0x2c48a5[_0x2e5a('0x45')]=[{'all':!![]}];}_0x2c48a5=_[_0x2e5a('0x42')]({},_0x2c48a5,_0x1bcac4[_0x2e5a('0x43')]);return db['SmsTransferReport']['find'](_0x2c48a5)['then'](handleEntityNotFound(_0x46e98d,null))[_0x2e5a('0x27')](respondWithResult(_0x46e98d,null))['catch'](handleError(_0x46e98d,null));};exports[_0x2e5a('0x4c')]=function(_0xae2a9d,_0x1ef3eb){return db[_0x2e5a('0x4b')][_0x2e5a('0x4c')](_0xae2a9d['body'],{})['then'](respondWithResult(_0x1ef3eb,0xc9))[_0x2e5a('0x48')](handleError(_0x1ef3eb,null));};exports[_0x2e5a('0x26')]=function(_0x33e468,_0x4d11f4){if(_0x33e468[_0x2e5a('0x4d')]['id']){delete _0x33e468['body']['id'];}return db['SmsTransferReport'][_0x2e5a('0x4e')]({'where':{'id':_0x33e468['params']['id']}})[_0x2e5a('0x27')](handleEntityNotFound(_0x4d11f4,null))[_0x2e5a('0x27')](saveUpdates(_0x33e468[_0x2e5a('0x4d')],null))[_0x2e5a('0x27')](respondWithResult(_0x4d11f4,null))[_0x2e5a('0x48')](handleError(_0x4d11f4,null));};exports[_0x2e5a('0x28')]=function(_0x92a5ee,_0xffa98d){return db[_0x2e5a('0x4b')][_0x2e5a('0x4e')]({'where':{'id':_0x92a5ee[_0x2e5a('0x4a')]['id']}})['then'](handleEntityNotFound(_0xffa98d,null))[_0x2e5a('0x27')](removeEntity(_0xffa98d,null))[_0x2e5a('0x48')](handleError(_0xffa98d,null));};exports[_0x2e5a('0x4f')]=function(_0x13467e,_0x285d01){return db[_0x2e5a('0x4b')][_0x2e5a('0x4f')]()[_0x2e5a('0x27')](respondWithResult(_0x285d01,null))[_0x2e5a('0x48')](handleError(_0x285d01,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 10cb0ae..4581376 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 _0x63be=['../../config/environment','exports','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x63be,0xd7));var _0xe63b=function(_0x2ff945,_0x320479){_0x2ff945=_0x2ff945-0x0;var _0x5d4e8c=_0x63be[_0x2ff945];return _0x5d4e8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe63b('0x0'))(_0xe63b('0x1'));var moment=require('moment');var BPromise=require(_0xe63b('0x2'));var rp=require(_0xe63b('0x3'));var fs=require('fs');var path=require(_0xe63b('0x4'));var rimraf=require('rimraf');var config=require(_0xe63b('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0xe63b('0x6')]=function(_0x19cf80,_0x3cc298){return _0x19cf80['define'](_0xe63b('0x7'),attributes,{'tableName':_0xe63b('0x8'),'paranoid':![],'indexes':[{'name':_0xe63b('0x9'),'fields':[_0xe63b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d86=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x2c2b30,_0x48ed61){var _0x3b386a=function(_0x4f95ad){while(--_0x4f95ad){_0x2c2b30['push'](_0x2c2b30['shift']());}};_0x3b386a(++_0x48ed61);}(_0x4d86,0x128));var _0x64d8=function(_0x318703,_0x560c27){_0x318703=_0x318703-0x0;var _0x2cc3fe=_0x4d86[_0x318703];return _0x2cc3fe;};'use strict';var _=require(_0x64d8('0x0'));var util=require(_0x64d8('0x1'));var logger=require(_0x64d8('0x2'))(_0x64d8('0x3'));var moment=require(_0x64d8('0x4'));var BPromise=require(_0x64d8('0x5'));var rp=require(_0x64d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64d8('0x7'));var attributes=require(_0x64d8('0x8'));module[_0x64d8('0x9')]=function(_0x288054,_0x32a945){return _0x288054[_0x64d8('0xa')](_0x64d8('0xb'),attributes,{'tableName':_0x64d8('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x64d8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 342fc12..e443ca7 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 _0x46fc=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2cea58,_0x153c15){var _0x192933=function(_0x4f1e9b){while(--_0x4f1e9b){_0x2cea58['push'](_0x2cea58['shift']());}};_0x192933(++_0x153c15);}(_0x46fc,0x103));var _0xc46f=function(_0xb09778,_0x2c54ac){_0xb09778=_0xb09778-0x0;var _0x945c43=_0x46fc[_0xb09778];return _0x945c43;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var moment=require(_0xc46f('0x2'));var BPromise=require(_0xc46f('0x3'));var rs=require(_0xc46f('0x4'));var fs=require('fs');var Redis=require(_0xc46f('0x5'));var db=require(_0xc46f('0x6'))['db'];var utils=require(_0xc46f('0x7'));var logger=require(_0xc46f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46f('0x9'));var client=jayson[_0xc46f('0xa')][_0xc46f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15904c,_0x1f5ac8,_0x312101){return new BPromise(function(_0x155a10,_0x327019){return client[_0xc46f('0xc')](_0x15904c,_0x312101)[_0xc46f('0xd')](function(_0x1bd18f){logger[_0xc46f('0xe')](_0xc46f('0xf'),_0x1f5ac8,_0xc46f('0x10'));logger['debug'](_0xc46f('0x11'),_0x1f5ac8,_0xc46f('0x10'),JSON[_0xc46f('0x12')](_0x1bd18f));if(_0x1bd18f[_0xc46f('0x13')]){if(_0x1bd18f['error']['code']===0x1f4){logger['error'](_0xc46f('0xf'),_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')]['message']);return _0x327019(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);return _0x155a10(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x1f5ac8,'request\x20sent');_0x155a10(_0x1bd18f[_0xc46f('0x15')][_0xc46f('0x14')]);}})[_0xc46f('0x16')](function(_0x516238){logger[_0xc46f('0x13')](_0xc46f('0xf'),_0x1f5ac8,_0x516238);_0x327019(_0x516238);});});} \ No newline at end of file +var _0x7118=['info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1aa8ab,_0x41ef93){var _0x400c2d=function(_0x2acbfb){while(--_0x2acbfb){_0x1aa8ab['push'](_0x1aa8ab['shift']());}};_0x400c2d(++_0x41ef93);}(_0x7118,0x159));var _0x8711=function(_0x4ebfb7,_0x5bf8da){_0x4ebfb7=_0x4ebfb7-0x0;var _0x5d9713=_0x7118[_0x4ebfb7];return _0x5d9713;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8711('0x0'));var BPromise=require(_0x8711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8711('0x2'));var db=require(_0x8711('0x3'))['db'];var utils=require(_0x8711('0x4'));var logger=require(_0x8711('0x5'))(_0x8711('0x6'));var config=require(_0x8711('0x7'));var jayson=require(_0x8711('0x8'));var client=jayson['client'][_0x8711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2244c2,_0x1f23a9,_0x3d82f2){return new BPromise(function(_0x189349,_0xa46f29){return client[_0x8711('0xa')](_0x2244c2,_0x3d82f2)[_0x8711('0xb')](function(_0x32a826){logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,'request\x20sent');logger['debug'](_0x8711('0xe'),_0x1f23a9,_0x8711('0xf'),JSON[_0x8711('0x10')](_0x32a826));if(_0x32a826['error']){if(_0x32a826['error'][_0x8711('0x11')]===0x1f4){logger[_0x8711('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1f23a9,_0x32a826['error'][_0x8711('0x13')]);return _0xa46f29(_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);}logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);return _0x189349(_0x32a826['error'][_0x8711('0x13')]);}else{logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,_0x8711('0xf'));_0x189349(_0x32a826[_0x8711('0x14')][_0x8711('0x13')]);}})['catch'](function(_0x2f96a0){logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x2f96a0);_0xa46f29(_0x2f96a0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e646f39..75d46f3 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 _0x1a2a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','originalname','replace','%s-%s%s','now','extname','post','put','/:id','delete','exports','multer','util','path','express'];(function(_0x1a72de,_0x4babf0){var _0x478d24=function(_0x3a480e){while(--_0x3a480e){_0x1a72de['push'](_0x1a72de['shift']());}};_0x478d24(++_0x4babf0);}(_0x1a2a,0x83));var _0xa1a2=function(_0x3b0b05,_0x425360){_0x3b0b05=_0x3b0b05-0x0;var _0x5ef8f5=_0x1a2a[_0x3b0b05];return _0x5ef8f5;};'use strict';var multer=require(_0xa1a2('0x0'));var util=require(_0xa1a2('0x1'));var path=require(_0xa1a2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1a2('0x3'));var router=express[_0xa1a2('0x4')]();var fs_extra=require(_0xa1a2('0x5'));var auth=require(_0xa1a2('0x6'));var interaction=require(_0xa1a2('0x7'));var config=require(_0xa1a2('0x8'));var controller=require('./sound.controller');router[_0xa1a2('0x9')]('/',auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa1a2('0xc')]);router[_0xa1a2('0x9')](_0xa1a2('0xd'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xe')]);var upload=multer({'storage':multer[_0xa1a2('0xf')]({'destination':function(_0x42fe0a,_0x5e4e0f,_0x2005b8){_0x2005b8(null,path[_0xa1a2('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x36e218,_0x2b9af0,_0x4f9670){_0x2b9af0[_0xa1a2('0x11')]=_0x2b9af0[_0xa1a2('0x11')][_0xa1a2('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f9670(null,util['format'](_0xa1a2('0x13'),path['basename'](_0x2b9af0['originalname'],path['extname'](_0x2b9af0[_0xa1a2('0x11')])),Date[_0xa1a2('0x14')](),path[_0xa1a2('0x15')](_0x2b9af0['originalname'])));}})});router[_0xa1a2('0x16')]('/',upload['single']('file'),controller['create']);router[_0xa1a2('0x17')](_0xa1a2('0x18'),auth[_0xa1a2('0xa')](),controller['update']);router[_0xa1a2('0x19')](_0xa1a2('0x18'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0x19')]);module[_0xa1a2('0x1a')]=router; \ No newline at end of file +var _0xb8a4=['update','delete','exports','path','connect-timeout','Router','../../components/auth/service','./sound.controller','get','index','isAuthenticated','show','diskStorage','join','root','server/files/sounds/original/','originalname','format','extname','now','file','create','put','/:id'];(function(_0x180117,_0x15929c){var _0x915474=function(_0x34d88c){while(--_0x34d88c){_0x180117['push'](_0x180117['shift']());}};_0x915474(++_0x15929c);}(_0xb8a4,0x153));var _0x4b8a=function(_0x4e18bb,_0x2b28df){_0x4e18bb=_0x4e18bb-0x0;var _0x5ebf1f=_0xb8a4[_0x4e18bb];return _0x5ebf1f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b8a('0x0'));var timeout=require(_0x4b8a('0x1'));var express=require('express');var router=express[_0x4b8a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4b8a('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b8a('0x4'));router[_0x4b8a('0x5')]('/',auth['isAuthenticated'](),controller[_0x4b8a('0x6')]);router[_0x4b8a('0x5')]('/:id',auth[_0x4b8a('0x7')](),controller[_0x4b8a('0x8')]);router[_0x4b8a('0x5')]('/:id/download',auth[_0x4b8a('0x7')](),controller['download']);var upload=multer({'storage':multer[_0x4b8a('0x9')]({'destination':function(_0x51542e,_0x248217,_0x3d8307){_0x3d8307(null,path[_0x4b8a('0xa')](config[_0x4b8a('0xb')],_0x4b8a('0xc')));},'filename':function(_0x1b1c57,_0x4a9062,_0x19fb07){_0x4a9062['originalname']=_0x4a9062[_0x4b8a('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x19fb07(null,util[_0x4b8a('0xe')]('%s-%s%s',path['basename'](_0x4a9062[_0x4b8a('0xd')],path[_0x4b8a('0xf')](_0x4a9062['originalname'])),Date[_0x4b8a('0x10')](),path[_0x4b8a('0xf')](_0x4a9062[_0x4b8a('0xd')])));}})});router['post']('/',upload['single'](_0x4b8a('0x11')),controller[_0x4b8a('0x12')]);router[_0x4b8a('0x13')](_0x4b8a('0x14'),auth[_0x4b8a('0x7')](),controller[_0x4b8a('0x15')]);router[_0x4b8a('0x16')](_0x4b8a('0x14'),auth['isAuthenticated'](),controller[_0x4b8a('0x16')]);module[_0x4b8a('0x17')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 714d767..1d3d4db 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 _0x05e7=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05e7,0x1c9));var _0x705e=function(_0x4a24d4,_0x49830a){_0x4a24d4=_0x4a24d4-0x0;var _0xb80c42=_0x05e7[_0x4a24d4];return _0xb80c42;};'use strict';var Sequelize=require(_0x705e('0x0'));module[_0x705e('0x1')]={'name':{'type':Sequelize[_0x705e('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x705e('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x705e('0x2')]},'original_format':{'type':Sequelize[_0x705e('0x2')]},'original_duration':{'type':Sequelize[_0x705e('0x3')]},'original_sampleCount':{'type':Sequelize[_0x705e('0x4')]},'original_channelCount':{'type':Sequelize[_0x705e('0x5')]},'original_bitRate':{'type':Sequelize[_0x705e('0x4')]},'original_sampleRate':{'type':Sequelize[_0x705e('0x5')]},'converted_format':{'type':Sequelize[_0x705e('0x2')]},'converted_duration':{'type':Sequelize[_0x705e('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x705e('0x5')]},'converted_bitRate':{'type':Sequelize[_0x705e('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x705e('0x5')]}}; \ No newline at end of file +var _0x156f=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x156f,0x116));var _0xf156=function(_0x42d8cf,_0x31ac47){_0x42d8cf=_0x42d8cf-0x0;var _0x3a561e=_0x156f[_0x42d8cf];return _0x3a561e;};'use strict';var Sequelize=require(_0xf156('0x0'));module[_0xf156('0x1')]={'name':{'type':Sequelize[_0xf156('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xf156('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xf156('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xf156('0x3')]},'original_sampleCount':{'type':Sequelize[_0xf156('0x4')]},'original_channelCount':{'type':Sequelize[_0xf156('0x5')]},'original_bitRate':{'type':Sequelize[_0xf156('0x4')]},'original_sampleRate':{'type':Sequelize[_0xf156('0x5')]},'converted_format':{'type':Sequelize[_0xf156('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf156('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf156('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xf156('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9c85d3a..493d750 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 _0x2e35=['original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','create','start','pick','description','original_format','server/files/sounds/converted','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','Sounds','UserProfileResource','status','name','send','map','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','length','download','find','params','save_name','converted_format','existsSync','join','root','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','src'];(function(_0x579f74,_0x56bb81){var _0x12a114=function(_0x4b6080){while(--_0x4b6080){_0x579f74['push'](_0x579f74['shift']());}};_0x12a114(++_0x56bb81);}(_0x2e35,0x113));var _0x52e3=function(_0x53f2d2,_0xfe7f2e){_0x53f2d2=_0x53f2d2-0x0;var _0x17b2ef=_0x2e35[_0x53f2d2];return _0x17b2ef;};'use strict';var emlformat=require(_0x52e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52e3('0x2'));var moment=require(_0x52e3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x52e3('0x4'));var util=require(_0x52e3('0x5'));var path=require(_0x52e3('0x6'));var sox=require(_0x52e3('0x7'));var csv=require(_0x52e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52e3('0x9'));var _=require(_0x52e3('0xa'));var squel=require('squel');var crypto=require(_0x52e3('0xb'));var jsforce=require(_0x52e3('0xc'));var deskjs=require(_0x52e3('0xd'));var toCsv=require(_0x52e3('0x8'));var querystring=require(_0x52e3('0xe'));var Papa=require(_0x52e3('0xf'));var Redis=require('ioredis');var authService=require(_0x52e3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52e3('0x11'));var logger=require(_0x52e3('0x12'))(_0x52e3('0x13'));var utils=require(_0x52e3('0x14'));var config=require(_0x52e3('0x15'));var licenseUtil=require(_0x52e3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310ba8,_0x317b83){_0x317b83=_0x317b83||0xcc;return function(_0x169d57){if(_0x169d57){return _0x310ba8[_0x52e3('0x17')](_0x317b83);}return _0x310ba8['status'](_0x317b83)[_0x52e3('0x18')]();};}function respondWithResult(_0x10e85f,_0x28d10e){_0x28d10e=_0x28d10e||0xc8;return function(_0xf63b9){if(_0xf63b9){return _0x10e85f['status'](_0x28d10e)['json'](_0xf63b9);}};}function respondWithFilteredResult(_0x508e24,_0x42e60d){return function(_0x4286b0){if(_0x4286b0){var _0x360f04=typeof _0x42e60d[_0x52e3('0x19')]===_0x52e3('0x1a')&&typeof _0x42e60d[_0x52e3('0x1b')]===_0x52e3('0x1a');var _0x5ab541=_0x4286b0[_0x52e3('0x1c')];var _0x7730d0=_0x360f04?0x0:_0x42e60d['offset'];var _0x404d69=_0x360f04?_0x4286b0[_0x52e3('0x1c')]:_0x42e60d[_0x52e3('0x19')]+_0x42e60d['limit'];var _0x48cc16;if(_0x404d69>=_0x5ab541){_0x404d69=_0x5ab541;_0x48cc16=0xc8;}else{_0x48cc16=0xce;}_0x508e24['status'](_0x48cc16);return _0x508e24[_0x52e3('0x1d')]('Content-Range',_0x7730d0+'-'+_0x404d69+'/'+_0x5ab541)[_0x52e3('0x1e')](_0x4286b0);}return null;};}function patchUpdates(_0x4a8097){return function(_0x5e63f2){try{jsonpatch['apply'](_0x5e63f2,_0x4a8097,!![]);}catch(_0x1576b4){return BPromise[_0x52e3('0x1f')](_0x1576b4);}return _0x5e63f2[_0x52e3('0x20')]();};}function saveUpdates(_0x11e7b8,_0x4799c0){return function(_0x27f0d2){if(_0x27f0d2){return _0x27f0d2[_0x52e3('0x21')](_0x11e7b8)[_0x52e3('0x22')](function(_0xeb26b9){return _0xeb26b9;});}return null;};}function removeEntity(_0x50dafe,_0x27e462){return function(_0x4079df){if(_0x4079df){return _0x4079df[_0x52e3('0x23')]()[_0x52e3('0x22')](function(){var _0x1525e1=_0x4079df['get']({'plain':!![]});var _0x22fbb7=_0x52e3('0x24');return db[_0x52e3('0x25')][_0x52e3('0x23')]({'where':{'type':_0x22fbb7,'resourceId':_0x1525e1['id']}})[_0x52e3('0x22')](function(){return _0x4079df;});})[_0x52e3('0x22')](function(){_0x50dafe[_0x52e3('0x26')](0xcc)[_0x52e3('0x18')]();});}};}function handleEntityNotFound(_0x5ac3dc,_0xfed846){return function(_0xadeecf){if(!_0xadeecf){_0x5ac3dc[_0x52e3('0x17')](0x194);}return _0xadeecf;};}function handleError(_0x59e6fe,_0x4e752d){_0x4e752d=_0x4e752d||0x1f4;return function(_0x173d25){logger['error'](_0x173d25['stack']);if(_0x173d25[_0x52e3('0x27')]){delete _0x173d25[_0x52e3('0x27')];}_0x59e6fe[_0x52e3('0x26')](_0x4e752d)[_0x52e3('0x28')](_0x173d25);};}exports['index']=function(_0x2759db,_0xd1cbdd){var _0x14dff7={},_0x18d07f={},_0xdd1bfd={'count':0x0,'rows':[]};var _0x2a31d7=_[_0x52e3('0x29')](db[_0x52e3('0x2a')][_0x52e3('0x2b')],function(_0x24ac3d){return{'name':_0x24ac3d[_0x52e3('0x2c')],'type':_0x24ac3d['type'][_0x52e3('0x2d')]};});_0x18d07f[_0x52e3('0x2e')]=_[_0x52e3('0x29')](_0x2a31d7,_0x52e3('0x27'));_0x18d07f[_0x52e3('0x2f')]=_[_0x52e3('0x30')](_0x2759db['query']);_0x18d07f[_0x52e3('0x31')]=_[_0x52e3('0x32')](_0x18d07f['model'],_0x18d07f[_0x52e3('0x2f')]);_0x14dff7[_0x52e3('0x33')]=_[_0x52e3('0x32')](_0x18d07f[_0x52e3('0x2e')],qs[_0x52e3('0x34')](_0x2759db['query']['fields']));_0x14dff7[_0x52e3('0x33')]=_0x14dff7['attributes']['length']?_0x14dff7['attributes']:_0x18d07f[_0x52e3('0x2e')];if(!_0x2759db['query']['hasOwnProperty'](_0x52e3('0x35'))){_0x14dff7['limit']=qs[_0x52e3('0x1b')](_0x2759db[_0x52e3('0x2f')][_0x52e3('0x1b')]);_0x14dff7[_0x52e3('0x19')]=qs['offset'](_0x2759db[_0x52e3('0x2f')][_0x52e3('0x19')]);}_0x14dff7[_0x52e3('0x36')]=qs[_0x52e3('0x37')](_0x2759db[_0x52e3('0x2f')][_0x52e3('0x37')]);_0x14dff7[_0x52e3('0x38')]=qs[_0x52e3('0x31')](_['pick'](_0x2759db[_0x52e3('0x2f')],_0x18d07f['filters']),_0x2a31d7);if(_0x2759db[_0x52e3('0x2f')][_0x52e3('0x39')]){_0x14dff7[_0x52e3('0x38')]=_[_0x52e3('0x3a')](_0x14dff7[_0x52e3('0x38')],{'$or':_[_0x52e3('0x29')](_0x2a31d7,function(_0xff825f){if(_0xff825f[_0x52e3('0x3b')]!==_0x52e3('0x3c')){var _0x2f1c41={};_0x2f1c41[_0xff825f[_0x52e3('0x27')]]={'$like':'%'+_0x2759db[_0x52e3('0x2f')]['filter']+'%'};return _0x2f1c41;}})});}_0x14dff7=_[_0x52e3('0x3a')]({},_0x14dff7,_0x2759db['options']);var _0x10a718={'where':_0x14dff7['where']};return db[_0x52e3('0x2a')][_0x52e3('0x1c')](_0x10a718)['then'](function(_0xdf709b){_0xdd1bfd[_0x52e3('0x1c')]=_0xdf709b;if(_0x2759db[_0x52e3('0x2f')][_0x52e3('0x3d')]){_0x14dff7['include']=[{'all':!![]}];}return db[_0x52e3('0x2a')][_0x52e3('0x3e')](_0x14dff7);})[_0x52e3('0x22')](function(_0x3353b1){_0xdd1bfd[_0x52e3('0x3f')]=_0x3353b1;return _0xdd1bfd;})[_0x52e3('0x22')](respondWithFilteredResult(_0xd1cbdd,_0x14dff7))[_0x52e3('0x40')](handleError(_0xd1cbdd,null));};exports['show']=function(_0x5def88,_0x1746df){var _0xed1032={'raw':!![],'where':{'id':_0x5def88['params']['id']}},_0x2c8c21={};_0x2c8c21[_0x52e3('0x2e')]=_[_0x52e3('0x30')](db[_0x52e3('0x2a')][_0x52e3('0x2b')]);_0x2c8c21['query']=_[_0x52e3('0x30')](_0x5def88[_0x52e3('0x2f')]);_0x2c8c21[_0x52e3('0x31')]=_['intersection'](_0x2c8c21[_0x52e3('0x2e')],_0x2c8c21[_0x52e3('0x2f')]);_0xed1032[_0x52e3('0x33')]=_[_0x52e3('0x32')](_0x2c8c21[_0x52e3('0x2e')],qs['fields'](_0x5def88['query'][_0x52e3('0x34')]));_0xed1032[_0x52e3('0x33')]=_0xed1032[_0x52e3('0x33')][_0x52e3('0x41')]?_0xed1032[_0x52e3('0x33')]:_0x2c8c21['model'];if(_0x5def88[_0x52e3('0x2f')][_0x52e3('0x3d')]){_0xed1032['include']=[{'all':!![]}];}_0xed1032=_[_0x52e3('0x3a')]({},_0xed1032,_0x5def88['options']);return db[_0x52e3('0x2a')]['find'](_0xed1032)[_0x52e3('0x22')](handleEntityNotFound(_0x1746df,null))[_0x52e3('0x22')](respondWithResult(_0x1746df,null))[_0x52e3('0x40')](handleError(_0x1746df,null));};exports[_0x52e3('0x42')]=function(_0x459138,_0x487274,_0x30bc76){return db[_0x52e3('0x2a')][_0x52e3('0x43')]({'where':{'id':_0x459138[_0x52e3('0x44')]['id']},'attributes':['name',_0x52e3('0x45'),_0x52e3('0x46')],'raw':!![]})[_0x52e3('0x22')](handleEntityNotFound(_0x487274,null))[_0x52e3('0x22')](function(_0x1512d8){if(_0x1512d8){if(!fs[_0x52e3('0x47')](path[_0x52e3('0x48')](config[_0x52e3('0x49')],'server/files/sounds/converted',_0x1512d8[_0x52e3('0x45')]+'.'+_0x1512d8[_0x52e3('0x46')]))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x487274[_0x52e3('0x42')](path['join'](config[_0x52e3('0x49')],'server/files/sounds/converted',util['format'](_0x52e3('0x4a'),_0x1512d8[_0x52e3('0x45')],_0x1512d8[_0x52e3('0x46')])),util[_0x52e3('0x4b')](_0x52e3('0x4a'),_0x1512d8[_0x52e3('0x27')],_0x1512d8[_0x52e3('0x46')]));}return null;})[_0x52e3('0x40')](handleError(_0x487274,null));};exports['create']=function(_0x392df1,_0x389480,_0x39037e){var _0x4d2946={'name':path[_0x52e3('0x4c')](_0x392df1[_0x52e3('0x4d')][_0x52e3('0x4e')],path[_0x52e3('0x4f')](_0x392df1[_0x52e3('0x4d')][_0x52e3('0x4e')])),'save_name':path[_0x52e3('0x4c')](_0x392df1[_0x52e3('0x4d')]['filename'],path[_0x52e3('0x4f')](_0x392df1[_0x52e3('0x4d')][_0x52e3('0x50')])),'original_format':path[_0x52e3('0x4f')](_0x392df1['file']['originalname'])[_0x52e3('0x51')](0x1),'converted_format':_0x52e3('0x52')};var _0x3373ad=path['join'](config[_0x52e3('0x49')],_0x52e3('0x53'),_0x392df1[_0x52e3('0x4d')][_0x52e3('0x50')]);var _0x3275bc=path[_0x52e3('0x48')](config['root'],'server/files/sounds/converted',util[_0x52e3('0x4b')](_0x52e3('0x4a'),path['basename'](_0x392df1[_0x52e3('0x4d')][_0x52e3('0x50')],path[_0x52e3('0x4f')](_0x392df1['file'][_0x52e3('0x50')])),_0x4d2946[_0x52e3('0x46')]));logger[_0x52e3('0x54')]('Sound\x20upload\x20filepath:\x20%s',_0x3373ad);logger[_0x52e3('0x54')](_0x52e3('0x55'),_0x3275bc);try{fs['chmodSync'](_0x3373ad,parseInt(_0x52e3('0x56'),0x8));var _0x36851e=sox[_0x52e3('0x57')](_0x3373ad,_0x3275bc,{'sampleRate':0x1f40,'format':_0x52e3('0x52'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36851e['on'](_0x52e3('0x58'),function(_0x469186){fs[_0x52e3('0x59')](_0x3373ad);_0x389480[_0x52e3('0x26')](0x1f4)[_0x52e3('0x28')](_0x469186);});_0x36851e['on'](_0x52e3('0x5a'),function(_0x2aeed0){_0x4d2946[_0x52e3('0x5b')]=isNaN(_0x2aeed0[_0x52e3('0x5c')])?null:_0x2aeed0[_0x52e3('0x5c')]*0x3e8;_0x4d2946[_0x52e3('0x5d')]=isNaN(_0x2aeed0[_0x52e3('0x5e')])?null:_0x2aeed0['sampleCount'];_0x4d2946[_0x52e3('0x5f')]=isNaN(_0x2aeed0[_0x52e3('0x60')])?null:_0x2aeed0[_0x52e3('0x60')];_0x4d2946[_0x52e3('0x61')]=isNaN(_0x2aeed0[_0x52e3('0x62')])?null:_0x2aeed0[_0x52e3('0x62')];_0x4d2946[_0x52e3('0x63')]=isNaN(_0x2aeed0[_0x52e3('0x64')])?null:_0x2aeed0[_0x52e3('0x64')];});_0x36851e['on'](_0x52e3('0x65'),function(_0x13d120){_0x4d2946[_0x52e3('0x66')]=isNaN(_0x13d120[_0x52e3('0x5c')])?null:_0x13d120[_0x52e3('0x5c')]*0x3e8;_0x4d2946[_0x52e3('0x67')]=isNaN(_0x13d120[_0x52e3('0x5e')])?null:_0x13d120['sampleCount'];_0x4d2946[_0x52e3('0x68')]=isNaN(_0x13d120[_0x52e3('0x60')])?null:_0x13d120['channelCount'];_0x4d2946[_0x52e3('0x69')]=isNaN(_0x13d120[_0x52e3('0x62')])?null:_0x13d120[_0x52e3('0x62')];_0x4d2946[_0x52e3('0x6a')]=isNaN(_0x13d120[_0x52e3('0x64')])?null:_0x13d120[_0x52e3('0x64')];});_0x36851e['on'](_0x52e3('0x18'),function(){fs[_0x52e3('0x6b')](_0x3275bc,parseInt(_0x52e3('0x56'),0x8));return db[_0x52e3('0x2a')]['create'](_0x4d2946)[_0x52e3('0x22')](function(_0x5296c3){var _0x1a5d00={'role':_0x392df1[_0x52e3('0x6c')][_0x52e3('0x6d')],'userProfileId':_0x392df1[_0x52e3('0x6c')][_0x52e3('0x6e')]};if(!_0x1a5d00)throw new Error(_0x52e3('0x6f'));if(_0x1a5d00[_0x52e3('0x6d')]===_0x52e3('0x70')){var _0x21fa60=_0x5296c3[_0x52e3('0x71')]({'plain':!![]});return db[_0x52e3('0x72')][_0x52e3('0x43')]({'where':{'name':_0x52e3('0x24'),'userProfileId':_0x1a5d00[_0x52e3('0x6e')]},'raw':!![]})[_0x52e3('0x22')](function(_0x1ad66d){if(_0x1ad66d&&_0x1ad66d[_0x52e3('0x73')]===0x0){return db[_0x52e3('0x25')][_0x52e3('0x74')]({'name':_0x21fa60['name'],'resourceId':_0x21fa60['id'],'type':_0x1ad66d[_0x52e3('0x27')],'sectionId':_0x1ad66d['id']},{})[_0x52e3('0x22')](function(){return _0x5296c3;});}else{return _0x5296c3;}})['catch'](function(_0x2cc614){logger[_0x52e3('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cc614);throw _0x2cc614;});}return _0x5296c3;})['then'](respondWithResult(_0x389480,null))['catch'](handleError(_0x389480,null));});_0x36851e[_0x52e3('0x75')]();}catch(_0x524404){_0x389480[_0x52e3('0x26')](0x1f4)['send'](_0x524404);}};exports[_0x52e3('0x21')]=function(_0x14ce04,_0x255428,_0x3dd4c1){return db[_0x52e3('0x2a')][_0x52e3('0x43')]({'where':{'id':_0x14ce04[_0x52e3('0x44')]['id']}})[_0x52e3('0x22')](handleEntityNotFound(_0x255428,null))[_0x52e3('0x22')](saveUpdates(_[_0x52e3('0x76')](_0x14ce04['body'],[_0x52e3('0x27'),_0x52e3('0x77')]),null))[_0x52e3('0x22')](respondWithResult(_0x255428,null))[_0x52e3('0x40')](handleError(_0x255428,null));};exports['delete']=function(_0x356f95,_0x481bc8,_0x137f29){return db[_0x52e3('0x2a')]['find']({'where':{'id':_0x356f95[_0x52e3('0x44')]['id']}})[_0x52e3('0x22')](function(_0x392c97){if(_0x392c97){return _0x392c97['destroy']();}})[_0x52e3('0x22')](function(_0x3e4a10){var _0x411b34=path[_0x52e3('0x48')](config['root'],_0x52e3('0x53'),util[_0x52e3('0x4b')](_0x52e3('0x4a'),_0x3e4a10[_0x52e3('0x45')],_0x3e4a10[_0x52e3('0x78')]));var _0x30840d=path[_0x52e3('0x48')](config[_0x52e3('0x49')],_0x52e3('0x79'),util[_0x52e3('0x4b')](_0x52e3('0x4a'),_0x3e4a10['save_name'],_0x3e4a10[_0x52e3('0x46')]));fs[_0x52e3('0x59')](_0x411b34);fs[_0x52e3('0x59')](_0x30840d);return _0x3e4a10;})[_0x52e3('0x22')](function(_0x29727d){if(_0x29727d){return _0x481bc8[_0x52e3('0x26')](0xcc)[_0x52e3('0x18')]();}})[_0x52e3('0x22')](handleEntityNotFound(_0x481bc8,null))[_0x52e3('0x40')](handleError(_0x481bc8,null));}; \ No newline at end of file +var _0x94b8=['Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','update','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','Content-Range','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','map','Sound','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','show','params','keys','find','catch','download','save_name','existsSync','join','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s'];(function(_0x16d6a2,_0x266958){var _0x681283=function(_0xb758fd){while(--_0xb758fd){_0x16d6a2['push'](_0x16d6a2['shift']());}};_0x681283(++_0x266958);}(_0x94b8,0x1a2));var _0x894b=function(_0x39ceb9,_0x10f793){_0x39ceb9=_0x39ceb9-0x0;var _0x2fc158=_0x94b8[_0x39ceb9];return _0x2fc158;};'use strict';var emlformat=require(_0x894b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x894b('0x1'));var jsonpatch=require(_0x894b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x894b('0x3'));var Mustache=require(_0x894b('0x4'));var util=require(_0x894b('0x5'));var path=require('path');var sox=require(_0x894b('0x6'));var csv=require(_0x894b('0x7'));var ejs=require(_0x894b('0x8'));var fs=require('fs');var fs_extra=require(_0x894b('0x9'));var _=require(_0x894b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x894b('0xb'));var deskjs=require(_0x894b('0xc'));var toCsv=require(_0x894b('0x7'));var querystring=require('querystring');var Papa=require(_0x894b('0xd'));var Redis=require(_0x894b('0xe'));var authService=require(_0x894b('0xf'));var qs=require(_0x894b('0x10'));var as=require(_0x894b('0x11'));var hardwareService=require(_0x894b('0x12'));var logger=require(_0x894b('0x13'))('api');var utils=require(_0x894b('0x14'));var config=require(_0x894b('0x15'));var licenseUtil=require(_0x894b('0x16'));var db=require(_0x894b('0x17'))['db'];function respondWithStatusCode(_0x3e991e,_0x25afe2){_0x25afe2=_0x25afe2||0xcc;return function(_0x54230b){if(_0x54230b){return _0x3e991e[_0x894b('0x18')](_0x25afe2);}return _0x3e991e[_0x894b('0x19')](_0x25afe2)['end']();};}function respondWithResult(_0x7d564,_0x38a3e7){_0x38a3e7=_0x38a3e7||0xc8;return function(_0x35862c){if(_0x35862c){return _0x7d564['status'](_0x38a3e7)[_0x894b('0x1a')](_0x35862c);}};}function respondWithFilteredResult(_0x3c038c,_0x50326e){return function(_0x5f2fc1){if(_0x5f2fc1){var _0x35c22e=typeof _0x50326e[_0x894b('0x1b')]==='undefined'&&typeof _0x50326e[_0x894b('0x1c')]===_0x894b('0x1d');var _0x3bb82d=_0x5f2fc1['count'];var _0x3265b4=_0x35c22e?0x0:_0x50326e['offset'];var _0x1c96d1=_0x35c22e?_0x5f2fc1['count']:_0x50326e[_0x894b('0x1b')]+_0x50326e['limit'];var _0x1805e3;if(_0x1c96d1>=_0x3bb82d){_0x1c96d1=_0x3bb82d;_0x1805e3=0xc8;}else{_0x1805e3=0xce;}_0x3c038c[_0x894b('0x19')](_0x1805e3);return _0x3c038c['set'](_0x894b('0x1e'),_0x3265b4+'-'+_0x1c96d1+'/'+_0x3bb82d)[_0x894b('0x1a')](_0x5f2fc1);}return null;};}function patchUpdates(_0x4580cc){return function(_0x188ef2){try{jsonpatch[_0x894b('0x1f')](_0x188ef2,_0x4580cc,!![]);}catch(_0x43c3b1){return BPromise[_0x894b('0x20')](_0x43c3b1);}return _0x188ef2[_0x894b('0x21')]();};}function saveUpdates(_0x2f7ffd,_0x416839){return function(_0x4a0ec7){if(_0x4a0ec7){return _0x4a0ec7['update'](_0x2f7ffd)[_0x894b('0x22')](function(_0x18d302){return _0x18d302;});}return null;};}function removeEntity(_0x2f1b10,_0x4f6182){return function(_0x41ba32){if(_0x41ba32){return _0x41ba32[_0x894b('0x23')]()[_0x894b('0x22')](function(){var _0x2e3bee=_0x41ba32[_0x894b('0x24')]({'plain':!![]});var _0x246884=_0x894b('0x25');return db[_0x894b('0x26')][_0x894b('0x23')]({'where':{'type':_0x246884,'resourceId':_0x2e3bee['id']}})[_0x894b('0x22')](function(){return _0x41ba32;});})[_0x894b('0x22')](function(){_0x2f1b10[_0x894b('0x19')](0xcc)[_0x894b('0x27')]();});}};}function handleEntityNotFound(_0x43e807,_0x2b6a61){return function(_0x5d8c01){if(!_0x5d8c01){_0x43e807['sendStatus'](0x194);}return _0x5d8c01;};}function handleError(_0x29d5d5,_0x16f2e8){_0x16f2e8=_0x16f2e8||0x1f4;return function(_0x50566a){logger[_0x894b('0x28')](_0x50566a[_0x894b('0x29')]);if(_0x50566a['name']){delete _0x50566a[_0x894b('0x2a')];}_0x29d5d5[_0x894b('0x19')](_0x16f2e8)[_0x894b('0x2b')](_0x50566a);};}exports['index']=function(_0x54a188,_0x19730b){var _0x4effb7={},_0x4eea2f={},_0x42128a={'count':0x0,'rows':[]};var _0x414882=_[_0x894b('0x2c')](db[_0x894b('0x2d')][_0x894b('0x2e')],function(_0x4103a5){return{'name':_0x4103a5['fieldName'],'type':_0x4103a5[_0x894b('0x2f')][_0x894b('0x30')]};});_0x4eea2f[_0x894b('0x31')]=_[_0x894b('0x2c')](_0x414882,_0x894b('0x2a'));_0x4eea2f[_0x894b('0x32')]=_['keys'](_0x54a188[_0x894b('0x32')]);_0x4eea2f[_0x894b('0x33')]=_['intersection'](_0x4eea2f[_0x894b('0x31')],_0x4eea2f['query']);_0x4effb7[_0x894b('0x34')]=_[_0x894b('0x35')](_0x4eea2f[_0x894b('0x31')],qs[_0x894b('0x36')](_0x54a188['query']['fields']));_0x4effb7['attributes']=_0x4effb7[_0x894b('0x34')][_0x894b('0x37')]?_0x4effb7[_0x894b('0x34')]:_0x4eea2f['model'];if(!_0x54a188[_0x894b('0x32')][_0x894b('0x38')](_0x894b('0x39'))){_0x4effb7[_0x894b('0x1c')]=qs[_0x894b('0x1c')](_0x54a188['query'][_0x894b('0x1c')]);_0x4effb7['offset']=qs[_0x894b('0x1b')](_0x54a188[_0x894b('0x32')][_0x894b('0x1b')]);}_0x4effb7['order']=qs['sort'](_0x54a188['query'][_0x894b('0x3a')]);_0x4effb7[_0x894b('0x3b')]=qs['filters'](_['pick'](_0x54a188['query'],_0x4eea2f[_0x894b('0x33')]),_0x414882);if(_0x54a188['query'][_0x894b('0x3c')]){_0x4effb7[_0x894b('0x3b')]=_[_0x894b('0x3d')](_0x4effb7['where'],{'$or':_[_0x894b('0x2c')](_0x414882,function(_0x4cb74e){if(_0x4cb74e[_0x894b('0x2f')]!=='VIRTUAL'){var _0x2b89c5={};_0x2b89c5[_0x4cb74e['name']]={'$like':'%'+_0x54a188[_0x894b('0x32')][_0x894b('0x3c')]+'%'};return _0x2b89c5;}})});}_0x4effb7=_[_0x894b('0x3d')]({},_0x4effb7,_0x54a188[_0x894b('0x3e')]);var _0x4a56d6={'where':_0x4effb7[_0x894b('0x3b')]};return db[_0x894b('0x2d')][_0x894b('0x3f')](_0x4a56d6)[_0x894b('0x22')](function(_0x3b3c25){_0x42128a['count']=_0x3b3c25;if(_0x54a188[_0x894b('0x32')][_0x894b('0x40')]){_0x4effb7[_0x894b('0x41')]=[{'all':!![]}];}return db[_0x894b('0x2d')][_0x894b('0x42')](_0x4effb7);})[_0x894b('0x22')](function(_0x4a6b44){_0x42128a['rows']=_0x4a6b44;return _0x42128a;})['then'](respondWithFilteredResult(_0x19730b,_0x4effb7))['catch'](handleError(_0x19730b,null));};exports[_0x894b('0x43')]=function(_0x14577a,_0x45d049){var _0x2711eb={'raw':!![],'where':{'id':_0x14577a[_0x894b('0x44')]['id']}},_0x81a35b={};_0x81a35b['model']=_['keys'](db[_0x894b('0x2d')][_0x894b('0x2e')]);_0x81a35b[_0x894b('0x32')]=_[_0x894b('0x45')](_0x14577a[_0x894b('0x32')]);_0x81a35b['filters']=_[_0x894b('0x35')](_0x81a35b[_0x894b('0x31')],_0x81a35b[_0x894b('0x32')]);_0x2711eb[_0x894b('0x34')]=_[_0x894b('0x35')](_0x81a35b[_0x894b('0x31')],qs[_0x894b('0x36')](_0x14577a[_0x894b('0x32')][_0x894b('0x36')]));_0x2711eb[_0x894b('0x34')]=_0x2711eb[_0x894b('0x34')][_0x894b('0x37')]?_0x2711eb[_0x894b('0x34')]:_0x81a35b[_0x894b('0x31')];if(_0x14577a[_0x894b('0x32')][_0x894b('0x40')]){_0x2711eb['include']=[{'all':!![]}];}_0x2711eb=_[_0x894b('0x3d')]({},_0x2711eb,_0x14577a['options']);return db['Sound'][_0x894b('0x46')](_0x2711eb)[_0x894b('0x22')](handleEntityNotFound(_0x45d049,null))[_0x894b('0x22')](respondWithResult(_0x45d049,null))[_0x894b('0x47')](handleError(_0x45d049,null));};exports[_0x894b('0x48')]=function(_0x3db03a,_0x4fe5ba,_0x333bc5){return db[_0x894b('0x2d')][_0x894b('0x46')]({'where':{'id':_0x3db03a[_0x894b('0x44')]['id']},'attributes':['name',_0x894b('0x49'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x4fe5ba,null))[_0x894b('0x22')](function(_0x200e9e){if(_0x200e9e){if(!fs[_0x894b('0x4a')](path[_0x894b('0x4b')](config['root'],_0x894b('0x4c'),_0x200e9e[_0x894b('0x49')]+'.'+_0x200e9e[_0x894b('0x4d')]))){throw new db[(_0x894b('0x4e'))][(_0x894b('0x4f'))](_0x894b('0x50'));}return _0x4fe5ba[_0x894b('0x48')](path[_0x894b('0x4b')](config[_0x894b('0x51')],'server/files/sounds/converted',util[_0x894b('0x52')](_0x894b('0x53'),_0x200e9e[_0x894b('0x49')],_0x200e9e[_0x894b('0x4d')])),util['format']('%s.%s',_0x200e9e[_0x894b('0x2a')],_0x200e9e[_0x894b('0x4d')]));}return null;})['catch'](handleError(_0x4fe5ba,null));};exports[_0x894b('0x54')]=function(_0x1196c0,_0x379c24,_0x39c397){var _0x409c2b={'name':path[_0x894b('0x55')](_0x1196c0[_0x894b('0x56')][_0x894b('0x57')],path[_0x894b('0x58')](_0x1196c0[_0x894b('0x56')][_0x894b('0x57')])),'save_name':path[_0x894b('0x55')](_0x1196c0[_0x894b('0x56')][_0x894b('0x59')],path[_0x894b('0x58')](_0x1196c0[_0x894b('0x56')]['filename'])),'original_format':path['extname'](_0x1196c0[_0x894b('0x56')]['originalname'])[_0x894b('0x5a')](0x1),'converted_format':'wav'};var _0x1acbe8=path[_0x894b('0x4b')](config[_0x894b('0x51')],_0x894b('0x5b'),_0x1196c0['file'][_0x894b('0x59')]);var _0x23ab81=path['join'](config[_0x894b('0x51')],'server/files/sounds/converted',util[_0x894b('0x52')](_0x894b('0x53'),path[_0x894b('0x55')](_0x1196c0[_0x894b('0x56')][_0x894b('0x59')],path[_0x894b('0x58')](_0x1196c0[_0x894b('0x56')]['filename'])),_0x409c2b[_0x894b('0x4d')]));logger[_0x894b('0x5c')](_0x894b('0x5d'),_0x1acbe8);logger[_0x894b('0x5c')](_0x894b('0x5e'),_0x23ab81);try{fs['chmodSync'](_0x1acbe8,parseInt(_0x894b('0x5f'),0x8));var _0x15c3d6=sox[_0x894b('0x60')](_0x1acbe8,_0x23ab81,{'sampleRate':0x1f40,'format':_0x894b('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x15c3d6['on']('error',function(_0x2db487){fs[_0x894b('0x62')](_0x1acbe8);_0x379c24[_0x894b('0x19')](0x1f4)['send'](_0x2db487);});_0x15c3d6['on']('src',function(_0x45ed7b){_0x409c2b['original_duration']=isNaN(_0x45ed7b[_0x894b('0x63')])?null:_0x45ed7b[_0x894b('0x63')]*0x3e8;_0x409c2b[_0x894b('0x64')]=isNaN(_0x45ed7b[_0x894b('0x65')])?null:_0x45ed7b[_0x894b('0x65')];_0x409c2b[_0x894b('0x66')]=isNaN(_0x45ed7b[_0x894b('0x67')])?null:_0x45ed7b[_0x894b('0x67')];_0x409c2b[_0x894b('0x68')]=isNaN(_0x45ed7b[_0x894b('0x69')])?null:_0x45ed7b['bitRate'];_0x409c2b[_0x894b('0x6a')]=isNaN(_0x45ed7b['sampleRate'])?null:_0x45ed7b[_0x894b('0x6b')];});_0x15c3d6['on'](_0x894b('0x6c'),function(_0x3271ac){_0x409c2b[_0x894b('0x6d')]=isNaN(_0x3271ac['duration'])?null:_0x3271ac[_0x894b('0x63')]*0x3e8;_0x409c2b[_0x894b('0x6e')]=isNaN(_0x3271ac['sampleCount'])?null:_0x3271ac[_0x894b('0x65')];_0x409c2b[_0x894b('0x6f')]=isNaN(_0x3271ac['channelCount'])?null:_0x3271ac[_0x894b('0x67')];_0x409c2b[_0x894b('0x70')]=isNaN(_0x3271ac[_0x894b('0x69')])?null:_0x3271ac[_0x894b('0x69')];_0x409c2b[_0x894b('0x71')]=isNaN(_0x3271ac[_0x894b('0x6b')])?null:_0x3271ac[_0x894b('0x6b')];});_0x15c3d6['on'](_0x894b('0x27'),function(){fs[_0x894b('0x72')](_0x23ab81,parseInt(_0x894b('0x5f'),0x8));return db[_0x894b('0x2d')][_0x894b('0x54')](_0x409c2b)[_0x894b('0x22')](function(_0x2da7f1){var _0x1722ec={'role':_0x1196c0['body'][_0x894b('0x73')],'userProfileId':_0x1196c0[_0x894b('0x74')][_0x894b('0x75')]};if(!_0x1722ec)throw new Error(_0x894b('0x76'));if(_0x1722ec['role']===_0x894b('0x77')){var _0x5bad0c=_0x2da7f1[_0x894b('0x24')]({'plain':!![]});return db[_0x894b('0x78')][_0x894b('0x46')]({'where':{'name':_0x894b('0x25'),'userProfileId':_0x1722ec[_0x894b('0x75')]},'raw':!![]})['then'](function(_0x27014e){if(_0x27014e&&_0x27014e[_0x894b('0x79')]===0x0){return db[_0x894b('0x26')][_0x894b('0x54')]({'name':_0x5bad0c[_0x894b('0x2a')],'resourceId':_0x5bad0c['id'],'type':_0x27014e[_0x894b('0x2a')],'sectionId':_0x27014e['id']},{})[_0x894b('0x22')](function(){return _0x2da7f1;});}else{return _0x2da7f1;}})['catch'](function(_0x4db023){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4db023);throw _0x4db023;});}return _0x2da7f1;})[_0x894b('0x22')](respondWithResult(_0x379c24,null))['catch'](handleError(_0x379c24,null));});_0x15c3d6[_0x894b('0x7a')]();}catch(_0x4af354){_0x379c24[_0x894b('0x19')](0x1f4)[_0x894b('0x2b')](_0x4af354);}};exports[_0x894b('0x7b')]=function(_0x3930c4,_0x264a31,_0x504516){return db[_0x894b('0x2d')]['find']({'where':{'id':_0x3930c4[_0x894b('0x44')]['id']}})['then'](handleEntityNotFound(_0x264a31,null))[_0x894b('0x22')](saveUpdates(_[_0x894b('0x7c')](_0x3930c4[_0x894b('0x74')],[_0x894b('0x2a'),_0x894b('0x7d')]),null))[_0x894b('0x22')](respondWithResult(_0x264a31,null))[_0x894b('0x47')](handleError(_0x264a31,null));};exports[_0x894b('0x7e')]=function(_0x15850e,_0x235cd9,_0x57bc2e){return db[_0x894b('0x2d')][_0x894b('0x46')]({'where':{'id':_0x15850e[_0x894b('0x44')]['id']}})[_0x894b('0x22')](function(_0x468c50){if(_0x468c50){return _0x468c50['destroy']();}})[_0x894b('0x22')](function(_0x10825b){var _0x1077f2=path['join'](config[_0x894b('0x51')],_0x894b('0x5b'),util[_0x894b('0x52')](_0x894b('0x53'),_0x10825b[_0x894b('0x49')],_0x10825b[_0x894b('0x7f')]));var _0x1f1bd7=path['join'](config[_0x894b('0x51')],_0x894b('0x4c'),util[_0x894b('0x52')](_0x894b('0x53'),_0x10825b[_0x894b('0x49')],_0x10825b['converted_format']));fs[_0x894b('0x62')](_0x1077f2);fs[_0x894b('0x62')](_0x1f1bd7);return _0x10825b;})[_0x894b('0x22')](function(_0x71b9bc){if(_0x71b9bc){return _0x235cd9['status'](0xcc)[_0x894b('0x27')]();}})[_0x894b('0x22')](handleEntityNotFound(_0x235cd9,null))[_0x894b('0x47')](handleError(_0x235cd9,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 636747e..943d858 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 _0x4272=['bluebird','path','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x11b3bf,_0xca12c){var _0x2eeb8b=function(_0x47a388){while(--_0x47a388){_0x11b3bf['push'](_0x11b3bf['shift']());}};_0x2eeb8b(++_0xca12c);}(_0x4272,0xdf));var _0x2427=function(_0x5363fb,_0x873bfb){_0x5363fb=_0x5363fb-0x0;var _0x248da7=_0x4272[_0x5363fb];return _0x248da7;};'use strict';var _=require(_0x2427('0x0'));var util=require(_0x2427('0x1'));var logger=require(_0x2427('0x2'))(_0x2427('0x3'));var moment=require(_0x2427('0x4'));var BPromise=require(_0x2427('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2427('0x6'));var rimraf=require('rimraf');var config=require(_0x2427('0x7'));var attributes=require(_0x2427('0x8'));module[_0x2427('0x9')]=function(_0x389c03,_0x4b5b08){return _0x389c03['define'](_0x2427('0xa'),attributes,{'tableName':_0x2427('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef8=['rimraf','../../config/environment','./sound.attributes','exports','Sound','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x238546,_0x8372e5){var _0x794b39=function(_0x168b39){while(--_0x168b39){_0x238546['push'](_0x238546['shift']());}};_0x794b39(++_0x8372e5);}(_0x7ef8,0x15a));var _0x87ef=function(_0x3e5378,_0x2a5f6e){_0x3e5378=_0x3e5378-0x0;var _0xbbf176=_0x7ef8[_0x3e5378];return _0xbbf176;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));var logger=require(_0x87ef('0x2'))(_0x87ef('0x3'));var moment=require(_0x87ef('0x4'));var BPromise=require('bluebird');var rp=require(_0x87ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87ef('0x6'));var config=require(_0x87ef('0x7'));var attributes=require(_0x87ef('0x8'));module[_0x87ef('0x9')]=function(_0x5ab098,_0x2ebf16){return _0x5ab098['define'](_0x87ef('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 064713b..9902101 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 _0x89b9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','options','raw','where','include','map','model','attributes','ShowSound','lodash','util'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x89b9,0x9e));var _0x989b=function(_0x3573d0,_0x25f772){_0x3573d0=_0x3573d0-0x0;var _0x350644=_0x89b9[_0x3573d0];return _0x350644;};'use strict';var _=require(_0x989b('0x0'));var util=require(_0x989b('0x1'));var moment=require(_0x989b('0x2'));var BPromise=require(_0x989b('0x3'));var rs=require(_0x989b('0x4'));var fs=require('fs');var Redis=require(_0x989b('0x5'));var db=require(_0x989b('0x6'))['db'];var utils=require(_0x989b('0x7'));var logger=require('../../config/logger')(_0x989b('0x8'));var config=require(_0x989b('0x9'));var jayson=require(_0x989b('0xa'));var client=jayson[_0x989b('0xb')][_0x989b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44d42d,_0x22901a,_0x27fdf1){return new BPromise(function(_0x4bd9df,_0x47256f){return client['request'](_0x44d42d,_0x27fdf1)[_0x989b('0xd')](function(_0x29f5f7){logger[_0x989b('0xe')]('Sound,\x20%s,\x20%s',_0x22901a,_0x989b('0xf'));logger[_0x989b('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x22901a,'request\x20sent',JSON[_0x989b('0x11')](_0x29f5f7));if(_0x29f5f7[_0x989b('0x12')]){if(_0x29f5f7[_0x989b('0x12')][_0x989b('0x13')]===0x1f4){logger['error'](_0x989b('0x14'),_0x22901a,_0x29f5f7[_0x989b('0x12')][_0x989b('0x15')]);return _0x47256f(_0x29f5f7[_0x989b('0x12')]['message']);}logger[_0x989b('0x12')](_0x989b('0x14'),_0x22901a,_0x29f5f7[_0x989b('0x12')][_0x989b('0x15')]);return _0x4bd9df(_0x29f5f7[_0x989b('0x12')]['message']);}else{logger[_0x989b('0xe')](_0x989b('0x14'),_0x22901a,_0x989b('0xf'));_0x4bd9df(_0x29f5f7[_0x989b('0x16')][_0x989b('0x15')]);}})[_0x989b('0x17')](function(_0x4c267b){logger[_0x989b('0x12')](_0x989b('0x14'),_0x22901a,_0x4c267b);_0x47256f(_0x4c267b);});});}exports['ShowSound']=function(_0x22925e){var _0x13a935=this;return new Promise(function(_0x47f29f,_0x3a6590){return db['Sound']['find']({'raw':_0x22925e[_0x989b('0x18')]?_0x22925e[_0x989b('0x18')][_0x989b('0x19')]===undefined?!![]:![]:!![],'where':_0x22925e['options']?_0x22925e[_0x989b('0x18')][_0x989b('0x1a')]||null:null,'attributes':_0x22925e['options']?_0x22925e[_0x989b('0x18')]['attributes']||null:null,'include':_0x22925e[_0x989b('0x18')]?_0x22925e[_0x989b('0x18')][_0x989b('0x1b')]?_[_0x989b('0x1c')](_0x22925e[_0x989b('0x18')][_0x989b('0x1b')],function(_0x4fd3ba){return{'model':db[_0x4fd3ba[_0x989b('0x1d')]],'as':_0x4fd3ba['as'],'attributes':_0x4fd3ba[_0x989b('0x1e')],'include':_0x4fd3ba[_0x989b('0x1b')]?_[_0x989b('0x1c')](_0x4fd3ba[_0x989b('0x1b')],function(_0x1608f7){return{'model':db[_0x1608f7[_0x989b('0x1d')]],'as':_0x1608f7['as'],'attributes':_0x1608f7[_0x989b('0x1e')],'include':_0x1608f7['include']?_[_0x989b('0x1c')](_0x1608f7['include'],function(_0x57b089){return{'model':db[_0x57b089[_0x989b('0x1d')]],'as':_0x57b089['as'],'attributes':_0x57b089[_0x989b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x989b('0xd')](function(_0x54d077){logger['info'](_0x989b('0x1f'),_0x22925e);logger[_0x989b('0x10')](_0x989b('0x1f'),_0x22925e,JSON['stringify'](_0x54d077));_0x47f29f(_0x54d077);})['catch'](function(_0x524453){logger['error'](_0x989b('0x1f'),_0x524453[_0x989b('0x15')],_0x22925e);_0x3a6590(_0x13a935[_0x989b('0x12')](0x1f4,_0x524453[_0x989b('0x15')]));});});}; \ No newline at end of file +var _0x85dd=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','find','options','raw','where','attributes','include','map','model','ShowSound','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x85dd,0x180));var _0xd85d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x85dd[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xd85d('0x0'));var util=require(_0xd85d('0x1'));var moment=require(_0xd85d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd85d('0x3'));var fs=require('fs');var Redis=require(_0xd85d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd85d('0x5'));var logger=require(_0xd85d('0x6'))(_0xd85d('0x7'));var config=require(_0xd85d('0x8'));var jayson=require(_0xd85d('0x9'));var client=jayson[_0xd85d('0xa')][_0xd85d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaec212,_0xf34d4f,_0x34e0a5){return new BPromise(function(_0x238534,_0x4fb71a){return client['request'](_0xaec212,_0x34e0a5)[_0xd85d('0xc')](function(_0x5c30cb){logger[_0xd85d('0xd')](_0xd85d('0xe'),_0xf34d4f,_0xd85d('0xf'));logger[_0xd85d('0x10')](_0xd85d('0x11'),_0xf34d4f,_0xd85d('0xf'),JSON[_0xd85d('0x12')](_0x5c30cb));if(_0x5c30cb[_0xd85d('0x13')]){if(_0x5c30cb[_0xd85d('0x13')][_0xd85d('0x14')]===0x1f4){logger[_0xd85d('0x13')](_0xd85d('0xe'),_0xf34d4f,_0x5c30cb[_0xd85d('0x13')][_0xd85d('0x15')]);return _0x4fb71a(_0x5c30cb['error'][_0xd85d('0x15')]);}logger[_0xd85d('0x13')](_0xd85d('0xe'),_0xf34d4f,_0x5c30cb[_0xd85d('0x13')][_0xd85d('0x15')]);return _0x238534(_0x5c30cb[_0xd85d('0x13')]['message']);}else{logger['info'](_0xd85d('0xe'),_0xf34d4f,'request\x20sent');_0x238534(_0x5c30cb[_0xd85d('0x16')][_0xd85d('0x15')]);}})['catch'](function(_0x594317){logger['error'](_0xd85d('0xe'),_0xf34d4f,_0x594317);_0x4fb71a(_0x594317);});});}exports['ShowSound']=function(_0x8008f){var _0x4d597e=this;return new Promise(function(_0x40a730,_0x1e84a5){return db['Sound'][_0xd85d('0x17')]({'raw':_0x8008f[_0xd85d('0x18')]?_0x8008f['options'][_0xd85d('0x19')]===undefined?!![]:![]:!![],'where':_0x8008f[_0xd85d('0x18')]?_0x8008f[_0xd85d('0x18')][_0xd85d('0x1a')]||null:null,'attributes':_0x8008f['options']?_0x8008f['options'][_0xd85d('0x1b')]||null:null,'include':_0x8008f['options']?_0x8008f[_0xd85d('0x18')][_0xd85d('0x1c')]?_[_0xd85d('0x1d')](_0x8008f['options']['include'],function(_0x24c897){return{'model':db[_0x24c897[_0xd85d('0x1e')]],'as':_0x24c897['as'],'attributes':_0x24c897[_0xd85d('0x1b')],'include':_0x24c897[_0xd85d('0x1c')]?_['map'](_0x24c897['include'],function(_0x499567){return{'model':db[_0x499567[_0xd85d('0x1e')]],'as':_0x499567['as'],'attributes':_0x499567[_0xd85d('0x1b')],'include':_0x499567[_0xd85d('0x1c')]?_['map'](_0x499567[_0xd85d('0x1c')],function(_0x1e1847){return{'model':db[_0x1e1847[_0xd85d('0x1e')]],'as':_0x1e1847['as'],'attributes':_0x1e1847[_0xd85d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd85d('0xc')](function(_0xe439e8){logger['info'](_0xd85d('0x1f'),_0x8008f);logger[_0xd85d('0x10')](_0xd85d('0x1f'),_0x8008f,JSON[_0xd85d('0x12')](_0xe439e8));_0x40a730(_0xe439e8);})[_0xd85d('0x20')](function(_0x506d71){logger[_0xd85d('0x13')](_0xd85d('0x1f'),_0x506d71[_0xd85d('0x15')],_0x8008f);_0x1e84a5(_0x4d597e['error'](0x1f4,_0x506d71[_0xd85d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 61c4221..899c195 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x4baa2e,_0xb13d36){var _0x4b3a8e=function(_0x4f20f5){while(--_0x4f20f5){_0x4baa2e['push'](_0x4baa2e['shift']());}};_0x4b3a8e(++_0xb13d36);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x59946f,_0x5a12f3){var _0x3d4dd9=function(_0x401c2f){while(--_0x401c2f){_0x59946f['push'](_0x59946f['shift']());}};_0x3d4dd9(++_0x5a12f3);}(_0xda3f,0xec));var _0xfda3=function(_0x2d5b11,_0x43d8bc){_0x2d5b11=_0x2d5b11-0x0;var _0x375e97=_0xda3f[_0x2d5b11];return _0x375e97;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a563f1e..101e61c 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 _0x477e=['medium','out','sequelize','exports','STRING','TEXT'];(function(_0x44b5cf,_0x1e7623){var _0x29b4b6=function(_0x348264){while(--_0x348264){_0x44b5cf['push'](_0x44b5cf['shift']());}};_0x29b4b6(++_0x1e7623);}(_0x477e,0x9e));var _0xe477=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x477e[_0x5a7e3c];return _0x59252b;};'use strict';var Sequelize=require(_0xe477('0x0'));module[_0xe477('0x1')]={'uniqueid':{'type':Sequelize[_0xe477('0x2')]},'body':{'type':Sequelize[_0xe477('0x3')](_0xe477('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe477('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe477('0x2')]},'providerResponse':{'type':Sequelize[_0xe477('0x3')]}}; \ No newline at end of file +var _0xdf0c=['sequelize','exports','STRING','ENUM'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xdf0c,0x1a8));var _0xcdf0=function(_0x59625f,_0x3b2c76){_0x59625f=_0x59625f-0x0;var _0x498e1e=_0xdf0c[_0x59625f];return _0x498e1e;};'use strict';var Sequelize=require(_0xcdf0('0x0'));module[_0xcdf0('0x1')]={'uniqueid':{'type':Sequelize[_0xcdf0('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xcdf0('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xcdf0('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ec03a2e..f83cb09 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 _0x02d5=['pick','merge','where','VIRTUAL','options','SquareMessage','include','findAll','rows','catch','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x3ccc5a,_0x3e981a){var _0x5369f3=function(_0xa3643d){while(--_0xa3643d){_0x3ccc5a['push'](_0x3ccc5a['shift']());}};_0x5369f3(++_0x3e981a);}(_0x02d5,0x17d));var _0x502d=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x02d5[_0x3d00db];return _0x41f115;};'use strict';var emlformat=require(_0x502d('0x0'));var rimraf=require(_0x502d('0x1'));var zipdir=require(_0x502d('0x2'));var jsonpatch=require(_0x502d('0x3'));var rp=require(_0x502d('0x4'));var moment=require('moment');var BPromise=require(_0x502d('0x5'));var Mustache=require(_0x502d('0x6'));var util=require('util');var path=require(_0x502d('0x7'));var sox=require(_0x502d('0x8'));var csv=require(_0x502d('0x9'));var ejs=require(_0x502d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x502d('0xb'));var squel=require(_0x502d('0xc'));var crypto=require(_0x502d('0xd'));var jsforce=require(_0x502d('0xe'));var deskjs=require(_0x502d('0xf'));var toCsv=require(_0x502d('0x9'));var querystring=require('querystring');var Papa=require(_0x502d('0x10'));var Redis=require(_0x502d('0x11'));var authService=require(_0x502d('0x12'));var qs=require(_0x502d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x502d('0x14'))(_0x502d('0x15'));var utils=require(_0x502d('0x16'));var config=require(_0x502d('0x17'));var licenseUtil=require(_0x502d('0x18'));var db=require(_0x502d('0x19'))['db'];function respondWithStatusCode(_0x2a6d29,_0x59f6ce){_0x59f6ce=_0x59f6ce||0xcc;return function(_0x3e357e){if(_0x3e357e){return _0x2a6d29[_0x502d('0x1a')](_0x59f6ce);}return _0x2a6d29[_0x502d('0x1b')](_0x59f6ce)['end']();};}function respondWithResult(_0xae2121,_0x570ebf){_0x570ebf=_0x570ebf||0xc8;return function(_0x44e079){if(_0x44e079){return _0xae2121['status'](_0x570ebf)[_0x502d('0x1c')](_0x44e079);}};}function respondWithFilteredResult(_0xd1822a,_0xf3d979){return function(_0x2fd745){if(_0x2fd745){var _0x2a3593=typeof _0xf3d979[_0x502d('0x1d')]===_0x502d('0x1e')&&typeof _0xf3d979[_0x502d('0x1f')]===_0x502d('0x1e');var _0x104bc4=_0x2fd745[_0x502d('0x20')];var _0x5647fc=_0x2a3593?0x0:_0xf3d979[_0x502d('0x1d')];var _0x1c3f4e=_0x2a3593?_0x2fd745['count']:_0xf3d979['offset']+_0xf3d979[_0x502d('0x1f')];var _0x313ae1;if(_0x1c3f4e>=_0x104bc4){_0x1c3f4e=_0x104bc4;_0x313ae1=0xc8;}else{_0x313ae1=0xce;}_0xd1822a[_0x502d('0x1b')](_0x313ae1);return _0xd1822a[_0x502d('0x21')](_0x502d('0x22'),_0x5647fc+'-'+_0x1c3f4e+'/'+_0x104bc4)[_0x502d('0x1c')](_0x2fd745);}return null;};}function patchUpdates(_0x45b407){return function(_0x31bd37){try{jsonpatch['apply'](_0x31bd37,_0x45b407,!![]);}catch(_0x3b3788){return BPromise['reject'](_0x3b3788);}return _0x31bd37[_0x502d('0x23')]();};}function saveUpdates(_0x1dc1be,_0x5d54d2){return function(_0x6eacdf){if(_0x6eacdf){return _0x6eacdf[_0x502d('0x24')](_0x1dc1be)[_0x502d('0x25')](function(_0x2b1c1a){return _0x2b1c1a;});}return null;};}function removeEntity(_0x1445db,_0x5f14a4){return function(_0x18a7f1){if(_0x18a7f1){return _0x18a7f1[_0x502d('0x26')]()[_0x502d('0x25')](function(){_0x1445db[_0x502d('0x1b')](0xcc)[_0x502d('0x27')]();});}};}function handleEntityNotFound(_0x30a4d4,_0x144e99){return function(_0x54f60e){if(!_0x54f60e){_0x30a4d4[_0x502d('0x1a')](0x194);}return _0x54f60e;};}function handleError(_0x5771bc,_0x24a837){_0x24a837=_0x24a837||0x1f4;return function(_0x135982){logger[_0x502d('0x28')](_0x135982['stack']);if(_0x135982[_0x502d('0x29')]){delete _0x135982[_0x502d('0x29')];}_0x5771bc[_0x502d('0x1b')](_0x24a837)[_0x502d('0x2a')](_0x135982);};}exports['index']=function(_0x58e5e2,_0x37143d){var _0x37c9c7={},_0x4401d8={},_0x7f7d59={'count':0x0,'rows':[]};var _0x2d8e88=_['map'](db['SquareMessage'][_0x502d('0x2b')],function(_0x132257){return{'name':_0x132257[_0x502d('0x2c')],'type':_0x132257[_0x502d('0x2d')][_0x502d('0x2e')]};});_0x4401d8[_0x502d('0x2f')]=_[_0x502d('0x30')](_0x2d8e88,_0x502d('0x29'));_0x4401d8[_0x502d('0x31')]=_['keys'](_0x58e5e2[_0x502d('0x31')]);_0x4401d8[_0x502d('0x32')]=_[_0x502d('0x33')](_0x4401d8[_0x502d('0x2f')],_0x4401d8['query']);_0x37c9c7['attributes']=_[_0x502d('0x33')](_0x4401d8['model'],qs[_0x502d('0x34')](_0x58e5e2[_0x502d('0x31')]['fields']));_0x37c9c7[_0x502d('0x35')]=_0x37c9c7[_0x502d('0x35')]['length']?_0x37c9c7['attributes']:_0x4401d8[_0x502d('0x2f')];if(!_0x58e5e2[_0x502d('0x31')][_0x502d('0x36')](_0x502d('0x37'))){_0x37c9c7['limit']=qs[_0x502d('0x1f')](_0x58e5e2[_0x502d('0x31')]['limit']);_0x37c9c7[_0x502d('0x1d')]=qs[_0x502d('0x1d')](_0x58e5e2[_0x502d('0x31')][_0x502d('0x1d')]);}_0x37c9c7[_0x502d('0x38')]=qs['sort'](_0x58e5e2[_0x502d('0x31')]['sort']);_0x37c9c7['where']=qs[_0x502d('0x32')](_[_0x502d('0x39')](_0x58e5e2['query'],_0x4401d8[_0x502d('0x32')]),_0x2d8e88);if(_0x58e5e2[_0x502d('0x31')]['filter']){_0x37c9c7['where']=_[_0x502d('0x3a')](_0x37c9c7[_0x502d('0x3b')],{'$or':_[_0x502d('0x30')](_0x2d8e88,function(_0x152d98){if(_0x152d98[_0x502d('0x2d')]!==_0x502d('0x3c')){var _0x108161={};_0x108161[_0x152d98[_0x502d('0x29')]]={'$like':'%'+_0x58e5e2['query']['filter']+'%'};return _0x108161;}})});}_0x37c9c7=_[_0x502d('0x3a')]({},_0x37c9c7,_0x58e5e2[_0x502d('0x3d')]);var _0x1a644f={'where':_0x37c9c7['where']};return db[_0x502d('0x3e')][_0x502d('0x20')](_0x1a644f)['then'](function(_0xd682b7){_0x7f7d59['count']=_0xd682b7;if(_0x58e5e2[_0x502d('0x31')]['includeAll']){_0x37c9c7[_0x502d('0x3f')]=[{'all':!![]}];}return db[_0x502d('0x3e')][_0x502d('0x40')](_0x37c9c7);})[_0x502d('0x25')](function(_0x2587a3){_0x7f7d59[_0x502d('0x41')]=_0x2587a3;return _0x7f7d59;})[_0x502d('0x25')](respondWithFilteredResult(_0x37143d,_0x37c9c7))[_0x502d('0x42')](handleError(_0x37143d,null));};exports['show']=function(_0x21d71f,_0x38832f){var _0x4ec0e3={'raw':!![],'where':{'id':_0x21d71f[_0x502d('0x43')]['id']}},_0xb6d78a={};_0xb6d78a[_0x502d('0x2f')]=_['keys'](db[_0x502d('0x3e')][_0x502d('0x2b')]);_0xb6d78a[_0x502d('0x31')]=_['keys'](_0x21d71f[_0x502d('0x31')]);_0xb6d78a[_0x502d('0x32')]=_[_0x502d('0x33')](_0xb6d78a[_0x502d('0x2f')],_0xb6d78a[_0x502d('0x31')]);_0x4ec0e3[_0x502d('0x35')]=_[_0x502d('0x33')](_0xb6d78a[_0x502d('0x2f')],qs[_0x502d('0x34')](_0x21d71f[_0x502d('0x31')][_0x502d('0x34')]));_0x4ec0e3[_0x502d('0x35')]=_0x4ec0e3['attributes'][_0x502d('0x44')]?_0x4ec0e3[_0x502d('0x35')]:_0xb6d78a['model'];if(_0x21d71f[_0x502d('0x31')][_0x502d('0x45')]){_0x4ec0e3['include']=[{'all':!![]}];}_0x4ec0e3=_[_0x502d('0x3a')]({},_0x4ec0e3,_0x21d71f['options']);return db['SquareMessage'][_0x502d('0x46')](_0x4ec0e3)['then'](handleEntityNotFound(_0x38832f,null))[_0x502d('0x25')](respondWithResult(_0x38832f,null))[_0x502d('0x42')](handleError(_0x38832f,null));};exports[_0x502d('0x47')]=function(_0x56cd95,_0x4918a6){return db[_0x502d('0x3e')][_0x502d('0x47')](_0x56cd95[_0x502d('0x48')],{})[_0x502d('0x25')](respondWithResult(_0x4918a6,0xc9))[_0x502d('0x42')](handleError(_0x4918a6,null));};exports[_0x502d('0x24')]=function(_0x366577,_0x56701e){if(_0x366577['body']['id']){delete _0x366577[_0x502d('0x48')]['id'];}return db[_0x502d('0x3e')][_0x502d('0x46')]({'where':{'id':_0x366577[_0x502d('0x43')]['id']}})[_0x502d('0x25')](handleEntityNotFound(_0x56701e,null))[_0x502d('0x25')](saveUpdates(_0x366577['body'],null))[_0x502d('0x25')](respondWithResult(_0x56701e,null))['catch'](handleError(_0x56701e,null));};exports[_0x502d('0x26')]=function(_0x37c0ea,_0x33de95){return db['SquareMessage'][_0x502d('0x46')]({'where':{'id':_0x37c0ea[_0x502d('0x43')]['id']}})['then'](handleEntityNotFound(_0x33de95,null))['then'](removeEntity(_0x33de95,null))[_0x502d('0x42')](handleError(_0x33de95,null));}; \ No newline at end of file +var _0xa1d2=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','index','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','options','includeAll','SquareMessage','findAll','rows','catch','show','rawAttributes','intersection','include','merge','create','body','find','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1cee55,_0xe75188){var _0x4f640a=function(_0x550c43){while(--_0x550c43){_0x1cee55['push'](_0x1cee55['shift']());}};_0x4f640a(++_0xe75188);}(_0xa1d2,0x151));var _0x2a1d=function(_0x430edd,_0x58e9f8){_0x430edd=_0x430edd-0x0;var _0x2ba764=_0xa1d2[_0x430edd];return _0x2ba764;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a1d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a1d('0x1'));var rp=require(_0x2a1d('0x2'));var moment=require(_0x2a1d('0x3'));var BPromise=require(_0x2a1d('0x4'));var Mustache=require(_0x2a1d('0x5'));var util=require(_0x2a1d('0x6'));var path=require(_0x2a1d('0x7'));var sox=require(_0x2a1d('0x8'));var csv=require(_0x2a1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a1d('0xa'));var _=require(_0x2a1d('0xb'));var squel=require(_0x2a1d('0xc'));var crypto=require(_0x2a1d('0xd'));var jsforce=require(_0x2a1d('0xe'));var deskjs=require(_0x2a1d('0xf'));var toCsv=require(_0x2a1d('0x9'));var querystring=require(_0x2a1d('0x10'));var Papa=require(_0x2a1d('0x11'));var Redis=require(_0x2a1d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a1d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a1d('0x14'));var logger=require(_0x2a1d('0x15'))('api');var utils=require(_0x2a1d('0x16'));var config=require(_0x2a1d('0x17'));var licenseUtil=require(_0x2a1d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37b8d7,_0x4e072f){_0x4e072f=_0x4e072f||0xcc;return function(_0x1d8a8c){if(_0x1d8a8c){return _0x37b8d7[_0x2a1d('0x19')](_0x4e072f);}return _0x37b8d7[_0x2a1d('0x1a')](_0x4e072f)[_0x2a1d('0x1b')]();};}function respondWithResult(_0x41b1fc,_0x52df8a){_0x52df8a=_0x52df8a||0xc8;return function(_0x432740){if(_0x432740){return _0x41b1fc[_0x2a1d('0x1a')](_0x52df8a)[_0x2a1d('0x1c')](_0x432740);}};}function respondWithFilteredResult(_0x2d5519,_0x4810cb){return function(_0x4630c4){if(_0x4630c4){var _0x1cfb8b=typeof _0x4810cb[_0x2a1d('0x1d')]===_0x2a1d('0x1e')&&typeof _0x4810cb[_0x2a1d('0x1f')]===_0x2a1d('0x1e');var _0x229a21=_0x4630c4[_0x2a1d('0x20')];var _0x4118c9=_0x1cfb8b?0x0:_0x4810cb[_0x2a1d('0x1d')];var _0x5e45b4=_0x1cfb8b?_0x4630c4[_0x2a1d('0x20')]:_0x4810cb[_0x2a1d('0x1d')]+_0x4810cb[_0x2a1d('0x1f')];var _0x44ca03;if(_0x5e45b4>=_0x229a21){_0x5e45b4=_0x229a21;_0x44ca03=0xc8;}else{_0x44ca03=0xce;}_0x2d5519[_0x2a1d('0x1a')](_0x44ca03);return _0x2d5519['set'](_0x2a1d('0x21'),_0x4118c9+'-'+_0x5e45b4+'/'+_0x229a21)['json'](_0x4630c4);}return null;};}function patchUpdates(_0x33087b){return function(_0x1dae5e){try{jsonpatch[_0x2a1d('0x22')](_0x1dae5e,_0x33087b,!![]);}catch(_0x296ab8){return BPromise[_0x2a1d('0x23')](_0x296ab8);}return _0x1dae5e['save']();};}function saveUpdates(_0x5384fc,_0x40a353){return function(_0x452743){if(_0x452743){return _0x452743[_0x2a1d('0x24')](_0x5384fc)[_0x2a1d('0x25')](function(_0x5549e6){return _0x5549e6;});}return null;};}function removeEntity(_0x55effb,_0x4eb8d1){return function(_0x4f9501){if(_0x4f9501){return _0x4f9501[_0x2a1d('0x26')]()['then'](function(){_0x55effb['status'](0xcc)[_0x2a1d('0x1b')]();});}};}function handleEntityNotFound(_0x4f858d,_0x754572){return function(_0x20a21b){if(!_0x20a21b){_0x4f858d['sendStatus'](0x194);}return _0x20a21b;};}function handleError(_0x2a6055,_0x450bac){_0x450bac=_0x450bac||0x1f4;return function(_0x19867f){logger['error'](_0x19867f['stack']);if(_0x19867f['name']){delete _0x19867f[_0x2a1d('0x27')];}_0x2a6055[_0x2a1d('0x1a')](_0x450bac)['send'](_0x19867f);};}exports[_0x2a1d('0x28')]=function(_0x511df0,_0x3d75ca){var _0x4a5ccd={},_0x3a00e2={},_0x524ae7={'count':0x0,'rows':[]};var _0x39b145=_['map'](db['SquareMessage']['rawAttributes'],function(_0x317018){return{'name':_0x317018['fieldName'],'type':_0x317018[_0x2a1d('0x29')][_0x2a1d('0x2a')]};});_0x3a00e2[_0x2a1d('0x2b')]=_[_0x2a1d('0x2c')](_0x39b145,_0x2a1d('0x27'));_0x3a00e2[_0x2a1d('0x2d')]=_[_0x2a1d('0x2e')](_0x511df0[_0x2a1d('0x2d')]);_0x3a00e2['filters']=_['intersection'](_0x3a00e2['model'],_0x3a00e2[_0x2a1d('0x2d')]);_0x4a5ccd[_0x2a1d('0x2f')]=_['intersection'](_0x3a00e2['model'],qs['fields'](_0x511df0[_0x2a1d('0x2d')][_0x2a1d('0x30')]));_0x4a5ccd[_0x2a1d('0x2f')]=_0x4a5ccd['attributes'][_0x2a1d('0x31')]?_0x4a5ccd[_0x2a1d('0x2f')]:_0x3a00e2[_0x2a1d('0x2b')];if(!_0x511df0[_0x2a1d('0x2d')][_0x2a1d('0x32')](_0x2a1d('0x33'))){_0x4a5ccd[_0x2a1d('0x1f')]=qs[_0x2a1d('0x1f')](_0x511df0[_0x2a1d('0x2d')][_0x2a1d('0x1f')]);_0x4a5ccd['offset']=qs[_0x2a1d('0x1d')](_0x511df0['query']['offset']);}_0x4a5ccd['order']=qs[_0x2a1d('0x34')](_0x511df0[_0x2a1d('0x2d')]['sort']);_0x4a5ccd['where']=qs[_0x2a1d('0x35')](_[_0x2a1d('0x36')](_0x511df0[_0x2a1d('0x2d')],_0x3a00e2['filters']),_0x39b145);if(_0x511df0['query'][_0x2a1d('0x37')]){_0x4a5ccd[_0x2a1d('0x38')]=_['merge'](_0x4a5ccd[_0x2a1d('0x38')],{'$or':_['map'](_0x39b145,function(_0x5515e0){if(_0x5515e0[_0x2a1d('0x29')]!=='VIRTUAL'){var _0x2ef779={};_0x2ef779[_0x5515e0[_0x2a1d('0x27')]]={'$like':'%'+_0x511df0[_0x2a1d('0x2d')][_0x2a1d('0x37')]+'%'};return _0x2ef779;}})});}_0x4a5ccd=_['merge']({},_0x4a5ccd,_0x511df0[_0x2a1d('0x39')]);var _0x146225={'where':_0x4a5ccd[_0x2a1d('0x38')]};return db['SquareMessage'][_0x2a1d('0x20')](_0x146225)[_0x2a1d('0x25')](function(_0x278187){_0x524ae7[_0x2a1d('0x20')]=_0x278187;if(_0x511df0[_0x2a1d('0x2d')][_0x2a1d('0x3a')]){_0x4a5ccd['include']=[{'all':!![]}];}return db[_0x2a1d('0x3b')][_0x2a1d('0x3c')](_0x4a5ccd);})[_0x2a1d('0x25')](function(_0x2c1c0c){_0x524ae7[_0x2a1d('0x3d')]=_0x2c1c0c;return _0x524ae7;})[_0x2a1d('0x25')](respondWithFilteredResult(_0x3d75ca,_0x4a5ccd))[_0x2a1d('0x3e')](handleError(_0x3d75ca,null));};exports[_0x2a1d('0x3f')]=function(_0x5e331f,_0x35d58e){var _0x5e9c78={'raw':!![],'where':{'id':_0x5e331f['params']['id']}},_0x439980={};_0x439980['model']=_[_0x2a1d('0x2e')](db['SquareMessage'][_0x2a1d('0x40')]);_0x439980['query']=_[_0x2a1d('0x2e')](_0x5e331f['query']);_0x439980[_0x2a1d('0x35')]=_[_0x2a1d('0x41')](_0x439980['model'],_0x439980['query']);_0x5e9c78['attributes']=_[_0x2a1d('0x41')](_0x439980[_0x2a1d('0x2b')],qs[_0x2a1d('0x30')](_0x5e331f['query']['fields']));_0x5e9c78[_0x2a1d('0x2f')]=_0x5e9c78[_0x2a1d('0x2f')]['length']?_0x5e9c78[_0x2a1d('0x2f')]:_0x439980[_0x2a1d('0x2b')];if(_0x5e331f[_0x2a1d('0x2d')][_0x2a1d('0x3a')]){_0x5e9c78[_0x2a1d('0x42')]=[{'all':!![]}];}_0x5e9c78=_[_0x2a1d('0x43')]({},_0x5e9c78,_0x5e331f['options']);return db['SquareMessage']['find'](_0x5e9c78)[_0x2a1d('0x25')](handleEntityNotFound(_0x35d58e,null))['then'](respondWithResult(_0x35d58e,null))['catch'](handleError(_0x35d58e,null));};exports['create']=function(_0x328aa8,_0x2a535d){return db[_0x2a1d('0x3b')][_0x2a1d('0x44')](_0x328aa8[_0x2a1d('0x45')],{})[_0x2a1d('0x25')](respondWithResult(_0x2a535d,0xc9))[_0x2a1d('0x3e')](handleError(_0x2a535d,null));};exports[_0x2a1d('0x24')]=function(_0x4ff79b,_0x31ef75){if(_0x4ff79b['body']['id']){delete _0x4ff79b['body']['id'];}return db[_0x2a1d('0x3b')][_0x2a1d('0x46')]({'where':{'id':_0x4ff79b[_0x2a1d('0x47')]['id']}})['then'](handleEntityNotFound(_0x31ef75,null))[_0x2a1d('0x25')](saveUpdates(_0x4ff79b[_0x2a1d('0x45')],null))[_0x2a1d('0x25')](respondWithResult(_0x31ef75,null))[_0x2a1d('0x3e')](handleError(_0x31ef75,null));};exports[_0x2a1d('0x26')]=function(_0x12855f,_0x5542ec){return db[_0x2a1d('0x3b')][_0x2a1d('0x46')]({'where':{'id':_0x12855f['params']['id']}})[_0x2a1d('0x25')](handleEntityNotFound(_0x5542ec,null))[_0x2a1d('0x25')](removeEntity(_0x5542ec,null))['catch'](handleError(_0x5542ec,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ae70537..22eca92 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 _0x96c9=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','lodash','util'];(function(_0xa83066,_0x553f6d){var _0x17dc60=function(_0x1b78f8){while(--_0x1b78f8){_0xa83066['push'](_0xa83066['shift']());}};_0x17dc60(++_0x553f6d);}(_0x96c9,0xe4));var _0x996c=function(_0x45e8c3,_0x4baf57){_0x45e8c3=_0x45e8c3-0x0;var _0x3a4759=_0x96c9[_0x45e8c3];return _0x3a4759;};'use strict';var _=require(_0x996c('0x0'));var util=require(_0x996c('0x1'));var logger=require(_0x996c('0x2'))(_0x996c('0x3'));var moment=require(_0x996c('0x4'));var BPromise=require(_0x996c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x996c('0x6'));var rimraf=require(_0x996c('0x7'));var config=require(_0x996c('0x8'));var attributes=require(_0x996c('0x9'));module['exports']=function(_0x15a2b3,_0x5efbfe){return _0x15a2b3['define']('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cea=['define','SquareMessage','square_messages','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2cea,0x153));var _0xa2ce=function(_0x4fdc01,_0x4101ea){_0x4fdc01=_0x4fdc01-0x0;var _0x5bb876=_0x2cea[_0x4fdc01];return _0x5bb876;};'use strict';var _=require('lodash');var util=require(_0xa2ce('0x0'));var logger=require(_0xa2ce('0x1'))(_0xa2ce('0x2'));var moment=require(_0xa2ce('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2ce('0x4'));var fs=require('fs');var path=require(_0xa2ce('0x5'));var rimraf=require(_0xa2ce('0x6'));var config=require(_0xa2ce('0x7'));var attributes=require(_0xa2ce('0x8'));module['exports']=function(_0x2331d9,_0x2750ac){return _0x2331d9[_0xa2ce('0x9')](_0xa2ce('0xa'),attributes,{'tableName':_0xa2ce('0xb'),'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 4183f4a..c518d30 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 _0x5f0d=['options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message','info','result','CreateSquareMessage','SquareMessage','body'];(function(_0x331ad6,_0x590df3){var _0xec2197=function(_0x4534e8){while(--_0x4534e8){_0x331ad6['push'](_0x331ad6['shift']());}};_0xec2197(++_0x590df3);}(_0x5f0d,0x1d7));var _0xd5f0=function(_0x154128,_0x5d8668){_0x154128=_0x154128-0x0;var _0xb6b938=_0x5f0d[_0x154128];return _0xb6b938;};'use strict';var _=require(_0xd5f0('0x0'));var util=require('util');var moment=require(_0xd5f0('0x1'));var BPromise=require(_0xd5f0('0x2'));var rs=require(_0xd5f0('0x3'));var fs=require('fs');var Redis=require(_0xd5f0('0x4'));var db=require(_0xd5f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5f0('0x6'));var config=require(_0xd5f0('0x7'));var jayson=require(_0xd5f0('0x8'));var client=jayson['client'][_0xd5f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x156efa,_0x1efdfd,_0xa57485){return new BPromise(function(_0x546b8e,_0x49f37f){return client[_0xd5f0('0xa')](_0x156efa,_0xa57485)[_0xd5f0('0xb')](function(_0x17024c){logger['info']('SquareMessage,\x20%s,\x20%s',_0x1efdfd,_0xd5f0('0xc'));logger['debug'](_0xd5f0('0xd'),_0x1efdfd,_0xd5f0('0xc'),JSON[_0xd5f0('0xe')](_0x17024c));if(_0x17024c[_0xd5f0('0xf')]){if(_0x17024c[_0xd5f0('0xf')]['code']===0x1f4){logger[_0xd5f0('0xf')](_0xd5f0('0x10'),_0x1efdfd,_0x17024c['error'][_0xd5f0('0x11')]);return _0x49f37f(_0x17024c[_0xd5f0('0xf')][_0xd5f0('0x11')]);}logger[_0xd5f0('0xf')](_0xd5f0('0x10'),_0x1efdfd,_0x17024c[_0xd5f0('0xf')][_0xd5f0('0x11')]);return _0x546b8e(_0x17024c[_0xd5f0('0xf')]['message']);}else{logger[_0xd5f0('0x12')](_0xd5f0('0x10'),_0x1efdfd,_0xd5f0('0xc'));_0x546b8e(_0x17024c[_0xd5f0('0x13')][_0xd5f0('0x11')]);}})['catch'](function(_0x2e2084){logger[_0xd5f0('0xf')](_0xd5f0('0x10'),_0x1efdfd,_0x2e2084);_0x49f37f(_0x2e2084);});});}exports[_0xd5f0('0x14')]=function(_0x37c712){var _0x472709=this;return new Promise(function(_0x3950dc,_0x5ae695){return db[_0xd5f0('0x15')]['create'](_0x37c712[_0xd5f0('0x16')],{'raw':_0x37c712['options']?_0x37c712[_0xd5f0('0x17')][_0xd5f0('0x18')]===undefined?!![]:![]:!![]})[_0xd5f0('0xb')](function(_0x33b247){logger[_0xd5f0('0x12')](_0xd5f0('0x14'),_0x37c712);logger['debug'](_0xd5f0('0x14'),_0x37c712,JSON[_0xd5f0('0xe')](_0x33b247));_0x3950dc(_0x33b247);})[_0xd5f0('0x19')](function(_0x595333){logger[_0xd5f0('0xf')](_0xd5f0('0x14'),_0x595333[_0xd5f0('0x11')],_0x37c712);_0x5ae695(_0x472709[_0xd5f0('0xf')](0x1f4,_0x595333['message']));});});}; \ No newline at end of file +var _0xae41=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareMessage','SquareMessage','body','options','raw','debug','stringify','catch'];(function(_0x191023,_0x2cc243){var _0x2ce0e1=function(_0x1feef5){while(--_0x1feef5){_0x191023['push'](_0x191023['shift']());}};_0x2ce0e1(++_0x2cc243);}(_0xae41,0x1dc));var _0x1ae4=function(_0x23c58e,_0x19da71){_0x23c58e=_0x23c58e-0x0;var _0x55d36d=_0xae41[_0x23c58e];return _0x55d36d;};'use strict';var _=require('lodash');var util=require(_0x1ae4('0x0'));var moment=require(_0x1ae4('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ae4('0x2'));var fs=require('fs');var Redis=require(_0x1ae4('0x3'));var db=require(_0x1ae4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ae4('0x5'))('rpc');var config=require(_0x1ae4('0x6'));var jayson=require(_0x1ae4('0x7'));var client=jayson[_0x1ae4('0x8')][_0x1ae4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x261620,_0x5d754d,_0x59aaba){return new BPromise(function(_0xbf7dc2,_0x4c0c33){return client[_0x1ae4('0xa')](_0x261620,_0x59aaba)[_0x1ae4('0xb')](function(_0x515147){logger[_0x1ae4('0xc')](_0x1ae4('0xd'),_0x5d754d,'request\x20sent');logger['debug'](_0x1ae4('0xe'),_0x5d754d,_0x1ae4('0xf'),JSON['stringify'](_0x515147));if(_0x515147['error']){if(_0x515147[_0x1ae4('0x10')][_0x1ae4('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5d754d,_0x515147[_0x1ae4('0x10')][_0x1ae4('0x12')]);return _0x4c0c33(_0x515147[_0x1ae4('0x10')]['message']);}logger['error'](_0x1ae4('0xd'),_0x5d754d,_0x515147['error']['message']);return _0xbf7dc2(_0x515147['error']['message']);}else{logger[_0x1ae4('0xc')](_0x1ae4('0xd'),_0x5d754d,_0x1ae4('0xf'));_0xbf7dc2(_0x515147[_0x1ae4('0x13')]['message']);}})['catch'](function(_0x3c81cf){logger[_0x1ae4('0x10')](_0x1ae4('0xd'),_0x5d754d,_0x3c81cf);_0x4c0c33(_0x3c81cf);});});}exports[_0x1ae4('0x14')]=function(_0x16452b){var _0x5ef171=this;return new Promise(function(_0x3e43f4,_0x1a9e4d){return db[_0x1ae4('0x15')]['create'](_0x16452b[_0x1ae4('0x16')],{'raw':_0x16452b[_0x1ae4('0x17')]?_0x16452b[_0x1ae4('0x17')][_0x1ae4('0x18')]===undefined?!![]:![]:!![]})[_0x1ae4('0xb')](function(_0x533144){logger[_0x1ae4('0xc')](_0x1ae4('0x14'),_0x16452b);logger[_0x1ae4('0x19')](_0x1ae4('0x14'),_0x16452b,JSON[_0x1ae4('0x1a')](_0x533144));_0x3e43f4(_0x533144);})[_0x1ae4('0x1b')](function(_0x4bc21f){logger[_0x1ae4('0x10')](_0x1ae4('0x14'),_0x4bc21f[_0x1ae4('0x12')],_0x16452b);_0x1a9e4d(_0x5ef171[_0x1ae4('0x10')](0x1f4,_0x4bc21f[_0x1ae4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4728e56..6a7e856 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 _0xfb6f=['Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x20e0ac,_0x353879){var _0x230cf1=function(_0x5071f2){while(--_0x5071f2){_0x20e0ac['push'](_0x20e0ac['shift']());}};_0x230cf1(++_0x353879);}(_0xfb6f,0x146));var _0xffb6=function(_0xb53209,_0x26406f){_0xb53209=_0xb53209-0x0;var _0x4a5b28=_0xfb6f[_0xb53209];return _0x4a5b28;};'use strict';var multer=require(_0xffb6('0x0'));var util=require(_0xffb6('0x1'));var path=require(_0xffb6('0x2'));var timeout=require('connect-timeout');var express=require(_0xffb6('0x3'));var router=express[_0xffb6('0x4')]();var fs_extra=require(_0xffb6('0x5'));var auth=require(_0xffb6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xffb6('0x7'));var controller=require(_0xffb6('0x8'));router[_0xffb6('0x9')]('/',auth[_0xffb6('0xa')](),controller[_0xffb6('0xb')]);router[_0xffb6('0x9')](_0xffb6('0xc'),auth[_0xffb6('0xa')](),controller['show']);router[_0xffb6('0x9')](_0xffb6('0xd'),auth[_0xffb6('0xa')](),timeout('15s'),controller[_0xffb6('0xe')]);router[_0xffb6('0xf')]('/',auth[_0xffb6('0xa')](),controller[_0xffb6('0x10')]);router[_0xffb6('0x11')]('/:id',auth[_0xffb6('0xa')](),controller[_0xffb6('0x12')]);router[_0xffb6('0x13')](_0xffb6('0xc'),auth['isAuthenticated'](),controller[_0xffb6('0x14')]);module[_0xffb6('0x15')]=router; \ No newline at end of file +var _0x4996=['../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','test','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3a29c3,_0x58b817){var _0x34104b=function(_0x1c5917){while(--_0x1c5917){_0x3a29c3['push'](_0x3a29c3['shift']());}};_0x34104b(++_0x58b817);}(_0x4996,0xb6));var _0x6499=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x4996[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0x6499('0x0'));var util=require(_0x6499('0x1'));var path=require(_0x6499('0x2'));var timeout=require('connect-timeout');var express=require(_0x6499('0x3'));var router=express[_0x6499('0x4')]();var fs_extra=require(_0x6499('0x5'));var auth=require(_0x6499('0x6'));var interaction=require(_0x6499('0x7'));var config=require('../../config/environment');var controller=require(_0x6499('0x8'));router['get']('/',auth[_0x6499('0x9')](),controller[_0x6499('0xa')]);router[_0x6499('0xb')](_0x6499('0xc'),auth[_0x6499('0x9')](),controller[_0x6499('0xd')]);router[_0x6499('0xb')](_0x6499('0xe'),auth['isAuthenticated'](),timeout('15s'),controller[_0x6499('0xf')]);router[_0x6499('0x10')]('/',auth[_0x6499('0x9')](),controller['create']);router[_0x6499('0x11')]('/:id',auth[_0x6499('0x9')](),controller[_0x6499('0x12')]);router['delete'](_0x6499('0xc'),auth[_0x6499('0x9')](),controller[_0x6499('0x13')]);module[_0x6499('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 50f6bf0..8f46853 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 _0x2c59=['STRING','name','exports'];(function(_0x1f108e,_0x115c9f){var _0x5221e6=function(_0x5c34c7){while(--_0x5c34c7){_0x1f108e['push'](_0x1f108e['shift']());}};_0x5221e6(++_0x115c9f);}(_0x2c59,0xa7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x92c5('0x0')]={'name':{'type':Sequelize[_0x92c5('0x1')],'unique':_0x92c5('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x92c5('0x1')]},'description':{'type':Sequelize[_0x92c5('0x1')]}}; \ No newline at end of file +var _0x4ccf=['STRING','name','sequelize','exports'];(function(_0x4b84e8,_0x23e807){var _0x3d8b44=function(_0x19a459){while(--_0x19a459){_0x4b84e8['push'](_0x4b84e8['shift']());}};_0x3d8b44(++_0x23e807);}(_0x4ccf,0x19a));var _0xf4cc=function(_0x1eb54d,_0x56cbaf){_0x1eb54d=_0x1eb54d-0x0;var _0x32a24b=_0x4ccf[_0x1eb54d];return _0x32a24b;};'use strict';var Sequelize=require(_0xf4cc('0x0'));module[_0xf4cc('0x1')]={'name':{'type':Sequelize[_0xf4cc('0x2')],'unique':_0xf4cc('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf4cc('0x2')]},'description':{'type':Sequelize[_0xf4cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index fdeb544..8664a26 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 _0x779b=['limit','count','status','set','Content-Range','apply','save','update','then','destroy','ODBC','stack','name','send','index','map','SquareOdbc','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined'];(function(_0x38e6ce,_0x2532e2){var _0x1e3a03=function(_0x1f19a5){while(--_0x1f19a5){_0x38e6ce['push'](_0x38e6ce['shift']());}};_0x1e3a03(++_0x2532e2);}(_0x779b,0x132));var _0xb779=function(_0x23789e,_0x53ad4b){_0x23789e=_0x23789e-0x0;var _0x5b1e85=_0x779b[_0x23789e];return _0x5b1e85;};'use strict';var emlformat=require(_0xb779('0x0'));var rimraf=require(_0xb779('0x1'));var zipdir=require(_0xb779('0x2'));var jsonpatch=require(_0xb779('0x3'));var rp=require(_0xb779('0x4'));var moment=require(_0xb779('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb779('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb779('0x7'));var csv=require('to-csv');var ejs=require(_0xb779('0x8'));var fs=require('fs');var fs_extra=require(_0xb779('0x9'));var _=require('lodash');var squel=require(_0xb779('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb779('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb779('0xc'));var Papa=require(_0xb779('0xd'));var Redis=require('ioredis');var authService=require(_0xb779('0xe'));var qs=require(_0xb779('0xf'));var as=require(_0xb779('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb779('0x11'));var utils=require('../../config/utils');var config=require(_0xb779('0x12'));var licenseUtil=require(_0xb779('0x13'));var db=require(_0xb779('0x14'))['db'];function respondWithStatusCode(_0x5a2a40,_0x310eaa){_0x310eaa=_0x310eaa||0xcc;return function(_0x3a6956){if(_0x3a6956){return _0x5a2a40[_0xb779('0x15')](_0x310eaa);}return _0x5a2a40['status'](_0x310eaa)[_0xb779('0x16')]();};}function respondWithResult(_0xff2146,_0xd7b08f){_0xd7b08f=_0xd7b08f||0xc8;return function(_0x1b1721){if(_0x1b1721){return _0xff2146['status'](_0xd7b08f)[_0xb779('0x17')](_0x1b1721);}};}function respondWithFilteredResult(_0x3aedb3,_0xe498fb){return function(_0x451d59){if(_0x451d59){var _0x59e9f7=typeof _0xe498fb[_0xb779('0x18')]===_0xb779('0x19')&&typeof _0xe498fb[_0xb779('0x1a')]==='undefined';var _0x246409=_0x451d59[_0xb779('0x1b')];var _0x19808a=_0x59e9f7?0x0:_0xe498fb[_0xb779('0x18')];var _0x5ecabc=_0x59e9f7?_0x451d59[_0xb779('0x1b')]:_0xe498fb[_0xb779('0x18')]+_0xe498fb[_0xb779('0x1a')];var _0x3ae377;if(_0x5ecabc>=_0x246409){_0x5ecabc=_0x246409;_0x3ae377=0xc8;}else{_0x3ae377=0xce;}_0x3aedb3[_0xb779('0x1c')](_0x3ae377);return _0x3aedb3[_0xb779('0x1d')](_0xb779('0x1e'),_0x19808a+'-'+_0x5ecabc+'/'+_0x246409)[_0xb779('0x17')](_0x451d59);}return null;};}function patchUpdates(_0x2bc061){return function(_0x351f3d){try{jsonpatch[_0xb779('0x1f')](_0x351f3d,_0x2bc061,!![]);}catch(_0x370574){return BPromise['reject'](_0x370574);}return _0x351f3d[_0xb779('0x20')]();};}function saveUpdates(_0x1030ef,_0x283621){return function(_0x45f895){if(_0x45f895){return _0x45f895[_0xb779('0x21')](_0x1030ef)[_0xb779('0x22')](function(_0x371034){return _0x371034;});}return null;};}function removeEntity(_0x314920,_0x46f34b){return function(_0x403c88){if(_0x403c88){return _0x403c88[_0xb779('0x23')]()[_0xb779('0x22')](function(){var _0x10cdc6=_0x403c88['get']({'plain':!![]});var _0x8b6cdf=_0xb779('0x24');return db['UserProfileResource'][_0xb779('0x23')]({'where':{'type':_0x8b6cdf,'resourceId':_0x10cdc6['id']}})[_0xb779('0x22')](function(){return _0x403c88;});})[_0xb779('0x22')](function(){_0x314920[_0xb779('0x1c')](0xcc)[_0xb779('0x16')]();});}};}function handleEntityNotFound(_0x19743f,_0x3a409a){return function(_0x1b95ce){if(!_0x1b95ce){_0x19743f[_0xb779('0x15')](0x194);}return _0x1b95ce;};}function handleError(_0x5aadad,_0x1bde05){_0x1bde05=_0x1bde05||0x1f4;return function(_0x1bba1b){logger['error'](_0x1bba1b[_0xb779('0x25')]);if(_0x1bba1b[_0xb779('0x26')]){delete _0x1bba1b[_0xb779('0x26')];}_0x5aadad['status'](_0x1bde05)[_0xb779('0x27')](_0x1bba1b);};}exports[_0xb779('0x28')]=function(_0x8252c9,_0x5b3502){var _0x48dc8c={},_0x227b32={},_0x5740d6={'count':0x0,'rows':[]};var _0x1f7f07=_[_0xb779('0x29')](db[_0xb779('0x2a')][_0xb779('0x2b')],function(_0x53752a){return{'name':_0x53752a['fieldName'],'type':_0x53752a[_0xb779('0x2c')]['key']};});_0x227b32[_0xb779('0x2d')]=_[_0xb779('0x29')](_0x1f7f07,_0xb779('0x26'));_0x227b32[_0xb779('0x2e')]=_[_0xb779('0x2f')](_0x8252c9[_0xb779('0x2e')]);_0x227b32['filters']=_[_0xb779('0x30')](_0x227b32['model'],_0x227b32[_0xb779('0x2e')]);_0x48dc8c[_0xb779('0x31')]=_[_0xb779('0x30')](_0x227b32[_0xb779('0x2d')],qs['fields'](_0x8252c9[_0xb779('0x2e')][_0xb779('0x32')]));_0x48dc8c[_0xb779('0x31')]=_0x48dc8c[_0xb779('0x31')][_0xb779('0x33')]?_0x48dc8c['attributes']:_0x227b32[_0xb779('0x2d')];if(!_0x8252c9[_0xb779('0x2e')]['hasOwnProperty'](_0xb779('0x34'))){_0x48dc8c['limit']=qs[_0xb779('0x1a')](_0x8252c9['query']['limit']);_0x48dc8c[_0xb779('0x18')]=qs[_0xb779('0x18')](_0x8252c9[_0xb779('0x2e')]['offset']);}_0x48dc8c[_0xb779('0x35')]=qs[_0xb779('0x36')](_0x8252c9['query'][_0xb779('0x36')]);_0x48dc8c['where']=qs[_0xb779('0x37')](_[_0xb779('0x38')](_0x8252c9[_0xb779('0x2e')],_0x227b32[_0xb779('0x37')]),_0x1f7f07);if(_0x8252c9[_0xb779('0x2e')][_0xb779('0x39')]){_0x48dc8c['where']=_[_0xb779('0x3a')](_0x48dc8c[_0xb779('0x3b')],{'$or':_[_0xb779('0x29')](_0x1f7f07,function(_0xbda87){if(_0xbda87['type']!=='VIRTUAL'){var _0x58534c={};_0x58534c[_0xbda87[_0xb779('0x26')]]={'$like':'%'+_0x8252c9[_0xb779('0x2e')]['filter']+'%'};return _0x58534c;}})});}_0x48dc8c=_[_0xb779('0x3a')]({},_0x48dc8c,_0x8252c9['options']);var _0x492173={'where':_0x48dc8c['where']};return db['SquareOdbc']['count'](_0x492173)[_0xb779('0x22')](function(_0x52a501){_0x5740d6[_0xb779('0x1b')]=_0x52a501;if(_0x8252c9['query'][_0xb779('0x3c')]){_0x48dc8c[_0xb779('0x3d')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb779('0x3e')](_0x48dc8c);})[_0xb779('0x22')](function(_0x3d3d32){_0x5740d6[_0xb779('0x3f')]=_0x3d3d32;return _0x5740d6;})[_0xb779('0x22')](respondWithFilteredResult(_0x5b3502,_0x48dc8c))[_0xb779('0x40')](handleError(_0x5b3502,null));};exports[_0xb779('0x41')]=function(_0x75945b,_0x279e13){var _0x316e1a={'raw':!![],'where':{'id':_0x75945b[_0xb779('0x42')]['id']}},_0x1cef70={};_0x1cef70[_0xb779('0x2d')]=_['keys'](db[_0xb779('0x2a')][_0xb779('0x2b')]);_0x1cef70[_0xb779('0x2e')]=_[_0xb779('0x2f')](_0x75945b[_0xb779('0x2e')]);_0x1cef70['filters']=_[_0xb779('0x30')](_0x1cef70[_0xb779('0x2d')],_0x1cef70['query']);_0x316e1a[_0xb779('0x31')]=_[_0xb779('0x30')](_0x1cef70[_0xb779('0x2d')],qs[_0xb779('0x32')](_0x75945b['query'][_0xb779('0x32')]));_0x316e1a[_0xb779('0x31')]=_0x316e1a[_0xb779('0x31')][_0xb779('0x33')]?_0x316e1a[_0xb779('0x31')]:_0x1cef70[_0xb779('0x2d')];if(_0x75945b['query'][_0xb779('0x3c')]){_0x316e1a[_0xb779('0x3d')]=[{'all':!![]}];}_0x316e1a=_['merge']({},_0x316e1a,_0x75945b['options']);return db[_0xb779('0x2a')][_0xb779('0x43')](_0x316e1a)[_0xb779('0x22')](handleEntityNotFound(_0x279e13,null))['then'](respondWithResult(_0x279e13,null))[_0xb779('0x40')](handleError(_0x279e13,null));};exports[_0xb779('0x44')]=function(_0x56fd84,_0x44959b){return db[_0xb779('0x2a')]['create'](_0x56fd84[_0xb779('0x45')],{})['then'](function(_0x59831b){var _0x1f73cd=_0x56fd84[_0xb779('0x46')][_0xb779('0x47')]({'plain':!![]});if(!_0x1f73cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f73cd['role']===_0xb779('0x46')){var _0x59aa86=_0x59831b[_0xb779('0x47')]({'plain':!![]});var _0x57c825='ODBC';return db[_0xb779('0x48')][_0xb779('0x43')]({'where':{'name':_0x57c825,'userProfileId':_0x1f73cd[_0xb779('0x49')]},'raw':!![]})[_0xb779('0x22')](function(_0x51f2c8){if(_0x51f2c8&&_0x51f2c8[_0xb779('0x4a')]===0x0){return db[_0xb779('0x4b')][_0xb779('0x44')]({'name':_0x59aa86[_0xb779('0x26')],'resourceId':_0x59aa86['id'],'type':_0x51f2c8[_0xb779('0x26')],'sectionId':_0x51f2c8['id']},{})[_0xb779('0x22')](function(){return _0x59831b;});}else{return _0x59831b;}})['catch'](function(_0x4f5fb3){logger[_0xb779('0x4c')](_0xb779('0x4d'),_0x4f5fb3);throw _0x4f5fb3;});}return _0x59831b;})[_0xb779('0x22')](respondWithResult(_0x44959b,0xc9))['catch'](handleError(_0x44959b,null));};exports[_0xb779('0x21')]=function(_0x77762d,_0x4e4917){if(_0x77762d[_0xb779('0x45')]['id']){delete _0x77762d[_0xb779('0x45')]['id'];}return db[_0xb779('0x2a')][_0xb779('0x43')]({'where':{'id':_0x77762d[_0xb779('0x42')]['id']}})[_0xb779('0x22')](handleEntityNotFound(_0x4e4917,null))[_0xb779('0x22')](saveUpdates(_0x77762d[_0xb779('0x45')],null))[_0xb779('0x22')](respondWithResult(_0x4e4917,null))[_0xb779('0x40')](handleError(_0x4e4917,null));};exports['destroy']=function(_0xc268dc,_0x5d76cb){return db['SquareOdbc']['find']({'where':{'id':_0xc268dc[_0xb779('0x42')]['id']}})[_0xb779('0x22')](handleEntityNotFound(_0x5d76cb,null))[_0xb779('0x22')](removeEntity(_0x5d76cb,null))[_0xb779('0x40')](handleError(_0x5d76cb,null));};exports[_0xb779('0x4e')]=function(_0x1ce60a,_0x40de63,_0x1f31ac){var _0x483529;return db[_0xb779('0x2a')][_0xb779('0x43')]({'where':{'id':_0x1ce60a[_0xb779('0x42')]['id']},'attributes':['id',_0xb779('0x4f')]})[_0xb779('0x22')](handleEntityNotFound(_0x40de63,null))[_0xb779('0x22')](function(_0x2e33bb){if(_0x2e33bb){var _0x3cc8e6=require(_0xb779('0x50'))();_0x3cc8e6[_0xb779('0x51')](_0x2e33bb[_0xb779('0x4f')]);_0x3cc8e6[_0xb779('0x52')]();return _0x2e33bb;}})['then'](respondWithResult(_0x40de63,null))[_0xb779('0x40')](handleError(_0x40de63,null));}; \ No newline at end of file +var _0x29b5=['filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../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','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x1365bb,_0x297a78){var _0x209ae2=function(_0x123c87){while(--_0x123c87){_0x1365bb['push'](_0x1365bb['shift']());}};_0x209ae2(++_0x297a78);}(_0x29b5,0x11f));var _0x529b=function(_0x25ad6e,_0x22934a){_0x25ad6e=_0x25ad6e-0x0;var _0x598c98=_0x29b5[_0x25ad6e];return _0x598c98;};'use strict';var emlformat=require(_0x529b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x529b('0x1'));var jsonpatch=require(_0x529b('0x2'));var rp=require('request-promise');var moment=require(_0x529b('0x3'));var BPromise=require(_0x529b('0x4'));var Mustache=require(_0x529b('0x5'));var util=require(_0x529b('0x6'));var path=require(_0x529b('0x7'));var sox=require('sox');var csv=require(_0x529b('0x8'));var ejs=require(_0x529b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x529b('0xa'));var squel=require(_0x529b('0xb'));var crypto=require(_0x529b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x529b('0xd'));var toCsv=require(_0x529b('0x8'));var querystring=require('querystring');var Papa=require(_0x529b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x529b('0xf'));var as=require(_0x529b('0x10'));var hardwareService=require(_0x529b('0x11'));var logger=require(_0x529b('0x12'))(_0x529b('0x13'));var utils=require(_0x529b('0x14'));var config=require(_0x529b('0x15'));var licenseUtil=require(_0x529b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e722,_0x2842ba){_0x2842ba=_0x2842ba||0xcc;return function(_0x2b2b77){if(_0x2b2b77){return _0x19e722[_0x529b('0x17')](_0x2842ba);}return _0x19e722[_0x529b('0x18')](_0x2842ba)[_0x529b('0x19')]();};}function respondWithResult(_0x439213,_0x410dd4){_0x410dd4=_0x410dd4||0xc8;return function(_0x666e19){if(_0x666e19){return _0x439213[_0x529b('0x18')](_0x410dd4)[_0x529b('0x1a')](_0x666e19);}};}function respondWithFilteredResult(_0x211d93,_0xa66d58){return function(_0x525422){if(_0x525422){var _0xdae4b7=typeof _0xa66d58[_0x529b('0x1b')]===_0x529b('0x1c')&&typeof _0xa66d58[_0x529b('0x1d')]===_0x529b('0x1c');var _0x5159bc=_0x525422['count'];var _0xa2d56f=_0xdae4b7?0x0:_0xa66d58[_0x529b('0x1b')];var _0x2b0473=_0xdae4b7?_0x525422['count']:_0xa66d58[_0x529b('0x1b')]+_0xa66d58['limit'];var _0x2aec48;if(_0x2b0473>=_0x5159bc){_0x2b0473=_0x5159bc;_0x2aec48=0xc8;}else{_0x2aec48=0xce;}_0x211d93['status'](_0x2aec48);return _0x211d93[_0x529b('0x1e')](_0x529b('0x1f'),_0xa2d56f+'-'+_0x2b0473+'/'+_0x5159bc)[_0x529b('0x1a')](_0x525422);}return null;};}function patchUpdates(_0x31604f){return function(_0x203763){try{jsonpatch[_0x529b('0x20')](_0x203763,_0x31604f,!![]);}catch(_0x5e6f01){return BPromise[_0x529b('0x21')](_0x5e6f01);}return _0x203763['save']();};}function saveUpdates(_0x4251a4,_0x3dc69f){return function(_0x22c61b){if(_0x22c61b){return _0x22c61b[_0x529b('0x22')](_0x4251a4)[_0x529b('0x23')](function(_0x3e19a7){return _0x3e19a7;});}return null;};}function removeEntity(_0x5ec9d0,_0x3047be){return function(_0x11d6c8){if(_0x11d6c8){return _0x11d6c8[_0x529b('0x24')]()[_0x529b('0x23')](function(){var _0x1cd46a=_0x11d6c8['get']({'plain':!![]});var _0x5b46fa='ODBC';return db[_0x529b('0x25')][_0x529b('0x24')]({'where':{'type':_0x5b46fa,'resourceId':_0x1cd46a['id']}})['then'](function(){return _0x11d6c8;});})[_0x529b('0x23')](function(){_0x5ec9d0['status'](0xcc)[_0x529b('0x19')]();});}};}function handleEntityNotFound(_0x3eb2ea,_0x3e81f8){return function(_0x38d6c9){if(!_0x38d6c9){_0x3eb2ea[_0x529b('0x17')](0x194);}return _0x38d6c9;};}function handleError(_0x3fedd1,_0x305f1d){_0x305f1d=_0x305f1d||0x1f4;return function(_0x1bd897){logger[_0x529b('0x26')](_0x1bd897[_0x529b('0x27')]);if(_0x1bd897[_0x529b('0x28')]){delete _0x1bd897[_0x529b('0x28')];}_0x3fedd1[_0x529b('0x18')](_0x305f1d)[_0x529b('0x29')](_0x1bd897);};}exports[_0x529b('0x2a')]=function(_0x4c046a,_0xc64588){var _0x3f7801={},_0x2e702f={},_0x2190a0={'count':0x0,'rows':[]};var _0x1d472e=_[_0x529b('0x2b')](db[_0x529b('0x2c')]['rawAttributes'],function(_0x3f7d06){return{'name':_0x3f7d06[_0x529b('0x2d')],'type':_0x3f7d06[_0x529b('0x2e')][_0x529b('0x2f')]};});_0x2e702f[_0x529b('0x30')]=_['map'](_0x1d472e,_0x529b('0x28'));_0x2e702f[_0x529b('0x31')]=_[_0x529b('0x32')](_0x4c046a['query']);_0x2e702f[_0x529b('0x33')]=_['intersection'](_0x2e702f['model'],_0x2e702f[_0x529b('0x31')]);_0x3f7801[_0x529b('0x34')]=_[_0x529b('0x35')](_0x2e702f[_0x529b('0x30')],qs[_0x529b('0x36')](_0x4c046a['query'][_0x529b('0x36')]));_0x3f7801[_0x529b('0x34')]=_0x3f7801['attributes'][_0x529b('0x37')]?_0x3f7801[_0x529b('0x34')]:_0x2e702f[_0x529b('0x30')];if(!_0x4c046a[_0x529b('0x31')][_0x529b('0x38')](_0x529b('0x39'))){_0x3f7801[_0x529b('0x1d')]=qs[_0x529b('0x1d')](_0x4c046a[_0x529b('0x31')][_0x529b('0x1d')]);_0x3f7801['offset']=qs['offset'](_0x4c046a[_0x529b('0x31')][_0x529b('0x1b')]);}_0x3f7801[_0x529b('0x3a')]=qs[_0x529b('0x3b')](_0x4c046a[_0x529b('0x31')][_0x529b('0x3b')]);_0x3f7801['where']=qs[_0x529b('0x33')](_[_0x529b('0x3c')](_0x4c046a['query'],_0x2e702f[_0x529b('0x33')]),_0x1d472e);if(_0x4c046a[_0x529b('0x31')][_0x529b('0x3d')]){_0x3f7801['where']=_[_0x529b('0x3e')](_0x3f7801['where'],{'$or':_[_0x529b('0x2b')](_0x1d472e,function(_0x54a306){if(_0x54a306['type']!==_0x529b('0x3f')){var _0x4a98a4={};_0x4a98a4[_0x54a306['name']]={'$like':'%'+_0x4c046a[_0x529b('0x31')]['filter']+'%'};return _0x4a98a4;}})});}_0x3f7801=_[_0x529b('0x3e')]({},_0x3f7801,_0x4c046a[_0x529b('0x40')]);var _0x18f467={'where':_0x3f7801['where']};return db[_0x529b('0x2c')]['count'](_0x18f467)[_0x529b('0x23')](function(_0xadfb83){_0x2190a0[_0x529b('0x41')]=_0xadfb83;if(_0x4c046a[_0x529b('0x31')][_0x529b('0x42')]){_0x3f7801[_0x529b('0x43')]=[{'all':!![]}];}return db[_0x529b('0x2c')][_0x529b('0x44')](_0x3f7801);})[_0x529b('0x23')](function(_0x4a36f3){_0x2190a0[_0x529b('0x45')]=_0x4a36f3;return _0x2190a0;})[_0x529b('0x23')](respondWithFilteredResult(_0xc64588,_0x3f7801))[_0x529b('0x46')](handleError(_0xc64588,null));};exports[_0x529b('0x47')]=function(_0x47cf3b,_0x1716d5){var _0xb31fc3={'raw':!![],'where':{'id':_0x47cf3b[_0x529b('0x48')]['id']}},_0x44d5d5={};_0x44d5d5['model']=_[_0x529b('0x32')](db[_0x529b('0x2c')]['rawAttributes']);_0x44d5d5[_0x529b('0x31')]=_[_0x529b('0x32')](_0x47cf3b[_0x529b('0x31')]);_0x44d5d5['filters']=_[_0x529b('0x35')](_0x44d5d5[_0x529b('0x30')],_0x44d5d5[_0x529b('0x31')]);_0xb31fc3[_0x529b('0x34')]=_[_0x529b('0x35')](_0x44d5d5[_0x529b('0x30')],qs['fields'](_0x47cf3b[_0x529b('0x31')][_0x529b('0x36')]));_0xb31fc3['attributes']=_0xb31fc3[_0x529b('0x34')][_0x529b('0x37')]?_0xb31fc3[_0x529b('0x34')]:_0x44d5d5[_0x529b('0x30')];if(_0x47cf3b[_0x529b('0x31')]['includeAll']){_0xb31fc3['include']=[{'all':!![]}];}_0xb31fc3=_['merge']({},_0xb31fc3,_0x47cf3b[_0x529b('0x40')]);return db[_0x529b('0x2c')][_0x529b('0x49')](_0xb31fc3)[_0x529b('0x23')](handleEntityNotFound(_0x1716d5,null))[_0x529b('0x23')](respondWithResult(_0x1716d5,null))['catch'](handleError(_0x1716d5,null));};exports[_0x529b('0x4a')]=function(_0x3d88b0,_0x58da39){return db['SquareOdbc'][_0x529b('0x4a')](_0x3d88b0[_0x529b('0x4b')],{})['then'](function(_0x6fcff3){var _0x598656=_0x3d88b0[_0x529b('0x4c')][_0x529b('0x4d')]({'plain':!![]});if(!_0x598656)throw new Error(_0x529b('0x4e'));if(_0x598656[_0x529b('0x4f')]===_0x529b('0x4c')){var _0x3eae6b=_0x6fcff3[_0x529b('0x4d')]({'plain':!![]});var _0x128648=_0x529b('0x50');return db[_0x529b('0x51')][_0x529b('0x49')]({'where':{'name':_0x128648,'userProfileId':_0x598656['userProfileId']},'raw':!![]})[_0x529b('0x23')](function(_0x491aba){if(_0x491aba&&_0x491aba['autoAssociation']===0x0){return db[_0x529b('0x25')][_0x529b('0x4a')]({'name':_0x3eae6b[_0x529b('0x28')],'resourceId':_0x3eae6b['id'],'type':_0x491aba[_0x529b('0x28')],'sectionId':_0x491aba['id']},{})['then'](function(){return _0x6fcff3;});}else{return _0x6fcff3;}})[_0x529b('0x46')](function(_0x38aac1){logger['error'](_0x529b('0x52'),_0x38aac1);throw _0x38aac1;});}return _0x6fcff3;})[_0x529b('0x23')](respondWithResult(_0x58da39,0xc9))[_0x529b('0x46')](handleError(_0x58da39,null));};exports[_0x529b('0x22')]=function(_0x4b3d54,_0x13645d){if(_0x4b3d54[_0x529b('0x4b')]['id']){delete _0x4b3d54[_0x529b('0x4b')]['id'];}return db['SquareOdbc'][_0x529b('0x49')]({'where':{'id':_0x4b3d54[_0x529b('0x48')]['id']}})[_0x529b('0x23')](handleEntityNotFound(_0x13645d,null))[_0x529b('0x23')](saveUpdates(_0x4b3d54[_0x529b('0x4b')],null))[_0x529b('0x23')](respondWithResult(_0x13645d,null))[_0x529b('0x46')](handleError(_0x13645d,null));};exports[_0x529b('0x24')]=function(_0x5f86b4,_0x5c91a6){return db['SquareOdbc']['find']({'where':{'id':_0x5f86b4[_0x529b('0x48')]['id']}})[_0x529b('0x23')](handleEntityNotFound(_0x5c91a6,null))[_0x529b('0x23')](removeEntity(_0x5c91a6,null))[_0x529b('0x46')](handleError(_0x5c91a6,null));};exports['test']=function(_0x2aabbc,_0x516353,_0x432b6d){var _0x5cf68e;return db[_0x529b('0x2c')][_0x529b('0x49')]({'where':{'id':_0x2aabbc[_0x529b('0x48')]['id']},'attributes':['id','dsn']})[_0x529b('0x23')](handleEntityNotFound(_0x516353,null))[_0x529b('0x23')](function(_0x2794d7){if(_0x2794d7){var _0x381008=require(_0x529b('0x53'))();_0x381008[_0x529b('0x54')](_0x2794d7[_0x529b('0x55')]);_0x381008[_0x529b('0x56')]();return _0x2794d7;}})['then'](respondWithResult(_0x516353,null))['catch'](handleError(_0x516353,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1d46539..b495070 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 _0x1b31=['moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1b31,0x7e));var _0x11b3=function(_0x1e7fb6,_0xc66c5c){_0x1e7fb6=_0x1e7fb6-0x0;var _0x5c9f65=_0x1b31[_0x1e7fb6];return _0x5c9f65;};'use strict';var _=require(_0x11b3('0x0'));var util=require(_0x11b3('0x1'));var logger=require(_0x11b3('0x2'))(_0x11b3('0x3'));var moment=require(_0x11b3('0x4'));var BPromise=require(_0x11b3('0x5'));var rp=require(_0x11b3('0x6'));var fs=require('fs');var path=require(_0x11b3('0x7'));var rimraf=require(_0x11b3('0x8'));var config=require('../../config/environment');var attributes=require(_0x11b3('0x9'));module[_0x11b3('0xa')]=function(_0x3efe9a,_0x46099f){return _0x3efe9a[_0x11b3('0xb')](_0x11b3('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b3=['exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','request-promise','path','./squareOdbc.attributes'];(function(_0x5dee87,_0x320064){var _0x5483f0=function(_0x549bcd){while(--_0x549bcd){_0x5dee87['push'](_0x5dee87['shift']());}};_0x5483f0(++_0x320064);}(_0x90b3,0x143));var _0x390b=function(_0x4f7fe0,_0x18201f){_0x4f7fe0=_0x4f7fe0-0x0;var _0x1e2851=_0x90b3[_0x4f7fe0];return _0x1e2851;};'use strict';var _=require(_0x390b('0x0'));var util=require(_0x390b('0x1'));var logger=require(_0x390b('0x2'))('api');var moment=require(_0x390b('0x3'));var BPromise=require('bluebird');var rp=require(_0x390b('0x4'));var fs=require('fs');var path=require(_0x390b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x390b('0x6'));module[_0x390b('0x7')]=function(_0x15b6f2,_0x31a2d3){return _0x15b6f2[_0x390b('0x8')](_0x390b('0x9'),attributes,{'tableName':_0x390b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b53833f..9f9be97 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 _0x72a2=['model','attributes','debug','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc','options','raw','where','include','map'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x72a2,0x84));var _0x272a=function(_0x40678d,_0x5ffaa4){_0x40678d=_0x40678d-0x0;var _0x4302ba=_0x72a2[_0x40678d];return _0x4302ba;};'use strict';var _=require(_0x272a('0x0'));var util=require(_0x272a('0x1'));var moment=require(_0x272a('0x2'));var BPromise=require(_0x272a('0x3'));var rs=require(_0x272a('0x4'));var fs=require('fs');var Redis=require(_0x272a('0x5'));var db=require(_0x272a('0x6'))['db'];var utils=require(_0x272a('0x7'));var logger=require(_0x272a('0x8'))(_0x272a('0x9'));var config=require('../../config/environment');var jayson=require(_0x272a('0xa'));var client=jayson['client'][_0x272a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c1853,_0x20a82e,_0x1b7e07){return new BPromise(function(_0x4404eb,_0x40e85a){return client[_0x272a('0xc')](_0x3c1853,_0x1b7e07)[_0x272a('0xd')](function(_0x872d09){logger[_0x272a('0xe')](_0x272a('0xf'),_0x20a82e,_0x272a('0x10'));logger['debug'](_0x272a('0x11'),_0x20a82e,_0x272a('0x10'),JSON[_0x272a('0x12')](_0x872d09));if(_0x872d09[_0x272a('0x13')]){if(_0x872d09[_0x272a('0x13')][_0x272a('0x14')]===0x1f4){logger['error'](_0x272a('0xf'),_0x20a82e,_0x872d09['error'][_0x272a('0x15')]);return _0x40e85a(_0x872d09[_0x272a('0x13')]['message']);}logger[_0x272a('0x13')](_0x272a('0xf'),_0x20a82e,_0x872d09[_0x272a('0x13')][_0x272a('0x15')]);return _0x4404eb(_0x872d09[_0x272a('0x13')][_0x272a('0x15')]);}else{logger[_0x272a('0xe')](_0x272a('0xf'),_0x20a82e,_0x272a('0x10'));_0x4404eb(_0x872d09['result']['message']);}})['catch'](function(_0x5b4acc){logger[_0x272a('0x13')](_0x272a('0xf'),_0x20a82e,_0x5b4acc);_0x40e85a(_0x5b4acc);});});}exports['ShowSquareOdbc']=function(_0x1e3e25){var _0x247dc=this;return new Promise(function(_0x41c063,_0x5232e7){return db[_0x272a('0x16')]['find']({'raw':_0x1e3e25[_0x272a('0x17')]?_0x1e3e25['options'][_0x272a('0x18')]===undefined?!![]:![]:!![],'where':_0x1e3e25['options']?_0x1e3e25[_0x272a('0x17')][_0x272a('0x19')]||null:null,'attributes':_0x1e3e25[_0x272a('0x17')]?_0x1e3e25[_0x272a('0x17')]['attributes']||null:null,'include':_0x1e3e25[_0x272a('0x17')]?_0x1e3e25[_0x272a('0x17')][_0x272a('0x1a')]?_[_0x272a('0x1b')](_0x1e3e25[_0x272a('0x17')][_0x272a('0x1a')],function(_0x1cbb32){return{'model':db[_0x1cbb32[_0x272a('0x1c')]],'as':_0x1cbb32['as'],'attributes':_0x1cbb32[_0x272a('0x1d')],'include':_0x1cbb32[_0x272a('0x1a')]?_[_0x272a('0x1b')](_0x1cbb32[_0x272a('0x1a')],function(_0x3ba083){return{'model':db[_0x3ba083[_0x272a('0x1c')]],'as':_0x3ba083['as'],'attributes':_0x3ba083[_0x272a('0x1d')],'include':_0x3ba083[_0x272a('0x1a')]?_['map'](_0x3ba083[_0x272a('0x1a')],function(_0x5755f6){return{'model':db[_0x5755f6[_0x272a('0x1c')]],'as':_0x5755f6['as'],'attributes':_0x5755f6[_0x272a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x272a('0xd')](function(_0x322975){logger[_0x272a('0xe')]('ShowSquareOdbc',_0x1e3e25);logger[_0x272a('0x1e')](_0x272a('0x1f'),_0x1e3e25,JSON[_0x272a('0x12')](_0x322975));_0x41c063(_0x322975);})['catch'](function(_0x308c0c){logger[_0x272a('0x13')](_0x272a('0x1f'),_0x308c0c[_0x272a('0x15')],_0x1e3e25);_0x5232e7(_0x247dc[_0x272a('0x13')](0x1f4,_0x308c0c['message']));});});}; \ No newline at end of file +var _0x3722=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','debug','stringify','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x3722,0x96));var _0x2372=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x3722[_0x403f5f];return _0x15b1cd;};'use strict';var _=require(_0x2372('0x0'));var util=require('util');var moment=require(_0x2372('0x1'));var BPromise=require(_0x2372('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2372('0x3'));var db=require(_0x2372('0x4'))['db'];var utils=require(_0x2372('0x5'));var logger=require(_0x2372('0x6'))(_0x2372('0x7'));var config=require('../../config/environment');var jayson=require(_0x2372('0x8'));var client=jayson['client'][_0x2372('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1982ee,_0x24347c,_0x532426){return new BPromise(function(_0x2b996d,_0x5ae0d3){return client[_0x2372('0xa')](_0x1982ee,_0x532426)[_0x2372('0xb')](function(_0x382379){logger[_0x2372('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x24347c,_0x2372('0xd'));logger['debug'](_0x2372('0xe'),_0x24347c,_0x2372('0xd'),JSON['stringify'](_0x382379));if(_0x382379['error']){if(_0x382379[_0x2372('0xf')][_0x2372('0x10')]===0x1f4){logger[_0x2372('0xf')](_0x2372('0x11'),_0x24347c,_0x382379[_0x2372('0xf')][_0x2372('0x12')]);return _0x5ae0d3(_0x382379['error'][_0x2372('0x12')]);}logger[_0x2372('0xf')](_0x2372('0x11'),_0x24347c,_0x382379[_0x2372('0xf')][_0x2372('0x12')]);return _0x2b996d(_0x382379[_0x2372('0xf')][_0x2372('0x12')]);}else{logger[_0x2372('0xc')](_0x2372('0x11'),_0x24347c,_0x2372('0xd'));_0x2b996d(_0x382379['result'][_0x2372('0x12')]);}})[_0x2372('0x13')](function(_0x2a95c4){logger[_0x2372('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x24347c,_0x2a95c4);_0x5ae0d3(_0x2a95c4);});});}exports[_0x2372('0x14')]=function(_0x360056){var _0x56357a=this;return new Promise(function(_0x2eaeaf,_0x1c9363){return db['SquareOdbc'][_0x2372('0x15')]({'raw':_0x360056[_0x2372('0x16')]?_0x360056[_0x2372('0x16')][_0x2372('0x17')]===undefined?!![]:![]:!![],'where':_0x360056[_0x2372('0x16')]?_0x360056[_0x2372('0x16')][_0x2372('0x18')]||null:null,'attributes':_0x360056[_0x2372('0x16')]?_0x360056[_0x2372('0x16')][_0x2372('0x19')]||null:null,'include':_0x360056['options']?_0x360056[_0x2372('0x16')][_0x2372('0x1a')]?_[_0x2372('0x1b')](_0x360056['options'][_0x2372('0x1a')],function(_0x4cdb37){return{'model':db[_0x4cdb37['model']],'as':_0x4cdb37['as'],'attributes':_0x4cdb37[_0x2372('0x19')],'include':_0x4cdb37['include']?_[_0x2372('0x1b')](_0x4cdb37['include'],function(_0x2372a6){return{'model':db[_0x2372a6[_0x2372('0x1c')]],'as':_0x2372a6['as'],'attributes':_0x2372a6[_0x2372('0x19')],'include':_0x2372a6[_0x2372('0x1a')]?_[_0x2372('0x1b')](_0x2372a6['include'],function(_0xd486a9){return{'model':db[_0xd486a9[_0x2372('0x1c')]],'as':_0xd486a9['as'],'attributes':_0xd486a9[_0x2372('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10d8a6){logger[_0x2372('0xc')](_0x2372('0x14'),_0x360056);logger[_0x2372('0x1d')](_0x2372('0x14'),_0x360056,JSON[_0x2372('0x1e')](_0x10d8a6));_0x2eaeaf(_0x10d8a6);})['catch'](function(_0x2fd960){logger[_0x2372('0xf')]('ShowSquareOdbc',_0x2fd960[_0x2372('0x12')],_0x360056);_0x1c9363(_0x56357a[_0x2372('0xf')](0x1f4,_0x2fd960['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 91bdd43..6fa0c9f 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 _0x5713=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/users','getUsers','post','update','delete','destroy','removeUsers','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5713,0x1c7));var _0x3571=function(_0x4a3b38,_0xa0cd40){_0x4a3b38=_0x4a3b38-0x0;var _0x4bf33f=_0x5713[_0x4a3b38];return _0x4bf33f;};'use strict';var multer=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var path=require('path');var timeout=require(_0x3571('0x2'));var express=require('express');var router=express[_0x3571('0x3')]();var fs_extra=require(_0x3571('0x4'));var auth=require(_0x3571('0x5'));var interaction=require(_0x3571('0x6'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0x3571('0x7')]('/',auth[_0x3571('0x8')](),controller[_0x3571('0x9')]);router[_0x3571('0x7')](_0x3571('0xa'),auth[_0x3571('0x8')](),controller['show']);router[_0x3571('0x7')](_0x3571('0xb'),auth[_0x3571('0x8')](),controller[_0x3571('0xc')]);router[_0x3571('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3571('0xd')](_0x3571('0xb'),auth[_0x3571('0x8')](),controller['addUsers']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3571('0xe')]);router[_0x3571('0xf')](_0x3571('0xa'),auth[_0x3571('0x8')](),controller[_0x3571('0x10')]);router[_0x3571('0xf')](_0x3571('0xb'),auth[_0x3571('0x8')](),controller[_0x3571('0x11')]);module[_0x3571('0x12')]=router; \ No newline at end of file +var _0xa76e=['removeUsers','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa76e,0xfe));var _0xea76=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xa76e[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require(_0xea76('0x0'));var path=require(_0xea76('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea76('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xea76('0x3'));var interaction=require(_0xea76('0x4'));var config=require(_0xea76('0x5'));var controller=require('./squareProject.controller');router[_0xea76('0x6')]('/',auth['isAuthenticated'](),controller[_0xea76('0x7')]);router['get'](_0xea76('0x8'),auth[_0xea76('0x9')](),controller['show']);router['get'](_0xea76('0xa'),auth[_0xea76('0x9')](),controller[_0xea76('0xb')]);router[_0xea76('0xc')]('/',auth['isAuthenticated'](),controller[_0xea76('0xd')]);router[_0xea76('0xc')](_0xea76('0xa'),auth['isAuthenticated'](),controller[_0xea76('0xe')]);router[_0xea76('0xf')](_0xea76('0x8'),auth[_0xea76('0x9')](),controller[_0xea76('0x10')]);router[_0xea76('0x11')](_0xea76('0x8'),auth[_0xea76('0x9')](),controller[_0xea76('0x12')]);router[_0xea76('0x11')](_0xea76('0xa'),auth[_0xea76('0x9')](),controller[_0xea76('0x13')]);module[_0xea76('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8ef4438..0f56ddf 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 _0xaaf5=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT'];(function(_0x9ae29c,_0x43759b){var _0x5a56b8=function(_0x29dbc6){while(--_0x29dbc6){_0x9ae29c['push'](_0x9ae29c['shift']());}};_0x5a56b8(++_0x43759b);}(_0xaaf5,0x14d));var _0x5aaf=function(_0x339794,_0x2241da){_0x339794=_0x339794-0x0;var _0x2b1957=_0xaaf5[_0x339794];return _0x2b1957;};'use strict';var Sequelize=require(_0x5aaf('0x0'));module[_0x5aaf('0x1')]={'name':{'type':Sequelize[_0x5aaf('0x2')],'unique':_0x5aaf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5aaf('0x2')]},'notes':{'type':Sequelize[_0x5aaf('0x4')]},'preproduction':{'type':Sequelize[_0x5aaf('0x5')](_0x5aaf('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x5aaf('0x7')](_0x5aaf('0x8'))[_0x5aaf('0x9')](_0x5aaf('0xa'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x5aaf('0x7')](_0x5aaf('0xb'))){return this[_0x5aaf('0x7')](_0x5aaf('0xb'))[_0x5aaf('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x5aaf('0xc')]},'publishedAt':{'type':Sequelize[_0x5aaf('0xc')]}}; \ No newline at end of file +var _0x7f86=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','BLOB','long'];(function(_0x42dddd,_0x5c207d){var _0x4cf459=function(_0x2aacc6){while(--_0x2aacc6){_0x42dddd['push'](_0x42dddd['shift']());}};_0x4cf459(++_0x5c207d);}(_0x7f86,0xea));var _0x67f8=function(_0x1ced77,_0x2a0306){_0x1ced77=_0x1ced77-0x0;var _0x159fe4=_0x7f86[_0x1ced77];return _0x159fe4;};'use strict';var Sequelize=require(_0x67f8('0x0'));module[_0x67f8('0x1')]={'name':{'type':Sequelize[_0x67f8('0x2')],'unique':_0x67f8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x67f8('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x67f8('0x4')](_0x67f8('0x5')),'get':function(){if(this[_0x67f8('0x6')](_0x67f8('0x7'))){return this['getDataValue'](_0x67f8('0x7'))[_0x67f8('0x8')](_0x67f8('0x9'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x67f8('0x6')](_0x67f8('0xa'))){return this[_0x67f8('0x6')](_0x67f8('0xa'))['toString'](_0x67f8('0x9'));}}},'savedAt':{'type':Sequelize[_0x67f8('0xb')]},'publishedAt':{'type':Sequelize[_0x67f8('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 883d181..1835bc6 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 _0x2ef3=['include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','pick','production','addUsers','omit','removeUsers','ids','isArray','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','limit','set','update','then','destroy','get','UserProfileResource','agi','error','stack','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','name','filter','options','includeAll'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x2ef3,0xba));var _0x32ef=function(_0x17f4de,_0x3e4eb5){_0x17f4de=_0x17f4de-0x0;var _0x59b88a=_0x2ef3[_0x17f4de];return _0x59b88a;};'use strict';var _=require(_0x32ef('0x0'));var Redis=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var config=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x6')]=_[_0x32ef('0x7')](config['redis'],{'host':_0x32ef('0x8'),'port':0x18eb});var socket=require(_0x32ef('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x32ef('0xa')](socket);function respondWithStatusCode(_0x4bfcf8,_0x367c39){_0x367c39=_0x367c39||0xcc;return function(_0x2fb8eb){if(_0x2fb8eb){return _0x4bfcf8[_0x32ef('0xb')](_0x367c39);}return _0x4bfcf8[_0x32ef('0xc')](_0x367c39)[_0x32ef('0xd')]();};}function respondWithResult(_0x2bbb50,_0x28275c){_0x28275c=_0x28275c||0xc8;return function(_0x77df79){if(_0x77df79){return _0x2bbb50['status'](_0x28275c)['json'](_0x77df79);}};}function respondWithFilteredResult(_0x401d0b,_0x33281d){return function(_0x45bfd5){if(_0x45bfd5){var _0x1499c2=typeof _0x33281d['offset']===_0x32ef('0xe')&&typeof _0x33281d['limit']===_0x32ef('0xe');var _0x49d590=_0x45bfd5[_0x32ef('0xf')];var _0x1ef1ae=_0x1499c2?0x0:_0x33281d['offset'];var _0x539d18=_0x1499c2?_0x45bfd5[_0x32ef('0xf')]:_0x33281d['offset']+_0x33281d[_0x32ef('0x10')];var _0x40a6e6;if(_0x539d18>=_0x49d590){_0x539d18=_0x49d590;_0x40a6e6=0xc8;}else{_0x40a6e6=0xce;}_0x401d0b[_0x32ef('0xc')](_0x40a6e6);return _0x401d0b[_0x32ef('0x11')]('Content-Range',_0x1ef1ae+'-'+_0x539d18+'/'+_0x49d590)['json'](_0x45bfd5);}return null;};}function saveUpdates(_0x531e30){return function(_0x13db1a){if(_0x13db1a){return _0x13db1a[_0x32ef('0x12')](_0x531e30)[_0x32ef('0x13')](function(_0x53a5ca){return _0x53a5ca;});}return null;};}function removeEntity(_0x5d559b){return function(_0x1eb468){if(_0x1eb468){return _0x1eb468[_0x32ef('0x14')]()[_0x32ef('0x13')](function(){var _0x57863c=_0x1eb468[_0x32ef('0x15')]({'plain':!![]});var _0x33e230='SquareProjects';return db[_0x32ef('0x16')][_0x32ef('0x14')]({'where':{'type':_0x33e230,'resourceId':_0x57863c['id']}})[_0x32ef('0x13')](function(){return _0x1eb468;});})[_0x32ef('0x13')](function(){var _0x445cda=new Redis(config[_0x32ef('0x6')]);_0x445cda['publish'](_0x32ef('0x17'),JSON['stringify']({'id':_0x1eb468['id'],'deleted':!![]}));})[_0x32ef('0x13')](function(){_0x5d559b[_0x32ef('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af371){return function(_0x97780){if(!_0x97780){_0x1af371[_0x32ef('0xb')](0x194);}return _0x97780;};}function handleError(_0x55f7f2,_0x57f5e5){_0x57f5e5=_0x57f5e5||0x1f4;return function(_0x22f2d7){logger[_0x32ef('0x18')](_0x22f2d7[_0x32ef('0x19')]);if(_0x22f2d7['name']){delete _0x22f2d7['name'];}_0x55f7f2[_0x32ef('0xc')](_0x57f5e5)['send'](_0x22f2d7);};}exports['index']=function(_0x278495,_0x14d4b3){var _0x371540={},_0x1dbe98={},_0x15ce54={'count':0x0,'rows':[]};var _0x234175=_[_0x32ef('0x1a')](db[_0x32ef('0x1b')][_0x32ef('0x1c')],function(_0x2f52d7){return{'name':_0x2f52d7[_0x32ef('0x1d')],'type':_0x2f52d7[_0x32ef('0x1e')]['key']};});_0x1dbe98[_0x32ef('0x1f')]=_[_0x32ef('0x1a')](_0x234175,'name');_0x1dbe98[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x278495[_0x32ef('0x20')]);_0x1dbe98[_0x32ef('0x22')]=_['intersection'](_0x1dbe98[_0x32ef('0x1f')],_0x1dbe98[_0x32ef('0x20')]);_0x371540[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x1dbe98[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x278495[_0x32ef('0x20')]['fields']));_0x371540[_0x32ef('0x23')]=_0x371540['attributes'][_0x32ef('0x26')]?_0x371540[_0x32ef('0x23')]:_0x1dbe98['model'];if(!_0x278495[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x371540[_0x32ef('0x10')]=qs[_0x32ef('0x10')](_0x278495['query']['limit']);_0x371540[_0x32ef('0x29')]=qs['offset'](_0x278495[_0x32ef('0x20')][_0x32ef('0x29')]);}_0x371540[_0x32ef('0x2a')]=qs[_0x32ef('0x2b')](_0x278495[_0x32ef('0x20')][_0x32ef('0x2b')]);_0x371540['where']=qs['filters'](_['pick'](_0x278495[_0x32ef('0x20')],_0x1dbe98[_0x32ef('0x22')]),_0x234175);if(_0x278495[_0x32ef('0x20')]['filter']){_0x371540['where']=_[_0x32ef('0x2c')](_0x371540[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x234175,function(_0x480348){if(_0x480348['type']!==_0x32ef('0x2e')){var _0x21706f={};_0x21706f[_0x480348[_0x32ef('0x2f')]]={'$like':'%'+_0x278495[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x21706f;}})});}_0x371540=_[_0x32ef('0x2c')]({},_0x371540,_0x278495[_0x32ef('0x31')]);var _0x21da90={'where':_0x371540[_0x32ef('0x2d')]};return db['SquareProject'][_0x32ef('0xf')](_0x21da90)[_0x32ef('0x13')](function(_0x14b54f){_0x15ce54['count']=_0x14b54f;if(_0x278495[_0x32ef('0x20')][_0x32ef('0x32')]){_0x371540[_0x32ef('0x33')]=[{'all':!![]}];}return db[_0x32ef('0x1b')][_0x32ef('0x34')](_0x371540);})[_0x32ef('0x13')](function(_0x256c40){_0x15ce54[_0x32ef('0x35')]=_0x256c40;return _0x15ce54;})[_0x32ef('0x13')](respondWithFilteredResult(_0x14d4b3,_0x371540))[_0x32ef('0x36')](handleError(_0x14d4b3,null));};exports[_0x32ef('0x37')]=function(_0x4615b4,_0x48e071){var _0x3cac2e={'raw':![],'where':{'id':_0x4615b4[_0x32ef('0x38')]['id']}},_0xc3a6d3={};_0xc3a6d3[_0x32ef('0x1f')]=_[_0x32ef('0x21')](db[_0x32ef('0x1b')][_0x32ef('0x1c')]);_0xc3a6d3['query']=_['keys'](_0x4615b4[_0x32ef('0x20')]);_0xc3a6d3[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0xc3a6d3[_0x32ef('0x1f')],_0xc3a6d3['query']);_0x3cac2e[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0xc3a6d3['model'],qs[_0x32ef('0x25')](_0x4615b4['query'][_0x32ef('0x25')]));_0x3cac2e[_0x32ef('0x23')]=_0x3cac2e[_0x32ef('0x23')][_0x32ef('0x26')]?_0x3cac2e[_0x32ef('0x23')]:_0xc3a6d3[_0x32ef('0x1f')];if(_0x4615b4[_0x32ef('0x20')][_0x32ef('0x32')]){_0x3cac2e[_0x32ef('0x33')]=[{'all':!![]}];}_0x3cac2e=_[_0x32ef('0x2c')]({},_0x3cac2e,_0x4615b4['options']);return db[_0x32ef('0x1b')]['find'](_0x3cac2e)[_0x32ef('0x13')](handleEntityNotFound(_0x48e071,null))[_0x32ef('0x13')](respondWithResult(_0x48e071,null))[_0x32ef('0x36')](handleError(_0x48e071,null));};exports['create']=function(_0x502113,_0x230ac9){return db[_0x32ef('0x1b')][_0x32ef('0x39')](_0x502113[_0x32ef('0x3a')],{})[_0x32ef('0x13')](function(_0x12c9e6){var _0x47dbe1=_0x502113['user'][_0x32ef('0x15')]({'plain':!![]});if(!_0x47dbe1)throw new Error(_0x32ef('0x3b'));if(_0x47dbe1[_0x32ef('0x3c')]===_0x32ef('0x3d')){var _0x209361=_0x12c9e6[_0x32ef('0x15')]({'plain':!![]});var _0x44ad11=_0x32ef('0x3e');return db[_0x32ef('0x3f')][_0x32ef('0x40')]({'where':{'name':_0x44ad11,'userProfileId':_0x47dbe1[_0x32ef('0x41')]},'raw':!![]})[_0x32ef('0x13')](function(_0x36a65c){if(_0x36a65c&&_0x36a65c['autoAssociation']===0x0){return db[_0x32ef('0x16')][_0x32ef('0x39')]({'name':_0x209361[_0x32ef('0x2f')],'resourceId':_0x209361['id'],'type':_0x36a65c[_0x32ef('0x2f')],'sectionId':_0x36a65c['id']},{})[_0x32ef('0x13')](function(){return _0x12c9e6;});}else{return _0x12c9e6;}})[_0x32ef('0x36')](function(_0x278696){logger[_0x32ef('0x18')](_0x32ef('0x42'),_0x278696);throw _0x278696;});}return _0x12c9e6;})[_0x32ef('0x13')](respondWithResult(_0x230ac9,0xc9))[_0x32ef('0x36')](handleError(_0x230ac9,null));};exports[_0x32ef('0x12')]=function(_0x272377,_0x326445){if(_0x272377[_0x32ef('0x3a')]['id']){delete _0x272377[_0x32ef('0x3a')]['id'];}return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x272377['params']['id']}})['then'](handleEntityNotFound(_0x326445,null))[_0x32ef('0x13')](saveUpdates(_0x272377[_0x32ef('0x3a')],null))[_0x32ef('0x13')](function(_0x166405){if(!_0x166405)return;var _0x34bd3e=_0x166405[_0x32ef('0x15')]({'plain':!![]});return _0x34bd3e;})[_0x32ef('0x13')](function(_0x1f105a){var _0x15b640=new Redis(config[_0x32ef('0x6')]);_0x15b640[_0x32ef('0x43')]('agi',JSON[_0x32ef('0x44')](_[_0x32ef('0x45')](_0x1f105a,['id',_0x32ef('0x2f'),_0x32ef('0x46')])));return _0x1f105a;})[_0x32ef('0x13')](respondWithResult(_0x326445,null))[_0x32ef('0x36')](handleError(_0x326445,null));};exports['destroy']=function(_0x44a4e9,_0x1eeb3e){return db[_0x32ef('0x1b')]['find']({'where':{'id':_0x44a4e9[_0x32ef('0x38')]['id']}})['then'](handleEntityNotFound(_0x1eeb3e,null))[_0x32ef('0x13')](removeEntity(_0x1eeb3e,null))[_0x32ef('0x36')](handleError(_0x1eeb3e,null));};exports['addUsers']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x206ad5[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x13')](function(_0x30e377){if(_0x30e377){return _0x30e377[_0x32ef('0x47')](_0x206ad5['body']['ids'],_[_0x32ef('0x48')](_0x206ad5['body'],['ids','id'])||{});}})[_0x32ef('0x13')](respondWithResult(_0x59e5f9,null))[_0x32ef('0x36')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x49')]=function(_0x6aae59,_0x2468e6){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x6aae59[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x2468e6,null))[_0x32ef('0x13')](function(_0x4c125c){if(_0x4c125c){return _0x4c125c['removeUsers'](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])['then'](function(){if(_[_0x32ef('0x4b')](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])){for(var _0x49c245=0x0;_0x49c245<_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')][_0x32ef('0x26')];_0x49c245+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')]['ids'][_0x49c245]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2468e6,null))[_0x32ef('0x36')](handleError(_0x2468e6,null));};exports[_0x32ef('0x4c')]=function(_0x5f9da7,_0x58ecbb){var _0x4557ce={};var _0x12b7f8={};var _0x4c3bab;var _0x4a4eaa;return db[_0x32ef('0x1b')][_0x32ef('0x4d')]({'where':{'id':_0x5f9da7[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x58ecbb,null))[_0x32ef('0x13')](function(_0x40700e){if(_0x40700e){_0x4c3bab=_0x40700e;_0x12b7f8['model']=_[_0x32ef('0x21')](db[_0x32ef('0x4e')][_0x32ef('0x1c')]);_0x12b7f8[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x5f9da7[_0x32ef('0x20')]);_0x12b7f8[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],_0x12b7f8['query']);_0x4557ce[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x5f9da7[_0x32ef('0x20')]['fields']));_0x4557ce['attributes']=_0x4557ce[_0x32ef('0x23')][_0x32ef('0x26')]?_0x4557ce[_0x32ef('0x23')]:_0x12b7f8[_0x32ef('0x1f')];_0x4557ce[_0x32ef('0x2a')]=qs['sort'](_0x5f9da7[_0x32ef('0x20')]['sort']);_0x4557ce[_0x32ef('0x2d')]=qs[_0x32ef('0x22')](_['pick'](_0x5f9da7['query'],_0x12b7f8[_0x32ef('0x22')]));if(_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]){_0x4557ce['where']=_['merge'](_0x4557ce[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x4557ce[_0x32ef('0x23')],function(_0x416e62){var _0x4f4006={};_0x4f4006[_0x416e62]={'$like':'%'+_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x4f4006;})});}_0x4557ce=_[_0x32ef('0x2c')]({},_0x4557ce,_0x5f9da7[_0x32ef('0x31')]);return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x43b176){if(_0x43b176){_0x4a4eaa=_0x43b176[_0x32ef('0x26')];if(!_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x4557ce[_0x32ef('0x10')]=qs['limit'](_0x5f9da7['query'][_0x32ef('0x10')]);_0x4557ce[_0x32ef('0x29')]=qs['offset'](_0x5f9da7[_0x32ef('0x20')]['offset']);}return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x323758){if(_0x323758){return _0x323758?{'count':_0x4a4eaa,'rows':_0x323758}:null;}})['then'](respondWithResult(_0x58ecbb,null))[_0x32ef('0x36')](handleError(_0x58ecbb,null));}; \ No newline at end of file +var _0xef0f=['error','stack','name','index','map','SquareProject','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','publish','production','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','order','options','hasOwnProperty','nolimit','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','offset','undefined','limit','count','update','then','get','SquareProjects','destroy','agi','sendStatus'];(function(_0x136fe7,_0x38887c){var _0x282ef2=function(_0x18875a){while(--_0x18875a){_0x136fe7['push'](_0x136fe7['shift']());}};_0x282ef2(++_0x38887c);}(_0xef0f,0x168));var _0xfef0=function(_0x278dce,_0x10861f){_0x278dce=_0x278dce-0x0;var _0x503ff8=_0xef0f[_0x278dce];return _0x503ff8;};'use strict';var _=require(_0xfef0('0x0'));var Redis=require('ioredis');var qs=require(_0xfef0('0x1'));var logger=require(_0xfef0('0x2'))(_0xfef0('0x3'));var config=require('../../config/environment');var db=require(_0xfef0('0x4'))['db'];config[_0xfef0('0x5')]=_[_0xfef0('0x6')](config['redis'],{'host':_0xfef0('0x7'),'port':0x18eb});var socket=require(_0xfef0('0x8'))(new Redis(config[_0xfef0('0x5')]));require(_0xfef0('0x9'))[_0xfef0('0xa')](socket);function respondWithStatusCode(_0x11dfd7,_0x5130bd){_0x5130bd=_0x5130bd||0xcc;return function(_0x41ec94){if(_0x41ec94){return _0x11dfd7['sendStatus'](_0x5130bd);}return _0x11dfd7[_0xfef0('0xb')](_0x5130bd)[_0xfef0('0xc')]();};}function respondWithResult(_0x3a81cc,_0x2d42dc){_0x2d42dc=_0x2d42dc||0xc8;return function(_0x334e74){if(_0x334e74){return _0x3a81cc[_0xfef0('0xb')](_0x2d42dc)[_0xfef0('0xd')](_0x334e74);}};}function respondWithFilteredResult(_0x4bd6f2,_0x11bbca){return function(_0x111878){if(_0x111878){var _0x410234=typeof _0x11bbca[_0xfef0('0xe')]===_0xfef0('0xf')&&typeof _0x11bbca[_0xfef0('0x10')]==='undefined';var _0x3135ab=_0x111878[_0xfef0('0x11')];var _0x24bbab=_0x410234?0x0:_0x11bbca[_0xfef0('0xe')];var _0xe9f78d=_0x410234?_0x111878[_0xfef0('0x11')]:_0x11bbca[_0xfef0('0xe')]+_0x11bbca['limit'];var _0x3d1f02;if(_0xe9f78d>=_0x3135ab){_0xe9f78d=_0x3135ab;_0x3d1f02=0xc8;}else{_0x3d1f02=0xce;}_0x4bd6f2['status'](_0x3d1f02);return _0x4bd6f2['set']('Content-Range',_0x24bbab+'-'+_0xe9f78d+'/'+_0x3135ab)[_0xfef0('0xd')](_0x111878);}return null;};}function saveUpdates(_0x284b6d){return function(_0x3510a7){if(_0x3510a7){return _0x3510a7[_0xfef0('0x12')](_0x284b6d)[_0xfef0('0x13')](function(_0x3f9a6c){return _0x3f9a6c;});}return null;};}function removeEntity(_0x155833){return function(_0x2887e6){if(_0x2887e6){return _0x2887e6['destroy']()[_0xfef0('0x13')](function(){var _0x1642cd=_0x2887e6[_0xfef0('0x14')]({'plain':!![]});var _0x39f9d3=_0xfef0('0x15');return db['UserProfileResource'][_0xfef0('0x16')]({'where':{'type':_0x39f9d3,'resourceId':_0x1642cd['id']}})['then'](function(){return _0x2887e6;});})[_0xfef0('0x13')](function(){var _0x1a0aa0=new Redis(config[_0xfef0('0x5')]);_0x1a0aa0['publish'](_0xfef0('0x17'),JSON['stringify']({'id':_0x2887e6['id'],'deleted':!![]}));})[_0xfef0('0x13')](function(){_0x155833[_0xfef0('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4897af){return function(_0x4b8b22){if(!_0x4b8b22){_0x4897af[_0xfef0('0x18')](0x194);}return _0x4b8b22;};}function handleError(_0x4faea8,_0x1f9970){_0x1f9970=_0x1f9970||0x1f4;return function(_0x46b34a){logger[_0xfef0('0x19')](_0x46b34a[_0xfef0('0x1a')]);if(_0x46b34a[_0xfef0('0x1b')]){delete _0x46b34a[_0xfef0('0x1b')];}_0x4faea8['status'](_0x1f9970)['send'](_0x46b34a);};}exports[_0xfef0('0x1c')]=function(_0x1ffaa4,_0x924f6e){var _0x34ca65={},_0xab231c={},_0xf60f2={'count':0x0,'rows':[]};var _0x5df04f=_[_0xfef0('0x1d')](db[_0xfef0('0x1e')]['rawAttributes'],function(_0x1a6758){return{'name':_0x1a6758[_0xfef0('0x1f')],'type':_0x1a6758[_0xfef0('0x20')][_0xfef0('0x21')]};});_0xab231c[_0xfef0('0x22')]=_[_0xfef0('0x1d')](_0x5df04f,_0xfef0('0x1b'));_0xab231c[_0xfef0('0x23')]=_[_0xfef0('0x24')](_0x1ffaa4[_0xfef0('0x23')]);_0xab231c[_0xfef0('0x25')]=_[_0xfef0('0x26')](_0xab231c['model'],_0xab231c[_0xfef0('0x23')]);_0x34ca65['attributes']=_['intersection'](_0xab231c[_0xfef0('0x22')],qs[_0xfef0('0x27')](_0x1ffaa4['query']['fields']));_0x34ca65['attributes']=_0x34ca65['attributes']['length']?_0x34ca65[_0xfef0('0x28')]:_0xab231c[_0xfef0('0x22')];if(!_0x1ffaa4[_0xfef0('0x23')]['hasOwnProperty']('nolimit')){_0x34ca65['limit']=qs[_0xfef0('0x10')](_0x1ffaa4['query'][_0xfef0('0x10')]);_0x34ca65[_0xfef0('0xe')]=qs[_0xfef0('0xe')](_0x1ffaa4['query'][_0xfef0('0xe')]);}_0x34ca65['order']=qs[_0xfef0('0x29')](_0x1ffaa4[_0xfef0('0x23')][_0xfef0('0x29')]);_0x34ca65[_0xfef0('0x2a')]=qs[_0xfef0('0x25')](_[_0xfef0('0x2b')](_0x1ffaa4[_0xfef0('0x23')],_0xab231c[_0xfef0('0x25')]),_0x5df04f);if(_0x1ffaa4['query'][_0xfef0('0x2c')]){_0x34ca65[_0xfef0('0x2a')]=_[_0xfef0('0x2d')](_0x34ca65[_0xfef0('0x2a')],{'$or':_[_0xfef0('0x1d')](_0x5df04f,function(_0x262341){if(_0x262341[_0xfef0('0x20')]!==_0xfef0('0x2e')){var _0x459d4a={};_0x459d4a[_0x262341[_0xfef0('0x1b')]]={'$like':'%'+_0x1ffaa4[_0xfef0('0x23')][_0xfef0('0x2c')]+'%'};return _0x459d4a;}})});}_0x34ca65=_[_0xfef0('0x2d')]({},_0x34ca65,_0x1ffaa4['options']);var _0x1f4a1e={'where':_0x34ca65['where']};return db[_0xfef0('0x1e')][_0xfef0('0x11')](_0x1f4a1e)[_0xfef0('0x13')](function(_0x4ab401){_0xf60f2[_0xfef0('0x11')]=_0x4ab401;if(_0x1ffaa4[_0xfef0('0x23')][_0xfef0('0x2f')]){_0x34ca65['include']=[{'all':!![]}];}return db[_0xfef0('0x1e')][_0xfef0('0x30')](_0x34ca65);})[_0xfef0('0x13')](function(_0x5577f4){_0xf60f2[_0xfef0('0x31')]=_0x5577f4;return _0xf60f2;})['then'](respondWithFilteredResult(_0x924f6e,_0x34ca65))['catch'](handleError(_0x924f6e,null));};exports[_0xfef0('0x32')]=function(_0x547a5d,_0x5c3305){var _0xbf6ddd={'raw':![],'where':{'id':_0x547a5d[_0xfef0('0x33')]['id']}},_0x61f1ce={};_0x61f1ce[_0xfef0('0x22')]=_[_0xfef0('0x24')](db[_0xfef0('0x1e')]['rawAttributes']);_0x61f1ce[_0xfef0('0x23')]=_[_0xfef0('0x24')](_0x547a5d['query']);_0x61f1ce['filters']=_[_0xfef0('0x26')](_0x61f1ce['model'],_0x61f1ce[_0xfef0('0x23')]);_0xbf6ddd[_0xfef0('0x28')]=_[_0xfef0('0x26')](_0x61f1ce[_0xfef0('0x22')],qs[_0xfef0('0x27')](_0x547a5d[_0xfef0('0x23')][_0xfef0('0x27')]));_0xbf6ddd[_0xfef0('0x28')]=_0xbf6ddd['attributes'][_0xfef0('0x34')]?_0xbf6ddd['attributes']:_0x61f1ce['model'];if(_0x547a5d[_0xfef0('0x23')][_0xfef0('0x2f')]){_0xbf6ddd['include']=[{'all':!![]}];}_0xbf6ddd=_[_0xfef0('0x2d')]({},_0xbf6ddd,_0x547a5d['options']);return db[_0xfef0('0x1e')][_0xfef0('0x35')](_0xbf6ddd)[_0xfef0('0x13')](handleEntityNotFound(_0x5c3305,null))[_0xfef0('0x13')](respondWithResult(_0x5c3305,null))['catch'](handleError(_0x5c3305,null));};exports[_0xfef0('0x36')]=function(_0x22838d,_0x504967){return db['SquareProject'][_0xfef0('0x36')](_0x22838d['body'],{})[_0xfef0('0x13')](function(_0x435153){var _0x390247=_0x22838d[_0xfef0('0x37')][_0xfef0('0x14')]({'plain':!![]});if(!_0x390247)throw new Error(_0xfef0('0x38'));if(_0x390247['role']===_0xfef0('0x37')){var _0x559a28=_0x435153['get']({'plain':!![]});var _0x2f11cb=_0xfef0('0x15');return db[_0xfef0('0x39')]['find']({'where':{'name':_0x2f11cb,'userProfileId':_0x390247[_0xfef0('0x3a')]},'raw':!![]})['then'](function(_0x5dd26b){if(_0x5dd26b&&_0x5dd26b['autoAssociation']===0x0){return db[_0xfef0('0x3b')][_0xfef0('0x36')]({'name':_0x559a28[_0xfef0('0x1b')],'resourceId':_0x559a28['id'],'type':_0x5dd26b[_0xfef0('0x1b')],'sectionId':_0x5dd26b['id']},{})[_0xfef0('0x13')](function(){return _0x435153;});}else{return _0x435153;}})[_0xfef0('0x3c')](function(_0x1b78af){logger[_0xfef0('0x19')](_0xfef0('0x3d'),_0x1b78af);throw _0x1b78af;});}return _0x435153;})['then'](respondWithResult(_0x504967,0xc9))['catch'](handleError(_0x504967,null));};exports[_0xfef0('0x12')]=function(_0x18e5ba,_0x34e9ed){if(_0x18e5ba[_0xfef0('0x3e')]['id']){delete _0x18e5ba[_0xfef0('0x3e')]['id'];}return db[_0xfef0('0x1e')][_0xfef0('0x35')]({'where':{'id':_0x18e5ba[_0xfef0('0x33')]['id']}})['then'](handleEntityNotFound(_0x34e9ed,null))[_0xfef0('0x13')](saveUpdates(_0x18e5ba[_0xfef0('0x3e')],null))[_0xfef0('0x13')](function(_0x10378e){if(!_0x10378e)return;var _0x6591d4=_0x10378e['get']({'plain':!![]});return _0x6591d4;})['then'](function(_0x523763){var _0x445f3f=new Redis(config[_0xfef0('0x5')]);_0x445f3f[_0xfef0('0x3f')](_0xfef0('0x17'),JSON['stringify'](_[_0xfef0('0x2b')](_0x523763,['id',_0xfef0('0x1b'),_0xfef0('0x40')])));return _0x523763;})[_0xfef0('0x13')](respondWithResult(_0x34e9ed,null))[_0xfef0('0x3c')](handleError(_0x34e9ed,null));};exports[_0xfef0('0x16')]=function(_0x282a18,_0x4cd0fd){return db[_0xfef0('0x1e')][_0xfef0('0x35')]({'where':{'id':_0x282a18['params']['id']}})[_0xfef0('0x13')](handleEntityNotFound(_0x4cd0fd,null))['then'](removeEntity(_0x4cd0fd,null))[_0xfef0('0x3c')](handleError(_0x4cd0fd,null));};exports[_0xfef0('0x41')]=function(_0x5cf1fa,_0x1e1c02){return db['SquareProject']['find']({'where':{'id':_0x5cf1fa['params']['id']}})[_0xfef0('0x13')](handleEntityNotFound(_0x1e1c02,null))[_0xfef0('0x13')](function(_0x455923){if(_0x455923){return _0x455923[_0xfef0('0x41')](_0x5cf1fa[_0xfef0('0x3e')][_0xfef0('0x42')],_['omit'](_0x5cf1fa[_0xfef0('0x3e')],[_0xfef0('0x42'),'id'])||{});}})[_0xfef0('0x13')](respondWithResult(_0x1e1c02,null))[_0xfef0('0x3c')](handleError(_0x1e1c02,null));};exports[_0xfef0('0x43')]=function(_0x58d95e,_0x59d1b6){return db['SquareProject'][_0xfef0('0x35')]({'where':{'id':_0x58d95e['params']['id']}})[_0xfef0('0x13')](handleEntityNotFound(_0x59d1b6,null))[_0xfef0('0x13')](function(_0xdd1121){if(_0xdd1121){return _0xdd1121[_0xfef0('0x43')](_0x58d95e[_0xfef0('0x23')]['ids'])[_0xfef0('0x13')](function(){if(_['isArray'](_0x58d95e[_0xfef0('0x23')][_0xfef0('0x42')])){for(var _0x4a4d36=0x0;_0x4a4d36<_0x58d95e[_0xfef0('0x23')][_0xfef0('0x42')][_0xfef0('0x34')];_0x4a4d36+=0x1){socket[_0xfef0('0x44')](_0xfef0('0x45'),{'UserId':Number(_0x58d95e[_0xfef0('0x23')][_0xfef0('0x42')][_0x4a4d36]),'SquareProjectId':Number(_0x58d95e[_0xfef0('0x33')]['id'])});}}else{socket[_0xfef0('0x44')](_0xfef0('0x45'),{'UserId':Number(_0x58d95e[_0xfef0('0x23')][_0xfef0('0x42')]),'SquareProjectId':Number(_0x58d95e['params']['id'])});}});}})[_0xfef0('0x13')](respondWithStatusCode(_0x59d1b6,null))[_0xfef0('0x3c')](handleError(_0x59d1b6,null));};exports[_0xfef0('0x46')]=function(_0x312dcf,_0x16f0a2){var _0x49ed54={};var _0x12e383={};var _0x15275e;var _0xf023ba;return db[_0xfef0('0x1e')][_0xfef0('0x47')]({'where':{'id':_0x312dcf[_0xfef0('0x33')]['id']}})[_0xfef0('0x13')](handleEntityNotFound(_0x16f0a2,null))[_0xfef0('0x13')](function(_0x14d53d){if(_0x14d53d){_0x15275e=_0x14d53d;_0x12e383[_0xfef0('0x22')]=_['keys'](db[_0xfef0('0x48')]['rawAttributes']);_0x12e383[_0xfef0('0x23')]=_[_0xfef0('0x24')](_0x312dcf['query']);_0x12e383[_0xfef0('0x25')]=_[_0xfef0('0x26')](_0x12e383[_0xfef0('0x22')],_0x12e383[_0xfef0('0x23')]);_0x49ed54[_0xfef0('0x28')]=_['intersection'](_0x12e383[_0xfef0('0x22')],qs[_0xfef0('0x27')](_0x312dcf[_0xfef0('0x23')]['fields']));_0x49ed54[_0xfef0('0x28')]=_0x49ed54[_0xfef0('0x28')][_0xfef0('0x34')]?_0x49ed54[_0xfef0('0x28')]:_0x12e383[_0xfef0('0x22')];_0x49ed54[_0xfef0('0x49')]=qs[_0xfef0('0x29')](_0x312dcf['query'][_0xfef0('0x29')]);_0x49ed54[_0xfef0('0x2a')]=qs[_0xfef0('0x25')](_[_0xfef0('0x2b')](_0x312dcf[_0xfef0('0x23')],_0x12e383[_0xfef0('0x25')]));if(_0x312dcf['query'][_0xfef0('0x2c')]){_0x49ed54[_0xfef0('0x2a')]=_[_0xfef0('0x2d')](_0x49ed54[_0xfef0('0x2a')],{'$or':_['map'](_0x49ed54[_0xfef0('0x28')],function(_0x24b25e){var _0x5a33a1={};_0x5a33a1[_0x24b25e]={'$like':'%'+_0x312dcf[_0xfef0('0x23')][_0xfef0('0x2c')]+'%'};return _0x5a33a1;})});}_0x49ed54=_[_0xfef0('0x2d')]({},_0x49ed54,_0x312dcf[_0xfef0('0x4a')]);return _0x15275e[_0xfef0('0x46')](_0x49ed54);}})['then'](function(_0x4eb78e){if(_0x4eb78e){_0xf023ba=_0x4eb78e['length'];if(!_0x312dcf[_0xfef0('0x23')][_0xfef0('0x4b')](_0xfef0('0x4c'))){_0x49ed54['limit']=qs[_0xfef0('0x10')](_0x312dcf['query']['limit']);_0x49ed54['offset']=qs[_0xfef0('0xe')](_0x312dcf[_0xfef0('0x23')]['offset']);}return _0x15275e[_0xfef0('0x46')](_0x49ed54);}})[_0xfef0('0x13')](function(_0x1f4c6f){if(_0x1f4c6f){return _0x1f4c6f?{'count':_0xf023ba,'rows':_0x1f4c6f}:null;}})['then'](respondWithResult(_0x16f0a2,null))[_0xfef0('0x3c')](handleError(_0x16f0a2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fb1226b..d6c9cc0 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 _0xa474=['emit','hook','events','../../mysqldb','SquareProject','save','update'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xa474,0x95));var _0x4a47=function(_0x1d7f22,_0x424b24){_0x1d7f22=_0x1d7f22-0x0;var _0x5dd8a3=_0xa474[_0x1d7f22];return _0x5dd8a3;};'use strict';var EventEmitter=require(_0x4a47('0x0'));var SquareProject=require(_0x4a47('0x1'))['db'][_0x4a47('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4a47('0x3'),'afterUpdate':_0x4a47('0x4'),'afterDestroy':'remove'};function emitEvent(_0x244b45){return function(_0x38da5b,_0x1705e3,_0x585ad3){SquareProjectEvents['emit'](_0x244b45+':'+_0x38da5b['id'],_0x38da5b);SquareProjectEvents[_0x4a47('0x5')](_0x244b45,_0x38da5b);_0x585ad3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x4a47('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x08f5=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x08f5,0x18d));var _0x508f=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0x08f5[_0x7cdaf1];return _0xf58e9a;};'use strict';var EventEmitter=require(_0x508f('0x0'));var SquareProject=require(_0x508f('0x1'))['db'][_0x508f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x508f('0x3')](0x0);var events={'afterCreate':_0x508f('0x4'),'afterUpdate':_0x508f('0x5'),'afterDestroy':_0x508f('0x6')};function emitEvent(_0x6dfc3a){return function(_0xd8c04c,_0x1c1aa3,_0x3eddc0){SquareProjectEvents[_0x508f('0x7')](_0x6dfc3a+':'+_0xd8c04c['id'],_0xd8c04c);SquareProjectEvents[_0x508f('0x7')](_0x6dfc3a,_0xd8c04c);_0x3eddc0(null);};}for(var e in events){if(events[_0x508f('0x8')](e)){var event=events[e];SquareProject[_0x508f('0x9')](e,emitEvent(event));}}module[_0x508f('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d5c22f9..85cc2b5 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 _0xb222=['production','publishedAt','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','preproduction','savedAt','format'];(function(_0x28e083,_0x1b2d7d){var _0x6ca4f1=function(_0x4b15b5){while(--_0x4b15b5){_0x28e083['push'](_0x28e083['shift']());}};_0x6ca4f1(++_0x1b2d7d);}(_0xb222,0x112));var _0x2b22=function(_0x2ffb2b,_0x253877){_0x2ffb2b=_0x2ffb2b-0x0;var _0x2d6526=_0xb222[_0x2ffb2b];return _0x2d6526;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b22('0x0'))(_0x2b22('0x1'));var moment=require(_0x2b22('0x2'));var BPromise=require(_0x2b22('0x3'));var rp=require(_0x2b22('0x4'));var fs=require('fs');var path=require(_0x2b22('0x5'));var rimraf=require(_0x2b22('0x6'));var config=require(_0x2b22('0x7'));var attributes=require(_0x2b22('0x8'));module['exports']=function(_0x4ff512,_0x57d9a0){return _0x4ff512[_0x2b22('0x9')]('SquareProject',attributes,{'tableName':_0x2b22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x171a0e,_0x27670d,_0x5f0146){if(_0x171a0e['changed'](_0x2b22('0xb'))){_0x171a0e[_0x2b22('0xc')]=moment()[_0x2b22('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x171a0e['changed'](_0x2b22('0xe'))){_0x171a0e[_0x2b22('0xf')]=moment()[_0x2b22('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5f0146(null,_0x171a0e);}}});}; \ No newline at end of file +var _0x76e3=['publishedAt','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareProject.attributes','define','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0xca67ec,_0x4a6d13){var _0x509220=function(_0x28f87c){while(--_0x28f87c){_0xca67ec['push'](_0xca67ec['shift']());}};_0x509220(++_0x4a6d13);}(_0x76e3,0x97));var _0x376e=function(_0x434fef,_0x2c9697){_0x434fef=_0x434fef-0x0;var _0x2d8a33=_0x76e3[_0x434fef];return _0x2d8a33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x376e('0x0'))(_0x376e('0x1'));var moment=require(_0x376e('0x2'));var BPromise=require(_0x376e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x376e('0x4'));var rimraf=require('rimraf');var config=require(_0x376e('0x5'));var attributes=require(_0x376e('0x6'));module['exports']=function(_0x1d72c8,_0x580898){return _0x1d72c8[_0x376e('0x7')]('SquareProject',attributes,{'tableName':_0x376e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13cb4c,_0x3847c1,_0x26e916){if(_0x13cb4c[_0x376e('0x9')]('preproduction')){_0x13cb4c[_0x376e('0xa')]=moment()[_0x376e('0xb')](_0x376e('0xc'));}if(_0x13cb4c[_0x376e('0x9')](_0x376e('0xd'))){_0x13cb4c[_0x376e('0xe')]=moment()[_0x376e('0xb')](_0x376e('0xc'));}_0x26e916(null,_0x13cb4c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1de0ddd..e5fda43 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 _0xa1a1=['catch','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','include','map','then','debug','message','error','ShowSquareProject','find','model','info','stringify'];(function(_0x267919,_0x55a044){var _0x447523=function(_0x129642){while(--_0x129642){_0x267919['push'](_0x267919['shift']());}};_0x447523(++_0x55a044);}(_0xa1a1,0x1c1));var _0x1a1a=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xa1a1[_0x587fb5];return _0x551105;};'use strict';var _=require(_0x1a1a('0x0'));var Redis=require(_0x1a1a('0x1'));var db=require(_0x1a1a('0x2'))['db'];var logger=require(_0x1a1a('0x3'))('rpc');var config=require(_0x1a1a('0x4'));config[_0x1a1a('0x5')]=_[_0x1a1a('0x6')](config[_0x1a1a('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a1a('0x7'))[_0x1a1a('0x8')](socket);exports[_0x1a1a('0x9')]=function(_0x19722d){var _0x5b3cac=this;return new Promise(function(_0x19d554,_0x1847c){return db[_0x1a1a('0xa')][_0x1a1a('0xb')]({'raw':_0x19722d[_0x1a1a('0xc')]?_0x19722d[_0x1a1a('0xc')][_0x1a1a('0xd')]===undefined?!![]:![]:!![],'where':_0x19722d['options']?_0x19722d[_0x1a1a('0xc')][_0x1a1a('0xe')]||null:null,'attributes':_0x19722d[_0x1a1a('0xc')]?_0x19722d[_0x1a1a('0xc')][_0x1a1a('0xf')]||null:null,'limit':_0x19722d['options']?_0x19722d['options']['limit']||null:null,'include':_0x19722d[_0x1a1a('0xc')]?_0x19722d['options'][_0x1a1a('0x10')]?_[_0x1a1a('0x11')](_0x19722d[_0x1a1a('0xc')][_0x1a1a('0x10')],function(_0x590736){return{'model':db[_0x590736['model']],'as':_0x590736['as'],'attributes':_0x590736[_0x1a1a('0xf')],'include':_0x590736['include']?_[_0x1a1a('0x11')](_0x590736['include'],function(_0x4dea2d){return{'model':db[_0x4dea2d['model']],'as':_0x4dea2d['as'],'attributes':_0x4dea2d[_0x1a1a('0xf')],'include':_0x4dea2d[_0x1a1a('0x10')]?_['map'](_0x4dea2d['include'],function(_0x31b0b7){return{'model':db[_0x31b0b7['model']],'as':_0x31b0b7['as'],'attributes':_0x31b0b7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a1a('0x12')](function(_0x27bfd5){logger['info']('GetSquareProjects',_0x19722d);logger[_0x1a1a('0x13')]('GetSquareProjects',_0x19722d,JSON['stringify'](_0x27bfd5));_0x19d554(_0x27bfd5);})['catch'](function(_0x2c641d){logger['error'](_0x1a1a('0x9'),_0x2c641d[_0x1a1a('0x14')],_0x19722d);_0x1847c(_0x5b3cac[_0x1a1a('0x15')](0x1f4,_0x2c641d[_0x1a1a('0x14')]));});});};exports[_0x1a1a('0x16')]=function(_0x56804c){var _0x3086e7=this;return new Promise(function(_0x29a5bf,_0x58e8e2){return db[_0x1a1a('0xa')][_0x1a1a('0x17')]({'raw':_0x56804c[_0x1a1a('0xc')]?_0x56804c['options']['raw']===undefined?!![]:![]:!![],'where':_0x56804c[_0x1a1a('0xc')]?_0x56804c['options'][_0x1a1a('0xe')]||null:null,'attributes':_0x56804c['options']?_0x56804c[_0x1a1a('0xc')][_0x1a1a('0xf')]||null:null,'include':_0x56804c['options']?_0x56804c['options'][_0x1a1a('0x10')]?_['map'](_0x56804c[_0x1a1a('0xc')]['include'],function(_0x4a0ab9){return{'model':db[_0x4a0ab9[_0x1a1a('0x18')]],'as':_0x4a0ab9['as'],'attributes':_0x4a0ab9[_0x1a1a('0xf')],'include':_0x4a0ab9[_0x1a1a('0x10')]?_[_0x1a1a('0x11')](_0x4a0ab9[_0x1a1a('0x10')],function(_0x54702f){return{'model':db[_0x54702f['model']],'as':_0x54702f['as'],'attributes':_0x54702f[_0x1a1a('0xf')],'include':_0x54702f['include']?_['map'](_0x54702f[_0x1a1a('0x10')],function(_0x58c073){return{'model':db[_0x58c073[_0x1a1a('0x18')]],'as':_0x58c073['as'],'attributes':_0x58c073['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a1a('0x12')](function(_0x402da6){logger[_0x1a1a('0x19')]('ShowSquareProject',_0x56804c);logger[_0x1a1a('0x13')]('ShowSquareProject',_0x56804c,JSON[_0x1a1a('0x1a')](_0x402da6));_0x29a5bf(_0x402da6);})[_0x1a1a('0x1b')](function(_0x576670){logger[_0x1a1a('0x15')]('ShowSquareProject',_0x576670[_0x1a1a('0x14')],_0x56804c);_0x58e8e2(_0x3086e7['error'](0x1f4,_0x576670['message']));});});}; \ No newline at end of file +var _0xe498=['model','then','info','debug','stringify','catch','error','message','find','where','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','options','raw','attributes','include','map'];(function(_0x360179,_0x3a4461){var _0x7673c4=function(_0x321e74){while(--_0x321e74){_0x360179['push'](_0x360179['shift']());}};_0x7673c4(++_0x3a4461);}(_0xe498,0x185));var _0x8e49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe498[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8e49('0x0'));var Redis=require(_0x8e49('0x1'));var db=require(_0x8e49('0x2'))['db'];var logger=require(_0x8e49('0x3'))('rpc');var config=require(_0x8e49('0x4'));config['redis']=_[_0x8e49('0x5')](config[_0x8e49('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e49('0x7'))(new Redis(config['redis']));require(_0x8e49('0x8'))['register'](socket);exports[_0x8e49('0x9')]=function(_0x300021){var _0x2c60e5=this;return new Promise(function(_0x479087,_0x28ed96){return db[_0x8e49('0xa')]['findAll']({'raw':_0x300021[_0x8e49('0xb')]?_0x300021[_0x8e49('0xb')][_0x8e49('0xc')]===undefined?!![]:![]:!![],'where':_0x300021[_0x8e49('0xb')]?_0x300021[_0x8e49('0xb')]['where']||null:null,'attributes':_0x300021[_0x8e49('0xb')]?_0x300021[_0x8e49('0xb')][_0x8e49('0xd')]||null:null,'limit':_0x300021[_0x8e49('0xb')]?_0x300021['options']['limit']||null:null,'include':_0x300021[_0x8e49('0xb')]?_0x300021[_0x8e49('0xb')][_0x8e49('0xe')]?_[_0x8e49('0xf')](_0x300021[_0x8e49('0xb')][_0x8e49('0xe')],function(_0x48d1d4){return{'model':db[_0x48d1d4[_0x8e49('0x10')]],'as':_0x48d1d4['as'],'attributes':_0x48d1d4[_0x8e49('0xd')],'include':_0x48d1d4[_0x8e49('0xe')]?_[_0x8e49('0xf')](_0x48d1d4[_0x8e49('0xe')],function(_0x3a6b6d){return{'model':db[_0x3a6b6d[_0x8e49('0x10')]],'as':_0x3a6b6d['as'],'attributes':_0x3a6b6d[_0x8e49('0xd')],'include':_0x3a6b6d['include']?_['map'](_0x3a6b6d[_0x8e49('0xe')],function(_0x38e26b){return{'model':db[_0x38e26b[_0x8e49('0x10')]],'as':_0x38e26b['as'],'attributes':_0x38e26b[_0x8e49('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8e49('0x11')](function(_0x399e88){logger[_0x8e49('0x12')](_0x8e49('0x9'),_0x300021);logger[_0x8e49('0x13')](_0x8e49('0x9'),_0x300021,JSON[_0x8e49('0x14')](_0x399e88));_0x479087(_0x399e88);})[_0x8e49('0x15')](function(_0x4a232b){logger[_0x8e49('0x16')]('GetSquareProjects',_0x4a232b['message'],_0x300021);_0x28ed96(_0x2c60e5[_0x8e49('0x16')](0x1f4,_0x4a232b[_0x8e49('0x17')]));});});};exports['ShowSquareProject']=function(_0x239a1b){var _0x3b166e=this;return new Promise(function(_0x43a26a,_0x495552){return db[_0x8e49('0xa')][_0x8e49('0x18')]({'raw':_0x239a1b[_0x8e49('0xb')]?_0x239a1b['options'][_0x8e49('0xc')]===undefined?!![]:![]:!![],'where':_0x239a1b[_0x8e49('0xb')]?_0x239a1b[_0x8e49('0xb')][_0x8e49('0x19')]||null:null,'attributes':_0x239a1b['options']?_0x239a1b[_0x8e49('0xb')]['attributes']||null:null,'include':_0x239a1b[_0x8e49('0xb')]?_0x239a1b[_0x8e49('0xb')][_0x8e49('0xe')]?_[_0x8e49('0xf')](_0x239a1b[_0x8e49('0xb')][_0x8e49('0xe')],function(_0x94f8ef){return{'model':db[_0x94f8ef[_0x8e49('0x10')]],'as':_0x94f8ef['as'],'attributes':_0x94f8ef[_0x8e49('0xd')],'include':_0x94f8ef['include']?_['map'](_0x94f8ef[_0x8e49('0xe')],function(_0xdd3b71){return{'model':db[_0xdd3b71[_0x8e49('0x10')]],'as':_0xdd3b71['as'],'attributes':_0xdd3b71[_0x8e49('0xd')],'include':_0xdd3b71['include']?_[_0x8e49('0xf')](_0xdd3b71[_0x8e49('0xe')],function(_0x50ac7e){return{'model':db[_0x50ac7e[_0x8e49('0x10')]],'as':_0x50ac7e['as'],'attributes':_0x50ac7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e49('0x11')](function(_0x10a48f){logger[_0x8e49('0x12')](_0x8e49('0x1a'),_0x239a1b);logger[_0x8e49('0x13')]('ShowSquareProject',_0x239a1b,JSON[_0x8e49('0x14')](_0x10a48f));_0x43a26a(_0x10a48f);})[_0x8e49('0x15')](function(_0x4f9b0d){logger[_0x8e49('0x16')](_0x8e49('0x1a'),_0x4f9b0d['message'],_0x239a1b);_0x495552(_0x3b166e[_0x8e49('0x16')](0x1f4,_0x4f9b0d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 65fd97a..7b0f38d 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 _0x660a=['remove','update','removeListener','register','./squareProject.events','save'];(function(_0x3a845e,_0x2bfae5){var _0x44a7c8=function(_0x2d981f){while(--_0x2d981f){_0x3a845e['push'](_0x3a845e['shift']());}};_0x44a7c8(++_0x2bfae5);}(_0x660a,0x1b4));var _0xa660=function(_0x2b9b3a,_0x5a81bc){_0x2b9b3a=_0x2b9b3a-0x0;var _0x393639=_0x660a[_0x2b9b3a];return _0x393639;};'use strict';var SquareProjectEvents=require(_0xa660('0x0'));var events=[_0xa660('0x1'),_0xa660('0x2'),_0xa660('0x3')];function createListener(_0x229ced,_0x23d714){return function(_0x1e2e62){_0x23d714['emit'](_0x229ced,_0x1e2e62);};}function removeListener(_0x286e98,_0x470ea5){return function(){SquareProjectEvents[_0xa660('0x4')](_0x286e98,_0x470ea5);};}exports[_0xa660('0x5')]=function(_0x3054f9){for(var _0x184354=0x0,_0x41ad6d=events['length'];_0x184354<_0x41ad6d;_0x184354++){var _0x454571=events[_0x184354];var _0x427ccb=createListener('squareProject:'+_0x454571,_0x3054f9);SquareProjectEvents['on'](_0x454571,_0x427ccb);}}; \ No newline at end of file +var _0x01b1=['register','length','./squareProject.events','save','remove','emit','removeListener'];(function(_0x2bff0b,_0x449287){var _0x28f51c=function(_0x2a6b34){while(--_0x2a6b34){_0x2bff0b['push'](_0x2bff0b['shift']());}};_0x28f51c(++_0x449287);}(_0x01b1,0xa3));var _0x101b=function(_0x487060,_0x224dc7){_0x487060=_0x487060-0x0;var _0x2d75a8=_0x01b1[_0x487060];return _0x2d75a8;};'use strict';var SquareProjectEvents=require(_0x101b('0x0'));var events=[_0x101b('0x1'),_0x101b('0x2'),'update'];function createListener(_0x3bf53d,_0x3e1407){return function(_0x27e04f){_0x3e1407[_0x101b('0x3')](_0x3bf53d,_0x27e04f);};}function removeListener(_0x221e7c,_0x11b1cc){return function(){SquareProjectEvents[_0x101b('0x4')](_0x221e7c,_0x11b1cc);};}exports[_0x101b('0x5')]=function(_0x31dd8d){for(var _0xc4629c=0x0,_0x1ba1a5=events[_0x101b('0x6')];_0xc4629c<_0x1ba1a5;_0xc4629c++){var _0x46e0e9=events[_0xc4629c];var _0x5d79f8=createListener('squareProject:'+_0x46e0e9,_0x31dd8d);SquareProjectEvents['on'](_0x46e0e9,_0x5d79f8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 62bc92f..4611cd6 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x46f57c,_0x390766){var _0x5c4841=function(_0x438a69){while(--_0x438a69){_0x46f57c['push'](_0x46f57c['shift']());}};_0x5c4841(++_0x390766);}(_0x1cb9,0x14e));var _0x91cb=function(_0x492498,_0x69f808){_0x492498=_0x492498-0x0;var _0x119d20=_0x1cb9[_0x492498];return _0x119d20;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x18aeb8,_0x25359c){var _0x5d8608=function(_0xa784c0){while(--_0xa784c0){_0x18aeb8['push'](_0x18aeb8['shift']());}};_0x5d8608(++_0x25359c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x5fc3[_0x4ce028];return _0x583d0c;};'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 c5e49c2..85c6be8 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 _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x276dc9,_0x4f2650){var _0x1ec268=function(_0x354cb0){while(--_0x354cb0){_0x276dc9['push'](_0x276dc9['shift']());}};_0x1ec268(++_0x4f2650);}(_0x814b,0x1a2));var _0xb814=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x814b[_0x128450];return _0x4d80ed;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x25fa51,_0x2a23a3){var _0x459f76=function(_0x3c081b){while(--_0x3c081b){_0x25fa51['push'](_0x25fa51['shift']());}};_0x459f76(++_0x2a23a3);}(_0x7c09,0x102));var _0x97c0=function(_0xc51178,_0x1a6207){_0xc51178=_0xc51178-0x0;var _0x519ec6=_0x7c09[_0xc51178];return _0x519ec6;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d6a441d..0db9c70 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 _0xc070=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info'];(function(_0x391c02,_0xfa24d5){var _0x465a76=function(_0x44c553){while(--_0x44c553){_0x391c02['push'](_0x391c02['shift']());}};_0x465a76(++_0xfa24d5);}(_0xc070,0x120));var _0x0c07=function(_0x3aa301,_0x5cd2e2){_0x3aa301=_0x3aa301-0x0;var _0x4b9126=_0xc070[_0x3aa301];return _0x4b9126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c07('0x0'));var zipdir=require(_0x0c07('0x1'));var jsonpatch=require(_0x0c07('0x2'));var rp=require(_0x0c07('0x3'));var moment=require('moment');var BPromise=require(_0x0c07('0x4'));var Mustache=require(_0x0c07('0x5'));var util=require('util');var path=require(_0x0c07('0x6'));var sox=require('sox');var csv=require(_0x0c07('0x7'));var ejs=require(_0x0c07('0x8'));var fs=require('fs');var fs_extra=require(_0x0c07('0x9'));var _=require(_0x0c07('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c07('0xb'));var deskjs=require(_0x0c07('0xc'));var toCsv=require(_0x0c07('0x7'));var querystring=require(_0x0c07('0xd'));var Papa=require(_0x0c07('0xe'));var Redis=require(_0x0c07('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0c07('0x10'));var as=require(_0x0c07('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c07('0x12'))('api');var utils=require(_0x0c07('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x578c6d,_0x1526c0){_0x1526c0=_0x1526c0||0xcc;return function(_0x22cb9d){if(_0x22cb9d){return _0x578c6d[_0x0c07('0x14')](_0x1526c0);}return _0x578c6d[_0x0c07('0x15')](_0x1526c0)['end']();};}function respondWithResult(_0x31741f,_0x21537e){_0x21537e=_0x21537e||0xc8;return function(_0x85050d){if(_0x85050d){return _0x31741f[_0x0c07('0x15')](_0x21537e)[_0x0c07('0x16')](_0x85050d);}};}function respondWithFilteredResult(_0x2db237,_0x4562a2){return function(_0xf8a8c9){if(_0xf8a8c9){var _0x285700=typeof _0x4562a2[_0x0c07('0x17')]==='undefined'&&typeof _0x4562a2[_0x0c07('0x18')]===_0x0c07('0x19');var _0x5bb5b2=_0xf8a8c9[_0x0c07('0x1a')];var _0x2fc2e9=_0x285700?0x0:_0x4562a2[_0x0c07('0x17')];var _0x4c4d0b=_0x285700?_0xf8a8c9[_0x0c07('0x1a')]:_0x4562a2[_0x0c07('0x17')]+_0x4562a2[_0x0c07('0x18')];var _0x4d6279;if(_0x4c4d0b>=_0x5bb5b2){_0x4c4d0b=_0x5bb5b2;_0x4d6279=0xc8;}else{_0x4d6279=0xce;}_0x2db237[_0x0c07('0x15')](_0x4d6279);return _0x2db237[_0x0c07('0x1b')](_0x0c07('0x1c'),_0x2fc2e9+'-'+_0x4c4d0b+'/'+_0x5bb5b2)[_0x0c07('0x16')](_0xf8a8c9);}return null;};}function patchUpdates(_0x4e6836){return function(_0x2b8952){try{jsonpatch[_0x0c07('0x1d')](_0x2b8952,_0x4e6836,!![]);}catch(_0x5d96ac){return BPromise[_0x0c07('0x1e')](_0x5d96ac);}return _0x2b8952[_0x0c07('0x1f')]();};}function saveUpdates(_0x2394c9,_0x13ee09){return function(_0x1ce6be){if(_0x1ce6be){return _0x1ce6be[_0x0c07('0x20')](_0x2394c9)[_0x0c07('0x21')](function(_0x4a0b0d){return _0x4a0b0d;});}return null;};}function removeEntity(_0x370636,_0x99e167){return function(_0x2b07cc){if(_0x2b07cc){return _0x2b07cc[_0x0c07('0x22')]()['then'](function(){_0x370636['status'](0xcc)[_0x0c07('0x23')]();});}};}function handleEntityNotFound(_0x9c3d5d,_0x442825){return function(_0x391397){if(!_0x391397){_0x9c3d5d[_0x0c07('0x14')](0x194);}return _0x391397;};}function handleError(_0x23d5ba,_0x51e31f){_0x51e31f=_0x51e31f||0x1f4;return function(_0x8ac539){logger['error'](_0x8ac539[_0x0c07('0x24')]);if(_0x8ac539[_0x0c07('0x25')]){delete _0x8ac539[_0x0c07('0x25')];}_0x23d5ba[_0x0c07('0x15')](_0x51e31f)['send'](_0x8ac539);};}exports[_0x0c07('0x26')]=function(_0x38fa5f,_0x4c5ccf){var _0x3afdd={},_0x3cf5ad={},_0x1783ad={'count':0x0,'rows':[]};var _0x2068a9=_[_0x0c07('0x27')](db[_0x0c07('0x28')][_0x0c07('0x29')],function(_0x474ee2){return{'name':_0x474ee2[_0x0c07('0x2a')],'type':_0x474ee2[_0x0c07('0x2b')][_0x0c07('0x2c')]};});_0x3cf5ad[_0x0c07('0x2d')]=_['map'](_0x2068a9,'name');_0x3cf5ad['query']=_[_0x0c07('0x2e')](_0x38fa5f[_0x0c07('0x2f')]);_0x3cf5ad[_0x0c07('0x30')]=_[_0x0c07('0x31')](_0x3cf5ad[_0x0c07('0x2d')],_0x3cf5ad['query']);_0x3afdd[_0x0c07('0x32')]=_[_0x0c07('0x31')](_0x3cf5ad[_0x0c07('0x2d')],qs[_0x0c07('0x33')](_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x33')]));_0x3afdd[_0x0c07('0x32')]=_0x3afdd['attributes'][_0x0c07('0x34')]?_0x3afdd['attributes']:_0x3cf5ad[_0x0c07('0x2d')];if(!_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x35')](_0x0c07('0x36'))){_0x3afdd[_0x0c07('0x18')]=qs[_0x0c07('0x18')](_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x18')]);_0x3afdd[_0x0c07('0x17')]=qs[_0x0c07('0x17')](_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x17')]);}_0x3afdd[_0x0c07('0x37')]=qs[_0x0c07('0x38')](_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x38')]);_0x3afdd[_0x0c07('0x39')]=qs[_0x0c07('0x30')](_[_0x0c07('0x3a')](_0x38fa5f[_0x0c07('0x2f')],_0x3cf5ad[_0x0c07('0x30')]),_0x2068a9);if(_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x3b')]){_0x3afdd[_0x0c07('0x39')]=_[_0x0c07('0x3c')](_0x3afdd['where'],{'$or':_[_0x0c07('0x27')](_0x2068a9,function(_0x1bf922){if(_0x1bf922['type']!==_0x0c07('0x3d')){var _0xfc94d8={};_0xfc94d8[_0x1bf922['name']]={'$like':'%'+_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x3b')]+'%'};return _0xfc94d8;}})});}_0x3afdd=_[_0x0c07('0x3c')]({},_0x3afdd,_0x38fa5f['options']);var _0x2a9aee={'where':_0x3afdd[_0x0c07('0x39')]};return db[_0x0c07('0x28')][_0x0c07('0x1a')](_0x2a9aee)[_0x0c07('0x21')](function(_0x54ba1b){_0x1783ad[_0x0c07('0x1a')]=_0x54ba1b;if(_0x38fa5f[_0x0c07('0x2f')][_0x0c07('0x3e')]){_0x3afdd[_0x0c07('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0x0c07('0x40')](_0x3afdd);})['then'](function(_0x4c8d12){_0x1783ad[_0x0c07('0x41')]=_0x4c8d12;return _0x1783ad;})[_0x0c07('0x21')](respondWithFilteredResult(_0x4c5ccf,_0x3afdd))[_0x0c07('0x42')](handleError(_0x4c5ccf,null));};exports[_0x0c07('0x43')]=function(_0x1b894c,_0x24b522){var _0x1ec895={'raw':!![],'where':{'id':_0x1b894c['params']['id']}},_0x24ec5={};_0x24ec5[_0x0c07('0x2d')]=_[_0x0c07('0x2e')](db[_0x0c07('0x28')][_0x0c07('0x29')]);_0x24ec5[_0x0c07('0x2f')]=_[_0x0c07('0x2e')](_0x1b894c['query']);_0x24ec5[_0x0c07('0x30')]=_['intersection'](_0x24ec5[_0x0c07('0x2d')],_0x24ec5['query']);_0x1ec895['attributes']=_[_0x0c07('0x31')](_0x24ec5[_0x0c07('0x2d')],qs['fields'](_0x1b894c[_0x0c07('0x2f')][_0x0c07('0x33')]));_0x1ec895[_0x0c07('0x32')]=_0x1ec895[_0x0c07('0x32')][_0x0c07('0x34')]?_0x1ec895[_0x0c07('0x32')]:_0x24ec5[_0x0c07('0x2d')];if(_0x1b894c['query']['includeAll']){_0x1ec895[_0x0c07('0x3f')]=[{'all':!![]}];}_0x1ec895=_[_0x0c07('0x3c')]({},_0x1ec895,_0x1b894c['options']);return db[_0x0c07('0x28')][_0x0c07('0x44')](_0x1ec895)['then'](handleEntityNotFound(_0x24b522,null))[_0x0c07('0x21')](respondWithResult(_0x24b522,null))[_0x0c07('0x42')](handleError(_0x24b522,null));};exports['create']=function(_0x49891a,_0x2010af){return db[_0x0c07('0x28')][_0x0c07('0x45')](_0x49891a[_0x0c07('0x46')],{})[_0x0c07('0x21')](respondWithResult(_0x2010af,0xc9))[_0x0c07('0x42')](handleError(_0x2010af,null));};exports[_0x0c07('0x20')]=function(_0x3ac32a,_0x1d9732){if(_0x3ac32a['body']['id']){delete _0x3ac32a[_0x0c07('0x46')]['id'];}return db[_0x0c07('0x28')][_0x0c07('0x44')]({'where':{'id':_0x3ac32a[_0x0c07('0x47')]['id']}})[_0x0c07('0x21')](handleEntityNotFound(_0x1d9732,null))[_0x0c07('0x21')](saveUpdates(_0x3ac32a[_0x0c07('0x46')],null))['then'](respondWithResult(_0x1d9732,null))[_0x0c07('0x42')](handleError(_0x1d9732,null));};exports[_0x0c07('0x48')]=function(_0x578692,_0x1c6b80,_0x481832){var _0x292867=require(_0x0c07('0x49'));var _0x3df1ed=![];var _0x539c1d={};if(_0x578692[_0x0c07('0x2f')][_0x0c07('0x2b')]&&_0x578692[_0x0c07('0x2f')]['type']===_0x0c07('0x4a')){_0x539c1d[_0x0c07('0x4a')]=_0x578692[_0x0c07('0x47')]['id'];}else{_0x539c1d['id']=_0x578692[_0x0c07('0x47')]['id'];}return db['SquareRecording']['find']({'where':_0x539c1d,'attributes':['id',_0x0c07('0x4b'),_0x0c07('0x4c')],'raw':!![]})[_0x0c07('0x21')](handleEntityNotFound(_0x1c6b80,null))[_0x0c07('0x21')](function(_0x1dd9e1){if(_0x1dd9e1){var _0x3b1356=_0x1dd9e1['savePath'];var _0x2c75b4=util['format'](_0x0c07('0x4d'),_0x3b1356);if(fs[_0x0c07('0x4e')](_0x2c75b4)){_0x3df1ed=!![];return _0x292867[_0x0c07('0x4f')](_0x2c75b4,_0x3b1356,config[_0x0c07('0x50')][_0x0c07('0x51')])[_0x0c07('0x21')](function(){return _0x1dd9e1;});}return _0x1dd9e1;}})[_0x0c07('0x21')](function(_0x48ffd4){if(_0x48ffd4){var _0xe56bf6=_0x48ffd4[_0x0c07('0x4b')];if(!fs[_0x0c07('0x4e')](_0xe56bf6)){throw new db['Sequelize'][(_0x0c07('0x52'))](_0x0c07('0x53'));}if(_0x48ffd4[_0x0c07('0x4c')]){return _0x1c6b80[_0x0c07('0x48')](_0xe56bf6,_0x48ffd4['filename']+path[_0x0c07('0x54')](_0xe56bf6),function(){if(_0x3df1ed){fs['unlink'](_0xe56bf6);}});}else{return _0x1c6b80['download'](_0xe56bf6,function(_0x56c46a){if(_0x3df1ed){fs[_0x0c07('0x55')](_0xe56bf6);}});}}})[_0x0c07('0x42')](function(_0x4c8352){if(_0x4c8352[_0x0c07('0x56')]===_0x0c07('0x53')){_0x1c6b80[_0x0c07('0x15')](0x194)['send'](_0x0c07('0x57'));}else{return handleError(_0x1c6b80,null);}});};exports[_0x0c07('0x22')]=function(_0xe52484,_0x48a34d){return db['SquareRecording']['find']({'where':{'id':_0xe52484[_0x0c07('0x47')]['id']}})[_0x0c07('0x21')](function(_0x50c71d){if(_[_0x0c07('0x58')](_0x50c71d)){throw new ReferenceError(_0x0c07('0x59'));}return _0x50c71d;})[_0x0c07('0x21')](function(_0x503e45){var _0x46479b=_0x503e45[_0x0c07('0x4b')];logger['info'](_0x0c07('0x5a'),_0x46479b);if(!_['isNil'](_0x503e45[_0x0c07('0x4b')])&&fs[_0x0c07('0x4e')](_0x46479b)){logger['info'](_0x0c07('0x5b')+_0x46479b+_0x0c07('0x5c'));fs[_0x0c07('0x5d')](_0x46479b);}_0x46479b=_0x46479b+_0x0c07('0x5e');if(!_[_0x0c07('0x58')](_0x503e45[_0x0c07('0x4b')])&&fs[_0x0c07('0x4e')](_0x46479b)){logger[_0x0c07('0x5f')](_0x0c07('0x5b')+_0x46479b+_0x0c07('0x5c'));fs['unlinkSync'](_0x46479b);}return _0x503e45;})[_0x0c07('0x21')](function(_0x52d322){if(!_0x52d322)throw new InternalError();return _0x52d322[_0x0c07('0x22')]();})['then'](function(){_0x48a34d[_0x0c07('0x15')](0xcc)[_0x0c07('0x23')]();})[_0x0c07('0x42')](handleError(_0x48a34d,null));}; \ No newline at end of file +var _0xaccb=['Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SquareRecording','includeAll','include','rows','catch','params','options','find','create','body','update','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x4634f8,_0x1ac5ec){var _0x2374f1=function(_0x7dcc77){while(--_0x7dcc77){_0x4634f8['push'](_0x4634f8['shift']());}};_0x2374f1(++_0x1ac5ec);}(_0xaccb,0x1c4));var _0xbacc=function(_0x3d1d8b,_0x184169){_0x3d1d8b=_0x3d1d8b-0x0;var _0x45d8b1=_0xaccb[_0x3d1d8b];return _0x45d8b1;};'use strict';var emlformat=require(_0xbacc('0x0'));var rimraf=require(_0xbacc('0x1'));var zipdir=require(_0xbacc('0x2'));var jsonpatch=require(_0xbacc('0x3'));var rp=require('request-promise');var moment=require(_0xbacc('0x4'));var BPromise=require(_0xbacc('0x5'));var Mustache=require(_0xbacc('0x6'));var util=require(_0xbacc('0x7'));var path=require(_0xbacc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbacc('0x9'));var fs=require('fs');var fs_extra=require(_0xbacc('0xa'));var _=require(_0xbacc('0xb'));var squel=require(_0xbacc('0xc'));var crypto=require(_0xbacc('0xd'));var jsforce=require(_0xbacc('0xe'));var deskjs=require(_0xbacc('0xf'));var toCsv=require(_0xbacc('0x10'));var querystring=require(_0xbacc('0x11'));var Papa=require(_0xbacc('0x12'));var Redis=require('ioredis');var authService=require(_0xbacc('0x13'));var qs=require(_0xbacc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbacc('0x15'));var logger=require(_0xbacc('0x16'))(_0xbacc('0x17'));var utils=require('../../config/utils');var config=require(_0xbacc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbacc('0x19'))['db'];function respondWithStatusCode(_0x14cad3,_0x12d77b){_0x12d77b=_0x12d77b||0xcc;return function(_0x3dbc34){if(_0x3dbc34){return _0x14cad3['sendStatus'](_0x12d77b);}return _0x14cad3[_0xbacc('0x1a')](_0x12d77b)[_0xbacc('0x1b')]();};}function respondWithResult(_0x27d3f5,_0x9ce88a){_0x9ce88a=_0x9ce88a||0xc8;return function(_0x56514a){if(_0x56514a){return _0x27d3f5[_0xbacc('0x1a')](_0x9ce88a)[_0xbacc('0x1c')](_0x56514a);}};}function respondWithFilteredResult(_0x39c914,_0x1faff3){return function(_0x203209){if(_0x203209){var _0x189f0c=typeof _0x1faff3[_0xbacc('0x1d')]===_0xbacc('0x1e')&&typeof _0x1faff3[_0xbacc('0x1f')]===_0xbacc('0x1e');var _0x490027=_0x203209[_0xbacc('0x20')];var _0x55d1f2=_0x189f0c?0x0:_0x1faff3[_0xbacc('0x1d')];var _0x9c3294=_0x189f0c?_0x203209[_0xbacc('0x20')]:_0x1faff3[_0xbacc('0x1d')]+_0x1faff3['limit'];var _0x2f43e6;if(_0x9c3294>=_0x490027){_0x9c3294=_0x490027;_0x2f43e6=0xc8;}else{_0x2f43e6=0xce;}_0x39c914[_0xbacc('0x1a')](_0x2f43e6);return _0x39c914['set'](_0xbacc('0x21'),_0x55d1f2+'-'+_0x9c3294+'/'+_0x490027)[_0xbacc('0x1c')](_0x203209);}return null;};}function patchUpdates(_0x268494){return function(_0x3bd9b5){try{jsonpatch['apply'](_0x3bd9b5,_0x268494,!![]);}catch(_0x37739c){return BPromise[_0xbacc('0x22')](_0x37739c);}return _0x3bd9b5[_0xbacc('0x23')]();};}function saveUpdates(_0x527bbb,_0x28a1ed){return function(_0x40764f){if(_0x40764f){return _0x40764f['update'](_0x527bbb)[_0xbacc('0x24')](function(_0x6f5757){return _0x6f5757;});}return null;};}function removeEntity(_0x506b0c,_0x448ce8){return function(_0x1be599){if(_0x1be599){return _0x1be599[_0xbacc('0x25')]()['then'](function(){_0x506b0c['status'](0xcc)[_0xbacc('0x1b')]();});}};}function handleEntityNotFound(_0x1aa555,_0x31db9d){return function(_0x21e595){if(!_0x21e595){_0x1aa555[_0xbacc('0x26')](0x194);}return _0x21e595;};}function handleError(_0x29ffd8,_0xed58f0){_0xed58f0=_0xed58f0||0x1f4;return function(_0x52e069){logger['error'](_0x52e069[_0xbacc('0x27')]);if(_0x52e069[_0xbacc('0x28')]){delete _0x52e069[_0xbacc('0x28')];}_0x29ffd8[_0xbacc('0x1a')](_0xed58f0)[_0xbacc('0x29')](_0x52e069);};}exports[_0xbacc('0x2a')]=function(_0x44cc08,_0x291e52){var _0xffe333={},_0x3bf066={},_0x4b8f09={'count':0x0,'rows':[]};var _0x41a3d0=_['map'](db['SquareRecording'][_0xbacc('0x2b')],function(_0x4c04e4){return{'name':_0x4c04e4[_0xbacc('0x2c')],'type':_0x4c04e4[_0xbacc('0x2d')][_0xbacc('0x2e')]};});_0x3bf066[_0xbacc('0x2f')]=_[_0xbacc('0x30')](_0x41a3d0,'name');_0x3bf066['query']=_[_0xbacc('0x31')](_0x44cc08[_0xbacc('0x32')]);_0x3bf066['filters']=_[_0xbacc('0x33')](_0x3bf066[_0xbacc('0x2f')],_0x3bf066['query']);_0xffe333['attributes']=_['intersection'](_0x3bf066['model'],qs[_0xbacc('0x34')](_0x44cc08['query'][_0xbacc('0x34')]));_0xffe333[_0xbacc('0x35')]=_0xffe333[_0xbacc('0x35')][_0xbacc('0x36')]?_0xffe333[_0xbacc('0x35')]:_0x3bf066[_0xbacc('0x2f')];if(!_0x44cc08['query'][_0xbacc('0x37')](_0xbacc('0x38'))){_0xffe333[_0xbacc('0x1f')]=qs['limit'](_0x44cc08[_0xbacc('0x32')][_0xbacc('0x1f')]);_0xffe333[_0xbacc('0x1d')]=qs['offset'](_0x44cc08[_0xbacc('0x32')][_0xbacc('0x1d')]);}_0xffe333[_0xbacc('0x39')]=qs['sort'](_0x44cc08[_0xbacc('0x32')][_0xbacc('0x3a')]);_0xffe333[_0xbacc('0x3b')]=qs['filters'](_['pick'](_0x44cc08['query'],_0x3bf066[_0xbacc('0x3c')]),_0x41a3d0);if(_0x44cc08['query'][_0xbacc('0x3d')]){_0xffe333[_0xbacc('0x3b')]=_[_0xbacc('0x3e')](_0xffe333[_0xbacc('0x3b')],{'$or':_[_0xbacc('0x30')](_0x41a3d0,function(_0x1e49ab){if(_0x1e49ab[_0xbacc('0x2d')]!==_0xbacc('0x3f')){var _0x32f813={};_0x32f813[_0x1e49ab[_0xbacc('0x28')]]={'$like':'%'+_0x44cc08['query'][_0xbacc('0x3d')]+'%'};return _0x32f813;}})});}_0xffe333=_[_0xbacc('0x3e')]({},_0xffe333,_0x44cc08['options']);var _0x114d07={'where':_0xffe333[_0xbacc('0x3b')]};return db[_0xbacc('0x40')][_0xbacc('0x20')](_0x114d07)[_0xbacc('0x24')](function(_0x53e96a){_0x4b8f09[_0xbacc('0x20')]=_0x53e96a;if(_0x44cc08[_0xbacc('0x32')][_0xbacc('0x41')]){_0xffe333[_0xbacc('0x42')]=[{'all':!![]}];}return db[_0xbacc('0x40')]['findAll'](_0xffe333);})[_0xbacc('0x24')](function(_0xbf2b17){_0x4b8f09[_0xbacc('0x43')]=_0xbf2b17;return _0x4b8f09;})[_0xbacc('0x24')](respondWithFilteredResult(_0x291e52,_0xffe333))[_0xbacc('0x44')](handleError(_0x291e52,null));};exports['show']=function(_0x1e48f6,_0x1cd1bc){var _0x35d65b={'raw':!![],'where':{'id':_0x1e48f6[_0xbacc('0x45')]['id']}},_0x1db55b={};_0x1db55b[_0xbacc('0x2f')]=_['keys'](db[_0xbacc('0x40')]['rawAttributes']);_0x1db55b[_0xbacc('0x32')]=_[_0xbacc('0x31')](_0x1e48f6[_0xbacc('0x32')]);_0x1db55b[_0xbacc('0x3c')]=_[_0xbacc('0x33')](_0x1db55b[_0xbacc('0x2f')],_0x1db55b[_0xbacc('0x32')]);_0x35d65b['attributes']=_[_0xbacc('0x33')](_0x1db55b[_0xbacc('0x2f')],qs[_0xbacc('0x34')](_0x1e48f6[_0xbacc('0x32')][_0xbacc('0x34')]));_0x35d65b[_0xbacc('0x35')]=_0x35d65b[_0xbacc('0x35')][_0xbacc('0x36')]?_0x35d65b['attributes']:_0x1db55b[_0xbacc('0x2f')];if(_0x1e48f6[_0xbacc('0x32')][_0xbacc('0x41')]){_0x35d65b[_0xbacc('0x42')]=[{'all':!![]}];}_0x35d65b=_[_0xbacc('0x3e')]({},_0x35d65b,_0x1e48f6[_0xbacc('0x46')]);return db['SquareRecording'][_0xbacc('0x47')](_0x35d65b)[_0xbacc('0x24')](handleEntityNotFound(_0x1cd1bc,null))['then'](respondWithResult(_0x1cd1bc,null))[_0xbacc('0x44')](handleError(_0x1cd1bc,null));};exports[_0xbacc('0x48')]=function(_0x19f9d3,_0x3d9589){return db[_0xbacc('0x40')][_0xbacc('0x48')](_0x19f9d3[_0xbacc('0x49')],{})[_0xbacc('0x24')](respondWithResult(_0x3d9589,0xc9))[_0xbacc('0x44')](handleError(_0x3d9589,null));};exports[_0xbacc('0x4a')]=function(_0x112e78,_0x18a09b){if(_0x112e78[_0xbacc('0x49')]['id']){delete _0x112e78[_0xbacc('0x49')]['id'];}return db['SquareRecording'][_0xbacc('0x47')]({'where':{'id':_0x112e78[_0xbacc('0x45')]['id']}})[_0xbacc('0x24')](handleEntityNotFound(_0x18a09b,null))[_0xbacc('0x24')](saveUpdates(_0x112e78[_0xbacc('0x49')],null))[_0xbacc('0x24')](respondWithResult(_0x18a09b,null))[_0xbacc('0x44')](handleError(_0x18a09b,null));};exports[_0xbacc('0x4b')]=function(_0x44bb93,_0x414745,_0x4a5142){var _0x1c5747=require('../../components/encryptor');var _0x3c0fad=![];var _0x54b226={};if(_0x44bb93[_0xbacc('0x32')][_0xbacc('0x2d')]&&_0x44bb93[_0xbacc('0x32')][_0xbacc('0x2d')]==='uniqueid'){_0x54b226[_0xbacc('0x4c')]=_0x44bb93[_0xbacc('0x45')]['id'];}else{_0x54b226['id']=_0x44bb93[_0xbacc('0x45')]['id'];}return db['SquareRecording'][_0xbacc('0x47')]({'where':_0x54b226,'attributes':['id',_0xbacc('0x4d'),_0xbacc('0x4e')],'raw':!![]})[_0xbacc('0x24')](handleEntityNotFound(_0x414745,null))[_0xbacc('0x24')](function(_0x180a87){if(_0x180a87){var _0x4aad2c=_0x180a87['savePath'];var _0x33ee54=util[_0xbacc('0x4f')](_0xbacc('0x50'),_0x4aad2c);if(fs[_0xbacc('0x51')](_0x33ee54)){_0x3c0fad=!![];return _0x1c5747[_0xbacc('0x52')](_0x33ee54,_0x4aad2c,config[_0xbacc('0x53')]['recording'])[_0xbacc('0x24')](function(){return _0x180a87;});}return _0x180a87;}})[_0xbacc('0x24')](function(_0x28942a){if(_0x28942a){var _0x4bff2a=_0x28942a[_0xbacc('0x4d')];if(!fs[_0xbacc('0x51')](_0x4bff2a)){throw new db[(_0xbacc('0x54'))][(_0xbacc('0x55'))](_0xbacc('0x56'));}if(_0x28942a['filename']){return _0x414745[_0xbacc('0x4b')](_0x4bff2a,_0x28942a[_0xbacc('0x4e')]+path[_0xbacc('0x57')](_0x4bff2a),function(){if(_0x3c0fad){fs['unlink'](_0x4bff2a);}});}else{return _0x414745['download'](_0x4bff2a,function(_0x4030ef){if(_0x3c0fad){fs[_0xbacc('0x58')](_0x4bff2a);}});}}})[_0xbacc('0x44')](function(_0x5ed1c0){if(_0x5ed1c0[_0xbacc('0x59')]==='SquareRecording\x20not\x20found'){_0x414745[_0xbacc('0x1a')](0x194)[_0xbacc('0x29')](_0xbacc('0x5a'));}else{return handleError(_0x414745,null);}});};exports['destroy']=function(_0x278970,_0x462019){return db['SquareRecording']['find']({'where':{'id':_0x278970['params']['id']}})[_0xbacc('0x24')](function(_0x4f793a){if(_['isNil'](_0x4f793a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4f793a;})[_0xbacc('0x24')](function(_0xb3c4ae){var _0x34d465=_0xb3c4ae[_0xbacc('0x4d')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x34d465);if(!_[_0xbacc('0x5b')](_0xb3c4ae[_0xbacc('0x4d')])&&fs[_0xbacc('0x51')](_0x34d465)){logger['info'](_0xbacc('0x5c')+_0x34d465+_0xbacc('0x5d'));fs[_0xbacc('0x5e')](_0x34d465);}_0x34d465=_0x34d465+_0xbacc('0x5f');if(!_[_0xbacc('0x5b')](_0xb3c4ae[_0xbacc('0x4d')])&&fs['existsSync'](_0x34d465)){logger[_0xbacc('0x60')](_0xbacc('0x5c')+_0x34d465+_0xbacc('0x5d'));fs[_0xbacc('0x5e')](_0x34d465);}return _0xb3c4ae;})[_0xbacc('0x24')](function(_0x4fb10e){if(!_0x4fb10e)throw new InternalError();return _0x4fb10e['destroy']();})[_0xbacc('0x24')](function(){_0x462019[_0xbacc('0x1a')](0xcc)[_0xbacc('0x1b')]();})[_0xbacc('0x44')](handleError(_0x462019,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1013209..441a8ec 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 _0x6ab9=['exports','define','SquareRecording','lodash','util','api','moment','bluebird','request-promise','path','./squareRecording.attributes'];(function(_0x2eab95,_0x4ee457){var _0x15668e=function(_0x48e0e1){while(--_0x48e0e1){_0x2eab95['push'](_0x2eab95['shift']());}};_0x15668e(++_0x4ee457);}(_0x6ab9,0x19a));var _0x96ab=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6ab9[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var logger=require('../../config/logger')(_0x96ab('0x2'));var moment=require(_0x96ab('0x3'));var BPromise=require(_0x96ab('0x4'));var rp=require(_0x96ab('0x5'));var fs=require('fs');var path=require(_0x96ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96ab('0x7'));module[_0x96ab('0x8')]=function(_0x1ce450,_0x52339d){return _0x1ce450[_0x96ab('0x9')](_0x96ab('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa848=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x2cdc90,_0x2465e2){var _0x2aff04=function(_0x4cf284){while(--_0x4cf284){_0x2cdc90['push'](_0x2cdc90['shift']());}};_0x2aff04(++_0x2465e2);}(_0xa848,0x99));var _0x8a84=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa848[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var logger=require(_0x8a84('0x2'))('api');var moment=require(_0x8a84('0x3'));var BPromise=require(_0x8a84('0x4'));var rp=require(_0x8a84('0x5'));var fs=require('fs');var path=require(_0x8a84('0x6'));var rimraf=require(_0x8a84('0x7'));var config=require(_0x8a84('0x8'));var attributes=require(_0x8a84('0x9'));module[_0x8a84('0xa')]=function(_0x13acad,_0x3ee596){return _0x13acad[_0x8a84('0xb')](_0x8a84('0xc'),attributes,{'tableName':_0x8a84('0xd'),'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 05f3b72..d4673a9 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 _0x4b27=['message','info','result','CreateSquareRecording','SquareRecording','create','options','raw','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5c6e47,_0x35d057){var _0x30aeac=function(_0x3cc9f6){while(--_0x3cc9f6){_0x5c6e47['push'](_0x5c6e47['shift']());}};_0x30aeac(++_0x35d057);}(_0x4b27,0xea));var _0x74b2=function(_0x46a59e,_0x4bf9ff){_0x46a59e=_0x46a59e-0x0;var _0x35aae0=_0x4b27[_0x46a59e];return _0x35aae0;};'use strict';var _=require(_0x74b2('0x0'));var util=require(_0x74b2('0x1'));var moment=require('moment');var BPromise=require(_0x74b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74b2('0x3'))['db'];var utils=require(_0x74b2('0x4'));var logger=require(_0x74b2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74b2('0x6'));var client=jayson[_0x74b2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32cd25,_0x2a61fe,_0x15683f){return new BPromise(function(_0x2ed7c9,_0x42ac0e){return client[_0x74b2('0x8')](_0x32cd25,_0x15683f)[_0x74b2('0x9')](function(_0x481ffa){logger['info'](_0x74b2('0xa'),_0x2a61fe,_0x74b2('0xb'));logger[_0x74b2('0xc')](_0x74b2('0xd'),_0x2a61fe,_0x74b2('0xb'),JSON['stringify'](_0x481ffa));if(_0x481ffa['error']){if(_0x481ffa[_0x74b2('0xe')][_0x74b2('0xf')]===0x1f4){logger[_0x74b2('0xe')]('SquareRecording,\x20%s,\x20%s',_0x2a61fe,_0x481ffa[_0x74b2('0xe')]['message']);return _0x42ac0e(_0x481ffa['error']['message']);}logger[_0x74b2('0xe')](_0x74b2('0xa'),_0x2a61fe,_0x481ffa['error'][_0x74b2('0x10')]);return _0x2ed7c9(_0x481ffa[_0x74b2('0xe')]['message']);}else{logger[_0x74b2('0x11')](_0x74b2('0xa'),_0x2a61fe,_0x74b2('0xb'));_0x2ed7c9(_0x481ffa[_0x74b2('0x12')][_0x74b2('0x10')]);}})['catch'](function(_0x9588e6){logger[_0x74b2('0xe')](_0x74b2('0xa'),_0x2a61fe,_0x9588e6);_0x42ac0e(_0x9588e6);});});}exports[_0x74b2('0x13')]=function(_0x2ea891){var _0x2ea123=this;return new Promise(function(_0x158659,_0xdf39dc){return db[_0x74b2('0x14')][_0x74b2('0x15')](_0x2ea891['body'],{'raw':_0x2ea891[_0x74b2('0x16')]?_0x2ea891[_0x74b2('0x16')][_0x74b2('0x17')]===undefined?!![]:![]:!![]})[_0x74b2('0x9')](function(_0x4533ed){logger['info']('CreateSquareRecording',_0x2ea891);logger[_0x74b2('0xc')](_0x74b2('0x13'),_0x2ea891,JSON[_0x74b2('0x18')](_0x4533ed));_0x158659(_0x4533ed);})['catch'](function(_0x284531){logger[_0x74b2('0xe')]('CreateSquareRecording',_0x284531[_0x74b2('0x10')],_0x2ea891);_0xdf39dc(_0x2ea123[_0x74b2('0xe')](0x1f4,_0x284531[_0x74b2('0x10')]));});});}; \ No newline at end of file +var _0x73a9=['jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateSquareRecording','create','body','options','raw','then','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x18bcaf,_0x3d27c4){var _0x174a2d=function(_0x5e024b){while(--_0x5e024b){_0x18bcaf['push'](_0x18bcaf['shift']());}};_0x174a2d(++_0x3d27c4);}(_0x73a9,0x1b8));var _0x973a=function(_0x39fdad,_0x3ea49b){_0x39fdad=_0x39fdad-0x0;var _0x35e83b=_0x73a9[_0x39fdad];return _0x35e83b;};'use strict';var _=require(_0x973a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x973a('0x1'));var rs=require(_0x973a('0x2'));var fs=require('fs');var Redis=require(_0x973a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x973a('0x4'));var logger=require(_0x973a('0x5'))(_0x973a('0x6'));var config=require(_0x973a('0x7'));var jayson=require(_0x973a('0x8'));var client=jayson[_0x973a('0x9')][_0x973a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409cbc,_0x4f5aeb,_0x1a41aa){return new BPromise(function(_0x31719d,_0x14ea3c){return client[_0x973a('0xb')](_0x409cbc,_0x1a41aa)['then'](function(_0xd9e28b){logger['info'](_0x973a('0xc'),_0x4f5aeb,_0x973a('0xd'));logger[_0x973a('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4f5aeb,_0x973a('0xd'),JSON['stringify'](_0xd9e28b));if(_0xd9e28b[_0x973a('0xf')]){if(_0xd9e28b[_0x973a('0xf')][_0x973a('0x10')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4f5aeb,_0xd9e28b[_0x973a('0xf')][_0x973a('0x11')]);return _0x14ea3c(_0xd9e28b[_0x973a('0xf')][_0x973a('0x11')]);}logger[_0x973a('0xf')]('SquareRecording,\x20%s,\x20%s',_0x4f5aeb,_0xd9e28b[_0x973a('0xf')][_0x973a('0x11')]);return _0x31719d(_0xd9e28b['error'][_0x973a('0x11')]);}else{logger[_0x973a('0x12')](_0x973a('0xc'),_0x4f5aeb,_0x973a('0xd'));_0x31719d(_0xd9e28b[_0x973a('0x13')][_0x973a('0x11')]);}})[_0x973a('0x14')](function(_0x9c9411){logger[_0x973a('0xf')](_0x973a('0xc'),_0x4f5aeb,_0x9c9411);_0x14ea3c(_0x9c9411);});});}exports[_0x973a('0x15')]=function(_0x134d88){var _0x517873=this;return new Promise(function(_0x10121f,_0x347de7){return db['SquareRecording'][_0x973a('0x16')](_0x134d88[_0x973a('0x17')],{'raw':_0x134d88[_0x973a('0x18')]?_0x134d88[_0x973a('0x18')][_0x973a('0x19')]===undefined?!![]:![]:!![]})[_0x973a('0x1a')](function(_0x2af631){logger[_0x973a('0x12')](_0x973a('0x15'),_0x134d88);logger[_0x973a('0xe')](_0x973a('0x15'),_0x134d88,JSON[_0x973a('0x1b')](_0x2af631));_0x10121f(_0x2af631);})[_0x973a('0x14')](function(_0x2c8eb8){logger[_0x973a('0xf')]('CreateSquareRecording',_0x2c8eb8[_0x973a('0x11')],_0x134d88);_0x347de7(_0x517873[_0x973a('0xf')](0x1f4,_0x2c8eb8[_0x973a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e70a392..9ceb7bb 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x23ea96,_0x87dcd6){var _0x36884a=function(_0x46f5a3){while(--_0x46f5a3){_0x23ea96['push'](_0x23ea96['shift']());}};_0x36884a(++_0x87dcd6);}(_0xe706,0xa3));var _0x6e70=function(_0x5bbf70,_0x2f58b3){_0x5bbf70=_0x5bbf70-0x0;var _0x397a54=_0xe706[_0x5bbf70];return _0x397a54;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_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['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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1796dca..b713823 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 _0xfbb4=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x208d6f,_0x576241){var _0x398bbf=function(_0x3c8084){while(--_0x3c8084){_0x208d6f['push'](_0x208d6f['shift']());}};_0x398bbf(++_0x576241);}(_0xfbb4,0xca));var _0x4fbb=function(_0x57468c,_0xb053ce){_0x57468c=_0x57468c-0x0;var _0x2cb90c=_0xfbb4[_0x57468c];return _0x2cb90c;};'use strict';var Sequelize=require(_0x4fbb('0x0'));module[_0x4fbb('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4fbb('0x2')]},'request':{'type':Sequelize[_0x4fbb('0x2')]},'channel':{'type':Sequelize[_0x4fbb('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4fbb('0x2')]},'uniqueid':{'type':Sequelize[_0x4fbb('0x2')]},'version':{'type':Sequelize[_0x4fbb('0x2')]},'callerid':{'type':Sequelize[_0x4fbb('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4fbb('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x4fbb('0x2')]},'dnid':{'type':Sequelize[_0x4fbb('0x2')]},'rdnis':{'type':Sequelize[_0x4fbb('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4fbb('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4fbb('0x2')]},'threadid':{'type':Sequelize[_0x4fbb('0x2')]},'project_name':{'type':Sequelize[_0x4fbb('0x2')]},'joinAt':{'type':Sequelize[_0x4fbb('0x3')]},'leaveAt':{'type':Sequelize[_0x4fbb('0x3')]},'bot':{'type':Sequelize[_0x4fbb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2d7a=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3af6d3,_0xd6ff2e){var _0xf0c5a8=function(_0x392c56){while(--_0x392c56){_0x3af6d3['push'](_0x3af6d3['shift']());}};_0xf0c5a8(++_0xd6ff2e);}(_0x2d7a,0x16b));var _0xa2d7=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0x2d7a[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0xa2d7('0x0'));module[_0xa2d7('0x1')]={'network':{'type':Sequelize[_0xa2d7('0x2')]},'network_script':{'type':Sequelize[_0xa2d7('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa2d7('0x2')]},'language':{'type':Sequelize[_0xa2d7('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xa2d7('0x2')]},'callerid':{'type':Sequelize[_0xa2d7('0x2')]},'calleridname':{'type':Sequelize[_0xa2d7('0x2')]},'callingpres':{'type':Sequelize[_0xa2d7('0x2')]},'callingani2':{'type':Sequelize[_0xa2d7('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xa2d7('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xa2d7('0x2')]},'context':{'type':Sequelize[_0xa2d7('0x2')]},'extension':{'type':Sequelize[_0xa2d7('0x2')]},'priority':{'type':Sequelize[_0xa2d7('0x2')]},'enhanced':{'type':Sequelize[_0xa2d7('0x2')]},'accountcode':{'type':Sequelize[_0xa2d7('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa2d7('0x3')]},'leaveAt':{'type':Sequelize[_0xa2d7('0x3')]},'bot':{'type':Sequelize[_0xa2d7('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ee95920..e183e62 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 _0xa8f9=['query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model'];(function(_0x1cad55,_0x52b9db){var _0x1f1030=function(_0xbfb043){while(--_0xbfb043){_0x1cad55['push'](_0x1cad55['shift']());}};_0x1f1030(++_0x52b9db);}(_0xa8f9,0x138));var _0x9a8f=function(_0x29ed5c,_0x10f4a5){_0x29ed5c=_0x29ed5c-0x0;var _0x19eeac=_0xa8f9[_0x29ed5c];return _0x19eeac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a8f('0x0'));var zipdir=require(_0x9a8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a8f('0x2'));var moment=require(_0x9a8f('0x3'));var BPromise=require(_0x9a8f('0x4'));var Mustache=require(_0x9a8f('0x5'));var util=require(_0x9a8f('0x6'));var path=require(_0x9a8f('0x7'));var sox=require(_0x9a8f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a8f('0x9'));var _=require(_0x9a8f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a8f('0xb'));var toCsv=require(_0x9a8f('0xc'));var querystring=require(_0x9a8f('0xd'));var Papa=require('papaparse');var Redis=require(_0x9a8f('0xe'));var authService=require(_0x9a8f('0xf'));var qs=require(_0x9a8f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a8f('0x11'))(_0x9a8f('0x12'));var utils=require(_0x9a8f('0x13'));var config=require(_0x9a8f('0x14'));var licenseUtil=require(_0x9a8f('0x15'));var db=require(_0x9a8f('0x16'))['db'];function respondWithStatusCode(_0x57db59,_0x23d4e8){_0x23d4e8=_0x23d4e8||0xcc;return function(_0x331f41){if(_0x331f41){return _0x57db59['sendStatus'](_0x23d4e8);}return _0x57db59[_0x9a8f('0x17')](_0x23d4e8)['end']();};}function respondWithResult(_0x2c3dc2,_0x18629d){_0x18629d=_0x18629d||0xc8;return function(_0x745cba){if(_0x745cba){return _0x2c3dc2[_0x9a8f('0x17')](_0x18629d)[_0x9a8f('0x18')](_0x745cba);}};}function respondWithFilteredResult(_0x2fcdf0,_0x1dc70d){return function(_0x3d89c6){if(_0x3d89c6){var _0x20d927=typeof _0x1dc70d[_0x9a8f('0x19')]===_0x9a8f('0x1a')&&typeof _0x1dc70d[_0x9a8f('0x1b')]==='undefined';var _0x565cff=_0x3d89c6[_0x9a8f('0x1c')];var _0x5d6f58=_0x20d927?0x0:_0x1dc70d['offset'];var _0x50b1c2=_0x20d927?_0x3d89c6[_0x9a8f('0x1c')]:_0x1dc70d['offset']+_0x1dc70d[_0x9a8f('0x1b')];var _0x3d5c1a;if(_0x50b1c2>=_0x565cff){_0x50b1c2=_0x565cff;_0x3d5c1a=0xc8;}else{_0x3d5c1a=0xce;}_0x2fcdf0['status'](_0x3d5c1a);return _0x2fcdf0[_0x9a8f('0x1d')](_0x9a8f('0x1e'),_0x5d6f58+'-'+_0x50b1c2+'/'+_0x565cff)['json'](_0x3d89c6);}return null;};}function patchUpdates(_0x3babbb){return function(_0x53f947){try{jsonpatch[_0x9a8f('0x1f')](_0x53f947,_0x3babbb,!![]);}catch(_0x5cee4c){return BPromise[_0x9a8f('0x20')](_0x5cee4c);}return _0x53f947[_0x9a8f('0x21')]();};}function saveUpdates(_0x2c8b0c,_0x13f79c){return function(_0x433fd5){if(_0x433fd5){return _0x433fd5[_0x9a8f('0x22')](_0x2c8b0c)[_0x9a8f('0x23')](function(_0x4722d2){return _0x4722d2;});}return null;};}function removeEntity(_0x504df9,_0x166a9b){return function(_0x412db7){if(_0x412db7){return _0x412db7[_0x9a8f('0x24')]()[_0x9a8f('0x23')](function(){_0x504df9[_0x9a8f('0x17')](0xcc)[_0x9a8f('0x25')]();});}};}function handleEntityNotFound(_0x5c7e20,_0x4bbb30){return function(_0x507119){if(!_0x507119){_0x5c7e20['sendStatus'](0x194);}return _0x507119;};}function handleError(_0x3e1433,_0x19caf6){_0x19caf6=_0x19caf6||0x1f4;return function(_0x3bf696){logger[_0x9a8f('0x26')](_0x3bf696['stack']);if(_0x3bf696['name']){delete _0x3bf696[_0x9a8f('0x27')];}_0x3e1433[_0x9a8f('0x17')](_0x19caf6)['send'](_0x3bf696);};}exports[_0x9a8f('0x28')]=function(_0x114cd8,_0x2cbbb3){var _0x12bb7d={},_0x23d6bb={},_0x857dbf={'count':0x0,'rows':[]};var _0x6df45=_[_0x9a8f('0x29')](db[_0x9a8f('0x2a')][_0x9a8f('0x2b')],function(_0x1fa8da){return{'name':_0x1fa8da[_0x9a8f('0x2c')],'type':_0x1fa8da[_0x9a8f('0x2d')][_0x9a8f('0x2e')]};});_0x23d6bb[_0x9a8f('0x2f')]=_[_0x9a8f('0x29')](_0x6df45,_0x9a8f('0x27'));_0x23d6bb[_0x9a8f('0x30')]=_['keys'](_0x114cd8['query']);_0x23d6bb[_0x9a8f('0x31')]=_[_0x9a8f('0x32')](_0x23d6bb['model'],_0x23d6bb[_0x9a8f('0x30')]);_0x12bb7d['attributes']=_['intersection'](_0x23d6bb[_0x9a8f('0x2f')],qs[_0x9a8f('0x33')](_0x114cd8[_0x9a8f('0x30')][_0x9a8f('0x33')]));_0x12bb7d['attributes']=_0x12bb7d[_0x9a8f('0x34')][_0x9a8f('0x35')]?_0x12bb7d[_0x9a8f('0x34')]:_0x23d6bb[_0x9a8f('0x2f')];if(!_0x114cd8[_0x9a8f('0x30')]['hasOwnProperty'](_0x9a8f('0x36'))){_0x12bb7d[_0x9a8f('0x1b')]=qs['limit'](_0x114cd8['query'][_0x9a8f('0x1b')]);_0x12bb7d[_0x9a8f('0x19')]=qs['offset'](_0x114cd8['query']['offset']);}_0x12bb7d['order']=qs[_0x9a8f('0x37')](_0x114cd8[_0x9a8f('0x30')][_0x9a8f('0x37')]);_0x12bb7d[_0x9a8f('0x38')]=qs['filters'](_[_0x9a8f('0x39')](_0x114cd8[_0x9a8f('0x30')],_0x23d6bb['filters']),_0x6df45);if(_0x114cd8[_0x9a8f('0x30')][_0x9a8f('0x3a')]){_0x12bb7d['where']=_[_0x9a8f('0x3b')](_0x12bb7d[_0x9a8f('0x38')],{'$or':_[_0x9a8f('0x29')](_0x6df45,function(_0x443b4c){if(_0x443b4c[_0x9a8f('0x2d')]!=='VIRTUAL'){var _0xb8e231={};_0xb8e231[_0x443b4c[_0x9a8f('0x27')]]={'$like':'%'+_0x114cd8[_0x9a8f('0x30')][_0x9a8f('0x3a')]+'%'};return _0xb8e231;}})});}_0x12bb7d=_['merge']({},_0x12bb7d,_0x114cd8['options']);var _0x2c58f9={'where':_0x12bb7d[_0x9a8f('0x38')]};return db['SquareReport']['count'](_0x2c58f9)[_0x9a8f('0x23')](function(_0x39e024){_0x857dbf[_0x9a8f('0x1c')]=_0x39e024;if(_0x114cd8[_0x9a8f('0x30')]['includeAll']){_0x12bb7d[_0x9a8f('0x3c')]=[{'all':!![]}];}return db['SquareReport'][_0x9a8f('0x3d')](_0x12bb7d);})['then'](function(_0x58a615){_0x857dbf[_0x9a8f('0x3e')]=_0x58a615;return _0x857dbf;})['then'](respondWithFilteredResult(_0x2cbbb3,_0x12bb7d))[_0x9a8f('0x3f')](handleError(_0x2cbbb3,null));};exports['show']=function(_0x30b567,_0x4a8596){var _0x3fc74f={'raw':!![],'where':{'id':_0x30b567[_0x9a8f('0x40')]['id']}},_0x47ebfd={};_0x47ebfd['model']=_[_0x9a8f('0x41')](db[_0x9a8f('0x2a')]['rawAttributes']);_0x47ebfd['query']=_[_0x9a8f('0x41')](_0x30b567[_0x9a8f('0x30')]);_0x47ebfd[_0x9a8f('0x31')]=_[_0x9a8f('0x32')](_0x47ebfd[_0x9a8f('0x2f')],_0x47ebfd[_0x9a8f('0x30')]);_0x3fc74f[_0x9a8f('0x34')]=_['intersection'](_0x47ebfd['model'],qs['fields'](_0x30b567[_0x9a8f('0x30')]['fields']));_0x3fc74f[_0x9a8f('0x34')]=_0x3fc74f[_0x9a8f('0x34')][_0x9a8f('0x35')]?_0x3fc74f[_0x9a8f('0x34')]:_0x47ebfd['model'];if(_0x30b567[_0x9a8f('0x30')][_0x9a8f('0x42')]){_0x3fc74f[_0x9a8f('0x3c')]=[{'all':!![]}];}_0x3fc74f=_[_0x9a8f('0x3b')]({},_0x3fc74f,_0x30b567[_0x9a8f('0x43')]);return db[_0x9a8f('0x2a')][_0x9a8f('0x44')](_0x3fc74f)[_0x9a8f('0x23')](handleEntityNotFound(_0x4a8596,null))[_0x9a8f('0x23')](respondWithResult(_0x4a8596,null))[_0x9a8f('0x3f')](handleError(_0x4a8596,null));};exports[_0x9a8f('0x45')]=function(_0x45968b,_0x3dd7d2){return db[_0x9a8f('0x2a')][_0x9a8f('0x45')](_0x45968b[_0x9a8f('0x46')],{})[_0x9a8f('0x23')](respondWithResult(_0x3dd7d2,0xc9))['catch'](handleError(_0x3dd7d2,null));};exports['update']=function(_0x230e78,_0x50984a){if(_0x230e78['body']['id']){delete _0x230e78[_0x9a8f('0x46')]['id'];}return db[_0x9a8f('0x2a')][_0x9a8f('0x44')]({'where':{'id':_0x230e78[_0x9a8f('0x40')]['id']}})[_0x9a8f('0x23')](handleEntityNotFound(_0x50984a,null))[_0x9a8f('0x23')](saveUpdates(_0x230e78[_0x9a8f('0x46')],null))[_0x9a8f('0x23')](respondWithResult(_0x50984a,null))['catch'](handleError(_0x50984a,null));};exports['destroy']=function(_0x57bccc,_0x3a4294){return db[_0x9a8f('0x2a')][_0x9a8f('0x44')]({'where':{'id':_0x57bccc[_0x9a8f('0x40')]['id']}})[_0x9a8f('0x23')](handleEntityNotFound(_0x3a4294,null))[_0x9a8f('0x23')](removeEntity(_0x3a4294,null))[_0x9a8f('0x3f')](handleError(_0x3a4294,null));};exports[_0x9a8f('0x47')]=function(_0x4f77ae,_0x482107){return db[_0x9a8f('0x2a')][_0x9a8f('0x47')]()['then'](respondWithResult(_0x482107,null))[_0x9a8f('0x3f')](handleError(_0x482107,null));}; \ No newline at end of file +var _0x8e1c=['undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','catch','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit'];(function(_0x3a4721,_0x40b144){var _0x4ed712=function(_0x42cf89){while(--_0x42cf89){_0x3a4721['push'](_0x3a4721['shift']());}};_0x4ed712(++_0x40b144);}(_0x8e1c,0xc1));var _0xc8e1=function(_0x387b2f,_0x29cd46){_0x387b2f=_0x387b2f-0x0;var _0x158b27=_0x8e1c[_0x387b2f];return _0x158b27;};'use strict';var emlformat=require(_0xc8e1('0x0'));var rimraf=require(_0xc8e1('0x1'));var zipdir=require(_0xc8e1('0x2'));var jsonpatch=require(_0xc8e1('0x3'));var rp=require(_0xc8e1('0x4'));var moment=require(_0xc8e1('0x5'));var BPromise=require(_0xc8e1('0x6'));var Mustache=require('mustache');var util=require(_0xc8e1('0x7'));var path=require('path');var sox=require(_0xc8e1('0x8'));var csv=require(_0xc8e1('0x9'));var ejs=require(_0xc8e1('0xa'));var fs=require('fs');var fs_extra=require(_0xc8e1('0xb'));var _=require(_0xc8e1('0xc'));var squel=require('squel');var crypto=require(_0xc8e1('0xd'));var jsforce=require(_0xc8e1('0xe'));var deskjs=require(_0xc8e1('0xf'));var toCsv=require(_0xc8e1('0x9'));var querystring=require(_0xc8e1('0x10'));var Papa=require(_0xc8e1('0x11'));var Redis=require(_0xc8e1('0x12'));var authService=require(_0xc8e1('0x13'));var qs=require(_0xc8e1('0x14'));var as=require(_0xc8e1('0x15'));var hardwareService=require(_0xc8e1('0x16'));var logger=require(_0xc8e1('0x17'))(_0xc8e1('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc8e1('0x19'));var db=require(_0xc8e1('0x1a'))['db'];function respondWithStatusCode(_0x569861,_0x2eec2b){_0x2eec2b=_0x2eec2b||0xcc;return function(_0x241695){if(_0x241695){return _0x569861['sendStatus'](_0x2eec2b);}return _0x569861[_0xc8e1('0x1b')](_0x2eec2b)[_0xc8e1('0x1c')]();};}function respondWithResult(_0x1fc36e,_0x304d40){_0x304d40=_0x304d40||0xc8;return function(_0x33af80){if(_0x33af80){return _0x1fc36e['status'](_0x304d40)[_0xc8e1('0x1d')](_0x33af80);}};}function respondWithFilteredResult(_0x39b190,_0x51c517){return function(_0x2e46c6){if(_0x2e46c6){var _0x5704b0=typeof _0x51c517[_0xc8e1('0x1e')]==='undefined'&&typeof _0x51c517[_0xc8e1('0x1f')]===_0xc8e1('0x20');var _0x551bb8=_0x2e46c6['count'];var _0x12a7a6=_0x5704b0?0x0:_0x51c517[_0xc8e1('0x1e')];var _0x1251be=_0x5704b0?_0x2e46c6[_0xc8e1('0x21')]:_0x51c517[_0xc8e1('0x1e')]+_0x51c517['limit'];var _0x4ddc84;if(_0x1251be>=_0x551bb8){_0x1251be=_0x551bb8;_0x4ddc84=0xc8;}else{_0x4ddc84=0xce;}_0x39b190[_0xc8e1('0x1b')](_0x4ddc84);return _0x39b190[_0xc8e1('0x22')](_0xc8e1('0x23'),_0x12a7a6+'-'+_0x1251be+'/'+_0x551bb8)[_0xc8e1('0x1d')](_0x2e46c6);}return null;};}function patchUpdates(_0x37f2e2){return function(_0x2a2687){try{jsonpatch[_0xc8e1('0x24')](_0x2a2687,_0x37f2e2,!![]);}catch(_0x17aa78){return BPromise['reject'](_0x17aa78);}return _0x2a2687[_0xc8e1('0x25')]();};}function saveUpdates(_0x3b53f0,_0x49a4dd){return function(_0x3eb0d2){if(_0x3eb0d2){return _0x3eb0d2[_0xc8e1('0x26')](_0x3b53f0)[_0xc8e1('0x27')](function(_0x2c9536){return _0x2c9536;});}return null;};}function removeEntity(_0x362587,_0x5420e1){return function(_0x19978f){if(_0x19978f){return _0x19978f[_0xc8e1('0x28')]()[_0xc8e1('0x27')](function(){_0x362587['status'](0xcc)[_0xc8e1('0x1c')]();});}};}function handleEntityNotFound(_0x2e9d4f,_0x1ee1e6){return function(_0x2dc4bf){if(!_0x2dc4bf){_0x2e9d4f[_0xc8e1('0x29')](0x194);}return _0x2dc4bf;};}function handleError(_0x3c6002,_0x127ab9){_0x127ab9=_0x127ab9||0x1f4;return function(_0x4331bc){logger[_0xc8e1('0x2a')](_0x4331bc[_0xc8e1('0x2b')]);if(_0x4331bc[_0xc8e1('0x2c')]){delete _0x4331bc[_0xc8e1('0x2c')];}_0x3c6002[_0xc8e1('0x1b')](_0x127ab9)[_0xc8e1('0x2d')](_0x4331bc);};}exports[_0xc8e1('0x2e')]=function(_0x438fc2,_0x311859){var _0x56a2d7={},_0x5c74da={},_0x39d9f2={'count':0x0,'rows':[]};var _0x197e6f=_[_0xc8e1('0x2f')](db[_0xc8e1('0x30')]['rawAttributes'],function(_0x36105e){return{'name':_0x36105e[_0xc8e1('0x31')],'type':_0x36105e[_0xc8e1('0x32')][_0xc8e1('0x33')]};});_0x5c74da['model']=_['map'](_0x197e6f,_0xc8e1('0x2c'));_0x5c74da[_0xc8e1('0x34')]=_[_0xc8e1('0x35')](_0x438fc2[_0xc8e1('0x34')]);_0x5c74da[_0xc8e1('0x36')]=_[_0xc8e1('0x37')](_0x5c74da['model'],_0x5c74da[_0xc8e1('0x34')]);_0x56a2d7[_0xc8e1('0x38')]=_[_0xc8e1('0x37')](_0x5c74da[_0xc8e1('0x39')],qs['fields'](_0x438fc2[_0xc8e1('0x34')]['fields']));_0x56a2d7[_0xc8e1('0x38')]=_0x56a2d7[_0xc8e1('0x38')]['length']?_0x56a2d7[_0xc8e1('0x38')]:_0x5c74da[_0xc8e1('0x39')];if(!_0x438fc2['query']['hasOwnProperty'](_0xc8e1('0x3a'))){_0x56a2d7[_0xc8e1('0x1f')]=qs[_0xc8e1('0x1f')](_0x438fc2['query'][_0xc8e1('0x1f')]);_0x56a2d7[_0xc8e1('0x1e')]=qs[_0xc8e1('0x1e')](_0x438fc2[_0xc8e1('0x34')][_0xc8e1('0x1e')]);}_0x56a2d7[_0xc8e1('0x3b')]=qs[_0xc8e1('0x3c')](_0x438fc2['query'][_0xc8e1('0x3c')]);_0x56a2d7['where']=qs[_0xc8e1('0x36')](_['pick'](_0x438fc2[_0xc8e1('0x34')],_0x5c74da[_0xc8e1('0x36')]),_0x197e6f);if(_0x438fc2[_0xc8e1('0x34')][_0xc8e1('0x3d')]){_0x56a2d7[_0xc8e1('0x3e')]=_[_0xc8e1('0x3f')](_0x56a2d7[_0xc8e1('0x3e')],{'$or':_[_0xc8e1('0x2f')](_0x197e6f,function(_0x2cec35){if(_0x2cec35[_0xc8e1('0x32')]!=='VIRTUAL'){var _0x2fa1d3={};_0x2fa1d3[_0x2cec35[_0xc8e1('0x2c')]]={'$like':'%'+_0x438fc2[_0xc8e1('0x34')]['filter']+'%'};return _0x2fa1d3;}})});}_0x56a2d7=_[_0xc8e1('0x3f')]({},_0x56a2d7,_0x438fc2[_0xc8e1('0x40')]);var _0x16418f={'where':_0x56a2d7[_0xc8e1('0x3e')]};return db[_0xc8e1('0x30')][_0xc8e1('0x21')](_0x16418f)[_0xc8e1('0x27')](function(_0x38a30d){_0x39d9f2[_0xc8e1('0x21')]=_0x38a30d;if(_0x438fc2['query'][_0xc8e1('0x41')]){_0x56a2d7[_0xc8e1('0x42')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x56a2d7);})[_0xc8e1('0x27')](function(_0x52ee02){_0x39d9f2[_0xc8e1('0x43')]=_0x52ee02;return _0x39d9f2;})[_0xc8e1('0x27')](respondWithFilteredResult(_0x311859,_0x56a2d7))[_0xc8e1('0x44')](handleError(_0x311859,null));};exports['show']=function(_0x59a2f7,_0x3a9409){var _0x4269ee={'raw':!![],'where':{'id':_0x59a2f7[_0xc8e1('0x45')]['id']}},_0x25c2bf={};_0x25c2bf[_0xc8e1('0x39')]=_['keys'](db[_0xc8e1('0x30')]['rawAttributes']);_0x25c2bf[_0xc8e1('0x34')]=_[_0xc8e1('0x35')](_0x59a2f7['query']);_0x25c2bf[_0xc8e1('0x36')]=_['intersection'](_0x25c2bf[_0xc8e1('0x39')],_0x25c2bf[_0xc8e1('0x34')]);_0x4269ee[_0xc8e1('0x38')]=_[_0xc8e1('0x37')](_0x25c2bf[_0xc8e1('0x39')],qs['fields'](_0x59a2f7[_0xc8e1('0x34')][_0xc8e1('0x46')]));_0x4269ee['attributes']=_0x4269ee[_0xc8e1('0x38')]['length']?_0x4269ee[_0xc8e1('0x38')]:_0x25c2bf[_0xc8e1('0x39')];if(_0x59a2f7['query'][_0xc8e1('0x41')]){_0x4269ee[_0xc8e1('0x42')]=[{'all':!![]}];}_0x4269ee=_[_0xc8e1('0x3f')]({},_0x4269ee,_0x59a2f7[_0xc8e1('0x40')]);return db[_0xc8e1('0x30')][_0xc8e1('0x47')](_0x4269ee)[_0xc8e1('0x27')](handleEntityNotFound(_0x3a9409,null))[_0xc8e1('0x27')](respondWithResult(_0x3a9409,null))[_0xc8e1('0x44')](handleError(_0x3a9409,null));};exports[_0xc8e1('0x48')]=function(_0x52043d,_0x38aa60){return db[_0xc8e1('0x30')][_0xc8e1('0x48')](_0x52043d[_0xc8e1('0x49')],{})[_0xc8e1('0x27')](respondWithResult(_0x38aa60,0xc9))[_0xc8e1('0x44')](handleError(_0x38aa60,null));};exports['update']=function(_0x34b782,_0x5f27d3){if(_0x34b782['body']['id']){delete _0x34b782[_0xc8e1('0x49')]['id'];}return db['SquareReport'][_0xc8e1('0x47')]({'where':{'id':_0x34b782['params']['id']}})[_0xc8e1('0x27')](handleEntityNotFound(_0x5f27d3,null))[_0xc8e1('0x27')](saveUpdates(_0x34b782[_0xc8e1('0x49')],null))[_0xc8e1('0x27')](respondWithResult(_0x5f27d3,null))[_0xc8e1('0x44')](handleError(_0x5f27d3,null));};exports[_0xc8e1('0x28')]=function(_0x40cf55,_0x560593){return db['SquareReport']['find']({'where':{'id':_0x40cf55[_0xc8e1('0x45')]['id']}})[_0xc8e1('0x27')](handleEntityNotFound(_0x560593,null))[_0xc8e1('0x27')](removeEntity(_0x560593,null))[_0xc8e1('0x44')](handleError(_0x560593,null));};exports[_0xc8e1('0x4a')]=function(_0x3b7a99,_0x17ac49){return db['SquareReport']['describe']()['then'](respondWithResult(_0x17ac49,null))['catch'](handleError(_0x17ac49,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e44603f..76ef983 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 _0x6bf1=['uid_pname','uniqueid','leaveAt','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square'];(function(_0x3a5dec,_0x51a52a){var _0x58c843=function(_0x575c25){while(--_0x575c25){_0x3a5dec['push'](_0x3a5dec['shift']());}};_0x58c843(++_0x51a52a);}(_0x6bf1,0x81));var _0x16bf=function(_0xc61ea8,_0x56e451){_0xc61ea8=_0xc61ea8-0x0;var _0x22c845=_0x6bf1[_0xc61ea8];return _0x22c845;};'use strict';var _=require('lodash');var util=require(_0x16bf('0x0'));var logger=require('../../config/logger')(_0x16bf('0x1'));var moment=require(_0x16bf('0x2'));var BPromise=require(_0x16bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16bf('0x4'));var rimraf=require(_0x16bf('0x5'));var config=require(_0x16bf('0x6'));var attributes=require(_0x16bf('0x7'));module[_0x16bf('0x8')]=function(_0x31a04b,_0x402ecb){return _0x31a04b['define'](_0x16bf('0x9'),attributes,{'tableName':_0x16bf('0xa'),'paranoid':![],'indexes':[{'name':_0x16bf('0xb'),'fields':[_0x16bf('0xc'),'project_name']},{'name':'leaveAt','fields':[_0x16bf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a31=['project_name','leaveAt','util','../../config/logger','moment','request-promise','path','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0x7a31,0x12d));var _0x17a3=function(_0x522262,_0x21da83){_0x522262=_0x522262-0x0;var _0x5bed1c=_0x7a31[_0x522262];return _0x5bed1c;};'use strict';var _=require('lodash');var util=require(_0x17a3('0x0'));var logger=require(_0x17a3('0x1'))('api');var moment=require(_0x17a3('0x2'));var BPromise=require('bluebird');var rp=require(_0x17a3('0x3'));var fs=require('fs');var path=require(_0x17a3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17a3('0x5'));module[_0x17a3('0x6')]=function(_0x280161,_0x461410){return _0x280161['define'](_0x17a3('0x7'),attributes,{'tableName':_0x17a3('0x8'),'paranoid':![],'indexes':[{'name':_0x17a3('0x9'),'fields':[_0x17a3('0xa'),_0x17a3('0xb')]},{'name':_0x17a3('0xc'),'fields':[_0x17a3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index da57eff..2406f52 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 _0x4097=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','SquareReport','create','options','CreateSquareReport','catch','update','body','raw','where','attributes','limit','UpdateSquareReport'];(function(_0x5e0741,_0x4f05ce){var _0x33b46c=function(_0x52f293){while(--_0x52f293){_0x5e0741['push'](_0x5e0741['shift']());}};_0x33b46c(++_0x4f05ce);}(_0x4097,0x198));var _0x7409=function(_0x5a1b2a,_0x149d63){_0x5a1b2a=_0x5a1b2a-0x0;var _0x40641c=_0x4097[_0x5a1b2a];return _0x40641c;};'use strict';var _=require(_0x7409('0x0'));var util=require(_0x7409('0x1'));var moment=require(_0x7409('0x2'));var BPromise=require('bluebird');var rs=require(_0x7409('0x3'));var fs=require('fs');var Redis=require(_0x7409('0x4'));var db=require(_0x7409('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7409('0x6'))(_0x7409('0x7'));var config=require(_0x7409('0x8'));var jayson=require(_0x7409('0x9'));var client=jayson[_0x7409('0xa')][_0x7409('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x293340,_0x5010cc,_0x4344a4){return new BPromise(function(_0xfe42e4,_0xf437ba){return client['request'](_0x293340,_0x4344a4)[_0x7409('0xc')](function(_0x424559){logger[_0x7409('0xd')]('SquareReport,\x20%s,\x20%s',_0x5010cc,_0x7409('0xe'));logger[_0x7409('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5010cc,_0x7409('0xe'),JSON[_0x7409('0x10')](_0x424559));if(_0x424559[_0x7409('0x11')]){if(_0x424559[_0x7409('0x11')][_0x7409('0x12')]===0x1f4){logger[_0x7409('0x11')]('SquareReport,\x20%s,\x20%s',_0x5010cc,_0x424559[_0x7409('0x11')][_0x7409('0x13')]);return _0xf437ba(_0x424559[_0x7409('0x11')]['message']);}logger[_0x7409('0x11')](_0x7409('0x14'),_0x5010cc,_0x424559[_0x7409('0x11')][_0x7409('0x13')]);return _0xfe42e4(_0x424559[_0x7409('0x11')][_0x7409('0x13')]);}else{logger[_0x7409('0xd')]('SquareReport,\x20%s,\x20%s',_0x5010cc,_0x7409('0xe'));_0xfe42e4(_0x424559[_0x7409('0x15')][_0x7409('0x13')]);}})['catch'](function(_0x314474){logger['error'](_0x7409('0x14'),_0x5010cc,_0x314474);_0xf437ba(_0x314474);});});}exports['CreateSquareReport']=function(_0x504331){var _0xafb3b7=this;return new Promise(function(_0x165a27,_0x39c6ec){return db[_0x7409('0x16')][_0x7409('0x17')](_0x504331['body'],{'raw':_0x504331[_0x7409('0x18')]?_0x504331[_0x7409('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x7409('0xc')](function(_0x405299){logger[_0x7409('0xd')](_0x7409('0x19'),_0x504331);logger[_0x7409('0xf')]('CreateSquareReport',_0x504331,JSON[_0x7409('0x10')](_0x405299));_0x165a27(_0x405299);})[_0x7409('0x1a')](function(_0x24082b){logger[_0x7409('0x11')](_0x7409('0x19'),_0x24082b[_0x7409('0x13')],_0x504331);_0x39c6ec(_0xafb3b7[_0x7409('0x11')](0x1f4,_0x24082b[_0x7409('0x13')]));});});};exports['UpdateSquareReport']=function(_0x56fe9b){var _0x1e2162=this;return new Promise(function(_0x5703cd,_0x2389a0){return db[_0x7409('0x16')][_0x7409('0x1b')](_0x56fe9b[_0x7409('0x1c')],{'raw':_0x56fe9b[_0x7409('0x18')]?_0x56fe9b[_0x7409('0x18')][_0x7409('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56fe9b[_0x7409('0x18')]?_0x56fe9b[_0x7409('0x18')][_0x7409('0x1e')]||null:null,'attributes':_0x56fe9b[_0x7409('0x18')]?_0x56fe9b[_0x7409('0x18')][_0x7409('0x1f')]||null:null,'limit':_0x56fe9b[_0x7409('0x18')]?_0x56fe9b[_0x7409('0x18')][_0x7409('0x20')]||null:null})[_0x7409('0xc')](function(_0x1f7070){logger['info']('UpdateSquareReport',_0x56fe9b);logger[_0x7409('0xf')]('UpdateSquareReport',_0x56fe9b,JSON['stringify'](_0x1f7070));_0x5703cd(_0x1f7070);})[_0x7409('0x1a')](function(_0x2b2233){logger[_0x7409('0x11')](_0x7409('0x21'),_0x2b2233[_0x7409('0x13')],_0x56fe9b);_0x2389a0(_0x1e2162[_0x7409('0x11')](0x1f4,_0x2b2233[_0x7409('0x13')]));});});}; \ No newline at end of file +var _0xfea0=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','options','raw','then','UpdateSquareReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x12704e,_0x543352){var _0x3f451f=function(_0x412163){while(--_0x412163){_0x12704e['push'](_0x12704e['shift']());}};_0x3f451f(++_0x543352);}(_0xfea0,0x14e));var _0x0fea=function(_0x1689b5,_0x2510a3){_0x1689b5=_0x1689b5-0x0;var _0x23ead8=_0xfea0[_0x1689b5];return _0x23ead8;};'use strict';var _=require(_0x0fea('0x0'));var util=require(_0x0fea('0x1'));var moment=require(_0x0fea('0x2'));var BPromise=require(_0x0fea('0x3'));var rs=require(_0x0fea('0x4'));var fs=require('fs');var Redis=require(_0x0fea('0x5'));var db=require(_0x0fea('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fea('0x7'));var config=require('../../config/environment');var jayson=require(_0x0fea('0x8'));var client=jayson['client'][_0x0fea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24fc2a,_0x5c1837,_0x31d62c){return new BPromise(function(_0x11c7cb,_0x14e84e){return client[_0x0fea('0xa')](_0x24fc2a,_0x31d62c)['then'](function(_0x53b060){logger[_0x0fea('0xb')]('SquareReport,\x20%s,\x20%s',_0x5c1837,_0x0fea('0xc'));logger[_0x0fea('0xd')](_0x0fea('0xe'),_0x5c1837,'request\x20sent',JSON[_0x0fea('0xf')](_0x53b060));if(_0x53b060[_0x0fea('0x10')]){if(_0x53b060[_0x0fea('0x10')]['code']===0x1f4){logger[_0x0fea('0x10')](_0x0fea('0x11'),_0x5c1837,_0x53b060['error'][_0x0fea('0x12')]);return _0x14e84e(_0x53b060['error'][_0x0fea('0x12')]);}logger['error'](_0x0fea('0x11'),_0x5c1837,_0x53b060[_0x0fea('0x10')]['message']);return _0x11c7cb(_0x53b060['error'][_0x0fea('0x12')]);}else{logger[_0x0fea('0xb')](_0x0fea('0x11'),_0x5c1837,_0x0fea('0xc'));_0x11c7cb(_0x53b060['result'][_0x0fea('0x12')]);}})[_0x0fea('0x13')](function(_0x13d3a1){logger[_0x0fea('0x10')](_0x0fea('0x11'),_0x5c1837,_0x13d3a1);_0x14e84e(_0x13d3a1);});});}exports[_0x0fea('0x14')]=function(_0x42e402){var _0x1e60e8=this;return new Promise(function(_0x2f3856,_0x5e0a2a){return db['SquareReport']['create'](_0x42e402['body'],{'raw':_0x42e402[_0x0fea('0x15')]?_0x42e402[_0x0fea('0x15')][_0x0fea('0x16')]===undefined?!![]:![]:!![]})[_0x0fea('0x17')](function(_0x3a20b6){logger[_0x0fea('0xb')](_0x0fea('0x14'),_0x42e402);logger[_0x0fea('0xd')](_0x0fea('0x14'),_0x42e402,JSON[_0x0fea('0xf')](_0x3a20b6));_0x2f3856(_0x3a20b6);})['catch'](function(_0x3b0f0b){logger['error'](_0x0fea('0x14'),_0x3b0f0b[_0x0fea('0x12')],_0x42e402);_0x5e0a2a(_0x1e60e8['error'](0x1f4,_0x3b0f0b['message']));});});};exports[_0x0fea('0x18')]=function(_0x210d63){var _0x3b94fb=this;return new Promise(function(_0x2249f5,_0x1ac38d){return db['SquareReport'][_0x0fea('0x19')](_0x210d63[_0x0fea('0x1a')],{'raw':_0x210d63[_0x0fea('0x15')]?_0x210d63['options'][_0x0fea('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x210d63['options']?_0x210d63[_0x0fea('0x15')][_0x0fea('0x1b')]||null:null,'attributes':_0x210d63['options']?_0x210d63[_0x0fea('0x15')][_0x0fea('0x1c')]||null:null,'limit':_0x210d63[_0x0fea('0x15')]?_0x210d63[_0x0fea('0x15')]['limit']||null:null})[_0x0fea('0x17')](function(_0x3a04ad){logger['info'](_0x0fea('0x18'),_0x210d63);logger[_0x0fea('0xd')](_0x0fea('0x18'),_0x210d63,JSON['stringify'](_0x3a04ad));_0x2249f5(_0x3a04ad);})['catch'](function(_0x3f4991){logger[_0x0fea('0x10')](_0x0fea('0x18'),_0x3f4991[_0x0fea('0x12')],_0x210d63);_0x1ac38d(_0x3b94fb[_0x0fea('0x10')](0x1f4,_0x3f4991[_0x0fea('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5b8d4dc..692e321 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 _0xcefe=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xcefe,0x170));var _0xecef=function(_0x2e9f72,_0x36480c){_0x2e9f72=_0x2e9f72-0x0;var _0x4b1a98=_0xcefe[_0x2e9f72];return _0x4b1a98;};'use strict';var multer=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var path=require('path');var timeout=require(_0xecef('0x2'));var express=require('express');var router=express[_0xecef('0x3')]();var fs_extra=require(_0xecef('0x4'));var auth=require(_0xecef('0x5'));var interaction=require(_0xecef('0x6'));var config=require('../../config/environment');var controller=require(_0xecef('0x7'));router[_0xecef('0x8')]('/',auth[_0xecef('0x9')](),controller[_0xecef('0xa')]);router['get'](_0xecef('0xb'),auth[_0xecef('0x9')](),controller['describe']);router[_0xecef('0x8')](_0xecef('0xc'),auth[_0xecef('0x9')](),controller[_0xecef('0xd')]);router[_0xecef('0xe')]('/',auth[_0xecef('0x9')](),controller['create']);router[_0xecef('0xf')]('/:id',auth[_0xecef('0x9')](),controller[_0xecef('0x10')]);router[_0xecef('0x11')](_0xecef('0xc'),auth[_0xecef('0x9')](),controller[_0xecef('0x12')]);module[_0xecef('0x13')]=router; \ No newline at end of file +var _0x0777=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x177fb2,_0x5886a1){var _0x1f790e=function(_0x38984e){while(--_0x38984e){_0x177fb2['push'](_0x177fb2['shift']());}};_0x1f790e(++_0x5886a1);}(_0x0777,0x99));var _0x7077=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x0777[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x7077('0x0'));var util=require(_0x7077('0x1'));var path=require(_0x7077('0x2'));var timeout=require(_0x7077('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7077('0x4'));var auth=require(_0x7077('0x5'));var interaction=require(_0x7077('0x6'));var config=require(_0x7077('0x7'));var controller=require(_0x7077('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7077('0x9')]);router[_0x7077('0xa')](_0x7077('0xb'),auth[_0x7077('0xc')](),controller[_0x7077('0xd')]);router[_0x7077('0xa')](_0x7077('0xe'),auth[_0x7077('0xc')](),controller[_0x7077('0xf')]);router[_0x7077('0x10')]('/',auth[_0x7077('0xc')](),controller[_0x7077('0x11')]);router['put'](_0x7077('0xe'),auth[_0x7077('0xc')](),controller[_0x7077('0x12')]);router[_0x7077('0x13')]('/:id',auth[_0x7077('0xc')](),controller[_0x7077('0x14')]);module[_0x7077('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index d99fcd3..6c48444 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 _0xbde2=['STRING','TEXT','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbde2,0x7a));var _0x2bde=function(_0x2ba378,_0x2e2734){_0x2ba378=_0x2ba378-0x0;var _0x5817be=_0xbde2[_0x2ba378];return _0x5817be;};'use strict';var Sequelize=require('sequelize');module[_0x2bde('0x0')]={'uniqueid':{'type':Sequelize[_0x2bde('0x1')]},'node':{'type':Sequelize[_0x2bde('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2bde('0x2')]},'project_name':{'type':Sequelize[_0x2bde('0x1')]},'callerid':{'type':Sequelize[_0x2bde('0x1')]}}; \ No newline at end of file +var _0xd3e5=['sequelize','exports','STRING','TEXT'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xd3e5,0x118));var _0x5d3e=function(_0x185444,_0xf87c6c){_0x185444=_0x185444-0x0;var _0x4fa1d0=_0xd3e5[_0x185444];return _0x4fa1d0;};'use strict';var Sequelize=require(_0x5d3e('0x0'));module[_0x5d3e('0x1')]={'uniqueid':{'type':Sequelize[_0x5d3e('0x2')]},'node':{'type':Sequelize[_0x5d3e('0x2')]},'application':{'type':Sequelize[_0x5d3e('0x2')]},'data':{'type':Sequelize[_0x5d3e('0x3')]},'project_name':{'type':Sequelize[_0x5d3e('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index af1e0ee..743508d 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 _0x6578=['findAll','catch','keys','intersection','length','merge','find','create','body','update','params','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include'];(function(_0x490e61,_0x7f848e){var _0x169bc6=function(_0x1c70bf){while(--_0x1c70bf){_0x490e61['push'](_0x490e61['shift']());}};_0x169bc6(++_0x7f848e);}(_0x6578,0xa4));var _0x8657=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x6578[_0x466af7];return _0x348c96;};'use strict';var emlformat=require(_0x8657('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8657('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8657('0x2'));var BPromise=require(_0x8657('0x3'));var Mustache=require(_0x8657('0x4'));var util=require(_0x8657('0x5'));var path=require('path');var sox=require(_0x8657('0x6'));var csv=require('to-csv');var ejs=require(_0x8657('0x7'));var fs=require('fs');var fs_extra=require(_0x8657('0x8'));var _=require(_0x8657('0x9'));var squel=require(_0x8657('0xa'));var crypto=require('crypto');var jsforce=require(_0x8657('0xb'));var deskjs=require(_0x8657('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8657('0xd'));var Papa=require(_0x8657('0xe'));var Redis=require(_0x8657('0xf'));var authService=require(_0x8657('0x10'));var qs=require(_0x8657('0x11'));var as=require(_0x8657('0x12'));var hardwareService=require(_0x8657('0x13'));var logger=require(_0x8657('0x14'))(_0x8657('0x15'));var utils=require(_0x8657('0x16'));var config=require(_0x8657('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8657('0x18'))['db'];function respondWithStatusCode(_0x416548,_0x20ca73){_0x20ca73=_0x20ca73||0xcc;return function(_0x223304){if(_0x223304){return _0x416548[_0x8657('0x19')](_0x20ca73);}return _0x416548[_0x8657('0x1a')](_0x20ca73)[_0x8657('0x1b')]();};}function respondWithResult(_0x3200b3,_0x52b73e){_0x52b73e=_0x52b73e||0xc8;return function(_0x26fb98){if(_0x26fb98){return _0x3200b3['status'](_0x52b73e)[_0x8657('0x1c')](_0x26fb98);}};}function respondWithFilteredResult(_0xd6966e,_0x3c30fb){return function(_0x5e17a2){if(_0x5e17a2){var _0x530f48=typeof _0x3c30fb[_0x8657('0x1d')]===_0x8657('0x1e')&&typeof _0x3c30fb[_0x8657('0x1f')]===_0x8657('0x1e');var _0x3dc5ec=_0x5e17a2[_0x8657('0x20')];var _0x5c5997=_0x530f48?0x0:_0x3c30fb[_0x8657('0x1d')];var _0xd7da9a=_0x530f48?_0x5e17a2[_0x8657('0x20')]:_0x3c30fb['offset']+_0x3c30fb[_0x8657('0x1f')];var _0x1a838d;if(_0xd7da9a>=_0x3dc5ec){_0xd7da9a=_0x3dc5ec;_0x1a838d=0xc8;}else{_0x1a838d=0xce;}_0xd6966e[_0x8657('0x1a')](_0x1a838d);return _0xd6966e[_0x8657('0x21')]('Content-Range',_0x5c5997+'-'+_0xd7da9a+'/'+_0x3dc5ec)[_0x8657('0x1c')](_0x5e17a2);}return null;};}function patchUpdates(_0x370f1a){return function(_0x3ac094){try{jsonpatch[_0x8657('0x22')](_0x3ac094,_0x370f1a,!![]);}catch(_0x50e147){return BPromise[_0x8657('0x23')](_0x50e147);}return _0x3ac094[_0x8657('0x24')]();};}function saveUpdates(_0x1c24ff,_0x166adc){return function(_0x2c25e6){if(_0x2c25e6){return _0x2c25e6['update'](_0x1c24ff)[_0x8657('0x25')](function(_0x4589aa){return _0x4589aa;});}return null;};}function removeEntity(_0x277a70,_0x24a003){return function(_0x2506a9){if(_0x2506a9){return _0x2506a9[_0x8657('0x26')]()[_0x8657('0x25')](function(){_0x277a70['status'](0xcc)[_0x8657('0x1b')]();});}};}function handleEntityNotFound(_0x524782,_0x102fb5){return function(_0x3a491e){if(!_0x3a491e){_0x524782[_0x8657('0x19')](0x194);}return _0x3a491e;};}function handleError(_0x5a2dad,_0x4623f3){_0x4623f3=_0x4623f3||0x1f4;return function(_0x37482d){logger['error'](_0x37482d[_0x8657('0x27')]);if(_0x37482d[_0x8657('0x28')]){delete _0x37482d[_0x8657('0x28')];}_0x5a2dad[_0x8657('0x1a')](_0x4623f3)[_0x8657('0x29')](_0x37482d);};}exports['index']=function(_0x48abab,_0x4bb46d){var _0x35b331={},_0x559709={},_0x304fc9={'count':0x0,'rows':[]};var _0x4669db=_['map'](db[_0x8657('0x2a')][_0x8657('0x2b')],function(_0x59a5c6){return{'name':_0x59a5c6[_0x8657('0x2c')],'type':_0x59a5c6['type'][_0x8657('0x2d')]};});_0x559709[_0x8657('0x2e')]=_[_0x8657('0x2f')](_0x4669db,_0x8657('0x28'));_0x559709[_0x8657('0x30')]=_['keys'](_0x48abab[_0x8657('0x30')]);_0x559709[_0x8657('0x31')]=_['intersection'](_0x559709[_0x8657('0x2e')],_0x559709['query']);_0x35b331[_0x8657('0x32')]=_['intersection'](_0x559709[_0x8657('0x2e')],qs[_0x8657('0x33')](_0x48abab[_0x8657('0x30')][_0x8657('0x33')]));_0x35b331[_0x8657('0x32')]=_0x35b331[_0x8657('0x32')]['length']?_0x35b331['attributes']:_0x559709['model'];if(!_0x48abab[_0x8657('0x30')][_0x8657('0x34')](_0x8657('0x35'))){_0x35b331[_0x8657('0x1f')]=qs[_0x8657('0x1f')](_0x48abab[_0x8657('0x30')]['limit']);_0x35b331[_0x8657('0x1d')]=qs[_0x8657('0x1d')](_0x48abab[_0x8657('0x30')]['offset']);}_0x35b331[_0x8657('0x36')]=qs[_0x8657('0x37')](_0x48abab['query'][_0x8657('0x37')]);_0x35b331[_0x8657('0x38')]=qs[_0x8657('0x31')](_[_0x8657('0x39')](_0x48abab[_0x8657('0x30')],_0x559709['filters']),_0x4669db);if(_0x48abab[_0x8657('0x30')][_0x8657('0x3a')]){_0x35b331[_0x8657('0x38')]=_['merge'](_0x35b331['where'],{'$or':_[_0x8657('0x2f')](_0x4669db,function(_0x181ecd){if(_0x181ecd[_0x8657('0x3b')]!==_0x8657('0x3c')){var _0x1ab7f1={};_0x1ab7f1[_0x181ecd[_0x8657('0x28')]]={'$like':'%'+_0x48abab['query']['filter']+'%'};return _0x1ab7f1;}})});}_0x35b331=_['merge']({},_0x35b331,_0x48abab[_0x8657('0x3d')]);var _0xae09f6={'where':_0x35b331['where']};return db[_0x8657('0x2a')][_0x8657('0x20')](_0xae09f6)[_0x8657('0x25')](function(_0x18ef6c){_0x304fc9[_0x8657('0x20')]=_0x18ef6c;if(_0x48abab['query'][_0x8657('0x3e')]){_0x35b331[_0x8657('0x3f')]=[{'all':!![]}];}return db[_0x8657('0x2a')][_0x8657('0x40')](_0x35b331);})[_0x8657('0x25')](function(_0x407fdb){_0x304fc9['rows']=_0x407fdb;return _0x304fc9;})[_0x8657('0x25')](respondWithFilteredResult(_0x4bb46d,_0x35b331))[_0x8657('0x41')](handleError(_0x4bb46d,null));};exports['show']=function(_0x20c295,_0x1b47ed){var _0x2b0e21={'raw':!![],'where':{'id':_0x20c295['params']['id']}},_0x3629db={};_0x3629db['model']=_[_0x8657('0x42')](db[_0x8657('0x2a')]['rawAttributes']);_0x3629db[_0x8657('0x30')]=_[_0x8657('0x42')](_0x20c295['query']);_0x3629db[_0x8657('0x31')]=_[_0x8657('0x43')](_0x3629db[_0x8657('0x2e')],_0x3629db['query']);_0x2b0e21[_0x8657('0x32')]=_[_0x8657('0x43')](_0x3629db[_0x8657('0x2e')],qs[_0x8657('0x33')](_0x20c295['query'][_0x8657('0x33')]));_0x2b0e21[_0x8657('0x32')]=_0x2b0e21[_0x8657('0x32')][_0x8657('0x44')]?_0x2b0e21[_0x8657('0x32')]:_0x3629db['model'];if(_0x20c295['query'][_0x8657('0x3e')]){_0x2b0e21[_0x8657('0x3f')]=[{'all':!![]}];}_0x2b0e21=_[_0x8657('0x45')]({},_0x2b0e21,_0x20c295['options']);return db[_0x8657('0x2a')][_0x8657('0x46')](_0x2b0e21)[_0x8657('0x25')](handleEntityNotFound(_0x1b47ed,null))[_0x8657('0x25')](respondWithResult(_0x1b47ed,null))[_0x8657('0x41')](handleError(_0x1b47ed,null));};exports[_0x8657('0x47')]=function(_0x142202,_0x443b18){return db[_0x8657('0x2a')][_0x8657('0x47')](_0x142202[_0x8657('0x48')],{})[_0x8657('0x25')](respondWithResult(_0x443b18,0xc9))[_0x8657('0x41')](handleError(_0x443b18,null));};exports[_0x8657('0x49')]=function(_0x1911c5,_0x55a52c){if(_0x1911c5[_0x8657('0x48')]['id']){delete _0x1911c5['body']['id'];}return db[_0x8657('0x2a')][_0x8657('0x46')]({'where':{'id':_0x1911c5[_0x8657('0x4a')]['id']}})[_0x8657('0x25')](handleEntityNotFound(_0x55a52c,null))['then'](saveUpdates(_0x1911c5[_0x8657('0x48')],null))['then'](respondWithResult(_0x55a52c,null))[_0x8657('0x41')](handleError(_0x55a52c,null));};exports[_0x8657('0x26')]=function(_0x15fdc7,_0xf9f40b){return db[_0x8657('0x2a')][_0x8657('0x46')]({'where':{'id':_0x15fdc7[_0x8657('0x4a')]['id']}})[_0x8657('0x25')](handleEntityNotFound(_0xf9f40b,null))[_0x8657('0x25')](removeEntity(_0xf9f40b,null))[_0x8657('0x41')](handleError(_0xf9f40b,null));};exports[_0x8657('0x4b')]=function(_0x38e0e2,_0x406dde){return db[_0x8657('0x2a')][_0x8657('0x4b')]()[_0x8657('0x25')](respondWithResult(_0x406dde,null))[_0x8657('0x41')](handleError(_0x406dde,null));}; \ No newline at end of file +var _0x9565=['keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','filter','options','SquareDetailsReport','then','includeAll','include','findAll','show','params','merge','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','status','end','json','offset','undefined','limit','count','set','apply','reject','update','sendStatus','error','stack','name','index','rawAttributes','fieldName','key','model','map'];(function(_0x59b79f,_0x53c506){var _0x8dc132=function(_0x10d53b){while(--_0x10d53b){_0x59b79f['push'](_0x59b79f['shift']());}};_0x8dc132(++_0x53c506);}(_0x9565,0x6a));var _0x5956=function(_0x19ca39,_0x1c1b72){_0x19ca39=_0x19ca39-0x0;var _0xb03b15=_0x9565[_0x19ca39];return _0xb03b15;};'use strict';var emlformat=require(_0x5956('0x0'));var rimraf=require(_0x5956('0x1'));var zipdir=require(_0x5956('0x2'));var jsonpatch=require(_0x5956('0x3'));var rp=require(_0x5956('0x4'));var moment=require(_0x5956('0x5'));var BPromise=require(_0x5956('0x6'));var Mustache=require(_0x5956('0x7'));var util=require('util');var path=require(_0x5956('0x8'));var sox=require(_0x5956('0x9'));var csv=require('to-csv');var ejs=require(_0x5956('0xa'));var fs=require('fs');var fs_extra=require(_0x5956('0xb'));var _=require(_0x5956('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5956('0xd'));var deskjs=require(_0x5956('0xe'));var toCsv=require(_0x5956('0xf'));var querystring=require(_0x5956('0x10'));var Papa=require(_0x5956('0x11'));var Redis=require(_0x5956('0x12'));var authService=require(_0x5956('0x13'));var qs=require(_0x5956('0x14'));var as=require(_0x5956('0x15'));var hardwareService=require(_0x5956('0x16'));var logger=require(_0x5956('0x17'))(_0x5956('0x18'));var utils=require(_0x5956('0x19'));var config=require(_0x5956('0x1a'));var licenseUtil=require(_0x5956('0x1b'));var db=require(_0x5956('0x1c'))['db'];function respondWithStatusCode(_0x561015,_0x551569){_0x551569=_0x551569||0xcc;return function(_0x395dbb){if(_0x395dbb){return _0x561015['sendStatus'](_0x551569);}return _0x561015[_0x5956('0x1d')](_0x551569)[_0x5956('0x1e')]();};}function respondWithResult(_0x3f579a,_0x5d928a){_0x5d928a=_0x5d928a||0xc8;return function(_0x5d22f2){if(_0x5d22f2){return _0x3f579a[_0x5956('0x1d')](_0x5d928a)[_0x5956('0x1f')](_0x5d22f2);}};}function respondWithFilteredResult(_0x549571,_0x32d411){return function(_0x33ff3b){if(_0x33ff3b){var _0x1052b7=typeof _0x32d411[_0x5956('0x20')]===_0x5956('0x21')&&typeof _0x32d411[_0x5956('0x22')]===_0x5956('0x21');var _0x227ec1=_0x33ff3b[_0x5956('0x23')];var _0x3ed0db=_0x1052b7?0x0:_0x32d411[_0x5956('0x20')];var _0x5aacac=_0x1052b7?_0x33ff3b['count']:_0x32d411[_0x5956('0x20')]+_0x32d411[_0x5956('0x22')];var _0x1c78f7;if(_0x5aacac>=_0x227ec1){_0x5aacac=_0x227ec1;_0x1c78f7=0xc8;}else{_0x1c78f7=0xce;}_0x549571[_0x5956('0x1d')](_0x1c78f7);return _0x549571[_0x5956('0x24')]('Content-Range',_0x3ed0db+'-'+_0x5aacac+'/'+_0x227ec1)[_0x5956('0x1f')](_0x33ff3b);}return null;};}function patchUpdates(_0x2cfad6){return function(_0x4dcf15){try{jsonpatch[_0x5956('0x25')](_0x4dcf15,_0x2cfad6,!![]);}catch(_0x58c55c){return BPromise[_0x5956('0x26')](_0x58c55c);}return _0x4dcf15['save']();};}function saveUpdates(_0x53c18f,_0x57493a){return function(_0x3957c2){if(_0x3957c2){return _0x3957c2[_0x5956('0x27')](_0x53c18f)['then'](function(_0x35472e){return _0x35472e;});}return null;};}function removeEntity(_0x3960c5,_0x37056e){return function(_0x2daef5){if(_0x2daef5){return _0x2daef5['destroy']()['then'](function(){_0x3960c5[_0x5956('0x1d')](0xcc)[_0x5956('0x1e')]();});}};}function handleEntityNotFound(_0x1fde13,_0x316006){return function(_0x5f00ef){if(!_0x5f00ef){_0x1fde13[_0x5956('0x28')](0x194);}return _0x5f00ef;};}function handleError(_0x11b37e,_0x2cc2ae){_0x2cc2ae=_0x2cc2ae||0x1f4;return function(_0x873956){logger[_0x5956('0x29')](_0x873956[_0x5956('0x2a')]);if(_0x873956[_0x5956('0x2b')]){delete _0x873956[_0x5956('0x2b')];}_0x11b37e[_0x5956('0x1d')](_0x2cc2ae)['send'](_0x873956);};}exports[_0x5956('0x2c')]=function(_0x1b55b0,_0x1f96aa){var _0x5bf4d9={},_0x6b42cf={},_0x2ceb36={'count':0x0,'rows':[]};var _0x982282=_['map'](db['SquareDetailsReport'][_0x5956('0x2d')],function(_0x6d9fb2){return{'name':_0x6d9fb2[_0x5956('0x2e')],'type':_0x6d9fb2['type'][_0x5956('0x2f')]};});_0x6b42cf[_0x5956('0x30')]=_[_0x5956('0x31')](_0x982282,_0x5956('0x2b'));_0x6b42cf['query']=_[_0x5956('0x32')](_0x1b55b0[_0x5956('0x33')]);_0x6b42cf['filters']=_['intersection'](_0x6b42cf[_0x5956('0x30')],_0x6b42cf['query']);_0x5bf4d9[_0x5956('0x34')]=_['intersection'](_0x6b42cf[_0x5956('0x30')],qs[_0x5956('0x35')](_0x1b55b0[_0x5956('0x33')][_0x5956('0x35')]));_0x5bf4d9['attributes']=_0x5bf4d9['attributes'][_0x5956('0x36')]?_0x5bf4d9['attributes']:_0x6b42cf[_0x5956('0x30')];if(!_0x1b55b0['query'][_0x5956('0x37')](_0x5956('0x38'))){_0x5bf4d9[_0x5956('0x22')]=qs[_0x5956('0x22')](_0x1b55b0['query'][_0x5956('0x22')]);_0x5bf4d9['offset']=qs['offset'](_0x1b55b0[_0x5956('0x33')][_0x5956('0x20')]);}_0x5bf4d9[_0x5956('0x39')]=qs[_0x5956('0x3a')](_0x1b55b0[_0x5956('0x33')][_0x5956('0x3a')]);_0x5bf4d9['where']=qs[_0x5956('0x3b')](_[_0x5956('0x3c')](_0x1b55b0[_0x5956('0x33')],_0x6b42cf['filters']),_0x982282);if(_0x1b55b0[_0x5956('0x33')]['filter']){_0x5bf4d9[_0x5956('0x3d')]=_['merge'](_0x5bf4d9[_0x5956('0x3d')],{'$or':_[_0x5956('0x31')](_0x982282,function(_0x323216){if(_0x323216[_0x5956('0x3e')]!=='VIRTUAL'){var _0x2ace36={};_0x2ace36[_0x323216['name']]={'$like':'%'+_0x1b55b0['query'][_0x5956('0x3f')]+'%'};return _0x2ace36;}})});}_0x5bf4d9=_['merge']({},_0x5bf4d9,_0x1b55b0[_0x5956('0x40')]);var _0x29b8fb={'where':_0x5bf4d9[_0x5956('0x3d')]};return db[_0x5956('0x41')][_0x5956('0x23')](_0x29b8fb)[_0x5956('0x42')](function(_0x29e48b){_0x2ceb36[_0x5956('0x23')]=_0x29e48b;if(_0x1b55b0[_0x5956('0x33')][_0x5956('0x43')]){_0x5bf4d9[_0x5956('0x44')]=[{'all':!![]}];}return db[_0x5956('0x41')][_0x5956('0x45')](_0x5bf4d9);})[_0x5956('0x42')](function(_0x18084d){_0x2ceb36['rows']=_0x18084d;return _0x2ceb36;})['then'](respondWithFilteredResult(_0x1f96aa,_0x5bf4d9))['catch'](handleError(_0x1f96aa,null));};exports[_0x5956('0x46')]=function(_0x24f59d,_0x5d61d2){var _0x22dd84={'raw':!![],'where':{'id':_0x24f59d[_0x5956('0x47')]['id']}},_0x561ebf={};_0x561ebf['model']=_[_0x5956('0x32')](db[_0x5956('0x41')]['rawAttributes']);_0x561ebf[_0x5956('0x33')]=_['keys'](_0x24f59d['query']);_0x561ebf['filters']=_['intersection'](_0x561ebf[_0x5956('0x30')],_0x561ebf[_0x5956('0x33')]);_0x22dd84[_0x5956('0x34')]=_['intersection'](_0x561ebf['model'],qs[_0x5956('0x35')](_0x24f59d[_0x5956('0x33')]['fields']));_0x22dd84['attributes']=_0x22dd84['attributes']['length']?_0x22dd84[_0x5956('0x34')]:_0x561ebf[_0x5956('0x30')];if(_0x24f59d[_0x5956('0x33')][_0x5956('0x43')]){_0x22dd84[_0x5956('0x44')]=[{'all':!![]}];}_0x22dd84=_[_0x5956('0x48')]({},_0x22dd84,_0x24f59d['options']);return db[_0x5956('0x41')][_0x5956('0x49')](_0x22dd84)[_0x5956('0x42')](handleEntityNotFound(_0x5d61d2,null))[_0x5956('0x42')](respondWithResult(_0x5d61d2,null))['catch'](handleError(_0x5d61d2,null));};exports[_0x5956('0x4a')]=function(_0x416c6c,_0x4f36a7){return db[_0x5956('0x41')][_0x5956('0x4a')](_0x416c6c[_0x5956('0x4b')],{})[_0x5956('0x42')](respondWithResult(_0x4f36a7,0xc9))[_0x5956('0x4c')](handleError(_0x4f36a7,null));};exports['update']=function(_0x2820e5,_0xa3b480){if(_0x2820e5[_0x5956('0x4b')]['id']){delete _0x2820e5['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x2820e5[_0x5956('0x47')]['id']}})[_0x5956('0x42')](handleEntityNotFound(_0xa3b480,null))['then'](saveUpdates(_0x2820e5[_0x5956('0x4b')],null))['then'](respondWithResult(_0xa3b480,null))[_0x5956('0x4c')](handleError(_0xa3b480,null));};exports['destroy']=function(_0x5be850,_0x4ecf67){return db[_0x5956('0x41')][_0x5956('0x49')]({'where':{'id':_0x5be850[_0x5956('0x47')]['id']}})[_0x5956('0x42')](handleEntityNotFound(_0x4ecf67,null))[_0x5956('0x42')](removeEntity(_0x4ecf67,null))[_0x5956('0x4c')](handleError(_0x4ecf67,null));};exports[_0x5956('0x4d')]=function(_0x494b80,_0x5d341a){return db[_0x5956('0x41')][_0x5956('0x4d')]()[_0x5956('0x42')](respondWithResult(_0x5d341a,null))['catch'](handleError(_0x5d341a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index efacbb0..d7a1a75 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 _0x6b7a=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1cd9c3,_0x2e9f58){var _0x33591e=function(_0xdc1395){while(--_0xdc1395){_0x1cd9c3['push'](_0x1cd9c3['shift']());}};_0x33591e(++_0x2e9f58);}(_0x6b7a,0xa2));var _0xa6b7=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x6b7a[_0x2defb5];return _0x229c53;};'use strict';var _=require(_0xa6b7('0x0'));var util=require(_0xa6b7('0x1'));var logger=require(_0xa6b7('0x2'))('api');var moment=require(_0xa6b7('0x3'));var BPromise=require(_0xa6b7('0x4'));var rp=require(_0xa6b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6b7('0x6'));var config=require(_0xa6b7('0x7'));var attributes=require(_0xa6b7('0x8'));module[_0xa6b7('0x9')]=function(_0x15383f,_0xf37e8c){return _0x15383f['define'](_0xa6b7('0xa'),attributes,{'tableName':_0xa6b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3cf=['bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','../../config/logger'];(function(_0x983791,_0x126b45){var _0x372884=function(_0x1c3a76){while(--_0x1c3a76){_0x983791['push'](_0x983791['shift']());}};_0x372884(++_0x126b45);}(_0xc3cf,0x1ac));var _0xfc3c=function(_0x22a995,_0x4e2cc3){_0x22a995=_0x22a995-0x0;var _0x22d9a9=_0xc3cf[_0x22a995];return _0x22d9a9;};'use strict';var _=require('lodash');var util=require(_0xfc3c('0x0'));var logger=require(_0xfc3c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfc3c('0x2'));var rp=require(_0xfc3c('0x3'));var fs=require('fs');var path=require(_0xfc3c('0x4'));var rimraf=require('rimraf');var config=require(_0xfc3c('0x5'));var attributes=require(_0xfc3c('0x6'));module['exports']=function(_0x4c0ba6,_0x48a440){return _0x4c0ba6[_0xfc3c('0x7')](_0xfc3c('0x8'),attributes,{'tableName':_0xfc3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 69e7a92..88cb169 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 _0x5eb8=['CreateSquareDetailsReport','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','SquareDetailsReport','create','body','options','raw','then'];(function(_0x9dedb1,_0x36c21b){var _0x5bf097=function(_0x4607a1){while(--_0x4607a1){_0x9dedb1['push'](_0x9dedb1['shift']());}};_0x5bf097(++_0x36c21b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x5eb8[_0x221b8c];return _0x3fab9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateSquareDetailsReport']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateSquareDetailsReport',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});}; \ No newline at end of file +var _0xa149=['result','catch','CreateSquareDetailsReport','create','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x268202,_0x4ff2ff){var _0x1847aa=function(_0x23ac03){while(--_0x23ac03){_0x268202['push'](_0x268202['shift']());}};_0x1847aa(++_0x4ff2ff);}(_0xa149,0x18c));var _0x9a14=function(_0x5309ee,_0x4f419c){_0x5309ee=_0x5309ee-0x0;var _0x361873=_0xa149[_0x5309ee];return _0x361873;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3beb93,_0x286760,_0x17d2e5){return new BPromise(function(_0x109f69,_0x26efc5){return client['request'](_0x3beb93,_0x17d2e5)[_0x9a14('0xc')](function(_0x4bdd6c){logger[_0x9a14('0xd')](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));logger[_0x9a14('0x10')](_0x9a14('0x11'),_0x286760,_0x9a14('0xf'),JSON['stringify'](_0x4bdd6c));if(_0x4bdd6c['error']){if(_0x4bdd6c['error']['code']===0x1f4){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x4bdd6c['error'][_0x9a14('0x13')]);return _0x26efc5(_0x4bdd6c['error'][_0x9a14('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x286760,_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);return _0x109f69(_0x4bdd6c[_0x9a14('0x12')][_0x9a14('0x13')]);}else{logger['info'](_0x9a14('0xe'),_0x286760,_0x9a14('0xf'));_0x109f69(_0x4bdd6c[_0x9a14('0x14')][_0x9a14('0x13')]);}})[_0x9a14('0x15')](function(_0x5b3a7a){logger[_0x9a14('0x12')](_0x9a14('0xe'),_0x286760,_0x5b3a7a);_0x26efc5(_0x5b3a7a);});});}exports[_0x9a14('0x16')]=function(_0x3aa654){var _0x38be44=this;return new Promise(function(_0x55a283,_0x5287e6){return db['SquareDetailsReport'][_0x9a14('0x17')](_0x3aa654['body'],{'raw':_0x3aa654[_0x9a14('0x18')]?_0x3aa654[_0x9a14('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53e151){logger['info'](_0x9a14('0x16'),_0x3aa654);logger[_0x9a14('0x10')](_0x9a14('0x16'),_0x3aa654,JSON[_0x9a14('0x19')](_0x53e151));_0x55a283(_0x53e151);})[_0x9a14('0x15')](function(_0xc78dd7){logger[_0x9a14('0x12')]('CreateSquareDetailsReport',_0xc78dd7['message'],_0x3aa654);_0x5287e6(_0x38be44[_0x9a14('0x12')](0x1f4,_0xc78dd7[_0x9a14('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3b787ff..ed35582 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 _0x7eb1=['express','isAuthenticated','index','get','killProcess'];(function(_0x2e19ac,_0x5ee48a){var _0x29d578=function(_0x436f90){while(--_0x436f90){_0x2e19ac['push'](_0x2e19ac['shift']());}};_0x29d578(++_0x5ee48a);}(_0x7eb1,0x1bd));var _0x17eb=function(_0x22c50e,_0x4ea131){_0x22c50e=_0x22c50e-0x0;var _0x500f85=_0x7eb1[_0x22c50e];return _0x500f85;};'use strict';var express=require(_0x17eb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x17eb('0x1')](),controller[_0x17eb('0x2')]);router[_0x17eb('0x3')]('/process/:pid/kill',auth[_0x17eb('0x1')](),controller[_0x17eb('0x4')]);module['exports']=router; \ No newline at end of file +var _0x9267=['Router','../../components/auth/service','get','isAuthenticated','index','exports','express'];(function(_0x1a3bd2,_0x344d4a){var _0x4222e6=function(_0x4a20c8){while(--_0x4a20c8){_0x1a3bd2['push'](_0x1a3bd2['shift']());}};_0x4222e6(++_0x344d4a);}(_0x9267,0x110));var _0x7926=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0x9267[_0x1df79c];return _0x2f23e4;};'use strict';var express=require(_0x7926('0x0'));var router=express[_0x7926('0x1')]();var auth=require(_0x7926('0x2'));var controller=require('./system.controller');router[_0x7926('0x3')]('/',auth[_0x7926('0x4')](),controller[_0x7926('0x5')]);router['get']('/process/:pid/kill',auth[_0x7926('0x4')](),controller['killProcess']);module[_0x7926('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 86e5e1b..f36055c 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 _0xa912=['child_process','exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xa912,0xbc));var _0x2a91=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xa912[_0x1b2ff7];return _0x31656a;};'use strict';var info=require(_0x2a91('0x0'));var exec=require(_0x2a91('0x1'))[_0x2a91('0x2')];var logger=require('../../config/logger')(_0x2a91('0x3'));var util=require('util');var BPromise=require(_0x2a91('0x4'));var _=require(_0x2a91('0x5'));function handleError(_0x3d3b29,_0xf7ad2,_0x35ae66){_0xf7ad2=_0xf7ad2||0x1f4;return function(_0x477f94){logger[_0x2a91('0x6')](_0x2a91('0x7'),_0x35ae66,_0xf7ad2,util[_0x2a91('0x8')](_0x477f94,{'showHidden':![],'depth':null}));delete _0x477f94['name'];_0x3d3b29[_0x2a91('0x9')](_0xf7ad2)[_0x2a91('0xa')](_0x477f94);};}exports[_0x2a91('0xb')]=function(_0x8300b3,_0x2a0320){return info['getAllData']()[_0x2a91('0xc')](function(_0x2be902){return _0x2a0320[_0x2a91('0x9')](0xc8)['json'](_0x2be902);})[_0x2a91('0xd')](function(_0x3564e0){return _0x2a0320['status'](0x1f4)[_0x2a91('0xe')](_0x3564e0);});};exports[_0x2a91('0xf')]=function(_0xa1583a,_0x392eaa){var _0x5ecddd=[_0x2a91('0x10')];return new BPromise(function(_0x5197bb,_0x1f85f2){return exec(util[_0x2a91('0x11')](_0x2a91('0x12'),_0xa1583a[_0x2a91('0x13')][_0x2a91('0x14')]),function(_0x2dee78,_0x3131b1,_0x4a6ab3){if(_0x2dee78){return _0x1f85f2(_0x2dee78);}return _0x5197bb(_0x3131b1);});})[_0x2a91('0xc')](function(_0x421f1a){var _0x5a4ee3=![];var _0xd1564f=_0x421f1a['split'](/\n/);for(var _0xf7f111=0x0,_0x596ed8=_0x5ecddd[_0x2a91('0x15')];_0xf7f111<_0x596ed8,_0x5a4ee3===![];_0xf7f111+=0x1){if(_0x421f1a[_0x2a91('0x16')](_0x5ecddd[_0xf7f111])>=0x0){_0x5a4ee3=!![];}}if(!_0x5a4ee3){throw new Error(util[_0x2a91('0x11')](_0x2a91('0x17'),_0xa1583a[_0x2a91('0x13')]['pid']));}process[_0x2a91('0x18')](_0xa1583a[_0x2a91('0x13')][_0x2a91('0x14')],_0x2a91('0x19'));return _0x392eaa['status'](0xc8)[_0x2a91('0xe')]({'message':util['format'](_0x2a91('0x1a'),_0xa1583a[_0x2a91('0x13')][_0x2a91('0x14')])});})['catch'](handleError(_0x392eaa,null,_0x2a91('0xf')));}; \ No newline at end of file +var _0x789d=['exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process'];(function(_0x1af77d,_0x1a44b1){var _0x21ce9b=function(_0xc03128){while(--_0xc03128){_0x1af77d['push'](_0x1af77d['shift']());}};_0x21ce9b(++_0x1a44b1);}(_0x789d,0x8a));var _0xd789=function(_0x11b482,_0x2fe90b){_0x11b482=_0x11b482-0x0;var _0x1c5b13=_0x789d[_0x11b482];return _0x1c5b13;};'use strict';var info=require(_0xd789('0x0'));var exec=require(_0xd789('0x1'))[_0xd789('0x2')];var logger=require('../../config/logger')(_0xd789('0x3'));var util=require(_0xd789('0x4'));var BPromise=require(_0xd789('0x5'));var _=require(_0xd789('0x6'));function handleError(_0x20481a,_0x179ae7,_0x3c5085){_0x179ae7=_0x179ae7||0x1f4;return function(_0x5e7373){logger[_0xd789('0x7')](_0xd789('0x8'),_0x3c5085,_0x179ae7,util['inspect'](_0x5e7373,{'showHidden':![],'depth':null}));delete _0x5e7373['name'];_0x20481a[_0xd789('0x9')](_0x179ae7)['send'](_0x5e7373);};}exports[_0xd789('0xa')]=function(_0x1e853a,_0x2a7539){return info[_0xd789('0xb')]()[_0xd789('0xc')](function(_0x155106){return _0x2a7539[_0xd789('0x9')](0xc8)[_0xd789('0xd')](_0x155106);})['catch'](function(_0x153018){return _0x2a7539[_0xd789('0x9')](0x1f4)[_0xd789('0xd')](_0x153018);});};exports[_0xd789('0xe')]=function(_0x9809de,_0x104955){var _0x26f906=[_0xd789('0xf')];return new BPromise(function(_0x3948a9,_0xb04fbb){return exec(util[_0xd789('0x10')](_0xd789('0x11'),_0x9809de[_0xd789('0x12')][_0xd789('0x13')]),function(_0x93a47a,_0x4d86ac,_0x50f427){if(_0x93a47a){return _0xb04fbb(_0x93a47a);}return _0x3948a9(_0x4d86ac);});})['then'](function(_0x38bf35){var _0x19459e=![];var _0xc70f3d=_0x38bf35[_0xd789('0x14')](/\n/);for(var _0x128160=0x0,_0x1b7c1c=_0x26f906[_0xd789('0x15')];_0x128160<_0x1b7c1c,_0x19459e===![];_0x128160+=0x1){if(_0x38bf35[_0xd789('0x16')](_0x26f906[_0x128160])>=0x0){_0x19459e=!![];}}if(!_0x19459e){throw new Error(util[_0xd789('0x10')](_0xd789('0x17'),_0x9809de['params'][_0xd789('0x13')]));}process[_0xd789('0x18')](_0x9809de['params']['pid'],_0xd789('0x19'));return _0x104955[_0xd789('0x9')](0xc8)[_0xd789('0xd')]({'message':util[_0xd789('0x10')](_0xd789('0x1a'),_0x9809de[_0xd789('0x12')][_0xd789('0x13')])});})[_0xd789('0x1b')](handleError(_0x104955,null,_0xd789('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 479687d..42317bb 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 _0xc2c7=['post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x4856a1,_0x17875f){var _0x2ad4e7=function(_0x30e216){while(--_0x30e216){_0x4856a1['push'](_0x4856a1['shift']());}};_0x2ad4e7(++_0x17875f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3586bf,_0x20a161){_0x3586bf=_0x3586bf-0x0;var _0x19bf54=_0xc2c7[_0x3586bf];return _0x19bf54;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0xc')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router[_0x7c2c('0xe')]('/:id',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x10')](_0x7c2c('0x11'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _0x00a4=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x77bccf,_0x49b71d){var _0x382762=function(_0x38d21c){while(--_0x38d21c){_0x77bccf['push'](_0x77bccf['shift']());}};_0x382762(++_0x49b71d);}(_0x00a4,0x186));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x400a('0x0'));var util=require(_0x400a('0x1'));var path=require(_0x400a('0x2'));var timeout=require(_0x400a('0x3'));var express=require(_0x400a('0x4'));var router=express['Router']();var fs_extra=require(_0x400a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x400a('0x6'));var config=require(_0x400a('0x7'));var controller=require('./tag.controller');router[_0x400a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x400a('0x8')](_0x400a('0x9'),auth[_0x400a('0xa')](),controller[_0x400a('0xb')]);router[_0x400a('0xc')]('/',auth['isAuthenticated'](),controller[_0x400a('0xd')]);router[_0x400a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x400a('0xf')]);router['delete']('/:id',auth[_0x400a('0xa')](),controller[_0x400a('0x10')]);module[_0x400a('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8cc226a..bd25d42 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 _0x7d25=['name','#0091EA','exports','STRING'];(function(_0x502fc8,_0x4be412){var _0x31b3a9=function(_0x18645a){while(--_0x18645a){_0x502fc8['push'](_0x502fc8['shift']());}};_0x31b3a9(++_0x4be412);}(_0x7d25,0x8a));var _0x57d2=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x7d25[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'unique':_0x57d2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x57d2('0x1')],'defaultValue':_0x57d2('0x3')},'description':{'type':Sequelize[_0x57d2('0x1')]}}; \ No newline at end of file +var _0xe3db=['sequelize','exports','name','STRING','#0091EA'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe3db,0xc8));var _0xbe3d=function(_0x45d0c3,_0x1e70d6){_0x45d0c3=_0x45d0c3-0x0;var _0x5db4d8=_0xe3db[_0x45d0c3];return _0x5db4d8;};'use strict';var Sequelize=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbe3d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbe3d('0x3')],'defaultValue':_0xbe3d('0x4')},'description':{'type':Sequelize[_0xbe3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2f4e879..c2e8d84 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 _0x8b29=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','Tags','UserProfileResource','sendStatus','error','stack','name','index','map','Tag','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0x234bef,_0x180abb){var _0x10bdae=function(_0x4df333){while(--_0x4df333){_0x234bef['push'](_0x234bef['shift']());}};_0x10bdae(++_0x180abb);}(_0x8b29,0xbe));var _0x98b2=function(_0x4ce645,_0x241202){_0x4ce645=_0x4ce645-0x0;var _0x255cfe=_0x8b29[_0x4ce645];return _0x255cfe;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){var _0x4c34f1=_0x2a5587['get']({'plain':!![]});var _0x7b6ebc=_0x98b2('0x21');return db[_0x98b2('0x22')]['destroy']({'where':{'type':_0x7b6ebc,'resourceId':_0x4c34f1['id']}})['then'](function(){return _0x2a5587;});})['then'](function(){_0xfae112[_0x98b2('0x1c')](0xcc)[_0x98b2('0x17')]();});}};}function handleEntityNotFound(_0x50aafb,_0xecb32b){return function(_0x28db65){if(!_0x28db65){_0x50aafb[_0x98b2('0x23')](0x194);}return _0x28db65;};}function handleError(_0x56efb6,_0x2e1ea4){_0x2e1ea4=_0x2e1ea4||0x1f4;return function(_0x1dee11){logger[_0x98b2('0x24')](_0x1dee11[_0x98b2('0x25')]);if(_0x1dee11[_0x98b2('0x26')]){delete _0x1dee11['name'];}_0x56efb6[_0x98b2('0x1c')](_0x2e1ea4)['send'](_0x1dee11);};}exports[_0x98b2('0x27')]=function(_0x1aa42a,_0x4d197c){var _0x2f5156={},_0x363174={},_0x526637={'count':0x0,'rows':[]};var _0x1a676e=_[_0x98b2('0x28')](db[_0x98b2('0x29')][_0x98b2('0x2a')],function(_0x4aee2a){return{'name':_0x4aee2a['fieldName'],'type':_0x4aee2a[_0x98b2('0x2b')][_0x98b2('0x2c')]};});_0x363174[_0x98b2('0x2d')]=_[_0x98b2('0x28')](_0x1a676e,_0x98b2('0x26'));_0x363174[_0x98b2('0x2e')]=_['keys'](_0x1aa42a[_0x98b2('0x2e')]);_0x363174[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],_0x363174[_0x98b2('0x2e')]);_0x2f5156[_0x98b2('0x31')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x2f5156[_0x98b2('0x31')]=_0x2f5156[_0x98b2('0x31')]['length']?_0x2f5156['attributes']:_0x363174[_0x98b2('0x2d')];if(!_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x33')](_0x98b2('0x34'))){_0x2f5156[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1aa42a['query'][_0x98b2('0x18')]);_0x2f5156[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1aa42a[_0x98b2('0x2e')]['offset']);}_0x2f5156[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x36')]);_0x2f5156[_0x98b2('0x37')]=qs[_0x98b2('0x2f')](_[_0x98b2('0x38')](_0x1aa42a['query'],_0x363174[_0x98b2('0x2f')]),_0x1a676e);if(_0x1aa42a['query'][_0x98b2('0x39')]){_0x2f5156[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x2f5156[_0x98b2('0x37')],{'$or':_['map'](_0x1a676e,function(_0x5aa34b){if(_0x5aa34b[_0x98b2('0x2b')]!==_0x98b2('0x3b')){var _0x42c69c={};_0x42c69c[_0x5aa34b['name']]={'$like':'%'+_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x39')]+'%'};return _0x42c69c;}})});}_0x2f5156=_[_0x98b2('0x3a')]({},_0x2f5156,_0x1aa42a[_0x98b2('0x3c')]);var _0x311fa7={'where':_0x2f5156[_0x98b2('0x37')]};return db['Tag'][_0x98b2('0x1a')](_0x311fa7)[_0x98b2('0x20')](function(_0x197749){_0x526637['count']=_0x197749;if(_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x3d')]){_0x2f5156[_0x98b2('0x3e')]=[{'all':!![]}];}return db[_0x98b2('0x29')][_0x98b2('0x3f')](_0x2f5156);})[_0x98b2('0x20')](function(_0x4a6c03){_0x526637[_0x98b2('0x40')]=_0x4a6c03;return _0x526637;})['then'](respondWithFilteredResult(_0x4d197c,_0x2f5156))[_0x98b2('0x41')](handleError(_0x4d197c,null));};exports[_0x98b2('0x42')]=function(_0x410094,_0x1d262d){var _0x44d858={'raw':!![],'where':{'id':_0x410094[_0x98b2('0x43')]['id']}},_0x32e14b={};_0x32e14b[_0x98b2('0x2d')]=_[_0x98b2('0x44')](db['Tag'][_0x98b2('0x2a')]);_0x32e14b['query']=_[_0x98b2('0x44')](_0x410094[_0x98b2('0x2e')]);_0x32e14b[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],_0x32e14b[_0x98b2('0x2e')]);_0x44d858['attributes']=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x410094[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x44d858['attributes']=_0x44d858['attributes'][_0x98b2('0x45')]?_0x44d858[_0x98b2('0x31')]:_0x32e14b[_0x98b2('0x2d')];if(_0x410094[_0x98b2('0x2e')]['includeAll']){_0x44d858['include']=[{'all':!![]}];}_0x44d858=_['merge']({},_0x44d858,_0x410094[_0x98b2('0x3c')]);return db[_0x98b2('0x29')][_0x98b2('0x46')](_0x44d858)[_0x98b2('0x20')](handleEntityNotFound(_0x1d262d,null))[_0x98b2('0x20')](respondWithResult(_0x1d262d,null))[_0x98b2('0x41')](handleError(_0x1d262d,null));};exports[_0x98b2('0x47')]=function(_0x2b08ed,_0x3c2477){return db['Tag'][_0x98b2('0x47')](_0x2b08ed['body'],{})[_0x98b2('0x20')](function(_0x6369ca){var _0x3c3c64=_0x2b08ed[_0x98b2('0x48')]['get']({'plain':!![]});if(!_0x3c3c64)throw new Error(_0x98b2('0x49'));if(_0x3c3c64[_0x98b2('0x4a')]===_0x98b2('0x48')){var _0x1e13b8=_0x6369ca[_0x98b2('0x4b')]({'plain':!![]});var _0x54f7ba=_0x98b2('0x21');return db[_0x98b2('0x4c')][_0x98b2('0x46')]({'where':{'name':_0x54f7ba,'userProfileId':_0x3c3c64[_0x98b2('0x4d')]},'raw':!![]})[_0x98b2('0x20')](function(_0x3d6a4e){if(_0x3d6a4e&&_0x3d6a4e[_0x98b2('0x4e')]===0x0){return db[_0x98b2('0x22')][_0x98b2('0x47')]({'name':_0x1e13b8[_0x98b2('0x26')],'resourceId':_0x1e13b8['id'],'type':_0x3d6a4e[_0x98b2('0x26')],'sectionId':_0x3d6a4e['id']},{})[_0x98b2('0x20')](function(){return _0x6369ca;});}else{return _0x6369ca;}})['catch'](function(_0x3b083a){logger[_0x98b2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b083a);throw _0x3b083a;});}return _0x6369ca;})['then'](respondWithResult(_0x3c2477,0xc9))[_0x98b2('0x41')](handleError(_0x3c2477,null));};exports['update']=function(_0x20ddfd,_0x1cad33){if(_0x20ddfd[_0x98b2('0x4f')]['id']){delete _0x20ddfd[_0x98b2('0x4f')]['id'];}return db[_0x98b2('0x29')][_0x98b2('0x46')]({'where':{'id':_0x20ddfd['params']['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1cad33,null))['then'](saveUpdates(_0x20ddfd['body'],null))[_0x98b2('0x20')](respondWithResult(_0x1cad33,null))[_0x98b2('0x41')](handleError(_0x1cad33,null));};exports['destroy']=function(_0x12a72e,_0x1253e2){return db['Tag'][_0x98b2('0x46')]({'where':{'id':_0x12a72e[_0x98b2('0x43')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1253e2,null))[_0x98b2('0x20')](removeEntity(_0x1253e2,null))['catch'](handleError(_0x1253e2,null));}; \ No newline at end of file +var _0xf2cb=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Tags','UserProfileResource','end','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xf2cb,0x130));var _0xbf2c=function(_0x3a6bbf,_0x2d7ea4){_0x3a6bbf=_0x3a6bbf-0x0;var _0x1371c6=_0xf2cb[_0x3a6bbf];return _0x1371c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf2c('0x1'));var rp=require('request-promise');var moment=require(_0xbf2c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbf2c('0x3'));var util=require(_0xbf2c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xbf2c('0x5'));var ejs=require(_0xbf2c('0x6'));var fs=require('fs');var fs_extra=require(_0xbf2c('0x7'));var _=require(_0xbf2c('0x8'));var squel=require('squel');var crypto=require(_0xbf2c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbf2c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf2c('0xb'));var Redis=require(_0xbf2c('0xc'));var authService=require(_0xbf2c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf2c('0xe'));var hardwareService=require(_0xbf2c('0xf'));var logger=require(_0xbf2c('0x10'))(_0xbf2c('0x11'));var utils=require(_0xbf2c('0x12'));var config=require(_0xbf2c('0x13'));var licenseUtil=require(_0xbf2c('0x14'));var db=require(_0xbf2c('0x15'))['db'];function respondWithStatusCode(_0x52983d,_0x149235){_0x149235=_0x149235||0xcc;return function(_0x294d0d){if(_0x294d0d){return _0x52983d[_0xbf2c('0x16')](_0x149235);}return _0x52983d[_0xbf2c('0x17')](_0x149235)['end']();};}function respondWithResult(_0x7665b1,_0x5a160b){_0x5a160b=_0x5a160b||0xc8;return function(_0x557740){if(_0x557740){return _0x7665b1[_0xbf2c('0x17')](_0x5a160b)['json'](_0x557740);}};}function respondWithFilteredResult(_0x47df49,_0x3ed1c3){return function(_0x45412){if(_0x45412){var _0x2dc80e=typeof _0x3ed1c3[_0xbf2c('0x18')]===_0xbf2c('0x19')&&typeof _0x3ed1c3['limit']===_0xbf2c('0x19');var _0x5514b0=_0x45412[_0xbf2c('0x1a')];var _0x1df2ab=_0x2dc80e?0x0:_0x3ed1c3[_0xbf2c('0x18')];var _0x32a44d=_0x2dc80e?_0x45412[_0xbf2c('0x1a')]:_0x3ed1c3['offset']+_0x3ed1c3[_0xbf2c('0x1b')];var _0x1fbfe8;if(_0x32a44d>=_0x5514b0){_0x32a44d=_0x5514b0;_0x1fbfe8=0xc8;}else{_0x1fbfe8=0xce;}_0x47df49[_0xbf2c('0x17')](_0x1fbfe8);return _0x47df49[_0xbf2c('0x1c')](_0xbf2c('0x1d'),_0x1df2ab+'-'+_0x32a44d+'/'+_0x5514b0)[_0xbf2c('0x1e')](_0x45412);}return null;};}function patchUpdates(_0x426724){return function(_0x58caa9){try{jsonpatch[_0xbf2c('0x1f')](_0x58caa9,_0x426724,!![]);}catch(_0x2a3adf){return BPromise[_0xbf2c('0x20')](_0x2a3adf);}return _0x58caa9[_0xbf2c('0x21')]();};}function saveUpdates(_0x57873c,_0x2bc2ad){return function(_0x1f5515){if(_0x1f5515){return _0x1f5515['update'](_0x57873c)[_0xbf2c('0x22')](function(_0x356f26){return _0x356f26;});}return null;};}function removeEntity(_0x3f1cdb,_0x52ecb4){return function(_0x5de1f2){if(_0x5de1f2){return _0x5de1f2[_0xbf2c('0x23')]()[_0xbf2c('0x22')](function(){var _0xae9c7=_0x5de1f2[_0xbf2c('0x24')]({'plain':!![]});var _0x108aa8=_0xbf2c('0x25');return db[_0xbf2c('0x26')]['destroy']({'where':{'type':_0x108aa8,'resourceId':_0xae9c7['id']}})['then'](function(){return _0x5de1f2;});})[_0xbf2c('0x22')](function(){_0x3f1cdb[_0xbf2c('0x17')](0xcc)[_0xbf2c('0x27')]();});}};}function handleEntityNotFound(_0x4314d6,_0x3ed68d){return function(_0x4a0257){if(!_0x4a0257){_0x4314d6[_0xbf2c('0x16')](0x194);}return _0x4a0257;};}function handleError(_0x2976fa,_0x1f7030){_0x1f7030=_0x1f7030||0x1f4;return function(_0x4f3191){logger[_0xbf2c('0x28')](_0x4f3191['stack']);if(_0x4f3191[_0xbf2c('0x29')]){delete _0x4f3191[_0xbf2c('0x29')];}_0x2976fa[_0xbf2c('0x17')](_0x1f7030)[_0xbf2c('0x2a')](_0x4f3191);};}exports[_0xbf2c('0x2b')]=function(_0x502943,_0x1e946c){var _0xef5fc9={},_0x132365={},_0x13e238={'count':0x0,'rows':[]};var _0x2cc8cb=_[_0xbf2c('0x2c')](db[_0xbf2c('0x2d')][_0xbf2c('0x2e')],function(_0x4d731d){return{'name':_0x4d731d[_0xbf2c('0x2f')],'type':_0x4d731d[_0xbf2c('0x30')][_0xbf2c('0x31')]};});_0x132365['model']=_['map'](_0x2cc8cb,_0xbf2c('0x29'));_0x132365[_0xbf2c('0x32')]=_[_0xbf2c('0x33')](_0x502943[_0xbf2c('0x32')]);_0x132365[_0xbf2c('0x34')]=_[_0xbf2c('0x35')](_0x132365[_0xbf2c('0x36')],_0x132365[_0xbf2c('0x32')]);_0xef5fc9[_0xbf2c('0x37')]=_['intersection'](_0x132365[_0xbf2c('0x36')],qs[_0xbf2c('0x38')](_0x502943[_0xbf2c('0x32')][_0xbf2c('0x38')]));_0xef5fc9[_0xbf2c('0x37')]=_0xef5fc9[_0xbf2c('0x37')][_0xbf2c('0x39')]?_0xef5fc9[_0xbf2c('0x37')]:_0x132365['model'];if(!_0x502943[_0xbf2c('0x32')][_0xbf2c('0x3a')](_0xbf2c('0x3b'))){_0xef5fc9['limit']=qs[_0xbf2c('0x1b')](_0x502943[_0xbf2c('0x32')][_0xbf2c('0x1b')]);_0xef5fc9['offset']=qs[_0xbf2c('0x18')](_0x502943[_0xbf2c('0x32')]['offset']);}_0xef5fc9['order']=qs['sort'](_0x502943['query']['sort']);_0xef5fc9[_0xbf2c('0x3c')]=qs[_0xbf2c('0x34')](_[_0xbf2c('0x3d')](_0x502943[_0xbf2c('0x32')],_0x132365[_0xbf2c('0x34')]),_0x2cc8cb);if(_0x502943[_0xbf2c('0x32')][_0xbf2c('0x3e')]){_0xef5fc9[_0xbf2c('0x3c')]=_[_0xbf2c('0x3f')](_0xef5fc9[_0xbf2c('0x3c')],{'$or':_[_0xbf2c('0x2c')](_0x2cc8cb,function(_0x99abc8){if(_0x99abc8[_0xbf2c('0x30')]!==_0xbf2c('0x40')){var _0x4776e0={};_0x4776e0[_0x99abc8[_0xbf2c('0x29')]]={'$like':'%'+_0x502943['query'][_0xbf2c('0x3e')]+'%'};return _0x4776e0;}})});}_0xef5fc9=_[_0xbf2c('0x3f')]({},_0xef5fc9,_0x502943[_0xbf2c('0x41')]);var _0x3379d2={'where':_0xef5fc9[_0xbf2c('0x3c')]};return db[_0xbf2c('0x2d')][_0xbf2c('0x1a')](_0x3379d2)[_0xbf2c('0x22')](function(_0x500e0b){_0x13e238[_0xbf2c('0x1a')]=_0x500e0b;if(_0x502943[_0xbf2c('0x32')][_0xbf2c('0x42')]){_0xef5fc9[_0xbf2c('0x43')]=[{'all':!![]}];}return db['Tag'][_0xbf2c('0x44')](_0xef5fc9);})['then'](function(_0x369bdc){_0x13e238[_0xbf2c('0x45')]=_0x369bdc;return _0x13e238;})[_0xbf2c('0x22')](respondWithFilteredResult(_0x1e946c,_0xef5fc9))[_0xbf2c('0x46')](handleError(_0x1e946c,null));};exports[_0xbf2c('0x47')]=function(_0x14107c,_0x4c2a1e){var _0x365710={'raw':!![],'where':{'id':_0x14107c['params']['id']}},_0x55c3d7={};_0x55c3d7[_0xbf2c('0x36')]=_['keys'](db['Tag'][_0xbf2c('0x2e')]);_0x55c3d7[_0xbf2c('0x32')]=_['keys'](_0x14107c[_0xbf2c('0x32')]);_0x55c3d7['filters']=_[_0xbf2c('0x35')](_0x55c3d7['model'],_0x55c3d7[_0xbf2c('0x32')]);_0x365710[_0xbf2c('0x37')]=_[_0xbf2c('0x35')](_0x55c3d7[_0xbf2c('0x36')],qs[_0xbf2c('0x38')](_0x14107c[_0xbf2c('0x32')]['fields']));_0x365710[_0xbf2c('0x37')]=_0x365710[_0xbf2c('0x37')][_0xbf2c('0x39')]?_0x365710[_0xbf2c('0x37')]:_0x55c3d7[_0xbf2c('0x36')];if(_0x14107c['query']['includeAll']){_0x365710[_0xbf2c('0x43')]=[{'all':!![]}];}_0x365710=_['merge']({},_0x365710,_0x14107c[_0xbf2c('0x41')]);return db[_0xbf2c('0x2d')][_0xbf2c('0x48')](_0x365710)[_0xbf2c('0x22')](handleEntityNotFound(_0x4c2a1e,null))[_0xbf2c('0x22')](respondWithResult(_0x4c2a1e,null))[_0xbf2c('0x46')](handleError(_0x4c2a1e,null));};exports[_0xbf2c('0x49')]=function(_0x1c3b78,_0x128e97){return db[_0xbf2c('0x2d')][_0xbf2c('0x49')](_0x1c3b78['body'],{})[_0xbf2c('0x22')](function(_0x22af02){var _0x90276=_0x1c3b78[_0xbf2c('0x4a')]['get']({'plain':!![]});if(!_0x90276)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x90276['role']===_0xbf2c('0x4a')){var _0x2451ba=_0x22af02['get']({'plain':!![]});var _0x5a0c37='Tags';return db[_0xbf2c('0x4b')][_0xbf2c('0x48')]({'where':{'name':_0x5a0c37,'userProfileId':_0x90276[_0xbf2c('0x4c')]},'raw':!![]})[_0xbf2c('0x22')](function(_0x3a8d9a){if(_0x3a8d9a&&_0x3a8d9a[_0xbf2c('0x4d')]===0x0){return db['UserProfileResource'][_0xbf2c('0x49')]({'name':_0x2451ba[_0xbf2c('0x29')],'resourceId':_0x2451ba['id'],'type':_0x3a8d9a[_0xbf2c('0x29')],'sectionId':_0x3a8d9a['id']},{})[_0xbf2c('0x22')](function(){return _0x22af02;});}else{return _0x22af02;}})[_0xbf2c('0x46')](function(_0x3166dd){logger[_0xbf2c('0x28')](_0xbf2c('0x4e'),_0x3166dd);throw _0x3166dd;});}return _0x22af02;})['then'](respondWithResult(_0x128e97,0xc9))['catch'](handleError(_0x128e97,null));};exports['update']=function(_0x3a62f9,_0x2b0ec3){if(_0x3a62f9[_0xbf2c('0x4f')]['id']){delete _0x3a62f9[_0xbf2c('0x4f')]['id'];}return db['Tag'][_0xbf2c('0x48')]({'where':{'id':_0x3a62f9[_0xbf2c('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b0ec3,null))[_0xbf2c('0x22')](saveUpdates(_0x3a62f9[_0xbf2c('0x4f')],null))[_0xbf2c('0x22')](respondWithResult(_0x2b0ec3,null))['catch'](handleError(_0x2b0ec3,null));};exports['destroy']=function(_0x4b6253,_0x49cae6){return db[_0xbf2c('0x2d')][_0xbf2c('0x48')]({'where':{'id':_0x4b6253[_0xbf2c('0x50')]['id']}})[_0xbf2c('0x22')](handleEntityNotFound(_0x49cae6,null))[_0xbf2c('0x22')](removeEntity(_0x49cae6,null))['catch'](handleError(_0x49cae6,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index bf3e187..eefab37 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 _0xdff5=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util','../../config/logger','api','moment'];(function(_0x1e51cf,_0x3abf53){var _0x33ddcc=function(_0x18d935){while(--_0x18d935){_0x1e51cf['push'](_0x1e51cf['shift']());}};_0x33ddcc(++_0x3abf53);}(_0xdff5,0x100));var _0x5dff=function(_0x372655,_0x5cb403){_0x372655=_0x372655-0x0;var _0x4f5885=_0xdff5[_0x372655];return _0x4f5885;};'use strict';var _=require('lodash');var util=require(_0x5dff('0x0'));var logger=require(_0x5dff('0x1'))(_0x5dff('0x2'));var moment=require(_0x5dff('0x3'));var BPromise=require(_0x5dff('0x4'));var rp=require(_0x5dff('0x5'));var fs=require('fs');var path=require(_0x5dff('0x6'));var rimraf=require(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var attributes=require(_0x5dff('0x9'));module[_0x5dff('0xa')]=function(_0x490fdd,_0x5999bc){return _0x490fdd[_0x5dff('0xb')]('Tag',attributes,{'tableName':_0x5dff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4114=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','tools_tags'];(function(_0x5e3585,_0x505712){var _0x31797e=function(_0x20076d){while(--_0x20076d){_0x5e3585['push'](_0x5e3585['shift']());}};_0x31797e(++_0x505712);}(_0x4114,0x1ce));var _0x4411=function(_0x412ea2,_0x5aaa6c){_0x412ea2=_0x412ea2-0x0;var _0x1c37e7=_0x4114[_0x412ea2];return _0x1c37e7;};'use strict';var _=require(_0x4411('0x0'));var util=require(_0x4411('0x1'));var logger=require(_0x4411('0x2'))(_0x4411('0x3'));var moment=require(_0x4411('0x4'));var BPromise=require('bluebird');var rp=require(_0x4411('0x5'));var fs=require('fs');var path=require(_0x4411('0x6'));var rimraf=require(_0x4411('0x7'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x4411('0x8')]=function(_0x4eaf9d,_0x3620d2){return _0x4eaf9d[_0x4411('0x9')]('Tag',attributes,{'tableName':_0x4411('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 5657a12..bf850c3 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 _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x51779b,_0x5f4f8f){var _0x5de26e=function(_0x5f4547){while(--_0x5f4547){_0x51779b['push'](_0x51779b['shift']());}};_0x5de26e(++_0x5f4f8f);}(_0xac9d,0x14d));var _0xdac9=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0xac9d[_0x3fe2be];return _0x16b3ca;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0x6f7f=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Tag,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x6f7f,0x177));var _0xf6f7=function(_0x23920c,_0x596714){_0x23920c=_0x23920c-0x0;var _0x29f679=_0x6f7f[_0x23920c];return _0x29f679;};'use strict';var _=require('lodash');var util=require(_0xf6f7('0x0'));var moment=require(_0xf6f7('0x1'));var BPromise=require(_0xf6f7('0x2'));var rs=require(_0xf6f7('0x3'));var fs=require('fs');var Redis=require(_0xf6f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6f7('0x5'));var logger=require('../../config/logger')(_0xf6f7('0x6'));var config=require(_0xf6f7('0x7'));var jayson=require(_0xf6f7('0x8'));var client=jayson['client'][_0xf6f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x543eb3,_0x33a2b2,_0x3c641f){return new BPromise(function(_0xe86f3a,_0x279ed7){return client[_0xf6f7('0xa')](_0x543eb3,_0x3c641f)[_0xf6f7('0xb')](function(_0x506617){logger[_0xf6f7('0xc')]('Tag,\x20%s,\x20%s',_0x33a2b2,'request\x20sent');logger['debug'](_0xf6f7('0xd'),_0x33a2b2,_0xf6f7('0xe'),JSON[_0xf6f7('0xf')](_0x506617));if(_0x506617[_0xf6f7('0x10')]){if(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);return _0x279ed7(_0x506617[_0xf6f7('0x10')][_0xf6f7('0x12')]);}logger['error']('Tag,\x20%s,\x20%s',_0x33a2b2,_0x506617[_0xf6f7('0x10')]['message']);return _0xe86f3a(_0x506617[_0xf6f7('0x10')]['message']);}else{logger[_0xf6f7('0xc')](_0xf6f7('0x13'),_0x33a2b2,_0xf6f7('0xe'));_0xe86f3a(_0x506617[_0xf6f7('0x14')][_0xf6f7('0x12')]);}})['catch'](function(_0x42aa26){logger[_0xf6f7('0x10')]('Tag,\x20%s,\x20%s',_0x33a2b2,_0x42aa26);_0x279ed7(_0x42aa26);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index e6f05c1..23775bc 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 352761a..bcd39cb 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xe706,0xa3));var _0x6e70=function(_0x1c43aa,_0xff2696){_0x1c43aa=_0x1c43aa-0x0;var _0x514c3c=_0xe706[_0x1c43aa];return _0x514c3c;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 41e689c..a5d9d49 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 _0x7178=['offset','undefined','limit','count','set','reject','update','then','error','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','rows','show','params','length','includeAll','include','find','catch','create','body','user','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','capitalize','channel','toLowerCase','Queue','get','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','ValidationError','remove','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','through','penalty','QueueId','findOrCreate','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','removeAgents','Chat','Whatsapp','Queue:remove','getAgents','pick','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','end','status','json'];(function(_0x99f6b0,_0x17783b){var _0x1e7b78=function(_0xc6b0f4){while(--_0xc6b0f4){_0x99f6b0['push'](_0x99f6b0['shift']());}};_0x1e7b78(++_0x17783b);}(_0x7178,0x1c5));var _0x8717=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7178[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8717('0x0'));var zipdir=require(_0x8717('0x1'));var jsonpatch=require(_0x8717('0x2'));var rp=require('request-promise');var moment=require(_0x8717('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8717('0x4'));var util=require(_0x8717('0x5'));var path=require('path');var sox=require(_0x8717('0x6'));var csv=require('to-csv');var ejs=require(_0x8717('0x7'));var fs=require('fs');var fs_extra=require(_0x8717('0x8'));var _=require(_0x8717('0x9'));var squel=require(_0x8717('0xa'));var crypto=require(_0x8717('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8717('0xc'));var toCsv=require(_0x8717('0xd'));var querystring=require(_0x8717('0xe'));var Papa=require(_0x8717('0xf'));var Redis=require(_0x8717('0x10'));var authService=require(_0x8717('0x11'));var qs=require(_0x8717('0x12'));var as=require(_0x8717('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8717('0x14'))(_0x8717('0x15'));var utils=require(_0x8717('0x16'));var config=require(_0x8717('0x17'));var licenseUtil=require(_0x8717('0x18'));var db=require(_0x8717('0x19'))['db'];config[_0x8717('0x1a')]=_[_0x8717('0x1b')](config[_0x8717('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8717('0x1a')]));require('./team.socket')[_0x8717('0x1c')](socket);function respondWithStatusCode(_0x421832,_0x3051f8){_0x3051f8=_0x3051f8||0xcc;return function(_0x1aff27){if(_0x1aff27){return _0x421832[_0x8717('0x1d')](_0x3051f8);}return _0x421832['status'](_0x3051f8)[_0x8717('0x1e')]();};}function respondWithResult(_0x4aa17b,_0xc23831){_0xc23831=_0xc23831||0xc8;return function(_0x5e8b33){if(_0x5e8b33){return _0x4aa17b[_0x8717('0x1f')](_0xc23831)[_0x8717('0x20')](_0x5e8b33);}};}function respondWithFilteredResult(_0x481e6c,_0x3aaaf0){return function(_0x1cab80){if(_0x1cab80){var _0x37c321=typeof _0x3aaaf0[_0x8717('0x21')]===_0x8717('0x22')&&typeof _0x3aaaf0[_0x8717('0x23')]===_0x8717('0x22');var _0x572c6e=_0x1cab80['count'];var _0x24e503=_0x37c321?0x0:_0x3aaaf0['offset'];var _0x4d0767=_0x37c321?_0x1cab80[_0x8717('0x24')]:_0x3aaaf0[_0x8717('0x21')]+_0x3aaaf0[_0x8717('0x23')];var _0x3223d5;if(_0x4d0767>=_0x572c6e){_0x4d0767=_0x572c6e;_0x3223d5=0xc8;}else{_0x3223d5=0xce;}_0x481e6c[_0x8717('0x1f')](_0x3223d5);return _0x481e6c[_0x8717('0x25')]('Content-Range',_0x24e503+'-'+_0x4d0767+'/'+_0x572c6e)[_0x8717('0x20')](_0x1cab80);}return null;};}function patchUpdates(_0x17788f){return function(_0x55cbd4){try{jsonpatch['apply'](_0x55cbd4,_0x17788f,!![]);}catch(_0x109374){return BPromise[_0x8717('0x26')](_0x109374);}return _0x55cbd4['save']();};}function saveUpdates(_0x428e46,_0x4072f9){return function(_0x471ed4){if(_0x471ed4){return _0x471ed4[_0x8717('0x27')](_0x428e46)[_0x8717('0x28')](function(_0x344b16){return _0x344b16;});}return null;};}function handleEntityNotFound(_0x3443d7,_0x5e8809){return function(_0x210ac3){if(!_0x210ac3){_0x3443d7[_0x8717('0x1d')](0x194);}return _0x210ac3;};}function handleError(_0x399090,_0x409bcf){_0x409bcf=_0x409bcf||0x1f4;return function(_0xfc4167){logger[_0x8717('0x29')](_0xfc4167[_0x8717('0x2a')]);if(_0xfc4167[_0x8717('0x2b')]){delete _0xfc4167['name'];}_0x399090['status'](_0x409bcf)['send'](_0xfc4167);};}exports[_0x8717('0x2c')]=function(_0x2411ee,_0x183bb3){var _0x10d0b9={},_0x5d93fc={},_0x39638a={'count':0x0,'rows':[]};var _0x296e1c=_[_0x8717('0x2d')](db[_0x8717('0x2e')][_0x8717('0x2f')],function(_0x532ae5){return{'name':_0x532ae5[_0x8717('0x30')],'type':_0x532ae5[_0x8717('0x31')][_0x8717('0x32')]};});_0x5d93fc[_0x8717('0x33')]=_[_0x8717('0x2d')](_0x296e1c,_0x8717('0x2b'));_0x5d93fc[_0x8717('0x34')]=_[_0x8717('0x35')](_0x2411ee[_0x8717('0x34')]);_0x5d93fc['filters']=_[_0x8717('0x36')](_0x5d93fc[_0x8717('0x33')],_0x5d93fc['query']);_0x10d0b9[_0x8717('0x37')]=_[_0x8717('0x36')](_0x5d93fc[_0x8717('0x33')],qs[_0x8717('0x38')](_0x2411ee[_0x8717('0x34')][_0x8717('0x38')]));_0x10d0b9[_0x8717('0x37')]=_0x10d0b9[_0x8717('0x37')]['length']?_0x10d0b9[_0x8717('0x37')]:_0x5d93fc['model'];if(!_0x2411ee['query']['hasOwnProperty'](_0x8717('0x39'))){_0x10d0b9[_0x8717('0x23')]=qs[_0x8717('0x23')](_0x2411ee[_0x8717('0x34')][_0x8717('0x23')]);_0x10d0b9[_0x8717('0x21')]=qs['offset'](_0x2411ee[_0x8717('0x34')][_0x8717('0x21')]);}_0x10d0b9[_0x8717('0x3a')]=qs[_0x8717('0x3b')](_0x2411ee[_0x8717('0x34')][_0x8717('0x3b')]);_0x10d0b9[_0x8717('0x3c')]=qs[_0x8717('0x3d')](_['pick'](_0x2411ee[_0x8717('0x34')],_0x5d93fc[_0x8717('0x3d')]),_0x296e1c);if(_0x2411ee['query']['filter']){_0x10d0b9['where']=_[_0x8717('0x3e')](_0x10d0b9['where'],{'$or':_[_0x8717('0x2d')](_0x296e1c,function(_0x303d7c){if(_0x303d7c['type']!==_0x8717('0x3f')){var _0x2dcccc={};_0x2dcccc[_0x303d7c[_0x8717('0x2b')]]={'$like':'%'+_0x2411ee[_0x8717('0x34')][_0x8717('0x40')]+'%'};return _0x2dcccc;}})});}_0x10d0b9=_['merge']({},_0x10d0b9,_0x2411ee[_0x8717('0x41')]);var _0x355902={'where':_0x10d0b9['where']};return db[_0x8717('0x2e')]['count'](_0x355902)[_0x8717('0x28')](function(_0x13b467){_0x39638a[_0x8717('0x24')]=_0x13b467;if(_0x2411ee[_0x8717('0x34')]['includeAll']){_0x10d0b9['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x10d0b9);})[_0x8717('0x28')](function(_0x376421){_0x39638a[_0x8717('0x42')]=_0x376421;return _0x39638a;})[_0x8717('0x28')](respondWithFilteredResult(_0x183bb3,_0x10d0b9))['catch'](handleError(_0x183bb3,null));};exports[_0x8717('0x43')]=function(_0x5d27f5,_0x2631c3){var _0xb857c1={'raw':![],'where':{'id':_0x5d27f5[_0x8717('0x44')]['id']}},_0xe8f8e4={};_0xe8f8e4[_0x8717('0x33')]=_[_0x8717('0x35')](db[_0x8717('0x2e')][_0x8717('0x2f')]);_0xe8f8e4[_0x8717('0x34')]=_[_0x8717('0x35')](_0x5d27f5[_0x8717('0x34')]);_0xe8f8e4[_0x8717('0x3d')]=_[_0x8717('0x36')](_0xe8f8e4[_0x8717('0x33')],_0xe8f8e4[_0x8717('0x34')]);_0xb857c1[_0x8717('0x37')]=_[_0x8717('0x36')](_0xe8f8e4[_0x8717('0x33')],qs[_0x8717('0x38')](_0x5d27f5[_0x8717('0x34')][_0x8717('0x38')]));_0xb857c1[_0x8717('0x37')]=_0xb857c1[_0x8717('0x37')][_0x8717('0x45')]?_0xb857c1[_0x8717('0x37')]:_0xe8f8e4[_0x8717('0x33')];if(_0x5d27f5['query'][_0x8717('0x46')]){_0xb857c1[_0x8717('0x47')]=[{'all':!![]}];}_0xb857c1=_[_0x8717('0x3e')]({},_0xb857c1,_0x5d27f5[_0x8717('0x41')]);return db['Team'][_0x8717('0x48')](_0xb857c1)[_0x8717('0x28')](handleEntityNotFound(_0x2631c3,null))[_0x8717('0x28')](respondWithResult(_0x2631c3,null))[_0x8717('0x49')](handleError(_0x2631c3,null));};exports[_0x8717('0x4a')]=function(_0x449102,_0x4a600c){return db[_0x8717('0x2e')]['create'](_0x449102[_0x8717('0x4b')],{})[_0x8717('0x28')](function(_0x2afe42){var _0x2c75e2=_0x449102[_0x8717('0x4c')]['get']({'plain':!![]});if(!_0x2c75e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c75e2[_0x8717('0x4d')]===_0x8717('0x4c')){var _0x1e0e39=_0x2afe42['get']({'plain':!![]});var _0x18f649=_0x8717('0x4e');return db[_0x8717('0x4f')][_0x8717('0x48')]({'where':{'name':_0x18f649,'userProfileId':_0x2c75e2[_0x8717('0x50')]},'raw':!![]})[_0x8717('0x28')](function(_0x41d86a){if(_0x41d86a&&_0x41d86a[_0x8717('0x51')]===0x0){return db['UserProfileResource'][_0x8717('0x4a')]({'name':_0x1e0e39[_0x8717('0x2b')],'resourceId':_0x1e0e39['id'],'type':_0x41d86a[_0x8717('0x2b')],'sectionId':_0x41d86a['id']},{})['then'](function(){return _0x2afe42;});}else{return _0x2afe42;}})[_0x8717('0x49')](function(_0xff4b89){logger[_0x8717('0x29')](_0x8717('0x52'),_0xff4b89);throw _0xff4b89;});}return _0x2afe42;})[_0x8717('0x28')](respondWithResult(_0x4a600c,0xc9))[_0x8717('0x49')](handleError(_0x4a600c,null));};exports[_0x8717('0x27')]=function(_0x13c1e4,_0x537f8c){if(_0x13c1e4[_0x8717('0x4b')]['id']){delete _0x13c1e4['body']['id'];}return db['Team'][_0x8717('0x48')]({'where':{'id':_0x13c1e4[_0x8717('0x44')]['id']}})['then'](handleEntityNotFound(_0x537f8c,null))['then'](saveUpdates(_0x13c1e4['body'],null))[_0x8717('0x28')](respondWithResult(_0x537f8c,null))['catch'](handleError(_0x537f8c,null));};exports[_0x8717('0x53')]=function(_0xcdf4db,_0x37390a){var _0x317a21=_0xcdf4db[_0x8717('0x44')]['id'];var _0x3c5e09=[];return db[_0x8717('0x54')][_0x8717('0x55')](function(_0x18ab8f){var _0x37e31b=_0x8717('0x56')+_0x317a21;return db[_0x8717('0x54')][_0x8717('0x34')](_0x37e31b,{'type':db[_0x8717('0x57')][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f})[_0x8717('0x28')](function(_0x14ee98){_0x3c5e09=_[_0x8717('0x2d')](_0x14ee98,function(_0x179ae4){return Number(_0x179ae4[_0x8717('0x5a')]);});})[_0x8717('0x28')](function(){var _0x11d5f4=_0x8717('0x5b')+_0x317a21;return db[_0x8717('0x54')][_0x8717('0x34')](_0x11d5f4,{'type':db['Sequelize'][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})['then'](function(_0x19e377){var _0x34d8d7=_[_0x8717('0x2d')](_0x19e377,function(_0x338bc0){return Number(_0x338bc0[_0x8717('0x5c')]);});return db[_0x8717('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x3c5e09},'VoiceQueueId':{'$in':_0x34d8d7}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x47be5a=_0x8717('0x5e')+_0x317a21;return db[_0x8717('0x54')][_0x8717('0x34')](_0x47be5a,{'type':db['Sequelize'][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})['then'](function(_0x63253b){var _0x56edfa=_['map'](_0x63253b,function(_0x153b7a){return Number(_0x153b7a[_0x8717('0x5f')]);});return db[_0x8717('0x60')][_0x8717('0x53')]({'where':{'UserId':{'$in':_0x3c5e09},'MailQueueId':{'$in':_0x56edfa}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x3b88b1=_0x8717('0x61')+_0x317a21;return db['sequelize'][_0x8717('0x34')](_0x3b88b1,{'type':db[_0x8717('0x57')][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})[_0x8717('0x28')](function(_0x323d46){var _0x2f91d7=_[_0x8717('0x2d')](_0x323d46,function(_0x4dcd7c){return Number(_0x4dcd7c[_0x8717('0x62')]);});return db[_0x8717('0x63')]['destroy']({'where':{'UserId':{'$in':_0x3c5e09},'SmsQueueId':{'$in':_0x2f91d7}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x279670=_0x8717('0x64')+_0x317a21;return db['sequelize'][_0x8717('0x34')](_0x279670,{'type':db[_0x8717('0x57')]['QueryTypes'][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})[_0x8717('0x28')](function(_0x15d4a4){var _0x19dd5a=_[_0x8717('0x2d')](_0x15d4a4,function(_0xd26c88){return Number(_0xd26c88[_0x8717('0x65')]);});return db[_0x8717('0x66')][_0x8717('0x53')]({'where':{'UserId':{'$in':_0x3c5e09},'ChatQueueId':{'$in':_0x19dd5a}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x2714d1=_0x8717('0x67')+_0x317a21;return db[_0x8717('0x54')]['query'](_0x2714d1,{'type':db[_0x8717('0x57')][_0x8717('0x58')]['SELECT'],'raw':!![],'transaction':_0x18ab8f});})['then'](function(_0x21fd2c){var _0x4710cf=_['map'](_0x21fd2c,function(_0x565b4a){return Number(_0x565b4a[_0x8717('0x68')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x3c5e09},'FaxQueueId':{'$in':_0x4710cf}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x55cb46=_0x8717('0x69')+_0x317a21;return db[_0x8717('0x54')][_0x8717('0x34')](_0x55cb46,{'type':db[_0x8717('0x57')][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})[_0x8717('0x28')](function(_0x1ac660){var _0x43c0e4=_[_0x8717('0x2d')](_0x1ac660,function(_0x52a391){return Number(_0x52a391[_0x8717('0x6a')]);});return db[_0x8717('0x6b')][_0x8717('0x53')]({'where':{'UserId':{'$in':_0x3c5e09},'OpenchannelQueueId':{'$in':_0x43c0e4}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){var _0x2b1106=_0x8717('0x6c')+_0x317a21;return db[_0x8717('0x54')][_0x8717('0x34')](_0x2b1106,{'type':db[_0x8717('0x57')][_0x8717('0x58')][_0x8717('0x59')],'raw':!![],'transaction':_0x18ab8f});})[_0x8717('0x28')](function(_0x13e981){var _0x570e68=_['map'](_0x13e981,function(_0x549ea4){return Number(_0x549ea4[_0x8717('0x6d')]);});return db[_0x8717('0x6e')][_0x8717('0x53')]({'where':{'UserId':{'$in':_0x3c5e09},'WhatsappQueueId':{'$in':_0x570e68}},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){return db['TeamVoicePrefix'][_0x8717('0x48')]({'where':{'TeamId':_0x317a21}});})[_0x8717('0x28')](function(_0x2ffa0d){if(_0x2ffa0d===null){return;}return db[_0x8717('0x6f')][_0x8717('0x53')]({'where':{'UserId':{'$in':_0x3c5e09},'VoicePrefixId':_0x2ffa0d[_0x8717('0x70')]},'transaction':_0x18ab8f});})[_0x8717('0x28')](function(){return db[_0x8717('0x2e')][_0x8717('0x53')]({'where':{'id':_0x317a21},'cascade':!![],'transaction':_0x18ab8f});})[_0x8717('0x28')](function(_0x124b28){if(_0x124b28===0x0){_0x37390a['sendStatus'](0x194);}else{return db[_0x8717('0x71')]['destroy']({'where':{'type':_0x8717('0x4e'),'resourceId':_0x317a21},'cascade':!![],'transaction':_0x18ab8f})[_0x8717('0x28')](function(){_0x37390a[_0x8717('0x1f')](0xcc)[_0x8717('0x1e')]();});}})['catch'](function(_0x134698){_0x37390a[_0x8717('0x1f')](0x1f4)['send'](_0x134698);});});};exports[_0x8717('0x72')]=function(_0x2e9104,_0x5c33e8,_0x41ae0f){return db[_0x8717('0x2e')][_0x8717('0x73')]({'where':{'id':_0x2e9104[_0x8717('0x44')]['id']}})[_0x8717('0x28')](handleEntityNotFound(_0x5c33e8,null))[_0x8717('0x28')](function(_0x180a16){if(!_0x2e9104[_0x8717('0x34')]['channel']||!utils[_0x8717('0x74')](_0x2e9104[_0x8717('0x34')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x51bee6={};var _0x45aae0={};_0x45aae0[_0x8717('0x33')]=_['keys'](db[_[_0x8717('0x75')](_0x2e9104[_0x8717('0x34')][_0x8717('0x76')][_0x8717('0x77')]())+_0x8717('0x78')][_0x8717('0x2f')]);_0x45aae0[_0x8717('0x34')]=_['keys'](_0x2e9104[_0x8717('0x34')]);_0x45aae0[_0x8717('0x3d')]=_[_0x8717('0x36')](_0x45aae0['model'],_0x45aae0[_0x8717('0x34')]);_0x51bee6[_0x8717('0x37')]=_['intersection'](_0x45aae0['model'],qs[_0x8717('0x38')](_0x2e9104[_0x8717('0x34')][_0x8717('0x38')]));_0x51bee6[_0x8717('0x37')]=_0x51bee6[_0x8717('0x37')][_0x8717('0x45')]?_0x51bee6[_0x8717('0x37')]:_0x45aae0['model'];_0x51bee6[_0x8717('0x23')]=qs[_0x8717('0x23')](_0x2e9104[_0x8717('0x34')][_0x8717('0x23')]);_0x51bee6[_0x8717('0x21')]=qs[_0x8717('0x21')](_0x2e9104[_0x8717('0x34')][_0x8717('0x21')]);_0x51bee6[_0x8717('0x3a')]=qs['sort'](_0x2e9104[_0x8717('0x34')][_0x8717('0x3b')]);_0x51bee6[_0x8717('0x3c')]=qs[_0x8717('0x3d')](_['pick'](_0x2e9104[_0x8717('0x34')],_0x45aae0[_0x8717('0x3d')]));_0x51bee6=_[_0x8717('0x3e')]({},_0x51bee6,_0x2e9104[_0x8717('0x41')]);return _0x180a16[_0x8717('0x79')+_[_0x8717('0x75')](_0x2e9104[_0x8717('0x34')][_0x8717('0x76')][_0x8717('0x77')]())+_0x8717('0x7a')](_0x51bee6);})[_0x8717('0x28')](respondWithResult(_0x5c33e8,null))[_0x8717('0x49')](handleError(_0x5c33e8,null));};exports[_0x8717('0x7b')]=function(_0x459d9c,_0x19d217,_0x5ceff5){return db[_0x8717('0x2e')][_0x8717('0x73')]({'where':{'id':_0x459d9c[_0x8717('0x44')]['id']}})[_0x8717('0x28')](function(_0x4a7938){if(_0x4a7938){if(!_0x459d9c[_0x8717('0x4b')][_0x8717('0x76')]||!utils['isValidChannel'](_0x459d9c['body']['channel'])){throw new db[(_0x8717('0x57'))]['ValidationError'](_0x8717('0x7c'));}return _0x4a7938[_0x8717('0x7d')+_[_0x8717('0x75')](_0x459d9c[_0x8717('0x4b')][_0x8717('0x76')][_0x8717('0x77')]())+_0x8717('0x7a')](_0x459d9c['body'][_0x8717('0x7e')]);}return null;})[_0x8717('0x28')](handleEntityNotFound(_0x19d217,null))[_0x8717('0x28')](respondWithStatusCode(_0x19d217,null))[_0x8717('0x49')](handleError(_0x19d217,null));};exports[_0x8717('0x7f')]=function(_0x5d5644,_0x42f0dc,_0x20f986){return db[_0x8717('0x2e')][_0x8717('0x73')]({'where':{'id':_0x5d5644[_0x8717('0x44')]['id']}})[_0x8717('0x28')](function(_0x46d14a){if(_0x46d14a){if(!_0x5d5644['query']['channel']||!utils[_0x8717('0x74')](_0x5d5644[_0x8717('0x34')]['channel'])){throw new db[(_0x8717('0x57'))][(_0x8717('0x80'))]('Unknown\x20channel');}return _0x46d14a[_0x8717('0x81')+_[_0x8717('0x75')](_0x5d5644[_0x8717('0x34')][_0x8717('0x76')][_0x8717('0x77')]())+_0x8717('0x7a')](_0x5d5644[_0x8717('0x34')][_0x8717('0x7e')]);}return null;})[_0x8717('0x28')](handleEntityNotFound(_0x42f0dc,null))['then'](respondWithStatusCode(_0x42f0dc,null))['catch'](handleError(_0x42f0dc,null));};exports[_0x8717('0x82')]=function(_0x3388a8,_0x2a4918){var _0x5ee906=_[_0x8717('0x83')](_0x3388a8[_0x8717('0x4b')][_0x8717('0x7e')])?_0x3388a8['body'][_0x8717('0x7e')]:[_0x3388a8[_0x8717('0x4b')][_0x8717('0x7e')]];var _0x3d0aaa=_0x3388a8['params']['id'];return db[_0x8717('0x2e')][_0x8717('0x48')]({'where':{'id':_0x3d0aaa}})['then'](handleEntityNotFound(_0x2a4918,null))['then'](function(_0x8c7a0){if(_0x8c7a0){var _0x31dc1d=[_0x8717('0x84'),'Chat',_0x8717('0x85'),_0x8717('0x86'),_0x8717('0x87'),_0x8717('0x88'),'Whatsapp'];return db[_0x8717('0x54')]['transaction'](function(_0x40b7c4){var _0x223d6d=_[_0x8717('0x2d')](_0x31dc1d,function(_0x540b05){var _0x38e82a={'attributes':['id',_0x8717('0x2b')]};if(_0x540b05===_0x8717('0x84')){_0x38e82a[_0x8717('0x89')]={'attributes':[_0x8717('0x8a')]};}return _0x8c7a0[_0x8717('0x79')+_0x540b05+_0x8717('0x7a')](_0x38e82a)[_0x8717('0x28')](function(_0x55b045){var _0x1168ea=_[_0x8717('0x2d')](_0x55b045,function(_0x308bd2){var _0x3a2e41=_['map'](_0x5ee906,function(_0x54931d){var _0xda2a4={'where':{'UserId':_0x54931d,[_0x540b05+_0x8717('0x8b')]:_0x308bd2['id']},'transaction':_0x40b7c4};if(_0x540b05===_0x8717('0x84')){_0xda2a4[_0x8717('0x1b')]={'penalty':_0x308bd2['TeamVoiceQueue'][_0x8717('0x8a')]};}return db['User'+_0x540b05+_0x8717('0x78')][_0x8717('0x8c')](_0xda2a4)['then'](function(){socket[_0x8717('0x8d')]('user'+_0x540b05+_0x8717('0x8e'),{'UserId':_0x54931d,[_0x540b05+_0x8717('0x8b')]:_0x308bd2['id']});if(_0x540b05!==_0x8717('0x84')){return;}return db[_0x8717('0x8f')]['findAll']({'where':{'id':_0x5ee906,'online':0x1},'attributes':['id',_0x8717('0x2b'),_0x8717('0x90'),_0x8717('0x91'),_0x8717('0x92')],'raw':!![]})['then'](function(_0x194f91){var _0x27ab06=_['map'](_0x194f91,function(_0x24bc00){return db[_0x8717('0x93')][_0x8717('0x94')]({'membername':_0x24bc00['name'],'UserId':_0x24bc00['id'],'queue_name':_0x308bd2[_0x8717('0x2b')],'VoiceQueueId':_0x308bd2['id'],'interface':_[_0x8717('0x95')](_0x24bc00[_0x8717('0x92')])?util[_0x8717('0x96')](_0x8717('0x97'),_0x24bc00[_0x8717('0x2b')]):_0x24bc00[_0x8717('0x92')],'paused':_0x24bc00['voicePause']||![],'penalty':_0x308bd2[_0x8717('0x98')]['penalty']},{'transaction':_0x40b7c4});});return Promise['all'](_0x27ab06);});});});return Promise[_0x8717('0x99')](_0x3a2e41);});return Promise[_0x8717('0x99')](_0x1168ea);})['then'](function(){return db[_0x8717('0x9a')][_0x8717('0x73')]({'where':{'teamId':_0x3d0aaa}})['then'](function(_0x4d2d5d){if(_0x4d2d5d){var _0x4a6011=_['map'](_0x5ee906,function(_0x22e7a3){db['UserVoicePrefix']['upsert']({'UserId':_0x22e7a3,'VoicePrefixId':_0x4d2d5d[_0x8717('0x70')]});});return Promise[_0x8717('0x99')](_0x4a6011);}});});});return Promise[_0x8717('0x99')](_0x223d6d)[_0x8717('0x28')](function(){return _0x8c7a0['addAgents'](_0x5ee906,{'transaction':_0x40b7c4})['spread'](function(_0x4e2bc7){return _0x4e2bc7;});});});}})[_0x8717('0x28')](respondWithResult(_0x2a4918,null))['catch'](handleError(_0x2a4918,null));};exports[_0x8717('0x9b')]=function(_0x3fd92a,_0x5468d3){var _0x3673c6=_[_0x8717('0x83')](_0x3fd92a[_0x8717('0x34')][_0x8717('0x7e')])?_0x3fd92a[_0x8717('0x34')][_0x8717('0x7e')]:[_0x3fd92a[_0x8717('0x34')][_0x8717('0x7e')]];var _0x1c668c=_0x3fd92a[_0x8717('0x44')]['id'];return db['Team'][_0x8717('0x48')]({'where':{'id':_0x1c668c}})['then'](handleEntityNotFound(_0x5468d3,null))[_0x8717('0x28')](function(_0x1065e3){if(_0x1065e3){var _0x2ea41c=[_0x8717('0x84'),_0x8717('0x9c'),'Mail',_0x8717('0x86'),_0x8717('0x87'),_0x8717('0x88'),_0x8717('0x9d')];return db[_0x8717('0x54')][_0x8717('0x55')](function(_0x1c9caa){var _0x5a2307=_[_0x8717('0x2d')](_0x2ea41c,function(_0x5b8612){var _0xc92de7={'attributes':['id','name']};return _0x1065e3['get'+_0x5b8612+_0x8717('0x7a')](_0xc92de7)[_0x8717('0x28')](function(_0x41908c){var _0x59b1ba=_[_0x8717('0x2d')](_0x41908c,function(_0x56570d){return _0x56570d['removeAgents'](_0x3673c6,{'transaction':_0x1c9caa})['then'](function(){var _0x47f681=_[_0x8717('0x2d')](_0x3673c6,function(_0x38c3fa){socket['emit'](_0x8717('0x4c')+_0x5b8612+_0x8717('0x9e'),{'UserId':Number(_0x38c3fa),[_0x5b8612+_0x8717('0x8b')]:_0x56570d['id']});if(_0x5b8612!==_0x8717('0x84')){return;}return db[_0x8717('0x93')][_0x8717('0x53')]({'where':{'VoiceQueueId':_0x56570d['id'],'UserId':_0x38c3fa},'transaction':_0x1c9caa});});return Promise[_0x8717('0x99')](_0x47f681);});});return Promise[_0x8717('0x99')](_0x59b1ba);});});return Promise['all'](_0x5a2307)[_0x8717('0x28')](function(){return _0x1065e3[_0x8717('0x9b')](_0x3673c6,{'transaction':_0x1c9caa});})[_0x8717('0x28')](function(){return db[_0x8717('0x9a')][_0x8717('0x73')]({'where':{'teamId':_0x1c668c}})[_0x8717('0x28')](function(_0x59c5c5){if(_0x59c5c5){var _0x5ae945=_[_0x8717('0x2d')](_0x3673c6,function(_0x4f1ac1){db[_0x8717('0x6f')]['destroy']({'where':{'UserId':_0x4f1ac1,'VoicePrefixId':_0x59c5c5[_0x8717('0x70')]}});});return Promise['all'](_0x5ae945);}});});});}})[_0x8717('0x28')](respondWithStatusCode(_0x5468d3,null))[_0x8717('0x49')](handleError(_0x5468d3,null));};exports[_0x8717('0x9f')]=function(_0x2bf9e3,_0x1b69cd,_0xc8202d){var _0xfc753a={};var _0x2e6147={};var _0x225bb7;var _0x343f2c;return db[_0x8717('0x2e')][_0x8717('0x73')]({'where':{'id':_0x2bf9e3[_0x8717('0x44')]['id']}})[_0x8717('0x28')](handleEntityNotFound(_0x1b69cd,null))['then'](function(_0x173ecd){if(_0x173ecd){_0x225bb7=_0x173ecd;_0x2e6147[_0x8717('0x33')]=_['keys'](db[_0x8717('0x8f')][_0x8717('0x2f')]);_0x2e6147[_0x8717('0x34')]=_[_0x8717('0x35')](_0x2bf9e3[_0x8717('0x34')]);_0x2e6147[_0x8717('0x3d')]=_[_0x8717('0x36')](_0x2e6147[_0x8717('0x33')],_0x2e6147[_0x8717('0x34')]);_0xfc753a[_0x8717('0x37')]=_[_0x8717('0x36')](_0x2e6147[_0x8717('0x33')],qs[_0x8717('0x38')](_0x2bf9e3[_0x8717('0x34')][_0x8717('0x38')]));_0xfc753a[_0x8717('0x37')]=_0xfc753a[_0x8717('0x37')][_0x8717('0x45')]?_0xfc753a[_0x8717('0x37')]:_0x2e6147[_0x8717('0x33')];_0xfc753a['order']=qs[_0x8717('0x3b')](_0x2bf9e3[_0x8717('0x34')]['sort']);_0xfc753a[_0x8717('0x3c')]=qs[_0x8717('0x3d')](_[_0x8717('0xa0')](_0x2bf9e3[_0x8717('0x34')],_0x2e6147[_0x8717('0x3d')]));if(_0x2bf9e3[_0x8717('0x34')][_0x8717('0x40')]){_0xfc753a[_0x8717('0x3c')]=_[_0x8717('0x3e')](_0xfc753a[_0x8717('0x3c')],{'$or':_[_0x8717('0x2d')](_0xfc753a[_0x8717('0x37')],function(_0x20823f){var _0x5d34c1={};_0x5d34c1[_0x20823f]={'$like':'%'+_0x2bf9e3[_0x8717('0x34')][_0x8717('0x40')]+'%'};return _0x5d34c1;})});}_0xfc753a=_[_0x8717('0x3e')]({},_0xfc753a,_0x2bf9e3[_0x8717('0x41')]);return _0x225bb7[_0x8717('0x9f')](_0xfc753a);}})[_0x8717('0x28')](function(_0xe0941e){if(_0xe0941e){_0x343f2c=_0xe0941e['length'];if(!_0x2bf9e3[_0x8717('0x34')][_0x8717('0xa1')](_0x8717('0x39'))){_0xfc753a[_0x8717('0x23')]=qs[_0x8717('0x23')](_0x2bf9e3[_0x8717('0x34')][_0x8717('0x23')]);_0xfc753a[_0x8717('0x21')]=qs[_0x8717('0x21')](_0x2bf9e3['query'][_0x8717('0x21')]);}return _0x225bb7[_0x8717('0x9f')](_0xfc753a);}})[_0x8717('0x28')](function(_0x3b1cc0){if(_0x3b1cc0){return _0x3b1cc0?{'count':_0x343f2c,'rows':_0x3b1cc0}:null;}})[_0x8717('0x28')](respondWithResult(_0x1b69cd,null))[_0x8717('0x49')](handleError(_0x1b69cd,null));}; \ No newline at end of file +var _0x8b61=['hasOwnProperty','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','then','error','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','transaction','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','pick','add','toLowerCase','Queues','ids','isArray','Chat','Mail','Openchannel','Voice','penalty','QueueId','defaults','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','TeamVoiceQueue','all','UserVoicePrefix','addAgents','spread','Sms','Fax','removeAgents','Queue:remove','getAgents','filter'];(function(_0x150abc,_0x2fa678){var _0x71f675=function(_0x4c81c5){while(--_0x4c81c5){_0x150abc['push'](_0x150abc['shift']());}};_0x71f675(++_0x2fa678);}(_0x8b61,0x12e));var _0x18b6=function(_0x52746e,_0x158c43){_0x52746e=_0x52746e-0x0;var _0x23f28f=_0x8b61[_0x52746e];return _0x23f28f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18b6('0x0'));var zipdir=require(_0x18b6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18b6('0x2'));var moment=require(_0x18b6('0x3'));var BPromise=require(_0x18b6('0x4'));var Mustache=require(_0x18b6('0x5'));var util=require('util');var path=require(_0x18b6('0x6'));var sox=require(_0x18b6('0x7'));var csv=require(_0x18b6('0x8'));var ejs=require(_0x18b6('0x9'));var fs=require('fs');var fs_extra=require(_0x18b6('0xa'));var _=require('lodash');var squel=require(_0x18b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x18b6('0xc'));var deskjs=require(_0x18b6('0xd'));var toCsv=require(_0x18b6('0x8'));var querystring=require(_0x18b6('0xe'));var Papa=require(_0x18b6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x18b6('0x10'));var as=require(_0x18b6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18b6('0x12'));var utils=require('../../config/utils');var config=require(_0x18b6('0x13'));var licenseUtil=require(_0x18b6('0x14'));var db=require(_0x18b6('0x15'))['db'];config[_0x18b6('0x16')]=_['defaults'](config[_0x18b6('0x16')],{'host':_0x18b6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18b6('0x16')]));require(_0x18b6('0x18'))[_0x18b6('0x19')](socket);function respondWithStatusCode(_0x8f8c03,_0x3587d9){_0x3587d9=_0x3587d9||0xcc;return function(_0x1e59bb){if(_0x1e59bb){return _0x8f8c03[_0x18b6('0x1a')](_0x3587d9);}return _0x8f8c03[_0x18b6('0x1b')](_0x3587d9)['end']();};}function respondWithResult(_0x3932e5,_0x5bb8e6){_0x5bb8e6=_0x5bb8e6||0xc8;return function(_0x27c400){if(_0x27c400){return _0x3932e5['status'](_0x5bb8e6)['json'](_0x27c400);}};}function respondWithFilteredResult(_0x34aeac,_0x51f84c){return function(_0x5ee8f7){if(_0x5ee8f7){var _0x59743a=typeof _0x51f84c[_0x18b6('0x1c')]===_0x18b6('0x1d')&&typeof _0x51f84c[_0x18b6('0x1e')]===_0x18b6('0x1d');var _0x16b7be=_0x5ee8f7[_0x18b6('0x1f')];var _0x401f4c=_0x59743a?0x0:_0x51f84c[_0x18b6('0x1c')];var _0x4f3275=_0x59743a?_0x5ee8f7[_0x18b6('0x1f')]:_0x51f84c[_0x18b6('0x1c')]+_0x51f84c[_0x18b6('0x1e')];var _0x43bd37;if(_0x4f3275>=_0x16b7be){_0x4f3275=_0x16b7be;_0x43bd37=0xc8;}else{_0x43bd37=0xce;}_0x34aeac['status'](_0x43bd37);return _0x34aeac['set'](_0x18b6('0x20'),_0x401f4c+'-'+_0x4f3275+'/'+_0x16b7be)[_0x18b6('0x21')](_0x5ee8f7);}return null;};}function patchUpdates(_0x5d6478){return function(_0x29475c){try{jsonpatch['apply'](_0x29475c,_0x5d6478,!![]);}catch(_0x3a55b9){return BPromise[_0x18b6('0x22')](_0x3a55b9);}return _0x29475c['save']();};}function saveUpdates(_0x4ebe0c,_0x3d2333){return function(_0x11b4b4){if(_0x11b4b4){return _0x11b4b4['update'](_0x4ebe0c)[_0x18b6('0x23')](function(_0x382120){return _0x382120;});}return null;};}function handleEntityNotFound(_0x32a65e,_0x3b9007){return function(_0x142e05){if(!_0x142e05){_0x32a65e[_0x18b6('0x1a')](0x194);}return _0x142e05;};}function handleError(_0x1feaff,_0x4c89bd){_0x4c89bd=_0x4c89bd||0x1f4;return function(_0x55902a){logger[_0x18b6('0x24')](_0x55902a[_0x18b6('0x25')]);if(_0x55902a['name']){delete _0x55902a[_0x18b6('0x26')];}_0x1feaff[_0x18b6('0x1b')](_0x4c89bd)[_0x18b6('0x27')](_0x55902a);};}exports['index']=function(_0x4a1476,_0x32c90c){var _0x2aff1f={},_0x31bcc8={},_0xd4b91a={'count':0x0,'rows':[]};var _0x436414=_['map'](db[_0x18b6('0x28')][_0x18b6('0x29')],function(_0x47405e){return{'name':_0x47405e[_0x18b6('0x2a')],'type':_0x47405e[_0x18b6('0x2b')][_0x18b6('0x2c')]};});_0x31bcc8[_0x18b6('0x2d')]=_[_0x18b6('0x2e')](_0x436414,_0x18b6('0x26'));_0x31bcc8['query']=_['keys'](_0x4a1476[_0x18b6('0x2f')]);_0x31bcc8[_0x18b6('0x30')]=_[_0x18b6('0x31')](_0x31bcc8[_0x18b6('0x2d')],_0x31bcc8[_0x18b6('0x2f')]);_0x2aff1f[_0x18b6('0x32')]=_[_0x18b6('0x31')](_0x31bcc8['model'],qs[_0x18b6('0x33')](_0x4a1476['query'][_0x18b6('0x33')]));_0x2aff1f[_0x18b6('0x32')]=_0x2aff1f[_0x18b6('0x32')][_0x18b6('0x34')]?_0x2aff1f[_0x18b6('0x32')]:_0x31bcc8[_0x18b6('0x2d')];if(!_0x4a1476['query']['hasOwnProperty']('nolimit')){_0x2aff1f['limit']=qs[_0x18b6('0x1e')](_0x4a1476[_0x18b6('0x2f')][_0x18b6('0x1e')]);_0x2aff1f[_0x18b6('0x1c')]=qs['offset'](_0x4a1476[_0x18b6('0x2f')][_0x18b6('0x1c')]);}_0x2aff1f[_0x18b6('0x35')]=qs[_0x18b6('0x36')](_0x4a1476[_0x18b6('0x2f')][_0x18b6('0x36')]);_0x2aff1f['where']=qs[_0x18b6('0x30')](_['pick'](_0x4a1476['query'],_0x31bcc8[_0x18b6('0x30')]),_0x436414);if(_0x4a1476[_0x18b6('0x2f')]['filter']){_0x2aff1f[_0x18b6('0x37')]=_['merge'](_0x2aff1f[_0x18b6('0x37')],{'$or':_['map'](_0x436414,function(_0x50cc30){if(_0x50cc30[_0x18b6('0x2b')]!==_0x18b6('0x38')){var _0x36c9b6={};_0x36c9b6[_0x50cc30['name']]={'$like':'%'+_0x4a1476[_0x18b6('0x2f')]['filter']+'%'};return _0x36c9b6;}})});}_0x2aff1f=_[_0x18b6('0x39')]({},_0x2aff1f,_0x4a1476[_0x18b6('0x3a')]);var _0x28db8b={'where':_0x2aff1f['where']};return db['Team'][_0x18b6('0x1f')](_0x28db8b)[_0x18b6('0x23')](function(_0x287341){_0xd4b91a[_0x18b6('0x1f')]=_0x287341;if(_0x4a1476['query'][_0x18b6('0x3b')]){_0x2aff1f['include']=[{'all':!![]}];}return db['Team'][_0x18b6('0x3c')](_0x2aff1f);})['then'](function(_0x4351a3){_0xd4b91a[_0x18b6('0x3d')]=_0x4351a3;return _0xd4b91a;})[_0x18b6('0x23')](respondWithFilteredResult(_0x32c90c,_0x2aff1f))['catch'](handleError(_0x32c90c,null));};exports[_0x18b6('0x3e')]=function(_0x51ae03,_0x3ed7aa){var _0x44b5fa={'raw':![],'where':{'id':_0x51ae03[_0x18b6('0x3f')]['id']}},_0x3d1b41={};_0x3d1b41[_0x18b6('0x2d')]=_['keys'](db[_0x18b6('0x28')][_0x18b6('0x29')]);_0x3d1b41[_0x18b6('0x2f')]=_[_0x18b6('0x40')](_0x51ae03[_0x18b6('0x2f')]);_0x3d1b41[_0x18b6('0x30')]=_['intersection'](_0x3d1b41[_0x18b6('0x2d')],_0x3d1b41[_0x18b6('0x2f')]);_0x44b5fa[_0x18b6('0x32')]=_['intersection'](_0x3d1b41[_0x18b6('0x2d')],qs[_0x18b6('0x33')](_0x51ae03[_0x18b6('0x2f')][_0x18b6('0x33')]));_0x44b5fa[_0x18b6('0x32')]=_0x44b5fa['attributes'][_0x18b6('0x34')]?_0x44b5fa['attributes']:_0x3d1b41[_0x18b6('0x2d')];if(_0x51ae03[_0x18b6('0x2f')][_0x18b6('0x3b')]){_0x44b5fa[_0x18b6('0x41')]=[{'all':!![]}];}_0x44b5fa=_['merge']({},_0x44b5fa,_0x51ae03[_0x18b6('0x3a')]);return db[_0x18b6('0x28')][_0x18b6('0x42')](_0x44b5fa)[_0x18b6('0x23')](handleEntityNotFound(_0x3ed7aa,null))[_0x18b6('0x23')](respondWithResult(_0x3ed7aa,null))[_0x18b6('0x43')](handleError(_0x3ed7aa,null));};exports[_0x18b6('0x44')]=function(_0x599d35,_0x2dda07){return db[_0x18b6('0x28')]['create'](_0x599d35['body'],{})[_0x18b6('0x23')](function(_0x3e6dc9){var _0x591d38=_0x599d35['user'][_0x18b6('0x45')]({'plain':!![]});if(!_0x591d38)throw new Error(_0x18b6('0x46'));if(_0x591d38[_0x18b6('0x47')]===_0x18b6('0x48')){var _0x272404=_0x3e6dc9[_0x18b6('0x45')]({'plain':!![]});var _0x2bbe4c=_0x18b6('0x49');return db[_0x18b6('0x4a')]['find']({'where':{'name':_0x2bbe4c,'userProfileId':_0x591d38[_0x18b6('0x4b')]},'raw':!![]})[_0x18b6('0x23')](function(_0x302697){if(_0x302697&&_0x302697['autoAssociation']===0x0){return db[_0x18b6('0x4c')][_0x18b6('0x44')]({'name':_0x272404[_0x18b6('0x26')],'resourceId':_0x272404['id'],'type':_0x302697[_0x18b6('0x26')],'sectionId':_0x302697['id']},{})[_0x18b6('0x23')](function(){return _0x3e6dc9;});}else{return _0x3e6dc9;}})['catch'](function(_0x58712d){logger[_0x18b6('0x24')](_0x18b6('0x4d'),_0x58712d);throw _0x58712d;});}return _0x3e6dc9;})['then'](respondWithResult(_0x2dda07,0xc9))['catch'](handleError(_0x2dda07,null));};exports[_0x18b6('0x4e')]=function(_0x5de7fe,_0x2c75e7){if(_0x5de7fe[_0x18b6('0x4f')]['id']){delete _0x5de7fe[_0x18b6('0x4f')]['id'];}return db['Team'][_0x18b6('0x42')]({'where':{'id':_0x5de7fe['params']['id']}})[_0x18b6('0x23')](handleEntityNotFound(_0x2c75e7,null))[_0x18b6('0x23')](saveUpdates(_0x5de7fe['body'],null))['then'](respondWithResult(_0x2c75e7,null))[_0x18b6('0x43')](handleError(_0x2c75e7,null));};exports['destroy']=function(_0x54e43b,_0x4c334a){var _0x2bcdf2=_0x54e43b['params']['id'];var _0x400570=[];return db['sequelize'][_0x18b6('0x50')](function(_0x46c14e){var _0xa32ba4='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2bcdf2;return db['sequelize'][_0x18b6('0x2f')](_0xa32ba4,{'type':db['Sequelize'][_0x18b6('0x51')][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e})[_0x18b6('0x23')](function(_0x1391f3){_0x400570=_['map'](_0x1391f3,function(_0x4b18b4){return Number(_0x4b18b4['UserId']);});})[_0x18b6('0x23')](function(){var _0x1a1c83=_0x18b6('0x53')+_0x2bcdf2;return db['sequelize'][_0x18b6('0x2f')](_0x1a1c83,{'type':db[_0x18b6('0x54')][_0x18b6('0x51')][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x124dda){var _0x27b68a=_[_0x18b6('0x2e')](_0x124dda,function(_0x3db4dc){return Number(_0x3db4dc[_0x18b6('0x55')]);});return db[_0x18b6('0x56')][_0x18b6('0x57')]({'where':{'UserId':{'$in':_0x400570},'VoiceQueueId':{'$in':_0x27b68a}},'transaction':_0x46c14e});})['then'](function(){var _0x23e216=_0x18b6('0x58')+_0x2bcdf2;return db[_0x18b6('0x59')][_0x18b6('0x2f')](_0x23e216,{'type':db['Sequelize'][_0x18b6('0x51')][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x871cce){var _0x14e245=_[_0x18b6('0x2e')](_0x871cce,function(_0x4ed024){return Number(_0x4ed024['MailQueueId']);});return db[_0x18b6('0x5a')][_0x18b6('0x57')]({'where':{'UserId':{'$in':_0x400570},'MailQueueId':{'$in':_0x14e245}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){var _0x32809e=_0x18b6('0x5b')+_0x2bcdf2;return db[_0x18b6('0x59')][_0x18b6('0x2f')](_0x32809e,{'type':db['Sequelize'][_0x18b6('0x51')][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})['then'](function(_0x51eb18){var _0x2008ce=_[_0x18b6('0x2e')](_0x51eb18,function(_0x478357){return Number(_0x478357[_0x18b6('0x5c')]);});return db[_0x18b6('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x400570},'SmsQueueId':{'$in':_0x2008ce}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){var _0xdc9bd=_0x18b6('0x5e')+_0x2bcdf2;return db[_0x18b6('0x59')][_0x18b6('0x2f')](_0xdc9bd,{'type':db[_0x18b6('0x54')][_0x18b6('0x51')][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x190f0c){var _0x4262db=_[_0x18b6('0x2e')](_0x190f0c,function(_0x4c0225){return Number(_0x4c0225[_0x18b6('0x5f')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x400570},'ChatQueueId':{'$in':_0x4262db}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){var _0xae716b=_0x18b6('0x60')+_0x2bcdf2;return db[_0x18b6('0x59')][_0x18b6('0x2f')](_0xae716b,{'type':db[_0x18b6('0x54')]['QueryTypes'][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x555d8d){var _0x315519=_[_0x18b6('0x2e')](_0x555d8d,function(_0x577cbc){return Number(_0x577cbc['FaxQueueId']);});return db['UserFaxQueue'][_0x18b6('0x57')]({'where':{'UserId':{'$in':_0x400570},'FaxQueueId':{'$in':_0x315519}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){var _0x168174=_0x18b6('0x61')+_0x2bcdf2;return db[_0x18b6('0x59')]['query'](_0x168174,{'type':db[_0x18b6('0x54')][_0x18b6('0x51')]['SELECT'],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x12f23f){var _0x38a793=_[_0x18b6('0x2e')](_0x12f23f,function(_0x432517){return Number(_0x432517[_0x18b6('0x62')]);});return db[_0x18b6('0x63')]['destroy']({'where':{'UserId':{'$in':_0x400570},'OpenchannelQueueId':{'$in':_0x38a793}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){var _0x5b8dd6=_0x18b6('0x64')+_0x2bcdf2;return db[_0x18b6('0x59')]['query'](_0x5b8dd6,{'type':db['Sequelize']['QueryTypes'][_0x18b6('0x52')],'raw':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x54b2e6){var _0x352063=_[_0x18b6('0x2e')](_0x54b2e6,function(_0x3561c3){return Number(_0x3561c3[_0x18b6('0x65')]);});return db[_0x18b6('0x66')]['destroy']({'where':{'UserId':{'$in':_0x400570},'WhatsappQueueId':{'$in':_0x352063}},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){return db[_0x18b6('0x67')][_0x18b6('0x42')]({'where':{'TeamId':_0x2bcdf2}});})[_0x18b6('0x23')](function(_0x5239b1){if(_0x5239b1===null){return;}return db['UserVoicePrefix'][_0x18b6('0x57')]({'where':{'UserId':{'$in':_0x400570},'VoicePrefixId':_0x5239b1[_0x18b6('0x68')]},'transaction':_0x46c14e});})[_0x18b6('0x23')](function(){return db[_0x18b6('0x28')]['destroy']({'where':{'id':_0x2bcdf2},'cascade':!![],'transaction':_0x46c14e});})[_0x18b6('0x23')](function(_0x2499d4){if(_0x2499d4===0x0){_0x4c334a[_0x18b6('0x1a')](0x194);}else{return db[_0x18b6('0x4c')]['destroy']({'where':{'type':_0x18b6('0x49'),'resourceId':_0x2bcdf2},'cascade':!![],'transaction':_0x46c14e})[_0x18b6('0x23')](function(){_0x4c334a['status'](0xcc)[_0x18b6('0x69')]();});}})[_0x18b6('0x43')](function(_0x250651){_0x4c334a['status'](0x1f4)[_0x18b6('0x27')](_0x250651);});});};exports[_0x18b6('0x6a')]=function(_0x37394e,_0x30195f,_0x42fef8){return db['Team'][_0x18b6('0x6b')]({'where':{'id':_0x37394e[_0x18b6('0x3f')]['id']}})[_0x18b6('0x23')](handleEntityNotFound(_0x30195f,null))['then'](function(_0xa0ec1b){if(!_0x37394e[_0x18b6('0x2f')][_0x18b6('0x6c')]||!utils[_0x18b6('0x6d')](_0x37394e['query'][_0x18b6('0x6c')])){throw new db[(_0x18b6('0x54'))][(_0x18b6('0x6e'))](_0x18b6('0x6f'));}var _0x4b1d54={};var _0x30d77a={};_0x30d77a[_0x18b6('0x2d')]=_[_0x18b6('0x40')](db[_[_0x18b6('0x70')](_0x37394e[_0x18b6('0x2f')][_0x18b6('0x6c')]['toLowerCase']())+_0x18b6('0x71')][_0x18b6('0x29')]);_0x30d77a[_0x18b6('0x2f')]=_[_0x18b6('0x40')](_0x37394e[_0x18b6('0x2f')]);_0x30d77a[_0x18b6('0x30')]=_[_0x18b6('0x31')](_0x30d77a[_0x18b6('0x2d')],_0x30d77a[_0x18b6('0x2f')]);_0x4b1d54[_0x18b6('0x32')]=_[_0x18b6('0x31')](_0x30d77a['model'],qs[_0x18b6('0x33')](_0x37394e[_0x18b6('0x2f')][_0x18b6('0x33')]));_0x4b1d54[_0x18b6('0x32')]=_0x4b1d54[_0x18b6('0x32')]['length']?_0x4b1d54[_0x18b6('0x32')]:_0x30d77a[_0x18b6('0x2d')];_0x4b1d54['limit']=qs[_0x18b6('0x1e')](_0x37394e[_0x18b6('0x2f')][_0x18b6('0x1e')]);_0x4b1d54[_0x18b6('0x1c')]=qs[_0x18b6('0x1c')](_0x37394e[_0x18b6('0x2f')][_0x18b6('0x1c')]);_0x4b1d54['order']=qs[_0x18b6('0x36')](_0x37394e[_0x18b6('0x2f')]['sort']);_0x4b1d54[_0x18b6('0x37')]=qs[_0x18b6('0x30')](_[_0x18b6('0x72')](_0x37394e[_0x18b6('0x2f')],_0x30d77a[_0x18b6('0x30')]));_0x4b1d54=_['merge']({},_0x4b1d54,_0x37394e[_0x18b6('0x3a')]);return _0xa0ec1b[_0x18b6('0x45')+_[_0x18b6('0x70')](_0x37394e[_0x18b6('0x2f')][_0x18b6('0x6c')]['toLowerCase']())+'Queues'](_0x4b1d54);})[_0x18b6('0x23')](respondWithResult(_0x30195f,null))[_0x18b6('0x43')](handleError(_0x30195f,null));};exports['addQueues']=function(_0xdcf62f,_0x4e6ca5,_0x11696b){return db[_0x18b6('0x28')][_0x18b6('0x6b')]({'where':{'id':_0xdcf62f[_0x18b6('0x3f')]['id']}})['then'](function(_0x361b50){if(_0x361b50){if(!_0xdcf62f[_0x18b6('0x4f')][_0x18b6('0x6c')]||!utils[_0x18b6('0x6d')](_0xdcf62f[_0x18b6('0x4f')][_0x18b6('0x6c')])){throw new db[(_0x18b6('0x54'))][(_0x18b6('0x6e'))](_0x18b6('0x6f'));}return _0x361b50[_0x18b6('0x73')+_['capitalize'](_0xdcf62f['body']['channel'][_0x18b6('0x74')]())+_0x18b6('0x75')](_0xdcf62f[_0x18b6('0x4f')][_0x18b6('0x76')]);}return null;})[_0x18b6('0x23')](handleEntityNotFound(_0x4e6ca5,null))[_0x18b6('0x23')](respondWithStatusCode(_0x4e6ca5,null))['catch'](handleError(_0x4e6ca5,null));};exports['removeQueues']=function(_0x4a250c,_0x3f7892,_0x596e21){return db['Team'][_0x18b6('0x6b')]({'where':{'id':_0x4a250c['params']['id']}})[_0x18b6('0x23')](function(_0x3c8e22){if(_0x3c8e22){if(!_0x4a250c[_0x18b6('0x2f')][_0x18b6('0x6c')]||!utils[_0x18b6('0x6d')](_0x4a250c[_0x18b6('0x2f')][_0x18b6('0x6c')])){throw new db[(_0x18b6('0x54'))]['ValidationError'](_0x18b6('0x6f'));}return _0x3c8e22['remove'+_[_0x18b6('0x70')](_0x4a250c['query'][_0x18b6('0x6c')][_0x18b6('0x74')]())+_0x18b6('0x75')](_0x4a250c[_0x18b6('0x2f')][_0x18b6('0x76')]);}return null;})[_0x18b6('0x23')](handleEntityNotFound(_0x3f7892,null))[_0x18b6('0x23')](respondWithStatusCode(_0x3f7892,null))[_0x18b6('0x43')](handleError(_0x3f7892,null));};exports['addAgents']=function(_0x42ad60,_0x197874){var _0x13ecb3=_[_0x18b6('0x77')](_0x42ad60['body'][_0x18b6('0x76')])?_0x42ad60[_0x18b6('0x4f')]['ids']:[_0x42ad60['body'][_0x18b6('0x76')]];var _0x41014a=_0x42ad60['params']['id'];return db[_0x18b6('0x28')][_0x18b6('0x42')]({'where':{'id':_0x41014a}})['then'](handleEntityNotFound(_0x197874,null))[_0x18b6('0x23')](function(_0x59401c){if(_0x59401c){var _0x3ef94d=['Voice',_0x18b6('0x78'),_0x18b6('0x79'),'Sms','Fax',_0x18b6('0x7a'),'Whatsapp'];return db[_0x18b6('0x59')][_0x18b6('0x50')](function(_0x19ddff){var _0xf604d5=_[_0x18b6('0x2e')](_0x3ef94d,function(_0x2762b9){var _0x5775cd={'attributes':['id',_0x18b6('0x26')]};if(_0x2762b9===_0x18b6('0x7b')){_0x5775cd['through']={'attributes':[_0x18b6('0x7c')]};}return _0x59401c[_0x18b6('0x45')+_0x2762b9+_0x18b6('0x75')](_0x5775cd)[_0x18b6('0x23')](function(_0x4230ca){var _0x3e549d=_[_0x18b6('0x2e')](_0x4230ca,function(_0x36d9b6){var _0x298ca2=_[_0x18b6('0x2e')](_0x13ecb3,function(_0x54afe9){var _0x18deec={'where':{'UserId':_0x54afe9,[_0x2762b9+_0x18b6('0x7d')]:_0x36d9b6['id']},'transaction':_0x19ddff};if(_0x2762b9==='Voice'){_0x18deec[_0x18b6('0x7e')]={'penalty':_0x36d9b6['TeamVoiceQueue'][_0x18b6('0x7c')]};}return db['User'+_0x2762b9+_0x18b6('0x71')]['findOrCreate'](_0x18deec)[_0x18b6('0x23')](function(){socket[_0x18b6('0x7f')](_0x18b6('0x48')+_0x2762b9+_0x18b6('0x80'),{'UserId':_0x54afe9,[_0x2762b9+_0x18b6('0x7d')]:_0x36d9b6['id']});if(_0x2762b9!==_0x18b6('0x7b')){return;}return db[_0x18b6('0x81')][_0x18b6('0x3c')]({'where':{'id':_0x13ecb3,'online':0x1},'attributes':['id',_0x18b6('0x26'),_0x18b6('0x82'),_0x18b6('0x83'),_0x18b6('0x84')],'raw':!![]})[_0x18b6('0x23')](function(_0x27ae39){var _0x50eeb9=_[_0x18b6('0x2e')](_0x27ae39,function(_0x3272f7){return db[_0x18b6('0x85')][_0x18b6('0x86')]({'membername':_0x3272f7[_0x18b6('0x26')],'UserId':_0x3272f7['id'],'queue_name':_0x36d9b6[_0x18b6('0x26')],'VoiceQueueId':_0x36d9b6['id'],'interface':_['isNil'](_0x3272f7[_0x18b6('0x84')])?util[_0x18b6('0x87')](_0x18b6('0x88'),_0x3272f7[_0x18b6('0x26')]):_0x3272f7['interface'],'paused':_0x3272f7[_0x18b6('0x83')]||![],'penalty':_0x36d9b6[_0x18b6('0x89')][_0x18b6('0x7c')]},{'transaction':_0x19ddff});});return Promise['all'](_0x50eeb9);});});});return Promise['all'](_0x298ca2);});return Promise[_0x18b6('0x8a')](_0x3e549d);})[_0x18b6('0x23')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x41014a}})['then'](function(_0x1873a3){if(_0x1873a3){var _0x73382c=_[_0x18b6('0x2e')](_0x13ecb3,function(_0x52715f){db[_0x18b6('0x8b')][_0x18b6('0x86')]({'UserId':_0x52715f,'VoicePrefixId':_0x1873a3[_0x18b6('0x68')]});});return Promise['all'](_0x73382c);}});});});return Promise[_0x18b6('0x8a')](_0xf604d5)['then'](function(){return _0x59401c[_0x18b6('0x8c')](_0x13ecb3,{'transaction':_0x19ddff})[_0x18b6('0x8d')](function(_0x314413){return _0x314413;});});});}})['then'](respondWithResult(_0x197874,null))[_0x18b6('0x43')](handleError(_0x197874,null));};exports['removeAgents']=function(_0x489055,_0x5c7123){var _0x5cb7cb=_[_0x18b6('0x77')](_0x489055[_0x18b6('0x2f')][_0x18b6('0x76')])?_0x489055['query'][_0x18b6('0x76')]:[_0x489055[_0x18b6('0x2f')][_0x18b6('0x76')]];var _0x2fdd9a=_0x489055[_0x18b6('0x3f')]['id'];return db[_0x18b6('0x28')][_0x18b6('0x42')]({'where':{'id':_0x2fdd9a}})[_0x18b6('0x23')](handleEntityNotFound(_0x5c7123,null))[_0x18b6('0x23')](function(_0xf8be91){if(_0xf8be91){var _0x287d4c=[_0x18b6('0x7b'),'Chat',_0x18b6('0x79'),_0x18b6('0x8e'),_0x18b6('0x8f'),_0x18b6('0x7a'),'Whatsapp'];return db[_0x18b6('0x59')]['transaction'](function(_0x4e5d81){var _0x3799b0=_['map'](_0x287d4c,function(_0x206007){var _0x2be420={'attributes':['id','name']};return _0xf8be91[_0x18b6('0x45')+_0x206007+_0x18b6('0x75')](_0x2be420)[_0x18b6('0x23')](function(_0x5c4dcb){var _0xe8f80=_[_0x18b6('0x2e')](_0x5c4dcb,function(_0x132d6a){return _0x132d6a[_0x18b6('0x90')](_0x5cb7cb,{'transaction':_0x4e5d81})[_0x18b6('0x23')](function(){var _0x1a3155=_['map'](_0x5cb7cb,function(_0x528246){socket[_0x18b6('0x7f')]('user'+_0x206007+_0x18b6('0x91'),{'UserId':Number(_0x528246),[_0x206007+_0x18b6('0x7d')]:_0x132d6a['id']});if(_0x206007!=='Voice'){return;}return db[_0x18b6('0x85')][_0x18b6('0x57')]({'where':{'VoiceQueueId':_0x132d6a['id'],'UserId':_0x528246},'transaction':_0x4e5d81});});return Promise['all'](_0x1a3155);});});return Promise[_0x18b6('0x8a')](_0xe8f80);});});return Promise[_0x18b6('0x8a')](_0x3799b0)[_0x18b6('0x23')](function(){return _0xf8be91[_0x18b6('0x90')](_0x5cb7cb,{'transaction':_0x4e5d81});})[_0x18b6('0x23')](function(){return db[_0x18b6('0x67')][_0x18b6('0x6b')]({'where':{'teamId':_0x2fdd9a}})[_0x18b6('0x23')](function(_0x2eb218){if(_0x2eb218){var _0x26d611=_[_0x18b6('0x2e')](_0x5cb7cb,function(_0x3d89f5){db['UserVoicePrefix'][_0x18b6('0x57')]({'where':{'UserId':_0x3d89f5,'VoicePrefixId':_0x2eb218[_0x18b6('0x68')]}});});return Promise[_0x18b6('0x8a')](_0x26d611);}});});});}})['then'](respondWithStatusCode(_0x5c7123,null))[_0x18b6('0x43')](handleError(_0x5c7123,null));};exports[_0x18b6('0x92')]=function(_0x26d4cd,_0x32caff,_0x20711f){var _0x357938={};var _0x11860b={};var _0x451186;var _0x54a159;return db['Team'][_0x18b6('0x6b')]({'where':{'id':_0x26d4cd['params']['id']}})[_0x18b6('0x23')](handleEntityNotFound(_0x32caff,null))[_0x18b6('0x23')](function(_0xf84c8c){if(_0xf84c8c){_0x451186=_0xf84c8c;_0x11860b[_0x18b6('0x2d')]=_[_0x18b6('0x40')](db[_0x18b6('0x81')][_0x18b6('0x29')]);_0x11860b[_0x18b6('0x2f')]=_[_0x18b6('0x40')](_0x26d4cd['query']);_0x11860b['filters']=_[_0x18b6('0x31')](_0x11860b[_0x18b6('0x2d')],_0x11860b[_0x18b6('0x2f')]);_0x357938[_0x18b6('0x32')]=_[_0x18b6('0x31')](_0x11860b[_0x18b6('0x2d')],qs['fields'](_0x26d4cd[_0x18b6('0x2f')][_0x18b6('0x33')]));_0x357938['attributes']=_0x357938['attributes'][_0x18b6('0x34')]?_0x357938[_0x18b6('0x32')]:_0x11860b['model'];_0x357938[_0x18b6('0x35')]=qs[_0x18b6('0x36')](_0x26d4cd[_0x18b6('0x2f')][_0x18b6('0x36')]);_0x357938[_0x18b6('0x37')]=qs[_0x18b6('0x30')](_[_0x18b6('0x72')](_0x26d4cd[_0x18b6('0x2f')],_0x11860b['filters']));if(_0x26d4cd[_0x18b6('0x2f')]['filter']){_0x357938['where']=_[_0x18b6('0x39')](_0x357938[_0x18b6('0x37')],{'$or':_['map'](_0x357938[_0x18b6('0x32')],function(_0x2e6f1a){var _0x55fe3b={};_0x55fe3b[_0x2e6f1a]={'$like':'%'+_0x26d4cd['query'][_0x18b6('0x93')]+'%'};return _0x55fe3b;})});}_0x357938=_[_0x18b6('0x39')]({},_0x357938,_0x26d4cd[_0x18b6('0x3a')]);return _0x451186[_0x18b6('0x92')](_0x357938);}})['then'](function(_0x4b7acb){if(_0x4b7acb){_0x54a159=_0x4b7acb[_0x18b6('0x34')];if(!_0x26d4cd[_0x18b6('0x2f')][_0x18b6('0x94')](_0x18b6('0x95'))){_0x357938[_0x18b6('0x1e')]=qs[_0x18b6('0x1e')](_0x26d4cd[_0x18b6('0x2f')][_0x18b6('0x1e')]);_0x357938['offset']=qs[_0x18b6('0x1c')](_0x26d4cd[_0x18b6('0x2f')][_0x18b6('0x1c')]);}return _0x451186[_0x18b6('0x92')](_0x357938);}})[_0x18b6('0x23')](function(_0x5b9103){if(_0x5b9103){return _0x5b9103?{'count':_0x54a159,'rows':_0x5b9103}:null;}})[_0x18b6('0x23')](respondWithResult(_0x32caff,null))[_0x18b6('0x43')](handleError(_0x32caff,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e80e36c..013c828 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 _0x7fd9=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x105c69,_0x41541d){var _0x589218=function(_0xd96453){while(--_0xd96453){_0x105c69['push'](_0x105c69['shift']());}};_0x589218(++_0x41541d);}(_0x7fd9,0x8b));var _0x97fd=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0x7fd9[_0x3eef60];return _0x569efe;};'use strict';var EventEmitter=require(_0x97fd('0x0'));var Team=require(_0x97fd('0x1'))['db'][_0x97fd('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x97fd('0x3')](0x0);var events={'afterCreate':_0x97fd('0x4'),'afterUpdate':_0x97fd('0x5'),'afterDestroy':_0x97fd('0x6')};function emitEvent(_0x8e5153){return function(_0x31478f,_0x5135d7,_0x5b5709){TeamEvents[_0x97fd('0x7')](_0x8e5153+':'+_0x31478f['id'],_0x31478f);TeamEvents[_0x97fd('0x7')](_0x8e5153,_0x31478f);_0x5b5709(null);};}for(var e in events){if(events[_0x97fd('0x8')](e)){var event=events[e];Team[_0x97fd('0x9')](e,emitEvent(event));}}module[_0x97fd('0xa')]=TeamEvents; \ No newline at end of file +var _0x3979=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3979,0xeb));var _0x9397=function(_0x2daee6,_0x147b90){_0x2daee6=_0x2daee6-0x0;var _0x4c583a=_0x3979[_0x2daee6];return _0x4c583a;};'use strict';var EventEmitter=require(_0x9397('0x0'));var Team=require(_0x9397('0x1'))['db'][_0x9397('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x9397('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9397('0x4'),'afterDestroy':_0x9397('0x5')};function emitEvent(_0xd7beed){return function(_0x1a6ac6,_0x31a075,_0x5b6521){TeamEvents[_0x9397('0x6')](_0xd7beed+':'+_0x1a6ac6['id'],_0x1a6ac6);TeamEvents[_0x9397('0x6')](_0xd7beed,_0x1a6ac6);_0x5b6521(null);};}for(var e in events){if(events[_0x9397('0x7')](e)){var event=events[e];Team[_0x9397('0x8')](e,emitEvent(event));}}module[_0x9397('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3690561..a34fb33 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 _0xb557=['catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','resolve','./team.attributes','get','then','map','channel'];(function(_0x26b3bb,_0x2c7ff0){var _0x1c403a=function(_0x8b8275){while(--_0x8b8275){_0x26b3bb['push'](_0x26b3bb['shift']());}};_0x1c403a(++_0x2c7ff0);}(_0xb557,0x136));var _0x7b55=function(_0x5c506f,_0xd51883){_0x5c506f=_0x5c506f-0x0;var _0x4186c2=_0xb557[_0x5c506f];return _0x4186c2;};'use strict';var _=require('lodash');var attributes=require(_0x7b55('0x0'));function getQueuesByChannel(_0x559a20,_0x55b79f){var _0x17d9cb=_0x7b55('0x1')+_0x55b79f+'Queues';return _0x559a20[_0x17d9cb]()[_0x7b55('0x2')](function(_0x43cebf){return _[_0x7b55('0x3')](_0x43cebf,function(_0x503f22){_0x503f22['setDataValue'](_0x7b55('0x4'),_0x55b79f);return _0x503f22;});})[_0x7b55('0x5')](function(_0x1489a8){throw _0x1489a8;});}module[_0x7b55('0x6')]=function(_0x3f93eb){return _0x3f93eb[_0x7b55('0x7')](_0x7b55('0x8'),attributes,{'tableName':_0x7b55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x63f162=this;var _0x57f78f=[_0x7b55('0xa'),_0x7b55('0xb'),_0x7b55('0xc'),'Openchannel',_0x7b55('0xd'),'Voice','Whatsapp'];return Promise[_0x7b55('0xe')]()[_0x7b55('0x2')](function(){var _0x5e386c=_[_0x7b55('0x3')](_0x57f78f,function(_0xe35a1e){return getQueuesByChannel(_0x63f162,_0xe35a1e);});return Promise['all'](_0x5e386c);})[_0x7b55('0x5')](function(_0x5360e4){throw _0x5360e4;});}}});}; \ No newline at end of file +var _0x4583=['channel','catch','exports','teams','Chat','Mail','Sms','Voice','Whatsapp','all','lodash','./team.attributes','get','then','setDataValue'];(function(_0x15ec89,_0x3776a8){var _0x4fb044=function(_0x127767){while(--_0x127767){_0x15ec89['push'](_0x15ec89['shift']());}};_0x4fb044(++_0x3776a8);}(_0x4583,0xcd));var _0x3458=function(_0x22bc9c,_0x43c887){_0x22bc9c=_0x22bc9c-0x0;var _0x3da773=_0x4583[_0x22bc9c];return _0x3da773;};'use strict';var _=require(_0x3458('0x0'));var attributes=require(_0x3458('0x1'));function getQueuesByChannel(_0x3010f7,_0x49c72b){var _0x3c185d=_0x3458('0x2')+_0x49c72b+'Queues';return _0x3010f7[_0x3c185d]()[_0x3458('0x3')](function(_0x54e842){return _['map'](_0x54e842,function(_0x5136ba){_0x5136ba[_0x3458('0x4')](_0x3458('0x5'),_0x49c72b);return _0x5136ba;});})[_0x3458('0x6')](function(_0x1f2a20){throw _0x1f2a20;});}module[_0x3458('0x7')]=function(_0x313fb6){return _0x313fb6['define']('Team',attributes,{'tableName':_0x3458('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3fc4f2=this;var _0x16b062=[_0x3458('0x9'),'Fax',_0x3458('0xa'),'Openchannel',_0x3458('0xb'),_0x3458('0xc'),_0x3458('0xd')];return Promise['resolve']()[_0x3458('0x3')](function(){var _0xa9eb79=_['map'](_0x16b062,function(_0x377a7e){return getQueuesByChannel(_0x3fc4f2,_0x377a7e);});return Promise[_0x3458('0xe')](_0xa9eb79);})[_0x3458('0x6')](function(_0x227a0f){throw _0x227a0f;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index b3c9654..06d7ffe 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 _0x1e1b=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x1bbea4,_0x2512fc){var _0xce5e9b=function(_0x308865){while(--_0x308865){_0x1bbea4['push'](_0x1bbea4['shift']());}};_0xce5e9b(++_0x2512fc);}(_0x1e1b,0x1c1));var _0xb1e1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1e1b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb1e1('0x0'));var util=require(_0xb1e1('0x1'));var moment=require(_0xb1e1('0x2'));var BPromise=require(_0xb1e1('0x3'));var rs=require(_0xb1e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1e1('0x5'));var config=require('../../config/environment');var jayson=require(_0xb1e1('0x6'));var client=jayson[_0xb1e1('0x7')][_0xb1e1('0x8')]({'port':0x232a});config[_0xb1e1('0x9')]=_[_0xb1e1('0xa')](config[_0xb1e1('0x9')],{'host':_0xb1e1('0xb'),'port':0x18eb});var socket=require(_0xb1e1('0xc'))(new Redis(config[_0xb1e1('0x9')]));require('./team.socket')[_0xb1e1('0xd')](socket);function respondWithRpcPromise(_0x5114f3,_0x1aa7b5,_0x2f1e9c){return new BPromise(function(_0x4b4e09,_0x33e822){return client[_0xb1e1('0xe')](_0x5114f3,_0x2f1e9c)[_0xb1e1('0xf')](function(_0x500384){logger[_0xb1e1('0x10')](_0xb1e1('0x11'),_0x1aa7b5,_0xb1e1('0x12'));logger['debug'](_0xb1e1('0x13'),_0x1aa7b5,_0xb1e1('0x12'),JSON[_0xb1e1('0x14')](_0x500384));if(_0x500384[_0xb1e1('0x15')]){if(_0x500384[_0xb1e1('0x15')][_0xb1e1('0x16')]===0x1f4){logger[_0xb1e1('0x15')]('Team,\x20%s,\x20%s',_0x1aa7b5,_0x500384[_0xb1e1('0x15')][_0xb1e1('0x17')]);return _0x33e822(_0x500384[_0xb1e1('0x15')][_0xb1e1('0x17')]);}logger[_0xb1e1('0x15')](_0xb1e1('0x11'),_0x1aa7b5,_0x500384[_0xb1e1('0x15')][_0xb1e1('0x17')]);return _0x4b4e09(_0x500384['error'][_0xb1e1('0x17')]);}else{logger[_0xb1e1('0x10')]('Team,\x20%s,\x20%s',_0x1aa7b5,'request\x20sent');_0x4b4e09(_0x500384[_0xb1e1('0x18')][_0xb1e1('0x17')]);}})[_0xb1e1('0x19')](function(_0x3555f9){logger[_0xb1e1('0x15')](_0xb1e1('0x11'),_0x1aa7b5,_0x3555f9);_0x33e822(_0x3555f9);});});} \ No newline at end of file +var _0x7b58=['client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x282b19,_0x30eeb0){var _0x1a083f=function(_0x5b6818){while(--_0x5b6818){_0x282b19['push'](_0x282b19['shift']());}};_0x1a083f(++_0x30eeb0);}(_0x7b58,0xe9));var _0x87b5=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0x7b58[_0x31c27f];return _0x28f9c6;};'use strict';var _=require(_0x87b5('0x0'));var util=require(_0x87b5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87b5('0x2'))['db'];var utils=require(_0x87b5('0x3'));var logger=require(_0x87b5('0x4'))(_0x87b5('0x5'));var config=require(_0x87b5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x87b5('0x7')]['http']({'port':0x232a});config[_0x87b5('0x8')]=_[_0x87b5('0x9')](config[_0x87b5('0x8')],{'host':_0x87b5('0xa'),'port':0x18eb});var socket=require(_0x87b5('0xb'))(new Redis(config[_0x87b5('0x8')]));require(_0x87b5('0xc'))[_0x87b5('0xd')](socket);function respondWithRpcPromise(_0x562932,_0x222f26,_0x332cf8){return new BPromise(function(_0x60381c,_0x116a91){return client['request'](_0x562932,_0x332cf8)[_0x87b5('0xe')](function(_0x2f1c7d){logger['info'](_0x87b5('0xf'),_0x222f26,'request\x20sent');logger[_0x87b5('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x222f26,'request\x20sent',JSON[_0x87b5('0x11')](_0x2f1c7d));if(_0x2f1c7d[_0x87b5('0x12')]){if(_0x2f1c7d[_0x87b5('0x12')][_0x87b5('0x13')]===0x1f4){logger[_0x87b5('0x12')]('Team,\x20%s,\x20%s',_0x222f26,_0x2f1c7d['error'][_0x87b5('0x14')]);return _0x116a91(_0x2f1c7d['error'][_0x87b5('0x14')]);}logger['error']('Team,\x20%s,\x20%s',_0x222f26,_0x2f1c7d[_0x87b5('0x12')][_0x87b5('0x14')]);return _0x60381c(_0x2f1c7d['error'][_0x87b5('0x14')]);}else{logger[_0x87b5('0x15')]('Team,\x20%s,\x20%s',_0x222f26,_0x87b5('0x16'));_0x60381c(_0x2f1c7d['result'][_0x87b5('0x14')]);}})[_0x87b5('0x17')](function(_0x280a4e){logger['error'](_0x87b5('0xf'),_0x222f26,_0x280a4e);_0x116a91(_0x280a4e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f616a0d..df253fe 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 _0xe5ff=['length','./team.events','save','remove','update','emit','register'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe5ff,0x197));var _0xfe5f=function(_0x18219d,_0x41a8bb){_0x18219d=_0x18219d-0x0;var _0x22993f=_0xe5ff[_0x18219d];return _0x22993f;};'use strict';var TeamEvents=require(_0xfe5f('0x0'));var events=[_0xfe5f('0x1'),_0xfe5f('0x2'),_0xfe5f('0x3')];function createListener(_0x19cbd0,_0x18967f){return function(_0x40959b){_0x18967f[_0xfe5f('0x4')](_0x19cbd0,_0x40959b);};}function removeListener(_0xb58880,_0x24b61c){return function(){TeamEvents['removeListener'](_0xb58880,_0x24b61c);};}exports[_0xfe5f('0x5')]=function(_0x36a58e){for(var _0x439ab5=0x0,_0x5db4ea=events[_0xfe5f('0x6')];_0x439ab5<_0x5db4ea;_0x439ab5++){var _0x5bef39=events[_0x439ab5];var _0x196127=createListener('team:'+_0x5bef39,_0x36a58e);TeamEvents['on'](_0x5bef39,_0x196127);}}; \ No newline at end of file +var _0xa204=['register','team:','./team.events','save','update','emit','removeListener'];(function(_0x134dd3,_0x1a1ba2){var _0x4f97ee=function(_0x25cdb5){while(--_0x25cdb5){_0x134dd3['push'](_0x134dd3['shift']());}};_0x4f97ee(++_0x1a1ba2);}(_0xa204,0x152));var _0x4a20=function(_0xe2587d,_0x18eb7c){_0xe2587d=_0xe2587d-0x0;var _0x2a922b=_0xa204[_0xe2587d];return _0x2a922b;};'use strict';var TeamEvents=require(_0x4a20('0x0'));var events=[_0x4a20('0x1'),'remove',_0x4a20('0x2')];function createListener(_0x3d1e93,_0x435705){return function(_0x50ad99){_0x435705[_0x4a20('0x3')](_0x3d1e93,_0x50ad99);};}function removeListener(_0x297877,_0x3151c7){return function(){TeamEvents[_0x4a20('0x4')](_0x297877,_0x3151c7);};}exports[_0x4a20('0x5')]=function(_0x37ef29){for(var _0x29382b=0x0,_0x2a549b=events['length'];_0x29382b<_0x2a549b;_0x29382b++){var _0x27e3ec=events[_0x29382b];var _0x31a214=createListener(_0x4a20('0x6')+_0x27e3ec,_0x37ef29);TeamEvents['on'](_0x27e3ec,_0x31a214);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index bf70931..94ae2cf 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 _0x3b46=['INTEGER','sequelize','exports'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x3b46,0x1a2));var _0x63b4=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x3b46[_0x1b8f5a];return _0x594189;};'use strict';var Sequelize=require(_0x63b4('0x0'));module[_0x63b4('0x1')]={'TeamId':{'type':Sequelize[_0x63b4('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x63b4('0x2')]}}; \ No newline at end of file +var _0xa4de=['INTEGER','sequelize'];(function(_0x45d174,_0x3be210){var _0x217f48=function(_0x4c8713){while(--_0x4c8713){_0x45d174['push'](_0x45d174['shift']());}};_0x217f48(++_0x3be210);}(_0xa4de,0x10d));var _0xea4d=function(_0x391ea5,_0x449ca0){_0x391ea5=_0x391ea5-0x0;var _0x47f4a1=_0xa4de[_0x391ea5];return _0x47f4a1;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xea4d('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 4790827..3ddc984 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 _0x180d=['moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api'];(function(_0x271567,_0x3381fc){var _0x48164f=function(_0x3d561f){while(--_0x3d561f){_0x271567['push'](_0x271567['shift']());}};_0x48164f(++_0x3381fc);}(_0x180d,0xf9));var _0xd180=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x180d[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var logger=require(_0xd180('0x1'))(_0xd180('0x2'));var moment=require(_0xd180('0x3'));var BPromise=require(_0xd180('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd180('0x5'));var rimraf=require(_0xd180('0x6'));var config=require(_0xd180('0x7'));var attributes=require(_0xd180('0x8'));module[_0xd180('0x9')]=function(_0x44cf0b,_0x570b44){return _0x44cf0b['define'](_0xd180('0xa'),attributes,{'tableName':_0xd180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7072=['exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird','rimraf','./teamVoicePrefix.attributes'];(function(_0x3c81a8,_0x349f48){var _0x2c79ac=function(_0x38491a){while(--_0x38491a){_0x3c81a8['push'](_0x3c81a8['shift']());}};_0x2c79ac(++_0x349f48);}(_0x7072,0x138));var _0x2707=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7072[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var moment=require(_0x2707('0x3'));var BPromise=require(_0x2707('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2707('0x5'));var config=require('../../config/environment');var attributes=require(_0x2707('0x6'));module[_0x2707('0x7')]=function(_0x1e86f2,_0x194132){return _0x1e86f2[_0x2707('0x8')](_0x2707('0x9'),attributes,{'tableName':_0x2707('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index a4b77c2..ffe0887 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x382445,_0x5727ac){var _0x4219cb=function(_0x25bc48){while(--_0x25bc48){_0x382445['push'](_0x382445['shift']());}};_0x4219cb(++_0x5727ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3e64ed,_0x491816){var _0x14d8bc=function(_0x171983){while(--_0x171983){_0x3e64ed['push'](_0x3e64ed['shift']());}};_0x14d8bc(++_0x491816);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index ad0f41d..d513cac 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 _0x2228=['INTEGER'];(function(_0x396432,_0x225220){var _0x587fd7=function(_0x13760a){while(--_0x13760a){_0x396432['push'](_0x396432['shift']());}};_0x587fd7(++_0x225220);}(_0x2228,0x118));var _0x8222=function(_0x1aa533,_0x38403c){_0x1aa533=_0x1aa533-0x0;var _0x4ef525=_0x2228[_0x1aa533];return _0x4ef525;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x8222('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x39e0=['INTEGER'];(function(_0x467aa2,_0x2ab1d0){var _0x4bc4cf=function(_0x1d33ea){while(--_0x1d33ea){_0x467aa2['push'](_0x467aa2['shift']());}};_0x4bc4cf(++_0x2ab1d0);}(_0x39e0,0x1c5));var _0x039e=function(_0x20868d,_0x5eb699){_0x20868d=_0x20868d-0x0;var _0x270b30=_0x39e0[_0x20868d];return _0x270b30;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x039e('0x0')],'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 60070b6..73dcdf2 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 _0x2fda=['lodash','api','moment','bluebird','request-promise','path','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x191835,_0x32eb4c){var _0x26ad18=function(_0x3d5fe3){while(--_0x3d5fe3){_0x191835['push'](_0x191835['shift']());}};_0x26ad18(++_0x32eb4c);}(_0x2fda,0x186));var _0xa2fd=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x2fda[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xa2fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2fd('0x1'));var moment=require(_0xa2fd('0x2'));var BPromise=require(_0xa2fd('0x3'));var rp=require(_0xa2fd('0x4'));var fs=require('fs');var path=require(_0xa2fd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xa2fd('0x6')]=function(_0x1bab5a,_0x4c6b0b){return _0x1bab5a[_0xa2fd('0x7')](_0xa2fd('0x8'),attributes,{'tableName':_0xa2fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae79=['../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x364db7,_0x58e709){var _0x2b2476=function(_0x5dc765){while(--_0x5dc765){_0x364db7['push'](_0x364db7['shift']());}};_0x2b2476(++_0x58e709);}(_0xae79,0x1d3));var _0x9ae7=function(_0x1519cf,_0x37118b){_0x1519cf=_0x1519cf-0x0;var _0x1e55a0=_0xae79[_0x1519cf];return _0x1e55a0;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var BPromise=require(_0x9ae7('0x5'));var rp=require(_0x9ae7('0x6'));var fs=require('fs');var path=require(_0x9ae7('0x7'));var rimraf=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var attributes=require(_0x9ae7('0xa'));module[_0x9ae7('0xb')]=function(_0x3e98cf,_0x396863){return _0x3e98cf[_0x9ae7('0xc')]('TeamVoiceQueue',attributes,{'tableName':_0x9ae7('0xd'),'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 3ca50d8..afc80cd 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 _0xf7df=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x181540,_0x19c119){var _0xc77e05=function(_0x196d7e){while(--_0x196d7e){_0x181540['push'](_0x181540['shift']());}};_0xc77e05(++_0x19c119);}(_0xf7df,0x10e));var _0xff7d=function(_0x256aa4,_0x123bd0){_0x256aa4=_0x256aa4-0x0;var _0x35f56f=_0xf7df[_0x256aa4];return _0x35f56f;};'use strict';var _=require(_0xff7d('0x0'));var util=require('util');var moment=require(_0xff7d('0x1'));var BPromise=require(_0xff7d('0x2'));var rs=require(_0xff7d('0x3'));var fs=require('fs');var Redis=require(_0xff7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff7d('0x5'));var logger=require('../../config/logger')(_0xff7d('0x6'));var config=require(_0xff7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff7d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526150,_0xbf82e,_0x118c8f){return new BPromise(function(_0x174f46,_0x358670){return client[_0xff7d('0x9')](_0x526150,_0x118c8f)[_0xff7d('0xa')](function(_0x4c13ae){logger[_0xff7d('0xb')](_0xff7d('0xc'),_0xbf82e,_0xff7d('0xd'));logger[_0xff7d('0xe')](_0xff7d('0xf'),_0xbf82e,_0xff7d('0xd'),JSON[_0xff7d('0x10')](_0x4c13ae));if(_0x4c13ae[_0xff7d('0x11')]){if(_0x4c13ae[_0xff7d('0x11')][_0xff7d('0x12')]===0x1f4){logger[_0xff7d('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xbf82e,_0x4c13ae[_0xff7d('0x11')][_0xff7d('0x13')]);return _0x358670(_0x4c13ae['error'][_0xff7d('0x13')]);}logger[_0xff7d('0x11')](_0xff7d('0xc'),_0xbf82e,_0x4c13ae[_0xff7d('0x11')][_0xff7d('0x13')]);return _0x174f46(_0x4c13ae[_0xff7d('0x11')]['message']);}else{logger[_0xff7d('0xb')](_0xff7d('0xc'),_0xbf82e,_0xff7d('0xd'));_0x174f46(_0x4c13ae[_0xff7d('0x14')][_0xff7d('0x13')]);}})[_0xff7d('0x15')](function(_0x33de89){logger[_0xff7d('0x11')](_0xff7d('0xc'),_0xbf82e,_0x33de89);_0x358670(_0x33de89);});});} \ No newline at end of file +var _0xe058=['jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe058,0x109));var _0x8e05=function(_0x8dc2a2,_0x14dd21){_0x8dc2a2=_0x8dc2a2-0x0;var _0x429944=_0xe058[_0x8dc2a2];return _0x429944;};'use strict';var _=require('lodash');var util=require(_0x8e05('0x0'));var moment=require(_0x8e05('0x1'));var BPromise=require(_0x8e05('0x2'));var rs=require(_0x8e05('0x3'));var fs=require('fs');var Redis=require(_0x8e05('0x4'));var db=require(_0x8e05('0x5'))['db'];var utils=require(_0x8e05('0x6'));var logger=require(_0x8e05('0x7'))(_0x8e05('0x8'));var config=require(_0x8e05('0x9'));var jayson=require(_0x8e05('0xa'));var client=jayson[_0x8e05('0xb')][_0x8e05('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f8a0f,_0x2abbce,_0xcc5164){return new BPromise(function(_0x364342,_0x4661c3){return client[_0x8e05('0xd')](_0x3f8a0f,_0xcc5164)[_0x8e05('0xe')](function(_0x39d4cd){logger['info'](_0x8e05('0xf'),_0x2abbce,_0x8e05('0x10'));logger[_0x8e05('0x11')](_0x8e05('0x12'),_0x2abbce,_0x8e05('0x10'),JSON[_0x8e05('0x13')](_0x39d4cd));if(_0x39d4cd[_0x8e05('0x14')]){if(_0x39d4cd[_0x8e05('0x14')][_0x8e05('0x15')]===0x1f4){logger[_0x8e05('0x14')](_0x8e05('0xf'),_0x2abbce,_0x39d4cd[_0x8e05('0x14')][_0x8e05('0x16')]);return _0x4661c3(_0x39d4cd[_0x8e05('0x14')]['message']);}logger[_0x8e05('0x14')](_0x8e05('0xf'),_0x2abbce,_0x39d4cd[_0x8e05('0x14')][_0x8e05('0x16')]);return _0x364342(_0x39d4cd['error'][_0x8e05('0x16')]);}else{logger[_0x8e05('0x17')](_0x8e05('0xf'),_0x2abbce,_0x8e05('0x10'));_0x364342(_0x39d4cd[_0x8e05('0x18')][_0x8e05('0x16')]);}})['catch'](function(_0x2a47a5){logger['error'](_0x8e05('0xf'),_0x2abbce,_0x2a47a5);_0x4661c3(_0x2a47a5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 51f80ff..9d3f220 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 _0x022a=['./template.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x022a,0x1f0));var _0xa022=function(_0x396e83,_0x2d51e2){_0x396e83=_0x396e83-0x0;var _0x4a42cc=_0x022a[_0x396e83];return _0x4a42cc;};'use strict';var multer=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var path=require(_0xa022('0x2'));var timeout=require(_0xa022('0x3'));var express=require(_0xa022('0x4'));var router=express[_0xa022('0x5')]();var fs_extra=require(_0xa022('0x6'));var auth=require(_0xa022('0x7'));var interaction=require(_0xa022('0x8'));var config=require(_0xa022('0x9'));var controller=require(_0xa022('0xa'));router[_0xa022('0xb')]('/',auth['isAuthenticated'](),controller[_0xa022('0xc')]);router['get']('/:id',auth[_0xa022('0xd')](),controller[_0xa022('0xe')]);router[_0xa022('0xf')]('/',auth[_0xa022('0xd')](),controller[_0xa022('0x10')]);router[_0xa022('0x11')](_0xa022('0x12'),auth['isAuthenticated'](),controller[_0xa022('0x13')]);router[_0xa022('0x14')](_0xa022('0x12'),auth['isAuthenticated'](),controller[_0xa022('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd959=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ad698,_0x43aba1){var _0x560d8f=function(_0x4492dd){while(--_0x4492dd){_0x5ad698['push'](_0x5ad698['shift']());}};_0x560d8f(++_0x43aba1);}(_0xd959,0x94));var _0x9d95=function(_0x3e6546,_0xd247d5){_0x3e6546=_0x3e6546-0x0;var _0x1da964=_0xd959[_0x3e6546];return _0x1da964;};'use strict';var multer=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var path=require(_0x9d95('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d95('0x3'));var router=express[_0x9d95('0x4')]();var fs_extra=require(_0x9d95('0x5'));var auth=require(_0x9d95('0x6'));var interaction=require(_0x9d95('0x7'));var config=require('../../config/environment');var controller=require(_0x9d95('0x8'));router[_0x9d95('0x9')]('/',auth[_0x9d95('0xa')](),controller[_0x9d95('0xb')]);router['get'](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xd')]);router['post']('/',auth[_0x9d95('0xa')](),controller['create']);router[_0x9d95('0xe')](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xf')]);router[_0x9d95('0x10')]('/:id',auth[_0x9d95('0xa')](),controller[_0x9d95('0x11')]);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 4e77ce0..3fc3ced 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 _0xd626=['sequelize','exports','STRING'];(function(_0x2c7e3d,_0x224968){var _0x4a27d6=function(_0x190e6c){while(--_0x190e6c){_0x2c7e3d['push'](_0x2c7e3d['shift']());}};_0x4a27d6(++_0x224968);}(_0xd626,0x1a4));var _0x6d62=function(_0x541fca,_0x318cd5){_0x541fca=_0x541fca-0x0;var _0x3998db=_0xd626[_0x541fca];return _0x3998db;};'use strict';var Sequelize=require(_0x6d62('0x0'));module[_0x6d62('0x1')]={'name':{'type':Sequelize[_0x6d62('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x73ab=['STRING','TEXT','sequelize'];(function(_0x27cdb8,_0x105c3c){var _0x172ea5=function(_0x293844){while(--_0x293844){_0x27cdb8['push'](_0x27cdb8['shift']());}};_0x172ea5(++_0x105c3c);}(_0x73ab,0x1d9));var _0xb73a=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x73ab[_0x104a84];return _0x4973ff;};'use strict';var Sequelize=require(_0xb73a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb73a('0x1')]},'description':{'type':Sequelize[_0xb73a('0x1')]},'html':{'type':Sequelize[_0xb73a('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 63ca3e7..d1c31d0 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 _0x6744=['user','role','UserProfileSection','userProfileId','body','params','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','type','VIRTUAL','options','Template','include','findAll','rows','catch','show','keys','includeAll','find','create'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x6744,0x1c8));var _0x4674=function(_0x5d2aac,_0x1c3b8f){_0x5d2aac=_0x5d2aac-0x0;var _0x281789=_0x6744[_0x5d2aac];return _0x281789;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4674('0x0'));var zipdir=require(_0x4674('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4674('0x2'));var moment=require(_0x4674('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4674('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4674('0x5'));var ejs=require(_0x4674('0x6'));var fs=require('fs');var fs_extra=require(_0x4674('0x7'));var _=require(_0x4674('0x8'));var squel=require('squel');var crypto=require(_0x4674('0x9'));var jsforce=require(_0x4674('0xa'));var deskjs=require(_0x4674('0xb'));var toCsv=require(_0x4674('0x5'));var querystring=require(_0x4674('0xc'));var Papa=require(_0x4674('0xd'));var Redis=require(_0x4674('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4674('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4674('0x10'));var logger=require('../../config/logger')(_0x4674('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4674('0x12'));var db=require(_0x4674('0x13'))['db'];function respondWithStatusCode(_0x5b9109,_0x3f9c6b){_0x3f9c6b=_0x3f9c6b||0xcc;return function(_0x1c7cd8){if(_0x1c7cd8){return _0x5b9109[_0x4674('0x14')](_0x3f9c6b);}return _0x5b9109[_0x4674('0x15')](_0x3f9c6b)[_0x4674('0x16')]();};}function respondWithResult(_0x2122e1,_0x12abf1){_0x12abf1=_0x12abf1||0xc8;return function(_0x1ce990){if(_0x1ce990){return _0x2122e1['status'](_0x12abf1)[_0x4674('0x17')](_0x1ce990);}};}function respondWithFilteredResult(_0x2a9eaf,_0x1e37ba){return function(_0x3892b6){if(_0x3892b6){var _0x2a5668=typeof _0x1e37ba['offset']==='undefined'&&typeof _0x1e37ba[_0x4674('0x18')]===_0x4674('0x19');var _0x271be5=_0x3892b6[_0x4674('0x1a')];var _0x273b2b=_0x2a5668?0x0:_0x1e37ba[_0x4674('0x1b')];var _0x35e159=_0x2a5668?_0x3892b6[_0x4674('0x1a')]:_0x1e37ba[_0x4674('0x1b')]+_0x1e37ba['limit'];var _0x169d20;if(_0x35e159>=_0x271be5){_0x35e159=_0x271be5;_0x169d20=0xc8;}else{_0x169d20=0xce;}_0x2a9eaf[_0x4674('0x15')](_0x169d20);return _0x2a9eaf[_0x4674('0x1c')](_0x4674('0x1d'),_0x273b2b+'-'+_0x35e159+'/'+_0x271be5)[_0x4674('0x17')](_0x3892b6);}return null;};}function patchUpdates(_0x4512eb){return function(_0x59da18){try{jsonpatch[_0x4674('0x1e')](_0x59da18,_0x4512eb,!![]);}catch(_0xb11b09){return BPromise['reject'](_0xb11b09);}return _0x59da18[_0x4674('0x1f')]();};}function saveUpdates(_0x68a460,_0x103ca6){return function(_0x25cd91){if(_0x25cd91){return _0x25cd91[_0x4674('0x20')](_0x68a460)[_0x4674('0x21')](function(_0x587907){return _0x587907;});}return null;};}function removeEntity(_0x13d272,_0xbb3f3c){return function(_0xace316){if(_0xace316){return _0xace316[_0x4674('0x22')]()[_0x4674('0x21')](function(){var _0x5c0df2=_0xace316[_0x4674('0x23')]({'plain':!![]});var _0xd42371=_0x4674('0x24');return db[_0x4674('0x25')]['destroy']({'where':{'type':_0xd42371,'resourceId':_0x5c0df2['id']}})[_0x4674('0x21')](function(){return _0xace316;});})[_0x4674('0x21')](function(){_0x13d272['status'](0xcc)[_0x4674('0x16')]();});}};}function handleEntityNotFound(_0x39d450,_0x1f9b4e){return function(_0x537321){if(!_0x537321){_0x39d450[_0x4674('0x14')](0x194);}return _0x537321;};}function handleError(_0x21541f,_0x407ceb){_0x407ceb=_0x407ceb||0x1f4;return function(_0x487386){logger[_0x4674('0x26')](_0x487386['stack']);if(_0x487386[_0x4674('0x27')]){delete _0x487386[_0x4674('0x27')];}_0x21541f[_0x4674('0x15')](_0x407ceb)[_0x4674('0x28')](_0x487386);};}exports[_0x4674('0x29')]=function(_0xc08b17,_0x2dff6b){var _0x382e2a={},_0x4407ab={},_0x140e55={'count':0x0,'rows':[]};var _0x361d6c=_[_0x4674('0x2a')](db['Template'][_0x4674('0x2b')],function(_0x17af3c){return{'name':_0x17af3c[_0x4674('0x2c')],'type':_0x17af3c['type']['key']};});_0x4407ab[_0x4674('0x2d')]=_[_0x4674('0x2a')](_0x361d6c,_0x4674('0x27'));_0x4407ab[_0x4674('0x2e')]=_['keys'](_0xc08b17[_0x4674('0x2e')]);_0x4407ab[_0x4674('0x2f')]=_[_0x4674('0x30')](_0x4407ab[_0x4674('0x2d')],_0x4407ab[_0x4674('0x2e')]);_0x382e2a[_0x4674('0x31')]=_[_0x4674('0x30')](_0x4407ab[_0x4674('0x2d')],qs[_0x4674('0x32')](_0xc08b17[_0x4674('0x2e')][_0x4674('0x32')]));_0x382e2a[_0x4674('0x31')]=_0x382e2a[_0x4674('0x31')][_0x4674('0x33')]?_0x382e2a[_0x4674('0x31')]:_0x4407ab[_0x4674('0x2d')];if(!_0xc08b17[_0x4674('0x2e')]['hasOwnProperty']('nolimit')){_0x382e2a[_0x4674('0x18')]=qs['limit'](_0xc08b17[_0x4674('0x2e')][_0x4674('0x18')]);_0x382e2a['offset']=qs[_0x4674('0x1b')](_0xc08b17['query'][_0x4674('0x1b')]);}_0x382e2a['order']=qs[_0x4674('0x34')](_0xc08b17[_0x4674('0x2e')]['sort']);_0x382e2a[_0x4674('0x35')]=qs[_0x4674('0x2f')](_[_0x4674('0x36')](_0xc08b17['query'],_0x4407ab[_0x4674('0x2f')]),_0x361d6c);if(_0xc08b17[_0x4674('0x2e')][_0x4674('0x37')]){_0x382e2a['where']=_['merge'](_0x382e2a[_0x4674('0x35')],{'$or':_[_0x4674('0x2a')](_0x361d6c,function(_0x57b4ff){if(_0x57b4ff[_0x4674('0x38')]!==_0x4674('0x39')){var _0x1d3c0f={};_0x1d3c0f[_0x57b4ff[_0x4674('0x27')]]={'$like':'%'+_0xc08b17[_0x4674('0x2e')][_0x4674('0x37')]+'%'};return _0x1d3c0f;}})});}_0x382e2a=_['merge']({},_0x382e2a,_0xc08b17[_0x4674('0x3a')]);var _0x4a3461={'where':_0x382e2a[_0x4674('0x35')]};return db[_0x4674('0x3b')][_0x4674('0x1a')](_0x4a3461)[_0x4674('0x21')](function(_0x40ddc1){_0x140e55[_0x4674('0x1a')]=_0x40ddc1;if(_0xc08b17[_0x4674('0x2e')]['includeAll']){_0x382e2a[_0x4674('0x3c')]=[{'all':!![]}];}return db[_0x4674('0x3b')][_0x4674('0x3d')](_0x382e2a);})[_0x4674('0x21')](function(_0x37bc3f){_0x140e55[_0x4674('0x3e')]=_0x37bc3f;return _0x140e55;})['then'](respondWithFilteredResult(_0x2dff6b,_0x382e2a))[_0x4674('0x3f')](handleError(_0x2dff6b,null));};exports[_0x4674('0x40')]=function(_0x36909c,_0x402768){var _0x2eff1e={'raw':!![],'where':{'id':_0x36909c['params']['id']}},_0x24631b={};_0x24631b['model']=_[_0x4674('0x41')](db[_0x4674('0x3b')][_0x4674('0x2b')]);_0x24631b[_0x4674('0x2e')]=_[_0x4674('0x41')](_0x36909c[_0x4674('0x2e')]);_0x24631b['filters']=_[_0x4674('0x30')](_0x24631b['model'],_0x24631b[_0x4674('0x2e')]);_0x2eff1e[_0x4674('0x31')]=_['intersection'](_0x24631b[_0x4674('0x2d')],qs[_0x4674('0x32')](_0x36909c['query'][_0x4674('0x32')]));_0x2eff1e[_0x4674('0x31')]=_0x2eff1e['attributes'][_0x4674('0x33')]?_0x2eff1e[_0x4674('0x31')]:_0x24631b[_0x4674('0x2d')];if(_0x36909c[_0x4674('0x2e')][_0x4674('0x42')]){_0x2eff1e[_0x4674('0x3c')]=[{'all':!![]}];}_0x2eff1e=_['merge']({},_0x2eff1e,_0x36909c[_0x4674('0x3a')]);return db[_0x4674('0x3b')][_0x4674('0x43')](_0x2eff1e)[_0x4674('0x21')](handleEntityNotFound(_0x402768,null))[_0x4674('0x21')](respondWithResult(_0x402768,null))[_0x4674('0x3f')](handleError(_0x402768,null));};exports[_0x4674('0x44')]=function(_0x401a4e,_0x3fcb72){return db[_0x4674('0x3b')]['create'](_0x401a4e['body'],{})[_0x4674('0x21')](function(_0x436669){var _0x40a5d3=_0x401a4e[_0x4674('0x45')][_0x4674('0x23')]({'plain':!![]});if(!_0x40a5d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a5d3[_0x4674('0x46')]===_0x4674('0x45')){var _0x3b7326=_0x436669[_0x4674('0x23')]({'plain':!![]});var _0x302948=_0x4674('0x24');return db[_0x4674('0x47')]['find']({'where':{'name':_0x302948,'userProfileId':_0x40a5d3[_0x4674('0x48')]},'raw':!![]})[_0x4674('0x21')](function(_0x52b3c9){if(_0x52b3c9&&_0x52b3c9['autoAssociation']===0x0){return db['UserProfileResource'][_0x4674('0x44')]({'name':_0x3b7326['name'],'resourceId':_0x3b7326['id'],'type':_0x52b3c9[_0x4674('0x27')],'sectionId':_0x52b3c9['id']},{})['then'](function(){return _0x436669;});}else{return _0x436669;}})[_0x4674('0x3f')](function(_0x19e1f3){logger[_0x4674('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19e1f3);throw _0x19e1f3;});}return _0x436669;})['then'](respondWithResult(_0x3fcb72,0xc9))[_0x4674('0x3f')](handleError(_0x3fcb72,null));};exports[_0x4674('0x20')]=function(_0x28861d,_0x3d0876){if(_0x28861d[_0x4674('0x49')]['id']){delete _0x28861d[_0x4674('0x49')]['id'];}return db[_0x4674('0x3b')][_0x4674('0x43')]({'where':{'id':_0x28861d[_0x4674('0x4a')]['id']}})[_0x4674('0x21')](handleEntityNotFound(_0x3d0876,null))[_0x4674('0x21')](saveUpdates(_0x28861d['body'],null))[_0x4674('0x21')](respondWithResult(_0x3d0876,null))['catch'](handleError(_0x3d0876,null));};exports['destroy']=function(_0x1a611a,_0x58e79d){return db[_0x4674('0x3b')][_0x4674('0x43')]({'where':{'id':_0x1a611a[_0x4674('0x4a')]['id']}})[_0x4674('0x21')](handleEntityNotFound(_0x58e79d,null))[_0x4674('0x21')](removeEntity(_0x58e79d,null))[_0x4674('0x3f')](handleError(_0x58e79d,null));}; \ No newline at end of file +var _0x09a1=['crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','get','Templates','stack','name','send','Template','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x47579e,_0x531445){var _0x27500b=function(_0x4a5406){while(--_0x4a5406){_0x47579e['push'](_0x47579e['shift']());}};_0x27500b(++_0x531445);}(_0x09a1,0x180));var _0x109a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x09a1[_0x87b0ff];return _0x3bc0b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x109a('0x0'));var zipdir=require(_0x109a('0x1'));var jsonpatch=require(_0x109a('0x2'));var rp=require('request-promise');var moment=require(_0x109a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x109a('0x4'));var path=require(_0x109a('0x5'));var sox=require('sox');var csv=require(_0x109a('0x6'));var ejs=require(_0x109a('0x7'));var fs=require('fs');var fs_extra=require(_0x109a('0x8'));var _=require(_0x109a('0x9'));var squel=require(_0x109a('0xa'));var crypto=require(_0x109a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x109a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x109a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x109a('0xe'));var as=require(_0x109a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x109a('0x10'))(_0x109a('0x11'));var utils=require(_0x109a('0x12'));var config=require(_0x109a('0x13'));var licenseUtil=require(_0x109a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23063c,_0x31b230){_0x31b230=_0x31b230||0xcc;return function(_0x4c923a){if(_0x4c923a){return _0x23063c[_0x109a('0x15')](_0x31b230);}return _0x23063c[_0x109a('0x16')](_0x31b230)[_0x109a('0x17')]();};}function respondWithResult(_0x1ae37f,_0xef95aa){_0xef95aa=_0xef95aa||0xc8;return function(_0x2ceca6){if(_0x2ceca6){return _0x1ae37f[_0x109a('0x16')](_0xef95aa)['json'](_0x2ceca6);}};}function respondWithFilteredResult(_0x2ccbe3,_0x5ad3cd){return function(_0x2d91e0){if(_0x2d91e0){var _0x35707f=typeof _0x5ad3cd[_0x109a('0x18')]===_0x109a('0x19')&&typeof _0x5ad3cd['limit']===_0x109a('0x19');var _0x3d3644=_0x2d91e0['count'];var _0x1bfb67=_0x35707f?0x0:_0x5ad3cd[_0x109a('0x18')];var _0x55502e=_0x35707f?_0x2d91e0[_0x109a('0x1a')]:_0x5ad3cd[_0x109a('0x18')]+_0x5ad3cd[_0x109a('0x1b')];var _0x42a3fa;if(_0x55502e>=_0x3d3644){_0x55502e=_0x3d3644;_0x42a3fa=0xc8;}else{_0x42a3fa=0xce;}_0x2ccbe3[_0x109a('0x16')](_0x42a3fa);return _0x2ccbe3[_0x109a('0x1c')]('Content-Range',_0x1bfb67+'-'+_0x55502e+'/'+_0x3d3644)[_0x109a('0x1d')](_0x2d91e0);}return null;};}function patchUpdates(_0x412ed9){return function(_0x3cd9e4){try{jsonpatch[_0x109a('0x1e')](_0x3cd9e4,_0x412ed9,!![]);}catch(_0x43b734){return BPromise[_0x109a('0x1f')](_0x43b734);}return _0x3cd9e4[_0x109a('0x20')]();};}function saveUpdates(_0x3ef733,_0x192fee){return function(_0x51900c){if(_0x51900c){return _0x51900c['update'](_0x3ef733)[_0x109a('0x21')](function(_0x2a910e){return _0x2a910e;});}return null;};}function removeEntity(_0xdb2019,_0x148377){return function(_0x5a49ab){if(_0x5a49ab){return _0x5a49ab[_0x109a('0x22')]()['then'](function(){var _0x98861e=_0x5a49ab[_0x109a('0x23')]({'plain':!![]});var _0x406ec6=_0x109a('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x406ec6,'resourceId':_0x98861e['id']}})['then'](function(){return _0x5a49ab;});})['then'](function(){_0xdb2019['status'](0xcc)[_0x109a('0x17')]();});}};}function handleEntityNotFound(_0x435a26,_0x30c657){return function(_0x4a23a4){if(!_0x4a23a4){_0x435a26[_0x109a('0x15')](0x194);}return _0x4a23a4;};}function handleError(_0x4713bb,_0x29b535){_0x29b535=_0x29b535||0x1f4;return function(_0x23227e){logger['error'](_0x23227e[_0x109a('0x25')]);if(_0x23227e[_0x109a('0x26')]){delete _0x23227e['name'];}_0x4713bb[_0x109a('0x16')](_0x29b535)[_0x109a('0x27')](_0x23227e);};}exports['index']=function(_0x4326b2,_0x1e175e){var _0x2f8b34={},_0x9076bc={},_0x153641={'count':0x0,'rows':[]};var _0x13d2b7=_['map'](db[_0x109a('0x28')]['rawAttributes'],function(_0x40fcba){return{'name':_0x40fcba[_0x109a('0x29')],'type':_0x40fcba[_0x109a('0x2a')][_0x109a('0x2b')]};});_0x9076bc[_0x109a('0x2c')]=_[_0x109a('0x2d')](_0x13d2b7,_0x109a('0x26'));_0x9076bc[_0x109a('0x2e')]=_[_0x109a('0x2f')](_0x4326b2['query']);_0x9076bc[_0x109a('0x30')]=_[_0x109a('0x31')](_0x9076bc[_0x109a('0x2c')],_0x9076bc[_0x109a('0x2e')]);_0x2f8b34[_0x109a('0x32')]=_[_0x109a('0x31')](_0x9076bc[_0x109a('0x2c')],qs[_0x109a('0x33')](_0x4326b2[_0x109a('0x2e')][_0x109a('0x33')]));_0x2f8b34['attributes']=_0x2f8b34[_0x109a('0x32')]['length']?_0x2f8b34[_0x109a('0x32')]:_0x9076bc[_0x109a('0x2c')];if(!_0x4326b2[_0x109a('0x2e')][_0x109a('0x34')](_0x109a('0x35'))){_0x2f8b34[_0x109a('0x1b')]=qs['limit'](_0x4326b2[_0x109a('0x2e')][_0x109a('0x1b')]);_0x2f8b34[_0x109a('0x18')]=qs[_0x109a('0x18')](_0x4326b2['query'][_0x109a('0x18')]);}_0x2f8b34[_0x109a('0x36')]=qs[_0x109a('0x37')](_0x4326b2[_0x109a('0x2e')][_0x109a('0x37')]);_0x2f8b34[_0x109a('0x38')]=qs['filters'](_[_0x109a('0x39')](_0x4326b2[_0x109a('0x2e')],_0x9076bc['filters']),_0x13d2b7);if(_0x4326b2['query']['filter']){_0x2f8b34['where']=_[_0x109a('0x3a')](_0x2f8b34[_0x109a('0x38')],{'$or':_['map'](_0x13d2b7,function(_0x5d6c4f){if(_0x5d6c4f[_0x109a('0x2a')]!==_0x109a('0x3b')){var _0x115d76={};_0x115d76[_0x5d6c4f[_0x109a('0x26')]]={'$like':'%'+_0x4326b2[_0x109a('0x2e')]['filter']+'%'};return _0x115d76;}})});}_0x2f8b34=_[_0x109a('0x3a')]({},_0x2f8b34,_0x4326b2['options']);var _0x2a0f26={'where':_0x2f8b34[_0x109a('0x38')]};return db[_0x109a('0x28')][_0x109a('0x1a')](_0x2a0f26)[_0x109a('0x21')](function(_0x6dfbec){_0x153641[_0x109a('0x1a')]=_0x6dfbec;if(_0x4326b2[_0x109a('0x2e')][_0x109a('0x3c')]){_0x2f8b34[_0x109a('0x3d')]=[{'all':!![]}];}return db[_0x109a('0x28')]['findAll'](_0x2f8b34);})['then'](function(_0xe0c476){_0x153641[_0x109a('0x3e')]=_0xe0c476;return _0x153641;})['then'](respondWithFilteredResult(_0x1e175e,_0x2f8b34))[_0x109a('0x3f')](handleError(_0x1e175e,null));};exports[_0x109a('0x40')]=function(_0x488a7b,_0x1bec07){var _0x54bb46={'raw':!![],'where':{'id':_0x488a7b[_0x109a('0x41')]['id']}},_0x432d16={};_0x432d16[_0x109a('0x2c')]=_[_0x109a('0x2f')](db[_0x109a('0x28')]['rawAttributes']);_0x432d16[_0x109a('0x2e')]=_[_0x109a('0x2f')](_0x488a7b['query']);_0x432d16[_0x109a('0x30')]=_[_0x109a('0x31')](_0x432d16[_0x109a('0x2c')],_0x432d16[_0x109a('0x2e')]);_0x54bb46['attributes']=_[_0x109a('0x31')](_0x432d16['model'],qs[_0x109a('0x33')](_0x488a7b[_0x109a('0x2e')][_0x109a('0x33')]));_0x54bb46[_0x109a('0x32')]=_0x54bb46[_0x109a('0x32')][_0x109a('0x42')]?_0x54bb46['attributes']:_0x432d16['model'];if(_0x488a7b[_0x109a('0x2e')]['includeAll']){_0x54bb46['include']=[{'all':!![]}];}_0x54bb46=_[_0x109a('0x3a')]({},_0x54bb46,_0x488a7b['options']);return db[_0x109a('0x28')][_0x109a('0x43')](_0x54bb46)[_0x109a('0x21')](handleEntityNotFound(_0x1bec07,null))[_0x109a('0x21')](respondWithResult(_0x1bec07,null))[_0x109a('0x3f')](handleError(_0x1bec07,null));};exports[_0x109a('0x44')]=function(_0x60339,_0x44c72b){return db['Template'][_0x109a('0x44')](_0x60339['body'],{})[_0x109a('0x21')](function(_0x6c56cb){var _0x3fb2e0=_0x60339[_0x109a('0x45')][_0x109a('0x23')]({'plain':!![]});if(!_0x3fb2e0)throw new Error(_0x109a('0x46'));if(_0x3fb2e0[_0x109a('0x47')]===_0x109a('0x45')){var _0x2c5084=_0x6c56cb['get']({'plain':!![]});var _0x36f22c='Templates';return db[_0x109a('0x48')][_0x109a('0x43')]({'where':{'name':_0x36f22c,'userProfileId':_0x3fb2e0[_0x109a('0x49')]},'raw':!![]})[_0x109a('0x21')](function(_0x2caf0d){if(_0x2caf0d&&_0x2caf0d[_0x109a('0x4a')]===0x0){return db['UserProfileResource'][_0x109a('0x44')]({'name':_0x2c5084['name'],'resourceId':_0x2c5084['id'],'type':_0x2caf0d[_0x109a('0x26')],'sectionId':_0x2caf0d['id']},{})[_0x109a('0x21')](function(){return _0x6c56cb;});}else{return _0x6c56cb;}})['catch'](function(_0x5e29a1){logger[_0x109a('0x4b')](_0x109a('0x4c'),_0x5e29a1);throw _0x5e29a1;});}return _0x6c56cb;})[_0x109a('0x21')](respondWithResult(_0x44c72b,0xc9))[_0x109a('0x3f')](handleError(_0x44c72b,null));};exports[_0x109a('0x4d')]=function(_0x476c13,_0xe81884){if(_0x476c13[_0x109a('0x4e')]['id']){delete _0x476c13[_0x109a('0x4e')]['id'];}return db[_0x109a('0x28')][_0x109a('0x43')]({'where':{'id':_0x476c13[_0x109a('0x41')]['id']}})[_0x109a('0x21')](handleEntityNotFound(_0xe81884,null))[_0x109a('0x21')](saveUpdates(_0x476c13[_0x109a('0x4e')],null))[_0x109a('0x21')](respondWithResult(_0xe81884,null))['catch'](handleError(_0xe81884,null));};exports[_0x109a('0x22')]=function(_0x234774,_0x206c8f){return db[_0x109a('0x28')]['find']({'where':{'id':_0x234774[_0x109a('0x41')]['id']}})['then'](handleEntityNotFound(_0x206c8f,null))[_0x109a('0x21')](removeEntity(_0x206c8f,null))[_0x109a('0x3f')](handleError(_0x206c8f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0c9c2cb..4785ce2 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 _0xdedb=['rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f5554,_0x457318){var _0x3f8256=function(_0xe0422d){while(--_0xe0422d){_0x1f5554['push'](_0x1f5554['shift']());}};_0x3f8256(++_0x457318);}(_0xdedb,0x110));var _0xbded=function(_0x3d75f3,_0x1efc73){_0x3d75f3=_0x3d75f3-0x0;var _0x390983=_0xdedb[_0x3d75f3];return _0x390983;};'use strict';var _=require(_0xbded('0x0'));var util=require(_0xbded('0x1'));var logger=require(_0xbded('0x2'))(_0xbded('0x3'));var moment=require(_0xbded('0x4'));var BPromise=require(_0xbded('0x5'));var rp=require(_0xbded('0x6'));var fs=require('fs');var path=require(_0xbded('0x7'));var rimraf=require(_0xbded('0x8'));var config=require(_0xbded('0x9'));var attributes=require(_0xbded('0xa'));module['exports']=function(_0x422fe3,_0x1276a1){return _0x422fe3[_0xbded('0xb')](_0xbded('0xc'),attributes,{'tableName':_0xbded('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdfb=['Template','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./template.attributes','exports','define'];(function(_0x80cf51,_0x3cb0c2){var _0x373867=function(_0x1bbb65){while(--_0x1bbb65){_0x80cf51['push'](_0x80cf51['shift']());}};_0x373867(++_0x3cb0c2);}(_0xfdfb,0xe5));var _0xbfdf=function(_0x2d30a0,_0x3c61a1){_0x2d30a0=_0x2d30a0-0x0;var _0x331525=_0xfdfb[_0x2d30a0];return _0x331525;};'use strict';var _=require(_0xbfdf('0x0'));var util=require(_0xbfdf('0x1'));var logger=require(_0xbfdf('0x2'))(_0xbfdf('0x3'));var moment=require(_0xbfdf('0x4'));var BPromise=require('bluebird');var rp=require(_0xbfdf('0x5'));var fs=require('fs');var path=require(_0xbfdf('0x6'));var rimraf=require(_0xbfdf('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfdf('0x8'));module[_0xbfdf('0x9')]=function(_0x48ff37,_0x594b88){return _0x48ff37[_0xbfdf('0xa')](_0xbfdf('0xb'),attributes,{'tableName':'tools_templates','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 7dd8247..8e543bd 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 _0x1aa6=['info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetTemplate','findAll','options','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x9df32c,_0x373400){var _0xf1118e=function(_0x322e06){while(--_0x322e06){_0x9df32c['push'](_0x9df32c['shift']());}};_0xf1118e(++_0x373400);}(_0x1aa6,0xcb));var _0x61aa=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x1aa6[_0x4ec13d];return _0x3c3fa7;};'use strict';var _=require(_0x61aa('0x0'));var util=require(_0x61aa('0x1'));var moment=require(_0x61aa('0x2'));var BPromise=require(_0x61aa('0x3'));var rs=require(_0x61aa('0x4'));var fs=require('fs');var Redis=require(_0x61aa('0x5'));var db=require(_0x61aa('0x6'))['db'];var utils=require(_0x61aa('0x7'));var logger=require(_0x61aa('0x8'))(_0x61aa('0x9'));var config=require(_0x61aa('0xa'));var jayson=require(_0x61aa('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x447f41,_0x5ee31c,_0x333c45){return new BPromise(function(_0x3d1e05,_0x282d5e){return client[_0x61aa('0xc')](_0x447f41,_0x333c45)[_0x61aa('0xd')](function(_0x4f2350){logger[_0x61aa('0xe')](_0x61aa('0xf'),_0x5ee31c,_0x61aa('0x10'));logger[_0x61aa('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x5ee31c,_0x61aa('0x10'),JSON[_0x61aa('0x12')](_0x4f2350));if(_0x4f2350[_0x61aa('0x13')]){if(_0x4f2350['error'][_0x61aa('0x14')]===0x1f4){logger['error'](_0x61aa('0xf'),_0x5ee31c,_0x4f2350[_0x61aa('0x13')]['message']);return _0x282d5e(_0x4f2350['error'][_0x61aa('0x15')]);}logger[_0x61aa('0x13')](_0x61aa('0xf'),_0x5ee31c,_0x4f2350[_0x61aa('0x13')][_0x61aa('0x15')]);return _0x3d1e05(_0x4f2350[_0x61aa('0x13')][_0x61aa('0x15')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x5ee31c,_0x61aa('0x10'));_0x3d1e05(_0x4f2350['result'][_0x61aa('0x15')]);}})['catch'](function(_0x1f9d0c){logger[_0x61aa('0x13')]('Template,\x20%s,\x20%s',_0x5ee31c,_0x1f9d0c);_0x282d5e(_0x1f9d0c);});});}exports[_0x61aa('0x16')]=function(_0x53b587){var _0x5287ac=this;return new Promise(function(_0x540bf9,_0x49f78d){return db['Template'][_0x61aa('0x17')]({'raw':_0x53b587[_0x61aa('0x18')]?_0x53b587[_0x61aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x53b587[_0x61aa('0x18')]?_0x53b587[_0x61aa('0x18')][_0x61aa('0x19')]||null:null,'attributes':_0x53b587['options']?_0x53b587[_0x61aa('0x18')][_0x61aa('0x1a')]||null:null,'limit':_0x53b587[_0x61aa('0x18')]?_0x53b587[_0x61aa('0x18')][_0x61aa('0x1b')]||null:null,'include':_0x53b587['options']?_0x53b587['options'][_0x61aa('0x1c')]?_[_0x61aa('0x1d')](_0x53b587['options'][_0x61aa('0x1c')],function(_0x3dccb3){return{'model':db[_0x3dccb3[_0x61aa('0x1e')]],'as':_0x3dccb3['as'],'attributes':_0x3dccb3[_0x61aa('0x1a')],'include':_0x3dccb3[_0x61aa('0x1c')]?_[_0x61aa('0x1d')](_0x3dccb3['include'],function(_0x286641){return{'model':db[_0x286641[_0x61aa('0x1e')]],'as':_0x286641['as'],'attributes':_0x286641['attributes'],'include':_0x286641[_0x61aa('0x1c')]?_[_0x61aa('0x1d')](_0x286641[_0x61aa('0x1c')],function(_0x332d1b){return{'model':db[_0x332d1b[_0x61aa('0x1e')]],'as':_0x332d1b['as'],'attributes':_0x332d1b['attributes']};}):[]};}):[]};}):[]:[]})[_0x61aa('0xd')](function(_0x2b6a07){logger[_0x61aa('0xe')](_0x61aa('0x16'),_0x53b587);logger[_0x61aa('0x11')](_0x61aa('0x16'),_0x53b587,JSON[_0x61aa('0x12')](_0x2b6a07));_0x540bf9(_0x2b6a07);})['catch'](function(_0x1c605c){logger[_0x61aa('0x13')](_0x61aa('0x16'),_0x1c605c[_0x61aa('0x15')],_0x53b587);_0x49f78d(_0x5287ac[_0x61aa('0x13')](0x1f4,_0x1c605c[_0x61aa('0x15')]));});});}; \ No newline at end of file +var _0x4c0b=['attributes','map','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','include','model'];(function(_0x151529,_0x304ba7){var _0x181dd5=function(_0xe49683){while(--_0xe49683){_0x151529['push'](_0x151529['shift']());}};_0x181dd5(++_0x304ba7);}(_0x4c0b,0xcd));var _0xb4c0=function(_0x3b9944,_0x3756ea){_0x3b9944=_0x3b9944-0x0;var _0x3d9ee0=_0x4c0b[_0x3b9944];return _0x3d9ee0;};'use strict';var _=require(_0xb4c0('0x0'));var util=require(_0xb4c0('0x1'));var moment=require('moment');var BPromise=require(_0xb4c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4c0('0x3'));var db=require(_0xb4c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb4c0('0x5'));var jayson=require(_0xb4c0('0x6'));var client=jayson['client'][_0xb4c0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45a571,_0x582aee,_0xe4de82){return new BPromise(function(_0x557d96,_0x55f212){return client[_0xb4c0('0x8')](_0x45a571,_0xe4de82)['then'](function(_0x40517a){logger[_0xb4c0('0x9')](_0xb4c0('0xa'),_0x582aee,_0xb4c0('0xb'));logger['debug'](_0xb4c0('0xc'),_0x582aee,_0xb4c0('0xb'),JSON[_0xb4c0('0xd')](_0x40517a));if(_0x40517a[_0xb4c0('0xe')]){if(_0x40517a[_0xb4c0('0xe')][_0xb4c0('0xf')]===0x1f4){logger[_0xb4c0('0xe')](_0xb4c0('0xa'),_0x582aee,_0x40517a[_0xb4c0('0xe')]['message']);return _0x55f212(_0x40517a[_0xb4c0('0xe')][_0xb4c0('0x10')]);}logger[_0xb4c0('0xe')](_0xb4c0('0xa'),_0x582aee,_0x40517a['error'][_0xb4c0('0x10')]);return _0x557d96(_0x40517a[_0xb4c0('0xe')][_0xb4c0('0x10')]);}else{logger[_0xb4c0('0x9')](_0xb4c0('0xa'),_0x582aee,_0xb4c0('0xb'));_0x557d96(_0x40517a[_0xb4c0('0x11')][_0xb4c0('0x10')]);}})[_0xb4c0('0x12')](function(_0x5ece52){logger[_0xb4c0('0xe')](_0xb4c0('0xa'),_0x582aee,_0x5ece52);_0x55f212(_0x5ece52);});});}exports[_0xb4c0('0x13')]=function(_0x4e0890){var _0x119186=this;return new Promise(function(_0x4fac18,_0x2c80f2){return db[_0xb4c0('0x14')][_0xb4c0('0x15')]({'raw':_0x4e0890[_0xb4c0('0x16')]?_0x4e0890[_0xb4c0('0x16')][_0xb4c0('0x17')]===undefined?!![]:![]:!![],'where':_0x4e0890[_0xb4c0('0x16')]?_0x4e0890[_0xb4c0('0x16')][_0xb4c0('0x18')]||null:null,'attributes':_0x4e0890[_0xb4c0('0x16')]?_0x4e0890[_0xb4c0('0x16')]['attributes']||null:null,'limit':_0x4e0890[_0xb4c0('0x16')]?_0x4e0890[_0xb4c0('0x16')]['limit']||null:null,'include':_0x4e0890[_0xb4c0('0x16')]?_0x4e0890[_0xb4c0('0x16')][_0xb4c0('0x19')]?_['map'](_0x4e0890['options'][_0xb4c0('0x19')],function(_0x19ff9b){return{'model':db[_0x19ff9b[_0xb4c0('0x1a')]],'as':_0x19ff9b['as'],'attributes':_0x19ff9b[_0xb4c0('0x1b')],'include':_0x19ff9b[_0xb4c0('0x19')]?_[_0xb4c0('0x1c')](_0x19ff9b[_0xb4c0('0x19')],function(_0x1da93d){return{'model':db[_0x1da93d[_0xb4c0('0x1a')]],'as':_0x1da93d['as'],'attributes':_0x1da93d[_0xb4c0('0x1b')],'include':_0x1da93d[_0xb4c0('0x19')]?_[_0xb4c0('0x1c')](_0x1da93d[_0xb4c0('0x19')],function(_0x3b9817){return{'model':db[_0x3b9817[_0xb4c0('0x1a')]],'as':_0x3b9817['as'],'attributes':_0x3b9817['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f17b2){logger[_0xb4c0('0x9')]('GetTemplate',_0x4e0890);logger['debug'](_0xb4c0('0x13'),_0x4e0890,JSON[_0xb4c0('0xd')](_0x2f17b2));_0x4fac18(_0x2f17b2);})['catch'](function(_0x5b1267){logger[_0xb4c0('0xe')](_0xb4c0('0x13'),_0x5b1267[_0xb4c0('0x10')],_0x4e0890);_0x2c80f2(_0x119186[_0xb4c0('0xe')](0x1f4,_0x5b1267[_0xb4c0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0ae27ef..8c2000d 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 _0x9d9a=['isAuthenticated','index','/:id','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','addAllCondition','addAnyCondition','/:id/actions','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x27042b,_0x279eb1){var _0x25f459=function(_0x3078f6){while(--_0x3078f6){_0x27042b['push'](_0x27042b['shift']());}};_0x25f459(++_0x279eb1);}(_0x9d9a,0x1ba));var _0xa9d9=function(_0x4a7fcf,_0x2543b6){_0x4a7fcf=_0x4a7fcf-0x0;var _0x198071=_0x9d9a[_0x4a7fcf];return _0x198071;};'use strict';var multer=require('multer');var util=require(_0xa9d9('0x0'));var path=require(_0xa9d9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9d9('0x2'));var router=express[_0xa9d9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9d9('0x4'));var interaction=require(_0xa9d9('0x5'));var config=require(_0xa9d9('0x6'));var controller=require(_0xa9d9('0x7'));router['get']('/',auth[_0xa9d9('0x8')](),controller[_0xa9d9('0x9')]);router['get'](_0xa9d9('0xa'),auth[_0xa9d9('0x8')](),controller['show']);router[_0xa9d9('0xb')](_0xa9d9('0xc'),auth[_0xa9d9('0x8')](),controller[_0xa9d9('0xd')]);router[_0xa9d9('0xb')](_0xa9d9('0xe'),auth[_0xa9d9('0x8')](),controller[_0xa9d9('0xf')]);router[_0xa9d9('0xb')]('/:id/actions',auth[_0xa9d9('0x8')](),controller['getActions']);router[_0xa9d9('0x10')]('/',auth[_0xa9d9('0x8')](),controller['create']);router[_0xa9d9('0x10')](_0xa9d9('0xc'),auth['isAuthenticated'](),controller[_0xa9d9('0x11')]);router['post'](_0xa9d9('0xe'),auth['isAuthenticated'](),controller[_0xa9d9('0x12')]);router[_0xa9d9('0x10')](_0xa9d9('0x13'),auth[_0xa9d9('0x8')](),controller['addAction']);router[_0xa9d9('0x14')](_0xa9d9('0xa'),auth[_0xa9d9('0x8')](),controller[_0xa9d9('0x15')]);router[_0xa9d9('0x16')](_0xa9d9('0xa'),auth[_0xa9d9('0x8')](),controller[_0xa9d9('0x17')]);module[_0xa9d9('0x18')]=router; \ No newline at end of file +var _0x7341=['addAnyCondition','addAction','update','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create'];(function(_0x18614e,_0x57a88e){var _0x4983f1=function(_0x22ed06){while(--_0x22ed06){_0x18614e['push'](_0x18614e['shift']());}};_0x4983f1(++_0x57a88e);}(_0x7341,0x1d1));var _0x1734=function(_0xd61740,_0x27ad2e){_0xd61740=_0xd61740-0x0;var _0x39cd62=_0x7341[_0xd61740];return _0x39cd62;};'use strict';var multer=require(_0x1734('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1734('0x1'));var express=require('express');var router=express[_0x1734('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1734('0x3'));var interaction=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var controller=require(_0x1734('0x6'));router[_0x1734('0x7')]('/',auth[_0x1734('0x8')](),controller['index']);router['get'](_0x1734('0x9'),auth[_0x1734('0x8')](),controller[_0x1734('0xa')]);router['get'](_0x1734('0xb'),auth[_0x1734('0x8')](),controller[_0x1734('0xc')]);router[_0x1734('0x7')](_0x1734('0xd'),auth[_0x1734('0x8')](),controller[_0x1734('0xe')]);router['get'](_0x1734('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x1734('0x10')]('/',auth[_0x1734('0x8')](),controller[_0x1734('0x11')]);router[_0x1734('0x10')](_0x1734('0xb'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x1734('0x10')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x1734('0x12')]);router['post'](_0x1734('0xf'),auth['isAuthenticated'](),controller[_0x1734('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1734('0x14')]);router['delete'](_0x1734('0x9'),auth[_0x1734('0x8')](),controller[_0x1734('0x15')]);module[_0x1734('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index fbca140..4df609c 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 _0x9c34=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5dc824,_0x4eaa30){var _0x5c8ba2=function(_0x11e9fd){while(--_0x11e9fd){_0x5dc824['push'](_0x5dc824['shift']());}};_0x5c8ba2(++_0x4eaa30);}(_0x9c34,0xcc));var _0x49c3=function(_0x3f5085,_0x12db62){_0x3f5085=_0x3f5085-0x0;var _0x41895f=_0x9c34[_0x3f5085];return _0x41895f;};'use strict';var Sequelize=require(_0x49c3('0x0'));module[_0x49c3('0x1')]={'name':{'type':Sequelize[_0x49c3('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x49c3('0x2')]},'status':{'type':Sequelize[_0x49c3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe17b=['STRING','BOOLEAN','exports'];(function(_0x5c6ecf,_0xd0db9){var _0x14cf03=function(_0x398465){while(--_0x398465){_0x5c6ecf['push'](_0x5c6ecf['shift']());}};_0x14cf03(++_0xd0db9);}(_0xe17b,0x131));var _0xbe17=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xe17b[_0x533528];return _0x3189f1;};'use strict';var Sequelize=require('sequelize');module[_0xbe17('0x0')]={'name':{'type':Sequelize[_0xbe17('0x1')]},'channel':{'type':Sequelize[_0xbe17('0x1')]},'description':{'type':Sequelize[_0xbe17('0x1')]},'status':{'type':Sequelize[_0xbe17('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 67c7463..4468126 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 _0x7302=['Trigger','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','TriggerAllId','Condition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','hasOwnProperty','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','end','name','send','index'];(function(_0x583bf0,_0x4b59aa){var _0x210ec6=function(_0x3a7abb){while(--_0x3a7abb){_0x583bf0['push'](_0x583bf0['shift']());}};_0x210ec6(++_0x4b59aa);}(_0x7302,0x8d));var _0x2730=function(_0x3df6d5,_0x63e781){_0x3df6d5=_0x3df6d5-0x0;var _0x1bf76f=_0x7302[_0x3df6d5];return _0x1bf76f;};'use strict';var emlformat=require(_0x2730('0x0'));var rimraf=require(_0x2730('0x1'));var zipdir=require(_0x2730('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2730('0x3'));var moment=require('moment');var BPromise=require(_0x2730('0x4'));var Mustache=require('mustache');var util=require(_0x2730('0x5'));var path=require(_0x2730('0x6'));var sox=require(_0x2730('0x7'));var csv=require(_0x2730('0x8'));var ejs=require(_0x2730('0x9'));var fs=require('fs');var fs_extra=require(_0x2730('0xa'));var _=require(_0x2730('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2730('0xc'));var toCsv=require(_0x2730('0x8'));var querystring=require('querystring');var Papa=require(_0x2730('0xd'));var Redis=require('ioredis');var authService=require(_0x2730('0xe'));var qs=require(_0x2730('0xf'));var as=require(_0x2730('0x10'));var hardwareService=require(_0x2730('0x11'));var logger=require(_0x2730('0x12'))(_0x2730('0x13'));var utils=require(_0x2730('0x14'));var config=require(_0x2730('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2730('0x16'))['db'];function respondWithStatusCode(_0x165f01,_0x513758){_0x513758=_0x513758||0xcc;return function(_0x4a18ff){if(_0x4a18ff){return _0x165f01['sendStatus'](_0x513758);}return _0x165f01['status'](_0x513758)['end']();};}function respondWithResult(_0x340524,_0x6c5ef7){_0x6c5ef7=_0x6c5ef7||0xc8;return function(_0x161c0e){if(_0x161c0e){return _0x340524[_0x2730('0x17')](_0x6c5ef7)[_0x2730('0x18')](_0x161c0e);}};}function respondWithFilteredResult(_0x42c0c,_0x3c5c4b){return function(_0x1aac32){if(_0x1aac32){var _0x1acb12=typeof _0x3c5c4b[_0x2730('0x19')]===_0x2730('0x1a')&&typeof _0x3c5c4b[_0x2730('0x1b')]===_0x2730('0x1a');var _0x5374cd=_0x1aac32[_0x2730('0x1c')];var _0x589cfc=_0x1acb12?0x0:_0x3c5c4b[_0x2730('0x19')];var _0x3b6d24=_0x1acb12?_0x1aac32[_0x2730('0x1c')]:_0x3c5c4b[_0x2730('0x19')]+_0x3c5c4b[_0x2730('0x1b')];var _0x1135ca;if(_0x3b6d24>=_0x5374cd){_0x3b6d24=_0x5374cd;_0x1135ca=0xc8;}else{_0x1135ca=0xce;}_0x42c0c[_0x2730('0x17')](_0x1135ca);return _0x42c0c[_0x2730('0x1d')](_0x2730('0x1e'),_0x589cfc+'-'+_0x3b6d24+'/'+_0x5374cd)[_0x2730('0x18')](_0x1aac32);}return null;};}function patchUpdates(_0x4cc78a){return function(_0x167185){try{jsonpatch[_0x2730('0x1f')](_0x167185,_0x4cc78a,!![]);}catch(_0x538803){return BPromise[_0x2730('0x20')](_0x538803);}return _0x167185[_0x2730('0x21')]();};}function saveUpdates(_0x2a1460,_0x573279){return function(_0x595b8f){if(_0x595b8f){return _0x595b8f[_0x2730('0x22')](_0x2a1460)[_0x2730('0x23')](function(_0x2e4343){return _0x2e4343;});}return null;};}function removeEntity(_0x3a90a6,_0x26b250){return function(_0x3461f4){if(_0x3461f4){return _0x3461f4[_0x2730('0x24')]()[_0x2730('0x23')](function(){var _0xdb67a7=_0x3461f4[_0x2730('0x25')]({'plain':!![]});var _0x4de4f7=_0x2730('0x26');return db['UserProfileResource'][_0x2730('0x24')]({'where':{'type':_0x4de4f7,'resourceId':_0xdb67a7['id']}})[_0x2730('0x23')](function(){return _0x3461f4;});})['then'](function(){_0x3a90a6['status'](0xcc)[_0x2730('0x27')]();});}};}function handleEntityNotFound(_0x2a3a45,_0x9e04d2){return function(_0x15d9ac){if(!_0x15d9ac){_0x2a3a45['sendStatus'](0x194);}return _0x15d9ac;};}function handleError(_0x37ab47,_0x583a5b){_0x583a5b=_0x583a5b||0x1f4;return function(_0x27dc63){logger['error'](_0x27dc63['stack']);if(_0x27dc63[_0x2730('0x28')]){delete _0x27dc63['name'];}_0x37ab47[_0x2730('0x17')](_0x583a5b)[_0x2730('0x29')](_0x27dc63);};}exports[_0x2730('0x2a')]=function(_0x27f812,_0x4caf73){var _0x441d33={},_0x5f3c37={},_0x58469f={'count':0x0,'rows':[]};var _0x392a33=_['map'](db[_0x2730('0x2b')][_0x2730('0x2c')],function(_0x2f508f){return{'name':_0x2f508f['fieldName'],'type':_0x2f508f[_0x2730('0x2d')][_0x2730('0x2e')]};});_0x5f3c37[_0x2730('0x2f')]=_[_0x2730('0x30')](_0x392a33,'name');_0x5f3c37[_0x2730('0x31')]=_[_0x2730('0x32')](_0x27f812[_0x2730('0x31')]);_0x5f3c37[_0x2730('0x33')]=_[_0x2730('0x34')](_0x5f3c37[_0x2730('0x2f')],_0x5f3c37[_0x2730('0x31')]);_0x441d33['attributes']=_[_0x2730('0x34')](_0x5f3c37['model'],qs['fields'](_0x27f812[_0x2730('0x31')][_0x2730('0x35')]));_0x441d33[_0x2730('0x36')]=_0x441d33[_0x2730('0x36')]['length']?_0x441d33[_0x2730('0x36')]:_0x5f3c37[_0x2730('0x2f')];if(!_0x27f812[_0x2730('0x31')]['hasOwnProperty'](_0x2730('0x37'))){_0x441d33[_0x2730('0x1b')]=qs[_0x2730('0x1b')](_0x27f812['query'][_0x2730('0x1b')]);_0x441d33[_0x2730('0x19')]=qs[_0x2730('0x19')](_0x27f812[_0x2730('0x31')]['offset']);}_0x441d33[_0x2730('0x38')]=qs[_0x2730('0x39')](_0x27f812[_0x2730('0x31')][_0x2730('0x39')]);_0x441d33[_0x2730('0x3a')]=qs['filters'](_[_0x2730('0x3b')](_0x27f812[_0x2730('0x31')],_0x5f3c37['filters']),_0x392a33);if(_0x27f812['query'][_0x2730('0x3c')]){_0x441d33[_0x2730('0x3a')]=_['merge'](_0x441d33['where'],{'$or':_[_0x2730('0x30')](_0x392a33,function(_0x290ff8){if(_0x290ff8[_0x2730('0x2d')]!==_0x2730('0x3d')){var _0x2d17dc={};_0x2d17dc[_0x290ff8[_0x2730('0x28')]]={'$like':'%'+_0x27f812[_0x2730('0x31')][_0x2730('0x3c')]+'%'};return _0x2d17dc;}})});}_0x441d33=_[_0x2730('0x3e')]({},_0x441d33,_0x27f812[_0x2730('0x3f')]);var _0x1c86b9={'where':_0x441d33[_0x2730('0x3a')]};return db[_0x2730('0x2b')][_0x2730('0x1c')](_0x1c86b9)[_0x2730('0x23')](function(_0x2aa69c){_0x58469f[_0x2730('0x1c')]=_0x2aa69c;if(_0x27f812[_0x2730('0x31')][_0x2730('0x40')]){_0x441d33[_0x2730('0x41')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x441d33);})[_0x2730('0x23')](function(_0x4a6464){_0x58469f['rows']=_0x4a6464;return _0x58469f;})['then'](respondWithFilteredResult(_0x4caf73,_0x441d33))[_0x2730('0x42')](handleError(_0x4caf73,null));};exports[_0x2730('0x43')]=function(_0x1e571f,_0x2fcb4a){var _0x58e9b={'raw':![],'where':{'id':_0x1e571f[_0x2730('0x44')]['id']}},_0x150270={};_0x150270[_0x2730('0x2f')]=_[_0x2730('0x32')](db[_0x2730('0x2b')][_0x2730('0x2c')]);_0x150270[_0x2730('0x31')]=_[_0x2730('0x32')](_0x1e571f[_0x2730('0x31')]);_0x150270['filters']=_[_0x2730('0x34')](_0x150270[_0x2730('0x2f')],_0x150270['query']);_0x58e9b[_0x2730('0x36')]=_['intersection'](_0x150270[_0x2730('0x2f')],qs[_0x2730('0x35')](_0x1e571f[_0x2730('0x31')]['fields']));_0x58e9b[_0x2730('0x36')]=_0x58e9b['attributes'][_0x2730('0x45')]?_0x58e9b['attributes']:_0x150270[_0x2730('0x2f')];if(_0x1e571f[_0x2730('0x31')][_0x2730('0x40')]){_0x58e9b[_0x2730('0x41')]=[{'all':!![]}];}_0x58e9b=_[_0x2730('0x3e')]({},_0x58e9b,_0x1e571f['options']);return db[_0x2730('0x2b')]['find'](_0x58e9b)['then'](handleEntityNotFound(_0x2fcb4a,null))['then'](respondWithResult(_0x2fcb4a,null))['catch'](handleError(_0x2fcb4a,null));};exports['create']=function(_0x26e2cb,_0x5ec76e){return db[_0x2730('0x2b')][_0x2730('0x46')](_0x26e2cb[_0x2730('0x47')],{})[_0x2730('0x23')](function(_0xbc3d66){var _0x3ad45a=_0x26e2cb[_0x2730('0x48')][_0x2730('0x25')]({'plain':!![]});if(!_0x3ad45a)throw new Error(_0x2730('0x49'));if(_0x3ad45a[_0x2730('0x4a')]==='user'){var _0x135b99=_0xbc3d66['get']({'plain':!![]});var _0x5559a9=_0x2730('0x26');return db[_0x2730('0x4b')]['find']({'where':{'name':_0x5559a9,'userProfileId':_0x3ad45a['userProfileId']},'raw':!![]})['then'](function(_0x50be85){if(_0x50be85&&_0x50be85[_0x2730('0x4c')]===0x0){return db[_0x2730('0x4d')][_0x2730('0x46')]({'name':_0x135b99[_0x2730('0x28')],'resourceId':_0x135b99['id'],'type':_0x50be85[_0x2730('0x28')],'sectionId':_0x50be85['id']},{})['then'](function(){return _0xbc3d66;});}else{return _0xbc3d66;}})[_0x2730('0x42')](function(_0x43ef15){logger[_0x2730('0x4e')](_0x2730('0x4f'),_0x43ef15);throw _0x43ef15;});}return _0xbc3d66;})[_0x2730('0x23')](respondWithResult(_0x5ec76e,0xc9))[_0x2730('0x42')](handleError(_0x5ec76e,null));};exports[_0x2730('0x22')]=function(_0x1262d3,_0x4ef36e){if(_0x1262d3[_0x2730('0x47')]['id']){delete _0x1262d3[_0x2730('0x47')]['id'];}return db[_0x2730('0x2b')][_0x2730('0x50')]({'where':{'id':_0x1262d3[_0x2730('0x44')]['id']}})[_0x2730('0x23')](handleEntityNotFound(_0x4ef36e,null))[_0x2730('0x23')](saveUpdates(_0x1262d3[_0x2730('0x47')],null))[_0x2730('0x23')](respondWithResult(_0x4ef36e,null))[_0x2730('0x42')](handleError(_0x4ef36e,null));};exports[_0x2730('0x24')]=function(_0x5f2a02,_0x20b7dc){return db[_0x2730('0x2b')]['find']({'where':{'id':_0x5f2a02[_0x2730('0x44')]['id']}})['then'](handleEntityNotFound(_0x20b7dc,null))['then'](removeEntity(_0x20b7dc,null))[_0x2730('0x42')](handleError(_0x20b7dc,null));};exports['addAllCondition']=function(_0x402cc9,_0x3ad351,_0x378410){if(_0x402cc9[_0x2730('0x47')]['id']){delete _0x402cc9['body']['id'];}return db[_0x2730('0x2b')]['find']({'where':{'id':_0x402cc9[_0x2730('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ad351,null))[_0x2730('0x23')](function(_0x251b5c){if(_0x251b5c){_0x402cc9['body'][_0x2730('0x51')]=_0x251b5c['id'];return db[_0x2730('0x52')]['create'](_0x402cc9[_0x2730('0x47')]);}})[_0x2730('0x23')](respondWithResult(_0x3ad351,null))[_0x2730('0x42')](handleError(_0x3ad351,null));};exports['addAnyCondition']=function(_0x56d480,_0x282685,_0x1e8110){if(_0x56d480[_0x2730('0x47')]['id']){delete _0x56d480[_0x2730('0x47')]['id'];}return db[_0x2730('0x2b')]['find']({'where':{'id':_0x56d480[_0x2730('0x44')]['id']}})[_0x2730('0x23')](handleEntityNotFound(_0x282685,null))[_0x2730('0x23')](function(_0x168506){if(_0x168506){_0x56d480[_0x2730('0x47')][_0x2730('0x53')]=_0x168506['id'];return db[_0x2730('0x52')][_0x2730('0x46')](_0x56d480['body']);}})['then'](respondWithResult(_0x282685,null))[_0x2730('0x42')](handleError(_0x282685,null));};exports['getAllConditions']=function(_0x537a91,_0xa9d68f,_0x446397){var _0x3b3006={};var _0x107167={};var _0x4fdfe7;var _0x35de37;return db['Trigger'][_0x2730('0x54')]({'where':{'id':_0x537a91[_0x2730('0x44')]['id']}})['then'](handleEntityNotFound(_0xa9d68f,null))[_0x2730('0x23')](function(_0xfc0fc8){if(_0xfc0fc8){_0x4fdfe7=_0xfc0fc8;_0x107167[_0x2730('0x2f')]=_['keys'](db[_0x2730('0x52')][_0x2730('0x2c')]);_0x107167['query']=_[_0x2730('0x32')](_0x537a91[_0x2730('0x31')]);_0x107167[_0x2730('0x33')]=_['intersection'](_0x107167['model'],_0x107167[_0x2730('0x31')]);_0x3b3006[_0x2730('0x36')]=_[_0x2730('0x34')](_0x107167[_0x2730('0x2f')],qs[_0x2730('0x35')](_0x537a91[_0x2730('0x31')][_0x2730('0x35')]));_0x3b3006[_0x2730('0x36')]=_0x3b3006[_0x2730('0x36')][_0x2730('0x45')]?_0x3b3006[_0x2730('0x36')]:_0x107167[_0x2730('0x2f')];_0x3b3006['order']=qs[_0x2730('0x39')](_0x537a91['query'][_0x2730('0x39')]);_0x3b3006[_0x2730('0x3a')]=qs[_0x2730('0x33')](_[_0x2730('0x3b')](_0x537a91[_0x2730('0x31')],_0x107167[_0x2730('0x33')]));if(_0x537a91['query'][_0x2730('0x3c')]){_0x3b3006[_0x2730('0x3a')]=_[_0x2730('0x3e')](_0x3b3006[_0x2730('0x3a')],{'$or':_[_0x2730('0x30')](_0x3b3006[_0x2730('0x36')],function(_0x11dd98){var _0x50bbd0={};_0x50bbd0[_0x11dd98]={'$like':'%'+_0x537a91[_0x2730('0x31')][_0x2730('0x3c')]+'%'};return _0x50bbd0;})});}_0x3b3006=_['merge']({},_0x3b3006,_0x537a91[_0x2730('0x3f')]);return _0x4fdfe7[_0x2730('0x55')](_0x3b3006);}})['then'](function(_0x52190d){if(_0x52190d){_0x35de37=_0x52190d[_0x2730('0x45')];if(!_0x537a91[_0x2730('0x31')]['hasOwnProperty'](_0x2730('0x37'))){_0x3b3006[_0x2730('0x1b')]=qs[_0x2730('0x1b')](_0x537a91[_0x2730('0x31')]['limit']);_0x3b3006['offset']=qs[_0x2730('0x19')](_0x537a91['query']['offset']);}return _0x4fdfe7[_0x2730('0x55')](_0x3b3006);}})[_0x2730('0x23')](function(_0x4e0c94){if(_0x4e0c94){return _0x4e0c94?{'count':_0x35de37,'rows':_0x4e0c94}:null;}})['then'](respondWithResult(_0xa9d68f,null))[_0x2730('0x42')](handleError(_0xa9d68f,null));};exports[_0x2730('0x56')]=function(_0x26ac5a,_0x121ff3,_0x4f15b7){var _0x5da787={};var _0x1e1cc1={};var _0x340899;var _0x4cc776;return db['Trigger'][_0x2730('0x54')]({'where':{'id':_0x26ac5a[_0x2730('0x44')]['id']}})['then'](handleEntityNotFound(_0x121ff3,null))['then'](function(_0x46d9b0){if(_0x46d9b0){_0x340899=_0x46d9b0;_0x1e1cc1[_0x2730('0x2f')]=_[_0x2730('0x32')](db[_0x2730('0x52')]['rawAttributes']);_0x1e1cc1['query']=_[_0x2730('0x32')](_0x26ac5a['query']);_0x1e1cc1[_0x2730('0x33')]=_[_0x2730('0x34')](_0x1e1cc1['model'],_0x1e1cc1[_0x2730('0x31')]);_0x5da787[_0x2730('0x36')]=_[_0x2730('0x34')](_0x1e1cc1[_0x2730('0x2f')],qs[_0x2730('0x35')](_0x26ac5a[_0x2730('0x31')]['fields']));_0x5da787[_0x2730('0x36')]=_0x5da787[_0x2730('0x36')][_0x2730('0x45')]?_0x5da787['attributes']:_0x1e1cc1['model'];_0x5da787['order']=qs[_0x2730('0x39')](_0x26ac5a[_0x2730('0x31')]['sort']);_0x5da787['where']=qs[_0x2730('0x33')](_[_0x2730('0x3b')](_0x26ac5a[_0x2730('0x31')],_0x1e1cc1[_0x2730('0x33')]));if(_0x26ac5a[_0x2730('0x31')][_0x2730('0x3c')]){_0x5da787['where']=_['merge'](_0x5da787['where'],{'$or':_['map'](_0x5da787[_0x2730('0x36')],function(_0x36d083){var _0x222566={};_0x222566[_0x36d083]={'$like':'%'+_0x26ac5a[_0x2730('0x31')][_0x2730('0x3c')]+'%'};return _0x222566;})});}_0x5da787=_[_0x2730('0x3e')]({},_0x5da787,_0x26ac5a[_0x2730('0x3f')]);return _0x340899[_0x2730('0x56')](_0x5da787);}})[_0x2730('0x23')](function(_0x1abb30){if(_0x1abb30){_0x4cc776=_0x1abb30[_0x2730('0x45')];if(!_0x26ac5a[_0x2730('0x31')][_0x2730('0x57')](_0x2730('0x37'))){_0x5da787[_0x2730('0x1b')]=qs[_0x2730('0x1b')](_0x26ac5a[_0x2730('0x31')]['limit']);_0x5da787['offset']=qs['offset'](_0x26ac5a[_0x2730('0x31')][_0x2730('0x19')]);}return _0x340899['getAnyConditions'](_0x5da787);}})[_0x2730('0x23')](function(_0x32c9e1){if(_0x32c9e1){return _0x32c9e1?{'count':_0x4cc776,'rows':_0x32c9e1}:null;}})[_0x2730('0x23')](respondWithResult(_0x121ff3,null))['catch'](handleError(_0x121ff3,null));};exports[_0x2730('0x58')]=function(_0x9f4312,_0x42661f,_0x12bc06){if(_0x9f4312[_0x2730('0x47')]['id']){delete _0x9f4312[_0x2730('0x47')]['id'];}return db['Trigger'][_0x2730('0x50')]({'where':{'id':_0x9f4312[_0x2730('0x44')]['id']}})[_0x2730('0x23')](handleEntityNotFound(_0x42661f,null))[_0x2730('0x23')](function(_0x1d92a6){if(_0x1d92a6){_0x9f4312[_0x2730('0x47')][_0x2730('0x59')]=_0x1d92a6['id'];return db['Action']['create'](_0x9f4312[_0x2730('0x47')]);}})[_0x2730('0x23')](respondWithResult(_0x42661f,null))[_0x2730('0x42')](handleError(_0x42661f,null));};exports[_0x2730('0x5a')]=function(_0x5bd96a,_0x12c29e,_0xb9216d){var _0x2d517a={};var _0x1d0295={};var _0x1f53a2;var _0x921c95;return db[_0x2730('0x2b')][_0x2730('0x54')]({'where':{'id':_0x5bd96a[_0x2730('0x44')]['id']}})['then'](handleEntityNotFound(_0x12c29e,null))[_0x2730('0x23')](function(_0x1967b1){if(_0x1967b1){_0x1f53a2=_0x1967b1;_0x1d0295['model']=_[_0x2730('0x32')](db[_0x2730('0x5b')][_0x2730('0x2c')]);_0x1d0295[_0x2730('0x31')]=_[_0x2730('0x32')](_0x5bd96a['query']);_0x1d0295[_0x2730('0x33')]=_[_0x2730('0x34')](_0x1d0295[_0x2730('0x2f')],_0x1d0295['query']);_0x2d517a[_0x2730('0x36')]=_[_0x2730('0x34')](_0x1d0295[_0x2730('0x2f')],qs[_0x2730('0x35')](_0x5bd96a[_0x2730('0x31')]['fields']));_0x2d517a[_0x2730('0x36')]=_0x2d517a[_0x2730('0x36')][_0x2730('0x45')]?_0x2d517a[_0x2730('0x36')]:_0x1d0295[_0x2730('0x2f')];_0x2d517a[_0x2730('0x38')]=qs[_0x2730('0x39')](_0x5bd96a[_0x2730('0x31')]['sort']);_0x2d517a['where']=qs[_0x2730('0x33')](_[_0x2730('0x3b')](_0x5bd96a[_0x2730('0x31')],_0x1d0295[_0x2730('0x33')]));if(_0x5bd96a[_0x2730('0x31')]['filter']){_0x2d517a[_0x2730('0x3a')]=_[_0x2730('0x3e')](_0x2d517a[_0x2730('0x3a')],{'$or':_[_0x2730('0x30')](_0x2d517a[_0x2730('0x36')],function(_0x213508){var _0x507109={};_0x507109[_0x213508]={'$like':'%'+_0x5bd96a[_0x2730('0x31')]['filter']+'%'};return _0x507109;})});}_0x2d517a=_[_0x2730('0x3e')]({},_0x2d517a,_0x5bd96a[_0x2730('0x3f')]);return _0x1f53a2[_0x2730('0x5a')](_0x2d517a);}})[_0x2730('0x23')](function(_0x1d2c57){if(_0x1d2c57){_0x921c95=_0x1d2c57[_0x2730('0x45')];if(!_0x5bd96a[_0x2730('0x31')][_0x2730('0x57')](_0x2730('0x37'))){_0x2d517a[_0x2730('0x1b')]=qs[_0x2730('0x1b')](_0x5bd96a['query'][_0x2730('0x1b')]);_0x2d517a['offset']=qs['offset'](_0x5bd96a[_0x2730('0x31')][_0x2730('0x19')]);}return _0x1f53a2[_0x2730('0x5a')](_0x2d517a);}})[_0x2730('0x23')](function(_0x16b999){if(_0x16b999){return _0x16b999?{'count':_0x921c95,'rows':_0x16b999}:null;}})[_0x2730('0x23')](respondWithResult(_0x12c29e,null))['catch'](handleError(_0x12c29e,null));}; \ No newline at end of file +var _0x8052=['rows','catch','show','params','keys','include','find','create','body','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','order','options','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','get','Triggers','UserProfileResource','stack','index','map','Trigger','rawAttributes','fieldName','type','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','includeAll','findAll'];(function(_0x1473ea,_0x342d9b){var _0x1bc33c=function(_0x178963){while(--_0x178963){_0x1473ea['push'](_0x1473ea['shift']());}};_0x1bc33c(++_0x342d9b);}(_0x8052,0x190));var _0x2805=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x8052[_0x269094];return _0x10344f;};'use strict';var emlformat=require(_0x2805('0x0'));var rimraf=require(_0x2805('0x1'));var zipdir=require(_0x2805('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2805('0x3'));var moment=require(_0x2805('0x4'));var BPromise=require(_0x2805('0x5'));var Mustache=require(_0x2805('0x6'));var util=require('util');var path=require(_0x2805('0x7'));var sox=require(_0x2805('0x8'));var csv=require(_0x2805('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2805('0xa'));var _=require(_0x2805('0xb'));var squel=require(_0x2805('0xc'));var crypto=require(_0x2805('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2805('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2805('0xf'));var Papa=require(_0x2805('0x10'));var Redis=require(_0x2805('0x11'));var authService=require(_0x2805('0x12'));var qs=require(_0x2805('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2805('0x14'))(_0x2805('0x15'));var utils=require(_0x2805('0x16'));var config=require(_0x2805('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2433cd,_0x235344){_0x235344=_0x235344||0xcc;return function(_0xa1e2dd){if(_0xa1e2dd){return _0x2433cd[_0x2805('0x18')](_0x235344);}return _0x2433cd['status'](_0x235344)[_0x2805('0x19')]();};}function respondWithResult(_0xdb57aa,_0x127340){_0x127340=_0x127340||0xc8;return function(_0x279ee2){if(_0x279ee2){return _0xdb57aa[_0x2805('0x1a')](_0x127340)['json'](_0x279ee2);}};}function respondWithFilteredResult(_0x5a59b1,_0xbe192c){return function(_0x5679b5){if(_0x5679b5){var _0x3732c6=typeof _0xbe192c[_0x2805('0x1b')]===_0x2805('0x1c')&&typeof _0xbe192c[_0x2805('0x1d')]===_0x2805('0x1c');var _0x5d7a36=_0x5679b5[_0x2805('0x1e')];var _0x75cc7e=_0x3732c6?0x0:_0xbe192c['offset'];var _0x268202=_0x3732c6?_0x5679b5[_0x2805('0x1e')]:_0xbe192c['offset']+_0xbe192c[_0x2805('0x1d')];var _0x14578d;if(_0x268202>=_0x5d7a36){_0x268202=_0x5d7a36;_0x14578d=0xc8;}else{_0x14578d=0xce;}_0x5a59b1[_0x2805('0x1a')](_0x14578d);return _0x5a59b1['set'](_0x2805('0x1f'),_0x75cc7e+'-'+_0x268202+'/'+_0x5d7a36)[_0x2805('0x20')](_0x5679b5);}return null;};}function patchUpdates(_0x2e0f0a){return function(_0x4acbf4){try{jsonpatch[_0x2805('0x21')](_0x4acbf4,_0x2e0f0a,!![]);}catch(_0x2ffd90){return BPromise[_0x2805('0x22')](_0x2ffd90);}return _0x4acbf4[_0x2805('0x23')]();};}function saveUpdates(_0x53e1b0,_0x574361){return function(_0x37182e){if(_0x37182e){return _0x37182e['update'](_0x53e1b0)['then'](function(_0x2a9df5){return _0x2a9df5;});}return null;};}function removeEntity(_0x32bcb3,_0xb9e3d9){return function(_0x903e9a){if(_0x903e9a){return _0x903e9a[_0x2805('0x24')]()[_0x2805('0x25')](function(){var _0x16f1aa=_0x903e9a[_0x2805('0x26')]({'plain':!![]});var _0xd6ccfd=_0x2805('0x27');return db[_0x2805('0x28')]['destroy']({'where':{'type':_0xd6ccfd,'resourceId':_0x16f1aa['id']}})['then'](function(){return _0x903e9a;});})[_0x2805('0x25')](function(){_0x32bcb3[_0x2805('0x1a')](0xcc)[_0x2805('0x19')]();});}};}function handleEntityNotFound(_0x5df5e1,_0x325dd8){return function(_0x4dd492){if(!_0x4dd492){_0x5df5e1[_0x2805('0x18')](0x194);}return _0x4dd492;};}function handleError(_0x4b10b8,_0x54c5f7){_0x54c5f7=_0x54c5f7||0x1f4;return function(_0x1ed70d){logger['error'](_0x1ed70d[_0x2805('0x29')]);if(_0x1ed70d['name']){delete _0x1ed70d['name'];}_0x4b10b8[_0x2805('0x1a')](_0x54c5f7)['send'](_0x1ed70d);};}exports[_0x2805('0x2a')]=function(_0x15f7c2,_0x433f2d){var _0x2cd7b4={},_0x2307f5={},_0x33079e={'count':0x0,'rows':[]};var _0x6ee577=_[_0x2805('0x2b')](db[_0x2805('0x2c')][_0x2805('0x2d')],function(_0x2a5eac){return{'name':_0x2a5eac[_0x2805('0x2e')],'type':_0x2a5eac[_0x2805('0x2f')]['key']};});_0x2307f5[_0x2805('0x30')]=_[_0x2805('0x2b')](_0x6ee577,_0x2805('0x31'));_0x2307f5[_0x2805('0x32')]=_['keys'](_0x15f7c2[_0x2805('0x32')]);_0x2307f5['filters']=_['intersection'](_0x2307f5['model'],_0x2307f5[_0x2805('0x32')]);_0x2cd7b4['attributes']=_[_0x2805('0x33')](_0x2307f5[_0x2805('0x30')],qs[_0x2805('0x34')](_0x15f7c2['query'][_0x2805('0x34')]));_0x2cd7b4[_0x2805('0x35')]=_0x2cd7b4[_0x2805('0x35')][_0x2805('0x36')]?_0x2cd7b4[_0x2805('0x35')]:_0x2307f5[_0x2805('0x30')];if(!_0x15f7c2[_0x2805('0x32')][_0x2805('0x37')](_0x2805('0x38'))){_0x2cd7b4[_0x2805('0x1d')]=qs[_0x2805('0x1d')](_0x15f7c2[_0x2805('0x32')][_0x2805('0x1d')]);_0x2cd7b4[_0x2805('0x1b')]=qs[_0x2805('0x1b')](_0x15f7c2[_0x2805('0x32')][_0x2805('0x1b')]);}_0x2cd7b4['order']=qs[_0x2805('0x39')](_0x15f7c2[_0x2805('0x32')][_0x2805('0x39')]);_0x2cd7b4['where']=qs[_0x2805('0x3a')](_[_0x2805('0x3b')](_0x15f7c2[_0x2805('0x32')],_0x2307f5[_0x2805('0x3a')]),_0x6ee577);if(_0x15f7c2[_0x2805('0x32')][_0x2805('0x3c')]){_0x2cd7b4[_0x2805('0x3d')]=_['merge'](_0x2cd7b4[_0x2805('0x3d')],{'$or':_[_0x2805('0x2b')](_0x6ee577,function(_0x161419){if(_0x161419[_0x2805('0x2f')]!=='VIRTUAL'){var _0x5a387d={};_0x5a387d[_0x161419['name']]={'$like':'%'+_0x15f7c2['query'][_0x2805('0x3c')]+'%'};return _0x5a387d;}})});}_0x2cd7b4=_[_0x2805('0x3e')]({},_0x2cd7b4,_0x15f7c2['options']);var _0x41c08e={'where':_0x2cd7b4[_0x2805('0x3d')]};return db['Trigger']['count'](_0x41c08e)['then'](function(_0x3ceefd){_0x33079e['count']=_0x3ceefd;if(_0x15f7c2[_0x2805('0x32')][_0x2805('0x3f')]){_0x2cd7b4['include']=[{'all':!![]}];}return db[_0x2805('0x2c')][_0x2805('0x40')](_0x2cd7b4);})[_0x2805('0x25')](function(_0x180224){_0x33079e[_0x2805('0x41')]=_0x180224;return _0x33079e;})[_0x2805('0x25')](respondWithFilteredResult(_0x433f2d,_0x2cd7b4))[_0x2805('0x42')](handleError(_0x433f2d,null));};exports[_0x2805('0x43')]=function(_0x677ce5,_0x110290){var _0x372e3e={'raw':![],'where':{'id':_0x677ce5[_0x2805('0x44')]['id']}},_0x45e11d={};_0x45e11d[_0x2805('0x30')]=_[_0x2805('0x45')](db[_0x2805('0x2c')][_0x2805('0x2d')]);_0x45e11d[_0x2805('0x32')]=_['keys'](_0x677ce5[_0x2805('0x32')]);_0x45e11d[_0x2805('0x3a')]=_[_0x2805('0x33')](_0x45e11d[_0x2805('0x30')],_0x45e11d[_0x2805('0x32')]);_0x372e3e[_0x2805('0x35')]=_[_0x2805('0x33')](_0x45e11d['model'],qs[_0x2805('0x34')](_0x677ce5['query']['fields']));_0x372e3e[_0x2805('0x35')]=_0x372e3e[_0x2805('0x35')][_0x2805('0x36')]?_0x372e3e['attributes']:_0x45e11d['model'];if(_0x677ce5[_0x2805('0x32')][_0x2805('0x3f')]){_0x372e3e[_0x2805('0x46')]=[{'all':!![]}];}_0x372e3e=_[_0x2805('0x3e')]({},_0x372e3e,_0x677ce5['options']);return db[_0x2805('0x2c')][_0x2805('0x47')](_0x372e3e)[_0x2805('0x25')](handleEntityNotFound(_0x110290,null))[_0x2805('0x25')](respondWithResult(_0x110290,null))[_0x2805('0x42')](handleError(_0x110290,null));};exports[_0x2805('0x48')]=function(_0x48c87d,_0x318bbd){return db[_0x2805('0x2c')]['create'](_0x48c87d[_0x2805('0x49')],{})['then'](function(_0x466166){var _0x8dba12=_0x48c87d[_0x2805('0x4a')]['get']({'plain':!![]});if(!_0x8dba12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8dba12['role']===_0x2805('0x4a')){var _0x52cc3b=_0x466166[_0x2805('0x26')]({'plain':!![]});var _0x2c0f1a=_0x2805('0x27');return db[_0x2805('0x4b')][_0x2805('0x47')]({'where':{'name':_0x2c0f1a,'userProfileId':_0x8dba12[_0x2805('0x4c')]},'raw':!![]})[_0x2805('0x25')](function(_0x335e4b){if(_0x335e4b&&_0x335e4b['autoAssociation']===0x0){return db['UserProfileResource'][_0x2805('0x48')]({'name':_0x52cc3b[_0x2805('0x31')],'resourceId':_0x52cc3b['id'],'type':_0x335e4b[_0x2805('0x31')],'sectionId':_0x335e4b['id']},{})[_0x2805('0x25')](function(){return _0x466166;});}else{return _0x466166;}})[_0x2805('0x42')](function(_0x3ac8f5){logger[_0x2805('0x4d')](_0x2805('0x4e'),_0x3ac8f5);throw _0x3ac8f5;});}return _0x466166;})[_0x2805('0x25')](respondWithResult(_0x318bbd,0xc9))[_0x2805('0x42')](handleError(_0x318bbd,null));};exports[_0x2805('0x4f')]=function(_0x56fd62,_0x3efc96){if(_0x56fd62[_0x2805('0x49')]['id']){delete _0x56fd62[_0x2805('0x49')]['id'];}return db[_0x2805('0x2c')][_0x2805('0x47')]({'where':{'id':_0x56fd62['params']['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x3efc96,null))['then'](saveUpdates(_0x56fd62[_0x2805('0x49')],null))[_0x2805('0x25')](respondWithResult(_0x3efc96,null))['catch'](handleError(_0x3efc96,null));};exports[_0x2805('0x24')]=function(_0x34994a,_0x22d08a){return db[_0x2805('0x2c')]['find']({'where':{'id':_0x34994a['params']['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x22d08a,null))[_0x2805('0x25')](removeEntity(_0x22d08a,null))[_0x2805('0x42')](handleError(_0x22d08a,null));};exports[_0x2805('0x50')]=function(_0x549ff1,_0x148133,_0x278bc2){if(_0x549ff1[_0x2805('0x49')]['id']){delete _0x549ff1[_0x2805('0x49')]['id'];}return db[_0x2805('0x2c')]['find']({'where':{'id':_0x549ff1[_0x2805('0x44')]['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x148133,null))[_0x2805('0x25')](function(_0x2dd995){if(_0x2dd995){_0x549ff1[_0x2805('0x49')]['TriggerAllId']=_0x2dd995['id'];return db['Condition']['create'](_0x549ff1['body']);}})['then'](respondWithResult(_0x148133,null))[_0x2805('0x42')](handleError(_0x148133,null));};exports[_0x2805('0x51')]=function(_0x1e6b6c,_0x487b3d,_0x99e1fb){if(_0x1e6b6c[_0x2805('0x49')]['id']){delete _0x1e6b6c[_0x2805('0x49')]['id'];}return db[_0x2805('0x2c')][_0x2805('0x47')]({'where':{'id':_0x1e6b6c['params']['id']}})['then'](handleEntityNotFound(_0x487b3d,null))['then'](function(_0x1922ab){if(_0x1922ab){_0x1e6b6c['body'][_0x2805('0x52')]=_0x1922ab['id'];return db[_0x2805('0x53')][_0x2805('0x48')](_0x1e6b6c[_0x2805('0x49')]);}})[_0x2805('0x25')](respondWithResult(_0x487b3d,null))[_0x2805('0x42')](handleError(_0x487b3d,null));};exports[_0x2805('0x54')]=function(_0x525e81,_0x3f1230,_0x59eab1){var _0x1f5898={};var _0x58f7a8={};var _0x17f0ee;var _0x44ff31;return db[_0x2805('0x2c')][_0x2805('0x55')]({'where':{'id':_0x525e81[_0x2805('0x44')]['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x3f1230,null))[_0x2805('0x25')](function(_0x3bbd7b){if(_0x3bbd7b){_0x17f0ee=_0x3bbd7b;_0x58f7a8[_0x2805('0x30')]=_[_0x2805('0x45')](db[_0x2805('0x53')][_0x2805('0x2d')]);_0x58f7a8[_0x2805('0x32')]=_[_0x2805('0x45')](_0x525e81[_0x2805('0x32')]);_0x58f7a8[_0x2805('0x3a')]=_[_0x2805('0x33')](_0x58f7a8[_0x2805('0x30')],_0x58f7a8[_0x2805('0x32')]);_0x1f5898[_0x2805('0x35')]=_[_0x2805('0x33')](_0x58f7a8[_0x2805('0x30')],qs[_0x2805('0x34')](_0x525e81[_0x2805('0x32')][_0x2805('0x34')]));_0x1f5898[_0x2805('0x35')]=_0x1f5898[_0x2805('0x35')]['length']?_0x1f5898[_0x2805('0x35')]:_0x58f7a8[_0x2805('0x30')];_0x1f5898['order']=qs[_0x2805('0x39')](_0x525e81[_0x2805('0x32')][_0x2805('0x39')]);_0x1f5898[_0x2805('0x3d')]=qs[_0x2805('0x3a')](_['pick'](_0x525e81[_0x2805('0x32')],_0x58f7a8[_0x2805('0x3a')]));if(_0x525e81['query']['filter']){_0x1f5898['where']=_[_0x2805('0x3e')](_0x1f5898[_0x2805('0x3d')],{'$or':_[_0x2805('0x2b')](_0x1f5898[_0x2805('0x35')],function(_0x312bdc){var _0x4d2805={};_0x4d2805[_0x312bdc]={'$like':'%'+_0x525e81[_0x2805('0x32')][_0x2805('0x3c')]+'%'};return _0x4d2805;})});}_0x1f5898=_[_0x2805('0x3e')]({},_0x1f5898,_0x525e81['options']);return _0x17f0ee[_0x2805('0x54')](_0x1f5898);}})[_0x2805('0x25')](function(_0xaa7e7d){if(_0xaa7e7d){_0x44ff31=_0xaa7e7d[_0x2805('0x36')];if(!_0x525e81[_0x2805('0x32')][_0x2805('0x37')](_0x2805('0x38'))){_0x1f5898[_0x2805('0x1d')]=qs[_0x2805('0x1d')](_0x525e81['query'][_0x2805('0x1d')]);_0x1f5898[_0x2805('0x1b')]=qs[_0x2805('0x1b')](_0x525e81['query'][_0x2805('0x1b')]);}return _0x17f0ee['getAllConditions'](_0x1f5898);}})[_0x2805('0x25')](function(_0x1c1956){if(_0x1c1956){return _0x1c1956?{'count':_0x44ff31,'rows':_0x1c1956}:null;}})['then'](respondWithResult(_0x3f1230,null))[_0x2805('0x42')](handleError(_0x3f1230,null));};exports[_0x2805('0x56')]=function(_0x3b5e7d,_0x3c4779,_0x3ab245){var _0x5af584={};var _0x58b065={};var _0x4ceb18;var _0x30bdee;return db[_0x2805('0x2c')]['findOne']({'where':{'id':_0x3b5e7d[_0x2805('0x44')]['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x3c4779,null))['then'](function(_0x566477){if(_0x566477){_0x4ceb18=_0x566477;_0x58b065[_0x2805('0x30')]=_[_0x2805('0x45')](db['Condition'][_0x2805('0x2d')]);_0x58b065[_0x2805('0x32')]=_[_0x2805('0x45')](_0x3b5e7d['query']);_0x58b065[_0x2805('0x3a')]=_['intersection'](_0x58b065[_0x2805('0x30')],_0x58b065['query']);_0x5af584['attributes']=_[_0x2805('0x33')](_0x58b065[_0x2805('0x30')],qs['fields'](_0x3b5e7d[_0x2805('0x32')][_0x2805('0x34')]));_0x5af584[_0x2805('0x35')]=_0x5af584[_0x2805('0x35')]['length']?_0x5af584[_0x2805('0x35')]:_0x58b065['model'];_0x5af584[_0x2805('0x57')]=qs[_0x2805('0x39')](_0x3b5e7d[_0x2805('0x32')][_0x2805('0x39')]);_0x5af584['where']=qs[_0x2805('0x3a')](_[_0x2805('0x3b')](_0x3b5e7d[_0x2805('0x32')],_0x58b065[_0x2805('0x3a')]));if(_0x3b5e7d['query'][_0x2805('0x3c')]){_0x5af584[_0x2805('0x3d')]=_[_0x2805('0x3e')](_0x5af584[_0x2805('0x3d')],{'$or':_[_0x2805('0x2b')](_0x5af584['attributes'],function(_0x48499b){var _0x3b7ff9={};_0x3b7ff9[_0x48499b]={'$like':'%'+_0x3b5e7d[_0x2805('0x32')][_0x2805('0x3c')]+'%'};return _0x3b7ff9;})});}_0x5af584=_[_0x2805('0x3e')]({},_0x5af584,_0x3b5e7d[_0x2805('0x58')]);return _0x4ceb18[_0x2805('0x56')](_0x5af584);}})[_0x2805('0x25')](function(_0x17fb26){if(_0x17fb26){_0x30bdee=_0x17fb26['length'];if(!_0x3b5e7d[_0x2805('0x32')][_0x2805('0x37')](_0x2805('0x38'))){_0x5af584['limit']=qs[_0x2805('0x1d')](_0x3b5e7d[_0x2805('0x32')][_0x2805('0x1d')]);_0x5af584[_0x2805('0x1b')]=qs[_0x2805('0x1b')](_0x3b5e7d[_0x2805('0x32')][_0x2805('0x1b')]);}return _0x4ceb18['getAnyConditions'](_0x5af584);}})['then'](function(_0x533f86){if(_0x533f86){return _0x533f86?{'count':_0x30bdee,'rows':_0x533f86}:null;}})[_0x2805('0x25')](respondWithResult(_0x3c4779,null))[_0x2805('0x42')](handleError(_0x3c4779,null));};exports[_0x2805('0x59')]=function(_0x150511,_0x4a1105,_0x505ea5){if(_0x150511[_0x2805('0x49')]['id']){delete _0x150511[_0x2805('0x49')]['id'];}return db[_0x2805('0x2c')][_0x2805('0x47')]({'where':{'id':_0x150511[_0x2805('0x44')]['id']}})[_0x2805('0x25')](handleEntityNotFound(_0x4a1105,null))[_0x2805('0x25')](function(_0x31a6cc){if(_0x31a6cc){_0x150511[_0x2805('0x49')][_0x2805('0x5a')]=_0x31a6cc['id'];return db[_0x2805('0x5b')][_0x2805('0x48')](_0x150511['body']);}})['then'](respondWithResult(_0x4a1105,null))[_0x2805('0x42')](handleError(_0x4a1105,null));};exports[_0x2805('0x5c')]=function(_0x2e87b1,_0xccb7c1,_0x2732f9){var _0x4e7357={};var _0x36c83c={};var _0x99f11f;var _0x1bdb51;return db[_0x2805('0x2c')]['findOne']({'where':{'id':_0x2e87b1[_0x2805('0x44')]['id']}})[_0x2805('0x25')](handleEntityNotFound(_0xccb7c1,null))['then'](function(_0x1b8c11){if(_0x1b8c11){_0x99f11f=_0x1b8c11;_0x36c83c[_0x2805('0x30')]=_['keys'](db[_0x2805('0x5b')][_0x2805('0x2d')]);_0x36c83c[_0x2805('0x32')]=_[_0x2805('0x45')](_0x2e87b1['query']);_0x36c83c[_0x2805('0x3a')]=_['intersection'](_0x36c83c[_0x2805('0x30')],_0x36c83c[_0x2805('0x32')]);_0x4e7357['attributes']=_[_0x2805('0x33')](_0x36c83c['model'],qs[_0x2805('0x34')](_0x2e87b1['query'][_0x2805('0x34')]));_0x4e7357[_0x2805('0x35')]=_0x4e7357['attributes'][_0x2805('0x36')]?_0x4e7357[_0x2805('0x35')]:_0x36c83c['model'];_0x4e7357['order']=qs[_0x2805('0x39')](_0x2e87b1[_0x2805('0x32')][_0x2805('0x39')]);_0x4e7357[_0x2805('0x3d')]=qs[_0x2805('0x3a')](_[_0x2805('0x3b')](_0x2e87b1[_0x2805('0x32')],_0x36c83c[_0x2805('0x3a')]));if(_0x2e87b1[_0x2805('0x32')][_0x2805('0x3c')]){_0x4e7357[_0x2805('0x3d')]=_['merge'](_0x4e7357[_0x2805('0x3d')],{'$or':_[_0x2805('0x2b')](_0x4e7357[_0x2805('0x35')],function(_0x35f1d3){var _0x350782={};_0x350782[_0x35f1d3]={'$like':'%'+_0x2e87b1[_0x2805('0x32')]['filter']+'%'};return _0x350782;})});}_0x4e7357=_[_0x2805('0x3e')]({},_0x4e7357,_0x2e87b1[_0x2805('0x58')]);return _0x99f11f['getActions'](_0x4e7357);}})[_0x2805('0x25')](function(_0x1b1b87){if(_0x1b1b87){_0x1bdb51=_0x1b1b87[_0x2805('0x36')];if(!_0x2e87b1['query'][_0x2805('0x37')](_0x2805('0x38'))){_0x4e7357[_0x2805('0x1d')]=qs[_0x2805('0x1d')](_0x2e87b1['query'][_0x2805('0x1d')]);_0x4e7357[_0x2805('0x1b')]=qs[_0x2805('0x1b')](_0x2e87b1[_0x2805('0x32')]['offset']);}return _0x99f11f['getActions'](_0x4e7357);}})[_0x2805('0x25')](function(_0x705199){if(_0x705199){return _0x705199?{'count':_0x1bdb51,'rows':_0x705199}:null;}})[_0x2805('0x25')](respondWithResult(_0xccb7c1,null))[_0x2805('0x42')](handleError(_0xccb7c1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index fda6419..b056faa 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 _0x0eaa=['./trigger.attributes','exports','tools_triggers','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x44a790,_0x7b30b9){var _0x187f44=function(_0x509ca7){while(--_0x509ca7){_0x44a790['push'](_0x44a790['shift']());}};_0x187f44(++_0x7b30b9);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0xec7d20,_0x4a98a9){_0xec7d20=_0xec7d20-0x0;var _0x4ec861=_0x0eaa[_0xec7d20];return _0x4ec861;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0ea('0x2'));var BPromise=require(_0xa0ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0ea('0x4'));var rimraf=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var attributes=require(_0xa0ea('0x7'));module[_0xa0ea('0x8')]=function(_0x5636ed,_0x3c6586){return _0x5636ed['define']('Trigger',attributes,{'tableName':_0xa0ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4350=['../../config/environment','./trigger.attributes','exports','tools_triggers','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4350,0x1d0));var _0x0435=function(_0x237528,_0x1fe8ad){_0x237528=_0x237528-0x0;var _0x50804b=_0x4350[_0x237528];return _0x50804b;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var logger=require('../../config/logger')(_0x0435('0x2'));var moment=require('moment');var BPromise=require(_0x0435('0x3'));var rp=require(_0x0435('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var attributes=require(_0x0435('0x7'));module[_0x0435('0x8')]=function(_0x58a62d,_0x580eeb){return _0x58a62d['define']('Trigger',attributes,{'tableName':_0x0435('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index dd44109..497da8d 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 _0x6f70=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetTrigger','debug','Trigger','find','raw','ShowTrigger','lodash','util','moment','bluebird','randomstring'];(function(_0xf671d3,_0xfef74e){var _0xf4bb25=function(_0x4160df){while(--_0x4160df){_0xf671d3['push'](_0xf671d3['shift']());}};_0xf4bb25(++_0xfef74e);}(_0x6f70,0xdf));var _0x06f7=function(_0x631210,_0x372d10){_0x631210=_0x631210-0x0;var _0x3146de=_0x6f70[_0x631210];return _0x3146de;};'use strict';var _=require(_0x06f7('0x0'));var util=require(_0x06f7('0x1'));var moment=require(_0x06f7('0x2'));var BPromise=require(_0x06f7('0x3'));var rs=require(_0x06f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x06f7('0x5'));var logger=require(_0x06f7('0x6'))(_0x06f7('0x7'));var config=require(_0x06f7('0x8'));var jayson=require(_0x06f7('0x9'));var client=jayson[_0x06f7('0xa')][_0x06f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ec296,_0x33d88b,_0x31d5d1){return new BPromise(function(_0x1e595d,_0x4a8ca9){return client[_0x06f7('0xc')](_0x4ec296,_0x31d5d1)[_0x06f7('0xd')](function(_0x3a6015){logger[_0x06f7('0xe')](_0x06f7('0xf'),_0x33d88b,'request\x20sent');logger['debug'](_0x06f7('0x10'),_0x33d88b,_0x06f7('0x11'),JSON[_0x06f7('0x12')](_0x3a6015));if(_0x3a6015[_0x06f7('0x13')]){if(_0x3a6015[_0x06f7('0x13')][_0x06f7('0x14')]===0x1f4){logger[_0x06f7('0x13')]('Trigger,\x20%s,\x20%s',_0x33d88b,_0x3a6015['error'][_0x06f7('0x15')]);return _0x4a8ca9(_0x3a6015['error']['message']);}logger[_0x06f7('0x13')](_0x06f7('0xf'),_0x33d88b,_0x3a6015[_0x06f7('0x13')][_0x06f7('0x15')]);return _0x1e595d(_0x3a6015[_0x06f7('0x13')][_0x06f7('0x15')]);}else{logger[_0x06f7('0xe')](_0x06f7('0xf'),_0x33d88b,_0x06f7('0x11'));_0x1e595d(_0x3a6015[_0x06f7('0x16')][_0x06f7('0x15')]);}})[_0x06f7('0x17')](function(_0x196460){logger['error']('Trigger,\x20%s,\x20%s',_0x33d88b,_0x196460);_0x4a8ca9(_0x196460);});});}exports['GetTrigger']=function(_0x19fb3b){var _0x2da730=this;return new Promise(function(_0xd36b35,_0x3deafa){return db['Trigger'][_0x06f7('0x18')]({'raw':_0x19fb3b['options']?_0x19fb3b[_0x06f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x19fb3b[_0x06f7('0x19')]?_0x19fb3b[_0x06f7('0x19')][_0x06f7('0x1a')]||null:null,'attributes':_0x19fb3b['options']?_0x19fb3b[_0x06f7('0x19')]['attributes']||null:null,'limit':_0x19fb3b[_0x06f7('0x19')]?_0x19fb3b['options'][_0x06f7('0x1b')]||null:null,'include':_0x19fb3b[_0x06f7('0x19')]?_0x19fb3b[_0x06f7('0x19')][_0x06f7('0x1c')]?_[_0x06f7('0x1d')](_0x19fb3b[_0x06f7('0x19')][_0x06f7('0x1c')],function(_0x5f0085){return{'model':db[_0x5f0085[_0x06f7('0x1e')]],'as':_0x5f0085['as'],'attributes':_0x5f0085[_0x06f7('0x1f')],'include':_0x5f0085[_0x06f7('0x1c')]?_[_0x06f7('0x1d')](_0x5f0085[_0x06f7('0x1c')],function(_0x53ea8a){return{'model':db[_0x53ea8a[_0x06f7('0x1e')]],'as':_0x53ea8a['as'],'attributes':_0x53ea8a[_0x06f7('0x1f')],'include':_0x53ea8a[_0x06f7('0x1c')]?_[_0x06f7('0x1d')](_0x53ea8a[_0x06f7('0x1c')],function(_0xda93ae){return{'model':db[_0xda93ae['model']],'as':_0xda93ae['as'],'attributes':_0xda93ae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x431538){logger[_0x06f7('0xe')](_0x06f7('0x20'),_0x19fb3b);logger[_0x06f7('0x21')](_0x06f7('0x20'),_0x19fb3b,JSON[_0x06f7('0x12')](_0x431538));_0xd36b35(_0x431538);})[_0x06f7('0x17')](function(_0x314a5e){logger[_0x06f7('0x13')](_0x06f7('0x20'),_0x314a5e['message'],_0x19fb3b);_0x3deafa(_0x2da730[_0x06f7('0x13')](0x1f4,_0x314a5e[_0x06f7('0x15')]));});});};exports['ShowTrigger']=function(_0x36f6c4){var _0xaf9915=this;return new Promise(function(_0x4a6bae,_0xe54131){return db[_0x06f7('0x22')][_0x06f7('0x23')]({'raw':_0x36f6c4[_0x06f7('0x19')]?_0x36f6c4[_0x06f7('0x19')][_0x06f7('0x24')]===undefined?!![]:![]:!![],'where':_0x36f6c4[_0x06f7('0x19')]?_0x36f6c4[_0x06f7('0x19')][_0x06f7('0x1a')]||null:null,'attributes':_0x36f6c4['options']?_0x36f6c4['options'][_0x06f7('0x1f')]||null:null,'include':_0x36f6c4[_0x06f7('0x19')]?_0x36f6c4['options'][_0x06f7('0x1c')]?_[_0x06f7('0x1d')](_0x36f6c4[_0x06f7('0x19')][_0x06f7('0x1c')],function(_0x26804c){return{'model':db[_0x26804c['model']],'as':_0x26804c['as'],'attributes':_0x26804c[_0x06f7('0x1f')],'include':_0x26804c[_0x06f7('0x1c')]?_['map'](_0x26804c['include'],function(_0x4b9a14){return{'model':db[_0x4b9a14[_0x06f7('0x1e')]],'as':_0x4b9a14['as'],'attributes':_0x4b9a14['attributes'],'include':_0x4b9a14[_0x06f7('0x1c')]?_[_0x06f7('0x1d')](_0x4b9a14['include'],function(_0x15555c){return{'model':db[_0x15555c[_0x06f7('0x1e')]],'as':_0x15555c['as'],'attributes':_0x15555c[_0x06f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x06f7('0xd')](function(_0x595bbf){logger[_0x06f7('0xe')](_0x06f7('0x25'),_0x36f6c4);logger['debug'](_0x06f7('0x25'),_0x36f6c4,JSON['stringify'](_0x595bbf));_0x4a6bae(_0x595bbf);})[_0x06f7('0x17')](function(_0x3528aa){logger[_0x06f7('0x13')](_0x06f7('0x25'),_0x3528aa[_0x06f7('0x15')],_0x36f6c4);_0xe54131(_0xaf9915['error'](0x1f4,_0x3528aa[_0x06f7('0x15')]));});});}; \ No newline at end of file +var _0xd474=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','debug','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2de9ca,_0x2c323a){var _0x55c8d3=function(_0x363883){while(--_0x363883){_0x2de9ca['push'](_0x2de9ca['shift']());}};_0x55c8d3(++_0x2c323a);}(_0xd474,0x135));var _0x4d47=function(_0x520c24,_0x3fb9af){_0x520c24=_0x520c24-0x0;var _0x377104=_0xd474[_0x520c24];return _0x377104;};'use strict';var _=require(_0x4d47('0x0'));var util=require(_0x4d47('0x1'));var moment=require('moment');var BPromise=require(_0x4d47('0x2'));var rs=require(_0x4d47('0x3'));var fs=require('fs');var Redis=require(_0x4d47('0x4'));var db=require(_0x4d47('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d47('0x6'))(_0x4d47('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d47('0x8'));var client=jayson[_0x4d47('0x9')][_0x4d47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df603,_0x3e62b6,_0x17f429){return new BPromise(function(_0x11650f,_0x31a7e2){return client[_0x4d47('0xb')](_0x3df603,_0x17f429)[_0x4d47('0xc')](function(_0x41cc40){logger[_0x4d47('0xd')](_0x4d47('0xe'),_0x3e62b6,_0x4d47('0xf'));logger['debug'](_0x4d47('0x10'),_0x3e62b6,_0x4d47('0xf'),JSON[_0x4d47('0x11')](_0x41cc40));if(_0x41cc40[_0x4d47('0x12')]){if(_0x41cc40[_0x4d47('0x12')][_0x4d47('0x13')]===0x1f4){logger[_0x4d47('0x12')](_0x4d47('0xe'),_0x3e62b6,_0x41cc40[_0x4d47('0x12')][_0x4d47('0x14')]);return _0x31a7e2(_0x41cc40[_0x4d47('0x12')]['message']);}logger[_0x4d47('0x12')]('Trigger,\x20%s,\x20%s',_0x3e62b6,_0x41cc40[_0x4d47('0x12')][_0x4d47('0x14')]);return _0x11650f(_0x41cc40[_0x4d47('0x12')][_0x4d47('0x14')]);}else{logger[_0x4d47('0xd')](_0x4d47('0xe'),_0x3e62b6,_0x4d47('0xf'));_0x11650f(_0x41cc40[_0x4d47('0x15')][_0x4d47('0x14')]);}})[_0x4d47('0x16')](function(_0x2eea59){logger['error'](_0x4d47('0xe'),_0x3e62b6,_0x2eea59);_0x31a7e2(_0x2eea59);});});}exports['GetTrigger']=function(_0x2fe66c){var _0x2bda61=this;return new Promise(function(_0x592c1e,_0x2664cc){return db['Trigger'][_0x4d47('0x17')]({'raw':_0x2fe66c[_0x4d47('0x18')]?_0x2fe66c['options'][_0x4d47('0x19')]===undefined?!![]:![]:!![],'where':_0x2fe66c[_0x4d47('0x18')]?_0x2fe66c[_0x4d47('0x18')][_0x4d47('0x1a')]||null:null,'attributes':_0x2fe66c['options']?_0x2fe66c[_0x4d47('0x18')][_0x4d47('0x1b')]||null:null,'limit':_0x2fe66c[_0x4d47('0x18')]?_0x2fe66c[_0x4d47('0x18')][_0x4d47('0x1c')]||null:null,'include':_0x2fe66c['options']?_0x2fe66c[_0x4d47('0x18')]['include']?_[_0x4d47('0x1d')](_0x2fe66c['options'][_0x4d47('0x1e')],function(_0x2a0c0a){return{'model':db[_0x2a0c0a[_0x4d47('0x1f')]],'as':_0x2a0c0a['as'],'attributes':_0x2a0c0a[_0x4d47('0x1b')],'include':_0x2a0c0a[_0x4d47('0x1e')]?_['map'](_0x2a0c0a[_0x4d47('0x1e')],function(_0x215c3f){return{'model':db[_0x215c3f['model']],'as':_0x215c3f['as'],'attributes':_0x215c3f[_0x4d47('0x1b')],'include':_0x215c3f[_0x4d47('0x1e')]?_[_0x4d47('0x1d')](_0x215c3f[_0x4d47('0x1e')],function(_0x126a4b){return{'model':db[_0x126a4b[_0x4d47('0x1f')]],'as':_0x126a4b['as'],'attributes':_0x126a4b[_0x4d47('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5d36){logger[_0x4d47('0xd')]('GetTrigger',_0x2fe66c);logger[_0x4d47('0x20')]('GetTrigger',_0x2fe66c,JSON['stringify'](_0x3d5d36));_0x592c1e(_0x3d5d36);})['catch'](function(_0x49cc9a){logger['error']('GetTrigger',_0x49cc9a[_0x4d47('0x14')],_0x2fe66c);_0x2664cc(_0x2bda61[_0x4d47('0x12')](0x1f4,_0x49cc9a[_0x4d47('0x14')]));});});};exports['ShowTrigger']=function(_0x30cba6){var _0x2061cd=this;return new Promise(function(_0x5f52cf,_0x26d566){return db['Trigger'][_0x4d47('0x21')]({'raw':_0x30cba6[_0x4d47('0x18')]?_0x30cba6[_0x4d47('0x18')][_0x4d47('0x19')]===undefined?!![]:![]:!![],'where':_0x30cba6[_0x4d47('0x18')]?_0x30cba6['options'][_0x4d47('0x1a')]||null:null,'attributes':_0x30cba6['options']?_0x30cba6[_0x4d47('0x18')][_0x4d47('0x1b')]||null:null,'include':_0x30cba6[_0x4d47('0x18')]?_0x30cba6[_0x4d47('0x18')]['include']?_[_0x4d47('0x1d')](_0x30cba6[_0x4d47('0x18')][_0x4d47('0x1e')],function(_0x326a6a){return{'model':db[_0x326a6a[_0x4d47('0x1f')]],'as':_0x326a6a['as'],'attributes':_0x326a6a[_0x4d47('0x1b')],'include':_0x326a6a[_0x4d47('0x1e')]?_[_0x4d47('0x1d')](_0x326a6a['include'],function(_0x338f15){return{'model':db[_0x338f15[_0x4d47('0x1f')]],'as':_0x338f15['as'],'attributes':_0x338f15[_0x4d47('0x1b')],'include':_0x338f15[_0x4d47('0x1e')]?_[_0x4d47('0x1d')](_0x338f15[_0x4d47('0x1e')],function(_0x5a2a1f){return{'model':db[_0x5a2a1f['model']],'as':_0x5a2a1f['as'],'attributes':_0x5a2a1f[_0x4d47('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aaf1c){logger[_0x4d47('0xd')](_0x4d47('0x22'),_0x30cba6);logger[_0x4d47('0x20')](_0x4d47('0x22'),_0x30cba6,JSON[_0x4d47('0x11')](_0x2aaf1c));_0x5f52cf(_0x2aaf1c);})[_0x4d47('0x16')](function(_0x12719d){logger[_0x4d47('0x12')]('ShowTrigger',_0x12719d[_0x4d47('0x14')],_0x30cba6);_0x26d566(_0x2061cd[_0x4d47('0x12')](0x1f4,_0x12719d[_0x4d47('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index bb26c2a..ddacdd5 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 _0x6121=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x6121,0xea));var _0x1612=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6121[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x1612('0x0'));var path=require(_0x1612('0x1'));var timeout=require(_0x1612('0x2'));var express=require(_0x1612('0x3'));var router=express[_0x1612('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1612('0x5'));var interaction=require(_0x1612('0x6'));var config=require(_0x1612('0x7'));var controller=require('./trunk.controller');router[_0x1612('0x8')]('/',auth[_0x1612('0x9')](),controller[_0x1612('0xa')]);router[_0x1612('0x8')](_0x1612('0xb'),auth[_0x1612('0x9')](),controller[_0x1612('0xc')]);router[_0x1612('0xd')](_0x1612('0xe'),auth[_0x1612('0x9')](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x1612('0xf')]);router[_0x1612('0x10')]('/:id',auth[_0x1612('0x9')](),controller[_0x1612('0x11')]);router[_0x1612('0x12')](_0x1612('0xb'),auth[_0x1612('0x9')](),controller['destroy']);module[_0x1612('0x13')]=router; \ No newline at end of file +var _0xa082=['post','/:id/clone','put','/:id','delete','destroy','exports','path','connect-timeout','Router','../../config/environment','./trunk.controller','get','index','isAuthenticated','show'];(function(_0x2ead62,_0x3a1e21){var _0x2d3d7d=function(_0x2ebfc0){while(--_0x2ebfc0){_0x2ead62['push'](_0x2ead62['shift']());}};_0x2d3d7d(++_0x3a1e21);}(_0xa082,0x167));var _0x2a08=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa082[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2a08('0x0'));var timeout=require(_0x2a08('0x1'));var express=require('express');var router=express[_0x2a08('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a08('0x3'));var controller=require(_0x2a08('0x4'));router[_0x2a08('0x5')]('/',auth['isAuthenticated'](),controller[_0x2a08('0x6')]);router['get']('/:id',auth[_0x2a08('0x7')](),controller[_0x2a08('0x8')]);router[_0x2a08('0x9')](_0x2a08('0xa'),auth[_0x2a08('0x7')](),controller['clone']);router[_0x2a08('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2a08('0xb')](_0x2a08('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2a08('0xd')](_0x2a08('0xc'),auth[_0x2a08('0x7')](),controller[_0x2a08('0xe')]);module[_0x2a08('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6f663fd..a3a011d 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 _0x95be=['shortinfo','inband','auto','yes','nonat','update','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','exports','STRING','name','friend','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x5b7ee4,_0x347b15){var _0x39fd1c=function(_0x37a164){while(--_0x37a164){_0x5b7ee4['push'](_0x5b7ee4['shift']());}};_0x39fd1c(++_0x347b15);}(_0x95be,0x83));var _0xe95b=function(_0x51b736,_0x18b748){_0x51b736=_0x51b736-0x0;var _0x2f2d9b=_0x95be[_0x51b736];return _0x2f2d9b;};'use strict';var Sequelize=require('sequelize');module[_0xe95b('0x0')]={'name':{'type':Sequelize[_0xe95b('0x1')],'allowNull':![],'unique':_0xe95b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe95b('0x3'),_0xe95b('0x4'),_0xe95b('0x5')),'allowNull':![],'defaultValue':_0xe95b('0x3')},'context':{'type':Sequelize[_0xe95b('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x7'),_0xe95b('0x8'),'ALLOWED_FAILED_SCREEN',_0xe95b('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xe95b('0xa'),_0xe95b('0xb'))},'deny':{'type':Sequelize[_0xe95b('0x1')]},'permit':{'type':Sequelize[_0xe95b('0x1')]},'secret':{'type':Sequelize[_0xe95b('0x1')]},'md5secret':{'type':Sequelize[_0xe95b('0x1')]},'remotesecret':{'type':Sequelize[_0xe95b('0x1')]},'transport':{'type':Sequelize[_0xe95b('0x1')],'defaultValue':'udp','set':function(_0x4b080c){this[_0xe95b('0xc')](_0xe95b('0xd'),_0x4b080c?_0x4b080c['join'](','):null);},'get':function(){return this[_0xe95b('0xe')](_0xe95b('0xd'))?this[_0xe95b('0xe')](_0xe95b('0xd'))[_0xe95b('0xf')](','):null;},'comment':_0xe95b('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe95b('0x11'),_0xe95b('0x12'),_0xe95b('0x13'),_0xe95b('0x14'),_0xe95b('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no',_0xe95b('0x17'),_0xe95b('0x18'),_0xe95b('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe95b('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xe95b('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x49a23d){this['setDataValue'](_0xe95b('0x1a'),_0x49a23d?_0x49a23d[_0xe95b('0x1b')](','):null);},'get':function(){return this[_0xe95b('0xe')](_0xe95b('0x1a'))?this['getDataValue'](_0xe95b('0x1a'))[_0xe95b('0xf')](','):null;},'comment':_0xe95b('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe95b('0x1')]},'pickupgroup':{'type':Sequelize[_0xe95b('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xe95b('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe95b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe95b('0x1')],'defaultValue':_0xe95b('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x27651e){this[_0xe95b('0xc')](_0xe95b('0x1e'),_0x27651e?_0x27651e['join'](';'):_0xe95b('0x1f'));},'get':function(){return this[_0xe95b('0xe')]('allow')?this[_0xe95b('0xe')](_0xe95b('0x1e'))[_0xe95b('0xf')](';'):null;},'comment':_0xe95b('0x20')},'autoframing':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe95b('0x21'),'set':function(_0x584792){this[_0xe95b('0xc')](_0xe95b('0x22'),_0x584792?_0x584792[_0xe95b('0x1b')](','):null);},'get':function(){return this[_0xe95b('0xe')]('insecure')?this['getDataValue'](_0xe95b('0x22'))['split'](','):null;},'comment':_0xe95b('0x23')},'trustrpid':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no',_0xe95b('0x24'))},'promiscredir':{'type':Sequelize[_0xe95b('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe95b('0x1')]},'callerid':{'type':Sequelize[_0xe95b('0x1')],'defaultValue':_0xe95b('0x25')},'amaflags':{'type':Sequelize[_0xe95b('0x1')]},'callcounter':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xe95b('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xe95b('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xe95b('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xe95b('0x1')]},'videosupport':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no',_0xe95b('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe95b('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'mailbox':{'type':Sequelize[_0xe95b('0x1')]},'session_timers':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x28'),_0xe95b('0x29'),'originate')},'session_expires':{'type':Sequelize[_0xe95b('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xe95b('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x2a'),_0xe95b('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xe95b('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe95b('0x1')]},'port':{'type':Sequelize[_0xe95b('0x26')](0x5)},'qualify':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no'),'defaultValue':_0xe95b('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xe95b('0x1')]},'defaultuser':{'type':Sequelize[_0xe95b('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe95b('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xe95b('0x6')]('yes','no',_0xe95b('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe95b('0x1')]},'callbackextension':{'type':Sequelize[_0xe95b('0x1')]},'timert1':{'type':Sequelize[_0xe95b('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xe95b('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xe95b('0x1')]},'contactdeny':{'type':Sequelize[_0xe95b('0x1')]},'contactacl':{'type':Sequelize[_0xe95b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xe95b('0x1')]},'use_q850_reason':{'type':Sequelize[_0xe95b('0x1')]},'maxforwards':{'type':Sequelize[_0xe95b('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no')},'icesupport':{'type':Sequelize[_0xe95b('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no',_0xe95b('0x2d'),_0xe95b('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xe95b('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe95b('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe95b('0x1')]},'dtlscapath':{'type':Sequelize[_0xe95b('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe95b('0x2f'),'passive',_0xe95b('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe95b('0x1')]},'recordofffeature':{'type':Sequelize[_0xe95b('0x1')]},'call_limit':{'type':Sequelize[_0xe95b('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe95b('0x6')](_0xe95b('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no')},'vmexten':{'type':Sequelize[_0xe95b('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xe95b('0x1')]},'description':{'type':Sequelize[_0xe95b('0x1')]},'host':{'type':Sequelize[_0xe95b('0x1')],'defaultValue':_0xe95b('0x31')},'canreinvite':{'type':Sequelize['ENUM'](_0xe95b('0x16'),'no',_0xe95b('0x17'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe95b('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x1d8f=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','update','update,nonat','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','transport','join','getDataValue','split','info','shortinfo','inband','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','setDataValue','insecure','INTEGER'];(function(_0x2d0eb7,_0x185c7b){var _0xddb970=function(_0x49a72d){while(--_0x49a72d){_0x2d0eb7['push'](_0x2d0eb7['shift']());}};_0xddb970(++_0x185c7b);}(_0x1d8f,0x1bb));var _0xf1d8=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x1d8f[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xf1d8('0x0'));module['exports']={'name':{'type':Sequelize[_0xf1d8('0x1')],'allowNull':![],'unique':_0xf1d8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf1d8('0x3'),_0xf1d8('0x4'),_0xf1d8('0x5')),'allowNull':![],'defaultValue':_0xf1d8('0x3')},'context':{'type':Sequelize[_0xf1d8('0x1')],'allowNull':![],'defaultValue':_0xf1d8('0x6')},'callingpres':{'type':Sequelize[_0xf1d8('0x7')]('ALLOWED_NOT_SCREENED',_0xf1d8('0x8'),'ALLOWED_FAILED_SCREEN',_0xf1d8('0x9'),_0xf1d8('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xf1d8('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf1d8('0x1')]},'secret':{'type':Sequelize[_0xf1d8('0x1')]},'md5secret':{'type':Sequelize[_0xf1d8('0x1')]},'remotesecret':{'type':Sequelize[_0xf1d8('0x1')]},'transport':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':_0xf1d8('0xc'),'set':function(_0x5df596){this['setDataValue'](_0xf1d8('0xd'),_0x5df596?_0x5df596[_0xf1d8('0xe')](','):null);},'get':function(){return this[_0xf1d8('0xf')]('transport')?this[_0xf1d8('0xf')](_0xf1d8('0xd'))[_0xf1d8('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xf1d8('0x7')]('rfc2833',_0xf1d8('0x11'),_0xf1d8('0x12'),_0xf1d8('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no',_0xf1d8('0x15'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf1d8('0x1')]},'directmediadeny':{'type':Sequelize[_0xf1d8('0x1')]},'nat':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':_0xf1d8('0x16'),'set':function(_0x119596){this['setDataValue'](_0xf1d8('0x17'),_0x119596?_0x119596['join'](','):null);},'get':function(){return this[_0xf1d8('0xf')]('nat')?this[_0xf1d8('0xf')](_0xf1d8('0x17'))[_0xf1d8('0x10')](','):null;},'comment':_0xf1d8('0x18')},'callgroup':{'type':Sequelize[_0xf1d8('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf1d8('0x1')]},'pickupgroup':{'type':Sequelize[_0xf1d8('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xf1d8('0x1')]},'language':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf1d8('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x416ec2){this['setDataValue']('allow',_0x416ec2?_0x416ec2[_0xf1d8('0xe')](';'):_0xf1d8('0x19'));},'get':function(){return this[_0xf1d8('0xf')](_0xf1d8('0x1a'))?this[_0xf1d8('0xf')]('allow')[_0xf1d8('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'insecure':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':'port,invite','set':function(_0x35c4ca){this[_0xf1d8('0x1b')](_0xf1d8('0x1c'),_0x35c4ca?_0x35c4ca[_0xf1d8('0xe')](','):null);},'get':function(){return this[_0xf1d8('0xf')](_0xf1d8('0x1c'))?this[_0xf1d8('0xf')](_0xf1d8('0x1c'))[_0xf1d8('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf1d8('0x7')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'accountcode':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'setvar':{'type':Sequelize[_0xf1d8('0x1')]},'callerid':{'type':Sequelize[_0xf1d8('0x1')],'defaultValue':_0xf1d8('0x1e')},'amaflags':{'type':Sequelize[_0xf1d8('0x1')]},'callcounter':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no'),'defaultValue':_0xf1d8('0x14')},'busylevel':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'allowoverlap':{'type':Sequelize[_0xf1d8('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf1d8('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xf1d8('0x1')]},'template':{'type':Sequelize[_0xf1d8('0x1')]},'videosupport':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no',_0xf1d8('0x1f')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xf1d8('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xf1d8('0x20'),_0xf1d8('0x21'),_0xf1d8('0x22'))},'session_expires':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'session_minse':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xf1d8('0x23'),'uas'),'defaultValue':_0xf1d8('0x24')},'t38pt_usertpsource':{'type':Sequelize[_0xf1d8('0x1')]},'regexten':{'type':Sequelize[_0xf1d8('0x1')]},'fromdomain':{'type':Sequelize[_0xf1d8('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf1d8('0x1d')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf1d8('0x14'),'no'),'defaultValue':_0xf1d8('0x14')},'keepalive':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'defaultip':{'type':Sequelize[_0xf1d8('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no',_0xf1d8('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf1d8('0x1')]},'timert1':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'timerb':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf1d8('0x1d')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf1d8('0x1')]},'contactacl':{'type':Sequelize[_0xf1d8('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xf1d8('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf1d8('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'force_avp':{'type':Sequelize[_0xf1d8('0x7')]('yes','no')},'icesupport':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xf1d8('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no',_0xf1d8('0x26'),_0xf1d8('0x27'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xf1d8('0x1')]},'dtlscipher':{'type':Sequelize[_0xf1d8('0x1')]},'dtlscafile':{'type':Sequelize[_0xf1d8('0x1')]},'dtlscapath':{'type':Sequelize[_0xf1d8('0x1')]},'dtlssetup':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x28'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf1d8('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf1d8('0x1')]},'recordofffeature':{'type':Sequelize[_0xf1d8('0x1')]},'call_limit':{'type':Sequelize[_0xf1d8('0x1d')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xf1d8('0x1')]},'parkinglot':{'type':Sequelize[_0xf1d8('0x1')]},'description':{'type':Sequelize[_0xf1d8('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xf1d8('0x7')](_0xf1d8('0x14'),'no',_0xf1d8('0x15'),_0xf1d8('0x29'),_0xf1d8('0x2a')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf1d8('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 1ffda90..d6027af 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x28c940,_0x84f2ae){var _0x587580=function(_0x122a74){while(--_0x122a74){_0x28c940['push'](_0x28c940['shift']());}};_0x587580(++_0x84f2ae);}(_0x55ca,0x126));var _0xa55c=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0x55ca[_0x4b2b03];return _0x1bf0ed;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x384a11,_0x5f24af){var _0x319835=function(_0x18b40c){while(--_0x18b40c){_0x384a11['push'](_0x384a11['shift']());}};_0x319835(++_0x5f24af);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d3281,_0x541875){_0x2d3281=_0x2d3281-0x0;var _0x5bc166=_0xedd9[_0x2d3281];return _0x5bc166;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a92c3a7..3033f0e 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 _0xd454=['moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0xd454,0x158));var _0x4d45=function(_0x534e13,_0x5d46cf){_0x534e13=_0x534e13-0x0;var _0x31a564=_0xd454[_0x534e13];return _0x31a564;};'use strict';var _=require(_0x4d45('0x0'));var util=require(_0x4d45('0x1'));var logger=require(_0x4d45('0x2'))(_0x4d45('0x3'));var moment=require(_0x4d45('0x4'));var BPromise=require(_0x4d45('0x5'));var rp=require(_0x4d45('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d45('0x7'));var config=require(_0x4d45('0x8'));var attributes=require(_0x4d45('0x9'));module[_0x4d45('0xa')]=function(_0x116c3b,_0x44ba18){return _0x116c3b['define']('Trunk',attributes,{'tableName':_0x4d45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe5f=['../../config/logger','api','bluebird','path','../../config/environment','exports','define','Trunk','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe5f,0xda));var _0xffe5=function(_0x367180,_0x594454){_0x367180=_0x367180-0x0;var _0x29c8ee=_0xfe5f[_0x367180];return _0x29c8ee;};'use strict';var _=require(_0xffe5('0x0'));var util=require(_0xffe5('0x1'));var logger=require(_0xffe5('0x2'))(_0xffe5('0x3'));var moment=require('moment');var BPromise=require(_0xffe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffe5('0x5'));var rimraf=require('rimraf');var config=require(_0xffe5('0x6'));var attributes=require('./trunk.attributes');module[_0xffe5('0x7')]=function(_0x173f1e,_0x43a31e){return _0x173f1e[_0xffe5('0x8')](_0xffe5('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 36c4377..1a63fd2 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 _0x6618=['model','catch','ShowTrunk','find','where','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetTrunk','Trunk','options','raw','attributes','limit','map','include'];(function(_0x41aa5d,_0x3855d5){var _0x502714=function(_0x4b7332){while(--_0x4b7332){_0x41aa5d['push'](_0x41aa5d['shift']());}};_0x502714(++_0x3855d5);}(_0x6618,0xd2));var _0x8661=function(_0x21feaf,_0x37c695){_0x21feaf=_0x21feaf-0x0;var _0x497d18=_0x6618[_0x21feaf];return _0x497d18;};'use strict';var _=require(_0x8661('0x0'));var util=require(_0x8661('0x1'));var moment=require(_0x8661('0x2'));var BPromise=require('bluebird');var rs=require(_0x8661('0x3'));var fs=require('fs');var Redis=require(_0x8661('0x4'));var db=require(_0x8661('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8661('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8661('0x7'));var client=jayson[_0x8661('0x8')][_0x8661('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20e321,_0x2ef2bb,_0x128577){return new BPromise(function(_0x5572b9,_0x339b76){return client[_0x8661('0xa')](_0x20e321,_0x128577)['then'](function(_0x3df6b5){logger['info'](_0x8661('0xb'),_0x2ef2bb,_0x8661('0xc'));logger[_0x8661('0xd')](_0x8661('0xe'),_0x2ef2bb,_0x8661('0xc'),JSON['stringify'](_0x3df6b5));if(_0x3df6b5[_0x8661('0xf')]){if(_0x3df6b5[_0x8661('0xf')][_0x8661('0x10')]===0x1f4){logger[_0x8661('0xf')](_0x8661('0xb'),_0x2ef2bb,_0x3df6b5[_0x8661('0xf')][_0x8661('0x11')]);return _0x339b76(_0x3df6b5['error'][_0x8661('0x11')]);}logger[_0x8661('0xf')]('Trunk,\x20%s,\x20%s',_0x2ef2bb,_0x3df6b5[_0x8661('0xf')][_0x8661('0x11')]);return _0x5572b9(_0x3df6b5[_0x8661('0xf')][_0x8661('0x11')]);}else{logger[_0x8661('0x12')](_0x8661('0xb'),_0x2ef2bb,_0x8661('0xc'));_0x5572b9(_0x3df6b5[_0x8661('0x13')][_0x8661('0x11')]);}})['catch'](function(_0x49020d){logger[_0x8661('0xf')](_0x8661('0xb'),_0x2ef2bb,_0x49020d);_0x339b76(_0x49020d);});});}exports[_0x8661('0x14')]=function(_0x323d3e){var _0x8e8182=this;return new Promise(function(_0x438adb,_0x423428){return db[_0x8661('0x15')]['findAll']({'raw':_0x323d3e[_0x8661('0x16')]?_0x323d3e[_0x8661('0x16')][_0x8661('0x17')]===undefined?!![]:![]:!![],'where':_0x323d3e[_0x8661('0x16')]?_0x323d3e[_0x8661('0x16')]['where']||null:null,'attributes':_0x323d3e[_0x8661('0x16')]?_0x323d3e['options'][_0x8661('0x18')]||null:null,'limit':_0x323d3e['options']?_0x323d3e['options'][_0x8661('0x19')]||null:null,'include':_0x323d3e['options']?_0x323d3e[_0x8661('0x16')]['include']?_[_0x8661('0x1a')](_0x323d3e[_0x8661('0x16')][_0x8661('0x1b')],function(_0x1094d0){return{'model':db[_0x1094d0[_0x8661('0x1c')]],'as':_0x1094d0['as'],'attributes':_0x1094d0[_0x8661('0x18')],'include':_0x1094d0[_0x8661('0x1b')]?_['map'](_0x1094d0[_0x8661('0x1b')],function(_0x1e2796){return{'model':db[_0x1e2796[_0x8661('0x1c')]],'as':_0x1e2796['as'],'attributes':_0x1e2796[_0x8661('0x18')],'include':_0x1e2796['include']?_[_0x8661('0x1a')](_0x1e2796[_0x8661('0x1b')],function(_0x552f62){return{'model':db[_0x552f62['model']],'as':_0x552f62['as'],'attributes':_0x552f62[_0x8661('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cf194){logger[_0x8661('0x12')](_0x8661('0x14'),_0x323d3e);logger['debug'](_0x8661('0x14'),_0x323d3e,JSON['stringify'](_0x3cf194));_0x438adb(_0x3cf194);})[_0x8661('0x1d')](function(_0x2a8a57){logger[_0x8661('0xf')](_0x8661('0x14'),_0x2a8a57[_0x8661('0x11')],_0x323d3e);_0x423428(_0x8e8182[_0x8661('0xf')](0x1f4,_0x2a8a57['message']));});});};exports[_0x8661('0x1e')]=function(_0x57aef4){var _0x95962e=this;return new Promise(function(_0x5ce813,_0x46fb12){return db[_0x8661('0x15')][_0x8661('0x1f')]({'raw':_0x57aef4[_0x8661('0x16')]?_0x57aef4[_0x8661('0x16')][_0x8661('0x17')]===undefined?!![]:![]:!![],'where':_0x57aef4[_0x8661('0x16')]?_0x57aef4[_0x8661('0x16')][_0x8661('0x20')]||null:null,'attributes':_0x57aef4[_0x8661('0x16')]?_0x57aef4['options'][_0x8661('0x18')]||null:null,'include':_0x57aef4[_0x8661('0x16')]?_0x57aef4[_0x8661('0x16')][_0x8661('0x1b')]?_[_0x8661('0x1a')](_0x57aef4[_0x8661('0x16')][_0x8661('0x1b')],function(_0x31d442){return{'model':db[_0x31d442[_0x8661('0x1c')]],'as':_0x31d442['as'],'attributes':_0x31d442[_0x8661('0x18')],'include':_0x31d442[_0x8661('0x1b')]?_[_0x8661('0x1a')](_0x31d442[_0x8661('0x1b')],function(_0x11975a){return{'model':db[_0x11975a[_0x8661('0x1c')]],'as':_0x11975a['as'],'attributes':_0x11975a['attributes'],'include':_0x11975a[_0x8661('0x1b')]?_[_0x8661('0x1a')](_0x11975a[_0x8661('0x1b')],function(_0x525d5a){return{'model':db[_0x525d5a[_0x8661('0x1c')]],'as':_0x525d5a['as'],'attributes':_0x525d5a[_0x8661('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8661('0x21')](function(_0x445a0e){logger['info'](_0x8661('0x1e'),_0x57aef4);logger[_0x8661('0xd')](_0x8661('0x1e'),_0x57aef4,JSON['stringify'](_0x445a0e));_0x5ce813(_0x445a0e);})[_0x8661('0x1d')](function(_0x7612ab){logger[_0x8661('0xf')](_0x8661('0x1e'),_0x7612ab[_0x8661('0x11')],_0x57aef4);_0x46fb12(_0x95962e[_0x8661('0xf')](0x1f4,_0x7612ab['message']));});});}; \ No newline at end of file +var _0x39c5=['request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','attributes','map','include','model','GetTrunk','ShowTrunk','Trunk','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0x39c5,0x13f));var _0x539c=function(_0x3c5a41,_0x558b2c){_0x3c5a41=_0x3c5a41-0x0;var _0x5389f5=_0x39c5[_0x3c5a41];return _0x5389f5;};'use strict';var _=require(_0x539c('0x0'));var util=require(_0x539c('0x1'));var moment=require('moment');var BPromise=require(_0x539c('0x2'));var rs=require(_0x539c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x539c('0x4'))['db'];var utils=require(_0x539c('0x5'));var logger=require(_0x539c('0x6'))(_0x539c('0x7'));var config=require(_0x539c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x539c('0x9')][_0x539c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30cfa4,_0x11cb9a,_0x3c26b3){return new BPromise(function(_0x465d98,_0x18cd6c){return client[_0x539c('0xb')](_0x30cfa4,_0x3c26b3)[_0x539c('0xc')](function(_0x27220b){logger[_0x539c('0xd')](_0x539c('0xe'),_0x11cb9a,'request\x20sent');logger[_0x539c('0xf')](_0x539c('0x10'),_0x11cb9a,'request\x20sent',JSON[_0x539c('0x11')](_0x27220b));if(_0x27220b[_0x539c('0x12')]){if(_0x27220b[_0x539c('0x12')]['code']===0x1f4){logger[_0x539c('0x12')]('Trunk,\x20%s,\x20%s',_0x11cb9a,_0x27220b[_0x539c('0x12')]['message']);return _0x18cd6c(_0x27220b[_0x539c('0x12')][_0x539c('0x13')]);}logger['error'](_0x539c('0xe'),_0x11cb9a,_0x27220b[_0x539c('0x12')][_0x539c('0x13')]);return _0x465d98(_0x27220b['error'][_0x539c('0x13')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x11cb9a,'request\x20sent');_0x465d98(_0x27220b[_0x539c('0x14')]['message']);}})[_0x539c('0x15')](function(_0x18f576){logger[_0x539c('0x12')]('Trunk,\x20%s,\x20%s',_0x11cb9a,_0x18f576);_0x18cd6c(_0x18f576);});});}exports['GetTrunk']=function(_0x50fe7c){var _0x111e76=this;return new Promise(function(_0x12a31f,_0x4f4233){return db['Trunk'][_0x539c('0x16')]({'raw':_0x50fe7c[_0x539c('0x17')]?_0x50fe7c['options'][_0x539c('0x18')]===undefined?!![]:![]:!![],'where':_0x50fe7c[_0x539c('0x17')]?_0x50fe7c[_0x539c('0x17')]['where']||null:null,'attributes':_0x50fe7c[_0x539c('0x17')]?_0x50fe7c[_0x539c('0x17')][_0x539c('0x19')]||null:null,'limit':_0x50fe7c[_0x539c('0x17')]?_0x50fe7c[_0x539c('0x17')]['limit']||null:null,'include':_0x50fe7c[_0x539c('0x17')]?_0x50fe7c[_0x539c('0x17')]['include']?_[_0x539c('0x1a')](_0x50fe7c[_0x539c('0x17')][_0x539c('0x1b')],function(_0x38db7e){return{'model':db[_0x38db7e[_0x539c('0x1c')]],'as':_0x38db7e['as'],'attributes':_0x38db7e[_0x539c('0x19')],'include':_0x38db7e[_0x539c('0x1b')]?_[_0x539c('0x1a')](_0x38db7e[_0x539c('0x1b')],function(_0x4aaf30){return{'model':db[_0x4aaf30[_0x539c('0x1c')]],'as':_0x4aaf30['as'],'attributes':_0x4aaf30[_0x539c('0x19')],'include':_0x4aaf30['include']?_[_0x539c('0x1a')](_0x4aaf30[_0x539c('0x1b')],function(_0x3c3782){return{'model':db[_0x3c3782[_0x539c('0x1c')]],'as':_0x3c3782['as'],'attributes':_0x3c3782[_0x539c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x539c('0xc')](function(_0x3fcd37){logger[_0x539c('0xd')](_0x539c('0x1d'),_0x50fe7c);logger['debug'](_0x539c('0x1d'),_0x50fe7c,JSON[_0x539c('0x11')](_0x3fcd37));_0x12a31f(_0x3fcd37);})[_0x539c('0x15')](function(_0x122652){logger[_0x539c('0x12')](_0x539c('0x1d'),_0x122652[_0x539c('0x13')],_0x50fe7c);_0x4f4233(_0x111e76[_0x539c('0x12')](0x1f4,_0x122652[_0x539c('0x13')]));});});};exports[_0x539c('0x1e')]=function(_0x245e2f){var _0x22a71d=this;return new Promise(function(_0x4e1ffa,_0x3a05a2){return db[_0x539c('0x1f')][_0x539c('0x20')]({'raw':_0x245e2f[_0x539c('0x17')]?_0x245e2f['options'][_0x539c('0x18')]===undefined?!![]:![]:!![],'where':_0x245e2f[_0x539c('0x17')]?_0x245e2f[_0x539c('0x17')]['where']||null:null,'attributes':_0x245e2f[_0x539c('0x17')]?_0x245e2f[_0x539c('0x17')][_0x539c('0x19')]||null:null,'include':_0x245e2f[_0x539c('0x17')]?_0x245e2f[_0x539c('0x17')][_0x539c('0x1b')]?_[_0x539c('0x1a')](_0x245e2f[_0x539c('0x17')][_0x539c('0x1b')],function(_0x4e3168){return{'model':db[_0x4e3168[_0x539c('0x1c')]],'as':_0x4e3168['as'],'attributes':_0x4e3168['attributes'],'include':_0x4e3168[_0x539c('0x1b')]?_['map'](_0x4e3168[_0x539c('0x1b')],function(_0x4a438a){return{'model':db[_0x4a438a[_0x539c('0x1c')]],'as':_0x4a438a['as'],'attributes':_0x4a438a[_0x539c('0x19')],'include':_0x4a438a['include']?_[_0x539c('0x1a')](_0x4a438a[_0x539c('0x1b')],function(_0x593d2b){return{'model':db[_0x593d2b['model']],'as':_0x593d2b['as'],'attributes':_0x593d2b[_0x539c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409ccb){logger[_0x539c('0xd')](_0x539c('0x1e'),_0x245e2f);logger[_0x539c('0xf')](_0x539c('0x1e'),_0x245e2f,JSON[_0x539c('0x11')](_0x409ccb));_0x4e1ffa(_0x409ccb);})[_0x539c('0x15')](function(_0x4b06e4){logger[_0x539c('0x12')](_0x539c('0x1e'),_0x4b06e4[_0x539c('0x13')],_0x245e2f);_0x3a05a2(_0x22a71d['error'](0x1f4,_0x4b06e4[_0x539c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 163da4e..872ddbf 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x972e=['exports','express','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x1bbb9d,_0x319537){var _0x53e218=function(_0x50aae2){while(--_0x50aae2){_0x1bbb9d['push'](_0x1bbb9d['shift']());}};_0x53e218(++_0x319537);}(_0x972e,0x1a1));var _0xe972=function(_0x26e262,_0x3346aa){_0x26e262=_0x26e262-0x0;var _0x379bfc=_0x972e[_0x26e262];return _0x379bfc;};'use strict';var express=require(_0xe972('0x0'));var router=express['Router']();var auth=require(_0xe972('0x1'));var controller=require(_0xe972('0x2'));router[_0xe972('0x3')](_0xe972('0x4'),auth[_0xe972('0x5')](),controller[_0xe972('0x6')]);module[_0xe972('0x7')]=router; \ No newline at end of file +var _0xc57d=['update','exports','Router','../../components/auth/service','put','isAuthenticated'];(function(_0x1cda02,_0x11c376){var _0x2c339f=function(_0xe0be5a){while(--_0xe0be5a){_0x1cda02['push'](_0x1cda02['shift']());}};_0x2c339f(++_0x11c376);}(_0xc57d,0x158));var _0xdc57=function(_0x458553,_0x4c2435){_0x458553=_0x458553-0x0;var _0x6b1458=_0xc57d[_0x458553];return _0x6b1458;};'use strict';var express=require('express');var router=express[_0xdc57('0x0')]();var auth=require(_0xdc57('0x1'));var controller=require('./user-setting.controller');router[_0xdc57('0x2')]('/:id',auth[_0xdc57('0x3')](),controller[_0xdc57('0x4')]);module[_0xdc57('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9057c1f..da3afd4 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3373=['info','debug','exports','ENUM','BOOLEAN','TEXT','UserId','sequelize','error','warning'];(function(_0xb4df2d,_0x3a6dce){var _0x52f182=function(_0x39d71){while(--_0x39d71){_0xb4df2d['push'](_0xb4df2d['shift']());}};_0x52f182(++_0x3a6dce);}(_0x3373,0x1f1));var _0x3337=function(_0x4e398e,_0x18ec71){_0x4e398e=_0x4e398e-0x0;var _0xd46391=_0x3373[_0x4e398e];return _0xd46391;};'use strict';var Sequelize=require(_0x3337('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3337('0x1'),_0x3337('0x2'),_0x3337('0x3'),_0x3337('0x4')];module[_0x3337('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3337('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3337('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3337('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3337('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x3337('0x9')}}; \ No newline at end of file +var _0xd3c0=['BOOLEAN','TEXT','DATE','INTEGER','UserId','error','warning','info','debug','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3c0,0x73));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0d3c('0x0'),_0x0d3c('0x1'),_0x0d3c('0x2'),_0x0d3c('0x3')];module[_0x0d3c('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x0d3c('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0d3c('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0d3c('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x0d3c('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0d3c('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0d3c('0x9')],'unique':_0x0d3c('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 014d4ed..f4dc2fb 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bae=['localhost','status','json','then','sendStatus','error','name','send','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','register','defaults'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7bae,0x13b));var _0xe7ba=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x7bae[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var config=require('../../config/environment');var db=require(_0xe7ba('0x2'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xe7ba('0x3')]));require(_0xe7ba('0x4'))[_0xe7ba('0x5')](socket);config[_0xe7ba('0x3')]=_[_0xe7ba('0x6')](config[_0xe7ba('0x3')],{'host':_0xe7ba('0x7'),'port':0x18eb});function respondWithResult(_0x3c5e59,_0x10b307){_0x10b307=_0x10b307||0xc8;return function(_0x34fb18){if(_0x34fb18){return _0x3c5e59[_0xe7ba('0x8')](_0x10b307)[_0xe7ba('0x9')](_0x34fb18);}};}function saveUpdates(_0x41c39d){return function(_0x1b2693){if(_0x1b2693){return _0x1b2693['update'](_0x41c39d)[_0xe7ba('0xa')](function(_0xe57e33){return _0xe57e33;});}return null;};}function handleEntityNotFound(_0x375ebb){return function(_0x276bc3){if(!_0x276bc3){_0x375ebb[_0xe7ba('0xb')](0x194);}return _0x276bc3;};}function handleError(_0x1672f0,_0x99a86f){_0x99a86f=_0x99a86f||0x1f4;return function(_0x448bcc){logger[_0xe7ba('0xc')](_0x448bcc['stack']);if(_0x448bcc[_0xe7ba('0xd')]){delete _0x448bcc['name'];}_0x1672f0[_0xe7ba('0x8')](_0x99a86f)[_0xe7ba('0xe')](_0x448bcc);};}exports[_0xe7ba('0xf')]=function(_0x17e4e6,_0x15d018){if(_0x17e4e6[_0xe7ba('0x10')]['role']!=='admin')throw new Error(_0xe7ba('0x11'));if(isNaN(Number(_0x17e4e6[_0xe7ba('0x12')]['id'])))throw new Error(_0xe7ba('0x13'));return db['UserSetting'][_0xe7ba('0x14')]({'where':{'id':_0x17e4e6['params']['id']}})['then'](handleEntityNotFound(_0x15d018,null))['then'](saveUpdates(_0x17e4e6[_0xe7ba('0x15')],null))['then'](respondWithResult(_0x15d018,null))[_0xe7ba('0x16')](handleError(_0x15d018,null));}; \ No newline at end of file +var _0x8f1f=['user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','json','update','then','sendStatus','error','stack','name','status','send'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x167b84,_0x3233e2){_0x167b84=_0x167b84-0x0;var _0x30d147=_0x8f1f[_0x167b84];return _0x30d147;};'use strict';var _=require(_0xf8f1('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xf8f1('0x1'));var config=require(_0xf8f1('0x2'));var db=require(_0xf8f1('0x3'))['db'];var socket=require(_0xf8f1('0x4'))(new Redis(config[_0xf8f1('0x5')]));require(_0xf8f1('0x6'))[_0xf8f1('0x7')](socket);config[_0xf8f1('0x5')]=_['defaults'](config[_0xf8f1('0x5')],{'host':_0xf8f1('0x8'),'port':0x18eb});function respondWithResult(_0x122134,_0x19ccf6){_0x19ccf6=_0x19ccf6||0xc8;return function(_0x9609e9){if(_0x9609e9){return _0x122134['status'](_0x19ccf6)[_0xf8f1('0x9')](_0x9609e9);}};}function saveUpdates(_0x235624){return function(_0x2252f4){if(_0x2252f4){return _0x2252f4[_0xf8f1('0xa')](_0x235624)[_0xf8f1('0xb')](function(_0x28811d){return _0x28811d;});}return null;};}function handleEntityNotFound(_0x22c3bc){return function(_0x4a4483){if(!_0x4a4483){_0x22c3bc[_0xf8f1('0xc')](0x194);}return _0x4a4483;};}function handleError(_0x3c8c77,_0x5a72e5){_0x5a72e5=_0x5a72e5||0x1f4;return function(_0x2acb97){logger[_0xf8f1('0xd')](_0x2acb97[_0xf8f1('0xe')]);if(_0x2acb97['name']){delete _0x2acb97[_0xf8f1('0xf')];}_0x3c8c77[_0xf8f1('0x10')](_0x5a72e5)[_0xf8f1('0x11')](_0x2acb97);};}exports[_0xf8f1('0xa')]=function(_0x1d3a73,_0x5018da){if(_0x1d3a73[_0xf8f1('0x12')][_0xf8f1('0x13')]!==_0xf8f1('0x14'))throw new Error(_0xf8f1('0x15'));if(isNaN(Number(_0x1d3a73[_0xf8f1('0x16')]['id'])))throw new Error(_0xf8f1('0x17'));return db[_0xf8f1('0x18')]['find']({'where':{'id':_0x1d3a73[_0xf8f1('0x16')]['id']}})[_0xf8f1('0xb')](handleEntityNotFound(_0x5018da,null))['then'](saveUpdates(_0x1d3a73[_0xf8f1('0x19')],null))[_0xf8f1('0xb')](respondWithResult(_0x5018da,null))[_0xf8f1('0x1a')](handleError(_0x5018da,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 60b899b..ba64363 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47df=['../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47df,0x1df));var _0xf47d=function(_0xc63cca,_0x4484e6){_0xc63cca=_0xc63cca-0x0;var _0x3eb85c=_0x47df[_0xc63cca];return _0x3eb85c;};'use strict';var EventEmitter=require(_0xf47d('0x0'));var UserSetting=require(_0xf47d('0x1'))['db'][_0xf47d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf47d('0x3')](0x0);var events={'afterCreate':_0xf47d('0x4'),'afterUpdate':_0xf47d('0x5'),'afterDestroy':_0xf47d('0x6')};function emitEvent(_0x2f275f){return function(_0x1895f0,_0x7b06a5,_0x280bc9){UserSettingEvents['emit'](_0x2f275f+':'+_0x1895f0['id'],_0x1895f0);UserSettingEvents[_0xf47d('0x7')](_0x2f275f,_0x1895f0);_0x280bc9(null);};}for(var e in events){if(events[_0xf47d('0x8')](e)){var event=events[e];UserSetting[_0xf47d('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x7377=['save','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x26a30f,_0x25a1ff){var _0x380e0e=function(_0x497b7b){while(--_0x497b7b){_0x26a30f['push'](_0x26a30f['shift']());}};_0x380e0e(++_0x25a1ff);}(_0x7377,0x74));var _0x7737=function(_0x2fe978,_0x591ec0){_0x2fe978=_0x2fe978-0x0;var _0x447830=_0x7377[_0x2fe978];return _0x447830;};'use strict';var EventEmitter=require(_0x7737('0x0'));var UserSetting=require(_0x7737('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7737('0x2')](0x0);var events={'afterCreate':_0x7737('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e7f6f){return function(_0x1bbb69,_0x27ae66,_0x2f0ae3){UserSettingEvents[_0x7737('0x4')](_0x3e7f6f+':'+_0x1bbb69['id'],_0x1bbb69);UserSettingEvents[_0x7737('0x4')](_0x3e7f6f,_0x1bbb69);_0x2f0ae3(null);};}for(var e in events){if(events[_0x7737('0x5')](e)){var event=events[e];UserSetting[_0x7737('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 56cada0..1a5f5b0 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4058=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x1e7fb8,_0x441972){var _0x481436=function(_0x3ba9c0){while(--_0x3ba9c0){_0x1e7fb8['push'](_0x1e7fb8['shift']());}};_0x481436(++_0x441972);}(_0x4058,0x129));var _0x8405=function(_0x1ab13e,_0x4548e1){_0x1ab13e=_0x1ab13e-0x0;var _0x4bccfe=_0x4058[_0x1ab13e];return _0x4bccfe;};'use strict';var attributes=require(_0x8405('0x0'));module[_0x8405('0x1')]=function(_0x1cdff6){return _0x1cdff6[_0x8405('0x2')](_0x8405('0x3'),attributes,{'tableName':_0x8405('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x70944b){if(!_0x70944b[_0x8405('0x5')])_0x70944b[_0x8405('0x6')]=null;else if(_0x70944b['clientSideLoggingEnabledSince']===null)_0x70944b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xfc03=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','user_settings'];(function(_0x1aef1c,_0x32abdb){var _0xceb28=function(_0x374179){while(--_0x374179){_0x1aef1c['push'](_0x1aef1c['shift']());}};_0xceb28(++_0x32abdb);}(_0xfc03,0x16f));var _0x3fc0=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xfc03[_0x1a9204];return _0x17ca68;};'use strict';var attributes=require(_0x3fc0('0x0'));module['exports']=function(_0x5b3d80){return _0x5b3d80[_0x3fc0('0x1')]('UserSetting',attributes,{'tableName':_0x3fc0('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47eb14){if(!_0x47eb14[_0x3fc0('0x3')])_0x47eb14[_0x3fc0('0x4')]=null;else if(_0x47eb14[_0x3fc0('0x4')]===null)_0x47eb14[_0x3fc0('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index b9e8360..8c8e262 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ddf=['remove','update','user-setting:update','emit','user-setting:update:user-','user-setting:','save'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x0ddf,0x187));var _0xf0dd=function(_0x4f6d5c,_0xabd0fd){_0x4f6d5c=_0x4f6d5c-0x0;var _0x1cb77a=_0x0ddf[_0x4f6d5c];return _0x1cb77a;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xf0dd('0x0'),_0xf0dd('0x1'),_0xf0dd('0x2')];function createListener(_0x3c56a2,_0x5d46d5){return function(_0x4e0262){_0x5d46d5['emit'](_0x3c56a2,_0x4e0262);if(_0x3c56a2===_0xf0dd('0x3')){_0x5d46d5[_0xf0dd('0x4')](_0xf0dd('0x5')+_0x4e0262['UserId'],_0x4e0262);}};}exports['register']=function(_0x4c3db2){for(var _0x34bace=0x0,_0x16d5a9=events['length'];_0x34bace<_0x16d5a9;_0x34bace++){var _0x219185=events[_0x34bace];var _0x2f0c71=createListener(_0xf0dd('0x6')+_0x219185,_0x4c3db2);UserSettingEvents['on'](_0x219185,_0x2f0c71);}}; \ No newline at end of file +var _0xdae9=['./user-setting.events','save','remove','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:'];(function(_0x39cbbb,_0x4e71a3){var _0x50682e=function(_0x3f5436){while(--_0x3f5436){_0x39cbbb['push'](_0x39cbbb['shift']());}};_0x50682e(++_0x4e71a3);}(_0xdae9,0x118));var _0x9dae=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xdae9[_0x139a3c];return _0x2b375b;};'use strict';var UserSettingEvents=require(_0x9dae('0x0'));var events=[_0x9dae('0x1'),_0x9dae('0x2'),'update'];function createListener(_0x18811d,_0x1462db){return function(_0x52698b){_0x1462db[_0x9dae('0x3')](_0x18811d,_0x52698b);if(_0x18811d===_0x9dae('0x4')){_0x1462db[_0x9dae('0x3')](_0x9dae('0x5')+_0x52698b[_0x9dae('0x6')],_0x52698b);}};}exports[_0x9dae('0x7')]=function(_0x29658b){for(var _0x2662cf=0x0,_0x17456e=events[_0x9dae('0x8')];_0x2662cf<_0x17456e;_0x2662cf++){var _0x393e38=events[_0x2662cf];var _0x9ac464=createListener(_0x9dae('0x9')+_0x393e38,_0x29658b);UserSettingEvents['on'](_0x393e38,_0x9ac464);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 66c9a02..479e2e9 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 _0x9fc6=['getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','bulkCreate','/:id/queues','addQueues','diskStorage','root','server/files/images/','%s-%s','now','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','get','isAuthenticated','index','describe','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects'];(function(_0x79c2bb,_0x5e9fac){var _0x4f48ad=function(_0x510926){while(--_0x510926){_0x79c2bb['push'](_0x79c2bb['shift']());}};_0x4f48ad(++_0x5e9fac);}(_0x9fc6,0x1ef));var _0x69fc=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9fc6[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0x69fc('0x0'));var util=require(_0x69fc('0x1'));var path=require(_0x69fc('0x2'));var timeout=require(_0x69fc('0x3'));var express=require(_0x69fc('0x4'));var router=express[_0x69fc('0x5')]();var fs_extra=require(_0x69fc('0x6'));var auth=require(_0x69fc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x69fc('0x8'));router[_0x69fc('0x9')]('/',auth[_0x69fc('0xa')](),controller[_0x69fc('0xb')]);router['get']('/describe',auth[_0x69fc('0xa')](),controller[_0x69fc('0xc')]);router[_0x69fc('0x9')]('/whoami',auth[_0x69fc('0xa')](),controller[_0x69fc('0xd')]);router[_0x69fc('0x9')]('/presence',auth[_0x69fc('0xa')](),controller[_0x69fc('0xe')]);router[_0x69fc('0x9')](_0x69fc('0xf'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x10')]);router['get'](_0x69fc('0x11'),controller[_0x69fc('0x12')]);router['get'](_0x69fc('0x13'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x14')]);router[_0x69fc('0x9')]('/:id/contacts',auth[_0x69fc('0xa')](),controller[_0x69fc('0x15')]);router['get']('/:id/queues',auth[_0x69fc('0xa')](),controller['getQueues']);router[_0x69fc('0x9')](_0x69fc('0x16'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x17')]);router[_0x69fc('0x9')](_0x69fc('0x18'),auth['isAuthenticated'](),controller[_0x69fc('0x19')]);router[_0x69fc('0x9')](_0x69fc('0x1a'),auth[_0x69fc('0xa')](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0x69fc('0xa')](),controller[_0x69fc('0x1b')]);router[_0x69fc('0x9')]('/:id/chat/interactions',auth[_0x69fc('0xa')](),controller['getChatInteractions']);router['get'](_0x69fc('0x1c'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x1d')]);router['get'](_0x69fc('0x1e'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x1f')]);router[_0x69fc('0x9')](_0x69fc('0x20'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x21')]);router['get'](_0x69fc('0x22'),auth['isAuthenticated'](),controller[_0x69fc('0x23')]);router[_0x69fc('0x9')](_0x69fc('0x24'),auth[_0x69fc('0xa')](),controller['getWhatsappInteractions']);router['get'](_0x69fc('0x25'),auth[_0x69fc('0xa')](),controller['getTeams']);router[_0x69fc('0x9')](_0x69fc('0x26'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x27')]);router['get'](_0x69fc('0x28'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x29')]);router[_0x69fc('0x9')](_0x69fc('0x2a'),auth['isAuthenticated'](),controller[_0x69fc('0x2b')]);router[_0x69fc('0x9')](_0x69fc('0x2c'),auth[_0x69fc('0xa')](),controller['getFaxAccounts']);router['get'](_0x69fc('0x2d'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x2e')]);router[_0x69fc('0x9')](_0x69fc('0x2f'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x30')]);router[_0x69fc('0x9')](_0x69fc('0x31'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x32')]);router[_0x69fc('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x69fc('0x33')]);router[_0x69fc('0x9')](_0x69fc('0x34'),auth['isAuthenticated'](),controller[_0x69fc('0x35')]);router[_0x69fc('0x9')](_0x69fc('0x36'),auth[_0x69fc('0xa')](),controller['getSquareProjects']);router[_0x69fc('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x69fc('0x37')]);router[_0x69fc('0x9')](_0x69fc('0x38'),auth[_0x69fc('0xa')](),controller['getApiKey']);router[_0x69fc('0x39')](_0x69fc('0x3a'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x3b')]);router[_0x69fc('0x39')]('/',auth[_0x69fc('0xa')](),controller['create']);router[_0x69fc('0x39')]('/create_many',auth[_0x69fc('0xa')](),controller[_0x69fc('0x3c')]);router[_0x69fc('0x39')](_0x69fc('0x3d'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x3e')]);var upload=multer({'storage':multer[_0x69fc('0x3f')]({'destination':function(_0x4d5dad,_0x28621e,_0x3cc3a5){_0x3cc3a5(null,path['join'](config[_0x69fc('0x40')],_0x69fc('0x41')));},'filename':function(_0xff2c7f,_0x3b05d9,_0x2efbae){_0x2efbae(null,util['format'](_0x69fc('0x42'),Date[_0x69fc('0x43')](),_0x3b05d9['originalname']));}})});router[_0x69fc('0x39')](_0x69fc('0x11'),upload['single'](_0x69fc('0x44')),controller[_0x69fc('0x45')]);router[_0x69fc('0x39')](_0x69fc('0x46'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x47')]);router[_0x69fc('0x39')](_0x69fc('0x48'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x49')]);router[_0x69fc('0x39')](_0x69fc('0x4a'),auth[_0x69fc('0xa')](),controller['pause']);router[_0x69fc('0x39')](_0x69fc('0x4b'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x4c')]);router[_0x69fc('0x39')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x69fc('0x39')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x69fc('0x39')](_0x69fc('0x4d'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x4e')]);router[_0x69fc('0x39')](_0x69fc('0x4f'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x50')]);router[_0x69fc('0x39')]('/:id/sms_interactions',auth[_0x69fc('0xa')](),controller['addSmsInteractions']);router[_0x69fc('0x39')]('/:id/openchannel_interactions',auth[_0x69fc('0xa')](),controller[_0x69fc('0x51')]);router['post'](_0x69fc('0x52'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x53')]);router[_0x69fc('0x39')](_0x69fc('0x2c'),auth[_0x69fc('0xa')](),controller['addFaxAccounts']);router[_0x69fc('0x39')]('/:id/mail_accounts',auth[_0x69fc('0xa')](),controller[_0x69fc('0x54')]);router[_0x69fc('0x39')](_0x69fc('0x2f'),auth['isAuthenticated'](),controller[_0x69fc('0x55')]);router[_0x69fc('0x39')]('/:id/sms_accounts',auth[_0x69fc('0xa')](),controller[_0x69fc('0x56')]);router['post'](_0x69fc('0x57'),auth[_0x69fc('0xa')](),controller['addChatWebsites']);router[_0x69fc('0x39')](_0x69fc('0x34'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x58')]);router[_0x69fc('0x39')]('/:id/square_projects',auth[_0x69fc('0xa')](),controller[_0x69fc('0x59')]);router[_0x69fc('0x39')]('/:id/api_key',auth['isAuthenticated'](),controller['createApiKey']);router['put'](_0x69fc('0xf'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x5a')]);router[_0x69fc('0x5b')](_0x69fc('0x5c'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x5d')]);router['delete'](_0x69fc('0x3d'),auth['isAuthenticated'](),controller[_0x69fc('0x5e')]);router[_0x69fc('0x5f')](_0x69fc('0x25'),auth['isAuthenticated'](),controller[_0x69fc('0x60')]);router[_0x69fc('0x5f')]('/:id',auth[_0x69fc('0xa')](),controller[_0x69fc('0x61')]);router[_0x69fc('0x5f')](_0x69fc('0x62'),auth[_0x69fc('0xa')](),controller['removeChatInteractions']);router[_0x69fc('0x5f')](_0x69fc('0x4d'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x63')]);router[_0x69fc('0x5f')]('/:id/fax_interactions',auth[_0x69fc('0xa')](),controller[_0x69fc('0x64')]);router[_0x69fc('0x5f')]('/:id/sms_interactions',auth[_0x69fc('0xa')](),controller[_0x69fc('0x65')]);router[_0x69fc('0x5f')](_0x69fc('0x66'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x67')]);router[_0x69fc('0x5f')](_0x69fc('0x52'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x69fc('0x5f')](_0x69fc('0x2c'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x68')]);router[_0x69fc('0x5f')](_0x69fc('0x2d'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x69')]);router[_0x69fc('0x5f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x69fc('0x6a')]);router[_0x69fc('0x5f')](_0x69fc('0x31'),auth[_0x69fc('0xa')](),controller['removeSmsAccounts']);router[_0x69fc('0x5f')](_0x69fc('0x57'),auth[_0x69fc('0xa')](),controller['removeChatWebsites']);router['delete'](_0x69fc('0x34'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x6b')]);router[_0x69fc('0x5f')](_0x69fc('0x36'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x6c')]);router[_0x69fc('0x5f')](_0x69fc('0x38'),auth[_0x69fc('0xa')](),controller[_0x69fc('0x6d')]);module['exports']=router; \ No newline at end of file +var _0xd290=['multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey'];(function(_0x217ac,_0x43238e){var _0x1f8fc9=function(_0x3bbbc4){while(--_0x3bbbc4){_0x217ac['push'](_0x217ac['shift']());}};_0x1f8fc9(++_0x43238e);}(_0xd290,0x1a8));var _0x0d29=function(_0xf54307,_0x28eea7){_0xf54307=_0xf54307-0x0;var _0x20f964=_0xd290[_0xf54307];return _0x20f964;};'use strict';var multer=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var path=require(_0x0d29('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0d29('0x3'));var auth=require(_0x0d29('0x4'));var interaction=require(_0x0d29('0x5'));var config=require(_0x0d29('0x6'));var controller=require(_0x0d29('0x7'));router[_0x0d29('0x8')]('/',auth[_0x0d29('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0d29('0xa')]);router[_0x0d29('0x8')]('/whoami',auth[_0x0d29('0x9')](),controller[_0x0d29('0xb')]);router[_0x0d29('0x8')](_0x0d29('0xc'),auth[_0x0d29('0x9')](),controller[_0x0d29('0xd')]);router[_0x0d29('0x8')](_0x0d29('0xe'),auth[_0x0d29('0x9')](),controller[_0x0d29('0xf')]);router[_0x0d29('0x8')]('/:id/avatar',controller['getAvatar']);router['get'](_0x0d29('0x10'),auth[_0x0d29('0x9')](),controller['getOpenTabs']);router[_0x0d29('0x8')](_0x0d29('0x11'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x12')]);router['get'](_0x0d29('0x13'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x14')]);router['get'](_0x0d29('0x15'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x16')]);router[_0x0d29('0x8')]('/:id/groups',auth[_0x0d29('0x9')](),controller[_0x0d29('0x17')]);router[_0x0d29('0x8')](_0x0d29('0x18'),auth['isAuthenticated'](),controller[_0x0d29('0x19')]);router[_0x0d29('0x8')](_0x0d29('0x1a'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x1b')]);router[_0x0d29('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x0d29('0x1c')]);router['get'](_0x0d29('0x1d'),auth[_0x0d29('0x9')](),controller['getOpenchannelInteractions']);router[_0x0d29('0x8')](_0x0d29('0x1e'),auth['isAuthenticated'](),controller[_0x0d29('0x1f')]);router['get']('/:id/sms/interactions',auth[_0x0d29('0x9')](),controller[_0x0d29('0x20')]);router[_0x0d29('0x8')]('/:id/fax/interactions',auth[_0x0d29('0x9')](),controller[_0x0d29('0x21')]);router[_0x0d29('0x8')](_0x0d29('0x22'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x23')]);router[_0x0d29('0x8')]('/:id/teams',auth[_0x0d29('0x9')](),controller[_0x0d29('0x24')]);router[_0x0d29('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0x0d29('0x25')]);router['get'](_0x0d29('0x26'),auth['isAuthenticated'](),controller[_0x0d29('0x27')]);router[_0x0d29('0x8')](_0x0d29('0x28'),auth['isAuthenticated'](),controller[_0x0d29('0x29')]);router[_0x0d29('0x8')](_0x0d29('0x2a'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x2b')]);router[_0x0d29('0x8')]('/:id/mail_accounts',auth[_0x0d29('0x9')](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x0d29('0x2c')]);router[_0x0d29('0x8')]('/:id/sms_accounts',auth[_0x0d29('0x9')](),controller[_0x0d29('0x2d')]);router[_0x0d29('0x8')](_0x0d29('0x2e'),auth[_0x0d29('0x9')](),controller['getChatWebsites']);router[_0x0d29('0x8')](_0x0d29('0x2f'),auth[_0x0d29('0x9')](),controller['getWhatsappAccounts']);router[_0x0d29('0x8')](_0x0d29('0x30'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x0d29('0x8')]('/:id/scheduled_calls',auth[_0x0d29('0x9')](),controller[_0x0d29('0x31')]);router[_0x0d29('0x8')](_0x0d29('0x32'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x33')]);router[_0x0d29('0x34')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x0d29('0x34')]('/',auth[_0x0d29('0x9')](),controller['create']);router['post'](_0x0d29('0x35'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x36')]);router['post'](_0x0d29('0x13'),auth[_0x0d29('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x0d29('0x37')]({'destination':function(_0x5df667,_0x2aae8d,_0x44a43a){_0x44a43a(null,path[_0x0d29('0x38')](config[_0x0d29('0x39')],_0x0d29('0x3a')));},'filename':function(_0x43885e,_0x5b630c,_0x81dfce){_0x81dfce(null,util[_0x0d29('0x3b')]('%s-%s',Date[_0x0d29('0x3c')](),_0x5b630c[_0x0d29('0x3d')]));}})});router[_0x0d29('0x34')]('/:id/avatar',upload[_0x0d29('0x3e')](_0x0d29('0x3f')),controller['addAvatar']);router[_0x0d29('0x34')](_0x0d29('0x40'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x41')]);router[_0x0d29('0x34')](_0x0d29('0x42'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x43')]);router[_0x0d29('0x34')](_0x0d29('0x44'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x45')]);router[_0x0d29('0x34')](_0x0d29('0x46'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x47')]);router[_0x0d29('0x34')](_0x0d29('0x48'),auth['isAuthenticated'](),controller[_0x0d29('0x49')]);router[_0x0d29('0x34')](_0x0d29('0x4a'),auth[_0x0d29('0x9')](),controller['addChatInteractions']);router[_0x0d29('0x34')](_0x0d29('0x4b'),auth['isAuthenticated'](),controller[_0x0d29('0x4c')]);router[_0x0d29('0x34')](_0x0d29('0x4d'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x4e')]);router[_0x0d29('0x34')](_0x0d29('0x4f'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x50')]);router[_0x0d29('0x34')](_0x0d29('0x51'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x52')]);router[_0x0d29('0x34')](_0x0d29('0x53'),auth[_0x0d29('0x9')](),controller['addWhatsappInteractions']);router['post'](_0x0d29('0x2a'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x54')]);router[_0x0d29('0x34')](_0x0d29('0x55'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0x0d29('0x56'),auth[_0x0d29('0x9')](),controller['addOpenchannelAccounts']);router[_0x0d29('0x34')](_0x0d29('0x57'),auth[_0x0d29('0x9')](),controller['addSmsAccounts']);router[_0x0d29('0x34')](_0x0d29('0x2e'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x58')]);router[_0x0d29('0x34')](_0x0d29('0x2f'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x59')]);router[_0x0d29('0x34')](_0x0d29('0x30'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x5a')]);router[_0x0d29('0x34')](_0x0d29('0x32'),auth['isAuthenticated'](),controller[_0x0d29('0x5b')]);router['put'](_0x0d29('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x0d29('0x5c')](_0x0d29('0x5d'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x5e')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0x0d29('0x5f')]);router[_0x0d29('0x60')]('/:id/teams',auth[_0x0d29('0x9')](),controller[_0x0d29('0x61')]);router[_0x0d29('0x60')]('/:id',auth['isAuthenticated'](),controller[_0x0d29('0x62')]);router[_0x0d29('0x60')](_0x0d29('0x4a'),auth[_0x0d29('0x9')](),controller['removeChatInteractions']);router[_0x0d29('0x60')](_0x0d29('0x4b'),auth['isAuthenticated'](),controller[_0x0d29('0x63')]);router[_0x0d29('0x60')](_0x0d29('0x4d'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x64')]);router[_0x0d29('0x60')](_0x0d29('0x4f'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x65')]);router[_0x0d29('0x60')](_0x0d29('0x51'),auth[_0x0d29('0x9')](),controller['removeOpenchannelInteractions']);router[_0x0d29('0x60')](_0x0d29('0x53'),auth[_0x0d29('0x9')](),controller['removeWhatsappInteractions']);router[_0x0d29('0x60')]('/:id/fax_accounts',auth[_0x0d29('0x9')](),controller['removeFaxAccounts']);router[_0x0d29('0x60')](_0x0d29('0x55'),auth[_0x0d29('0x9')](),controller['removeMailAccounts']);router[_0x0d29('0x60')](_0x0d29('0x56'),auth[_0x0d29('0x9')](),controller['removeOpenchannelAccounts']);router[_0x0d29('0x60')](_0x0d29('0x57'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x66')]);router[_0x0d29('0x60')](_0x0d29('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x0d29('0x60')](_0x0d29('0x2f'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x67')]);router[_0x0d29('0x60')](_0x0d29('0x30'),auth[_0x0d29('0x9')](),controller[_0x0d29('0x68')]);router[_0x0d29('0x60')](_0x0d29('0x32'),auth['isAuthenticated'](),controller[_0x0d29('0x69')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 504007e..2fc1811 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','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','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x3840aa,_0x3ae926){var _0x2f3d9f=function(_0x2ebb73){while(--_0x2ebb73){_0x3840aa['push'](_0x3840aa['shift']());}};_0x2f3d9f(++_0x3ae926);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0xcb91[_0x24875d];return _0x181471;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x2a7e91,_0x344236){var _0x47b1d6=function(_0x3f1edd){while(--_0x3f1edd){_0x2a7e91['push'](_0x2a7e91['shift']());}};_0x47b1d6(++_0x344236);}(_0xedd9,0xfc));var _0x9edd=function(_0x32303d,_0x2983b9){_0x32303d=_0x32303d-0x0;var _0x51f7db=_0xedd9[_0x32303d];return _0x51f7db;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1d14467..adfff36 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 _0x4b60=['isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','authenticate','oldPassword','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','VoiceQueue','voice','format','SIP/%s','UserVoiceQueueRt','upsert','remove','Queue:remove','userpic','file','root','server/files/images/logos/default_profile.png','existsSync','join','download','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','FaxOpenTabs','OPENCHANNEL','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','concat','getContacts','CmContact','order','sort','pick','merge','hasOwnProperty','List','Tag','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','smsPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','%s%s','Pause','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','transaction','removeAgent','UserVoicePrefix','getLists','CmList','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','inbound','flatten','getAgents','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','SELECT','field','InteractionId','ui.createdAt','_interactions','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','emit','destroy','get','admin','Users','user','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','name','UserProfileResource','stack','send','index','User','fieldName','type','key','password','salt','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','mail','openchannel','all','show','params','model','differenceBy','keys','rawAttributes','filters','intersection','fields','options','sms','fax','body','describe','addContacts','ids','Setting','securePassword','max','internal','isNil','min_internal','sequelize','QueryTypes','from','voicemail','VoiceMail','email','permissions','101','102','103','113','105','106','107','108','109','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4b60,0x109));var _0x04b6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4b60[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x04b6('0x0'));var BPromise=require(_0x04b6('0x1'));var util=require(_0x04b6('0x2'));var path=require(_0x04b6('0x3'));var fs=require('fs');var _=require(_0x04b6('0x4'));var squel=require(_0x04b6('0x5'));var jayson=require(_0x04b6('0x6'));var Redis=require(_0x04b6('0x7'));var authService=require('../../components/auth/service');var qs=require(_0x04b6('0x8'));var logger=require(_0x04b6('0x9'))(_0x04b6('0xa'));var utils=require(_0x04b6('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0x04b6('0xc'));var APIBadRequestError=require('../../errors/api')[_0x04b6('0xd')];var APINotFoundError=require(_0x04b6('0xe'))[_0x04b6('0xf')];var APIHandleError=require(_0x04b6('0xe'))[_0x04b6('0x10')];var db=require(_0x04b6('0x11'))['db'];var socket=require(_0x04b6('0x12'))(new Redis(config[_0x04b6('0x13')]));require(_0x04b6('0x14'))[_0x04b6('0x15')](socket);config[_0x04b6('0x13')]=_['defaults'](config[_0x04b6('0x13')],{'host':'localhost','port':0x18eb});var client=jayson['client'][_0x04b6('0x16')]({'port':0x232a});var values;function respondWithRpcPromise(_0x339cc3,_0x13ea33,_0x417084,_0x5a65ed){return new BPromise(function(_0x1ff1e0,_0x214b32){var _0xad3609=_0x5a65ed||client;return _0xad3609[_0x04b6('0x17')](_0x339cc3,_0x417084)[_0x04b6('0x18')](function(_0x28510a){logger[_0x04b6('0x19')](_0x04b6('0x1a'),_0x13ea33,_0x04b6('0x1b'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x13ea33,_0x04b6('0x1b'),JSON['stringify'](_0x28510a));if(_0x28510a[_0x04b6('0x1c')]){if(_0x28510a['error']['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x13ea33,_0x28510a['error']['message']);return _0x214b32(_0x28510a[_0x04b6('0x1c')][_0x04b6('0x1d')]);}logger[_0x04b6('0x1c')]('User,\x20%s,\x20%s',_0x13ea33,_0x28510a[_0x04b6('0x1c')]['message']);return _0x1ff1e0(_0x28510a[_0x04b6('0x1c')][_0x04b6('0x1d')]);}else{logger[_0x04b6('0x19')](_0x04b6('0x1a'),_0x13ea33,_0x04b6('0x1b'));_0x1ff1e0(_0x28510a[_0x04b6('0x1e')]['message']);}})[_0x04b6('0x1f')](function(_0x36f2e1){logger['error'](_0x04b6('0x1a'),_0x13ea33,_0x36f2e1);_0x214b32(_0x36f2e1);});});}function respondWithStatusCode(_0x4f3d80,_0x373a91){_0x373a91=_0x373a91||0xcc;return function(_0x4fef99){if(_0x4fef99){return _0x4f3d80[_0x04b6('0x20')](_0x373a91);}return _0x4f3d80[_0x04b6('0x21')](_0x373a91)[_0x04b6('0x22')]();};}function respondWithResult(_0x22145b,_0x309696){_0x309696=_0x309696||0xc8;return function(_0x36b7de){if(_0x36b7de){return _0x22145b[_0x04b6('0x21')](_0x309696)[_0x04b6('0x23')](_0x36b7de);}};}function respondWithFilteredResult(_0x305a59,_0x1ab4a1){return function(_0x279c76){if(_0x279c76){var _0x33f290=typeof _0x1ab4a1[_0x04b6('0x24')]===_0x04b6('0x25')&&typeof _0x1ab4a1[_0x04b6('0x26')]===_0x04b6('0x25');var _0xe66cac=_0x279c76[_0x04b6('0x27')];var _0x37418f=_0x33f290?0x0:_0x1ab4a1[_0x04b6('0x24')];var _0x971557=_0x33f290?_0x279c76[_0x04b6('0x27')]:_0x1ab4a1[_0x04b6('0x24')]+_0x1ab4a1[_0x04b6('0x26')];var _0x17a506;if(_0x971557>=_0xe66cac){_0x971557=_0xe66cac;_0x17a506=0xc8;}else{_0x17a506=0xce;}_0x305a59[_0x04b6('0x21')](_0x17a506);return _0x305a59[_0x04b6('0x28')](_0x04b6('0x29'),_0x37418f+'-'+_0x971557+'/'+_0xe66cac)[_0x04b6('0x23')](_0x279c76);}return null;};}function saveUpdates(_0x417ac4){return function(_0x317df5){if(_0x317df5){return _0x317df5[_0x04b6('0x2a')](_0x417ac4)['then'](function(_0x2e8b1b){socket[_0x04b6('0x2b')]('userNotification:recalc:'+_0x2e8b1b['id'],{});return _0x2e8b1b;});}return null;};}function removeEntity(_0x4f5b4b){return function(_0x1bdf17){if(_0x1bdf17){return _0x1bdf17[_0x04b6('0x2c')]()[_0x04b6('0x18')](function(){var _0x29a164=_0x1bdf17[_0x04b6('0x2d')]({'plain':!![]});if(_0x29a164['role']===_0x04b6('0x2e'))return;var _0x372a41=[{'name':_0x04b6('0x2f'),'value':_0x04b6('0x30'),'ignore':!![]},{'name':'Agents','value':_0x04b6('0x31'),'ignore':![]},{'name':_0x04b6('0x32'),'value':_0x04b6('0x33'),'ignore':![]}];var _0x1ae5e9=_(_0x372a41)[_0x04b6('0x34')](_0x04b6('0x35'))[_0x04b6('0x36')](_0x04b6('0x37'))[_0x04b6('0x37')]();if(_[_0x04b6('0x38')](_0x1ae5e9,_0x29a164[_0x04b6('0x39')])){return;}var _0x238c69=_[_0x04b6('0x3a')](_0x372a41,[_0x04b6('0x37'),_0x29a164[_0x04b6('0x39')]])[_0x04b6('0x3b')];return db[_0x04b6('0x3c')]['destroy']({'where':{'type':_0x238c69,'resourceId':_0x29a164['id']}})[_0x04b6('0x18')](function(){return _0x1bdf17;});})['then'](function(){_0x4f5b4b[_0x04b6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc02f){return function(_0x27c858){if(!_0x27c858){_0x5cc02f['sendStatus'](0x194);}return _0x27c858;};}function handleError(_0x51a371,_0xdd1c1d){_0xdd1c1d=_0xdd1c1d||0x1f4;return function(_0x26818b){logger['error'](_0x26818b[_0x04b6('0x3d')]);if(_0x26818b[_0x04b6('0x3b')]){delete _0x26818b[_0x04b6('0x3b')];}_0x51a371[_0x04b6('0x21')](_0xdd1c1d)[_0x04b6('0x3e')](_0x26818b);};}exports[_0x04b6('0x3f')]=function(_0x624c4a,_0x59f379){var _0x57705f={},_0x479268={'count':0x0,'rows':[]};var _0xe63c4c=_(db[_0x04b6('0x40')]['rawAttributes'])[_0x04b6('0x36')](function(_0x3e39f9){return{'name':_0x3e39f9[_0x04b6('0x41')],'type':_0x3e39f9[_0x04b6('0x42')][_0x04b6('0x43')]};})[_0x04b6('0x34')](function(_0x36d1f0){return!_[_0x04b6('0x38')]([_0x04b6('0x44'),_0x04b6('0x45')],_0x36d1f0[_0x04b6('0x3b')]);})[_0x04b6('0x37')]();_0x57705f=qs['getOptions'](_0xe63c4c,_0x624c4a);var _0x1e6873={'where':_0x57705f[_0x04b6('0x46')]};return db['User'][_0x04b6('0x27')](_0x1e6873)[_0x04b6('0x18')](function(_0x3195f0){_0x479268[_0x04b6('0x27')]=_0x3195f0;if(_0x624c4a[_0x04b6('0x47')][_0x04b6('0x48')]){_0x57705f[_0x04b6('0x49')]=[{'all':!![]}];}if(_0x624c4a[_0x04b6('0x47')]['userSetting']===_0x04b6('0x4a')){_0x57705f[_0x04b6('0x49')]=[{'model':db[_0x04b6('0x4b')],'as':_0x04b6('0x4c')}];}if(!_['includes'](_0x57705f[_0x04b6('0x4d')],'id')){_0x57705f['attributes'][_0x04b6('0x4e')]('id');}return db[_0x04b6('0x40')][_0x04b6('0x4f')](_0x57705f);})['then'](function(_0x9ec5a8){_0x479268[_0x04b6('0x50')]=_0x9ec5a8;if(_0x624c4a[_0x04b6('0x47')][_0x04b6('0x51')]===_0x04b6('0x4a')){var _0x2565d1=[];for(var _0x3e7c94=0x0;_0x3e7c94<_0x479268[_0x04b6('0x50')][_0x04b6('0x52')];_0x3e7c94++){_0x2565d1[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x53'),_0x479268[_0x04b6('0x50')][_0x3e7c94]['dataValues']));_0x2565d1[_0x04b6('0x4e')](get_open_tabs('sms',_0x479268[_0x04b6('0x50')][_0x3e7c94][_0x04b6('0x54')]));_0x2565d1['push'](get_open_tabs('fax',_0x479268[_0x04b6('0x50')][_0x3e7c94]['dataValues']));_0x2565d1[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x55'),_0x479268[_0x04b6('0x50')][_0x3e7c94]['dataValues']));_0x2565d1['push'](get_open_tabs(_0x04b6('0x56'),_0x479268[_0x04b6('0x50')][_0x3e7c94]['dataValues']));_0x2565d1[_0x04b6('0x4e')](get_open_tabs('whatsapp',_0x479268[_0x04b6('0x50')][_0x3e7c94]['dataValues']));}return BPromise[_0x04b6('0x57')](_0x2565d1)[_0x04b6('0x18')](function(){return _0x479268;});}else{return _0x479268;}})[_0x04b6('0x18')](respondWithFilteredResult(_0x59f379,_0x57705f))[_0x04b6('0x1f')](handleError(_0x59f379,null));};exports[_0x04b6('0x58')]=function(_0x585f7c,_0x116e72){var _0x167cf6={'raw':![],'where':{'id':_0x585f7c[_0x04b6('0x59')]['id']}},_0xe199f={};_0xe199f[_0x04b6('0x5a')]=_[_0x04b6('0x5b')](_[_0x04b6('0x5c')](db['User'][_0x04b6('0x5d')]),[_0x04b6('0x44'),'salt']);_0xe199f[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x585f7c[_0x04b6('0x47')]);_0xe199f[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0xe199f[_0x04b6('0x5a')],_0xe199f[_0x04b6('0x47')]);_0x167cf6[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0xe199f[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x585f7c[_0x04b6('0x47')]['fields']));_0x167cf6[_0x04b6('0x4d')]=_0x167cf6[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x167cf6[_0x04b6('0x4d')]:_0xe199f[_0x04b6('0x5a')];if(_0x585f7c[_0x04b6('0x47')]['includeAll']){_0x167cf6[_0x04b6('0x49')]=[{'all':!![]}];}if(_0x585f7c[_0x04b6('0x47')][_0x04b6('0x4c')]===_0x04b6('0x4a')){_0x167cf6[_0x04b6('0x49')]=[{'model':db[_0x04b6('0x4b')],'as':_0x04b6('0x4c')}];}_0x167cf6=_['merge']({},_0x167cf6,_0x585f7c[_0x04b6('0x61')]);if(!_[_0x04b6('0x38')](_0x167cf6[_0x04b6('0x4d')],'id')){_0x167cf6[_0x04b6('0x4d')][_0x04b6('0x4e')]('id');}return db[_0x04b6('0x40')][_0x04b6('0x3a')](_0x167cf6)[_0x04b6('0x18')](handleEntityNotFound(_0x116e72,null))[_0x04b6('0x18')](function(_0xcaf5bb){var _0x17fdfc=[];values=_0xcaf5bb;if(_0x585f7c[_0x04b6('0x47')][_0x04b6('0x51')]===_0x04b6('0x4a')){_0x17fdfc['push'](get_open_tabs('chat',_0xcaf5bb['dataValues']));_0x17fdfc[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x62'),_0xcaf5bb[_0x04b6('0x54')]));_0x17fdfc[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x56'),_0xcaf5bb['dataValues']));_0x17fdfc['push'](get_open_tabs('whatsapp',_0xcaf5bb[_0x04b6('0x54')]));_0x17fdfc[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x63'),_0xcaf5bb['dataValues']));_0x17fdfc[_0x04b6('0x4e')](get_open_tabs('mail',_0xcaf5bb['dataValues']));return BPromise['all'](_0x17fdfc);}else{return values;}})[_0x04b6('0x18')](function(){return values;})[_0x04b6('0x18')](respondWithResult(_0x116e72,null))[_0x04b6('0x1f')](handleError(_0x116e72,null));};exports[_0x04b6('0x2a')]=function(_0x49f256,_0x51a0c2){if(_0x49f256[_0x04b6('0x64')]['id']){delete _0x49f256[_0x04b6('0x64')]['id'];}delete _0x49f256[_0x04b6('0x64')][_0x04b6('0x39')];return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x49f256[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x51a0c2,null))[_0x04b6('0x18')](saveUpdates(_0x49f256['body'],null))[_0x04b6('0x18')](respondWithResult(_0x51a0c2,null))['catch'](handleError(_0x51a0c2,null));};exports[_0x04b6('0x65')]=function(_0x53b4a7,_0x57a5b6){return db[_0x04b6('0x40')][_0x04b6('0x65')]()[_0x04b6('0x18')](respondWithResult(_0x57a5b6,null))[_0x04b6('0x1f')](handleError(_0x57a5b6,null));};exports['addContacts']=function(_0xb23eb7,_0x51efc1){return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0xb23eb7['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x51efc1,null))[_0x04b6('0x18')](function(_0x5cf29a){if(_0x5cf29a){return _0x5cf29a[_0x04b6('0x66')](_0xb23eb7[_0x04b6('0x64')][_0x04b6('0x67')],_['omit'](_0xb23eb7[_0x04b6('0x64')],[_0x04b6('0x67'),'id'])||{});}})[_0x04b6('0x18')](respondWithResult(_0x51efc1,null))[_0x04b6('0x1f')](handleError(_0x51efc1,null));};function validateUser(_0x4cb69d){return new BPromise(function(_0x32fd24,_0x1a9d8c){if(_0x4cb69d['internal'])return _0x32fd24(_0x4cb69d);return db[_0x04b6('0x68')]['findById'](0x1)[_0x04b6('0x18')](function(_0x26d178){if(_0x26d178[_0x04b6('0x69')])authService['validatePasswordPattern'](_0x4cb69d[_0x04b6('0x44')]);db[_0x04b6('0x40')][_0x04b6('0x6a')](_0x04b6('0x6b'))['then'](function(_0x2ac282){if(_['isNil'](_0x2ac282)){_0x4cb69d[_0x04b6('0x6b')]=_0x26d178['min_internal']||0x1;return;}if(_[_0x04b6('0x6c')](_0x26d178[_0x04b6('0x6d')])||_0x26d178['min_internal']===_0x2ac282){_0x4cb69d[_0x04b6('0x6b')]=_0x2ac282+0x1;return;}if(_0x26d178[_0x04b6('0x6d')]>_0x2ac282){_0x4cb69d[_0x04b6('0x6b')]=_0x26d178['min_internal'];return;}return db[_0x04b6('0x6e')][_0x04b6('0x47')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x04b6('0x6e')][_0x04b6('0x6f')]['SELECT']})[_0x04b6('0x18')](function(_0xfaa648){if(_0xfaa648&&_0xfaa648[_0x04b6('0x52')]){for(var _0x4ec62c=0x0,_0x1f85d2=_0xfaa648[_0x04b6('0x52')];_0x4ec62c<_0x1f85d2&&_[_0x04b6('0x6c')](_0x4cb69d['internal']);_0x4ec62c++){if(_0x26d178['min_internal']<=_0xfaa648[_0x4ec62c][_0x04b6('0x70')]){_0x4cb69d[_0x04b6('0x6b')]=_0xfaa648[_0x4ec62c][_0x04b6('0x70')];}else if(_0x26d178[_0x04b6('0x6d')]>_0xfaa648[_0x4ec62c][_0x04b6('0x70')]&&_0x26d178[_0x04b6('0x6d')]<=_0xfaa648[_0x4ec62c]['to']){_0x4cb69d[_0x04b6('0x6b')]=_0x26d178[_0x04b6('0x6d')];}}}if(_[_0x04b6('0x6c')](_0x4cb69d[_0x04b6('0x6b')])){_0x4cb69d[_0x04b6('0x6b')]=_0x2ac282+0x1;}return _0x32fd24(_0x4cb69d);});});})['catch'](function(_0x2e32ed){_0x1a9d8c(_0x2e32ed);});});}function updateUser(_0x195799){return new BPromise(function(_0x20fac0,_0x383bd5){try{if(_0x195799[_0x04b6('0x71')]){_0x195799['mailbox']=_0x195799[_0x04b6('0x6b')];_0x195799[_0x04b6('0x72')]={'mailbox':_0x195799[_0x04b6('0x6b')],'password':_0x195799[_0x04b6('0x44')],'fullname':_0x195799['fullname'],'email':_0x195799[_0x04b6('0x73')]};}if(_0x195799[_0x04b6('0x39')]===_0x04b6('0x31')){if(!_0x195799[_0x04b6('0x74')])_0x195799['permissions']=[_0x04b6('0x75'),_0x04b6('0x76'),_0x04b6('0x77'),_0x04b6('0x78'),'110','104',_0x04b6('0x79'),_0x04b6('0x7a'),_0x04b6('0x7b'),_0x04b6('0x7c'),_0x04b6('0x7d'),'100',_0x04b6('0x7e'),_0x04b6('0x7f'),_0x04b6('0x80')];}_0x20fac0(_0x195799);}catch(_0x48da92){_0x383bd5(_0x48da92);}});}exports[_0x04b6('0x81')]=function(_0x20c376,_0x2c4001){if(_0x20c376[_0x04b6('0x30')][_0x04b6('0x39')]==='agent')throw new Error(_0x04b6('0x82'));if(_0x20c376['body'][_0x04b6('0x39')]==='user'&&_0x20c376[_0x04b6('0x30')][_0x04b6('0x39')]!==_0x04b6('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x20c376[_0x04b6('0x64')]['role']===_0x04b6('0x2e')&&_0x20c376[_0x04b6('0x30')][_0x04b6('0x39')]!=='admin'){throw new Error(_0x04b6('0x83'));}return licenseUtil['checkUserLimits']([_0x20c376[_0x04b6('0x64')]])[_0x04b6('0x18')](function(){return validateUser(_0x20c376[_0x04b6('0x64')]);})[_0x04b6('0x18')](function(_0x1c71cb){return updateUser(_0x1c71cb)[_0x04b6('0x18')](function(_0x55ac14){if(_0x55ac14[_0x04b6('0x39')]==='admin'){_0x55ac14[_0x04b6('0x84')]=_0x20c376[_0x04b6('0x30')][_0x04b6('0x84')];delete _0x55ac14[_0x04b6('0x85')];}return _0x55ac14;});})[_0x04b6('0x18')](function(_0x2a999a){return db[_0x04b6('0x40')][_0x04b6('0x81')](_0x2a999a,{'include':[{'model':db[_0x04b6('0x72')],'as':_0x04b6('0x72')}]});})['then'](function(_0x34f69f){if(_0x20c376[_0x04b6('0x64')]['role']===_0x04b6('0x30'))return _0x34f69f;if(_0x20c376[_0x04b6('0x30')][_0x04b6('0x39')]!=='user')return _0x34f69f;return db[_0x04b6('0x86')][_0x04b6('0x3a')]({'where':{'name':_0x34f69f['role']===_0x04b6('0x31')?_0x04b6('0x87'):_0x04b6('0x32'),'userProfileId':_0x20c376['user'][_0x04b6('0x85')]},'raw':!![]})['then'](function(_0x203a68){if(!_0x203a68||_0x203a68[_0x04b6('0x88')]!=0x0)return _0x34f69f;return db[_0x04b6('0x3c')][_0x04b6('0x81')]({'name':_0x34f69f['name'],'resourceId':_0x34f69f['id'],'type':_0x203a68[_0x04b6('0x3b')],'sectionId':_0x203a68['id']},{})['then'](function(){return _0x34f69f;});})[_0x04b6('0x1f')](function(_0x4eb1e0){logger[_0x04b6('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4eb1e0);throw _0x4eb1e0;});})[_0x04b6('0x18')](respondWithResult(_0x2c4001,0xc9))['catch'](handleError(_0x2c4001,null));};exports[_0x04b6('0x89')]=function(_0x460ae1,_0x1310dc){var _0x1826f9=_0x460ae1[_0x04b6('0x64')];var _0x54cea7=[];if(_0x460ae1['user'][_0x04b6('0x39')]===_0x04b6('0x31'))throw new Error('Unauthorized');if(_[_0x04b6('0x8a')](_0x1826f9,[_0x04b6('0x39'),'user'])&&_0x460ae1[_0x04b6('0x30')][_0x04b6('0x39')]!==_0x04b6('0x2e')){throw new Error(_0x04b6('0x8b'));}if(_[_0x04b6('0x8a')](_0x1826f9,['role',_0x04b6('0x2e')])&&_0x460ae1[_0x04b6('0x30')][_0x04b6('0x39')]!==_0x04b6('0x2e')){throw new Error(_0x04b6('0x8c'));}return licenseUtil['checkUserLimits'](_0x1826f9)['then'](function(){return validateUser(_0x1826f9[0x0]);})[_0x04b6('0x18')](function(){for(var _0x596d7b=0x1;_0x596d7b<_0x1826f9[_0x04b6('0x52')];_0x596d7b++){var _0x2535ec=_0x1826f9[_0x596d7b-0x1][_0x04b6('0x6b')];if(!_0x1826f9[_0x596d7b][_0x04b6('0x6b')])_0x1826f9[_0x596d7b][_0x04b6('0x6b')]=_0x2535ec+0x1;_0x54cea7[_0x04b6('0x4e')](validateUser(_0x1826f9[_0x596d7b]));}return BPromise['all'](_0x54cea7);})[_0x04b6('0x18')](function(){_0x54cea7=[];for(var _0x218260=0x0;_0x218260<_0x1826f9[_0x04b6('0x52')];_0x218260++){_0x54cea7[_0x04b6('0x4e')](updateUser(_0x1826f9[_0x218260]));}return BPromise[_0x04b6('0x57')](_0x54cea7);})[_0x04b6('0x18')](function(){return BPromise[_0x04b6('0x8d')](_0x1826f9,function(_0x4f5c9c){return db[_0x04b6('0x40')][_0x04b6('0x81')](_0x4f5c9c,{'include':[{'model':db['VoiceMail'],'as':_0x04b6('0x72')}]})[_0x04b6('0x18')](function(_0xe51a9d){_0x4f5c9c['id']=_0xe51a9d['id'];return _0x4f5c9c;});});})['then'](function(_0x584318){if(_0x460ae1[_0x04b6('0x64')][_0x04b6('0x39')]==='user')return _0x584318;if(_0x460ae1[_0x04b6('0x30')][_0x04b6('0x39')]!==_0x04b6('0x30'))return _0x584318;var _0x180500=_[_0x04b6('0x8a')](_0x584318,function(_0x228149){return _0x228149[_0x04b6('0x39')]===_0x04b6('0x31')||_0x228149[_0x04b6('0x39')]===_0x04b6('0x33');});if(!_0x180500)return _0x584318;return db[_0x04b6('0x86')][_0x04b6('0x4f')]({'where':{'name':{'$or':[_0x04b6('0x87'),_0x04b6('0x32')]},'userProfileId':_0x460ae1['user']['userProfileId']},'raw':!![]})[_0x04b6('0x18')](function(_0x121f3d){if(_[_0x04b6('0x8e')](_0x121f3d)||!_[_0x04b6('0x8a')](_0x121f3d,['autoAssociation',0x0]))return _0x584318;_0x54cea7=[];var _0x45b1a0=_(_0x121f3d)['map'](function(_0x1f34f4){if(_0x1f34f4['autoAssociation']===0x1)return;return _0x1f34f4['name']==='Agents'?_0x04b6('0x31'):_0x04b6('0x33');})[_0x04b6('0x8f')]()[_0x04b6('0x37')]();for(var _0x38f951=0x0;_0x38f951<_0x584318[_0x04b6('0x52')];_0x38f951++){if(!_[_0x04b6('0x38')](_0x45b1a0,_0x584318[_0x38f951][_0x04b6('0x39')]))return;var _0xf53f3a=_0x584318[_0x38f951][_0x04b6('0x39')]===_0x04b6('0x31')?_0x04b6('0x87'):_0x04b6('0x32');_0x54cea7[_0x04b6('0x4e')](db[_0x04b6('0x3c')][_0x04b6('0x81')]({'name':_0x584318[_0x38f951][_0x04b6('0x3b')],'resourceId':_0x584318[_0x38f951]['id'],'type':_0xf53f3a,'sectionId':_[_0x04b6('0x3a')](_0x121f3d,[_0x04b6('0x3b'),_0xf53f3a])['id']},{}));}return BPromise[_0x04b6('0x57')](_0x54cea7);});})[_0x04b6('0x18')](respondWithResult(_0x1310dc,0xc9))[_0x04b6('0x1f')](handleError(_0x1310dc,null));};exports[_0x04b6('0x90')]=function(_0x1597f5,_0x253267){if(_0x1597f5['body']['id']){delete _0x1597f5[_0x04b6('0x64')]['id'];}return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x1597f5[_0x04b6('0x59')]['id']}})['then'](function(_0x190520){if(!_0x190520)return null;if(_0x190520['id']===_0x1597f5[_0x04b6('0x30')]['id']){if(!_0x1597f5[_0x04b6('0x64')]['oldPassword']||!_0x1597f5[_0x04b6('0x64')][_0x04b6('0x91')]){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x190520[_0x04b6('0x94')](_0x1597f5[_0x04b6('0x64')][_0x04b6('0x95')])){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0x96'));}if(_0x1597f5[_0x04b6('0x64')][_0x04b6('0x95')]===_0x1597f5[_0x04b6('0x64')][_0x04b6('0x91')]){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1597f5['user'][_0x04b6('0x39')]==='admin'){if(!_0x1597f5[_0x04b6('0x64')][_0x04b6('0x91')]){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0x97'));}}else if(_0x1597f5[_0x04b6('0x30')][_0x04b6('0x39')]===_0x04b6('0x30')){if(!_0x1597f5['body'][_0x04b6('0x91')]){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0x97'));}if(_0x190520[_0x04b6('0x39')]!==_0x04b6('0x31')){throw new db['Sequelize'][(_0x04b6('0x93'))](_0x04b6('0x82'));}}else{throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))]('Unauthorized');}return _0x190520;})['then'](handleEntityNotFound(_0x253267,null))['then'](function(_0x5e2028){return db[_0x04b6('0x68')][_0x04b6('0x98')]({'attributes':['id','securePassword',_0x04b6('0x99'),_0x04b6('0x9a')]})[_0x04b6('0x18')](function(_0x563a91){if(_0x563a91[_0x04b6('0x69')])authService[_0x04b6('0x9b')](_0x1597f5['body'][_0x04b6('0x91')]);if(!_0x563a91[_0x04b6('0x99')]||!_0x5e2028[_0x04b6('0x9c')])return _0x5e2028;authService[_0x04b6('0x9d')](_0x1597f5[_0x04b6('0x64')][_0x04b6('0x91')],_0x5e2028[_0x04b6('0x9c')],_0x563a91[_0x04b6('0x9a')]);return _0x5e2028;})[_0x04b6('0x18')](saveUpdates({'password':_0x1597f5[_0x04b6('0x64')][_0x04b6('0x91')],'passwordResetAt':_0x1597f5[_0x04b6('0x30')]['id']==_0x1597f5['params']['id']?moment():null,'previousPasswords':authService[_0x04b6('0x9e')](_0x1597f5['body'][_0x04b6('0x91')],_0x5e2028['previousPasswords'])},null));})[_0x04b6('0x18')](respondWithResult(_0x253267,null))[_0x04b6('0x1f')](handleError(_0x253267,null));};exports[_0x04b6('0x9f')]=function(_0x2b6a5f,_0x5424a2){var _0x432e98=_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0xa0')];return db[_0x04b6('0x40')]['find']({'where':{'id':_0x2b6a5f['params']['id']},'attributes':['id',_0x04b6('0x3b'),_0x04b6('0x39'),_0x04b6('0xa1'),_0x04b6('0xa2'),_0x04b6('0xa3'),_0x04b6('0xa4')]})[_0x04b6('0x18')](handleEntityNotFound(_0x5424a2,null))['then'](function(_0x4dc295){if(_0x4dc295){if(!utils[_0x04b6('0xa5')](_0x432e98)){throw new db[(_0x04b6('0x92'))]['ValidationError'](_0x04b6('0xa6'));}return _0x4dc295['add'+_[_0x04b6('0xa7')](_0x432e98[_0x04b6('0xa8')]())+_0x04b6('0xa9')](_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0x67')],{'penalty':_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0xaa')]||0x0})[_0x04b6('0xab')](function(_0x5baabe){for(var _0x56db3b=0x0;_0x56db3b<_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0x67')][_0x04b6('0x52')];_0x56db3b+=0x1){var _0x57a15b={'UserId':Number(_0x2b6a5f[_0x04b6('0x59')]['id'])};_0x57a15b[_[_0x04b6('0xa7')](_0x432e98[_0x04b6('0xa8')]())+_0x04b6('0xac')]=Number(_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0x67')][_0x56db3b]);socket[_0x04b6('0x2b')](_0x04b6('0x30')+_[_0x04b6('0xa7')](_0x432e98[_0x04b6('0xa8')]())+_0x04b6('0xad'),_0x57a15b);}return _0x5baabe;})['then'](function(){if(_0x432e98==='voice'){return db[_0x04b6('0xae')]['findAll']({'where':{'id':_0x2b6a5f[_0x04b6('0x64')][_0x04b6('0x67')]||[]},'raw':!![],'attributes':['id',_0x04b6('0x3b')]});}})[_0x04b6('0x18')](function(_0x3be966){var _0x3e4d41=_0x4dc295[_0x04b6('0x2d')]({'plain':!![]});var _0xc23286=[];if(_0x432e98===_0x04b6('0xaf')&&_0x3e4d41[_0x04b6('0x39')]===_0x04b6('0x31')&&_0x3e4d41[_0x04b6('0xa1')]){for(var _0x12ae3b=0x0;_0x12ae3b<_0x3be966[_0x04b6('0x52')];_0x12ae3b+=0x1){_0xc23286[_0x04b6('0x4e')]({'membername':_0x3e4d41[_0x04b6('0x3b')],'UserId':_0x3e4d41['id'],'queue_name':_0x3be966[_0x12ae3b]['name'],'VoiceQueueId':_0x3be966[_0x12ae3b]['id'],'interface':_[_0x04b6('0x6c')](_0x3e4d41[_0x04b6('0xa4')])?util[_0x04b6('0xb0')](_0x04b6('0xb1'),_0x3e4d41['name']):_0x3e4d41['interface'],'paused':_0x3e4d41[_0x04b6('0xa3')]||![],'penalty':_0x2b6a5f['body']['penalty']||0x0});}return BPromise[_0x04b6('0x8d')](_0xc23286,function(_0x5e27b7){return db[_0x04b6('0xb2')][_0x04b6('0xb3')](_0x5e27b7);});}return _0x4dc295;});}})['then'](respondWithStatusCode(_0x5424a2,null))[_0x04b6('0x1f')](handleError(_0x5424a2,null));};exports['removeQueues']=function(_0x559da3,_0x17fc07){var _0x53e6a2,_0x127276;return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x559da3[_0x04b6('0x59')]['id']},'attributes':['id',_0x04b6('0x3b'),_0x04b6('0x39')]})[_0x04b6('0x18')](handleEntityNotFound(_0x17fc07,null))[_0x04b6('0x18')](function(_0x511d77){if(_0x511d77){_0x53e6a2=_0x511d77;if(!_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')]||!utils[_0x04b6('0xa5')](_0x559da3['query'][_0x04b6('0xa0')])){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0xa6'));}return _0x511d77[_0x04b6('0xb4')+_[_0x04b6('0xa7')](_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')][_0x04b6('0xa8')]())+_0x04b6('0xa9')](_0x559da3[_0x04b6('0x47')][_0x04b6('0x67')]);}})['then'](function(_0x59761f){if(_['isArray'](_0x559da3['query'][_0x04b6('0x67')])){for(var _0x231209=0x0;_0x231209<_0x559da3[_0x04b6('0x47')][_0x04b6('0x67')][_0x04b6('0x52')];_0x231209+=0x1){_0x127276={'UserId':Number(_0x559da3[_0x04b6('0x59')]['id'])};_0x127276[_[_0x04b6('0xa7')](_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')][_0x04b6('0xa8')]())+'QueueId']=Number(_0x559da3[_0x04b6('0x47')][_0x04b6('0x67')][_0x231209]);socket['emit'](_0x04b6('0x30')+_[_0x04b6('0xa7')](_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')][_0x04b6('0xa8')]())+_0x04b6('0xb5'),_0x127276);}}else{_0x127276={'UserId':Number(_0x559da3[_0x04b6('0x59')]['id'])};_0x127276[_[_0x04b6('0xa7')](_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')][_0x04b6('0xa8')]())+_0x04b6('0xac')]=Number(_0x559da3[_0x04b6('0x47')][_0x04b6('0x67')]);socket[_0x04b6('0x2b')](_0x04b6('0x30')+_[_0x04b6('0xa7')](_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')][_0x04b6('0xa8')]())+_0x04b6('0xb5'),_0x127276);}return _0x59761f;})[_0x04b6('0x18')](function(){if(_0x559da3[_0x04b6('0x47')][_0x04b6('0xa0')]===_0x04b6('0xaf')){return db['UserVoiceQueueRt'][_0x04b6('0x2c')]({'where':{'UserId':_0x559da3[_0x04b6('0x59')]['id'],'VoiceQueueId':_0x559da3[_0x04b6('0x47')]['ids']},'individualHooks':!![]})[_0x04b6('0x18')](function(){return _0x53e6a2;});}return _0x53e6a2;})[_0x04b6('0x18')](respondWithStatusCode(_0x17fc07,null))[_0x04b6('0x1f')](handleError(_0x17fc07,null));};exports['addAvatar']=function(_0x399457,_0x399270){_0x399457['body'][_0x04b6('0xb6')]=_0x399457[_0x04b6('0xb7')]['filename'];return db['User']['find']({'where':{'id':_0x399457['params']['id']}})['then'](handleEntityNotFound(_0x399270,null))[_0x04b6('0x18')](saveUpdates(_0x399457[_0x04b6('0x64')],null))[_0x04b6('0x18')](respondWithResult(_0x399270,null))[_0x04b6('0x1f')](handleError(_0x399270,null));};exports['getAvatar']=function(_0x41ddf9,_0xd4f2b){var _0x5a6b72=path['join'](config[_0x04b6('0xb8')],_0x04b6('0xb9'));return db['User'][_0x04b6('0x3a')]({'where':{'id':_0x41ddf9['params']['id']},'attributes':['id',_0x04b6('0xb6')],'raw':!![]})[_0x04b6('0x18')](handleEntityNotFound(_0xd4f2b,null))[_0x04b6('0x18')](function(_0x42c4c0){if(_0x42c4c0){if(_['isNil'](_0x42c4c0[_0x04b6('0xb6')])){return _0xd4f2b['download'](_0x5a6b72);}else{if(!fs[_0x04b6('0xba')](path[_0x04b6('0xbb')](config[_0x04b6('0xb8')],'server/files/images/',_0x42c4c0['userpic']))){return _0xd4f2b[_0x04b6('0xbc')](_0x5a6b72);}return _0xd4f2b[_0x04b6('0xbc')](path[_0x04b6('0xbb')](config[_0x04b6('0xb8')],_0x04b6('0xbd'),_0x42c4c0['userpic']));}}})['catch'](handleError(_0xd4f2b,null));};exports[_0x04b6('0xbe')]=function(_0x35682d,_0x16a957){return db[_0x04b6('0x40')]['find']({'where':{'id':_0x35682d[_0x04b6('0x59')]['id']},'attributes':['id']})[_0x04b6('0x18')](handleEntityNotFound(_0x16a957,null))[_0x04b6('0x18')](function(_0x1bde7f){var _0x45b219=[];values=_0x1bde7f[_0x04b6('0x54')];_0x45b219[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x53'),_0x1bde7f[_0x04b6('0x54')]));_0x45b219[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x62'),_0x1bde7f['dataValues']));_0x45b219[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x56'),_0x1bde7f[_0x04b6('0x54')]));_0x45b219[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0xbf'),_0x1bde7f['dataValues']));_0x45b219[_0x04b6('0x4e')](get_open_tabs(_0x04b6('0x63'),_0x1bde7f[_0x04b6('0x54')]));_0x45b219['push'](get_open_tabs(_0x04b6('0x55'),_0x1bde7f['dataValues']));return BPromise['all'](_0x45b219);})[_0x04b6('0x18')](function(_0x397f1f){if(_0x397f1f){var _0x4416e4=_[_0x04b6('0x36')](values[_0x04b6('0xc0')],function(_0x40445d){return{'channel':_0x04b6('0xc1'),'id':_0x40445d['id'],'createdAt':_0x40445d['createdAt']};});var _0x49e96c=_[_0x04b6('0x36')](values[_0x04b6('0xc2')],function(_0x1f3237){return{'channel':'FAX','id':_0x1f3237['id'],'createdAt':_0x1f3237['createdAt']};});var _0x2d02eb=_[_0x04b6('0x36')](values['OpenchannelOpenTabs'],function(_0x154624){return{'channel':_0x04b6('0xc3'),'id':_0x154624['id'],'createdAt':_0x154624[_0x04b6('0xc4')]};});var _0x5c206a=_[_0x04b6('0x36')](values[_0x04b6('0xc5')],function(_0x300ddc){return{'channel':_0x04b6('0xc6'),'id':_0x300ddc['id'],'createdAt':_0x300ddc[_0x04b6('0xc4')]};});var _0x4b064b=_[_0x04b6('0x36')](values[_0x04b6('0xc7')],function(_0x2550da){return{'channel':'SMS','id':_0x2550da['id'],'createdAt':_0x2550da[_0x04b6('0xc4')]};});var _0x38afe3=_[_0x04b6('0x36')](values[_0x04b6('0xc8')],function(_0x486e11){return{'channel':'WHATSAPP','id':_0x486e11['id'],'createdAt':_0x486e11[_0x04b6('0xc4')]};});var _0x5d5ebf=_[_0x04b6('0xc9')](_0x4416e4,_0x49e96c,_0x2d02eb,_0x5c206a,_0x4b064b,_0x38afe3);var _0x4d5dd9={'count':_0x5d5ebf[_0x04b6('0x52')],'rows':_0x5d5ebf};return _0x4d5dd9;}else return null;})[_0x04b6('0x18')](respondWithResult(_0x16a957,null))[_0x04b6('0x1f')](handleError(_0x16a957,null));};exports[_0x04b6('0xca')]=function(_0x3877f5,_0x5ce5a6){var _0x575357={};var _0x4d3c3d={};var _0x9c6ae8;var _0x34d50a;return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x3877f5['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x5ce5a6,null))[_0x04b6('0x18')](function(_0x275a41){if(_0x275a41){_0x9c6ae8=_0x275a41;_0x4d3c3d[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0xcb')]['rawAttributes']);_0x4d3c3d['query']=_[_0x04b6('0x5c')](_0x3877f5[_0x04b6('0x47')]);_0x4d3c3d[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x4d3c3d[_0x04b6('0x5a')],_0x4d3c3d[_0x04b6('0x47')]);_0x575357[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x4d3c3d[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x3877f5[_0x04b6('0x47')]['fields']));_0x575357['attributes']=_0x575357[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x575357[_0x04b6('0x4d')]:_0x4d3c3d[_0x04b6('0x5a')];_0x575357[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x3877f5[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x575357['where']=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x3877f5[_0x04b6('0x47')],_0x4d3c3d[_0x04b6('0x5e')]));if(_0x3877f5['query'][_0x04b6('0x34')]){_0x575357['where']=_[_0x04b6('0xcf')](_0x575357[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x575357[_0x04b6('0x4d')],function(_0x16d6cd){var _0x5e64e4={};_0x5e64e4[_0x16d6cd]={'$like':'%'+_0x3877f5[_0x04b6('0x47')]['filter']+'%'};return _0x5e64e4;})});}_0x575357=_[_0x04b6('0xcf')]({},_0x575357,_0x3877f5['options']);return _0x9c6ae8[_0x04b6('0xca')](_0x575357);}})[_0x04b6('0x18')](function(_0x79a4d3){if(_0x79a4d3){_0x34d50a=_0x79a4d3[_0x04b6('0x52')];if(_0x3877f5[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0x48'))){_0x575357[_0x04b6('0x49')]=[{'model':db['CmList'],'as':_0x04b6('0xd1'),'required':![]},{'model':db[_0x04b6('0xd2')],'as':'Tags','attributes':['id',_0x04b6('0x3b'),_0x04b6('0xd3')],'where':_0x3877f5[_0x04b6('0x47')][_0x04b6('0xd4')]?{'id':_0x3877f5[_0x04b6('0x47')][_0x04b6('0xd4')]}:undefined,'required':_0x3877f5['query'][_0x04b6('0xd4')]?!![]:![]}];}if(!_0x3877f5[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x575357['limit']=qs[_0x04b6('0x26')](_0x3877f5['query'][_0x04b6('0x26')]);_0x575357[_0x04b6('0x24')]=qs['offset'](_0x3877f5[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x9c6ae8[_0x04b6('0xca')](_0x575357);}})[_0x04b6('0x18')](function(_0x774332){if(_0x774332){return _0x774332?{'count':_0x34d50a,'rows':_0x774332}:null;}})[_0x04b6('0x18')](respondWithResult(_0x5ce5a6,null))[_0x04b6('0x1f')](handleError(_0x5ce5a6,null));};exports[_0x04b6('0xd6')]=function(_0x448457,_0x236ecc){var _0x13f819;var _0x92c703={};var _0x126bfe;return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x448457['params']['id']},'attributes':['id',_0x04b6('0x3b'),_0x04b6('0x39')]})[_0x04b6('0x18')](handleEntityNotFound(_0x236ecc,null))[_0x04b6('0x18')](function(_0x21a4d1){if(!utils[_0x04b6('0xa5')](_0x448457[_0x04b6('0x47')][_0x04b6('0xa0')])){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))]('Unknown\x20channel');}_0x13f819=_0x21a4d1;var _0x2a1774={};_0x2a1774[_0x04b6('0x5a')]=_['keys'](db[_[_0x04b6('0xa7')](_0x448457['query'][_0x04b6('0xa0')])+_0x04b6('0xd7')][_0x04b6('0x5d')]);_0x2a1774['query']=_['keys'](_0x448457['query']);_0x2a1774[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x2a1774[_0x04b6('0x5a')],_0x2a1774[_0x04b6('0x47')]);_0x92c703[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x2a1774['model'],qs['fields'](_0x448457['query'][_0x04b6('0x60')]));_0x92c703['attributes']=_0x92c703['attributes']['length']?_0x92c703[_0x04b6('0x4d')]:_0x2a1774[_0x04b6('0x5a')];_0x92c703[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x448457['query'][_0x04b6('0xcd')]);_0x92c703[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x448457[_0x04b6('0x47')],_0x2a1774[_0x04b6('0x5e')]));if(_0x448457[_0x04b6('0x47')][_0x04b6('0x34')]){_0x92c703['where']=_[_0x04b6('0xcf')](_0x92c703[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x92c703[_0x04b6('0x4d')],function(_0x8ab310){var _0x1529f8={};_0x1529f8[_0x8ab310]={'$like':'%'+_0x448457[_0x04b6('0x47')]['filter']+'%'};return _0x1529f8;})});}_0x92c703=_['merge']({},_0x92c703,_0x448457[_0x04b6('0x61')]);switch(_0x13f819[_0x04b6('0x39')]){case'admin':return db[_['capitalize'](_0x448457[_0x04b6('0x47')][_0x04b6('0xa0')])+'Queue']['findAll'](_0x92c703);case'user':case _0x04b6('0x31'):return _0x13f819[_0x04b6('0x2d')+_['capitalize'](_0x448457[_0x04b6('0x47')][_0x04b6('0xa0')])+_0x04b6('0xa9')](_0x92c703);default:throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0xd8'));}})['then'](function(_0x3ba8b2){_0x126bfe=_0x3ba8b2['length'];if(!_0x448457[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x92c703['limit']=qs[_0x04b6('0x26')](_0x448457[_0x04b6('0x47')]['limit']);_0x92c703[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0x448457[_0x04b6('0x47')][_0x04b6('0x24')]);}switch(_0x13f819[_0x04b6('0x39')]){case _0x04b6('0x2e'):return db[_[_0x04b6('0xa7')](_0x448457[_0x04b6('0x47')][_0x04b6('0xa0')])+_0x04b6('0xd7')][_0x04b6('0x4f')](_0x92c703);case _0x04b6('0x30'):case _0x04b6('0x31'):return _0x13f819[_0x04b6('0x2d')+_['capitalize'](_0x448457[_0x04b6('0x47')][_0x04b6('0xa0')])+_0x04b6('0xa9')](_0x92c703);}})['then'](function(_0x2a6084){return{'count':_0x126bfe,'rows':_0x2a6084};})[_0x04b6('0x18')](respondWithResult(_0x236ecc,null))[_0x04b6('0x1f')](handleError(_0x236ecc,null));};exports[_0x04b6('0xd9')]=function(_0x215f18,_0x571fff){var _0x4bf91c={};var _0x3056bb={};var _0x4c943f;var _0x3e5e1f;return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x215f18[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x571fff,null))[_0x04b6('0x18')](function(_0x3cde85){if(_0x3cde85){_0x4c943f=_0x3cde85;_0x3056bb['model']=_[_0x04b6('0x5c')](db[_0x04b6('0xb2')][_0x04b6('0x5d')]);_0x3056bb[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x215f18[_0x04b6('0x47')]);_0x3056bb[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x3056bb[_0x04b6('0x5a')],_0x3056bb['query']);_0x4bf91c[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x3056bb[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x215f18[_0x04b6('0x47')]['fields']));_0x4bf91c['attributes']=_0x4bf91c[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x4bf91c[_0x04b6('0x4d')]:_0x3056bb['model'];_0x4bf91c[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x215f18['query'][_0x04b6('0xcd')]);_0x4bf91c[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_['pick'](_0x215f18[_0x04b6('0x47')],_0x3056bb[_0x04b6('0x5e')]));if(_0x215f18['query']['filter']){_0x4bf91c[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x4bf91c[_0x04b6('0x46')],{'$or':_['map'](_0x4bf91c[_0x04b6('0x4d')],function(_0x2126f5){var _0x30fae2={};_0x30fae2[_0x2126f5]={'$like':'%'+_0x215f18[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x30fae2;})});}_0x4bf91c=_[_0x04b6('0xcf')]({},_0x4bf91c,_0x215f18[_0x04b6('0x61')]);return _0x4c943f[_0x04b6('0xd9')](_0x4bf91c);}})[_0x04b6('0x18')](function(_0x868f4d){if(_0x868f4d){_0x3e5e1f=_0x868f4d[_0x04b6('0x52')];if(!_0x215f18['query'][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x4bf91c[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x215f18['query'][_0x04b6('0x26')]);_0x4bf91c[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0x215f18['query'][_0x04b6('0x24')]);}return _0x4c943f[_0x04b6('0xd9')](_0x4bf91c);}})['then'](function(_0x44fbf4){if(_0x44fbf4){return _0x44fbf4?{'count':_0x3e5e1f,'rows':_0x44fbf4}:null;}})['then'](respondWithResult(_0x571fff,null))[_0x04b6('0x1f')](handleError(_0x571fff,null));};exports['getGroups']=function(_0x4e5421,_0x16a22f){var _0x3d9e86={};var _0x3cfa52={};var _0x2f969b;var _0x2996d5;return db['User'][_0x04b6('0x98')]({'where':{'id':_0x4e5421[_0x04b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x16a22f,null))[_0x04b6('0x18')](function(_0xe6048e){if(_0xe6048e){_0x2f969b=_0xe6048e;_0x3cfa52[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0xda')][_0x04b6('0x5d')]);_0x3cfa52['query']=_[_0x04b6('0x5c')](_0x4e5421[_0x04b6('0x47')]);_0x3cfa52['filters']=_[_0x04b6('0x5f')](_0x3cfa52[_0x04b6('0x5a')],_0x3cfa52['query']);_0x3d9e86[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x3cfa52[_0x04b6('0x5a')],qs['fields'](_0x4e5421['query'][_0x04b6('0x60')]));_0x3d9e86['attributes']=_0x3d9e86[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x3d9e86['attributes']:_0x3cfa52[_0x04b6('0x5a')];_0x3d9e86['order']=qs[_0x04b6('0xcd')](_0x4e5421[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x3d9e86[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x4e5421[_0x04b6('0x47')],_0x3cfa52[_0x04b6('0x5e')]));if(_0x4e5421['query'][_0x04b6('0x34')]){_0x3d9e86[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x3d9e86[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x3d9e86[_0x04b6('0x4d')],function(_0x11b57e){var _0x69b48c={};_0x69b48c[_0x11b57e]={'$like':'%'+_0x4e5421[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x69b48c;})});}_0x3d9e86=_[_0x04b6('0xcf')]({},_0x3d9e86,_0x4e5421['options']);return _0x2f969b[_0x04b6('0xdb')](_0x3d9e86);}})[_0x04b6('0x18')](function(_0x2fd812){if(_0x2fd812){_0x2996d5=_0x2fd812[_0x04b6('0x52')];if(!_0x4e5421['query'][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x3d9e86[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x4e5421[_0x04b6('0x47')][_0x04b6('0x26')]);_0x3d9e86[_0x04b6('0x24')]=qs['offset'](_0x4e5421[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x2f969b[_0x04b6('0xdb')](_0x3d9e86);}})[_0x04b6('0x18')](function(_0x31cdc4){if(_0x31cdc4){return _0x31cdc4?{'count':_0x2996d5,'rows':_0x31cdc4}:null;}})[_0x04b6('0x18')](respondWithResult(_0x16a22f,null))[_0x04b6('0x1f')](handleError(_0x16a22f,null));};exports[_0x04b6('0xdc')]=function(_0xdc0435,_0x4ef2d1){var _0x5e71a={'raw':!![],'where':{}};var _0x1f297d={};var _0x3dafcc={'count':0x0,'rows':[]};return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0xdc0435[_0x04b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x4ef2d1,null))['then'](function(_0xf1b0c8){if(_0xf1b0c8){_0x1f297d[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0xdd')][_0x04b6('0x5d')]);_0x1f297d[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0xdc0435[_0x04b6('0x47')]);_0x1f297d[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x1f297d['model'],_0x1f297d['query']);_0x5e71a[_0x04b6('0x4d')]=_['intersection'](_0x1f297d[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0xdc0435['query']['fields']));_0x5e71a[_0x04b6('0x4d')]=_0x5e71a[_0x04b6('0x4d')]['length']?_0x5e71a['attributes']:_0x1f297d['model'];if(!_0xdc0435[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x5e71a['limit']=qs[_0x04b6('0x26')](_0xdc0435['query'][_0x04b6('0x26')]);_0x5e71a[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0xdc0435[_0x04b6('0x47')][_0x04b6('0x24')]);}_0x5e71a[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0xdc0435['query']['sort']);_0x5e71a[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0xdc0435[_0x04b6('0x47')],_0x1f297d[_0x04b6('0x5e')]));_0x5e71a['where'][_0x04b6('0xde')]=_0xf1b0c8['id'];if(_0xdc0435[_0x04b6('0x47')][_0x04b6('0x34')]){_0x5e71a['where']=_['merge'](_0x5e71a[_0x04b6('0x46')],{'$or':_['map'](_0x5e71a['attributes'],function(_0x53c53e){var _0x3241c9={};_0x3241c9[_0x53c53e]={'$like':'%'+_0xdc0435[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x3241c9;})});}_0x5e71a=_[_0x04b6('0xcf')]({},_0x5e71a,_0xdc0435[_0x04b6('0x61')]);return db[_0x04b6('0xdd')]['count']({'where':_0x5e71a[_0x04b6('0x46')]})[_0x04b6('0x18')](function(_0xa8740){_0x3dafcc[_0x04b6('0x27')]=_0xa8740;if(_0xdc0435[_0x04b6('0x47')]['includeAll']){_0x5e71a[_0x04b6('0x49')]=[{'all':!![]}];}return db[_0x04b6('0xdd')][_0x04b6('0x4f')](_0x5e71a);})[_0x04b6('0x18')](function(_0x383a04){_0x3dafcc[_0x04b6('0x50')]=_0x383a04;return _0x3dafcc;});}})[_0x04b6('0x18')](respondWithFilteredResult(_0x4ef2d1,_0x5e71a))[_0x04b6('0x1f')](handleError(_0x4ef2d1,null));};exports[_0x04b6('0xdf')]=function(_0x216bea,_0x232343){var _0x1a41bd={'raw':!![],'where':{}};var _0x135927={};var _0x244d70={'count':0x0,'rows':[]};return db['User'][_0x04b6('0x98')]({'where':{'id':_0x216bea['params']['id']}})['then'](handleEntityNotFound(_0x232343,null))['then'](function(_0x887584){if(_0x887584){_0x135927[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0xe0')]['rawAttributes']);_0x135927['query']=_['keys'](_0x216bea[_0x04b6('0x47')]);_0x135927[_0x04b6('0x5e')]=_['intersection'](_0x135927[_0x04b6('0x5a')],_0x135927['query']);_0x1a41bd[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x135927[_0x04b6('0x5a')],qs['fields'](_0x216bea[_0x04b6('0x47')][_0x04b6('0x60')]));_0x1a41bd['attributes']=_0x1a41bd[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x1a41bd[_0x04b6('0x4d')]:_0x135927[_0x04b6('0x5a')];if(!_0x216bea[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x1a41bd['limit']=qs[_0x04b6('0x26')](_0x216bea[_0x04b6('0x47')][_0x04b6('0x26')]);_0x1a41bd[_0x04b6('0x24')]=qs['offset'](_0x216bea[_0x04b6('0x47')][_0x04b6('0x24')]);}_0x1a41bd[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x216bea[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x1a41bd[_0x04b6('0x46')]=qs['filters'](_[_0x04b6('0xce')](_0x216bea[_0x04b6('0x47')],_0x135927[_0x04b6('0x5e')]));_0x1a41bd[_0x04b6('0x46')][_0x04b6('0xde')]=_0x887584['id'];if(_0x216bea[_0x04b6('0x47')][_0x04b6('0x34')]){_0x1a41bd[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x1a41bd[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x1a41bd[_0x04b6('0x4d')],function(_0x40eafb){var _0x2a8d9a={};_0x2a8d9a[_0x40eafb]={'$like':'%'+_0x216bea[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x2a8d9a;})});}_0x1a41bd=_[_0x04b6('0xcf')]({},_0x1a41bd,_0x216bea[_0x04b6('0x61')]);return db['ScreenRecording'][_0x04b6('0x27')]({'where':_0x1a41bd[_0x04b6('0x46')]})[_0x04b6('0x18')](function(_0x135f1d){_0x244d70[_0x04b6('0x27')]=_0x135f1d;if(_0x216bea[_0x04b6('0x47')][_0x04b6('0x48')]){_0x1a41bd[_0x04b6('0x49')]=[{'all':!![]}];}return db[_0x04b6('0xe0')][_0x04b6('0x4f')](_0x1a41bd);})[_0x04b6('0x18')](function(_0x1adf57){_0x244d70[_0x04b6('0x50')]=_0x1adf57;return _0x244d70;});}})[_0x04b6('0x18')](respondWithFilteredResult(_0x232343,_0x1a41bd))[_0x04b6('0x1f')](handleError(_0x232343,null));};exports['getChatInteractions']=function(_0x1543c3,_0x4000aa){var _0x2a3e23={};var _0x18860f={};var _0x740730;var _0x3a1a0c;return db['User'][_0x04b6('0x98')]({'where':{'id':_0x1543c3[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x4000aa,null))[_0x04b6('0x18')](function(_0x74fa9a){if(_0x74fa9a){_0x740730=_0x74fa9a;_0x18860f[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0xe1')]['rawAttributes']);_0x18860f[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x1543c3[_0x04b6('0x47')]);_0x18860f['filters']=_[_0x04b6('0x5f')](_0x18860f[_0x04b6('0x5a')],_0x18860f[_0x04b6('0x47')]);_0x2a3e23[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x18860f[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x1543c3[_0x04b6('0x47')][_0x04b6('0x60')]));_0x2a3e23['attributes']=_0x2a3e23[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x2a3e23[_0x04b6('0x4d')]:_0x18860f[_0x04b6('0x5a')];_0x2a3e23[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x1543c3[_0x04b6('0x47')]['sort']);_0x2a3e23[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_['pick'](_0x1543c3[_0x04b6('0x47')],_0x18860f[_0x04b6('0x5e')]));if(_0x1543c3[_0x04b6('0x47')][_0x04b6('0x34')]){_0x2a3e23[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x2a3e23[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x2a3e23[_0x04b6('0x4d')],function(_0xdf52f0){var _0x3686af={};_0x3686af[_0xdf52f0]={'$like':'%'+_0x1543c3['query']['filter']+'%'};return _0x3686af;})});}_0x2a3e23=_[_0x04b6('0xcf')]({},_0x2a3e23,_0x1543c3[_0x04b6('0x61')]);return _0x740730[_0x04b6('0xe2')](_0x2a3e23);}})[_0x04b6('0x18')](function(_0x43b968){if(_0x43b968){_0x3a1a0c=_0x43b968['length'];if(!_0x1543c3[_0x04b6('0x47')]['hasOwnProperty']('nolimit')){_0x2a3e23[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x1543c3[_0x04b6('0x47')][_0x04b6('0x26')]);_0x2a3e23['offset']=qs[_0x04b6('0x24')](_0x1543c3[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x740730[_0x04b6('0xe2')](_0x2a3e23);}})[_0x04b6('0x18')](function(_0x39ed14){if(_0x39ed14){return _0x39ed14?{'count':_0x3a1a0c,'rows':_0x39ed14}:null;}})[_0x04b6('0x18')](respondWithResult(_0x4000aa,null))['catch'](handleError(_0x4000aa,null));};exports[_0x04b6('0xe3')]=function(_0x264fb2,_0xc171de){var _0x2751b2={};var _0x190712={};var _0x567aa8;var _0x1be703;return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x264fb2[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0xc171de,null))[_0x04b6('0x18')](function(_0x392a47){if(_0x392a47){_0x567aa8=_0x392a47;_0x190712[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0xe4')]['rawAttributes']);_0x190712[_0x04b6('0x47')]=_['keys'](_0x264fb2[_0x04b6('0x47')]);_0x190712[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x190712[_0x04b6('0x5a')],_0x190712[_0x04b6('0x47')]);_0x2751b2[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x190712[_0x04b6('0x5a')],qs['fields'](_0x264fb2[_0x04b6('0x47')]['fields']));_0x2751b2[_0x04b6('0x4d')]=_0x2751b2[_0x04b6('0x4d')]['length']?_0x2751b2[_0x04b6('0x4d')]:_0x190712[_0x04b6('0x5a')];_0x2751b2[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x264fb2['query'][_0x04b6('0xcd')]);_0x2751b2[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x264fb2['query'],_0x190712[_0x04b6('0x5e')]));if(_0x264fb2[_0x04b6('0x47')][_0x04b6('0x34')]){_0x2751b2[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x2751b2[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x2751b2[_0x04b6('0x4d')],function(_0x2970e8){var _0x49d7a6={};_0x49d7a6[_0x2970e8]={'$like':'%'+_0x264fb2[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x49d7a6;})});}_0x2751b2=_[_0x04b6('0xcf')]({},_0x2751b2,_0x264fb2[_0x04b6('0x61')]);return _0x567aa8['getOpenchannelInteractions'](_0x2751b2);}})[_0x04b6('0x18')](function(_0x17bc61){if(_0x17bc61){_0x1be703=_0x17bc61['length'];if(!_0x264fb2[_0x04b6('0x47')]['hasOwnProperty'](_0x04b6('0xd5'))){_0x2751b2['limit']=qs[_0x04b6('0x26')](_0x264fb2[_0x04b6('0x47')][_0x04b6('0x26')]);_0x2751b2['offset']=qs['offset'](_0x264fb2[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x567aa8['getOpenchannelInteractions'](_0x2751b2);}})[_0x04b6('0x18')](function(_0x1991cc){if(_0x1991cc){return _0x1991cc?{'count':_0x1be703,'rows':_0x1991cc}:null;}})[_0x04b6('0x18')](respondWithResult(_0xc171de,null))['catch'](handleError(_0xc171de,null));};exports[_0x04b6('0xe5')]=function(_0x233491,_0x3134c1){var _0x361cb5={'raw':!![],'where':{}};var _0x5a2690={};var _0x42d1cd={'count':0x0,'rows':[]};return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x233491[_0x04b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x3134c1,null))[_0x04b6('0x18')](function(_0x68bac2){if(_0x68bac2){_0x5a2690[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0xe6')][_0x04b6('0x5d')]);_0x5a2690[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x233491[_0x04b6('0x47')]);_0x5a2690[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x5a2690[_0x04b6('0x5a')],_0x5a2690[_0x04b6('0x47')]);_0x361cb5[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x5a2690[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x233491[_0x04b6('0x47')][_0x04b6('0x60')]));_0x361cb5[_0x04b6('0x4d')]=_0x361cb5[_0x04b6('0x4d')]['length']?_0x361cb5[_0x04b6('0x4d')]:_0x5a2690[_0x04b6('0x5a')];if(!_0x233491['query'][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x361cb5[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x233491[_0x04b6('0x47')][_0x04b6('0x26')]);_0x361cb5[_0x04b6('0x24')]=qs['offset'](_0x233491[_0x04b6('0x47')][_0x04b6('0x24')]);}_0x361cb5[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x233491[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x361cb5[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x233491['query'],_0x5a2690['filters']));_0x361cb5['where'][_0x04b6('0xde')]=_0x68bac2['id'];if(_0x233491['query'][_0x04b6('0x34')]){_0x361cb5[_0x04b6('0x46')]=_['merge'](_0x361cb5[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x361cb5[_0x04b6('0x4d')],function(_0x37bbb0){var _0x153db0={};_0x153db0[_0x37bbb0]={'$like':'%'+_0x233491[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x153db0;})});}_0x361cb5=_[_0x04b6('0xcf')]({},_0x361cb5,_0x233491['options']);return db[_0x04b6('0xe6')][_0x04b6('0x27')]({'where':_0x361cb5[_0x04b6('0x46')]})[_0x04b6('0x18')](function(_0x5e37bd){_0x42d1cd['count']=_0x5e37bd;if(_0x233491['query']['includeAll']){_0x361cb5[_0x04b6('0x49')]=[{'all':!![]}];}return db[_0x04b6('0xe6')]['findAll'](_0x361cb5);})[_0x04b6('0x18')](function(_0x46f8a8){_0x42d1cd[_0x04b6('0x50')]=_0x46f8a8;return _0x42d1cd;});}})[_0x04b6('0x18')](respondWithFilteredResult(_0x3134c1,_0x361cb5))[_0x04b6('0x1f')](handleError(_0x3134c1,null));};exports[_0x04b6('0xe7')]=function(_0x90b4b5,_0x5e2a7d){var _0x1c3778={};var _0x2b649b={};var _0x2f2439;var _0x2965b4;return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x90b4b5[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x5e2a7d,null))[_0x04b6('0x18')](function(_0x3ebe54){if(_0x3ebe54){_0x2f2439=_0x3ebe54;_0x2b649b[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0xe8')][_0x04b6('0x5d')]);_0x2b649b[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x90b4b5[_0x04b6('0x47')]);_0x2b649b[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x2b649b[_0x04b6('0x5a')],_0x2b649b[_0x04b6('0x47')]);_0x1c3778[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x2b649b[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x90b4b5[_0x04b6('0x47')][_0x04b6('0x60')]));_0x1c3778[_0x04b6('0x4d')]=_0x1c3778['attributes'][_0x04b6('0x52')]?_0x1c3778[_0x04b6('0x4d')]:_0x2b649b[_0x04b6('0x5a')];_0x1c3778['order']=qs[_0x04b6('0xcd')](_0x90b4b5[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x1c3778[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x90b4b5[_0x04b6('0x47')],_0x2b649b[_0x04b6('0x5e')]));if(_0x90b4b5[_0x04b6('0x47')]['filter']){_0x1c3778[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x1c3778[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x1c3778[_0x04b6('0x4d')],function(_0x24d7c9){var _0x2a1ebc={};_0x2a1ebc[_0x24d7c9]={'$like':'%'+_0x90b4b5['query']['filter']+'%'};return _0x2a1ebc;})});}_0x1c3778=_[_0x04b6('0xcf')]({},_0x1c3778,_0x90b4b5[_0x04b6('0x61')]);return _0x2f2439['getSmsInteractions'](_0x1c3778);}})[_0x04b6('0x18')](function(_0x5659e3){if(_0x5659e3){_0x2965b4=_0x5659e3[_0x04b6('0x52')];if(!_0x90b4b5[_0x04b6('0x47')]['hasOwnProperty'](_0x04b6('0xd5'))){_0x1c3778['limit']=qs[_0x04b6('0x26')](_0x90b4b5[_0x04b6('0x47')][_0x04b6('0x26')]);_0x1c3778[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0x90b4b5[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x2f2439[_0x04b6('0xe7')](_0x1c3778);}})[_0x04b6('0x18')](function(_0x5ab497){if(_0x5ab497){return _0x5ab497?{'count':_0x2965b4,'rows':_0x5ab497}:null;}})['then'](respondWithResult(_0x5e2a7d,null))['catch'](handleError(_0x5e2a7d,null));};exports[_0x04b6('0xe9')]=function(_0x25b77a,_0x460403){var _0x587937={};var _0x167524={};var _0x31de98;var _0x338259;return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x25b77a[_0x04b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x460403,null))[_0x04b6('0x18')](function(_0xa19cd8){if(_0xa19cd8){_0x31de98=_0xa19cd8;_0x167524[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0xea')][_0x04b6('0x5d')]);_0x167524[_0x04b6('0x47')]=_[_0x04b6('0x5c')](_0x25b77a[_0x04b6('0x47')]);_0x167524[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x167524[_0x04b6('0x5a')],_0x167524['query']);_0x587937['attributes']=_[_0x04b6('0x5f')](_0x167524[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x25b77a['query']['fields']));_0x587937[_0x04b6('0x4d')]=_0x587937['attributes'][_0x04b6('0x52')]?_0x587937['attributes']:_0x167524[_0x04b6('0x5a')];_0x587937['order']=qs[_0x04b6('0xcd')](_0x25b77a[_0x04b6('0x47')]['sort']);_0x587937['where']=qs['filters'](_[_0x04b6('0xce')](_0x25b77a['query'],_0x167524[_0x04b6('0x5e')]));if(_0x25b77a[_0x04b6('0x47')][_0x04b6('0x34')]){_0x587937[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x587937[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x587937['attributes'],function(_0x2e7cc8){var _0x20e9cb={};_0x20e9cb[_0x2e7cc8]={'$like':'%'+_0x25b77a['query'][_0x04b6('0x34')]+'%'};return _0x20e9cb;})});}_0x587937=_[_0x04b6('0xcf')]({},_0x587937,_0x25b77a[_0x04b6('0x61')]);return _0x31de98[_0x04b6('0xe9')](_0x587937);}})[_0x04b6('0x18')](function(_0x4ef02e){if(_0x4ef02e){_0x338259=_0x4ef02e[_0x04b6('0x52')];if(!_0x25b77a[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x587937[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x25b77a[_0x04b6('0x47')][_0x04b6('0x26')]);_0x587937[_0x04b6('0x24')]=qs['offset'](_0x25b77a['query'][_0x04b6('0x24')]);}return _0x31de98[_0x04b6('0xe9')](_0x587937);}})['then'](function(_0x507e74){if(_0x507e74){return _0x507e74?{'count':_0x338259,'rows':_0x507e74}:null;}})[_0x04b6('0x18')](respondWithResult(_0x460403,null))[_0x04b6('0x1f')](handleError(_0x460403,null));};exports[_0x04b6('0xeb')]=function(_0x436ed0,_0x488608){var _0x531a8e={};var _0x1c2b23={};var _0x2afcef;var _0x2426b8;return db['User'][_0x04b6('0x98')]({'where':{'id':_0x436ed0[_0x04b6('0x59')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x488608,null))[_0x04b6('0x18')](function(_0x1cc81b){if(_0x1cc81b){_0x2afcef=_0x1cc81b;_0x1c2b23[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0xec')][_0x04b6('0x5d')]);_0x1c2b23['query']=_[_0x04b6('0x5c')](_0x436ed0[_0x04b6('0x47')]);_0x1c2b23[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0x1c2b23[_0x04b6('0x5a')],_0x1c2b23[_0x04b6('0x47')]);_0x531a8e[_0x04b6('0x4d')]=_[_0x04b6('0x5f')](_0x1c2b23[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x436ed0[_0x04b6('0x47')][_0x04b6('0x60')]));_0x531a8e[_0x04b6('0x4d')]=_0x531a8e[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x531a8e[_0x04b6('0x4d')]:_0x1c2b23[_0x04b6('0x5a')];_0x531a8e[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x436ed0['query'][_0x04b6('0xcd')]);_0x531a8e['where']=qs['filters'](_['pick'](_0x436ed0['query'],_0x1c2b23[_0x04b6('0x5e')]));if(_0x436ed0['query'][_0x04b6('0x34')]){_0x531a8e['where']=_['merge'](_0x531a8e[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x531a8e[_0x04b6('0x4d')],function(_0xb712f7){var _0x553592={};_0x553592[_0xb712f7]={'$like':'%'+_0x436ed0[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x553592;})});}_0x531a8e=_[_0x04b6('0xcf')]({},_0x531a8e,_0x436ed0[_0x04b6('0x61')]);return _0x2afcef[_0x04b6('0xeb')](_0x531a8e);}})['then'](function(_0x447104){if(_0x447104){_0x2426b8=_0x447104[_0x04b6('0x52')];if(!_0x436ed0[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x531a8e[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x436ed0['query'][_0x04b6('0x26')]);_0x531a8e[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0x436ed0[_0x04b6('0x47')]['offset']);}return _0x2afcef[_0x04b6('0xeb')](_0x531a8e);}})[_0x04b6('0x18')](function(_0x4f5e90){if(_0x4f5e90){return _0x4f5e90?{'count':_0x2426b8,'rows':_0x4f5e90}:null;}})[_0x04b6('0x18')](respondWithResult(_0x488608,null))[_0x04b6('0x1f')](handleError(_0x488608,null));};exports['login']=function(_0x4cfd60,_0x29e535,_0x13baa9){var _0x505502;var _0x16a690;var _0x4946eb;var _0x1542bd=!_[_0x04b6('0x6c')](_0x4cfd60[_0x04b6('0x59')]['id'])?_0x4cfd60[_0x04b6('0x59')]['id']:!_['isNil'](_0x4cfd60['user']['id'])?_0x4cfd60[_0x04b6('0x30')]['id']:null;return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x1542bd,'role':{'$or':['admin','user','agent']}},'attributes':['id','name',_0x04b6('0xed'),_0x04b6('0xee'),'role',_0x04b6('0x6b'),'loginInPause']})[_0x04b6('0x18')](function(_0x2581e1){if(_0x2581e1){if(_0x2581e1[_0x04b6('0x39')]===_0x04b6('0x31')){_0x505502=_0x2581e1;if(_0x4cfd60[_0x04b6('0x64')][_0x04b6('0xa4')]){_0x4946eb=util[_0x04b6('0xb0')](_0x04b6('0xef'),_0x505502[_0x4cfd60[_0x04b6('0x64')][_0x04b6('0xa4')]]);}else if(_0x4cfd60[_0x04b6('0x64')][_0x04b6('0xf0')]){_0x4946eb=util[_0x04b6('0xb0')](_0x04b6('0xb1'),_0x4cfd60[_0x04b6('0x64')]['intrf']);}else{_0x4946eb=util[_0x04b6('0xb0')]('SIP/%s',_0x505502[_0x04b6('0x3b')]);}socket['to'](util[_0x04b6('0xb0')](_0x04b6('0xf1'),_0x505502[_0x04b6('0x3b')]))[_0x04b6('0x2b')](_0x04b6('0xf2'),{'user':{'id':_0x505502['id'],'name':_0x505502[_0x04b6('0x3b')]},'ip':_0x4cfd60[_0x04b6('0xf3')]['x-forwarded-for']||_0x4cfd60['connection'][_0x04b6('0xf4')]||_0x4cfd60[_0x04b6('0xf5')]['remoteAddress']||_0x4cfd60['connection'][_0x04b6('0xf5')][_0x04b6('0xf4')]});return db[_0x04b6('0xb2')][_0x04b6('0x2c')]({'where':{'membername':_0x505502['name']},'individualHooks':!![]});}}else{throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))](_0x04b6('0xf6'));}})['then'](function(){if(_0x505502){return _0x505502[_0x04b6('0xf7')]({'raw':!![]});}})['then'](function(_0x53015b){if(_0x505502){var _0xcb749d=[];if(_0x53015b){_0x16a690=_0x53015b;if(_0x16a690[_0x04b6('0x52')]){for(var _0x3f41e8=0x0;_0x3f41e8<_0x16a690['length'];_0x3f41e8++){_0xcb749d[_0x04b6('0x4e')]({'membername':_0x505502[_0x04b6('0x3b')],'UserId':_0x505502['id'],'queue_name':_0x16a690[_0x3f41e8][_0x04b6('0x3b')],'VoiceQueueId':_0x16a690[_0x3f41e8]['id'],'interface':_0x4946eb,'paused':_0x505502[_0x04b6('0xa2')]||![],'penalty':_0x16a690[_0x3f41e8][_0x04b6('0xf8')]||0x0});}return BPromise['each'](_0xcb749d,function(_0x3ed8a3){return db[_0x04b6('0xb2')]['upsert'](_0x3ed8a3);});}}}})[_0x04b6('0x18')](function(){if(_0x505502){return db[_0x04b6('0xf9')][_0x04b6('0x4f')]({'where':{'membername':_0x505502[_0x04b6('0x3b')],'exitAt':null}});}})[_0x04b6('0x18')](function(_0x55cf44){if(_0x505502){var _0x4483ee=[];_0x55cf44[_0x04b6('0xfa')](function(_0x2b4c8d){_0x4483ee[_0x04b6('0x4e')](_0x2b4c8d[_0x04b6('0x2a')]({'exitAt':moment()[_0x04b6('0xb0')](_0x04b6('0xfb'))}));});return BPromise[_0x04b6('0x57')](_0x4483ee);}})[_0x04b6('0x18')](function(){if(_0x505502){var _0x360616=[];var _0x54747d=[];var _0x2d955f=utils[_0x04b6('0xfc')]();var _0x1d2bda={'membername':_0x505502[_0x04b6('0x3b')],'interface':_0x4946eb,'enterAt':moment()[_0x04b6('0xb0')](_0x04b6('0xfb')),'role':_0x505502[_0x04b6('0x39')],'internal':_0x505502[_0x04b6('0x6b')]};_0x2d955f[_0x04b6('0xfa')](function(_0x54125d){_0x360616['push'](_[_0x04b6('0xcf')]({'channel':_0x54125d,'type':_0x04b6('0xfd'),'data1':_0x4cfd60[_0x04b6('0x64')]['device'],'data2':_0x4946eb},_0x1d2bda));if(_0x505502[_0x04b6('0xa2')]){_0x54747d['push'](_['merge']({'channel':_0x54125d,'type':_0x04b6('0xfe'),'data1':_0x04b6('0xff')},_0x1d2bda));}});return db['MemberReport'][_0x04b6('0x89')](_0x360616['concat'](_0x54747d),{'individualHooks':!![]});}})[_0x04b6('0x18')](function(){if(_0x505502){return _0x505502[_0x04b6('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x04b6('0xb0')](_0x04b6('0xfb')),'voicePause':_0x505502[_0x04b6('0xa2')]||![],'mailPause':_0x505502[_0x04b6('0xa2')]||![],'chatPause':_0x505502['loginInPause']||![],'faxPause':_0x505502[_0x04b6('0xa2')]||![],'smsPause':_0x505502[_0x04b6('0xa2')]||![],'openchannelPause':_0x505502['loginInPause']||![],'whatsappPause':_0x505502['loginInPause']||![],'pauseType':_0x505502[_0x04b6('0xa2')]?_0x04b6('0xff'):null,'interface':_0x4946eb,'lastPauseAt':moment()[_0x04b6('0xb0')](_0x04b6('0xfb'))});}})['then'](function(_0x541bc0){if(_0x4cfd60[_0x04b6('0x100')]){return _0x13baa9();}else{return BPromise[_0x04b6('0x101')](_0x541bc0)['then'](respondWithResult(_0x29e535,null));}})['catch'](handleError(_0x29e535,null));};exports[_0x04b6('0x102')]=function(_0x987978,_0x3412f8){var _0x4f3a72;return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x987978[_0x04b6('0x59')]['id'],'role':_0x04b6('0x31')},'attributes':['id',_0x04b6('0x3b'),_0x04b6('0x39')]})['then'](handleEntityNotFound(_0x3412f8,null))[_0x04b6('0x18')](function(_0xaa2490){if(_0xaa2490){_0x4f3a72=_0xaa2490;return db[_0x04b6('0xb2')][_0x04b6('0x2c')]({'where':{'membername':_0x4f3a72['name']},'individualHooks':!![]});}})[_0x04b6('0x18')](function(){return db[_0x04b6('0xf9')][_0x04b6('0x4f')]({'where':{'membername':_0x4f3a72[_0x04b6('0x3b')],'exitAt':null}});})[_0x04b6('0x18')](function(_0x2cd9e6){var _0x4fa9ba=[];_0x2cd9e6[_0x04b6('0xfa')](function(_0x2dc649){_0x4fa9ba[_0x04b6('0x4e')](_0x2dc649[_0x04b6('0x2a')]({'exitAt':moment()['format'](_0x04b6('0xfb'))}));});return BPromise[_0x04b6('0x57')](_0x4fa9ba);})[_0x04b6('0x18')](function(){return _0x4f3a72['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x04b6('0x18')](respondWithResult(_0x3412f8,null))['catch'](handleError(_0x3412f8,null));};exports[_0x04b6('0x103')]=function(_0xe519f0,_0x4595e3){var _0x164811;return db[_0x04b6('0xb2')]['update']({'paused':0x1},{'where':{'UserId':_0xe519f0[_0x04b6('0x59')]['id']},'individualHooks':!![]})[_0x04b6('0x18')](function(){return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0xe519f0[_0x04b6('0x59')]['id'],'role':_0x04b6('0x31')},'attributes':['id',_0x04b6('0x3b'),_0x04b6('0x39'),'internal',_0x04b6('0xa4')]});})[_0x04b6('0x18')](handleEntityNotFound(_0x4595e3,null))[_0x04b6('0x18')](function(_0x2d3847){if(_0x2d3847){_0x164811=_0x2d3847;return respondWithRpcPromise('QueuePause',_0x04b6('0x103'),{'id':_0x164811['id'],'name':_0x164811['name'],'pause':!![]});}})[_0x04b6('0x18')](function(){if(_0x164811){return db[_0x04b6('0xf9')][_0x04b6('0x4f')]({'where':{'membername':_0x164811[_0x04b6('0x3b')],'type':_0x04b6('0xfe'),'exitAt':null}});}})[_0x04b6('0x18')](function(_0x421125){if(_0x421125['length']){var _0x877138=moment()[_0x04b6('0xb0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1661a3=0x0,_0x199c60=_0x421125[_0x04b6('0x52')];_0x1661a3<_0x199c60;_0x1661a3++){_0x421125[_0x1661a3][_0x04b6('0x104')]({'exitAt':_0x877138});}}})[_0x04b6('0x18')](function(){var _0x2a0164=[];var _0x3240bd=utils[_0x04b6('0xfc')]();_0x3240bd['forEach'](function(_0x17d9c4){_0x2a0164[_0x04b6('0x4e')]({'channel':_0x17d9c4,'membername':_0x164811['name'],'interface':_[_0x04b6('0x6c')](_0x164811['interface'])?util[_0x04b6('0xb0')](_0x04b6('0xb1'),_0x164811[_0x04b6('0x3b')]):_0x164811['interface'],'type':_0x04b6('0xfe'),'enterAt':moment()[_0x04b6('0xb0')](_0x04b6('0xfb')),'data1':_0xe519f0[_0x04b6('0x64')][_0x04b6('0x42')]||_0x04b6('0x105'),'role':_0x164811['role'],'internal':_0x164811[_0x04b6('0x6b')]});});return db[_0x04b6('0xf9')][_0x04b6('0x89')](_0x2a0164,{'individualHooks':!![]});})[_0x04b6('0x18')](function(){return _0x164811[_0x04b6('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xe519f0[_0x04b6('0x64')][_0x04b6('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x04b6('0xfb'))});})[_0x04b6('0x18')](respondWithResult(_0x4595e3,null))[_0x04b6('0x1f')](handleError(_0x4595e3,null));};exports[_0x04b6('0x106')]=function(_0x1d7e8c,_0x39514b){var _0x5f4c69;return db[_0x04b6('0x40')][_0x04b6('0x3a')]({'where':{'id':_0x1d7e8c[_0x04b6('0x59')]['id']},'attributes':['id','name',_0x04b6('0x39'),_0x04b6('0xa3'),_0x04b6('0x107'),_0x04b6('0x108'),'faxPause','openchannelPause',_0x04b6('0x109'),_0x04b6('0x10a'),_0x04b6('0x10b'),_0x04b6('0x10c')]})[_0x04b6('0x18')](handleEntityNotFound(_0x39514b,null))['then'](function(_0x499587){if(_0x499587){_0x5f4c69=_0x499587;if(_0x1d7e8c[_0x04b6('0x64')]['channel']&&!utils[_0x04b6('0xa5')](_0x1d7e8c['body'][_0x04b6('0xa0')])){throw new db[(_0x04b6('0x92'))][(_0x04b6('0x93'))]('Unknown\x20channel');}switch(_0x1d7e8c[_0x04b6('0x64')][_0x04b6('0xa0')]){case _0x04b6('0xaf'):return respondWithRpcPromise(_0x04b6('0x10d'),_0x04b6('0x106'),{'id':_0x5f4c69['id'],'name':_0x5f4c69[_0x04b6('0x3b')],'pause':![]})[_0x04b6('0x18')](function(){return db[_0x04b6('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0x5f4c69['id']},'individualHooks':!![]});})['then'](function(){return db[_0x04b6('0xf9')][_0x04b6('0x3a')]({'where':{'channel':_0x1d7e8c[_0x04b6('0x64')][_0x04b6('0xa0')],'membername':_0x5f4c69['name'],'type':_0x04b6('0xfe'),'exitAt':null}});})['then'](function(_0x1a5d38){if(_0x1a5d38){return _0x1a5d38[_0x04b6('0x2a')]({'exitAt':moment()['format'](_0x04b6('0xfb')),'data2':_0x04b6('0x10e')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5f4c69[_0x04b6('0x2a')]({'voicePause':![]});});case'mail':case'chat':case _0x04b6('0x63'):case _0x04b6('0x62'):case'whatsapp':case _0x04b6('0x56'):return db[_0x04b6('0xf9')][_0x04b6('0x3a')]({'where':{'channel':_0x1d7e8c[_0x04b6('0x64')][_0x04b6('0xa0')],'membername':_0x5f4c69[_0x04b6('0x3b')],'type':_0x04b6('0xfe'),'exitAt':null}})[_0x04b6('0x18')](function(_0xc5f470){if(_0xc5f470){return _0xc5f470[_0x04b6('0x2a')]({'exitAt':moment()['format'](_0x04b6('0xfb')),'data2':_0x04b6('0x10e')},{'individualHooks':!![]});}return null;})[_0x04b6('0x18')](function(){var _0x5c7e5d={};_[_0x04b6('0x28')](_0x5c7e5d,util[_0x04b6('0xb0')](_0x04b6('0x10f'),_0x1d7e8c[_0x04b6('0x64')][_0x04b6('0xa0')],_0x04b6('0x110')),![]);return _0x5f4c69[_0x04b6('0x2a')](_0x5c7e5d);});default:return respondWithRpcPromise(_0x04b6('0x10d'),_0x04b6('0x106'),{'id':_0x5f4c69['id'],'name':_0x5f4c69['name'],'pause':![]})[_0x04b6('0x18')](function(){return db[_0x04b6('0xb2')][_0x04b6('0x2a')]({'paused':0x0},{'where':{'UserId':_0x5f4c69['id']}});})[_0x04b6('0x18')](function(){return db[_0x04b6('0xf9')][_0x04b6('0x4f')]({'where':{'membername':_0x5f4c69[_0x04b6('0x3b')],'type':_0x04b6('0xfe'),'exitAt':null}});})[_0x04b6('0x18')](function(_0x7de69c){var _0x3df2be=[];_0x7de69c[_0x04b6('0xfa')](function(_0x2ec89c){_0x3df2be[_0x04b6('0x4e')](_0x2ec89c[_0x04b6('0x2a')]({'exitAt':moment()[_0x04b6('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x04b6('0x10e')}));});return BPromise[_0x04b6('0x57')](_0x3df2be);})[_0x04b6('0x18')](function(){return _0x5f4c69['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x04b6('0x18')](respondWithResult(_0x39514b,null))[_0x04b6('0x1f')](handleError(_0x39514b,null));};exports['getTeams']=function(_0x1069cc,_0x2ff7c5){var _0x2d306a={};var _0xcab653={};var _0x535f20;var _0x3c1b87;return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x1069cc['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x2ff7c5,null))[_0x04b6('0x18')](function(_0x6f0e8b){if(_0x6f0e8b){_0x535f20=_0x6f0e8b;_0xcab653[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0x111')]['rawAttributes']);_0xcab653[_0x04b6('0x47')]=_['keys'](_0x1069cc['query']);_0xcab653[_0x04b6('0x5e')]=_[_0x04b6('0x5f')](_0xcab653[_0x04b6('0x5a')],_0xcab653['query']);_0x2d306a[_0x04b6('0x4d')]=_['intersection'](_0xcab653[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x1069cc[_0x04b6('0x47')][_0x04b6('0x60')]));_0x2d306a[_0x04b6('0x4d')]=_0x2d306a[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x2d306a['attributes']:_0xcab653[_0x04b6('0x5a')];_0x2d306a[_0x04b6('0xcc')]=qs['sort'](_0x1069cc[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x2d306a['where']=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x1069cc[_0x04b6('0x47')],_0xcab653[_0x04b6('0x5e')]));if(_0x1069cc[_0x04b6('0x47')][_0x04b6('0x34')]){_0x2d306a['where']=_[_0x04b6('0xcf')](_0x2d306a[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x2d306a[_0x04b6('0x4d')],function(_0x4fe5a9){var _0x473212={};_0x473212[_0x4fe5a9]={'$like':'%'+_0x1069cc[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x473212;})});}_0x2d306a=_[_0x04b6('0xcf')]({},_0x2d306a,_0x1069cc['options']);return _0x535f20['getTeams'](_0x2d306a);}})[_0x04b6('0x18')](function(_0xad0a3c){if(_0xad0a3c){_0x3c1b87=_0xad0a3c['length'];if(!_0x1069cc[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x2d306a[_0x04b6('0x26')]=qs[_0x04b6('0x26')](_0x1069cc[_0x04b6('0x47')]['limit']);_0x2d306a['offset']=qs[_0x04b6('0x24')](_0x1069cc['query'][_0x04b6('0x24')]);}return _0x535f20['getTeams'](_0x2d306a);}})[_0x04b6('0x18')](function(_0x2674e1){if(_0x2674e1){return _0x2674e1?{'count':_0x3c1b87,'rows':_0x2674e1}:null;}})[_0x04b6('0x18')](respondWithResult(_0x2ff7c5,null))[_0x04b6('0x1f')](handleError(_0x2ff7c5,null));};exports[_0x04b6('0x112')]=function(_0x21e60b,_0x478527){var _0x16ef1c=_0x21e60b[_0x04b6('0x59')]['id'];var _0x3b3b99=_0x21e60b['body']?_0x21e60b[_0x04b6('0x64')]['ids']:null;var _0x447003=[];return Promise[_0x04b6('0x101')]()[_0x04b6('0x18')](function(){if(!_0x3b3b99)throw new APIBadRequestError(_0x04b6('0x113'));})[_0x04b6('0x18')](function(){return db[_0x04b6('0x40')][_0x04b6('0x98')]({'where':{'id':_0x16ef1c}});})[_0x04b6('0x18')](function(_0x3b2744){if(!_0x3b2744)throw new APINotFoundError(util[_0x04b6('0xb0')](_0x04b6('0x114'),_0x21e60b[_0x04b6('0x59')]['id']));return db['sequelize']['transaction'](function(_0x5903db){return _0x3b2744['addTeams'](_0x3b3b99,{'transaction':_0x5903db})[_0x04b6('0x18')](function(){return db[_0x04b6('0x111')][_0x04b6('0x4f')]({'where':{'id':{'$in':_0x3b3b99}}});})[_0x04b6('0x18')](function(_0x4c472f){var _0x1ff63e=_[_0x04b6('0x36')](_0x4c472f,function(_0x140543){return _0x140543[_0x04b6('0x115')]();});return Promise[_0x04b6('0x57')](_0x1ff63e);})[_0x04b6('0x18')](function(_0x47e5fd){_0x447003=_[_0x04b6('0x116')](_0x47e5fd);var _0x83083=_[_0x04b6('0x36')](_0x447003,function(_0x100aa7){return _0x100aa7[_0x04b6('0x117')](_0x3b2744['id'],{'transaction':_0x5903db});});return Promise[_0x04b6('0x57')](_0x83083);})['then'](function(){if(!_0x3b2744[_0x04b6('0xa1')])return;var _0x116d21=_[_0x04b6('0x34')](_0x447003,function(_0x150063){return _0x150063[_0x04b6('0x118')]('channel')===_0x04b6('0x119');});var _0x3bd11d=_[_0x04b6('0x36')](_0x116d21,function(_0x245e6e){return db[_0x04b6('0xb2')][_0x04b6('0xb3')]({'membername':_0x3b2744[_0x04b6('0x3b')],'UserId':_0x3b2744['id'],'queue_name':_0x245e6e[_0x04b6('0x3b')],'VoiceQueueId':_0x245e6e['id'],'interface':_['isNil'](_0x3b2744[_0x04b6('0xa4')])?util[_0x04b6('0xb0')](_0x04b6('0xb1'),_0x3b2744['name']):_0x3b2744[_0x04b6('0xa4')],'paused':_0x3b2744[_0x04b6('0xa3')]||![],'penalty':_0x3b2744[_0x04b6('0xaa')]},{'transaction':_0x5903db});});return Promise[_0x04b6('0x57')](_0x3bd11d);})[_0x04b6('0x18')](function(){return db[_0x04b6('0x11a')][_0x04b6('0x4f')]({'where':{'teamId':{'$in':_0x3b3b99}}});})[_0x04b6('0x18')](function(_0x512ec5){var _0x3bf3ae=_[_0x04b6('0x36')](_0x512ec5,function(_0xbf381b){return db['UserVoicePrefix'][_0x04b6('0x81')]({'UserId':_0x3b2744['id'],'VoicePrefixId':_0xbf381b[_0x04b6('0x11b')]},{'transaction':_0x5903db});});return Promise[_0x04b6('0x57')](_0x3bf3ae);});});})[_0x04b6('0x18')](function(){for(var _0x4c3e74=0x0;_0x4c3e74<_0x447003['length'];_0x4c3e74++){var _0x1dbbb9=_0x447003[_0x4c3e74]['getDataValue'](_0x04b6('0xa0'));var _0xe8bdfa=_0x1dbbb9+_0x04b6('0xac');socket[_0x04b6('0x2b')](_0x04b6('0x30')+_0x1dbbb9+_0x04b6('0xad'),{'UserId':_0x16ef1c,['queueField']:_0x447003[_0x4c3e74]['id']});}})[_0x04b6('0x18')](respondWithStatusCode(_0x478527,null))[_0x04b6('0x1f')](APIHandleError(_0x478527));};exports[_0x04b6('0x11c')]=function(_0x59be06,_0x1e869a){var _0x4dee24=_0x59be06[_0x04b6('0x59')]['id'];var _0x4df5dd=null;if(_0x59be06[_0x04b6('0x47')][_0x04b6('0x67')]){_0x4df5dd=_['isArray'](_0x59be06[_0x04b6('0x47')][_0x04b6('0x67')])?_0x59be06[_0x04b6('0x47')][_0x04b6('0x67')]:[_0x59be06['query'][_0x04b6('0x67')]];}var _0x22e658=[];return Promise[_0x04b6('0x101')]()[_0x04b6('0x18')](function(){if(!_0x4df5dd)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x04b6('0x18')](function(){return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x4dee24}});})[_0x04b6('0x18')](function(_0x2688df){if(!_0x2688df)throw new APINotFoundError(util[_0x04b6('0xb0')](_0x04b6('0x114'),_0x59be06[_0x04b6('0x59')]['id']));return db[_0x04b6('0x6e')][_0x04b6('0x11d')](function(_0x2faa31){return _0x2688df[_0x04b6('0x11c')](_0x4df5dd,{'transaction':_0x2faa31})[_0x04b6('0x18')](function(){return db[_0x04b6('0x111')][_0x04b6('0x4f')]({'where':{'id':{'$in':_0x4df5dd}}});})[_0x04b6('0x18')](function(_0x29c51f){var _0x4285ec=_[_0x04b6('0x36')](_0x29c51f,function(_0x220721){return _0x220721[_0x04b6('0x115')]();});return Promise[_0x04b6('0x57')](_0x4285ec);})['then'](function(_0x21432e){_0x22e658=_[_0x04b6('0x116')](_0x21432e);var _0x190255=_[_0x04b6('0x36')](_0x22e658,function(_0x4761ce){return _0x4761ce[_0x04b6('0x11e')](_0x2688df['id'],{'transaction':_0x2faa31});});return Promise[_0x04b6('0x57')](_0x190255);})[_0x04b6('0x18')](function(){if(!_0x2688df[_0x04b6('0xa1')])return;var _0x25e77e=_[_0x04b6('0x34')](_0x22e658,function(_0x3b1cf5){return _0x3b1cf5['getDataValue'](_0x04b6('0xa0'))===_0x04b6('0x119');});var _0x358f2d=_[_0x04b6('0x36')](_0x25e77e,function(_0x2ceaed){return db[_0x04b6('0xb2')][_0x04b6('0x2c')]({'where':{'VoiceQueueId':_0x2ceaed['id'],'UserId':_0x2688df['id']},'transaction':_0x2faa31});});return Promise[_0x04b6('0x57')](_0x358f2d);})['then'](function(){return db[_0x04b6('0x11a')][_0x04b6('0x4f')]({'where':{'teamId':{'$in':_0x4df5dd}}});})[_0x04b6('0x18')](function(_0x4dedb7){var _0x49f547=_[_0x04b6('0x36')](_0x4dedb7,function(_0x5144ab){return db[_0x04b6('0x11f')]['destroy']({'where':{'UserId':_0x2688df['id'],'VoicePrefixId':_0x5144ab[_0x04b6('0x11b')]}},{'transaction':_0x2faa31});});return Promise[_0x04b6('0x57')](_0x49f547);});});})[_0x04b6('0x18')](function(){for(var _0x5ead71=0x0;_0x5ead71<_0x22e658[_0x04b6('0x52')];_0x5ead71++){var _0x4cc8ee=_0x22e658[_0x5ead71][_0x04b6('0x118')]('channel');var _0x21e5b3=_0x4cc8ee+_0x04b6('0xac');socket[_0x04b6('0x2b')](_0x04b6('0x30')+_0x4cc8ee+_0x04b6('0xb5'),{'UserId':_0x4dee24,['queueField']:_0x22e658[_0x5ead71]['id']});}})[_0x04b6('0x18')](respondWithStatusCode(_0x1e869a,null))[_0x04b6('0x1f')](APIHandleError(_0x1e869a));};exports[_0x04b6('0x120')]=function(_0x12e7d4,_0x553935){var _0x198885={};var _0x40e5aa={};var _0x1fc549;var _0x209cf3;return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x12e7d4['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x553935,null))[_0x04b6('0x18')](function(_0x26eda2){if(_0x26eda2){_0x1fc549=_0x26eda2;_0x40e5aa[_0x04b6('0x5a')]=_[_0x04b6('0x5c')](db[_0x04b6('0x121')][_0x04b6('0x5d')]);_0x40e5aa[_0x04b6('0x47')]=_['keys'](_0x12e7d4[_0x04b6('0x47')]);_0x40e5aa['filters']=_[_0x04b6('0x5f')](_0x40e5aa[_0x04b6('0x5a')],_0x40e5aa['query']);_0x198885['attributes']=_[_0x04b6('0x5f')](_0x40e5aa['model'],qs['fields'](_0x12e7d4[_0x04b6('0x47')][_0x04b6('0x60')]));_0x198885[_0x04b6('0x4d')]=_0x198885['attributes'][_0x04b6('0x52')]?_0x198885[_0x04b6('0x4d')]:_0x40e5aa[_0x04b6('0x5a')];_0x198885['order']=qs[_0x04b6('0xcd')](_0x12e7d4[_0x04b6('0x47')][_0x04b6('0xcd')]);_0x198885[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_['pick'](_0x12e7d4[_0x04b6('0x47')],_0x40e5aa[_0x04b6('0x5e')]));if(_0x12e7d4[_0x04b6('0x47')][_0x04b6('0x34')]){_0x198885[_0x04b6('0x46')]=_[_0x04b6('0xcf')](_0x198885[_0x04b6('0x46')],{'$or':_['map'](_0x198885[_0x04b6('0x4d')],function(_0x440cd2){var _0x56e12f={};_0x56e12f[_0x440cd2]={'$like':'%'+_0x12e7d4[_0x04b6('0x47')]['filter']+'%'};return _0x56e12f;})});}_0x198885=_[_0x04b6('0xcf')]({},_0x198885,_0x12e7d4[_0x04b6('0x61')]);return _0x1fc549['getLists'](_0x198885);}})[_0x04b6('0x18')](function(_0x310a4e){if(_0x310a4e){_0x209cf3=_0x310a4e[_0x04b6('0x52')];if(!_0x12e7d4[_0x04b6('0x47')][_0x04b6('0xd0')](_0x04b6('0xd5'))){_0x198885['limit']=qs[_0x04b6('0x26')](_0x12e7d4[_0x04b6('0x47')][_0x04b6('0x26')]);_0x198885[_0x04b6('0x24')]=qs[_0x04b6('0x24')](_0x12e7d4[_0x04b6('0x47')][_0x04b6('0x24')]);}return _0x1fc549[_0x04b6('0x120')](_0x198885);}})['then'](function(_0xfc84a4){if(_0xfc84a4){return _0xfc84a4?{'count':_0x209cf3,'rows':_0xfc84a4}:null;}})[_0x04b6('0x18')](respondWithResult(_0x553935,null))[_0x04b6('0x1f')](handleError(_0x553935,null));};exports['getAgents']=function(_0x4d2eb8,_0x44e41b){var _0x419dfc={};var _0x1e4200={};var _0x26acc2;return db[_0x04b6('0x40')]['findOne']({'where':{'id':_0x4d2eb8[_0x04b6('0x59')]['id']}})['then'](handleEntityNotFound(_0x44e41b,null))['then'](function(_0x1c2cc7){if(_0x1c2cc7){_0x26acc2=_0x1c2cc7;_0x1e4200[_0x04b6('0x5a')]=_['keys'](db[_0x04b6('0x40')]['rawAttributes']);_0x1e4200['query']=_[_0x04b6('0x5c')](_0x4d2eb8[_0x04b6('0x47')]);_0x1e4200['filters']=_[_0x04b6('0x5f')](_0x1e4200[_0x04b6('0x5a')],_0x1e4200['query']);_0x419dfc['attributes']=_['intersection'](_0x1e4200[_0x04b6('0x5a')],qs[_0x04b6('0x60')](_0x4d2eb8[_0x04b6('0x47')][_0x04b6('0x60')]));_0x419dfc[_0x04b6('0x4d')]=_0x419dfc[_0x04b6('0x4d')][_0x04b6('0x52')]?_0x419dfc['attributes']:_0x1e4200['model'];_0x419dfc[_0x04b6('0xcc')]=qs[_0x04b6('0xcd')](_0x4d2eb8['query'][_0x04b6('0xcd')]);_0x419dfc[_0x04b6('0x46')]=qs[_0x04b6('0x5e')](_[_0x04b6('0xce')](_0x4d2eb8[_0x04b6('0x47')],_0x1e4200[_0x04b6('0x5e')]));if(_0x4d2eb8[_0x04b6('0x47')][_0x04b6('0x34')]){_0x419dfc[_0x04b6('0x46')]=_['merge'](_0x419dfc[_0x04b6('0x46')],{'$or':_[_0x04b6('0x36')](_0x419dfc[_0x04b6('0x4d')],function(_0x5002f5){var _0x464014={};_0x464014[_0x5002f5]={'$like':'%'+_0x4d2eb8[_0x04b6('0x47')][_0x04b6('0x34')]+'%'};return _0x464014;})});}_0x419dfc[_0x04b6('0x5a')]=db['User'];_0x419dfc['as']=_0x04b6('0x87');_0x419dfc=_[_0x04b6('0xcf')]({},_0x419dfc,_0x4d2eb8[_0x04b6('0x61')]);return _0x26acc2[_0x04b6('0xf7')]({'include':[_0x419dfc]});}})[_0x04b6('0x18')](function(_0x459905){if(_0x459905){var _0x15256a={},_0x25be21=[];for(var _0x291431=0x0;_0x291431<_0x459905[_0x04b6('0x52')];_0x291431+=0x1){for(var _0x3e0702=0x0,_0x5977b7;_0x3e0702<_0x459905[_0x291431][_0x04b6('0x87')][_0x04b6('0x52')];_0x3e0702+=0x1){_0x5977b7=_0x459905[_0x291431]['Agents'][_0x3e0702][_0x04b6('0x2d')]({'plain':!![]});_0x15256a[_0x5977b7['id']]=_0x5977b7;}}_0x15256a=_['values'](_0x15256a);for(var _0x1d9e96=qs['offset'](_0x4d2eb8[_0x04b6('0x47')][_0x04b6('0x24')]);_0x1d9e96<_0x15256a[_0x04b6('0x52')]&&_0x25be21[_0x04b6('0x52')]=_0x1b88f3){_0x3df4d9=_0x1b88f3;_0x2fd3ce=0xc8;}else{_0x2fd3ce=0xce;}_0x2b47b8[_0x6a63('0x27')](_0x2fd3ce);return _0x2b47b8[_0x6a63('0x28')](_0x6a63('0x29'),_0x27c6bb+'-'+_0x3df4d9+'/'+_0x1b88f3)[_0x6a63('0x22')](_0x215161);}return null;};}function saveUpdates(_0xcff2de){return function(_0x10fd37){if(_0x10fd37){return _0x10fd37[_0x6a63('0x2a')](_0xcff2de)[_0x6a63('0x16')](function(_0x395ea1){socket[_0x6a63('0x2b')]('userNotification:recalc:'+_0x395ea1['id'],{});return _0x395ea1;});}return null;};}function removeEntity(_0x73983e){return function(_0x9ef4c1){if(_0x9ef4c1){return _0x9ef4c1[_0x6a63('0x2c')]()[_0x6a63('0x16')](function(){var _0x3e2c10=_0x9ef4c1[_0x6a63('0x2d')]({'plain':!![]});if(_0x3e2c10[_0x6a63('0x2e')]===_0x6a63('0x2f'))return;var _0x1e90df=[{'name':_0x6a63('0x30'),'value':'user','ignore':!![]},{'name':_0x6a63('0x31'),'value':'agent','ignore':![]},{'name':_0x6a63('0x32'),'value':_0x6a63('0x33'),'ignore':![]}];var _0x38761f=_(_0x1e90df)[_0x6a63('0x34')]('ignore')['map'](_0x6a63('0x35'))[_0x6a63('0x35')]();if(_[_0x6a63('0x36')](_0x38761f,_0x3e2c10[_0x6a63('0x2e')])){return;}var _0x121068=_[_0x6a63('0x37')](_0x1e90df,[_0x6a63('0x35'),_0x3e2c10[_0x6a63('0x2e')]])[_0x6a63('0x38')];return db[_0x6a63('0x39')][_0x6a63('0x2c')]({'where':{'type':_0x121068,'resourceId':_0x3e2c10['id']}})[_0x6a63('0x16')](function(){return _0x9ef4c1;});})[_0x6a63('0x16')](function(){_0x73983e[_0x6a63('0x27')](0xcc)[_0x6a63('0x3a')]();});}};}function handleEntityNotFound(_0x1b6b3a){return function(_0x28ca96){if(!_0x28ca96){_0x1b6b3a[_0x6a63('0x21')](0x194);}return _0x28ca96;};}function handleError(_0x51f5db,_0x34a43b){_0x34a43b=_0x34a43b||0x1f4;return function(_0x5328b7){logger[_0x6a63('0x1c')](_0x5328b7[_0x6a63('0x3b')]);if(_0x5328b7['name']){delete _0x5328b7[_0x6a63('0x38')];}_0x51f5db[_0x6a63('0x27')](_0x34a43b)[_0x6a63('0x3c')](_0x5328b7);};}exports[_0x6a63('0x3d')]=function(_0x25df7b,_0x292d0e){var _0x27888e={},_0x315b40={'count':0x0,'rows':[]};var _0x5b45d5=_(db[_0x6a63('0x3e')][_0x6a63('0x3f')])['map'](function(_0x2bcee6){return{'name':_0x2bcee6[_0x6a63('0x40')],'type':_0x2bcee6[_0x6a63('0x41')]['key']};})[_0x6a63('0x34')](function(_0x28060a){return!_[_0x6a63('0x36')]([_0x6a63('0x42'),'salt'],_0x28060a[_0x6a63('0x38')]);})[_0x6a63('0x35')]();_0x27888e=qs['getOptions'](_0x5b45d5,_0x25df7b);var _0x590777={'where':_0x27888e[_0x6a63('0x43')]};return db['User'][_0x6a63('0x26')](_0x590777)[_0x6a63('0x16')](function(_0x344bbe){_0x315b40[_0x6a63('0x26')]=_0x344bbe;if(_0x25df7b[_0x6a63('0x44')][_0x6a63('0x45')]){_0x27888e['include']=[{'all':!![]}];}if(_0x25df7b[_0x6a63('0x44')]['userSetting']===_0x6a63('0x46')){_0x27888e['include']=[{'model':db[_0x6a63('0x47')],'as':_0x6a63('0x48')}];}if(!_[_0x6a63('0x36')](_0x27888e[_0x6a63('0x49')],'id')){_0x27888e[_0x6a63('0x49')][_0x6a63('0x4a')]('id');}return db['User'][_0x6a63('0x4b')](_0x27888e);})[_0x6a63('0x16')](function(_0x1dc950){_0x315b40[_0x6a63('0x4c')]=_0x1dc950;if(_0x25df7b[_0x6a63('0x44')][_0x6a63('0x4d')]==='true'){var _0x526bff=[];for(var _0x2dc519=0x0;_0x2dc519<_0x315b40[_0x6a63('0x4c')][_0x6a63('0x4e')];_0x2dc519++){_0x526bff[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x4f'),_0x315b40[_0x6a63('0x4c')][_0x2dc519]['dataValues']));_0x526bff['push'](get_open_tabs(_0x6a63('0x50'),_0x315b40[_0x6a63('0x4c')][_0x2dc519][_0x6a63('0x51')]));_0x526bff[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x52'),_0x315b40[_0x6a63('0x4c')][_0x2dc519][_0x6a63('0x51')]));_0x526bff[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x53'),_0x315b40[_0x6a63('0x4c')][_0x2dc519][_0x6a63('0x51')]));_0x526bff[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x54'),_0x315b40[_0x6a63('0x4c')][_0x2dc519][_0x6a63('0x51')]));_0x526bff[_0x6a63('0x4a')](get_open_tabs('whatsapp',_0x315b40['rows'][_0x2dc519][_0x6a63('0x51')]));}return BPromise[_0x6a63('0x55')](_0x526bff)[_0x6a63('0x16')](function(){return _0x315b40;});}else{return _0x315b40;}})[_0x6a63('0x16')](respondWithFilteredResult(_0x292d0e,_0x27888e))[_0x6a63('0x20')](handleError(_0x292d0e,null));};exports[_0x6a63('0x56')]=function(_0x108548,_0x33e7f2){var _0x2a71e3={'raw':![],'where':{'id':_0x108548[_0x6a63('0x57')]['id']}},_0x4d76fa={};_0x4d76fa[_0x6a63('0x58')]=_[_0x6a63('0x59')](_['keys'](db[_0x6a63('0x3e')]['rawAttributes']),[_0x6a63('0x42'),_0x6a63('0x5a')]);_0x4d76fa[_0x6a63('0x44')]=_['keys'](_0x108548[_0x6a63('0x44')]);_0x4d76fa['filters']=_[_0x6a63('0x5b')](_0x4d76fa[_0x6a63('0x58')],_0x4d76fa[_0x6a63('0x44')]);_0x2a71e3[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x4d76fa['model'],qs['fields'](_0x108548[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x2a71e3[_0x6a63('0x49')]=_0x2a71e3[_0x6a63('0x49')]['length']?_0x2a71e3[_0x6a63('0x49')]:_0x4d76fa['model'];if(_0x108548[_0x6a63('0x44')][_0x6a63('0x45')]){_0x2a71e3[_0x6a63('0x5d')]=[{'all':!![]}];}if(_0x108548[_0x6a63('0x44')]['userSetting']===_0x6a63('0x46')){_0x2a71e3[_0x6a63('0x5d')]=[{'model':db['UserSetting'],'as':_0x6a63('0x48')}];}_0x2a71e3=_[_0x6a63('0x5e')]({},_0x2a71e3,_0x108548[_0x6a63('0x5f')]);if(!_['includes'](_0x2a71e3[_0x6a63('0x49')],'id')){_0x2a71e3[_0x6a63('0x49')][_0x6a63('0x4a')]('id');}return db[_0x6a63('0x3e')][_0x6a63('0x37')](_0x2a71e3)[_0x6a63('0x16')](handleEntityNotFound(_0x33e7f2,null))[_0x6a63('0x16')](function(_0x1faa82){var _0x41e3fe=[];values=_0x1faa82;if(_0x108548[_0x6a63('0x44')]['openTabs']===_0x6a63('0x46')){_0x41e3fe[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x4f'),_0x1faa82[_0x6a63('0x51')]));_0x41e3fe[_0x6a63('0x4a')](get_open_tabs('sms',_0x1faa82[_0x6a63('0x51')]));_0x41e3fe[_0x6a63('0x4a')](get_open_tabs('openchannel',_0x1faa82[_0x6a63('0x51')]));_0x41e3fe[_0x6a63('0x4a')](get_open_tabs(_0x6a63('0x60'),_0x1faa82[_0x6a63('0x51')]));_0x41e3fe['push'](get_open_tabs(_0x6a63('0x52'),_0x1faa82[_0x6a63('0x51')]));_0x41e3fe['push'](get_open_tabs('mail',_0x1faa82[_0x6a63('0x51')]));return BPromise[_0x6a63('0x55')](_0x41e3fe);}else{return values;}})[_0x6a63('0x16')](function(){return values;})[_0x6a63('0x16')](respondWithResult(_0x33e7f2,null))['catch'](handleError(_0x33e7f2,null));};exports[_0x6a63('0x2a')]=function(_0x551f6b,_0x5a7d29){if(_0x551f6b[_0x6a63('0x61')]['id']){delete _0x551f6b[_0x6a63('0x61')]['id'];}delete _0x551f6b[_0x6a63('0x61')][_0x6a63('0x2e')];return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x551f6b[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x5a7d29,null))[_0x6a63('0x16')](saveUpdates(_0x551f6b[_0x6a63('0x61')],null))['then'](respondWithResult(_0x5a7d29,null))[_0x6a63('0x20')](handleError(_0x5a7d29,null));};exports[_0x6a63('0x62')]=function(_0x1505f1,_0x1dab3a){return db[_0x6a63('0x3e')]['describe']()['then'](respondWithResult(_0x1dab3a,null))[_0x6a63('0x20')](handleError(_0x1dab3a,null));};exports[_0x6a63('0x63')]=function(_0x306e8f,_0x43db2f){return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x306e8f[_0x6a63('0x57')]['id']}})['then'](handleEntityNotFound(_0x43db2f,null))[_0x6a63('0x16')](function(_0x1e470d){if(_0x1e470d){return _0x1e470d[_0x6a63('0x63')](_0x306e8f['body'][_0x6a63('0x64')],_['omit'](_0x306e8f[_0x6a63('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x43db2f,null))[_0x6a63('0x20')](handleError(_0x43db2f,null));};function validateUser(_0x5b970b){return new BPromise(function(_0x1e1bec,_0x18575d){if(_0x5b970b[_0x6a63('0x65')])return _0x1e1bec(_0x5b970b);return db[_0x6a63('0x66')][_0x6a63('0x67')](0x1)[_0x6a63('0x16')](function(_0x442848){if(_0x442848[_0x6a63('0x68')])authService[_0x6a63('0x69')](_0x5b970b[_0x6a63('0x42')]);db[_0x6a63('0x3e')][_0x6a63('0x6a')]('internal')[_0x6a63('0x16')](function(_0x588583){if(_[_0x6a63('0x6b')](_0x588583)){_0x5b970b['internal']=_0x442848['min_internal']||0x1;return;}if(_[_0x6a63('0x6b')](_0x442848[_0x6a63('0x6c')])||_0x442848[_0x6a63('0x6c')]===_0x588583){_0x5b970b['internal']=_0x588583+0x1;return;}if(_0x442848['min_internal']>_0x588583){_0x5b970b[_0x6a63('0x65')]=_0x442848[_0x6a63('0x6c')];return;}return db[_0x6a63('0x6d')][_0x6a63('0x44')](_0x6a63('0x6e'),{'type':db[_0x6a63('0x6d')][_0x6a63('0x6f')][_0x6a63('0x70')]})[_0x6a63('0x16')](function(_0xe4ad8a){if(_0xe4ad8a&&_0xe4ad8a['length']){for(var _0x43cb69=0x0,_0x5351b8=_0xe4ad8a['length'];_0x43cb69<_0x5351b8&&_[_0x6a63('0x6b')](_0x5b970b['internal']);_0x43cb69++){if(_0x442848[_0x6a63('0x6c')]<=_0xe4ad8a[_0x43cb69][_0x6a63('0x71')]){_0x5b970b[_0x6a63('0x65')]=_0xe4ad8a[_0x43cb69][_0x6a63('0x71')];}else if(_0x442848['min_internal']>_0xe4ad8a[_0x43cb69][_0x6a63('0x71')]&&_0x442848[_0x6a63('0x6c')]<=_0xe4ad8a[_0x43cb69]['to']){_0x5b970b[_0x6a63('0x65')]=_0x442848[_0x6a63('0x6c')];}}}if(_[_0x6a63('0x6b')](_0x5b970b[_0x6a63('0x65')])){_0x5b970b['internal']=_0x588583+0x1;}return _0x1e1bec(_0x5b970b);});});})[_0x6a63('0x20')](function(_0x161a4f){_0x18575d(_0x161a4f);});});}function updateUser(_0x5146a6){return new BPromise(function(_0x4f9904,_0x36b268){try{if(_0x5146a6[_0x6a63('0x72')]){_0x5146a6[_0x6a63('0x73')]=_0x5146a6[_0x6a63('0x65')];_0x5146a6[_0x6a63('0x74')]={'mailbox':_0x5146a6[_0x6a63('0x65')],'password':_0x5146a6[_0x6a63('0x42')],'fullname':_0x5146a6[_0x6a63('0x75')],'email':_0x5146a6[_0x6a63('0x76')]};}if(_0x5146a6['role']===_0x6a63('0x77')){if(!_0x5146a6[_0x6a63('0x78')])_0x5146a6['permissions']=[_0x6a63('0x79'),_0x6a63('0x7a'),_0x6a63('0x7b'),_0x6a63('0x7c'),_0x6a63('0x7d'),'104',_0x6a63('0x7e'),_0x6a63('0x7f'),_0x6a63('0x80'),_0x6a63('0x81'),_0x6a63('0x82'),'100',_0x6a63('0x83'),_0x6a63('0x84'),_0x6a63('0x85')];}_0x4f9904(_0x5146a6);}catch(_0x24797a){_0x36b268(_0x24797a);}});}exports[_0x6a63('0x86')]=function(_0x253b77,_0x45487e){if(_0x253b77[_0x6a63('0x87')][_0x6a63('0x2e')]==='agent')throw new Error(_0x6a63('0x88'));if(_0x253b77['body'][_0x6a63('0x2e')]===_0x6a63('0x87')&&_0x253b77[_0x6a63('0x87')][_0x6a63('0x2e')]!==_0x6a63('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x253b77[_0x6a63('0x61')][_0x6a63('0x2e')]==='admin'&&_0x253b77[_0x6a63('0x87')][_0x6a63('0x2e')]!==_0x6a63('0x2f')){throw new Error(_0x6a63('0x89'));}return licenseUtil[_0x6a63('0x8a')]([_0x253b77[_0x6a63('0x61')]])[_0x6a63('0x16')](function(){return validateUser(_0x253b77[_0x6a63('0x61')]);})['then'](function(_0x47d861){return updateUser(_0x47d861)[_0x6a63('0x16')](function(_0x273293){if(_0x273293[_0x6a63('0x2e')]==='admin'){_0x273293['settingsEnabled']=_0x253b77[_0x6a63('0x87')][_0x6a63('0x8b')];delete _0x273293[_0x6a63('0x8c')];}return _0x273293;});})[_0x6a63('0x16')](function(_0x589955){return db['User'][_0x6a63('0x86')](_0x589955,{'include':[{'model':db[_0x6a63('0x74')],'as':_0x6a63('0x74')}]});})[_0x6a63('0x16')](function(_0xa7d810){if(_0x253b77[_0x6a63('0x61')][_0x6a63('0x2e')]==='user')return _0xa7d810;if(_0x253b77[_0x6a63('0x87')][_0x6a63('0x2e')]!==_0x6a63('0x87'))return _0xa7d810;return db[_0x6a63('0x8d')][_0x6a63('0x37')]({'where':{'name':_0xa7d810['role']===_0x6a63('0x77')?_0x6a63('0x31'):_0x6a63('0x32'),'userProfileId':_0x253b77['user']['userProfileId']},'raw':!![]})[_0x6a63('0x16')](function(_0x1d15ba){if(!_0x1d15ba||_0x1d15ba[_0x6a63('0x8e')]!=0x0)return _0xa7d810;return db[_0x6a63('0x39')][_0x6a63('0x86')]({'name':_0xa7d810['name'],'resourceId':_0xa7d810['id'],'type':_0x1d15ba['name'],'sectionId':_0x1d15ba['id']},{})[_0x6a63('0x16')](function(){return _0xa7d810;});})['catch'](function(_0x171ce4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x171ce4);throw _0x171ce4;});})['then'](respondWithResult(_0x45487e,0xc9))[_0x6a63('0x20')](handleError(_0x45487e,null));};exports[_0x6a63('0x8f')]=function(_0xa84907,_0x5330a4){var _0x34e8f1=_0xa84907[_0x6a63('0x61')];var _0x9afbde=[];if(_0xa84907[_0x6a63('0x87')][_0x6a63('0x2e')]===_0x6a63('0x77'))throw new Error(_0x6a63('0x88'));if(_[_0x6a63('0x90')](_0x34e8f1,[_0x6a63('0x2e'),'user'])&&_0xa84907['user']['role']!=='admin'){throw new Error(_0x6a63('0x91'));}if(_[_0x6a63('0x90')](_0x34e8f1,[_0x6a63('0x2e'),_0x6a63('0x2f')])&&_0xa84907[_0x6a63('0x87')][_0x6a63('0x2e')]!=='admin'){throw new Error(_0x6a63('0x92'));}return licenseUtil['checkUserLimits'](_0x34e8f1)[_0x6a63('0x16')](function(){return validateUser(_0x34e8f1[0x0]);})[_0x6a63('0x16')](function(){for(var _0x1db9f0=0x1;_0x1db9f0<_0x34e8f1[_0x6a63('0x4e')];_0x1db9f0++){var _0x22ee0c=_0x34e8f1[_0x1db9f0-0x1][_0x6a63('0x65')];if(!_0x34e8f1[_0x1db9f0]['internal'])_0x34e8f1[_0x1db9f0][_0x6a63('0x65')]=_0x22ee0c+0x1;_0x9afbde['push'](validateUser(_0x34e8f1[_0x1db9f0]));}return BPromise[_0x6a63('0x55')](_0x9afbde);})['then'](function(){_0x9afbde=[];for(var _0x53a2fb=0x0;_0x53a2fb<_0x34e8f1[_0x6a63('0x4e')];_0x53a2fb++){_0x9afbde[_0x6a63('0x4a')](updateUser(_0x34e8f1[_0x53a2fb]));}return BPromise['all'](_0x9afbde);})[_0x6a63('0x16')](function(){return BPromise[_0x6a63('0x93')](_0x34e8f1,function(_0x54f468){return db[_0x6a63('0x3e')][_0x6a63('0x86')](_0x54f468,{'include':[{'model':db['VoiceMail'],'as':_0x6a63('0x74')}]})[_0x6a63('0x16')](function(_0x1574d7){_0x54f468['id']=_0x1574d7['id'];return _0x54f468;});});})['then'](function(_0x50b8cf){if(_0xa84907[_0x6a63('0x61')][_0x6a63('0x2e')]==='user')return _0x50b8cf;if(_0xa84907[_0x6a63('0x87')][_0x6a63('0x2e')]!==_0x6a63('0x87'))return _0x50b8cf;var _0x9c2c9a=_['some'](_0x50b8cf,function(_0x1e98b9){return _0x1e98b9['role']===_0x6a63('0x77')||_0x1e98b9[_0x6a63('0x2e')]==='telephone';});if(!_0x9c2c9a)return _0x50b8cf;return db[_0x6a63('0x8d')][_0x6a63('0x4b')]({'where':{'name':{'$or':[_0x6a63('0x31'),'Telephones']},'userProfileId':_0xa84907[_0x6a63('0x87')][_0x6a63('0x8c')]},'raw':!![]})[_0x6a63('0x16')](function(_0xb00f19){if(_['isEmpty'](_0xb00f19)||!_[_0x6a63('0x90')](_0xb00f19,[_0x6a63('0x8e'),0x0]))return _0x50b8cf;_0x9afbde=[];var _0x1f4de3=_(_0xb00f19)['map'](function(_0x29ad55){if(_0x29ad55[_0x6a63('0x8e')]===0x1)return;return _0x29ad55[_0x6a63('0x38')]===_0x6a63('0x31')?_0x6a63('0x77'):_0x6a63('0x33');})[_0x6a63('0x94')]()[_0x6a63('0x35')]();for(var _0x363e52=0x0;_0x363e52<_0x50b8cf[_0x6a63('0x4e')];_0x363e52++){if(!_[_0x6a63('0x36')](_0x1f4de3,_0x50b8cf[_0x363e52][_0x6a63('0x2e')]))return;var _0x3db537=_0x50b8cf[_0x363e52]['role']==='agent'?_0x6a63('0x31'):_0x6a63('0x32');_0x9afbde['push'](db[_0x6a63('0x39')]['create']({'name':_0x50b8cf[_0x363e52][_0x6a63('0x38')],'resourceId':_0x50b8cf[_0x363e52]['id'],'type':_0x3db537,'sectionId':_[_0x6a63('0x37')](_0xb00f19,[_0x6a63('0x38'),_0x3db537])['id']},{}));}return BPromise[_0x6a63('0x55')](_0x9afbde);});})[_0x6a63('0x16')](respondWithResult(_0x5330a4,0xc9))[_0x6a63('0x20')](handleError(_0x5330a4,null));};exports['changePassword']=function(_0x4064fd,_0x170ff4){if(_0x4064fd[_0x6a63('0x61')]['id']){delete _0x4064fd[_0x6a63('0x61')]['id'];}return db[_0x6a63('0x3e')]['find']({'where':{'id':_0x4064fd[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](function(_0x183bb2){if(!_0x183bb2)return null;if(_0x183bb2['id']===_0x4064fd['user']['id']){if(!_0x4064fd[_0x6a63('0x61')][_0x6a63('0x95')]||!_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')]){throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x183bb2[_0x6a63('0x99')](_0x4064fd[_0x6a63('0x61')][_0x6a63('0x95')])){throw new db['Sequelize'][(_0x6a63('0x98'))](_0x6a63('0x9a'));}if(_0x4064fd['body'][_0x6a63('0x95')]===_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')]){throw new db[(_0x6a63('0x97'))]['ValidationError'](_0x6a63('0x9b'));}}else if(_0x4064fd[_0x6a63('0x87')][_0x6a63('0x2e')]==='admin'){if(!_0x4064fd['body'][_0x6a63('0x96')]){throw new db['Sequelize'][(_0x6a63('0x98'))](_0x6a63('0x9c'));}}else if(_0x4064fd[_0x6a63('0x87')][_0x6a63('0x2e')]==='user'){if(!_0x4064fd[_0x6a63('0x61')]['newPassword']){throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))](_0x6a63('0x9c'));}if(_0x183bb2['role']!==_0x6a63('0x77')){throw new db[(_0x6a63('0x97'))]['ValidationError'](_0x6a63('0x88'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x183bb2;})[_0x6a63('0x16')](handleEntityNotFound(_0x170ff4,null))[_0x6a63('0x16')](function(_0x3b75a3){return db[_0x6a63('0x66')][_0x6a63('0x9d')]({'attributes':['id',_0x6a63('0x68'),_0x6a63('0x9e'),_0x6a63('0x9f')]})['then'](function(_0x110b7c){if(_0x110b7c[_0x6a63('0x68')])authService[_0x6a63('0x69')](_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')]);if(!_0x110b7c[_0x6a63('0x9e')]||!_0x3b75a3[_0x6a63('0xa0')])return _0x3b75a3;authService[_0x6a63('0xa1')](_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')],_0x3b75a3[_0x6a63('0xa0')],_0x110b7c['passwordHistoryLimit']);return _0x3b75a3;})[_0x6a63('0x16')](saveUpdates({'password':_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')],'passwordResetAt':_0x4064fd[_0x6a63('0x87')]['id']==_0x4064fd['params']['id']?moment():null,'previousPasswords':authService[_0x6a63('0xa2')](_0x4064fd[_0x6a63('0x61')][_0x6a63('0x96')],_0x3b75a3['previousPasswords'])},null));})['then'](respondWithResult(_0x170ff4,null))[_0x6a63('0x20')](handleError(_0x170ff4,null));};exports[_0x6a63('0xa3')]=function(_0x34275c,_0xb77a29){var _0x2f5c8e=_0x34275c[_0x6a63('0x61')][_0x6a63('0xa4')];return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x34275c[_0x6a63('0x57')]['id']},'attributes':['id',_0x6a63('0x38'),'role',_0x6a63('0xa5'),_0x6a63('0xa6'),_0x6a63('0xa7'),'interface']})[_0x6a63('0x16')](handleEntityNotFound(_0xb77a29,null))[_0x6a63('0x16')](function(_0x48ae58){if(_0x48ae58){if(!utils['isValidChannel'](_0x2f5c8e)){throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))](_0x6a63('0xa8'));}return _0x48ae58['add'+_['capitalize'](_0x2f5c8e[_0x6a63('0xa9')]())+_0x6a63('0xaa')](_0x34275c[_0x6a63('0x61')][_0x6a63('0x64')],{'penalty':_0x34275c[_0x6a63('0x61')][_0x6a63('0xab')]||0x0})[_0x6a63('0xac')](function(_0xbea4e3){for(var _0x2c61da=0x0;_0x2c61da<_0x34275c[_0x6a63('0x61')][_0x6a63('0x64')][_0x6a63('0x4e')];_0x2c61da+=0x1){var _0x5dcf5b={'UserId':Number(_0x34275c[_0x6a63('0x57')]['id'])};_0x5dcf5b[_[_0x6a63('0xad')](_0x2f5c8e[_0x6a63('0xa9')]())+_0x6a63('0xae')]=Number(_0x34275c['body']['ids'][_0x2c61da]);socket[_0x6a63('0x2b')](_0x6a63('0x87')+_[_0x6a63('0xad')](_0x2f5c8e[_0x6a63('0xa9')]())+_0x6a63('0xaf'),_0x5dcf5b);}return _0xbea4e3;})[_0x6a63('0x16')](function(){if(_0x2f5c8e===_0x6a63('0xb0')){return db[_0x6a63('0xb1')][_0x6a63('0x4b')]({'where':{'id':_0x34275c[_0x6a63('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x6a63('0x38')]});}})[_0x6a63('0x16')](function(_0x2851e1){var _0x867249=_0x48ae58['get']({'plain':!![]});var _0x1ced65=[];if(_0x2f5c8e==='voice'&&_0x867249[_0x6a63('0x2e')]===_0x6a63('0x77')&&_0x867249['online']){for(var _0xb47aeb=0x0;_0xb47aeb<_0x2851e1[_0x6a63('0x4e')];_0xb47aeb+=0x1){_0x1ced65[_0x6a63('0x4a')]({'membername':_0x867249[_0x6a63('0x38')],'UserId':_0x867249['id'],'queue_name':_0x2851e1[_0xb47aeb][_0x6a63('0x38')],'VoiceQueueId':_0x2851e1[_0xb47aeb]['id'],'interface':_[_0x6a63('0x6b')](_0x867249[_0x6a63('0xb2')])?util[_0x6a63('0xb3')](_0x6a63('0xb4'),_0x867249[_0x6a63('0x38')]):_0x867249['interface'],'paused':_0x867249['voicePause']||![],'penalty':_0x34275c[_0x6a63('0x61')][_0x6a63('0xab')]||0x0});}return BPromise[_0x6a63('0x93')](_0x1ced65,function(_0x4ccb12){return db['UserVoiceQueueRt'][_0x6a63('0xb5')](_0x4ccb12);});}return _0x48ae58;});}})[_0x6a63('0x16')](respondWithStatusCode(_0xb77a29,null))[_0x6a63('0x20')](handleError(_0xb77a29,null));};exports[_0x6a63('0xb6')]=function(_0x6322f4,_0x153b79){var _0x300cf1,_0x4dc71e;return db['User'][_0x6a63('0x37')]({'where':{'id':_0x6322f4['params']['id']},'attributes':['id',_0x6a63('0x38'),'role']})[_0x6a63('0x16')](handleEntityNotFound(_0x153b79,null))[_0x6a63('0x16')](function(_0x25fdeb){if(_0x25fdeb){_0x300cf1=_0x25fdeb;if(!_0x6322f4[_0x6a63('0x44')][_0x6a63('0xa4')]||!utils[_0x6a63('0xb7')](_0x6322f4[_0x6a63('0x44')][_0x6a63('0xa4')])){throw new db['Sequelize'][(_0x6a63('0x98'))](_0x6a63('0xa8'));}return _0x25fdeb['remove'+_[_0x6a63('0xad')](_0x6322f4['query'][_0x6a63('0xa4')][_0x6a63('0xa9')]())+_0x6a63('0xaa')](_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')]);}})[_0x6a63('0x16')](function(_0x416d69){if(_[_0x6a63('0xb8')](_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')])){for(var _0x58e1f8=0x0;_0x58e1f8<_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')]['length'];_0x58e1f8+=0x1){_0x4dc71e={'UserId':Number(_0x6322f4[_0x6a63('0x57')]['id'])};_0x4dc71e[_['capitalize'](_0x6322f4[_0x6a63('0x44')][_0x6a63('0xa4')][_0x6a63('0xa9')]())+_0x6a63('0xae')]=Number(_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')][_0x58e1f8]);socket[_0x6a63('0x2b')](_0x6a63('0x87')+_['capitalize'](_0x6322f4[_0x6a63('0x44')][_0x6a63('0xa4')]['toLowerCase']())+_0x6a63('0xb9'),_0x4dc71e);}}else{_0x4dc71e={'UserId':Number(_0x6322f4[_0x6a63('0x57')]['id'])};_0x4dc71e[_[_0x6a63('0xad')](_0x6322f4[_0x6a63('0x44')]['channel'][_0x6a63('0xa9')]())+_0x6a63('0xae')]=Number(_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')]);socket[_0x6a63('0x2b')](_0x6a63('0x87')+_[_0x6a63('0xad')](_0x6322f4[_0x6a63('0x44')][_0x6a63('0xa4')]['toLowerCase']())+'Queue:remove',_0x4dc71e);}return _0x416d69;})[_0x6a63('0x16')](function(){if(_0x6322f4['query'][_0x6a63('0xa4')]===_0x6a63('0xb0')){return db[_0x6a63('0xba')]['destroy']({'where':{'UserId':_0x6322f4[_0x6a63('0x57')]['id'],'VoiceQueueId':_0x6322f4[_0x6a63('0x44')][_0x6a63('0x64')]},'individualHooks':!![]})['then'](function(){return _0x300cf1;});}return _0x300cf1;})[_0x6a63('0x16')](respondWithStatusCode(_0x153b79,null))[_0x6a63('0x20')](handleError(_0x153b79,null));};exports[_0x6a63('0xbb')]=function(_0x8924b4,_0x1d8469){_0x8924b4[_0x6a63('0x61')][_0x6a63('0xbc')]=_0x8924b4[_0x6a63('0xbd')]['filename'];return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x8924b4[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x1d8469,null))[_0x6a63('0x16')](saveUpdates(_0x8924b4[_0x6a63('0x61')],null))[_0x6a63('0x16')](respondWithResult(_0x1d8469,null))[_0x6a63('0x20')](handleError(_0x1d8469,null));};exports[_0x6a63('0xbe')]=function(_0x55aab3,_0x413ebc){var _0x5996f7=path['join'](config[_0x6a63('0xbf')],_0x6a63('0xc0'));return db['User']['find']({'where':{'id':_0x55aab3[_0x6a63('0x57')]['id']},'attributes':['id',_0x6a63('0xbc')],'raw':!![]})[_0x6a63('0x16')](handleEntityNotFound(_0x413ebc,null))[_0x6a63('0x16')](function(_0x12886c){if(_0x12886c){if(_[_0x6a63('0x6b')](_0x12886c['userpic'])){return _0x413ebc[_0x6a63('0xc1')](_0x5996f7);}else{if(!fs['existsSync'](path[_0x6a63('0xc2')](config[_0x6a63('0xbf')],_0x6a63('0xc3'),_0x12886c[_0x6a63('0xbc')]))){return _0x413ebc['download'](_0x5996f7);}return _0x413ebc[_0x6a63('0xc1')](path[_0x6a63('0xc2')](config[_0x6a63('0xbf')],'server/files/images/',_0x12886c['userpic']));}}})['catch'](handleError(_0x413ebc,null));};exports['getOpenTabs']=function(_0x4bb3ee,_0x124d3e){return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x4bb3ee['params']['id']},'attributes':['id']})[_0x6a63('0x16')](handleEntityNotFound(_0x124d3e,null))[_0x6a63('0x16')](function(_0x1b9791){var _0x656037=[];values=_0x1b9791['dataValues'];_0x656037[_0x6a63('0x4a')](get_open_tabs('chat',_0x1b9791[_0x6a63('0x51')]));_0x656037[_0x6a63('0x4a')](get_open_tabs('sms',_0x1b9791[_0x6a63('0x51')]));_0x656037['push'](get_open_tabs('openchannel',_0x1b9791[_0x6a63('0x51')]));_0x656037[_0x6a63('0x4a')](get_open_tabs('whatsapp',_0x1b9791[_0x6a63('0x51')]));_0x656037[_0x6a63('0x4a')](get_open_tabs('fax',_0x1b9791['dataValues']));_0x656037[_0x6a63('0x4a')](get_open_tabs('mail',_0x1b9791[_0x6a63('0x51')]));return BPromise[_0x6a63('0x55')](_0x656037);})[_0x6a63('0x16')](function(_0x184189){if(_0x184189){var _0x8d7e03=_['map'](values['ChatOpenTabs'],function(_0x335258){return{'channel':'CHAT','id':_0x335258['id'],'createdAt':_0x335258[_0x6a63('0xc4')]};});var _0x83115b=_[_0x6a63('0xc5')](values[_0x6a63('0xc6')],function(_0x41660a){return{'channel':_0x6a63('0xc7'),'id':_0x41660a['id'],'createdAt':_0x41660a[_0x6a63('0xc4')]};});var _0x3c25b3=_[_0x6a63('0xc5')](values[_0x6a63('0xc8')],function(_0x11ee44){return{'channel':_0x6a63('0xc9'),'id':_0x11ee44['id'],'createdAt':_0x11ee44[_0x6a63('0xc4')]};});var _0x324d23=_['map'](values[_0x6a63('0xca')],function(_0x249a8b){return{'channel':_0x6a63('0xcb'),'id':_0x249a8b['id'],'createdAt':_0x249a8b[_0x6a63('0xc4')]};});var _0x186bc7=_[_0x6a63('0xc5')](values['SmsOpenTabs'],function(_0x5bdfab){return{'channel':_0x6a63('0xcc'),'id':_0x5bdfab['id'],'createdAt':_0x5bdfab['createdAt']};});var _0x538215=_[_0x6a63('0xc5')](values[_0x6a63('0xcd')],function(_0x1f3b3b){return{'channel':_0x6a63('0xce'),'id':_0x1f3b3b['id'],'createdAt':_0x1f3b3b[_0x6a63('0xc4')]};});var _0x5a8f7d=_[_0x6a63('0xcf')](_0x8d7e03,_0x83115b,_0x3c25b3,_0x324d23,_0x186bc7,_0x538215);var _0xca81bd={'count':_0x5a8f7d[_0x6a63('0x4e')],'rows':_0x5a8f7d};return _0xca81bd;}else return null;})[_0x6a63('0x16')](respondWithResult(_0x124d3e,null))[_0x6a63('0x20')](handleError(_0x124d3e,null));};exports[_0x6a63('0xd0')]=function(_0x10f1cd,_0x47b236){var _0x5343d2={};var _0x57ace1={};var _0x49b8b7;var _0x590236;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x10f1cd[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x47b236,null))[_0x6a63('0x16')](function(_0x532edf){if(_0x532edf){_0x49b8b7=_0x532edf;_0x57ace1['model']=_[_0x6a63('0xd1')](db[_0x6a63('0xd2')][_0x6a63('0x3f')]);_0x57ace1[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x10f1cd[_0x6a63('0x44')]);_0x57ace1[_0x6a63('0xd3')]=_['intersection'](_0x57ace1[_0x6a63('0x58')],_0x57ace1['query']);_0x5343d2[_0x6a63('0x49')]=_['intersection'](_0x57ace1[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x10f1cd['query'][_0x6a63('0x5c')]));_0x5343d2[_0x6a63('0x49')]=_0x5343d2['attributes'][_0x6a63('0x4e')]?_0x5343d2[_0x6a63('0x49')]:_0x57ace1[_0x6a63('0x58')];_0x5343d2[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x10f1cd[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x5343d2['where']=qs['filters'](_[_0x6a63('0xd6')](_0x10f1cd[_0x6a63('0x44')],_0x57ace1[_0x6a63('0xd3')]));if(_0x10f1cd[_0x6a63('0x44')][_0x6a63('0x34')]){_0x5343d2[_0x6a63('0x43')]=_['merge'](_0x5343d2[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x5343d2['attributes'],function(_0x5f2bd2){var _0xbd9904={};_0xbd9904[_0x5f2bd2]={'$like':'%'+_0x10f1cd['query']['filter']+'%'};return _0xbd9904;})});}_0x5343d2=_[_0x6a63('0x5e')]({},_0x5343d2,_0x10f1cd[_0x6a63('0x5f')]);return _0x49b8b7[_0x6a63('0xd0')](_0x5343d2);}})[_0x6a63('0x16')](function(_0x542c4b){if(_0x542c4b){_0x590236=_0x542c4b[_0x6a63('0x4e')];if(_0x10f1cd[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0x45'))){_0x5343d2[_0x6a63('0x5d')]=[{'model':db[_0x6a63('0xd8')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x6a63('0xd9'),'attributes':['id',_0x6a63('0x38'),'color'],'where':_0x10f1cd['query'][_0x6a63('0xda')]?{'id':_0x10f1cd[_0x6a63('0x44')]['tag']}:undefined,'required':_0x10f1cd[_0x6a63('0x44')][_0x6a63('0xda')]?!![]:![]}];}if(!_0x10f1cd[_0x6a63('0x44')]['hasOwnProperty'](_0x6a63('0xdb'))){_0x5343d2['limit']=qs[_0x6a63('0x24')](_0x10f1cd[_0x6a63('0x44')][_0x6a63('0x24')]);_0x5343d2['offset']=qs[_0x6a63('0x23')](_0x10f1cd['query'][_0x6a63('0x23')]);}return _0x49b8b7[_0x6a63('0xd0')](_0x5343d2);}})['then'](function(_0x5c2aea){if(_0x5c2aea){return _0x5c2aea?{'count':_0x590236,'rows':_0x5c2aea}:null;}})[_0x6a63('0x16')](respondWithResult(_0x47b236,null))[_0x6a63('0x20')](handleError(_0x47b236,null));};exports[_0x6a63('0xdc')]=function(_0x4cf182,_0x415c7c){var _0x531c17;var _0x2e4155={};var _0x1ed979;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x4cf182[_0x6a63('0x57')]['id']},'attributes':['id',_0x6a63('0x38'),_0x6a63('0x2e')]})[_0x6a63('0x16')](handleEntityNotFound(_0x415c7c,null))[_0x6a63('0x16')](function(_0x987d71){if(!utils[_0x6a63('0xb7')](_0x4cf182['query'][_0x6a63('0xa4')])){throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))](_0x6a63('0xa8'));}_0x531c17=_0x987d71;var _0x47a8af={};_0x47a8af[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_['capitalize'](_0x4cf182[_0x6a63('0x44')][_0x6a63('0xa4')])+_0x6a63('0xdd')][_0x6a63('0x3f')]);_0x47a8af[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x4cf182['query']);_0x47a8af[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x47a8af[_0x6a63('0x58')],_0x47a8af['query']);_0x2e4155[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x47a8af[_0x6a63('0x58')],qs['fields'](_0x4cf182[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x2e4155[_0x6a63('0x49')]=_0x2e4155[_0x6a63('0x49')][_0x6a63('0x4e')]?_0x2e4155[_0x6a63('0x49')]:_0x47a8af[_0x6a63('0x58')];_0x2e4155[_0x6a63('0xd4')]=qs['sort'](_0x4cf182['query']['sort']);_0x2e4155[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_['pick'](_0x4cf182['query'],_0x47a8af['filters']));if(_0x4cf182[_0x6a63('0x44')][_0x6a63('0x34')]){_0x2e4155['where']=_[_0x6a63('0x5e')](_0x2e4155[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x2e4155['attributes'],function(_0x48a05b){var _0x5b913b={};_0x5b913b[_0x48a05b]={'$like':'%'+_0x4cf182[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x5b913b;})});}_0x2e4155=_[_0x6a63('0x5e')]({},_0x2e4155,_0x4cf182[_0x6a63('0x5f')]);switch(_0x531c17['role']){case'admin':return db[_[_0x6a63('0xad')](_0x4cf182[_0x6a63('0x44')][_0x6a63('0xa4')])+_0x6a63('0xdd')][_0x6a63('0x4b')](_0x2e4155);case _0x6a63('0x87'):case _0x6a63('0x77'):return _0x531c17[_0x6a63('0x2d')+_[_0x6a63('0xad')](_0x4cf182[_0x6a63('0x44')]['channel'])+_0x6a63('0xaa')](_0x2e4155);default:throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))]('Unknown\x20role');}})['then'](function(_0x95addc){_0x1ed979=_0x95addc[_0x6a63('0x4e')];if(!_0x4cf182['query'][_0x6a63('0xd7')]('nolimit')){_0x2e4155[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x4cf182[_0x6a63('0x44')][_0x6a63('0x24')]);_0x2e4155[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x4cf182[_0x6a63('0x44')][_0x6a63('0x23')]);}switch(_0x531c17[_0x6a63('0x2e')]){case _0x6a63('0x2f'):return db[_[_0x6a63('0xad')](_0x4cf182[_0x6a63('0x44')][_0x6a63('0xa4')])+_0x6a63('0xdd')][_0x6a63('0x4b')](_0x2e4155);case _0x6a63('0x87'):case _0x6a63('0x77'):return _0x531c17[_0x6a63('0x2d')+_['capitalize'](_0x4cf182[_0x6a63('0x44')][_0x6a63('0xa4')])+'Queues'](_0x2e4155);}})[_0x6a63('0x16')](function(_0x2834d9){return{'count':_0x1ed979,'rows':_0x2834d9};})[_0x6a63('0x16')](respondWithResult(_0x415c7c,null))[_0x6a63('0x20')](handleError(_0x415c7c,null));};exports[_0x6a63('0xde')]=function(_0x5b817c,_0x5c9ae0){var _0x5e3120={};var _0x5acab5={};var _0x5ce61d;var _0x2bc6a1;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x5b817c[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x5c9ae0,null))['then'](function(_0x4f7d3f){if(_0x4f7d3f){_0x5ce61d=_0x4f7d3f;_0x5acab5[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xba')][_0x6a63('0x3f')]);_0x5acab5['query']=_[_0x6a63('0xd1')](_0x5b817c[_0x6a63('0x44')]);_0x5acab5['filters']=_[_0x6a63('0x5b')](_0x5acab5[_0x6a63('0x58')],_0x5acab5[_0x6a63('0x44')]);_0x5e3120[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x5acab5[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x5b817c[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x5e3120[_0x6a63('0x49')]=_0x5e3120[_0x6a63('0x49')][_0x6a63('0x4e')]?_0x5e3120[_0x6a63('0x49')]:_0x5acab5['model'];_0x5e3120[_0x6a63('0xd4')]=qs['sort'](_0x5b817c[_0x6a63('0x44')]['sort']);_0x5e3120[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x5b817c['query'],_0x5acab5[_0x6a63('0xd3')]));if(_0x5b817c[_0x6a63('0x44')]['filter']){_0x5e3120[_0x6a63('0x43')]=_['merge'](_0x5e3120[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x5e3120['attributes'],function(_0x12f961){var _0x18fd2b={};_0x18fd2b[_0x12f961]={'$like':'%'+_0x5b817c[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x18fd2b;})});}_0x5e3120=_['merge']({},_0x5e3120,_0x5b817c['options']);return _0x5ce61d[_0x6a63('0xde')](_0x5e3120);}})[_0x6a63('0x16')](function(_0x1d3e64){if(_0x1d3e64){_0x2bc6a1=_0x1d3e64['length'];if(!_0x5b817c[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x5e3120[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x5b817c['query'][_0x6a63('0x24')]);_0x5e3120[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x5b817c[_0x6a63('0x44')]['offset']);}return _0x5ce61d['getVoiceQueuesRt'](_0x5e3120);}})[_0x6a63('0x16')](function(_0x22ca41){if(_0x22ca41){return _0x22ca41?{'count':_0x2bc6a1,'rows':_0x22ca41}:null;}})['then'](respondWithResult(_0x5c9ae0,null))[_0x6a63('0x20')](handleError(_0x5c9ae0,null));};exports['getGroups']=function(_0x481d4f,_0x50d43a){var _0x4c7ba5={};var _0x25934b={};var _0x1a0e04;var _0xbbd7f6;return db[_0x6a63('0x3e')]['findOne']({'where':{'id':_0x481d4f['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x50d43a,null))[_0x6a63('0x16')](function(_0x4ef2b2){if(_0x4ef2b2){_0x1a0e04=_0x4ef2b2;_0x25934b[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xdf')][_0x6a63('0x3f')]);_0x25934b[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x481d4f[_0x6a63('0x44')]);_0x25934b[_0x6a63('0xd3')]=_['intersection'](_0x25934b['model'],_0x25934b[_0x6a63('0x44')]);_0x4c7ba5[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x25934b['model'],qs[_0x6a63('0x5c')](_0x481d4f[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x4c7ba5[_0x6a63('0x49')]=_0x4c7ba5[_0x6a63('0x49')]['length']?_0x4c7ba5['attributes']:_0x25934b[_0x6a63('0x58')];_0x4c7ba5[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x481d4f[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x4c7ba5[_0x6a63('0x43')]=qs['filters'](_[_0x6a63('0xd6')](_0x481d4f[_0x6a63('0x44')],_0x25934b[_0x6a63('0xd3')]));if(_0x481d4f[_0x6a63('0x44')][_0x6a63('0x34')]){_0x4c7ba5[_0x6a63('0x43')]=_['merge'](_0x4c7ba5[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x4c7ba5['attributes'],function(_0x470cc0){var _0x5e16c3={};_0x5e16c3[_0x470cc0]={'$like':'%'+_0x481d4f['query']['filter']+'%'};return _0x5e16c3;})});}_0x4c7ba5=_[_0x6a63('0x5e')]({},_0x4c7ba5,_0x481d4f['options']);return _0x1a0e04[_0x6a63('0xe0')](_0x4c7ba5);}})[_0x6a63('0x16')](function(_0x1efedb){if(_0x1efedb){_0xbbd7f6=_0x1efedb[_0x6a63('0x4e')];if(!_0x481d4f[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x4c7ba5[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x481d4f['query'][_0x6a63('0x24')]);_0x4c7ba5[_0x6a63('0x23')]=qs['offset'](_0x481d4f['query'][_0x6a63('0x23')]);}return _0x1a0e04[_0x6a63('0xe0')](_0x4c7ba5);}})[_0x6a63('0x16')](function(_0x522306){if(_0x522306){return _0x522306?{'count':_0xbbd7f6,'rows':_0x522306}:null;}})[_0x6a63('0x16')](respondWithResult(_0x50d43a,null))[_0x6a63('0x20')](handleError(_0x50d43a,null));};exports['getRecordings']=function(_0x4490db,_0x2fb4c1){var _0x28829f={'raw':!![],'where':{}};var _0x539d23={};var _0x4e7d4f={'count':0x0,'rows':[]};return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x4490db[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x2fb4c1,null))[_0x6a63('0x16')](function(_0x27741e){if(_0x27741e){_0x539d23[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xe1')][_0x6a63('0x3f')]);_0x539d23[_0x6a63('0x44')]=_['keys'](_0x4490db[_0x6a63('0x44')]);_0x539d23[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x539d23[_0x6a63('0x58')],_0x539d23[_0x6a63('0x44')]);_0x28829f[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x539d23['model'],qs[_0x6a63('0x5c')](_0x4490db[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x28829f[_0x6a63('0x49')]=_0x28829f[_0x6a63('0x49')]['length']?_0x28829f[_0x6a63('0x49')]:_0x539d23[_0x6a63('0x58')];if(!_0x4490db[_0x6a63('0x44')]['hasOwnProperty']('nolimit')){_0x28829f['limit']=qs[_0x6a63('0x24')](_0x4490db[_0x6a63('0x44')][_0x6a63('0x24')]);_0x28829f[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x4490db['query'][_0x6a63('0x23')]);}_0x28829f['order']=qs[_0x6a63('0xd5')](_0x4490db[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x28829f[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x4490db['query'],_0x539d23[_0x6a63('0xd3')]));_0x28829f[_0x6a63('0x43')][_0x6a63('0xe2')]=_0x27741e['id'];if(_0x4490db[_0x6a63('0x44')][_0x6a63('0x34')]){_0x28829f[_0x6a63('0x43')]=_['merge'](_0x28829f[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x28829f[_0x6a63('0x49')],function(_0x3b91b5){var _0x442c2b={};_0x442c2b[_0x3b91b5]={'$like':'%'+_0x4490db[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x442c2b;})});}_0x28829f=_[_0x6a63('0x5e')]({},_0x28829f,_0x4490db[_0x6a63('0x5f')]);return db[_0x6a63('0xe1')]['count']({'where':_0x28829f[_0x6a63('0x43')]})[_0x6a63('0x16')](function(_0x3112ae){_0x4e7d4f['count']=_0x3112ae;if(_0x4490db[_0x6a63('0x44')]['includeAll']){_0x28829f[_0x6a63('0x5d')]=[{'all':!![]}];}return db[_0x6a63('0xe1')][_0x6a63('0x4b')](_0x28829f);})['then'](function(_0x1b1937){_0x4e7d4f['rows']=_0x1b1937;return _0x4e7d4f;});}})[_0x6a63('0x16')](respondWithFilteredResult(_0x2fb4c1,_0x28829f))[_0x6a63('0x20')](handleError(_0x2fb4c1,null));};exports[_0x6a63('0xe3')]=function(_0x202ac5,_0x39e809){var _0xf31612={'raw':!![],'where':{}};var _0x5aad05={};var _0x3f3244={'count':0x0,'rows':[]};return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x202ac5[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x39e809,null))[_0x6a63('0x16')](function(_0x3d8a14){if(_0x3d8a14){_0x5aad05[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xe4')][_0x6a63('0x3f')]);_0x5aad05[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x202ac5[_0x6a63('0x44')]);_0x5aad05['filters']=_['intersection'](_0x5aad05[_0x6a63('0x58')],_0x5aad05[_0x6a63('0x44')]);_0xf31612[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x5aad05['model'],qs[_0x6a63('0x5c')](_0x202ac5[_0x6a63('0x44')][_0x6a63('0x5c')]));_0xf31612[_0x6a63('0x49')]=_0xf31612[_0x6a63('0x49')][_0x6a63('0x4e')]?_0xf31612[_0x6a63('0x49')]:_0x5aad05[_0x6a63('0x58')];if(!_0x202ac5[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0xf31612[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x202ac5[_0x6a63('0x44')][_0x6a63('0x24')]);_0xf31612[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x202ac5['query'][_0x6a63('0x23')]);}_0xf31612[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x202ac5['query'][_0x6a63('0xd5')]);_0xf31612[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_['pick'](_0x202ac5[_0x6a63('0x44')],_0x5aad05[_0x6a63('0xd3')]));_0xf31612[_0x6a63('0x43')][_0x6a63('0xe2')]=_0x3d8a14['id'];if(_0x202ac5[_0x6a63('0x44')]['filter']){_0xf31612[_0x6a63('0x43')]=_['merge'](_0xf31612[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0xf31612[_0x6a63('0x49')],function(_0x7a778f){var _0x1a3974={};_0x1a3974[_0x7a778f]={'$like':'%'+_0x202ac5[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x1a3974;})});}_0xf31612=_[_0x6a63('0x5e')]({},_0xf31612,_0x202ac5[_0x6a63('0x5f')]);return db[_0x6a63('0xe4')][_0x6a63('0x26')]({'where':_0xf31612[_0x6a63('0x43')]})['then'](function(_0x19f1a1){_0x3f3244[_0x6a63('0x26')]=_0x19f1a1;if(_0x202ac5[_0x6a63('0x44')][_0x6a63('0x45')]){_0xf31612[_0x6a63('0x5d')]=[{'all':!![]}];}return db[_0x6a63('0xe4')]['findAll'](_0xf31612);})[_0x6a63('0x16')](function(_0x4d0148){_0x3f3244[_0x6a63('0x4c')]=_0x4d0148;return _0x3f3244;});}})[_0x6a63('0x16')](respondWithFilteredResult(_0x39e809,_0xf31612))[_0x6a63('0x20')](handleError(_0x39e809,null));};exports[_0x6a63('0xe5')]=function(_0x4d4c71,_0x2b465d){var _0x3ecc5c={};var _0x3c879b={};var _0x3457b3;var _0x1c3d70;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x4d4c71['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x2b465d,null))[_0x6a63('0x16')](function(_0x4080cb){if(_0x4080cb){_0x3457b3=_0x4080cb;_0x3c879b[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xe6')][_0x6a63('0x3f')]);_0x3c879b[_0x6a63('0x44')]=_['keys'](_0x4d4c71[_0x6a63('0x44')]);_0x3c879b['filters']=_[_0x6a63('0x5b')](_0x3c879b[_0x6a63('0x58')],_0x3c879b['query']);_0x3ecc5c[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x3c879b[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x4d4c71[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x3ecc5c[_0x6a63('0x49')]=_0x3ecc5c[_0x6a63('0x49')][_0x6a63('0x4e')]?_0x3ecc5c['attributes']:_0x3c879b['model'];_0x3ecc5c[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x4d4c71[_0x6a63('0x44')]['sort']);_0x3ecc5c[_0x6a63('0x43')]=qs['filters'](_[_0x6a63('0xd6')](_0x4d4c71[_0x6a63('0x44')],_0x3c879b[_0x6a63('0xd3')]));if(_0x4d4c71[_0x6a63('0x44')]['filter']){_0x3ecc5c['where']=_[_0x6a63('0x5e')](_0x3ecc5c[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x3ecc5c[_0x6a63('0x49')],function(_0x492ced){var _0x558145={};_0x558145[_0x492ced]={'$like':'%'+_0x4d4c71[_0x6a63('0x44')]['filter']+'%'};return _0x558145;})});}_0x3ecc5c=_[_0x6a63('0x5e')]({},_0x3ecc5c,_0x4d4c71[_0x6a63('0x5f')]);return _0x3457b3[_0x6a63('0xe5')](_0x3ecc5c);}})[_0x6a63('0x16')](function(_0x2ea078){if(_0x2ea078){_0x1c3d70=_0x2ea078[_0x6a63('0x4e')];if(!_0x4d4c71[_0x6a63('0x44')][_0x6a63('0xd7')]('nolimit')){_0x3ecc5c[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x4d4c71[_0x6a63('0x44')][_0x6a63('0x24')]);_0x3ecc5c[_0x6a63('0x23')]=qs['offset'](_0x4d4c71[_0x6a63('0x44')][_0x6a63('0x23')]);}return _0x3457b3[_0x6a63('0xe5')](_0x3ecc5c);}})[_0x6a63('0x16')](function(_0x3d3e53){if(_0x3d3e53){return _0x3d3e53?{'count':_0x1c3d70,'rows':_0x3d3e53}:null;}})['then'](respondWithResult(_0x2b465d,null))[_0x6a63('0x20')](handleError(_0x2b465d,null));};exports['getOpenchannelInteractions']=function(_0x355c15,_0x256c4d){var _0x24ae05={};var _0x135ce9={};var _0x4b61a4;var _0x3fab8d;return db[_0x6a63('0x3e')]['findOne']({'where':{'id':_0x355c15['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x256c4d,null))[_0x6a63('0x16')](function(_0x4b8b66){if(_0x4b8b66){_0x4b61a4=_0x4b8b66;_0x135ce9[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xe7')][_0x6a63('0x3f')]);_0x135ce9[_0x6a63('0x44')]=_['keys'](_0x355c15[_0x6a63('0x44')]);_0x135ce9[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x135ce9[_0x6a63('0x58')],_0x135ce9['query']);_0x24ae05[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x135ce9[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x355c15[_0x6a63('0x44')]['fields']));_0x24ae05[_0x6a63('0x49')]=_0x24ae05[_0x6a63('0x49')]['length']?_0x24ae05[_0x6a63('0x49')]:_0x135ce9[_0x6a63('0x58')];_0x24ae05[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x355c15[_0x6a63('0x44')]['sort']);_0x24ae05[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_['pick'](_0x355c15[_0x6a63('0x44')],_0x135ce9[_0x6a63('0xd3')]));if(_0x355c15[_0x6a63('0x44')]['filter']){_0x24ae05['where']=_['merge'](_0x24ae05[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x24ae05[_0x6a63('0x49')],function(_0xa7543f){var _0x979628={};_0x979628[_0xa7543f]={'$like':'%'+_0x355c15[_0x6a63('0x44')]['filter']+'%'};return _0x979628;})});}_0x24ae05=_[_0x6a63('0x5e')]({},_0x24ae05,_0x355c15[_0x6a63('0x5f')]);return _0x4b61a4[_0x6a63('0xe8')](_0x24ae05);}})[_0x6a63('0x16')](function(_0x51c35e){if(_0x51c35e){_0x3fab8d=_0x51c35e[_0x6a63('0x4e')];if(!_0x355c15[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x24ae05[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x355c15[_0x6a63('0x44')][_0x6a63('0x24')]);_0x24ae05[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x355c15[_0x6a63('0x44')][_0x6a63('0x23')]);}return _0x4b61a4[_0x6a63('0xe8')](_0x24ae05);}})[_0x6a63('0x16')](function(_0x18be26){if(_0x18be26){return _0x18be26?{'count':_0x3fab8d,'rows':_0x18be26}:null;}})['then'](respondWithResult(_0x256c4d,null))[_0x6a63('0x20')](handleError(_0x256c4d,null));};exports[_0x6a63('0xe9')]=function(_0x2b1dd9,_0x33c91b){var _0x4b4db6={'raw':!![],'where':{}};var _0x1f522e={};var _0x570111={'count':0x0,'rows':[]};return db[_0x6a63('0x3e')]['findOne']({'where':{'id':_0x2b1dd9['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x33c91b,null))[_0x6a63('0x16')](function(_0x144fa9){if(_0x144fa9){_0x1f522e[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xea')]['rawAttributes']);_0x1f522e[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x2b1dd9['query']);_0x1f522e[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x1f522e[_0x6a63('0x58')],_0x1f522e[_0x6a63('0x44')]);_0x4b4db6[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x1f522e[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x2b1dd9[_0x6a63('0x44')]['fields']));_0x4b4db6[_0x6a63('0x49')]=_0x4b4db6['attributes'][_0x6a63('0x4e')]?_0x4b4db6[_0x6a63('0x49')]:_0x1f522e[_0x6a63('0x58')];if(!_0x2b1dd9['query'][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x4b4db6[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x2b1dd9[_0x6a63('0x44')]['limit']);_0x4b4db6['offset']=qs[_0x6a63('0x23')](_0x2b1dd9['query'][_0x6a63('0x23')]);}_0x4b4db6[_0x6a63('0xd4')]=qs['sort'](_0x2b1dd9[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x4b4db6[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x2b1dd9[_0x6a63('0x44')],_0x1f522e[_0x6a63('0xd3')]));_0x4b4db6[_0x6a63('0x43')][_0x6a63('0xe2')]=_0x144fa9['id'];if(_0x2b1dd9['query'][_0x6a63('0x34')]){_0x4b4db6[_0x6a63('0x43')]=_[_0x6a63('0x5e')](_0x4b4db6[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x4b4db6[_0x6a63('0x49')],function(_0x3453e9){var _0x7fca4f={};_0x7fca4f[_0x3453e9]={'$like':'%'+_0x2b1dd9['query'][_0x6a63('0x34')]+'%'};return _0x7fca4f;})});}_0x4b4db6=_['merge']({},_0x4b4db6,_0x2b1dd9[_0x6a63('0x5f')]);return db['MailInteraction'][_0x6a63('0x26')]({'where':_0x4b4db6['where']})[_0x6a63('0x16')](function(_0x320abe){_0x570111[_0x6a63('0x26')]=_0x320abe;if(_0x2b1dd9[_0x6a63('0x44')][_0x6a63('0x45')]){_0x4b4db6[_0x6a63('0x5d')]=[{'all':!![]}];}return db['MailInteraction'][_0x6a63('0x4b')](_0x4b4db6);})[_0x6a63('0x16')](function(_0x454c66){_0x570111[_0x6a63('0x4c')]=_0x454c66;return _0x570111;});}})[_0x6a63('0x16')](respondWithFilteredResult(_0x33c91b,_0x4b4db6))[_0x6a63('0x20')](handleError(_0x33c91b,null));};exports[_0x6a63('0xeb')]=function(_0x507085,_0x19a2aa){var _0x33f003={};var _0x167e25={};var _0x157209;var _0x56956e;return db[_0x6a63('0x3e')]['findOne']({'where':{'id':_0x507085[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x19a2aa,null))[_0x6a63('0x16')](function(_0x1c0788){if(_0x1c0788){_0x157209=_0x1c0788;_0x167e25[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xec')][_0x6a63('0x3f')]);_0x167e25[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x507085[_0x6a63('0x44')]);_0x167e25[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x167e25[_0x6a63('0x58')],_0x167e25['query']);_0x33f003[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0x167e25['model'],qs[_0x6a63('0x5c')](_0x507085[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x33f003[_0x6a63('0x49')]=_0x33f003[_0x6a63('0x49')][_0x6a63('0x4e')]?_0x33f003[_0x6a63('0x49')]:_0x167e25[_0x6a63('0x58')];_0x33f003['order']=qs['sort'](_0x507085[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x33f003[_0x6a63('0x43')]=qs['filters'](_[_0x6a63('0xd6')](_0x507085['query'],_0x167e25[_0x6a63('0xd3')]));if(_0x507085[_0x6a63('0x44')]['filter']){_0x33f003[_0x6a63('0x43')]=_['merge'](_0x33f003[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x33f003['attributes'],function(_0x117ebb){var _0x464e17={};_0x464e17[_0x117ebb]={'$like':'%'+_0x507085[_0x6a63('0x44')]['filter']+'%'};return _0x464e17;})});}_0x33f003=_[_0x6a63('0x5e')]({},_0x33f003,_0x507085[_0x6a63('0x5f')]);return _0x157209[_0x6a63('0xeb')](_0x33f003);}})[_0x6a63('0x16')](function(_0xbdcdd9){if(_0xbdcdd9){_0x56956e=_0xbdcdd9['length'];if(!_0x507085[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x33f003[_0x6a63('0x24')]=qs['limit'](_0x507085['query'][_0x6a63('0x24')]);_0x33f003[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x507085[_0x6a63('0x44')][_0x6a63('0x23')]);}return _0x157209[_0x6a63('0xeb')](_0x33f003);}})['then'](function(_0x4640ec){if(_0x4640ec){return _0x4640ec?{'count':_0x56956e,'rows':_0x4640ec}:null;}})[_0x6a63('0x16')](respondWithResult(_0x19a2aa,null))[_0x6a63('0x20')](handleError(_0x19a2aa,null));};exports['getFaxInteractions']=function(_0x34e82e,_0x11c191){var _0x3fe163={};var _0x3809f8={};var _0x334a26;var _0x34d613;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x34e82e[_0x6a63('0x57')]['id']}})['then'](handleEntityNotFound(_0x11c191,null))[_0x6a63('0x16')](function(_0x3c72a2){if(_0x3c72a2){_0x334a26=_0x3c72a2;_0x3809f8['model']=_[_0x6a63('0xd1')](db[_0x6a63('0xed')][_0x6a63('0x3f')]);_0x3809f8[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x34e82e['query']);_0x3809f8[_0x6a63('0xd3')]=_['intersection'](_0x3809f8[_0x6a63('0x58')],_0x3809f8[_0x6a63('0x44')]);_0x3fe163['attributes']=_[_0x6a63('0x5b')](_0x3809f8[_0x6a63('0x58')],qs['fields'](_0x34e82e['query'][_0x6a63('0x5c')]));_0x3fe163['attributes']=_0x3fe163['attributes'][_0x6a63('0x4e')]?_0x3fe163['attributes']:_0x3809f8['model'];_0x3fe163[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x34e82e['query'][_0x6a63('0xd5')]);_0x3fe163['where']=qs['filters'](_[_0x6a63('0xd6')](_0x34e82e[_0x6a63('0x44')],_0x3809f8['filters']));if(_0x34e82e[_0x6a63('0x44')][_0x6a63('0x34')]){_0x3fe163[_0x6a63('0x43')]=_['merge'](_0x3fe163[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x3fe163[_0x6a63('0x49')],function(_0x578492){var _0x5b68a4={};_0x5b68a4[_0x578492]={'$like':'%'+_0x34e82e[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x5b68a4;})});}_0x3fe163=_[_0x6a63('0x5e')]({},_0x3fe163,_0x34e82e[_0x6a63('0x5f')]);return _0x334a26[_0x6a63('0xee')](_0x3fe163);}})[_0x6a63('0x16')](function(_0xbf7369){if(_0xbf7369){_0x34d613=_0xbf7369[_0x6a63('0x4e')];if(!_0x34e82e['query'][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x3fe163[_0x6a63('0x24')]=qs['limit'](_0x34e82e[_0x6a63('0x44')][_0x6a63('0x24')]);_0x3fe163[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x34e82e['query'][_0x6a63('0x23')]);}return _0x334a26[_0x6a63('0xee')](_0x3fe163);}})[_0x6a63('0x16')](function(_0x5d595d){if(_0x5d595d){return _0x5d595d?{'count':_0x34d613,'rows':_0x5d595d}:null;}})['then'](respondWithResult(_0x11c191,null))['catch'](handleError(_0x11c191,null));};exports['getWhatsappInteractions']=function(_0x2800bf,_0x506ce2){var _0x56a0d7={};var _0x302cfc={};var _0x120a87;var _0x254f2d;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x2800bf[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x506ce2,null))[_0x6a63('0x16')](function(_0x142b82){if(_0x142b82){_0x120a87=_0x142b82;_0x302cfc[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xef')][_0x6a63('0x3f')]);_0x302cfc[_0x6a63('0x44')]=_['keys'](_0x2800bf[_0x6a63('0x44')]);_0x302cfc[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x302cfc[_0x6a63('0x58')],_0x302cfc['query']);_0x56a0d7['attributes']=_[_0x6a63('0x5b')](_0x302cfc[_0x6a63('0x58')],qs['fields'](_0x2800bf[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x56a0d7[_0x6a63('0x49')]=_0x56a0d7[_0x6a63('0x49')][_0x6a63('0x4e')]?_0x56a0d7[_0x6a63('0x49')]:_0x302cfc['model'];_0x56a0d7[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x2800bf[_0x6a63('0x44')]['sort']);_0x56a0d7['where']=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x2800bf[_0x6a63('0x44')],_0x302cfc['filters']));if(_0x2800bf[_0x6a63('0x44')]['filter']){_0x56a0d7['where']=_[_0x6a63('0x5e')](_0x56a0d7[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x56a0d7['attributes'],function(_0x2d5463){var _0x3ee220={};_0x3ee220[_0x2d5463]={'$like':'%'+_0x2800bf[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x3ee220;})});}_0x56a0d7=_[_0x6a63('0x5e')]({},_0x56a0d7,_0x2800bf['options']);return _0x120a87[_0x6a63('0xf0')](_0x56a0d7);}})['then'](function(_0x34dbe8){if(_0x34dbe8){_0x254f2d=_0x34dbe8[_0x6a63('0x4e')];if(!_0x2800bf[_0x6a63('0x44')][_0x6a63('0xd7')](_0x6a63('0xdb'))){_0x56a0d7['limit']=qs[_0x6a63('0x24')](_0x2800bf['query']['limit']);_0x56a0d7[_0x6a63('0x23')]=qs['offset'](_0x2800bf['query']['offset']);}return _0x120a87[_0x6a63('0xf0')](_0x56a0d7);}})[_0x6a63('0x16')](function(_0x396ec3){if(_0x396ec3){return _0x396ec3?{'count':_0x254f2d,'rows':_0x396ec3}:null;}})[_0x6a63('0x16')](respondWithResult(_0x506ce2,null))[_0x6a63('0x20')](handleError(_0x506ce2,null));};exports[_0x6a63('0xf1')]=function(_0x49a9ed,_0xa6e8a5,_0x55d8d9){var _0x5266a9;var _0xc7b7c;var _0x6cc91f;var _0x3a1a1d=!_[_0x6a63('0x6b')](_0x49a9ed[_0x6a63('0x57')]['id'])?_0x49a9ed[_0x6a63('0x57')]['id']:!_['isNil'](_0x49a9ed[_0x6a63('0x87')]['id'])?_0x49a9ed['user']['id']:null;return db['User'][_0x6a63('0x37')]({'where':{'id':_0x3a1a1d,'role':{'$or':[_0x6a63('0x2f'),_0x6a63('0x87'),'agent']}},'attributes':['id',_0x6a63('0x38'),_0x6a63('0xf2'),_0x6a63('0xf3'),_0x6a63('0x2e'),_0x6a63('0x65'),'loginInPause']})[_0x6a63('0x16')](function(_0x31513e){if(_0x31513e){if(_0x31513e[_0x6a63('0x2e')]==='agent'){_0x5266a9=_0x31513e;if(_0x49a9ed[_0x6a63('0x61')]['interface']){_0x6cc91f=util['format'](_0x6a63('0xf4'),_0x5266a9[_0x49a9ed[_0x6a63('0x61')][_0x6a63('0xb2')]]);}else if(_0x49a9ed[_0x6a63('0x61')][_0x6a63('0xf5')]){_0x6cc91f=util['format'](_0x6a63('0xb4'),_0x49a9ed[_0x6a63('0x61')][_0x6a63('0xf5')]);}else{_0x6cc91f=util[_0x6a63('0xb3')](_0x6a63('0xb4'),_0x5266a9['name']);}socket['to'](util[_0x6a63('0xb3')](_0x6a63('0xf6'),_0x5266a9['name']))[_0x6a63('0x2b')](_0x6a63('0xf7'),{'user':{'id':_0x5266a9['id'],'name':_0x5266a9[_0x6a63('0x38')]},'ip':_0x49a9ed[_0x6a63('0xf8')][_0x6a63('0xf9')]||_0x49a9ed[_0x6a63('0xfa')][_0x6a63('0xfb')]||_0x49a9ed[_0x6a63('0xfc')][_0x6a63('0xfb')]||_0x49a9ed['connection'][_0x6a63('0xfc')][_0x6a63('0xfb')]});return db[_0x6a63('0xba')][_0x6a63('0x2c')]({'where':{'membername':_0x5266a9['name']},'individualHooks':!![]});}}else{throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))](_0x6a63('0xfd'));}})[_0x6a63('0x16')](function(){if(_0x5266a9){return _0x5266a9[_0x6a63('0xfe')]({'raw':!![]});}})[_0x6a63('0x16')](function(_0x427fb9){if(_0x5266a9){var _0x1f2ce0=[];if(_0x427fb9){_0xc7b7c=_0x427fb9;if(_0xc7b7c[_0x6a63('0x4e')]){for(var _0x5a45dd=0x0;_0x5a45dd<_0xc7b7c[_0x6a63('0x4e')];_0x5a45dd++){_0x1f2ce0[_0x6a63('0x4a')]({'membername':_0x5266a9['name'],'UserId':_0x5266a9['id'],'queue_name':_0xc7b7c[_0x5a45dd][_0x6a63('0x38')],'VoiceQueueId':_0xc7b7c[_0x5a45dd]['id'],'interface':_0x6cc91f,'paused':_0x5266a9[_0x6a63('0xa6')]||![],'penalty':_0xc7b7c[_0x5a45dd][_0x6a63('0xff')]||0x0});}return BPromise[_0x6a63('0x93')](_0x1f2ce0,function(_0x3e4297){return db[_0x6a63('0xba')][_0x6a63('0xb5')](_0x3e4297);});}}}})[_0x6a63('0x16')](function(){if(_0x5266a9){return db[_0x6a63('0x100')]['findAll']({'where':{'membername':_0x5266a9[_0x6a63('0x38')],'exitAt':null}});}})['then'](function(_0x212c23){if(_0x5266a9){var _0x4a766a=[];_0x212c23['forEach'](function(_0x52340f){_0x4a766a[_0x6a63('0x4a')](_0x52340f[_0x6a63('0x2a')]({'exitAt':moment()[_0x6a63('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4a766a);}})[_0x6a63('0x16')](function(){if(_0x5266a9){var _0x1097bc=[];var _0x4516d3=[];var _0x402fa1=utils[_0x6a63('0x101')]();var _0x97bd00={'membername':_0x5266a9[_0x6a63('0x38')],'interface':_0x6cc91f,'enterAt':moment()[_0x6a63('0xb3')](_0x6a63('0x102')),'role':_0x5266a9['role'],'internal':_0x5266a9[_0x6a63('0x65')]};_0x402fa1['forEach'](function(_0x517817){_0x1097bc[_0x6a63('0x4a')](_[_0x6a63('0x5e')]({'channel':_0x517817,'type':_0x6a63('0x103'),'data1':_0x49a9ed['body'][_0x6a63('0x104')],'data2':_0x6cc91f},_0x97bd00));if(_0x5266a9['loginInPause']){_0x4516d3['push'](_['merge']({'channel':_0x517817,'type':_0x6a63('0x105'),'data1':_0x6a63('0x106')},_0x97bd00));}});return db[_0x6a63('0x100')][_0x6a63('0x8f')](_0x1097bc[_0x6a63('0xcf')](_0x4516d3),{'individualHooks':!![]});}})['then'](function(){if(_0x5266a9){return _0x5266a9['update']({'online':!![],'lastLoginAt':moment()['format'](_0x6a63('0x102')),'voicePause':_0x5266a9[_0x6a63('0xa6')]||![],'mailPause':_0x5266a9[_0x6a63('0xa6')]||![],'chatPause':_0x5266a9[_0x6a63('0xa6')]||![],'faxPause':_0x5266a9[_0x6a63('0xa6')]||![],'smsPause':_0x5266a9[_0x6a63('0xa6')]||![],'openchannelPause':_0x5266a9[_0x6a63('0xa6')]||![],'whatsappPause':_0x5266a9[_0x6a63('0xa6')]||![],'pauseType':_0x5266a9['loginInPause']?_0x6a63('0x106'):null,'interface':_0x6cc91f,'lastPauseAt':moment()[_0x6a63('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0xefc65b){if(_0x49a9ed[_0x6a63('0x107')]){return _0x55d8d9();}else{return BPromise[_0x6a63('0x108')](_0xefc65b)[_0x6a63('0x16')](respondWithResult(_0xa6e8a5,null));}})[_0x6a63('0x20')](handleError(_0xa6e8a5,null));};exports[_0x6a63('0x109')]=function(_0x5d3df1,_0x50a745){var _0x5f2eaa;return db['User'][_0x6a63('0x37')]({'where':{'id':_0x5d3df1[_0x6a63('0x57')]['id'],'role':_0x6a63('0x77')},'attributes':['id',_0x6a63('0x38'),_0x6a63('0x2e')]})[_0x6a63('0x16')](handleEntityNotFound(_0x50a745,null))[_0x6a63('0x16')](function(_0x521811){if(_0x521811){_0x5f2eaa=_0x521811;return db[_0x6a63('0xba')][_0x6a63('0x2c')]({'where':{'membername':_0x5f2eaa['name']},'individualHooks':!![]});}})[_0x6a63('0x16')](function(){return db[_0x6a63('0x100')][_0x6a63('0x4b')]({'where':{'membername':_0x5f2eaa[_0x6a63('0x38')],'exitAt':null}});})[_0x6a63('0x16')](function(_0x314b34){var _0x4135af=[];_0x314b34[_0x6a63('0x10a')](function(_0x1e0014){_0x4135af[_0x6a63('0x4a')](_0x1e0014[_0x6a63('0x2a')]({'exitAt':moment()[_0x6a63('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6a63('0x55')](_0x4135af);})['then'](function(){return _0x5f2eaa[_0x6a63('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6a63('0x16')](respondWithResult(_0x50a745,null))[_0x6a63('0x20')](handleError(_0x50a745,null));};exports[_0x6a63('0x10b')]=function(_0x191e1a,_0x3c8697){var _0x2c4e92;return db[_0x6a63('0xba')]['update']({'paused':0x1},{'where':{'UserId':_0x191e1a[_0x6a63('0x57')]['id']},'individualHooks':!![]})[_0x6a63('0x16')](function(){return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x191e1a['params']['id'],'role':'agent'},'attributes':['id',_0x6a63('0x38'),'role',_0x6a63('0x65'),_0x6a63('0xb2')]});})[_0x6a63('0x16')](handleEntityNotFound(_0x3c8697,null))['then'](function(_0x48a048){if(_0x48a048){_0x2c4e92=_0x48a048;return respondWithRpcPromise(_0x6a63('0x10c'),_0x6a63('0x10b'),{'id':_0x2c4e92['id'],'name':_0x2c4e92[_0x6a63('0x38')],'pause':!![]});}})[_0x6a63('0x16')](function(){if(_0x2c4e92){return db['MemberReport'][_0x6a63('0x4b')]({'where':{'membername':_0x2c4e92[_0x6a63('0x38')],'type':_0x6a63('0x105'),'exitAt':null}});}})[_0x6a63('0x16')](function(_0x5bfbc4){if(_0x5bfbc4[_0x6a63('0x4e')]){var _0x298fc3=moment()[_0x6a63('0xb3')](_0x6a63('0x102'));for(var _0x26f884=0x0,_0x1b7b65=_0x5bfbc4[_0x6a63('0x4e')];_0x26f884<_0x1b7b65;_0x26f884++){_0x5bfbc4[_0x26f884]['updateAttributes']({'exitAt':_0x298fc3});}}})[_0x6a63('0x16')](function(){var _0x5dbc62=[];var _0x504e93=utils[_0x6a63('0x101')]();_0x504e93[_0x6a63('0x10a')](function(_0x149f8c){_0x5dbc62['push']({'channel':_0x149f8c,'membername':_0x2c4e92[_0x6a63('0x38')],'interface':_[_0x6a63('0x6b')](_0x2c4e92[_0x6a63('0xb2')])?util[_0x6a63('0xb3')](_0x6a63('0xb4'),_0x2c4e92[_0x6a63('0x38')]):_0x2c4e92['interface'],'type':'PAUSE','enterAt':moment()[_0x6a63('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x191e1a[_0x6a63('0x61')][_0x6a63('0x41')]||_0x6a63('0x10d'),'role':_0x2c4e92[_0x6a63('0x2e')],'internal':_0x2c4e92[_0x6a63('0x65')]});});return db[_0x6a63('0x100')][_0x6a63('0x8f')](_0x5dbc62,{'individualHooks':!![]});})[_0x6a63('0x16')](function(){return _0x2c4e92[_0x6a63('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x191e1a['body'][_0x6a63('0x41')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6a63('0xb3')](_0x6a63('0x102'))});})['then'](respondWithResult(_0x3c8697,null))[_0x6a63('0x20')](handleError(_0x3c8697,null));};exports[_0x6a63('0x10e')]=function(_0x1763f4,_0x4e87cc){var _0x2eafe9;return db[_0x6a63('0x3e')][_0x6a63('0x37')]({'where':{'id':_0x1763f4[_0x6a63('0x57')]['id']},'attributes':['id',_0x6a63('0x38'),_0x6a63('0x2e'),_0x6a63('0xa7'),_0x6a63('0x10f'),_0x6a63('0x110'),_0x6a63('0x111'),'openchannelPause',_0x6a63('0x112'),_0x6a63('0x113'),_0x6a63('0x114'),_0x6a63('0x115')]})['then'](handleEntityNotFound(_0x4e87cc,null))[_0x6a63('0x16')](function(_0x4e97b8){if(_0x4e97b8){_0x2eafe9=_0x4e97b8;if(_0x1763f4[_0x6a63('0x61')][_0x6a63('0xa4')]&&!utils[_0x6a63('0xb7')](_0x1763f4[_0x6a63('0x61')][_0x6a63('0xa4')])){throw new db[(_0x6a63('0x97'))][(_0x6a63('0x98'))](_0x6a63('0xa8'));}switch(_0x1763f4['body'][_0x6a63('0xa4')]){case _0x6a63('0xb0'):return respondWithRpcPromise('QueuePause',_0x6a63('0x10e'),{'id':_0x2eafe9['id'],'name':_0x2eafe9[_0x6a63('0x38')],'pause':![]})['then'](function(){return db[_0x6a63('0xba')]['update']({'paused':0x0},{'where':{'UserId':_0x2eafe9['id']},'individualHooks':!![]});})['then'](function(){return db[_0x6a63('0x100')][_0x6a63('0x37')]({'where':{'channel':_0x1763f4[_0x6a63('0x61')]['channel'],'membername':_0x2eafe9[_0x6a63('0x38')],'type':_0x6a63('0x105'),'exitAt':null}});})[_0x6a63('0x16')](function(_0x5eb228){if(_0x5eb228){return _0x5eb228['update']({'exitAt':moment()[_0x6a63('0xb3')](_0x6a63('0x102')),'data2':_0x6a63('0x116')},{'individualHooks':!![]});}return null;})[_0x6a63('0x16')](function(){return _0x2eafe9['update']({'voicePause':![]});});case _0x6a63('0x53'):case'chat':case'fax':case _0x6a63('0x50'):case _0x6a63('0x60'):case _0x6a63('0x54'):return db[_0x6a63('0x100')][_0x6a63('0x37')]({'where':{'channel':_0x1763f4[_0x6a63('0x61')][_0x6a63('0xa4')],'membername':_0x2eafe9[_0x6a63('0x38')],'type':_0x6a63('0x105'),'exitAt':null}})[_0x6a63('0x16')](function(_0x32056c){if(_0x32056c){return _0x32056c[_0x6a63('0x2a')]({'exitAt':moment()['format'](_0x6a63('0x102')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x6a63('0x16')](function(){var _0x3861f3={};_[_0x6a63('0x28')](_0x3861f3,util[_0x6a63('0xb3')]('%s%s',_0x1763f4[_0x6a63('0x61')][_0x6a63('0xa4')],_0x6a63('0x117')),![]);return _0x2eafe9[_0x6a63('0x2a')](_0x3861f3);});default:return respondWithRpcPromise(_0x6a63('0x10c'),_0x6a63('0x10e'),{'id':_0x2eafe9['id'],'name':_0x2eafe9['name'],'pause':![]})['then'](function(){return db[_0x6a63('0xba')][_0x6a63('0x2a')]({'paused':0x0},{'where':{'UserId':_0x2eafe9['id']}});})[_0x6a63('0x16')](function(){return db['MemberReport'][_0x6a63('0x4b')]({'where':{'membername':_0x2eafe9['name'],'type':_0x6a63('0x105'),'exitAt':null}});})[_0x6a63('0x16')](function(_0x4ec4ca){var _0x308383=[];_0x4ec4ca[_0x6a63('0x10a')](function(_0x519b97){_0x308383['push'](_0x519b97[_0x6a63('0x2a')]({'exitAt':moment()[_0x6a63('0xb3')](_0x6a63('0x102')),'data2':'manual'}));});return BPromise[_0x6a63('0x55')](_0x308383);})[_0x6a63('0x16')](function(){return _0x2eafe9[_0x6a63('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x6a63('0x16')](respondWithResult(_0x4e87cc,null))[_0x6a63('0x20')](handleError(_0x4e87cc,null));};exports[_0x6a63('0x118')]=function(_0x59d74a,_0x4a69da){var _0x4c62ca={};var _0x4d2e21={};var _0xa80828;var _0x5dd462;return db['User'][_0x6a63('0x9d')]({'where':{'id':_0x59d74a['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x4a69da,null))[_0x6a63('0x16')](function(_0x85758){if(_0x85758){_0xa80828=_0x85758;_0x4d2e21[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0x119')]['rawAttributes']);_0x4d2e21[_0x6a63('0x44')]=_['keys'](_0x59d74a[_0x6a63('0x44')]);_0x4d2e21[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x4d2e21[_0x6a63('0x58')],_0x4d2e21[_0x6a63('0x44')]);_0x4c62ca[_0x6a63('0x49')]=_['intersection'](_0x4d2e21[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x59d74a[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x4c62ca[_0x6a63('0x49')]=_0x4c62ca['attributes']['length']?_0x4c62ca['attributes']:_0x4d2e21[_0x6a63('0x58')];_0x4c62ca[_0x6a63('0xd4')]=qs[_0x6a63('0xd5')](_0x59d74a[_0x6a63('0x44')]['sort']);_0x4c62ca[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x59d74a['query'],_0x4d2e21[_0x6a63('0xd3')]));if(_0x59d74a[_0x6a63('0x44')][_0x6a63('0x34')]){_0x4c62ca[_0x6a63('0x43')]=_[_0x6a63('0x5e')](_0x4c62ca[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x4c62ca[_0x6a63('0x49')],function(_0x4afa45){var _0x53cc82={};_0x53cc82[_0x4afa45]={'$like':'%'+_0x59d74a[_0x6a63('0x44')]['filter']+'%'};return _0x53cc82;})});}_0x4c62ca=_[_0x6a63('0x5e')]({},_0x4c62ca,_0x59d74a['options']);return _0xa80828[_0x6a63('0x118')](_0x4c62ca);}})[_0x6a63('0x16')](function(_0x1f6be8){if(_0x1f6be8){_0x5dd462=_0x1f6be8[_0x6a63('0x4e')];if(!_0x59d74a[_0x6a63('0x44')][_0x6a63('0xd7')]('nolimit')){_0x4c62ca[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x59d74a[_0x6a63('0x44')][_0x6a63('0x24')]);_0x4c62ca[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x59d74a[_0x6a63('0x44')][_0x6a63('0x23')]);}return _0xa80828[_0x6a63('0x118')](_0x4c62ca);}})[_0x6a63('0x16')](function(_0x48134f){if(_0x48134f){return _0x48134f?{'count':_0x5dd462,'rows':_0x48134f}:null;}})['then'](respondWithResult(_0x4a69da,null))[_0x6a63('0x20')](handleError(_0x4a69da,null));};exports[_0x6a63('0x11a')]=function(_0x1133bf,_0x566331){var _0x41d4e9=_0x1133bf[_0x6a63('0x57')]['id'];var _0x729cde=_0x1133bf[_0x6a63('0x61')]?_0x1133bf['body'][_0x6a63('0x64')]:null;var _0x2f2a9f=[];return Promise['resolve']()[_0x6a63('0x16')](function(){if(!_0x729cde)throw new APIBadRequestError(_0x6a63('0x11b'));})[_0x6a63('0x16')](function(){return db['User'][_0x6a63('0x9d')]({'where':{'id':_0x41d4e9}});})['then'](function(_0x1dc168){if(!_0x1dc168)throw new APINotFoundError(util[_0x6a63('0xb3')](_0x6a63('0x11c'),_0x1133bf[_0x6a63('0x57')]['id']));return db[_0x6a63('0x6d')][_0x6a63('0x11d')](function(_0x56062f){return _0x1dc168[_0x6a63('0x11a')](_0x729cde,{'transaction':_0x56062f})[_0x6a63('0x16')](function(){return db[_0x6a63('0x119')][_0x6a63('0x4b')]({'where':{'id':{'$in':_0x729cde}}});})[_0x6a63('0x16')](function(_0x4a7da7){var _0x5a1b72=_[_0x6a63('0xc5')](_0x4a7da7,function(_0x3a6956){return _0x3a6956[_0x6a63('0x11e')]();});return Promise[_0x6a63('0x55')](_0x5a1b72);})[_0x6a63('0x16')](function(_0x34d8fe){_0x2f2a9f=_[_0x6a63('0x11f')](_0x34d8fe);var _0x325b70=_['map'](_0x2f2a9f,function(_0x5e7cb9){return _0x5e7cb9[_0x6a63('0x120')](_0x1dc168['id'],{'transaction':_0x56062f});});return Promise[_0x6a63('0x55')](_0x325b70);})[_0x6a63('0x16')](function(){if(!_0x1dc168[_0x6a63('0xa5')])return;var _0x13c8ac=_[_0x6a63('0x34')](_0x2f2a9f,function(_0x42490c){return _0x42490c[_0x6a63('0x121')](_0x6a63('0xa4'))===_0x6a63('0x122');});var _0x191f14=_[_0x6a63('0xc5')](_0x13c8ac,function(_0x58332f){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1dc168[_0x6a63('0x38')],'UserId':_0x1dc168['id'],'queue_name':_0x58332f['name'],'VoiceQueueId':_0x58332f['id'],'interface':_[_0x6a63('0x6b')](_0x1dc168[_0x6a63('0xb2')])?util[_0x6a63('0xb3')](_0x6a63('0xb4'),_0x1dc168[_0x6a63('0x38')]):_0x1dc168[_0x6a63('0xb2')],'paused':_0x1dc168['voicePause']||![],'penalty':_0x1dc168[_0x6a63('0xab')]},{'transaction':_0x56062f});});return Promise[_0x6a63('0x55')](_0x191f14);})[_0x6a63('0x16')](function(){return db[_0x6a63('0x123')][_0x6a63('0x4b')]({'where':{'teamId':{'$in':_0x729cde}}});})[_0x6a63('0x16')](function(_0x2db4ee){var _0x38ce76=_['map'](_0x2db4ee,function(_0x5c45ea){return db[_0x6a63('0x124')][_0x6a63('0x86')]({'UserId':_0x1dc168['id'],'VoicePrefixId':_0x5c45ea[_0x6a63('0x125')]},{'transaction':_0x56062f});});return Promise['all'](_0x38ce76);});});})[_0x6a63('0x16')](function(){for(var _0x4af063=0x0;_0x4af063<_0x2f2a9f[_0x6a63('0x4e')];_0x4af063++){var _0x48ac7f=_0x2f2a9f[_0x4af063][_0x6a63('0x121')](_0x6a63('0xa4'));var _0x22c560=_0x48ac7f+'QueueId';socket[_0x6a63('0x2b')]('user'+_0x48ac7f+_0x6a63('0xaf'),{'UserId':_0x41d4e9,['queueField']:_0x2f2a9f[_0x4af063]['id']});}})['then'](respondWithStatusCode(_0x566331,null))[_0x6a63('0x20')](APIHandleError(_0x566331));};exports[_0x6a63('0x126')]=function(_0x5d1dc6,_0x1968ec){var _0x548af6=_0x5d1dc6[_0x6a63('0x57')]['id'];var _0x511718=null;if(_0x5d1dc6[_0x6a63('0x44')]['ids']){_0x511718=_[_0x6a63('0xb8')](_0x5d1dc6['query'][_0x6a63('0x64')])?_0x5d1dc6[_0x6a63('0x44')][_0x6a63('0x64')]:[_0x5d1dc6[_0x6a63('0x44')]['ids']];}var _0x3382ad=[];return Promise[_0x6a63('0x108')]()['then'](function(){if(!_0x511718)throw new APIBadRequestError(_0x6a63('0x127'));})[_0x6a63('0x16')](function(){return db[_0x6a63('0x3e')]['findOne']({'where':{'id':_0x548af6}});})[_0x6a63('0x16')](function(_0x5aaa8a){if(!_0x5aaa8a)throw new APINotFoundError(util['format'](_0x6a63('0x11c'),_0x5d1dc6[_0x6a63('0x57')]['id']));return db[_0x6a63('0x6d')][_0x6a63('0x11d')](function(_0x1d26d4){return _0x5aaa8a[_0x6a63('0x126')](_0x511718,{'transaction':_0x1d26d4})['then'](function(){return db['Team'][_0x6a63('0x4b')]({'where':{'id':{'$in':_0x511718}}});})[_0x6a63('0x16')](function(_0x1216ad){var _0x33d03d=_[_0x6a63('0xc5')](_0x1216ad,function(_0x47116c){return _0x47116c[_0x6a63('0x11e')]();});return Promise[_0x6a63('0x55')](_0x33d03d);})[_0x6a63('0x16')](function(_0x5239c6){_0x3382ad=_[_0x6a63('0x11f')](_0x5239c6);var _0x14ada6=_['map'](_0x3382ad,function(_0x3c01d8){return _0x3c01d8[_0x6a63('0x128')](_0x5aaa8a['id'],{'transaction':_0x1d26d4});});return Promise[_0x6a63('0x55')](_0x14ada6);})[_0x6a63('0x16')](function(){if(!_0x5aaa8a['online'])return;var _0x6715c8=_[_0x6a63('0x34')](_0x3382ad,function(_0x89dbe7){return _0x89dbe7[_0x6a63('0x121')](_0x6a63('0xa4'))===_0x6a63('0x122');});var _0x359007=_[_0x6a63('0xc5')](_0x6715c8,function(_0x246701){return db[_0x6a63('0xba')][_0x6a63('0x2c')]({'where':{'VoiceQueueId':_0x246701['id'],'UserId':_0x5aaa8a['id']},'transaction':_0x1d26d4});});return Promise[_0x6a63('0x55')](_0x359007);})['then'](function(){return db['TeamVoicePrefix'][_0x6a63('0x4b')]({'where':{'teamId':{'$in':_0x511718}}});})[_0x6a63('0x16')](function(_0x1af2c7){var _0x155604=_[_0x6a63('0xc5')](_0x1af2c7,function(_0x2c1f20){return db[_0x6a63('0x124')][_0x6a63('0x2c')]({'where':{'UserId':_0x5aaa8a['id'],'VoicePrefixId':_0x2c1f20['VoicePrefixId']}},{'transaction':_0x1d26d4});});return Promise[_0x6a63('0x55')](_0x155604);});});})[_0x6a63('0x16')](function(){for(var _0x248db8=0x0;_0x248db8<_0x3382ad[_0x6a63('0x4e')];_0x248db8++){var _0x3db6a3=_0x3382ad[_0x248db8][_0x6a63('0x121')]('channel');var _0x1186f2=_0x3db6a3+_0x6a63('0xae');socket[_0x6a63('0x2b')](_0x6a63('0x87')+_0x3db6a3+_0x6a63('0xb9'),{'UserId':_0x548af6,['queueField']:_0x3382ad[_0x248db8]['id']});}})[_0x6a63('0x16')](respondWithStatusCode(_0x1968ec,null))[_0x6a63('0x20')](APIHandleError(_0x1968ec));};exports[_0x6a63('0x129')]=function(_0x9c7794,_0x4269bf){var _0x5c6dd6={};var _0xb1a012={};var _0x50f04d;var _0x4d0654;return db[_0x6a63('0x3e')][_0x6a63('0x9d')]({'where':{'id':_0x9c7794[_0x6a63('0x57')]['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x4269bf,null))[_0x6a63('0x16')](function(_0x1f9e6e){if(_0x1f9e6e){_0x50f04d=_0x1f9e6e;_0xb1a012[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0xd8')][_0x6a63('0x3f')]);_0xb1a012[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x9c7794[_0x6a63('0x44')]);_0xb1a012['filters']=_[_0x6a63('0x5b')](_0xb1a012[_0x6a63('0x58')],_0xb1a012[_0x6a63('0x44')]);_0x5c6dd6[_0x6a63('0x49')]=_[_0x6a63('0x5b')](_0xb1a012[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x9c7794[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x5c6dd6[_0x6a63('0x49')]=_0x5c6dd6[_0x6a63('0x49')]['length']?_0x5c6dd6[_0x6a63('0x49')]:_0xb1a012[_0x6a63('0x58')];_0x5c6dd6['order']=qs[_0x6a63('0xd5')](_0x9c7794[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x5c6dd6[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x9c7794[_0x6a63('0x44')],_0xb1a012[_0x6a63('0xd3')]));if(_0x9c7794[_0x6a63('0x44')]['filter']){_0x5c6dd6['where']=_[_0x6a63('0x5e')](_0x5c6dd6[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x5c6dd6[_0x6a63('0x49')],function(_0x55aa63){var _0x2b6974={};_0x2b6974[_0x55aa63]={'$like':'%'+_0x9c7794['query']['filter']+'%'};return _0x2b6974;})});}_0x5c6dd6=_[_0x6a63('0x5e')]({},_0x5c6dd6,_0x9c7794[_0x6a63('0x5f')]);return _0x50f04d[_0x6a63('0x129')](_0x5c6dd6);}})[_0x6a63('0x16')](function(_0x256632){if(_0x256632){_0x4d0654=_0x256632[_0x6a63('0x4e')];if(!_0x9c7794[_0x6a63('0x44')][_0x6a63('0xd7')]('nolimit')){_0x5c6dd6[_0x6a63('0x24')]=qs[_0x6a63('0x24')](_0x9c7794['query'][_0x6a63('0x24')]);_0x5c6dd6[_0x6a63('0x23')]=qs[_0x6a63('0x23')](_0x9c7794[_0x6a63('0x44')][_0x6a63('0x23')]);}return _0x50f04d[_0x6a63('0x129')](_0x5c6dd6);}})[_0x6a63('0x16')](function(_0x3824d0){if(_0x3824d0){return _0x3824d0?{'count':_0x4d0654,'rows':_0x3824d0}:null;}})[_0x6a63('0x16')](respondWithResult(_0x4269bf,null))[_0x6a63('0x20')](handleError(_0x4269bf,null));};exports[_0x6a63('0x12a')]=function(_0x6e9630,_0x16f18b){var _0x1614c8={};var _0x565d57={};var _0x2336d7;return db['User'][_0x6a63('0x9d')]({'where':{'id':_0x6e9630['params']['id']}})[_0x6a63('0x16')](handleEntityNotFound(_0x16f18b,null))['then'](function(_0x3957fb){if(_0x3957fb){_0x2336d7=_0x3957fb;_0x565d57[_0x6a63('0x58')]=_[_0x6a63('0xd1')](db[_0x6a63('0x3e')][_0x6a63('0x3f')]);_0x565d57[_0x6a63('0x44')]=_[_0x6a63('0xd1')](_0x6e9630[_0x6a63('0x44')]);_0x565d57[_0x6a63('0xd3')]=_[_0x6a63('0x5b')](_0x565d57[_0x6a63('0x58')],_0x565d57['query']);_0x1614c8['attributes']=_[_0x6a63('0x5b')](_0x565d57[_0x6a63('0x58')],qs[_0x6a63('0x5c')](_0x6e9630[_0x6a63('0x44')][_0x6a63('0x5c')]));_0x1614c8[_0x6a63('0x49')]=_0x1614c8['attributes']['length']?_0x1614c8[_0x6a63('0x49')]:_0x565d57['model'];_0x1614c8[_0x6a63('0xd4')]=qs['sort'](_0x6e9630[_0x6a63('0x44')][_0x6a63('0xd5')]);_0x1614c8[_0x6a63('0x43')]=qs[_0x6a63('0xd3')](_[_0x6a63('0xd6')](_0x6e9630[_0x6a63('0x44')],_0x565d57[_0x6a63('0xd3')]));if(_0x6e9630[_0x6a63('0x44')]['filter']){_0x1614c8['where']=_[_0x6a63('0x5e')](_0x1614c8[_0x6a63('0x43')],{'$or':_[_0x6a63('0xc5')](_0x1614c8[_0x6a63('0x49')],function(_0x16edff){var _0x3a38b0={};_0x3a38b0[_0x16edff]={'$like':'%'+_0x6e9630[_0x6a63('0x44')][_0x6a63('0x34')]+'%'};return _0x3a38b0;})});}_0x1614c8[_0x6a63('0x58')]=db[_0x6a63('0x3e')];_0x1614c8['as']=_0x6a63('0x31');_0x1614c8=_[_0x6a63('0x5e')]({},_0x1614c8,_0x6e9630['options']);return _0x2336d7[_0x6a63('0xfe')]({'include':[_0x1614c8]});}})[_0x6a63('0x16')](function(_0x3b7449){if(_0x3b7449){var _0x20c086={},_0x4228a0=[];for(var _0x33642b=0x0;_0x33642b<_0x3b7449[_0x6a63('0x4e')];_0x33642b+=0x1){for(var _0xaa1f4b=0x0,_0x3d9033;_0xaa1f4b<_0x3b7449[_0x33642b][_0x6a63('0x31')][_0x6a63('0x4e')];_0xaa1f4b+=0x1){_0x3d9033=_0x3b7449[_0x33642b]['Agents'][_0xaa1f4b]['get']({'plain':!![]});_0x20c086[_0x3d9033['id']]=_0x3d9033;}}_0x20c086=_[_0x6a63('0x12b')](_0x20c086);for(var _0x54298d=qs[_0x6a63('0x23')](_0x6e9630['query']['offset']);_0x54298d<_0x20c086[_0x6a63('0x4e')]&&_0x4228a0['length']=_0x275dde[_0xa944('0x57')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa944('0x11')](function(){if(_0x5042f1){return db['UserVoiceQueueRt'][_0xa944('0x58')]({'where':{'membername':_0x5042f1['name']},'individualHooks':!![]});}})[_0xa944('0x11')](function(){if(_0x5042f1){return _0x5042f1[_0xa944('0x59')]({'raw':!![]});}})[_0xa944('0x11')](function(_0x35ba42){if(_0x5042f1){if(_0x35ba42){var _0x7230cd=[];_0x835933=_0x35ba42;if(_0x835933[_0xa944('0x2f')]){for(var _0x20b2fc=0x0;_0x20b2fc<_0x835933['length'];_0x20b2fc++){_0x7230cd[_0xa944('0x35')](db[_0xa944('0x2b')][_0xa944('0x5a')]({'membername':_0x5042f1[_0xa944('0x28')],'UserId':_0x5042f1['id'],'queue_name':_0x835933[_0x20b2fc][_0xa944('0x28')],'VoiceQueueId':_0x835933[_0x20b2fc]['id'],'interface':_0x16b2d1,'paused':_0x5042f1[_0xa944('0x5b')]||![],'penalty':_0x835933[_0x20b2fc][_0xa944('0x5c')]||0x0}));}return BPromise[_0xa944('0x4e')](_0x7230cd);}}}})[_0xa944('0x11')](function(){if(_0x5042f1){return db['MemberReport'][_0xa944('0x2d')]({'where':{'membername':_0x5042f1[_0xa944('0x28')],'exitAt':null}});}})[_0xa944('0x11')](function(_0x46c974){if(_0x5042f1){if(_0x46c974&&_0x46c974['length']){var _0x424c3e=[];_0x46c974[_0xa944('0x34')](function(_0x55b942){_0x424c3e[_0xa944('0x35')](_0x55b942[_0xa944('0x2c')]({'exitAt':moment()['format'](_0xa944('0x31'))}));});return BPromise['all'](_0x424c3e);}}})[_0xa944('0x11')](function(_0x34672a){if(_0x5042f1){var _0x931ffd=[];var _0x151363=[];var _0x2b627c=utils['getChannels']();var _0x1af364={'membername':_0x5042f1[_0xa944('0x28')],'interface':_0x16b2d1,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5042f1[_0xa944('0x3a')],'internal':_0x5042f1[_0xa944('0x29')]};_0x2b627c['forEach'](function(_0xfedd1){_0x931ffd['push'](_['merge']({'channel':_0xfedd1,'type':_0xa944('0x5d'),'data1':_0xa944('0x5e'),'data2':_0x16b2d1},_0x1af364));if(_0x5042f1[_0xa944('0x5b')]){_0x151363[_0xa944('0x35')](_[_0xa944('0x5f')]({'channel':_0xfedd1,'type':_0xa944('0x2e'),'data1':_0xa944('0x60')},_0x1af364));}});return db['MemberReport']['bulkCreate'](_0x931ffd[_0xa944('0x61')](_0x151363),{'individualHooks':!![]});}})[_0xa944('0x11')](function(){if(_0x5042f1){return _0x5042f1['update']({'online':!![],'lastLoginAt':moment()[_0xa944('0x30')](_0xa944('0x31')),'voicePause':_0x5042f1[_0xa944('0x5b')]||![],'mailPause':_0x5042f1['loginInPause']||![],'chatPause':_0x5042f1['loginInPause']||![],'faxPause':_0x5042f1[_0xa944('0x5b')]||![],'smsPause':_0x5042f1[_0xa944('0x5b')]||![],'openchannelPause':_0x5042f1[_0xa944('0x5b')]||![],'pauseType':_0x5042f1[_0xa944('0x5b')]?_0xa944('0x60'):null,'lastPauseAt':moment()[_0xa944('0x30')](_0xa944('0x31')),'interface':_0x16b2d1});}})[_0xa944('0x11')](function(_0x3088d4){_0x16362b(_0x3088d4);})[_0xa944('0x26')](function(_0x5edec3){_0x1b6ef5(_0x479a4e['error'](0x1f4,_0x5edec3[_0xa944('0x1a')]));});});}; \ No newline at end of file +var _0xe925=['LogoutUser','LoginUser','mobile','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./user.socket','register','request','info','request\x20sent','debug','stringify','error','User,\x20%s,\x20%s','message','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowUser','then','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','findOne','isValidChannel','channel','Unknown\x20channel','system','mail','chat','openchannel','whatsapp','set','%s%s','Pause','all'];(function(_0x2e9d8e,_0x3a377e){var _0x4dfc9b=function(_0x499ec4){while(--_0x499ec4){_0x2e9d8e['push'](_0x2e9d8e['shift']());}};_0x4dfc9b(++_0x3a377e);}(_0xe925,0x6e));var _0x5e92=function(_0x591a59,_0x2a4270){_0x591a59=_0x591a59-0x0;var _0x48b358=_0xe925[_0x591a59];return _0x48b358;};'use strict';var _=require(_0x5e92('0x0'));var util=require(_0x5e92('0x1'));var moment=require(_0x5e92('0x2'));var BPromise=require(_0x5e92('0x3'));var rs=require(_0x5e92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e92('0x5'))['db'];var utils=require(_0x5e92('0x6'));var logger=require(_0x5e92('0x7'))(_0x5e92('0x8'));var config=require(_0x5e92('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5e92('0xa')]({'port':0x232a});config[_0x5e92('0xb')]=_['defaults'](config[_0x5e92('0xb')],{'host':_0x5e92('0xc'),'port':0x18eb});var socket=require(_0x5e92('0xd'))(new Redis(config[_0x5e92('0xb')]));require(_0x5e92('0xe'))[_0x5e92('0xf')](socket);function respondWithRpcPromise(_0x569065,_0x4eaea0,_0xed3844){return new BPromise(function(_0x4b0882,_0x2257c1){return client[_0x5e92('0x10')](_0x569065,_0xed3844)['then'](function(_0x1d288c){logger[_0x5e92('0x11')]('User,\x20%s,\x20%s',_0x4eaea0,_0x5e92('0x12'));logger[_0x5e92('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x4eaea0,_0x5e92('0x12'),JSON[_0x5e92('0x14')](_0x1d288c));if(_0x1d288c[_0x5e92('0x15')]){if(_0x1d288c[_0x5e92('0x15')]['code']===0x1f4){logger['error'](_0x5e92('0x16'),_0x4eaea0,_0x1d288c['error'][_0x5e92('0x17')]);return _0x2257c1(_0x1d288c[_0x5e92('0x15')][_0x5e92('0x17')]);}logger[_0x5e92('0x15')](_0x5e92('0x16'),_0x4eaea0,_0x1d288c['error'][_0x5e92('0x17')]);return _0x4b0882(_0x1d288c[_0x5e92('0x15')]['message']);}else{logger[_0x5e92('0x11')](_0x5e92('0x16'),_0x4eaea0,_0x5e92('0x12'));_0x4b0882(_0x1d288c['result'][_0x5e92('0x17')]);}})['catch'](function(_0x2391b8){logger[_0x5e92('0x15')]('User,\x20%s,\x20%s',_0x4eaea0,_0x2391b8);_0x2257c1(_0x2391b8);});});}exports[_0x5e92('0x18')]=function(_0x55e8d9){var _0x1e8a63=this;return new Promise(function(_0x1ded07,_0x77e050){return db[_0x5e92('0x19')][_0x5e92('0x1a')]({'raw':_0x55e8d9[_0x5e92('0x1b')]?_0x55e8d9[_0x5e92('0x1b')][_0x5e92('0x1c')]===undefined?!![]:![]:!![],'where':_0x55e8d9['options']?_0x55e8d9[_0x5e92('0x1b')][_0x5e92('0x1d')]||null:null,'attributes':_0x55e8d9[_0x5e92('0x1b')]?_0x55e8d9[_0x5e92('0x1b')][_0x5e92('0x1e')]||null:null,'limit':_0x55e8d9['options']?_0x55e8d9['options'][_0x5e92('0x1f')]||null:null,'include':_0x55e8d9[_0x5e92('0x1b')]?_0x55e8d9[_0x5e92('0x1b')][_0x5e92('0x20')]?_[_0x5e92('0x21')](_0x55e8d9['options'][_0x5e92('0x20')],function(_0x401754){return{'model':db[_0x401754[_0x5e92('0x22')]],'as':_0x401754['as'],'attributes':_0x401754[_0x5e92('0x1e')],'include':_0x401754[_0x5e92('0x20')]?_[_0x5e92('0x21')](_0x401754[_0x5e92('0x20')],function(_0x18ad97){return{'model':db[_0x18ad97[_0x5e92('0x22')]],'as':_0x18ad97['as'],'attributes':_0x18ad97[_0x5e92('0x1e')],'include':_0x18ad97[_0x5e92('0x20')]?_[_0x5e92('0x21')](_0x18ad97['include'],function(_0x3805c6){return{'model':db[_0x3805c6[_0x5e92('0x22')]],'as':_0x3805c6['as'],'attributes':_0x3805c6[_0x5e92('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x133f4f){logger[_0x5e92('0x11')](_0x5e92('0x18'),_0x55e8d9);logger[_0x5e92('0x13')](_0x5e92('0x18'),_0x55e8d9,JSON[_0x5e92('0x14')](_0x133f4f));_0x1ded07(_0x133f4f);})[_0x5e92('0x23')](function(_0x50002f){logger[_0x5e92('0x15')](_0x5e92('0x18'),_0x50002f['message'],_0x55e8d9);_0x77e050(_0x1e8a63[_0x5e92('0x15')](0x1f4,_0x50002f[_0x5e92('0x17')]));});});};exports[_0x5e92('0x24')]=function(_0x3471ea){var _0x5c7483=this;return new Promise(function(_0x2265ca,_0x2ff441){return db['User']['find']({'raw':_0x3471ea[_0x5e92('0x1b')]?_0x3471ea['options'][_0x5e92('0x1c')]===undefined?!![]:![]:!![],'where':_0x3471ea[_0x5e92('0x1b')]?_0x3471ea['options']['where']||null:null,'attributes':_0x3471ea[_0x5e92('0x1b')]?_0x3471ea[_0x5e92('0x1b')]['attributes']||null:null,'include':_0x3471ea['options']?_0x3471ea[_0x5e92('0x1b')]['include']?_[_0x5e92('0x21')](_0x3471ea[_0x5e92('0x1b')][_0x5e92('0x20')],function(_0x2ed537){return{'model':db[_0x2ed537['model']],'as':_0x2ed537['as'],'attributes':_0x2ed537[_0x5e92('0x1e')],'include':_0x2ed537['include']?_[_0x5e92('0x21')](_0x2ed537[_0x5e92('0x20')],function(_0x278573){return{'model':db[_0x278573[_0x5e92('0x22')]],'as':_0x278573['as'],'attributes':_0x278573['attributes'],'include':_0x278573[_0x5e92('0x20')]?_[_0x5e92('0x21')](_0x278573['include'],function(_0x21484c){return{'model':db[_0x21484c[_0x5e92('0x22')]],'as':_0x21484c['as'],'attributes':_0x21484c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e92('0x25')](function(_0x4fc8e7){logger[_0x5e92('0x11')](_0x5e92('0x24'),_0x3471ea);logger[_0x5e92('0x13')](_0x5e92('0x24'),_0x3471ea,JSON[_0x5e92('0x14')](_0x4fc8e7));_0x2265ca(_0x4fc8e7);})['catch'](function(_0x3f91f3){logger[_0x5e92('0x15')]('ShowUser',_0x3f91f3['message'],_0x3471ea);_0x2ff441(_0x5c7483[_0x5e92('0x15')](0x1f4,_0x3f91f3[_0x5e92('0x17')]));});});};exports[_0x5e92('0x26')]=function(_0x49528){var _0x52812a=this;return new Promise(function(_0x3a85b1,_0x430aa5){var _0x285ebf;return db[_0x5e92('0x19')][_0x5e92('0x27')]({'where':_0x49528[_0x5e92('0x1b')]['where']||{},'attributes':['id',_0x5e92('0x28'),_0x5e92('0x29'),_0x5e92('0x2a'),_0x5e92('0x2b')]})[_0x5e92('0x25')](function(_0x41b166){if(_0x41b166){_0x285ebf=_0x41b166;return db[_0x5e92('0x2c')][_0x5e92('0x2d')]({'paused':0x1},{'where':{'UserId':_0x285ebf['id']},'individualHooks':!![]});}})[_0x5e92('0x25')](function(){if(_0x285ebf){return db[_0x5e92('0x2e')][_0x5e92('0x1a')]({'where':{'membername':_0x285ebf[_0x5e92('0x28')],'type':_0x5e92('0x2f'),'exitAt':null}});}})[_0x5e92('0x25')](function(_0x24febc){if(_0x285ebf){if(_0x24febc&&_0x24febc[_0x5e92('0x30')]){var _0x99996c=moment()[_0x5e92('0x31')](_0x5e92('0x32'));for(var _0x56033b=0x0,_0x141565=_0x24febc[_0x5e92('0x30')];_0x56033b<_0x141565;_0x56033b++){_0x24febc[_0x56033b][_0x5e92('0x33')]({'exitAt':_0x99996c});}}}})[_0x5e92('0x25')](function(){if(_0x285ebf){var _0x2ff18a=[];var _0x142873=utils[_0x5e92('0x34')]();_0x142873[_0x5e92('0x35')](function(_0x1b0ee6){_0x2ff18a[_0x5e92('0x36')]({'channel':_0x1b0ee6,'membername':_0x285ebf[_0x5e92('0x28')],'interface':_[_0x5e92('0x37')](_0x285ebf[_0x5e92('0x2b')])?util[_0x5e92('0x31')]('SIP/%s',_0x285ebf['name']):_0x285ebf[_0x5e92('0x2b')],'type':_0x5e92('0x2f'),'enterAt':moment()[_0x5e92('0x31')](_0x5e92('0x32')),'data1':_0x49528[_0x5e92('0x38')][_0x5e92('0x39')]||_0x5e92('0x3a'),'role':_0x285ebf[_0x5e92('0x29')],'internal':_0x285ebf[_0x5e92('0x2a')],'uniqueid':_0x49528['body'][_0x5e92('0x3b')]||null});});return db['MemberReport'][_0x5e92('0x3c')](_0x2ff18a,{'individualHooks':!![]});}})[_0x5e92('0x25')](function(){if(_0x285ebf){return _0x285ebf[_0x5e92('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x49528[_0x5e92('0x38')][_0x5e92('0x39')]||_0x5e92('0x3a'),'lastPauseAt':moment()[_0x5e92('0x31')](_0x5e92('0x32'))});}})[_0x5e92('0x25')](function(_0x59d4c6){_0x3a85b1(_0x59d4c6);})['catch'](function(_0x5b3037){_0x430aa5(_0x52812a[_0x5e92('0x15')](0x1f4,_0x5b3037['message']));});});};exports['UnpauseUser']=function(_0x3b6974){var _0x1bb5a3=this;return new Promise(function(_0xa57771,_0x572457){var _0x592a21;return db['User'][_0x5e92('0x3d')]({'where':_0x3b6974[_0x5e92('0x1b')][_0x5e92('0x1d')]||{},'attributes':['id',_0x5e92('0x28')]})[_0x5e92('0x25')](function(_0xb66c41){if(_0xb66c41){_0x592a21=_0xb66c41;if(_0x3b6974[_0x5e92('0x38')]['channel']&&!utils[_0x5e92('0x3e')](_0x3b6974['body'][_0x5e92('0x3f')])){throw new Error(_0x5e92('0x40'));}switch(_0x3b6974['body'][_0x5e92('0x3f')]){case'voice':return db[_0x5e92('0x2c')][_0x5e92('0x2d')]({'paused':0x0},{'where':{'UserId':_0x592a21['id']}})['then'](function(){return db[_0x5e92('0x2e')]['find']({'where':{'channel':_0x3b6974[_0x5e92('0x38')]['channel'],'membername':_0x592a21[_0x5e92('0x28')],'type':_0x5e92('0x2f'),'exitAt':null}});})[_0x5e92('0x25')](function(_0x2b554a){if(_0x2b554a){return _0x2b554a[_0x5e92('0x2d')]({'exitAt':moment()['format'](_0x5e92('0x32')),'data2':_0x5e92('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x592a21[_0x5e92('0x2d')]({'voicePause':![]});});case _0x5e92('0x42'):case _0x5e92('0x43'):case'fax':case'sms':case _0x5e92('0x44'):case _0x5e92('0x45'):return db[_0x5e92('0x2e')][_0x5e92('0x27')]({'where':{'channel':_0x3b6974[_0x5e92('0x38')][_0x5e92('0x3f')],'membername':_0x592a21[_0x5e92('0x28')],'type':_0x5e92('0x2f'),'exitAt':null}})[_0x5e92('0x25')](function(_0x19c8b4){return _0x19c8b4[_0x5e92('0x2d')]({'exitAt':moment()[_0x5e92('0x31')](_0x5e92('0x32')),'data2':_0x5e92('0x41')},{'individualHooks':!![]});})[_0x5e92('0x25')](function(){var _0x328d56={};_[_0x5e92('0x46')](_0x328d56,util['format'](_0x5e92('0x47'),_0x3b6974[_0x5e92('0x38')]['channel'],_0x5e92('0x48')),![]);return _0x592a21[_0x5e92('0x2d')](_0x328d56);});default:return db['UserVoiceQueueRt'][_0x5e92('0x2d')]({'paused':0x0},{'where':{'UserId':_0x592a21['id']}})['then'](function(){return db[_0x5e92('0x2e')][_0x5e92('0x1a')]({'where':{'membername':_0x592a21['name'],'type':_0x5e92('0x2f'),'exitAt':null}});})[_0x5e92('0x25')](function(_0x3b8891){var _0x262440=[];_0x3b8891[_0x5e92('0x35')](function(_0x1c6a6f){_0x262440[_0x5e92('0x36')](_0x1c6a6f['update']({'exitAt':moment()[_0x5e92('0x31')](_0x5e92('0x32')),'data2':_0x5e92('0x41')}));});return BPromise[_0x5e92('0x49')](_0x262440);})[_0x5e92('0x25')](function(){return _0x592a21[_0x5e92('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x4079f5){_0xa57771(_0x4079f5);})[_0x5e92('0x23')](function(_0x3ba960){_0x572457(_0x1bb5a3[_0x5e92('0x15')](0x1f4,_0x3ba960[_0x5e92('0x17')]));});});};exports[_0x5e92('0x4a')]=function(_0xc2cc9f){var _0x21eecb=this;return new Promise(function(_0x34c088,_0x372d2c){var _0x6dda9;return db[_0x5e92('0x19')]['findOne']({'where':_0xc2cc9f[_0x5e92('0x1b')][_0x5e92('0x1d')]||{},'attributes':['id','name']})[_0x5e92('0x25')](function(_0x53dac1){if(_0x53dac1){_0x6dda9=_0x53dac1;return db[_0x5e92('0x2c')]['destroy']({'where':{'membername':_0x6dda9[_0x5e92('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x6dda9){return db[_0x5e92('0x2e')][_0x5e92('0x1a')]({'where':{'membername':_0x6dda9[_0x5e92('0x28')],'exitAt':null}});}})[_0x5e92('0x25')](function(_0x3b6bd8){if(_0x6dda9){if(_0x3b6bd8&&_0x3b6bd8[_0x5e92('0x30')]){var _0x5f8a0d=[];_0x3b6bd8[_0x5e92('0x35')](function(_0xe71a37){_0x5f8a0d['push'](_0xe71a37['update']({'exitAt':moment()[_0x5e92('0x31')](_0x5e92('0x32'))}));});return BPromise[_0x5e92('0x49')](_0x5f8a0d);}}})['then'](function(){if(_0x6dda9){return _0x6dda9[_0x5e92('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5e92('0x25')](function(_0x57141c){_0x34c088(_0x57141c);})[_0x5e92('0x23')](function(_0x108704){_0x372d2c(_0x21eecb[_0x5e92('0x15')](0x1f4,_0x108704[_0x5e92('0x17')]));});});};exports[_0x5e92('0x4b')]=function(_0x49918a){var _0x5d43ff=this;return new Promise(function(_0x3899d2,_0x1f8af3){var _0x1d7226;var _0xa068ed;var _0x37d87f;var _0x4c52e9;return db[_0x5e92('0x19')][_0x5e92('0x3d')]({'where':_0x49918a[_0x5e92('0x1b')][_0x5e92('0x1d')]||{},'attributes':['id',_0x5e92('0x28'),_0x5e92('0x29'),_0x5e92('0x4c'),'phone','internal',_0x5e92('0x4d'),_0x5e92('0x2b')]})[_0x5e92('0x25')](function(_0x2fca36){if(_0x2fca36){_0x1d7226=_0x2fca36;_0x4c52e9=_0x49918a['body'][_0x5e92('0x2b')]?_0x49918a[_0x5e92('0x38')][_0x5e92('0x2b')]:util[_0x5e92('0x31')](_0x5e92('0x4e'),_0x1d7226[_0x5e92('0x28')]);return db[_0x5e92('0x19')][_0x5e92('0x4f')]({'where':{'role':_0x5e92('0x50'),'online':!![],'id':{'$ne':_0x1d7226['id']}}});}})[_0x5e92('0x25')](function(_0x19f11b){if(_0x19f11b){_0x37d87f=_0x19f11b;return require(_0x5e92('0x51'))[_0x5e92('0x52')]();}})['then'](function(_0x5eac2d){if(_0x5eac2d&&_0x5eac2d[_0x5e92('0x53')]&&_0x37d87f>=_0x5eac2d[_0x5e92('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5e92('0x25')](function(){if(_0x1d7226){return db['UserVoiceQueueRt'][_0x5e92('0x54')]({'where':{'membername':_0x1d7226['name']},'individualHooks':!![]});}})[_0x5e92('0x25')](function(){if(_0x1d7226){return _0x1d7226[_0x5e92('0x55')]({'raw':!![]});}})[_0x5e92('0x25')](function(_0x288e48){if(_0x1d7226){if(_0x288e48){var _0x36925a=[];_0xa068ed=_0x288e48;if(_0xa068ed[_0x5e92('0x30')]){for(var _0x4b779c=0x0;_0x4b779c<_0xa068ed['length'];_0x4b779c++){_0x36925a['push'](db[_0x5e92('0x2c')][_0x5e92('0x56')]({'membername':_0x1d7226[_0x5e92('0x28')],'UserId':_0x1d7226['id'],'queue_name':_0xa068ed[_0x4b779c][_0x5e92('0x28')],'VoiceQueueId':_0xa068ed[_0x4b779c]['id'],'interface':_0x4c52e9,'paused':_0x1d7226[_0x5e92('0x4d')]||![],'penalty':_0xa068ed[_0x4b779c][_0x5e92('0x57')]||0x0}));}return BPromise[_0x5e92('0x49')](_0x36925a);}}}})[_0x5e92('0x25')](function(){if(_0x1d7226){return db[_0x5e92('0x2e')][_0x5e92('0x1a')]({'where':{'membername':_0x1d7226[_0x5e92('0x28')],'exitAt':null}});}})[_0x5e92('0x25')](function(_0x3ac9a3){if(_0x1d7226){if(_0x3ac9a3&&_0x3ac9a3['length']){var _0x24dc42=[];_0x3ac9a3['forEach'](function(_0x482d5d){_0x24dc42[_0x5e92('0x36')](_0x482d5d[_0x5e92('0x2d')]({'exitAt':moment()['format'](_0x5e92('0x32'))}));});return BPromise[_0x5e92('0x49')](_0x24dc42);}}})[_0x5e92('0x25')](function(_0x3fb919){if(_0x1d7226){var _0x21e079=[];var _0x560cf3=[];var _0x459a1a=utils[_0x5e92('0x34')]();var _0x32b0db={'membername':_0x1d7226['name'],'interface':_0x4c52e9,'enterAt':moment()['format'](_0x5e92('0x32')),'role':_0x1d7226[_0x5e92('0x29')],'internal':_0x1d7226[_0x5e92('0x2a')]};_0x459a1a['forEach'](function(_0x3fb2c1){_0x21e079['push'](_[_0x5e92('0x58')]({'channel':_0x3fb2c1,'type':_0x5e92('0x59'),'data1':'callysquare','data2':_0x4c52e9},_0x32b0db));if(_0x1d7226[_0x5e92('0x4d')]){_0x560cf3[_0x5e92('0x36')](_['merge']({'channel':_0x3fb2c1,'type':'PAUSE','data1':_0x5e92('0x5a')},_0x32b0db));}});return db[_0x5e92('0x2e')]['bulkCreate'](_0x21e079[_0x5e92('0x5b')](_0x560cf3),{'individualHooks':!![]});}})[_0x5e92('0x25')](function(){if(_0x1d7226){return _0x1d7226[_0x5e92('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x5e92('0x31')](_0x5e92('0x32')),'voicePause':_0x1d7226['loginInPause']||![],'mailPause':_0x1d7226[_0x5e92('0x4d')]||![],'chatPause':_0x1d7226[_0x5e92('0x4d')]||![],'faxPause':_0x1d7226['loginInPause']||![],'smsPause':_0x1d7226[_0x5e92('0x4d')]||![],'openchannelPause':_0x1d7226['loginInPause']||![],'pauseType':_0x1d7226['loginInPause']?_0x5e92('0x5a'):null,'lastPauseAt':moment()['format'](_0x5e92('0x32')),'interface':_0x4c52e9});}})[_0x5e92('0x25')](function(_0x39a500){_0x3899d2(_0x39a500);})[_0x5e92('0x23')](function(_0x143563){_0x1f8af3(_0x5d43ff[_0x5e92('0x15')](0x1f4,_0x143563[_0x5e92('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f5397dd..a6e8820 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 _0xa809=['./user.events','save','update','removeListener','register','length','user:'];(function(_0xe63ea7,_0x3cb541){var _0x3177da=function(_0x9a6b5f){while(--_0x9a6b5f){_0xe63ea7['push'](_0xe63ea7['shift']());}};_0x3177da(++_0x3cb541);}(_0xa809,0x150));var _0x9a80=function(_0x2fd818,_0x5be2ea){_0x2fd818=_0x2fd818-0x0;var _0x42d1b2=_0xa809[_0x2fd818];return _0x42d1b2;};'use strict';var UserEvents=require(_0x9a80('0x0'));var events=[_0x9a80('0x1'),'remove',_0x9a80('0x2')];function createListener(_0x5c0e81,_0x41b360){return function(_0x41fd65){_0x41b360['emit'](_0x5c0e81,_0x41fd65);};}function removeListener(_0x2dd715,_0xde1751){return function(){UserEvents[_0x9a80('0x3')](_0x2dd715,_0xde1751);};}exports[_0x9a80('0x4')]=function(_0x173ef9){for(var _0xa9a157=0x0,_0x3e1f5b=events[_0x9a80('0x5')];_0xa9a157<_0x3e1f5b;_0xa9a157++){var _0x480129=events[_0xa9a157];var _0x4bbd80=createListener(_0x9a80('0x6')+_0x480129,_0x173ef9);UserEvents['on'](_0x480129,_0x4bbd80);}}; \ No newline at end of file +var _0x0e7b=['register','user:','./user.events','save','remove','emit','removeListener'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0x0e7b,0x1ad));var _0xb0e7=function(_0x3675e1,_0x30fa8e){_0x3675e1=_0x3675e1-0x0;var _0xd5e412=_0x0e7b[_0x3675e1];return _0xd5e412;};'use strict';var UserEvents=require(_0xb0e7('0x0'));var events=[_0xb0e7('0x1'),_0xb0e7('0x2'),'update'];function createListener(_0x517120,_0x547210){return function(_0x4e501f){_0x547210[_0xb0e7('0x3')](_0x517120,_0x4e501f);};}function removeListener(_0x32e69,_0x48108b){return function(){UserEvents[_0xb0e7('0x4')](_0x32e69,_0x48108b);};}exports[_0xb0e7('0x5')]=function(_0xb61ac9){for(var _0x201cca=0x0,_0x5a8e39=events['length'];_0x201cca<_0x5a8e39;_0x201cca++){var _0x679f51=events[_0x201cca];var _0x575aaf=createListener(_0xb0e7('0x6')+_0x679f51,_0xb61ac9);UserEvents['on'](_0x679f51,_0x575aaf);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2b51053..717e493 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x53b612,_0x38122b){var _0x4d4e07=function(_0x3d0b86){while(--_0x3d0b86){_0x53b612['push'](_0x53b612['shift']());}};_0x4d4e07(++_0x38122b);}(_0xedd9,0xfc));var _0x9edd=function(_0x228a3d,_0x5e163e){_0x228a3d=_0x228a3d-0x0;var _0x465ff6=_0xedd9[_0x228a3d];return _0x465ff6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 76d3fe0..d91cd8a 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 _0x277c=['INTEGER','sequelize'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x277c,0x153));var _0xc277=function(_0x3590e8,_0x27285c){_0x3590e8=_0x3590e8-0x0;var _0x125172=_0x277c[_0x3590e8];return _0x125172;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc277('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd1e2=['exports'];(function(_0x9ae07c,_0x4cba11){var _0x837b1f=function(_0x4f30a7){while(--_0x4f30a7){_0x9ae07c['push'](_0x9ae07c['shift']());}};_0x837b1f(++_0x4cba11);}(_0xd1e2,0x1c2));var _0x2d1e=function(_0x587bb0,_0xfc600f){_0x587bb0=_0x587bb0-0x0;var _0x456ccd=_0xd1e2[_0x587bb0];return _0x456ccd;};'use strict';var Sequelize=require('sequelize');module[_0x2d1e('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 e699fd9..d358b4e 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 _0x1f61=['request-promise','path','rimraf','../../config/environment','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x1f61,0x151));var _0x11f6=function(_0x50c9b7,_0x14f813){_0x50c9b7=_0x50c9b7-0x0;var _0x202f64=_0x1f61[_0x50c9b7];return _0x202f64;};'use strict';var _=require(_0x11f6('0x0'));var util=require(_0x11f6('0x1'));var logger=require(_0x11f6('0x2'))(_0x11f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x11f6('0x4'));var fs=require('fs');var path=require(_0x11f6('0x5'));var rimraf=require(_0x11f6('0x6'));var config=require(_0x11f6('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x11f6('0x8')]=function(_0x2d2ee7,_0x3e6f7a){return _0x2d2ee7[_0x11f6('0x9')]('UserChatQueue',attributes,{'tableName':_0x11f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4333=['rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b92cd,_0x382484){var _0x264e66=function(_0x4ee855){while(--_0x4ee855){_0x4b92cd['push'](_0x4b92cd['shift']());}};_0x264e66(++_0x382484);}(_0x4333,0xec));var _0x3433=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x4333[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x3433('0x0'));var util=require('util');var logger=require(_0x3433('0x1'))(_0x3433('0x2'));var moment=require(_0x3433('0x3'));var BPromise=require(_0x3433('0x4'));var rp=require(_0x3433('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3433('0x6'));var config=require(_0x3433('0x7'));var attributes=require(_0x3433('0x8'));module['exports']=function(_0x344b7a,_0x1b3f44){return _0x344b7a[_0x3433('0x9')](_0x3433('0xa'),attributes,{'tableName':'user_has_chat_queues','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 eb5e3f1..d96601a 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 _0xc2f7=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4ff2d6,_0x50caf2){var _0x146b0d=function(_0x2149b8){while(--_0x2149b8){_0x4ff2d6['push'](_0x4ff2d6['shift']());}};_0x146b0d(++_0x50caf2);}(_0xc2f7,0x7e));var _0x7c2f=function(_0x5b2042,_0x2d8aff){_0x5b2042=_0x5b2042-0x0;var _0x1c554f=_0xc2f7[_0x5b2042];return _0x1c554f;};'use strict';var _=require(_0x7c2f('0x0'));var util=require(_0x7c2f('0x1'));var moment=require(_0x7c2f('0x2'));var BPromise=require(_0x7c2f('0x3'));var rs=require(_0x7c2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c2f('0x6'))(_0x7c2f('0x7'));var config=require(_0x7c2f('0x8'));var jayson=require(_0x7c2f('0x9'));var client=jayson[_0x7c2f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c115,_0x4c6438,_0x21ff08){return new BPromise(function(_0x4b7027,_0x4335c9){return client['request'](_0x55c115,_0x21ff08)['then'](function(_0x16f62d){logger['info'](_0x7c2f('0xb'),_0x4c6438,_0x7c2f('0xc'));logger['debug'](_0x7c2f('0xd'),_0x4c6438,_0x7c2f('0xc'),JSON[_0x7c2f('0xe')](_0x16f62d));if(_0x16f62d[_0x7c2f('0xf')]){if(_0x16f62d['error']['code']===0x1f4){logger[_0x7c2f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x4c6438,_0x16f62d[_0x7c2f('0xf')][_0x7c2f('0x10')]);return _0x4335c9(_0x16f62d[_0x7c2f('0xf')][_0x7c2f('0x10')]);}logger[_0x7c2f('0xf')](_0x7c2f('0xb'),_0x4c6438,_0x16f62d['error']['message']);return _0x4b7027(_0x16f62d[_0x7c2f('0xf')]['message']);}else{logger['info'](_0x7c2f('0xb'),_0x4c6438,_0x7c2f('0xc'));_0x4b7027(_0x16f62d['result'][_0x7c2f('0x10')]);}})[_0x7c2f('0x11')](function(_0x537666){logger[_0x7c2f('0xf')](_0x7c2f('0xb'),_0x4c6438,_0x537666);_0x4335c9(_0x537666);});});} \ No newline at end of file +var _0xed65=['../../config/environment','jayson/promise','request','then','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x189cbc,_0x18aa5a){var _0x31d0db=function(_0x2d4280){while(--_0x2d4280){_0x189cbc['push'](_0x189cbc['shift']());}};_0x31d0db(++_0x18aa5a);}(_0xed65,0x150));var _0x5ed6=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xed65[_0x4179e2];return _0x24cb50;};'use strict';var _=require(_0x5ed6('0x0'));var util=require(_0x5ed6('0x1'));var moment=require(_0x5ed6('0x2'));var BPromise=require(_0x5ed6('0x3'));var rs=require(_0x5ed6('0x4'));var fs=require('fs');var Redis=require(_0x5ed6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ed6('0x6'));var logger=require(_0x5ed6('0x7'))(_0x5ed6('0x8'));var config=require(_0x5ed6('0x9'));var jayson=require(_0x5ed6('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1103c6,_0x2f7b66,_0x10fe77){return new BPromise(function(_0x19b59a,_0x2e2674){return client[_0x5ed6('0xb')](_0x1103c6,_0x10fe77)[_0x5ed6('0xc')](function(_0x72e29b){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2f7b66,_0x5ed6('0xd'));logger['debug'](_0x5ed6('0xe'),_0x2f7b66,_0x5ed6('0xd'),JSON[_0x5ed6('0xf')](_0x72e29b));if(_0x72e29b['error']){if(_0x72e29b[_0x5ed6('0x10')][_0x5ed6('0x11')]===0x1f4){logger[_0x5ed6('0x10')](_0x5ed6('0x12'),_0x2f7b66,_0x72e29b[_0x5ed6('0x10')][_0x5ed6('0x13')]);return _0x2e2674(_0x72e29b[_0x5ed6('0x10')]['message']);}logger[_0x5ed6('0x10')](_0x5ed6('0x12'),_0x2f7b66,_0x72e29b[_0x5ed6('0x10')]['message']);return _0x19b59a(_0x72e29b[_0x5ed6('0x10')][_0x5ed6('0x13')]);}else{logger[_0x5ed6('0x14')]('UserChatQueue,\x20%s,\x20%s',_0x2f7b66,_0x5ed6('0xd'));_0x19b59a(_0x72e29b[_0x5ed6('0x15')]['message']);}})[_0x5ed6('0x16')](function(_0x2a4356){logger[_0x5ed6('0x10')](_0x5ed6('0x12'),_0x2f7b66,_0x2a4356);_0x2e2674(_0x2a4356);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e9170e7..fd3d1d8 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4a7fb1,_0x2d4ea2){var _0x494daf=function(_0x290f11){while(--_0x290f11){_0x4a7fb1['push'](_0x4a7fb1['shift']());}};_0x494daf(++_0x2d4ea2);}(_0x70e0,0x17b));var _0x070e=function(_0x5ef5dc,_0x41a915){_0x5ef5dc=_0x5ef5dc-0x0;var _0x3d381e=_0x70e0[_0x5ef5dc];return _0x3d381e;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x48478f,_0x537acd){var _0x10af50=function(_0x4cf0ac){while(--_0x4cf0ac){_0x48478f['push'](_0x48478f['shift']());}};_0x10af50(++_0x537acd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 a7f715b..53b41a6 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 _0xb00b=['exports','INTEGER','STRING'];(function(_0x38eaa0,_0x51ce21){var _0x7e86f8=function(_0x53bc33){while(--_0x53bc33){_0x38eaa0['push'](_0x38eaa0['shift']());}};_0x7e86f8(++_0x51ce21);}(_0xb00b,0x1e9));var _0xbb00=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xb00b[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require('sequelize');module[_0xbb00('0x0')]={'penalty':{'type':Sequelize[_0xbb00('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb00('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbb00('0x2')]}}; \ No newline at end of file +var _0x2263=['exports','INTEGER','STRING'];(function(_0x57db66,_0x1ae171){var _0x3f9a38=function(_0x381617){while(--_0x381617){_0x57db66['push'](_0x57db66['shift']());}};_0x3f9a38(++_0x1ae171);}(_0x2263,0x171));var _0x3226=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x2263[_0x3a21c0];return _0x411e84;};'use strict';var Sequelize=require('sequelize');module[_0x3226('0x0')]={'penalty':{'type':Sequelize[_0x3226('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3226('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8951132..49e0e37 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 _0xa9e9=['bluebird','request-promise','rimraf','./userFaxQueue.attributes','lodash','util','../../config/logger','api','moment'];(function(_0x557022,_0x5194db){var _0x12693f=function(_0x2e7474){while(--_0x2e7474){_0x557022['push'](_0x557022['shift']());}};_0x12693f(++_0x5194db);}(_0xa9e9,0x1cf));var _0x9a9e=function(_0x52564d,_0x4d5f48){_0x52564d=_0x52564d-0x0;var _0x3f1406=_0xa9e9[_0x52564d];return _0x3f1406;};'use strict';var _=require(_0x9a9e('0x0'));var util=require(_0x9a9e('0x1'));var logger=require(_0x9a9e('0x2'))(_0x9a9e('0x3'));var moment=require(_0x9a9e('0x4'));var BPromise=require(_0x9a9e('0x5'));var rp=require(_0x9a9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a9e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a9e('0x8'));module['exports']=function(_0x5c2a1d,_0x16f1a5){return _0x5c2a1d['define']('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a53=['api','moment','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x1a53,0xf8));var _0x31a5=function(_0x26bcc5,_0x224d17){_0x26bcc5=_0x26bcc5-0x0;var _0x57c217=_0x1a53[_0x26bcc5];return _0x57c217;};'use strict';var _=require(_0x31a5('0x0'));var util=require(_0x31a5('0x1'));var logger=require('../../config/logger')(_0x31a5('0x2'));var moment=require(_0x31a5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x31a5('0x4'));var rimraf=require(_0x31a5('0x5'));var config=require(_0x31a5('0x6'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x20cbfe,_0x1f4b57){return _0x20cbfe[_0x31a5('0x7')](_0x31a5('0x8'),attributes,{'tableName':_0x31a5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c2f3fe6..d3fbbf6 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 _0xc51c=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x48d569,_0x53c633){var _0x283621=function(_0x19f791){while(--_0x19f791){_0x48d569['push'](_0x48d569['shift']());}};_0x283621(++_0x53c633);}(_0xc51c,0x1b8));var _0xcc51=function(_0x1bff3b,_0x4df499){_0x1bff3b=_0x1bff3b-0x0;var _0x5cc86b=_0xc51c[_0x1bff3b];return _0x5cc86b;};'use strict';var _=require(_0xcc51('0x0'));var util=require(_0xcc51('0x1'));var moment=require(_0xcc51('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc51('0x3'));var fs=require('fs');var Redis=require(_0xcc51('0x4'));var db=require(_0xcc51('0x5'))['db'];var utils=require(_0xcc51('0x6'));var logger=require(_0xcc51('0x7'))(_0xcc51('0x8'));var config=require('../../config/environment');var jayson=require(_0xcc51('0x9'));var client=jayson['client'][_0xcc51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd0bcc4,_0xa9083f,_0x22f3ae){return new BPromise(function(_0x2eee5c,_0x67c1dc){return client['request'](_0xd0bcc4,_0x22f3ae)[_0xcc51('0xb')](function(_0x577172){logger[_0xcc51('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0xa9083f,_0xcc51('0xd'));logger[_0xcc51('0xe')](_0xcc51('0xf'),_0xa9083f,'request\x20sent',JSON[_0xcc51('0x10')](_0x577172));if(_0x577172[_0xcc51('0x11')]){if(_0x577172[_0xcc51('0x11')]['code']===0x1f4){logger[_0xcc51('0x11')](_0xcc51('0x12'),_0xa9083f,_0x577172[_0xcc51('0x11')][_0xcc51('0x13')]);return _0x67c1dc(_0x577172[_0xcc51('0x11')]['message']);}logger[_0xcc51('0x11')](_0xcc51('0x12'),_0xa9083f,_0x577172[_0xcc51('0x11')][_0xcc51('0x13')]);return _0x2eee5c(_0x577172['error'][_0xcc51('0x13')]);}else{logger[_0xcc51('0xc')](_0xcc51('0x12'),_0xa9083f,'request\x20sent');_0x2eee5c(_0x577172[_0xcc51('0x14')][_0xcc51('0x13')]);}})[_0xcc51('0x15')](function(_0x29fd05){logger[_0xcc51('0x11')](_0xcc51('0x12'),_0xa9083f,_0x29fd05);_0x67c1dc(_0x29fd05);});});} \ No newline at end of file +var _0x86bf=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0x86bf,0x135));var _0xf86b=function(_0x5aa2b2,_0x360e2f){_0x5aa2b2=_0x5aa2b2-0x0;var _0x5af357=_0x86bf[_0x5aa2b2];return _0x5af357;};'use strict';var _=require(_0xf86b('0x0'));var util=require('util');var moment=require(_0xf86b('0x1'));var BPromise=require(_0xf86b('0x2'));var rs=require(_0xf86b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf86b('0x4'))['db'];var utils=require(_0xf86b('0x5'));var logger=require(_0xf86b('0x6'))(_0xf86b('0x7'));var config=require(_0xf86b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf86b('0x9')][_0xf86b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a1734,_0x3c01c9,_0x3a671c){return new BPromise(function(_0x4d3126,_0x3c65ee){return client[_0xf86b('0xb')](_0x4a1734,_0x3a671c)[_0xf86b('0xc')](function(_0x1399db){logger[_0xf86b('0xd')](_0xf86b('0xe'),_0x3c01c9,_0xf86b('0xf'));logger[_0xf86b('0x10')](_0xf86b('0x11'),_0x3c01c9,_0xf86b('0xf'),JSON['stringify'](_0x1399db));if(_0x1399db[_0xf86b('0x12')]){if(_0x1399db['error']['code']===0x1f4){logger[_0xf86b('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3c01c9,_0x1399db[_0xf86b('0x12')][_0xf86b('0x13')]);return _0x3c65ee(_0x1399db[_0xf86b('0x12')][_0xf86b('0x13')]);}logger[_0xf86b('0x12')](_0xf86b('0xe'),_0x3c01c9,_0x1399db[_0xf86b('0x12')]['message']);return _0x4d3126(_0x1399db[_0xf86b('0x12')]['message']);}else{logger[_0xf86b('0xd')](_0xf86b('0xe'),_0x3c01c9,_0xf86b('0xf'));_0x4d3126(_0x1399db['result']['message']);}})[_0xf86b('0x14')](function(_0x25546a){logger[_0xf86b('0x12')](_0xf86b('0xe'),_0x3c01c9,_0x25546a);_0x3c65ee(_0x25546a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6c46a99..207fd60 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c37bc,_0x155be9){var _0xe93cff=function(_0xa48bd8){while(--_0xa48bd8){_0x1c37bc['push'](_0x1c37bc['shift']());}};_0xe93cff(++_0x155be9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5eda20,_0x3936f1){var _0x57e158=function(_0x27d6e6){while(--_0x27d6e6){_0x5eda20['push'](_0x5eda20['shift']());}};_0x57e158(++_0x3936f1);}(_0x70e0,0x17b));var _0x070e=function(_0x24ac57,_0x657772){_0x24ac57=_0x24ac57-0x0;var _0x1af787=_0x70e0[_0x24ac57];return _0x1af787;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7d40a80..a7f6335 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 _0x3a96=['sequelize','INTEGER'];(function(_0x5b8262,_0x93ab76){var _0x21f734=function(_0x2e9df6){while(--_0x2e9df6){_0x5b8262['push'](_0x5b8262['shift']());}};_0x21f734(++_0x93ab76);}(_0x3a96,0x1b2));var _0x63a9=function(_0x1c4995,_0x3e61d6){_0x1c4995=_0x1c4995-0x0;var _0x40baff=_0x3a96[_0x1c4995];return _0x40baff;};'use strict';var Sequelize=require(_0x63a9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x63a9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x887d=['exports','INTEGER','sequelize'];(function(_0x54d431,_0x34796a){var _0x261d45=function(_0x3555ed){while(--_0x3555ed){_0x54d431['push'](_0x54d431['shift']());}};_0x261d45(++_0x34796a);}(_0x887d,0x19d));var _0xd887=function(_0x1235a0,_0x30dc1f){_0x1235a0=_0x1235a0-0x0;var _0x3029f2=_0x887d[_0x1235a0];return _0x3029f2;};'use strict';var Sequelize=require(_0xd887('0x0'));module[_0xd887('0x1')]={'penalty':{'type':Sequelize[_0xd887('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 9c6b271..ce4389b 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 _0x3b8d=['define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','exports'];(function(_0x472e97,_0x1c7e44){var _0x26bed6=function(_0x2ec4fb){while(--_0x2ec4fb){_0x472e97['push'](_0x472e97['shift']());}};_0x26bed6(++_0x1c7e44);}(_0x3b8d,0x13b));var _0xd3b8=function(_0x38c8b1,_0x1e6609){_0x38c8b1=_0x38c8b1-0x0;var _0x207f22=_0x3b8d[_0x38c8b1];return _0x207f22;};'use strict';var _=require(_0xd3b8('0x0'));var util=require(_0xd3b8('0x1'));var logger=require(_0xd3b8('0x2'))('api');var moment=require(_0xd3b8('0x3'));var BPromise=require(_0xd3b8('0x4'));var rp=require(_0xd3b8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3b8('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3b8('0x7'));module[_0xd3b8('0x8')]=function(_0x12586e,_0x50aa08){return _0x12586e[_0xd3b8('0x9')](_0xd3b8('0xa'),attributes,{'tableName':_0xd3b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb5=['bluebird','request-promise','rimraf','./userMailQueue.attributes','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5eb5,0x1a8));var _0x55eb=function(_0x52b6a5,_0x17379e){_0x52b6a5=_0x52b6a5-0x0;var _0x18624f=_0x5eb5[_0x52b6a5];return _0x18624f;};'use strict';var _=require(_0x55eb('0x0'));var util=require(_0x55eb('0x1'));var logger=require(_0x55eb('0x2'))(_0x55eb('0x3'));var moment=require(_0x55eb('0x4'));var BPromise=require(_0x55eb('0x5'));var rp=require(_0x55eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55eb('0x7'));var config=require('../../config/environment');var attributes=require(_0x55eb('0x8'));module['exports']=function(_0x1537ca,_0x5664a2){return _0x1537ca[_0x55eb('0x9')]('UserMailQueue',attributes,{'tableName':_0x55eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index edf18ff..0d0b211 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4899da,_0x4390ae){_0x4899da=_0x4899da-0x0;var _0x34043a=_0x1cb9[_0x4899da];return _0x34043a;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3a6fdb,_0x26b427){_0x3a6fdb=_0x3a6fdb-0x0;var _0x3cbc9f=_0x1cb9[_0x3a6fdb];return _0x3cbc9f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 287b295..9f63dc7 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 _0x89c8=['sendUserNotification','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x15ec9f,_0x3383eb){var _0x3d54dc=function(_0x3cc039){while(--_0x3cc039){_0x15ec9f['push'](_0x15ec9f['shift']());}};_0x3d54dc(++_0x3383eb);}(_0x89c8,0x115));var _0x889c=function(_0x4129c0,_0x13a7ec){_0x4129c0=_0x4129c0-0x0;var _0x3af7e7=_0x89c8[_0x4129c0];return _0x3af7e7;};'use strict';var multer=require(_0x889c('0x0'));var util=require(_0x889c('0x1'));var path=require(_0x889c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x889c('0x3')]();var fs_extra=require(_0x889c('0x4'));var auth=require(_0x889c('0x5'));var interaction=require(_0x889c('0x6'));var config=require(_0x889c('0x7'));var controller=require(_0x889c('0x8'));router[_0x889c('0x9')]('/',auth[_0x889c('0xa')](),controller[_0x889c('0xb')]);module['exports']=router; \ No newline at end of file +var _0xf35b=['express','fs-extra','../../components/interaction/service','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout'];(function(_0x5870c1,_0x173ba3){var _0x344685=function(_0x1984be){while(--_0x1984be){_0x5870c1['push'](_0x5870c1['shift']());}};_0x344685(++_0x173ba3);}(_0xf35b,0x6a));var _0xbf35=function(_0x166f82,_0x273733){_0x166f82=_0x166f82-0x0;var _0x2ebfda=_0xf35b[_0x166f82];return _0x2ebfda;};'use strict';var multer=require(_0xbf35('0x0'));var util=require(_0xbf35('0x1'));var path=require(_0xbf35('0x2'));var timeout=require(_0xbf35('0x3'));var express=require(_0xbf35('0x4'));var router=express['Router']();var fs_extra=require(_0xbf35('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf35('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0xbf35('0x7')]('/',auth[_0xbf35('0x8')](),controller[_0xbf35('0x9')]);module[_0xbf35('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 f4348b2..e191545 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 _0x061f=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2550d4,_0x400724){var _0x2cf1a8=function(_0x55f6b2){while(--_0x55f6b2){_0x2550d4['push'](_0x2550d4['shift']());}};_0x2cf1a8(++_0x400724);}(_0x061f,0x161));var _0xf061=function(_0x23adea,_0x109cd8){_0x23adea=_0x23adea-0x0;var _0x5d6587=_0x061f[_0x23adea];return _0x5d6587;};'use strict';var Sequelize=require(_0xf061('0x0'));module[_0xf061('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xf061('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xf061('0x2')]},'beep':{'type':Sequelize[_0xf061('0x3')]}}; \ No newline at end of file +var _0x3112=['BOOLEAN','exports','TEXT'];(function(_0x30baff,_0x1d19e0){var _0x3e6eb7=function(_0x2bce58){while(--_0x2bce58){_0x30baff['push'](_0x30baff['shift']());}};_0x3e6eb7(++_0x1d19e0);}(_0x3112,0x91));var _0x2311=function(_0x177c62,_0x38b4b8){_0x177c62=_0x177c62-0x0;var _0x2ebdc5=_0x3112[_0x177c62];return _0x2ebdc5;};'use strict';var Sequelize=require('sequelize');module[_0x2311('0x0')]={'body':{'type':Sequelize[_0x2311('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x2311('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2311('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e560053..b1dd9c2 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 _0xef1d=['Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','queue','Queue','ids','all','flatten','getAgents','map','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','sendUserNotification','body','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','senderName','user','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html'];(function(_0x3246e2,_0x337736){var _0x128728=function(_0x13e97d){while(--_0x13e97d){_0x3246e2['push'](_0x3246e2['shift']());}};_0x128728(++_0x337736);}(_0xef1d,0x12e));var _0xdef1=function(_0x379864,_0x2b5bf9){_0x379864=_0x379864-0x0;var _0x33946f=_0xef1d[_0x379864];return _0x33946f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdef1('0x0'));var jsonpatch=require(_0xdef1('0x1'));var rp=require(_0xdef1('0x2'));var moment=require(_0xdef1('0x3'));var BPromise=require(_0xdef1('0x4'));var Mustache=require(_0xdef1('0x5'));var util=require(_0xdef1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xdef1('0x7'));var ejs=require(_0xdef1('0x8'));var fs=require('fs');var fs_extra=require(_0xdef1('0x9'));var _=require(_0xdef1('0xa'));var squel=require(_0xdef1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdef1('0xc'));var toCsv=require(_0xdef1('0x7'));var querystring=require(_0xdef1('0xd'));var Papa=require(_0xdef1('0xe'));var Redis=require(_0xdef1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdef1('0x10'));var as=require(_0xdef1('0x11'));var hardwareService=require(_0xdef1('0x12'));var logger=require(_0xdef1('0x13'))(_0xdef1('0x14'));var utils=require(_0xdef1('0x15'));var config=require(_0xdef1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdef1('0x17'))['db'];config['redis']=_[_0xdef1('0x18')](config[_0xdef1('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdef1('0x1a'))(new Redis(config[_0xdef1('0x19')]));require('./userNotification.socket')[_0xdef1('0x1b')](socket);function respondWithStatusCode(_0x157d6e,_0x42355d){_0x42355d=_0x42355d||0xcc;return function(_0x4528e8){if(_0x4528e8){return _0x157d6e[_0xdef1('0x1c')](_0x42355d);}return _0x157d6e['status'](_0x42355d)[_0xdef1('0x1d')]();};}function respondWithResult(_0x4011bb,_0x413b0a){_0x413b0a=_0x413b0a||0xc8;return function(_0x4acef5){if(_0x4acef5){return _0x4011bb[_0xdef1('0x1e')](_0x413b0a)[_0xdef1('0x1f')](_0x4acef5);}};}function respondWithFilteredResult(_0x4047b5,_0x33dbce){return function(_0x1e9c7f){if(_0x1e9c7f){var _0x2022fe=typeof _0x33dbce[_0xdef1('0x20')]===_0xdef1('0x21')&&typeof _0x33dbce[_0xdef1('0x22')]==='undefined';var _0x564368=_0x1e9c7f[_0xdef1('0x23')];var _0x446303=_0x2022fe?0x0:_0x33dbce[_0xdef1('0x20')];var _0x24caee=_0x2022fe?_0x1e9c7f[_0xdef1('0x23')]:_0x33dbce[_0xdef1('0x20')]+_0x33dbce[_0xdef1('0x22')];var _0x444db5;if(_0x24caee>=_0x564368){_0x24caee=_0x564368;_0x444db5=0xc8;}else{_0x444db5=0xce;}_0x4047b5[_0xdef1('0x1e')](_0x444db5);return _0x4047b5[_0xdef1('0x24')](_0xdef1('0x25'),_0x446303+'-'+_0x24caee+'/'+_0x564368)['json'](_0x1e9c7f);}return null;};}function patchUpdates(_0x2d17fa){return function(_0x283b5b){try{jsonpatch[_0xdef1('0x26')](_0x283b5b,_0x2d17fa,!![]);}catch(_0x5dcab8){return BPromise[_0xdef1('0x27')](_0x5dcab8);}return _0x283b5b[_0xdef1('0x28')]();};}function saveUpdates(_0x1f50e6,_0x5068d9){return function(_0x5181c3){if(_0x5181c3){return _0x5181c3[_0xdef1('0x29')](_0x1f50e6)['then'](function(_0x10fdd5){return _0x10fdd5;});}return null;};}function removeEntity(_0x283300,_0x157acd){return function(_0x1073dc){if(_0x1073dc){return _0x1073dc[_0xdef1('0x2a')]()[_0xdef1('0x2b')](function(){_0x283300[_0xdef1('0x1e')](0xcc)[_0xdef1('0x1d')]();});}};}function handleEntityNotFound(_0x1789e5,_0x552c2b){return function(_0x2be20e){if(!_0x2be20e){_0x1789e5['sendStatus'](0x194);}return _0x2be20e;};}function handleError(_0x382a5a,_0x587c85){_0x587c85=_0x587c85||0x1f4;return function(_0x5921df){logger[_0xdef1('0x2c')](_0x5921df[_0xdef1('0x2d')]);if(_0x5921df[_0xdef1('0x2e')]){delete _0x5921df[_0xdef1('0x2e')];}_0x382a5a[_0xdef1('0x1e')](_0x587c85)['send'](_0x5921df);};}exports[_0xdef1('0x2f')]=function(_0xfbc4e0,_0x2cfb81,_0x419214){if(!_0xfbc4e0[_0xdef1('0x30')]['hasOwnProperty'](_0xdef1('0x31'))&&!_0xfbc4e0['body']['hasOwnProperty'](_0xdef1('0x32'))){throw new db[(_0xdef1('0x33'))][(_0xdef1('0x34'))](_0xdef1('0x35'));}else{if(_0xfbc4e0['body'][_0xdef1('0x36')](_0xdef1('0x32'))&&!_0xfbc4e0['body'][_0xdef1('0x36')](_0xdef1('0x37'))){throw new db[(_0xdef1('0x33'))][(_0xdef1('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xfbc4e0[_0xdef1('0x30')][_0xdef1('0x36')](_0xdef1('0x38'))){throw new db[(_0xdef1('0x33'))][(_0xdef1('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4aed5a=JSON['parse'](_0xfbc4e0[_0xdef1('0x30')]['recipients']);}catch(_0x358587){logger[_0xdef1('0x2c')](_0x358587);throw new db[(_0xdef1('0x33'))][(_0xdef1('0x34'))](_0xdef1('0x39'));}var _0xd4c968=['chatqueue',_0xdef1('0x3a'),'mailqueue',_0xdef1('0x3b'),'smsqueue',_0xdef1('0x3c'),_0xdef1('0x3d'),_0xdef1('0x3e'),'user'];if(_[_0xdef1('0x3f')](_0x4aed5a,function(_0x102356){return!_[_0xdef1('0x40')](_0xd4c968,_0x102356[_0xdef1('0x41')]['toLowerCase']());})){throw new db[(_0xdef1('0x33'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x251b4e={};_0x251b4e['senderName']=_0xfbc4e0[_0xdef1('0x30')][_0xdef1('0x36')](_0xdef1('0x42'))?_0xfbc4e0[_0xdef1('0x30')]['senderName']:_0xfbc4e0[_0xdef1('0x43')]['fullname'];_0x251b4e[_0xdef1('0x44')]=_[_0xdef1('0x45')](_0xfbc4e0['body'][_0xdef1('0x44')])?null:_0xfbc4e0['body'][_0xdef1('0x44')];_0x251b4e[_0xdef1('0x46')]=_0xfbc4e0[_0xdef1('0x30')]['beep']||![];_0x251b4e[_0xdef1('0x47')]=_0xfbc4e0[_0xdef1('0x43')]['id'];return getContent(_0xfbc4e0[_0xdef1('0x30')])['then'](function(_0x32af0f){_0x251b4e['body']=_0x32af0f;return getRecipients(_0x4aed5a);})[_0xdef1('0x2b')](function(_0x5b58e8){_0x251b4e['recipientsId']=_[_0xdef1('0x48')](_0x5b58e8)[_0xdef1('0x49')](',');return db[_0xdef1('0x4a')][_0xdef1('0x4b')](function(_0x265a60){return db[_0xdef1('0x4c')][_0xdef1('0x4d')](_0x251b4e,{'raw':!![],'transaction':_0x265a60})[_0xdef1('0x2b')](function(_0x567c92){var _0x1a2029={'sender':_0x251b4e[_0xdef1('0x42')],'description':_0x251b4e[_0xdef1('0x44')],'content':_0x251b4e[_0xdef1('0x30')],'beep':_0x251b4e['beep']};_0x5b58e8[_0xdef1('0x4e')](function(_0x2683e2){_0x1a2029[_0xdef1('0x4f')]=_0x2683e2;socket[_0xdef1('0x50')](_0xdef1('0x51'),_0x1a2029);});return _0x567c92;});});})[_0xdef1('0x2b')](respondWithResult(_0x2cfb81,0xc9))[_0xdef1('0x52')](handleError(_0x2cfb81,null));};function getContent(_0x965282){return new BPromise(function(_0x197ac9,_0x53b006){if(_0x965282[_0xdef1('0x31')]){_0x197ac9(_0x965282[_0xdef1('0x31')]);return;}return db[_0xdef1('0x53')][_0xdef1('0x54')]({'attributes':[_0xdef1('0x55')],'where':{'id':_0x965282[_0xdef1('0x32')]},'raw':!![]})['then'](function(_0x38b323){if(!_0x38b323)throw new db[(_0xdef1('0x33'))]['ValidationError'](_0xdef1('0x56'));var _0x9f6148=Mustache[_0xdef1('0x57')](_0x38b323[_0xdef1('0x55')],_0x965282['view']);_0x197ac9(_0x9f6148);})[_0xdef1('0x52')](function(_0x301898){_0x53b006(_0x301898);});});}function getRecipients(_0x42da77){return new BPromise(function(_0x350eb6,_0x32037f){var _0x9c5aee=[];var _0x371798=[];_0x42da77[_0xdef1('0x4e')](function(_0x2cfc6d){var _0x593ea5=_[_0xdef1('0x58')](_0x2cfc6d[_0xdef1('0x41')]['toLowerCase']());if(_0x593ea5==='User'){_0x9c5aee=_[_0xdef1('0x59')](_0x9c5aee,_0x2cfc6d['ids']);}else{if(_['includes'](_0x593ea5,_0xdef1('0x5a')))_0x593ea5=_0x593ea5['replace']('queue',_0xdef1('0x5b'));_0x2cfc6d[_0xdef1('0x5c')]['forEach'](function(_0x314b8e){_0x371798['push'](getAgents(_0x593ea5,_0x314b8e));});}});return BPromise[_0xdef1('0x5d')](_0x371798)[_0xdef1('0x2b')](function(_0x37cd0e){_0x9c5aee=_[_0xdef1('0x59')](_0x9c5aee,_[_0xdef1('0x5e')](_0x37cd0e));_0x350eb6(_0x9c5aee);})['catch'](function(_0x2fface){_0x32037f(_0x2fface);});});}function getAgents(_0x199e63,_0x258d33){return new BPromise(function(_0x21235f,_0x41c0d1){return db[_0x199e63][_0xdef1('0x54')]({'where':{'id':_0x258d33}})[_0xdef1('0x2b')](function(_0x533c37){return _0x533c37[_0xdef1('0x5f')]({'attributes':['id'],'raw':!![]})[_0xdef1('0x2b')](function(_0x4b88ce){var _0x57a141=_[_0xdef1('0x60')](_0x4b88ce,'id');_0x21235f(_0x57a141);});})['catch'](function(_0x596957){_0x41c0d1(_0x596957);});});} \ No newline at end of file +var _0xbb41=['union','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','team','user','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','forEach','startCase','toLowerCase','queue','replace','Queue','ids','push','all'];(function(_0x3a4db2,_0x40ee85){var _0x54b20e=function(_0x5321aa){while(--_0x5321aa){_0x3a4db2['push'](_0x3a4db2['shift']());}};_0x54b20e(++_0x40ee85);}(_0xbb41,0x194));var _0x1bb4=function(_0xb84520,_0x23ce94){_0xb84520=_0xb84520-0x0;var _0x5848c1=_0xbb41[_0xb84520];return _0x5848c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1bb4('0x0'));var zipdir=require(_0x1bb4('0x1'));var jsonpatch=require(_0x1bb4('0x2'));var rp=require(_0x1bb4('0x3'));var moment=require('moment');var BPromise=require(_0x1bb4('0x4'));var Mustache=require(_0x1bb4('0x5'));var util=require(_0x1bb4('0x6'));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(_0x1bb4('0x7'));var _=require(_0x1bb4('0x8'));var squel=require(_0x1bb4('0x9'));var crypto=require(_0x1bb4('0xa'));var jsforce=require(_0x1bb4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1bb4('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1bb4('0xd'));var authService=require(_0x1bb4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1bb4('0xf'));var hardwareService=require(_0x1bb4('0x10'));var logger=require(_0x1bb4('0x11'))(_0x1bb4('0x12'));var utils=require(_0x1bb4('0x13'));var config=require(_0x1bb4('0x14'));var licenseUtil=require(_0x1bb4('0x15'));var db=require(_0x1bb4('0x16'))['db'];config[_0x1bb4('0x17')]=_[_0x1bb4('0x18')](config[_0x1bb4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bb4('0x19'))(new Redis(config[_0x1bb4('0x17')]));require(_0x1bb4('0x1a'))[_0x1bb4('0x1b')](socket);function respondWithStatusCode(_0x1481e3,_0x429033){_0x429033=_0x429033||0xcc;return function(_0x57555a){if(_0x57555a){return _0x1481e3[_0x1bb4('0x1c')](_0x429033);}return _0x1481e3['status'](_0x429033)[_0x1bb4('0x1d')]();};}function respondWithResult(_0x116652,_0x4f40ae){_0x4f40ae=_0x4f40ae||0xc8;return function(_0xff61b8){if(_0xff61b8){return _0x116652['status'](_0x4f40ae)[_0x1bb4('0x1e')](_0xff61b8);}};}function respondWithFilteredResult(_0x51fd09,_0x4d8746){return function(_0x281dd5){if(_0x281dd5){var _0x3346a4=typeof _0x4d8746[_0x1bb4('0x1f')]===_0x1bb4('0x20')&&typeof _0x4d8746['limit']===_0x1bb4('0x20');var _0x4799f1=_0x281dd5['count'];var _0x1f519e=_0x3346a4?0x0:_0x4d8746[_0x1bb4('0x1f')];var _0x19b5f1=_0x3346a4?_0x281dd5[_0x1bb4('0x21')]:_0x4d8746['offset']+_0x4d8746[_0x1bb4('0x22')];var _0x18e5b8;if(_0x19b5f1>=_0x4799f1){_0x19b5f1=_0x4799f1;_0x18e5b8=0xc8;}else{_0x18e5b8=0xce;}_0x51fd09[_0x1bb4('0x23')](_0x18e5b8);return _0x51fd09[_0x1bb4('0x24')](_0x1bb4('0x25'),_0x1f519e+'-'+_0x19b5f1+'/'+_0x4799f1)[_0x1bb4('0x1e')](_0x281dd5);}return null;};}function patchUpdates(_0x4e7b6a){return function(_0x283b1e){try{jsonpatch[_0x1bb4('0x26')](_0x283b1e,_0x4e7b6a,!![]);}catch(_0x5be4d8){return BPromise['reject'](_0x5be4d8);}return _0x283b1e[_0x1bb4('0x27')]();};}function saveUpdates(_0x25d815,_0x5e384a){return function(_0x6242a7){if(_0x6242a7){return _0x6242a7[_0x1bb4('0x28')](_0x25d815)[_0x1bb4('0x29')](function(_0x3a6d87){return _0x3a6d87;});}return null;};}function removeEntity(_0xb33148,_0x2ea891){return function(_0x506b2b){if(_0x506b2b){return _0x506b2b[_0x1bb4('0x2a')]()[_0x1bb4('0x29')](function(){_0xb33148[_0x1bb4('0x23')](0xcc)[_0x1bb4('0x1d')]();});}};}function handleEntityNotFound(_0x4dc1be,_0x38645e){return function(_0x545e72){if(!_0x545e72){_0x4dc1be[_0x1bb4('0x1c')](0x194);}return _0x545e72;};}function handleError(_0x2deb85,_0x469106){_0x469106=_0x469106||0x1f4;return function(_0x34ef67){logger[_0x1bb4('0x2b')](_0x34ef67[_0x1bb4('0x2c')]);if(_0x34ef67[_0x1bb4('0x2d')]){delete _0x34ef67['name'];}_0x2deb85[_0x1bb4('0x23')](_0x469106)[_0x1bb4('0x2e')](_0x34ef67);};}exports[_0x1bb4('0x2f')]=function(_0x3ce0cb,_0x119608,_0x3f0943){if(!_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x31')](_0x1bb4('0x32'))&&!_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x31')](_0x1bb4('0x33'))){throw new db['Sequelize']['ValidationError'](_0x1bb4('0x34'));}else{if(_0x3ce0cb[_0x1bb4('0x30')]['hasOwnProperty'](_0x1bb4('0x33'))&&!_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x31')](_0x1bb4('0x35'))){throw new db[(_0x1bb4('0x36'))]['ValidationError'](_0x1bb4('0x37'));}if(!_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x31')](_0x1bb4('0x38'))){throw new db[(_0x1bb4('0x36'))][(_0x1bb4('0x39'))](_0x1bb4('0x3a'));}else{try{var _0x4bfdbc=JSON[_0x1bb4('0x3b')](_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x38')]);}catch(_0x146e2e){logger[_0x1bb4('0x2b')](_0x146e2e);throw new db['Sequelize'][(_0x1bb4('0x39'))](_0x1bb4('0x3c'));}var _0x5e687e=[_0x1bb4('0x3d'),'faxqueue',_0x1bb4('0x3e'),_0x1bb4('0x3f'),'smsqueue','voicequeue','whatsappqueue',_0x1bb4('0x40'),_0x1bb4('0x41')];if(_['some'](_0x4bfdbc,function(_0x2fcd36){return!_[_0x1bb4('0x42')](_0x5e687e,_0x2fcd36['model']['toLowerCase']());})){throw new db[(_0x1bb4('0x36'))][(_0x1bb4('0x39'))](_0x1bb4('0x43'));}}}var _0x39dd9a={};_0x39dd9a[_0x1bb4('0x44')]=_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x31')]('senderName')?_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x44')]:_0x3ce0cb[_0x1bb4('0x41')][_0x1bb4('0x45')];_0x39dd9a[_0x1bb4('0x46')]=_[_0x1bb4('0x47')](_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x46')])?null:_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x46')];_0x39dd9a[_0x1bb4('0x48')]=_0x3ce0cb[_0x1bb4('0x30')][_0x1bb4('0x48')]||![];_0x39dd9a['SenderId']=_0x3ce0cb[_0x1bb4('0x41')]['id'];return getContent(_0x3ce0cb[_0x1bb4('0x30')])['then'](function(_0x229d05){_0x39dd9a['body']=_0x229d05;return getRecipients(_0x4bfdbc);})[_0x1bb4('0x29')](function(_0x5d58df){_0x39dd9a['recipientsId']=_[_0x1bb4('0x49')](_0x5d58df)['join'](',');return db[_0x1bb4('0x4a')][_0x1bb4('0x4b')](function(_0x843cbf){return db[_0x1bb4('0x4c')][_0x1bb4('0x4d')](_0x39dd9a,{'raw':!![],'transaction':_0x843cbf})[_0x1bb4('0x29')](function(_0x4f2ea2){var _0x5c9ad6={'sender':_0x39dd9a['senderName'],'description':_0x39dd9a['recipientsDescription'],'content':_0x39dd9a[_0x1bb4('0x30')],'beep':_0x39dd9a[_0x1bb4('0x48')]};_0x5d58df['forEach'](function(_0x4d53da){_0x5c9ad6[_0x1bb4('0x4e')]=_0x4d53da;socket[_0x1bb4('0x4f')](_0x1bb4('0x50'),_0x5c9ad6);});return _0x4f2ea2;});});})['then'](respondWithResult(_0x119608,0xc9))[_0x1bb4('0x51')](handleError(_0x119608,null));};function getContent(_0x143089){return new BPromise(function(_0x12a700,_0xf08ba1){if(_0x143089['text']){_0x12a700(_0x143089['text']);return;}return db[_0x1bb4('0x52')][_0x1bb4('0x53')]({'attributes':['html'],'where':{'id':_0x143089['TemplateId']},'raw':!![]})['then'](function(_0x21197e){if(!_0x21197e)throw new db[(_0x1bb4('0x36'))]['ValidationError'](_0x1bb4('0x54'));var _0x1dac8d=Mustache[_0x1bb4('0x55')](_0x21197e[_0x1bb4('0x56')],_0x143089['view']);_0x12a700(_0x1dac8d);})[_0x1bb4('0x51')](function(_0x4273d0){_0xf08ba1(_0x4273d0);});});}function getRecipients(_0x579f40){return new BPromise(function(_0x500f28,_0x1949f9){var _0x41516b=[];var _0xeb532f=[];_0x579f40[_0x1bb4('0x57')](function(_0x55e9eb){var _0x48f247=_[_0x1bb4('0x58')](_0x55e9eb['model'][_0x1bb4('0x59')]());if(_0x48f247==='User'){_0x41516b=_['union'](_0x41516b,_0x55e9eb['ids']);}else{if(_[_0x1bb4('0x42')](_0x48f247,_0x1bb4('0x5a')))_0x48f247=_0x48f247[_0x1bb4('0x5b')](_0x1bb4('0x5a'),_0x1bb4('0x5c'));_0x55e9eb[_0x1bb4('0x5d')][_0x1bb4('0x57')](function(_0x16a80d){_0xeb532f[_0x1bb4('0x5e')](getAgents(_0x48f247,_0x16a80d));});}});return BPromise[_0x1bb4('0x5f')](_0xeb532f)[_0x1bb4('0x29')](function(_0x311fa7){_0x41516b=_[_0x1bb4('0x60')](_0x41516b,_[_0x1bb4('0x61')](_0x311fa7));_0x500f28(_0x41516b);})['catch'](function(_0x63fb56){_0x1949f9(_0x63fb56);});});}function getAgents(_0x2990c,_0x25e90c){return new BPromise(function(_0x8c434,_0x4fd9b2){return db[_0x2990c][_0x1bb4('0x53')]({'where':{'id':_0x25e90c}})[_0x1bb4('0x29')](function(_0x3a574f){return _0x3a574f[_0x1bb4('0x62')]({'attributes':['id'],'raw':!![]})[_0x1bb4('0x29')](function(_0x89c635){var _0x2e68a2=_[_0x1bb4('0x63')](_0x89c635,'id');_0x8c434(_0x2e68a2);});})[_0x1bb4('0x51')](function(_0x371f21){_0x4fd9b2(_0x371f21);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b486459..4bfedd7 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 _0xa601=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa601,0xbc));var _0x1a60=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa601[_0x58e469];return _0x4c01c5;};'use strict';var EventEmitter=require(_0x1a60('0x0'));var UserNotification=require(_0x1a60('0x1'))['db'][_0x1a60('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1a60('0x3')](0x0);var events={'afterCreate':_0x1a60('0x4'),'afterUpdate':_0x1a60('0x5'),'afterDestroy':_0x1a60('0x6')};function emitEvent(_0x37d20a){return function(_0x23f27d,_0x4ae43a,_0x4280ed){UserNotificationEvents['emit'](_0x37d20a+':'+_0x23f27d['id'],_0x23f27d);UserNotificationEvents[_0x1a60('0x7')](_0x37d20a,_0x23f27d);_0x4280ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x1a60('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xab82=['UserNotification','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x496bea,_0x23151f){var _0x431e45=function(_0x47de33){while(--_0x47de33){_0x496bea['push'](_0x496bea['shift']());}};_0x431e45(++_0x23151f);}(_0xab82,0x181));var _0x2ab8=function(_0x1595c2,_0x42aa75){_0x1595c2=_0x1595c2-0x0;var _0x228947=_0xab82[_0x1595c2];return _0x228947;};'use strict';var EventEmitter=require(_0x2ab8('0x0'));var UserNotification=require(_0x2ab8('0x1'))['db'][_0x2ab8('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ab8('0x3'),'afterDestroy':_0x2ab8('0x4')};function emitEvent(_0x5286f1){return function(_0x14408f,_0x2b09fe,_0x58d74a){UserNotificationEvents[_0x2ab8('0x5')](_0x5286f1+':'+_0x14408f['id'],_0x14408f);UserNotificationEvents['emit'](_0x5286f1,_0x14408f);_0x58d74a(null);};}for(var e in events){if(events[_0x2ab8('0x6')](e)){var event=events[e];UserNotification[_0x2ab8('0x7')](e,emitEvent(event));}}module[_0x2ab8('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 946d36a..976184f 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 _0x5b33=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','./userNotification.attributes','define','UserNotification','userNotifications'];(function(_0x410467,_0x183061){var _0x4cfae=function(_0x49a108){while(--_0x49a108){_0x410467['push'](_0x410467['shift']());}};_0x4cfae(++_0x183061);}(_0x5b33,0x1da));var _0x35b3=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5b33[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x35b3('0x0'));var util=require('util');var logger=require(_0x35b3('0x1'))(_0x35b3('0x2'));var moment=require('moment');var BPromise=require(_0x35b3('0x3'));var rp=require(_0x35b3('0x4'));var fs=require('fs');var path=require(_0x35b3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x35b3('0x6'));module['exports']=function(_0x5ded84,_0x17aedb){return _0x5ded84[_0x35b3('0x7')](_0x35b3('0x8'),attributes,{'tableName':_0x35b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35b3('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb0af=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb0af,0x140));var _0xfb0a=function(_0x50a0b7,_0x5a25f6){_0x50a0b7=_0x50a0b7-0x0;var _0x1a7e9a=_0xb0af[_0x50a0b7];return _0x1a7e9a;};'use strict';var _=require(_0xfb0a('0x0'));var util=require(_0xfb0a('0x1'));var logger=require(_0xfb0a('0x2'))(_0xfb0a('0x3'));var moment=require(_0xfb0a('0x4'));var BPromise=require(_0xfb0a('0x5'));var rp=require(_0xfb0a('0x6'));var fs=require('fs');var path=require(_0xfb0a('0x7'));var rimraf=require(_0xfb0a('0x8'));var config=require('../../config/environment');var attributes=require(_0xfb0a('0x9'));module[_0xfb0a('0xa')]=function(_0x39ee70,_0x486257){return _0x39ee70[_0xfb0a('0xb')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb0a('0xc'),'collate':_0xfb0a('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 54d013b..2937839 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 _0xd256=['../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x466bfd,_0x56f4bb){var _0x29293d=function(_0x47298b){while(--_0x47298b){_0x466bfd['push'](_0x466bfd['shift']());}};_0x29293d(++_0x56f4bb);}(_0xd256,0x194));var _0x6d25=function(_0x3fcdb3,_0x238206){_0x3fcdb3=_0x3fcdb3-0x0;var _0x5de950=_0xd256[_0x3fcdb3];return _0x5de950;};'use strict';var _=require(_0x6d25('0x0'));var util=require(_0x6d25('0x1'));var moment=require('moment');var BPromise=require(_0x6d25('0x2'));var rs=require(_0x6d25('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d25('0x4'))['db'];var utils=require(_0x6d25('0x5'));var logger=require(_0x6d25('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6d25('0x7')]=_[_0x6d25('0x8')](config['redis'],{'host':_0x6d25('0x9'),'port':0x18eb});var socket=require(_0x6d25('0xa'))(new Redis(config[_0x6d25('0x7')]));require('./userNotification.socket')[_0x6d25('0xb')](socket);function respondWithRpcPromise(_0xf0e33a,_0x427f32,_0x41c54b){return new BPromise(function(_0xe3fe4b,_0x77d555){return client[_0x6d25('0xc')](_0xf0e33a,_0x41c54b)[_0x6d25('0xd')](function(_0x11ec72){logger['info'](_0x6d25('0xe'),_0x427f32,_0x6d25('0xf'));logger[_0x6d25('0x10')](_0x6d25('0x11'),_0x427f32,_0x6d25('0xf'),JSON['stringify'](_0x11ec72));if(_0x11ec72['error']){if(_0x11ec72['error'][_0x6d25('0x12')]===0x1f4){logger[_0x6d25('0x13')](_0x6d25('0xe'),_0x427f32,_0x11ec72[_0x6d25('0x13')]['message']);return _0x77d555(_0x11ec72['error']['message']);}logger[_0x6d25('0x13')](_0x6d25('0xe'),_0x427f32,_0x11ec72[_0x6d25('0x13')][_0x6d25('0x14')]);return _0xe3fe4b(_0x11ec72[_0x6d25('0x13')][_0x6d25('0x14')]);}else{logger[_0x6d25('0x15')](_0x6d25('0xe'),_0x427f32,_0x6d25('0xf'));_0xe3fe4b(_0x11ec72[_0x6d25('0x16')]['message']);}})[_0x6d25('0x17')](function(_0x2472db){logger[_0x6d25('0x13')](_0x6d25('0xe'),_0x427f32,_0x2472db);_0x77d555(_0x2472db);});});} \ No newline at end of file +var _0xa4aa=['stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4aa,0x1d9));var _0xaa4a=function(_0x2cb71c,_0x503573){_0x2cb71c=_0x2cb71c-0x0;var _0x9c5a36=_0xa4aa[_0x2cb71c];return _0x9c5a36;};'use strict';var _=require(_0xaa4a('0x0'));var util=require('util');var moment=require(_0xaa4a('0x1'));var BPromise=require(_0xaa4a('0x2'));var rs=require(_0xaa4a('0x3'));var fs=require('fs');var Redis=require(_0xaa4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa4a('0x5'));var config=require(_0xaa4a('0x6'));var jayson=require(_0xaa4a('0x7'));var client=jayson['client'][_0xaa4a('0x8')]({'port':0x232a});config[_0xaa4a('0x9')]=_[_0xaa4a('0xa')](config['redis'],{'host':_0xaa4a('0xb'),'port':0x18eb});var socket=require(_0xaa4a('0xc'))(new Redis(config[_0xaa4a('0x9')]));require(_0xaa4a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4d7109,_0x145bfc,_0xe79aca){return new BPromise(function(_0x214fe7,_0x463e4a){return client[_0xaa4a('0xe')](_0x4d7109,_0xe79aca)[_0xaa4a('0xf')](function(_0x4d6e91){logger[_0xaa4a('0x10')](_0xaa4a('0x11'),_0x145bfc,_0xaa4a('0x12'));logger[_0xaa4a('0x13')](_0xaa4a('0x14'),_0x145bfc,'request\x20sent',JSON[_0xaa4a('0x15')](_0x4d6e91));if(_0x4d6e91[_0xaa4a('0x16')]){if(_0x4d6e91[_0xaa4a('0x16')][_0xaa4a('0x17')]===0x1f4){logger[_0xaa4a('0x16')](_0xaa4a('0x11'),_0x145bfc,_0x4d6e91[_0xaa4a('0x16')][_0xaa4a('0x18')]);return _0x463e4a(_0x4d6e91[_0xaa4a('0x16')]['message']);}logger[_0xaa4a('0x16')](_0xaa4a('0x11'),_0x145bfc,_0x4d6e91[_0xaa4a('0x16')][_0xaa4a('0x18')]);return _0x214fe7(_0x4d6e91[_0xaa4a('0x16')][_0xaa4a('0x18')]);}else{logger['info'](_0xaa4a('0x11'),_0x145bfc,_0xaa4a('0x12'));_0x214fe7(_0x4d6e91[_0xaa4a('0x19')][_0xaa4a('0x18')]);}})['catch'](function(_0x244f3f){logger[_0xaa4a('0x16')](_0xaa4a('0x11'),_0x145bfc,_0x244f3f);_0x463e4a(_0x244f3f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 421c156..1847841 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 _0xdc69=['length','userNotification:','./userNotification.events','update','removeListener','register'];(function(_0x31e965,_0xbd1e54){var _0x120351=function(_0x45229d){while(--_0x45229d){_0x31e965['push'](_0x31e965['shift']());}};_0x120351(++_0xbd1e54);}(_0xdc69,0x98));var _0x9dc6=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xdc69[_0x5ac0f0];return _0x4aceec;};'use strict';var UserNotificationEvents=require(_0x9dc6('0x0'));var events=['save','remove',_0x9dc6('0x1')];function createListener(_0x558cd6,_0x4e3d51){return function(_0x1113b3){_0x4e3d51['emit'](_0x558cd6,_0x1113b3);};}function removeListener(_0x5031eb,_0x10bb8d){return function(){UserNotificationEvents[_0x9dc6('0x2')](_0x5031eb,_0x10bb8d);};}exports[_0x9dc6('0x3')]=function(_0x22667f){for(var _0x589ed6=0x0,_0x8dc57b=events[_0x9dc6('0x4')];_0x589ed6<_0x8dc57b;_0x589ed6++){var _0x1fea13=events[_0x589ed6];var _0x2712df=createListener(_0x9dc6('0x5')+_0x1fea13,_0x22667f);UserNotificationEvents['on'](_0x1fea13,_0x2712df);}}; \ No newline at end of file +var _0x8c0d=['remove','emit','register','length','userNotification:','./userNotification.events'];(function(_0x182b41,_0x3710ca){var _0x39e4dc=function(_0x9bf120){while(--_0x9bf120){_0x182b41['push'](_0x182b41['shift']());}};_0x39e4dc(++_0x3710ca);}(_0x8c0d,0x95));var _0xd8c0=function(_0x160ccd,_0x10f9f8){_0x160ccd=_0x160ccd-0x0;var _0x8668df=_0x8c0d[_0x160ccd];return _0x8668df;};'use strict';var UserNotificationEvents=require(_0xd8c0('0x0'));var events=['save',_0xd8c0('0x1'),'update'];function createListener(_0x118cf4,_0x28e121){return function(_0xf05a3b){_0x28e121[_0xd8c0('0x2')](_0x118cf4,_0xf05a3b);};}function removeListener(_0x21f61a,_0xa24cab){return function(){UserNotificationEvents['removeListener'](_0x21f61a,_0xa24cab);};}exports[_0xd8c0('0x3')]=function(_0x3bdd01){for(var _0x491079=0x0,_0x6ddfca=events[_0xd8c0('0x4')];_0x491079<_0x6ddfca;_0x491079++){var _0x4930fc=events[_0x491079];var _0x15e555=createListener(_0xd8c0('0x5')+_0x4930fc,_0x3bdd01);UserNotificationEvents['on'](_0x4930fc,_0x15e555);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4329e68..3b41dfb 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd6e787,_0x47531e){var _0x5c8936=function(_0x31edbc){while(--_0x31edbc){_0xd6e787['push'](_0xd6e787['shift']());}};_0x5c8936(++_0x47531e);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3cf0d7,_0x2ca1dc){var _0x2f4981=function(_0x233570){while(--_0x233570){_0x3cf0d7['push'](_0x3cf0d7['shift']());}};_0x2f4981(++_0x2ca1dc);}(_0xedd9,0xfc));var _0x9edd=function(_0x169428,_0x12537a){_0x169428=_0x169428-0x0;var _0x3a164a=_0xedd9[_0x169428];return _0x3a164a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d314d14..70b3841 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 _0x1d34=['exports','INTEGER'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1d34,0xb2));var _0x41d3=function(_0xa7516,_0x544d3f){_0xa7516=_0xa7516-0x0;var _0x1b92ee=_0x1d34[_0xa7516];return _0x1b92ee;};'use strict';var Sequelize=require('sequelize');module[_0x41d3('0x0')]={'penalty':{'type':Sequelize[_0x41d3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e51=['INTEGER'];(function(_0x1742df,_0x4b17a7){var _0x39c917=function(_0x2504fb){while(--_0x2504fb){_0x1742df['push'](_0x1742df['shift']());}};_0x39c917(++_0x4b17a7);}(_0x3e51,0xa3));var _0x13e5=function(_0x27773e,_0x1fb5bd){_0x27773e=_0x27773e-0x0;var _0x24895c=_0x3e51[_0x27773e];return _0x24895c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x13e5('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 36c0bfc..8107a77 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 _0xfa40=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xfa40,0x182));var _0x0fa4=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xfa40[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0fa4('0x0'));var util=require(_0x0fa4('0x1'));var logger=require(_0x0fa4('0x2'))(_0x0fa4('0x3'));var moment=require(_0x0fa4('0x4'));var BPromise=require(_0x0fa4('0x5'));var rp=require(_0x0fa4('0x6'));var fs=require('fs');var path=require(_0x0fa4('0x7'));var rimraf=require(_0x0fa4('0x8'));var config=require(_0x0fa4('0x9'));var attributes=require(_0x0fa4('0xa'));module['exports']=function(_0xe163ae,_0x5a30e0){return _0xe163ae[_0x0fa4('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0x0fa4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x052e=['UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x5dcfc2,_0x3d5b37){var _0x34f415=function(_0x5e11a0){while(--_0x5e11a0){_0x5dcfc2['push'](_0x5dcfc2['shift']());}};_0x34f415(++_0x3d5b37);}(_0x052e,0x18e));var _0xe052=function(_0x2639e8,_0x432210){_0x2639e8=_0x2639e8-0x0;var _0x599369=_0x052e[_0x2639e8];return _0x599369;};'use strict';var _=require('lodash');var util=require(_0xe052('0x0'));var logger=require(_0xe052('0x1'))(_0xe052('0x2'));var moment=require('moment');var BPromise=require(_0xe052('0x3'));var rp=require(_0xe052('0x4'));var fs=require('fs');var path=require(_0xe052('0x5'));var rimraf=require(_0xe052('0x6'));var config=require('../../config/environment');var attributes=require(_0xe052('0x7'));module[_0xe052('0x8')]=function(_0x5e48c1,_0x4d9f52){return _0x5e48c1['define'](_0xe052('0x9'),attributes,{'tableName':_0xe052('0xa'),'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 345ea2d..d14f181 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 _0xb24f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x2ea4a8,_0x1492b7){var _0x4c5d54=function(_0x5e7726){while(--_0x5e7726){_0x2ea4a8['push'](_0x2ea4a8['shift']());}};_0x4c5d54(++_0x1492b7);}(_0xb24f,0x1c2));var _0xfb24=function(_0x53adbb,_0x49f2d8){_0x53adbb=_0x53adbb-0x0;var _0x49b2b0=_0xb24f[_0x53adbb];return _0x49b2b0;};'use strict';var _=require(_0xfb24('0x0'));var util=require(_0xfb24('0x1'));var moment=require(_0xfb24('0x2'));var BPromise=require(_0xfb24('0x3'));var rs=require(_0xfb24('0x4'));var fs=require('fs');var Redis=require(_0xfb24('0x5'));var db=require(_0xfb24('0x6'))['db'];var utils=require(_0xfb24('0x7'));var logger=require(_0xfb24('0x8'))(_0xfb24('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb24('0xa'));var client=jayson[_0xfb24('0xb')][_0xfb24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17bd14,_0x975aa9,_0x339734){return new BPromise(function(_0x40860b,_0x5c1340){return client[_0xfb24('0xd')](_0x17bd14,_0x339734)[_0xfb24('0xe')](function(_0x700b08){logger[_0xfb24('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x975aa9,_0xfb24('0x10'));logger[_0xfb24('0x11')](_0xfb24('0x12'),_0x975aa9,_0xfb24('0x10'),JSON[_0xfb24('0x13')](_0x700b08));if(_0x700b08[_0xfb24('0x14')]){if(_0x700b08[_0xfb24('0x14')]['code']===0x1f4){logger[_0xfb24('0x14')](_0xfb24('0x15'),_0x975aa9,_0x700b08[_0xfb24('0x14')]['message']);return _0x5c1340(_0x700b08[_0xfb24('0x14')][_0xfb24('0x16')]);}logger[_0xfb24('0x14')](_0xfb24('0x15'),_0x975aa9,_0x700b08['error'][_0xfb24('0x16')]);return _0x40860b(_0x700b08[_0xfb24('0x14')][_0xfb24('0x16')]);}else{logger[_0xfb24('0xf')](_0xfb24('0x15'),_0x975aa9,'request\x20sent');_0x40860b(_0x700b08[_0xfb24('0x17')][_0xfb24('0x16')]);}})[_0xfb24('0x18')](function(_0x12a22f){logger['error'](_0xfb24('0x15'),_0x975aa9,_0x12a22f);_0x5c1340(_0x12a22f);});});} \ No newline at end of file +var _0xddb2=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xddb2,0x1d0));var _0x2ddb=function(_0x19c35c,_0x26a467){_0x19c35c=_0x19c35c-0x0;var _0x3d928f=_0xddb2[_0x19c35c];return _0x3d928f;};'use strict';var _=require(_0x2ddb('0x0'));var util=require(_0x2ddb('0x1'));var moment=require('moment');var BPromise=require(_0x2ddb('0x2'));var rs=require(_0x2ddb('0x3'));var fs=require('fs');var Redis=require(_0x2ddb('0x4'));var db=require(_0x2ddb('0x5'))['db'];var utils=require(_0x2ddb('0x6'));var logger=require('../../config/logger')(_0x2ddb('0x7'));var config=require(_0x2ddb('0x8'));var jayson=require(_0x2ddb('0x9'));var client=jayson[_0x2ddb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd1627,_0xbda219,_0x44f0f0){return new BPromise(function(_0x2c628f,_0x361dcc){return client[_0x2ddb('0xb')](_0xd1627,_0x44f0f0)[_0x2ddb('0xc')](function(_0x48521f){logger[_0x2ddb('0xd')](_0x2ddb('0xe'),_0xbda219,_0x2ddb('0xf'));logger[_0x2ddb('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xbda219,'request\x20sent',JSON[_0x2ddb('0x11')](_0x48521f));if(_0x48521f['error']){if(_0x48521f[_0x2ddb('0x12')][_0x2ddb('0x13')]===0x1f4){logger['error'](_0x2ddb('0xe'),_0xbda219,_0x48521f[_0x2ddb('0x12')][_0x2ddb('0x14')]);return _0x361dcc(_0x48521f[_0x2ddb('0x12')][_0x2ddb('0x14')]);}logger[_0x2ddb('0x12')](_0x2ddb('0xe'),_0xbda219,_0x48521f[_0x2ddb('0x12')][_0x2ddb('0x14')]);return _0x2c628f(_0x48521f[_0x2ddb('0x12')]['message']);}else{logger['info'](_0x2ddb('0xe'),_0xbda219,_0x2ddb('0xf'));_0x2c628f(_0x48521f[_0x2ddb('0x15')][_0x2ddb('0x14')]);}})[_0x2ddb('0x16')](function(_0x19564d){logger[_0x2ddb('0x12')](_0x2ddb('0xe'),_0xbda219,_0x19564d);_0x361dcc(_0x19564d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 21c54bb..bce7fe1 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 _0xaa4c=['removeResources','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','clone','addResources','put','update','delete','destroy','removeSections'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa4c,0xa9));var _0xcaa4=function(_0x15379b,_0x4d5732){_0x15379b=_0x15379b-0x0;var _0x10f623=_0xaa4c[_0x15379b];return _0x10f623;};'use strict';var multer=require(_0xcaa4('0x0'));var util=require(_0xcaa4('0x1'));var path=require('path');var timeout=require(_0xcaa4('0x2'));var express=require('express');var router=express[_0xcaa4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcaa4('0x4'));var interaction=require(_0xcaa4('0x5'));var config=require(_0xcaa4('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x8')]);router['get'](_0xcaa4('0x9'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0xa')]);router['get'](_0xcaa4('0xb'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0xc')]);router[_0xcaa4('0xd')](_0xcaa4('0xe'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0xf')]);router[_0xcaa4('0xd')](_0xcaa4('0x10'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x11')]);router[_0xcaa4('0x12')](_0xcaa4('0x13'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x14')]);router[_0xcaa4('0x12')](_0xcaa4('0xe'),auth[_0xcaa4('0x7')](),controller['addSections']);router[_0xcaa4('0x12')]('/:id/resources',auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x15')]);router[_0xcaa4('0x16')](_0xcaa4('0xb'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x17')]);router[_0xcaa4('0x18')]('/:id',auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x19')]);router[_0xcaa4('0x18')](_0xcaa4('0xe'),auth[_0xcaa4('0x7')](),controller[_0xcaa4('0x1a')]);router[_0xcaa4('0x18')](_0xcaa4('0x10'),auth['isAuthenticated'](),controller[_0xcaa4('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xc7bf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','/:id/resources','getResources','create','/:id/clone','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router'];(function(_0x2ae0c3,_0x3090a0){var _0x23c41c=function(_0xbc995a){while(--_0xbc995a){_0x2ae0c3['push'](_0x2ae0c3['shift']());}};_0x23c41c(++_0x3090a0);}(_0xc7bf,0x1e8));var _0xfc7b=function(_0x5e851a,_0x5347a0){_0x5e851a=_0x5e851a-0x0;var _0x4e7e27=_0xc7bf[_0x5e851a];return _0x4e7e27;};'use strict';var multer=require(_0xfc7b('0x0'));var util=require('util');var path=require(_0xfc7b('0x1'));var timeout=require(_0xfc7b('0x2'));var express=require(_0xfc7b('0x3'));var router=express[_0xfc7b('0x4')]();var fs_extra=require(_0xfc7b('0x5'));var auth=require(_0xfc7b('0x6'));var interaction=require(_0xfc7b('0x7'));var config=require(_0xfc7b('0x8'));var controller=require(_0xfc7b('0x9'));router[_0xfc7b('0xa')]('/',auth[_0xfc7b('0xb')](),controller[_0xfc7b('0xc')]);router['get'](_0xfc7b('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xfc7b('0xe'),auth[_0xfc7b('0xb')](),controller[_0xfc7b('0xf')]);router[_0xfc7b('0xa')](_0xfc7b('0x10'),auth[_0xfc7b('0xb')](),controller['getSections']);router[_0xfc7b('0xa')](_0xfc7b('0x11'),auth['isAuthenticated'](),controller[_0xfc7b('0x12')]);router['post']('/',auth[_0xfc7b('0xb')](),controller[_0xfc7b('0x13')]);router['post'](_0xfc7b('0x14'),auth['isAuthenticated'](),controller['clone']);router['post'](_0xfc7b('0x10'),auth[_0xfc7b('0xb')](),controller['addSections']);router['post'](_0xfc7b('0x11'),auth['isAuthenticated'](),controller[_0xfc7b('0x15')]);router[_0xfc7b('0x16')](_0xfc7b('0xe'),auth[_0xfc7b('0xb')](),controller[_0xfc7b('0x17')]);router[_0xfc7b('0x18')](_0xfc7b('0xe'),auth['isAuthenticated'](),controller[_0xfc7b('0x19')]);router[_0xfc7b('0x18')](_0xfc7b('0x10'),auth[_0xfc7b('0xb')](),controller[_0xfc7b('0x1a')]);router['delete'](_0xfc7b('0x11'),auth[_0xfc7b('0xb')](),controller[_0xfc7b('0x1b')]);module[_0xfc7b('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 7ed34f5..6f4158a 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 _0x364b=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x2103c1,_0x49fc3c){var _0x19cb9e=function(_0x4e8aed){while(--_0x4e8aed){_0x2103c1['push'](_0x2103c1['shift']());}};_0x19cb9e(++_0x49fc3c);}(_0x364b,0x1cd));var _0xb364=function(_0x45ca66,_0x47f5d2){_0x45ca66=_0x45ca66-0x0;var _0x329bdc=_0x364b[_0x45ca66];return _0x329bdc;};'use strict';var Sequelize=require(_0xb364('0x0'));module[_0xb364('0x1')]={'name':{'type':Sequelize[_0xb364('0x2')],'allowNull':![],'unique':_0xb364('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x38657d){this[_0xb364('0x4')](_0xb364('0x5'),_0x38657d?_0x38657d[_0xb364('0x6')](''):[]);},'get':function(){return this[_0xb364('0x7')](_0xb364('0x5'))?this['getDataValue']('crudPermissions')[_0xb364('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb364('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb364('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb364('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb364('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb364('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc8d9=['split','BOOLEAN','sequelize','name','STRING','setDataValue','join','getDataValue','crudPermissions'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0xc8d9,0xc8));var _0x9c8d=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xc8d9[_0x319e2e];return _0x302524;};'use strict';var Sequelize=require(_0x9c8d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9c8d('0x1')},'crudPermissions':{'type':Sequelize[_0x9c8d('0x2')],'set':function(_0x3d21b0){this[_0x9c8d('0x3')]('crudPermissions',_0x3d21b0?_0x3d21b0[_0x9c8d('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x9c8d('0x5')](_0x9c8d('0x6'))[_0x9c8d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9c8d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9c8d('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b8b46e0..72da326 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 _0xa2cb=['subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','create','body','catch','clone','options','find','get','omit','updatedAt','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','push','removeSections','getSections','enabled','includes'];(function(_0x593bce,_0x484075){var _0x4f56c9=function(_0x583a02){while(--_0x583a02){_0x593bce['push'](_0x593bce['shift']());}};_0x4f56c9(++_0x484075);}(_0xa2cb,0x7d));var _0xba2c=function(_0x58c24a,_0x159665){_0x58c24a=_0x58c24a-0x0;var _0x50d1bc=_0xa2cb[_0x58c24a];return _0x50d1bc;};'use strict';var emlformat=require(_0xba2c('0x0'));var rimraf=require(_0xba2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba2c('0x2'));var rp=require(_0xba2c('0x3'));var moment=require(_0xba2c('0x4'));var BPromise=require(_0xba2c('0x5'));var Mustache=require(_0xba2c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba2c('0x7'));var _=require('lodash');var squel=require(_0xba2c('0x8'));var crypto=require('crypto');var jsforce=require(_0xba2c('0x9'));var deskjs=require(_0xba2c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xba2c('0xb'));var Papa=require(_0xba2c('0xc'));var Redis=require('ioredis');var authService=require(_0xba2c('0xd'));var qs=require(_0xba2c('0xe'));var as=require(_0xba2c('0xf'));var hardwareService=require(_0xba2c('0x10'));var logger=require('../../config/logger')(_0xba2c('0x11'));var utils=require(_0xba2c('0x12'));var config=require(_0xba2c('0x13'));var licenseUtil=require(_0xba2c('0x14'));var db=require(_0xba2c('0x15'))['db'];config[_0xba2c('0x16')]=_[_0xba2c('0x17')](config[_0xba2c('0x16')],{'host':_0xba2c('0x18'),'port':0x18eb});var socket=require(_0xba2c('0x19'))(new Redis(config['redis']));require(_0xba2c('0x1a'))[_0xba2c('0x1b')](socket);function respondWithStatusCode(_0x3fc26e,_0x210203){_0x210203=_0x210203||0xcc;return function(_0x3e6f61){if(_0x3e6f61){return _0x3fc26e[_0xba2c('0x1c')](_0x210203);}return _0x3fc26e[_0xba2c('0x1d')](_0x210203)[_0xba2c('0x1e')]();};}function respondWithResult(_0x121bbc,_0x54018c){_0x54018c=_0x54018c||0xc8;return function(_0x10cd6a){if(_0x10cd6a){return _0x121bbc[_0xba2c('0x1d')](_0x54018c)[_0xba2c('0x1f')](_0x10cd6a);}};}function respondWithFilteredResult(_0x3282ea,_0x5d6866){return function(_0x48227c){if(_0x48227c){var _0x1b281f=typeof _0x5d6866[_0xba2c('0x20')]==='undefined'&&typeof _0x5d6866['limit']==='undefined';var _0x56087a=_0x48227c[_0xba2c('0x21')];var _0x1c27c0=_0x1b281f?0x0:_0x5d6866[_0xba2c('0x20')];var _0x266824=_0x1b281f?_0x48227c[_0xba2c('0x21')]:_0x5d6866[_0xba2c('0x20')]+_0x5d6866[_0xba2c('0x22')];var _0x14902f;if(_0x266824>=_0x56087a){_0x266824=_0x56087a;_0x14902f=0xc8;}else{_0x14902f=0xce;}_0x3282ea[_0xba2c('0x1d')](_0x14902f);return _0x3282ea[_0xba2c('0x23')](_0xba2c('0x24'),_0x1c27c0+'-'+_0x266824+'/'+_0x56087a)[_0xba2c('0x1f')](_0x48227c);}return null;};}function patchUpdates(_0x31cd64){return function(_0x3e0c06){try{jsonpatch[_0xba2c('0x25')](_0x3e0c06,_0x31cd64,!![]);}catch(_0x45a296){return BPromise[_0xba2c('0x26')](_0x45a296);}return _0x3e0c06[_0xba2c('0x27')]();};}function saveUpdates(_0x5ea429,_0x2d8123){return function(_0xda1ede){if(_0xda1ede){return _0xda1ede[_0xba2c('0x28')](_0x5ea429)[_0xba2c('0x29')](function(_0x590f6a){return _0x590f6a;});}return null;};}function removeEntity(_0x5f134f,_0x199b1d){return function(_0x4f509f){if(_0x4f509f){return _0x4f509f[_0xba2c('0x2a')]()[_0xba2c('0x29')](function(){_0x5f134f[_0xba2c('0x1d')](0xcc)[_0xba2c('0x1e')]();});}};}function handleEntityNotFound(_0x28c5fc,_0x2af4cc){return function(_0x5667bf){if(!_0x5667bf){_0x28c5fc['sendStatus'](0x194);}return _0x5667bf;};}function handleError(_0x37a4f9,_0x63da54){_0x63da54=_0x63da54||0x1f4;return function(_0x19ee5a){logger[_0xba2c('0x2b')](_0x19ee5a[_0xba2c('0x2c')]);if(_0x19ee5a[_0xba2c('0x2d')]){delete _0x19ee5a[_0xba2c('0x2d')];}_0x37a4f9[_0xba2c('0x1d')](_0x63da54)[_0xba2c('0x2e')](_0x19ee5a);};}exports[_0xba2c('0x2f')]=function(_0x3342b3,_0x26b5c7){var _0x1b3dfa={},_0x367106={},_0x3f3f6b={'count':0x0,'rows':[]};var _0x261383=_[_0xba2c('0x30')](db[_0xba2c('0x31')][_0xba2c('0x32')],function(_0x45cd33){return{'name':_0x45cd33[_0xba2c('0x33')],'type':_0x45cd33[_0xba2c('0x34')]['key']};});_0x367106[_0xba2c('0x35')]=_['map'](_0x261383,_0xba2c('0x2d'));_0x367106[_0xba2c('0x36')]=_[_0xba2c('0x37')](_0x3342b3[_0xba2c('0x36')]);_0x367106[_0xba2c('0x38')]=_[_0xba2c('0x39')](_0x367106['model'],_0x367106[_0xba2c('0x36')]);_0x1b3dfa[_0xba2c('0x3a')]=_[_0xba2c('0x39')](_0x367106[_0xba2c('0x35')],qs[_0xba2c('0x3b')](_0x3342b3[_0xba2c('0x36')][_0xba2c('0x3b')]));_0x1b3dfa[_0xba2c('0x3a')]=_0x1b3dfa[_0xba2c('0x3a')]['length']?_0x1b3dfa[_0xba2c('0x3a')]:_0x367106[_0xba2c('0x35')];if(!_0x3342b3[_0xba2c('0x36')]['hasOwnProperty'](_0xba2c('0x3c'))){_0x1b3dfa[_0xba2c('0x22')]=qs[_0xba2c('0x22')](_0x3342b3[_0xba2c('0x36')]['limit']);_0x1b3dfa['offset']=qs[_0xba2c('0x20')](_0x3342b3['query'][_0xba2c('0x20')]);}_0x1b3dfa['order']=qs['sort'](_0x3342b3[_0xba2c('0x36')][_0xba2c('0x3d')]);_0x1b3dfa[_0xba2c('0x3e')]=qs[_0xba2c('0x38')](_['pick'](_0x3342b3[_0xba2c('0x36')],_0x367106[_0xba2c('0x38')]),_0x261383);if(_0x3342b3[_0xba2c('0x36')]['filter']){_0x1b3dfa[_0xba2c('0x3e')]=_[_0xba2c('0x3f')](_0x1b3dfa[_0xba2c('0x3e')],{'$or':_[_0xba2c('0x30')](_0x261383,function(_0x260b23){if(_0x260b23['type']!==_0xba2c('0x40')){var _0x10a900={};_0x10a900[_0x260b23[_0xba2c('0x2d')]]={'$like':'%'+_0x3342b3[_0xba2c('0x36')][_0xba2c('0x41')]+'%'};return _0x10a900;}})});}_0x1b3dfa=_['merge']({},_0x1b3dfa,_0x3342b3['options']);var _0x8512ad={'where':_0x1b3dfa[_0xba2c('0x3e')]};return db['UserProfile'][_0xba2c('0x21')](_0x8512ad)[_0xba2c('0x29')](function(_0x1e2ad8){_0x3f3f6b[_0xba2c('0x21')]=_0x1e2ad8;if(_0x3342b3[_0xba2c('0x36')][_0xba2c('0x42')]){_0x1b3dfa[_0xba2c('0x43')]=[{'all':!![]}];}return db[_0xba2c('0x31')][_0xba2c('0x44')](_0x1b3dfa);})['then'](function(_0x3fddfd){_0x3f3f6b[_0xba2c('0x45')]=_0x3fddfd;return _0x3f3f6b;})[_0xba2c('0x29')](respondWithFilteredResult(_0x26b5c7,_0x1b3dfa))['catch'](handleError(_0x26b5c7,null));};exports[_0xba2c('0x46')]=function(_0x40769b,_0x45937f){var _0x52d973={'raw':![],'where':{'id':_0x40769b[_0xba2c('0x47')]['id']}},_0x16f4e8={};_0x16f4e8[_0xba2c('0x35')]=_[_0xba2c('0x37')](db['UserProfile'][_0xba2c('0x32')]);_0x16f4e8[_0xba2c('0x36')]=_[_0xba2c('0x37')](_0x40769b[_0xba2c('0x36')]);_0x16f4e8[_0xba2c('0x38')]=_[_0xba2c('0x39')](_0x16f4e8['model'],_0x16f4e8[_0xba2c('0x36')]);_0x52d973[_0xba2c('0x3a')]=_[_0xba2c('0x39')](_0x16f4e8[_0xba2c('0x35')],qs['fields'](_0x40769b['query'][_0xba2c('0x3b')]));_0x52d973[_0xba2c('0x3a')]=_0x52d973['attributes'][_0xba2c('0x48')]?_0x52d973['attributes']:_0x16f4e8[_0xba2c('0x35')];if(_0x40769b[_0xba2c('0x36')]['includeAll']){_0x52d973['include']=[{'all':!![]}];}_0x52d973=_[_0xba2c('0x3f')]({},_0x52d973,_0x40769b['options']);return db['UserProfile']['find'](_0x52d973)[_0xba2c('0x29')](handleEntityNotFound(_0x45937f,null))[_0xba2c('0x29')](respondWithResult(_0x45937f,null))['catch'](handleError(_0x45937f,null));};exports[_0xba2c('0x49')]=function(_0x2ec59a,_0x41d277){return db[_0xba2c('0x31')]['create'](_0x2ec59a[_0xba2c('0x4a')],{})[_0xba2c('0x29')](respondWithResult(_0x41d277,0xc9))[_0xba2c('0x4b')](handleError(_0x41d277,null));};exports[_0xba2c('0x4c')]=function(_0x4f52f6,_0x4009ee){var _0x36eee2={'where':{'id':_0x4f52f6['params']['id']}},_0x10eaeb={};_0x10eaeb[_0xba2c('0x35')]=_['keys'](db[_0xba2c('0x31')][_0xba2c('0x32')]);_0x36eee2[_0xba2c('0x3a')]=_[_0xba2c('0x39')](_0x10eaeb[_0xba2c('0x35')],qs[_0xba2c('0x3b')](_0x4f52f6['query']['fields']));_0x36eee2[_0xba2c('0x3a')]=_0x36eee2[_0xba2c('0x3a')]['length']?_0x36eee2['attributes']:_0x10eaeb['model'];if(_0x4f52f6[_0xba2c('0x36')][_0xba2c('0x42')]){_0x36eee2[_0xba2c('0x43')]=[{'all':!![]}];}_0x36eee2=_[_0xba2c('0x3f')]({},_0x36eee2,_0x4f52f6[_0xba2c('0x4d')]);return db['UserProfile'][_0xba2c('0x4e')](_0x36eee2)[_0xba2c('0x29')](handleEntityNotFound(_0x4009ee,null))[_0xba2c('0x29')](function(_0x1f64af){if(_0x1f64af){var _0x504c77=_0x1f64af[_0xba2c('0x4f')]({'plain':!![]});_0x504c77=qs[_0xba2c('0x50')](_0x504c77,['id','createdAt',_0xba2c('0x51'),'crudPermissions']);_0x4f52f6['body']=_[_0xba2c('0x50')](_0x4f52f6[_0xba2c('0x4a')],['id',_0xba2c('0x52'),'updatedAt']);return db[_0xba2c('0x53')][_0xba2c('0x54')](function(_0x1fe69a){return db[_0xba2c('0x31')]['create'](_[_0xba2c('0x3f')](_0x504c77,_0x4f52f6[_0xba2c('0x4a')]),{'include':_0x4f52f6[_0xba2c('0x36')][_0xba2c('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x1fe69a})['then'](function(_0x1f29aa){var _0xed99a7=_0x1f29aa[_0xba2c('0x4f')]({'plain':!![]});return db[_0xba2c('0x55')]['findAll']({'where':{'userProfileId':_0x4f52f6[_0xba2c('0x47')]['id']},'raw':!![]})[_0xba2c('0x29')](function(_0xba1358){if(_0xba1358){return BPromise['each'](_0xba1358,function(_0x12ecec){return new BPromise(function(_0x5ed6e3,_0xe37166){if(_0x12ecec[_0xba2c('0x56')]===null||_0x12ecec[_0xba2c('0x56')]===0x1)_0x5ed6e3(null);return db[_0xba2c('0x57')][_0xba2c('0x44')]({'where':{'sectionId':_0x12ecec['id']},'raw':!![]})[_0xba2c('0x29')](function(_0x29420f){var _0x530a42=_['map'](_0x29420f,function(_0xfb3bba){return qs[_0xba2c('0x50')](_0xfb3bba,['id',_0xba2c('0x52'),_0xba2c('0x51'),_0xba2c('0x58')]);});_0x5ed6e3(_0x530a42);})['catch'](function(_0x1719a2){_0xe37166(_0x1719a2);});})[_0xba2c('0x29')](function(_0xc33ada){var _0x3c8919=qs[_0xba2c('0x50')](_0x12ecec,['id',_0xba2c('0x52'),_0xba2c('0x51')]);_0x3c8919[_0xba2c('0x59')]=_0xed99a7['id'];if(_0xc33ada)_0x3c8919[_0xba2c('0x5a')]=_0xc33ada;return _0x3c8919;})[_0xba2c('0x29')](function(_0x4c72d1){return db[_0xba2c('0x55')][_0xba2c('0x49')](_0x4c72d1,{'include':[{'model':db[_0xba2c('0x57')],'as':_0xba2c('0x5a')}],'raw':!![],'transaction':_0x1fe69a});});})[_0xba2c('0x29')](function(){return _0xed99a7;});}});});});}})['then'](respondWithResult(_0x4009ee,0xc9))['catch'](handleError(_0x4009ee,null));};exports[_0xba2c('0x28')]=function(_0x14cfda,_0x2d3339){if(_0x14cfda['body']['id']){delete _0x14cfda[_0xba2c('0x4a')]['id'];}return db[_0xba2c('0x31')][_0xba2c('0x4e')]({'where':{'id':_0x14cfda['params']['id']}})[_0xba2c('0x29')](handleEntityNotFound(_0x2d3339,null))['then'](saveUpdates(_0x14cfda[_0xba2c('0x4a')],null))[_0xba2c('0x29')](respondWithResult(_0x2d3339,null))['catch'](handleError(_0x2d3339,null));};exports[_0xba2c('0x2a')]=function(_0x3c427a,_0x201628){return db[_0xba2c('0x31')][_0xba2c('0x4e')]({'where':{'id':_0x3c427a['params']['id']}})[_0xba2c('0x29')](handleEntityNotFound(_0x201628,null))['then'](removeEntity(_0x201628,null))[_0xba2c('0x4b')](handleError(_0x201628,null));};exports['describe']=function(_0x2cf14a,_0x5b6663){return db[_0xba2c('0x31')][_0xba2c('0x5b')]()['then'](respondWithResult(_0x5b6663,null))[_0xba2c('0x4b')](handleError(_0x5b6663,null));};exports[_0xba2c('0x5c')]=function(_0x2c92f5,_0x3c5310){var _0x57f3a0=_0x2c92f5[_0xba2c('0x4a')];return db['UserProfile'][_0xba2c('0x4e')]({'where':{'id':_0x2c92f5[_0xba2c('0x47')]['id']}})[_0xba2c('0x29')](handleEntityNotFound(_0x3c5310,null))[_0xba2c('0x29')](function(_0x2949df){if(_0x2949df){return db[_0xba2c('0x53')][_0xba2c('0x54')](function(_0x46b0a5){return db[_0xba2c('0x55')][_0xba2c('0x2a')]({'where':{'userProfileId':_0x2c92f5[_0xba2c('0x47')]['id'],'sectionId':_[_0xba2c('0x30')](_0x57f3a0,function(_0x43b915){return _0x43b915[_0xba2c('0x58')];})},'transaction':_0x46b0a5})[_0xba2c('0x29')](function(){var _0x123e66=_['map'](_0x57f3a0,function(_0x28d175){_0x28d175[_0xba2c('0x59')]=_0x2c92f5['params']['id'];return _0x28d175;});var _0x42816f=[];return BPromise[_0xba2c('0x5d')](_0x123e66,function(_0x1ded1a){return db[_0xba2c('0x55')][_0xba2c('0x49')](_0x1ded1a,{'include':[{'model':db[_0xba2c('0x57')],'as':_0xba2c('0x5a')}],'raw':!![],'transaction':_0x46b0a5})[_0xba2c('0x29')](function(_0x5df684){_0x42816f[_0xba2c('0x5e')](_0x5df684[_0xba2c('0x4f')]({'plain':!![]}));});})[_0xba2c('0x29')](function(){return _0x42816f;});});});}})[_0xba2c('0x29')](function(_0x216cb6){return _0x216cb6;})['then'](respondWithResult(_0x3c5310,null))[_0xba2c('0x4b')](handleError(_0x3c5310,null));};exports[_0xba2c('0x5f')]=function(_0x2893de,_0x158847){var _0x3ff9f6;return db[_0xba2c('0x31')][_0xba2c('0x4e')]({'where':{'id':_0x2893de[_0xba2c('0x47')]['id']},'attributes':['id',_0xba2c('0x2d')]})[_0xba2c('0x29')](handleEntityNotFound(_0x158847,null))[_0xba2c('0x29')](function(_0x40f952){if(_0x40f952){_0x3ff9f6=_0x40f952;return db[_0xba2c('0x55')][_0xba2c('0x2a')]({'where':{'userProfileId':_0x2893de['params']['id'],'sectionId':_0x2893de['query']['ids']}});}})['then'](function(){return _0x3ff9f6;})[_0xba2c('0x29')](respondWithStatusCode(_0x158847,null))[_0xba2c('0x4b')](handleError(_0x158847,null));};exports[_0xba2c('0x60')]=function(_0x525393,_0x3453c9){var _0x2c8873=[];var _0x1120c4=[];return db[_0xba2c('0x55')][_0xba2c('0x44')]({'where':{'userProfileId':_0x525393['params']['id']},'raw':!![]})[_0xba2c('0x29')](function(_0x1d2b58){_0x2c8873=_[_0xba2c('0x41')](_0x1d2b58,function(_0x5e2f34){return _0x5e2f34[_0xba2c('0x61')]===0x1||_[_0xba2c('0x62')]([0x3eb,0x709],_0x5e2f34['sectionId']);});if(!_['isEmpty'](_0x2c8873)){return _['map'](_0x2c8873,function(_0x3500a2){return _0x3500a2['sectionId'];});}else{return;}})[_0xba2c('0x29')](function(_0x2948c2){if(_0x2948c2)_0x1120c4=_0x2948c2;if(_[_0xba2c('0x62')](_0x1120c4,0x64)){var _0xfbbe4a=_['find'](_0x2c8873,{'sectionId':0x64});return hasDefaultDashboard(_0xfbbe4a)['then'](function(_0xa93254){return _[_0xba2c('0x30')](_0x2c8873,function(_0x20c5d5){if(_0x20c5d5[_0xba2c('0x58')]===0x64){_0x20c5d5[_0xba2c('0x63')]=_0xa93254;}return _0x20c5d5;});});}else{return;}})[_0xba2c('0x29')](function(_0x138773){if(_0x138773)_0x2c8873=_0x138773;if(_['includes'](_0x1120c4,0x3eb)){var _0x1fc04d=_[_0xba2c('0x4e')](_0x2c8873,{'sectionId':0x3eb});return getCustomDashboards(_0x1fc04d)[_0xba2c('0x29')](function(_0x54fae4){return _['map'](_0x2c8873,function(_0x491537){if(_0x1fc04d[_0xba2c('0x61')]){if(_0x491537[_0xba2c('0x58')]===0x3eb){_0x491537[_0xba2c('0x63')]=_0x54fae4;}}else{if(_0x491537[_0xba2c('0x58')]===0x64){_0x491537['subsections']=_0x54fae4;}}return _0x491537;});});}else{return;}})[_0xba2c('0x29')](function(_0x551353){if(_0x551353)_0x2c8873=_0x551353;if(_[_0xba2c('0x62')](_0x1120c4,0x709)){var _0x188cd5=_['find'](_0x2c8873,{'sectionId':0x709});return getPlugins(_0x188cd5)['then'](function(_0x200bec){if(_0x188cd5[_0xba2c('0x61')]){return _[_0xba2c('0x30')](_0x2c8873,function(_0x260af0){if(_0x260af0['sectionId']===0x709){_0x260af0[_0xba2c('0x63')]=_0x200bec;}return _0x260af0;});}else{var _0x4f51ef={'sectionId':0x76c,'enabled':0x1,'subsections':_0x200bec};var _0x2b6b66=_[_0xba2c('0x30')](_0x2c8873);_0x2b6b66[_0xba2c('0x5e')](_0x4f51ef);return _0x2b6b66;}});}else{return;}})['then'](function(_0x23ef09){if(_0x23ef09)_0x2c8873=_0x23ef09;return _[_0xba2c('0x41')](_0x2c8873,[_0xba2c('0x61'),0x1]);})['then'](respondWithResult(_0x3453c9,null))[_0xba2c('0x4b')](handleError(_0x3453c9,null));};function hasDefaultDashboard(_0x1092ec){var _0x1c1cce=[0x65];return new BPromise(function(_0x19d11c,_0x4cfa92){try{if(_0x1092ec['autoAssociation']){_0x19d11c(_0x1c1cce);}else{return db[_0xba2c('0x57')][_0xba2c('0x64')]({'where':{'sectionId':_0x1092ec['id']},'raw':!![]})['then'](function(_0x23bfe5){_0x23bfe5?_0x19d11c(_0x1c1cce):_0x19d11c();});}}catch(_0x3db835){_0x4cfa92(_0x3db835);}});}function getCustomDashboards(_0x506167){var _0x6b80ea=[];return new BPromise(function(_0x496c6d,_0x481e5b){try{if(_0x506167[_0xba2c('0x56')]){return db[_0xba2c('0x65')]['findAll']({'raw':!![]})[_0xba2c('0x29')](function(_0x36eb63){_0x36eb63['forEach'](function(_0x2e038a){_0x6b80ea[_0xba2c('0x5e')](_0x2e038a['id']+0x1869f);});_0x496c6d(_0x6b80ea);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x506167['id']},'raw':!![]})[_0xba2c('0x29')](function(_0xdff01e){_0xdff01e[_0xba2c('0x66')](function(_0xa4686e){_0x6b80ea['push'](_0xa4686e[_0xba2c('0x67')]+0x1869f);});_0x496c6d(_0x6b80ea);});}}catch(_0x518f2c){_0x481e5b(_0x518f2c);}});}function getPlugins(_0x1b903b){var _0x13f360=[];return new BPromise(function(_0x38e590,_0x1fcd42){try{if(_0x1b903b[_0xba2c('0x56')]){return db[_0xba2c('0x68')][_0xba2c('0x44')]({'raw':!![]})['then'](function(_0x3b76af){_0x3b76af['forEach'](function(_0x54e3fe){_0x13f360[_0xba2c('0x5e')](_0x54e3fe['id']+0x15b38);});_0x38e590(_0x13f360);});}else{return db[_0xba2c('0x57')]['findAll']({'where':{'sectionId':_0x1b903b['id']},'raw':!![]})[_0xba2c('0x29')](function(_0x9d6f86){_0x9d6f86['forEach'](function(_0x3015ec){_0x13f360[_0xba2c('0x5e')](_0x3015ec['resourceId']+0x15b38);});_0x38e590(_0x13f360);});}}catch(_0x4d6634){_0x1fcd42(_0x4d6634);}});}exports[_0xba2c('0x69')]=function(_0x5c3a51,_0x4ef9e0){return db[_0xba2c('0x31')][_0xba2c('0x4e')]({'where':{'id':_0x5c3a51[_0xba2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ef9e0,null))[_0xba2c('0x29')](function(_0x44d2ed){if(_0x44d2ed){return db['sequelize'][_0xba2c('0x54')](function(_0x5421a6){return db[_0xba2c('0x55')]['findAll']({'where':{'userProfileId':_0x5c3a51['params']['id']},'attributes':['id'],'raw':!![]})[_0xba2c('0x29')](function(_0x2bd662){if(_0x2bd662){return db[_0xba2c('0x55')][_0xba2c('0x2a')]({'where':{'userProfileId':_0x5c3a51[_0xba2c('0x47')]['id'],'id':_['map'](_0x2bd662,function(_0x2bcc50){return _0x2bcc50['id'];})},'transaction':_0x5421a6});}})[_0xba2c('0x29')](function(_0x5b2e13){var _0x11f9cf=_['map'](_0x5c3a51['body'],function(_0x103f8d){_0x103f8d[_0xba2c('0x59')]=_0x5c3a51[_0xba2c('0x47')]['id'];return _0x103f8d;});return db[_0xba2c('0x55')]['bulkCreate'](_0x11f9cf,{'raw':!![],'transaction':_0x5421a6});})[_0xba2c('0x29')](function(_0x105bcd){var _0x591af0=_[_0xba2c('0x41')](_['map'](_0x105bcd,function(_0x54e83a){return _0x54e83a[_0xba2c('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x591af0){return db[_0xba2c('0x55')][_0xba2c('0x44')]({'where':{'userProfileId':_0x5c3a51[_0xba2c('0x47')]['id'],'sectionId':_[_0xba2c('0x30')](_0x591af0,function(_0x4317e1){return _0x4317e1['sectionId'];})},'attributes':['id',_0xba2c('0x58')],'raw':!![]})[_0xba2c('0x29')](function(_0x497697){var _0x129050=_[_0xba2c('0x30')](_0x5c3a51['body'],function(_0x43dedf){_0x43dedf['userProfileId']=_0x5c3a51[_0xba2c('0x47')]['id'];return _0x43dedf;});return db['UserProfileResource'][_0xba2c('0x6a')](_0x129050,{'raw':!![],'transaction':_0x5421a6});});}})['catch'](handleError(_0x4ef9e0,null));});}})['then'](function(_0x451e8f){var _0x3e76f=_[_0xba2c('0x30')](_0x451e8f,function(_0x4174bd){return _0x4174bd[_0xba2c('0x4f')]({'plain':!![]});});})[_0xba2c('0x29')](respondWithResult(_0x4ef9e0,null))[_0xba2c('0x4b')](handleError(_0x4ef9e0,null));};exports[_0xba2c('0x6b')]=function(_0x3c9336,_0x29f74a,_0x4ecf8f){return db[_0xba2c('0x31')]['find']({'where':{'id':_0x3c9336[_0xba2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x29f74a,null))[_0xba2c('0x29')](function(_0x186410){if(_0x186410){return _0x186410[_0xba2c('0x6b')](_0x3c9336[_0xba2c('0x36')][_0xba2c('0x6c')]);}})[_0xba2c('0x29')](respondWithStatusCode(_0x29f74a,null))[_0xba2c('0x4b')](handleError(_0x29f74a,null));};exports[_0xba2c('0x6d')]=function(_0xade620,_0x582d5a){var _0x2a47d0={};if(!_0xade620[_0xba2c('0x36')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0xade620[_0xba2c('0x36')][_0xba2c('0x6e')]('nolimit')){_0x2a47d0[_0xba2c('0x22')]=qs['limit'](_0xade620[_0xba2c('0x36')][_0xba2c('0x22')]);_0x2a47d0['offset']=qs[_0xba2c('0x20')](_0xade620[_0xba2c('0x36')][_0xba2c('0x20')]);}return db[_0xba2c('0x31')][_0xba2c('0x4e')]({'where':{'id':_0xade620[_0xba2c('0x47')]['id']}})[_0xba2c('0x29')](function(_0x4f10be){if(!_0x4f10be)throw new Error(_0xba2c('0x6f')+_0xade620[_0xba2c('0x47')]['id']);return db['UserProfile'][_0xba2c('0x6d')](_0xade620);})[_0xba2c('0x29')](respondWithFilteredResult(_0x582d5a,_0x2a47d0))[_0xba2c('0x4b')](handleError(_0x582d5a,null));}; \ No newline at end of file +var _0xdf94=['fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','keys','include','options','find','create','body','clone','params','rawAttributes','get','omit','updatedAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','sectionId','update','describe','transaction','userProfileId','Resources','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','UserProfile','type','key','model','query','filters','intersection'];(function(_0xf03956,_0x3a3e8e){var _0x43d7f1=function(_0x180c71){while(--_0x180c71){_0xf03956['push'](_0xf03956['shift']());}};_0x43d7f1(++_0x3a3e8e);}(_0xdf94,0xad));var _0x4df9=function(_0x5a6083,_0x471692){_0x5a6083=_0x5a6083-0x0;var _0x398c52=_0xdf94[_0x5a6083];return _0x398c52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4df9('0x0'));var zipdir=require(_0x4df9('0x1'));var jsonpatch=require(_0x4df9('0x2'));var rp=require(_0x4df9('0x3'));var moment=require(_0x4df9('0x4'));var BPromise=require(_0x4df9('0x5'));var Mustache=require(_0x4df9('0x6'));var util=require(_0x4df9('0x7'));var path=require(_0x4df9('0x8'));var sox=require(_0x4df9('0x9'));var csv=require(_0x4df9('0xa'));var ejs=require(_0x4df9('0xb'));var fs=require('fs');var fs_extra=require(_0x4df9('0xc'));var _=require(_0x4df9('0xd'));var squel=require(_0x4df9('0xe'));var crypto=require(_0x4df9('0xf'));var jsforce=require(_0x4df9('0x10'));var deskjs=require(_0x4df9('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4df9('0x12'));var Papa=require(_0x4df9('0x13'));var Redis=require(_0x4df9('0x14'));var authService=require(_0x4df9('0x15'));var qs=require(_0x4df9('0x16'));var as=require(_0x4df9('0x17'));var hardwareService=require(_0x4df9('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x4df9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4df9('0x1a'));var db=require(_0x4df9('0x1b'))['db'];config[_0x4df9('0x1c')]=_[_0x4df9('0x1d')](config['redis'],{'host':_0x4df9('0x1e'),'port':0x18eb});var socket=require(_0x4df9('0x1f'))(new Redis(config[_0x4df9('0x1c')]));require('./userProfile.socket')[_0x4df9('0x20')](socket);function respondWithStatusCode(_0x1a35ef,_0xc141bb){_0xc141bb=_0xc141bb||0xcc;return function(_0x4fe068){if(_0x4fe068){return _0x1a35ef[_0x4df9('0x21')](_0xc141bb);}return _0x1a35ef['status'](_0xc141bb)[_0x4df9('0x22')]();};}function respondWithResult(_0x260d04,_0x412752){_0x412752=_0x412752||0xc8;return function(_0x3e2add){if(_0x3e2add){return _0x260d04['status'](_0x412752)[_0x4df9('0x23')](_0x3e2add);}};}function respondWithFilteredResult(_0x36ef28,_0x10852a){return function(_0x59d4e9){if(_0x59d4e9){var _0xa9d338=typeof _0x10852a['offset']===_0x4df9('0x24')&&typeof _0x10852a[_0x4df9('0x25')]===_0x4df9('0x24');var _0x1fe11a=_0x59d4e9[_0x4df9('0x26')];var _0x58233e=_0xa9d338?0x0:_0x10852a['offset'];var _0x4b7b6d=_0xa9d338?_0x59d4e9[_0x4df9('0x26')]:_0x10852a[_0x4df9('0x27')]+_0x10852a[_0x4df9('0x25')];var _0x434afe;if(_0x4b7b6d>=_0x1fe11a){_0x4b7b6d=_0x1fe11a;_0x434afe=0xc8;}else{_0x434afe=0xce;}_0x36ef28[_0x4df9('0x28')](_0x434afe);return _0x36ef28[_0x4df9('0x29')](_0x4df9('0x2a'),_0x58233e+'-'+_0x4b7b6d+'/'+_0x1fe11a)['json'](_0x59d4e9);}return null;};}function patchUpdates(_0xc03aea){return function(_0x60de39){try{jsonpatch[_0x4df9('0x2b')](_0x60de39,_0xc03aea,!![]);}catch(_0x446d8a){return BPromise[_0x4df9('0x2c')](_0x446d8a);}return _0x60de39['save']();};}function saveUpdates(_0x316f5c,_0x3473cc){return function(_0x55dfcd){if(_0x55dfcd){return _0x55dfcd['update'](_0x316f5c)[_0x4df9('0x2d')](function(_0x2ba01c){return _0x2ba01c;});}return null;};}function removeEntity(_0x4c7d68,_0x4234d1){return function(_0x427c43){if(_0x427c43){return _0x427c43[_0x4df9('0x2e')]()[_0x4df9('0x2d')](function(){_0x4c7d68[_0x4df9('0x28')](0xcc)[_0x4df9('0x22')]();});}};}function handleEntityNotFound(_0x5e4f21,_0x10d7f6){return function(_0x38c7a9){if(!_0x38c7a9){_0x5e4f21['sendStatus'](0x194);}return _0x38c7a9;};}function handleError(_0x12790c,_0x23b032){_0x23b032=_0x23b032||0x1f4;return function(_0x4138a2){logger[_0x4df9('0x2f')](_0x4138a2['stack']);if(_0x4138a2[_0x4df9('0x30')]){delete _0x4138a2[_0x4df9('0x30')];}_0x12790c[_0x4df9('0x28')](_0x23b032)[_0x4df9('0x31')](_0x4138a2);};}exports[_0x4df9('0x32')]=function(_0x298b15,_0x3ee40a){var _0x42aa30={},_0x52b346={},_0x150b6a={'count':0x0,'rows':[]};var _0x3079f4=_[_0x4df9('0x33')](db[_0x4df9('0x34')]['rawAttributes'],function(_0x24de38){return{'name':_0x24de38['fieldName'],'type':_0x24de38[_0x4df9('0x35')][_0x4df9('0x36')]};});_0x52b346[_0x4df9('0x37')]=_['map'](_0x3079f4,'name');_0x52b346['query']=_['keys'](_0x298b15[_0x4df9('0x38')]);_0x52b346[_0x4df9('0x39')]=_['intersection'](_0x52b346['model'],_0x52b346[_0x4df9('0x38')]);_0x42aa30['attributes']=_[_0x4df9('0x3a')](_0x52b346['model'],qs[_0x4df9('0x3b')](_0x298b15[_0x4df9('0x38')]['fields']));_0x42aa30['attributes']=_0x42aa30[_0x4df9('0x3c')][_0x4df9('0x3d')]?_0x42aa30[_0x4df9('0x3c')]:_0x52b346[_0x4df9('0x37')];if(!_0x298b15[_0x4df9('0x38')]['hasOwnProperty']('nolimit')){_0x42aa30[_0x4df9('0x25')]=qs[_0x4df9('0x25')](_0x298b15[_0x4df9('0x38')][_0x4df9('0x25')]);_0x42aa30[_0x4df9('0x27')]=qs[_0x4df9('0x27')](_0x298b15[_0x4df9('0x38')][_0x4df9('0x27')]);}_0x42aa30['order']=qs[_0x4df9('0x3e')](_0x298b15[_0x4df9('0x38')][_0x4df9('0x3e')]);_0x42aa30[_0x4df9('0x3f')]=qs[_0x4df9('0x39')](_[_0x4df9('0x40')](_0x298b15['query'],_0x52b346[_0x4df9('0x39')]),_0x3079f4);if(_0x298b15[_0x4df9('0x38')][_0x4df9('0x41')]){_0x42aa30[_0x4df9('0x3f')]=_[_0x4df9('0x42')](_0x42aa30[_0x4df9('0x3f')],{'$or':_['map'](_0x3079f4,function(_0x4af4a9){if(_0x4af4a9[_0x4df9('0x35')]!==_0x4df9('0x43')){var _0x5cc651={};_0x5cc651[_0x4af4a9[_0x4df9('0x30')]]={'$like':'%'+_0x298b15[_0x4df9('0x38')][_0x4df9('0x41')]+'%'};return _0x5cc651;}})});}_0x42aa30=_['merge']({},_0x42aa30,_0x298b15['options']);var _0x18f8ac={'where':_0x42aa30[_0x4df9('0x3f')]};return db[_0x4df9('0x34')][_0x4df9('0x26')](_0x18f8ac)[_0x4df9('0x2d')](function(_0x5cd4ce){_0x150b6a[_0x4df9('0x26')]=_0x5cd4ce;if(_0x298b15[_0x4df9('0x38')][_0x4df9('0x44')]){_0x42aa30['include']=[{'all':!![]}];}return db[_0x4df9('0x34')][_0x4df9('0x45')](_0x42aa30);})[_0x4df9('0x2d')](function(_0x54dfbc){_0x150b6a[_0x4df9('0x46')]=_0x54dfbc;return _0x150b6a;})[_0x4df9('0x2d')](respondWithFilteredResult(_0x3ee40a,_0x42aa30))[_0x4df9('0x47')](handleError(_0x3ee40a,null));};exports['show']=function(_0x1252b4,_0x32c823){var _0x1c706b={'raw':![],'where':{'id':_0x1252b4['params']['id']}},_0x56949d={};_0x56949d[_0x4df9('0x37')]=_[_0x4df9('0x48')](db[_0x4df9('0x34')]['rawAttributes']);_0x56949d[_0x4df9('0x38')]=_[_0x4df9('0x48')](_0x1252b4['query']);_0x56949d[_0x4df9('0x39')]=_[_0x4df9('0x3a')](_0x56949d[_0x4df9('0x37')],_0x56949d[_0x4df9('0x38')]);_0x1c706b[_0x4df9('0x3c')]=_[_0x4df9('0x3a')](_0x56949d[_0x4df9('0x37')],qs[_0x4df9('0x3b')](_0x1252b4[_0x4df9('0x38')]['fields']));_0x1c706b[_0x4df9('0x3c')]=_0x1c706b[_0x4df9('0x3c')]['length']?_0x1c706b['attributes']:_0x56949d[_0x4df9('0x37')];if(_0x1252b4['query']['includeAll']){_0x1c706b[_0x4df9('0x49')]=[{'all':!![]}];}_0x1c706b=_[_0x4df9('0x42')]({},_0x1c706b,_0x1252b4[_0x4df9('0x4a')]);return db['UserProfile'][_0x4df9('0x4b')](_0x1c706b)['then'](handleEntityNotFound(_0x32c823,null))[_0x4df9('0x2d')](respondWithResult(_0x32c823,null))[_0x4df9('0x47')](handleError(_0x32c823,null));};exports[_0x4df9('0x4c')]=function(_0x59db64,_0x320407){return db['UserProfile'][_0x4df9('0x4c')](_0x59db64[_0x4df9('0x4d')],{})['then'](respondWithResult(_0x320407,0xc9))[_0x4df9('0x47')](handleError(_0x320407,null));};exports[_0x4df9('0x4e')]=function(_0xd77f49,_0x474446){var _0x42634d={'where':{'id':_0xd77f49[_0x4df9('0x4f')]['id']}},_0x588690={};_0x588690[_0x4df9('0x37')]=_[_0x4df9('0x48')](db[_0x4df9('0x34')][_0x4df9('0x50')]);_0x42634d[_0x4df9('0x3c')]=_[_0x4df9('0x3a')](_0x588690['model'],qs[_0x4df9('0x3b')](_0xd77f49[_0x4df9('0x38')][_0x4df9('0x3b')]));_0x42634d[_0x4df9('0x3c')]=_0x42634d[_0x4df9('0x3c')][_0x4df9('0x3d')]?_0x42634d[_0x4df9('0x3c')]:_0x588690[_0x4df9('0x37')];if(_0xd77f49[_0x4df9('0x38')][_0x4df9('0x44')]){_0x42634d['include']=[{'all':!![]}];}_0x42634d=_['merge']({},_0x42634d,_0xd77f49[_0x4df9('0x4a')]);return db[_0x4df9('0x34')]['find'](_0x42634d)[_0x4df9('0x2d')](handleEntityNotFound(_0x474446,null))['then'](function(_0x318ee8){if(_0x318ee8){var _0x11ce31=_0x318ee8[_0x4df9('0x51')]({'plain':!![]});_0x11ce31=qs[_0x4df9('0x52')](_0x11ce31,['id','createdAt',_0x4df9('0x53'),_0x4df9('0x54')]);_0xd77f49['body']=_['omit'](_0xd77f49['body'],['id','createdAt',_0x4df9('0x53')]);return db[_0x4df9('0x55')]['transaction'](function(_0xd19834){return db[_0x4df9('0x34')][_0x4df9('0x4c')](_[_0x4df9('0x42')](_0x11ce31,_0xd77f49['body']),{'include':_0xd77f49[_0x4df9('0x38')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xd19834})[_0x4df9('0x2d')](function(_0x337b24){var _0x94d1e9=_0x337b24[_0x4df9('0x51')]({'plain':!![]});return db[_0x4df9('0x56')][_0x4df9('0x45')]({'where':{'userProfileId':_0xd77f49[_0x4df9('0x4f')]['id']},'raw':!![]})[_0x4df9('0x2d')](function(_0x368bc1){if(_0x368bc1){return BPromise[_0x4df9('0x57')](_0x368bc1,function(_0x1d4c1f){return new BPromise(function(_0x2bbd45,_0x593a2d){if(_0x1d4c1f[_0x4df9('0x58')]===null||_0x1d4c1f['autoAssociation']===0x1)_0x2bbd45(null);return db[_0x4df9('0x59')][_0x4df9('0x45')]({'where':{'sectionId':_0x1d4c1f['id']},'raw':!![]})[_0x4df9('0x2d')](function(_0x2e6c07){var _0x3408d7=_[_0x4df9('0x33')](_0x2e6c07,function(_0x434a1e){return qs['omit'](_0x434a1e,['id',_0x4df9('0x5a'),'updatedAt',_0x4df9('0x5b')]);});_0x2bbd45(_0x3408d7);})[_0x4df9('0x47')](function(_0x4f6676){_0x593a2d(_0x4f6676);});})[_0x4df9('0x2d')](function(_0x1905d9){var _0xbeacd5=qs['omit'](_0x1d4c1f,['id',_0x4df9('0x5a'),'updatedAt']);_0xbeacd5['userProfileId']=_0x94d1e9['id'];if(_0x1905d9)_0xbeacd5['Resources']=_0x1905d9;return _0xbeacd5;})[_0x4df9('0x2d')](function(_0x17dee4){return db[_0x4df9('0x56')][_0x4df9('0x4c')](_0x17dee4,{'include':[{'model':db[_0x4df9('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0xd19834});});})[_0x4df9('0x2d')](function(){return _0x94d1e9;});}});});});}})[_0x4df9('0x2d')](respondWithResult(_0x474446,0xc9))[_0x4df9('0x47')](handleError(_0x474446,null));};exports[_0x4df9('0x5c')]=function(_0x50c1ad,_0x227aa9){if(_0x50c1ad[_0x4df9('0x4d')]['id']){delete _0x50c1ad[_0x4df9('0x4d')]['id'];}return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x50c1ad[_0x4df9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x227aa9,null))[_0x4df9('0x2d')](saveUpdates(_0x50c1ad[_0x4df9('0x4d')],null))[_0x4df9('0x2d')](respondWithResult(_0x227aa9,null))[_0x4df9('0x47')](handleError(_0x227aa9,null));};exports[_0x4df9('0x2e')]=function(_0x287be7,_0x4f4206){return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x287be7[_0x4df9('0x4f')]['id']}})[_0x4df9('0x2d')](handleEntityNotFound(_0x4f4206,null))['then'](removeEntity(_0x4f4206,null))['catch'](handleError(_0x4f4206,null));};exports['describe']=function(_0x2bc042,_0x2d6bc5){return db[_0x4df9('0x34')][_0x4df9('0x5d')]()['then'](respondWithResult(_0x2d6bc5,null))[_0x4df9('0x47')](handleError(_0x2d6bc5,null));};exports['addSections']=function(_0x57d77c,_0x1c92a6){var _0x4a72ac=_0x57d77c['body'];return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x57d77c[_0x4df9('0x4f')]['id']}})[_0x4df9('0x2d')](handleEntityNotFound(_0x1c92a6,null))['then'](function(_0x268249){if(_0x268249){return db[_0x4df9('0x55')][_0x4df9('0x5e')](function(_0x4ec06c){return db[_0x4df9('0x56')]['destroy']({'where':{'userProfileId':_0x57d77c[_0x4df9('0x4f')]['id'],'sectionId':_['map'](_0x4a72ac,function(_0x2096cf){return _0x2096cf['sectionId'];})},'transaction':_0x4ec06c})[_0x4df9('0x2d')](function(){var _0x589dfe=_[_0x4df9('0x33')](_0x4a72ac,function(_0x1597ac){_0x1597ac[_0x4df9('0x5f')]=_0x57d77c['params']['id'];return _0x1597ac;});var _0x47d2b0=[];return BPromise['each'](_0x589dfe,function(_0x2da014){return db['UserProfileSection'][_0x4df9('0x4c')](_0x2da014,{'include':[{'model':db[_0x4df9('0x59')],'as':_0x4df9('0x60')}],'raw':!![],'transaction':_0x4ec06c})[_0x4df9('0x2d')](function(_0x599cd2){_0x47d2b0[_0x4df9('0x61')](_0x599cd2[_0x4df9('0x51')]({'plain':!![]}));});})[_0x4df9('0x2d')](function(){return _0x47d2b0;});});});}})['then'](function(_0x31a057){return _0x31a057;})[_0x4df9('0x2d')](respondWithResult(_0x1c92a6,null))['catch'](handleError(_0x1c92a6,null));};exports['removeSections']=function(_0x2e7c28,_0x26a6bd){var _0x46323d;return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x2e7c28['params']['id']},'attributes':['id',_0x4df9('0x30')]})[_0x4df9('0x2d')](handleEntityNotFound(_0x26a6bd,null))[_0x4df9('0x2d')](function(_0x13a719){if(_0x13a719){_0x46323d=_0x13a719;return db['UserProfileSection'][_0x4df9('0x2e')]({'where':{'userProfileId':_0x2e7c28[_0x4df9('0x4f')]['id'],'sectionId':_0x2e7c28[_0x4df9('0x38')][_0x4df9('0x62')]}});}})[_0x4df9('0x2d')](function(){return _0x46323d;})[_0x4df9('0x2d')](respondWithStatusCode(_0x26a6bd,null))[_0x4df9('0x47')](handleError(_0x26a6bd,null));};exports[_0x4df9('0x63')]=function(_0x50d9a9,_0xbb9ee5){var _0x1f2c81=[];var _0x20c0c0=[];return db[_0x4df9('0x56')][_0x4df9('0x45')]({'where':{'userProfileId':_0x50d9a9['params']['id']},'raw':!![]})['then'](function(_0x24b969){_0x1f2c81=_[_0x4df9('0x41')](_0x24b969,function(_0xeeed17){return _0xeeed17[_0x4df9('0x64')]===0x1||_[_0x4df9('0x65')]([0x3eb,0x709],_0xeeed17[_0x4df9('0x5b')]);});if(!_[_0x4df9('0x66')](_0x1f2c81)){return _[_0x4df9('0x33')](_0x1f2c81,function(_0x59ad0e){return _0x59ad0e[_0x4df9('0x5b')];});}else{return;}})[_0x4df9('0x2d')](function(_0x35936b){if(_0x35936b)_0x20c0c0=_0x35936b;if(_['includes'](_0x20c0c0,0x64)){var _0xfb1164=_[_0x4df9('0x4b')](_0x1f2c81,{'sectionId':0x64});return hasDefaultDashboard(_0xfb1164)['then'](function(_0x5593de){return _['map'](_0x1f2c81,function(_0x38feda){if(_0x38feda['sectionId']===0x64){_0x38feda[_0x4df9('0x67')]=_0x5593de;}return _0x38feda;});});}else{return;}})[_0x4df9('0x2d')](function(_0x3d9e31){if(_0x3d9e31)_0x1f2c81=_0x3d9e31;if(_['includes'](_0x20c0c0,0x3eb)){var _0x41208e=_[_0x4df9('0x4b')](_0x1f2c81,{'sectionId':0x3eb});return getCustomDashboards(_0x41208e)[_0x4df9('0x2d')](function(_0x2bbf14){return _['map'](_0x1f2c81,function(_0x2ba2c9){if(_0x41208e['enabled']){if(_0x2ba2c9['sectionId']===0x3eb){_0x2ba2c9[_0x4df9('0x67')]=_0x2bbf14;}}else{if(_0x2ba2c9[_0x4df9('0x5b')]===0x64){_0x2ba2c9[_0x4df9('0x67')]=_0x2bbf14;}}return _0x2ba2c9;});});}else{return;}})[_0x4df9('0x2d')](function(_0xbf286e){if(_0xbf286e)_0x1f2c81=_0xbf286e;if(_[_0x4df9('0x65')](_0x20c0c0,0x709)){var _0x3c1c27=_[_0x4df9('0x4b')](_0x1f2c81,{'sectionId':0x709});return getPlugins(_0x3c1c27)['then'](function(_0xe5c6e7){if(_0x3c1c27[_0x4df9('0x64')]){return _[_0x4df9('0x33')](_0x1f2c81,function(_0x123442){if(_0x123442[_0x4df9('0x5b')]===0x709){_0x123442[_0x4df9('0x67')]=_0xe5c6e7;}return _0x123442;});}else{var _0x577654={'sectionId':0x76c,'enabled':0x1,'subsections':_0xe5c6e7};var _0x21d78c=_[_0x4df9('0x33')](_0x1f2c81);_0x21d78c['push'](_0x577654);return _0x21d78c;}});}else{return;}})[_0x4df9('0x2d')](function(_0x524daa){if(_0x524daa)_0x1f2c81=_0x524daa;return _[_0x4df9('0x41')](_0x1f2c81,[_0x4df9('0x64'),0x1]);})[_0x4df9('0x2d')](respondWithResult(_0xbb9ee5,null))[_0x4df9('0x47')](handleError(_0xbb9ee5,null));};function hasDefaultDashboard(_0x2a6114){var _0x4e1dd6=[0x65];return new BPromise(function(_0x184ab6,_0x2be881){try{if(_0x2a6114[_0x4df9('0x58')]){_0x184ab6(_0x4e1dd6);}else{return db['UserProfileResource'][_0x4df9('0x68')]({'where':{'sectionId':_0x2a6114['id']},'raw':!![]})['then'](function(_0x2d2716){_0x2d2716?_0x184ab6(_0x4e1dd6):_0x184ab6();});}}catch(_0xc2e724){_0x2be881(_0xc2e724);}});}function getCustomDashboards(_0x408fa2){var _0x136210=[];return new BPromise(function(_0xad5d2d,_0x298ffd){try{if(_0x408fa2[_0x4df9('0x58')]){return db[_0x4df9('0x69')][_0x4df9('0x45')]({'raw':!![]})[_0x4df9('0x2d')](function(_0x4d4d53){_0x4d4d53['forEach'](function(_0x1ef32b){_0x136210[_0x4df9('0x61')](_0x1ef32b['id']+0x1869f);});_0xad5d2d(_0x136210);});}else{return db[_0x4df9('0x59')][_0x4df9('0x45')]({'where':{'sectionId':_0x408fa2['id']},'raw':!![]})[_0x4df9('0x2d')](function(_0x43abfa){_0x43abfa['forEach'](function(_0x2ebc02){_0x136210['push'](_0x2ebc02[_0x4df9('0x6a')]+0x1869f);});_0xad5d2d(_0x136210);});}}catch(_0x2213e2){_0x298ffd(_0x2213e2);}});}function getPlugins(_0x41d27f){var _0x183871=[];return new BPromise(function(_0x358b5e,_0x5e7e19){try{if(_0x41d27f[_0x4df9('0x58')]){return db[_0x4df9('0x6b')][_0x4df9('0x45')]({'raw':!![]})['then'](function(_0x5db2d7){_0x5db2d7['forEach'](function(_0x19c048){_0x183871['push'](_0x19c048['id']+0x15b38);});_0x358b5e(_0x183871);});}else{return db[_0x4df9('0x59')][_0x4df9('0x45')]({'where':{'sectionId':_0x41d27f['id']},'raw':!![]})[_0x4df9('0x2d')](function(_0x13aa5d){_0x13aa5d[_0x4df9('0x6c')](function(_0x33894b){_0x183871[_0x4df9('0x61')](_0x33894b[_0x4df9('0x6a')]+0x15b38);});_0x358b5e(_0x183871);});}}catch(_0x3b9af6){_0x5e7e19(_0x3b9af6);}});}exports[_0x4df9('0x6d')]=function(_0x412e00,_0x222c4e){return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x412e00[_0x4df9('0x4f')]['id']}})[_0x4df9('0x2d')](handleEntityNotFound(_0x222c4e,null))[_0x4df9('0x2d')](function(_0xf4ff1e){if(_0xf4ff1e){return db[_0x4df9('0x55')][_0x4df9('0x5e')](function(_0x431ff1){return db[_0x4df9('0x56')]['findAll']({'where':{'userProfileId':_0x412e00[_0x4df9('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x4df9('0x2d')](function(_0x207c1b){if(_0x207c1b){return db[_0x4df9('0x56')][_0x4df9('0x2e')]({'where':{'userProfileId':_0x412e00[_0x4df9('0x4f')]['id'],'id':_[_0x4df9('0x33')](_0x207c1b,function(_0x152450){return _0x152450['id'];})},'transaction':_0x431ff1});}})[_0x4df9('0x2d')](function(_0x10467c){var _0x442858=_['map'](_0x412e00[_0x4df9('0x4d')],function(_0x4c344e){_0x4c344e[_0x4df9('0x5f')]=_0x412e00['params']['id'];return _0x4c344e;});return db[_0x4df9('0x56')][_0x4df9('0x6e')](_0x442858,{'raw':!![],'transaction':_0x431ff1});})['then'](function(_0x42d45f){var _0x10cb17=_[_0x4df9('0x41')](_[_0x4df9('0x33')](_0x42d45f,function(_0x3d4780){return _0x3d4780[_0x4df9('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x10cb17){return db[_0x4df9('0x56')][_0x4df9('0x45')]({'where':{'userProfileId':_0x412e00[_0x4df9('0x4f')]['id'],'sectionId':_['map'](_0x10cb17,function(_0x3b1f45){return _0x3b1f45['sectionId'];})},'attributes':['id',_0x4df9('0x5b')],'raw':!![]})['then'](function(_0x3b8476){var _0x4ba64f=_['map'](_0x412e00[_0x4df9('0x4d')],function(_0x4a8f80){_0x4a8f80['userProfileId']=_0x412e00[_0x4df9('0x4f')]['id'];return _0x4a8f80;});return db[_0x4df9('0x59')][_0x4df9('0x6e')](_0x4ba64f,{'raw':!![],'transaction':_0x431ff1});});}})[_0x4df9('0x47')](handleError(_0x222c4e,null));});}})[_0x4df9('0x2d')](function(_0x1e9bba){var _0x289ed3=_[_0x4df9('0x33')](_0x1e9bba,function(_0x1a7534){return _0x1a7534[_0x4df9('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x222c4e,null))['catch'](handleError(_0x222c4e,null));};exports[_0x4df9('0x6f')]=function(_0x447893,_0x25b116,_0x2e9f46){return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x447893['params']['id']}})[_0x4df9('0x2d')](handleEntityNotFound(_0x25b116,null))[_0x4df9('0x2d')](function(_0x59551c){if(_0x59551c){return _0x59551c['removeResources'](_0x447893[_0x4df9('0x38')][_0x4df9('0x62')]);}})[_0x4df9('0x2d')](respondWithStatusCode(_0x25b116,null))[_0x4df9('0x47')](handleError(_0x25b116,null));};exports['getResources']=function(_0x5321a0,_0x39c616){var _0x5c54b4={};if(!_0x5321a0[_0x4df9('0x38')][_0x4df9('0x70')])throw new Error(_0x4df9('0x71'));if(!_0x5321a0[_0x4df9('0x38')][_0x4df9('0x72')](_0x4df9('0x73'))){_0x5c54b4['limit']=qs[_0x4df9('0x25')](_0x5321a0[_0x4df9('0x38')][_0x4df9('0x25')]);_0x5c54b4[_0x4df9('0x27')]=qs['offset'](_0x5321a0[_0x4df9('0x38')]['offset']);}return db[_0x4df9('0x34')][_0x4df9('0x4b')]({'where':{'id':_0x5321a0['params']['id']}})[_0x4df9('0x2d')](function(_0x16c310){if(!_0x16c310)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5321a0['params']['id']);return db[_0x4df9('0x34')]['getResources'](_0x5321a0);})['then'](respondWithFilteredResult(_0x39c616,_0x5c54b4))['catch'](handleError(_0x39c616,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a964902..3abc586 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 _0xcaf2=['hook','exports','events','UserProfile','setMaxListeners','update','remove','emit'];(function(_0x3334c5,_0x2a8b40){var _0x19e791=function(_0x37fe04){while(--_0x37fe04){_0x3334c5['push'](_0x3334c5['shift']());}};_0x19e791(++_0x2a8b40);}(_0xcaf2,0x8a));var _0x2caf=function(_0x17a0a0,_0x1befaa){_0x17a0a0=_0x17a0a0-0x0;var _0x4da752=_0xcaf2[_0x17a0a0];return _0x4da752;};'use strict';var EventEmitter=require(_0x2caf('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x2caf('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2caf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2caf('0x3'),'afterDestroy':_0x2caf('0x4')};function emitEvent(_0x5b4a90){return function(_0xb4fae,_0x4d046b,_0x335e3c){UserProfileEvents[_0x2caf('0x5')](_0x5b4a90+':'+_0xb4fae['id'],_0xb4fae);UserProfileEvents[_0x2caf('0x5')](_0x5b4a90,_0xb4fae);_0x335e3c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x2caf('0x6')](e,emitEvent(event));}}module[_0x2caf('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xcb22=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xcb22,0xc8));var _0x2cb2=function(_0x1c22a3,_0x24339e){_0x1c22a3=_0x1c22a3-0x0;var _0x183093=_0xcb22[_0x1c22a3];return _0x183093;};'use strict';var EventEmitter=require(_0x2cb2('0x0'));var UserProfile=require(_0x2cb2('0x1'))['db'][_0x2cb2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2cb2('0x3')](0x0);var events={'afterCreate':_0x2cb2('0x4'),'afterUpdate':_0x2cb2('0x5'),'afterDestroy':_0x2cb2('0x6')};function emitEvent(_0xe763ff){return function(_0x386f8b,_0x3b1af5,_0x3dec93){UserProfileEvents['emit'](_0xe763ff+':'+_0x386f8b['id'],_0x386f8b);UserProfileEvents[_0x2cb2('0x7')](_0xe763ff,_0x386f8b);_0x3dec93(null);};}for(var e in events){if(events[_0x2cb2('0x8')](e)){var event=events[e];UserProfile[_0x2cb2('0x9')](e,emitEvent(event));}}module[_0x2cb2('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 d5770c1..d3c25a6 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 _0x2542=['parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','VoiceContext','voicemails','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','Schedule','sounds','Sound','Tag','Template','triggers','trunks','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','length','model','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','reportId','DefaultReports','CustomReports','count','rows','ids','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact'];(function(_0x3dab16,_0x42335a){var _0x8d1f56=function(_0x11f3ea){while(--_0x11f3ea){_0x3dab16['push'](_0x3dab16['shift']());}};_0x8d1f56(++_0x42335a);}(_0x2542,0x169));var _0x2254=function(_0x112056,_0xaf65a2){_0x112056=_0x112056-0x0;var _0x221fc6=_0x2542[_0x112056];return _0x221fc6;};'use strict';var _=require(_0x2254('0x0'));var attributes=require(_0x2254('0x1'));var qs=require(_0x2254('0x2'));var squel=require(_0x2254('0x3'));module['exports']=function(_0x105910){var _0x47b1da=_0x105910[_0x2254('0x4')];function _0x3b3dcb(_0x27f5c9,_0x456612){return new Promise(function(_0x76c902,_0x508183){if(!_0x456612)return _0x76c902(null);var _0x19ad3c=_0x456612[_0x2254('0x5')]?{[_0x456612[_0x2254('0x5')][_0x2254('0x6')]]:_0x456612[_0x2254('0x5')][_0x2254('0x7')]}:undefined;return _0x47b1da[_0x27f5c9][_0x2254('0x8')]({'where':_0x19ad3c,'raw':!![]})[_0x2254('0x9')](function(_0xb395da){_0x456612[_0x2254('0xa')]=_[_0x2254('0xb')](_0xb395da,'id');_0x76c902(_0x456612);})['catch'](function(_0x336e14){_0x508183(_0x336e14);});});}function _0x2655ea(_0x506abe,_0x143c90){return new Promise(function(_0x575d58,_0x524fad){var _0xe4fc71=_0x506abe[_0x2254('0x5')]?{[_0x506abe[_0x2254('0x5')][_0x2254('0x6')]]:_0x506abe[_0x2254('0x5')][_0x2254('0x7')]}:undefined;return _0x47b1da[_0x506abe['model']][_0x2254('0x8')]({'where':_0xe4fc71,'raw':!![]})[_0x2254('0x9')](function(_0x504749){_0x143c90[_0x2254('0xa')]=_[_0x2254('0xb')](_0x504749,function(_0xfb23cb){return _0xfb23cb[_0x2254('0xc')];});_0x575d58(_0x143c90);})[_0x2254('0xd')](function(_0xbc5548){_0x524fad(_0xbc5548);});});}function _0x50f137(_0x18baf4,_0x57247a,_0x327d6d){if(!_0x57247a)return Promise[_0x2254('0xe')](null);return new Promise(function(_0x170ffa,_0x25f8b2){return _0x47b1da[_0x2254('0xf')][_0x2254('0x8')]({'where':{'sectionId':_0x57247a['id']},'raw':!![]})['then'](function(_0x51b395){if(_0x18baf4['field']&&_0x18baf4[_0x2254('0x6')]!=='id'){_0x57247a[_0x2254('0xa')]=_[_0x2254('0xb')](_0x51b395,function(_0x1f1163){return _0x1f1163[_0x18baf4[_0x2254('0x6')]];});}else{if(_0x327d6d===_0x2254('0x10')){_0x57247a['associatedResources']=_[_0x2254('0xb')](_0x51b395,function(_0x16148d){return{'id':_0x16148d[_0x2254('0x11')],'type':_0x16148d['type']};});}else{_0x57247a['associatedResources']=_['map'](_0x51b395,function(_0x1e8a98){return _0x1e8a98[_0x2254('0x11')];});}}_0x170ffa(_0x57247a);})[_0x2254('0xd')](function(_0x56b91e){_0x25f8b2(_0x56b91e);});});}function _0x5713e4(_0x4d8faf,_0x540020){var _0x5e5edb={'parentSections':[]};switch(_0x4d8faf['toLowerCase']()){case _0x2254('0x12'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x14');break;case _0x2254('0x15'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x16');break;case'squarerecordings':_0x5e5edb['childModel']=_0x2254('0x17');_0x5e5edb['parentSections']=[{'name':_0x2254('0x18'),'field':_0x2254('0xc'),'foreignKey':_0x2254('0x19')}];break;case _0x2254('0x1a'):_0x5e5edb[_0x2254('0x13')]='JscriptyProject';break;case _0x2254('0x1b'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x1c');_0x5e5edb[_0x2254('0x1d')]=[{'name':_0x2254('0x1e'),'field':'id','foreignKey':_0x2254('0x1f')}];break;case _0x2254('0x20'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x21');break;case _0x2254('0x22'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x23');break;case _0x2254('0x24'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x25');break;case _0x2254('0x26'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x27');break;case _0x2254('0x28'):_0x5e5edb['childModel']=_0x2254('0x29');break;case _0x2254('0x2a'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x2b');break;case _0x2254('0x2c'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x2d');break;case _0x2254('0x2e'):case _0x2254('0x2f'):case'outboundroutes':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x30');break;case'contexts':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x31');break;case _0x2254('0x32'):_0x5e5edb[_0x2254('0x13')]='VoiceMail';break;case'voicerecordings':_0x5e5edb[_0x2254('0x13')]='VoiceRecording';_0x5e5edb[_0x2254('0x1d')]=[{'name':_0x2254('0x33'),'field':_0x2254('0xc'),'foreignKey':_0x2254('0x34'),'model':_0x2254('0x35'),'filter':{'field':_0x2254('0x36'),'value':[_0x2254('0x37')]}},{'name':'Telephones','field':_0x2254('0xc'),'foreignKey':_0x2254('0x34'),'model':_0x2254('0x35'),'filter':{'field':_0x2254('0x36'),'value':[_0x2254('0x38')]}},{'name':_0x2254('0x39'),'field':_0x2254('0xc'),'foreignKey':_0x2254('0x3a'),'model':_0x2254('0x3b'),'filter':{'field':_0x2254('0x3c'),'value':['inbound']}},{'name':_0x2254('0x3d'),'field':_0x2254('0xc'),'foreignKey':_0x2254('0x3a'),'model':_0x2254('0x3b'),'filter':{'field':'type','value':[_0x2254('0x3e')]}}];break;case _0x2254('0x3f'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x40');break;case _0x2254('0x41'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x42');break;case _0x2254('0x43'):_0x5e5edb['childModel']=_0x2254('0x44');break;case'ivrcampaigns':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x45');break;case _0x2254('0x46'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x47');break;case _0x2254('0x48'):_0x5e5edb[_0x2254('0x13')]='MailAccount';break;case _0x2254('0x49'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x4a');break;case _0x2254('0x4b'):_0x5e5edb[_0x2254('0x13')]='OpenchannelQueue';break;case _0x2254('0x4c'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x4d');break;case _0x2254('0x4e'):_0x5e5edb[_0x2254('0x13')]='SmsQueue';break;case _0x2254('0x4f'):_0x5e5edb['childModel']=_0x2254('0x50');break;case _0x2254('0x51'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x52');break;case _0x2254('0x53'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x54');break;case _0x2254('0x55'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x56');break;case _0x2254('0x57'):case _0x2254('0x58'):_0x5e5edb[_0x2254('0x13')]='VoiceQueue';if(_0x540020){_0x5e5edb[_0x2254('0x1d')]=[{'name':_0x2254('0x39')},{'name':_0x2254('0x3d')}];}break;case'users':case _0x2254('0x59'):case _0x2254('0x5a'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x35');if(_0x540020){_0x5e5edb[_0x2254('0x1d')]=[{'name':_0x2254('0x5b'),'filter':{'field':_0x2254('0x36'),'value':[_0x2254('0x5c'),_0x2254('0x5d')]},'ignore':!![]},{'name':'Agents'},{'name':_0x2254('0x5e')}];}break;case _0x2254('0x5f'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x60');break;case _0x2254('0x61'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x62');break;case _0x2254('0x63'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x64');break;case'sugarcrmaccounts':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x65');break;case'deskaccounts':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x66');break;case _0x2254('0x67'):_0x5e5edb[_0x2254('0x13')]='ZohoAccount';break;case _0x2254('0x68'):_0x5e5edb[_0x2254('0x13')]='User';break;case _0x2254('0x69'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x6a');break;case _0x2254('0x6b'):_0x5e5edb['childModel']=_0x2254('0x6c');break;case _0x2254('0x6d'):_0x5e5edb[_0x2254('0x13')]='Dashboard';break;case'intervals':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x6e');break;case'pauses':_0x5e5edb[_0x2254('0x13')]='Pause';break;case'scheduler':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x6f');break;case _0x2254('0x70'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x71');break;case'tags':_0x5e5edb['childModel']=_0x2254('0x72');break;case'templates':_0x5e5edb[_0x2254('0x13')]=_0x2254('0x73');break;case _0x2254('0x74'):_0x5e5edb[_0x2254('0x13')]='Trigger';break;case _0x2254('0x75'):_0x5e5edb[_0x2254('0x13')]='Trunk';break;case'variables':_0x5e5edb[_0x2254('0x13')]='Variable';break;case _0x2254('0x76'):_0x5e5edb[_0x2254('0x13')]=_0x2254('0x77');break;case _0x2254('0x78'):_0x5e5edb[_0x2254('0x13')]='AnalyticExtractedReport';_0x5e5edb['parentSections']=[{'name':_0x2254('0x79'),'field':'id','foreignKey':'reportId'}];break;case _0x2254('0x7a'):_0x5e5edb['childModel']='AnalyticMetric';break;}return _0x5e5edb;}function _0x5999c8(_0x2c0063,_0x448773){var _0x1d4b90=_0x2c0063[_0x2254('0x7b')](0x0)[_0x2254('0x7c')]()+_0x2c0063[_0x2254('0x7d')](0x1);var _0x14b1ba={'type':_0x47b1da[_0x2254('0x7e')][_0x2254('0x7f')][_0x2254('0x80')],'raw':!![]};return new Promise(function(_0x2e68b5,_0x44cfd9){var _0x41c97d=squel[_0x2254('0x81')]()[_0x2254('0x6')](_0x2254('0x82')+_0x1d4b90+_0x2254('0x83'),'id')[_0x2254('0x6')](_0x2254('0x84'))['from'](_0x2254('0x85')+_0x2c0063+_0x2254('0x86'),'ui')[_0x2254('0x87')](_0x2254('0x88'),_0x448773['id']);return _0x47b1da['sequelize']['query'](_0x41c97d[_0x2254('0x89')](),_0x14b1ba)[_0x2254('0x9')](function(_0x1d73a3){_0x448773[_0x1d4b90+_0x2254('0x8a')]=_0x1d73a3;_0x2e68b5(_0x1d73a3);})[_0x2254('0xd')](function(_0x53b55b){_0x44cfd9(_0x53b55b);});});}return _0x105910[_0x2254('0x8b')](_0x2254('0x8c'),attributes,{'tableName':_0x2254('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4a7d36){var _0x5ada4c={'raw':_0x4a7d36[_0x2254('0x8e')]['raw'],'where':{}};var _0x294931={};var _0x232d6c={'count':0x0,'rows':[]};var _0x5b269d=_0x4a7d36[_0x2254('0x8e')][_0x2254('0x8f')];var _0x4d30a5=_0x4a7d36[_0x2254('0x8e')][_0x2254('0x90')]||![];var _0x4c6104=_0x5713e4(_0x5b269d,_0x4d30a5);if(!_0x4c6104['childModel'])throw new Error(_0x2254('0x91')+_0x5b269d+'\x27');var _0xa159a4=[{'name':_0x5b269d}];if(!_['isEmpty'](_0x4c6104['parentSections']))_0xa159a4=_0x4c6104[_0x2254('0x1d')];var _0x53fca8=[];for(var _0x1d880f=0x0;_0x1d880f<_0xa159a4['length'];_0x1d880f++){_0x53fca8[_0x2254('0x92')](_0x47b1da[_0x2254('0x93')][_0x2254('0x94')]({'where':{'userProfileId':_0x4a7d36[_0x2254('0x95')]['id'],'name':_0xa159a4[_0x1d880f]['name']},'raw':!![]}));}return Promise[_0x2254('0x96')](_0x53fca8)['then'](function(_0x1c2158){var _0x33cab6=_['filter'](_0x1c2158,function(_0x43211c){return _0x43211c?_0x43211c:undefined;});var _0x23a889=_['filter'](_0xa159a4,[_0x2254('0x97'),!![]]);var _0x3b3b20=_[_0x2254('0x98')](_0x33cab6)&&_[_0x2254('0x98')](_0x23a889)?null:_['union'](_0x23a889,_0x33cab6);if(!_0x3b3b20)return null;var _0x46e89b=[];for(var _0x301db7=0x0;_0x301db7<_0x3b3b20['length'];_0x301db7++){var _0x1ac8ff=_[_0x2254('0x94')](_0xa159a4,function(_0x49d611){return _0x3b3b20[_0x301db7]?_0x49d611[_0x2254('0xc')]===_0x3b3b20[_0x301db7]['name']:null;});if(_0x1ac8ff){if(_0x3b3b20[_0x301db7][_0x2254('0x97')]){_0x46e89b['push'](_0x3b3dcb(_0x4c6104[_0x2254('0x13')],_0x3b3b20[_0x301db7]));}else{if(!_0x3b3b20[_0x301db7][_0x2254('0x99')]){_0x46e89b['push'](_0x50f137(_0x1ac8ff,_0x3b3b20[_0x301db7],_0x4c6104[_0x2254('0x13')]));}else{if(_0x1ac8ff['model']){_0x46e89b[_0x2254('0x92')](_0x2655ea(_0x1ac8ff,_0x3b3b20[_0x301db7]));}}}}}return Promise[_0x2254('0x96')](_0x46e89b);})[_0x2254('0x9')](function(_0x567894){var _0x14c384=_0x567894;var _0x5afa65=null;if(_0x14c384){_0x5afa65=_0x14c384[_0x2254('0x9a')]===0x1?_0x14c384[0x0]:null;}if(!_0x5afa65&&!_0x14c384)return _0x232d6c;var _0x33f29b=_0x47b1da[_0x4c6104['childModel']]['rawAttributes'];_0x294931[_0x2254('0x9b')]=_[_0x2254('0x9c')](_0x33f29b);_0x294931[_0x2254('0x8e')]=_[_0x2254('0x9c')](_0x4a7d36['query']);_0x294931[_0x2254('0x9d')]=_[_0x2254('0x9e')](_0x294931[_0x2254('0x9b')],_0x294931[_0x2254('0x8e')]);_0x5ada4c['attributes']=_[_0x2254('0x9e')](_0x294931[_0x2254('0x9b')],qs['fields'](_0x4a7d36[_0x2254('0x8e')]['fields']));_0x5ada4c[_0x2254('0x9f')]=_0x5ada4c['attributes']['length']?_0x5ada4c['attributes']:_0x294931[_0x2254('0x9b')];if(!_0x4a7d36['query'][_0x2254('0xa0')](_0x2254('0xa1'))){_0x5ada4c['limit']=qs[_0x2254('0xa2')](_0x4a7d36[_0x2254('0x8e')][_0x2254('0xa2')]);_0x5ada4c[_0x2254('0xa3')]=qs[_0x2254('0xa3')](_0x4a7d36[_0x2254('0x8e')]['offset']);}_0x5ada4c['order']=qs[_0x2254('0xa4')](_0x4a7d36[_0x2254('0x8e')][_0x2254('0xa4')]);_0x5ada4c[_0x2254('0x87')]=qs[_0x2254('0x9d')](_[_0x2254('0xa5')](_0x4a7d36[_0x2254('0x8e')],_0x294931[_0x2254('0x9d')]));if(_0x4a7d36[_0x2254('0x8e')][_0x2254('0x5')]){_0x5ada4c['where']=_[_0x2254('0xa6')](_0x5ada4c[_0x2254('0x87')],{'$or':_['map'](_0x33f29b,function(_0x447e4f){if(_0x447e4f['type'][_0x2254('0xa7')]!==_0x2254('0xa8')){var _0x4dfcb4={};_0x4dfcb4[_0x447e4f[_0x2254('0x6')]]={'$like':'%'+_0x4a7d36['query'][_0x2254('0x5')]+'%'};return _0x4dfcb4;}})});}var _0x2f66ba=[];var _0x30f2c9=null;var _0x1f7a48={};if(_0x5afa65){_0x30f2c9=_['find'](_0xa159a4,[_0x2254('0xc'),_0x5afa65[_0x2254('0xc')]]);if(_0x30f2c9[_0x2254('0x6')]){_0x1f7a48={};if(_0x4c6104[_0x2254('0x13')]==='AnalyticExtractedReport'){_0x1f7a48[_0x30f2c9[_0x2254('0xa9')]]=_[_0x2254('0xb')](_0x5afa65['associatedResources'],'id');}else{_0x1f7a48[_0x30f2c9[_0x2254('0xa9')]]=_0x5afa65[_0x2254('0xa')];}_0x2f66ba['push'](_0x1f7a48);}else{_0x5ada4c['where']['id']=_0x5afa65[_0x2254('0xa')];}}else{for(var _0x2f3650=0x0;_0x2f3650<_0x14c384[_0x2254('0x9a')];_0x2f3650++){_0x30f2c9=_[_0x2254('0x94')](_0xa159a4,[_0x2254('0xc'),_0x14c384[_0x2f3650][_0x2254('0xc')]]);if(_0x30f2c9[_0x2254('0x6')]){_0x1f7a48={};_0x1f7a48[_0x30f2c9[_0x2254('0xa9')]]=_0x14c384[_0x2f3650][_0x2254('0xa')];_0x2f66ba['push'](_0x1f7a48);}else{if(!_0x5ada4c[_0x2254('0x87')]['id'])_0x5ada4c['where']['id']=[];_0x14c384[_0x2f3650][_0x2254('0xa')]['forEach'](function(_0x36d121){_0x5ada4c[_0x2254('0x87')]['id'][_0x2254('0x92')](_0x36d121);});}}}if(!_['isEmpty'](_0x2f66ba)){_0x5ada4c[_0x2254('0x87')]=_[_0x2254('0xa6')](_0x5ada4c[_0x2254('0x87')],{'$and':{'$or':_0x2f66ba}});}_0x5ada4c=_[_0x2254('0xa6')]({},_0x5ada4c,_0x4a7d36[_0x2254('0xaa')]);if(_0x5afa65&&!_0x5afa65[_0x2254('0x99')]&&_0x4c6104[_0x2254('0x13')]===_0x2254('0x10')){if(_0x4a7d36[_0x2254('0x8e')][_0x2254('0xab')]){_0x5ada4c[_0x2254('0xac')]=[{'all':!![]}];}return _0x47b1da[_0x4c6104[_0x2254('0x13')]][_0x2254('0x8')](_0x5ada4c)['then'](function(_0x806221){var _0x4be714=[];_0x806221[_0x2254('0xad')](function(_0xb98b40){var _0x3b1d5c;switch(_0xb98b40[_0x2254('0xae')]){case _0x2254('0xaf'):_0x3b1d5c=_[_0x2254('0x94')](_0x5afa65[_0x2254('0xa')],function(_0x5b7f24){return _0x5b7f24['id']===_0xb98b40[_0x2254('0xb0')]&&_0x5b7f24['type']===_0x2254('0xb1');});break;case'custom':_0x3b1d5c=_[_0x2254('0x94')](_0x5afa65[_0x2254('0xa')],function(_0x1d0c8f){return _0x1d0c8f['id']===_0xb98b40['reportId']&&_0x1d0c8f[_0x2254('0x3c')]===_0x2254('0xb2');});break;}if(_0x3b1d5c)_0x4be714[_0x2254('0x92')](_0xb98b40);});_0x232d6c[_0x2254('0xb3')]=_0x4be714[_0x2254('0x9a')];_0x232d6c[_0x2254('0xb4')]=_0x4be714;return _0x232d6c;});}else{if(!_[_0x2254('0x98')](_0x4a7d36[_0x2254('0x8e')]['ids'])){_0x5ada4c['where']['id']=_0x5ada4c[_0x2254('0x87')]['id']?_['intersection'](_0x5ada4c[_0x2254('0x87')]['id'],_0x4a7d36[_0x2254('0x8e')][_0x2254('0xb5')]):_0x4a7d36[_0x2254('0x8e')][_0x2254('0xb5')];}return _0x47b1da[_0x4c6104[_0x2254('0x13')]][_0x2254('0xb3')]({'where':_0x5ada4c['where']})[_0x2254('0x9')](function(_0x34ac83){_0x232d6c[_0x2254('0xb3')]=_0x34ac83;if(_0x4a7d36['query'][_0x2254('0xab')]){if(_0x4c6104[_0x2254('0x13')]===_0x2254('0x1c')){_0x5ada4c[_0x2254('0xac')]=[{'model':_0x47b1da[_0x2254('0x72')],'as':_0x2254('0xb6'),'attributes':['id',_0x2254('0xc'),_0x2254('0xb7')],'required':_0x4a7d36[_0x2254('0x8e')]['tag']?!![]:![]},{'model':_0x47b1da[_0x2254('0x72')],'as':_0x2254('0xb8'),'attributes':['id','name','color'],'through':_0x4a7d36[_0x2254('0x8e')]['tag']?{'attributes':[],'where':{'TagId':_0x4a7d36[_0x2254('0x8e')][_0x2254('0xb9')]||undefined}}:{},'required':_0x4a7d36[_0x2254('0x8e')][_0x2254('0xb9')]?!![]:![]}];}else{_0x5ada4c[_0x2254('0xac')]=[{'all':!![]}];}}return _0x47b1da[_0x4c6104[_0x2254('0x13')]][_0x2254('0x8')](_0x5ada4c);})[_0x2254('0x9')](function(_0x5bf7cf){_0x232d6c['rows']=_0x5bf7cf;if(_0x5b269d===_0x2254('0x33')&&_0x4a7d36[_0x2254('0x8e')][_0x2254('0xba')]===_0x2254('0xbb')){var _0x201da7=[];for(var _0x4fac52=0x0;_0x4fac52<_0x232d6c['rows'][_0x2254('0x9a')];_0x4fac52++){_0x201da7['push'](_0x5999c8(_0x2254('0xbc'),_0x232d6c[_0x2254('0xb4')][_0x4fac52][_0x2254('0xbd')]));_0x201da7[_0x2254('0x92')](_0x5999c8(_0x2254('0xbe'),_0x232d6c[_0x2254('0xb4')][_0x4fac52][_0x2254('0xbd')]));_0x201da7['push'](_0x5999c8(_0x2254('0xbf'),_0x232d6c[_0x2254('0xb4')][_0x4fac52]['dataValues']));_0x201da7[_0x2254('0x92')](_0x5999c8(_0x2254('0xc0'),_0x232d6c[_0x2254('0xb4')][_0x4fac52][_0x2254('0xbd')]));_0x201da7[_0x2254('0x92')](_0x5999c8(_0x2254('0xc1'),_0x232d6c[_0x2254('0xb4')][_0x4fac52][_0x2254('0xbd')]));_0x201da7[_0x2254('0x92')](_0x5999c8(_0x2254('0xc2'),_0x232d6c[_0x2254('0xb4')][_0x4fac52]['dataValues']));}return Promise[_0x2254('0x96')](_0x201da7)[_0x2254('0x9')](function(){return _0x232d6c;});}return _0x232d6c;});}});}}});}; \ No newline at end of file +var _0x2032=['offset','order','sort','merge','key','foreignKey','forEach','options','includeAll','reportType','default','reportId','DefaultReports','custom','CustomReports','count','rows','ids','Tags','color','ThroughTags','tag','include','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','filter','field','value','map','catch','findAll','associatedResources','name','then','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','agent','Telephones','role','VoiceQueues','queue','type','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','VoiceQueue','users','agents','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','intervals','pauses','scheduler','Schedule','sounds','Sound','Tag','Template','triggers','Trigger','trunks','variables','plugins','Plugin','Reports','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','union','length','ignore','autoAssociation','model','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x3b98c1,_0x3a4ae5){var _0x26990b=function(_0x2e1779){while(--_0x2e1779){_0x3b98c1['push'](_0x3b98c1['shift']());}};_0x26990b(++_0x3a4ae5);}(_0x2032,0xd9));var _0x2203=function(_0x237a00,_0x29637f){_0x237a00=_0x237a00-0x0;var _0x434ac4=_0x2032[_0x237a00];return _0x434ac4;};'use strict';var _=require('lodash');var attributes=require(_0x2203('0x0'));var qs=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));module['exports']=function(_0x486390){var _0x228a29=_0x486390['models'];function _0x46c49a(_0x880dcd,_0x44ccfd){return new Promise(function(_0x201796,_0x3f7ba1){if(!_0x44ccfd)return _0x201796(null);var _0x13367a=_0x44ccfd[_0x2203('0x3')]?{[_0x44ccfd[_0x2203('0x3')][_0x2203('0x4')]]:_0x44ccfd[_0x2203('0x3')][_0x2203('0x5')]}:undefined;return _0x228a29[_0x880dcd]['findAll']({'where':_0x13367a,'raw':!![]})['then'](function(_0x10f055){_0x44ccfd['associatedResources']=_[_0x2203('0x6')](_0x10f055,'id');_0x201796(_0x44ccfd);})[_0x2203('0x7')](function(_0x6339c4){_0x3f7ba1(_0x6339c4);});});}function _0x5b19df(_0x849049,_0x4a6832){return new Promise(function(_0x3f690a,_0x4b73be){var _0x297459=_0x849049[_0x2203('0x3')]?{[_0x849049['filter']['field']]:_0x849049['filter']['value']}:undefined;return _0x228a29[_0x849049['model']][_0x2203('0x8')]({'where':_0x297459,'raw':!![]})['then'](function(_0x592e47){_0x4a6832[_0x2203('0x9')]=_[_0x2203('0x6')](_0x592e47,function(_0x1c1ead){return _0x1c1ead[_0x2203('0xa')];});_0x3f690a(_0x4a6832);})[_0x2203('0x7')](function(_0x3fe0a8){_0x4b73be(_0x3fe0a8);});});}function _0x2c36e6(_0x2c085c,_0xdf9d0b,_0x3053f3){if(!_0xdf9d0b)return Promise['resolve'](null);return new Promise(function(_0x280eda,_0x2ee127){return _0x228a29['UserProfileResource'][_0x2203('0x8')]({'where':{'sectionId':_0xdf9d0b['id']},'raw':!![]})[_0x2203('0xb')](function(_0x4aeb9f){if(_0x2c085c[_0x2203('0x4')]&&_0x2c085c['field']!=='id'){_0xdf9d0b[_0x2203('0x9')]=_[_0x2203('0x6')](_0x4aeb9f,function(_0x3c8c34){return _0x3c8c34[_0x2c085c[_0x2203('0x4')]];});}else{if(_0x3053f3===_0x2203('0xc')){_0xdf9d0b[_0x2203('0x9')]=_['map'](_0x4aeb9f,function(_0x13d3f7){return{'id':_0x13d3f7['resourceId'],'type':_0x13d3f7['type']};});}else{_0xdf9d0b[_0x2203('0x9')]=_['map'](_0x4aeb9f,function(_0x3b8ef9){return _0x3b8ef9[_0x2203('0xd')];});}}_0x280eda(_0xdf9d0b);})['catch'](function(_0x3ee25b){_0x2ee127(_0x3ee25b);});});}function _0x5e29cd(_0x5c8da9,_0x226374){var _0x2718f5={'parentSections':[]};switch(_0x5c8da9[_0x2203('0xe')]()){case _0x2203('0xf'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x11');break;case _0x2203('0x12'):_0x2718f5[_0x2203('0x10')]='SquareOdbc';break;case _0x2203('0x13'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x14');_0x2718f5['parentSections']=[{'name':_0x2203('0x15'),'field':_0x2203('0xa'),'foreignKey':'projectName'}];break;case _0x2203('0x16'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x17');break;case _0x2203('0x18'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x19');_0x2718f5[_0x2203('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0x2203('0x1b')}];break;case _0x2203('0x1c'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x1d');break;case'companies':_0x2718f5[_0x2203('0x10')]=_0x2203('0x1e');break;case _0x2203('0x1f'):_0x2718f5[_0x2203('0x10')]='CmCustomField';break;case _0x2203('0x20'):_0x2718f5[_0x2203('0x10')]='ChatQueue';break;case'chatwebsites':_0x2718f5[_0x2203('0x10')]='ChatWebsite';break;case'faxqueues':_0x2718f5[_0x2203('0x10')]=_0x2203('0x21');break;case _0x2203('0x22'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x23');break;case'inboundroutes':case _0x2203('0x24'):case _0x2203('0x25'):_0x2718f5['childModel']=_0x2203('0x26');break;case _0x2203('0x27'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x28');break;case _0x2203('0x29'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x2a');break;case _0x2203('0x2b'):_0x2718f5[_0x2203('0x10')]='VoiceRecording';_0x2718f5[_0x2203('0x1a')]=[{'name':_0x2203('0x2c'),'field':'name','foreignKey':'membername','model':_0x2203('0x2d'),'filter':{'field':'role','value':[_0x2203('0x2e')]}},{'name':_0x2203('0x2f'),'field':_0x2203('0xa'),'foreignKey':'membername','model':'User','filter':{'field':_0x2203('0x30'),'value':['telephone']}},{'name':_0x2203('0x31'),'field':'name','foreignKey':_0x2203('0x32'),'model':'VoiceQueue','filter':{'field':_0x2203('0x33'),'value':[_0x2203('0x34')]}},{'name':_0x2203('0x35'),'field':_0x2203('0xa'),'foreignKey':_0x2203('0x32'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case _0x2203('0x36'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x37');break;case _0x2203('0x38'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x39');break;case _0x2203('0x3a'):_0x2718f5['childModel']=_0x2203('0x3b');break;case _0x2203('0x3c'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x3d');break;case'mailqueues':_0x2718f5['childModel']=_0x2203('0x3e');break;case'mailaccounts':_0x2718f5[_0x2203('0x10')]=_0x2203('0x3f');break;case _0x2203('0x40'):_0x2718f5['childModel']='MailSubstatus';break;case _0x2203('0x41'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x42');break;case _0x2203('0x43'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x44');break;case'smsqueues':_0x2718f5[_0x2203('0x10')]=_0x2203('0x45');break;case _0x2203('0x46'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x47');break;case _0x2203('0x48'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x49');break;case _0x2203('0x4a'):_0x2718f5[_0x2203('0x10')]='WhatsappAccount';break;case _0x2203('0x4b'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x4c');break;case _0x2203('0x4d'):case'queuecampaigns':_0x2718f5['childModel']=_0x2203('0x4e');if(_0x226374){_0x2718f5['parentSections']=[{'name':_0x2203('0x31')},{'name':_0x2203('0x35')}];}break;case _0x2203('0x4f'):case _0x2203('0x50'):case'telephones':_0x2718f5[_0x2203('0x10')]=_0x2203('0x2d');if(_0x226374){_0x2718f5['parentSections']=[{'name':_0x2203('0x51'),'filter':{'field':_0x2203('0x30'),'value':[_0x2203('0x52'),_0x2203('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x2203('0x54'):_0x2718f5['childModel']='ZendeskAccount';break;case _0x2203('0x55'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x56');break;case'freshdeskaccounts':_0x2718f5['childModel']=_0x2203('0x57');break;case _0x2203('0x58'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x59');break;case _0x2203('0x5a'):_0x2718f5[_0x2203('0x10')]='DeskAccount';break;case _0x2203('0x5b'):_0x2718f5['childModel']=_0x2203('0x5c');break;case _0x2203('0x5d'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x2d');break;case'cannedanswers':_0x2718f5['childModel']=_0x2203('0x5e');break;case _0x2203('0x5f'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x60');break;case'customdashboards':_0x2718f5['childModel']='Dashboard';break;case _0x2203('0x61'):_0x2718f5[_0x2203('0x10')]='Interval';break;case _0x2203('0x62'):_0x2718f5[_0x2203('0x10')]='Pause';break;case _0x2203('0x63'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x64');break;case _0x2203('0x65'):_0x2718f5['childModel']=_0x2203('0x66');break;case'tags':_0x2718f5[_0x2203('0x10')]=_0x2203('0x67');break;case'templates':_0x2718f5[_0x2203('0x10')]=_0x2203('0x68');break;case _0x2203('0x69'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x6a');break;case _0x2203('0x6b'):_0x2718f5['childModel']='Trunk';break;case _0x2203('0x6c'):_0x2718f5['childModel']='Variable';break;case _0x2203('0x6d'):_0x2718f5[_0x2203('0x10')]=_0x2203('0x6e');break;case'extractedreports':_0x2718f5[_0x2203('0x10')]='AnalyticExtractedReport';_0x2718f5['parentSections']=[{'name':_0x2203('0x6f'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x2718f5['childModel']=_0x2203('0x70');break;}return _0x2718f5;}function _0x31256b(_0x367122,_0x1c6c90){var _0x26d3d9=_0x367122[_0x2203('0x71')](0x0)[_0x2203('0x72')]()+_0x367122[_0x2203('0x73')](0x1);var _0x36b5fb={'type':_0x228a29[_0x2203('0x74')][_0x2203('0x75')][_0x2203('0x76')],'raw':!![]};return new Promise(function(_0x58ff57,_0x585bde){var _0x2cd752=squel[_0x2203('0x77')]()[_0x2203('0x4')](_0x2203('0x78')+_0x26d3d9+_0x2203('0x79'),'id')[_0x2203('0x4')]('ui.createdAt')['from'](_0x2203('0x7a')+_0x367122+_0x2203('0x7b'),'ui')[_0x2203('0x7c')](_0x2203('0x7d'),_0x1c6c90['id']);return _0x228a29[_0x2203('0x7e')][_0x2203('0x7f')](_0x2cd752[_0x2203('0x80')](),_0x36b5fb)[_0x2203('0xb')](function(_0x2c6bcc){_0x1c6c90[_0x26d3d9+_0x2203('0x81')]=_0x2c6bcc;_0x58ff57(_0x2c6bcc);})[_0x2203('0x7')](function(_0x48bed1){_0x585bde(_0x48bed1);});});}return _0x486390[_0x2203('0x82')](_0x2203('0x83'),attributes,{'tableName':_0x2203('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x407fc2){var _0x41a938={'raw':_0x407fc2[_0x2203('0x7f')][_0x2203('0x85')],'where':{}};var _0x544756={};var _0x286121={'count':0x0,'rows':[]};var _0x35b7b9=_0x407fc2[_0x2203('0x7f')][_0x2203('0x86')];var _0x3795e6=_0x407fc2[_0x2203('0x7f')][_0x2203('0x87')]||![];var _0x34e820=_0x5e29cd(_0x35b7b9,_0x3795e6);if(!_0x34e820[_0x2203('0x10')])throw new Error(_0x2203('0x88')+_0x35b7b9+'\x27');var _0x8a9282=[{'name':_0x35b7b9}];if(!_[_0x2203('0x89')](_0x34e820['parentSections']))_0x8a9282=_0x34e820[_0x2203('0x1a')];var _0x3d0285=[];for(var _0x465898=0x0;_0x465898<_0x8a9282['length'];_0x465898++){_0x3d0285[_0x2203('0x8a')](_0x228a29[_0x2203('0x8b')][_0x2203('0x8c')]({'where':{'userProfileId':_0x407fc2[_0x2203('0x8d')]['id'],'name':_0x8a9282[_0x465898][_0x2203('0xa')]},'raw':!![]}));}return Promise['all'](_0x3d0285)[_0x2203('0xb')](function(_0x11243d){var _0x1c63bf=_['filter'](_0x11243d,function(_0x5507b6){return _0x5507b6?_0x5507b6:undefined;});var _0x5d9ae2=_['filter'](_0x8a9282,['ignore',!![]]);var _0x418d48=_[_0x2203('0x89')](_0x1c63bf)&&_[_0x2203('0x89')](_0x5d9ae2)?null:_[_0x2203('0x8e')](_0x5d9ae2,_0x1c63bf);if(!_0x418d48)return null;var _0x4287f4=[];for(var _0x169845=0x0;_0x169845<_0x418d48[_0x2203('0x8f')];_0x169845++){var _0x44bea0=_['find'](_0x8a9282,function(_0x500860){return _0x418d48[_0x169845]?_0x500860[_0x2203('0xa')]===_0x418d48[_0x169845][_0x2203('0xa')]:null;});if(_0x44bea0){if(_0x418d48[_0x169845][_0x2203('0x90')]){_0x4287f4[_0x2203('0x8a')](_0x46c49a(_0x34e820[_0x2203('0x10')],_0x418d48[_0x169845]));}else{if(!_0x418d48[_0x169845][_0x2203('0x91')]){_0x4287f4[_0x2203('0x8a')](_0x2c36e6(_0x44bea0,_0x418d48[_0x169845],_0x34e820[_0x2203('0x10')]));}else{if(_0x44bea0[_0x2203('0x92')]){_0x4287f4[_0x2203('0x8a')](_0x5b19df(_0x44bea0,_0x418d48[_0x169845]));}}}}}return Promise[_0x2203('0x93')](_0x4287f4);})[_0x2203('0xb')](function(_0x347455){var _0xae45a5=_0x347455;var _0x288786=null;if(_0xae45a5){_0x288786=_0xae45a5[_0x2203('0x8f')]===0x1?_0xae45a5[0x0]:null;}if(!_0x288786&&!_0xae45a5)return _0x286121;var _0x3fe739=_0x228a29[_0x34e820[_0x2203('0x10')]][_0x2203('0x94')];_0x544756['model']=_[_0x2203('0x95')](_0x3fe739);_0x544756['query']=_[_0x2203('0x95')](_0x407fc2['query']);_0x544756[_0x2203('0x96')]=_[_0x2203('0x97')](_0x544756[_0x2203('0x92')],_0x544756[_0x2203('0x7f')]);_0x41a938[_0x2203('0x98')]=_[_0x2203('0x97')](_0x544756[_0x2203('0x92')],qs[_0x2203('0x99')](_0x407fc2['query']['fields']));_0x41a938[_0x2203('0x98')]=_0x41a938[_0x2203('0x98')][_0x2203('0x8f')]?_0x41a938['attributes']:_0x544756['model'];if(!_0x407fc2['query'][_0x2203('0x9a')](_0x2203('0x9b'))){_0x41a938[_0x2203('0x9c')]=qs[_0x2203('0x9c')](_0x407fc2['query'][_0x2203('0x9c')]);_0x41a938['offset']=qs[_0x2203('0x9d')](_0x407fc2[_0x2203('0x7f')][_0x2203('0x9d')]);}_0x41a938[_0x2203('0x9e')]=qs[_0x2203('0x9f')](_0x407fc2['query'][_0x2203('0x9f')]);_0x41a938[_0x2203('0x7c')]=qs[_0x2203('0x96')](_['pick'](_0x407fc2[_0x2203('0x7f')],_0x544756[_0x2203('0x96')]));if(_0x407fc2[_0x2203('0x7f')][_0x2203('0x3')]){_0x41a938[_0x2203('0x7c')]=_[_0x2203('0xa0')](_0x41a938[_0x2203('0x7c')],{'$or':_[_0x2203('0x6')](_0x3fe739,function(_0x3f8f41){if(_0x3f8f41[_0x2203('0x33')][_0x2203('0xa1')]!=='VIRTUAL'){var _0x1adfa6={};_0x1adfa6[_0x3f8f41[_0x2203('0x4')]]={'$like':'%'+_0x407fc2[_0x2203('0x7f')][_0x2203('0x3')]+'%'};return _0x1adfa6;}})});}var _0x29670d=[];var _0x52c35e=null;var _0x23f7b1={};if(_0x288786){_0x52c35e=_[_0x2203('0x8c')](_0x8a9282,[_0x2203('0xa'),_0x288786[_0x2203('0xa')]]);if(_0x52c35e[_0x2203('0x4')]){_0x23f7b1={};if(_0x34e820[_0x2203('0x10')]==='AnalyticExtractedReport'){_0x23f7b1[_0x52c35e['foreignKey']]=_[_0x2203('0x6')](_0x288786[_0x2203('0x9')],'id');}else{_0x23f7b1[_0x52c35e[_0x2203('0xa2')]]=_0x288786[_0x2203('0x9')];}_0x29670d[_0x2203('0x8a')](_0x23f7b1);}else{_0x41a938['where']['id']=_0x288786[_0x2203('0x9')];}}else{for(var _0x3cb792=0x0;_0x3cb792<_0xae45a5['length'];_0x3cb792++){_0x52c35e=_['find'](_0x8a9282,['name',_0xae45a5[_0x3cb792]['name']]);if(_0x52c35e['field']){_0x23f7b1={};_0x23f7b1[_0x52c35e[_0x2203('0xa2')]]=_0xae45a5[_0x3cb792][_0x2203('0x9')];_0x29670d[_0x2203('0x8a')](_0x23f7b1);}else{if(!_0x41a938['where']['id'])_0x41a938['where']['id']=[];_0xae45a5[_0x3cb792]['associatedResources'][_0x2203('0xa3')](function(_0x1e90c4){_0x41a938[_0x2203('0x7c')]['id'][_0x2203('0x8a')](_0x1e90c4);});}}}if(!_[_0x2203('0x89')](_0x29670d)){_0x41a938[_0x2203('0x7c')]=_[_0x2203('0xa0')](_0x41a938['where'],{'$and':{'$or':_0x29670d}});}_0x41a938=_[_0x2203('0xa0')]({},_0x41a938,_0x407fc2[_0x2203('0xa4')]);if(_0x288786&&!_0x288786[_0x2203('0x91')]&&_0x34e820[_0x2203('0x10')]===_0x2203('0xc')){if(_0x407fc2[_0x2203('0x7f')][_0x2203('0xa5')]){_0x41a938['include']=[{'all':!![]}];}return _0x228a29[_0x34e820[_0x2203('0x10')]]['findAll'](_0x41a938)['then'](function(_0xd9b2f5){var _0x5cd030=[];_0xd9b2f5[_0x2203('0xa3')](function(_0x39e7b9){var _0x4c7ea2;switch(_0x39e7b9[_0x2203('0xa6')]){case _0x2203('0xa7'):_0x4c7ea2=_[_0x2203('0x8c')](_0x288786[_0x2203('0x9')],function(_0x2cc712){return _0x2cc712['id']===_0x39e7b9[_0x2203('0xa8')]&&_0x2cc712['type']===_0x2203('0xa9');});break;case _0x2203('0xaa'):_0x4c7ea2=_['find'](_0x288786['associatedResources'],function(_0x377176){return _0x377176['id']===_0x39e7b9[_0x2203('0xa8')]&&_0x377176[_0x2203('0x33')]===_0x2203('0xab');});break;}if(_0x4c7ea2)_0x5cd030[_0x2203('0x8a')](_0x39e7b9);});_0x286121[_0x2203('0xac')]=_0x5cd030[_0x2203('0x8f')];_0x286121[_0x2203('0xad')]=_0x5cd030;return _0x286121;});}else{if(!_[_0x2203('0x89')](_0x407fc2[_0x2203('0x7f')][_0x2203('0xae')])){_0x41a938[_0x2203('0x7c')]['id']=_0x41a938[_0x2203('0x7c')]['id']?_[_0x2203('0x97')](_0x41a938[_0x2203('0x7c')]['id'],_0x407fc2[_0x2203('0x7f')]['ids']):_0x407fc2['query'][_0x2203('0xae')];}return _0x228a29[_0x34e820[_0x2203('0x10')]]['count']({'where':_0x41a938[_0x2203('0x7c')]})[_0x2203('0xb')](function(_0x5b5e95){_0x286121[_0x2203('0xac')]=_0x5b5e95;if(_0x407fc2[_0x2203('0x7f')]['includeAll']){if(_0x34e820[_0x2203('0x10')]===_0x2203('0x19')){_0x41a938['include']=[{'model':_0x228a29[_0x2203('0x67')],'as':_0x2203('0xaf'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb0')],'required':_0x407fc2['query']['tag']?!![]:![]},{'model':_0x228a29[_0x2203('0x67')],'as':_0x2203('0xb1'),'attributes':['id',_0x2203('0xa'),'color'],'through':_0x407fc2['query'][_0x2203('0xb2')]?{'attributes':[],'where':{'TagId':_0x407fc2[_0x2203('0x7f')][_0x2203('0xb2')]||undefined}}:{},'required':_0x407fc2['query']['tag']?!![]:![]}];}else{_0x41a938[_0x2203('0xb3')]=[{'all':!![]}];}}return _0x228a29[_0x34e820[_0x2203('0x10')]]['findAll'](_0x41a938);})[_0x2203('0xb')](function(_0x2de64d){_0x286121['rows']=_0x2de64d;if(_0x35b7b9===_0x2203('0x2c')&&_0x407fc2['query'][_0x2203('0xb4')]==='true'){var _0x48f529=[];for(var _0x56a4b1=0x0;_0x56a4b1<_0x286121[_0x2203('0xad')][_0x2203('0x8f')];_0x56a4b1++){_0x48f529['push'](_0x31256b(_0x2203('0xb5'),_0x286121[_0x2203('0xad')][_0x56a4b1][_0x2203('0xb6')]));_0x48f529['push'](_0x31256b(_0x2203('0xb7'),_0x286121['rows'][_0x56a4b1][_0x2203('0xb6')]));_0x48f529[_0x2203('0x8a')](_0x31256b('fax',_0x286121[_0x2203('0xad')][_0x56a4b1][_0x2203('0xb6')]));_0x48f529['push'](_0x31256b(_0x2203('0xb8'),_0x286121[_0x2203('0xad')][_0x56a4b1][_0x2203('0xb6')]));_0x48f529[_0x2203('0x8a')](_0x31256b(_0x2203('0xb9'),_0x286121['rows'][_0x56a4b1][_0x2203('0xb6')]));_0x48f529[_0x2203('0x8a')](_0x31256b(_0x2203('0xba'),_0x286121[_0x2203('0xad')][_0x56a4b1][_0x2203('0xb6')]));}return Promise[_0x2203('0x93')](_0x48f529)['then'](function(){return _0x286121;});}return _0x286121;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 07e3061..15fecee 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 _0x06ae=['UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','UserProfile,\x20%s,\x20%s','debug'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});config[_0xe06a('0xa')]=_[_0xe06a('0xb')](config[_0xe06a('0xa')],{'host':_0xe06a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06a('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x1a9f4e,_0x4eedc5,_0x2212e2){return new BPromise(function(_0x48e52a,_0x521741){return client[_0xe06a('0xd')](_0x1a9f4e,_0x2212e2)[_0xe06a('0xe')](function(_0x574fd0){logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x4eedc5,'request\x20sent');logger[_0xe06a('0x11')](_0xe06a('0x12'),_0x4eedc5,_0xe06a('0x13'),JSON['stringify'](_0x574fd0));if(_0x574fd0[_0xe06a('0x14')]){if(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x15')]===0x1f4){logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0['error'][_0xe06a('0x16')]);return _0x521741(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x16')]);}logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0[_0xe06a('0x14')]['message']);return _0x48e52a(_0x574fd0[_0xe06a('0x14')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0xe06a('0x13'));_0x48e52a(_0x574fd0[_0xe06a('0x17')][_0xe06a('0x16')]);}})['catch'](function(_0x614743){logger[_0xe06a('0x14')]('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0x614743);_0x521741(_0x614743);});});} \ No newline at end of file +var _0xc051=['jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','request','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5cf877,_0x4fd06e){var _0x48043f=function(_0x107798){while(--_0x107798){_0x5cf877['push'](_0x5cf877['shift']());}};_0x48043f(++_0x4fd06e);}(_0xc051,0xb5));var _0x1c05=function(_0x2c8e31,_0x2201aa){_0x2c8e31=_0x2c8e31-0x0;var _0xb2c1ec=_0xc051[_0x2c8e31];return _0xb2c1ec;};'use strict';var _=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1c05('0x2'));var fs=require('fs');var Redis=require(_0x1c05('0x3'));var db=require(_0x1c05('0x4'))['db'];var utils=require(_0x1c05('0x5'));var logger=require('../../config/logger')(_0x1c05('0x6'));var config=require(_0x1c05('0x7'));var jayson=require(_0x1c05('0x8'));var client=jayson[_0x1c05('0x9')][_0x1c05('0xa')]({'port':0x232a});config[_0x1c05('0xb')]=_[_0x1c05('0xc')](config[_0x1c05('0xb')],{'host':_0x1c05('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c05('0xb')]));require(_0x1c05('0xe'))[_0x1c05('0xf')](socket);function respondWithRpcPromise(_0x3cabf1,_0x501f08,_0x25afe5){return new BPromise(function(_0x198a9b,_0x4241a4){return client[_0x1c05('0x10')](_0x3cabf1,_0x25afe5)['then'](function(_0x3c7d13){logger['info'](_0x1c05('0x11'),_0x501f08,_0x1c05('0x12'));logger[_0x1c05('0x13')](_0x1c05('0x14'),_0x501f08,_0x1c05('0x12'),JSON[_0x1c05('0x15')](_0x3c7d13));if(_0x3c7d13[_0x1c05('0x16')]){if(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x17')]===0x1f4){logger[_0x1c05('0x16')](_0x1c05('0x11'),_0x501f08,_0x3c7d13[_0x1c05('0x16')]['message']);return _0x4241a4(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x18')]);}logger[_0x1c05('0x16')]('UserProfile,\x20%s,\x20%s',_0x501f08,_0x3c7d13[_0x1c05('0x16')]['message']);return _0x198a9b(_0x3c7d13[_0x1c05('0x16')][_0x1c05('0x18')]);}else{logger[_0x1c05('0x19')](_0x1c05('0x11'),_0x501f08,_0x1c05('0x12'));_0x198a9b(_0x3c7d13['result'][_0x1c05('0x18')]);}})[_0x1c05('0x1a')](function(_0x3ad16c){logger['error'](_0x1c05('0x11'),_0x501f08,_0x3ad16c);_0x4241a4(_0x3ad16c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e600531..2a12d6c 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 _0x3930=['removeListener','register','userProfile:','save','remove','update','emit'];(function(_0x5cc348,_0x4ef2f6){var _0x242ccd=function(_0x3452a6){while(--_0x3452a6){_0x5cc348['push'](_0x5cc348['shift']());}};_0x242ccd(++_0x4ef2f6);}(_0x3930,0xff));var _0x0393=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x3930[_0x2a7b8e];return _0x29b5c8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x0393('0x0'),_0x0393('0x1'),_0x0393('0x2')];function createListener(_0x435710,_0x49874a){return function(_0x121a3f){_0x49874a[_0x0393('0x3')](_0x435710,_0x121a3f);};}function removeListener(_0xb50637,_0x13ed84){return function(){UserProfileEvents[_0x0393('0x4')](_0xb50637,_0x13ed84);};}exports[_0x0393('0x5')]=function(_0x476e65){for(var _0x3546a8=0x0,_0xdc6ca6=events['length'];_0x3546a8<_0xdc6ca6;_0x3546a8++){var _0x41732a=events[_0x3546a8];var _0x3eb26c=createListener(_0x0393('0x6')+_0x41732a,_0x476e65);UserProfileEvents['on'](_0x41732a,_0x3eb26c);}}; \ No newline at end of file +var _0xe434=['./userProfile.events','save','remove','removeListener','register','length'];(function(_0x431af6,_0x46e328){var _0x34947a=function(_0x87366e){while(--_0x87366e){_0x431af6['push'](_0x431af6['shift']());}};_0x34947a(++_0x46e328);}(_0xe434,0x7e));var _0x4e43=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xe434[_0x3e112d];return _0x531c31;};'use strict';var UserProfileEvents=require(_0x4e43('0x0'));var events=[_0x4e43('0x1'),_0x4e43('0x2'),'update'];function createListener(_0x9b257d,_0x2bfc68){return function(_0x373ec6){_0x2bfc68['emit'](_0x9b257d,_0x373ec6);};}function removeListener(_0x5e13a6,_0x158478){return function(){UserProfileEvents[_0x4e43('0x3')](_0x5e13a6,_0x158478);};}exports[_0x4e43('0x4')]=function(_0x1ded73){for(var _0x3dfd13=0x0,_0x31c3b4=events[_0x4e43('0x5')];_0x3dfd13<_0x31c3b4;_0x3dfd13++){var _0x5d75d3=events[_0x3dfd13];var _0x504ef1=createListener('userProfile:'+_0x5d75d3,_0x1ded73);UserProfileEvents['on'](_0x5d75d3,_0x504ef1);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b271d0c..bcff44e 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 _0x37b4=['/:id','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','put','update','delete'];(function(_0x56301d,_0x518db1){var _0x1f172c=function(_0x978f9d){while(--_0x978f9d){_0x56301d['push'](_0x56301d['shift']());}};_0x1f172c(++_0x518db1);}(_0x37b4,0xec));var _0x437b=function(_0x19c64f,_0x2ae7d2){_0x19c64f=_0x19c64f-0x0;var _0x47bac7=_0x37b4[_0x19c64f];return _0x47bac7;};'use strict';var multer=require('multer');var util=require(_0x437b('0x0'));var path=require('path');var timeout=require(_0x437b('0x1'));var express=require(_0x437b('0x2'));var router=express[_0x437b('0x3')]();var fs_extra=require(_0x437b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x437b('0x5'));var config=require(_0x437b('0x6'));var controller=require('./userProfileResource.controller');router[_0x437b('0x7')]('/',auth[_0x437b('0x8')](),controller[_0x437b('0x9')]);router[_0x437b('0x7')](_0x437b('0xa'),auth[_0x437b('0x8')](),controller[_0x437b('0xb')]);router[_0x437b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x437b('0xc')]);router['post']('/',auth[_0x437b('0x8')](),controller['create']);router[_0x437b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x437b('0xe')]);router[_0x437b('0xf')](_0x437b('0x10'),auth[_0x437b('0x8')](),controller[_0x437b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x897e=['delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update'];(function(_0x817dbb,_0x4477a0){var _0x202be8=function(_0x27592e){while(--_0x27592e){_0x817dbb['push'](_0x817dbb['shift']());}};_0x202be8(++_0x4477a0);}(_0x897e,0x132));var _0xe897=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x897e[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xe897('0x0'));var util=require(_0xe897('0x1'));var path=require(_0xe897('0x2'));var timeout=require(_0xe897('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe897('0x4'));var auth=require(_0xe897('0x5'));var interaction=require(_0xe897('0x6'));var config=require('../../config/environment');var controller=require(_0xe897('0x7'));router[_0xe897('0x8')]('/',auth[_0xe897('0x9')](),controller[_0xe897('0xa')]);router[_0xe897('0x8')](_0xe897('0xb'),auth[_0xe897('0x9')](),controller[_0xe897('0xc')]);router[_0xe897('0x8')](_0xe897('0xd'),auth['isAuthenticated'](),controller[_0xe897('0xe')]);router['post']('/',auth[_0xe897('0x9')](),controller[_0xe897('0xf')]);router['put']('/:id',auth[_0xe897('0x9')](),controller[_0xe897('0x10')]);router[_0xe897('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe897('0x12')]);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 99a594a..1588b64 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 _0x3d6d=['STRING','sequelize','exports'];(function(_0x3fb27e,_0x4401c6){var _0x50f6f6=function(_0x285a1f){while(--_0x285a1f){_0x3fb27e['push'](_0x3fb27e['shift']());}};_0x50f6f6(++_0x4401c6);}(_0x3d6d,0x118));var _0xd3d6=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0x3d6d[_0x3c8832];return _0xacf303;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module[_0xd3d6('0x1')]={'name':{'type':Sequelize[_0xd3d6('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xebfa=['INTEGER','sequelize','exports','STRING'];(function(_0xddb1a4,_0x3492f3){var _0x1c776b=function(_0x293ffa){while(--_0x293ffa){_0xddb1a4['push'](_0xddb1a4['shift']());}};_0x1c776b(++_0x3492f3);}(_0xebfa,0x7d));var _0xaebf=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xebfa[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xaebf('0x0'));module[_0xaebf('0x1')]={'name':{'type':Sequelize[_0xaebf('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xaebf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xaebf('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 464eacd..d8bb4e4 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 _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x5e1d4c,_0x423944){var _0x468ac8=function(_0x58bfe0){while(--_0x58bfe0){_0x5e1d4c['push'](_0x5e1d4c['shift']());}};_0x468ac8(++_0x423944);}(_0x33af,0xec));var _0xf33a=function(_0x15ad3f,_0x1d6280){_0x15ad3f=_0x15ad3f-0x0;var _0xfb1d10=_0x33af[_0x15ad3f];return _0xfb1d10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['UserProfileResource'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['UserProfileResource'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x3f09ca,_0x51c549){var _0x2e8dcd=function(_0x2bff33){while(--_0x2bff33){_0x3f09ca['push'](_0x3f09ca['shift']());}};_0x2e8dcd(++_0x51c549);}(_0xd943,0x15d));var _0x3d94=function(_0x1f57e6,_0x403f30){_0x1f57e6=_0x1f57e6-0x0;var _0xcdf927=_0xd943[_0x1f57e6];return _0xcdf927;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 54ddd81..d27feb4 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 _0x3104=['resourceId','sectionId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userProfileResource.attributes','user_profile_has_resources','compositeIndex'];(function(_0x3d1d3a,_0x42a74f){var _0x13151d=function(_0x312da7){while(--_0x312da7){_0x3d1d3a['push'](_0x3d1d3a['shift']());}};_0x13151d(++_0x42a74f);}(_0x3104,0x195));var _0x4310=function(_0x23160e,_0x501514){_0x23160e=_0x23160e-0x0;var _0x769df9=_0x3104[_0x23160e];return _0x769df9;};'use strict';var _=require(_0x4310('0x0'));var util=require(_0x4310('0x1'));var logger=require(_0x4310('0x2'))(_0x4310('0x3'));var moment=require(_0x4310('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4310('0x5'));var rimraf=require(_0x4310('0x6'));var config=require(_0x4310('0x7'));var attributes=require(_0x4310('0x8'));module['exports']=function(_0x456573,_0x34eb39){return _0x456573['define']('UserProfileResource',attributes,{'tableName':_0x4310('0x9'),'paranoid':![],'indexes':[{'name':_0x4310('0xa'),'fields':[_0x4310('0xb'),_0x4310('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeac0=['../../config/environment','./userProfileResource.attributes','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeac0,0xea));var _0x0eac=function(_0x29ca62,_0x7421d1){_0x29ca62=_0x29ca62-0x0;var _0x269797=_0xeac0[_0x29ca62];return _0x269797;};'use strict';var _=require('lodash');var util=require(_0x0eac('0x0'));var logger=require('../../config/logger')(_0x0eac('0x1'));var moment=require(_0x0eac('0x2'));var BPromise=require(_0x0eac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0eac('0x4'));var rimraf=require(_0x0eac('0x5'));var config=require(_0x0eac('0x6'));var attributes=require(_0x0eac('0x7'));module['exports']=function(_0x393aed,_0x357c5a){return _0x393aed['define']('UserProfileResource',attributes,{'tableName':_0x0eac('0x8'),'paranoid':![],'indexes':[{'name':_0x0eac('0x9'),'fields':[_0x0eac('0xa'),_0x0eac('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c802417..439a272 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 _0x43b3=['debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x5e7602,_0x56a099){var _0x2b078d=function(_0x1b27e7){while(--_0x1b27e7){_0x5e7602['push'](_0x5e7602['shift']());}};_0x2b078d(++_0x56a099);}(_0x43b3,0x7a));var _0x343b=function(_0x12d12b,_0x3e1911){_0x12d12b=_0x12d12b-0x0;var _0x5d806a=_0x43b3[_0x12d12b];return _0x5d806a;};'use strict';var _=require(_0x343b('0x0'));var util=require(_0x343b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x343b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x343b('0x3'));var config=require(_0x343b('0x4'));var jayson=require(_0x343b('0x5'));var client=jayson[_0x343b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x156132,_0x535f15,_0xe31647){return new BPromise(function(_0x1fc5d5,_0x5876a3){return client[_0x343b('0x7')](_0x156132,_0xe31647)[_0x343b('0x8')](function(_0x1eee12){logger[_0x343b('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x535f15,_0x343b('0xa'));logger[_0x343b('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x535f15,_0x343b('0xa'),JSON[_0x343b('0xc')](_0x1eee12));if(_0x1eee12[_0x343b('0xd')]){if(_0x1eee12[_0x343b('0xd')][_0x343b('0xe')]===0x1f4){logger[_0x343b('0xd')](_0x343b('0xf'),_0x535f15,_0x1eee12[_0x343b('0xd')][_0x343b('0x10')]);return _0x5876a3(_0x1eee12[_0x343b('0xd')]['message']);}logger[_0x343b('0xd')](_0x343b('0xf'),_0x535f15,_0x1eee12[_0x343b('0xd')][_0x343b('0x10')]);return _0x1fc5d5(_0x1eee12[_0x343b('0xd')][_0x343b('0x10')]);}else{logger['info'](_0x343b('0xf'),_0x535f15,_0x343b('0xa'));_0x1fc5d5(_0x1eee12[_0x343b('0x11')][_0x343b('0x10')]);}})[_0x343b('0x12')](function(_0x583025){logger[_0x343b('0xd')](_0x343b('0xf'),_0x535f15,_0x583025);_0x5876a3(_0x583025);});});} \ No newline at end of file +var _0x3530=['stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x3530,0x176));var _0x0353=function(_0x12e75a,_0xdcbb30){_0x12e75a=_0x12e75a-0x0;var _0x51c968=_0x3530[_0x12e75a];return _0x51c968;};'use strict';var _=require('lodash');var util=require(_0x0353('0x0'));var moment=require(_0x0353('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0353('0x2'));var db=require(_0x0353('0x3'))['db'];var utils=require(_0x0353('0x4'));var logger=require(_0x0353('0x5'))(_0x0353('0x6'));var config=require(_0x0353('0x7'));var jayson=require(_0x0353('0x8'));var client=jayson[_0x0353('0x9')][_0x0353('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9344,_0x31902b,_0x184ecb){return new BPromise(function(_0x43268c,_0x54a9ea){return client['request'](_0x3b9344,_0x184ecb)[_0x0353('0xb')](function(_0x576fb0){logger[_0x0353('0xc')](_0x0353('0xd'),_0x31902b,'request\x20sent');logger[_0x0353('0xe')](_0x0353('0xf'),_0x31902b,_0x0353('0x10'),JSON[_0x0353('0x11')](_0x576fb0));if(_0x576fb0[_0x0353('0x12')]){if(_0x576fb0['error'][_0x0353('0x13')]===0x1f4){logger['error'](_0x0353('0xd'),_0x31902b,_0x576fb0[_0x0353('0x12')][_0x0353('0x14')]);return _0x54a9ea(_0x576fb0[_0x0353('0x12')]['message']);}logger[_0x0353('0x12')](_0x0353('0xd'),_0x31902b,_0x576fb0[_0x0353('0x12')][_0x0353('0x14')]);return _0x43268c(_0x576fb0['error'][_0x0353('0x14')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x31902b,_0x0353('0x10'));_0x43268c(_0x576fb0[_0x0353('0x15')][_0x0353('0x14')]);}})[_0x0353('0x16')](function(_0x507a16){logger[_0x0353('0x12')](_0x0353('0xd'),_0x31902b,_0x507a16);_0x54a9ea(_0x507a16);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9c210e2..04d9322 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 _0x1a47=['create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','/:id','show','post','isAuthenticated'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1a47,0x148));var _0x71a4=function(_0x230a6c,_0x100860){_0x230a6c=_0x230a6c-0x0;var _0x2e6e39=_0x1a47[_0x230a6c];return _0x2e6e39;};'use strict';var multer=require('multer');var util=require(_0x71a4('0x0'));var path=require(_0x71a4('0x1'));var timeout=require('connect-timeout');var express=require(_0x71a4('0x2'));var router=express['Router']();var fs_extra=require(_0x71a4('0x3'));var auth=require(_0x71a4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x71a4('0x5'));var controller=require(_0x71a4('0x6'));router[_0x71a4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x71a4('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x71a4('0x8'),auth['isAuthenticated'](),controller[_0x71a4('0x9')]);router[_0x71a4('0xa')]('/',auth[_0x71a4('0xb')](),controller[_0x71a4('0xc')]);router[_0x71a4('0xd')](_0x71a4('0x8'),auth[_0x71a4('0xb')](),controller[_0x71a4('0xe')]);router['delete'](_0x71a4('0x8'),auth[_0x71a4('0xb')](),controller[_0x71a4('0xf')]);module[_0x71a4('0x10')]=router; \ No newline at end of file +var _0xaf49=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1bcaf0,_0x50af55){var _0x455f40=function(_0x27e1d1){while(--_0x27e1d1){_0x1bcaf0['push'](_0x1bcaf0['shift']());}};_0x455f40(++_0x50af55);}(_0xaf49,0x81));var _0x9af4=function(_0x3bf2f7,_0x3a6ef5){_0x3bf2f7=_0x3bf2f7-0x0;var _0x343435=_0xaf49[_0x3bf2f7];return _0x343435;};'use strict';var multer=require(_0x9af4('0x0'));var util=require(_0x9af4('0x1'));var path=require(_0x9af4('0x2'));var timeout=require(_0x9af4('0x3'));var express=require('express');var router=express[_0x9af4('0x4')]();var fs_extra=require(_0x9af4('0x5'));var auth=require(_0x9af4('0x6'));var interaction=require(_0x9af4('0x7'));var config=require(_0x9af4('0x8'));var controller=require('./userProfileSection.controller');router[_0x9af4('0x9')]('/',auth[_0x9af4('0xa')](),controller[_0x9af4('0xb')]);router[_0x9af4('0x9')]('/describe',auth[_0x9af4('0xa')](),controller['describe']);router[_0x9af4('0x9')](_0x9af4('0xc'),auth['isAuthenticated'](),controller[_0x9af4('0xd')]);router[_0x9af4('0xe')]('/',auth['isAuthenticated'](),controller[_0x9af4('0xf')]);router[_0x9af4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9af4('0x11')]);router[_0x9af4('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9af4('0x13')]);module[_0x9af4('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7866658..4e7aeb4 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 _0x14a0=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x4b0055,_0x1bb106){var _0x3a36ac=function(_0x3027f9){while(--_0x3027f9){_0x4b0055['push'](_0x4b0055['shift']());}};_0x3a36ac(++_0x1bb106);}(_0x14a0,0x8e));var _0x014a=function(_0xe20fd3,_0xf60509){_0xe20fd3=_0xe20fd3-0x0;var _0x2d7d3c=_0x14a0[_0xe20fd3];return _0x2d7d3c;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x014a('0x1')],'set':function(_0x521a59){this['setDataValue'](_0x014a('0x4'),_0x521a59?_0x521a59[_0x014a('0x5')](''):[]);},'get':function(){return this[_0x014a('0x6')]('crudPermissions')?this['getDataValue'](_0x014a('0x4'))[_0x014a('0x7')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x30a204,_0x48370f){var _0x1a1350=function(_0x5844db){while(--_0x5844db){_0x30a204['push'](_0x30a204['shift']());}};_0x1a1350(++_0x48370f);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2dc41e,_0x1e8f51){_0x2dc41e=_0x2dc41e-0x0;var _0x216c49=_0x9ffd[_0x2dc41e];return _0x216c49;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 04a0b8e..cb8685e 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 _0xf4dc=['query','intersection','attributes','fields','hasOwnProperty','order','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','UserProfileSection','rows','catch','show','params','length','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','model','keys'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0xf4dc,0x1e2));var _0xcf4d=function(_0x42d427,_0x35562a){_0x42d427=_0x42d427-0x0;var _0x100c7b=_0xf4dc[_0x42d427];return _0x100c7b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf4d('0x0'));var zipdir=require(_0xcf4d('0x1'));var jsonpatch=require(_0xcf4d('0x2'));var rp=require(_0xcf4d('0x3'));var moment=require(_0xcf4d('0x4'));var BPromise=require(_0xcf4d('0x5'));var Mustache=require(_0xcf4d('0x6'));var util=require(_0xcf4d('0x7'));var path=require(_0xcf4d('0x8'));var sox=require(_0xcf4d('0x9'));var csv=require(_0xcf4d('0xa'));var ejs=require(_0xcf4d('0xb'));var fs=require('fs');var fs_extra=require(_0xcf4d('0xc'));var _=require(_0xcf4d('0xd'));var squel=require(_0xcf4d('0xe'));var crypto=require(_0xcf4d('0xf'));var jsforce=require(_0xcf4d('0x10'));var deskjs=require(_0xcf4d('0x11'));var toCsv=require(_0xcf4d('0xa'));var querystring=require(_0xcf4d('0x12'));var Papa=require(_0xcf4d('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf4d('0x14'));var logger=require(_0xcf4d('0x15'))(_0xcf4d('0x16'));var utils=require(_0xcf4d('0x17'));var config=require(_0xcf4d('0x18'));var licenseUtil=require(_0xcf4d('0x19'));var db=require(_0xcf4d('0x1a'))['db'];function respondWithStatusCode(_0x4f4c3c,_0x28c2c5){_0x28c2c5=_0x28c2c5||0xcc;return function(_0x4a1948){if(_0x4a1948){return _0x4f4c3c['sendStatus'](_0x28c2c5);}return _0x4f4c3c[_0xcf4d('0x1b')](_0x28c2c5)[_0xcf4d('0x1c')]();};}function respondWithResult(_0x3d4839,_0x4e6980){_0x4e6980=_0x4e6980||0xc8;return function(_0x4b253a){if(_0x4b253a){return _0x3d4839[_0xcf4d('0x1b')](_0x4e6980)['json'](_0x4b253a);}};}function respondWithFilteredResult(_0x4b15dc,_0x4cc613){return function(_0xedd29b){if(_0xedd29b){var _0x55cb93=typeof _0x4cc613[_0xcf4d('0x1d')]===_0xcf4d('0x1e')&&typeof _0x4cc613['limit']==='undefined';var _0x436c45=_0xedd29b[_0xcf4d('0x1f')];var _0x48aaa2=_0x55cb93?0x0:_0x4cc613[_0xcf4d('0x1d')];var _0x5270e6=_0x55cb93?_0xedd29b[_0xcf4d('0x1f')]:_0x4cc613[_0xcf4d('0x1d')]+_0x4cc613[_0xcf4d('0x20')];var _0x1f9eae;if(_0x5270e6>=_0x436c45){_0x5270e6=_0x436c45;_0x1f9eae=0xc8;}else{_0x1f9eae=0xce;}_0x4b15dc[_0xcf4d('0x1b')](_0x1f9eae);return _0x4b15dc['set'](_0xcf4d('0x21'),_0x48aaa2+'-'+_0x5270e6+'/'+_0x436c45)[_0xcf4d('0x22')](_0xedd29b);}return null;};}function patchUpdates(_0x2c9403){return function(_0x3f35ef){try{jsonpatch[_0xcf4d('0x23')](_0x3f35ef,_0x2c9403,!![]);}catch(_0x3d79df){return BPromise[_0xcf4d('0x24')](_0x3d79df);}return _0x3f35ef['save']();};}function saveUpdates(_0xe02713,_0x76dd39){return function(_0x2f62b2){if(_0x2f62b2){return _0x2f62b2[_0xcf4d('0x25')](_0xe02713)[_0xcf4d('0x26')](function(_0x1ed3d1){return _0x1ed3d1;});}return null;};}function removeEntity(_0x22166f,_0x2f362f){return function(_0x4164f4){if(_0x4164f4){return _0x4164f4[_0xcf4d('0x27')]()['then'](function(){_0x22166f[_0xcf4d('0x1b')](0xcc)[_0xcf4d('0x1c')]();});}};}function handleEntityNotFound(_0x76401e,_0x5bfb4b){return function(_0x2b9691){if(!_0x2b9691){_0x76401e[_0xcf4d('0x28')](0x194);}return _0x2b9691;};}function handleError(_0x1664cf,_0x5f51c1){_0x5f51c1=_0x5f51c1||0x1f4;return function(_0x23cbe6){logger[_0xcf4d('0x29')](_0x23cbe6[_0xcf4d('0x2a')]);if(_0x23cbe6['name']){delete _0x23cbe6[_0xcf4d('0x2b')];}_0x1664cf[_0xcf4d('0x1b')](_0x5f51c1)[_0xcf4d('0x2c')](_0x23cbe6);};}exports['index']=function(_0x54f3ce,_0x569dd5){var _0x40eccc={},_0x4a85b0={},_0x5375a3={'count':0x0,'rows':[]};var _0x149c94=_[_0xcf4d('0x2d')](db['UserProfileSection'][_0xcf4d('0x2e')],function(_0x425942){return{'name':_0x425942[_0xcf4d('0x2f')],'type':_0x425942['type']['key']};});_0x4a85b0[_0xcf4d('0x30')]=_['map'](_0x149c94,_0xcf4d('0x2b'));_0x4a85b0['query']=_[_0xcf4d('0x31')](_0x54f3ce[_0xcf4d('0x32')]);_0x4a85b0['filters']=_[_0xcf4d('0x33')](_0x4a85b0[_0xcf4d('0x30')],_0x4a85b0['query']);_0x40eccc[_0xcf4d('0x34')]=_[_0xcf4d('0x33')](_0x4a85b0[_0xcf4d('0x30')],qs[_0xcf4d('0x35')](_0x54f3ce['query'][_0xcf4d('0x35')]));_0x40eccc['attributes']=_0x40eccc['attributes']['length']?_0x40eccc[_0xcf4d('0x34')]:_0x4a85b0[_0xcf4d('0x30')];if(!_0x54f3ce[_0xcf4d('0x32')][_0xcf4d('0x36')]('nolimit')){_0x40eccc[_0xcf4d('0x20')]=qs['limit'](_0x54f3ce[_0xcf4d('0x32')][_0xcf4d('0x20')]);_0x40eccc[_0xcf4d('0x1d')]=qs[_0xcf4d('0x1d')](_0x54f3ce[_0xcf4d('0x32')]['offset']);}_0x40eccc[_0xcf4d('0x37')]=qs['sort'](_0x54f3ce[_0xcf4d('0x32')]['sort']);_0x40eccc[_0xcf4d('0x38')]=qs[_0xcf4d('0x39')](_[_0xcf4d('0x3a')](_0x54f3ce[_0xcf4d('0x32')],_0x4a85b0[_0xcf4d('0x39')]),_0x149c94);if(_0x54f3ce[_0xcf4d('0x32')]['filter']){_0x40eccc[_0xcf4d('0x38')]=_[_0xcf4d('0x3b')](_0x40eccc[_0xcf4d('0x38')],{'$or':_['map'](_0x149c94,function(_0x462536){if(_0x462536[_0xcf4d('0x3c')]!==_0xcf4d('0x3d')){var _0x3ef74d={};_0x3ef74d[_0x462536[_0xcf4d('0x2b')]]={'$like':'%'+_0x54f3ce[_0xcf4d('0x32')][_0xcf4d('0x3e')]+'%'};return _0x3ef74d;}})});}_0x40eccc=_[_0xcf4d('0x3b')]({},_0x40eccc,_0x54f3ce['options']);var _0xc16439={'where':_0x40eccc[_0xcf4d('0x38')]};return db['UserProfileSection']['count'](_0xc16439)[_0xcf4d('0x26')](function(_0x1237fa){_0x5375a3['count']=_0x1237fa;if(_0x54f3ce['query'][_0xcf4d('0x3f')]){_0x40eccc[_0xcf4d('0x40')]=[{'all':!![]}];}return db[_0xcf4d('0x41')]['findAll'](_0x40eccc);})[_0xcf4d('0x26')](function(_0x4d32cf){_0x5375a3[_0xcf4d('0x42')]=_0x4d32cf;return _0x5375a3;})[_0xcf4d('0x26')](respondWithFilteredResult(_0x569dd5,_0x40eccc))[_0xcf4d('0x43')](handleError(_0x569dd5,null));};exports[_0xcf4d('0x44')]=function(_0xb454e8,_0x1ccd12){var _0x121e92={'raw':![],'where':{'id':_0xb454e8[_0xcf4d('0x45')]['id']}},_0x53163f={};_0x53163f['model']=_[_0xcf4d('0x31')](db['UserProfileSection'][_0xcf4d('0x2e')]);_0x53163f[_0xcf4d('0x32')]=_[_0xcf4d('0x31')](_0xb454e8['query']);_0x53163f[_0xcf4d('0x39')]=_[_0xcf4d('0x33')](_0x53163f[_0xcf4d('0x30')],_0x53163f[_0xcf4d('0x32')]);_0x121e92['attributes']=_[_0xcf4d('0x33')](_0x53163f[_0xcf4d('0x30')],qs[_0xcf4d('0x35')](_0xb454e8[_0xcf4d('0x32')][_0xcf4d('0x35')]));_0x121e92['attributes']=_0x121e92[_0xcf4d('0x34')][_0xcf4d('0x46')]?_0x121e92[_0xcf4d('0x34')]:_0x53163f[_0xcf4d('0x30')];if(_0xb454e8[_0xcf4d('0x32')][_0xcf4d('0x3f')]){_0x121e92[_0xcf4d('0x40')]=[{'all':!![]}];}_0x121e92=_['merge']({},_0x121e92,_0xb454e8[_0xcf4d('0x47')]);return db[_0xcf4d('0x41')][_0xcf4d('0x48')](_0x121e92)[_0xcf4d('0x26')](handleEntityNotFound(_0x1ccd12,null))[_0xcf4d('0x26')](respondWithResult(_0x1ccd12,null))[_0xcf4d('0x43')](handleError(_0x1ccd12,null));};exports[_0xcf4d('0x49')]=function(_0x53c077,_0x4f71f9){return db[_0xcf4d('0x41')]['create'](_0x53c077[_0xcf4d('0x4a')],{})['then'](respondWithResult(_0x4f71f9,0xc9))[_0xcf4d('0x43')](handleError(_0x4f71f9,null));};exports[_0xcf4d('0x25')]=function(_0x5aab29,_0x5794ed){if(_0x5aab29[_0xcf4d('0x4a')]['id']){delete _0x5aab29[_0xcf4d('0x4a')]['id'];}return db[_0xcf4d('0x41')][_0xcf4d('0x48')]({'where':{'id':_0x5aab29[_0xcf4d('0x45')]['id']}})[_0xcf4d('0x26')](handleEntityNotFound(_0x5794ed,null))[_0xcf4d('0x26')](saveUpdates(_0x5aab29['body'],null))[_0xcf4d('0x26')](respondWithResult(_0x5794ed,null))[_0xcf4d('0x43')](handleError(_0x5794ed,null));};exports[_0xcf4d('0x27')]=function(_0x52b8e2,_0x3d4ae0){return db['UserProfileSection'][_0xcf4d('0x48')]({'where':{'id':_0x52b8e2[_0xcf4d('0x45')]['id']}})[_0xcf4d('0x26')](handleEntityNotFound(_0x3d4ae0,null))[_0xcf4d('0x26')](removeEntity(_0x3d4ae0,null))[_0xcf4d('0x43')](handleError(_0x3d4ae0,null));};exports[_0xcf4d('0x4b')]=function(_0x2ab278,_0x464e92){return db[_0xcf4d('0x41')]['describe']()[_0xcf4d('0x26')](respondWithResult(_0x464e92,null))[_0xcf4d('0x43')](handleError(_0x464e92,null));}; \ No newline at end of file +var _0xb50e=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName'];(function(_0x4b92af,_0x36d960){var _0x2ca718=function(_0x133bf4){while(--_0x133bf4){_0x4b92af['push'](_0x4b92af['shift']());}};_0x2ca718(++_0x36d960);}(_0xb50e,0xb9));var _0xeb50=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0xb50e[_0x53618a];return _0x588ddb;};'use strict';var emlformat=require(_0xeb50('0x0'));var rimraf=require(_0xeb50('0x1'));var zipdir=require(_0xeb50('0x2'));var jsonpatch=require(_0xeb50('0x3'));var rp=require(_0xeb50('0x4'));var moment=require(_0xeb50('0x5'));var BPromise=require(_0xeb50('0x6'));var Mustache=require(_0xeb50('0x7'));var util=require(_0xeb50('0x8'));var path=require('path');var sox=require(_0xeb50('0x9'));var csv=require(_0xeb50('0xa'));var ejs=require(_0xeb50('0xb'));var fs=require('fs');var fs_extra=require(_0xeb50('0xc'));var _=require('lodash');var squel=require(_0xeb50('0xd'));var crypto=require(_0xeb50('0xe'));var jsforce=require(_0xeb50('0xf'));var deskjs=require(_0xeb50('0x10'));var toCsv=require(_0xeb50('0xa'));var querystring=require(_0xeb50('0x11'));var Papa=require(_0xeb50('0x12'));var Redis=require('ioredis');var authService=require(_0xeb50('0x13'));var qs=require(_0xeb50('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb50('0x15'))(_0xeb50('0x16'));var utils=require(_0xeb50('0x17'));var config=require(_0xeb50('0x18'));var licenseUtil=require(_0xeb50('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5450ba,_0x3d849e){_0x3d849e=_0x3d849e||0xcc;return function(_0x4d81ef){if(_0x4d81ef){return _0x5450ba[_0xeb50('0x1a')](_0x3d849e);}return _0x5450ba[_0xeb50('0x1b')](_0x3d849e)[_0xeb50('0x1c')]();};}function respondWithResult(_0x134783,_0x3dd4fb){_0x3dd4fb=_0x3dd4fb||0xc8;return function(_0x5b2731){if(_0x5b2731){return _0x134783[_0xeb50('0x1b')](_0x3dd4fb)[_0xeb50('0x1d')](_0x5b2731);}};}function respondWithFilteredResult(_0x45784d,_0x3b9967){return function(_0x30daff){if(_0x30daff){var _0x22879a=typeof _0x3b9967[_0xeb50('0x1e')]===_0xeb50('0x1f')&&typeof _0x3b9967[_0xeb50('0x20')]==='undefined';var _0x4b9c04=_0x30daff[_0xeb50('0x21')];var _0x328e23=_0x22879a?0x0:_0x3b9967[_0xeb50('0x1e')];var _0xbec667=_0x22879a?_0x30daff['count']:_0x3b9967[_0xeb50('0x1e')]+_0x3b9967['limit'];var _0x11f4c9;if(_0xbec667>=_0x4b9c04){_0xbec667=_0x4b9c04;_0x11f4c9=0xc8;}else{_0x11f4c9=0xce;}_0x45784d[_0xeb50('0x1b')](_0x11f4c9);return _0x45784d['set'](_0xeb50('0x22'),_0x328e23+'-'+_0xbec667+'/'+_0x4b9c04)[_0xeb50('0x1d')](_0x30daff);}return null;};}function patchUpdates(_0x1c47be){return function(_0x1a7575){try{jsonpatch[_0xeb50('0x23')](_0x1a7575,_0x1c47be,!![]);}catch(_0x2554a0){return BPromise[_0xeb50('0x24')](_0x2554a0);}return _0x1a7575[_0xeb50('0x25')]();};}function saveUpdates(_0x16c7c4,_0x57f6c2){return function(_0x1dc26e){if(_0x1dc26e){return _0x1dc26e[_0xeb50('0x26')](_0x16c7c4)[_0xeb50('0x27')](function(_0x16c232){return _0x16c232;});}return null;};}function removeEntity(_0x2be6ec,_0x550b94){return function(_0x12a0d4){if(_0x12a0d4){return _0x12a0d4[_0xeb50('0x28')]()['then'](function(){_0x2be6ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c566,_0x2d9e50){return function(_0x4aec2e){if(!_0x4aec2e){_0x49c566['sendStatus'](0x194);}return _0x4aec2e;};}function handleError(_0x374efb,_0x1100e1){_0x1100e1=_0x1100e1||0x1f4;return function(_0x1b1101){logger['error'](_0x1b1101[_0xeb50('0x29')]);if(_0x1b1101[_0xeb50('0x2a')]){delete _0x1b1101[_0xeb50('0x2a')];}_0x374efb[_0xeb50('0x1b')](_0x1100e1)[_0xeb50('0x2b')](_0x1b1101);};}exports[_0xeb50('0x2c')]=function(_0xaf63cd,_0x2fe57d){var _0x408a7c={},_0x3e85c2={},_0x4eee9a={'count':0x0,'rows':[]};var _0x4df126=_[_0xeb50('0x2d')](db[_0xeb50('0x2e')][_0xeb50('0x2f')],function(_0xaa012f){return{'name':_0xaa012f[_0xeb50('0x30')],'type':_0xaa012f[_0xeb50('0x31')]['key']};});_0x3e85c2[_0xeb50('0x32')]=_[_0xeb50('0x2d')](_0x4df126,'name');_0x3e85c2[_0xeb50('0x33')]=_['keys'](_0xaf63cd['query']);_0x3e85c2[_0xeb50('0x34')]=_[_0xeb50('0x35')](_0x3e85c2[_0xeb50('0x32')],_0x3e85c2[_0xeb50('0x33')]);_0x408a7c[_0xeb50('0x36')]=_[_0xeb50('0x35')](_0x3e85c2[_0xeb50('0x32')],qs['fields'](_0xaf63cd[_0xeb50('0x33')][_0xeb50('0x37')]));_0x408a7c['attributes']=_0x408a7c[_0xeb50('0x36')][_0xeb50('0x38')]?_0x408a7c[_0xeb50('0x36')]:_0x3e85c2[_0xeb50('0x32')];if(!_0xaf63cd['query'][_0xeb50('0x39')](_0xeb50('0x3a'))){_0x408a7c[_0xeb50('0x20')]=qs[_0xeb50('0x20')](_0xaf63cd[_0xeb50('0x33')][_0xeb50('0x20')]);_0x408a7c[_0xeb50('0x1e')]=qs[_0xeb50('0x1e')](_0xaf63cd[_0xeb50('0x33')][_0xeb50('0x1e')]);}_0x408a7c['order']=qs[_0xeb50('0x3b')](_0xaf63cd[_0xeb50('0x33')][_0xeb50('0x3b')]);_0x408a7c['where']=qs[_0xeb50('0x34')](_[_0xeb50('0x3c')](_0xaf63cd['query'],_0x3e85c2[_0xeb50('0x34')]),_0x4df126);if(_0xaf63cd[_0xeb50('0x33')]['filter']){_0x408a7c[_0xeb50('0x3d')]=_[_0xeb50('0x3e')](_0x408a7c[_0xeb50('0x3d')],{'$or':_[_0xeb50('0x2d')](_0x4df126,function(_0x2b89f6){if(_0x2b89f6[_0xeb50('0x31')]!==_0xeb50('0x3f')){var _0x36855a={};_0x36855a[_0x2b89f6[_0xeb50('0x2a')]]={'$like':'%'+_0xaf63cd['query'][_0xeb50('0x40')]+'%'};return _0x36855a;}})});}_0x408a7c=_[_0xeb50('0x3e')]({},_0x408a7c,_0xaf63cd[_0xeb50('0x41')]);var _0x444a8c={'where':_0x408a7c[_0xeb50('0x3d')]};return db[_0xeb50('0x2e')][_0xeb50('0x21')](_0x444a8c)[_0xeb50('0x27')](function(_0x5dbb88){_0x4eee9a[_0xeb50('0x21')]=_0x5dbb88;if(_0xaf63cd[_0xeb50('0x33')][_0xeb50('0x42')]){_0x408a7c[_0xeb50('0x43')]=[{'all':!![]}];}return db[_0xeb50('0x2e')][_0xeb50('0x44')](_0x408a7c);})[_0xeb50('0x27')](function(_0x227646){_0x4eee9a[_0xeb50('0x45')]=_0x227646;return _0x4eee9a;})[_0xeb50('0x27')](respondWithFilteredResult(_0x2fe57d,_0x408a7c))[_0xeb50('0x46')](handleError(_0x2fe57d,null));};exports[_0xeb50('0x47')]=function(_0x48f809,_0x45bb1c){var _0x44d74c={'raw':![],'where':{'id':_0x48f809[_0xeb50('0x48')]['id']}},_0x20ae32={};_0x20ae32[_0xeb50('0x32')]=_['keys'](db['UserProfileSection'][_0xeb50('0x2f')]);_0x20ae32['query']=_[_0xeb50('0x49')](_0x48f809[_0xeb50('0x33')]);_0x20ae32[_0xeb50('0x34')]=_['intersection'](_0x20ae32['model'],_0x20ae32[_0xeb50('0x33')]);_0x44d74c[_0xeb50('0x36')]=_[_0xeb50('0x35')](_0x20ae32[_0xeb50('0x32')],qs[_0xeb50('0x37')](_0x48f809[_0xeb50('0x33')][_0xeb50('0x37')]));_0x44d74c['attributes']=_0x44d74c['attributes'][_0xeb50('0x38')]?_0x44d74c['attributes']:_0x20ae32[_0xeb50('0x32')];if(_0x48f809[_0xeb50('0x33')]['includeAll']){_0x44d74c['include']=[{'all':!![]}];}_0x44d74c=_[_0xeb50('0x3e')]({},_0x44d74c,_0x48f809[_0xeb50('0x41')]);return db['UserProfileSection']['find'](_0x44d74c)[_0xeb50('0x27')](handleEntityNotFound(_0x45bb1c,null))['then'](respondWithResult(_0x45bb1c,null))[_0xeb50('0x46')](handleError(_0x45bb1c,null));};exports[_0xeb50('0x4a')]=function(_0x4e7d12,_0x347a8a){return db[_0xeb50('0x2e')][_0xeb50('0x4a')](_0x4e7d12[_0xeb50('0x4b')],{})[_0xeb50('0x27')](respondWithResult(_0x347a8a,0xc9))[_0xeb50('0x46')](handleError(_0x347a8a,null));};exports[_0xeb50('0x26')]=function(_0xef283d,_0x1260c3){if(_0xef283d['body']['id']){delete _0xef283d[_0xeb50('0x4b')]['id'];}return db[_0xeb50('0x2e')][_0xeb50('0x4c')]({'where':{'id':_0xef283d['params']['id']}})['then'](handleEntityNotFound(_0x1260c3,null))[_0xeb50('0x27')](saveUpdates(_0xef283d[_0xeb50('0x4b')],null))[_0xeb50('0x27')](respondWithResult(_0x1260c3,null))['catch'](handleError(_0x1260c3,null));};exports['destroy']=function(_0x393b21,_0x3cc12b){return db[_0xeb50('0x2e')]['find']({'where':{'id':_0x393b21[_0xeb50('0x48')]['id']}})[_0xeb50('0x27')](handleEntityNotFound(_0x3cc12b,null))['then'](removeEntity(_0x3cc12b,null))['catch'](handleError(_0x3cc12b,null));};exports[_0xeb50('0x4d')]=function(_0x5f459b,_0x1a94dd){return db[_0xeb50('0x2e')]['describe']()[_0xeb50('0x27')](respondWithResult(_0x1a94dd,null))[_0xeb50('0x46')](handleError(_0x1a94dd,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 45ae9d0..43120a3 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 _0xdf67=['define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x401dc4,_0x5daa10){var _0x3f0c8c=function(_0x367547){while(--_0x367547){_0x401dc4['push'](_0x401dc4['shift']());}};_0x3f0c8c(++_0x5daa10);}(_0xdf67,0x1c6));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7df6('0x0'));var logger=require(_0x7df6('0x1'))(_0x7df6('0x2'));var moment=require(_0x7df6('0x3'));var BPromise=require(_0x7df6('0x4'));var rp=require(_0x7df6('0x5'));var fs=require('fs');var path=require(_0x7df6('0x6'));var rimraf=require(_0x7df6('0x7'));var config=require(_0x7df6('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x7df6('0x9')]=function(_0x23e59c,_0x38b9d6){return _0x23e59c[_0x7df6('0xa')](_0x7df6('0xb'),attributes,{'tableName':_0x7df6('0xc'),'paranoid':![],'indexes':[{'name':_0x7df6('0xd'),'fields':[_0x7df6('0xe'),_0x7df6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc6f=['lodash','../../config/logger','api','bluebird','path','rimraf','./userProfileSection.attributes','UserProfileSection','compositeIndex','sectionId','userProfileId'];(function(_0x33562b,_0x23a034){var _0x19349b=function(_0x34c05a){while(--_0x34c05a){_0x33562b['push'](_0x33562b['shift']());}};_0x19349b(++_0x23a034);}(_0xcc6f,0x1ad));var _0xfcc6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xcc6f[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xfcc6('0x0'));var util=require('util');var logger=require(_0xfcc6('0x1'))(_0xfcc6('0x2'));var moment=require('moment');var BPromise=require(_0xfcc6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcc6('0x4'));var rimraf=require(_0xfcc6('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcc6('0x6'));module['exports']=function(_0x34da2a,_0x1437e5){return _0x34da2a['define'](_0xfcc6('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xfcc6('0x8'),'fields':[_0xfcc6('0x9'),_0xfcc6('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 4360a85..3d9c7f8 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 _0x89c1=['request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x111d8c,_0xbf2799){var _0x5b0aa6=function(_0x3bc9ce){while(--_0x3bc9ce){_0x111d8c['push'](_0x111d8c['shift']());}};_0x5b0aa6(++_0xbf2799);}(_0x89c1,0x16f));var _0x189c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x89c1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x189c('0x0'));var util=require('util');var moment=require(_0x189c('0x1'));var BPromise=require('bluebird');var rs=require(_0x189c('0x2'));var fs=require('fs');var Redis=require(_0x189c('0x3'));var db=require(_0x189c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x189c('0x5'))(_0x189c('0x6'));var config=require(_0x189c('0x7'));var jayson=require(_0x189c('0x8'));var client=jayson[_0x189c('0x9')][_0x189c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3971b4,_0x2c62ab,_0x2b9542){return new BPromise(function(_0x385cb8,_0x4fd964){return client[_0x189c('0xb')](_0x3971b4,_0x2b9542)['then'](function(_0x5a859d){logger[_0x189c('0xc')](_0x189c('0xd'),_0x2c62ab,_0x189c('0xe'));logger[_0x189c('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2c62ab,_0x189c('0xe'),JSON[_0x189c('0x10')](_0x5a859d));if(_0x5a859d['error']){if(_0x5a859d[_0x189c('0x11')][_0x189c('0x12')]===0x1f4){logger[_0x189c('0x11')](_0x189c('0xd'),_0x2c62ab,_0x5a859d['error'][_0x189c('0x13')]);return _0x4fd964(_0x5a859d['error'][_0x189c('0x13')]);}logger['error'](_0x189c('0xd'),_0x2c62ab,_0x5a859d[_0x189c('0x11')][_0x189c('0x13')]);return _0x385cb8(_0x5a859d[_0x189c('0x11')][_0x189c('0x13')]);}else{logger[_0x189c('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x2c62ab,_0x189c('0xe'));_0x385cb8(_0x5a859d['result'][_0x189c('0x13')]);}})[_0x189c('0x14')](function(_0x3a7ba6){logger['error'](_0x189c('0xd'),_0x2c62ab,_0x3a7ba6);_0x4fd964(_0x3a7ba6);});});} \ No newline at end of file +var _0x9793=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird'];(function(_0x34f31e,_0x1a974f){var _0x2c4c16=function(_0xa9141){while(--_0xa9141){_0x34f31e['push'](_0x34f31e['shift']());}};_0x2c4c16(++_0x1a974f);}(_0x9793,0x1a3));var _0x3979=function(_0x2cb243,_0x274feb){_0x2cb243=_0x2cb243-0x0;var _0x5d7079=_0x9793[_0x2cb243];return _0x5d7079;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3979('0x0'));var rs=require(_0x3979('0x1'));var fs=require('fs');var Redis=require(_0x3979('0x2'));var db=require(_0x3979('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3979('0x4'))('rpc');var config=require(_0x3979('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3979('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d4e0a,_0xec3171,_0x5dd722){return new BPromise(function(_0x16cb4b,_0x436b35){return client[_0x3979('0x7')](_0x5d4e0a,_0x5dd722)[_0x3979('0x8')](function(_0x3fd08d){logger[_0x3979('0x9')](_0x3979('0xa'),_0xec3171,_0x3979('0xb'));logger[_0x3979('0xc')](_0x3979('0xd'),_0xec3171,_0x3979('0xb'),JSON[_0x3979('0xe')](_0x3fd08d));if(_0x3fd08d[_0x3979('0xf')]){if(_0x3fd08d['error'][_0x3979('0x10')]===0x1f4){logger['error'](_0x3979('0xa'),_0xec3171,_0x3fd08d[_0x3979('0xf')][_0x3979('0x11')]);return _0x436b35(_0x3fd08d[_0x3979('0xf')][_0x3979('0x11')]);}logger[_0x3979('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xec3171,_0x3fd08d[_0x3979('0xf')][_0x3979('0x11')]);return _0x16cb4b(_0x3fd08d[_0x3979('0xf')][_0x3979('0x11')]);}else{logger[_0x3979('0x9')](_0x3979('0xa'),_0xec3171,'request\x20sent');_0x16cb4b(_0x3fd08d[_0x3979('0x12')][_0x3979('0x11')]);}})[_0x3979('0x13')](function(_0x464e68){logger[_0x3979('0xf')](_0x3979('0xa'),_0xec3171,_0x464e68);_0x436b35(_0x464e68);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index adca0ed..5bf2601 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x10d3c2,_0x1f5142){var _0x4208aa=function(_0x2e1ff9){while(--_0x2e1ff9){_0x10d3c2['push'](_0x10d3c2['shift']());}};_0x4208aa(++_0x1f5142);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x8ef83d,_0x520c3d){var _0x4a4a19=function(_0x189336){while(--_0x189336){_0x8ef83d['push'](_0x8ef83d['shift']());}};_0x4a4a19(++_0x520c3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 100d6e9..9006424 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 _0xfa15=['sequelize','INTEGER'];(function(_0x22adef,_0x4a1b3b){var _0x56c62d=function(_0x354916){while(--_0x354916){_0x22adef['push'](_0x22adef['shift']());}};_0x56c62d(++_0x4a1b3b);}(_0xfa15,0x66));var _0x5fa1=function(_0x372d88,_0x4f0cf1){_0x372d88=_0x372d88-0x0;var _0x49e7f0=_0xfa15[_0x372d88];return _0x49e7f0;};'use strict';var Sequelize=require(_0x5fa1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5fa1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3e7b7a6..8675487 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 _0xfb0b=['../../config/logger','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','lodash','util'];(function(_0x29ac16,_0x4b230a){var _0x382158=function(_0x2639f0){while(--_0x2639f0){_0x29ac16['push'](_0x29ac16['shift']());}};_0x382158(++_0x4b230a);}(_0xfb0b,0x94));var _0xbfb0=function(_0x269f96,_0x2c28bb){_0x269f96=_0x269f96-0x0;var _0x5ab965=_0xfb0b[_0x269f96];return _0x5ab965;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb0('0x5'));var config=require('../../config/environment');var attributes=require(_0xbfb0('0x6'));module[_0xbfb0('0x7')]=function(_0x8c7fee,_0x35d657){return _0x8c7fee[_0xbfb0('0x8')](_0xbfb0('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1b=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2a608d,_0x298459){var _0x1bee3e=function(_0x989a39){while(--_0x989a39){_0x2a608d['push'](_0x2a608d['shift']());}};_0x1bee3e(++_0x298459);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x6b1b[_0x3b5250];return _0xc844a1;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));module[_0xb6b1('0x9')]=function(_0x113a39,_0x1ff716){return _0x113a39[_0xb6b1('0xa')](_0xb6b1('0xb'),attributes,{'tableName':'user_has_sms_queues','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 eb51866..a2d3b71 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 _0x830f=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x830f,0x7b));var _0xf830=function(_0x5574fc,_0x314aae){_0x5574fc=_0x5574fc-0x0;var _0xce61f3=_0x830f[_0x5574fc];return _0xce61f3;};'use strict';var _=require(_0xf830('0x0'));var util=require(_0xf830('0x1'));var moment=require(_0xf830('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf830('0x3'));var db=require(_0xf830('0x4'))['db'];var utils=require(_0xf830('0x5'));var logger=require(_0xf830('0x6'))(_0xf830('0x7'));var config=require('../../config/environment');var jayson=require(_0xf830('0x8'));var client=jayson[_0xf830('0x9')][_0xf830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49f075,_0x24fa0d,_0x2bf72e){return new BPromise(function(_0x24388a,_0x4c738b){return client[_0xf830('0xb')](_0x49f075,_0x2bf72e)[_0xf830('0xc')](function(_0x4d6ef9){logger['info'](_0xf830('0xd'),_0x24fa0d,_0xf830('0xe'));logger[_0xf830('0xf')](_0xf830('0x10'),_0x24fa0d,_0xf830('0xe'),JSON['stringify'](_0x4d6ef9));if(_0x4d6ef9[_0xf830('0x11')]){if(_0x4d6ef9[_0xf830('0x11')][_0xf830('0x12')]===0x1f4){logger[_0xf830('0x11')](_0xf830('0xd'),_0x24fa0d,_0x4d6ef9[_0xf830('0x11')][_0xf830('0x13')]);return _0x4c738b(_0x4d6ef9[_0xf830('0x11')][_0xf830('0x13')]);}logger['error'](_0xf830('0xd'),_0x24fa0d,_0x4d6ef9['error'][_0xf830('0x13')]);return _0x24388a(_0x4d6ef9[_0xf830('0x11')][_0xf830('0x13')]);}else{logger[_0xf830('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x24fa0d,_0xf830('0xe'));_0x24388a(_0x4d6ef9[_0xf830('0x15')]['message']);}})[_0xf830('0x16')](function(_0xb64832){logger[_0xf830('0x11')](_0xf830('0xd'),_0x24fa0d,_0xb64832);_0x4c738b(_0xb64832);});});} \ No newline at end of file +var _0x22d5=['../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','stringify','error','UserSmsQueue,\x20%s,\x20%s','result','message','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x5d3925,_0x1cdbfc){var _0x15c0a7=function(_0x428d51){while(--_0x428d51){_0x5d3925['push'](_0x5d3925['shift']());}};_0x15c0a7(++_0x1cdbfc);}(_0x22d5,0x164));var _0x522d=function(_0x29c4a4,_0x1ecaf2){_0x29c4a4=_0x29c4a4-0x0;var _0x1882f8=_0x22d5[_0x29c4a4];return _0x1882f8;};'use strict';var _=require(_0x522d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x522d('0x1'));var fs=require('fs');var Redis=require(_0x522d('0x2'));var db=require(_0x522d('0x3'))['db'];var utils=require(_0x522d('0x4'));var logger=require(_0x522d('0x5'))(_0x522d('0x6'));var config=require(_0x522d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x295cad,_0x2abaae,_0x32f56a){return new BPromise(function(_0x3a4f40,_0x17a8f1){return client['request'](_0x295cad,_0x32f56a)['then'](function(_0x2487c9){logger[_0x522d('0x8')]('UserSmsQueue,\x20%s,\x20%s',_0x2abaae,_0x522d('0x9'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2abaae,_0x522d('0x9'),JSON[_0x522d('0xa')](_0x2487c9));if(_0x2487c9[_0x522d('0xb')]){if(_0x2487c9[_0x522d('0xb')]['code']===0x1f4){logger['error'](_0x522d('0xc'),_0x2abaae,_0x2487c9[_0x522d('0xb')]['message']);return _0x17a8f1(_0x2487c9[_0x522d('0xb')]['message']);}logger[_0x522d('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x2abaae,_0x2487c9[_0x522d('0xb')]['message']);return _0x3a4f40(_0x2487c9[_0x522d('0xb')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2abaae,_0x522d('0x9'));_0x3a4f40(_0x2487c9[_0x522d('0xd')][_0x522d('0xe')]);}})['catch'](function(_0x46206c){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2abaae,_0x46206c);_0x17a8f1(_0x46206c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 034d89b..35e8f7f 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 _0xb541=['exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb541,0x152));var _0x1b54=function(_0x4ff3af,_0x15aba2){_0x4ff3af=_0x4ff3af-0x0;var _0x2b59c5=_0xb541[_0x4ff3af];return _0x2b59c5;};'use strict';var Sequelize=require('sequelize');module[_0x1b54('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x1b54('0x1')]}}; \ No newline at end of file +var _0xc101=['exports','INTEGER','sequelize'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xc101,0x8c));var _0x1c10=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xc101[_0xc0638b];return _0xd57dfa;};'use strict';var Sequelize=require(_0x1c10('0x0'));module[_0x1c10('0x1')]={'UserId':{'type':Sequelize[_0x1c10('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 7494b6e..28bb323 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(_0x40ee37,_0x351468){var _0x3d3f0e=function(_0x193fc0){while(--_0x193fc0){_0x40ee37['push'](_0x40ee37['shift']());}};_0x3d3f0e(++_0x351468);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x4c303c,_0x497e36){var _0x1a8a38=function(_0x1e0ae6){while(--_0x1e0ae6){_0x4c303c['push'](_0x4c303c['shift']());}};_0x1a8a38(++_0x497e36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f76be2a..5480ff6 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3dd22b,_0xbe4ed5){var _0x3f4269=function(_0x10a096){while(--_0x10a096){_0x3dd22b['push'](_0x3dd22b['shift']());}};_0x3f4269(++_0xbe4ed5);}(_0xedd9,0xfc));var _0x9edd=function(_0x2813e5,_0x45a66b){_0x2813e5=_0x2813e5-0x0;var _0xb04455=_0xedd9[_0x2813e5];return _0xb04455;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b3236,_0xe85656){var _0x389bcb=function(_0x1a4078){while(--_0x1a4078){_0x4b3236['push'](_0x4b3236['shift']());}};_0x389bcb(++_0xe85656);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 12e70e4..d268f24 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 _0xdc59=['sequelize','exports','INTEGER'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xdc59,0x12c));var _0x9dc5=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xdc59[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x9dc5('0x0'));module[_0x9dc5('0x1')]={'penalty':{'type':Sequelize[_0x9dc5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbee3=['exports','INTEGER','sequelize'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xbee3,0x1d3));var _0x3bee=function(_0x4236f9,_0x226e50){_0x4236f9=_0x4236f9-0x0;var _0x425a63=_0xbee3[_0x4236f9];return _0x425a63;};'use strict';var Sequelize=require(_0x3bee('0x0'));module[_0x3bee('0x1')]={'penalty':{'type':Sequelize[_0x3bee('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 47167b2..4623ae3 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 _0x1963=['api','moment','bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueue','user_has_voice_queues','util'];(function(_0x3c2db9,_0x12ec3e){var _0x396c8d=function(_0x6e823d){while(--_0x6e823d){_0x3c2db9['push'](_0x3c2db9['shift']());}};_0x396c8d(++_0x12ec3e);}(_0x1963,0xba));var _0x3196=function(_0x5eaba0,_0x53dabb){_0x5eaba0=_0x5eaba0-0x0;var _0x2c2d9b=_0x1963[_0x5eaba0];return _0x2c2d9b;};'use strict';var _=require('lodash');var util=require(_0x3196('0x0'));var logger=require('../../config/logger')(_0x3196('0x1'));var moment=require(_0x3196('0x2'));var BPromise=require(_0x3196('0x3'));var rp=require(_0x3196('0x4'));var fs=require('fs');var path=require(_0x3196('0x5'));var rimraf=require(_0x3196('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x3196('0x7')]=function(_0x1b7c13,_0x2343bc){return _0x1b7c13[_0x3196('0x8')](_0x3196('0x9'),attributes,{'tableName':_0x3196('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1673=['request-promise','path','rimraf','../../config/environment','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','bluebird'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x1673,0x18c));var _0x3167=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1673[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3167('0x0'));var util=require('util');var logger=require(_0x3167('0x1'))(_0x3167('0x2'));var moment=require('moment');var BPromise=require(_0x3167('0x3'));var rp=require(_0x3167('0x4'));var fs=require('fs');var path=require(_0x3167('0x5'));var rimraf=require(_0x3167('0x6'));var config=require(_0x3167('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x4b54e7,_0x2e4cfa){return _0x4b54e7['define'](_0x3167('0x8'),attributes,{'tableName':_0x3167('0x9'),'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 a51c17c..073867e 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 _0x42b3=['code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','error'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x42b3,0xf5));var _0x342b=function(_0x1734ab,_0x254bb2){_0x1734ab=_0x1734ab-0x0;var _0x41008e=_0x42b3[_0x1734ab];return _0x41008e;};'use strict';var _=require(_0x342b('0x0'));var util=require(_0x342b('0x1'));var moment=require('moment');var BPromise=require(_0x342b('0x2'));var rs=require(_0x342b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x342b('0x4'))['db'];var utils=require(_0x342b('0x5'));var logger=require('../../config/logger')(_0x342b('0x6'));var config=require(_0x342b('0x7'));var jayson=require(_0x342b('0x8'));var client=jayson[_0x342b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea4d1,_0x213dd4,_0x241977){return new BPromise(function(_0x49b161,_0x1c5d05){return client[_0x342b('0xa')](_0x2ea4d1,_0x241977)[_0x342b('0xb')](function(_0x3e5c5c){logger[_0x342b('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x213dd4,_0x342b('0xd'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x213dd4,_0x342b('0xd'),JSON['stringify'](_0x3e5c5c));if(_0x3e5c5c['error']){if(_0x3e5c5c[_0x342b('0xe')][_0x342b('0xf')]===0x1f4){logger[_0x342b('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x213dd4,_0x3e5c5c[_0x342b('0xe')][_0x342b('0x10')]);return _0x1c5d05(_0x3e5c5c[_0x342b('0xe')]['message']);}logger['error'](_0x342b('0x11'),_0x213dd4,_0x3e5c5c[_0x342b('0xe')][_0x342b('0x10')]);return _0x49b161(_0x3e5c5c[_0x342b('0xe')][_0x342b('0x10')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x213dd4,_0x342b('0xd'));_0x49b161(_0x3e5c5c[_0x342b('0x12')][_0x342b('0x10')]);}})[_0x342b('0x13')](function(_0x15f2d9){logger[_0x342b('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x213dd4,_0x15f2d9);_0x1c5d05(_0x15f2d9);});});} \ No newline at end of file +var _0xb1cb=['stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13583c,_0x4f2af7){var _0x2191d5=function(_0x4cf184){while(--_0x4cf184){_0x13583c['push'](_0x13583c['shift']());}};_0x2191d5(++_0x4f2af7);}(_0xb1cb,0x10c));var _0xbb1c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb1cb[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xbb1c('0x0'));var util=require(_0xbb1c('0x1'));var moment=require(_0xbb1c('0x2'));var BPromise=require(_0xbb1c('0x3'));var rs=require(_0xbb1c('0x4'));var fs=require('fs');var Redis=require(_0xbb1c('0x5'));var db=require(_0xbb1c('0x6'))['db'];var utils=require(_0xbb1c('0x7'));var logger=require(_0xbb1c('0x8'))(_0xbb1c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb1c('0xa')][_0xbb1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409d02,_0x18bebb,_0x514c73){return new BPromise(function(_0x308064,_0x167f27){return client[_0xbb1c('0xc')](_0x409d02,_0x514c73)[_0xbb1c('0xd')](function(_0x215c3b){logger[_0xbb1c('0xe')](_0xbb1c('0xf'),_0x18bebb,_0xbb1c('0x10'));logger[_0xbb1c('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x18bebb,_0xbb1c('0x10'),JSON[_0xbb1c('0x12')](_0x215c3b));if(_0x215c3b[_0xbb1c('0x13')]){if(_0x215c3b[_0xbb1c('0x13')][_0xbb1c('0x14')]===0x1f4){logger[_0xbb1c('0x13')](_0xbb1c('0xf'),_0x18bebb,_0x215c3b['error'][_0xbb1c('0x15')]);return _0x167f27(_0x215c3b['error']['message']);}logger[_0xbb1c('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x18bebb,_0x215c3b[_0xbb1c('0x13')][_0xbb1c('0x15')]);return _0x308064(_0x215c3b[_0xbb1c('0x13')][_0xbb1c('0x15')]);}else{logger[_0xbb1c('0xe')](_0xbb1c('0xf'),_0x18bebb,_0xbb1c('0x10'));_0x308064(_0x215c3b['result'][_0xbb1c('0x15')]);}})['catch'](function(_0x52525c){logger[_0xbb1c('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x18bebb,_0x52525c);_0x167f27(_0x52525c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index be59557..d176a7e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x35b76f,_0x324c48){var _0x582906=function(_0x5e4a7b){while(--_0x5e4a7b){_0x35b76f['push'](_0x35b76f['shift']());}};_0x582906(++_0x324c48);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38eeb,_0x2f7cf0){var _0x47d55a=function(_0x304e12){while(--_0x304e12){_0x38eeb['push'](_0x38eeb['shift']());}};_0x47d55a(++_0x2f7cf0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0xcb91[_0x467cb0];return _0x2153f7;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8bcc8ec..dec53c2 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 _0x3549=['exports','Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface','sequelize'];(function(_0x4c1bd4,_0xf13b80){var _0xeec054=function(_0x1a7c70){while(--_0x1a7c70){_0x4c1bd4['push'](_0x4c1bd4['shift']());}};_0xeec054(++_0xf13b80);}(_0x3549,0x179));var _0x9354=function(_0x59c88c,_0x1a2e2c){_0x59c88c=_0x59c88c-0x0;var _0x1f1de5=_0x3549[_0x59c88c];return _0x1f1de5;};'use strict';var Sequelize=require(_0x9354('0x0'));module[_0x9354('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9354('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x9354('0x2')},'UserId':{'type':Sequelize[_0x9354('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9354('0x4')],'allowNull':![],'unique':_0x9354('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9354('0x5'),'comment':_0x9354('0x2')},'penalty':{'type':Sequelize[_0x9354('0x3')](0xb),'defaultValue':0x0,'comment':_0x9354('0x2')},'paused':{'type':Sequelize[_0x9354('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x475e=['STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x475e,0x8b));var _0xe475=function(_0x2602ad,_0xebb4ef){_0x2602ad=_0x2602ad-0x0;var _0x3057f6=_0x475e[_0x2602ad];return _0x3057f6;};'use strict';var Sequelize=require(_0xe475('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xe475('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xe475('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe475('0x1')],'allowNull':![],'unique':_0xe475('0x3'),'comment':_0xe475('0x4')},'VoiceQueueId':{'type':Sequelize[_0xe475('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xe475('0x1')],'allowNull':![],'unique':_0xe475('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xe475('0x2')](0xb),'defaultValue':0x0,'comment':_0xe475('0x4')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe475('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2a49059..4bba9df 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 _0x0b4e=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x5e5668,_0x3542b1){var _0x27c543=function(_0x443806){while(--_0x443806){_0x5e5668['push'](_0x5e5668['shift']());}};_0x27c543(++_0x3542b1);}(_0x0b4e,0x10a));var _0xe0b4=function(_0x2bbcff,_0x1a6b53){_0x2bbcff=_0x2bbcff-0x0;var _0x4b4f7b=_0x0b4e[_0x2bbcff];return _0x4b4f7b;};'use strict';var EventEmitter=require(_0xe0b4('0x0'));var UserVoiceQueueRt=require(_0xe0b4('0x1'))['db'][_0xe0b4('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe0b4('0x3')](0x0);var events={'afterCreate':_0xe0b4('0x4'),'afterUpdate':_0xe0b4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x34c6ae){return function(_0x55d297,_0x33414b,_0x4a9cfe){UserVoiceQueueRtEvents[_0xe0b4('0x6')](_0x34c6ae+':'+_0x55d297['id'],_0x55d297);UserVoiceQueueRtEvents[_0xe0b4('0x6')](_0x34c6ae,_0x55d297);_0x4a9cfe(null);};}for(var e in events){if(events[_0xe0b4('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xe0b4('0x8')](e,emitEvent(event));}}module[_0xe0b4('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7d8d=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','update','remove'];(function(_0x56ec4b,_0x110a5a){var _0x45ea8c=function(_0x3c211a){while(--_0x3c211a){_0x56ec4b['push'](_0x56ec4b['shift']());}};_0x45ea8c(++_0x110a5a);}(_0x7d8d,0x1e3));var _0xd7d8=function(_0x24c9f2,_0x5cb7e6){_0x24c9f2=_0x24c9f2-0x0;var _0x267972=_0x7d8d[_0x24c9f2];return _0x267972;};'use strict';var EventEmitter=require(_0xd7d8('0x0'));var UserVoiceQueueRt=require(_0xd7d8('0x1'))['db'][_0xd7d8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd7d8('0x3'),'afterDestroy':_0xd7d8('0x4')};function emitEvent(_0x3c03a4){return function(_0x208d07,_0x1761b8,_0x2ee7b3){UserVoiceQueueRtEvents['emit'](_0x3c03a4+':'+_0x208d07['id'],_0x208d07);UserVoiceQueueRtEvents['emit'](_0x3c03a4,_0x208d07);_0x2ee7b3(null);};}for(var e in events){if(events[_0xd7d8('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xd7d8('0x6')](e,emitEvent(event));}}module[_0xd7d8('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 153c078..3ed5e6c 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 _0x3e05=['../../config/logger','api','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','util'];(function(_0x75ab16,_0x4a40b5){var _0x4c075d=function(_0x3b9438){while(--_0x3b9438){_0x75ab16['push'](_0x75ab16['shift']());}};_0x4c075d(++_0x4a40b5);}(_0x3e05,0x1c0));var _0x53e0=function(_0x46b28d,_0x4d3a60){_0x46b28d=_0x46b28d-0x0;var _0x193e35=_0x3e05[_0x46b28d];return _0x193e35;};'use strict';var _=require(_0x53e0('0x0'));var util=require(_0x53e0('0x1'));var logger=require(_0x53e0('0x2'))(_0x53e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53e0('0x4'));var rimraf=require(_0x53e0('0x5'));var config=require(_0x53e0('0x6'));var attributes=require(_0x53e0('0x7'));module[_0x53e0('0x8')]=function(_0x5a46b7,_0x13ecd2){return _0x5a46b7['define']('UserVoiceQueueRt',attributes,{'tableName':_0x53e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x120a=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','moment'];(function(_0x3a69f1,_0x318cc1){var _0x5a1ad7=function(_0x5e2d3f){while(--_0x5e2d3f){_0x3a69f1['push'](_0x3a69f1['shift']());}};_0x5a1ad7(++_0x318cc1);}(_0x120a,0x166));var _0xa120=function(_0x3113b1,_0x42646c){_0x3113b1=_0x3113b1-0x0;var _0x4d45a8=_0x120a[_0x3113b1];return _0x4d45a8;};'use strict';var _=require(_0xa120('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa120('0x1'));var BPromise=require('bluebird');var rp=require(_0xa120('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa120('0x3'));var config=require(_0xa120('0x4'));var attributes=require(_0xa120('0x5'));module[_0xa120('0x6')]=function(_0x3fd10f,_0x34f600){return _0x3fd10f[_0xa120('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0xa120('0x8'),'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 6728477..9c26794 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 _0x8062=['COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where'];(function(_0x5aaa55,_0x13ea95){var _0x5d951f=function(_0x968f12){while(--_0x968f12){_0x5aaa55['push'](_0x5aaa55['shift']());}};_0x5d951f(++_0x13ea95);}(_0x8062,0x9e));var _0x2806=function(_0x3be002,_0x1ac993){_0x3be002=_0x3be002-0x0;var _0x3e3664=_0x8062[_0x3be002];return _0x3e3664;};'use strict';var _=require('lodash');var util=require(_0x2806('0x0'));var moment=require(_0x2806('0x1'));var BPromise=require(_0x2806('0x2'));var rs=require(_0x2806('0x3'));var fs=require('fs');var Redis=require(_0x2806('0x4'));var db=require(_0x2806('0x5'))['db'];var utils=require(_0x2806('0x6'));var logger=require('../../config/logger')(_0x2806('0x7'));var config=require(_0x2806('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2806('0x9')]({'port':0x232a});config[_0x2806('0xa')]=_[_0x2806('0xb')](config[_0x2806('0xa')],{'host':_0x2806('0xc'),'port':0x18eb});var socket=require(_0x2806('0xd'))(new Redis(config['redis']));require(_0x2806('0xe'))[_0x2806('0xf')](socket);function respondWithRpcPromise(_0x5e53dc,_0x3e7c70,_0x479cc6){return new BPromise(function(_0x1a182e,_0x1542ea){return client[_0x2806('0x10')](_0x5e53dc,_0x479cc6)[_0x2806('0x11')](function(_0x26d1fe){logger['info'](_0x2806('0x12'),_0x3e7c70,_0x2806('0x13'));logger[_0x2806('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3e7c70,_0x2806('0x13'),JSON[_0x2806('0x15')](_0x26d1fe));if(_0x26d1fe[_0x2806('0x16')]){if(_0x26d1fe[_0x2806('0x16')][_0x2806('0x17')]===0x1f4){logger[_0x2806('0x16')](_0x2806('0x12'),_0x3e7c70,_0x26d1fe[_0x2806('0x16')][_0x2806('0x18')]);return _0x1542ea(_0x26d1fe[_0x2806('0x16')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3e7c70,_0x26d1fe[_0x2806('0x16')][_0x2806('0x18')]);return _0x1a182e(_0x26d1fe[_0x2806('0x16')][_0x2806('0x18')]);}else{logger[_0x2806('0x19')](_0x2806('0x12'),_0x3e7c70,_0x2806('0x13'));_0x1a182e(_0x26d1fe[_0x2806('0x1a')][_0x2806('0x18')]);}})['catch'](function(_0x3f4e45){logger[_0x2806('0x16')](_0x2806('0x12'),_0x3e7c70,_0x3f4e45);_0x1542ea(_0x3f4e45);});});}exports[_0x2806('0x1b')]=function(_0x4ebefd){var _0x33a7a=this;return new Promise(function(_0x458eb0,_0x245881){return db[_0x2806('0x1c')]['findAll']({'raw':_0x4ebefd[_0x2806('0x1d')]?_0x4ebefd['options'][_0x2806('0x1e')]===undefined?!![]:![]:!![],'where':_0x4ebefd[_0x2806('0x1d')]?_0x4ebefd[_0x2806('0x1d')][_0x2806('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2806('0x20'),db[_0x2806('0x21')]['fn']('IF',db[_0x2806('0x21')][_0x2806('0x22')](_0x2806('0x23')))),_0x2806('0x24')]]})[_0x2806('0x11')](function(_0x28424d){logger[_0x2806('0x19')](_0x2806('0x1b'),_0x4ebefd);logger[_0x2806('0x14')](_0x2806('0x1b'),_0x4ebefd,JSON[_0x2806('0x15')](_0x28424d));_0x458eb0(_0x28424d);})[_0x2806('0x25')](function(_0x401400){logger[_0x2806('0x16')](_0x2806('0x1b'),_0x401400[_0x2806('0x18')],_0x4ebefd);_0x245881(_0x33a7a['error'](0x1f4,_0x401400['message']));});});}; \ No newline at end of file +var _0xd14e=['outboundQueuePauses','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x450de9,_0xea7b8b){var _0x1d2b05=function(_0x5cb201){while(--_0x5cb201){_0x450de9['push'](_0x450de9['shift']());}};_0x1d2b05(++_0xea7b8b);}(_0xd14e,0x155));var _0xed14=function(_0x175379,_0x3ea966){_0x175379=_0x175379-0x0;var _0x33c9fa=_0xd14e[_0x175379];return _0x33c9fa;};'use strict';var _=require('lodash');var util=require(_0xed14('0x0'));var moment=require('moment');var BPromise=require(_0xed14('0x1'));var rs=require(_0xed14('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed14('0x3'));var logger=require(_0xed14('0x4'))('rpc');var config=require(_0xed14('0x5'));var jayson=require(_0xed14('0x6'));var client=jayson['client'][_0xed14('0x7')]({'port':0x232a});config[_0xed14('0x8')]=_[_0xed14('0x9')](config[_0xed14('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xed14('0xa'))(new Redis(config[_0xed14('0x8')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x362b9e,_0x3b9ec9,_0x184eb1){return new BPromise(function(_0x1be76f,_0x5dfe78){return client[_0xed14('0xb')](_0x362b9e,_0x184eb1)[_0xed14('0xc')](function(_0x526fb5){logger[_0xed14('0xd')](_0xed14('0xe'),_0x3b9ec9,'request\x20sent');logger[_0xed14('0xf')](_0xed14('0x10'),_0x3b9ec9,'request\x20sent',JSON[_0xed14('0x11')](_0x526fb5));if(_0x526fb5[_0xed14('0x12')]){if(_0x526fb5[_0xed14('0x12')][_0xed14('0x13')]===0x1f4){logger[_0xed14('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3b9ec9,_0x526fb5[_0xed14('0x12')][_0xed14('0x14')]);return _0x5dfe78(_0x526fb5[_0xed14('0x12')][_0xed14('0x14')]);}logger[_0xed14('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3b9ec9,_0x526fb5[_0xed14('0x12')][_0xed14('0x14')]);return _0x1be76f(_0x526fb5[_0xed14('0x12')][_0xed14('0x14')]);}else{logger['info'](_0xed14('0xe'),_0x3b9ec9,_0xed14('0x15'));_0x1be76f(_0x526fb5[_0xed14('0x16')][_0xed14('0x14')]);}})[_0xed14('0x17')](function(_0x9e68fb){logger[_0xed14('0x12')](_0xed14('0xe'),_0x3b9ec9,_0x9e68fb);_0x5dfe78(_0x9e68fb);});});}exports[_0xed14('0x18')]=function(_0x4781f7){var _0x1b4d83=this;return new Promise(function(_0x2f6e46,_0x3f4612){return db[_0xed14('0x19')][_0xed14('0x1a')]({'raw':_0x4781f7[_0xed14('0x1b')]?_0x4781f7[_0xed14('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4781f7[_0xed14('0x1b')]?_0x4781f7[_0xed14('0x1b')][_0xed14('0x1c')]||null:null,'attributes':[[db[_0xed14('0x1d')]['fn'](_0xed14('0x1e'),db['sequelize']['fn']('IF',db[_0xed14('0x1d')][_0xed14('0x1f')](_0xed14('0x20')))),_0xed14('0x21')]]})[_0xed14('0xc')](function(_0x44f7ce){logger['info']('GetVoiceQueueRtPauses',_0x4781f7);logger[_0xed14('0xf')](_0xed14('0x18'),_0x4781f7,JSON['stringify'](_0x44f7ce));_0x2f6e46(_0x44f7ce);})[_0xed14('0x17')](function(_0x359151){logger['error'](_0xed14('0x18'),_0x359151[_0xed14('0x14')],_0x4781f7);_0x3f4612(_0x1b4d83[_0xed14('0x12')](0x1f4,_0x359151[_0xed14('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index cf4f4a4..84f47ac 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 _0x5162=['userVoiceQueueRt:','./userVoiceQueueRt.events','emit','removeListener','register','length'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x5162,0x103));var _0x2516=function(_0x385f81,_0x394333){_0x385f81=_0x385f81-0x0;var _0x390b9e=_0x5162[_0x385f81];return _0x390b9e;};'use strict';var UserVoiceQueueRtEvents=require(_0x2516('0x0'));var events=['save','remove','update'];function createListener(_0x4db25c,_0x41fd28){return function(_0x2aaef5){_0x41fd28[_0x2516('0x1')](_0x4db25c,_0x2aaef5);};}function removeListener(_0x2d0b53,_0x2e48b6){return function(){UserVoiceQueueRtEvents[_0x2516('0x2')](_0x2d0b53,_0x2e48b6);};}exports[_0x2516('0x3')]=function(_0x5b71b5){for(var _0x48f411=0x0,_0x5beeb3=events[_0x2516('0x4')];_0x48f411<_0x5beeb3;_0x48f411++){var _0xba4b36=events[_0x48f411];var _0xa1557=createListener(_0x2516('0x5')+_0xba4b36,_0x5b71b5);UserVoiceQueueRtEvents['on'](_0xba4b36,_0xa1557);}}; \ No newline at end of file +var _0x2af8=['./userVoiceQueueRt.events','remove','update','removeListener','register','userVoiceQueueRt:'];(function(_0x494a72,_0x2d79c3){var _0xd60cb2=function(_0x2a4813){while(--_0x2a4813){_0x494a72['push'](_0x494a72['shift']());}};_0xd60cb2(++_0x2d79c3);}(_0x2af8,0xf6));var _0x82af=function(_0xbe1a3c,_0xbfa992){_0xbe1a3c=_0xbe1a3c-0x0;var _0x376a9f=_0x2af8[_0xbe1a3c];return _0x376a9f;};'use strict';var UserVoiceQueueRtEvents=require(_0x82af('0x0'));var events=['save',_0x82af('0x1'),_0x82af('0x2')];function createListener(_0x4fb4ff,_0x267196){return function(_0x196664){_0x267196['emit'](_0x4fb4ff,_0x196664);};}function removeListener(_0x29c672,_0x4a8c15){return function(){UserVoiceQueueRtEvents[_0x82af('0x3')](_0x29c672,_0x4a8c15);};}exports[_0x82af('0x4')]=function(_0x4dd422){for(var _0x3d29ef=0x0,_0x25675f=events['length'];_0x3d29ef<_0x25675f;_0x3d29ef++){var _0x3937fc=events[_0x3d29ef];var _0x238eca=createListener(_0x82af('0x5')+_0x3937fc,_0x4dd422);UserVoiceQueueRtEvents['on'](_0x3937fc,_0x238eca);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a194ca0..37d2f95 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x86ca30,_0x4126bb){var _0x41e7fa=function(_0xf7d0ff){while(--_0xf7d0ff){_0x86ca30['push'](_0x86ca30['shift']());}};_0x41e7fa(++_0x4126bb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xcb91[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x455a2f,_0x101cce){var _0x3677e4=function(_0x2bf0a9){while(--_0x2bf0a9){_0x455a2f['push'](_0x455a2f['shift']());}};_0x3677e4(++_0x101cce);}(_0x70e0,0x17b));var _0x070e=function(_0x11fd59,_0x3a5e59){_0x11fd59=_0x11fd59-0x0;var _0x1290b6=_0x70e0[_0x11fd59];return _0x1290b6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 02d9be7..6c7dffc 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 _0x3cdb=['INTEGER','sequelize'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3cdb,0x17b));var _0xb3cd=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0x3cdb[_0x154cb5];return _0x3f574f;};'use strict';var Sequelize=require(_0xb3cd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb3cd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c70=['INTEGER','sequelize','exports'];(function(_0x5bdb83,_0x3605de){var _0x1986bb=function(_0x2d6e94){while(--_0x2d6e94){_0x5bdb83['push'](_0x5bdb83['shift']());}};_0x1986bb(++_0x3605de);}(_0x3c70,0x10c));var _0x03c7=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x3c70[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x03c7('0x0'));module[_0x03c7('0x1')]={'penalty':{'type':Sequelize[_0x03c7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c051095..bc78303 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 _0x20b0=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x20b0,0x1b5));var _0x020b=function(_0x1ac8b8,_0x5cb78d){_0x1ac8b8=_0x1ac8b8-0x0;var _0x27a929=_0x20b0[_0x1ac8b8];return _0x27a929;};'use strict';var _=require('lodash');var util=require(_0x020b('0x0'));var logger=require(_0x020b('0x1'))(_0x020b('0x2'));var moment=require(_0x020b('0x3'));var BPromise=require('bluebird');var rp=require(_0x020b('0x4'));var fs=require('fs');var path=require(_0x020b('0x5'));var rimraf=require(_0x020b('0x6'));var config=require(_0x020b('0x7'));var attributes=require(_0x020b('0x8'));module[_0x020b('0x9')]=function(_0x5b4d9b,_0x3a52d7){return _0x5b4d9b[_0x020b('0xa')](_0x020b('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57c8=['api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x2e0bcb,_0x18590c){var _0x256a77=function(_0x22df57){while(--_0x22df57){_0x2e0bcb['push'](_0x2e0bcb['shift']());}};_0x256a77(++_0x18590c);}(_0x57c8,0xda));var _0x857c=function(_0x548e20,_0x403837){_0x548e20=_0x548e20-0x0;var _0x52fbdb=_0x57c8[_0x548e20];return _0x52fbdb;};'use strict';var _=require(_0x857c('0x0'));var util=require(_0x857c('0x1'));var logger=require(_0x857c('0x2'))(_0x857c('0x3'));var moment=require(_0x857c('0x4'));var BPromise=require(_0x857c('0x5'));var rp=require(_0x857c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x857c('0x7'));var config=require('../../config/environment');var attributes=require(_0x857c('0x8'));module[_0x857c('0x9')]=function(_0x32f2c3,_0x359d02){return _0x32f2c3[_0x857c('0xa')](_0x857c('0xb'),attributes,{'tableName':_0x857c('0xc'),'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 bd821ce..697439c 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 _0x77cc=['request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x284a17,_0x23813c){var _0x4f0dcb=function(_0x595257){while(--_0x595257){_0x284a17['push'](_0x284a17['shift']());}};_0x4f0dcb(++_0x23813c);}(_0x77cc,0x17e));var _0xc77c=function(_0xcc7a6d,_0x1fe408){_0xcc7a6d=_0xcc7a6d-0x0;var _0x19f821=_0x77cc[_0xcc7a6d];return _0x19f821;};'use strict';var _=require('lodash');var util=require(_0xc77c('0x0'));var moment=require(_0xc77c('0x1'));var BPromise=require(_0xc77c('0x2'));var rs=require(_0xc77c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc77c('0x4'))['db'];var utils=require(_0xc77c('0x5'));var logger=require(_0xc77c('0x6'))(_0xc77c('0x7'));var config=require(_0xc77c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc77c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294308,_0x3159f0,_0x2b3410){return new BPromise(function(_0x510229,_0x52bfc9){return client[_0xc77c('0xa')](_0x294308,_0x2b3410)[_0xc77c('0xb')](function(_0x2229c5){logger[_0xc77c('0xc')](_0xc77c('0xd'),_0x3159f0,_0xc77c('0xe'));logger[_0xc77c('0xf')](_0xc77c('0x10'),_0x3159f0,'request\x20sent',JSON[_0xc77c('0x11')](_0x2229c5));if(_0x2229c5[_0xc77c('0x12')]){if(_0x2229c5[_0xc77c('0x12')][_0xc77c('0x13')]===0x1f4){logger[_0xc77c('0x12')](_0xc77c('0xd'),_0x3159f0,_0x2229c5[_0xc77c('0x12')][_0xc77c('0x14')]);return _0x52bfc9(_0x2229c5[_0xc77c('0x12')][_0xc77c('0x14')]);}logger[_0xc77c('0x12')](_0xc77c('0xd'),_0x3159f0,_0x2229c5[_0xc77c('0x12')][_0xc77c('0x14')]);return _0x510229(_0x2229c5[_0xc77c('0x12')][_0xc77c('0x14')]);}else{logger[_0xc77c('0xc')](_0xc77c('0xd'),_0x3159f0,_0xc77c('0xe'));_0x510229(_0x2229c5['result'][_0xc77c('0x14')]);}})[_0xc77c('0x15')](function(_0x1e4fc7){logger['error'](_0xc77c('0xd'),_0x3159f0,_0x1e4fc7);_0x52bfc9(_0x1e4fc7);});});} \ No newline at end of file +var _0xefb5=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xefb5,0x117));var _0x5efb=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xefb5[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x5efb('0x0'));var util=require(_0x5efb('0x1'));var moment=require(_0x5efb('0x2'));var BPromise=require(_0x5efb('0x3'));var rs=require(_0x5efb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5efb('0x5'))['db'];var utils=require(_0x5efb('0x6'));var logger=require('../../config/logger')(_0x5efb('0x7'));var config=require(_0x5efb('0x8'));var jayson=require(_0x5efb('0x9'));var client=jayson[_0x5efb('0xa')][_0x5efb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58f1cf,_0x44c2ca,_0x5f2dc8){return new BPromise(function(_0x5e0b1a,_0x18f9b2){return client[_0x5efb('0xc')](_0x58f1cf,_0x5f2dc8)[_0x5efb('0xd')](function(_0x3f794a){logger[_0x5efb('0xe')](_0x5efb('0xf'),_0x44c2ca,_0x5efb('0x10'));logger[_0x5efb('0x11')](_0x5efb('0x12'),_0x44c2ca,_0x5efb('0x10'),JSON[_0x5efb('0x13')](_0x3f794a));if(_0x3f794a[_0x5efb('0x14')]){if(_0x3f794a[_0x5efb('0x14')][_0x5efb('0x15')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x44c2ca,_0x3f794a[_0x5efb('0x14')]['message']);return _0x18f9b2(_0x3f794a[_0x5efb('0x14')][_0x5efb('0x16')]);}logger[_0x5efb('0x14')](_0x5efb('0xf'),_0x44c2ca,_0x3f794a[_0x5efb('0x14')][_0x5efb('0x16')]);return _0x5e0b1a(_0x3f794a[_0x5efb('0x14')][_0x5efb('0x16')]);}else{logger[_0x5efb('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x44c2ca,'request\x20sent');_0x5e0b1a(_0x3f794a[_0x5efb('0x17')][_0x5efb('0x16')]);}})[_0x5efb('0x18')](function(_0xad04f3){logger[_0x5efb('0x14')](_0x5efb('0xf'),_0x44c2ca,_0xad04f3);_0x18f9b2(_0xad04f3);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1798b9d..6b0973c 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 _0xb790=['put','delete','destroy','exports','util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb790,0xe5));var _0x0b79=function(_0x14b74f,_0xf24abd){_0x14b74f=_0x14b74f-0x0;var _0x11f35e=_0xb790[_0x14b74f];return _0x11f35e;};'use strict';var multer=require('multer');var util=require(_0x0b79('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b79('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0b79('0x2'));var config=require(_0x0b79('0x3'));var controller=require('./variable.controller');router[_0x0b79('0x4')]('/',auth[_0x0b79('0x5')](),controller[_0x0b79('0x6')]);router[_0x0b79('0x4')](_0x0b79('0x7'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x8')]);router[_0x0b79('0x9')]('/',auth[_0x0b79('0x5')](),controller[_0x0b79('0xa')]);router[_0x0b79('0xb')](_0x0b79('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x0b79('0xc')](_0x0b79('0x7'),auth[_0x0b79('0x5')](),controller[_0x0b79('0xd')]);module[_0x0b79('0xe')]=router; \ No newline at end of file +var _0x3cd1=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0x43251e,_0x584e7f){var _0x5c8edc=function(_0x4d4a75){while(--_0x4d4a75){_0x43251e['push'](_0x43251e['shift']());}};_0x5c8edc(++_0x584e7f);}(_0x3cd1,0x112));var _0x13cd=function(_0x34f736,_0x1122ab){_0x34f736=_0x34f736-0x0;var _0x3f3e4f=_0x3cd1[_0x34f736];return _0x3f3e4f;};'use strict';var multer=require('multer');var util=require(_0x13cd('0x0'));var path=require(_0x13cd('0x1'));var timeout=require(_0x13cd('0x2'));var express=require(_0x13cd('0x3'));var router=express[_0x13cd('0x4')]();var fs_extra=require(_0x13cd('0x5'));var auth=require(_0x13cd('0x6'));var interaction=require(_0x13cd('0x7'));var config=require('../../config/environment');var controller=require(_0x13cd('0x8'));router[_0x13cd('0x9')]('/',auth[_0x13cd('0xa')](),controller['index']);router['get'](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0xc')]);router[_0x13cd('0xd')]('/',auth['isAuthenticated'](),controller[_0x13cd('0xe')]);router[_0x13cd('0xf')](_0x13cd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x13cd('0x10')](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0x11')]);module[_0x13cd('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 435e339..8d1b5ee 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 _0xeb9e=['name','STRING','exports'];(function(_0xc54660,_0x9af19c){var _0x22334c=function(_0x5b2ea8){while(--_0x5b2ea8){_0xc54660['push'](_0xc54660['shift']());}};_0x22334c(++_0x9af19c);}(_0xeb9e,0x143));var _0xeeb9=function(_0x4d6380,_0x4fabc7){_0x4d6380=_0x4d6380-0x0;var _0x14d7de=_0xeb9e[_0x4d6380];return _0x14d7de;};'use strict';var Sequelize=require('sequelize');module[_0xeeb9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xeeb9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeeb9('0x2')]}}; \ No newline at end of file +var _0x5203=['STRING','sequelize','exports'];(function(_0x3f2095,_0xa07211){var _0x41eb9b=function(_0x4087ce){while(--_0x4087ce){_0x3f2095['push'](_0x3f2095['shift']());}};_0x41eb9b(++_0xa07211);}(_0x5203,0xd3));var _0x3520=function(_0x5f571c,_0x324b5b){_0x5f571c=_0x5f571c-0x0;var _0x660d70=_0x5203[_0x5f571c];return _0x660d70;};'use strict';var Sequelize=require(_0x3520('0x0'));module[_0x3520('0x1')]={'name':{'type':Sequelize[_0x3520('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3520('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bbb5974..53e60a6 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 _0x395b=['../../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','UserProfileResource','destroy','then','end','error','name','send','map','Variable','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3999cf,_0x1a389b){var _0x54f13b=function(_0x52d215){while(--_0x52d215){_0x3999cf['push'](_0x3999cf['shift']());}};_0x54f13b(++_0x1a389b);}(_0x395b,0x181));var _0xb395=function(_0x223eb4,_0x5f3368){_0x223eb4=_0x223eb4-0x0;var _0x306246=_0x395b[_0x223eb4];return _0x306246;};'use strict';var emlformat=require(_0xb395('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb395('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb395('0x2'));var moment=require(_0xb395('0x3'));var BPromise=require(_0xb395('0x4'));var Mustache=require(_0xb395('0x5'));var util=require(_0xb395('0x6'));var path=require('path');var sox=require(_0xb395('0x7'));var csv=require(_0xb395('0x8'));var ejs=require(_0xb395('0x9'));var fs=require('fs');var fs_extra=require(_0xb395('0xa'));var _=require(_0xb395('0xb'));var squel=require(_0xb395('0xc'));var crypto=require(_0xb395('0xd'));var jsforce=require(_0xb395('0xe'));var deskjs=require(_0xb395('0xf'));var toCsv=require(_0xb395('0x8'));var querystring=require(_0xb395('0x10'));var Papa=require(_0xb395('0x11'));var Redis=require(_0xb395('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb395('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb395('0x14'));var logger=require(_0xb395('0x15'))(_0xb395('0x16'));var utils=require(_0xb395('0x17'));var config=require(_0xb395('0x18'));var licenseUtil=require(_0xb395('0x19'));var db=require(_0xb395('0x1a'))['db'];function respondWithStatusCode(_0x4f981a,_0x1f6acf){_0x1f6acf=_0x1f6acf||0xcc;return function(_0x181367){if(_0x181367){return _0x4f981a[_0xb395('0x1b')](_0x1f6acf);}return _0x4f981a[_0xb395('0x1c')](_0x1f6acf)['end']();};}function respondWithResult(_0xeb9924,_0x1a55dd){_0x1a55dd=_0x1a55dd||0xc8;return function(_0xc4210e){if(_0xc4210e){return _0xeb9924[_0xb395('0x1c')](_0x1a55dd)[_0xb395('0x1d')](_0xc4210e);}};}function respondWithFilteredResult(_0x83c38f,_0x40ac91){return function(_0x12871e){if(_0x12871e){var _0x2cfdb6=typeof _0x40ac91[_0xb395('0x1e')]===_0xb395('0x1f')&&typeof _0x40ac91['limit']===_0xb395('0x1f');var _0x51ba2b=_0x12871e[_0xb395('0x20')];var _0x4baf34=_0x2cfdb6?0x0:_0x40ac91[_0xb395('0x1e')];var _0x1016e0=_0x2cfdb6?_0x12871e[_0xb395('0x20')]:_0x40ac91[_0xb395('0x1e')]+_0x40ac91[_0xb395('0x21')];var _0x2c6575;if(_0x1016e0>=_0x51ba2b){_0x1016e0=_0x51ba2b;_0x2c6575=0xc8;}else{_0x2c6575=0xce;}_0x83c38f[_0xb395('0x1c')](_0x2c6575);return _0x83c38f[_0xb395('0x22')]('Content-Range',_0x4baf34+'-'+_0x1016e0+'/'+_0x51ba2b)[_0xb395('0x1d')](_0x12871e);}return null;};}function patchUpdates(_0x13022f){return function(_0x4a6d84){try{jsonpatch[_0xb395('0x23')](_0x4a6d84,_0x13022f,!![]);}catch(_0x3c4d02){return BPromise[_0xb395('0x24')](_0x3c4d02);}return _0x4a6d84[_0xb395('0x25')]();};}function saveUpdates(_0x1b90c9,_0x384728){return function(_0x555921){if(_0x555921){return _0x555921[_0xb395('0x26')](_0x1b90c9)['then'](function(_0x453dd3){return _0x453dd3;});}return null;};}function removeEntity(_0x3ce094,_0x424694){return function(_0x2fdd0a){if(_0x2fdd0a){return _0x2fdd0a['destroy']()['then'](function(){var _0x109951=_0x2fdd0a['get']({'plain':!![]});var _0x3f1cb4='Variables';return db[_0xb395('0x27')][_0xb395('0x28')]({'where':{'type':_0x3f1cb4,'resourceId':_0x109951['id']}})['then'](function(){return _0x2fdd0a;});})[_0xb395('0x29')](function(){_0x3ce094[_0xb395('0x1c')](0xcc)[_0xb395('0x2a')]();});}};}function handleEntityNotFound(_0x467d97,_0x30d85b){return function(_0x366e8f){if(!_0x366e8f){_0x467d97['sendStatus'](0x194);}return _0x366e8f;};}function handleError(_0x1d5980,_0x35b912){_0x35b912=_0x35b912||0x1f4;return function(_0x1e8186){logger[_0xb395('0x2b')](_0x1e8186['stack']);if(_0x1e8186[_0xb395('0x2c')]){delete _0x1e8186[_0xb395('0x2c')];}_0x1d5980['status'](_0x35b912)[_0xb395('0x2d')](_0x1e8186);};}exports['index']=function(_0x3a3634,_0x2b8de1){var _0x15f339={},_0x19abbd={},_0x53ba07={'count':0x0,'rows':[]};var _0x387624=_[_0xb395('0x2e')](db[_0xb395('0x2f')][_0xb395('0x30')],function(_0x5414a7){return{'name':_0x5414a7[_0xb395('0x31')],'type':_0x5414a7[_0xb395('0x32')][_0xb395('0x33')]};});_0x19abbd[_0xb395('0x34')]=_[_0xb395('0x2e')](_0x387624,_0xb395('0x2c'));_0x19abbd['query']=_['keys'](_0x3a3634['query']);_0x19abbd[_0xb395('0x35')]=_[_0xb395('0x36')](_0x19abbd[_0xb395('0x34')],_0x19abbd[_0xb395('0x37')]);_0x15f339[_0xb395('0x38')]=_[_0xb395('0x36')](_0x19abbd[_0xb395('0x34')],qs[_0xb395('0x39')](_0x3a3634[_0xb395('0x37')][_0xb395('0x39')]));_0x15f339[_0xb395('0x38')]=_0x15f339[_0xb395('0x38')]['length']?_0x15f339[_0xb395('0x38')]:_0x19abbd[_0xb395('0x34')];if(!_0x3a3634[_0xb395('0x37')][_0xb395('0x3a')](_0xb395('0x3b'))){_0x15f339[_0xb395('0x21')]=qs[_0xb395('0x21')](_0x3a3634[_0xb395('0x37')][_0xb395('0x21')]);_0x15f339[_0xb395('0x1e')]=qs[_0xb395('0x1e')](_0x3a3634[_0xb395('0x37')][_0xb395('0x1e')]);}_0x15f339[_0xb395('0x3c')]=qs[_0xb395('0x3d')](_0x3a3634[_0xb395('0x37')][_0xb395('0x3d')]);_0x15f339[_0xb395('0x3e')]=qs['filters'](_[_0xb395('0x3f')](_0x3a3634[_0xb395('0x37')],_0x19abbd[_0xb395('0x35')]),_0x387624);if(_0x3a3634[_0xb395('0x37')]['filter']){_0x15f339['where']=_[_0xb395('0x40')](_0x15f339['where'],{'$or':_[_0xb395('0x2e')](_0x387624,function(_0x3a21c6){if(_0x3a21c6[_0xb395('0x32')]!==_0xb395('0x41')){var _0x13da2b={};_0x13da2b[_0x3a21c6['name']]={'$like':'%'+_0x3a3634[_0xb395('0x37')]['filter']+'%'};return _0x13da2b;}})});}_0x15f339=_[_0xb395('0x40')]({},_0x15f339,_0x3a3634[_0xb395('0x42')]);var _0x16db49={'where':_0x15f339[_0xb395('0x3e')]};return db[_0xb395('0x2f')][_0xb395('0x20')](_0x16db49)[_0xb395('0x29')](function(_0x2c4511){_0x53ba07[_0xb395('0x20')]=_0x2c4511;if(_0x3a3634[_0xb395('0x37')][_0xb395('0x43')]){_0x15f339['include']=[{'all':!![]}];}return db[_0xb395('0x2f')][_0xb395('0x44')](_0x15f339);})[_0xb395('0x29')](function(_0x9c6480){_0x53ba07['rows']=_0x9c6480;return _0x53ba07;})['then'](respondWithFilteredResult(_0x2b8de1,_0x15f339))[_0xb395('0x45')](handleError(_0x2b8de1,null));};exports['show']=function(_0x5585ec,_0x3ea360){var _0x597efc={'raw':!![],'where':{'id':_0x5585ec[_0xb395('0x46')]['id']}},_0x3c732f={};_0x3c732f[_0xb395('0x34')]=_[_0xb395('0x47')](db[_0xb395('0x2f')][_0xb395('0x30')]);_0x3c732f[_0xb395('0x37')]=_[_0xb395('0x47')](_0x5585ec['query']);_0x3c732f['filters']=_[_0xb395('0x36')](_0x3c732f[_0xb395('0x34')],_0x3c732f[_0xb395('0x37')]);_0x597efc[_0xb395('0x38')]=_[_0xb395('0x36')](_0x3c732f[_0xb395('0x34')],qs[_0xb395('0x39')](_0x5585ec[_0xb395('0x37')]['fields']));_0x597efc[_0xb395('0x38')]=_0x597efc[_0xb395('0x38')]['length']?_0x597efc['attributes']:_0x3c732f['model'];if(_0x5585ec[_0xb395('0x37')]['includeAll']){_0x597efc['include']=[{'all':!![]}];}_0x597efc=_[_0xb395('0x40')]({},_0x597efc,_0x5585ec[_0xb395('0x42')]);return db[_0xb395('0x2f')][_0xb395('0x48')](_0x597efc)['then'](handleEntityNotFound(_0x3ea360,null))[_0xb395('0x29')](respondWithResult(_0x3ea360,null))['catch'](handleError(_0x3ea360,null));};exports[_0xb395('0x49')]=function(_0x584c74,_0x4e2f41){return db['Variable'][_0xb395('0x49')](_0x584c74[_0xb395('0x4a')],{})[_0xb395('0x29')](function(_0x2a40d3){var _0x30dc86=_0x584c74[_0xb395('0x4b')][_0xb395('0x4c')]({'plain':!![]});if(!_0x30dc86)throw new Error(_0xb395('0x4d'));if(_0x30dc86[_0xb395('0x4e')]===_0xb395('0x4b')){var _0x434d71=_0x2a40d3[_0xb395('0x4c')]({'plain':!![]});var _0x54eaf2='Variables';return db[_0xb395('0x4f')][_0xb395('0x48')]({'where':{'name':_0x54eaf2,'userProfileId':_0x30dc86['userProfileId']},'raw':!![]})[_0xb395('0x29')](function(_0x19b2b8){if(_0x19b2b8&&_0x19b2b8['autoAssociation']===0x0){return db['UserProfileResource'][_0xb395('0x49')]({'name':_0x434d71[_0xb395('0x2c')],'resourceId':_0x434d71['id'],'type':_0x19b2b8[_0xb395('0x2c')],'sectionId':_0x19b2b8['id']},{})['then'](function(){return _0x2a40d3;});}else{return _0x2a40d3;}})[_0xb395('0x45')](function(_0x412782){logger[_0xb395('0x2b')](_0xb395('0x50'),_0x412782);throw _0x412782;});}return _0x2a40d3;})[_0xb395('0x29')](respondWithResult(_0x4e2f41,0xc9))[_0xb395('0x45')](handleError(_0x4e2f41,null));};exports['update']=function(_0x1aa758,_0x260023){if(_0x1aa758[_0xb395('0x4a')]['id']){delete _0x1aa758['body']['id'];}return db[_0xb395('0x2f')][_0xb395('0x48')]({'where':{'id':_0x1aa758[_0xb395('0x46')]['id']}})['then'](handleEntityNotFound(_0x260023,null))[_0xb395('0x29')](saveUpdates(_0x1aa758[_0xb395('0x4a')],null))[_0xb395('0x29')](respondWithResult(_0x260023,null))['catch'](handleError(_0x260023,null));};exports[_0xb395('0x28')]=function(_0x392488,_0x49e8da){return db['Variable']['find']({'where':{'id':_0x392488[_0xb395('0x46')]['id']}})[_0xb395('0x29')](handleEntityNotFound(_0x49e8da,null))[_0xb395('0x29')](removeEntity(_0x49e8da,null))[_0xb395('0x45')](handleError(_0x49e8da,null));}; \ No newline at end of file +var _0x515e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Variables','UserProfileResource','destroy','error','name','index','Variable','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x55518e,_0x4da7d9){var _0x5af057=function(_0x3ce15f){while(--_0x3ce15f){_0x55518e['push'](_0x55518e['shift']());}};_0x5af057(++_0x4da7d9);}(_0x515e,0x1a4));var _0xe515=function(_0x56f927,_0xdfcfa4){_0x56f927=_0x56f927-0x0;var _0x363231=_0x515e[_0x56f927];return _0x363231;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe515('0x0'));var zipdir=require(_0xe515('0x1'));var jsonpatch=require(_0xe515('0x2'));var rp=require(_0xe515('0x3'));var moment=require(_0xe515('0x4'));var BPromise=require(_0xe515('0x5'));var Mustache=require(_0xe515('0x6'));var util=require(_0xe515('0x7'));var path=require(_0xe515('0x8'));var sox=require(_0xe515('0x9'));var csv=require(_0xe515('0xa'));var ejs=require(_0xe515('0xb'));var fs=require('fs');var fs_extra=require(_0xe515('0xc'));var _=require(_0xe515('0xd'));var squel=require('squel');var crypto=require(_0xe515('0xe'));var jsforce=require(_0xe515('0xf'));var deskjs=require(_0xe515('0x10'));var toCsv=require(_0xe515('0xa'));var querystring=require(_0xe515('0x11'));var Papa=require(_0xe515('0x12'));var Redis=require(_0xe515('0x13'));var authService=require(_0xe515('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe515('0x15'));var hardwareService=require(_0xe515('0x16'));var logger=require(_0xe515('0x17'))(_0xe515('0x18'));var utils=require(_0xe515('0x19'));var config=require(_0xe515('0x1a'));var licenseUtil=require(_0xe515('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cf70f,_0x41688f){_0x41688f=_0x41688f||0xcc;return function(_0x5254a0){if(_0x5254a0){return _0x1cf70f[_0xe515('0x1c')](_0x41688f);}return _0x1cf70f[_0xe515('0x1d')](_0x41688f)[_0xe515('0x1e')]();};}function respondWithResult(_0x52070e,_0x42f0b2){_0x42f0b2=_0x42f0b2||0xc8;return function(_0x4d7bc6){if(_0x4d7bc6){return _0x52070e[_0xe515('0x1d')](_0x42f0b2)[_0xe515('0x1f')](_0x4d7bc6);}};}function respondWithFilteredResult(_0x54e83f,_0x46e884){return function(_0x106700){if(_0x106700){var _0x5056a7=typeof _0x46e884[_0xe515('0x20')]===_0xe515('0x21')&&typeof _0x46e884[_0xe515('0x22')]===_0xe515('0x21');var _0x155aa3=_0x106700[_0xe515('0x23')];var _0x2fc4b2=_0x5056a7?0x0:_0x46e884['offset'];var _0x8090ee=_0x5056a7?_0x106700[_0xe515('0x23')]:_0x46e884['offset']+_0x46e884[_0xe515('0x22')];var _0x5d9500;if(_0x8090ee>=_0x155aa3){_0x8090ee=_0x155aa3;_0x5d9500=0xc8;}else{_0x5d9500=0xce;}_0x54e83f[_0xe515('0x1d')](_0x5d9500);return _0x54e83f[_0xe515('0x24')](_0xe515('0x25'),_0x2fc4b2+'-'+_0x8090ee+'/'+_0x155aa3)[_0xe515('0x1f')](_0x106700);}return null;};}function patchUpdates(_0x11bbb3){return function(_0x527e56){try{jsonpatch[_0xe515('0x26')](_0x527e56,_0x11bbb3,!![]);}catch(_0x414076){return BPromise[_0xe515('0x27')](_0x414076);}return _0x527e56['save']();};}function saveUpdates(_0x554318,_0x2eeaca){return function(_0x3fd612){if(_0x3fd612){return _0x3fd612[_0xe515('0x28')](_0x554318)['then'](function(_0x46b222){return _0x46b222;});}return null;};}function removeEntity(_0x1aa722,_0x13455d){return function(_0x10b719){if(_0x10b719){return _0x10b719['destroy']()[_0xe515('0x29')](function(){var _0x2974f5=_0x10b719[_0xe515('0x2a')]({'plain':!![]});var _0x416f5a=_0xe515('0x2b');return db[_0xe515('0x2c')][_0xe515('0x2d')]({'where':{'type':_0x416f5a,'resourceId':_0x2974f5['id']}})['then'](function(){return _0x10b719;});})[_0xe515('0x29')](function(){_0x1aa722[_0xe515('0x1d')](0xcc)[_0xe515('0x1e')]();});}};}function handleEntityNotFound(_0x4fabcf,_0x111df1){return function(_0x28a0b6){if(!_0x28a0b6){_0x4fabcf[_0xe515('0x1c')](0x194);}return _0x28a0b6;};}function handleError(_0x52b350,_0x52528b){_0x52528b=_0x52528b||0x1f4;return function(_0x28a53b){logger[_0xe515('0x2e')](_0x28a53b['stack']);if(_0x28a53b['name']){delete _0x28a53b[_0xe515('0x2f')];}_0x52b350[_0xe515('0x1d')](_0x52528b)['send'](_0x28a53b);};}exports[_0xe515('0x30')]=function(_0x3012d5,_0xef987b){var _0x12feb9={},_0x44e46d={},_0x596ac3={'count':0x0,'rows':[]};var _0x5a0ddc=_['map'](db[_0xe515('0x31')][_0xe515('0x32')],function(_0x4c00d8){return{'name':_0x4c00d8[_0xe515('0x33')],'type':_0x4c00d8[_0xe515('0x34')][_0xe515('0x35')]};});_0x44e46d[_0xe515('0x36')]=_[_0xe515('0x37')](_0x5a0ddc,_0xe515('0x2f'));_0x44e46d[_0xe515('0x38')]=_[_0xe515('0x39')](_0x3012d5[_0xe515('0x38')]);_0x44e46d[_0xe515('0x3a')]=_[_0xe515('0x3b')](_0x44e46d['model'],_0x44e46d[_0xe515('0x38')]);_0x12feb9[_0xe515('0x3c')]=_[_0xe515('0x3b')](_0x44e46d['model'],qs[_0xe515('0x3d')](_0x3012d5[_0xe515('0x38')][_0xe515('0x3d')]));_0x12feb9[_0xe515('0x3c')]=_0x12feb9['attributes'][_0xe515('0x3e')]?_0x12feb9[_0xe515('0x3c')]:_0x44e46d[_0xe515('0x36')];if(!_0x3012d5[_0xe515('0x38')][_0xe515('0x3f')]('nolimit')){_0x12feb9[_0xe515('0x22')]=qs['limit'](_0x3012d5[_0xe515('0x38')][_0xe515('0x22')]);_0x12feb9[_0xe515('0x20')]=qs[_0xe515('0x20')](_0x3012d5[_0xe515('0x38')]['offset']);}_0x12feb9[_0xe515('0x40')]=qs[_0xe515('0x41')](_0x3012d5[_0xe515('0x38')][_0xe515('0x41')]);_0x12feb9['where']=qs[_0xe515('0x3a')](_[_0xe515('0x42')](_0x3012d5['query'],_0x44e46d[_0xe515('0x3a')]),_0x5a0ddc);if(_0x3012d5[_0xe515('0x38')][_0xe515('0x43')]){_0x12feb9['where']=_[_0xe515('0x44')](_0x12feb9[_0xe515('0x45')],{'$or':_[_0xe515('0x37')](_0x5a0ddc,function(_0x2f063b){if(_0x2f063b[_0xe515('0x34')]!==_0xe515('0x46')){var _0x4d5edb={};_0x4d5edb[_0x2f063b[_0xe515('0x2f')]]={'$like':'%'+_0x3012d5[_0xe515('0x38')][_0xe515('0x43')]+'%'};return _0x4d5edb;}})});}_0x12feb9=_[_0xe515('0x44')]({},_0x12feb9,_0x3012d5['options']);var _0x3ca4e3={'where':_0x12feb9[_0xe515('0x45')]};return db[_0xe515('0x31')]['count'](_0x3ca4e3)[_0xe515('0x29')](function(_0x5d6864){_0x596ac3[_0xe515('0x23')]=_0x5d6864;if(_0x3012d5[_0xe515('0x38')]['includeAll']){_0x12feb9[_0xe515('0x47')]=[{'all':!![]}];}return db[_0xe515('0x31')][_0xe515('0x48')](_0x12feb9);})['then'](function(_0x3cf118){_0x596ac3[_0xe515('0x49')]=_0x3cf118;return _0x596ac3;})['then'](respondWithFilteredResult(_0xef987b,_0x12feb9))[_0xe515('0x4a')](handleError(_0xef987b,null));};exports[_0xe515('0x4b')]=function(_0x2b043e,_0x20a604){var _0x2233f4={'raw':!![],'where':{'id':_0x2b043e[_0xe515('0x4c')]['id']}},_0x2d143d={};_0x2d143d[_0xe515('0x36')]=_['keys'](db['Variable']['rawAttributes']);_0x2d143d[_0xe515('0x38')]=_['keys'](_0x2b043e[_0xe515('0x38')]);_0x2d143d['filters']=_[_0xe515('0x3b')](_0x2d143d[_0xe515('0x36')],_0x2d143d[_0xe515('0x38')]);_0x2233f4[_0xe515('0x3c')]=_[_0xe515('0x3b')](_0x2d143d[_0xe515('0x36')],qs[_0xe515('0x3d')](_0x2b043e['query'][_0xe515('0x3d')]));_0x2233f4[_0xe515('0x3c')]=_0x2233f4['attributes'][_0xe515('0x3e')]?_0x2233f4['attributes']:_0x2d143d[_0xe515('0x36')];if(_0x2b043e[_0xe515('0x38')][_0xe515('0x4d')]){_0x2233f4[_0xe515('0x47')]=[{'all':!![]}];}_0x2233f4=_[_0xe515('0x44')]({},_0x2233f4,_0x2b043e[_0xe515('0x4e')]);return db[_0xe515('0x31')][_0xe515('0x4f')](_0x2233f4)[_0xe515('0x29')](handleEntityNotFound(_0x20a604,null))[_0xe515('0x29')](respondWithResult(_0x20a604,null))[_0xe515('0x4a')](handleError(_0x20a604,null));};exports['create']=function(_0x4dd3a2,_0x4826f6){return db[_0xe515('0x31')]['create'](_0x4dd3a2[_0xe515('0x50')],{})[_0xe515('0x29')](function(_0x3d9738){var _0x47f719=_0x4dd3a2[_0xe515('0x51')][_0xe515('0x2a')]({'plain':!![]});if(!_0x47f719)throw new Error(_0xe515('0x52'));if(_0x47f719['role']===_0xe515('0x51')){var _0x4b6642=_0x3d9738['get']({'plain':!![]});var _0x3f3c20=_0xe515('0x2b');return db[_0xe515('0x53')][_0xe515('0x4f')]({'where':{'name':_0x3f3c20,'userProfileId':_0x47f719[_0xe515('0x54')]},'raw':!![]})[_0xe515('0x29')](function(_0x22d0f5){if(_0x22d0f5&&_0x22d0f5[_0xe515('0x55')]===0x0){return db['UserProfileResource'][_0xe515('0x56')]({'name':_0x4b6642[_0xe515('0x2f')],'resourceId':_0x4b6642['id'],'type':_0x22d0f5[_0xe515('0x2f')],'sectionId':_0x22d0f5['id']},{})['then'](function(){return _0x3d9738;});}else{return _0x3d9738;}})['catch'](function(_0x5b38b5){logger[_0xe515('0x2e')](_0xe515('0x57'),_0x5b38b5);throw _0x5b38b5;});}return _0x3d9738;})['then'](respondWithResult(_0x4826f6,0xc9))[_0xe515('0x4a')](handleError(_0x4826f6,null));};exports[_0xe515('0x28')]=function(_0x5b788c,_0x2526aa){if(_0x5b788c[_0xe515('0x50')]['id']){delete _0x5b788c[_0xe515('0x50')]['id'];}return db[_0xe515('0x31')]['find']({'where':{'id':_0x5b788c['params']['id']}})['then'](handleEntityNotFound(_0x2526aa,null))['then'](saveUpdates(_0x5b788c[_0xe515('0x50')],null))['then'](respondWithResult(_0x2526aa,null))[_0xe515('0x4a')](handleError(_0x2526aa,null));};exports[_0xe515('0x2d')]=function(_0x1bb420,_0x1277d){return db[_0xe515('0x31')][_0xe515('0x4f')]({'where':{'id':_0x1bb420[_0xe515('0x4c')]['id']}})[_0xe515('0x29')](handleEntityNotFound(_0x1277d,null))[_0xe515('0x29')](removeEntity(_0x1277d,null))[_0xe515('0x4a')](handleError(_0x1277d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 386f87b..5d758f8 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 _0x273b=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path','./variable.attributes','exports'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x273b,0x123));var _0xb273=function(_0x57abf5,_0x6c864c){_0x57abf5=_0x57abf5-0x0;var _0x1eed9f=_0x273b[_0x57abf5];return _0x1eed9f;};'use strict';var _=require(_0xb273('0x0'));var util=require(_0xb273('0x1'));var logger=require(_0xb273('0x2'))(_0xb273('0x3'));var moment=require(_0xb273('0x4'));var BPromise=require(_0xb273('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb273('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb273('0x7'));module[_0xb273('0x8')]=function(_0x217245,_0xab138f){return _0x217245[_0xb273('0x9')](_0xb273('0xa'),attributes,{'tableName':_0xb273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d0f=['tools_variables','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./variable.attributes','exports','Variable'];(function(_0x173b14,_0x19c915){var _0x24dce9=function(_0x2f7154){while(--_0x2f7154){_0x173b14['push'](_0x173b14['shift']());}};_0x24dce9(++_0x19c915);}(_0x9d0f,0x1ae));var _0xf9d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9d0f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf9d0('0x0'));var util=require(_0xf9d0('0x1'));var logger=require('../../config/logger')(_0xf9d0('0x2'));var moment=require(_0xf9d0('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9d0('0x5'));var config=require(_0xf9d0('0x6'));var attributes=require(_0xf9d0('0x7'));module[_0xf9d0('0x8')]=function(_0x5513d5,_0x4d1b1f){return _0x5513d5['define'](_0xf9d0('0x9'),attributes,{'tableName':_0xf9d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index af83292..9ff4a9a 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x1feeaf,_0x5a7aab){var _0x280058=function(_0x46968e){while(--_0x46968e){_0x1feeaf['push'](_0x1feeaf['shift']());}};_0x280058(++_0x5a7aab);}(_0x7217,0x19e));var _0x7721=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7217[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0xf0f7ba,_0x48be70){var _0x44382c=function(_0x5b746c){while(--_0x5b746c){_0xf0f7ba['push'](_0xf0f7ba['shift']());}};_0x44382c(++_0x48be70);}(_0x1cb9,0x14e));var _0x91cb=function(_0x605bef,_0x54bec5){_0x605bef=_0x605bef-0x0;var _0x575d00=_0x1cb9[_0x605bef];return _0x575d00;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0248e8d..fe4484a 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 _0xdd26=['pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','isAuthenticated','reset','/pull'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xdd26,0x1bf));var _0x6dd2=function(_0x3e407e,_0x277189){_0x3e407e=_0x3e407e-0x0;var _0x37c26b=_0xdd26[_0x3e407e];return _0x37c26b;};'use strict';var express=require(_0x6dd2('0x0'));var router=express[_0x6dd2('0x1')]();var auth=require(_0x6dd2('0x2'));var controller=require(_0x6dd2('0x3'));router['get']('/',controller[_0x6dd2('0x4')]);router[_0x6dd2('0x5')](_0x6dd2('0x6'),auth['isAuthenticated'](),auth[_0x6dd2('0x7')](),controller[_0x6dd2('0x8')]);router[_0x6dd2('0x5')]('/reset',auth[_0x6dd2('0x9')](),auth[_0x6dd2('0x7')](),controller[_0x6dd2('0xa')]);router[_0x6dd2('0x5')](_0x6dd2('0xb'),auth['isAuthenticated'](),auth[_0x6dd2('0x7')](),controller[_0x6dd2('0xc')]);router[_0x6dd2('0x5')](_0x6dd2('0xd'),auth['isAuthenticated'](),controller[_0x6dd2('0xe')]);router['get'](_0x6dd2('0xf'),controller['migrations']);module[_0x6dd2('0x10')]=router; \ No newline at end of file +var _0x8ef6=['canUpdate','/reset','reset','/pull','pull','/restart','/migrations','migrations','express','Router','../../components/auth/service','index','get','isAuthenticated'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ef6,0x1f2));var _0x68ef=function(_0x2e066e,_0x76ee5d){_0x2e066e=_0x2e066e-0x0;var _0x2021c3=_0x8ef6[_0x2e066e];return _0x2021c3;};'use strict';var express=require(_0x68ef('0x0'));var router=express[_0x68ef('0x1')]();var auth=require(_0x68ef('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x68ef('0x3')]);router[_0x68ef('0x4')]('/fetch',auth[_0x68ef('0x5')](),auth[_0x68ef('0x6')](),controller['fetch']);router['get'](_0x68ef('0x7'),auth[_0x68ef('0x5')](),auth[_0x68ef('0x6')](),controller[_0x68ef('0x8')]);router[_0x68ef('0x4')](_0x68ef('0x9'),auth[_0x68ef('0x5')](),auth['canUpdate'](),controller[_0x68ef('0xa')]);router[_0x68ef('0x4')](_0x68ef('0xb'),auth['isAuthenticated'](),controller['restart']);router['get'](_0x68ef('0xc'),controller[_0x68ef('0xd')]);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 eeeb46b..69bcfa3 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 _0x2922=['\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','push','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.','map','.js'];(function(_0x339216,_0x5307be){var _0x3c751c=function(_0x679e3a){while(--_0x679e3a){_0x339216['push'](_0x339216['shift']());}};_0x3c751c(++_0x5307be);}(_0x2922,0x1a4));var _0x2292=function(_0x1ab755,_0x5e288f){_0x1ab755=_0x1ab755-0x0;var _0x3bbdd2=_0x2922[_0x1ab755];return _0x3bbdd2;};'use strict';var Umzug=require(_0x2292('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x2292('0x1'));var pkginfo=require(_0x2292('0x2'))(module,_0x2292('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x2292('0x4'))['exec'];var db=require(_0x2292('0x5'))['db'];var config=require(_0x2292('0x6'));var pm2=require(_0x2292('0x7'));var logger=require(_0x2292('0x8'))(_0x2292('0x9'));var git=require(_0x2292('0xa'))(config[_0x2292('0xb')]);exports[_0x2292('0xc')]=function(_0x331649,_0x5a0457){var _0x4d84e4={'current':module[_0x2292('0xd')][_0x2292('0x3')],'phonebar':0x2};if(_0x331649[_0x2292('0xe')]&&_0x331649['query']['latest']){return git[_0x2292('0xf')]()[_0x2292('0x10')](function(_0x49e2a5,_0x288ccf){_0x4d84e4[_0x2292('0x11')]=(_0x49e2a5?module[_0x2292('0xd')][_0x2292('0x3')]:_0x288ccf[_0x2292('0x11')])||_0x2292('0x12');return _0x5a0457[_0x2292('0x13')](0xc8)[_0x2292('0x14')](_0x4d84e4);});}else{return _0x5a0457[_0x2292('0x13')](0xc8)['json'](_0x4d84e4);}};exports[_0x2292('0xf')]=function(_0xfdd6f1,_0x531b58){return git[_0x2292('0xf')]([_0x2292('0x15'),_0x2292('0x16')],function(_0x42f00e){if(_0x42f00e){logger[_0x2292('0x17')](_0x42f00e);return _0x531b58['status'](0x1f4)[_0x2292('0x14')](_0x42f00e);}logger[_0x2292('0x18')](_0x2292('0x19'));return _0x531b58[_0x2292('0x13')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x2292('0x1a')]=function(_0x98d786,_0x16a2dd){return git[_0x2292('0x1a')]([_0x2292('0x1b'),_0x2292('0x1c')],function(_0x1452b7){if(_0x1452b7){logger[_0x2292('0x17')](_0x1452b7);return _0x16a2dd[_0x2292('0x13')](0x1f4)['json'](_0x1452b7);}logger[_0x2292('0x18')](_0x2292('0x1d'));return _0x16a2dd[_0x2292('0x13')](0xc8)[_0x2292('0x14')]({'output':_0x2292('0x1e')});});};exports['pull']=function(_0x286ac1,_0x43385b){exec(_0x2292('0x1f'),function(_0x4a1751,_0x143a54,_0x5cb2c2){logger[_0x2292('0x18')](_0x143a54);logger['info'](_0x5cb2c2);if(_0x4a1751){logger[_0x2292('0x17')](_0x4a1751);return _0x43385b['status'](0x1f4)['json'](_0x4a1751);}return _0x43385b[_0x2292('0x13')](0xc8)[_0x2292('0x14')]({'output':_0x143a54});});};exports['restart']=function(_0x499ad4,_0x389079){return pm2[_0x2292('0x20')](_0x2292('0x21'))[_0x2292('0x22')](function(_0x1259a3){logger[_0x2292('0x18')]('pm2\x20restart\x20motion\x20%s',_0x1259a3);return _0x389079[_0x2292('0x13')](0xc8)[_0x2292('0x14')]({'output':_0x2292('0x23')});})['catch'](function(_0xb29f10){logger[_0x2292('0x17')](_0xb29f10);return _0x389079['status'](0x1f4)['json'](_0xb29f10);});};exports[_0x2292('0x24')]=function(_0x264d6c,_0x25f1f5){var _0x49cf4c=fs['readdirSync'](path[_0x2292('0x25')](config[_0x2292('0xb')],_0x2292('0x26'),'migrations'));var _0x28f4b9=[];for(var _0x23525b=0x0;_0x23525b<_0x49cf4c['length'];_0x23525b++){var _0xcf627d=_0x49cf4c[_0x23525b]['replace']('.js','');if(compareVersions(module[_0x2292('0xd')][_0x2292('0x3')],_0xcf627d)===-0x1){_0x28f4b9[_0x2292('0x27')](_0xcf627d);}}if(_0x28f4b9[_0x2292('0x28')]){var _0x5b60fd=_0x28f4b9[_0x2292('0x29')](compareVersions);var _0x274730=new Umzug({'storage':_0x2292('0x2a'),'storageOptions':{'model':db[_0x2292('0x2b')],'modelName':'Migration','columnName':_0x2292('0x3')},'migrations':{'params':[db[_0x2292('0x2a')][_0x2292('0x2c')](),db[_0x2292('0x2a')]['constructor'],function(){throw new Error(_0x2292('0x2d'));}],'path':path[_0x2292('0x25')](config[_0x2292('0xb')],_0x2292('0x26'),'migrations'),'pattern':/\.js$/}});_0x274730['up']({'migrations':_[_0x2292('0x2e')](_0x5b60fd,function(_0x1f7500){return _0x1f7500+_0x2292('0x2f');})})[_0x2292('0x22')](function(){return _0x25f1f5[_0x2292('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x2292('0xd')][_0x2292('0x3')]+_0x2292('0x30')+_['last'](_0x5b60fd),'migrations':_[_0x2292('0x25')](_0x5b60fd)});})[_0x2292('0x31')](function(_0x19c6e0){if(_0x19c6e0 instanceof db[_0x2292('0x2a')][_0x2292('0x32')]){return _0x25f1f5['status'](0xc8)[_0x2292('0x14')]({'output':_0x2292('0x33')});}else{return _0x25f1f5[_0x2292('0x13')](0x1f4)[_0x2292('0x14')](_0x19c6e0);}});}else{return _0x25f1f5['status'](0xc8)[_0x2292('0x14')]({'output':_0x2292('0x33')});}}; \ No newline at end of file +var _0xfe83=['query','latest','fetch','tags','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','readdirSync','join','server','migrations','length','.js','push','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','compare-versions','child_process','exec','../../config/environment','../../config/logger','update','simple-git','root','index','exports','version'];(function(_0x51ab03,_0x3240ee){var _0x5b4892=function(_0x2ce615){while(--_0x2ce615){_0x51ab03['push'](_0x51ab03['shift']());}};_0x5b4892(++_0x3240ee);}(_0xfe83,0x17b));var _0x3fe8=function(_0x575353,_0x14e72f){_0x575353=_0x575353-0x0;var _0x1188fc=_0xfe83[_0x575353];return _0x1188fc;};'use strict';var Umzug=require('umzug');var path=require(_0x3fe8('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x3fe8('0x1'))(module,'version');var compareVersions=require(_0x3fe8('0x2'));var exec=require(_0x3fe8('0x3'))[_0x3fe8('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x3fe8('0x5'));var pm2=require('../../config/pm2');var logger=require(_0x3fe8('0x6'))(_0x3fe8('0x7'));var git=require(_0x3fe8('0x8'))(config[_0x3fe8('0x9')]);exports[_0x3fe8('0xa')]=function(_0x40d7f1,_0x19f32d){var _0x559b57={'current':module[_0x3fe8('0xb')][_0x3fe8('0xc')],'phonebar':0x2};if(_0x40d7f1[_0x3fe8('0xd')]&&_0x40d7f1[_0x3fe8('0xd')][_0x3fe8('0xe')]){return git[_0x3fe8('0xf')]()[_0x3fe8('0x10')](function(_0x1548b1,_0x4c5e6f){_0x559b57[_0x3fe8('0xe')]=(_0x1548b1?module[_0x3fe8('0xb')][_0x3fe8('0xc')]:_0x4c5e6f['latest'])||'2.0.0';return _0x19f32d[_0x3fe8('0x11')](0xc8)[_0x3fe8('0x12')](_0x559b57);});}else{return _0x19f32d['status'](0xc8)[_0x3fe8('0x12')](_0x559b57);}};exports[_0x3fe8('0xf')]=function(_0x123a05,_0x7cbfb9){return git['fetch']([_0x3fe8('0x13'),_0x3fe8('0x14')],function(_0x5521c9){if(_0x5521c9){logger['error'](_0x5521c9);return _0x7cbfb9[_0x3fe8('0x11')](0x1f4)['json'](_0x5521c9);}logger[_0x3fe8('0x15')](_0x3fe8('0x16'));return _0x7cbfb9[_0x3fe8('0x11')](0xc8)['json']({'output':_0x3fe8('0x17')});});};exports[_0x3fe8('0x18')]=function(_0x5a6482,_0x2f9caf){return git[_0x3fe8('0x18')](['--hard','FETCH_HEAD'],function(_0xfd237b){if(_0xfd237b){logger['error'](_0xfd237b);return _0x2f9caf[_0x3fe8('0x11')](0x1f4)['json'](_0xfd237b);}logger[_0x3fe8('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2f9caf[_0x3fe8('0x11')](0xc8)[_0x3fe8('0x12')]({'output':_0x3fe8('0x19')});});};exports[_0x3fe8('0x1a')]=function(_0x829816,_0x4ce135){exec(_0x3fe8('0x1b'),function(_0x54f145,_0x17d7a8,_0x35ec52){logger[_0x3fe8('0x15')](_0x17d7a8);logger[_0x3fe8('0x15')](_0x35ec52);if(_0x54f145){logger['error'](_0x54f145);return _0x4ce135[_0x3fe8('0x11')](0x1f4)[_0x3fe8('0x12')](_0x54f145);}return _0x4ce135['status'](0xc8)[_0x3fe8('0x12')]({'output':_0x17d7a8});});};exports[_0x3fe8('0x1c')]=function(_0x2c7381,_0x5cceb7){return pm2[_0x3fe8('0x1c')](_0x3fe8('0x1d'))[_0x3fe8('0x1e')](function(_0x124d84){logger[_0x3fe8('0x15')](_0x3fe8('0x1f'),_0x124d84);return _0x5cceb7[_0x3fe8('0x11')](0xc8)[_0x3fe8('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x57a887){logger['error'](_0x57a887);return _0x5cceb7[_0x3fe8('0x11')](0x1f4)[_0x3fe8('0x12')](_0x57a887);});};exports['migrations']=function(_0x10180f,_0x4252a9){var _0x2c19ec=fs[_0x3fe8('0x20')](path[_0x3fe8('0x21')](config['root'],_0x3fe8('0x22'),_0x3fe8('0x23')));var _0x19d5fd=[];for(var _0x210231=0x0;_0x210231<_0x2c19ec[_0x3fe8('0x24')];_0x210231++){var _0xe6d519=_0x2c19ec[_0x210231]['replace'](_0x3fe8('0x25'),'');if(compareVersions(module[_0x3fe8('0xb')]['version'],_0xe6d519)===-0x1){_0x19d5fd[_0x3fe8('0x26')](_0xe6d519);}}if(_0x19d5fd[_0x3fe8('0x24')]){var _0x106784=_0x19d5fd['sort'](compareVersions);var _0x3d5ef7=new Umzug({'storage':_0x3fe8('0x27'),'storageOptions':{'model':db[_0x3fe8('0x28')],'modelName':_0x3fe8('0x28'),'columnName':_0x3fe8('0xc')},'migrations':{'params':[db[_0x3fe8('0x27')][_0x3fe8('0x29')](),db[_0x3fe8('0x27')][_0x3fe8('0x2a')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x3fe8('0x21')](config[_0x3fe8('0x9')],_0x3fe8('0x22'),_0x3fe8('0x23')),'pattern':/\.js$/}});_0x3d5ef7['up']({'migrations':_[_0x3fe8('0x2b')](_0x106784,function(_0x55f315){return _0x55f315+_0x3fe8('0x25');})})[_0x3fe8('0x1e')](function(){return _0x4252a9[_0x3fe8('0x11')](0xc8)['json']({'output':_0x3fe8('0x2c')+module[_0x3fe8('0xb')]['version']+_0x3fe8('0x2d')+_['last'](_0x106784),'migrations':_[_0x3fe8('0x21')](_0x106784)});})[_0x3fe8('0x2e')](function(_0x451fcd){if(_0x451fcd instanceof db[_0x3fe8('0x27')][_0x3fe8('0x2f')]){return _0x4252a9[_0x3fe8('0x11')](0xc8)[_0x3fe8('0x12')]({'output':_0x3fe8('0x30')});}else{return _0x4252a9[_0x3fe8('0x11')](0x1f4)[_0x3fe8('0x12')](_0x451fcd);}});}else{return _0x4252a9['status'](0xc8)[_0x3fe8('0x12')]({'output':_0x3fe8('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 57016d0..55c0cbf 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 _0x4b7b=['index','/describe','describe','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x210d9e,_0x4e2fc4){var _0x35c394=function(_0x21ab6b){while(--_0x21ab6b){_0x210d9e['push'](_0x210d9e['shift']());}};_0x35c394(++_0x4e2fc4);}(_0x4b7b,0x19a));var _0xb4b7=function(_0x1d1bc8,_0x924feb){_0x1d1bc8=_0x1d1bc8-0x0;var _0x2cea86=_0x4b7b[_0x1d1bc8];return _0x2cea86;};'use strict';var multer=require(_0xb4b7('0x0'));var util=require(_0xb4b7('0x1'));var path=require('path');var timeout=require(_0xb4b7('0x2'));var express=require(_0xb4b7('0x3'));var router=express['Router']();var fs_extra=require(_0xb4b7('0x4'));var auth=require(_0xb4b7('0x5'));var interaction=require(_0xb4b7('0x6'));var config=require(_0xb4b7('0x7'));var controller=require('./voiceAgentReport.controller');router[_0xb4b7('0x8')]('/',auth[_0xb4b7('0x9')](),controller[_0xb4b7('0xa')]);router[_0xb4b7('0x8')](_0xb4b7('0xb'),auth['isAuthenticated'](),controller[_0xb4b7('0xc')]);router[_0xb4b7('0x8')]('/:id',auth[_0xb4b7('0x9')](),controller[_0xb4b7('0xd')]);router['post']('/',auth[_0xb4b7('0x9')](),controller[_0xb4b7('0xe')]);router['put'](_0xb4b7('0xf'),auth[_0xb4b7('0x9')](),controller[_0xb4b7('0x10')]);router[_0xb4b7('0x11')](_0xb4b7('0xf'),auth[_0xb4b7('0x9')](),controller[_0xb4b7('0x12')]);module[_0xb4b7('0x13')]=router; \ No newline at end of file +var _0xa1ef=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','show','create','/:id','update','destroy','exports'];(function(_0xcfb742,_0x208cb1){var _0x1b2742=function(_0x50385a){while(--_0x50385a){_0xcfb742['push'](_0xcfb742['shift']());}};_0x1b2742(++_0x208cb1);}(_0xa1ef,0x130));var _0xfa1e=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0xa1ef[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0xfa1e('0x0'));var util=require(_0xfa1e('0x1'));var path=require(_0xfa1e('0x2'));var timeout=require(_0xfa1e('0x3'));var express=require(_0xfa1e('0x4'));var router=express[_0xfa1e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa1e('0x6'));var config=require('../../config/environment');var controller=require(_0xfa1e('0x7'));router[_0xfa1e('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa1e('0x9')]);router[_0xfa1e('0x8')](_0xfa1e('0xa'),auth[_0xfa1e('0xb')](),controller[_0xfa1e('0xc')]);router[_0xfa1e('0x8')]('/:id',auth[_0xfa1e('0xb')](),controller[_0xfa1e('0xd')]);router['post']('/',auth[_0xfa1e('0xb')](),controller[_0xfa1e('0xe')]);router['put'](_0xfa1e('0xf'),auth[_0xfa1e('0xb')](),controller[_0xfa1e('0x10')]);router['delete'](_0xfa1e('0xf'),auth[_0xfa1e('0xb')](),controller[_0xfa1e('0x11')]);module[_0xfa1e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 85ac530..b3dee4e 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 _0xb8cb=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x403486,_0x514f7e){_0x403486=_0x403486-0x0;var _0x3fdd57=_0xb8cb[_0x403486];return _0x3fdd57;};'use strict';var Sequelize=require(_0xbb8c('0x0'));module[_0xbb8c('0x1')]={'type':{'type':Sequelize[_0xbb8c('0x2')]},'uniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'calleridnum':{'type':Sequelize[_0xbb8c('0x2')]},'calleridname':{'type':Sequelize[_0xbb8c('0x2')]},'queue':{'type':Sequelize[_0xbb8c('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbb8c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xbb8c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xbb8c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbb8c('0x3')]},'holdtime':{'type':Sequelize[_0xbb8c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbb8c('0x4')]},'agentacw':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbb8c('0x4')]},'reason':{'type':Sequelize[_0xbb8c('0x2')]},'lastevent':{'type':Sequelize[_0xbb8c('0x2')]},'channel':{'type':Sequelize[_0xbb8c('0x2')]},'channelstate':{'type':Sequelize[_0xbb8c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xbb8c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbb8c('0x2')]},'connectedlinename':{'type':Sequelize[_0xbb8c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbb8c('0x2')]},'context':{'type':Sequelize[_0xbb8c('0x2')]},'exten':{'type':Sequelize[_0xbb8c('0x2')]},'priority':{'type':Sequelize[_0xbb8c('0x2')]},'destchannel':{'type':Sequelize[_0xbb8c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbb8c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbb8c('0x2')]},'destcalleridname':{'type':Sequelize[_0xbb8c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbb8c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbb8c('0x2')]},'destlanguage':{'type':Sequelize[_0xbb8c('0x2')]},'destaccountcode':{'type':Sequelize[_0xbb8c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbb8c('0x2')]},'destpriority':{'type':Sequelize[_0xbb8c('0x2')]},'destuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbb8c('0x2')]},'transfer':{'type':Sequelize[_0xbb8c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbb8c('0x2')],'comment':_0xbb8c('0x6')},'transferexten':{'type':Sequelize[_0xbb8c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbb8c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd070=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x2ae5d5,_0x9edd76){var _0x260126=function(_0x1ac517){while(--_0x1ac517){_0x2ae5d5['push'](_0x2ae5d5['shift']());}};_0x260126(++_0x9edd76);}(_0xd070,0x8e));var _0x0d07=function(_0x32b491,_0x47581e){_0x32b491=_0x32b491-0x0;var _0x4a5551=_0xd070[_0x32b491];return _0x4a5551;};'use strict';var Sequelize=require(_0x0d07('0x0'));module['exports']={'type':{'type':Sequelize[_0x0d07('0x1')]},'uniqueid':{'type':Sequelize[_0x0d07('0x1')]},'calleridnum':{'type':Sequelize[_0x0d07('0x1')]},'calleridname':{'type':Sequelize[_0x0d07('0x1')]},'queue':{'type':Sequelize[_0x0d07('0x1')]},'interface':{'type':Sequelize[_0x0d07('0x1')]},'membername':{'type':Sequelize[_0x0d07('0x1')]},'agentcalledAt':{'type':Sequelize[_0x0d07('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0d07('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x0d07('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x0d07('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0d07('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0d07('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0d07('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0d07('0x3')]},'agentacw':{'type':Sequelize[_0x0d07('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0d07('0x3')]},'reason':{'type':Sequelize[_0x0d07('0x1')]},'lastevent':{'type':Sequelize[_0x0d07('0x1')]},'channel':{'type':Sequelize[_0x0d07('0x1')]},'channelstate':{'type':Sequelize[_0x0d07('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0d07('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0d07('0x1')]},'accountcode':{'type':Sequelize[_0x0d07('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0d07('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0d07('0x1')]},'destchannelstate':{'type':Sequelize[_0x0d07('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x0d07('0x1')]},'destcalleridname':{'type':Sequelize[_0x0d07('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0d07('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0d07('0x1')]},'destlanguage':{'type':Sequelize[_0x0d07('0x1')]},'destaccountcode':{'type':Sequelize[_0x0d07('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0d07('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0d07('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x0d07('0x1')]},'transfer':{'type':Sequelize[_0x0d07('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d07('0x1')],'comment':_0x0d07('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b17cb02..4501829 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(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 15bc059..eb3d75a 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 _0x06f4=['api','moment','path','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x3386bd,_0x39e369){var _0x3cfc55=function(_0x5247c9){while(--_0x5247c9){_0x3386bd['push'](_0x3386bd['shift']());}};_0x3cfc55(++_0x39e369);}(_0x06f4,0x136));var _0x406f=function(_0x21339e,_0xc5751e){_0x21339e=_0x21339e-0x0;var _0x36629f=_0x06f4[_0x21339e];return _0x36629f;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x406f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x406f('0xa'),_0x406f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2070=['moment','request-promise','path','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','destuniqueid','../../config/logger','api'];(function(_0x5a6d9d,_0x32c66a){var _0x1d1c2a=function(_0x2d687b){while(--_0x2d687b){_0x5a6d9d['push'](_0x5a6d9d['shift']());}};_0x1d1c2a(++_0x32c66a);}(_0x2070,0x1a2));var _0x0207=function(_0x3863b2,_0x13e404){_0x3863b2=_0x3863b2-0x0;var _0x209711=_0x2070[_0x3863b2];return _0x209711;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0207('0x0'))(_0x0207('0x1'));var moment=require(_0x0207('0x2'));var BPromise=require('bluebird');var rp=require(_0x0207('0x3'));var fs=require('fs');var path=require(_0x0207('0x4'));var rimraf=require('rimraf');var config=require(_0x0207('0x5'));var attributes=require(_0x0207('0x6'));module['exports']=function(_0x5573e8,_0x5cf734){return _0x5573e8['define'](_0x0207('0x7'),attributes,{'tableName':_0x0207('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x0207('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 02f981d..c1e8bd2 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 _0x0da4=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','then','UpdateVoiceAgentReport','update','options','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x388809,_0xd9c48c){var _0x6cb9ad=function(_0x5d7e84){while(--_0x5d7e84){_0x388809['push'](_0x388809['shift']());}};_0x6cb9ad(++_0xd9c48c);}(_0x0da4,0x150));var _0x40da=function(_0x15852b,_0xe912b5){_0x15852b=_0x15852b-0x0;var _0x440508=_0x0da4[_0x15852b];return _0x440508;};'use strict';var _=require(_0x40da('0x0'));var util=require(_0x40da('0x1'));var moment=require(_0x40da('0x2'));var BPromise=require(_0x40da('0x3'));var rs=require(_0x40da('0x4'));var fs=require('fs');var Redis=require(_0x40da('0x5'));var db=require(_0x40da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x40da('0x7'))(_0x40da('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x40da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5081e8,_0x3bcd19,_0x45ef04){return new BPromise(function(_0x27072c,_0x5dd905){return client[_0x40da('0xa')](_0x5081e8,_0x45ef04)['then'](function(_0x2aa096){logger[_0x40da('0xb')](_0x40da('0xc'),_0x3bcd19,'request\x20sent');logger[_0x40da('0xd')](_0x40da('0xe'),_0x3bcd19,_0x40da('0xf'),JSON[_0x40da('0x10')](_0x2aa096));if(_0x2aa096[_0x40da('0x11')]){if(_0x2aa096[_0x40da('0x11')][_0x40da('0x12')]===0x1f4){logger[_0x40da('0x11')](_0x40da('0xc'),_0x3bcd19,_0x2aa096[_0x40da('0x11')][_0x40da('0x13')]);return _0x5dd905(_0x2aa096[_0x40da('0x11')][_0x40da('0x13')]);}logger['error'](_0x40da('0xc'),_0x3bcd19,_0x2aa096['error']['message']);return _0x27072c(_0x2aa096[_0x40da('0x11')]['message']);}else{logger[_0x40da('0xb')](_0x40da('0xc'),_0x3bcd19,_0x40da('0xf'));_0x27072c(_0x2aa096[_0x40da('0x14')][_0x40da('0x13')]);}})[_0x40da('0x15')](function(_0x59aac3){logger[_0x40da('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x3bcd19,_0x59aac3);_0x5dd905(_0x59aac3);});});}exports[_0x40da('0x16')]=function(_0x370c9c){var _0x2915dc=this;return new Promise(function(_0xef46b3,_0x1679d2){return db[_0x40da('0x17')][_0x40da('0x18')](_0x370c9c[_0x40da('0x19')],{'raw':_0x370c9c['options']?_0x370c9c['options']['raw']===undefined?!![]:![]:!![]})[_0x40da('0x1a')](function(_0x5bfb59){logger[_0x40da('0xb')]('CreateVoiceAgentReport',_0x370c9c);logger[_0x40da('0xd')](_0x40da('0x16'),_0x370c9c,JSON[_0x40da('0x10')](_0x5bfb59));_0xef46b3(_0x5bfb59);})[_0x40da('0x15')](function(_0x59c4fa){logger[_0x40da('0x11')]('CreateVoiceAgentReport',_0x59c4fa['message'],_0x370c9c);_0x1679d2(_0x2915dc[_0x40da('0x11')](0x1f4,_0x59c4fa[_0x40da('0x13')]));});});};exports[_0x40da('0x1b')]=function(_0xbbf3f8){var _0x14e597=this;return new Promise(function(_0xd842fd,_0x1a26af){return db[_0x40da('0x17')][_0x40da('0x1c')](_0xbbf3f8[_0x40da('0x19')],{'raw':_0xbbf3f8[_0x40da('0x1d')]?_0xbbf3f8[_0x40da('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbbf3f8[_0x40da('0x1d')]?_0xbbf3f8[_0x40da('0x1d')][_0x40da('0x1e')]||null:null,'attributes':_0xbbf3f8[_0x40da('0x1d')]?_0xbbf3f8[_0x40da('0x1d')]['attributes']||null:null,'limit':_0xbbf3f8[_0x40da('0x1d')]?_0xbbf3f8['options'][_0x40da('0x1f')]||null:null})[_0x40da('0x1a')](function(_0x2d4b5a){logger['info']('UpdateVoiceAgentReport',_0xbbf3f8);logger['debug'](_0x40da('0x1b'),_0xbbf3f8,JSON['stringify'](_0x2d4b5a));_0xd842fd(_0x2d4b5a);})[_0x40da('0x15')](function(_0x4b21c8){logger[_0x40da('0x11')](_0x40da('0x1b'),_0x4b21c8[_0x40da('0x13')],_0xbbf3f8);_0x1a26af(_0x14e597[_0x40da('0x11')](0x1f4,_0x4b21c8[_0x40da('0x13')]));});});}; \ No newline at end of file +var _0x1514=['ioredis','../../mysqldb','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','update','body','where','limit','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring'];(function(_0x5d6186,_0x2a8113){var _0x508ce4=function(_0x1e2159){while(--_0x1e2159){_0x5d6186['push'](_0x5d6186['shift']());}};_0x508ce4(++_0x2a8113);}(_0x1514,0x78));var _0x4151=function(_0x3b7ef8,_0x4480c8){_0x3b7ef8=_0x3b7ef8-0x0;var _0x540891=_0x1514[_0x3b7ef8];return _0x540891;};'use strict';var _=require(_0x4151('0x0'));var util=require('util');var moment=require(_0x4151('0x1'));var BPromise=require(_0x4151('0x2'));var rs=require(_0x4151('0x3'));var fs=require('fs');var Redis=require(_0x4151('0x4'));var db=require(_0x4151('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4151('0x6')][_0x4151('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26d6e2,_0xdd82b5,_0x3d296f){return new BPromise(function(_0x27c871,_0x2c0b48){return client[_0x4151('0x8')](_0x26d6e2,_0x3d296f)[_0x4151('0x9')](function(_0x1903b1){logger[_0x4151('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0xdd82b5,'request\x20sent');logger['debug'](_0x4151('0xb'),_0xdd82b5,_0x4151('0xc'),JSON[_0x4151('0xd')](_0x1903b1));if(_0x1903b1[_0x4151('0xe')]){if(_0x1903b1[_0x4151('0xe')][_0x4151('0xf')]===0x1f4){logger['error'](_0x4151('0x10'),_0xdd82b5,_0x1903b1[_0x4151('0xe')][_0x4151('0x11')]);return _0x2c0b48(_0x1903b1[_0x4151('0xe')][_0x4151('0x11')]);}logger[_0x4151('0xe')](_0x4151('0x10'),_0xdd82b5,_0x1903b1[_0x4151('0xe')][_0x4151('0x11')]);return _0x27c871(_0x1903b1['error']['message']);}else{logger[_0x4151('0xa')](_0x4151('0x10'),_0xdd82b5,_0x4151('0xc'));_0x27c871(_0x1903b1[_0x4151('0x12')][_0x4151('0x11')]);}})[_0x4151('0x13')](function(_0x55841e){logger[_0x4151('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0xdd82b5,_0x55841e);_0x2c0b48(_0x55841e);});});}exports[_0x4151('0x14')]=function(_0x3b9cfa){var _0x38d81b=this;return new Promise(function(_0x308f01,_0x2e58a6){return db[_0x4151('0x15')][_0x4151('0x16')](_0x3b9cfa['body'],{'raw':_0x3b9cfa[_0x4151('0x17')]?_0x3b9cfa[_0x4151('0x17')][_0x4151('0x18')]===undefined?!![]:![]:!![]})[_0x4151('0x9')](function(_0x499876){logger[_0x4151('0xa')]('CreateVoiceAgentReport',_0x3b9cfa);logger[_0x4151('0x19')](_0x4151('0x14'),_0x3b9cfa,JSON[_0x4151('0xd')](_0x499876));_0x308f01(_0x499876);})['catch'](function(_0x915f50){logger[_0x4151('0xe')]('CreateVoiceAgentReport',_0x915f50[_0x4151('0x11')],_0x3b9cfa);_0x2e58a6(_0x38d81b[_0x4151('0xe')](0x1f4,_0x915f50[_0x4151('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x645548){var _0x2ec6f9=this;return new Promise(function(_0x3ee794,_0x1c1fa8){return db[_0x4151('0x15')][_0x4151('0x1a')](_0x645548[_0x4151('0x1b')],{'raw':_0x645548[_0x4151('0x17')]?_0x645548[_0x4151('0x17')][_0x4151('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x645548[_0x4151('0x17')]?_0x645548['options'][_0x4151('0x1c')]||null:null,'attributes':_0x645548[_0x4151('0x17')]?_0x645548[_0x4151('0x17')]['attributes']||null:null,'limit':_0x645548[_0x4151('0x17')]?_0x645548[_0x4151('0x17')][_0x4151('0x1d')]||null:null})[_0x4151('0x9')](function(_0x357271){logger[_0x4151('0xa')](_0x4151('0x1e'),_0x645548);logger[_0x4151('0x19')](_0x4151('0x1e'),_0x645548,JSON[_0x4151('0xd')](_0x357271));_0x3ee794(_0x357271);})[_0x4151('0x13')](function(_0x93656a){logger[_0x4151('0xe')](_0x4151('0x1e'),_0x93656a['message'],_0x645548);_0x1c1fa8(_0x2ec6f9[_0x4151('0xe')](0x1f4,_0x93656a[_0x4151('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 391eaeb..88d9b28 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 _0x72b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x303ee3,_0x140838){var _0x2d47ab=function(_0x437c7e){while(--_0x437c7e){_0x303ee3['push'](_0x303ee3['shift']());}};_0x2d47ab(++_0x140838);}(_0x72b1,0x16e));var _0x172b=function(_0x2d26a5,_0x40a314){_0x2d26a5=_0x2d26a5-0x0;var _0xec0da=_0x72b1[_0x2d26a5];return _0xec0da;};'use strict';var multer=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var timeout=require(_0x172b('0x2'));var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var fs_extra=require(_0x172b('0x5'));var auth=require(_0x172b('0x6'));var interaction=require(_0x172b('0x7'));var config=require('../../config/environment');var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller[_0x172b('0xb')]);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router['get'](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0xf')]);router[_0x172b('0x10')]('/',auth['isAuthenticated'](),controller[_0x172b('0x11')]);router[_0x172b('0x12')](_0x172b('0xe'),auth[_0x172b('0xa')](),controller[_0x172b('0x13')]);router[_0x172b('0x14')](_0x172b('0xe'),auth['isAuthenticated'](),controller[_0x172b('0x15')]);module[_0x172b('0x16')]=router; \ No newline at end of file +var _0xcca7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xcca7,0x1aa));var _0x7cca=function(_0x32dc29,_0x4b863f){_0x32dc29=_0x32dc29-0x0;var _0x1132e5=_0xcca7[_0x32dc29];return _0x1132e5;};'use strict';var multer=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var path=require(_0x7cca('0x2'));var timeout=require(_0x7cca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var controller=require(_0x7cca('0x7'));router[_0x7cca('0x8')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xa')]);router['get']('/describe',auth[_0x7cca('0x9')](),controller[_0x7cca('0xb')]);router[_0x7cca('0x8')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller[_0x7cca('0xd')]);router[_0x7cca('0xe')]('/',auth[_0x7cca('0x9')](),controller[_0x7cca('0xf')]);router[_0x7cca('0x10')]('/:id',auth[_0x7cca('0x9')](),controller[_0x7cca('0x11')]);router[_0x7cca('0x12')](_0x7cca('0xc'),auth[_0x7cca('0x9')](),controller['destroy']);module[_0x7cca('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 14ff695..e24ec44 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 _0x52ad=['outbound-fax','TEXT','DATE','INTEGER','STRING','inbound','internal','outbound'];(function(_0x10b1c3,_0x108830){var _0x457e5a=function(_0x1ca507){while(--_0x1ca507){_0x10b1c3['push'](_0x10b1c3['shift']());}};_0x457e5a(++_0x108830);}(_0x52ad,0xd4));var _0xd52a=function(_0x120e33,_0x60f6b3){_0x120e33=_0x120e33-0x0;var _0x1f824f=_0x52ad[_0x120e33];return _0x1f824f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd52a('0x0')]},'type':{'type':Sequelize['ENUM'](_0xd52a('0x1'),_0xd52a('0x2'),_0xd52a('0x3'),'inbound-fax',_0xd52a('0x4'),'dialer')},'tag':{'type':Sequelize[_0xd52a('0x0')]},'accountcode':{'type':Sequelize[_0xd52a('0x0')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xd52a('0x0')]},'destinationcontext':{'type':Sequelize[_0xd52a('0x0')]},'callerid':{'type':Sequelize[_0xd52a('0x0')]},'channel':{'type':Sequelize[_0xd52a('0x0')]},'destinationchannel':{'type':Sequelize[_0xd52a('0x0')]},'lastapplication':{'type':Sequelize[_0xd52a('0x0')]},'lastdata':{'type':Sequelize[_0xd52a('0x5')]},'starttime':{'type':Sequelize[_0xd52a('0x6')]},'systemanswertime':{'type':Sequelize[_0xd52a('0x6')]},'answertime':{'type':Sequelize[_0xd52a('0x6')]},'endtime':{'type':Sequelize[_0xd52a('0x6')]},'duration':{'type':Sequelize[_0xd52a('0x7')]},'billableseconds':{'type':Sequelize[_0xd52a('0x7')]},'mohtime':{'type':Sequelize[_0xd52a('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd52a('0x0')]},'amaflags':{'type':Sequelize[_0xd52a('0x0')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xd52a('0x0')]},'userThirdDisposition':{'type':Sequelize[_0xd52a('0x0')]},'note':{'type':Sequelize[_0xd52a('0x0')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xd52a('0x7')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd92a=['outbound','TEXT','DATE','INTEGER','exports','STRING','ENUM','internal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd92a,0x1bc));var _0xad92=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd92a[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xad92('0x0')]={'uniqueid':{'type':Sequelize[_0xad92('0x1')]},'type':{'type':Sequelize[_0xad92('0x2')]('inbound',_0xad92('0x3'),_0xad92('0x4'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0xad92('0x1')]},'accountcode':{'type':Sequelize[_0xad92('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xad92('0x1')]},'destinationcontext':{'type':Sequelize[_0xad92('0x1')]},'callerid':{'type':Sequelize[_0xad92('0x1')]},'channel':{'type':Sequelize[_0xad92('0x1')]},'destinationchannel':{'type':Sequelize[_0xad92('0x1')]},'lastapplication':{'type':Sequelize[_0xad92('0x1')]},'lastdata':{'type':Sequelize[_0xad92('0x5')]},'starttime':{'type':Sequelize[_0xad92('0x6')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xad92('0x6')]},'endtime':{'type':Sequelize[_0xad92('0x6')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xad92('0x7')]},'mohtime':{'type':Sequelize[_0xad92('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xad92('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xad92('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xad92('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xad92('0x1')]},'note':{'type':Sequelize[_0xad92('0x1')]},'prefix':{'type':Sequelize[_0xad92('0x1')]},'routeid':{'type':Sequelize[_0xad92('0x7')]},'sipcallid':{'type':Sequelize[_0xad92('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d08edfb..d543613 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0xadb5,0xad));var _0x5adb=function(_0x6725d9,_0x599aa9){_0x6725d9=_0x6725d9-0x0;var _0x573142=_0xadb5[_0x6725d9];return _0x573142;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c05cc,_0xd63ced){_0x1c05cc=_0x1c05cc-0x0;var _0x2c1255=_0x2ef3[_0x1c05cc];return _0x2c1255;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3b7aef3..5e027da 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 _0x7754=['../../config/logger','api','moment','request-promise','path','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x59e4c4,_0x484286){var _0x1d98e6=function(_0x5845d8){while(--_0x5845d8){_0x59e4c4['push'](_0x59e4c4['shift']());}};_0x1d98e6(++_0x484286);}(_0x7754,0x1d7));var _0x4775=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7754[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x4775('0x0'));var util=require(_0x4775('0x1'));var logger=require(_0x4775('0x2'))(_0x4775('0x3'));var moment=require(_0x4775('0x4'));var BPromise=require('bluebird');var rp=require(_0x4775('0x5'));var fs=require('fs');var path=require(_0x4775('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4775('0x7'));module['exports']=function(_0x25a563,_0x442fb3){return _0x25a563['define'](_0x4775('0x8'),attributes,{'tableName':_0x4775('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4775('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0df5=['./voiceCallReport.attributes','exports','define','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0df5,0x13d));var _0x50df=function(_0x2c4d7b,_0x1c35a5){_0x2c4d7b=_0x2c4d7b-0x0;var _0x15e0fb=_0x0df5[_0x2c4d7b];return _0x15e0fb;};'use strict';var _=require('lodash');var util=require(_0x50df('0x0'));var logger=require(_0x50df('0x1'))(_0x50df('0x2'));var moment=require(_0x50df('0x3'));var BPromise=require(_0x50df('0x4'));var rp=require(_0x50df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50df('0x6'));var attributes=require(_0x50df('0x7'));module[_0x50df('0x8')]=function(_0x5f435b,_0x5b27b5){return _0x5f435b[_0x50df('0x9')]('VoiceCallReport',attributes,{'tableName':_0x50df('0xa'),'paranoid':![],'indexes':[{'fields':[_0x50df('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 2836c7e..d593299 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 _0x8a03=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','then','debug','stringify','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','where','lodash','moment'];(function(_0x41524f,_0x249e9f){var _0x43e89d=function(_0x2195c8){while(--_0x2195c8){_0x41524f['push'](_0x41524f['shift']());}};_0x43e89d(++_0x249e9f);}(_0x8a03,0x154));var _0x38a0=function(_0x499026,_0x272f69){_0x499026=_0x499026-0x0;var _0x4c63c1=_0x8a03[_0x499026];return _0x4c63c1;};'use strict';var _=require(_0x38a0('0x0'));var util=require('util');var moment=require(_0x38a0('0x1'));var BPromise=require(_0x38a0('0x2'));var rs=require(_0x38a0('0x3'));var fs=require('fs');var Redis=require(_0x38a0('0x4'));var db=require(_0x38a0('0x5'))['db'];var utils=require(_0x38a0('0x6'));var logger=require(_0x38a0('0x7'))(_0x38a0('0x8'));var config=require('../../config/environment');var jayson=require(_0x38a0('0x9'));var client=jayson['client'][_0x38a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b67c0,_0x3564d2,_0x10a4b2){return new BPromise(function(_0x540697,_0x49345d){return client['request'](_0x4b67c0,_0x10a4b2)['then'](function(_0x261b47){logger[_0x38a0('0xb')](_0x38a0('0xc'),_0x3564d2,_0x38a0('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3564d2,_0x38a0('0xd'),JSON['stringify'](_0x261b47));if(_0x261b47[_0x38a0('0xe')]){if(_0x261b47[_0x38a0('0xe')][_0x38a0('0xf')]===0x1f4){logger['error'](_0x38a0('0xc'),_0x3564d2,_0x261b47['error'][_0x38a0('0x10')]);return _0x49345d(_0x261b47[_0x38a0('0xe')][_0x38a0('0x10')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3564d2,_0x261b47[_0x38a0('0xe')][_0x38a0('0x10')]);return _0x540697(_0x261b47[_0x38a0('0xe')][_0x38a0('0x10')]);}else{logger['info'](_0x38a0('0xc'),_0x3564d2,_0x38a0('0xd'));_0x540697(_0x261b47[_0x38a0('0x11')][_0x38a0('0x10')]);}})[_0x38a0('0x12')](function(_0x1731e1){logger[_0x38a0('0xe')](_0x38a0('0xc'),_0x3564d2,_0x1731e1);_0x49345d(_0x1731e1);});});}exports[_0x38a0('0x13')]=function(_0x34a22f){var _0x2414cf=this;return new Promise(function(_0x7c7f9c,_0x530518){return db[_0x38a0('0x14')][_0x38a0('0x15')]({'raw':_0x34a22f[_0x38a0('0x16')]?_0x34a22f[_0x38a0('0x16')][_0x38a0('0x17')]===undefined?!![]:![]:!![],'where':_0x34a22f[_0x38a0('0x16')]?_0x34a22f[_0x38a0('0x16')]['where']||null:null,'attributes':_0x34a22f['options']?_0x34a22f['options'][_0x38a0('0x18')]||null:null,'limit':_0x34a22f[_0x38a0('0x16')]?_0x34a22f[_0x38a0('0x16')][_0x38a0('0x19')]||null:null,'include':_0x34a22f[_0x38a0('0x16')]?_0x34a22f[_0x38a0('0x16')][_0x38a0('0x1a')]?_[_0x38a0('0x1b')](_0x34a22f[_0x38a0('0x16')][_0x38a0('0x1a')],function(_0x33bc99){return{'model':db[_0x33bc99[_0x38a0('0x1c')]],'as':_0x33bc99['as'],'attributes':_0x33bc99[_0x38a0('0x18')],'include':_0x33bc99[_0x38a0('0x1a')]?_[_0x38a0('0x1b')](_0x33bc99[_0x38a0('0x1a')],function(_0x3424e4){return{'model':db[_0x3424e4['model']],'as':_0x3424e4['as'],'attributes':_0x3424e4[_0x38a0('0x18')],'include':_0x3424e4[_0x38a0('0x1a')]?_[_0x38a0('0x1b')](_0x3424e4[_0x38a0('0x1a')],function(_0x49d649){return{'model':db[_0x49d649[_0x38a0('0x1c')]],'as':_0x49d649['as'],'attributes':_0x49d649[_0x38a0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x38a0('0x1d')](function(_0x53131f){logger[_0x38a0('0xb')]('GetVoiceCallReport',_0x34a22f);logger[_0x38a0('0x1e')](_0x38a0('0x13'),_0x34a22f,JSON[_0x38a0('0x1f')](_0x53131f));_0x7c7f9c(_0x53131f);})[_0x38a0('0x12')](function(_0x12cc6f){logger[_0x38a0('0xe')](_0x38a0('0x13'),_0x12cc6f[_0x38a0('0x10')],_0x34a22f);_0x530518(_0x2414cf[_0x38a0('0xe')](0x1f4,_0x12cc6f['message']));});});};exports['CreateVoiceCallReport']=function(_0x5c3c4c){var _0x40d578=this;return new Promise(function(_0x589d19,_0x14c664){return db[_0x38a0('0x14')][_0x38a0('0x20')](_0x5c3c4c['body'],{'raw':_0x5c3c4c[_0x38a0('0x16')]?_0x5c3c4c[_0x38a0('0x16')][_0x38a0('0x17')]===undefined?!![]:![]:!![]})[_0x38a0('0x1d')](function(_0x5bf90a){logger[_0x38a0('0xb')](_0x38a0('0x21'),_0x5c3c4c);logger[_0x38a0('0x1e')](_0x38a0('0x21'),_0x5c3c4c,JSON[_0x38a0('0x1f')](_0x5bf90a));_0x589d19(_0x5bf90a);})[_0x38a0('0x12')](function(_0x1084b7){logger[_0x38a0('0xe')](_0x38a0('0x21'),_0x1084b7[_0x38a0('0x10')],_0x5c3c4c);_0x14c664(_0x40d578[_0x38a0('0xe')](0x1f4,_0x1084b7['message']));});});};exports[_0x38a0('0x22')]=function(_0x491ad4){var _0x35ec7d=this;return new Promise(function(_0x521092,_0x5c2ebe){return db[_0x38a0('0x14')][_0x38a0('0x23')](_0x491ad4[_0x38a0('0x24')],{'raw':_0x491ad4[_0x38a0('0x16')]?_0x491ad4[_0x38a0('0x16')][_0x38a0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x491ad4[_0x38a0('0x16')]?_0x491ad4[_0x38a0('0x16')][_0x38a0('0x25')]||null:null,'attributes':_0x491ad4[_0x38a0('0x16')]?_0x491ad4['options'][_0x38a0('0x18')]||null:null,'limit':_0x491ad4[_0x38a0('0x16')]?_0x491ad4['options'][_0x38a0('0x19')]||null:null})[_0x38a0('0x1d')](function(_0xe03fec){logger[_0x38a0('0xb')](_0x38a0('0x22'),_0x491ad4);logger[_0x38a0('0x1e')](_0x38a0('0x22'),_0x491ad4,JSON['stringify'](_0xe03fec));_0x521092(_0xe03fec);})[_0x38a0('0x12')](function(_0x8523f0){logger[_0x38a0('0xe')](_0x38a0('0x22'),_0x8523f0[_0x38a0('0x10')],_0x491ad4);_0x5c2ebe(_0x35ec7d[_0x38a0('0xe')](0x1f4,_0x8523f0[_0x38a0('0x10')]));});});}; \ No newline at end of file +var _0x145b=['message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','model','attributes','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x145b,0x173));var _0xb145=function(_0x3107d6,_0x41dbb5){_0x3107d6=_0x3107d6-0x0;var _0x1e5d78=_0x145b[_0x3107d6];return _0x1e5d78;};'use strict';var _=require(_0xb145('0x0'));var util=require(_0xb145('0x1'));var moment=require('moment');var BPromise=require(_0xb145('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb145('0x3'));var db=require(_0xb145('0x4'))['db'];var utils=require(_0xb145('0x5'));var logger=require(_0xb145('0x6'))(_0xb145('0x7'));var config=require(_0xb145('0x8'));var jayson=require(_0xb145('0x9'));var client=jayson[_0xb145('0xa')][_0xb145('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5542cf,_0xca40f8,_0x4df971){return new BPromise(function(_0xa9c581,_0x178686){return client['request'](_0x5542cf,_0x4df971)[_0xb145('0xc')](function(_0x541681){logger['info'](_0xb145('0xd'),_0xca40f8,_0xb145('0xe'));logger[_0xb145('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xca40f8,_0xb145('0xe'),JSON[_0xb145('0x10')](_0x541681));if(_0x541681['error']){if(_0x541681[_0xb145('0x11')][_0xb145('0x12')]===0x1f4){logger[_0xb145('0x11')](_0xb145('0xd'),_0xca40f8,_0x541681[_0xb145('0x11')][_0xb145('0x13')]);return _0x178686(_0x541681[_0xb145('0x11')]['message']);}logger[_0xb145('0x11')](_0xb145('0xd'),_0xca40f8,_0x541681[_0xb145('0x11')][_0xb145('0x13')]);return _0xa9c581(_0x541681[_0xb145('0x11')][_0xb145('0x13')]);}else{logger[_0xb145('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0xca40f8,_0xb145('0xe'));_0xa9c581(_0x541681[_0xb145('0x15')][_0xb145('0x13')]);}})[_0xb145('0x16')](function(_0x1ade6b){logger[_0xb145('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xca40f8,_0x1ade6b);_0x178686(_0x1ade6b);});});}exports[_0xb145('0x17')]=function(_0x1ffa97){var _0x5c1929=this;return new Promise(function(_0x1ace05,_0x5bc297){return db[_0xb145('0x18')][_0xb145('0x19')]({'raw':_0x1ffa97['options']?_0x1ffa97[_0xb145('0x1a')][_0xb145('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ffa97[_0xb145('0x1a')]?_0x1ffa97['options']['where']||null:null,'attributes':_0x1ffa97['options']?_0x1ffa97[_0xb145('0x1a')]['attributes']||null:null,'limit':_0x1ffa97[_0xb145('0x1a')]?_0x1ffa97['options'][_0xb145('0x1c')]||null:null,'include':_0x1ffa97[_0xb145('0x1a')]?_0x1ffa97['options'][_0xb145('0x1d')]?_[_0xb145('0x1e')](_0x1ffa97[_0xb145('0x1a')]['include'],function(_0x4ae139){return{'model':db[_0x4ae139[_0xb145('0x1f')]],'as':_0x4ae139['as'],'attributes':_0x4ae139[_0xb145('0x20')],'include':_0x4ae139[_0xb145('0x1d')]?_[_0xb145('0x1e')](_0x4ae139[_0xb145('0x1d')],function(_0x228461){return{'model':db[_0x228461[_0xb145('0x1f')]],'as':_0x228461['as'],'attributes':_0x228461[_0xb145('0x20')],'include':_0x228461[_0xb145('0x1d')]?_[_0xb145('0x1e')](_0x228461[_0xb145('0x1d')],function(_0x4663b1){return{'model':db[_0x4663b1['model']],'as':_0x4663b1['as'],'attributes':_0x4663b1[_0xb145('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1dde){logger[_0xb145('0x14')](_0xb145('0x17'),_0x1ffa97);logger[_0xb145('0xf')](_0xb145('0x17'),_0x1ffa97,JSON[_0xb145('0x10')](_0x3c1dde));_0x1ace05(_0x3c1dde);})[_0xb145('0x16')](function(_0x29ccc0){logger[_0xb145('0x11')](_0xb145('0x17'),_0x29ccc0['message'],_0x1ffa97);_0x5bc297(_0x5c1929[_0xb145('0x11')](0x1f4,_0x29ccc0[_0xb145('0x13')]));});});};exports[_0xb145('0x21')]=function(_0x430c82){var _0xe0f804=this;return new Promise(function(_0xc098d6,_0xd8e981){return db[_0xb145('0x18')][_0xb145('0x22')](_0x430c82[_0xb145('0x23')],{'raw':_0x430c82[_0xb145('0x1a')]?_0x430c82[_0xb145('0x1a')][_0xb145('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x243a21){logger[_0xb145('0x14')](_0xb145('0x21'),_0x430c82);logger[_0xb145('0xf')]('CreateVoiceCallReport',_0x430c82,JSON[_0xb145('0x10')](_0x243a21));_0xc098d6(_0x243a21);})[_0xb145('0x16')](function(_0xfea883){logger['error'](_0xb145('0x21'),_0xfea883[_0xb145('0x13')],_0x430c82);_0xd8e981(_0xe0f804[_0xb145('0x11')](0x1f4,_0xfea883[_0xb145('0x13')]));});});};exports[_0xb145('0x24')]=function(_0x503452){var _0x5b38fb=this;return new Promise(function(_0x757319,_0x597626){return db[_0xb145('0x18')][_0xb145('0x25')](_0x503452['body'],{'raw':_0x503452[_0xb145('0x1a')]?_0x503452[_0xb145('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503452[_0xb145('0x1a')]?_0x503452[_0xb145('0x1a')][_0xb145('0x26')]||null:null,'attributes':_0x503452[_0xb145('0x1a')]?_0x503452[_0xb145('0x1a')]['attributes']||null:null,'limit':_0x503452[_0xb145('0x1a')]?_0x503452['options'][_0xb145('0x1c')]||null:null})['then'](function(_0x1cd815){logger[_0xb145('0x14')](_0xb145('0x24'),_0x503452);logger[_0xb145('0xf')](_0xb145('0x24'),_0x503452,JSON[_0xb145('0x10')](_0x1cd815));_0x757319(_0x1cd815);})[_0xb145('0x16')](function(_0x526275){logger['error']('UpdateVoiceCallReport',_0x526275[_0xb145('0x13')],_0x503452);_0x597626(_0x5b38fb['error'](0x1f4,_0x526275[_0xb145('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 58baac1..e8bf7a1 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 _0x289c=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x411c91,_0x511781){var _0x19bcd7=function(_0x3afa42){while(--_0x3afa42){_0x411c91['push'](_0x411c91['shift']());}};_0x19bcd7(++_0x511781);}(_0x289c,0x1bd));var _0xc289=function(_0x49fb64,_0x24ebde){_0x49fb64=_0x49fb64-0x0;var _0x53873f=_0x289c[_0x49fb64];return _0x53873f;};'use strict';var multer=require(_0xc289('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc289('0x1'));var express=require(_0xc289('0x2'));var router=express[_0xc289('0x3')]();var fs_extra=require(_0xc289('0x4'));var auth=require(_0xc289('0x5'));var interaction=require(_0xc289('0x6'));var config=require(_0xc289('0x7'));var controller=require(_0xc289('0x8'));router[_0xc289('0x9')]('/',auth[_0xc289('0xa')](),controller[_0xc289('0xb')]);router[_0xc289('0x9')](_0xc289('0xc'),auth[_0xc289('0xa')](),controller[_0xc289('0xd')]);router[_0xc289('0xe')]('/',auth[_0xc289('0xa')](),controller[_0xc289('0xf')]);router[_0xc289('0x10')](_0xc289('0xc'),auth[_0xc289('0xa')](),controller['update']);router[_0xc289('0x11')](_0xc289('0xc'),auth['isAuthenticated'](),controller[_0xc289('0x12')]);module[_0xc289('0x13')]=router; \ No newline at end of file +var _0x2966=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x2966,0x187));var _0x6296=function(_0x1145a0,_0x20c24b){_0x1145a0=_0x1145a0-0x0;var _0x46bb64=_0x2966[_0x1145a0];return _0x46bb64;};'use strict';var multer=require(_0x6296('0x0'));var util=require(_0x6296('0x1'));var path=require(_0x6296('0x2'));var timeout=require(_0x6296('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6296('0x4'));var auth=require(_0x6296('0x5'));var interaction=require(_0x6296('0x6'));var config=require(_0x6296('0x7'));var controller=require(_0x6296('0x8'));router[_0x6296('0x9')]('/',auth[_0x6296('0xa')](),controller[_0x6296('0xb')]);router['get'](_0x6296('0xc'),auth['isAuthenticated'](),controller[_0x6296('0xd')]);router[_0x6296('0xe')]('/',auth[_0x6296('0xa')](),controller[_0x6296('0xf')]);router[_0x6296('0x10')]('/:id',auth[_0x6296('0xa')](),controller['update']);router[_0x6296('0x11')](_0x6296('0xc'),auth[_0x6296('0xa')](),controller[_0x6296('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2c2c1a6..6a6e3bc 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 _0x6320=['exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x8d148a,_0x1ec477){var _0x211d85=function(_0x1e84e3){while(--_0x1e84e3){_0x8d148a['push'](_0x8d148a['shift']());}};_0x211d85(++_0x1ec477);}(_0x6320,0x70));var _0x0632=function(_0x8b2cd2,_0x41a31a){_0x8b2cd2=_0x8b2cd2-0x0;var _0x58a579=_0x6320[_0x8b2cd2];return _0x58a579;};'use strict';var Sequelize=require('sequelize');module[_0x0632('0x0')]={'name':{'type':Sequelize[_0x0632('0x1')]},'prefix':{'type':Sequelize[_0x0632('0x1')],'unique':_0x0632('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x0632('0x1')],'set':function(_0xc45b5e){this['setDataValue'](_0x0632('0x3'),_0xc45b5e?_0xc45b5e[_0x0632('0x4')](''):[]);},'get':function(){return this[_0x0632('0x5')]('options')?this[_0x0632('0x5')]('options')[_0x0632('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0632('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0632('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0632('0x1')]},'description':{'type':Sequelize[_0x0632('0x1')]}}; \ No newline at end of file +var _0xdd2c=['BOOLEAN','sequelize','exports','STRING','options','join','getDataValue'];(function(_0x28f06a,_0x1eb4a8){var _0x4bd299=function(_0x45f96a){while(--_0x45f96a){_0x28f06a['push'](_0x28f06a['shift']());}};_0x4bd299(++_0x1eb4a8);}(_0xdd2c,0xa9));var _0xcdd2=function(_0x1dbecd,_0x55ad88){_0x1dbecd=_0x1dbecd-0x0;var _0x2b2109=_0xdd2c[_0x1dbecd];return _0x2b2109;};'use strict';var Sequelize=require(_0xcdd2('0x0'));module[_0xcdd2('0x1')]={'name':{'type':Sequelize[_0xcdd2('0x2')]},'prefix':{'type':Sequelize[_0xcdd2('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xcdd2('0x2')],'set':function(_0x3c0ee4){this['setDataValue'](_0xcdd2('0x3'),_0x3c0ee4?_0x3c0ee4[_0xcdd2('0x4')](''):[]);},'get':function(){return this[_0xcdd2('0x5')](_0xcdd2('0x3'))?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xcdd2('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xcdd2('0x2')]},'record':{'type':Sequelize[_0xcdd2('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 6f95ed6..bde90b9 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 _0xb4e6=['findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xb4e6[_0x4b6778];return _0x22dbb9;};'use strict';var emlformat=require(_0x6b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4e('0x1'));var jsonpatch=require(_0x6b4e('0x2'));var rp=require(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var Mustache=require(_0x6b4e('0x6'));var util=require(_0x6b4e('0x7'));var path=require('path');var sox=require(_0x6b4e('0x8'));var csv=require(_0x6b4e('0x9'));var ejs=require(_0x6b4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];function respondWithStatusCode(_0x432399,_0x2b2ce0){_0x2b2ce0=_0x2b2ce0||0xcc;return function(_0x9f8f6c){if(_0x9f8f6c){return _0x432399[_0x6b4e('0x18')](_0x2b2ce0);}return _0x432399[_0x6b4e('0x19')](_0x2b2ce0)['end']();};}function respondWithResult(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xc8;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x19')](_0x29bdee)['json'](_0x4788cf);}};}function respondWithFilteredResult(_0x355f10,_0x2195c1){return function(_0x3ba513){if(_0x3ba513){var _0x42e265=typeof _0x2195c1[_0x6b4e('0x1a')]===_0x6b4e('0x1b')&&typeof _0x2195c1['limit']==='undefined';var _0x67496d=_0x3ba513[_0x6b4e('0x1c')];var _0x10d2b1=_0x42e265?0x0:_0x2195c1[_0x6b4e('0x1a')];var _0x101d0a=_0x42e265?_0x3ba513[_0x6b4e('0x1c')]:_0x2195c1[_0x6b4e('0x1a')]+_0x2195c1[_0x6b4e('0x1d')];var _0x35aee1;if(_0x101d0a>=_0x67496d){_0x101d0a=_0x67496d;_0x35aee1=0xc8;}else{_0x35aee1=0xce;}_0x355f10[_0x6b4e('0x19')](_0x35aee1);return _0x355f10[_0x6b4e('0x1e')]('Content-Range',_0x10d2b1+'-'+_0x101d0a+'/'+_0x67496d)[_0x6b4e('0x1f')](_0x3ba513);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x20')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x21')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x22')](_0x2503a5)[_0x6b4e('0x23')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x23')](function(){var _0x884b7e=_0x2e36db[_0x6b4e('0x24')]({'plain':!![]});var _0xdba4fe='ChanSpies';return db[_0x6b4e('0x25')][_0x6b4e('0x26')]({'where':{'type':_0xdba4fe,'resourceId':_0x884b7e['id']}})['then'](function(){return _0x2e36db;});})[_0x6b4e('0x23')](function(){_0x3e636f[_0x6b4e('0x19')](0xcc)[_0x6b4e('0x27')]();});}};}function handleEntityNotFound(_0x44b399,_0x5bfe9e){return function(_0x2d42be){if(!_0x2d42be){_0x44b399[_0x6b4e('0x18')](0x194);}return _0x2d42be;};}function handleError(_0x57650d,_0x130c21){_0x130c21=_0x130c21||0x1f4;return function(_0x453beb){logger[_0x6b4e('0x28')](_0x453beb[_0x6b4e('0x29')]);if(_0x453beb['name']){delete _0x453beb[_0x6b4e('0x2a')];}_0x57650d[_0x6b4e('0x19')](_0x130c21)['send'](_0x453beb);};}exports[_0x6b4e('0x2b')]=function(_0x3f9868,_0x37b636){var _0x53c242={},_0x5c2200={},_0x11156e={'count':0x0,'rows':[]};var _0x2e6414=_[_0x6b4e('0x2c')](db['VoiceChanSpy'][_0x6b4e('0x2d')],function(_0x421177){return{'name':_0x421177[_0x6b4e('0x2e')],'type':_0x421177['type']['key']};});_0x5c2200[_0x6b4e('0x2f')]=_['map'](_0x2e6414,_0x6b4e('0x2a'));_0x5c2200[_0x6b4e('0x30')]=_['keys'](_0x3f9868[_0x6b4e('0x30')]);_0x5c2200[_0x6b4e('0x31')]=_[_0x6b4e('0x32')](_0x5c2200[_0x6b4e('0x2f')],_0x5c2200['query']);_0x53c242['attributes']=_[_0x6b4e('0x32')](_0x5c2200[_0x6b4e('0x2f')],qs[_0x6b4e('0x33')](_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x33')]));_0x53c242[_0x6b4e('0x34')]=_0x53c242[_0x6b4e('0x34')][_0x6b4e('0x35')]?_0x53c242[_0x6b4e('0x34')]:_0x5c2200[_0x6b4e('0x2f')];if(!_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x36')](_0x6b4e('0x37'))){_0x53c242['limit']=qs[_0x6b4e('0x1d')](_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x1d')]);_0x53c242['offset']=qs[_0x6b4e('0x1a')](_0x3f9868['query'][_0x6b4e('0x1a')]);}_0x53c242[_0x6b4e('0x38')]=qs[_0x6b4e('0x39')](_0x3f9868['query']['sort']);_0x53c242[_0x6b4e('0x3a')]=qs[_0x6b4e('0x31')](_['pick'](_0x3f9868['query'],_0x5c2200[_0x6b4e('0x31')]),_0x2e6414);if(_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x3b')]){_0x53c242[_0x6b4e('0x3a')]=_[_0x6b4e('0x3c')](_0x53c242[_0x6b4e('0x3a')],{'$or':_[_0x6b4e('0x2c')](_0x2e6414,function(_0xc3f4e4){if(_0xc3f4e4[_0x6b4e('0x3d')]!==_0x6b4e('0x3e')){var _0x1f2c38={};_0x1f2c38[_0xc3f4e4['name']]={'$like':'%'+_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x3b')]+'%'};return _0x1f2c38;}})});}_0x53c242=_['merge']({},_0x53c242,_0x3f9868[_0x6b4e('0x3f')]);var _0x29353b={'where':_0x53c242[_0x6b4e('0x3a')]};return db[_0x6b4e('0x40')][_0x6b4e('0x1c')](_0x29353b)['then'](function(_0x4e545c){_0x11156e[_0x6b4e('0x1c')]=_0x4e545c;if(_0x3f9868['query'][_0x6b4e('0x41')]){_0x53c242[_0x6b4e('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x6b4e('0x43')](_0x53c242);})['then'](function(_0x3dec0f){_0x11156e['rows']=_0x3dec0f;return _0x11156e;})[_0x6b4e('0x23')](respondWithFilteredResult(_0x37b636,_0x53c242))[_0x6b4e('0x44')](handleError(_0x37b636,null));};exports[_0x6b4e('0x45')]=function(_0x30401b,_0x555be1){var _0x17185e={'raw':![],'where':{'id':_0x30401b[_0x6b4e('0x46')]['id']}},_0x244a9f={};_0x244a9f['model']=_[_0x6b4e('0x47')](db[_0x6b4e('0x40')][_0x6b4e('0x2d')]);_0x244a9f[_0x6b4e('0x30')]=_[_0x6b4e('0x47')](_0x30401b[_0x6b4e('0x30')]);_0x244a9f[_0x6b4e('0x31')]=_[_0x6b4e('0x32')](_0x244a9f[_0x6b4e('0x2f')],_0x244a9f['query']);_0x17185e[_0x6b4e('0x34')]=_[_0x6b4e('0x32')](_0x244a9f[_0x6b4e('0x2f')],qs[_0x6b4e('0x33')](_0x30401b[_0x6b4e('0x30')]['fields']));_0x17185e[_0x6b4e('0x34')]=_0x17185e['attributes'][_0x6b4e('0x35')]?_0x17185e[_0x6b4e('0x34')]:_0x244a9f[_0x6b4e('0x2f')];if(_0x30401b[_0x6b4e('0x30')]['includeAll']){_0x17185e[_0x6b4e('0x42')]=[{'all':!![]}];}_0x17185e=_[_0x6b4e('0x3c')]({},_0x17185e,_0x30401b[_0x6b4e('0x3f')]);return db['VoiceChanSpy'][_0x6b4e('0x48')](_0x17185e)[_0x6b4e('0x23')](handleEntityNotFound(_0x555be1,null))[_0x6b4e('0x23')](respondWithResult(_0x555be1,null))[_0x6b4e('0x44')](handleError(_0x555be1,null));};exports[_0x6b4e('0x49')]=function(_0x33c797,_0x289dfa){return db[_0x6b4e('0x40')][_0x6b4e('0x49')](_0x33c797[_0x6b4e('0x4a')],{})['then'](function(_0x2106fb){var _0x1527f1=_0x33c797[_0x6b4e('0x4b')]['get']({'plain':!![]});if(!_0x1527f1)throw new Error(_0x6b4e('0x4c'));if(_0x1527f1[_0x6b4e('0x4d')]===_0x6b4e('0x4b')){var _0x738ee5=_0x2106fb[_0x6b4e('0x24')]({'plain':!![]});var _0x104c2a=_0x6b4e('0x4e');return db[_0x6b4e('0x4f')][_0x6b4e('0x48')]({'where':{'name':_0x104c2a,'userProfileId':_0x1527f1[_0x6b4e('0x50')]},'raw':!![]})[_0x6b4e('0x23')](function(_0x49f81a){if(_0x49f81a&&_0x49f81a['autoAssociation']===0x0){return db[_0x6b4e('0x25')][_0x6b4e('0x49')]({'name':_0x738ee5[_0x6b4e('0x2a')],'resourceId':_0x738ee5['id'],'type':_0x49f81a[_0x6b4e('0x2a')],'sectionId':_0x49f81a['id']},{})['then'](function(){return _0x2106fb;});}else{return _0x2106fb;}})[_0x6b4e('0x44')](function(_0x31071f){logger[_0x6b4e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31071f);throw _0x31071f;});}return _0x2106fb;})[_0x6b4e('0x23')](respondWithResult(_0x289dfa,0xc9))[_0x6b4e('0x44')](handleError(_0x289dfa,null));};exports[_0x6b4e('0x22')]=function(_0x282c4d,_0x3ce7b8){if(_0x282c4d['body']['id']){delete _0x282c4d[_0x6b4e('0x4a')]['id'];}return db['VoiceChanSpy'][_0x6b4e('0x48')]({'where':{'id':_0x282c4d[_0x6b4e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ce7b8,null))[_0x6b4e('0x23')](saveUpdates(_0x282c4d['body'],null))[_0x6b4e('0x23')](respondWithResult(_0x3ce7b8,null))[_0x6b4e('0x44')](handleError(_0x3ce7b8,null));};exports[_0x6b4e('0x26')]=function(_0x3bd916,_0x11b868){return db['VoiceChanSpy'][_0x6b4e('0x48')]({'where':{'id':_0x3bd916[_0x6b4e('0x46')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x11b868,null))['then'](removeEntity(_0x11b868,null))['catch'](handleError(_0x11b868,null));}; \ No newline at end of file +var _0xf290=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','ChanSpies','UserProfileResource','error','stack','name','send','map','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0xfb7020,_0x2797ff){var _0xd400ba=function(_0x12be15){while(--_0x12be15){_0xfb7020['push'](_0xfb7020['shift']());}};_0xd400ba(++_0x2797ff);}(_0xf290,0xde));var _0x0f29=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xf290[_0x5a2d3f];return _0x5c65d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){var _0x5a440f=_0x29ca73[_0x0f29('0x25')]({'plain':!![]});var _0x26f46f=_0x0f29('0x26');return db[_0x0f29('0x27')]['destroy']({'where':{'type':_0x26f46f,'resourceId':_0x5a440f['id']}})[_0x0f29('0x24')](function(){return _0x29ca73;});})['then'](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x5c0202,_0x5bfcac){return function(_0x57dcc7){if(!_0x57dcc7){_0x5c0202['sendStatus'](0x194);}return _0x57dcc7;};}function handleError(_0x3c6ce9,_0x1f4ad2){_0x1f4ad2=_0x1f4ad2||0x1f4;return function(_0x4cc5a0){logger[_0x0f29('0x28')](_0x4cc5a0[_0x0f29('0x29')]);if(_0x4cc5a0[_0x0f29('0x2a')]){delete _0x4cc5a0['name'];}_0x3c6ce9['status'](_0x1f4ad2)[_0x0f29('0x2b')](_0x4cc5a0);};}exports['index']=function(_0x36b65c,_0x561c31){var _0x526364={},_0x7b10f={},_0x409b19={'count':0x0,'rows':[]};var _0xf59431=_[_0x0f29('0x2c')](db['VoiceChanSpy']['rawAttributes'],function(_0x3bb3c8){return{'name':_0x3bb3c8['fieldName'],'type':_0x3bb3c8['type'][_0x0f29('0x2d')]};});_0x7b10f['model']=_[_0x0f29('0x2c')](_0xf59431,'name');_0x7b10f['query']=_[_0x0f29('0x2e')](_0x36b65c[_0x0f29('0x2f')]);_0x7b10f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x7b10f[_0x0f29('0x32')],_0x7b10f['query']);_0x526364[_0x0f29('0x33')]=_['intersection'](_0x7b10f[_0x0f29('0x32')],qs[_0x0f29('0x34')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x34')]));_0x526364['attributes']=_0x526364[_0x0f29('0x33')][_0x0f29('0x35')]?_0x526364['attributes']:_0x7b10f[_0x0f29('0x32')];if(!_0x36b65c[_0x0f29('0x2f')]['hasOwnProperty']('nolimit')){_0x526364[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x526364[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x36b65c['query'][_0x0f29('0x1d')]);}_0x526364['order']=qs[_0x0f29('0x36')](_0x36b65c['query'][_0x0f29('0x36')]);_0x526364[_0x0f29('0x37')]=qs[_0x0f29('0x30')](_['pick'](_0x36b65c['query'],_0x7b10f[_0x0f29('0x30')]),_0xf59431);if(_0x36b65c['query'][_0x0f29('0x38')]){_0x526364[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x526364[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0xf59431,function(_0x5afbb8){if(_0x5afbb8[_0x0f29('0x3a')]!==_0x0f29('0x3b')){var _0x42872b={};_0x42872b[_0x5afbb8[_0x0f29('0x2a')]]={'$like':'%'+_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x42872b;}})});}_0x526364=_[_0x0f29('0x39')]({},_0x526364,_0x36b65c[_0x0f29('0x3c')]);var _0x250b20={'where':_0x526364['where']};return db[_0x0f29('0x3d')][_0x0f29('0x20')](_0x250b20)[_0x0f29('0x24')](function(_0x11b1dc){_0x409b19['count']=_0x11b1dc;if(_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x526364[_0x0f29('0x3f')]=[{'all':!![]}];}return db[_0x0f29('0x3d')][_0x0f29('0x40')](_0x526364);})['then'](function(_0x410c59){_0x409b19[_0x0f29('0x41')]=_0x410c59;return _0x409b19;})[_0x0f29('0x24')](respondWithFilteredResult(_0x561c31,_0x526364))['catch'](handleError(_0x561c31,null));};exports[_0x0f29('0x42')]=function(_0x284279,_0x3a6479){var _0x338412={'raw':![],'where':{'id':_0x284279[_0x0f29('0x43')]['id']}},_0x35f753={};_0x35f753[_0x0f29('0x32')]=_[_0x0f29('0x2e')](db['VoiceChanSpy']['rawAttributes']);_0x35f753['query']=_[_0x0f29('0x2e')](_0x284279[_0x0f29('0x2f')]);_0x35f753[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x35f753[_0x0f29('0x32')],_0x35f753[_0x0f29('0x2f')]);_0x338412['attributes']=_[_0x0f29('0x31')](_0x35f753['model'],qs[_0x0f29('0x34')](_0x284279['query'][_0x0f29('0x34')]));_0x338412[_0x0f29('0x33')]=_0x338412[_0x0f29('0x33')][_0x0f29('0x35')]?_0x338412[_0x0f29('0x33')]:_0x35f753['model'];if(_0x284279[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x338412[_0x0f29('0x3f')]=[{'all':!![]}];}_0x338412=_['merge']({},_0x338412,_0x284279[_0x0f29('0x3c')]);return db['VoiceChanSpy']['find'](_0x338412)[_0x0f29('0x24')](handleEntityNotFound(_0x3a6479,null))[_0x0f29('0x24')](respondWithResult(_0x3a6479,null))[_0x0f29('0x44')](handleError(_0x3a6479,null));};exports[_0x0f29('0x45')]=function(_0x20aa53,_0x335435){return db['VoiceChanSpy'][_0x0f29('0x45')](_0x20aa53[_0x0f29('0x46')],{})[_0x0f29('0x24')](function(_0x857564){var _0x2455d2=_0x20aa53[_0x0f29('0x47')][_0x0f29('0x25')]({'plain':!![]});if(!_0x2455d2)throw new Error(_0x0f29('0x48'));if(_0x2455d2[_0x0f29('0x49')]===_0x0f29('0x47')){var _0x5cd4a9=_0x857564['get']({'plain':!![]});var _0xa6231e=_0x0f29('0x26');return db[_0x0f29('0x4a')][_0x0f29('0x4b')]({'where':{'name':_0xa6231e,'userProfileId':_0x2455d2['userProfileId']},'raw':!![]})[_0x0f29('0x24')](function(_0xd624ad){if(_0xd624ad&&_0xd624ad[_0x0f29('0x4c')]===0x0){return db[_0x0f29('0x27')][_0x0f29('0x45')]({'name':_0x5cd4a9[_0x0f29('0x2a')],'resourceId':_0x5cd4a9['id'],'type':_0xd624ad[_0x0f29('0x2a')],'sectionId':_0xd624ad['id']},{})['then'](function(){return _0x857564;});}else{return _0x857564;}})[_0x0f29('0x44')](function(_0x6c1800){logger[_0x0f29('0x28')](_0x0f29('0x4d'),_0x6c1800);throw _0x6c1800;});}return _0x857564;})[_0x0f29('0x24')](respondWithResult(_0x335435,0xc9))[_0x0f29('0x44')](handleError(_0x335435,null));};exports['update']=function(_0x8c9780,_0x45d87c){if(_0x8c9780[_0x0f29('0x46')]['id']){delete _0x8c9780['body']['id'];}return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x8c9780[_0x0f29('0x43')]['id']}})['then'](handleEntityNotFound(_0x45d87c,null))[_0x0f29('0x24')](saveUpdates(_0x8c9780[_0x0f29('0x46')],null))['then'](respondWithResult(_0x45d87c,null))[_0x0f29('0x44')](handleError(_0x45d87c,null));};exports[_0x0f29('0x4e')]=function(_0x4ae30,_0x4a2c08){return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x4ae30[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x4a2c08,null))['then'](removeEntity(_0x4a2c08,null))[_0x0f29('0x44')](handleError(_0x4a2c08,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 60c6c10..1e897b2 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 _0xac1a=['merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','push','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system'];(function(_0x16ebbf,_0x1af6c5){var _0x1502bf=function(_0x174ab2){while(--_0x174ab2){_0x16ebbf['push'](_0x16ebbf['shift']());}};_0x1502bf(++_0x1af6c5);}(_0xac1a,0x1d8));var _0xaac1=function(_0x351e8e,_0x2fe0af){_0x351e8e=_0x351e8e-0x0;var _0x641a43=_0xac1a[_0x351e8e];return _0x641a43;};'use strict';var _=require(_0xaac1('0x0'));var util=require(_0xaac1('0x1'));var BPromise=require(_0xaac1('0x2'));var attributes=require(_0xaac1('0x3'));var getUserApplications=function(_0x33a1a8,_0x6027fe,_0x506e76){var _0x121247=0x1;var _0x36ecff=[];var _0x1c71e3={'context':_0x6027fe[_0xaac1('0x4')]||_0xaac1('0x5'),'exten':util[_0xaac1('0x6')](_0xaac1('0x7'),_0x33a1a8['prefix'],_0x506e76),'type':_0xaac1('0x8'),'isApp':![],'ChanSpyId':_0x33a1a8['id'],'UserId':_0x6027fe['id']};_0x36ecff['push'](_[_0xaac1('0x9')]({'app':_0xaac1('0xa'),'appdata':util[_0xaac1('0x6')](_0xaac1('0xb'),_0xaac1('0xc')),'priority':_0x121247++},_0x1c71e3));if(_0x33a1a8[_0xaac1('0xd')]){_0x36ecff['push'](_['merge']({'app':_0xaac1('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x33a1a8[_0xaac1('0xf')]),'priority':_0x121247++},_0x1c71e3));}if(_0x33a1a8[_0xaac1('0x10')]){_0x36ecff[_0xaac1('0x11')](_[_0xaac1('0x9')]({'app':'Authenticate','appdata':_0x33a1a8['password'],'priority':_0x121247++},_0x1c71e3));}_0x36ecff['push'](_['merge']({'app':'ChanSpy','appdata':util[_0xaac1('0x6')](_0xaac1('0x12'),_0x6027fe['name'],_0x33a1a8['options']?_0x33a1a8[_0xaac1('0x13')][_0xaac1('0x14')](''):''),'priority':_0x121247++},_0x1c71e3));if(_0x33a1a8[_0xaac1('0xd')]){_0x36ecff[_0xaac1('0x11')](_[_0xaac1('0x9')]({'app':_0xaac1('0x15'),'priority':_0x121247++},_0x1c71e3));}return _0x36ecff;};var getChanSpyApplications=function(_0x324858,_0x179a5d){var _0x2b9965=[];for(var _0x5eceb2=0x0,_0x3709c5=0x1;_0x5eceb2<_0x179a5d[_0xaac1('0x16')];_0x5eceb2++,_0x3709c5=0x1){_0x2b9965=_0x2b9965[_0xaac1('0x17')](getUserApplications(_0x324858,_0x179a5d[_0x5eceb2],_0x179a5d[_0x5eceb2][_0xaac1('0x18')]));if(_0x179a5d[_0x5eceb2][_0xaac1('0x18')]!=_0x179a5d[_0x5eceb2][_0xaac1('0x19')]){_0x2b9965=_0x2b9965['concat'](getUserApplications(_0x324858,_0x179a5d[_0x5eceb2],_0x179a5d[_0x5eceb2]['name']));}}return _0x2b9965;};var getChanSpyPromise=function(_0x440dda,_0x212af6){return new BPromise(function(_0x222a8a,_0x42c95a){return _0x440dda[_0xaac1('0x1a')][_0xaac1('0x1b')]({'attributes':['id',_0xaac1('0x19'),_0xaac1('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x4721b8){if(_0x4721b8){return _0x222a8a(getChanSpyApplications(_0x212af6,_0x4721b8));}return _0x222a8a([]);})[_0xaac1('0x1c')](function(_0x1f623b){_0x42c95a(_0x1f623b);});});};module['exports']=function(_0x201482,_0x3bd77f){var _0x5e34e2=_0x201482[_0xaac1('0x1d')];return _0x201482[_0xaac1('0x1e')](_0xaac1('0x1f'),attributes,{'tableName':_0xaac1('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x833f16,_0x123783,_0x457da4){return getChanSpyPromise(_0x5e34e2,_0x833f16)[_0xaac1('0x21')](function(_0x27e46d){if(_0x27e46d&&_0x27e46d[_0xaac1('0x16')]){return _0x5e34e2[_0xaac1('0x22')][_0xaac1('0x23')](_0x27e46d);}})[_0xaac1('0x21')](function(){_0x457da4();})[_0xaac1('0x1c')](function(_0x2e7a75){_0x457da4(_0x2e7a75);});},'afterUpdate':function(_0x4740dc,_0x1ed54e,_0x567d6a){return _0x5e34e2[_0xaac1('0x22')][_0xaac1('0x24')]({'where':{'ChanSpyId':_0x4740dc['id']}})[_0xaac1('0x21')](function(){return getChanSpyPromise(_0x5e34e2,_0x4740dc);})[_0xaac1('0x21')](function(_0x3cd070){if(_0x3cd070&&_0x3cd070[_0xaac1('0x16')]){return _0x5e34e2[_0xaac1('0x22')][_0xaac1('0x23')](_0x3cd070);}})[_0xaac1('0x21')](function(){_0x567d6a();})[_0xaac1('0x1c')](function(_0x209a8b){_0x567d6a(_0x209a8b);});},'afterDestroy':function(_0x287edd,_0x50dbaf,_0x17f126){return _0x5e34e2[_0xaac1('0x22')][_0xaac1('0x24')]({'where':{'ChanSpyId':_0x287edd['id']}})[_0xaac1('0x21')](function(){_0x17f126();})['catch'](function(_0x39e7a4){_0x17f126(_0x39e7a4);});}}});}; \ No newline at end of file +var _0x7a54=['lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','options','join','StopMixMonitor','length','concat','name','User','internal','agent','then','catch','models','VoiceChanSpy','VoiceExtension','destroy','bulkCreate'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0xfc));var _0x47a5=function(_0x498309,_0x192119){_0x498309=_0x498309-0x0;var _0x201261=_0x7a54[_0x498309];return _0x201261;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var BPromise=require('bluebird');var attributes=require(_0x47a5('0x2'));var getUserApplications=function(_0x1be83c,_0x398c4f,_0x22871c){var _0x40e5f6=0x1;var _0x455ff5=[];var _0x4602d5={'context':_0x398c4f[_0x47a5('0x3')]||_0x47a5('0x4'),'exten':util[_0x47a5('0x5')](_0x47a5('0x6'),_0x1be83c['prefix'],_0x22871c),'type':_0x47a5('0x7'),'isApp':![],'ChanSpyId':_0x1be83c['id'],'UserId':_0x398c4f['id']};_0x455ff5[_0x47a5('0x8')](_[_0x47a5('0x9')]({'app':_0x47a5('0xa'),'appdata':util[_0x47a5('0x5')](_0x47a5('0xb'),_0x47a5('0xc')),'priority':_0x40e5f6++},_0x4602d5));if(_0x1be83c[_0x47a5('0xd')]){_0x455ff5[_0x47a5('0x8')](_[_0x47a5('0x9')]({'app':_0x47a5('0xe'),'appdata':util['format'](_0x47a5('0xf'),_0x1be83c[_0x47a5('0x10')]),'priority':_0x40e5f6++},_0x4602d5));}if(_0x1be83c[_0x47a5('0x11')]){_0x455ff5['push'](_[_0x47a5('0x9')]({'app':_0x47a5('0x12'),'appdata':_0x1be83c['password'],'priority':_0x40e5f6++},_0x4602d5));}_0x455ff5['push'](_['merge']({'app':_0x47a5('0x13'),'appdata':util[_0x47a5('0x5')]('SIP/%s,%s',_0x398c4f['name'],_0x1be83c[_0x47a5('0x14')]?_0x1be83c[_0x47a5('0x14')][_0x47a5('0x15')](''):''),'priority':_0x40e5f6++},_0x4602d5));if(_0x1be83c[_0x47a5('0xd')]){_0x455ff5[_0x47a5('0x8')](_[_0x47a5('0x9')]({'app':_0x47a5('0x16'),'priority':_0x40e5f6++},_0x4602d5));}return _0x455ff5;};var getChanSpyApplications=function(_0x53734b,_0x3bdcdd){var _0x21aecd=[];for(var _0xddf81c=0x0,_0x447573=0x1;_0xddf81c<_0x3bdcdd[_0x47a5('0x17')];_0xddf81c++,_0x447573=0x1){_0x21aecd=_0x21aecd[_0x47a5('0x18')](getUserApplications(_0x53734b,_0x3bdcdd[_0xddf81c],_0x3bdcdd[_0xddf81c]['internal']));if(_0x3bdcdd[_0xddf81c]['internal']!=_0x3bdcdd[_0xddf81c][_0x47a5('0x19')]){_0x21aecd=_0x21aecd[_0x47a5('0x18')](getUserApplications(_0x53734b,_0x3bdcdd[_0xddf81c],_0x3bdcdd[_0xddf81c][_0x47a5('0x19')]));}}return _0x21aecd;};var getChanSpyPromise=function(_0x29542c,_0x343f19){return new BPromise(function(_0x542274,_0x21edd9){return _0x29542c[_0x47a5('0x1a')]['findAll']({'attributes':['id',_0x47a5('0x19'),_0x47a5('0x1b')],'where':{'role':_0x47a5('0x1c'),'chanspy':!![]},'raw':!![]})[_0x47a5('0x1d')](function(_0x41cb62){if(_0x41cb62){return _0x542274(getChanSpyApplications(_0x343f19,_0x41cb62));}return _0x542274([]);})[_0x47a5('0x1e')](function(_0x531047){_0x21edd9(_0x531047);});});};module['exports']=function(_0x2ee934,_0x44c048){var _0x3156db=_0x2ee934[_0x47a5('0x1f')];return _0x2ee934['define'](_0x47a5('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x689b2a,_0x345552,_0x29915b){return getChanSpyPromise(_0x3156db,_0x689b2a)[_0x47a5('0x1d')](function(_0xe5b0f5){if(_0xe5b0f5&&_0xe5b0f5[_0x47a5('0x17')]){return _0x3156db['VoiceExtension']['bulkCreate'](_0xe5b0f5);}})[_0x47a5('0x1d')](function(){_0x29915b();})[_0x47a5('0x1e')](function(_0x185407){_0x29915b(_0x185407);});},'afterUpdate':function(_0x113f9a,_0x44a99f,_0x3a6907){return _0x3156db[_0x47a5('0x21')][_0x47a5('0x22')]({'where':{'ChanSpyId':_0x113f9a['id']}})[_0x47a5('0x1d')](function(){return getChanSpyPromise(_0x3156db,_0x113f9a);})[_0x47a5('0x1d')](function(_0x250eeb){if(_0x250eeb&&_0x250eeb['length']){return _0x3156db[_0x47a5('0x21')][_0x47a5('0x23')](_0x250eeb);}})[_0x47a5('0x1d')](function(){_0x3a6907();})[_0x47a5('0x1e')](function(_0x125fd3){_0x3a6907(_0x125fd3);});},'afterDestroy':function(_0x539c85,_0x316fe1,_0x29fe90){return _0x3156db[_0x47a5('0x21')]['destroy']({'where':{'ChanSpyId':_0x539c85['id']}})[_0x47a5('0x1d')](function(){_0x29fe90();})['catch'](function(_0x8b900b){_0x29fe90(_0x8b900b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d45d2f0..ca41d1d 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 _0x2504=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5b85c5,_0x3b198e){var _0xc5b69f=function(_0x38d92a){while(--_0x38d92a){_0x5b85c5['push'](_0x5b85c5['shift']());}};_0xc5b69f(++_0x3b198e);}(_0x2504,0xee));var _0x4250=function(_0x5896bd,_0x415599){_0x5896bd=_0x5896bd-0x0;var _0x141458=_0x2504[_0x5896bd];return _0x141458;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e177e,_0x5a5286,_0x370998){return new BPromise(function(_0x477312,_0x1a3b57){return client[_0x4250('0xd')](_0x4e177e,_0x370998)[_0x4250('0xe')](function(_0x51ea6f){logger[_0x4250('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'),JSON['stringify'](_0x51ea6f));if(_0x51ea6f['error']){if(_0x51ea6f[_0x4250('0x12')][_0x4250('0x13')]===0x1f4){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')]['message']);return _0x1a3b57(_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);}logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x51ea6f[_0x4250('0x12')][_0x4250('0x15')]);return _0x477312(_0x51ea6f['error'][_0x4250('0x15')]);}else{logger[_0x4250('0xf')](_0x4250('0x14'),_0x5a5286,_0x4250('0x10'));_0x477312(_0x51ea6f[_0x4250('0x16')][_0x4250('0x15')]);}})[_0x4250('0x17')](function(_0x4e70fc){logger[_0x4250('0x12')](_0x4250('0x14'),_0x5a5286,_0x4e70fc);_0x1a3b57(_0x4e70fc);});});} \ No newline at end of file +var _0xac4a=['VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xac4a,0x13f));var _0xaac4=function(_0x48e672,_0x1757bf){_0x48e672=_0x48e672-0x0;var _0x1b34db=_0xac4a[_0x48e672];return _0x1b34db;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d20577a..ca5cdaf 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 _0xc9ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path'];(function(_0x39c4ea,_0x1bb06b){var _0x45866a=function(_0x195437){while(--_0x195437){_0x39c4ea['push'](_0x39c4ea['shift']());}};_0x45866a(++_0x1bb06b);}(_0xc9ec,0x116));var _0xcc9e=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0xc9ec[_0x4ca6a4];return _0x120555;};'use strict';var multer=require('multer');var util=require(_0xcc9e('0x0'));var path=require(_0xcc9e('0x1'));var timeout=require(_0xcc9e('0x2'));var express=require(_0xcc9e('0x3'));var router=express[_0xcc9e('0x4')]();var fs_extra=require(_0xcc9e('0x5'));var auth=require(_0xcc9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc9e('0x7'));var controller=require(_0xcc9e('0x8'));router[_0xcc9e('0x9')]('/',auth[_0xcc9e('0xa')](),controller[_0xcc9e('0xb')]);router[_0xcc9e('0x9')](_0xcc9e('0xc'),auth[_0xcc9e('0xa')](),controller[_0xcc9e('0xd')]);router[_0xcc9e('0xe')]('/',auth[_0xcc9e('0xa')](),controller[_0xcc9e('0xf')]);router['put'](_0xcc9e('0xc'),auth['isAuthenticated'](),controller[_0xcc9e('0x10')]);router[_0xcc9e('0x11')]('/:id',auth[_0xcc9e('0xa')](),controller[_0xcc9e('0x12')]);module[_0xcc9e('0x13')]=router; \ No newline at end of file +var _0x81bf=['/:id','isAuthenticated','show','post','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x2e00b6,_0x50d63b){var _0x2f7fa7=function(_0x46bc3a){while(--_0x46bc3a){_0x2e00b6['push'](_0x2e00b6['shift']());}};_0x2f7fa7(++_0x50d63b);}(_0x81bf,0xf8));var _0xf81b=function(_0x37010a,_0x4f0a8a){_0x37010a=_0x37010a-0x0;var _0x121956=_0x81bf[_0x37010a];return _0x121956;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf81b('0x0'));var express=require(_0xf81b('0x1'));var router=express[_0xf81b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf81b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf81b('0x4'));var controller=require('./voiceContext.controller');router[_0xf81b('0x5')]('/',auth['isAuthenticated'](),controller[_0xf81b('0x6')]);router[_0xf81b('0x5')](_0xf81b('0x7'),auth[_0xf81b('0x8')](),controller[_0xf81b('0x9')]);router[_0xf81b('0xa')]('/',auth[_0xf81b('0x8')](),controller['create']);router[_0xf81b('0xb')](_0xf81b('0x7'),auth[_0xf81b('0x8')](),controller[_0xf81b('0xc')]);router['delete'](_0xf81b('0x7'),auth['isAuthenticated'](),controller[_0xf81b('0xd')]);module[_0xf81b('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 86a70d9..a979cc9 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 _0xb79c=['BOOLEAN','exports','STRING','name'];(function(_0x46afc8,_0x833bc1){var _0x1dc057=function(_0x3109e7){while(--_0x3109e7){_0x46afc8['push'](_0x46afc8['shift']());}};_0x1dc057(++_0x833bc1);}(_0xb79c,0xd9));var _0xcb79=function(_0x12ca93,_0x3ba2ed){_0x12ca93=_0x12ca93-0x0;var _0x183f7b=_0xb79c[_0x12ca93];return _0x183f7b;};'use strict';var Sequelize=require('sequelize');module[_0xcb79('0x0')]={'name':{'type':Sequelize[_0xcb79('0x1')],'unique':_0xcb79('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xcb79('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7353=['BOOLEAN','exports'];(function(_0x2f716d,_0x449183){var _0x4ee181=function(_0x192d6c){while(--_0x192d6c){_0x2f716d['push'](_0x2f716d['shift']());}};_0x4ee181(++_0x449183);}(_0x7353,0x6f));var _0x3735=function(_0x3f67a2,_0x13f4b5){_0x3f67a2=_0x3f67a2-0x0;var _0x49da4a=_0x7353[_0x3f67a2];return _0x49da4a;};'use strict';var Sequelize=require('sequelize');module[_0x3735('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3735('0x1')],'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 11bd56b..7936bbe 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 _0x65b8=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','Contexts','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoiceContext','include','findAll','catch','show','params','includeAll','merge','find','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','autoAssociation','readFileSync','utf8','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','then'];(function(_0xf680b0,_0x256600){var _0x22c24c=function(_0xe6a84e){while(--_0xe6a84e){_0xf680b0['push'](_0xf680b0['shift']());}};_0x22c24c(++_0x256600);}(_0x65b8,0xa9));var _0x865b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x65b8[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x865b('0x0'));var rimraf=require(_0x865b('0x1'));var zipdir=require(_0x865b('0x2'));var jsonpatch=require(_0x865b('0x3'));var rp=require('request-promise');var moment=require(_0x865b('0x4'));var BPromise=require(_0x865b('0x5'));var Mustache=require('mustache');var util=require(_0x865b('0x6'));var path=require(_0x865b('0x7'));var sox=require(_0x865b('0x8'));var csv=require(_0x865b('0x9'));var ejs=require(_0x865b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x865b('0xb'));var squel=require(_0x865b('0xc'));var crypto=require(_0x865b('0xd'));var jsforce=require(_0x865b('0xe'));var deskjs=require(_0x865b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x865b('0x10'));var Papa=require(_0x865b('0x11'));var Redis=require(_0x865b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x865b('0x13'));var as=require(_0x865b('0x14'));var hardwareService=require(_0x865b('0x15'));var logger=require('../../config/logger')(_0x865b('0x16'));var utils=require(_0x865b('0x17'));var config=require(_0x865b('0x18'));var licenseUtil=require(_0x865b('0x19'));var db=require(_0x865b('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x865b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1fdb48,_0xc2ab95,_0x4b3de8,_0x28d117){return new BPromise(function(_0x1acebb,_0x399c57){var _0x447bdf=_0x28d117||client;return _0x447bdf['request'](_0x1fdb48,_0x4b3de8)[_0x865b('0x1c')](function(_0x25c90b){logger[_0x865b('0x1d')](_0x865b('0x1e'),_0xc2ab95,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0xc2ab95,_0x865b('0x1f'),JSON[_0x865b('0x20')](_0x25c90b));if(_0x25c90b[_0x865b('0x21')]){if(_0x25c90b['error']['code']===0x1f4){logger['error'](_0x865b('0x1e'),_0xc2ab95,_0x25c90b[_0x865b('0x21')][_0x865b('0x22')]);return _0x399c57(_0x25c90b[_0x865b('0x21')][_0x865b('0x22')]);}logger[_0x865b('0x21')](_0x865b('0x1e'),_0xc2ab95,_0x25c90b[_0x865b('0x21')]['message']);return _0x1acebb(_0x25c90b[_0x865b('0x21')][_0x865b('0x22')]);}else{logger[_0x865b('0x1d')]('VoiceContext,\x20%s,\x20%s',_0xc2ab95,_0x865b('0x1f'));_0x1acebb(_0x25c90b[_0x865b('0x23')][_0x865b('0x22')]);}})['catch'](function(_0xef73ea){logger[_0x865b('0x21')]('VoiceContext,\x20%s,\x20%s',_0xc2ab95,_0xef73ea);_0x399c57(_0xef73ea);});});}function respondWithStatusCode(_0x21f841,_0x4f7f84){_0x4f7f84=_0x4f7f84||0xcc;return function(_0x24fc98){if(_0x24fc98){return _0x21f841[_0x865b('0x24')](_0x4f7f84);}return _0x21f841['status'](_0x4f7f84)[_0x865b('0x25')]();};}function respondWithResult(_0x1752df,_0x403cfa){_0x403cfa=_0x403cfa||0xc8;return function(_0x1b3bb7){if(_0x1b3bb7){return _0x1752df[_0x865b('0x26')](_0x403cfa)[_0x865b('0x27')](_0x1b3bb7);}};}function respondWithFilteredResult(_0xd321ad,_0x1f42cb){return function(_0x938619){if(_0x938619){var _0xba4b6d=typeof _0x1f42cb[_0x865b('0x28')]===_0x865b('0x29')&&typeof _0x1f42cb[_0x865b('0x2a')]===_0x865b('0x29');var _0x3ace5f=_0x938619[_0x865b('0x2b')];var _0x2d1ab6=_0xba4b6d?0x0:_0x1f42cb[_0x865b('0x28')];var _0x350bf4=_0xba4b6d?_0x938619['count']:_0x1f42cb['offset']+_0x1f42cb[_0x865b('0x2a')];var _0x5cc413;if(_0x350bf4>=_0x3ace5f){_0x350bf4=_0x3ace5f;_0x5cc413=0xc8;}else{_0x5cc413=0xce;}_0xd321ad[_0x865b('0x26')](_0x5cc413);return _0xd321ad['set'](_0x865b('0x2c'),_0x2d1ab6+'-'+_0x350bf4+'/'+_0x3ace5f)[_0x865b('0x27')](_0x938619);}return null;};}function patchUpdates(_0x1bd114){return function(_0x5d260c){try{jsonpatch['apply'](_0x5d260c,_0x1bd114,!![]);}catch(_0x4f0077){return BPromise[_0x865b('0x2d')](_0x4f0077);}return _0x5d260c[_0x865b('0x2e')]();};}function saveUpdates(_0x5daf5e,_0x26295f){return function(_0x30e1d7){if(_0x30e1d7){return _0x30e1d7[_0x865b('0x2f')](_0x5daf5e)['then'](function(_0x3fa7ec){return _0x3fa7ec;});}return null;};}function removeEntity(_0x2f4820,_0x1aa4b4){return function(_0x19a426){if(_0x19a426){return _0x19a426[_0x865b('0x30')]()[_0x865b('0x1c')](function(){var _0x13b481=_0x19a426['get']({'plain':!![]});var _0x2e9baa=_0x865b('0x31');return db[_0x865b('0x32')]['destroy']({'where':{'type':_0x2e9baa,'resourceId':_0x13b481['id']}})[_0x865b('0x1c')](function(){return _0x19a426;});})[_0x865b('0x1c')](function(){_0x2f4820[_0x865b('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113c9f,_0xfa0035){return function(_0x1ec925){if(!_0x1ec925){_0x113c9f['sendStatus'](0x194);}return _0x1ec925;};}function handleError(_0xe7b794,_0x4b5c6d){_0x4b5c6d=_0x4b5c6d||0x1f4;return function(_0x1ba84e){logger['error'](_0x1ba84e['stack']);if(_0x1ba84e[_0x865b('0x33')]){delete _0x1ba84e[_0x865b('0x33')];}_0xe7b794[_0x865b('0x26')](_0x4b5c6d)[_0x865b('0x34')](_0x1ba84e);};}exports[_0x865b('0x35')]=function(_0x1e00e2,_0x218d2f){var _0x3ed0b8={},_0x1b5fab={},_0x36c384={'count':0x0,'rows':[]};var _0x4df609=_[_0x865b('0x36')](db['VoiceContext'][_0x865b('0x37')],function(_0x4e9769){return{'name':_0x4e9769[_0x865b('0x38')],'type':_0x4e9769[_0x865b('0x39')]['key']};});_0x1b5fab[_0x865b('0x3a')]=_[_0x865b('0x36')](_0x4df609,'name');_0x1b5fab[_0x865b('0x3b')]=_[_0x865b('0x3c')](_0x1e00e2[_0x865b('0x3b')]);_0x1b5fab[_0x865b('0x3d')]=_[_0x865b('0x3e')](_0x1b5fab[_0x865b('0x3a')],_0x1b5fab[_0x865b('0x3b')]);_0x3ed0b8[_0x865b('0x3f')]=_[_0x865b('0x3e')](_0x1b5fab['model'],qs[_0x865b('0x40')](_0x1e00e2[_0x865b('0x3b')][_0x865b('0x40')]));_0x3ed0b8[_0x865b('0x3f')]=_0x3ed0b8[_0x865b('0x3f')][_0x865b('0x41')]?_0x3ed0b8[_0x865b('0x3f')]:_0x1b5fab[_0x865b('0x3a')];if(!_0x1e00e2[_0x865b('0x3b')]['hasOwnProperty'](_0x865b('0x42'))){_0x3ed0b8[_0x865b('0x2a')]=qs['limit'](_0x1e00e2[_0x865b('0x3b')][_0x865b('0x2a')]);_0x3ed0b8['offset']=qs[_0x865b('0x28')](_0x1e00e2[_0x865b('0x3b')][_0x865b('0x28')]);}_0x3ed0b8[_0x865b('0x43')]=qs[_0x865b('0x44')](_0x1e00e2[_0x865b('0x3b')][_0x865b('0x44')]);_0x3ed0b8[_0x865b('0x45')]=qs[_0x865b('0x3d')](_[_0x865b('0x46')](_0x1e00e2['query'],_0x1b5fab[_0x865b('0x3d')]),_0x4df609);if(_0x1e00e2[_0x865b('0x3b')][_0x865b('0x47')]){_0x3ed0b8[_0x865b('0x45')]=_['merge'](_0x3ed0b8[_0x865b('0x45')],{'$or':_[_0x865b('0x36')](_0x4df609,function(_0x2c8e47){if(_0x2c8e47[_0x865b('0x39')]!==_0x865b('0x48')){var _0x191024={};_0x191024[_0x2c8e47[_0x865b('0x33')]]={'$like':'%'+_0x1e00e2['query'][_0x865b('0x47')]+'%'};return _0x191024;}})});}_0x3ed0b8=_['merge']({},_0x3ed0b8,_0x1e00e2[_0x865b('0x49')]);var _0x3cbd9a={'where':_0x3ed0b8[_0x865b('0x45')]};return db[_0x865b('0x4a')][_0x865b('0x2b')](_0x3cbd9a)[_0x865b('0x1c')](function(_0x198931){_0x36c384[_0x865b('0x2b')]=_0x198931;if(_0x1e00e2[_0x865b('0x3b')]['includeAll']){_0x3ed0b8[_0x865b('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x865b('0x4c')](_0x3ed0b8);})['then'](function(_0x515765){_0x36c384['rows']=_0x515765;return _0x36c384;})[_0x865b('0x1c')](respondWithFilteredResult(_0x218d2f,_0x3ed0b8))[_0x865b('0x4d')](handleError(_0x218d2f,null));};exports[_0x865b('0x4e')]=function(_0x287be3,_0x15f1f0){var _0x1e8a4f={'raw':![],'where':{'id':_0x287be3[_0x865b('0x4f')]['id']}},_0x5931b1={};_0x5931b1[_0x865b('0x3a')]=_[_0x865b('0x3c')](db[_0x865b('0x4a')][_0x865b('0x37')]);_0x5931b1[_0x865b('0x3b')]=_['keys'](_0x287be3[_0x865b('0x3b')]);_0x5931b1[_0x865b('0x3d')]=_[_0x865b('0x3e')](_0x5931b1[_0x865b('0x3a')],_0x5931b1[_0x865b('0x3b')]);_0x1e8a4f[_0x865b('0x3f')]=_[_0x865b('0x3e')](_0x5931b1[_0x865b('0x3a')],qs[_0x865b('0x40')](_0x287be3[_0x865b('0x3b')][_0x865b('0x40')]));_0x1e8a4f[_0x865b('0x3f')]=_0x1e8a4f[_0x865b('0x3f')][_0x865b('0x41')]?_0x1e8a4f[_0x865b('0x3f')]:_0x5931b1[_0x865b('0x3a')];if(_0x287be3['query'][_0x865b('0x50')]){_0x1e8a4f['include']=[{'all':!![]}];}_0x1e8a4f=_[_0x865b('0x51')]({},_0x1e8a4f,_0x287be3['options']);return db[_0x865b('0x4a')][_0x865b('0x52')](_0x1e8a4f)[_0x865b('0x1c')](handleEntityNotFound(_0x15f1f0,null))[_0x865b('0x1c')](respondWithResult(_0x15f1f0,null))[_0x865b('0x4d')](handleError(_0x15f1f0,null));};exports[_0x865b('0x53')]=function(_0x4d0c14,_0x2ad649,_0x5b1fb1){var _0x312e61;return db['VoiceContext']['create'](_0x4d0c14[_0x865b('0x54')],{'raw':!![]})[_0x865b('0x1c')](function(_0x385a41){_0x312e61=_0x385a41;return db['VoiceContext'][_0x865b('0x4c')]({'raw':!![]});})[_0x865b('0x1c')](function(_0x46eae4){var _0x520657=fs['readFileSync'](path[_0x865b('0x55')](config[_0x865b('0x56')],_0x865b('0x57')),'utf8');var _0x4d3fe0=ejs[_0x865b('0x58')](_0x520657,{'contexts':_0x46eae4||[]});fs[_0x865b('0x59')](_0x865b('0x5a'),_0x4d3fe0);})[_0x865b('0x1c')](function(){return respondWithRpcPromise(_0x865b('0x5b'),'create',{'module':_0x865b('0x5c')});})[_0x865b('0x1c')](function(){var _0x2b7c57=_0x4d0c14[_0x865b('0x5d')][_0x865b('0x5e')]({'plain':!![]});if(!_0x2b7c57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b7c57[_0x865b('0x5f')]==='user'){var _0xe2dc1c=_0x312e61[_0x865b('0x5e')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x865b('0x31'),'userProfileId':_0x2b7c57['userProfileId']},'raw':!![]})[_0x865b('0x1c')](function(_0x4c4386){if(_0x4c4386&&_0x4c4386[_0x865b('0x60')]===0x0){return db[_0x865b('0x32')]['create']({'name':_0xe2dc1c[_0x865b('0x33')],'resourceId':_0xe2dc1c['id'],'type':_0x4c4386[_0x865b('0x33')],'sectionId':_0x4c4386['id']},{})[_0x865b('0x1c')](function(){return _0x312e61;});}else{return _0x312e61;}})[_0x865b('0x4d')](function(_0x57df2c){logger[_0x865b('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57df2c);throw _0x57df2c;});}return _0x312e61;})[_0x865b('0x1c')](respondWithResult(_0x2ad649,0xc9))[_0x865b('0x4d')](handleError(_0x2ad649,null));};exports[_0x865b('0x2f')]=function(_0x507bd0,_0x5d802d,_0x54249f){var _0xe1aae8;return db[_0x865b('0x4a')]['find']({'where':{'id':_0x507bd0['params']['id']}})['then'](handleEntityNotFound(_0x5d802d,null))[_0x865b('0x1c')](saveUpdates(_0x507bd0[_0x865b('0x54')],null))[_0x865b('0x1c')](function(_0x1f2eb7){if(_0x1f2eb7){_0xe1aae8=_0x1f2eb7;return db[_0x865b('0x4a')][_0x865b('0x4c')]({'raw':!![]});}})[_0x865b('0x1c')](function(_0xdaa24){var _0x2b4e99=fs[_0x865b('0x61')](path[_0x865b('0x55')](config[_0x865b('0x56')],_0x865b('0x57')),_0x865b('0x62'));var _0x344de9=ejs[_0x865b('0x58')](_0x2b4e99,{'contexts':_0xdaa24||[]});fs[_0x865b('0x59')](_0x865b('0x5a'),_0x344de9);})[_0x865b('0x1c')](function(){return respondWithRpcPromise(_0x865b('0x5b'),_0x865b('0x2f'),{'module':_0x865b('0x5c')});})[_0x865b('0x1c')](function(){return _0xe1aae8;})[_0x865b('0x1c')](respondWithResult(_0x5d802d,null))[_0x865b('0x4d')](handleError(_0x5d802d,null));};exports['destroy']=function(_0x17f47c,_0x7f70a,_0x2eb60e){var _0x975f49;return db['VoiceContext'][_0x865b('0x52')]({'where':{'id':_0x17f47c[_0x865b('0x4f')]['id']}})[_0x865b('0x1c')](handleEntityNotFound(_0x7f70a,null))[_0x865b('0x1c')](removeEntity(_0x7f70a,null))[_0x865b('0x1c')](function(){return db[_0x865b('0x4a')][_0x865b('0x4c')]({'raw':!![]});})[_0x865b('0x1c')](function(_0x2abbc6){var _0x460f5e=fs['readFileSync'](path[_0x865b('0x55')](config['root'],'server/files/templates/context.ejs'),_0x865b('0x62'));var _0xa08c5=ejs['render'](_0x460f5e,{'contexts':_0x2abbc6});fs[_0x865b('0x59')](_0x865b('0x5a'),_0xa08c5);return respondWithRpcPromise(_0x865b('0x5b'),_0x865b('0x30'),{'module':_0x865b('0x5c')});})[_0x865b('0x4d')](handleError(_0x7f70a,null));}; \ No newline at end of file +var _0xd582=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','length','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes'];(function(_0x4d69ed,_0x2ee525){var _0x446033=function(_0x210ff9){while(--_0x210ff9){_0x4d69ed['push'](_0x4d69ed['shift']());}};_0x446033(++_0x2ee525);}(_0xd582,0x91));var _0x2d58=function(_0x359f8f,_0x362a7c){_0x359f8f=_0x359f8f-0x0;var _0x4857bb=_0xd582[_0x359f8f];return _0x4857bb;};'use strict';var emlformat=require(_0x2d58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d58('0x1'));var jsonpatch=require(_0x2d58('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d58('0x3'));var Mustache=require(_0x2d58('0x4'));var util=require(_0x2d58('0x5'));var path=require(_0x2d58('0x6'));var sox=require(_0x2d58('0x7'));var csv=require(_0x2d58('0x8'));var ejs=require(_0x2d58('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d58('0xa'));var crypto=require(_0x2d58('0xb'));var jsforce=require(_0x2d58('0xc'));var deskjs=require(_0x2d58('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2d58('0xe'));var Papa=require(_0x2d58('0xf'));var Redis=require(_0x2d58('0x10'));var authService=require(_0x2d58('0x11'));var qs=require(_0x2d58('0x12'));var as=require(_0x2d58('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d58('0x14'))(_0x2d58('0x15'));var utils=require(_0x2d58('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2d58('0x17'));var db=require(_0x2d58('0x18'))['db'];var jayson=require(_0x2d58('0x19'));var client=jayson[_0x2d58('0x1a')][_0x2d58('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x27d61d,_0x4560c0,_0x30c14a,_0x46efe0){return new BPromise(function(_0xed34f5,_0x2fdeea){var _0x405a78=_0x46efe0||client;return _0x405a78[_0x2d58('0x1c')](_0x27d61d,_0x30c14a)[_0x2d58('0x1d')](function(_0x56dc44){logger[_0x2d58('0x1e')](_0x2d58('0x1f'),_0x4560c0,_0x2d58('0x20'));logger[_0x2d58('0x21')](_0x2d58('0x22'),_0x4560c0,_0x2d58('0x20'),JSON['stringify'](_0x56dc44));if(_0x56dc44[_0x2d58('0x23')]){if(_0x56dc44[_0x2d58('0x23')][_0x2d58('0x24')]===0x1f4){logger[_0x2d58('0x23')](_0x2d58('0x1f'),_0x4560c0,_0x56dc44[_0x2d58('0x23')][_0x2d58('0x25')]);return _0x2fdeea(_0x56dc44['error'][_0x2d58('0x25')]);}logger[_0x2d58('0x23')]('VoiceContext,\x20%s,\x20%s',_0x4560c0,_0x56dc44[_0x2d58('0x23')]['message']);return _0xed34f5(_0x56dc44[_0x2d58('0x23')][_0x2d58('0x25')]);}else{logger[_0x2d58('0x1e')](_0x2d58('0x1f'),_0x4560c0,_0x2d58('0x20'));_0xed34f5(_0x56dc44[_0x2d58('0x26')]['message']);}})[_0x2d58('0x27')](function(_0x5622bd){logger[_0x2d58('0x23')](_0x2d58('0x1f'),_0x4560c0,_0x5622bd);_0x2fdeea(_0x5622bd);});});}function respondWithStatusCode(_0x32411b,_0x490c90){_0x490c90=_0x490c90||0xcc;return function(_0x88a0e6){if(_0x88a0e6){return _0x32411b[_0x2d58('0x28')](_0x490c90);}return _0x32411b[_0x2d58('0x29')](_0x490c90)[_0x2d58('0x2a')]();};}function respondWithResult(_0x20dbd7,_0x40820f){_0x40820f=_0x40820f||0xc8;return function(_0x547d13){if(_0x547d13){return _0x20dbd7[_0x2d58('0x29')](_0x40820f)[_0x2d58('0x2b')](_0x547d13);}};}function respondWithFilteredResult(_0x5d4e8f,_0x3c62bb){return function(_0x532bc0){if(_0x532bc0){var _0x53ddbc=typeof _0x3c62bb['offset']===_0x2d58('0x2c')&&typeof _0x3c62bb['limit']===_0x2d58('0x2c');var _0x49ddde=_0x532bc0[_0x2d58('0x2d')];var _0x144eba=_0x53ddbc?0x0:_0x3c62bb[_0x2d58('0x2e')];var _0xad0e19=_0x53ddbc?_0x532bc0[_0x2d58('0x2d')]:_0x3c62bb['offset']+_0x3c62bb[_0x2d58('0x2f')];var _0x5996c9;if(_0xad0e19>=_0x49ddde){_0xad0e19=_0x49ddde;_0x5996c9=0xc8;}else{_0x5996c9=0xce;}_0x5d4e8f['status'](_0x5996c9);return _0x5d4e8f[_0x2d58('0x30')]('Content-Range',_0x144eba+'-'+_0xad0e19+'/'+_0x49ddde)[_0x2d58('0x2b')](_0x532bc0);}return null;};}function patchUpdates(_0x1a2fac){return function(_0x583958){try{jsonpatch[_0x2d58('0x31')](_0x583958,_0x1a2fac,!![]);}catch(_0x438bf8){return BPromise[_0x2d58('0x32')](_0x438bf8);}return _0x583958[_0x2d58('0x33')]();};}function saveUpdates(_0x33862b,_0x56f701){return function(_0x56a2f2){if(_0x56a2f2){return _0x56a2f2[_0x2d58('0x34')](_0x33862b)[_0x2d58('0x1d')](function(_0x479691){return _0x479691;});}return null;};}function removeEntity(_0x816264,_0x40361e){return function(_0x4adfc2){if(_0x4adfc2){return _0x4adfc2[_0x2d58('0x35')]()[_0x2d58('0x1d')](function(){var _0x9f785=_0x4adfc2[_0x2d58('0x36')]({'plain':!![]});var _0x54aa95=_0x2d58('0x37');return db[_0x2d58('0x38')]['destroy']({'where':{'type':_0x54aa95,'resourceId':_0x9f785['id']}})[_0x2d58('0x1d')](function(){return _0x4adfc2;});})[_0x2d58('0x1d')](function(){_0x816264[_0x2d58('0x29')](0xcc)[_0x2d58('0x2a')]();});}};}function handleEntityNotFound(_0x268865,_0x1e015b){return function(_0x5069ce){if(!_0x5069ce){_0x268865[_0x2d58('0x28')](0x194);}return _0x5069ce;};}function handleError(_0x44da56,_0x308358){_0x308358=_0x308358||0x1f4;return function(_0x2c41b7){logger[_0x2d58('0x23')](_0x2c41b7['stack']);if(_0x2c41b7[_0x2d58('0x39')]){delete _0x2c41b7['name'];}_0x44da56[_0x2d58('0x29')](_0x308358)[_0x2d58('0x3a')](_0x2c41b7);};}exports[_0x2d58('0x3b')]=function(_0x32984a,_0x257a17){var _0x1afb3b={},_0x5241f8={},_0xa71c8c={'count':0x0,'rows':[]};var _0x24f6b1=_[_0x2d58('0x3c')](db[_0x2d58('0x3d')][_0x2d58('0x3e')],function(_0x390df5){return{'name':_0x390df5[_0x2d58('0x3f')],'type':_0x390df5[_0x2d58('0x40')][_0x2d58('0x41')]};});_0x5241f8[_0x2d58('0x42')]=_['map'](_0x24f6b1,_0x2d58('0x39'));_0x5241f8['query']=_[_0x2d58('0x43')](_0x32984a[_0x2d58('0x44')]);_0x5241f8[_0x2d58('0x45')]=_[_0x2d58('0x46')](_0x5241f8[_0x2d58('0x42')],_0x5241f8[_0x2d58('0x44')]);_0x1afb3b[_0x2d58('0x47')]=_[_0x2d58('0x46')](_0x5241f8[_0x2d58('0x42')],qs[_0x2d58('0x48')](_0x32984a[_0x2d58('0x44')][_0x2d58('0x48')]));_0x1afb3b[_0x2d58('0x47')]=_0x1afb3b[_0x2d58('0x47')]['length']?_0x1afb3b[_0x2d58('0x47')]:_0x5241f8[_0x2d58('0x42')];if(!_0x32984a[_0x2d58('0x44')][_0x2d58('0x49')](_0x2d58('0x4a'))){_0x1afb3b[_0x2d58('0x2f')]=qs[_0x2d58('0x2f')](_0x32984a[_0x2d58('0x44')]['limit']);_0x1afb3b[_0x2d58('0x2e')]=qs[_0x2d58('0x2e')](_0x32984a['query']['offset']);}_0x1afb3b[_0x2d58('0x4b')]=qs[_0x2d58('0x4c')](_0x32984a['query']['sort']);_0x1afb3b[_0x2d58('0x4d')]=qs[_0x2d58('0x45')](_[_0x2d58('0x4e')](_0x32984a['query'],_0x5241f8[_0x2d58('0x45')]),_0x24f6b1);if(_0x32984a[_0x2d58('0x44')][_0x2d58('0x4f')]){_0x1afb3b[_0x2d58('0x4d')]=_[_0x2d58('0x50')](_0x1afb3b[_0x2d58('0x4d')],{'$or':_['map'](_0x24f6b1,function(_0x5b4f18){if(_0x5b4f18['type']!==_0x2d58('0x51')){var _0x5a9574={};_0x5a9574[_0x5b4f18['name']]={'$like':'%'+_0x32984a['query'][_0x2d58('0x4f')]+'%'};return _0x5a9574;}})});}_0x1afb3b=_[_0x2d58('0x50')]({},_0x1afb3b,_0x32984a['options']);var _0x38f5b3={'where':_0x1afb3b[_0x2d58('0x4d')]};return db[_0x2d58('0x3d')]['count'](_0x38f5b3)[_0x2d58('0x1d')](function(_0x3ac170){_0xa71c8c['count']=_0x3ac170;if(_0x32984a[_0x2d58('0x44')][_0x2d58('0x52')]){_0x1afb3b['include']=[{'all':!![]}];}return db[_0x2d58('0x3d')][_0x2d58('0x53')](_0x1afb3b);})['then'](function(_0x58525d){_0xa71c8c[_0x2d58('0x54')]=_0x58525d;return _0xa71c8c;})[_0x2d58('0x1d')](respondWithFilteredResult(_0x257a17,_0x1afb3b))[_0x2d58('0x27')](handleError(_0x257a17,null));};exports['show']=function(_0x5226cd,_0x3ac7fc){var _0x5e0711={'raw':![],'where':{'id':_0x5226cd[_0x2d58('0x55')]['id']}},_0x4acc6c={};_0x4acc6c['model']=_[_0x2d58('0x43')](db[_0x2d58('0x3d')]['rawAttributes']);_0x4acc6c[_0x2d58('0x44')]=_[_0x2d58('0x43')](_0x5226cd[_0x2d58('0x44')]);_0x4acc6c[_0x2d58('0x45')]=_['intersection'](_0x4acc6c[_0x2d58('0x42')],_0x4acc6c[_0x2d58('0x44')]);_0x5e0711[_0x2d58('0x47')]=_[_0x2d58('0x46')](_0x4acc6c['model'],qs['fields'](_0x5226cd[_0x2d58('0x44')][_0x2d58('0x48')]));_0x5e0711[_0x2d58('0x47')]=_0x5e0711['attributes'][_0x2d58('0x56')]?_0x5e0711['attributes']:_0x4acc6c[_0x2d58('0x42')];if(_0x5226cd[_0x2d58('0x44')][_0x2d58('0x52')]){_0x5e0711['include']=[{'all':!![]}];}_0x5e0711=_['merge']({},_0x5e0711,_0x5226cd['options']);return db[_0x2d58('0x3d')][_0x2d58('0x57')](_0x5e0711)[_0x2d58('0x1d')](handleEntityNotFound(_0x3ac7fc,null))['then'](respondWithResult(_0x3ac7fc,null))['catch'](handleError(_0x3ac7fc,null));};exports[_0x2d58('0x58')]=function(_0x53d626,_0x2bc6d3,_0x50acbf){var _0x5421cf;return db[_0x2d58('0x3d')][_0x2d58('0x58')](_0x53d626['body'],{'raw':!![]})[_0x2d58('0x1d')](function(_0x37575a){_0x5421cf=_0x37575a;return db[_0x2d58('0x3d')]['findAll']({'raw':!![]});})[_0x2d58('0x1d')](function(_0x1b88b4){var _0x2b08bc=fs[_0x2d58('0x59')](path[_0x2d58('0x5a')](config[_0x2d58('0x5b')],_0x2d58('0x5c')),_0x2d58('0x5d'));var _0x1d86bd=ejs[_0x2d58('0x5e')](_0x2b08bc,{'contexts':_0x1b88b4||[]});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x1d86bd);})[_0x2d58('0x1d')](function(){return respondWithRpcPromise(_0x2d58('0x61'),'create',{'module':_0x2d58('0x62')});})[_0x2d58('0x1d')](function(){var _0x4c87bb=_0x53d626[_0x2d58('0x63')][_0x2d58('0x36')]({'plain':!![]});if(!_0x4c87bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c87bb[_0x2d58('0x64')]===_0x2d58('0x63')){var _0x29907f=_0x5421cf[_0x2d58('0x36')]({'plain':!![]});return db['UserProfileSection'][_0x2d58('0x57')]({'where':{'name':'Contexts','userProfileId':_0x4c87bb[_0x2d58('0x65')]},'raw':!![]})[_0x2d58('0x1d')](function(_0x2142a6){if(_0x2142a6&&_0x2142a6['autoAssociation']===0x0){return db[_0x2d58('0x38')][_0x2d58('0x58')]({'name':_0x29907f['name'],'resourceId':_0x29907f['id'],'type':_0x2142a6[_0x2d58('0x39')],'sectionId':_0x2142a6['id']},{})['then'](function(){return _0x5421cf;});}else{return _0x5421cf;}})[_0x2d58('0x27')](function(_0xddd264){logger[_0x2d58('0x23')](_0x2d58('0x66'),_0xddd264);throw _0xddd264;});}return _0x5421cf;})['then'](respondWithResult(_0x2bc6d3,0xc9))[_0x2d58('0x27')](handleError(_0x2bc6d3,null));};exports[_0x2d58('0x34')]=function(_0x56a623,_0x3805eb,_0x42dbdd){var _0x11d2f7;return db[_0x2d58('0x3d')][_0x2d58('0x57')]({'where':{'id':_0x56a623[_0x2d58('0x55')]['id']}})[_0x2d58('0x1d')](handleEntityNotFound(_0x3805eb,null))[_0x2d58('0x1d')](saveUpdates(_0x56a623[_0x2d58('0x67')],null))[_0x2d58('0x1d')](function(_0x8cabbe){if(_0x8cabbe){_0x11d2f7=_0x8cabbe;return db[_0x2d58('0x3d')][_0x2d58('0x53')]({'raw':!![]});}})[_0x2d58('0x1d')](function(_0x5a883b){var _0x1ff6f3=fs[_0x2d58('0x59')](path[_0x2d58('0x5a')](config[_0x2d58('0x5b')],'server/files/templates/context.ejs'),_0x2d58('0x5d'));var _0x1a0608=ejs[_0x2d58('0x5e')](_0x1ff6f3,{'contexts':_0x5a883b||[]});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x1a0608);})[_0x2d58('0x1d')](function(){return respondWithRpcPromise(_0x2d58('0x61'),_0x2d58('0x34'),{'module':'chan_sip.so'});})['then'](function(){return _0x11d2f7;})[_0x2d58('0x1d')](respondWithResult(_0x3805eb,null))['catch'](handleError(_0x3805eb,null));};exports[_0x2d58('0x35')]=function(_0x3fd25d,_0x1cd96a,_0xc3f85e){var _0x32cc7e;return db[_0x2d58('0x3d')][_0x2d58('0x57')]({'where':{'id':_0x3fd25d[_0x2d58('0x55')]['id']}})[_0x2d58('0x1d')](handleEntityNotFound(_0x1cd96a,null))[_0x2d58('0x1d')](removeEntity(_0x1cd96a,null))[_0x2d58('0x1d')](function(){return db[_0x2d58('0x3d')]['findAll']({'raw':!![]});})[_0x2d58('0x1d')](function(_0x2599ea){var _0xa318ef=fs[_0x2d58('0x59')](path[_0x2d58('0x5a')](config[_0x2d58('0x5b')],'server/files/templates/context.ejs'),_0x2d58('0x5d'));var _0x5d4ec8=ejs['render'](_0xa318ef,{'contexts':_0x2599ea});fs[_0x2d58('0x5f')](_0x2d58('0x60'),_0x5d4ec8);return respondWithRpcPromise('Reload','destroy',{'module':_0x2d58('0x62')});})[_0x2d58('0x27')](handleError(_0x1cd96a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a2839f2..fe9dbbc 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 _0x4894=['request-promise','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird'];(function(_0x1d0c8e,_0x1990ac){var _0x3fbca7=function(_0x4f5ab3){while(--_0x4f5ab3){_0x1d0c8e['push'](_0x1d0c8e['shift']());}};_0x3fbca7(++_0x1990ac);}(_0x4894,0x13a));var _0x4489=function(_0x4ee52c,_0x1c9916){_0x4ee52c=_0x4ee52c-0x0;var _0x5ec6a4=_0x4894[_0x4ee52c];return _0x5ec6a4;};'use strict';var _=require(_0x4489('0x0'));var util=require(_0x4489('0x1'));var logger=require(_0x4489('0x2'))(_0x4489('0x3'));var moment=require('moment');var BPromise=require(_0x4489('0x4'));var rp=require(_0x4489('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4489('0x6'));var attributes=require(_0x4489('0x7'));module[_0x4489('0x8')]=function(_0x448ab1,_0x47ef50){return _0x448ab1['define'](_0x4489('0x9'),attributes,{'tableName':_0x4489('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3b=['exports','define','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x102a66,_0x3fa9bd){var _0x26ab11=function(_0x114306){while(--_0x114306){_0x102a66['push'](_0x102a66['shift']());}};_0x26ab11(++_0x3fa9bd);}(_0xaa3b,0x191));var _0xbaa3=function(_0x419bb9,_0x247ffa){_0x419bb9=_0x419bb9-0x0;var _0x594006=_0xaa3b[_0x419bb9];return _0x594006;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbaa3('0x0'))('api');var moment=require(_0xbaa3('0x1'));var BPromise=require(_0xbaa3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaa3('0x3'));var rimraf=require(_0xbaa3('0x4'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xbaa3('0x5')]=function(_0x398fad,_0x2c6d5d){return _0x398fad[_0xbaa3('0x6')]('VoiceContext',attributes,{'tableName':'voice_contexts','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 bff2bc9..80e58fe 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 _0x9e38=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0x9e38,0x155));var _0x89e3=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0x9e38[_0x412b2a];return _0x5872e3;};'use strict';var _=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var moment=require(_0x89e3('0x2'));var BPromise=require(_0x89e3('0x3'));var rs=require(_0x89e3('0x4'));var fs=require('fs');var Redis=require(_0x89e3('0x5'));var db=require(_0x89e3('0x6'))['db'];var utils=require(_0x89e3('0x7'));var logger=require(_0x89e3('0x8'))(_0x89e3('0x9'));var config=require(_0x89e3('0xa'));var jayson=require(_0x89e3('0xb'));var client=jayson[_0x89e3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e2a8e,_0xcad35d,_0xe526ab){return new BPromise(function(_0x2476e4,_0x3ebc0b){return client[_0x89e3('0xd')](_0x3e2a8e,_0xe526ab)[_0x89e3('0xe')](function(_0x18d0a6){logger[_0x89e3('0xf')](_0x89e3('0x10'),_0xcad35d,'request\x20sent');logger[_0x89e3('0x11')](_0x89e3('0x12'),_0xcad35d,_0x89e3('0x13'),JSON[_0x89e3('0x14')](_0x18d0a6));if(_0x18d0a6['error']){if(_0x18d0a6[_0x89e3('0x15')][_0x89e3('0x16')]===0x1f4){logger[_0x89e3('0x15')]('VoiceContext,\x20%s,\x20%s',_0xcad35d,_0x18d0a6[_0x89e3('0x15')]['message']);return _0x3ebc0b(_0x18d0a6[_0x89e3('0x15')][_0x89e3('0x17')]);}logger[_0x89e3('0x15')](_0x89e3('0x10'),_0xcad35d,_0x18d0a6[_0x89e3('0x15')][_0x89e3('0x17')]);return _0x2476e4(_0x18d0a6[_0x89e3('0x15')][_0x89e3('0x17')]);}else{logger[_0x89e3('0xf')](_0x89e3('0x10'),_0xcad35d,_0x89e3('0x13'));_0x2476e4(_0x18d0a6[_0x89e3('0x18')][_0x89e3('0x17')]);}})[_0x89e3('0x19')](function(_0x3d8792){logger['error'](_0x89e3('0x10'),_0xcad35d,_0x3d8792);_0x3ebc0b(_0x3d8792);});});} \ No newline at end of file +var _0x16d1=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x435302,_0x2eb521){var _0x1e2b47=function(_0x440ff1){while(--_0x440ff1){_0x435302['push'](_0x435302['shift']());}};_0x1e2b47(++_0x2eb521);}(_0x16d1,0xf7));var _0x116d=function(_0x5038bc,_0x32b3d0){_0x5038bc=_0x5038bc-0x0;var _0x1acf4e=_0x16d1[_0x5038bc];return _0x1acf4e;};'use strict';var _=require(_0x116d('0x0'));var util=require(_0x116d('0x1'));var moment=require(_0x116d('0x2'));var BPromise=require(_0x116d('0x3'));var rs=require(_0x116d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x116d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x116d('0x6'))(_0x116d('0x7'));var config=require(_0x116d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x116d('0x9')][_0x116d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x912a78,_0x560653,_0x34c27a){return new BPromise(function(_0x2e3922,_0x1f46ee){return client[_0x116d('0xb')](_0x912a78,_0x34c27a)[_0x116d('0xc')](function(_0x36feaa){logger[_0x116d('0xd')](_0x116d('0xe'),_0x560653,_0x116d('0xf'));logger[_0x116d('0x10')](_0x116d('0x11'),_0x560653,_0x116d('0xf'),JSON[_0x116d('0x12')](_0x36feaa));if(_0x36feaa[_0x116d('0x13')]){if(_0x36feaa[_0x116d('0x13')]['code']===0x1f4){logger['error'](_0x116d('0xe'),_0x560653,_0x36feaa['error'][_0x116d('0x14')]);return _0x1f46ee(_0x36feaa['error'][_0x116d('0x14')]);}logger[_0x116d('0x13')](_0x116d('0xe'),_0x560653,_0x36feaa[_0x116d('0x13')][_0x116d('0x14')]);return _0x2e3922(_0x36feaa[_0x116d('0x13')][_0x116d('0x14')]);}else{logger[_0x116d('0xd')]('VoiceContext,\x20%s,\x20%s',_0x560653,_0x116d('0xf'));_0x2e3922(_0x36feaa['result'][_0x116d('0x14')]);}})[_0x116d('0x15')](function(_0x3f64f7){logger[_0x116d('0x13')]('VoiceContext,\x20%s,\x20%s',_0x560653,_0x3f64f7);_0x1f46ee(_0x3f64f7);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1698cf1..2e054ef 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 _0x4e37=['../../config/environment','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x4e37,0x1a8));var _0x74e3=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x4e37[_0x53bcc3];return _0x47c959;};'use strict';var multer=require(_0x74e3('0x0'));var util=require(_0x74e3('0x1'));var path=require(_0x74e3('0x2'));var timeout=require(_0x74e3('0x3'));var express=require(_0x74e3('0x4'));var router=express[_0x74e3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x74e3('0x6'));var interaction=require(_0x74e3('0x7'));var config=require(_0x74e3('0x8'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x74e3('0x9')](),controller[_0x74e3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x74e3('0xb')]);router['get'](_0x74e3('0xc'),auth[_0x74e3('0x9')](),controller['show']);router[_0x74e3('0xd')]('/',auth[_0x74e3('0x9')](),controller[_0x74e3('0xe')]);router[_0x74e3('0xf')](_0x74e3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x74e3('0x10')]('/:id',auth[_0x74e3('0x9')](),controller[_0x74e3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x672e=['describe','/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x672e,0x1ac));var _0xe672=function(_0x446ade,_0x1e28db){_0x446ade=_0x446ade-0x0;var _0x3229f7=_0x672e[_0x446ade];return _0x3229f7;};'use strict';var multer=require(_0xe672('0x0'));var util=require(_0xe672('0x1'));var path=require('path');var timeout=require(_0xe672('0x2'));var express=require(_0xe672('0x3'));var router=express[_0xe672('0x4')]();var fs_extra=require(_0xe672('0x5'));var auth=require(_0xe672('0x6'));var interaction=require(_0xe672('0x7'));var config=require(_0xe672('0x8'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xe672('0x9')](),controller[_0xe672('0xa')]);router[_0xe672('0xb')](_0xe672('0xc'),auth[_0xe672('0x9')](),controller[_0xe672('0xd')]);router[_0xe672('0xb')](_0xe672('0xe'),auth[_0xe672('0x9')](),controller['show']);router[_0xe672('0xf')]('/',auth[_0xe672('0x9')](),controller[_0xe672('0x10')]);router[_0xe672('0x11')](_0xe672('0xe'),auth[_0xe672('0x9')](),controller[_0xe672('0x12')]);router['delete']('/:id',auth[_0xe672('0x9')](),controller[_0xe672('0x13')]);module[_0xe672('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e536d19..52f2177 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 _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xe14d,0x1ee));var _0xde14=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe14d[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x54ef,0x112));var _0xf54e=function(_0x5e926e,_0x8c5446){_0x5e926e=_0x5e926e-0x0;var _0x1ef77c=_0x54ef[_0x5e926e];return _0x1ef77c;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 69d23b4..77f6e39 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 _0x22cb=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','create','body','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x22cb,0x10d));var _0xb22c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x22cb[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xb22c('0x0'));var rimraf=require(_0xb22c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb22c('0x2'));var BPromise=require(_0xb22c('0x3'));var Mustache=require(_0xb22c('0x4'));var util=require(_0xb22c('0x5'));var path=require(_0xb22c('0x6'));var sox=require(_0xb22c('0x7'));var csv=require(_0xb22c('0x8'));var ejs=require(_0xb22c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb22c('0xa'));var squel=require(_0xb22c('0xb'));var crypto=require('crypto');var jsforce=require(_0xb22c('0xc'));var deskjs=require(_0xb22c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb22c('0xe'));var Papa=require(_0xb22c('0xf'));var Redis=require(_0xb22c('0x10'));var authService=require(_0xb22c('0x11'));var qs=require(_0xb22c('0x12'));var as=require(_0xb22c('0x13'));var hardwareService=require(_0xb22c('0x14'));var logger=require(_0xb22c('0x15'))(_0xb22c('0x16'));var utils=require(_0xb22c('0x17'));var config=require(_0xb22c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509509,_0x11b6c9){_0x11b6c9=_0x11b6c9||0xcc;return function(_0x4f2a63){if(_0x4f2a63){return _0x509509['sendStatus'](_0x11b6c9);}return _0x509509[_0xb22c('0x19')](_0x11b6c9)[_0xb22c('0x1a')]();};}function respondWithResult(_0x3803bf,_0x16e87e){_0x16e87e=_0x16e87e||0xc8;return function(_0x2a7654){if(_0x2a7654){return _0x3803bf['status'](_0x16e87e)[_0xb22c('0x1b')](_0x2a7654);}};}function respondWithFilteredResult(_0x3ed899,_0x2e607c){return function(_0x3a9b8f){if(_0x3a9b8f){var _0x41c955=typeof _0x2e607c[_0xb22c('0x1c')]==='undefined'&&typeof _0x2e607c[_0xb22c('0x1d')]===_0xb22c('0x1e');var _0x3239e2=_0x3a9b8f[_0xb22c('0x1f')];var _0x30ac54=_0x41c955?0x0:_0x2e607c['offset'];var _0x3b2af9=_0x41c955?_0x3a9b8f[_0xb22c('0x1f')]:_0x2e607c['offset']+_0x2e607c[_0xb22c('0x1d')];var _0x335679;if(_0x3b2af9>=_0x3239e2){_0x3b2af9=_0x3239e2;_0x335679=0xc8;}else{_0x335679=0xce;}_0x3ed899[_0xb22c('0x19')](_0x335679);return _0x3ed899[_0xb22c('0x20')](_0xb22c('0x21'),_0x30ac54+'-'+_0x3b2af9+'/'+_0x3239e2)['json'](_0x3a9b8f);}return null;};}function patchUpdates(_0x501ade){return function(_0x1c47dd){try{jsonpatch[_0xb22c('0x22')](_0x1c47dd,_0x501ade,!![]);}catch(_0x532ce4){return BPromise[_0xb22c('0x23')](_0x532ce4);}return _0x1c47dd[_0xb22c('0x24')]();};}function saveUpdates(_0x18b0fa,_0x1fcde8){return function(_0x14402b){if(_0x14402b){return _0x14402b[_0xb22c('0x25')](_0x18b0fa)[_0xb22c('0x26')](function(_0x4b1402){return _0x4b1402;});}return null;};}function removeEntity(_0x4910a3,_0x2a3106){return function(_0x3917d2){if(_0x3917d2){return _0x3917d2[_0xb22c('0x27')]()[_0xb22c('0x26')](function(){_0x4910a3[_0xb22c('0x19')](0xcc)[_0xb22c('0x1a')]();});}};}function handleEntityNotFound(_0x2e82d0,_0x5b91d6){return function(_0x52a380){if(!_0x52a380){_0x2e82d0[_0xb22c('0x28')](0x194);}return _0x52a380;};}function handleError(_0xa6d680,_0x3ac878){_0x3ac878=_0x3ac878||0x1f4;return function(_0x293b79){logger[_0xb22c('0x29')](_0x293b79['stack']);if(_0x293b79[_0xb22c('0x2a')]){delete _0x293b79[_0xb22c('0x2a')];}_0xa6d680[_0xb22c('0x19')](_0x3ac878)[_0xb22c('0x2b')](_0x293b79);};}exports[_0xb22c('0x2c')]=function(_0x4bfe89,_0xb418dd){var _0x338dea={},_0x3b8a84={},_0xf75642={'count':0x0,'rows':[]};var _0x2a41f4=_[_0xb22c('0x2d')](db[_0xb22c('0x2e')][_0xb22c('0x2f')],function(_0x3c8f79){return{'name':_0x3c8f79['fieldName'],'type':_0x3c8f79[_0xb22c('0x30')][_0xb22c('0x31')]};});_0x3b8a84[_0xb22c('0x32')]=_[_0xb22c('0x2d')](_0x2a41f4,_0xb22c('0x2a'));_0x3b8a84['query']=_[_0xb22c('0x33')](_0x4bfe89[_0xb22c('0x34')]);_0x3b8a84[_0xb22c('0x35')]=_['intersection'](_0x3b8a84[_0xb22c('0x32')],_0x3b8a84[_0xb22c('0x34')]);_0x338dea[_0xb22c('0x36')]=_['intersection'](_0x3b8a84[_0xb22c('0x32')],qs[_0xb22c('0x37')](_0x4bfe89[_0xb22c('0x34')]['fields']));_0x338dea[_0xb22c('0x36')]=_0x338dea[_0xb22c('0x36')][_0xb22c('0x38')]?_0x338dea[_0xb22c('0x36')]:_0x3b8a84['model'];if(!_0x4bfe89[_0xb22c('0x34')]['hasOwnProperty'](_0xb22c('0x39'))){_0x338dea[_0xb22c('0x1d')]=qs[_0xb22c('0x1d')](_0x4bfe89[_0xb22c('0x34')]['limit']);_0x338dea[_0xb22c('0x1c')]=qs[_0xb22c('0x1c')](_0x4bfe89[_0xb22c('0x34')][_0xb22c('0x1c')]);}_0x338dea['order']=qs[_0xb22c('0x3a')](_0x4bfe89[_0xb22c('0x34')][_0xb22c('0x3a')]);_0x338dea[_0xb22c('0x3b')]=qs[_0xb22c('0x35')](_['pick'](_0x4bfe89[_0xb22c('0x34')],_0x3b8a84[_0xb22c('0x35')]),_0x2a41f4);if(_0x4bfe89[_0xb22c('0x34')][_0xb22c('0x3c')]){_0x338dea[_0xb22c('0x3b')]=_[_0xb22c('0x3d')](_0x338dea[_0xb22c('0x3b')],{'$or':_['map'](_0x2a41f4,function(_0x204006){if(_0x204006[_0xb22c('0x30')]!==_0xb22c('0x3e')){var _0x371b83={};_0x371b83[_0x204006[_0xb22c('0x2a')]]={'$like':'%'+_0x4bfe89[_0xb22c('0x34')][_0xb22c('0x3c')]+'%'};return _0x371b83;}})});}_0x338dea=_[_0xb22c('0x3d')]({},_0x338dea,_0x4bfe89[_0xb22c('0x3f')]);var _0x1695e5={'where':_0x338dea[_0xb22c('0x3b')]};return db[_0xb22c('0x2e')][_0xb22c('0x1f')](_0x1695e5)[_0xb22c('0x26')](function(_0x1f0837){_0xf75642['count']=_0x1f0837;if(_0x4bfe89[_0xb22c('0x34')][_0xb22c('0x40')]){_0x338dea[_0xb22c('0x41')]=[{'all':!![]}];}return db[_0xb22c('0x2e')]['findAll'](_0x338dea);})['then'](function(_0x22b3f3){_0xf75642['rows']=_0x22b3f3;return _0xf75642;})['then'](respondWithFilteredResult(_0xb418dd,_0x338dea))['catch'](handleError(_0xb418dd,null));};exports['show']=function(_0x40c821,_0x277264){var _0x1b548f={'raw':!![],'where':{'id':_0x40c821[_0xb22c('0x42')]['id']}},_0x8e584e={};_0x8e584e['model']=_['keys'](db[_0xb22c('0x2e')]['rawAttributes']);_0x8e584e[_0xb22c('0x34')]=_[_0xb22c('0x33')](_0x40c821['query']);_0x8e584e[_0xb22c('0x35')]=_['intersection'](_0x8e584e[_0xb22c('0x32')],_0x8e584e['query']);_0x1b548f[_0xb22c('0x36')]=_['intersection'](_0x8e584e['model'],qs[_0xb22c('0x37')](_0x40c821[_0xb22c('0x34')][_0xb22c('0x37')]));_0x1b548f['attributes']=_0x1b548f[_0xb22c('0x36')][_0xb22c('0x38')]?_0x1b548f['attributes']:_0x8e584e[_0xb22c('0x32')];if(_0x40c821[_0xb22c('0x34')][_0xb22c('0x40')]){_0x1b548f[_0xb22c('0x41')]=[{'all':!![]}];}_0x1b548f=_['merge']({},_0x1b548f,_0x40c821[_0xb22c('0x3f')]);return db['VoiceDialReport'][_0xb22c('0x43')](_0x1b548f)[_0xb22c('0x26')](handleEntityNotFound(_0x277264,null))[_0xb22c('0x26')](respondWithResult(_0x277264,null))[_0xb22c('0x44')](handleError(_0x277264,null));};exports['create']=function(_0x5a954f,_0x76fc5a){return db[_0xb22c('0x2e')][_0xb22c('0x45')](_0x5a954f[_0xb22c('0x46')],{})[_0xb22c('0x26')](respondWithResult(_0x76fc5a,0xc9))['catch'](handleError(_0x76fc5a,null));};exports['update']=function(_0x19c8d0,_0x2a78d3){if(_0x19c8d0['body']['id']){delete _0x19c8d0[_0xb22c('0x46')]['id'];}return db[_0xb22c('0x2e')][_0xb22c('0x43')]({'where':{'id':_0x19c8d0[_0xb22c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a78d3,null))[_0xb22c('0x26')](saveUpdates(_0x19c8d0[_0xb22c('0x46')],null))[_0xb22c('0x26')](respondWithResult(_0x2a78d3,null))['catch'](handleError(_0x2a78d3,null));};exports[_0xb22c('0x27')]=function(_0x415b53,_0x36fc55){return db[_0xb22c('0x2e')][_0xb22c('0x43')]({'where':{'id':_0x415b53[_0xb22c('0x42')]['id']}})[_0xb22c('0x26')](handleEntityNotFound(_0x36fc55,null))[_0xb22c('0x26')](removeEntity(_0x36fc55,null))[_0xb22c('0x44')](handleError(_0x36fc55,null));};exports['describe']=function(_0x57a016,_0x1a6a16){return db[_0xb22c('0x2e')]['describe']()[_0xb22c('0x26')](respondWithResult(_0x1a6a16,null))[_0xb22c('0x44')](handleError(_0x1a6a16,null));}; \ No newline at end of file +var _0x8f84=['merge','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','name','send','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filter'];(function(_0x371fae,_0xc8cd13){var _0xa056ee=function(_0x436811){while(--_0x436811){_0x371fae['push'](_0x371fae['shift']());}};_0xa056ee(++_0xc8cd13);}(_0x8f84,0xe1));var _0x48f8=function(_0x1715d0,_0x2418e7){_0x1715d0=_0x1715d0-0x0;var _0xa8dfeb=_0x8f84[_0x1715d0];return _0xa8dfeb;};'use strict';var emlformat=require(_0x48f8('0x0'));var rimraf=require(_0x48f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48f8('0x2'));var rp=require(_0x48f8('0x3'));var moment=require('moment');var BPromise=require(_0x48f8('0x4'));var Mustache=require('mustache');var util=require(_0x48f8('0x5'));var path=require(_0x48f8('0x6'));var sox=require(_0x48f8('0x7'));var csv=require(_0x48f8('0x8'));var ejs=require(_0x48f8('0x9'));var fs=require('fs');var fs_extra=require(_0x48f8('0xa'));var _=require(_0x48f8('0xb'));var squel=require(_0x48f8('0xc'));var crypto=require(_0x48f8('0xd'));var jsforce=require(_0x48f8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x48f8('0x8'));var querystring=require(_0x48f8('0xf'));var Papa=require(_0x48f8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x48f8('0x11'));var hardwareService=require(_0x48f8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x48f8('0x13'));var config=require(_0x48f8('0x14'));var licenseUtil=require(_0x48f8('0x15'));var db=require(_0x48f8('0x16'))['db'];function respondWithStatusCode(_0x36f5b6,_0x5f1c0f){_0x5f1c0f=_0x5f1c0f||0xcc;return function(_0x41f563){if(_0x41f563){return _0x36f5b6[_0x48f8('0x17')](_0x5f1c0f);}return _0x36f5b6['status'](_0x5f1c0f)['end']();};}function respondWithResult(_0x24771e,_0xd963a1){_0xd963a1=_0xd963a1||0xc8;return function(_0x3229ca){if(_0x3229ca){return _0x24771e[_0x48f8('0x18')](_0xd963a1)['json'](_0x3229ca);}};}function respondWithFilteredResult(_0x4efa41,_0xec34d0){return function(_0x26a5ee){if(_0x26a5ee){var _0x1a1edc=typeof _0xec34d0['offset']===_0x48f8('0x19')&&typeof _0xec34d0[_0x48f8('0x1a')]===_0x48f8('0x19');var _0x3de33c=_0x26a5ee[_0x48f8('0x1b')];var _0x4a7b09=_0x1a1edc?0x0:_0xec34d0['offset'];var _0x176688=_0x1a1edc?_0x26a5ee[_0x48f8('0x1b')]:_0xec34d0['offset']+_0xec34d0[_0x48f8('0x1a')];var _0x4c114a;if(_0x176688>=_0x3de33c){_0x176688=_0x3de33c;_0x4c114a=0xc8;}else{_0x4c114a=0xce;}_0x4efa41[_0x48f8('0x18')](_0x4c114a);return _0x4efa41[_0x48f8('0x1c')]('Content-Range',_0x4a7b09+'-'+_0x176688+'/'+_0x3de33c)[_0x48f8('0x1d')](_0x26a5ee);}return null;};}function patchUpdates(_0x14de3a){return function(_0x4acacb){try{jsonpatch[_0x48f8('0x1e')](_0x4acacb,_0x14de3a,!![]);}catch(_0x2cfe3b){return BPromise[_0x48f8('0x1f')](_0x2cfe3b);}return _0x4acacb[_0x48f8('0x20')]();};}function saveUpdates(_0x1d6829,_0x5adce0){return function(_0x34302e){if(_0x34302e){return _0x34302e[_0x48f8('0x21')](_0x1d6829)[_0x48f8('0x22')](function(_0x2549af){return _0x2549af;});}return null;};}function removeEntity(_0x349d16,_0x10d2d4){return function(_0x142cea){if(_0x142cea){return _0x142cea[_0x48f8('0x23')]()[_0x48f8('0x22')](function(){_0x349d16[_0x48f8('0x18')](0xcc)[_0x48f8('0x24')]();});}};}function handleEntityNotFound(_0x5ee4aa,_0x10ee7d){return function(_0x67bde9){if(!_0x67bde9){_0x5ee4aa[_0x48f8('0x17')](0x194);}return _0x67bde9;};}function handleError(_0x251d57,_0x336ba4){_0x336ba4=_0x336ba4||0x1f4;return function(_0x46d7a4){logger[_0x48f8('0x25')](_0x46d7a4['stack']);if(_0x46d7a4[_0x48f8('0x26')]){delete _0x46d7a4[_0x48f8('0x26')];}_0x251d57[_0x48f8('0x18')](_0x336ba4)[_0x48f8('0x27')](_0x46d7a4);};}exports['index']=function(_0x535a22,_0x509137){var _0x4952e2={},_0x5215b5={},_0x206c77={'count':0x0,'rows':[]};var _0x1cd49e=_[_0x48f8('0x28')](db[_0x48f8('0x29')]['rawAttributes'],function(_0xf1e618){return{'name':_0xf1e618[_0x48f8('0x2a')],'type':_0xf1e618[_0x48f8('0x2b')][_0x48f8('0x2c')]};});_0x5215b5[_0x48f8('0x2d')]=_['map'](_0x1cd49e,'name');_0x5215b5[_0x48f8('0x2e')]=_[_0x48f8('0x2f')](_0x535a22[_0x48f8('0x2e')]);_0x5215b5[_0x48f8('0x30')]=_['intersection'](_0x5215b5[_0x48f8('0x2d')],_0x5215b5[_0x48f8('0x2e')]);_0x4952e2[_0x48f8('0x31')]=_[_0x48f8('0x32')](_0x5215b5[_0x48f8('0x2d')],qs[_0x48f8('0x33')](_0x535a22[_0x48f8('0x2e')][_0x48f8('0x33')]));_0x4952e2[_0x48f8('0x31')]=_0x4952e2[_0x48f8('0x31')][_0x48f8('0x34')]?_0x4952e2['attributes']:_0x5215b5[_0x48f8('0x2d')];if(!_0x535a22[_0x48f8('0x2e')][_0x48f8('0x35')]('nolimit')){_0x4952e2[_0x48f8('0x1a')]=qs['limit'](_0x535a22['query'][_0x48f8('0x1a')]);_0x4952e2[_0x48f8('0x36')]=qs['offset'](_0x535a22[_0x48f8('0x2e')][_0x48f8('0x36')]);}_0x4952e2[_0x48f8('0x37')]=qs[_0x48f8('0x38')](_0x535a22['query'][_0x48f8('0x38')]);_0x4952e2[_0x48f8('0x39')]=qs['filters'](_['pick'](_0x535a22[_0x48f8('0x2e')],_0x5215b5[_0x48f8('0x30')]),_0x1cd49e);if(_0x535a22[_0x48f8('0x2e')][_0x48f8('0x3a')]){_0x4952e2[_0x48f8('0x39')]=_[_0x48f8('0x3b')](_0x4952e2[_0x48f8('0x39')],{'$or':_[_0x48f8('0x28')](_0x1cd49e,function(_0x2fa28e){if(_0x2fa28e[_0x48f8('0x2b')]!==_0x48f8('0x3c')){var _0x4f1b49={};_0x4f1b49[_0x2fa28e[_0x48f8('0x26')]]={'$like':'%'+_0x535a22[_0x48f8('0x2e')][_0x48f8('0x3a')]+'%'};return _0x4f1b49;}})});}_0x4952e2=_['merge']({},_0x4952e2,_0x535a22[_0x48f8('0x3d')]);var _0x100707={'where':_0x4952e2[_0x48f8('0x39')]};return db['VoiceDialReport'][_0x48f8('0x1b')](_0x100707)[_0x48f8('0x22')](function(_0x231fed){_0x206c77[_0x48f8('0x1b')]=_0x231fed;if(_0x535a22[_0x48f8('0x2e')][_0x48f8('0x3e')]){_0x4952e2['include']=[{'all':!![]}];}return db[_0x48f8('0x29')]['findAll'](_0x4952e2);})[_0x48f8('0x22')](function(_0x5ee802){_0x206c77[_0x48f8('0x3f')]=_0x5ee802;return _0x206c77;})[_0x48f8('0x22')](respondWithFilteredResult(_0x509137,_0x4952e2))[_0x48f8('0x40')](handleError(_0x509137,null));};exports['show']=function(_0x2969fd,_0x1a6f37){var _0x54e94e={'raw':!![],'where':{'id':_0x2969fd['params']['id']}},_0x421ff6={};_0x421ff6[_0x48f8('0x2d')]=_['keys'](db['VoiceDialReport']['rawAttributes']);_0x421ff6[_0x48f8('0x2e')]=_[_0x48f8('0x2f')](_0x2969fd[_0x48f8('0x2e')]);_0x421ff6[_0x48f8('0x30')]=_[_0x48f8('0x32')](_0x421ff6[_0x48f8('0x2d')],_0x421ff6['query']);_0x54e94e['attributes']=_[_0x48f8('0x32')](_0x421ff6[_0x48f8('0x2d')],qs[_0x48f8('0x33')](_0x2969fd['query'][_0x48f8('0x33')]));_0x54e94e[_0x48f8('0x31')]=_0x54e94e[_0x48f8('0x31')][_0x48f8('0x34')]?_0x54e94e['attributes']:_0x421ff6[_0x48f8('0x2d')];if(_0x2969fd['query'][_0x48f8('0x3e')]){_0x54e94e[_0x48f8('0x41')]=[{'all':!![]}];}_0x54e94e=_[_0x48f8('0x3b')]({},_0x54e94e,_0x2969fd[_0x48f8('0x3d')]);return db['VoiceDialReport'][_0x48f8('0x42')](_0x54e94e)['then'](handleEntityNotFound(_0x1a6f37,null))[_0x48f8('0x22')](respondWithResult(_0x1a6f37,null))[_0x48f8('0x40')](handleError(_0x1a6f37,null));};exports['create']=function(_0x43d481,_0xf66a79){return db[_0x48f8('0x29')][_0x48f8('0x43')](_0x43d481[_0x48f8('0x44')],{})[_0x48f8('0x22')](respondWithResult(_0xf66a79,0xc9))[_0x48f8('0x40')](handleError(_0xf66a79,null));};exports[_0x48f8('0x21')]=function(_0x2bf673,_0x479bf0){if(_0x2bf673[_0x48f8('0x44')]['id']){delete _0x2bf673['body']['id'];}return db[_0x48f8('0x29')][_0x48f8('0x42')]({'where':{'id':_0x2bf673[_0x48f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x479bf0,null))['then'](saveUpdates(_0x2bf673[_0x48f8('0x44')],null))['then'](respondWithResult(_0x479bf0,null))[_0x48f8('0x40')](handleError(_0x479bf0,null));};exports[_0x48f8('0x23')]=function(_0x393502,_0x3a2298){return db[_0x48f8('0x29')]['find']({'where':{'id':_0x393502[_0x48f8('0x45')]['id']}})[_0x48f8('0x22')](handleEntityNotFound(_0x3a2298,null))['then'](removeEntity(_0x3a2298,null))[_0x48f8('0x40')](handleError(_0x3a2298,null));};exports[_0x48f8('0x46')]=function(_0x152751,_0x4c3587){return db['VoiceDialReport'][_0x48f8('0x46')]()['then'](respondWithResult(_0x4c3587,null))[_0x48f8('0x40')](handleError(_0x4c3587,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3fa9b97..35c65bc 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 _0x4e1c=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x3d66ef,_0x5dd67c){var _0x4f8f7a=function(_0xa23ea4){while(--_0xa23ea4){_0x3d66ef['push'](_0x3d66ef['shift']());}};_0x4f8f7a(++_0x5dd67c);}(_0x4e1c,0x140));var _0xc4e1=function(_0x1c3765,_0xc3b431){_0x1c3765=_0x1c3765-0x0;var _0x3ab003=_0x4e1c[_0x1c3765];return _0x3ab003;};'use strict';var _=require(_0xc4e1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc4e1('0x1'));var BPromise=require(_0xc4e1('0x2'));var rp=require(_0xc4e1('0x3'));var fs=require('fs');var path=require(_0xc4e1('0x4'));var rimraf=require(_0xc4e1('0x5'));var config=require(_0xc4e1('0x6'));var attributes=require(_0xc4e1('0x7'));module[_0xc4e1('0x8')]=function(_0x24acb3,_0x46af79){return _0x24acb3[_0xc4e1('0x9')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x24ba=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','VoiceDialReport','lodash'];(function(_0x188e3b,_0x4b8e01){var _0x5137c9=function(_0x167a06){while(--_0x167a06){_0x188e3b['push'](_0x188e3b['shift']());}};_0x5137c9(++_0x4b8e01);}(_0x24ba,0xf2));var _0xa24b=function(_0x1ffca2,_0x29db27){_0x1ffca2=_0x1ffca2-0x0;var _0x4d061a=_0x24ba[_0x1ffca2];return _0x4d061a;};'use strict';var _=require(_0xa24b('0x0'));var util=require('util');var logger=require(_0xa24b('0x1'))('api');var moment=require(_0xa24b('0x2'));var BPromise=require(_0xa24b('0x3'));var rp=require(_0xa24b('0x4'));var fs=require('fs');var path=require(_0xa24b('0x5'));var rimraf=require(_0xa24b('0x6'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xa24b('0x7')]=function(_0x3bf103,_0x5f37fb){return _0x3bf103['define'](_0xa24b('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 155e80a..fb688a4 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 _0x1b77=['message','VoiceDialReport,\x20%s,\x20%s','result','CreateVoiceDialReport','VoiceDialReport','create','body','raw','UpdateVoiceDialReport','update','options','where','attributes','limit','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xd723be,_0x3c5571){var _0x3d1e14=function(_0x29a978){while(--_0x29a978){_0xd723be['push'](_0xd723be['shift']());}};_0x3d1e14(++_0x3c5571);}(_0x1b77,0xff));var _0x71b7=function(_0x46ecd7,_0x54a514){_0x46ecd7=_0x46ecd7-0x0;var _0x28c5d8=_0x1b77[_0x46ecd7];return _0x28c5d8;};'use strict';var _=require('lodash');var util=require(_0x71b7('0x0'));var moment=require(_0x71b7('0x1'));var BPromise=require(_0x71b7('0x2'));var rs=require(_0x71b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71b7('0x5'));var config=require('../../config/environment');var jayson=require(_0x71b7('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15b9c6,_0x3cb06d,_0x482cf4){return new BPromise(function(_0x53b679,_0x4e7547){return client['request'](_0x15b9c6,_0x482cf4)[_0x71b7('0x7')](function(_0x5ec368){logger[_0x71b7('0x8')]('VoiceDialReport,\x20%s,\x20%s',_0x3cb06d,'request\x20sent');logger[_0x71b7('0x9')](_0x71b7('0xa'),_0x3cb06d,_0x71b7('0xb'),JSON[_0x71b7('0xc')](_0x5ec368));if(_0x5ec368[_0x71b7('0xd')]){if(_0x5ec368[_0x71b7('0xd')][_0x71b7('0xe')]===0x1f4){logger[_0x71b7('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3cb06d,_0x5ec368['error'][_0x71b7('0xf')]);return _0x4e7547(_0x5ec368[_0x71b7('0xd')][_0x71b7('0xf')]);}logger[_0x71b7('0xd')](_0x71b7('0x10'),_0x3cb06d,_0x5ec368[_0x71b7('0xd')][_0x71b7('0xf')]);return _0x53b679(_0x5ec368[_0x71b7('0xd')][_0x71b7('0xf')]);}else{logger[_0x71b7('0x8')](_0x71b7('0x10'),_0x3cb06d,_0x71b7('0xb'));_0x53b679(_0x5ec368[_0x71b7('0x11')][_0x71b7('0xf')]);}})['catch'](function(_0x4ef476){logger[_0x71b7('0xd')](_0x71b7('0x10'),_0x3cb06d,_0x4ef476);_0x4e7547(_0x4ef476);});});}exports[_0x71b7('0x12')]=function(_0x154f82){var _0x11316e=this;return new Promise(function(_0x5ce49a,_0x238145){return db[_0x71b7('0x13')][_0x71b7('0x14')](_0x154f82[_0x71b7('0x15')],{'raw':_0x154f82['options']?_0x154f82['options'][_0x71b7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xca344b){logger['info']('CreateVoiceDialReport',_0x154f82);logger[_0x71b7('0x9')](_0x71b7('0x12'),_0x154f82,JSON[_0x71b7('0xc')](_0xca344b));_0x5ce49a(_0xca344b);})['catch'](function(_0x7a7bcb){logger[_0x71b7('0xd')](_0x71b7('0x12'),_0x7a7bcb[_0x71b7('0xf')],_0x154f82);_0x238145(_0x11316e[_0x71b7('0xd')](0x1f4,_0x7a7bcb[_0x71b7('0xf')]));});});};exports[_0x71b7('0x17')]=function(_0x20d583){var _0x568705=this;return new Promise(function(_0x5902cf,_0x43f66f){return db[_0x71b7('0x13')][_0x71b7('0x18')](_0x20d583[_0x71b7('0x15')],{'raw':_0x20d583['options']?_0x20d583[_0x71b7('0x19')][_0x71b7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d583[_0x71b7('0x19')]?_0x20d583['options'][_0x71b7('0x1a')]||null:null,'attributes':_0x20d583[_0x71b7('0x19')]?_0x20d583['options'][_0x71b7('0x1b')]||null:null,'limit':_0x20d583['options']?_0x20d583[_0x71b7('0x19')][_0x71b7('0x1c')]||null:null})[_0x71b7('0x7')](function(_0x3dd48){logger[_0x71b7('0x8')](_0x71b7('0x17'),_0x20d583);logger[_0x71b7('0x9')]('UpdateVoiceDialReport',_0x20d583,JSON['stringify'](_0x3dd48));_0x5902cf(_0x3dd48);})[_0x71b7('0x1d')](function(_0x19a63c){logger['error'](_0x71b7('0x17'),_0x19a63c['message'],_0x20d583);_0x43f66f(_0x568705[_0x71b7('0xd')](0x1f4,_0x19a63c[_0x71b7('0xf')]));});});}; \ No newline at end of file +var _0xf604=['body','stringify','update','options','raw','where','attributes','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create'];(function(_0x52f66c,_0x3da231){var _0x4eacbb=function(_0x1a41f7){while(--_0x1a41f7){_0x52f66c['push'](_0x52f66c['shift']());}};_0x4eacbb(++_0x3da231);}(_0xf604,0x194));var _0x4f60=function(_0x207202,_0x4d5a09){_0x207202=_0x207202-0x0;var _0x2c5866=_0xf604[_0x207202];return _0x2c5866;};'use strict';var _=require('lodash');var util=require(_0x4f60('0x0'));var moment=require(_0x4f60('0x1'));var BPromise=require(_0x4f60('0x2'));var rs=require(_0x4f60('0x3'));var fs=require('fs');var Redis=require(_0x4f60('0x4'));var db=require(_0x4f60('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f60('0x6'))(_0x4f60('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f60('0x8'));var client=jayson['client'][_0x4f60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3942ea,_0x54097e,_0x4db83e){return new BPromise(function(_0x26fad7,_0x3d459c){return client[_0x4f60('0xa')](_0x3942ea,_0x4db83e)[_0x4f60('0xb')](function(_0x3620c8){logger[_0x4f60('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x54097e,_0x4f60('0xd'));logger[_0x4f60('0xe')](_0x4f60('0xf'),_0x54097e,_0x4f60('0xd'),JSON['stringify'](_0x3620c8));if(_0x3620c8[_0x4f60('0x10')]){if(_0x3620c8[_0x4f60('0x10')][_0x4f60('0x11')]===0x1f4){logger[_0x4f60('0x10')](_0x4f60('0x12'),_0x54097e,_0x3620c8['error']['message']);return _0x3d459c(_0x3620c8[_0x4f60('0x10')][_0x4f60('0x13')]);}logger[_0x4f60('0x10')](_0x4f60('0x12'),_0x54097e,_0x3620c8[_0x4f60('0x10')][_0x4f60('0x13')]);return _0x26fad7(_0x3620c8[_0x4f60('0x10')][_0x4f60('0x13')]);}else{logger[_0x4f60('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x54097e,_0x4f60('0xd'));_0x26fad7(_0x3620c8[_0x4f60('0x14')][_0x4f60('0x13')]);}})[_0x4f60('0x15')](function(_0x2c0755){logger['error'](_0x4f60('0x12'),_0x54097e,_0x2c0755);_0x3d459c(_0x2c0755);});});}exports[_0x4f60('0x16')]=function(_0x23ed80){var _0x454f7c=this;return new Promise(function(_0x4ec69f,_0x358e36){return db[_0x4f60('0x17')][_0x4f60('0x18')](_0x23ed80[_0x4f60('0x19')],{'raw':_0x23ed80['options']?_0x23ed80['options']['raw']===undefined?!![]:![]:!![]})[_0x4f60('0xb')](function(_0x13ae07){logger[_0x4f60('0xc')](_0x4f60('0x16'),_0x23ed80);logger[_0x4f60('0xe')](_0x4f60('0x16'),_0x23ed80,JSON[_0x4f60('0x1a')](_0x13ae07));_0x4ec69f(_0x13ae07);})[_0x4f60('0x15')](function(_0x2b78f8){logger[_0x4f60('0x10')](_0x4f60('0x16'),_0x2b78f8[_0x4f60('0x13')],_0x23ed80);_0x358e36(_0x454f7c[_0x4f60('0x10')](0x1f4,_0x2b78f8[_0x4f60('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x3ec0a4){var _0x3f371a=this;return new Promise(function(_0x2e3ddf,_0x4f01a6){return db['VoiceDialReport'][_0x4f60('0x1b')](_0x3ec0a4[_0x4f60('0x19')],{'raw':_0x3ec0a4['options']?_0x3ec0a4[_0x4f60('0x1c')][_0x4f60('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec0a4['options']?_0x3ec0a4[_0x4f60('0x1c')][_0x4f60('0x1e')]||null:null,'attributes':_0x3ec0a4['options']?_0x3ec0a4[_0x4f60('0x1c')][_0x4f60('0x1f')]||null:null,'limit':_0x3ec0a4[_0x4f60('0x1c')]?_0x3ec0a4[_0x4f60('0x1c')]['limit']||null:null})[_0x4f60('0xb')](function(_0x389ad9){logger['info'](_0x4f60('0x20'),_0x3ec0a4);logger['debug'](_0x4f60('0x20'),_0x3ec0a4,JSON['stringify'](_0x389ad9));_0x2e3ddf(_0x389ad9);})[_0x4f60('0x15')](function(_0xb39ad1){logger['error'](_0x4f60('0x20'),_0xb39ad1[_0x4f60('0x13')],_0x3ec0a4);_0x4f01a6(_0x3f371a[_0x4f60('0x10')](0x1f4,_0xb39ad1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 05e5f5b..36f6fc4 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 _0xa4a4=['show','addApplications','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','isAuthenticated'];(function(_0x116ff3,_0x3045f7){var _0x48d2f1=function(_0x7a67d5){while(--_0x7a67d5){_0x116ff3['push'](_0x116ff3['shift']());}};_0x48d2f1(++_0x3045f7);}(_0xa4a4,0x182));var _0x4a4a=function(_0x99250c,_0x4603c0){_0x99250c=_0x99250c-0x0;var _0x3927d5=_0xa4a4[_0x99250c];return _0x3927d5;};'use strict';var multer=require(_0x4a4a('0x0'));var util=require(_0x4a4a('0x1'));var path=require(_0x4a4a('0x2'));var timeout=require(_0x4a4a('0x3'));var express=require(_0x4a4a('0x4'));var router=express[_0x4a4a('0x5')]();var fs_extra=require(_0x4a4a('0x6'));var auth=require(_0x4a4a('0x7'));var interaction=require(_0x4a4a('0x8'));var config=require(_0x4a4a('0x9'));var controller=require(_0x4a4a('0xa'));router[_0x4a4a('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4a4a('0xc'),auth[_0x4a4a('0xd')](),controller[_0x4a4a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/applications',auth[_0x4a4a('0xd')](),controller[_0x4a4a('0xf')]);router[_0x4a4a('0x10')](_0x4a4a('0xc'),auth[_0x4a4a('0xd')](),controller[_0x4a4a('0x11')]);router[_0x4a4a('0x12')](_0x4a4a('0xc'),auth[_0x4a4a('0xd')](),controller['destroy']);module[_0x4a4a('0x13')]=router; \ No newline at end of file +var _0x45d0=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','/:id','post','create','/:id/applications','put'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x45d0,0xc1));var _0x045d=function(_0x50cd40,_0x309390){_0x50cd40=_0x50cd40-0x0;var _0x3712ed=_0x45d0[_0x50cd40];return _0x3712ed;};'use strict';var multer=require(_0x045d('0x0'));var util=require(_0x045d('0x1'));var path=require(_0x045d('0x2'));var timeout=require(_0x045d('0x3'));var express=require(_0x045d('0x4'));var router=express['Router']();var fs_extra=require(_0x045d('0x5'));var auth=require(_0x045d('0x6'));var interaction=require(_0x045d('0x7'));var config=require(_0x045d('0x8'));var controller=require(_0x045d('0x9'));router['get']('/',auth[_0x045d('0xa')](),controller[_0x045d('0xb')]);router['get'](_0x045d('0xc'),auth[_0x045d('0xa')](),controller['show']);router[_0x045d('0xd')]('/',auth['isAuthenticated'](),controller[_0x045d('0xe')]);router[_0x045d('0xd')](_0x045d('0xf'),auth[_0x045d('0xa')](),controller['addApplications']);router[_0x045d('0x10')]('/:id',auth[_0x045d('0xa')](),controller[_0x045d('0x11')]);router[_0x045d('0x12')](_0x045d('0xc'),auth['isAuthenticated'](),controller[_0x045d('0x13')]);module[_0x045d('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 dd03d06..39b7ea3 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 _0xb513=['outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax'];(function(_0x50c8af,_0x1d844a){var _0x1748eb=function(_0x14d206){while(--_0x14d206){_0x50c8af['push'](_0x50c8af['shift']());}};_0x1748eb(++_0x1d844a);}(_0xb513,0x129));var _0x3b51=function(_0x34bcf6,_0x2cc521){_0x34bcf6=_0x34bcf6-0x0;var _0x54adc9=_0xb513[_0x34bcf6];return _0x54adc9;};'use strict';var Sequelize=require(_0x3b51('0x0'));module[_0x3b51('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3b51('0x2')],'allowNull':![],'unique':_0x3b51('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x3b51('0x3')},'tag':{'type':Sequelize[_0x3b51('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3b51('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3b51('0x4')](_0x3b51('0x5'),_0x3b51('0x6'),_0x3b51('0x7'),_0x3b51('0x8'),_0x3b51('0x9'),_0x3b51('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x3b51('0x2')]},'interval':{'type':Sequelize[_0x3b51('0x2')],'allowNull':![],'defaultValue':_0x3b51('0xb')},'IntervalId':{'type':Sequelize[_0x3b51('0xc')]},'isApp':{'type':Sequelize[_0x3b51('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3b51('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3b51('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3b51('0xc')]},'recordingFormat':{'type':Sequelize[_0x3b51('0x2')],'defaultValue':_0x3b51('0xe')},'answer':{'type':Sequelize[_0x3b51('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3b51('0xf')],'get':function(_0x2595f8){return this[_0x3b51('0x10')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xa483=['inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','NoOp'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0xa483,0x199));var _0x3a48=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa483[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x3a48('0x0'));module[_0x3a48('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3a48('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3a48('0x3')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x3a48('0x2')},'tag':{'type':Sequelize[_0x3a48('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3a48('0x3')],'allowNull':![],'defaultValue':_0x3a48('0x4')},'appdata':{'type':Sequelize[_0x3a48('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x3a48('0x5'),_0x3a48('0x6'),_0x3a48('0x7'),_0x3a48('0x8'),_0x3a48('0x9'),'system',_0x3a48('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3a48('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3a48('0xb')},'IntervalId':{'type':Sequelize[_0x3a48('0xc')]},'isApp':{'type':Sequelize[_0x3a48('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3a48('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3a48('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3a48('0xc')]},'recordingFormat':{'type':Sequelize[_0x3a48('0x3')],'defaultValue':_0x3a48('0xe')},'answer':{'type':Sequelize[_0x3a48('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3a48('0xf')],'get':function(_0x279b10){return this[_0x3a48('0x10')](_0x3a48('0x11'));}},'alias':{'type':Sequelize[_0x3a48('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f1a1b24..1058ae8 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 _0x11dd=['find','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','cutdigits','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','UserProfileResource','end','stack','name','send','VoiceExtension','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','options','includeAll','include','rows','catch','rawAttributes','length'];(function(_0x5ad895,_0x14a31c){var _0x3fae3d=function(_0x14c9ad){while(--_0x14c9ad){_0x5ad895['push'](_0x5ad895['shift']());}};_0x3fae3d(++_0x14a31c);}(_0x11dd,0x171));var _0xd11d=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x11dd[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd11d('0x0'))('api');var config=require(_0xd11d('0x1'));var db=require(_0xd11d('0x2'))['db'];config['redis']=_[_0xd11d('0x3')](config[_0xd11d('0x4')],{'host':_0xd11d('0x5'),'port':0x18eb});var socket=require(_0xd11d('0x6'))(new Redis(config[_0xd11d('0x4')]));require(_0xd11d('0x7'))['register'](socket);function respondWithStatusCode(_0x443d4f,_0x107ab9){_0x107ab9=_0x107ab9||0xcc;return function(_0xb7988b){if(_0xb7988b){return _0x443d4f[_0xd11d('0x8')](_0x107ab9);}return _0x443d4f[_0xd11d('0x9')](_0x107ab9)['end']();};}function respondWithResult(_0x30ce85,_0x447d45){_0x447d45=_0x447d45||0xc8;return function(_0x44ec86){if(_0x44ec86){return _0x30ce85[_0xd11d('0x9')](_0x447d45)[_0xd11d('0xa')](_0x44ec86);}};}function respondWithFilteredResult(_0x48107c,_0x2e6b41){return function(_0x2e6bd0){if(_0x2e6bd0){var _0x17b351=typeof _0x2e6b41['offset']===_0xd11d('0xb')&&typeof _0x2e6b41[_0xd11d('0xc')]===_0xd11d('0xb');var _0xbab772=_0x2e6bd0[_0xd11d('0xd')];var _0x243cb4=_0x17b351?0x0:_0x2e6b41[_0xd11d('0xe')];var _0x23aa12=_0x17b351?_0x2e6bd0[_0xd11d('0xd')]:_0x2e6b41['offset']+_0x2e6b41['limit'];var _0x58e543;if(_0x23aa12>=_0xbab772){_0x23aa12=_0xbab772;_0x58e543=0xc8;}else{_0x58e543=0xce;}_0x48107c[_0xd11d('0x9')](_0x58e543);return _0x48107c[_0xd11d('0xf')](_0xd11d('0x10'),_0x243cb4+'-'+_0x23aa12+'/'+_0xbab772)[_0xd11d('0xa')](_0x2e6bd0);}return null;};}function removeEntity(_0x595747){return function(_0x543e5a){if(_0x543e5a){return _0x543e5a[_0xd11d('0x11')]()[_0xd11d('0x12')](function(){var _0x5f12c1=_0x543e5a['get']({'plain':!![]});var _0x4aa4db=[{'name':'InboundRoutes','value':_0xd11d('0x13'),'ignore':![]},{'name':_0xd11d('0x14'),'value':_0xd11d('0x15'),'ignore':![]},{'name':_0xd11d('0x16'),'value':_0xd11d('0x17'),'ignore':![]}];var _0x55e386=_(_0x4aa4db)[_0xd11d('0x18')](_0xd11d('0x19'))[_0xd11d('0x1a')](_0xd11d('0x1b'))[_0xd11d('0x1b')]();if(_[_0xd11d('0x1c')](_0x55e386,_0x5f12c1['type'])){return;}var _0x434255=_['find'](_0x4aa4db,['value',_0x5f12c1['type']])['name'];return db[_0xd11d('0x1d')]['destroy']({'where':{'type':_0x434255,'resourceId':_0x5f12c1['id']}})['then'](function(){return _0x543e5a;});})[_0xd11d('0x12')](function(){_0x595747['status'](0xcc)[_0xd11d('0x1e')]();});}};}function handleEntityNotFound(_0x405162){return function(_0x21201b){if(!_0x21201b){_0x405162[_0xd11d('0x8')](0x194);}return _0x21201b;};}function handleError(_0x143cbf,_0x477767){_0x477767=_0x477767||0x1f4;return function(_0x16a884){logger['error'](_0x16a884[_0xd11d('0x1f')]);if(_0x16a884[_0xd11d('0x20')]){delete _0x16a884['name'];}_0x143cbf[_0xd11d('0x9')](_0x477767)[_0xd11d('0x21')](_0x16a884);};}exports['index']=function(_0x33980d,_0x222827){var _0x59a80c={},_0x425beb={},_0x301e27={'count':0x0,'rows':[]};var _0x4a4cd4=_[_0xd11d('0x1a')](db[_0xd11d('0x22')]['rawAttributes'],function(_0x198e9e){return{'name':_0x198e9e[_0xd11d('0x23')],'type':_0x198e9e[_0xd11d('0x24')][_0xd11d('0x25')]};});_0x425beb[_0xd11d('0x26')]=_[_0xd11d('0x1a')](_0x4a4cd4,'name');_0x425beb[_0xd11d('0x27')]=_[_0xd11d('0x28')](_0x33980d[_0xd11d('0x27')]);_0x425beb[_0xd11d('0x29')]=_[_0xd11d('0x2a')](_0x425beb[_0xd11d('0x26')],_0x425beb[_0xd11d('0x27')]);_0x59a80c[_0xd11d('0x2b')]=_[_0xd11d('0x2a')](_0x425beb[_0xd11d('0x26')],qs[_0xd11d('0x2c')](_0x33980d[_0xd11d('0x27')][_0xd11d('0x2c')]));_0x59a80c[_0xd11d('0x2b')]=_0x59a80c[_0xd11d('0x2b')]['length']?_0x59a80c[_0xd11d('0x2b')]:_0x425beb[_0xd11d('0x26')];if(!_0x33980d['query']['hasOwnProperty']('nolimit')){_0x59a80c['limit']=qs[_0xd11d('0xc')](_0x33980d[_0xd11d('0x27')]['limit']);_0x59a80c[_0xd11d('0xe')]=qs['offset'](_0x33980d[_0xd11d('0x27')][_0xd11d('0xe')]);}_0x59a80c[_0xd11d('0x2d')]=qs[_0xd11d('0x2e')](_0x33980d[_0xd11d('0x27')][_0xd11d('0x2e')]);_0x59a80c[_0xd11d('0x2f')]=qs[_0xd11d('0x29')](_['pick'](_0x33980d[_0xd11d('0x27')],_0x425beb[_0xd11d('0x29')]),_0x4a4cd4);if(_0x33980d[_0xd11d('0x27')][_0xd11d('0x18')]){_0x59a80c[_0xd11d('0x2f')]=_[_0xd11d('0x30')](_0x59a80c[_0xd11d('0x2f')],{'$or':_[_0xd11d('0x1a')](_0x4a4cd4,function(_0x4b1a8f){if(_0x4b1a8f['type']!=='VIRTUAL'){var _0x23018a={};_0x23018a[_0x4b1a8f[_0xd11d('0x20')]]={'$like':'%'+_0x33980d[_0xd11d('0x27')][_0xd11d('0x18')]+'%'};return _0x23018a;}})});}_0x59a80c=_[_0xd11d('0x30')]({},_0x59a80c,_0x33980d[_0xd11d('0x31')]);var _0x27c15d={'where':_0x59a80c[_0xd11d('0x2f')]};return db[_0xd11d('0x22')][_0xd11d('0xd')](_0x27c15d)[_0xd11d('0x12')](function(_0x548ab9){_0x301e27[_0xd11d('0xd')]=_0x548ab9;if(_0x33980d[_0xd11d('0x27')][_0xd11d('0x32')]){_0x59a80c[_0xd11d('0x33')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x59a80c);})[_0xd11d('0x12')](function(_0x25c4dc){_0x301e27[_0xd11d('0x34')]=_0x25c4dc;return _0x301e27;})[_0xd11d('0x12')](respondWithFilteredResult(_0x222827,_0x59a80c))[_0xd11d('0x35')](handleError(_0x222827,null));};exports['show']=function(_0x5dc0c0,_0x12f07e){var _0x265d54={'raw':![],'where':{'id':_0x5dc0c0['params']['id']}},_0x15737a={};_0x15737a['model']=_[_0xd11d('0x28')](db[_0xd11d('0x22')][_0xd11d('0x36')]);_0x15737a['query']=_[_0xd11d('0x28')](_0x5dc0c0['query']);_0x15737a['filters']=_['intersection'](_0x15737a[_0xd11d('0x26')],_0x15737a[_0xd11d('0x27')]);_0x265d54['attributes']=_[_0xd11d('0x2a')](_0x15737a[_0xd11d('0x26')],qs['fields'](_0x5dc0c0[_0xd11d('0x27')]['fields']));_0x265d54[_0xd11d('0x2b')]=_0x265d54[_0xd11d('0x2b')][_0xd11d('0x37')]?_0x265d54['attributes']:_0x15737a['model'];if(_0x5dc0c0['query'][_0xd11d('0x32')]){_0x265d54[_0xd11d('0x33')]=[{'all':!![]}];}_0x265d54=_['merge']({},_0x265d54,_0x5dc0c0[_0xd11d('0x31')]);return db['VoiceExtension'][_0xd11d('0x38')](_0x265d54)[_0xd11d('0x12')](handleEntityNotFound(_0x12f07e,null))[_0xd11d('0x12')](respondWithResult(_0x12f07e,null))[_0xd11d('0x35')](handleError(_0x12f07e,null));};exports[_0xd11d('0x11')]=function(_0x323eda,_0x178b83){return db[_0xd11d('0x22')]['find']({'where':{'id':_0x323eda[_0xd11d('0x39')]['id']}})[_0xd11d('0x12')](handleEntityNotFound(_0x178b83,null))[_0xd11d('0x12')](removeEntity(_0x178b83,null))[_0xd11d('0x35')](handleError(_0x178b83,null));};exports[_0xd11d('0x3a')]=function(_0xae5c33,_0x5b4707){if(_0xae5c33[_0xd11d('0x3b')]['type']==='outbound'&&!_['startsWith'](_0xae5c33[_0xd11d('0x3b')][_0xd11d('0x3c')],'_')){_0xae5c33[_0xd11d('0x3b')][_0xd11d('0x3c')]='_'[_0xd11d('0x3d')](_0xae5c33[_0xd11d('0x3b')][_0xd11d('0x3c')]);}return db[_0xd11d('0x22')][_0xd11d('0x3a')](_0xae5c33[_0xd11d('0x3b')],{'raw':![]})[_0xd11d('0x12')](function(_0x316ff4){var _0x5a86ea=_0xae5c33[_0xd11d('0x3e')][_0xd11d('0x3f')]({'plain':!![]});if(!_0x5a86ea)throw new Error(_0xd11d('0x40'));if(_0x5a86ea['role']===_0xd11d('0x3e')){var _0x211e15=_0x316ff4[_0xd11d('0x3f')]({'plain':!![]});var _0xe6a527=[{'name':_0xd11d('0x41'),'value':_0xd11d('0x13')},{'name':_0xd11d('0x14'),'value':_0xd11d('0x15')},{'name':_0xd11d('0x16'),'value':'internal'}];var _0x36b823=_[_0xd11d('0x38')](_0xe6a527,[_0xd11d('0x1b'),_0x211e15[_0xd11d('0x24')]])[_0xd11d('0x20')];return db[_0xd11d('0x42')][_0xd11d('0x38')]({'where':{'name':_0x36b823,'userProfileId':_0x5a86ea['userProfileId']},'raw':!![]})[_0xd11d('0x12')](function(_0x2bcd34){if(_0x2bcd34&&_0x2bcd34[_0xd11d('0x43')]===0x0){return db['UserProfileResource'][_0xd11d('0x3a')]({'name':_0x211e15['name'],'resourceId':_0x211e15['id'],'type':_0x2bcd34[_0xd11d('0x20')],'sectionId':_0x2bcd34['id']},{})[_0xd11d('0x12')](function(){return _0x316ff4;});}else{return _0x316ff4;}})[_0xd11d('0x35')](function(_0x44ea9a){logger[_0xd11d('0x44')](_0xd11d('0x45'),_0x44ea9a);throw _0x44ea9a;});}return _0x316ff4;})[_0xd11d('0x12')](respondWithResult(_0x5b4707,0xc9))['catch'](handleError(_0x5b4707,null));};exports[_0xd11d('0x46')]=function(_0x2a8636,_0x6355af){if(_0x2a8636[_0xd11d('0x3b')]['id']){delete _0x2a8636[_0xd11d('0x3b')]['id'];}return db[_0xd11d('0x22')][_0xd11d('0x38')]({'where':{'id':_0x2a8636[_0xd11d('0x39')]['id']}})[_0xd11d('0x12')](handleEntityNotFound(_0x6355af,null))[_0xd11d('0x12')](function(_0x12f3ca){if(_0x12f3ca){return db[_0xd11d('0x22')][_0xd11d('0x46')](_[_0xd11d('0x47')](_0x2a8636['body'],['exten',_0xd11d('0x48'),'description','recordingFormat',_0xd11d('0x49'),_0xd11d('0x4a'),_0xd11d('0x4b')]),{'where':{'context':_0x12f3ca[_0xd11d('0x48')],'exten':_0x12f3ca['exten']},'individualHooks':!![]})[_0xd11d('0x12')](function(_0x4c7824){return _0x4c7824;});}return null;})[_0xd11d('0x12')](respondWithStatusCode(_0x6355af,null))[_0xd11d('0x35')](handleError(_0x6355af,null));};exports['addApplications']=function(_0xd1a50,_0x17dfa4){var _0x4052bc=_0xd1a50[_0xd11d('0x39')]['id'];var _0x31e2fc=_0xd1a50['body'];var _0x288769=0xc8;var _0x3c0fc0=null;return db[_0xd11d('0x4c')][_0xd11d('0x4d')]({'isolationLevel':db[_0xd11d('0x4c')]['Transaction'][_0xd11d('0x4e')][_0xd11d('0x4f')]},function(_0x1d97be){return db[_0xd11d('0x22')]['findOne']({'where':{'id':_0x4052bc},'transaction':_0x1d97be})[_0xd11d('0x12')](function(_0x3d8915){if(_0x3d8915){return db[_0xd11d('0x22')][_0xd11d('0x11')]({'where':{'VoiceExtensionId':_0x4052bc},'transaction':_0x1d97be})[_0xd11d('0x12')](function(){var _0x29f4a0=_[_0xd11d('0x1a')](_0x31e2fc,function(_0x37b3c5){_0x37b3c5[_0xd11d('0x50')]=_0x4052bc;_0x37b3c5[_0xd11d('0x51')]=!![];return _0x37b3c5;});return _0x3d8915[_0xd11d('0x52')](_0x29f4a0);})['then'](function(_0x39c12e){return db[_0xd11d('0x22')][_0xd11d('0x53')](_0x39c12e,{'transaction':_0x1d97be});});}else{_0x288769=0x194;_0x3c0fc0=[];}});})[_0xd11d('0x12')](function(){if(_0x288769!==0x194){return db[_0xd11d('0x22')][_0xd11d('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4052bc},'order':'cast(priority\x20as\x20unsigned)'})[_0xd11d('0x12')](function(_0x168426){_0x3c0fc0=_0x168426;});}})[_0xd11d('0x35')](function(_0x24a2dc){_0x288769=0x1f4;logger[_0xd11d('0x44')](_0x24a2dc[_0xd11d('0x1f')]);if(_0x24a2dc[_0xd11d('0x20')]){delete _0x24a2dc[_0xd11d('0x20')];}_0x3c0fc0=_0x24a2dc;})['finally'](function(){if(_0x3c0fc0===null){_0x17dfa4['sendStatus'](_0x288769);}else{if(_0x288769===0x1f4){_0x17dfa4[_0xd11d('0x9')](_0x288769)[_0xd11d('0x21')](_0x3c0fc0);}else{_0x17dfa4[_0xd11d('0x9')](_0x288769)[_0xd11d('0xa')](_0x3c0fc0);}}});}; \ No newline at end of file +var _0x080c=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','keys','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','error','update','context','description','recordingFormat','mandatoryDisposition','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','send','ioredis'];(function(_0xe2a258,_0x24daca){var _0x319fd6=function(_0x3834a7){while(--_0x3834a7){_0xe2a258['push'](_0xe2a258['shift']());}};_0x319fd6(++_0x24daca);}(_0x080c,0x173));var _0xc080=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x080c[_0x102f97];return _0xd22058;};'use strict';var _=require('lodash');var Redis=require(_0xc080('0x0'));var qs=require(_0xc080('0x1'));var logger=require(_0xc080('0x2'))(_0xc080('0x3'));var config=require('../../config/environment');var db=require(_0xc080('0x4'))['db'];config[_0xc080('0x5')]=_['defaults'](config[_0xc080('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xc080('0x6'))(new Redis(config[_0xc080('0x5')]));require('./voiceExtension.socket')[_0xc080('0x7')](socket);function respondWithStatusCode(_0x23ee12,_0x97992e){_0x97992e=_0x97992e||0xcc;return function(_0x50a949){if(_0x50a949){return _0x23ee12[_0xc080('0x8')](_0x97992e);}return _0x23ee12['status'](_0x97992e)[_0xc080('0x9')]();};}function respondWithResult(_0x295067,_0x4f40dc){_0x4f40dc=_0x4f40dc||0xc8;return function(_0x5e3920){if(_0x5e3920){return _0x295067[_0xc080('0xa')](_0x4f40dc)[_0xc080('0xb')](_0x5e3920);}};}function respondWithFilteredResult(_0xe80722,_0x32bbbc){return function(_0x3c1fc6){if(_0x3c1fc6){var _0x58904b=typeof _0x32bbbc[_0xc080('0xc')]==='undefined'&&typeof _0x32bbbc[_0xc080('0xd')]===_0xc080('0xe');var _0x86dfc9=_0x3c1fc6[_0xc080('0xf')];var _0x42ea33=_0x58904b?0x0:_0x32bbbc[_0xc080('0xc')];var _0x45c273=_0x58904b?_0x3c1fc6[_0xc080('0xf')]:_0x32bbbc[_0xc080('0xc')]+_0x32bbbc[_0xc080('0xd')];var _0x411570;if(_0x45c273>=_0x86dfc9){_0x45c273=_0x86dfc9;_0x411570=0xc8;}else{_0x411570=0xce;}_0xe80722[_0xc080('0xa')](_0x411570);return _0xe80722[_0xc080('0x10')](_0xc080('0x11'),_0x42ea33+'-'+_0x45c273+'/'+_0x86dfc9)[_0xc080('0xb')](_0x3c1fc6);}return null;};}function removeEntity(_0x4113dc){return function(_0x407f1a){if(_0x407f1a){return _0x407f1a[_0xc080('0x12')]()[_0xc080('0x13')](function(){var _0x1089d3=_0x407f1a[_0xc080('0x14')]({'plain':!![]});var _0x48f25c=[{'name':_0xc080('0x15'),'value':'inbound','ignore':![]},{'name':_0xc080('0x16'),'value':_0xc080('0x17'),'ignore':![]},{'name':_0xc080('0x18'),'value':_0xc080('0x19'),'ignore':![]}];var _0x17bea9=_(_0x48f25c)[_0xc080('0x1a')](_0xc080('0x1b'))[_0xc080('0x1c')]('value')[_0xc080('0x1d')]();if(_['includes'](_0x17bea9,_0x1089d3[_0xc080('0x1e')])){return;}var _0x3025b4=_[_0xc080('0x1f')](_0x48f25c,[_0xc080('0x1d'),_0x1089d3[_0xc080('0x1e')]])[_0xc080('0x20')];return db[_0xc080('0x21')]['destroy']({'where':{'type':_0x3025b4,'resourceId':_0x1089d3['id']}})[_0xc080('0x13')](function(){return _0x407f1a;});})[_0xc080('0x13')](function(){_0x4113dc[_0xc080('0xa')](0xcc)[_0xc080('0x9')]();});}};}function handleEntityNotFound(_0x5c737a){return function(_0x4bfd2d){if(!_0x4bfd2d){_0x5c737a[_0xc080('0x8')](0x194);}return _0x4bfd2d;};}function handleError(_0x32a1bf,_0x4c196d){_0x4c196d=_0x4c196d||0x1f4;return function(_0x44bcb7){logger['error'](_0x44bcb7['stack']);if(_0x44bcb7[_0xc080('0x20')]){delete _0x44bcb7[_0xc080('0x20')];}_0x32a1bf[_0xc080('0xa')](_0x4c196d)['send'](_0x44bcb7);};}exports['index']=function(_0xa22382,_0x3cf959){var _0x1c8d64={},_0x48af08={},_0x557343={'count':0x0,'rows':[]};var _0x3b962a=_[_0xc080('0x1c')](db['VoiceExtension'][_0xc080('0x22')],function(_0x1b1570){return{'name':_0x1b1570[_0xc080('0x23')],'type':_0x1b1570[_0xc080('0x1e')][_0xc080('0x24')]};});_0x48af08[_0xc080('0x25')]=_['map'](_0x3b962a,_0xc080('0x20'));_0x48af08[_0xc080('0x26')]=_['keys'](_0xa22382[_0xc080('0x26')]);_0x48af08[_0xc080('0x27')]=_[_0xc080('0x28')](_0x48af08['model'],_0x48af08[_0xc080('0x26')]);_0x1c8d64[_0xc080('0x29')]=_[_0xc080('0x28')](_0x48af08['model'],qs[_0xc080('0x2a')](_0xa22382['query'][_0xc080('0x2a')]));_0x1c8d64[_0xc080('0x29')]=_0x1c8d64[_0xc080('0x29')][_0xc080('0x2b')]?_0x1c8d64[_0xc080('0x29')]:_0x48af08[_0xc080('0x25')];if(!_0xa22382[_0xc080('0x26')][_0xc080('0x2c')](_0xc080('0x2d'))){_0x1c8d64['limit']=qs[_0xc080('0xd')](_0xa22382[_0xc080('0x26')][_0xc080('0xd')]);_0x1c8d64[_0xc080('0xc')]=qs[_0xc080('0xc')](_0xa22382['query'][_0xc080('0xc')]);}_0x1c8d64[_0xc080('0x2e')]=qs[_0xc080('0x2f')](_0xa22382['query'][_0xc080('0x2f')]);_0x1c8d64[_0xc080('0x30')]=qs[_0xc080('0x27')](_[_0xc080('0x31')](_0xa22382['query'],_0x48af08['filters']),_0x3b962a);if(_0xa22382[_0xc080('0x26')][_0xc080('0x1a')]){_0x1c8d64[_0xc080('0x30')]=_[_0xc080('0x32')](_0x1c8d64['where'],{'$or':_['map'](_0x3b962a,function(_0x41d948){if(_0x41d948[_0xc080('0x1e')]!==_0xc080('0x33')){var _0x58b6c9={};_0x58b6c9[_0x41d948[_0xc080('0x20')]]={'$like':'%'+_0xa22382['query'][_0xc080('0x1a')]+'%'};return _0x58b6c9;}})});}_0x1c8d64=_[_0xc080('0x32')]({},_0x1c8d64,_0xa22382[_0xc080('0x34')]);var _0x48b617={'where':_0x1c8d64['where']};return db[_0xc080('0x35')]['count'](_0x48b617)[_0xc080('0x13')](function(_0x3947a6){_0x557343[_0xc080('0xf')]=_0x3947a6;if(_0xa22382[_0xc080('0x26')][_0xc080('0x36')]){_0x1c8d64[_0xc080('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0xc080('0x38')](_0x1c8d64);})['then'](function(_0x2e9218){_0x557343[_0xc080('0x39')]=_0x2e9218;return _0x557343;})[_0xc080('0x13')](respondWithFilteredResult(_0x3cf959,_0x1c8d64))[_0xc080('0x3a')](handleError(_0x3cf959,null));};exports[_0xc080('0x3b')]=function(_0x3ea4b9,_0x4b9609){var _0xeecbe0={'raw':![],'where':{'id':_0x3ea4b9[_0xc080('0x3c')]['id']}},_0x55964a={};_0x55964a[_0xc080('0x25')]=_[_0xc080('0x3d')](db['VoiceExtension'][_0xc080('0x22')]);_0x55964a[_0xc080('0x26')]=_[_0xc080('0x3d')](_0x3ea4b9[_0xc080('0x26')]);_0x55964a[_0xc080('0x27')]=_[_0xc080('0x28')](_0x55964a[_0xc080('0x25')],_0x55964a[_0xc080('0x26')]);_0xeecbe0[_0xc080('0x29')]=_[_0xc080('0x28')](_0x55964a[_0xc080('0x25')],qs[_0xc080('0x2a')](_0x3ea4b9['query'][_0xc080('0x2a')]));_0xeecbe0[_0xc080('0x29')]=_0xeecbe0[_0xc080('0x29')][_0xc080('0x2b')]?_0xeecbe0[_0xc080('0x29')]:_0x55964a[_0xc080('0x25')];if(_0x3ea4b9[_0xc080('0x26')][_0xc080('0x36')]){_0xeecbe0[_0xc080('0x37')]=[{'all':!![]}];}_0xeecbe0=_[_0xc080('0x32')]({},_0xeecbe0,_0x3ea4b9[_0xc080('0x34')]);return db[_0xc080('0x35')][_0xc080('0x1f')](_0xeecbe0)[_0xc080('0x13')](handleEntityNotFound(_0x4b9609,null))[_0xc080('0x13')](respondWithResult(_0x4b9609,null))['catch'](handleError(_0x4b9609,null));};exports[_0xc080('0x12')]=function(_0x5f5d84,_0x583bed){return db[_0xc080('0x35')][_0xc080('0x1f')]({'where':{'id':_0x5f5d84[_0xc080('0x3c')]['id']}})[_0xc080('0x13')](handleEntityNotFound(_0x583bed,null))[_0xc080('0x13')](removeEntity(_0x583bed,null))[_0xc080('0x3a')](handleError(_0x583bed,null));};exports[_0xc080('0x3e')]=function(_0x28ab51,_0x5bdb32){if(_0x28ab51[_0xc080('0x3f')]['type']===_0xc080('0x17')&&!_[_0xc080('0x40')](_0x28ab51['body'][_0xc080('0x41')],'_')){_0x28ab51['body'][_0xc080('0x41')]='_'[_0xc080('0x42')](_0x28ab51['body'][_0xc080('0x41')]);}return db[_0xc080('0x35')][_0xc080('0x3e')](_0x28ab51[_0xc080('0x3f')],{'raw':![]})['then'](function(_0x15b0ff){var _0x67d335=_0x28ab51[_0xc080('0x43')]['get']({'plain':!![]});if(!_0x67d335)throw new Error(_0xc080('0x44'));if(_0x67d335[_0xc080('0x45')]==='user'){var _0x1073a5=_0x15b0ff[_0xc080('0x14')]({'plain':!![]});var _0xfe5ec5=[{'name':_0xc080('0x15'),'value':_0xc080('0x46')},{'name':_0xc080('0x16'),'value':_0xc080('0x17')},{'name':'InternalRoutes','value':_0xc080('0x19')}];var _0x1742f0=_[_0xc080('0x1f')](_0xfe5ec5,[_0xc080('0x1d'),_0x1073a5['type']])[_0xc080('0x20')];return db[_0xc080('0x47')][_0xc080('0x1f')]({'where':{'name':_0x1742f0,'userProfileId':_0x67d335[_0xc080('0x48')]},'raw':!![]})[_0xc080('0x13')](function(_0x40c761){if(_0x40c761&&_0x40c761[_0xc080('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x1073a5[_0xc080('0x20')],'resourceId':_0x1073a5['id'],'type':_0x40c761['name'],'sectionId':_0x40c761['id']},{})[_0xc080('0x13')](function(){return _0x15b0ff;});}else{return _0x15b0ff;}})[_0xc080('0x3a')](function(_0x4950d2){logger[_0xc080('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4950d2);throw _0x4950d2;});}return _0x15b0ff;})[_0xc080('0x13')](respondWithResult(_0x5bdb32,0xc9))['catch'](handleError(_0x5bdb32,null));};exports[_0xc080('0x4b')]=function(_0x275367,_0x5a8c37){if(_0x275367['body']['id']){delete _0x275367[_0xc080('0x3f')]['id'];}return db[_0xc080('0x35')][_0xc080('0x1f')]({'where':{'id':_0x275367[_0xc080('0x3c')]['id']}})[_0xc080('0x13')](handleEntityNotFound(_0x5a8c37,null))[_0xc080('0x13')](function(_0x2c7a4a){if(_0x2c7a4a){return db['VoiceExtension'][_0xc080('0x4b')](_[_0xc080('0x31')](_0x275367['body'],[_0xc080('0x41'),_0xc080('0x4c'),_0xc080('0x4d'),_0xc080('0x4e'),'cutdigits',_0xc080('0x4f'),'alias']),{'where':{'context':_0x2c7a4a[_0xc080('0x4c')],'exten':_0x2c7a4a[_0xc080('0x41')]},'individualHooks':!![]})[_0xc080('0x13')](function(_0x5041ea){return _0x5041ea;});}return null;})[_0xc080('0x13')](respondWithStatusCode(_0x5a8c37,null))['catch'](handleError(_0x5a8c37,null));};exports[_0xc080('0x50')]=function(_0x4166e7,_0x2c6a7a){var _0x8b590=_0x4166e7[_0xc080('0x3c')]['id'];var _0x2ded57=_0x4166e7[_0xc080('0x3f')];var _0x16d82e=0xc8;var _0x56fcbc=null;return db['sequelize'][_0xc080('0x51')]({'isolationLevel':db[_0xc080('0x52')][_0xc080('0x53')]['ISOLATION_LEVELS'][_0xc080('0x54')]},function(_0x3c71ad){return db[_0xc080('0x35')][_0xc080('0x55')]({'where':{'id':_0x8b590},'transaction':_0x3c71ad})['then'](function(_0x2793e9){if(_0x2793e9){return db[_0xc080('0x35')][_0xc080('0x12')]({'where':{'VoiceExtensionId':_0x8b590},'transaction':_0x3c71ad})[_0xc080('0x13')](function(){var _0x3b6939=_['map'](_0x2ded57,function(_0x319b22){_0x319b22[_0xc080('0x56')]=_0x8b590;_0x319b22['isApp']=!![];return _0x319b22;});return _0x2793e9['createRouting'](_0x3b6939);})[_0xc080('0x13')](function(_0x33b1d7){return db[_0xc080('0x35')][_0xc080('0x57')](_0x33b1d7,{'transaction':_0x3c71ad});});}else{_0x16d82e=0x194;_0x56fcbc=[];}});})[_0xc080('0x13')](function(){if(_0x16d82e!==0x194){return db[_0xc080('0x35')][_0xc080('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x8b590},'order':_0xc080('0x59')})['then'](function(_0x406b8b){_0x56fcbc=_0x406b8b;});}})[_0xc080('0x3a')](function(_0x4b2b64){_0x16d82e=0x1f4;logger[_0xc080('0x4a')](_0x4b2b64[_0xc080('0x5a')]);if(_0x4b2b64['name']){delete _0x4b2b64[_0xc080('0x20')];}_0x56fcbc=_0x4b2b64;})[_0xc080('0x5b')](function(){if(_0x56fcbc===null){_0x2c6a7a['sendStatus'](_0x16d82e);}else{if(_0x16d82e===0x1f4){_0x2c6a7a['status'](_0x16d82e)[_0xc080('0x5c')](_0x56fcbc);}else{_0x2c6a7a[_0xc080('0xa')](_0x16d82e)[_0xc080('0xb')](_0x56fcbc);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 419cde5..a2307c0 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 _0xaaae=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x322721,_0x50af25){var _0x5d566a=function(_0x419627){while(--_0x419627){_0x322721['push'](_0x322721['shift']());}};_0x5d566a(++_0x50af25);}(_0xaaae,0x6f));var _0xeaaa=function(_0x20d3d7,_0x5558a3){_0x20d3d7=_0x20d3d7-0x0;var _0x2c70bd=_0xaaae[_0x20d3d7];return _0x2c70bd;};'use strict';var EventEmitter=require(_0xeaaa('0x0'));var VoiceExtension=require(_0xeaaa('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xeaaa('0x2')](0x0);var events={'afterCreate':_0xeaaa('0x3'),'afterUpdate':'update','afterDestroy':_0xeaaa('0x4')};function emitEvent(_0x5c6579){return function(_0x5613f5,_0x2b055a,_0x8b747f){VoiceExtensionEvents[_0xeaaa('0x5')](_0x5c6579+':'+_0x5613f5['id'],_0x5613f5);VoiceExtensionEvents['emit'](_0x5c6579,_0x5613f5);_0x8b747f(null);};}for(var e in events){if(events[_0xeaaa('0x6')](e)){var event=events[e];VoiceExtension[_0xeaaa('0x7')](e,emitEvent(event));}}module[_0xeaaa('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x79dd=['remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x14f55c,_0x2adaaf){var _0x513e7a=function(_0x1d8145){while(--_0x1d8145){_0x14f55c['push'](_0x14f55c['shift']());}};_0x513e7a(++_0x2adaaf);}(_0x79dd,0xd6));var _0xd79d=function(_0x41b3d6,_0x21daa8){_0x41b3d6=_0x41b3d6-0x0;var _0x3e60ca=_0x79dd[_0x41b3d6];return _0x3e60ca;};'use strict';var EventEmitter=require(_0xd79d('0x0'));var VoiceExtension=require(_0xd79d('0x1'))['db'][_0xd79d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd79d('0x3')](0x0);var events={'afterCreate':_0xd79d('0x4'),'afterUpdate':_0xd79d('0x5'),'afterDestroy':_0xd79d('0x6')};function emitEvent(_0x1f17c0){return function(_0x2f902f,_0x1c7740,_0x183cf2){VoiceExtensionEvents[_0xd79d('0x7')](_0x1f17c0+':'+_0x2f902f['id'],_0x2f902f);VoiceExtensionEvents['emit'](_0x1f17c0,_0x2f902f);_0x183cf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xd79d('0x8')](e,emitEvent(event));}}module[_0xd79d('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 3887ca7..97075da 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 _0xe4ef=['Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','length','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','then','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','NoOp','CDR(routeAlias)=','alias','exten','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN}','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','${EXTEN:','indexOf','U(xcally-mixmonitor-context)','join','isEmpty'];(function(_0x10ced5,_0x54e444){var _0x25f816=function(_0x365f4f){while(--_0x365f4f){_0x10ced5['push'](_0x10ced5['shift']());}};_0x25f816(++_0x54e444);}(_0xe4ef,0x17b));var _0xfe4e=function(_0x29d52c,_0x46d811){_0x29d52c=_0x29d52c-0x0;var _0x515c23=_0xe4ef[_0x29d52c];return _0x515c23;};'use strict';var _=require(_0xfe4e('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xfe4e('0x1')]=function(_0x4f41e1){var _0x122a86=_0x4f41e1[_0xfe4e('0x2')];function _0x1870de(_0x1959ff){var _0x141ba0=0x2;var _0x246ba1=[{'type':_0x1959ff[_0xfe4e('0x3')],'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x5')+_0x1959ff['type'],'context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff['exten'],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']},{'type':_0x1959ff[_0xfe4e('0x3')],'app':_0x1959ff['alias']?_0xfe4e('0x4'):_0xfe4e('0x7'),'appdata':_0x1959ff['alias']?_0xfe4e('0x8')+_0x1959ff[_0xfe4e('0x9')]:'No\x20alias\x20set','context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff[_0xfe4e('0xa')],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']}];if(_0x1959ff[_0xfe4e('0x3')]===_0xfe4e('0xb')){_0x246ba1['push']({'type':'inbound','app':'Set','appdata':_0xfe4e('0xc')+_0x1959ff['id'],'context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff['exten'],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']});}_0x246ba1[_0xfe4e('0xd')]({'type':_0x1959ff[_0xfe4e('0x3')],'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0xe'),'context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff['exten'],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']},{'type':_0x1959ff[_0xfe4e('0x3')],'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0xf'),'context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff['exten'],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']},{'type':_0x1959ff[_0xfe4e('0x3')],'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x10'),'context':_0x1959ff[_0xfe4e('0x6')],'exten':_0x1959ff[_0xfe4e('0xa')],'priority':_0x141ba0++,'VoiceExtensionId':_0x1959ff['id']});return _0x246ba1;}function _0x2dcd52(_0x4a2db5){var _0x488058=0x2;var _0x5d3fc1=[{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x12'),'context':_0x4a2db5['context'],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0x4a2db5['alias']?_0xfe4e('0x4'):_0xfe4e('0x7'),'appdata':_0x4a2db5['alias']?_0xfe4e('0x8')+_0x4a2db5[_0xfe4e('0x9')]:'No\x20alias\x20set','context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':'Set','appdata':_0xfe4e('0x13')+(_0x4a2db5['cutdigits']?'${EXTEN:'+_0x4a2db5['cutdigits']+'}':_0xfe4e('0x14')),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':'CDR(routeid)='+_0x4a2db5['id'],'context':_0x4a2db5['context'],'exten':_0x4a2db5['exten'],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x488058+0x2)+_0xfe4e('0x15')+(_0x488058+0x1)+')','context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0x4a2db5[_0xfe4e('0x16')]?_0xfe4e('0x17')+_0x4a2db5[_0xfe4e('0x16')]+'}':_0xfe4e('0x18'),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':'outbound','app':_0xfe4e('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0xf'),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x10'),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5['exten'],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x19')+_0x4a2db5['id'],'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']}];if(_0x4a2db5[_0xfe4e('0x1a')](_0xfe4e('0x1b'))&&_0x4a2db5['recordingFormat']!==_0xfe4e('0x1c')){_0x5d3fc1['push']({'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x1d'),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5[_0xfe4e('0xa')],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']},{'type':_0xfe4e('0x11'),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x1e')+_0x4a2db5[_0xfe4e('0x1b')]||_0xfe4e('0x1f'),'context':_0x4a2db5[_0xfe4e('0x6')],'exten':_0x4a2db5['exten'],'priority':_0x488058++,'VoiceExtensionId':_0x4a2db5['id']});}return _0x5d3fc1;}function _0x6fe5e(_0xc8cd86,_0x45b805){var _0x4f0314=[{'name':_0xfe4e('0x20'),'param':0x0},{'name':_0xfe4e('0x21'),'param':0x1},{'name':_0xfe4e('0x22'),'param':0x2},{'name':_0xfe4e('0x23'),'param':0x3}];var _0x14f3c9={};var _0x396833=_0x45b805[_0xfe4e('0x24')](',');var _0x4f204b=[];for(var _0x1e8530=0x0;_0x1e8530<_0x4f0314['length'];_0x1e8530++){switch(_0x4f0314[_0x1e8530][_0xfe4e('0x25')]){case _0xfe4e('0x20'):_0x14f3c9[_0xfe4e('0x20')]=_0x396833[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]][_0xfe4e('0x24')]('/')[0x1];_0x14f3c9[_0xfe4e('0x27')]=_0x396833[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]][_0xfe4e('0x24')]('/')[0x2];_0x14f3c9[_0xfe4e('0x28')]=_0x14f3c9[_0xfe4e('0x27')]?_0x14f3c9[_0xfe4e('0x27')][_0xfe4e('0x24')]('$')[0x0]:undefined;_0x14f3c9[_0xfe4e('0x27')]=_0xc8cd86['cutdigits']?(_0x14f3c9['prefix']||'')+_0xfe4e('0x29')+_0xc8cd86[_0xfe4e('0x16')]+'}':(_0x14f3c9[_0xfe4e('0x28')]||'')+_0xfe4e('0x14');_0x4f204b[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]]=['SIP',_0x14f3c9[_0xfe4e('0x20')],_0x14f3c9[_0xfe4e('0x27')]]['join']('/');break;case _0xfe4e('0x22'):_0x14f3c9[_0xfe4e('0x22')]=_0x396833[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]];if(_0xc8cd86[_0xfe4e('0x1b')]!==_0xfe4e('0x1c')){if(_0x14f3c9['options'][_0xfe4e('0x2a')]('U(xcally-mixmonitor-context)')<0x0){_0x14f3c9['options']+=_0xfe4e('0x2b');}}else{_0x14f3c9[_0xfe4e('0x22')]=_0x14f3c9[_0xfe4e('0x22')]['replace'](_0xfe4e('0x2b'),'');}_0x4f204b[_0x4f0314[_0x1e8530]['param']]=_0x14f3c9['options'];break;default:_0x4f204b[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]]=_0x396833[_0x4f0314[_0x1e8530][_0xfe4e('0x26')]];}}return _0x4f204b[_0xfe4e('0x2c')](',');}function _0x21db6c(_0x1a9c21,_0x1b8f55,_0x4368c7){return new Promise(function(_0x3b6a34,_0x261e78){var _0x5f20ac=[];if(_[_0xfe4e('0x2d')](_0x1b8f55))return _0x3b6a34(_0x5f20ac);_0x122a86[_0xfe4e('0x2e')][_0xfe4e('0x2f')]({'attributes':['id',_0xfe4e('0x30'),_0xfe4e('0x31')],'raw':!![]})['then'](function(_0x995a47){for(var _0x575c60=0x0,_0x68a4da=0x0;_0x575c60<_0x1b8f55['length'];_0x575c60++,_0x68a4da=0x0){var _0xa9b951=_0x1b8f55[_0x575c60];var _0xefddc6=[];var _0x507bc8=[];delete _0xa9b951['id'];if(_0xa9b951[_0xfe4e('0x30')]!==_0xfe4e('0x32')){_0xa9b951[_0xfe4e('0x33')]=[_0xa9b951[_0xfe4e('0x30')]];}else{_0xa9b951[_0xfe4e('0x33')]=_0xa9b951[_0xfe4e('0x31')]?_[_0xfe4e('0x34')](_[_0xfe4e('0x35')](_0x995a47,{'IntervalId':_0xa9b951[_0xfe4e('0x31')]}),_0xfe4e('0x30')):[];}_0xa9b951['context']=_0x1a9c21[_0xfe4e('0x6')];_0xa9b951[_0xfe4e('0xa')]=_0x1a9c21[_0xfe4e('0xa')];if(_0xa9b951[_0xfe4e('0x3')])_0xa9b951[_0xfe4e('0x3')]=_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')]();if(_0x1a9c21['type']===_0xfe4e('0x11')){if(_0xa9b951[_0xfe4e('0x1a')](_0xfe4e('0x37'))&&_0xa9b951['tag']&&_0xa9b951[_0xfe4e('0x37')]!=='--'){_0xefddc6[_0xfe4e('0xd')]({'type':_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')](),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x38')+_0xa9b951[_0xfe4e('0x37')],'context':_0x1a9c21['context'],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951['intervals'][_0xfe4e('0x39')]+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});}_0xefddc6[_0xfe4e('0xd')]({'type':_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')](),'app':_0xfe4e('0x3a'),'appdata':_0xfe4e('0x3b')+(_0xa9b951['callerID']?'Set(CALLERID(all)='+_0xa9b951[_0xfe4e('0x3c')]+')':_0xfe4e('0x3d')),'context':_0x1a9c21[_0xfe4e('0x6')],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951[_0xfe4e('0x33')][_0xfe4e('0x39')]+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});}else{if(_0xa9b951[_0xfe4e('0x1a')](_0xfe4e('0x3e'))){if([_0xfe4e('0x3f'),'playback'][_0xfe4e('0x40')](_0xa9b951[_0xfe4e('0x41')]['toLowerCase']())&&_0xa9b951[_0xfe4e('0x42')]!==_0xfe4e('0x43')){if(_0xa9b951[_0xfe4e('0x3e')]){_0xefddc6[_0xfe4e('0xd')]({'type':_0xa9b951['type']['toLowerCase'](),'app':_0xfe4e('0x3a'),'appdata':_0xfe4e('0x44'),'context':_0x1a9c21[_0xfe4e('0x6')],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951[_0xfe4e('0x33')][_0xfe4e('0x39')]+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});_0xefddc6[_0xfe4e('0xd')]({'type':_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')](),'app':_0xfe4e('0x4'),'appdata':_0xfe4e('0x45'),'context':_0x1a9c21[_0xfe4e('0x6')],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951[_0xfe4e('0x33')]['length']+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});}else{_0xefddc6['push']({'type':_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')](),'app':_0xfe4e('0x3a'),'appdata':_0xfe4e('0x46'),'context':_0x1a9c21[_0xfe4e('0x6')],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951['intervals'][_0xfe4e('0x39')]+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});_0xefddc6[_0xfe4e('0xd')]({'type':_0xa9b951[_0xfe4e('0x3')][_0xfe4e('0x36')](),'app':_0xfe4e('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1a9c21[_0xfe4e('0x6')],'exten':_0x1a9c21[_0xfe4e('0xa')],'priority':_0xa9b951[_0xfe4e('0x33')][_0xfe4e('0x39')]+_0x4368c7+_0x68a4da++,'VoiceExtensionId':_0x1a9c21['id']});}}}}for(var _0x53fecc=0x0;_0x53fecc<_0xa9b951[_0xfe4e('0x33')][_0xfe4e('0x39')];_0x53fecc++){var _0x1ea777=_0x4368c7+_0xa9b951[_0xfe4e('0x33')][_0xfe4e('0x39')];var _0x47f3bc=_0x53fecc===_0xa9b951[_0xfe4e('0x33')]['length']-0x1?_0x4368c7+_0xefddc6[_0xfe4e('0x39')]+_0x507bc8['length']+0x2:_0x4368c7+_0x53fecc+0x1;_0xefddc6[_0xfe4e('0x47')](_0x53fecc,0x0,{'type':_0x1a9c21[_0xfe4e('0x3')],'app':_0xfe4e('0x48'),'appdata':_0xa9b951['intervals'][_0x53fecc]+'?'+_0x1a9c21[_0xfe4e('0x6')]+_0xfe4e('0x49')+_0x1ea777+':'+_0x1a9c21[_0xfe4e('0x6')]+_0xfe4e('0x49')+_0x47f3bc,'exten':_0x1a9c21[_0xfe4e('0xa')],'context':_0x1a9c21['context'],'priority':_0x4368c7+_0x53fecc,'VoiceExtensionId':_0x1a9c21['id']});}if(_0xa9b951[_0xfe4e('0x42')]===_0xfe4e('0x4a'))_0xa9b951[_0xfe4e('0x4b')]=_0x6fe5e(_0x1a9c21,_0xa9b951[_0xfe4e('0x4b')]);_0xa9b951['priority']=_0xefddc6[_0xfe4e('0x39')]?_['last'](_0xefddc6)[_0xfe4e('0x4c')]+0x1:_0x4368c7;_0x5f20ac=_[_0xfe4e('0x4d')](_0x5f20ac,_0xefddc6,[_0xa9b951],_0x507bc8);_0x4368c7=_[_0xfe4e('0x4e')](_0x5f20ac)[_0xfe4e('0x4c')]+0x1;}return _0x3b6a34(_0x5f20ac);})[_0xfe4e('0x4f')](function(_0x1b8c62){_0x261e78(_0x1b8c62);});});}return _0x4f41e1[_0xfe4e('0x50')](_0xfe4e('0x51'),attributes,{'tableName':_0xfe4e('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5c90a5){var _0x5561b8=this['get']({'plain':!![]});var _0x570a8c=_0x5561b8[_0xfe4e('0x3')]===_0xfe4e('0x11')?_0x2dcd52(_0x5561b8):_0x1870de(_0x5561b8);return _0x21db6c(_0x5561b8,_0x5c90a5,_['last'](_0x570a8c)[_0xfe4e('0x4c')]+0x1)[_0xfe4e('0x53')](function(_0x1fe9ca){var _0x1055d9=_[_0xfe4e('0x4d')](_0x570a8c,_0x1fe9ca);_0x1055d9['push']({'type':_0x5561b8[_0xfe4e('0x3')],'app':_0xfe4e('0x54'),'exten':_0x5561b8[_0xfe4e('0xa')],'context':_0x5561b8['context'],'priority':_[_0xfe4e('0x4e')](_0x1055d9)[_0xfe4e('0x4c')]+0x1,'VoiceExtensionId':_0x5561b8['id']});return _0x1055d9;});}}});}; \ No newline at end of file +var _0x07b6=['playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','lodash','exports','models','type','CDR(type)=','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN:','${EXTEN}','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x07b6,0xb5));var _0x607b=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x07b6[_0x329437];return _0x3789d9;};'use strict';var _=require(_0x607b('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x607b('0x1')]=function(_0x1e1961){var _0xf213c2=_0x1e1961[_0x607b('0x2')];function _0x15168f(_0xda82d1){var _0x58ac0b=0x2;var _0x10e257=[{'type':_0xda82d1[_0x607b('0x3')],'app':'Set','appdata':_0x607b('0x4')+_0xda82d1[_0x607b('0x3')],'context':_0xda82d1['context'],'exten':_0xda82d1[_0x607b('0x5')],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']},{'type':_0xda82d1[_0x607b('0x3')],'app':_0xda82d1[_0x607b('0x6')]?_0x607b('0x7'):_0x607b('0x8'),'appdata':_0xda82d1[_0x607b('0x6')]?_0x607b('0x9')+_0xda82d1[_0x607b('0x6')]:_0x607b('0xa'),'context':_0xda82d1[_0x607b('0xb')],'exten':_0xda82d1[_0x607b('0x5')],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']}];if(_0xda82d1[_0x607b('0x3')]===_0x607b('0xc')){_0x10e257[_0x607b('0xd')]({'type':_0x607b('0xc'),'app':_0x607b('0x7'),'appdata':_0x607b('0xe')+_0xda82d1['id'],'context':_0xda82d1[_0x607b('0xb')],'exten':_0xda82d1[_0x607b('0x5')],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']});}_0x10e257[_0x607b('0xd')]({'type':_0xda82d1[_0x607b('0x3')],'app':_0x607b('0x7'),'appdata':_0x607b('0xf'),'context':_0xda82d1[_0x607b('0xb')],'exten':_0xda82d1[_0x607b('0x5')],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']},{'type':_0xda82d1['type'],'app':_0x607b('0x7'),'appdata':_0x607b('0x10'),'context':_0xda82d1[_0x607b('0xb')],'exten':_0xda82d1['exten'],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']},{'type':_0xda82d1[_0x607b('0x3')],'app':_0x607b('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0xda82d1[_0x607b('0xb')],'exten':_0xda82d1[_0x607b('0x5')],'priority':_0x58ac0b++,'VoiceExtensionId':_0xda82d1['id']});return _0x10e257;}function _0x422ed6(_0x5bda44){var _0x3d1a2e=0x2;var _0x1168d1=[{'type':'outbound','app':_0x607b('0x7'),'appdata':_0x607b('0x11'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':_0x5bda44['alias']?_0x607b('0x7'):_0x607b('0x8'),'appdata':_0x5bda44[_0x607b('0x6')]?_0x607b('0x9')+_0x5bda44[_0x607b('0x6')]:'No\x20alias\x20set','context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':'Set','appdata':_0x607b('0x13')+(_0x5bda44[_0x607b('0x14')]?'${EXTEN:'+_0x5bda44[_0x607b('0x14')]+'}':'${EXTEN}'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':'Set','appdata':_0x607b('0xe')+_0x5bda44['id'],'context':_0x5bda44['context'],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':'ExecIf','appdata':_0x607b('0x15')+(_0x3d1a2e+0x2)+'):Goto('+(_0x3d1a2e+0x1)+')','context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':_0x607b('0x7'),'appdata':_0x5bda44[_0x607b('0x14')]?_0x607b('0x16')+_0x5bda44[_0x607b('0x14')]+'}':_0x607b('0x17'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':_0x607b('0x7'),'appdata':_0x607b('0xf'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':'outbound','app':_0x607b('0x7'),'appdata':_0x607b('0x10'),'context':_0x5bda44['context'],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':'Set','appdata':_0x607b('0x18'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':_0x607b('0x7'),'appdata':'outboundrouteid='+_0x5bda44['id'],'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44['exten'],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']}];if(_0x5bda44[_0x607b('0x19')](_0x607b('0x1a'))&&_0x5bda44[_0x607b('0x1a')]!==_0x607b('0x1b')){_0x1168d1['push']({'type':_0x607b('0x12'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44[_0x607b('0x5')],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']},{'type':_0x607b('0x12'),'app':_0x607b('0x7'),'appdata':_0x607b('0x1c')+_0x5bda44[_0x607b('0x1a')]||_0x607b('0x1d'),'context':_0x5bda44[_0x607b('0xb')],'exten':_0x5bda44['exten'],'priority':_0x3d1a2e++,'VoiceExtensionId':_0x5bda44['id']});}return _0x1168d1;}function _0x50687c(_0x46f8d6,_0x3d7a3c){var _0x23b49d=[{'name':_0x607b('0x1e'),'param':0x0},{'name':_0x607b('0x1f'),'param':0x1},{'name':_0x607b('0x20'),'param':0x2},{'name':_0x607b('0x21'),'param':0x3}];var _0x590faa={};var _0x4c61f8=_0x3d7a3c[_0x607b('0x22')](',');var _0x296975=[];for(var _0xa7c69d=0x0;_0xa7c69d<_0x23b49d[_0x607b('0x23')];_0xa7c69d++){switch(_0x23b49d[_0xa7c69d]['name']){case'trunk':_0x590faa[_0x607b('0x1e')]=_0x4c61f8[_0x23b49d[_0xa7c69d][_0x607b('0x24')]]['split']('/')[0x1];_0x590faa[_0x607b('0x25')]=_0x4c61f8[_0x23b49d[_0xa7c69d][_0x607b('0x24')]][_0x607b('0x22')]('/')[0x2];_0x590faa[_0x607b('0x26')]=_0x590faa[_0x607b('0x25')]?_0x590faa['phone'][_0x607b('0x22')]('$')[0x0]:undefined;_0x590faa['phone']=_0x46f8d6[_0x607b('0x14')]?(_0x590faa[_0x607b('0x26')]||'')+_0x607b('0x27')+_0x46f8d6[_0x607b('0x14')]+'}':(_0x590faa['prefix']||'')+_0x607b('0x28');_0x296975[_0x23b49d[_0xa7c69d][_0x607b('0x24')]]=['SIP',_0x590faa['trunk'],_0x590faa[_0x607b('0x25')]][_0x607b('0x29')]('/');break;case _0x607b('0x20'):_0x590faa['options']=_0x4c61f8[_0x23b49d[_0xa7c69d]['param']];if(_0x46f8d6[_0x607b('0x1a')]!==_0x607b('0x1b')){if(_0x590faa['options']['indexOf'](_0x607b('0x2a'))<0x0){_0x590faa[_0x607b('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0x590faa[_0x607b('0x20')]=_0x590faa[_0x607b('0x20')]['replace'](_0x607b('0x2a'),'');}_0x296975[_0x23b49d[_0xa7c69d][_0x607b('0x24')]]=_0x590faa[_0x607b('0x20')];break;default:_0x296975[_0x23b49d[_0xa7c69d]['param']]=_0x4c61f8[_0x23b49d[_0xa7c69d]['param']];}}return _0x296975[_0x607b('0x29')](',');}function _0x5c5b14(_0x52919f,_0xbfc7ba,_0x29737b){return new Promise(function(_0x502edb,_0x32a12f){var _0x5a044c=[];if(_[_0x607b('0x2b')](_0xbfc7ba))return _0x502edb(_0x5a044c);_0xf213c2[_0x607b('0x2c')][_0x607b('0x2d')]({'attributes':['id',_0x607b('0x2e'),'IntervalId'],'raw':!![]})[_0x607b('0x2f')](function(_0x8e5fa9){for(var _0x9153e6=0x0,_0x4f2c89=0x0;_0x9153e6<_0xbfc7ba[_0x607b('0x23')];_0x9153e6++,_0x4f2c89=0x0){var _0x4f7d83=_0xbfc7ba[_0x9153e6];var _0xd19315=[];var _0x133358=[];delete _0x4f7d83['id'];if(_0x4f7d83[_0x607b('0x2e')]!==_0x607b('0x30')){_0x4f7d83[_0x607b('0x31')]=[_0x4f7d83['interval']];}else{_0x4f7d83[_0x607b('0x31')]=_0x4f7d83[_0x607b('0x32')]?_['map'](_[_0x607b('0x33')](_0x8e5fa9,{'IntervalId':_0x4f7d83[_0x607b('0x32')]}),_0x607b('0x2e')):[];}_0x4f7d83['context']=_0x52919f[_0x607b('0xb')];_0x4f7d83[_0x607b('0x5')]=_0x52919f[_0x607b('0x5')];if(_0x4f7d83[_0x607b('0x3')])_0x4f7d83[_0x607b('0x3')]=_0x4f7d83['type'][_0x607b('0x34')]();if(_0x52919f['type']===_0x607b('0x12')){if(_0x4f7d83[_0x607b('0x19')](_0x607b('0x35'))&&_0x4f7d83[_0x607b('0x35')]&&_0x4f7d83['tag']!=='--'){_0xd19315[_0x607b('0xd')]({'type':_0x4f7d83[_0x607b('0x3')][_0x607b('0x34')](),'app':_0x607b('0x7'),'appdata':_0x607b('0x36')+_0x4f7d83['tag'],'context':_0x52919f[_0x607b('0xb')],'exten':_0x52919f[_0x607b('0x5')],'priority':_0x4f7d83[_0x607b('0x31')][_0x607b('0x23')]+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});}_0xd19315[_0x607b('0xd')]({'type':_0x4f7d83[_0x607b('0x3')][_0x607b('0x34')](),'app':_0x607b('0x37'),'appdata':_0x607b('0x38')+(_0x4f7d83[_0x607b('0x39')]?_0x607b('0x3a')+_0x4f7d83[_0x607b('0x39')]+')':_0x607b('0x3b')),'context':_0x52919f[_0x607b('0xb')],'exten':_0x52919f['exten'],'priority':_0x4f7d83[_0x607b('0x31')][_0x607b('0x23')]+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});}else{if(_0x4f7d83[_0x607b('0x19')](_0x607b('0x3c'))){if([_0x607b('0x3d'),_0x607b('0x3e')][_0x607b('0x3f')](_0x4f7d83[_0x607b('0x40')][_0x607b('0x34')]())&&_0x4f7d83[_0x607b('0x41')]!==_0x607b('0x42')){if(_0x4f7d83[_0x607b('0x3c')]){_0xd19315[_0x607b('0xd')]({'type':_0x4f7d83[_0x607b('0x3')][_0x607b('0x34')](),'app':'ExecIf','appdata':_0x607b('0x43'),'context':_0x52919f[_0x607b('0xb')],'exten':_0x52919f[_0x607b('0x5')],'priority':_0x4f7d83[_0x607b('0x31')]['length']+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});_0xd19315[_0x607b('0xd')]({'type':_0x4f7d83[_0x607b('0x3')][_0x607b('0x34')](),'app':_0x607b('0x7'),'appdata':_0x607b('0x44'),'context':_0x52919f['context'],'exten':_0x52919f[_0x607b('0x5')],'priority':_0x4f7d83['intervals'][_0x607b('0x23')]+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});}else{_0xd19315['push']({'type':_0x4f7d83['type']['toLowerCase'](),'app':_0x607b('0x37'),'appdata':_0x607b('0x45'),'context':_0x52919f[_0x607b('0xb')],'exten':_0x52919f[_0x607b('0x5')],'priority':_0x4f7d83['intervals'][_0x607b('0x23')]+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});_0xd19315[_0x607b('0xd')]({'type':_0x4f7d83[_0x607b('0x3')][_0x607b('0x34')](),'app':_0x607b('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x52919f[_0x607b('0xb')],'exten':_0x52919f[_0x607b('0x5')],'priority':_0x4f7d83[_0x607b('0x31')][_0x607b('0x23')]+_0x29737b+_0x4f2c89++,'VoiceExtensionId':_0x52919f['id']});}}}}for(var _0x4545c6=0x0;_0x4545c6<_0x4f7d83[_0x607b('0x31')][_0x607b('0x23')];_0x4545c6++){var _0x1c8c28=_0x29737b+_0x4f7d83[_0x607b('0x31')][_0x607b('0x23')];var _0x19e02c=_0x4545c6===_0x4f7d83['intervals'][_0x607b('0x23')]-0x1?_0x29737b+_0xd19315[_0x607b('0x23')]+_0x133358[_0x607b('0x23')]+0x2:_0x29737b+_0x4545c6+0x1;_0xd19315[_0x607b('0x46')](_0x4545c6,0x0,{'type':_0x52919f[_0x607b('0x3')],'app':_0x607b('0x47'),'appdata':_0x4f7d83[_0x607b('0x31')][_0x4545c6]+'?'+_0x52919f[_0x607b('0xb')]+_0x607b('0x48')+_0x1c8c28+':'+_0x52919f['context']+_0x607b('0x48')+_0x19e02c,'exten':_0x52919f['exten'],'context':_0x52919f[_0x607b('0xb')],'priority':_0x29737b+_0x4545c6,'VoiceExtensionId':_0x52919f['id']});}if(_0x4f7d83['appType']==='outboundDial')_0x4f7d83[_0x607b('0x49')]=_0x50687c(_0x52919f,_0x4f7d83[_0x607b('0x49')]);_0x4f7d83[_0x607b('0x4a')]=_0xd19315[_0x607b('0x23')]?_['last'](_0xd19315)[_0x607b('0x4a')]+0x1:_0x29737b;_0x5a044c=_['concat'](_0x5a044c,_0xd19315,[_0x4f7d83],_0x133358);_0x29737b=_[_0x607b('0x4b')](_0x5a044c)[_0x607b('0x4a')]+0x1;}return _0x502edb(_0x5a044c);})[_0x607b('0x4c')](function(_0x4566af){_0x32a12f(_0x4566af);});});}return _0x1e1961[_0x607b('0x4d')](_0x607b('0x4e'),attributes,{'tableName':_0x607b('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x564714){var _0x344d69=this[_0x607b('0x50')]({'plain':!![]});var _0x438501=_0x344d69[_0x607b('0x3')]==='outbound'?_0x422ed6(_0x344d69):_0x15168f(_0x344d69);return _0x5c5b14(_0x344d69,_0x564714,_['last'](_0x438501)[_0x607b('0x4a')]+0x1)[_0x607b('0x2f')](function(_0x48f6be){var _0x1384ab=_['concat'](_0x438501,_0x48f6be);_0x1384ab[_0x607b('0xd')]({'type':_0x344d69[_0x607b('0x3')],'app':'Hangup','exten':_0x344d69[_0x607b('0x5')],'context':_0x344d69[_0x607b('0xb')],'priority':_[_0x607b('0x4b')](_0x1384ab)[_0x607b('0x4a')]+0x1,'VoiceExtensionId':_0x344d69['id']});return _0x1384ab;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 0b38d22..5dedca3 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 _0x3981=['then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','attributes','limit','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3981,0x144));var _0x1398=function(_0x39d1b2,_0x5e3154){_0x39d1b2=_0x39d1b2-0x0;var _0xc919af=_0x3981[_0x39d1b2];return _0xc919af;};'use strict';var _=require(_0x1398('0x0'));var util=require('util');var moment=require(_0x1398('0x1'));var BPromise=require(_0x1398('0x2'));var rs=require(_0x1398('0x3'));var fs=require('fs');var Redis=require(_0x1398('0x4'));var db=require(_0x1398('0x5'))['db'];var utils=require(_0x1398('0x6'));var logger=require(_0x1398('0x7'))(_0x1398('0x8'));var config=require(_0x1398('0x9'));var jayson=require(_0x1398('0xa'));var client=jayson[_0x1398('0xb')]['http']({'port':0x232a});config[_0x1398('0xc')]=_[_0x1398('0xd')](config[_0x1398('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1398('0xe'))(new Redis(config[_0x1398('0xc')]));require(_0x1398('0xf'))[_0x1398('0x10')](socket);function respondWithRpcPromise(_0x110c1e,_0x40b03e,_0x551a63){return new BPromise(function(_0x2c4e2b,_0xa024aa){return client[_0x1398('0x11')](_0x110c1e,_0x551a63)[_0x1398('0x12')](function(_0x50d051){logger[_0x1398('0x13')](_0x1398('0x14'),_0x40b03e,_0x1398('0x15'));logger[_0x1398('0x16')](_0x1398('0x17'),_0x40b03e,'request\x20sent',JSON[_0x1398('0x18')](_0x50d051));if(_0x50d051[_0x1398('0x19')]){if(_0x50d051[_0x1398('0x19')][_0x1398('0x1a')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x40b03e,_0x50d051['error'][_0x1398('0x1b')]);return _0xa024aa(_0x50d051['error']['message']);}logger['error'](_0x1398('0x14'),_0x40b03e,_0x50d051['error'][_0x1398('0x1b')]);return _0x2c4e2b(_0x50d051[_0x1398('0x19')][_0x1398('0x1b')]);}else{logger[_0x1398('0x13')](_0x1398('0x14'),_0x40b03e,'request\x20sent');_0x2c4e2b(_0x50d051[_0x1398('0x1c')]['message']);}})['catch'](function(_0x117b09){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x40b03e,_0x117b09);_0xa024aa(_0x117b09);});});}exports[_0x1398('0x1d')]=function(_0x1f23b0){var _0x5ccf6b=this;return new Promise(function(_0x26eaf2,_0x146357){return db[_0x1398('0x1e')][_0x1398('0x1f')]({'raw':_0x1f23b0[_0x1398('0x20')]?_0x1f23b0[_0x1398('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1f23b0['options']?_0x1f23b0['options']['where']||null:null,'attributes':_0x1f23b0[_0x1398('0x20')]?_0x1f23b0[_0x1398('0x20')][_0x1398('0x21')]||null:null,'limit':_0x1f23b0[_0x1398('0x20')]?_0x1f23b0[_0x1398('0x20')][_0x1398('0x22')]||null:null,'include':_0x1f23b0['options']?_0x1f23b0[_0x1398('0x20')][_0x1398('0x23')]?_['map'](_0x1f23b0[_0x1398('0x20')][_0x1398('0x23')],function(_0x41c42c){return{'model':db[_0x41c42c[_0x1398('0x24')]],'as':_0x41c42c['as'],'attributes':_0x41c42c['attributes'],'include':_0x41c42c['include']?_[_0x1398('0x25')](_0x41c42c['include'],function(_0x360112){return{'model':db[_0x360112['model']],'as':_0x360112['as'],'attributes':_0x360112['attributes'],'include':_0x360112['include']?_[_0x1398('0x25')](_0x360112[_0x1398('0x23')],function(_0x76bd5){return{'model':db[_0x76bd5[_0x1398('0x24')]],'as':_0x76bd5['as'],'attributes':_0x76bd5[_0x1398('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1398('0x12')](function(_0x53343d){logger['info']('GetVoiceExtension',_0x1f23b0);logger[_0x1398('0x16')](_0x1398('0x1d'),_0x1f23b0,JSON[_0x1398('0x18')](_0x53343d));_0x26eaf2(_0x53343d);})['catch'](function(_0x403585){logger[_0x1398('0x19')]('GetVoiceExtension',_0x403585['message'],_0x1f23b0);_0x146357(_0x5ccf6b['error'](0x1f4,_0x403585[_0x1398('0x1b')]));});});}; \ No newline at end of file +var _0xa1aa=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','GetVoiceExtension','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x4246bd,_0xdab764){var _0x20e0b7=function(_0x402785){while(--_0x402785){_0x4246bd['push'](_0x4246bd['shift']());}};_0x20e0b7(++_0xdab764);}(_0xa1aa,0x88));var _0xaa1a=function(_0x5c76a5,_0x7fb422){_0x5c76a5=_0x5c76a5-0x0;var _0x212067=_0xa1aa[_0x5c76a5];return _0x212067;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa1a('0x0'));var BPromise=require(_0xaa1a('0x1'));var rs=require(_0xaa1a('0x2'));var fs=require('fs');var Redis=require(_0xaa1a('0x3'));var db=require(_0xaa1a('0x4'))['db'];var utils=require(_0xaa1a('0x5'));var logger=require(_0xaa1a('0x6'))('rpc');var config=require(_0xaa1a('0x7'));var jayson=require(_0xaa1a('0x8'));var client=jayson['client'][_0xaa1a('0x9')]({'port':0x232a});config[_0xaa1a('0xa')]=_[_0xaa1a('0xb')](config[_0xaa1a('0xa')],{'host':_0xaa1a('0xc'),'port':0x18eb});var socket=require(_0xaa1a('0xd'))(new Redis(config[_0xaa1a('0xa')]));require(_0xaa1a('0xe'))[_0xaa1a('0xf')](socket);function respondWithRpcPromise(_0x4cd755,_0x1a276c,_0x5663fd){return new BPromise(function(_0x7c44f4,_0x2b58b2){return client[_0xaa1a('0x10')](_0x4cd755,_0x5663fd)[_0xaa1a('0x11')](function(_0x432916){logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x1a276c,_0xaa1a('0x14'));logger[_0xaa1a('0x15')](_0xaa1a('0x16'),_0x1a276c,_0xaa1a('0x14'),JSON['stringify'](_0x432916));if(_0x432916['error']){if(_0x432916[_0xaa1a('0x17')][_0xaa1a('0x18')]===0x1f4){logger[_0xaa1a('0x17')](_0xaa1a('0x13'),_0x1a276c,_0x432916[_0xaa1a('0x17')][_0xaa1a('0x19')]);return _0x2b58b2(_0x432916['error'][_0xaa1a('0x19')]);}logger[_0xaa1a('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1a276c,_0x432916[_0xaa1a('0x17')]['message']);return _0x7c44f4(_0x432916['error'][_0xaa1a('0x19')]);}else{logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x1a276c,_0xaa1a('0x14'));_0x7c44f4(_0x432916[_0xaa1a('0x1a')][_0xaa1a('0x19')]);}})[_0xaa1a('0x1b')](function(_0x18bb19){logger[_0xaa1a('0x17')](_0xaa1a('0x13'),_0x1a276c,_0x18bb19);_0x2b58b2(_0x18bb19);});});}exports['GetVoiceExtension']=function(_0x328a07){var _0x156ce9=this;return new Promise(function(_0x281e8f,_0x2558a8){return db[_0xaa1a('0x1c')][_0xaa1a('0x1d')]({'raw':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x1f')]||null:null,'attributes':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x20')]||null:null,'limit':_0x328a07[_0xaa1a('0x1e')]?_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x21')]||null:null,'include':_0x328a07['options']?_0x328a07[_0xaa1a('0x1e')]['include']?_[_0xaa1a('0x22')](_0x328a07[_0xaa1a('0x1e')][_0xaa1a('0x23')],function(_0x15fb61){return{'model':db[_0x15fb61[_0xaa1a('0x24')]],'as':_0x15fb61['as'],'attributes':_0x15fb61[_0xaa1a('0x20')],'include':_0x15fb61[_0xaa1a('0x23')]?_['map'](_0x15fb61[_0xaa1a('0x23')],function(_0x164b7f){return{'model':db[_0x164b7f['model']],'as':_0x164b7f['as'],'attributes':_0x164b7f[_0xaa1a('0x20')],'include':_0x164b7f['include']?_[_0xaa1a('0x22')](_0x164b7f[_0xaa1a('0x23')],function(_0xd2360d){return{'model':db[_0xd2360d['model']],'as':_0xd2360d['as'],'attributes':_0xd2360d[_0xaa1a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaa1a('0x11')](function(_0x43d0b1){logger[_0xaa1a('0x12')]('GetVoiceExtension',_0x328a07);logger['debug'](_0xaa1a('0x25'),_0x328a07,JSON[_0xaa1a('0x26')](_0x43d0b1));_0x281e8f(_0x43d0b1);})[_0xaa1a('0x1b')](function(_0x3d10c7){logger[_0xaa1a('0x17')](_0xaa1a('0x25'),_0x3d10c7['message'],_0x328a07);_0x2558a8(_0x156ce9['error'](0x1f4,_0x3d10c7[_0xaa1a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 46747e0..684fde4 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x45e2ca,_0x59129f){var _0x4d3682=function(_0x5daaeb){while(--_0x5daaeb){_0x45e2ca['push'](_0x45e2ca['shift']());}};_0x4d3682(++_0x59129f);}(_0xe14b,0x93));var _0xbe14=function(_0x5ee745,_0x357a60){_0x5ee745=_0x5ee745-0x0;var _0x32e871=_0xe14b[_0x5ee745];return _0x32e871;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x5104bd,_0x2f8415){var _0x1d2dce=function(_0x3f3ff7){while(--_0x3f3ff7){_0x5104bd['push'](_0x5104bd['shift']());}};_0x1d2dce(++_0x2f8415);}(_0xabce,0x103));var _0xeabc=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xabce[_0x433a86];return _0x23000c;};'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 2125394..9f81eaa 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xdb28,0x106));var _0x8db2=function(_0x20ca95,_0x1db359){_0x20ca95=_0x20ca95-0x0;var _0x2005e5=_0xdb28[_0x20ca95];return _0x2005e5;};'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('./voiceMail.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('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x71ab=['getMessages','post','create','update','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0xed4e3c,_0x39e976){var _0x4297cc=function(_0x5a0cb8){while(--_0x5a0cb8){_0xed4e3c['push'](_0xed4e3c['shift']());}};_0x4297cc(++_0x39e976);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0x8')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0xf')]('/',auth['isAuthenticated'](),controller[_0xb71a('0x10')]);router['put'](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x11')]);router['delete'](_0xb71a('0xb'),auth['isAuthenticated'](),controller[_0xb71a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c60907a..aec5c84 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 _0x8ac9=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER'];(function(_0x45f822,_0x46a92b){var _0x2d3ae6=function(_0x44c157){while(--_0x44c157){_0x45f822['push'](_0x45f822['shift']());}};_0x2d3ae6(++_0x46a92b);}(_0x8ac9,0x17f));var _0x98ac=function(_0x37eeb8,_0x35dca1){_0x37eeb8=_0x37eeb8-0x0;var _0x2a6a41=_0x8ac9[_0x37eeb8];return _0x2a6a41;};'use strict';var Sequelize=require(_0x98ac('0x0'));module[_0x98ac('0x1')]={'customer_id':{'type':Sequelize[_0x98ac('0x2')]},'context':{'type':Sequelize[_0x98ac('0x2')],'defaultValue':'from-voicemail','unique':_0x98ac('0x3')},'mailbox':{'type':Sequelize[_0x98ac('0x2')],'defaultValue':'','allowNull':![],'unique':_0x98ac('0x3')},'password':{'type':Sequelize[_0x98ac('0x2')]},'fullname':{'type':Sequelize[_0x98ac('0x2')]},'email':{'type':Sequelize[_0x98ac('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4519cf){this[_0x98ac('0x4')](_0x98ac('0x5'),typeof _0x4519cf===_0x98ac('0x6')&&_0x4519cf[_0x98ac('0x7')]()?_0x4519cf['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x98ac('0x2')],'defaultValue':_0x98ac('0x8')},'attach':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':_0x98ac('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x98ac('0x2')]},'callback':{'type':Sequelize[_0x98ac('0x2')]},'review':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x98ac('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x98ac('0x9')](_0x98ac('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x98ac('0x9')]('yes','no'),'defaultValue':_0x98ac('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x98ac('0x2')]},'emailbody':{'type':Sequelize[_0x98ac('0x2')]},'maxsecs':{'type':Sequelize[_0x98ac('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x98ac('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x98ac('0xd')],'get':function(){return this[_0x98ac('0xe')](_0x98ac('0xf'))+_0x98ac('0x10')+this[_0x98ac('0xe')](_0x98ac('0x11'));}}}; \ No newline at end of file +var _0x5abc=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20'];(function(_0x240c9a,_0x100d6d){var _0xb239e9=function(_0x313bbc){while(--_0x313bbc){_0x240c9a['push'](_0x240c9a['shift']());}};_0xb239e9(++_0x100d6d);}(_0x5abc,0x110));var _0xc5ab=function(_0x514163,_0x449585){_0x514163=_0x514163-0x0;var _0x3880c9=_0x5abc[_0x514163];return _0x3880c9;};'use strict';var Sequelize=require(_0xc5ab('0x0'));module[_0xc5ab('0x1')]={'customer_id':{'type':Sequelize[_0xc5ab('0x2')]},'context':{'type':Sequelize[_0xc5ab('0x2')],'defaultValue':_0xc5ab('0x3'),'unique':_0xc5ab('0x4')},'mailbox':{'type':Sequelize[_0xc5ab('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc5ab('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xc5ab('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4008b0){this[_0xc5ab('0x5')]('email',typeof _0x4008b0===_0xc5ab('0x6')&&_0x4008b0[_0xc5ab('0x7')]()?_0x4008b0[_0xc5ab('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xc5ab('0x8')},'attach':{'type':Sequelize['ENUM'](_0xc5ab('0x9'),'no'),'defaultValue':_0xc5ab('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':_0xc5ab('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc5ab('0x2')]},'callback':{'type':Sequelize[_0xc5ab('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc5ab('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':_0xc5ab('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc5ab('0xa')](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xc5ab('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xc5ab('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc5ab('0x2')]},'emailbody':{'type':Sequelize[_0xc5ab('0x2')]},'maxsecs':{'type':Sequelize[_0xc5ab('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc5ab('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc5ab('0xd')],'get':function(){return this['getDataValue'](_0xc5ab('0xe'))+_0xc5ab('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1eb2741..d215610 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 _0x80ed=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x45a2e2,_0x92d820){var _0x9cdd87=function(_0x2d1320){while(--_0x2d1320){_0x45a2e2['push'](_0x45a2e2['shift']());}};_0x9cdd87(++_0x92d820);}(_0x80ed,0x11c));var _0xd80e=function(_0x3fb4f5,_0x1b7b8a){_0x3fb4f5=_0x3fb4f5-0x0;var _0x4f2061=_0x80ed[_0x3fb4f5];return _0x4f2061;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];function respondWithStatusCode(_0x118f53,_0x1d3fcf){_0x1d3fcf=_0x1d3fcf||0xcc;return function(_0x4fb01c){if(_0x4fb01c){return _0x118f53['sendStatus'](_0x1d3fcf);}return _0x118f53['status'](_0x1d3fcf)['end']();};}function respondWithResult(_0x145766,_0x3d233b){_0x3d233b=_0x3d233b||0xc8;return function(_0x3096ae){if(_0x3096ae){return _0x145766[_0xd80e('0x1b')](_0x3d233b)[_0xd80e('0x1c')](_0x3096ae);}};}function respondWithFilteredResult(_0x58a17e,_0x595683){return function(_0x2c8c61){if(_0x2c8c61){var _0x3124e8=typeof _0x595683[_0xd80e('0x1d')]===_0xd80e('0x1e')&&typeof _0x595683[_0xd80e('0x1f')]===_0xd80e('0x1e');var _0x22ab67=_0x2c8c61['count'];var _0x21ceec=_0x3124e8?0x0:_0x595683[_0xd80e('0x1d')];var _0x3b543d=_0x3124e8?_0x2c8c61[_0xd80e('0x20')]:_0x595683['offset']+_0x595683[_0xd80e('0x1f')];var _0x175c67;if(_0x3b543d>=_0x22ab67){_0x3b543d=_0x22ab67;_0x175c67=0xc8;}else{_0x175c67=0xce;}_0x58a17e[_0xd80e('0x1b')](_0x175c67);return _0x58a17e['set'](_0xd80e('0x21'),_0x21ceec+'-'+_0x3b543d+'/'+_0x22ab67)[_0xd80e('0x1c')](_0x2c8c61);}return null;};}function patchUpdates(_0x2765ea){return function(_0x147134){try{jsonpatch[_0xd80e('0x22')](_0x147134,_0x2765ea,!![]);}catch(_0x5509d4){return BPromise['reject'](_0x5509d4);}return _0x147134[_0xd80e('0x23')]();};}function saveUpdates(_0x3fa159,_0x3b39bf){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0xd80e('0x24')](_0x3fa159)[_0xd80e('0x25')](function(_0x43152c){return _0x43152c;});}return null;};}function removeEntity(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(_0x57d70){return _0x57d70[_0xd80e('0x26')]()['then'](function(){var _0x635ce0=_0x57d70[_0xd80e('0x27')]({'plain':!![]});var _0xe9bb59='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0xe9bb59,'resourceId':_0x635ce0['id']}})[_0xd80e('0x25')](function(){return _0x57d70;});})['then'](function(){_0x5430b6[_0xd80e('0x1b')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x4e8ed9,_0x24bafb){return function(_0xe1c04a){if(!_0xe1c04a){_0x4e8ed9[_0xd80e('0x29')](0x194);}return _0xe1c04a;};}function handleError(_0x46c05d,_0x5376eb){_0x5376eb=_0x5376eb||0x1f4;return function(_0x15f317){logger[_0xd80e('0x2a')](_0x15f317[_0xd80e('0x2b')]);if(_0x15f317[_0xd80e('0x2c')]){delete _0x15f317[_0xd80e('0x2c')];}_0x46c05d[_0xd80e('0x1b')](_0x5376eb)[_0xd80e('0x2d')](_0x15f317);};}exports[_0xd80e('0x2e')]=function(_0x5522dd,_0x54504e){var _0x30f9bd={},_0x1303eb={},_0x400220={'count':0x0,'rows':[]};var _0x32360c=_[_0xd80e('0x2f')](db[_0xd80e('0x30')]['rawAttributes'],function(_0x568d82){return{'name':_0x568d82[_0xd80e('0x31')],'type':_0x568d82[_0xd80e('0x32')][_0xd80e('0x33')]};});_0x1303eb[_0xd80e('0x34')]=_[_0xd80e('0x2f')](_0x32360c,_0xd80e('0x2c'));_0x1303eb[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x5522dd['query']);_0x1303eb['filters']=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],_0x1303eb[_0xd80e('0x35')]);_0x30f9bd[_0xd80e('0x38')]=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x5522dd[_0xd80e('0x35')][_0xd80e('0x39')]));_0x30f9bd[_0xd80e('0x38')]=_0x30f9bd['attributes'][_0xd80e('0x3a')]?_0x30f9bd['attributes']:_0x1303eb[_0xd80e('0x34')];if(!_0x5522dd[_0xd80e('0x35')][_0xd80e('0x3b')](_0xd80e('0x3c'))){_0x30f9bd['limit']=qs[_0xd80e('0x1f')](_0x5522dd['query'][_0xd80e('0x1f')]);_0x30f9bd['offset']=qs[_0xd80e('0x1d')](_0x5522dd[_0xd80e('0x35')]['offset']);}_0x30f9bd[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x5522dd[_0xd80e('0x35')]['sort']);_0x30f9bd[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x5522dd[_0xd80e('0x35')],_0x1303eb[_0xd80e('0x40')]),_0x32360c);if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x42')]){_0x30f9bd[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x30f9bd['where'],{'$or':_['map'](_0x32360c,function(_0x4e92f6){if(_0x4e92f6[_0xd80e('0x32')]!==_0xd80e('0x44')){var _0x55925e={};_0x55925e[_0x4e92f6[_0xd80e('0x2c')]]={'$like':'%'+_0x5522dd['query'][_0xd80e('0x42')]+'%'};return _0x55925e;}})});}_0x30f9bd=_['merge']({},_0x30f9bd,_0x5522dd[_0xd80e('0x45')]);var _0xae1514={'where':_0x30f9bd['where']};return db['VoiceMail'][_0xd80e('0x20')](_0xae1514)[_0xd80e('0x25')](function(_0x439673){_0x400220[_0xd80e('0x20')]=_0x439673;if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x46')]){_0x30f9bd[_0xd80e('0x47')]=[{'all':!![]}];}return db[_0xd80e('0x30')][_0xd80e('0x48')](_0x30f9bd);})[_0xd80e('0x25')](function(_0x1bbb36){_0x400220[_0xd80e('0x49')]=_0x1bbb36;return _0x400220;})[_0xd80e('0x25')](respondWithFilteredResult(_0x54504e,_0x30f9bd))[_0xd80e('0x4a')](handleError(_0x54504e,null));};exports[_0xd80e('0x4b')]=function(_0x7f80a,_0x558911){var _0x52213c={'raw':!![],'where':{'id':_0x7f80a[_0xd80e('0x4c')]['id']}},_0x5bdea5={};_0x5bdea5['model']=_[_0xd80e('0x36')](db[_0xd80e('0x30')][_0xd80e('0x4d')]);_0x5bdea5[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x7f80a[_0xd80e('0x35')]);_0x5bdea5['filters']=_['intersection'](_0x5bdea5['model'],_0x5bdea5[_0xd80e('0x35')]);_0x52213c['attributes']=_[_0xd80e('0x37')](_0x5bdea5[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x7f80a[_0xd80e('0x35')][_0xd80e('0x39')]));_0x52213c['attributes']=_0x52213c[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x52213c[_0xd80e('0x38')]:_0x5bdea5['model'];if(_0x7f80a[_0xd80e('0x35')][_0xd80e('0x46')]){_0x52213c[_0xd80e('0x47')]=[{'all':!![]}];}_0x52213c=_['merge']({},_0x52213c,_0x7f80a[_0xd80e('0x45')]);return db[_0xd80e('0x30')][_0xd80e('0x4e')](_0x52213c)[_0xd80e('0x25')](handleEntityNotFound(_0x558911,null))[_0xd80e('0x25')](respondWithResult(_0x558911,null))[_0xd80e('0x4a')](handleError(_0x558911,null));};exports['create']=function(_0x5aad1b,_0x275985){return db[_0xd80e('0x30')][_0xd80e('0x4f')](_0x5aad1b['body'],{})['then'](function(_0x1762a8){var _0xff0980=_0x5aad1b[_0xd80e('0x50')][_0xd80e('0x27')]({'plain':!![]});if(!_0xff0980)throw new Error(_0xd80e('0x51'));if(_0xff0980['role']===_0xd80e('0x50')){var _0x5c392d=_0x1762a8[_0xd80e('0x27')]({'plain':!![]});var _0x31107b='Voicemails';return db[_0xd80e('0x52')][_0xd80e('0x4e')]({'where':{'name':_0x31107b,'userProfileId':_0xff0980[_0xd80e('0x53')]},'raw':!![]})[_0xd80e('0x25')](function(_0x44b2f5){if(_0x44b2f5&&_0x44b2f5[_0xd80e('0x54')]===0x0){return db[_0xd80e('0x55')]['create']({'name':_0x5c392d[_0xd80e('0x2c')],'resourceId':_0x5c392d['id'],'type':_0x44b2f5[_0xd80e('0x2c')],'sectionId':_0x44b2f5['id']},{})[_0xd80e('0x25')](function(){return _0x1762a8;});}else{return _0x1762a8;}})['catch'](function(_0x52ab04){logger[_0xd80e('0x2a')](_0xd80e('0x56'),_0x52ab04);throw _0x52ab04;});}return _0x1762a8;})[_0xd80e('0x25')](respondWithResult(_0x275985,0xc9))[_0xd80e('0x4a')](handleError(_0x275985,null));};exports[_0xd80e('0x24')]=function(_0x8b7a70,_0x53b2b8){if(_0x8b7a70[_0xd80e('0x57')]['id']){delete _0x8b7a70['body']['id'];}return db[_0xd80e('0x30')]['find']({'where':{'id':_0x8b7a70[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x53b2b8,null))[_0xd80e('0x25')](saveUpdates(_0x8b7a70[_0xd80e('0x57')],null))[_0xd80e('0x25')](respondWithResult(_0x53b2b8,null))[_0xd80e('0x4a')](handleError(_0x53b2b8,null));};exports['destroy']=function(_0x13270c,_0x4e7edd){return db[_0xd80e('0x30')][_0xd80e('0x4e')]({'where':{'id':_0x13270c['params']['id']}})['then'](handleEntityNotFound(_0x4e7edd,null))[_0xd80e('0x25')](removeEntity(_0x4e7edd,null))[_0xd80e('0x4a')](handleError(_0x4e7edd,null));};exports[_0xd80e('0x58')]=function(_0x570a02,_0x568770,_0x1ba0ed){return db[_0xd80e('0x30')]['findOne']({'where':{'id':_0x570a02[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x568770,null))[_0xd80e('0x25')](function(_0x539390){var _0x41dda0;var _0x589c0b={},_0x720eab={};_0x720eab[_0xd80e('0x34')]=_[_0xd80e('0x36')](db[_0xd80e('0x59')]['rawAttributes']);_0x720eab[_0xd80e('0x35')]=_['keys'](_0x570a02[_0xd80e('0x35')]);_0x720eab['filters']=_[_0xd80e('0x37')](_0x720eab[_0xd80e('0x34')],_0x720eab[_0xd80e('0x35')]);_0x589c0b[_0xd80e('0x38')]=_['intersection'](_0x720eab[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x570a02['query'][_0xd80e('0x39')]));_0x589c0b[_0xd80e('0x38')]=_0x589c0b[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x589c0b['attributes']:_0x720eab[_0xd80e('0x34')];if(!_0x570a02[_0xd80e('0x35')]['hasOwnProperty'](_0xd80e('0x3c'))){_0x589c0b[_0xd80e('0x1f')]=qs[_0xd80e('0x1f')](_0x570a02['query']['limit']);_0x589c0b['offset']=qs['offset'](_0x570a02[_0xd80e('0x35')]['offset']);}_0x589c0b[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x570a02[_0xd80e('0x35')]['sort']);_0x589c0b[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x570a02[_0xd80e('0x35')],_0x720eab[_0xd80e('0x40')]));if(_0x570a02[_0xd80e('0x35')][_0xd80e('0x42')]){_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b['where'],{'$or':_['map'](_0x589c0b[_0xd80e('0x38')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x570a02[_0xd80e('0x35')]['filter']+'%'};return _0x10104c;})});}_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b[_0xd80e('0x3f')],{'mailboxuser':_0x539390[_0xd80e('0x5a')]});_0x589c0b=_[_0xd80e('0x43')]({},_0x589c0b,_0x570a02['options']);return db[_0xd80e('0x59')][_0xd80e('0x5b')](_0x589c0b)[_0xd80e('0x25')](respondWithFilteredResult(_0x568770,_0x589c0b));})[_0xd80e('0x4a')](handleError(_0x568770,null));}; \ No newline at end of file +var _0x0fd9=['ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x406342,_0xfcdf46){var _0x28ef3b=function(_0x1fa1da){while(--_0x1fa1da){_0x406342['push'](_0x406342['shift']());}};_0x28ef3b(++_0xfcdf46);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x0fd9[_0x5a60ce];return _0x393e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){var _0x52b066=_0x300262[_0x90fd('0x26')]({'plain':!![]});var _0x18d5b3=_0x90fd('0x27');return db[_0x90fd('0x28')][_0x90fd('0x29')]({'where':{'type':_0x18d5b3,'resourceId':_0x52b066['id']}})['then'](function(){return _0x300262;});})[_0x90fd('0x25')](function(){_0x3ad6c6[_0x90fd('0x19')](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x1cdc38,_0x1c3805){return function(_0x428bc2){if(!_0x428bc2){_0x1cdc38['sendStatus'](0x194);}return _0x428bc2;};}function handleError(_0x5671fc,_0xbf1c9b){_0xbf1c9b=_0xbf1c9b||0x1f4;return function(_0x170cfb){logger[_0x90fd('0x2a')](_0x170cfb[_0x90fd('0x2b')]);if(_0x170cfb[_0x90fd('0x2c')]){delete _0x170cfb['name'];}_0x5671fc['status'](_0xbf1c9b)[_0x90fd('0x2d')](_0x170cfb);};}exports[_0x90fd('0x2e')]=function(_0x228fbc,_0x3a0102){var _0x4a3ae4={},_0x59aede={},_0x12dea4={'count':0x0,'rows':[]};var _0x21a9cf=_[_0x90fd('0x2f')](db[_0x90fd('0x30')]['rawAttributes'],function(_0x2c5204){return{'name':_0x2c5204[_0x90fd('0x31')],'type':_0x2c5204[_0x90fd('0x32')][_0x90fd('0x33')]};});_0x59aede[_0x90fd('0x34')]=_[_0x90fd('0x2f')](_0x21a9cf,_0x90fd('0x2c'));_0x59aede[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x228fbc[_0x90fd('0x35')]);_0x59aede[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x59aede[_0x90fd('0x34')],_0x59aede[_0x90fd('0x35')]);_0x4a3ae4[_0x90fd('0x39')]=_[_0x90fd('0x38')](_0x59aede['model'],qs[_0x90fd('0x3a')](_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x4a3ae4[_0x90fd('0x39')]=_0x4a3ae4[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x4a3ae4[_0x90fd('0x39')]:_0x59aede[_0x90fd('0x34')];if(!_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3c')](_0x90fd('0x3d'))){_0x4a3ae4[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x228fbc['query'][_0x90fd('0x1c')]);_0x4a3ae4[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x228fbc[_0x90fd('0x35')]['offset']);}_0x4a3ae4[_0x90fd('0x3e')]=qs[_0x90fd('0x3f')](_0x228fbc[_0x90fd('0x35')]['sort']);_0x4a3ae4['where']=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x228fbc[_0x90fd('0x35')],_0x59aede[_0x90fd('0x37')]),_0x21a9cf);if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]){_0x4a3ae4[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x4a3ae4[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x21a9cf,function(_0x3265c6){if(_0x3265c6[_0x90fd('0x32')]!==_0x90fd('0x44')){var _0x47856d={};_0x47856d[_0x3265c6[_0x90fd('0x2c')]]={'$like':'%'+_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]+'%'};return _0x47856d;}})});}_0x4a3ae4=_[_0x90fd('0x43')]({},_0x4a3ae4,_0x228fbc['options']);var _0xa5f17={'where':_0x4a3ae4[_0x90fd('0x42')]};return db[_0x90fd('0x30')]['count'](_0xa5f17)['then'](function(_0x47b8c8){_0x12dea4[_0x90fd('0x1d')]=_0x47b8c8;if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x45')]){_0x4a3ae4[_0x90fd('0x46')]=[{'all':!![]}];}return db[_0x90fd('0x30')][_0x90fd('0x47')](_0x4a3ae4);})[_0x90fd('0x25')](function(_0x733d4d){_0x12dea4[_0x90fd('0x48')]=_0x733d4d;return _0x12dea4;})[_0x90fd('0x25')](respondWithFilteredResult(_0x3a0102,_0x4a3ae4))[_0x90fd('0x49')](handleError(_0x3a0102,null));};exports[_0x90fd('0x4a')]=function(_0x4cb682,_0x386a0e){var _0x311cbf={'raw':!![],'where':{'id':_0x4cb682['params']['id']}},_0x50b722={};_0x50b722[_0x90fd('0x34')]=_[_0x90fd('0x36')](db[_0x90fd('0x30')]['rawAttributes']);_0x50b722['query']=_[_0x90fd('0x36')](_0x4cb682[_0x90fd('0x35')]);_0x50b722['filters']=_['intersection'](_0x50b722[_0x90fd('0x34')],_0x50b722[_0x90fd('0x35')]);_0x311cbf['attributes']=_['intersection'](_0x50b722[_0x90fd('0x34')],qs[_0x90fd('0x3a')](_0x4cb682[_0x90fd('0x35')]['fields']));_0x311cbf[_0x90fd('0x39')]=_0x311cbf[_0x90fd('0x39')]['length']?_0x311cbf['attributes']:_0x50b722['model'];if(_0x4cb682[_0x90fd('0x35')][_0x90fd('0x45')]){_0x311cbf['include']=[{'all':!![]}];}_0x311cbf=_[_0x90fd('0x43')]({},_0x311cbf,_0x4cb682[_0x90fd('0x4b')]);return db[_0x90fd('0x30')][_0x90fd('0x4c')](_0x311cbf)[_0x90fd('0x25')](handleEntityNotFound(_0x386a0e,null))['then'](respondWithResult(_0x386a0e,null))['catch'](handleError(_0x386a0e,null));};exports[_0x90fd('0x4d')]=function(_0x326e4d,_0x125874){return db[_0x90fd('0x30')][_0x90fd('0x4d')](_0x326e4d[_0x90fd('0x4e')],{})[_0x90fd('0x25')](function(_0x277751){var _0x31b284=_0x326e4d[_0x90fd('0x4f')]['get']({'plain':!![]});if(!_0x31b284)throw new Error(_0x90fd('0x50'));if(_0x31b284[_0x90fd('0x51')]===_0x90fd('0x4f')){var _0x38021b=_0x277751['get']({'plain':!![]});var _0x4cf061=_0x90fd('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4cf061,'userProfileId':_0x31b284[_0x90fd('0x52')]},'raw':!![]})[_0x90fd('0x25')](function(_0x41f029){if(_0x41f029&&_0x41f029[_0x90fd('0x53')]===0x0){return db[_0x90fd('0x28')][_0x90fd('0x4d')]({'name':_0x38021b[_0x90fd('0x2c')],'resourceId':_0x38021b['id'],'type':_0x41f029['name'],'sectionId':_0x41f029['id']},{})['then'](function(){return _0x277751;});}else{return _0x277751;}})[_0x90fd('0x49')](function(_0x43d076){logger[_0x90fd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d076);throw _0x43d076;});}return _0x277751;})[_0x90fd('0x25')](respondWithResult(_0x125874,0xc9))[_0x90fd('0x49')](handleError(_0x125874,null));};exports[_0x90fd('0x24')]=function(_0x3494f7,_0x437abd){if(_0x3494f7[_0x90fd('0x4e')]['id']){delete _0x3494f7[_0x90fd('0x4e')]['id'];}return db[_0x90fd('0x30')]['find']({'where':{'id':_0x3494f7['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x437abd,null))[_0x90fd('0x25')](saveUpdates(_0x3494f7[_0x90fd('0x4e')],null))['then'](respondWithResult(_0x437abd,null))[_0x90fd('0x49')](handleError(_0x437abd,null));};exports[_0x90fd('0x29')]=function(_0x29b880,_0x24229f){return db[_0x90fd('0x30')][_0x90fd('0x4c')]({'where':{'id':_0x29b880['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x24229f,null))['then'](removeEntity(_0x24229f,null))[_0x90fd('0x49')](handleError(_0x24229f,null));};exports['getMessages']=function(_0x29b7ea,_0x461509,_0x2fb220){return db[_0x90fd('0x30')]['findOne']({'where':{'id':_0x29b7ea[_0x90fd('0x54')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x461509,null))[_0x90fd('0x25')](function(_0x40fea3){var _0x4586e9;var _0x15bca2={},_0x57acf6={};_0x57acf6['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x57acf6[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x29b7ea[_0x90fd('0x35')]);_0x57acf6[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x57acf6['model'],_0x57acf6['query']);_0x15bca2['attributes']=_[_0x90fd('0x38')](_0x57acf6[_0x90fd('0x34')],qs['fields'](_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x15bca2[_0x90fd('0x39')]=_0x15bca2[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x15bca2[_0x90fd('0x39')]:_0x57acf6[_0x90fd('0x34')];if(!_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3c')]('nolimit')){_0x15bca2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x29b7ea[_0x90fd('0x35')]['limit']);_0x15bca2['offset']=qs[_0x90fd('0x1e')](_0x29b7ea[_0x90fd('0x35')]['offset']);}_0x15bca2[_0x90fd('0x3e')]=qs['sort'](_0x29b7ea['query'][_0x90fd('0x3f')]);_0x15bca2[_0x90fd('0x42')]=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x29b7ea[_0x90fd('0x35')],_0x57acf6[_0x90fd('0x37')]));if(_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x41')]){_0x15bca2['where']=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x15bca2['attributes'],function(_0x2d0f4b){var _0x4636d5={};_0x4636d5[_0x2d0f4b]={'$like':'%'+_0x29b7ea['query']['filter']+'%'};return _0x4636d5;})});}_0x15bca2[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'mailboxuser':_0x40fea3['mailbox']});_0x15bca2=_[_0x90fd('0x43')]({},_0x15bca2,_0x29b7ea['options']);return db['VoiceMailMessage'][_0x90fd('0x55')](_0x15bca2)['then'](respondWithFilteredResult(_0x461509,_0x15bca2));})[_0x90fd('0x49')](handleError(_0x461509,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index dcc3daa..2e639b5 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 _0x7c9a=['VoiceMail','voice_voicemail','mailbox','api','moment','request-promise','path','rimraf','./voiceMail.attributes','define'];(function(_0x5ad321,_0x43a8de){var _0x3b9dc1=function(_0x49d41f){while(--_0x49d41f){_0x5ad321['push'](_0x5ad321['shift']());}};_0x3b9dc1(++_0x43a8de);}(_0x7c9a,0x12f));var _0xa7c9=function(_0x32306f,_0x4a902e){_0x32306f=_0x32306f-0x0;var _0x32df90=_0x7c9a[_0x32306f];return _0x32df90;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa7c9('0x0'));var moment=require(_0xa7c9('0x1'));var BPromise=require('bluebird');var rp=require(_0xa7c9('0x2'));var fs=require('fs');var path=require(_0xa7c9('0x3'));var rimraf=require(_0xa7c9('0x4'));var config=require('../../config/environment');var attributes=require(_0xa7c9('0x5'));module['exports']=function(_0x14bab6,_0x49ceed){return _0x14bab6[_0xa7c9('0x6')](_0xa7c9('0x7'),attributes,{'tableName':_0xa7c9('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xa7c9('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x151c=['request-promise','path','rimraf','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','context','util','api','moment'];(function(_0x26a051,_0x4eeae0){var _0x21c9e3=function(_0x773b9f){while(--_0x773b9f){_0x26a051['push'](_0x26a051['shift']());}};_0x21c9e3(++_0x4eeae0);}(_0x151c,0x1dd));var _0xc151=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x151c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xc151('0x0'));var logger=require('../../config/logger')(_0xc151('0x1'));var moment=require(_0xc151('0x2'));var BPromise=require('bluebird');var rp=require(_0xc151('0x3'));var fs=require('fs');var path=require(_0xc151('0x4'));var rimraf=require(_0xc151('0x5'));var config=require('../../config/environment');var attributes=require(_0xc151('0x6'));module[_0xc151('0x7')]=function(_0x21fbcb,_0x85e9b1){return _0x21fbcb[_0xc151('0x8')]('VoiceMail',attributes,{'tableName':_0xc151('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc151('0xa'),_0xc151('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c8f7010..20665c9 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 _0xb92a=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0xb92a,0x15b));var _0xab92=function(_0x3dbcef,_0xcdfaaa){_0x3dbcef=_0x3dbcef-0x0;var _0x1770c8=_0xb92a[_0x3dbcef];return _0x1770c8;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab92('0x3'));var db=require(_0xab92('0x4'))['db'];var utils=require(_0xab92('0x5'));var logger=require(_0xab92('0x6'))(_0xab92('0x7'));var config=require(_0xab92('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xab92('0x9')][_0xab92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fe6c5,_0x4cc7b9,_0x1e2777){return new BPromise(function(_0x3d28b5,_0x1c3efa){return client[_0xab92('0xb')](_0x3fe6c5,_0x1e2777)[_0xab92('0xc')](function(_0x110b09){logger[_0xab92('0xd')](_0xab92('0xe'),_0x4cc7b9,_0xab92('0xf'));logger[_0xab92('0x10')](_0xab92('0x11'),_0x4cc7b9,_0xab92('0xf'),JSON['stringify'](_0x110b09));if(_0x110b09['error']){if(_0x110b09['error'][_0xab92('0x12')]===0x1f4){logger[_0xab92('0x13')](_0xab92('0xe'),_0x4cc7b9,_0x110b09[_0xab92('0x13')]['message']);return _0x1c3efa(_0x110b09[_0xab92('0x13')]['message']);}logger[_0xab92('0x13')](_0xab92('0xe'),_0x4cc7b9,_0x110b09['error'][_0xab92('0x14')]);return _0x3d28b5(_0x110b09[_0xab92('0x13')][_0xab92('0x14')]);}else{logger['info'](_0xab92('0xe'),_0x4cc7b9,_0xab92('0xf'));_0x3d28b5(_0x110b09[_0xab92('0x15')]['message']);}})[_0xab92('0x16')](function(_0x3a6a7e){logger[_0xab92('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4cc7b9,_0x3a6a7e);_0x1c3efa(_0x3a6a7e);});});} \ No newline at end of file +var _0xcdb6=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4722ad,_0x24f7b5){var _0xea80b0=function(_0x12be83){while(--_0x12be83){_0x4722ad['push'](_0x4722ad['shift']());}};_0xea80b0(++_0x24f7b5);}(_0xcdb6,0xa1));var _0x6cdb=function(_0x31c1b9,_0x48330e){_0x31c1b9=_0x31c1b9-0x0;var _0x3da56b=_0xcdb6[_0x31c1b9];return _0x3da56b;};'use strict';var _=require(_0x6cdb('0x0'));var util=require(_0x6cdb('0x1'));var moment=require(_0x6cdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cdb('0x3'));var fs=require('fs');var Redis=require(_0x6cdb('0x4'));var db=require(_0x6cdb('0x5'))['db'];var utils=require(_0x6cdb('0x6'));var logger=require(_0x6cdb('0x7'))(_0x6cdb('0x8'));var config=require(_0x6cdb('0x9'));var jayson=require(_0x6cdb('0xa'));var client=jayson['client'][_0x6cdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47bc37,_0x3224e5,_0x50c3c1){return new BPromise(function(_0x1c77b4,_0x5b9798){return client[_0x6cdb('0xc')](_0x47bc37,_0x50c3c1)[_0x6cdb('0xd')](function(_0x32192a){logger[_0x6cdb('0xe')](_0x6cdb('0xf'),_0x3224e5,_0x6cdb('0x10'));logger[_0x6cdb('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3224e5,'request\x20sent',JSON[_0x6cdb('0x12')](_0x32192a));if(_0x32192a[_0x6cdb('0x13')]){if(_0x32192a['error'][_0x6cdb('0x14')]===0x1f4){logger[_0x6cdb('0x13')](_0x6cdb('0xf'),_0x3224e5,_0x32192a[_0x6cdb('0x13')][_0x6cdb('0x15')]);return _0x5b9798(_0x32192a[_0x6cdb('0x13')][_0x6cdb('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3224e5,_0x32192a['error'][_0x6cdb('0x15')]);return _0x1c77b4(_0x32192a[_0x6cdb('0x13')][_0x6cdb('0x15')]);}else{logger[_0x6cdb('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3224e5,'request\x20sent');_0x1c77b4(_0x32192a[_0x6cdb('0x16')][_0x6cdb('0x15')]);}})[_0x6cdb('0x17')](function(_0x3172fa){logger[_0x6cdb('0x13')](_0x6cdb('0xf'),_0x3224e5,_0x3172fa);_0x5b9798(_0x3172fa);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1a80087..86961e8 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 _0x8e6b=['/:id','/:id/download','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x16619b,_0x1edd37){var _0x4f7ade=function(_0x4fa9e){while(--_0x4fa9e){_0x16619b['push'](_0x16619b['shift']());}};_0x4f7ade(++_0x1edd37);}(_0x8e6b,0x1c7));var _0xb8e6=function(_0x5426d9,_0x1eb3f6){_0x5426d9=_0x5426d9-0x0;var _0x344b02=_0x8e6b[_0x5426d9];return _0x344b02;};'use strict';var multer=require(_0xb8e6('0x0'));var util=require(_0xb8e6('0x1'));var path=require(_0xb8e6('0x2'));var timeout=require(_0xb8e6('0x3'));var express=require('express');var router=express[_0xb8e6('0x4')]();var fs_extra=require(_0xb8e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb8e6('0x6'));var config=require(_0xb8e6('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xb8e6('0x8')](),controller['index']);router[_0xb8e6('0x9')](_0xb8e6('0xa'),auth[_0xb8e6('0x8')](),controller['show']);router['get'](_0xb8e6('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb8e6('0xa'),auth['isAuthenticated'](),controller[_0xb8e6('0xc')]);router[_0xb8e6('0xd')](_0xb8e6('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb8e6('0xe')]=router; \ No newline at end of file +var _0xb5ca=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0xb5ca,0x1ca));var _0xab5c=function(_0x89efcc,_0x161b0a){_0x89efcc=_0x89efcc-0x0;var _0xa3fc20=_0xb5ca[_0x89efcc];return _0xa3fc20;};'use strict';var multer=require(_0xab5c('0x0'));var util=require(_0xab5c('0x1'));var path=require(_0xab5c('0x2'));var timeout=require(_0xab5c('0x3'));var express=require(_0xab5c('0x4'));var router=express[_0xab5c('0x5')]();var fs_extra=require(_0xab5c('0x6'));var auth=require(_0xab5c('0x7'));var interaction=require(_0xab5c('0x8'));var config=require('../../config/environment');var controller=require(_0xab5c('0x9'));router[_0xab5c('0xa')]('/',auth[_0xab5c('0xb')](),controller[_0xab5c('0xc')]);router[_0xab5c('0xa')](_0xab5c('0xd'),auth[_0xab5c('0xb')](),controller[_0xab5c('0xe')]);router[_0xab5c('0xa')](_0xab5c('0xf'),auth[_0xab5c('0xb')](),controller['download']);router[_0xab5c('0x10')]('/',auth[_0xab5c('0xb')](),controller['create']);router[_0xab5c('0x11')](_0xab5c('0xd'),auth[_0xab5c('0xb')](),controller[_0xab5c('0x12')]);router[_0xab5c('0x13')](_0xab5c('0xd'),auth[_0xab5c('0xb')](),controller[_0xab5c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6bb74bc..aba4cf2 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 _0x3244=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','STRING','long'];(function(_0x1745fa,_0x17f4f8){var _0x5794d1=function(_0x2364b5){while(--_0x2364b5){_0x1745fa['push'](_0x1745fa['shift']());}};_0x5794d1(++_0x17f4f8);}(_0x3244,0x1c9));var _0x4324=function(_0x2f95b7,_0x2274de){_0x2f95b7=_0x2f95b7-0x0;var _0x4dc9cf=_0x3244[_0x2f95b7];return _0x4dc9cf;};'use strict';var Sequelize=require(_0x4324('0x0'));module['exports']={'name':{'type':Sequelize[_0x4324('0x1')],'get':function(_0x598c65){return this[_0x4324('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x4324('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4324('0x3')],'defaultValue':''},'stamp':{'type':_0x4324('0x5'),'defaultValue':Sequelize['literal'](_0x4324('0x6'))}}; \ No newline at end of file +var _0xf078=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf078,0xb2));var _0x8f07=function(_0x120c92,_0x4641d7){_0x120c92=_0x120c92-0x0;var _0x5b3992=_0xf078[_0x120c92];return _0x5b3992;};'use strict';var Sequelize=require(_0x8f07('0x0'));module[_0x8f07('0x1')]={'name':{'type':Sequelize[_0x8f07('0x2')],'get':function(_0xd58255){return this[_0x8f07('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x8f07('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8f07('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x8f07('0x6')](_0x8f07('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 77ef46e..b1be45d 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 _0x1c71=['merge','type','VoiceMailMessage','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter'];(function(_0xab12d4,_0x5e5d8e){var _0x355e03=function(_0x410dd6){while(--_0x410dd6){_0xab12d4['push'](_0xab12d4['shift']());}};_0x355e03(++_0x5e5d8e);}(_0x1c71,0x150));var _0x11c7=function(_0x5c0a85,_0x508dd7){_0x5c0a85=_0x5c0a85-0x0;var _0x4b55d6=_0x1c71[_0x5c0a85];return _0x4b55d6;};'use strict';var emlformat=require(_0x11c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x11c7('0x1'));var rp=require(_0x11c7('0x2'));var moment=require('moment');var BPromise=require(_0x11c7('0x3'));var Mustache=require(_0x11c7('0x4'));var util=require(_0x11c7('0x5'));var path=require('path');var sox=require(_0x11c7('0x6'));var csv=require(_0x11c7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11c7('0x8'));var squel=require(_0x11c7('0x9'));var crypto=require(_0x11c7('0xa'));var jsforce=require(_0x11c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x11c7('0x7'));var querystring=require('querystring');var Papa=require(_0x11c7('0xc'));var Redis=require(_0x11c7('0xd'));var authService=require(_0x11c7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x11c7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x11c7('0x10'));var config=require(_0x11c7('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x11c7('0x12'))['db'];function respondWithStatusCode(_0x11f499,_0x3254de){_0x3254de=_0x3254de||0xcc;return function(_0x2d90cd){if(_0x2d90cd){return _0x11f499['sendStatus'](_0x3254de);}return _0x11f499[_0x11c7('0x13')](_0x3254de)[_0x11c7('0x14')]();};}function respondWithResult(_0x203525,_0x3b5ed9){_0x3b5ed9=_0x3b5ed9||0xc8;return function(_0x4b5671){if(_0x4b5671){return _0x203525[_0x11c7('0x13')](_0x3b5ed9)['json'](_0x4b5671);}};}function respondWithFilteredResult(_0x1bb47c,_0x41279b){return function(_0x355a42){if(_0x355a42){var _0x5add5d=typeof _0x41279b[_0x11c7('0x15')]===_0x11c7('0x16')&&typeof _0x41279b[_0x11c7('0x17')]===_0x11c7('0x16');var _0x26c772=_0x355a42[_0x11c7('0x18')];var _0x3a4050=_0x5add5d?0x0:_0x41279b[_0x11c7('0x15')];var _0x55130b=_0x5add5d?_0x355a42['count']:_0x41279b['offset']+_0x41279b[_0x11c7('0x17')];var _0x12dbdd;if(_0x55130b>=_0x26c772){_0x55130b=_0x26c772;_0x12dbdd=0xc8;}else{_0x12dbdd=0xce;}_0x1bb47c['status'](_0x12dbdd);return _0x1bb47c[_0x11c7('0x19')](_0x11c7('0x1a'),_0x3a4050+'-'+_0x55130b+'/'+_0x26c772)[_0x11c7('0x1b')](_0x355a42);}return null;};}function patchUpdates(_0x645589){return function(_0x6a9040){try{jsonpatch[_0x11c7('0x1c')](_0x6a9040,_0x645589,!![]);}catch(_0x374164){return BPromise[_0x11c7('0x1d')](_0x374164);}return _0x6a9040['save']();};}function saveUpdates(_0x26a2e3,_0x349e6d){return function(_0xbda864){if(_0xbda864){return _0xbda864[_0x11c7('0x1e')](_0x26a2e3)[_0x11c7('0x1f')](function(_0x19eabe){return _0x19eabe;});}return null;};}function removeEntity(_0x5b7075,_0xb15992){return function(_0xe82027){if(_0xe82027){return _0xe82027[_0x11c7('0x20')]()[_0x11c7('0x1f')](function(){_0x5b7075[_0x11c7('0x13')](0xcc)[_0x11c7('0x14')]();});}};}function handleEntityNotFound(_0x2a74e2,_0x175807){return function(_0x456c6b){if(!_0x456c6b){_0x2a74e2[_0x11c7('0x21')](0x194);}return _0x456c6b;};}function handleError(_0x3007b3,_0x378521){_0x378521=_0x378521||0x1f4;return function(_0x3f2bf1){logger['error'](_0x3f2bf1[_0x11c7('0x22')]);if(_0x3f2bf1[_0x11c7('0x23')]){delete _0x3f2bf1[_0x11c7('0x23')];}_0x3007b3[_0x11c7('0x13')](_0x378521)['send'](_0x3f2bf1);};}exports['index']=function(_0x1f9667,_0x1a246c){var _0x1aaa1d={},_0x408fb8={},_0x4abb16={'count':0x0,'rows':[]};var _0x4ae5dd=_[_0x11c7('0x24')](db['VoiceMailMessage'][_0x11c7('0x25')],function(_0x2223f8){return{'name':_0x2223f8[_0x11c7('0x26')],'type':_0x2223f8['type'][_0x11c7('0x27')]};});_0x408fb8[_0x11c7('0x28')]=_[_0x11c7('0x29')](_['map'](_0x4ae5dd,_0x11c7('0x23')),[_0x11c7('0x23')]);_0x408fb8[_0x11c7('0x2a')]=_[_0x11c7('0x2b')](_0x1f9667[_0x11c7('0x2a')]);_0x408fb8[_0x11c7('0x2c')]=_[_0x11c7('0x2d')](_0x408fb8['model'],_0x408fb8['query']);_0x1aaa1d[_0x11c7('0x2e')]=_[_0x11c7('0x2d')](_0x408fb8[_0x11c7('0x28')],qs['fields'](_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x2f')]));_0x1aaa1d['attributes']=_0x1aaa1d[_0x11c7('0x2e')][_0x11c7('0x30')]?_0x1aaa1d[_0x11c7('0x2e')]:_0x408fb8['model'];if(!_0x1f9667['query']['hasOwnProperty'](_0x11c7('0x31'))){_0x1aaa1d['limit']=qs[_0x11c7('0x17')](_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x17')]);_0x1aaa1d[_0x11c7('0x15')]=qs[_0x11c7('0x15')](_0x1f9667['query']['offset']);}_0x1aaa1d[_0x11c7('0x32')]=qs[_0x11c7('0x33')](_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x33')]);_0x1aaa1d[_0x11c7('0x34')]=qs[_0x11c7('0x2c')](_['pick'](_0x1f9667[_0x11c7('0x2a')],_0x408fb8[_0x11c7('0x2c')]),_0x4ae5dd);if(_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x35')]){_0x1aaa1d[_0x11c7('0x34')]=_[_0x11c7('0x36')](_0x1aaa1d[_0x11c7('0x34')],{'$or':_[_0x11c7('0x24')](_0x4ae5dd,function(_0x19ec9f){if(_0x19ec9f[_0x11c7('0x37')]!=='VIRTUAL'){var _0x176b51={};_0x176b51[_0x19ec9f[_0x11c7('0x23')]]={'$like':'%'+_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x35')]+'%'};return _0x176b51;}})});}_0x1aaa1d=_[_0x11c7('0x36')]({},_0x1aaa1d,_0x1f9667['options']);var _0x237e45={'where':_0x1aaa1d[_0x11c7('0x34')]};return db[_0x11c7('0x38')][_0x11c7('0x18')](_0x237e45)[_0x11c7('0x1f')](function(_0x2e710a){_0x4abb16[_0x11c7('0x18')]=_0x2e710a;if(_0x1f9667[_0x11c7('0x2a')][_0x11c7('0x39')]){_0x1aaa1d[_0x11c7('0x3a')]=[{'all':!![]}];}return db[_0x11c7('0x38')][_0x11c7('0x3b')](_0x1aaa1d);})[_0x11c7('0x1f')](function(_0x3c610f){_0x4abb16[_0x11c7('0x3c')]=_0x3c610f;return _0x4abb16;})[_0x11c7('0x1f')](respondWithFilteredResult(_0x1a246c,_0x1aaa1d))['catch'](handleError(_0x1a246c,null));};exports[_0x11c7('0x3d')]=function(_0x450219,_0x1cc7cf){var _0x389f9e={'raw':!![],'where':{'id':_0x450219[_0x11c7('0x3e')]['id']}},_0x317743={};_0x317743['model']=_['keys'](db['VoiceMailMessage'][_0x11c7('0x25')]);_0x317743[_0x11c7('0x2a')]=_[_0x11c7('0x2b')](_0x450219[_0x11c7('0x2a')]);_0x317743[_0x11c7('0x2c')]=_[_0x11c7('0x2d')](_0x317743[_0x11c7('0x28')],_0x317743[_0x11c7('0x2a')]);_0x389f9e[_0x11c7('0x2e')]=_[_0x11c7('0x2d')](_0x317743[_0x11c7('0x28')],qs[_0x11c7('0x2f')](_0x450219[_0x11c7('0x2a')][_0x11c7('0x2f')]));_0x389f9e[_0x11c7('0x2e')]=_0x389f9e['attributes'][_0x11c7('0x30')]?_0x389f9e['attributes']:_0x317743['model'];if(_0x450219[_0x11c7('0x2a')][_0x11c7('0x39')]){_0x389f9e[_0x11c7('0x3a')]=[{'all':!![]}];}_0x389f9e=_['merge']({},_0x389f9e,_0x450219[_0x11c7('0x3f')]);return db[_0x11c7('0x38')][_0x11c7('0x40')](_0x389f9e)['then'](handleEntityNotFound(_0x1cc7cf,null))[_0x11c7('0x1f')](respondWithResult(_0x1cc7cf,null))[_0x11c7('0x41')](handleError(_0x1cc7cf,null));};exports[_0x11c7('0x42')]=function(_0x9820e7,_0x577769){return db['VoiceMailMessage']['create'](_0x9820e7[_0x11c7('0x43')],{})[_0x11c7('0x1f')](respondWithResult(_0x577769,0xc9))[_0x11c7('0x41')](handleError(_0x577769,null));};exports[_0x11c7('0x1e')]=function(_0x3162cd,_0x5d3551){if(_0x3162cd['body']['id']){delete _0x3162cd[_0x11c7('0x43')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x3162cd['params']['id']}})[_0x11c7('0x1f')](handleEntityNotFound(_0x5d3551,null))['then'](saveUpdates(_0x3162cd[_0x11c7('0x43')],null))[_0x11c7('0x1f')](respondWithResult(_0x5d3551,null))[_0x11c7('0x41')](handleError(_0x5d3551,null));};exports['destroy']=function(_0xd1f579,_0x5575e9){return db[_0x11c7('0x38')]['find']({'where':{'id':_0xd1f579[_0x11c7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5575e9,null))[_0x11c7('0x1f')](removeEntity(_0x5575e9,null))[_0x11c7('0x41')](handleError(_0x5575e9,null));};exports['download']=function(_0x21b609,_0x30217e,_0x483d73){return db[_0x11c7('0x38')]['find']({'where':{'id':_0x21b609[_0x11c7('0x3e')]['id']},'attributes':['id',_0x11c7('0x44'),_0x11c7('0x45')]})[_0x11c7('0x1f')](handleEntityNotFound(_0x30217e,null))[_0x11c7('0x1f')](function(_0x24d56f){if(_0x24d56f){if(!_0x24d56f[_0x11c7('0x44')]){throw new db[(_0x11c7('0x46'))][(_0x11c7('0x47'))](_0x11c7('0x48'));}var _0x21bc23={'Content-Type':_0x11c7('0x49'),'Content-Disposition':'attachment'};if(_0x24d56f[_0x11c7('0x45')]){_0x21bc23[_0x11c7('0x4a')]=_0x11c7('0x4b')+_0x24d56f['msg_id']+_0x11c7('0x4c');}_0x30217e[_0x11c7('0x19')](_0x21bc23);return _0x30217e[_0x11c7('0x4d')](new Buffer(_0x24d56f[_0x11c7('0x44')]));}})[_0x11c7('0x41')](handleError(_0x30217e,null));}; \ No newline at end of file +var _0xd1e2=['catch','show','params','include','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMailMessage','includeAll','findAll','rows'];(function(_0x74da55,_0x207199){var _0x459778=function(_0x315a19){while(--_0x315a19){_0x74da55['push'](_0x74da55['shift']());}};_0x459778(++_0x207199);}(_0xd1e2,0x163));var _0x2d1e=function(_0xae0d41,_0x9cac8f){_0xae0d41=_0xae0d41-0x0;var _0x3b1e23=_0xd1e2[_0xae0d41];return _0x3b1e23;};'use strict';var emlformat=require(_0x2d1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d1e('0x1'));var jsonpatch=require(_0x2d1e('0x2'));var rp=require(_0x2d1e('0x3'));var moment=require(_0x2d1e('0x4'));var BPromise=require(_0x2d1e('0x5'));var Mustache=require(_0x2d1e('0x6'));var util=require('util');var path=require(_0x2d1e('0x7'));var sox=require(_0x2d1e('0x8'));var csv=require(_0x2d1e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d1e('0xa'));var _=require(_0x2d1e('0xb'));var squel=require(_0x2d1e('0xc'));var crypto=require(_0x2d1e('0xd'));var jsforce=require(_0x2d1e('0xe'));var deskjs=require(_0x2d1e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2d1e('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d1e('0x11'));var authService=require(_0x2d1e('0x12'));var qs=require(_0x2d1e('0x13'));var as=require(_0x2d1e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d1e('0x15'))(_0x2d1e('0x16'));var utils=require(_0x2d1e('0x17'));var config=require(_0x2d1e('0x18'));var licenseUtil=require(_0x2d1e('0x19'));var db=require(_0x2d1e('0x1a'))['db'];function respondWithStatusCode(_0x100925,_0x2aa460){_0x2aa460=_0x2aa460||0xcc;return function(_0x5a2462){if(_0x5a2462){return _0x100925[_0x2d1e('0x1b')](_0x2aa460);}return _0x100925[_0x2d1e('0x1c')](_0x2aa460)[_0x2d1e('0x1d')]();};}function respondWithResult(_0x262b16,_0x5950d7){_0x5950d7=_0x5950d7||0xc8;return function(_0x394f63){if(_0x394f63){return _0x262b16['status'](_0x5950d7)[_0x2d1e('0x1e')](_0x394f63);}};}function respondWithFilteredResult(_0x273852,_0x58f977){return function(_0x567bbf){if(_0x567bbf){var _0x5eda56=typeof _0x58f977[_0x2d1e('0x1f')]===_0x2d1e('0x20')&&typeof _0x58f977[_0x2d1e('0x21')]===_0x2d1e('0x20');var _0x55065b=_0x567bbf['count'];var _0x470d39=_0x5eda56?0x0:_0x58f977['offset'];var _0x1d2c13=_0x5eda56?_0x567bbf[_0x2d1e('0x22')]:_0x58f977[_0x2d1e('0x1f')]+_0x58f977[_0x2d1e('0x21')];var _0x13a3f4;if(_0x1d2c13>=_0x55065b){_0x1d2c13=_0x55065b;_0x13a3f4=0xc8;}else{_0x13a3f4=0xce;}_0x273852[_0x2d1e('0x1c')](_0x13a3f4);return _0x273852[_0x2d1e('0x23')]('Content-Range',_0x470d39+'-'+_0x1d2c13+'/'+_0x55065b)[_0x2d1e('0x1e')](_0x567bbf);}return null;};}function patchUpdates(_0x11c2ec){return function(_0x1796fe){try{jsonpatch[_0x2d1e('0x24')](_0x1796fe,_0x11c2ec,!![]);}catch(_0x43c430){return BPromise[_0x2d1e('0x25')](_0x43c430);}return _0x1796fe['save']();};}function saveUpdates(_0x48b537,_0x887b04){return function(_0x20be82){if(_0x20be82){return _0x20be82[_0x2d1e('0x26')](_0x48b537)[_0x2d1e('0x27')](function(_0x42c4dc){return _0x42c4dc;});}return null;};}function removeEntity(_0x494e18,_0x3fee07){return function(_0x27dafd){if(_0x27dafd){return _0x27dafd[_0x2d1e('0x28')]()[_0x2d1e('0x27')](function(){_0x494e18[_0x2d1e('0x1c')](0xcc)[_0x2d1e('0x1d')]();});}};}function handleEntityNotFound(_0xef5e79,_0x459712){return function(_0x2bceec){if(!_0x2bceec){_0xef5e79[_0x2d1e('0x1b')](0x194);}return _0x2bceec;};}function handleError(_0x359bc1,_0xca88ec){_0xca88ec=_0xca88ec||0x1f4;return function(_0x53e724){logger['error'](_0x53e724['stack']);if(_0x53e724[_0x2d1e('0x29')]){delete _0x53e724[_0x2d1e('0x29')];}_0x359bc1[_0x2d1e('0x1c')](_0xca88ec)[_0x2d1e('0x2a')](_0x53e724);};}exports[_0x2d1e('0x2b')]=function(_0xeae917,_0x5e44d9){var _0x471811={},_0x195adf={},_0x5bcfcd={'count':0x0,'rows':[]};var _0x4996ff=_[_0x2d1e('0x2c')](db['VoiceMailMessage'][_0x2d1e('0x2d')],function(_0x2e90e3){return{'name':_0x2e90e3[_0x2d1e('0x2e')],'type':_0x2e90e3[_0x2d1e('0x2f')][_0x2d1e('0x30')]};});_0x195adf[_0x2d1e('0x31')]=_['differenceBy'](_[_0x2d1e('0x2c')](_0x4996ff,_0x2d1e('0x29')),[_0x2d1e('0x29')]);_0x195adf['query']=_[_0x2d1e('0x32')](_0xeae917[_0x2d1e('0x33')]);_0x195adf['filters']=_['intersection'](_0x195adf[_0x2d1e('0x31')],_0x195adf['query']);_0x471811[_0x2d1e('0x34')]=_[_0x2d1e('0x35')](_0x195adf[_0x2d1e('0x31')],qs[_0x2d1e('0x36')](_0xeae917[_0x2d1e('0x33')][_0x2d1e('0x36')]));_0x471811['attributes']=_0x471811[_0x2d1e('0x34')][_0x2d1e('0x37')]?_0x471811[_0x2d1e('0x34')]:_0x195adf[_0x2d1e('0x31')];if(!_0xeae917['query'][_0x2d1e('0x38')](_0x2d1e('0x39'))){_0x471811[_0x2d1e('0x21')]=qs[_0x2d1e('0x21')](_0xeae917[_0x2d1e('0x33')][_0x2d1e('0x21')]);_0x471811[_0x2d1e('0x1f')]=qs[_0x2d1e('0x1f')](_0xeae917['query'][_0x2d1e('0x1f')]);}_0x471811[_0x2d1e('0x3a')]=qs['sort'](_0xeae917[_0x2d1e('0x33')][_0x2d1e('0x3b')]);_0x471811[_0x2d1e('0x3c')]=qs[_0x2d1e('0x3d')](_[_0x2d1e('0x3e')](_0xeae917[_0x2d1e('0x33')],_0x195adf[_0x2d1e('0x3d')]),_0x4996ff);if(_0xeae917[_0x2d1e('0x33')]['filter']){_0x471811[_0x2d1e('0x3c')]=_[_0x2d1e('0x3f')](_0x471811[_0x2d1e('0x3c')],{'$or':_['map'](_0x4996ff,function(_0x145b15){if(_0x145b15['type']!=='VIRTUAL'){var _0x1de440={};_0x1de440[_0x145b15[_0x2d1e('0x29')]]={'$like':'%'+_0xeae917[_0x2d1e('0x33')][_0x2d1e('0x40')]+'%'};return _0x1de440;}})});}_0x471811=_['merge']({},_0x471811,_0xeae917[_0x2d1e('0x41')]);var _0x48d46d={'where':_0x471811['where']};return db[_0x2d1e('0x42')]['count'](_0x48d46d)[_0x2d1e('0x27')](function(_0x9e5691){_0x5bcfcd[_0x2d1e('0x22')]=_0x9e5691;if(_0xeae917[_0x2d1e('0x33')][_0x2d1e('0x43')]){_0x471811['include']=[{'all':!![]}];}return db[_0x2d1e('0x42')][_0x2d1e('0x44')](_0x471811);})['then'](function(_0x3f21be){_0x5bcfcd[_0x2d1e('0x45')]=_0x3f21be;return _0x5bcfcd;})[_0x2d1e('0x27')](respondWithFilteredResult(_0x5e44d9,_0x471811))[_0x2d1e('0x46')](handleError(_0x5e44d9,null));};exports[_0x2d1e('0x47')]=function(_0x21cae4,_0x400138){var _0x48cf99={'raw':!![],'where':{'id':_0x21cae4[_0x2d1e('0x48')]['id']}},_0x231204={};_0x231204[_0x2d1e('0x31')]=_[_0x2d1e('0x32')](db[_0x2d1e('0x42')]['rawAttributes']);_0x231204[_0x2d1e('0x33')]=_[_0x2d1e('0x32')](_0x21cae4['query']);_0x231204[_0x2d1e('0x3d')]=_[_0x2d1e('0x35')](_0x231204[_0x2d1e('0x31')],_0x231204[_0x2d1e('0x33')]);_0x48cf99[_0x2d1e('0x34')]=_[_0x2d1e('0x35')](_0x231204[_0x2d1e('0x31')],qs['fields'](_0x21cae4['query'][_0x2d1e('0x36')]));_0x48cf99[_0x2d1e('0x34')]=_0x48cf99['attributes'][_0x2d1e('0x37')]?_0x48cf99[_0x2d1e('0x34')]:_0x231204[_0x2d1e('0x31')];if(_0x21cae4['query']['includeAll']){_0x48cf99[_0x2d1e('0x49')]=[{'all':!![]}];}_0x48cf99=_[_0x2d1e('0x3f')]({},_0x48cf99,_0x21cae4[_0x2d1e('0x41')]);return db['VoiceMailMessage'][_0x2d1e('0x4a')](_0x48cf99)[_0x2d1e('0x27')](handleEntityNotFound(_0x400138,null))[_0x2d1e('0x27')](respondWithResult(_0x400138,null))[_0x2d1e('0x46')](handleError(_0x400138,null));};exports[_0x2d1e('0x4b')]=function(_0x37aa3b,_0x322501){return db[_0x2d1e('0x42')][_0x2d1e('0x4b')](_0x37aa3b[_0x2d1e('0x4c')],{})[_0x2d1e('0x27')](respondWithResult(_0x322501,0xc9))[_0x2d1e('0x46')](handleError(_0x322501,null));};exports[_0x2d1e('0x26')]=function(_0x418ba6,_0x53606e){if(_0x418ba6[_0x2d1e('0x4c')]['id']){delete _0x418ba6[_0x2d1e('0x4c')]['id'];}return db[_0x2d1e('0x42')]['find']({'where':{'id':_0x418ba6[_0x2d1e('0x48')]['id']}})['then'](handleEntityNotFound(_0x53606e,null))[_0x2d1e('0x27')](saveUpdates(_0x418ba6[_0x2d1e('0x4c')],null))[_0x2d1e('0x27')](respondWithResult(_0x53606e,null))['catch'](handleError(_0x53606e,null));};exports[_0x2d1e('0x28')]=function(_0x17b966,_0x267ef3){return db[_0x2d1e('0x42')][_0x2d1e('0x4a')]({'where':{'id':_0x17b966[_0x2d1e('0x48')]['id']}})[_0x2d1e('0x27')](handleEntityNotFound(_0x267ef3,null))[_0x2d1e('0x27')](removeEntity(_0x267ef3,null))[_0x2d1e('0x46')](handleError(_0x267ef3,null));};exports[_0x2d1e('0x4d')]=function(_0x360308,_0x3d955a,_0x3d0239){return db[_0x2d1e('0x42')][_0x2d1e('0x4a')]({'where':{'id':_0x360308['params']['id']},'attributes':['id','recording','msg_id']})[_0x2d1e('0x27')](handleEntityNotFound(_0x3d955a,null))[_0x2d1e('0x27')](function(_0x12a359){if(_0x12a359){if(!_0x12a359[_0x2d1e('0x4e')]){throw new db[(_0x2d1e('0x4f'))][(_0x2d1e('0x50'))](_0x2d1e('0x51'));}var _0x249db5={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x12a359[_0x2d1e('0x52')]){_0x249db5['Content-Disposition']=_0x2d1e('0x53')+_0x12a359[_0x2d1e('0x52')]+_0x2d1e('0x54');}_0x3d955a['set'](_0x249db5);return _0x3d955a[_0x2d1e('0x2a')](new Buffer(_0x12a359[_0x2d1e('0x4e')]));}})[_0x2d1e('0x46')](handleError(_0x3d955a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c4fba9a..b782f31 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 _0x1b68=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment'];(function(_0x21a5f1,_0x144ce4){var _0x2d493a=function(_0xacb6d1){while(--_0xacb6d1){_0x21a5f1['push'](_0x21a5f1['shift']());}};_0x2d493a(++_0x144ce4);}(_0x1b68,0x1e8));var _0x81b6=function(_0x478a46,_0x2e8321){_0x478a46=_0x478a46-0x0;var _0x9da1ee=_0x1b68[_0x478a46];return _0x9da1ee;};'use strict';var _=require(_0x81b6('0x0'));var util=require(_0x81b6('0x1'));var logger=require('../../config/logger')(_0x81b6('0x2'));var moment=require(_0x81b6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x81b6('0x4'));var rimraf=require(_0x81b6('0x5'));var config=require(_0x81b6('0x6'));var attributes=require(_0x81b6('0x7'));module['exports']=function(_0x9fbb8c,_0x133147){return _0x9fbb8c[_0x81b6('0x8')](_0x81b6('0x9'),attributes,{'tableName':_0x81b6('0xa'),'paranoid':![],'indexes':[{'name':_0x81b6('0xb'),'fields':[_0x81b6('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x14e9=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x14e9,0x153));var _0x914e=function(_0x5c2e81,_0x3419d0){_0x5c2e81=_0x5c2e81-0x0;var _0x12f4cd=_0x14e9[_0x5c2e81];return _0x12f4cd;};'use strict';var _=require(_0x914e('0x0'));var util=require(_0x914e('0x1'));var logger=require(_0x914e('0x2'))(_0x914e('0x3'));var moment=require(_0x914e('0x4'));var BPromise=require(_0x914e('0x5'));var rp=require(_0x914e('0x6'));var fs=require('fs');var path=require(_0x914e('0x7'));var rimraf=require(_0x914e('0x8'));var config=require('../../config/environment');var attributes=require(_0x914e('0x9'));module[_0x914e('0xa')]=function(_0x18766b,_0xe816e0){return _0x18766b['define'](_0x914e('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x914e('0xc'),'fields':[_0x914e('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c6df0a5..29f4763 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 _0x296f=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x3f8dfa,_0x4ca511){var _0x4fd797=function(_0x57eb4d){while(--_0x57eb4d){_0x3f8dfa['push'](_0x3f8dfa['shift']());}};_0x4fd797(++_0x4ca511);}(_0x296f,0x1ac));var _0xf296=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x296f[_0x2fc113];return _0x5144ce;};'use strict';var _=require(_0xf296('0x0'));var util=require('util');var moment=require(_0xf296('0x1'));var BPromise=require(_0xf296('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf296('0x3'))['db'];var utils=require(_0xf296('0x4'));var logger=require(_0xf296('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf296('0x6'));var client=jayson[_0xf296('0x7')][_0xf296('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2731f7,_0x168198,_0x4f45ee){return new BPromise(function(_0x3f5e6c,_0x43ec6f){return client[_0xf296('0x9')](_0x2731f7,_0x4f45ee)[_0xf296('0xa')](function(_0x3bad18){logger[_0xf296('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x168198,'request\x20sent');logger[_0xf296('0xc')](_0xf296('0xd'),_0x168198,_0xf296('0xe'),JSON[_0xf296('0xf')](_0x3bad18));if(_0x3bad18['error']){if(_0x3bad18[_0xf296('0x10')][_0xf296('0x11')]===0x1f4){logger[_0xf296('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x168198,_0x3bad18['error'][_0xf296('0x12')]);return _0x43ec6f(_0x3bad18[_0xf296('0x10')]['message']);}logger[_0xf296('0x10')](_0xf296('0x13'),_0x168198,_0x3bad18['error'][_0xf296('0x12')]);return _0x3f5e6c(_0x3bad18[_0xf296('0x10')][_0xf296('0x12')]);}else{logger[_0xf296('0xb')](_0xf296('0x13'),_0x168198,_0xf296('0xe'));_0x3f5e6c(_0x3bad18[_0xf296('0x14')]['message']);}})[_0xf296('0x15')](function(_0x230eb7){logger[_0xf296('0x10')](_0xf296('0x13'),_0x168198,_0x230eb7);_0x43ec6f(_0x230eb7);});});} \ No newline at end of file +var _0xcd53=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4965d1,_0xb546d4){var _0x59e849=function(_0x2df6e9){while(--_0x2df6e9){_0x4965d1['push'](_0x4965d1['shift']());}};_0x59e849(++_0xb546d4);}(_0xcd53,0x11a));var _0x3cd5=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xcd53[_0x30faec];return _0x29484f;};'use strict';var _=require(_0x3cd5('0x0'));var util=require(_0x3cd5('0x1'));var moment=require(_0x3cd5('0x2'));var BPromise=require(_0x3cd5('0x3'));var rs=require(_0x3cd5('0x4'));var fs=require('fs');var Redis=require(_0x3cd5('0x5'));var db=require(_0x3cd5('0x6'))['db'];var utils=require(_0x3cd5('0x7'));var logger=require('../../config/logger')(_0x3cd5('0x8'));var config=require(_0x3cd5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3cd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf6ab8c,_0x5ca1bb,_0x49b446){return new BPromise(function(_0x44fc06,_0x5b9960){return client[_0x3cd5('0xb')](_0xf6ab8c,_0x49b446)[_0x3cd5('0xc')](function(_0xa4422f){logger[_0x3cd5('0xd')](_0x3cd5('0xe'),_0x5ca1bb,_0x3cd5('0xf'));logger[_0x3cd5('0x10')](_0x3cd5('0x11'),_0x5ca1bb,_0x3cd5('0xf'),JSON['stringify'](_0xa4422f));if(_0xa4422f['error']){if(_0xa4422f[_0x3cd5('0x12')]['code']===0x1f4){logger[_0x3cd5('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x5ca1bb,_0xa4422f['error'][_0x3cd5('0x13')]);return _0x5b9960(_0xa4422f[_0x3cd5('0x12')]['message']);}logger[_0x3cd5('0x12')](_0x3cd5('0xe'),_0x5ca1bb,_0xa4422f[_0x3cd5('0x12')][_0x3cd5('0x13')]);return _0x44fc06(_0xa4422f['error'][_0x3cd5('0x13')]);}else{logger[_0x3cd5('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x5ca1bb,_0x3cd5('0xf'));_0x44fc06(_0xa4422f[_0x3cd5('0x14')][_0x3cd5('0x13')]);}})[_0x3cd5('0x15')](function(_0x18fb2a){logger[_0x3cd5('0x12')](_0x3cd5('0xe'),_0x5ca1bb,_0x18fb2a);_0x5b9960(_0x18fb2a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f5c0869..5c143d6 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 _0xb383=['/:id/sounds','getSounds','post','addSound','put','delete','destroy','removeSound','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4f833c,_0x1e409c){var _0x390f1e=function(_0x3152d8){while(--_0x3152d8){_0x4f833c['push'](_0x4f833c['shift']());}};_0x390f1e(++_0x1e409c);}(_0xb383,0x1be));var _0x3b38=function(_0x4f80a4,_0x12d0a3){_0x4f80a4=_0x4f80a4-0x0;var _0x4955de=_0xb383[_0x4f80a4];return _0x4955de;};'use strict';var multer=require('multer');var util=require(_0x3b38('0x0'));var path=require(_0x3b38('0x1'));var timeout=require(_0x3b38('0x2'));var express=require(_0x3b38('0x3'));var router=express[_0x3b38('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b38('0x5'));var interaction=require(_0x3b38('0x6'));var config=require(_0x3b38('0x7'));var controller=require(_0x3b38('0x8'));router[_0x3b38('0x9')]('/',auth[_0x3b38('0xa')](),controller[_0x3b38('0xb')]);router[_0x3b38('0x9')](_0x3b38('0xc'),auth[_0x3b38('0xa')](),controller[_0x3b38('0xd')]);router[_0x3b38('0x9')](_0x3b38('0xe'),auth[_0x3b38('0xa')](),controller[_0x3b38('0xf')]);router[_0x3b38('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b38('0x10')](_0x3b38('0xe'),auth[_0x3b38('0xa')](),controller[_0x3b38('0x11')]);router[_0x3b38('0x12')](_0x3b38('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3b38('0x13')](_0x3b38('0xc'),auth['isAuthenticated'](),controller[_0x3b38('0x14')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x3b38('0x15')]);module[_0x3b38('0x16')]=router; \ No newline at end of file +var _0x526e=['/:id','isAuthenticated','show','/:id/sounds','getSounds','post','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','get'];(function(_0x48026e,_0x2bb295){var _0x4b42aa=function(_0x42c647){while(--_0x42c647){_0x48026e['push'](_0x48026e['shift']());}};_0x4b42aa(++_0x2bb295);}(_0x526e,0x1bd));var _0xe526=function(_0x35cad4,_0x5a8613){_0x35cad4=_0x35cad4-0x0;var _0x1e0e54=_0x526e[_0x35cad4];return _0x1e0e54;};'use strict';var multer=require(_0xe526('0x0'));var util=require(_0xe526('0x1'));var path=require('path');var timeout=require(_0xe526('0x2'));var express=require(_0xe526('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe526('0x4')](_0xe526('0x5'),auth[_0xe526('0x6')](),controller[_0xe526('0x7')]);router[_0xe526('0x4')](_0xe526('0x8'),auth[_0xe526('0x6')](),controller[_0xe526('0x9')]);router[_0xe526('0xa')]('/',auth[_0xe526('0x6')](),controller['create']);router[_0xe526('0xa')](_0xe526('0x8'),auth[_0xe526('0x6')](),controller['addSound']);router[_0xe526('0xb')](_0xe526('0x5'),auth[_0xe526('0x6')](),controller[_0xe526('0xc')]);router[_0xe526('0xd')](_0xe526('0x5'),auth[_0xe526('0x6')](),controller[_0xe526('0xe')]);router[_0xe526('0xd')](_0xe526('0xf'),auth[_0xe526('0x6')](),controller[_0xe526('0x10')]);module[_0xe526('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c2b753a..634e0cb 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 _0x36d3=['ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x36d3,0xec));var _0x336d=function(_0x54499d,_0x52e84){_0x54499d=_0x54499d-0x0;var _0x5ced2d=_0x36d3[_0x54499d];return _0x5ced2d;};'use strict';var Sequelize=require(_0x336d('0x0'));module[_0x336d('0x1')]={'name':{'type':Sequelize[_0x336d('0x2')],'allowNull':![],'unique':_0x336d('0x3')},'mode':{'type':Sequelize[_0x336d('0x4')](_0x336d('0x5'),_0x336d('0x6'),'mp3nb',_0x336d('0x7'),_0x336d('0x8'),_0x336d('0x9')),'allowNull':!![],'defaultValue':_0x336d('0x6')},'directory':{'type':Sequelize[_0x336d('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x336d('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x336d('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x336d('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x415e=['ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING'];(function(_0x10488a,_0x2ed5b7){var _0x2908fd=function(_0x4d1a66){while(--_0x4d1a66){_0x10488a['push'](_0x10488a['shift']());}};_0x2908fd(++_0x2ed5b7);}(_0x415e,0xa2));var _0xe415=function(_0x55ec9e,_0x57a936){_0x55ec9e=_0x55ec9e-0x0;var _0x581fbb=_0x415e[_0x55ec9e];return _0x581fbb;};'use strict';var Sequelize=require(_0xe415('0x0'));module[_0xe415('0x1')]={'name':{'type':Sequelize[_0xe415('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xe415('0x3')](_0xe415('0x4'),_0xe415('0x5'),_0xe415('0x6'),'quietmp3nb',_0xe415('0x7'),_0xe415('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xe415('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe415('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe415('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xe415('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 8be1044..9460108 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 _0x1d77=['unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','server/files/sounds/converted','format','basename','extname','converted_format','%s.%s','message','removeSound','id2','Sound','getSounds','rawAttributes','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','stack','name','index','map','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync'];(function(_0x3ea853,_0x193450){var _0x1b5583=function(_0x7ea3f1){while(--_0x7ea3f1){_0x3ea853['push'](_0x3ea853['shift']());}};_0x1b5583(++_0x193450);}(_0x1d77,0x86));var _0x71d7=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x1d77[_0x128bef];return _0x1ba862;};'use strict';var emlformat=require(_0x71d7('0x0'));var rimraf=require(_0x71d7('0x1'));var zipdir=require(_0x71d7('0x2'));var jsonpatch=require(_0x71d7('0x3'));var rp=require(_0x71d7('0x4'));var moment=require(_0x71d7('0x5'));var BPromise=require(_0x71d7('0x6'));var Mustache=require(_0x71d7('0x7'));var util=require(_0x71d7('0x8'));var path=require(_0x71d7('0x9'));var sox=require(_0x71d7('0xa'));var csv=require(_0x71d7('0xb'));var ejs=require(_0x71d7('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x71d7('0xd'));var crypto=require('crypto');var jsforce=require(_0x71d7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71d7('0xf'));var Redis=require(_0x71d7('0x10'));var authService=require(_0x71d7('0x11'));var qs=require(_0x71d7('0x12'));var as=require(_0x71d7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71d7('0x14'))('api');var utils=require(_0x71d7('0x15'));var config=require(_0x71d7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x71d7('0x17'))['db'];function respondWithStatusCode(_0x592bc0,_0x354da5){_0x354da5=_0x354da5||0xcc;return function(_0x3b4ddb){if(_0x3b4ddb){return _0x592bc0[_0x71d7('0x18')](_0x354da5);}return _0x592bc0[_0x71d7('0x19')](_0x354da5)['end']();};}function respondWithResult(_0x1dc5b4,_0x25156c){_0x25156c=_0x25156c||0xc8;return function(_0x1109f3){if(_0x1109f3){return _0x1dc5b4[_0x71d7('0x19')](_0x25156c)[_0x71d7('0x1a')](_0x1109f3);}};}function respondWithFilteredResult(_0x4ce50a,_0x408f45){return function(_0x32b115){if(_0x32b115){var _0x3d4067=typeof _0x408f45[_0x71d7('0x1b')]===_0x71d7('0x1c')&&typeof _0x408f45[_0x71d7('0x1d')]===_0x71d7('0x1c');var _0x443ee7=_0x32b115[_0x71d7('0x1e')];var _0x3343b1=_0x3d4067?0x0:_0x408f45[_0x71d7('0x1b')];var _0x57ec1f=_0x3d4067?_0x32b115['count']:_0x408f45[_0x71d7('0x1b')]+_0x408f45[_0x71d7('0x1d')];var _0x5b3522;if(_0x57ec1f>=_0x443ee7){_0x57ec1f=_0x443ee7;_0x5b3522=0xc8;}else{_0x5b3522=0xce;}_0x4ce50a['status'](_0x5b3522);return _0x4ce50a[_0x71d7('0x1f')](_0x71d7('0x20'),_0x3343b1+'-'+_0x57ec1f+'/'+_0x443ee7)[_0x71d7('0x1a')](_0x32b115);}return null;};}function patchUpdates(_0x3da10b){return function(_0x9fa873){try{jsonpatch[_0x71d7('0x21')](_0x9fa873,_0x3da10b,!![]);}catch(_0x506e16){return BPromise[_0x71d7('0x22')](_0x506e16);}return _0x9fa873['save']();};}function saveUpdates(_0x23282b,_0x143616){return function(_0x220042){if(_0x220042){return _0x220042[_0x71d7('0x23')](_0x23282b)[_0x71d7('0x24')](function(_0x41448c){return _0x41448c;});}return null;};}function removeEntity(_0x5c2734,_0x1eae49){return function(_0x134f66){if(_0x134f66){return _0x134f66[_0x71d7('0x25')]()['then'](function(){var _0x2cbef0=_0x134f66[_0x71d7('0x26')]({'plain':!![]});var _0x49c361=_0x71d7('0x27');return db[_0x71d7('0x28')][_0x71d7('0x25')]({'where':{'type':_0x49c361,'resourceId':_0x2cbef0['id']}})[_0x71d7('0x24')](function(){return _0x134f66;});})[_0x71d7('0x24')](function(){_0x5c2734[_0x71d7('0x19')](0xcc)[_0x71d7('0x29')]();});}};}function handleEntityNotFound(_0x2f669e,_0x5f2487){return function(_0x3ec149){if(!_0x3ec149){_0x2f669e[_0x71d7('0x18')](0x194);}return _0x3ec149;};}function handleError(_0x2e914d,_0x3adeeb){_0x3adeeb=_0x3adeeb||0x1f4;return function(_0x474a0d){logger['error'](_0x474a0d[_0x71d7('0x2a')]);if(_0x474a0d['name']){delete _0x474a0d[_0x71d7('0x2b')];}_0x2e914d[_0x71d7('0x19')](_0x3adeeb)['send'](_0x474a0d);};}exports[_0x71d7('0x2c')]=function(_0x197fb0,_0x5cdbe8){var _0x257f74={},_0x5eff2e={},_0x15fabc={'count':0x0,'rows':[]};var _0x4b6bd5=_[_0x71d7('0x2d')](db[_0x71d7('0x2e')]['rawAttributes'],function(_0x533d0d){return{'name':_0x533d0d['fieldName'],'type':_0x533d0d[_0x71d7('0x2f')][_0x71d7('0x30')]};});_0x5eff2e[_0x71d7('0x31')]=_[_0x71d7('0x2d')](_0x4b6bd5,'name');_0x5eff2e[_0x71d7('0x32')]=_[_0x71d7('0x33')](_0x197fb0[_0x71d7('0x32')]);_0x5eff2e[_0x71d7('0x34')]=_[_0x71d7('0x35')](_0x5eff2e[_0x71d7('0x31')],_0x5eff2e[_0x71d7('0x32')]);_0x257f74['attributes']=_[_0x71d7('0x35')](_0x5eff2e[_0x71d7('0x31')],qs[_0x71d7('0x36')](_0x197fb0[_0x71d7('0x32')][_0x71d7('0x36')]));_0x257f74[_0x71d7('0x37')]=_0x257f74['attributes']['length']?_0x257f74[_0x71d7('0x37')]:_0x5eff2e[_0x71d7('0x31')];if(!_0x197fb0['query'][_0x71d7('0x38')](_0x71d7('0x39'))){_0x257f74[_0x71d7('0x1d')]=qs[_0x71d7('0x1d')](_0x197fb0[_0x71d7('0x32')]['limit']);_0x257f74[_0x71d7('0x1b')]=qs['offset'](_0x197fb0[_0x71d7('0x32')][_0x71d7('0x1b')]);}_0x257f74['order']=qs['sort'](_0x197fb0[_0x71d7('0x32')][_0x71d7('0x3a')]);delete _0x197fb0[_0x71d7('0x32')]['sort'];_0x257f74[_0x71d7('0x3b')]=qs[_0x71d7('0x34')](_['pick'](_0x197fb0[_0x71d7('0x32')],_0x5eff2e['filters']),_0x4b6bd5);if(_0x197fb0['query'][_0x71d7('0x3c')]){_0x257f74[_0x71d7('0x3b')]=_[_0x71d7('0x3d')](_0x257f74[_0x71d7('0x3b')],{'$or':_[_0x71d7('0x2d')](_0x4b6bd5,function(_0xef11e6){if(_0xef11e6['type']!==_0x71d7('0x3e')){var _0xe0a173={};_0xe0a173[_0xef11e6[_0x71d7('0x2b')]]={'$like':'%'+_0x197fb0['query'][_0x71d7('0x3c')]+'%'};return _0xe0a173;}})});}_0x257f74=_[_0x71d7('0x3d')]({},_0x257f74,_0x197fb0[_0x71d7('0x3f')]);var _0x49a65c={'where':_0x257f74['where']};return db[_0x71d7('0x2e')]['count'](_0x49a65c)['then'](function(_0x43af6e){_0x15fabc[_0x71d7('0x1e')]=_0x43af6e;if(_0x197fb0['query'][_0x71d7('0x40')]){_0x257f74['include']=[{'all':!![]}];}return db[_0x71d7('0x2e')][_0x71d7('0x41')](_0x257f74);})['then'](function(_0x47ca33){_0x15fabc[_0x71d7('0x42')]=_0x47ca33;return _0x15fabc;})[_0x71d7('0x24')](respondWithFilteredResult(_0x5cdbe8,_0x257f74))[_0x71d7('0x43')](handleError(_0x5cdbe8,null));};exports['show']=function(_0x160578,_0x1e1a25){var _0x41372c={'raw':![],'where':{'id':_0x160578[_0x71d7('0x44')]['id']}},_0xac8e4f={};_0xac8e4f[_0x71d7('0x31')]=_[_0x71d7('0x33')](db['VoiceMusicOnHold']['rawAttributes']);_0xac8e4f['query']=_[_0x71d7('0x33')](_0x160578[_0x71d7('0x32')]);_0xac8e4f['filters']=_['intersection'](_0xac8e4f[_0x71d7('0x31')],_0xac8e4f[_0x71d7('0x32')]);_0x41372c[_0x71d7('0x37')]=_['intersection'](_0xac8e4f['model'],qs[_0x71d7('0x36')](_0x160578[_0x71d7('0x32')]['fields']));_0x41372c['attributes']=_0x41372c['attributes'][_0x71d7('0x45')]?_0x41372c[_0x71d7('0x37')]:_0xac8e4f[_0x71d7('0x31')];if(_0x160578['query'][_0x71d7('0x40')]){_0x41372c[_0x71d7('0x46')]=[{'all':!![]}];}_0x41372c=_['merge']({},_0x41372c,_0x160578[_0x71d7('0x3f')]);return db[_0x71d7('0x2e')]['find'](_0x41372c)[_0x71d7('0x24')](handleEntityNotFound(_0x1e1a25,null))['then'](respondWithResult(_0x1e1a25,null))[_0x71d7('0x43')](handleError(_0x1e1a25,null));};exports[_0x71d7('0x23')]=function(_0x14e091,_0x287bb6){if(_0x14e091[_0x71d7('0x47')]['id']){delete _0x14e091[_0x71d7('0x47')]['id'];}return db[_0x71d7('0x2e')]['find']({'where':{'id':_0x14e091[_0x71d7('0x44')]['id']}})[_0x71d7('0x24')](handleEntityNotFound(_0x287bb6,null))[_0x71d7('0x24')](saveUpdates(_0x14e091[_0x71d7('0x47')],null))['then'](respondWithResult(_0x287bb6,null))[_0x71d7('0x43')](handleError(_0x287bb6,null));};exports[_0x71d7('0x48')]=function(_0x3da88d,_0x4af688,_0x3bf24a){return db[_0x71d7('0x49')][_0x71d7('0x4a')](function(_0x426c65){if(_0x3da88d[_0x71d7('0x47')][_0x71d7('0x4b')]===_0x71d7('0x4c')){_0x3da88d[_0x71d7('0x47')]['directory']=path[_0x71d7('0x4d')](config[_0x71d7('0x4e')],_0x71d7('0x4f'),_0x3da88d['body'][_0x71d7('0x2b')]);}return db[_0x71d7('0x2e')]['create'](_0x3da88d[_0x71d7('0x47')],{'transaction':_0x426c65})['then'](function(_0x490300){if(_0x3da88d[_0x71d7('0x47')][_0x71d7('0x4b')]===_0x71d7('0x4c')){fs[_0x71d7('0x50')](_0x490300[_0x71d7('0x51')],parseInt(_0x71d7('0x52'),0x8));}var _0x2937c3=_0x3da88d[_0x71d7('0x53')][_0x71d7('0x26')]({'plain':!![]});if(!_0x2937c3)throw new Error(_0x71d7('0x54'));if(_0x2937c3[_0x71d7('0x55')]===_0x71d7('0x53')){var _0x4f2608=_0x490300[_0x71d7('0x26')]({'plain':!![]});return db[_0x71d7('0x56')][_0x71d7('0x57')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2937c3['userProfileId']},'raw':!![]})[_0x71d7('0x24')](function(_0x3f1f63){if(_0x3f1f63&&_0x3f1f63[_0x71d7('0x58')]===0x0){return db[_0x71d7('0x28')][_0x71d7('0x48')]({'name':_0x4f2608[_0x71d7('0x2b')],'resourceId':_0x4f2608['id'],'type':_0x3f1f63[_0x71d7('0x2b')],'sectionId':_0x3f1f63['id']},{})['then'](function(){return _0x490300;});}else{return _0x490300;}})[_0x71d7('0x43')](function(_0x4000b7){logger[_0x71d7('0x59')](_0x71d7('0x5a'),_0x4000b7);});}return _0x490300;});})['then'](respondWithResult(_0x4af688,0xc9))['catch'](handleError(_0x4af688,null));};exports[_0x71d7('0x25')]=function(_0x565699,_0xd9989c,_0x3aa85a){var _0x1c0b6e;return db[_0x71d7('0x2e')][_0x71d7('0x57')]({'where':{'id':_0x565699[_0x71d7('0x44')]['id']}})['then'](function(_0x30f955){if(_0x30f955){return db[_0x71d7('0x49')]['transaction'](function(_0x197e76){return _0x30f955[_0x71d7('0x25')]({'transaction':_0x197e76,'raw':!![]})[_0x71d7('0x24')](function(_0x10024e){if(_0x10024e['directory']){fs[_0x71d7('0x5b')](_0x10024e[_0x71d7('0x51')])['forEach'](function(_0x51674b){fs[_0x71d7('0x5c')](path[_0x71d7('0x4d')](_0x10024e[_0x71d7('0x51')],_0x51674b));});fs[_0x71d7('0x5d')](_0x10024e[_0x71d7('0x51')]);}return _0x10024e;});})[_0x71d7('0x43')](function(_0x23f8a8){throw new db[(_0x71d7('0x5e'))][(_0x71d7('0x5f'))](_0x23f8a8['message']);});}})[_0x71d7('0x24')](handleEntityNotFound(_0xd9989c,null))['then'](removeEntity(_0xd9989c,null))[_0x71d7('0x43')](handleError(_0xd9989c,null));};exports[_0x71d7('0x60')]=function(_0x1d5596,_0x54f09b,_0x1967c7){return db[_0x71d7('0x49')][_0x71d7('0x4a')](function(_0x41c40b){var _0x28fc35;return db['VoiceMusicOnHold'][_0x71d7('0x57')]({'where':{'id':_0x1d5596[_0x71d7('0x44')]['id']}})[_0x71d7('0x24')](function(_0x2ec736){if(_0x2ec736){_0x28fc35=_0x2ec736;return _0x2ec736[_0x71d7('0x60')](_0x1d5596['body']['id'],{'transaction':_0x41c40b});}})[_0x71d7('0x24')](function(_0x4d5373){if(_0x4d5373){return db['Sound'][_0x71d7('0x61')]({'where':{'id':_0x1d5596[_0x71d7('0x47')]['id']},'attributes':['id','name',_0x71d7('0x62'),'converted_format','createdAt'],'raw':!![]});}})[_0x71d7('0x24')](function(_0x7f2456){if(_0x7f2456){var _0x315922=path[_0x71d7('0x4d')](config[_0x71d7('0x4e')],_0x71d7('0x63'),util[_0x71d7('0x64')]('%s.%s',path[_0x71d7('0x65')](_0x7f2456[_0x71d7('0x62')],path[_0x71d7('0x66')](_0x7f2456['save_name'])),_0x7f2456[_0x71d7('0x67')]));var _0x61daec=path[_0x71d7('0x4d')](config[_0x71d7('0x4e')],_0x71d7('0x4f'),_0x28fc35[_0x71d7('0x2b')],util[_0x71d7('0x64')](_0x71d7('0x68'),_0x7f2456[_0x71d7('0x2b')],_0x7f2456[_0x71d7('0x67')]));fs['symlinkSync'](_0x315922,_0x61daec);return _0x7f2456;}})[_0x71d7('0x43')](function(_0x45b7d7){throw new db[(_0x71d7('0x5e'))][(_0x71d7('0x5f'))](_0x45b7d7[_0x71d7('0x69')]);});})[_0x71d7('0x24')](handleEntityNotFound(_0x54f09b,null))[_0x71d7('0x24')](respondWithResult(_0x54f09b,0xc9))[_0x71d7('0x43')](handleError(_0x54f09b,null));};exports['removeSound']=function(_0x14eea1,_0x1ea91c,_0x4ef9af){return db['sequelize'][_0x71d7('0x4a')](function(_0x349946){var _0x95578f;return db['VoiceMusicOnHold'][_0x71d7('0x61')]({'where':{'id':_0x14eea1[_0x71d7('0x44')]['id']}})[_0x71d7('0x24')](handleEntityNotFound(_0x1ea91c,null))[_0x71d7('0x24')](function(_0x246102){if(_0x246102){_0x95578f=_0x246102;return _0x246102[_0x71d7('0x6a')](_0x14eea1[_0x71d7('0x44')][_0x71d7('0x6b')]);}})[_0x71d7('0x24')](function(_0x4a27d3){if(_0x4a27d3){return db[_0x71d7('0x6c')][_0x71d7('0x61')]({'where':{'id':_0x14eea1[_0x71d7('0x44')][_0x71d7('0x6b')]},'attributes':['id','name',_0x71d7('0x62'),_0x71d7('0x67'),'createdAt'],'raw':!![]});}})['then'](function(_0x14cefa){if(_0x14cefa){fs[_0x71d7('0x5c')](path[_0x71d7('0x4d')](_0x95578f[_0x71d7('0x51')],util[_0x71d7('0x64')]('%s.%s',_0x14cefa[_0x71d7('0x2b')],_0x14cefa[_0x71d7('0x67')])));return _0x14cefa;}})[_0x71d7('0x43')](function(_0x3ca394){throw new db[(_0x71d7('0x5e'))][(_0x71d7('0x5f'))](_0x3ca394[_0x71d7('0x69')]);});})[_0x71d7('0x24')](handleEntityNotFound(_0x1ea91c,null))[_0x71d7('0x24')](respondWithStatusCode(_0x1ea91c,0xcc))[_0x71d7('0x43')](handleError(_0x1ea91c,null));};exports[_0x71d7('0x6d')]=function(_0x1d14f8,_0x5d6422,_0x164a3f){var _0x108c3e={};var _0x3f0497={};var _0x5eea53;var _0x185d87;return db[_0x71d7('0x2e')]['findOne']({'where':{'id':_0x1d14f8[_0x71d7('0x44')]['id']}})[_0x71d7('0x24')](handleEntityNotFound(_0x5d6422,null))[_0x71d7('0x24')](function(_0x1aeacd){if(_0x1aeacd){_0x5eea53=_0x1aeacd;_0x3f0497[_0x71d7('0x31')]=_[_0x71d7('0x33')](db['Sound'][_0x71d7('0x6e')]);_0x3f0497['query']=_[_0x71d7('0x33')](_0x1d14f8[_0x71d7('0x32')]);_0x3f0497['filters']=_['intersection'](_0x3f0497[_0x71d7('0x31')],_0x3f0497['query']);_0x108c3e[_0x71d7('0x37')]=_['intersection'](_0x3f0497[_0x71d7('0x31')],qs[_0x71d7('0x36')](_0x1d14f8[_0x71d7('0x32')][_0x71d7('0x36')]));_0x108c3e[_0x71d7('0x37')]=_0x108c3e[_0x71d7('0x37')][_0x71d7('0x45')]?_0x108c3e[_0x71d7('0x37')]:_0x3f0497[_0x71d7('0x31')];_0x108c3e[_0x71d7('0x6f')]=qs[_0x71d7('0x3a')](_0x1d14f8[_0x71d7('0x32')][_0x71d7('0x3a')]);_0x108c3e[_0x71d7('0x3b')]=qs[_0x71d7('0x34')](_[_0x71d7('0x70')](_0x1d14f8['query'],_0x3f0497[_0x71d7('0x34')]));if(_0x1d14f8[_0x71d7('0x32')][_0x71d7('0x3c')]){_0x108c3e[_0x71d7('0x3b')]=_[_0x71d7('0x3d')](_0x108c3e[_0x71d7('0x3b')],{'$or':_[_0x71d7('0x2d')](_0x108c3e[_0x71d7('0x37')],function(_0x32294e){var _0xcb3f2={};_0xcb3f2[_0x32294e]={'$like':'%'+_0x1d14f8[_0x71d7('0x32')]['filter']+'%'};return _0xcb3f2;})});}_0x108c3e=_['merge']({},_0x108c3e,_0x1d14f8[_0x71d7('0x3f')]);return _0x5eea53['getSounds'](_0x108c3e);}})[_0x71d7('0x24')](function(_0x5a934c){if(_0x5a934c){_0x185d87=_0x5a934c['length'];if(!_0x1d14f8[_0x71d7('0x32')][_0x71d7('0x38')](_0x71d7('0x39'))){_0x108c3e[_0x71d7('0x1d')]=qs[_0x71d7('0x1d')](_0x1d14f8['query'][_0x71d7('0x1d')]);_0x108c3e['offset']=qs['offset'](_0x1d14f8[_0x71d7('0x32')]['offset']);}return _0x5eea53['getSounds'](_0x108c3e);}})[_0x71d7('0x24')](function(_0xdd2b44){if(_0xdd2b44){return _0xdd2b44?{'count':_0x185d87,'rows':_0xdd2b44}:null;}})['then'](respondWithResult(_0x5d6422,null))[_0x71d7('0x43')](handleError(_0x5d6422,null));}; \ No newline at end of file +var _0x5490=['sort','options','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','merge','find','body','params','create','sequelize','transaction','mode','files','join','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','order'];(function(_0x2ba1c7,_0x2f8fc5){var _0x1cdd5b=function(_0x3e30bc){while(--_0x3e30bc){_0x2ba1c7['push'](_0x2ba1c7['shift']());}};_0x1cdd5b(++_0x2f8fc5);}(_0x5490,0x74));var _0x0549=function(_0x45ef78,_0x15b1cb){_0x45ef78=_0x45ef78-0x0;var _0x3dc74c=_0x5490[_0x45ef78];return _0x3dc74c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0549('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0549('0x1'));var moment=require(_0x0549('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0549('0x3'));var util=require('util');var path=require(_0x0549('0x4'));var sox=require(_0x0549('0x5'));var csv=require(_0x0549('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0549('0x7'));var squel=require('squel');var crypto=require(_0x0549('0x8'));var jsforce=require(_0x0549('0x9'));var deskjs=require(_0x0549('0xa'));var toCsv=require(_0x0549('0x6'));var querystring=require(_0x0549('0xb'));var Papa=require(_0x0549('0xc'));var Redis=require('ioredis');var authService=require(_0x0549('0xd'));var qs=require(_0x0549('0xe'));var as=require(_0x0549('0xf'));var hardwareService=require(_0x0549('0x10'));var logger=require('../../config/logger')(_0x0549('0x11'));var utils=require(_0x0549('0x12'));var config=require(_0x0549('0x13'));var licenseUtil=require(_0x0549('0x14'));var db=require(_0x0549('0x15'))['db'];function respondWithStatusCode(_0x510d0f,_0x3effd8){_0x3effd8=_0x3effd8||0xcc;return function(_0x2043f0){if(_0x2043f0){return _0x510d0f['sendStatus'](_0x3effd8);}return _0x510d0f[_0x0549('0x16')](_0x3effd8)['end']();};}function respondWithResult(_0x49cb89,_0x21d8b6){_0x21d8b6=_0x21d8b6||0xc8;return function(_0x5dff38){if(_0x5dff38){return _0x49cb89[_0x0549('0x16')](_0x21d8b6)[_0x0549('0x17')](_0x5dff38);}};}function respondWithFilteredResult(_0x23c783,_0x34382f){return function(_0x47c471){if(_0x47c471){var _0x3ed8c8=typeof _0x34382f[_0x0549('0x18')]==='undefined'&&typeof _0x34382f[_0x0549('0x19')]===_0x0549('0x1a');var _0x2a1a45=_0x47c471[_0x0549('0x1b')];var _0x33f521=_0x3ed8c8?0x0:_0x34382f[_0x0549('0x18')];var _0x1406bd=_0x3ed8c8?_0x47c471[_0x0549('0x1b')]:_0x34382f[_0x0549('0x18')]+_0x34382f[_0x0549('0x19')];var _0x5589ab;if(_0x1406bd>=_0x2a1a45){_0x1406bd=_0x2a1a45;_0x5589ab=0xc8;}else{_0x5589ab=0xce;}_0x23c783[_0x0549('0x16')](_0x5589ab);return _0x23c783['set'](_0x0549('0x1c'),_0x33f521+'-'+_0x1406bd+'/'+_0x2a1a45)[_0x0549('0x17')](_0x47c471);}return null;};}function patchUpdates(_0x4cb0c0){return function(_0x2b20a1){try{jsonpatch[_0x0549('0x1d')](_0x2b20a1,_0x4cb0c0,!![]);}catch(_0x384f2f){return BPromise[_0x0549('0x1e')](_0x384f2f);}return _0x2b20a1[_0x0549('0x1f')]();};}function saveUpdates(_0x338bb5,_0x3eeb22){return function(_0x440a56){if(_0x440a56){return _0x440a56[_0x0549('0x20')](_0x338bb5)[_0x0549('0x21')](function(_0x5d3f9a){return _0x5d3f9a;});}return null;};}function removeEntity(_0x4cc430,_0x2dcd19){return function(_0x4b2044){if(_0x4b2044){return _0x4b2044[_0x0549('0x22')]()[_0x0549('0x21')](function(){var _0x4ed02c=_0x4b2044[_0x0549('0x23')]({'plain':!![]});var _0x54ed18=_0x0549('0x24');return db[_0x0549('0x25')][_0x0549('0x22')]({'where':{'type':_0x54ed18,'resourceId':_0x4ed02c['id']}})[_0x0549('0x21')](function(){return _0x4b2044;});})[_0x0549('0x21')](function(){_0x4cc430['status'](0xcc)[_0x0549('0x26')]();});}};}function handleEntityNotFound(_0x4e4b6c,_0x3e8406){return function(_0x533761){if(!_0x533761){_0x4e4b6c[_0x0549('0x27')](0x194);}return _0x533761;};}function handleError(_0x3769df,_0x28b0fa){_0x28b0fa=_0x28b0fa||0x1f4;return function(_0x565413){logger[_0x0549('0x28')](_0x565413[_0x0549('0x29')]);if(_0x565413[_0x0549('0x2a')]){delete _0x565413[_0x0549('0x2a')];}_0x3769df['status'](_0x28b0fa)[_0x0549('0x2b')](_0x565413);};}exports['index']=function(_0x371bcd,_0x4edcf4){var _0x461710={},_0x4d263f={},_0x15a12d={'count':0x0,'rows':[]};var _0x52781a=_['map'](db[_0x0549('0x2c')][_0x0549('0x2d')],function(_0x572927){return{'name':_0x572927[_0x0549('0x2e')],'type':_0x572927['type'][_0x0549('0x2f')]};});_0x4d263f[_0x0549('0x30')]=_[_0x0549('0x31')](_0x52781a,_0x0549('0x2a'));_0x4d263f[_0x0549('0x32')]=_[_0x0549('0x33')](_0x371bcd[_0x0549('0x32')]);_0x4d263f[_0x0549('0x34')]=_[_0x0549('0x35')](_0x4d263f[_0x0549('0x30')],_0x4d263f['query']);_0x461710[_0x0549('0x36')]=_[_0x0549('0x35')](_0x4d263f['model'],qs['fields'](_0x371bcd[_0x0549('0x32')][_0x0549('0x37')]));_0x461710['attributes']=_0x461710[_0x0549('0x36')]['length']?_0x461710[_0x0549('0x36')]:_0x4d263f[_0x0549('0x30')];if(!_0x371bcd[_0x0549('0x32')][_0x0549('0x38')](_0x0549('0x39'))){_0x461710[_0x0549('0x19')]=qs[_0x0549('0x19')](_0x371bcd[_0x0549('0x32')][_0x0549('0x19')]);_0x461710[_0x0549('0x18')]=qs[_0x0549('0x18')](_0x371bcd['query'][_0x0549('0x18')]);}_0x461710['order']=qs['sort'](_0x371bcd[_0x0549('0x32')]['sort']);delete _0x371bcd['query']['sort'];_0x461710[_0x0549('0x3a')]=qs[_0x0549('0x34')](_[_0x0549('0x3b')](_0x371bcd[_0x0549('0x32')],_0x4d263f[_0x0549('0x34')]),_0x52781a);if(_0x371bcd['query'][_0x0549('0x3c')]){_0x461710['where']=_['merge'](_0x461710[_0x0549('0x3a')],{'$or':_[_0x0549('0x31')](_0x52781a,function(_0x3f6ec9){if(_0x3f6ec9[_0x0549('0x3d')]!==_0x0549('0x3e')){var _0x15fb17={};_0x15fb17[_0x3f6ec9[_0x0549('0x2a')]]={'$like':'%'+_0x371bcd[_0x0549('0x32')][_0x0549('0x3c')]+'%'};return _0x15fb17;}})});}_0x461710=_['merge']({},_0x461710,_0x371bcd['options']);var _0x4e5798={'where':_0x461710[_0x0549('0x3a')]};return db[_0x0549('0x2c')][_0x0549('0x1b')](_0x4e5798)['then'](function(_0x342343){_0x15a12d[_0x0549('0x1b')]=_0x342343;if(_0x371bcd[_0x0549('0x32')][_0x0549('0x3f')]){_0x461710[_0x0549('0x40')]=[{'all':!![]}];}return db[_0x0549('0x2c')][_0x0549('0x41')](_0x461710);})[_0x0549('0x21')](function(_0x5137c4){_0x15a12d[_0x0549('0x42')]=_0x5137c4;return _0x15a12d;})[_0x0549('0x21')](respondWithFilteredResult(_0x4edcf4,_0x461710))[_0x0549('0x43')](handleError(_0x4edcf4,null));};exports[_0x0549('0x44')]=function(_0x3907fd,_0x1be834){var _0x1b3e5a={'raw':![],'where':{'id':_0x3907fd['params']['id']}},_0x4679c9={};_0x4679c9['model']=_['keys'](db[_0x0549('0x2c')][_0x0549('0x2d')]);_0x4679c9[_0x0549('0x32')]=_[_0x0549('0x33')](_0x3907fd['query']);_0x4679c9[_0x0549('0x34')]=_['intersection'](_0x4679c9['model'],_0x4679c9['query']);_0x1b3e5a[_0x0549('0x36')]=_[_0x0549('0x35')](_0x4679c9[_0x0549('0x30')],qs[_0x0549('0x37')](_0x3907fd['query'][_0x0549('0x37')]));_0x1b3e5a[_0x0549('0x36')]=_0x1b3e5a[_0x0549('0x36')][_0x0549('0x45')]?_0x1b3e5a['attributes']:_0x4679c9[_0x0549('0x30')];if(_0x3907fd[_0x0549('0x32')][_0x0549('0x3f')]){_0x1b3e5a[_0x0549('0x40')]=[{'all':!![]}];}_0x1b3e5a=_[_0x0549('0x46')]({},_0x1b3e5a,_0x3907fd['options']);return db[_0x0549('0x2c')][_0x0549('0x47')](_0x1b3e5a)[_0x0549('0x21')](handleEntityNotFound(_0x1be834,null))['then'](respondWithResult(_0x1be834,null))[_0x0549('0x43')](handleError(_0x1be834,null));};exports[_0x0549('0x20')]=function(_0x1a1ec1,_0x5b6320){if(_0x1a1ec1['body']['id']){delete _0x1a1ec1[_0x0549('0x48')]['id'];}return db[_0x0549('0x2c')][_0x0549('0x47')]({'where':{'id':_0x1a1ec1[_0x0549('0x49')]['id']}})[_0x0549('0x21')](handleEntityNotFound(_0x5b6320,null))[_0x0549('0x21')](saveUpdates(_0x1a1ec1['body'],null))[_0x0549('0x21')](respondWithResult(_0x5b6320,null))[_0x0549('0x43')](handleError(_0x5b6320,null));};exports[_0x0549('0x4a')]=function(_0x50137a,_0x1d4df7,_0xdf48bb){return db[_0x0549('0x4b')][_0x0549('0x4c')](function(_0x96241f){if(_0x50137a[_0x0549('0x48')][_0x0549('0x4d')]===_0x0549('0x4e')){_0x50137a[_0x0549('0x48')]['directory']=path[_0x0549('0x4f')](config['root'],_0x0549('0x50'),_0x50137a[_0x0549('0x48')]['name']);}return db[_0x0549('0x2c')][_0x0549('0x4a')](_0x50137a['body'],{'transaction':_0x96241f})[_0x0549('0x21')](function(_0x71ec6a){if(_0x50137a[_0x0549('0x48')][_0x0549('0x4d')]===_0x0549('0x4e')){fs[_0x0549('0x51')](_0x71ec6a[_0x0549('0x52')],parseInt(_0x0549('0x53'),0x8));}var _0x10a147=_0x50137a[_0x0549('0x54')]['get']({'plain':!![]});if(!_0x10a147)throw new Error(_0x0549('0x55'));if(_0x10a147['role']===_0x0549('0x54')){var _0x3771d4=_0x71ec6a[_0x0549('0x23')]({'plain':!![]});return db[_0x0549('0x56')][_0x0549('0x47')]({'where':{'name':_0x0549('0x24'),'userProfileId':_0x10a147[_0x0549('0x57')]},'raw':!![]})[_0x0549('0x21')](function(_0x230426){if(_0x230426&&_0x230426[_0x0549('0x58')]===0x0){return db[_0x0549('0x25')]['create']({'name':_0x3771d4[_0x0549('0x2a')],'resourceId':_0x3771d4['id'],'type':_0x230426[_0x0549('0x2a')],'sectionId':_0x230426['id']},{})['then'](function(){return _0x71ec6a;});}else{return _0x71ec6a;}})[_0x0549('0x43')](function(_0x39df4f){logger[_0x0549('0x28')](_0x0549('0x59'),_0x39df4f);});}return _0x71ec6a;});})[_0x0549('0x21')](respondWithResult(_0x1d4df7,0xc9))[_0x0549('0x43')](handleError(_0x1d4df7,null));};exports[_0x0549('0x22')]=function(_0x337118,_0x2e8209,_0x192b3f){var _0x305c80;return db[_0x0549('0x2c')][_0x0549('0x47')]({'where':{'id':_0x337118['params']['id']}})[_0x0549('0x21')](function(_0x1dd736){if(_0x1dd736){return db[_0x0549('0x4b')][_0x0549('0x4c')](function(_0x1ea40f){return _0x1dd736[_0x0549('0x22')]({'transaction':_0x1ea40f,'raw':!![]})[_0x0549('0x21')](function(_0x52b460){if(_0x52b460[_0x0549('0x52')]){fs[_0x0549('0x5a')](_0x52b460['directory'])['forEach'](function(_0x121335){fs[_0x0549('0x5b')](path[_0x0549('0x4f')](_0x52b460[_0x0549('0x52')],_0x121335));});fs['rmdirSync'](_0x52b460[_0x0549('0x52')]);}return _0x52b460;});})[_0x0549('0x43')](function(_0x807a0a){throw new db[(_0x0549('0x5c'))][(_0x0549('0x5d'))](_0x807a0a[_0x0549('0x5e')]);});}})[_0x0549('0x21')](handleEntityNotFound(_0x2e8209,null))['then'](removeEntity(_0x2e8209,null))[_0x0549('0x43')](handleError(_0x2e8209,null));};exports[_0x0549('0x5f')]=function(_0x494955,_0x3934db,_0x30ec30){return db[_0x0549('0x4b')][_0x0549('0x4c')](function(_0x531726){var _0x4396f3;return db[_0x0549('0x2c')][_0x0549('0x47')]({'where':{'id':_0x494955[_0x0549('0x49')]['id']}})[_0x0549('0x21')](function(_0x38a2f8){if(_0x38a2f8){_0x4396f3=_0x38a2f8;return _0x38a2f8[_0x0549('0x5f')](_0x494955['body']['id'],{'transaction':_0x531726});}})['then'](function(_0x3d9d37){if(_0x3d9d37){return db[_0x0549('0x60')][_0x0549('0x61')]({'where':{'id':_0x494955['body']['id']},'attributes':['id',_0x0549('0x2a'),_0x0549('0x62'),_0x0549('0x63'),_0x0549('0x64')],'raw':!![]});}})['then'](function(_0x109276){if(_0x109276){var _0x10acdc=path['join'](config[_0x0549('0x65')],_0x0549('0x66'),util[_0x0549('0x67')](_0x0549('0x68'),path[_0x0549('0x69')](_0x109276[_0x0549('0x62')],path[_0x0549('0x6a')](_0x109276[_0x0549('0x62')])),_0x109276[_0x0549('0x63')]));var _0x147873=path['join'](config[_0x0549('0x65')],'server/files/moh',_0x4396f3['name'],util[_0x0549('0x67')]('%s.%s',_0x109276[_0x0549('0x2a')],_0x109276[_0x0549('0x63')]));fs[_0x0549('0x6b')](_0x10acdc,_0x147873);return _0x109276;}})[_0x0549('0x43')](function(_0x50fdb2){throw new db[(_0x0549('0x5c'))][(_0x0549('0x5d'))](_0x50fdb2[_0x0549('0x5e')]);});})[_0x0549('0x21')](handleEntityNotFound(_0x3934db,null))[_0x0549('0x21')](respondWithResult(_0x3934db,0xc9))[_0x0549('0x43')](handleError(_0x3934db,null));};exports['removeSound']=function(_0x5cf947,_0x13d89d,_0x1beef5){return db['sequelize'][_0x0549('0x4c')](function(_0x30fc8f){var _0x10d1e9;return db[_0x0549('0x2c')][_0x0549('0x61')]({'where':{'id':_0x5cf947[_0x0549('0x49')]['id']}})[_0x0549('0x21')](handleEntityNotFound(_0x13d89d,null))[_0x0549('0x21')](function(_0x185a33){if(_0x185a33){_0x10d1e9=_0x185a33;return _0x185a33[_0x0549('0x6c')](_0x5cf947['params'][_0x0549('0x6d')]);}})[_0x0549('0x21')](function(_0xdff0dd){if(_0xdff0dd){return db[_0x0549('0x60')][_0x0549('0x61')]({'where':{'id':_0x5cf947[_0x0549('0x49')][_0x0549('0x6d')]},'attributes':['id',_0x0549('0x2a'),_0x0549('0x62'),_0x0549('0x63'),'createdAt'],'raw':!![]});}})[_0x0549('0x21')](function(_0x4459e9){if(_0x4459e9){fs['unlinkSync'](path['join'](_0x10d1e9[_0x0549('0x52')],util[_0x0549('0x67')](_0x0549('0x68'),_0x4459e9['name'],_0x4459e9[_0x0549('0x63')])));return _0x4459e9;}})[_0x0549('0x43')](function(_0x3d87b3){throw new db['Sequelize']['ValidationError'](_0x3d87b3[_0x0549('0x5e')]);});})[_0x0549('0x21')](handleEntityNotFound(_0x13d89d,null))['then'](respondWithStatusCode(_0x13d89d,0xcc))['catch'](handleError(_0x13d89d,null));};exports[_0x0549('0x6e')]=function(_0x56661e,_0x2949ca,_0x2efeae){var _0x1e56d5={};var _0x15d6d0={};var _0x3efd2f;var _0x5c0dff;return db[_0x0549('0x2c')][_0x0549('0x61')]({'where':{'id':_0x56661e[_0x0549('0x49')]['id']}})[_0x0549('0x21')](handleEntityNotFound(_0x2949ca,null))[_0x0549('0x21')](function(_0x588967){if(_0x588967){_0x3efd2f=_0x588967;_0x15d6d0[_0x0549('0x30')]=_[_0x0549('0x33')](db['Sound'][_0x0549('0x2d')]);_0x15d6d0[_0x0549('0x32')]=_[_0x0549('0x33')](_0x56661e[_0x0549('0x32')]);_0x15d6d0[_0x0549('0x34')]=_[_0x0549('0x35')](_0x15d6d0['model'],_0x15d6d0['query']);_0x1e56d5[_0x0549('0x36')]=_[_0x0549('0x35')](_0x15d6d0[_0x0549('0x30')],qs[_0x0549('0x37')](_0x56661e[_0x0549('0x32')][_0x0549('0x37')]));_0x1e56d5['attributes']=_0x1e56d5[_0x0549('0x36')][_0x0549('0x45')]?_0x1e56d5['attributes']:_0x15d6d0[_0x0549('0x30')];_0x1e56d5[_0x0549('0x6f')]=qs[_0x0549('0x70')](_0x56661e[_0x0549('0x32')][_0x0549('0x70')]);_0x1e56d5[_0x0549('0x3a')]=qs['filters'](_[_0x0549('0x3b')](_0x56661e[_0x0549('0x32')],_0x15d6d0[_0x0549('0x34')]));if(_0x56661e[_0x0549('0x32')][_0x0549('0x3c')]){_0x1e56d5[_0x0549('0x3a')]=_[_0x0549('0x46')](_0x1e56d5[_0x0549('0x3a')],{'$or':_[_0x0549('0x31')](_0x1e56d5[_0x0549('0x36')],function(_0x3c7201){var _0x328dc8={};_0x328dc8[_0x3c7201]={'$like':'%'+_0x56661e[_0x0549('0x32')][_0x0549('0x3c')]+'%'};return _0x328dc8;})});}_0x1e56d5=_[_0x0549('0x46')]({},_0x1e56d5,_0x56661e[_0x0549('0x71')]);return _0x3efd2f['getSounds'](_0x1e56d5);}})[_0x0549('0x21')](function(_0x3f3151){if(_0x3f3151){_0x5c0dff=_0x3f3151['length'];if(!_0x56661e['query'][_0x0549('0x38')](_0x0549('0x39'))){_0x1e56d5[_0x0549('0x19')]=qs['limit'](_0x56661e[_0x0549('0x32')][_0x0549('0x19')]);_0x1e56d5[_0x0549('0x18')]=qs[_0x0549('0x18')](_0x56661e[_0x0549('0x32')][_0x0549('0x18')]);}return _0x3efd2f['getSounds'](_0x1e56d5);}})[_0x0549('0x21')](function(_0xfd97d4){if(_0xfd97d4){return _0xfd97d4?{'count':_0x5c0dff,'rows':_0xfd97d4}:null;}})[_0x0549('0x21')](respondWithResult(_0x2949ca,null))[_0x0549('0x43')](handleError(_0x2949ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c958c94..b8478d0 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 _0x74d4=['exports','define','VoiceMusicOnHold','voice_musiconhold','util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x3e86e2,_0x551ef2){var _0x38feb7=function(_0xecb266){while(--_0xecb266){_0x3e86e2['push'](_0x3e86e2['shift']());}};_0x38feb7(++_0x551ef2);}(_0x74d4,0x72));var _0x474d=function(_0x3f2ab8,_0x44c0e2){_0x3f2ab8=_0x3f2ab8-0x0;var _0xe9253c=_0x74d4[_0x3f2ab8];return _0xe9253c;};'use strict';var _=require('lodash');var util=require(_0x474d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x474d('0x1'));var BPromise=require(_0x474d('0x2'));var rp=require(_0x474d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x474d('0x4'));var config=require(_0x474d('0x5'));var attributes=require(_0x474d('0x6'));module[_0x474d('0x7')]=function(_0x5ec418,_0x447599){return _0x5ec418[_0x474d('0x8')](_0x474d('0x9'),attributes,{'tableName':_0x474d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x513a=['voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0x513a,0x135));var _0xa513=function(_0x4aaff3,_0x18b012){_0x4aaff3=_0x4aaff3-0x0;var _0x3a20f3=_0x513a[_0x4aaff3];return _0x3a20f3;};'use strict';var _=require(_0xa513('0x0'));var util=require(_0xa513('0x1'));var logger=require(_0xa513('0x2'))(_0xa513('0x3'));var moment=require(_0xa513('0x4'));var BPromise=require(_0xa513('0x5'));var rp=require(_0xa513('0x6'));var fs=require('fs');var path=require(_0xa513('0x7'));var rimraf=require('rimraf');var config=require(_0xa513('0x8'));var attributes=require(_0xa513('0x9'));module[_0xa513('0xa')]=function(_0x9a2748,_0x226fb3){return _0x9a2748[_0xa513('0xb')](_0xa513('0xc'),attributes,{'tableName':_0xa513('0xd'),'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 d6ff5c0..cea7b6e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3bdf65,_0x19339f){var _0x1243f4=function(_0x16f77a){while(--_0x16f77a){_0x3bdf65['push'](_0x3bdf65['shift']());}};_0x1243f4(++_0x19339f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _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(_0x46a47a,_0x51301b){var _0x2d7d4c=function(_0x12354f){while(--_0x12354f){_0x46a47a['push'](_0x46a47a['shift']());}};_0x2d7d4c(++_0x51301b);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 93e5309..fb71555 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 _0xff98=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','create','post','addAgents','addTeams','put','update','delete','removeTeams','exports'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xff98,0x9c));var _0x8ff9=function(_0x40c087,_0x5111c6){_0x40c087=_0x40c087-0x0;var _0x8158bd=_0xff98[_0x40c087];return _0x8158bd;};'use strict';var multer=require('multer');var util=require(_0x8ff9('0x0'));var path=require(_0x8ff9('0x1'));var timeout=require(_0x8ff9('0x2'));var express=require(_0x8ff9('0x3'));var router=express['Router']();var fs_extra=require(_0x8ff9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ff9('0x5'));var config=require('../../config/environment');var controller=require(_0x8ff9('0x6'));router['get']('/',auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x8')]);router[_0x8ff9('0x9')](_0x8ff9('0xa'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0xb')]);router[_0x8ff9('0x9')](_0x8ff9('0xc'),auth['isAuthenticated'](),controller[_0x8ff9('0xd')]);router[_0x8ff9('0x9')](_0x8ff9('0xe'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0xf')]);router[_0x8ff9('0x9')](_0x8ff9('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['post']('/',auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x11')]);router[_0x8ff9('0x12')]('/:id/users',auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x13')]);router[_0x8ff9('0x12')](_0x8ff9('0x10'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x14')]);router[_0x8ff9('0x15')]('/:id',auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x16')]);router[_0x8ff9('0x17')]('/:id',auth[_0x8ff9('0x7')](),controller['destroy']);router[_0x8ff9('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0x8ff9('0x10'),auth[_0x8ff9('0x7')](),controller[_0x8ff9('0x18')]);module[_0x8ff9('0x19')]=router; \ No newline at end of file +var _0x447b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','addTeams','update','delete','removeAgents','/:id/teams','removeTeams','exports','multer','util','connect-timeout','express'];(function(_0x11fa92,_0x21f9ad){var _0x37aa45=function(_0x5793d5){while(--_0x5793d5){_0x11fa92['push'](_0x11fa92['shift']());}};_0x37aa45(++_0x21f9ad);}(_0x447b,0xe4));var _0xb447=function(_0x3842ef,_0x1e35ad){_0x3842ef=_0x3842ef-0x0;var _0xb638de=_0x447b[_0x3842ef];return _0xb638de;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require('path');var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require(_0xb447('0x6'));var interaction=require(_0xb447('0x7'));var config=require(_0xb447('0x8'));var controller=require(_0xb447('0x9'));router[_0xb447('0xa')]('/',auth[_0xb447('0xb')](),controller['index']);router['get'](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0xd')]);router[_0xb447('0xa')](_0xb447('0xe'),auth[_0xb447('0xb')](),controller[_0xb447('0xf')]);router['get'](_0xb447('0x10'),auth[_0xb447('0xb')](),controller[_0xb447('0x11')]);router[_0xb447('0xa')]('/:id/teams',auth[_0xb447('0xb')](),controller[_0xb447('0x12')]);router[_0xb447('0x13')]('/',auth[_0xb447('0xb')](),controller[_0xb447('0x14')]);router[_0xb447('0x13')](_0xb447('0x10'),auth[_0xb447('0xb')](),controller[_0xb447('0x15')]);router['post']('/:id/teams',auth[_0xb447('0xb')](),controller[_0xb447('0x16')]);router['put'](_0xb447('0xe'),auth[_0xb447('0xb')](),controller[_0xb447('0x17')]);router['delete']('/:id',auth[_0xb447('0xb')](),controller['destroy']);router[_0xb447('0x18')]('/:id/users',auth[_0xb447('0xb')](),controller[_0xb447('0x19')]);router[_0xb447('0x18')](_0xb447('0x1a'),auth[_0xb447('0xb')](),controller[_0xb447('0x1b')]);module[_0xb447('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b2e4f89..0cde237 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 _0xcd8f=['getDataValue','INTEGER','exports','STRING','name','VIRTUAL','system-'];(function(_0x1363ac,_0x40e2ab){var _0x170097=function(_0x3da07e){while(--_0x3da07e){_0x1363ac['push'](_0x1363ac['shift']());}};_0x170097(++_0x40e2ab);}(_0xcd8f,0x191));var _0xfcd8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcd8f[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0xfcd8('0x0')]={'name':{'type':Sequelize[_0xfcd8('0x1')],'allowNull':![],'unique':_0xfcd8('0x2')},'prefix':{'type':Sequelize[_0xfcd8('0x3')],'get':function(_0x24b0fd){return _0xfcd8('0x4')+this[_0xfcd8('0x5')](_0xfcd8('0x2'))+'-';}},'description':{'type':Sequelize[_0xfcd8('0x1')]},'callerIdAll':{'type':Sequelize[_0xfcd8('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xfcd8('0x6')]}}; \ No newline at end of file +var _0xf2ad=['getDataValue','INTEGER','exports','STRING','name'];(function(_0x5ee65e,_0x409c32){var _0x6670a=function(_0x50a030){while(--_0x50a030){_0x5ee65e['push'](_0x5ee65e['shift']());}};_0x6670a(++_0x409c32);}(_0xf2ad,0x9d));var _0xdf2a=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0xf2ad[_0xf80b3];return _0x10c489;};'use strict';var Sequelize=require('sequelize');module[_0xdf2a('0x0')]={'name':{'type':Sequelize[_0xdf2a('0x1')],'allowNull':![],'unique':_0xdf2a('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x439a04){return'system-'+this[_0xdf2a('0x3')](_0xdf2a('0x2'))+'-';}},'description':{'type':Sequelize[_0xdf2a('0x1')]},'callerIdAll':{'type':Sequelize[_0xdf2a('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xdf2a('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 875925d..ec25f16 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 _0x4b17=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','params','rawAttributes','includeAll','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','context','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','isEmpty','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4b17,0x10f));var _0x74b1=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x4b17[_0x3a607e];return _0x37b106;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];config['redis']=_['defaults'](config[_0x74b1('0x17')],{'host':_0x74b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x74b1('0x19')](socket);function respondWithStatusCode(_0x5c12eb,_0x4e289b){_0x4e289b=_0x4e289b||0xcc;return function(_0x2ccba6){if(_0x2ccba6){return _0x5c12eb[_0x74b1('0x1a')](_0x4e289b);}return _0x5c12eb[_0x74b1('0x1b')](_0x4e289b)[_0x74b1('0x1c')]();};}function respondWithResult(_0x16b147,_0x10138e){_0x10138e=_0x10138e||0xc8;return function(_0x528e8c){if(_0x528e8c){return _0x16b147[_0x74b1('0x1b')](_0x10138e)[_0x74b1('0x1d')](_0x528e8c);}};}function respondWithFilteredResult(_0x1a0851,_0x2cfcc3){return function(_0xde2736){if(_0xde2736){var _0x8c9510=typeof _0x2cfcc3[_0x74b1('0x1e')]==='undefined'&&typeof _0x2cfcc3[_0x74b1('0x1f')]===_0x74b1('0x20');var _0x524ece=_0xde2736[_0x74b1('0x21')];var _0x38d932=_0x8c9510?0x0:_0x2cfcc3[_0x74b1('0x1e')];var _0x25704e=_0x8c9510?_0xde2736[_0x74b1('0x21')]:_0x2cfcc3[_0x74b1('0x1e')]+_0x2cfcc3[_0x74b1('0x1f')];var _0xaac5f7;if(_0x25704e>=_0x524ece){_0x25704e=_0x524ece;_0xaac5f7=0xc8;}else{_0xaac5f7=0xce;}_0x1a0851['status'](_0xaac5f7);return _0x1a0851[_0x74b1('0x22')]('Content-Range',_0x38d932+'-'+_0x25704e+'/'+_0x524ece)['json'](_0xde2736);}return null;};}function patchUpdates(_0x481bf2){return function(_0x27fd1a){try{jsonpatch[_0x74b1('0x23')](_0x27fd1a,_0x481bf2,!![]);}catch(_0x405a22){return BPromise[_0x74b1('0x24')](_0x405a22);}return _0x27fd1a[_0x74b1('0x25')]();};}function saveUpdates(_0x4ee88b,_0x3c78e5){return function(_0x4eca36){if(_0x4eca36){return _0x4eca36[_0x74b1('0x26')](_0x4ee88b)[_0x74b1('0x27')](function(_0xb5af0){return _0xb5af0;});}return null;};}function removeEntity(_0x14a651,_0x3239d8){return function(_0x322de5){if(_0x322de5){return _0x322de5[_0x74b1('0x28')]()[_0x74b1('0x27')](function(){var _0x4c7f05=_0x322de5[_0x74b1('0x29')]({'plain':!![]});var _0x42b69d=_0x74b1('0x2a');return db['UserProfileResource'][_0x74b1('0x28')]({'where':{'type':_0x42b69d,'resourceId':_0x4c7f05['id']}})[_0x74b1('0x27')](function(){return _0x322de5;});})[_0x74b1('0x27')](function(){_0x14a651[_0x74b1('0x1b')](0xcc)[_0x74b1('0x1c')]();});}};}function handleEntityNotFound(_0x273ff1,_0x436eda){return function(_0x3ce043){if(!_0x3ce043){_0x273ff1['sendStatus'](0x194);}return _0x3ce043;};}function handleError(_0xe74c82,_0x40b32a){_0x40b32a=_0x40b32a||0x1f4;return function(_0x51ce6d){logger[_0x74b1('0x2b')](_0x51ce6d[_0x74b1('0x2c')]);if(_0x51ce6d[_0x74b1('0x2d')]){delete _0x51ce6d['name'];}_0xe74c82[_0x74b1('0x1b')](_0x40b32a)[_0x74b1('0x2e')](_0x51ce6d);};}exports['index']=function(_0x3dbf18,_0x33ec7c){var _0x2211b2={},_0x31c321={},_0x68a3bd={'count':0x0,'rows':[]};var _0x32a8d6=_[_0x74b1('0x2f')](db[_0x74b1('0x30')]['rawAttributes'],function(_0x3d5fc0){return{'name':_0x3d5fc0['fieldName'],'type':_0x3d5fc0['type'][_0x74b1('0x31')]};});_0x31c321['model']=_['map'](_0x32a8d6,_0x74b1('0x2d'));_0x31c321[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x3dbf18[_0x74b1('0x32')]);_0x31c321[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x31c321[_0x74b1('0x36')],_0x31c321[_0x74b1('0x32')]);_0x2211b2['attributes']=_['intersection'](_0x31c321['model'],qs[_0x74b1('0x37')](_0x3dbf18['query']['fields']));_0x2211b2[_0x74b1('0x38')]=_0x2211b2[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2211b2['attributes']:_0x31c321[_0x74b1('0x36')];if(!_0x3dbf18['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2211b2['limit']=qs['limit'](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2211b2['offset']=qs['offset'](_0x3dbf18[_0x74b1('0x32')]['offset']);}_0x2211b2[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x2211b2[_0x74b1('0x3e')]=qs['filters'](_[_0x74b1('0x3f')](_0x3dbf18['query'],_0x31c321[_0x74b1('0x34')]),_0x32a8d6);if(_0x3dbf18['query'][_0x74b1('0x40')]){_0x2211b2['where']=_['merge'](_0x2211b2[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x32a8d6,function(_0x2725fd){if(_0x2725fd['type']!==_0x74b1('0x41')){var _0x327334={};_0x327334[_0x2725fd[_0x74b1('0x2d')]]={'$like':'%'+_0x3dbf18['query'][_0x74b1('0x40')]+'%'};return _0x327334;}})});}_0x2211b2=_[_0x74b1('0x42')]({},_0x2211b2,_0x3dbf18['options']);var _0x48ac05={'where':_0x2211b2[_0x74b1('0x3e')]};return db[_0x74b1('0x30')][_0x74b1('0x21')](_0x48ac05)[_0x74b1('0x27')](function(_0x1d9f5b){_0x68a3bd[_0x74b1('0x21')]=_0x1d9f5b;if(_0x3dbf18[_0x74b1('0x32')]['includeAll']){_0x2211b2[_0x74b1('0x43')]=[{'all':!![]}];}return db[_0x74b1('0x30')][_0x74b1('0x44')](_0x2211b2);})[_0x74b1('0x27')](function(_0x17a44f){_0x68a3bd['rows']=_0x17a44f;return _0x68a3bd;})[_0x74b1('0x27')](respondWithFilteredResult(_0x33ec7c,_0x2211b2))[_0x74b1('0x45')](handleError(_0x33ec7c,null));};exports['show']=function(_0x50d9de,_0x1b7a58){var _0x3c3c3c={'raw':![],'where':{'id':_0x50d9de[_0x74b1('0x46')]['id']}},_0x54c94b={};_0x54c94b[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x30')][_0x74b1('0x47')]);_0x54c94b[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x50d9de['query']);_0x54c94b['filters']=_['intersection'](_0x54c94b[_0x74b1('0x36')],_0x54c94b[_0x74b1('0x32')]);_0x3c3c3c[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x54c94b[_0x74b1('0x36')],qs['fields'](_0x50d9de[_0x74b1('0x32')][_0x74b1('0x37')]));_0x3c3c3c[_0x74b1('0x38')]=_0x3c3c3c[_0x74b1('0x38')][_0x74b1('0x39')]?_0x3c3c3c[_0x74b1('0x38')]:_0x54c94b[_0x74b1('0x36')];if(_0x50d9de[_0x74b1('0x32')][_0x74b1('0x48')]){_0x3c3c3c[_0x74b1('0x43')]=[{'all':!![]}];}_0x3c3c3c=_[_0x74b1('0x42')]({},_0x3c3c3c,_0x50d9de[_0x74b1('0x49')]);return db['VoicePrefix'][_0x74b1('0x4a')](_0x3c3c3c)[_0x74b1('0x27')](handleEntityNotFound(_0x1b7a58,null))['then'](respondWithResult(_0x1b7a58,null))[_0x74b1('0x45')](handleError(_0x1b7a58,null));};exports['destroy']=function(_0x4b1add,_0x2073eb){return db['VoicePrefix'][_0x74b1('0x4a')]({'where':{'id':_0x4b1add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2073eb,null))['then'](removeEntity(_0x2073eb,null))[_0x74b1('0x45')](handleError(_0x2073eb,null));};exports[_0x74b1('0x4b')]=function(_0x1b2d51,_0x3d199b){return db[_0x74b1('0x30')]['describe']()[_0x74b1('0x27')](respondWithResult(_0x3d199b,null))['catch'](handleError(_0x3d199b,null));};exports[_0x74b1('0x4c')]=function(_0x4085b8,_0x5e458c){var _0x1be639;return db[_0x74b1('0x4d')][_0x74b1('0x4e')](function(_0x54a221){return db[_0x74b1('0x30')][_0x74b1('0x4c')](_0x4085b8['body'],{'transaction':_0x54a221})[_0x74b1('0x27')](function(_0x4fdd6b){_0x1be639=_0x4fdd6b['get']({'plain':!![]});return db[_0x74b1('0x4f')][_0x74b1('0x4a')]({'where':{'id':_0x1be639[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x41b45f){return createVoicePrefixExtensions(_0x1be639,_0x41b45f,_0x54a221);});});})['then'](function(){var _0x145ce3=_0x4085b8[_0x74b1('0x51')]['get']({'plain':!![]});if(!_0x145ce3)throw new Error(_0x74b1('0x52'));if(_0x145ce3[_0x74b1('0x53')]===_0x74b1('0x51')){var _0x5634d1=_0x1be639;return db[_0x74b1('0x54')][_0x74b1('0x4a')]({'where':{'name':_0x74b1('0x2a'),'userProfileId':_0x145ce3['userProfileId']},'raw':!![]})[_0x74b1('0x27')](function(_0x3b4338){if(_0x3b4338&&_0x3b4338[_0x74b1('0x55')]===0x0){return db[_0x74b1('0x56')][_0x74b1('0x4c')]({'name':_0x5634d1[_0x74b1('0x2d')],'resourceId':_0x5634d1['id'],'type':_0x3b4338['name'],'sectionId':_0x3b4338['id']},{})[_0x74b1('0x27')](function(){return _0x1be639;});}else{return _0x1be639;}})['catch'](function(_0x5343c4){logger[_0x74b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5343c4);throw _0x5343c4;});}return _0x1be639;})['then'](respondWithResult(_0x5e458c,null))[_0x74b1('0x45')](handleError(_0x5e458c,null));};function Extension(_0x29ab63,_0x16db5c,_0x515a8e,_0x204b7d){this[_0x74b1('0x57')]=_0x74b1('0x58');this[_0x74b1('0x59')]=_0x29ab63;this[_0x74b1('0x5a')]=_0x515a8e;this[_0x74b1('0x5b')]=_0x74b1('0x5c');this[_0x74b1('0x5d')]=_0x74b1('0x5e');this[_0x74b1('0x5f')]=_0x16db5c;this[_0x74b1('0x60')]=_0x204b7d;}function createVoicePrefixExtensions(_0x112721,_0x516e44,_0x598daa){return new BPromise(function(_0x2a46ca,_0x553615){var _0x15eb38=new Extension(formatPrefixName(_0x112721[_0x74b1('0x61')]),0x1,'NoOp','Voice\x20Prefix');_0x15eb38[_0x74b1('0x62')]=_0x112721['id'];return db[_0x74b1('0x4f')][_0x74b1('0x4c')](_0x15eb38,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x3dd0c3){var _0x1f879f=_0x3dd0c3[_0x74b1('0x29')]({'plain':!![]});var _0x1fb137=_[_0x74b1('0x2f')](addVoicePrefixExtensions(_0x112721,_0x516e44),function(_0x128a7e){_0x128a7e[_0x74b1('0x50')]=_0x1f879f['id'];_0x128a7e[_0x74b1('0x62')]=_0x112721['id'];return _0x128a7e;});return db['VoiceExtension'][_0x74b1('0x63')](_0x1fb137,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x378f63){if(!_0x378f63){return _0x553615(_0x74b1('0x64'));}else{return _0x2a46ca(_0x378f63);}})['catch'](function(_0x308b98){return _0x553615(_0x308b98);});});;});};function addVoicePrefixExtensions(_0x1709d9,_0x5ada76){var _0x425f9f=[];var _0x4d2fcb=formatPrefixName(_0x1709d9[_0x74b1('0x61')]);_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x2,'Set',_0x74b1('0x66')+_0x1709d9[_0x74b1('0x2d')]));if(_0x1709d9[_0x74b1('0x67')]){_0x425f9f['push'](new Extension(_0x4d2fcb,0x3,_0x74b1('0x68'),'PREFIX-CALLERIDALL='+_0x1709d9[_0x74b1('0x67')]));}else{_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x3,_0x74b1('0x69'),_0x74b1('0x6a')));}_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x4,_0x74b1('0x6b'),_0x5ada76[_0x74b1('0x57')]+','+_0x74b1('0x6c')+(0x8+_0x1709d9[_0x74b1('0x2d')][_0x74b1('0x39')])+'}'+','+0x1));return _0x425f9f;}function formatPrefixName(_0x8b4902){var _0x44563d='_';for(var _0x2a33c9=0x0;_0x2a33c9<_0x8b4902['length'];_0x2a33c9++){if(_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)=='-'){_0x44563d+=_0x8b4902[_0x74b1('0x6d')](_0x2a33c9);}else{_0x44563d+='['+_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)+']';}}_0x44563d+='.';return _0x44563d;}exports[_0x74b1('0x26')]=function(_0x30692c,_0x228f8f,_0x2e94d6){var _0x7e2bcc=_0x30692c[_0x74b1('0x6e')];_0x7e2bcc['prefix']=_0x74b1('0x6f')+_0x7e2bcc['name']+'-';return db[_0x74b1('0x4d')]['transaction'](function(_0x5886d1){return db[_0x74b1('0x30')][_0x74b1('0x26')](_0x7e2bcc,{'where':{'id':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x28')]({'where':{'VoicePrefixId':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x4a')]({'where':{'id':_0x7e2bcc[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x21e767){return createVoicePrefixExtensions(_0x7e2bcc,_0x21e767,_0x5886d1);});});});})[_0x74b1('0x27')](function(){return db[_0x74b1('0x30')][_0x74b1('0x70')](_0x7e2bcc['id']);})[_0x74b1('0x27')](respondWithResult(_0x228f8f,null))[_0x74b1('0x45')](handleError(_0x228f8f,null));};exports[_0x74b1('0x71')]=function(_0x542ee7,_0x2b1119,_0x3267ef){return db[_0x74b1('0x30')]['find']({'where':{'id':_0x542ee7[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2b1119,null))[_0x74b1('0x27')](function(_0x1a6a70){if(_0x1a6a70){return _0x1a6a70[_0x74b1('0x71')](_0x542ee7['body'][_0x74b1('0x72')],_[_0x74b1('0x73')](_0x542ee7[_0x74b1('0x6e')],[_0x74b1('0x72'),'id'])||{})[_0x74b1('0x74')](function(_0x36733f){for(var _0x359e05=0x0;_0x359e05<_0x542ee7[_0x74b1('0x6e')]['ids'][_0x74b1('0x39')];_0x359e05+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':Number(_0x542ee7['body']['ids'][_0x359e05]),'VoicePrefixId':Number(_0x542ee7[_0x74b1('0x46')]['id'])});}return _0x36733f;});}})[_0x74b1('0x27')](respondWithResult(_0x2b1119,null))[_0x74b1('0x45')](handleError(_0x2b1119,null));};exports[_0x74b1('0x77')]=function(_0x2de935,_0x5d8729,_0x42a630){return db['VoicePrefix']['find']({'where':{'id':_0x2de935[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5d8729,null))[_0x74b1('0x27')](function(_0x2da0f2){if(_0x2da0f2){return _0x2da0f2[_0x74b1('0x77')](_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')])[_0x74b1('0x27')](function(){if(_['isArray'](_0x2de935['query']['ids'])){for(var _0x7ec28f=0x0;_0x7ec28f<_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x74b1('0x39')];_0x7ec28f+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x7ec28f]),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}}else{socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')]['ids']),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}});}})[_0x74b1('0x27')](respondWithStatusCode(_0x5d8729,null))[_0x74b1('0x45')](handleError(_0x5d8729,null));};exports[_0x74b1('0x79')]=function(_0x25f929,_0x138f79,_0x5a07a6){var _0x2567d7={};var _0x32eb2d={};var _0x21c54f;var _0x4b025c;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x25f929[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x138f79,null))['then'](function(_0x7d3f08){if(_0x7d3f08){_0x21c54f=_0x7d3f08;_0x32eb2d[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x7b')][_0x74b1('0x47')]);_0x32eb2d['query']=_[_0x74b1('0x33')](_0x25f929[_0x74b1('0x32')]);_0x32eb2d['filters']=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],_0x32eb2d['query']);_0x2567d7[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],qs[_0x74b1('0x37')](_0x25f929['query']['fields']));_0x2567d7[_0x74b1('0x38')]=_0x2567d7[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2567d7['attributes']:_0x32eb2d[_0x74b1('0x36')];_0x2567d7[_0x74b1('0x3c')]=qs['sort'](_0x25f929['query'][_0x74b1('0x3d')]);_0x2567d7[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_['pick'](_0x25f929[_0x74b1('0x32')],_0x32eb2d[_0x74b1('0x34')]));if(_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]){_0x2567d7['where']=_['merge'](_0x2567d7[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x2567d7['attributes'],function(_0x1bf4a4){var _0x258b8f={};_0x258b8f[_0x1bf4a4]={'$like':'%'+_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]+'%'};return _0x258b8f;})});}_0x2567d7=_[_0x74b1('0x42')]({},_0x2567d7,_0x25f929[_0x74b1('0x49')]);return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x21453e){if(_0x21453e){_0x4b025c=_0x21453e[_0x74b1('0x39')];if(!_0x25f929['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2567d7[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x25f929[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2567d7['offset']=qs[_0x74b1('0x1e')](_0x25f929['query'][_0x74b1('0x1e')]);}return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x4fcd9a){if(_0x4fcd9a){return _0x4fcd9a?{'count':_0x4b025c,'rows':_0x4fcd9a}:null;}})[_0x74b1('0x27')](respondWithResult(_0x138f79,null))[_0x74b1('0x45')](handleError(_0x138f79,null));};exports['getTeams']=function(_0x4a9ec5,_0x5c02fc,_0x1cbfde){var _0x6ac5ae={};var _0x1a223d={};var _0x25624b;var _0xb24035;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x4a9ec5[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5c02fc,null))[_0x74b1('0x27')](function(_0x220cbf){if(_0x220cbf){_0x25624b=_0x220cbf;_0x1a223d[_0x74b1('0x36')]=_['keys'](db[_0x74b1('0x7c')][_0x74b1('0x47')]);_0x1a223d[_0x74b1('0x32')]=_['keys'](_0x4a9ec5[_0x74b1('0x32')]);_0x1a223d[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x1a223d['model'],_0x1a223d[_0x74b1('0x32')]);_0x6ac5ae[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x1a223d['model'],qs[_0x74b1('0x37')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x37')]));_0x6ac5ae[_0x74b1('0x38')]=_0x6ac5ae[_0x74b1('0x38')][_0x74b1('0x39')]?_0x6ac5ae[_0x74b1('0x38')]:_0x1a223d[_0x74b1('0x36')];_0x6ac5ae[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x6ac5ae[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_[_0x74b1('0x3f')](_0x4a9ec5[_0x74b1('0x32')],_0x1a223d[_0x74b1('0x34')]));if(_0x4a9ec5['query'][_0x74b1('0x40')]){_0x6ac5ae[_0x74b1('0x3e')]=_['merge'](_0x6ac5ae[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x6ac5ae[_0x74b1('0x38')],function(_0x3e3dfb){var _0x1a5c1e={};_0x1a5c1e[_0x3e3dfb]={'$like':'%'+_0x4a9ec5[_0x74b1('0x32')]['filter']+'%'};return _0x1a5c1e;})});}_0x6ac5ae=_['merge']({},_0x6ac5ae,_0x4a9ec5[_0x74b1('0x49')]);return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x401599){if(_0x401599){_0xb24035=_0x401599[_0x74b1('0x39')];if(!_0x4a9ec5[_0x74b1('0x32')]['hasOwnProperty'](_0x74b1('0x3b'))){_0x6ac5ae[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x4a9ec5[_0x74b1('0x32')]['limit']);_0x6ac5ae[_0x74b1('0x1e')]=qs[_0x74b1('0x1e')](_0x4a9ec5['query'][_0x74b1('0x1e')]);}return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x29de45){if(_0x29de45){return _0x29de45?{'count':_0xb24035,'rows':_0x29de45}:null;}})[_0x74b1('0x27')](respondWithResult(_0x5c02fc,null))[_0x74b1('0x45')](handleError(_0x5c02fc,null));};exports[_0x74b1('0x7e')]=function(_0x33b136,_0x4f9b6a,_0x8366b){var _0x2d356c=_0x33b136['body'][_0x74b1('0x72')];var _0x3719d7;return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x2d356c},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':_0x74b1('0x7f'),'attributes':['id',_0x74b1('0x2d'),'online',_0x74b1('0x80'),'interface'],'raw':!![]}]})[_0x74b1('0x27')](function(_0x3bd788){if(_0x3bd788){_0x3719d7=_0x3bd788;var _0x5b4ecf=_[_0x74b1('0x81')](_0x3bd788,function(_0x5dbc1f){var _0x4aa62a=_0x5dbc1f[_0x74b1('0x29')]({'plain':!![]});return _0x4aa62a['Agents'];});return db[_0x74b1('0x30')]['find']({'where':{'id':_0x33b136[_0x74b1('0x46')]['id']}})['then'](function(_0x5b8ba6){return db[_0x74b1('0x4d')]['transaction'](function(_0x2ea97c){return _0x5b8ba6[_0x74b1('0x7e')](_0x2d356c,{'transaction':_0x2ea97c})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x3719d7,function(_0x433293){return db['TeamVoicePrefix'][_0x74b1('0x83')]({'TeamId':_0x433293['id'],'VoicePrefixId':_0x33b136['params']['id']},{'transaction':_0x2ea97c});});})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x5b4ecf,function(_0x110bb6){return db['UserVoicePrefix'][_0x74b1('0x84')]({'where':{'UserId':_0x110bb6['id'],'VoicePrefixId':_0x33b136[_0x74b1('0x46')]['id']},'transaction':_0x2ea97c});});})['then'](function(){_0x5b4ecf[_0x74b1('0x85')](function(_0xbaf7f4){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':_0xbaf7f4['id'],'VoicePrefixId':_0x5b8ba6['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9b6a,null))[_0x74b1('0x45')](handleError(_0x4f9b6a,null));};exports[_0x74b1('0x86')]=function(_0x1f2add,_0x1ab4ea,_0x5b3ae9){return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x1f2add['query'][_0x74b1('0x72')]},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b1('0x27')](handleEntityNotFound(_0x1ab4ea,null))[_0x74b1('0x27')](function(_0x39354d){var _0x484368=_['map'](_0x39354d,'id');var _0xfcd9b=[];var _0x1b3847=[];var _0x4880f6=squel['select']();_0x4880f6[_0x74b1('0x87')](_0x74b1('0x88'))['from'](_0x74b1('0x89'),'tq')[_0x74b1('0x8a')](_0x74b1('0x8b'),'ut',_0x74b1('0x8c'))[_0x74b1('0x3e')](_0x74b1('0x8d'),_0x1f2add[_0x74b1('0x46')]['id']);for(var _0x523ec1=0x0;_0x523ec1<_0x39354d[_0x74b1('0x39')];_0x523ec1+=0x1){let _0x304756=_0x39354d[_0x523ec1];for(var _0x3039d7=0x0;_0x3039d7<_0x304756[_0x74b1('0x7f')][_0x74b1('0x39')];_0x3039d7+=0x1){let _0x367373=_0x304756[_0x74b1('0x7f')][_0x3039d7];var _0x2ee3a7=_0x4880f6[_0x74b1('0x8e')]();_0x2ee3a7[_0x74b1('0x3e')]('ut.UserId\x20=\x20?',_0x367373['id']);_0x1b3847['push'](db['sequelize'][_0x74b1('0x32')](_0x2ee3a7[_0x74b1('0x8f')](),{'type':db['sequelize'][_0x74b1('0x90')][_0x74b1('0x91')]})[_0x74b1('0x27')](function(_0x399c7c){if(_0x399c7c['length']===0x1){return _0x367373['id'];}else{var _0xe421dc=_[_0x74b1('0x92')](_[_0x74b1('0x2f')](_0x399c7c,_0x74b1('0x93')),function(_0x58896f){return _['includes'](_0x484368,_0x58896f);});if(_0xe421dc){return _0x367373['id'];}}}));}}return BPromise['all'](_0x1b3847)[_0x74b1('0x27')](function(_0x20f41b){_0xfcd9b=_(_0xfcd9b)['union'](_0x20f41b)['compact']()['value']();return db[_0x74b1('0x30')]['find']({'where':{'id':_0x1f2add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](function(_0x1326b3){return db['sequelize'][_0x74b1('0x4e')](function(_0x155534){return _0x1326b3['removeTeams'](_0x1f2add[_0x74b1('0x32')][_0x74b1('0x72')],{'transaction':_0x155534})[_0x74b1('0x27')](function(){if(!_[_0x74b1('0x94')](_0xfcd9b)){return _0x1326b3['removeAgents'](_0xfcd9b,{'transaction':_0x155534});}})[_0x74b1('0x27')](function(){_0xfcd9b[_0x74b1('0x85')](function(_0x4a9046){socket[_0x74b1('0x75')]('userVoicePrefix:remove',{'UserId':_0x4a9046,'VoicePrefixId':_0x1326b3['id']});});});});});});})[_0x74b1('0x27')](respondWithStatusCode(_0x1ab4ea,null))[_0x74b1('0x45')](handleError(_0x1ab4ea,null));}; \ No newline at end of file +var _0xd914=['Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','type','system','description'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd914,0x17f));var _0x4d91=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xd914[_0x154cb5];return _0x3f574f;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];config[_0x4d91('0x1b')]=_[_0x4d91('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d91('0x1d'))(new Redis(config[_0x4d91('0x1b')]));require(_0x4d91('0x1e'))[_0x4d91('0x1f')](socket);function respondWithStatusCode(_0x33fbd4,_0x25bafc){_0x25bafc=_0x25bafc||0xcc;return function(_0x36f606){if(_0x36f606){return _0x33fbd4['sendStatus'](_0x25bafc);}return _0x33fbd4[_0x4d91('0x20')](_0x25bafc)[_0x4d91('0x21')]();};}function respondWithResult(_0x1e2ef7,_0xb92681){_0xb92681=_0xb92681||0xc8;return function(_0x280e80){if(_0x280e80){return _0x1e2ef7['status'](_0xb92681)[_0x4d91('0x22')](_0x280e80);}};}function respondWithFilteredResult(_0xb75abf,_0x241564){return function(_0x44b9a7){if(_0x44b9a7){var _0x4cfa40=typeof _0x241564[_0x4d91('0x23')]===_0x4d91('0x24')&&typeof _0x241564[_0x4d91('0x25')]==='undefined';var _0x13ef2c=_0x44b9a7[_0x4d91('0x26')];var _0x351388=_0x4cfa40?0x0:_0x241564[_0x4d91('0x23')];var _0x10b767=_0x4cfa40?_0x44b9a7[_0x4d91('0x26')]:_0x241564[_0x4d91('0x23')]+_0x241564[_0x4d91('0x25')];var _0x30d911;if(_0x10b767>=_0x13ef2c){_0x10b767=_0x13ef2c;_0x30d911=0xc8;}else{_0x30d911=0xce;}_0xb75abf[_0x4d91('0x20')](_0x30d911);return _0xb75abf['set'](_0x4d91('0x27'),_0x351388+'-'+_0x10b767+'/'+_0x13ef2c)['json'](_0x44b9a7);}return null;};}function patchUpdates(_0x57913e){return function(_0x74a697){try{jsonpatch[_0x4d91('0x28')](_0x74a697,_0x57913e,!![]);}catch(_0x341d18){return BPromise[_0x4d91('0x29')](_0x341d18);}return _0x74a697[_0x4d91('0x2a')]();};}function saveUpdates(_0x12b722,_0x100cd4){return function(_0x123606){if(_0x123606){return _0x123606['update'](_0x12b722)['then'](function(_0x1ee6b3){return _0x1ee6b3;});}return null;};}function removeEntity(_0x112923,_0x3bed98){return function(_0x45fc91){if(_0x45fc91){return _0x45fc91[_0x4d91('0x2b')]()[_0x4d91('0x2c')](function(){var _0x14bdb4=_0x45fc91['get']({'plain':!![]});var _0x3dc353=_0x4d91('0x2d');return db[_0x4d91('0x2e')]['destroy']({'where':{'type':_0x3dc353,'resourceId':_0x14bdb4['id']}})['then'](function(){return _0x45fc91;});})[_0x4d91('0x2c')](function(){_0x112923[_0x4d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fe76,_0x42d5a0){return function(_0x2d6981){if(!_0x2d6981){_0x50fe76[_0x4d91('0x2f')](0x194);}return _0x2d6981;};}function handleError(_0x17c7bc,_0x4f23dd){_0x4f23dd=_0x4f23dd||0x1f4;return function(_0x2587a1){logger[_0x4d91('0x30')](_0x2587a1[_0x4d91('0x31')]);if(_0x2587a1[_0x4d91('0x32')]){delete _0x2587a1[_0x4d91('0x32')];}_0x17c7bc[_0x4d91('0x20')](_0x4f23dd)[_0x4d91('0x33')](_0x2587a1);};}exports['index']=function(_0x82f585,_0x4f44ff){var _0x4ad7bf={},_0x292808={},_0x3a2780={'count':0x0,'rows':[]};var _0x4f95f0=_[_0x4d91('0x34')](db[_0x4d91('0x35')][_0x4d91('0x36')],function(_0x2be3f5){return{'name':_0x2be3f5[_0x4d91('0x37')],'type':_0x2be3f5['type'][_0x4d91('0x38')]};});_0x292808[_0x4d91('0x39')]=_[_0x4d91('0x34')](_0x4f95f0,_0x4d91('0x32'));_0x292808[_0x4d91('0x3a')]=_[_0x4d91('0x3b')](_0x82f585['query']);_0x292808[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x292808['model'],_0x292808[_0x4d91('0x3a')]);_0x4ad7bf[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x292808['model'],qs[_0x4d91('0x3f')](_0x82f585[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x4ad7bf[_0x4d91('0x3e')]=_0x4ad7bf['attributes'][_0x4d91('0x40')]?_0x4ad7bf[_0x4d91('0x3e')]:_0x292808[_0x4d91('0x39')];if(!_0x82f585[_0x4d91('0x3a')]['hasOwnProperty']('nolimit')){_0x4ad7bf[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x82f585['query'][_0x4d91('0x25')]);_0x4ad7bf[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x82f585[_0x4d91('0x3a')]['offset']);}_0x4ad7bf[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x82f585['query'][_0x4d91('0x42')]);_0x4ad7bf['where']=qs[_0x4d91('0x3c')](_['pick'](_0x82f585[_0x4d91('0x3a')],_0x292808['filters']),_0x4f95f0);if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x4ad7bf[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x4ad7bf['where'],{'$or':_['map'](_0x4f95f0,function(_0x25e0f5){if(_0x25e0f5['type']!==_0x4d91('0x46')){var _0x282d64={};_0x282d64[_0x25e0f5['name']]={'$like':'%'+_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x282d64;}})});}_0x4ad7bf=_[_0x4d91('0x45')]({},_0x4ad7bf,_0x82f585[_0x4d91('0x47')]);var _0x1c6d0b={'where':_0x4ad7bf[_0x4d91('0x44')]};return db[_0x4d91('0x35')]['count'](_0x1c6d0b)[_0x4d91('0x2c')](function(_0x4c70af){_0x3a2780[_0x4d91('0x26')]=_0x4c70af;if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x4ad7bf[_0x4d91('0x49')]=[{'all':!![]}];}return db[_0x4d91('0x35')][_0x4d91('0x4a')](_0x4ad7bf);})['then'](function(_0x4ffc08){_0x3a2780[_0x4d91('0x4b')]=_0x4ffc08;return _0x3a2780;})[_0x4d91('0x2c')](respondWithFilteredResult(_0x4f44ff,_0x4ad7bf))['catch'](handleError(_0x4f44ff,null));};exports[_0x4d91('0x4c')]=function(_0x164658,_0x342de1){var _0x3f8659={'raw':![],'where':{'id':_0x164658[_0x4d91('0x4d')]['id']}},_0x31f21a={};_0x31f21a[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x35')]['rawAttributes']);_0x31f21a['query']=_[_0x4d91('0x3b')](_0x164658['query']);_0x31f21a[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x31f21a[_0x4d91('0x39')],_0x31f21a[_0x4d91('0x3a')]);_0x3f8659['attributes']=_[_0x4d91('0x3d')](_0x31f21a['model'],qs['fields'](_0x164658[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x3f8659[_0x4d91('0x3e')]=_0x3f8659[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x3f8659[_0x4d91('0x3e')]:_0x31f21a['model'];if(_0x164658[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x3f8659[_0x4d91('0x49')]=[{'all':!![]}];}_0x3f8659=_[_0x4d91('0x45')]({},_0x3f8659,_0x164658[_0x4d91('0x47')]);return db[_0x4d91('0x35')][_0x4d91('0x4e')](_0x3f8659)[_0x4d91('0x2c')](handleEntityNotFound(_0x342de1,null))[_0x4d91('0x2c')](respondWithResult(_0x342de1,null))[_0x4d91('0x4f')](handleError(_0x342de1,null));};exports[_0x4d91('0x2b')]=function(_0x5a67fa,_0xa5c630){return db['VoicePrefix'][_0x4d91('0x4e')]({'where':{'id':_0x5a67fa[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0xa5c630,null))[_0x4d91('0x2c')](removeEntity(_0xa5c630,null))[_0x4d91('0x4f')](handleError(_0xa5c630,null));};exports[_0x4d91('0x50')]=function(_0x3028b1,_0x22b341){return db['VoicePrefix'][_0x4d91('0x50')]()[_0x4d91('0x2c')](respondWithResult(_0x22b341,null))[_0x4d91('0x4f')](handleError(_0x22b341,null));};exports[_0x4d91('0x51')]=function(_0x26ecd7,_0x19e57e){var _0x5765ce;return db['sequelize'][_0x4d91('0x52')](function(_0x2159e4){return db[_0x4d91('0x35')][_0x4d91('0x51')](_0x26ecd7[_0x4d91('0x53')],{'transaction':_0x2159e4})[_0x4d91('0x2c')](function(_0x2875f4){_0x5765ce=_0x2875f4[_0x4d91('0x54')]({'plain':!![]});return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5765ce[_0x4d91('0x56')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x280c41){return createVoicePrefixExtensions(_0x5765ce,_0x280c41,_0x2159e4);});});})[_0x4d91('0x2c')](function(){var _0x3e9154=_0x26ecd7[_0x4d91('0x57')][_0x4d91('0x54')]({'plain':!![]});if(!_0x3e9154)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9154['role']==='user'){var _0x45cf4e=_0x5765ce;return db[_0x4d91('0x58')][_0x4d91('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9154[_0x4d91('0x59')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x3985f3){if(_0x3985f3&&_0x3985f3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45cf4e[_0x4d91('0x32')],'resourceId':_0x45cf4e['id'],'type':_0x3985f3[_0x4d91('0x32')],'sectionId':_0x3985f3['id']},{})[_0x4d91('0x2c')](function(){return _0x5765ce;});}else{return _0x5765ce;}})[_0x4d91('0x4f')](function(_0x31d6e5){logger['error'](_0x4d91('0x5a'),_0x31d6e5);throw _0x31d6e5;});}return _0x5765ce;})[_0x4d91('0x2c')](respondWithResult(_0x19e57e,null))['catch'](handleError(_0x19e57e,null));};function Extension(_0x563558,_0x3f4f24,_0x544711,_0x3fda50){this[_0x4d91('0x5b')]=_0x4d91('0x5c');this['exten']=_0x563558;this[_0x4d91('0x5d')]=_0x544711;this[_0x4d91('0x5e')]=_0x4d91('0x5f');this[_0x4d91('0x60')]=_0x4d91('0x61');this[_0x4d91('0x62')]=_0x3f4f24;this[_0x4d91('0x63')]=_0x3fda50;}function createVoicePrefixExtensions(_0x524b4f,_0x533572,_0x5eeba8){return new BPromise(function(_0x4bd66d,_0x83395){var _0x8d6db2=new Extension(formatPrefixName(_0x524b4f[_0x4d91('0x64')]),0x1,'NoOp',_0x4d91('0x65'));_0x8d6db2['VoicePrefixId']=_0x524b4f['id'];return db[_0x4d91('0x55')][_0x4d91('0x51')](_0x8d6db2,{'transaction':_0x5eeba8})['then'](function(_0x51a594){var _0x1a707f=_0x51a594[_0x4d91('0x54')]({'plain':!![]});var _0x31150f=_[_0x4d91('0x34')](addVoicePrefixExtensions(_0x524b4f,_0x533572),function(_0x24661a){_0x24661a[_0x4d91('0x56')]=_0x1a707f['id'];_0x24661a[_0x4d91('0x66')]=_0x524b4f['id'];return _0x24661a;});return db[_0x4d91('0x55')][_0x4d91('0x67')](_0x31150f,{'transaction':_0x5eeba8})[_0x4d91('0x2c')](function(_0x5bfb08){if(!_0x5bfb08){return _0x83395('Extensions\x20creation\x20failed');}else{return _0x4bd66d(_0x5bfb08);}})[_0x4d91('0x4f')](function(_0x7e26c2){return _0x83395(_0x7e26c2);});});;});};function addVoicePrefixExtensions(_0x2049ca,_0x13281d){var _0x16ba26=[];var _0x16d384=formatPrefixName(_0x2049ca[_0x4d91('0x64')]);_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x2,_0x4d91('0x69'),'CDR(prefix)='+_0x2049ca['name']));if(_0x2049ca['callerIdAll']){_0x16ba26['push'](new Extension(_0x16d384,0x3,_0x4d91('0x69'),_0x4d91('0x6a')+_0x2049ca[_0x4d91('0x6b')]));}else{_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x3,_0x4d91('0x6c'),_0x4d91('0x6d')));}_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x4,_0x4d91('0x6e'),_0x13281d[_0x4d91('0x5b')]+','+_0x4d91('0x6f')+(0x8+_0x2049ca[_0x4d91('0x32')][_0x4d91('0x40')])+'}'+','+0x1));return _0x16ba26;}function formatPrefixName(_0x4444a2){var _0xef787='_';for(var _0x3bc828=0x0;_0x3bc828<_0x4444a2[_0x4d91('0x40')];_0x3bc828++){if(_0x4444a2[_0x4d91('0x70')](_0x3bc828)=='-'){_0xef787+=_0x4444a2['charAt'](_0x3bc828);}else{_0xef787+='['+_0x4444a2[_0x4d91('0x70')](_0x3bc828)+']';}}_0xef787+='.';return _0xef787;}exports[_0x4d91('0x71')]=function(_0xc4ef10,_0x2e2105,_0x1cad5b){var _0x5ab447=_0xc4ef10[_0x4d91('0x53')];_0x5ab447[_0x4d91('0x64')]='system-'+_0x5ab447[_0x4d91('0x32')]+'-';return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0xa469a4){return db[_0x4d91('0x35')]['update'](_0x5ab447,{'where':{'id':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')]['destroy']({'where':{'VoicePrefixId':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5ab447['VoiceExtensionId']},'raw':!![]})[_0x4d91('0x2c')](function(_0x403e0c){return createVoicePrefixExtensions(_0x5ab447,_0x403e0c,_0xa469a4);});});});})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x35')][_0x4d91('0x73')](_0x5ab447['id']);})[_0x4d91('0x2c')](respondWithResult(_0x2e2105,null))[_0x4d91('0x4f')](handleError(_0x2e2105,null));};exports['addAgents']=function(_0xdbb484,_0x2e014b,_0x4e7994){return db[_0x4d91('0x35')]['find']({'where':{'id':_0xdbb484['params']['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x2e014b,null))['then'](function(_0x1a5376){if(_0x1a5376){return _0x1a5376[_0x4d91('0x74')](_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')],_[_0x4d91('0x76')](_0xdbb484[_0x4d91('0x53')],[_0x4d91('0x75'),'id'])||{})['spread'](function(_0x485da1){for(var _0x1c27e7=0x0;_0x1c27e7<_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')][_0x4d91('0x40')];_0x1c27e7+=0x1){socket[_0x4d91('0x77')]('userVoicePrefix:save',{'UserId':Number(_0xdbb484['body'][_0x4d91('0x75')][_0x1c27e7]),'VoicePrefixId':Number(_0xdbb484['params']['id'])});}return _0x485da1;});}})['then'](respondWithResult(_0x2e014b,null))[_0x4d91('0x4f')](handleError(_0x2e014b,null));};exports['removeAgents']=function(_0x585a8d,_0x216c33,_0x1b813c){return db[_0x4d91('0x35')]['find']({'where':{'id':_0x585a8d['params']['id']}})['then'](handleEntityNotFound(_0x216c33,null))[_0x4d91('0x2c')](function(_0x8d84f3){if(_0x8d84f3){return _0x8d84f3[_0x4d91('0x78')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])[_0x4d91('0x2c')](function(){if(_[_0x4d91('0x79')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])){for(var _0x542f58=0x0;_0x542f58<_0x585a8d[_0x4d91('0x3a')]['ids']['length'];_0x542f58+=0x1){socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')][_0x542f58]),'VoicePrefixId':Number(_0x585a8d['params']['id'])});}}else{socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')]),'VoicePrefixId':Number(_0x585a8d[_0x4d91('0x4d')]['id'])});}});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x216c33,null))[_0x4d91('0x4f')](handleError(_0x216c33,null));};exports['getAgents']=function(_0x28322e,_0x24376e,_0x7bc606){var _0x49d81c={};var _0xc37e2e={};var _0x45a628;var _0x2cf518;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x28322e[_0x4d91('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24376e,null))[_0x4d91('0x2c')](function(_0x582bee){if(_0x582bee){_0x45a628=_0x582bee;_0xc37e2e[_0x4d91('0x39')]=_['keys'](db[_0x4d91('0x7c')][_0x4d91('0x36')]);_0xc37e2e['query']=_['keys'](_0x28322e['query']);_0xc37e2e[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0xc37e2e[_0x4d91('0x39')],_0xc37e2e[_0x4d91('0x3a')]);_0x49d81c[_0x4d91('0x3e')]=_['intersection'](_0xc37e2e['model'],qs[_0x4d91('0x3f')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x49d81c[_0x4d91('0x3e')]=_0x49d81c[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x49d81c[_0x4d91('0x3e')]:_0xc37e2e['model'];_0x49d81c[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x49d81c[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x28322e[_0x4d91('0x3a')],_0xc37e2e[_0x4d91('0x3c')]));if(_0x28322e['query'][_0x4d91('0x43')]){_0x49d81c[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x49d81c[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x49d81c[_0x4d91('0x3e')],function(_0x4682a8){var _0x51a30d={};_0x51a30d[_0x4682a8]={'$like':'%'+_0x28322e[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x51a30d;})});}_0x49d81c=_['merge']({},_0x49d81c,_0x28322e[_0x4d91('0x47')]);return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})['then'](function(_0x22cd5a){if(_0x22cd5a){_0x2cf518=_0x22cd5a[_0x4d91('0x40')];if(!_0x28322e[_0x4d91('0x3a')][_0x4d91('0x7f')](_0x4d91('0x80'))){_0x49d81c[_0x4d91('0x25')]=qs['limit'](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x49d81c[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x28322e[_0x4d91('0x3a')]['offset']);}return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})[_0x4d91('0x2c')](function(_0x3b0ab3){if(_0x3b0ab3){return _0x3b0ab3?{'count':_0x2cf518,'rows':_0x3b0ab3}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x24376e,null))[_0x4d91('0x4f')](handleError(_0x24376e,null));};exports[_0x4d91('0x81')]=function(_0x18f844,_0x3e93d0,_0x53d973){var _0x367c30={};var _0x28b505={};var _0x451e14;var _0x37fe62;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x18f844[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x3e93d0,null))[_0x4d91('0x2c')](function(_0x5abc1d){if(_0x5abc1d){_0x451e14=_0x5abc1d;_0x28b505[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x82')][_0x4d91('0x36')]);_0x28b505['query']=_['keys'](_0x18f844[_0x4d91('0x3a')]);_0x28b505[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],_0x28b505['query']);_0x367c30[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],qs[_0x4d91('0x3f')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x367c30[_0x4d91('0x3e')]=_0x367c30[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x367c30['attributes']:_0x28b505[_0x4d91('0x39')];_0x367c30[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x367c30[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x18f844[_0x4d91('0x3a')],_0x28b505[_0x4d91('0x3c')]));if(_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x367c30['where']=_[_0x4d91('0x45')](_0x367c30[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x367c30[_0x4d91('0x3e')],function(_0x3e57a1){var _0x41fbc7={};_0x41fbc7[_0x3e57a1]={'$like':'%'+_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x41fbc7;})});}_0x367c30=_[_0x4d91('0x45')]({},_0x367c30,_0x18f844[_0x4d91('0x47')]);return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x5a241a){if(_0x5a241a){_0x37fe62=_0x5a241a['length'];if(!_0x18f844[_0x4d91('0x3a')]['hasOwnProperty'](_0x4d91('0x80'))){_0x367c30[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x367c30[_0x4d91('0x23')]=qs['offset'](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x23')]);}return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x1419c5){if(_0x1419c5){return _0x1419c5?{'count':_0x37fe62,'rows':_0x1419c5}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x3e93d0,null))[_0x4d91('0x4f')](handleError(_0x3e93d0,null));};exports[_0x4d91('0x83')]=function(_0x47cbca,_0x1df276,_0x3e2771){var _0x15d270=_0x47cbca[_0x4d91('0x53')][_0x4d91('0x75')];var _0x17e3bc;return db[_0x4d91('0x82')][_0x4d91('0x4a')]({'where':{'id':_0x15d270},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id','name',_0x4d91('0x85'),_0x4d91('0x86'),'interface'],'raw':!![]}]})[_0x4d91('0x2c')](function(_0x1f836b){if(_0x1f836b){_0x17e3bc=_0x1f836b;var _0x455dd6=_['flatMap'](_0x1f836b,function(_0x46ccf4){var _0xcc22a2=_0x46ccf4['get']({'plain':!![]});return _0xcc22a2['Agents'];});return db[_0x4d91('0x35')][_0x4d91('0x4e')]({'where':{'id':_0x47cbca[_0x4d91('0x4d')]['id']}})['then'](function(_0x352e84){return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0x3b2e36){return _0x352e84[_0x4d91('0x83')](_0x15d270,{'transaction':_0x3b2e36})[_0x4d91('0x2c')](function(){return BPromise[_0x4d91('0x87')](_0x17e3bc,function(_0x185ded){return db[_0x4d91('0x88')][_0x4d91('0x89')]({'TeamId':_0x185ded['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},{'transaction':_0x3b2e36});});})['then'](function(){return BPromise[_0x4d91('0x87')](_0x455dd6,function(_0x2a9069){return db[_0x4d91('0x8a')][_0x4d91('0x8b')]({'where':{'UserId':_0x2a9069['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},'transaction':_0x3b2e36});});})[_0x4d91('0x2c')](function(){_0x455dd6[_0x4d91('0x8c')](function(_0xb67bd3){socket[_0x4d91('0x77')](_0x4d91('0x8d'),{'UserId':_0xb67bd3['id'],'VoicePrefixId':_0x352e84['id']});});});});});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x1df276,null))[_0x4d91('0x4f')](handleError(_0x1df276,null));};exports[_0x4d91('0x8e')]=function(_0xbadba4,_0xe88619,_0x44f21b){return db[_0x4d91('0x82')]['findAll']({'where':{'id':_0xbadba4['query'][_0x4d91('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe88619,null))[_0x4d91('0x2c')](function(_0x2882d5){var _0x2678e7=_[_0x4d91('0x34')](_0x2882d5,'id');var _0x236a61=[];var _0x54f720=[];var _0x5f2ce4=squel['select']();_0x5f2ce4['field'](_0x4d91('0x8f'))[_0x4d91('0x90')]('team_has_voice_prefixes','tq')[_0x4d91('0x91')](_0x4d91('0x92'),'ut',_0x4d91('0x93'))['where'](_0x4d91('0x94'),_0xbadba4[_0x4d91('0x4d')]['id']);for(var _0x237074=0x0;_0x237074<_0x2882d5['length'];_0x237074+=0x1){let _0x3b4804=_0x2882d5[_0x237074];for(var _0x20212f=0x0;_0x20212f<_0x3b4804[_0x4d91('0x84')][_0x4d91('0x40')];_0x20212f+=0x1){let _0x39de93=_0x3b4804['Agents'][_0x20212f];var _0xe60b6=_0x5f2ce4[_0x4d91('0x95')]();_0xe60b6[_0x4d91('0x44')](_0x4d91('0x96'),_0x39de93['id']);_0x54f720['push'](db[_0x4d91('0x72')][_0x4d91('0x3a')](_0xe60b6[_0x4d91('0x97')](),{'type':db[_0x4d91('0x72')][_0x4d91('0x98')][_0x4d91('0x99')]})['then'](function(_0x12e226){if(_0x12e226[_0x4d91('0x40')]===0x1){return _0x39de93['id'];}else{var _0x448a12=_[_0x4d91('0x9a')](_[_0x4d91('0x34')](_0x12e226,_0x4d91('0x9b')),function(_0x2c5ccc){return _['includes'](_0x2678e7,_0x2c5ccc);});if(_0x448a12){return _0x39de93['id'];}}}));}}return BPromise['all'](_0x54f720)[_0x4d91('0x2c')](function(_0x4026b3){_0x236a61=_(_0x236a61)[_0x4d91('0x9c')](_0x4026b3)[_0x4d91('0x9d')]()[_0x4d91('0x9e')]();return db[_0x4d91('0x35')]['find']({'where':{'id':_0xbadba4[_0x4d91('0x4d')]['id']}})['then'](function(_0x3e23df){return db[_0x4d91('0x72')]['transaction'](function(_0x9d7ff1){return _0x3e23df[_0x4d91('0x8e')](_0xbadba4['query']['ids'],{'transaction':_0x9d7ff1})['then'](function(){if(!_[_0x4d91('0x9f')](_0x236a61)){return _0x3e23df['removeAgents'](_0x236a61,{'transaction':_0x9d7ff1});}})[_0x4d91('0x2c')](function(){_0x236a61[_0x4d91('0x8c')](function(_0x4da3b1){socket['emit'](_0x4d91('0x7a'),{'UserId':_0x4da3b1,'VoicePrefixId':_0x3e23df['id']});});});});});});})[_0x4d91('0x2c')](respondWithStatusCode(_0xe88619,null))[_0x4d91('0x4f')](handleError(_0xe88619,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 145864e..42d2385 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 _0x1bc5=['remove','emit','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x4028c7,_0x94e708){var _0x332311=function(_0x552579){while(--_0x552579){_0x4028c7['push'](_0x4028c7['shift']());}};_0x332311(++_0x94e708);}(_0x1bc5,0x1cf));var _0x51bc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x1bc5[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x51bc('0x0'))['db'][_0x51bc('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x51bc('0x2')](0x0);var events={'afterCreate':_0x51bc('0x3'),'afterUpdate':_0x51bc('0x4'),'afterDestroy':_0x51bc('0x5')};function emitEvent(_0x5ef3b3){return function(_0x130c9f,_0x2900a6,_0x1f80be){VoicePrefixEvents[_0x51bc('0x6')](_0x5ef3b3+':'+_0x130c9f['id'],_0x130c9f);VoicePrefixEvents[_0x51bc('0x6')](_0x5ef3b3,_0x130c9f);_0x1f80be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x51bc('0x7')](e,emitEvent(event));}}module[_0x51bc('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x89b7=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','save','update'];(function(_0x1440ac,_0x54b6d0){var _0x15ae9e=function(_0x4be8aa){while(--_0x4be8aa){_0x1440ac['push'](_0x1440ac['shift']());}};_0x15ae9e(++_0x54b6d0);}(_0x89b7,0x151));var _0x789b=function(_0x4ecbce,_0x290a94){_0x4ecbce=_0x4ecbce-0x0;var _0x5dda0d=_0x89b7[_0x4ecbce];return _0x5dda0d;};'use strict';var EventEmitter=require(_0x789b('0x0'));var VoicePrefix=require(_0x789b('0x1'))['db'][_0x789b('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x789b('0x3'),'afterUpdate':_0x789b('0x4'),'afterDestroy':_0x789b('0x5')};function emitEvent(_0x46f18f){return function(_0x42e343,_0x4c4ce9,_0x5255fa){VoicePrefixEvents[_0x789b('0x6')](_0x46f18f+':'+_0x42e343['id'],_0x42e343);VoicePrefixEvents['emit'](_0x46f18f,_0x42e343);_0x5255fa(null);};}for(var e in events){if(events[_0x789b('0x7')](e)){var event=events[e];VoicePrefix[_0x789b('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 07671ff..d76c5b6 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 _0x549a=['./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5a924a,_0x45688d){var _0x580d8b=function(_0x4c43f3){while(--_0x4c43f3){_0x5a924a['push'](_0x5a924a['shift']());}};_0x580d8b(++_0x45688d);}(_0x549a,0x93));var _0xa549=function(_0x52a946,_0x1aed25){_0x52a946=_0x52a946-0x0;var _0x3c03ea=_0x549a[_0x52a946];return _0x3c03ea;};'use strict';var _=require(_0xa549('0x0'));var util=require(_0xa549('0x1'));var logger=require(_0xa549('0x2'))(_0xa549('0x3'));var moment=require(_0xa549('0x4'));var BPromise=require(_0xa549('0x5'));var rp=require(_0xa549('0x6'));var fs=require('fs');var path=require(_0xa549('0x7'));var rimraf=require('rimraf');var config=require(_0xa549('0x8'));var attributes=require(_0xa549('0x9'));module[_0xa549('0xa')]=function(_0x454f37,_0xac7ac8){return _0x454f37[_0xa549('0xb')]('VoicePrefix',attributes,{'tableName':_0xa549('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ffd=['request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','util','api','moment','bluebird'];(function(_0x3ec501,_0x1d035a){var _0x5a3037=function(_0x383d66){while(--_0x383d66){_0x3ec501['push'](_0x3ec501['shift']());}};_0x5a3037(++_0x1d035a);}(_0x6ffd,0xf9));var _0xd6ff=function(_0x48dc9f,_0x3d5926){_0x48dc9f=_0x48dc9f-0x0;var _0x354587=_0x6ffd[_0x48dc9f];return _0x354587;};'use strict';var _=require('lodash');var util=require(_0xd6ff('0x0'));var logger=require('../../config/logger')(_0xd6ff('0x1'));var moment=require(_0xd6ff('0x2'));var BPromise=require(_0xd6ff('0x3'));var rp=require(_0xd6ff('0x4'));var fs=require('fs');var path=require(_0xd6ff('0x5'));var rimraf=require('rimraf');var config=require(_0xd6ff('0x6'));var attributes=require(_0xd6ff('0x7'));module['exports']=function(_0x1819e8,_0x1858a5){return _0x1819e8[_0xd6ff('0x8')](_0xd6ff('0x9'),attributes,{'tableName':_0xd6ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index a2629ba..d091d06 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 _0x6822=['./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x3756bf,_0x5d83c6){var _0x535e69=function(_0x4d599d){while(--_0x4d599d){_0x3756bf['push'](_0x3756bf['shift']());}};_0x535e69(++_0x5d83c6);}(_0x6822,0xca));var _0x2682=function(_0x11ab57,_0x242f42){_0x11ab57=_0x11ab57-0x0;var _0x374ab2=_0x6822[_0x11ab57];return _0x374ab2;};'use strict';var _=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var moment=require(_0x2682('0x2'));var BPromise=require(_0x2682('0x3'));var rs=require(_0x2682('0x4'));var fs=require('fs');var Redis=require(_0x2682('0x5'));var db=require(_0x2682('0x6'))['db'];var utils=require(_0x2682('0x7'));var logger=require(_0x2682('0x8'))('rpc');var config=require(_0x2682('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});config[_0x2682('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2682('0xd'))(new Redis(config[_0x2682('0xc')]));require(_0x2682('0xe'))[_0x2682('0xf')](socket);function respondWithRpcPromise(_0x4b484e,_0xc33e58,_0x42b955){return new BPromise(function(_0x18b9ec,_0xfa8115){return client['request'](_0x4b484e,_0x42b955)[_0x2682('0x10')](function(_0x1631f4){logger[_0x2682('0x11')](_0x2682('0x12'),_0xc33e58,'request\x20sent');logger[_0x2682('0x13')](_0x2682('0x14'),_0xc33e58,_0x2682('0x15'),JSON[_0x2682('0x16')](_0x1631f4));if(_0x1631f4[_0x2682('0x17')]){if(_0x1631f4['error'][_0x2682('0x18')]===0x1f4){logger[_0x2682('0x17')](_0x2682('0x12'),_0xc33e58,_0x1631f4[_0x2682('0x17')][_0x2682('0x19')]);return _0xfa8115(_0x1631f4['error'][_0x2682('0x19')]);}logger['error'](_0x2682('0x12'),_0xc33e58,_0x1631f4['error'][_0x2682('0x19')]);return _0x18b9ec(_0x1631f4[_0x2682('0x17')][_0x2682('0x19')]);}else{logger['info'](_0x2682('0x12'),_0xc33e58,_0x2682('0x15'));_0x18b9ec(_0x1631f4[_0x2682('0x1a')][_0x2682('0x19')]);}})['catch'](function(_0xce7bd2){logger['error'](_0x2682('0x12'),_0xc33e58,_0xce7bd2);_0xfa8115(_0xce7bd2);});});} \ No newline at end of file +var _0xb296=['defaults','localhost','./voicePrefix.socket','register','then','info','request\x20sent','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x54d0b8,_0x31b232){var _0x502c5c=function(_0x9fab4f){while(--_0x9fab4f){_0x54d0b8['push'](_0x54d0b8['shift']());}};_0x502c5c(++_0x31b232);}(_0xb296,0xa3));var _0x6b29=function(_0x51b628,_0x397dde){_0x51b628=_0x51b628-0x0;var _0x39f639=_0xb296[_0x51b628];return _0x39f639;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var moment=require(_0x6b29('0x2'));var BPromise=require(_0x6b29('0x3'));var rs=require(_0x6b29('0x4'));var fs=require('fs');var Redis=require(_0x6b29('0x5'));var db=require(_0x6b29('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b29('0x7'))('rpc');var config=require(_0x6b29('0x8'));var jayson=require(_0x6b29('0x9'));var client=jayson['client'][_0x6b29('0xa')]({'port':0x232a});config[_0x6b29('0xb')]=_[_0x6b29('0xc')](config[_0x6b29('0xb')],{'host':_0x6b29('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b29('0xb')]));require(_0x6b29('0xe'))[_0x6b29('0xf')](socket);function respondWithRpcPromise(_0x39d65c,_0x1eb87c,_0x3c6e6f){return new BPromise(function(_0x2c2823,_0x3ece8b){return client['request'](_0x39d65c,_0x3c6e6f)[_0x6b29('0x10')](function(_0x754be9){logger[_0x6b29('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'),JSON['stringify'](_0x754be9));if(_0x754be9['error']){if(_0x754be9[_0x6b29('0x13')][_0x6b29('0x14')]===0x1f4){logger['error'](_0x6b29('0x15'),_0x1eb87c,_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);return _0x3ece8b(_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);}logger[_0x6b29('0x13')](_0x6b29('0x15'),_0x1eb87c,_0x754be9['error'][_0x6b29('0x16')]);return _0x2c2823(_0x754be9[_0x6b29('0x13')][_0x6b29('0x16')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1eb87c,_0x6b29('0x12'));_0x2c2823(_0x754be9[_0x6b29('0x17')][_0x6b29('0x16')]);}})[_0x6b29('0x18')](function(_0x18b4c8){logger[_0x6b29('0x13')](_0x6b29('0x15'),_0x1eb87c,_0x18b4c8);_0x3ece8b(_0x18b4c8);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7c7a85a..ed4d453 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 _0x89e8=['emit','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x123c2e,_0x310018){var _0xf929a8=function(_0x57590d){while(--_0x57590d){_0x123c2e['push'](_0x123c2e['shift']());}};_0xf929a8(++_0x310018);}(_0x89e8,0x74));var _0x889e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x89e8[_0x5b644e];return _0x49c6bf;};'use strict';var VoicePrefixEvents=require(_0x889e('0x0'));var events=[_0x889e('0x1'),_0x889e('0x2'),_0x889e('0x3')];function createListener(_0x35d770,_0x2a8b6d){return function(_0xfe71bf){_0x2a8b6d[_0x889e('0x4')](_0x35d770,_0xfe71bf);};}function removeListener(_0x4a8a0a,_0x58ac1e){return function(){VoicePrefixEvents['removeListener'](_0x4a8a0a,_0x58ac1e);};}exports[_0x889e('0x5')]=function(_0x293daf){for(var _0x25f9e2=0x0,_0x5ed85f=events[_0x889e('0x6')];_0x25f9e2<_0x5ed85f;_0x25f9e2++){var _0x54f734=events[_0x25f9e2];var _0x2bfae4=createListener(_0x889e('0x7')+_0x54f734,_0x293daf);VoicePrefixEvents['on'](_0x54f734,_0x2bfae4);}}; \ No newline at end of file +var _0x803f=['length','voicePrefix:','./voicePrefix.events','remove','update','emit','register'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x803f,0x64));var _0xf803=function(_0x151a06,_0x52023e){_0x151a06=_0x151a06-0x0;var _0x490e7a=_0x803f[_0x151a06];return _0x490e7a;};'use strict';var VoicePrefixEvents=require(_0xf803('0x0'));var events=['save',_0xf803('0x1'),_0xf803('0x2')];function createListener(_0x4ce875,_0x1a8691){return function(_0x43fb3b){_0x1a8691[_0xf803('0x3')](_0x4ce875,_0x43fb3b);};}function removeListener(_0x6baafe,_0x5c2cd6){return function(){VoicePrefixEvents['removeListener'](_0x6baafe,_0x5c2cd6);};}exports[_0xf803('0x4')]=function(_0x2ba12f){for(var _0x1d3a79=0x0,_0x584b2d=events[_0xf803('0x5')];_0x1d3a79<_0x584b2d;_0x1d3a79++){var _0x47128f=events[_0x1d3a79];var _0x587319=createListener(_0xf803('0x6')+_0x47128f,_0x2ba12f);VoicePrefixEvents['on'](_0x47128f,_0x587319);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f3eb318..0f6d08c 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b3463,_0x43e1f5){_0x1b3463=_0x1b3463-0x0;var _0x29d544=_0xb10b[_0x1b3463];return _0x29d544;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x321f48,_0x407eed){var _0x400e26=function(_0x13c76c){while(--_0x13c76c){_0x321f48['push'](_0x321f48['shift']());}};_0x400e26(++_0x407eed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 8490685..aab9e0a 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 _0x1347=['join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','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.','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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','mandatoryDisposition','exports','STRING','name','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','ENUM','yes','all','once','TEXT','periodic_announce','split'];(function(_0x5b5a6a,_0x4f29d7){var _0x275b50=function(_0x1b9447){while(--_0x1b9447){_0x5b5a6a['push'](_0x5b5a6a['shift']());}};_0x275b50(++_0x4f29d7);}(_0x1347,0x1c7));var _0x7134=function(_0x3b3489,_0x1da252){_0x3b3489=_0x3b3489-0x0;var _0x2a70a3=_0x1347[_0x3b3489];return _0x2a70a3;};'use strict';var Sequelize=require('sequelize');module[_0x7134('0x0')]={'name':{'type':Sequelize[_0x7134('0x1')],'allowNull':![],'unique':_0x7134('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7134('0x3'),_0x7134('0x4')),'allowNull':![],'defaultValue':_0x7134('0x3')},'musiconhold':{'type':Sequelize[_0x7134('0x1')],'defaultValue':_0x7134('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x7134('0x6'),_0x7134('0x7'),_0x7134('0x8'),_0x7134('0x9'),_0x7134('0xa'),'linear',_0x7134('0xb'),_0x7134('0xc')),'allowNull':![],'defaultValue':_0x7134('0x6'),'set':function(_0x245b71){this[_0x7134('0xd')](_0x7134('0xe'),_0x245b71?_0x245b71:_0x7134('0xa'));},'get':function(){var _0x406972=this[_0x7134('0xf')](_0x7134('0x10'));var _0x2aea24=this['getDataValue'](_0x7134('0x11'));var _0x17c15c=this[_0x7134('0xf')]('strategy');if(_0x406972===_0x7134('0x3')){return _0x17c15c;}if(_0x2aea24==='booked'&&_0x17c15c==='rrmemory'||_0x2aea24===_0x7134('0x12')&&_0x17c15c===_0x7134('0x13')){return _0x17c15c;}if(_0x2aea24===_0x7134('0x14')||_0x2aea24===_0x7134('0x15')||_0x2aea24===_0x7134('0x16')){return _0x17c15c;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7134('0x17')](0xb)},'timeout':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7134('0x1')]},'weight':{'type':Sequelize[_0x7134('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':_0x7134('0x19')},'autopause':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no',_0x7134('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7134('0x18')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x7134('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7134('0x18')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7134('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7134('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7134('0x18')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7134('0x19')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7134('0x19'),'no',_0x7134('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7134('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x7134('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7134('0x1')]},'queue_youarenext':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7134('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7134('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x7134('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x7134('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x7134('0x1c')],'set':function(_0x463196){this['setDataValue']('periodic_announce',_0x463196?_0x463196['join'](','):[]);},'get':function(){return this[_0x7134('0xf')](_0x7134('0x1d'))?this['getDataValue'](_0x7134('0x1d'))[_0x7134('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x7134('0x1')],'defaultValue':_0x7134('0x19'),'set':function(_0x3c1bab){this[_0x7134('0xd')]('joinempty',_0x3c1bab?_0x3c1bab[_0x7134('0x1f')](','):undefined);},'get':function(){return this['getDataValue'](_0x7134('0x20'))?this[_0x7134('0xf')](_0x7134('0x20'))[_0x7134('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7134('0x1')],'defaultValue':'no','set':function(_0x23faf4){this[_0x7134('0xd')](_0x7134('0x21'),_0x23faf4?_0x23faf4['join'](','):undefined);},'get':function(){return this[_0x7134('0xf')](_0x7134('0x21'))?this[_0x7134('0xf')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7134('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x7134('0x22')],'defaultValue':0x0,'set':function(_0x3c8aef){this[_0x7134('0xd')](_0x7134('0x23'),_0x3c8aef);if(_0x3c8aef){if(this['getDataValue'](_0x7134('0x24'))<0x2){this['setDataValue'](_0x7134('0x24'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7134('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7134('0x22')],'defaultValue':0x0,'comment':_0x7134('0x25')},'dialMethod':{'type':Sequelize[_0x7134('0x18')]('preview',_0x7134('0x14'),_0x7134('0x16'),_0x7134('0x15'),_0x7134('0x12')),'defaultValue':_0x7134('0x14'),'comment':_0x7134('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x7134('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x7134('0x17')](0x4)[_0x7134('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7134('0x28')},'dialPowerLevel':{'type':Sequelize[_0x7134('0x29')](0x2)[_0x7134('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7134('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x2b'),_0x7134('0x2c')),'defaultValue':'dropRate','comment':_0x7134('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7134('0x29')](0x2)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x7134('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7134('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7134('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x7134('0x1')],'defaultValue':_0x7134('0x2e'),'comment':_0x7134('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x30')},'dialQueueProject':{'type':Sequelize[_0x7134('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7134('0x17')](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x3,'comment':_0x7134('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x7134('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7134('0x1')],'defaultValue':_0x7134('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x35'),_0x7134('0x36'),_0x7134('0x37')),'defaultValue':_0x7134('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7134('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7134('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x7134('0x17')](0x9)[_0x7134('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7134('0x17')](0x9)[_0x7134('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7134('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7134('0x17')](0x9)[_0x7134('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7134('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x7134('0x17')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7134('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7134('0x17')](0x9)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7134('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x7134('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7134('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7134('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7134('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x7134('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7134('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7134('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7134('0x18')](_0x7134('0x41'),'ASC'),'defaultValue':_0x7134('0x41')},'dialQueueProject2':{'type':Sequelize[_0x7134('0x1')],'comment':_0x7134('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7134('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7134('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7134('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7134('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x7134('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7134('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7134('0x17')](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7134('0x17')](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7134('0x17')](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7134('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7134('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7134('0x17')](0x5)[_0x7134('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7134('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7134('0x17')],'allowNull':!![],'comment':_0x7134('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x7134('0x22')],'defaultValue':![],'comment':_0x7134('0x4f'),'set':function(_0x3847d4){if(!_0x3847d4)this[_0x7134('0xd')]('mandatoryDispositionPauseId',null);this[_0x7134('0xd')](_0x7134('0x50'),_0x3847d4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7134('0x17')](0x3)[_0x7134('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7134('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7134('0x17')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7134('0x22')],'defaultValue':![]}}; \ No newline at end of file +var _0xdc1d=['sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','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)','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,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xdc1d,0x172));var _0xddc1=function(_0x540d0b,_0x15a876){_0x540d0b=_0x540d0b-0x0;var _0x87a0c8=_0xdc1d[_0x540d0b];return _0x87a0c8;};'use strict';var Sequelize=require(_0xddc1('0x0'));module['exports']={'name':{'type':Sequelize[_0xddc1('0x1')],'allowNull':![],'unique':_0xddc1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x4'),_0xddc1('0x5')),'allowNull':![],'defaultValue':_0xddc1('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xddc1('0x6')},'announce':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xddc1('0x3')]('rr',_0xddc1('0x7'),_0xddc1('0x8'),_0xddc1('0x9'),_0xddc1('0xa'),_0xddc1('0xb'),'linear',_0xddc1('0xc'),_0xddc1('0xd')),'allowNull':![],'defaultValue':_0xddc1('0x7'),'set':function(_0x3e426b){this[_0xddc1('0xe')](_0xddc1('0xf'),_0x3e426b?_0x3e426b:_0xddc1('0xb'));},'get':function(){var _0xcb5d5=this[_0xddc1('0x10')](_0xddc1('0x11'));var _0x3f66f5=this['getDataValue'](_0xddc1('0x12'));var _0x56bd13=this[_0xddc1('0x10')]('strategy');if(_0xcb5d5===_0xddc1('0x4')){return _0x56bd13;}if(_0x3f66f5==='booked'&&_0x56bd13===_0xddc1('0xb')||_0x3f66f5===_0xddc1('0x13')&&_0x56bd13===_0xddc1('0x14')){return _0x56bd13;}if(_0x3f66f5===_0xddc1('0x15')||_0x3f66f5===_0xddc1('0x16')||_0x3f66f5===_0xddc1('0x17')){return _0x56bd13;}return null;}},'servicelevel':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xddc1('0x18')](0xb)},'timeout':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xddc1('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no'),'defaultValue':_0xddc1('0x19')},'autopause':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no',_0xddc1('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xddc1('0x18')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xddc1('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xddc1('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xddc1('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xddc1('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xddc1('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xddc1('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no'),'defaultValue':_0xddc1('0x19')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xddc1('0x19'),'no',_0xddc1('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0xddc1('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xddc1('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xddc1('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xddc1('0x1')]},'queue_quantity1':{'type':Sequelize[_0xddc1('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xddc1('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x16050e){this[_0xddc1('0xe')](_0xddc1('0x1c'),_0x16050e?_0x16050e[_0xddc1('0x1d')](','):[]);},'get':function(){return this[_0xddc1('0x10')]('periodic_announce')?this[_0xddc1('0x10')]('periodic_announce')[_0xddc1('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xddc1('0x19'),'set':function(_0x5cb95f){this[_0xddc1('0xe')](_0xddc1('0x1f'),_0x5cb95f?_0x5cb95f[_0xddc1('0x1d')](','):undefined);},'get':function(){return this[_0xddc1('0x10')](_0xddc1('0x1f'))?this['getDataValue'](_0xddc1('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4868dc){this['setDataValue']('leavewhenempty',_0x4868dc?_0x4868dc[_0xddc1('0x1d')](','):undefined);},'get':function(){return this[_0xddc1('0x10')]('leavewhenempty')?this[_0xddc1('0x10')](_0xddc1('0x20'))[_0xddc1('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xddc1('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xddc1('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xddc1('0x1')]},'acw':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':0x0,'set':function(_0x453ca5){this['setDataValue']('acw',_0x453ca5);if(_0x453ca5){if(this[_0xddc1('0x10')](_0xddc1('0x22'))<0x2){this[_0xddc1('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xddc1('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xddc1('0x23')},'dialMethod':{'type':Sequelize[_0xddc1('0x3')]('preview',_0xddc1('0x15'),_0xddc1('0x17'),_0xddc1('0x16'),_0xddc1('0x13')),'defaultValue':_0xddc1('0x15'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xddc1('0x18')](0x4)[_0xddc1('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xddc1('0x25')},'dialLimitQueue':{'type':Sequelize[_0xddc1('0x18')](0x4)[_0xddc1('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xddc1('0x26')](0x2)[_0xddc1('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x27'),_0xddc1('0x28')),'defaultValue':_0xddc1('0x28'),'comment':_0xddc1('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xddc1('0x26')](0x2)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xddc1('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xddc1('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xddc1('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xddc1('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xddc1('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x2e')},'dialQueueProject':{'type':Sequelize[_0xddc1('0x1')],'comment':_0xddc1('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xddc1('0x18')](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc1('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc1('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xddc1('0x33')},'dialTimezone':{'type':Sequelize[_0xddc1('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x34'),_0xddc1('0x35'),_0xddc1('0x36')),'defaultValue':_0xddc1('0x34')},'dialAMDActive':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':0x0,'comment':_0xddc1('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0xddc1('0x18')](0x9)[_0xddc1('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xddc1('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xddc1('0x18')](0x9)[_0xddc1('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xddc1('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xddc1('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xddc1('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xddc1('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xddc1('0x18')](0x9)[_0xddc1('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xddc1('0x18')](0x9)[_0xddc1('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xddc1('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xddc1('0x18')](0x9)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xddc1('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xddc1('0x18')](0x5)[_0xddc1('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xddc1('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xddc1('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xddc1('0x18')](0x5)[_0xddc1('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xddc1('0x3')](_0xddc1('0x3e'),_0xddc1('0x3f')),'defaultValue':_0xddc1('0x3e')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xddc1('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc1('0x40')},'dialCutDigit':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddc1('0x41')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xddc1('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xddc1('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc1('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0xddc1('0x18')](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc1('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddc1('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xddc1('0x18')](0x5)[_0xddc1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddc1('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xddc1('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':![],'comment':_0xddc1('0x49'),'set':function(_0x343e25){if(!_0x343e25)this[_0xddc1('0xe')]('mandatoryDispositionPauseId',null);this[_0xddc1('0xe')]('mandatoryDisposition',_0x343e25);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xddc1('0x18')](0x3)[_0xddc1('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xddc1('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 322ee2a..18d759b 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 _0xf105=['userVoiceQueue:remove','addAgents','ids','omit','spread','userVoiceQueue:save','isEmpty','isNil','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ContactId','ListId','phone','scheduledAt','CmListId','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','insert','cm_hopper_additional_phones','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./voiceQueue.socket','end','status','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','find','type','name','UserProfileResource','sendStatus','error','stack','send','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','findOne','nolimit','pick','CmHopper','getHopperHistories','CmHopperHistory','order','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','online','voicePause','interface','forEach','penalty','Agents','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','format','SIP/%s','emit','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact'];(function(_0x2abb65,_0x1027d2){var _0x9e9f3e=function(_0x3b2473){while(--_0x3b2473){_0x2abb65['push'](_0x2abb65['shift']());}};_0x9e9f3e(++_0x1027d2);}(_0xf105,0x1b0));var _0x5f10=function(_0x46ac1d,_0x5ae81f){_0x46ac1d=_0x46ac1d-0x0;var _0x41dce0=_0xf105[_0x46ac1d];return _0x41dce0;};'use strict';var emlformat=require(_0x5f10('0x0'));var rimraf=require(_0x5f10('0x1'));var zipdir=require(_0x5f10('0x2'));var jsonpatch=require(_0x5f10('0x3'));var rp=require(_0x5f10('0x4'));var moment=require(_0x5f10('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5f10('0x6'));var util=require('util');var path=require(_0x5f10('0x7'));var sox=require(_0x5f10('0x8'));var csv=require(_0x5f10('0x9'));var ejs=require(_0x5f10('0xa'));var fs=require('fs');var fs_extra=require(_0x5f10('0xb'));var _=require(_0x5f10('0xc'));var squel=require(_0x5f10('0xd'));var crypto=require(_0x5f10('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5f10('0xf'));var toCsv=require(_0x5f10('0x9'));var querystring=require(_0x5f10('0x10'));var Papa=require(_0x5f10('0x11'));var Redis=require(_0x5f10('0x12'));var authService=require(_0x5f10('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5f10('0x14'));var hardwareService=require(_0x5f10('0x15'));var logger=require(_0x5f10('0x16'))(_0x5f10('0x17'));var utils=require(_0x5f10('0x18'));var config=require(_0x5f10('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f10('0x1a'))['db'];config[_0x5f10('0x1b')]=_[_0x5f10('0x1c')](config[_0x5f10('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f10('0x1b')]));require(_0x5f10('0x1d'))['register'](socket);function respondWithStatusCode(_0x508aaa,_0x197ed4){_0x197ed4=_0x197ed4||0xcc;return function(_0x4ffa6a){if(_0x4ffa6a){return _0x508aaa['sendStatus'](_0x197ed4);}return _0x508aaa['status'](_0x197ed4)[_0x5f10('0x1e')]();};}function respondWithResult(_0x93fed1,_0x47d307){_0x47d307=_0x47d307||0xc8;return function(_0x369a23){if(_0x369a23){return _0x93fed1[_0x5f10('0x1f')](_0x47d307)['json'](_0x369a23);}};}function respondWithFilteredResult(_0x35cb24,_0x206bd2){return function(_0x25d01b){if(_0x25d01b){var _0x1cf554=typeof _0x206bd2['offset']==='undefined'&&typeof _0x206bd2[_0x5f10('0x20')]===_0x5f10('0x21');var _0x1ca208=_0x25d01b['count'];var _0x1a5ac4=_0x1cf554?0x0:_0x206bd2[_0x5f10('0x22')];var _0x4e7cf1=_0x1cf554?_0x25d01b[_0x5f10('0x23')]:_0x206bd2['offset']+_0x206bd2[_0x5f10('0x20')];var _0x1e536b;if(_0x4e7cf1>=_0x1ca208){_0x4e7cf1=_0x1ca208;_0x1e536b=0xc8;}else{_0x1e536b=0xce;}_0x35cb24[_0x5f10('0x1f')](_0x1e536b);return _0x35cb24[_0x5f10('0x24')](_0x5f10('0x25'),_0x1a5ac4+'-'+_0x4e7cf1+'/'+_0x1ca208)['json'](_0x25d01b);}return null;};}function patchUpdates(_0x5407a6){return function(_0x515a67){try{jsonpatch[_0x5f10('0x26')](_0x515a67,_0x5407a6,!![]);}catch(_0x6c4056){return BPromise[_0x5f10('0x27')](_0x6c4056);}return _0x515a67[_0x5f10('0x28')]();};}function saveUpdates(_0x4ac05d,_0x3aa6a3){return function(_0x3a0e83){if(_0x3a0e83){return _0x3a0e83[_0x5f10('0x29')](_0x4ac05d)[_0x5f10('0x2a')](function(_0x577569){return _0x577569;});}return null;};}function removeEntity(_0x5f3889,_0x363e84){return function(_0x3bb62f){if(_0x3bb62f){return _0x3bb62f[_0x5f10('0x2b')]()[_0x5f10('0x2a')](function(){var _0x42f009=_0x3bb62f[_0x5f10('0x2c')]({'plain':!![]});var _0x422c17=[{'name':_0x5f10('0x2d'),'value':_0x5f10('0x2e'),'ignore':![]},{'name':_0x5f10('0x2f'),'value':_0x5f10('0x30'),'ignore':![]}];var _0x42693d=_(_0x422c17)[_0x5f10('0x31')](_0x5f10('0x32'))[_0x5f10('0x33')]('value')[_0x5f10('0x34')]();if(_[_0x5f10('0x35')](_0x42693d,_0x42f009['type'])){return;}var _0x158cd2=_[_0x5f10('0x36')](_0x422c17,[_0x5f10('0x34'),_0x42f009[_0x5f10('0x37')]])[_0x5f10('0x38')];return db[_0x5f10('0x39')]['destroy']({'where':{'type':_0x158cd2,'resourceId':_0x42f009['id']}})['then'](function(){return _0x3bb62f;});})[_0x5f10('0x2a')](function(){_0x5f3889[_0x5f10('0x1f')](0xcc)[_0x5f10('0x1e')]();});}};}function handleEntityNotFound(_0x5c54fb,_0x5e6364){return function(_0x471bcd){if(!_0x471bcd){_0x5c54fb[_0x5f10('0x3a')](0x194);}return _0x471bcd;};}function handleError(_0x3266c3,_0x5553e6){_0x5553e6=_0x5553e6||0x1f4;return function(_0x355c64){logger[_0x5f10('0x3b')](_0x355c64[_0x5f10('0x3c')]);if(_0x355c64[_0x5f10('0x38')]){delete _0x355c64[_0x5f10('0x38')];}_0x3266c3[_0x5f10('0x1f')](_0x5553e6)[_0x5f10('0x3d')](_0x355c64);};}exports['index']=function(_0x15b98a,_0x12f919){var _0x1946a7={},_0xbae146={},_0x58101f={'count':0x0,'rows':[]};var _0x5c361a=_[_0x5f10('0x33')](db[_0x5f10('0x3e')][_0x5f10('0x3f')],function(_0xff5f26){return{'name':_0xff5f26[_0x5f10('0x40')],'type':_0xff5f26[_0x5f10('0x37')]['key']};});_0xbae146['model']=_[_0x5f10('0x33')](_0x5c361a,_0x5f10('0x38'));_0xbae146[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x15b98a[_0x5f10('0x41')]);_0xbae146[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0xbae146[_0x5f10('0x45')],_0xbae146[_0x5f10('0x41')]);_0x1946a7[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0xbae146[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x15b98a[_0x5f10('0x41')][_0x5f10('0x47')]));_0x1946a7[_0x5f10('0x46')]=_0x1946a7[_0x5f10('0x46')][_0x5f10('0x48')]?_0x1946a7[_0x5f10('0x46')]:_0xbae146[_0x5f10('0x45')];if(!_0x15b98a[_0x5f10('0x41')][_0x5f10('0x49')]('nolimit')){_0x1946a7[_0x5f10('0x20')]=qs[_0x5f10('0x20')](_0x15b98a[_0x5f10('0x41')][_0x5f10('0x20')]);_0x1946a7[_0x5f10('0x22')]=qs['offset'](_0x15b98a[_0x5f10('0x41')][_0x5f10('0x22')]);}_0x1946a7['order']=qs['sort'](_0x15b98a[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x1946a7[_0x5f10('0x4b')]=qs['filters'](_['pick'](_0x15b98a[_0x5f10('0x41')],_0xbae146[_0x5f10('0x43')]),_0x5c361a);if(_0x15b98a[_0x5f10('0x41')][_0x5f10('0x31')]){_0x1946a7['where']=_['merge'](_0x1946a7[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x5c361a,function(_0x37fdb9){if(_0x37fdb9['type']!==_0x5f10('0x4c')){var _0x254f65={};_0x254f65[_0x37fdb9[_0x5f10('0x38')]]={'$like':'%'+_0x15b98a[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x254f65;}})});}_0x1946a7=_['merge']({},_0x1946a7,_0x15b98a['options']);var _0x495de5={'where':_0x1946a7['where']};return db[_0x5f10('0x3e')][_0x5f10('0x23')](_0x495de5)[_0x5f10('0x2a')](function(_0x5ec626){_0x58101f[_0x5f10('0x23')]=_0x5ec626;if(_0x15b98a['query']['includeAll']){_0x1946a7[_0x5f10('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x5f10('0x4e')](_0x1946a7);})['then'](function(_0x38cec3){_0x58101f[_0x5f10('0x4f')]=_0x38cec3;return _0x58101f;})[_0x5f10('0x2a')](respondWithFilteredResult(_0x12f919,_0x1946a7))[_0x5f10('0x50')](handleError(_0x12f919,null));};exports['show']=function(_0xd2548,_0x14c0a9){var _0x50bc5f={'raw':![],'where':{'id':_0xd2548[_0x5f10('0x51')]['id']}},_0x3d7cf6={};_0x3d7cf6[_0x5f10('0x45')]=_[_0x5f10('0x42')](db[_0x5f10('0x3e')][_0x5f10('0x3f')]);_0x3d7cf6[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0xd2548[_0x5f10('0x41')]);_0x3d7cf6[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x3d7cf6[_0x5f10('0x45')],_0x3d7cf6[_0x5f10('0x41')]);_0x50bc5f[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x3d7cf6[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0xd2548['query'][_0x5f10('0x47')]));_0x50bc5f['attributes']=_0x50bc5f[_0x5f10('0x46')][_0x5f10('0x48')]?_0x50bc5f[_0x5f10('0x46')]:_0x3d7cf6['model'];if(_0xd2548[_0x5f10('0x41')][_0x5f10('0x52')]){_0x50bc5f[_0x5f10('0x4d')]=[{'all':!![]}];}_0x50bc5f=_['merge']({},_0x50bc5f,_0xd2548[_0x5f10('0x53')]);return db[_0x5f10('0x3e')]['find'](_0x50bc5f)['then'](handleEntityNotFound(_0x14c0a9,null))[_0x5f10('0x2a')](respondWithResult(_0x14c0a9,null))[_0x5f10('0x50')](handleError(_0x14c0a9,null));};exports[_0x5f10('0x54')]=function(_0x5e34a1,_0x35db71){return db['VoiceQueue']['create'](_0x5e34a1[_0x5f10('0x55')],{})[_0x5f10('0x2a')](function(_0xdf6b17){var _0x1181d0=_0x5e34a1[_0x5f10('0x56')]['get']({'plain':!![]});if(!_0x1181d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1181d0['role']==='user'){var _0x392ec3=_0xdf6b17[_0x5f10('0x2c')]({'plain':!![]});var _0x57bae1=[{'name':_0x5f10('0x2d'),'value':_0x5f10('0x2e')},{'name':_0x5f10('0x2f'),'value':_0x5f10('0x30')}];var _0x190594=_['find'](_0x57bae1,[_0x5f10('0x34'),_0x392ec3[_0x5f10('0x37')]])['name'];return db[_0x5f10('0x57')]['find']({'where':{'name':_0x190594,'userProfileId':_0x1181d0[_0x5f10('0x58')]},'raw':!![]})[_0x5f10('0x2a')](function(_0x44e9f9){if(_0x44e9f9&&_0x44e9f9[_0x5f10('0x59')]===0x0){return db[_0x5f10('0x39')][_0x5f10('0x54')]({'name':_0x392ec3['name'],'resourceId':_0x392ec3['id'],'type':_0x44e9f9[_0x5f10('0x38')],'sectionId':_0x44e9f9['id']},{})['then'](function(){return _0xdf6b17;});}else{return _0xdf6b17;}})['catch'](function(_0x39b860){logger[_0x5f10('0x3b')](_0x5f10('0x5a'),_0x39b860);throw _0x39b860;});}return _0xdf6b17;})[_0x5f10('0x2a')](respondWithResult(_0x35db71,0xc9))[_0x5f10('0x50')](handleError(_0x35db71,null));};exports[_0x5f10('0x5b')]=function(_0x189a48,_0x5d004b){var _0x5da31d={'where':{'id':_0x189a48[_0x5f10('0x51')]['id']}},_0x4c3903={};_0x4c3903['model']=_[_0x5f10('0x42')](db[_0x5f10('0x3e')][_0x5f10('0x3f')]);_0x5da31d[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x4c3903['model'],qs[_0x5f10('0x47')](_0x189a48['query'][_0x5f10('0x47')]));_0x5da31d[_0x5f10('0x46')]=_0x5da31d['attributes'][_0x5f10('0x48')]?_0x5da31d[_0x5f10('0x46')]:_0x4c3903[_0x5f10('0x45')];if(_0x189a48[_0x5f10('0x41')][_0x5f10('0x52')]){_0x5da31d['include']=[{'all':!![]}];}_0x5da31d=_[_0x5f10('0x5c')]({},_0x5da31d,_0x189a48['options']);return db[_0x5f10('0x3e')][_0x5f10('0x36')](_0x5da31d)[_0x5f10('0x2a')](handleEntityNotFound(_0x5d004b,null))[_0x5f10('0x2a')](function(_0x4758af){if(_0x4758af){var _0xd9660c=_0x4758af[_0x5f10('0x2c')]({'plain':!![]});_0xd9660c=qs['omit'](_0xd9660c,['id',_0x5f10('0x5d'),_0x5f10('0x5e')]);_0x189a48[_0x5f10('0x55')]=_['omit'](_0x189a48[_0x5f10('0x55')],['id','createdAt',_0x5f10('0x5e')]);return db['VoiceQueue'][_0x5f10('0x54')](_[_0x5f10('0x5c')](_0xd9660c,_0x189a48[_0x5f10('0x55')]),{'include':_0x189a48[_0x5f10('0x41')][_0x5f10('0x52')]?[{'all':!![]}]:undefined})['then'](function(_0x58ec4c){var _0x57ac59=_0x189a48[_0x5f10('0x56')][_0x5f10('0x2c')]({'plain':!![]});if(!_0x57ac59)throw new Error(_0x5f10('0x5f'));if(_0x57ac59[_0x5f10('0x60')]===_0x5f10('0x56')){var _0x182875=_0x58ec4c[_0x5f10('0x2c')]({'plain':!![]});var _0xd7b6a2=[{'name':_0x5f10('0x2d'),'value':_0x5f10('0x2e')},{'name':'QueueCampaigns','value':_0x5f10('0x30')}];var _0x268406=_[_0x5f10('0x36')](_0xd7b6a2,[_0x5f10('0x34'),_0x182875[_0x5f10('0x37')]])[_0x5f10('0x38')];return db[_0x5f10('0x57')][_0x5f10('0x36')]({'where':{'name':_0x268406,'userProfileId':_0x57ac59[_0x5f10('0x58')]},'raw':!![]})['then'](function(_0x191a92){if(_0x191a92&&_0x191a92[_0x5f10('0x59')]===0x0){return db[_0x5f10('0x39')][_0x5f10('0x54')]({'name':_0x182875[_0x5f10('0x38')],'resourceId':_0x182875['id'],'type':_0x191a92[_0x5f10('0x38')],'sectionId':_0x191a92['id']},{})[_0x5f10('0x2a')](function(){return _0x58ec4c;});}else{return _0x58ec4c;}})[_0x5f10('0x50')](function(_0xec4cbf){logger['error'](_0x5f10('0x5a'),_0xec4cbf);throw _0xec4cbf;});}return _0x58ec4c;});}})[_0x5f10('0x2a')](respondWithResult(_0x5d004b,0xc9))[_0x5f10('0x50')](handleError(_0x5d004b,null));};exports[_0x5f10('0x29')]=function(_0x4b0f23,_0x3b4641){if(_0x4b0f23[_0x5f10('0x55')]['id']){delete _0x4b0f23['body']['id'];}return db[_0x5f10('0x3e')][_0x5f10('0x36')]({'where':{'id':_0x4b0f23['params']['id']}})['then'](handleEntityNotFound(_0x3b4641,null))['then'](saveUpdates(_0x4b0f23[_0x5f10('0x55')],null))['then'](respondWithResult(_0x3b4641,null))['catch'](handleError(_0x3b4641,null));};exports[_0x5f10('0x2b')]=function(_0x4b2d85,_0x5701bf){return db[_0x5f10('0x3e')][_0x5f10('0x36')]({'where':{'id':_0x4b2d85['params']['id']}})['then'](handleEntityNotFound(_0x5701bf,null))['then'](removeEntity(_0x5701bf,null))[_0x5f10('0x50')](handleError(_0x5701bf,null));};exports['getHoppers']=function(_0x4b05e9,_0x24774b,_0x5c0fed){var _0x611808={'raw':![],'where':{}};var _0x442093={};var _0x5879d7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5f10('0x61')]({'where':{'id':_0x4b05e9[_0x5f10('0x51')]['id']}})['then'](handleEntityNotFound(_0x24774b,null))[_0x5f10('0x2a')](function(_0x28af77){if(_0x28af77){_0x442093[_0x5f10('0x45')]=_[_0x5f10('0x42')](db['CmHopper']['rawAttributes']);_0x442093[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x4b05e9[_0x5f10('0x41')]);_0x442093[_0x5f10('0x43')]=_['intersection'](_0x442093['model'],_0x442093[_0x5f10('0x41')]);_0x611808[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x442093[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x4b05e9[_0x5f10('0x41')][_0x5f10('0x47')]));_0x611808[_0x5f10('0x46')]=_0x611808[_0x5f10('0x46')][_0x5f10('0x48')]?_0x611808[_0x5f10('0x46')]:_0x442093[_0x5f10('0x45')];if(!_0x4b05e9[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x611808[_0x5f10('0x20')]=qs['limit'](_0x4b05e9[_0x5f10('0x41')][_0x5f10('0x20')]);_0x611808['offset']=qs[_0x5f10('0x22')](_0x4b05e9['query']['offset']);}_0x611808['order']=qs[_0x5f10('0x4a')](_0x4b05e9[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x611808[_0x5f10('0x4b')]=qs['filters'](_[_0x5f10('0x63')](_0x4b05e9[_0x5f10('0x41')],_0x442093[_0x5f10('0x43')]));_0x611808[_0x5f10('0x4b')]['VoiceQueueId']=_0x28af77['id'];if(_0x4b05e9[_0x5f10('0x41')]['filter']){_0x611808['where']=_[_0x5f10('0x5c')](_0x611808[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x611808[_0x5f10('0x46')],function(_0x3d7d95){var _0x669e0e={};_0x669e0e[_0x3d7d95]={'$like':'%'+_0x4b05e9[_0x5f10('0x41')]['filter']+'%'};return _0x669e0e;})});}_0x611808=_[_0x5f10('0x5c')]({},_0x611808,_0x4b05e9[_0x5f10('0x53')]);return db[_0x5f10('0x64')][_0x5f10('0x23')]({'where':_0x611808['where']})[_0x5f10('0x2a')](function(_0x1ae718){_0x5879d7[_0x5f10('0x23')]=_0x1ae718;if(_0x4b05e9[_0x5f10('0x41')]['includeAll']){_0x611808[_0x5f10('0x4d')]=[{'all':!![]}];}return db[_0x5f10('0x64')][_0x5f10('0x4e')](_0x611808);})[_0x5f10('0x2a')](function(_0x1f464c){_0x5879d7['rows']=_0x1f464c;return _0x5879d7;});}})['then'](respondWithFilteredResult(_0x24774b,_0x611808))[_0x5f10('0x50')](handleError(_0x24774b,null));};exports[_0x5f10('0x65')]=function(_0x389a1b,_0x29d8a2,_0x1209cf){var _0xb08cfd={'raw':!![],'where':{}};var _0x51e8e5={};var _0x1ef691={'count':0x0,'rows':[]};return db[_0x5f10('0x3e')][_0x5f10('0x61')]({'where':{'id':_0x389a1b[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x29d8a2,null))[_0x5f10('0x2a')](function(_0x13353b){if(_0x13353b){_0x51e8e5[_0x5f10('0x45')]=_[_0x5f10('0x42')](db[_0x5f10('0x66')][_0x5f10('0x3f')]);_0x51e8e5['query']=_['keys'](_0x389a1b['query']);_0x51e8e5['filters']=_[_0x5f10('0x44')](_0x51e8e5['model'],_0x51e8e5['query']);_0xb08cfd[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x51e8e5[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x389a1b['query'][_0x5f10('0x47')]));_0xb08cfd[_0x5f10('0x46')]=_0xb08cfd[_0x5f10('0x46')][_0x5f10('0x48')]?_0xb08cfd[_0x5f10('0x46')]:_0x51e8e5['model'];if(!_0x389a1b['query']['hasOwnProperty'](_0x5f10('0x62'))){_0xb08cfd[_0x5f10('0x20')]=qs['limit'](_0x389a1b[_0x5f10('0x41')][_0x5f10('0x20')]);_0xb08cfd[_0x5f10('0x22')]=qs['offset'](_0x389a1b[_0x5f10('0x41')]['offset']);}_0xb08cfd[_0x5f10('0x67')]=qs[_0x5f10('0x4a')](_0x389a1b['query'][_0x5f10('0x4a')]);_0xb08cfd[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x389a1b[_0x5f10('0x41')],_0x51e8e5['filters']));_0xb08cfd['where'][_0x5f10('0x68')]=_0x13353b['id'];if(_0x389a1b[_0x5f10('0x41')][_0x5f10('0x31')]){_0xb08cfd[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0xb08cfd[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0xb08cfd['attributes'],function(_0x270728){var _0x2ea71b={};_0x2ea71b[_0x270728]={'$like':'%'+_0x389a1b[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x2ea71b;})});}_0xb08cfd=_['merge']({},_0xb08cfd,_0x389a1b[_0x5f10('0x53')]);return db[_0x5f10('0x66')][_0x5f10('0x23')]({'where':_0xb08cfd[_0x5f10('0x4b')]})['then'](function(_0x4dffc3){_0x1ef691[_0x5f10('0x23')]=_0x4dffc3;if(_0x389a1b[_0x5f10('0x41')][_0x5f10('0x52')]){_0xb08cfd['include']=[{'all':!![]}];}return db[_0x5f10('0x66')]['findAll'](_0xb08cfd);})[_0x5f10('0x2a')](function(_0x5365fa){_0x1ef691[_0x5f10('0x4f')]=_0x5365fa;return _0x1ef691;});}})[_0x5f10('0x2a')](respondWithFilteredResult(_0x29d8a2,_0xb08cfd))[_0x5f10('0x50')](handleError(_0x29d8a2,null));};exports[_0x5f10('0x69')]=function(_0x5df864,_0x2c04df,_0x59883d){var _0x5640fe={'raw':!![],'where':{}};var _0x44723d={};var _0x5556b6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5f10('0x61')]({'where':{'id':_0x5df864[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x2c04df,null))['then'](function(_0x39d18b){if(_0x39d18b){_0x44723d[_0x5f10('0x45')]=_[_0x5f10('0x42')](db[_0x5f10('0x6a')][_0x5f10('0x3f')]);_0x44723d[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x5df864[_0x5f10('0x41')]);_0x44723d[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x44723d[_0x5f10('0x45')],_0x44723d[_0x5f10('0x41')]);_0x5640fe[_0x5f10('0x46')]=_['intersection'](_0x44723d[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x5df864[_0x5f10('0x41')][_0x5f10('0x47')]));_0x5640fe[_0x5f10('0x46')]=_0x5640fe['attributes'][_0x5f10('0x48')]?_0x5640fe[_0x5f10('0x46')]:_0x44723d[_0x5f10('0x45')];if(!_0x5df864[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x5640fe['limit']=qs['limit'](_0x5df864[_0x5f10('0x41')][_0x5f10('0x20')]);_0x5640fe[_0x5f10('0x22')]=qs[_0x5f10('0x22')](_0x5df864['query'][_0x5f10('0x22')]);}_0x5640fe[_0x5f10('0x67')]=qs[_0x5f10('0x4a')](_0x5df864['query'][_0x5f10('0x4a')]);_0x5640fe['where']=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x5df864[_0x5f10('0x41')],_0x44723d[_0x5f10('0x43')]));_0x5640fe['where'][_0x5f10('0x68')]=_0x39d18b['id'];if(_0x5df864[_0x5f10('0x41')][_0x5f10('0x31')]){_0x5640fe[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0x5640fe[_0x5f10('0x4b')],{'$or':_['map'](_0x5640fe[_0x5f10('0x46')],function(_0x207880){var _0x323375={};_0x323375[_0x207880]={'$like':'%'+_0x5df864[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x323375;})});}_0x5640fe=_[_0x5f10('0x5c')]({},_0x5640fe,_0x5df864['options']);return db[_0x5f10('0x6a')]['count']({'where':_0x5640fe['where']})['then'](function(_0x4173d4){_0x5556b6[_0x5f10('0x23')]=_0x4173d4;if(_0x5df864[_0x5f10('0x41')]['includeAll']){_0x5640fe[_0x5f10('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5f10('0x4e')](_0x5640fe);})[_0x5f10('0x2a')](function(_0x3757a6){_0x5556b6['rows']=_0x3757a6;return _0x5556b6;});}})['then'](respondWithFilteredResult(_0x2c04df,_0x5640fe))[_0x5f10('0x50')](handleError(_0x2c04df,null));};exports[_0x5f10('0x6b')]=function(_0x305705,_0x56ccd8,_0x2de55d){var _0x2e8c23={'raw':!![],'where':{}};var _0x5df09d={};var _0x160663={'count':0x0,'rows':[]};return db[_0x5f10('0x3e')][_0x5f10('0x61')]({'where':{'id':_0x305705[_0x5f10('0x51')]['id']}})['then'](handleEntityNotFound(_0x56ccd8,null))[_0x5f10('0x2a')](function(_0xad633d){if(_0xad633d){_0x5df09d[_0x5f10('0x45')]=_[_0x5f10('0x42')](db['CmHopperBlack']['rawAttributes']);_0x5df09d[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x305705['query']);_0x5df09d[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x5df09d[_0x5f10('0x45')],_0x5df09d[_0x5f10('0x41')]);_0x2e8c23[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x5df09d[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x305705[_0x5f10('0x41')][_0x5f10('0x47')]));_0x2e8c23[_0x5f10('0x46')]=_0x2e8c23[_0x5f10('0x46')][_0x5f10('0x48')]?_0x2e8c23[_0x5f10('0x46')]:_0x5df09d[_0x5f10('0x45')];if(!_0x305705[_0x5f10('0x41')]['hasOwnProperty']('nolimit')){_0x2e8c23['limit']=qs['limit'](_0x305705[_0x5f10('0x41')][_0x5f10('0x20')]);_0x2e8c23['offset']=qs[_0x5f10('0x22')](_0x305705[_0x5f10('0x41')][_0x5f10('0x22')]);}_0x2e8c23['order']=qs['sort'](_0x305705[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x2e8c23[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_['pick'](_0x305705[_0x5f10('0x41')],_0x5df09d[_0x5f10('0x43')]));_0x2e8c23[_0x5f10('0x4b')][_0x5f10('0x68')]=_0xad633d['id'];if(_0x305705['query'][_0x5f10('0x31')]){_0x2e8c23[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0x2e8c23[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x2e8c23[_0x5f10('0x46')],function(_0x443422){var _0x23637f={};_0x23637f[_0x443422]={'$like':'%'+_0x305705['query'][_0x5f10('0x31')]+'%'};return _0x23637f;})});}_0x2e8c23=_['merge']({},_0x2e8c23,_0x305705[_0x5f10('0x53')]);return db[_0x5f10('0x6c')][_0x5f10('0x23')]({'where':_0x2e8c23[_0x5f10('0x4b')]})['then'](function(_0x45c09d){_0x160663[_0x5f10('0x23')]=_0x45c09d;if(_0x305705[_0x5f10('0x41')][_0x5f10('0x52')]){_0x2e8c23[_0x5f10('0x4d')]=[{'all':!![]}];}return db[_0x5f10('0x6c')][_0x5f10('0x4e')](_0x2e8c23);})['then'](function(_0x213455){_0x160663[_0x5f10('0x4f')]=_0x213455;return _0x160663;});}})[_0x5f10('0x2a')](respondWithFilteredResult(_0x56ccd8,_0x2e8c23))[_0x5f10('0x50')](handleError(_0x56ccd8,null));};exports['getTeams']=function(_0x15c94d,_0x3538f4,_0x5d2b7c){var _0x14c4ae={};var _0x54cfdd={};var _0x3b52fd;var _0x588226;return db[_0x5f10('0x3e')]['findOne']({'where':{'id':_0x15c94d[_0x5f10('0x51')]['id']}})['then'](handleEntityNotFound(_0x3538f4,null))[_0x5f10('0x2a')](function(_0x11dfc2){if(_0x11dfc2){_0x3b52fd=_0x11dfc2;_0x54cfdd['model']=_[_0x5f10('0x42')](db[_0x5f10('0x6d')][_0x5f10('0x3f')]);_0x54cfdd[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x15c94d[_0x5f10('0x41')]);_0x54cfdd[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x54cfdd[_0x5f10('0x45')],_0x54cfdd[_0x5f10('0x41')]);_0x14c4ae[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x54cfdd[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x15c94d[_0x5f10('0x41')][_0x5f10('0x47')]));_0x14c4ae[_0x5f10('0x46')]=_0x14c4ae[_0x5f10('0x46')][_0x5f10('0x48')]?_0x14c4ae[_0x5f10('0x46')]:_0x54cfdd[_0x5f10('0x45')];_0x14c4ae['order']=qs[_0x5f10('0x4a')](_0x15c94d[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x14c4ae[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x15c94d['query'],_0x54cfdd[_0x5f10('0x43')]));if(_0x15c94d[_0x5f10('0x41')][_0x5f10('0x31')]){_0x14c4ae['where']=_['merge'](_0x14c4ae['where'],{'$or':_[_0x5f10('0x33')](_0x14c4ae['attributes'],function(_0x5d76a7){var _0x262d10={};_0x262d10[_0x5d76a7]={'$like':'%'+_0x15c94d[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x262d10;})});}_0x14c4ae=_[_0x5f10('0x5c')]({},_0x14c4ae,_0x15c94d['options']);return _0x3b52fd[_0x5f10('0x6e')](_0x14c4ae);}})[_0x5f10('0x2a')](function(_0x674783){if(_0x674783){_0x588226=_0x674783[_0x5f10('0x48')];if(!_0x15c94d[_0x5f10('0x41')]['hasOwnProperty'](_0x5f10('0x62'))){_0x14c4ae[_0x5f10('0x20')]=qs[_0x5f10('0x20')](_0x15c94d[_0x5f10('0x41')][_0x5f10('0x20')]);_0x14c4ae['offset']=qs[_0x5f10('0x22')](_0x15c94d[_0x5f10('0x41')][_0x5f10('0x22')]);}return _0x3b52fd[_0x5f10('0x6e')](_0x14c4ae);}})[_0x5f10('0x2a')](function(_0xec9ac2){if(_0xec9ac2){return _0xec9ac2?{'count':_0x588226,'rows':_0xec9ac2}:null;}})[_0x5f10('0x2a')](respondWithResult(_0x3538f4,null))[_0x5f10('0x50')](handleError(_0x3538f4,null));};exports[_0x5f10('0x6f')]=function(_0x37524a,_0x1f7f66,_0x1ce63e){var _0x159394=_0x37524a[_0x5f10('0x55')][_0x5f10('0x70')];var _0x1876df=_[_0x5f10('0x33')](_0x159394,'id');return db[_0x5f10('0x6d')][_0x5f10('0x4e')]({'where':{'id':_0x1876df},'attributes':['id'],'include':[{'model':db[_0x5f10('0x71')],'as':'Agents','attributes':['id',_0x5f10('0x38'),_0x5f10('0x72'),_0x5f10('0x73'),_0x5f10('0x74')],'raw':!![]}]})[_0x5f10('0x2a')](function(_0xc7bfe9){if(_0xc7bfe9){var _0x52c959=_['flatMap'](_0xc7bfe9,function(_0x4dc002){var _0x43cb78=_0x4dc002[_0x5f10('0x2c')]({'plain':!![]});_0x43cb78['Agents'][_0x5f10('0x75')](function(_0x39e727){_0x39e727['penalty']=_[_0x5f10('0x36')](_0x159394,{'id':_0x43cb78['id']})[_0x5f10('0x76')];});return _0x43cb78[_0x5f10('0x77')];});return db[_0x5f10('0x3e')][_0x5f10('0x36')]({'where':{'id':_0x37524a[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](function(_0xcdf214){return db[_0x5f10('0x78')][_0x5f10('0x79')](function(_0xdab2c1){return _0xcdf214[_0x5f10('0x6f')](_0x1876df,{'transaction':_0xdab2c1})[_0x5f10('0x2a')](function(){return BPromise[_0x5f10('0x7a')](_0x159394,function(_0x286ce0){return db['TeamVoiceQueue'][_0x5f10('0x7b')]({'TeamId':_0x286ce0['id'],'VoiceQueueId':_0x37524a[_0x5f10('0x51')]['id'],'penalty':_0x286ce0[_0x5f10('0x76')]},{'transaction':_0xdab2c1});});})[_0x5f10('0x2a')](function(){return BPromise['each'](_0x52c959,function(_0x5b4a7a){return db[_0x5f10('0x7c')]['findOrCreate']({'where':{'UserId':_0x5b4a7a['id'],'VoiceQueueId':_0x37524a[_0x5f10('0x51')]['id']},'defaults':{'penalty':_0x5b4a7a['penalty']},'transaction':_0xdab2c1});});})[_0x5f10('0x2a')](function(){return BPromise[_0x5f10('0x7a')](_['filter'](_0x52c959,{'online':!![]}),function(_0x3d0542){return db[_0x5f10('0x7d')]['upsert']({'membername':_0x3d0542[_0x5f10('0x38')],'UserId':_0x3d0542['id'],'queue_name':_0xcdf214['name'],'VoiceQueueId':_0xcdf214['id'],'interface':_['isNil'](_0x3d0542[_0x5f10('0x74')])?util[_0x5f10('0x7e')](_0x5f10('0x7f'),_0x3d0542[_0x5f10('0x38')]):_0x3d0542['interface'],'paused':_0x3d0542[_0x5f10('0x73')]||![],'penalty':_0x3d0542[_0x5f10('0x76')]},{'transaction':_0xdab2c1});});})[_0x5f10('0x2a')](function(){_0x52c959[_0x5f10('0x75')](function(_0x39c5b8){socket[_0x5f10('0x80')]('userVoiceQueue:save',{'UserId':_0x39c5b8['id'],'VoiceQueueId':_0xcdf214['id']});});});});});}})['then'](respondWithStatusCode(_0x1f7f66,null))[_0x5f10('0x50')](handleError(_0x1f7f66,null));};exports[_0x5f10('0x81')]=function(_0x252d2b,_0x739e8b,_0x44de9b){return db[_0x5f10('0x6d')][_0x5f10('0x4e')]({'where':{'id':_0x252d2b[_0x5f10('0x41')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5f10('0x77'),'attributes':['id'],'raw':!![]}]})[_0x5f10('0x2a')](handleEntityNotFound(_0x739e8b,null))[_0x5f10('0x2a')](function(_0x106438){var _0x3cd14b=_[_0x5f10('0x33')](_0x106438,'id');var _0x51a64a=[];var _0x31d0f9=[];var _0xa855b=squel['select']();_0xa855b[_0x5f10('0x82')](_0x5f10('0x83'))['from']('team_has_voice_queues','tq')[_0x5f10('0x84')](_0x5f10('0x85'),'ut',_0x5f10('0x86'))[_0x5f10('0x4b')](_0x5f10('0x87'),_0x252d2b[_0x5f10('0x51')]['id']);for(var _0x357528=0x0;_0x357528<_0x106438['length'];_0x357528+=0x1){let _0x3b9916=_0x106438[_0x357528];for(var _0x4ff384=0x0;_0x4ff384<_0x3b9916[_0x5f10('0x77')][_0x5f10('0x48')];_0x4ff384+=0x1){let _0x2b114f=_0x3b9916['Agents'][_0x4ff384];var _0x33c903=_0xa855b[_0x5f10('0x5b')]();_0x33c903[_0x5f10('0x4b')]('ut.UserId\x20=\x20?',_0x2b114f['id']);_0x31d0f9[_0x5f10('0x88')](db['sequelize']['query'](_0x33c903[_0x5f10('0x89')](),{'type':db[_0x5f10('0x78')][_0x5f10('0x8a')][_0x5f10('0x8b')]})[_0x5f10('0x2a')](function(_0x3738ec){if(_0x3738ec['length']===0x1){return _0x2b114f['id'];}else{var _0x1e470a=_[_0x5f10('0x8c')](_['map'](_0x3738ec,'TeamId'),function(_0x287379){return _[_0x5f10('0x35')](_0x3cd14b,_0x287379);});if(_0x1e470a){return _0x2b114f['id'];}}}));}}return BPromise[_0x5f10('0x8d')](_0x31d0f9)[_0x5f10('0x2a')](function(_0xb586b2){_0x51a64a=_(_0x51a64a)[_0x5f10('0x8e')](_0xb586b2)[_0x5f10('0x8f')]()['value']();return db['VoiceQueue']['find']({'where':{'id':_0x252d2b[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](function(_0x37ccd8){return db[_0x5f10('0x78')][_0x5f10('0x79')](function(_0x4443c7){return _0x37ccd8[_0x5f10('0x81')](_0x252d2b[_0x5f10('0x41')]['ids'],{'transaction':_0x4443c7})[_0x5f10('0x2a')](function(){if(!_['isEmpty'](_0x51a64a)){return _0x37ccd8['removeAgents'](_0x51a64a,{'transaction':_0x4443c7})[_0x5f10('0x2a')](function(){return db[_0x5f10('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x252d2b[_0x5f10('0x51')]['id'],'UserId':_0x51a64a},'transaction':_0x4443c7});});}})[_0x5f10('0x2a')](function(){_0x51a64a['forEach'](function(_0x5db3a9){socket[_0x5f10('0x80')](_0x5f10('0x90'),{'UserId':_0x5db3a9,'VoiceQueueId':_0x37ccd8['id']});});});});});});})[_0x5f10('0x2a')](respondWithStatusCode(_0x739e8b,null))[_0x5f10('0x50')](handleError(_0x739e8b,null));};exports['addAgents']=function(_0x295937,_0x430823,_0x5ccc80){var _0x55b2da,_0x5ce55d;return db['VoiceQueue'][_0x5f10('0x36')]({'where':{'id':_0x295937[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x430823,null))[_0x5f10('0x2a')](function(_0x430c65){if(_0x430c65){_0x5ce55d=_0x430c65;return _0x430c65[_0x5f10('0x91')](_0x295937[_0x5f10('0x55')][_0x5f10('0x92')],_[_0x5f10('0x93')](_0x295937[_0x5f10('0x55')],['ids','id'])||{})[_0x5f10('0x94')](function(_0xf75704){for(var _0x2e4483=0x0;_0x2e4483<_0x295937['body'][_0x5f10('0x92')][_0x5f10('0x48')];_0x2e4483+=0x1){socket[_0x5f10('0x80')](_0x5f10('0x95'),{'UserId':Number(_0x295937[_0x5f10('0x55')]['ids'][_0x2e4483]),'VoiceQueueId':Number(_0x295937[_0x5f10('0x51')]['id'])});}return _0xf75704;});}})[_0x5f10('0x2a')](function(_0x56c78c){_0x55b2da=_0x56c78c||[];if(_0x5ce55d){return db[_0x5f10('0x71')]['findAll']({'where':{'id':_0x295937[_0x5f10('0x55')][_0x5f10('0x92')]},'attributes':['id',_0x5f10('0x38'),_0x5f10('0x72'),'voicePause',_0x5f10('0x74')],'raw':!![]});}})[_0x5f10('0x2a')](function(_0x152463){if(!_[_0x5f10('0x96')](_0x152463)){var _0x56348c=[];for(var _0x1c287c=0x0;_0x1c287c<_0x152463['length'];_0x1c287c++){if(_0x152463[_0x1c287c][_0x5f10('0x72')]){_0x56348c['push'](db['UserVoiceQueueRt'][_0x5f10('0x7b')]({'membername':_0x152463[_0x1c287c][_0x5f10('0x38')],'UserId':_0x152463[_0x1c287c]['id'],'queue_name':_0x5ce55d[_0x5f10('0x38')],'VoiceQueueId':_0x5ce55d['id'],'interface':_[_0x5f10('0x97')](_0x152463[_0x1c287c][_0x5f10('0x74')])?util[_0x5f10('0x7e')](_0x5f10('0x7f'),_0x152463[_0x1c287c]['name']):_0x152463[_0x1c287c][_0x5f10('0x74')],'paused':_0x152463[_0x1c287c]['voicePause']||![],'penalty':_0x295937[_0x5f10('0x55')][_0x5f10('0x76')]||0x0}));}}return BPromise['all'](_0x56348c);}})['then'](function(){return _0x55b2da;})[_0x5f10('0x2a')](respondWithResult(_0x430823,null))[_0x5f10('0x50')](handleError(_0x430823,null));};exports[_0x5f10('0x98')]=function(_0x24cfa8,_0x5af126,_0x29792e){return db['VoiceQueue'][_0x5f10('0x36')]({'where':{'id':_0x24cfa8['params']['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x5af126,null))[_0x5f10('0x2a')](function(_0x2b56bb){if(_0x2b56bb){return _0x2b56bb[_0x5f10('0x98')](_0x24cfa8[_0x5f10('0x41')]['ids'])[_0x5f10('0x2a')](function(){if(_['isArray'](_0x24cfa8[_0x5f10('0x41')][_0x5f10('0x92')])){for(var _0x22287b=0x0;_0x22287b<_0x24cfa8['query'][_0x5f10('0x92')][_0x5f10('0x48')];_0x22287b+=0x1){socket[_0x5f10('0x80')](_0x5f10('0x90'),{'UserId':Number(_0x24cfa8[_0x5f10('0x41')]['ids'][_0x22287b]),'VoiceQueueId':Number(_0x24cfa8[_0x5f10('0x51')]['id'])});}}else{socket[_0x5f10('0x80')](_0x5f10('0x90'),{'UserId':Number(_0x24cfa8['query']['ids']),'VoiceQueueId':Number(_0x24cfa8['params']['id'])});}});}})[_0x5f10('0x2a')](function(_0x2d6e96){return db[_0x5f10('0x7d')][_0x5f10('0x2b')]({'where':{'VoiceQueueId':_0x24cfa8['params']['id'],'UserId':_0x24cfa8[_0x5f10('0x41')]['ids']}})[_0x5f10('0x2a')](function(){return _0x2d6e96;});})['then'](respondWithStatusCode(_0x5af126,null))[_0x5f10('0x50')](handleError(_0x5af126,null));};exports[_0x5f10('0x99')]=function(_0x285360,_0x2ffc74,_0xa45fbd){var _0x408295={};var _0x35c46a={};var _0x5d6115;var _0x3993d1;return db['VoiceQueue']['findOne']({'where':{'id':_0x285360[_0x5f10('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ffc74,null))[_0x5f10('0x2a')](function(_0x444684){if(_0x444684){_0x5d6115=_0x444684;_0x35c46a[_0x5f10('0x45')]=_[_0x5f10('0x42')](db[_0x5f10('0x71')][_0x5f10('0x3f')]);_0x35c46a[_0x5f10('0x41')]=_['keys'](_0x285360['query']);_0x35c46a['filters']=_[_0x5f10('0x44')](_0x35c46a['model'],_0x35c46a[_0x5f10('0x41')]);_0x408295[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0x35c46a[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x285360[_0x5f10('0x41')][_0x5f10('0x47')]));_0x408295['attributes']=_0x408295[_0x5f10('0x46')]['length']?_0x408295[_0x5f10('0x46')]:_0x35c46a['model'];_0x408295[_0x5f10('0x67')]=qs[_0x5f10('0x4a')](_0x285360['query']['sort']);_0x408295[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x285360[_0x5f10('0x41')],_0x35c46a[_0x5f10('0x43')]));if(_0x285360[_0x5f10('0x41')]['filter']){_0x408295[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0x408295[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x408295['attributes'],function(_0x5df30c){var _0x4ae378={};_0x4ae378[_0x5df30c]={'$like':'%'+_0x285360[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x4ae378;})});}_0x408295=_[_0x5f10('0x5c')]({},_0x408295,_0x285360[_0x5f10('0x53')]);return _0x5d6115[_0x5f10('0x99')](_0x408295);}})[_0x5f10('0x2a')](function(_0x1a2f3d){if(_0x1a2f3d){_0x3993d1=_0x1a2f3d[_0x5f10('0x48')];if(!_0x285360[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x408295[_0x5f10('0x20')]=qs[_0x5f10('0x20')](_0x285360['query'][_0x5f10('0x20')]);_0x408295[_0x5f10('0x22')]=qs[_0x5f10('0x22')](_0x285360[_0x5f10('0x41')][_0x5f10('0x22')]);}return _0x5d6115[_0x5f10('0x99')](_0x408295);}})[_0x5f10('0x2a')](function(_0x34b630){if(_0x34b630){return _0x34b630?{'count':_0x3993d1,'rows':_0x34b630}:null;}})[_0x5f10('0x2a')](respondWithResult(_0x2ffc74,null))[_0x5f10('0x50')](handleError(_0x2ffc74,null));};exports[_0x5f10('0x9a')]=function(_0x5be1fa,_0x7ca2d0,_0x50b3bc){var _0x2601b6={};var _0x1580d0={};var _0x1b1df9;var _0x1e7190;return db['VoiceQueue']['findOne']({'where':{'id':_0x5be1fa[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x7ca2d0,null))[_0x5f10('0x2a')](function(_0x4dcc3d){if(_0x4dcc3d){_0x1b1df9=_0x4dcc3d;_0x1580d0[_0x5f10('0x45')]=_[_0x5f10('0x42')](db[_0x5f10('0x7d')][_0x5f10('0x3f')]);_0x1580d0['query']=_[_0x5f10('0x42')](_0x5be1fa['query']);_0x1580d0[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x1580d0[_0x5f10('0x45')],_0x1580d0[_0x5f10('0x41')]);_0x2601b6[_0x5f10('0x46')]=_['intersection'](_0x1580d0[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x5be1fa[_0x5f10('0x41')][_0x5f10('0x47')]));_0x2601b6[_0x5f10('0x46')]=_0x2601b6[_0x5f10('0x46')][_0x5f10('0x48')]?_0x2601b6[_0x5f10('0x46')]:_0x1580d0[_0x5f10('0x45')];_0x2601b6[_0x5f10('0x67')]=qs[_0x5f10('0x4a')](_0x5be1fa[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x2601b6[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x5be1fa[_0x5f10('0x41')],_0x1580d0[_0x5f10('0x43')]));if(_0x5be1fa['query'][_0x5f10('0x31')]){_0x2601b6[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0x2601b6['where'],{'$or':_[_0x5f10('0x33')](_0x2601b6['attributes'],function(_0x34ec67){var _0x34c273={};_0x34c273[_0x34ec67]={'$like':'%'+_0x5be1fa[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x34c273;})});}_0x2601b6=_[_0x5f10('0x5c')]({},_0x2601b6,_0x5be1fa[_0x5f10('0x53')]);return _0x1b1df9[_0x5f10('0x9a')](_0x2601b6);}})[_0x5f10('0x2a')](function(_0x4a5d61){if(_0x4a5d61){_0x1e7190=_0x4a5d61[_0x5f10('0x48')];if(!_0x5be1fa[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x2601b6[_0x5f10('0x20')]=qs[_0x5f10('0x20')](_0x5be1fa['query']['limit']);_0x2601b6[_0x5f10('0x22')]=qs[_0x5f10('0x22')](_0x5be1fa['query']['offset']);}return _0x1b1df9[_0x5f10('0x9a')](_0x2601b6);}})[_0x5f10('0x2a')](function(_0x150df8){return _0x150df8?{'count':_0x1e7190,'rows':_0x150df8}:null;})[_0x5f10('0x2a')](respondWithResult(_0x7ca2d0,null))[_0x5f10('0x50')](handleError(_0x7ca2d0,null));};exports[_0x5f10('0x9b')]=function(_0x48ec31,_0x45a2c4,_0x372450){var _0x3305e6={};var _0x497533={};var _0x272932;var _0x53ade7;return db[_0x5f10('0x3e')][_0x5f10('0x61')]({'where':{'id':_0x48ec31[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x45a2c4,null))[_0x5f10('0x2a')](function(_0x1cf4b0){if(_0x1cf4b0){_0x272932=_0x1cf4b0;_0x497533[_0x5f10('0x45')]=_['keys'](db[_0x5f10('0x9c')]['rawAttributes']);_0x497533['query']=_[_0x5f10('0x42')](_0x48ec31[_0x5f10('0x41')]);_0x497533[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0x497533['model'],_0x497533[_0x5f10('0x41')]);_0x3305e6[_0x5f10('0x46')]=_['intersection'](_0x497533[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x48ec31[_0x5f10('0x41')][_0x5f10('0x47')]));_0x3305e6['attributes']=_0x3305e6[_0x5f10('0x46')][_0x5f10('0x48')]?_0x3305e6[_0x5f10('0x46')]:_0x497533[_0x5f10('0x45')];_0x3305e6[_0x5f10('0x67')]=qs['sort'](_0x48ec31[_0x5f10('0x41')][_0x5f10('0x4a')]);_0x3305e6[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x48ec31[_0x5f10('0x41')],_0x497533[_0x5f10('0x43')]));if(_0x48ec31[_0x5f10('0x41')][_0x5f10('0x31')]){_0x3305e6[_0x5f10('0x4b')]=_[_0x5f10('0x5c')](_0x3305e6[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x3305e6[_0x5f10('0x46')],function(_0x5e88c4){var _0x1e8b27={};_0x1e8b27[_0x5e88c4]={'$like':'%'+_0x48ec31[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x1e8b27;})});}_0x3305e6=_['merge']({},_0x3305e6,_0x48ec31[_0x5f10('0x53')]);return _0x272932[_0x5f10('0x9b')](_0x3305e6);}})[_0x5f10('0x2a')](function(_0x5e7583){if(_0x5e7583){_0x53ade7=_0x5e7583['length'];if(!_0x48ec31[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x3305e6[_0x5f10('0x20')]=qs[_0x5f10('0x20')](_0x48ec31['query'][_0x5f10('0x20')]);_0x3305e6['offset']=qs[_0x5f10('0x22')](_0x48ec31[_0x5f10('0x41')]['offset']);}return _0x272932['getLists'](_0x3305e6);}})[_0x5f10('0x2a')](function(_0x21d501){if(_0x21d501){return _0x21d501?{'count':_0x53ade7,'rows':_0x21d501}:null;}})[_0x5f10('0x2a')](respondWithResult(_0x45a2c4,null))['catch'](handleError(_0x45a2c4,null));};exports[_0x5f10('0x9d')]=function(_0x16a2ed,_0x5cc5f5,_0x49506e){var _0x45a04a=moment()[_0x5f10('0x7e')](_0x5f10('0x9e'));var _0x1d8a43,_0x54b846;return db[_0x5f10('0x3e')][_0x5f10('0x36')]({'where':{'id':_0x16a2ed[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x5cc5f5,null))[_0x5f10('0x2a')](function(_0x466ff1){if(_0x466ff1){_0x54b846=_0x466ff1;return _0x466ff1[_0x5f10('0x9d')](_0x16a2ed['body'][_0x5f10('0x92')],_[_0x5f10('0x93')](_0x16a2ed[_0x5f10('0x55')],['ids','id'])||{});}return null;})['spread'](function(_0x42c4f4){var _0x12920b;_0x1d8a43=_0x42c4f4||[];var _0x45ea33=[];if(_0x42c4f4){for(var _0x2a964f=0x0;_0x2a964f<_0x42c4f4[_0x5f10('0x48')];_0x2a964f+=0x1){var _0x21360e=_0x42c4f4[_0x2a964f]['get']({'plain':!![]});_0x54b846['dialCheckDuplicateType']=_0x16a2ed['body'][_0x5f10('0x9f')]?_0x16a2ed['body'][_0x5f10('0x9f')]:_0x54b846[_0x5f10('0x9f')];switch(_0x54b846[_0x5f10('0x9f')]){case _0x5f10('0xa0'):_0x12920b=squel['insert']()[_0x5f10('0xa1')](_0x5f10('0xa2'))[_0x5f10('0xa3')](['phone','scheduledAt',_0x5f10('0xa4'),_0x5f10('0xa5'),_0x5f10('0x68'),_0x5f10('0x5d'),_0x5f10('0x5e')],squel['select']()['field'](_0x5f10('0xa6'),_0x5f10('0xa6'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27',_0x5f10('0xa7'))['field']('id',_0x5f10('0xa4'))[_0x5f10('0x82')](_0x21360e[_0x5f10('0xa8')]['toString'](),_0x5f10('0xa5'))[_0x5f10('0x82')](_0x16a2ed['params']['id']['toString'](),_0x5f10('0x68'))['field']('\x27'+_0x45a04a+'\x27',_0x5f10('0x5d'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27','updatedAt')[_0x5f10('0xa9')](_0x5f10('0xaa'))['where']('deletedAt\x20IS\x20NULL')[_0x5f10('0x4b')](_0x5f10('0xab'),_0x21360e[_0x5f10('0xa8')][_0x5f10('0x89')]())['where'](_0x5f10('0xac'))[_0x5f10('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5f10('0xad')]()[_0x5f10('0x82')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x5f10('0xae'))[_0x5f10('0x4b')](_0x5f10('0x87'),_0x16a2ed[_0x5f10('0x51')]['id'][_0x5f10('0x89')]()))[_0x5f10('0x4b')](_0x5f10('0xaf'),squel[_0x5f10('0xad')]()[_0x5f10('0x82')](_0x5f10('0xb0'))[_0x5f10('0xa9')]('cm_hopper')[_0x5f10('0x4b')](_0x5f10('0x87'),_0x16a2ed[_0x5f10('0x51')]['id'][_0x5f10('0x89')]())))[_0x5f10('0x89')]();break;case'onlyIfOpen':_0x12920b=squel['insert']()[_0x5f10('0xa1')](_0x5f10('0xa2'))[_0x5f10('0xa3')]([_0x5f10('0xa6'),_0x5f10('0xa7'),'ContactId','ListId',_0x5f10('0x68'),_0x5f10('0x5d'),'updatedAt'],squel[_0x5f10('0xad')]()['field'](_0x5f10('0xa6'),_0x5f10('0xa6'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27',_0x5f10('0xa7'))[_0x5f10('0x82')]('id',_0x5f10('0xa4'))[_0x5f10('0x82')](_0x21360e['CmListId'][_0x5f10('0x89')](),_0x5f10('0xa5'))['field'](_0x16a2ed[_0x5f10('0x51')]['id'][_0x5f10('0x89')](),_0x5f10('0x68'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27','createdAt')[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27',_0x5f10('0x5e'))[_0x5f10('0xa9')]('cm_contacts')['where'](_0x5f10('0xb1'))['where'](_0x5f10('0xab'),_0x21360e[_0x5f10('0xa8')][_0x5f10('0x89')]())['where'](_0x5f10('0xac'))[_0x5f10('0x4b')](_0x5f10('0xaf'),squel[_0x5f10('0xad')]()[_0x5f10('0x82')](_0x5f10('0xb0'))[_0x5f10('0xa9')](_0x5f10('0xa2'))['where']('VoiceQueueId\x20=\x20?',_0x16a2ed[_0x5f10('0x51')]['id'][_0x5f10('0x89')]())))[_0x5f10('0x89')]();break;default:_0x12920b=squel[_0x5f10('0xb2')]()[_0x5f10('0xa1')](_0x5f10('0xa2'))[_0x5f10('0xa3')]([_0x5f10('0xa6'),_0x5f10('0xa7'),_0x5f10('0xa4'),_0x5f10('0xa5'),_0x5f10('0x68'),_0x5f10('0x5d'),_0x5f10('0x5e')],squel['select']()[_0x5f10('0x82')](_0x5f10('0xa6'),'phone')[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27','scheduledAt')['field']('id',_0x5f10('0xa4'))[_0x5f10('0x82')](_0x21360e[_0x5f10('0xa8')][_0x5f10('0x89')](),_0x5f10('0xa5'))[_0x5f10('0x82')](_0x16a2ed[_0x5f10('0x51')]['id'][_0x5f10('0x89')](),'VoiceQueueId')['field']('\x27'+_0x45a04a+'\x27',_0x5f10('0x5d'))['field']('\x27'+_0x45a04a+'\x27','updatedAt')[_0x5f10('0xa9')](_0x5f10('0xaa'))['where'](_0x5f10('0xb1'))[_0x5f10('0x4b')]('ListId\x20=\x20?',_0x21360e[_0x5f10('0xa8')][_0x5f10('0x89')]())[_0x5f10('0x4b')](_0x5f10('0xac')))[_0x5f10('0x89')]();}_0x45ea33['push'](db['sequelize'][_0x5f10('0x41')](_0x12920b));}return BPromise[_0x5f10('0x8d')](_0x45ea33);}})[_0x5f10('0x2a')](function(){var _0x253fc7=[];var _0x45db61=squel[_0x5f10('0xb2')]()[_0x5f10('0xa1')](_0x5f10('0xb3'))[_0x5f10('0xa3')](['CmHopperId',_0x5f10('0xa6'),'OrderBy','createdAt','updatedAt'],squel[_0x5f10('0xad')]()['field'](_0x5f10('0xb4'))['field'](_0x5f10('0xb5'))[_0x5f10('0x82')](_0x5f10('0xb6'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27',_0x5f10('0x5d'))[_0x5f10('0x82')]('\x27'+_0x45a04a+'\x27','updatedAt')['from']('cm_contact_has_items','ci')[_0x5f10('0x84')]('cm_hopper','h',_0x5f10('0xb7'))[_0x5f10('0x4b')](_0x5f10('0xb8'),_0x45a04a)[_0x5f10('0x4b')](_0x5f10('0xb9'),_0x5f10('0xba')))[_0x5f10('0x89')]();_0x253fc7['push'](db[_0x5f10('0x78')]['query'](_0x45db61));return BPromise['all'](_0x253fc7);})[_0x5f10('0x2a')](function(){return _0x1d8a43;})[_0x5f10('0x2a')](respondWithResult(_0x5cc5f5,null))[_0x5f10('0x50')](handleError(_0x5cc5f5,null));};exports[_0x5f10('0xbb')]=function(_0x5bf810,_0x4b29e5,_0x158a4a){return db[_0x5f10('0x3e')][_0x5f10('0x36')]({'where':{'id':_0x5bf810['params']['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x4b29e5,null))['then'](function(_0x3b513f){if(_0x3b513f){return _0x3b513f[_0x5f10('0xbb')](_0x5bf810[_0x5f10('0x41')][_0x5f10('0x92')]);}})['then'](function(_0x3d14fb){if(_0x3d14fb){return db['CmHopper'][_0x5f10('0x2b')]({'where':{'ListId':_0x5bf810[_0x5f10('0x41')]['ids'],'VoiceQueueId':_0x5bf810[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](function(){return _0x3d14fb;});}})[_0x5f10('0x2a')](respondWithStatusCode(_0x4b29e5,null))[_0x5f10('0x50')](handleError(_0x4b29e5,null));};exports[_0x5f10('0xbc')]=function(_0x1c21f1,_0x4da9eb,_0x490393){var _0x2754ad={};var _0xe8131={};var _0x4e2d47;var _0x3b5a7d;return db[_0x5f10('0x3e')][_0x5f10('0x61')]({'where':{'id':_0x1c21f1[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x4da9eb,null))['then'](function(_0x3ce863){if(_0x3ce863){_0x4e2d47=_0x3ce863;_0xe8131['model']=_[_0x5f10('0x42')](db[_0x5f10('0x9c')][_0x5f10('0x3f')]);_0xe8131[_0x5f10('0x41')]=_[_0x5f10('0x42')](_0x1c21f1[_0x5f10('0x41')]);_0xe8131[_0x5f10('0x43')]=_[_0x5f10('0x44')](_0xe8131[_0x5f10('0x45')],_0xe8131['query']);_0x2754ad[_0x5f10('0x46')]=_[_0x5f10('0x44')](_0xe8131[_0x5f10('0x45')],qs[_0x5f10('0x47')](_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x47')]));_0x2754ad[_0x5f10('0x46')]=_0x2754ad[_0x5f10('0x46')][_0x5f10('0x48')]?_0x2754ad['attributes']:_0xe8131['model'];_0x2754ad[_0x5f10('0x67')]=qs[_0x5f10('0x4a')](_0x1c21f1['query'][_0x5f10('0x4a')]);_0x2754ad[_0x5f10('0x4b')]=qs[_0x5f10('0x43')](_[_0x5f10('0x63')](_0x1c21f1['query'],_0xe8131[_0x5f10('0x43')]));if(_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x31')]){_0x2754ad['where']=_[_0x5f10('0x5c')](_0x2754ad[_0x5f10('0x4b')],{'$or':_[_0x5f10('0x33')](_0x2754ad[_0x5f10('0x46')],function(_0x130c91){var _0x21baf1={};_0x21baf1[_0x130c91]={'$like':'%'+_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x31')]+'%'};return _0x21baf1;})});}_0x2754ad=_[_0x5f10('0x5c')]({},_0x2754ad,_0x1c21f1[_0x5f10('0x53')]);return _0x4e2d47['getBlackLists'](_0x2754ad);}})['then'](function(_0x38ffed){if(_0x38ffed){_0x3b5a7d=_0x38ffed[_0x5f10('0x48')];if(!_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x49')](_0x5f10('0x62'))){_0x2754ad['limit']=qs[_0x5f10('0x20')](_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x20')]);_0x2754ad[_0x5f10('0x22')]=qs[_0x5f10('0x22')](_0x1c21f1[_0x5f10('0x41')][_0x5f10('0x22')]);}return _0x4e2d47[_0x5f10('0xbc')](_0x2754ad);}})['then'](function(_0x48ea6e){if(_0x48ea6e){return _0x48ea6e?{'count':_0x3b5a7d,'rows':_0x48ea6e}:null;}})[_0x5f10('0x2a')](respondWithResult(_0x4da9eb,null))[_0x5f10('0x50')](handleError(_0x4da9eb,null));};exports[_0x5f10('0xbd')]=function(_0x4e8fd3,_0x310dd2,_0x558d76){var _0x983711,_0x298a28;return db[_0x5f10('0x3e')]['find']({'where':{'id':_0x4e8fd3[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x310dd2,null))[_0x5f10('0x2a')](function(_0x515c78){if(_0x515c78){_0x298a28=_0x515c78;return _0x515c78[_0x5f10('0xbd')](_0x4e8fd3[_0x5f10('0x55')][_0x5f10('0x92')],_[_0x5f10('0x93')](_0x4e8fd3[_0x5f10('0x55')],[_0x5f10('0x92'),'id'])||{});}return null;})[_0x5f10('0x94')](function(_0x1288c0){var _0x1bcf9f;_0x983711=_0x1288c0||[];var _0x5c0f2f=[];if(_0x1288c0){for(var _0x49b264=0x0;_0x49b264<_0x1288c0[_0x5f10('0x48')];_0x49b264+=0x1){var _0x9611e0=_0x1288c0[_0x49b264][_0x5f10('0x2c')]({'plain':!![]});_0x1bcf9f=squel[_0x5f10('0xb2')]()['into']('cm_hopper_black')[_0x5f10('0xa3')]([_0x5f10('0xa6'),_0x5f10('0xa4'),_0x5f10('0xa5'),_0x5f10('0x68'),_0x5f10('0x5d'),_0x5f10('0x5e')],squel[_0x5f10('0xad')]()[_0x5f10('0x82')]('phone',_0x5f10('0xa6'))['field']('id',_0x5f10('0xa4'))['field'](_0x9611e0[_0x5f10('0xa8')]['toString'](),_0x5f10('0xa5'))[_0x5f10('0x82')](_0x4e8fd3['params']['id'][_0x5f10('0x89')](),_0x5f10('0x68'))[_0x5f10('0x82')](_0x5f10('0xbe'),_0x5f10('0x5d'))[_0x5f10('0x82')](_0x5f10('0xbe'),_0x5f10('0x5e'))[_0x5f10('0xa9')](_0x5f10('0xaa'))[_0x5f10('0x4b')](_0x5f10('0xb1'))[_0x5f10('0x4b')](_0x5f10('0xab'),_0x9611e0[_0x5f10('0xa8')][_0x5f10('0x89')]())[_0x5f10('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x5f10('0x89')]();_0x5c0f2f[_0x5f10('0x88')](db[_0x5f10('0x78')][_0x5f10('0x41')](_0x1bcf9f));}return BPromise[_0x5f10('0x8d')](_0x5c0f2f);}})['then'](function(){return _0x983711;})[_0x5f10('0x2a')](respondWithResult(_0x310dd2,null))['catch'](handleError(_0x310dd2,null));};exports[_0x5f10('0xbf')]=function(_0x280616,_0x86ee29,_0x32f06f){return db['VoiceQueue'][_0x5f10('0x36')]({'where':{'id':_0x280616[_0x5f10('0x51')]['id']}})[_0x5f10('0x2a')](handleEntityNotFound(_0x86ee29,null))['then'](function(_0x283e1a){if(_0x283e1a){return _0x283e1a[_0x5f10('0xbf')](_0x280616[_0x5f10('0x41')][_0x5f10('0x92')]);}})[_0x5f10('0x2a')](function(_0x1c41f8){if(_0x1c41f8){return db['CmHopperBlack'][_0x5f10('0x2b')]({'where':{'ListId':_0x280616[_0x5f10('0x41')]['ids'],'VoiceQueueId':_0x280616[_0x5f10('0x51')]['id']}})['then'](function(){return _0x1c41f8;});}})[_0x5f10('0x2a')](respondWithStatusCode(_0x86ee29,null))[_0x5f10('0x50')](handleError(_0x86ee29,null));}; \ No newline at end of file +var _0xa7ee=['Content-Range','json','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','UserProfileResource','end','sendStatus','error','stack','name','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','merge','include','catch','params','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','omit','updatedAt','createdAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','hasOwnProperty','CmHopperHistory','rows','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','Team','ids','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','upsert','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','CmListId','toString','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone','ListId\x20=\x20?','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','ci.OrderBy+1','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','count','limit','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7ee,0x159));var _0xea7e=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xa7ee[_0x1c6089];return _0x4d97c1;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require(_0xea7e('0x2'));var rp=require(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea7e('0x5'));var path=require('path');var sox=require(_0xea7e('0x6'));var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require('lodash');var squel=require(_0xea7e('0xa'));var crypto=require(_0xea7e('0xb'));var jsforce=require(_0xea7e('0xc'));var deskjs=require(_0xea7e('0xd'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea7e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0xf'));var as=require(_0xea7e('0x10'));var hardwareService=require(_0xea7e('0x11'));var logger=require(_0xea7e('0x12'))('api');var utils=require(_0xea7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea7e('0x14'));var db=require(_0xea7e('0x15'))['db'];config[_0xea7e('0x16')]=_[_0xea7e('0x17')](config[_0xea7e('0x16')],{'host':_0xea7e('0x18'),'port':0x18eb});var socket=require(_0xea7e('0x19'))(new Redis(config[_0xea7e('0x16')]));require('./voiceQueue.socket')[_0xea7e('0x1a')](socket);function respondWithStatusCode(_0x3ef916,_0x1a617e){_0x1a617e=_0x1a617e||0xcc;return function(_0x777c57){if(_0x777c57){return _0x3ef916['sendStatus'](_0x1a617e);}return _0x3ef916[_0xea7e('0x1b')](_0x1a617e)['end']();};}function respondWithResult(_0x5c7466,_0x3cd795){_0x3cd795=_0x3cd795||0xc8;return function(_0x2d5794){if(_0x2d5794){return _0x5c7466[_0xea7e('0x1b')](_0x3cd795)['json'](_0x2d5794);}};}function respondWithFilteredResult(_0x5c3b15,_0x13281d){return function(_0x5becf4){if(_0x5becf4){var _0x195d5a=typeof _0x13281d[_0xea7e('0x1c')]==='undefined'&&typeof _0x13281d['limit']===_0xea7e('0x1d');var _0x59e8d8=_0x5becf4['count'];var _0x406aff=_0x195d5a?0x0:_0x13281d['offset'];var _0x373c2c=_0x195d5a?_0x5becf4[_0xea7e('0x1e')]:_0x13281d['offset']+_0x13281d[_0xea7e('0x1f')];var _0x52dfb0;if(_0x373c2c>=_0x59e8d8){_0x373c2c=_0x59e8d8;_0x52dfb0=0xc8;}else{_0x52dfb0=0xce;}_0x5c3b15[_0xea7e('0x1b')](_0x52dfb0);return _0x5c3b15[_0xea7e('0x20')](_0xea7e('0x21'),_0x406aff+'-'+_0x373c2c+'/'+_0x59e8d8)[_0xea7e('0x22')](_0x5becf4);}return null;};}function patchUpdates(_0x372b9d){return function(_0x268511){try{jsonpatch['apply'](_0x268511,_0x372b9d,!![]);}catch(_0xd41599){return BPromise[_0xea7e('0x23')](_0xd41599);}return _0x268511['save']();};}function saveUpdates(_0xb8149f,_0x344ec6){return function(_0xa07c9a){if(_0xa07c9a){return _0xa07c9a['update'](_0xb8149f)[_0xea7e('0x24')](function(_0x400125){return _0x400125;});}return null;};}function removeEntity(_0x41b995,_0x49ce51){return function(_0x456222){if(_0x456222){return _0x456222[_0xea7e('0x25')]()[_0xea7e('0x24')](function(){var _0x7a75a6=_0x456222[_0xea7e('0x26')]({'plain':!![]});var _0x789f9e=[{'name':_0xea7e('0x27'),'value':_0xea7e('0x28'),'ignore':![]},{'name':_0xea7e('0x29'),'value':_0xea7e('0x2a'),'ignore':![]}];var _0x4a23a9=_(_0x789f9e)[_0xea7e('0x2b')](_0xea7e('0x2c'))['map'](_0xea7e('0x2d'))[_0xea7e('0x2d')]();if(_[_0xea7e('0x2e')](_0x4a23a9,_0x7a75a6[_0xea7e('0x2f')])){return;}var _0x33447e=_['find'](_0x789f9e,[_0xea7e('0x2d'),_0x7a75a6[_0xea7e('0x2f')]])['name'];return db[_0xea7e('0x30')][_0xea7e('0x25')]({'where':{'type':_0x33447e,'resourceId':_0x7a75a6['id']}})['then'](function(){return _0x456222;});})[_0xea7e('0x24')](function(){_0x41b995['status'](0xcc)[_0xea7e('0x31')]();});}};}function handleEntityNotFound(_0x17c03c,_0x2e6915){return function(_0x1313f3){if(!_0x1313f3){_0x17c03c[_0xea7e('0x32')](0x194);}return _0x1313f3;};}function handleError(_0x352b07,_0x585218){_0x585218=_0x585218||0x1f4;return function(_0x2a2272){logger[_0xea7e('0x33')](_0x2a2272[_0xea7e('0x34')]);if(_0x2a2272[_0xea7e('0x35')]){delete _0x2a2272[_0xea7e('0x35')];}_0x352b07[_0xea7e('0x1b')](_0x585218)['send'](_0x2a2272);};}exports['index']=function(_0xb53ef9,_0x2b3744){var _0x1260e7={},_0x5e8f90={},_0x2f15a0={'count':0x0,'rows':[]};var _0x3296b9=_[_0xea7e('0x36')](db[_0xea7e('0x37')][_0xea7e('0x38')],function(_0x21ca5f){return{'name':_0x21ca5f[_0xea7e('0x39')],'type':_0x21ca5f[_0xea7e('0x2f')][_0xea7e('0x3a')]};});_0x5e8f90[_0xea7e('0x3b')]=_[_0xea7e('0x36')](_0x3296b9,_0xea7e('0x35'));_0x5e8f90[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0xb53ef9[_0xea7e('0x3c')]);_0x5e8f90['filters']=_[_0xea7e('0x3e')](_0x5e8f90[_0xea7e('0x3b')],_0x5e8f90[_0xea7e('0x3c')]);_0x1260e7[_0xea7e('0x3f')]=_['intersection'](_0x5e8f90[_0xea7e('0x3b')],qs['fields'](_0xb53ef9[_0xea7e('0x3c')]['fields']));_0x1260e7[_0xea7e('0x3f')]=_0x1260e7[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x1260e7[_0xea7e('0x3f')]:_0x5e8f90[_0xea7e('0x3b')];if(!_0xb53ef9[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x1260e7[_0xea7e('0x1f')]=qs['limit'](_0xb53ef9[_0xea7e('0x3c')]['limit']);_0x1260e7[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0xb53ef9['query'][_0xea7e('0x1c')]);}_0x1260e7[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0xb53ef9[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x1260e7[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0xb53ef9[_0xea7e('0x3c')],_0x5e8f90[_0xea7e('0x45')]),_0x3296b9);if(_0xb53ef9[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x1260e7[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x1260e7['where'],{'$or':_['map'](_0x3296b9,function(_0x51000a){if(_0x51000a['type']!=='VIRTUAL'){var _0x5f0fbf={};_0x5f0fbf[_0x51000a[_0xea7e('0x35')]]={'$like':'%'+_0xb53ef9['query'][_0xea7e('0x2b')]+'%'};return _0x5f0fbf;}})});}_0x1260e7=_[_0xea7e('0x47')]({},_0x1260e7,_0xb53ef9['options']);var _0x5c9e86={'where':_0x1260e7[_0xea7e('0x44')]};return db[_0xea7e('0x37')][_0xea7e('0x1e')](_0x5c9e86)[_0xea7e('0x24')](function(_0x521744){_0x2f15a0['count']=_0x521744;if(_0xb53ef9[_0xea7e('0x3c')]['includeAll']){_0x1260e7[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x37')]['findAll'](_0x1260e7);})[_0xea7e('0x24')](function(_0x26a4f5){_0x2f15a0['rows']=_0x26a4f5;return _0x2f15a0;})[_0xea7e('0x24')](respondWithFilteredResult(_0x2b3744,_0x1260e7))[_0xea7e('0x49')](handleError(_0x2b3744,null));};exports['show']=function(_0x5111a6,_0x231e67){var _0x303877={'raw':![],'where':{'id':_0x5111a6[_0xea7e('0x4a')]['id']}},_0x52d0a5={};_0x52d0a5[_0xea7e('0x3b')]=_['keys'](db[_0xea7e('0x37')][_0xea7e('0x38')]);_0x52d0a5[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x5111a6[_0xea7e('0x3c')]);_0x52d0a5[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x52d0a5['model'],_0x52d0a5[_0xea7e('0x3c')]);_0x303877[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x52d0a5[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x5111a6[_0xea7e('0x3c')]['fields']));_0x303877[_0xea7e('0x3f')]=_0x303877[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x303877[_0xea7e('0x3f')]:_0x52d0a5[_0xea7e('0x3b')];if(_0x5111a6[_0xea7e('0x3c')]['includeAll']){_0x303877[_0xea7e('0x48')]=[{'all':!![]}];}_0x303877=_[_0xea7e('0x47')]({},_0x303877,_0x5111a6[_0xea7e('0x4c')]);return db['VoiceQueue'][_0xea7e('0x4d')](_0x303877)[_0xea7e('0x24')](handleEntityNotFound(_0x231e67,null))['then'](respondWithResult(_0x231e67,null))[_0xea7e('0x49')](handleError(_0x231e67,null));};exports[_0xea7e('0x4e')]=function(_0xd8908e,_0x2729df){return db[_0xea7e('0x37')][_0xea7e('0x4e')](_0xd8908e[_0xea7e('0x4f')],{})[_0xea7e('0x24')](function(_0x3a2912){var _0x4c2c73=_0xd8908e['user'][_0xea7e('0x26')]({'plain':!![]});if(!_0x4c2c73)throw new Error(_0xea7e('0x50'));if(_0x4c2c73['role']===_0xea7e('0x51')){var _0x5b0bcb=_0x3a2912[_0xea7e('0x26')]({'plain':!![]});var _0x40f092=[{'name':_0xea7e('0x27'),'value':'inbound'},{'name':_0xea7e('0x29'),'value':_0xea7e('0x2a')}];var _0x3eb694=_[_0xea7e('0x4d')](_0x40f092,[_0xea7e('0x2d'),_0x5b0bcb['type']])['name'];return db[_0xea7e('0x52')][_0xea7e('0x4d')]({'where':{'name':_0x3eb694,'userProfileId':_0x4c2c73[_0xea7e('0x53')]},'raw':!![]})[_0xea7e('0x24')](function(_0x57ee06){if(_0x57ee06&&_0x57ee06[_0xea7e('0x54')]===0x0){return db[_0xea7e('0x30')][_0xea7e('0x4e')]({'name':_0x5b0bcb[_0xea7e('0x35')],'resourceId':_0x5b0bcb['id'],'type':_0x57ee06[_0xea7e('0x35')],'sectionId':_0x57ee06['id']},{})['then'](function(){return _0x3a2912;});}else{return _0x3a2912;}})['catch'](function(_0xca2af3){logger[_0xea7e('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xca2af3);throw _0xca2af3;});}return _0x3a2912;})[_0xea7e('0x24')](respondWithResult(_0x2729df,0xc9))[_0xea7e('0x49')](handleError(_0x2729df,null));};exports[_0xea7e('0x55')]=function(_0x107727,_0x2c6008){var _0x4dae8b={'where':{'id':_0x107727[_0xea7e('0x4a')]['id']}},_0x5485ac={};_0x5485ac[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x37')][_0xea7e('0x38')]);_0x4dae8b[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x5485ac['model'],qs['fields'](_0x107727['query'][_0xea7e('0x4b')]));_0x4dae8b[_0xea7e('0x3f')]=_0x4dae8b['attributes'][_0xea7e('0x40')]?_0x4dae8b[_0xea7e('0x3f')]:_0x5485ac['model'];if(_0x107727[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x4dae8b['include']=[{'all':!![]}];}_0x4dae8b=_[_0xea7e('0x47')]({},_0x4dae8b,_0x107727[_0xea7e('0x4c')]);return db[_0xea7e('0x37')][_0xea7e('0x4d')](_0x4dae8b)[_0xea7e('0x24')](handleEntityNotFound(_0x2c6008,null))['then'](function(_0x519d75){if(_0x519d75){var _0x1a47dd=_0x519d75[_0xea7e('0x26')]({'plain':!![]});_0x1a47dd=qs[_0xea7e('0x57')](_0x1a47dd,['id','createdAt',_0xea7e('0x58')]);_0x107727[_0xea7e('0x4f')]=_[_0xea7e('0x57')](_0x107727[_0xea7e('0x4f')],['id',_0xea7e('0x59'),'updatedAt']);return db['VoiceQueue'][_0xea7e('0x4e')](_[_0xea7e('0x47')](_0x1a47dd,_0x107727['body']),{'include':_0x107727[_0xea7e('0x3c')][_0xea7e('0x56')]?[{'all':!![]}]:undefined})['then'](function(_0x2673f9){var _0x3e90b2=_0x107727[_0xea7e('0x51')][_0xea7e('0x26')]({'plain':!![]});if(!_0x3e90b2)throw new Error(_0xea7e('0x50'));if(_0x3e90b2[_0xea7e('0x5a')]==='user'){var _0x2cdc7b=_0x2673f9['get']({'plain':!![]});var _0x25566d=[{'name':_0xea7e('0x27'),'value':_0xea7e('0x28')},{'name':_0xea7e('0x29'),'value':'outbound'}];var _0x3d5022=_['find'](_0x25566d,[_0xea7e('0x2d'),_0x2cdc7b[_0xea7e('0x2f')]])['name'];return db[_0xea7e('0x52')][_0xea7e('0x4d')]({'where':{'name':_0x3d5022,'userProfileId':_0x3e90b2[_0xea7e('0x53')]},'raw':!![]})['then'](function(_0x306937){if(_0x306937&&_0x306937['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2cdc7b[_0xea7e('0x35')],'resourceId':_0x2cdc7b['id'],'type':_0x306937['name'],'sectionId':_0x306937['id']},{})['then'](function(){return _0x2673f9;});}else{return _0x2673f9;}})[_0xea7e('0x49')](function(_0x2ac5f0){logger[_0xea7e('0x33')](_0xea7e('0x5b'),_0x2ac5f0);throw _0x2ac5f0;});}return _0x2673f9;});}})[_0xea7e('0x24')](respondWithResult(_0x2c6008,0xc9))['catch'](handleError(_0x2c6008,null));};exports[_0xea7e('0x5c')]=function(_0x480249,_0x5d3c5e){if(_0x480249[_0xea7e('0x4f')]['id']){delete _0x480249[_0xea7e('0x4f')]['id'];}return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x480249[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d3c5e,null))['then'](saveUpdates(_0x480249['body'],null))['then'](respondWithResult(_0x5d3c5e,null))[_0xea7e('0x49')](handleError(_0x5d3c5e,null));};exports['destroy']=function(_0x2c10a6,_0x4c3872){return db[_0xea7e('0x37')]['find']({'where':{'id':_0x2c10a6['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x4c3872,null))[_0xea7e('0x24')](removeEntity(_0x4c3872,null))['catch'](handleError(_0x4c3872,null));};exports[_0xea7e('0x5d')]=function(_0x187e91,_0x3f577f,_0x1afec5){var _0x1314d0={'raw':![],'where':{}};var _0x4411c7={};var _0x21d447={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x187e91[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3f577f,null))['then'](function(_0x153a25){if(_0x153a25){_0x4411c7[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['CmHopper'][_0xea7e('0x38')]);_0x4411c7[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x187e91[_0xea7e('0x3c')]);_0x4411c7[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x4411c7[_0xea7e('0x3b')],_0x4411c7[_0xea7e('0x3c')]);_0x1314d0[_0xea7e('0x3f')]=_['intersection'](_0x4411c7[_0xea7e('0x3b')],qs['fields'](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x1314d0['attributes']=_0x1314d0['attributes'][_0xea7e('0x40')]?_0x1314d0['attributes']:_0x4411c7['model'];if(!_0x187e91[_0xea7e('0x3c')]['hasOwnProperty']('nolimit')){_0x1314d0[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x1314d0[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x1c')]);}_0x1314d0[_0xea7e('0x42')]=qs['sort'](_0x187e91['query'][_0xea7e('0x43')]);_0x1314d0[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x187e91[_0xea7e('0x3c')],_0x4411c7[_0xea7e('0x45')]));_0x1314d0[_0xea7e('0x44')][_0xea7e('0x5f')]=_0x153a25['id'];if(_0x187e91[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x1314d0[_0xea7e('0x44')]=_['merge'](_0x1314d0[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x1314d0[_0xea7e('0x3f')],function(_0x1b5bdb){var _0xef557e={};_0xef557e[_0x1b5bdb]={'$like':'%'+_0x187e91[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0xef557e;})});}_0x1314d0=_[_0xea7e('0x47')]({},_0x1314d0,_0x187e91[_0xea7e('0x4c')]);return db['CmHopper'][_0xea7e('0x1e')]({'where':_0x1314d0[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x2ddff1){_0x21d447[_0xea7e('0x1e')]=_0x2ddff1;if(_0x187e91[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x1314d0[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x60')]['findAll'](_0x1314d0);})[_0xea7e('0x24')](function(_0x1d9f7a){_0x21d447['rows']=_0x1d9f7a;return _0x21d447;});}})[_0xea7e('0x24')](respondWithFilteredResult(_0x3f577f,_0x1314d0))['catch'](handleError(_0x3f577f,null));};exports[_0xea7e('0x61')]=function(_0x5eaa32,_0x42f38f,_0x45feeb){var _0x297238={'raw':!![],'where':{}};var _0x11b8d9={};var _0x51dcc5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xea7e('0x5e')]({'where':{'id':_0x5eaa32[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f38f,null))[_0xea7e('0x24')](function(_0x531f14){if(_0x531f14){_0x11b8d9[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['CmHopperHistory'][_0xea7e('0x38')]);_0x11b8d9[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x5eaa32[_0xea7e('0x3c')]);_0x11b8d9['filters']=_[_0xea7e('0x3e')](_0x11b8d9[_0xea7e('0x3b')],_0x11b8d9[_0xea7e('0x3c')]);_0x297238['attributes']=_[_0xea7e('0x3e')](_0x11b8d9[_0xea7e('0x3b')],qs['fields'](_0x5eaa32['query'][_0xea7e('0x4b')]));_0x297238[_0xea7e('0x3f')]=_0x297238['attributes']['length']?_0x297238['attributes']:_0x11b8d9[_0xea7e('0x3b')];if(!_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0x297238[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x5eaa32[_0xea7e('0x3c')]['limit']);_0x297238['offset']=qs[_0xea7e('0x1c')](_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x1c')]);}_0x297238['order']=qs[_0xea7e('0x43')](_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x297238[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x5eaa32[_0xea7e('0x3c')],_0x11b8d9[_0xea7e('0x45')]));_0x297238[_0xea7e('0x44')]['VoiceQueueId']=_0x531f14['id'];if(_0x5eaa32[_0xea7e('0x3c')]['filter']){_0x297238[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x297238[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x297238['attributes'],function(_0x46146e){var _0x12bf32={};_0x12bf32[_0x46146e]={'$like':'%'+_0x5eaa32['query'][_0xea7e('0x2b')]+'%'};return _0x12bf32;})});}_0x297238=_[_0xea7e('0x47')]({},_0x297238,_0x5eaa32[_0xea7e('0x4c')]);return db['CmHopperHistory']['count']({'where':_0x297238[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x35af58){_0x51dcc5[_0xea7e('0x1e')]=_0x35af58;if(_0x5eaa32[_0xea7e('0x3c')]['includeAll']){_0x297238[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x63')]['findAll'](_0x297238);})['then'](function(_0x30c696){_0x51dcc5[_0xea7e('0x64')]=_0x30c696;return _0x51dcc5;});}})['then'](respondWithFilteredResult(_0x42f38f,_0x297238))[_0xea7e('0x49')](handleError(_0x42f38f,null));};exports['getHopperFinals']=function(_0x27feb2,_0x3b439e,_0x454221){var _0x199ddf={'raw':!![],'where':{}};var _0x2c3233={};var _0x136719={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x27feb2[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3b439e,null))['then'](function(_0x4876be){if(_0x4876be){_0x2c3233[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x65')][_0xea7e('0x38')]);_0x2c3233[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x27feb2[_0xea7e('0x3c')]);_0x2c3233[_0xea7e('0x45')]=_['intersection'](_0x2c3233['model'],_0x2c3233[_0xea7e('0x3c')]);_0x199ddf['attributes']=_[_0xea7e('0x3e')](_0x2c3233[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x199ddf[_0xea7e('0x3f')]=_0x199ddf[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x199ddf['attributes']:_0x2c3233['model'];if(!_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x199ddf[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x199ddf[_0xea7e('0x1c')]=qs['offset'](_0x27feb2['query']['offset']);}_0x199ddf['order']=qs['sort'](_0x27feb2[_0xea7e('0x3c')]['sort']);_0x199ddf[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x27feb2['query'],_0x2c3233[_0xea7e('0x45')]));_0x199ddf[_0xea7e('0x44')]['VoiceQueueId']=_0x4876be['id'];if(_0x27feb2[_0xea7e('0x3c')]['filter']){_0x199ddf[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x199ddf[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x199ddf[_0xea7e('0x3f')],function(_0x1ef641){var _0x585a9a={};_0x585a9a[_0x1ef641]={'$like':'%'+_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x585a9a;})});}_0x199ddf=_['merge']({},_0x199ddf,_0x27feb2[_0xea7e('0x4c')]);return db[_0xea7e('0x65')]['count']({'where':_0x199ddf[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x2a4a91){_0x136719['count']=_0x2a4a91;if(_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x199ddf[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x65')][_0xea7e('0x66')](_0x199ddf);})[_0xea7e('0x24')](function(_0x2cb637){_0x136719[_0xea7e('0x64')]=_0x2cb637;return _0x136719;});}})['then'](respondWithFilteredResult(_0x3b439e,_0x199ddf))[_0xea7e('0x49')](handleError(_0x3b439e,null));};exports[_0xea7e('0x67')]=function(_0xa64d10,_0x238f77,_0x32b2a8){var _0x480793={'raw':!![],'where':{}};var _0x3a63da={};var _0x19860e={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0xa64d10[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x238f77,null))[_0xea7e('0x24')](function(_0x49cfa6){if(_0x49cfa6){_0x3a63da['model']=_['keys'](db[_0xea7e('0x68')][_0xea7e('0x38')]);_0x3a63da[_0xea7e('0x3c')]=_['keys'](_0xa64d10[_0xea7e('0x3c')]);_0x3a63da['filters']=_['intersection'](_0x3a63da[_0xea7e('0x3b')],_0x3a63da[_0xea7e('0x3c')]);_0x480793[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x3a63da[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0xa64d10[_0xea7e('0x3c')]['fields']));_0x480793[_0xea7e('0x3f')]=_0x480793[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x480793['attributes']:_0x3a63da[_0xea7e('0x3b')];if(!_0xa64d10[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x480793[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x480793[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0xa64d10['query'][_0xea7e('0x1c')]);}_0x480793['order']=qs['sort'](_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x480793[_0xea7e('0x44')]=qs['filters'](_[_0xea7e('0x46')](_0xa64d10[_0xea7e('0x3c')],_0x3a63da['filters']));_0x480793['where'][_0xea7e('0x5f')]=_0x49cfa6['id'];if(_0xa64d10[_0xea7e('0x3c')]['filter']){_0x480793[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x480793[_0xea7e('0x44')],{'$or':_['map'](_0x480793[_0xea7e('0x3f')],function(_0x2a0ef7){var _0x2a3a74={};_0x2a3a74[_0x2a0ef7]={'$like':'%'+_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x2a3a74;})});}_0x480793=_[_0xea7e('0x47')]({},_0x480793,_0xa64d10[_0xea7e('0x4c')]);return db[_0xea7e('0x68')][_0xea7e('0x1e')]({'where':_0x480793[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x540147){_0x19860e[_0xea7e('0x1e')]=_0x540147;if(_0xa64d10[_0xea7e('0x3c')]['includeAll']){_0x480793[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x68')]['findAll'](_0x480793);})[_0xea7e('0x24')](function(_0x358637){_0x19860e[_0xea7e('0x64')]=_0x358637;return _0x19860e;});}})[_0xea7e('0x24')](respondWithFilteredResult(_0x238f77,_0x480793))[_0xea7e('0x49')](handleError(_0x238f77,null));};exports[_0xea7e('0x69')]=function(_0x279a39,_0x380df5,_0x5c9349){var _0x4085c8={};var _0x28b002={};var _0x4036c3;var _0x2f4f1d;return db['VoiceQueue']['findOne']({'where':{'id':_0x279a39[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x380df5,null))[_0xea7e('0x24')](function(_0x212a8c){if(_0x212a8c){_0x4036c3=_0x212a8c;_0x28b002[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['Team'][_0xea7e('0x38')]);_0x28b002[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x279a39['query']);_0x28b002[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x28b002[_0xea7e('0x3b')],_0x28b002[_0xea7e('0x3c')]);_0x4085c8[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x28b002[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x4085c8[_0xea7e('0x3f')]=_0x4085c8[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x4085c8['attributes']:_0x28b002[_0xea7e('0x3b')];_0x4085c8[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x4085c8[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x279a39[_0xea7e('0x3c')],_0x28b002['filters']));if(_0x279a39[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x4085c8[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x4085c8[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x4085c8[_0xea7e('0x3f')],function(_0x33e288){var _0x516fdb={};_0x516fdb[_0x33e288]={'$like':'%'+_0x279a39[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x516fdb;})});}_0x4085c8=_[_0xea7e('0x47')]({},_0x4085c8,_0x279a39['options']);return _0x4036c3[_0xea7e('0x69')](_0x4085c8);}})[_0xea7e('0x24')](function(_0x3c7c6a){if(_0x3c7c6a){_0x2f4f1d=_0x3c7c6a[_0xea7e('0x40')];if(!_0x279a39[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x4085c8[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x4085c8[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x4036c3[_0xea7e('0x69')](_0x4085c8);}})['then'](function(_0x246114){if(_0x246114){return _0x246114?{'count':_0x2f4f1d,'rows':_0x246114}:null;}})[_0xea7e('0x24')](respondWithResult(_0x380df5,null))[_0xea7e('0x49')](handleError(_0x380df5,null));};exports[_0xea7e('0x6a')]=function(_0x2d5489,_0x23ca75,_0x3bf4e9){var _0x575b8e=_0x2d5489[_0xea7e('0x4f')]['teams'];var _0x4be089=_[_0xea7e('0x36')](_0x575b8e,'id');return db['Team'][_0xea7e('0x66')]({'where':{'id':_0x4be089},'attributes':['id'],'include':[{'model':db[_0xea7e('0x6b')],'as':'Agents','attributes':['id',_0xea7e('0x35'),_0xea7e('0x6c'),_0xea7e('0x6d'),_0xea7e('0x6e')],'raw':!![]}]})['then'](function(_0x11d27c){if(_0x11d27c){var _0x12e5f0=_[_0xea7e('0x6f')](_0x11d27c,function(_0x3a0425){var _0x3d734d=_0x3a0425[_0xea7e('0x26')]({'plain':!![]});_0x3d734d[_0xea7e('0x70')][_0xea7e('0x71')](function(_0x37ba95){_0x37ba95[_0xea7e('0x72')]=_[_0xea7e('0x4d')](_0x575b8e,{'id':_0x3d734d['id']})[_0xea7e('0x72')];});return _0x3d734d['Agents'];});return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x2d5489[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(_0x2f9b66){return db[_0xea7e('0x73')][_0xea7e('0x74')](function(_0x21ae65){return _0x2f9b66[_0xea7e('0x6a')](_0x4be089,{'transaction':_0x21ae65})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_0x575b8e,function(_0x38bedf){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x38bedf['id'],'VoiceQueueId':_0x2d5489[_0xea7e('0x4a')]['id'],'penalty':_0x38bedf[_0xea7e('0x72')]},{'transaction':_0x21ae65});});})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_0x12e5f0,function(_0x32379b){return db[_0xea7e('0x76')][_0xea7e('0x77')]({'where':{'UserId':_0x32379b['id'],'VoiceQueueId':_0x2d5489['params']['id']},'defaults':{'penalty':_0x32379b[_0xea7e('0x72')]},'transaction':_0x21ae65});});})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_[_0xea7e('0x2b')](_0x12e5f0,{'online':!![]}),function(_0x3392c7){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3392c7[_0xea7e('0x35')],'UserId':_0x3392c7['id'],'queue_name':_0x2f9b66[_0xea7e('0x35')],'VoiceQueueId':_0x2f9b66['id'],'interface':_[_0xea7e('0x78')](_0x3392c7['interface'])?util[_0xea7e('0x79')](_0xea7e('0x7a'),_0x3392c7[_0xea7e('0x35')]):_0x3392c7['interface'],'paused':_0x3392c7[_0xea7e('0x6d')]||![],'penalty':_0x3392c7[_0xea7e('0x72')]},{'transaction':_0x21ae65});});})['then'](function(){_0x12e5f0[_0xea7e('0x71')](function(_0x374318){socket[_0xea7e('0x7b')](_0xea7e('0x7c'),{'UserId':_0x374318['id'],'VoiceQueueId':_0x2f9b66['id']});});});});});}})[_0xea7e('0x24')](respondWithStatusCode(_0x23ca75,null))[_0xea7e('0x49')](handleError(_0x23ca75,null));};exports[_0xea7e('0x7d')]=function(_0x44bc96,_0x81cee0,_0x4fc137){return db[_0xea7e('0x7e')][_0xea7e('0x66')]({'where':{'id':_0x44bc96['query'][_0xea7e('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xea7e('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea7e('0x24')](handleEntityNotFound(_0x81cee0,null))['then'](function(_0x114ce9){var _0x90ca0f=_[_0xea7e('0x36')](_0x114ce9,'id');var _0x58f173=[];var _0x3665a0=[];var _0x11cf34=squel['select']();_0x11cf34[_0xea7e('0x80')](_0xea7e('0x81'))[_0xea7e('0x82')](_0xea7e('0x83'),'tq')[_0xea7e('0x84')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xea7e('0x44')](_0xea7e('0x85'),_0x44bc96[_0xea7e('0x4a')]['id']);for(var _0x392dc9=0x0;_0x392dc9<_0x114ce9[_0xea7e('0x40')];_0x392dc9+=0x1){let _0x1704dc=_0x114ce9[_0x392dc9];for(var _0x1fbcef=0x0;_0x1fbcef<_0x1704dc[_0xea7e('0x70')][_0xea7e('0x40')];_0x1fbcef+=0x1){let _0x59fdcb=_0x1704dc[_0xea7e('0x70')][_0x1fbcef];var _0x4242f0=_0x11cf34[_0xea7e('0x55')]();_0x4242f0[_0xea7e('0x44')](_0xea7e('0x86'),_0x59fdcb['id']);_0x3665a0[_0xea7e('0x87')](db[_0xea7e('0x73')][_0xea7e('0x3c')](_0x4242f0['toString'](),{'type':db[_0xea7e('0x73')][_0xea7e('0x88')][_0xea7e('0x89')]})[_0xea7e('0x24')](function(_0x37c06c){if(_0x37c06c['length']===0x1){return _0x59fdcb['id'];}else{var _0x33e9bd=_[_0xea7e('0x8a')](_[_0xea7e('0x36')](_0x37c06c,_0xea7e('0x8b')),function(_0xab11ef){return _[_0xea7e('0x2e')](_0x90ca0f,_0xab11ef);});if(_0x33e9bd){return _0x59fdcb['id'];}}}));}}return BPromise[_0xea7e('0x8c')](_0x3665a0)[_0xea7e('0x24')](function(_0x59a97d){_0x58f173=_(_0x58f173)[_0xea7e('0x8d')](_0x59a97d)[_0xea7e('0x8e')]()[_0xea7e('0x2d')]();return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x44bc96[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(_0x485b3f){return db['sequelize']['transaction'](function(_0x3c1cd2){return _0x485b3f[_0xea7e('0x7d')](_0x44bc96['query'][_0xea7e('0x7f')],{'transaction':_0x3c1cd2})[_0xea7e('0x24')](function(){if(!_[_0xea7e('0x8f')](_0x58f173)){return _0x485b3f[_0xea7e('0x90')](_0x58f173,{'transaction':_0x3c1cd2})['then'](function(){return db[_0xea7e('0x91')][_0xea7e('0x25')]({'where':{'VoiceQueueId':_0x44bc96[_0xea7e('0x4a')]['id'],'UserId':_0x58f173},'transaction':_0x3c1cd2});});}})[_0xea7e('0x24')](function(){_0x58f173[_0xea7e('0x71')](function(_0x3b7e6a){socket[_0xea7e('0x7b')]('userVoiceQueue:remove',{'UserId':_0x3b7e6a,'VoiceQueueId':_0x485b3f['id']});});});});});});})[_0xea7e('0x24')](respondWithStatusCode(_0x81cee0,null))['catch'](handleError(_0x81cee0,null));};exports[_0xea7e('0x92')]=function(_0x21046d,_0x38a18f,_0x38e3e7){var _0x581b09,_0x21f947;return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x21046d['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x38a18f,null))[_0xea7e('0x24')](function(_0x3d6768){if(_0x3d6768){_0x21f947=_0x3d6768;return _0x3d6768[_0xea7e('0x92')](_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')],_[_0xea7e('0x57')](_0x21046d['body'],[_0xea7e('0x7f'),'id'])||{})[_0xea7e('0x93')](function(_0x15ca7f){for(var _0x366597=0x0;_0x366597<_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')]['length'];_0x366597+=0x1){socket['emit'](_0xea7e('0x7c'),{'UserId':Number(_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')][_0x366597]),'VoiceQueueId':Number(_0x21046d['params']['id'])});}return _0x15ca7f;});}})[_0xea7e('0x24')](function(_0x390136){_0x581b09=_0x390136||[];if(_0x21f947){return db[_0xea7e('0x6b')][_0xea7e('0x66')]({'where':{'id':_0x21046d[_0xea7e('0x4f')]['ids']},'attributes':['id',_0xea7e('0x35'),'online',_0xea7e('0x6d'),'interface'],'raw':!![]});}})['then'](function(_0x228468){if(!_['isEmpty'](_0x228468)){var _0x3e8cdf=[];for(var _0xc79990=0x0;_0xc79990<_0x228468['length'];_0xc79990++){if(_0x228468[_0xc79990][_0xea7e('0x6c')]){_0x3e8cdf[_0xea7e('0x87')](db['UserVoiceQueueRt'][_0xea7e('0x94')]({'membername':_0x228468[_0xc79990][_0xea7e('0x35')],'UserId':_0x228468[_0xc79990]['id'],'queue_name':_0x21f947[_0xea7e('0x35')],'VoiceQueueId':_0x21f947['id'],'interface':_[_0xea7e('0x78')](_0x228468[_0xc79990][_0xea7e('0x6e')])?util[_0xea7e('0x79')]('SIP/%s',_0x228468[_0xc79990][_0xea7e('0x35')]):_0x228468[_0xc79990]['interface'],'paused':_0x228468[_0xc79990]['voicePause']||![],'penalty':_0x21046d[_0xea7e('0x4f')][_0xea7e('0x72')]||0x0}));}}return BPromise[_0xea7e('0x8c')](_0x3e8cdf);}})['then'](function(){return _0x581b09;})[_0xea7e('0x24')](respondWithResult(_0x38a18f,null))[_0xea7e('0x49')](handleError(_0x38a18f,null));};exports[_0xea7e('0x90')]=function(_0xbc313b,_0x552ecd,_0x1ebf33){return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0xbc313b['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x552ecd,null))['then'](function(_0xcc464f){if(_0xcc464f){return _0xcc464f[_0xea7e('0x90')](_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')])[_0xea7e('0x24')](function(){if(_[_0xea7e('0x95')](_0xbc313b['query'][_0xea7e('0x7f')])){for(var _0x49b1e0=0x0;_0x49b1e0<_0xbc313b[_0xea7e('0x3c')]['ids'][_0xea7e('0x40')];_0x49b1e0+=0x1){socket[_0xea7e('0x7b')](_0xea7e('0x96'),{'UserId':Number(_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')][_0x49b1e0]),'VoiceQueueId':Number(_0xbc313b['params']['id'])});}}else{socket[_0xea7e('0x7b')](_0xea7e('0x96'),{'UserId':Number(_0xbc313b[_0xea7e('0x3c')]['ids']),'VoiceQueueId':Number(_0xbc313b[_0xea7e('0x4a')]['id'])});}});}})['then'](function(_0x5259e7){return db[_0xea7e('0x91')][_0xea7e('0x25')]({'where':{'VoiceQueueId':_0xbc313b[_0xea7e('0x4a')]['id'],'UserId':_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')]}})[_0xea7e('0x24')](function(){return _0x5259e7;});})['then'](respondWithStatusCode(_0x552ecd,null))['catch'](handleError(_0x552ecd,null));};exports[_0xea7e('0x97')]=function(_0x34c244,_0x410023,_0x7583bf){var _0xdbe2eb={};var _0x197259={};var _0x3210dc;var _0x18d9a2;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x34c244[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x410023,null))[_0xea7e('0x24')](function(_0x34cbb1){if(_0x34cbb1){_0x3210dc=_0x34cbb1;_0x197259['model']=_[_0xea7e('0x3d')](db[_0xea7e('0x6b')]['rawAttributes']);_0x197259[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x34c244[_0xea7e('0x3c')]);_0x197259[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x197259[_0xea7e('0x3b')],_0x197259[_0xea7e('0x3c')]);_0xdbe2eb[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x197259[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x34c244[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0xdbe2eb[_0xea7e('0x3f')]=_0xdbe2eb[_0xea7e('0x3f')][_0xea7e('0x40')]?_0xdbe2eb[_0xea7e('0x3f')]:_0x197259[_0xea7e('0x3b')];_0xdbe2eb[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x34c244[_0xea7e('0x3c')]['sort']);_0xdbe2eb['where']=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x34c244[_0xea7e('0x3c')],_0x197259[_0xea7e('0x45')]));if(_0x34c244[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0xdbe2eb[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0xdbe2eb[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0xdbe2eb['attributes'],function(_0x17def9){var _0x514949={};_0x514949[_0x17def9]={'$like':'%'+_0x34c244['query'][_0xea7e('0x2b')]+'%'};return _0x514949;})});}_0xdbe2eb=_[_0xea7e('0x47')]({},_0xdbe2eb,_0x34c244['options']);return _0x3210dc[_0xea7e('0x97')](_0xdbe2eb);}})[_0xea7e('0x24')](function(_0x502a5f){if(_0x502a5f){_0x18d9a2=_0x502a5f[_0xea7e('0x40')];if(!_0x34c244[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0xdbe2eb[_0xea7e('0x1f')]=qs['limit'](_0x34c244[_0xea7e('0x3c')]['limit']);_0xdbe2eb[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x34c244['query'][_0xea7e('0x1c')]);}return _0x3210dc[_0xea7e('0x97')](_0xdbe2eb);}})[_0xea7e('0x24')](function(_0x6dd8a7){if(_0x6dd8a7){return _0x6dd8a7?{'count':_0x18d9a2,'rows':_0x6dd8a7}:null;}})[_0xea7e('0x24')](respondWithResult(_0x410023,null))['catch'](handleError(_0x410023,null));};exports['getMembers']=function(_0x38e27b,_0x3d9529,_0x4b47e){var _0x13aa87={};var _0x2c7e67={};var _0x2ff014;var _0x4d36d5;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x38e27b[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3d9529,null))[_0xea7e('0x24')](function(_0x343fd4){if(_0x343fd4){_0x2ff014=_0x343fd4;_0x2c7e67[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x91')]['rawAttributes']);_0x2c7e67['query']=_[_0xea7e('0x3d')](_0x38e27b[_0xea7e('0x3c')]);_0x2c7e67[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x2c7e67['model'],_0x2c7e67['query']);_0x13aa87[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x2c7e67[_0xea7e('0x3b')],qs['fields'](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x13aa87[_0xea7e('0x3f')]=_0x13aa87['attributes']['length']?_0x13aa87['attributes']:_0x2c7e67['model'];_0x13aa87[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x38e27b[_0xea7e('0x3c')]['sort']);_0x13aa87[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x38e27b[_0xea7e('0x3c')],_0x2c7e67[_0xea7e('0x45')]));if(_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x13aa87['where']=_[_0xea7e('0x47')](_0x13aa87['where'],{'$or':_[_0xea7e('0x36')](_0x13aa87[_0xea7e('0x3f')],function(_0x24a2d3){var _0xae2246={};_0xae2246[_0x24a2d3]={'$like':'%'+_0x38e27b['query'][_0xea7e('0x2b')]+'%'};return _0xae2246;})});}_0x13aa87=_[_0xea7e('0x47')]({},_0x13aa87,_0x38e27b[_0xea7e('0x4c')]);return _0x2ff014[_0xea7e('0x98')](_0x13aa87);}})[_0xea7e('0x24')](function(_0x506130){if(_0x506130){_0x4d36d5=_0x506130[_0xea7e('0x40')];if(!_0x38e27b[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x13aa87[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x13aa87[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x2ff014[_0xea7e('0x98')](_0x13aa87);}})['then'](function(_0xf7e451){return _0xf7e451?{'count':_0x4d36d5,'rows':_0xf7e451}:null;})[_0xea7e('0x24')](respondWithResult(_0x3d9529,null))[_0xea7e('0x49')](handleError(_0x3d9529,null));};exports['getLists']=function(_0x4d0bf2,_0x469612,_0x1d6e2a){var _0x25b5f6={};var _0x124609={};var _0x22e8aa;var _0x523fa5;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x4d0bf2['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x469612,null))[_0xea7e('0x24')](function(_0x587def){if(_0x587def){_0x22e8aa=_0x587def;_0x124609[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x99')][_0xea7e('0x38')]);_0x124609[_0xea7e('0x3c')]=_['keys'](_0x4d0bf2[_0xea7e('0x3c')]);_0x124609[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x124609['model'],_0x124609[_0xea7e('0x3c')]);_0x25b5f6['attributes']=_[_0xea7e('0x3e')](_0x124609['model'],qs['fields'](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x25b5f6[_0xea7e('0x3f')]=_0x25b5f6[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x25b5f6[_0xea7e('0x3f')]:_0x124609[_0xea7e('0x3b')];_0x25b5f6[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x4d0bf2[_0xea7e('0x3c')]['sort']);_0x25b5f6[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_['pick'](_0x4d0bf2['query'],_0x124609[_0xea7e('0x45')]));if(_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x25b5f6['where']=_[_0xea7e('0x47')](_0x25b5f6[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x25b5f6[_0xea7e('0x3f')],function(_0x36ae6f){var _0x26c13d={};_0x26c13d[_0x36ae6f]={'$like':'%'+_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x26c13d;})});}_0x25b5f6=_[_0xea7e('0x47')]({},_0x25b5f6,_0x4d0bf2[_0xea7e('0x4c')]);return _0x22e8aa[_0xea7e('0x9a')](_0x25b5f6);}})[_0xea7e('0x24')](function(_0x4881d0){if(_0x4881d0){_0x523fa5=_0x4881d0[_0xea7e('0x40')];if(!_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0x25b5f6[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x25b5f6[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x22e8aa[_0xea7e('0x9a')](_0x25b5f6);}})['then'](function(_0x2ea6de){if(_0x2ea6de){return _0x2ea6de?{'count':_0x523fa5,'rows':_0x2ea6de}:null;}})[_0xea7e('0x24')](respondWithResult(_0x469612,null))['catch'](handleError(_0x469612,null));};exports[_0xea7e('0x9b')]=function(_0x210f3e,_0x448388,_0x24d1c1){var _0x207a7c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1a1ff8,_0x2764f7;return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x210f3e[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x448388,null))[_0xea7e('0x24')](function(_0x1d9992){if(_0x1d9992){_0x2764f7=_0x1d9992;return _0x1d9992[_0xea7e('0x9b')](_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x7f')],_[_0xea7e('0x57')](_0x210f3e[_0xea7e('0x4f')],[_0xea7e('0x7f'),'id'])||{});}return null;})[_0xea7e('0x93')](function(_0x26a226){var _0x5891fe;_0x1a1ff8=_0x26a226||[];var _0x5d599f=[];if(_0x26a226){for(var _0x20f41f=0x0;_0x20f41f<_0x26a226[_0xea7e('0x40')];_0x20f41f+=0x1){var _0x4c5463=_0x26a226[_0x20f41f][_0xea7e('0x26')]({'plain':!![]});_0x2764f7['dialCheckDuplicateType']=_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x9c')]?_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x9c')]:_0x2764f7[_0xea7e('0x9c')];switch(_0x2764f7['dialCheckDuplicateType']){case'always':_0x5891fe=squel[_0xea7e('0x9d')]()[_0xea7e('0x9e')](_0xea7e('0x9f'))['fromQuery'](['phone',_0xea7e('0xa0'),_0xea7e('0xa1'),_0xea7e('0xa2'),_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')]('phone','phone')[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))['field'](_0x4c5463[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27','createdAt')['field']('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))['from'](_0xea7e('0xa6'))[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')]('ListId\x20=\x20?',_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7'))[_0xea7e('0x44')](_0xea7e('0xa8'),squel['select']()['field'](_0xea7e('0xa9'))[_0xea7e('0x82')]('cm_hopper_final')[_0xea7e('0x44')](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id']['toString']()))[_0xea7e('0x44')](_0xea7e('0xa8'),squel[_0xea7e('0xa3')]()['field'](_0xea7e('0xaa'))['from']('cm_hopper')[_0xea7e('0x44')](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')]())))[_0xea7e('0xa5')]();break;case _0xea7e('0xab'):_0x5891fe=squel[_0xea7e('0x9d')]()[_0xea7e('0x9e')](_0xea7e('0x9f'))['fromQuery']([_0xea7e('0xac'),'scheduledAt',_0xea7e('0xa1'),'ListId',_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))[_0xea7e('0x80')](_0x4c5463[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x59'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))[_0xea7e('0x82')]('cm_contacts')[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')](_0xea7e('0xad'),_0x4c5463['CmListId'][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7'))['where'](_0xea7e('0xa8'),squel[_0xea7e('0xa3')]()[_0xea7e('0x80')](_0xea7e('0xaa'))['from']('cm_hopper')['where'](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')]())))[_0xea7e('0xa5')]();break;default:_0x5891fe=squel['insert']()['into'](_0xea7e('0x9f'))['fromQuery']([_0xea7e('0xac'),_0xea7e('0xa0'),'ContactId',_0xea7e('0xa2'),_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel['select']()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))['field']('id','ContactId')[_0xea7e('0x80')](_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),'VoiceQueueId')['field']('\x27'+_0x207a7c+'\x27',_0xea7e('0x59'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))['from'](_0xea7e('0xa6'))[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')](_0xea7e('0xad'),_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7')))[_0xea7e('0xa5')]();}_0x5d599f[_0xea7e('0x87')](db['sequelize'][_0xea7e('0x3c')](_0x5891fe));}return BPromise[_0xea7e('0x8c')](_0x5d599f);}})[_0xea7e('0x24')](function(){var _0x2c1e20=[];var _0x5597f1=squel['insert']()[_0xea7e('0x9e')](_0xea7e('0xae'))[_0xea7e('0xaf')]([_0xea7e('0xb0'),_0xea7e('0xac'),_0xea7e('0xb1'),_0xea7e('0x59'),'updatedAt'],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')]('h.id')['field']('ci.item')['field'](_0xea7e('0xb2'))['field']('\x27'+_0x207a7c+'\x27','createdAt')[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))[_0xea7e('0x82')]('cm_contact_has_items','ci')['join'](_0xea7e('0x9f'),'h','h.ContactId=ci.CmContactId')[_0xea7e('0x44')](_0xea7e('0xb3'),_0x207a7c)[_0xea7e('0x44')](_0xea7e('0xb4'),_0xea7e('0xb5')))[_0xea7e('0xa5')]();_0x2c1e20[_0xea7e('0x87')](db['sequelize'][_0xea7e('0x3c')](_0x5597f1));return BPromise[_0xea7e('0x8c')](_0x2c1e20);})[_0xea7e('0x24')](function(){return _0x1a1ff8;})[_0xea7e('0x24')](respondWithResult(_0x448388,null))[_0xea7e('0x49')](handleError(_0x448388,null));};exports[_0xea7e('0xb6')]=function(_0x329a3c,_0x2af7ba,_0x3cbc95){return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x329a3c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x2af7ba,null))[_0xea7e('0x24')](function(_0x4541cd){if(_0x4541cd){return _0x4541cd[_0xea7e('0xb6')](_0x329a3c[_0xea7e('0x3c')]['ids']);}})[_0xea7e('0x24')](function(_0x590a97){if(_0x590a97){return db['CmHopper'][_0xea7e('0x25')]({'where':{'ListId':_0x329a3c[_0xea7e('0x3c')][_0xea7e('0x7f')],'VoiceQueueId':_0x329a3c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(){return _0x590a97;});}})[_0xea7e('0x24')](respondWithStatusCode(_0x2af7ba,null))[_0xea7e('0x49')](handleError(_0x2af7ba,null));};exports['getBlackLists']=function(_0x4d12ff,_0x124173,_0x19aca0){var _0x72b940={};var _0x5ad505={};var _0x10dc38;var _0x36d1cc;return db['VoiceQueue']['findOne']({'where':{'id':_0x4d12ff[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x124173,null))[_0xea7e('0x24')](function(_0x4f21f9){if(_0x4f21f9){_0x10dc38=_0x4f21f9;_0x5ad505[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x99')]['rawAttributes']);_0x5ad505[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x4d12ff['query']);_0x5ad505[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x5ad505['model'],_0x5ad505['query']);_0x72b940['attributes']=_[_0xea7e('0x3e')](_0x5ad505[_0xea7e('0x3b')],qs['fields'](_0x4d12ff[_0xea7e('0x3c')]['fields']));_0x72b940['attributes']=_0x72b940['attributes'][_0xea7e('0x40')]?_0x72b940[_0xea7e('0x3f')]:_0x5ad505[_0xea7e('0x3b')];_0x72b940[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x72b940['where']=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x4d12ff[_0xea7e('0x3c')],_0x5ad505[_0xea7e('0x45')]));if(_0x4d12ff[_0xea7e('0x3c')]['filter']){_0x72b940['where']=_['merge'](_0x72b940['where'],{'$or':_[_0xea7e('0x36')](_0x72b940[_0xea7e('0x3f')],function(_0x3e3849){var _0x52bb75={};_0x52bb75[_0x3e3849]={'$like':'%'+_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x52bb75;})});}_0x72b940=_['merge']({},_0x72b940,_0x4d12ff[_0xea7e('0x4c')]);return _0x10dc38['getBlackLists'](_0x72b940);}})[_0xea7e('0x24')](function(_0x4988f3){if(_0x4988f3){_0x36d1cc=_0x4988f3[_0xea7e('0x40')];if(!_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x72b940[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x4d12ff['query'][_0xea7e('0x1f')]);_0x72b940['offset']=qs[_0xea7e('0x1c')](_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x10dc38[_0xea7e('0xb7')](_0x72b940);}})['then'](function(_0x302690){if(_0x302690){return _0x302690?{'count':_0x36d1cc,'rows':_0x302690}:null;}})[_0xea7e('0x24')](respondWithResult(_0x124173,null))[_0xea7e('0x49')](handleError(_0x124173,null));};exports[_0xea7e('0xb8')]=function(_0x503e30,_0x314b04,_0x5e3dc0){var _0x5bf993,_0x2358a1;return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x503e30[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x314b04,null))['then'](function(_0x44f1e1){if(_0x44f1e1){_0x2358a1=_0x44f1e1;return _0x44f1e1[_0xea7e('0xb8')](_0x503e30[_0xea7e('0x4f')]['ids'],_[_0xea7e('0x57')](_0x503e30[_0xea7e('0x4f')],[_0xea7e('0x7f'),'id'])||{});}return null;})[_0xea7e('0x93')](function(_0x15b80e){var _0x32758d;_0x5bf993=_0x15b80e||[];var _0x3595a8=[];if(_0x15b80e){for(var _0x4c08d0=0x0;_0x4c08d0<_0x15b80e[_0xea7e('0x40')];_0x4c08d0+=0x1){var _0x10ba65=_0x15b80e[_0x4c08d0][_0xea7e('0x26')]({'plain':!![]});_0x32758d=squel[_0xea7e('0x9d')]()['into'](_0xea7e('0xb9'))[_0xea7e('0xaf')](['phone',_0xea7e('0xa1'),_0xea7e('0xa2'),'VoiceQueueId',_0xea7e('0x59'),'updatedAt'],squel['select']()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))[_0xea7e('0x80')](_0x10ba65[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))['field'](_0x503e30[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))['field'](_0xea7e('0xba'),_0xea7e('0x59'))[_0xea7e('0x80')](_0xea7e('0xba'),'updatedAt')[_0xea7e('0x82')](_0xea7e('0xa6'))['where'](_0xea7e('0xbb'))['where'](_0xea7e('0xad'),_0x10ba65[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7')))['toString']();_0x3595a8['push'](db[_0xea7e('0x73')][_0xea7e('0x3c')](_0x32758d));}return BPromise[_0xea7e('0x8c')](_0x3595a8);}})['then'](function(){return _0x5bf993;})['then'](respondWithResult(_0x314b04,null))[_0xea7e('0x49')](handleError(_0x314b04,null));};exports[_0xea7e('0xbc')]=function(_0xd80c44,_0x2f4321,_0x586f5f){return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0xd80c44[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x2f4321,null))[_0xea7e('0x24')](function(_0x529676){if(_0x529676){return _0x529676[_0xea7e('0xbc')](_0xd80c44['query']['ids']);}})['then'](function(_0x48e6cb){if(_0x48e6cb){return db['CmHopperBlack'][_0xea7e('0x25')]({'where':{'ListId':_0xd80c44['query'][_0xea7e('0x7f')],'VoiceQueueId':_0xd80c44[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(){return _0x48e6cb;});}})['then'](respondWithStatusCode(_0x2f4321,null))[_0xea7e('0x49')](handleError(_0x2f4321,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 41a7b8b..baf2e57 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 _0xed05=['../../mysqldb','setMaxListeners','save','update','remove','emit','events'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xed05,0x102));var _0x5ed0=function(_0x2715e2,_0x273fe){_0x2715e2=_0x2715e2-0x0;var _0x2f559a=_0xed05[_0x2715e2];return _0x2f559a;};'use strict';var EventEmitter=require(_0x5ed0('0x0'));var VoiceQueue=require(_0x5ed0('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5ed0('0x2')](0x0);var events={'afterCreate':_0x5ed0('0x3'),'afterUpdate':_0x5ed0('0x4'),'afterDestroy':_0x5ed0('0x5')};function emitEvent(_0x1c0b81){return function(_0xa4bbcc,_0x4d21c1,_0x489e01){VoiceQueueEvents[_0x5ed0('0x6')](_0x1c0b81+':'+_0xa4bbcc['id'],_0xa4bbcc);VoiceQueueEvents[_0x5ed0('0x6')](_0x1c0b81,_0xa4bbcc);_0x489e01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x494a=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','emit','hook'];(function(_0x4f1866,_0x4a5b72){var _0x58a829=function(_0x18ae6d){while(--_0x18ae6d){_0x4f1866['push'](_0x4f1866['shift']());}};_0x58a829(++_0x4a5b72);}(_0x494a,0x89));var _0xa494=function(_0x2625ee,_0x44821d){_0x2625ee=_0x2625ee-0x0;var _0x5db885=_0x494a[_0x2625ee];return _0x5db885;};'use strict';var EventEmitter=require(_0xa494('0x0'));var VoiceQueue=require(_0xa494('0x1'))['db'][_0xa494('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa494('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa494('0x4'),'afterDestroy':'remove'};function emitEvent(_0x270139){return function(_0x493924,_0x496e0d,_0x508589){VoiceQueueEvents[_0xa494('0x5')](_0x270139+':'+_0x493924['id'],_0x493924);VoiceQueueEvents[_0xa494('0x5')](_0x270139,_0x493924);_0x508589(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xa494('0x6')](e,emitEvent(event));}}module[_0xa494('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 74ce3a0..650f606 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(_0x52598d,_0x10fb73){var _0x170309=function(_0x30c9f7){while(--_0x30c9f7){_0x52598d['push'](_0x52598d['shift']());}};_0x170309(++_0x10fb73);}(_0x3e74,0x175));var _0x43e7=function(_0x486f67,_0x5e1c9a){_0x486f67=_0x486f67-0x0;var _0x555273=_0x3e74[_0x486f67];return _0x555273;};'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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0xa72f73,_0x8058d1){var _0x190264=function(_0x547589){while(--_0x547589){_0xa72f73['push'](_0xa72f73['shift']());}};_0x190264(++_0x8058d1);}(_0x3e74,0x175));var _0x43e7=function(_0x50dd1b,_0x905a0e){_0x50dd1b=_0x50dd1b-0x0;var _0x252f4c=_0x3e74[_0x50dd1b];return _0x252f4c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 55497b5..aa1fb21 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 _0xd6a0=['then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','map','include','model','attributes','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request'];(function(_0x387af8,_0x77b4b8){var _0x1eff3c=function(_0x1dab44){while(--_0x1dab44){_0x387af8['push'](_0x387af8['shift']());}};_0x1eff3c(++_0x77b4b8);}(_0xd6a0,0xe0));var _0x0d6a=function(_0x18c4a8,_0x96c52e){_0x18c4a8=_0x18c4a8-0x0;var _0x189ff1=_0xd6a0[_0x18c4a8];return _0x189ff1;};'use strict';var _=require(_0x0d6a('0x0'));var util=require(_0x0d6a('0x1'));var moment=require(_0x0d6a('0x2'));var BPromise=require(_0x0d6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d6a('0x5'));var logger=require(_0x0d6a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d6a('0x7'));var client=jayson[_0x0d6a('0x8')][_0x0d6a('0x9')]({'port':0x232a});config['redis']=_[_0x0d6a('0xa')](config['redis'],{'host':_0x0d6a('0xb'),'port':0x18eb});var socket=require(_0x0d6a('0xc'))(new Redis(config['redis']));require(_0x0d6a('0xd'))[_0x0d6a('0xe')](socket);function respondWithRpcPromise(_0x3fb61b,_0x55d8b9,_0x1ec9ba){return new BPromise(function(_0x55e836,_0x325075){return client[_0x0d6a('0xf')](_0x3fb61b,_0x1ec9ba)[_0x0d6a('0x10')](function(_0x2473f5){logger[_0x0d6a('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x55d8b9,_0x0d6a('0x12'));logger[_0x0d6a('0x13')](_0x0d6a('0x14'),_0x55d8b9,'request\x20sent',JSON[_0x0d6a('0x15')](_0x2473f5));if(_0x2473f5[_0x0d6a('0x16')]){if(_0x2473f5[_0x0d6a('0x16')][_0x0d6a('0x17')]===0x1f4){logger[_0x0d6a('0x16')](_0x0d6a('0x18'),_0x55d8b9,_0x2473f5[_0x0d6a('0x16')][_0x0d6a('0x19')]);return _0x325075(_0x2473f5[_0x0d6a('0x16')]['message']);}logger['error'](_0x0d6a('0x18'),_0x55d8b9,_0x2473f5[_0x0d6a('0x16')][_0x0d6a('0x19')]);return _0x55e836(_0x2473f5[_0x0d6a('0x16')][_0x0d6a('0x19')]);}else{logger[_0x0d6a('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x55d8b9,_0x0d6a('0x12'));_0x55e836(_0x2473f5['result']['message']);}})[_0x0d6a('0x1a')](function(_0x3eb95c){logger[_0x0d6a('0x16')](_0x0d6a('0x18'),_0x55d8b9,_0x3eb95c);_0x325075(_0x3eb95c);});});}exports[_0x0d6a('0x1b')]=function(_0x4038d6){var _0xa9eb4c=this;return new Promise(function(_0x34a477,_0x10f798){return db[_0x0d6a('0x1c')][_0x0d6a('0x1d')]({'raw':_0x4038d6['options']?_0x4038d6[_0x0d6a('0x1e')][_0x0d6a('0x1f')]===undefined?!![]:![]:!![],'where':_0x4038d6['options']?_0x4038d6[_0x0d6a('0x1e')][_0x0d6a('0x20')]||null:null,'attributes':_0x4038d6[_0x0d6a('0x1e')]?_0x4038d6['options']['attributes']||null:null,'limit':_0x4038d6[_0x0d6a('0x1e')]?_0x4038d6[_0x0d6a('0x1e')][_0x0d6a('0x21')]||null:null,'include':_0x4038d6[_0x0d6a('0x1e')]?_0x4038d6['options']['include']?_[_0x0d6a('0x22')](_0x4038d6[_0x0d6a('0x1e')][_0x0d6a('0x23')],function(_0x46b73f){return{'model':db[_0x46b73f[_0x0d6a('0x24')]],'as':_0x46b73f['as'],'attributes':_0x46b73f['attributes'],'include':_0x46b73f[_0x0d6a('0x23')]?_['map'](_0x46b73f['include'],function(_0x308d6a){return{'model':db[_0x308d6a[_0x0d6a('0x24')]],'as':_0x308d6a['as'],'attributes':_0x308d6a[_0x0d6a('0x25')],'include':_0x308d6a['include']?_[_0x0d6a('0x22')](_0x308d6a[_0x0d6a('0x23')],function(_0x574a96){return{'model':db[_0x574a96[_0x0d6a('0x24')]],'as':_0x574a96['as'],'attributes':_0x574a96['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x10')](function(_0x4c7385){logger[_0x0d6a('0x11')]('GetVoiceQueue',_0x4038d6);logger[_0x0d6a('0x13')](_0x0d6a('0x1b'),_0x4038d6,JSON[_0x0d6a('0x15')](_0x4c7385));_0x34a477(_0x4c7385);})[_0x0d6a('0x1a')](function(_0x2a69cd){logger[_0x0d6a('0x16')](_0x0d6a('0x1b'),_0x2a69cd['message'],_0x4038d6);_0x10f798(_0xa9eb4c['error'](0x1f4,_0x2a69cd[_0x0d6a('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x8f20e9){var _0x55b585=this;return new Promise(function(_0x4e47f2,_0x5dbe15){return db[_0x0d6a('0x1c')][_0x0d6a('0x26')]({'raw':_0x8f20e9[_0x0d6a('0x1e')]?_0x8f20e9[_0x0d6a('0x1e')][_0x0d6a('0x1f')]===undefined?!![]:![]:!![],'where':_0x8f20e9[_0x0d6a('0x1e')]?_0x8f20e9['options']['where']||null:null,'attributes':_0x8f20e9[_0x0d6a('0x1e')]?_0x8f20e9['options']['attributes']||null:null,'include':_0x8f20e9['options']?_0x8f20e9[_0x0d6a('0x1e')]['include']?_['map'](_0x8f20e9['options'][_0x0d6a('0x23')],function(_0x42bbe3){return{'model':db[_0x42bbe3[_0x0d6a('0x24')]],'as':_0x42bbe3['as'],'attributes':_0x42bbe3['attributes'],'include':_0x42bbe3['include']?_[_0x0d6a('0x22')](_0x42bbe3[_0x0d6a('0x23')],function(_0x44649a){return{'model':db[_0x44649a['model']],'as':_0x44649a['as'],'attributes':_0x44649a[_0x0d6a('0x25')],'include':_0x44649a[_0x0d6a('0x23')]?_['map'](_0x44649a[_0x0d6a('0x23')],function(_0x22bb1a){return{'model':db[_0x22bb1a[_0x0d6a('0x24')]],'as':_0x22bb1a['as'],'attributes':_0x22bb1a[_0x0d6a('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0d6a('0x10')](function(_0x5c6fc0){logger[_0x0d6a('0x11')](_0x0d6a('0x27'),_0x8f20e9);logger[_0x0d6a('0x13')]('ShowVoiceQueue',_0x8f20e9,JSON[_0x0d6a('0x15')](_0x5c6fc0));_0x4e47f2(_0x5c6fc0);})[_0x0d6a('0x1a')](function(_0x87f19){logger[_0x0d6a('0x16')](_0x0d6a('0x27'),_0x87f19[_0x0d6a('0x19')],_0x8f20e9);_0x5dbe15(_0x55b585[_0x0d6a('0x16')](0x1f4,_0x87f19['message']));});});}; \ No newline at end of file +var _0x4b9a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','lodash','util','moment','bluebird'];(function(_0x3b1050,_0x37b2c1){var _0x5b35b4=function(_0x28e7d1){while(--_0x28e7d1){_0x3b1050['push'](_0x3b1050['shift']());}};_0x5b35b4(++_0x37b2c1);}(_0x4b9a,0x9c));var _0xa4b9=function(_0x16420e,_0xa7685f){_0x16420e=_0x16420e-0x0;var _0x42862e=_0x4b9a[_0x16420e];return _0x42862e;};'use strict';var _=require(_0xa4b9('0x0'));var util=require(_0xa4b9('0x1'));var moment=require(_0xa4b9('0x2'));var BPromise=require(_0xa4b9('0x3'));var rs=require(_0xa4b9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4b9('0x5'))['db'];var utils=require(_0xa4b9('0x6'));var logger=require(_0xa4b9('0x7'))(_0xa4b9('0x8'));var config=require(_0xa4b9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa4b9('0xa')][_0xa4b9('0xb')]({'port':0x232a});config[_0xa4b9('0xc')]=_[_0xa4b9('0xd')](config[_0xa4b9('0xc')],{'host':_0xa4b9('0xe'),'port':0x18eb});var socket=require(_0xa4b9('0xf'))(new Redis(config[_0xa4b9('0xc')]));require(_0xa4b9('0x10'))['register'](socket);function respondWithRpcPromise(_0x5ee2ee,_0x24f35e,_0xb21953){return new BPromise(function(_0x287ce5,_0x3f8728){return client[_0xa4b9('0x11')](_0x5ee2ee,_0xb21953)[_0xa4b9('0x12')](function(_0x59d963){logger[_0xa4b9('0x13')](_0xa4b9('0x14'),_0x24f35e,_0xa4b9('0x15'));logger[_0xa4b9('0x16')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x24f35e,_0xa4b9('0x15'),JSON[_0xa4b9('0x17')](_0x59d963));if(_0x59d963[_0xa4b9('0x18')]){if(_0x59d963[_0xa4b9('0x18')][_0xa4b9('0x19')]===0x1f4){logger[_0xa4b9('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x24f35e,_0x59d963[_0xa4b9('0x18')]['message']);return _0x3f8728(_0x59d963['error']['message']);}logger[_0xa4b9('0x18')](_0xa4b9('0x14'),_0x24f35e,_0x59d963['error'][_0xa4b9('0x1a')]);return _0x287ce5(_0x59d963[_0xa4b9('0x18')][_0xa4b9('0x1a')]);}else{logger[_0xa4b9('0x13')](_0xa4b9('0x14'),_0x24f35e,'request\x20sent');_0x287ce5(_0x59d963['result'][_0xa4b9('0x1a')]);}})[_0xa4b9('0x1b')](function(_0x31b14c){logger[_0xa4b9('0x18')](_0xa4b9('0x14'),_0x24f35e,_0x31b14c);_0x3f8728(_0x31b14c);});});}exports[_0xa4b9('0x1c')]=function(_0xce5f3c){var _0x6f28ad=this;return new Promise(function(_0x22b8d3,_0x170fea){return db[_0xa4b9('0x1d')][_0xa4b9('0x1e')]({'raw':_0xce5f3c[_0xa4b9('0x1f')]?_0xce5f3c[_0xa4b9('0x1f')][_0xa4b9('0x20')]===undefined?!![]:![]:!![],'where':_0xce5f3c[_0xa4b9('0x1f')]?_0xce5f3c[_0xa4b9('0x1f')][_0xa4b9('0x21')]||null:null,'attributes':_0xce5f3c['options']?_0xce5f3c[_0xa4b9('0x1f')][_0xa4b9('0x22')]||null:null,'limit':_0xce5f3c['options']?_0xce5f3c[_0xa4b9('0x1f')][_0xa4b9('0x23')]||null:null,'include':_0xce5f3c[_0xa4b9('0x1f')]?_0xce5f3c[_0xa4b9('0x1f')][_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0xce5f3c[_0xa4b9('0x1f')]['include'],function(_0x44fd60){return{'model':db[_0x44fd60[_0xa4b9('0x26')]],'as':_0x44fd60['as'],'attributes':_0x44fd60[_0xa4b9('0x22')],'include':_0x44fd60[_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0x44fd60[_0xa4b9('0x24')],function(_0x2958b6){return{'model':db[_0x2958b6['model']],'as':_0x2958b6['as'],'attributes':_0x2958b6[_0xa4b9('0x22')],'include':_0x2958b6[_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0x2958b6[_0xa4b9('0x24')],function(_0x3b376e){return{'model':db[_0x3b376e[_0xa4b9('0x26')]],'as':_0x3b376e['as'],'attributes':_0x3b376e[_0xa4b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa4b9('0x12')](function(_0x40d254){logger['info']('GetVoiceQueue',_0xce5f3c);logger['debug'](_0xa4b9('0x1c'),_0xce5f3c,JSON['stringify'](_0x40d254));_0x22b8d3(_0x40d254);})[_0xa4b9('0x1b')](function(_0x388e51){logger['error']('GetVoiceQueue',_0x388e51[_0xa4b9('0x1a')],_0xce5f3c);_0x170fea(_0x6f28ad[_0xa4b9('0x18')](0x1f4,_0x388e51[_0xa4b9('0x1a')]));});});};exports[_0xa4b9('0x27')]=function(_0x231e16){var _0x38f2a5=this;return new Promise(function(_0x78f9f7,_0x550b80){return db[_0xa4b9('0x1d')]['find']({'raw':_0x231e16[_0xa4b9('0x1f')]?_0x231e16[_0xa4b9('0x1f')][_0xa4b9('0x20')]===undefined?!![]:![]:!![],'where':_0x231e16[_0xa4b9('0x1f')]?_0x231e16[_0xa4b9('0x1f')][_0xa4b9('0x21')]||null:null,'attributes':_0x231e16[_0xa4b9('0x1f')]?_0x231e16[_0xa4b9('0x1f')][_0xa4b9('0x22')]||null:null,'include':_0x231e16['options']?_0x231e16['options'][_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0x231e16[_0xa4b9('0x1f')][_0xa4b9('0x24')],function(_0x434c0){return{'model':db[_0x434c0['model']],'as':_0x434c0['as'],'attributes':_0x434c0['attributes'],'include':_0x434c0[_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0x434c0[_0xa4b9('0x24')],function(_0x1a3d63){return{'model':db[_0x1a3d63['model']],'as':_0x1a3d63['as'],'attributes':_0x1a3d63[_0xa4b9('0x22')],'include':_0x1a3d63[_0xa4b9('0x24')]?_[_0xa4b9('0x25')](_0x1a3d63[_0xa4b9('0x24')],function(_0xc8437f){return{'model':db[_0xc8437f[_0xa4b9('0x26')]],'as':_0xc8437f['as'],'attributes':_0xc8437f[_0xa4b9('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa4b9('0x12')](function(_0x5c6911){logger[_0xa4b9('0x13')](_0xa4b9('0x27'),_0x231e16);logger[_0xa4b9('0x16')](_0xa4b9('0x27'),_0x231e16,JSON[_0xa4b9('0x17')](_0x5c6911));_0x78f9f7(_0x5c6911);})[_0xa4b9('0x1b')](function(_0x24bfee){logger['error'](_0xa4b9('0x27'),_0x24bfee['message'],_0x231e16);_0x550b80(_0x38f2a5[_0xa4b9('0x18')](0x1f4,_0x24bfee['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9b59d80..71e0595 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 _0x7067=['save','remove','emit','removeListener'];(function(_0x3f9c8d,_0x1bcdf4){var _0x17bfbc=function(_0xf3cafd){while(--_0xf3cafd){_0x3f9c8d['push'](_0x3f9c8d['shift']());}};_0x17bfbc(++_0x1bcdf4);}(_0x7067,0x70));var _0x7706=function(_0x411184,_0x4e75fc){_0x411184=_0x411184-0x0;var _0x21d946=_0x7067[_0x411184];return _0x21d946;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7706('0x0'),_0x7706('0x1'),'update'];function createListener(_0xeabfb0,_0x4920ae){return function(_0x449b11){_0x4920ae[_0x7706('0x2')](_0xeabfb0,_0x449b11);};}function removeListener(_0xae2ff6,_0x3e85fe){return function(){VoiceQueueEvents[_0x7706('0x3')](_0xae2ff6,_0x3e85fe);};}exports['register']=function(_0x4c6c5f){for(var _0x1502ae=0x0,_0x19c8cc=events['length'];_0x1502ae<_0x19c8cc;_0x1502ae++){var _0x167f56=events[_0x1502ae];var _0x2f54ad=createListener('voiceQueue:'+_0x167f56,_0x4c6c5f);VoiceQueueEvents['on'](_0x167f56,_0x2f54ad);}}; \ No newline at end of file +var _0xf3dd=['voiceQueue:','save','remove','update','emit','removeListener','register'];(function(_0x80ba0d,_0x15421f){var _0x236109=function(_0x1c0899){while(--_0x1c0899){_0x80ba0d['push'](_0x80ba0d['shift']());}};_0x236109(++_0x15421f);}(_0xf3dd,0xda));var _0xdf3d=function(_0xeb31d6,_0x36dda8){_0xeb31d6=_0xeb31d6-0x0;var _0x2f7189=_0xf3dd[_0xeb31d6];return _0x2f7189;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xdf3d('0x0'),_0xdf3d('0x1'),_0xdf3d('0x2')];function createListener(_0x36eef0,_0xc8df4b){return function(_0x4da0e7){_0xc8df4b[_0xdf3d('0x3')](_0x36eef0,_0x4da0e7);};}function removeListener(_0x3ffac0,_0x5261d5){return function(){VoiceQueueEvents[_0xdf3d('0x4')](_0x3ffac0,_0x5261d5);};}exports[_0xdf3d('0x5')]=function(_0x2b1ac0){for(var _0x28f60c=0x0,_0x1d0b40=events['length'];_0x28f60c<_0x1d0b40;_0x28f60c++){var _0x3d0b5c=events[_0x28f60c];var _0x470d99=createListener(_0xdf3d('0x6')+_0x3d0b5c,_0x2b1ac0);VoiceQueueEvents['on'](_0x3d0b5c,_0x470d99);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7eb8b03..7915cec 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 _0x0257=['describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get'];(function(_0x15c420,_0x1a8ef1){var _0x23f862=function(_0x44f4a2){while(--_0x44f4a2){_0x15c420['push'](_0x15c420['shift']());}};_0x23f862(++_0x1a8ef1);}(_0x0257,0x113));var _0x7025=function(_0x40fa00,_0x1fbb3f){_0x40fa00=_0x40fa00-0x0;var _0x2f2426=_0x0257[_0x40fa00];return _0x2f2426;};'use strict';var multer=require('multer');var util=require(_0x7025('0x0'));var path=require(_0x7025('0x1'));var timeout=require(_0x7025('0x2'));var express=require(_0x7025('0x3'));var router=express[_0x7025('0x4')]();var fs_extra=require(_0x7025('0x5'));var auth=require(_0x7025('0x6'));var interaction=require(_0x7025('0x7'));var config=require(_0x7025('0x8'));var controller=require(_0x7025('0x9'));router['get']('/',auth[_0x7025('0xa')](),controller[_0x7025('0xb')]);router[_0x7025('0xc')]('/describe',auth[_0x7025('0xa')](),controller[_0x7025('0xd')]);router[_0x7025('0xc')](_0x7025('0xe'),auth[_0x7025('0xa')](),controller[_0x7025('0xf')]);router[_0x7025('0xc')](_0x7025('0x10'),auth[_0x7025('0xa')](),controller[_0x7025('0x11')]);router[_0x7025('0x12')]('/',auth[_0x7025('0xa')](),controller[_0x7025('0x13')]);router[_0x7025('0x14')](_0x7025('0x10'),auth['isAuthenticated'](),controller[_0x7025('0x15')]);router[_0x7025('0x16')](_0x7025('0x10'),auth[_0x7025('0xa')](),controller['destroy']);module[_0x7025('0x17')]=router; \ No newline at end of file +var _0x3754=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','put','update','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0x3754,0xfb));var _0x4375=function(_0x3ef44b,_0x4c2ee5){_0x3ef44b=_0x3ef44b-0x0;var _0x2b91dc=_0x3754[_0x3ef44b];return _0x2b91dc;};'use strict';var multer=require('multer');var util=require(_0x4375('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4375('0x1'));var auth=require(_0x4375('0x2'));var interaction=require(_0x4375('0x3'));var config=require(_0x4375('0x4'));var controller=require(_0x4375('0x5'));router[_0x4375('0x6')]('/',auth[_0x4375('0x7')](),controller[_0x4375('0x8')]);router['get'](_0x4375('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x4375('0x6')](_0x4375('0xa'),auth[_0x4375('0x7')](),controller[_0x4375('0xb')]);router[_0x4375('0x6')](_0x4375('0xc'),auth['isAuthenticated'](),controller[_0x4375('0xd')]);router['post']('/',auth[_0x4375('0x7')](),controller['create']);router[_0x4375('0xe')]('/:id',auth[_0x4375('0x7')](),controller[_0x4375('0xf')]);router['delete'](_0x4375('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4375('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9c34177..5a37de9 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 _0x1628=['queuecallerjoinAt','format','diff','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING','DATE'];(function(_0x58f29c,_0x551df2){var _0x5266ed=function(_0x421cbc){while(--_0x421cbc){_0x58f29c['push'](_0x58f29c['shift']());}};_0x5266ed(++_0x551df2);}(_0x1628,0x158));var _0x8162=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x1628[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require(_0x8162('0x0'));var moment=require(_0x8162('0x1'));module['exports']={'type':{'type':Sequelize[_0x8162('0x2')]},'uniqueid':{'type':Sequelize[_0x8162('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8162('0x2')]},'queue':{'type':Sequelize[_0x8162('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x8162('0x3')],'set':function(_0x2f027c){var _0x2cb9c5=moment(_0x2f027c);var _0x21ba32=moment(this['getDataValue'](_0x8162('0x4')))[_0x8162('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x186aee=_0x2cb9c5[_0x8162('0x6')](_0x21ba32,'seconds');this[_0x8162('0x7')](_0x8162('0x8'),_0x2f027c);this[_0x8162('0x7')]('holdtime',_0x186aee||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x8162('0x9')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x8162('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x8162('0x3')]},'queuecallerexit':{'type':Sequelize[_0x8162('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x8162('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x8162('0x2')],'comment':_0x8162('0xb')},'originalposition':{'type':Sequelize[_0x8162('0x9')]},'channel':{'type':Sequelize[_0x8162('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8162('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8162('0x2')]},'exten':{'type':Sequelize[_0x8162('0x2')]},'priority':{'type':Sequelize[_0x8162('0x2')]},'holdtime':{'type':Sequelize[_0x8162('0x9')]},'mohtime':{'type':Sequelize[_0x8162('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x8162('0x2')]},'transfer':{'type':Sequelize[_0x8162('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8162('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8162('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8162('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8162('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8840=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','queuecallerleaveAt','setDataValue'];(function(_0x42fddd,_0xd397da){var _0x5b763d=function(_0xf19854){while(--_0xf19854){_0x42fddd['push'](_0x42fddd['shift']());}};_0x5b763d(++_0xd397da);}(_0x8840,0x14e));var _0x0884=function(_0x114356,_0x561b7a){_0x114356=_0x114356-0x0;var _0xd46fa7=_0x8840[_0x114356];return _0xd46fa7;};'use strict';var Sequelize=require(_0x0884('0x0'));var moment=require(_0x0884('0x1'));module[_0x0884('0x2')]={'type':{'type':Sequelize[_0x0884('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0884('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0884('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0884('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x29ddec){var _0x2c3194=moment(_0x29ddec);var _0x388fa3=moment(this[_0x0884('0x5')](_0x0884('0x6')))['format'](_0x0884('0x7'));var _0x563ae7=_0x2c3194[_0x0884('0x8')](_0x388fa3,'seconds');this['setDataValue'](_0x0884('0x9'),_0x29ddec);this[_0x0884('0xa')]('holdtime',_0x563ae7||null);}},'position':{'type':Sequelize[_0x0884('0xb')]},'count':{'type':Sequelize[_0x0884('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0884('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0884('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0884('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x0884('0xd')},'originalposition':{'type':Sequelize[_0x0884('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0884('0x3')]},'connectedlinename':{'type':Sequelize[_0x0884('0x3')]},'accountcode':{'type':Sequelize[_0x0884('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0884('0x3')]},'priority':{'type':Sequelize[_0x0884('0x3')]},'holdtime':{'type':Sequelize[_0x0884('0xb')]},'mohtime':{'type':Sequelize[_0x0884('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0884('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0884('0x3')]},'transfer':{'type':Sequelize[_0x0884('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0884('0x3')],'comment':_0x0884('0xe')},'transferexten':{'type':Sequelize[_0x0884('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0884('0x3')]},'disposition':{'type':Sequelize[_0x0884('0x3')]},'secondDisposition':{'type':Sequelize[_0x0884('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0884('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9eed037..303f3d8 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 _0x88d2=['filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','length','find','create','body','destroy','getVoiceQueuesReport','nolimit','include','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x455a21,_0x4334a4){var _0x1e7d8d=function(_0x4942ae){while(--_0x4942ae){_0x455a21['push'](_0x455a21['shift']());}};_0x1e7d8d(++_0x4334a4);}(_0x88d2,0xbd));var _0x288d=function(_0x3af1b8,_0x28f941){_0x3af1b8=_0x3af1b8-0x0;var _0x2798a5=_0x88d2[_0x3af1b8];return _0x2798a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x288d('0x0'));var zipdir=require(_0x288d('0x1'));var jsonpatch=require(_0x288d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x288d('0x3'));var Mustache=require(_0x288d('0x4'));var util=require(_0x288d('0x5'));var path=require('path');var sox=require(_0x288d('0x6'));var csv=require(_0x288d('0x7'));var ejs=require(_0x288d('0x8'));var fs=require('fs');var fs_extra=require(_0x288d('0x9'));var _=require(_0x288d('0xa'));var squel=require(_0x288d('0xb'));var crypto=require(_0x288d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x288d('0xd'));var toCsv=require(_0x288d('0x7'));var querystring=require(_0x288d('0xe'));var Papa=require('papaparse');var Redis=require(_0x288d('0xf'));var authService=require(_0x288d('0x10'));var qs=require(_0x288d('0x11'));var as=require(_0x288d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x288d('0x13'))(_0x288d('0x14'));var utils=require(_0x288d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x288d('0x16'));var db=require(_0x288d('0x17'))['db'];config[_0x288d('0x18')]=_[_0x288d('0x19')](config[_0x288d('0x18')],{'host':_0x288d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x288d('0x18')]));require('./voiceQueueReport.socket')[_0x288d('0x1b')](socket);function respondWithStatusCode(_0x7ebeb8,_0x4b0a38){_0x4b0a38=_0x4b0a38||0xcc;return function(_0x5419d3){if(_0x5419d3){return _0x7ebeb8[_0x288d('0x1c')](_0x4b0a38);}return _0x7ebeb8['status'](_0x4b0a38)[_0x288d('0x1d')]();};}function respondWithResult(_0xdffddd,_0xe1d336){_0xe1d336=_0xe1d336||0xc8;return function(_0x316a9b){if(_0x316a9b){return _0xdffddd['status'](_0xe1d336)[_0x288d('0x1e')](_0x316a9b);}};}function respondWithFilteredResult(_0x2e365c,_0x2179f6){return function(_0x1e27df){if(_0x1e27df){var _0x1d9595=typeof _0x2179f6[_0x288d('0x1f')]===_0x288d('0x20')&&typeof _0x2179f6[_0x288d('0x21')]===_0x288d('0x20');var _0x496a6f=_0x1e27df[_0x288d('0x22')];var _0x28cfc6=_0x1d9595?0x0:_0x2179f6[_0x288d('0x1f')];var _0xbb07a3=_0x1d9595?_0x1e27df[_0x288d('0x22')]:_0x2179f6[_0x288d('0x1f')]+_0x2179f6[_0x288d('0x21')];var _0xae6a83;if(_0xbb07a3>=_0x496a6f){_0xbb07a3=_0x496a6f;_0xae6a83=0xc8;}else{_0xae6a83=0xce;}_0x2e365c[_0x288d('0x23')](_0xae6a83);return _0x2e365c[_0x288d('0x24')](_0x288d('0x25'),_0x28cfc6+'-'+_0xbb07a3+'/'+_0x496a6f)[_0x288d('0x1e')](_0x1e27df);}return null;};}function patchUpdates(_0x4b1f79){return function(_0x525088){try{jsonpatch[_0x288d('0x26')](_0x525088,_0x4b1f79,!![]);}catch(_0x15683c){return BPromise[_0x288d('0x27')](_0x15683c);}return _0x525088[_0x288d('0x28')]();};}function saveUpdates(_0x47324f,_0x2f42aa){return function(_0x489e9e){if(_0x489e9e){return _0x489e9e[_0x288d('0x29')](_0x47324f)[_0x288d('0x2a')](function(_0xc2f809){return _0xc2f809;});}return null;};}function removeEntity(_0x23ed0d,_0x40866b){return function(_0x3e06e3){if(_0x3e06e3){return _0x3e06e3['destroy']()['then'](function(){_0x23ed0d[_0x288d('0x23')](0xcc)[_0x288d('0x1d')]();});}};}function handleEntityNotFound(_0x12a5f1,_0x54879d){return function(_0x30b423){if(!_0x30b423){_0x12a5f1[_0x288d('0x1c')](0x194);}return _0x30b423;};}function handleError(_0x534e37,_0x382172){_0x382172=_0x382172||0x1f4;return function(_0x21c680){logger[_0x288d('0x2b')](_0x21c680[_0x288d('0x2c')]);if(_0x21c680[_0x288d('0x2d')]){delete _0x21c680[_0x288d('0x2d')];}_0x534e37[_0x288d('0x23')](_0x382172)[_0x288d('0x2e')](_0x21c680);};}exports[_0x288d('0x2f')]=function(_0x42158c,_0xc195ce){var _0x5b1b83={},_0x29b4ff={},_0x39a298={'count':0x0,'rows':[]};var _0x4ee631=_[_0x288d('0x30')](db[_0x288d('0x31')][_0x288d('0x32')],function(_0x5b59db){return{'name':_0x5b59db[_0x288d('0x33')],'type':_0x5b59db[_0x288d('0x34')][_0x288d('0x35')]};});_0x29b4ff[_0x288d('0x36')]=_[_0x288d('0x30')](_0x4ee631,_0x288d('0x2d'));_0x29b4ff[_0x288d('0x37')]=_[_0x288d('0x38')](_0x42158c[_0x288d('0x37')]);_0x29b4ff[_0x288d('0x39')]=_['intersection'](_0x29b4ff[_0x288d('0x36')],_0x29b4ff['query']);_0x5b1b83[_0x288d('0x3a')]=_[_0x288d('0x3b')](_0x29b4ff['model'],qs[_0x288d('0x3c')](_0x42158c[_0x288d('0x37')][_0x288d('0x3c')]));_0x5b1b83[_0x288d('0x3a')]=_0x5b1b83['attributes']['length']?_0x5b1b83[_0x288d('0x3a')]:_0x29b4ff[_0x288d('0x36')];if(!_0x42158c[_0x288d('0x37')][_0x288d('0x3d')]('nolimit')){_0x5b1b83[_0x288d('0x21')]=qs['limit'](_0x42158c[_0x288d('0x37')][_0x288d('0x21')]);_0x5b1b83[_0x288d('0x1f')]=qs['offset'](_0x42158c[_0x288d('0x37')][_0x288d('0x1f')]);}_0x5b1b83[_0x288d('0x3e')]=qs[_0x288d('0x3f')](_0x42158c['query'][_0x288d('0x3f')]);_0x5b1b83[_0x288d('0x40')]=qs['filters'](_[_0x288d('0x41')](_0x42158c[_0x288d('0x37')],_0x29b4ff[_0x288d('0x39')]),_0x4ee631);if(_0x42158c[_0x288d('0x37')][_0x288d('0x42')]){_0x5b1b83[_0x288d('0x40')]=_[_0x288d('0x43')](_0x5b1b83[_0x288d('0x40')],{'$or':_[_0x288d('0x30')](_0x4ee631,function(_0x5aa1e5){if(_0x5aa1e5['type']!==_0x288d('0x44')){var _0x32ffbc={};_0x32ffbc[_0x5aa1e5[_0x288d('0x2d')]]={'$like':'%'+_0x42158c[_0x288d('0x37')][_0x288d('0x42')]+'%'};return _0x32ffbc;}})});}_0x5b1b83=_[_0x288d('0x43')]({},_0x5b1b83,_0x42158c[_0x288d('0x45')]);var _0x26d8ae={'where':_0x5b1b83[_0x288d('0x40')]};return db['VoiceQueueReport'][_0x288d('0x22')](_0x26d8ae)[_0x288d('0x2a')](function(_0x48893e){_0x39a298[_0x288d('0x22')]=_0x48893e;if(_0x42158c['query']['includeAll']){_0x5b1b83['include']=[{'all':!![]}];}return db[_0x288d('0x31')]['findAll'](_0x5b1b83);})['then'](function(_0x344ff8){_0x39a298[_0x288d('0x46')]=_0x344ff8;return _0x39a298;})[_0x288d('0x2a')](respondWithFilteredResult(_0xc195ce,_0x5b1b83))[_0x288d('0x47')](handleError(_0xc195ce,null));};exports[_0x288d('0x48')]=function(_0x26777e,_0x337d59){var _0x3ea8be={'raw':![],'where':{'id':_0x26777e[_0x288d('0x49')]['id']}},_0x5b34b1={};_0x5b34b1[_0x288d('0x36')]=_[_0x288d('0x38')](db[_0x288d('0x31')]['rawAttributes']);_0x5b34b1['query']=_[_0x288d('0x38')](_0x26777e['query']);_0x5b34b1[_0x288d('0x39')]=_[_0x288d('0x3b')](_0x5b34b1[_0x288d('0x36')],_0x5b34b1[_0x288d('0x37')]);_0x3ea8be[_0x288d('0x3a')]=_[_0x288d('0x3b')](_0x5b34b1[_0x288d('0x36')],qs['fields'](_0x26777e[_0x288d('0x37')]['fields']));_0x3ea8be[_0x288d('0x3a')]=_0x3ea8be['attributes'][_0x288d('0x4a')]?_0x3ea8be[_0x288d('0x3a')]:_0x5b34b1[_0x288d('0x36')];if(_0x26777e[_0x288d('0x37')]['includeAll']){_0x3ea8be['include']=[{'all':!![]}];}_0x3ea8be=_[_0x288d('0x43')]({},_0x3ea8be,_0x26777e[_0x288d('0x45')]);return db['VoiceQueueReport'][_0x288d('0x4b')](_0x3ea8be)[_0x288d('0x2a')](handleEntityNotFound(_0x337d59,null))[_0x288d('0x2a')](respondWithResult(_0x337d59,null))[_0x288d('0x47')](handleError(_0x337d59,null));};exports[_0x288d('0x4c')]=function(_0x338e9e,_0x54a707){return db[_0x288d('0x31')][_0x288d('0x4c')](_0x338e9e[_0x288d('0x4d')],{})[_0x288d('0x2a')](respondWithResult(_0x54a707,0xc9))[_0x288d('0x47')](handleError(_0x54a707,null));};exports[_0x288d('0x29')]=function(_0x3ece05,_0x197025){if(_0x3ece05[_0x288d('0x4d')]['id']){delete _0x3ece05[_0x288d('0x4d')]['id'];}return db[_0x288d('0x31')][_0x288d('0x4b')]({'where':{'id':_0x3ece05[_0x288d('0x49')]['id']}})['then'](handleEntityNotFound(_0x197025,null))[_0x288d('0x2a')](saveUpdates(_0x3ece05[_0x288d('0x4d')],null))[_0x288d('0x2a')](respondWithResult(_0x197025,null))[_0x288d('0x47')](handleError(_0x197025,null));};exports[_0x288d('0x4e')]=function(_0x5e0060,_0x3f593e){return db[_0x288d('0x31')]['find']({'where':{'id':_0x5e0060['params']['id']}})[_0x288d('0x2a')](handleEntityNotFound(_0x3f593e,null))['then'](removeEntity(_0x3f593e,null))['catch'](handleError(_0x3f593e,null));};exports['describe']=function(_0x5e7a43,_0x5715f4){return db[_0x288d('0x31')]['describe']()[_0x288d('0x2a')](respondWithResult(_0x5715f4,null))[_0x288d('0x47')](handleError(_0x5715f4,null));};exports[_0x288d('0x4f')]=function(_0x6e2bb3,_0x342294){var _0x51a326={},_0x2e36f9={},_0x2ee454={'count':0x0,'rows':[]};_0x2e36f9['model']=_[_0x288d('0x38')](db[_0x288d('0x31')]['rawAttributes']);_0x2e36f9[_0x288d('0x37')]=_['keys'](_0x6e2bb3[_0x288d('0x37')]);_0x2e36f9[_0x288d('0x39')]=_[_0x288d('0x3b')](_0x2e36f9['model'],_0x2e36f9[_0x288d('0x37')]);_0x51a326[_0x288d('0x3a')]=_[_0x288d('0x3b')](_0x2e36f9['model'],qs[_0x288d('0x3c')](_0x6e2bb3[_0x288d('0x37')][_0x288d('0x3c')]));_0x51a326['attributes']=_0x51a326['attributes'][_0x288d('0x4a')]?_0x51a326[_0x288d('0x3a')]:_0x2e36f9[_0x288d('0x36')];if(!_0x6e2bb3[_0x288d('0x37')][_0x288d('0x3d')](_0x288d('0x50'))){_0x51a326[_0x288d('0x21')]=qs[_0x288d('0x21')](_0x6e2bb3[_0x288d('0x37')][_0x288d('0x21')]);_0x51a326[_0x288d('0x1f')]=qs[_0x288d('0x1f')](_0x6e2bb3['query']['offset']);}_0x51a326[_0x288d('0x3e')]=qs['sort'](_0x6e2bb3[_0x288d('0x37')]['sort']);_0x51a326['where']=qs[_0x288d('0x39')](_['pick'](_0x6e2bb3[_0x288d('0x37')],_0x2e36f9[_0x288d('0x39')]));if(_0x6e2bb3[_0x288d('0x37')][_0x288d('0x42')]){_0x51a326[_0x288d('0x40')]=_['merge'](_0x51a326[_0x288d('0x40')],{'$or':_[_0x288d('0x30')](_0x51a326[_0x288d('0x3a')],function(_0x498cff){var _0x41f70c={};_0x41f70c[_0x498cff]={'$like':'%'+_0x6e2bb3[_0x288d('0x37')]['filter']+'%'};return _0x41f70c;})});}_0x51a326=_[_0x288d('0x43')]({},_0x51a326,_0x6e2bb3['options']);var _0x575cdc={'where':_0x51a326['where']};return db['VoiceQueueReport']['count'](_0x575cdc)[_0x288d('0x2a')](function(_0x40e750){_0x2ee454[_0x288d('0x22')]=_0x40e750;if(_0x6e2bb3['query']['includeAll']){_0x51a326[_0x288d('0x51')]=[{'all':!![]}];}return db[_0x288d('0x31')]['findAll'](_0x51a326);})['then'](function(_0x5a42db){_0x2ee454[_0x288d('0x46')]=_0x5a42db;return _0x2ee454;})[_0x288d('0x2a')](respondWithFilteredResult(_0x342294,_0x51a326,_0x288d('0x4f')))[_0x288d('0x47')](handleError(_0x342294,null,_0x288d('0x4f')));}; \ No newline at end of file +var _0x8ff6=['lodash','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','stack','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','create','body','find','params','destroy','describe','getVoiceQueuesReport','order','filter','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x2e9962,_0x24132f){var _0x5387fc=function(_0x372a7b){while(--_0x372a7b){_0x2e9962['push'](_0x2e9962['shift']());}};_0x5387fc(++_0x24132f);}(_0x8ff6,0x9c));var _0x68ff=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8ff6[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68ff('0x0'));var zipdir=require(_0x68ff('0x1'));var jsonpatch=require(_0x68ff('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68ff('0x3'));var Mustache=require(_0x68ff('0x4'));var util=require(_0x68ff('0x5'));var path=require(_0x68ff('0x6'));var sox=require(_0x68ff('0x7'));var csv=require('to-csv');var ejs=require(_0x68ff('0x8'));var fs=require('fs');var fs_extra=require(_0x68ff('0x9'));var _=require(_0x68ff('0xa'));var squel=require('squel');var crypto=require(_0x68ff('0xb'));var jsforce=require(_0x68ff('0xc'));var deskjs=require(_0x68ff('0xd'));var toCsv=require('to-csv');var querystring=require(_0x68ff('0xe'));var Papa=require('papaparse');var Redis=require(_0x68ff('0xf'));var authService=require(_0x68ff('0x10'));var qs=require(_0x68ff('0x11'));var as=require(_0x68ff('0x12'));var hardwareService=require(_0x68ff('0x13'));var logger=require(_0x68ff('0x14'))(_0x68ff('0x15'));var utils=require(_0x68ff('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x68ff('0x17'));var db=require(_0x68ff('0x18'))['db'];config[_0x68ff('0x19')]=_[_0x68ff('0x1a')](config[_0x68ff('0x19')],{'host':_0x68ff('0x1b'),'port':0x18eb});var socket=require(_0x68ff('0x1c'))(new Redis(config[_0x68ff('0x19')]));require('./voiceQueueReport.socket')[_0x68ff('0x1d')](socket);function respondWithStatusCode(_0x521b21,_0x364fc7){_0x364fc7=_0x364fc7||0xcc;return function(_0x5f2bc0){if(_0x5f2bc0){return _0x521b21[_0x68ff('0x1e')](_0x364fc7);}return _0x521b21[_0x68ff('0x1f')](_0x364fc7)['end']();};}function respondWithResult(_0x29e466,_0xd2ca1d){_0xd2ca1d=_0xd2ca1d||0xc8;return function(_0x3dfa89){if(_0x3dfa89){return _0x29e466['status'](_0xd2ca1d)[_0x68ff('0x20')](_0x3dfa89);}};}function respondWithFilteredResult(_0x390fb1,_0x2f5ffd){return function(_0x12d139){if(_0x12d139){var _0x23de03=typeof _0x2f5ffd[_0x68ff('0x21')]==='undefined'&&typeof _0x2f5ffd[_0x68ff('0x22')]===_0x68ff('0x23');var _0x59a298=_0x12d139[_0x68ff('0x24')];var _0x1be1a9=_0x23de03?0x0:_0x2f5ffd[_0x68ff('0x21')];var _0x2c37fd=_0x23de03?_0x12d139[_0x68ff('0x24')]:_0x2f5ffd['offset']+_0x2f5ffd[_0x68ff('0x22')];var _0x5f4470;if(_0x2c37fd>=_0x59a298){_0x2c37fd=_0x59a298;_0x5f4470=0xc8;}else{_0x5f4470=0xce;}_0x390fb1[_0x68ff('0x1f')](_0x5f4470);return _0x390fb1[_0x68ff('0x25')](_0x68ff('0x26'),_0x1be1a9+'-'+_0x2c37fd+'/'+_0x59a298)[_0x68ff('0x20')](_0x12d139);}return null;};}function patchUpdates(_0x58d630){return function(_0x5b180d){try{jsonpatch[_0x68ff('0x27')](_0x5b180d,_0x58d630,!![]);}catch(_0x241943){return BPromise[_0x68ff('0x28')](_0x241943);}return _0x5b180d[_0x68ff('0x29')]();};}function saveUpdates(_0x31a9ce,_0xafeaf6){return function(_0x199c24){if(_0x199c24){return _0x199c24[_0x68ff('0x2a')](_0x31a9ce)['then'](function(_0x3b4f43){return _0x3b4f43;});}return null;};}function removeEntity(_0x5e02e7,_0x3b66a7){return function(_0x5650c1){if(_0x5650c1){return _0x5650c1['destroy']()['then'](function(){_0x5e02e7[_0x68ff('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd035,_0x10ab2c){return function(_0x4fd765){if(!_0x4fd765){_0x5bd035['sendStatus'](0x194);}return _0x4fd765;};}function handleError(_0xa04345,_0x4e9d8d){_0x4e9d8d=_0x4e9d8d||0x1f4;return function(_0x45c7d9){logger['error'](_0x45c7d9[_0x68ff('0x2b')]);if(_0x45c7d9['name']){delete _0x45c7d9['name'];}_0xa04345[_0x68ff('0x1f')](_0x4e9d8d)[_0x68ff('0x2c')](_0x45c7d9);};}exports[_0x68ff('0x2d')]=function(_0x48675b,_0x428a7d){var _0x198909={},_0x28bf38={},_0x402766={'count':0x0,'rows':[]};var _0x35fa1a=_[_0x68ff('0x2e')](db[_0x68ff('0x2f')][_0x68ff('0x30')],function(_0x372901){return{'name':_0x372901[_0x68ff('0x31')],'type':_0x372901[_0x68ff('0x32')]['key']};});_0x28bf38[_0x68ff('0x33')]=_[_0x68ff('0x2e')](_0x35fa1a,_0x68ff('0x34'));_0x28bf38[_0x68ff('0x35')]=_[_0x68ff('0x36')](_0x48675b[_0x68ff('0x35')]);_0x28bf38[_0x68ff('0x37')]=_[_0x68ff('0x38')](_0x28bf38['model'],_0x28bf38[_0x68ff('0x35')]);_0x198909['attributes']=_[_0x68ff('0x38')](_0x28bf38[_0x68ff('0x33')],qs[_0x68ff('0x39')](_0x48675b[_0x68ff('0x35')]['fields']));_0x198909[_0x68ff('0x3a')]=_0x198909[_0x68ff('0x3a')][_0x68ff('0x3b')]?_0x198909[_0x68ff('0x3a')]:_0x28bf38[_0x68ff('0x33')];if(!_0x48675b[_0x68ff('0x35')][_0x68ff('0x3c')](_0x68ff('0x3d'))){_0x198909['limit']=qs[_0x68ff('0x22')](_0x48675b['query'][_0x68ff('0x22')]);_0x198909[_0x68ff('0x21')]=qs[_0x68ff('0x21')](_0x48675b['query'][_0x68ff('0x21')]);}_0x198909['order']=qs[_0x68ff('0x3e')](_0x48675b[_0x68ff('0x35')][_0x68ff('0x3e')]);_0x198909[_0x68ff('0x3f')]=qs[_0x68ff('0x37')](_['pick'](_0x48675b['query'],_0x28bf38['filters']),_0x35fa1a);if(_0x48675b[_0x68ff('0x35')]['filter']){_0x198909[_0x68ff('0x3f')]=_[_0x68ff('0x40')](_0x198909['where'],{'$or':_['map'](_0x35fa1a,function(_0x38f444){if(_0x38f444[_0x68ff('0x32')]!==_0x68ff('0x41')){var _0x223513={};_0x223513[_0x38f444[_0x68ff('0x34')]]={'$like':'%'+_0x48675b['query']['filter']+'%'};return _0x223513;}})});}_0x198909=_[_0x68ff('0x40')]({},_0x198909,_0x48675b[_0x68ff('0x42')]);var _0x5a2320={'where':_0x198909[_0x68ff('0x3f')]};return db[_0x68ff('0x2f')][_0x68ff('0x24')](_0x5a2320)[_0x68ff('0x43')](function(_0x474322){_0x402766[_0x68ff('0x24')]=_0x474322;if(_0x48675b[_0x68ff('0x35')][_0x68ff('0x44')]){_0x198909[_0x68ff('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x68ff('0x46')](_0x198909);})['then'](function(_0x3d067f){_0x402766[_0x68ff('0x47')]=_0x3d067f;return _0x402766;})[_0x68ff('0x43')](respondWithFilteredResult(_0x428a7d,_0x198909))[_0x68ff('0x48')](handleError(_0x428a7d,null));};exports[_0x68ff('0x49')]=function(_0xd3d823,_0x36fdf8){var _0x461f14={'raw':![],'where':{'id':_0xd3d823['params']['id']}},_0x11ef3d={};_0x11ef3d[_0x68ff('0x33')]=_['keys'](db[_0x68ff('0x2f')]['rawAttributes']);_0x11ef3d[_0x68ff('0x35')]=_[_0x68ff('0x36')](_0xd3d823[_0x68ff('0x35')]);_0x11ef3d[_0x68ff('0x37')]=_['intersection'](_0x11ef3d[_0x68ff('0x33')],_0x11ef3d[_0x68ff('0x35')]);_0x461f14[_0x68ff('0x3a')]=_[_0x68ff('0x38')](_0x11ef3d[_0x68ff('0x33')],qs[_0x68ff('0x39')](_0xd3d823[_0x68ff('0x35')]['fields']));_0x461f14['attributes']=_0x461f14[_0x68ff('0x3a')]['length']?_0x461f14[_0x68ff('0x3a')]:_0x11ef3d['model'];if(_0xd3d823[_0x68ff('0x35')][_0x68ff('0x44')]){_0x461f14[_0x68ff('0x45')]=[{'all':!![]}];}_0x461f14=_['merge']({},_0x461f14,_0xd3d823[_0x68ff('0x42')]);return db['VoiceQueueReport']['find'](_0x461f14)['then'](handleEntityNotFound(_0x36fdf8,null))[_0x68ff('0x43')](respondWithResult(_0x36fdf8,null))['catch'](handleError(_0x36fdf8,null));};exports[_0x68ff('0x4a')]=function(_0x3a401f,_0x2cfa1d){return db[_0x68ff('0x2f')][_0x68ff('0x4a')](_0x3a401f[_0x68ff('0x4b')],{})[_0x68ff('0x43')](respondWithResult(_0x2cfa1d,0xc9))['catch'](handleError(_0x2cfa1d,null));};exports['update']=function(_0x46f751,_0x135a4b){if(_0x46f751[_0x68ff('0x4b')]['id']){delete _0x46f751[_0x68ff('0x4b')]['id'];}return db['VoiceQueueReport'][_0x68ff('0x4c')]({'where':{'id':_0x46f751[_0x68ff('0x4d')]['id']}})[_0x68ff('0x43')](handleEntityNotFound(_0x135a4b,null))['then'](saveUpdates(_0x46f751[_0x68ff('0x4b')],null))[_0x68ff('0x43')](respondWithResult(_0x135a4b,null))[_0x68ff('0x48')](handleError(_0x135a4b,null));};exports[_0x68ff('0x4e')]=function(_0xc74652,_0x5d2ec7){return db['VoiceQueueReport'][_0x68ff('0x4c')]({'where':{'id':_0xc74652[_0x68ff('0x4d')]['id']}})[_0x68ff('0x43')](handleEntityNotFound(_0x5d2ec7,null))['then'](removeEntity(_0x5d2ec7,null))[_0x68ff('0x48')](handleError(_0x5d2ec7,null));};exports[_0x68ff('0x4f')]=function(_0x37f464,_0xdff1a9){return db[_0x68ff('0x2f')][_0x68ff('0x4f')]()[_0x68ff('0x43')](respondWithResult(_0xdff1a9,null))['catch'](handleError(_0xdff1a9,null));};exports[_0x68ff('0x50')]=function(_0x2ae311,_0x3ec366){var _0x565d99={},_0x210b89={},_0xcdbf2f={'count':0x0,'rows':[]};_0x210b89['model']=_[_0x68ff('0x36')](db[_0x68ff('0x2f')]['rawAttributes']);_0x210b89[_0x68ff('0x35')]=_[_0x68ff('0x36')](_0x2ae311['query']);_0x210b89[_0x68ff('0x37')]=_['intersection'](_0x210b89[_0x68ff('0x33')],_0x210b89[_0x68ff('0x35')]);_0x565d99[_0x68ff('0x3a')]=_[_0x68ff('0x38')](_0x210b89[_0x68ff('0x33')],qs[_0x68ff('0x39')](_0x2ae311[_0x68ff('0x35')][_0x68ff('0x39')]));_0x565d99[_0x68ff('0x3a')]=_0x565d99[_0x68ff('0x3a')][_0x68ff('0x3b')]?_0x565d99['attributes']:_0x210b89[_0x68ff('0x33')];if(!_0x2ae311[_0x68ff('0x35')]['hasOwnProperty'](_0x68ff('0x3d'))){_0x565d99[_0x68ff('0x22')]=qs['limit'](_0x2ae311[_0x68ff('0x35')][_0x68ff('0x22')]);_0x565d99[_0x68ff('0x21')]=qs[_0x68ff('0x21')](_0x2ae311['query']['offset']);}_0x565d99[_0x68ff('0x51')]=qs[_0x68ff('0x3e')](_0x2ae311[_0x68ff('0x35')][_0x68ff('0x3e')]);_0x565d99[_0x68ff('0x3f')]=qs['filters'](_['pick'](_0x2ae311[_0x68ff('0x35')],_0x210b89[_0x68ff('0x37')]));if(_0x2ae311[_0x68ff('0x35')]['filter']){_0x565d99['where']=_['merge'](_0x565d99[_0x68ff('0x3f')],{'$or':_[_0x68ff('0x2e')](_0x565d99[_0x68ff('0x3a')],function(_0x70cfab){var _0xd559b7={};_0xd559b7[_0x70cfab]={'$like':'%'+_0x2ae311[_0x68ff('0x35')][_0x68ff('0x52')]+'%'};return _0xd559b7;})});}_0x565d99=_[_0x68ff('0x40')]({},_0x565d99,_0x2ae311[_0x68ff('0x42')]);var _0x510f0c={'where':_0x565d99['where']};return db[_0x68ff('0x2f')][_0x68ff('0x24')](_0x510f0c)[_0x68ff('0x43')](function(_0x20d68c){_0xcdbf2f['count']=_0x20d68c;if(_0x2ae311[_0x68ff('0x35')][_0x68ff('0x44')]){_0x565d99['include']=[{'all':!![]}];}return db[_0x68ff('0x2f')][_0x68ff('0x46')](_0x565d99);})[_0x68ff('0x43')](function(_0x385973){_0xcdbf2f[_0x68ff('0x47')]=_0x385973;return _0xcdbf2f;})[_0x68ff('0x43')](respondWithFilteredResult(_0x3ec366,_0x565d99,_0x68ff('0x50')))[_0x68ff('0x48')](handleError(_0x3ec366,null,_0x68ff('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b6ec1e4..520c711 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 _0xd25d=['emit','hook','exports','events','../../mysqldb','VoiceQueueReport','remove'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd25d,0x199));var _0xdd25=function(_0x3a05ba,_0x3f03ee){_0x3a05ba=_0x3a05ba-0x0;var _0x270df4=_0xd25d[_0x3a05ba];return _0x270df4;};'use strict';var EventEmitter=require(_0xdd25('0x0'));var VoiceQueueReport=require(_0xdd25('0x1'))['db'][_0xdd25('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdd25('0x3')};function emitEvent(_0x2c8aae){return function(_0x28e8f9,_0x230d19,_0x4656ce){VoiceQueueReportEvents[_0xdd25('0x4')](_0x2c8aae+':'+_0x28e8f9['id'],_0x28e8f9);VoiceQueueReportEvents[_0xdd25('0x4')](_0x2c8aae,_0x28e8f9);_0x4656ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xdd25('0x5')](e,emitEvent(event));}}module[_0xdd25('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5e0a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1d8d2a,_0x1641ad){var _0x33f660=function(_0x519a04){while(--_0x519a04){_0x1d8d2a['push'](_0x1d8d2a['shift']());}};_0x33f660(++_0x1641ad);}(_0x5e0a,0x7e));var _0xa5e0=function(_0x40282b,_0x3e85bf){_0x40282b=_0x40282b-0x0;var _0x42b730=_0x5e0a[_0x40282b];return _0x42b730;};'use strict';var EventEmitter=require(_0xa5e0('0x0'));var VoiceQueueReport=require(_0xa5e0('0x1'))['db'][_0xa5e0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa5e0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa5e0('0x4'),'afterDestroy':_0xa5e0('0x5')};function emitEvent(_0x1f5c6a){return function(_0x165c21,_0x4a6ebf,_0x267292){VoiceQueueReportEvents[_0xa5e0('0x6')](_0x1f5c6a+':'+_0x165c21['id'],_0x165c21);VoiceQueueReportEvents[_0xa5e0('0x6')](_0x1f5c6a,_0x165c21);_0x267292(null);};}for(var e in events){if(events[_0xa5e0('0x7')](e)){var event=events[e];VoiceQueueReport[_0xa5e0('0x8')](e,emitEvent(event));}}module[_0xa5e0('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 6c4d047..454adf4 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 _0x7af3=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x7af3,0x72));var _0x37af=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7af3[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require(_0x37af('0x0'));var logger=require('../../config/logger')(_0x37af('0x1'));var moment=require('moment');var BPromise=require(_0x37af('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37af('0x3'));var rimraf=require(_0x37af('0x4'));var config=require(_0x37af('0x5'));var attributes=require(_0x37af('0x6'));module[_0x37af('0x7')]=function(_0x3020a0,_0x1b8a99){return _0x3020a0[_0x37af('0x8')](_0x37af('0x9'),attributes,{'tableName':_0x37af('0xa'),'paranoid':![],'indexes':[{'fields':[_0x37af('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1781=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','api','moment','request-promise'];(function(_0x21d326,_0x41b110){var _0x4b4f48=function(_0x5eb33d){while(--_0x5eb33d){_0x21d326['push'](_0x21d326['shift']());}};_0x4b4f48(++_0x41b110);}(_0x1781,0x109));var _0x1178=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1781[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1178('0x0'));var util=require(_0x1178('0x1'));var logger=require('../../config/logger')(_0x1178('0x2'));var moment=require(_0x1178('0x3'));var BPromise=require('bluebird');var rp=require(_0x1178('0x4'));var fs=require('fs');var path=require(_0x1178('0x5'));var rimraf=require(_0x1178('0x6'));var config=require(_0x1178('0x7'));var attributes=require(_0x1178('0x8'));module[_0x1178('0x9')]=function(_0x23c55d,_0x24319e){return _0x23c55d[_0x1178('0xa')](_0x1178('0xb'),attributes,{'tableName':_0x1178('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1178('0xd')]},{'fields':[_0x1178('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1c60f24..0db41df 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 _0xe7b2=['stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x33c663,_0x4416ed){var _0x4c6299=function(_0x4c1937){while(--_0x4c1937){_0x33c663['push'](_0x33c663['shift']());}};_0x4c6299(++_0x4416ed);}(_0xe7b2,0x1b5));var _0x2e7b=function(_0x2e2cde,_0x1f3068){_0x2e2cde=_0x2e2cde-0x0;var _0x330b4e=_0xe7b2[_0x2e2cde];return _0x330b4e;};'use strict';var _=require(_0x2e7b('0x0'));var util=require(_0x2e7b('0x1'));var moment=require(_0x2e7b('0x2'));var BPromise=require(_0x2e7b('0x3'));var rs=require(_0x2e7b('0x4'));var fs=require('fs');var Redis=require(_0x2e7b('0x5'));var db=require(_0x2e7b('0x6'))['db'];var utils=require(_0x2e7b('0x7'));var logger=require(_0x2e7b('0x8'))('rpc');var config=require(_0x2e7b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2e7b('0xa')][_0x2e7b('0xb')]({'port':0x232a});config[_0x2e7b('0xc')]=_[_0x2e7b('0xd')](config[_0x2e7b('0xc')],{'host':_0x2e7b('0xe'),'port':0x18eb});var socket=require(_0x2e7b('0xf'))(new Redis(config[_0x2e7b('0xc')]));require(_0x2e7b('0x10'))['register'](socket);function respondWithRpcPromise(_0x170ae9,_0x4eb4e9,_0x26af99){return new BPromise(function(_0x2bc3be,_0x1b876a){return client[_0x2e7b('0x11')](_0x170ae9,_0x26af99)['then'](function(_0x5da071){logger[_0x2e7b('0x12')](_0x2e7b('0x13'),_0x4eb4e9,'request\x20sent');logger[_0x2e7b('0x14')](_0x2e7b('0x15'),_0x4eb4e9,_0x2e7b('0x16'),JSON[_0x2e7b('0x17')](_0x5da071));if(_0x5da071['error']){if(_0x5da071[_0x2e7b('0x18')][_0x2e7b('0x19')]===0x1f4){logger[_0x2e7b('0x18')](_0x2e7b('0x13'),_0x4eb4e9,_0x5da071[_0x2e7b('0x18')][_0x2e7b('0x1a')]);return _0x1b876a(_0x5da071[_0x2e7b('0x18')][_0x2e7b('0x1a')]);}logger[_0x2e7b('0x18')](_0x2e7b('0x13'),_0x4eb4e9,_0x5da071['error'][_0x2e7b('0x1a')]);return _0x2bc3be(_0x5da071[_0x2e7b('0x18')][_0x2e7b('0x1a')]);}else{logger[_0x2e7b('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x4eb4e9,_0x2e7b('0x16'));_0x2bc3be(_0x5da071[_0x2e7b('0x1b')][_0x2e7b('0x1a')]);}})[_0x2e7b('0x1c')](function(_0x449e3a){logger[_0x2e7b('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x4eb4e9,_0x449e3a);_0x1b876a(_0x449e3a);});});}exports[_0x2e7b('0x1d')]=function(_0x449cc3){var _0x30325e=this;return new Promise(function(_0x1675f3,_0x4bfc79){return db['VoiceQueueReport'][_0x2e7b('0x1e')]({'raw':_0x449cc3[_0x2e7b('0x1f')]?_0x449cc3[_0x2e7b('0x1f')][_0x2e7b('0x20')]===undefined?!![]:![]:!![],'where':_0x449cc3[_0x2e7b('0x1f')]?_0x449cc3[_0x2e7b('0x1f')][_0x2e7b('0x21')]||null:null,'attributes':_0x449cc3['options']?_0x449cc3['options'][_0x2e7b('0x22')]||null:null,'limit':_0x449cc3[_0x2e7b('0x1f')]?_0x449cc3[_0x2e7b('0x1f')][_0x2e7b('0x23')]||null:null,'include':_0x449cc3[_0x2e7b('0x1f')]?_0x449cc3[_0x2e7b('0x1f')][_0x2e7b('0x24')]?_[_0x2e7b('0x25')](_0x449cc3[_0x2e7b('0x1f')][_0x2e7b('0x24')],function(_0x3ec155){return{'model':db[_0x3ec155[_0x2e7b('0x26')]],'as':_0x3ec155['as'],'attributes':_0x3ec155[_0x2e7b('0x22')],'include':_0x3ec155[_0x2e7b('0x24')]?_[_0x2e7b('0x25')](_0x3ec155['include'],function(_0x1625f4){return{'model':db[_0x1625f4['model']],'as':_0x1625f4['as'],'attributes':_0x1625f4[_0x2e7b('0x22')],'include':_0x1625f4[_0x2e7b('0x24')]?_[_0x2e7b('0x25')](_0x1625f4[_0x2e7b('0x24')],function(_0x606102){return{'model':db[_0x606102[_0x2e7b('0x26')]],'as':_0x606102['as'],'attributes':_0x606102[_0x2e7b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2e7b('0x27')](function(_0x359a22){logger['info']('GetVoiceQueueReport',_0x449cc3);logger[_0x2e7b('0x14')](_0x2e7b('0x1d'),_0x449cc3,JSON[_0x2e7b('0x17')](_0x359a22));_0x1675f3(_0x359a22);})[_0x2e7b('0x1c')](function(_0x4aa213){logger['error']('GetVoiceQueueReport',_0x4aa213['message'],_0x449cc3);_0x4bfc79(_0x30325e[_0x2e7b('0x18')](0x1f4,_0x4aa213[_0x2e7b('0x1a')]));});});};exports[_0x2e7b('0x28')]=function(_0xba76c8){var _0x4212c4=this;return new Promise(function(_0x50ee01,_0x446144){return db[_0x2e7b('0x29')][_0x2e7b('0x2a')](_0xba76c8[_0x2e7b('0x2b')],{'raw':_0xba76c8['options']?_0xba76c8[_0x2e7b('0x1f')][_0x2e7b('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x16231c){logger[_0x2e7b('0x12')]('CreateVoiceQueueReport',_0xba76c8);logger[_0x2e7b('0x14')](_0x2e7b('0x28'),_0xba76c8,JSON['stringify'](_0x16231c));_0x50ee01(_0x16231c);})[_0x2e7b('0x1c')](function(_0x4cbe90){logger[_0x2e7b('0x18')](_0x2e7b('0x28'),_0x4cbe90['message'],_0xba76c8);_0x446144(_0x4212c4[_0x2e7b('0x18')](0x1f4,_0x4cbe90[_0x2e7b('0x1a')]));});});};exports[_0x2e7b('0x2c')]=function(_0x337733){var _0x556acd=this;return new Promise(function(_0x142a4c,_0x23e0ef){return db[_0x2e7b('0x29')][_0x2e7b('0x2d')](_0x337733[_0x2e7b('0x2b')],{'raw':_0x337733['options']?_0x337733[_0x2e7b('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337733[_0x2e7b('0x1f')]?_0x337733[_0x2e7b('0x1f')]['where']||null:null,'attributes':_0x337733[_0x2e7b('0x1f')]?_0x337733[_0x2e7b('0x1f')][_0x2e7b('0x22')]||null:null,'limit':_0x337733['options']?_0x337733['options']['limit']||null:null})[_0x2e7b('0x27')](function(_0x504903){logger['info']('UpdateVoiceQueueReport',_0x337733);logger[_0x2e7b('0x14')]('UpdateVoiceQueueReport',_0x337733,JSON['stringify'](_0x504903));_0x142a4c(_0x504903);})[_0x2e7b('0x1c')](function(_0x9dda){logger[_0x2e7b('0x18')]('UpdateVoiceQueueReport',_0x9dda[_0x2e7b('0x1a')],_0x337733);_0x23e0ef(_0x556acd['error'](0x1f4,_0x9dda[_0x2e7b('0x1a')]));});});}; \ No newline at end of file +var _0xe263=['include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','then','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','raw','options','where','attributes','limit'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xe263,0xbe));var _0x3e26=function(_0x2c0c8f,_0x433767){_0x2c0c8f=_0x2c0c8f-0x0;var _0x5f54dc=_0xe263[_0x2c0c8f];return _0x5f54dc;};'use strict';var _=require(_0x3e26('0x0'));var util=require(_0x3e26('0x1'));var moment=require(_0x3e26('0x2'));var BPromise=require(_0x3e26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e26('0x4'));var db=require(_0x3e26('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e26('0x6'))(_0x3e26('0x7'));var config=require(_0x3e26('0x8'));var jayson=require(_0x3e26('0x9'));var client=jayson[_0x3e26('0xa')][_0x3e26('0xb')]({'port':0x232a});config[_0x3e26('0xc')]=_['defaults'](config[_0x3e26('0xc')],{'host':_0x3e26('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e26('0xc')]));require(_0x3e26('0xe'))[_0x3e26('0xf')](socket);function respondWithRpcPromise(_0x5df17a,_0x5b97f5,_0x623250){return new BPromise(function(_0x3f1aa2,_0x28614e){return client[_0x3e26('0x10')](_0x5df17a,_0x623250)['then'](function(_0x5e7aff){logger[_0x3e26('0x11')](_0x3e26('0x12'),_0x5b97f5,_0x3e26('0x13'));logger[_0x3e26('0x14')](_0x3e26('0x15'),_0x5b97f5,'request\x20sent',JSON[_0x3e26('0x16')](_0x5e7aff));if(_0x5e7aff[_0x3e26('0x17')]){if(_0x5e7aff[_0x3e26('0x17')][_0x3e26('0x18')]===0x1f4){logger[_0x3e26('0x17')](_0x3e26('0x12'),_0x5b97f5,_0x5e7aff['error'][_0x3e26('0x19')]);return _0x28614e(_0x5e7aff[_0x3e26('0x17')][_0x3e26('0x19')]);}logger['error'](_0x3e26('0x12'),_0x5b97f5,_0x5e7aff[_0x3e26('0x17')][_0x3e26('0x19')]);return _0x3f1aa2(_0x5e7aff[_0x3e26('0x17')][_0x3e26('0x19')]);}else{logger[_0x3e26('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b97f5,_0x3e26('0x13'));_0x3f1aa2(_0x5e7aff[_0x3e26('0x1a')]['message']);}})[_0x3e26('0x1b')](function(_0x2c4051){logger[_0x3e26('0x17')](_0x3e26('0x12'),_0x5b97f5,_0x2c4051);_0x28614e(_0x2c4051);});});}exports['GetVoiceQueueReport']=function(_0x380109){var _0x2b6ec8=this;return new Promise(function(_0x14de5b,_0x3cd2a3){return db[_0x3e26('0x1c')][_0x3e26('0x1d')]({'raw':_0x380109['options']?_0x380109['options'][_0x3e26('0x1e')]===undefined?!![]:![]:!![],'where':_0x380109[_0x3e26('0x1f')]?_0x380109[_0x3e26('0x1f')][_0x3e26('0x20')]||null:null,'attributes':_0x380109['options']?_0x380109['options'][_0x3e26('0x21')]||null:null,'limit':_0x380109[_0x3e26('0x1f')]?_0x380109['options'][_0x3e26('0x22')]||null:null,'include':_0x380109[_0x3e26('0x1f')]?_0x380109[_0x3e26('0x1f')][_0x3e26('0x23')]?_[_0x3e26('0x24')](_0x380109[_0x3e26('0x1f')]['include'],function(_0x1faed3){return{'model':db[_0x1faed3['model']],'as':_0x1faed3['as'],'attributes':_0x1faed3[_0x3e26('0x21')],'include':_0x1faed3[_0x3e26('0x23')]?_[_0x3e26('0x24')](_0x1faed3['include'],function(_0x3cbae7){return{'model':db[_0x3cbae7[_0x3e26('0x25')]],'as':_0x3cbae7['as'],'attributes':_0x3cbae7[_0x3e26('0x21')],'include':_0x3cbae7[_0x3e26('0x23')]?_[_0x3e26('0x24')](_0x3cbae7[_0x3e26('0x23')],function(_0x4db3ce){return{'model':db[_0x4db3ce[_0x3e26('0x25')]],'as':_0x4db3ce['as'],'attributes':_0x4db3ce[_0x3e26('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51fd9b){logger[_0x3e26('0x11')](_0x3e26('0x26'),_0x380109);logger[_0x3e26('0x14')]('GetVoiceQueueReport',_0x380109,JSON[_0x3e26('0x16')](_0x51fd9b));_0x14de5b(_0x51fd9b);})[_0x3e26('0x1b')](function(_0x574b95){logger[_0x3e26('0x17')](_0x3e26('0x26'),_0x574b95[_0x3e26('0x19')],_0x380109);_0x3cd2a3(_0x2b6ec8[_0x3e26('0x17')](0x1f4,_0x574b95[_0x3e26('0x19')]));});});};exports[_0x3e26('0x27')]=function(_0x513d43){var _0x2d4c70=this;return new Promise(function(_0x102ce8,_0xd65ec8){return db[_0x3e26('0x1c')][_0x3e26('0x28')](_0x513d43['body'],{'raw':_0x513d43['options']?_0x513d43[_0x3e26('0x1f')][_0x3e26('0x1e')]===undefined?!![]:![]:!![]})[_0x3e26('0x29')](function(_0x167a9f){logger[_0x3e26('0x11')](_0x3e26('0x27'),_0x513d43);logger[_0x3e26('0x14')](_0x3e26('0x27'),_0x513d43,JSON[_0x3e26('0x16')](_0x167a9f));_0x102ce8(_0x167a9f);})[_0x3e26('0x1b')](function(_0x45d384){logger[_0x3e26('0x17')](_0x3e26('0x27'),_0x45d384['message'],_0x513d43);_0xd65ec8(_0x2d4c70['error'](0x1f4,_0x45d384[_0x3e26('0x19')]));});});};exports[_0x3e26('0x2a')]=function(_0x2f3419){var _0x4e1c38=this;return new Promise(function(_0x1e8838,_0x439f6c){return db['VoiceQueueReport'][_0x3e26('0x2b')](_0x2f3419[_0x3e26('0x2c')],{'raw':_0x2f3419[_0x3e26('0x1f')]?_0x2f3419[_0x3e26('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3419[_0x3e26('0x1f')]?_0x2f3419['options'][_0x3e26('0x20')]||null:null,'attributes':_0x2f3419[_0x3e26('0x1f')]?_0x2f3419[_0x3e26('0x1f')][_0x3e26('0x21')]||null:null,'limit':_0x2f3419['options']?_0x2f3419[_0x3e26('0x1f')][_0x3e26('0x22')]||null:null})[_0x3e26('0x29')](function(_0x31f074){logger['info'](_0x3e26('0x2a'),_0x2f3419);logger[_0x3e26('0x14')](_0x3e26('0x2a'),_0x2f3419,JSON['stringify'](_0x31f074));_0x1e8838(_0x31f074);})[_0x3e26('0x1b')](function(_0xe64ae6){logger['error'](_0x3e26('0x2a'),_0xe64ae6[_0x3e26('0x19')],_0x2f3419);_0x439f6c(_0x4e1c38[_0x3e26('0x17')](0x1f4,_0xe64ae6[_0x3e26('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ff527ad..c0a7cdb 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 _0xef39=['length','voiceQueueReport:','save','remove','update','emit','removeListener','register'];(function(_0x2a1ce9,_0xb9848a){var _0x228e81=function(_0x3d4249){while(--_0x3d4249){_0x2a1ce9['push'](_0x2a1ce9['shift']());}};_0x228e81(++_0xb9848a);}(_0xef39,0x92));var _0x9ef3=function(_0x3868be,_0x7debd8){_0x3868be=_0x3868be-0x0;var _0x297c05=_0xef39[_0x3868be];return _0x297c05;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x9ef3('0x0'),_0x9ef3('0x1'),_0x9ef3('0x2')];function createListener(_0x1b0836,_0x27d008){return function(_0xd297b1){_0x27d008[_0x9ef3('0x3')](_0x1b0836,_0xd297b1);};}function removeListener(_0x162196,_0x2c4541){return function(){VoiceQueueReportEvents[_0x9ef3('0x4')](_0x162196,_0x2c4541);};}exports[_0x9ef3('0x5')]=function(_0x42911f){for(var _0x50b950=0x0,_0x1b8488=events[_0x9ef3('0x6')];_0x50b950<_0x1b8488;_0x50b950++){var _0x290ffd=events[_0x50b950];var _0x27cfaa=createListener(_0x9ef3('0x7')+_0x290ffd,_0x42911f);VoiceQueueReportEvents['on'](_0x290ffd,_0x27cfaa);}}; \ No newline at end of file +var _0x0689=['update','emit','removeListener','register','voiceQueueReport:','save'];(function(_0x155e8e,_0xa1b75b){var _0x5ca561=function(_0xdaaa9c){while(--_0xdaaa9c){_0x155e8e['push'](_0x155e8e['shift']());}};_0x5ca561(++_0xa1b75b);}(_0x0689,0x161));var _0x9068=function(_0x22a924,_0x3b893c){_0x22a924=_0x22a924-0x0;var _0xf76f64=_0x0689[_0x22a924];return _0xf76f64;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x9068('0x0'),'remove',_0x9068('0x1')];function createListener(_0xcea3b,_0x222292){return function(_0x45c9e5){_0x222292[_0x9068('0x2')](_0xcea3b,_0x45c9e5);};}function removeListener(_0x1c35ba,_0x3b12f4){return function(){VoiceQueueReportEvents[_0x9068('0x3')](_0x1c35ba,_0x3b12f4);};}exports[_0x9068('0x4')]=function(_0x287846){for(var _0x5ce5a7=0x0,_0x34cb67=events['length'];_0x5ce5a7<_0x34cb67;_0x5ce5a7++){var _0x4bdd1b=events[_0x5ce5a7];var _0x17bc63=createListener(_0x9068('0x5')+_0x4bdd1b,_0x287846);VoiceQueueReportEvents['on'](_0x4bdd1b,_0x17bc63);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c9cd823..a0cbf50 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 _0x4889=['/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4889,0x194));var _0x9488=function(_0x4fdee1,_0x3f290c){_0x4fdee1=_0x4fdee1-0x0;var _0x87826e=_0x4889[_0x4fdee1];return _0x87826e;};'use strict';var multer=require(_0x9488('0x0'));var util=require('util');var path=require(_0x9488('0x1'));var timeout=require(_0x9488('0x2'));var express=require('express');var router=express[_0x9488('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9488('0x4'));var config=require(_0x9488('0x5'));var controller=require(_0x9488('0x6'));router[_0x9488('0x7')]('/',auth[_0x9488('0x8')](),controller[_0x9488('0x9')]);router[_0x9488('0x7')](_0x9488('0xa'),auth[_0x9488('0x8')](),controller[_0x9488('0xb')]);router[_0x9488('0xc')]('/',auth[_0x9488('0x8')](),controller[_0x9488('0xd')]);router[_0x9488('0xe')](_0x9488('0xa'),auth[_0x9488('0x8')](),controller['update']);router[_0x9488('0xf')](_0x9488('0xa'),auth[_0x9488('0x8')](),controller[_0x9488('0x10')]);module[_0x9488('0x11')]=router; \ No newline at end of file +var _0x1b2c=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x4f5ab4,_0x34bf64){var _0x3c9576=function(_0x1191d1){while(--_0x1191d1){_0x4f5ab4['push'](_0x4f5ab4['shift']());}};_0x3c9576(++_0x34bf64);}(_0x1b2c,0x105));var _0xc1b2=function(_0x22bda9,_0x4637b7){_0x22bda9=_0x22bda9-0x0;var _0x43af19=_0x1b2c[_0x22bda9];return _0x43af19;};'use strict';var multer=require(_0xc1b2('0x0'));var util=require(_0xc1b2('0x1'));var path=require('path');var timeout=require(_0xc1b2('0x2'));var express=require('express');var router=express[_0xc1b2('0x3')]();var fs_extra=require(_0xc1b2('0x4'));var auth=require(_0xc1b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b2('0x6'));var controller=require(_0xc1b2('0x7'));router[_0xc1b2('0x8')]('/',auth[_0xc1b2('0x9')](),controller[_0xc1b2('0xa')]);router[_0xc1b2('0x8')](_0xc1b2('0xb'),auth[_0xc1b2('0x9')](),controller[_0xc1b2('0xc')]);router[_0xc1b2('0xd')]('/',auth['isAuthenticated'](),controller[_0xc1b2('0xe')]);router[_0xc1b2('0xf')]('/:id',auth[_0xc1b2('0x9')](),controller[_0xc1b2('0x10')]);router['delete']('/:id',auth[_0xc1b2('0x9')](),controller[_0xc1b2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 359206e..9ab08e6 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 _0xc599=['STRING','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x813cc2,_0x2ef8c2){var _0x5a0552=function(_0x2de57d){while(--_0x2de57d){_0x813cc2['push'](_0x813cc2['shift']());}};_0x5a0552(++_0x2ef8c2);}(_0xc599,0x1b2));var _0x9c59=function(_0x4808e0,_0x46806c){_0x4808e0=_0x4808e0-0x0;var _0x16d12a=_0xc599[_0x4808e0];return _0x16d12a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9c59('0x0'));module['exports']={'time':{'type':Sequelize[_0x9c59('0x1')]},'callid':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9c59('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x9c59('0x2'))}}; \ No newline at end of file +var _0x1996=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x1996,0xfb));var _0x6199=function(_0x3448b2,_0xece3dd){_0x3448b2=_0x3448b2-0x0;var _0x260462=_0x1996[_0x3448b2];return _0x260462;};'use strict';var Sequelize=require(_0x6199('0x0'));var moment=require(_0x6199('0x1'));module['exports']={'time':{'type':Sequelize[_0x6199('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6199('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6199('0x3')],'allowNull':![],'defaultValue':moment()[_0x6199('0x4')](_0x6199('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 385621a..994c61c 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 _0x3133=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3133,0x172));var _0x3313=function(_0x4c3001,_0x2ba8d5){_0x4c3001=_0x4c3001-0x0;var _0x48962b=_0x3133[_0x4c3001];return _0x48962b;};'use strict';var emlformat=require(_0x3313('0x0'));var rimraf=require(_0x3313('0x1'));var zipdir=require(_0x3313('0x2'));var jsonpatch=require(_0x3313('0x3'));var rp=require(_0x3313('0x4'));var moment=require(_0x3313('0x5'));var BPromise=require(_0x3313('0x6'));var Mustache=require(_0x3313('0x7'));var util=require('util');var path=require(_0x3313('0x8'));var sox=require(_0x3313('0x9'));var csv=require(_0x3313('0xa'));var ejs=require(_0x3313('0xb'));var fs=require('fs');var fs_extra=require(_0x3313('0xc'));var _=require(_0x3313('0xd'));var squel=require(_0x3313('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3313('0xf'));var toCsv=require(_0x3313('0xa'));var querystring=require(_0x3313('0x10'));var Papa=require(_0x3313('0x11'));var Redis=require(_0x3313('0x12'));var authService=require(_0x3313('0x13'));var qs=require(_0x3313('0x14'));var as=require(_0x3313('0x15'));var hardwareService=require(_0x3313('0x16'));var logger=require(_0x3313('0x17'))(_0x3313('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3313('0x19'));var db=require(_0x3313('0x1a'))['db'];function respondWithStatusCode(_0x190b15,_0xec5c5f){_0xec5c5f=_0xec5c5f||0xcc;return function(_0x42d97b){if(_0x42d97b){return _0x190b15[_0x3313('0x1b')](_0xec5c5f);}return _0x190b15[_0x3313('0x1c')](_0xec5c5f)[_0x3313('0x1d')]();};}function respondWithResult(_0x384490,_0x4fa89d){_0x4fa89d=_0x4fa89d||0xc8;return function(_0x20f682){if(_0x20f682){return _0x384490[_0x3313('0x1c')](_0x4fa89d)[_0x3313('0x1e')](_0x20f682);}};}function respondWithFilteredResult(_0x2d71ec,_0x47fe30){return function(_0x193aee){if(_0x193aee){var _0x19deb5=typeof _0x47fe30[_0x3313('0x1f')]===_0x3313('0x20')&&typeof _0x47fe30[_0x3313('0x21')]===_0x3313('0x20');var _0x470894=_0x193aee[_0x3313('0x22')];var _0x22eacf=_0x19deb5?0x0:_0x47fe30[_0x3313('0x1f')];var _0x84aca4=_0x19deb5?_0x193aee[_0x3313('0x22')]:_0x47fe30[_0x3313('0x1f')]+_0x47fe30[_0x3313('0x21')];var _0x315443;if(_0x84aca4>=_0x470894){_0x84aca4=_0x470894;_0x315443=0xc8;}else{_0x315443=0xce;}_0x2d71ec[_0x3313('0x1c')](_0x315443);return _0x2d71ec[_0x3313('0x23')](_0x3313('0x24'),_0x22eacf+'-'+_0x84aca4+'/'+_0x470894)[_0x3313('0x1e')](_0x193aee);}return null;};}function patchUpdates(_0x3de431){return function(_0x3960d1){try{jsonpatch[_0x3313('0x25')](_0x3960d1,_0x3de431,!![]);}catch(_0x1e9422){return BPromise['reject'](_0x1e9422);}return _0x3960d1[_0x3313('0x26')]();};}function saveUpdates(_0x359b41,_0x2f4bd1){return function(_0x612ea1){if(_0x612ea1){return _0x612ea1[_0x3313('0x27')](_0x359b41)[_0x3313('0x28')](function(_0x16071c){return _0x16071c;});}return null;};}function removeEntity(_0x549f92,_0x4c0891){return function(_0x386c42){if(_0x386c42){return _0x386c42[_0x3313('0x29')]()[_0x3313('0x28')](function(){_0x549f92[_0x3313('0x1c')](0xcc)[_0x3313('0x1d')]();});}};}function handleEntityNotFound(_0x28ad01,_0xddf166){return function(_0x3a5d74){if(!_0x3a5d74){_0x28ad01[_0x3313('0x1b')](0x194);}return _0x3a5d74;};}function handleError(_0x5a7029,_0x2c5a0f){_0x2c5a0f=_0x2c5a0f||0x1f4;return function(_0x1c49dc){logger[_0x3313('0x2a')](_0x1c49dc[_0x3313('0x2b')]);if(_0x1c49dc[_0x3313('0x2c')]){delete _0x1c49dc['name'];}_0x5a7029[_0x3313('0x1c')](_0x2c5a0f)[_0x3313('0x2d')](_0x1c49dc);};}exports[_0x3313('0x2e')]=function(_0x561941,_0xac9977){var _0x3a1ea2={},_0x3ec6f5={},_0x2a5da7={'count':0x0,'rows':[]};var _0x17dde1=_[_0x3313('0x2f')](db[_0x3313('0x30')][_0x3313('0x31')],function(_0x5a7967){return{'name':_0x5a7967[_0x3313('0x32')],'type':_0x5a7967[_0x3313('0x33')][_0x3313('0x34')]};});_0x3ec6f5[_0x3313('0x35')]=_[_0x3313('0x2f')](_0x17dde1,_0x3313('0x2c'));_0x3ec6f5[_0x3313('0x36')]=_[_0x3313('0x37')](_0x561941['query']);_0x3ec6f5[_0x3313('0x38')]=_[_0x3313('0x39')](_0x3ec6f5['model'],_0x3ec6f5[_0x3313('0x36')]);_0x3a1ea2[_0x3313('0x3a')]=_[_0x3313('0x39')](_0x3ec6f5[_0x3313('0x35')],qs[_0x3313('0x3b')](_0x561941[_0x3313('0x36')][_0x3313('0x3b')]));_0x3a1ea2[_0x3313('0x3a')]=_0x3a1ea2[_0x3313('0x3a')][_0x3313('0x3c')]?_0x3a1ea2[_0x3313('0x3a')]:_0x3ec6f5['model'];if(!_0x561941[_0x3313('0x36')][_0x3313('0x3d')](_0x3313('0x3e'))){_0x3a1ea2['limit']=qs[_0x3313('0x21')](_0x561941[_0x3313('0x36')]['limit']);_0x3a1ea2['offset']=qs[_0x3313('0x1f')](_0x561941['query'][_0x3313('0x1f')]);}_0x3a1ea2[_0x3313('0x3f')]=qs['sort'](_0x561941['query'][_0x3313('0x40')]);_0x3a1ea2['where']=qs[_0x3313('0x38')](_[_0x3313('0x41')](_0x561941['query'],_0x3ec6f5[_0x3313('0x38')]),_0x17dde1);if(_0x561941[_0x3313('0x36')][_0x3313('0x42')]){_0x3a1ea2[_0x3313('0x43')]=_['merge'](_0x3a1ea2[_0x3313('0x43')],{'$or':_[_0x3313('0x2f')](_0x17dde1,function(_0x285e9e){if(_0x285e9e['type']!==_0x3313('0x44')){var _0x321289={};_0x321289[_0x285e9e['name']]={'$like':'%'+_0x561941['query'][_0x3313('0x42')]+'%'};return _0x321289;}})});}_0x3a1ea2=_[_0x3313('0x45')]({},_0x3a1ea2,_0x561941[_0x3313('0x46')]);var _0x263918={'where':_0x3a1ea2[_0x3313('0x43')]};return db[_0x3313('0x30')][_0x3313('0x22')](_0x263918)['then'](function(_0x41ace){_0x2a5da7['count']=_0x41ace;if(_0x561941[_0x3313('0x36')][_0x3313('0x47')]){_0x3a1ea2['include']=[{'all':!![]}];}return db[_0x3313('0x30')][_0x3313('0x48')](_0x3a1ea2);})[_0x3313('0x28')](function(_0x447cf){_0x2a5da7[_0x3313('0x49')]=_0x447cf;return _0x2a5da7;})[_0x3313('0x28')](respondWithFilteredResult(_0xac9977,_0x3a1ea2))[_0x3313('0x4a')](handleError(_0xac9977,null));};exports[_0x3313('0x4b')]=function(_0x4f0c7c,_0x3c06e3){var _0xcc592d={'raw':!![],'where':{'id':_0x4f0c7c[_0x3313('0x4c')]['id']}},_0x52b2ae={};_0x52b2ae[_0x3313('0x35')]=_[_0x3313('0x37')](db['VoiceQueuesLog'][_0x3313('0x31')]);_0x52b2ae[_0x3313('0x36')]=_[_0x3313('0x37')](_0x4f0c7c['query']);_0x52b2ae[_0x3313('0x38')]=_[_0x3313('0x39')](_0x52b2ae[_0x3313('0x35')],_0x52b2ae['query']);_0xcc592d[_0x3313('0x3a')]=_[_0x3313('0x39')](_0x52b2ae['model'],qs[_0x3313('0x3b')](_0x4f0c7c[_0x3313('0x36')][_0x3313('0x3b')]));_0xcc592d[_0x3313('0x3a')]=_0xcc592d['attributes'][_0x3313('0x3c')]?_0xcc592d[_0x3313('0x3a')]:_0x52b2ae[_0x3313('0x35')];if(_0x4f0c7c['query']['includeAll']){_0xcc592d[_0x3313('0x4d')]=[{'all':!![]}];}_0xcc592d=_['merge']({},_0xcc592d,_0x4f0c7c[_0x3313('0x46')]);return db[_0x3313('0x30')][_0x3313('0x4e')](_0xcc592d)[_0x3313('0x28')](handleEntityNotFound(_0x3c06e3,null))[_0x3313('0x28')](respondWithResult(_0x3c06e3,null))[_0x3313('0x4a')](handleError(_0x3c06e3,null));};exports[_0x3313('0x4f')]=function(_0x3f7f3a,_0x4eeeb4){return db['VoiceQueuesLog']['create'](_0x3f7f3a['body'],{})[_0x3313('0x28')](respondWithResult(_0x4eeeb4,0xc9))[_0x3313('0x4a')](handleError(_0x4eeeb4,null));};exports['update']=function(_0x588530,_0x2a6ef7){if(_0x588530[_0x3313('0x50')]['id']){delete _0x588530['body']['id'];}return db[_0x3313('0x30')][_0x3313('0x4e')]({'where':{'id':_0x588530[_0x3313('0x4c')]['id']}})[_0x3313('0x28')](handleEntityNotFound(_0x2a6ef7,null))['then'](saveUpdates(_0x588530[_0x3313('0x50')],null))[_0x3313('0x28')](respondWithResult(_0x2a6ef7,null))[_0x3313('0x4a')](handleError(_0x2a6ef7,null));};exports['destroy']=function(_0x5de322,_0x588849){return db['VoiceQueuesLog'][_0x3313('0x4e')]({'where':{'id':_0x5de322[_0x3313('0x4c')]['id']}})['then'](handleEntityNotFound(_0x588849,null))[_0x3313('0x28')](removeEntity(_0x588849,null))[_0x3313('0x4a')](handleError(_0x588849,null));}; \ No newline at end of file +var _0xd0c2=['catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create'];(function(_0x37761f,_0x3cefee){var _0x2eed39=function(_0x205b75){while(--_0x205b75){_0x37761f['push'](_0x37761f['shift']());}};_0x2eed39(++_0x3cefee);}(_0xd0c2,0x179));var _0x2d0c=function(_0x3c13bc,_0x4c385b){_0x3c13bc=_0x3c13bc-0x0;var _0x1a2c27=_0xd0c2[_0x3c13bc];return _0x1a2c27;};'use strict';var emlformat=require(_0x2d0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d0c('0x1'));var jsonpatch=require(_0x2d0c('0x2'));var rp=require(_0x2d0c('0x3'));var moment=require(_0x2d0c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d0c('0x5'));var util=require(_0x2d0c('0x6'));var path=require(_0x2d0c('0x7'));var sox=require(_0x2d0c('0x8'));var csv=require(_0x2d0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d0c('0xa'));var _=require(_0x2d0c('0xb'));var squel=require(_0x2d0c('0xc'));var crypto=require(_0x2d0c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d0c('0x9'));var querystring=require(_0x2d0c('0xe'));var Papa=require(_0x2d0c('0xf'));var Redis=require(_0x2d0c('0x10'));var authService=require(_0x2d0c('0x11'));var qs=require(_0x2d0c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d0c('0x13'));var logger=require(_0x2d0c('0x14'))('api');var utils=require(_0x2d0c('0x15'));var config=require(_0x2d0c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d0c('0x17'))['db'];function respondWithStatusCode(_0x50f63a,_0x5d7905){_0x5d7905=_0x5d7905||0xcc;return function(_0x5390c2){if(_0x5390c2){return _0x50f63a[_0x2d0c('0x18')](_0x5d7905);}return _0x50f63a['status'](_0x5d7905)['end']();};}function respondWithResult(_0x614f99,_0x2f1b09){_0x2f1b09=_0x2f1b09||0xc8;return function(_0x502774){if(_0x502774){return _0x614f99[_0x2d0c('0x19')](_0x2f1b09)[_0x2d0c('0x1a')](_0x502774);}};}function respondWithFilteredResult(_0xa3e535,_0x15a122){return function(_0xb0318e){if(_0xb0318e){var _0x39d602=typeof _0x15a122[_0x2d0c('0x1b')]===_0x2d0c('0x1c')&&typeof _0x15a122[_0x2d0c('0x1d')]===_0x2d0c('0x1c');var _0x268799=_0xb0318e['count'];var _0x347745=_0x39d602?0x0:_0x15a122[_0x2d0c('0x1b')];var _0x44cbc7=_0x39d602?_0xb0318e['count']:_0x15a122[_0x2d0c('0x1b')]+_0x15a122[_0x2d0c('0x1d')];var _0x2cd6c6;if(_0x44cbc7>=_0x268799){_0x44cbc7=_0x268799;_0x2cd6c6=0xc8;}else{_0x2cd6c6=0xce;}_0xa3e535[_0x2d0c('0x19')](_0x2cd6c6);return _0xa3e535[_0x2d0c('0x1e')]('Content-Range',_0x347745+'-'+_0x44cbc7+'/'+_0x268799)[_0x2d0c('0x1a')](_0xb0318e);}return null;};}function patchUpdates(_0x443c1c){return function(_0x333472){try{jsonpatch['apply'](_0x333472,_0x443c1c,!![]);}catch(_0x3f1016){return BPromise[_0x2d0c('0x1f')](_0x3f1016);}return _0x333472[_0x2d0c('0x20')]();};}function saveUpdates(_0x5e3de5,_0x4e799c){return function(_0x12d34b){if(_0x12d34b){return _0x12d34b[_0x2d0c('0x21')](_0x5e3de5)[_0x2d0c('0x22')](function(_0x57b039){return _0x57b039;});}return null;};}function removeEntity(_0x52050c,_0x29ac12){return function(_0xa71bcf){if(_0xa71bcf){return _0xa71bcf[_0x2d0c('0x23')]()[_0x2d0c('0x22')](function(){_0x52050c['status'](0xcc)[_0x2d0c('0x24')]();});}};}function handleEntityNotFound(_0xb85677,_0x384817){return function(_0x31c6b3){if(!_0x31c6b3){_0xb85677[_0x2d0c('0x18')](0x194);}return _0x31c6b3;};}function handleError(_0x10cd98,_0x2f04be){_0x2f04be=_0x2f04be||0x1f4;return function(_0x461ef3){logger[_0x2d0c('0x25')](_0x461ef3[_0x2d0c('0x26')]);if(_0x461ef3[_0x2d0c('0x27')]){delete _0x461ef3[_0x2d0c('0x27')];}_0x10cd98['status'](_0x2f04be)[_0x2d0c('0x28')](_0x461ef3);};}exports[_0x2d0c('0x29')]=function(_0x1dc574,_0x21de11){var _0x14357d={},_0x1a43fc={},_0x45bf99={'count':0x0,'rows':[]};var _0x52e660=_[_0x2d0c('0x2a')](db[_0x2d0c('0x2b')][_0x2d0c('0x2c')],function(_0x131d6e){return{'name':_0x131d6e[_0x2d0c('0x2d')],'type':_0x131d6e[_0x2d0c('0x2e')][_0x2d0c('0x2f')]};});_0x1a43fc[_0x2d0c('0x30')]=_[_0x2d0c('0x2a')](_0x52e660,'name');_0x1a43fc[_0x2d0c('0x31')]=_[_0x2d0c('0x32')](_0x1dc574[_0x2d0c('0x31')]);_0x1a43fc['filters']=_[_0x2d0c('0x33')](_0x1a43fc[_0x2d0c('0x30')],_0x1a43fc[_0x2d0c('0x31')]);_0x14357d[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x1a43fc[_0x2d0c('0x30')],qs['fields'](_0x1dc574[_0x2d0c('0x31')][_0x2d0c('0x35')]));_0x14357d[_0x2d0c('0x34')]=_0x14357d[_0x2d0c('0x34')][_0x2d0c('0x36')]?_0x14357d[_0x2d0c('0x34')]:_0x1a43fc[_0x2d0c('0x30')];if(!_0x1dc574[_0x2d0c('0x31')][_0x2d0c('0x37')](_0x2d0c('0x38'))){_0x14357d[_0x2d0c('0x1d')]=qs['limit'](_0x1dc574[_0x2d0c('0x31')]['limit']);_0x14357d[_0x2d0c('0x1b')]=qs['offset'](_0x1dc574[_0x2d0c('0x31')]['offset']);}_0x14357d[_0x2d0c('0x39')]=qs[_0x2d0c('0x3a')](_0x1dc574[_0x2d0c('0x31')][_0x2d0c('0x3a')]);_0x14357d[_0x2d0c('0x3b')]=qs[_0x2d0c('0x3c')](_['pick'](_0x1dc574['query'],_0x1a43fc[_0x2d0c('0x3c')]),_0x52e660);if(_0x1dc574[_0x2d0c('0x31')][_0x2d0c('0x3d')]){_0x14357d[_0x2d0c('0x3b')]=_[_0x2d0c('0x3e')](_0x14357d[_0x2d0c('0x3b')],{'$or':_[_0x2d0c('0x2a')](_0x52e660,function(_0x3ad532){if(_0x3ad532[_0x2d0c('0x2e')]!==_0x2d0c('0x3f')){var _0x44a603={};_0x44a603[_0x3ad532[_0x2d0c('0x27')]]={'$like':'%'+_0x1dc574['query'][_0x2d0c('0x3d')]+'%'};return _0x44a603;}})});}_0x14357d=_[_0x2d0c('0x3e')]({},_0x14357d,_0x1dc574[_0x2d0c('0x40')]);var _0x4d59fd={'where':_0x14357d[_0x2d0c('0x3b')]};return db[_0x2d0c('0x2b')]['count'](_0x4d59fd)[_0x2d0c('0x22')](function(_0x161cab){_0x45bf99[_0x2d0c('0x41')]=_0x161cab;if(_0x1dc574['query'][_0x2d0c('0x42')]){_0x14357d[_0x2d0c('0x43')]=[{'all':!![]}];}return db[_0x2d0c('0x2b')]['findAll'](_0x14357d);})['then'](function(_0x5f15f2){_0x45bf99[_0x2d0c('0x44')]=_0x5f15f2;return _0x45bf99;})[_0x2d0c('0x22')](respondWithFilteredResult(_0x21de11,_0x14357d))['catch'](handleError(_0x21de11,null));};exports[_0x2d0c('0x45')]=function(_0x5f06f1,_0x49b24f){var _0x3b27ea={'raw':!![],'where':{'id':_0x5f06f1[_0x2d0c('0x46')]['id']}},_0x38359e={};_0x38359e['model']=_[_0x2d0c('0x32')](db[_0x2d0c('0x2b')][_0x2d0c('0x2c')]);_0x38359e['query']=_['keys'](_0x5f06f1['query']);_0x38359e[_0x2d0c('0x3c')]=_['intersection'](_0x38359e[_0x2d0c('0x30')],_0x38359e[_0x2d0c('0x31')]);_0x3b27ea[_0x2d0c('0x34')]=_[_0x2d0c('0x33')](_0x38359e['model'],qs[_0x2d0c('0x35')](_0x5f06f1['query'][_0x2d0c('0x35')]));_0x3b27ea[_0x2d0c('0x34')]=_0x3b27ea[_0x2d0c('0x34')]['length']?_0x3b27ea['attributes']:_0x38359e['model'];if(_0x5f06f1[_0x2d0c('0x31')][_0x2d0c('0x42')]){_0x3b27ea[_0x2d0c('0x43')]=[{'all':!![]}];}_0x3b27ea=_[_0x2d0c('0x3e')]({},_0x3b27ea,_0x5f06f1[_0x2d0c('0x40')]);return db['VoiceQueuesLog'][_0x2d0c('0x47')](_0x3b27ea)[_0x2d0c('0x22')](handleEntityNotFound(_0x49b24f,null))[_0x2d0c('0x22')](respondWithResult(_0x49b24f,null))['catch'](handleError(_0x49b24f,null));};exports['create']=function(_0x2fdb63,_0x5de7ed){return db[_0x2d0c('0x2b')][_0x2d0c('0x48')](_0x2fdb63['body'],{})[_0x2d0c('0x22')](respondWithResult(_0x5de7ed,0xc9))[_0x2d0c('0x49')](handleError(_0x5de7ed,null));};exports[_0x2d0c('0x21')]=function(_0x1b2d78,_0xf8d317){if(_0x1b2d78[_0x2d0c('0x4a')]['id']){delete _0x1b2d78[_0x2d0c('0x4a')]['id'];}return db[_0x2d0c('0x2b')]['find']({'where':{'id':_0x1b2d78[_0x2d0c('0x46')]['id']}})['then'](handleEntityNotFound(_0xf8d317,null))['then'](saveUpdates(_0x1b2d78[_0x2d0c('0x4a')],null))[_0x2d0c('0x22')](respondWithResult(_0xf8d317,null))[_0x2d0c('0x49')](handleError(_0xf8d317,null));};exports[_0x2d0c('0x23')]=function(_0x2d7117,_0x475050){return db[_0x2d0c('0x2b')][_0x2d0c('0x47')]({'where':{'id':_0x2d7117['params']['id']}})[_0x2d0c('0x22')](handleEntityNotFound(_0x475050,null))[_0x2d0c('0x22')](removeEntity(_0x475050,null))['catch'](handleError(_0x475050,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0b81589..2198cb6 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 _0x22fd=['exports','define','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x22fd,0x166));var _0xd22f=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x22fd[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xd22f('0x0'));var util=require('util');var logger=require(_0xd22f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd22f('0x2'));var rp=require(_0xd22f('0x3'));var fs=require('fs');var path=require(_0xd22f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xd22f('0x5')]=function(_0x5a1cca,_0x521859){return _0x5a1cca[_0xd22f('0x6')]('VoiceQueuesLog',attributes,{'tableName':_0xd22f('0x7'),'paranoid':![],'indexes':[{'name':_0xd22f('0x8'),'fields':[_0xd22f('0x9'),_0xd22f('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdfcb=['../../config/logger','bluebird','request-promise','rimraf','define','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x4df28e,_0x219815){var _0x1268c1=function(_0xbcc2a2){while(--_0xbcc2a2){_0x4df28e['push'](_0x4df28e['shift']());}};_0x1268c1(++_0x219815);}(_0xdfcb,0x10d));var _0xbdfc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xdfcb[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xbdfc('0x0'));var util=require('util');var logger=require(_0xbdfc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbdfc('0x2'));var rp=require(_0xbdfc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdfc('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x95d7fa,_0x1f6ff3){return _0x95d7fa[_0xbdfc('0x5')]('VoiceQueuesLog',attributes,{'tableName':_0xbdfc('0x6'),'paranoid':![],'indexes':[{'name':_0xbdfc('0x7'),'fields':[_0xbdfc('0x8'),_0xbdfc('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3e0971f..002e605 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 _0x6cc0=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3f71f5,_0x113f43){var _0x4f7b62=function(_0x6bff45){while(--_0x6bff45){_0x3f71f5['push'](_0x3f71f5['shift']());}};_0x4f7b62(++_0x113f43);}(_0x6cc0,0x1d5));var _0x06cc=function(_0x478219,_0x28aa3d){_0x478219=_0x478219-0x0;var _0x4ff324=_0x6cc0[_0x478219];return _0x4ff324;};'use strict';var _=require(_0x06cc('0x0'));var util=require(_0x06cc('0x1'));var moment=require(_0x06cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06cc('0x3'));var fs=require('fs');var Redis=require(_0x06cc('0x4'));var db=require(_0x06cc('0x5'))['db'];var utils=require(_0x06cc('0x6'));var logger=require('../../config/logger')(_0x06cc('0x7'));var config=require(_0x06cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06cc('0x9')][_0x06cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1910b2,_0x390282,_0x52a107){return new BPromise(function(_0x28ebca,_0x13f2fd){return client[_0x06cc('0xb')](_0x1910b2,_0x52a107)[_0x06cc('0xc')](function(_0x40c238){logger[_0x06cc('0xd')](_0x06cc('0xe'),_0x390282,_0x06cc('0xf'));logger['debug'](_0x06cc('0x10'),_0x390282,_0x06cc('0xf'),JSON[_0x06cc('0x11')](_0x40c238));if(_0x40c238['error']){if(_0x40c238[_0x06cc('0x12')][_0x06cc('0x13')]===0x1f4){logger[_0x06cc('0x12')](_0x06cc('0xe'),_0x390282,_0x40c238['error'][_0x06cc('0x14')]);return _0x13f2fd(_0x40c238[_0x06cc('0x12')][_0x06cc('0x14')]);}logger[_0x06cc('0x12')](_0x06cc('0xe'),_0x390282,_0x40c238[_0x06cc('0x12')][_0x06cc('0x14')]);return _0x28ebca(_0x40c238[_0x06cc('0x12')][_0x06cc('0x14')]);}else{logger['info'](_0x06cc('0xe'),_0x390282,_0x06cc('0xf'));_0x28ebca(_0x40c238[_0x06cc('0x15')]['message']);}})[_0x06cc('0x16')](function(_0x134a63){logger[_0x06cc('0x12')](_0x06cc('0xe'),_0x390282,_0x134a63);_0x13f2fd(_0x134a63);});});} \ No newline at end of file +var _0x8717=['code','error','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8717,0xa6));var _0x7871=function(_0x590cd0,_0x11bfd4){_0x590cd0=_0x590cd0-0x0;var _0x208eb0=_0x8717[_0x590cd0];return _0x208eb0;};'use strict';var _=require(_0x7871('0x0'));var util=require(_0x7871('0x1'));var moment=require(_0x7871('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7871('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7871('0x4'))(_0x7871('0x5'));var config=require(_0x7871('0x6'));var jayson=require(_0x7871('0x7'));var client=jayson['client'][_0x7871('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x541709,_0x82626f,_0x515ea6){return new BPromise(function(_0x466f24,_0x53c7a0){return client[_0x7871('0x9')](_0x541709,_0x515ea6)[_0x7871('0xa')](function(_0x393e79){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x82626f,_0x7871('0xb'));logger[_0x7871('0xc')](_0x7871('0xd'),_0x82626f,_0x7871('0xb'),JSON['stringify'](_0x393e79));if(_0x393e79['error']){if(_0x393e79['error'][_0x7871('0xe')]===0x1f4){logger[_0x7871('0xf')](_0x7871('0x10'),_0x82626f,_0x393e79['error']['message']);return _0x53c7a0(_0x393e79[_0x7871('0xf')][_0x7871('0x11')]);}logger['error'](_0x7871('0x10'),_0x82626f,_0x393e79[_0x7871('0xf')][_0x7871('0x11')]);return _0x466f24(_0x393e79[_0x7871('0xf')][_0x7871('0x11')]);}else{logger[_0x7871('0x12')](_0x7871('0x10'),_0x82626f,_0x7871('0xb'));_0x466f24(_0x393e79[_0x7871('0x13')][_0x7871('0x11')]);}})['catch'](function(_0x2ebc53){logger[_0x7871('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x82626f,_0x2ebc53);_0x53c7a0(_0x2ebc53);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4395571..cc82d2f 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 _0x0e3a=['/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','download','/:id/downloads','downloads','downloadTranscribe','post','create'];(function(_0x3eb4dd,_0x1800eb){var _0x32067f=function(_0xae85b2){while(--_0xae85b2){_0x3eb4dd['push'](_0x3eb4dd['shift']());}};_0x32067f(++_0x1800eb);}(_0x0e3a,0xa4));var _0xa0e3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0e3a[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xa0e3('0x0'));var path=require(_0xa0e3('0x1'));var timeout=require(_0xa0e3('0x2'));var express=require(_0xa0e3('0x3'));var router=express[_0xa0e3('0x4')]();var fs_extra=require(_0xa0e3('0x5'));var auth=require(_0xa0e3('0x6'));var interaction=require(_0xa0e3('0x7'));var config=require(_0xa0e3('0x8'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xa0e3('0x9')](),controller['index']);router[_0xa0e3('0xa')](_0xa0e3('0xb'),auth['isAuthenticated'](),controller[_0xa0e3('0xc')]);router['get']('/:id',auth[_0xa0e3('0x9')](),controller[_0xa0e3('0xd')]);router[_0xa0e3('0xa')]('/:id/download',auth[_0xa0e3('0x9')](),controller[_0xa0e3('0xe')]);router[_0xa0e3('0xa')](_0xa0e3('0xf'),controller[_0xa0e3('0x10')]);router[_0xa0e3('0xa')]('/:id/transcribe',auth[_0xa0e3('0x9')](),controller[_0xa0e3('0x11')]);router[_0xa0e3('0x12')]('/',auth[_0xa0e3('0x9')](),controller[_0xa0e3('0x13')]);router['post']('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router['put'](_0xa0e3('0x14'),auth[_0xa0e3('0x9')](),controller['update']);router['delete'](_0xa0e3('0x14'),auth[_0xa0e3('0x9')](),controller[_0xa0e3('0x15')]);module[_0xa0e3('0x16')]=router; \ No newline at end of file +var _0x1108=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','post','create','runTranscribe','put','delete','destroy','exports','multer'];(function(_0x188220,_0x42aef6){var _0x9f6211=function(_0x307752){while(--_0x307752){_0x188220['push'](_0x188220['shift']());}};_0x9f6211(++_0x42aef6);}(_0x1108,0x167));var _0x8110=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x1108[_0x101802];return _0x5d61ce;};'use strict';var multer=require(_0x8110('0x0'));var util=require('util');var path=require(_0x8110('0x1'));var timeout=require(_0x8110('0x2'));var express=require(_0x8110('0x3'));var router=express[_0x8110('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8110('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8110('0x6'));var controller=require(_0x8110('0x7'));router[_0x8110('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8110('0x8')](_0x8110('0x9'),auth[_0x8110('0xa')](),controller['describe']);router[_0x8110('0x8')](_0x8110('0xb'),auth[_0x8110('0xa')](),controller[_0x8110('0xc')]);router[_0x8110('0x8')](_0x8110('0xd'),auth['isAuthenticated'](),controller[_0x8110('0xe')]);router['get'](_0x8110('0xf'),controller['downloads']);router['get'](_0x8110('0x10'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x8110('0x11')]('/',auth['isAuthenticated'](),controller[_0x8110('0x12')]);router[_0x8110('0x11')](_0x8110('0x10'),auth[_0x8110('0xa')](),controller[_0x8110('0x13')]);router[_0x8110('0x14')](_0x8110('0xb'),auth[_0x8110('0xa')](),controller['update']);router[_0x8110('0x15')](_0x8110('0xb'),auth['isAuthenticated'](),controller[_0x8110('0x16')]);module[_0x8110('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 54778f9..9503815 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 803a8d0..27de479 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 _0x71fb=['filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','type','merge','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','describe','download','../../components/encryptor','value','%s.cypher','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','col','uniqueid','token','$and','push','decryptFile','secrets','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys'];(function(_0x396565,_0x3e5b6c){var _0x109b7c=function(_0x36f4de){while(--_0x36f4de){_0x396565['push'](_0x396565['shift']());}};_0x109b7c(++_0x3e5b6c);}(_0x71fb,0xfc));var _0xb71f=function(_0x4830fa,_0x6bc819){_0x4830fa=_0x4830fa-0x0;var _0x2f8d5b=_0x71fb[_0x4830fa];return _0x2f8d5b;};'use strict';var emlformat=require(_0xb71f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb71f('0x1'));var jsonpatch=require(_0xb71f('0x2'));var rp=require(_0xb71f('0x3'));var moment=require(_0xb71f('0x4'));var BPromise=require(_0xb71f('0x5'));var Mustache=require('mustache');var util=require(_0xb71f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb71f('0x7'));var fs=require('fs');var fs_extra=require(_0xb71f('0x8'));var _=require(_0xb71f('0x9'));var squel=require(_0xb71f('0xa'));var crypto=require(_0xb71f('0xb'));var jsforce=require(_0xb71f('0xc'));var deskjs=require(_0xb71f('0xd'));var toCsv=require(_0xb71f('0xe'));var querystring=require('querystring');var Papa=require(_0xb71f('0xf'));var AWS=require(_0xb71f('0x10'));var uuidv4=require(_0xb71f('0x11'));var Redis=require('ioredis');var authService=require(_0xb71f('0x12'));var qs=require(_0xb71f('0x13'));var as=require(_0xb71f('0x14'));var hardwareService=require(_0xb71f('0x15'));var logger=require(_0xb71f('0x16'))(_0xb71f('0x17'));var utils=require('../../config/utils');var config=require(_0xb71f('0x18'));var licenseUtil=require(_0xb71f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548043,_0x3ab796){_0x3ab796=_0x3ab796||0xcc;return function(_0x410f1a){if(_0x410f1a){return _0x548043[_0xb71f('0x1a')](_0x3ab796);}return _0x548043['status'](_0x3ab796)[_0xb71f('0x1b')]();};}function respondWithResult(_0x1cae2a,_0x5c8346){_0x5c8346=_0x5c8346||0xc8;return function(_0x58901f){if(_0x58901f){return _0x1cae2a['status'](_0x5c8346)[_0xb71f('0x1c')](_0x58901f);}};}function respondWithFilteredResult(_0x5386c2,_0x3f51c8){return function(_0x5a35ef){if(_0x5a35ef){var _0x581b84=typeof _0x3f51c8[_0xb71f('0x1d')]===_0xb71f('0x1e')&&typeof _0x3f51c8[_0xb71f('0x1f')]===_0xb71f('0x1e');var _0x20dea1=_0x5a35ef[_0xb71f('0x20')];var _0xc125b6=_0x581b84?0x0:_0x3f51c8[_0xb71f('0x1d')];var _0x3d1246=_0x581b84?_0x5a35ef[_0xb71f('0x20')]:_0x3f51c8[_0xb71f('0x1d')]+_0x3f51c8[_0xb71f('0x1f')];var _0x798b2b;if(_0x3d1246>=_0x20dea1){_0x3d1246=_0x20dea1;_0x798b2b=0xc8;}else{_0x798b2b=0xce;}_0x5386c2[_0xb71f('0x21')](_0x798b2b);return _0x5386c2[_0xb71f('0x22')](_0xb71f('0x23'),_0xc125b6+'-'+_0x3d1246+'/'+_0x20dea1)['json'](_0x5a35ef);}return null;};}function patchUpdates(_0x3eb3b3){return function(_0x9173a7){try{jsonpatch[_0xb71f('0x24')](_0x9173a7,_0x3eb3b3,!![]);}catch(_0x24c9c5){return BPromise['reject'](_0x24c9c5);}return _0x9173a7['save']();};}function saveUpdates(_0x3345ea,_0x317c12){return function(_0x1a407a){if(_0x1a407a){return _0x1a407a[_0xb71f('0x25')](_0x3345ea)['then'](function(_0x13bd21){return _0x13bd21;});}return null;};}function removeEntity(_0x48d39c,_0x41c942){return function(_0x273ed4){if(_0x273ed4){return _0x273ed4['destroy']()[_0xb71f('0x26')](function(){_0x48d39c[_0xb71f('0x21')](0xcc)[_0xb71f('0x1b')]();});}};}function handleEntityNotFound(_0xa9f469,_0x579d59){return function(_0x45c617){if(!_0x45c617){_0xa9f469[_0xb71f('0x1a')](0x194);}return _0x45c617;};}function handleError(_0x5aa43d,_0xd829d7){_0xd829d7=_0xd829d7||0x1f4;return function(_0x372b4c){logger[_0xb71f('0x27')](_0x372b4c[_0xb71f('0x28')]);if(_0x372b4c[_0xb71f('0x29')]){delete _0x372b4c[_0xb71f('0x29')];}_0x5aa43d[_0xb71f('0x21')](_0xd829d7)[_0xb71f('0x2a')](_0x372b4c);};}exports[_0xb71f('0x2b')]=function(_0x219ac9,_0x4bca2d){var _0x352510={},_0x30f876={},_0x1c1629={'count':0x0,'rows':[]};var _0x3898b8=_[_0xb71f('0x2c')](db[_0xb71f('0x2d')][_0xb71f('0x2e')],function(_0x409eaf){return{'name':_0x409eaf[_0xb71f('0x2f')],'type':_0x409eaf['type'][_0xb71f('0x30')]};});_0x30f876[_0xb71f('0x31')]=_[_0xb71f('0x32')](_[_0xb71f('0x2c')](_0x3898b8,_0xb71f('0x29')),[_0xb71f('0x33')]);_0x30f876[_0xb71f('0x34')]=_[_0xb71f('0x35')](_0x219ac9[_0xb71f('0x34')]);_0x30f876[_0xb71f('0x36')]=_['intersection'](_0x30f876[_0xb71f('0x31')],_0x30f876[_0xb71f('0x34')]);_0x352510[_0xb71f('0x37')]=_[_0xb71f('0x38')](_0x30f876[_0xb71f('0x31')],qs[_0xb71f('0x39')](_0x219ac9[_0xb71f('0x34')]['fields']));_0x352510[_0xb71f('0x37')]=_0x352510[_0xb71f('0x37')][_0xb71f('0x3a')]?_0x352510[_0xb71f('0x37')]:_0x30f876[_0xb71f('0x31')];if(!_0x219ac9['query']['hasOwnProperty'](_0xb71f('0x3b'))){_0x352510[_0xb71f('0x1f')]=qs[_0xb71f('0x1f')](_0x219ac9['query'][_0xb71f('0x1f')]);_0x352510[_0xb71f('0x1d')]=qs[_0xb71f('0x1d')](_0x219ac9[_0xb71f('0x34')]['offset']);}_0x352510[_0xb71f('0x3c')]=qs[_0xb71f('0x3d')](_0x219ac9[_0xb71f('0x34')][_0xb71f('0x3d')]);_0x352510[_0xb71f('0x3e')]=qs['filters'](_['pick'](_0x219ac9[_0xb71f('0x34')],_0x30f876[_0xb71f('0x36')]),_0x3898b8);if(_0x219ac9[_0xb71f('0x34')][_0xb71f('0x3f')]){_0x352510[_0xb71f('0x3e')]=_['merge'](_0x352510['where'],{'$or':_['map'](_0x3898b8,function(_0x129900){if(_0x129900[_0xb71f('0x40')]!=='VIRTUAL'){var _0x3e0ab5={};_0x3e0ab5[_0x129900['name']]={'$like':'%'+_0x219ac9['query'][_0xb71f('0x3f')]+'%'};return _0x3e0ab5;}})});}_0x352510=_[_0xb71f('0x41')]({},_0x352510,_0x219ac9['options']);var _0x323e0d={'where':_0x352510[_0xb71f('0x3e')]};return db[_0xb71f('0x2d')]['count'](_0x323e0d)[_0xb71f('0x26')](function(_0x4bc8f9){_0x1c1629[_0xb71f('0x20')]=_0x4bc8f9;if(_0x219ac9['query']['includeAll']){_0x352510['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xb71f('0x42')](_0x352510);})[_0xb71f('0x26')](function(_0x15402f){_0x1c1629[_0xb71f('0x43')]=_0x15402f;return _0x1c1629;})[_0xb71f('0x26')](respondWithFilteredResult(_0x4bca2d,_0x352510))[_0xb71f('0x44')](handleError(_0x4bca2d,null));};exports[_0xb71f('0x45')]=function(_0x1705ad,_0x18ab27){var _0x1d60f5={'raw':![],'where':{'id':_0x1705ad[_0xb71f('0x46')]['id']}},_0x47a06a={};_0x47a06a[_0xb71f('0x31')]=_[_0xb71f('0x35')](db[_0xb71f('0x2d')][_0xb71f('0x2e')]);_0x47a06a[_0xb71f('0x34')]=_[_0xb71f('0x35')](_0x1705ad[_0xb71f('0x34')]);_0x47a06a[_0xb71f('0x36')]=_[_0xb71f('0x38')](_0x47a06a[_0xb71f('0x31')],_0x47a06a[_0xb71f('0x34')]);_0x1d60f5[_0xb71f('0x37')]=_['intersection'](_0x47a06a[_0xb71f('0x31')],qs[_0xb71f('0x39')](_0x1705ad[_0xb71f('0x34')][_0xb71f('0x39')]));_0x1d60f5[_0xb71f('0x37')]=_0x1d60f5[_0xb71f('0x37')][_0xb71f('0x3a')]?_0x1d60f5['attributes']:_0x47a06a['model'];if(_0x1705ad[_0xb71f('0x34')][_0xb71f('0x47')]){_0x1d60f5[_0xb71f('0x48')]=[{'all':!![]}];}_0x1d60f5=_['merge']({},_0x1d60f5,_0x1705ad[_0xb71f('0x49')]);return db[_0xb71f('0x2d')][_0xb71f('0x4a')](_0x1d60f5)[_0xb71f('0x26')](handleEntityNotFound(_0x18ab27,null))[_0xb71f('0x26')](respondWithResult(_0x18ab27,null))[_0xb71f('0x44')](handleError(_0x18ab27,null));};exports[_0xb71f('0x4b')]=function(_0x2a6546,_0x347803){return db['VoiceRecording'][_0xb71f('0x4b')](_0x2a6546[_0xb71f('0x4c')],{})[_0xb71f('0x26')](respondWithResult(_0x347803,0xc9))['catch'](handleError(_0x347803,null));};exports[_0xb71f('0x25')]=function(_0x376baf,_0x2bc50b){if(_0x376baf[_0xb71f('0x4c')]['id']){delete _0x376baf[_0xb71f('0x4c')]['id'];}return db[_0xb71f('0x2d')][_0xb71f('0x4a')]({'where':{'id':_0x376baf['params']['id']}})[_0xb71f('0x26')](handleEntityNotFound(_0x2bc50b,null))[_0xb71f('0x26')](saveUpdates(_0x376baf[_0xb71f('0x4c')],null))[_0xb71f('0x26')](respondWithResult(_0x2bc50b,null))[_0xb71f('0x44')](handleError(_0x2bc50b,null));};exports['describe']=function(_0x54c812,_0x4b0a77){return db[_0xb71f('0x2d')][_0xb71f('0x4d')]()[_0xb71f('0x26')](respondWithResult(_0x4b0a77,null))[_0xb71f('0x44')](handleError(_0x4b0a77,null));};exports[_0xb71f('0x4e')]=function(_0x31297b,_0xcae76f,_0x4dcc24){var _0x4f8162=require(_0xb71f('0x4f'));var _0x39293c=![];var _0x57beba={};if(_0x31297b[_0xb71f('0x34')][_0xb71f('0x40')]&&_0x31297b[_0xb71f('0x34')]['type']==='uniqueid'){_0x57beba['uniqueid']=_0x31297b[_0xb71f('0x46')]['id'];}else{_0x57beba['id']=_0x31297b[_0xb71f('0x46')]['id'];}return db[_0xb71f('0x2d')][_0xb71f('0x4a')]({'where':_0x57beba,'attributes':['id',_0xb71f('0x50')],'raw':!![]})[_0xb71f('0x26')](handleEntityNotFound(_0xcae76f,null))[_0xb71f('0x26')](function(_0x152169){if(_0x152169){var _0x30eb73=_0x152169['value'];var _0x344f61=util[_0xb71f('0x33')](_0xb71f('0x51'),_0x30eb73);if(fs[_0xb71f('0x52')](_0x344f61)){_0x39293c=!![];return _0x4f8162['decryptFile'](_0x344f61,_0x30eb73,config['secrets'][_0xb71f('0x53')])[_0xb71f('0x26')](function(){return _0x152169;});}return _0x152169;}})['then'](function(_0x29be15){if(_0x29be15){var _0x56a6ca=_0x29be15['value'];if(!fs[_0xb71f('0x52')](_0x56a6ca)){throw new db[(_0xb71f('0x54'))][(_0xb71f('0x55'))](_0xb71f('0x56'));}if(_0x29be15['filename']){return _0xcae76f[_0xb71f('0x4e')](_0x56a6ca,_0x29be15[_0xb71f('0x57')]+path[_0xb71f('0x58')](_0x56a6ca),function(){if(_0x39293c){fs['unlink'](_0x56a6ca);}});}else{return _0xcae76f[_0xb71f('0x4e')](_0x56a6ca,function(_0x4165ae){if(_0x39293c){fs[_0xb71f('0x59')](_0x56a6ca);}});}}})[_0xb71f('0x44')](function(_0x1cce24){if(_0x1cce24['message']==='VoiceRecording\x20not\x20found'){_0xcae76f[_0xb71f('0x21')](0x194)[_0xb71f('0x2a')]('Not\x20found');}else{return handleError(_0xcae76f,null);}});};exports[_0xb71f('0x5a')]=function(_0x1f56ca,_0x39f93a,_0x1d0032){var _0x58f0b5=require('../../components/encryptor');var _0x241b93=![];var _0x58c61e={'$and':[db['sequelize'][_0xb71f('0x3e')](db[_0xb71f('0x5b')]['fn']('MD5',db[_0xb71f('0x5b')][_0xb71f('0x5c')](_0xb71f('0x5d'))),_0x1f56ca[_0xb71f('0x34')][_0xb71f('0x5e')])]};if(_0x1f56ca[_0xb71f('0x34')][_0xb71f('0x40')]&&_0x1f56ca[_0xb71f('0x34')][_0xb71f('0x40')]===_0xb71f('0x5d')){_0x58c61e[_0xb71f('0x5f')][_0xb71f('0x60')]({'uniqueid':_0x1f56ca[_0xb71f('0x46')]['id']});}else{_0x58c61e[_0xb71f('0x5f')][_0xb71f('0x60')]({'id':_0x1f56ca[_0xb71f('0x46')]['id']});}return db['VoiceRecording'][_0xb71f('0x4a')]({'where':_0x58c61e,'attributes':['id','value'],'raw':!![]})[_0xb71f('0x26')](handleEntityNotFound(_0x39f93a,null))[_0xb71f('0x26')](function(_0x5d7c00){if(_0x5d7c00){var _0x40df28=util[_0xb71f('0x33')](_0xb71f('0x51'),_0x5d7c00[_0xb71f('0x50')]);if(fs['existsSync'](_0x40df28)){_0x241b93=!![];return _0x58f0b5[_0xb71f('0x61')](_0x40df28,_0x5d7c00[_0xb71f('0x50')],config[_0xb71f('0x62')][_0xb71f('0x53')])[_0xb71f('0x26')](function(){return _0x5d7c00;});}return _0x5d7c00;}})[_0xb71f('0x26')](function(_0x1c1d34){if(_0x1c1d34){if(!fs[_0xb71f('0x52')](_0x1c1d34[_0xb71f('0x50')])){throw new db['Sequelize'][(_0xb71f('0x55'))](_0xb71f('0x56'));}if(_0x1c1d34[_0xb71f('0x57')]){return _0x39f93a['download'](_0x1c1d34[_0xb71f('0x50')],_0x1c1d34[_0xb71f('0x57')]+path[_0xb71f('0x58')](_0x1c1d34['value']),function(){if(_0x241b93){fs['unlink'](_0x1c1d34[_0xb71f('0x50')]);}});}else{return _0x39f93a[_0xb71f('0x4e')](_0x1c1d34[_0xb71f('0x50')],function(_0x41e31f){if(_0x241b93){fs[_0xb71f('0x59')](_0x1c1d34[_0xb71f('0x50')]);}});}}})[_0xb71f('0x44')](handleError(_0x39f93a,null));};exports[_0xb71f('0x63')]=function(_0x3346f9,_0x4c7a45){return db[_0xb71f('0x2d')][_0xb71f('0x4a')]({'where':{'id':_0x3346f9[_0xb71f('0x46')]['id']}})['then'](function(_0x52d5a9){if(_[_0xb71f('0x64')](_0x52d5a9)){throw new ReferenceError(_0xb71f('0x65'));}return _0x52d5a9;})['then'](function(_0x2ae727){var _0x3e2779=_0x2ae727['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3e2779);if(!_[_0xb71f('0x64')](_0x2ae727['value'])&&fs[_0xb71f('0x52')](_0x3e2779)){logger[_0xb71f('0x66')](_0xb71f('0x67')+_0x3e2779+_0xb71f('0x68'));fs[_0xb71f('0x69')](_0x3e2779);}_0x3e2779=_0x3e2779+'.cypher';if(!_[_0xb71f('0x64')](_0x2ae727[_0xb71f('0x50')])&&fs[_0xb71f('0x52')](_0x3e2779)){logger[_0xb71f('0x66')](_0xb71f('0x67')+_0x3e2779+_0xb71f('0x68'));fs[_0xb71f('0x69')](_0x3e2779);}return _0x2ae727;})[_0xb71f('0x26')](function(_0x52e9df){if(!_0x52e9df)throw new InternalError();return _0x52e9df[_0xb71f('0x63')]();})[_0xb71f('0x26')](function(){_0x4c7a45[_0xb71f('0x21')](0xcc)[_0xb71f('0x1b')]();})[_0xb71f('0x44')](handleError(_0x4c7a45,null));};function getBucketslist(_0x1d7561,_0x167c03,_0x5f26b2){return new Promise(function(_0x281e48,_0x1ccd59){var _0x29cfac=new AWS['S3']({'accessKeyId':_0x167c03,'secretAccessKey':_0x1d7561,'region':_0x5f26b2});_0x29cfac[_0xb71f('0x6a')]({},function(_0xc4645b,_0x25281e){if(_0xc4645b){return _0x1ccd59(_0xc4645b);}else{return _0x281e48(_0x25281e);}});});}function createBucket(_0x3fa046,_0x28c729,_0x3e9baf,_0x1590aa){return new Promise(function(_0x56bb6e,_0xd96746){var _0x12ea3d=new AWS['S3']({'accessKeyId':_0x28c729,'secretAccessKey':_0x3fa046,'region':_0x3e9baf});_0x12ea3d[_0xb71f('0x6b')]({'Bucket':_0x1590aa},function(_0x271f5b,_0xf56603){if(_0x271f5b){return _0xd96746(_0x271f5b);}else{return _0x56bb6e(_0xf56603);}});});}function uploadFile(_0x5c872d,_0x3c3dc7,_0x340432,_0x35221e,_0x44f350,_0x5867ee){return new Promise(function(_0xf2768d,_0x240101){var _0x5d5f4a=new AWS['S3']({'accessKeyId':_0x3c3dc7,'secretAccessKey':_0x5c872d,'region':_0x340432});_0x5d5f4a[_0xb71f('0x6c')]({'Bucket':_0x35221e,'Key':_0x44f350,'Body':_0x5867ee},function(_0x55b558,_0x5f3f12){if(_0x55b558){return _0x240101(_0x55b558);}else{return _0xf2768d(_0x5f3f12);}});});}function startTranscribe(_0xf6955f,_0x3d5f66,_0x3d5069,_0x15ecb6,_0x13fe38,_0xaa3e49){return new Promise(function(_0x1235f7,_0x23ddb6){var _0x3354a8=new AWS[(_0xb71f('0x6d'))]({'accessKeyId':_0x3d5f66,'secretAccessKey':_0xf6955f,'region':_0x3d5069});_0x3354a8['startTranscriptionJob']({'TranscriptionJobName':_0x15ecb6,'LanguageCode':_0x13fe38,'Media':{'MediaFileUri':_0xaa3e49}},function(_0x126f86,_0x1bc318){if(_0x126f86){return _0x23ddb6(_0x126f86);}else{return _0x1235f7(_0x1bc318);}});});}function transcribe(_0x237106,_0x487faa,_0x10e6a3,_0x5513f1,_0x3c3f5a,_0x684fe5,_0x413217){return new Promise(function(_0x1abfd4,_0x389973){var _0x34f2ac={};logger[_0xb71f('0x66')](util[_0xb71f('0x33')](_0xb71f('0x6e'),_0x237106,_0x3c3f5a));return uploadFile(_0x487faa,_0x10e6a3,_0x5513f1,_0x3c3f5a,path[_0xb71f('0x6f')](_0x684fe5),fs[_0xb71f('0x70')](_0x684fe5))[_0xb71f('0x26')](function(_0x3ec244){logger[_0xb71f('0x66')](util[_0xb71f('0x33')](_0xb71f('0x71'),_0x237106,_0x3c3f5a,_0x3ec244[_0xb71f('0x72')]));_0x34f2ac[_0xb71f('0x73')]=_0x3ec244['Bucket'];_0x34f2ac[_0xb71f('0x74')]=_0x3ec244[_0xb71f('0x72')];logger['info'](util[_0xb71f('0x33')](_0xb71f('0x75'),_0x237106));return startTranscribe(_0x487faa,_0x10e6a3,_0x5513f1,uuidv4(),_0x413217,_0x3ec244[_0xb71f('0x72')]);})[_0xb71f('0x26')](function(_0x51611d){logger[_0xb71f('0x66')](util[_0xb71f('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x237106,_0x51611d[_0xb71f('0x76')][_0xb71f('0x77')]));_0x34f2ac[_0xb71f('0x78')]=_0x51611d[_0xb71f('0x76')][_0xb71f('0x77')];_0x34f2ac[_0xb71f('0x79')]=_0x51611d[_0xb71f('0x76')][_0xb71f('0x7a')];return _0x1abfd4(_0x34f2ac);})[_0xb71f('0x44')](function(_0x12f846){return _0x389973(_0x12f846);});});}exports[_0xb71f('0x7b')]=function(_0x78589e,_0x413f52,_0x5d80a6){var _0x4bd7b7;var _0x4ea446;var _0x597a55;var _0x42ff83=require('../../components/encryptor');return db[_0xb71f('0x2d')]['findOne']({'where':{'id':_0x78589e[_0xb71f('0x46')]['id']}})[_0xb71f('0x26')](function(_0x4034f9){if(_0x4034f9){var _0x4efc45=util[_0xb71f('0x33')](_0xb71f('0x51'),_0x4034f9[_0xb71f('0x50')]);if(fs[_0xb71f('0x52')](_0x4efc45)){cypher=!![];return _0x42ff83['decryptFile'](_0x4efc45,_0x4034f9['value'],config[_0xb71f('0x62')]['recording'])[_0xb71f('0x26')](function(){return _0x4034f9;});}return _0x4034f9;}})[_0xb71f('0x26')](function(_0x4ee67b){if(!_0x4ee67b){throw new db[(_0xb71f('0x54'))][(_0xb71f('0x55'))](_0xb71f('0x7c'));}_0x4ea446=_0x4ee67b;return db[_0xb71f('0x7d')][_0xb71f('0x7e')]({'where':{'id':0x1}});})[_0xb71f('0x26')](handleEntityNotFound(_0x413f52,null))[_0xb71f('0x26')](function(_0x20240b){if(_0x20240b){_0x4bd7b7=_0x20240b;if(!_0x4bd7b7[_0xb71f('0x7f')]||!_0x4bd7b7[_0xb71f('0x80')]||!_0x4bd7b7[_0xb71f('0x81')]||!_0x4bd7b7[_0xb71f('0x82')]||!_0x4bd7b7[_0xb71f('0x73')]){throw new db['Sequelize']['ValidationError'](_0xb71f('0x83'));}if(_0x78589e[_0xb71f('0x4c')][_0xb71f('0x84')]&&(!_0x4bd7b7[_0xb71f('0x85')]||!_0x4bd7b7[_0xb71f('0x86')]||!_0x4bd7b7[_0xb71f('0x87')]||!_0x4bd7b7[_0xb71f('0x82')]||!_0x4bd7b7[_0xb71f('0x73')])){throw new db[(_0xb71f('0x54'))][(_0xb71f('0x55'))](_0xb71f('0x88'));}return db['CloudProvider'][_0xb71f('0x7e')]({'where':{'id':_0x4bd7b7[_0xb71f('0x80')]}});}})[_0xb71f('0x26')](function(_0x190fb9){if(!_0x190fb9){throw new db['Sequelize'][(_0xb71f('0x55'))](_0xb71f('0x89'));}if(!_0x190fb9[_0xb71f('0x8a')]||!_0x190fb9['data2']){throw new db[(_0xb71f('0x54'))][(_0xb71f('0x55'))]('Cloud\x20Provider\x20not\x20configured');}_0x597a55=_0x190fb9;return getBucketslist(_0x597a55['data1'],_0x597a55['data2'],_0x4bd7b7[_0xb71f('0x81')]);})[_0xb71f('0x26')](function(_0x28e196){if(_0x28e196&&_0x28e196[_0xb71f('0x8b')]){var _0x4c24a0=_[_0xb71f('0x4a')](_0x28e196[_0xb71f('0x8b')],function(_0x57b331){return _0x57b331['Name']===_0x4bd7b7[_0xb71f('0x73')];});if(!_0x4c24a0){logger[_0xb71f('0x66')](util[_0xb71f('0x33')](_0xb71f('0x8c'),_0x78589e['params']['id'],_0x4bd7b7[_0xb71f('0x73')]));return createBucket(_0x597a55[_0xb71f('0x8a')],_0x597a55[_0xb71f('0x8d')],_0x4bd7b7[_0xb71f('0x81')],_0x4bd7b7['bucket']);}logger['info'](util[_0xb71f('0x33')](_0xb71f('0x8e'),_0x78589e[_0xb71f('0x46')]['id'],_0x4bd7b7[_0xb71f('0x73')]));return;}})[_0xb71f('0x26')](function(_0x97faab){if(_0x4ea446[_0xb71f('0x79')]===_0xb71f('0x8f')){return transcribe(_0x78589e[_0xb71f('0x46')]['id'],_0x597a55[_0xb71f('0x8a')],_0x597a55[_0xb71f('0x8d')],_0x4bd7b7[_0xb71f('0x81')],_0x4bd7b7[_0xb71f('0x73')],_0x4ea446[_0xb71f('0x50')],_0x4bd7b7[_0xb71f('0x82')]);}else{logger['info'](util[_0xb71f('0x33')](_0xb71f('0x90'),_0x78589e[_0xb71f('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xb71f('0x26')](function(_0x538a24){if(_0x538a24){_0x538a24['tempSentiment']=_0x78589e[_0xb71f('0x4c')][_0xb71f('0x84')];return _0x4ea446[_0xb71f('0x91')](_0x538a24);}})[_0xb71f('0x26')](respondWithResult(_0x413f52,null))[_0xb71f('0x44')](handleError(_0x413f52,null));};function writeFile(_0xb4052,_0x4f6ba3){return new Promise(function(_0x3983f7,_0x3895d9){fs[_0xb71f('0x92')](_0x4f6ba3,_0xb4052,function(_0x2abe46,_0x4199c6){if(_0x2abe46){return _0x3895d9(_0x2abe46);}else{return _0x3983f7(_0x4199c6);}});});}exports[_0xb71f('0x93')]=function(_0x3ab365,_0x365456,_0x37bf7c){return db[_0xb71f('0x2d')][_0xb71f('0x7e')]({'where':{'id':_0x3ab365[_0xb71f('0x46')]['id']}})[_0xb71f('0x26')](handleEntityNotFound(_0x365456))[_0xb71f('0x26')](function(_0x1158ba){if(_0x1158ba&&_0x1158ba[_0xb71f('0x94')]){var _0x5a8f96=_0x1158ba['fileText'];var _0x5c8f63=config[_0xb71f('0x95')]+_0xb71f('0x96')+_0x1158ba['id']+_0xb71f('0x97');if(fs['existsSync'](_0x5c8f63)){return _0x5c8f63;}return writeFile(_0x5a8f96,_0x5c8f63)[_0xb71f('0x26')](function(){return _0x5c8f63;});}else{throw new db['Sequelize'][(_0xb71f('0x55'))](_0xb71f('0x98'));}})[_0xb71f('0x26')](function(_0x19fdca){return _0x365456[_0xb71f('0x4e')](_0x19fdca);})[_0xb71f('0x44')](handleError(_0x365456));}; \ No newline at end of file +var _0xce5a=['type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','body','update','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','secrets','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','VoiceRecording','rawAttributes'];(function(_0x1d2d7b,_0x44d388){var _0x4e804a=function(_0x4c8fc5){while(--_0x4c8fc5){_0x1d2d7b['push'](_0x1d2d7b['shift']());}};_0x4e804a(++_0x44d388);}(_0xce5a,0x100));var _0xace5=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0xce5a[_0x3a4f18];return _0x4c20fc;};'use strict';var emlformat=require(_0xace5('0x0'));var rimraf=require(_0xace5('0x1'));var zipdir=require(_0xace5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xace5('0x3'));var moment=require(_0xace5('0x4'));var BPromise=require(_0xace5('0x5'));var Mustache=require(_0xace5('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xace5('0x7'));var ejs=require(_0xace5('0x8'));var fs=require('fs');var fs_extra=require(_0xace5('0x9'));var _=require(_0xace5('0xa'));var squel=require(_0xace5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xace5('0xc'));var toCsv=require(_0xace5('0x7'));var querystring=require(_0xace5('0xd'));var Papa=require(_0xace5('0xe'));var AWS=require(_0xace5('0xf'));var uuidv4=require(_0xace5('0x10'));var Redis=require('ioredis');var authService=require(_0xace5('0x11'));var qs=require(_0xace5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xace5('0x13'));var utils=require(_0xace5('0x14'));var config=require(_0xace5('0x15'));var licenseUtil=require(_0xace5('0x16'));var db=require(_0xace5('0x17'))['db'];function respondWithStatusCode(_0x5bc56f,_0x6ddfc0){_0x6ddfc0=_0x6ddfc0||0xcc;return function(_0x33fbfb){if(_0x33fbfb){return _0x5bc56f[_0xace5('0x18')](_0x6ddfc0);}return _0x5bc56f[_0xace5('0x19')](_0x6ddfc0)[_0xace5('0x1a')]();};}function respondWithResult(_0x36bb15,_0x3dbb60){_0x3dbb60=_0x3dbb60||0xc8;return function(_0x238cce){if(_0x238cce){return _0x36bb15[_0xace5('0x19')](_0x3dbb60)[_0xace5('0x1b')](_0x238cce);}};}function respondWithFilteredResult(_0x4e13fe,_0x17b227){return function(_0xfd17c7){if(_0xfd17c7){var _0x5f46a4=typeof _0x17b227[_0xace5('0x1c')]==='undefined'&&typeof _0x17b227[_0xace5('0x1d')]===_0xace5('0x1e');var _0x1149ef=_0xfd17c7[_0xace5('0x1f')];var _0x57d2a4=_0x5f46a4?0x0:_0x17b227[_0xace5('0x1c')];var _0xd691e5=_0x5f46a4?_0xfd17c7[_0xace5('0x1f')]:_0x17b227[_0xace5('0x1c')]+_0x17b227['limit'];var _0x194a8b;if(_0xd691e5>=_0x1149ef){_0xd691e5=_0x1149ef;_0x194a8b=0xc8;}else{_0x194a8b=0xce;}_0x4e13fe[_0xace5('0x19')](_0x194a8b);return _0x4e13fe[_0xace5('0x20')](_0xace5('0x21'),_0x57d2a4+'-'+_0xd691e5+'/'+_0x1149ef)[_0xace5('0x1b')](_0xfd17c7);}return null;};}function patchUpdates(_0x2d4e3c){return function(_0xb3c8bc){try{jsonpatch[_0xace5('0x22')](_0xb3c8bc,_0x2d4e3c,!![]);}catch(_0x288fee){return BPromise[_0xace5('0x23')](_0x288fee);}return _0xb3c8bc[_0xace5('0x24')]();};}function saveUpdates(_0x1e8597,_0x318718){return function(_0x2d8ea2){if(_0x2d8ea2){return _0x2d8ea2['update'](_0x1e8597)['then'](function(_0x396312){return _0x396312;});}return null;};}function removeEntity(_0x387fec,_0x41acce){return function(_0x148f44){if(_0x148f44){return _0x148f44[_0xace5('0x25')]()[_0xace5('0x26')](function(){_0x387fec[_0xace5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1433c3,_0x5f376d){return function(_0x49ba02){if(!_0x49ba02){_0x1433c3[_0xace5('0x18')](0x194);}return _0x49ba02;};}function handleError(_0x41314d,_0x5bb8a1){_0x5bb8a1=_0x5bb8a1||0x1f4;return function(_0xc038b4){logger[_0xace5('0x27')](_0xc038b4[_0xace5('0x28')]);if(_0xc038b4[_0xace5('0x29')]){delete _0xc038b4[_0xace5('0x29')];}_0x41314d[_0xace5('0x19')](_0x5bb8a1)[_0xace5('0x2a')](_0xc038b4);};}exports[_0xace5('0x2b')]=function(_0x391055,_0x226b6b){var _0x55f4d9={},_0x51f5b9={},_0x1a7f06={'count':0x0,'rows':[]};var _0x148ed8=_['map'](db[_0xace5('0x2c')][_0xace5('0x2d')],function(_0x5a45bd){return{'name':_0x5a45bd['fieldName'],'type':_0x5a45bd[_0xace5('0x2e')][_0xace5('0x2f')]};});_0x51f5b9[_0xace5('0x30')]=_[_0xace5('0x31')](_[_0xace5('0x32')](_0x148ed8,_0xace5('0x29')),[_0xace5('0x33')]);_0x51f5b9[_0xace5('0x34')]=_[_0xace5('0x35')](_0x391055['query']);_0x51f5b9[_0xace5('0x36')]=_[_0xace5('0x37')](_0x51f5b9['model'],_0x51f5b9['query']);_0x55f4d9[_0xace5('0x38')]=_[_0xace5('0x37')](_0x51f5b9[_0xace5('0x30')],qs[_0xace5('0x39')](_0x391055[_0xace5('0x34')][_0xace5('0x39')]));_0x55f4d9['attributes']=_0x55f4d9[_0xace5('0x38')][_0xace5('0x3a')]?_0x55f4d9[_0xace5('0x38')]:_0x51f5b9['model'];if(!_0x391055['query'][_0xace5('0x3b')](_0xace5('0x3c'))){_0x55f4d9[_0xace5('0x1d')]=qs[_0xace5('0x1d')](_0x391055[_0xace5('0x34')][_0xace5('0x1d')]);_0x55f4d9[_0xace5('0x1c')]=qs[_0xace5('0x1c')](_0x391055[_0xace5('0x34')][_0xace5('0x1c')]);}_0x55f4d9['order']=qs['sort'](_0x391055[_0xace5('0x34')][_0xace5('0x3d')]);_0x55f4d9[_0xace5('0x3e')]=qs[_0xace5('0x36')](_[_0xace5('0x3f')](_0x391055[_0xace5('0x34')],_0x51f5b9[_0xace5('0x36')]),_0x148ed8);if(_0x391055[_0xace5('0x34')][_0xace5('0x40')]){_0x55f4d9['where']=_[_0xace5('0x41')](_0x55f4d9[_0xace5('0x3e')],{'$or':_[_0xace5('0x32')](_0x148ed8,function(_0x37e39f){if(_0x37e39f[_0xace5('0x2e')]!==_0xace5('0x42')){var _0x4d1266={};_0x4d1266[_0x37e39f[_0xace5('0x29')]]={'$like':'%'+_0x391055[_0xace5('0x34')][_0xace5('0x40')]+'%'};return _0x4d1266;}})});}_0x55f4d9=_[_0xace5('0x41')]({},_0x55f4d9,_0x391055['options']);var _0x2ae9b5={'where':_0x55f4d9[_0xace5('0x3e')]};return db['VoiceRecording'][_0xace5('0x1f')](_0x2ae9b5)['then'](function(_0x110582){_0x1a7f06[_0xace5('0x1f')]=_0x110582;if(_0x391055[_0xace5('0x34')][_0xace5('0x43')]){_0x55f4d9[_0xace5('0x44')]=[{'all':!![]}];}return db[_0xace5('0x2c')][_0xace5('0x45')](_0x55f4d9);})[_0xace5('0x26')](function(_0x246e87){_0x1a7f06[_0xace5('0x46')]=_0x246e87;return _0x1a7f06;})[_0xace5('0x26')](respondWithFilteredResult(_0x226b6b,_0x55f4d9))[_0xace5('0x47')](handleError(_0x226b6b,null));};exports['show']=function(_0x444354,_0x384953){var _0x21ea27={'raw':![],'where':{'id':_0x444354[_0xace5('0x48')]['id']}},_0x10a399={};_0x10a399[_0xace5('0x30')]=_[_0xace5('0x35')](db[_0xace5('0x2c')][_0xace5('0x2d')]);_0x10a399['query']=_[_0xace5('0x35')](_0x444354[_0xace5('0x34')]);_0x10a399[_0xace5('0x36')]=_[_0xace5('0x37')](_0x10a399[_0xace5('0x30')],_0x10a399[_0xace5('0x34')]);_0x21ea27[_0xace5('0x38')]=_[_0xace5('0x37')](_0x10a399[_0xace5('0x30')],qs[_0xace5('0x39')](_0x444354[_0xace5('0x34')][_0xace5('0x39')]));_0x21ea27[_0xace5('0x38')]=_0x21ea27[_0xace5('0x38')][_0xace5('0x3a')]?_0x21ea27[_0xace5('0x38')]:_0x10a399[_0xace5('0x30')];if(_0x444354[_0xace5('0x34')]['includeAll']){_0x21ea27[_0xace5('0x44')]=[{'all':!![]}];}_0x21ea27=_['merge']({},_0x21ea27,_0x444354[_0xace5('0x49')]);return db[_0xace5('0x2c')][_0xace5('0x4a')](_0x21ea27)[_0xace5('0x26')](handleEntityNotFound(_0x384953,null))[_0xace5('0x26')](respondWithResult(_0x384953,null))[_0xace5('0x47')](handleError(_0x384953,null));};exports['create']=function(_0x367d93,_0x310be7){return db['VoiceRecording']['create'](_0x367d93[_0xace5('0x4b')],{})[_0xace5('0x26')](respondWithResult(_0x310be7,0xc9))[_0xace5('0x47')](handleError(_0x310be7,null));};exports[_0xace5('0x4c')]=function(_0x5ee0b8,_0x1b19b7){if(_0x5ee0b8[_0xace5('0x4b')]['id']){delete _0x5ee0b8[_0xace5('0x4b')]['id'];}return db[_0xace5('0x2c')][_0xace5('0x4a')]({'where':{'id':_0x5ee0b8[_0xace5('0x48')]['id']}})[_0xace5('0x26')](handleEntityNotFound(_0x1b19b7,null))[_0xace5('0x26')](saveUpdates(_0x5ee0b8[_0xace5('0x4b')],null))[_0xace5('0x26')](respondWithResult(_0x1b19b7,null))[_0xace5('0x47')](handleError(_0x1b19b7,null));};exports['describe']=function(_0x267df3,_0x1af27f){return db[_0xace5('0x2c')]['describe']()[_0xace5('0x26')](respondWithResult(_0x1af27f,null))[_0xace5('0x47')](handleError(_0x1af27f,null));};exports[_0xace5('0x4d')]=function(_0x1ce8e8,_0x46f2c9,_0x2f90f4){var _0x454a44=require(_0xace5('0x4e'));var _0x20a8af=![];var _0x2237be={};if(_0x1ce8e8[_0xace5('0x34')][_0xace5('0x2e')]&&_0x1ce8e8[_0xace5('0x34')][_0xace5('0x2e')]===_0xace5('0x4f')){_0x2237be[_0xace5('0x4f')]=_0x1ce8e8[_0xace5('0x48')]['id'];}else{_0x2237be['id']=_0x1ce8e8[_0xace5('0x48')]['id'];}return db[_0xace5('0x2c')]['find']({'where':_0x2237be,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x46f2c9,null))[_0xace5('0x26')](function(_0x358913){if(_0x358913){var _0x557361=_0x358913[_0xace5('0x50')];var _0x4158a0=util['format'](_0xace5('0x51'),_0x557361);if(fs[_0xace5('0x52')](_0x4158a0)){_0x20a8af=!![];return _0x454a44[_0xace5('0x53')](_0x4158a0,_0x557361,config['secrets'][_0xace5('0x54')])[_0xace5('0x26')](function(){return _0x358913;});}return _0x358913;}})[_0xace5('0x26')](function(_0x3e3d3a){if(_0x3e3d3a){var _0x6fed5f=_0x3e3d3a[_0xace5('0x50')];if(!fs['existsSync'](_0x6fed5f)){throw new db[(_0xace5('0x55'))][(_0xace5('0x56'))](_0xace5('0x57'));}if(_0x3e3d3a[_0xace5('0x58')]){return _0x46f2c9['download'](_0x6fed5f,_0x3e3d3a[_0xace5('0x58')]+path['extname'](_0x6fed5f),function(){if(_0x20a8af){fs[_0xace5('0x59')](_0x6fed5f);}});}else{return _0x46f2c9[_0xace5('0x4d')](_0x6fed5f,function(_0x4b3e6e){if(_0x20a8af){fs['unlink'](_0x6fed5f);}});}}})['catch'](function(_0x116167){if(_0x116167[_0xace5('0x5a')]==='VoiceRecording\x20not\x20found'){_0x46f2c9[_0xace5('0x19')](0x194)[_0xace5('0x2a')](_0xace5('0x5b'));}else{return handleError(_0x46f2c9,null);}});};exports[_0xace5('0x5c')]=function(_0x663c0f,_0x14edf0,_0x20ad90){var _0x4af79d=require(_0xace5('0x4e'));var _0x8bf9c1=![];var _0x3e9eef={'$and':[db[_0xace5('0x5d')]['where'](db[_0xace5('0x5d')]['fn'](_0xace5('0x5e'),db[_0xace5('0x5d')][_0xace5('0x5f')](_0xace5('0x4f'))),_0x663c0f['query']['token'])]};if(_0x663c0f[_0xace5('0x34')]['type']&&_0x663c0f[_0xace5('0x34')][_0xace5('0x2e')]===_0xace5('0x4f')){_0x3e9eef[_0xace5('0x60')][_0xace5('0x61')]({'uniqueid':_0x663c0f[_0xace5('0x48')]['id']});}else{_0x3e9eef[_0xace5('0x60')]['push']({'id':_0x663c0f['params']['id']});}return db['VoiceRecording']['find']({'where':_0x3e9eef,'attributes':['id',_0xace5('0x50')],'raw':!![]})[_0xace5('0x26')](handleEntityNotFound(_0x14edf0,null))[_0xace5('0x26')](function(_0xa0359b){if(_0xa0359b){var _0x18b2fe=util['format'](_0xace5('0x51'),_0xa0359b['value']);if(fs[_0xace5('0x52')](_0x18b2fe)){_0x8bf9c1=!![];return _0x4af79d['decryptFile'](_0x18b2fe,_0xa0359b[_0xace5('0x50')],config[_0xace5('0x62')][_0xace5('0x54')])['then'](function(){return _0xa0359b;});}return _0xa0359b;}})[_0xace5('0x26')](function(_0x5864a6){if(_0x5864a6){if(!fs[_0xace5('0x52')](_0x5864a6['value'])){throw new db['Sequelize']['ValidationError'](_0xace5('0x57'));}if(_0x5864a6[_0xace5('0x58')]){return _0x14edf0[_0xace5('0x4d')](_0x5864a6[_0xace5('0x50')],_0x5864a6[_0xace5('0x58')]+path['extname'](_0x5864a6[_0xace5('0x50')]),function(){if(_0x8bf9c1){fs[_0xace5('0x59')](_0x5864a6[_0xace5('0x50')]);}});}else{return _0x14edf0[_0xace5('0x4d')](_0x5864a6['value'],function(_0x20e2b9){if(_0x8bf9c1){fs[_0xace5('0x59')](_0x5864a6[_0xace5('0x50')]);}});}}})[_0xace5('0x47')](handleError(_0x14edf0,null));};exports['destroy']=function(_0x1073fb,_0x80598f){return db[_0xace5('0x2c')]['find']({'where':{'id':_0x1073fb[_0xace5('0x48')]['id']}})['then'](function(_0x142206){if(_[_0xace5('0x63')](_0x142206)){throw new ReferenceError('Entity\x20not\x20found');}return _0x142206;})[_0xace5('0x26')](function(_0x12d6f6){var _0x42efe2=_0x12d6f6[_0xace5('0x50')];logger[_0xace5('0x64')](_0xace5('0x65'),_0x42efe2);if(!_[_0xace5('0x63')](_0x12d6f6[_0xace5('0x50')])&&fs[_0xace5('0x52')](_0x42efe2)){logger['info'](_0xace5('0x66')+_0x42efe2+_0xace5('0x67'));fs['unlinkSync'](_0x42efe2);}_0x42efe2=_0x42efe2+_0xace5('0x68');if(!_[_0xace5('0x63')](_0x12d6f6[_0xace5('0x50')])&&fs[_0xace5('0x52')](_0x42efe2)){logger[_0xace5('0x64')](_0xace5('0x66')+_0x42efe2+_0xace5('0x67'));fs['unlinkSync'](_0x42efe2);}return _0x12d6f6;})[_0xace5('0x26')](function(_0x3f288d){if(!_0x3f288d)throw new InternalError();return _0x3f288d[_0xace5('0x25')]();})[_0xace5('0x26')](function(){_0x80598f['status'](0xcc)[_0xace5('0x1a')]();})[_0xace5('0x47')](handleError(_0x80598f,null));};function getBucketslist(_0x546407,_0xf01aef,_0x3ef4bc){return new Promise(function(_0x24b2de,_0x48e665){var _0x35992f=new AWS['S3']({'accessKeyId':_0xf01aef,'secretAccessKey':_0x546407,'region':_0x3ef4bc});_0x35992f['listBuckets']({},function(_0x33561e,_0x55e8){if(_0x33561e){return _0x48e665(_0x33561e);}else{return _0x24b2de(_0x55e8);}});});}function createBucket(_0x3f3161,_0x5f479a,_0x50eb69,_0x1f04ff){return new Promise(function(_0x1a137f,_0x1d581b){var _0x5896bb=new AWS['S3']({'accessKeyId':_0x5f479a,'secretAccessKey':_0x3f3161,'region':_0x50eb69});_0x5896bb[_0xace5('0x69')]({'Bucket':_0x1f04ff},function(_0x274fb6,_0x34799b){if(_0x274fb6){return _0x1d581b(_0x274fb6);}else{return _0x1a137f(_0x34799b);}});});}function uploadFile(_0x2bf896,_0x2e7d8d,_0x184041,_0x1cf0a5,_0x5c4ddc,_0xe538c2){return new Promise(function(_0x36ed9b,_0x598de5){var _0x41df0f=new AWS['S3']({'accessKeyId':_0x2e7d8d,'secretAccessKey':_0x2bf896,'region':_0x184041});_0x41df0f[_0xace5('0x6a')]({'Bucket':_0x1cf0a5,'Key':_0x5c4ddc,'Body':_0xe538c2},function(_0x45bc6d,_0x407dc2){if(_0x45bc6d){return _0x598de5(_0x45bc6d);}else{return _0x36ed9b(_0x407dc2);}});});}function startTranscribe(_0x437d42,_0x4f26a3,_0x279d88,_0x1da8ac,_0x33d881,_0x856698){return new Promise(function(_0xac2c15,_0x5763e5){var _0x5cefa4=new AWS[(_0xace5('0x6b'))]({'accessKeyId':_0x4f26a3,'secretAccessKey':_0x437d42,'region':_0x279d88});_0x5cefa4[_0xace5('0x6c')]({'TranscriptionJobName':_0x1da8ac,'LanguageCode':_0x33d881,'Media':{'MediaFileUri':_0x856698}},function(_0x311a3f,_0x56d8fd){if(_0x311a3f){return _0x5763e5(_0x311a3f);}else{return _0xac2c15(_0x56d8fd);}});});}function transcribe(_0xd8f394,_0x5ef7c0,_0x319d81,_0x6d2eaf,_0x2dc259,_0x537bfe,_0x40d417){return new Promise(function(_0x36a3c7,_0x7337fb){var _0x27e388={};logger[_0xace5('0x64')](util[_0xace5('0x33')](_0xace5('0x6d'),_0xd8f394,_0x2dc259));return uploadFile(_0x5ef7c0,_0x319d81,_0x6d2eaf,_0x2dc259,path[_0xace5('0x6e')](_0x537bfe),fs[_0xace5('0x6f')](_0x537bfe))[_0xace5('0x26')](function(_0x31d9d7){logger[_0xace5('0x64')](util[_0xace5('0x33')](_0xace5('0x70'),_0xd8f394,_0x2dc259,_0x31d9d7[_0xace5('0x71')]));_0x27e388[_0xace5('0x72')]=_0x31d9d7['Bucket'];_0x27e388[_0xace5('0x73')]=_0x31d9d7[_0xace5('0x71')];logger['info'](util[_0xace5('0x33')](_0xace5('0x74'),_0xd8f394));return startTranscribe(_0x5ef7c0,_0x319d81,_0x6d2eaf,uuidv4(),_0x40d417,_0x31d9d7[_0xace5('0x71')]);})[_0xace5('0x26')](function(_0x5a0aa1){logger[_0xace5('0x64')](util[_0xace5('0x33')](_0xace5('0x75'),_0xd8f394,_0x5a0aa1[_0xace5('0x76')]['TranscriptionJobName']));_0x27e388[_0xace5('0x77')]=_0x5a0aa1['TranscriptionJob']['TranscriptionJobName'];_0x27e388['transcribeStatus']=_0x5a0aa1[_0xace5('0x76')][_0xace5('0x78')];return _0x36a3c7(_0x27e388);})[_0xace5('0x47')](function(_0x10c866){return _0x7337fb(_0x10c866);});});}exports[_0xace5('0x79')]=function(_0x264a5c,_0x44133e,_0x208ef2){var _0x2e02c5;var _0x2f1d69;var _0x3594a0;var _0x210e2a=require(_0xace5('0x4e'));return db[_0xace5('0x2c')][_0xace5('0x7a')]({'where':{'id':_0x264a5c['params']['id']}})[_0xace5('0x26')](function(_0x4db6dd){if(_0x4db6dd){var _0x314ae2=util[_0xace5('0x33')](_0xace5('0x51'),_0x4db6dd['value']);if(fs[_0xace5('0x52')](_0x314ae2)){cypher=!![];return _0x210e2a[_0xace5('0x53')](_0x314ae2,_0x4db6dd[_0xace5('0x50')],config[_0xace5('0x62')][_0xace5('0x54')])[_0xace5('0x26')](function(){return _0x4db6dd;});}return _0x4db6dd;}})[_0xace5('0x26')](function(_0x46d423){if(!_0x46d423){throw new db['Sequelize'][(_0xace5('0x56'))](_0xace5('0x7b'));}_0x2f1d69=_0x46d423;return db[_0xace5('0x7c')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x44133e,null))['then'](function(_0x3cff5f){if(_0x3cff5f){_0x2e02c5=_0x3cff5f;if(!_0x2e02c5[_0xace5('0x7d')]||!_0x2e02c5['transcribeAccountId']||!_0x2e02c5[_0xace5('0x7e')]||!_0x2e02c5[_0xace5('0x7f')]||!_0x2e02c5['bucket']){throw new db['Sequelize']['ValidationError'](_0xace5('0x80'));}if(_0x264a5c[_0xace5('0x4b')]['runSentiment']&&(!_0x2e02c5[_0xace5('0x81')]||!_0x2e02c5[_0xace5('0x82')]||!_0x2e02c5[_0xace5('0x83')]||!_0x2e02c5[_0xace5('0x7f')]||!_0x2e02c5[_0xace5('0x72')])){throw new db[(_0xace5('0x55'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xace5('0x84')][_0xace5('0x7a')]({'where':{'id':_0x2e02c5[_0xace5('0x85')]}});}})[_0xace5('0x26')](function(_0x7821d0){if(!_0x7821d0){throw new db[(_0xace5('0x55'))][(_0xace5('0x56'))](_0xace5('0x86'));}if(!_0x7821d0[_0xace5('0x87')]||!_0x7821d0[_0xace5('0x88')]){throw new db[(_0xace5('0x55'))][(_0xace5('0x56'))](_0xace5('0x89'));}_0x3594a0=_0x7821d0;return getBucketslist(_0x3594a0[_0xace5('0x87')],_0x3594a0[_0xace5('0x88')],_0x2e02c5[_0xace5('0x7e')]);})[_0xace5('0x26')](function(_0x49b709){if(_0x49b709&&_0x49b709[_0xace5('0x8a')]){var _0x18965e=_[_0xace5('0x4a')](_0x49b709['Buckets'],function(_0x159427){return _0x159427[_0xace5('0x8b')]===_0x2e02c5[_0xace5('0x72')];});if(!_0x18965e){logger[_0xace5('0x64')](util[_0xace5('0x33')](_0xace5('0x8c'),_0x264a5c[_0xace5('0x48')]['id'],_0x2e02c5[_0xace5('0x72')]));return createBucket(_0x3594a0['data1'],_0x3594a0['data2'],_0x2e02c5['transcribeRegion'],_0x2e02c5[_0xace5('0x72')]);}logger[_0xace5('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x264a5c['params']['id'],_0x2e02c5['bucket']));return;}})[_0xace5('0x26')](function(_0x52dbb0){if(_0x2f1d69[_0xace5('0x8d')]==='NEW'){return transcribe(_0x264a5c[_0xace5('0x48')]['id'],_0x3594a0[_0xace5('0x87')],_0x3594a0[_0xace5('0x88')],_0x2e02c5[_0xace5('0x7e')],_0x2e02c5[_0xace5('0x72')],_0x2f1d69[_0xace5('0x50')],_0x2e02c5[_0xace5('0x7f')]);}else{logger[_0xace5('0x64')](util['format'](_0xace5('0x8e'),_0x264a5c[_0xace5('0x48')]['id']));return{'transcribeStatus':_0xace5('0x8f')};}})[_0xace5('0x26')](function(_0x496ed4){if(_0x496ed4){_0x496ed4['tempSentiment']=_0x264a5c['body'][_0xace5('0x90')];return _0x2f1d69[_0xace5('0x91')](_0x496ed4);}})['then'](respondWithResult(_0x44133e,null))['catch'](handleError(_0x44133e,null));};function writeFile(_0x505a76,_0x2ad074){return new Promise(function(_0x2ae72f,_0x31fcd1){fs['writeFile'](_0x2ad074,_0x505a76,function(_0x3fc5b9,_0x206398){if(_0x3fc5b9){return _0x31fcd1(_0x3fc5b9);}else{return _0x2ae72f(_0x206398);}});});}exports[_0xace5('0x92')]=function(_0x16522e,_0x4df804,_0x733763){return db['VoiceRecording'][_0xace5('0x7a')]({'where':{'id':_0x16522e['params']['id']}})[_0xace5('0x26')](handleEntityNotFound(_0x4df804))['then'](function(_0x2f39fe){if(_0x2f39fe&&_0x2f39fe[_0xace5('0x93')]){var _0x2f4e99=_0x2f39fe['fileText'];var _0x2a4610=config[_0xace5('0x94')]+'/server/files/transcribes/transcribe_'+_0x2f39fe['id']+_0xace5('0x95');if(fs[_0xace5('0x52')](_0x2a4610)){return _0x2a4610;}return writeFile(_0x2f4e99,_0x2a4610)[_0xace5('0x26')](function(){return _0x2a4610;});}else{throw new db[(_0xace5('0x55'))][(_0xace5('0x56'))](_0xace5('0x96'));}})[_0xace5('0x26')](function(_0x1b8b52){return _0x4df804[_0xace5('0x4d')](_0x1b8b52);})[_0xace5('0x47')](handleError(_0x4df804));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index edb3194..8105d31 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 _0xe2d7=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x4be6f4,_0x385b23){var _0x3e9098=function(_0x17ff9a){while(--_0x17ff9a){_0x4be6f4['push'](_0x4be6f4['shift']());}};_0x3e9098(++_0x385b23);}(_0xe2d7,0x112));var _0x7e2d=function(_0x2fdfee,_0x386dc7){_0x2fdfee=_0x2fdfee-0x0;var _0x2387c3=_0xe2d7[_0x2fdfee];return _0x2387c3;};'use strict';var _=require(_0x7e2d('0x0'));var util=require('util');var logger=require(_0x7e2d('0x1'))(_0x7e2d('0x2'));var moment=require(_0x7e2d('0x3'));var BPromise=require(_0x7e2d('0x4'));var rp=require(_0x7e2d('0x5'));var fs=require('fs');var path=require(_0x7e2d('0x6'));var rimraf=require(_0x7e2d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e2d('0x8'));module[_0x7e2d('0x9')]=function(_0x4428b4,_0x3b7b41){return _0x4428b4[_0x7e2d('0xa')](_0x7e2d('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7e2d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x28b0=['path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13fabf,_0x554b3a){var _0x35e697=function(_0x1d160){while(--_0x1d160){_0x13fabf['push'](_0x13fabf['shift']());}};_0x35e697(++_0x554b3a);}(_0x28b0,0x174));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x028b('0x0'));var logger=require(_0x028b('0x1'))(_0x028b('0x2'));var moment=require(_0x028b('0x3'));var BPromise=require(_0x028b('0x4'));var rp=require(_0x028b('0x5'));var fs=require('fs');var path=require(_0x028b('0x6'));var rimraf=require(_0x028b('0x7'));var config=require(_0x028b('0x8'));var attributes=require(_0x028b('0x9'));module['exports']=function(_0x14b5c9,_0x5bbe03){return _0x14b5c9[_0x028b('0xa')](_0x028b('0xb'),attributes,{'tableName':_0x028b('0xc'),'paranoid':![],'indexes':[{'name':_0x028b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 551097e..767bd58 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 _0xbff5=['catch','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','%s.cypher','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','options','raw','where','attributes','then','UpdateVoiceRecording','debug'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0xbff5,0x1bc));var _0x5bff=function(_0x47478c,_0x491b74){_0x47478c=_0x47478c-0x0;var _0x119413=_0xbff5[_0x47478c];return _0x119413;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['UpdateVoiceRecording']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['VoiceRecording'][_0x5bff('0x15')](_0xc9fbc3['body'],{'raw':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3['options'][_0x5bff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')]['limit']||null:null})[_0x5bff('0x1a')](function(_0x263cf5){logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0xc9fbc3);logger[_0x5bff('0x1c')](_0x5bff('0x1b'),_0xc9fbc3,JSON[_0x5bff('0xf')](_0x263cf5));_0x36653b(_0x263cf5);})[_0x5bff('0x1d')](function(_0x5e2ae8){logger['error'](_0x5bff('0x1b'),_0x5e2ae8['message'],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x5e2ae8[_0x5bff('0x12')]));});});};exports[_0x5bff('0x1e')]=function(_0x6f18f1){var _0xfa361d=this;return new Promise(function(_0x1140eb,_0x271f3c){var _0xedba9d=require('../../components/encryptor');var _0x4df57a;return db[_0x5bff('0x1f')][_0x5bff('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5bff('0x1a')](function(_0x588078){_0x4df57a=_0x588078;return db['VoiceRecording'][_0x5bff('0x21')](_0x6f18f1['body']);})[_0x5bff('0x1a')](function(_0x64e22){if(_0x4df57a[_0x5bff('0x22')]&&fs[_0x5bff('0x23')](_0x64e22['value'])){var _0x71783=util['format'](_0x5bff('0x24'),_0x64e22['value']);return _0xedba9d[_0x5bff('0x25')](_0x64e22[_0x5bff('0x26')],_0x71783,config[_0x5bff('0x27')][_0x5bff('0x28')])[_0x5bff('0x1a')](function(){fs[_0x5bff('0x29')](_0x64e22['value']);logger[_0x5bff('0x13')](_0x5bff('0x2a'));return _0x64e22;});}return _0x64e22;})[_0x5bff('0x1a')](function(_0x42fe4a){logger[_0x5bff('0x13')](_0x5bff('0x1e'),_0x6f18f1);logger[_0x5bff('0x1c')](_0x5bff('0x1e'),_0x6f18f1,JSON['stringify'](_0x42fe4a));_0x1140eb(_0x42fe4a);})[_0x5bff('0x1d')](function(_0x16042d){logger[_0x5bff('0x10')](_0x5bff('0x1e'),_0x16042d['message'],_0x6f18f1);_0x271f3c(_0xfa361d[_0x5bff('0x10')](0x1f4,_0x16042d[_0x5bff('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2b179c,_0x254522){var _0x56845e=function(_0x4d8a57){while(--_0x4d8a57){_0x2b179c['push'](_0x2b179c['shift']());}};_0x56845e(++_0x254522);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2fb97a,_0x1f8373){_0x2fb97a=_0x2fb97a-0x0;var _0x23de99=_0x5f2f[_0x2fb97a];return _0x23de99;};'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')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 81c4bfe..d298222 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 _0x678a=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x678a,0x1c8));var _0xa678=function(_0x2117ca,_0x592ad0){_0x2117ca=_0x2117ca-0x0;var _0x4eccb5=_0x678a[_0x2117ca];return _0x4eccb5;};'use strict';var multer=require('multer');var util=require(_0xa678('0x0'));var path=require(_0xa678('0x1'));var timeout=require(_0xa678('0x2'));var express=require(_0xa678('0x3'));var router=express['Router']();var fs_extra=require(_0xa678('0x4'));var auth=require(_0xa678('0x5'));var interaction=require(_0xa678('0x6'));var config=require(_0xa678('0x7'));var controller=require(_0xa678('0x8'));router[_0xa678('0x9')]('/',auth[_0xa678('0xa')](),controller[_0xa678('0xb')]);router[_0xa678('0x9')]('/describe',auth[_0xa678('0xa')](),controller[_0xa678('0xc')]);router['get'](_0xa678('0xd'),auth['isAuthenticated'](),controller[_0xa678('0xe')]);router['post']('/',auth[_0xa678('0xa')](),controller[_0xa678('0xf')]);router[_0xa678('0x10')]('/:id',auth[_0xa678('0xa')](),controller[_0xa678('0x11')]);router[_0xa678('0x12')](_0xa678('0xd'),auth[_0xa678('0xa')](),controller[_0xa678('0x13')]);module[_0xa678('0x14')]=router; \ No newline at end of file +var _0xc08b=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x518bdc,_0x1a3ab0){var _0x275ec5=function(_0x59c776){while(--_0x59c776){_0x518bdc['push'](_0x518bdc['shift']());}};_0x275ec5(++_0x1a3ab0);}(_0xc08b,0xc4));var _0xbc08=function(_0x2b7dd5,_0x34b4b8){_0x2b7dd5=_0x2b7dd5-0x0;var _0x11f7c3=_0xc08b[_0x2b7dd5];return _0x11f7c3;};'use strict';var multer=require(_0xbc08('0x0'));var util=require('util');var path=require(_0xbc08('0x1'));var timeout=require(_0xbc08('0x2'));var express=require(_0xbc08('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc08('0x4'));var interaction=require(_0xbc08('0x5'));var config=require(_0xbc08('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xbc08('0x7')]('/',auth['isAuthenticated'](),controller[_0xbc08('0x8')]);router['get'](_0xbc08('0x9'),auth[_0xbc08('0xa')](),controller[_0xbc08('0xb')]);router[_0xbc08('0x7')](_0xbc08('0xc'),auth[_0xbc08('0xa')](),controller[_0xbc08('0xd')]);router[_0xbc08('0xe')]('/',auth[_0xbc08('0xa')](),controller[_0xbc08('0xf')]);router[_0xbc08('0x10')](_0xbc08('0xc'),auth[_0xbc08('0xa')](),controller[_0xbc08('0x11')]);router[_0xbc08('0x12')](_0xbc08('0xc'),auth[_0xbc08('0xa')](),controller[_0xbc08('0x13')]);module[_0xbc08('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9348201..bdb1504 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 _0x5e89=['attended','STRING','ENUM','Yes','sequelize','moment','blind'];(function(_0x301774,_0x48aae1){var _0x9ee9c9=function(_0x408bc2){while(--_0x408bc2){_0x301774['push'](_0x301774['shift']());}};_0x9ee9c9(++_0x48aae1);}(_0x5e89,0x131));var _0x95e8=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5e89[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x95e8('0x0'));var moment=require(_0x95e8('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x95e8('0x2'),_0x95e8('0x3'))},'result':{'type':Sequelize[_0x95e8('0x4')]},'transfererchannel':{'type':Sequelize[_0x95e8('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x95e8('0x4')]},'transferercalleridname':{'type':Sequelize[_0x95e8('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x95e8('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x95e8('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x95e8('0x4')]},'transferercontext':{'type':Sequelize[_0x95e8('0x4')]},'transfererexten':{'type':Sequelize[_0x95e8('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x95e8('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x95e8('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x95e8('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x95e8('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x95e8('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x95e8('0x4')]},'transfereecontext':{'type':Sequelize[_0x95e8('0x4')]},'transfereeexten':{'type':Sequelize[_0x95e8('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x95e8('0x4')]},'isexternal':{'type':Sequelize[_0x95e8('0x5')](_0x95e8('0x6'),'No')},'context':{'type':Sequelize[_0x95e8('0x4')]},'extension':{'type':Sequelize[_0x95e8('0x4')]}}; \ No newline at end of file +var _0x88b9=['attended','STRING','ENUM','Yes','sequelize','exports','blind'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x88b9,0x185));var _0x988b=function(_0x336b2b,_0x39c6e6){_0x336b2b=_0x336b2b-0x0;var _0x4c7a27=_0x88b9[_0x336b2b];return _0x4c7a27;};'use strict';var Sequelize=require(_0x988b('0x0'));var moment=require('moment');module[_0x988b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x988b('0x2'),_0x988b('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x988b('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x988b('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x988b('0x4')]},'transferercontext':{'type':Sequelize[_0x988b('0x4')]},'transfererexten':{'type':Sequelize[_0x988b('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x988b('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x988b('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x988b('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x988b('0x4')]},'transfereecontext':{'type':Sequelize[_0x988b('0x4')]},'transfereeexten':{'type':Sequelize[_0x988b('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x988b('0x5')](_0x988b('0x6'),'No')},'context':{'type':Sequelize[_0x988b('0x4')]},'extension':{'type':Sequelize[_0x988b('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5c33320..44da069 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 _0xee53=['length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0x32aeec,_0x2d5623){var _0x3d7fb7=function(_0x1d6473){while(--_0x1d6473){_0x32aeec['push'](_0x32aeec['shift']());}};_0x3d7fb7(++_0x2d5623);}(_0xee53,0x138));var _0x3ee5=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0xee53[_0x2962b4];return _0x411b7d;};'use strict';var emlformat=require(_0x3ee5('0x0'));var rimraf=require(_0x3ee5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ee5('0x2'));var rp=require(_0x3ee5('0x3'));var moment=require(_0x3ee5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ee5('0x5'));var path=require(_0x3ee5('0x6'));var sox=require(_0x3ee5('0x7'));var csv=require(_0x3ee5('0x8'));var ejs=require(_0x3ee5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ee5('0xb'));var deskjs=require(_0x3ee5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ee5('0xd'));var Papa=require(_0x3ee5('0xe'));var Redis=require('ioredis');var authService=require(_0x3ee5('0xf'));var qs=require(_0x3ee5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ee5('0x11'));var logger=require(_0x3ee5('0x12'))(_0x3ee5('0x13'));var utils=require(_0x3ee5('0x14'));var config=require(_0x3ee5('0x15'));var licenseUtil=require(_0x3ee5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x779be5,_0x4c6909){_0x4c6909=_0x4c6909||0xcc;return function(_0x3677d1){if(_0x3677d1){return _0x779be5[_0x3ee5('0x17')](_0x4c6909);}return _0x779be5[_0x3ee5('0x18')](_0x4c6909)['end']();};}function respondWithResult(_0x3f083e,_0x258287){_0x258287=_0x258287||0xc8;return function(_0x16bd5e){if(_0x16bd5e){return _0x3f083e[_0x3ee5('0x18')](_0x258287)[_0x3ee5('0x19')](_0x16bd5e);}};}function respondWithFilteredResult(_0x4a747d,_0x436f3c){return function(_0x515571){if(_0x515571){var _0x129c06=typeof _0x436f3c[_0x3ee5('0x1a')]===_0x3ee5('0x1b')&&typeof _0x436f3c[_0x3ee5('0x1c')]===_0x3ee5('0x1b');var _0x537f4e=_0x515571[_0x3ee5('0x1d')];var _0x78dbdb=_0x129c06?0x0:_0x436f3c[_0x3ee5('0x1a')];var _0x435c5e=_0x129c06?_0x515571[_0x3ee5('0x1d')]:_0x436f3c[_0x3ee5('0x1a')]+_0x436f3c[_0x3ee5('0x1c')];var _0xed13f;if(_0x435c5e>=_0x537f4e){_0x435c5e=_0x537f4e;_0xed13f=0xc8;}else{_0xed13f=0xce;}_0x4a747d[_0x3ee5('0x18')](_0xed13f);return _0x4a747d[_0x3ee5('0x1e')]('Content-Range',_0x78dbdb+'-'+_0x435c5e+'/'+_0x537f4e)[_0x3ee5('0x19')](_0x515571);}return null;};}function patchUpdates(_0xd08f0){return function(_0x6898a6){try{jsonpatch[_0x3ee5('0x1f')](_0x6898a6,_0xd08f0,!![]);}catch(_0x295824){return BPromise[_0x3ee5('0x20')](_0x295824);}return _0x6898a6[_0x3ee5('0x21')]();};}function saveUpdates(_0x509fdf,_0xf4e5d2){return function(_0x55a241){if(_0x55a241){return _0x55a241[_0x3ee5('0x22')](_0x509fdf)[_0x3ee5('0x23')](function(_0x20eede){return _0x20eede;});}return null;};}function removeEntity(_0xfd52db,_0x3b0bf2){return function(_0x482803){if(_0x482803){return _0x482803[_0x3ee5('0x24')]()['then'](function(){_0xfd52db['status'](0xcc)[_0x3ee5('0x25')]();});}};}function handleEntityNotFound(_0xead5b6,_0xe3b4c6){return function(_0x47e89f){if(!_0x47e89f){_0xead5b6[_0x3ee5('0x17')](0x194);}return _0x47e89f;};}function handleError(_0x4482b7,_0x381ce9){_0x381ce9=_0x381ce9||0x1f4;return function(_0x172f83){logger[_0x3ee5('0x26')](_0x172f83['stack']);if(_0x172f83[_0x3ee5('0x27')]){delete _0x172f83[_0x3ee5('0x27')];}_0x4482b7['status'](_0x381ce9)[_0x3ee5('0x28')](_0x172f83);};}exports[_0x3ee5('0x29')]=function(_0x39d247,_0x44cf83){var _0x595d1e={},_0x7f18d={},_0x1b1aaf={'count':0x0,'rows':[]};var _0x5afad9=_[_0x3ee5('0x2a')](db[_0x3ee5('0x2b')][_0x3ee5('0x2c')],function(_0x20a55c){return{'name':_0x20a55c[_0x3ee5('0x2d')],'type':_0x20a55c['type']['key']};});_0x7f18d[_0x3ee5('0x2e')]=_[_0x3ee5('0x2a')](_0x5afad9,_0x3ee5('0x27'));_0x7f18d[_0x3ee5('0x2f')]=_[_0x3ee5('0x30')](_0x39d247[_0x3ee5('0x2f')]);_0x7f18d[_0x3ee5('0x31')]=_[_0x3ee5('0x32')](_0x7f18d[_0x3ee5('0x2e')],_0x7f18d[_0x3ee5('0x2f')]);_0x595d1e[_0x3ee5('0x33')]=_[_0x3ee5('0x32')](_0x7f18d[_0x3ee5('0x2e')],qs['fields'](_0x39d247['query'][_0x3ee5('0x34')]));_0x595d1e[_0x3ee5('0x33')]=_0x595d1e[_0x3ee5('0x33')][_0x3ee5('0x35')]?_0x595d1e[_0x3ee5('0x33')]:_0x7f18d[_0x3ee5('0x2e')];if(!_0x39d247[_0x3ee5('0x2f')]['hasOwnProperty']('nolimit')){_0x595d1e['limit']=qs['limit'](_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x1c')]);_0x595d1e['offset']=qs[_0x3ee5('0x1a')](_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x1a')]);}_0x595d1e[_0x3ee5('0x36')]=qs[_0x3ee5('0x37')](_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x37')]);_0x595d1e['where']=qs[_0x3ee5('0x31')](_[_0x3ee5('0x38')](_0x39d247[_0x3ee5('0x2f')],_0x7f18d[_0x3ee5('0x31')]),_0x5afad9);if(_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x39')]){_0x595d1e[_0x3ee5('0x3a')]=_[_0x3ee5('0x3b')](_0x595d1e[_0x3ee5('0x3a')],{'$or':_[_0x3ee5('0x2a')](_0x5afad9,function(_0x47f14b){if(_0x47f14b[_0x3ee5('0x3c')]!==_0x3ee5('0x3d')){var _0x474933={};_0x474933[_0x47f14b[_0x3ee5('0x27')]]={'$like':'%'+_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x39')]+'%'};return _0x474933;}})});}_0x595d1e=_[_0x3ee5('0x3b')]({},_0x595d1e,_0x39d247[_0x3ee5('0x3e')]);var _0x213e2e={'where':_0x595d1e[_0x3ee5('0x3a')]};return db['VoiceTransferReport']['count'](_0x213e2e)[_0x3ee5('0x23')](function(_0x5114dd){_0x1b1aaf[_0x3ee5('0x1d')]=_0x5114dd;if(_0x39d247[_0x3ee5('0x2f')][_0x3ee5('0x3f')]){_0x595d1e[_0x3ee5('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3ee5('0x41')](_0x595d1e);})[_0x3ee5('0x23')](function(_0x331b4b){_0x1b1aaf['rows']=_0x331b4b;return _0x1b1aaf;})[_0x3ee5('0x23')](respondWithFilteredResult(_0x44cf83,_0x595d1e))[_0x3ee5('0x42')](handleError(_0x44cf83,null));};exports[_0x3ee5('0x43')]=function(_0x1e8e1e,_0x158111){var _0x57fa65={'raw':!![],'where':{'id':_0x1e8e1e[_0x3ee5('0x44')]['id']}},_0x5a16e9={};_0x5a16e9[_0x3ee5('0x2e')]=_[_0x3ee5('0x30')](db['VoiceTransferReport']['rawAttributes']);_0x5a16e9[_0x3ee5('0x2f')]=_['keys'](_0x1e8e1e[_0x3ee5('0x2f')]);_0x5a16e9[_0x3ee5('0x31')]=_['intersection'](_0x5a16e9[_0x3ee5('0x2e')],_0x5a16e9[_0x3ee5('0x2f')]);_0x57fa65[_0x3ee5('0x33')]=_['intersection'](_0x5a16e9[_0x3ee5('0x2e')],qs[_0x3ee5('0x34')](_0x1e8e1e[_0x3ee5('0x2f')]['fields']));_0x57fa65[_0x3ee5('0x33')]=_0x57fa65[_0x3ee5('0x33')][_0x3ee5('0x35')]?_0x57fa65[_0x3ee5('0x33')]:_0x5a16e9[_0x3ee5('0x2e')];if(_0x1e8e1e[_0x3ee5('0x2f')][_0x3ee5('0x3f')]){_0x57fa65[_0x3ee5('0x40')]=[{'all':!![]}];}_0x57fa65=_[_0x3ee5('0x3b')]({},_0x57fa65,_0x1e8e1e['options']);return db[_0x3ee5('0x2b')][_0x3ee5('0x45')](_0x57fa65)['then'](handleEntityNotFound(_0x158111,null))[_0x3ee5('0x23')](respondWithResult(_0x158111,null))[_0x3ee5('0x42')](handleError(_0x158111,null));};exports[_0x3ee5('0x46')]=function(_0x44cde2,_0x3e07fb){return db[_0x3ee5('0x2b')][_0x3ee5('0x46')](_0x44cde2[_0x3ee5('0x47')],{})[_0x3ee5('0x23')](respondWithResult(_0x3e07fb,0xc9))[_0x3ee5('0x42')](handleError(_0x3e07fb,null));};exports[_0x3ee5('0x22')]=function(_0x5a5706,_0xf402ca){if(_0x5a5706[_0x3ee5('0x47')]['id']){delete _0x5a5706[_0x3ee5('0x47')]['id'];}return db[_0x3ee5('0x2b')][_0x3ee5('0x45')]({'where':{'id':_0x5a5706[_0x3ee5('0x44')]['id']}})[_0x3ee5('0x23')](handleEntityNotFound(_0xf402ca,null))['then'](saveUpdates(_0x5a5706[_0x3ee5('0x47')],null))[_0x3ee5('0x23')](respondWithResult(_0xf402ca,null))[_0x3ee5('0x42')](handleError(_0xf402ca,null));};exports[_0x3ee5('0x24')]=function(_0x69fcb2,_0x4866bd){return db[_0x3ee5('0x2b')][_0x3ee5('0x45')]({'where':{'id':_0x69fcb2[_0x3ee5('0x44')]['id']}})['then'](handleEntityNotFound(_0x4866bd,null))['then'](removeEntity(_0x4866bd,null))[_0x3ee5('0x42')](handleError(_0x4866bd,null));};exports[_0x3ee5('0x48')]=function(_0x1202cf,_0x386486){return db[_0x3ee5('0x2b')][_0x3ee5('0x48')]()[_0x3ee5('0x23')](respondWithResult(_0x386486,null))[_0x3ee5('0x42')](handleError(_0x386486,null));}; \ No newline at end of file +var _0xc6e3=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','catch','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x248f6b,_0x401324){var _0x54b829=function(_0x51ad90){while(--_0x51ad90){_0x248f6b['push'](_0x248f6b['shift']());}};_0x54b829(++_0x401324);}(_0xc6e3,0x170));var _0x3c6e=function(_0x16ee7d,_0x5cac30){_0x16ee7d=_0x16ee7d-0x0;var _0x2acc08=_0xc6e3[_0x16ee7d];return _0x2acc08;};'use strict';var emlformat=require(_0x3c6e('0x0'));var rimraf=require(_0x3c6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c6e('0x2'));var BPromise=require(_0x3c6e('0x3'));var Mustache=require(_0x3c6e('0x4'));var util=require(_0x3c6e('0x5'));var path=require(_0x3c6e('0x6'));var sox=require(_0x3c6e('0x7'));var csv=require(_0x3c6e('0x8'));var ejs=require(_0x3c6e('0x9'));var fs=require('fs');var fs_extra=require(_0x3c6e('0xa'));var _=require(_0x3c6e('0xb'));var squel=require(_0x3c6e('0xc'));var crypto=require(_0x3c6e('0xd'));var jsforce=require(_0x3c6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c6e('0xf'));var Redis=require(_0x3c6e('0x10'));var authService=require(_0x3c6e('0x11'));var qs=require(_0x3c6e('0x12'));var as=require(_0x3c6e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c6e('0x14'))(_0x3c6e('0x15'));var utils=require(_0x3c6e('0x16'));var config=require(_0x3c6e('0x17'));var licenseUtil=require(_0x3c6e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x237deb,_0xf1bb1a){_0xf1bb1a=_0xf1bb1a||0xcc;return function(_0x490447){if(_0x490447){return _0x237deb[_0x3c6e('0x19')](_0xf1bb1a);}return _0x237deb[_0x3c6e('0x1a')](_0xf1bb1a)[_0x3c6e('0x1b')]();};}function respondWithResult(_0xd5ef1c,_0x2f9935){_0x2f9935=_0x2f9935||0xc8;return function(_0x27bcd8){if(_0x27bcd8){return _0xd5ef1c[_0x3c6e('0x1a')](_0x2f9935)['json'](_0x27bcd8);}};}function respondWithFilteredResult(_0x41de7d,_0x127085){return function(_0x189679){if(_0x189679){var _0x1de853=typeof _0x127085[_0x3c6e('0x1c')]===_0x3c6e('0x1d')&&typeof _0x127085[_0x3c6e('0x1e')]===_0x3c6e('0x1d');var _0x6b2dd0=_0x189679['count'];var _0x43ce7a=_0x1de853?0x0:_0x127085[_0x3c6e('0x1c')];var _0x172e0b=_0x1de853?_0x189679[_0x3c6e('0x1f')]:_0x127085[_0x3c6e('0x1c')]+_0x127085['limit'];var _0x2b250e;if(_0x172e0b>=_0x6b2dd0){_0x172e0b=_0x6b2dd0;_0x2b250e=0xc8;}else{_0x2b250e=0xce;}_0x41de7d[_0x3c6e('0x1a')](_0x2b250e);return _0x41de7d[_0x3c6e('0x20')]('Content-Range',_0x43ce7a+'-'+_0x172e0b+'/'+_0x6b2dd0)[_0x3c6e('0x21')](_0x189679);}return null;};}function patchUpdates(_0x10cf51){return function(_0x45aac4){try{jsonpatch[_0x3c6e('0x22')](_0x45aac4,_0x10cf51,!![]);}catch(_0x54f0b6){return BPromise[_0x3c6e('0x23')](_0x54f0b6);}return _0x45aac4[_0x3c6e('0x24')]();};}function saveUpdates(_0x44da3a,_0x139712){return function(_0x100cfb){if(_0x100cfb){return _0x100cfb[_0x3c6e('0x25')](_0x44da3a)[_0x3c6e('0x26')](function(_0x3d2a8a){return _0x3d2a8a;});}return null;};}function removeEntity(_0x48554d,_0x19992a){return function(_0x3d3fe6){if(_0x3d3fe6){return _0x3d3fe6['destroy']()[_0x3c6e('0x26')](function(){_0x48554d[_0x3c6e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32f0a6,_0x5e14e7){return function(_0x527925){if(!_0x527925){_0x32f0a6['sendStatus'](0x194);}return _0x527925;};}function handleError(_0x59189e,_0x3cac71){_0x3cac71=_0x3cac71||0x1f4;return function(_0xa74d83){logger[_0x3c6e('0x27')](_0xa74d83['stack']);if(_0xa74d83['name']){delete _0xa74d83[_0x3c6e('0x28')];}_0x59189e['status'](_0x3cac71)[_0x3c6e('0x29')](_0xa74d83);};}exports[_0x3c6e('0x2a')]=function(_0x3ddf8e,_0x2e7619){var _0x27106d={},_0x400c95={},_0x5abfe7={'count':0x0,'rows':[]};var _0x4a214a=_['map'](db[_0x3c6e('0x2b')][_0x3c6e('0x2c')],function(_0x2931fc){return{'name':_0x2931fc[_0x3c6e('0x2d')],'type':_0x2931fc[_0x3c6e('0x2e')]['key']};});_0x400c95[_0x3c6e('0x2f')]=_[_0x3c6e('0x30')](_0x4a214a,_0x3c6e('0x28'));_0x400c95[_0x3c6e('0x31')]=_[_0x3c6e('0x32')](_0x3ddf8e[_0x3c6e('0x31')]);_0x400c95[_0x3c6e('0x33')]=_[_0x3c6e('0x34')](_0x400c95[_0x3c6e('0x2f')],_0x400c95[_0x3c6e('0x31')]);_0x27106d[_0x3c6e('0x35')]=_[_0x3c6e('0x34')](_0x400c95[_0x3c6e('0x2f')],qs[_0x3c6e('0x36')](_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x36')]));_0x27106d[_0x3c6e('0x35')]=_0x27106d['attributes'][_0x3c6e('0x37')]?_0x27106d['attributes']:_0x400c95['model'];if(!_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x38')](_0x3c6e('0x39'))){_0x27106d['limit']=qs['limit'](_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x1e')]);_0x27106d[_0x3c6e('0x1c')]=qs[_0x3c6e('0x1c')](_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x1c')]);}_0x27106d[_0x3c6e('0x3a')]=qs['sort'](_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x3b')]);_0x27106d['where']=qs[_0x3c6e('0x33')](_[_0x3c6e('0x3c')](_0x3ddf8e[_0x3c6e('0x31')],_0x400c95['filters']),_0x4a214a);if(_0x3ddf8e['query'][_0x3c6e('0x3d')]){_0x27106d[_0x3c6e('0x3e')]=_[_0x3c6e('0x3f')](_0x27106d['where'],{'$or':_[_0x3c6e('0x30')](_0x4a214a,function(_0x56be5f){if(_0x56be5f[_0x3c6e('0x2e')]!==_0x3c6e('0x40')){var _0x459871={};_0x459871[_0x56be5f['name']]={'$like':'%'+_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x3d')]+'%'};return _0x459871;}})});}_0x27106d=_[_0x3c6e('0x3f')]({},_0x27106d,_0x3ddf8e['options']);var _0x4dc8d8={'where':_0x27106d['where']};return db['VoiceTransferReport'][_0x3c6e('0x1f')](_0x4dc8d8)[_0x3c6e('0x26')](function(_0x14c88e){_0x5abfe7[_0x3c6e('0x1f')]=_0x14c88e;if(_0x3ddf8e[_0x3c6e('0x31')][_0x3c6e('0x41')]){_0x27106d[_0x3c6e('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3c6e('0x43')](_0x27106d);})[_0x3c6e('0x26')](function(_0x4f7769){_0x5abfe7[_0x3c6e('0x44')]=_0x4f7769;return _0x5abfe7;})[_0x3c6e('0x26')](respondWithFilteredResult(_0x2e7619,_0x27106d))['catch'](handleError(_0x2e7619,null));};exports['show']=function(_0x1e28cf,_0x3e2895){var _0x48e558={'raw':!![],'where':{'id':_0x1e28cf[_0x3c6e('0x45')]['id']}},_0x4f3cf2={};_0x4f3cf2[_0x3c6e('0x2f')]=_[_0x3c6e('0x32')](db[_0x3c6e('0x2b')][_0x3c6e('0x2c')]);_0x4f3cf2[_0x3c6e('0x31')]=_['keys'](_0x1e28cf[_0x3c6e('0x31')]);_0x4f3cf2[_0x3c6e('0x33')]=_[_0x3c6e('0x34')](_0x4f3cf2[_0x3c6e('0x2f')],_0x4f3cf2['query']);_0x48e558['attributes']=_[_0x3c6e('0x34')](_0x4f3cf2[_0x3c6e('0x2f')],qs[_0x3c6e('0x36')](_0x1e28cf[_0x3c6e('0x31')]['fields']));_0x48e558[_0x3c6e('0x35')]=_0x48e558[_0x3c6e('0x35')][_0x3c6e('0x37')]?_0x48e558[_0x3c6e('0x35')]:_0x4f3cf2[_0x3c6e('0x2f')];if(_0x1e28cf[_0x3c6e('0x31')][_0x3c6e('0x41')]){_0x48e558[_0x3c6e('0x42')]=[{'all':!![]}];}_0x48e558=_[_0x3c6e('0x3f')]({},_0x48e558,_0x1e28cf[_0x3c6e('0x46')]);return db[_0x3c6e('0x2b')]['find'](_0x48e558)[_0x3c6e('0x26')](handleEntityNotFound(_0x3e2895,null))['then'](respondWithResult(_0x3e2895,null))[_0x3c6e('0x47')](handleError(_0x3e2895,null));};exports['create']=function(_0x372102,_0x2fc3fb){return db[_0x3c6e('0x2b')][_0x3c6e('0x48')](_0x372102[_0x3c6e('0x49')],{})[_0x3c6e('0x26')](respondWithResult(_0x2fc3fb,0xc9))['catch'](handleError(_0x2fc3fb,null));};exports['update']=function(_0x2dfb43,_0x4e1b1a){if(_0x2dfb43[_0x3c6e('0x49')]['id']){delete _0x2dfb43['body']['id'];}return db[_0x3c6e('0x2b')][_0x3c6e('0x4a')]({'where':{'id':_0x2dfb43[_0x3c6e('0x45')]['id']}})[_0x3c6e('0x26')](handleEntityNotFound(_0x4e1b1a,null))[_0x3c6e('0x26')](saveUpdates(_0x2dfb43[_0x3c6e('0x49')],null))['then'](respondWithResult(_0x4e1b1a,null))[_0x3c6e('0x47')](handleError(_0x4e1b1a,null));};exports['destroy']=function(_0x5185fb,_0x18a2bd){return db[_0x3c6e('0x2b')]['find']({'where':{'id':_0x5185fb[_0x3c6e('0x45')]['id']}})[_0x3c6e('0x26')](handleEntityNotFound(_0x18a2bd,null))[_0x3c6e('0x26')](removeEntity(_0x18a2bd,null))[_0x3c6e('0x47')](handleError(_0x18a2bd,null));};exports[_0x3c6e('0x4b')]=function(_0x32cdc3,_0xa7ca79){return db[_0x3c6e('0x2b')][_0x3c6e('0x4b')]()[_0x3c6e('0x26')](respondWithResult(_0xa7ca79,null))['catch'](handleError(_0xa7ca79,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a93d4ab..477106b 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 _0x426e=['VoiceTransferReport','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceTransferReport.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x426e,0x1c4));var _0xe426=function(_0x236607,_0x37f8e9){_0x236607=_0x236607-0x0;var _0x1a4b1e=_0x426e[_0x236607];return _0x1a4b1e;};'use strict';var _=require(_0xe426('0x0'));var util=require(_0xe426('0x1'));var logger=require(_0xe426('0x2'))('api');var moment=require(_0xe426('0x3'));var BPromise=require(_0xe426('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe426('0x5'));var rimraf=require(_0xe426('0x6'));var config=require('../../config/environment');var attributes=require(_0xe426('0x7'));module[_0xe426('0x8')]=function(_0x32f417,_0x17e6e2){return _0x32f417[_0xe426('0x9')](_0xe426('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe679=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0xe679,0x198));var _0x9e67=function(_0x52d1a8,_0x310d9b){_0x52d1a8=_0x52d1a8-0x0;var _0x3d662e=_0xe679[_0x52d1a8];return _0x3d662e;};'use strict';var _=require(_0x9e67('0x0'));var util=require('util');var logger=require(_0x9e67('0x1'))(_0x9e67('0x2'));var moment=require(_0x9e67('0x3'));var BPromise=require(_0x9e67('0x4'));var rp=require(_0x9e67('0x5'));var fs=require('fs');var path=require(_0x9e67('0x6'));var rimraf=require(_0x9e67('0x7'));var config=require(_0x9e67('0x8'));var attributes=require(_0x9e67('0x9'));module[_0x9e67('0xa')]=function(_0x2a42fa,_0x4d7648){return _0x2a42fa['define'](_0x9e67('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 b64f46f..c95f1c4 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 _0x68d3=['message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x68d3,0xb7));var _0x368d=function(_0xd63ab7,_0xb5bb72){_0xd63ab7=_0xd63ab7-0x0;var _0x1bad90=_0x68d3[_0xd63ab7];return _0x1bad90;};'use strict';var _=require(_0x368d('0x0'));var util=require(_0x368d('0x1'));var moment=require(_0x368d('0x2'));var BPromise=require(_0x368d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x368d('0x4'));var db=require(_0x368d('0x5'))['db'];var utils=require(_0x368d('0x6'));var logger=require(_0x368d('0x7'))(_0x368d('0x8'));var config=require(_0x368d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x368d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29046e,_0x24da9d,_0x5c4930){return new BPromise(function(_0x3e9f2b,_0x19d57d){return client[_0x368d('0xb')](_0x29046e,_0x5c4930)[_0x368d('0xc')](function(_0xbcc3a1){logger[_0x368d('0xd')](_0x368d('0xe'),_0x24da9d,'request\x20sent');logger[_0x368d('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x24da9d,_0x368d('0x10'),JSON[_0x368d('0x11')](_0xbcc3a1));if(_0xbcc3a1['error']){if(_0xbcc3a1[_0x368d('0x12')][_0x368d('0x13')]===0x1f4){logger[_0x368d('0x12')](_0x368d('0xe'),_0x24da9d,_0xbcc3a1[_0x368d('0x12')][_0x368d('0x14')]);return _0x19d57d(_0xbcc3a1[_0x368d('0x12')][_0x368d('0x14')]);}logger[_0x368d('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x24da9d,_0xbcc3a1[_0x368d('0x12')][_0x368d('0x14')]);return _0x3e9f2b(_0xbcc3a1[_0x368d('0x12')][_0x368d('0x14')]);}else{logger[_0x368d('0xd')](_0x368d('0xe'),_0x24da9d,'request\x20sent');_0x3e9f2b(_0xbcc3a1[_0x368d('0x15')][_0x368d('0x14')]);}})[_0x368d('0x16')](function(_0xc33912){logger['error'](_0x368d('0xe'),_0x24da9d,_0xc33912);_0x19d57d(_0xc33912);});});}exports['CreateVoiceTransferReport']=function(_0x5812c6){var _0x5d591e=this;return new Promise(function(_0x436507,_0x17ecc6){return db[_0x368d('0x17')][_0x368d('0x18')](_0x5812c6[_0x368d('0x19')],{'raw':_0x5812c6['options']?_0x5812c6[_0x368d('0x1a')][_0x368d('0x1b')]===undefined?!![]:![]:!![]})[_0x368d('0xc')](function(_0x296de5){logger['info']('CreateVoiceTransferReport',_0x5812c6);logger[_0x368d('0xf')](_0x368d('0x1c'),_0x5812c6,JSON[_0x368d('0x11')](_0x296de5));_0x436507(_0x296de5);})['catch'](function(_0x372198){logger[_0x368d('0x12')]('CreateVoiceTransferReport',_0x372198[_0x368d('0x14')],_0x5812c6);_0x17ecc6(_0x5d591e['error'](0x1f4,_0x372198[_0x368d('0x14')]));});});}; \ No newline at end of file +var _0x14f7=['code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x35dcb4,_0x8c1349){var _0x1f4969=function(_0x3feafe){while(--_0x3feafe){_0x35dcb4['push'](_0x35dcb4['shift']());}};_0x1f4969(++_0x8c1349);}(_0x14f7,0x13d));var _0x714f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x14f7[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x714f('0x0'));var util=require(_0x714f('0x1'));var moment=require(_0x714f('0x2'));var BPromise=require(_0x714f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x714f('0x4'))['db'];var utils=require(_0x714f('0x5'));var logger=require(_0x714f('0x6'))(_0x714f('0x7'));var config=require(_0x714f('0x8'));var jayson=require(_0x714f('0x9'));var client=jayson['client'][_0x714f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ac487,_0x36cec9,_0x3001d9){return new BPromise(function(_0x4f5943,_0xaab10d){return client[_0x714f('0xb')](_0x3ac487,_0x3001d9)['then'](function(_0x595011){logger[_0x714f('0xc')](_0x714f('0xd'),_0x36cec9,_0x714f('0xe'));logger[_0x714f('0xf')](_0x714f('0x10'),_0x36cec9,_0x714f('0xe'),JSON[_0x714f('0x11')](_0x595011));if(_0x595011[_0x714f('0x12')]){if(_0x595011['error'][_0x714f('0x13')]===0x1f4){logger[_0x714f('0x12')](_0x714f('0xd'),_0x36cec9,_0x595011[_0x714f('0x12')][_0x714f('0x14')]);return _0xaab10d(_0x595011['error'][_0x714f('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x36cec9,_0x595011[_0x714f('0x12')][_0x714f('0x14')]);return _0x4f5943(_0x595011[_0x714f('0x12')][_0x714f('0x14')]);}else{logger[_0x714f('0xc')](_0x714f('0xd'),_0x36cec9,_0x714f('0xe'));_0x4f5943(_0x595011['result'][_0x714f('0x14')]);}})[_0x714f('0x15')](function(_0x359d98){logger[_0x714f('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x36cec9,_0x359d98);_0xaab10d(_0x359d98);});});}exports[_0x714f('0x16')]=function(_0x57d3d7){var _0x17e87d=this;return new Promise(function(_0x3baecd,_0x47dce5){return db[_0x714f('0x17')][_0x714f('0x18')](_0x57d3d7['body'],{'raw':_0x57d3d7[_0x714f('0x19')]?_0x57d3d7['options'][_0x714f('0x1a')]===undefined?!![]:![]:!![]})[_0x714f('0x1b')](function(_0x1b325c){logger[_0x714f('0xc')](_0x714f('0x16'),_0x57d3d7);logger[_0x714f('0xf')](_0x714f('0x16'),_0x57d3d7,JSON[_0x714f('0x11')](_0x1b325c));_0x3baecd(_0x1b325c);})[_0x714f('0x15')](function(_0x262176){logger['error'](_0x714f('0x16'),_0x262176[_0x714f('0x14')],_0x57d3d7);_0x47dce5(_0x17e87d['error'](0x1f4,_0x262176[_0x714f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 42e8b08..afcef9f 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0xdace,0xc5));var _0xedac=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xdace[_0x37e845];return _0x59e55b;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x325994,_0x1e0bc6){var _0x4b5161=function(_0x2b0a5d){while(--_0x2b0a5d){_0x325994['push'](_0x325994['shift']());}};_0x4b5161(++_0x1e0bc6);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3512c3,_0x346843){_0x3512c3=_0x3512c3-0x0;var _0x3b2842=_0x6f0d[_0x3512c3];return _0x3b2842;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 45d7e77..9b2901a 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 _0xf109=['message','result','catch','then','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','emit','log','error','name','send','status','NotFound','request'];(function(_0x52331c,_0x257aab){var _0xd1e80e=function(_0x249efb){while(--_0x249efb){_0x52331c['push'](_0x52331c['shift']());}};_0xd1e80e(++_0x257aab);}(_0xf109,0xce));var _0x9f10=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xf109[_0x42bdad];return _0x122626;};'use strict';var path=require(_0x9f10('0x0'));var fs=require('fs');var _=require(_0x9f10('0x1'));var db=require(_0x9f10('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x9f10('0x3'));var amiClient=jayson[_0x9f10('0x4')][_0x9f10('0x5')]({'port':0x232a});var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var Redis=require(_0x9f10('0x8'));config[_0x9f10('0x9')]=_[_0x9f10('0xa')](config[_0x9f10('0x9')],{'host':_0x9f10('0xb'),'port':0x18eb});var io=require(_0x9f10('0xc'))(new Redis(config['redis']));var Schema=require(_0x9f10('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'callNumber':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9f10('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]},'sessionId':{'type':_0x9f10('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x12')]},'transferNumber':{'type':_0x9f10('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x11154b,_0x5ae255,_0x14d3fe){logger[_0x9f10('0x13')](_0x11154b,_0x5ae255,JSON['stringify'](_0x14d3fe));io['to'](_0x11154b)[_0x9f10('0x14')](_0x5ae255,_0x14d3fe);}function handleError(_0xd2950c){return function(_0x509fba){console[_0x9f10('0x15')]('handleError:',_0x509fba,_0x509fba instanceof RangeError);logger[_0x9f10('0x16')](_0x509fba['stack']);if(_0x509fba instanceof RangeError){if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba['name'];}_0xd2950c['status'](0x194)[_0x9f10('0x18')](_0x509fba);}else{if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba[_0x9f10('0x17')];}_0xd2950c[_0x9f10('0x19')](0x1f4)[_0x9f10('0x18')](_0x509fba);}};}function checkError(){return function(_0x332575){if(!_0x332575){throw new RangeError(_0x9f10('0x1a'));}return _0x332575;};}function respondWithRpcPromise(_0x4cdc00,_0x366044){return new BPromise(function(_0x58e6ba,_0x293990){var _0x36ace4=amiClient;return _0x36ace4[_0x9f10('0x1b')](_0x4cdc00,_0x366044)['then'](function(_0x2f31fb){if(_0x2f31fb[_0x9f10('0x16')]){if(_0x2f31fb[_0x9f10('0x16')]['code']===0x1f4){return _0x293990(_0x2f31fb[_0x9f10('0x16')][_0x9f10('0x1c')]);}return _0x58e6ba(_0x2f31fb[_0x9f10('0x16')]['message']);}else{_0x58e6ba(_0x2f31fb[_0x9f10('0x1d')]);}})[_0x9f10('0x1e')](function(_0x11cae7){_0x293990(_0x11cae7);});});}function getAgent(_0x1647c0){return db['User']['findOne']({'where':{'id':_0x1647c0,'role':'agent'}})[_0x9f10('0x1f')](checkError());}function getAgentCheckSession(_0x4a0407,_0x314794){return new BPromise(function(_0x1de75a,_0x45fffc){var _0x2ed95b=respondWithRpcPromise(_0x9f10('0x20'));var _0x4f6b0c=getAgent(_0x4a0407);Promise[_0x9f10('0x21')]([_0x2ed95b,_0x4f6b0c])[_0x9f10('0x1f')](function(_0x40f96b){var _0xfbb37f=_0x40f96b[0x0];var _0x181aec=_0x40f96b[0x1];var _0x2c4373=_['filter'](_0xfbb37f[_0x9f10('0x22')],function(_0x501ee){return _0x501ee[_0x9f10('0x23')]==_0x181aec['id']&&_0x501ee[_0x9f10('0x24')]==_0x314794;});if(_0x2c4373['length']==0x1){_0x1de75a(_0x181aec);}else{_0x45fffc(new RangeError(_0x9f10('0x25')+_0x314794+_0x9f10('0x26')));}});});}exports[_0x9f10('0x27')]=function(_0x5dd404,_0x434128){logger['info'](_0x9f10('0x28'),_0x5dd404[_0x9f10('0x29')]);var _0x13532b=originateValidation['validate'](_0x5dd404[_0x9f10('0x29')]);if(_0x13532b[_0x9f10('0x2a')]>0x0){return _0x434128[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x13532b);}var _0x148a5b=_0x5dd404['body'][_0x9f10('0x2c')];var _0x4b54b7=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2d')];var _0x1990da=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2e')];var _0x12c486=_0x5dd404['body'][_0x9f10('0x2f')];return getAgent(_0x148a5b)[_0x9f10('0x1f')](function(_0x1b8018){logger['info'](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x1b8018['name']),_0x9f10('0x32'),{'callNumber':_0x4b54b7,'callerId':_0x1990da,'callbackUrl':_0x12c486});return _0x434128[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x33')});})[_0x9f10('0x1e')](handleError(_0x434128));};exports[_0x9f10('0x34')]=function(_0x12036c,_0x1db955){logger['info'](_0x9f10('0x35'),_0x12036c[_0x9f10('0x29')]);var _0x2fa4bf=hangupValidation['validate'](_0x12036c[_0x9f10('0x29')]);if(_0x2fa4bf[_0x9f10('0x2a')]>0x0){return _0x1db955['status'](0x190)[_0x9f10('0x2b')](_0x2fa4bf);}var _0x26f0ba=_0x12036c[_0x9f10('0x29')]['userId'];var _0x5c516c=_0x12036c[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x26f0ba)[_0x9f10('0x1f')](function(_0x433e70){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x433e70[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x433e70[_0x9f10('0x17')]),_0x9f10('0x37'),{'sessionId':_0x5c516c});return _0x1db955[_0x9f10('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x1db955));};exports[_0x9f10('0x38')]=function(_0x5c8c44,_0x420027){logger[_0x9f10('0x13')](_0x9f10('0x39'),_0x5c8c44['body']);var _0x3cfce6=answerValidation[_0x9f10('0xd')](_0x5c8c44[_0x9f10('0x29')]);if(_0x3cfce6[_0x9f10('0x2a')]>0x0){return _0x420027[_0x9f10('0x19')](0x190)['json'](_0x3cfce6);}var _0x578368=_0x5c8c44['body'][_0x9f10('0x2c')];var _0x5d08fb=_0x5c8c44[_0x9f10('0x29')]['sessionId'];return getAgent(_0x578368)[_0x9f10('0x1f')](function(_0x3e8d3c){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x3e8d3c['name']);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x3e8d3c['name']),_0x9f10('0x3a'),{'sessionId':_0x5d08fb});return _0x420027[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3b')});})[_0x9f10('0x1e')](handleError(_0x420027));};exports[_0x9f10('0x3c')]=function(_0x4bedbe,_0x281da4){logger[_0x9f10('0x13')](_0x9f10('0x3d'),_0x4bedbe['body']);var _0x181eab=holdValidation[_0x9f10('0xd')](_0x4bedbe['body']);if(_0x181eab[_0x9f10('0x2a')]>0x0){return _0x281da4[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x181eab);}var _0x1807b3=_0x4bedbe['body'][_0x9f10('0x2c')];var _0x2ae710=_0x4bedbe[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x1807b3)[_0x9f10('0x1f')](function(_0x43cb31){logger['info'](_0x9f10('0x30'),_0x43cb31[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x43cb31[_0x9f10('0x17')]),_0x9f10('0x3e'),{'sessionId':_0x2ae710});return _0x281da4['status'](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3f')});})[_0x9f10('0x1e')](handleError(_0x281da4));};exports[_0x9f10('0x40')]=function(_0x39dae3,_0x15d676){logger[_0x9f10('0x13')](_0x9f10('0x41'),_0x39dae3['body']);var _0xd1da11=unholdValidation['validate'](_0x39dae3[_0x9f10('0x29')]);if(_0xd1da11['length']>0x0){return _0x15d676[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0xd1da11);}var _0x30fad9=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x497260=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x30fad9)[_0x9f10('0x1f')](function(_0x3818dc){logger['info']('entityFound:',_0x3818dc[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')]('user:%s',_0x3818dc['name']),_0x9f10('0x42'),{'sessionId':_0x497260});return _0x15d676[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'unhold\x20executed!'});})[_0x9f10('0x1e')](handleError(_0x15d676));};exports[_0x9f10('0x43')]=function(_0x7611e8,_0x4c3d18){logger[_0x9f10('0x13')](_0x9f10('0x44'),_0x4c3d18[_0x9f10('0x29')]);var _0x48a76e=callsValidation[_0x9f10('0xd')](_0x7611e8[_0x9f10('0x29')]);if(_0x48a76e['length']>0x0){return _0x4c3d18[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x48a76e);}var _0xcd8ae7=_0x7611e8[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x55cb99=respondWithRpcPromise(_0x9f10('0x20'));var _0x53c384=getAgent(_0xcd8ae7);return Promise['all']([_0x55cb99,_0x53c384])[_0x9f10('0x1f')](function(_0x19b489){var _0x1f109a=_0x19b489[0x0];var _0x277a86=_0x19b489[0x1];var _0x2ed385=_[_0x9f10('0x45')](_0x1f109a[_0x9f10('0x22')],function(_0x4ef6c3){return _0x4ef6c3['UserId']==_0x277a86['id'];});return _0x4c3d18[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'count':_0x2ed385[_0x9f10('0x2a')],'rows':_0x2ed385});})[_0x9f10('0x1e')](handleError(_0x4c3d18));};exports[_0x9f10('0x46')]=function(_0x2094c9,_0x35460a){logger['info'](_0x9f10('0x47'),_0x2094c9[_0x9f10('0x29')]);var _0x5a777a=conferenceValidation[_0x9f10('0xd')](_0x2094c9[_0x9f10('0x29')]);if(_0x5a777a['length']>0x0){return _0x35460a[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x5a777a);}var _0x58b3b4=_0x2094c9[_0x9f10('0x29')]['userId'];return getAgent(_0x58b3b4)[_0x9f10('0x1f')](function(_0x2325aa){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2325aa[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x2325aa[_0x9f10('0x17')]),_0x9f10('0x48'));return _0x35460a['status'](0xc8)['json']({'error':![],'message':_0x9f10('0x49')});})[_0x9f10('0x1e')](handleError(_0x35460a));};exports[_0x9f10('0x4a')]=function(_0x20045f,_0xd627a2){logger[_0x9f10('0x13')](_0x9f10('0x4b'),_0x20045f['body']);var _0x3635f9=transferValidation[_0x9f10('0xd')](_0x20045f['body']);if(_0x3635f9[_0x9f10('0x2a')]>0x0){return _0xd627a2['status'](0x190)[_0x9f10('0x2b')](_0x3635f9);}var _0x354220=_0x20045f['body'][_0x9f10('0x2c')];var _0x4cbe80=_0x20045f[_0x9f10('0x29')][_0x9f10('0x24')];var _0x163165=_0x20045f['body'][_0x9f10('0x4c')];return getAgent(_0x354220)['then'](function(_0x2d704b){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2d704b['name']);emit(util[_0x9f10('0x36')]('user:%s',_0x2d704b['name']),_0x9f10('0x4d'),{'sessionId':_0x4cbe80,'transferNumber':_0x163165});return _0xd627a2[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x9f10('0x1e')](handleError(_0xd627a2));}; \ No newline at end of file +var _0x2bc6=['path','lodash','../../mysqldb','client','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','status','send','name','NotFound','request','then','code','message','catch','User','findOne','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','callerId','format','user:%s','json','originate\x20executed!','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','all','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x2bc6,0x163));var _0x62bc=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x2bc6[_0x32729c];return _0x482cfd;};'use strict';var path=require(_0x62bc('0x0'));var fs=require('fs');var _=require(_0x62bc('0x1'));var db=require(_0x62bc('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x62bc('0x3')]['http']({'port':0x232a});var logger=require(_0x62bc('0x4'))(_0x62bc('0x5'));var Redis=require('ioredis');config[_0x62bc('0x6')]=_[_0x62bc('0x7')](config[_0x62bc('0x6')],{'host':_0x62bc('0x8'),'port':0x18eb});var io=require(_0x62bc('0x9'))(new Redis(config[_0x62bc('0x6')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]},'callNumber':{'type':_0x62bc('0xc'),'required':[!![],_0x62bc('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x62bc('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]},'sessionId':{'type':_0x62bc('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]},'sessionId':{'type':_0x62bc('0xc'),'required':[!![],_0x62bc('0xe')]},'transferNumber':{'type':'string','required':[!![],_0x62bc('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x62bc('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x62bc('0xa'),'required':[!![],_0x62bc('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x39c5e0,_0x2d6820,_0x5bb569){logger[_0x62bc('0x10')](_0x39c5e0,_0x2d6820,JSON[_0x62bc('0x11')](_0x5bb569));io['to'](_0x39c5e0)[_0x62bc('0x12')](_0x2d6820,_0x5bb569);}function handleError(_0x1e2405){return function(_0xc95407){console[_0x62bc('0x13')](_0x62bc('0x14'),_0xc95407,_0xc95407 instanceof RangeError);logger[_0x62bc('0x15')](_0xc95407[_0x62bc('0x16')]);if(_0xc95407 instanceof RangeError){if(_0xc95407['name']){delete _0xc95407['name'];}_0x1e2405[_0x62bc('0x17')](0x194)[_0x62bc('0x18')](_0xc95407);}else{if(_0xc95407[_0x62bc('0x19')]){delete _0xc95407['name'];}_0x1e2405[_0x62bc('0x17')](0x1f4)['send'](_0xc95407);}};}function checkError(){return function(_0x30e7d9){if(!_0x30e7d9){throw new RangeError(_0x62bc('0x1a'));}return _0x30e7d9;};}function respondWithRpcPromise(_0x1b6689,_0x5e2e9b){return new BPromise(function(_0x3b8644,_0x28757d){var _0xae87bf=amiClient;return _0xae87bf[_0x62bc('0x1b')](_0x1b6689,_0x5e2e9b)[_0x62bc('0x1c')](function(_0x3b2eb0){if(_0x3b2eb0['error']){if(_0x3b2eb0[_0x62bc('0x15')][_0x62bc('0x1d')]===0x1f4){return _0x28757d(_0x3b2eb0[_0x62bc('0x15')][_0x62bc('0x1e')]);}return _0x3b8644(_0x3b2eb0[_0x62bc('0x15')]['message']);}else{_0x3b8644(_0x3b2eb0['result']);}})[_0x62bc('0x1f')](function(_0x58e76a){_0x28757d(_0x58e76a);});});}function getAgent(_0x32e749){return db[_0x62bc('0x20')][_0x62bc('0x21')]({'where':{'id':_0x32e749,'role':'agent'}})[_0x62bc('0x1c')](checkError());}function getAgentCheckSession(_0x19e689,_0x32e03c){return new BPromise(function(_0x5c03ac,_0x5b26ce){var _0x641626=respondWithRpcPromise(_0x62bc('0x22'));var _0x23817c=getAgent(_0x19e689);Promise['all']([_0x641626,_0x23817c])[_0x62bc('0x1c')](function(_0x1f2985){var _0x44600f=_0x1f2985[0x0];var _0x444267=_0x1f2985[0x1];var _0x5a9302=_[_0x62bc('0x23')](_0x44600f['rows'],function(_0x26701b){return _0x26701b[_0x62bc('0x24')]==_0x444267['id']&&_0x26701b[_0x62bc('0x25')]==_0x32e03c;});if(_0x5a9302[_0x62bc('0x26')]==0x1){_0x5c03ac(_0x444267);}else{_0x5b26ce(new RangeError(_0x62bc('0x27')+_0x32e03c+_0x62bc('0x28')));}});});}exports[_0x62bc('0x29')]=function(_0x12d443,_0x406063){logger[_0x62bc('0x10')](_0x62bc('0x2a'),_0x12d443[_0x62bc('0x2b')]);var _0x1668ab=originateValidation[_0x62bc('0x2c')](_0x12d443[_0x62bc('0x2b')]);if(_0x1668ab[_0x62bc('0x26')]>0x0){return _0x406063[_0x62bc('0x17')](0x190)['json'](_0x1668ab);}var _0x32e3a9=_0x12d443['body']['userId'];var _0x2823ef=_0x12d443['body']['callNumber'];var _0x512dac=_0x12d443[_0x62bc('0x2b')][_0x62bc('0x2d')];var _0x26e043=_0x12d443['body']['callbackUrl'];return getAgent(_0x32e3a9)['then'](function(_0x3c938d){logger[_0x62bc('0x10')]('entityFound:',_0x3c938d['name']);emit(util[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x19')]),'webbar:originate',{'callNumber':_0x2823ef,'callerId':_0x512dac,'callbackUrl':_0x26e043});return _0x406063[_0x62bc('0x17')](0xc8)[_0x62bc('0x30')]({'error':![],'message':_0x62bc('0x31')});})[_0x62bc('0x1f')](handleError(_0x406063));};exports['hangup']=function(_0x42a777,_0x2caa71){logger['info'](_0x62bc('0x32'),_0x42a777[_0x62bc('0x2b')]);var _0x24dbbe=hangupValidation[_0x62bc('0x2c')](_0x42a777['body']);if(_0x24dbbe[_0x62bc('0x26')]>0x0){return _0x2caa71['status'](0x190)[_0x62bc('0x30')](_0x24dbbe);}var _0x19a6e2=_0x42a777[_0x62bc('0x2b')][_0x62bc('0x33')];var _0x5c0d67=_0x42a777[_0x62bc('0x2b')][_0x62bc('0x25')];return getAgent(_0x19a6e2)[_0x62bc('0x1c')](function(_0x176b1f){logger[_0x62bc('0x10')](_0x62bc('0x34'),_0x176b1f[_0x62bc('0x19')]);emit(util[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x176b1f[_0x62bc('0x19')]),_0x62bc('0x35'),{'sessionId':_0x5c0d67});return _0x2caa71['status'](0xc8)['json']({'error':![],'message':_0x62bc('0x36')});})[_0x62bc('0x1f')](handleError(_0x2caa71));};exports['answer']=function(_0x1cf503,_0x366505){logger[_0x62bc('0x10')](_0x62bc('0x37'),_0x1cf503[_0x62bc('0x2b')]);var _0x5f3752=answerValidation[_0x62bc('0x2c')](_0x1cf503[_0x62bc('0x2b')]);if(_0x5f3752['length']>0x0){return _0x366505['status'](0x190)[_0x62bc('0x30')](_0x5f3752);}var _0xdbd9ee=_0x1cf503[_0x62bc('0x2b')]['userId'];var _0x185423=_0x1cf503[_0x62bc('0x2b')][_0x62bc('0x25')];return getAgent(_0xdbd9ee)[_0x62bc('0x1c')](function(_0x467d22){logger[_0x62bc('0x10')]('entityFound:',_0x467d22[_0x62bc('0x19')]);emit(util['format'](_0x62bc('0x2f'),_0x467d22[_0x62bc('0x19')]),_0x62bc('0x38'),{'sessionId':_0x185423});return _0x366505['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x62bc('0x1f')](handleError(_0x366505));};exports['hold']=function(_0x10ea2e,_0x10ffa0){logger['info']('hold\x20fired:',_0x10ea2e['body']);var _0x4ce5fa=holdValidation[_0x62bc('0x2c')](_0x10ea2e[_0x62bc('0x2b')]);if(_0x4ce5fa[_0x62bc('0x26')]>0x0){return _0x10ffa0[_0x62bc('0x17')](0x190)['json'](_0x4ce5fa);}var _0x3834b2=_0x10ea2e[_0x62bc('0x2b')]['userId'];var _0x1c0026=_0x10ea2e['body'][_0x62bc('0x25')];return getAgent(_0x3834b2)[_0x62bc('0x1c')](function(_0x17e0ec){logger[_0x62bc('0x10')](_0x62bc('0x34'),_0x17e0ec[_0x62bc('0x19')]);emit(util[_0x62bc('0x2e')]('user:%s',_0x17e0ec[_0x62bc('0x19')]),_0x62bc('0x39'),{'sessionId':_0x1c0026});return _0x10ffa0['status'](0xc8)[_0x62bc('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0x62bc('0x1f')](handleError(_0x10ffa0));};exports[_0x62bc('0x3a')]=function(_0x4bec08,_0x6c2969){logger[_0x62bc('0x10')](_0x62bc('0x3b'),_0x4bec08['body']);var _0xed0bef=unholdValidation[_0x62bc('0x2c')](_0x4bec08[_0x62bc('0x2b')]);if(_0xed0bef[_0x62bc('0x26')]>0x0){return _0x6c2969[_0x62bc('0x17')](0x190)[_0x62bc('0x30')](_0xed0bef);}var _0xe9ea36=_0x4bec08[_0x62bc('0x2b')][_0x62bc('0x33')];var _0x1fb6d3=_0x4bec08[_0x62bc('0x2b')][_0x62bc('0x25')];return getAgent(_0xe9ea36)[_0x62bc('0x1c')](function(_0x3bb89a){logger[_0x62bc('0x10')](_0x62bc('0x34'),_0x3bb89a['name']);emit(util[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x3bb89a[_0x62bc('0x19')]),_0x62bc('0x3c'),{'sessionId':_0x1fb6d3});return _0x6c2969[_0x62bc('0x17')](0xc8)[_0x62bc('0x30')]({'error':![],'message':_0x62bc('0x3d')});})[_0x62bc('0x1f')](handleError(_0x6c2969));};exports[_0x62bc('0x3e')]=function(_0x4142dd,_0x2f2322){logger[_0x62bc('0x10')]('calls\x20fired:',_0x2f2322[_0x62bc('0x2b')]);var _0x50d761=callsValidation[_0x62bc('0x2c')](_0x4142dd[_0x62bc('0x2b')]);if(_0x50d761[_0x62bc('0x26')]>0x0){return _0x2f2322[_0x62bc('0x17')](0x190)[_0x62bc('0x30')](_0x50d761);}var _0xb6e13e=_0x4142dd[_0x62bc('0x2b')][_0x62bc('0x33')];var _0x4934ce=respondWithRpcPromise('VoiceChannels');var _0xd35ce2=getAgent(_0xb6e13e);return Promise[_0x62bc('0x3f')]([_0x4934ce,_0xd35ce2])[_0x62bc('0x1c')](function(_0x56bccf){var _0x221681=_0x56bccf[0x0];var _0x1325a4=_0x56bccf[0x1];var _0x14064d=_[_0x62bc('0x23')](_0x221681['rows'],function(_0x19e990){return _0x19e990[_0x62bc('0x24')]==_0x1325a4['id'];});return _0x2f2322[_0x62bc('0x17')](0xc8)[_0x62bc('0x30')]({'count':_0x14064d[_0x62bc('0x26')],'rows':_0x14064d});})[_0x62bc('0x1f')](handleError(_0x2f2322));};exports[_0x62bc('0x40')]=function(_0x4f196a,_0x32d424){logger[_0x62bc('0x10')](_0x62bc('0x41'),_0x4f196a['body']);var _0x4a56b7=conferenceValidation[_0x62bc('0x2c')](_0x4f196a[_0x62bc('0x2b')]);if(_0x4a56b7[_0x62bc('0x26')]>0x0){return _0x32d424['status'](0x190)[_0x62bc('0x30')](_0x4a56b7);}var _0x579c0c=_0x4f196a[_0x62bc('0x2b')][_0x62bc('0x33')];return getAgent(_0x579c0c)['then'](function(_0x3884b0){logger['info'](_0x62bc('0x34'),_0x3884b0['name']);emit(util[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x3884b0[_0x62bc('0x19')]),_0x62bc('0x42'));return _0x32d424[_0x62bc('0x17')](0xc8)[_0x62bc('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x62bc('0x1f')](handleError(_0x32d424));};exports[_0x62bc('0x43')]=function(_0x2e28e4,_0x4e5478){logger[_0x62bc('0x10')](_0x62bc('0x44'),_0x2e28e4[_0x62bc('0x2b')]);var _0x132509=transferValidation['validate'](_0x2e28e4[_0x62bc('0x2b')]);if(_0x132509[_0x62bc('0x26')]>0x0){return _0x4e5478[_0x62bc('0x17')](0x190)[_0x62bc('0x30')](_0x132509);}var _0x31d5f0=_0x2e28e4['body']['userId'];var _0x280f73=_0x2e28e4['body'][_0x62bc('0x25')];var _0x18779a=_0x2e28e4['body'][_0x62bc('0x45')];return getAgent(_0x31d5f0)['then'](function(_0x2a3599){logger['info'](_0x62bc('0x34'),_0x2a3599['name']);emit(util[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x2a3599[_0x62bc('0x19')]),'webbar:transfer',{'sessionId':_0x280f73,'transferNumber':_0x18779a});return _0x4e5478[_0x62bc('0x17')](0xc8)[_0x62bc('0x30')]({'error':![],'message':_0x62bc('0x46')});})[_0x62bc('0x1f')](handleError(_0x4e5478));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5b28295..7c41470 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 _0x7708=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','../../components/interaction/service'];(function(_0x23f692,_0x124c95){var _0x489af2=function(_0x13c2cd){while(--_0x13c2cd){_0x23f692['push'](_0x23f692['shift']());}};_0x489af2(++_0x124c95);}(_0x7708,0x188));var _0x8770=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7708[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./whatsappAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getAgents']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')]('/:id/dispositions',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xe'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x12')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller['addApplications']);router['post'](_0x8770('0x17'),controller[_0x8770('0x18')]);router[_0x8770('0x12')](_0x8770('0x19'),auth[_0x8770('0x8')](),controller['send']);router[_0x8770('0x1a')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router['delete']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router[_0x8770('0x1d')](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0xe'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router[_0x8770('0x1d')]('/:id/users',auth[_0x8770('0x8')](),controller['removeAgents']);module[_0x8770('0x20')]=router; \ No newline at end of file +var _0x8952=['getAgents','/:id/applications','create','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','getAnswers'];(function(_0x5ae046,_0x966d55){var _0x374e94=function(_0x51a5a6){while(--_0x51a5a6){_0x5ae046['push'](_0x5ae046['shift']());}};_0x374e94(++_0x966d55);}(_0x8952,0x17e));var _0x2895=function(_0x3ed85d,_0x16deb8){_0x3ed85d=_0x3ed85d-0x0;var _0x31c5c5=_0x8952[_0x3ed85d];return _0x31c5c5;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2895('0x5'));var interaction=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var controller=require('./whatsappAccount.controller');router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router['get']('/describe',auth[_0x2895('0x9')](),controller[_0x2895('0xb')]);router[_0x2895('0x8')](_0x2895('0xc'),auth[_0x2895('0x9')](),controller['show']);router[_0x2895('0x8')]('/:id/dispositions',auth[_0x2895('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router[_0x2895('0x8')]('/:id/users',auth[_0x2895('0x9')](),controller[_0x2895('0xe')]);router['get'](_0x2895('0xf'),auth[_0x2895('0x9')](),controller['getApplications']);router['post']('/',auth[_0x2895('0x9')](),controller[_0x2895('0x10')]);router['post'](_0x2895('0x11'),auth[_0x2895('0x9')](),controller[_0x2895('0x12')]);router[_0x2895('0x13')](_0x2895('0x14'),auth[_0x2895('0x9')](),controller[_0x2895('0x15')]);router[_0x2895('0x13')](_0x2895('0x16'),auth[_0x2895('0x9')](),controller[_0x2895('0x17')]);router[_0x2895('0x13')](_0x2895('0xf'),auth[_0x2895('0x9')](),controller[_0x2895('0x18')]);router[_0x2895('0x13')](_0x2895('0x19'),controller[_0x2895('0x1a')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x2895('0x1b')]);router[_0x2895('0x1c')](_0x2895('0xc'),auth['isAuthenticated'](),controller[_0x2895('0x1d')]);router[_0x2895('0x1e')](_0x2895('0xc'),auth[_0x2895('0x9')](),controller[_0x2895('0x1f')]);router['delete'](_0x2895('0x11'),auth[_0x2895('0x9')](),controller['removeDispositions']);router[_0x2895('0x1e')](_0x2895('0x14'),auth[_0x2895('0x9')](),controller['removeAnswers']);router['delete'](_0x2895('0x16'),auth[_0x2895('0x9')](),controller[_0x2895('0x20')]);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 6df8176..63172b3 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 _0xbc2b=['name','STRING','generate','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x3cdb07,_0x42111e){var _0x1b182a=function(_0x4bc8b1){while(--_0x4bc8b1){_0x3cdb07['push'](_0x3cdb07['shift']());}};_0x1b182a(++_0x42111e);}(_0xbc2b,0x15d));var _0xbbc2=function(_0x125a14,_0x13bf6c){_0x125a14=_0x125a14-0x0;var _0x81418e=_0xbc2b[_0x125a14];return _0x81418e;};'use strict';var Sequelize=require(_0xbbc2('0x0'));var rs=require(_0xbbc2('0x1'));module[_0xbbc2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xbbc2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xbbc2('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xbbc2('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xbbc2('0x4')],'defaultValue':function(){return rs[_0xbbc2('0x5')]();}},'phone':{'type':Sequelize[_0xbbc2('0x4')]},'type':{'type':Sequelize['ENUM'](_0xbbc2('0x6'),_0xbbc2('0x7'))},'accountSid':{'type':Sequelize[_0xbbc2('0x4')]},'baseUrl':{'type':Sequelize[_0xbbc2('0x4')]},'authToken':{'type':Sequelize[_0xbbc2('0x4')]},'notificationTemplate':{'type':Sequelize[_0xbbc2('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbbc2('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xbbc2('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbbc2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbbc2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbbc2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbbc2('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbbc2('0xa')],'comment':_0xbbc2('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xbbc2('0x9')],'defaultValue':![],'comment':_0xbbc2('0xc'),'set':function(_0xcd44fc){if(!_0xcd44fc){this[_0xbbc2('0xd')](_0xbbc2('0xe'),null);}this[_0xbbc2('0xd')](_0xbbc2('0xf'),_0xcd44fc);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7d0=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4d0b9e,_0x5c6260){var _0x2bba87=function(_0x49314a){while(--_0x49314a){_0x4d0b9e['push'](_0x4d0b9e['shift']());}};_0x2bba87(++_0x5c6260);}(_0xb7d0,0x1a9));var _0x0b7d=function(_0x156584,_0x211fde){_0x156584=_0x156584-0x0;var _0x3416b1=_0xb7d0[_0x156584];return _0x3416b1;};'use strict';var Sequelize=require(_0x0b7d('0x0'));var rs=require(_0x0b7d('0x1'));module[_0x0b7d('0x2')]={'name':{'type':Sequelize[_0x0b7d('0x3')],'unique':_0x0b7d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x0b7d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b7d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0b7d('0x3')],'defaultValue':function(){return rs[_0x0b7d('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0b7d('0x6')]('twilio',_0x0b7d('0x7'))},'accountSid':{'type':Sequelize[_0x0b7d('0x3')]},'baseUrl':{'type':Sequelize[_0x0b7d('0x3')]},'authToken':{'type':Sequelize[_0x0b7d('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0b7d('0x8');}},'notificationSound':{'type':Sequelize[_0x0b7d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b7d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b7d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b7d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b7d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b7d('0xa')],'comment':_0x0b7d('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d6cd3){if(!_0x2d6cd3){this[_0x0b7d('0xc')]('mandatoryDispositionPauseId',null);}this[_0x0b7d('0xc')](_0x0b7d('0xd'),_0x2d6cd3);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index af777a5..486c84a 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 _0xa7aa=['CmList','List','ListId','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','reject','save','update','WhatsappAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','WhatsappAccount','includeAll','include','findAll','show','params','Pause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rows','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','list','contact','WhatsappInteraction','interaction','get','autoclose','push','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','set','Content-Type','\x0a','to\x20is\x20mandatory'];(function(_0x78974d,_0x174bed){var _0x6b95c8=function(_0xbf265e){while(--_0xbf265e){_0x78974d['push'](_0x78974d['shift']());}};_0x6b95c8(++_0x174bed);}(_0xa7aa,0x1a2));var _0xaa7a=function(_0x46e523,_0x4faeca){_0x46e523=_0x46e523-0x0;var _0xf0b31b=_0xa7aa[_0x46e523];return _0xf0b31b;};'use strict';var emlformat=require(_0xaa7a('0x0'));var rimraf=require(_0xaa7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa7a('0x2'));var rp=require(_0xaa7a('0x3'));var moment=require(_0xaa7a('0x4'));var BPromise=require(_0xaa7a('0x5'));var Mustache=require(_0xaa7a('0x6'));var util=require(_0xaa7a('0x7'));var path=require(_0xaa7a('0x8'));var sox=require(_0xaa7a('0x9'));var csv=require(_0xaa7a('0xa'));var ejs=require(_0xaa7a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa7a('0xc'));var squel=require(_0xaa7a('0xd'));var crypto=require(_0xaa7a('0xe'));var jsforce=require(_0xaa7a('0xf'));var deskjs=require(_0xaa7a('0x10'));var toCsv=require(_0xaa7a('0xa'));var querystring=require(_0xaa7a('0x11'));var Papa=require(_0xaa7a('0x12'));var Redis=require('ioredis');var authService=require(_0xaa7a('0x13'));var qs=require(_0xaa7a('0x14'));var as=require(_0xaa7a('0x15'));var hardwareService=require(_0xaa7a('0x16'));var logger=require(_0xaa7a('0x17'))(_0xaa7a('0x18'));var utils=require(_0xaa7a('0x19'));var config=require(_0xaa7a('0x1a'));var licenseUtil=require(_0xaa7a('0x1b'));var db=require(_0xaa7a('0x1c'))['db'];config['redis']=_['defaults'](config[_0xaa7a('0x1d')],{'host':_0xaa7a('0x1e'),'port':0x18eb});var socket=require(_0xaa7a('0x1f'))(new Redis(config[_0xaa7a('0x1d')]));require(_0xaa7a('0x20'))[_0xaa7a('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xaa7a('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x19176e,_0x91170f,_0x4ef0fc,_0x24d60d){return new BPromise(function(_0x4bed46,_0x1f4af7){var _0x464ccb=_0x24d60d||client;return _0x464ccb[_0xaa7a('0x23')](_0x19176e,_0x4ef0fc)[_0xaa7a('0x24')](function(_0x242c10){logger[_0xaa7a('0x25')](_0xaa7a('0x26'),_0x91170f,_0xaa7a('0x27'));logger[_0xaa7a('0x28')](_0xaa7a('0x29'),_0x91170f,_0xaa7a('0x27'),JSON[_0xaa7a('0x2a')](_0x242c10));if(_0x242c10['error']){if(_0x242c10[_0xaa7a('0x2b')][_0xaa7a('0x2c')]===0x1f4){logger[_0xaa7a('0x2b')](_0xaa7a('0x26'),_0x91170f,_0x242c10['error'][_0xaa7a('0x2d')]);return _0x1f4af7(_0x242c10[_0xaa7a('0x2b')][_0xaa7a('0x2d')]);}logger[_0xaa7a('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x91170f,_0x242c10['error'][_0xaa7a('0x2d')]);return _0x4bed46(_0x242c10[_0xaa7a('0x2b')][_0xaa7a('0x2d')]);}else{logger[_0xaa7a('0x25')](_0xaa7a('0x26'),_0x91170f,_0xaa7a('0x27'));_0x4bed46(_0x242c10[_0xaa7a('0x2e')]['message']);}})[_0xaa7a('0x2f')](function(_0x5af7c3){logger[_0xaa7a('0x2b')](_0xaa7a('0x26'),_0x91170f,_0x5af7c3);_0x1f4af7(_0x5af7c3);});});}function respondWithStatusCode(_0x2845e7,_0x32682d){_0x32682d=_0x32682d||0xcc;return function(_0x304a93){if(_0x304a93){return _0x2845e7['sendStatus'](_0x32682d);}return _0x2845e7[_0xaa7a('0x30')](_0x32682d)['end']();};}function respondWithResult(_0x5c7634,_0x302815){_0x302815=_0x302815||0xc8;return function(_0x3f15c7){if(_0x3f15c7){return _0x5c7634[_0xaa7a('0x30')](_0x302815)[_0xaa7a('0x31')](_0x3f15c7);}};}function respondWithFilteredResult(_0x43c003,_0x4f60c4){return function(_0x4021a3){if(_0x4021a3){var _0x3f245a=typeof _0x4f60c4[_0xaa7a('0x32')]===_0xaa7a('0x33')&&typeof _0x4f60c4[_0xaa7a('0x34')]===_0xaa7a('0x33');var _0x2347db=_0x4021a3[_0xaa7a('0x35')];var _0x49156e=_0x3f245a?0x0:_0x4f60c4['offset'];var _0x11c6b7=_0x3f245a?_0x4021a3[_0xaa7a('0x35')]:_0x4f60c4['offset']+_0x4f60c4[_0xaa7a('0x34')];var _0x9e7f02;if(_0x11c6b7>=_0x2347db){_0x11c6b7=_0x2347db;_0x9e7f02=0xc8;}else{_0x9e7f02=0xce;}_0x43c003[_0xaa7a('0x30')](_0x9e7f02);return _0x43c003['set']('Content-Range',_0x49156e+'-'+_0x11c6b7+'/'+_0x2347db)['json'](_0x4021a3);}return null;};}function patchUpdates(_0x5906c1){return function(_0x520cfb){try{jsonpatch['apply'](_0x520cfb,_0x5906c1,!![]);}catch(_0x22d7ad){return BPromise[_0xaa7a('0x36')](_0x22d7ad);}return _0x520cfb[_0xaa7a('0x37')]();};}function saveUpdates(_0x1d7dcb,_0x4532b6){return function(_0x200758){if(_0x200758){return _0x200758[_0xaa7a('0x38')](_0x1d7dcb)[_0xaa7a('0x24')](function(_0x281b4b){return _0x281b4b;});}return null;};}function removeEntity(_0x221d92,_0x33b785){return function(_0xb1e445){if(_0xb1e445){return _0xb1e445['destroy']()[_0xaa7a('0x24')](function(){var _0x1123c1=_0xb1e445['get']({'plain':!![]});var _0x495ba5=_0xaa7a('0x39');return db[_0xaa7a('0x3a')][_0xaa7a('0x3b')]({'where':{'type':_0x495ba5,'resourceId':_0x1123c1['id']}})['then'](function(){return _0xb1e445;});})['then'](function(){_0x221d92[_0xaa7a('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12a125,_0x1e106e){return function(_0x4fba9c){if(!_0x4fba9c){_0x12a125[_0xaa7a('0x3c')](0x194);}return _0x4fba9c;};}function handleError(_0x11daa3,_0x5d282b){_0x5d282b=_0x5d282b||0x1f4;return function(_0x35e553){logger[_0xaa7a('0x2b')](_0x35e553[_0xaa7a('0x3d')]);if(_0x35e553[_0xaa7a('0x3e')]){delete _0x35e553[_0xaa7a('0x3e')];}_0x11daa3[_0xaa7a('0x30')](_0x5d282b)[_0xaa7a('0x3f')](_0x35e553);};}exports[_0xaa7a('0x40')]=function(_0x5aa66f,_0x50a202){var _0x33797e={'include':[{'model':db['Pause'],'as':_0xaa7a('0x41')}]},_0x56cac5={},_0x51d85f={'count':0x0,'rows':[]};var _0x577e10=_['map'](db['WhatsappAccount'][_0xaa7a('0x42')],function(_0x444d0a){return{'name':_0x444d0a[_0xaa7a('0x43')],'type':_0x444d0a[_0xaa7a('0x44')][_0xaa7a('0x45')]};});_0x56cac5['model']=_['map'](_0x577e10,_0xaa7a('0x3e'));_0x56cac5[_0xaa7a('0x46')]=_[_0xaa7a('0x47')](_0x5aa66f['query']);_0x56cac5[_0xaa7a('0x48')]=_['intersection'](_0x56cac5[_0xaa7a('0x49')],_0x56cac5['query']);_0x33797e[_0xaa7a('0x4a')]=_[_0xaa7a('0x4b')](_0x56cac5['model'],qs[_0xaa7a('0x4c')](_0x5aa66f[_0xaa7a('0x46')][_0xaa7a('0x4c')]));_0x33797e[_0xaa7a('0x4a')]=_0x33797e['attributes'][_0xaa7a('0x4d')]?_0x33797e[_0xaa7a('0x4a')]:_0x56cac5[_0xaa7a('0x49')];if(!_0x5aa66f['query'][_0xaa7a('0x4e')](_0xaa7a('0x4f'))){_0x33797e[_0xaa7a('0x34')]=qs[_0xaa7a('0x34')](_0x5aa66f['query']['limit']);_0x33797e['offset']=qs[_0xaa7a('0x32')](_0x5aa66f['query']['offset']);}_0x33797e[_0xaa7a('0x50')]=qs[_0xaa7a('0x51')](_0x5aa66f[_0xaa7a('0x46')]['sort']);_0x33797e[_0xaa7a('0x52')]=qs[_0xaa7a('0x48')](_[_0xaa7a('0x53')](_0x5aa66f[_0xaa7a('0x46')],_0x56cac5['filters']),_0x577e10);if(_0x5aa66f[_0xaa7a('0x46')]['filter']){_0x33797e[_0xaa7a('0x52')]=_['merge'](_0x33797e[_0xaa7a('0x52')],{'$or':_[_0xaa7a('0x54')](_0x577e10,function(_0x18446c){if(_0x18446c['type']!==_0xaa7a('0x55')){var _0x4e5cbf={};_0x4e5cbf[_0x18446c['name']]={'$like':'%'+_0x5aa66f['query'][_0xaa7a('0x56')]+'%'};return _0x4e5cbf;}})});}_0x33797e=_[_0xaa7a('0x57')]({},_0x33797e,_0x5aa66f[_0xaa7a('0x58')]);var _0x15e3ed={'where':_0x33797e[_0xaa7a('0x52')]};return db[_0xaa7a('0x59')][_0xaa7a('0x35')](_0x15e3ed)[_0xaa7a('0x24')](function(_0x122419){_0x51d85f[_0xaa7a('0x35')]=_0x122419;if(_0x5aa66f['query'][_0xaa7a('0x5a')]){_0x33797e[_0xaa7a('0x5b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xaa7a('0x5c')](_0x33797e);})[_0xaa7a('0x24')](function(_0x583a9a){_0x51d85f['rows']=_0x583a9a;return _0x51d85f;})[_0xaa7a('0x24')](respondWithFilteredResult(_0x50a202,_0x33797e))['catch'](handleError(_0x50a202,null));};exports[_0xaa7a('0x5d')]=function(_0x568e68,_0x5790b6){var _0x9ef389={'raw':![],'where':{'id':_0x568e68[_0xaa7a('0x5e')]['id']},'include':[{'model':db[_0xaa7a('0x5f')],'as':_0xaa7a('0x41')}]},_0x28c933={};_0x28c933[_0xaa7a('0x49')]=_['keys'](db[_0xaa7a('0x59')][_0xaa7a('0x42')]);_0x28c933[_0xaa7a('0x46')]=_[_0xaa7a('0x47')](_0x568e68['query']);_0x28c933['filters']=_[_0xaa7a('0x4b')](_0x28c933[_0xaa7a('0x49')],_0x28c933[_0xaa7a('0x46')]);_0x9ef389['attributes']=_['intersection'](_0x28c933[_0xaa7a('0x49')],qs[_0xaa7a('0x4c')](_0x568e68[_0xaa7a('0x46')][_0xaa7a('0x4c')]));_0x9ef389['attributes']=_0x9ef389['attributes'][_0xaa7a('0x4d')]?_0x9ef389[_0xaa7a('0x4a')]:_0x28c933[_0xaa7a('0x49')];if(_0x568e68[_0xaa7a('0x46')][_0xaa7a('0x5a')]){_0x9ef389[_0xaa7a('0x5b')]=[{'all':!![]}];}_0x9ef389=_[_0xaa7a('0x57')]({},_0x9ef389,_0x568e68[_0xaa7a('0x58')]);return db[_0xaa7a('0x59')][_0xaa7a('0x60')](_0x9ef389)['then'](handleEntityNotFound(_0x5790b6,null))[_0xaa7a('0x24')](respondWithResult(_0x5790b6,null))[_0xaa7a('0x2f')](handleError(_0x5790b6,null));};exports[_0xaa7a('0x61')]=function(_0x10e249,_0x12ba0){return db[_0xaa7a('0x59')]['create'](_0x10e249[_0xaa7a('0x62')],{})[_0xaa7a('0x24')](function(_0x604d5d){var _0x296014=_0x10e249['user']['get']({'plain':!![]});if(!_0x296014)throw new Error(_0xaa7a('0x63'));if(_0x296014['role']===_0xaa7a('0x64')){var _0x2e29fc=_0x604d5d['get']({'plain':!![]});var _0x1febed=_0xaa7a('0x39');return db[_0xaa7a('0x65')][_0xaa7a('0x60')]({'where':{'name':_0x1febed,'userProfileId':_0x296014[_0xaa7a('0x66')]},'raw':!![]})[_0xaa7a('0x24')](function(_0x3adcd9){if(_0x3adcd9&&_0x3adcd9[_0xaa7a('0x67')]===0x0){return db[_0xaa7a('0x3a')][_0xaa7a('0x61')]({'name':_0x2e29fc['name'],'resourceId':_0x2e29fc['id'],'type':_0x3adcd9[_0xaa7a('0x3e')],'sectionId':_0x3adcd9['id']},{})['then'](function(){return _0x604d5d;});}else{return _0x604d5d;}})[_0xaa7a('0x2f')](function(_0x456c76){logger[_0xaa7a('0x2b')](_0xaa7a('0x68'),_0x456c76);throw _0x456c76;});}return _0x604d5d;})['then'](respondWithResult(_0x12ba0,0xc9))[_0xaa7a('0x2f')](handleError(_0x12ba0,null));};exports[_0xaa7a('0x38')]=function(_0x33e028,_0x150dc2){if(_0x33e028[_0xaa7a('0x62')]['id']){delete _0x33e028[_0xaa7a('0x62')]['id'];}return db[_0xaa7a('0x59')][_0xaa7a('0x60')]({'where':{'id':_0x33e028['params']['id']},'include':[{'model':db['Pause'],'as':_0xaa7a('0x41')}]})[_0xaa7a('0x24')](handleEntityNotFound(_0x150dc2,null))[_0xaa7a('0x24')](saveUpdates(_0x33e028[_0xaa7a('0x62')],null))[_0xaa7a('0x24')](respondWithResult(_0x150dc2,null))[_0xaa7a('0x2f')](handleError(_0x150dc2,null));};exports[_0xaa7a('0x3b')]=function(_0xd02872,_0x4f2646){return db[_0xaa7a('0x59')][_0xaa7a('0x60')]({'where':{'id':_0xd02872['params']['id']}})['then'](handleEntityNotFound(_0x4f2646,null))[_0xaa7a('0x24')](removeEntity(_0x4f2646,null))[_0xaa7a('0x2f')](handleError(_0x4f2646,null));};exports['describe']=function(_0x3b1360,_0x33f3d1){return db[_0xaa7a('0x59')][_0xaa7a('0x69')]()[_0xaa7a('0x24')](respondWithResult(_0x33f3d1,null))[_0xaa7a('0x2f')](handleError(_0x33f3d1,null));};exports[_0xaa7a('0x6a')]=function(_0x241ca9,_0x2a69cd,_0x402f0d){if(_0x241ca9[_0xaa7a('0x62')]['id']){delete _0x241ca9[_0xaa7a('0x62')]['id'];}return db['WhatsappAccount'][_0xaa7a('0x60')]({'where':{'id':_0x241ca9[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0x2a69cd,null))[_0xaa7a('0x24')](function(_0x3b5ba5){if(_0x3b5ba5){_0x241ca9[_0xaa7a('0x62')][_0xaa7a('0x6b')]=_0x3b5ba5['id'];return db['Disposition']['create'](_0x241ca9[_0xaa7a('0x62')]);}})[_0xaa7a('0x24')](respondWithResult(_0x2a69cd,null))[_0xaa7a('0x2f')](handleError(_0x2a69cd,null));};exports[_0xaa7a('0x6c')]=function(_0x43a0e3,_0x3e2c48,_0x29174f){var _0x5b11cf={'raw':![],'where':{}};var _0x490003={};var _0x90cfe1={'count':0x0,'rows':[]};return db[_0xaa7a('0x59')][_0xaa7a('0x6d')]({'where':{'id':_0x43a0e3[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0x3e2c48,null))[_0xaa7a('0x24')](function(_0x52819f){if(_0x52819f){_0x490003[_0xaa7a('0x49')]=_[_0xaa7a('0x47')](db[_0xaa7a('0x6e')][_0xaa7a('0x42')]);_0x490003[_0xaa7a('0x46')]=_[_0xaa7a('0x47')](_0x43a0e3[_0xaa7a('0x46')]);_0x490003['filters']=_[_0xaa7a('0x4b')](_0x490003[_0xaa7a('0x49')],_0x490003['query']);_0x5b11cf[_0xaa7a('0x4a')]=_['intersection'](_0x490003[_0xaa7a('0x49')],qs[_0xaa7a('0x4c')](_0x43a0e3[_0xaa7a('0x46')][_0xaa7a('0x4c')]));_0x5b11cf[_0xaa7a('0x4a')]=_0x5b11cf[_0xaa7a('0x4a')]['length']?_0x5b11cf[_0xaa7a('0x4a')]:_0x490003[_0xaa7a('0x49')];if(!_0x43a0e3[_0xaa7a('0x46')][_0xaa7a('0x4e')](_0xaa7a('0x4f'))){_0x5b11cf['limit']=qs['limit'](_0x43a0e3['query'][_0xaa7a('0x34')]);_0x5b11cf[_0xaa7a('0x32')]=qs[_0xaa7a('0x32')](_0x43a0e3[_0xaa7a('0x46')][_0xaa7a('0x32')]);}_0x5b11cf[_0xaa7a('0x50')]=qs[_0xaa7a('0x51')](_0x43a0e3['query']['sort']);_0x5b11cf[_0xaa7a('0x52')]=qs['filters'](_['pick'](_0x43a0e3[_0xaa7a('0x46')],_0x490003[_0xaa7a('0x48')]));_0x5b11cf[_0xaa7a('0x52')][_0xaa7a('0x6b')]=_0x52819f['id'];if(_0x43a0e3[_0xaa7a('0x46')][_0xaa7a('0x56')]){_0x5b11cf[_0xaa7a('0x52')]=_['merge'](_0x5b11cf['where'],{'$or':_[_0xaa7a('0x54')](_0x5b11cf[_0xaa7a('0x4a')],function(_0x4bf9ca){var _0x4b3955={};_0x4b3955[_0x4bf9ca]={'$like':'%'+_0x43a0e3[_0xaa7a('0x46')]['filter']+'%'};return _0x4b3955;})});}_0x5b11cf=_['merge']({},_0x5b11cf,_0x43a0e3[_0xaa7a('0x58')]);return db[_0xaa7a('0x6e')][_0xaa7a('0x35')]({'where':_0x5b11cf[_0xaa7a('0x52')]})['then'](function(_0xf36b31){_0x90cfe1['count']=_0xf36b31;if(_0x43a0e3[_0xaa7a('0x46')][_0xaa7a('0x5a')]){_0x5b11cf['include']=[{'all':!![]}];}return db[_0xaa7a('0x6e')][_0xaa7a('0x5c')](_0x5b11cf);})['then'](function(_0x41e2a8){_0x90cfe1['rows']=_0x41e2a8;return _0x90cfe1;});}})['then'](respondWithFilteredResult(_0x3e2c48,_0x5b11cf))[_0xaa7a('0x2f')](handleError(_0x3e2c48,null));};exports[_0xaa7a('0x6f')]=function(_0x199ae6,_0x498e4e,_0x1d79b9){return db['WhatsappAccount'][_0xaa7a('0x60')]({'where':{'id':_0x199ae6[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0x498e4e,null))[_0xaa7a('0x24')](function(_0x1543db){if(_0x1543db){return _0x1543db[_0xaa7a('0x6f')](_0x199ae6[_0xaa7a('0x46')][_0xaa7a('0x70')]);}})['then'](respondWithStatusCode(_0x498e4e,null))[_0xaa7a('0x2f')](handleError(_0x498e4e,null));};exports[_0xaa7a('0x71')]=function(_0x32fdc8,_0x24709d,_0x31712f){if(_0x32fdc8[_0xaa7a('0x62')]['id']){delete _0x32fdc8[_0xaa7a('0x62')]['id'];}return db[_0xaa7a('0x59')]['find']({'where':{'id':_0x32fdc8[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0x24709d,null))[_0xaa7a('0x24')](function(_0x20ec62){if(_0x20ec62){_0x32fdc8[_0xaa7a('0x62')][_0xaa7a('0x6b')]=_0x20ec62['id'];return db['CannedAnswer'][_0xaa7a('0x61')](_0x32fdc8[_0xaa7a('0x62')]);}})[_0xaa7a('0x24')](respondWithResult(_0x24709d,null))[_0xaa7a('0x2f')](handleError(_0x24709d,null));};exports[_0xaa7a('0x72')]=function(_0x4e45fa,_0x385c94,_0x212505){var _0x2743bb={'raw':![],'where':{}};var _0x2acf00={};var _0x2ac579={'count':0x0,'rows':[]};return db[_0xaa7a('0x59')][_0xaa7a('0x6d')]({'where':{'id':_0x4e45fa[_0xaa7a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x385c94,null))['then'](function(_0x1adfd3){if(_0x1adfd3){_0x2acf00[_0xaa7a('0x49')]=_['keys'](db[_0xaa7a('0x73')][_0xaa7a('0x42')]);_0x2acf00[_0xaa7a('0x46')]=_['keys'](_0x4e45fa[_0xaa7a('0x46')]);_0x2acf00['filters']=_[_0xaa7a('0x4b')](_0x2acf00[_0xaa7a('0x49')],_0x2acf00[_0xaa7a('0x46')]);_0x2743bb[_0xaa7a('0x4a')]=_[_0xaa7a('0x4b')](_0x2acf00[_0xaa7a('0x49')],qs['fields'](_0x4e45fa[_0xaa7a('0x46')]['fields']));_0x2743bb['attributes']=_0x2743bb[_0xaa7a('0x4a')]['length']?_0x2743bb[_0xaa7a('0x4a')]:_0x2acf00[_0xaa7a('0x49')];if(!_0x4e45fa[_0xaa7a('0x46')]['hasOwnProperty'](_0xaa7a('0x4f'))){_0x2743bb[_0xaa7a('0x34')]=qs[_0xaa7a('0x34')](_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x34')]);_0x2743bb[_0xaa7a('0x32')]=qs[_0xaa7a('0x32')](_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x32')]);}_0x2743bb[_0xaa7a('0x50')]=qs[_0xaa7a('0x51')](_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x51')]);_0x2743bb[_0xaa7a('0x52')]=qs[_0xaa7a('0x48')](_[_0xaa7a('0x53')](_0x4e45fa[_0xaa7a('0x46')],_0x2acf00[_0xaa7a('0x48')]));_0x2743bb[_0xaa7a('0x52')][_0xaa7a('0x6b')]=_0x1adfd3['id'];if(_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x56')]){_0x2743bb[_0xaa7a('0x52')]=_[_0xaa7a('0x57')](_0x2743bb[_0xaa7a('0x52')],{'$or':_[_0xaa7a('0x54')](_0x2743bb['attributes'],function(_0x5643b5){var _0x2ff737={};_0x2ff737[_0x5643b5]={'$like':'%'+_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x56')]+'%'};return _0x2ff737;})});}_0x2743bb=_[_0xaa7a('0x57')]({},_0x2743bb,_0x4e45fa['options']);return db['CannedAnswer'][_0xaa7a('0x35')]({'where':_0x2743bb[_0xaa7a('0x52')]})[_0xaa7a('0x24')](function(_0x2b708b){_0x2ac579['count']=_0x2b708b;if(_0x4e45fa[_0xaa7a('0x46')][_0xaa7a('0x5a')]){_0x2743bb[_0xaa7a('0x5b')]=[{'all':!![]}];}return db[_0xaa7a('0x73')]['findAll'](_0x2743bb);})[_0xaa7a('0x24')](function(_0x49a409){_0x2ac579[_0xaa7a('0x74')]=_0x49a409;return _0x2ac579;});}})[_0xaa7a('0x24')](respondWithFilteredResult(_0x385c94,_0x2743bb))[_0xaa7a('0x2f')](handleError(_0x385c94,null));};exports['removeAnswers']=function(_0xbee66b,_0x590169,_0x52319){return db[_0xaa7a('0x59')][_0xaa7a('0x60')]({'where':{'id':_0xbee66b[_0xaa7a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x590169,null))['then'](function(_0xc7b82d){if(_0xc7b82d){return _0xc7b82d[_0xaa7a('0x75')](_0xbee66b[_0xaa7a('0x46')][_0xaa7a('0x70')]);}})['then'](respondWithStatusCode(_0x590169,null))[_0xaa7a('0x2f')](handleError(_0x590169,null));};exports[_0xaa7a('0x76')]=function(_0x905127,_0x5754df,_0x36c5b2){return db[_0xaa7a('0x59')]['find']({'where':{'id':_0x905127[_0xaa7a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5754df,null))[_0xaa7a('0x24')](function(_0x5dd87d){if(_0x5dd87d){return _0x5dd87d[_0xaa7a('0x76')](_0x905127[_0xaa7a('0x62')]['ids'],_[_0xaa7a('0x77')](_0x905127[_0xaa7a('0x62')],[_0xaa7a('0x70'),'id'])||{})[_0xaa7a('0x78')](function(_0x5e26ef){for(var _0xbcfc12=0x0;_0xbcfc12<_0x905127[_0xaa7a('0x62')]['ids'][_0xaa7a('0x4d')];_0xbcfc12+=0x1){socket[_0xaa7a('0x79')](_0xaa7a('0x7a'),{'UserId':Number(_0x905127[_0xaa7a('0x62')][_0xaa7a('0x70')][_0xbcfc12]),'WhatsappAccountId':Number(_0x905127[_0xaa7a('0x5e')]['id'])});}return _0x5e26ef;});}})[_0xaa7a('0x24')](respondWithResult(_0x5754df,null))['catch'](handleError(_0x5754df,null));};exports[_0xaa7a('0x7b')]=function(_0x186d36,_0xa1a68a,_0x45593a){return db[_0xaa7a('0x59')][_0xaa7a('0x60')]({'where':{'id':_0x186d36['params']['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0xa1a68a,null))[_0xaa7a('0x24')](function(_0x2b1142){if(_0x2b1142){return _0x2b1142[_0xaa7a('0x7b')](_0x186d36[_0xaa7a('0x46')]['ids'])[_0xaa7a('0x24')](function(){if(_[_0xaa7a('0x7c')](_0x186d36['query']['ids'])){for(var _0x226a50=0x0;_0x226a50<_0x186d36['query'][_0xaa7a('0x70')]['length'];_0x226a50+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x186d36['query'][_0xaa7a('0x70')][_0x226a50]),'WhatsappAccountId':Number(_0x186d36['params']['id'])});}}else{socket[_0xaa7a('0x79')](_0xaa7a('0x7d'),{'UserId':Number(_0x186d36['query'][_0xaa7a('0x70')]),'WhatsappAccountId':Number(_0x186d36[_0xaa7a('0x5e')]['id'])});}});}})[_0xaa7a('0x24')](respondWithStatusCode(_0xa1a68a,null))[_0xaa7a('0x2f')](handleError(_0xa1a68a,null));};exports['getAgents']=function(_0xfdfbf4,_0x564048,_0x4ca458){var _0x2d0fe6={};var _0x563775={};var _0x5123e4;var _0x17e385;return db['WhatsappAccount'][_0xaa7a('0x6d')]({'where':{'id':_0xfdfbf4[_0xaa7a('0x5e')]['id']}})['then'](handleEntityNotFound(_0x564048,null))[_0xaa7a('0x24')](function(_0x2a7072){if(_0x2a7072){_0x5123e4=_0x2a7072;_0x563775[_0xaa7a('0x49')]=_[_0xaa7a('0x47')](db['User']['rawAttributes']);_0x563775['query']=_[_0xaa7a('0x47')](_0xfdfbf4[_0xaa7a('0x46')]);_0x563775['filters']=_[_0xaa7a('0x4b')](_0x563775[_0xaa7a('0x49')],_0x563775[_0xaa7a('0x46')]);_0x2d0fe6[_0xaa7a('0x4a')]=_[_0xaa7a('0x4b')](_0x563775[_0xaa7a('0x49')],qs[_0xaa7a('0x4c')](_0xfdfbf4[_0xaa7a('0x46')]['fields']));_0x2d0fe6[_0xaa7a('0x4a')]=_0x2d0fe6[_0xaa7a('0x4a')][_0xaa7a('0x4d')]?_0x2d0fe6['attributes']:_0x563775[_0xaa7a('0x49')];_0x2d0fe6[_0xaa7a('0x50')]=qs['sort'](_0xfdfbf4[_0xaa7a('0x46')][_0xaa7a('0x51')]);_0x2d0fe6[_0xaa7a('0x52')]=qs['filters'](_[_0xaa7a('0x53')](_0xfdfbf4[_0xaa7a('0x46')],_0x563775[_0xaa7a('0x48')]));if(_0xfdfbf4['query'][_0xaa7a('0x56')]){_0x2d0fe6['where']=_['merge'](_0x2d0fe6[_0xaa7a('0x52')],{'$or':_['map'](_0x2d0fe6['attributes'],function(_0x83940a){var _0x22130c={};_0x22130c[_0x83940a]={'$like':'%'+_0xfdfbf4[_0xaa7a('0x46')]['filter']+'%'};return _0x22130c;})});}_0x2d0fe6=_[_0xaa7a('0x57')]({},_0x2d0fe6,_0xfdfbf4[_0xaa7a('0x58')]);return _0x5123e4[_0xaa7a('0x7e')](_0x2d0fe6);}})[_0xaa7a('0x24')](function(_0x2f99cb){if(_0x2f99cb){_0x17e385=_0x2f99cb[_0xaa7a('0x4d')];if(!_0xfdfbf4[_0xaa7a('0x46')]['hasOwnProperty'](_0xaa7a('0x4f'))){_0x2d0fe6[_0xaa7a('0x34')]=qs['limit'](_0xfdfbf4[_0xaa7a('0x46')][_0xaa7a('0x34')]);_0x2d0fe6['offset']=qs[_0xaa7a('0x32')](_0xfdfbf4['query'][_0xaa7a('0x32')]);}return _0x5123e4[_0xaa7a('0x7e')](_0x2d0fe6);}})['then'](function(_0x3df5b2){if(_0x3df5b2){return _0x3df5b2?{'count':_0x17e385,'rows':_0x3df5b2}:null;}})[_0xaa7a('0x24')](respondWithResult(_0x564048,null))[_0xaa7a('0x2f')](handleError(_0x564048,null));};exports[_0xaa7a('0x7f')]=function(_0x198786,_0x2cf835){var _0x47716f=_0x198786['params']['id'];var _0x940d89=_0x198786[_0xaa7a('0x62')];var _0x26ca9f=0xc8;var _0x448d12=null;return db[_0xaa7a('0x80')][_0xaa7a('0x81')]({'isolationLevel':db[_0xaa7a('0x80')][_0xaa7a('0x82')][_0xaa7a('0x83')][_0xaa7a('0x84')]},function(_0xcf8f34){return db['WhatsappAccount']['findOne']({'where':{'id':_0x47716f},'transaction':_0xcf8f34})[_0xaa7a('0x24')](function(_0x5acfbc){if(_0x5acfbc){return db[_0xaa7a('0x85')]['destroy']({'where':{'WhatsappAccountId':_0x47716f},'transaction':_0xcf8f34})[_0xaa7a('0x24')](function(){var _0x3f5190=_[_0xaa7a('0x54')](_0x940d89,function(_0x32536a){_0x32536a[_0xaa7a('0x6b')]=_0x47716f;return _0x32536a;});return db[_0xaa7a('0x85')][_0xaa7a('0x86')](_0x3f5190,{'transaction':_0xcf8f34});});}else{_0x26ca9f=0x194;_0x448d12=[];}});})[_0xaa7a('0x24')](function(){if(_0x26ca9f!==0x194){return db[_0xaa7a('0x85')][_0xaa7a('0x87')]({'where':{'WhatsappAccountId':_0x47716f},'order':_0xaa7a('0x88')})[_0xaa7a('0x24')](function(_0x53c10a){_0x448d12=_0x53c10a;});}})[_0xaa7a('0x2f')](function(_0x1d2cbd){_0x26ca9f=0x1f4;logger[_0xaa7a('0x2b')](_0x1d2cbd[_0xaa7a('0x3d')]);if(_0x1d2cbd[_0xaa7a('0x3e')]){delete _0x1d2cbd[_0xaa7a('0x3e')];}_0x448d12=_0x1d2cbd;})[_0xaa7a('0x89')](function(){if(_0x448d12===null){_0x2cf835[_0xaa7a('0x3c')](_0x26ca9f);}else{if(_0x26ca9f===0x1f4){_0x2cf835[_0xaa7a('0x30')](_0x26ca9f)[_0xaa7a('0x3f')](_0x448d12);}else{_0x2cf835[_0xaa7a('0x30')](_0x26ca9f)[_0xaa7a('0x31')](_0x448d12);}}});};exports['getApplications']=function(_0x4fc257,_0x467856,_0x2c318e){var _0x119b4a={};var _0x1c9746={};var _0x578750;var _0x137c23;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4fc257[_0xaa7a('0x5e')]['id']}})[_0xaa7a('0x24')](handleEntityNotFound(_0x467856,null))['then'](function(_0x507dc0){if(_0x507dc0){_0x578750=_0x507dc0;_0x1c9746[_0xaa7a('0x49')]=_['keys'](db[_0xaa7a('0x85')][_0xaa7a('0x42')]);_0x1c9746[_0xaa7a('0x46')]=_['keys'](_0x4fc257['query']);_0x1c9746[_0xaa7a('0x48')]=_[_0xaa7a('0x4b')](_0x1c9746[_0xaa7a('0x49')],_0x1c9746[_0xaa7a('0x46')]);_0x119b4a[_0xaa7a('0x4a')]=_[_0xaa7a('0x4b')](_0x1c9746[_0xaa7a('0x49')],qs[_0xaa7a('0x4c')](_0x4fc257[_0xaa7a('0x46')]['fields']));_0x119b4a[_0xaa7a('0x4a')]=_0x119b4a[_0xaa7a('0x4a')][_0xaa7a('0x4d')]?_0x119b4a['attributes']:_0x1c9746[_0xaa7a('0x49')];_0x119b4a[_0xaa7a('0x50')]=qs[_0xaa7a('0x51')](_0x4fc257['query']['sort']);_0x119b4a[_0xaa7a('0x52')]=qs[_0xaa7a('0x48')](_[_0xaa7a('0x53')](_0x4fc257[_0xaa7a('0x46')],_0x1c9746[_0xaa7a('0x48')]));if(_0x4fc257['query']['filter']){_0x119b4a[_0xaa7a('0x52')]=_[_0xaa7a('0x57')](_0x119b4a[_0xaa7a('0x52')],{'$or':_[_0xaa7a('0x54')](_0x119b4a[_0xaa7a('0x4a')],function(_0x5d7805){var _0x4d8300={};_0x4d8300[_0x5d7805]={'$like':'%'+_0x4fc257['query'][_0xaa7a('0x56')]+'%'};return _0x4d8300;})});}_0x119b4a=_[_0xaa7a('0x57')]({},_0x119b4a,_0x4fc257['options']);return _0x578750[_0xaa7a('0x8a')](_0x119b4a);}})[_0xaa7a('0x24')](function(_0x45683d){if(_0x45683d){_0x137c23=_0x45683d[_0xaa7a('0x4d')];if(!_0x4fc257[_0xaa7a('0x46')][_0xaa7a('0x4e')](_0xaa7a('0x4f'))){_0x119b4a[_0xaa7a('0x34')]=qs['limit'](_0x4fc257[_0xaa7a('0x46')][_0xaa7a('0x34')]);_0x119b4a[_0xaa7a('0x32')]=qs['offset'](_0x4fc257[_0xaa7a('0x46')][_0xaa7a('0x32')]);}return _0x578750[_0xaa7a('0x8a')](_0x119b4a);}})[_0xaa7a('0x24')](function(_0x41f6b8){if(_0x41f6b8){return _0x41f6b8?{'count':_0x137c23,'rows':_0x41f6b8}:null;}})['then'](respondWithResult(_0x467856,null))[_0xaa7a('0x2f')](handleError(_0x467856,null));};exports[_0xaa7a('0x8b')]=function(_0x5b6ebc,_0x103378,_0x11731b){var _0x14911d={'channel':_0xaa7a('0x8c')};var _0x49b946=[];var _0x446705=[];var _0x3f0e28={};return db[_0xaa7a('0x59')]['find']({'where':{'id':_0x5b6ebc['params']['id']},'include':[{'model':db[_0xaa7a('0x85')],'as':_0xaa7a('0x8d')}]})[_0xaa7a('0x24')](handleEntityNotFound(_0x103378,null))['then'](function(_0x484cb1){_0x14911d['account']=_0x484cb1;if(_0x14911d[_0xaa7a('0x8e')]&&_0x14911d[_0xaa7a('0x8e')][_0xaa7a('0x44')]===_0xaa7a('0x8f')&&_0x5b6ebc['body'][_0xaa7a('0x90')]){if(_0x5b6ebc[_0xaa7a('0x62')]['statuses'][_0xaa7a('0x4d')]===0x0)return;if(_0x5b6ebc[_0xaa7a('0x62')]['statuses'][0x0][_0xaa7a('0x91')]!=='read')return;return db[_0xaa7a('0x92')]['update']({'read':!![],'readAt':_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0x90')][0x0][_0xaa7a('0x93')]},{'where':{'messageId':_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0x90')][0x0]['message_id']},'individualHooks':!![]})[_0xaa7a('0x24')](function(_0xf2f32e){return _0x103378[_0xaa7a('0x30')](0xc8)[_0xaa7a('0x31')](_0xf2f32e);});}_0x14911d[_0xaa7a('0x94')]=_[_0xaa7a('0x95')](_0x484cb1[_0xaa7a('0x8d')],[_0xaa7a('0x88')],['asc']);if(_0x14911d['account'][_0xaa7a('0x8d')]){delete _0x14911d['account'][_0xaa7a('0x8d')];}return db[_0xaa7a('0x96')][_0xaa7a('0x69')]()[_0xaa7a('0x24')](function(_0xed4e76){if(!_0xed4e76){throw new db[(_0xaa7a('0x97'))]['ValidationError'](_0xaa7a('0x98'));}_0x49b946=_[_0xaa7a('0x99')](_['keys'](_0xed4e76),[_0xaa7a('0x9a'),'updatedAt']);_0x446705=_[_0xaa7a('0x99')](_[_0xaa7a('0x47')](_0xed4e76),[_0xaa7a('0x9a'),_0xaa7a('0x9b'),_0xaa7a('0x9c'),'ListId']);_0x14911d[_0xaa7a('0x62')]={'mapKey':_0xaa7a('0x9d')};if(_0x14911d[_0xaa7a('0x8e')]&&_0x14911d['account'][_0xaa7a('0x44')]===_0xaa7a('0x9e')){_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')]=_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0xa0')][_0xaa7a('0xa1')](_0xaa7a('0xa2'),'');_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x62')]=_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0xa3')];_0x14911d[_0xaa7a('0x62')][_0xaa7a('0xa4')]=_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0xa5')];}if(_0x14911d[_0xaa7a('0x8e')]&&_0x14911d[_0xaa7a('0x8e')]['type']===_0xaa7a('0x8f')){_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')]=_0x5b6ebc['body'][_0xaa7a('0xa6')][0x0][_0xaa7a('0x9f')];_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x62')]=_0x5b6ebc['body'][_0xaa7a('0xa6')][0x0][_0xaa7a('0x2d')][_0xaa7a('0x62')];_0x14911d['body']['messageId']=_0x5b6ebc[_0xaa7a('0x62')][_0xaa7a('0xa6')][0x0][_0xaa7a('0xa7')];}if(_0x14911d[_0xaa7a('0x62')]['id']){delete _0x14911d['body']['id'];}if(_['isNil'](_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')])){throw new db[(_0xaa7a('0x97'))][(_0xaa7a('0xa8'))](_0xaa7a('0xa9'));}if(_[_0xaa7a('0xaa')](_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x62')])||_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x62')]===''){throw new db[(_0xaa7a('0x97'))]['ValidationError'](_0xaa7a('0xab'));}if(_['isNil'](_0x14911d['body']['mapKey'])){throw new db[(_0xaa7a('0x97'))][(_0xaa7a('0xa8'))](_0xaa7a('0xac')+_0x446705);}if(!_[_0xaa7a('0xad')](_0x446705,_0x14911d[_0xaa7a('0x62')]['mapKey'])){throw new db[(_0xaa7a('0x97'))][(_0xaa7a('0xa8'))](_0xaa7a('0xae')+_0x446705);}_0x3f0e28[_0x14911d[_0xaa7a('0x62')][_0xaa7a('0xaf')]]=_0x14911d['body'][_0xaa7a('0x9f')];return db['CmList'][_0xaa7a('0x60')]({'where':{'id':_0x14911d[_0xaa7a('0x8e')]['ListId']},'include':[{'model':db[_0xaa7a('0x96')],'as':_0xaa7a('0xb0'),'where':_0x3f0e28,'limit':0x1,'order':[[_0xaa7a('0x9b'),_0xaa7a('0xb1')]]}]});})[_0xaa7a('0x24')](handleEntityNotFound(_0x103378,null))[_0xaa7a('0x24')](function(_0x28f0ae){if(_0x28f0ae){_0x14911d[_0xaa7a('0xb2')]=_[_0xaa7a('0x77')](_0x28f0ae,[_0xaa7a('0xb0')]);if(_0x28f0ae[_0xaa7a('0xb0')]['length']){return _0x28f0ae[_0xaa7a('0xb0')][0x0];}var _0xf0fed2=_['defaults'](_0x14911d['body'],{'firstName':_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')],'ListId':_0x28f0ae['id']});_0xf0fed2[_0x14911d['body'][_0xaa7a('0xaf')]]=_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')];return db[_0xaa7a('0x96')][_0xaa7a('0x61')](_0xf0fed2,{'fields':_0x49b946,'raw':!![]});}})['then'](handleEntityNotFound(_0x103378,null))[_0xaa7a('0x24')](function(_0x1b4b05){if(_0x1b4b05){_0x14911d[_0xaa7a('0xb3')]=_0x1b4b05;var _0x34b2fc={'ContactId':_0x1b4b05['id'],'phone':_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')],'WhatsappAccountId':_0x5b6ebc[_0xaa7a('0x5e')]['id']};var _0x33e11b={'ContactId':_0x1b4b05['id'],'WhatsappAccountId':_0x5b6ebc[_0xaa7a('0x5e')]['id'],'closed':![]};return db[_0xaa7a('0xb4')][_0xaa7a('0x60')]({'where':_0x33e11b})[_0xaa7a('0x24')](function(_0x4966ff){if(_0x4966ff){return[_0x4966ff,![]];}return db[_0xaa7a('0xb4')][_0xaa7a('0x61')](_0x34b2fc)[_0xaa7a('0x24')](function(_0x58af22){return[_0x58af22,!![]];});});}})[_0xaa7a('0x78')](function(_0x27cdc4,_0x1d1d6c){_0x14911d[_0xaa7a('0xb5')]=_0x27cdc4[_0xaa7a('0xb6')]({'plain':!![]});_0x14911d[_0xaa7a('0xb5')]['created']=![];if(_0x1d1d6c){if(_0x14911d[_0xaa7a('0x8e')][_0xaa7a('0xb7')]){_0x14911d[_0xaa7a('0x94')][_0xaa7a('0xb8')]({'id':0x0,'priority':_0x14911d['applications'][_0xaa7a('0x4d')]+0x1,'app':'close','appdata':_0xaa7a('0xb9'),'interval':_0xaa7a('0xba')});}_0x14911d['interaction'][_0xaa7a('0xbb')]=!![];}return db['WhatsappMessage'][_0xaa7a('0x61')]({'phone':_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x9f')],'messageId':_0x14911d[_0xaa7a('0x62')]['messageId'],'body':_0x14911d[_0xaa7a('0x62')][_0xaa7a('0x62')],'WhatsappAccountId':_0x5b6ebc['params']['id'],'WhatsappInteractionId':_0x27cdc4['id'],'direction':'in','ContactId':_0x27cdc4[_0xaa7a('0xbc')],'AttachmentId':_0x14911d[_0xaa7a('0x62')]['AttachmentId']});})[_0xaa7a('0x24')](function(_0x3430f3){_0x14911d[_0xaa7a('0x2d')]=_0x3430f3;if(_0x14911d[_0xaa7a('0xb5')]['UserId']){return db['User'][_0xaa7a('0x60')]({'attributes':['id',_0xaa7a('0x3e')],'where':{'id':_0x14911d[_0xaa7a('0xb5')][_0xaa7a('0xbd')]}})[_0xaa7a('0x24')](function(_0x537dcb){if(_0x537dcb){_0x14911d[_0xaa7a('0x94')][_0xaa7a('0xbe')]({'id':0x0,'priority':0x0,'app':_0xaa7a('0xbf'),'appdata':_0x537dcb[_0xaa7a('0x3e')]+','+(_0x14911d['account']['waitForTheAssignedAgent']||0xa),'interval':_0xaa7a('0xba')});}return respondWithRpcPromise(_0xaa7a('0xc0'),'startRouting',_0x14911d);});}return respondWithRpcPromise('Start',_0xaa7a('0xc1'),_0x14911d);})[_0xaa7a('0x24')](function(_0x410822){if(_0x410822){var _0x33ebc4=0xc8;var _0x9d4755=_0xaa7a('0xc2');logger[_0xaa7a('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x9d4755,_0x33ebc4,_0xaa7a('0xc3'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x9d4755,_0x33ebc4,_0xaa7a('0xc3'),JSON[_0xaa7a('0x2a')](_0x410822));if(_0x14911d['account'][_0xaa7a('0x44')]==='twilio'){return _0x103378[_0xaa7a('0x30')](_0x33ebc4)[_0xaa7a('0xc4')](_0xaa7a('0xc5'),'text/xml')['send'](_0xaa7a('0xc6'));}else{return _0x103378[_0xaa7a('0x30')](_0x33ebc4)[_0xaa7a('0x31')](_0x410822);}}});})[_0xaa7a('0x2f')](handleError(_0x103378,null));};exports[_0xaa7a('0x3f')]=function(_0x3b74fc,_0x5ddd3b,_0x47088d){var _0xce9ad8,_0x4a4301,_0x34731a;if(_[_0xaa7a('0xaa')](_0x3b74fc[_0xaa7a('0x62')][_0xaa7a('0x62')])||_0x3b74fc[_0xaa7a('0x62')][_0xaa7a('0x62')]===''){throw new db[(_0xaa7a('0x97'))]['ValidationError'](_0xaa7a('0xab'));}if(_['isNil'](_0x3b74fc[_0xaa7a('0x62')]['to'])){throw new db[(_0xaa7a('0x97'))][(_0xaa7a('0xa8'))](_0xaa7a('0xc7'));}_0xce9ad8=_0x3b74fc['body']['to'];return db[_0xaa7a('0x59')][_0xaa7a('0x60')]({'where':{'id':_0x3b74fc['params']['id']},'include':[{'model':db[_0xaa7a('0xc8')],'as':'List','include':[{'model':db[_0xaa7a('0x96')],'as':'Contacts','where':{'mobile':_0xce9ad8},'limit':0x1,'order':[[_0xaa7a('0x9b'),_0xaa7a('0xb1')]]}]}]})[_0xaa7a('0x24')](handleEntityNotFound(_0x5ddd3b,null))['then'](function(_0x5dd62a){if(_0x5dd62a&&_0x5dd62a[_0xaa7a('0xc9')]){_0x4a4301=_0x5dd62a[_0xaa7a('0xb6')]({'plain':!![]});if(_0x4a4301[_0xaa7a('0xc9')]&&_0x4a4301[_0xaa7a('0xc9')][_0xaa7a('0xb0')][_0xaa7a('0x4d')]){return _0x4a4301['List'][_0xaa7a('0xb0')][0x0];}return db[_0xaa7a('0x96')][_0xaa7a('0x61')](_['defaults'](_0x3b74fc[_0xaa7a('0x62')],{'firstName':_0xce9ad8,'mobile':_0xce9ad8,'phone':_0xce9ad8,'ListId':_0x4a4301[_0xaa7a('0xca')]}));}})[_0xaa7a('0x24')](handleEntityNotFound(_0x5ddd3b,null))[_0xaa7a('0x24')](function(_0x4b32b2){if(_0x4b32b2){_0x34731a=_0x4b32b2;return db[_0xaa7a('0xb4')][_0xaa7a('0x60')]({'where':{'ContactId':_0x34731a['id'],'closed':![],'WhatsappAccountId':_0x4a4301['id']}})[_0xaa7a('0x24')](function(_0x1cab19){if(_0x1cab19){return[_0x1cab19,![]];}return db[_0xaa7a('0xb4')]['create']({'UserId':_0x3b74fc[_0xaa7a('0x64')]['id'],'ContactId':_0x34731a['id'],'WhatsappAccountId':_0x4a4301['id'],'phone':_0xce9ad8,'firstMsgDirection':_0xaa7a('0xcb'),'Messages':[_[_0xaa7a('0x57')](_0x3b74fc[_0xaa7a('0x62')],{'read':![],'body':_0x3b74fc[_0xaa7a('0x62')][_0xaa7a('0x62')],'phone':_0xce9ad8,'WhatsappAccountId':_0x4a4301['id'],'UserId':_0x3b74fc[_0xaa7a('0x64')]['id'],'ContactId':_0x34731a['id']})]},{'include':[{'model':db[_0xaa7a('0x92')],'as':'Messages'}]})[_0xaa7a('0x24')](function(_0x3c5a68){return[_0x3c5a68,!![]];});});}})[_0xaa7a('0x78')](function(_0x3c4f6f,_0x22194c){if(_0x22194c){return _0x3c4f6f;}return db[_0xaa7a('0x92')]['create'](_[_0xaa7a('0x57')](_0x3b74fc['body'],{'read':![],'body':_0x3b74fc[_0xaa7a('0x62')][_0xaa7a('0x62')],'phone':_0xce9ad8,'WhatsappAccountId':_0x4a4301['id'],'WhatsappInteractionId':_0x3c4f6f['id'],'UserId':_0x3b74fc['user']['id'],'ContactId':_0x34731a['id']}))[_0xaa7a('0x24')](function(_0x22a1ad){_0x3c4f6f[_0xaa7a('0xcc')][_0xaa7a('0xcd')]=[];_0x3c4f6f['dataValues'][_0xaa7a('0xcd')][_0xaa7a('0xb8')](_0x22a1ad['dataValues']);return _0x3c4f6f;});})[_0xaa7a('0x24')](respondWithResult(_0x5ddd3b,null))[_0xaa7a('0x2f')](handleError(_0x5ddd3b,null));}; \ No newline at end of file +var _0x3482=['mobile','twilio','From','replace','whatsapp:','Body','from','notifications','messageId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','user','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','Pause','includeAll','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId'];(function(_0x14bade,_0x4da10b){var _0x2693d6=function(_0x2ad03e){while(--_0x2ad03e){_0x14bade['push'](_0x14bade['shift']());}};_0x2693d6(++_0x4da10b);}(_0x3482,0x1dc));var _0x2348=function(_0x5da21e,_0x1232cd){_0x5da21e=_0x5da21e-0x0;var _0x4cb5a4=_0x3482[_0x5da21e];return _0x4cb5a4;};'use strict';var emlformat=require(_0x2348('0x0'));var rimraf=require(_0x2348('0x1'));var zipdir=require(_0x2348('0x2'));var jsonpatch=require(_0x2348('0x3'));var rp=require(_0x2348('0x4'));var moment=require(_0x2348('0x5'));var BPromise=require(_0x2348('0x6'));var Mustache=require(_0x2348('0x7'));var util=require(_0x2348('0x8'));var path=require(_0x2348('0x9'));var sox=require(_0x2348('0xa'));var csv=require(_0x2348('0xb'));var ejs=require(_0x2348('0xc'));var fs=require('fs');var fs_extra=require(_0x2348('0xd'));var _=require(_0x2348('0xe'));var squel=require(_0x2348('0xf'));var crypto=require(_0x2348('0x10'));var jsforce=require(_0x2348('0x11'));var deskjs=require(_0x2348('0x12'));var toCsv=require(_0x2348('0xb'));var querystring=require(_0x2348('0x13'));var Papa=require(_0x2348('0x14'));var Redis=require(_0x2348('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x2348('0x16'));var as=require(_0x2348('0x17'));var hardwareService=require(_0x2348('0x18'));var logger=require(_0x2348('0x19'))(_0x2348('0x1a'));var utils=require('../../config/utils');var config=require(_0x2348('0x1b'));var licenseUtil=require(_0x2348('0x1c'));var db=require(_0x2348('0x1d'))['db'];config[_0x2348('0x1e')]=_[_0x2348('0x1f')](config[_0x2348('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x2348('0x20'))(new Redis(config[_0x2348('0x1e')]));require(_0x2348('0x21'))[_0x2348('0x22')](socket);var jayson=require(_0x2348('0x23'));var client=jayson[_0x2348('0x24')][_0x2348('0x25')]({'port':0x232c});function respondWithRpcPromise(_0x3d3599,_0x159257,_0x234721,_0x3a27c3){return new BPromise(function(_0x531f49,_0xdd4bdf){var _0x182b34=_0x3a27c3||client;return _0x182b34[_0x2348('0x26')](_0x3d3599,_0x234721)[_0x2348('0x27')](function(_0x65dd6d){logger[_0x2348('0x28')](_0x2348('0x29'),_0x159257,_0x2348('0x2a'));logger[_0x2348('0x2b')](_0x2348('0x2c'),_0x159257,'request\x20sent',JSON[_0x2348('0x2d')](_0x65dd6d));if(_0x65dd6d['error']){if(_0x65dd6d[_0x2348('0x2e')]['code']===0x1f4){logger[_0x2348('0x2e')](_0x2348('0x29'),_0x159257,_0x65dd6d[_0x2348('0x2e')][_0x2348('0x2f')]);return _0xdd4bdf(_0x65dd6d['error'][_0x2348('0x2f')]);}logger[_0x2348('0x2e')](_0x2348('0x29'),_0x159257,_0x65dd6d[_0x2348('0x2e')][_0x2348('0x2f')]);return _0x531f49(_0x65dd6d['error'][_0x2348('0x2f')]);}else{logger[_0x2348('0x28')](_0x2348('0x29'),_0x159257,_0x2348('0x2a'));_0x531f49(_0x65dd6d[_0x2348('0x30')]['message']);}})[_0x2348('0x31')](function(_0x21246a){logger[_0x2348('0x2e')]('WhatsappAccount,\x20%s,\x20%s',_0x159257,_0x21246a);_0xdd4bdf(_0x21246a);});});}function respondWithStatusCode(_0x538955,_0xbcbd2c){_0xbcbd2c=_0xbcbd2c||0xcc;return function(_0x2ff95f){if(_0x2ff95f){return _0x538955[_0x2348('0x32')](_0xbcbd2c);}return _0x538955[_0x2348('0x33')](_0xbcbd2c)[_0x2348('0x34')]();};}function respondWithResult(_0x4b872e,_0x32e63e){_0x32e63e=_0x32e63e||0xc8;return function(_0x905696){if(_0x905696){return _0x4b872e[_0x2348('0x33')](_0x32e63e)[_0x2348('0x35')](_0x905696);}};}function respondWithFilteredResult(_0x3c8d8b,_0x397f56){return function(_0x1a4e29){if(_0x1a4e29){var _0x5eddfe=typeof _0x397f56[_0x2348('0x36')]===_0x2348('0x37')&&typeof _0x397f56[_0x2348('0x38')]===_0x2348('0x37');var _0x2e91e8=_0x1a4e29['count'];var _0x35173f=_0x5eddfe?0x0:_0x397f56[_0x2348('0x36')];var _0x2322ce=_0x5eddfe?_0x1a4e29[_0x2348('0x39')]:_0x397f56['offset']+_0x397f56[_0x2348('0x38')];var _0x5a4f96;if(_0x2322ce>=_0x2e91e8){_0x2322ce=_0x2e91e8;_0x5a4f96=0xc8;}else{_0x5a4f96=0xce;}_0x3c8d8b['status'](_0x5a4f96);return _0x3c8d8b[_0x2348('0x3a')](_0x2348('0x3b'),_0x35173f+'-'+_0x2322ce+'/'+_0x2e91e8)[_0x2348('0x35')](_0x1a4e29);}return null;};}function patchUpdates(_0x419274){return function(_0x3e4fef){try{jsonpatch[_0x2348('0x3c')](_0x3e4fef,_0x419274,!![]);}catch(_0x8808ef){return BPromise[_0x2348('0x3d')](_0x8808ef);}return _0x3e4fef[_0x2348('0x3e')]();};}function saveUpdates(_0x403be5,_0x4f0579){return function(_0x17e8d7){if(_0x17e8d7){return _0x17e8d7[_0x2348('0x3f')](_0x403be5)[_0x2348('0x27')](function(_0x1909f2){return _0x1909f2;});}return null;};}function removeEntity(_0x186a16,_0x5817e8){return function(_0x239467){if(_0x239467){return _0x239467[_0x2348('0x40')]()[_0x2348('0x27')](function(){var _0x2748d5=_0x239467[_0x2348('0x41')]({'plain':!![]});var _0x2644d2=_0x2348('0x42');return db[_0x2348('0x43')]['destroy']({'where':{'type':_0x2644d2,'resourceId':_0x2748d5['id']}})[_0x2348('0x27')](function(){return _0x239467;});})['then'](function(){_0x186a16[_0x2348('0x33')](0xcc)[_0x2348('0x34')]();});}};}function handleEntityNotFound(_0x229c42,_0x28079c){return function(_0x2f6057){if(!_0x2f6057){_0x229c42[_0x2348('0x32')](0x194);}return _0x2f6057;};}function handleError(_0x5e8e48,_0x59dee9){_0x59dee9=_0x59dee9||0x1f4;return function(_0x361156){logger[_0x2348('0x2e')](_0x361156['stack']);if(_0x361156[_0x2348('0x44')]){delete _0x361156['name'];}_0x5e8e48['status'](_0x59dee9)[_0x2348('0x45')](_0x361156);};}exports[_0x2348('0x46')]=function(_0x3467d1,_0x402fe){var _0x10cec4={'include':[{'model':db['Pause'],'as':_0x2348('0x47')}]},_0x5ad47a={},_0x2546b4={'count':0x0,'rows':[]};var _0x15c84a=_['map'](db[_0x2348('0x48')][_0x2348('0x49')],function(_0x2b3701){return{'name':_0x2b3701[_0x2348('0x4a')],'type':_0x2b3701[_0x2348('0x4b')]['key']};});_0x5ad47a[_0x2348('0x4c')]=_[_0x2348('0x4d')](_0x15c84a,_0x2348('0x44'));_0x5ad47a[_0x2348('0x4e')]=_[_0x2348('0x4f')](_0x3467d1[_0x2348('0x4e')]);_0x5ad47a[_0x2348('0x50')]=_[_0x2348('0x51')](_0x5ad47a[_0x2348('0x4c')],_0x5ad47a[_0x2348('0x4e')]);_0x10cec4[_0x2348('0x52')]=_[_0x2348('0x51')](_0x5ad47a[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x3467d1[_0x2348('0x4e')]['fields']));_0x10cec4[_0x2348('0x52')]=_0x10cec4[_0x2348('0x52')][_0x2348('0x54')]?_0x10cec4['attributes']:_0x5ad47a[_0x2348('0x4c')];if(!_0x3467d1[_0x2348('0x4e')][_0x2348('0x55')](_0x2348('0x56'))){_0x10cec4[_0x2348('0x38')]=qs['limit'](_0x3467d1[_0x2348('0x4e')][_0x2348('0x38')]);_0x10cec4['offset']=qs[_0x2348('0x36')](_0x3467d1[_0x2348('0x4e')][_0x2348('0x36')]);}_0x10cec4[_0x2348('0x57')]=qs['sort'](_0x3467d1[_0x2348('0x4e')][_0x2348('0x58')]);_0x10cec4[_0x2348('0x59')]=qs[_0x2348('0x50')](_[_0x2348('0x5a')](_0x3467d1['query'],_0x5ad47a['filters']),_0x15c84a);if(_0x3467d1[_0x2348('0x4e')][_0x2348('0x5b')]){_0x10cec4[_0x2348('0x59')]=_['merge'](_0x10cec4[_0x2348('0x59')],{'$or':_[_0x2348('0x4d')](_0x15c84a,function(_0x23c020){if(_0x23c020[_0x2348('0x4b')]!==_0x2348('0x5c')){var _0x4e35c9={};_0x4e35c9[_0x23c020[_0x2348('0x44')]]={'$like':'%'+_0x3467d1[_0x2348('0x4e')][_0x2348('0x5b')]+'%'};return _0x4e35c9;}})});}_0x10cec4=_[_0x2348('0x5d')]({},_0x10cec4,_0x3467d1[_0x2348('0x5e')]);var _0x20b74e={'where':_0x10cec4[_0x2348('0x59')]};return db[_0x2348('0x48')]['count'](_0x20b74e)[_0x2348('0x27')](function(_0x543b62){_0x2546b4[_0x2348('0x39')]=_0x543b62;if(_0x3467d1['query']['includeAll']){_0x10cec4[_0x2348('0x5f')]=[{'all':!![]}];}return db[_0x2348('0x48')][_0x2348('0x60')](_0x10cec4);})[_0x2348('0x27')](function(_0x2aa172){_0x2546b4[_0x2348('0x61')]=_0x2aa172;return _0x2546b4;})[_0x2348('0x27')](respondWithFilteredResult(_0x402fe,_0x10cec4))['catch'](handleError(_0x402fe,null));};exports[_0x2348('0x62')]=function(_0x5baff7,_0x4f8edc){var _0x42b4ea={'raw':![],'where':{'id':_0x5baff7[_0x2348('0x63')]['id']},'include':[{'model':db[_0x2348('0x64')],'as':_0x2348('0x47')}]},_0x4922c9={};_0x4922c9[_0x2348('0x4c')]=_[_0x2348('0x4f')](db[_0x2348('0x48')][_0x2348('0x49')]);_0x4922c9['query']=_[_0x2348('0x4f')](_0x5baff7[_0x2348('0x4e')]);_0x4922c9['filters']=_[_0x2348('0x51')](_0x4922c9[_0x2348('0x4c')],_0x4922c9[_0x2348('0x4e')]);_0x42b4ea[_0x2348('0x52')]=_[_0x2348('0x51')](_0x4922c9[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x5baff7['query'][_0x2348('0x53')]));_0x42b4ea['attributes']=_0x42b4ea[_0x2348('0x52')][_0x2348('0x54')]?_0x42b4ea[_0x2348('0x52')]:_0x4922c9[_0x2348('0x4c')];if(_0x5baff7[_0x2348('0x4e')][_0x2348('0x65')]){_0x42b4ea['include']=[{'all':!![]}];}_0x42b4ea=_[_0x2348('0x5d')]({},_0x42b4ea,_0x5baff7[_0x2348('0x5e')]);return db[_0x2348('0x48')][_0x2348('0x66')](_0x42b4ea)['then'](handleEntityNotFound(_0x4f8edc,null))[_0x2348('0x27')](respondWithResult(_0x4f8edc,null))[_0x2348('0x31')](handleError(_0x4f8edc,null));};exports[_0x2348('0x67')]=function(_0x1590fb,_0x1a43c6){return db[_0x2348('0x48')][_0x2348('0x67')](_0x1590fb[_0x2348('0x68')],{})[_0x2348('0x27')](function(_0x36ffee){var _0x1c5d3b=_0x1590fb['user']['get']({'plain':!![]});if(!_0x1c5d3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c5d3b[_0x2348('0x69')]==='user'){var _0x50c8c9=_0x36ffee['get']({'plain':!![]});var _0x598674=_0x2348('0x42');return db[_0x2348('0x6a')][_0x2348('0x66')]({'where':{'name':_0x598674,'userProfileId':_0x1c5d3b[_0x2348('0x6b')]},'raw':!![]})[_0x2348('0x27')](function(_0x204f23){if(_0x204f23&&_0x204f23[_0x2348('0x6c')]===0x0){return db[_0x2348('0x43')]['create']({'name':_0x50c8c9[_0x2348('0x44')],'resourceId':_0x50c8c9['id'],'type':_0x204f23['name'],'sectionId':_0x204f23['id']},{})[_0x2348('0x27')](function(){return _0x36ffee;});}else{return _0x36ffee;}})['catch'](function(_0x2aac84){logger[_0x2348('0x2e')](_0x2348('0x6d'),_0x2aac84);throw _0x2aac84;});}return _0x36ffee;})[_0x2348('0x27')](respondWithResult(_0x1a43c6,0xc9))['catch'](handleError(_0x1a43c6,null));};exports['update']=function(_0x46ea58,_0x488d8e){if(_0x46ea58[_0x2348('0x68')]['id']){delete _0x46ea58[_0x2348('0x68')]['id'];}return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x46ea58['params']['id']},'include':[{'model':db[_0x2348('0x64')],'as':_0x2348('0x47')}]})[_0x2348('0x27')](handleEntityNotFound(_0x488d8e,null))['then'](saveUpdates(_0x46ea58[_0x2348('0x68')],null))['then'](respondWithResult(_0x488d8e,null))[_0x2348('0x31')](handleError(_0x488d8e,null));};exports['destroy']=function(_0x308325,_0x311221){return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x308325['params']['id']}})['then'](handleEntityNotFound(_0x311221,null))['then'](removeEntity(_0x311221,null))[_0x2348('0x31')](handleError(_0x311221,null));};exports[_0x2348('0x6e')]=function(_0x43d44c,_0x316be0){return db[_0x2348('0x48')][_0x2348('0x6e')]()[_0x2348('0x27')](respondWithResult(_0x316be0,null))['catch'](handleError(_0x316be0,null));};exports[_0x2348('0x6f')]=function(_0x300730,_0x4a2869,_0x3d3417){if(_0x300730[_0x2348('0x68')]['id']){delete _0x300730[_0x2348('0x68')]['id'];}return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x300730[_0x2348('0x63')]['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x4a2869,null))[_0x2348('0x27')](function(_0x157e35){if(_0x157e35){_0x300730[_0x2348('0x68')][_0x2348('0x70')]=_0x157e35['id'];return db[_0x2348('0x71')][_0x2348('0x67')](_0x300730[_0x2348('0x68')]);}})[_0x2348('0x27')](respondWithResult(_0x4a2869,null))[_0x2348('0x31')](handleError(_0x4a2869,null));};exports[_0x2348('0x72')]=function(_0x2e2198,_0x464c50,_0x4471d1){var _0x9d5735={'raw':![],'where':{}};var _0x1e25ca={};var _0x26dcd3={'count':0x0,'rows':[]};return db[_0x2348('0x48')]['findOne']({'where':{'id':_0x2e2198[_0x2348('0x63')]['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x464c50,null))['then'](function(_0x4b37ff){if(_0x4b37ff){_0x1e25ca[_0x2348('0x4c')]=_['keys'](db['Disposition'][_0x2348('0x49')]);_0x1e25ca[_0x2348('0x4e')]=_['keys'](_0x2e2198[_0x2348('0x4e')]);_0x1e25ca[_0x2348('0x50')]=_[_0x2348('0x51')](_0x1e25ca['model'],_0x1e25ca['query']);_0x9d5735['attributes']=_['intersection'](_0x1e25ca[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x2e2198['query'][_0x2348('0x53')]));_0x9d5735[_0x2348('0x52')]=_0x9d5735[_0x2348('0x52')]['length']?_0x9d5735[_0x2348('0x52')]:_0x1e25ca[_0x2348('0x4c')];if(!_0x2e2198['query'][_0x2348('0x55')]('nolimit')){_0x9d5735['limit']=qs['limit'](_0x2e2198['query'][_0x2348('0x38')]);_0x9d5735[_0x2348('0x36')]=qs[_0x2348('0x36')](_0x2e2198[_0x2348('0x4e')]['offset']);}_0x9d5735[_0x2348('0x57')]=qs[_0x2348('0x58')](_0x2e2198[_0x2348('0x4e')]['sort']);_0x9d5735[_0x2348('0x59')]=qs[_0x2348('0x50')](_['pick'](_0x2e2198['query'],_0x1e25ca[_0x2348('0x50')]));_0x9d5735['where'][_0x2348('0x70')]=_0x4b37ff['id'];if(_0x2e2198['query'][_0x2348('0x5b')]){_0x9d5735[_0x2348('0x59')]=_[_0x2348('0x5d')](_0x9d5735['where'],{'$or':_['map'](_0x9d5735[_0x2348('0x52')],function(_0xb50567){var _0x140d90={};_0x140d90[_0xb50567]={'$like':'%'+_0x2e2198[_0x2348('0x4e')][_0x2348('0x5b')]+'%'};return _0x140d90;})});}_0x9d5735=_['merge']({},_0x9d5735,_0x2e2198[_0x2348('0x5e')]);return db[_0x2348('0x71')][_0x2348('0x39')]({'where':_0x9d5735[_0x2348('0x59')]})[_0x2348('0x27')](function(_0x16e935){_0x26dcd3[_0x2348('0x39')]=_0x16e935;if(_0x2e2198['query'][_0x2348('0x65')]){_0x9d5735[_0x2348('0x5f')]=[{'all':!![]}];}return db[_0x2348('0x71')][_0x2348('0x60')](_0x9d5735);})['then'](function(_0x276a4b){_0x26dcd3[_0x2348('0x61')]=_0x276a4b;return _0x26dcd3;});}})['then'](respondWithFilteredResult(_0x464c50,_0x9d5735))[_0x2348('0x31')](handleError(_0x464c50,null));};exports['removeDispositions']=function(_0x1ada9d,_0x26360e,_0x31e410){return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x1ada9d[_0x2348('0x63')]['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x26360e,null))['then'](function(_0x3a4aad){if(_0x3a4aad){return _0x3a4aad[_0x2348('0x73')](_0x1ada9d[_0x2348('0x4e')][_0x2348('0x74')]);}})[_0x2348('0x27')](respondWithStatusCode(_0x26360e,null))[_0x2348('0x31')](handleError(_0x26360e,null));};exports[_0x2348('0x75')]=function(_0x2fe5de,_0x1eb67a,_0x341e0f){if(_0x2fe5de[_0x2348('0x68')]['id']){delete _0x2fe5de[_0x2348('0x68')]['id'];}return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x2fe5de['params']['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x1eb67a,null))['then'](function(_0x585a24){if(_0x585a24){_0x2fe5de[_0x2348('0x68')][_0x2348('0x70')]=_0x585a24['id'];return db[_0x2348('0x76')][_0x2348('0x67')](_0x2fe5de[_0x2348('0x68')]);}})[_0x2348('0x27')](respondWithResult(_0x1eb67a,null))[_0x2348('0x31')](handleError(_0x1eb67a,null));};exports[_0x2348('0x77')]=function(_0x3ced0e,_0x4eb53f,_0x42643a){var _0x573c07={'raw':![],'where':{}};var _0x20d5f1={};var _0x123a4b={'count':0x0,'rows':[]};return db[_0x2348('0x48')][_0x2348('0x78')]({'where':{'id':_0x3ced0e['params']['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x4eb53f,null))['then'](function(_0x5e6b44){if(_0x5e6b44){_0x20d5f1[_0x2348('0x4c')]=_[_0x2348('0x4f')](db[_0x2348('0x76')][_0x2348('0x49')]);_0x20d5f1[_0x2348('0x4e')]=_[_0x2348('0x4f')](_0x3ced0e[_0x2348('0x4e')]);_0x20d5f1['filters']=_[_0x2348('0x51')](_0x20d5f1['model'],_0x20d5f1[_0x2348('0x4e')]);_0x573c07[_0x2348('0x52')]=_[_0x2348('0x51')](_0x20d5f1[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x3ced0e[_0x2348('0x4e')][_0x2348('0x53')]));_0x573c07[_0x2348('0x52')]=_0x573c07['attributes'][_0x2348('0x54')]?_0x573c07[_0x2348('0x52')]:_0x20d5f1[_0x2348('0x4c')];if(!_0x3ced0e[_0x2348('0x4e')]['hasOwnProperty'](_0x2348('0x56'))){_0x573c07['limit']=qs[_0x2348('0x38')](_0x3ced0e[_0x2348('0x4e')][_0x2348('0x38')]);_0x573c07[_0x2348('0x36')]=qs['offset'](_0x3ced0e['query'][_0x2348('0x36')]);}_0x573c07[_0x2348('0x57')]=qs[_0x2348('0x58')](_0x3ced0e[_0x2348('0x4e')][_0x2348('0x58')]);_0x573c07[_0x2348('0x59')]=qs['filters'](_[_0x2348('0x5a')](_0x3ced0e[_0x2348('0x4e')],_0x20d5f1['filters']));_0x573c07[_0x2348('0x59')][_0x2348('0x70')]=_0x5e6b44['id'];if(_0x3ced0e[_0x2348('0x4e')][_0x2348('0x5b')]){_0x573c07['where']=_[_0x2348('0x5d')](_0x573c07[_0x2348('0x59')],{'$or':_[_0x2348('0x4d')](_0x573c07['attributes'],function(_0x2ebee6){var _0xdf4320={};_0xdf4320[_0x2ebee6]={'$like':'%'+_0x3ced0e['query']['filter']+'%'};return _0xdf4320;})});}_0x573c07=_['merge']({},_0x573c07,_0x3ced0e['options']);return db[_0x2348('0x76')][_0x2348('0x39')]({'where':_0x573c07[_0x2348('0x59')]})[_0x2348('0x27')](function(_0x3f73db){_0x123a4b[_0x2348('0x39')]=_0x3f73db;if(_0x3ced0e[_0x2348('0x4e')][_0x2348('0x65')]){_0x573c07['include']=[{'all':!![]}];}return db[_0x2348('0x76')][_0x2348('0x60')](_0x573c07);})['then'](function(_0xc614f8){_0x123a4b[_0x2348('0x61')]=_0xc614f8;return _0x123a4b;});}})[_0x2348('0x27')](respondWithFilteredResult(_0x4eb53f,_0x573c07))['catch'](handleError(_0x4eb53f,null));};exports['removeAnswers']=function(_0x475ff7,_0x2086a6,_0x2ffae9){return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x475ff7['params']['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x2086a6,null))[_0x2348('0x27')](function(_0x2f5e29){if(_0x2f5e29){return _0x2f5e29[_0x2348('0x79')](_0x475ff7[_0x2348('0x4e')][_0x2348('0x74')]);}})[_0x2348('0x27')](respondWithStatusCode(_0x2086a6,null))[_0x2348('0x31')](handleError(_0x2086a6,null));};exports[_0x2348('0x7a')]=function(_0x369d8f,_0x59778d,_0x362886){return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x369d8f[_0x2348('0x63')]['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x59778d,null))[_0x2348('0x27')](function(_0xc9dfdf){if(_0xc9dfdf){return _0xc9dfdf[_0x2348('0x7a')](_0x369d8f['body'][_0x2348('0x74')],_[_0x2348('0x7b')](_0x369d8f[_0x2348('0x68')],[_0x2348('0x74'),'id'])||{})[_0x2348('0x7c')](function(_0x216ea3){for(var _0xe5806b=0x0;_0xe5806b<_0x369d8f[_0x2348('0x68')][_0x2348('0x74')][_0x2348('0x54')];_0xe5806b+=0x1){socket[_0x2348('0x7d')]('userWhatsappAccount:save',{'UserId':Number(_0x369d8f[_0x2348('0x68')]['ids'][_0xe5806b]),'WhatsappAccountId':Number(_0x369d8f['params']['id'])});}return _0x216ea3;});}})[_0x2348('0x27')](respondWithResult(_0x59778d,null))[_0x2348('0x31')](handleError(_0x59778d,null));};exports[_0x2348('0x7e')]=function(_0x3957bd,_0x274756,_0x1de70e){return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x3957bd[_0x2348('0x63')]['id']}})['then'](handleEntityNotFound(_0x274756,null))[_0x2348('0x27')](function(_0x2179e3){if(_0x2179e3){return _0x2179e3[_0x2348('0x7e')](_0x3957bd[_0x2348('0x4e')][_0x2348('0x74')])[_0x2348('0x27')](function(){if(_[_0x2348('0x7f')](_0x3957bd[_0x2348('0x4e')][_0x2348('0x74')])){for(var _0xcfe0e5=0x0;_0xcfe0e5<_0x3957bd[_0x2348('0x4e')][_0x2348('0x74')][_0x2348('0x54')];_0xcfe0e5+=0x1){socket[_0x2348('0x7d')](_0x2348('0x80'),{'UserId':Number(_0x3957bd[_0x2348('0x4e')][_0x2348('0x74')][_0xcfe0e5]),'WhatsappAccountId':Number(_0x3957bd[_0x2348('0x63')]['id'])});}}else{socket[_0x2348('0x7d')](_0x2348('0x80'),{'UserId':Number(_0x3957bd['query'][_0x2348('0x74')]),'WhatsappAccountId':Number(_0x3957bd['params']['id'])});}});}})[_0x2348('0x27')](respondWithStatusCode(_0x274756,null))['catch'](handleError(_0x274756,null));};exports[_0x2348('0x81')]=function(_0x4ef7e6,_0x3664b7,_0x5dac57){var _0x521143={};var _0x371efe={};var _0x5657d3;var _0x5212e7;return db[_0x2348('0x48')][_0x2348('0x78')]({'where':{'id':_0x4ef7e6[_0x2348('0x63')]['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x3664b7,null))[_0x2348('0x27')](function(_0x16e7c7){if(_0x16e7c7){_0x5657d3=_0x16e7c7;_0x371efe[_0x2348('0x4c')]=_[_0x2348('0x4f')](db[_0x2348('0x82')][_0x2348('0x49')]);_0x371efe[_0x2348('0x4e')]=_[_0x2348('0x4f')](_0x4ef7e6[_0x2348('0x4e')]);_0x371efe[_0x2348('0x50')]=_[_0x2348('0x51')](_0x371efe[_0x2348('0x4c')],_0x371efe[_0x2348('0x4e')]);_0x521143[_0x2348('0x52')]=_['intersection'](_0x371efe[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x4ef7e6[_0x2348('0x4e')][_0x2348('0x53')]));_0x521143[_0x2348('0x52')]=_0x521143[_0x2348('0x52')]['length']?_0x521143[_0x2348('0x52')]:_0x371efe[_0x2348('0x4c')];_0x521143[_0x2348('0x57')]=qs['sort'](_0x4ef7e6['query'][_0x2348('0x58')]);_0x521143[_0x2348('0x59')]=qs[_0x2348('0x50')](_[_0x2348('0x5a')](_0x4ef7e6[_0x2348('0x4e')],_0x371efe[_0x2348('0x50')]));if(_0x4ef7e6[_0x2348('0x4e')][_0x2348('0x5b')]){_0x521143[_0x2348('0x59')]=_[_0x2348('0x5d')](_0x521143[_0x2348('0x59')],{'$or':_[_0x2348('0x4d')](_0x521143[_0x2348('0x52')],function(_0x50a29a){var _0x258a0d={};_0x258a0d[_0x50a29a]={'$like':'%'+_0x4ef7e6[_0x2348('0x4e')]['filter']+'%'};return _0x258a0d;})});}_0x521143=_[_0x2348('0x5d')]({},_0x521143,_0x4ef7e6[_0x2348('0x5e')]);return _0x5657d3['getAgents'](_0x521143);}})[_0x2348('0x27')](function(_0xa783c4){if(_0xa783c4){_0x5212e7=_0xa783c4[_0x2348('0x54')];if(!_0x4ef7e6[_0x2348('0x4e')][_0x2348('0x55')](_0x2348('0x56'))){_0x521143[_0x2348('0x38')]=qs[_0x2348('0x38')](_0x4ef7e6[_0x2348('0x4e')][_0x2348('0x38')]);_0x521143[_0x2348('0x36')]=qs['offset'](_0x4ef7e6['query'][_0x2348('0x36')]);}return _0x5657d3[_0x2348('0x81')](_0x521143);}})[_0x2348('0x27')](function(_0x2ea583){if(_0x2ea583){return _0x2ea583?{'count':_0x5212e7,'rows':_0x2ea583}:null;}})[_0x2348('0x27')](respondWithResult(_0x3664b7,null))['catch'](handleError(_0x3664b7,null));};exports[_0x2348('0x83')]=function(_0x568abd,_0x36b33b){var _0x4e22f1=_0x568abd['params']['id'];var _0x4aa410=_0x568abd[_0x2348('0x68')];var _0x20b511=0xc8;var _0x5c540a=null;return db[_0x2348('0x84')][_0x2348('0x85')]({'isolationLevel':db[_0x2348('0x84')][_0x2348('0x86')][_0x2348('0x87')][_0x2348('0x88')]},function(_0x191e3d){return db[_0x2348('0x48')][_0x2348('0x78')]({'where':{'id':_0x4e22f1},'transaction':_0x191e3d})[_0x2348('0x27')](function(_0x14917d){if(_0x14917d){return db[_0x2348('0x89')][_0x2348('0x40')]({'where':{'WhatsappAccountId':_0x4e22f1},'transaction':_0x191e3d})[_0x2348('0x27')](function(){var _0x76c97=_['map'](_0x4aa410,function(_0x2836da){_0x2836da[_0x2348('0x70')]=_0x4e22f1;return _0x2836da;});return db[_0x2348('0x89')][_0x2348('0x8a')](_0x76c97,{'transaction':_0x191e3d});});}else{_0x20b511=0x194;_0x5c540a=[];}});})[_0x2348('0x27')](function(){if(_0x20b511!==0x194){return db['WhatsappApplication'][_0x2348('0x8b')]({'where':{'WhatsappAccountId':_0x4e22f1},'order':_0x2348('0x8c')})[_0x2348('0x27')](function(_0x46ce30){_0x5c540a=_0x46ce30;});}})['catch'](function(_0x292ab0){_0x20b511=0x1f4;logger[_0x2348('0x2e')](_0x292ab0[_0x2348('0x8d')]);if(_0x292ab0[_0x2348('0x44')]){delete _0x292ab0[_0x2348('0x44')];}_0x5c540a=_0x292ab0;})[_0x2348('0x8e')](function(){if(_0x5c540a===null){_0x36b33b[_0x2348('0x32')](_0x20b511);}else{if(_0x20b511===0x1f4){_0x36b33b[_0x2348('0x33')](_0x20b511)[_0x2348('0x45')](_0x5c540a);}else{_0x36b33b[_0x2348('0x33')](_0x20b511)[_0x2348('0x35')](_0x5c540a);}}});};exports['getApplications']=function(_0x38be28,_0x5d1b04,_0x3c5678){var _0x2b5596={};var _0x5b72ae={};var _0x2d7e8b;var _0x4bade7;return db['WhatsappAccount'][_0x2348('0x78')]({'where':{'id':_0x38be28['params']['id']}})[_0x2348('0x27')](handleEntityNotFound(_0x5d1b04,null))[_0x2348('0x27')](function(_0x404f2f){if(_0x404f2f){_0x2d7e8b=_0x404f2f;_0x5b72ae['model']=_['keys'](db['WhatsappApplication'][_0x2348('0x49')]);_0x5b72ae[_0x2348('0x4e')]=_[_0x2348('0x4f')](_0x38be28[_0x2348('0x4e')]);_0x5b72ae[_0x2348('0x50')]=_['intersection'](_0x5b72ae[_0x2348('0x4c')],_0x5b72ae[_0x2348('0x4e')]);_0x2b5596['attributes']=_[_0x2348('0x51')](_0x5b72ae[_0x2348('0x4c')],qs[_0x2348('0x53')](_0x38be28[_0x2348('0x4e')][_0x2348('0x53')]));_0x2b5596['attributes']=_0x2b5596[_0x2348('0x52')]['length']?_0x2b5596['attributes']:_0x5b72ae[_0x2348('0x4c')];_0x2b5596[_0x2348('0x57')]=qs['sort'](_0x38be28['query'][_0x2348('0x58')]);_0x2b5596[_0x2348('0x59')]=qs[_0x2348('0x50')](_[_0x2348('0x5a')](_0x38be28[_0x2348('0x4e')],_0x5b72ae['filters']));if(_0x38be28[_0x2348('0x4e')][_0x2348('0x5b')]){_0x2b5596[_0x2348('0x59')]=_[_0x2348('0x5d')](_0x2b5596[_0x2348('0x59')],{'$or':_['map'](_0x2b5596[_0x2348('0x52')],function(_0x343294){var _0x84006c={};_0x84006c[_0x343294]={'$like':'%'+_0x38be28['query'][_0x2348('0x5b')]+'%'};return _0x84006c;})});}_0x2b5596=_[_0x2348('0x5d')]({},_0x2b5596,_0x38be28[_0x2348('0x5e')]);return _0x2d7e8b[_0x2348('0x8f')](_0x2b5596);}})[_0x2348('0x27')](function(_0x3404f4){if(_0x3404f4){_0x4bade7=_0x3404f4['length'];if(!_0x38be28['query']['hasOwnProperty'](_0x2348('0x56'))){_0x2b5596['limit']=qs[_0x2348('0x38')](_0x38be28[_0x2348('0x4e')][_0x2348('0x38')]);_0x2b5596[_0x2348('0x36')]=qs[_0x2348('0x36')](_0x38be28['query'][_0x2348('0x36')]);}return _0x2d7e8b['getApplications'](_0x2b5596);}})[_0x2348('0x27')](function(_0x4dac25){if(_0x4dac25){return _0x4dac25?{'count':_0x4bade7,'rows':_0x4dac25}:null;}})[_0x2348('0x27')](respondWithResult(_0x5d1b04,null))[_0x2348('0x31')](handleError(_0x5d1b04,null));};exports['notify']=function(_0x59acec,_0x22e058,_0x48a446){var _0x5d6b7f={'channel':_0x2348('0x90')};var _0x1d610a=[];var _0x4a5454=[];var _0x4c8ed7={};return db[_0x2348('0x48')][_0x2348('0x66')]({'where':{'id':_0x59acec[_0x2348('0x63')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x2348('0x91')}]})[_0x2348('0x27')](handleEntityNotFound(_0x22e058,null))[_0x2348('0x27')](function(_0x4c2fb4){_0x5d6b7f[_0x2348('0x92')]=_0x4c2fb4;if(_0x5d6b7f['account']&&_0x5d6b7f[_0x2348('0x92')][_0x2348('0x4b')]===_0x2348('0x93')&&_0x59acec[_0x2348('0x68')][_0x2348('0x94')]){if(_0x59acec[_0x2348('0x68')][_0x2348('0x94')]['length']===0x0)return;if(_0x59acec[_0x2348('0x68')][_0x2348('0x94')][0x0][_0x2348('0x95')]!==_0x2348('0x96'))return;return db['WhatsappMessage'][_0x2348('0x3f')]({'read':!![],'readAt':_0x59acec[_0x2348('0x68')][_0x2348('0x94')][0x0][_0x2348('0x97')]},{'where':{'messageId':_0x59acec['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x1de1e0){return _0x22e058['status'](0xc8)['json'](_0x1de1e0);});}_0x5d6b7f[_0x2348('0x98')]=_[_0x2348('0x99')](_0x4c2fb4[_0x2348('0x91')],[_0x2348('0x8c')],[_0x2348('0x9a')]);if(_0x5d6b7f['account'][_0x2348('0x91')]){delete _0x5d6b7f[_0x2348('0x92')][_0x2348('0x91')];}return db[_0x2348('0x9b')]['describe']()['then'](function(_0x48a350){if(!_0x48a350){throw new db['Sequelize'][(_0x2348('0x9c'))](_0x2348('0x9d'));}_0x1d610a=_[_0x2348('0x9e')](_['keys'](_0x48a350),['createdAt',_0x2348('0x9f')]);_0x4a5454=_[_0x2348('0x9e')](_[_0x2348('0x4f')](_0x48a350),[_0x2348('0xa0'),_0x2348('0x9f'),_0x2348('0xa1'),_0x2348('0xa2')]);_0x5d6b7f['body']={'mapKey':_0x2348('0xa3')};if(_0x5d6b7f['account']&&_0x5d6b7f['account'][_0x2348('0x4b')]===_0x2348('0xa4')){_0x5d6b7f['body']['from']=_0x59acec[_0x2348('0x68')][_0x2348('0xa5')][_0x2348('0xa6')](_0x2348('0xa7'),'');_0x5d6b7f['body'][_0x2348('0x68')]=_0x59acec[_0x2348('0x68')][_0x2348('0xa8')];_0x5d6b7f[_0x2348('0x68')]['messageId']=_0x59acec[_0x2348('0x68')]['MessageSid'];}if(_0x5d6b7f[_0x2348('0x92')]&&_0x5d6b7f[_0x2348('0x92')][_0x2348('0x4b')]===_0x2348('0x93')){_0x5d6b7f['body'][_0x2348('0xa9')]=_0x59acec[_0x2348('0x68')][_0x2348('0xaa')][0x0]['from'];_0x5d6b7f[_0x2348('0x68')][_0x2348('0x68')]=_0x59acec['body']['notifications'][0x0]['message'][_0x2348('0x68')];_0x5d6b7f[_0x2348('0x68')][_0x2348('0xab')]=_0x59acec[_0x2348('0x68')][_0x2348('0xaa')][0x0]['message_id'];}if(_0x5d6b7f[_0x2348('0x68')]['id']){delete _0x5d6b7f[_0x2348('0x68')]['id'];}if(_['isNil'](_0x5d6b7f[_0x2348('0x68')][_0x2348('0xa9')])){throw new db[(_0x2348('0xac'))][(_0x2348('0x9c'))](_0x2348('0xad'));}if(_['isNil'](_0x5d6b7f[_0x2348('0x68')][_0x2348('0x68')])||_0x5d6b7f[_0x2348('0x68')][_0x2348('0x68')]===''){throw new db[(_0x2348('0xac'))]['ValidationError'](_0x2348('0xae'));}if(_[_0x2348('0xaf')](_0x5d6b7f['body'][_0x2348('0xb0')])){throw new db[(_0x2348('0xac'))]['ValidationError'](_0x2348('0xb1')+_0x4a5454);}if(!_[_0x2348('0xb2')](_0x4a5454,_0x5d6b7f[_0x2348('0x68')][_0x2348('0xb0')])){throw new db[(_0x2348('0xac'))]['ValidationError'](_0x2348('0xb3')+_0x4a5454);}_0x4c8ed7[_0x5d6b7f[_0x2348('0x68')][_0x2348('0xb0')]]=_0x5d6b7f[_0x2348('0x68')][_0x2348('0xa9')];return db[_0x2348('0xb4')][_0x2348('0x66')]({'where':{'id':_0x5d6b7f[_0x2348('0x92')][_0x2348('0xa2')]},'include':[{'model':db[_0x2348('0x9b')],'as':'Contacts','where':_0x4c8ed7,'limit':0x1,'order':[['updatedAt',_0x2348('0xb5')]]}]});})[_0x2348('0x27')](handleEntityNotFound(_0x22e058,null))[_0x2348('0x27')](function(_0x33a926){if(_0x33a926){_0x5d6b7f['list']=_[_0x2348('0x7b')](_0x33a926,[_0x2348('0xb6')]);if(_0x33a926[_0x2348('0xb6')][_0x2348('0x54')]){return _0x33a926[_0x2348('0xb6')][0x0];}var _0x123d2a=_[_0x2348('0x1f')](_0x5d6b7f[_0x2348('0x68')],{'firstName':_0x5d6b7f[_0x2348('0x68')]['from'],'ListId':_0x33a926['id']});_0x123d2a[_0x5d6b7f[_0x2348('0x68')]['mapKey']]=_0x5d6b7f['body'][_0x2348('0xa9')];return db['CmContact'][_0x2348('0x67')](_0x123d2a,{'fields':_0x1d610a,'raw':!![]});}})[_0x2348('0x27')](handleEntityNotFound(_0x22e058,null))[_0x2348('0x27')](function(_0x7806dc){if(_0x7806dc){_0x5d6b7f[_0x2348('0xb7')]=_0x7806dc;var _0x26c70e={'ContactId':_0x7806dc['id'],'phone':_0x5d6b7f[_0x2348('0x68')]['from'],'WhatsappAccountId':_0x59acec['params']['id']};var _0x565293={'ContactId':_0x7806dc['id'],'WhatsappAccountId':_0x59acec['params']['id'],'closed':![]};return db[_0x2348('0xb8')][_0x2348('0x66')]({'where':_0x565293})[_0x2348('0x27')](function(_0xd29bb3){if(_0xd29bb3){return[_0xd29bb3,![]];}return db['WhatsappInteraction']['create'](_0x26c70e)[_0x2348('0x27')](function(_0x9d4d5e){return[_0x9d4d5e,!![]];});});}})['spread'](function(_0x64cdf2,_0x4fd1bb){_0x5d6b7f['interaction']=_0x64cdf2['get']({'plain':!![]});_0x5d6b7f[_0x2348('0xb9')][_0x2348('0xba')]=![];if(_0x4fd1bb){if(_0x5d6b7f[_0x2348('0x92')][_0x2348('0xbb')]){_0x5d6b7f['applications'][_0x2348('0xbc')]({'id':0x0,'priority':_0x5d6b7f[_0x2348('0x98')][_0x2348('0x54')]+0x1,'app':_0x2348('0xbd'),'appdata':_0x2348('0xbe'),'interval':_0x2348('0xbf')});}_0x5d6b7f['interaction'][_0x2348('0xba')]=!![];}return db[_0x2348('0xc0')]['create']({'phone':_0x5d6b7f[_0x2348('0x68')][_0x2348('0xa9')],'messageId':_0x5d6b7f['body'][_0x2348('0xab')],'body':_0x5d6b7f[_0x2348('0x68')][_0x2348('0x68')],'WhatsappAccountId':_0x59acec[_0x2348('0x63')]['id'],'WhatsappInteractionId':_0x64cdf2['id'],'direction':'in','ContactId':_0x64cdf2[_0x2348('0xc1')],'AttachmentId':_0x5d6b7f[_0x2348('0x68')][_0x2348('0xc2')]});})[_0x2348('0x27')](function(_0x3aca47){_0x5d6b7f[_0x2348('0x2f')]=_0x3aca47;if(_0x5d6b7f['interaction'][_0x2348('0xc3')]){return db['User']['find']({'attributes':['id',_0x2348('0x44')],'where':{'id':_0x5d6b7f[_0x2348('0xb9')][_0x2348('0xc3')]}})['then'](function(_0x2a1ae8){if(_0x2a1ae8){_0x5d6b7f[_0x2348('0x98')][_0x2348('0xc4')]({'id':0x0,'priority':0x0,'app':_0x2348('0xc5'),'appdata':_0x2a1ae8[_0x2348('0x44')]+','+(_0x5d6b7f[_0x2348('0x92')][_0x2348('0xc6')]||0xa),'interval':_0x2348('0xbf')});}return respondWithRpcPromise(_0x2348('0xc7'),_0x2348('0xc8'),_0x5d6b7f);});}return respondWithRpcPromise(_0x2348('0xc7'),_0x2348('0xc8'),_0x5d6b7f);})[_0x2348('0x27')](function(_0x4e11d5){if(_0x4e11d5){var _0x349bec=0xc8;var _0x23b704=_0x2348('0xc9');logger[_0x2348('0x28')](_0x2348('0x2c'),_0x23b704,_0x349bec,_0x2348('0xca'));logger['debug'](_0x2348('0xcb'),_0x23b704,_0x349bec,'entity\x20found',JSON['stringify'](_0x4e11d5));if(_0x5d6b7f['account'][_0x2348('0x4b')]===_0x2348('0xa4')){return _0x22e058['status'](_0x349bec)[_0x2348('0x3a')](_0x2348('0xcc'),_0x2348('0xcd'))[_0x2348('0x45')](_0x2348('0xce'));}else{return _0x22e058['status'](_0x349bec)[_0x2348('0x35')](_0x4e11d5);}}});})['catch'](handleError(_0x22e058,null));};exports[_0x2348('0x45')]=function(_0x5510cf,_0x3a907e,_0x2a51d4){var _0x11a5c4,_0x26eb26,_0x4465d7;if(_[_0x2348('0xaf')](_0x5510cf[_0x2348('0x68')][_0x2348('0x68')])||_0x5510cf[_0x2348('0x68')]['body']===''){throw new db['Sequelize'][(_0x2348('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2348('0xaf')](_0x5510cf[_0x2348('0x68')]['to'])){throw new db[(_0x2348('0xac'))][(_0x2348('0x9c'))](_0x2348('0xcf'));}_0x11a5c4=_0x5510cf['body']['to'];return db[_0x2348('0x48')]['find']({'where':{'id':_0x5510cf[_0x2348('0x63')]['id']},'include':[{'model':db[_0x2348('0xb4')],'as':_0x2348('0xd0'),'include':[{'model':db[_0x2348('0x9b')],'as':_0x2348('0xb6'),'where':{'mobile':_0x11a5c4},'limit':0x1,'order':[[_0x2348('0x9f'),_0x2348('0xb5')]]}]}]})[_0x2348('0x27')](handleEntityNotFound(_0x3a907e,null))[_0x2348('0x27')](function(_0xeeb3ef){if(_0xeeb3ef&&_0xeeb3ef[_0x2348('0xd0')]){_0x26eb26=_0xeeb3ef[_0x2348('0x41')]({'plain':!![]});if(_0x26eb26[_0x2348('0xd0')]&&_0x26eb26['List']['Contacts'][_0x2348('0x54')]){return _0x26eb26['List']['Contacts'][0x0];}return db[_0x2348('0x9b')][_0x2348('0x67')](_[_0x2348('0x1f')](_0x5510cf['body'],{'firstName':_0x11a5c4,'mobile':_0x11a5c4,'phone':_0x11a5c4,'ListId':_0x26eb26[_0x2348('0xa2')]}));}})[_0x2348('0x27')](handleEntityNotFound(_0x3a907e,null))[_0x2348('0x27')](function(_0x3ebf7f){if(_0x3ebf7f){_0x4465d7=_0x3ebf7f;return db['WhatsappInteraction'][_0x2348('0x66')]({'where':{'ContactId':_0x4465d7['id'],'closed':![],'WhatsappAccountId':_0x26eb26['id']}})[_0x2348('0x27')](function(_0x4f9a2d){if(_0x4f9a2d){return[_0x4f9a2d,![]];}return db['WhatsappInteraction'][_0x2348('0x67')]({'UserId':_0x5510cf['user']['id'],'ContactId':_0x4465d7['id'],'WhatsappAccountId':_0x26eb26['id'],'phone':_0x11a5c4,'firstMsgDirection':_0x2348('0xd1'),'Messages':[_[_0x2348('0x5d')](_0x5510cf[_0x2348('0x68')],{'read':![],'body':_0x5510cf['body'][_0x2348('0x68')],'phone':_0x11a5c4,'WhatsappAccountId':_0x26eb26['id'],'UserId':_0x5510cf['user']['id'],'ContactId':_0x4465d7['id']})]},{'include':[{'model':db[_0x2348('0xc0')],'as':_0x2348('0xd2')}]})['then'](function(_0x39abb3){return[_0x39abb3,!![]];});});}})['spread'](function(_0x7bf1be,_0x1cd356){if(_0x1cd356){return _0x7bf1be;}return db[_0x2348('0xc0')]['create'](_['merge'](_0x5510cf[_0x2348('0x68')],{'read':![],'body':_0x5510cf[_0x2348('0x68')][_0x2348('0x68')],'phone':_0x11a5c4,'WhatsappAccountId':_0x26eb26['id'],'WhatsappInteractionId':_0x7bf1be['id'],'UserId':_0x5510cf[_0x2348('0xd3')]['id'],'ContactId':_0x4465d7['id']}))[_0x2348('0x27')](function(_0x552ef9){_0x7bf1be[_0x2348('0xd4')][_0x2348('0xd2')]=[];_0x7bf1be[_0x2348('0xd4')][_0x2348('0xd2')][_0x2348('0xbc')](_0x552ef9['dataValues']);return _0x7bf1be;});})[_0x2348('0x27')](respondWithResult(_0x3a907e,null))['catch'](handleError(_0x3a907e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7bb0155..cc08512 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 _0xde70=['emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x2ba05d,_0x19cd7b){var _0xe1e7f5=function(_0x359cfc){while(--_0x359cfc){_0x2ba05d['push'](_0x2ba05d['shift']());}};_0xe1e7f5(++_0x19cd7b);}(_0xde70,0x92));var _0x0de7=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0xde70[_0x4b043b];return _0x398f5a;};'use strict';var EventEmitter=require(_0x0de7('0x0'));var WhatsappAccount=require(_0x0de7('0x1'))['db'][_0x0de7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0de7('0x3')](0x0);var events={'afterCreate':_0x0de7('0x4'),'afterUpdate':_0x0de7('0x5'),'afterDestroy':_0x0de7('0x6')};function emitEvent(_0x40f65){return function(_0x5967c0,_0x368fb9,_0x1ab109){WhatsappAccountEvents[_0x0de7('0x7')](_0x40f65+':'+_0x5967c0['id'],_0x5967c0);WhatsappAccountEvents[_0x0de7('0x7')](_0x40f65,_0x5967c0);_0x1ab109(null);};}for(var e in events){if(events[_0x0de7('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x923d=['events','WhatsappAccount','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x29b89e,_0x2d322d){var _0x5ec067=function(_0x55cdc0){while(--_0x55cdc0){_0x29b89e['push'](_0x29b89e['shift']());}};_0x5ec067(++_0x2d322d);}(_0x923d,0xd0));var _0xd923=function(_0x4dd13a,_0x463659){_0x4dd13a=_0x4dd13a-0x0;var _0x59e0af=_0x923d[_0x4dd13a];return _0x59e0af;};'use strict';var EventEmitter=require(_0xd923('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xd923('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd923('0x2'),'afterUpdate':_0xd923('0x3'),'afterDestroy':'remove'};function emitEvent(_0xa5ba08){return function(_0x35c2e7,_0x1108da,_0xe87df9){WhatsappAccountEvents[_0xd923('0x4')](_0xa5ba08+':'+_0x35c2e7['id'],_0x35c2e7);WhatsappAccountEvents[_0xd923('0x4')](_0xa5ba08,_0x35c2e7);_0xe87df9(null);};}for(var e in events){if(events[_0xd923('0x5')](e)){var event=events[e];WhatsappAccount[_0xd923('0x6')](e,emitEvent(event));}}module[_0xd923('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b1c4c95..c265ebe 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 _0xa194=['../../config/logger','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3f6231,_0x1a65db){var _0x48e472=function(_0x2e7d75){while(--_0x2e7d75){_0x3f6231['push'](_0x3f6231['shift']());}};_0x48e472(++_0x1a65db);}(_0xa194,0x1d4));var _0x4a19=function(_0x2b36b0,_0x331282){_0x2b36b0=_0x2b36b0-0x0;var _0x3c0a23=_0xa194[_0x2b36b0];return _0x3c0a23;};'use strict';var _=require(_0x4a19('0x0'));var util=require(_0x4a19('0x1'));var logger=require(_0x4a19('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4a19('0x3'));var rp=require(_0x4a19('0x4'));var fs=require('fs');var path=require(_0x4a19('0x5'));var rimraf=require(_0x4a19('0x6'));var config=require('../../config/environment');var attributes=require(_0x4a19('0x7'));module['exports']=function(_0x300b73,_0x45c95a){return _0x300b73['define'](_0x4a19('0x8'),attributes,{'tableName':_0x4a19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x246b=['../../config/logger','api','moment','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x265ecd,_0xd1d67b){var _0x341789=function(_0x107ca8){while(--_0x107ca8){_0x265ecd['push'](_0x265ecd['shift']());}};_0x341789(++_0xd1d67b);}(_0x246b,0x1c5));var _0xb246=function(_0x1a8ba5,_0x1705a6){_0x1a8ba5=_0x1a8ba5-0x0;var _0x523a0d=_0x246b[_0x1a8ba5];return _0x523a0d;};'use strict';var _=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var logger=require(_0xb246('0x2'))(_0xb246('0x3'));var moment=require(_0xb246('0x4'));var BPromise=require('bluebird');var rp=require(_0xb246('0x5'));var fs=require('fs');var path=require(_0xb246('0x6'));var rimraf=require(_0xb246('0x7'));var config=require('../../config/environment');var attributes=require(_0xb246('0x8'));module[_0xb246('0x9')]=function(_0x1acf81,_0x2c69c6){return _0x1acf81[_0xb246('0xa')](_0xb246('0xb'),attributes,{'tableName':_0xb246('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index fe69f9a..bfce405 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 _0x5bfd=['options','raw','where','attributes','include','model','map','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','defaults','localhost','redis','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bfd,0x1f1));var _0xd5bf=function(_0x4752d9,_0x27151a){_0x4752d9=_0x4752d9-0x0;var _0x49a45b=_0x5bfd[_0x4752d9];return _0x49a45b;};'use strict';var _=require('lodash');var util=require(_0xd5bf('0x0'));var moment=require(_0xd5bf('0x1'));var BPromise=require(_0xd5bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5bf('0x3'));var db=require(_0xd5bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5bf('0x5'));var config=require(_0xd5bf('0x6'));var jayson=require(_0xd5bf('0x7'));var client=jayson[_0xd5bf('0x8')]['http']({'port':0x232a});config['redis']=_[_0xd5bf('0x9')](config['redis'],{'host':_0xd5bf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5bf('0xb')]));require(_0xd5bf('0xc'))[_0xd5bf('0xd')](socket);function respondWithRpcPromise(_0x3894e2,_0x7f1d85,_0x4f6c8c){return new BPromise(function(_0x44aec7,_0x3ed242){return client['request'](_0x3894e2,_0x4f6c8c)[_0xd5bf('0xe')](function(_0x675061){logger[_0xd5bf('0xf')](_0xd5bf('0x10'),_0x7f1d85,_0xd5bf('0x11'));logger[_0xd5bf('0x12')](_0xd5bf('0x13'),_0x7f1d85,'request\x20sent',JSON['stringify'](_0x675061));if(_0x675061[_0xd5bf('0x14')]){if(_0x675061[_0xd5bf('0x14')][_0xd5bf('0x15')]===0x1f4){logger[_0xd5bf('0x14')](_0xd5bf('0x10'),_0x7f1d85,_0x675061[_0xd5bf('0x14')]['message']);return _0x3ed242(_0x675061[_0xd5bf('0x14')][_0xd5bf('0x16')]);}logger[_0xd5bf('0x14')](_0xd5bf('0x10'),_0x7f1d85,_0x675061[_0xd5bf('0x14')][_0xd5bf('0x16')]);return _0x44aec7(_0x675061['error'][_0xd5bf('0x16')]);}else{logger[_0xd5bf('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x7f1d85,'request\x20sent');_0x44aec7(_0x675061[_0xd5bf('0x17')][_0xd5bf('0x16')]);}})[_0xd5bf('0x18')](function(_0x5c3e05){logger[_0xd5bf('0x14')](_0xd5bf('0x10'),_0x7f1d85,_0x5c3e05);_0x3ed242(_0x5c3e05);});});}exports[_0xd5bf('0x19')]=function(_0x59cc70){var _0x4ec32a=this;return new Promise(function(_0x6dcf41,_0x5c8029){return db[_0xd5bf('0x1a')][_0xd5bf('0x1b')]({'raw':_0x59cc70['options']?_0x59cc70[_0xd5bf('0x1c')][_0xd5bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x59cc70['options']?_0x59cc70[_0xd5bf('0x1c')][_0xd5bf('0x1e')]||null:null,'attributes':_0x59cc70[_0xd5bf('0x1c')]?_0x59cc70['options'][_0xd5bf('0x1f')]||null:null,'include':_0x59cc70[_0xd5bf('0x1c')]?_0x59cc70[_0xd5bf('0x1c')][_0xd5bf('0x20')]?_['map'](_0x59cc70[_0xd5bf('0x1c')]['include'],function(_0x1aeb79){return{'model':db[_0x1aeb79[_0xd5bf('0x21')]],'as':_0x1aeb79['as'],'attributes':_0x1aeb79['attributes'],'include':_0x1aeb79['include']?_[_0xd5bf('0x22')](_0x1aeb79[_0xd5bf('0x20')],function(_0x24cda1){return{'model':db[_0x24cda1[_0xd5bf('0x21')]],'as':_0x24cda1['as'],'attributes':_0x24cda1[_0xd5bf('0x1f')],'include':_0x24cda1['include']?_['map'](_0x24cda1[_0xd5bf('0x20')],function(_0x5d32cf){return{'model':db[_0x5d32cf['model']],'as':_0x5d32cf['as'],'attributes':_0x5d32cf[_0xd5bf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd5bf('0xe')](function(_0x1d4af8){logger[_0xd5bf('0xf')](_0xd5bf('0x19'),_0x59cc70);logger['debug'](_0xd5bf('0x19'),_0x59cc70,JSON['stringify'](_0x1d4af8));_0x6dcf41(_0x1d4af8);})['catch'](function(_0x1084f2){logger[_0xd5bf('0x14')]('ShowWhatsappAccount',_0x1084f2[_0xd5bf('0x16')],_0x59cc70);_0x5c8029(_0x4ec32a['error'](0x1f4,_0x1084f2['message']));});});}; \ No newline at end of file +var _0x5a8a=['options','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','find'];(function(_0x9376c0,_0x256019){var _0x3971d1=function(_0x52747c){while(--_0x52747c){_0x9376c0['push'](_0x9376c0['shift']());}};_0x3971d1(++_0x256019);}(_0x5a8a,0x19d));var _0xa5a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5a8a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa5a8('0x0'));var util=require(_0xa5a8('0x1'));var moment=require('moment');var BPromise=require(_0xa5a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5a8('0x3'));var db=require(_0xa5a8('0x4'))['db'];var utils=require(_0xa5a8('0x5'));var logger=require(_0xa5a8('0x6'))(_0xa5a8('0x7'));var config=require('../../config/environment');var jayson=require(_0xa5a8('0x8'));var client=jayson[_0xa5a8('0x9')]['http']({'port':0x232a});config[_0xa5a8('0xa')]=_[_0xa5a8('0xb')](config[_0xa5a8('0xa')],{'host':_0xa5a8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5a8('0xa')]));require(_0xa5a8('0xd'))[_0xa5a8('0xe')](socket);function respondWithRpcPromise(_0x355e68,_0xfc342f,_0x2bacfe){return new BPromise(function(_0x4a4d4e,_0x26f3c7){return client[_0xa5a8('0xf')](_0x355e68,_0x2bacfe)[_0xa5a8('0x10')](function(_0x16c7c6){logger[_0xa5a8('0x11')](_0xa5a8('0x12'),_0xfc342f,_0xa5a8('0x13'));logger[_0xa5a8('0x14')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xfc342f,_0xa5a8('0x13'),JSON[_0xa5a8('0x15')](_0x16c7c6));if(_0x16c7c6['error']){if(_0x16c7c6[_0xa5a8('0x16')][_0xa5a8('0x17')]===0x1f4){logger[_0xa5a8('0x16')](_0xa5a8('0x12'),_0xfc342f,_0x16c7c6[_0xa5a8('0x16')][_0xa5a8('0x18')]);return _0x26f3c7(_0x16c7c6[_0xa5a8('0x16')][_0xa5a8('0x18')]);}logger[_0xa5a8('0x16')](_0xa5a8('0x12'),_0xfc342f,_0x16c7c6[_0xa5a8('0x16')][_0xa5a8('0x18')]);return _0x4a4d4e(_0x16c7c6[_0xa5a8('0x16')]['message']);}else{logger[_0xa5a8('0x11')](_0xa5a8('0x12'),_0xfc342f,_0xa5a8('0x13'));_0x4a4d4e(_0x16c7c6[_0xa5a8('0x19')][_0xa5a8('0x18')]);}})[_0xa5a8('0x1a')](function(_0x55d37f){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xfc342f,_0x55d37f);_0x26f3c7(_0x55d37f);});});}exports[_0xa5a8('0x1b')]=function(_0x441625){var _0x27037f=this;return new Promise(function(_0x2d2bb8,_0x4a3d2d){return db['WhatsappAccount'][_0xa5a8('0x1c')]({'raw':_0x441625[_0xa5a8('0x1d')]?_0x441625['options']['raw']===undefined?!![]:![]:!![],'where':_0x441625[_0xa5a8('0x1d')]?_0x441625['options']['where']||null:null,'attributes':_0x441625[_0xa5a8('0x1d')]?_0x441625[_0xa5a8('0x1d')][_0xa5a8('0x1e')]||null:null,'include':_0x441625[_0xa5a8('0x1d')]?_0x441625[_0xa5a8('0x1d')][_0xa5a8('0x1f')]?_[_0xa5a8('0x20')](_0x441625[_0xa5a8('0x1d')][_0xa5a8('0x1f')],function(_0x12116b){return{'model':db[_0x12116b['model']],'as':_0x12116b['as'],'attributes':_0x12116b['attributes'],'include':_0x12116b['include']?_[_0xa5a8('0x20')](_0x12116b[_0xa5a8('0x1f')],function(_0x5b0efa){return{'model':db[_0x5b0efa['model']],'as':_0x5b0efa['as'],'attributes':_0x5b0efa[_0xa5a8('0x1e')],'include':_0x5b0efa['include']?_['map'](_0x5b0efa[_0xa5a8('0x1f')],function(_0x18ee54){return{'model':db[_0x18ee54[_0xa5a8('0x21')]],'as':_0x18ee54['as'],'attributes':_0x18ee54[_0xa5a8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa5a8('0x10')](function(_0x2d5aa6){logger[_0xa5a8('0x11')](_0xa5a8('0x1b'),_0x441625);logger[_0xa5a8('0x14')]('ShowWhatsappAccount',_0x441625,JSON[_0xa5a8('0x15')](_0x2d5aa6));_0x2d2bb8(_0x2d5aa6);})[_0xa5a8('0x1a')](function(_0x1626c9){logger[_0xa5a8('0x16')](_0xa5a8('0x1b'),_0x1626c9['message'],_0x441625);_0x4a3d2d(_0x27037f['error'](0x1f4,_0x1626c9[_0xa5a8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6aa59a5..af6c005 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 _0x6069=['update','emit','register','length','./whatsappAccount.events','save','remove'];(function(_0x532ff6,_0x11b57b){var _0x3f83c7=function(_0x21b46f){while(--_0x21b46f){_0x532ff6['push'](_0x532ff6['shift']());}};_0x3f83c7(++_0x11b57b);}(_0x6069,0x66));var _0x9606=function(_0x1d9a6c,_0x396228){_0x1d9a6c=_0x1d9a6c-0x0;var _0x22cd0f=_0x6069[_0x1d9a6c];return _0x22cd0f;};'use strict';var WhatsappAccountEvents=require(_0x9606('0x0'));var events=[_0x9606('0x1'),_0x9606('0x2'),_0x9606('0x3')];function createListener(_0x1957a2,_0x2fc616){return function(_0x28d9d5){_0x2fc616[_0x9606('0x4')](_0x1957a2,_0x28d9d5);};}function removeListener(_0x246237,_0x564570){return function(){WhatsappAccountEvents['removeListener'](_0x246237,_0x564570);};}exports[_0x9606('0x5')]=function(_0x2718e3){for(var _0x33d8d3=0x0,_0x5977eb=events[_0x9606('0x6')];_0x33d8d3<_0x5977eb;_0x33d8d3++){var _0x41d11b=events[_0x33d8d3];var _0x52f174=createListener('whatsappAccount:'+_0x41d11b,_0x2718e3);WhatsappAccountEvents['on'](_0x41d11b,_0x52f174);}}; \ No newline at end of file +var _0x4c15=['save','update','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4c15,0x68));var _0x54c1=function(_0x2463e2,_0x1a75c9){_0x2463e2=_0x2463e2-0x0;var _0x358990=_0x4c15[_0x2463e2];return _0x358990;};'use strict';var WhatsappAccountEvents=require(_0x54c1('0x0'));var events=[_0x54c1('0x1'),'remove',_0x54c1('0x2')];function createListener(_0x2ea578,_0x1aede1){return function(_0x43f807){_0x1aede1[_0x54c1('0x3')](_0x2ea578,_0x43f807);};}function removeListener(_0x51f5a5,_0x150f37){return function(){WhatsappAccountEvents[_0x54c1('0x4')](_0x51f5a5,_0x150f37);};}exports['register']=function(_0x3b2fb6){for(var _0xb0988c=0x0,_0x165265=events[_0x54c1('0x5')];_0xb0988c<_0x165265;_0xb0988c++){var _0x399888=events[_0xb0988c];var _0x615625=createListener(_0x54c1('0x6')+_0x399888,_0x3b2fb6);WhatsappAccountEvents['on'](_0x399888,_0x615625);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f2f4ad9..1099686 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 _0x1419=['put','update','destroy','exports','multer','util','express','Router','./whatsappApplication.controller','get','index','/:id','show','post','create'];(function(_0x1eaac2,_0x545f4a){var _0x4e8229=function(_0x1d4dbb){while(--_0x1d4dbb){_0x1eaac2['push'](_0x1eaac2['shift']());}};_0x4e8229(++_0x545f4a);}(_0x1419,0x103));var _0x9141=function(_0x196b3d,_0x1cb4f8){_0x196b3d=_0x196b3d-0x0;var _0x425502=_0x1419[_0x196b3d];return _0x425502;};'use strict';var multer=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9141('0x2'));var router=express[_0x9141('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(_0x9141('0x4'));router[_0x9141('0x5')]('/',auth['isAuthenticated'](),controller[_0x9141('0x6')]);router['get'](_0x9141('0x7'),auth['isAuthenticated'](),controller[_0x9141('0x8')]);router[_0x9141('0x9')]('/',auth['isAuthenticated'](),controller[_0x9141('0xa')]);router[_0x9141('0xb')](_0x9141('0x7'),auth['isAuthenticated'](),controller[_0x9141('0xc')]);router['delete'](_0x9141('0x7'),auth['isAuthenticated'](),controller[_0x9141('0xd')]);module[_0x9141('0xe')]=router; \ No newline at end of file +var _0xaec9=['post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','index','isAuthenticated'];(function(_0x207030,_0x392c00){var _0x1bbf74=function(_0x1ad852){while(--_0x1ad852){_0x207030['push'](_0x207030['shift']());}};_0x1bbf74(++_0x392c00);}(_0xaec9,0x1da));var _0x9aec=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xaec9[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x9aec('0x0'));var util=require(_0x9aec('0x1'));var path=require(_0x9aec('0x2'));var timeout=require(_0x9aec('0x3'));var express=require(_0x9aec('0x4'));var router=express[_0x9aec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9aec('0x6'));var interaction=require(_0x9aec('0x7'));var config=require('../../config/environment');var controller=require(_0x9aec('0x8'));router[_0x9aec('0x9')]('/',auth['isAuthenticated'](),controller[_0x9aec('0xa')]);router['get']('/:id',auth[_0x9aec('0xb')](),controller['show']);router[_0x9aec('0xc')]('/',auth[_0x9aec('0xb')](),controller[_0x9aec('0xd')]);router[_0x9aec('0xe')](_0x9aec('0xf'),auth[_0x9aec('0xb')](),controller[_0x9aec('0x10')]);router['delete'](_0x9aec('0xf'),auth[_0x9aec('0xb')](),controller[_0x9aec('0x11')]);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 00eadcf..274e6a5 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 _0x38a0=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x40d020,_0x4879e9){var _0x364d92=function(_0x1ee137){while(--_0x1ee137){_0x40d020['push'](_0x40d020['shift']());}};_0x364d92(++_0x4879e9);}(_0x38a0,0x84));var _0x038a=function(_0x46c139,_0x4a7bd8){_0x46c139=_0x46c139-0x0;var _0x5a1e47=_0x38a0[_0x46c139];return _0x5a1e47;};'use strict';var Sequelize=require(_0x038a('0x0'));module[_0x038a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x038a('0x2')],'allowNull':![],'defaultValue':_0x038a('0x3')},'appdata':{'type':Sequelize[_0x038a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x038a('0x2')],'defaultValue':_0x038a('0x5')}}; \ No newline at end of file +var _0xfb03=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x2a620b,_0x5b4ffe){var _0x5ba14e=function(_0xc3d39e){while(--_0xc3d39e){_0x2a620b['push'](_0x2a620b['shift']());}};_0x5ba14e(++_0x5b4ffe);}(_0xfb03,0x197));var _0x3fb0=function(_0x5d246a,_0x4fe603){_0x5d246a=_0x5d246a-0x0;var _0x2267d2=_0xfb03[_0x5d246a];return _0x2267d2;};'use strict';var Sequelize=require(_0x3fb0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3fb0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3fb0('0x2')],'allowNull':![],'defaultValue':_0x3fb0('0x3')},'appdata':{'type':Sequelize[_0x3fb0('0x4')]()},'description':{'type':Sequelize[_0x3fb0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e19036c..85fd990 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 _0x7031=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','WhatsappApplication','include','findAll','rows','show','params','includeAll','catch','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','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','sendStatus','status','end','offset','undefined','count','Content-Range','json','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x491552,_0x6f69c3){var _0x2b8322=function(_0x4196f6){while(--_0x4196f6){_0x491552['push'](_0x491552['shift']());}};_0x2b8322(++_0x6f69c3);}(_0x7031,0x19a));var _0x1703=function(_0x3a6bdc,_0x1b8897){_0x3a6bdc=_0x3a6bdc-0x0;var _0x4b27d7=_0x7031[_0x3a6bdc];return _0x4b27d7;};'use strict';var emlformat=require(_0x1703('0x0'));var rimraf=require(_0x1703('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1703('0x2'));var rp=require(_0x1703('0x3'));var moment=require('moment');var BPromise=require(_0x1703('0x4'));var Mustache=require(_0x1703('0x5'));var util=require('util');var path=require(_0x1703('0x6'));var sox=require(_0x1703('0x7'));var csv=require('to-csv');var ejs=require(_0x1703('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1703('0x9'));var squel=require(_0x1703('0xa'));var crypto=require(_0x1703('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1703('0xc'));var toCsv=require(_0x1703('0xd'));var querystring=require(_0x1703('0xe'));var Papa=require('papaparse');var Redis=require(_0x1703('0xf'));var authService=require(_0x1703('0x10'));var qs=require(_0x1703('0x11'));var as=require(_0x1703('0x12'));var hardwareService=require(_0x1703('0x13'));var logger=require(_0x1703('0x14'))(_0x1703('0x15'));var utils=require(_0x1703('0x16'));var config=require(_0x1703('0x17'));var licenseUtil=require(_0x1703('0x18'));var db=require(_0x1703('0x19'))['db'];function respondWithStatusCode(_0x3cfcec,_0x157055){_0x157055=_0x157055||0xcc;return function(_0x24b81e){if(_0x24b81e){return _0x3cfcec[_0x1703('0x1a')](_0x157055);}return _0x3cfcec[_0x1703('0x1b')](_0x157055)[_0x1703('0x1c')]();};}function respondWithResult(_0x572b96,_0x51b2b8){_0x51b2b8=_0x51b2b8||0xc8;return function(_0x3bea9e){if(_0x3bea9e){return _0x572b96[_0x1703('0x1b')](_0x51b2b8)['json'](_0x3bea9e);}};}function respondWithFilteredResult(_0x5c5371,_0x46e1bc){return function(_0x3f6367){if(_0x3f6367){var _0x4c41a3=typeof _0x46e1bc[_0x1703('0x1d')]===_0x1703('0x1e')&&typeof _0x46e1bc['limit']===_0x1703('0x1e');var _0x77b9ea=_0x3f6367[_0x1703('0x1f')];var _0x3c0695=_0x4c41a3?0x0:_0x46e1bc[_0x1703('0x1d')];var _0x5c9668=_0x4c41a3?_0x3f6367[_0x1703('0x1f')]:_0x46e1bc['offset']+_0x46e1bc['limit'];var _0x4ccc42;if(_0x5c9668>=_0x77b9ea){_0x5c9668=_0x77b9ea;_0x4ccc42=0xc8;}else{_0x4ccc42=0xce;}_0x5c5371[_0x1703('0x1b')](_0x4ccc42);return _0x5c5371['set'](_0x1703('0x20'),_0x3c0695+'-'+_0x5c9668+'/'+_0x77b9ea)[_0x1703('0x21')](_0x3f6367);}return null;};}function patchUpdates(_0xda335){return function(_0x56444e){try{jsonpatch['apply'](_0x56444e,_0xda335,!![]);}catch(_0x3de8a8){return BPromise[_0x1703('0x22')](_0x3de8a8);}return _0x56444e[_0x1703('0x23')]();};}function saveUpdates(_0x2bf640,_0x4b7323){return function(_0x374175){if(_0x374175){return _0x374175['update'](_0x2bf640)[_0x1703('0x24')](function(_0x30c2b5){return _0x30c2b5;});}return null;};}function removeEntity(_0x962021,_0x2d6cdf){return function(_0x2a931d){if(_0x2a931d){return _0x2a931d['destroy']()['then'](function(){_0x962021[_0x1703('0x1b')](0xcc)[_0x1703('0x1c')]();});}};}function handleEntityNotFound(_0x203205,_0x4ee3c1){return function(_0x3c23ea){if(!_0x3c23ea){_0x203205[_0x1703('0x1a')](0x194);}return _0x3c23ea;};}function handleError(_0x2be6a7,_0x18e983){_0x18e983=_0x18e983||0x1f4;return function(_0x59b809){logger['error'](_0x59b809[_0x1703('0x25')]);if(_0x59b809[_0x1703('0x26')]){delete _0x59b809['name'];}_0x2be6a7[_0x1703('0x1b')](_0x18e983)[_0x1703('0x27')](_0x59b809);};}exports[_0x1703('0x28')]=function(_0x25be97,_0x525f06){var _0x5d5ded={},_0x4e2d3e={},_0x393fec={'count':0x0,'rows':[]};var _0x3c4ccf=_[_0x1703('0x29')](db['WhatsappApplication'][_0x1703('0x2a')],function(_0x179082){return{'name':_0x179082[_0x1703('0x2b')],'type':_0x179082[_0x1703('0x2c')][_0x1703('0x2d')]};});_0x4e2d3e[_0x1703('0x2e')]=_['map'](_0x3c4ccf,_0x1703('0x26'));_0x4e2d3e[_0x1703('0x2f')]=_[_0x1703('0x30')](_0x25be97[_0x1703('0x2f')]);_0x4e2d3e['filters']=_[_0x1703('0x31')](_0x4e2d3e['model'],_0x4e2d3e[_0x1703('0x2f')]);_0x5d5ded[_0x1703('0x32')]=_['intersection'](_0x4e2d3e['model'],qs[_0x1703('0x33')](_0x25be97[_0x1703('0x2f')]['fields']));_0x5d5ded[_0x1703('0x32')]=_0x5d5ded[_0x1703('0x32')][_0x1703('0x34')]?_0x5d5ded[_0x1703('0x32')]:_0x4e2d3e['model'];if(!_0x25be97['query'][_0x1703('0x35')](_0x1703('0x36'))){_0x5d5ded[_0x1703('0x37')]=qs[_0x1703('0x37')](_0x25be97[_0x1703('0x2f')][_0x1703('0x37')]);_0x5d5ded[_0x1703('0x1d')]=qs[_0x1703('0x1d')](_0x25be97[_0x1703('0x2f')]['offset']);}_0x5d5ded[_0x1703('0x38')]=qs['sort'](_0x25be97[_0x1703('0x2f')][_0x1703('0x39')]);_0x5d5ded[_0x1703('0x3a')]=qs[_0x1703('0x3b')](_[_0x1703('0x3c')](_0x25be97[_0x1703('0x2f')],_0x4e2d3e['filters']),_0x3c4ccf);if(_0x25be97['query'][_0x1703('0x3d')]){_0x5d5ded[_0x1703('0x3a')]=_['merge'](_0x5d5ded[_0x1703('0x3a')],{'$or':_[_0x1703('0x29')](_0x3c4ccf,function(_0x35e8e0){if(_0x35e8e0[_0x1703('0x2c')]!==_0x1703('0x3e')){var _0x1c5488={};_0x1c5488[_0x35e8e0[_0x1703('0x26')]]={'$like':'%'+_0x25be97[_0x1703('0x2f')][_0x1703('0x3d')]+'%'};return _0x1c5488;}})});}_0x5d5ded=_[_0x1703('0x3f')]({},_0x5d5ded,_0x25be97[_0x1703('0x40')]);var _0x15d9db={'where':_0x5d5ded[_0x1703('0x3a')]};return db[_0x1703('0x41')][_0x1703('0x1f')](_0x15d9db)[_0x1703('0x24')](function(_0x26c7af){_0x393fec['count']=_0x26c7af;if(_0x25be97['query']['includeAll']){_0x5d5ded[_0x1703('0x42')]=[{'all':!![]}];}return db[_0x1703('0x41')][_0x1703('0x43')](_0x5d5ded);})['then'](function(_0x648f15){_0x393fec[_0x1703('0x44')]=_0x648f15;return _0x393fec;})[_0x1703('0x24')](respondWithFilteredResult(_0x525f06,_0x5d5ded))['catch'](handleError(_0x525f06,null));};exports[_0x1703('0x45')]=function(_0x194b4e,_0x37ac42){var _0x320723={'raw':!![],'where':{'id':_0x194b4e[_0x1703('0x46')]['id']}},_0x34b455={};_0x34b455['model']=_['keys'](db[_0x1703('0x41')]['rawAttributes']);_0x34b455[_0x1703('0x2f')]=_[_0x1703('0x30')](_0x194b4e[_0x1703('0x2f')]);_0x34b455[_0x1703('0x3b')]=_[_0x1703('0x31')](_0x34b455[_0x1703('0x2e')],_0x34b455[_0x1703('0x2f')]);_0x320723['attributes']=_[_0x1703('0x31')](_0x34b455[_0x1703('0x2e')],qs[_0x1703('0x33')](_0x194b4e[_0x1703('0x2f')][_0x1703('0x33')]));_0x320723[_0x1703('0x32')]=_0x320723['attributes'][_0x1703('0x34')]?_0x320723[_0x1703('0x32')]:_0x34b455['model'];if(_0x194b4e[_0x1703('0x2f')][_0x1703('0x47')]){_0x320723[_0x1703('0x42')]=[{'all':!![]}];}_0x320723=_[_0x1703('0x3f')]({},_0x320723,_0x194b4e[_0x1703('0x40')]);return db[_0x1703('0x41')]['find'](_0x320723)[_0x1703('0x24')](handleEntityNotFound(_0x37ac42,null))['then'](respondWithResult(_0x37ac42,null))[_0x1703('0x48')](handleError(_0x37ac42,null));};exports[_0x1703('0x49')]=function(_0x3682ce,_0x55d96f){return db['WhatsappApplication']['create'](_0x3682ce[_0x1703('0x4a')],{})[_0x1703('0x24')](respondWithResult(_0x55d96f,0xc9))[_0x1703('0x48')](handleError(_0x55d96f,null));};exports['update']=function(_0x1bb341,_0x11c759){if(_0x1bb341[_0x1703('0x4a')]['id']){delete _0x1bb341[_0x1703('0x4a')]['id'];}return db[_0x1703('0x41')][_0x1703('0x4b')]({'where':{'id':_0x1bb341[_0x1703('0x46')]['id']}})[_0x1703('0x24')](handleEntityNotFound(_0x11c759,null))[_0x1703('0x24')](saveUpdates(_0x1bb341['body'],null))[_0x1703('0x24')](respondWithResult(_0x11c759,null))[_0x1703('0x48')](handleError(_0x11c759,null));};exports[_0x1703('0x4c')]=function(_0x2541b6,_0xb08f79){return db[_0x1703('0x41')]['find']({'where':{'id':_0x2541b6['params']['id']}})['then'](handleEntityNotFound(_0xb08f79,null))[_0x1703('0x24')](removeEntity(_0xb08f79,null))['catch'](handleError(_0xb08f79,null));}; \ No newline at end of file +var _0xa3e8=['options','include','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x22fb94,_0x9a235c){var _0x33da77=function(_0x58edb8){while(--_0x58edb8){_0x22fb94['push'](_0x22fb94['shift']());}};_0x33da77(++_0x9a235c);}(_0xa3e8,0x127));var _0x8a3e=function(_0x1bab79,_0x484d83){_0x1bab79=_0x1bab79-0x0;var _0x41bed5=_0xa3e8[_0x1bab79];return _0x41bed5;};'use strict';var emlformat=require(_0x8a3e('0x0'));var rimraf=require(_0x8a3e('0x1'));var zipdir=require(_0x8a3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3e('0x3'));var moment=require(_0x8a3e('0x4'));var BPromise=require(_0x8a3e('0x5'));var Mustache=require(_0x8a3e('0x6'));var util=require(_0x8a3e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x8a3e('0x9'));var _=require(_0x8a3e('0xa'));var squel=require('squel');var crypto=require(_0x8a3e('0xb'));var jsforce=require(_0x8a3e('0xc'));var deskjs=require(_0x8a3e('0xd'));var toCsv=require(_0x8a3e('0xe'));var querystring=require(_0x8a3e('0xf'));var Papa=require(_0x8a3e('0x10'));var Redis=require(_0x8a3e('0x11'));var authService=require(_0x8a3e('0x12'));var qs=require(_0x8a3e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a3e('0x14'));var logger=require(_0x8a3e('0x15'))(_0x8a3e('0x16'));var utils=require('../../config/utils');var config=require(_0x8a3e('0x17'));var licenseUtil=require(_0x8a3e('0x18'));var db=require(_0x8a3e('0x19'))['db'];function respondWithStatusCode(_0x365ea5,_0x4731ca){_0x4731ca=_0x4731ca||0xcc;return function(_0x23eb66){if(_0x23eb66){return _0x365ea5[_0x8a3e('0x1a')](_0x4731ca);}return _0x365ea5[_0x8a3e('0x1b')](_0x4731ca)[_0x8a3e('0x1c')]();};}function respondWithResult(_0x4290ab,_0xd50736){_0xd50736=_0xd50736||0xc8;return function(_0x2f6305){if(_0x2f6305){return _0x4290ab[_0x8a3e('0x1b')](_0xd50736)['json'](_0x2f6305);}};}function respondWithFilteredResult(_0x48585f,_0x2676a8){return function(_0x259fd9){if(_0x259fd9){var _0xe302f3=typeof _0x2676a8[_0x8a3e('0x1d')]===_0x8a3e('0x1e')&&typeof _0x2676a8['limit']===_0x8a3e('0x1e');var _0x5aec3d=_0x259fd9['count'];var _0x2f0b46=_0xe302f3?0x0:_0x2676a8[_0x8a3e('0x1d')];var _0xcb1a1f=_0xe302f3?_0x259fd9[_0x8a3e('0x1f')]:_0x2676a8[_0x8a3e('0x1d')]+_0x2676a8[_0x8a3e('0x20')];var _0x18bb0e;if(_0xcb1a1f>=_0x5aec3d){_0xcb1a1f=_0x5aec3d;_0x18bb0e=0xc8;}else{_0x18bb0e=0xce;}_0x48585f[_0x8a3e('0x1b')](_0x18bb0e);return _0x48585f['set'](_0x8a3e('0x21'),_0x2f0b46+'-'+_0xcb1a1f+'/'+_0x5aec3d)['json'](_0x259fd9);}return null;};}function patchUpdates(_0x103eab){return function(_0x2c4c9f){try{jsonpatch[_0x8a3e('0x22')](_0x2c4c9f,_0x103eab,!![]);}catch(_0x4a43c8){return BPromise[_0x8a3e('0x23')](_0x4a43c8);}return _0x2c4c9f[_0x8a3e('0x24')]();};}function saveUpdates(_0x4f3688,_0x316594){return function(_0x34dc13){if(_0x34dc13){return _0x34dc13[_0x8a3e('0x25')](_0x4f3688)[_0x8a3e('0x26')](function(_0x1cebd6){return _0x1cebd6;});}return null;};}function removeEntity(_0x1dacd9,_0x2bb49e){return function(_0x422303){if(_0x422303){return _0x422303[_0x8a3e('0x27')]()[_0x8a3e('0x26')](function(){_0x1dacd9[_0x8a3e('0x1b')](0xcc)[_0x8a3e('0x1c')]();});}};}function handleEntityNotFound(_0x489015,_0x1d34e5){return function(_0x58195b){if(!_0x58195b){_0x489015[_0x8a3e('0x1a')](0x194);}return _0x58195b;};}function handleError(_0x4eb728,_0x1366eb){_0x1366eb=_0x1366eb||0x1f4;return function(_0x3e0cdb){logger[_0x8a3e('0x28')](_0x3e0cdb[_0x8a3e('0x29')]);if(_0x3e0cdb[_0x8a3e('0x2a')]){delete _0x3e0cdb[_0x8a3e('0x2a')];}_0x4eb728[_0x8a3e('0x1b')](_0x1366eb)['send'](_0x3e0cdb);};}exports[_0x8a3e('0x2b')]=function(_0x1c9a16,_0xf80a64){var _0x10c27b={},_0x459309={},_0x37cf55={'count':0x0,'rows':[]};var _0xd8ca5b=_['map'](db[_0x8a3e('0x2c')][_0x8a3e('0x2d')],function(_0x1012b0){return{'name':_0x1012b0[_0x8a3e('0x2e')],'type':_0x1012b0[_0x8a3e('0x2f')][_0x8a3e('0x30')]};});_0x459309[_0x8a3e('0x31')]=_[_0x8a3e('0x32')](_0xd8ca5b,_0x8a3e('0x2a'));_0x459309[_0x8a3e('0x33')]=_[_0x8a3e('0x34')](_0x1c9a16[_0x8a3e('0x33')]);_0x459309[_0x8a3e('0x35')]=_[_0x8a3e('0x36')](_0x459309[_0x8a3e('0x31')],_0x459309['query']);_0x10c27b['attributes']=_['intersection'](_0x459309[_0x8a3e('0x31')],qs[_0x8a3e('0x37')](_0x1c9a16['query']['fields']));_0x10c27b[_0x8a3e('0x38')]=_0x10c27b['attributes']['length']?_0x10c27b[_0x8a3e('0x38')]:_0x459309[_0x8a3e('0x31')];if(!_0x1c9a16[_0x8a3e('0x33')][_0x8a3e('0x39')](_0x8a3e('0x3a'))){_0x10c27b['limit']=qs[_0x8a3e('0x20')](_0x1c9a16[_0x8a3e('0x33')]['limit']);_0x10c27b[_0x8a3e('0x1d')]=qs['offset'](_0x1c9a16[_0x8a3e('0x33')][_0x8a3e('0x1d')]);}_0x10c27b[_0x8a3e('0x3b')]=qs[_0x8a3e('0x3c')](_0x1c9a16[_0x8a3e('0x33')][_0x8a3e('0x3c')]);_0x10c27b[_0x8a3e('0x3d')]=qs[_0x8a3e('0x35')](_['pick'](_0x1c9a16[_0x8a3e('0x33')],_0x459309[_0x8a3e('0x35')]),_0xd8ca5b);if(_0x1c9a16[_0x8a3e('0x33')][_0x8a3e('0x3e')]){_0x10c27b[_0x8a3e('0x3d')]=_[_0x8a3e('0x3f')](_0x10c27b['where'],{'$or':_[_0x8a3e('0x32')](_0xd8ca5b,function(_0x2c60db){if(_0x2c60db[_0x8a3e('0x2f')]!==_0x8a3e('0x40')){var _0x59bf36={};_0x59bf36[_0x2c60db[_0x8a3e('0x2a')]]={'$like':'%'+_0x1c9a16['query'][_0x8a3e('0x3e')]+'%'};return _0x59bf36;}})});}_0x10c27b=_[_0x8a3e('0x3f')]({},_0x10c27b,_0x1c9a16[_0x8a3e('0x41')]);var _0x161382={'where':_0x10c27b[_0x8a3e('0x3d')]};return db[_0x8a3e('0x2c')][_0x8a3e('0x1f')](_0x161382)[_0x8a3e('0x26')](function(_0x2364db){_0x37cf55[_0x8a3e('0x1f')]=_0x2364db;if(_0x1c9a16['query']['includeAll']){_0x10c27b[_0x8a3e('0x42')]=[{'all':!![]}];}return db[_0x8a3e('0x2c')]['findAll'](_0x10c27b);})[_0x8a3e('0x26')](function(_0x1cf040){_0x37cf55['rows']=_0x1cf040;return _0x37cf55;})[_0x8a3e('0x26')](respondWithFilteredResult(_0xf80a64,_0x10c27b))['catch'](handleError(_0xf80a64,null));};exports['show']=function(_0x42e44a,_0x5ba2c5){var _0x495cb4={'raw':!![],'where':{'id':_0x42e44a[_0x8a3e('0x43')]['id']}},_0x17cd6c={};_0x17cd6c['model']=_[_0x8a3e('0x34')](db[_0x8a3e('0x2c')]['rawAttributes']);_0x17cd6c[_0x8a3e('0x33')]=_['keys'](_0x42e44a['query']);_0x17cd6c[_0x8a3e('0x35')]=_[_0x8a3e('0x36')](_0x17cd6c[_0x8a3e('0x31')],_0x17cd6c['query']);_0x495cb4[_0x8a3e('0x38')]=_[_0x8a3e('0x36')](_0x17cd6c['model'],qs[_0x8a3e('0x37')](_0x42e44a[_0x8a3e('0x33')]['fields']));_0x495cb4[_0x8a3e('0x38')]=_0x495cb4[_0x8a3e('0x38')]['length']?_0x495cb4['attributes']:_0x17cd6c[_0x8a3e('0x31')];if(_0x42e44a[_0x8a3e('0x33')]['includeAll']){_0x495cb4[_0x8a3e('0x42')]=[{'all':!![]}];}_0x495cb4=_[_0x8a3e('0x3f')]({},_0x495cb4,_0x42e44a[_0x8a3e('0x41')]);return db[_0x8a3e('0x2c')][_0x8a3e('0x44')](_0x495cb4)['then'](handleEntityNotFound(_0x5ba2c5,null))['then'](respondWithResult(_0x5ba2c5,null))[_0x8a3e('0x45')](handleError(_0x5ba2c5,null));};exports[_0x8a3e('0x46')]=function(_0x5dee53,_0x318096){return db['WhatsappApplication'][_0x8a3e('0x46')](_0x5dee53[_0x8a3e('0x47')],{})['then'](respondWithResult(_0x318096,0xc9))[_0x8a3e('0x45')](handleError(_0x318096,null));};exports[_0x8a3e('0x25')]=function(_0x380b63,_0x12a86e){if(_0x380b63['body']['id']){delete _0x380b63[_0x8a3e('0x47')]['id'];}return db['WhatsappApplication'][_0x8a3e('0x44')]({'where':{'id':_0x380b63[_0x8a3e('0x43')]['id']}})['then'](handleEntityNotFound(_0x12a86e,null))[_0x8a3e('0x26')](saveUpdates(_0x380b63[_0x8a3e('0x47')],null))[_0x8a3e('0x26')](respondWithResult(_0x12a86e,null))[_0x8a3e('0x45')](handleError(_0x12a86e,null));};exports[_0x8a3e('0x27')]=function(_0x51414f,_0x4e32b9){return db['WhatsappApplication'][_0x8a3e('0x44')]({'where':{'id':_0x51414f[_0x8a3e('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e32b9,null))[_0x8a3e('0x26')](removeEntity(_0x4e32b9,null))[_0x8a3e('0x45')](handleError(_0x4e32b9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b8731d5..a9244dc 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 _0xcabc=['api','moment','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x196117,_0x484472){var _0x42adda=function(_0x468b17){while(--_0x468b17){_0x196117['push'](_0x196117['shift']());}};_0x42adda(++_0x484472);}(_0xcabc,0x16a));var _0xccab=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcabc[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xccab('0x0'));var logger=require(_0xccab('0x1'))(_0xccab('0x2'));var moment=require(_0xccab('0x3'));var BPromise=require(_0xccab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccab('0x5'));var rimraf=require(_0xccab('0x6'));var config=require('../../config/environment');var attributes=require(_0xccab('0x7'));module[_0xccab('0x8')]=function(_0x271a61,_0x492d75){return _0x271a61[_0xccab('0x9')](_0xccab('0xa'),attributes,{'tableName':_0xccab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xccab('0xc')});}; \ No newline at end of file +var _0x8a9c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x436057,_0x495fb3){var _0x77fb04=function(_0x7df963){while(--_0x7df963){_0x436057['push'](_0x436057['shift']());}};_0x77fb04(++_0x495fb3);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var logger=require(_0xc8a9('0x2'))(_0xc8a9('0x3'));var moment=require(_0xc8a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8a9('0x5'));var fs=require('fs');var path=require(_0xc8a9('0x6'));var rimraf=require('rimraf');var config=require(_0xc8a9('0x7'));var attributes=require(_0xc8a9('0x8'));module[_0xc8a9('0x9')]=function(_0x4c1e04,_0xb4340b){return _0x4c1e04[_0xc8a9('0xa')](_0xc8a9('0xb'),attributes,{'tableName':_0xc8a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8a9('0xd'),'collate':_0xc8a9('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 4aedc5d..f1ce1bc 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x493927,_0x36135c){var _0x5825f4=function(_0x29b6a3){while(--_0x29b6a3){_0x493927['push'](_0x493927['shift']());}};_0x5825f4(++_0x36135c);}(_0x207c,0x1e8));var _0xc207=function(_0x174e6d,_0x45f4d1){_0x174e6d=_0x174e6d-0x0;var _0x27a7eb=_0x207c[_0x174e6d];return _0x27a7eb;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0xbec5=['info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x25ada9,_0x5f0e07){var _0x59e1ab=function(_0x241d91){while(--_0x241d91){_0x25ada9['push'](_0x25ada9['shift']());}};_0x59e1ab(++_0x5f0e07);}(_0xbec5,0xe5));var _0x5bec=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xbec5[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e1195ed..83105df 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 _0xb4c7=['post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','create'];(function(_0x1715a2,_0x13d1d3){var _0x447fc1=function(_0x4ba3e4){while(--_0x4ba3e4){_0x1715a2['push'](_0x1715a2['shift']());}};_0x447fc1(++_0x13d1d3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x210f96,_0x5dfb7c){_0x210f96=_0x210f96-0x0;var _0x2e4717=_0xb4c7[_0x210f96];return _0x2e4717;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0xc')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0xc')](_0x7b4c('0x12'),auth[_0x7b4c('0xa')](),controller['download']);router['post']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x14')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x14')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x18')),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')](_0x7b4c('0x1b'),_0x7b4c('0x1c')),controller['update']);router[_0x7b4c('0x1d')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x1e')),controller[_0x7b4c('0x1f')]);router[_0x7b4c('0x1d')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x20')]);module[_0x7b4c('0x21')]=router; \ No newline at end of file +var _0x4fb4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','util','path','connect-timeout'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x4fb4,0x190));var _0x44fb=function(_0x47aa19,_0x4d854a){_0x47aa19=_0x47aa19-0x0;var _0x1d21f4=_0x4fb4[_0x47aa19];return _0x1d21f4;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var fs_extra=require(_0x44fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var controller=require(_0x44fb('0x8'));router[_0x44fb('0x9')]('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0xb')]);router[_0x44fb('0x9')](_0x44fb('0xc'),auth['isAuthenticated'](),controller[_0x44fb('0xd')]);router[_0x44fb('0x9')]('/:id',auth[_0x44fb('0xa')](),controller[_0x44fb('0xe')]);router[_0x44fb('0x9')](_0x44fb('0xf'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x10')]);router[_0x44fb('0x9')](_0x44fb('0x11'),auth[_0x44fb('0xa')](),controller[_0x44fb('0x12')]);router['post']('/',auth[_0x44fb('0xa')](),controller[_0x44fb('0x13')]);router[_0x44fb('0x14')](_0x44fb('0xf'),auth[_0x44fb('0xa')](),controller['addMessage']);router[_0x44fb('0x14')](_0x44fb('0x15'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),'whatsappinteraction:addtags'),controller[_0x44fb('0x18')]);router[_0x44fb('0x19')](_0x44fb('0x1a'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),_0x44fb('0x1b')),controller['update']);router[_0x44fb('0x1c')](_0x44fb('0x1a'),auth[_0x44fb('0xa')](),interaction[_0x44fb('0x16')](_0x44fb('0x17'),_0x44fb('0x1d')),controller[_0x44fb('0x1e')]);router[_0x44fb('0x1c')](_0x44fb('0x15'),auth[_0x44fb('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0128426..01be5ca 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 _0xe5e0=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x30f18d,_0x3badd3){var _0x166e9f=function(_0xfd4874){while(--_0xfd4874){_0x30f18d['push'](_0x30f18d['shift']());}};_0x166e9f(++_0x3badd3);}(_0xe5e0,0x123));var _0x0e5e=function(_0x981b2d,_0xb21fc8){_0x981b2d=_0x981b2d-0x0;var _0x2d18a2=_0xe5e0[_0x981b2d];return _0x2d18a2;};'use strict';var Sequelize=require(_0x0e5e('0x0'));var moment=require(_0x0e5e('0x1'));module[_0x0e5e('0x2')]={'closed':{'type':Sequelize[_0x0e5e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e5e('0x4')]},'disposition':{'type':Sequelize[_0x0e5e('0x5')]},'secondDisposition':{'type':Sequelize[_0x0e5e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0e5e('0x5')]},'note':{'type':Sequelize[_0x0e5e('0x5')]},'phone':{'type':Sequelize[_0x0e5e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0e5e('0x6')]('in',_0x0e5e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0e5e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e5e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x85d0=['DATE','STRING','ENUM','out'];(function(_0x8969c2,_0xc524b7){var _0x519f23=function(_0x3d14f6){while(--_0x3d14f6){_0x8969c2['push'](_0x8969c2['shift']());}};_0x519f23(++_0xc524b7);}(_0x85d0,0x164));var _0x085d=function(_0x25bf54,_0x2f09be){_0x25bf54=_0x25bf54-0x0;var _0x356b8c=_0x85d0[_0x25bf54];return _0x356b8c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x085d('0x0')]},'disposition':{'type':Sequelize[_0x085d('0x1')]},'secondDisposition':{'type':Sequelize[_0x085d('0x1')]},'thirdDisposition':{'type':Sequelize[_0x085d('0x1')]},'note':{'type':Sequelize[_0x085d('0x1')]},'phone':{'type':Sequelize[_0x085d('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x085d('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x085d('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x085d('0x2')]('in',_0x085d('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 6d792e9..5543234 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 _0xb515=['Users','TagIds','split','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','where','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','toString','all','rows','show','params','include','options','create','body','describe','addMessage','findOne','WhatsappMessage','WhatsappInteractionId','format','findAll','omit','ids','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','Whatsapp','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','System','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xb515,0x1b8));var _0x5b51=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0xb515[_0x46d87a];return _0x115296;};'use strict';var emlformat=require(_0x5b51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b51('0x1'));var jsonpatch=require(_0x5b51('0x2'));var rp=require(_0x5b51('0x3'));var moment=require(_0x5b51('0x4'));var BPromise=require(_0x5b51('0x5'));var Mustache=require(_0x5b51('0x6'));var util=require(_0x5b51('0x7'));var path=require(_0x5b51('0x8'));var sox=require('sox');var csv=require(_0x5b51('0x9'));var ejs=require(_0x5b51('0xa'));var fs=require('fs');var fs_extra=require(_0x5b51('0xb'));var _=require(_0x5b51('0xc'));var squel=require(_0x5b51('0xd'));var crypto=require(_0x5b51('0xe'));var jsforce=require(_0x5b51('0xf'));var deskjs=require(_0x5b51('0x10'));var toCsv=require(_0x5b51('0x9'));var querystring=require(_0x5b51('0x11'));var Papa=require(_0x5b51('0x12'));var Redis=require(_0x5b51('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5b51('0x14'));var as=require(_0x5b51('0x15'));var pdf=require(_0x5b51('0x16'));var hardwareService=require(_0x5b51('0x17'));var logger=require(_0x5b51('0x18'))(_0x5b51('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5b51('0x1a'))['db'];config[_0x5b51('0x1b')]=_[_0x5b51('0x1c')](config[_0x5b51('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b51('0x1d'))(new Redis(config[_0x5b51('0x1b')]));require(_0x5b51('0x1e'))[_0x5b51('0x1f')](socket);function respondWithStatusCode(_0x303abd,_0x1b45f6){_0x1b45f6=_0x1b45f6||0xcc;return function(_0x13adfc){if(_0x13adfc){return _0x303abd[_0x5b51('0x20')](_0x1b45f6);}return _0x303abd[_0x5b51('0x21')](_0x1b45f6)[_0x5b51('0x22')]();};}function respondWithResult(_0x4216aa,_0x1118a2){_0x1118a2=_0x1118a2||0xc8;return function(_0x520686){if(_0x520686){return _0x4216aa[_0x5b51('0x21')](_0x1118a2)['json'](_0x520686);}};}function respondWithFilteredResult(_0x5aefeb,_0x3d570d){return function(_0x2142ad){if(_0x2142ad){var _0x56e747=typeof _0x3d570d[_0x5b51('0x23')]===_0x5b51('0x24')&&typeof _0x3d570d['limit']===_0x5b51('0x24');var _0x5b506e=_0x2142ad[_0x5b51('0x25')];var _0x207f68=_0x56e747?0x0:_0x3d570d[_0x5b51('0x23')];var _0x1435f4=_0x56e747?_0x2142ad[_0x5b51('0x25')]:_0x3d570d[_0x5b51('0x23')]+_0x3d570d[_0x5b51('0x26')];var _0x2c0aa1;if(_0x1435f4>=_0x5b506e){_0x1435f4=_0x5b506e;_0x2c0aa1=0xc8;}else{_0x2c0aa1=0xce;}_0x5aefeb['status'](_0x2c0aa1);return _0x5aefeb[_0x5b51('0x27')](_0x5b51('0x28'),_0x207f68+'-'+_0x1435f4+'/'+_0x5b506e)[_0x5b51('0x29')](_0x2142ad);}return null;};}function patchUpdates(_0x24816e){return function(_0x3665c5){try{jsonpatch[_0x5b51('0x2a')](_0x3665c5,_0x24816e,!![]);}catch(_0x58f169){return BPromise['reject'](_0x58f169);}return _0x3665c5[_0x5b51('0x2b')]();};}function saveUpdates(_0x41c9b6,_0x516178){return function(_0x3ea804){if(_0x3ea804){return _0x3ea804[_0x5b51('0x2c')](_0x41c9b6)[_0x5b51('0x2d')](function(_0xc99bd5){return _0xc99bd5;});}return null;};}function removeEntity(_0x56e7ab,_0x38494b){return function(_0x24ed4f){if(_0x24ed4f){return _0x24ed4f[_0x5b51('0x2e')]()[_0x5b51('0x2d')](function(){_0x56e7ab[_0x5b51('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5ff3,_0x5346c3){return function(_0x2b466d){if(!_0x2b466d){_0x3a5ff3[_0x5b51('0x20')](0x194);}return _0x2b466d;};}function handleError(_0x1a1ce6,_0x29f61a){_0x29f61a=_0x29f61a||0x1f4;return function(_0x567068){logger[_0x5b51('0x2f')](_0x567068[_0x5b51('0x30')]);if(_0x567068[_0x5b51('0x31')]){delete _0x567068[_0x5b51('0x31')];}_0x1a1ce6[_0x5b51('0x21')](_0x29f61a)['send'](_0x567068);};}function getInteractionUsers(_0x1d75ba,_0x8af31){return new BPromise(function(_0x43d2e3,_0xe456a9){try{if(_0x8af31[_0x1d75ba['id']]){_0x1d75ba[_0x5b51('0x32')]=_['map'](_0x8af31[_0x1d75ba['id']],function(_0x2bac8d){return{'id':_0x2bac8d['id'],'fullname':_0x2bac8d['fullname']};});}}catch(_0x580435){_0xe456a9(_0x580435);}_0x43d2e3(_0x1d75ba);});}function getInteractionTags(_0x2bc485,_0x194a58){return new BPromise(function(_0x1fd372,_0x2c1cfc){try{if(_0x2bc485[_0x5b51('0x33')]){_0x2bc485['Tags']=[];_0x2bc485[_0x5b51('0x33')][_0x5b51('0x34')](',')['forEach'](function(_0xea7797){_0x2bc485['Tags'][_0x5b51('0x35')](_0x194a58[_0xea7797]);});}delete _0x2bc485[_0x5b51('0x33')];}catch(_0x31c0fb){_0x2c1cfc(_0x31c0fb);}_0x1fd372(_0x2bc485);});}function updateWhatsappInteraction(_0xaa1cd,_0x1879f8,_0x1b2abf){return new BPromise(function(_0x20f7cf,_0x3befd3){return getInteractionUsers(_0xaa1cd,_0x1b2abf)[_0x5b51('0x2d')](function(_0x50d2ba){return getInteractionTags(_0x50d2ba,_0x1879f8);})['then'](function(_0x22a642){return getStateInteraction(_0x22a642);})['then'](function(_0xe0a745){_0x20f7cf(_0xe0a745);})[_0x5b51('0x36')](function(_0x3d6127){_0x3befd3(_0x3d6127);});});}function getStateInteraction(_0x9fa80a){return new BPromise(function(_0x168342){_0x9fa80a[_0x5b51('0x37')]=0x0;_0x9fa80a[_0x5b51('0x38')]=0x0;_0x9fa80a['answered']=0x0;_0x9fa80a[_0x5b51('0x39')]=0x0;_0x9fa80a[_0x5b51('0x3a')]=0x0;if(!_0x9fa80a[_0x5b51('0x3b')]&&!_0x9fa80a[_0x5b51('0x3c')]){_0x9fa80a['waiting']+=0x1;}if(!_0x9fa80a[_0x5b51('0x3b')]&&_0x9fa80a[_0x5b51('0x3c')]){_0x9fa80a['talking']+=0x1;if(_0x9fa80a[_0x5b51('0x37')]){_0x9fa80a[_0x5b51('0x37')]-=0x1;}}if(_0x9fa80a[_0x5b51('0x3b')]&&_0x9fa80a[_0x5b51('0x3c')]){_0x9fa80a[_0x5b51('0x3d')]+=0x1;if(_0x9fa80a[_0x5b51('0x38')]){_0x9fa80a[_0x5b51('0x38')]-=0x1;}}if(_0x9fa80a[_0x5b51('0x3b')]&&!_0x9fa80a['UserId']){_0x9fa80a[_0x5b51('0x39')]+=0x1;if(_0x9fa80a[_0x5b51('0x37')]){_0x9fa80a[_0x5b51('0x37')]-=0x1;}}_0x9fa80a[_0x5b51('0x3a')]+=0x1;_0x168342(_0x9fa80a);});}exports['index']=function(_0x4b4817,_0x5a3581){var _0x59abcf={},_0x5567b8={},_0x2b78b0={'count':0x0,'rows':[]};var _0x38d5d9=_[_0x5b51('0x3e')](db[_0x5b51('0x3f')][_0x5b51('0x40')],function(_0x4f03d7){return{'name':_0x4f03d7[_0x5b51('0x41')],'type':_0x4f03d7[_0x5b51('0x42')][_0x5b51('0x43')]};});_0x5567b8[_0x5b51('0x44')]=_[_0x5b51('0x3e')](_0x38d5d9,_0x5b51('0x31'));_0x5567b8[_0x5b51('0x45')]=_[_0x5b51('0x46')](_0x4b4817[_0x5b51('0x45')]);_0x5567b8['filters']=_[_0x5b51('0x47')](_0x5567b8['model'],_0x5567b8[_0x5b51('0x45')]);_0x59abcf[_0x5b51('0x48')]=_[_0x5b51('0x47')](_0x5567b8['model'],qs['fields'](_0x4b4817[_0x5b51('0x45')][_0x5b51('0x49')]));_0x59abcf[_0x5b51('0x48')]=_0x59abcf[_0x5b51('0x48')][_0x5b51('0x4a')]?_0x59abcf[_0x5b51('0x48')]:_0x5567b8[_0x5b51('0x44')];if(!_0x4b4817[_0x5b51('0x45')][_0x5b51('0x4b')](_0x5b51('0x4c'))){_0x59abcf[_0x5b51('0x26')]=qs[_0x5b51('0x26')](_0x4b4817[_0x5b51('0x45')][_0x5b51('0x26')]);_0x59abcf[_0x5b51('0x23')]=qs[_0x5b51('0x23')](_0x4b4817[_0x5b51('0x45')]['offset']);}_0x59abcf[_0x5b51('0x4d')]=qs[_0x5b51('0x4e')](_0x4b4817[_0x5b51('0x45')]['sort']);_0x59abcf['where']=qs[_0x5b51('0x4f')](_[_0x5b51('0x50')](_0x4b4817[_0x5b51('0x45')],_0x5567b8[_0x5b51('0x4f')]),_0x38d5d9);var _0xc6bfa=[];var _0x7f0f1c=squel[_0x5b51('0x51')]()['field']('id')['field'](_0x5b51('0x31'))[_0x5b51('0x52')]('color')[_0x5b51('0x53')]('tools_tags');var _0x10572b=squel[_0x5b51('0x51')]()['field'](_0x5b51('0x54'))[_0x5b51('0x52')](_0x5b51('0x55'))[_0x5b51('0x52')]('ui.WhatsappInteractionId')[_0x5b51('0x53')](_0x5b51('0x56'),'ui')['left_join'](_0x5b51('0x57'),'u',_0x5b51('0x58'));var _0x25c1c2=squel['select']()[_0x5b51('0x53')](_0x5b51('0x59'),'i')[_0x5b51('0x5a')](_0x5b51('0x5b'),'c',_0x5b51('0x5c'))[_0x5b51('0x5a')](_0x5b51('0x57'),'o',_0x5b51('0x5d'))[_0x5b51('0x5a')]('whatsapp_accounts','a',_0x5b51('0x5e'))[_0x5b51('0x5a')](_0x5b51('0x5f'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x5b51('0x5a')](_0x5b51('0x60'),'it',_0x5b51('0x61'))['left_join'](_0x5b51('0x62'),'t',_0x5b51('0x63'));var _0x1200c0=squel[_0x5b51('0x64')]();var _0xf77e1f=[];var _0x31f456=squel['expr']();var _0x1532bb;if(_0x4b4817[_0x5b51('0x45')]['search']){_0x1532bb=as[_0x5b51('0x65')](_0x4b4817['query'][_0x5b51('0x66')]);var _0x57a266=_0x1532bb[_0x5b51('0x67')];for(var _0x371de2=0x0;_0x371de2<_0x1532bb['conditions'][_0x5b51('0x4a')];_0x371de2++){var _0x1105d4=_0x1532bb[_0x5b51('0x68')][_0x371de2];var _0x1efbd2='i';var _0x417b9a=_[_0x5b51('0x69')](_0x38d5d9,['name',_0x1105d4['field']]);if(!_0x417b9a){switch(_0x1105d4['field']){case _0x5b51('0x6a'):if(_0x1105d4[_0x5b51('0x6b')]==0x1){_0x25c1c2[_0x5b51('0x6c')]('`'+_0x1105d4[_0x5b51('0x52')]+_0x5b51('0x6d'));}else{_0x25c1c2[_0x5b51('0x6c')]('`'+_0x1105d4['field']+'`\x20>\x200');}break;case _0x5b51('0x6e'):if(_0x1105d4[_0x5b51('0x6f')]===_0x5b51('0x70')){if(_0x1105d4[_0x5b51('0x6b')][_0x5b51('0x34')]('\x20')[_0x5b51('0x4a')]>0x1){_0x1200c0[_0x57a266](_0x5b51('0x71'),qs['getFullTextValue'](_0x1105d4[_0x5b51('0x6b')]),null);}else{var _0x2925b5='%'+_0x1105d4[_0x5b51('0x6b')]+'%';_0x1200c0[_0x57a266](_0x5b51('0x72'),_0x2925b5,_0x2925b5,_0x2925b5);}}else{_0x417b9a=_[_0x5b51('0x69')](_0x38d5d9,[_0x5b51('0x31'),_0x5b51('0x73')]);_0x1105d4['field']='ContactId';_0x1ca4a5=as['buildExpression'](_0x1efbd2,_0x417b9a['type'],_0x1105d4);_0x1200c0[_0x57a266](_0x1ca4a5[_0x5b51('0x74')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x75')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x22')]);}break;case'Tag':var _0x12b380=_0x1105d4[_0x5b51('0x6b')][_0x5b51('0x34')](',')[_0x5b51('0x3e')](function(_0x5f0448){return Number(_0x5f0448);});_0x12b380[_0x5b51('0x76')](function(_0x211fa7){_0x31f456['or'](_0x5b51('0x77'),'%,'+_0x211fa7+',%');});_0xf77e1f=_[_0x5b51('0x78')](_0xf77e1f,_0x12b380);break;case _0x5b51('0x79'):if(_0x1105d4[_0x5b51('0x6f')]===_0x5b51('0x70')){_0x1200c0[_0x57a266](_0x5b51('0x7a'),'%'+_0x1105d4[_0x5b51('0x6b')]+'%',null);}else{_0x417b9a=_['find'](_0x38d5d9,['name','UserId']);_0x1105d4[_0x5b51('0x52')]='UserId';_0x1ca4a5=as[_0x5b51('0x7b')](_0x1efbd2,_0x417b9a[_0x5b51('0x42')],_0x1105d4);_0x1200c0[_0x57a266](_0x1ca4a5[_0x5b51('0x74')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x75')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x22')]);}break;case'body':_0x1ca4a5=as[_0x5b51('0x7b')]('me',null,_0x1105d4);_0x1200c0[_0x57a266](_0x1ca4a5[_0x5b51('0x74')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x75')],_0x1ca4a5[_0x5b51('0x6b')]['end']);break;}}else{var _0x1ca4a5=as[_0x5b51('0x7b')](_0x1efbd2,_0x417b9a[_0x5b51('0x42')],_0x1105d4);_0x1200c0[_0x57a266](_0x1ca4a5[_0x5b51('0x74')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x75')],_0x1ca4a5[_0x5b51('0x6b')][_0x5b51('0x22')]);}}}else{var _0x55d564=_(_0x4b4817[_0x5b51('0x45')])['keys']()['map'](function(_0x36114e){return _[_0x5b51('0x7c')](_0x38d5d9,[_0x5b51('0x31'),_0x36114e])?_0x36114e:undefined;})[_0x5b51('0x7d')]()[_0x5b51('0x6b')]();if(!_[_0x5b51('0x7e')](_0x55d564)){_0x55d564[_0x5b51('0x76')](function(_0x4883cb){if(_0x4883cb===_0x5b51('0x7f')){_0x25c1c2['where'](_0x5b51('0x80'),[][_0x5b51('0x81')](_0x4b4817[_0x5b51('0x45')][_0x4883cb]));}else if(_0x4883cb===_0x5b51('0x82')){var _0x24298e=JSON['parse'](_0x4b4817[_0x5b51('0x45')][_0x4883cb])[_0x5b51('0x83')];var _0x23af84=JSON[_0x5b51('0x84')](_0x4b4817[_0x5b51('0x45')][_0x4883cb])[_0x5b51('0x85')];_0x25c1c2['where'](_0x5b51('0x86'),_0x24298e,_0x23af84);}else{if(_0x4b4817[_0x5b51('0x45')][_0x4883cb]===_0x5b51('0x87')){_0x25c1c2['where']('i.'+_0x4883cb+_0x5b51('0x88'));}else{_0x25c1c2[_0x5b51('0x89')]('i.'+_0x4883cb+_0x5b51('0x8a'),_0x4b4817[_0x5b51('0x45')][_0x4883cb]);}}});}if(_0x4b4817[_0x5b51('0x45')][_0x5b51('0x8b')]){if(_0x4b4817[_0x5b51('0x45')][_0x5b51('0x8b')]==0x1){_0x25c1c2[_0x5b51('0x6c')](_0x5b51('0x8c'));}else{_0x25c1c2[_0x5b51('0x6c')](_0x5b51('0x8d'));}}if(_0x4b4817[_0x5b51('0x45')]['tag']){_0xf77e1f=_[_0x5b51('0x8e')](_0x4b4817['query'][_0x5b51('0x8f')])?_0x4b4817[_0x5b51('0x45')][_0x5b51('0x8f')]:new Array(_0x4b4817[_0x5b51('0x45')][_0x5b51('0x8f')]);_0xf77e1f['forEach'](function(_0x31cde5){_0x31f456['or'](_0x5b51('0x77'),'%,'+_0x31cde5+',%');});}if(_0x4b4817[_0x5b51('0x45')][_0x5b51('0x90')]){var _0x319c77=_0x4b4817[_0x5b51('0x45')][_0x5b51('0x90')][_0x5b51('0x91')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5b51('0x92')](_0x319c77)){_0x1200c0['or'](_0x5b51('0x93'),_0x319c77+'%')['or']('i.phone\x20LIKE\x20?',_0x319c77+'%');}else{_0x1200c0['or'](_0x5b51('0x94'),qs[_0x5b51('0x95')](_0x319c77))['or'](_0x5b51('0x96'),_0x319c77+'%');}}}_0x25c1c2[_0x5b51('0x89')](_0x1200c0);_0x25c1c2[_0x5b51('0x97')](_0x5b51('0x98'));var _0x5b024b={'type':db['Sequelize'][_0x5b51('0x99')]['SELECT'],'raw':!![]};var _0x4c27d7=_0x25c1c2[_0x5b51('0x9a')]();_0x4c27d7[_0x5b51('0x52')](_0x5b51('0x98'));_0x4c27d7['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x59abcf[_0x5b51('0x4d')]){_0x59abcf[_0x5b51('0x4d')][_0x5b51('0x76')](function(_0x5446cc){var _0x1861e5=_0x5446cc[0x0]===_0x5b51('0x9b')?_0x5446cc[0x0]:'i.'+_0x5446cc[0x0];_0x25c1c2[_0x5b51('0x4d')](_0x1861e5,_0x5446cc[0x1]===_0x5b51('0x9c')?![]:!![]);});}if(!_[_0x5b51('0x7e')](_0xf77e1f)){_0x25c1c2[_0x5b51('0x6c')](_0x31f456);_0x4c27d7['where'](_0x5b51('0x9d'),_0xf77e1f);}BPromise[_0x5b51('0x9e')]()[_0x5b51('0x2d')](function(){if(!_0x1532bb){if(_0x4b4817['query']['WhatsappAccountId'])return;_0x4c27d7[_0x5b51('0x89')](_0x5b51('0x9f'));_0x25c1c2['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4b4817[_0x5b51('0xa0')][_0x5b51('0xa1')]!==_0x5b51('0xa2'))return;return _0x4b4817[_0x5b51('0xa0')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x5b51('0x2d')](function(_0x26ce87){if(_[_0x5b51('0x7e')](_0x26ce87)){_0x4c27d7[_0x5b51('0x89')](_0x5b51('0xa3'));_0x25c1c2['where'](_0x5b51('0xa3'));}else{_0x4c27d7[_0x5b51('0x89')](_0x5b51('0x80'),_[_0x5b51('0x3e')](_0x26ce87,'id'));_0x25c1c2['where'](_0x5b51('0x80'),_[_0x5b51('0x3e')](_0x26ce87,'id'));}});})['then'](function(){if(_0x4b4817[_0x5b51('0xa0')][_0x5b51('0xa1')]===_0x5b51('0xa2')&&!_0x1532bb&&!_0x4b4817[_0x5b51('0x45')][_0x5b51('0x7f')])return[];return db[_0x5b51('0xa4')][_0x5b51('0x45')](_0x4c27d7['toString'](),_0x5b024b);})[_0x5b51('0x2d')](function(_0x294447){_0x2b78b0[_0x5b51('0x25')]=_0x294447[_0x5b51('0x4a')];if(_0x2b78b0[_0x5b51('0x25')]===0x0)return[];return db[_0x5b51('0xa4')][_0x5b51('0x45')](_0x7f0f1c['toString'](),_0x5b024b)[_0x5b51('0x2d')](function(_0x4dedf1){_0xc6bfa=_[_0x5b51('0xa5')](_0x4dedf1,'id');_0x5b024b=_[_0x5b51('0xa6')](_0x5b024b,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b4817[_0x5b51('0x45')][_0x5b51('0x49')]){_0x59abcf[_0x5b51('0x48')][_0x5b51('0x76')](function(_0x257251){_0x25c1c2['field']('i.'+_0x257251);});}else{_0x25c1c2[_0x5b51('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xa7'),_0x5b51('0xa8'));_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xa9'),_0x5b51('0xaa'));_0x25c1c2[_0x5b51('0x52')]('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');_0x25c1c2[_0x5b51('0x52')]('i.*');_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xab'),_0x5b51('0xac'));_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xad'),_0x5b51('0xae'));_0x25c1c2[_0x5b51('0x52')]('c.email',_0x5b51('0xaf'));_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xb0'),'Contact.phone');_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xb1'),_0x5b51('0xb2'));_0x25c1c2[_0x5b51('0x52')](_0x5b51('0xb3'),_0x5b51('0xb4'));_0x25c1c2[_0x5b51('0x52')]('o.fullname',_0x5b51('0xb5'));_0x25c1c2[_0x5b51('0x52')]('o.internal',_0x5b51('0xb6'));_0x25c1c2[_0x5b51('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5b51('0x33'));}if(_0x59abcf['limit'])_0x25c1c2[_0x5b51('0x26')](_0x59abcf['limit']);if(_0x59abcf[_0x5b51('0x23')])_0x25c1c2[_0x5b51('0x23')](_0x59abcf[_0x5b51('0x23')]);return db[_0x5b51('0xa4')][_0x5b51('0x45')](_0x25c1c2['toString'](),_0x5b024b);})[_0x5b51('0x2d')](function(_0x29b084){if(_0x29b084[_0x5b51('0x4a')]>0x0)_0x10572b[_0x5b51('0x89')](_0x5b51('0xb7'),_[_0x5b51('0x3e')](_0x29b084,'id'));return db['sequelize'][_0x5b51('0x45')](_0x10572b[_0x5b51('0xb8')](),_0x5b024b)[_0x5b51('0x2d')](function(_0x352022){var _0x1eb6c5=_['groupBy'](_0x352022,'WhatsappInteractionId');var _0x1cf2db=[];_0x29b084[_0x5b51('0x76')](function(_0xc753bb){_0x1cf2db[_0x5b51('0x35')](updateWhatsappInteraction(_0xc753bb,_0xc6bfa,_0x1eb6c5));});return BPromise[_0x5b51('0xb9')](_0x1cf2db);});});})[_0x5b51('0x2d')](function(_0x4539f1){_0x2b78b0[_0x5b51('0xba')]=_0x4539f1;return _0x2b78b0;})[_0x5b51('0x2d')](respondWithFilteredResult(_0x5a3581,_0x59abcf))['catch'](handleError(_0x5a3581,null));};exports[_0x5b51('0xbb')]=function(_0x4b6eff,_0x3ef341){var _0x54b20f={'raw':![],'where':{'id':_0x4b6eff[_0x5b51('0xbc')]['id']}},_0x125760={};_0x125760[_0x5b51('0x44')]=_['keys'](db[_0x5b51('0x3f')][_0x5b51('0x40')]);_0x125760[_0x5b51('0x45')]=_['keys'](_0x4b6eff[_0x5b51('0x45')]);_0x125760[_0x5b51('0x4f')]=_[_0x5b51('0x47')](_0x125760[_0x5b51('0x44')],_0x125760[_0x5b51('0x45')]);_0x54b20f[_0x5b51('0x48')]=_[_0x5b51('0x47')](_0x125760[_0x5b51('0x44')],qs[_0x5b51('0x49')](_0x4b6eff['query'][_0x5b51('0x49')]));_0x54b20f['attributes']=_0x54b20f['attributes'][_0x5b51('0x4a')]?_0x54b20f['attributes']:_0x125760[_0x5b51('0x44')];if(_0x4b6eff['query']['includeAll']){_0x54b20f[_0x5b51('0xbd')]=[{'all':!![]}];}_0x54b20f=_[_0x5b51('0xa6')]({},_0x54b20f,_0x4b6eff[_0x5b51('0xbe')]);return db['WhatsappInteraction']['find'](_0x54b20f)[_0x5b51('0x2d')](handleEntityNotFound(_0x3ef341,null))[_0x5b51('0x2d')](respondWithResult(_0x3ef341,null))[_0x5b51('0x36')](handleError(_0x3ef341,null));};exports[_0x5b51('0xbf')]=function(_0x4d5a07,_0x385f37){return db[_0x5b51('0x3f')][_0x5b51('0xbf')](_0x4d5a07[_0x5b51('0xc0')],{})[_0x5b51('0x2d')](respondWithResult(_0x385f37,0xc9))['catch'](handleError(_0x385f37,null));};exports[_0x5b51('0x2c')]=function(_0x3e5a9b,_0x2cb24b){if(_0x3e5a9b[_0x5b51('0xc0')]['id']){delete _0x3e5a9b[_0x5b51('0xc0')]['id'];}return db[_0x5b51('0x3f')]['find']({'where':{'id':_0x3e5a9b['params']['id']}})[_0x5b51('0x2d')](handleEntityNotFound(_0x2cb24b,null))['then'](saveUpdates(_0x3e5a9b[_0x5b51('0xc0')],null))['then'](respondWithResult(_0x2cb24b,null))['catch'](handleError(_0x2cb24b,null));};exports[_0x5b51('0x2e')]=function(_0x5925f4,_0x1a4e2d){return db[_0x5b51('0x3f')][_0x5b51('0x69')]({'where':{'id':_0x5925f4[_0x5b51('0xbc')]['id']}})[_0x5b51('0x2d')](handleEntityNotFound(_0x1a4e2d,null))[_0x5b51('0x2d')](removeEntity(_0x1a4e2d,null))['catch'](handleError(_0x1a4e2d,null));};exports[_0x5b51('0xc1')]=function(_0x32c3c9,_0x1380c1){return db[_0x5b51('0x3f')][_0x5b51('0xc1')]()['then'](respondWithResult(_0x1380c1,null))[_0x5b51('0x36')](handleError(_0x1380c1,null));};exports['addMessage']=function(_0x219fdc,_0x2d7ba6,_0x459473){return db['WhatsappMessage'][_0x5b51('0x69')]({'where':{'id':_0x219fdc[_0x5b51('0xbc')]['id']}})[_0x5b51('0x2d')](handleEntityNotFound(_0x2d7ba6,null))['then'](function(_0x2a019e){if(_0x2a019e){return _0x2a019e[_0x5b51('0xc2')](_0x219fdc[_0x5b51('0xc0')]['ids'],_['omit'](_0x219fdc[_0x5b51('0xc0')],['ids','id'])||{});}})[_0x5b51('0x2d')](respondWithResult(_0x2d7ba6,null))['catch'](handleError(_0x2d7ba6,null));};exports['getMessages']=function(_0x1ac620,_0x52aca2,_0x5af234){var _0x580f8f={'raw':![],'where':{}};var _0x2047d9={};var _0x4688d6={'count':0x0,'rows':[]};return db[_0x5b51('0x3f')][_0x5b51('0xc3')]({'where':{'id':_0x1ac620[_0x5b51('0xbc')]['id']}})[_0x5b51('0x2d')](handleEntityNotFound(_0x52aca2,null))[_0x5b51('0x2d')](function(_0x173002){if(_0x173002){_0x2047d9['model']=_[_0x5b51('0x46')](db[_0x5b51('0xc4')][_0x5b51('0x40')]);_0x2047d9[_0x5b51('0x45')]=_['keys'](_0x1ac620[_0x5b51('0x45')]);_0x2047d9[_0x5b51('0x4f')]=_[_0x5b51('0x47')](_0x2047d9[_0x5b51('0x44')],_0x2047d9[_0x5b51('0x45')]);_0x580f8f['attributes']=_[_0x5b51('0x47')](_0x2047d9[_0x5b51('0x44')],qs[_0x5b51('0x49')](_0x1ac620[_0x5b51('0x45')][_0x5b51('0x49')]));_0x580f8f[_0x5b51('0x48')]=_0x580f8f[_0x5b51('0x48')][_0x5b51('0x4a')]?_0x580f8f[_0x5b51('0x48')]:_0x2047d9['model'];if(!_0x1ac620[_0x5b51('0x45')][_0x5b51('0x4b')](_0x5b51('0x4c'))){_0x580f8f[_0x5b51('0x26')]=qs[_0x5b51('0x26')](_0x1ac620[_0x5b51('0x45')][_0x5b51('0x26')]);_0x580f8f[_0x5b51('0x23')]=qs[_0x5b51('0x23')](_0x1ac620[_0x5b51('0x45')][_0x5b51('0x23')]);}_0x580f8f['order']=qs[_0x5b51('0x4e')](_0x1ac620['query'][_0x5b51('0x4e')]);_0x580f8f['where']=qs[_0x5b51('0x4f')](_['pick'](_0x1ac620[_0x5b51('0x45')],_0x2047d9['filters']));_0x580f8f[_0x5b51('0x89')][_0x5b51('0xc5')]=_0x173002['id'];if(_0x1ac620[_0x5b51('0x45')][_0x5b51('0x90')]){_0x580f8f[_0x5b51('0x89')]=_[_0x5b51('0xa6')](_0x580f8f[_0x5b51('0x89')],{'$or':_[_0x5b51('0x3e')](_0x580f8f[_0x5b51('0x48')],function(_0x20412c){var _0x300f73={};_0x300f73[_0x20412c]={'$like':'%'+_0x1ac620[_0x5b51('0x45')][_0x5b51('0x90')]+'%'};return _0x300f73;})});}if(_0x1ac620['query']['$gte']){var _0x2f4b5d=_0x1ac620['query'][_0x5b51('0x83')][_0x5b51('0x34')](',');var _0x8adfeb={};_0x8adfeb[_0x2f4b5d[0x0]]={'$gte':moment(_0x2f4b5d[0x1])[_0x5b51('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x580f8f[_0x5b51('0x89')]=_[_0x5b51('0xa6')](_0x580f8f[_0x5b51('0x89')],_0x8adfeb);}_0x580f8f=_[_0x5b51('0xa6')]({},_0x580f8f,_0x1ac620['options']);return db[_0x5b51('0xc4')]['count']({'where':_0x580f8f[_0x5b51('0x89')]})[_0x5b51('0x2d')](function(_0x3c3df8){_0x4688d6[_0x5b51('0x25')]=_0x3c3df8;if(_0x1ac620[_0x5b51('0x45')]['includeAll']){_0x580f8f[_0x5b51('0xbd')]=[{'all':!![]}];}return db[_0x5b51('0xc4')][_0x5b51('0xc7')](_0x580f8f);})['then'](function(_0x55d5fa){_0x4688d6['rows']=_0x55d5fa;return _0x4688d6;});}})[_0x5b51('0x2d')](respondWithFilteredResult(_0x52aca2,_0x580f8f))[_0x5b51('0x36')](handleError(_0x52aca2,null));};exports['addTags']=function(_0x3b08e8,_0x3a196b,_0x239780){return db[_0x5b51('0x3f')][_0x5b51('0x69')]({'where':{'id':_0x3b08e8['params']['id']}})[_0x5b51('0x2d')](handleEntityNotFound(_0x3a196b,null))[_0x5b51('0x2d')](function(_0x39eabf){if(_0x39eabf){return _0x39eabf['setTags'](_0x3b08e8[_0x5b51('0xc0')]['ids'],_[_0x5b51('0xc8')](_0x3b08e8[_0x5b51('0xc0')],[_0x5b51('0xc9'),'id'])||{})[_0x5b51('0xca')](function(){return db[_0x5b51('0xcb')][_0x5b51('0xc7')]({'attributes':['id',_0x5b51('0x31'),'color'],'where':{'id':_0x3b08e8[_0x5b51('0xc0')]['ids']}});})[_0x5b51('0x2d')](function(_0x24e7a6){socket[_0x5b51('0xcc')](_0x5b51('0xcd'),{'id':Number(_0x3b08e8[_0x5b51('0xbc')]['id']),'tags':_0x24e7a6||[]});return{'id':Number(_0x3b08e8[_0x5b51('0xbc')]['id']),'tags':_0x24e7a6||[]};});}})['then'](respondWithResult(_0x3a196b,null))[_0x5b51('0x36')](handleError(_0x3a196b,null));};exports[_0x5b51('0xce')]=function(_0x467730,_0x6f5765,_0x19a902){return db[_0x5b51('0x3f')]['find']({'where':{'id':_0x467730[_0x5b51('0xbc')]['id']}})['then'](handleEntityNotFound(_0x6f5765,null))['then'](function(_0x45aee5){if(_0x45aee5){return _0x45aee5[_0x5b51('0xce')](_0x467730[_0x5b51('0x45')][_0x5b51('0xc9')]);}})['then'](respondWithStatusCode(_0x6f5765,null))[_0x5b51('0x36')](handleError(_0x6f5765,null));};exports[_0x5b51('0xcf')]=function(_0x1ca399,_0x5b573a){var _0x2d5409=moment()[_0x5b51('0xd0')]()['toString']();var _0x4495fe=path[_0x5b51('0xd1')](config[_0x5b51('0xd2')],_0x5b51('0xd3'),_0x5b51('0xd4'),_0x5b51('0xd5'));var _0x230abe=path[_0x5b51('0xd1')](config[_0x5b51('0xd2')],_0x5b51('0xd3'),'files',_0x5b51('0xd6'));var _0x2849dc=path[_0x5b51('0xd1')](_0x4495fe,_0x2d5409);var _0xe77375=util[_0x5b51('0xc6')](_0x5b51('0xd7'),_0x1ca399[_0x5b51('0xbc')]['id'],_0x2d5409);var _0x2d25ad=path[_0x5b51('0xd1')](_0x4495fe,_0xe77375);var _0x27c13d=[];_0x27c13d['push']({'model':db[_0x5b51('0x79')],'as':'User','attributes':['id',_0x5b51('0xd8')],'raw':!![]});_0x27c13d[_0x5b51('0x35')]({'model':db[_0x5b51('0xd9')],'as':_0x5b51('0x6e'),'attributes':['id',_0x5b51('0xda'),_0x5b51('0xdb')],'raw':!![]});if(_0x1ca399[_0x5b51('0x45')]['attachments']){_0x27c13d[_0x5b51('0x35')]({'model':db[_0x5b51('0xdc')],'as':_0x5b51('0xdc'),'raw':!![]});}var _0x4a0eea=[{'model':db[_0x5b51('0xc4')],'as':_0x5b51('0xdd'),'attributes':['id',_0x5b51('0xc0'),'createdAt',_0x5b51('0xde'),_0x5b51('0xdf'),_0x5b51('0x8b')],'include':_0x27c13d}];_0x4a0eea[_0x5b51('0x35')]({'model':db[_0x5b51('0xe0')],'as':_0x5b51('0xe1'),'attributes':['id',_0x5b51('0x31')]});_0x4a0eea[_0x5b51('0x35')]({'model':db[_0x5b51('0x79')],'as':'Owner','attributes':['id',_0x5b51('0xd8')]});return db[_0x5b51('0x3f')][_0x5b51('0x69')]({'where':{'id':_0x1ca399[_0x5b51('0xbc')]['id']},'include':_0x4a0eea})['then'](handleEntityNotFound(_0x5b573a,null))[_0x5b51('0x2d')](function(_0x4db6ba){if(_0x4db6ba){var _0xf3e5e9=_0x4db6ba[_0x5b51('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x2849dc);var _0x9a3b35={'channel':_0x5b51('0xe3'),'account':_0xf3e5e9[_0x5b51('0xe1')][_0x5b51('0x31')],'agent':_0xf3e5e9[_0x5b51('0xe4')]?_0xf3e5e9['Owner'][_0x5b51('0xd8')]:'N.A.','createdAt':moment(_0xf3e5e9[_0x5b51('0x82')])['format'](_0x5b51('0xe5'))[_0x5b51('0xb8')](),'closedAt':_0xf3e5e9[_0x5b51('0x3b')]?moment(_0xf3e5e9[_0x5b51('0xe6')])[_0x5b51('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5b51('0xb8')]():'','disposition':_0xf3e5e9[_0x5b51('0xe7')],'messages':_(_0xf3e5e9['Messages'])[_0x5b51('0x90')]({'secret':![]})['map'](function(_0x44643d){if(_0x44643d[_0x5b51('0xdc')]){var _0x344d45=path['join'](_0x230abe,_0x44643d[_0x5b51('0xdc')]['basename']);if(fs[_0x5b51('0xe8')](_0x344d45)){fs[_0x5b51('0xe9')](_0x344d45)[_0x5b51('0xea')](fs['createWriteStream'](path[_0x5b51('0xd1')](_0x2849dc,_0x44643d[_0x5b51('0xdc')][_0x5b51('0xeb')])));}}return{'date':moment(_0x44643d[_0x5b51('0x82')])[_0x5b51('0xc6')](_0x5b51('0xe5'))[_0x5b51('0xb8')](),'sender':_0x44643d[_0x5b51('0xde')]===_0x5b51('0xec')?_0x44643d[_0x5b51('0x79')]?_0x44643d[_0x5b51('0x79')][_0x5b51('0xd8')]:_0x5b51('0xed'):_0x44643d[_0x5b51('0x6e')][_0x5b51('0xda')]+(_0x44643d[_0x5b51('0x6e')]['lastName']?'\x20'+_0x44643d[_0x5b51('0x6e')]['lastName']:''),'body':_0x44643d[_0x5b51('0xdc')]?_0x44643d[_0x5b51('0xdc')][_0x5b51('0xeb')]:_0x44643d[_0x5b51('0xc0')],'direction':_0x44643d[_0x5b51('0xde')]===_0x5b51('0xec')?'A':'C','secret':_0x44643d[_0x5b51('0xdf')],'read':_0x44643d[_0x5b51('0x8b')],'attachment':_0x44643d[_0x5b51('0xdc')]};})[_0x5b51('0x6b')]()};return ejs[_0x5b51('0xee')](path[_0x5b51('0xd1')](config['root'],_0x5b51('0xd3'),_0x5b51('0xef'),_0x5b51('0xf0')),{'interaction':_0x9a3b35})[_0x5b51('0x2d')](function(_0x14bad4){var _0x468323=path[_0x5b51('0xd1')](_0x2849dc,'transcript-'+_0xf3e5e9['id']+'-'+_0x2d5409+_0x5b51('0xf1'));var _0x1f6324={'path':_0x468323,'channel':'Whatsapp','interactionId':_0xf3e5e9['id']};return pdf['createPdfFromHTML'](_0x14bad4,_0x1f6324);})['then'](function(){return new BPromise(function(_0x336044,_0x1bfe2a){zipdir(_0x2849dc,{'saveTo':_0x2d25ad},function(_0x37721c,_0x4529e1){if(_0x37721c)return _0x1bfe2a(_0x37721c);return _0x336044(_0x4529e1);});})[_0x5b51('0x2d')](function(){return new BPromise(function(_0x5887f7,_0x487b3a){rimraf(_0x2849dc,function(_0x401889){if(_0x401889)_0x487b3a(_0x401889);return _0x5887f7();});});})[_0x5b51('0x2d')](function(){return _0x5b573a[_0x5b51('0xcf')](_0x2d25ad,_0xe77375,function(_0x36503b){if(_0x36503b){console[_0x5b51('0xf2')](_0x5b51('0xf3'),_0x36503b);}else{fs[_0x5b51('0xf4')](_0x2d25ad);}});});});}else{return _0x5b573a[_0x5b51('0x20')](0xc8);}})[_0x5b51('0x36')](handleError(_0x5b573a,null));}; \ No newline at end of file +var _0x905a=['pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','direction','System','lastName','out','downloadInteraction.ejs','Whatsapp','createPdfFromHTML','download','err','unlinkSync','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','apply','save','update','then','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','talking','answered','unmanaged','total','closed','UserId','waiting','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','operator','$substring','split','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','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','QueryTypes','SELECT','order','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','rows','show','params','include','options','catch','create','describe','WhatsappMessage','addMessage','omit','ids','getMessages','hasOwnProperty','WhatsappInteractionId','merge','format','includeAll','findAll','setTags','emit','removeTags','unix','join','root','files','tmp','server','attachments','User','CmContact','Contact','firstName','Attachment','Messages','secret','WhatsappAccount','Account','N.A.','basename','existsSync','createReadStream'];(function(_0x31fcfa,_0x48a7ac){var _0x31afc3=function(_0x12bffa){while(--_0x12bffa){_0x31fcfa['push'](_0x31fcfa['shift']());}};_0x31afc3(++_0x48a7ac);}(_0x905a,0xeb));var _0xa905=function(_0x3658ca,_0x748828){_0x3658ca=_0x3658ca-0x0;var _0x13adc3=_0x905a[_0x3658ca];return _0x13adc3;};'use strict';var emlformat=require(_0xa905('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa905('0x2'));var BPromise=require(_0xa905('0x3'));var Mustache=require(_0xa905('0x4'));var util=require(_0xa905('0x5'));var path=require(_0xa905('0x6'));var sox=require(_0xa905('0x7'));var csv=require(_0xa905('0x8'));var ejs=require(_0xa905('0x9'));var fs=require('fs');var fs_extra=require(_0xa905('0xa'));var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x8'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xa905('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa905('0x13'));var config=require(_0xa905('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa905('0x15')]=_[_0xa905('0x16')](config[_0xa905('0x15')],{'host':_0xa905('0x17'),'port':0x18eb});var socket=require(_0xa905('0x18'))(new Redis(config[_0xa905('0x15')]));require('./whatsappInteraction.socket')[_0xa905('0x19')](socket);function respondWithStatusCode(_0x5f2072,_0x356cfb){_0x356cfb=_0x356cfb||0xcc;return function(_0x97332d){if(_0x97332d){return _0x5f2072['sendStatus'](_0x356cfb);}return _0x5f2072['status'](_0x356cfb)['end']();};}function respondWithResult(_0x103c18,_0x15a4df){_0x15a4df=_0x15a4df||0xc8;return function(_0x1d393b){if(_0x1d393b){return _0x103c18[_0xa905('0x1a')](_0x15a4df)[_0xa905('0x1b')](_0x1d393b);}};}function respondWithFilteredResult(_0x3f5a06,_0x1439d5){return function(_0x1005dc){if(_0x1005dc){var _0xa59b33=typeof _0x1439d5[_0xa905('0x1c')]===_0xa905('0x1d')&&typeof _0x1439d5[_0xa905('0x1e')]==='undefined';var _0x334433=_0x1005dc[_0xa905('0x1f')];var _0x2a0ceb=_0xa59b33?0x0:_0x1439d5[_0xa905('0x1c')];var _0x14930d=_0xa59b33?_0x1005dc[_0xa905('0x1f')]:_0x1439d5['offset']+_0x1439d5[_0xa905('0x1e')];var _0x110be0;if(_0x14930d>=_0x334433){_0x14930d=_0x334433;_0x110be0=0xc8;}else{_0x110be0=0xce;}_0x3f5a06[_0xa905('0x1a')](_0x110be0);return _0x3f5a06[_0xa905('0x20')]('Content-Range',_0x2a0ceb+'-'+_0x14930d+'/'+_0x334433)[_0xa905('0x1b')](_0x1005dc);}return null;};}function patchUpdates(_0xa64309){return function(_0x32760e){try{jsonpatch[_0xa905('0x21')](_0x32760e,_0xa64309,!![]);}catch(_0x50a44a){return BPromise['reject'](_0x50a44a);}return _0x32760e[_0xa905('0x22')]();};}function saveUpdates(_0x43e2f6,_0x54edcb){return function(_0x2e39c8){if(_0x2e39c8){return _0x2e39c8[_0xa905('0x23')](_0x43e2f6)[_0xa905('0x24')](function(_0x182967){return _0x182967;});}return null;};}function removeEntity(_0x59fb12,_0x2ba8a5){return function(_0x3ad10c){if(_0x3ad10c){return _0x3ad10c['destroy']()[_0xa905('0x24')](function(){_0x59fb12[_0xa905('0x1a')](0xcc)[_0xa905('0x25')]();});}};}function handleEntityNotFound(_0x2ff254,_0x2768c0){return function(_0x131421){if(!_0x131421){_0x2ff254[_0xa905('0x26')](0x194);}return _0x131421;};}function handleError(_0x564315,_0x3f391d){_0x3f391d=_0x3f391d||0x1f4;return function(_0x32cf90){logger[_0xa905('0x27')](_0x32cf90[_0xa905('0x28')]);if(_0x32cf90[_0xa905('0x29')]){delete _0x32cf90['name'];}_0x564315['status'](_0x3f391d)[_0xa905('0x2a')](_0x32cf90);};}function getInteractionUsers(_0x403ed0,_0x951d2e){return new BPromise(function(_0x565ce0,_0x4f0e23){try{if(_0x951d2e[_0x403ed0['id']]){_0x403ed0[_0xa905('0x2b')]=_[_0xa905('0x2c')](_0x951d2e[_0x403ed0['id']],function(_0x1ca49e){return{'id':_0x1ca49e['id'],'fullname':_0x1ca49e[_0xa905('0x2d')]};});}}catch(_0x2cc596){_0x4f0e23(_0x2cc596);}_0x565ce0(_0x403ed0);});}function getInteractionTags(_0x50734b,_0x433b78){return new BPromise(function(_0x27abe1,_0x395a85){try{if(_0x50734b[_0xa905('0x2e')]){_0x50734b[_0xa905('0x2f')]=[];_0x50734b[_0xa905('0x2e')]['split'](',')[_0xa905('0x30')](function(_0x450e9b){_0x50734b[_0xa905('0x2f')][_0xa905('0x31')](_0x433b78[_0x450e9b]);});}delete _0x50734b[_0xa905('0x2e')];}catch(_0x4e1ca2){_0x395a85(_0x4e1ca2);}_0x27abe1(_0x50734b);});}function updateWhatsappInteraction(_0x31afa8,_0x4cedf4,_0x43b16c){return new BPromise(function(_0x3a1f22,_0x1b1c14){return getInteractionUsers(_0x31afa8,_0x43b16c)[_0xa905('0x24')](function(_0x54a5b5){return getInteractionTags(_0x54a5b5,_0x4cedf4);})[_0xa905('0x24')](function(_0x2a9b86){return getStateInteraction(_0x2a9b86);})['then'](function(_0x226588){_0x3a1f22(_0x226588);})['catch'](function(_0x275f64){_0x1b1c14(_0x275f64);});});}function getStateInteraction(_0x4b5ffe){return new BPromise(function(_0xe78a35){_0x4b5ffe['waiting']=0x0;_0x4b5ffe[_0xa905('0x32')]=0x0;_0x4b5ffe[_0xa905('0x33')]=0x0;_0x4b5ffe[_0xa905('0x34')]=0x0;_0x4b5ffe[_0xa905('0x35')]=0x0;if(!_0x4b5ffe[_0xa905('0x36')]&&!_0x4b5ffe[_0xa905('0x37')]){_0x4b5ffe[_0xa905('0x38')]+=0x1;}if(!_0x4b5ffe[_0xa905('0x36')]&&_0x4b5ffe[_0xa905('0x37')]){_0x4b5ffe[_0xa905('0x32')]+=0x1;if(_0x4b5ffe[_0xa905('0x38')]){_0x4b5ffe['waiting']-=0x1;}}if(_0x4b5ffe[_0xa905('0x36')]&&_0x4b5ffe[_0xa905('0x37')]){_0x4b5ffe['answered']+=0x1;if(_0x4b5ffe[_0xa905('0x32')]){_0x4b5ffe[_0xa905('0x32')]-=0x1;}}if(_0x4b5ffe['closed']&&!_0x4b5ffe[_0xa905('0x37')]){_0x4b5ffe[_0xa905('0x34')]+=0x1;if(_0x4b5ffe['waiting']){_0x4b5ffe[_0xa905('0x38')]-=0x1;}}_0x4b5ffe['total']+=0x1;_0xe78a35(_0x4b5ffe);});}exports[_0xa905('0x39')]=function(_0x1fc2f5,_0x48cc44){var _0x247475={},_0x4a8f02={},_0x14b559={'count':0x0,'rows':[]};var _0x5b353e=_[_0xa905('0x2c')](db[_0xa905('0x3a')][_0xa905('0x3b')],function(_0x382412){return{'name':_0x382412[_0xa905('0x3c')],'type':_0x382412[_0xa905('0x3d')][_0xa905('0x3e')]};});_0x4a8f02[_0xa905('0x3f')]=_['map'](_0x5b353e,_0xa905('0x29'));_0x4a8f02[_0xa905('0x40')]=_['keys'](_0x1fc2f5[_0xa905('0x40')]);_0x4a8f02[_0xa905('0x41')]=_['intersection'](_0x4a8f02[_0xa905('0x3f')],_0x4a8f02[_0xa905('0x40')]);_0x247475['attributes']=_[_0xa905('0x42')](_0x4a8f02[_0xa905('0x3f')],qs[_0xa905('0x43')](_0x1fc2f5[_0xa905('0x40')][_0xa905('0x43')]));_0x247475[_0xa905('0x44')]=_0x247475[_0xa905('0x44')][_0xa905('0x45')]?_0x247475[_0xa905('0x44')]:_0x4a8f02[_0xa905('0x3f')];if(!_0x1fc2f5[_0xa905('0x40')]['hasOwnProperty'](_0xa905('0x46'))){_0x247475['limit']=qs['limit'](_0x1fc2f5[_0xa905('0x40')]['limit']);_0x247475[_0xa905('0x1c')]=qs['offset'](_0x1fc2f5['query'][_0xa905('0x1c')]);}_0x247475['order']=qs[_0xa905('0x47')](_0x1fc2f5['query']['sort']);_0x247475['where']=qs['filters'](_[_0xa905('0x48')](_0x1fc2f5[_0xa905('0x40')],_0x4a8f02[_0xa905('0x41')]),_0x5b353e);var _0x2ca873=[];var _0x5c9e8a=squel[_0xa905('0x49')]()['field']('id')['field'](_0xa905('0x29'))[_0xa905('0x4a')](_0xa905('0x4b'))[_0xa905('0x4c')](_0xa905('0x4d'));var _0x28d10a=squel[_0xa905('0x49')]()[_0xa905('0x4a')](_0xa905('0x4e'))[_0xa905('0x4a')](_0xa905('0x4f'))[_0xa905('0x4a')](_0xa905('0x50'))[_0xa905('0x4c')](_0xa905('0x51'),'ui')[_0xa905('0x52')](_0xa905('0x53'),'u',_0xa905('0x54'));var _0x77efa3=squel[_0xa905('0x49')]()[_0xa905('0x4c')](_0xa905('0x55'),'i')[_0xa905('0x52')](_0xa905('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa905('0x52')](_0xa905('0x53'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xa905('0x57'),'a',_0xa905('0x58'))[_0xa905('0x52')](_0xa905('0x59'),'me',_0xa905('0x5a'))[_0xa905('0x52')]('whatsapp_interaction_has_tags','it',_0xa905('0x5b'))[_0xa905('0x52')]('tools_tags','t',_0xa905('0x5c'));var _0x12ff33=squel[_0xa905('0x5d')]();var _0x364401=[];var _0x5f3fc9=squel[_0xa905('0x5d')]();var _0x4320ec;if(_0x1fc2f5[_0xa905('0x40')]['search']){_0x4320ec=as[_0xa905('0x5e')](_0x1fc2f5[_0xa905('0x40')][_0xa905('0x5f')]);var _0x2a5b93=_0x4320ec[_0xa905('0x60')];for(var _0x27f9be=0x0;_0x27f9be<_0x4320ec[_0xa905('0x61')][_0xa905('0x45')];_0x27f9be++){var _0x378585=_0x4320ec[_0xa905('0x61')][_0x27f9be];var _0x498a92='i';var _0x4d3310=_['find'](_0x5b353e,[_0xa905('0x29'),_0x378585[_0xa905('0x4a')]]);if(!_0x4d3310){switch(_0x378585[_0xa905('0x4a')]){case _0xa905('0x62'):if(_0x378585[_0xa905('0x63')]==0x1){_0x77efa3[_0xa905('0x64')]('`'+_0x378585[_0xa905('0x4a')]+_0xa905('0x65'));}else{_0x77efa3[_0xa905('0x64')]('`'+_0x378585[_0xa905('0x4a')]+'`\x20>\x200');}break;case'Contact':if(_0x378585[_0xa905('0x66')]===_0xa905('0x67')){if(_0x378585[_0xa905('0x63')][_0xa905('0x68')]('\x20')[_0xa905('0x45')]>0x1){_0x12ff33[_0x2a5b93]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa905('0x69')](_0x378585['value']),null);}else{var _0x2348e0='%'+_0x378585[_0xa905('0x63')]+'%';_0x12ff33[_0x2a5b93]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2348e0,_0x2348e0,_0x2348e0);}}else{_0x4d3310=_[_0xa905('0x6a')](_0x5b353e,[_0xa905('0x29'),_0xa905('0x6b')]);_0x378585[_0xa905('0x4a')]=_0xa905('0x6b');_0x5c2cfa=as[_0xa905('0x6c')](_0x498a92,_0x4d3310['type'],_0x378585);_0x12ff33[_0x2a5b93](_0x5c2cfa[_0xa905('0x6d')],_0x5c2cfa['value'][_0xa905('0x6e')],_0x5c2cfa['value'][_0xa905('0x25')]);}break;case _0xa905('0x6f'):var _0x5a75a8=_0x378585['value'][_0xa905('0x68')](',')['map'](function(_0x4b7b75){return Number(_0x4b7b75);});_0x5a75a8[_0xa905('0x30')](function(_0x595669){_0x5f3fc9['or'](_0xa905('0x70'),'%,'+_0x595669+',%');});_0x364401=_['union'](_0x364401,_0x5a75a8);break;case'User':if(_0x378585[_0xa905('0x66')]===_0xa905('0x67')){_0x12ff33[_0x2a5b93](_0xa905('0x71'),'%'+_0x378585[_0xa905('0x63')]+'%',null);}else{_0x4d3310=_[_0xa905('0x6a')](_0x5b353e,[_0xa905('0x29'),_0xa905('0x37')]);_0x378585['field']=_0xa905('0x37');_0x5c2cfa=as[_0xa905('0x6c')](_0x498a92,_0x4d3310[_0xa905('0x3d')],_0x378585);_0x12ff33[_0x2a5b93](_0x5c2cfa[_0xa905('0x6d')],_0x5c2cfa[_0xa905('0x63')][_0xa905('0x6e')],_0x5c2cfa[_0xa905('0x63')][_0xa905('0x25')]);}break;case _0xa905('0x72'):_0x5c2cfa=as[_0xa905('0x6c')]('me',null,_0x378585);_0x12ff33[_0x2a5b93](_0x5c2cfa[_0xa905('0x6d')],_0x5c2cfa[_0xa905('0x63')][_0xa905('0x6e')],_0x5c2cfa[_0xa905('0x63')]['end']);break;}}else{var _0x5c2cfa=as[_0xa905('0x6c')](_0x498a92,_0x4d3310['type'],_0x378585);_0x12ff33[_0x2a5b93](_0x5c2cfa[_0xa905('0x6d')],_0x5c2cfa[_0xa905('0x63')]['start'],_0x5c2cfa[_0xa905('0x63')][_0xa905('0x25')]);}}}else{var _0x5c48c0=_(_0x1fc2f5[_0xa905('0x40')])[_0xa905('0x73')]()['map'](function(_0xc58416){return _['some'](_0x5b353e,['name',_0xc58416])?_0xc58416:undefined;})['compact']()[_0xa905('0x63')]();if(!_['isEmpty'](_0x5c48c0)){_0x5c48c0[_0xa905('0x30')](function(_0x4ef6ad){if(_0x4ef6ad===_0xa905('0x74')){_0x77efa3[_0xa905('0x75')](_0xa905('0x76'),[]['concat'](_0x1fc2f5[_0xa905('0x40')][_0x4ef6ad]));}else if(_0x4ef6ad===_0xa905('0x77')){var _0x2bbf6e=JSON[_0xa905('0x78')](_0x1fc2f5[_0xa905('0x40')][_0x4ef6ad])[_0xa905('0x79')];var _0x2c345e=JSON[_0xa905('0x78')](_0x1fc2f5[_0xa905('0x40')][_0x4ef6ad])[_0xa905('0x7a')];_0x77efa3[_0xa905('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2bbf6e,_0x2c345e);}else{if(_0x1fc2f5[_0xa905('0x40')][_0x4ef6ad]==='null'){_0x77efa3['where']('i.'+_0x4ef6ad+'\x20IS\x20NULL');}else{_0x77efa3[_0xa905('0x75')]('i.'+_0x4ef6ad+_0xa905('0x7b'),_0x1fc2f5[_0xa905('0x40')][_0x4ef6ad]);}}});}if(_0x1fc2f5[_0xa905('0x40')]['read']){if(_0x1fc2f5[_0xa905('0x40')][_0xa905('0x7c')]==0x1){_0x77efa3[_0xa905('0x64')]('`unreadMessages`\x20=\x200');}else{_0x77efa3[_0xa905('0x64')](_0xa905('0x7d'));}}if(_0x1fc2f5['query']['tag']){_0x364401=_[_0xa905('0x7e')](_0x1fc2f5[_0xa905('0x40')][_0xa905('0x7f')])?_0x1fc2f5['query'][_0xa905('0x7f')]:new Array(_0x1fc2f5[_0xa905('0x40')]['tag']);_0x364401[_0xa905('0x30')](function(_0x2d5764){_0x5f3fc9['or'](_0xa905('0x70'),'%,'+_0x2d5764+',%');});}if(_0x1fc2f5[_0xa905('0x40')][_0xa905('0x80')]){var _0x5c267b=_0x1fc2f5[_0xa905('0x40')][_0xa905('0x80')][_0xa905('0x81')]('\x5c','\x5c\x5c')[_0xa905('0x81')](/'/g,'\x27\x27');if(qs[_0xa905('0x82')](_0x5c267b)){_0x12ff33['or'](_0xa905('0x83'),_0x5c267b+'%')['or']('i.phone\x20LIKE\x20?',_0x5c267b+'%');}else{_0x12ff33['or'](_0xa905('0x84'),qs[_0xa905('0x69')](_0x5c267b))['or'](_0xa905('0x85'),_0x5c267b+'%');}}}_0x77efa3[_0xa905('0x75')](_0x12ff33);_0x77efa3[_0xa905('0x86')](_0xa905('0x87'));var _0x527503={'type':db['Sequelize'][_0xa905('0x88')][_0xa905('0x89')],'raw':!![]};var _0x39de99=_0x77efa3['clone']();_0x39de99[_0xa905('0x4a')]('i.id');_0x39de99['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa905('0x62'));if(_0x247475[_0xa905('0x8a')]){_0x247475[_0xa905('0x8a')]['forEach'](function(_0x4843e2){var _0x5654d0=_0x4843e2[0x0]==='contactName'?_0x4843e2[0x0]:'i.'+_0x4843e2[0x0];_0x77efa3['order'](_0x5654d0,_0x4843e2[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x364401)){_0x77efa3[_0xa905('0x64')](_0x5f3fc9);_0x39de99[_0xa905('0x75')]('t.id\x20IN\x20?',_0x364401);}BPromise['resolve']()[_0xa905('0x24')](function(){if(!_0x4320ec){if(_0x1fc2f5[_0xa905('0x40')][_0xa905('0x74')])return;_0x39de99[_0xa905('0x75')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x77efa3[_0xa905('0x75')](_0xa905('0x8b'));return;}if(_0x1fc2f5[_0xa905('0x8c')][_0xa905('0x8d')]!==_0xa905('0x8e'))return;return _0x1fc2f5[_0xa905('0x8c')][_0xa905('0x8f')]({'attributes':['id'],'raw':!![]})[_0xa905('0x24')](function(_0x3e9d6b){if(_['isEmpty'](_0x3e9d6b)){_0x39de99['where'](_0xa905('0x90'));_0x77efa3[_0xa905('0x75')](_0xa905('0x90'));}else{_0x39de99[_0xa905('0x75')](_0xa905('0x76'),_[_0xa905('0x2c')](_0x3e9d6b,'id'));_0x77efa3[_0xa905('0x75')](_0xa905('0x76'),_['map'](_0x3e9d6b,'id'));}});})[_0xa905('0x24')](function(){if(_0x1fc2f5[_0xa905('0x8c')][_0xa905('0x8d')]===_0xa905('0x8e')&&!_0x4320ec&&!_0x1fc2f5['query'][_0xa905('0x74')])return[];return db[_0xa905('0x91')][_0xa905('0x40')](_0x39de99[_0xa905('0x92')](),_0x527503);})['then'](function(_0x762777){_0x14b559[_0xa905('0x1f')]=_0x762777[_0xa905('0x45')];if(_0x14b559[_0xa905('0x1f')]===0x0)return[];return db[_0xa905('0x91')][_0xa905('0x40')](_0x5c9e8a[_0xa905('0x92')](),_0x527503)['then'](function(_0x57bd2b){_0x2ca873=_[_0xa905('0x93')](_0x57bd2b,'id');_0x527503=_['merge'](_0x527503,{'model':db[_0xa905('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fc2f5['query'][_0xa905('0x43')]){_0x247475[_0xa905('0x44')][_0xa905('0x30')](function(_0x2f521c){_0x77efa3['field']('i.'+_0x2f521c);});}else{_0x77efa3[_0xa905('0x4a')](_0xa905('0x94'),_0xa905('0x62'));_0x77efa3[_0xa905('0x4a')]('a.key',_0xa905('0x95'));_0x77efa3[_0xa905('0x4a')](_0xa905('0x96'),_0xa905('0x97'));_0x77efa3[_0xa905('0x4a')](_0xa905('0x98'),'contactName');_0x77efa3[_0xa905('0x4a')](_0xa905('0x99'));_0x77efa3['field'](_0xa905('0x9a'),_0xa905('0x9b'));_0x77efa3['field'](_0xa905('0x9c'),'Contact.lastName');_0x77efa3[_0xa905('0x4a')](_0xa905('0x9d'),_0xa905('0x9e'));_0x77efa3[_0xa905('0x4a')]('c.phone',_0xa905('0x9f'));_0x77efa3['field']('c.mobile',_0xa905('0xa0'));_0x77efa3[_0xa905('0x4a')](_0xa905('0xa1'),'Contact.fax');_0x77efa3['field'](_0xa905('0xa2'),_0xa905('0xa3'));_0x77efa3[_0xa905('0x4a')](_0xa905('0xa4'),'Owner.internal');_0x77efa3[_0xa905('0x4a')](_0xa905('0xa5'),_0xa905('0x2e'));}if(_0x247475[_0xa905('0x1e')])_0x77efa3[_0xa905('0x1e')](_0x247475[_0xa905('0x1e')]);if(_0x247475[_0xa905('0x1c')])_0x77efa3[_0xa905('0x1c')](_0x247475[_0xa905('0x1c')]);return db[_0xa905('0x91')][_0xa905('0x40')](_0x77efa3[_0xa905('0x92')](),_0x527503);})['then'](function(_0x20040f){if(_0x20040f[_0xa905('0x45')]>0x0)_0x28d10a[_0xa905('0x75')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x20040f,'id'));return db[_0xa905('0x91')]['query'](_0x28d10a[_0xa905('0x92')](),_0x527503)['then'](function(_0x5a37e6){var _0x1ded49=_[_0xa905('0xa6')](_0x5a37e6,'WhatsappInteractionId');var _0x223351=[];_0x20040f['forEach'](function(_0x2a73c1){_0x223351[_0xa905('0x31')](updateWhatsappInteraction(_0x2a73c1,_0x2ca873,_0x1ded49));});return BPromise['all'](_0x223351);});});})[_0xa905('0x24')](function(_0x23b8f3){_0x14b559[_0xa905('0xa7')]=_0x23b8f3;return _0x14b559;})['then'](respondWithFilteredResult(_0x48cc44,_0x247475))['catch'](handleError(_0x48cc44,null));};exports[_0xa905('0xa8')]=function(_0x20ead8,_0x3f3600){var _0x4d7562={'raw':![],'where':{'id':_0x20ead8[_0xa905('0xa9')]['id']}},_0x51430d={};_0x51430d[_0xa905('0x3f')]=_[_0xa905('0x73')](db[_0xa905('0x3a')][_0xa905('0x3b')]);_0x51430d[_0xa905('0x40')]=_[_0xa905('0x73')](_0x20ead8[_0xa905('0x40')]);_0x51430d[_0xa905('0x41')]=_['intersection'](_0x51430d['model'],_0x51430d[_0xa905('0x40')]);_0x4d7562[_0xa905('0x44')]=_[_0xa905('0x42')](_0x51430d[_0xa905('0x3f')],qs['fields'](_0x20ead8[_0xa905('0x40')]['fields']));_0x4d7562[_0xa905('0x44')]=_0x4d7562[_0xa905('0x44')][_0xa905('0x45')]?_0x4d7562[_0xa905('0x44')]:_0x51430d[_0xa905('0x3f')];if(_0x20ead8[_0xa905('0x40')]['includeAll']){_0x4d7562[_0xa905('0xaa')]=[{'all':!![]}];}_0x4d7562=_['merge']({},_0x4d7562,_0x20ead8[_0xa905('0xab')]);return db[_0xa905('0x3a')]['find'](_0x4d7562)[_0xa905('0x24')](handleEntityNotFound(_0x3f3600,null))[_0xa905('0x24')](respondWithResult(_0x3f3600,null))[_0xa905('0xac')](handleError(_0x3f3600,null));};exports[_0xa905('0xad')]=function(_0x2b76ca,_0x4872aa){return db[_0xa905('0x3a')][_0xa905('0xad')](_0x2b76ca[_0xa905('0x72')],{})['then'](respondWithResult(_0x4872aa,0xc9))['catch'](handleError(_0x4872aa,null));};exports[_0xa905('0x23')]=function(_0x32c5bf,_0x440d05){if(_0x32c5bf['body']['id']){delete _0x32c5bf[_0xa905('0x72')]['id'];}return db['WhatsappInteraction'][_0xa905('0x6a')]({'where':{'id':_0x32c5bf[_0xa905('0xa9')]['id']}})['then'](handleEntityNotFound(_0x440d05,null))[_0xa905('0x24')](saveUpdates(_0x32c5bf['body'],null))['then'](respondWithResult(_0x440d05,null))[_0xa905('0xac')](handleError(_0x440d05,null));};exports['destroy']=function(_0x114e3e,_0x49f7a9){return db[_0xa905('0x3a')][_0xa905('0x6a')]({'where':{'id':_0x114e3e[_0xa905('0xa9')]['id']}})['then'](handleEntityNotFound(_0x49f7a9,null))[_0xa905('0x24')](removeEntity(_0x49f7a9,null))['catch'](handleError(_0x49f7a9,null));};exports[_0xa905('0xae')]=function(_0x38abaf,_0x3c8855){return db[_0xa905('0x3a')][_0xa905('0xae')]()['then'](respondWithResult(_0x3c8855,null))[_0xa905('0xac')](handleError(_0x3c8855,null));};exports['addMessage']=function(_0x4c29db,_0x54ff65,_0x312fd8){return db[_0xa905('0xaf')][_0xa905('0x6a')]({'where':{'id':_0x4c29db[_0xa905('0xa9')]['id']}})[_0xa905('0x24')](handleEntityNotFound(_0x54ff65,null))[_0xa905('0x24')](function(_0x5e79cf){if(_0x5e79cf){return _0x5e79cf[_0xa905('0xb0')](_0x4c29db['body']['ids'],_[_0xa905('0xb1')](_0x4c29db[_0xa905('0x72')],[_0xa905('0xb2'),'id'])||{});}})[_0xa905('0x24')](respondWithResult(_0x54ff65,null))[_0xa905('0xac')](handleError(_0x54ff65,null));};exports[_0xa905('0xb3')]=function(_0x1525f1,_0x1e044f,_0x591299){var _0xc74b0b={'raw':![],'where':{}};var _0x1e6e58={};var _0x6f9d50={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x1525f1[_0xa905('0xa9')]['id']}})[_0xa905('0x24')](handleEntityNotFound(_0x1e044f,null))[_0xa905('0x24')](function(_0x2ee4b7){if(_0x2ee4b7){_0x1e6e58['model']=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x1e6e58[_0xa905('0x40')]=_[_0xa905('0x73')](_0x1525f1[_0xa905('0x40')]);_0x1e6e58[_0xa905('0x41')]=_[_0xa905('0x42')](_0x1e6e58[_0xa905('0x3f')],_0x1e6e58[_0xa905('0x40')]);_0xc74b0b['attributes']=_[_0xa905('0x42')](_0x1e6e58[_0xa905('0x3f')],qs[_0xa905('0x43')](_0x1525f1['query'][_0xa905('0x43')]));_0xc74b0b[_0xa905('0x44')]=_0xc74b0b['attributes'][_0xa905('0x45')]?_0xc74b0b['attributes']:_0x1e6e58[_0xa905('0x3f')];if(!_0x1525f1[_0xa905('0x40')][_0xa905('0xb4')](_0xa905('0x46'))){_0xc74b0b[_0xa905('0x1e')]=qs[_0xa905('0x1e')](_0x1525f1['query']['limit']);_0xc74b0b[_0xa905('0x1c')]=qs['offset'](_0x1525f1[_0xa905('0x40')][_0xa905('0x1c')]);}_0xc74b0b[_0xa905('0x8a')]=qs['sort'](_0x1525f1[_0xa905('0x40')][_0xa905('0x47')]);_0xc74b0b[_0xa905('0x75')]=qs[_0xa905('0x41')](_['pick'](_0x1525f1['query'],_0x1e6e58[_0xa905('0x41')]));_0xc74b0b[_0xa905('0x75')][_0xa905('0xb5')]=_0x2ee4b7['id'];if(_0x1525f1[_0xa905('0x40')]['filter']){_0xc74b0b[_0xa905('0x75')]=_[_0xa905('0xb6')](_0xc74b0b[_0xa905('0x75')],{'$or':_[_0xa905('0x2c')](_0xc74b0b['attributes'],function(_0x597402){var _0x2fa2fd={};_0x2fa2fd[_0x597402]={'$like':'%'+_0x1525f1[_0xa905('0x40')][_0xa905('0x80')]+'%'};return _0x2fa2fd;})});}if(_0x1525f1['query']['$gte']){var _0x1ecc21=_0x1525f1['query'][_0xa905('0x79')][_0xa905('0x68')](',');var _0x53c03f={};_0x53c03f[_0x1ecc21[0x0]]={'$gte':moment(_0x1ecc21[0x1])[_0xa905('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc74b0b[_0xa905('0x75')]=_[_0xa905('0xb6')](_0xc74b0b['where'],_0x53c03f);}_0xc74b0b=_[_0xa905('0xb6')]({},_0xc74b0b,_0x1525f1[_0xa905('0xab')]);return db[_0xa905('0xaf')][_0xa905('0x1f')]({'where':_0xc74b0b['where']})['then'](function(_0x1251f1){_0x6f9d50['count']=_0x1251f1;if(_0x1525f1[_0xa905('0x40')][_0xa905('0xb8')]){_0xc74b0b[_0xa905('0xaa')]=[{'all':!![]}];}return db[_0xa905('0xaf')][_0xa905('0xb9')](_0xc74b0b);})[_0xa905('0x24')](function(_0x1ee4c8){_0x6f9d50['rows']=_0x1ee4c8;return _0x6f9d50;});}})['then'](respondWithFilteredResult(_0x1e044f,_0xc74b0b))[_0xa905('0xac')](handleError(_0x1e044f,null));};exports['addTags']=function(_0x2a0c91,_0x578588,_0xeb1ec9){return db[_0xa905('0x3a')][_0xa905('0x6a')]({'where':{'id':_0x2a0c91[_0xa905('0xa9')]['id']}})[_0xa905('0x24')](handleEntityNotFound(_0x578588,null))[_0xa905('0x24')](function(_0x530f18){if(_0x530f18){return _0x530f18[_0xa905('0xba')](_0x2a0c91[_0xa905('0x72')]['ids'],_[_0xa905('0xb1')](_0x2a0c91[_0xa905('0x72')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xa905('0x29'),'color'],'where':{'id':_0x2a0c91[_0xa905('0x72')][_0xa905('0xb2')]}});})['then'](function(_0x29da82){socket[_0xa905('0xbb')]('whatsappInteractionTags:save',{'id':Number(_0x2a0c91[_0xa905('0xa9')]['id']),'tags':_0x29da82||[]});return{'id':Number(_0x2a0c91[_0xa905('0xa9')]['id']),'tags':_0x29da82||[]};});}})['then'](respondWithResult(_0x578588,null))[_0xa905('0xac')](handleError(_0x578588,null));};exports[_0xa905('0xbc')]=function(_0x1e6ffe,_0x4800c1,_0x4dff42){return db[_0xa905('0x3a')][_0xa905('0x6a')]({'where':{'id':_0x1e6ffe[_0xa905('0xa9')]['id']}})[_0xa905('0x24')](handleEntityNotFound(_0x4800c1,null))[_0xa905('0x24')](function(_0xd4c318){if(_0xd4c318){return _0xd4c318['removeTags'](_0x1e6ffe[_0xa905('0x40')][_0xa905('0xb2')]);}})['then'](respondWithStatusCode(_0x4800c1,null))[_0xa905('0xac')](handleError(_0x4800c1,null));};exports['download']=function(_0x334ead,_0x165826){var _0x4e1f1c=moment()[_0xa905('0xbd')]()['toString']();var _0xbe8150=path[_0xa905('0xbe')](config[_0xa905('0xbf')],'server',_0xa905('0xc0'),_0xa905('0xc1'));var _0x236e05=path[_0xa905('0xbe')](config[_0xa905('0xbf')],_0xa905('0xc2'),_0xa905('0xc0'),_0xa905('0xc3'));var _0x54286e=path[_0xa905('0xbe')](_0xbe8150,_0x4e1f1c);var _0x260f0b=util[_0xa905('0xb7')]('transcript-%d-%s.zip',_0x334ead[_0xa905('0xa9')]['id'],_0x4e1f1c);var _0x2bf83d=path['join'](_0xbe8150,_0x260f0b);var _0x458e0e=[];_0x458e0e[_0xa905('0x31')]({'model':db[_0xa905('0xc4')],'as':_0xa905('0xc4'),'attributes':['id',_0xa905('0x2d')],'raw':!![]});_0x458e0e['push']({'model':db[_0xa905('0xc5')],'as':_0xa905('0xc6'),'attributes':['id',_0xa905('0xc7'),'lastName'],'raw':!![]});if(_0x334ead[_0xa905('0x40')][_0xa905('0xc3')]){_0x458e0e[_0xa905('0x31')]({'model':db[_0xa905('0xc8')],'as':'Attachment','raw':!![]});}var _0x2eb8f8=[{'model':db['WhatsappMessage'],'as':_0xa905('0xc9'),'attributes':['id',_0xa905('0x72'),_0xa905('0x77'),'direction',_0xa905('0xca'),_0xa905('0x7c')],'include':_0x458e0e}];_0x2eb8f8[_0xa905('0x31')]({'model':db[_0xa905('0xcb')],'as':_0xa905('0xcc'),'attributes':['id','name']});_0x2eb8f8[_0xa905('0x31')]({'model':db[_0xa905('0xc4')],'as':'Owner','attributes':['id',_0xa905('0x2d')]});return db[_0xa905('0x3a')]['find']({'where':{'id':_0x334ead[_0xa905('0xa9')]['id']},'include':_0x2eb8f8})['then'](handleEntityNotFound(_0x165826,null))[_0xa905('0x24')](function(_0x406ff5){if(_0x406ff5){var _0x28a671=_0x406ff5['get']({'plain':!![]});fs['mkdirSync'](_0x54286e);var _0x3b9263={'channel':'Whatsapp','account':_0x28a671[_0xa905('0xcc')][_0xa905('0x29')],'agent':_0x28a671['Owner']?_0x28a671['Owner'][_0xa905('0x2d')]:_0xa905('0xcd'),'createdAt':moment(_0x28a671[_0xa905('0x77')])[_0xa905('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa905('0x92')](),'closedAt':_0x28a671[_0xa905('0x36')]?moment(_0x28a671['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa905('0x92')]():'','disposition':_0x28a671['disposition'],'messages':_(_0x28a671[_0xa905('0xc9')])['filter']({'secret':![]})['map'](function(_0x191561){if(_0x191561[_0xa905('0xc8')]){var _0x3b0e34=path[_0xa905('0xbe')](_0x236e05,_0x191561[_0xa905('0xc8')][_0xa905('0xce')]);if(fs[_0xa905('0xcf')](_0x3b0e34)){fs[_0xa905('0xd0')](_0x3b0e34)[_0xa905('0xd1')](fs[_0xa905('0xd2')](path['join'](_0x54286e,_0x191561[_0xa905('0xc8')][_0xa905('0xce')])));}}return{'date':moment(_0x191561[_0xa905('0x77')])[_0xa905('0xb7')](_0xa905('0xd3'))[_0xa905('0x92')](),'sender':_0x191561[_0xa905('0xd4')]==='out'?_0x191561[_0xa905('0xc4')]?_0x191561[_0xa905('0xc4')][_0xa905('0x2d')]:_0xa905('0xd5'):_0x191561[_0xa905('0xc6')][_0xa905('0xc7')]+(_0x191561[_0xa905('0xc6')]['lastName']?'\x20'+_0x191561['Contact'][_0xa905('0xd6')]:''),'body':_0x191561[_0xa905('0xc8')]?_0x191561['Attachment'][_0xa905('0xce')]:_0x191561[_0xa905('0x72')],'direction':_0x191561[_0xa905('0xd4')]===_0xa905('0xd7')?'A':'C','secret':_0x191561[_0xa905('0xca')],'read':_0x191561[_0xa905('0x7c')],'attachment':_0x191561[_0xa905('0xc8')]};})[_0xa905('0x63')]()};return ejs['renderFile'](path[_0xa905('0xbe')](config[_0xa905('0xbf')],_0xa905('0xc2'),'views',_0xa905('0xd8')),{'interaction':_0x3b9263})[_0xa905('0x24')](function(_0x2853a8){var _0x3cc4dd=path[_0xa905('0xbe')](_0x54286e,'transcript-'+_0x28a671['id']+'-'+_0x4e1f1c+'.pdf');var _0x537e38={'path':_0x3cc4dd,'channel':_0xa905('0xd9'),'interactionId':_0x28a671['id']};return pdf[_0xa905('0xda')](_0x2853a8,_0x537e38);})[_0xa905('0x24')](function(){return new BPromise(function(_0x537c3c,_0x3849be){zipdir(_0x54286e,{'saveTo':_0x2bf83d},function(_0x36f42a,_0x295490){if(_0x36f42a)return _0x3849be(_0x36f42a);return _0x537c3c(_0x295490);});})['then'](function(){return new BPromise(function(_0x3b9191,_0x41f26c){rimraf(_0x54286e,function(_0x46fae2){if(_0x46fae2)_0x41f26c(_0x46fae2);return _0x3b9191();});});})[_0xa905('0x24')](function(){return _0x165826[_0xa905('0xdb')](_0x2bf83d,_0x260f0b,function(_0x46a91f){if(_0x46a91f){console['log'](_0xa905('0xdc'),_0x46a91f);}else{fs[_0xa905('0xdd')](_0x2bf83d);}});});});}else{return _0x165826['sendStatus'](0xc8);}})[_0xa905('0xac')](handleError(_0x165826,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 35d6c5c..cd28b29 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 _0x9bc3=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll'];(function(_0x21454b,_0x38f173){var _0x45557b=function(_0x8135b1){while(--_0x8135b1){_0x21454b['push'](_0x21454b['shift']());}};_0x45557b(++_0x38f173);}(_0x9bc3,0x137));var _0x39bc=function(_0x544391,_0x1e996c){_0x544391=_0x544391-0x0;var _0x506b00=_0x9bc3[_0x544391];return _0x506b00;};'use strict';var EventEmitter=require(_0x39bc('0x0'));var WhatsappInteraction=require(_0x39bc('0x1'))['db'][_0x39bc('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x39bc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x39bc('0x4')](0x0);var events={'afterCreate':_0x39bc('0x5'),'afterUpdate':_0x39bc('0x6'),'afterDestroy':'remove'};function emitEvent(_0xdce94f){return function(_0xe8d119,_0x99ef87,_0x442ec9){_0xe8d119['getUsers']({'attributes':['id'],'raw':!![]})[_0x39bc('0x7')](function(_0x1367c6){_0xe8d119[_0x39bc('0x8')](_0x39bc('0x9'),_0x1367c6[_0x39bc('0xa')](function(_0x286294){return{'id':_0x286294['id']};}));return WhatsappMessage[_0x39bc('0xb')]({'where':{'WhatsappInteractionId':_0xe8d119['id'],'direction':'in','read':![]},'raw':!![]});})[_0x39bc('0x7')](function(_0x4e9b81){_0xe8d119[_0x39bc('0x8')](_0x39bc('0xc'),_0x4e9b81[_0x39bc('0xd')]);WhatsappInteractionEvents[_0x39bc('0xe')](_0xdce94f+':'+_0xe8d119['id'],_0xe8d119);WhatsappInteractionEvents[_0x39bc('0xe')](_0xdce94f,_0xe8d119);_0x442ec9(null);})[_0x39bc('0xf')](_0x442ec9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x39bc('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc961=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x8b5a51,_0x14915c){var _0x405b9a=function(_0x35ab34){while(--_0x35ab34){_0x8b5a51['push'](_0x8b5a51['shift']());}};_0x405b9a(++_0x14915c);}(_0xc961,0x17a));var _0x1c96=function(_0x59385f,_0x218c19){_0x59385f=_0x59385f-0x0;var _0x3502df=_0xc961[_0x59385f];return _0x3502df;};'use strict';var EventEmitter=require(_0x1c96('0x0'));var WhatsappInteraction=require(_0x1c96('0x1'))['db'][_0x1c96('0x2')];var WhatsappMessage=require(_0x1c96('0x1'))['db'][_0x1c96('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1c96('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30d2e0){return function(_0x494d92,_0x180969,_0x5594ee){_0x494d92[_0x1c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x1c96('0x6')](function(_0x1f09ff){_0x494d92[_0x1c96('0x7')](_0x1c96('0x8'),_0x1f09ff[_0x1c96('0x9')](function(_0x5523de){return{'id':_0x5523de['id']};}));return WhatsappMessage[_0x1c96('0xa')]({'where':{'WhatsappInteractionId':_0x494d92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c96('0x6')](function(_0x691a95){_0x494d92[_0x1c96('0x7')](_0x1c96('0xb'),_0x691a95[_0x1c96('0xc')]);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0+':'+_0x494d92['id'],_0x494d92);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0,_0x494d92);_0x5594ee(null);})[_0x1c96('0xe')](_0x5594ee(null));};}for(var e in events){if(events[_0x1c96('0xf')](e)){var event=events[e];WhatsappInteraction[_0x1c96('0x10')](e,emitEvent(event));}}module[_0x1c96('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b08ea75..ffa18e4 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 _0xd8d7=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x5c1d76,_0x1052b5){var _0x4ef7f5=function(_0x4d8972){while(--_0x4d8972){_0x5c1d76['push'](_0x5c1d76['shift']());}};_0x4ef7f5(++_0x1052b5);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xd8d7[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7d8d('0x0'));var util=require(_0x7d8d('0x1'));var logger=require(_0x7d8d('0x2'))(_0x7d8d('0x3'));var moment=require(_0x7d8d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d8d('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0x7d8d('0x6')]=function(_0x35f2b2,_0x1dce79){return _0x35f2b2[_0x7d8d('0x7')](_0x7d8d('0x8'),attributes,{'tableName':_0x7d8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bac2e,_0x506fcd,_0x102889){if(_0x1bac2e[_0x7d8d('0xa')](_0x7d8d('0xb'))){_0x1bac2e[_0x7d8d('0xc')]=moment()[_0x7d8d('0xd')](_0x7d8d('0xe'));}_0x102889(null,_0x1bac2e);}}});}; \ No newline at end of file +var _0x6100=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closed','format'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6100,0x1e1));var _0x0610=function(_0x57aa88,_0xcc7362){_0x57aa88=_0x57aa88-0x0;var _0x2103a1=_0x6100[_0x57aa88];return _0x2103a1;};'use strict';var _=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var logger=require(_0x0610('0x2'))(_0x0610('0x3'));var moment=require(_0x0610('0x4'));var BPromise=require('bluebird');var rp=require(_0x0610('0x5'));var fs=require('fs');var path=require(_0x0610('0x6'));var rimraf=require(_0x0610('0x7'));var config=require(_0x0610('0x8'));var attributes=require(_0x0610('0x9'));module[_0x0610('0xa')]=function(_0x21e4d6,_0x4844a2){return _0x21e4d6[_0x0610('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x0610('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1befc0,_0x3757e5,_0x27c33d){if(_0x1befc0['changed'](_0x0610('0xd'))){_0x1befc0['closedAt']=moment()[_0x0610('0xe')](_0x0610('0xf'));}_0x27c33d(null,_0x1befc0);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c0a3e42..316c9e7 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 _0x4921=['moment','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','update','body','options','raw','where','attributes','UpdateWhatsappInteraction','debug','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','AddTags','lodash','util'];(function(_0x4c64b2,_0x4f361f){var _0x226576=function(_0x3bfe17){while(--_0x3bfe17){_0x4c64b2['push'](_0x4c64b2['shift']());}};_0x226576(++_0x4f361f);}(_0x4921,0x14b));var _0x1492=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x4921[_0x3bd52b];return _0x1e5b89;};'use strict';var _=require(_0x1492('0x0'));var util=require(_0x1492('0x1'));var moment=require(_0x1492('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1492('0x3'));var db=require(_0x1492('0x4'))['db'];var utils=require(_0x1492('0x5'));var logger=require('../../config/logger')(_0x1492('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1492('0x7')]['http']({'port':0x232a});config[_0x1492('0x8')]=_[_0x1492('0x9')](config['redis'],{'host':_0x1492('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1492('0x8')]));require(_0x1492('0xb'))[_0x1492('0xc')](socket);function respondWithRpcPromise(_0x2f5087,_0x60ed3f,_0x5be3e9){return new BPromise(function(_0x2dc4ac,_0x5d68eb){return client[_0x1492('0xd')](_0x2f5087,_0x5be3e9)[_0x1492('0xe')](function(_0x3e0357){logger[_0x1492('0xf')](_0x1492('0x10'),_0x60ed3f,_0x1492('0x11'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x60ed3f,_0x1492('0x11'),JSON['stringify'](_0x3e0357));if(_0x3e0357[_0x1492('0x12')]){if(_0x3e0357[_0x1492('0x12')][_0x1492('0x13')]===0x1f4){logger[_0x1492('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x60ed3f,_0x3e0357['error'][_0x1492('0x14')]);return _0x5d68eb(_0x3e0357[_0x1492('0x12')][_0x1492('0x14')]);}logger[_0x1492('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x60ed3f,_0x3e0357[_0x1492('0x12')][_0x1492('0x14')]);return _0x2dc4ac(_0x3e0357[_0x1492('0x12')][_0x1492('0x14')]);}else{logger[_0x1492('0xf')](_0x1492('0x10'),_0x60ed3f,'request\x20sent');_0x2dc4ac(_0x3e0357['result'][_0x1492('0x14')]);}})[_0x1492('0x15')](function(_0x5d5902){logger[_0x1492('0x12')](_0x1492('0x10'),_0x60ed3f,_0x5d5902);_0x5d68eb(_0x5d5902);});});}exports['UpdateWhatsappInteraction']=function(_0x190563){var _0x152c88=this;return new Promise(function(_0x169328,_0x4385ef){return db['WhatsappInteraction'][_0x1492('0x16')](_0x190563[_0x1492('0x17')],{'raw':_0x190563[_0x1492('0x18')]?_0x190563['options'][_0x1492('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x190563['options']?_0x190563[_0x1492('0x18')][_0x1492('0x1a')]||null:null,'attributes':_0x190563[_0x1492('0x18')]?_0x190563[_0x1492('0x18')][_0x1492('0x1b')]||null:null,'limit':_0x190563[_0x1492('0x18')]?_0x190563[_0x1492('0x18')]['limit']||null:null})[_0x1492('0xe')](function(_0x16a781){logger[_0x1492('0xf')](_0x1492('0x1c'),_0x190563);logger[_0x1492('0x1d')](_0x1492('0x1c'),_0x190563,JSON[_0x1492('0x1e')](_0x16a781));_0x169328(_0x16a781);})[_0x1492('0x15')](function(_0x5920b5){logger[_0x1492('0x12')](_0x1492('0x1c'),_0x5920b5[_0x1492('0x14')],_0x190563);_0x4385ef(_0x152c88['error'](0x1f4,_0x5920b5[_0x1492('0x14')]));});});};exports[_0x1492('0x1f')]=function(_0x59d84a){return new Promise(function(_0x31bc5e,_0x2cf4ae){return db[_0x1492('0x20')][_0x1492('0x21')]({'where':_0x59d84a[_0x1492('0x18')]?_0x59d84a['options'][_0x1492('0x1a')]||null:null})[_0x1492('0xe')](function(_0xcd6c7f){if(_0xcd6c7f){return _0xcd6c7f[_0x1492('0x22')](_0x59d84a[_0x1492('0x17')][_0x1492('0x23')],_['omit'](_0x59d84a[_0x1492('0x17')],['ids','id'])||{});}})['spread'](function(_0x1278a2){logger[_0x1492('0xf')](_0x1492('0x24'),_0x59d84a);logger[_0x1492('0x1d')](_0x1492('0x24'),_0x59d84a,JSON[_0x1492('0x1e')](_0x1278a2));_0x31bc5e(_0x1278a2);})[_0x1492('0x15')](function(_0x5905bc){logger[_0x1492('0x12')](_0x1492('0x24'),_0x5905bc['message'],_0x59d84a);_0x2cf4ae(_this[_0x1492('0x12')](0x1f4,_0x5905bc['message']));});});}; \ No newline at end of file +var _0x94dd=['result','catch','WhatsappInteraction','update','body','options','where','attributes','limit','debug','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message'];(function(_0x5404f6,_0x5900a7){var _0x13230b=function(_0x15be12){while(--_0x15be12){_0x5404f6['push'](_0x5404f6['shift']());}};_0x13230b(++_0x5900a7);}(_0x94dd,0x13e));var _0xd94d=function(_0xa8f8cd,_0x701b94){_0xa8f8cd=_0xa8f8cd-0x0;var _0x27e755=_0x94dd[_0xa8f8cd];return _0x27e755;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd94d('0x0'));var rs=require(_0xd94d('0x1'));var fs=require('fs');var Redis=require(_0xd94d('0x2'));var db=require(_0xd94d('0x3'))['db'];var utils=require(_0xd94d('0x4'));var logger=require(_0xd94d('0x5'))(_0xd94d('0x6'));var config=require(_0xd94d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd94d('0x8')][_0xd94d('0x9')]({'port':0x232a});config[_0xd94d('0xa')]=_[_0xd94d('0xb')](config[_0xd94d('0xa')],{'host':_0xd94d('0xc'),'port':0x18eb});var socket=require(_0xd94d('0xd'))(new Redis(config[_0xd94d('0xa')]));require(_0xd94d('0xe'))[_0xd94d('0xf')](socket);function respondWithRpcPromise(_0xc27796,_0x3c9113,_0x1240c4){return new BPromise(function(_0x2e3800,_0x55af7a){return client[_0xd94d('0x10')](_0xc27796,_0x1240c4)[_0xd94d('0x11')](function(_0x1bebe8){logger[_0xd94d('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c9113,_0xd94d('0x13'));logger['debug'](_0xd94d('0x14'),_0x3c9113,_0xd94d('0x13'),JSON[_0xd94d('0x15')](_0x1bebe8));if(_0x1bebe8[_0xd94d('0x16')]){if(_0x1bebe8['error'][_0xd94d('0x17')]===0x1f4){logger['error'](_0xd94d('0x18'),_0x3c9113,_0x1bebe8[_0xd94d('0x16')]['message']);return _0x55af7a(_0x1bebe8['error'][_0xd94d('0x19')]);}logger[_0xd94d('0x16')](_0xd94d('0x18'),_0x3c9113,_0x1bebe8[_0xd94d('0x16')][_0xd94d('0x19')]);return _0x2e3800(_0x1bebe8[_0xd94d('0x16')][_0xd94d('0x19')]);}else{logger[_0xd94d('0x12')](_0xd94d('0x18'),_0x3c9113,_0xd94d('0x13'));_0x2e3800(_0x1bebe8[_0xd94d('0x1a')]['message']);}})[_0xd94d('0x1b')](function(_0x59c642){logger[_0xd94d('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c9113,_0x59c642);_0x55af7a(_0x59c642);});});}exports['UpdateWhatsappInteraction']=function(_0x13fd03){var _0x39c0c7=this;return new Promise(function(_0x35f32f,_0x700b4c){return db[_0xd94d('0x1c')][_0xd94d('0x1d')](_0x13fd03[_0xd94d('0x1e')],{'raw':_0x13fd03[_0xd94d('0x1f')]?_0x13fd03[_0xd94d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13fd03[_0xd94d('0x1f')]?_0x13fd03[_0xd94d('0x1f')][_0xd94d('0x20')]||null:null,'attributes':_0x13fd03[_0xd94d('0x1f')]?_0x13fd03[_0xd94d('0x1f')][_0xd94d('0x21')]||null:null,'limit':_0x13fd03[_0xd94d('0x1f')]?_0x13fd03[_0xd94d('0x1f')][_0xd94d('0x22')]||null:null})[_0xd94d('0x11')](function(_0x4a4dd6){logger[_0xd94d('0x12')]('UpdateWhatsappInteraction',_0x13fd03);logger[_0xd94d('0x23')](_0xd94d('0x24'),_0x13fd03,JSON['stringify'](_0x4a4dd6));_0x35f32f(_0x4a4dd6);})['catch'](function(_0x302034){logger[_0xd94d('0x16')](_0xd94d('0x24'),_0x302034[_0xd94d('0x19')],_0x13fd03);_0x700b4c(_0x39c0c7[_0xd94d('0x16')](0x1f4,_0x302034[_0xd94d('0x19')]));});});};exports[_0xd94d('0x25')]=function(_0x36d72a){return new Promise(function(_0x1c16b1,_0xf09143){return db[_0xd94d('0x1c')][_0xd94d('0x26')]({'where':_0x36d72a[_0xd94d('0x1f')]?_0x36d72a[_0xd94d('0x1f')]['where']||null:null})['then'](function(_0x137b27){if(_0x137b27){return _0x137b27['addTags'](_0x36d72a['body'][_0xd94d('0x27')],_[_0xd94d('0x28')](_0x36d72a[_0xd94d('0x1e')],[_0xd94d('0x27'),'id'])||{});}})[_0xd94d('0x29')](function(_0x1ed626){logger[_0xd94d('0x12')](_0xd94d('0x2a'),_0x36d72a);logger[_0xd94d('0x23')](_0xd94d('0x2a'),_0x36d72a,JSON[_0xd94d('0x15')](_0x1ed626));_0x1c16b1(_0x1ed626);})[_0xd94d('0x1b')](function(_0x1adf6a){logger[_0xd94d('0x16')](_0xd94d('0x2a'),_0x1adf6a[_0xd94d('0x19')],_0x36d72a);_0xf09143(_this[_0xd94d('0x16')](0x1f4,_0x1adf6a[_0xd94d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d30e5c0..77637cd 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 _0xe3b9=['save','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x4612c7,_0x52e029){var _0x2e004b=function(_0x227a13){while(--_0x227a13){_0x4612c7['push'](_0x4612c7['shift']());}};_0x2e004b(++_0x52e029);}(_0xe3b9,0x19f));var _0x9e3b=function(_0x1a88d9,_0x3f1601){_0x1a88d9=_0x1a88d9-0x0;var _0x1d572f=_0xe3b9[_0x1a88d9];return _0x1d572f;};'use strict';var WhatsappInteractionEvents=require(_0x9e3b('0x0'));var events=[_0x9e3b('0x1'),'remove',_0x9e3b('0x2')];function createListener(_0x14d81e,_0x4e5b6d){return function(_0x241d33){_0x4e5b6d[_0x9e3b('0x3')](_0x14d81e,_0x241d33);};}function removeListener(_0x2b301d,_0x31bd16){return function(){WhatsappInteractionEvents[_0x9e3b('0x4')](_0x2b301d,_0x31bd16);};}exports[_0x9e3b('0x5')]=function(_0x4fe6df){for(var _0xae45d5=0x0,_0x2bb3a9=events[_0x9e3b('0x6')];_0xae45d5<_0x2bb3a9;_0xae45d5++){var _0x1b91d2=events[_0xae45d5];var _0x271e5b=createListener(_0x9e3b('0x7')+_0x1b91d2,_0x4fe6df);WhatsappInteractionEvents['on'](_0x1b91d2,_0x271e5b);}}; \ No newline at end of file +var _0xa08e=['removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa08e,0x143));var _0xea08=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xa08e[_0x295314];return _0x584b0c;};'use strict';var WhatsappInteractionEvents=require(_0xea08('0x0'));var events=[_0xea08('0x1'),_0xea08('0x2'),_0xea08('0x3')];function createListener(_0x11a448,_0x3878e1){return function(_0x3f4c4b){_0x3878e1[_0xea08('0x4')](_0x11a448,_0x3f4c4b);};}function removeListener(_0x942b82,_0x2e0ff9){return function(){WhatsappInteractionEvents[_0xea08('0x5')](_0x942b82,_0x2e0ff9);};}exports['register']=function(_0x3c30c3){for(var _0x574e28=0x0,_0x4bf885=events[_0xea08('0x6')];_0x574e28<_0x4bf885;_0x574e28++){var _0x272d74=events[_0x574e28];var _0x32148c=createListener(_0xea08('0x7')+_0x272d74,_0x3c30c3);WhatsappInteractionEvents['on'](_0x272d74,_0x32148c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0e5e172..3cee0b7 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 _0x6649=['put','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','whatsapp','create','post','/:id/status'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6649,0x1a7));var _0x9664=function(_0x3fe6de,_0x3360b5){_0x3fe6de=_0x3fe6de-0x0;var _0x2f4153=_0x6649[_0x3fe6de];return _0x2f4153;};'use strict';var multer=require(_0x9664('0x0'));var util=require(_0x9664('0x1'));var path=require(_0x9664('0x2'));var timeout=require(_0x9664('0x3'));var express=require(_0x9664('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9664('0x5'));var interaction=require(_0x9664('0x6'));var config=require('../../config/environment');var controller=require(_0x9664('0x7'));router[_0x9664('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9664('0x8')]('/describe',auth[_0x9664('0x9')](),controller[_0x9664('0xa')]);router[_0x9664('0x8')](_0x9664('0xb'),auth[_0x9664('0x9')](),controller[_0x9664('0xc')]);router['post']('/',auth[_0x9664('0x9')](),interaction['tracked'](_0x9664('0xd'),'whatsappmessage:create'),controller[_0x9664('0xe')]);router[_0x9664('0xf')](_0x9664('0x10'),controller['status']);router[_0x9664('0x11')](_0x9664('0xb'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0x9664('0x9')](),controller[_0x9664('0x12')]);router[_0x9664('0x11')](_0x9664('0x13'),auth[_0x9664('0x9')](),controller['reject']);router['delete']('/:id',auth[_0x9664('0x9')](),controller[_0x9664('0x14')]);module[_0x9664('0x15')]=router; \ No newline at end of file +var _0x93a2=['/:id/accept','accept','put','reject','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','post','whatsappmessage:create','create','/:id/status','status','update'];(function(_0x4be9e1,_0x21054a){var _0x2e7b12=function(_0x76caf6){while(--_0x76caf6){_0x4be9e1['push'](_0x4be9e1['shift']());}};_0x2e7b12(++_0x21054a);}(_0x93a2,0x155));var _0x293a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x93a2[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require(_0x293a('0x0'));var path=require(_0x293a('0x1'));var timeout=require(_0x293a('0x2'));var express=require(_0x293a('0x3'));var router=express['Router']();var fs_extra=require(_0x293a('0x4'));var auth=require(_0x293a('0x5'));var interaction=require(_0x293a('0x6'));var config=require('../../config/environment');var controller=require(_0x293a('0x7'));router[_0x293a('0x8')]('/',auth['isAuthenticated'](),controller[_0x293a('0x9')]);router[_0x293a('0x8')]('/describe',auth[_0x293a('0xa')](),controller[_0x293a('0xb')]);router[_0x293a('0x8')](_0x293a('0xc'),auth[_0x293a('0xa')](),controller['show']);router[_0x293a('0xd')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x293a('0xe')),controller[_0x293a('0xf')]);router['post'](_0x293a('0x10'),controller[_0x293a('0x11')]);router['put']('/:id',auth[_0x293a('0xa')](),controller[_0x293a('0x12')]);router['put'](_0x293a('0x13'),auth[_0x293a('0xa')](),controller[_0x293a('0x14')]);router[_0x293a('0x15')]('/:id/reject',auth[_0x293a('0xa')](),controller[_0x293a('0x16')]);router['delete'](_0x293a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x293a('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 76145a8..b983410 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 _0x5ad6=['STRING','DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x5959e2,_0x3a8ac3){var _0x299a72=function(_0x5d5706){while(--_0x5d5706){_0x5959e2['push'](_0x5959e2['shift']());}};_0x299a72(++_0x3a8ac3);}(_0x5ad6,0xba));var _0x65ad=function(_0x116573,_0x234dde){_0x116573=_0x116573-0x0;var _0x4274e0=_0x5ad6[_0x116573];return _0x4274e0;};'use strict';var Sequelize=require(_0x65ad('0x0'));module[_0x65ad('0x1')]={'body':{'type':Sequelize[_0x65ad('0x2')](_0x65ad('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x65ad('0x4')]('in',_0x65ad('0x5')),'defaultValue':_0x65ad('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x65ad('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x65ad('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x65ad('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5084=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x5b9d8a,_0xecbb7a){var _0x3250fc=function(_0x159479){while(--_0x159479){_0x5b9d8a['push'](_0x5b9d8a['shift']());}};_0x3250fc(++_0xecbb7a);}(_0x5084,0xde));var _0x4508=function(_0x2bc5ab,_0x5ceb6c){_0x2bc5ab=_0x2bc5ab-0x0;var _0x2c51a6=_0x5084[_0x2bc5ab];return _0x2c51a6;};'use strict';var Sequelize=require(_0x4508('0x0'));module[_0x4508('0x1')]={'body':{'type':Sequelize[_0x4508('0x2')](_0x4508('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4508('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4508('0x5')]('in',_0x4508('0x6')),'defaultValue':_0x4508('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4508('0x7')](0xbe)},'phone':{'type':Sequelize[_0x4508('0x7')]},'readAt':{'type':Sequelize[_0x4508('0x8')]},'secret':{'type':Sequelize[_0x4508('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4508('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 32bee41..c5cdd31 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 _0x87c8=['WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','body','params','describe','accept','whatsapp','read','readAt','format','UserId','user','agent','get','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE: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','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteraction','WhatsappInteractionId','RejectMessage','rejectMessage','SELECT','motionChannel','WhatsappAccountId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x87c8,0x1ae));var _0x887c=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x87c8[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0x887c('0x0'));var rimraf=require(_0x887c('0x1'));var zipdir=require(_0x887c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x887c('0x3'));var moment=require(_0x887c('0x4'));var BPromise=require(_0x887c('0x5'));var Mustache=require(_0x887c('0x6'));var util=require(_0x887c('0x7'));var path=require('path');var sox=require(_0x887c('0x8'));var csv=require('to-csv');var ejs=require(_0x887c('0x9'));var fs=require('fs');var fs_extra=require(_0x887c('0xa'));var _=require('lodash');var squel=require(_0x887c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x887c('0xc'));var querystring=require(_0x887c('0xd'));var Papa=require(_0x887c('0xe'));var Redis=require(_0x887c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x887c('0x10'));var as=require(_0x887c('0x11'));var hardwareService=require(_0x887c('0x12'));var logger=require(_0x887c('0x13'))(_0x887c('0x14'));var utils=require(_0x887c('0x15'));var config=require(_0x887c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x887c('0x17'))['db'];config['redis']=_['defaults'](config[_0x887c('0x18')],{'host':_0x887c('0x19'),'port':0x18eb});var socket=require(_0x887c('0x1a'))(new Redis(config[_0x887c('0x18')]));require(_0x887c('0x1b'))[_0x887c('0x1c')](socket);var jayson=require(_0x887c('0x1d'));var client=jayson[_0x887c('0x1e')][_0x887c('0x1f')]({'port':0x232c});var client9002=jayson[_0x887c('0x1e')][_0x887c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1c9219,_0x4a64a9,_0xc2b195,_0x2580d6){return new BPromise(function(_0x34eda3,_0x4de23d){var _0x5bdd11=_0x2580d6||client;return _0x5bdd11[_0x887c('0x20')](_0x1c9219,_0xc2b195)[_0x887c('0x21')](function(_0x14d97c){logger[_0x887c('0x22')](_0x887c('0x23'),_0x4a64a9,_0x887c('0x24'));logger[_0x887c('0x25')](_0x887c('0x26'),_0x4a64a9,_0x887c('0x24'),JSON[_0x887c('0x27')](_0x14d97c));if(_0x14d97c[_0x887c('0x28')]){if(_0x14d97c[_0x887c('0x28')][_0x887c('0x29')]===0x1f4){logger[_0x887c('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x4a64a9,_0x14d97c[_0x887c('0x28')][_0x887c('0x2a')]);return _0x4de23d(_0x14d97c[_0x887c('0x28')]['message']);}logger['error'](_0x887c('0x23'),_0x4a64a9,_0x14d97c[_0x887c('0x28')][_0x887c('0x2a')]);return _0x34eda3(_0x14d97c['error'][_0x887c('0x2a')]);}else{logger[_0x887c('0x22')](_0x887c('0x23'),_0x4a64a9,'request\x20sent');_0x34eda3(_0x14d97c[_0x887c('0x2b')][_0x887c('0x2a')]);}})[_0x887c('0x2c')](function(_0x592e35){logger['error'](_0x887c('0x23'),_0x4a64a9,_0x592e35);_0x4de23d(_0x592e35);});});}function respondWithStatusCode(_0x426daf,_0x4f0fd0){_0x4f0fd0=_0x4f0fd0||0xcc;return function(_0x5eb3df){if(_0x5eb3df){return _0x426daf['sendStatus'](_0x4f0fd0);}return _0x426daf[_0x887c('0x2d')](_0x4f0fd0)[_0x887c('0x2e')]();};}function respondWithResult(_0x695b80,_0x488a61){_0x488a61=_0x488a61||0xc8;return function(_0x519a0e){if(_0x519a0e){return _0x695b80[_0x887c('0x2d')](_0x488a61)['json'](_0x519a0e);}};}function respondWithFilteredResult(_0x55029b,_0x4427b6){return function(_0x58eb5b){if(_0x58eb5b){var _0x5a3bf4=typeof _0x4427b6[_0x887c('0x2f')]==='undefined'&&typeof _0x4427b6['limit']===_0x887c('0x30');var _0x2e0c87=_0x58eb5b[_0x887c('0x31')];var _0x5c49ef=_0x5a3bf4?0x0:_0x4427b6[_0x887c('0x2f')];var _0x956ddb=_0x5a3bf4?_0x58eb5b['count']:_0x4427b6['offset']+_0x4427b6[_0x887c('0x32')];var _0x58b572;if(_0x956ddb>=_0x2e0c87){_0x956ddb=_0x2e0c87;_0x58b572=0xc8;}else{_0x58b572=0xce;}_0x55029b['status'](_0x58b572);return _0x55029b[_0x887c('0x33')](_0x887c('0x34'),_0x5c49ef+'-'+_0x956ddb+'/'+_0x2e0c87)[_0x887c('0x35')](_0x58eb5b);}return null;};}function patchUpdates(_0x5ee79c){return function(_0x348f1c){try{jsonpatch[_0x887c('0x36')](_0x348f1c,_0x5ee79c,!![]);}catch(_0xdabed){return BPromise[_0x887c('0x37')](_0xdabed);}return _0x348f1c[_0x887c('0x38')]();};}function saveUpdates(_0x985290,_0x4baf6d){return function(_0x2842c2){if(_0x2842c2){return _0x2842c2[_0x887c('0x39')](_0x985290)[_0x887c('0x21')](function(_0x4dc8f1){return _0x4dc8f1;});}return null;};}function removeEntity(_0x5c8695,_0xe7d0ca){return function(_0x425db0){if(_0x425db0){return _0x425db0[_0x887c('0x3a')]()['then'](function(){_0x5c8695[_0x887c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b39f,_0x177638){return function(_0x3e94ad){if(!_0x3e94ad){_0x35b39f[_0x887c('0x3b')](0x194);}return _0x3e94ad;};}function handleError(_0x19adf7,_0x3884d4){_0x3884d4=_0x3884d4||0x1f4;return function(_0x1e1af7){logger[_0x887c('0x28')](_0x1e1af7[_0x887c('0x3c')]);if(_0x1e1af7['name']){delete _0x1e1af7[_0x887c('0x3d')];}_0x19adf7[_0x887c('0x2d')](_0x3884d4)[_0x887c('0x3e')](_0x1e1af7);};}exports[_0x887c('0x3f')]=function(_0x1afa0f,_0x4f6113){var _0x164d4a={},_0x51d808={},_0x27cf4f={'count':0x0,'rows':[]};var _0x10471e=_[_0x887c('0x40')](db[_0x887c('0x41')][_0x887c('0x42')],function(_0x1c2df9){return{'name':_0x1c2df9[_0x887c('0x43')],'type':_0x1c2df9[_0x887c('0x44')][_0x887c('0x45')]};});_0x51d808[_0x887c('0x46')]=_['map'](_0x10471e,_0x887c('0x3d'));_0x51d808[_0x887c('0x47')]=_[_0x887c('0x48')](_0x1afa0f[_0x887c('0x47')]);_0x51d808[_0x887c('0x49')]=_[_0x887c('0x4a')](_0x51d808['model'],_0x51d808['query']);_0x164d4a[_0x887c('0x4b')]=_['intersection'](_0x51d808[_0x887c('0x46')],qs['fields'](_0x1afa0f['query'][_0x887c('0x4c')]));_0x164d4a[_0x887c('0x4b')]=_0x164d4a['attributes'][_0x887c('0x4d')]?_0x164d4a[_0x887c('0x4b')]:_0x51d808[_0x887c('0x46')];if(!_0x1afa0f[_0x887c('0x47')][_0x887c('0x4e')]('nolimit')){_0x164d4a[_0x887c('0x32')]=qs[_0x887c('0x32')](_0x1afa0f[_0x887c('0x47')][_0x887c('0x32')]);_0x164d4a[_0x887c('0x2f')]=qs[_0x887c('0x2f')](_0x1afa0f['query'][_0x887c('0x2f')]);}_0x164d4a['order']=qs[_0x887c('0x4f')](_0x1afa0f[_0x887c('0x47')][_0x887c('0x4f')]);_0x164d4a[_0x887c('0x50')]=qs[_0x887c('0x49')](_[_0x887c('0x51')](_0x1afa0f['query'],_0x51d808[_0x887c('0x49')]),_0x10471e);if(_0x1afa0f['query'][_0x887c('0x52')]){_0x164d4a['where']=_[_0x887c('0x53')](_0x164d4a[_0x887c('0x50')],{'$or':_[_0x887c('0x40')](_0x10471e,function(_0x9e3c64){if(_0x9e3c64[_0x887c('0x44')]!==_0x887c('0x54')){var _0x38bfdd={};_0x38bfdd[_0x9e3c64[_0x887c('0x3d')]]={'$like':'%'+_0x1afa0f[_0x887c('0x47')][_0x887c('0x52')]+'%'};return _0x38bfdd;}})});}_0x164d4a=_['merge']({},_0x164d4a,_0x1afa0f[_0x887c('0x55')]);var _0x3041ed={'where':_0x164d4a[_0x887c('0x50')]};return db['WhatsappMessage'][_0x887c('0x31')](_0x3041ed)['then'](function(_0x1ccbd9){_0x27cf4f[_0x887c('0x31')]=_0x1ccbd9;if(_0x1afa0f[_0x887c('0x47')][_0x887c('0x56')]){_0x164d4a[_0x887c('0x57')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x164d4a);})[_0x887c('0x21')](function(_0x249314){_0x27cf4f[_0x887c('0x58')]=_0x249314;return _0x27cf4f;})[_0x887c('0x21')](respondWithFilteredResult(_0x4f6113,_0x164d4a))[_0x887c('0x2c')](handleError(_0x4f6113,null));};exports[_0x887c('0x59')]=function(_0xcebf5f,_0x23e5b6){var _0x5b2048={'raw':!![],'where':{'id':_0xcebf5f['params']['id']}},_0x5819af={};_0x5819af[_0x887c('0x46')]=_[_0x887c('0x48')](db[_0x887c('0x41')][_0x887c('0x42')]);_0x5819af[_0x887c('0x47')]=_[_0x887c('0x48')](_0xcebf5f[_0x887c('0x47')]);_0x5819af[_0x887c('0x49')]=_['intersection'](_0x5819af['model'],_0x5819af[_0x887c('0x47')]);_0x5b2048[_0x887c('0x4b')]=_[_0x887c('0x4a')](_0x5819af['model'],qs[_0x887c('0x4c')](_0xcebf5f[_0x887c('0x47')][_0x887c('0x4c')]));_0x5b2048[_0x887c('0x4b')]=_0x5b2048[_0x887c('0x4b')][_0x887c('0x4d')]?_0x5b2048[_0x887c('0x4b')]:_0x5819af[_0x887c('0x46')];if(_0xcebf5f[_0x887c('0x47')]['includeAll']){_0x5b2048['include']=[{'all':!![]}];}_0x5b2048=_[_0x887c('0x53')]({},_0x5b2048,_0xcebf5f['options']);return db['WhatsappMessage'][_0x887c('0x5a')](_0x5b2048)['then'](handleEntityNotFound(_0x23e5b6,null))[_0x887c('0x21')](respondWithResult(_0x23e5b6,null))[_0x887c('0x2c')](handleError(_0x23e5b6,null));};exports['create']=function(_0x21ef73,_0x3e042e){return db['WhatsappMessage']['create'](_0x21ef73[_0x887c('0x5b')],{})[_0x887c('0x21')](respondWithResult(_0x3e042e,0xc9))[_0x887c('0x2c')](handleError(_0x3e042e,null));};exports[_0x887c('0x39')]=function(_0x4bb3f3,_0x143a30){if(_0x4bb3f3[_0x887c('0x5b')]['id']){delete _0x4bb3f3[_0x887c('0x5b')]['id'];}return db[_0x887c('0x41')][_0x887c('0x5a')]({'where':{'id':_0x4bb3f3[_0x887c('0x5c')]['id']}})[_0x887c('0x21')](handleEntityNotFound(_0x143a30,null))[_0x887c('0x21')](saveUpdates(_0x4bb3f3[_0x887c('0x5b')],null))[_0x887c('0x21')](respondWithResult(_0x143a30,null))[_0x887c('0x2c')](handleError(_0x143a30,null));};exports[_0x887c('0x3a')]=function(_0x44c943,_0x3f35d7){return db[_0x887c('0x41')]['find']({'where':{'id':_0x44c943['params']['id']}})[_0x887c('0x21')](handleEntityNotFound(_0x3f35d7,null))[_0x887c('0x21')](removeEntity(_0x3f35d7,null))[_0x887c('0x2c')](handleError(_0x3f35d7,null));};exports[_0x887c('0x5d')]=function(_0x1d6627,_0x1b3465){return db[_0x887c('0x41')][_0x887c('0x5d')]()['then'](respondWithResult(_0x1b3465,null))[_0x887c('0x2c')](handleError(_0x1b3465,null));};var interaction_log=require(_0x887c('0x13'))('whatsapp-interactions');exports[_0x887c('0x5e')]=function(_0x133537,_0x3d3134,_0x5aa3ce){var _0x20902c={'agent':{},'channel':_0x887c('0x5f')};if(_0x133537[_0x887c('0x5b')]['id']){delete _0x133537[_0x887c('0x5b')]['id'];}_0x133537[_0x887c('0x5b')][_0x887c('0x60')]=!![];_0x133537[_0x887c('0x5b')][_0x887c('0x61')]=moment()[_0x887c('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x133537[_0x887c('0x5b')][_0x887c('0x63')]=_0x133537[_0x887c('0x5b')]['UserId']||_0x133537[_0x887c('0x64')]['id'];_0x20902c[_0x887c('0x65')]['id']=_0x133537['body'][_0x887c('0x63')];return db[_0x887c('0x41')][_0x887c('0x5a')]({'where':{'id':_0x133537['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d3134,null))[_0x887c('0x21')](saveUpdates(_0x133537[_0x887c('0x5b')],null))['then'](function(_0x671acb){if(_0x671acb){_0x20902c[_0x887c('0x2a')]=_0x671acb[_0x887c('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x887c('0x5a')]({'where':{'id':_0x671acb['WhatsappInteractionId']}});}return null;})[_0x887c('0x21')](handleEntityNotFound(_0x3d3134,null))[_0x887c('0x21')](function(_0x39600f){if(_0x39600f){return _0x39600f[_0x887c('0x39')]({'UserId':_0x133537[_0x887c('0x5b')]['UserId'],'read1stAt':_[_0x887c('0x67')](_0x39600f['read1stAt'])?moment()[_0x887c('0x62')](_0x887c('0x68')):undefined});}return null;})[_0x887c('0x21')](function(_0x4fd3ce){if(_0x4fd3ce){_0x20902c[_0x887c('0x69')]=_0x4fd3ce[_0x887c('0x66')]({'plain':!![]});interaction_log['info'](_0x887c('0x6a'),_0x133537[_0x887c('0x64')]['id'],_0x133537[_0x887c('0x64')][_0x887c('0x3d')],_0x133537['user'][_0x887c('0x6b')],_0x20902c['interaction']['id'],_0x133537['body']?JSON[_0x887c('0x27')](_0x133537[_0x887c('0x5b')]):_0x887c('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x887c('0x6d'),_0x20902c);}return null;})[_0x887c('0x21')](function(_0x10c408){var _0x221cbf=_0x887c('0x6e')+_0x10c408[_0x887c('0x2a')][_0x887c('0x6f')];return db[_0x887c('0x70')][_0x887c('0x47')](_0x221cbf,{'type':db[_0x887c('0x71')][_0x887c('0x72')]['SELECT'],'raw':!![]})[_0x887c('0x21')](function(_0x44b154){return _0x44b154;});})[_0x887c('0x21')](function(_0x4cf2df){if(_0x4cf2df){_0x20902c[_0x887c('0x2a')][_0x887c('0x73')]=_0x4cf2df[0x0];if(!_0x133537[_0x887c('0x5b')]['UserId'])return;return db[_0x887c('0x74')]['find']({'where':{'id':_0x133537[_0x887c('0x5b')][_0x887c('0x63')],'role':'agent'},'attributes':['id','name',_0x887c('0x75'),'email',_0x887c('0x76')],'raw':!![]});}return null;})['then'](function(_0x51846b){if(!_0x51846b)return null;_0x20902c[_0x887c('0x2a')][_0x887c('0x65')]=_0x51846b;return _0x20902c;})[_0x887c('0x21')](function(_0x584322){if(_0x584322){if(_0x133537[_0x887c('0x5b')][_0x887c('0x77')]){_0x20902c[_0x887c('0x2a')][_0x887c('0x78')]=util[_0x887c('0x62')](_0x887c('0x79'),_0x133537[_0x887c('0x64')][_0x887c('0x3d')]);_0x20902c[_0x887c('0x2a')][_0x887c('0x7a')]=_0x20902c[_0x887c('0x7a')];_0x20902c[_0x887c('0x2a')]['motionChannel']=_0x20902c[_0x887c('0x7a')];_0x20902c['message'][_0x887c('0x7b')]=_0x887c('0x5e');return respondWithRpcPromise(_0x887c('0x7c'),_0x887c('0x7c'),{'event':_0x887c('0x7d'),'message':_0x20902c[_0x887c('0x2a')]},client9002)[_0x887c('0x21')](function(){return _0x20902c;});}return _0x20902c;}return null;})[_0x887c('0x21')](respondWithResult(_0x3d3134,null))[_0x887c('0x2c')](handleError(_0x3d3134,null));};var interaction_log=require(_0x887c('0x13'))(_0x887c('0x7e'));exports[_0x887c('0x37')]=function(_0x3cc095,_0x20088a,_0x12f576){var _0x3f25e4={'agent':{},'channel':'whatsapp'};if(_0x3cc095['body']['id']){delete _0x3cc095['body']['id'];}_0x3cc095['body'][_0x887c('0x63')]=_0x3cc095[_0x887c('0x5b')][_0x887c('0x63')]||_0x3cc095[_0x887c('0x64')]['id'];_0x3f25e4[_0x887c('0x65')]['id']=_0x3cc095[_0x887c('0x5b')][_0x887c('0x63')];return db[_0x887c('0x41')][_0x887c('0x5a')]({'where':{'id':_0x3cc095[_0x887c('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x20088a,null))[_0x887c('0x21')](function(_0x5c2c2){if(_0x5c2c2){_0x3f25e4['message']=_0x5c2c2['get']({'plain':!![]});return db[_0x887c('0x7f')][_0x887c('0x5a')]({'where':{'id':_0x5c2c2[_0x887c('0x80')]}});}return null;})[_0x887c('0x21')](handleEntityNotFound(_0x20088a,null))[_0x887c('0x21')](function(_0x38d670){if(_0x38d670){_0x3f25e4[_0x887c('0x69')]=_0x38d670[_0x887c('0x66')]({'plain':!![]});interaction_log[_0x887c('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3cc095[_0x887c('0x64')]['id'],_0x3cc095['user'][_0x887c('0x3d')],_0x3cc095[_0x887c('0x64')][_0x887c('0x6b')],_0x3f25e4[_0x887c('0x69')]['id'],_0x3cc095['body']?JSON[_0x887c('0x27')](_0x3cc095[_0x887c('0x5b')]):'null');return respondWithRpcPromise(_0x887c('0x81'),_0x887c('0x82'),_0x3f25e4);}return null;})[_0x887c('0x21')](function(_0x1f87b4){var _0x362f5d=_0x887c('0x6e')+_0x1f87b4[_0x887c('0x2a')][_0x887c('0x6f')];return db[_0x887c('0x70')]['query'](_0x362f5d,{'type':db[_0x887c('0x71')][_0x887c('0x72')][_0x887c('0x83')],'raw':!![]})[_0x887c('0x21')](function(_0x197730){return _0x197730;});})[_0x887c('0x21')](function(_0x97c0e3){if(_0x97c0e3){_0x3f25e4[_0x887c('0x2a')][_0x887c('0x73')]=_0x97c0e3[0x0];if(!_0x3cc095[_0x887c('0x5b')][_0x887c('0x63')])return;return db[_0x887c('0x74')]['find']({'where':{'id':_0x3cc095['body']['UserId'],'role':_0x887c('0x65')},'attributes':['id','name',_0x887c('0x75'),'email',_0x887c('0x76')],'raw':!![]});}return null;})[_0x887c('0x21')](function(_0x88760b){if(!_0x88760b)return null;_0x3f25e4[_0x887c('0x2a')][_0x887c('0x65')]=_0x88760b;return _0x3f25e4;})[_0x887c('0x21')](function(_0x21834c){if(_0x21834c){_0x21834c['message'][_0x887c('0x78')]=util[_0x887c('0x62')](_0x887c('0x79'),_0x3cc095[_0x887c('0x64')][_0x887c('0x3d')]);_0x21834c['message'][_0x887c('0x7a')]=_0x3f25e4['channel'];_0x21834c[_0x887c('0x2a')][_0x887c('0x84')]=_0x3f25e4[_0x887c('0x7a')];_0x21834c[_0x887c('0x2a')][_0x887c('0x7b')]='reject';respondWithRpcPromise(_0x887c('0x7c'),'EventManager',{'event':'rejectmessage','message':_0x21834c[_0x887c('0x2a')]},client9002);return _0x3f25e4;}return null;})['then'](respondWithResult(_0x20088a,null))[_0x887c('0x2c')](handleError(_0x20088a,null));};exports[_0x887c('0x2d')]=function(_0x58fc84,_0x29c19a,_0x4c57c3){if(_0x58fc84[_0x887c('0x5b')]['id']){delete _0x58fc84[_0x887c('0x5b')]['id'];}var _0x2fa420;return db[_0x887c('0x41')][_0x887c('0x5a')]({'where':{'id':_0x58fc84['params']['id']}})[_0x887c('0x21')](handleEntityNotFound(_0x29c19a,null))['then'](function(_0x2d38ff){if(_0x2d38ff){_0x2fa420=_0x2d38ff;return db['WhatsappAccount'][_0x887c('0x5a')]({'where':{'id':_0x2d38ff[_0x887c('0x85')]}});}})['then'](handleEntityNotFound(_0x29c19a,null))['then'](function(_0x3ef7cf){if(_0x3ef7cf){logger['debug'](_0x887c('0x86'),_0x887c('0x2d'),_0x887c('0x87'),_0x3ef7cf[_0x887c('0x44')],util['inspect'](_0x58fc84[_0x887c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3ef7cf[_0x887c('0x44')]){case _0x887c('0x88'):if(_0x58fc84[_0x887c('0x5b')]['MessageSid']&&_0x58fc84['body']['MessageSid']===_0x2fa420[_0x887c('0x89')]&&_0x58fc84['body']['MessageStatus']&&_0x58fc84[_0x887c('0x5b')][_0x887c('0x8a')]===_0x887c('0x60')){return _0x2fa420['update']({'read':!![]});}else{logger[_0x887c('0x28')](_0x887c('0x8b'),'status','twilio',util[_0x887c('0x8c')](_0x58fc84['body'],{'showHidden':![],'depth':null}));}break;}return _0x2fa420;}})[_0x887c('0x21')](respondWithResult(_0x29c19a,null))[_0x887c('0x2c')](handleError(_0x29c19a,null));}; \ No newline at end of file +var _0xac1a=['includeAll','rows','catch','show','params','include','find','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','motionChannel','channel','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x24b8ec,_0x3c8c5b){var _0x1d1b63=function(_0x316c98){while(--_0x316c98){_0x24b8ec['push'](_0x24b8ec['shift']());}};_0x1d1b63(++_0x3c8c5b);}(_0xac1a,0x155));var _0xaac1=function(_0x3c5216,_0xb179c1){_0x3c5216=_0x3c5216-0x0;var _0x19b139=_0xac1a[_0x3c5216];return _0x19b139;};'use strict';var emlformat=require(_0xaac1('0x0'));var rimraf=require(_0xaac1('0x1'));var zipdir=require(_0xaac1('0x2'));var jsonpatch=require(_0xaac1('0x3'));var rp=require(_0xaac1('0x4'));var moment=require(_0xaac1('0x5'));var BPromise=require(_0xaac1('0x6'));var Mustache=require(_0xaac1('0x7'));var util=require(_0xaac1('0x8'));var path=require(_0xaac1('0x9'));var sox=require(_0xaac1('0xa'));var csv=require(_0xaac1('0xb'));var ejs=require(_0xaac1('0xc'));var fs=require('fs');var fs_extra=require(_0xaac1('0xd'));var _=require(_0xaac1('0xe'));var squel=require('squel');var crypto=require(_0xaac1('0xf'));var jsforce=require(_0xaac1('0x10'));var deskjs=require(_0xaac1('0x11'));var toCsv=require('to-csv');var querystring=require(_0xaac1('0x12'));var Papa=require('papaparse');var Redis=require(_0xaac1('0x13'));var authService=require(_0xaac1('0x14'));var qs=require(_0xaac1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaac1('0x16'));var logger=require('../../config/logger')(_0xaac1('0x17'));var utils=require(_0xaac1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaac1('0x19'));var db=require(_0xaac1('0x1a'))['db'];config['redis']=_['defaults'](config[_0xaac1('0x1b')],{'host':_0xaac1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaac1('0x1d'))['register'](socket);var jayson=require(_0xaac1('0x1e'));var client=jayson[_0xaac1('0x1f')][_0xaac1('0x20')]({'port':0x232c});var client9002=jayson[_0xaac1('0x1f')][_0xaac1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x173620,_0x3d5f23,_0x3d970c,_0x405c18){return new BPromise(function(_0x184049,_0x415b39){var _0x7f940f=_0x405c18||client;return _0x7f940f[_0xaac1('0x21')](_0x173620,_0x3d970c)[_0xaac1('0x22')](function(_0x22f14e){logger[_0xaac1('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x3d5f23,_0xaac1('0x24'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3d5f23,'request\x20sent',JSON[_0xaac1('0x25')](_0x22f14e));if(_0x22f14e['error']){if(_0x22f14e[_0xaac1('0x26')][_0xaac1('0x27')]===0x1f4){logger['error'](_0xaac1('0x28'),_0x3d5f23,_0x22f14e['error'][_0xaac1('0x29')]);return _0x415b39(_0x22f14e[_0xaac1('0x26')][_0xaac1('0x29')]);}logger['error'](_0xaac1('0x28'),_0x3d5f23,_0x22f14e[_0xaac1('0x26')][_0xaac1('0x29')]);return _0x184049(_0x22f14e[_0xaac1('0x26')]['message']);}else{logger['info'](_0xaac1('0x28'),_0x3d5f23,'request\x20sent');_0x184049(_0x22f14e[_0xaac1('0x2a')][_0xaac1('0x29')]);}})['catch'](function(_0x3db3e2){logger[_0xaac1('0x26')](_0xaac1('0x28'),_0x3d5f23,_0x3db3e2);_0x415b39(_0x3db3e2);});});}function respondWithStatusCode(_0x1f938e,_0x42a26f){_0x42a26f=_0x42a26f||0xcc;return function(_0x1fcadb){if(_0x1fcadb){return _0x1f938e[_0xaac1('0x2b')](_0x42a26f);}return _0x1f938e['status'](_0x42a26f)[_0xaac1('0x2c')]();};}function respondWithResult(_0x1895fc,_0x5127b7){_0x5127b7=_0x5127b7||0xc8;return function(_0x421d94){if(_0x421d94){return _0x1895fc[_0xaac1('0x2d')](_0x5127b7)['json'](_0x421d94);}};}function respondWithFilteredResult(_0x9615b5,_0x105835){return function(_0x54e00c){if(_0x54e00c){var _0x3110cb=typeof _0x105835[_0xaac1('0x2e')]===_0xaac1('0x2f')&&typeof _0x105835[_0xaac1('0x30')]===_0xaac1('0x2f');var _0x2bc4dc=_0x54e00c[_0xaac1('0x31')];var _0x3a00d3=_0x3110cb?0x0:_0x105835[_0xaac1('0x2e')];var _0x18d5f6=_0x3110cb?_0x54e00c[_0xaac1('0x31')]:_0x105835[_0xaac1('0x2e')]+_0x105835[_0xaac1('0x30')];var _0x4990ec;if(_0x18d5f6>=_0x2bc4dc){_0x18d5f6=_0x2bc4dc;_0x4990ec=0xc8;}else{_0x4990ec=0xce;}_0x9615b5[_0xaac1('0x2d')](_0x4990ec);return _0x9615b5[_0xaac1('0x32')](_0xaac1('0x33'),_0x3a00d3+'-'+_0x18d5f6+'/'+_0x2bc4dc)[_0xaac1('0x34')](_0x54e00c);}return null;};}function patchUpdates(_0x1c74c0){return function(_0x303575){try{jsonpatch[_0xaac1('0x35')](_0x303575,_0x1c74c0,!![]);}catch(_0x35db53){return BPromise[_0xaac1('0x36')](_0x35db53);}return _0x303575['save']();};}function saveUpdates(_0x3b0130,_0x5ca616){return function(_0xd9b98f){if(_0xd9b98f){return _0xd9b98f[_0xaac1('0x37')](_0x3b0130)[_0xaac1('0x22')](function(_0xec76ee){return _0xec76ee;});}return null;};}function removeEntity(_0x4e2aa7,_0xe1673c){return function(_0x22b99c){if(_0x22b99c){return _0x22b99c['destroy']()[_0xaac1('0x22')](function(){_0x4e2aa7[_0xaac1('0x2d')](0xcc)[_0xaac1('0x2c')]();});}};}function handleEntityNotFound(_0x262799,_0x53406c){return function(_0x4820df){if(!_0x4820df){_0x262799[_0xaac1('0x2b')](0x194);}return _0x4820df;};}function handleError(_0x4bd214,_0x2ca5e0){_0x2ca5e0=_0x2ca5e0||0x1f4;return function(_0x12e446){logger[_0xaac1('0x26')](_0x12e446['stack']);if(_0x12e446[_0xaac1('0x38')]){delete _0x12e446[_0xaac1('0x38')];}_0x4bd214[_0xaac1('0x2d')](_0x2ca5e0)['send'](_0x12e446);};}exports[_0xaac1('0x39')]=function(_0x305c9c,_0x2eacf0){var _0x3c78b0={},_0x43ce8b={},_0x1db009={'count':0x0,'rows':[]};var _0x1fdb7e=_[_0xaac1('0x3a')](db[_0xaac1('0x3b')][_0xaac1('0x3c')],function(_0x537580){return{'name':_0x537580[_0xaac1('0x3d')],'type':_0x537580[_0xaac1('0x3e')][_0xaac1('0x3f')]};});_0x43ce8b['model']=_[_0xaac1('0x3a')](_0x1fdb7e,_0xaac1('0x38'));_0x43ce8b[_0xaac1('0x40')]=_[_0xaac1('0x41')](_0x305c9c['query']);_0x43ce8b[_0xaac1('0x42')]=_[_0xaac1('0x43')](_0x43ce8b['model'],_0x43ce8b[_0xaac1('0x40')]);_0x3c78b0[_0xaac1('0x44')]=_[_0xaac1('0x43')](_0x43ce8b[_0xaac1('0x45')],qs[_0xaac1('0x46')](_0x305c9c['query'][_0xaac1('0x46')]));_0x3c78b0[_0xaac1('0x44')]=_0x3c78b0['attributes'][_0xaac1('0x47')]?_0x3c78b0['attributes']:_0x43ce8b['model'];if(!_0x305c9c[_0xaac1('0x40')][_0xaac1('0x48')](_0xaac1('0x49'))){_0x3c78b0[_0xaac1('0x30')]=qs[_0xaac1('0x30')](_0x305c9c[_0xaac1('0x40')][_0xaac1('0x30')]);_0x3c78b0[_0xaac1('0x2e')]=qs[_0xaac1('0x2e')](_0x305c9c[_0xaac1('0x40')][_0xaac1('0x2e')]);}_0x3c78b0[_0xaac1('0x4a')]=qs[_0xaac1('0x4b')](_0x305c9c[_0xaac1('0x40')][_0xaac1('0x4b')]);_0x3c78b0[_0xaac1('0x4c')]=qs['filters'](_[_0xaac1('0x4d')](_0x305c9c[_0xaac1('0x40')],_0x43ce8b['filters']),_0x1fdb7e);if(_0x305c9c[_0xaac1('0x40')][_0xaac1('0x4e')]){_0x3c78b0[_0xaac1('0x4c')]=_[_0xaac1('0x4f')](_0x3c78b0[_0xaac1('0x4c')],{'$or':_[_0xaac1('0x3a')](_0x1fdb7e,function(_0x55ed25){if(_0x55ed25['type']!==_0xaac1('0x50')){var _0x32acc2={};_0x32acc2[_0x55ed25[_0xaac1('0x38')]]={'$like':'%'+_0x305c9c[_0xaac1('0x40')][_0xaac1('0x4e')]+'%'};return _0x32acc2;}})});}_0x3c78b0=_['merge']({},_0x3c78b0,_0x305c9c[_0xaac1('0x51')]);var _0x329ee3={'where':_0x3c78b0[_0xaac1('0x4c')]};return db['WhatsappMessage'][_0xaac1('0x31')](_0x329ee3)['then'](function(_0x174c77){_0x1db009[_0xaac1('0x31')]=_0x174c77;if(_0x305c9c[_0xaac1('0x40')][_0xaac1('0x52')]){_0x3c78b0['include']=[{'all':!![]}];}return db[_0xaac1('0x3b')]['findAll'](_0x3c78b0);})['then'](function(_0x266dc6){_0x1db009[_0xaac1('0x53')]=_0x266dc6;return _0x1db009;})[_0xaac1('0x22')](respondWithFilteredResult(_0x2eacf0,_0x3c78b0))[_0xaac1('0x54')](handleError(_0x2eacf0,null));};exports[_0xaac1('0x55')]=function(_0x4ada8a,_0x30d0b7){var _0x5cd2b2={'raw':!![],'where':{'id':_0x4ada8a[_0xaac1('0x56')]['id']}},_0xab1495={};_0xab1495[_0xaac1('0x45')]=_['keys'](db['WhatsappMessage'][_0xaac1('0x3c')]);_0xab1495['query']=_[_0xaac1('0x41')](_0x4ada8a[_0xaac1('0x40')]);_0xab1495['filters']=_[_0xaac1('0x43')](_0xab1495[_0xaac1('0x45')],_0xab1495['query']);_0x5cd2b2[_0xaac1('0x44')]=_[_0xaac1('0x43')](_0xab1495[_0xaac1('0x45')],qs[_0xaac1('0x46')](_0x4ada8a[_0xaac1('0x40')][_0xaac1('0x46')]));_0x5cd2b2['attributes']=_0x5cd2b2[_0xaac1('0x44')][_0xaac1('0x47')]?_0x5cd2b2[_0xaac1('0x44')]:_0xab1495['model'];if(_0x4ada8a[_0xaac1('0x40')]['includeAll']){_0x5cd2b2[_0xaac1('0x57')]=[{'all':!![]}];}_0x5cd2b2=_[_0xaac1('0x4f')]({},_0x5cd2b2,_0x4ada8a[_0xaac1('0x51')]);return db[_0xaac1('0x3b')][_0xaac1('0x58')](_0x5cd2b2)['then'](handleEntityNotFound(_0x30d0b7,null))['then'](respondWithResult(_0x30d0b7,null))[_0xaac1('0x54')](handleError(_0x30d0b7,null));};exports['create']=function(_0x94f0e4,_0x50a7d9){return db['WhatsappMessage']['create'](_0x94f0e4['body'],{})[_0xaac1('0x22')](respondWithResult(_0x50a7d9,0xc9))[_0xaac1('0x54')](handleError(_0x50a7d9,null));};exports[_0xaac1('0x37')]=function(_0x3257a7,_0x539bb1){if(_0x3257a7['body']['id']){delete _0x3257a7[_0xaac1('0x59')]['id'];}return db[_0xaac1('0x3b')]['find']({'where':{'id':_0x3257a7[_0xaac1('0x56')]['id']}})[_0xaac1('0x22')](handleEntityNotFound(_0x539bb1,null))['then'](saveUpdates(_0x3257a7[_0xaac1('0x59')],null))[_0xaac1('0x22')](respondWithResult(_0x539bb1,null))[_0xaac1('0x54')](handleError(_0x539bb1,null));};exports['destroy']=function(_0x2f7ddc,_0x4915f1){return db[_0xaac1('0x3b')][_0xaac1('0x58')]({'where':{'id':_0x2f7ddc[_0xaac1('0x56')]['id']}})[_0xaac1('0x22')](handleEntityNotFound(_0x4915f1,null))[_0xaac1('0x22')](removeEntity(_0x4915f1,null))['catch'](handleError(_0x4915f1,null));};exports['describe']=function(_0x305168,_0x2d27ea){return db[_0xaac1('0x3b')][_0xaac1('0x5a')]()['then'](respondWithResult(_0x2d27ea,null))[_0xaac1('0x54')](handleError(_0x2d27ea,null));};var interaction_log=require(_0xaac1('0x5b'))(_0xaac1('0x5c'));exports[_0xaac1('0x5d')]=function(_0x12850f,_0x1ff143,_0x1dc62d){var _0x48d924={'agent':{},'channel':_0xaac1('0x5e')};if(_0x12850f[_0xaac1('0x59')]['id']){delete _0x12850f[_0xaac1('0x59')]['id'];}_0x12850f['body'][_0xaac1('0x5f')]=!![];_0x12850f[_0xaac1('0x59')][_0xaac1('0x60')]=moment()[_0xaac1('0x61')](_0xaac1('0x62'));_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')]=_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')]||_0x12850f[_0xaac1('0x64')]['id'];_0x48d924[_0xaac1('0x65')]['id']=_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')];return db[_0xaac1('0x3b')]['find']({'where':{'id':_0x12850f['params']['id'],'UserId':null}})[_0xaac1('0x22')](handleEntityNotFound(_0x1ff143,null))[_0xaac1('0x22')](saveUpdates(_0x12850f[_0xaac1('0x59')],null))[_0xaac1('0x22')](function(_0x446f8a){if(_0x446f8a){_0x48d924[_0xaac1('0x29')]=_0x446f8a[_0xaac1('0x66')]({'plain':!![]});return db[_0xaac1('0x67')][_0xaac1('0x58')]({'where':{'id':_0x446f8a['WhatsappInteractionId']}});}return null;})[_0xaac1('0x22')](handleEntityNotFound(_0x1ff143,null))[_0xaac1('0x22')](function(_0x1af75e){if(_0x1af75e){return _0x1af75e[_0xaac1('0x37')]({'UserId':_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')],'read1stAt':_[_0xaac1('0x68')](_0x1af75e['read1stAt'])?moment()[_0xaac1('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3e6e4c){if(_0x3e6e4c){_0x48d924[_0xaac1('0x69')]=_0x3e6e4c[_0xaac1('0x66')]({'plain':!![]});interaction_log[_0xaac1('0x23')](_0xaac1('0x6a'),_0x12850f[_0xaac1('0x64')]['id'],_0x12850f[_0xaac1('0x64')][_0xaac1('0x38')],_0x12850f['user'][_0xaac1('0x6b')],_0x48d924[_0xaac1('0x69')]['id'],_0x12850f[_0xaac1('0x59')]?JSON[_0xaac1('0x25')](_0x12850f[_0xaac1('0x59')]):_0xaac1('0x6c'));return respondWithRpcPromise(_0xaac1('0x6d'),_0xaac1('0x6e'),_0x48d924);}return null;})['then'](function(_0x4e682d){var _0x185694='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e682d['message'][_0xaac1('0x6f')];return db[_0xaac1('0x70')][_0xaac1('0x40')](_0x185694,{'type':db[_0xaac1('0x71')][_0xaac1('0x72')][_0xaac1('0x73')],'raw':!![]})['then'](function(_0x47f7f5){return _0x47f7f5;});})[_0xaac1('0x22')](function(_0x1eb4b7){if(_0x1eb4b7){_0x48d924[_0xaac1('0x29')][_0xaac1('0x74')]=_0x1eb4b7[0x0];if(!_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')])return;return db[_0xaac1('0x75')][_0xaac1('0x58')]({'where':{'id':_0x12850f[_0xaac1('0x59')][_0xaac1('0x63')],'role':_0xaac1('0x65')},'attributes':['id',_0xaac1('0x38'),_0xaac1('0x76'),_0xaac1('0x77'),_0xaac1('0x78')],'raw':!![]});}return null;})[_0xaac1('0x22')](function(_0x549964){if(!_0x549964)return null;_0x48d924[_0xaac1('0x29')][_0xaac1('0x65')]=_0x549964;return _0x48d924;})[_0xaac1('0x22')](function(_0x274080){if(_0x274080){if(_0x12850f[_0xaac1('0x59')]['manual']){_0x48d924[_0xaac1('0x29')]['interface']=util['format']('SIP/%s',_0x12850f['user']['name']);_0x48d924[_0xaac1('0x29')]['channel']=_0x48d924['channel'];_0x48d924[_0xaac1('0x29')][_0xaac1('0x79')]=_0x48d924[_0xaac1('0x7a')];_0x48d924[_0xaac1('0x29')][_0xaac1('0x7b')]=_0xaac1('0x5d');return respondWithRpcPromise(_0xaac1('0x7c'),'EventManager',{'event':_0xaac1('0x7d'),'message':_0x48d924[_0xaac1('0x29')]},client9002)[_0xaac1('0x22')](function(){return _0x48d924;});}return _0x48d924;}return null;})[_0xaac1('0x22')](respondWithResult(_0x1ff143,null))[_0xaac1('0x54')](handleError(_0x1ff143,null));};var interaction_log=require('../../config/logger')(_0xaac1('0x5c'));exports['reject']=function(_0x98422a,_0x146351,_0x6e245){var _0x325a74={'agent':{},'channel':'whatsapp'};if(_0x98422a['body']['id']){delete _0x98422a[_0xaac1('0x59')]['id'];}_0x98422a[_0xaac1('0x59')][_0xaac1('0x63')]=_0x98422a[_0xaac1('0x59')][_0xaac1('0x63')]||_0x98422a['user']['id'];_0x325a74[_0xaac1('0x65')]['id']=_0x98422a[_0xaac1('0x59')]['UserId'];return db[_0xaac1('0x3b')][_0xaac1('0x58')]({'where':{'id':_0x98422a[_0xaac1('0x56')]['id'],'UserId':null}})[_0xaac1('0x22')](handleEntityNotFound(_0x146351,null))[_0xaac1('0x22')](function(_0x5560e5){if(_0x5560e5){_0x325a74[_0xaac1('0x29')]=_0x5560e5[_0xaac1('0x66')]({'plain':!![]});return db[_0xaac1('0x67')][_0xaac1('0x58')]({'where':{'id':_0x5560e5[_0xaac1('0x7e')]}});}return null;})[_0xaac1('0x22')](handleEntityNotFound(_0x146351,null))['then'](function(_0x40f417){if(_0x40f417){_0x325a74[_0xaac1('0x69')]=_0x40f417[_0xaac1('0x66')]({'plain':!![]});interaction_log[_0xaac1('0x23')](_0xaac1('0x7f'),_0x98422a[_0xaac1('0x64')]['id'],_0x98422a[_0xaac1('0x64')][_0xaac1('0x38')],_0x98422a[_0xaac1('0x64')][_0xaac1('0x6b')],_0x325a74[_0xaac1('0x69')]['id'],_0x98422a[_0xaac1('0x59')]?JSON[_0xaac1('0x25')](_0x98422a[_0xaac1('0x59')]):_0xaac1('0x6c'));return respondWithRpcPromise(_0xaac1('0x80'),'rejectMessage',_0x325a74);}return null;})['then'](function(_0x2d060c){var _0x1b35f3=_0xaac1('0x81')+_0x2d060c[_0xaac1('0x29')][_0xaac1('0x6f')];return db['sequelize']['query'](_0x1b35f3,{'type':db[_0xaac1('0x71')][_0xaac1('0x72')][_0xaac1('0x73')],'raw':!![]})['then'](function(_0x421a15){return _0x421a15;});})['then'](function(_0xfcafc3){if(_0xfcafc3){_0x325a74[_0xaac1('0x29')][_0xaac1('0x74')]=_0xfcafc3[0x0];if(!_0x98422a[_0xaac1('0x59')]['UserId'])return;return db[_0xaac1('0x75')][_0xaac1('0x58')]({'where':{'id':_0x98422a[_0xaac1('0x59')]['UserId'],'role':_0xaac1('0x65')},'attributes':['id',_0xaac1('0x38'),'fullname',_0xaac1('0x77'),'internal'],'raw':!![]});}return null;})[_0xaac1('0x22')](function(_0x34b0c4){if(!_0x34b0c4)return null;_0x325a74['message']['agent']=_0x34b0c4;return _0x325a74;})[_0xaac1('0x22')](function(_0x446f08){if(_0x446f08){_0x446f08[_0xaac1('0x29')]['interface']=util[_0xaac1('0x61')](_0xaac1('0x82'),_0x98422a[_0xaac1('0x64')][_0xaac1('0x38')]);_0x446f08['message'][_0xaac1('0x7a')]=_0x325a74[_0xaac1('0x7a')];_0x446f08[_0xaac1('0x29')][_0xaac1('0x79')]=_0x325a74[_0xaac1('0x7a')];_0x446f08[_0xaac1('0x29')]['event']='reject';respondWithRpcPromise(_0xaac1('0x7c'),_0xaac1('0x7c'),{'event':_0xaac1('0x83'),'message':_0x446f08[_0xaac1('0x29')]},client9002);return _0x325a74;}return null;})[_0xaac1('0x22')](respondWithResult(_0x146351,null))[_0xaac1('0x54')](handleError(_0x146351,null));};exports[_0xaac1('0x2d')]=function(_0x59cafe,_0x52f1b4,_0x37efae){if(_0x59cafe[_0xaac1('0x59')]['id']){delete _0x59cafe['body']['id'];}var _0x4abd0e;return db[_0xaac1('0x3b')][_0xaac1('0x58')]({'where':{'id':_0x59cafe['params']['id']}})['then'](handleEntityNotFound(_0x52f1b4,null))[_0xaac1('0x22')](function(_0x5e2454){if(_0x5e2454){_0x4abd0e=_0x5e2454;return db[_0xaac1('0x84')]['find']({'where':{'id':_0x5e2454[_0xaac1('0x85')]}});}})[_0xaac1('0x22')](handleEntityNotFound(_0x52f1b4,null))[_0xaac1('0x22')](function(_0x5d54d8){if(_0x5d54d8){logger[_0xaac1('0x86')](_0xaac1('0x87'),_0xaac1('0x2d'),'received\x20delivery\x20report\x20from',_0x5d54d8[_0xaac1('0x3e')],util[_0xaac1('0x88')](_0x59cafe[_0xaac1('0x59')],{'showHidden':![],'depth':null}));switch(_0x5d54d8[_0xaac1('0x3e')]){case _0xaac1('0x89'):if(_0x59cafe['body']['MessageSid']&&_0x59cafe[_0xaac1('0x59')][_0xaac1('0x8a')]===_0x4abd0e[_0xaac1('0x8b')]&&_0x59cafe['body'][_0xaac1('0x8c')]&&_0x59cafe['body'][_0xaac1('0x8c')]==='read'){return _0x4abd0e[_0xaac1('0x37')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xaac1('0x2d'),_0xaac1('0x89'),util[_0xaac1('0x88')](_0x59cafe[_0xaac1('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4abd0e;}})[_0xaac1('0x22')](respondWithResult(_0x52f1b4,null))[_0xaac1('0x54')](handleError(_0x52f1b4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ca26ed2..fb184b8 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 _0x8f59=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x11fcc2,_0x438742){var _0x2f3f6f=function(_0x1f5965){while(--_0x1f5965){_0x11fcc2['push'](_0x11fcc2['shift']());}};_0x2f3f6f(++_0x438742);}(_0x8f59,0x11d));var _0x98f5=function(_0x1fdf4d,_0xe8aac){_0x1fdf4d=_0x1fdf4d-0x0;var _0x255294=_0x8f59[_0x1fdf4d];return _0x255294;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var WhatsappMessage=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x912492){return function(_0x320235,_0x107e7e,_0x2f8c31){WhatsappMessageEvents['emit'](_0x912492+':'+_0x320235['id'],_0x320235);WhatsappMessageEvents[_0x98f5('0x6')](_0x912492,_0x320235);_0x2f8c31(null);};}for(var e in events){if(events[_0x98f5('0x7')](e)){var event=events[e];WhatsappMessage[_0x98f5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5423=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5423,0xe3));var _0x3542=function(_0x1067da,_0x453e5c){_0x1067da=_0x1067da-0x0;var _0x2b9fd3=_0x5423[_0x1067da];return _0x2b9fd3;};'use strict';var EventEmitter=require(_0x3542('0x0'));var WhatsappMessage=require(_0x3542('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3542('0x2')](0x0);var events={'afterCreate':_0x3542('0x3'),'afterUpdate':'update','afterDestroy':_0x3542('0x4')};function emitEvent(_0x1202d5){return function(_0xf0835,_0x2a1864,_0x54ea2f){WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5+':'+_0xf0835['id'],_0xf0835);WhatsappMessageEvents[_0x3542('0x5')](_0x1202d5,_0xf0835);_0x54ea2f(null);};}for(var e in events){if(events[_0x3542('0x6')](e)){var event=events[e];WhatsappMessage[_0x3542('0x7')](e,emitEvent(event));}}module[_0x3542('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0b7611e..85594db 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 _0xa91c=['get','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','application/json','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models'];(function(_0x39e6f2,_0x2867d1){var _0x4ea68d=function(_0x1ab3ea){while(--_0x1ab3ea){_0x39e6f2['push'](_0x39e6f2['shift']());}};_0x4ea68d(++_0x2867d1);}(_0xa91c,0x68));var _0xca91=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0xa91c[_0x12e650];return _0x5b56b1;};'use strict';var _=require('lodash');var util=require(_0xca91('0x0'));var logger=require(_0xca91('0x1'))(_0xca91('0x2'));var moment=require(_0xca91('0x3'));var BPromise=require(_0xca91('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xca91('0x5'));var rimraf=require(_0xca91('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xca91('0x7')]=function(_0x289c8e,_0x4a3172){return _0x289c8e[_0xca91('0x8')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xca91('0x9'),'fields':[_0xca91('0x9')]},{'name':_0xca91('0xa'),'fields':[_0xca91('0xb')],'type':_0xca91('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46d708,_0x1ebb4a,_0x58f1a9){var _0x1844a0=_0x289c8e[_0xca91('0xd')];var _0x2ddc2e=_0x46d708[_0xca91('0xe')]({'plain':!![]});if(_0x2ddc2e[_0xca91('0xf')][_0xca91('0x10')]()==='in'||_0x2ddc2e['direction'][_0xca91('0x10')]()===_0xca91('0x11')&&!_0x2ddc2e['secret']&&!_['isNil'](_0x2ddc2e[_0xca91('0x12')])){_0x1844a0[_0xca91('0x13')][_0xca91('0x14')]({'where':{'id':_0x2ddc2e[_0xca91('0x15')]}})[_0xca91('0x16')](function(_0x3a6960){if(_0x3a6960){_0x3a6960[_0xca91('0x17')]({'lastMsgAt':_0x2ddc2e[_0xca91('0x18')],'lastMsgDirection':_0x2ddc2e[_0xca91('0xf')]['toLowerCase']()});}})['catch'](function(_0x44bac9){console[_0xca91('0x19')](_0x44bac9);});}if(_0x2ddc2e['direction']===_0xca91('0x11')&&!_0x2ddc2e[_0xca91('0x1a')]){var _0x3519f8;_0x1844a0[_0xca91('0x1b')][_0xca91('0x1c')]({'where':{'id':_0x2ddc2e[_0xca91('0x1d')]},'raw':!![]})['then'](function(_0x57dcaa){_0x3519f8=_0x57dcaa;if(_0x3519f8&&_0x3519f8[_0xca91('0x1e')]){switch(_0x3519f8[_0xca91('0x1e')]){case _0xca91('0x1f'):var _0x3db9a4=require(_0xca91('0x1f'));if(_0x3519f8[_0xca91('0x20')]&&_0x3519f8['authToken']&&_0x3519f8[_0xca91('0x21')]){var _0x26097c=new _0x3db9a4(_0x3519f8[_0xca91('0x20')],_0x3519f8[_0xca91('0x22')]);_0x26097c[_0xca91('0x23')][_0xca91('0x24')]({'body':_0x2ddc2e[_0xca91('0xb')],'to':_0xca91('0x25')+_0x2ddc2e[_0xca91('0x21')],'from':'whatsapp:'+_0x3519f8[_0xca91('0x21')],'statusCallback':_0x3519f8[_0xca91('0x26')]+_0xca91('0x27')+_0x2ddc2e['id']+_0xca91('0x28')+_0x3519f8['token']})[_0xca91('0x16')](function(_0x7760bd){if(_0x7760bd['sid']){return _0x46d708[_0xca91('0x17')]({'messageId':_0x7760bd[_0xca91('0x29')]});}})[_0xca91('0x2a')](function(_0x591df8){logger['error'](_0xca91('0x2b'),_0xca91('0x2c'),'twilio',util[_0xca91('0x2d')](_0x591df8,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xca91('0x1f'),_0xca91('0x2e'));}break;case _0xca91('0x2f'):var _0x4eae69=_0x3519f8['accountSid'];var _0xff718c=_0x3519f8[_0xca91('0x22')];var _0x2ea474=_0x3519f8[_0xca91('0x30')]+_0xca91('0x31')+_0x4eae69+_0xca91('0x32');var _0x529edb={'to':[_0x2ddc2e[_0xca91('0x21')]],'message':{'type':_0xca91('0x33'),'text':_0x2ddc2e[_0xca91('0xb')]}};var _0x36afdc={'method':'POST','uri':_0x2ea474,'headers':{'Authorization':'Bearer\x20'+_0xff718c,'Content-Type':_0xca91('0x34')},'body':_0x529edb,'json':!![]};rp(_0x36afdc)['then'](function(_0x11984e){if(_0x11984e[_0xca91('0x35')][0x0]['message_id']){return _0x46d708[_0xca91('0x17')]({'messageId':_0x11984e['statuses'][0x0]['message_id']});}})[_0xca91('0x2a')](function(_0x459f6d){logger[_0xca91('0x36')](_0xca91('0x37'),_0x459f6d);});break;}}})[_0xca91('0x38')](function(){_0x58f1a9();});}else{_0x58f1a9();}}},'charset':_0xca91('0x39'),'collate':_0xca91('0x3a')});}; \ No newline at end of file +var _0xc4dd=['messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','text','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages'];(function(_0x11862c,_0x2aa23d){var _0x1ec194=function(_0x2df7ed){while(--_0x2df7ed){_0x11862c['push'](_0x11862c['shift']());}};_0x1ec194(++_0x2aa23d);}(_0xc4dd,0xe5));var _0xdc4d=function(_0x47defb,_0x2b9bdc){_0x47defb=_0x47defb-0x0;var _0x5ae5ba=_0xc4dd[_0x47defb];return _0x5ae5ba;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))(_0xdc4d('0x3'));var moment=require(_0xdc4d('0x4'));var BPromise=require(_0xdc4d('0x5'));var rp=require(_0xdc4d('0x6'));var fetch=require(_0xdc4d('0x7'));var fs=require('fs');var path=require(_0xdc4d('0x8'));var rimraf=require(_0xdc4d('0x9'));var config=require(_0xdc4d('0xa'));var attributes=require('./whatsappMessage.attributes');module[_0xdc4d('0xb')]=function(_0x26784d,_0x170ff5){return _0x26784d[_0xdc4d('0xc')](_0xdc4d('0xd'),attributes,{'tableName':_0xdc4d('0xe'),'paranoid':![],'indexes':[{'name':_0xdc4d('0xf'),'fields':[_0xdc4d('0xf')]},{'name':_0xdc4d('0x10'),'fields':['body'],'type':_0xdc4d('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44ca95,_0x55bce1,_0x2ba8b8){var _0x4e2b15=_0x26784d['models'];var _0x2c84c0=_0x44ca95[_0xdc4d('0x12')]({'plain':!![]});if(_0x2c84c0[_0xdc4d('0x13')][_0xdc4d('0x14')]()==='in'||_0x2c84c0[_0xdc4d('0x13')][_0xdc4d('0x14')]()==='out'&&!_0x2c84c0[_0xdc4d('0x15')]&&!_[_0xdc4d('0x16')](_0x2c84c0[_0xdc4d('0x17')])){_0x4e2b15[_0xdc4d('0x18')][_0xdc4d('0x19')]({'where':{'id':_0x2c84c0[_0xdc4d('0x1a')]}})[_0xdc4d('0x1b')](function(_0x5e6653){if(_0x5e6653){_0x5e6653[_0xdc4d('0x1c')]({'lastMsgAt':_0x2c84c0['createdAt'],'lastMsgDirection':_0x2c84c0[_0xdc4d('0x13')][_0xdc4d('0x14')]()});}})[_0xdc4d('0x1d')](function(_0x506dff){console[_0xdc4d('0x1e')](_0x506dff);});}if(_0x2c84c0['direction']===_0xdc4d('0x1f')&&!_0x2c84c0[_0xdc4d('0x15')]){var _0x433e7f;_0x4e2b15[_0xdc4d('0x20')][_0xdc4d('0x21')]({'where':{'id':_0x2c84c0[_0xdc4d('0x22')]},'raw':!![]})[_0xdc4d('0x1b')](function(_0x45e9e8){_0x433e7f=_0x45e9e8;if(_0x433e7f&&_0x433e7f[_0xdc4d('0x23')]){switch(_0x433e7f[_0xdc4d('0x23')]){case _0xdc4d('0x24'):var _0x441211=require('twilio');if(_0x433e7f[_0xdc4d('0x25')]&&_0x433e7f[_0xdc4d('0x26')]&&_0x433e7f[_0xdc4d('0x27')]){var _0x285d81=new _0x441211(_0x433e7f[_0xdc4d('0x25')],_0x433e7f[_0xdc4d('0x26')]);_0x285d81[_0xdc4d('0x28')][_0xdc4d('0x29')]({'body':_0x2c84c0[_0xdc4d('0x2a')],'to':_0xdc4d('0x2b')+_0x2c84c0['phone'],'from':_0xdc4d('0x2b')+_0x433e7f[_0xdc4d('0x27')],'statusCallback':_0x433e7f[_0xdc4d('0x2c')]+'/api/whatsapp/messages/'+_0x2c84c0['id']+'/status?token='+_0x433e7f[_0xdc4d('0x2d')]})['then'](function(_0x3683c0){if(_0x3683c0['sid']){return _0x44ca95['update']({'messageId':_0x3683c0[_0xdc4d('0x2e')]});}})[_0xdc4d('0x1d')](function(_0x245d10){logger['error'](_0xdc4d('0x2f'),_0xdc4d('0x30'),_0xdc4d('0x24'),util['inspect'](_0x245d10,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdc4d('0x2f'),_0xdc4d('0x30'),_0xdc4d('0x24'),_0xdc4d('0x31'));}break;case'sinch':var _0x2795d5=_0x433e7f[_0xdc4d('0x25')];var _0x351259=_0x433e7f[_0xdc4d('0x26')];var _0x5dd3dd=_0x433e7f[_0xdc4d('0x32')]+_0xdc4d('0x33')+_0x2795d5+'/messages/';var _0x232bde={'to':[_0x2c84c0['phone']],'message':{'type':_0xdc4d('0x34'),'text':_0x2c84c0[_0xdc4d('0x2a')]}};var _0x4c91a8={'method':'POST','uri':_0x5dd3dd,'headers':{'Authorization':_0xdc4d('0x35')+_0x351259,'Content-Type':_0xdc4d('0x36')},'body':_0x232bde,'json':!![]};rp(_0x4c91a8)['then'](function(_0x5b630c){if(_0x5b630c[_0xdc4d('0x37')][0x0][_0xdc4d('0x38')]){return _0x44ca95[_0xdc4d('0x1c')]({'messageId':_0x5b630c[_0xdc4d('0x37')][0x0][_0xdc4d('0x38')]});}})[_0xdc4d('0x1d')](function(_0x449ce1){logger[_0xdc4d('0x39')]('WhatsappMessage,\x20%s',_0x449ce1);});break;}}})[_0xdc4d('0x3a')](function(){_0x2ba8b8();});}else{_0x2ba8b8();}}},'charset':_0xdc4d('0x3b'),'collate':_0xdc4d('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e9ad163..2012fe7 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 _0xef8a=['raw','CreateWhatsappMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','create','options'];(function(_0x1898a9,_0xbba79b){var _0x3c4e13=function(_0x1f69c9){while(--_0x1f69c9){_0x1898a9['push'](_0x1898a9['shift']());}};_0x3c4e13(++_0xbba79b);}(_0xef8a,0xb1));var _0xaef8=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0xef8a[_0x2dc96f];return _0xd012da;};'use strict';var _=require(_0xaef8('0x0'));var util=require('util');var moment=require(_0xaef8('0x1'));var BPromise=require(_0xaef8('0x2'));var rs=require(_0xaef8('0x3'));var fs=require('fs');var Redis=require(_0xaef8('0x4'));var db=require(_0xaef8('0x5'))['db'];var utils=require(_0xaef8('0x6'));var logger=require('../../config/logger')(_0xaef8('0x7'));var config=require(_0xaef8('0x8'));var jayson=require(_0xaef8('0x9'));var client=jayson[_0xaef8('0xa')][_0xaef8('0xb')]({'port':0x232a});config[_0xaef8('0xc')]=_[_0xaef8('0xd')](config[_0xaef8('0xc')],{'host':_0xaef8('0xe'),'port':0x18eb});var socket=require(_0xaef8('0xf'))(new Redis(config[_0xaef8('0xc')]));require(_0xaef8('0x10'))[_0xaef8('0x11')](socket);function respondWithRpcPromise(_0x3c5a0d,_0x1175c8,_0x219aed){return new BPromise(function(_0x3a24a7,_0x1ebaba){return client[_0xaef8('0x12')](_0x3c5a0d,_0x219aed)[_0xaef8('0x13')](function(_0x5a9b66){logger[_0xaef8('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1175c8,_0xaef8('0x15'));logger[_0xaef8('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1175c8,'request\x20sent',JSON[_0xaef8('0x17')](_0x5a9b66));if(_0x5a9b66[_0xaef8('0x18')]){if(_0x5a9b66[_0xaef8('0x18')][_0xaef8('0x19')]===0x1f4){logger[_0xaef8('0x18')](_0xaef8('0x1a'),_0x1175c8,_0x5a9b66[_0xaef8('0x18')][_0xaef8('0x1b')]);return _0x1ebaba(_0x5a9b66[_0xaef8('0x18')][_0xaef8('0x1b')]);}logger[_0xaef8('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x1175c8,_0x5a9b66[_0xaef8('0x18')]['message']);return _0x3a24a7(_0x5a9b66[_0xaef8('0x18')][_0xaef8('0x1b')]);}else{logger['info'](_0xaef8('0x1a'),_0x1175c8,_0xaef8('0x15'));_0x3a24a7(_0x5a9b66[_0xaef8('0x1c')][_0xaef8('0x1b')]);}})[_0xaef8('0x1d')](function(_0x4cc596){logger['error'](_0xaef8('0x1a'),_0x1175c8,_0x4cc596);_0x1ebaba(_0x4cc596);});});}exports['CreateWhatsappMessage']=function(_0x4ca07e){var _0x38359e=this;return new Promise(function(_0xbd0721,_0x2dcb93){return db[_0xaef8('0x1e')][_0xaef8('0x1f')](_0x4ca07e['body'],{'raw':_0x4ca07e[_0xaef8('0x20')]?_0x4ca07e[_0xaef8('0x20')][_0xaef8('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2e325f){logger[_0xaef8('0x14')](_0xaef8('0x22'),_0x4ca07e);logger['debug'](_0xaef8('0x22'),_0x4ca07e,JSON[_0xaef8('0x17')](_0x2e325f));_0xbd0721(_0x2e325f);})[_0xaef8('0x1d')](function(_0x566495){logger[_0xaef8('0x18')](_0xaef8('0x22'),_0x566495[_0xaef8('0x1b')],_0x4ca07e);_0x2dcb93(_0x38359e[_0xaef8('0x18')](0x1f4,_0x566495['message']));});});}; \ No newline at end of file +var _0x4dcc=['result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x5c538e,_0x5d4b90){var _0x3da2f6=function(_0x55a0){while(--_0x55a0){_0x5c538e['push'](_0x5c538e['shift']());}};_0x3da2f6(++_0x5d4b90);}(_0x4dcc,0x8f));var _0xc4dc=function(_0x422890,_0x434494){_0x422890=_0x422890-0x0;var _0x202cf0=_0x4dcc[_0x422890];return _0x202cf0;};'use strict';var _=require(_0xc4dc('0x0'));var util=require(_0xc4dc('0x1'));var moment=require(_0xc4dc('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4dc('0x3'));var fs=require('fs');var Redis=require(_0xc4dc('0x4'));var db=require(_0xc4dc('0x5'))['db'];var utils=require(_0xc4dc('0x6'));var logger=require(_0xc4dc('0x7'))(_0xc4dc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4dc('0x9')][_0xc4dc('0xa')]({'port':0x232a});config[_0xc4dc('0xb')]=_[_0xc4dc('0xc')](config[_0xc4dc('0xb')],{'host':_0xc4dc('0xd'),'port':0x18eb});var socket=require(_0xc4dc('0xe'))(new Redis(config[_0xc4dc('0xb')]));require(_0xc4dc('0xf'))[_0xc4dc('0x10')](socket);function respondWithRpcPromise(_0x284b9e,_0x11d8b0,_0x29187b){return new BPromise(function(_0x532e58,_0x53df8d){return client['request'](_0x284b9e,_0x29187b)[_0xc4dc('0x11')](function(_0x113718){logger['info'](_0xc4dc('0x12'),_0x11d8b0,'request\x20sent');logger[_0xc4dc('0x13')](_0xc4dc('0x14'),_0x11d8b0,_0xc4dc('0x15'),JSON[_0xc4dc('0x16')](_0x113718));if(_0x113718[_0xc4dc('0x17')]){if(_0x113718[_0xc4dc('0x17')][_0xc4dc('0x18')]===0x1f4){logger[_0xc4dc('0x17')](_0xc4dc('0x12'),_0x11d8b0,_0x113718['error'][_0xc4dc('0x19')]);return _0x53df8d(_0x113718[_0xc4dc('0x17')]['message']);}logger[_0xc4dc('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x11d8b0,_0x113718['error'][_0xc4dc('0x19')]);return _0x532e58(_0x113718[_0xc4dc('0x17')][_0xc4dc('0x19')]);}else{logger[_0xc4dc('0x1a')](_0xc4dc('0x12'),_0x11d8b0,_0xc4dc('0x15'));_0x532e58(_0x113718[_0xc4dc('0x1b')][_0xc4dc('0x19')]);}})['catch'](function(_0x4bb811){logger[_0xc4dc('0x17')](_0xc4dc('0x12'),_0x11d8b0,_0x4bb811);_0x53df8d(_0x4bb811);});});}exports[_0xc4dc('0x1c')]=function(_0x184948){var _0x3428cb=this;return new Promise(function(_0x1d65ef,_0x155b26){return db[_0xc4dc('0x1d')][_0xc4dc('0x1e')](_0x184948[_0xc4dc('0x1f')],{'raw':_0x184948[_0xc4dc('0x20')]?_0x184948[_0xc4dc('0x20')][_0xc4dc('0x21')]===undefined?!![]:![]:!![]})[_0xc4dc('0x11')](function(_0x1f9d59){logger['info']('CreateWhatsappMessage',_0x184948);logger[_0xc4dc('0x13')]('CreateWhatsappMessage',_0x184948,JSON[_0xc4dc('0x16')](_0x1f9d59));_0x1d65ef(_0x1f9d59);})['catch'](function(_0x59dbed){logger[_0xc4dc('0x17')]('CreateWhatsappMessage',_0x59dbed['message'],_0x184948);_0x155b26(_0x3428cb[_0xc4dc('0x17')](0x1f4,_0x59dbed[_0xc4dc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b5a7043..3e91b90 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 _0x7d4f=['length','save','remove','update','removeListener'];(function(_0x352456,_0x34aa33){var _0x407f20=function(_0x5f32b6){while(--_0x5f32b6){_0x352456['push'](_0x352456['shift']());}};_0x407f20(++_0x34aa33);}(_0x7d4f,0x10a));var _0xf7d4=function(_0x4c9191,_0xe10c76){_0x4c9191=_0x4c9191-0x0;var _0x593642=_0x7d4f[_0x4c9191];return _0x593642;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf7d4('0x0'),_0xf7d4('0x1'),_0xf7d4('0x2')];function createListener(_0x5e9aaf,_0x58745a){return function(_0x1b83db){_0x58745a['emit'](_0x5e9aaf,_0x1b83db);};}function removeListener(_0x21786b,_0x28500e){return function(){WhatsappMessageEvents[_0xf7d4('0x3')](_0x21786b,_0x28500e);};}exports['register']=function(_0x5d9d4b){for(var _0x4efe23=0x0,_0x386738=events[_0xf7d4('0x4')];_0x4efe23<_0x386738;_0x4efe23++){var _0x19e4c3=events[_0x4efe23];var _0x37f214=createListener('whatsappMessage:'+_0x19e4c3,_0x5d9d4b);WhatsappMessageEvents['on'](_0x19e4c3,_0x37f214);}}; \ No newline at end of file +var _0x95c3=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','update'];(function(_0x40624b,_0x3ac415){var _0x4fa434=function(_0x1ab2b4){while(--_0x1ab2b4){_0x40624b['push'](_0x40624b['shift']());}};_0x4fa434(++_0x3ac415);}(_0x95c3,0x1cc));var _0x395c=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x95c3[_0x412e27];return _0x53da42;};'use strict';var WhatsappMessageEvents=require(_0x395c('0x0'));var events=['save','remove',_0x395c('0x1')];function createListener(_0x3fb130,_0x4afd94){return function(_0x560efa){_0x4afd94[_0x395c('0x2')](_0x3fb130,_0x560efa);};}function removeListener(_0x257401,_0x38baab){return function(){WhatsappMessageEvents[_0x395c('0x3')](_0x257401,_0x38baab);};}exports[_0x395c('0x4')]=function(_0x1755c0){for(var _0x33c947=0x0,_0x511d25=events[_0x395c('0x5')];_0x33c947<_0x511d25;_0x33c947++){var _0x53b6d4=events[_0x33c947];var _0x2e25bf=createListener(_0x395c('0x6')+_0x53b6d4,_0x1755c0);WhatsappMessageEvents['on'](_0x53b6d4,_0x2e25bf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b449a7b..b2d974e 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 _0x4757=['removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy'];(function(_0x58f401,_0x1136c9){var _0x146e3d=function(_0x249501){while(--_0x249501){_0x58f401['push'](_0x58f401['shift']());}};_0x146e3d(++_0x1136c9);}(_0x4757,0xc6));var _0x7475=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x4757[_0x3a0c4f];return _0x247049;};'use strict';var multer=require(_0x7475('0x0'));var util=require(_0x7475('0x1'));var path=require('path');var timeout=require(_0x7475('0x2'));var express=require(_0x7475('0x3'));var router=express[_0x7475('0x4')]();var fs_extra=require(_0x7475('0x5'));var auth=require(_0x7475('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7475('0x7'));var controller=require('./whatsappQueue.controller');router[_0x7475('0x8')]('/',auth[_0x7475('0x9')](),controller['index']);router[_0x7475('0x8')](_0x7475('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7475('0x8')](_0x7475('0xb'),auth[_0x7475('0x9')](),controller[_0x7475('0xc')]);router[_0x7475('0x8')](_0x7475('0xd'),auth[_0x7475('0x9')](),controller[_0x7475('0xe')]);router[_0x7475('0x8')]('/:id/teams',auth[_0x7475('0x9')](),controller[_0x7475('0xf')]);router[_0x7475('0x8')](_0x7475('0x10'),auth[_0x7475('0x9')](),controller[_0x7475('0x11')]);router[_0x7475('0x12')]('/',auth['isAuthenticated'](),controller[_0x7475('0x13')]);router[_0x7475('0x12')](_0x7475('0x14'),auth[_0x7475('0x9')](),controller[_0x7475('0x15')]);router[_0x7475('0x12')](_0x7475('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7475('0x16')](_0x7475('0xb'),auth[_0x7475('0x9')](),controller[_0x7475('0x17')]);router[_0x7475('0x18')](_0x7475('0xb'),auth[_0x7475('0x9')](),controller[_0x7475('0x19')]);router[_0x7475('0x18')](_0x7475('0x14'),auth[_0x7475('0x9')](),controller['removeTeams']);router[_0x7475('0x18')](_0x7475('0x10'),auth[_0x7475('0x9')](),controller[_0x7475('0x1a')]);module[_0x7475('0x1b')]=router; \ No newline at end of file +var _0x619c=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x306e81,_0x13da24){var _0x288465=function(_0x5d70de){while(--_0x5d70de){_0x306e81['push'](_0x306e81['shift']());}};_0x288465(++_0x13da24);}(_0x619c,0x132));var _0xc619=function(_0x27e959,_0x4c8be1){_0x27e959=_0x27e959-0x0;var _0xe1df65=_0x619c[_0x27e959];return _0xe1df65;};'use strict';var multer=require(_0xc619('0x0'));var util=require(_0xc619('0x1'));var path=require('path');var timeout=require(_0xc619('0x2'));var express=require(_0xc619('0x3'));var router=express[_0xc619('0x4')]();var fs_extra=require(_0xc619('0x5'));var auth=require(_0xc619('0x6'));var interaction=require(_0xc619('0x7'));var config=require(_0xc619('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xc619('0x9')](),controller[_0xc619('0xa')]);router[_0xc619('0xb')](_0xc619('0xc'),auth[_0xc619('0x9')](),controller[_0xc619('0xd')]);router[_0xc619('0xb')](_0xc619('0xe'),auth[_0xc619('0x9')](),controller['show']);router[_0xc619('0xb')](_0xc619('0xf'),auth[_0xc619('0x9')](),controller[_0xc619('0x10')]);router[_0xc619('0xb')](_0xc619('0x11'),auth['isAuthenticated'](),controller[_0xc619('0x12')]);router['get']('/:id/users',auth[_0xc619('0x9')](),controller[_0xc619('0x13')]);router[_0xc619('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc619('0x14')]('/:id/teams',auth[_0xc619('0x9')](),controller[_0xc619('0x15')]);router[_0xc619('0x14')](_0xc619('0x16'),auth[_0xc619('0x9')](),controller['addAgents']);router[_0xc619('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc619('0x18')](_0xc619('0xe'),auth[_0xc619('0x9')](),controller[_0xc619('0x19')]);router[_0xc619('0x18')](_0xc619('0x11'),auth['isAuthenticated'](),controller[_0xc619('0x1a')]);router['delete'](_0xc619('0x16'),auth['isAuthenticated'](),controller[_0xc619('0x1b')]);module[_0xc619('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6b22810..38b6cc2 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 _0x5e14=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x117417,_0x214c67){var _0x5ba86d=function(_0x35ad70){while(--_0x35ad70){_0x117417['push'](_0x117417['shift']());}};_0x5ba86d(++_0x214c67);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module[_0x45e1('0x1')]={'name':{'type':Sequelize[_0x45e1('0x2')],'unique':_0x45e1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x45e1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45e1('0x5')](_0x45e1('0x6'),_0x45e1('0x7'),_0x45e1('0x8'))},'description':{'type':Sequelize[_0x45e1('0x2')]}}; \ No newline at end of file +var _0xfd2f=['sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x48c644,_0x19edd8){var _0x4d1303=function(_0x562e4a){while(--_0x562e4a){_0x48c644['push'](_0x48c644['shift']());}};_0x4d1303(++_0x19edd8);}(_0xfd2f,0x14a));var _0xffd2=function(_0x5cc8a2,_0x4eb102){_0x5cc8a2=_0x5cc8a2-0x0;var _0x4be65d=_0xfd2f[_0x5cc8a2];return _0x4be65d;};'use strict';var Sequelize=require(_0xffd2('0x0'));module[_0xffd2('0x1')]={'name':{'type':Sequelize[_0xffd2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xffd2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xffd2('0x4'),_0xffd2('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xffd2('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 864c975..3489078 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 _0xc65e=['each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','stack','name','send','map','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','WhatsappQueue','include','catch','show','params','rawAttributes','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','rows','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','addTeams'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xc65e,0x148));var _0xec65=function(_0x195483,_0x39b7f7){_0x195483=_0x195483-0x0;var _0x274722=_0xc65e[_0x195483];return _0x274722;};'use strict';var emlformat=require(_0xec65('0x0'));var rimraf=require(_0xec65('0x1'));var zipdir=require(_0xec65('0x2'));var jsonpatch=require(_0xec65('0x3'));var rp=require(_0xec65('0x4'));var moment=require(_0xec65('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xec65('0x6'));var path=require(_0xec65('0x7'));var sox=require(_0xec65('0x8'));var csv=require(_0xec65('0x9'));var ejs=require(_0xec65('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec65('0xb'));var squel=require(_0xec65('0xc'));var crypto=require(_0xec65('0xd'));var jsforce=require(_0xec65('0xe'));var deskjs=require(_0xec65('0xf'));var toCsv=require(_0xec65('0x9'));var querystring=require(_0xec65('0x10'));var Papa=require(_0xec65('0x11'));var Redis=require(_0xec65('0x12'));var authService=require(_0xec65('0x13'));var qs=require(_0xec65('0x14'));var as=require(_0xec65('0x15'));var hardwareService=require(_0xec65('0x16'));var logger=require(_0xec65('0x17'))(_0xec65('0x18'));var utils=require(_0xec65('0x19'));var config=require(_0xec65('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xec65('0x1b'))['db'];config['redis']=_[_0xec65('0x1c')](config[_0xec65('0x1d')],{'host':_0xec65('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xec65('0x1f'))[_0xec65('0x20')](socket);function respondWithStatusCode(_0x8558be,_0x12785f){_0x12785f=_0x12785f||0xcc;return function(_0x420ed3){if(_0x420ed3){return _0x8558be[_0xec65('0x21')](_0x12785f);}return _0x8558be['status'](_0x12785f)[_0xec65('0x22')]();};}function respondWithResult(_0x3da815,_0x5acce9){_0x5acce9=_0x5acce9||0xc8;return function(_0x10c4b8){if(_0x10c4b8){return _0x3da815[_0xec65('0x23')](_0x5acce9)[_0xec65('0x24')](_0x10c4b8);}};}function respondWithFilteredResult(_0x37af35,_0x5619c2){return function(_0xef91a4){if(_0xef91a4){var _0x5bb9a9=typeof _0x5619c2[_0xec65('0x25')]===_0xec65('0x26')&&typeof _0x5619c2[_0xec65('0x27')]===_0xec65('0x26');var _0x450c39=_0xef91a4[_0xec65('0x28')];var _0x235b0f=_0x5bb9a9?0x0:_0x5619c2['offset'];var _0x3fda33=_0x5bb9a9?_0xef91a4[_0xec65('0x28')]:_0x5619c2[_0xec65('0x25')]+_0x5619c2[_0xec65('0x27')];var _0x5a20b8;if(_0x3fda33>=_0x450c39){_0x3fda33=_0x450c39;_0x5a20b8=0xc8;}else{_0x5a20b8=0xce;}_0x37af35[_0xec65('0x23')](_0x5a20b8);return _0x37af35[_0xec65('0x29')](_0xec65('0x2a'),_0x235b0f+'-'+_0x3fda33+'/'+_0x450c39)[_0xec65('0x24')](_0xef91a4);}return null;};}function patchUpdates(_0x1f534d){return function(_0x26ce45){try{jsonpatch[_0xec65('0x2b')](_0x26ce45,_0x1f534d,!![]);}catch(_0x471c84){return BPromise['reject'](_0x471c84);}return _0x26ce45[_0xec65('0x2c')]();};}function saveUpdates(_0x4b26ed,_0x8f66a4){return function(_0x5cee6c){if(_0x5cee6c){return _0x5cee6c[_0xec65('0x2d')](_0x4b26ed)['then'](function(_0x46d311){return _0x46d311;});}return null;};}function removeEntity(_0x1ba306,_0x191115){return function(_0x140d97){if(_0x140d97){return _0x140d97[_0xec65('0x2e')]()[_0xec65('0x2f')](function(){var _0x2e25b4=_0x140d97[_0xec65('0x30')]({'plain':!![]});var _0x3f7806='WhatsappQueues';return db[_0xec65('0x31')][_0xec65('0x2e')]({'where':{'type':_0x3f7806,'resourceId':_0x2e25b4['id']}})[_0xec65('0x2f')](function(){return _0x140d97;});})[_0xec65('0x2f')](function(){_0x1ba306[_0xec65('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440c8a,_0x531d09){return function(_0x1ec96f){if(!_0x1ec96f){_0x440c8a[_0xec65('0x21')](0x194);}return _0x1ec96f;};}function handleError(_0x12470d,_0x8b09c0){_0x8b09c0=_0x8b09c0||0x1f4;return function(_0x39ca8d){logger['error'](_0x39ca8d[_0xec65('0x32')]);if(_0x39ca8d[_0xec65('0x33')]){delete _0x39ca8d[_0xec65('0x33')];}_0x12470d[_0xec65('0x23')](_0x8b09c0)[_0xec65('0x34')](_0x39ca8d);};}exports['index']=function(_0x1925de,_0x81797f){var _0x33e205={},_0x2b0170={},_0xe89522={'count':0x0,'rows':[]};var _0x95b110=_[_0xec65('0x35')](db['WhatsappQueue']['rawAttributes'],function(_0x4cb08a){return{'name':_0x4cb08a[_0xec65('0x36')],'type':_0x4cb08a[_0xec65('0x37')]['key']};});_0x2b0170['model']=_['map'](_0x95b110,_0xec65('0x33'));_0x2b0170[_0xec65('0x38')]=_[_0xec65('0x39')](_0x1925de[_0xec65('0x38')]);_0x2b0170[_0xec65('0x3a')]=_['intersection'](_0x2b0170[_0xec65('0x3b')],_0x2b0170['query']);_0x33e205[_0xec65('0x3c')]=_['intersection'](_0x2b0170[_0xec65('0x3b')],qs['fields'](_0x1925de[_0xec65('0x38')][_0xec65('0x3d')]));_0x33e205['attributes']=_0x33e205[_0xec65('0x3c')][_0xec65('0x3e')]?_0x33e205['attributes']:_0x2b0170[_0xec65('0x3b')];if(!_0x1925de[_0xec65('0x38')][_0xec65('0x3f')]('nolimit')){_0x33e205['limit']=qs[_0xec65('0x27')](_0x1925de[_0xec65('0x38')][_0xec65('0x27')]);_0x33e205['offset']=qs[_0xec65('0x25')](_0x1925de[_0xec65('0x38')][_0xec65('0x25')]);}_0x33e205[_0xec65('0x40')]=qs[_0xec65('0x41')](_0x1925de[_0xec65('0x38')][_0xec65('0x41')]);_0x33e205['where']=qs[_0xec65('0x3a')](_[_0xec65('0x42')](_0x1925de['query'],_0x2b0170['filters']),_0x95b110);if(_0x1925de[_0xec65('0x38')][_0xec65('0x43')]){_0x33e205[_0xec65('0x44')]=_['merge'](_0x33e205[_0xec65('0x44')],{'$or':_[_0xec65('0x35')](_0x95b110,function(_0x56579f){if(_0x56579f[_0xec65('0x37')]!=='VIRTUAL'){var _0xe30ec2={};_0xe30ec2[_0x56579f[_0xec65('0x33')]]={'$like':'%'+_0x1925de[_0xec65('0x38')][_0xec65('0x43')]+'%'};return _0xe30ec2;}})});}_0x33e205=_[_0xec65('0x45')]({},_0x33e205,_0x1925de[_0xec65('0x46')]);var _0x239500={'where':_0x33e205[_0xec65('0x44')]};return db[_0xec65('0x47')][_0xec65('0x28')](_0x239500)[_0xec65('0x2f')](function(_0x580c50){_0xe89522['count']=_0x580c50;if(_0x1925de[_0xec65('0x38')]['includeAll']){_0x33e205[_0xec65('0x48')]=[{'all':!![]}];}return db[_0xec65('0x47')]['findAll'](_0x33e205);})[_0xec65('0x2f')](function(_0x2f9e87){_0xe89522['rows']=_0x2f9e87;return _0xe89522;})[_0xec65('0x2f')](respondWithFilteredResult(_0x81797f,_0x33e205))[_0xec65('0x49')](handleError(_0x81797f,null));};exports[_0xec65('0x4a')]=function(_0xa49650,_0x59f43c){var _0x158632={'raw':!![],'where':{'id':_0xa49650[_0xec65('0x4b')]['id']}},_0x5e6bcb={};_0x5e6bcb[_0xec65('0x3b')]=_['keys'](db[_0xec65('0x47')][_0xec65('0x4c')]);_0x5e6bcb[_0xec65('0x38')]=_[_0xec65('0x39')](_0xa49650[_0xec65('0x38')]);_0x5e6bcb['filters']=_[_0xec65('0x4d')](_0x5e6bcb[_0xec65('0x3b')],_0x5e6bcb[_0xec65('0x38')]);_0x158632[_0xec65('0x3c')]=_[_0xec65('0x4d')](_0x5e6bcb[_0xec65('0x3b')],qs['fields'](_0xa49650[_0xec65('0x38')][_0xec65('0x3d')]));_0x158632[_0xec65('0x3c')]=_0x158632[_0xec65('0x3c')][_0xec65('0x3e')]?_0x158632[_0xec65('0x3c')]:_0x5e6bcb[_0xec65('0x3b')];if(_0xa49650['query'][_0xec65('0x4e')]){_0x158632[_0xec65('0x48')]=[{'all':!![]}];}_0x158632=_[_0xec65('0x45')]({},_0x158632,_0xa49650[_0xec65('0x46')]);return db[_0xec65('0x47')]['find'](_0x158632)[_0xec65('0x2f')](handleEntityNotFound(_0x59f43c,null))['then'](respondWithResult(_0x59f43c,null))['catch'](handleError(_0x59f43c,null));};exports[_0xec65('0x4f')]=function(_0x5963e8,_0x4115a5){return db[_0xec65('0x47')][_0xec65('0x4f')](_0x5963e8[_0xec65('0x50')],{})[_0xec65('0x2f')](function(_0x319dbf){var _0x41a064=_0x5963e8[_0xec65('0x51')]['get']({'plain':!![]});if(!_0x41a064)throw new Error(_0xec65('0x52'));if(_0x41a064['role']===_0xec65('0x51')){var _0xc50b21=_0x319dbf['get']({'plain':!![]});var _0x5f558f=_0xec65('0x53');return db[_0xec65('0x54')][_0xec65('0x55')]({'where':{'name':_0x5f558f,'userProfileId':_0x41a064[_0xec65('0x56')]},'raw':!![]})[_0xec65('0x2f')](function(_0x12c611){if(_0x12c611&&_0x12c611['autoAssociation']===0x0){return db[_0xec65('0x31')][_0xec65('0x4f')]({'name':_0xc50b21[_0xec65('0x33')],'resourceId':_0xc50b21['id'],'type':_0x12c611[_0xec65('0x33')],'sectionId':_0x12c611['id']},{})['then'](function(){return _0x319dbf;});}else{return _0x319dbf;}})[_0xec65('0x49')](function(_0x2d20a0){logger[_0xec65('0x57')](_0xec65('0x58'),_0x2d20a0);throw _0x2d20a0;});}return _0x319dbf;})[_0xec65('0x2f')](respondWithResult(_0x4115a5,0xc9))[_0xec65('0x49')](handleError(_0x4115a5,null));};exports[_0xec65('0x2d')]=function(_0x5abf3e,_0x423981){if(_0x5abf3e['body']['id']){delete _0x5abf3e[_0xec65('0x50')]['id'];}return db[_0xec65('0x47')]['find']({'where':{'id':_0x5abf3e['params']['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x423981,null))['then'](saveUpdates(_0x5abf3e[_0xec65('0x50')],null))['then'](respondWithResult(_0x423981,null))[_0xec65('0x49')](handleError(_0x423981,null));};exports[_0xec65('0x2e')]=function(_0x49d617,_0x22118d){return db[_0xec65('0x47')][_0xec65('0x55')]({'where':{'id':_0x49d617[_0xec65('0x4b')]['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x22118d,null))['then'](removeEntity(_0x22118d,null))['catch'](handleError(_0x22118d,null));};exports[_0xec65('0x59')]=function(_0x8274e4,_0x13da1b){return db[_0xec65('0x47')][_0xec65('0x59')]()[_0xec65('0x2f')](respondWithResult(_0x13da1b,null))[_0xec65('0x49')](handleError(_0x13da1b,null));};exports[_0xec65('0x5a')]=function(_0x1541e1,_0x5e4e1c,_0x44437b){var _0x2023c5={'raw':!![],'where':{}},_0x271fdc={},_0x42c67c;return db['WhatsappQueue'][_0xec65('0x5b')]({'where':{'id':_0x1541e1['params']['id']}})['then'](handleEntityNotFound(_0x5e4e1c,null))['then'](function(_0x9c0eca){if(_0x9c0eca){_0x42c67c=_0x9c0eca[_0xec65('0x30')]({'plain':!![]});_0x271fdc[_0xec65('0x3b')]=_['keys'](db[_0xec65('0x5c')][_0xec65('0x4c')]);_0x271fdc['query']=_['keys'](_0x1541e1[_0xec65('0x38')]);_0x271fdc[_0xec65('0x3a')]=_[_0xec65('0x4d')](_0x271fdc[_0xec65('0x3b')],_0x271fdc['query']);_0x2023c5[_0xec65('0x3c')]=_[_0xec65('0x4d')](_0x271fdc[_0xec65('0x3b')],qs[_0xec65('0x3d')](_0x1541e1[_0xec65('0x38')][_0xec65('0x3d')]));_0x2023c5[_0xec65('0x3c')]=_0x2023c5[_0xec65('0x3c')][_0xec65('0x3e')]?_0x2023c5[_0xec65('0x3c')]:_0x271fdc[_0xec65('0x3b')];if(!_0x1541e1['query'][_0xec65('0x3f')](_0xec65('0x5d'))){_0x2023c5[_0xec65('0x27')]=qs[_0xec65('0x27')](_0x1541e1[_0xec65('0x38')]['limit']);_0x2023c5[_0xec65('0x25')]=qs[_0xec65('0x25')](_0x1541e1[_0xec65('0x38')]['offset']);}_0x2023c5[_0xec65('0x40')]=qs[_0xec65('0x41')](_0x1541e1[_0xec65('0x38')]['sort']);_0x2023c5['where']=qs[_0xec65('0x3a')](_['pick'](_0x1541e1['query'],_0x271fdc[_0xec65('0x3a')]));_0x2023c5[_0xec65('0x44')][_0xec65('0x5e')]=_0x9c0eca['id'];if(_0x1541e1[_0xec65('0x38')][_0xec65('0x43')]){_0x2023c5['where']=_['merge'](_0x2023c5['where'],{'$or':_[_0xec65('0x35')](_0x2023c5[_0xec65('0x3c')],function(_0xff07f9){var _0x4910cf={};_0x4910cf[_0xff07f9]={'$like':'%'+_0x1541e1[_0xec65('0x38')][_0xec65('0x43')]+'%'};return _0x4910cf;})});}_0x2023c5=_[_0xec65('0x45')]({},_0x2023c5,_0x1541e1[_0xec65('0x46')]);return db['UserWhatsappQueue'][_0xec65('0x5f')](_0x2023c5);}})[_0xec65('0x2f')](function(_0x2b58d3){if(_0x2b58d3){return db[_0xec65('0x60')][_0xec65('0x61')]({'where':{'id':_[_0xec65('0x35')](_0x2b58d3,_0xec65('0x62')),'role':_0xec65('0x63')},'attributes':['id',_0xec65('0x33'),_0xec65('0x64'),'updatedAt','createdAt']});}})[_0xec65('0x2f')](function(_0x31e3aa){if(_0x31e3aa){return{'count':_0x31e3aa[_0xec65('0x28')],'rows':_[_0xec65('0x35')](_0x31e3aa[_0xec65('0x65')],function(_0x1f95de){return{'membername':_0x1f95de[_0xec65('0x33')],'UserId':_0x1f95de['id'],'queue_name':_0x42c67c['name'],'WhatsappQueueId':_0x42c67c['id'],'interface':util['format'](_0xec65('0x66'),_0xec65('0x67'),_0x1f95de[_0xec65('0x33')]),'penalty':0x0,'paused':_0x1f95de[_0xec65('0x64')],'createdAt':_0x1f95de[_0xec65('0x68')],'updatedAt':_0x1f95de[_0xec65('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5e4e1c,_0x2023c5))['catch'](handleError(_0x5e4e1c,null));};exports['getTeams']=function(_0x3ca331,_0x5cb0f1,_0x122098){var _0x4966cd={};var _0x316aab={};var _0x29b7b3;var _0x455020;return db[_0xec65('0x47')][_0xec65('0x5b')]({'where':{'id':_0x3ca331[_0xec65('0x4b')]['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x5cb0f1,null))['then'](function(_0x3c3662){if(_0x3c3662){_0x29b7b3=_0x3c3662;_0x316aab[_0xec65('0x3b')]=_[_0xec65('0x39')](db[_0xec65('0x6a')][_0xec65('0x4c')]);_0x316aab[_0xec65('0x38')]=_[_0xec65('0x39')](_0x3ca331[_0xec65('0x38')]);_0x316aab[_0xec65('0x3a')]=_[_0xec65('0x4d')](_0x316aab[_0xec65('0x3b')],_0x316aab['query']);_0x4966cd[_0xec65('0x3c')]=_[_0xec65('0x4d')](_0x316aab['model'],qs['fields'](_0x3ca331[_0xec65('0x38')][_0xec65('0x3d')]));_0x4966cd[_0xec65('0x3c')]=_0x4966cd['attributes'][_0xec65('0x3e')]?_0x4966cd[_0xec65('0x3c')]:_0x316aab[_0xec65('0x3b')];_0x4966cd[_0xec65('0x40')]=qs[_0xec65('0x41')](_0x3ca331[_0xec65('0x38')][_0xec65('0x41')]);_0x4966cd['where']=qs['filters'](_['pick'](_0x3ca331[_0xec65('0x38')],_0x316aab[_0xec65('0x3a')]));if(_0x3ca331[_0xec65('0x38')][_0xec65('0x43')]){_0x4966cd[_0xec65('0x44')]=_[_0xec65('0x45')](_0x4966cd['where'],{'$or':_['map'](_0x4966cd[_0xec65('0x3c')],function(_0x371368){var _0x308858={};_0x308858[_0x371368]={'$like':'%'+_0x3ca331[_0xec65('0x38')][_0xec65('0x43')]+'%'};return _0x308858;})});}_0x4966cd=_[_0xec65('0x45')]({},_0x4966cd,_0x3ca331[_0xec65('0x46')]);return _0x29b7b3['getTeams'](_0x4966cd);}})['then'](function(_0x2511ac){if(_0x2511ac){_0x455020=_0x2511ac[_0xec65('0x3e')];if(!_0x3ca331[_0xec65('0x38')][_0xec65('0x3f')](_0xec65('0x5d'))){_0x4966cd[_0xec65('0x27')]=qs[_0xec65('0x27')](_0x3ca331['query'][_0xec65('0x27')]);_0x4966cd[_0xec65('0x25')]=qs[_0xec65('0x25')](_0x3ca331[_0xec65('0x38')][_0xec65('0x25')]);}return _0x29b7b3[_0xec65('0x6b')](_0x4966cd);}})['then'](function(_0x56b7d7){if(_0x56b7d7){return _0x56b7d7?{'count':_0x455020,'rows':_0x56b7d7}:null;}})['then'](respondWithResult(_0x5cb0f1,null))[_0xec65('0x49')](handleError(_0x5cb0f1,null));};exports['addTeams']=function(_0x396007,_0x464bda,_0x551a2b){var _0x7a1449=_0x396007['body'][_0xec65('0x6c')];return db[_0xec65('0x6a')]['findAll']({'where':{'id':_0x7a1449},'attributes':['id'],'include':[{'model':db[_0xec65('0x60')],'as':'Agents','attributes':['id',_0xec65('0x33'),_0xec65('0x6d'),_0xec65('0x6e'),_0xec65('0x6f')],'raw':!![]}]})[_0xec65('0x2f')](function(_0x1cfb0f){if(_0x1cfb0f){var _0x2774b1=_[_0xec65('0x70')](_0x1cfb0f,function(_0x529730){var _0x420140=_0x529730[_0xec65('0x30')]({'plain':!![]});return _0x420140[_0xec65('0x71')];});return db['WhatsappQueue'][_0xec65('0x55')]({'where':{'id':_0x396007[_0xec65('0x4b')]['id']}})['then'](function(_0x384a28){return db['sequelize'][_0xec65('0x72')](function(_0x4732ca){return _0x384a28[_0xec65('0x73')](_0x7a1449,{'transaction':_0x4732ca})[_0xec65('0x2f')](function(){return BPromise[_0xec65('0x74')](_0x2774b1,function(_0xdce5e0){return db[_0xec65('0x5c')][_0xec65('0x75')]({'where':{'UserId':_0xdce5e0['id'],'WhatsappQueueId':_0x396007[_0xec65('0x4b')]['id']},'transaction':_0x4732ca});});})[_0xec65('0x2f')](function(){_0x2774b1[_0xec65('0x76')](function(_0x51b7e6){socket[_0xec65('0x77')](_0xec65('0x78'),{'UserId':_0x51b7e6['id'],'WhatsappQueueId':_0x384a28['id']});});});});});}})['then'](respondWithStatusCode(_0x464bda,null))[_0xec65('0x49')](handleError(_0x464bda,null));};exports['removeTeams']=function(_0x53b2cd,_0x50b258,_0x5b28f2){return db[_0xec65('0x6a')]['findAll']({'where':{'id':_0x53b2cd[_0xec65('0x38')][_0xec65('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xec65('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x50b258,null))[_0xec65('0x2f')](function(_0x2491d4){var _0x47d7d2=_['map'](_0x2491d4,'id');var _0x24f1b2=[];var _0x57a30a=[];var _0x2d4287=squel[_0xec65('0x79')]();_0x2d4287['field'](_0xec65('0x7a'))[_0xec65('0x7b')](_0xec65('0x7c'),'tq')[_0xec65('0x7d')](_0xec65('0x7e'),'ut',_0xec65('0x7f'))[_0xec65('0x44')](_0xec65('0x80'),_0x53b2cd['params']['id']);for(var _0x302a96=0x0;_0x302a96<_0x2491d4[_0xec65('0x3e')];_0x302a96+=0x1){let _0x10adef=_0x2491d4[_0x302a96];for(var _0x2627ed=0x0;_0x2627ed<_0x10adef[_0xec65('0x71')][_0xec65('0x3e')];_0x2627ed+=0x1){let _0x2e8396=_0x10adef['Agents'][_0x2627ed];var _0x434811=_0x2d4287[_0xec65('0x81')]();_0x434811[_0xec65('0x44')](_0xec65('0x82'),_0x2e8396['id']);_0x57a30a[_0xec65('0x83')](db[_0xec65('0x84')][_0xec65('0x38')](_0x434811['toString'](),{'type':db[_0xec65('0x84')]['QueryTypes'][_0xec65('0x85')]})[_0xec65('0x2f')](function(_0x2e4bf1){if(_0x2e4bf1[_0xec65('0x3e')]===0x1){return _0x2e8396['id'];}else{var _0x39436a=_[_0xec65('0x86')](_[_0xec65('0x35')](_0x2e4bf1,_0xec65('0x87')),function(_0x185b7f){return _[_0xec65('0x88')](_0x47d7d2,_0x185b7f);});if(_0x39436a){return _0x2e8396['id'];}}}));}}return BPromise[_0xec65('0x89')](_0x57a30a)[_0xec65('0x2f')](function(_0x190499){_0x24f1b2=_(_0x24f1b2)[_0xec65('0x8a')](_0x190499)[_0xec65('0x8b')]()[_0xec65('0x8c')]();return db['WhatsappQueue'][_0xec65('0x55')]({'where':{'id':_0x53b2cd['params']['id']}})[_0xec65('0x2f')](function(_0x5d1aca){return db['sequelize'][_0xec65('0x72')](function(_0x3fd08e){return _0x5d1aca[_0xec65('0x8d')](_0x53b2cd[_0xec65('0x38')]['ids'],{'transaction':_0x3fd08e})[_0xec65('0x2f')](function(){if(!_[_0xec65('0x8e')](_0x24f1b2)){return _0x5d1aca[_0xec65('0x8f')](_0x24f1b2,{'transaction':_0x3fd08e});}})['then'](function(){_0x24f1b2[_0xec65('0x76')](function(_0x396f31){socket[_0xec65('0x77')](_0xec65('0x90'),{'UserId':_0x396f31,'WhatsappQueueId':_0x5d1aca['id']});});});});});});})['then'](respondWithStatusCode(_0x50b258,null))[_0xec65('0x49')](handleError(_0x50b258,null));};exports[_0xec65('0x91')]=function(_0x242132,_0x39074e,_0x4aaf00){return db['WhatsappQueue'][_0xec65('0x55')]({'where':{'id':_0x242132['params']['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x39074e,null))[_0xec65('0x2f')](function(_0x50d540){if(_0x50d540){return _0x50d540[_0xec65('0x91')](_0x242132[_0xec65('0x50')]['ids'],_['omit'](_0x242132[_0xec65('0x50')],[_0xec65('0x6c'),'id'])||{})[_0xec65('0x92')](function(_0x1e247f){for(var _0x3826d6=0x0;_0x3826d6<_0x242132[_0xec65('0x50')]['ids']['length'];_0x3826d6+=0x1){socket[_0xec65('0x77')](_0xec65('0x78'),{'UserId':Number(_0x242132[_0xec65('0x50')][_0xec65('0x6c')][_0x3826d6]),'WhatsappQueueId':Number(_0x242132['params']['id'])});}return _0x1e247f;});}})[_0xec65('0x2f')](respondWithResult(_0x39074e,null))[_0xec65('0x49')](handleError(_0x39074e,null));};exports[_0xec65('0x8f')]=function(_0x4d727a,_0x316c63,_0x5bb6dc){return db['WhatsappQueue'][_0xec65('0x55')]({'where':{'id':_0x4d727a[_0xec65('0x4b')]['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x316c63,null))[_0xec65('0x2f')](function(_0xb246ed){if(_0xb246ed){return _0xb246ed[_0xec65('0x8f')](_0x4d727a[_0xec65('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x4d727a[_0xec65('0x38')]['ids'])){for(var _0x433dea=0x0;_0x433dea<_0x4d727a[_0xec65('0x38')][_0xec65('0x6c')][_0xec65('0x3e')];_0x433dea+=0x1){socket['emit'](_0xec65('0x90'),{'UserId':Number(_0x4d727a[_0xec65('0x38')][_0xec65('0x6c')][_0x433dea]),'WhatsappQueueId':Number(_0x4d727a[_0xec65('0x4b')]['id'])});}}else{socket[_0xec65('0x77')](_0xec65('0x90'),{'UserId':Number(_0x4d727a[_0xec65('0x38')]['ids']),'WhatsappQueueId':Number(_0x4d727a[_0xec65('0x4b')]['id'])});}});}})[_0xec65('0x2f')](respondWithStatusCode(_0x316c63,null))[_0xec65('0x49')](handleError(_0x316c63,null));};exports[_0xec65('0x93')]=function(_0x1db9c8,_0x8312c9,_0x253037){var _0x2603d5={};var _0x346dc0={};var _0x3821c0;var _0x4d1874;return db[_0xec65('0x47')][_0xec65('0x5b')]({'where':{'id':_0x1db9c8[_0xec65('0x4b')]['id']}})[_0xec65('0x2f')](handleEntityNotFound(_0x8312c9,null))[_0xec65('0x2f')](function(_0x40f26c){if(_0x40f26c){_0x3821c0=_0x40f26c;_0x346dc0[_0xec65('0x3b')]=_[_0xec65('0x39')](db[_0xec65('0x60')][_0xec65('0x4c')]);_0x346dc0[_0xec65('0x38')]=_['keys'](_0x1db9c8[_0xec65('0x38')]);_0x346dc0[_0xec65('0x3a')]=_[_0xec65('0x4d')](_0x346dc0[_0xec65('0x3b')],_0x346dc0[_0xec65('0x38')]);_0x2603d5[_0xec65('0x3c')]=_[_0xec65('0x4d')](_0x346dc0['model'],qs[_0xec65('0x3d')](_0x1db9c8[_0xec65('0x38')][_0xec65('0x3d')]));_0x2603d5[_0xec65('0x3c')]=_0x2603d5[_0xec65('0x3c')][_0xec65('0x3e')]?_0x2603d5[_0xec65('0x3c')]:_0x346dc0['model'];_0x2603d5['order']=qs[_0xec65('0x41')](_0x1db9c8[_0xec65('0x38')]['sort']);_0x2603d5[_0xec65('0x44')]=qs['filters'](_[_0xec65('0x42')](_0x1db9c8[_0xec65('0x38')],_0x346dc0[_0xec65('0x3a')]));if(_0x1db9c8[_0xec65('0x38')][_0xec65('0x43')]){_0x2603d5['where']=_['merge'](_0x2603d5[_0xec65('0x44')],{'$or':_[_0xec65('0x35')](_0x2603d5['attributes'],function(_0x1a0a82){var _0x25c134={};_0x25c134[_0x1a0a82]={'$like':'%'+_0x1db9c8[_0xec65('0x38')][_0xec65('0x43')]+'%'};return _0x25c134;})});}_0x2603d5=_[_0xec65('0x45')]({},_0x2603d5,_0x1db9c8['options']);return _0x3821c0[_0xec65('0x93')](_0x2603d5);}})[_0xec65('0x2f')](function(_0x3f225b){if(_0x3f225b){_0x4d1874=_0x3f225b[_0xec65('0x3e')];if(!_0x1db9c8[_0xec65('0x38')][_0xec65('0x3f')]('nolimit')){_0x2603d5['limit']=qs['limit'](_0x1db9c8[_0xec65('0x38')][_0xec65('0x27')]);_0x2603d5[_0xec65('0x25')]=qs[_0xec65('0x25')](_0x1db9c8[_0xec65('0x38')]['offset']);}return _0x3821c0[_0xec65('0x93')](_0x2603d5);}})[_0xec65('0x2f')](function(_0x3d202e){if(_0x3d202e){return _0x3d202e?{'count':_0x4d1874,'rows':_0x3d202e}:null;}})[_0xec65('0x2f')](respondWithResult(_0x8312c9,null))['catch'](handleError(_0x8312c9,null));}; \ No newline at end of file +var _0x4697=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappQueue.socket','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','map','WhatsappQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','type','filter','merge','findAll','catch','show','keys','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','join','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x1b7a63,_0x2fa404){var _0x34ed9b=function(_0x1b7f6b){while(--_0x1b7f6b){_0x1b7a63['push'](_0x1b7a63['shift']());}};_0x34ed9b(++_0x2fa404);}(_0x4697,0xfa));var _0x7469=function(_0xa5bbd3,_0x3091f8){_0xa5bbd3=_0xa5bbd3-0x0;var _0xea93d9=_0x4697[_0xa5bbd3];return _0xea93d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7469('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7469('0x1'));var rp=require(_0x7469('0x2'));var moment=require(_0x7469('0x3'));var BPromise=require(_0x7469('0x4'));var Mustache=require(_0x7469('0x5'));var util=require('util');var path=require(_0x7469('0x6'));var sox=require(_0x7469('0x7'));var csv=require(_0x7469('0x8'));var ejs=require(_0x7469('0x9'));var fs=require('fs');var fs_extra=require(_0x7469('0xa'));var _=require('lodash');var squel=require(_0x7469('0xb'));var crypto=require(_0x7469('0xc'));var jsforce=require(_0x7469('0xd'));var deskjs=require(_0x7469('0xe'));var toCsv=require(_0x7469('0x8'));var querystring=require(_0x7469('0xf'));var Papa=require(_0x7469('0x10'));var Redis=require('ioredis');var authService=require(_0x7469('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7469('0x12'));var hardwareService=require(_0x7469('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7469('0x14'));var config=require(_0x7469('0x15'));var licenseUtil=require(_0x7469('0x16'));var db=require(_0x7469('0x17'))['db'];config[_0x7469('0x18')]=_['defaults'](config[_0x7469('0x18')],{'host':_0x7469('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7469('0x18')]));require(_0x7469('0x1a'))['register'](socket);function respondWithStatusCode(_0x505bba,_0x83e65d){_0x83e65d=_0x83e65d||0xcc;return function(_0x13eaf1){if(_0x13eaf1){return _0x505bba['sendStatus'](_0x83e65d);}return _0x505bba[_0x7469('0x1b')](_0x83e65d)[_0x7469('0x1c')]();};}function respondWithResult(_0x5281ef,_0x557be9){_0x557be9=_0x557be9||0xc8;return function(_0x4e5e52){if(_0x4e5e52){return _0x5281ef[_0x7469('0x1b')](_0x557be9)['json'](_0x4e5e52);}};}function respondWithFilteredResult(_0x4bf593,_0x2d73c6){return function(_0xb47f29){if(_0xb47f29){var _0x2a7fd4=typeof _0x2d73c6['offset']===_0x7469('0x1d')&&typeof _0x2d73c6['limit']===_0x7469('0x1d');var _0x1b25b6=_0xb47f29[_0x7469('0x1e')];var _0x800cf5=_0x2a7fd4?0x0:_0x2d73c6[_0x7469('0x1f')];var _0x13b615=_0x2a7fd4?_0xb47f29[_0x7469('0x1e')]:_0x2d73c6[_0x7469('0x1f')]+_0x2d73c6[_0x7469('0x20')];var _0xd868e9;if(_0x13b615>=_0x1b25b6){_0x13b615=_0x1b25b6;_0xd868e9=0xc8;}else{_0xd868e9=0xce;}_0x4bf593[_0x7469('0x1b')](_0xd868e9);return _0x4bf593[_0x7469('0x21')](_0x7469('0x22'),_0x800cf5+'-'+_0x13b615+'/'+_0x1b25b6)[_0x7469('0x23')](_0xb47f29);}return null;};}function patchUpdates(_0x30118f){return function(_0x36e1f7){try{jsonpatch['apply'](_0x36e1f7,_0x30118f,!![]);}catch(_0x4e6631){return BPromise[_0x7469('0x24')](_0x4e6631);}return _0x36e1f7[_0x7469('0x25')]();};}function saveUpdates(_0x595f00,_0x32fec2){return function(_0x276be8){if(_0x276be8){return _0x276be8[_0x7469('0x26')](_0x595f00)[_0x7469('0x27')](function(_0xfbd84b){return _0xfbd84b;});}return null;};}function removeEntity(_0x260f57,_0x392c60){return function(_0x5943c5){if(_0x5943c5){return _0x5943c5[_0x7469('0x28')]()[_0x7469('0x27')](function(){var _0x2cbd27=_0x5943c5['get']({'plain':!![]});var _0x496301=_0x7469('0x29');return db[_0x7469('0x2a')][_0x7469('0x28')]({'where':{'type':_0x496301,'resourceId':_0x2cbd27['id']}})['then'](function(){return _0x5943c5;});})[_0x7469('0x27')](function(){_0x260f57[_0x7469('0x1b')](0xcc)[_0x7469('0x1c')]();});}};}function handleEntityNotFound(_0x4ac38a,_0xb57d1b){return function(_0x4045db){if(!_0x4045db){_0x4ac38a[_0x7469('0x2b')](0x194);}return _0x4045db;};}function handleError(_0x37f823,_0x1958c0){_0x1958c0=_0x1958c0||0x1f4;return function(_0x34376d){logger[_0x7469('0x2c')](_0x34376d[_0x7469('0x2d')]);if(_0x34376d[_0x7469('0x2e')]){delete _0x34376d['name'];}_0x37f823[_0x7469('0x1b')](_0x1958c0)['send'](_0x34376d);};}exports['index']=function(_0x49d75c,_0x5db56e){var _0x39618b={},_0x30c652={},_0x513378={'count':0x0,'rows':[]};var _0x5b72f5=_[_0x7469('0x2f')](db[_0x7469('0x30')][_0x7469('0x31')],function(_0xf3d501){return{'name':_0xf3d501['fieldName'],'type':_0xf3d501['type']['key']};});_0x30c652[_0x7469('0x32')]=_[_0x7469('0x2f')](_0x5b72f5,'name');_0x30c652[_0x7469('0x33')]=_['keys'](_0x49d75c[_0x7469('0x33')]);_0x30c652[_0x7469('0x34')]=_[_0x7469('0x35')](_0x30c652[_0x7469('0x32')],_0x30c652['query']);_0x39618b[_0x7469('0x36')]=_[_0x7469('0x35')](_0x30c652['model'],qs[_0x7469('0x37')](_0x49d75c[_0x7469('0x33')][_0x7469('0x37')]));_0x39618b['attributes']=_0x39618b[_0x7469('0x36')][_0x7469('0x38')]?_0x39618b[_0x7469('0x36')]:_0x30c652[_0x7469('0x32')];if(!_0x49d75c[_0x7469('0x33')][_0x7469('0x39')]('nolimit')){_0x39618b[_0x7469('0x20')]=qs[_0x7469('0x20')](_0x49d75c[_0x7469('0x33')][_0x7469('0x20')]);_0x39618b['offset']=qs[_0x7469('0x1f')](_0x49d75c[_0x7469('0x33')]['offset']);}_0x39618b[_0x7469('0x3a')]=qs[_0x7469('0x3b')](_0x49d75c[_0x7469('0x33')][_0x7469('0x3b')]);_0x39618b['where']=qs['filters'](_[_0x7469('0x3c')](_0x49d75c[_0x7469('0x33')],_0x30c652['filters']),_0x5b72f5);if(_0x49d75c['query']['filter']){_0x39618b[_0x7469('0x3d')]=_['merge'](_0x39618b[_0x7469('0x3d')],{'$or':_['map'](_0x5b72f5,function(_0x1b7691){if(_0x1b7691[_0x7469('0x3e')]!=='VIRTUAL'){var _0x43388b={};_0x43388b[_0x1b7691[_0x7469('0x2e')]]={'$like':'%'+_0x49d75c['query'][_0x7469('0x3f')]+'%'};return _0x43388b;}})});}_0x39618b=_[_0x7469('0x40')]({},_0x39618b,_0x49d75c['options']);var _0x1ebe8e={'where':_0x39618b[_0x7469('0x3d')]};return db['WhatsappQueue'][_0x7469('0x1e')](_0x1ebe8e)[_0x7469('0x27')](function(_0xfcd585){_0x513378['count']=_0xfcd585;if(_0x49d75c[_0x7469('0x33')]['includeAll']){_0x39618b['include']=[{'all':!![]}];}return db[_0x7469('0x30')][_0x7469('0x41')](_0x39618b);})[_0x7469('0x27')](function(_0x21e3b9){_0x513378['rows']=_0x21e3b9;return _0x513378;})['then'](respondWithFilteredResult(_0x5db56e,_0x39618b))[_0x7469('0x42')](handleError(_0x5db56e,null));};exports[_0x7469('0x43')]=function(_0x53f015,_0x3c4ede){var _0x658160={'raw':!![],'where':{'id':_0x53f015['params']['id']}},_0x546987={};_0x546987[_0x7469('0x32')]=_[_0x7469('0x44')](db[_0x7469('0x30')][_0x7469('0x31')]);_0x546987[_0x7469('0x33')]=_[_0x7469('0x44')](_0x53f015[_0x7469('0x33')]);_0x546987['filters']=_[_0x7469('0x35')](_0x546987[_0x7469('0x32')],_0x546987['query']);_0x658160[_0x7469('0x36')]=_[_0x7469('0x35')](_0x546987[_0x7469('0x32')],qs[_0x7469('0x37')](_0x53f015['query']['fields']));_0x658160[_0x7469('0x36')]=_0x658160[_0x7469('0x36')][_0x7469('0x38')]?_0x658160[_0x7469('0x36')]:_0x546987[_0x7469('0x32')];if(_0x53f015[_0x7469('0x33')]['includeAll']){_0x658160[_0x7469('0x45')]=[{'all':!![]}];}_0x658160=_[_0x7469('0x40')]({},_0x658160,_0x53f015[_0x7469('0x46')]);return db[_0x7469('0x30')]['find'](_0x658160)[_0x7469('0x27')](handleEntityNotFound(_0x3c4ede,null))[_0x7469('0x27')](respondWithResult(_0x3c4ede,null))[_0x7469('0x42')](handleError(_0x3c4ede,null));};exports[_0x7469('0x47')]=function(_0x399da4,_0x364beb){return db['WhatsappQueue'][_0x7469('0x47')](_0x399da4[_0x7469('0x48')],{})['then'](function(_0x4f6198){var _0x2792a9=_0x399da4['user'][_0x7469('0x49')]({'plain':!![]});if(!_0x2792a9)throw new Error(_0x7469('0x4a'));if(_0x2792a9[_0x7469('0x4b')]==='user'){var _0x34ec1a=_0x4f6198[_0x7469('0x49')]({'plain':!![]});var _0x238a03=_0x7469('0x29');return db[_0x7469('0x4c')][_0x7469('0x4d')]({'where':{'name':_0x238a03,'userProfileId':_0x2792a9[_0x7469('0x4e')]},'raw':!![]})[_0x7469('0x27')](function(_0x4b74ba){if(_0x4b74ba&&_0x4b74ba['autoAssociation']===0x0){return db[_0x7469('0x2a')][_0x7469('0x47')]({'name':_0x34ec1a[_0x7469('0x2e')],'resourceId':_0x34ec1a['id'],'type':_0x4b74ba[_0x7469('0x2e')],'sectionId':_0x4b74ba['id']},{})[_0x7469('0x27')](function(){return _0x4f6198;});}else{return _0x4f6198;}})[_0x7469('0x42')](function(_0x5ce0ef){logger[_0x7469('0x2c')](_0x7469('0x4f'),_0x5ce0ef);throw _0x5ce0ef;});}return _0x4f6198;})[_0x7469('0x27')](respondWithResult(_0x364beb,0xc9))['catch'](handleError(_0x364beb,null));};exports['update']=function(_0x41869f,_0x4d281f){if(_0x41869f[_0x7469('0x48')]['id']){delete _0x41869f[_0x7469('0x48')]['id'];}return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x41869f[_0x7469('0x50')]['id']}})[_0x7469('0x27')](handleEntityNotFound(_0x4d281f,null))[_0x7469('0x27')](saveUpdates(_0x41869f[_0x7469('0x48')],null))[_0x7469('0x27')](respondWithResult(_0x4d281f,null))[_0x7469('0x42')](handleError(_0x4d281f,null));};exports['destroy']=function(_0x5ded71,_0x380913){return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x5ded71['params']['id']}})[_0x7469('0x27')](handleEntityNotFound(_0x380913,null))[_0x7469('0x27')](removeEntity(_0x380913,null))[_0x7469('0x42')](handleError(_0x380913,null));};exports[_0x7469('0x51')]=function(_0xb23228,_0x3c5f26){return db[_0x7469('0x30')][_0x7469('0x51')]()[_0x7469('0x27')](respondWithResult(_0x3c5f26,null))['catch'](handleError(_0x3c5f26,null));};exports['getMembers']=function(_0x811a0b,_0xd30021,_0x5125f6){var _0x1d8131={'raw':!![],'where':{}},_0x47d4f8={},_0x48c01a;return db['WhatsappQueue'][_0x7469('0x52')]({'where':{'id':_0x811a0b['params']['id']}})['then'](handleEntityNotFound(_0xd30021,null))[_0x7469('0x27')](function(_0x457a8d){if(_0x457a8d){_0x48c01a=_0x457a8d[_0x7469('0x49')]({'plain':!![]});_0x47d4f8[_0x7469('0x32')]=_[_0x7469('0x44')](db[_0x7469('0x53')]['rawAttributes']);_0x47d4f8[_0x7469('0x33')]=_[_0x7469('0x44')](_0x811a0b[_0x7469('0x33')]);_0x47d4f8['filters']=_[_0x7469('0x35')](_0x47d4f8[_0x7469('0x32')],_0x47d4f8['query']);_0x1d8131[_0x7469('0x36')]=_[_0x7469('0x35')](_0x47d4f8[_0x7469('0x32')],qs['fields'](_0x811a0b[_0x7469('0x33')][_0x7469('0x37')]));_0x1d8131[_0x7469('0x36')]=_0x1d8131[_0x7469('0x36')][_0x7469('0x38')]?_0x1d8131[_0x7469('0x36')]:_0x47d4f8[_0x7469('0x32')];if(!_0x811a0b[_0x7469('0x33')][_0x7469('0x39')]('nolimit')){_0x1d8131[_0x7469('0x20')]=qs['limit'](_0x811a0b['query'][_0x7469('0x20')]);_0x1d8131[_0x7469('0x1f')]=qs[_0x7469('0x1f')](_0x811a0b[_0x7469('0x33')][_0x7469('0x1f')]);}_0x1d8131['order']=qs[_0x7469('0x3b')](_0x811a0b[_0x7469('0x33')][_0x7469('0x3b')]);_0x1d8131[_0x7469('0x3d')]=qs[_0x7469('0x34')](_['pick'](_0x811a0b[_0x7469('0x33')],_0x47d4f8[_0x7469('0x34')]));_0x1d8131[_0x7469('0x3d')][_0x7469('0x54')]=_0x457a8d['id'];if(_0x811a0b[_0x7469('0x33')]['filter']){_0x1d8131['where']=_[_0x7469('0x40')](_0x1d8131['where'],{'$or':_[_0x7469('0x2f')](_0x1d8131[_0x7469('0x36')],function(_0x349126){var _0x3853a6={};_0x3853a6[_0x349126]={'$like':'%'+_0x811a0b[_0x7469('0x33')][_0x7469('0x3f')]+'%'};return _0x3853a6;})});}_0x1d8131=_[_0x7469('0x40')]({},_0x1d8131,_0x811a0b[_0x7469('0x46')]);return db[_0x7469('0x53')]['findAll'](_0x1d8131);}})[_0x7469('0x27')](function(_0x1c11cd){if(_0x1c11cd){return db[_0x7469('0x55')][_0x7469('0x56')]({'where':{'id':_[_0x7469('0x2f')](_0x1c11cd,'UserId'),'role':'agent'},'attributes':['id',_0x7469('0x2e'),'whatsappPause','updatedAt',_0x7469('0x57')]});}})[_0x7469('0x27')](function(_0x4cf520){if(_0x4cf520){return{'count':_0x4cf520['count'],'rows':_[_0x7469('0x2f')](_0x4cf520[_0x7469('0x58')],function(_0x2550dc){return{'membername':_0x2550dc['name'],'UserId':_0x2550dc['id'],'queue_name':_0x48c01a[_0x7469('0x2e')],'WhatsappQueueId':_0x48c01a['id'],'interface':util[_0x7469('0x59')](_0x7469('0x5a'),_0x7469('0x5b'),_0x2550dc[_0x7469('0x2e')]),'penalty':0x0,'paused':_0x2550dc[_0x7469('0x5c')],'createdAt':_0x2550dc[_0x7469('0x57')],'updatedAt':_0x2550dc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7469('0x27')](respondWithFilteredResult(_0xd30021,_0x1d8131))['catch'](handleError(_0xd30021,null));};exports[_0x7469('0x5d')]=function(_0x5ef797,_0x359ec8,_0x189247){var _0xa7487d={};var _0x368e01={};var _0x1b7ea2;var _0x3e0871;return db[_0x7469('0x30')]['findOne']({'where':{'id':_0x5ef797['params']['id']}})[_0x7469('0x27')](handleEntityNotFound(_0x359ec8,null))[_0x7469('0x27')](function(_0x5ba400){if(_0x5ba400){_0x1b7ea2=_0x5ba400;_0x368e01[_0x7469('0x32')]=_[_0x7469('0x44')](db[_0x7469('0x5e')]['rawAttributes']);_0x368e01[_0x7469('0x33')]=_[_0x7469('0x44')](_0x5ef797['query']);_0x368e01['filters']=_[_0x7469('0x35')](_0x368e01['model'],_0x368e01[_0x7469('0x33')]);_0xa7487d[_0x7469('0x36')]=_[_0x7469('0x35')](_0x368e01['model'],qs[_0x7469('0x37')](_0x5ef797[_0x7469('0x33')][_0x7469('0x37')]));_0xa7487d['attributes']=_0xa7487d[_0x7469('0x36')][_0x7469('0x38')]?_0xa7487d[_0x7469('0x36')]:_0x368e01[_0x7469('0x32')];_0xa7487d[_0x7469('0x3a')]=qs[_0x7469('0x3b')](_0x5ef797['query'][_0x7469('0x3b')]);_0xa7487d[_0x7469('0x3d')]=qs[_0x7469('0x34')](_['pick'](_0x5ef797['query'],_0x368e01['filters']));if(_0x5ef797[_0x7469('0x33')][_0x7469('0x3f')]){_0xa7487d[_0x7469('0x3d')]=_['merge'](_0xa7487d[_0x7469('0x3d')],{'$or':_[_0x7469('0x2f')](_0xa7487d[_0x7469('0x36')],function(_0x50ee65){var _0x51e9d1={};_0x51e9d1[_0x50ee65]={'$like':'%'+_0x5ef797[_0x7469('0x33')][_0x7469('0x3f')]+'%'};return _0x51e9d1;})});}_0xa7487d=_['merge']({},_0xa7487d,_0x5ef797[_0x7469('0x46')]);return _0x1b7ea2['getTeams'](_0xa7487d);}})[_0x7469('0x27')](function(_0x338edb){if(_0x338edb){_0x3e0871=_0x338edb[_0x7469('0x38')];if(!_0x5ef797[_0x7469('0x33')][_0x7469('0x39')]('nolimit')){_0xa7487d[_0x7469('0x20')]=qs[_0x7469('0x20')](_0x5ef797[_0x7469('0x33')]['limit']);_0xa7487d[_0x7469('0x1f')]=qs[_0x7469('0x1f')](_0x5ef797[_0x7469('0x33')][_0x7469('0x1f')]);}return _0x1b7ea2[_0x7469('0x5d')](_0xa7487d);}})[_0x7469('0x27')](function(_0x4d8b1b){if(_0x4d8b1b){return _0x4d8b1b?{'count':_0x3e0871,'rows':_0x4d8b1b}:null;}})[_0x7469('0x27')](respondWithResult(_0x359ec8,null))[_0x7469('0x42')](handleError(_0x359ec8,null));};exports['addTeams']=function(_0x4cff7b,_0x4971a8,_0x4c8e98){var _0x10749a=_0x4cff7b[_0x7469('0x48')][_0x7469('0x5f')];return db[_0x7469('0x5e')][_0x7469('0x41')]({'where':{'id':_0x10749a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7469('0x60'),'attributes':['id','name',_0x7469('0x61'),_0x7469('0x62'),_0x7469('0x63')],'raw':!![]}]})[_0x7469('0x27')](function(_0x26a3a6){if(_0x26a3a6){var _0x12c0f1=_[_0x7469('0x64')](_0x26a3a6,function(_0x44314e){var _0x483c93=_0x44314e[_0x7469('0x49')]({'plain':!![]});return _0x483c93['Agents'];});return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x4cff7b[_0x7469('0x50')]['id']}})[_0x7469('0x27')](function(_0x2cd151){return db[_0x7469('0x65')][_0x7469('0x66')](function(_0x34952f){return _0x2cd151[_0x7469('0x67')](_0x10749a,{'transaction':_0x34952f})[_0x7469('0x27')](function(){return BPromise['each'](_0x12c0f1,function(_0x3b9423){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x3b9423['id'],'WhatsappQueueId':_0x4cff7b[_0x7469('0x50')]['id']},'transaction':_0x34952f});});})['then'](function(){_0x12c0f1[_0x7469('0x68')](function(_0x2d5dac){socket[_0x7469('0x69')](_0x7469('0x6a'),{'UserId':_0x2d5dac['id'],'WhatsappQueueId':_0x2cd151['id']});});});});});}})[_0x7469('0x27')](respondWithStatusCode(_0x4971a8,null))[_0x7469('0x42')](handleError(_0x4971a8,null));};exports[_0x7469('0x6b')]=function(_0x467c17,_0x34cf16,_0x18f7a9){return db['Team'][_0x7469('0x41')]({'where':{'id':_0x467c17[_0x7469('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7469('0x55')],'as':_0x7469('0x60'),'attributes':['id'],'raw':!![]}]})[_0x7469('0x27')](handleEntityNotFound(_0x34cf16,null))[_0x7469('0x27')](function(_0x420ec4){var _0x4b9de5=_[_0x7469('0x2f')](_0x420ec4,'id');var _0x4f83d8=[];var _0x214edb=[];var _0x5144ed=squel[_0x7469('0x6c')]();_0x5144ed[_0x7469('0x6d')](_0x7469('0x6e'))['from']('team_has_whatsapp_queues','tq')[_0x7469('0x6f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7469('0x3d')](_0x7469('0x70'),_0x467c17['params']['id']);for(var _0x5942e3=0x0;_0x5942e3<_0x420ec4[_0x7469('0x38')];_0x5942e3+=0x1){let _0x500420=_0x420ec4[_0x5942e3];for(var _0x2dccc0=0x0;_0x2dccc0<_0x500420[_0x7469('0x60')]['length'];_0x2dccc0+=0x1){let _0xee5d8=_0x500420['Agents'][_0x2dccc0];var _0x2489bd=_0x5144ed['clone']();_0x2489bd[_0x7469('0x3d')](_0x7469('0x71'),_0xee5d8['id']);_0x214edb[_0x7469('0x72')](db[_0x7469('0x65')][_0x7469('0x33')](_0x2489bd[_0x7469('0x73')](),{'type':db[_0x7469('0x65')][_0x7469('0x74')][_0x7469('0x75')]})[_0x7469('0x27')](function(_0x510456){if(_0x510456[_0x7469('0x38')]===0x1){return _0xee5d8['id'];}else{var _0x2fa735=_['every'](_[_0x7469('0x2f')](_0x510456,_0x7469('0x76')),function(_0x5efaad){return _[_0x7469('0x77')](_0x4b9de5,_0x5efaad);});if(_0x2fa735){return _0xee5d8['id'];}}}));}}return BPromise['all'](_0x214edb)[_0x7469('0x27')](function(_0x3b6df6){_0x4f83d8=_(_0x4f83d8)[_0x7469('0x78')](_0x3b6df6)[_0x7469('0x79')]()[_0x7469('0x7a')]();return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x467c17[_0x7469('0x50')]['id']}})[_0x7469('0x27')](function(_0x4a0dd7){return db[_0x7469('0x65')][_0x7469('0x66')](function(_0x3a81c2){return _0x4a0dd7[_0x7469('0x6b')](_0x467c17['query'][_0x7469('0x5f')],{'transaction':_0x3a81c2})[_0x7469('0x27')](function(){if(!_['isEmpty'](_0x4f83d8)){return _0x4a0dd7[_0x7469('0x7b')](_0x4f83d8,{'transaction':_0x3a81c2});}})[_0x7469('0x27')](function(){_0x4f83d8['forEach'](function(_0x317e71){socket[_0x7469('0x69')](_0x7469('0x7c'),{'UserId':_0x317e71,'WhatsappQueueId':_0x4a0dd7['id']});});});});});});})[_0x7469('0x27')](respondWithStatusCode(_0x34cf16,null))['catch'](handleError(_0x34cf16,null));};exports[_0x7469('0x7d')]=function(_0x122fc3,_0x27ac20,_0x2107d6){return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x122fc3['params']['id']}})[_0x7469('0x27')](handleEntityNotFound(_0x27ac20,null))[_0x7469('0x27')](function(_0x110119){if(_0x110119){return _0x110119[_0x7469('0x7d')](_0x122fc3['body']['ids'],_[_0x7469('0x7e')](_0x122fc3['body'],[_0x7469('0x5f'),'id'])||{})['spread'](function(_0x515f97){for(var _0x3b9667=0x0;_0x3b9667<_0x122fc3[_0x7469('0x48')][_0x7469('0x5f')][_0x7469('0x38')];_0x3b9667+=0x1){socket[_0x7469('0x69')](_0x7469('0x6a'),{'UserId':Number(_0x122fc3[_0x7469('0x48')][_0x7469('0x5f')][_0x3b9667]),'WhatsappQueueId':Number(_0x122fc3['params']['id'])});}return _0x515f97;});}})[_0x7469('0x27')](respondWithResult(_0x27ac20,null))[_0x7469('0x42')](handleError(_0x27ac20,null));};exports[_0x7469('0x7b')]=function(_0x404945,_0x5929c,_0x32a889){return db[_0x7469('0x30')][_0x7469('0x4d')]({'where':{'id':_0x404945[_0x7469('0x50')]['id']}})['then'](handleEntityNotFound(_0x5929c,null))[_0x7469('0x27')](function(_0x2279d5){if(_0x2279d5){return _0x2279d5['removeAgents'](_0x404945[_0x7469('0x33')][_0x7469('0x5f')])[_0x7469('0x27')](function(){if(_[_0x7469('0x7f')](_0x404945[_0x7469('0x33')]['ids'])){for(var _0x25e5f7=0x0;_0x25e5f7<_0x404945[_0x7469('0x33')][_0x7469('0x5f')][_0x7469('0x38')];_0x25e5f7+=0x1){socket[_0x7469('0x69')]('userWhatsappQueue:remove',{'UserId':Number(_0x404945[_0x7469('0x33')][_0x7469('0x5f')][_0x25e5f7]),'WhatsappQueueId':Number(_0x404945[_0x7469('0x50')]['id'])});}}else{socket[_0x7469('0x69')](_0x7469('0x7c'),{'UserId':Number(_0x404945['query']['ids']),'WhatsappQueueId':Number(_0x404945[_0x7469('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x5929c,null))[_0x7469('0x42')](handleError(_0x5929c,null));};exports[_0x7469('0x80')]=function(_0x22442d,_0x2f5946,_0x1d85cf){var _0x3ba8d0={};var _0x526647={};var _0x2058c0;var _0x96189c;return db['WhatsappQueue']['findOne']({'where':{'id':_0x22442d['params']['id']}})['then'](handleEntityNotFound(_0x2f5946,null))['then'](function(_0x20c8d5){if(_0x20c8d5){_0x2058c0=_0x20c8d5;_0x526647[_0x7469('0x32')]=_[_0x7469('0x44')](db[_0x7469('0x55')][_0x7469('0x31')]);_0x526647[_0x7469('0x33')]=_[_0x7469('0x44')](_0x22442d[_0x7469('0x33')]);_0x526647[_0x7469('0x34')]=_['intersection'](_0x526647['model'],_0x526647[_0x7469('0x33')]);_0x3ba8d0[_0x7469('0x36')]=_[_0x7469('0x35')](_0x526647[_0x7469('0x32')],qs['fields'](_0x22442d[_0x7469('0x33')][_0x7469('0x37')]));_0x3ba8d0[_0x7469('0x36')]=_0x3ba8d0['attributes']['length']?_0x3ba8d0[_0x7469('0x36')]:_0x526647['model'];_0x3ba8d0[_0x7469('0x3a')]=qs[_0x7469('0x3b')](_0x22442d[_0x7469('0x33')][_0x7469('0x3b')]);_0x3ba8d0['where']=qs[_0x7469('0x34')](_['pick'](_0x22442d[_0x7469('0x33')],_0x526647['filters']));if(_0x22442d['query'][_0x7469('0x3f')]){_0x3ba8d0[_0x7469('0x3d')]=_['merge'](_0x3ba8d0[_0x7469('0x3d')],{'$or':_['map'](_0x3ba8d0[_0x7469('0x36')],function(_0x57f0c9){var _0x234e67={};_0x234e67[_0x57f0c9]={'$like':'%'+_0x22442d[_0x7469('0x33')]['filter']+'%'};return _0x234e67;})});}_0x3ba8d0=_['merge']({},_0x3ba8d0,_0x22442d['options']);return _0x2058c0[_0x7469('0x80')](_0x3ba8d0);}})['then'](function(_0x392358){if(_0x392358){_0x96189c=_0x392358[_0x7469('0x38')];if(!_0x22442d[_0x7469('0x33')][_0x7469('0x39')](_0x7469('0x81'))){_0x3ba8d0['limit']=qs[_0x7469('0x20')](_0x22442d['query']['limit']);_0x3ba8d0['offset']=qs[_0x7469('0x1f')](_0x22442d[_0x7469('0x33')]['offset']);}return _0x2058c0[_0x7469('0x80')](_0x3ba8d0);}})['then'](function(_0x5ced78){if(_0x5ced78){return _0x5ced78?{'count':_0x96189c,'rows':_0x5ced78}:null;}})[_0x7469('0x27')](respondWithResult(_0x2f5946,null))[_0x7469('0x42')](handleError(_0x2f5946,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f470c81..bf1d02b 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 _0x38b0=['remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0xfef2ea,_0x2632fc){var _0x26a541=function(_0x44efbd){while(--_0x44efbd){_0xfef2ea['push'](_0xfef2ea['shift']());}};_0x26a541(++_0x2632fc);}(_0x38b0,0x111));var _0x038b=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x38b0[_0x2fdce0];return _0x36f07e;};'use strict';var EventEmitter=require(_0x038b('0x0'));var WhatsappQueue=require(_0x038b('0x1'))['db'][_0x038b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x038b('0x3')](0x0);var events={'afterCreate':_0x038b('0x4'),'afterUpdate':_0x038b('0x5'),'afterDestroy':_0x038b('0x6')};function emitEvent(_0x33edfb){return function(_0x3d0b98,_0x2a5254,_0x295a17){WhatsappQueueEvents[_0x038b('0x7')](_0x33edfb+':'+_0x3d0b98['id'],_0x3d0b98);WhatsappQueueEvents[_0x038b('0x7')](_0x33edfb,_0x3d0b98);_0x295a17(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x038b('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xcd29=['WhatsappQueue','save','update','emit','hook','events','../../mysqldb'];(function(_0x23118b,_0x562da3){var _0x3636cf=function(_0x5dc55c){while(--_0x5dc55c){_0x23118b['push'](_0x23118b['shift']());}};_0x3636cf(++_0x562da3);}(_0xcd29,0x194));var _0x9cd2=function(_0x285d74,_0xd764c2){_0x285d74=_0x285d74-0x0;var _0x47dfa8=_0xcd29[_0x285d74];return _0x47dfa8;};'use strict';var EventEmitter=require(_0x9cd2('0x0'));var WhatsappQueue=require(_0x9cd2('0x1'))['db'][_0x9cd2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9cd2('0x3'),'afterUpdate':_0x9cd2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2283d9){return function(_0x3a3991,_0x352cb6,_0x4ae290){WhatsappQueueEvents['emit'](_0x2283d9+':'+_0x3a3991['id'],_0x3a3991);WhatsappQueueEvents[_0x9cd2('0x5')](_0x2283d9,_0x3a3991);_0x4ae290(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9cd2('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 194f325..1a76b1f 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 _0xecb3=['../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x47e540,_0x4d5ad9){var _0x290658=function(_0x1090bf){while(--_0x1090bf){_0x47e540['push'](_0x47e540['shift']());}};_0x290658(++_0x4d5ad9);}(_0xecb3,0x1f4));var _0x3ecb=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xecb3[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x3ecb('0x0'));var util=require(_0x3ecb('0x1'));var logger=require(_0x3ecb('0x2'))(_0x3ecb('0x3'));var moment=require('moment');var BPromise=require(_0x3ecb('0x4'));var rp=require(_0x3ecb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3ecb('0x6'));var attributes=require(_0x3ecb('0x7'));module[_0x3ecb('0x8')]=function(_0x3b5e34,_0x345ede){return _0x3b5e34[_0x3ecb('0x9')]('WhatsappQueue',attributes,{'tableName':_0x3ecb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4a2=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0xbfe06d,_0x2c5a5c){var _0x4db0b4=function(_0x43dee7){while(--_0x43dee7){_0xbfe06d['push'](_0xbfe06d['shift']());}};_0x4db0b4(++_0x2c5a5c);}(_0xa4a2,0x9e));var _0x2a4a=function(_0x30133d,_0x548ec7){_0x30133d=_0x30133d-0x0;var _0x4bc6b0=_0xa4a2[_0x30133d];return _0x4bc6b0;};'use strict';var _=require(_0x2a4a('0x0'));var util=require(_0x2a4a('0x1'));var logger=require(_0x2a4a('0x2'))(_0x2a4a('0x3'));var moment=require(_0x2a4a('0x4'));var BPromise=require(_0x2a4a('0x5'));var rp=require(_0x2a4a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a4a('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x2a4a('0x8')]=function(_0x5cc9cd,_0x2f10df){return _0x5cc9cd[_0x2a4a('0x9')](_0x2a4a('0xa'),attributes,{'tableName':_0x2a4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 464e7ab..a4b4396 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 _0x9d40=['debug','catch','ShowWhatsappQueue','find','randomstring','ioredis','../../mysqldb','rpc','defaults','redis','socket.io-emitter','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x382c79,_0x5879ed){var _0x3f55dd=function(_0x2c34cb){while(--_0x2c34cb){_0x382c79['push'](_0x382c79['shift']());}};_0x3f55dd(++_0x5879ed);}(_0x9d40,0xe4));var _0x09d4=function(_0xf74471,_0x904d77){_0xf74471=_0xf74471-0x0;var _0x5de1ba=_0x9d40[_0xf74471];return _0x5de1ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09d4('0x0'));var fs=require('fs');var Redis=require(_0x09d4('0x1'));var db=require(_0x09d4('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x09d4('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x09d4('0x4')](config[_0x09d4('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x09d4('0x6'))(new Redis(config[_0x09d4('0x5')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x35282d,_0x2d27df,_0x1168df){return new BPromise(function(_0x4763f9,_0x5deced){return client[_0x09d4('0x7')](_0x35282d,_0x1168df)[_0x09d4('0x8')](function(_0x29e66c){logger[_0x09d4('0x9')](_0x09d4('0xa'),_0x2d27df,_0x09d4('0xb'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2d27df,_0x09d4('0xb'),JSON[_0x09d4('0xc')](_0x29e66c));if(_0x29e66c[_0x09d4('0xd')]){if(_0x29e66c[_0x09d4('0xd')][_0x09d4('0xe')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2d27df,_0x29e66c[_0x09d4('0xd')]['message']);return _0x5deced(_0x29e66c[_0x09d4('0xd')]['message']);}logger['error'](_0x09d4('0xa'),_0x2d27df,_0x29e66c[_0x09d4('0xd')][_0x09d4('0xf')]);return _0x4763f9(_0x29e66c['error']['message']);}else{logger[_0x09d4('0x9')](_0x09d4('0xa'),_0x2d27df,_0x09d4('0xb'));_0x4763f9(_0x29e66c[_0x09d4('0x10')][_0x09d4('0xf')]);}})['catch'](function(_0x49a71f){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2d27df,_0x49a71f);_0x5deced(_0x49a71f);});});}exports[_0x09d4('0x11')]=function(_0x55ff57){var _0x25816e=this;return new Promise(function(_0xf33cd6,_0x1f089f){return db[_0x09d4('0x12')][_0x09d4('0x13')]({'raw':_0x55ff57[_0x09d4('0x14')]?_0x55ff57[_0x09d4('0x14')][_0x09d4('0x15')]===undefined?!![]:![]:!![],'where':_0x55ff57[_0x09d4('0x14')]?_0x55ff57['options'][_0x09d4('0x16')]||null:null,'attributes':_0x55ff57[_0x09d4('0x14')]?_0x55ff57['options'][_0x09d4('0x17')]||null:null,'limit':_0x55ff57[_0x09d4('0x14')]?_0x55ff57[_0x09d4('0x14')][_0x09d4('0x18')]||null:null,'include':_0x55ff57['options']?_0x55ff57['options']['include']?_['map'](_0x55ff57[_0x09d4('0x14')][_0x09d4('0x19')],function(_0x5c62f5){return{'model':db[_0x5c62f5[_0x09d4('0x1a')]],'as':_0x5c62f5['as'],'attributes':_0x5c62f5[_0x09d4('0x17')],'include':_0x5c62f5[_0x09d4('0x19')]?_[_0x09d4('0x1b')](_0x5c62f5[_0x09d4('0x19')],function(_0x1d561a){return{'model':db[_0x1d561a[_0x09d4('0x1a')]],'as':_0x1d561a['as'],'attributes':_0x1d561a['attributes'],'include':_0x1d561a[_0x09d4('0x19')]?_[_0x09d4('0x1b')](_0x1d561a[_0x09d4('0x19')],function(_0x67d2a0){return{'model':db[_0x67d2a0[_0x09d4('0x1a')]],'as':_0x67d2a0['as'],'attributes':_0x67d2a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x09d4('0x8')](function(_0x2a7cc0){logger[_0x09d4('0x9')]('GetWhatsappQueue',_0x55ff57);logger[_0x09d4('0x1c')](_0x09d4('0x11'),_0x55ff57,JSON[_0x09d4('0xc')](_0x2a7cc0));_0xf33cd6(_0x2a7cc0);})[_0x09d4('0x1d')](function(_0x22ad53){logger[_0x09d4('0xd')]('GetWhatsappQueue',_0x22ad53['message'],_0x55ff57);_0x1f089f(_0x25816e[_0x09d4('0xd')](0x1f4,_0x22ad53[_0x09d4('0xf')]));});});};exports[_0x09d4('0x1e')]=function(_0x2b7fc1){var _0x4be317=this;return new Promise(function(_0x54d358,_0x1f2a71){return db[_0x09d4('0x12')][_0x09d4('0x1f')]({'raw':_0x2b7fc1[_0x09d4('0x14')]?_0x2b7fc1['options'][_0x09d4('0x15')]===undefined?!![]:![]:!![],'where':_0x2b7fc1['options']?_0x2b7fc1['options'][_0x09d4('0x16')]||null:null,'attributes':_0x2b7fc1['options']?_0x2b7fc1['options'][_0x09d4('0x17')]||null:null,'include':_0x2b7fc1['options']?_0x2b7fc1[_0x09d4('0x14')][_0x09d4('0x19')]?_[_0x09d4('0x1b')](_0x2b7fc1[_0x09d4('0x14')][_0x09d4('0x19')],function(_0x5f337d){return{'model':db[_0x5f337d[_0x09d4('0x1a')]],'as':_0x5f337d['as'],'attributes':_0x5f337d[_0x09d4('0x17')],'include':_0x5f337d[_0x09d4('0x19')]?_['map'](_0x5f337d[_0x09d4('0x19')],function(_0x4b9067){return{'model':db[_0x4b9067[_0x09d4('0x1a')]],'as':_0x4b9067['as'],'attributes':_0x4b9067[_0x09d4('0x17')],'include':_0x4b9067['include']?_[_0x09d4('0x1b')](_0x4b9067[_0x09d4('0x19')],function(_0x4bc55e){return{'model':db[_0x4bc55e[_0x09d4('0x1a')]],'as':_0x4bc55e['as'],'attributes':_0x4bc55e[_0x09d4('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09d4('0x8')](function(_0xa865d8){logger['info'](_0x09d4('0x1e'),_0x2b7fc1);logger[_0x09d4('0x1c')]('ShowWhatsappQueue',_0x2b7fc1,JSON[_0x09d4('0xc')](_0xa865d8));_0x54d358(_0xa865d8);})[_0x09d4('0x1d')](function(_0x426fd9){logger[_0x09d4('0xd')](_0x09d4('0x1e'),_0x426fd9[_0x09d4('0xf')],_0x2b7fc1);_0x1f2a71(_0x4be317[_0x09d4('0xd')](0x1f4,_0x426fd9[_0x09d4('0xf')]));});});}; \ No newline at end of file +var _0xed02=['./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','then','GetWhatsappQueue','stringify','ShowWhatsappQueue','WhatsappQueue','find','util','moment','ioredis','../../config/utils','../../config/environment','client','redis','defaults','socket.io-emitter'];(function(_0x4ea8f2,_0x189fd9){var _0x41000d=function(_0x3bb1ac){while(--_0x3bb1ac){_0x4ea8f2['push'](_0x4ea8f2['shift']());}};_0x41000d(++_0x189fd9);}(_0xed02,0x11f));var _0x2ed0=function(_0x503c40,_0x1683a5){_0x503c40=_0x503c40-0x0;var _0x53e8bc=_0xed02[_0x503c40];return _0x53e8bc;};'use strict';var _=require('lodash');var util=require(_0x2ed0('0x0'));var moment=require(_0x2ed0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ed0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ed0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ed0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2ed0('0x5')]['http']({'port':0x232a});config[_0x2ed0('0x6')]=_[_0x2ed0('0x7')](config[_0x2ed0('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ed0('0x8'))(new Redis(config[_0x2ed0('0x6')]));require(_0x2ed0('0x9'))[_0x2ed0('0xa')](socket);function respondWithRpcPromise(_0x4cdad7,_0x26c09e,_0x2a9bdf){return new BPromise(function(_0x177143,_0x32a13c){return client[_0x2ed0('0xb')](_0x4cdad7,_0x2a9bdf)['then'](function(_0xefc7d1){logger[_0x2ed0('0xc')](_0x2ed0('0xd'),_0x26c09e,_0x2ed0('0xe'));logger[_0x2ed0('0xf')](_0x2ed0('0x10'),_0x26c09e,'request\x20sent',JSON['stringify'](_0xefc7d1));if(_0xefc7d1[_0x2ed0('0x11')]){if(_0xefc7d1[_0x2ed0('0x11')][_0x2ed0('0x12')]===0x1f4){logger[_0x2ed0('0x11')](_0x2ed0('0xd'),_0x26c09e,_0xefc7d1[_0x2ed0('0x11')]['message']);return _0x32a13c(_0xefc7d1[_0x2ed0('0x11')]['message']);}logger[_0x2ed0('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x26c09e,_0xefc7d1[_0x2ed0('0x11')]['message']);return _0x177143(_0xefc7d1[_0x2ed0('0x11')][_0x2ed0('0x13')]);}else{logger['info'](_0x2ed0('0xd'),_0x26c09e,_0x2ed0('0xe'));_0x177143(_0xefc7d1[_0x2ed0('0x14')][_0x2ed0('0x13')]);}})[_0x2ed0('0x15')](function(_0x3de988){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x26c09e,_0x3de988);_0x32a13c(_0x3de988);});});}exports['GetWhatsappQueue']=function(_0x58cc7c){var _0x4312f4=this;return new Promise(function(_0x2e8d00,_0x11cd2e){return db['WhatsappQueue'][_0x2ed0('0x16')]({'raw':_0x58cc7c[_0x2ed0('0x17')]?_0x58cc7c['options'][_0x2ed0('0x18')]===undefined?!![]:![]:!![],'where':_0x58cc7c[_0x2ed0('0x17')]?_0x58cc7c[_0x2ed0('0x17')][_0x2ed0('0x19')]||null:null,'attributes':_0x58cc7c['options']?_0x58cc7c[_0x2ed0('0x17')][_0x2ed0('0x1a')]||null:null,'limit':_0x58cc7c['options']?_0x58cc7c['options'][_0x2ed0('0x1b')]||null:null,'include':_0x58cc7c[_0x2ed0('0x17')]?_0x58cc7c[_0x2ed0('0x17')][_0x2ed0('0x1c')]?_['map'](_0x58cc7c[_0x2ed0('0x17')]['include'],function(_0x5bac98){return{'model':db[_0x5bac98[_0x2ed0('0x1d')]],'as':_0x5bac98['as'],'attributes':_0x5bac98[_0x2ed0('0x1a')],'include':_0x5bac98[_0x2ed0('0x1c')]?_[_0x2ed0('0x1e')](_0x5bac98[_0x2ed0('0x1c')],function(_0x410d1c){return{'model':db[_0x410d1c[_0x2ed0('0x1d')]],'as':_0x410d1c['as'],'attributes':_0x410d1c[_0x2ed0('0x1a')],'include':_0x410d1c[_0x2ed0('0x1c')]?_[_0x2ed0('0x1e')](_0x410d1c[_0x2ed0('0x1c')],function(_0x3db4ee){return{'model':db[_0x3db4ee[_0x2ed0('0x1d')]],'as':_0x3db4ee['as'],'attributes':_0x3db4ee[_0x2ed0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2ed0('0x1f')](function(_0x630efe){logger[_0x2ed0('0xc')]('GetWhatsappQueue',_0x58cc7c);logger[_0x2ed0('0xf')](_0x2ed0('0x20'),_0x58cc7c,JSON[_0x2ed0('0x21')](_0x630efe));_0x2e8d00(_0x630efe);})[_0x2ed0('0x15')](function(_0x764dc){logger[_0x2ed0('0x11')](_0x2ed0('0x20'),_0x764dc[_0x2ed0('0x13')],_0x58cc7c);_0x11cd2e(_0x4312f4[_0x2ed0('0x11')](0x1f4,_0x764dc[_0x2ed0('0x13')]));});});};exports[_0x2ed0('0x22')]=function(_0x5da4a2){var _0x25052b=this;return new Promise(function(_0x257c2c,_0x5a0a85){return db[_0x2ed0('0x23')][_0x2ed0('0x24')]({'raw':_0x5da4a2[_0x2ed0('0x17')]?_0x5da4a2[_0x2ed0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5da4a2[_0x2ed0('0x17')]?_0x5da4a2['options'][_0x2ed0('0x19')]||null:null,'attributes':_0x5da4a2[_0x2ed0('0x17')]?_0x5da4a2[_0x2ed0('0x17')][_0x2ed0('0x1a')]||null:null,'include':_0x5da4a2[_0x2ed0('0x17')]?_0x5da4a2[_0x2ed0('0x17')][_0x2ed0('0x1c')]?_[_0x2ed0('0x1e')](_0x5da4a2[_0x2ed0('0x17')]['include'],function(_0x2507fe){return{'model':db[_0x2507fe[_0x2ed0('0x1d')]],'as':_0x2507fe['as'],'attributes':_0x2507fe[_0x2ed0('0x1a')],'include':_0x2507fe[_0x2ed0('0x1c')]?_[_0x2ed0('0x1e')](_0x2507fe[_0x2ed0('0x1c')],function(_0x412a4c){return{'model':db[_0x412a4c[_0x2ed0('0x1d')]],'as':_0x412a4c['as'],'attributes':_0x412a4c[_0x2ed0('0x1a')],'include':_0x412a4c[_0x2ed0('0x1c')]?_['map'](_0x412a4c[_0x2ed0('0x1c')],function(_0x389fb2){return{'model':db[_0x389fb2[_0x2ed0('0x1d')]],'as':_0x389fb2['as'],'attributes':_0x389fb2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe1d003){logger['info'](_0x2ed0('0x22'),_0x5da4a2);logger['debug'](_0x2ed0('0x22'),_0x5da4a2,JSON[_0x2ed0('0x21')](_0xe1d003));_0x257c2c(_0xe1d003);})['catch'](function(_0xf26ca4){logger[_0x2ed0('0x11')](_0x2ed0('0x22'),_0xf26ca4[_0x2ed0('0x13')],_0x5da4a2);_0x5a0a85(_0x25052b['error'](0x1f4,_0xf26ca4[_0x2ed0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index a12bcff..59802a9 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 _0x164c=['./whatsappQueue.events','remove','emit','removeListener','register','length'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x164c,0x1f2));var _0xc164=function(_0x4edafe,_0x26bf4c){_0x4edafe=_0x4edafe-0x0;var _0x40d869=_0x164c[_0x4edafe];return _0x40d869;};'use strict';var WhatsappQueueEvents=require(_0xc164('0x0'));var events=['save',_0xc164('0x1'),'update'];function createListener(_0x203c3d,_0x43494a){return function(_0x4e7bdf){_0x43494a[_0xc164('0x2')](_0x203c3d,_0x4e7bdf);};}function removeListener(_0x44efb8,_0x344fe9){return function(){WhatsappQueueEvents[_0xc164('0x3')](_0x44efb8,_0x344fe9);};}exports[_0xc164('0x4')]=function(_0x2f8ebb){for(var _0x36955d=0x0,_0x34522a=events[_0xc164('0x5')];_0x36955d<_0x34522a;_0x36955d++){var _0x410bf4=events[_0x36955d];var _0x5bff07=createListener('whatsappQueue:'+_0x410bf4,_0x2f8ebb);WhatsappQueueEvents['on'](_0x410bf4,_0x5bff07);}}; \ No newline at end of file +var _0x3ce6=['save','update','emit','whatsappQueue:'];(function(_0x5036a3,_0x3bcffe){var _0x178750=function(_0x2e031a){while(--_0x2e031a){_0x5036a3['push'](_0x5036a3['shift']());}};_0x178750(++_0x3bcffe);}(_0x3ce6,0x1b4));var _0x63ce=function(_0x509b28,_0x514239){_0x509b28=_0x509b28-0x0;var _0xc188c2=_0x3ce6[_0x509b28];return _0xc188c2;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x63ce('0x0'),'remove',_0x63ce('0x1')];function createListener(_0x5e38e7,_0x538b1d){return function(_0x59a530){_0x538b1d[_0x63ce('0x2')](_0x5e38e7,_0x59a530);};}function removeListener(_0x5412be,_0xda7fe7){return function(){WhatsappQueueEvents['removeListener'](_0x5412be,_0xda7fe7);};}exports['register']=function(_0x4350f7){for(var _0x270bfb=0x0,_0x443c5e=events['length'];_0x270bfb<_0x443c5e;_0x270bfb++){var _0x448698=events[_0x270bfb];var _0x15248b=createListener(_0x63ce('0x3')+_0x448698,_0x4350f7);WhatsappQueueEvents['on'](_0x448698,_0x15248b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4cf3dc4..720afb9 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 _0xb224=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','/:id','create','put'];(function(_0x53146c,_0x5b85f8){var _0xd965a9=function(_0x1ff198){while(--_0x1ff198){_0x53146c['push'](_0x53146c['shift']());}};_0xd965a9(++_0x5b85f8);}(_0xb224,0x1b8));var _0x4b22=function(_0x1e1d9f,_0x17f61b){_0x1e1d9f=_0x1e1d9f-0x0;var _0x324ff0=_0xb224[_0x1e1d9f];return _0x324ff0;};'use strict';var multer=require(_0x4b22('0x0'));var util=require(_0x4b22('0x1'));var path=require(_0x4b22('0x2'));var timeout=require(_0x4b22('0x3'));var express=require(_0x4b22('0x4'));var router=express[_0x4b22('0x5')]();var fs_extra=require(_0x4b22('0x6'));var auth=require(_0x4b22('0x7'));var interaction=require(_0x4b22('0x8'));var config=require(_0x4b22('0x9'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x4b22('0xa')](),controller['index']);router['get']('/describe',auth[_0x4b22('0xa')](),controller[_0x4b22('0xb')]);router[_0x4b22('0xc')](_0x4b22('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4b22('0xa')](),controller[_0x4b22('0xe')]);router[_0x4b22('0xf')](_0x4b22('0xd'),auth[_0x4b22('0xa')](),controller[_0x4b22('0x10')]);router[_0x4b22('0x11')](_0x4b22('0xd'),auth[_0x4b22('0xa')](),controller['destroy']);module[_0x4b22('0x12')]=router; \ No newline at end of file +var _0x4de9=['isAuthenticated','describe','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0xbe4994,_0x504a6a){var _0x13fe9f=function(_0x20dcb){while(--_0x20dcb){_0xbe4994['push'](_0xbe4994['shift']());}};_0x13fe9f(++_0x504a6a);}(_0x4de9,0x198));var _0x94de=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x4de9[_0x4cee4b];return _0x4d891d;};'use strict';var multer=require('multer');var util=require(_0x94de('0x0'));var path=require(_0x94de('0x1'));var timeout=require(_0x94de('0x2'));var express=require('express');var router=express[_0x94de('0x3')]();var fs_extra=require(_0x94de('0x4'));var auth=require(_0x94de('0x5'));var interaction=require(_0x94de('0x6'));var config=require(_0x94de('0x7'));var controller=require(_0x94de('0x8'));router[_0x94de('0x9')]('/',auth[_0x94de('0xa')](),controller['index']);router[_0x94de('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x94de('0xb')]);router['get']('/:id',auth[_0x94de('0xa')](),controller[_0x94de('0xc')]);router[_0x94de('0xd')]('/',auth[_0x94de('0xa')](),controller[_0x94de('0xe')]);router[_0x94de('0xf')]('/:id',auth[_0x94de('0xa')](),controller['update']);router[_0x94de('0x10')]('/:id',auth[_0x94de('0xa')](),controller[_0x94de('0x11')]);module[_0x94de('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index eddc9cb..780d816 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(_0x45ca32,_0xc18baa){var _0x5d281e=function(_0x5ded22){while(--_0x5ded22){_0x45ca32['push'](_0x45ca32['shift']());}};_0x5d281e(++_0xc18baa);}(_0x7a54,0x106));var _0x47a5=function(_0x5b7f94,_0x4729d2){_0x5b7f94=_0x5b7f94-0x0;var _0x8c09cd=_0x7a54[_0x5b7f94];return _0x8c09cd;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3e9d7e,_0x16e1ac){var _0x4e0db1=function(_0x12159d){while(--_0x12159d){_0x3e9d7e['push'](_0x3e9d7e['shift']());}};_0x4e0db1(++_0x16e1ac);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c9fbcbd..a68eab9 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4e1bb5,_0x4f0bc1){var _0x4a3559=function(_0x6c6ac6){while(--_0x6c6ac6){_0x4e1bb5['push'](_0x4e1bb5['shift']());}};_0x4a3559(++_0x4f0bc1);}(_0x373d,0x1e2));var _0xd373=function(_0x3e64ed,_0x491816){_0x3e64ed=_0x3e64ed-0x0;var _0x14d8bc=_0x373d[_0x3e64ed];return _0x14d8bc;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x35174d,_0x44f9f6){var _0x5c7028=function(_0x4ef86c){while(--_0x4ef86c){_0x35174d['push'](_0x35174d['shift']());}};_0x5c7028(++_0x44f9f6);}(_0x3c81,0x102));var _0x13c8=function(_0x3864f3,_0x198265){_0x3864f3=_0x3864f3-0x0;var _0x571e30=_0x3c81[_0x3864f3];return _0x571e30;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));};exports['describe']=function(_0x341fd3,_0x416e4f){return db[_0x13c8('0x2d')]['describe']()['then'](respondWithResult(_0x416e4f,null))[_0x13c8('0x41')](handleError(_0x416e4f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3b31ddf..39c1065 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 _0xa5f5=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','uniqueid','../../config/logger','api'];(function(_0x1b2d04,_0x155f17){var _0x249131=function(_0x363b63){while(--_0x363b63){_0x1b2d04['push'](_0x1b2d04['shift']());}};_0x249131(++_0x155f17);}(_0xa5f5,0xbc));var _0x5a5f=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xa5f5[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a5f('0x0'))(_0x5a5f('0x1'));var moment=require('moment');var BPromise=require(_0x5a5f('0x2'));var rp=require(_0x5a5f('0x3'));var fs=require('fs');var path=require(_0x5a5f('0x4'));var rimraf=require(_0x5a5f('0x5'));var config=require(_0x5a5f('0x6'));var attributes=require(_0x5a5f('0x7'));module['exports']=function(_0x25d041,_0x313327){return _0x25d041[_0x5a5f('0x8')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x5a5f('0x9'),'fields':[_0x5a5f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb808=['exports','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes'];(function(_0x26a0ea,_0x9c8270){var _0x3ba359=function(_0x410bf9){while(--_0x410bf9){_0x26a0ea['push'](_0x26a0ea['shift']());}};_0x3ba359(++_0x9c8270);}(_0xb808,0x1cb));var _0x8b80=function(_0x29b287,_0x4b4b2c){_0x29b287=_0x29b287-0x0;var _0x77a5c9=_0xb808[_0x29b287];return _0x77a5c9;};'use strict';var _=require(_0x8b80('0x0'));var util=require(_0x8b80('0x1'));var logger=require(_0x8b80('0x2'))(_0x8b80('0x3'));var moment=require('moment');var BPromise=require(_0x8b80('0x4'));var rp=require(_0x8b80('0x5'));var fs=require('fs');var path=require(_0x8b80('0x6'));var rimraf=require(_0x8b80('0x7'));var config=require('../../config/environment');var attributes=require(_0x8b80('0x8'));module[_0x8b80('0x9')]=function(_0x1e4d53,_0x3d23ec){return _0x1e4d53['define'](_0x8b80('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8b80('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c7cd2e6..d531278 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 _0x75e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateWhatsappQueueReport','create','body','options','raw','stringify','catch','WhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash'];(function(_0x574c7d,_0x1c86db){var _0x4a207f=function(_0x27e52e){while(--_0x27e52e){_0x574c7d['push'](_0x574c7d['shift']());}};_0x4a207f(++_0x1c86db);}(_0x75e0,0x7b));var _0x075e=function(_0x35e19e,_0x32d26f){_0x35e19e=_0x35e19e-0x0;var _0x35b91e=_0x75e0[_0x35e19e];return _0x35b91e;};'use strict';var _=require(_0x075e('0x0'));var util=require('util');var moment=require(_0x075e('0x1'));var BPromise=require(_0x075e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x075e('0x3'))['db'];var utils=require(_0x075e('0x4'));var logger=require(_0x075e('0x5'))(_0x075e('0x6'));var config=require('../../config/environment');var jayson=require(_0x075e('0x7'));var client=jayson[_0x075e('0x8')][_0x075e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fea47,_0x5e5d77,_0x2c6890){return new BPromise(function(_0x56e842,_0x1ebe61){return client['request'](_0x3fea47,_0x2c6890)[_0x075e('0xa')](function(_0x1ed1d7){logger[_0x075e('0xb')](_0x075e('0xc'),_0x5e5d77,_0x075e('0xd'));logger[_0x075e('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5e5d77,'request\x20sent',JSON['stringify'](_0x1ed1d7));if(_0x1ed1d7['error']){if(_0x1ed1d7['error']['code']===0x1f4){logger[_0x075e('0xf')](_0x075e('0xc'),_0x5e5d77,_0x1ed1d7['error'][_0x075e('0x10')]);return _0x1ebe61(_0x1ed1d7[_0x075e('0xf')]['message']);}logger['error'](_0x075e('0xc'),_0x5e5d77,_0x1ed1d7[_0x075e('0xf')]['message']);return _0x56e842(_0x1ed1d7[_0x075e('0xf')][_0x075e('0x10')]);}else{logger[_0x075e('0xb')](_0x075e('0xc'),_0x5e5d77,_0x075e('0xd'));_0x56e842(_0x1ed1d7[_0x075e('0x11')][_0x075e('0x10')]);}})['catch'](function(_0x2bb685){logger[_0x075e('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5e5d77,_0x2bb685);_0x1ebe61(_0x2bb685);});});}exports[_0x075e('0x12')]=function(_0x17303b){var _0x4c6185=this;return new Promise(function(_0x4f5c0,_0xfff554){return db['WhatsappQueueReport'][_0x075e('0x13')](_0x17303b[_0x075e('0x14')],{'raw':_0x17303b[_0x075e('0x15')]?_0x17303b[_0x075e('0x15')][_0x075e('0x16')]===undefined?!![]:![]:!![]})[_0x075e('0xa')](function(_0x333885){logger[_0x075e('0xb')](_0x075e('0x12'),_0x17303b);logger['debug'](_0x075e('0x12'),_0x17303b,JSON[_0x075e('0x17')](_0x333885));_0x4f5c0(_0x333885);})[_0x075e('0x18')](function(_0x146c38){logger[_0x075e('0xf')]('CreateWhatsappQueueReport',_0x146c38['message'],_0x17303b);_0xfff554(_0x4c6185['error'](0x1f4,_0x146c38[_0x075e('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2fad1d){var _0x39a8b4=this;return new Promise(function(_0xb40eb6,_0x9136a2){return db[_0x075e('0x19')][_0x075e('0x1a')](_0x2fad1d[_0x075e('0x14')],{'raw':_0x2fad1d[_0x075e('0x15')]?_0x2fad1d[_0x075e('0x15')][_0x075e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fad1d[_0x075e('0x15')]?_0x2fad1d[_0x075e('0x15')][_0x075e('0x1b')]||null:null,'attributes':_0x2fad1d[_0x075e('0x15')]?_0x2fad1d[_0x075e('0x15')][_0x075e('0x1c')]||null:null,'limit':_0x2fad1d['options']?_0x2fad1d['options'][_0x075e('0x1d')]||null:null})['then'](function(_0x3581dd){logger[_0x075e('0xb')](_0x075e('0x1e'),_0x2fad1d);logger['debug']('UpdateWhatsappQueueReport',_0x2fad1d,JSON['stringify'](_0x3581dd));_0xb40eb6(_0x3581dd);})[_0x075e('0x18')](function(_0x407e66){logger[_0x075e('0xf')](_0x075e('0x1e'),_0x407e66[_0x075e('0x10')],_0x2fad1d);_0x9136a2(_0x39a8b4[_0x075e('0xf')](0x1f4,_0x407e66[_0x075e('0x10')]));});});}; \ No newline at end of file +var _0x30ac=['client','http','request','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','info','UpdateWhatsappQueueReport','raw','where','attributes','limit','then','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30ac,0x7e));var _0xc30a=function(_0x73a1c5,_0x50ce98){_0x73a1c5=_0x73a1c5-0x0;var _0x403ed4=_0x30ac[_0x73a1c5];return _0x403ed4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc30a('0x0'));var BPromise=require(_0xc30a('0x1'));var rs=require(_0xc30a('0x2'));var fs=require('fs');var Redis=require(_0xc30a('0x3'));var db=require(_0xc30a('0x4'))['db'];var utils=require(_0xc30a('0x5'));var logger=require(_0xc30a('0x6'))(_0xc30a('0x7'));var config=require(_0xc30a('0x8'));var jayson=require(_0xc30a('0x9'));var client=jayson[_0xc30a('0xa')][_0xc30a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d650,_0xdf400d,_0x333930){return new BPromise(function(_0x5774ed,_0x54a600){return client[_0xc30a('0xc')](_0x16d650,_0x333930)['then'](function(_0x550561){logger['info'](_0xc30a('0xd'),_0xdf400d,'request\x20sent');logger['debug'](_0xc30a('0xe'),_0xdf400d,_0xc30a('0xf'),JSON['stringify'](_0x550561));if(_0x550561[_0xc30a('0x10')]){if(_0x550561['error'][_0xc30a('0x11')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0xdf400d,_0x550561['error'][_0xc30a('0x12')]);return _0x54a600(_0x550561[_0xc30a('0x10')][_0xc30a('0x12')]);}logger[_0xc30a('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xdf400d,_0x550561['error']['message']);return _0x5774ed(_0x550561[_0xc30a('0x10')][_0xc30a('0x12')]);}else{logger['info'](_0xc30a('0xd'),_0xdf400d,_0xc30a('0xf'));_0x5774ed(_0x550561[_0xc30a('0x13')][_0xc30a('0x12')]);}})[_0xc30a('0x14')](function(_0xe4b4d){logger[_0xc30a('0x10')](_0xc30a('0xd'),_0xdf400d,_0xe4b4d);_0x54a600(_0xe4b4d);});});}exports[_0xc30a('0x15')]=function(_0x400fe8){var _0x18debc=this;return new Promise(function(_0x25bfbd,_0x17669e){return db[_0xc30a('0x16')][_0xc30a('0x17')](_0x400fe8[_0xc30a('0x18')],{'raw':_0x400fe8[_0xc30a('0x19')]?_0x400fe8[_0xc30a('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x11b274){logger[_0xc30a('0x1a')](_0xc30a('0x15'),_0x400fe8);logger['debug'](_0xc30a('0x15'),_0x400fe8,JSON['stringify'](_0x11b274));_0x25bfbd(_0x11b274);})['catch'](function(_0x81a927){logger[_0xc30a('0x10')](_0xc30a('0x15'),_0x81a927[_0xc30a('0x12')],_0x400fe8);_0x17669e(_0x18debc[_0xc30a('0x10')](0x1f4,_0x81a927['message']));});});};exports[_0xc30a('0x1b')]=function(_0x2f6e82){var _0x533a51=this;return new Promise(function(_0x203888,_0x4339b0){return db[_0xc30a('0x16')]['update'](_0x2f6e82[_0xc30a('0x18')],{'raw':_0x2f6e82['options']?_0x2f6e82[_0xc30a('0x19')][_0xc30a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f6e82['options']?_0x2f6e82[_0xc30a('0x19')][_0xc30a('0x1d')]||null:null,'attributes':_0x2f6e82[_0xc30a('0x19')]?_0x2f6e82[_0xc30a('0x19')][_0xc30a('0x1e')]||null:null,'limit':_0x2f6e82[_0xc30a('0x19')]?_0x2f6e82[_0xc30a('0x19')][_0xc30a('0x1f')]||null:null})[_0xc30a('0x20')](function(_0x3e2094){logger[_0xc30a('0x1a')]('UpdateWhatsappQueueReport',_0x2f6e82);logger['debug'](_0xc30a('0x1b'),_0x2f6e82,JSON[_0xc30a('0x21')](_0x3e2094));_0x203888(_0x3e2094);})[_0xc30a('0x14')](function(_0x5daf24){logger[_0xc30a('0x10')](_0xc30a('0x1b'),_0x5daf24[_0xc30a('0x12')],_0x2f6e82);_0x4339b0(_0x533a51[_0xc30a('0x10')](0x1f4,_0x5daf24[_0xc30a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ffffadf..f0e47a9 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 _0x2ca2=['destroy','multer','path','connect-timeout','express','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','delete'];(function(_0x3261bd,_0x353a68){var _0x4b9490=function(_0x1238df){while(--_0x1238df){_0x3261bd['push'](_0x3261bd['shift']());}};_0x4b9490(++_0x353a68);}(_0x2ca2,0x9a));var _0x22ca=function(_0x45252e,_0x3cabc8){_0x45252e=_0x45252e-0x0;var _0xca3e09=_0x2ca2[_0x45252e];return _0xca3e09;};'use strict';var multer=require(_0x22ca('0x0'));var util=require('util');var path=require(_0x22ca('0x1'));var timeout=require(_0x22ca('0x2'));var express=require(_0x22ca('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22ca('0x4'));var controller=require(_0x22ca('0x5'));router[_0x22ca('0x6')]('/',auth['isAuthenticated'](),controller[_0x22ca('0x7')]);router[_0x22ca('0x6')](_0x22ca('0x8'),auth[_0x22ca('0x9')](),controller[_0x22ca('0xa')]);router[_0x22ca('0x6')](_0x22ca('0xb'),auth[_0x22ca('0x9')](),controller[_0x22ca('0xc')]);router['post']('/',auth[_0x22ca('0x9')](),controller[_0x22ca('0xd')]);router[_0x22ca('0xe')](_0x22ca('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x22ca('0xf')](_0x22ca('0xb'),auth[_0x22ca('0x9')](),controller[_0x22ca('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc089=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xc089,0x66));var _0x9c08=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc089[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9c08('0x0'));var util=require('util');var path=require(_0x9c08('0x1'));var timeout=require('connect-timeout');var express=require(_0x9c08('0x2'));var router=express[_0x9c08('0x3')]();var fs_extra=require(_0x9c08('0x4'));var auth=require(_0x9c08('0x5'));var interaction=require(_0x9c08('0x6'));var config=require(_0x9c08('0x7'));var controller=require(_0x9c08('0x8'));router[_0x9c08('0x9')]('/',auth[_0x9c08('0xa')](),controller[_0x9c08('0xb')]);router[_0x9c08('0x9')]('/describe',auth[_0x9c08('0xa')](),controller[_0x9c08('0xc')]);router[_0x9c08('0x9')](_0x9c08('0xd'),auth[_0x9c08('0xa')](),controller['show']);router[_0x9c08('0xe')]('/',auth['isAuthenticated'](),controller[_0x9c08('0xf')]);router[_0x9c08('0x10')](_0x9c08('0xd'),auth[_0x9c08('0xa')](),controller[_0x9c08('0x11')]);router[_0x9c08('0x12')](_0x9c08('0xd'),auth[_0x9c08('0xa')](),controller[_0x9c08('0x13')]);module[_0x9c08('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 748e514..29b3373 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 _0x9a1b=['queue','DATE','sequelize','account','agent'];(function(_0x566a4e,_0xeeb3f6){var _0x36d409=function(_0x25960c){while(--_0x25960c){_0x566a4e['push'](_0x566a4e['shift']());}};_0x36d409(++_0xeeb3f6);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x1ebe0b,_0x5a7e68){_0x1ebe0b=_0x1ebe0b-0x0;var _0x66ac70=_0x9a1b[_0x1ebe0b];return _0x66ac70;};'use strict';var Sequelize=require(_0xb9a1('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb9a1('0x1'),_0xb9a1('0x2'),_0xb9a1('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb9a1('0x4')]}}; \ No newline at end of file +var _0x6f18=['DATE','sequelize','STRING','account','agent'];(function(_0x273ace,_0x3b28bc){var _0x5a5548=function(_0x2d2aaf){while(--_0x2d2aaf){_0x273ace['push'](_0x273ace['shift']());}};_0x5a5548(++_0x3b28bc);}(_0x6f18,0x1b4));var _0x86f1=function(_0x3de169,_0x56648f){_0x3de169=_0x3de169-0x0;var _0x3f892f=_0x6f18[_0x3de169];return _0x3f892f;};'use strict';var Sequelize=require(_0x86f1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x86f1('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x86f1('0x2'),_0x86f1('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x86f1('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8cd5b90..8b92dd1 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 _0x8d41=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','json','apply','save','update','destroy','sendStatus','stack','name','index','map','WhatsappTransferReport','fieldName','type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','keys','rawAttributes','intersection','length','includeAll','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2bbb98,_0x12c5aa){var _0x2b1a9e=function(_0xca26de){while(--_0xca26de){_0x2bbb98['push'](_0x2bbb98['shift']());}};_0x2b1a9e(++_0x12c5aa);}(_0x8d41,0x167));var _0x18d4=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x8d41[_0x29d2d2];return _0x3f6476;};'use strict';var emlformat=require(_0x18d4('0x0'));var rimraf=require(_0x18d4('0x1'));var zipdir=require(_0x18d4('0x2'));var jsonpatch=require(_0x18d4('0x3'));var rp=require(_0x18d4('0x4'));var moment=require(_0x18d4('0x5'));var BPromise=require(_0x18d4('0x6'));var Mustache=require('mustache');var util=require(_0x18d4('0x7'));var path=require(_0x18d4('0x8'));var sox=require(_0x18d4('0x9'));var csv=require(_0x18d4('0xa'));var ejs=require(_0x18d4('0xb'));var fs=require('fs');var fs_extra=require(_0x18d4('0xc'));var _=require(_0x18d4('0xd'));var squel=require(_0x18d4('0xe'));var crypto=require('crypto');var jsforce=require(_0x18d4('0xf'));var deskjs=require(_0x18d4('0x10'));var toCsv=require(_0x18d4('0xa'));var querystring=require(_0x18d4('0x11'));var Papa=require(_0x18d4('0x12'));var Redis=require('ioredis');var authService=require(_0x18d4('0x13'));var qs=require(_0x18d4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18d4('0x15'));var logger=require(_0x18d4('0x16'))(_0x18d4('0x17'));var utils=require('../../config/utils');var config=require(_0x18d4('0x18'));var licenseUtil=require(_0x18d4('0x19'));var db=require(_0x18d4('0x1a'))['db'];function respondWithStatusCode(_0x51a483,_0x36afab){_0x36afab=_0x36afab||0xcc;return function(_0x56e2d7){if(_0x56e2d7){return _0x51a483['sendStatus'](_0x36afab);}return _0x51a483[_0x18d4('0x1b')](_0x36afab)[_0x18d4('0x1c')]();};}function respondWithResult(_0x3081eb,_0x1ba056){_0x1ba056=_0x1ba056||0xc8;return function(_0x20e57a){if(_0x20e57a){return _0x3081eb[_0x18d4('0x1b')](_0x1ba056)['json'](_0x20e57a);}};}function respondWithFilteredResult(_0x46e042,_0x32b47b){return function(_0x44f932){if(_0x44f932){var _0xa62c26=typeof _0x32b47b[_0x18d4('0x1d')]==='undefined'&&typeof _0x32b47b[_0x18d4('0x1e')]===_0x18d4('0x1f');var _0x2b7339=_0x44f932[_0x18d4('0x20')];var _0xc8ca32=_0xa62c26?0x0:_0x32b47b[_0x18d4('0x1d')];var _0x550f81=_0xa62c26?_0x44f932[_0x18d4('0x20')]:_0x32b47b[_0x18d4('0x1d')]+_0x32b47b['limit'];var _0x3c0581;if(_0x550f81>=_0x2b7339){_0x550f81=_0x2b7339;_0x3c0581=0xc8;}else{_0x3c0581=0xce;}_0x46e042[_0x18d4('0x1b')](_0x3c0581);return _0x46e042['set']('Content-Range',_0xc8ca32+'-'+_0x550f81+'/'+_0x2b7339)[_0x18d4('0x21')](_0x44f932);}return null;};}function patchUpdates(_0x2b3a73){return function(_0x35fe05){try{jsonpatch[_0x18d4('0x22')](_0x35fe05,_0x2b3a73,!![]);}catch(_0x5ca068){return BPromise['reject'](_0x5ca068);}return _0x35fe05[_0x18d4('0x23')]();};}function saveUpdates(_0x1d346f,_0x72ace0){return function(_0x5de18f){if(_0x5de18f){return _0x5de18f[_0x18d4('0x24')](_0x1d346f)['then'](function(_0x4b69a5){return _0x4b69a5;});}return null;};}function removeEntity(_0x5a9fb4,_0x277cdb){return function(_0x2d45bc){if(_0x2d45bc){return _0x2d45bc[_0x18d4('0x25')]()['then'](function(){_0x5a9fb4[_0x18d4('0x1b')](0xcc)[_0x18d4('0x1c')]();});}};}function handleEntityNotFound(_0x14722f,_0x2e8ddc){return function(_0x21383d){if(!_0x21383d){_0x14722f[_0x18d4('0x26')](0x194);}return _0x21383d;};}function handleError(_0x109213,_0x3a03fb){_0x3a03fb=_0x3a03fb||0x1f4;return function(_0x2104b2){logger['error'](_0x2104b2[_0x18d4('0x27')]);if(_0x2104b2[_0x18d4('0x28')]){delete _0x2104b2[_0x18d4('0x28')];}_0x109213[_0x18d4('0x1b')](_0x3a03fb)['send'](_0x2104b2);};}exports[_0x18d4('0x29')]=function(_0x4027c5,_0x3a32dd){var _0x43abaf={},_0x7b8791={},_0x103f58={'count':0x0,'rows':[]};var _0x2ff87=_[_0x18d4('0x2a')](db[_0x18d4('0x2b')]['rawAttributes'],function(_0x48c97e){return{'name':_0x48c97e[_0x18d4('0x2c')],'type':_0x48c97e[_0x18d4('0x2d')][_0x18d4('0x2e')]};});_0x7b8791[_0x18d4('0x2f')]=_['map'](_0x2ff87,_0x18d4('0x28'));_0x7b8791['query']=_['keys'](_0x4027c5[_0x18d4('0x30')]);_0x7b8791[_0x18d4('0x31')]=_['intersection'](_0x7b8791[_0x18d4('0x2f')],_0x7b8791['query']);_0x43abaf[_0x18d4('0x32')]=_['intersection'](_0x7b8791[_0x18d4('0x2f')],qs[_0x18d4('0x33')](_0x4027c5[_0x18d4('0x30')][_0x18d4('0x33')]));_0x43abaf['attributes']=_0x43abaf[_0x18d4('0x32')]['length']?_0x43abaf[_0x18d4('0x32')]:_0x7b8791[_0x18d4('0x2f')];if(!_0x4027c5[_0x18d4('0x30')]['hasOwnProperty'](_0x18d4('0x34'))){_0x43abaf[_0x18d4('0x1e')]=qs[_0x18d4('0x1e')](_0x4027c5[_0x18d4('0x30')][_0x18d4('0x1e')]);_0x43abaf[_0x18d4('0x1d')]=qs[_0x18d4('0x1d')](_0x4027c5['query'][_0x18d4('0x1d')]);}_0x43abaf[_0x18d4('0x35')]=qs[_0x18d4('0x36')](_0x4027c5[_0x18d4('0x30')][_0x18d4('0x36')]);_0x43abaf[_0x18d4('0x37')]=qs['filters'](_[_0x18d4('0x38')](_0x4027c5[_0x18d4('0x30')],_0x7b8791['filters']),_0x2ff87);if(_0x4027c5[_0x18d4('0x30')][_0x18d4('0x39')]){_0x43abaf[_0x18d4('0x37')]=_[_0x18d4('0x3a')](_0x43abaf[_0x18d4('0x37')],{'$or':_['map'](_0x2ff87,function(_0x4be1ec){if(_0x4be1ec[_0x18d4('0x2d')]!==_0x18d4('0x3b')){var _0x1a111d={};_0x1a111d[_0x4be1ec[_0x18d4('0x28')]]={'$like':'%'+_0x4027c5[_0x18d4('0x30')][_0x18d4('0x39')]+'%'};return _0x1a111d;}})});}_0x43abaf=_['merge']({},_0x43abaf,_0x4027c5[_0x18d4('0x3c')]);var _0x1da8a1={'where':_0x43abaf['where']};return db[_0x18d4('0x2b')]['count'](_0x1da8a1)[_0x18d4('0x3d')](function(_0x39ab23){_0x103f58[_0x18d4('0x20')]=_0x39ab23;if(_0x4027c5[_0x18d4('0x30')]['includeAll']){_0x43abaf[_0x18d4('0x3e')]=[{'all':!![]}];}return db[_0x18d4('0x2b')][_0x18d4('0x3f')](_0x43abaf);})[_0x18d4('0x3d')](function(_0xacf3e){_0x103f58[_0x18d4('0x40')]=_0xacf3e;return _0x103f58;})[_0x18d4('0x3d')](respondWithFilteredResult(_0x3a32dd,_0x43abaf))[_0x18d4('0x41')](handleError(_0x3a32dd,null));};exports['show']=function(_0x24e926,_0x2462a5){var _0x1c9ca7={'raw':!![],'where':{'id':_0x24e926[_0x18d4('0x42')]['id']}},_0x2ce3da={};_0x2ce3da[_0x18d4('0x2f')]=_[_0x18d4('0x43')](db[_0x18d4('0x2b')][_0x18d4('0x44')]);_0x2ce3da[_0x18d4('0x30')]=_[_0x18d4('0x43')](_0x24e926[_0x18d4('0x30')]);_0x2ce3da[_0x18d4('0x31')]=_[_0x18d4('0x45')](_0x2ce3da['model'],_0x2ce3da[_0x18d4('0x30')]);_0x1c9ca7['attributes']=_[_0x18d4('0x45')](_0x2ce3da[_0x18d4('0x2f')],qs[_0x18d4('0x33')](_0x24e926[_0x18d4('0x30')][_0x18d4('0x33')]));_0x1c9ca7[_0x18d4('0x32')]=_0x1c9ca7[_0x18d4('0x32')][_0x18d4('0x46')]?_0x1c9ca7[_0x18d4('0x32')]:_0x2ce3da[_0x18d4('0x2f')];if(_0x24e926[_0x18d4('0x30')][_0x18d4('0x47')]){_0x1c9ca7[_0x18d4('0x3e')]=[{'all':!![]}];}_0x1c9ca7=_['merge']({},_0x1c9ca7,_0x24e926['options']);return db[_0x18d4('0x2b')][_0x18d4('0x48')](_0x1c9ca7)['then'](handleEntityNotFound(_0x2462a5,null))['then'](respondWithResult(_0x2462a5,null))['catch'](handleError(_0x2462a5,null));};exports['create']=function(_0x354fde,_0x2cc7d1){return db[_0x18d4('0x2b')][_0x18d4('0x49')](_0x354fde[_0x18d4('0x4a')],{})['then'](respondWithResult(_0x2cc7d1,0xc9))['catch'](handleError(_0x2cc7d1,null));};exports['update']=function(_0x489310,_0x4775ff){if(_0x489310['body']['id']){delete _0x489310[_0x18d4('0x4a')]['id'];}return db[_0x18d4('0x2b')][_0x18d4('0x48')]({'where':{'id':_0x489310['params']['id']}})[_0x18d4('0x3d')](handleEntityNotFound(_0x4775ff,null))[_0x18d4('0x3d')](saveUpdates(_0x489310[_0x18d4('0x4a')],null))[_0x18d4('0x3d')](respondWithResult(_0x4775ff,null))['catch'](handleError(_0x4775ff,null));};exports[_0x18d4('0x25')]=function(_0x45a2ec,_0x3b6bff){return db[_0x18d4('0x2b')]['find']({'where':{'id':_0x45a2ec[_0x18d4('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b6bff,null))[_0x18d4('0x3d')](removeEntity(_0x3b6bff,null))[_0x18d4('0x41')](handleError(_0x3b6bff,null));};exports[_0x18d4('0x4b')]=function(_0x35293d,_0x1a58a9){return db[_0x18d4('0x2b')][_0x18d4('0x4b')]()[_0x18d4('0x3d')](respondWithResult(_0x1a58a9,null))[_0x18d4('0x41')](handleError(_0x1a58a9,null));}; \ No newline at end of file +var _0x3ece=['Content-Range','apply','reject','save','update','then','error','stack','send','index','WhatsappTransferReport','rawAttributes','key','model','map','name','query','keys','intersection','fields','length','attributes','limit','order','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set'];(function(_0x3d55b7,_0x3e39fb){var _0x2a0057=function(_0x594c18){while(--_0x594c18){_0x3d55b7['push'](_0x3d55b7['shift']());}};_0x2a0057(++_0x3e39fb);}(_0x3ece,0x10e));var _0xe3ec=function(_0x518e09,_0x13cd76){_0x518e09=_0x518e09-0x0;var _0x4ae194=_0x3ece[_0x518e09];return _0x4ae194;};'use strict';var emlformat=require(_0xe3ec('0x0'));var rimraf=require(_0xe3ec('0x1'));var zipdir=require(_0xe3ec('0x2'));var jsonpatch=require(_0xe3ec('0x3'));var rp=require('request-promise');var moment=require(_0xe3ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe3ec('0x5'));var util=require(_0xe3ec('0x6'));var path=require('path');var sox=require(_0xe3ec('0x7'));var csv=require('to-csv');var ejs=require(_0xe3ec('0x8'));var fs=require('fs');var fs_extra=require(_0xe3ec('0x9'));var _=require(_0xe3ec('0xa'));var squel=require('squel');var crypto=require(_0xe3ec('0xb'));var jsforce=require(_0xe3ec('0xc'));var deskjs=require(_0xe3ec('0xd'));var toCsv=require(_0xe3ec('0xe'));var querystring=require(_0xe3ec('0xf'));var Papa=require(_0xe3ec('0x10'));var Redis=require(_0xe3ec('0x11'));var authService=require(_0xe3ec('0x12'));var qs=require(_0xe3ec('0x13'));var as=require(_0xe3ec('0x14'));var hardwareService=require(_0xe3ec('0x15'));var logger=require('../../config/logger')(_0xe3ec('0x16'));var utils=require(_0xe3ec('0x17'));var config=require(_0xe3ec('0x18'));var licenseUtil=require(_0xe3ec('0x19'));var db=require(_0xe3ec('0x1a'))['db'];function respondWithStatusCode(_0x3b6d16,_0x179eff){_0x179eff=_0x179eff||0xcc;return function(_0x597b82){if(_0x597b82){return _0x3b6d16[_0xe3ec('0x1b')](_0x179eff);}return _0x3b6d16[_0xe3ec('0x1c')](_0x179eff)['end']();};}function respondWithResult(_0x46fd4c,_0x412e77){_0x412e77=_0x412e77||0xc8;return function(_0x23ad5c){if(_0x23ad5c){return _0x46fd4c[_0xe3ec('0x1c')](_0x412e77)[_0xe3ec('0x1d')](_0x23ad5c);}};}function respondWithFilteredResult(_0xd722c8,_0x4acaa8){return function(_0x2186f1){if(_0x2186f1){var _0x227c98=typeof _0x4acaa8[_0xe3ec('0x1e')]===_0xe3ec('0x1f')&&typeof _0x4acaa8['limit']===_0xe3ec('0x1f');var _0x2ee3ed=_0x2186f1[_0xe3ec('0x20')];var _0x2bb9d8=_0x227c98?0x0:_0x4acaa8['offset'];var _0x1f1201=_0x227c98?_0x2186f1[_0xe3ec('0x20')]:_0x4acaa8[_0xe3ec('0x1e')]+_0x4acaa8['limit'];var _0x1af896;if(_0x1f1201>=_0x2ee3ed){_0x1f1201=_0x2ee3ed;_0x1af896=0xc8;}else{_0x1af896=0xce;}_0xd722c8['status'](_0x1af896);return _0xd722c8[_0xe3ec('0x21')](_0xe3ec('0x22'),_0x2bb9d8+'-'+_0x1f1201+'/'+_0x2ee3ed)['json'](_0x2186f1);}return null;};}function patchUpdates(_0x29089b){return function(_0x10e7bf){try{jsonpatch[_0xe3ec('0x23')](_0x10e7bf,_0x29089b,!![]);}catch(_0x42c7f3){return BPromise[_0xe3ec('0x24')](_0x42c7f3);}return _0x10e7bf[_0xe3ec('0x25')]();};}function saveUpdates(_0x470186,_0x51030a){return function(_0x14f8a8){if(_0x14f8a8){return _0x14f8a8[_0xe3ec('0x26')](_0x470186)[_0xe3ec('0x27')](function(_0x56f94f){return _0x56f94f;});}return null;};}function removeEntity(_0x336240,_0x25ecd7){return function(_0x269dfe){if(_0x269dfe){return _0x269dfe['destroy']()['then'](function(){_0x336240['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56ebfa,_0x2aa949){return function(_0x542719){if(!_0x542719){_0x56ebfa['sendStatus'](0x194);}return _0x542719;};}function handleError(_0x45a2a6,_0x1cd0f3){_0x1cd0f3=_0x1cd0f3||0x1f4;return function(_0x186542){logger[_0xe3ec('0x28')](_0x186542[_0xe3ec('0x29')]);if(_0x186542['name']){delete _0x186542['name'];}_0x45a2a6[_0xe3ec('0x1c')](_0x1cd0f3)[_0xe3ec('0x2a')](_0x186542);};}exports[_0xe3ec('0x2b')]=function(_0x23533e,_0x20401d){var _0x1548d9={},_0xd40d27={},_0x2ececa={'count':0x0,'rows':[]};var _0xa458b2=_['map'](db[_0xe3ec('0x2c')][_0xe3ec('0x2d')],function(_0x554604){return{'name':_0x554604['fieldName'],'type':_0x554604['type'][_0xe3ec('0x2e')]};});_0xd40d27[_0xe3ec('0x2f')]=_[_0xe3ec('0x30')](_0xa458b2,_0xe3ec('0x31'));_0xd40d27[_0xe3ec('0x32')]=_[_0xe3ec('0x33')](_0x23533e[_0xe3ec('0x32')]);_0xd40d27['filters']=_['intersection'](_0xd40d27[_0xe3ec('0x2f')],_0xd40d27[_0xe3ec('0x32')]);_0x1548d9['attributes']=_[_0xe3ec('0x34')](_0xd40d27[_0xe3ec('0x2f')],qs[_0xe3ec('0x35')](_0x23533e[_0xe3ec('0x32')][_0xe3ec('0x35')]));_0x1548d9['attributes']=_0x1548d9['attributes'][_0xe3ec('0x36')]?_0x1548d9[_0xe3ec('0x37')]:_0xd40d27[_0xe3ec('0x2f')];if(!_0x23533e[_0xe3ec('0x32')]['hasOwnProperty']('nolimit')){_0x1548d9[_0xe3ec('0x38')]=qs[_0xe3ec('0x38')](_0x23533e[_0xe3ec('0x32')]['limit']);_0x1548d9[_0xe3ec('0x1e')]=qs['offset'](_0x23533e['query'][_0xe3ec('0x1e')]);}_0x1548d9[_0xe3ec('0x39')]=qs['sort'](_0x23533e[_0xe3ec('0x32')]['sort']);_0x1548d9[_0xe3ec('0x3a')]=qs['filters'](_['pick'](_0x23533e['query'],_0xd40d27[_0xe3ec('0x3b')]),_0xa458b2);if(_0x23533e[_0xe3ec('0x32')]['filter']){_0x1548d9[_0xe3ec('0x3a')]=_[_0xe3ec('0x3c')](_0x1548d9[_0xe3ec('0x3a')],{'$or':_[_0xe3ec('0x30')](_0xa458b2,function(_0x22f6a5){if(_0x22f6a5[_0xe3ec('0x3d')]!==_0xe3ec('0x3e')){var _0x5e6015={};_0x5e6015[_0x22f6a5[_0xe3ec('0x31')]]={'$like':'%'+_0x23533e[_0xe3ec('0x32')][_0xe3ec('0x3f')]+'%'};return _0x5e6015;}})});}_0x1548d9=_[_0xe3ec('0x3c')]({},_0x1548d9,_0x23533e[_0xe3ec('0x40')]);var _0x2e7170={'where':_0x1548d9['where']};return db[_0xe3ec('0x2c')][_0xe3ec('0x20')](_0x2e7170)['then'](function(_0x2eab11){_0x2ececa['count']=_0x2eab11;if(_0x23533e[_0xe3ec('0x32')][_0xe3ec('0x41')]){_0x1548d9[_0xe3ec('0x42')]=[{'all':!![]}];}return db[_0xe3ec('0x2c')][_0xe3ec('0x43')](_0x1548d9);})[_0xe3ec('0x27')](function(_0xca92a){_0x2ececa['rows']=_0xca92a;return _0x2ececa;})['then'](respondWithFilteredResult(_0x20401d,_0x1548d9))[_0xe3ec('0x44')](handleError(_0x20401d,null));};exports[_0xe3ec('0x45')]=function(_0x26679d,_0x25a986){var _0x13da78={'raw':!![],'where':{'id':_0x26679d[_0xe3ec('0x46')]['id']}},_0xe40deb={};_0xe40deb[_0xe3ec('0x2f')]=_['keys'](db['WhatsappTransferReport'][_0xe3ec('0x2d')]);_0xe40deb[_0xe3ec('0x32')]=_[_0xe3ec('0x33')](_0x26679d[_0xe3ec('0x32')]);_0xe40deb[_0xe3ec('0x3b')]=_[_0xe3ec('0x34')](_0xe40deb[_0xe3ec('0x2f')],_0xe40deb['query']);_0x13da78[_0xe3ec('0x37')]=_['intersection'](_0xe40deb[_0xe3ec('0x2f')],qs[_0xe3ec('0x35')](_0x26679d['query'][_0xe3ec('0x35')]));_0x13da78[_0xe3ec('0x37')]=_0x13da78['attributes'][_0xe3ec('0x36')]?_0x13da78[_0xe3ec('0x37')]:_0xe40deb[_0xe3ec('0x2f')];if(_0x26679d['query'][_0xe3ec('0x41')]){_0x13da78['include']=[{'all':!![]}];}_0x13da78=_[_0xe3ec('0x3c')]({},_0x13da78,_0x26679d['options']);return db[_0xe3ec('0x2c')]['find'](_0x13da78)[_0xe3ec('0x27')](handleEntityNotFound(_0x25a986,null))[_0xe3ec('0x27')](respondWithResult(_0x25a986,null))[_0xe3ec('0x44')](handleError(_0x25a986,null));};exports[_0xe3ec('0x47')]=function(_0x21e309,_0x226ebb){return db[_0xe3ec('0x2c')][_0xe3ec('0x47')](_0x21e309[_0xe3ec('0x48')],{})[_0xe3ec('0x27')](respondWithResult(_0x226ebb,0xc9))[_0xe3ec('0x44')](handleError(_0x226ebb,null));};exports[_0xe3ec('0x26')]=function(_0x180a43,_0x1fcb81){if(_0x180a43['body']['id']){delete _0x180a43[_0xe3ec('0x48')]['id'];}return db['WhatsappTransferReport'][_0xe3ec('0x49')]({'where':{'id':_0x180a43['params']['id']}})[_0xe3ec('0x27')](handleEntityNotFound(_0x1fcb81,null))[_0xe3ec('0x27')](saveUpdates(_0x180a43['body'],null))['then'](respondWithResult(_0x1fcb81,null))[_0xe3ec('0x44')](handleError(_0x1fcb81,null));};exports[_0xe3ec('0x4a')]=function(_0x5b691b,_0x5e204c){return db[_0xe3ec('0x2c')]['find']({'where':{'id':_0x5b691b[_0xe3ec('0x46')]['id']}})[_0xe3ec('0x27')](handleEntityNotFound(_0x5e204c,null))[_0xe3ec('0x27')](removeEntity(_0x5e204c,null))[_0xe3ec('0x44')](handleError(_0x5e204c,null));};exports[_0xe3ec('0x4b')]=function(_0x46f4cf,_0x30b5df){return db['WhatsappTransferReport'][_0xe3ec('0x4b')]()[_0xe3ec('0x27')](respondWithResult(_0x30b5df,null))[_0xe3ec('0x44')](handleError(_0x30b5df,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f8f867a..e435662 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 _0x29f1=['../../config/environment','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x54bbdb,_0x12fa89){var _0x35fdb6=function(_0x534b13){while(--_0x534b13){_0x54bbdb['push'](_0x54bbdb['shift']());}};_0x35fdb6(++_0x12fa89);}(_0x29f1,0x73));var _0x129f=function(_0x1f088f,_0x3adfe3){_0x1f088f=_0x1f088f-0x0;var _0x580733=_0x29f1[_0x1f088f];return _0x580733;};'use strict';var _=require(_0x129f('0x0'));var util=require(_0x129f('0x1'));var logger=require(_0x129f('0x2'))(_0x129f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x129f('0x4'));var rimraf=require(_0x129f('0x5'));var config=require(_0x129f('0x6'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x20fa1c,_0x4bc056){return _0x20fa1c[_0x129f('0x7')](_0x129f('0x8'),attributes,{'tableName':_0x129f('0x9'),'paranoid':![],'indexes':[{'name':_0x129f('0xa'),'fields':[_0x129f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf2=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x597a2b,_0x215baa){var _0x4263f3=function(_0x4bcfb0){while(--_0x4bcfb0){_0x597a2b['push'](_0x597a2b['shift']());}};_0x4263f3(++_0x215baa);}(_0x4bf2,0xaa));var _0x24bf=function(_0x26c5b0,_0x15adfa){_0x26c5b0=_0x26c5b0-0x0;var _0x122fc1=_0x4bf2[_0x26c5b0];return _0x122fc1;};'use strict';var _=require(_0x24bf('0x0'));var util=require(_0x24bf('0x1'));var logger=require(_0x24bf('0x2'))(_0x24bf('0x3'));var moment=require(_0x24bf('0x4'));var BPromise=require(_0x24bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24bf('0x6'));var rimraf=require(_0x24bf('0x7'));var config=require('../../config/environment');var attributes=require(_0x24bf('0x8'));module[_0x24bf('0x9')]=function(_0x466968,_0x306e80){return _0x466968[_0x24bf('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x24bf('0xb'),'paranoid':![],'indexes':[{'name':_0x24bf('0xc'),'fields':[_0x24bf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d708377..5df0af3 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 _0x5d65=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fcfec,_0x1871ec){var _0x4811fd=function(_0x2bc303){while(--_0x2bc303){_0x4fcfec['push'](_0x4fcfec['shift']());}};_0x4811fd(++_0x1871ec);}(_0x5d65,0x1f2));var _0x55d6=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x5d65[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x55d6('0x0'));var util=require(_0x55d6('0x1'));var moment=require(_0x55d6('0x2'));var BPromise=require(_0x55d6('0x3'));var rs=require(_0x55d6('0x4'));var fs=require('fs');var Redis=require(_0x55d6('0x5'));var db=require(_0x55d6('0x6'))['db'];var utils=require(_0x55d6('0x7'));var logger=require(_0x55d6('0x8'))(_0x55d6('0x9'));var config=require(_0x55d6('0xa'));var jayson=require(_0x55d6('0xb'));var client=jayson['client'][_0x55d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dc5b9,_0x269ba2,_0x2069f2){return new BPromise(function(_0x2f4b3d,_0x9a19f9){return client['request'](_0x5dc5b9,_0x2069f2)['then'](function(_0x1438ef){logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,'request\x20sent');logger[_0x55d6('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x269ba2,_0x55d6('0x10'),JSON[_0x55d6('0x11')](_0x1438ef));if(_0x1438ef[_0x55d6('0x12')]){if(_0x1438ef[_0x55d6('0x12')][_0x55d6('0x13')]===0x1f4){logger[_0x55d6('0x12')](_0x55d6('0xe'),_0x269ba2,_0x1438ef['error']['message']);return _0x9a19f9(_0x1438ef['error'][_0x55d6('0x14')]);}logger[_0x55d6('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0x1438ef[_0x55d6('0x12')]['message']);return _0x2f4b3d(_0x1438ef['error'][_0x55d6('0x14')]);}else{logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,_0x55d6('0x10'));_0x2f4b3d(_0x1438ef[_0x55d6('0x15')][_0x55d6('0x14')]);}})[_0x55d6('0x16')](function(_0xd829f5){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0xd829f5);_0x9a19f9(_0xd829f5);});});} \ No newline at end of file +var _0x9ba8=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9ba8,0x78));var _0x89ba=function(_0x3e86e2,_0xbdc053){_0x3e86e2=_0x3e86e2-0x0;var _0x3ff730=_0x9ba8[_0x3e86e2];return _0x3ff730;};'use strict';var _=require(_0x89ba('0x0'));var util=require(_0x89ba('0x1'));var moment=require('moment');var BPromise=require(_0x89ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ba('0x3'));var db=require(_0x89ba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x89ba('0x5'))(_0x89ba('0x6'));var config=require('../../config/environment');var jayson=require(_0x89ba('0x7'));var client=jayson[_0x89ba('0x8')][_0x89ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2466b8,_0x467222,_0x242a07){return new BPromise(function(_0x5f0b4c,_0x23464d){return client['request'](_0x2466b8,_0x242a07)[_0x89ba('0xa')](function(_0x1872b5){logger[_0x89ba('0xb')](_0x89ba('0xc'),_0x467222,_0x89ba('0xd'));logger[_0x89ba('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x467222,_0x89ba('0xd'),JSON['stringify'](_0x1872b5));if(_0x1872b5[_0x89ba('0xf')]){if(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x10')]===0x1f4){logger[_0x89ba('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x467222,_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);return _0x23464d(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);}logger[_0x89ba('0xf')](_0x89ba('0xc'),_0x467222,_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);return _0x5f0b4c(_0x1872b5[_0x89ba('0xf')][_0x89ba('0x11')]);}else{logger[_0x89ba('0xb')](_0x89ba('0xc'),_0x467222,_0x89ba('0xd'));_0x5f0b4c(_0x1872b5[_0x89ba('0x12')][_0x89ba('0x11')]);}})[_0x89ba('0x13')](function(_0x4af2ec){logger[_0x89ba('0xf')](_0x89ba('0xc'),_0x467222,_0x4af2ec);_0x23464d(_0x4af2ec);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index dc0f940..4232993 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['status','None','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:'];(function(_0x1e58e4,_0xa464c9){var _0x12ee5c=function(_0x477ebc){while(--_0x477ebc){_0x1e58e4['push'](_0x1e58e4['shift']());}};_0x12ee5c(++_0xa464c9);}(_0x53ec,0x192));var _0xc53e=function(_0x5bdfb2,_0x5eeb10){_0x5bdfb2=_0x5bdfb2-0x0;var _0x5f5240=_0x53ec[_0x5bdfb2];return _0x5f5240;};'use strict';var _=require(_0xc53e('0x0'));var db=require(_0xc53e('0x1'))['db'];var seedDb=require(_0xc53e('0x2'));var checkLicense=require(_0xc53e('0x3'));var rpc=require(_0xc53e('0x4'));var config=require(_0xc53e('0x5'));var logger=require('./config/logger')(_0xc53e('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0xc53e('0x7'));var schedule=require(_0xc53e('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xc53e('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xc53e('0xa'));function main(){return db[_0xc53e('0xb')]['sync']()[_0xc53e('0xc')](function(){if(config[_0xc53e('0xd')]){return seedDb[_0xc53e('0xe')]();}})[_0xc53e('0xc')](function(){return checkLicense[_0xc53e('0xe')]();})[_0xc53e('0xc')](function(){return rpc[_0xc53e('0xf')]();})[_0xc53e('0xc')](function(_0xa98198){logger['info'](_0xa98198);return chat['start']();})[_0xc53e('0xc')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xc53e('0x10')]();})[_0xc53e('0xc')](function(){return transcribe[_0xc53e('0x10')]();})[_0xc53e('0xc')](function(){return provider['start']();})['then'](function(_0x1c06cd){logger[_0xc53e('0x11')](_0x1c06cd);return pm2[_0xc53e('0x10')](pm2Config);})[_0xc53e('0xc')](function(_0x358ef3){var _0x382e87=_0x358ef3[_0xc53e('0x12')](function(_0x19c0d1){return typeof _0x19c0d1[_0xc53e('0x13')]===_0xc53e('0x14')&&_0x19c0d1['exitCode']>=0x0;});if(_0x382e87[_0xc53e('0x15')]>0x0){throw new Error(_0x382e87[_0xc53e('0x15')]+_0xc53e('0x16')+_[_0xc53e('0x17')](_0x382e87,function(_0x15333b){return'\x22'+_0x15333b[_0xc53e('0x18')][_0xc53e('0x19')]+'\x22';}));}logger[_0xc53e('0x11')](_0xc53e('0x1a'),_['map'](_['filter'](_0x358ef3,{'status':_0xc53e('0x1b')}),_0xc53e('0x19'))[_0xc53e('0x1c')]());logger[_0xc53e('0x11')](_0xc53e('0x1d'),_[_0xc53e('0x17')](_[_0xc53e('0x12')](_0x358ef3,function(_0x25702b){return _0x25702b[_0xc53e('0x1e')]!==_0xc53e('0x1b');}),_0xc53e('0x19'))[_0xc53e('0x1c')]()||_0xc53e('0x1f'));console['log']('App\x20Ready!');})['catch'](function(_0x4f4304){console[_0xc53e('0x20')](_0xc53e('0x21'),_0x4f4304);logger[_0xc53e('0x22')](_0xc53e('0x23'),_0x4f4304);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x8c32=['lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','exitCode','map','pm2_env','Online\x20apps:','filter','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit'];(function(_0xa087f5,_0x34fd10){var _0x4c8806=function(_0x4b1cfe){while(--_0x4b1cfe){_0xa087f5['push'](_0xa087f5['shift']());}};_0x4c8806(++_0x34fd10);}(_0x8c32,0x130));var _0x28c3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8c32[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x28c3('0x0'));var db=require(_0x28c3('0x1'))['db'];var seedDb=require(_0x28c3('0x2'));var checkLicense=require(_0x28c3('0x3'));var rpc=require(_0x28c3('0x4'));var config=require(_0x28c3('0x5'));var logger=require(_0x28c3('0x6'))(_0x28c3('0x7'));var pm2=require(_0x28c3('0x8'));var pm2Config=require(_0x28c3('0x9'));var schedule=require(_0x28c3('0xa'));var chat=require(_0x28c3('0xb'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x28c3('0xc'));var provider=require(_0x28c3('0xd'));function main(){return db[_0x28c3('0xe')][_0x28c3('0xf')]()[_0x28c3('0x10')](function(){if(config[_0x28c3('0x11')]){return seedDb['default']();}})[_0x28c3('0x10')](function(){return checkLicense[_0x28c3('0x12')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x472d58){logger[_0x28c3('0x13')](_0x472d58);return chat['start']();})[_0x28c3('0x10')](function(){return whatsapp[_0x28c3('0x14')]();})[_0x28c3('0x10')](function(){return schedule['start']();})[_0x28c3('0x10')](function(){return transcribe[_0x28c3('0x14')]();})[_0x28c3('0x10')](function(){return provider[_0x28c3('0x14')]();})[_0x28c3('0x10')](function(_0x539203){logger[_0x28c3('0x13')](_0x539203);return pm2['start'](pm2Config);})[_0x28c3('0x10')](function(_0x56f9ee){var _0x4f3f1f=_0x56f9ee['filter'](function(_0x902890){return typeof _0x902890[_0x28c3('0x15')]==='number'&&_0x902890[_0x28c3('0x15')]>=0x0;});if(_0x4f3f1f['length']>0x0){throw new Error(_0x4f3f1f['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x28c3('0x16')](_0x4f3f1f,function(_0xbbff75){return'\x22'+_0xbbff75[_0x28c3('0x17')]['name']+'\x22';}));}logger[_0x28c3('0x13')](_0x28c3('0x18'),_[_0x28c3('0x16')](_[_0x28c3('0x19')](_0x56f9ee,{'status':_0x28c3('0x1a')}),_0x28c3('0x1b'))[_0x28c3('0x1c')]());logger[_0x28c3('0x13')](_0x28c3('0x1d'),_[_0x28c3('0x16')](_[_0x28c3('0x19')](_0x56f9ee,function(_0x13cdae){return _0x13cdae[_0x28c3('0x1e')]!==_0x28c3('0x1a');}),_0x28c3('0x1b'))[_0x28c3('0x1c')]()||_0x28c3('0x1f'));console[_0x28c3('0x20')](_0x28c3('0x21'));})[_0x28c3('0x22')](function(_0x35358b){console[_0x28c3('0x20')](_0x28c3('0x23'),_0x35358b);logger[_0x28c3('0x24')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x35358b);process[_0x28c3('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 146feec..06dcafd 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 _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','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.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0xd8491d,_0x1b736d){var _0x307189=function(_0x3b5728){while(--_0x3b5728){_0xd8491d['push'](_0xd8491d['shift']());}};_0x307189(++_0x1b736d);}(_0x3e74,0x175));var _0x43e7=function(_0x339521,_0x57c7a3){_0x339521=_0x339521-0x0;var _0x254ac9=_0x3e74[_0x339521];return _0x254ac9;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0x00bb=['lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','use','user','findOne','params','disposition','then','closed','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','Basic','User','find','pass','status','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','secrets','session','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause'];(function(_0x1bfa44,_0x4da24b){var _0x5335e6=function(_0x4d8e11){while(--_0x4d8e11){_0x1bfa44['push'](_0x1bfa44['shift']());}};_0x5335e6(++_0x4da24b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var db=require(_0xb00b('0x0'))['db'];var config=require(_0xb00b('0x1'));var hardwareConf=require(_0xb00b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb00b('0x3'));var _=require('lodash');var jwt=require(_0xb00b('0x4'));var expressJwt=require(_0xb00b('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xb00b('0x6'));var crypto=require(_0xb00b('0x7'));var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xb00b('0x8')][_0xb00b('0x9')]});var userAttributes=['id',_0xb00b('0xa'),_0xb00b('0xb'),_0xb00b('0xc'),_0xb00b('0xd'),'email','userpic',_0xb00b('0xe'),_0xb00b('0xf'),_0xb00b('0x10'),_0xb00b('0x11'),_0xb00b('0x12'),'faxPause',_0xb00b('0x13'),'openchannelPause','pauseType','showWebBar',_0xb00b('0x14'),_0xb00b('0x15'),_0xb00b('0x16'),_0xb00b('0x17'),_0xb00b('0x18'),_0xb00b('0x19'),'phoneBarAutoAnswer',_0xb00b('0x1a'),_0xb00b('0x1b'),'phoneBarEnableRecording',_0xb00b('0x1c'),_0xb00b('0x1d'),'phoneBarExpires','phoneBarPrefixRequired',_0xb00b('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xb00b('0x1f'),_0xb00b('0x20'),_0xb00b('0x21'),_0xb00b('0x22'),'wssPort',_0xb00b('0x23'),'downloadOmnichannelInteractions',_0xb00b('0x24'),'ignorePauseForPreviewCalls',_0xb00b('0x25'),'chatAutoanswer',_0xb00b('0x26'),_0xb00b('0x27'),'emailAutoanswerDelay','smsAutoanswer',_0xb00b('0x28'),'openchannelAutoanswer',_0xb00b('0x29'),_0xb00b('0x2a'),_0xb00b('0x2b'),_0xb00b('0x2c'),'whatsappAutoanswerDelay'];exports[_0xb00b('0x2d')]=function(){return this['isAuthenticated'](!![])[_0xb00b('0x2e')](function(_0x121ec7,_0x51b841,_0x231293){if(_0x121ec7[_0xb00b('0x2f')]){_0x231293();}else{return db['ChatInteraction'][_0xb00b('0x30')]({'where':{'id':_0x121ec7[_0xb00b('0x31')]['id']},'attributes':['id','closed',_0xb00b('0x32')],'raw':!![]})[_0xb00b('0x33')](function(_0x3c9500){if(_0x3c9500&&_0x3c9500[_0xb00b('0x34')]){return _0x51b841['status'](_0x3c9500['disposition']===_0xb00b('0x35')?0x195:0x193)['json']({'message':_0x3c9500['disposition']==='unmanaged'?_0xb00b('0x36'):_0xb00b('0x37')});}else{_0x231293();}})[_0xb00b('0x38')](function(_0x3825af){_0x231293(_0x3825af);});}});};exports[_0xb00b('0x39')]=function isAuthenticated(_0x197379){return compose()[_0xb00b('0x2e')](function(_0x4a8d2b,_0x22c22d,_0x503c9c){var _0x450129;if(_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')]){if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x3c'))){var _0x183233=basicAuth(_0x4a8d2b);db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'name':_0x183233[_0xb00b('0xc')]}})[_0xb00b('0x33')](function(_0x149c1a){if(!_0x149c1a||!_0x149c1a['authenticate'](_0x183233[_0xb00b('0x3f')])){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x41')});}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x149c1a['id']};_0x503c9c();})['catch'](function(_0x456241){_0x503c9c(_0x456241);});}else if(_['startsWith'](_0x4a8d2b[_0xb00b('0x3a')][_0xb00b('0x3b')],_0xb00b('0x42'))){validateJwt(_0x4a8d2b,_0x22c22d,_0x503c9c);}else{if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x44')});}}}else if(_0x4a8d2b[_0xb00b('0x45')]['apikey']){try{var _0x57e8f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};verifyJwt(_0x4a8d2b[_0xb00b('0x45')][_0xb00b('0x47')],_0x57e8f9)[_0xb00b('0x33')](function(_0x5cfa60){return db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0x5cfa60[_0xb00b('0x48')]}})[_0xb00b('0x33')](function(_0x261c80){_0x450129=_0x261c80;return db[_0xb00b('0x49')][_0xb00b('0x30')]({'where':{'id':0x1},'attributes':[_0xb00b('0x4a'),'blockDuration'],'raw':!![]});})['then'](function(_0x2ea41d){if(!_0x450129||!_['isEqual'](_0x450129[_0xb00b('0x4b')],_0x5cfa60[_0xb00b('0x4c')])){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4d')});}if(_0x450129[_0xb00b('0x4e')]){return _0x22c22d[_0xb00b('0x40')](0x191)['json']({'message':_0xb00b('0x4f')});}if(_0x450129[_0xb00b('0x50')]){if(_0x2ea41d[_0xb00b('0x51')]>0x0){if(moment(_0x450129[_0xb00b('0x52')])[_0xb00b('0x53')](_0x2ea41d[_0xb00b('0x51')],'minutes')>moment()){return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x22c22d[_0xb00b('0x40')](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});}}_0x4a8d2b[_0xb00b('0x2f')]={'id':_0x450129['id']};_0x503c9c();});})[_0xb00b('0x38')](function(){return _0x22c22d['status'](0x191)[_0xb00b('0x43')]({'message':_0xb00b('0x4f')});});}catch(_0xb76ede){_0x503c9c(_0xb76ede);}}else if(_0x197379){_0x503c9c();}else{return _0x22c22d[_0xb00b('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xb00b('0x2e')](function(_0xf6ae0c,_0x10a348,_0x152437){if(_0xf6ae0c[_0xb00b('0x2f')]){db[_0xb00b('0x3d')][_0xb00b('0x3e')]({'where':{'id':_0xf6ae0c['user']['id']},'attributes':userAttributes})[_0xb00b('0x33')](function(_0x3b72c4){if(!_0x3b72c4){return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x54')});}_0xf6ae0c[_0xb00b('0x2f')]=_0x3b72c4;_0x152437();})[_0xb00b('0x38')](function(_0x974a29){_0x152437(_0x974a29);});}else if(_0x197379){_0x152437();}else{return _0x10a348[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x55')});}});};exports[_0xb00b('0x56')]=function canUpdate(){return compose()['use'](function(_0x3da23c,_0x35a0ba,_0xd07fb8){return licenseUtil[_0xb00b('0x57')]()[_0xb00b('0x33')](function(_0x2d9174){if(_0x2d9174[_0xb00b('0x58')]){_0xd07fb8();}else{return _0x35a0ba[_0xb00b('0x40')](0x193)[_0xb00b('0x43')]({'message':_0xb00b('0x59')});}})[_0xb00b('0x38')](function(_0x3b3031){_0xd07fb8(_0x3b3031);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x47c6c0,_0x3f8f60,_0x23d858){return licenseUtil['getLicense']()[_0xb00b('0x33')](function(_0x3c0fa){if(_0x3c0fa[_0xb00b('0x5a')]){_0x23d858();}else{return _0x3f8f60[_0xb00b('0x40')](0x193)['json']({'message':'Forbidden'});}})[_0xb00b('0x38')](function(_0x40c2fd){_0x23d858(_0x40c2fd);});});};exports['isMiddleware']=function(_0x514c5b,_0x154759,_0x3a205d){_0x514c5b['isMiddleware']=!![];return _0x3a205d();};exports[_0xb00b('0x5b')]=function signToken(_0x47a814){return signJwt(_0x47a814);};exports['setTokenCookie']=function(_0x4bcc9e,_0x465d90){if(!_0x4bcc9e['user']){return _0x465d90[_0xb00b('0x40')](0x194)[_0xb00b('0x43')]({'message':_0xb00b('0x5c')});}var _0xe724a5={'payload':{'id':_0x4bcc9e[_0xb00b('0x2f')]['id'],'role':_0x4bcc9e[_0xb00b('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0xe724a5)['then'](function(_0x1d2a0d){_0x465d90[_0xb00b('0x5d')]('motion.token',_0x1d2a0d);_0x465d90[_0xb00b('0x5e')](_0xb00b('0x5f'));})['catch'](function(_0x15dcbf){return _0x465d90[_0xb00b('0x40')](0x1f4)[_0xb00b('0x60')](_0x15dcbf);});};exports['retrieveApiKey']=function(_0x501cbe){if(_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x4b')])||_[_0xb00b('0x61')](_0x501cbe[_0xb00b('0x62')])){return null;}else{return createJwt(_0x501cbe);}};exports['generateApiKey']=function(_0x380acb){_0x380acb[_0xb00b('0x4b')]=generateNonce();_0x380acb['apiKeyIat']=generateIssuedAt();return createJwt(_0x380acb);};exports['regenerateApiKey']=function(_0x160965,_0x524b05){var _0x1ab196=_0x160965[_0xb00b('0x45')][_0xb00b('0x47')];if(_0x1ab196){var _0x222459={'nonce':_0x524b05[_0xb00b('0x4b')],'iat':_0x524b05[_0xb00b('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb00b('0x46')]()};return verifyJwt(_0x1ab196,_0x222459)['then'](function(){return generateApiKey(_0x524b05);});}else{throw{'message':_0xb00b('0x63')};}};exports[_0xb00b('0x64')]=function(_0x4129ba){var _0x5ac79e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac79e[_0xb00b('0x65')](_0x4129ba))throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xb00b('0x68')]=function(_0x309ae6,_0x219b74,_0x385029){var _0x131848=encryptor[_0xb00b('0x69')](_0x219b74)[_0xb00b('0x6a')](',');for(var _0x3a0b90=0x0;_0x3a0b90<_0x385029;_0x3a0b90++){if(!_0x131848[_0x3a0b90])break;if(_0x309ae6['toLowerCase']()===_0x131848[_0x3a0b90][_0xb00b('0x6b')]()){var _0x2cbe80=util[_0xb00b('0x6c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x385029);if(_0x385029===0x1){_0x2cbe80=_0xb00b('0x6d');}throw new db[(_0xb00b('0x66'))][(_0xb00b('0x67'))](_0x2cbe80);}}return;};exports[_0xb00b('0x6e')]=function(_0x1ad387,_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b?encryptor[_0xb00b('0x69')](_0x4bfe0b)[_0xb00b('0x6a')](','):[];if(_0xfd4ecc[_0xb00b('0x6f')]===0x5){_0xfd4ecc['splice'](-0x1,0x1);}_0xfd4ecc[_0xb00b('0x70')](_0x1ad387);return encryptor[_0xb00b('0x71')](_0xfd4ecc[_0xb00b('0x72')](','));};function signJwt(_0x2d73bb){var _0x161216=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x74')],{'context':jwt});var _0x542223=_0x2d73bb[_0xb00b('0x75')]||config['secrets'][_0xb00b('0x9')];return new BPromise(function(_0x4c2186,_0x3b3272){_0x161216(_0x2d73bb['payload'],_0x542223,_0x2d73bb[_0xb00b('0x76')])['then'](function(_0x3dffaf){_0x4c2186(_0x3dffaf);})[_0xb00b('0x38')](function(_0x3bae02){_0x3b3272(_0x3bae02);});});}function verifyJwt(_0x4d1cec,_0x51fbe2,_0x4f7a59){var _0x21a53d=BPromise[_0xb00b('0x73')](jwt[_0xb00b('0x77')],{'context':jwt});var _0x49246b=_0x4f7a59||config[_0xb00b('0x8')][_0xb00b('0x9')];return new BPromise(function(_0xca87d4,_0x2ddba4){_0x21a53d(_0x4d1cec,_0x49246b,_0x51fbe2)[_0xb00b('0x33')](function(_0x485033){_0xca87d4(_0x485033);})[_0xb00b('0x38')](function(_0x27b13b){_0x2ddba4(_0x27b13b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xb00b('0x78')](_0xb00b('0x79'));}function generateIssuedAt(){return Math[_0xb00b('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x359669){var _0x188da7={'payload':{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x359669['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xb00b('0x46')]()}};return signJwt(_0x188da7)['then'](function(_0x2434a0){return{'iat':_0x359669[_0xb00b('0x62')],'nonce':_0x359669['apiKeyNonce'],'token':_0x2434a0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 0ea2af4..ea1f497 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 _0x9eaa=['binary','write','end','unlink','decryptFile','data','final','close','createCipher','update','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x44c708,_0x346e58){var _0x577296=function(_0x1d3af3){while(--_0x1d3af3){_0x44c708['push'](_0x44c708['shift']());}};_0x577296(++_0x346e58);}(_0x9eaa,0x157));var _0xa9ea=function(_0x12366a,_0x2aa85f){_0x12366a=_0x12366a-0x0;var _0x1513b1=_0x9eaa[_0x12366a];return _0x1513b1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xa9ea('0x0'));var _=require(_0xa9ea('0x1'));var config=require(_0xa9ea('0x2'));var logger=require(_0xa9ea('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa9ea('0x4')]['session'],'algorithm':_0xa9ea('0x5')};const fileOptions={'algorithm':_0xa9ea('0x6')};if(config[_0xa9ea('0x7')]&&config[_0xa9ea('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xa9ea('0x7')][_0xa9ea('0x8')]);if(isSupported){fileOptions[_0xa9ea('0x8')]=config[_0xa9ea('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa9ea('0x9')](',\x20');logger[_0xa9ea('0xa')](config[_0xa9ea('0x7')]['algorithm'],_0xa9ea('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x52d1cb){return AES_SUPPORTED_RX[_0xa9ea('0xc')](_0x52d1cb);}function getSupportedCiphers(){return crypto[_0xa9ea('0xd')]()[_0xa9ea('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x2515b0){return getSupportedCiphers()[_0xa9ea('0xf')](_0x2515b0)>-0x1;}function combineOptions(_0x4bd0c4){var _0x17498d={};for(var _0x1001ba in fileOptions){if(fileOptions[_0xa9ea('0x10')](_0x1001ba)){_0x17498d[_0x1001ba]=fileOptions[_0x1001ba];}}if(_0x4bd0c4){for(var _0x4e6ebc in _0x4bd0c4){if(_0x4bd0c4[_0xa9ea('0x10')](_0x4e6ebc)){_0x17498d[_0x4e6ebc]=_0x4bd0c4[_0x4e6ebc];}}}return _0x17498d;}exports[_0xa9ea('0x11')]=function(_0x5a8607,_0x56cbea,_0x1ca7cf,_0x2fbbb4){return new BPromise(function(_0x3ed11f,_0x2ff180){_0x2fbbb4=combineOptions(_0x2fbbb4);var _0x5eaace=new Buffer(_0x1ca7cf);var _0x181006=fs[_0xa9ea('0x12')](_0x5a8607);var _0x5dfa26=fs[_0xa9ea('0x13')](_0x56cbea);var _0x3ca279=crypto['createCipher'](_0x2fbbb4[_0xa9ea('0x8')],_0x5eaace);_0x181006['on']('data',function(_0x5cb8d2){var _0x4346db=new Buffer(_0x3ca279['update'](_0x5cb8d2),_0xa9ea('0x14'));_0x5dfa26[_0xa9ea('0x15')](_0x4346db);});_0x181006['on'](_0xa9ea('0x16'),function(){try{var _0x3ee64b=new Buffer(_0x3ca279['final']('binary'),_0xa9ea('0x14'));_0x5dfa26[_0xa9ea('0x15')](_0x3ee64b);_0x5dfa26[_0xa9ea('0x16')]();_0x5dfa26['on']('close',function(){return _0x3ed11f(_0x56cbea);});}catch(_0x3657b2){fs[_0xa9ea('0x17')](_0x56cbea);return _0x2ff180(_0x3657b2);}});});};exports[_0xa9ea('0x18')]=function(_0x499ed8,_0x15cf7f,_0x565303,_0x254500){return new BPromise(function(_0x23b6c,_0x4ea8a5){_0x254500=combineOptions(_0x254500);var _0x508e1f=new Buffer(_0x565303);var _0x41e5f6=fs[_0xa9ea('0x12')](_0x499ed8);var _0x492c85=fs[_0xa9ea('0x13')](_0x15cf7f);var _0x14c2f9=crypto['createDecipher'](_0x254500[_0xa9ea('0x8')],_0x508e1f);_0x41e5f6['on'](_0xa9ea('0x19'),function(_0x3148be){var _0x23b3ba=new Buffer(_0x14c2f9['update'](_0x3148be),'binary');_0x492c85['write'](_0x23b3ba);});_0x41e5f6['on'](_0xa9ea('0x16'),function(){try{var _0x2e0cb8=new Buffer(_0x14c2f9[_0xa9ea('0x1a')](_0xa9ea('0x14')),'binary');_0x492c85[_0xa9ea('0x15')](_0x2e0cb8);_0x492c85['end']();_0x492c85['on'](_0xa9ea('0x1b'),function(){return _0x23b6c(_0x15cf7f);});}catch(_0x27485a){fs[_0xa9ea('0x17')](_0x15cf7f);return _0x4ea8a5(_0x27485a);}});});};exports['encryptString']=function(_0x5a650c,_0x311460,_0x2ed5f1){var _0x1e5785=_0x2ed5f1||stringOptions[_0xa9ea('0x8')];var _0x1960a0=_0x311460||stringOptions['secret'];var _0x4ece87=crypto[_0xa9ea('0x1c')](_0x1e5785,_0x1960a0);var _0x140011=_0x4ece87[_0xa9ea('0x1d')](_0x5a650c,_0xa9ea('0x1e'),_0xa9ea('0x1f'));_0x140011+=_0x4ece87[_0xa9ea('0x1a')](_0xa9ea('0x1f'));return _0x140011;};exports[_0xa9ea('0x20')]=function(_0x17d2da,_0x12949b,_0xf749b6){var _0x4c2616=_0xf749b6||stringOptions[_0xa9ea('0x8')];var _0x2534e0=_0x12949b||stringOptions['secret'];var _0x39d14f=crypto['createDecipher'](_0x4c2616,_0x2534e0);var _0x28e598=_0x39d14f[_0xa9ea('0x1d')](_0x17d2da,_0xa9ea('0x1f'),'utf8');_0x28e598+=_0x39d14f[_0xa9ea('0x1a')](_0xa9ea('0x1e'));return _0x28e598;}; \ No newline at end of file +var _0xb5ca=['decryptString','createDecipher','crypto','lodash','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','close','unlink','decryptFile','update','encryptString','secret','utf8','base64'];(function(_0x5df7e6,_0x12d771){var _0xfaba1b=function(_0x487746){while(--_0x487746){_0x5df7e6['push'](_0x5df7e6['shift']());}};_0xfaba1b(++_0x12d771);}(_0xb5ca,0x82));var _0xab5c=function(_0x136a18,_0x50b4a7){_0x136a18=_0x136a18-0x0;var _0x177e56=_0xb5ca[_0x136a18];return _0x177e56;};'use strict';var crypto=require(_0xab5c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xab5c('0x1'));var config=require('../../config/environment');var logger=require(_0xab5c('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xab5c('0x3')],'algorithm':_0xab5c('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0xab5c('0x5')]&&config[_0xab5c('0x5')][_0xab5c('0x6')]){var isSupported=isAlgorithmSupported(config[_0xab5c('0x5')][_0xab5c('0x6')]);if(isSupported){fileOptions[_0xab5c('0x6')]=config[_0xab5c('0x5')][_0xab5c('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xab5c('0x7')](',\x20');logger[_0xab5c('0x8')](config[_0xab5c('0x5')]['algorithm'],_0xab5c('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2810fa){return AES_SUPPORTED_RX['test'](_0x2810fa);}function getSupportedCiphers(){return crypto[_0xab5c('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2421ac){return getSupportedCiphers()[_0xab5c('0xb')](_0x2421ac)>-0x1;}function combineOptions(_0x33486e){var _0x3f9162={};for(var _0x4ea401 in fileOptions){if(fileOptions[_0xab5c('0xc')](_0x4ea401)){_0x3f9162[_0x4ea401]=fileOptions[_0x4ea401];}}if(_0x33486e){for(var _0xd2902b in _0x33486e){if(_0x33486e[_0xab5c('0xc')](_0xd2902b)){_0x3f9162[_0xd2902b]=_0x33486e[_0xd2902b];}}}return _0x3f9162;}exports[_0xab5c('0xd')]=function(_0x3aa372,_0x48b047,_0x48e309,_0x4ee800){return new BPromise(function(_0x24435d,_0x287059){_0x4ee800=combineOptions(_0x4ee800);var _0x512bf4=new Buffer(_0x48e309);var _0x171a33=fs[_0xab5c('0xe')](_0x3aa372);var _0x227080=fs[_0xab5c('0xf')](_0x48b047);var _0x43238f=crypto[_0xab5c('0x10')](_0x4ee800[_0xab5c('0x6')],_0x512bf4);_0x171a33['on'](_0xab5c('0x11'),function(_0x1385ab){var _0x3e8483=new Buffer(_0x43238f['update'](_0x1385ab),_0xab5c('0x12'));_0x227080[_0xab5c('0x13')](_0x3e8483);});_0x171a33['on'](_0xab5c('0x14'),function(){try{var _0x28d072=new Buffer(_0x43238f[_0xab5c('0x15')](_0xab5c('0x12')),_0xab5c('0x12'));_0x227080[_0xab5c('0x13')](_0x28d072);_0x227080[_0xab5c('0x14')]();_0x227080['on'](_0xab5c('0x16'),function(){return _0x24435d(_0x48b047);});}catch(_0x349e53){fs[_0xab5c('0x17')](_0x48b047);return _0x287059(_0x349e53);}});});};exports[_0xab5c('0x18')]=function(_0x5d5b8b,_0x1d6306,_0x26070a,_0x2c1bde){return new BPromise(function(_0x38368a,_0x6a5b7d){_0x2c1bde=combineOptions(_0x2c1bde);var _0xa0ed1b=new Buffer(_0x26070a);var _0x3c2377=fs['createReadStream'](_0x5d5b8b);var _0x40e694=fs[_0xab5c('0xf')](_0x1d6306);var _0x5599ad=crypto['createDecipher'](_0x2c1bde[_0xab5c('0x6')],_0xa0ed1b);_0x3c2377['on']('data',function(_0x5bf1a8){var _0x54f040=new Buffer(_0x5599ad[_0xab5c('0x19')](_0x5bf1a8),_0xab5c('0x12'));_0x40e694[_0xab5c('0x13')](_0x54f040);});_0x3c2377['on'](_0xab5c('0x14'),function(){try{var _0x408027=new Buffer(_0x5599ad[_0xab5c('0x15')](_0xab5c('0x12')),_0xab5c('0x12'));_0x40e694[_0xab5c('0x13')](_0x408027);_0x40e694[_0xab5c('0x14')]();_0x40e694['on']('close',function(){return _0x38368a(_0x1d6306);});}catch(_0x62cade){fs[_0xab5c('0x17')](_0x1d6306);return _0x6a5b7d(_0x62cade);}});});};exports[_0xab5c('0x1a')]=function(_0x3b9176,_0x427347,_0x14dbc5){var _0x415307=_0x14dbc5||stringOptions[_0xab5c('0x6')];var _0x5f3ee5=_0x427347||stringOptions[_0xab5c('0x1b')];var _0x52bb53=crypto[_0xab5c('0x10')](_0x415307,_0x5f3ee5);var _0x438fb2=_0x52bb53[_0xab5c('0x19')](_0x3b9176,_0xab5c('0x1c'),_0xab5c('0x1d'));_0x438fb2+=_0x52bb53['final']('base64');return _0x438fb2;};exports[_0xab5c('0x1e')]=function(_0x5b1921,_0x3b0c99,_0x2569a8){var _0x36c2a9=_0x2569a8||stringOptions[_0xab5c('0x6')];var _0x5ed06a=_0x3b0c99||stringOptions[_0xab5c('0x1b')];var _0x5e2bc5=crypto[_0xab5c('0x1f')](_0x36c2a9,_0x5ed06a);var _0x1f4867=_0x5e2bc5[_0xab5c('0x19')](_0x5b1921,'base64',_0xab5c('0x1c'));_0x1f4867+=_0x5e2bc5[_0xab5c('0x15')](_0xab5c('0x1c'));return _0x1f4867;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 668ce59..5db14ae 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 _0xcb7b=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','existsSync','join','mkdirSync','%s.%s','csv','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','inspect','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcb7b,0x139));var _0xbcb7=function(_0x4ab009,_0x4d6ef1){_0x4ab009=_0x4ab009-0x0;var _0x36756e=_0xcb7b[_0x4ab009];return _0x36756e;};'use strict';var util=require(_0xbcb7('0x0'));var path=require(_0xbcb7('0x1'));var _=require(_0xbcb7('0x2'));var csv=require(_0xbcb7('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbcb7('0x4'));var rimraf=require(_0xbcb7('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbcb7('0x6'))[_0xbcb7('0x7')];var logger=require('../../config/logger')(_0xbcb7('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xbcb7('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbcb7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fc8a2,_0x3974de){var _0x149cd3={'status':_0x2fc8a2};var _0x59f93c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3974de){_0x149cd3[_0xbcb7('0xa')]=_0x3974de;}return db[_0xbcb7('0xb')]['update'](_0x149cd3,_0x59f93c);}function main(){var _0x602f1=0x1388;var _0x4c0e19;logger[_0xbcb7('0xc')](util[_0xbcb7('0xd')](_0xbcb7('0xe'),EXTRACTED_REPORT_ID,_0xbcb7('0xf')));return db[_0xbcb7('0x10')][_0xbcb7('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbcb7('0x12'),_0xbcb7('0x13')]})[_0xbcb7('0x14')](function(_0x49d9e3){if(_0x49d9e3){_0x4c0e19=_0x49d9e3;_0x602f1=_0x4c0e19[_0xbcb7('0x13')]||0x1388;}})[_0xbcb7('0x14')](function(){return dbH[_0xbcb7('0x15')][_0xbcb7('0x16')](util[_0xbcb7('0xd')](_0xbcb7('0x17'),QUERY),{'type':dbH[_0xbcb7('0x15')][_0xbcb7('0x18')]['SELECT']});})[_0xbcb7('0x14')](function(_0x5e7a9b){if(!_0x5e7a9b[0x0][_0xbcb7('0x19')]){return analyticExtractedReport('Empty');}var _0x2319de=[];var _0x263742=0x0;if(_0x4c0e19[_0xbcb7('0x12')]){if(_0x5e7a9b&&_0x5e7a9b[_0xbcb7('0x1a')]){var _0x166a6d=_[_0xbcb7('0x1b')](_0x5e7a9b[0x0][_0xbcb7('0x19')]/_0x602f1);var _0x29e3c6=Number[_0xbcb7('0x1c')](_0x5e7a9b[0x0][_0xbcb7('0x19')]/_0x602f1)?_0x5e7a9b[0x0][_0xbcb7('0x19')]%_0x602f1:0x0;_0x166a6d[_0xbcb7('0x1d')](function(_0x6c5181){if(_0x6c5181>0x0){_0x263742+=_0x602f1;}_0x2319de[_0xbcb7('0x1e')](dbH[_0xbcb7('0x15')]['query'](util[_0xbcb7('0xd')](_0xbcb7('0x1f'),QUERY,_0x602f1,_0x263742),{'type':dbH[_0xbcb7('0x15')]['QueryTypes'][_0xbcb7('0x20')]}));});if(_0x29e3c6>0x0){_0x263742+=_0x602f1;_0x2319de[_0xbcb7('0x1e')](dbH[_0xbcb7('0x15')][_0xbcb7('0x16')](util[_0xbcb7('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29e3c6,_0x263742),{'type':dbH[_0xbcb7('0x15')][_0xbcb7('0x18')][_0xbcb7('0x20')]}));}}}else{_0x2319de['push'](dbH['sequelize'][_0xbcb7('0x16')](QUERY,{'type':dbH[_0xbcb7('0x15')][_0xbcb7('0x18')][_0xbcb7('0x20')]}));}var _0x1325c0=path['dirname'](PATH);var _0x3fdba1=path[_0xbcb7('0x21')](PATH,'.csv');var _0xc86543=_0x4c0e19[_0xbcb7('0x12')]&&_0x2319de['length']>0x1;var _0x1d456b=[];if(!fs[_0xbcb7('0x22')](path[_0xbcb7('0x23')](_0x1325c0,_0x3fdba1))&&_0xc86543){fs[_0xbcb7('0x24')](path['join'](_0x1325c0,_0x3fdba1));}return BPromise['each'](_0x2319de,function(_0x6070f5){_0x1d456b['push'](_0x6070f5);})[_0xbcb7('0x14')](function(){for(var _0x1ce51f=0x0;_0x1ce51f<_0x1d456b[_0xbcb7('0x1a')];_0x1ce51f+=0x1){var _0x3c81d6;var _0x515bd5=_0x1d456b[_0x1ce51f];if(_0xc86543){_0x3c81d6=path['join'](_0x1325c0,_0x3fdba1,util[_0xbcb7('0xd')]('%s%d.%s',_0x3fdba1,_0x1ce51f,'csv'));}else{_0x3c81d6=path[_0xbcb7('0x23')](_0x1325c0,util[_0xbcb7('0xd')](_0xbcb7('0x25'),_0x3fdba1,_0xbcb7('0x26')));}fs[_0xbcb7('0x27')](_0x3c81d6,csv(_0x515bd5));}})['then'](function(){if(_0xc86543){return new Promise(function(_0x59e85d){zipdir(path[_0xbcb7('0x23')](_0x1325c0,_0x3fdba1),{'saveTo':path['join'](_0x1325c0,util[_0xbcb7('0xd')](_0xbcb7('0x25'),_0x3fdba1,'zip'))},function(_0x2237ff,_0x2a0246){rimraf(path[_0xbcb7('0x23')](_0x1325c0,_0x3fdba1),function(){});_0x59e85d(_0xbcb7('0x28'));});});}})['then'](function(){logger[_0xbcb7('0xc')](util[_0xbcb7('0xd')](_0xbcb7('0x29'),EXTRACTED_REPORT_ID,_0xbcb7('0xf')));return analyticExtractedReport(_0xbcb7('0x2a'),_0xc86543?util[_0xbcb7('0xd')]('%s.%s',_0x3fdba1,_0xc86543?_0xbcb7('0x2b'):_0xbcb7('0x26')):null);});})['catch'](function(_0x2163c1){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbcb7('0xf')),util[_0xbcb7('0x2c')](_0x2163c1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbcb7('0x2d'));})[_0xbcb7('0x2e')](function(){process[_0xbcb7('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4f15=['format','QueryTypes','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query'];(function(_0x27641c,_0x49f0d4){var _0x7232e8=function(_0x3a004c){while(--_0x3a004c){_0x27641c['push'](_0x27641c['shift']());}};_0x7232e8(++_0x49f0d4);}(_0x4f15,0x139));var _0x54f1=function(_0x44c622,_0x1144dd){_0x44c622=_0x44c622-0x0;var _0x5e8b4f=_0x4f15[_0x44c622];return _0x5e8b4f;};'use strict';var util=require(_0x54f1('0x0'));var path=require(_0x54f1('0x1'));var _=require(_0x54f1('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x54f1('0x3'));var zipdir=require(_0x54f1('0x4'));var rimraf=require(_0x54f1('0x5'));var db=require(_0x54f1('0x6'))['db'];var dbH=require('../../mysqldb')[_0x54f1('0x7')];var logger=require(_0x54f1('0x8'))(_0x54f1('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x54f1('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x54f1('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d901d,_0x479cb9){var _0x48611d={'status':_0x4d901d};var _0x6b2e2d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x479cb9){_0x48611d[_0x54f1('0xb')]=_0x479cb9;}return db['AnalyticExtractedReport'][_0x54f1('0xc')](_0x48611d,_0x6b2e2d);}function main(){var _0x32e5ec=0x1388;var _0x375642;logger[_0x54f1('0xd')](util['format'](_0x54f1('0xe'),EXTRACTED_REPORT_ID,_0x54f1('0xf')));return db[_0x54f1('0x10')][_0x54f1('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x54f1('0x12'),_0x54f1('0x13')]})[_0x54f1('0x14')](function(_0xdb6b4e){if(_0xdb6b4e){_0x375642=_0xdb6b4e;_0x32e5ec=_0x375642[_0x54f1('0x13')]||0x1388;}})['then'](function(){return dbH[_0x54f1('0x15')][_0x54f1('0x16')](util[_0x54f1('0x17')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x54f1('0x15')][_0x54f1('0x18')]['SELECT']});})['then'](function(_0x3617ef){if(!_0x3617ef[0x0][_0x54f1('0x19')]){return analyticExtractedReport(_0x54f1('0x1a'));}var _0x9b5789=[];var _0x4ac3f0=0x0;if(_0x375642[_0x54f1('0x12')]){if(_0x3617ef&&_0x3617ef[_0x54f1('0x1b')]){var _0xa8c3da=_[_0x54f1('0x1c')](_0x3617ef[0x0]['num']/_0x32e5ec);var _0x2dcce8=Number['isInteger'](_0x3617ef[0x0][_0x54f1('0x19')]/_0x32e5ec)?_0x3617ef[0x0][_0x54f1('0x19')]%_0x32e5ec:0x0;_0xa8c3da[_0x54f1('0x1d')](function(_0x4161bc){if(_0x4161bc>0x0){_0x4ac3f0+=_0x32e5ec;}_0x9b5789[_0x54f1('0x1e')](dbH[_0x54f1('0x15')]['query'](util[_0x54f1('0x17')](_0x54f1('0x1f'),QUERY,_0x32e5ec,_0x4ac3f0),{'type':dbH[_0x54f1('0x15')]['QueryTypes'][_0x54f1('0x20')]}));});if(_0x2dcce8>0x0){_0x4ac3f0+=_0x32e5ec;_0x9b5789['push'](dbH[_0x54f1('0x15')][_0x54f1('0x16')](util[_0x54f1('0x17')](_0x54f1('0x1f'),QUERY,_0x2dcce8,_0x4ac3f0),{'type':dbH[_0x54f1('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x9b5789[_0x54f1('0x1e')](dbH[_0x54f1('0x15')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x54f1('0x20')]}));}var _0x81a8c8=path[_0x54f1('0x21')](PATH);var _0x2ca62a=path['basename'](PATH,_0x54f1('0x22'));var _0x106745=_0x375642[_0x54f1('0x12')]&&_0x9b5789[_0x54f1('0x1b')]>0x1;var _0xb5a61a=[];if(!fs[_0x54f1('0x23')](path['join'](_0x81a8c8,_0x2ca62a))&&_0x106745){fs[_0x54f1('0x24')](path['join'](_0x81a8c8,_0x2ca62a));}return BPromise['each'](_0x9b5789,function(_0x54c3f5){_0xb5a61a['push'](_0x54c3f5);})[_0x54f1('0x14')](function(){for(var _0x5717c8=0x0;_0x5717c8<_0xb5a61a[_0x54f1('0x1b')];_0x5717c8+=0x1){var _0x3acdc4;var _0x3bc7d3=_0xb5a61a[_0x5717c8];if(_0x106745){_0x3acdc4=path[_0x54f1('0x25')](_0x81a8c8,_0x2ca62a,util[_0x54f1('0x17')](_0x54f1('0x26'),_0x2ca62a,_0x5717c8,_0x54f1('0x27')));}else{_0x3acdc4=path['join'](_0x81a8c8,util[_0x54f1('0x17')]('%s.%s',_0x2ca62a,_0x54f1('0x27')));}fs[_0x54f1('0x28')](_0x3acdc4,csv(_0x3bc7d3));}})[_0x54f1('0x14')](function(){if(_0x106745){return new Promise(function(_0x180d18){zipdir(path[_0x54f1('0x25')](_0x81a8c8,_0x2ca62a),{'saveTo':path[_0x54f1('0x25')](_0x81a8c8,util[_0x54f1('0x17')](_0x54f1('0x29'),_0x2ca62a,_0x54f1('0x2a')))},function(_0x1b834e,_0x1e1171){rimraf(path[_0x54f1('0x25')](_0x81a8c8,_0x2ca62a),function(){});_0x180d18(_0x54f1('0x2b'));});});}})[_0x54f1('0x14')](function(){logger[_0x54f1('0xd')](util[_0x54f1('0x17')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x106745?util[_0x54f1('0x17')](_0x54f1('0x29'),_0x2ca62a,_0x106745?_0x54f1('0x2a'):_0x54f1('0x27')):null);});})[_0x54f1('0x2c')](function(_0x2a6f5b){logger['info'](util[_0x54f1('0x17')](_0x54f1('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0x54f1('0x2e')](_0x2a6f5b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x54f1('0x2f'));})['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 60a335a..6d29086 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 _0x7225=['dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT'];(function(_0x207049,_0x15a51f){var _0x565b2b=function(_0xd66da4){while(--_0xd66da4){_0x207049['push'](_0x207049['shift']());}};_0x565b2b(++_0x15a51f);}(_0x7225,0xec));var _0x5722=function(_0x16e430,_0xf35fff){_0x16e430=_0x16e430-0x0;var _0x116946=_0x7225[_0x16e430];return _0x116946;};'use strict';var _=require(_0x5722('0x0'));var fs=require('fs');var util=require(_0x5722('0x1'));var path=require(_0x5722('0x2'));var moment=require(_0x5722('0x3'));var htmlToPdfmake=require(_0x5722('0x4'));var PdfPrinter=require(_0x5722('0x5'));var zipdir=require(_0x5722('0x6'));var rimraf=require(_0x5722('0x7'));var JSDOM=require(_0x5722('0x8'))[_0x5722('0x9')];var window=new JSDOM('')[_0x5722('0xa')];var BPromise=require(_0x5722('0xb'));var db=require(_0x5722('0xc'))['db'];var dbH=require(_0x5722('0xc'))[_0x5722('0xd')];var logger=require(_0x5722('0xe'))(_0x5722('0xf'));var EXTRACTED_REPORT_ID=Number(process[_0x5722('0x10')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5722('0x10')][0x4];var NAME=process[_0x5722('0x10')][0x5];var FORMAT=_0x5722('0x11');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x576385,_0x312976){var _0x4a9724={'status':_0x576385};var _0x52058f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x312976){_0x4a9724[_0x5722('0x12')]=_0x312976;}return db[_0x5722('0x13')]['update'](_0x4a9724,_0x52058f);}function getHeaders(_0x38778e){return _[_0x5722('0x14')](_0x38778e,function(_0x5635f1){return{'text':_0x5635f1,'style':_0x5722('0x15')};});}function getRows(_0x58b132,_0x39750d){return _[_0x5722('0x14')](_0x39750d,function(_0xce1bb2){return _(_0xce1bb2)[_0x5722('0x16')](_0x58b132)[_0x5722('0x14')](function(_0x29cad6){return _0x29cad6?_[_0x5722('0x17')](_0x29cad6):'';})[_0x5722('0x18')]();});}function createTable(_0x2c1d42,_0x43c661){var _0x508231={'widths':_[_0x5722('0x19')](Array(_0x2c1d42['length']),0x91),'heights':function(_0xcf2cee){return _0xcf2cee===0x0?_0x5722('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x157706=getHeaders(_0x2c1d42);_0x508231['body']['push'](_0x157706);var _0x432708=getRows(_0x2c1d42,_0x43c661);_0x508231[_0x5722('0x1b')]=_0x508231[_0x5722('0x1b')][_0x5722('0x1c')](_0x432708);return _0x508231;}function createTables(_0x1bc623){var _0xe647fa=[];var _0x206e41=_[_0x5722('0x1d')](Object[_0x5722('0x1e')](_0x1bc623[0x0]),0x5);_0x206e41['forEach'](function(_0x1a3c31){_0xe647fa[_0x5722('0x1f')](createTable(_0x1a3c31,_0x1bc623));});return _0xe647fa;}function getPDFDocDefinition(_0x3588a1){var _0x39c88d=util[_0x5722('0x20')](_0x5722('0x21'),NAME,EXTRACTED_REPORT[_0x5722('0x22')],moment(EXTRACTED_REPORT[_0x5722('0x23')])[_0x5722('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0x5722('0x24')])[_0x5722('0x20')](FORMAT));var _0xa4f9b3=[];for(var _0xf1b9d9=0x0;_0xf1b9d9<_0x3588a1[_0x5722('0x25')];_0xf1b9d9++){var _0x304864=[];if(_0xf1b9d9===0x0){_0x304864[_0x5722('0x1f')]({'text':_0x39c88d,'style':_0x5722('0x26')});}var _0x414bce={'table':_0x3588a1[_0xf1b9d9]};if(_0xf1b9d9>0x0){_0x414bce[_0x5722('0x27')]=_0x5722('0x28');_0x414bce[_0x5722('0x29')]=[0x0,0x46,0x0,0x0];}_0x304864[_0x5722('0x1f')](_0x414bce);_0xa4f9b3[_0x5722('0x1f')](_0x304864);}return{'pageSize':'A4','pageOrientation':_0x5722('0x2a'),'content':_0xa4f9b3,'footer':function(_0x232ff9,_0x5af10a){return{'text':_0x232ff9['toString']()+_0x5722('0x2b')+_0x5af10a,'style':_0x5722('0x2c')};},'defaultStyle':{'font':_0x5722('0x2d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5722('0x2e')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x39fb56){var _0x49084e=0x1388;var _0x5cb9f7;if(!_0x39fb56[0x0][_0x5722('0x2f')]){return analyticExtractedReport(_0x5722('0x30'));}return db[_0x5722('0x31')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5722('0x32'),_0x5722('0x33')]})[_0x5722('0x34')](function(_0x1dae43){if(_0x1dae43){_0x5cb9f7=_0x1dae43;_0x49084e=_0x5cb9f7[_0x5722('0x33')]||0x3e8;}})[_0x5722('0x34')](function(){var _0x583eeb=[];var _0x48d564=0x0;if(_0x5cb9f7[_0x5722('0x32')]){if(_0x39fb56&&_0x39fb56['length']){var _0x47a17e=_[_0x5722('0x35')](_0x39fb56[0x0][_0x5722('0x2f')]/_0x49084e);var _0x4ed6a3=Number[_0x5722('0x36')](_0x39fb56[0x0][_0x5722('0x2f')]/_0x49084e)?_0x39fb56[0x0]['num']%_0x49084e:0x0;_0x47a17e[_0x5722('0x37')](function(_0x5dd646){if(_0x5dd646>0x0){_0x48d564+=_0x49084e;}_0x583eeb[_0x5722('0x1f')](dbH['sequelize'][_0x5722('0x38')](util[_0x5722('0x20')](_0x5722('0x39'),QUERY,_0x49084e,_0x48d564),{'type':dbH[_0x5722('0x3a')][_0x5722('0x3b')][_0x5722('0x3c')]}));});if(_0x4ed6a3>0x0){_0x48d564+=_0x49084e;_0x583eeb['push'](dbH[_0x5722('0x3a')][_0x5722('0x38')](util['format'](_0x5722('0x39'),QUERY,_0x4ed6a3,_0x48d564),{'type':dbH[_0x5722('0x3a')]['QueryTypes']['SELECT']}));}}}else{_0x583eeb[_0x5722('0x1f')](dbH[_0x5722('0x3a')][_0x5722('0x38')](QUERY,{'type':dbH[_0x5722('0x3a')][_0x5722('0x3b')]['SELECT']}));}var _0x504341=path[_0x5722('0x3d')](PATH);var _0x263806=path[_0x5722('0x3e')](PATH,_0x5722('0x3f'));var _0x1c950b=_0x5cb9f7[_0x5722('0x32')]&&_0x583eeb[_0x5722('0x25')]>0x1;var _0x4f77a7=[];if(!fs[_0x5722('0x40')](path[_0x5722('0x41')](_0x504341,_0x263806))&&_0x1c950b){fs[_0x5722('0x42')](path['join'](_0x504341,_0x263806));}return BPromise[_0x5722('0x43')](_0x583eeb,function(_0x33ad74){_0x4f77a7['push'](_0x33ad74);})[_0x5722('0x34')](function(){var _0x31e922=[];for(var _0xa1144=0x0;_0xa1144<_0x4f77a7[_0x5722('0x25')];_0xa1144+=0x1){var _0x5f4c16=_0x4f77a7[_0xa1144];var _0x108748=createTables(_[_0x5722('0x44')](_0x5f4c16));var _0x3a9abb;var _0x78e7e8=getPDFDocDefinition(_0x108748);var _0x5603eb=getPDFPrinter();var _0x51b123=_0x5603eb[_0x5722('0x45')](_0x78e7e8);if(_0x1c950b){_0x3a9abb=path[_0x5722('0x41')](_0x504341,_0x263806,util[_0x5722('0x20')]('%s%d.%s',_0x263806,_0xa1144,_0x5722('0x46')));}else{_0x3a9abb=path[_0x5722('0x41')](_0x504341,util['format'](_0x5722('0x47'),_0x263806,_0x5722('0x46')));}_0x31e922['push'](writePDFDocument(_0x51b123,_0x3a9abb));}return Promise[_0x5722('0x48')](_0x31e922);})['then'](function(){if(_0x1c950b){return new Promise(function(_0x218489){zipdir(path['join'](_0x504341,_0x263806),{'saveTo':path[_0x5722('0x41')](_0x504341,util[_0x5722('0x20')](_0x5722('0x47'),_0x263806,_0x5722('0x49')))},function(){rimraf(path['join'](_0x504341,_0x263806),function(){});_0x218489(_0x5722('0x4a'));});});}})[_0x5722('0x34')](function(){if(!_0x1c950b)return;rimraf(path[_0x5722('0x41')](_0x504341,_0x263806),function(){});})[_0x5722('0x34')](function(){logger[_0x5722('0x4b')](util[_0x5722('0x20')](_0x5722('0x4c'),EXTRACTED_REPORT_ID,_0x5722('0x4d')));return analyticExtractedReport(_0x5722('0x4e'),_0x1c950b?util[_0x5722('0x20')](_0x5722('0x47'),_0x263806,_0x1c950b?_0x5722('0x49'):_0x5722('0x46')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5722('0x4b')](util[_0x5722('0x20')](_0x5722('0x4f'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x5722('0x50')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5722('0x34')](function(_0x18615f){EXTRACTED_REPORT=_0x18615f;return dbH['sequelize'][_0x5722('0x38')](util[_0x5722('0x20')](_0x5722('0x51'),QUERY),{'type':dbH[_0x5722('0x3a')]['QueryTypes'][_0x5722('0x3c')]});})[_0x5722('0x34')](extractReport)[_0x5722('0x52')](function(_0x2f2fb2){logger[_0x5722('0x4b')](util[_0x5722('0x20')](_0x5722('0x53'),EXTRACTED_REPORT_ID,_0x5722('0x4d')),util[_0x5722('0x54')](_0x2f2fb2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5722('0x55'));})[_0x5722('0x56')](function(){process[_0x5722('0x57')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4ed04e=new PdfPrinter({'Arial':{'normal':__dirname+_0x5722('0x58'),'bold':__dirname+_0x5722('0x59'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x5722('0x5a')}});return _0x4ed04e;}function getPDFDocDefinitionFromHTML(_0x49c2f7,_0x189469){var _0x47bcbe=util['format']('%s\x20#%d',_0x189469['channel'],_0x189469[_0x5722('0x5b')]);var _0x5abb36=moment()[_0x5722('0x20')](_0x5722('0x5c'))[_0x5722('0x17')]();var _0x580529=htmlToPdfmake(_0x49c2f7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x580529],'defaultStyle':{'font':_0x5722('0x2d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5722('0x5d'),'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':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x5722('0x26')}];},'footer':function(_0x5a5f5a,_0x238b65){return[{'text':util[_0x5722('0x20')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x47bcbe,_0x5a5f5a,_0x238b65,_0x5abb36),'style':_0x5722('0x2c')}];}};}function writePDFDocument(_0x28d75f,_0x2bacc3){return new Promise(function(_0x17f6bc,_0x3aa0b8){var _0x14cf4f=_0x28d75f[_0x5722('0x5e')](fs[_0x5722('0x5f')](_0x2bacc3));_0x14cf4f['on']('finish',function(){_0x17f6bc('finish');});_0x14cf4f['on'](_0x5722('0x60'),function(_0x2b5974){_0x3aa0b8(_0x2b5974);});_0x28d75f[_0x5722('0x61')]();});}exports[_0x5722('0x62')]=function(_0x192fa1,_0x1c2446){var _0x19c87f=getPDFPrinter();var _0x51f893=getPDFDocDefinitionFromHTML(_0x192fa1,_0x1c2446);var _0x4b64c1=_0x19c87f[_0x5722('0x45')](_0x51f893);return writePDFDocument(_0x4b64c1,_0x1c2446[_0x5722('0x2')])[_0x5722('0x52')](function(_0x558a1e){throw _0x558a1e;});}; \ No newline at end of file +var _0x5483=['error','end','createPdfFromHTML','path','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','bluebird','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','toString','value','auto','push','body','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','length','header','pageBreak','before','margin','landscape','footer','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish'];(function(_0x4415d9,_0x4e785a){var _0x1ebc5a=function(_0x54611c){while(--_0x54611c){_0x4415d9['push'](_0x4415d9['shift']());}};_0x1ebc5a(++_0x4e785a);}(_0x5483,0xae));var _0x3548=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x5483[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x3548('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x3548('0x1'));var PdfPrinter=require(_0x3548('0x2'));var zipdir=require(_0x3548('0x3'));var rimraf=require(_0x3548('0x4'));var JSDOM=require('jsdom')[_0x3548('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x3548('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x3548('0x7')];var logger=require(_0x3548('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3548('0x9')][0x2]);var QUERY=process[_0x3548('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x3548('0x9')][0x5];var FORMAT=_0x3548('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x26df23,_0x14844b){var _0x26b49b={'status':_0x26df23};var _0x2d7469={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x14844b){_0x26b49b[_0x3548('0xb')]=_0x14844b;}return db[_0x3548('0xc')]['update'](_0x26b49b,_0x2d7469);}function getHeaders(_0x2a1bef){return _['map'](_0x2a1bef,function(_0x271227){return{'text':_0x271227,'style':_0x3548('0xd')};});}function getRows(_0x2f2230,_0x336341){return _[_0x3548('0xe')](_0x336341,function(_0x56088f){return _(_0x56088f)[_0x3548('0xf')](_0x2f2230)[_0x3548('0xe')](function(_0x2dd69e){return _0x2dd69e?_[_0x3548('0x10')](_0x2dd69e):'';})[_0x3548('0x11')]();});}function createTable(_0x25d3de,_0x5378a7){var _0x152813={'widths':_['fill'](Array(_0x25d3de['length']),0x91),'heights':function(_0x3dea15){return _0x3dea15===0x0?_0x3548('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5ed117=getHeaders(_0x25d3de);_0x152813['body'][_0x3548('0x13')](_0x5ed117);var _0x47cb24=getRows(_0x25d3de,_0x5378a7);_0x152813['body']=_0x152813[_0x3548('0x14')]['concat'](_0x47cb24);return _0x152813;}function createTables(_0x337609){var _0x2aaf92=[];var _0xdee0d3=_[_0x3548('0x15')](Object[_0x3548('0x16')](_0x337609[0x0]),0x5);_0xdee0d3[_0x3548('0x17')](function(_0x263e6b){_0x2aaf92['push'](createTable(_0x263e6b,_0x337609));});return _0x2aaf92;}function getPDFDocDefinition(_0x4d0898){var _0x1d92a1=util[_0x3548('0x18')](_0x3548('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x3548('0x18')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3548('0x18')](FORMAT));var _0xff9b33=[];for(var _0x307af4=0x0;_0x307af4<_0x4d0898[_0x3548('0x1a')];_0x307af4++){var _0x1b0ad5=[];if(_0x307af4===0x0){_0x1b0ad5['push']({'text':_0x1d92a1,'style':_0x3548('0x1b')});}var _0x33d451={'table':_0x4d0898[_0x307af4]};if(_0x307af4>0x0){_0x33d451[_0x3548('0x1c')]=_0x3548('0x1d');_0x33d451[_0x3548('0x1e')]=[0x0,0x46,0x0,0x0];}_0x1b0ad5[_0x3548('0x13')](_0x33d451);_0xff9b33[_0x3548('0x13')](_0x1b0ad5);}return{'pageSize':'A4','pageOrientation':_0x3548('0x1f'),'content':_0xff9b33,'footer':function(_0x1bee1f,_0x5d2970){return{'text':_0x1bee1f['toString']()+'\x20/\x20'+_0x5d2970,'style':_0x3548('0x20')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3e9fc5){var _0x55034e=0x1388;var _0x1f21fc;if(!_0x3e9fc5[0x0][_0x3548('0x21')]){return analyticExtractedReport(_0x3548('0x22'));}return db[_0x3548('0x23')][_0x3548('0x24')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3548('0x25'),_0x3548('0x26')]})[_0x3548('0x27')](function(_0x3d559e){if(_0x3d559e){_0x1f21fc=_0x3d559e;_0x55034e=_0x1f21fc[_0x3548('0x26')]||0x3e8;}})[_0x3548('0x27')](function(){var _0x20a230=[];var _0x305782=0x0;if(_0x1f21fc[_0x3548('0x25')]){if(_0x3e9fc5&&_0x3e9fc5['length']){var _0x31fff9=_[_0x3548('0x28')](_0x3e9fc5[0x0][_0x3548('0x21')]/_0x55034e);var _0x1a4cdc=Number[_0x3548('0x29')](_0x3e9fc5[0x0]['num']/_0x55034e)?_0x3e9fc5[0x0][_0x3548('0x21')]%_0x55034e:0x0;_0x31fff9['forEach'](function(_0x4150b0){if(_0x4150b0>0x0){_0x305782+=_0x55034e;}_0x20a230[_0x3548('0x13')](dbH['sequelize'][_0x3548('0x2a')](util[_0x3548('0x18')](_0x3548('0x2b'),QUERY,_0x55034e,_0x305782),{'type':dbH[_0x3548('0x2c')][_0x3548('0x2d')][_0x3548('0x2e')]}));});if(_0x1a4cdc>0x0){_0x305782+=_0x55034e;_0x20a230[_0x3548('0x13')](dbH[_0x3548('0x2c')][_0x3548('0x2a')](util[_0x3548('0x18')](_0x3548('0x2b'),QUERY,_0x1a4cdc,_0x305782),{'type':dbH['sequelize'][_0x3548('0x2d')][_0x3548('0x2e')]}));}}}else{_0x20a230[_0x3548('0x13')](dbH[_0x3548('0x2c')][_0x3548('0x2a')](QUERY,{'type':dbH['sequelize'][_0x3548('0x2d')][_0x3548('0x2e')]}));}var _0x1aa003=path[_0x3548('0x2f')](PATH);var _0x5013aa=path[_0x3548('0x30')](PATH,_0x3548('0x31'));var _0x15cd63=_0x1f21fc[_0x3548('0x25')]&&_0x20a230['length']>0x1;var _0x19495d=[];if(!fs[_0x3548('0x32')](path[_0x3548('0x33')](_0x1aa003,_0x5013aa))&&_0x15cd63){fs['mkdirSync'](path[_0x3548('0x33')](_0x1aa003,_0x5013aa));}return BPromise[_0x3548('0x34')](_0x20a230,function(_0x30abf9){_0x19495d[_0x3548('0x13')](_0x30abf9);})['then'](function(){var _0x41668e=[];for(var _0xa9bd4b=0x0;_0xa9bd4b<_0x19495d['length'];_0xa9bd4b+=0x1){var _0x1ba588=_0x19495d[_0xa9bd4b];var _0x5e917c=createTables(_[_0x3548('0x35')](_0x1ba588));var _0x2bb7ee;var _0x4d1a30=getPDFDocDefinition(_0x5e917c);var _0x5280b9=getPDFPrinter();var _0x1e0556=_0x5280b9[_0x3548('0x36')](_0x4d1a30);if(_0x15cd63){_0x2bb7ee=path[_0x3548('0x33')](_0x1aa003,_0x5013aa,util[_0x3548('0x18')]('%s%d.%s',_0x5013aa,_0xa9bd4b,_0x3548('0x37')));}else{_0x2bb7ee=path[_0x3548('0x33')](_0x1aa003,util[_0x3548('0x18')](_0x3548('0x38'),_0x5013aa,_0x3548('0x37')));}_0x41668e['push'](writePDFDocument(_0x1e0556,_0x2bb7ee));}return Promise[_0x3548('0x39')](_0x41668e);})[_0x3548('0x27')](function(){if(_0x15cd63){return new Promise(function(_0x4bde09){zipdir(path[_0x3548('0x33')](_0x1aa003,_0x5013aa),{'saveTo':path[_0x3548('0x33')](_0x1aa003,util[_0x3548('0x18')](_0x3548('0x38'),_0x5013aa,'zip'))},function(){rimraf(path[_0x3548('0x33')](_0x1aa003,_0x5013aa),function(){});_0x4bde09(_0x3548('0x3a'));});});}})[_0x3548('0x27')](function(){if(!_0x15cd63)return;rimraf(path[_0x3548('0x33')](_0x1aa003,_0x5013aa),function(){});})['then'](function(){logger[_0x3548('0x3b')](util['format'](_0x3548('0x3c'),EXTRACTED_REPORT_ID,_0x3548('0x3d')));return analyticExtractedReport(_0x3548('0x3e'),_0x15cd63?util[_0x3548('0x18')]('%s.%s',_0x5013aa,_0x15cd63?'zip':_0x3548('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3548('0x3b')](util[_0x3548('0x18')](_0x3548('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x3548('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3548('0x27')](function(_0x6a0bce){EXTRACTED_REPORT=_0x6a0bce;return dbH['sequelize'][_0x3548('0x2a')](util[_0x3548('0x18')](_0x3548('0x40'),QUERY),{'type':dbH[_0x3548('0x2c')][_0x3548('0x2d')][_0x3548('0x2e')]});})[_0x3548('0x27')](extractReport)[_0x3548('0x41')](function(_0x394239){logger[_0x3548('0x3b')](util[_0x3548('0x18')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3548('0x3d')),util[_0x3548('0x42')](_0x394239,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3548('0x43')](function(){process[_0x3548('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x387be0=new PdfPrinter({'Arial':{'normal':__dirname+_0x3548('0x45'),'bold':__dirname+_0x3548('0x46'),'italics':__dirname+_0x3548('0x47'),'bolditalics':__dirname+_0x3548('0x48')}});return _0x387be0;}function getPDFDocDefinitionFromHTML(_0x372535,_0x2a0528){var _0x39c4b8=util[_0x3548('0x18')]('%s\x20#%d',_0x2a0528['channel'],_0x2a0528[_0x3548('0x49')]);var _0x1d9340=moment()[_0x3548('0x18')](_0x3548('0x4a'))['toString']();var _0x5549b9=htmlToPdfmake(_0x372535,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5549b9],'defaultStyle':{'font':_0x3548('0x4b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3548('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3548('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3548('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x3548('0x1b')}];},'footer':function(_0x36975a,_0x15de84){return[{'text':util[_0x3548('0x18')](_0x3548('0x4d'),_0x39c4b8,_0x36975a,_0x15de84,_0x1d9340),'style':'footer'}];}};}function writePDFDocument(_0x31eea9,_0x51729d){return new Promise(function(_0x424cb1,_0x44dd9c){var _0x243f6e=_0x31eea9[_0x3548('0x4e')](fs[_0x3548('0x4f')](_0x51729d));_0x243f6e['on']('finish',function(){_0x424cb1(_0x3548('0x50'));});_0x243f6e['on'](_0x3548('0x51'),function(_0x2e800d){_0x44dd9c(_0x2e800d);});_0x31eea9[_0x3548('0x52')]();});}exports[_0x3548('0x53')]=function(_0x25ced8,_0xe6f624){var _0x25ea6d=getPDFPrinter();var _0xfe43d8=getPDFDocDefinitionFromHTML(_0x25ced8,_0xe6f624);var _0x3306b5=_0x25ea6d[_0x3548('0x36')](_0xfe43d8);return writePDFDocument(_0x3306b5,_0xe6f624[_0x3548('0x54')])[_0x3548('0x41')](function(_0xd1532e){throw _0xd1532e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index cc3c389..9d7818a 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 _0x1f59=['mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','then','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','join'];(function(_0xc0f315,_0x54df8b){var _0x54707b=function(_0x551c33){while(--_0x551c33){_0xc0f315['push'](_0xc0f315['shift']());}};_0x54707b(++_0x54df8b);}(_0x1f59,0xef));var _0x91f5=function(_0xf1d768,_0x2e5e85){_0xf1d768=_0xf1d768-0x0;var _0x4cf889=_0x1f59[_0xf1d768];return _0x4cf889;};'use strict';var util=require('util');var path=require(_0x91f5('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x91f5('0x1'));var zipdir=require('zip-dir');var rimraf=require(_0x91f5('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0x91f5('0x3'))[_0x91f5('0x4')];var logger=require(_0x91f5('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x91f5('0x6')][0x2]);var QUERY=process[_0x91f5('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d160f,_0xb84e35){var _0x29cb14={'status':_0x2d160f};var _0x40bc84={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb84e35){_0x29cb14[_0x91f5('0x7')]=_0xb84e35;}return db['AnalyticExtractedReport']['update'](_0x29cb14,_0x40bc84);}function main(){var _0x5e4b94=0x1388;var _0x15c96d;logger[_0x91f5('0x8')](util[_0x91f5('0x9')](_0x91f5('0xa'),EXTRACTED_REPORT_ID,_0x91f5('0xb')));return db[_0x91f5('0xc')][_0x91f5('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x91f5('0xe'),_0x91f5('0xf')]})['then'](function(_0x29bcb6){if(_0x29bcb6){_0x15c96d=_0x29bcb6;_0x5e4b94=_0x15c96d[_0x91f5('0xf')]||0x1388;}})['then'](function(){return dbH[_0x91f5('0x10')][_0x91f5('0x11')](util[_0x91f5('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x91f5('0x10')][_0x91f5('0x12')][_0x91f5('0x13')]});})[_0x91f5('0x14')](function(_0x2fd9ac){if(!_0x2fd9ac[0x0][_0x91f5('0x15')]){return analyticExtractedReport('Empty');}var _0x2be265=[];var _0x149cbb=0x0;if(_0x15c96d['split']){if(_0x2fd9ac&&_0x2fd9ac[_0x91f5('0x16')]){var _0x410f3b=_[_0x91f5('0x17')](_0x2fd9ac[0x0][_0x91f5('0x15')]/_0x5e4b94);var _0x14274f=Number[_0x91f5('0x18')](_0x2fd9ac[0x0][_0x91f5('0x15')]/_0x5e4b94)?_0x2fd9ac[0x0][_0x91f5('0x15')]%_0x5e4b94:0x0;_0x410f3b[_0x91f5('0x19')](function(_0x14a85c){if(_0x14a85c>0x0){_0x149cbb+=_0x5e4b94;}_0x2be265[_0x91f5('0x1a')](dbH[_0x91f5('0x10')][_0x91f5('0x11')](util['format'](_0x91f5('0x1b'),QUERY,_0x5e4b94,_0x149cbb),{'type':dbH[_0x91f5('0x10')][_0x91f5('0x12')][_0x91f5('0x13')]}));});if(_0x14274f>0x0){_0x149cbb+=_0x5e4b94;_0x2be265[_0x91f5('0x1a')](dbH[_0x91f5('0x10')][_0x91f5('0x11')](util[_0x91f5('0x9')](_0x91f5('0x1b'),QUERY,_0x14274f,_0x149cbb),{'type':dbH[_0x91f5('0x10')][_0x91f5('0x12')][_0x91f5('0x13')]}));}}}else{_0x2be265[_0x91f5('0x1a')](dbH[_0x91f5('0x10')]['query'](QUERY,{'type':dbH[_0x91f5('0x10')][_0x91f5('0x12')][_0x91f5('0x13')]}));}var _0x232b9a=path[_0x91f5('0x1c')](PATH);var _0x5a8612=path['basename'](PATH,_0x91f5('0x1d'));var _0x26f78a=_0x15c96d['split']&&_0x2be265[_0x91f5('0x16')]>0x1;var _0x47b8be=[];if(!fs['existsSync'](path[_0x91f5('0x1e')](_0x232b9a,_0x5a8612))&&_0x26f78a){fs[_0x91f5('0x1f')](path[_0x91f5('0x1e')](_0x232b9a,_0x5a8612));}return BPromise[_0x91f5('0x20')](_0x2be265,function(_0x5743fa){_0x47b8be['push'](_0x5743fa);})[_0x91f5('0x14')](function(){for(var _0x44305e=0x0;_0x44305e<_0x47b8be[_0x91f5('0x16')];_0x44305e+=0x1){var _0x14c904;var _0x54231e=_0x47b8be[_0x44305e];if(_0x26f78a){_0x14c904=path[_0x91f5('0x1e')](_0x232b9a,_0x5a8612,util[_0x91f5('0x9')](_0x91f5('0x21'),_0x5a8612,_0x44305e,_0x91f5('0x22')));}else{_0x14c904=path['join'](_0x232b9a,util['format'](_0x91f5('0x23'),_0x5a8612,_0x91f5('0x22')));}fs[_0x91f5('0x24')](_0x14c904,json2xls(_0x54231e),_0x91f5('0x25'));}})[_0x91f5('0x14')](function(){if(_0x26f78a){return new Promise(function(_0x11edc1){zipdir(path[_0x91f5('0x1e')](_0x232b9a,_0x5a8612),{'saveTo':path['join'](_0x232b9a,util[_0x91f5('0x9')](_0x91f5('0x23'),_0x5a8612,'zip'))},function(_0x4bc7cf,_0x358d64){rimraf(path['join'](_0x232b9a,_0x5a8612),function(){});_0x11edc1('zip\x20finished');});});}})[_0x91f5('0x14')](function(){logger[_0x91f5('0x8')](util[_0x91f5('0x9')](_0x91f5('0x26'),EXTRACTED_REPORT_ID,_0x91f5('0xb')));return analyticExtractedReport('Completed',_0x26f78a?util[_0x91f5('0x9')]('%s.%s',_0x5a8612,_0x26f78a?_0x91f5('0x27'):_0x91f5('0x22')):null);});})['catch'](function(_0x62bc5d){logger['info'](util['format'](_0x91f5('0x28'),EXTRACTED_REPORT_ID,_0x91f5('0xb')),util[_0x91f5('0x29')](_0x62bc5d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x91f5('0x2a'));})[_0x91f5('0x2b')](function(){process[_0x91f5('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc6ec=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','format','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','info','Setting','find','split','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','num','Empty','length','range','isInteger'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0xc6ec,0x151));var _0xcc6e=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xc6ec[_0x16b1a5];return _0x475e25;};'use strict';var util=require(_0xcc6e('0x0'));var path=require(_0xcc6e('0x1'));var _=require(_0xcc6e('0x2'));var fs=require('fs');var json2xls=require(_0xcc6e('0x3'));var BPromise=require(_0xcc6e('0x4'));var zipdir=require(_0xcc6e('0x5'));var rimraf=require(_0xcc6e('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xcc6e('0x7'))['dbH'];var logger=require(_0xcc6e('0x8'))(_0xcc6e('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcc6e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x875b96,_0x110366){var _0x3110db={'status':_0x875b96};var _0x222242={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x110366){_0x3110db[_0xcc6e('0xb')]=_0x110366;}return db['AnalyticExtractedReport']['update'](_0x3110db,_0x222242);}function main(){var _0x37acc3=0x1388;var _0x46764e;logger[_0xcc6e('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0xcc6e('0xd')][_0xcc6e('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcc6e('0xf'),'splitSizeXlsx']})['then'](function(_0x3b2fca){if(_0x3b2fca){_0x46764e=_0x3b2fca;_0x37acc3=_0x46764e['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xcc6e('0x10')](util['format'](_0xcc6e('0x11'),QUERY),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')][_0xcc6e('0x14')]});})[_0xcc6e('0x15')](function(_0x7dc9f){if(!_0x7dc9f[0x0][_0xcc6e('0x16')]){return analyticExtractedReport(_0xcc6e('0x17'));}var _0x45211a=[];var _0x59d670=0x0;if(_0x46764e['split']){if(_0x7dc9f&&_0x7dc9f[_0xcc6e('0x18')]){var _0xbaf203=_[_0xcc6e('0x19')](_0x7dc9f[0x0][_0xcc6e('0x16')]/_0x37acc3);var _0x2891b7=Number[_0xcc6e('0x1a')](_0x7dc9f[0x0][_0xcc6e('0x16')]/_0x37acc3)?_0x7dc9f[0x0][_0xcc6e('0x16')]%_0x37acc3:0x0;_0xbaf203[_0xcc6e('0x1b')](function(_0x2d1036){if(_0x2d1036>0x0){_0x59d670+=_0x37acc3;}_0x45211a[_0xcc6e('0x1c')](dbH[_0xcc6e('0x12')]['query'](util['format'](_0xcc6e('0x1d'),QUERY,_0x37acc3,_0x59d670),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')][_0xcc6e('0x14')]}));});if(_0x2891b7>0x0){_0x59d670+=_0x37acc3;_0x45211a[_0xcc6e('0x1c')](dbH['sequelize']['query'](util[_0xcc6e('0x1e')](_0xcc6e('0x1d'),QUERY,_0x2891b7,_0x59d670),{'type':dbH[_0xcc6e('0x12')][_0xcc6e('0x13')]['SELECT']}));}}}else{_0x45211a[_0xcc6e('0x1c')](dbH[_0xcc6e('0x12')][_0xcc6e('0x10')](QUERY,{'type':dbH[_0xcc6e('0x12')]['QueryTypes'][_0xcc6e('0x14')]}));}var _0x1eb1d9=path[_0xcc6e('0x1f')](PATH);var _0x2b85a1=path[_0xcc6e('0x20')](PATH,_0xcc6e('0x21'));var _0x3ef078=_0x46764e[_0xcc6e('0xf')]&&_0x45211a[_0xcc6e('0x18')]>0x1;var _0x4b01c0=[];if(!fs[_0xcc6e('0x22')](path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1))&&_0x3ef078){fs[_0xcc6e('0x24')](path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1));}return BPromise[_0xcc6e('0x25')](_0x45211a,function(_0x33a2e3){_0x4b01c0['push'](_0x33a2e3);})[_0xcc6e('0x15')](function(){for(var _0x283d3f=0x0;_0x283d3f<_0x4b01c0['length'];_0x283d3f+=0x1){var _0x56c6c7;var _0x47e34b=_0x4b01c0[_0x283d3f];if(_0x3ef078){_0x56c6c7=path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1,util[_0xcc6e('0x1e')](_0xcc6e('0x26'),_0x2b85a1,_0x283d3f,_0xcc6e('0x27')));}else{_0x56c6c7=path['join'](_0x1eb1d9,util['format'](_0xcc6e('0x28'),_0x2b85a1,'xlsx'));}fs[_0xcc6e('0x29')](_0x56c6c7,json2xls(_0x47e34b),'binary');}})['then'](function(){if(_0x3ef078){return new Promise(function(_0x409f3c){zipdir(path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1),{'saveTo':path[_0xcc6e('0x23')](_0x1eb1d9,util['format'](_0xcc6e('0x28'),_0x2b85a1,_0xcc6e('0x2a')))},function(_0x179244,_0x3da509){rimraf(path[_0xcc6e('0x23')](_0x1eb1d9,_0x2b85a1),function(){});_0x409f3c(_0xcc6e('0x2b'));});});}})[_0xcc6e('0x15')](function(){logger[_0xcc6e('0xc')](util[_0xcc6e('0x1e')](_0xcc6e('0x2c'),EXTRACTED_REPORT_ID,_0xcc6e('0x2d')));return analyticExtractedReport('Completed',_0x3ef078?util[_0xcc6e('0x1e')](_0xcc6e('0x28'),_0x2b85a1,_0x3ef078?_0xcc6e('0x2a'):'xlsx'):null);});})[_0xcc6e('0x2e')](function(_0xd1e45a){logger[_0xcc6e('0xc')](util[_0xcc6e('0x1e')](_0xcc6e('0x2f'),EXTRACTED_REPORT_ID,_0xcc6e('0x2d')),util[_0xcc6e('0x30')](_0xd1e45a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcc6e('0x31'));})[_0xcc6e('0x32')](function(){process[_0xcc6e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 588fcba..299498b 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 _0x0b66=['Set','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','hasOwnProperty','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','queue','playback','extensions','extension','find','push','type'];(function(_0x147c4c,_0x333a6f){var _0x121a9b=function(_0x25ee5b){while(--_0x25ee5b){_0x147c4c['push'](_0x147c4c['shift']());}};_0x121a9b(++_0x333a6f);}(_0x0b66,0x163));var _0x60b6=function(_0x51e8f6,_0x5a711c){_0x51e8f6=_0x51e8f6-0x0;var _0x11c264=_0x0b66[_0x51e8f6];return _0x11c264;};'use strict';var _=require(_0x60b6('0x0'));var util=require(_0x60b6('0x1'));function rewrite(_0x18c8d7,_0x57cf57){var _0x4b35a6=this;return _0x18c8d7[_0x60b6('0x2')][_0x60b6('0x3')][_0x60b6('0x4')]({'raw':!![]})[_0x60b6('0x5')](function(_0x340e54){_0x4b35a6['intervals']=_0x340e54;return _0x18c8d7['models'][_0x60b6('0x6')][_0x60b6('0x4')]({'where':{'IntervalId':_0x57cf57[_0x60b6('0x7')]},'raw':!![]});})[_0x60b6('0x5')](function(_0x246e79){return _0x18c8d7[_0x60b6('0x2')][_0x60b6('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x60b6('0x8')](_[_0x60b6('0x9')](_0x246e79,_0x60b6('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x60b6('0x5')](function(_0x41b25a){var _0x3d061d=_[_0x60b6('0xb')](_0x41b25a,{'priority':'1'});var _0x275245=_[_0x60b6('0xb')](_0x41b25a,{'isApp':0x1});var _0x515680=_[_0x60b6('0xc')](_0x275245,'exten');var _0x27b6d6=[_0x60b6('0xd'),_0x60b6('0xe')];var _0x342174=[];var _0x5e9e5b=[];for(var _0x508ff2 in _0x515680){if(_0x515680['hasOwnProperty'](_0x508ff2)){_0x4b35a6['priority']=0x2;_0x4b35a6[_0x60b6('0xf')]=[];_0x4b35a6[_0x60b6('0x10')]=_[_0x60b6('0x11')](_0x3d061d,{'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')]});_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':util['format'](_0x60b6('0x15'),_0x515680[_0x508ff2][0x0][_0x60b6('0x13')]),'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6[_0x60b6('0x17')]++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});if(_0x515680[_0x508ff2][0x0][_0x60b6('0x13')]===_0x60b6('0x19')){_0x4b35a6[_0x60b6('0xf')]['push']({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x1a')+_0x515680[_0x508ff2][0x0][_0x60b6('0x18')],'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0]['exten'],'priority':_0x4b35a6[_0x60b6('0x17')]++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});}else if(_0x515680[_0x508ff2][0x0]['type']==='outbound'){if(_0x4b35a6[_0x60b6('0x10')]){_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0]['type'],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x1b')+(_0x4b35a6[_0x60b6('0x10')][_0x60b6('0x1c')]?_0x60b6('0x1d')+_0x4b35a6[_0x60b6('0x10')][_0x60b6('0x1c')]+'}':_0x60b6('0x1e')),'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0]['exten'],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});}_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':'CDR(routeid)='+_0x515680[_0x508ff2][0x0][_0x60b6('0x18')],'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});var _0x39f3aa=_0x4b35a6[_0x60b6('0x17')]++;_0x4b35a6[_0x60b6('0xf')]['push']({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x1f'),'appdata':_0x60b6('0x20')+(_0x39f3aa+0x2)+'):Goto('+(_0x39f3aa+0x1)+')','context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x39f3aa,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});if(_0x4b35a6[_0x60b6('0x10')]){_0x4b35a6['extensions'][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x4b35a6[_0x60b6('0x10')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x4b35a6[_0x60b6('0x10')][_0x60b6('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0]['VoiceExtensionId']});}_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':'outboundrouteid='+_0x515680[_0x508ff2][0x0][_0x60b6('0x18')],'context':_0x515680[_0x508ff2][0x0]['context'],'exten':_0x515680[_0x508ff2][0x0]['exten'],'priority':_0x4b35a6[_0x60b6('0x17')]++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0]['VoiceExtensionId']});if(_0x4b35a6[_0x60b6('0x10')]&&_0x4b35a6[_0x60b6('0x10')]['hasOwnProperty'](_0x60b6('0x21'))&&_0x4b35a6[_0x60b6('0x10')][_0x60b6('0x21')]!=='none'){_0x4b35a6['extensions']['push']({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':'Set','appdata':_0x60b6('0x22'),'context':_0x515680[_0x508ff2][0x0]['context'],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6[_0x60b6('0x17')]++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0]['type'],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x23')+_0x4b35a6['extension'][_0x60b6('0x21')]||_0x60b6('0x24'),'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});}}_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0]['type'],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x25'),'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0]['exten'],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x26'),'context':_0x515680[_0x508ff2][0x0]['context'],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6['priority']++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});_0x4b35a6['extensions'][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0][_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x27'),'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'priority':_0x4b35a6[_0x60b6('0x17')]++,'VoiceExtensionId':_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]});for(var _0x1d8e40=0x0,_0x2f838e=0x0;_0x1d8e40<_0x515680[_0x508ff2][_0x60b6('0x28')];_0x1d8e40+=0x1,_0x2f838e=0x0){var _0x4bce7a=_0x515680[_0x508ff2][_0x1d8e40];if(_0x4bce7a[_0x60b6('0x13')]){_0x4bce7a['type']=_0x4bce7a[_0x60b6('0x13')][_0x60b6('0x29')]();}var _0x52e999=[];var _0x19e23e=[];delete _0x4bce7a['id'];delete _0x4bce7a[_0x60b6('0x2a')];delete _0x4bce7a[_0x60b6('0x2b')];var _0x6c071e=_0x4bce7a[_0x60b6('0x2c')]!==_0x60b6('0x2d')?[_0x4bce7a[_0x60b6('0x2c')]]:_0x4bce7a['IntervalId']?_[_0x60b6('0x9')](_[_0x60b6('0xb')](_0x4b35a6[_0x60b6('0x2e')],{'IntervalId':_0x4bce7a[_0x60b6('0x7')]}),_0x60b6('0x2c')):[];if(_0x4bce7a[_0x60b6('0x2f')](_0x60b6('0x30'))){if(_0x4bce7a[_0x60b6('0x30')]&&_0x4bce7a[_0x60b6('0x30')]!=='--'){_0x52e999['push']({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x31')+_0x4bce7a[_0x60b6('0x30')],'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a[_0x60b6('0xa')],'priority':_0x6c071e[_0x60b6('0x28')]+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});}}if(_0x4bce7a[_0x60b6('0x13')]===_0x60b6('0x32')&&_0x4bce7a[_0x60b6('0x2f')](_0x60b6('0x33'))){if(_0x4bce7a[_0x60b6('0x33')]){_0x52e999['push']({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4bce7a[_0x60b6('0x33')]+')','context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a['exten'],'priority':_0x6c071e[_0x60b6('0x28')]+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a['VoiceExtensionId']});}else{_0x52e999[_0x60b6('0x12')]({'type':_0x4bce7a[_0x60b6('0x13')],'app':'ExecIf','appdata':_0x60b6('0x34'),'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a[_0x60b6('0xa')],'priority':_0x6c071e['length']+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});}}if(_0x4bce7a[_0x60b6('0x2f')]('answer')){if(_0x27b6d6[_0x60b6('0x35')](_0x4bce7a[_0x60b6('0x36')][_0x60b6('0x29')]())>=0x0&&_0x4bce7a[_0x60b6('0x37')]!==_0x60b6('0x38')){if(_0x4bce7a[_0x60b6('0x39')]){_0x52e999[_0x60b6('0x12')]({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x1f'),'appdata':_0x60b6('0x3a'),'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a[_0x60b6('0xa')],'priority':_0x6c071e[_0x60b6('0x28')]+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});_0x52e999['push']({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x3b'),'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a['exten'],'priority':_0x6c071e[_0x60b6('0x28')]+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});}else{_0x52e999['push']({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x1f'),'appdata':_0x60b6('0x3c'),'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a[_0x60b6('0xa')],'priority':_0x6c071e[_0x60b6('0x28')]+_0x4b35a6['priority']+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});_0x52e999[_0x60b6('0x12')]({'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x14'),'appdata':_0x60b6('0x3d'),'context':_0x4bce7a[_0x60b6('0x16')],'exten':_0x4bce7a[_0x60b6('0xa')],'priority':_0x6c071e['length']+_0x4b35a6[_0x60b6('0x17')]+_0x2f838e++,'VoiceExtensionId':_0x4bce7a[_0x60b6('0x18')]});}}}for(var _0x2c329a=0x0;_0x2c329a<_0x6c071e[_0x60b6('0x28')];_0x2c329a+=0x1){var _0x19fa39=_0x4b35a6['priority']+_0x6c071e[_0x60b6('0x28')];var _0x3f0656=_0x2c329a===_0x6c071e[_0x60b6('0x28')]-0x1?_0x4b35a6['priority']+_0x52e999[_0x60b6('0x28')]+_0x19e23e['length']+0x2:_0x4b35a6[_0x60b6('0x17')]+_0x2c329a+0x1;_0x52e999[_0x60b6('0x3e')](_0x2c329a,0x0,{'type':_0x4bce7a[_0x60b6('0x13')],'app':_0x60b6('0x3f'),'appdata':_0x6c071e[_0x2c329a]+'?'+_0x4bce7a[_0x60b6('0x16')]+_0x60b6('0x40')+_0x19fa39+':'+_0x4bce7a[_0x60b6('0x16')]+_0x60b6('0x40')+_0x3f0656,'exten':_0x4bce7a['exten'],'context':_0x4bce7a[_0x60b6('0x16')],'priority':_0x4b35a6[_0x60b6('0x17')]+_0x2c329a,'VoiceExtensionId':_0x515680[_0x508ff2][0x0]['VoiceExtensionId']});}_0x4bce7a['priority']=_0x52e999[_0x60b6('0x28')]?_[_0x60b6('0x41')](_0x52e999)['priority']+0x1:_0x4b35a6[_0x60b6('0x17')];_0x4b35a6[_0x60b6('0x17')]=(_0x19e23e[_0x60b6('0x28')]?_[_0x60b6('0x41')](_0x19e23e)[_0x60b6('0x17')]:_0x4bce7a[_0x60b6('0x17')])+0x1;_0x4b35a6[_0x60b6('0xf')]=_[_0x60b6('0x42')](_0x4b35a6[_0x60b6('0xf')],_0x52e999,[_0x4bce7a],_0x19e23e);}_0x4b35a6[_0x60b6('0xf')][_0x60b6('0x12')]({'type':_0x515680[_0x508ff2][0x0]['type'],'app':_0x60b6('0x43'),'exten':_0x515680[_0x508ff2][0x0][_0x60b6('0xa')],'context':_0x515680[_0x508ff2][0x0][_0x60b6('0x16')],'priority':_0x4b35a6[_0x60b6('0x17')],'VoiceExtensionId':_0x515680[_0x508ff2][0x0]['VoiceExtensionId']});_0x342174[_0x60b6('0x12')](_0x515680[_0x508ff2][0x0][_0x60b6('0x18')]);_0x5e9e5b=_[_0x60b6('0x42')](_0x5e9e5b,_0x4b35a6[_0x60b6('0xf')]);}}return _0x18c8d7[_0x60b6('0x44')](function(_0x345b09){return _0x18c8d7[_0x60b6('0x2')]['VoiceExtension'][_0x60b6('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x342174}},'transaction':_0x345b09})[_0x60b6('0x5')](function(_0x113e11){return _0x18c8d7[_0x60b6('0x2')]['VoiceExtension'][_0x60b6('0x46')](_[_0x60b6('0x47')](_0x5e9e5b,_0x60b6('0x17')),{'transaction':_0x345b09});});});})[_0x60b6('0x48')](function(_0x31d258){console[_0x60b6('0x49')](_0x31d258);});}exports[_0x60b6('0x4a')]=rewrite; \ No newline at end of file +var _0x000e=['${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','toLowerCase','createdAt','updatedAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','exten','queue','playback','hasOwnProperty','priority','extensions','find','push','type','format','CDR(type)=%s','VoiceExtensionId','Set','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x000e,0xa1));var _0xe000=function(_0x167474,_0x189140){_0x167474=_0x167474-0x0;var _0x5e67f3=_0x000e[_0x167474];return _0x5e67f3;};'use strict';var _=require(_0xe000('0x0'));var util=require(_0xe000('0x1'));function rewrite(_0x26a1c8,_0x594de9){var _0x5416f0=this;return _0x26a1c8[_0xe000('0x2')][_0xe000('0x3')][_0xe000('0x4')]({'raw':!![]})[_0xe000('0x5')](function(_0x16864c){_0x5416f0[_0xe000('0x6')]=_0x16864c;return _0x26a1c8[_0xe000('0x2')][_0xe000('0x7')][_0xe000('0x4')]({'where':{'IntervalId':_0x594de9[_0xe000('0x8')]},'raw':!![]});})[_0xe000('0x5')](function(_0x4cf9f3){return _0x26a1c8[_0xe000('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0xe000('0x9')](_[_0xe000('0xa')](_0x4cf9f3,'exten'))}},'order':[{'raw':_0xe000('0xb')}],'raw':!![]});})[_0xe000('0x5')](function(_0x5acc6d){var _0x32134c=_['filter'](_0x5acc6d,{'priority':'1'});var _0x4380d9=_['filter'](_0x5acc6d,{'isApp':0x1});var _0x1d7447=_['groupBy'](_0x4380d9,_0xe000('0xc'));var _0x1b2d19=[_0xe000('0xd'),_0xe000('0xe')];var _0x307f82=[];var _0x536dcb=[];for(var _0x35e135 in _0x1d7447){if(_0x1d7447[_0xe000('0xf')](_0x35e135)){_0x5416f0[_0xe000('0x10')]=0x2;_0x5416f0[_0xe000('0x11')]=[];_0x5416f0['extension']=_[_0xe000('0x12')](_0x32134c,{'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')]});_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':'Set','appdata':util[_0xe000('0x15')](_0xe000('0x16'),_0x1d7447[_0x35e135][0x0][_0xe000('0x14')]),'context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0]['exten'],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});if(_0x1d7447[_0x35e135][0x0][_0xe000('0x14')]==='inbound'){_0x5416f0[_0xe000('0x11')]['push']({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':'CDR(routeid)='+_0x1d7447[_0x35e135][0x0][_0xe000('0x17')],'context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0[_0xe000('0x10')]++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});}else if(_0x1d7447[_0x35e135][0x0][_0xe000('0x14')]===_0xe000('0x1a')){if(_0x5416f0[_0xe000('0x1b')]){_0x5416f0['extensions'][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':_0xe000('0x18'),'appdata':_0xe000('0x1c')+(_0x5416f0[_0xe000('0x1b')][_0xe000('0x1d')]?_0xe000('0x1e')+_0x5416f0[_0xe000('0x1b')][_0xe000('0x1d')]+'}':_0xe000('0x1f')),'context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0[_0xe000('0x10')]++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});}_0x5416f0['extensions'][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':_0xe000('0x18'),'appdata':_0xe000('0x20')+_0x1d7447[_0x35e135][0x0][_0xe000('0x17')],'context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']});var _0x43c837=_0x5416f0[_0xe000('0x10')]++;_0x5416f0[_0xe000('0x11')]['push']({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':_0xe000('0x21'),'appdata':_0xe000('0x22')+(_0x43c837+0x2)+_0xe000('0x23')+(_0x43c837+0x1)+')','context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'exten':_0x1d7447[_0x35e135][0x0]['exten'],'priority':_0x43c837,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});if(_0x5416f0[_0xe000('0x1b')]){_0x5416f0['extensions']['push']({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':_0x5416f0[_0xe000('0x1b')][_0xe000('0x1d')]?_0xe000('0x24')+_0x5416f0['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']});}_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':_0xe000('0x25')+_0x1d7447[_0x35e135][0x0][_0xe000('0x17')],'context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});if(_0x5416f0[_0xe000('0x1b')]&&_0x5416f0['extension'][_0xe000('0xf')](_0xe000('0x26'))&&_0x5416f0[_0xe000('0x1b')][_0xe000('0x26')]!=='none'){_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':'Set','appdata':_0xe000('0x27'),'context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0[_0xe000('0x10')]++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']});_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':_0xe000('0x18'),'appdata':_0xe000('0x28')+_0x5416f0[_0xe000('0x1b')][_0xe000('0x26')]||_0xe000('0x29'),'context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});}}_0x5416f0['extensions'][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0['priority']++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']});_0x5416f0['extensions'][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0[_0xe000('0x10')]++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0][_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d7447[_0x35e135][0x0]['context'],'exten':_0x1d7447[_0x35e135][0x0][_0xe000('0xc')],'priority':_0x5416f0[_0xe000('0x10')]++,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']});for(var _0x4a43e0=0x0,_0x5b646a=0x0;_0x4a43e0<_0x1d7447[_0x35e135]['length'];_0x4a43e0+=0x1,_0x5b646a=0x0){var _0x40def0=_0x1d7447[_0x35e135][_0x4a43e0];if(_0x40def0['type']){_0x40def0[_0xe000('0x14')]=_0x40def0[_0xe000('0x14')][_0xe000('0x2a')]();}var _0x1d86f6=[];var _0x4d5783=[];delete _0x40def0['id'];delete _0x40def0[_0xe000('0x2b')];delete _0x40def0[_0xe000('0x2c')];var _0x4a9d6a=_0x40def0[_0xe000('0x2d')]!=='*,*,*,*'?[_0x40def0['interval']]:_0x40def0['IntervalId']?_[_0xe000('0xa')](_['filter'](_0x5416f0[_0xe000('0x6')],{'IntervalId':_0x40def0['IntervalId']}),_0xe000('0x2d')):[];if(_0x40def0[_0xe000('0xf')](_0xe000('0x2e'))){if(_0x40def0['tag']&&_0x40def0[_0xe000('0x2e')]!=='--'){_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0['type'],'app':_0xe000('0x18'),'appdata':'CDR(tag)='+_0x40def0[_0xe000('0x2e')],'context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0['exten'],'priority':_0x4a9d6a['length']+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0['VoiceExtensionId']});}}if(_0x40def0[_0xe000('0x14')]==='outbound'&&_0x40def0[_0xe000('0xf')]('callerID')){if(_0x40def0[_0xe000('0x2f')]){_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0[_0xe000('0x14')],'app':'ExecIf','appdata':_0xe000('0x30')+_0x40def0[_0xe000('0x2f')]+')','context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0[_0xe000('0xc')],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0['priority']+_0x5b646a++,'VoiceExtensionId':_0x40def0['VoiceExtensionId']});}else{_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0[_0xe000('0x14')],'app':_0xe000('0x21'),'appdata':_0xe000('0x32'),'context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0[_0xe000('0xc')],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0[_0xe000('0x17')]});}}if(_0x40def0['hasOwnProperty']('answer')){if(_0x1b2d19[_0xe000('0x33')](_0x40def0['app'][_0xe000('0x2a')]())>=0x0&&_0x40def0['appType']!=='custom'){if(_0x40def0[_0xe000('0x34')]){_0x1d86f6['push']({'type':_0x40def0[_0xe000('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x40def0['context'],'exten':_0x40def0[_0xe000('0xc')],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0[_0xe000('0x17')]});_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0[_0xe000('0x14')],'app':_0xe000('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0['exten'],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0['VoiceExtensionId']});}else{_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0[_0xe000('0x14')],'app':_0xe000('0x21'),'appdata':_0xe000('0x35'),'context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0[_0xe000('0xc')],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0[_0xe000('0x17')]});_0x1d86f6[_0xe000('0x13')]({'type':_0x40def0[_0xe000('0x14')],'app':'Set','appdata':_0xe000('0x36'),'context':_0x40def0[_0xe000('0x19')],'exten':_0x40def0['exten'],'priority':_0x4a9d6a[_0xe000('0x31')]+_0x5416f0[_0xe000('0x10')]+_0x5b646a++,'VoiceExtensionId':_0x40def0[_0xe000('0x17')]});}}}for(var _0x5816ec=0x0;_0x5816ec<_0x4a9d6a['length'];_0x5816ec+=0x1){var _0x284396=_0x5416f0[_0xe000('0x10')]+_0x4a9d6a[_0xe000('0x31')];var _0x473d1f=_0x5816ec===_0x4a9d6a[_0xe000('0x31')]-0x1?_0x5416f0['priority']+_0x1d86f6[_0xe000('0x31')]+_0x4d5783['length']+0x2:_0x5416f0[_0xe000('0x10')]+_0x5816ec+0x1;_0x1d86f6[_0xe000('0x37')](_0x5816ec,0x0,{'type':_0x40def0[_0xe000('0x14')],'app':'GotoIfTime','appdata':_0x4a9d6a[_0x5816ec]+'?'+_0x40def0[_0xe000('0x19')]+',${EXTEN},'+_0x284396+':'+_0x40def0[_0xe000('0x19')]+_0xe000('0x38')+_0x473d1f,'exten':_0x40def0[_0xe000('0xc')],'context':_0x40def0[_0xe000('0x19')],'priority':_0x5416f0[_0xe000('0x10')]+_0x5816ec,'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});}_0x40def0['priority']=_0x1d86f6[_0xe000('0x31')]?_['last'](_0x1d86f6)[_0xe000('0x10')]+0x1:_0x5416f0['priority'];_0x5416f0[_0xe000('0x10')]=(_0x4d5783[_0xe000('0x31')]?_[_0xe000('0x39')](_0x4d5783)[_0xe000('0x10')]:_0x40def0['priority'])+0x1;_0x5416f0[_0xe000('0x11')]=_[_0xe000('0x3a')](_0x5416f0[_0xe000('0x11')],_0x1d86f6,[_0x40def0],_0x4d5783);}_0x5416f0[_0xe000('0x11')][_0xe000('0x13')]({'type':_0x1d7447[_0x35e135][0x0]['type'],'app':'Hangup','exten':_0x1d7447[_0x35e135][0x0]['exten'],'context':_0x1d7447[_0x35e135][0x0][_0xe000('0x19')],'priority':_0x5416f0[_0xe000('0x10')],'VoiceExtensionId':_0x1d7447[_0x35e135][0x0][_0xe000('0x17')]});_0x307f82[_0xe000('0x13')](_0x1d7447[_0x35e135][0x0]['VoiceExtensionId']);_0x536dcb=_[_0xe000('0x3a')](_0x536dcb,_0x5416f0[_0xe000('0x11')]);}}return _0x26a1c8[_0xe000('0x3b')](function(_0x2f8c1b){return _0x26a1c8[_0xe000('0x2')][_0xe000('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x307f82}},'transaction':_0x2f8c1b})[_0xe000('0x5')](function(_0x327f5d){return _0x26a1c8[_0xe000('0x2')][_0xe000('0x7')][_0xe000('0x3c')](_[_0xe000('0x3d')](_0x536dcb,'priority'),{'transaction':_0x2f8c1b});});});})[_0xe000('0x3e')](function(_0x4212c7){console['error'](_0x4212c7);});}exports[_0xe000('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 28e4db7..ca46008 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 _0xe783=['always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','CSV\x20parse\x20error','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','join','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','CmContact','create','push','catch','cmContact','checkHopper','inspect','into','cm_hopper','scheduledAt','updatedAt','select','NOW()','ContactId','field','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','fromQuery','ListId\x20=\x20?','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','str','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','then','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign'];(function(_0xe78c88,_0x2ec39a){var _0x5c226d=function(_0x5b41cb){while(--_0x5b41cb){_0xe78c88['push'](_0xe78c88['shift']());}};_0x5c226d(++_0x2ec39a);}(_0xe783,0x1c2));var _0x3e78=function(_0x2e46eb,_0x8bbfdb){_0x2e46eb=_0x2e46eb-0x0;var _0xe7cf80=_0xe783[_0x2e46eb];return _0xe7cf80;};'use strict';var BPromise=require('bluebird');var util=require(_0x3e78('0x0'));var _=require(_0x3e78('0x1'));var fs=require('fs');var squel=require(_0x3e78('0x2'));var Papa=require(_0x3e78('0x3'));var Redis=require(_0x3e78('0x4'));var db=require(_0x3e78('0x5'))['db'];var config=require(_0x3e78('0x6'));var logger=require(_0x3e78('0x7'))(_0x3e78('0x8'));config['redis']=_[_0x3e78('0x9')](config[_0x3e78('0xa')],{'host':_0x3e78('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e78('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x3e78('0xc')](socket);try{if(!process[_0x3e78('0xd')][0x2]||process['argv'][0x2]===_0x3e78('0xe')||process['argv'][0x2]===_0x3e78('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x3e78('0xd')][0x2];if(!process['argv'][0x3]||process[_0x3e78('0xd')][0x3]===_0x3e78('0xe')||process[_0x3e78('0xd')][0x3]===_0x3e78('0xf')||!process[_0x3e78('0xd')][0x4]||process[_0x3e78('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0x3e78('0xf')){throw new Error(_0x3e78('0x10'));}var FIELDS=_[_0x3e78('0x11')](process[_0x3e78('0xd')][0x3]['split'](','),process['argv'][0x4][_0x3e78('0x12')](','));if(!process['argv'][0x5]||process[_0x3e78('0xd')][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error(_0x3e78('0x13'));}var LISTID=process[_0x3e78('0xd')][0x5];var COMPANYID=process[_0x3e78('0xd')][0x6]&&process[_0x3e78('0xd')][0x6]!==_0x3e78('0xe')&&process[_0x3e78('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x3e78('0xd')][0x7]!==_0x3e78('0xe')&&process[_0x3e78('0xd')][0x7]!==_0x3e78('0xf')?process[_0x3e78('0xd')][0x7]:null;if(!process[_0x3e78('0xd')][0x8]||process[_0x3e78('0xd')][0x8]===_0x3e78('0xe')||process[_0x3e78('0xd')][0x8]==='null'){throw new Error(_0x3e78('0x14'));}var SOCKET_TIMESTAMP=process[_0x3e78('0xd')][0x8];}catch(_0x2986f1){logger['error'](_0x2986f1);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(_0x35eb0f,_0x5f14e1,_0xd4881e,_0x6655fe){var _0x581deb={'message':_0x5f14e1};_0x581deb[_0x35eb0f]=!![];if(_0xd4881e){_0x581deb[_0x3e78('0x15')]=_0xd4881e;}if(_0x6655fe){_0x581deb[_0x3e78('0x16')]=_0x6655fe;}return _0x581deb;}function isEmail(_0x3e0790){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'](_0x3e0790);}function checkRow(_0x1c524c,_0xf34395,_0x1cb297){return new BPromise(function(_0x58c43b,_0x116cf3){if(_[_0x3e78('0x17')](_0x1c524c)){return _0x116cf3(handleCheckRowError(_0x3e78('0x18'),_0x3e78('0x19'),null,_0x1cb297));}if(_0x1c524c['errors']&&_0x1c524c['errors'][_0x3e78('0x1a')]){var _0x3da936=_[_0x3e78('0x1b')](_0x1c524c[_0x3e78('0x1c')],_0x3e78('0x1d'))[_0x3e78('0x1e')](';');return _0x116cf3(handleCheckRowError('error',_0x3da936,null,_0x1cb297));}var _0x2a2632={};for(var _0x2ff2fb in FIELDS){if(FIELDS[_0x3e78('0x1f')](_0x2ff2fb)&&FIELDS[_0x2ff2fb]){_0x2a2632[_0x2ff2fb]=_0x1c524c['data'][0x0][FIELDS[_0x2ff2fb]]||_0x1c524c['data'][0x0]['\ufeff'+FIELDS[_0x2ff2fb]];}}if(!_0x2a2632[_0x3e78('0x20')]){return _0x116cf3(handleCheckRowError(_0x3e78('0x18'),_0x3e78('0x21'),null,_0x1cb297));}if(!_0x2a2632[_0x3e78('0x22')]){return _0x116cf3(handleCheckRowError(_0x3e78('0x18'),_0x3e78('0x23'),null,_0x1cb297));}if(_0x2a2632['birthDate']){var _0x179bf1=moment(_0x2a2632['birthDate'],_0x3e78('0x24'));if(!_0x179bf1[_0x3e78('0x25')]()){return _0x116cf3(handleCheckRowError(_0x3e78('0x18'),_0x3e78('0x26'),null,_0x1cb297));}}if(_0x2a2632[_0x3e78('0x27')]){if(!isEmail(_0x2a2632[_0x3e78('0x27')])){return _0x116cf3(handleCheckRowError(_0x3e78('0x18'),_0x3e78('0x28'),null,_0x1cb297));}}_0x2a2632[_0x3e78('0x29')]=LISTID;_0x2a2632[_0x3e78('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3e78('0x1a')]&&_0xf34395){var _0x2f3f2c={};for(var _0x9314d9=0x0,_0x150388=DUPLICATES['length'];_0x9314d9<_0x150388;_0x9314d9+=0x1){_0x2f3f2c[DUPLICATES[_0x9314d9]]=_0x2a2632[DUPLICATES[_0x9314d9]];}var _0x5cb428=_['find'](_0xf34395,_0x2f3f2c);if(_0x5cb428){return _0x116cf3(handleCheckRowError('duplicate',_0x3e78('0x2b'),_0x5cb428,_0x1cb297));}}return db[_0x3e78('0x2c')][_0x3e78('0x2d')](_0x2a2632,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2a2632)})['then'](function(_0x4e558a){if(DUPLICATES&&DUPLICATES[_0x3e78('0x1a')]&&_0xf34395){_0xf34395[_0x3e78('0x2e')](_['pick'](_0x2a2632,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4e558a['id'];return _0x58c43b();})[_0x3e78('0x2f')](function(_0x1d26ba){return _0x116cf3(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x1d26ba['message']||JSON['stringify'](_0x1d26ba)),null,_0x1cb297));});});}function checkHopper(){function _0x3babd2(){return function(_0x544eeb){logger[_0x3e78('0x18')](_0x3e78('0x30'),_0x3e78('0x31'),util[_0x3e78('0x32')](_0x544eeb,{'showHidden':![],'depth':null}));};}var _0x346c30=function(_0x431554,_0x60575c){var _0xad307a=squel['insert']()[_0x3e78('0x33')](_0x3e78('0x34'))['fromQuery']([_0x3e78('0x22'),_0x3e78('0x35'),'ContactId',_0x3e78('0x29'),_0x60575c,'createdAt',_0x3e78('0x36')],squel[_0x3e78('0x37')]()['field'](_0x3e78('0x22'),_0x3e78('0x22'))['field'](_0x3e78('0x38'),'scheduledAt')['field']('id',_0x3e78('0x39'))[_0x3e78('0x3a')](LISTID[_0x3e78('0x3b')](),_0x3e78('0x29'))[_0x3e78('0x3a')](_0x431554['id'][_0x3e78('0x3b')](),_0x60575c)[_0x3e78('0x3a')](_0x3e78('0x38'),_0x3e78('0x3c'))['field']('NOW()',_0x3e78('0x36'))[_0x3e78('0x3d')](_0x3e78('0x3e'))[_0x3e78('0x3f')](_0x3e78('0x40'))[_0x3e78('0x3f')]('ListId\x20=\x20?',LISTID[_0x3e78('0x3b')]())[_0x3e78('0x3f')](_0x3e78('0x41'))[_0x3e78('0x3f')](_0x3e78('0x42'),squel[_0x3e78('0x37')]()[_0x3e78('0x3a')]('phone')[_0x3e78('0x3d')](_0x3e78('0x34'))[_0x3e78('0x3f')](_0x60575c+_0x3e78('0x43'),_0x431554['id'][_0x3e78('0x3b')]())))['toString']();return _0xad307a;};var _0x14e501=function(_0x4d57f8,_0x4bbe02){var _0xc95ec4=squel[_0x3e78('0x44')]()['into'](_0x3e78('0x34'))[_0x3e78('0x45')]([_0x3e78('0x22'),'scheduledAt',_0x3e78('0x39'),_0x3e78('0x29'),_0x4bbe02,'createdAt',_0x3e78('0x36')],squel[_0x3e78('0x37')]()[_0x3e78('0x3a')](_0x3e78('0x22'),_0x3e78('0x22'))[_0x3e78('0x3a')](_0x3e78('0x38'),'scheduledAt')['field']('id',_0x3e78('0x39'))[_0x3e78('0x3a')](LISTID['toString'](),'ListId')[_0x3e78('0x3a')](_0x4d57f8['id'][_0x3e78('0x3b')](),_0x4bbe02)[_0x3e78('0x3a')]('NOW()',_0x3e78('0x3c'))[_0x3e78('0x3a')](_0x3e78('0x38'),_0x3e78('0x36'))['from'](_0x3e78('0x3e'))[_0x3e78('0x3f')](_0x3e78('0x40'))['where'](_0x3e78('0x46'),LISTID[_0x3e78('0x3b')]())[_0x3e78('0x3f')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x3e78('0x3f')](_0x3e78('0x41'))[_0x3e78('0x3f')](_0x3e78('0x42'),squel[_0x3e78('0x37')]()[_0x3e78('0x3a')](_0x3e78('0x47'))[_0x3e78('0x3d')](_0x3e78('0x48'))['where'](_0x4bbe02+_0x3e78('0x43'),_0x4d57f8['id'][_0x3e78('0x3b')]()))[_0x3e78('0x3f')](_0x3e78('0x42'),squel['select']()[_0x3e78('0x3a')](_0x3e78('0x22'))[_0x3e78('0x3d')](_0x3e78('0x34'))[_0x3e78('0x3f')](_0x4bbe02+'\x20=\x20?',_0x4d57f8['id']['toString']())))[_0x3e78('0x3b')]();return _0xc95ec4;};function _0x50c3c3(_0x2383be,_0x40ff3d){var _0x21e615=squel[_0x3e78('0x44')]()['into'](_0x3e78('0x34'))[_0x3e78('0x45')]([_0x3e78('0x22'),_0x3e78('0x35'),_0x3e78('0x39'),_0x3e78('0x29'),_0x40ff3d,_0x3e78('0x3c'),'updatedAt'],squel['select']()[_0x3e78('0x3a')](_0x3e78('0x22'),_0x3e78('0x22'))[_0x3e78('0x3a')](_0x3e78('0x38'),_0x3e78('0x35'))[_0x3e78('0x3a')]('id',_0x3e78('0x39'))[_0x3e78('0x3a')](LISTID[_0x3e78('0x3b')](),_0x3e78('0x29'))[_0x3e78('0x3a')](_0x2383be['id'][_0x3e78('0x3b')](),_0x40ff3d)[_0x3e78('0x3a')]('NOW()',_0x3e78('0x3c'))['field']('NOW()',_0x3e78('0x36'))['from'](_0x3e78('0x3e'))[_0x3e78('0x3f')](_0x3e78('0x40'))['where'](_0x3e78('0x46'),LISTID[_0x3e78('0x3b')]())['where'](_0x3e78('0x49'),squel['str'](hopperContacts))[_0x3e78('0x3f')](_0x3e78('0x41')))[_0x3e78('0x3b')]();return _0x21e615;}function _0x40d541(_0x44cd0a,_0x3adb58){var _0x1fe47b=squel[_0x3e78('0x44')]()['into'](_0x3e78('0x4a'))['fromQuery'](['phone',_0x3e78('0x39'),_0x3e78('0x29'),_0x3adb58,_0x3e78('0x3c'),_0x3e78('0x36')],squel[_0x3e78('0x37')]()[_0x3e78('0x3a')](_0x3e78('0x22'),_0x3e78('0x22'))[_0x3e78('0x3a')]('id',_0x3e78('0x39'))[_0x3e78('0x3a')](LISTID[_0x3e78('0x3b')](),'ListId')['field'](_0x44cd0a['id'][_0x3e78('0x3b')](),_0x3adb58)[_0x3e78('0x3a')](_0x3e78('0x38'),'createdAt')[_0x3e78('0x3a')]('NOW()',_0x3e78('0x36'))['from'](_0x3e78('0x3e'))[_0x3e78('0x3f')](_0x3e78('0x40'))[_0x3e78('0x3f')](_0x3e78('0x46'),LISTID['toString']())[_0x3e78('0x3f')](_0x3e78('0x49'),squel[_0x3e78('0x4b')](hopperContacts))['where'](_0x3e78('0x41')))[_0x3e78('0x3b')]();return _0x1fe47b;}return db[_0x3e78('0x4c')][_0x3e78('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x3e78('0x4e')],'include':[{'model':db[_0x3e78('0x4f')],'as':_0x3e78('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x1415fb){var _0x46cefa=[];if(_0x1415fb){var _0x2f9070;for(var _0x38e6cd=0x0,_0x2e4383;_0x38e6cd<_0x1415fb['length'];_0x38e6cd+=0x1){_0x2e4383=_0x1415fb[_0x38e6cd][_0x3e78('0x51')]({'plain':!![]});switch(_0x2e4383[_0x3e78('0x4e')]){case'always':_0x46cefa[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x14e501(_0x2e4383,'VoiceQueueId'))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));break;case _0x3e78('0x55'):_0x46cefa[_0x3e78('0x2e')](db[_0x3e78('0x52')]['query'](_0x346c30(_0x2e4383,_0x3e78('0x56')))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));break;default:_0x46cefa[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x50c3c3(_0x2e4383,_0x3e78('0x56')))[_0x3e78('0x54')](function(){})['catch'](_0x3babd2()));}}}return _0x46cefa;})[_0x3e78('0x57')]()[_0x3e78('0x54')](function(){return db['VoiceQueue'][_0x3e78('0x4d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3e78('0x4f')],'as':_0x3e78('0x58'),'where':{'id':LISTID}}]})[_0x3e78('0x54')](function(_0x204c3e){var _0x59447f=[];if(_0x204c3e){var _0x1f166e;for(var _0x5f42af=0x0,_0x5e5b01;_0x5f42af<_0x204c3e[_0x3e78('0x1a')];_0x5f42af+=0x1){_0x5e5b01=_0x204c3e[_0x5f42af][_0x3e78('0x51')]({'plain':!![]});_0x59447f[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x40d541(_0x5e5b01,_0x3e78('0x56')))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));}}return _0x59447f;})[_0x3e78('0x57')]();})['then'](function(){return db[_0x3e78('0x59')][_0x3e78('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3e78('0x4f')],'as':_0x3e78('0x50'),'where':{'id':LISTID}}]})[_0x3e78('0x54')](function(_0x15acc8){var _0xf583e=[];if(_0x15acc8){for(var _0x4bce59=0x0,_0x41fd37;_0x4bce59<_0x15acc8[_0x3e78('0x1a')];_0x4bce59+=0x1){_0x41fd37=_0x15acc8[_0x4bce59][_0x3e78('0x51')]({'plain':!![]});switch(_0x41fd37[_0x3e78('0x4e')]){case _0x3e78('0x5a'):_0xf583e[_0x3e78('0x2e')](db['sequelize']['query'](_0x14e501(_0x41fd37,'CampaignId'))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));break;case _0x3e78('0x55'):_0xf583e[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x346c30(_0x41fd37,_0x3e78('0x5b')))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));break;default:_0xf583e[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x50c3c3(_0x41fd37,'CampaignId'))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));}}}return _0xf583e;})[_0x3e78('0x57')]();})[_0x3e78('0x54')](function(){return db[_0x3e78('0x59')][_0x3e78('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x3e78('0x4f')],'as':_0x3e78('0x58'),'where':{'id':LISTID}}]})[_0x3e78('0x54')](function(_0x2de6c2){var _0x175509=[];if(_0x2de6c2){for(var _0x15dfd4=0x0,_0x1c0641;_0x15dfd4<_0x2de6c2['length'];_0x15dfd4+=0x1){_0x1c0641=_0x2de6c2[_0x15dfd4]['get']({'plain':!![]});_0x175509[_0x3e78('0x2e')](db[_0x3e78('0x52')][_0x3e78('0x53')](_0x40d541(_0x1c0641,_0x3e78('0x5b')))[_0x3e78('0x54')](function(){})[_0x3e78('0x2f')](_0x3babd2()));}}return _0x175509;})['all']();})['catch'](function(_0x3e5322){logger['error'](_0x3e78('0x5c'),_0x3e78('0x5d'),_0x3e5322[_0x3e78('0x1d')]);});}var processPromises=function(_0x5cf09f){return BPromise[_0x3e78('0x57')](promises)[_0x3e78('0x54')](function(_0x397910){})[_0x3e78('0x2f')](function(_0x1536c5){logger[_0x3e78('0x18')](_0x3e78('0x5e'),JSON[_0x3e78('0x5f')](_0x1536c5));})['finally'](function(){socket[_0x3e78('0x60')](_0x3e78('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5cf09f){return _0x5cf09f[_0x3e78('0x62')]();}});};var endCsv=function(){return BPromise[_0x3e78('0x63')]()[_0x3e78('0x54')](function(){if(hopperContacts){return checkHopper();}})[_0x3e78('0x54')](function(){socket[_0x3e78('0x60')](_0x3e78('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3e78('0x64')](FILEPATH);}catch(_0x33612c){logger[_0x3e78('0x18')](_0x3e78('0x65'),JSON['stringify'](_0x33612c));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x3e78('0x66')](_0x3e78('0x67'));endCsv();});function main(){return BPromise[_0x3e78('0x63')]()[_0x3e78('0x54')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3e78('0x12')](',');return db[_0x3e78('0x2c')][_0x3e78('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3e78('0x54')](function(_0x56a665){var _0x521c01=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3e78('0x68')](_0x521c01,{'header':!![],'skipEmptyLines':!![],'step':function(_0x141268,_0x3a424a){total+=0x1;var _0x40eebb=total;promises[_0x3e78('0x2e')](checkRow(_0x141268,_0x56a665,_0x40eebb)[_0x3e78('0x54')](function(){success+=0x1;})[_0x3e78('0x2f')](function(_0x3ff71f){if(_0x3ff71f[_0x3e78('0x18')]){errors+=0x1;delete _0x3ff71f[_0x3e78('0x18')];}else if(_0x3ff71f[_0x3e78('0x69')]){duplicates+=0x1;delete _0x3ff71f[_0x3e78('0x69')];}rows[_0x3e78('0x2e')](_0x3ff71f);}));if(total%0xc8===0x0){_0x3a424a[_0x3e78('0x6a')]();return processPromises(_0x3a424a);}},'complete':function(){return processPromises()[_0x3e78('0x54')](function(){logger[_0x3e78('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1b16dc,_0x59aefb){logger[_0x3e78('0x66')](_0x3e78('0x6b'),JSON[_0x3e78('0x5f')](_0x1b16dc));endCsv();}});})[_0x3e78('0x2f')](function(_0x53723a){logger[_0x3e78('0x18')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x53723a));});}main(); \ No newline at end of file +var _0x631a=['inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','then','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','BlackLists','all','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/logger','api','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','Duplicate\x20Contact','CmContact','create','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper'];(function(_0x2d4a4a,_0x1670c3){var _0x4ac0c1=function(_0x455c3d){while(--_0x455c3d){_0x2d4a4a['push'](_0x2d4a4a['shift']());}};_0x4ac0c1(++_0x1670c3);}(_0x631a,0x11b));var _0xa631=function(_0x366939,_0xd1e5d5){_0x366939=_0x366939-0x0;var _0x575447=_0x631a[_0x366939];return _0x575447;};'use strict';var BPromise=require('bluebird');var util=require(_0xa631('0x0'));var _=require(_0xa631('0x1'));var fs=require('fs');var squel=require(_0xa631('0x2'));var Papa=require(_0xa631('0x3'));var Redis=require(_0xa631('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xa631('0x5'))(_0xa631('0x6'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa631('0x7')]));require(_0xa631('0x8'))[_0xa631('0x9')](socket);try{if(!process[_0xa631('0xa')][0x2]||process[_0xa631('0xa')][0x2]===_0xa631('0xb')||process[_0xa631('0xa')][0x2]===_0xa631('0xc')){throw new Error(_0xa631('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0xa631('0xa')][0x3]||process[_0xa631('0xa')][0x3]===_0xa631('0xb')||process[_0xa631('0xa')][0x3]===_0xa631('0xc')||!process[_0xa631('0xa')][0x4]||process[_0xa631('0xa')][0x4]==='undefined'||process[_0xa631('0xa')][0x4]==='null'){throw new Error(_0xa631('0xe'));}var FIELDS=_[_0xa631('0xf')](process['argv'][0x3][_0xa631('0x10')](','),process[_0xa631('0xa')][0x4][_0xa631('0x10')](','));if(!process[_0xa631('0xa')][0x5]||process[_0xa631('0xa')][0x5]===_0xa631('0xb')||process[_0xa631('0xa')][0x5]==='null'){throw new Error(_0xa631('0x11'));}var LISTID=process[_0xa631('0xa')][0x5];var COMPANYID=process[_0xa631('0xa')][0x6]&&process['argv'][0x6]!==_0xa631('0xb')&&process['argv'][0x6]!==_0xa631('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa631('0xa')][0x7]&&process[_0xa631('0xa')][0x7]!=='undefined'&&process[_0xa631('0xa')][0x7]!==_0xa631('0xc')?process[_0xa631('0xa')][0x7]:null;if(!process[_0xa631('0xa')][0x8]||process['argv'][0x8]===_0xa631('0xb')||process[_0xa631('0xa')][0x8]===_0xa631('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xa631('0xa')][0x8];}catch(_0x5c2018){logger['error'](_0x5c2018);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(_0x3cca31,_0xd81dbf,_0x295869,_0x16effb){var _0x2a3602={'message':_0xd81dbf};_0x2a3602[_0x3cca31]=!![];if(_0x295869){_0x2a3602[_0xa631('0x12')]=_0x295869;}if(_0x16effb){_0x2a3602['index']=_0x16effb;}return _0x2a3602;}function isEmail(_0x58efde){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))*$/[_0xa631('0x13')](_0x58efde);}function checkRow(_0x17b0a9,_0x4845e3,_0xafe721){return new BPromise(function(_0x351063,_0x57d208){if(_['isNil'](_0x17b0a9)){return _0x57d208(handleCheckRowError(_0xa631('0x14'),_0xa631('0x15'),null,_0xafe721));}if(_0x17b0a9[_0xa631('0x16')]&&_0x17b0a9[_0xa631('0x16')][_0xa631('0x17')]){var _0x394ac4=_[_0xa631('0x18')](_0x17b0a9[_0xa631('0x16')],_0xa631('0x19'))[_0xa631('0x1a')](';');return _0x57d208(handleCheckRowError('error',_0x394ac4,null,_0xafe721));}var _0x5100d0={};for(var _0x77d742 in FIELDS){if(FIELDS[_0xa631('0x1b')](_0x77d742)&&FIELDS[_0x77d742]){_0x5100d0[_0x77d742]=_0x17b0a9['data'][0x0][FIELDS[_0x77d742]]||_0x17b0a9[_0xa631('0x1c')][0x0]['\ufeff'+FIELDS[_0x77d742]];}}if(!_0x5100d0['firstName']){return _0x57d208(handleCheckRowError(_0xa631('0x14'),_0xa631('0x1d'),null,_0xafe721));}if(!_0x5100d0[_0xa631('0x1e')]){return _0x57d208(handleCheckRowError(_0xa631('0x14'),'phone\x20not\x20specified!',null,_0xafe721));}if(_0x5100d0[_0xa631('0x1f')]){var _0x14c587=moment(_0x5100d0['birthDate'],_0xa631('0x20'));if(!_0x14c587[_0xa631('0x21')]()){return _0x57d208(handleCheckRowError('error',_0xa631('0x22'),null,_0xafe721));}}if(_0x5100d0[_0xa631('0x23')]){if(!isEmail(_0x5100d0[_0xa631('0x23')])){return _0x57d208(handleCheckRowError(_0xa631('0x14'),_0xa631('0x24'),null,_0xafe721));}}_0x5100d0['ListId']=LISTID;_0x5100d0[_0xa631('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4845e3){var _0x48ebe2={};for(var _0x2a0ef9=0x0,_0x1236ed=DUPLICATES['length'];_0x2a0ef9<_0x1236ed;_0x2a0ef9+=0x1){_0x48ebe2[DUPLICATES[_0x2a0ef9]]=_0x5100d0[DUPLICATES[_0x2a0ef9]];}var _0x4162c1=_['find'](_0x4845e3,_0x48ebe2);if(_0x4162c1){return _0x57d208(handleCheckRowError('duplicate',_0xa631('0x26'),_0x4162c1,_0xafe721));}}return db[_0xa631('0x27')][_0xa631('0x28')](_0x5100d0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5100d0)})['then'](function(_0x3db54e){if(DUPLICATES&&DUPLICATES[_0xa631('0x17')]&&_0x4845e3){_0x4845e3[_0xa631('0x29')](_['pick'](_0x5100d0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3db54e['id'];return _0x351063();})[_0xa631('0x2a')](function(_0x29318d){return _0x57d208(handleCheckRowError(_0xa631('0x14'),_0xa631('0x2b')+(_0x29318d[_0xa631('0x19')]||JSON[_0xa631('0x2c')](_0x29318d)),null,_0xafe721));});});}function checkHopper(){function _0x2f6eed(){return function(_0x4632a7){logger[_0xa631('0x14')](_0xa631('0x2d'),_0xa631('0x2e'),util[_0xa631('0x2f')](_0x4632a7,{'showHidden':![],'depth':null}));};}var _0xe1a73=function(_0x4b6824,_0x5d8584){var _0x19c5a4=squel[_0xa631('0x30')]()[_0xa631('0x31')](_0xa631('0x32'))[_0xa631('0x33')]([_0xa631('0x1e'),_0xa631('0x34'),_0xa631('0x35'),_0xa631('0x36'),_0x5d8584,_0xa631('0x37'),_0xa631('0x38')],squel[_0xa631('0x39')]()[_0xa631('0x3a')](_0xa631('0x1e'),_0xa631('0x1e'))[_0xa631('0x3a')]('NOW()',_0xa631('0x34'))['field']('id',_0xa631('0x35'))[_0xa631('0x3a')](LISTID[_0xa631('0x3b')](),_0xa631('0x36'))[_0xa631('0x3a')](_0x4b6824['id'][_0xa631('0x3b')](),_0x5d8584)[_0xa631('0x3a')](_0xa631('0x3c'),'createdAt')['field'](_0xa631('0x3c'),_0xa631('0x38'))[_0xa631('0x3d')](_0xa631('0x3e'))[_0xa631('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa631('0x3f')](_0xa631('0x40'),LISTID[_0xa631('0x3b')]())['where'](_0xa631('0x41'))[_0xa631('0x3f')](_0xa631('0x42'),squel[_0xa631('0x39')]()[_0xa631('0x3a')]('phone')['from'](_0xa631('0x32'))[_0xa631('0x3f')](_0x5d8584+_0xa631('0x43'),_0x4b6824['id'][_0xa631('0x3b')]())))['toString']();return _0x19c5a4;};var _0x4186cc=function(_0x44179f,_0x4011dc){var _0x411ee4=squel[_0xa631('0x30')]()[_0xa631('0x31')](_0xa631('0x32'))[_0xa631('0x33')](['phone',_0xa631('0x34'),_0xa631('0x35'),_0xa631('0x36'),_0x4011dc,_0xa631('0x37'),_0xa631('0x38')],squel[_0xa631('0x39')]()['field'](_0xa631('0x1e'),'phone')[_0xa631('0x3a')](_0xa631('0x3c'),_0xa631('0x34'))['field']('id','ContactId')[_0xa631('0x3a')](LISTID['toString'](),'ListId')[_0xa631('0x3a')](_0x44179f['id'][_0xa631('0x3b')](),_0x4011dc)[_0xa631('0x3a')]('NOW()',_0xa631('0x37'))[_0xa631('0x3a')](_0xa631('0x3c'),'updatedAt')[_0xa631('0x3d')](_0xa631('0x3e'))[_0xa631('0x3f')]('deletedAt\x20IS\x20NULL')[_0xa631('0x3f')](_0xa631('0x40'),LISTID[_0xa631('0x3b')]())[_0xa631('0x3f')](_0xa631('0x44'),squel[_0xa631('0x45')](hopperContacts))[_0xa631('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xa631('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa631('0x39')]()[_0xa631('0x3a')](_0xa631('0x46'))[_0xa631('0x3d')](_0xa631('0x47'))[_0xa631('0x3f')](_0x4011dc+_0xa631('0x43'),_0x44179f['id'][_0xa631('0x3b')]()))[_0xa631('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa631('0x39')]()[_0xa631('0x3a')](_0xa631('0x1e'))[_0xa631('0x3d')](_0xa631('0x32'))[_0xa631('0x3f')](_0x4011dc+_0xa631('0x43'),_0x44179f['id']['toString']())))[_0xa631('0x3b')]();return _0x411ee4;};function _0x59057f(_0x40f28c,_0x443678){var _0x44de29=squel[_0xa631('0x30')]()[_0xa631('0x31')](_0xa631('0x32'))[_0xa631('0x33')]([_0xa631('0x1e'),_0xa631('0x34'),_0xa631('0x35'),_0xa631('0x36'),_0x443678,_0xa631('0x37'),_0xa631('0x38')],squel[_0xa631('0x39')]()[_0xa631('0x3a')]('phone',_0xa631('0x1e'))[_0xa631('0x3a')]('NOW()',_0xa631('0x34'))[_0xa631('0x3a')]('id',_0xa631('0x35'))[_0xa631('0x3a')](LISTID['toString'](),_0xa631('0x36'))[_0xa631('0x3a')](_0x40f28c['id'][_0xa631('0x3b')](),_0x443678)[_0xa631('0x3a')](_0xa631('0x3c'),'createdAt')[_0xa631('0x3a')](_0xa631('0x3c'),_0xa631('0x38'))[_0xa631('0x3d')](_0xa631('0x3e'))[_0xa631('0x3f')](_0xa631('0x48'))[_0xa631('0x3f')](_0xa631('0x40'),LISTID[_0xa631('0x3b')]())['where'](_0xa631('0x44'),squel[_0xa631('0x45')](hopperContacts))[_0xa631('0x3f')](_0xa631('0x41')))[_0xa631('0x3b')]();return _0x44de29;}function _0x1b20d(_0x3ce0db,_0x502290){var _0x13db84=squel[_0xa631('0x30')]()[_0xa631('0x31')](_0xa631('0x49'))[_0xa631('0x33')]([_0xa631('0x1e'),'ContactId',_0xa631('0x36'),_0x502290,_0xa631('0x37'),'updatedAt'],squel[_0xa631('0x39')]()['field'](_0xa631('0x1e'),'phone')['field']('id',_0xa631('0x35'))[_0xa631('0x3a')](LISTID[_0xa631('0x3b')](),_0xa631('0x36'))[_0xa631('0x3a')](_0x3ce0db['id'][_0xa631('0x3b')](),_0x502290)[_0xa631('0x3a')](_0xa631('0x3c'),_0xa631('0x37'))['field'](_0xa631('0x3c'),_0xa631('0x38'))[_0xa631('0x3d')]('cm_contacts')[_0xa631('0x3f')](_0xa631('0x48'))[_0xa631('0x3f')](_0xa631('0x40'),LISTID['toString']())[_0xa631('0x3f')]('id\x20IN\x20?',squel[_0xa631('0x45')](hopperContacts))['where'](_0xa631('0x41')))['toString']();return _0x13db84;}return db[_0xa631('0x4a')][_0xa631('0x4b')]({'where':{'type':_0xa631('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa631('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0xa631('0x4e')](function(_0x4e0670){var _0x4895be=[];if(_0x4e0670){var _0x15d433;for(var _0x5b728e=0x0,_0x413ef4;_0x5b728e<_0x4e0670[_0xa631('0x17')];_0x5b728e+=0x1){_0x413ef4=_0x4e0670[_0x5b728e][_0xa631('0x4f')]({'plain':!![]});switch(_0x413ef4[_0xa631('0x50')]){case _0xa631('0x51'):_0x4895be[_0xa631('0x29')](db[_0xa631('0x52')]['query'](_0x4186cc(_0x413ef4,_0xa631('0x53')))['then'](function(){})[_0xa631('0x2a')](_0x2f6eed()));break;case _0xa631('0x54'):_0x4895be['push'](db[_0xa631('0x52')]['query'](_0xe1a73(_0x413ef4,_0xa631('0x53')))[_0xa631('0x4e')](function(){})[_0xa631('0x2a')](_0x2f6eed()));break;default:_0x4895be['push'](db[_0xa631('0x52')][_0xa631('0x55')](_0x59057f(_0x413ef4,_0xa631('0x53')))['then'](function(){})[_0xa631('0x2a')](_0x2f6eed()));}}}return _0x4895be;})['all']()['then'](function(){return db[_0xa631('0x4a')][_0xa631('0x4b')]({'where':{'type':_0xa631('0x4c')},'attributes':['id'],'include':[{'model':db[_0xa631('0x4d')],'as':_0xa631('0x56'),'where':{'id':LISTID}}]})[_0xa631('0x4e')](function(_0x20581e){var _0x800fa4=[];if(_0x20581e){var _0x4f9cca;for(var _0x22de85=0x0,_0x379611;_0x22de85<_0x20581e[_0xa631('0x17')];_0x22de85+=0x1){_0x379611=_0x20581e[_0x22de85]['get']({'plain':!![]});_0x800fa4[_0xa631('0x29')](db[_0xa631('0x52')]['query'](_0x1b20d(_0x379611,'VoiceQueueId'))['then'](function(){})[_0xa631('0x2a')](_0x2f6eed()));}}return _0x800fa4;})[_0xa631('0x57')]();})['then'](function(){return db[_0xa631('0x58')][_0xa631('0x4b')]({'attributes':['id',_0xa631('0x50')],'include':[{'model':db['CmList'],'as':_0xa631('0x59'),'where':{'id':LISTID}}]})[_0xa631('0x4e')](function(_0x2de770){var _0x14335e=[];if(_0x2de770){for(var _0x3ab979=0x0,_0x36b0ff;_0x3ab979<_0x2de770['length'];_0x3ab979+=0x1){_0x36b0ff=_0x2de770[_0x3ab979][_0xa631('0x4f')]({'plain':!![]});switch(_0x36b0ff[_0xa631('0x50')]){case _0xa631('0x51'):_0x14335e['push'](db[_0xa631('0x52')][_0xa631('0x55')](_0x4186cc(_0x36b0ff,_0xa631('0x5a')))[_0xa631('0x4e')](function(){})[_0xa631('0x2a')](_0x2f6eed()));break;case _0xa631('0x54'):_0x14335e[_0xa631('0x29')](db[_0xa631('0x52')][_0xa631('0x55')](_0xe1a73(_0x36b0ff,_0xa631('0x5a')))[_0xa631('0x4e')](function(){})['catch'](_0x2f6eed()));break;default:_0x14335e['push'](db[_0xa631('0x52')][_0xa631('0x55')](_0x59057f(_0x36b0ff,_0xa631('0x5a')))[_0xa631('0x4e')](function(){})[_0xa631('0x2a')](_0x2f6eed()));}}}return _0x14335e;})[_0xa631('0x57')]();})[_0xa631('0x4e')](function(){return db[_0xa631('0x58')][_0xa631('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xa631('0x4d')],'as':_0xa631('0x56'),'where':{'id':LISTID}}]})[_0xa631('0x4e')](function(_0x28fe8a){var _0x263cb0=[];if(_0x28fe8a){for(var _0x169e04=0x0,_0x19515a;_0x169e04<_0x28fe8a[_0xa631('0x17')];_0x169e04+=0x1){_0x19515a=_0x28fe8a[_0x169e04][_0xa631('0x4f')]({'plain':!![]});_0x263cb0[_0xa631('0x29')](db[_0xa631('0x52')][_0xa631('0x55')](_0x1b20d(_0x19515a,_0xa631('0x5a')))[_0xa631('0x4e')](function(){})[_0xa631('0x2a')](_0x2f6eed()));}}return _0x263cb0;})[_0xa631('0x57')]();})[_0xa631('0x2a')](function(_0x2d8d5d){logger[_0xa631('0x14')](_0xa631('0x5b'),_0xa631('0x5c'),_0x2d8d5d['message']);});}var processPromises=function(_0x239bda){return BPromise[_0xa631('0x57')](promises)[_0xa631('0x4e')](function(_0x498b16){})['catch'](function(_0x2021ac){logger[_0xa631('0x14')](_0xa631('0x5d'),JSON[_0xa631('0x2c')](_0x2021ac));})['finally'](function(){socket[_0xa631('0x5e')](_0xa631('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x239bda){return _0x239bda[_0xa631('0x60')]();}});};var endCsv=function(){return BPromise[_0xa631('0x61')]()[_0xa631('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0xa631('0x4e')](function(){socket[_0xa631('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa631('0x62')](FILEPATH);}catch(_0x2513a8){logger[_0xa631('0x14')](_0xa631('0x63'),JSON[_0xa631('0x2c')](_0x2513a8));}finally{process[_0xa631('0x64')](0x0);}});};process['on'](_0xa631('0x65'),function(){logger['info'](_0xa631('0x66'));endCsv();});function main(){return BPromise[_0xa631('0x61')]()[_0xa631('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa631('0x10')](',');return db[_0xa631('0x27')][_0xa631('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa631('0x4e')](function(_0x157c53){var _0x4dfb34=fs[_0xa631('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa631('0x68')](_0x4dfb34,{'header':!![],'skipEmptyLines':!![],'step':function(_0x349a8b,_0x458690){total+=0x1;var _0x5b615f=total;promises['push'](checkRow(_0x349a8b,_0x157c53,_0x5b615f)['then'](function(){success+=0x1;})[_0xa631('0x2a')](function(_0xe4e9e8){if(_0xe4e9e8['error']){errors+=0x1;delete _0xe4e9e8[_0xa631('0x14')];}else if(_0xe4e9e8['duplicate']){duplicates+=0x1;delete _0xe4e9e8['duplicate'];}rows[_0xa631('0x29')](_0xe4e9e8);}));if(total%0xc8===0x0){_0x458690[_0xa631('0x69')]();return processPromises(_0x458690);}},'complete':function(){return processPromises()[_0xa631('0x4e')](function(){logger[_0xa631('0x6a')](_0xa631('0x6b'));endCsv();});},'error':function(_0x58b197,_0x2fdcee){logger[_0xa631('0x6a')](_0xa631('0x6c'),JSON[_0xa631('0x2c')](_0x58b197));endCsv();}});})['catch'](function(_0x14e30c){logger['error'](_0xa631('0x6d'),JSON['stringify'](_0x14e30c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2764c65..853ad9b 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 _0x52aa=['catch','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','includes','keys','header','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','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','contactId','orderBy','campaigns','CampaignId','campaigns_has_cm_blacklists','VoiceQueueId','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','cm_hopper_black','ContactId','createdAt','.CmListId\x20=\x20?','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','recallme','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','errors','code','spread'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x52aa,0x113));var _0xa52a=function(_0x5523af,_0x79c71f){_0x5523af=_0x5523af-0x0;var _0x40af25=_0x52aa[_0x5523af];return _0x40af25;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa52a('0x0'));var Papa=require(_0xa52a('0x1'));var util=require(_0xa52a('0x2'));var BPromise=require(_0xa52a('0x3'));var moment=require(_0xa52a('0x4'));var squel=require(_0xa52a('0x5'));var Redis=require(_0xa52a('0x6'));var db=require(_0xa52a('0x7'))['db'];var config=require(_0xa52a('0x8'));var shared=require(_0xa52a('0x9'));var logger=require(_0xa52a('0xa'))('import');config['redis']=_[_0xa52a('0xb')](config[_0xa52a('0xc')],{'host':_0xa52a('0xd'),'port':0x18eb});var socket=require(_0xa52a('0xe'))(new Redis(config[_0xa52a('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa52a('0xf')](_0xa52a('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa52a('0xf')](_0xa52a('0x10'));function isEmail(_0x2a575f){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'](_0x2a575f);}function selectNotIn(_0x430d35,_0x547708,_0xf9948,_0x293749,_0x2a9e5c){return squel[_0xa52a('0x11')]()[_0xa52a('0x12')](_0xa52a('0x13'))[_0xa52a('0x14')](_0x293749)[_0xa52a('0x15')](_0x547708,null,_0x547708+_0xa52a('0x16')+_0x293749+'.'+_0xf9948)[_0xa52a('0x17')](_0x293749+'.'+_0xf9948+_0xa52a('0x18')+_0x430d35+'.'+_0xf9948)[_0xa52a('0x17')](_0x547708+_0xa52a('0x19')+_0x2a9e5c['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x56a2d2,_0x64faab){promisesAdditionalPhones=[];return db[_0xa52a('0x1a')]['findAll']({'raw':!![],'attributes':['id',_0xa52a('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa52a('0x1c')](function(_0x1380b1){if(_0x1380b1!==null){var _0x3b6cf7=[];for(var _0xa0faac=0x0;_0xa0faac<_0x1380b1[_0xa52a('0x1d')];_0xa0faac++){var _0x6e2ef1=_0x1380b1[_0xa0faac];_0x3b6cf7[_0xa52a('0x1e')](insertAdditionalPhones(_0x6e2ef1));}}Promise[_0xa52a('0x1f')](_0x3b6cf7)[_0xa52a('0x1c')](function(){_0x56a2d2({'val':0x1});});});});}function insertAdditionalPhones(_0x5e0018){return new Promise(function(_0x1e2cc8,_0x139634){var _0x1738bf=_0x5e0018[_0xa52a('0x1b')];var _0xf726ff=_0x1738bf[_0xa52a('0x20')](';');var _0x5d0fe4=[];orderBy=0x0;for(var _0x357887=0x0;_0x357887<_0xf726ff[_0xa52a('0x1d')];_0x357887++){_0x5d0fe4[_0xa52a('0x1e')](splitAdditionalPhone(_0x5e0018['id'],_0xf726ff[_0x357887]));}Promise[_0xa52a('0x1f')](_0x5d0fe4)['then'](function(){_0x1e2cc8({'val':_0xf726ff[_0xa52a('0x1d')]});});});}function splitAdditionalPhone(_0x2b62bc,_0x377a58){return new Promise(function(_0x327f82,_0x13ef38){var _0x4c8361=_0x377a58[_0xa52a('0x20')](':');var _0x5de947=_0x4c8361[0x0];var _0x56f900=_0x4c8361[0x1];if(!_[_0xa52a('0x21')](_0x56f900)){var _0x1de0a5=_0x56f900['split']('|');var _0x55dbce=[];for(var _0x14f9cc=0x0;_0x14f9cc<_0x1de0a5[_0xa52a('0x1d')];_0x14f9cc++){if(_0x1de0a5[_0x14f9cc]!==''){var _0x485383=_[_0xa52a('0x22')](promisesAdditionalPhones,{'contactId':_0x2b62bc,'phone':_0x1de0a5[_0x14f9cc]});if(_0x485383[_0xa52a('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xa52a('0x1e')]({'contactId':_0x2b62bc,'contactTypeId':_0x5de947,'phone':_0x1de0a5[_0x14f9cc],'orderBy':orderBy});}}}_0x327f82({'ok':0x1});}else _0x327f82({'res':0x0});});}function createAdditionalPhone(_0x443c38,_0x286280,_0x269431,_0x3f2e9e){var _0x2043c3='';var _0x3deb96='';var _0x1e8ff6=_0x269431[_0xa52a('0x20')]('§');_0x2043c3=_0x1e8ff6[0x0];if(_0x1e8ff6[_0xa52a('0x1d')]==0x2)_0x3deb96=_0x1e8ff6[0x1];return new Promise(function(_0x512341,_0x2658ec){return db[_0xa52a('0x23')][_0xa52a('0x24')]({'where':{'CmContactId':_0x443c38,'item':_0x2043c3}})[_0xa52a('0x1c')](function(_0x950f7e){if(_0x950f7e){return db['CmContactHasItem'][_0xa52a('0x25')]({'ItemTypeId':_0x286280,'description':_0x3deb96,'OrderBy':_0x3f2e9e},{'where':{'CmContactId':_0x443c38,'item':_0x2043c3}})[_0xa52a('0x1c')](function(_0x45bbbe){_0x512341({'res':'updated'});});}else{return db['CmContactHasItem'][_0xa52a('0x26')]({'CmContactId':_0x443c38,'item':_0x2043c3,'description':_0x3deb96,'ItemTypeId':_0x286280,'OrderBy':_0x3f2e9e,'ItemClass':_0xa52a('0x27')})[_0xa52a('0x1c')](function(_0x5d234b){_0x512341({'res':_0xa52a('0x28')});});}});});}function insertCmHopper(_0x37dbbb,_0x552fc5,_0x38c371,_0x3a7ccf,_0xecbed7){var _0x1aea52=[_0xa52a('0x29'),_0xa52a('0x2a'),_0xa52a('0x2b'),_0xa52a('0x2c'),_0x552fc5+'.'+_0x3a7ccf,'cm_contacts.createdAt',_0xa52a('0x2d'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0xecbed7+'\x22'];return squel[_0xa52a('0x2e')]()[_0xa52a('0x2f')](_0xa52a('0x30'))[_0xa52a('0x31')](['phone',_0xa52a('0x32'),'ContactId',_0xa52a('0x33'),_0x3a7ccf,'createdAt',_0xa52a('0x34'),_0xa52a('0x35'),_0xa52a('0x36'),'recallme'],squel['select']()[_0xa52a('0x37')](_0x1aea52)[_0xa52a('0x14')](_0x552fc5)[_0xa52a('0x15')](_0xa52a('0x38'),null,_0xa52a('0x39')+_0x552fc5+_0xa52a('0x3a'))[_0xa52a('0x15')](_0x38c371,null,_0x38c371+_0xa52a('0x16')+_0x552fc5+'.'+_0x3a7ccf)['where'](_0x552fc5+'.CmListId\x20=\x20?',_0x37dbbb)['where'](_0xa52a('0x3b'),NOW)[_0xa52a('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x552fc5,_0x38c371,_0x3a7ccf,'cm_hopper',[_0xa52a('0x3c'),'\x22onlyIfOpen\x22']))[_0xa52a('0x17')](_0xa52a('0x3d'),selectNotIn(_0x552fc5,_0x38c371,_0x3a7ccf,_0xa52a('0x30'),[_0xa52a('0x3c')])))['toString']();}function insertCmHopperBlack(_0x444bc8,_0x163a1c,_0x5bb3a3,_0x4fc040){var _0x5ffb0f=[_0xa52a('0x29'),_0xa52a('0x2b'),'cm_contacts.ListId',_0x163a1c+'.'+_0x4fc040,_0xa52a('0x3e'),'cm_contacts.updatedAt'];return squel[_0xa52a('0x2e')]()[_0xa52a('0x2f')](_0xa52a('0x3f'))[_0xa52a('0x31')]([_0xa52a('0x13'),_0xa52a('0x40'),_0xa52a('0x33'),_0x4fc040,_0xa52a('0x41'),'updatedAt'],squel[_0xa52a('0x11')]()[_0xa52a('0x37')](_0x5ffb0f)[_0xa52a('0x14')](_0x163a1c)[_0xa52a('0x15')]('cm_contacts',null,_0xa52a('0x39')+_0x163a1c+'.CmListId')[_0xa52a('0x15')](_0x5bb3a3,null,_0x5bb3a3+'.id\x20=\x20'+_0x163a1c+'.'+_0x4fc040)['where'](_0x163a1c+_0xa52a('0x42'),_0x444bc8)['where'](_0xa52a('0x3b'),NOW)[_0xa52a('0x17')](_0xa52a('0x3d'),squel[_0xa52a('0x11')]()['field'](_0xa52a('0x13'))['from'](_0xa52a('0x3f'))[_0xa52a('0x17')](_0xa52a('0x43'),_0x444bc8)[_0xa52a('0x17')](_0x4fc040+_0xa52a('0x18')+_0x163a1c+'.'+_0x4fc040)))[_0xa52a('0x44')]();}function insertTzCmHopper(_0x373f29,_0x53d670,_0x1e6b55,_0x3c2c8d,_0x5ebe90,_0x5f5a9e){var _0x579ef9=[_0xa52a('0x29'),_0xa52a('0x45')+_0x5f5a9e+_0xa52a('0x46'),'cm_contacts.id',_0xa52a('0x2c'),_0x53d670+'.'+_0x3c2c8d,_0xa52a('0x3e'),_0xa52a('0x2d'),'cm_contacts.priority',_0xa52a('0x47'),'\x22'+_0x5ebe90+'\x22'];var _0x454fbf=squel[_0xa52a('0x2e')]()[_0xa52a('0x2f')](_0xa52a('0x30'))[_0xa52a('0x31')]([_0xa52a('0x13'),_0xa52a('0x32'),_0xa52a('0x40'),'ListId',_0x3c2c8d,_0xa52a('0x41'),_0xa52a('0x34'),_0xa52a('0x35'),_0xa52a('0x36'),_0xa52a('0x48')],squel['select']()[_0xa52a('0x37')](_0x579ef9)[_0xa52a('0x14')](_0x53d670)[_0xa52a('0x15')](_0xa52a('0x38'),null,_0xa52a('0x39')+_0x53d670+_0xa52a('0x3a'))[_0xa52a('0x15')](_0x1e6b55,null,_0x1e6b55+_0xa52a('0x16')+_0x53d670+'.'+_0x3c2c8d)['join'](_0x5f5a9e,null,_0x5f5a9e+_0xa52a('0x16')+_0x53d670+'.'+_0x3c2c8d)[_0xa52a('0x17')](_0x53d670+'.CmListId\x20=\x20?',_0x373f29)['where'](_0xa52a('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x53d670,_0x1e6b55,_0x3c2c8d,'cm_hopper',[_0xa52a('0x3c'),_0xa52a('0x49')]))['where'](_0xa52a('0x3d'),selectNotIn(_0x53d670,_0x1e6b55,_0x3c2c8d,_0xa52a('0x30'),[_0xa52a('0x3c')])))[_0xa52a('0x44')]();return _0x454fbf;}function insertTzCmHopperBlack(_0x19f41a,_0x1266c3,_0x3ad06f,_0x1f95b6){var _0x24c8c2=[_0xa52a('0x29'),'cm_contacts.id',_0xa52a('0x2c'),_0x1266c3+'.'+_0x1f95b6,_0xa52a('0x3e'),_0xa52a('0x2d')];return squel['insert']()['into'](_0xa52a('0x3f'))[_0xa52a('0x31')]([_0xa52a('0x13'),'ContactId',_0xa52a('0x33'),_0x1f95b6,_0xa52a('0x41'),'updatedAt'],squel['select']()[_0xa52a('0x37')](_0x24c8c2)[_0xa52a('0x14')](_0x1266c3)[_0xa52a('0x15')](_0xa52a('0x38'),null,_0xa52a('0x39')+_0x1266c3+_0xa52a('0x3a'))[_0xa52a('0x15')](_0x3ad06f,null,_0x3ad06f+_0xa52a('0x16')+_0x1266c3+'.'+_0x1f95b6)[_0xa52a('0x17')](_0x1266c3+_0xa52a('0x42'),_0x19f41a)[_0xa52a('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa52a('0x17')](_0xa52a('0x3d'),squel[_0xa52a('0x11')]()[_0xa52a('0x12')](_0xa52a('0x13'))[_0xa52a('0x14')]('cm_hopper_black')['where'](_0xa52a('0x43'),_0x19f41a)['where'](_0x1f95b6+_0xa52a('0x18')+_0x1266c3+'.'+_0x1f95b6)))[_0xa52a('0x44')]();}function insertCmHopperAdditionalPhones(_0xcf4f0){var _0x27efc5=[_0xa52a('0x4a'),'cm_contact_has_items.item',_0xa52a('0x4b'),_0xa52a('0x4c'),_0xa52a('0x4d')];return squel['insert']()['into'](_0xa52a('0x4e'))[_0xa52a('0x31')]([_0xa52a('0x4f'),'phone',_0xa52a('0x50'),_0xa52a('0x41'),_0xa52a('0x34')],squel[_0xa52a('0x11')]()[_0xa52a('0x37')](_0x27efc5)[_0xa52a('0x14')](_0xa52a('0x30'))[_0xa52a('0x15')](_0xa52a('0x38'),null,_0xa52a('0x51'))[_0xa52a('0x15')](_0xa52a('0x52'),null,_0xa52a('0x53'))[_0xa52a('0x17')]('cm_hopper.ListId\x20=\x20?',_0xcf4f0)[_0xa52a('0x17')](_0xa52a('0x3b'),NOW))[_0xa52a('0x44')]();}function insertCmContact(_0x205d6a,_0xd0db3d,_0x3aa9da,_0x2f5e1c){var _0x113b9a=_[_0xa52a('0x54')](_['keys'](_0x2f5e1c),['ListId',_0xa52a('0x55'),'createdAt',_0xa52a('0x34')]);return squel[_0xa52a('0x2e')]()['into'](_0xa52a('0x38'))[_0xa52a('0x31')](_0x113b9a,squel['select']()[_0xa52a('0x37')](_0x113b9a)[_0xa52a('0x14')](_0xd0db3d)[_0xa52a('0x17')]('('+_0x3aa9da['join'](',')+_0xa52a('0x56'),squel[_0xa52a('0x11')]()[_0xa52a('0x37')](_0x3aa9da)['from']('cm_contacts')[_0xa52a('0x17')]('ListId\x20=\x20?',_0x205d6a)[_0xa52a('0x17')]('deletedAt\x20IS\x20NULL'))[_0xa52a('0x17')](_0xa52a('0x57'),squel[_0xa52a('0x11')]()['field'](_0xa52a('0x58'),'min_id')[_0xa52a('0x14')](_0xd0db3d)[_0xa52a('0x59')](_0x3aa9da['join'](','))))[_0xa52a('0x44')]();}function handleStop(){logger[_0xa52a('0x5a')](_0xa52a('0x5b'));stopped=!![];}function handleUncaughtException(_0x428030){logger[_0xa52a('0x5c')](_0x428030[_0xa52a('0x5d')]);process['exit'](0x1);}function handleError(_0x255ac0,_0xa1c0a0){stats[_0xa52a('0x5e')][_0xa52a('0x1e')]({'name':_0xa1c0a0[_0xa52a('0x5f')],'message':_0xa1c0a0[_0xa52a('0x5d')],'row':_0x255ac0});}function handleQuery(_0x14c081){logger['info'](_0x14c081);return db['sequelize']['query'](_0x14c081)[_0xa52a('0x60')](function(_0x2a0a2f){results['push'](_0x2a0a2f);})[_0xa52a('0x61')](function(_0x98a0d){logger['error'](_0x98a0d['message']);});}function updateTzCampaigns(_0x43e37e){return new Promise(function(_0x5775e7,_0x40082e){var _0x13e129=squel[_0xa52a('0x11')]()[_0xa52a('0x37')](['campaigns.id',_0xa52a('0x62')])[_0xa52a('0x14')]('campaigns')[_0xa52a('0x15')](_0xa52a('0x63'),null,_0xa52a('0x64'))[_0xa52a('0x17')](_0xa52a('0x65')+_0x43e37e);db[_0xa52a('0x66')][_0xa52a('0x67')](_0x13e129[_0xa52a('0x44')]())['spread'](function(_0x1b5e98){var _0x3595f4=[];for(var _0x41c1e7=0x0;_0x41c1e7<_0x1b5e98[_0xa52a('0x1d')];_0x41c1e7++){_0x3595f4[_0xa52a('0x1e')](getTimezoneData(_0x1b5e98[_0x41c1e7],tmp_campaigns));}BPromise[_0xa52a('0x1f')](_0x3595f4)[_0xa52a('0x1c')](function(){_0x5775e7({'val':0x1});});})[_0xa52a('0x61')](function(_0x20bc58){logger[_0xa52a('0x5c')](_0x20bc58[_0xa52a('0x5d')]);_0x5775e7({'val':0x0});});});}function updateTzVoiceQueues(_0x1038c6){return new Promise(function(_0x597377,_0x1bf158){var _0x2c950b=squel['select']()[_0xa52a('0x37')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0xa52a('0x68'))['join'](_0xa52a('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xa52a('0x17')](_0xa52a('0x6a')+_0x1038c6);db[_0xa52a('0x66')]['query'](_0x2c950b['toString']())[_0xa52a('0x60')](function(_0x48df2d){var _0x2b084a=[];for(var _0xcfef95=0x0;_0xcfef95<_0x48df2d['length'];_0xcfef95++){_0x2b084a['push'](getTimezoneData(_0x48df2d[_0xcfef95],tmp_voice_queues));}BPromise[_0xa52a('0x1f')](_0x2b084a)[_0xa52a('0x1c')](function(){_0x597377({'val':0x1});});})[_0xa52a('0x61')](function(_0x388736){logger[_0xa52a('0x5c')](_0x388736[_0xa52a('0x5d')]);_0x597377({'val':0x0});});});}function getTimezoneData(_0x726f1e,_0x2aec5f){return new Promise(function(_0x506f86,_0x2a8ea3){var _0x162023=shared[_0xa52a('0x6b')];var _0x39710b=_0x162023[_0x726f1e[_0xa52a('0x6c')]];if(_[_0xa52a('0x21')](_0x39710b)){_0x506f86({'ret':0x1});}else{var _0x196680=_0x39710b[_0xa52a('0x6d')];var _0x2b095e=squel[_0xa52a('0x2e')]()['into'](_0x2aec5f)[_0xa52a('0x6e')]('id',_0x726f1e['id'])[_0xa52a('0x6e')]('offset',_0x196680)['set'](_0xa52a('0x6c'),_0x726f1e[_0xa52a('0x6c')])[_0xa52a('0x44')]();return db[_0xa52a('0x66')][_0xa52a('0x67')](_0x2b095e)[_0xa52a('0x60')](function(_0xe6599){_0x506f86({'ret':0x1});})['catch'](function(_0x1daec0){logger['error'](_0x1daec0[_0xa52a('0x5d')]);_0x2a8ea3({'ret':0x1});});}});}function handleTZQuery(_0x438bb8){logger[_0xa52a('0x5a')](_0x438bb8);return db[_0xa52a('0x66')][_0xa52a('0x67')](_0x438bb8)[_0xa52a('0x60')](function(_0x16a974){})['catch'](function(_0x46e55b){logger['error'](_0x46e55b['message']);});}function main(_0x221022,_0x5bf935,_0x42306b,_0x2b90a9){logger[_0xa52a('0x5a')](_0xa52a('0x6f'),_0x221022,JSON[_0xa52a('0x70')](_0x5bf935));process[_0xa52a('0x71')](_0xa52a('0x72'));var _0x5e3e88=_0x5bf935[_0xa52a('0x73')];var _0x520341=_[_0xa52a('0x74')](_0x5e3e88);var _0x44661e=_0x5bf935['socket_timestamp'];var _0x4bfc64=path['join'](config[_0xa52a('0x75')],_0xa52a('0x76'),_0x44661e+_0xa52a('0x77'));hasTZ=_['keys'](_0x5e3e88)[_0xa52a('0x78')]('dialTimezone');var _0x1208be=_[_0xa52a('0x79')](_0x5e3e88)[_0xa52a('0x15')]();logger[_0xa52a('0x5a')](_0xa52a('0x7a'),_0x1208be);db[_0xa52a('0x7b')][_0xa52a('0x7c')]({'raw':!![],'attributes':['id',_0xa52a('0x7d')]})['then'](function(_0x33b697){for(var _0x4716ac=0x0;_0x4716ac<_0x33b697[_0xa52a('0x1d')];_0x4716ac++){if(_0x33b697[_0x4716ac]['name']in _0x5e3e88){contactItemTypes[_0xa52a('0x1e')](_0x33b697[_0x4716ac]);delete _0x520341[_0x33b697[_0x4716ac][_0xa52a('0x7d')]];hasAdditionalPhones=!![];}for(var _0x3ea963 in _0x5e3e88){if(_0x33b697[_0x4716ac][_0xa52a('0x7d')]+_0xa52a('0x7e')===_0x3ea963){phoneDescriptions[_0xa52a('0x1e')]({'itemTypeId':_0x33b697[_0x4716ac]['id'],'description':_0x3ea963});delete _0x520341[_0x3ea963];}}}if(hasAdditionalPhones)_0x520341[_0xa52a('0x1b')]='';var _0x5f3fc5=_[_0xa52a('0x79')](_0x520341)[_0xa52a('0x15')]();logger[_0xa52a('0x5a')](_0xa52a('0x7a'),_0x5f3fc5);fs[_0xa52a('0x7f')](_0x4bfc64,_0x5f3fc5+'\x0a');Papa[_0xa52a('0x80')](fs[_0xa52a('0x81')](_0x221022),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54c764,_0x5ad312){try{for(var _0x3f2f61=0x0,_0x5c7650=[];_0x3f2f61<_0x54c764[_0xa52a('0x82')][_0xa52a('0x1d')];_0x3f2f61++){stats[_0xa52a('0x83')]+=0x1;if(_0x54c764['errors'][_0x3f2f61]){handleError(_0x54c764[_0xa52a('0x82')][_0x3f2f61],_0x54c764[_0xa52a('0x5e')][_0x3f2f61]);}else{var _0x11a7be=[];var _0x28e775=[];var _0x4c80c4={};for(var _0x3fc430 in _0x5e3e88){let _0x46c7ef=contactItemTypes[_0xa52a('0x84')](_0x562ca9=>_0x562ca9[_0xa52a('0x7d')]===_0x3fc430);let _0x1752df=contactItemTypes[_0xa52a('0x84')](_0x2294a0=>_0x2294a0[_0xa52a('0x7d')]+_0xa52a('0x7e')===_0x3fc430);if(_['isNil'](_0x46c7ef)&&_[_0xa52a('0x21')](_0x1752df)){if(_0x5e3e88[_0xa52a('0x85')](_0x3fc430)){if(_0x54c764[_0xa52a('0x82')][_0x3f2f61][_0x5e3e88[_0x3fc430]]){var _0x2aa687=_[_0xa52a('0x86')](_0x54c764[_0xa52a('0x82')][_0x3f2f61][_0x5e3e88[_0x3fc430]][_0xa52a('0x87')](/"/g,'\x27'));switch(_0x3fc430){case _0xa52a('0x32'):var _0x264da8=moment(_0x2aa687,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x264da8[_0xa52a('0x88')]()){_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x2aa687+'\x22');}else{_0x11a7be[_0xa52a('0x1e')](_0xa52a('0x89'));}break;case _0xa52a('0x35'):var _0x52e5c6=parseInt(_0x2aa687);_0x2aa687=_[_0xa52a('0x8a')](_0x52e5c6)||_0x52e5c6<0x0||_0x52e5c6>0x4?_0x2b90a9?0x3:0x2:_0x52e5c6;_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x2aa687+'\x22');break;case'UserId':var _0x57d6f7=parseInt(_0x2aa687);if(_[_0xa52a('0x8b')](_0x57d6f7)&&_[_0xa52a('0x78')](_0x42306b,_0x57d6f7)){_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x57d6f7+'\x22');}else{_0x11a7be['push'](_0xa52a('0x8c'));}break;case'email':if(isEmail(_0x2aa687)){_0x5c7650['push']('\x22'+_0x2aa687+'\x22');}else{_0x11a7be[_0xa52a('0x1e')](_0xa52a('0x8d'));}break;case'dateOfBirth':var _0x54f617=moment(_0x2aa687,_0xa52a('0x8e'),!![]);if(_0x54f617[_0xa52a('0x88')]()){_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x2aa687+'\x22');}else{_0x11a7be[_0xa52a('0x1e')](_0xa52a('0x8f'));}break;case _0xa52a('0x6c'):var _0x104488=shared[_0xa52a('0x6b')];var _0x3fe335=_0x104488[_0x2aa687];if(!_[_0xa52a('0x21')](_0x3fe335)){var _0xc1585a=_0x3fe335[_0xa52a('0x6d')];_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x2aa687+'\x22');_0x5c7650['push']('\x22'+_0xc1585a+'\x22');}break;default:_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x2aa687+'\x22');}}else{switch(_0x3fc430){case _0xa52a('0x90'):case _0xa52a('0x13'):_0x11a7be[_0xa52a('0x1e')](_0x3fc430+'\x20not\x20specified');break;default:_0x5c7650[_0xa52a('0x1e')]('\x22\x22');}}}}else{var _0x43b903='';if(!_['isNil'](_0x46c7ef)){if(!_0x4c80c4['hasOwnProperty'](_0x46c7ef['id'])){if(!_[_0xa52a('0x21')](_0x54c764[_0xa52a('0x82')][_0x3f2f61][_0x5e3e88[_0x3fc430]])){var _0x2aa687=_[_0xa52a('0x86')](_0x54c764[_0xa52a('0x82')][_0x3f2f61][_0x5e3e88[_0x3fc430]][_0xa52a('0x87')](/"/g,'\x27'));var _0x534614=phoneDescriptions[_0xa52a('0x84')](_0x9f74c0=>_0x9f74c0[_0xa52a('0x91')]===_0x46c7ef['id']);if(!_[_0xa52a('0x21')](_0x534614)){var _0x52d3b0=_[_0xa52a('0x86')](_0x54c764[_0xa52a('0x82')][_0x3f2f61][_0x5e3e88[_0x534614[_0xa52a('0x92')]]][_0xa52a('0x87')](/"/g,'\x27'));if(!_[_0xa52a('0x21')](_0x52d3b0))_0x2aa687=_0x2aa687+'§'+_0x52d3b0;}if(_0x43b903=='')_0x43b903=_0x2aa687;else _0x43b903+='|'+_0x2aa687;}_0x28e775['push'](_0x46c7ef['id']+':'+_0x43b903);_0x4c80c4[_0x46c7ef['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5c7650[_0xa52a('0x1e')]('\x22'+_0x28e775['join'](';')+'\x22');}if(_0x11a7be[_0xa52a('0x1d')]){handleError(_0x54c764['data'][_0x3f2f61],{'code':_0xa52a('0x93'),'message':_0x11a7be['join']()});}else{fs[_0xa52a('0x94')](_0x4bfc64,_0x5c7650[_0xa52a('0x15')]()+'\x0a');}_0x5c7650=[];}if(!(stats[_0xa52a('0x83')]%0xc8)){socket['emit'](_0xa52a('0x95')+_0x44661e,stats);stats[_0xa52a('0x5e')]=[];}}if(stopped){logger[_0xa52a('0x5a')](_0xa52a('0x96'));_0x5ad312[_0xa52a('0x97')]();}}catch(_0xdb0310){handleError(_0x54c764[_0xa52a('0x82')][_0x3f2f61],{'code':_0xa52a('0x98'),'message':_0xdb0310[_0xa52a('0x5d')]});logger['error'](_0xa52a('0x99'),_0xdb0310['message']);}},'complete':function(){try{var _0xaf890a=[];var _0x4035bf=[];var _0x46f36b=_0xa52a('0x38');if(_0x5bf935[_0xa52a('0x9a')]&&_0x5bf935['duplicates'][_0xa52a('0x1d')]){_0x46f36b='cm_contacts_'+_0x44661e;_0xaf890a['push'](_0xa52a('0x9b')+_0x46f36b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa52a('0x9c')+_0x44661e;tmp_voice_queues=_0xa52a('0x9d')+_0x44661e;_0x4035bf[_0xa52a('0x1e')](_0xa52a('0x9b')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x4035bf[_0xa52a('0x1e')](_0xa52a('0x9b')+tmp_voice_queues+_0xa52a('0x9e'));BPromise[_0xa52a('0x9f')](_0x4035bf,handleTZQuery)[_0xa52a('0x1c')](function(_0x251fec){updateTzCampaigns(_0x5bf935[_0xa52a('0x33')])['then'](function(_0x4c15a9){updateTzVoiceQueues(_0x5bf935[_0xa52a('0x33')])[_0xa52a('0x1c')](function(_0x37e051){if(hasTZ)_0x5f3fc5=_0x5f3fc5[_0xa52a('0x87')](_0xa52a('0x6c'),_0xa52a('0xa0'));var _0x2d08f2=util[_0xa52a('0xf')](_0xa52a('0xa1'),_0x4bfc64,_0x46f36b,_0x5f3fc5,_0x5bf935['ListId'],_0x5bf935[_0xa52a('0x55')]||null,NOW,NOW);if(_[_0xa52a('0x21')](_0x5e3e88[_0xa52a('0x32')])){_0x2d08f2+=_0xa52a('0xa2');}_0xaf890a[_0xa52a('0x1e')](_0x2d08f2);if(_0x5bf935['duplicates']&&_0x5bf935[_0xa52a('0x9a')][_0xa52a('0x1d')]){_0xaf890a[_0xa52a('0x1e')](insertCmContact(_0x5bf935[_0xa52a('0x33')],_0x46f36b,_0x5bf935[_0xa52a('0x9a')],_0x5e3e88));_0xaf890a[_0xa52a('0x1e')](_0xa52a('0xa3')+_0x46f36b+';');}BPromise[_0xa52a('0x9f')](_0xaf890a,handleQuery)[_0xa52a('0x1c')](function(_0x51dfde){BPromise[_0xa52a('0x1f')]([handleAdditionalPhones()])[_0xa52a('0x1c')](function(){_0xaf890a=[];for(var _0xbae125=0x0;_0xbae125\x20\x20');}var _0x27b61d=path[_0xa52a('0x15')](config[_0xa52a('0x75')],_0xa52a('0x76'),process[_0xa52a('0xae')][0x2]);if(!fs[_0xa52a('0xaf')](_0x27b61d)){throw new Error(_0xa52a('0xb0'));}var _0x1307d7={};try{_0x1307d7=JSON['parse'](process[_0xa52a('0xae')][0x3]);if(!_0x1307d7[_0xa52a('0x73')]){throw new Error(_0xa52a('0xb1'));}if(!_0x1307d7[_0xa52a('0x73')]['phone']){throw new Error(_0xa52a('0xb2'));}if(!_0x1307d7[_0xa52a('0x73')][_0xa52a('0x90')]){throw new Error(_0xa52a('0xb3'));}var _0x2371a8=0x0;if(_0x1307d7['binding'][_0xa52a('0x36')]){_0x2371a8=0x1;}if(!_0x1307d7[_0xa52a('0x33')]){throw new Error(_0xa52a('0xb4'));}}catch(_0x30b3d8){throw new Error(_0xa52a('0xb5'));}var _0x400e90=[];try{_0x400e90=_[_0xa52a('0xb6')](JSON['parse'](process[_0xa52a('0xae')][0x4]),'id');}catch(_0xb0d3f9){logger[_0xa52a('0x5a')](_0xa52a('0xb7'));}main(_0x27b61d,_0x1307d7,_0x400e90,_0x2371a8);}validate();process['on'](_0xa52a('0xb8'),handleStop);process['on'](_0xa52a('0xb9'),handleUncaughtException); \ No newline at end of file +var _0x8ee8=['\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','updatedAt','cm_contacts.phone\x20NOT\x20IN\x20(?)','field','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists.CmListId=','query','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','all','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv','header','name','_description','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim','replace','isValid','isNaN','UserId','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','contactTypeId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','.id\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','AdditionalPhones','then','push','length','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','priority','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x8ee8,0x1dd));var _0x88ee=function(_0x3ee8b1,_0x375088){_0x3ee8b1=_0x3ee8b1-0x0;var _0x53aa77=_0x8ee8[_0x3ee8b1];return _0x53aa77;};'use strict';var fs=require('fs');var path=require(_0x88ee('0x0'));var _=require('lodash');var Papa=require(_0x88ee('0x1'));var util=require('util');var BPromise=require(_0x88ee('0x2'));var moment=require(_0x88ee('0x3'));var squel=require(_0x88ee('0x4'));var Redis=require(_0x88ee('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x88ee('0x6'));var shared=require(_0x88ee('0x7'));var logger=require(_0x88ee('0x8'))(_0x88ee('0x9'));config[_0x88ee('0xa')]=_[_0x88ee('0xb')](config[_0x88ee('0xa')],{'host':_0x88ee('0xc'),'port':0x18eb});var socket=require(_0x88ee('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x88ee('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x88ee('0xe'));function isEmail(_0x1a1a0f){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))*$/[_0x88ee('0xf')](_0x1a1a0f);}function selectNotIn(_0x18967e,_0x134197,_0x57d8d4,_0x4e4bd1,_0x44fff6){return squel[_0x88ee('0x10')]()['field']('phone')['from'](_0x4e4bd1)['join'](_0x134197,null,_0x134197+_0x88ee('0x11')+_0x4e4bd1+'.'+_0x57d8d4)['where'](_0x4e4bd1+'.'+_0x57d8d4+'\x20=\x20'+_0x18967e+'.'+_0x57d8d4)['where'](_0x134197+_0x88ee('0x12')+_0x44fff6[_0x88ee('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x42b40d,_0xaa0c91){promisesAdditionalPhones=[];return db[_0x88ee('0x14')]['findAll']({'raw':!![],'attributes':['id',_0x88ee('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x88ee('0x16')](function(_0x1e3a45){if(_0x1e3a45!==null){var _0x4158cc=[];for(var _0x2cbd8e=0x0;_0x2cbd8e<_0x1e3a45['length'];_0x2cbd8e++){var _0xa54279=_0x1e3a45[_0x2cbd8e];_0x4158cc[_0x88ee('0x17')](insertAdditionalPhones(_0xa54279));}}Promise['all'](_0x4158cc)[_0x88ee('0x16')](function(){_0x42b40d({'val':0x1});});});});}function insertAdditionalPhones(_0x4d21c7){return new Promise(function(_0x1dc744,_0x5e8693){var _0xa659b7=_0x4d21c7[_0x88ee('0x15')];var _0x5a25dc=_0xa659b7['split'](';');var _0x2c3271=[];orderBy=0x0;for(var _0x4f8f99=0x0;_0x4f8f99<_0x5a25dc[_0x88ee('0x18')];_0x4f8f99++){_0x2c3271[_0x88ee('0x17')](splitAdditionalPhone(_0x4d21c7['id'],_0x5a25dc[_0x4f8f99]));}Promise['all'](_0x2c3271)['then'](function(){_0x1dc744({'val':_0x5a25dc['length']});});});}function splitAdditionalPhone(_0x48e037,_0x5c322d){return new Promise(function(_0x492b13,_0xc681fd){var _0x114af2=_0x5c322d[_0x88ee('0x19')](':');var _0x2b837d=_0x114af2[0x0];var _0x563344=_0x114af2[0x1];if(!_[_0x88ee('0x1a')](_0x563344)){var _0x1fb6d7=_0x563344[_0x88ee('0x19')]('|');var _0x40d100=[];for(var _0x57e59f=0x0;_0x57e59f<_0x1fb6d7[_0x88ee('0x18')];_0x57e59f++){if(_0x1fb6d7[_0x57e59f]!==''){var _0x6c76eb=_[_0x88ee('0x1b')](promisesAdditionalPhones,{'contactId':_0x48e037,'phone':_0x1fb6d7[_0x57e59f]});if(_0x6c76eb[_0x88ee('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x88ee('0x17')]({'contactId':_0x48e037,'contactTypeId':_0x2b837d,'phone':_0x1fb6d7[_0x57e59f],'orderBy':orderBy});}}}_0x492b13({'ok':0x1});}else _0x492b13({'res':0x0});});}function createAdditionalPhone(_0x34ae33,_0x10a0eb,_0x55bef2,_0xd42be1){var _0x4e4915='';var _0x90c2b7='';var _0x2ddbc8=_0x55bef2[_0x88ee('0x19')]('§');_0x4e4915=_0x2ddbc8[0x0];if(_0x2ddbc8[_0x88ee('0x18')]==0x2)_0x90c2b7=_0x2ddbc8[0x1];return new Promise(function(_0xdac732,_0x3a7b45){return db[_0x88ee('0x1c')][_0x88ee('0x1d')]({'where':{'CmContactId':_0x34ae33,'item':_0x4e4915}})[_0x88ee('0x16')](function(_0x425f36){if(_0x425f36){return db[_0x88ee('0x1c')][_0x88ee('0x1e')]({'ItemTypeId':_0x10a0eb,'description':_0x90c2b7,'OrderBy':_0xd42be1},{'where':{'CmContactId':_0x34ae33,'item':_0x4e4915}})[_0x88ee('0x16')](function(_0x3a1448){_0xdac732({'res':_0x88ee('0x1f')});});}else{return db['CmContactHasItem'][_0x88ee('0x20')]({'CmContactId':_0x34ae33,'item':_0x4e4915,'description':_0x90c2b7,'ItemTypeId':_0x10a0eb,'OrderBy':_0xd42be1,'ItemClass':_0x88ee('0x21')})[_0x88ee('0x16')](function(_0x6dde89){_0xdac732({'res':_0x88ee('0x22')});});}});});}function insertCmHopper(_0xe9e606,_0x1b555f,_0x24578c,_0x276d7c,_0x1af62d){var _0x4c67af=[_0x88ee('0x23'),'cm_contacts.scheduledat',_0x88ee('0x24'),_0x88ee('0x25'),_0x1b555f+'.'+_0x276d7c,_0x88ee('0x26'),'cm_contacts.updatedAt',_0x88ee('0x27'),_0x88ee('0x28'),'\x22'+_0x1af62d+'\x22'];return squel[_0x88ee('0x29')]()[_0x88ee('0x2a')](_0x88ee('0x2b'))[_0x88ee('0x2c')]([_0x88ee('0x2d'),_0x88ee('0x2e'),_0x88ee('0x2f'),_0x88ee('0x30'),_0x276d7c,_0x88ee('0x31'),'updatedAt',_0x88ee('0x32'),'UserId','recallme'],squel['select']()[_0x88ee('0x33')](_0x4c67af)[_0x88ee('0x34')](_0x1b555f)[_0x88ee('0x13')](_0x88ee('0x35'),null,_0x88ee('0x36')+_0x1b555f+_0x88ee('0x37'))[_0x88ee('0x13')](_0x24578c,null,_0x24578c+_0x88ee('0x11')+_0x1b555f+'.'+_0x276d7c)[_0x88ee('0x38')](_0x1b555f+_0x88ee('0x39'),_0xe9e606)['where'](_0x88ee('0x3a'),NOW)[_0x88ee('0x38')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1b555f,_0x24578c,_0x276d7c,_0x88ee('0x2b'),[_0x88ee('0x3b'),_0x88ee('0x3c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1b555f,_0x24578c,_0x276d7c,_0x88ee('0x2b'),[_0x88ee('0x3b')])))[_0x88ee('0x3d')]();}function insertCmHopperBlack(_0x3f5648,_0x611444,_0x476406,_0x339346){var _0x1fbe8c=[_0x88ee('0x23'),_0x88ee('0x24'),_0x88ee('0x25'),_0x611444+'.'+_0x339346,_0x88ee('0x26'),_0x88ee('0x3e')];return squel['insert']()[_0x88ee('0x2a')](_0x88ee('0x3f'))[_0x88ee('0x2c')]([_0x88ee('0x2d'),_0x88ee('0x2f'),_0x88ee('0x30'),_0x339346,'createdAt',_0x88ee('0x40')],squel[_0x88ee('0x10')]()[_0x88ee('0x33')](_0x1fbe8c)[_0x88ee('0x34')](_0x611444)[_0x88ee('0x13')](_0x88ee('0x35'),null,_0x88ee('0x36')+_0x611444+_0x88ee('0x37'))[_0x88ee('0x13')](_0x476406,null,_0x476406+'.id\x20=\x20'+_0x611444+'.'+_0x339346)[_0x88ee('0x38')](_0x611444+_0x88ee('0x39'),_0x3f5648)[_0x88ee('0x38')](_0x88ee('0x3a'),NOW)[_0x88ee('0x38')](_0x88ee('0x41'),squel[_0x88ee('0x10')]()[_0x88ee('0x42')](_0x88ee('0x2d'))[_0x88ee('0x34')](_0x88ee('0x3f'))[_0x88ee('0x38')](_0x88ee('0x43'),_0x3f5648)['where'](_0x339346+_0x88ee('0x44')+_0x611444+'.'+_0x339346)))[_0x88ee('0x3d')]();}function insertTzCmHopper(_0x534069,_0x2fafef,_0x55a325,_0x2e62d8,_0x5ef3d8,_0x4d38cd){var _0x245c48=[_0x88ee('0x23'),_0x88ee('0x45')+_0x4d38cd+_0x88ee('0x46'),_0x88ee('0x24'),_0x88ee('0x25'),_0x2fafef+'.'+_0x2e62d8,_0x88ee('0x26'),_0x88ee('0x3e'),_0x88ee('0x27'),_0x88ee('0x28'),'\x22'+_0x5ef3d8+'\x22'];var _0x5b1048=squel[_0x88ee('0x29')]()[_0x88ee('0x2a')](_0x88ee('0x2b'))[_0x88ee('0x2c')](['phone','scheduledat',_0x88ee('0x2f'),_0x88ee('0x30'),_0x2e62d8,_0x88ee('0x31'),_0x88ee('0x40'),_0x88ee('0x32'),'UserId','recallme'],squel['select']()[_0x88ee('0x33')](_0x245c48)[_0x88ee('0x34')](_0x2fafef)['join'](_0x88ee('0x35'),null,_0x88ee('0x36')+_0x2fafef+_0x88ee('0x37'))[_0x88ee('0x13')](_0x55a325,null,_0x55a325+_0x88ee('0x11')+_0x2fafef+'.'+_0x2e62d8)[_0x88ee('0x13')](_0x4d38cd,null,_0x4d38cd+_0x88ee('0x11')+_0x2fafef+'.'+_0x2e62d8)[_0x88ee('0x38')](_0x2fafef+_0x88ee('0x39'),_0x534069)[_0x88ee('0x38')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x88ee('0x41'),selectNotIn(_0x2fafef,_0x55a325,_0x2e62d8,_0x88ee('0x2b'),[_0x88ee('0x3b'),_0x88ee('0x3c')]))[_0x88ee('0x38')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2fafef,_0x55a325,_0x2e62d8,_0x88ee('0x2b'),[_0x88ee('0x3b')])))['toString']();return _0x5b1048;}function insertTzCmHopperBlack(_0x424e00,_0x4e33a1,_0x456f9e,_0x3da7c6){var _0x29e31b=['cm_contacts.phone',_0x88ee('0x24'),_0x88ee('0x25'),_0x4e33a1+'.'+_0x3da7c6,_0x88ee('0x26'),'cm_contacts.updatedAt'];return squel['insert']()['into']('cm_hopper_black')[_0x88ee('0x2c')]([_0x88ee('0x2d'),_0x88ee('0x2f'),'ListId',_0x3da7c6,'createdAt','updatedAt'],squel[_0x88ee('0x10')]()[_0x88ee('0x33')](_0x29e31b)[_0x88ee('0x34')](_0x4e33a1)[_0x88ee('0x13')](_0x88ee('0x35'),null,_0x88ee('0x36')+_0x4e33a1+_0x88ee('0x37'))['join'](_0x456f9e,null,_0x456f9e+_0x88ee('0x11')+_0x4e33a1+'.'+_0x3da7c6)['where'](_0x4e33a1+_0x88ee('0x39'),_0x424e00)['where'](_0x88ee('0x3a'),NOW)[_0x88ee('0x38')](_0x88ee('0x41'),squel[_0x88ee('0x10')]()[_0x88ee('0x42')]('phone')[_0x88ee('0x34')](_0x88ee('0x3f'))['where'](_0x88ee('0x43'),_0x424e00)['where'](_0x3da7c6+'\x20=\x20'+_0x4e33a1+'.'+_0x3da7c6)))['toString']();}function insertCmHopperAdditionalPhones(_0x1fe439){var _0x3ed80c=['cm_hopper.id','cm_contact_has_items.item',_0x88ee('0x47'),'cm_contact_has_items.createdAt',_0x88ee('0x48')];return squel[_0x88ee('0x29')]()['into'](_0x88ee('0x49'))['fromQuery']([_0x88ee('0x4a'),_0x88ee('0x2d'),_0x88ee('0x4b'),'createdAt',_0x88ee('0x40')],squel[_0x88ee('0x10')]()['fields'](_0x3ed80c)[_0x88ee('0x34')](_0x88ee('0x2b'))['join']('cm_contacts',null,_0x88ee('0x4c'))[_0x88ee('0x13')](_0x88ee('0x4d'),null,_0x88ee('0x4e'))[_0x88ee('0x38')](_0x88ee('0x4f'),_0x1fe439)[_0x88ee('0x38')](_0x88ee('0x3a'),NOW))['toString']();}function insertCmContact(_0x7be70c,_0x478c86,_0x19b53c,_0x592076){var _0x14930d=_[_0x88ee('0x50')](_[_0x88ee('0x51')](_0x592076),[_0x88ee('0x30'),_0x88ee('0x52'),_0x88ee('0x31'),_0x88ee('0x40')]);return squel[_0x88ee('0x29')]()[_0x88ee('0x2a')]('cm_contacts')[_0x88ee('0x2c')](_0x14930d,squel[_0x88ee('0x10')]()['fields'](_0x14930d)[_0x88ee('0x34')](_0x478c86)['where']('('+_0x19b53c[_0x88ee('0x13')](',')+_0x88ee('0x53'),squel[_0x88ee('0x10')]()[_0x88ee('0x33')](_0x19b53c)['from'](_0x88ee('0x35'))[_0x88ee('0x38')]('ListId\x20=\x20?',_0x7be70c)[_0x88ee('0x38')](_0x88ee('0x54')))[_0x88ee('0x38')](_0x88ee('0x55'),squel[_0x88ee('0x10')]()['field']('MIN(id)',_0x88ee('0x56'))['from'](_0x478c86)[_0x88ee('0x57')](_0x19b53c[_0x88ee('0x13')](','))))[_0x88ee('0x3d')]();}function handleStop(){logger[_0x88ee('0x58')](_0x88ee('0x59'));stopped=!![];}function handleUncaughtException(_0x445976){logger[_0x88ee('0x5a')](_0x445976['message']);process[_0x88ee('0x5b')](0x1);}function handleError(_0x128fa7,_0x2bc794){stats[_0x88ee('0x5c')][_0x88ee('0x17')]({'name':_0x2bc794[_0x88ee('0x5d')],'message':_0x2bc794[_0x88ee('0x5e')],'row':_0x128fa7});}function handleQuery(_0x42da4e){logger[_0x88ee('0x58')](_0x42da4e);return db[_0x88ee('0x5f')]['query'](_0x42da4e)[_0x88ee('0x60')](function(_0x577f86){results[_0x88ee('0x17')](_0x577f86);})[_0x88ee('0x61')](function(_0x347615){logger[_0x88ee('0x5a')](_0x347615[_0x88ee('0x5e')]);});}function updateTzCampaigns(_0x45f179){return new Promise(function(_0xaf6b39,_0x2e5114){var _0x2680a6=squel[_0x88ee('0x10')]()['fields'](['campaigns.id',_0x88ee('0x62')])['from'](_0x88ee('0x63'))['join']('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x88ee('0x38')](_0x88ee('0x64')+_0x45f179);db[_0x88ee('0x5f')][_0x88ee('0x65')](_0x2680a6[_0x88ee('0x3d')]())['spread'](function(_0x2c59c6){var _0x5d400c=[];for(var _0x5f02ae=0x0;_0x5f02ae<_0x2c59c6['length'];_0x5f02ae++){_0x5d400c['push'](getTimezoneData(_0x2c59c6[_0x5f02ae],tmp_campaigns));}BPromise['all'](_0x5d400c)[_0x88ee('0x16')](function(){_0xaf6b39({'val':0x1});});})['catch'](function(_0x79d38){logger[_0x88ee('0x5a')](_0x79d38[_0x88ee('0x5e')]);_0xaf6b39({'val':0x0});});});}function updateTzVoiceQueues(_0x5aefba){return new Promise(function(_0x52a98d,_0x1228e2){var _0x4ab77f=squel['select']()[_0x88ee('0x33')](['voice_queues.id',_0x88ee('0x66')])[_0x88ee('0x34')]('voice_queues')[_0x88ee('0x13')](_0x88ee('0x67'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x88ee('0x38')](_0x88ee('0x68')+_0x5aefba);db['sequelize'][_0x88ee('0x65')](_0x4ab77f['toString']())[_0x88ee('0x60')](function(_0x58e1a7){var _0x447191=[];for(var _0x2bace1=0x0;_0x2bace1<_0x58e1a7[_0x88ee('0x18')];_0x2bace1++){_0x447191[_0x88ee('0x17')](getTimezoneData(_0x58e1a7[_0x2bace1],tmp_voice_queues));}BPromise[_0x88ee('0x69')](_0x447191)['then'](function(){_0x52a98d({'val':0x1});});})[_0x88ee('0x61')](function(_0x2c05d3){logger['error'](_0x2c05d3[_0x88ee('0x5e')]);_0x52a98d({'val':0x0});});});}function getTimezoneData(_0x5655ae,_0x28a3db){return new Promise(function(_0x584dad,_0x47a281){var _0x5852b4=shared[_0x88ee('0x6a')];var _0x1c61e0=_0x5852b4[_0x5655ae[_0x88ee('0x6b')]];if(_[_0x88ee('0x1a')](_0x1c61e0)){_0x584dad({'ret':0x1});}else{var _0x20ff4a=_0x1c61e0[_0x88ee('0x6c')];var _0x576728=squel[_0x88ee('0x29')]()[_0x88ee('0x2a')](_0x28a3db)['set']('id',_0x5655ae['id'])[_0x88ee('0x6d')](_0x88ee('0x6e'),_0x20ff4a)['set'](_0x88ee('0x6b'),_0x5655ae['dialTimezone'])[_0x88ee('0x3d')]();return db[_0x88ee('0x5f')]['query'](_0x576728)['spread'](function(_0x350cd1){_0x584dad({'ret':0x1});})[_0x88ee('0x61')](function(_0x3cd2f4){logger['error'](_0x3cd2f4[_0x88ee('0x5e')]);_0x47a281({'ret':0x1});});}});}function handleTZQuery(_0x3f0c1c){logger[_0x88ee('0x58')](_0x3f0c1c);return db[_0x88ee('0x5f')][_0x88ee('0x65')](_0x3f0c1c)[_0x88ee('0x60')](function(_0x27b65c){})[_0x88ee('0x61')](function(_0x7d942f){logger['error'](_0x7d942f[_0x88ee('0x5e')]);});}function main(_0x946932,_0xb7dff7,_0x3df736,_0x1b2f6f){logger['info'](_0x88ee('0x6f'),_0x946932,JSON[_0x88ee('0x70')](_0xb7dff7));process[_0x88ee('0x71')](_0x88ee('0x72'));var _0x48b37e=_0xb7dff7[_0x88ee('0x73')];var _0x140fae=_['clone'](_0x48b37e);var _0x5abeed=_0xb7dff7[_0x88ee('0x74')];var _0x1c697a=path[_0x88ee('0x13')](config[_0x88ee('0x75')],'server/files/tmp',_0x5abeed+_0x88ee('0x76'));hasTZ=_[_0x88ee('0x51')](_0x48b37e)['includes'](_0x88ee('0x6b'));var _0x58b3b0=_[_0x88ee('0x51')](_0x48b37e)[_0x88ee('0x13')]();logger[_0x88ee('0x58')](_0x88ee('0x77'),_0x58b3b0);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x88ee('0x78')]})[_0x88ee('0x16')](function(_0x377c86){for(var _0x59b260=0x0;_0x59b260<_0x377c86[_0x88ee('0x18')];_0x59b260++){if(_0x377c86[_0x59b260][_0x88ee('0x78')]in _0x48b37e){contactItemTypes[_0x88ee('0x17')](_0x377c86[_0x59b260]);delete _0x140fae[_0x377c86[_0x59b260][_0x88ee('0x78')]];hasAdditionalPhones=!![];}for(var _0x3efd92 in _0x48b37e){if(_0x377c86[_0x59b260][_0x88ee('0x78')]+_0x88ee('0x79')===_0x3efd92){phoneDescriptions[_0x88ee('0x17')]({'itemTypeId':_0x377c86[_0x59b260]['id'],'description':_0x3efd92});delete _0x140fae[_0x3efd92];}}}if(hasAdditionalPhones)_0x140fae[_0x88ee('0x15')]='';var _0x1d6402=_[_0x88ee('0x51')](_0x140fae)[_0x88ee('0x13')]();logger[_0x88ee('0x58')](_0x88ee('0x77'),_0x1d6402);fs[_0x88ee('0x7a')](_0x1c697a,_0x1d6402+'\x0a');Papa[_0x88ee('0x7b')](fs[_0x88ee('0x7c')](_0x946932),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56fa41,_0x5b1728){try{for(var _0x5ceff3=0x0,_0x53d51a=[];_0x5ceff3<_0x56fa41[_0x88ee('0x7d')]['length'];_0x5ceff3++){stats['rows']+=0x1;if(_0x56fa41[_0x88ee('0x5c')][_0x5ceff3]){handleError(_0x56fa41['data'][_0x5ceff3],_0x56fa41[_0x88ee('0x5c')][_0x5ceff3]);}else{var _0x187122=[];var _0x44adc1=[];var _0x276fa8={};for(var _0x27244c in _0x48b37e){let _0x30466a=contactItemTypes[_0x88ee('0x7e')](_0x3d598b=>_0x3d598b['name']===_0x27244c);let _0x3f6f94=contactItemTypes[_0x88ee('0x7e')](_0x3bec26=>_0x3bec26[_0x88ee('0x78')]+'_description'===_0x27244c);if(_[_0x88ee('0x1a')](_0x30466a)&&_[_0x88ee('0x1a')](_0x3f6f94)){if(_0x48b37e[_0x88ee('0x7f')](_0x27244c)){if(_0x56fa41[_0x88ee('0x7d')][_0x5ceff3][_0x48b37e[_0x27244c]]){var _0x4b7531=_[_0x88ee('0x80')](_0x56fa41['data'][_0x5ceff3][_0x48b37e[_0x27244c]][_0x88ee('0x81')](/"/g,'\x27'));switch(_0x27244c){case _0x88ee('0x2e'):var _0xb781fe=moment(_0x4b7531,_0x88ee('0xe'),!![]);if(_0xb781fe[_0x88ee('0x82')]()){_0x53d51a['push']('\x22'+_0x4b7531+'\x22');}else{_0x187122[_0x88ee('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x88ee('0x32'):var _0x36753f=parseInt(_0x4b7531);_0x4b7531=_[_0x88ee('0x83')](_0x36753f)||_0x36753f<0x0||_0x36753f>0x4?_0x1b2f6f?0x3:0x2:_0x36753f;_0x53d51a['push']('\x22'+_0x4b7531+'\x22');break;case _0x88ee('0x84'):var _0x4e3653=parseInt(_0x4b7531);if(_[_0x88ee('0x85')](_0x4e3653)&&_['includes'](_0x3df736,_0x4e3653)){_0x53d51a[_0x88ee('0x17')]('\x22'+_0x4e3653+'\x22');}else{_0x187122[_0x88ee('0x17')](_0x88ee('0x86'));}break;case'email':if(isEmail(_0x4b7531)){_0x53d51a[_0x88ee('0x17')]('\x22'+_0x4b7531+'\x22');}else{_0x187122[_0x88ee('0x17')](_0x88ee('0x87'));}break;case _0x88ee('0x88'):var _0x2a5057=moment(_0x4b7531,_0x88ee('0x89'),!![]);if(_0x2a5057[_0x88ee('0x82')]()){_0x53d51a[_0x88ee('0x17')]('\x22'+_0x4b7531+'\x22');}else{_0x187122['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x88ee('0x6b'):var _0x2fcd9b=shared[_0x88ee('0x6a')];var _0x14b0f9=_0x2fcd9b[_0x4b7531];if(!_[_0x88ee('0x1a')](_0x14b0f9)){var _0x1c4796=_0x14b0f9[_0x88ee('0x6c')];_0x53d51a['push']('\x22'+_0x4b7531+'\x22');_0x53d51a['push']('\x22'+_0x1c4796+'\x22');}break;default:_0x53d51a['push']('\x22'+_0x4b7531+'\x22');}}else{switch(_0x27244c){case'firstName':case'phone':_0x187122['push'](_0x27244c+'\x20not\x20specified');break;default:_0x53d51a[_0x88ee('0x17')]('\x22\x22');}}}}else{var _0x2db58c='';if(!_['isNil'](_0x30466a)){if(!_0x276fa8[_0x88ee('0x7f')](_0x30466a['id'])){if(!_[_0x88ee('0x1a')](_0x56fa41[_0x88ee('0x7d')][_0x5ceff3][_0x48b37e[_0x27244c]])){var _0x4b7531=_[_0x88ee('0x80')](_0x56fa41[_0x88ee('0x7d')][_0x5ceff3][_0x48b37e[_0x27244c]]['replace'](/"/g,'\x27'));var _0x28b70f=phoneDescriptions['find'](_0x4d1d42=>_0x4d1d42['itemTypeId']===_0x30466a['id']);if(!_[_0x88ee('0x1a')](_0x28b70f)){var _0x24e677=_[_0x88ee('0x80')](_0x56fa41['data'][_0x5ceff3][_0x48b37e[_0x28b70f[_0x88ee('0x8a')]]][_0x88ee('0x81')](/"/g,'\x27'));if(!_[_0x88ee('0x1a')](_0x24e677))_0x4b7531=_0x4b7531+'§'+_0x24e677;}if(_0x2db58c=='')_0x2db58c=_0x4b7531;else _0x2db58c+='|'+_0x4b7531;}_0x44adc1[_0x88ee('0x17')](_0x30466a['id']+':'+_0x2db58c);_0x276fa8[_0x30466a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53d51a['push']('\x22'+_0x44adc1[_0x88ee('0x13')](';')+'\x22');}if(_0x187122[_0x88ee('0x18')]){handleError(_0x56fa41[_0x88ee('0x7d')][_0x5ceff3],{'code':_0x88ee('0x8b'),'message':_0x187122[_0x88ee('0x13')]()});}else{fs[_0x88ee('0x8c')](_0x1c697a,_0x53d51a['join']()+'\x0a');}_0x53d51a=[];}if(!(stats[_0x88ee('0x8d')]%0xc8)){socket[_0x88ee('0x8e')](_0x88ee('0x8f')+_0x5abeed,stats);stats[_0x88ee('0x5c')]=[];}}if(stopped){logger[_0x88ee('0x58')](_0x88ee('0x90'));_0x5b1728[_0x88ee('0x91')]();}}catch(_0x351691){handleError(_0x56fa41[_0x88ee('0x7d')][_0x5ceff3],{'code':_0x88ee('0x92'),'message':_0x351691[_0x88ee('0x5e')]});logger[_0x88ee('0x5a')](_0x88ee('0x93'),_0x351691[_0x88ee('0x5e')]);}},'complete':function(){try{var _0x2e5b49=[];var _0x55c503=[];var _0x4187f8=_0x88ee('0x35');if(_0xb7dff7['duplicates']&&_0xb7dff7[_0x88ee('0x94')][_0x88ee('0x18')]){_0x4187f8=_0x88ee('0x95')+_0x5abeed;_0x2e5b49[_0x88ee('0x17')]('CREATE\x20TABLE\x20'+_0x4187f8+_0x88ee('0x96'));}tmp_campaigns='campaigns_'+_0x5abeed;tmp_voice_queues=_0x88ee('0x97')+_0x5abeed;_0x55c503[_0x88ee('0x17')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x88ee('0x98'));_0x55c503['push'](_0x88ee('0x99')+tmp_voice_queues+_0x88ee('0x98'));BPromise['each'](_0x55c503,handleTZQuery)['then'](function(_0x238f55){updateTzCampaigns(_0xb7dff7['ListId'])[_0x88ee('0x16')](function(_0x47735a){updateTzVoiceQueues(_0xb7dff7[_0x88ee('0x30')])['then'](function(_0x318b52){if(hasTZ)_0x1d6402=_0x1d6402[_0x88ee('0x81')](_0x88ee('0x6b'),'dialTimezone,utcOffset');var _0x459474=util['format'](_0x88ee('0x9a'),_0x1c697a,_0x4187f8,_0x1d6402,_0xb7dff7[_0x88ee('0x30')],_0xb7dff7['CompanyId']||null,NOW,NOW);if(_[_0x88ee('0x1a')](_0x48b37e[_0x88ee('0x2e')])){_0x459474+=',\x20scheduledAt\x20=\x20NOW()';}_0x2e5b49[_0x88ee('0x17')](_0x459474);if(_0xb7dff7['duplicates']&&_0xb7dff7[_0x88ee('0x94')][_0x88ee('0x18')]){_0x2e5b49['push'](insertCmContact(_0xb7dff7[_0x88ee('0x30')],_0x4187f8,_0xb7dff7[_0x88ee('0x94')],_0x48b37e));_0x2e5b49['push']('DROP\x20TABLE\x20'+_0x4187f8+';');}BPromise['each'](_0x2e5b49,handleQuery)[_0x88ee('0x16')](function(_0x5f1351){BPromise[_0x88ee('0x69')]([handleAdditionalPhones()])[_0x88ee('0x16')](function(){_0x2e5b49=[];for(var _0xf5ac5e=0x0;_0xf5ac5e\x20\x20');}var _0x41b9d6=path['join'](config[_0x88ee('0x75')],_0x88ee('0xaa'),process[_0x88ee('0xa9')][0x2]);if(!fs[_0x88ee('0xab')](_0x41b9d6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x33dbc6={};try{_0x33dbc6=JSON[_0x88ee('0x7b')](process['argv'][0x3]);if(!_0x33dbc6['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x33dbc6[_0x88ee('0x73')][_0x88ee('0x2d')]){throw new Error(_0x88ee('0xac'));}if(!_0x33dbc6['binding'][_0x88ee('0xad')]){throw new Error(_0x88ee('0xae'));}var _0x4bab8c=0x0;if(_0x33dbc6[_0x88ee('0x73')][_0x88ee('0x84')]){_0x4bab8c=0x1;}if(!_0x33dbc6['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x305a51){throw new Error('body\x20id\x20mandatory');}var _0x5ed00f=[];try{_0x5ed00f=_[_0x88ee('0xaf')](JSON['parse'](process[_0x88ee('0xa9')][0x4]),'id');}catch(_0x20ef57){logger[_0x88ee('0x58')](_0x88ee('0xb0'));}main(_0x41b9d6,_0x33dbc6,_0x5ed00f,_0x4bab8c);}validate();process['on'](_0x88ee('0xb1'),handleStop);process['on'](_0x88ee('0xb2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 06fb633..b3db415 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x316b=['CompanyId','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','min_id','group','info','exit','errors','message','sequelize','main','stringify','send','start','binding','root','server/files/tmp','.csv','body','findAll','name','header','parse','createReadStream','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','all','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','isNil','push','catch','error','AdditionalPhones','length','split','CmContactHasItem','then','updated','create','PHONE','inserted','update','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','cm_contacts.ListId\x20=\x20','.id\x20=\x20','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','ListId'];(function(_0x397eee,_0x5ad835){var _0x3d3fcc=function(_0x2ac20a){while(--_0x2ac20a){_0x397eee['push'](_0x397eee['shift']());}};_0x3d3fcc(++_0x5ad835);}(_0x316b,0x17e));var _0xb316=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x316b[_0x4e21ba];return _0x55b94b;};'use strict';var fs=require('fs');var path=require(_0xb316('0x0'));var _=require('lodash');var Papa=require(_0xb316('0x1'));var util=require('util');var BPromise=require(_0xb316('0x2'));var moment=require(_0xb316('0x3'));var squel=require(_0xb316('0x4'));var Redis=require(_0xb316('0x5'));var db=require(_0xb316('0x6'))['db'];var config=require(_0xb316('0x7'));var logger=require(_0xb316('0x8'))('import');config[_0xb316('0x9')]=_[_0xb316('0xa')](config[_0xb316('0x9')],{'host':_0xb316('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb316('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb316('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xb316('0xd')+moment()[_0xb316('0xc')](_0xb316('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x337c5c){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'](_0x337c5c);}function selectNotIn(_0x1d376c,_0xba6dd6,_0x44bb5f,_0x371d7e,_0x7d3df7){return squel[_0xb316('0xf')]()[_0xb316('0x10')](_0xb316('0x11'))[_0xb316('0x12')](_0x371d7e)[_0xb316('0x13')](_0xba6dd6,null,_0xba6dd6+'.id\x20=\x20'+_0x371d7e+'.'+_0x44bb5f)[_0xb316('0x14')](_0x371d7e+'.'+_0x44bb5f+_0xb316('0x15')+_0x1d376c+'.'+_0x44bb5f)['where'](_0xba6dd6+_0xb316('0x16')+_0x7d3df7[_0xb316('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2e4583,_0x367174){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xb316('0x17')](_0xb316('0x18')+tempTableName)['spread'](function(_0x4a1e93){if(_0x4a1e93!==null){var _0x5aed72=[];for(var _0x7105a4=0x0;_0x7105a4<_0x4a1e93['length'];_0x7105a4++){var _0x3d3ab9=_0x4a1e93[_0x7105a4];if(!_['isNil'](_0x3d3ab9['phone'])){if(!_[_0xb316('0x19')](_0x3d3ab9['AdditionalPhones']))_0x5aed72['push'](insertAdditionalPhones(_0x3d3ab9));promisesContact[_0xb316('0x1a')]({'contact':_0x3d3ab9});}}}Promise['all'](_0x5aed72)['then'](function(){_0x2e4583({'val':0x1});});})[_0xb316('0x1b')](function(_0x1ebb55){logger[_0xb316('0x1c')](_0x1ebb55['message']);});});}function insertAdditionalPhones(_0x4b9b83){return new Promise(function(_0x3f0c08,_0x2b1698){var _0x2ed31b=_0x4b9b83[_0xb316('0x1d')];if(_[_0xb316('0x19')](_0x2ed31b))_0x2b1698({'val':0x0});else{var _0x16798e=_0x2ed31b['split'](';');var _0x222375=[];orderBy=0x0;for(var _0x5d65b6=0x0;_0x5d65b6<_0x16798e[_0xb316('0x1e')];_0x5d65b6++){_0x222375[_0xb316('0x1a')](splitAdditionalPhone(_0x4b9b83['id'],_0x16798e[_0x5d65b6]));}Promise['all'](_0x222375)['then'](function(){_0x3f0c08({'val':_0x16798e['length']});});}});}function splitAdditionalPhone(_0x32cbf2,_0x4e1f86){return new Promise(function(_0x2f9203,_0x549535){var _0x3e3ffd=_0x4e1f86[_0xb316('0x1f')](':');var _0x401bbf=_0x3e3ffd[0x0];var _0x2ddcf8=_0x3e3ffd[0x1];if(_0x2ddcf8!==''){var _0x422e01=_0x2ddcf8[_0xb316('0x1f')]('|');var _0x28c908=[];for(var _0x15c137=0x0;_0x15c137<_0x422e01['length'];_0x15c137++){if(_0x422e01[_0x15c137]!==''){var _0x152686=_['filter'](promisesAdditionalPhones,{'contactId':_0x32cbf2,'phone':_0x422e01[_0x15c137]});if(_0x152686[_0xb316('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0xb316('0x1a')]({'contactId':_0x32cbf2,'contactTypeId':_0x401bbf,'phone':_0x422e01[_0x15c137],'orderBy':orderBy});}}}_0x2f9203({'ok':0x1});}else _0x2f9203({'res':0x0});});}function createAdditionalPhone(_0xe1a09,_0x2b9be0,_0x1dc996,_0x4be4fe){var _0x35493a='';var _0x4fe16d='';var _0x23fe76=_0x1dc996['split']('§');_0x35493a=_0x23fe76[0x0];if(_0x23fe76['length']==0x2)_0x4fe16d=_0x23fe76[0x1];return new Promise(function(_0x48a9fe,_0x55588d){return db[_0xb316('0x20')]['findOne']({'where':{'CmContactId':_0xe1a09,'item':_0x35493a}})[_0xb316('0x21')](function(_0x3c08ca){if(_0x3c08ca){return db[_0xb316('0x20')]['update']({'ItemTypeId':_0x2b9be0,'description':_0x4fe16d,'OrderBy':_0x4be4fe},{'where':{'CmContactId':_0xe1a09,'item':_0x35493a}})['then'](function(_0x18706d){_0x48a9fe({'res':_0xb316('0x22')});});}else{return db[_0xb316('0x20')][_0xb316('0x23')]({'CmContactId':_0xe1a09,'item':_0x35493a,'ItemTypeId':_0x2b9be0,'description':_0x4fe16d,'OrderBy':_0x4be4fe,'ItemClass':_0xb316('0x24')})[_0xb316('0x21')](function(_0x189c3e){_0x48a9fe({'res':_0xb316('0x25')});});}});});}function updateContact(_0x3f70b4){return new Promise(function(_0x5cdba1,_0x3f8795){var _0x339bec=_0x3f70b4['id'];delete _0x3f70b4['id'];return db['CmContact'][_0xb316('0x26')](_0x3f70b4,{'where':{'id':_0x339bec}})[_0xb316('0x21')](function(_0xee745d){updatedRows+=0x1;return db['CmHopper'][_0xb316('0x26')]({'phone':_0x3f70b4[_0xb316('0x11')]},{'where':{'ContactId':_0x339bec}})[_0xb316('0x21')](function(_0x177fe5){_0x5cdba1({'ret':'OK'});});});});}function insertCmHopper(_0x4f19a9,_0x3c634a,_0x57b51d,_0x366567,_0x100087){var _0x5ef75e=[_0xb316('0x27'),'cm_contacts.scheduledat',_0xb316('0x28'),_0xb316('0x29'),_0x3c634a+'.'+_0x366567,_0xb316('0x2a'),_0xb316('0x2b'),_0xb316('0x2c'),_0xb316('0x2d'),'\x22'+_0x100087+'\x22'];return squel[_0xb316('0x2e')]()[_0xb316('0x2f')](_0xb316('0x30'))[_0xb316('0x31')]([_0xb316('0x11'),_0xb316('0x32'),_0xb316('0x33'),'ListId',_0x366567,_0xb316('0x34'),_0xb316('0x35'),_0xb316('0x36'),'UserId',_0xb316('0x37')],squel[_0xb316('0xf')]()['fields'](_0x5ef75e)[_0xb316('0x12')](_0x3c634a)[_0xb316('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3c634a+_0xb316('0x38'))[_0xb316('0x13')](_0x57b51d,null,_0x57b51d+'.id\x20=\x20'+_0x3c634a+'.'+_0x366567)['where'](_0x3c634a+_0xb316('0x39'),_0x4f19a9)['where'](_0xb316('0x3a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3c634a,_0x57b51d,_0x366567,_0xb316('0x30'),['\x22always\x22',_0xb316('0x3b')]))[_0xb316('0x14')](_0xb316('0x3c'),selectNotIn(_0x3c634a,_0x57b51d,_0x366567,_0xb316('0x30'),[_0xb316('0x3d')])))[_0xb316('0x3e')]();}function insertCmHopperBlack(_0x455c47,_0x524fc1,_0x417c7f,_0x442243){var _0x520b90=['cm_contacts.phone',_0xb316('0x28'),_0xb316('0x29'),_0x524fc1+'.'+_0x442243,_0xb316('0x2a'),_0xb316('0x2b')];return squel[_0xb316('0x2e')]()[_0xb316('0x2f')](_0xb316('0x3f'))['fromQuery']([_0xb316('0x11'),_0xb316('0x33'),'ListId',_0x442243,_0xb316('0x34'),_0xb316('0x35')],squel['select']()['fields'](_0x520b90)[_0xb316('0x12')](_0x524fc1)[_0xb316('0x13')]('cm_contacts',null,_0xb316('0x40')+_0x524fc1+_0xb316('0x38'))[_0xb316('0x13')](_0x417c7f,null,_0x417c7f+_0xb316('0x41')+_0x524fc1+'.'+_0x442243)['where'](_0x524fc1+_0xb316('0x39'),_0x455c47)[_0xb316('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb316('0x14')](_0xb316('0x3c'),squel[_0xb316('0xf')]()[_0xb316('0x10')](_0xb316('0x11'))[_0xb316('0x12')](_0xb316('0x3f'))[_0xb316('0x14')]('ListId\x20=\x20?',_0x455c47)['where'](_0x442243+_0xb316('0x42'),_0x524fc1+'.'+_0x442243)))[_0xb316('0x3e')]();}function insertCmHopperAdditionalPhones(_0x13e00d){var _0x53bd3f=[_0xb316('0x43'),'cm_contact_has_items.item',_0xb316('0x44'),_0xb316('0x45'),_0xb316('0x46')];return squel['insert']()[_0xb316('0x2f')](_0xb316('0x47'))[_0xb316('0x31')]([_0xb316('0x48'),_0xb316('0x11'),_0xb316('0x49'),'createdAt',_0xb316('0x35')],squel['select']()[_0xb316('0x4a')](_0x53bd3f)[_0xb316('0x12')](_0xb316('0x30'))[_0xb316('0x13')]('cm_contacts',null,_0xb316('0x4b'))['join']('cm_contact_has_items',null,_0xb316('0x4c'))[_0xb316('0x14')]('cm_hopper.ListId\x20=\x20?',_0x13e00d)[_0xb316('0x14')](_0xb316('0x3a'),NOW))[_0xb316('0x3e')]();}function insertCmContact(_0x2575e3,_0x4ee055,_0x26af9b,_0x52af7c){var _0x3be794=_[_0xb316('0x4d')](_[_0xb316('0x4e')](_0x52af7c),[_0xb316('0x4f'),_0xb316('0x50'),_0xb316('0x34'),_0xb316('0x35')]);return squel[_0xb316('0x2e')]()[_0xb316('0x2f')](_0xb316('0x51'))[_0xb316('0x31')](_0x3be794,squel[_0xb316('0xf')]()[_0xb316('0x4a')](_0x3be794)[_0xb316('0x12')](_0x4ee055)[_0xb316('0x14')]('('+_0x26af9b[_0xb316('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xb316('0xf')]()['fields'](_0x26af9b)[_0xb316('0x12')]('cm_contacts')['where'](_0xb316('0x52'),_0x2575e3))[_0xb316('0x14')](_0xb316('0x53'),squel[_0xb316('0xf')]()[_0xb316('0x10')]('MIN(id)',_0xb316('0x54'))[_0xb316('0x12')](_0x4ee055)[_0xb316('0x55')](_0x26af9b[_0xb316('0x13')](','))))[_0xb316('0x3e')]();}function handleStop(){logger[_0xb316('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3c75d9){logger[_0xb316('0x1c')](_0x3c75d9['message']);process[_0xb316('0x57')](0x1);}function handleError(_0x3f6fb7,_0xd62740){stats[_0xb316('0x58')][_0xb316('0x1a')]({'name':_0xd62740['code'],'message':_0xd62740[_0xb316('0x59')],'row':_0x3f6fb7});}function handleQuery(_0x2ca84a){logger[_0xb316('0x56')](_0x2ca84a);return db[_0xb316('0x5a')][_0xb316('0x17')](_0x2ca84a)['spread'](function(_0x3c6c08){results[_0xb316('0x1a')](_0x3c6c08);})[_0xb316('0x1b')](function(_0x30da96){logger[_0xb316('0x1c')](_0x30da96[_0xb316('0x59')]);});}function main(_0x43fecf,_0x38acd1,_0x3b5f48,_0x4dc20a){logger[_0xb316('0x56')](_0xb316('0x5b'),_0x43fecf,JSON[_0xb316('0x5c')](_0x38acd1));process[_0xb316('0x5d')](_0xb316('0x5e'));var _0x59b66a=_0x38acd1[_0xb316('0x5f')];var _0x4e7303=_['clone'](_0x59b66a);var _0x3581aa=_0x38acd1['socket_timestamp'];var _0x3773d8=path[_0xb316('0x13')](config[_0xb316('0x60')],_0xb316('0x61'),_0x3581aa+_0xb316('0x62'));logger['info'](_0xb316('0x63'),_0x38acd1);db['ContactItemType'][_0xb316('0x64')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x5a16cf){for(var _0x5e31b9=0x0;_0x5e31b9<_0x5a16cf[_0xb316('0x1e')];_0x5e31b9++){if(_0x5a16cf[_0x5e31b9][_0xb316('0x65')]in _0x59b66a){contactItemTypes[_0xb316('0x1a')](_0x5a16cf[_0x5e31b9]);delete _0x4e7303[_0x5a16cf[_0x5e31b9][_0xb316('0x65')]];hasAdditionalPhones=!![];}for(var _0x4e6d00 in _0x59b66a){if(_0x5a16cf[_0x5e31b9][_0xb316('0x65')]+'_description'===_0x4e6d00){phoneDescriptions[_0xb316('0x1a')]({'itemTypeId':_0x5a16cf[_0x5e31b9]['id'],'description':_0x4e6d00});delete _0x4e7303[_0x4e6d00];}}}if(hasAdditionalPhones)_0x4e7303[_0xb316('0x1d')]='';var _0x9bda3c=_[_0xb316('0x4e')](_0x4e7303)[_0xb316('0x13')]();logger['info'](_0xb316('0x66'),_0x9bda3c);fs['writeFileSync'](_0x3773d8,_0x9bda3c+'\x0a');Papa[_0xb316('0x67')](fs[_0xb316('0x68')](_0x43fecf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x695ebe,_0x7405f8){try{for(var _0x2f0348=0x0,_0x30afb5=[];_0x2f0348<_0x695ebe[_0xb316('0x69')][_0xb316('0x1e')];_0x2f0348++){stats[_0xb316('0x6a')]+=0x1;if(_0x695ebe[_0xb316('0x58')][_0x2f0348]){handleError(_0x695ebe[_0xb316('0x69')][_0x2f0348],_0x695ebe['errors'][_0x2f0348]);}else{var _0x3cf379=[];var _0x3ef8be=[];var _0x3fe1f7={};for(var _0x49aed2 in _0x59b66a){let _0x5e7492=contactItemTypes[_0xb316('0x6b')](_0x2c1a76=>_0x2c1a76['name']===_0x49aed2);let _0x26c96f=contactItemTypes[_0xb316('0x6b')](_0x436804=>_0x436804[_0xb316('0x65')]+'_description'===_0x49aed2);if(_[_0xb316('0x19')](_0x5e7492)&&_[_0xb316('0x19')](_0x26c96f)){if(_0x59b66a[_0xb316('0x6c')](_0x49aed2)){if(_0x695ebe['data'][_0x2f0348][_0x59b66a[_0x49aed2]]){var _0xa0aa81=_['trim'](_0x695ebe[_0xb316('0x69')][_0x2f0348][_0x59b66a[_0x49aed2]][_0xb316('0x6d')](/"/g,'\x27'));switch(_0x49aed2){case _0xb316('0x32'):var _0x59e191=moment(_0xa0aa81,_0xb316('0x6e'),!![]);if(_0x59e191[_0xb316('0x6f')]()){_0x30afb5[_0xb316('0x1a')]('\x22'+_0xa0aa81+'\x22');}else{_0x3cf379[_0xb316('0x1a')](_0xb316('0x70'));}break;case _0xb316('0x36'):var _0x32da6e=parseInt(_0xa0aa81);_0xa0aa81=_[_0xb316('0x71')](_0x32da6e)||_0x32da6e<0x0||_0x32da6e>0x4?_0x4dc20a?0x3:0x2:_0x32da6e;_0x30afb5[_0xb316('0x1a')]('\x22'+_0xa0aa81+'\x22');break;case _0xb316('0x72'):var _0x3cbcd3=parseInt(_0xa0aa81);if(_[_0xb316('0x73')](_0x3cbcd3)&&_[_0xb316('0x74')](_0x3b5f48,_0x3cbcd3)){_0x30afb5['push']('\x22'+_0x3cbcd3+'\x22');}else{_0x3cf379[_0xb316('0x1a')](_0xb316('0x75'));}break;case _0xb316('0x76'):if(isEmail(_0xa0aa81)){_0x30afb5['push']('\x22'+_0xa0aa81+'\x22');}else{_0x3cf379[_0xb316('0x1a')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1e870b=moment(_0xa0aa81,_0xb316('0x77'),!![]);if(_0x1e870b[_0xb316('0x6f')]()){_0x30afb5['push']('\x22'+_0xa0aa81+'\x22');}else{_0x3cf379[_0xb316('0x1a')](_0xb316('0x78'));}break;default:_0x30afb5['push']('\x22'+_0xa0aa81+'\x22');}}else{switch(_0x49aed2){case _0xb316('0x79'):case'phone':_0x3cf379[_0xb316('0x1a')](_0x49aed2+_0xb316('0x7a'));break;default:_0x30afb5[_0xb316('0x1a')]('\x22\x22');}}}}else{var _0x537948='';if(!_['isNil'](_0x5e7492)){if(!_0x3fe1f7[_0xb316('0x6c')](_0x5e7492['id'])){for(var _0x25b1b6=0x0;_0x25b1b6<_0x59b66a[_0x49aed2][_0xb316('0x1e')];_0x25b1b6++){var _0xa0aa81=_[_0xb316('0x7b')](_0x695ebe[_0xb316('0x69')][_0x2f0348][_0x59b66a[_0x49aed2][_0x25b1b6]][_0xb316('0x6d')](/"/g,'\x27'));var _0x4dc395=phoneDescriptions[_0xb316('0x6b')](_0x2ee9df=>_0x2ee9df[_0xb316('0x7c')]===_0x5e7492['id']);if(!_[_0xb316('0x19')](_0x4dc395)){var _0x2995c0=_[_0xb316('0x7b')](_0x695ebe[_0xb316('0x69')][_0x2f0348][_0x59b66a[_0x4dc395[_0xb316('0x7d')]][0x0]][_0xb316('0x6d')](/"/g,'\x27'));if(!_[_0xb316('0x19')](_0x2995c0))_0xa0aa81=_0xa0aa81+'§'+_0x2995c0;}if(_0x537948=='')_0x537948=_0xa0aa81;else _0x537948+='|'+_0xa0aa81;}_0x3ef8be[_0xb316('0x1a')](_0x5e7492['id']+':'+_0x537948);_0x3fe1f7[_0x5e7492['id']]=0x1;}}}}if(hasAdditionalPhones){_0x30afb5[_0xb316('0x1a')]('\x22'+_0x3ef8be[_0xb316('0x13')](';')+'\x22');}if(_0x3cf379['length']){handleError(_0x695ebe[_0xb316('0x69')][_0x2f0348],{'code':_0xb316('0x7e'),'message':_0x3cf379[_0xb316('0x13')]()});}else{fs['appendFileSync'](_0x3773d8,_0x30afb5[_0xb316('0x13')]()+'\x0a');}_0x30afb5=[];}if(!(stats[_0xb316('0x6a')]%0xc8)){socket[_0xb316('0x7f')](_0xb316('0x80')+_0x3581aa,stats);stats[_0xb316('0x58')]=[];}}if(stopped){logger['info'](_0xb316('0x81'));_0x7405f8[_0xb316('0x82')]();}}catch(_0x148d42){handleError(_0x695ebe[_0xb316('0x69')][_0x2f0348],{'code':_0xb316('0x83'),'message':_0x148d42[_0xb316('0x59')]});logger['error']('step',_0x148d42['message']);}},'complete':function(){try{var _0x2504ba=[];var _0x2c2a08=tempTableName;_0x2504ba['push'](_0xb316('0x84')+_0x2c2a08+_0xb316('0x85'));logger[_0xb316('0x56')](_0xb316('0x86'),contactItemTypes[_0xb316('0x1e')]);var _0x556601=util['format'](_0xb316('0x87'),_0x3773d8,_0x2c2a08,_0x9bda3c,_0x38acd1['ListId'],_0x38acd1[_0xb316('0x50')]||null,NOW,NOW);if(_[_0xb316('0x19')](_0x59b66a[_0xb316('0x32')])){_0x556601+=',\x20scheduledAt\x20=\x20NOW()';}_0x2504ba[_0xb316('0x1a')](_0x556601);BPromise[_0xb316('0x88')](_0x2504ba,handleQuery)[_0xb316('0x21')](function(_0x48b6a9){BPromise[_0xb316('0x89')]([handleAdditionalPhones()])[_0xb316('0x21')](function(){_0x2504ba=[];for(var _0x3e1b4f=0x0;_0x3e1b4f\x20\x20');}var _0x230187=path[_0xb316('0x13')](config[_0xb316('0x60')],'server/files/tmp',process[_0xb316('0x91')][0x2]);if(!fs[_0xb316('0x92')](_0x230187)){throw new Error(_0xb316('0x93'));}var _0x2ffdd1={};try{_0x2ffdd1=JSON[_0xb316('0x67')](process[_0xb316('0x91')][0x3]);if(!_0x2ffdd1[_0xb316('0x5f')]){throw new Error(_0xb316('0x94'));}var _0x4ffeee=0x0;if(_0x2ffdd1['binding'][_0xb316('0x72')]){_0x4ffeee=0x1;}if(!_0x2ffdd1[_0xb316('0x4f')]){throw new Error(_0xb316('0x95'));}}catch(_0x50e73a){throw new Error(_0xb316('0x96'));}var _0x17643b=[];try{_0x17643b=_[_0xb316('0x97')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x294f77){logger['info'](_0xb316('0x98'));}main(_0x230187,_0x2ffdd1,_0x17643b,_0x4ffeee);}validate();process['on']('SIGINT',handleStop);process['on'](_0xb316('0x99'),handleUncaughtException); \ No newline at end of file +var _0x1681=['socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','all','catch','error','message','push','then','split','CmContactHasItem','create','PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','priority','UserId','recallme','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','toString','cm_contacts.ListId','cm_contacts.createdAt','ListId','updatedAt','cm_hopper_black','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','exit','errors','code','query','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','writeFileSync','createReadStream','find','hasOwnProperty','data','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','each','contact','contactId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','import','defaults','redis'];(function(_0x461b42,_0x117d4f){var _0x458f72=function(_0xc8098c){while(--_0xc8098c){_0x461b42['push'](_0x461b42['shift']());}};_0x458f72(++_0x117d4f);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x1168('0x0'));var util=require(_0x1168('0x1'));var BPromise=require(_0x1168('0x2'));var moment=require(_0x1168('0x3'));var squel=require(_0x1168('0x4'));var Redis=require(_0x1168('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x1168('0x6'))(_0x1168('0x7'));config['redis']=_[_0x1168('0x8')](config[_0x1168('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1168('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x1168('0xb')](_0x1168('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x1168('0xb')](_0x1168('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x50558d){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))*$/[_0x1168('0xe')](_0x50558d);}function selectNotIn(_0x34f5cd,_0x4d836e,_0x5df755,_0x355409,_0x418a25){return squel[_0x1168('0xf')]()[_0x1168('0x10')](_0x1168('0x11'))['from'](_0x355409)[_0x1168('0x12')](_0x4d836e,null,_0x4d836e+_0x1168('0x13')+_0x355409+'.'+_0x5df755)[_0x1168('0x14')](_0x355409+'.'+_0x5df755+_0x1168('0x15')+_0x34f5cd+'.'+_0x5df755)[_0x1168('0x14')](_0x4d836e+'.dialCheckDuplicateType\x20IN\x20('+_0x418a25[_0x1168('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x52b1f7,_0x3b99fa){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1168('0x16')]['query'](_0x1168('0x17')+tempTableName)[_0x1168('0x18')](function(_0x5a1b64){if(_0x5a1b64!==null){var _0x45224b=[];for(var _0x5cdd34=0x0;_0x5cdd34<_0x5a1b64[_0x1168('0x19')];_0x5cdd34++){var _0x6ff6ff=_0x5a1b64[_0x5cdd34];if(!_['isNil'](_0x6ff6ff[_0x1168('0x11')])){if(!_[_0x1168('0x1a')](_0x6ff6ff[_0x1168('0x1b')]))_0x45224b['push'](insertAdditionalPhones(_0x6ff6ff));promisesContact['push']({'contact':_0x6ff6ff});}}}Promise[_0x1168('0x1c')](_0x45224b)['then'](function(){_0x52b1f7({'val':0x1});});})[_0x1168('0x1d')](function(_0x439e00){logger[_0x1168('0x1e')](_0x439e00[_0x1168('0x1f')]);});});}function insertAdditionalPhones(_0x3f7d85){return new Promise(function(_0x416c29,_0x527acd){var _0x3f5cc4=_0x3f7d85['AdditionalPhones'];if(_[_0x1168('0x1a')](_0x3f5cc4))_0x527acd({'val':0x0});else{var _0x2c931e=_0x3f5cc4['split'](';');var _0x4a3e55=[];orderBy=0x0;for(var _0x1252c2=0x0;_0x1252c2<_0x2c931e[_0x1168('0x19')];_0x1252c2++){_0x4a3e55[_0x1168('0x20')](splitAdditionalPhone(_0x3f7d85['id'],_0x2c931e[_0x1252c2]));}Promise[_0x1168('0x1c')](_0x4a3e55)[_0x1168('0x21')](function(){_0x416c29({'val':_0x2c931e[_0x1168('0x19')]});});}});}function splitAdditionalPhone(_0x149967,_0xae3d9b){return new Promise(function(_0x21910c,_0x270eec){var _0x17fff9=_0xae3d9b[_0x1168('0x22')](':');var _0x24f599=_0x17fff9[0x0];var _0x4f29cd=_0x17fff9[0x1];if(_0x4f29cd!==''){var _0x20ab97=_0x4f29cd[_0x1168('0x22')]('|');var _0x4adb82=[];for(var _0x3cb49c=0x0;_0x3cb49c<_0x20ab97[_0x1168('0x19')];_0x3cb49c++){if(_0x20ab97[_0x3cb49c]!==''){var _0x3666d0=_['filter'](promisesAdditionalPhones,{'contactId':_0x149967,'phone':_0x20ab97[_0x3cb49c]});if(_0x3666d0[_0x1168('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x1168('0x20')]({'contactId':_0x149967,'contactTypeId':_0x24f599,'phone':_0x20ab97[_0x3cb49c],'orderBy':orderBy});}}}_0x21910c({'ok':0x1});}else _0x21910c({'res':0x0});});}function createAdditionalPhone(_0x763d9c,_0x272d47,_0x53ea92,_0x335865){var _0x50644e='';var _0xc7ba15='';var _0x25fd9b=_0x53ea92[_0x1168('0x22')]('§');_0x50644e=_0x25fd9b[0x0];if(_0x25fd9b[_0x1168('0x19')]==0x2)_0xc7ba15=_0x25fd9b[0x1];return new Promise(function(_0x570f2a,_0xd925da){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x763d9c,'item':_0x50644e}})[_0x1168('0x21')](function(_0x3100c2){if(_0x3100c2){return db[_0x1168('0x23')]['update']({'ItemTypeId':_0x272d47,'description':_0xc7ba15,'OrderBy':_0x335865},{'where':{'CmContactId':_0x763d9c,'item':_0x50644e}})[_0x1168('0x21')](function(_0x1bf7b8){_0x570f2a({'res':'updated'});});}else{return db[_0x1168('0x23')][_0x1168('0x24')]({'CmContactId':_0x763d9c,'item':_0x50644e,'ItemTypeId':_0x272d47,'description':_0xc7ba15,'OrderBy':_0x335865,'ItemClass':_0x1168('0x25')})[_0x1168('0x21')](function(_0x45aa2a){_0x570f2a({'res':_0x1168('0x26')});});}});});}function updateContact(_0x1fffbe){return new Promise(function(_0x17f8c4,_0x5ab246){var _0x3ef6f7=_0x1fffbe['id'];delete _0x1fffbe['id'];return db['CmContact'][_0x1168('0x27')](_0x1fffbe,{'where':{'id':_0x3ef6f7}})['then'](function(_0x318e00){updatedRows+=0x1;return db[_0x1168('0x28')][_0x1168('0x27')]({'phone':_0x1fffbe['phone']},{'where':{'ContactId':_0x3ef6f7}})[_0x1168('0x21')](function(_0x1a62d2){_0x17f8c4({'ret':'OK'});});});});}function insertCmHopper(_0x13cc6e,_0x10a3c2,_0x9a5a38,_0x574b5d,_0x253893){var _0xe87966=[_0x1168('0x29'),'cm_contacts.scheduledat',_0x1168('0x2a'),'cm_contacts.ListId',_0x10a3c2+'.'+_0x574b5d,'cm_contacts.createdAt',_0x1168('0x2b'),_0x1168('0x2c'),'cm_contacts.UserId','\x22'+_0x253893+'\x22'];return squel[_0x1168('0x2d')]()[_0x1168('0x2e')](_0x1168('0x2f'))[_0x1168('0x30')]([_0x1168('0x11'),_0x1168('0x31'),_0x1168('0x32'),'ListId',_0x574b5d,_0x1168('0x33'),'updatedAt',_0x1168('0x34'),_0x1168('0x35'),_0x1168('0x36')],squel[_0x1168('0xf')]()[_0x1168('0x37')](_0xe87966)[_0x1168('0x38')](_0x10a3c2)['join'](_0x1168('0x39'),null,_0x1168('0x3a')+_0x10a3c2+_0x1168('0x3b'))['join'](_0x9a5a38,null,_0x9a5a38+_0x1168('0x13')+_0x10a3c2+'.'+_0x574b5d)[_0x1168('0x14')](_0x10a3c2+_0x1168('0x3c'),_0x13cc6e)['where'](_0x1168('0x3d'),NOW)['where'](_0x1168('0x3e'),selectNotIn(_0x10a3c2,_0x9a5a38,_0x574b5d,_0x1168('0x2f'),[_0x1168('0x3f'),_0x1168('0x40')]))[_0x1168('0x14')](_0x1168('0x3e'),selectNotIn(_0x10a3c2,_0x9a5a38,_0x574b5d,_0x1168('0x2f'),[_0x1168('0x3f')])))[_0x1168('0x41')]();}function insertCmHopperBlack(_0x5aa3d4,_0x393a11,_0x47346d,_0x491294){var _0x18247e=[_0x1168('0x29'),'cm_contacts.id',_0x1168('0x42'),_0x393a11+'.'+_0x491294,_0x1168('0x43'),_0x1168('0x2b')];return squel[_0x1168('0x2d')]()['into']('cm_hopper_black')['fromQuery']([_0x1168('0x11'),_0x1168('0x32'),_0x1168('0x44'),_0x491294,_0x1168('0x33'),_0x1168('0x45')],squel[_0x1168('0xf')]()[_0x1168('0x37')](_0x18247e)[_0x1168('0x38')](_0x393a11)[_0x1168('0x12')](_0x1168('0x39'),null,_0x1168('0x3a')+_0x393a11+_0x1168('0x3b'))[_0x1168('0x12')](_0x47346d,null,_0x47346d+'.id\x20=\x20'+_0x393a11+'.'+_0x491294)['where'](_0x393a11+'.CmListId\x20=\x20?',_0x5aa3d4)[_0x1168('0x14')](_0x1168('0x3d'),NOW)[_0x1168('0x14')](_0x1168('0x3e'),squel[_0x1168('0xf')]()[_0x1168('0x10')](_0x1168('0x11'))[_0x1168('0x38')](_0x1168('0x46'))[_0x1168('0x14')]('ListId\x20=\x20?',_0x5aa3d4)['where'](_0x491294+'\x20=\x20?',_0x393a11+'.'+_0x491294)))[_0x1168('0x41')]();}function insertCmHopperAdditionalPhones(_0xf6709d){var _0x111808=['cm_hopper.id',_0x1168('0x47'),_0x1168('0x48'),_0x1168('0x49'),_0x1168('0x4a')];return squel[_0x1168('0x2d')]()[_0x1168('0x2e')](_0x1168('0x4b'))[_0x1168('0x30')]([_0x1168('0x4c'),'phone',_0x1168('0x4d'),_0x1168('0x33'),_0x1168('0x45')],squel[_0x1168('0xf')]()[_0x1168('0x37')](_0x111808)['from'](_0x1168('0x2f'))[_0x1168('0x12')](_0x1168('0x39'),null,_0x1168('0x4e'))[_0x1168('0x12')](_0x1168('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x1168('0x14')]('cm_hopper.ListId\x20=\x20?',_0xf6709d)[_0x1168('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x1168('0x41')]();}function insertCmContact(_0x211ae0,_0x2432fb,_0x1411e2,_0x3ba8e5){var _0x3c7cda=_['concat'](_[_0x1168('0x50')](_0x3ba8e5),[_0x1168('0x44'),'CompanyId',_0x1168('0x33'),_0x1168('0x45')]);return squel[_0x1168('0x2d')]()[_0x1168('0x2e')]('cm_contacts')['fromQuery'](_0x3c7cda,squel[_0x1168('0xf')]()[_0x1168('0x37')](_0x3c7cda)[_0x1168('0x38')](_0x2432fb)[_0x1168('0x14')]('('+_0x1411e2[_0x1168('0x12')](',')+_0x1168('0x51'),squel['select']()[_0x1168('0x37')](_0x1411e2)[_0x1168('0x38')](_0x1168('0x39'))[_0x1168('0x14')](_0x1168('0x52'),_0x211ae0))['where'](_0x1168('0x53'),squel['select']()[_0x1168('0x10')](_0x1168('0x54'),'min_id')[_0x1168('0x38')](_0x2432fb)['group'](_0x1411e2[_0x1168('0x12')](','))))[_0x1168('0x41')]();}function handleStop(){logger[_0x1168('0x55')](_0x1168('0x56'));stopped=!![];}function handleUncaughtException(_0x541d47){logger['error'](_0x541d47[_0x1168('0x1f')]);process[_0x1168('0x57')](0x1);}function handleError(_0x438d87,_0x4b1390){stats[_0x1168('0x58')][_0x1168('0x20')]({'name':_0x4b1390[_0x1168('0x59')],'message':_0x4b1390[_0x1168('0x1f')],'row':_0x438d87});}function handleQuery(_0x1250fb){logger[_0x1168('0x55')](_0x1250fb);return db['sequelize'][_0x1168('0x5a')](_0x1250fb)['spread'](function(_0x175663){results[_0x1168('0x20')](_0x175663);})[_0x1168('0x1d')](function(_0x563dad){logger[_0x1168('0x1e')](_0x563dad[_0x1168('0x1f')]);});}function main(_0x2cc0f0,_0x1e6cf0,_0x139c36,_0x4887ed){logger[_0x1168('0x55')](_0x1168('0x5b'),_0x2cc0f0,JSON[_0x1168('0x5c')](_0x1e6cf0));process[_0x1168('0x5d')](_0x1168('0x5e'));var _0x19abee=_0x1e6cf0[_0x1168('0x5f')];var _0xfea32a=_[_0x1168('0x60')](_0x19abee);var _0xd4aa18=_0x1e6cf0['socket_timestamp'];var _0x10ef9b=path[_0x1168('0x12')](config[_0x1168('0x61')],_0x1168('0x62'),_0xd4aa18+_0x1168('0x63'));logger[_0x1168('0x55')](_0x1168('0x64'),_0x1e6cf0);db[_0x1168('0x65')][_0x1168('0x66')]({'raw':!![],'attributes':['id','name']})[_0x1168('0x21')](function(_0x27fcf5){for(var _0x3a50b5=0x0;_0x3a50b5<_0x27fcf5[_0x1168('0x19')];_0x3a50b5++){if(_0x27fcf5[_0x3a50b5]['name']in _0x19abee){contactItemTypes[_0x1168('0x20')](_0x27fcf5[_0x3a50b5]);delete _0xfea32a[_0x27fcf5[_0x3a50b5][_0x1168('0x67')]];hasAdditionalPhones=!![];}for(var _0x451faa in _0x19abee){if(_0x27fcf5[_0x3a50b5][_0x1168('0x67')]+'_description'===_0x451faa){phoneDescriptions[_0x1168('0x20')]({'itemTypeId':_0x27fcf5[_0x3a50b5]['id'],'description':_0x451faa});delete _0xfea32a[_0x451faa];}}}if(hasAdditionalPhones)_0xfea32a[_0x1168('0x1b')]='';var _0x2ddecd=_['keys'](_0xfea32a)[_0x1168('0x12')]();logger[_0x1168('0x55')]('header',_0x2ddecd);fs[_0x1168('0x68')](_0x10ef9b,_0x2ddecd+'\x0a');Papa['parse'](fs[_0x1168('0x69')](_0x2cc0f0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14537d,_0x17356f){try{for(var _0x1382ce=0x0,_0x4ded4f=[];_0x1382ce<_0x14537d['data']['length'];_0x1382ce++){stats['rows']+=0x1;if(_0x14537d['errors'][_0x1382ce]){handleError(_0x14537d['data'][_0x1382ce],_0x14537d[_0x1168('0x58')][_0x1382ce]);}else{var _0x110ff6=[];var _0x3ef3a9=[];var _0x2673cd={};for(var _0x2c4db8 in _0x19abee){let _0x5da03e=contactItemTypes[_0x1168('0x6a')](_0x5dab3c=>_0x5dab3c[_0x1168('0x67')]===_0x2c4db8);let _0x2d9a88=contactItemTypes[_0x1168('0x6a')](_0x1611c0=>_0x1611c0['name']+'_description'===_0x2c4db8);if(_[_0x1168('0x1a')](_0x5da03e)&&_[_0x1168('0x1a')](_0x2d9a88)){if(_0x19abee[_0x1168('0x6b')](_0x2c4db8)){if(_0x14537d[_0x1168('0x6c')][_0x1382ce][_0x19abee[_0x2c4db8]]){var _0x2b5daa=_['trim'](_0x14537d[_0x1168('0x6c')][_0x1382ce][_0x19abee[_0x2c4db8]][_0x1168('0x6d')](/"/g,'\x27'));switch(_0x2c4db8){case'scheduledat':var _0x396b71=moment(_0x2b5daa,_0x1168('0xc'),!![]);if(_0x396b71[_0x1168('0x6e')]()){_0x4ded4f['push']('\x22'+_0x2b5daa+'\x22');}else{_0x110ff6['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x1168('0x34'):var _0x1cdf8c=parseInt(_0x2b5daa);_0x2b5daa=_[_0x1168('0x6f')](_0x1cdf8c)||_0x1cdf8c<0x0||_0x1cdf8c>0x4?_0x4887ed?0x3:0x2:_0x1cdf8c;_0x4ded4f[_0x1168('0x20')]('\x22'+_0x2b5daa+'\x22');break;case _0x1168('0x35'):var _0x2771e1=parseInt(_0x2b5daa);if(_[_0x1168('0x70')](_0x2771e1)&&_[_0x1168('0x71')](_0x139c36,_0x2771e1)){_0x4ded4f['push']('\x22'+_0x2771e1+'\x22');}else{_0x110ff6[_0x1168('0x20')](_0x1168('0x72'));}break;case _0x1168('0x73'):if(isEmail(_0x2b5daa)){_0x4ded4f[_0x1168('0x20')]('\x22'+_0x2b5daa+'\x22');}else{_0x110ff6[_0x1168('0x20')](_0x1168('0x74'));}break;case _0x1168('0x75'):var _0x41774f=moment(_0x2b5daa,_0x1168('0x76'),!![]);if(_0x41774f[_0x1168('0x6e')]()){_0x4ded4f[_0x1168('0x20')]('\x22'+_0x2b5daa+'\x22');}else{_0x110ff6[_0x1168('0x20')](_0x1168('0x77'));}break;default:_0x4ded4f[_0x1168('0x20')]('\x22'+_0x2b5daa+'\x22');}}else{switch(_0x2c4db8){case _0x1168('0x78'):case'phone':_0x110ff6[_0x1168('0x20')](_0x2c4db8+_0x1168('0x79'));break;default:_0x4ded4f[_0x1168('0x20')]('\x22\x22');}}}}else{var _0x50f6f4='';if(!_['isNil'](_0x5da03e)){if(!_0x2673cd[_0x1168('0x6b')](_0x5da03e['id'])){for(var _0x54c1df=0x0;_0x54c1df<_0x19abee[_0x2c4db8]['length'];_0x54c1df++){var _0x2b5daa=_[_0x1168('0x7a')](_0x14537d['data'][_0x1382ce][_0x19abee[_0x2c4db8][_0x54c1df]][_0x1168('0x6d')](/"/g,'\x27'));var _0x2187db=phoneDescriptions['find'](_0x53d6c9=>_0x53d6c9[_0x1168('0x7b')]===_0x5da03e['id']);if(!_[_0x1168('0x1a')](_0x2187db)){var _0x39d9a1=_[_0x1168('0x7a')](_0x14537d[_0x1168('0x6c')][_0x1382ce][_0x19abee[_0x2187db[_0x1168('0x7c')]][0x0]][_0x1168('0x6d')](/"/g,'\x27'));if(!_[_0x1168('0x1a')](_0x39d9a1))_0x2b5daa=_0x2b5daa+'§'+_0x39d9a1;}if(_0x50f6f4=='')_0x50f6f4=_0x2b5daa;else _0x50f6f4+='|'+_0x2b5daa;}_0x3ef3a9[_0x1168('0x20')](_0x5da03e['id']+':'+_0x50f6f4);_0x2673cd[_0x5da03e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4ded4f['push']('\x22'+_0x3ef3a9[_0x1168('0x12')](';')+'\x22');}if(_0x110ff6['length']){handleError(_0x14537d[_0x1168('0x6c')][_0x1382ce],{'code':'SystemRow','message':_0x110ff6[_0x1168('0x12')]()});}else{fs['appendFileSync'](_0x10ef9b,_0x4ded4f[_0x1168('0x12')]()+'\x0a');}_0x4ded4f=[];}if(!(stats[_0x1168('0x7d')]%0xc8)){socket[_0x1168('0x7e')](_0x1168('0x7f')+_0xd4aa18,stats);stats[_0x1168('0x58')]=[];}}if(stopped){logger[_0x1168('0x55')](_0x1168('0x80'));_0x17356f[_0x1168('0x81')]();}}catch(_0x6454a7){handleError(_0x14537d[_0x1168('0x6c')][_0x1382ce],{'code':_0x1168('0x82'),'message':_0x6454a7['message']});logger[_0x1168('0x1e')](_0x1168('0x83'),_0x6454a7[_0x1168('0x1f')]);}},'complete':function(){try{var _0xba8c54=[];var _0x45b993=tempTableName;_0xba8c54[_0x1168('0x20')](_0x1168('0x84')+_0x45b993+_0x1168('0x85'));logger[_0x1168('0x55')](_0x1168('0x86'),contactItemTypes[_0x1168('0x19')]);var _0x5808a1=util[_0x1168('0xb')](_0x1168('0x87'),_0x10ef9b,_0x45b993,_0x2ddecd,_0x1e6cf0[_0x1168('0x44')],_0x1e6cf0[_0x1168('0x88')]||null,NOW,NOW);if(_[_0x1168('0x1a')](_0x19abee[_0x1168('0x31')])){_0x5808a1+=',\x20scheduledAt\x20=\x20NOW()';}_0xba8c54[_0x1168('0x20')](_0x5808a1);BPromise[_0x1168('0x89')](_0xba8c54,handleQuery)[_0x1168('0x21')](function(_0x216acc){BPromise[_0x1168('0x1c')]([handleAdditionalPhones()])[_0x1168('0x21')](function(){_0xba8c54=[];for(var _0x45096c=0x0;_0x45096c=_0x4e48db){return _0x4015d8[_0xba27('0x12')](0x193)[_0xba27('0x13')]({'message':util[_0xba27('0x8')](_0xba27('0x14'),_0x5b31d3)});}_0x1783b4();})[_0xba27('0x15')](function(_0x1ccd9c){_0x1783b4(_0x1ccd9c);});});}function isUserLimit(){return isLimit(_0xba27('0x16'),0x1,db[_0xba27('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xba27('0x18')]=isUserLimit; \ No newline at end of file +var _0x234f=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','status','json','catch','User','admin','user','isUserLimit'];(function(_0x32de86,_0x2a4e10){var _0x356ce6=function(_0x2e4ccd){while(--_0x2e4ccd){_0x32de86['push'](_0x32de86['shift']());}};_0x356ce6(++_0x2a4e10);}(_0x234f,0x10e));var _0xf234=function(_0x4ce55c,_0x559f5c){_0x4ce55c=_0x4ce55c-0x0;var _0x2b8333=_0x234f[_0x4ce55c];return _0x2b8333;};'use strict';var crypto=require(_0xf234('0x0'));var util=require(_0xf234('0x1'));var compose=require(_0xf234('0x2'));var db=require(_0xf234('0x3'))['db'];var config=require(_0xf234('0x4'));function getValueFromLicense(_0x56b9b8,_0x67cd6c){if(_0x56b9b8&&_0x67cd6c){if(_0x67cd6c[_0xf234('0x5')]&&_0x67cd6c[_0xf234('0x6')]){var _0x5294d9=_0x67cd6c[_0xf234('0x5')];var _0x4f07fc=_0x67cd6c[_0xf234('0x6')];var _0x287dbc=_0x5294d9[_0xf234('0x7')]('-')[0x4];var _0x430a9d=_0x5294d9[_0xf234('0x7')]('-')[0x0];var _0x2b4259=crypto[_0xf234('0x8')](_0xf234('0x9'),util[_0xf234('0xa')]('%s:%s:%s',_0x287dbc,_0x5294d9,_0x430a9d));var _0x46d2ea=_0x2b4259['update'](_0x4f07fc,_0xf234('0xb'),_0xf234('0xc'));_0x46d2ea+=_0x2b4259[_0xf234('0xd')](_0xf234('0xc'));var _0x3b46d0=JSON[_0xf234('0xe')](_0x46d2ea);return _0x3b46d0[_0xf234('0xf')](_0x56b9b8)?_0x3b46d0[_0x56b9b8]:null;}}return null;}function isLimit(_0x3723e9,_0x15294c,_0x4d6309,_0xced5e9){var _0x4a3256=_0x15294c;return compose()['use'](function(_0x26940b,_0x3f2ccc,_0x1b71d9){return db[_0xf234('0x10')][_0xf234('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xf234('0x12')](function(_0xe1f677){var _0x1ce16d=getValueFromLicense(_0x3723e9,_0xe1f677);return _0x1ce16d?_0x1ce16d:_0x4a3256;})[_0xf234('0x12')](function(_0x5192c5){_0x4a3256=_0x5192c5;return _0x4d6309[_0xf234('0x13')](_0xced5e9);})[_0xf234('0x12')](function(_0x5271ba){if(_0x5271ba>=_0x4a3256){return _0x3f2ccc[_0xf234('0x14')](0x193)[_0xf234('0x15')]({'message':util[_0xf234('0xa')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3723e9)});}_0x1b71d9();})[_0xf234('0x16')](function(_0x1e9a16){_0x1b71d9(_0x1e9a16);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xf234('0x17')],{'where':{'$or':[{'role':_0xf234('0x18')},{'role':_0xf234('0x19')}]}});}exports[_0xf234('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9f3300c..2f9fc76 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 _0x9f07=['BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','add','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','shift','match','forEach','filter','map','conditions','DATE','operator','$between','value','days','format','YYYY-MM-DD','text','CAST(','field','castTo','includes','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$endsWith','LIKE\x20?','$gt','>\x20?','$lte','$gte','>=\x20?'];(function(_0x2d1228,_0x2e5f69){var _0x460b5c=function(_0x1fbf87){while(--_0x1fbf87){_0x2d1228['push'](_0x2d1228['shift']());}};_0x460b5c(++_0x2e5f69);}(_0x9f07,0x166));var _0x79f0=function(_0xd40f7f,_0x266c39){_0xd40f7f=_0xd40f7f-0x0;var _0xdc35a1=_0x9f07[_0xd40f7f];return _0xdc35a1;};'use strict';var _=require(_0x79f0('0x0'));var moment=require('moment');exports[_0x79f0('0x1')]=function(_0x4efc84){var _0x44cc09={'conditions':[]};_0x44cc09['sqlOperator']=_[_0x79f0('0x2')](_0x4efc84,_0x79f0('0x3'))?'or':_0x79f0('0x4');var _0x2b5fe0=_0x4efc84[_0x79f0('0x5')](_0x79f0('0x6'),'')[_0x79f0('0x5')](_0x79f0('0x3'),'')[_0x79f0('0x7')]('||');for(var _0x281955=0x0;_0x281955<_0x2b5fe0['length'];_0x281955++){var _0x247c6e=_0x2b5fe0[_0x281955]['split'](':=');var _0x217be7=_0x247c6e[0x0];var _0x3f0cfd=_0x247c6e[_0x79f0('0x8')](0x1);_0x3f0cfd['forEach'](function(_0x47250e){var _0xfbc51b=_0x47250e[_0x79f0('0x7')]('[')[_0x79f0('0x9')]();var _0x2f9501=_0x47250e[_0x79f0('0xa')](/\[(.*?)\]/g);_0x2f9501[_0x79f0('0xb')](function(_0x2a9fea){var _0x434670=_0x2a9fea[_0x79f0('0x7')]('[')[_0x79f0('0xc')](function(_0x3cf2f8){return _0x3cf2f8['indexOf'](']')>-0x1;})[_0x79f0('0xd')](function(_0x464e7f){return _0x464e7f[_0x79f0('0x7')](']')[0x0];})[0x0];_0x44cc09[_0x79f0('0xe')]['push']({'field':_0x217be7,'operator':_0xfbc51b,'value':_0x434670});});});}return _0x44cc09;};exports['buildExpression']=function(_0x3b1c66,_0x4b598b,_0x4374a5){var _0x3608f3={};if(_0x4b598b===_0x79f0('0xf')){if(_0x4374a5[_0x79f0('0x10')]==='$eq'){_0x4374a5['operator']=_0x79f0('0x11');_0x4374a5[_0x79f0('0x12')]+=','+_0x4374a5['value'];}else if(_['includes'](['$gt','$lte'],_0x4374a5[_0x79f0('0x10')])){_0x4374a5[_0x79f0('0x12')]=moment(_0x4374a5[_0x79f0('0x12')])['add'](0x1,_0x79f0('0x13'))[_0x79f0('0x14')](_0x79f0('0x15'));}}if(_0x4374a5['castTo']){_0x4b598b=_0x4374a5['castTo'];_0x3608f3[_0x79f0('0x16')]=_0x79f0('0x17')+_0x3b1c66+'.'+_0x4374a5[_0x79f0('0x18')]+'\x20AS\x20'+_0x4374a5[_0x79f0('0x19')]+')\x20'+parseOperator(_0x4374a5[_0x79f0('0x10')]);}else{_0x3608f3[_0x79f0('0x16')]=_0x3b1c66+'.'+_0x4374a5[_0x79f0('0x18')]+'\x20'+parseOperator(_0x4374a5[_0x79f0('0x10')]);}if(_[_0x79f0('0x1a')]([_0x79f0('0x1b'),_0x79f0('0x1c')],_0x4374a5[_0x79f0('0x10')]))_0x3608f3['text']='('+_0x3608f3[_0x79f0('0x16')]+_0x79f0('0x1d')+_0x3b1c66+'.'+_0x4374a5[_0x79f0('0x18')]+'\x20IS\x20NULL)';_0x3608f3[_0x79f0('0x12')]=parseValue(_0x4b598b,_0x4374a5[_0x79f0('0x10')],_0x4374a5[_0x79f0('0x12')]);return _0x3608f3;};function parseOperator(_0x16b57e){var _0x3ee084;switch(_0x16b57e){case'$in':_0x3ee084=_0x79f0('0x1e');break;case _0x79f0('0x1c'):_0x3ee084=_0x79f0('0x1f');break;case _0x79f0('0x20'):_0x3ee084='=\x20?';break;case _0x79f0('0x1b'):_0x3ee084=_0x79f0('0x21');break;case _0x79f0('0x22'):case'$startsWith':case _0x79f0('0x23'):_0x3ee084=_0x79f0('0x24');break;case'$lt':_0x3ee084='<\x20?';break;case _0x79f0('0x25'):_0x3ee084=_0x79f0('0x26');break;case _0x79f0('0x27'):_0x3ee084='<=\x20?';break;case _0x79f0('0x28'):_0x3ee084=_0x79f0('0x29');break;case'$between':_0x3ee084=_0x79f0('0x2a');break;}return _0x3ee084;}function parseValue(_0x4263db,_0x396812,_0x2a457a){var _0x19ece6={'start':undefined,'end':undefined};switch(_0x396812){case _0x79f0('0x2b'):case _0x79f0('0x1c'):_0x19ece6['start']=_0x2a457a[_0x79f0('0x7')](',');break;case _0x79f0('0x22'):_0x19ece6[_0x79f0('0x2c')]='%'+_0x2a457a+'%';break;case _0x79f0('0x2d'):_0x19ece6[_0x79f0('0x2c')]=_0x2a457a+'%';break;case _0x79f0('0x23'):_0x19ece6[_0x79f0('0x2c')]='%'+_0x2a457a;break;case _0x79f0('0x11'):var _0x311096=_0x2a457a[_0x79f0('0x7')](',');var _0x2a457a=_0x311096['shift']();var _0x5e160a=_0x311096[_0x79f0('0x2e')]();if(_0x4263db===_0x79f0('0xf')){_0x2a457a=moment(_0x2a457a)[_0x79f0('0x2f')](0x0,!![])['format']();_0x5e160a=moment(_0x5e160a)[_0x79f0('0x2f')](0x0,!![])[_0x79f0('0x30')](0x17,'hours')[_0x79f0('0x30')](0x3b,'minutes')['add'](0x3b,_0x79f0('0x31'))[_0x79f0('0x14')]();}_0x19ece6={'start':_0x2a457a,'end':_0x5e160a};break;default:_0x19ece6[_0x79f0('0x2c')]=_0x2a457a;break;}return _0x19ece6;} \ No newline at end of file +var _0x894c=['startsWith','and','replace','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','$gte','>=\x20?','$startsWith','utcOffset','add','minutes','seconds','start','lodash','moment','parseSearch','sqlOperator'];(function(_0x4a3e4f,_0x29c9d3){var _0x10bf7d=function(_0xdcd57d){while(--_0xdcd57d){_0x4a3e4f['push'](_0x4a3e4f['shift']());}};_0x10bf7d(++_0x29c9d3);}(_0x894c,0x19c));var _0xc894=function(_0x1f8f76,_0x29544f){_0x1f8f76=_0x1f8f76-0x0;var _0x3d998b=_0x894c[_0x1f8f76];return _0x3d998b;};'use strict';var _=require(_0xc894('0x0'));var moment=require(_0xc894('0x1'));exports[_0xc894('0x2')]=function(_0x5bb201){var _0x97fc3f={'conditions':[]};_0x97fc3f[_0xc894('0x3')]=_[_0xc894('0x4')](_0x5bb201,'[$or]')?'or':_0xc894('0x5');var _0x2a3a21=_0x5bb201[_0xc894('0x6')]('[$and]','')[_0xc894('0x6')]('[$or]','')[_0xc894('0x7')]('||');for(var _0x11aea8=0x0;_0x11aea8<_0x2a3a21[_0xc894('0x8')];_0x11aea8++){var _0x36c6cc=_0x2a3a21[_0x11aea8]['split'](':=');var _0x51c474=_0x36c6cc[0x0];var _0x302321=_0x36c6cc[_0xc894('0x9')](0x1);_0x302321['forEach'](function(_0xbd3896){var _0x2e9b80=_0xbd3896[_0xc894('0x7')]('[')[_0xc894('0xa')]();var _0x566055=_0xbd3896[_0xc894('0xb')](/\[(.*?)\]/g);_0x566055[_0xc894('0xc')](function(_0x350be7){var _0x4e88d8=_0x350be7['split']('[')[_0xc894('0xd')](function(_0x51dcaa){return _0x51dcaa[_0xc894('0xe')](']')>-0x1;})[_0xc894('0xf')](function(_0x3ffe17){return _0x3ffe17['split'](']')[0x0];})[0x0];_0x97fc3f[_0xc894('0x10')][_0xc894('0x11')]({'field':_0x51c474,'operator':_0x2e9b80,'value':_0x4e88d8});});});}return _0x97fc3f;};exports['buildExpression']=function(_0x40787c,_0x85079b,_0x5cfd2f){var _0x477142={};if(_0x85079b===_0xc894('0x12')){if(_0x5cfd2f[_0xc894('0x13')]===_0xc894('0x14')){_0x5cfd2f[_0xc894('0x13')]=_0xc894('0x15');_0x5cfd2f[_0xc894('0x16')]+=','+_0x5cfd2f[_0xc894('0x16')];}else if(_['includes']([_0xc894('0x17'),_0xc894('0x18')],_0x5cfd2f[_0xc894('0x13')])){_0x5cfd2f[_0xc894('0x16')]=moment(_0x5cfd2f['value'])['add'](0x1,_0xc894('0x19'))[_0xc894('0x1a')](_0xc894('0x1b'));}}if(_0x5cfd2f['castTo']){_0x85079b=_0x5cfd2f[_0xc894('0x1c')];_0x477142['text']=_0xc894('0x1d')+_0x40787c+'.'+_0x5cfd2f[_0xc894('0x1e')]+'\x20AS\x20'+_0x5cfd2f[_0xc894('0x1c')]+')\x20'+parseOperator(_0x5cfd2f[_0xc894('0x13')]);}else{_0x477142[_0xc894('0x1f')]=_0x40787c+'.'+_0x5cfd2f[_0xc894('0x1e')]+'\x20'+parseOperator(_0x5cfd2f[_0xc894('0x13')]);}if(_['includes'](['$ne',_0xc894('0x20')],_0x5cfd2f[_0xc894('0x13')]))_0x477142[_0xc894('0x1f')]='('+_0x477142['text']+_0xc894('0x21')+_0x40787c+'.'+_0x5cfd2f[_0xc894('0x1e')]+'\x20IS\x20NULL)';_0x477142[_0xc894('0x16')]=parseValue(_0x85079b,_0x5cfd2f[_0xc894('0x13')],_0x5cfd2f['value']);return _0x477142;};function parseOperator(_0x4e7c57){var _0x3a211a;switch(_0x4e7c57){case _0xc894('0x22'):_0x3a211a=_0xc894('0x23');break;case _0xc894('0x20'):_0x3a211a=_0xc894('0x24');break;case'$eq':_0x3a211a=_0xc894('0x25');break;case _0xc894('0x26'):_0x3a211a='<>\x20?';break;case _0xc894('0x27'):case'$startsWith':case _0xc894('0x28'):_0x3a211a=_0xc894('0x29');break;case _0xc894('0x2a'):_0x3a211a='<\x20?';break;case _0xc894('0x17'):_0x3a211a=_0xc894('0x2b');break;case _0xc894('0x18'):_0x3a211a='<=\x20?';break;case _0xc894('0x2c'):_0x3a211a=_0xc894('0x2d');break;case _0xc894('0x15'):_0x3a211a='BETWEEN\x20?\x20AND\x20?';break;}return _0x3a211a;}function parseValue(_0x22e25b,_0x20a340,_0xc7fc05){var _0x387926={'start':undefined,'end':undefined};switch(_0x20a340){case _0xc894('0x22'):case _0xc894('0x20'):_0x387926['start']=_0xc7fc05['split'](',');break;case _0xc894('0x27'):_0x387926['start']='%'+_0xc7fc05+'%';break;case _0xc894('0x2e'):_0x387926['start']=_0xc7fc05+'%';break;case _0xc894('0x28'):_0x387926['start']='%'+_0xc7fc05;break;case _0xc894('0x15'):var _0x11e293=_0xc7fc05[_0xc894('0x7')](',');var _0xc7fc05=_0x11e293[_0xc894('0xa')]();var _0x4d77bc=_0x11e293['pop']();if(_0x22e25b===_0xc894('0x12')){_0xc7fc05=moment(_0xc7fc05)[_0xc894('0x2f')](0x0,!![])['format']();_0x4d77bc=moment(_0x4d77bc)[_0xc894('0x2f')](0x0,!![])[_0xc894('0x30')](0x17,'hours')['add'](0x3b,_0xc894('0x31'))[_0xc894('0x30')](0x3b,_0xc894('0x32'))[_0xc894('0x1a')]();}_0x387926={'start':_0xc7fc05,'end':_0x4d77bc};break;default:_0x387926[_0xc894('0x33')]=_0xc7fc05;break;}return _0x387926;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 63d5872..8030cc2 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 _0x2bd8=['type','VIRTUAL','lower','options','lodash','moment','parse','keys','fields','forOwn','find','DATE','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid','isArray','split','limit','offset','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','isEmpty','length','omit','isObject','isString','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters','intersection','attributes','nolimit','sort','where','pick','filter','includes','value','merge'];(function(_0x15a82c,_0x38403b){var _0x30ca17=function(_0x5cb1a5){while(--_0x5cb1a5){_0x15a82c['push'](_0x15a82c['shift']());}};_0x30ca17(++_0x38403b);}(_0x2bd8,0x130));var _0x82bd=function(_0x55abc4,_0x9a96f3){_0x55abc4=_0x55abc4-0x0;var _0x2c4219=_0x2bd8[_0x55abc4];return _0x2c4219;};'use strict';var _=require(_0x82bd('0x0'));var sequelize=require('sequelize');var moment=require(_0x82bd('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x391673){var _0x208a3d=['ne'];try{var _0x41dbdf=JSON[_0x82bd('0x2')](_0x391673);var _0x197dbc=Object[_0x82bd('0x3')](_0x41dbdf)[0x0];return _0x208a3d['includes'](_0x197dbc);}catch(_0x41584e){return![];}}function getOperatorValue(_0x2e1a98){var _0x3bf810=JSON['parse'](_0x2e1a98);var _0x19dbb1=Object[_0x82bd('0x3')](_0x3bf810)[0x0];var _0x226f60=_0x3bf810[_0x19dbb1];return{['$'+_0x19dbb1]:_0x226f60};}exports[_0x82bd('0x4')]=function(_0x4dc3a6){var _0x1666cf=null;if(_0x4dc3a6){_0x1666cf=_0x4dc3a6['split'](',');}return _0x1666cf;};exports['filters']=function(_0x51c6ea,_0x5bb22c){var _0x5f0434={};if(!_['isEmpty'](_0x51c6ea)){_[_0x82bd('0x5')](_0x51c6ea,function(_0x5f3959,_0x4e50da){try{if(_0x5bb22c){var _0x32821a=_[_0x82bd('0x6')](_0x5bb22c,{'name':_0x4e50da})||{};if(hasSequelizeOperator(_0x5f3959)){_0x5f0434[_0x4e50da]=getOperatorValue(_0x5f3959);}else if(_0x32821a['type']===_0x82bd('0x7')&&_['isPlainObject'](_0x5f3959)){var _0xfaccf7=JSON['parse'](_0x5f3959);var _0x338bb4={'$gte':moment(moment(_0xfaccf7[_0x82bd('0x8')])[_0x82bd('0x9')](_0x82bd('0xa')))['utc']()[_0x82bd('0x9')](),'$lte':moment(moment(_0xfaccf7[_0x82bd('0xb')])['format'](_0x82bd('0xa')))['utc']()[_0x82bd('0xc')](0x1,'s')[_0x82bd('0x9')]()};_0x5f0434[_0x4e50da]=_0x338bb4;}else if(_0x32821a[_0x82bd('0xd')]===_0x82bd('0xe')){_0x5f0434[_0x4e50da]=_0x5f3959;}else{_0x5f0434[_0x4e50da]=_[_0x82bd('0xf')](_0x5f3959)?_0x5f3959:JSON[_0x82bd('0x2')](_0x5f3959);}}else{_0x5f0434[_0x4e50da]=_[_0x82bd('0xf')](_0x5f3959)?_0x5f3959:JSON[_0x82bd('0x2')](_0x5f3959);}}catch(_0x31a350){_0x5f0434[_0x4e50da]=_0x5f3959[_0x82bd('0x10')](',');}});}return _0x5f0434;};exports[_0x82bd('0x11')]=function(_0x29b689){_0x29b689=parseInt(_0x29b689,0xa);if(!_0x29b689||_0x29b689<0x0){_0x29b689=LIMIT_VALUE;}return _0x29b689;};exports[_0x82bd('0x12')]=function(_0x253741){_0x253741=parseInt(_0x253741,0xa);if(!_0x253741||_0x253741<0x0){_0x253741=0x0;}return _0x253741;};exports['sort']=function(_0x5688ed){var _0x283ce7,_0x3eb844=null;if(_0x5688ed){_0x283ce7=_0x5688ed[_0x82bd('0x10')](',');_0x3eb844=_[_0x82bd('0x13')](_0x283ce7,function(_0x34899b){if(_0x34899b[_0x82bd('0x14')]('-')===0x0){return[_0x34899b===_0x82bd('0x15')?sequelize[_0x82bd('0x16')](sequelize[_0x82bd('0x17')](_0x82bd('0x15')),_0x82bd('0x18')):_0x34899b[_0x82bd('0x19')](0x1),_0x82bd('0x1a')];}else{return[_0x34899b===_0x82bd('0x15')?sequelize[_0x82bd('0x16')](sequelize[_0x82bd('0x17')](_0x82bd('0x15')),_0x82bd('0x18')):_0x34899b,_0x82bd('0x1b')];}});}return _0x3eb844;};exports['omit']=function(_0x4b3215,_0x4248be){if(_[_0x82bd('0x1c')](_0x4b3215)){return _0x4b3215;}if(_[_0x82bd('0xf')](_0x4b3215)){for(var _0x3eb6a5=0x0;_0x3eb6a5<_0x4b3215[_0x82bd('0x1d')];_0x3eb6a5+=0x1){_0x4b3215[_0x3eb6a5]=this[_0x82bd('0x1e')](_0x4b3215[_0x3eb6a5],_0x4248be);}return _0x4b3215;}if(!_[_0x82bd('0x1f')](_0x4b3215)){return _0x4b3215;}if(_[_0x82bd('0x20')](_0x4248be)){_0x4248be=[_0x4248be];}if(!_[_0x82bd('0xf')](_0x4248be)){return _0x4b3215;}for(var _0x2add80=0x0;_0x2add80<_0x4248be['length'];_0x2add80+=0x1){_['unset'](_0x4b3215,_0x4248be[_0x2add80]);}for(var _0x5609b7 in _0x4b3215){if(_0x4b3215['hasOwnProperty'](_0x5609b7)){_0x4b3215[_0x5609b7]=this[_0x82bd('0x1e')](_0x4b3215[_0x5609b7],_0x4248be);}}return _0x4b3215;};exports[_0x82bd('0x21')]=function(_0x351d3d){return _0x351d3d[_0x82bd('0x22')](RegExp(_0x82bd('0x23')))?!![]:![];};exports['isEmail']=function(_0x516c6d){return _0x516c6d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x82bd('0x24')]=function(_0x2a5867){var _0x40884f=[];_0x2a5867['split'](/[ ,]+/)[_0x82bd('0x25')](function(_0x4f209e){_0x4f209e=_0x4f209e[_0x82bd('0x26')](/([^:]")"+/g,'$1');_0x4f209e='+'+_0x4f209e+'*';var _0x1a1e24=/[ `!@#$%^&*()_\-?~]/;if(_0x4f209e[_0x82bd('0x22')](_0x1a1e24))_0x4f209e='\x22'+_0x4f209e+'\x22';_0x40884f[_0x82bd('0x27')](_0x4f209e);});return _0x40884f[_0x82bd('0x28')]('\x20');};exports[_0x82bd('0x29')]=function(_0x5ca7fc,_0x591b38,_0x406c96){var _0x3a7d07={},_0x4a927a={};if(_0x591b38[_0x82bd('0x2a')]['$id']){_0x591b38['query']['id']=_0x591b38[_0x82bd('0x2a')][_0x82bd('0x2b')];delete _0x591b38[_0x82bd('0x2a')][_0x82bd('0x2b')];}_0x3a7d07[_0x82bd('0x2c')]=_[_0x82bd('0x13')](_0x5ca7fc,_0x82bd('0xd'));_0x3a7d07[_0x82bd('0x2a')]=_[_0x82bd('0x3')](_0x591b38[_0x82bd('0x2a')]);_0x3a7d07[_0x82bd('0x2d')]=_[_0x82bd('0x2e')](_0x3a7d07[_0x82bd('0x2c')],_0x3a7d07[_0x82bd('0x2a')]);_0x4a927a[_0x82bd('0x2f')]=_[_0x82bd('0x2e')](_0x3a7d07[_0x82bd('0x2c')],this['fields'](_0x591b38['query']['fields']));_0x4a927a[_0x82bd('0x2f')]=_0x4a927a[_0x82bd('0x2f')]['length']?_0x4a927a[_0x82bd('0x2f')]:_0x3a7d07['model'];if(!_0x591b38['query']['hasOwnProperty'](_0x82bd('0x30'))){_0x4a927a[_0x82bd('0x11')]=this[_0x82bd('0x11')](_0x591b38[_0x82bd('0x2a')][_0x82bd('0x11')]);_0x4a927a['offset']=this['offset'](_0x591b38['query'][_0x82bd('0x12')]);}_0x4a927a['order']=this['sort'](_0x591b38[_0x82bd('0x2a')][_0x82bd('0x31')]);_0x4a927a[_0x82bd('0x32')]=this[_0x82bd('0x2d')](_[_0x82bd('0x33')](_0x591b38[_0x82bd('0x2a')],_0x3a7d07[_0x82bd('0x2d')]),_0x5ca7fc);if(_0x591b38[_0x82bd('0x2a')][_0x82bd('0x34')]){var _0x5512b0=_0x5ca7fc;var _0x5c7661=_0x591b38[_0x82bd('0x2a')][_0x82bd('0x34')];if(typeof _0x5c7661==='object'){_0x5512b0=_['filter'](_0x5ca7fc,function(_0x277b7a){return _[_0x82bd('0x35')](_0x5c7661['columns'],_0x277b7a[_0x82bd('0xd')]);});_0x5c7661=_0x5c7661[_0x82bd('0x36')];}_0x4a927a[_0x82bd('0x32')]=_[_0x82bd('0x37')](_0x4a927a[_0x82bd('0x32')],{'$or':_[_0x82bd('0x13')](_0x5512b0,function(_0x2a18c3){if(_0x2a18c3[_0x82bd('0x38')]!==_0x82bd('0x39')){if(_0x406c96){return sequelize[_0x82bd('0x32')](sequelize['fn'](_0x82bd('0x3a'),sequelize[_0x82bd('0x17')](_0x2a18c3['name'])),{'$like':sequelize['fn'](_0x82bd('0x3a'),'%'+_0x591b38[_0x82bd('0x2a')]['filter']+'%')});}else{var _0x5b736e={};_0x5b736e[_0x2a18c3[_0x82bd('0xd')]]={'$like':'%'+_0x591b38[_0x82bd('0x2a')][_0x82bd('0x34')]+'%'};return _0x5b736e;}}})});}_0x4a927a=_[_0x82bd('0x37')]({},_0x4a927a,_0x591b38[_0x82bd('0x3b')]);return _0x4a927a;}; \ No newline at end of file +var _0xe14b=['getFullTextValue','forEach','replace','push','join','getOptions','query','model','intersection','attributes','fields','nolimit','limit','order','where','pick','filter','object','includes','columns','name','merge','VIRTUAL','lower','options','lodash','sequelize','parse','keys','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','uniqueid','isArray','offset','sort','map','indexOf','priority','col','unsigned','DESC','cast','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail'];(function(_0x25bb4c,_0x1a0b53){var _0x4c78b2=function(_0x437620){while(--_0x437620){_0x25bb4c['push'](_0x25bb4c['shift']());}};_0x4c78b2(++_0x1a0b53);}(_0xe14b,0x93));var _0xbe14=function(_0x500a50,_0x1a3b81){_0x500a50=_0x500a50-0x0;var _0x4e67f5=_0xe14b[_0x500a50];return _0x4e67f5;};'use strict';var _=require(_0xbe14('0x0'));var sequelize=require(_0xbe14('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5cc4d8){var _0x11c3a0=['ne'];try{var _0x36393a=JSON['parse'](_0x5cc4d8);var _0x7d3665=Object['keys'](_0x36393a)[0x0];return _0x11c3a0['includes'](_0x7d3665);}catch(_0x1833e3){return![];}}function getOperatorValue(_0x2d1a4a){var _0x1fe204=JSON[_0xbe14('0x2')](_0x2d1a4a);var _0x1d9ade=Object[_0xbe14('0x3')](_0x1fe204)[0x0];var _0x196fca=_0x1fe204[_0x1d9ade];return{['$'+_0x1d9ade]:_0x196fca};}exports['fields']=function(_0x50f909){var _0x496063=null;if(_0x50f909){_0x496063=_0x50f909[_0xbe14('0x4')](',');}return _0x496063;};exports[_0xbe14('0x5')]=function(_0xd68cd7,_0x90b4f){var _0x53c7ea={};if(!_['isEmpty'](_0xd68cd7)){_[_0xbe14('0x6')](_0xd68cd7,function(_0x3f70cb,_0x4935cc){try{if(_0x90b4f){var _0x254c3b=_[_0xbe14('0x7')](_0x90b4f,{'name':_0x4935cc})||{};if(hasSequelizeOperator(_0x3f70cb)){_0x53c7ea[_0x4935cc]=getOperatorValue(_0x3f70cb);}else if(_0x254c3b[_0xbe14('0x8')]===_0xbe14('0x9')&&_[_0xbe14('0xa')](_0x3f70cb)){var _0x3b898d=JSON[_0xbe14('0x2')](_0x3f70cb);var _0x2850cb={'$gte':moment(moment(_0x3b898d[_0xbe14('0xb')])[_0xbe14('0xc')](_0xbe14('0xd')))[_0xbe14('0xe')]()[_0xbe14('0xc')](),'$lte':moment(moment(_0x3b898d['$lte'])['format'](_0xbe14('0xd')))[_0xbe14('0xe')]()[_0xbe14('0xf')](0x1,'s')[_0xbe14('0xc')]()};_0x53c7ea[_0x4935cc]=_0x2850cb;}else if(_0x254c3b['name']===_0xbe14('0x10')){_0x53c7ea[_0x4935cc]=_0x3f70cb;}else{_0x53c7ea[_0x4935cc]=_[_0xbe14('0x11')](_0x3f70cb)?_0x3f70cb:JSON[_0xbe14('0x2')](_0x3f70cb);}}else{_0x53c7ea[_0x4935cc]=_[_0xbe14('0x11')](_0x3f70cb)?_0x3f70cb:JSON[_0xbe14('0x2')](_0x3f70cb);}}catch(_0x29ab73){_0x53c7ea[_0x4935cc]=_0x3f70cb[_0xbe14('0x4')](',');}});}return _0x53c7ea;};exports['limit']=function(_0x137ee5){_0x137ee5=parseInt(_0x137ee5,0xa);if(!_0x137ee5||_0x137ee5<0x0){_0x137ee5=LIMIT_VALUE;}return _0x137ee5;};exports[_0xbe14('0x12')]=function(_0x329588){_0x329588=parseInt(_0x329588,0xa);if(!_0x329588||_0x329588<0x0){_0x329588=0x0;}return _0x329588;};exports[_0xbe14('0x13')]=function(_0x3249da){var _0x37e4c1,_0x59a9e3=null;if(_0x3249da){_0x37e4c1=_0x3249da[_0xbe14('0x4')](',');_0x59a9e3=_[_0xbe14('0x14')](_0x37e4c1,function(_0x417c8d){if(_0x417c8d[_0xbe14('0x15')]('-')===0x0){return[_0x417c8d===_0xbe14('0x16')?sequelize['cast'](sequelize[_0xbe14('0x17')]('priority'),_0xbe14('0x18')):_0x417c8d['substr'](0x1),_0xbe14('0x19')];}else{return[_0x417c8d==='priority'?sequelize[_0xbe14('0x1a')](sequelize[_0xbe14('0x17')]('priority'),_0xbe14('0x18')):_0x417c8d,'ASC'];}});}return _0x59a9e3;};exports[_0xbe14('0x1b')]=function(_0x4851f8,_0x36a21e){if(_[_0xbe14('0x1c')](_0x4851f8)){return _0x4851f8;}if(_[_0xbe14('0x11')](_0x4851f8)){for(var _0x39cc81=0x0;_0x39cc81<_0x4851f8[_0xbe14('0x1d')];_0x39cc81+=0x1){_0x4851f8[_0x39cc81]=this[_0xbe14('0x1b')](_0x4851f8[_0x39cc81],_0x36a21e);}return _0x4851f8;}if(!_['isObject'](_0x4851f8)){return _0x4851f8;}if(_[_0xbe14('0x1e')](_0x36a21e)){_0x36a21e=[_0x36a21e];}if(!_[_0xbe14('0x11')](_0x36a21e)){return _0x4851f8;}for(var _0x391556=0x0;_0x391556<_0x36a21e[_0xbe14('0x1d')];_0x391556+=0x1){_['unset'](_0x4851f8,_0x36a21e[_0x391556]);}for(var _0x16f884 in _0x4851f8){if(_0x4851f8[_0xbe14('0x1f')](_0x16f884)){_0x4851f8[_0x16f884]=this['omit'](_0x4851f8[_0x16f884],_0x36a21e);}}return _0x4851f8;};exports[_0xbe14('0x20')]=function(_0x3b3e84){return _0x3b3e84[_0xbe14('0x21')](RegExp(_0xbe14('0x22')))?!![]:![];};exports[_0xbe14('0x23')]=function(_0x36d4b2){return _0x36d4b2[_0xbe14('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xbe14('0x24')]=function(_0x4168c8){var _0x16a159=[];_0x4168c8[_0xbe14('0x4')](/[ ,]+/)[_0xbe14('0x25')](function(_0x39dc0a){_0x39dc0a=_0x39dc0a[_0xbe14('0x26')](/([^:]")"+/g,'$1');_0x39dc0a='+'+_0x39dc0a+'*';var _0x223f7a=/[ `!@#$%^&*()_\-?~]/;if(_0x39dc0a[_0xbe14('0x21')](_0x223f7a))_0x39dc0a='\x22'+_0x39dc0a+'\x22';_0x16a159[_0xbe14('0x27')](_0x39dc0a);});return _0x16a159[_0xbe14('0x28')]('\x20');};exports[_0xbe14('0x29')]=function(_0x14e7c4,_0x581e86,_0x2e33e1){var _0x499793={},_0x58f8de={};if(_0x581e86[_0xbe14('0x2a')]['$id']){_0x581e86[_0xbe14('0x2a')]['id']=_0x581e86[_0xbe14('0x2a')]['$id'];delete _0x581e86['query']['$id'];}_0x499793[_0xbe14('0x2b')]=_[_0xbe14('0x14')](_0x14e7c4,'name');_0x499793[_0xbe14('0x2a')]=_[_0xbe14('0x3')](_0x581e86[_0xbe14('0x2a')]);_0x499793[_0xbe14('0x5')]=_[_0xbe14('0x2c')](_0x499793['model'],_0x499793['query']);_0x58f8de[_0xbe14('0x2d')]=_['intersection'](_0x499793['model'],this['fields'](_0x581e86[_0xbe14('0x2a')][_0xbe14('0x2e')]));_0x58f8de[_0xbe14('0x2d')]=_0x58f8de[_0xbe14('0x2d')][_0xbe14('0x1d')]?_0x58f8de[_0xbe14('0x2d')]:_0x499793[_0xbe14('0x2b')];if(!_0x581e86[_0xbe14('0x2a')][_0xbe14('0x1f')](_0xbe14('0x2f'))){_0x58f8de[_0xbe14('0x30')]=this[_0xbe14('0x30')](_0x581e86['query']['limit']);_0x58f8de[_0xbe14('0x12')]=this[_0xbe14('0x12')](_0x581e86[_0xbe14('0x2a')]['offset']);}_0x58f8de[_0xbe14('0x31')]=this[_0xbe14('0x13')](_0x581e86[_0xbe14('0x2a')][_0xbe14('0x13')]);_0x58f8de[_0xbe14('0x32')]=this[_0xbe14('0x5')](_[_0xbe14('0x33')](_0x581e86[_0xbe14('0x2a')],_0x499793[_0xbe14('0x5')]),_0x14e7c4);if(_0x581e86['query'][_0xbe14('0x34')]){var _0x841b71=_0x14e7c4;var _0x3463c4=_0x581e86[_0xbe14('0x2a')][_0xbe14('0x34')];if(typeof _0x3463c4===_0xbe14('0x35')){_0x841b71=_['filter'](_0x14e7c4,function(_0xb0f143){return _[_0xbe14('0x36')](_0x3463c4[_0xbe14('0x37')],_0xb0f143[_0xbe14('0x38')]);});_0x3463c4=_0x3463c4['value'];}_0x58f8de['where']=_[_0xbe14('0x39')](_0x58f8de[_0xbe14('0x32')],{'$or':_[_0xbe14('0x14')](_0x841b71,function(_0x51c859){if(_0x51c859['type']!==_0xbe14('0x3a')){if(_0x2e33e1){return sequelize['where'](sequelize['fn']('lower',sequelize[_0xbe14('0x17')](_0x51c859[_0xbe14('0x38')])),{'$like':sequelize['fn'](_0xbe14('0x3b'),'%'+_0x581e86['query']['filter']+'%')});}else{var _0x5aaa4f={};_0x5aaa4f[_0x51c859[_0xbe14('0x38')]]={'$like':'%'+_0x581e86[_0xbe14('0x2a')][_0xbe14('0x34')]+'%'};return _0x5aaa4f;}}})});}_0x58f8de=_['merge']({},_0x58f8de,_0x581e86[_0xbe14('0x3c')]);return _0x58f8de;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f8ee284..de7d251 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 156c0b9..c976b4b 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 _0x4bd9=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','update','digest','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat'];(function(_0x46eff1,_0x165b58){var _0x412c08=function(_0x407db4){while(--_0x407db4){_0x46eff1['push'](_0x46eff1['shift']());}};_0x412c08(++_0x165b58);}(_0x4bd9,0x7a));var _0x94bd=function(_0x4af43f,_0x5ae9b9){_0x4af43f=_0x4af43f-0x0;var _0x495240=_0x4bd9[_0x4af43f];return _0x495240;};'use strict';var _=require(_0x94bd('0x0'));var os=require('os');var crypto=require(_0x94bd('0x1'));var machine=require(_0x94bd('0x2'));var exec=require(_0x94bd('0x3'))[_0x94bd('0x4')];var config=require(_0x94bd('0x5'));function getInterfaces(){var _0x25771b=[];var _0x5eea87=os[_0x94bd('0x6')]();var _0x336015=_[_0x94bd('0x7')](_[_0x94bd('0x8')](_0x5eea87));for(var _0x365030=0x0;_0x365030<_0x336015[_0x94bd('0x9')];_0x365030++){var _0x542e84=_0x5eea87[_0x336015[_0x365030]][_0x94bd('0xa')](function(_0x4273c2){return _0x4273c2[_0x94bd('0xb')]===_0x94bd('0xc')&&_0x4273c2['internal']===![];});_0x25771b=_0x25771b[_0x94bd('0xd')](_0x542e84);}return _0x25771b;}function getFirstInterface(){var _0x215b9b=_[_0x94bd('0xe')](getInterfaces());return{'macAddress':_0x215b9b&&_0x215b9b[_0x94bd('0xf')]?_0x215b9b['mac']:_0x94bd('0x10'),'ipAddress':_0x215b9b&&_0x215b9b[_0x94bd('0x11')]?_0x215b9b['address']:_0x94bd('0x12')};}exports[_0x94bd('0x13')]=getFirstInterface;function getCPUhash(){var _0x1f5449=_[_0x94bd('0x7')](os[_0x94bd('0x14')]()['map'](function(_0x550134){return _0x550134['model'];}))['join'](':');return crypto['createHash']('md5')[_0x94bd('0x15')](_0x1f5449)[_0x94bd('0x16')]('hex');}exports[_0x94bd('0x17')]=function(){var _0x3b12ad=os[_0x94bd('0x18')]();var _0x45a87c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x45a87c[_0x94bd('0x19')](config[_0x94bd('0x1a')])){return config[_0x94bd('0x1a')];}else if(_0x3b12ad==='win32'){return exec(_0x94bd('0x1b'),{'encoding':_0x94bd('0x1c')})['replace']('\x0d\x0a','');}else{var _0x9fc3eb=getFirstInterface();var _0x33ef5f=getCPUhash();var _0x189532=_0x33ef5f+'|'+os[_0x94bd('0x1d')]()+'|'+_0x9fc3eb[_0x94bd('0x1e')]+'|'+_0x9fc3eb[_0x94bd('0x1f')];var _0x342ab0=crypto['createHash']('md5')[_0x94bd('0x15')](_0x189532)['digest'](_0x94bd('0x20'));return _0x342ab0[_0x94bd('0x21')](0x0,0x8)+'-'+_0x342ab0[_0x94bd('0x21')](0x8,0xc)+'-'+_0x342ab0[_0x94bd('0x21')](0xc,0x10)+'-'+_0x342ab0[_0x94bd('0x21')](0x10,0x14)+'-'+_0x342ab0[_0x94bd('0x21')](0x14);}}; \ No newline at end of file +var _0x2180=['join','createHash','update','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x2180,0x14a));var _0x0218=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2180[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0218('0x0'));var os=require('os');var crypto=require(_0x0218('0x1'));var machine=require(_0x0218('0x2'));var exec=require('child_process')[_0x0218('0x3')];var config=require(_0x0218('0x4'));function getInterfaces(){var _0x2072fb=[];var _0x4ddc67=os[_0x0218('0x5')]();var _0x3a8486=_[_0x0218('0x6')](_[_0x0218('0x7')](_0x4ddc67));for(var _0x203d47=0x0;_0x203d47<_0x3a8486[_0x0218('0x8')];_0x203d47++){var _0x1cef1c=_0x4ddc67[_0x3a8486[_0x203d47]]['filter'](function(_0x53c18a){return _0x53c18a[_0x0218('0x9')]===_0x0218('0xa')&&_0x53c18a[_0x0218('0xb')]===![];});_0x2072fb=_0x2072fb['concat'](_0x1cef1c);}return _0x2072fb;}function getFirstInterface(){var _0x36105f=_['head'](getInterfaces());return{'macAddress':_0x36105f&&_0x36105f[_0x0218('0xc')]?_0x36105f[_0x0218('0xc')]:_0x0218('0xd'),'ipAddress':_0x36105f&&_0x36105f[_0x0218('0xe')]?_0x36105f[_0x0218('0xe')]:_0x0218('0xf')};}exports[_0x0218('0x10')]=getFirstInterface;function getCPUhash(){var _0x51283f=_['orderBy'](os[_0x0218('0x11')]()[_0x0218('0x12')](function(_0x553f9f){return _0x553f9f[_0x0218('0x13')];}))[_0x0218('0x14')](':');return crypto[_0x0218('0x15')]('md5')[_0x0218('0x16')](_0x51283f)[_0x0218('0x17')](_0x0218('0x18'));}exports['getUuid']=function(){var _0x539a12=os['platform']();var _0x854cd2=/[0-9a-f-]{36}/;if(config[_0x0218('0x19')]&&_0x854cd2[_0x0218('0x1a')](config['licenseToken'])){return config[_0x0218('0x19')];}else if(_0x539a12===_0x0218('0x1b')){return exec(_0x0218('0x1c'),{'encoding':_0x0218('0x1d')})[_0x0218('0x1e')]('\x0d\x0a','');}else{var _0x8ee617=getFirstInterface();var _0x4d0186=getCPUhash();var _0x55a72b=_0x4d0186+'|'+os[_0x0218('0x1f')]()+'|'+_0x8ee617[_0x0218('0x20')]+'|'+_0x8ee617['ipAddress'];var _0x4c993c=crypto[_0x0218('0x15')](_0x0218('0x21'))['update'](_0x55a72b)[_0x0218('0x17')](_0x0218('0x18'));return _0x4c993c[_0x0218('0x22')](0x0,0x8)+'-'+_0x4c993c[_0x0218('0x22')](0x8,0xc)+'-'+_0x4c993c[_0x0218('0x22')](0xc,0x10)+'-'+_0x4c993c[_0x0218('0x22')](0x10,0x14)+'-'+_0x4c993c[_0x0218('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 32bd3ce..b0875bc 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 _0x312b=['SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','bluebird','pkginfo','../../mysqldb','./hardware','license','https://www.xcallymotion.com','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','days','message','finally','getUuid','License','spread'];(function(_0x3abce4,_0x34e488){var _0x2c25db=function(_0x10aa53){while(--_0x10aa53){_0x3abce4['push'](_0x3abce4['shift']());}};_0x2c25db(++_0x34e488);}(_0x312b,0x1d7));var _0xb312=function(_0x15beed,_0x5e97bc){_0x15beed=_0x15beed-0x0;var _0x2d99d4=_0x312b[_0x15beed];return _0x2d99d4;};'use strict';var util=require('util');var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xb312('0x0'));var pkginfo=require(_0xb312('0x1'))(module,'version');var db=require(_0xb312('0x2'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb312('0x3'));var logger=require('../logger')(_0xb312('0x4'));var HOST=_0xb312('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5ac2f8){return new BPromise(function(_0x41b785,_0x533fc7){var _0xa0176c=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x5ac2f8,module['exports'][_0xb312('0x6')]);if(oldToken){_0xa0176c=util[_0xb312('0x7')](_0xb312('0x8'),HOST,_0x5ac2f8,module[_0xb312('0x9')][_0xb312('0x6')],oldToken);}var _0x21b9aa={'uri':_0xa0176c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x21b9aa)[_0xb312('0xa')](function(_0x33c0e1){_0x41b785(_0x33c0e1);})[_0xb312('0xb')](function(_0x4bdf99){_0x533fc7(_0x4bdf99);});});}function manageLicense(_0x42db68,_0x24c4da){var _0x203e3b=_0x24c4da[_0xb312('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x203e3b['data1']!==_0x42db68&&!_0x203e3b[_0xb312('0xd')]){oldToken=_0x203e3b[_0xb312('0xe')];}httpRequest(_0x42db68)[_0xb312('0xa')](function(_0x3637d0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3637d0[_0xb312('0xf')]){isOldTokenSent=![];if(!_0x203e3b['license']&&_0x203e3b[_0xb312('0x4')]!=_0x3637d0[_0xb312('0x4')]||_0x203e3b['license']&&_0x203e3b[_0xb312('0xd')]){logger[_0xb312('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x203e3b[_0xb312('0x4')]&&!_0x203e3b[_0xb312('0xd')]&&_0x203e3b[_0xb312('0x4')]!=_0x3637d0[_0xb312('0x4')]){logger[_0xb312('0x10')](_0xb312('0x11'));}if(_0x203e3b['license']&&!_0x203e3b[_0xb312('0xd')]&&_0x203e3b[_0xb312('0x4')]==_0x3637d0['license']){return _0x24c4da;}return _0x24c4da['update']({'data1':_0x42db68,'data2':null,'license':_0x3637d0[_0xb312('0x4')]});}else{if(_0x3637d0[_0xb312('0x4')]||_0x203e3b[_0xb312('0x4')]){if(!_0x203e3b[_0xb312('0xd')]){if(_0x203e3b[_0xb312('0xe')]==_0x42db68){GRAY_PERIOD_REASON=_0xb312('0x12');logger[_0xb312('0x10')](_0xb312('0x13'));}else{GRAY_PERIOD_REASON=_0xb312('0x14');logger[_0xb312('0x10')](_0xb312('0x15'),_0x203e3b['data1'],_0x42db68);}logger[_0xb312('0x10')](_0xb312('0x16'),GRAY_PERIOD_REASON[_0xb312('0x17')](),moment()[_0xb312('0x7')](_0xb312('0x18')));return _0x24c4da[_0xb312('0x19')]({'data2':encryptor[_0xb312('0x1a')](moment()['format'](_0xb312('0x18')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x203e3b[_0xb312('0xd')]),_0xb312('0x1b'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xb312('0x7')](_0xb312('0x18')));isOldTokenSent=![];return _0x24c4da['update']({'data1':_0x42db68,'data2':null,'license':null});}}}else{if(_0x203e3b[_0xb312('0xe')]!=_0x42db68){logger[_0xb312('0x10')](_0xb312('0x15'),_0x203e3b[_0xb312('0xe')],_0x42db68);return _0x24c4da[_0xb312('0x19')]({'data1':_0x42db68,'data2':null,'license':null});}}}return _0x24c4da;})['then'](function(_0x4ac254){_0x24c4da=_0x4ac254;})[_0xb312('0xb')](function(_0x53ff26){logger['error'](_0x53ff26[_0xb312('0x1c')]);})[_0xb312('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xb312('0x1e')](),_0x24c4da);},TIME);});}function defaultLicense(){var _0x22ac92=hardware[_0xb312('0x1e')]();if(_0x22ac92){return db[_0xb312('0x1f')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x22ac92}})[_0xb312('0x20')](function(_0x396a20,_0x1951d3){logger['info'](_0xb312('0x21'),_0x22ac92);manageLicense(_0x22ac92,_0x396a20);})[_0xb312('0xb')](function(_0x748a00){logger[_0xb312('0x22')](_0x748a00[_0xb312('0x1c')]);});}}exports[_0xb312('0x23')]=defaultLicense; \ No newline at end of file +var _0x031c=['moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','then','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util'];(function(_0x2f91a2,_0x13254e){var _0x16db68=function(_0x332d03){while(--_0x332d03){_0x2f91a2['push'](_0x2f91a2['shift']());}};_0x16db68(++_0x13254e);}(_0x031c,0x199));var _0xc031=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x031c[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xc031('0x0'));var moment=require(_0xc031('0x1'));var rp=require(_0xc031('0x2'));var BPromise=require(_0xc031('0x3'));var pkginfo=require(_0xc031('0x4'))(module,'version');var db=require(_0xc031('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xc031('0x6'));var logger=require(_0xc031('0x7'))('license');var HOST=_0xc031('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x23050c){return new BPromise(function(_0x4fd3c0,_0x183297){var _0x52ecbf=util['format'](_0xc031('0x9'),HOST,_0x23050c,module[_0xc031('0xa')][_0xc031('0xb')]);if(oldToken){_0x52ecbf=util[_0xc031('0xc')](_0xc031('0xd'),HOST,_0x23050c,module[_0xc031('0xa')][_0xc031('0xb')],oldToken);}var _0xe1f7e6={'uri':_0x52ecbf,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xe1f7e6)['then'](function(_0x233d0b){_0x4fd3c0(_0x233d0b);})[_0xc031('0xe')](function(_0x3b68c3){_0x183297(_0x3b68c3);});});}function manageLicense(_0x4babb4,_0x32b6de){var _0x38be23=_0x32b6de[_0xc031('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x38be23[_0xc031('0x10')]!==_0x4babb4&&!_0x38be23[_0xc031('0x11')]){oldToken=_0x38be23[_0xc031('0x10')];}httpRequest(_0x4babb4)[_0xc031('0x12')](function(_0x1a83dc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1a83dc[_0xc031('0x13')]){isOldTokenSent=![];if(!_0x38be23[_0xc031('0x14')]&&_0x38be23[_0xc031('0x14')]!=_0x1a83dc[_0xc031('0x14')]||_0x38be23['license']&&_0x38be23[_0xc031('0x11')]){logger['info'](_0xc031('0x15'));}if(_0x38be23['license']&&!_0x38be23[_0xc031('0x11')]&&_0x38be23[_0xc031('0x14')]!=_0x1a83dc[_0xc031('0x14')]){logger['info'](_0xc031('0x16'));}if(_0x38be23[_0xc031('0x14')]&&!_0x38be23[_0xc031('0x11')]&&_0x38be23[_0xc031('0x14')]==_0x1a83dc[_0xc031('0x14')]){return _0x32b6de;}return _0x32b6de['update']({'data1':_0x4babb4,'data2':null,'license':_0x1a83dc['license']});}else{if(_0x1a83dc[_0xc031('0x14')]||_0x38be23[_0xc031('0x14')]){if(!_0x38be23['data2']){if(_0x38be23['data1']==_0x4babb4){GRAY_PERIOD_REASON='Disabled';logger[_0xc031('0x17')](_0xc031('0x18'));}else{GRAY_PERIOD_REASON=_0xc031('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x38be23['data1'],_0x4babb4);}logger[_0xc031('0x17')](_0xc031('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xc031('0xc')](_0xc031('0x1b')));return _0x32b6de[_0xc031('0x1c')]({'data2':encryptor[_0xc031('0x1d')](moment()['format'](_0xc031('0x1b')))});}else{if(moment()[_0xc031('0x1e')](encryptor[_0xc031('0x1f')](_0x38be23[_0xc031('0x11')]),_0xc031('0x20'))>DAYS){logger[_0xc031('0x17')](_0xc031('0x21'),moment()['format'](_0xc031('0x1b')));isOldTokenSent=![];return _0x32b6de[_0xc031('0x1c')]({'data1':_0x4babb4,'data2':null,'license':null});}}}else{if(_0x38be23[_0xc031('0x10')]!=_0x4babb4){logger[_0xc031('0x17')](_0xc031('0x22'),_0x38be23['data1'],_0x4babb4);return _0x32b6de[_0xc031('0x1c')]({'data1':_0x4babb4,'data2':null,'license':null});}}}return _0x32b6de;})[_0xc031('0x12')](function(_0x2983d4){_0x32b6de=_0x2983d4;})[_0xc031('0xe')](function(_0x2c1c1d){logger[_0xc031('0x23')](_0x2c1c1d['message']);})[_0xc031('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xc031('0x25')](),_0x32b6de);},TIME);});}function defaultLicense(){var _0x81e7c4=hardware[_0xc031('0x25')]();if(_0x81e7c4){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x81e7c4}})['spread'](function(_0xa6a59,_0x3621b8){logger[_0xc031('0x17')](_0xc031('0x26'),_0x81e7c4);manageLicense(_0x81e7c4,_0xa6a59);})[_0xc031('0xe')](function(_0x75c8ca){logger[_0xc031('0x23')](_0x75c8ca[_0xc031('0x27')]);});}}exports[_0xc031('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index cae5a04..8226e20 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 _0x1ad0=['parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','pick','countBy','exports','util','lodash','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x1ad0,0x154));var _0x01ad=function(_0x451443,_0x1ad30f){_0x451443=_0x451443-0x0;var _0xc868ef=_0x1ad0[_0x451443];return _0xc868ef;};'use strict';var util=require(_0x01ad('0x0'));var _=require(_0x01ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x01ad('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ad('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x01ad('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01ad('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x01ad('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5f1a9a){return new BPromise(function(_0x5c7819,_0xe918db){return db[_0x01ad('0x6')][_0x01ad('0x7')](_[_0x01ad('0x8')](_0x5f1a9a,{'raw':!![],'where':{'id':0x1}}))[_0x01ad('0x9')](function(_0xaaab4d){return checkLicense(_0xaaab4d,null);})[_0x01ad('0x9')](function(_0x4f8741){_0x5c7819(_0x4f8741);return;})[_0x01ad('0xa')](function(_0x401e5c){_0xe918db(_0x401e5c);});});}function checkLicense(_0x59fd4d,_0x671215){if(!_0x59fd4d){demoLicense[_0x01ad('0xb')]=_0x59fd4d[_0x01ad('0xc')];return demoLicense;}try{var _0x4a0fae=_0x671215||_0x59fd4d[_0x01ad('0xd')];if(_[_0x01ad('0xe')](_0x4a0fae)){throw new Error(_0x01ad('0xf'));}var _0x268315=_0x59fd4d[_0x01ad('0xc')];var _0x42a840=_0x59fd4d['data2'];var _0x1f269a=_0x268315[_0x01ad('0x10')]('-')[0x4];var _0x5e5160=_0x268315[_0x01ad('0x10')]('-')[0x0];var _0x20a633=encryptor[_0x01ad('0x11')](_0x4a0fae,util[_0x01ad('0x12')](_0x01ad('0x13'),_0x1f269a,_0x268315,_0x5e5160));var _0x341e82=JSON[_0x01ad('0x14')](_0x20a633);_0x341e82[_0x01ad('0x15')]=![];_0x341e82[_0x01ad('0xb')]=_0x268315;_0x341e82[_0x01ad('0x16')]=hardware[_0x01ad('0x4')]();if(_0x42a840){var _0xfbcf74=encryptor[_0x01ad('0x11')](_0x42a840);_0x341e82[_0x01ad('0x17')]=_0xfbcf74;_0x341e82[_0x01ad('0x18')]=moment(_0xfbcf74)[_0x01ad('0x19')](0x7,_0x01ad('0x1a'))[_0x01ad('0x12')]();_0x341e82['grayReason']=_0x341e82[_0x01ad('0xb')]!=_0x341e82[_0x01ad('0x16')]?_0x01ad('0x1b'):_0x01ad('0x1c');}return _0x341e82;}catch(_0x43d982){breakingLicense[_0x01ad('0xb')]=_0x59fd4d['data1'];breakingLicense[_0x01ad('0x1d')]=_0x43d982['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x324ebf,_0x540127){getLicense()[_0x01ad('0x9')](function(_0x3d91e2){return db[_0x01ad('0x1e')][_0x01ad('0x1f')]({'attributes':[_0x01ad('0x20'),[db[_0x01ad('0x21')]['fn'](_0x01ad('0x22'),db['sequelize'][_0x01ad('0x23')]('role')),_0x01ad('0x24')]],'group':_0x01ad('0x20'),'where':{'role':{'$or':[_0x01ad('0x25'),_0x01ad('0x26'),_0x01ad('0x27')]}},'raw':!![]})[_0x01ad('0x9')](function(_0x19ca4d){var _0x23143c={'user':_0x3d91e2[_0x01ad('0x28')]||0x0,'telephone':_0x3d91e2[_0x01ad('0x29')]||0x0};_0x19ca4d['forEach'](function(_0xed6326){var _0x5563fc=_0xed6326[_0x01ad('0x20')]==='admin'?_0x01ad('0x26'):_0xed6326['role'];_0x23143c[_0x5563fc]-=_0xed6326['count'];if(_0x23143c[_0x5563fc]<0x0)_0x23143c[_0x5563fc]=0x0;});_0x324ebf(_0x23143c);return;});})[_0x01ad('0xa')](function(_0x3f0c70){_0x540127(_0x3f0c70);});});}function checkUserLimits(_0x13055c){return new BPromise(function(_0x14dbc6,_0x550d94){getLimits()['then'](function(_0x54ade9){var _0x33189a=_[_0x01ad('0x2a')](_[_0x01ad('0x2b')](_0x13055c,_0x01ad('0x20')),['admin',_0x01ad('0x26'),_0x01ad('0x27')]);var _0x2cc2e1=(_0x33189a[_0x01ad('0x25')]||0x0)+(_0x33189a[_0x01ad('0x26')]||0x0);var _0x3e0046=_0x33189a['telephone']||0x0;if(_0x2cc2e1>_0x54ade9[_0x01ad('0x26')])return _0x550d94('License\x20limit\x20reached\x20for\x20users');if(_0x3e0046>_0x54ade9[_0x01ad('0x27')])return _0x550d94('License\x20limit\x20reached\x20for\x20telephones');return _0x14dbc6();})[_0x01ad('0xa')](function(_0x205642){_0x550d94(_0x205642);});});}module[_0x01ad('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe670=['machineUuid','gray','deadline','add','days','grayReason','changed','disabled','message','User','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s'];(function(_0x58d0de,_0xd41497){var _0x3a95a3=function(_0x219d8c){while(--_0x219d8c){_0x58d0de['push'](_0x58d0de['shift']());}};_0x3a95a3(++_0xd41497);}(_0xe670,0x19a));var _0x0e67=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0xe670[_0x4147ff];return _0x1e71e6;};'use strict';var util=require(_0x0e67('0x0'));var _=require(_0x0e67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x0e67('0x2'));var encryptor=require(_0x0e67('0x3'));var db=require(_0x0e67('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e67('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0e67('0x6'),'machineUuid':hardware[_0x0e67('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e67('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0e67('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x41c4ca){return new BPromise(function(_0x489ebc,_0x4facbb){return db['License'][_0x0e67('0x9')](_['defaults'](_0x41c4ca,{'raw':!![],'where':{'id':0x1}}))[_0x0e67('0xa')](function(_0x38ca08){return checkLicense(_0x38ca08,null);})[_0x0e67('0xa')](function(_0x52c1cb){_0x489ebc(_0x52c1cb);return;})[_0x0e67('0xb')](function(_0x5cf3d2){_0x4facbb(_0x5cf3d2);});});}function checkLicense(_0x143515,_0x3402ae){if(!_0x143515){demoLicense[_0x0e67('0xc')]=_0x143515[_0x0e67('0xd')];return demoLicense;}try{var _0x43a99d=_0x3402ae||_0x143515[_0x0e67('0xe')];if(_[_0x0e67('0xf')](_0x43a99d)){throw new Error(_0x0e67('0x10'));}var _0x26a6e2=_0x143515['data1'];var _0x2613a1=_0x143515[_0x0e67('0x11')];var _0x16868b=_0x26a6e2[_0x0e67('0x12')]('-')[0x4];var _0x181cfb=_0x26a6e2[_0x0e67('0x12')]('-')[0x0];var _0x350e06=encryptor[_0x0e67('0x13')](_0x43a99d,util[_0x0e67('0x14')](_0x0e67('0x15'),_0x16868b,_0x26a6e2,_0x181cfb));var _0x4e40c6=JSON['parse'](_0x350e06);_0x4e40c6['demo']=![];_0x4e40c6[_0x0e67('0xc')]=_0x26a6e2;_0x4e40c6[_0x0e67('0x16')]=hardware[_0x0e67('0x7')]();if(_0x2613a1){var _0x276ac0=encryptor['decryptString'](_0x2613a1);_0x4e40c6[_0x0e67('0x17')]=_0x276ac0;_0x4e40c6[_0x0e67('0x18')]=moment(_0x276ac0)[_0x0e67('0x19')](0x7,_0x0e67('0x1a'))['format']();_0x4e40c6[_0x0e67('0x1b')]=_0x4e40c6[_0x0e67('0xc')]!=_0x4e40c6['machineUuid']?_0x0e67('0x1c'):_0x0e67('0x1d');}return _0x4e40c6;}catch(_0x3fc792){breakingLicense[_0x0e67('0xc')]=_0x143515[_0x0e67('0xd')];breakingLicense[_0x0e67('0x1e')]=_0x3fc792[_0x0e67('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x310818,_0x18f874){getLicense()[_0x0e67('0xa')](function(_0x47a013){return db[_0x0e67('0x1f')]['findAll']({'attributes':[_0x0e67('0x20'),[db['sequelize']['fn'](_0x0e67('0x21'),db[_0x0e67('0x22')][_0x0e67('0x23')](_0x0e67('0x20'))),_0x0e67('0x24')]],'group':_0x0e67('0x20'),'where':{'role':{'$or':[_0x0e67('0x25'),_0x0e67('0x26'),_0x0e67('0x27')]}},'raw':!![]})[_0x0e67('0xa')](function(_0xbda5f1){var _0x1e52a6={'user':_0x47a013[_0x0e67('0x28')]||0x0,'telephone':_0x47a013[_0x0e67('0x29')]||0x0};_0xbda5f1[_0x0e67('0x2a')](function(_0x4688dc){var _0x54693d=_0x4688dc[_0x0e67('0x20')]===_0x0e67('0x25')?_0x0e67('0x26'):_0x4688dc[_0x0e67('0x20')];_0x1e52a6[_0x54693d]-=_0x4688dc[_0x0e67('0x24')];if(_0x1e52a6[_0x54693d]<0x0)_0x1e52a6[_0x54693d]=0x0;});_0x310818(_0x1e52a6);return;});})[_0x0e67('0xb')](function(_0xba64f6){_0x18f874(_0xba64f6);});});}function checkUserLimits(_0xfc2d0e){return new BPromise(function(_0x4d36db,_0x4e0086){getLimits()[_0x0e67('0xa')](function(_0x480278){var _0x4e1b91=_[_0x0e67('0x2b')](_[_0x0e67('0x2c')](_0xfc2d0e,_0x0e67('0x20')),[_0x0e67('0x25'),_0x0e67('0x26'),_0x0e67('0x27')]);var _0x598fc2=(_0x4e1b91['admin']||0x0)+(_0x4e1b91[_0x0e67('0x26')]||0x0);var _0x53a556=_0x4e1b91[_0x0e67('0x27')]||0x0;if(_0x598fc2>_0x480278[_0x0e67('0x26')])return _0x4e0086(_0x0e67('0x2d'));if(_0x53a556>_0x480278[_0x0e67('0x27')])return _0x4e0086(_0x0e67('0x2e'));return _0x4d36db();})[_0x0e67('0xb')](function(_0x56cba7){_0x4e0086(_0x56cba7);});});}module[_0x0e67('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 2e6c8ec..fc008fa 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 _0xd943=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd943,0x15d));var _0x3d94=function(_0x2c6a9f,_0x1252fe){_0x2c6a9f=_0x2c6a9f-0x0;var _0x5d7a75=_0xd943[_0x2c6a9f];return _0x5d7a75;};'use strict';module[_0x3d94('0x0')]={'DOMAIN':_0x3d94('0x1'),'SESSION_SECRET':_0x3d94('0x2'),'GOOGLE_ID':_0x3d94('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x1c7c=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x533b48,_0x22f65a){var _0x16c9a3=function(_0x254d9c){while(--_0x254d9c){_0x533b48['push'](_0x533b48['shift']());}};_0x16c9a3(++_0x22f65a);}(_0x1c7c,0x164));var _0xc1c7=function(_0x189d20,_0xb1fb31){_0x189d20=_0x189d20-0x0;var _0x3c15c5=_0x1c7c[_0x189d20];return _0x3c15c5;};'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 b905566..65b5a3b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x951b=['fileLogger','exports','../utils/loggers'];(function(_0x266eff,_0xafd2f1){var _0x26edc1=function(_0x1ffc58){while(--_0x1ffc58){_0x266eff['push'](_0x266eff['shift']());}};_0x26edc1(++_0xafd2f1);}(_0x951b,0x14c));var _0xb951=function(_0x1f906d,_0x408d01){_0x1f906d=_0x1f906d-0x0;var _0x415327=_0x951b[_0x1f906d];return _0x415327;};'use strict';var fileLogger=require(_0xb951('0x0'))[_0xb951('0x1')];module[_0xb951('0x2')]=fileLogger; \ No newline at end of file +'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c521ae6..2868cb8 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 _0x8df5=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x8df5,0x19d));var _0x58df=function(_0x8a6283,_0x44588b){_0x8a6283=_0x8a6283-0x0;var _0x3e6ae2=_0x8df5[_0x8a6283];return _0x3e6ae2;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x58df('0x0')](__dirname,_0x58df('0x1'))},{'name':_0x58df('0x2'),'script':path[_0x58df('0x0')](__dirname,_0x58df('0x3'))},{'name':_0x58df('0x4'),'script':path[_0x58df('0x0')](__dirname,_0x58df('0x5'))},{'name':_0x58df('0x6'),'script':path[_0x58df('0x0')](__dirname,_0x58df('0x7'))},{'name':_0x58df('0x8'),'script':path['join'](__dirname,_0x58df('0x9'))},{'name':_0x58df('0xa'),'script':path['join'](__dirname,_0x58df('0xb'))}]};module[_0x58df('0xc')]=config; \ No newline at end of file +var _0x5a8f=['xdr','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js'];(function(_0x19fd0d,_0x279eb9){var _0x516d9c=function(_0x860222){while(--_0x860222){_0x19fd0d['push'](_0x19fd0d['shift']());}};_0x516d9c(++_0x279eb9);}(_0x5a8f,0x19c));var _0xf5a8=function(_0x183bbd,_0x4dfd13){_0x183bbd=_0x183bbd-0x0;var _0x3773a9=_0x5a8f[_0x183bbd];return _0x3773a9;};'use strict';var path=require(_0xf5a8('0x0'));var os=require('os');var config={'apps':[{'name':_0xf5a8('0x1'),'script':path[_0xf5a8('0x2')](__dirname,_0xf5a8('0x3'))},{'name':'ami','script':path['join'](__dirname,_0xf5a8('0x4'))},{'name':'agi','script':path[_0xf5a8('0x2')](__dirname,_0xf5a8('0x5'))},{'name':'email','script':path[_0xf5a8('0x2')](__dirname,_0xf5a8('0x6'))},{'name':'routing','script':path[_0xf5a8('0x2')](__dirname,_0xf5a8('0x7'))},{'name':_0xf5a8('0x8'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xf5a8('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index becde0b..1a752b2 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 _0x2728=['pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','saved'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x2728,0x138));var _0x8272=function(_0x52dd39,_0xdb90a5){_0x52dd39=_0x52dd39-0x0;var _0x1d4076=_0x2728[_0x52dd39];return _0x1d4076;};'use strict';var pm2=require(_0x8272('0x0'));var BPromise=require(_0x8272('0x1'));var config=require(_0x8272('0x2'));function connect(){return new BPromise(function(_0x58d11e,_0x560a00){return pm2[_0x8272('0x3')](function(_0x217150){if(_0x217150){return _0x560a00(_0x217150);}return _0x58d11e('connected');});});};exports[_0x8272('0x4')]=function(_0x53c290){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x29e0e7,_0xdf198d){return pm2[_0x8272('0x4')](_0x53c290,function(_0x3f7df2,_0x5a0770){if(_0x3f7df2){return _0xdf198d(_0x3f7df2);}pm2[_0x8272('0x6')]();return _0x29e0e7(_0x5a0770);});});});};exports[_0x8272('0x7')]=function(_0x4db2d5){return connect()['then'](function(){return new BPromise(function(_0x219b25,_0x38c5f4){return pm2[_0x8272('0x7')](_0x4db2d5,function(_0x1f9076,_0x4b579c){if(_0x1f9076){return _0x38c5f4(_0x1f9076);}pm2[_0x8272('0x6')]();return _0x219b25(_0x4b579c);});});});};exports['restart']=function(_0x350be2){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x3b7eac,_0x53ceba){return pm2[_0x8272('0x8')](_0x350be2,function(_0x2f56fa,_0x3f855e){if(_0x2f56fa){return _0x53ceba(_0x2f56fa);}pm2[_0x8272('0x6')]();return _0x3b7eac(_0x3f855e);});});});};exports[_0x8272('0x9')]=function(){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x49da78,_0x1657d7){return pm2[_0x8272('0x9')](function(_0x39fa18,_0x55b922){if(_0x39fa18){return _0x1657d7(_0x39fa18);}pm2['disconnect']();return _0x49da78(_0x55b922);});});});};exports[_0x8272('0xa')]=function(_0x1fff14){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x5a329b,_0x38dd7a){return pm2[_0x8272('0xa')](_0x1fff14,function(_0x458525,_0x45d90d){if(_0x458525){return _0x38dd7a(_0x458525);}pm2[_0x8272('0x6')]();return _0x5a329b(_0x45d90d);});});});};exports[_0x8272('0xb')]=function(_0x20204e){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x2abb8a,_0x1f2578){return pm2[_0x8272('0xb')](_0x20204e,function(_0x447400,_0x250e32){if(_0x447400){return _0x1f2578(_0x447400);}pm2[_0x8272('0x6')]();return _0x2abb8a(_0x250e32);});});});};exports['dump']=function(){return connect()[_0x8272('0x5')](function(){return new BPromise(function(_0x2be263,_0x25cc17){return pm2['dump'](function(_0x2f5c67){if(_0x2f5c67){return _0x25cc17(_0x2f5c67);}return _0x2be263(_0x8272('0xc'));});});});}; \ No newline at end of file +var _0xf8d6=['describe','delete','dump','pm2','./config','connect','connected','start','then','disconnect','stop','restart','list'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0xf8d6,0x17c));var _0x6f8d=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xf8d6[_0x3c487b];return _0x1d65f6;};'use strict';var pm2=require(_0x6f8d('0x0'));var BPromise=require('bluebird');var config=require(_0x6f8d('0x1'));function connect(){return new BPromise(function(_0x17c476,_0x8c4c7a){return pm2[_0x6f8d('0x2')](function(_0x1d210b){if(_0x1d210b){return _0x8c4c7a(_0x1d210b);}return _0x17c476(_0x6f8d('0x3'));});});};exports[_0x6f8d('0x4')]=function(_0x55bdfb){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x4f6f0d,_0x3bf12c){return pm2[_0x6f8d('0x4')](_0x55bdfb,function(_0x5dbb57,_0x387228){if(_0x5dbb57){return _0x3bf12c(_0x5dbb57);}pm2[_0x6f8d('0x6')]();return _0x4f6f0d(_0x387228);});});});};exports['stop']=function(_0x344e28){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x139ed9,_0x459566){return pm2[_0x6f8d('0x7')](_0x344e28,function(_0x55631b,_0x26ebb6){if(_0x55631b){return _0x459566(_0x55631b);}pm2[_0x6f8d('0x6')]();return _0x139ed9(_0x26ebb6);});});});};exports[_0x6f8d('0x8')]=function(_0x142ffe){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x3a257c,_0x461314){return pm2['restart'](_0x142ffe,function(_0x2d8ef6,_0x1aeeb7){if(_0x2d8ef6){return _0x461314(_0x2d8ef6);}pm2[_0x6f8d('0x6')]();return _0x3a257c(_0x1aeeb7);});});});};exports[_0x6f8d('0x9')]=function(){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x211c80,_0x533de1){return pm2['list'](function(_0x47dd3e,_0x426d2e){if(_0x47dd3e){return _0x533de1(_0x47dd3e);}pm2[_0x6f8d('0x6')]();return _0x211c80(_0x426d2e);});});});};exports[_0x6f8d('0xa')]=function(_0xe5aa5f){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x792fbc,_0xb4e5db){return pm2['describe'](_0xe5aa5f,function(_0x43a8e5,_0x567acf){if(_0x43a8e5){return _0xb4e5db(_0x43a8e5);}pm2[_0x6f8d('0x6')]();return _0x792fbc(_0x567acf);});});});};exports[_0x6f8d('0xb')]=function(_0x214e20){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x76ae32,_0x34fe5d){return pm2[_0x6f8d('0xb')](_0x214e20,function(_0x10c4db,_0x4a17bb){if(_0x10c4db){return _0x34fe5d(_0x10c4db);}pm2[_0x6f8d('0x6')]();return _0x76ae32(_0x4a17bb);});});});};exports[_0x6f8d('0xc')]=function(){return connect()[_0x6f8d('0x5')](function(){return new BPromise(function(_0x334bd9,_0x196f9c){return pm2[_0x6f8d('0xc')](function(_0x565783){if(_0x565783){return _0x196f9c(_0x565783);}return _0x334bd9('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 47e1d63..9f2b05b 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 _0x881d=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','emit','chatInteraction:update','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x881d,0x73));var _0xd881=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x881d[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var moment=require(_0xd881('0x0'));var Redis=require(_0xd881('0x1'));var util=require(_0xd881('0x2'));var config=require(_0xd881('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xd881('0x4'))(_0xd881('0x5'));config[_0xd881('0x6')]=_[_0xd881('0x7')](config['redis'],{'host':_0xd881('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd881('0x6')]));function closeInteractions(){var _0x3e7e9f=0x0;var _0x17c242=[];return db['Setting'][_0xd881('0x9')]({'raw':!![],'attributes':['id',_0xd881('0xa')],'where':{'id':0x1}})['then'](function(_0x5df2a5){_0x3e7e9f=_0x5df2a5[_0xd881('0xa')];if(_0x3e7e9f){return db[_0xd881('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xd881('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd881('0xd')](_0x5df2a5['chatTimeout'],_0xd881('0xe'))}}});}else{return[];}})[_0xd881('0xf')](function(_0x48abdd){if(_0x48abdd&&_0x48abdd[_0xd881('0x10')]){_0x17c242=_[_0xd881('0x11')](_0x48abdd||[],'id');logger[_0xd881('0x12')](_0xd881('0x13'),_0x17c242[_0xd881('0x14')]());return db[_0xd881('0xb')][_0xd881('0x15')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x17c242}});}})[_0xd881('0xf')](function(){if(_0x17c242&&_0x17c242[_0xd881('0x10')]){logger[_0xd881('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x17c242['join']());for(var _0x45e6e4=0x0;_0x45e6e4<_0x17c242['length'];_0x45e6e4++){io[_0xd881('0x16')](_0xd881('0x17'),{'id':_0x17c242[_0x45e6e4],'closed':!![]});}}})['catch'](function(_0x52e363){logger[_0xd881('0x18')](_0xd881('0x19'),_0x52e363?util[_0xd881('0x1a')](_0x52e363,{'showHidden':![],'depth':null}):'');});}exports[_0xd881('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb98a=['util','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','error','inspect','start','lodash','moment','ioredis'];(function(_0x3d770e,_0x135d45){var _0x44b4bc=function(_0x503b0e){while(--_0x503b0e){_0x3d770e['push'](_0x3d770e['shift']());}};_0x44b4bc(++_0x135d45);}(_0xb98a,0x8e));var _0xab98=function(_0x284d70,_0x4e5330){_0x284d70=_0x284d70-0x0;var _0x5a40f8=_0xb98a[_0x284d70];return _0x5a40f8;};'use strict';var _=require(_0xab98('0x0'));var moment=require(_0xab98('0x1'));var Redis=require(_0xab98('0x2'));var util=require(_0xab98('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0xab98('0x4')]=_[_0xab98('0x5')](config[_0xab98('0x4')],{'host':_0xab98('0x6'),'port':0x18eb});var io=require(_0xab98('0x7'))(new Redis(config[_0xab98('0x4')]));function closeInteractions(){var _0x51ecf2=0x0;var _0x2f8295=[];return db[_0xab98('0x8')][_0xab98('0x9')]({'raw':!![],'attributes':['id',_0xab98('0xa')],'where':{'id':0x1}})[_0xab98('0xb')](function(_0x1bdd62){_0x51ecf2=_0x1bdd62[_0xab98('0xa')];if(_0x51ecf2){return db[_0xab98('0xc')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1bdd62[_0xab98('0xa')],_0xab98('0xd'))}}});}else{return[];}})['then'](function(_0xcc5f8c){if(_0xcc5f8c&&_0xcc5f8c[_0xab98('0xe')]){_0x2f8295=_[_0xab98('0xf')](_0xcc5f8c||[],'id');logger[_0xab98('0x10')](_0xab98('0x11'),_0x2f8295[_0xab98('0x12')]());return db[_0xab98('0xc')][_0xab98('0x13')]({'closeReason':_0xab98('0x14'),'disposition':_0xab98('0x15'),'closed':!![],'closedAt':moment()[_0xab98('0x16')](_0xab98('0x17'))},{'where':{'id':_0x2f8295}});}})[_0xab98('0xb')](function(){if(_0x2f8295&&_0x2f8295[_0xab98('0xe')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2f8295['join']());for(var _0x5b9809=0x0;_0x5b9809<_0x2f8295['length'];_0x5b9809++){io['emit'](_0xab98('0x18'),{'id':_0x2f8295[_0x5b9809],'closed':!![]});}}})[_0xab98('0x19')](function(_0x22094e){logger[_0xab98('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x22094e?util[_0xab98('0x1b')](_0x22094e,{'showHidden':![],'depth':null}):'');});}exports[_0xab98('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 937d8f7..6272e66 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf34e=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x497790,_0x5ee36a){var _0x3f8c4f=function(_0x30c7ff){while(--_0x30c7ff){_0x497790['push'](_0x497790['shift']());}};_0x3f8c4f(++_0x5ee36a);}(_0xf34e,0xd0));var _0xef34=function(_0x361f2a,_0x400c7a){_0x361f2a=_0x361f2a-0x0;var _0x234859=_0xf34e[_0x361f2a];return _0x234859;};'use strict';function start(){var _0x104625=require(_0xef34('0x0'));return _0x104625['startAllRefreshIntervals']();}module[_0xef34('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x7da8=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x1feefe,_0x2018ad){var _0x56471a=function(_0x8745df){while(--_0x8745df){_0x1feefe['push'](_0x1feefe['shift']());}};_0x56471a(++_0x2018ad);}(_0x7da8,0xee));var _0x87da=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7da8[_0x432682];return _0x463d05;};'use strict';function start(){var _0x2c0070=require(_0x87da('0x0'));return _0x2c0070['startAllRefreshIntervals']();}module[_0x87da('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 04b9771..c5ac4db 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 _0x5453=['toRun','length','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update','update\x20cron','deleteJob','run','util','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','email','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','basename','savename','extname','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','info','email\x20sent','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','difference','toString','exists','stop','delete\x20cron'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5453,0x1d4));var _0x3545=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5453[_0x126558];return _0x1f6d14;};'use strict';var fs=require('fs');var util=require(_0x3545('0x0'));var path=require(_0x3545('0x1'));var _=require(_0x3545('0x2'));var moment=require(_0x3545('0x3'));var CronJobManager=require(_0x3545('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3545('0x5'))(_0x3545('0x6'));var db=require(_0x3545('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3545('0x8'));var client=jayson[_0x3545('0x9')][_0x3545('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x12ff95,_0x28e9d6){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x12ff95['email']);var _0x443db1=!![];var _0x211155=_0x12ff95['MailAccount'][_0x3545('0xb')]();var _0x1ca4bf={'account':_0x211155,'message':{'from':util['format'](_0x3545('0xc'),_0x12ff95[_0x3545('0xd')]['name'],_0x12ff95[_0x3545('0xd')][_0x3545('0xe')]||_0x12ff95['MailAccount'][_0x3545('0xf')][_0x3545('0x10')]),'to':_0x12ff95[_0x3545('0xe')],'cc':_0x12ff95['cc'],'bcc':_0x12ff95[_0x3545('0x11')],'subject':util[_0x3545('0x12')](_0x3545('0x13'),_0x28e9d6[_0x3545('0x14')],_0x12ff95[_0x3545('0x15')],_0x12ff95[_0x3545('0x16')])}};var _0x540d42=path[_0x3545('0x17')](__dirname,'../../files/reports');var _0x31ba3c=_0x28e9d6['savename'];var _0x3178da=util[_0x3545('0x12')]('%s.%s',path[_0x3545('0x18')](_0x28e9d6[_0x3545('0x19')],path[_0x3545('0x1a')](_0x28e9d6['savename'])),_0x3545('0x1b'));var _0x223c0e=path['join'](_0x540d42,_0x31ba3c);var _0x31765a=path[_0x3545('0x17')](_0x540d42,_0x3178da);if(fs['existsSync'](_0x223c0e)){_0x28e9d6[_0x3545('0x1c')]=_0x3545('0x1d');_0x1ca4bf[_0x3545('0x1e')]['attachments']=[{'filename':_0x31ba3c,'path':_0x223c0e}];_0x1ca4bf[_0x3545('0x1e')][_0x3545('0x1f')]=util[_0x3545('0x12')](_0x3545('0x20'),JSON[_0x3545('0x21')](_0x28e9d6,null,0x2));}else if(fs[_0x3545('0x22')](_0x31765a)){_0x28e9d6[_0x3545('0x1c')]=_0x3545('0x1d');_0x1ca4bf['message'][_0x3545('0x23')]=[{'filename':_0x3178da,'path':_0x31765a}];}else{_0x1ca4bf[_0x3545('0x1e')][_0x3545('0x1f')]=_0x3545('0x24');if(!_0x12ff95[_0x3545('0x25')]){_0x443db1=![];logger['info'](_0x3545('0x26'));}}if(_0x443db1){return client[_0x3545('0x27')](_0x3545('0x28'),_0x1ca4bf)[_0x3545('0x29')](function(_0x3b7506){if(_0x3b7506['error']){return logger[_0x3545('0x2a')]('error\x20mail',JSON[_0x3545('0x21')](_0x3b7506));}return logger[_0x3545('0x2b')](_0x3545('0x2c'));})['catch'](function(_0x4174c1){return logger[_0x3545('0x2a')](_0x3545('0x2d'),JSON[_0x3545('0x21')](_0x4174c1));});}};}function handleError(){return function(_0x3eafe4){return logger[_0x3545('0x2a')](JSON['stringify'](_0x3eafe4));};}function handleResult(_0x121955){return function(_0x3784ff){logger[_0x3545('0x2b')](_0x3545('0x2e'),JSON[_0x3545('0x21')](_0x3784ff));if(_0x121955[_0x3545('0xd')]&&_0x121955['MailAccount'][_0x3545('0xf')]&&!_[_0x3545('0x2f')](_0x121955[_0x3545('0xe')])){setTimeout(handleSendEmail(_0x121955,_0x3784ff),0x3c*0x3e8);}};}function handleJob(_0x5798a9){return function(){try{if(_[_0x3545('0x2f')](_0x5798a9[_0x3545('0x15')])){return logger[_0x3545('0x2b')](_0x3545('0x30'));}if(_['isNil'](_0x5798a9['subtractUnit'])){return logger[_0x3545('0x2b')]('subtractUnit\x20null\x20or\x20undefined');}var _0x39e9c7={'startDate':moment()[_0x3545('0x31')](_0x5798a9[_0x3545('0x15')],_0x5798a9['subtractUnit'])[_0x3545('0x12')](_0x3545('0x32')),'endDate':moment()[_0x3545('0x12')](_0x3545('0x32')),'type':_0x3545('0x33'),'output':_0x5798a9[_0x3545('0x34')],'name':_0x5798a9['name']};if(!_[_0x3545('0x2f')](_0x5798a9[_0x3545('0x35')])){logger[_0x3545('0x2b')](_0x3545('0x36'),_0x5798a9[_0x3545('0x35')]);return analyticDefaultReportController[_0x3545('0x37')]({'id':_0x5798a9['DefaultReportId']},_0x39e9c7)[_0x3545('0x29')](handleResult(_0x5798a9))[_0x3545('0x38')](handleError());}if(!_[_0x3545('0x2f')](_0x5798a9[_0x3545('0x39')])){logger[_0x3545('0x2b')]('exec\x20custom\x20report\x20id:%s',_0x5798a9[_0x3545('0x39')]);return analyticCustomReportController[_0x3545('0x37')]({'id':_0x5798a9['CustomReportId']},_0x39e9c7)[_0x3545('0x29')](handleResult(_0x5798a9))[_0x3545('0x38')](handleError());}}catch(_0x178099){logger[_0x3545('0x2a')](JSON['stringify'](_0x178099));}return logger['info'](_0x3545('0x3a'));};}function getJobs(_0x4eb223){var _0x16128f={};if(_0x4eb223){_0x16128f['id']=_0x4eb223;}return db[_0x3545('0x3b')][_0x3545('0x3c')]({'where':_0x16128f,'include':[{'model':db[_0x3545('0xd')],'attributes':['id',_0x3545('0x14'),_0x3545('0xe')],'include':[{'model':db[_0x3545('0x3d')],'as':_0x3545('0xf'),'include':[{'model':db[_0x3545('0x3e')],'as':_0x3545('0x3e')}]}]}]})['then'](function(_0x36b411){var _0x25d17e=_[_0x3545('0x3f')](manager[_0x3545('0x40')]);var _0x5e0fc8=_[_0x3545('0x41')](_0x36b411,function(_0x349631){return _0x349631['id']['toString']();});var _0xcd6af1=_[_0x3545('0x42')](_0x36b411,function(_0x42339d){return _0x42339d['id']['toString']();});var _0x3a07fa=_0x4eb223?_0x5e0fc8:_[_0x3545('0x43')](_0x5e0fc8,_0x25d17e);var _0x853b19=_['intersection'](_0x5e0fc8,_0x25d17e);var _0x24ce73=_[_0x3545('0x43')](_0x25d17e,_0x5e0fc8);var _0x2b1dff;var _0x155c2d;for(_0x2b1dff=0x0;_0x2b1dff<_0x24ce73['length']&&!_0x4eb223;_0x2b1dff+=0x1){_0x155c2d=_0x24ce73[_0x2b1dff][_0x3545('0x44')]();if(manager[_0x3545('0x45')](_0x155c2d)){manager[_0x3545('0x46')](_0x155c2d);manager['deleteJob'](_0x155c2d);logger[_0x3545('0x2b')](_0x3545('0x47'),_0x155c2d);}}logger[_0x3545('0x2b')](_0x3545('0x48'),JSON[_0x3545('0x21')](_0x3a07fa));for(_0x2b1dff=0x0;_0x2b1dff<_0x3a07fa[_0x3545('0x49')];_0x2b1dff+=0x1){_0x155c2d=_0x3a07fa[_0x2b1dff]['toString']();logger[_0x3545('0x2b')](_0x3545('0x4a'),_0x155c2d);if(_0x4eb223){logger[_0x3545('0x2b')](_0x3545('0x4b'),_0x4eb223);logger[_0x3545('0x2b')](JSON['stringify'](_0xcd6af1[_0x155c2d]));BPromise[_0x3545('0x4c')]()[_0x3545('0x29')](handleJob(_0xcd6af1[_0x155c2d]));logger[_0x3545('0x2b')](_0x3545('0x4d'),_0xcd6af1[_0x155c2d][_0x3545('0x14')],_0xcd6af1[_0x155c2d]['cron']);}else if(_0xcd6af1[_0x155c2d][_0x3545('0x4e')]&&_0xcd6af1[_0x155c2d]['active']&&moment()['isBetween'](_0xcd6af1[_0x155c2d][_0x3545('0x4f')],_0xcd6af1[_0x155c2d][_0x3545('0x50')])){manager[_0x3545('0x51')](_0x155c2d,_0xcd6af1[_0x155c2d][_0x3545('0x4e')],handleJob(_0xcd6af1[_0x155c2d]));manager[_0x3545('0x52')](_0x155c2d);logger[_0x3545('0x2b')](_0x3545('0x53'),_0xcd6af1[_0x155c2d][_0x3545('0x14')],_0xcd6af1[_0x155c2d][_0x3545('0x4e')]);}else if(manager[_0x3545('0x45')](_0x155c2d)){manager['stop'](_0x155c2d);manager['deleteJob'](_0x155c2d);logger['info'](_0x3545('0x54'),_0xcd6af1[_0x155c2d][_0x3545('0x14')],_0xcd6af1[_0x155c2d][_0x3545('0x4e')]);}}for(_0x2b1dff=0x0,_0x155c2d;_0x2b1dff<_0x853b19[_0x3545('0x49')]&&!_0x4eb223;_0x2b1dff+=0x1){_0x155c2d=_0x853b19[_0x2b1dff][_0x3545('0x44')]();if(manager[_0x3545('0x45')](_0x155c2d)){if(_0xcd6af1[_0x155c2d][_0x3545('0x4e')]&&_0xcd6af1[_0x155c2d][_0x3545('0x55')]&&moment()['isBetween'](_0xcd6af1[_0x155c2d][_0x3545('0x4f')],_0xcd6af1[_0x155c2d][_0x3545('0x50')])){manager[_0x3545('0x56')](_0x155c2d,_0xcd6af1[_0x155c2d][_0x3545('0x4e')],handleJob(_0xcd6af1[_0x155c2d]));logger['info'](_0x3545('0x57'),_0xcd6af1[_0x155c2d][_0x3545('0x14')],_0xcd6af1[_0x155c2d][_0x3545('0x4e')]);}else{manager['stop'](_0x155c2d);manager[_0x3545('0x58')](_0x155c2d);logger[_0x3545('0x2b')](_0x3545('0x54'),_0xcd6af1[_0x155c2d][_0x3545('0x14')],_0xcd6af1[_0x155c2d][_0x3545('0x4e')]);}}}})[_0x3545('0x38')](function(_0x371333){logger[_0x3545('0x2a')](JSON[_0x3545('0x21')](_0x371333));});}exports[_0x3545('0x59')]=function(_0x24622e){return getJobs(_0x24622e);};exports[_0x3545('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0009=['run\x20job','cron','active','startAt','endAt','stop\x20cron','update\x20cron','run','start','util','path','lodash','moment','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','basename','extname','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','Schedule','findAll','CloudProvider','keys','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve'];(function(_0x311b05,_0x455499){var _0x19be31=function(_0x231c67){while(--_0x231c67){_0x311b05['push'](_0x311b05['shift']());}};_0x19be31(++_0x455499);}(_0x0009,0xf6));var _0x9000=function(_0x18ae8f,_0x25f684){_0x18ae8f=_0x18ae8f-0x0;var _0x43e219=_0x0009[_0x18ae8f];return _0x43e219;};'use strict';var fs=require('fs');var util=require(_0x9000('0x0'));var path=require(_0x9000('0x1'));var _=require(_0x9000('0x2'));var moment=require(_0x9000('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x9000('0x4'));var BPromise=require(_0x9000('0x5'));var logger=require(_0x9000('0x6'))('schedule');var db=require(_0x9000('0x7'))['db'];var analyticCustomReportController=require(_0x9000('0x8'));var analyticDefaultReportController=require(_0x9000('0x9'));var client=jayson[_0x9000('0xa')][_0x9000('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5dbb4a,_0x3f1af6){return function(){logger[_0x9000('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5dbb4a[_0x9000('0xd')]);var _0xc7b8f8=!![];var _0x389fb9=_0x5dbb4a[_0x9000('0xe')][_0x9000('0xf')]();var _0x4392d0={'account':_0x389fb9,'message':{'from':util[_0x9000('0x10')](_0x9000('0x11'),_0x5dbb4a[_0x9000('0xe')][_0x9000('0x12')],_0x5dbb4a[_0x9000('0xe')][_0x9000('0xd')]||_0x5dbb4a['MailAccount'][_0x9000('0x13')][_0x9000('0x14')]),'to':_0x5dbb4a['email'],'cc':_0x5dbb4a['cc'],'bcc':_0x5dbb4a[_0x9000('0x15')],'subject':util[_0x9000('0x10')](_0x9000('0x16'),_0x3f1af6['name'],_0x5dbb4a['subtractNumber'],_0x5dbb4a['subtractUnit'])}};var _0x2cfc29=path[_0x9000('0x17')](__dirname,_0x9000('0x18'));var _0x1925d0=_0x3f1af6[_0x9000('0x19')];var _0x27ecde=util[_0x9000('0x10')]('%s.%s',path[_0x9000('0x1a')](_0x3f1af6[_0x9000('0x19')],path[_0x9000('0x1b')](_0x3f1af6['savename'])),'zip');var _0xd233fe=path[_0x9000('0x17')](_0x2cfc29,_0x1925d0);var _0x3683e6=path[_0x9000('0x17')](_0x2cfc29,_0x27ecde);if(fs[_0x9000('0x1c')](_0xd233fe)){_0x3f1af6[_0x9000('0x1d')]=_0x9000('0x1e');_0x4392d0[_0x9000('0x1f')][_0x9000('0x20')]=[{'filename':_0x1925d0,'path':_0xd233fe}];_0x4392d0[_0x9000('0x1f')][_0x9000('0x21')]=util[_0x9000('0x10')](_0x9000('0x22'),JSON[_0x9000('0x23')](_0x3f1af6,null,0x2));}else if(fs[_0x9000('0x1c')](_0x3683e6)){_0x3f1af6[_0x9000('0x1d')]=_0x9000('0x1e');_0x4392d0['message']['attachments']=[{'filename':_0x27ecde,'path':_0x3683e6}];}else{_0x4392d0[_0x9000('0x1f')][_0x9000('0x21')]=_0x9000('0x24');if(!_0x5dbb4a['sendIfEmpty']){_0xc7b8f8=![];logger['info'](_0x9000('0x25'));}}if(_0xc7b8f8){return client['request'](_0x9000('0x26'),_0x4392d0)[_0x9000('0x27')](function(_0x6d59e4){if(_0x6d59e4[_0x9000('0x28')]){return logger[_0x9000('0x28')](_0x9000('0x29'),JSON[_0x9000('0x23')](_0x6d59e4));}return logger['info']('email\x20sent');})[_0x9000('0x2a')](function(_0x4d8b0a){return logger[_0x9000('0x28')](_0x9000('0x29'),JSON[_0x9000('0x23')](_0x4d8b0a));});}};}function handleError(){return function(_0x2eeb43){return logger['error'](JSON[_0x9000('0x23')](_0x2eeb43));};}function handleResult(_0x35c42e){return function(_0x368220){logger[_0x9000('0xc')]('data',JSON[_0x9000('0x23')](_0x368220));if(_0x35c42e[_0x9000('0xe')]&&_0x35c42e[_0x9000('0xe')][_0x9000('0x13')]&&!_[_0x9000('0x2b')](_0x35c42e['email'])){setTimeout(handleSendEmail(_0x35c42e,_0x368220),0x3c*0x3e8);}};}function handleJob(_0x2d403f){return function(){try{if(_[_0x9000('0x2b')](_0x2d403f[_0x9000('0x2c')])){return logger[_0x9000('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x9000('0x2b')](_0x2d403f[_0x9000('0x2d')])){return logger[_0x9000('0xc')](_0x9000('0x2e'));}var _0x5b8382={'startDate':moment()[_0x9000('0x2f')](_0x2d403f[_0x9000('0x2c')],_0x2d403f['subtractUnit'])[_0x9000('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x9000('0x30')),'type':'scheduled','output':_0x2d403f[_0x9000('0x31')],'name':_0x2d403f[_0x9000('0x12')]};if(!_[_0x9000('0x2b')](_0x2d403f[_0x9000('0x32')])){logger[_0x9000('0xc')](_0x9000('0x33'),_0x2d403f[_0x9000('0x32')]);return analyticDefaultReportController['runReport']({'id':_0x2d403f[_0x9000('0x32')]},_0x5b8382)['then'](handleResult(_0x2d403f))[_0x9000('0x2a')](handleError());}if(!_[_0x9000('0x2b')](_0x2d403f['CustomReportId'])){logger[_0x9000('0xc')]('exec\x20custom\x20report\x20id:%s',_0x2d403f[_0x9000('0x34')]);return analyticCustomReportController['runReport']({'id':_0x2d403f[_0x9000('0x34')]},_0x5b8382)[_0x9000('0x27')](handleResult(_0x2d403f))[_0x9000('0x2a')](handleError());}}catch(_0x5e3730){logger[_0x9000('0x28')](JSON[_0x9000('0x23')](_0x5e3730));}return logger[_0x9000('0xc')]('no\x20report\x20id');};}function getJobs(_0x46475e){var _0x132a40={};if(_0x46475e){_0x132a40['id']=_0x46475e;}return db[_0x9000('0x35')][_0x9000('0x36')]({'where':_0x132a40,'include':[{'model':db[_0x9000('0xe')],'attributes':['id',_0x9000('0x12'),_0x9000('0xd')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x9000('0x37')],'as':_0x9000('0x37')}]}]}]})[_0x9000('0x27')](function(_0xc1c139){var _0xb15987=_[_0x9000('0x38')](manager['jobs']);var _0x4ca650=_[_0x9000('0x39')](_0xc1c139,function(_0x478ae6){return _0x478ae6['id'][_0x9000('0x3a')]();});var _0x253426=_[_0x9000('0x3b')](_0xc1c139,function(_0x1eebdc){return _0x1eebdc['id'][_0x9000('0x3a')]();});var _0x2ae095=_0x46475e?_0x4ca650:_[_0x9000('0x3c')](_0x4ca650,_0xb15987);var _0x32a7f1=_[_0x9000('0x3d')](_0x4ca650,_0xb15987);var _0x14a581=_[_0x9000('0x3c')](_0xb15987,_0x4ca650);var _0x5f3dcb;var _0x237061;for(_0x5f3dcb=0x0;_0x5f3dcb<_0x14a581[_0x9000('0x3e')]&&!_0x46475e;_0x5f3dcb+=0x1){_0x237061=_0x14a581[_0x5f3dcb][_0x9000('0x3a')]();if(manager[_0x9000('0x3f')](_0x237061)){manager[_0x9000('0x40')](_0x237061);manager[_0x9000('0x41')](_0x237061);logger[_0x9000('0xc')](_0x9000('0x42'),_0x237061);}}logger[_0x9000('0xc')](_0x9000('0x43'),JSON[_0x9000('0x23')](_0x2ae095));for(_0x5f3dcb=0x0;_0x5f3dcb<_0x2ae095[_0x9000('0x3e')];_0x5f3dcb+=0x1){_0x237061=_0x2ae095[_0x5f3dcb][_0x9000('0x3a')]();logger[_0x9000('0xc')]('index',_0x237061);if(_0x46475e){logger['info'](_0x9000('0x44'),_0x46475e);logger[_0x9000('0xc')](JSON[_0x9000('0x23')](_0x253426[_0x237061]));BPromise[_0x9000('0x45')]()[_0x9000('0x27')](handleJob(_0x253426[_0x237061]));logger[_0x9000('0xc')](_0x9000('0x46'),_0x253426[_0x237061]['name'],_0x253426[_0x237061][_0x9000('0x47')]);}else if(_0x253426[_0x237061]['cron']&&_0x253426[_0x237061][_0x9000('0x48')]&&moment()['isBetween'](_0x253426[_0x237061][_0x9000('0x49')],_0x253426[_0x237061][_0x9000('0x4a')])){manager['add'](_0x237061,_0x253426[_0x237061][_0x9000('0x47')],handleJob(_0x253426[_0x237061]));manager['start'](_0x237061);logger['info']('add\x20cron',_0x253426[_0x237061][_0x9000('0x12')],_0x253426[_0x237061][_0x9000('0x47')]);}else if(manager['exists'](_0x237061)){manager[_0x9000('0x40')](_0x237061);manager[_0x9000('0x41')](_0x237061);logger[_0x9000('0xc')](_0x9000('0x4b'),_0x253426[_0x237061]['name'],_0x253426[_0x237061]['cron']);}}for(_0x5f3dcb=0x0,_0x237061;_0x5f3dcb<_0x32a7f1[_0x9000('0x3e')]&&!_0x46475e;_0x5f3dcb+=0x1){_0x237061=_0x32a7f1[_0x5f3dcb][_0x9000('0x3a')]();if(manager[_0x9000('0x3f')](_0x237061)){if(_0x253426[_0x237061][_0x9000('0x47')]&&_0x253426[_0x237061]['active']&&moment()['isBetween'](_0x253426[_0x237061][_0x9000('0x49')],_0x253426[_0x237061][_0x9000('0x4a')])){manager['update'](_0x237061,_0x253426[_0x237061]['cron'],handleJob(_0x253426[_0x237061]));logger[_0x9000('0xc')](_0x9000('0x4c'),_0x253426[_0x237061][_0x9000('0x12')],_0x253426[_0x237061][_0x9000('0x47')]);}else{manager[_0x9000('0x40')](_0x237061);manager[_0x9000('0x41')](_0x237061);logger[_0x9000('0xc')]('stop\x20cron',_0x253426[_0x237061]['name'],_0x253426[_0x237061]['cron']);}}}})[_0x9000('0x2a')](function(_0x15860d){logger['error'](JSON[_0x9000('0x23')](_0x15860d));});}exports[_0x9000('0x4d')]=function(_0x4ca707){return getJobs(_0x4ca707);};exports[_0x9000('0x4e')]=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 67d454a..6835e8a 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 _0x1516=['data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available'];(function(_0x1291b4,_0x2657c1){var _0x393b26=function(_0x1034c5){while(--_0x1034c5){_0x1291b4['push'](_0x1291b4['shift']());}};_0x393b26(++_0x2657c1);}(_0x1516,0xb0));var _0x6151=function(_0x36374c,_0x13bb2e){_0x36374c=_0x36374c-0x0;var _0x231cc5=_0x1516[_0x36374c];return _0x231cc5;};var _=require(_0x6151('0x0'));var AWS=require(_0x6151('0x1'));var rp=require(_0x6151('0x2'));var util=require('util');var BPromise=require(_0x6151('0x3'));var db=require(_0x6151('0x4'))['db'];var logger=require(_0x6151('0x5'))(_0x6151('0x6'));function getTranscriptionJob(_0x122679,_0x59bdaf,_0x198e1d,_0x52ab35){return new Promise(function(_0x69f924,_0x2585cd){var _0x319164=new AWS[(_0x6151('0x7'))]({'accessKeyId':_0x59bdaf,'secretAccessKey':_0x122679,'region':_0x198e1d});_0x319164[_0x6151('0x8')]({'TranscriptionJobName':_0x52ab35},function(_0x43513c,_0x44cc85){if(_0x43513c){return _0x2585cd(_0x43513c);}else{return _0x69f924(_0x44cc85);}});});}function sentiment(_0x2dfed8,_0x6349d9,_0x5c5b55,_0x5d2278,_0x13c0a8){return new Promise(function(_0x22ff2d,_0xb9019b){var _0x469a87=new AWS[(_0x6151('0x9'))]({'accessKeyId':_0x6349d9,'secretAccessKey':_0x2dfed8,'region':_0x5c5b55});_0x469a87[_0x6151('0xa')]({'Text':_0x5d2278,'LanguageCode':_0x13c0a8[_0x6151('0xb')](0x0,0x2)},function(_0x181946,_0x8306aa){if(_0x181946){return _0xb9019b(_0x181946);}else{return _0x22ff2d(_0x8306aa);}});});}function checkTranscribeJob(_0x573f0f,_0x55b225,_0x314156){var _0xb88b77;return new BPromise(function(_0x219873,_0x5752bb){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0xe'),_0x573f0f['id'],_0x573f0f[_0x6151('0xf')]));return getTranscriptionJob(_0x314156['data1'],_0x314156[_0x6151('0x10')],_0x55b225['transcribeRegion'],_0x573f0f[_0x6151('0xf')])[_0x6151('0x11')](function(_0x34d111){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x12'),_0x573f0f['id'],_0x573f0f[_0x6151('0xf')],_0x34d111[_0x6151('0x13')]['TranscriptionJobStatus']));if(!_0x573f0f[_0x6151('0x14')]){switch(_0x34d111[_0x6151('0x13')]['TranscriptionJobStatus']){case _0x6151('0x15'):var _0x24bfbd={'transcribeStatus':_0x34d111[_0x6151('0x13')][_0x6151('0x16')],'fileUri':_0x34d111[_0x6151('0x13')][_0x6151('0x17')][_0x6151('0x18')]};logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x19'),_0x573f0f['id']));return rp({'uri':_0x34d111[_0x6151('0x13')][_0x6151('0x17')][_0x6151('0x18')],'json':!![]})[_0x6151('0x11')](function(_0x452035){logger['info'](util[_0x6151('0xd')](_0x6151('0x1a'),_0x573f0f['id']));if(_0x452035&&_0x452035['results']&&_0x452035[_0x6151('0x1b')][_0x6151('0x1c')]&&_0x452035[_0x6151('0x1b')]['transcripts'][_0x6151('0x1d')]){_0x24bfbd[_0x6151('0x14')]='';for(var _0x4810dd=0x0;_0x4810dd<_0x452035[_0x6151('0x1b')][_0x6151('0x1c')][_0x6151('0x1d')];_0x4810dd++){_0x24bfbd[_0x6151('0x14')]+=_0x452035['results'][_0x6151('0x1c')][_0x4810dd][_0x6151('0x1e')]+'';}}return _0x573f0f[_0x6151('0x1f')](_0x24bfbd);})[_0x6151('0x11')](function(){logger['info'](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));if(!_0x573f0f[_0x6151('0x21')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x23'));}if(!_0x55b225['sentiment']||!_0x55b225[_0x6151('0x24')]||!_0x55b225[_0x6151('0x25')]||!_0x55b225[_0x6151('0x26')]||!_0x55b225[_0x6151('0x27')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x29'));}if(!_0x24bfbd[_0x6151('0x14')]){throw new Error(_0x6151('0x2a'));}if(_0x55b225[_0x6151('0x24')]===_0x314156['id']){return _0x314156;}else{return db[_0x6151('0x2b')][_0x6151('0x2c')]({'where':{'id':_settings[_0x6151('0x24')]}});}})[_0x6151('0x11')](function(_0x459970){if(!_0x459970){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x459970[_0x6151('0x2e')]||!_0x459970[_0x6151('0x10')]){throw new db[(_0x6151('0x28'))]['ValidationError'](_0x6151('0x2f'));}_0xb88b77=_0x459970;logger['info'](util[_0x6151('0xd')](_0x6151('0x30'),_0x573f0f['id']));return sentiment(_0xb88b77['data1'],_0xb88b77[_0x6151('0x10')],_0x55b225['sentimentRegion'],_0x24bfbd[_0x6151('0x14')],_0x55b225[_0x6151('0x26')]);})[_0x6151('0x11')](function(_0x4525f9){logger['info'](util[_0x6151('0xd')](_0x6151('0x31'),_0x573f0f['id']));return _0x573f0f[_0x6151('0x1f')]({'sentiment':_0x4525f9['Sentiment'],'sPositive':_0x4525f9[_0x6151('0x32')][_0x6151('0x33')],'sNegative':_0x4525f9[_0x6151('0x32')]['Negative'],'sMixed':_0x4525f9[_0x6151('0x32')][_0x6151('0x34')],'sNeutral':_0x4525f9['SentimentScore'][_0x6151('0x35')]});})[_0x6151('0x11')](function(){logger[_0x6151('0xc')](util[_0x6151('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x573f0f['id']));_0x219873();});case'FAILED':return _0x573f0f[_0x6151('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x34d111[_0x6151('0x13')][_0x6151('0x36')]})[_0x6151('0x11')](function(){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));_0x219873();});default:logger['info'](util[_0x6151('0xd')](_0x6151('0x37'),_0x573f0f['id']));break;}}else{return BPromise[_0x6151('0x38')]()[_0x6151('0x11')](function(){if(!_0x573f0f[_0x6151('0x21')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x23'));}if(!_0x55b225[_0x6151('0x39')]||!_0x55b225[_0x6151('0x24')]||!_0x55b225[_0x6151('0x25')]||!_0x55b225['language']||!_0x55b225['bucket']){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x29'));}if(!_0x573f0f[_0x6151('0x14')]){throw new Error(_0x6151('0x2a'));}if(_0x55b225['sentimentAccountId']===_0x314156['id']){return _0x314156;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6151('0x11')](function(_0x10513a){if(!_0x10513a){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x10513a[_0x6151('0x2e')]||!_0x10513a[_0x6151('0x10')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x2f'));}_0xb88b77=_0x10513a;logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x30'),_0x573f0f['id']));return sentiment(_0xb88b77[_0x6151('0x2e')],_0xb88b77['data2'],_0x55b225[_0x6151('0x25')],_0x573f0f['fileText'],_0x55b225[_0x6151('0x26')]);})[_0x6151('0x11')](function(_0x554118){logger[_0x6151('0xc')](util['format'](_0x6151('0x31'),_0x573f0f['id']));return _0x573f0f['update']({'sentiment':_0x554118[_0x6151('0x3a')],'sPositive':_0x554118[_0x6151('0x32')][_0x6151('0x33')],'sNegative':_0x554118[_0x6151('0x32')][_0x6151('0x3b')],'sMixed':_0x554118['SentimentScore']['Mixed'],'sNeutral':_0x554118[_0x6151('0x32')][_0x6151('0x35')],'transcribeStatus':_0x6151('0x15')});})[_0x6151('0x11')](function(){logger['info'](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));_0x219873();});}})[_0x6151('0x3c')](function(_0x172911){if(_0x172911){if(!_0x172911[_0x6151('0x3d')]||_0x172911[_0x6151('0x3d')]!==_0x6151('0x3e')){logger[_0x6151('0x3f')](util[_0x6151('0xd')](_0x6151('0x40'),_0x573f0f['id']),util[_0x6151('0x41')](_0x172911,{'showHidden':![],'depth':null}));}}_0x219873();});});}function checkTranscribe(){var _0x301791;var _0x2fcc9d;var _0x599f3a;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x6151('0x42')}})[_0x6151('0x11')](function(_0x42c441){if(!_0x42c441||!_0x42c441[_0x6151('0x1d')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x301791=_0x42c441;return db[_0x6151('0x43')][_0x6151('0x2c')]({'where':{'id':0x1}});})[_0x6151('0x11')](function(_0x45d5aa){if(!_0x45d5aa){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x44'));}_0x2fcc9d=_0x45d5aa;if(!_0x2fcc9d['transcribe']||!_0x2fcc9d[_0x6151('0x45')]||!_0x2fcc9d[_0x6151('0x46')]||!_0x2fcc9d[_0x6151('0x26')]||!_0x2fcc9d[_0x6151('0x27')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x47'));}return db[_0x6151('0x2b')][_0x6151('0x2c')]({'where':{'id':_0x2fcc9d[_0x6151('0x45')]}});})['then'](function(_0x552622){if(!_0x552622){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x552622[_0x6151('0x2e')]||!_0x552622[_0x6151('0x10')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x2f'));}_0x599f3a=_0x552622;var _0x10bb54=[];_0x301791[_0x6151('0x48')](function(_0x408d6e){_0x10bb54['push'](checkTranscribeJob(_0x408d6e,_0x2fcc9d,_0x599f3a));});return BPromise['all'](_0x10bb54);})[_0x6151('0x3c')](function(_0xefd27){if(_0xefd27){if(!_0xefd27[_0x6151('0x3d')]||_0xefd27[_0x6151('0x3d')]!==_0x6151('0x3e')){logger['error'](util['inspect'](_0xefd27,{'showHidden':![],'depth':null}));}}});}exports[_0x6151('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc23d=['fileText','TranscriptionJobStatus','Transcript','TranscriptFileUri','transcripts','results','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','data1','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','all','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob'];(function(_0x23b0d5,_0x5c0cfc){var _0x2b6ef8=function(_0x2fc259){while(--_0x2fc259){_0x23b0d5['push'](_0x23b0d5['shift']());}};_0x2b6ef8(++_0x5c0cfc);}(_0xc23d,0x7f));var _0xdc23=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0xc23d[_0x33e93d];return _0x19e99d;};var _=require(_0xdc23('0x0'));var AWS=require(_0xdc23('0x1'));var rp=require(_0xdc23('0x2'));var util=require(_0xdc23('0x3'));var BPromise=require(_0xdc23('0x4'));var db=require(_0xdc23('0x5'))['db'];var logger=require('../../config/logger')(_0xdc23('0x6'));function getTranscriptionJob(_0x202655,_0x38fc3c,_0xa69924,_0x2a93af){return new Promise(function(_0x5b6bec,_0x4a153f){var _0x17cb48=new AWS['TranscribeService']({'accessKeyId':_0x38fc3c,'secretAccessKey':_0x202655,'region':_0xa69924});_0x17cb48[_0xdc23('0x7')]({'TranscriptionJobName':_0x2a93af},function(_0x4d16cf,_0x459f6d){if(_0x4d16cf){return _0x4a153f(_0x4d16cf);}else{return _0x5b6bec(_0x459f6d);}});});}function sentiment(_0x31b677,_0x25a783,_0x43ba94,_0x7c2a2d,_0x5b11a9){return new Promise(function(_0x18ef88,_0x468cbd){var _0x20abc2=new AWS[(_0xdc23('0x8'))]({'accessKeyId':_0x25a783,'secretAccessKey':_0x31b677,'region':_0x43ba94});_0x20abc2[_0xdc23('0x9')]({'Text':_0x7c2a2d,'LanguageCode':_0x5b11a9[_0xdc23('0xa')](0x0,0x2)},function(_0x5ecadd,_0x2c6a47){if(_0x5ecadd){return _0x468cbd(_0x5ecadd);}else{return _0x18ef88(_0x2c6a47);}});});}function checkTranscribeJob(_0x2785d6,_0x43e23e,_0x186423){var _0x4aea2a;return new BPromise(function(_0xbb187f,_0x41238e){logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0xd'),_0x2785d6['id'],_0x2785d6[_0xdc23('0xe')]));return getTranscriptionJob(_0x186423['data1'],_0x186423[_0xdc23('0xf')],_0x43e23e['transcribeRegion'],_0x2785d6[_0xdc23('0xe')])[_0xdc23('0x10')](function(_0x2ba40a){logger['info'](util[_0xdc23('0xc')](_0xdc23('0x11'),_0x2785d6['id'],_0x2785d6[_0xdc23('0xe')],_0x2ba40a[_0xdc23('0x12')]['TranscriptionJobStatus']));if(!_0x2785d6[_0xdc23('0x13')]){switch(_0x2ba40a[_0xdc23('0x12')][_0xdc23('0x14')]){case'COMPLETED':var _0x4819f7={'transcribeStatus':_0x2ba40a[_0xdc23('0x12')][_0xdc23('0x14')],'fileUri':_0x2ba40a[_0xdc23('0x12')][_0xdc23('0x15')][_0xdc23('0x16')]};logger[_0xdc23('0xb')](util[_0xdc23('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x2785d6['id']));return rp({'uri':_0x2ba40a[_0xdc23('0x12')]['Transcript'][_0xdc23('0x16')],'json':!![]})[_0xdc23('0x10')](function(_0x3af256){logger[_0xdc23('0xb')](util[_0xdc23('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2785d6['id']));if(_0x3af256&&_0x3af256['results']&&_0x3af256['results'][_0xdc23('0x17')]&&_0x3af256[_0xdc23('0x18')][_0xdc23('0x17')][_0xdc23('0x19')]){_0x4819f7[_0xdc23('0x13')]='';for(var _0x3ba59f=0x0;_0x3ba59f<_0x3af256[_0xdc23('0x18')][_0xdc23('0x17')][_0xdc23('0x19')];_0x3ba59f++){_0x4819f7[_0xdc23('0x13')]+=_0x3af256[_0xdc23('0x18')]['transcripts'][_0x3ba59f][_0xdc23('0x1a')]+'';}}return _0x2785d6['update'](_0x4819f7);})[_0xdc23('0x10')](function(){logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x1b'),_0x2785d6['id']));if(!_0x2785d6[_0xdc23('0x1c')]){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x43e23e[_0xdc23('0x1f')]||!_0x43e23e[_0xdc23('0x20')]||!_0x43e23e['sentimentRegion']||!_0x43e23e[_0xdc23('0x21')]||!_0x43e23e[_0xdc23('0x22')]){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x23'));}if(!_0x4819f7[_0xdc23('0x13')]){throw new Error(_0xdc23('0x24'));}if(_0x43e23e[_0xdc23('0x20')]===_0x186423['id']){return _0x186423;}else{return db[_0xdc23('0x25')][_0xdc23('0x26')]({'where':{'id':_settings[_0xdc23('0x20')]}});}})['then'](function(_0x5df321){if(!_0x5df321){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x27'));}if(!_0x5df321['data1']||!_0x5df321[_0xdc23('0xf')]){throw new db[(_0xdc23('0x1d'))]['ValidationError'](_0xdc23('0x28'));}_0x4aea2a=_0x5df321;logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x29'),_0x2785d6['id']));return sentiment(_0x4aea2a['data1'],_0x4aea2a[_0xdc23('0xf')],_0x43e23e[_0xdc23('0x2a')],_0x4819f7['fileText'],_0x43e23e[_0xdc23('0x21')]);})[_0xdc23('0x10')](function(_0x70b054){logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x2b'),_0x2785d6['id']));return _0x2785d6[_0xdc23('0x2c')]({'sentiment':_0x70b054[_0xdc23('0x2d')],'sPositive':_0x70b054[_0xdc23('0x2e')][_0xdc23('0x2f')],'sNegative':_0x70b054[_0xdc23('0x2e')][_0xdc23('0x30')],'sMixed':_0x70b054['SentimentScore'][_0xdc23('0x31')],'sNeutral':_0x70b054['SentimentScore'][_0xdc23('0x32')]});})[_0xdc23('0x10')](function(){logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x1b'),_0x2785d6['id']));_0xbb187f();});case _0xdc23('0x33'):return _0x2785d6[_0xdc23('0x2c')]({'transcribeStatus':_0xdc23('0x33'),'failureReason':_0x2ba40a[_0xdc23('0x12')][_0xdc23('0x34')]})[_0xdc23('0x10')](function(){logger['info'](util[_0xdc23('0xc')](_0xdc23('0x1b'),_0x2785d6['id']));_0xbb187f();});default:logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x35'),_0x2785d6['id']));break;}}else{return BPromise[_0xdc23('0x36')]()[_0xdc23('0x10')](function(){if(!_0x2785d6['tempSentiment']){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x37'));}if(!_0x43e23e[_0xdc23('0x1f')]||!_0x43e23e[_0xdc23('0x20')]||!_0x43e23e[_0xdc23('0x2a')]||!_0x43e23e[_0xdc23('0x21')]||!_0x43e23e['bucket']){throw new db['Sequelize'][(_0xdc23('0x1e'))](_0xdc23('0x23'));}if(!_0x2785d6['fileText']){throw new Error(_0xdc23('0x24'));}if(_0x43e23e[_0xdc23('0x20')]===_0x186423['id']){return _0x186423;}else{return db[_0xdc23('0x25')][_0xdc23('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdc23('0x10')](function(_0x1f2d49){if(!_0x1f2d49){throw new db['Sequelize'][(_0xdc23('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1f2d49[_0xdc23('0x38')]||!_0x1f2d49['data2']){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x28'));}_0x4aea2a=_0x1f2d49;logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x29'),_0x2785d6['id']));return sentiment(_0x4aea2a[_0xdc23('0x38')],_0x4aea2a['data2'],_0x43e23e[_0xdc23('0x2a')],_0x2785d6['fileText'],_0x43e23e[_0xdc23('0x21')]);})[_0xdc23('0x10')](function(_0x2d086d){logger[_0xdc23('0xb')](util[_0xdc23('0xc')](_0xdc23('0x2b'),_0x2785d6['id']));return _0x2785d6[_0xdc23('0x2c')]({'sentiment':_0x2d086d['Sentiment'],'sPositive':_0x2d086d['SentimentScore'][_0xdc23('0x2f')],'sNegative':_0x2d086d[_0xdc23('0x2e')][_0xdc23('0x30')],'sMixed':_0x2d086d['SentimentScore'][_0xdc23('0x31')],'sNeutral':_0x2d086d[_0xdc23('0x2e')][_0xdc23('0x32')],'transcribeStatus':_0xdc23('0x39')});})[_0xdc23('0x10')](function(){logger[_0xdc23('0xb')](util['format'](_0xdc23('0x1b'),_0x2785d6['id']));_0xbb187f();});}})['catch'](function(_0x27f005){if(_0x27f005){if(!_0x27f005['name']||_0x27f005[_0xdc23('0x3a')]!==_0xdc23('0x3b')){logger[_0xdc23('0x3c')](util[_0xdc23('0xc')](_0xdc23('0x3d'),_0x2785d6['id']),util[_0xdc23('0x3e')](_0x27f005,{'showHidden':![],'depth':null}));}}_0xbb187f();});});}function checkTranscribe(){var _0x3a3a7f;var _0x32bc63;var _0x46aff9;return db[_0xdc23('0x3f')][_0xdc23('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdc23('0x10')](function(_0x544c7a){if(!_0x544c7a||!_0x544c7a[_0xdc23('0x19')]){throw new db[(_0xdc23('0x1d'))]['ValidationError'](_0xdc23('0x41'));}_0x3a3a7f=_0x544c7a;return db[_0xdc23('0x42')][_0xdc23('0x26')]({'where':{'id':0x1}});})[_0xdc23('0x10')](function(_0x56b03b){if(!_0x56b03b){throw new db[(_0xdc23('0x1d'))]['ValidationError'](_0xdc23('0x43'));}_0x32bc63=_0x56b03b;if(!_0x32bc63[_0xdc23('0x6')]||!_0x32bc63[_0xdc23('0x44')]||!_0x32bc63[_0xdc23('0x45')]||!_0x32bc63[_0xdc23('0x21')]||!_0x32bc63[_0xdc23('0x22')]){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x46'));}return db[_0xdc23('0x25')]['findOne']({'where':{'id':_0x32bc63['transcribeAccountId']}});})['then'](function(_0x8d132){if(!_0x8d132){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x8d132['data1']||!_0x8d132[_0xdc23('0xf')]){throw new db[(_0xdc23('0x1d'))][(_0xdc23('0x1e'))](_0xdc23('0x28'));}_0x46aff9=_0x8d132;var _0x2589d5=[];_0x3a3a7f[_0xdc23('0x47')](function(_0x15e2e9){_0x2589d5['push'](checkTranscribeJob(_0x15e2e9,_0x32bc63,_0x46aff9));});return BPromise[_0xdc23('0x48')](_0x2589d5);})['catch'](function(_0x1e9474){if(_0x1e9474){if(!_0x1e9474[_0xdc23('0x3a')]||_0x1e9474[_0xdc23('0x3a')]!==_0xdc23('0x3b')){logger['error'](util[_0xdc23('0x3e')](_0x1e9474,{'showHidden':![],'depth':null}));}}});}exports['start']=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 8963a2b..a11ec25 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 _0x80d4=['redis','defaults','WhatsappInteraction','findAll','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','start','lodash','moment','ioredis','../../config/environment','../logger','schedule'];(function(_0x479516,_0x58cc6f){var _0x2ffa7b=function(_0x101a1c){while(--_0x101a1c){_0x479516['push'](_0x479516['shift']());}};_0x2ffa7b(++_0x58cc6f);}(_0x80d4,0x1da));var _0x480d=function(_0x518a14,_0x5264be){_0x518a14=_0x518a14-0x0;var _0xd6cad5=_0x80d4[_0x518a14];return _0xd6cad5;};'use strict';var _=require(_0x480d('0x0'));var moment=require(_0x480d('0x1'));var Redis=require(_0x480d('0x2'));var util=require('util');var config=require(_0x480d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x480d('0x4'))(_0x480d('0x5'));config[_0x480d('0x6')]=_[_0x480d('0x7')](config[_0x480d('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x480d('0x6')]));function closeInteractions(){var _0x3a49dc=[];return db[_0x480d('0x8')][_0x480d('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x480d('0xa'))}}})[_0x480d('0xb')](function(_0x30363f){if(_0x30363f&&_0x30363f[_0x480d('0xc')]){_0x3a49dc=_['map'](_0x30363f||[],'id');logger['info'](_0x480d('0xd'),_0x3a49dc[_0x480d('0xe')]());return db['WhatsappInteraction'][_0x480d('0xf')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x480d('0x10')](_0x480d('0x11'))},{'where':{'id':_0x3a49dc}});}})[_0x480d('0xb')](function(){if(_0x3a49dc&&_0x3a49dc[_0x480d('0xc')]){logger[_0x480d('0x12')](_0x480d('0x13'),_0x3a49dc[_0x480d('0xe')]());for(var _0x4ced90=0x0;_0x4ced90<_0x3a49dc[_0x480d('0xc')];_0x4ced90++){io[_0x480d('0x14')]('whatsappInteraction:update',{'id':_0x3a49dc[_0x4ced90],'closed':!![]});}}})['catch'](function(_0x5645db){logger[_0x480d('0x15')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x5645db?util[_0x480d('0x16')](_0x5645db,{'showHidden':![],'depth':null}):'');});}exports[_0x480d('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4bfc=['util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis'];(function(_0x8c3505,_0x428516){var _0x4a26fd=function(_0x3e77d2){while(--_0x3e77d2){_0x8c3505['push'](_0x8c3505['shift']());}};_0x4a26fd(++_0x428516);}(_0x4bfc,0x134));var _0xc4bf=function(_0x2585f8,_0x450ed9){_0x2585f8=_0x2585f8-0x0;var _0x281df4=_0x4bfc[_0x2585f8];return _0x281df4;};'use strict';var _=require('lodash');var moment=require(_0xc4bf('0x0'));var Redis=require(_0xc4bf('0x1'));var util=require(_0xc4bf('0x2'));var config=require(_0xc4bf('0x3'));var db=require(_0xc4bf('0x4'))['db'];var logger=require(_0xc4bf('0x5'))('schedule');config[_0xc4bf('0x6')]=_[_0xc4bf('0x7')](config[_0xc4bf('0x6')],{'host':_0xc4bf('0x8'),'port':0x18eb});var io=require(_0xc4bf('0x9'))(new Redis(config[_0xc4bf('0x6')]));function closeInteractions(){var _0x2b4769=[];return db[_0xc4bf('0xa')][_0xc4bf('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc4bf('0xc'))}}})[_0xc4bf('0xd')](function(_0x581e8b){if(_0x581e8b&&_0x581e8b[_0xc4bf('0xe')]){_0x2b4769=_[_0xc4bf('0xf')](_0x581e8b||[],'id');logger['info'](_0xc4bf('0x10'),_0x2b4769[_0xc4bf('0x11')]());return db[_0xc4bf('0xa')][_0xc4bf('0x12')]({'closeReason':_0xc4bf('0x13'),'disposition':_0xc4bf('0x14'),'closed':!![],'closedAt':moment()[_0xc4bf('0x15')](_0xc4bf('0x16'))},{'where':{'id':_0x2b4769}});}})[_0xc4bf('0xd')](function(){if(_0x2b4769&&_0x2b4769['length']){logger[_0xc4bf('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2b4769[_0xc4bf('0x11')]());for(var _0x90b640=0x0;_0x90b640<_0x2b4769[_0xc4bf('0xe')];_0x90b640++){io[_0xc4bf('0x18')](_0xc4bf('0x19'),{'id':_0x2b4769[_0x90b640],'closed':!![]});}}})[_0xc4bf('0x1a')](function(_0x430f27){logger[_0xc4bf('0x1b')](_0xc4bf('0x1c'),_0x430f27?util[_0xc4bf('0x1d')](_0x430f27,{'showHidden':![],'depth':null}):'');});}exports[_0xc4bf('0x1e')]=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 3cc1c40..c131189 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3169=['finished\x20populating','CmHopper','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log'];(function(_0x8f7bbb,_0x5b652b){var _0x5764d2=function(_0x2266ca){while(--_0x2266ca){_0x8f7bbb['push'](_0x8f7bbb['shift']());}};_0x5764d2(++_0x5b652b);}(_0x3169,0x125));var _0x9316=function(_0x33199e,_0x428ded){_0x33199e=_0x33199e-0x0;var _0x2eef3c=_0x3169[_0x33199e];return _0x2eef3c;};'use strict';var util=require(_0x9316('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9316('0x1')]({'id':i,'firstName':_0x9316('0x2')+i,'lastName':_0x9316('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9316('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9316('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9316('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9316('0x5')](),'updatedAt':Date[_0x9316('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9316('0x1')]({'id':i,'firstName':_0x9316('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9316('0x5')](),'updatedAt':Date[_0x9316('0x5')]()});}db[_0x9316('0x6')][_0x9316('0x7')]({'where':{}})['then'](function(){return db[_0x9316('0x6')][_0x9316('0x8')](contacts);})[_0x9316('0x9')](function(){console[_0x9316('0xa')](_0x9316('0xb'),'contacts1');return db[_0x9316('0xc')][_0x9316('0x7')]({'where':{}});})[_0x9316('0x9')](function(){return db[_0x9316('0xc')]['bulkCreate'](hopper);})['then'](function(){console[_0x9316('0xa')](_0x9316('0xb'),'hopper1');return db[_0x9316('0x6')][_0x9316('0x8')](contacts2);})[_0x9316('0x9')](function(){console[_0x9316('0xa')](_0x9316('0xb'),_0x9316('0xd'));return db[_0x9316('0xc')]['bulkCreate'](hopper2);})[_0x9316('0x9')](function(){console['log'](_0x9316('0xb'),_0x9316('0xe'));})[_0x9316('0xf')](function(_0x5c9fd9){console['log'](_0x5c9fd9);}); \ No newline at end of file +var _0x31b6=['catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','then','bulkCreate','log','finished\x20populating','CmHopper','destroy','hopper1','contacts2','hopper2'];(function(_0x2d4521,_0x8d98b6){var _0x5d765f=function(_0x21795d){while(--_0x21795d){_0x2d4521['push'](_0x2d4521['shift']());}};_0x5d765f(++_0x8d98b6);}(_0x31b6,0x1d5));var _0x631b=function(_0x50245d,_0x520a37){_0x50245d=_0x50245d-0x0;var _0x9db1ea=_0x31b6[_0x50245d];return _0x9db1ea;};'use strict';var util=require('util');var db=require(_0x631b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x631b('0x1')+i,'phone':0xf879fb460+i,'email':_0x631b('0x2')+i+_0x631b('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x631b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x631b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x631b('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x631b('0x4')]({'id':i,'firstName':_0x631b('0x6')+i,'lastName':_0x631b('0x1')+i,'phone':0xf879fb460+i,'email':_0x631b('0x2')+i+_0x631b('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x631b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x631b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x631b('0x5')](),'updatedAt':Date['now']()});}db[_0x631b('0x7')]['destroy']({'where':{}})[_0x631b('0x8')](function(){return db['CmContact'][_0x631b('0x9')](contacts);})[_0x631b('0x8')](function(){console[_0x631b('0xa')](_0x631b('0xb'),'contacts1');return db[_0x631b('0xc')][_0x631b('0xd')]({'where':{}});})[_0x631b('0x8')](function(){return db[_0x631b('0xc')][_0x631b('0x9')](hopper);})[_0x631b('0x8')](function(){console[_0x631b('0xa')](_0x631b('0xb'),_0x631b('0xe'));return db[_0x631b('0x7')][_0x631b('0x9')](contacts2);})[_0x631b('0x8')](function(){console[_0x631b('0xa')](_0x631b('0xb'),_0x631b('0xf'));return db['CmHopper'][_0x631b('0x9')](hopper2);})[_0x631b('0x8')](function(){console[_0x631b('0xa')](_0x631b('0xb'),_0x631b('0x10'));})[_0x631b('0x11')](function(_0x3a0f86){console[_0x631b('0xa')](_0x3a0f86);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 224d7e2..0270dcc 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d85=['log','add\x20user','util','../mysqldb','push','format','%s%s','agent','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x3d85,0x192));var _0x53d8=function(_0x3ef464,_0x4c41e3){_0x3ef464=_0x3ef464-0x0;var _0x50c97a=_0x3d85[_0x3ef464];return _0x50c97a;};'use strict';var util=require(_0x53d8('0x0'));var db=require(_0x53d8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x53d8('0x2')]({'name':util[_0x53d8('0x3')](_0x53d8('0x4'),'agent',i),'fullname':util['format']('%s%s',_0x53d8('0x5'),i),'email':util[_0x53d8('0x3')]('%s%s@xcally.com',_0x53d8('0x5'),i),'role':_0x53d8('0x5'),'password':'password','internal':0xfa0+i,'type':_0x53d8('0x6'),'transport':['udp','ws',_0x53d8('0x7')],'disallow':[_0x53d8('0x8')],'allow':[_0x53d8('0x9')],'defaultuser':util[_0x53d8('0x3')]('%s%s',_0x53d8('0x5'),i),'encryption':'yes','avpf':_0x53d8('0xa'),'force_avp':'yes','icesupport':_0x53d8('0xa'),'dtlsenable':_0x53d8('0xa'),'dtlsverify':'no','dtlscertfile':_0x53d8('0xb'),'dtlsprivatekey':_0x53d8('0xc'),'dtlssetup':_0x53d8('0xd'),'callerid':util[_0x53d8('0x3')](_0x53d8('0xe'),util[_0x53d8('0x3')]('%s%s',_0x53d8('0x5'),i),0xfa0+i)});}db[_0x53d8('0xf')][_0x53d8('0x10')](users)[_0x53d8('0x11')](function(){console[_0x53d8('0x12')](_0x53d8('0x13'));})['catch'](function(_0x5e0bff){console[_0x53d8('0x12')](_0x5e0bff);}); \ No newline at end of file +var _0xc53c=['%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x48eb8e,_0x24be3f){var _0x414d04=function(_0x3ea2b3){while(--_0x3ea2b3){_0x48eb8e['push'](_0x48eb8e['shift']());}};_0x414d04(++_0x24be3f);}(_0xc53c,0x104));var _0xcc53=function(_0x432ddc,_0x5556a2){_0x432ddc=_0x432ddc-0x0;var _0x1f374e=_0xc53c[_0x432ddc];return _0x1f374e;};'use strict';var util=require(_0xcc53('0x0'));var db=require(_0xcc53('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xcc53('0x2')]({'name':util[_0xcc53('0x3')](_0xcc53('0x4'),_0xcc53('0x5'),i),'fullname':util[_0xcc53('0x3')](_0xcc53('0x4'),_0xcc53('0x5'),i),'email':util[_0xcc53('0x3')](_0xcc53('0x6'),_0xcc53('0x5'),i),'role':'agent','password':_0xcc53('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0xcc53('0x8'),'ws',_0xcc53('0x9')],'disallow':[_0xcc53('0xa')],'allow':[_0xcc53('0xb')],'defaultuser':util[_0xcc53('0x3')](_0xcc53('0x4'),_0xcc53('0x5'),i),'encryption':'yes','avpf':_0xcc53('0xc'),'force_avp':_0xcc53('0xc'),'icesupport':_0xcc53('0xc'),'dtlsenable':_0xcc53('0xc'),'dtlsverify':'no','dtlscertfile':_0xcc53('0xd'),'dtlsprivatekey':_0xcc53('0xe'),'dtlssetup':_0xcc53('0xf'),'callerid':util['format'](_0xcc53('0x10'),util[_0xcc53('0x3')](_0xcc53('0x4'),'agent',i),0xfa0+i)});}db[_0xcc53('0x11')]['bulkCreate'](users)[_0xcc53('0x12')](function(){console[_0xcc53('0x13')](_0xcc53('0x14'));})[_0xcc53('0x15')](function(_0x2d04ca){console['log'](_0x2d04ca);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index cdbfec5..31fa9ba 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa962=['getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','mail','openchannel','whatsapp','telephone:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','setMaxListeners','request','remoteAddress','remotePort','connectedAt','log','nsp','address','disconnect','lodash','util','../mysqldb','./environment','name','Agents','role','agent','telephone','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','User','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueues','WhatsappQueues','getVoiceQueues','getChatQueues'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xa962,0xea));var _0x2a96=function(_0x545c74,_0x216386){_0x545c74=_0x545c74-0x0;var _0x55f6db=_0xa962[_0x545c74];return _0x55f6db;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var BPromise=require('bluebird');var db=require(_0x2a96('0x2'))['db'];var config=require(_0x2a96('0x3'));var queryQueues={'attributes':['id',_0x2a96('0x4')],'include':[{'as':_0x2a96('0x5'),'model':db['User'],'attributes':['id',_0x2a96('0x4'),_0x2a96('0x6')],'raw':!![],'where':{'role':_0x2a96('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2a96('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2a96('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2a96('0x4')],'where':{'role':_0x2a96('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2a96('0x4'),'type'],'where':{'type':_0x2a96('0x9')}};function getAssociatedResources(_0x2a6371,_0x431069,_0x4d8e6a){return db[_0x2a96('0xa')]['findOne']({'where':{'name':_0x2a6371,'userProfileId':_0x431069},'raw':!![]})[_0x2a96('0xb')](function(_0x4e2d4b){if(_0x4e2d4b){if(_0x4e2d4b['autoAssociation']){switch(_0x2a6371){case _0x2a96('0xc'):case _0x2a96('0xd'):case'FaxQueues':case _0x2a96('0xe'):case'MailQueues':case _0x2a96('0xf'):case'WhatsappQueues':return db[_0x4d8e6a][_0x2a96('0x10')](queryQueues);case _0x2a96('0x11'):return db[_0x4d8e6a][_0x2a96('0x10')](queryTelephones);case'Trunks':return db[_0x4d8e6a]['findAll'](queryTrunks);case _0x2a96('0x12'):return db[_0x4d8e6a]['findAll'](queryCampaigns);}}else{return db[_0x2a96('0x13')][_0x2a96('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x4e2d4b['id']},'raw':!![]})['then'](function(_0x23997b){if(_0x23997b){var _0x5da80e={'where':{'id':_[_0x2a96('0x14')](_0x23997b,_0x2a96('0x15'))},'raw':!![]};switch(_0x4d8e6a){case'User':_0x5da80e[_0x2a96('0x16')][_0x2a96('0x6')]=_0x2a96('0x8');break;case _0x2a96('0x17'):_0x5da80e[_0x2a96('0x16')]['type']='ivr';break;}return db[_0x4d8e6a][_0x2a96('0x10')](_0x5da80e);}else{return[];}});}}else{return[];}})[_0x2a96('0xb')](function(_0x2732d0){return _0x2732d0;});}function joinOrLeaveQueues(_0x54d5d3,_0x417e8a,_0x24c47f,_0xf727de){_0x54d5d3[_0x417e8a](util[_0x2a96('0x18')](_0x2a96('0x19'),_0x24c47f,_0xf727de[_0x2a96('0x4')]));if(_0xf727de['Agents']){for(var _0x546fe0=0x0;_0x546fe0<_0xf727de['Agents'][_0x2a96('0x1a')];_0x546fe0+=0x1){_0x54d5d3[_0x417e8a](util['format'](_0x2a96('0x1b'),_0xf727de[_0x2a96('0x5')][_0x546fe0][_0x2a96('0x4')]));}}}function joinOrLeave(_0x2aa3a6,_0x50dc5b,_0x4b7cae){var _0x2fd3db;if(_0x2aa3a6[_0x2a96('0x1c')][_0x2a96('0x1d')]['id']){db[_0x2a96('0x1e')][_0x2a96('0x1f')]({'attributes':['id',_0x2a96('0x4'),'role',_0x2a96('0x20')],'where':{'id':_0x2aa3a6[_0x2a96('0x1c')][_0x2a96('0x1d')]['id']},'include':[{'model':db[_0x2a96('0x21')],'as':_0x2a96('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x2a96('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2a96('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x2a96('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2a96('0x26')],'as':_0x2a96('0x27'),'attributes':['id'],'raw':!![]}]})[_0x2a96('0xb')](function(_0x54770e){if(_0x54770e){_0x2fd3db=_0x54770e;_0x2aa3a6[_0x50dc5b](util[_0x2a96('0x18')](_0x2a96('0x1b'),_0x54770e['name']));var _0x4dd76e=[];switch(_0x54770e[_0x2a96('0x6')]){case _0x2a96('0x28'):_0x2aa3a6[_0x50dc5b](_0x2a96('0x29'));_0x2aa3a6[_0x50dc5b](_0x2a96('0x2a'));if(queryQueues[_0x2a96('0x2b')](_0x2a96('0x2c'))){delete queryQueues[_0x2a96('0x2c')];}_0x4dd76e[_0x2a96('0x2d')](db['VoiceQueue'][_0x2a96('0x10')](queryQueues));_0x4dd76e['push'](db[_0x2a96('0x2e')][_0x2a96('0x10')](queryQueues));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x2f')][_0x2a96('0x10')](queryQueues));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x30')][_0x2a96('0x10')](queryQueues));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x31')]['findAll'](queryQueues));_0x4dd76e['push'](db[_0x2a96('0x32')][_0x2a96('0x10')](queryQueues));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x33')][_0x2a96('0x10')](queryQueues));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x1e')][_0x2a96('0x10')](queryTelephones));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x34')][_0x2a96('0x10')](queryTrunks));_0x4dd76e[_0x2a96('0x2d')](db[_0x2a96('0x17')]['findAll'](queryCampaigns));_0x4dd76e['push'](db['User']['findAll'](queryAgents));break;case _0x2a96('0x35'):_0x2aa3a6[_0x50dc5b](_0x2a96('0x29'));_0x2aa3a6[_0x50dc5b](_0x2a96('0x2a'));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources(_0x2a96('0xc'),_0x54770e['userProfileId'],_0x2a96('0x36')));_0x4dd76e['push'](getAssociatedResources(_0x2a96('0xd'),_0x54770e[_0x2a96('0x20')],_0x2a96('0x2e')));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources(_0x2a96('0x37'),_0x54770e[_0x2a96('0x20')],_0x2a96('0x2f')));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources(_0x2a96('0xe'),_0x54770e[_0x2a96('0x20')],_0x2a96('0x30')));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources(_0x2a96('0x38'),_0x54770e[_0x2a96('0x20')],'MailQueue'));_0x4dd76e['push'](getAssociatedResources(_0x2a96('0xf'),_0x54770e[_0x2a96('0x20')],'OpenchannelQueue'));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources(_0x2a96('0x39'),_0x54770e['userProfileId'],'WhatsappQueue'));_0x4dd76e['push'](getAssociatedResources(_0x2a96('0x11'),_0x54770e[_0x2a96('0x20')],_0x2a96('0x1e')));_0x4dd76e['push'](getAssociatedResources('Trunks',_0x54770e[_0x2a96('0x20')],_0x2a96('0x34')));_0x4dd76e[_0x2a96('0x2d')](getAssociatedResources('IvrCampaigns',_0x54770e['userProfileId'],_0x2a96('0x17')));_0x4dd76e['push'](db[_0x2a96('0x1e')][_0x2a96('0x10')](queryAgents));break;case'agent':_0x2aa3a6[_0x50dc5b](_0x2a96('0x29'));_0x2aa3a6[_0x50dc5b](_0x2a96('0x2a'));_0x4dd76e[_0x2a96('0x2d')](_0x54770e[_0x2a96('0x3a')]({'attributes':['id',_0x2a96('0x4')]}));_0x4dd76e[_0x2a96('0x2d')](_0x54770e[_0x2a96('0x3b')]({'attributes':['id',_0x2a96('0x4')]}));_0x4dd76e['push'](_0x54770e[_0x2a96('0x3c')]({'attributes':['id',_0x2a96('0x4')]}));_0x4dd76e[_0x2a96('0x2d')](_0x54770e[_0x2a96('0x3d')]({'attributes':['id','name']}));_0x4dd76e['push'](_0x54770e[_0x2a96('0x3e')]({'attributes':['id',_0x2a96('0x4')]}));_0x4dd76e[_0x2a96('0x2d')](_0x54770e[_0x2a96('0x3f')]({'attributes':['id',_0x2a96('0x4')]}));_0x4dd76e['push'](_0x54770e['getWhatsappQueues']({'attributes':['id',_0x2a96('0x4')]}));break;}return BPromise[_0x2a96('0x40')](_0x4dd76e);}})[_0x2a96('0xb')](function(_0x4e19d0){if(_0x4e19d0&&_0x4e19d0[_0x2a96('0x1a')]){for(var _0x382411=0x0;_0x382411<_0x4e19d0['length'];_0x382411+=0x1){for(var _0x2daa14=0x0;_0x2daa14<_0x4e19d0[_0x382411][_0x2a96('0x1a')];_0x2daa14+=0x1){switch(_0x382411){case 0x0:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,_0x2a96('0x41'),_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x1:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,_0x2a96('0x42'),_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x2:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,'fax',_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x3:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,'sms',_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x4:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,_0x2a96('0x43'),_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x5:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,_0x2a96('0x44'),_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x6:joinOrLeaveQueues(_0x2aa3a6,_0x50dc5b,_0x2a96('0x45'),_0x4e19d0[_0x382411][_0x2daa14]);break;case 0x7:if(_0x2fd3db['role']!==_0x2a96('0x7'))_0x2aa3a6[_0x50dc5b](util['format'](_0x2a96('0x46'),_0x4e19d0[_0x382411][_0x2daa14]['name']));break;case 0x8:if(_0x2fd3db['role']!==_0x2a96('0x7'))_0x2aa3a6[_0x50dc5b](util['format']('trunk:%s',_0x4e19d0[_0x382411][_0x2daa14][_0x2a96('0x4')]));break;case 0x9:if(_0x2fd3db['role']!==_0x2a96('0x7'))_0x2aa3a6[_0x50dc5b](util[_0x2a96('0x18')]('campaign:%s:%s',_0x4e19d0[_0x382411][_0x2daa14]['type'],_0x4e19d0[_0x382411][_0x2daa14][_0x2a96('0x4')]));break;case 0xa:_0x2aa3a6[_0x50dc5b](util['format'](_0x2a96('0x1b'),_0x4e19d0[_0x382411][_0x2daa14][_0x2a96('0x4')]));break;}}}}})['then'](function(){if(_0x50dc5b==='leave'){var _0x45861b=_['map'](_0x2fd3db['ChatInteractions'],'id');return _0x2fd3db[_0x2a96('0x47')](_0x45861b)[_0x2a96('0xb')](function(){for(var _0x1238cc=0x0;_0x1238cc<_0x45861b[_0x2a96('0x1a')];_0x1238cc+=0x1){_0x4b7cae[_0x2a96('0x48')](_0x2a96('0x49'),{'ChatInteractionId':Number(_0x45861b[_0x1238cc]),'UserId':Number(_0x2fd3db['id'])});}});}})[_0x2a96('0xb')](function(){if(_0x50dc5b===_0x2a96('0x4a')){var _0x25cae5=_[_0x2a96('0x14')](_0x2fd3db[_0x2a96('0x23')],'id');return _0x2fd3db[_0x2a96('0x4b')](_0x25cae5)[_0x2a96('0xb')](function(){for(var _0x356e0d=0x0;_0x356e0d<_0x25cae5['length'];_0x356e0d+=0x1){_0x4b7cae['emit'](_0x2a96('0x4c'),{'MailInteractionId':Number(_0x25cae5[_0x356e0d]),'UserId':Number(_0x2fd3db['id'])});}});}})[_0x2a96('0xb')](function(){if(_0x50dc5b===_0x2a96('0x4a')){var _0x3cddd5=_[_0x2a96('0x14')](_0x2fd3db[_0x2a96('0x4d')],'id');return _0x2fd3db[_0x2a96('0x4e')](_0x3cddd5)[_0x2a96('0xb')](function(){for(var _0x56a621=0x0;_0x56a621<_0x3cddd5[_0x2a96('0x1a')];_0x56a621+=0x1){_0x4b7cae[_0x2a96('0x48')](_0x2a96('0x4f'),{'FaxInteractionId':Number(_0x3cddd5[_0x56a621]),'UserId':Number(_0x2fd3db['id'])});}});}})['then'](function(){if(_0x50dc5b==='leave'){var _0x2b2450=_[_0x2a96('0x14')](_0x2fd3db[_0x2a96('0x25')],'id');return _0x2fd3db[_0x2a96('0x50')](_0x2b2450)[_0x2a96('0xb')](function(){for(var _0x4f51bf=0x0;_0x4f51bf<_0x2b2450['length'];_0x4f51bf+=0x1){_0x4b7cae[_0x2a96('0x48')](_0x2a96('0x51'),{'SmsInteractionId':Number(_0x2b2450[_0x4f51bf]),'UserId':Number(_0x2fd3db['id'])});}});}})[_0x2a96('0xb')](function(){if(_0x50dc5b===_0x2a96('0x4a')){var _0x46c011=_['map'](_0x2fd3db[_0x2a96('0x52')],'id');return _0x2fd3db[_0x2a96('0x53')](_0x46c011)[_0x2a96('0xb')](function(){for(var _0x3844c4=0x0;_0x3844c4<_0x46c011[_0x2a96('0x1a')];_0x3844c4+=0x1){_0x4b7cae[_0x2a96('0x48')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x46c011[_0x3844c4]),'UserId':Number(_0x2fd3db['id'])});}});}})[_0x2a96('0xb')](function(){if(_0x50dc5b===_0x2a96('0x4a')){var _0x2e7759=_['map'](_0x2fd3db['WhatsappInteractions'],'id');return _0x2fd3db[_0x2a96('0x54')](_0x2e7759)['then'](function(){for(var _0x371402=0x0;_0x371402<_0x2e7759[_0x2a96('0x1a')];_0x371402+=0x1){_0x4b7cae[_0x2a96('0x48')](_0x2a96('0x55'),{'WhatsappInteractionId':Number(_0x2e7759[_0x371402]),'UserId':Number(_0x2fd3db['id'])});}});}})[_0x2a96('0x56')](function(_0x246f2b){_0x2aa3a6['log'](_0x246f2b);});}}function onDisconnect(_0x296cc6,_0x2d67fe){joinOrLeave(_0x296cc6,_0x2a96('0x4a'),_0x2d67fe);}function onConnect(_0x131a5f){joinOrLeave(_0x131a5f,_0x2a96('0x57'));}exports[_0x2a96('0x58')]=function(_0x154f75){_0x154f75['on']('connection',function(_0x52ed70){_0x52ed70[_0x2a96('0x59')](0x0);_0x52ed70['address']=_0x52ed70[_0x2a96('0x5a')]['connection'][_0x2a96('0x5b')]+':'+_0x52ed70[_0x2a96('0x5a')]['connection'][_0x2a96('0x5c')];_0x52ed70[_0x2a96('0x5d')]=new Date();_0x52ed70[_0x2a96('0x5e')]=function(_0x1be21a){console[_0x2a96('0x5e')]('SocketIO\x20'+_0x52ed70[_0x2a96('0x5f')]['name']+'['+_0x52ed70[_0x2a96('0x60')]+']',_0x1be21a);};_0x52ed70['on'](_0x2a96('0x61'),function(){onDisconnect(_0x52ed70,_0x154f75);_0x52ed70['log']('DISCONNECTED');});onConnect(_0x52ed70);_0x52ed70[_0x2a96('0x5e')]('CONNECTED');});}; \ No newline at end of file +var _0xe683=['OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:outbound','hasOwnProperty','include','VoiceQueue','push','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:inbound','ChatQueue','FaxQueue','OpenchannelQueues','OpenchannelQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','role','Campaign','type','format','length','user:%s','handshake','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction'];(function(_0x3168e1,_0xa046e0){var _0x13ad69=function(_0x136b1f){while(--_0x136b1f){_0x3168e1['push'](_0x3168e1['shift']());}};_0x13ad69(++_0xa046e0);}(_0xe683,0x1d7));var _0x3e68=function(_0x512202,_0x1f06da){_0x512202=_0x512202-0x0;var _0x28cba1=_0xe683[_0x512202];return _0x28cba1;};'use strict';var _=require(_0x3e68('0x0'));var util=require(_0x3e68('0x1'));var BPromise=require(_0x3e68('0x2'));var db=require(_0x3e68('0x3'))['db'];var config=require(_0x3e68('0x4'));var queryQueues={'attributes':['id',_0x3e68('0x5')],'include':[{'as':_0x3e68('0x6'),'model':db[_0x3e68('0x7')],'attributes':['id',_0x3e68('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3e68('0x5')],'where':{'role':_0x3e68('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3e68('0x5')],'where':{'role':_0x3e68('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x3e68('0xa')}};function getAssociatedResources(_0x23afe1,_0x59ad45,_0x5acf9a){return db[_0x3e68('0xb')][_0x3e68('0xc')]({'where':{'name':_0x23afe1,'userProfileId':_0x59ad45},'raw':!![]})['then'](function(_0x1cde9d){if(_0x1cde9d){if(_0x1cde9d[_0x3e68('0xd')]){switch(_0x23afe1){case _0x3e68('0xe'):case _0x3e68('0xf'):case _0x3e68('0x10'):case _0x3e68('0x11'):case _0x3e68('0x12'):case'OpenchannelQueues':case _0x3e68('0x13'):return db[_0x5acf9a][_0x3e68('0x14')](queryQueues);case _0x3e68('0x15'):return db[_0x5acf9a]['findAll'](queryTelephones);case _0x3e68('0x16'):return db[_0x5acf9a][_0x3e68('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x5acf9a][_0x3e68('0x14')](queryCampaigns);}}else{return db[_0x3e68('0x17')]['findAll']({'attributes':[_0x3e68('0x18')],'where':{'sectionId':_0x1cde9d['id']},'raw':!![]})[_0x3e68('0x19')](function(_0x79fc22){if(_0x79fc22){var _0x29b4de={'where':{'id':_[_0x3e68('0x1a')](_0x79fc22,'resourceId')},'raw':!![]};switch(_0x5acf9a){case _0x3e68('0x7'):_0x29b4de[_0x3e68('0x1b')][_0x3e68('0x1c')]=_0x3e68('0x8');break;case _0x3e68('0x1d'):_0x29b4de[_0x3e68('0x1b')][_0x3e68('0x1e')]=_0x3e68('0xa');break;}return db[_0x5acf9a][_0x3e68('0x14')](_0x29b4de);}else{return[];}});}}else{return[];}})[_0x3e68('0x19')](function(_0x1d9146){return _0x1d9146;});}function joinOrLeaveQueues(_0x1c9494,_0x2f683f,_0x8a07dc,_0x1c4d04){_0x1c9494[_0x2f683f](util[_0x3e68('0x1f')]('%s:queue:%s',_0x8a07dc,_0x1c4d04[_0x3e68('0x5')]));if(_0x1c4d04[_0x3e68('0x6')]){for(var _0x3e0da8=0x0;_0x3e0da8<_0x1c4d04[_0x3e68('0x6')][_0x3e68('0x20')];_0x3e0da8+=0x1){_0x1c9494[_0x2f683f](util[_0x3e68('0x1f')](_0x3e68('0x21'),_0x1c4d04[_0x3e68('0x6')][_0x3e0da8][_0x3e68('0x5')]));}}}function joinOrLeave(_0x4469b4,_0x12466e,_0x2cadcd){var _0xfe9fac;if(_0x4469b4[_0x3e68('0x22')][_0x3e68('0x23')]['id']){db[_0x3e68('0x7')][_0x3e68('0x24')]({'attributes':['id','name','role',_0x3e68('0x25')],'where':{'id':_0x4469b4['handshake'][_0x3e68('0x23')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3e68('0x26')],'as':_0x3e68('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e68('0x28')],'as':_0x3e68('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e68('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3e68('0x2b')],'as':_0x3e68('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e68('0x2d')],'as':_0x3e68('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x3e68('0x19')](function(_0x18ecc0){if(_0x18ecc0){_0xfe9fac=_0x18ecc0;_0x4469b4[_0x12466e](util[_0x3e68('0x1f')](_0x3e68('0x21'),_0x18ecc0[_0x3e68('0x5')]));var _0x506de3=[];switch(_0x18ecc0[_0x3e68('0x1c')]){case'admin':_0x4469b4[_0x12466e]('voice:inbound');_0x4469b4[_0x12466e](_0x3e68('0x2f'));if(queryQueues[_0x3e68('0x30')](_0x3e68('0x31'))){delete queryQueues['include'];}_0x506de3['push'](db[_0x3e68('0x32')][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db['ChatQueue'][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db['FaxQueue'][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x34')]['findAll'](queryQueues));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x35')][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db['OpenchannelQueue'][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x36')][_0x3e68('0x14')](queryQueues));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x7')][_0x3e68('0x14')](queryTelephones));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x37')][_0x3e68('0x14')](queryTrunks));_0x506de3[_0x3e68('0x33')](db['Campaign'][_0x3e68('0x14')](queryCampaigns));_0x506de3['push'](db[_0x3e68('0x7')][_0x3e68('0x14')](queryAgents));break;case'user':_0x4469b4[_0x12466e](_0x3e68('0x38'));_0x4469b4[_0x12466e]('voice:outbound');_0x506de3[_0x3e68('0x33')](getAssociatedResources('VoiceQueues',_0x18ecc0['userProfileId'],_0x3e68('0x32')));_0x506de3[_0x3e68('0x33')](getAssociatedResources('ChatQueues',_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x39')));_0x506de3['push'](getAssociatedResources(_0x3e68('0x10'),_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x3a')));_0x506de3[_0x3e68('0x33')](getAssociatedResources('SmsQueues',_0x18ecc0[_0x3e68('0x25')],'SmsQueue'));_0x506de3[_0x3e68('0x33')](getAssociatedResources('MailQueues',_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x35')));_0x506de3[_0x3e68('0x33')](getAssociatedResources(_0x3e68('0x3b'),_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x3c')));_0x506de3[_0x3e68('0x33')](getAssociatedResources(_0x3e68('0x13'),_0x18ecc0['userProfileId'],_0x3e68('0x36')));_0x506de3[_0x3e68('0x33')](getAssociatedResources('Telephones',_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x7')));_0x506de3['push'](getAssociatedResources(_0x3e68('0x16'),_0x18ecc0['userProfileId'],_0x3e68('0x37')));_0x506de3[_0x3e68('0x33')](getAssociatedResources(_0x3e68('0x3d'),_0x18ecc0[_0x3e68('0x25')],_0x3e68('0x1d')));_0x506de3[_0x3e68('0x33')](db[_0x3e68('0x7')]['findAll'](queryAgents));break;case _0x3e68('0x9'):_0x4469b4[_0x12466e]('voice:inbound');_0x4469b4[_0x12466e](_0x3e68('0x2f'));_0x506de3['push'](_0x18ecc0[_0x3e68('0x3e')]({'attributes':['id',_0x3e68('0x5')]}));_0x506de3[_0x3e68('0x33')](_0x18ecc0[_0x3e68('0x3f')]({'attributes':['id',_0x3e68('0x5')]}));_0x506de3[_0x3e68('0x33')](_0x18ecc0[_0x3e68('0x40')]({'attributes':['id','name']}));_0x506de3['push'](_0x18ecc0[_0x3e68('0x41')]({'attributes':['id','name']}));_0x506de3[_0x3e68('0x33')](_0x18ecc0[_0x3e68('0x42')]({'attributes':['id',_0x3e68('0x5')]}));_0x506de3[_0x3e68('0x33')](_0x18ecc0[_0x3e68('0x43')]({'attributes':['id',_0x3e68('0x5')]}));_0x506de3[_0x3e68('0x33')](_0x18ecc0[_0x3e68('0x44')]({'attributes':['id',_0x3e68('0x5')]}));break;}return BPromise[_0x3e68('0x45')](_0x506de3);}})[_0x3e68('0x19')](function(_0x5f99cd){if(_0x5f99cd&&_0x5f99cd['length']){for(var _0x502d94=0x0;_0x502d94<_0x5f99cd['length'];_0x502d94+=0x1){for(var _0x10f7c8=0x0;_0x10f7c8<_0x5f99cd[_0x502d94][_0x3e68('0x20')];_0x10f7c8+=0x1){switch(_0x502d94){case 0x0:joinOrLeaveQueues(_0x4469b4,_0x12466e,'voice',_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x1:joinOrLeaveQueues(_0x4469b4,_0x12466e,_0x3e68('0x46'),_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x2:joinOrLeaveQueues(_0x4469b4,_0x12466e,'fax',_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x3:joinOrLeaveQueues(_0x4469b4,_0x12466e,_0x3e68('0x47'),_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x4:joinOrLeaveQueues(_0x4469b4,_0x12466e,_0x3e68('0x48'),_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x5:joinOrLeaveQueues(_0x4469b4,_0x12466e,_0x3e68('0x49'),_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x6:joinOrLeaveQueues(_0x4469b4,_0x12466e,_0x3e68('0x4a'),_0x5f99cd[_0x502d94][_0x10f7c8]);break;case 0x7:if(_0xfe9fac[_0x3e68('0x1c')]!==_0x3e68('0x9'))_0x4469b4[_0x12466e](util['format'](_0x3e68('0x4b'),_0x5f99cd[_0x502d94][_0x10f7c8][_0x3e68('0x5')]));break;case 0x8:if(_0xfe9fac[_0x3e68('0x1c')]!==_0x3e68('0x9'))_0x4469b4[_0x12466e](util['format'](_0x3e68('0x4c'),_0x5f99cd[_0x502d94][_0x10f7c8][_0x3e68('0x5')]));break;case 0x9:if(_0xfe9fac['role']!==_0x3e68('0x9'))_0x4469b4[_0x12466e](util[_0x3e68('0x1f')]('campaign:%s:%s',_0x5f99cd[_0x502d94][_0x10f7c8][_0x3e68('0x1e')],_0x5f99cd[_0x502d94][_0x10f7c8][_0x3e68('0x5')]));break;case 0xa:_0x4469b4[_0x12466e](util[_0x3e68('0x1f')](_0x3e68('0x21'),_0x5f99cd[_0x502d94][_0x10f7c8][_0x3e68('0x5')]));break;}}}}})[_0x3e68('0x19')](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x163573=_[_0x3e68('0x1a')](_0xfe9fac[_0x3e68('0x4e')],'id');return _0xfe9fac[_0x3e68('0x4f')](_0x163573)[_0x3e68('0x19')](function(){for(var _0x25df7d=0x0;_0x25df7d<_0x163573['length'];_0x25df7d+=0x1){_0x2cadcd[_0x3e68('0x50')](_0x3e68('0x51'),{'ChatInteractionId':Number(_0x163573[_0x25df7d]),'UserId':Number(_0xfe9fac['id'])});}});}})[_0x3e68('0x19')](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x39af81=_[_0x3e68('0x1a')](_0xfe9fac[_0x3e68('0x27')],'id');return _0xfe9fac[_0x3e68('0x52')](_0x39af81)['then'](function(){for(var _0x7862f2=0x0;_0x7862f2<_0x39af81[_0x3e68('0x20')];_0x7862f2+=0x1){_0x2cadcd['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x39af81[_0x7862f2]),'UserId':Number(_0xfe9fac['id'])});}});}})['then'](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x43876c=_[_0x3e68('0x1a')](_0xfe9fac['FaxInteractions'],'id');return _0xfe9fac[_0x3e68('0x53')](_0x43876c)[_0x3e68('0x19')](function(){for(var _0x10e14b=0x0;_0x10e14b<_0x43876c[_0x3e68('0x20')];_0x10e14b+=0x1){_0x2cadcd[_0x3e68('0x50')](_0x3e68('0x54'),{'FaxInteractionId':Number(_0x43876c[_0x10e14b]),'UserId':Number(_0xfe9fac['id'])});}});}})[_0x3e68('0x19')](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x2c6e78=_[_0x3e68('0x1a')](_0xfe9fac[_0x3e68('0x55')],'id');return _0xfe9fac[_0x3e68('0x56')](_0x2c6e78)[_0x3e68('0x19')](function(){for(var _0x3988e2=0x0;_0x3988e2<_0x2c6e78[_0x3e68('0x20')];_0x3988e2+=0x1){_0x2cadcd['emit'](_0x3e68('0x57'),{'SmsInteractionId':Number(_0x2c6e78[_0x3988e2]),'UserId':Number(_0xfe9fac['id'])});}});}})['then'](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x57ab2c=_['map'](_0xfe9fac[_0x3e68('0x2c')],'id');return _0xfe9fac[_0x3e68('0x58')](_0x57ab2c)['then'](function(){for(var _0x511a90=0x0;_0x511a90<_0x57ab2c['length'];_0x511a90+=0x1){_0x2cadcd[_0x3e68('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x57ab2c[_0x511a90]),'UserId':Number(_0xfe9fac['id'])});}});}})[_0x3e68('0x19')](function(){if(_0x12466e===_0x3e68('0x4d')){var _0x5c76cd=_[_0x3e68('0x1a')](_0xfe9fac[_0x3e68('0x2e')],'id');return _0xfe9fac[_0x3e68('0x59')](_0x5c76cd)['then'](function(){for(var _0x173a51=0x0;_0x173a51<_0x5c76cd[_0x3e68('0x20')];_0x173a51+=0x1){_0x2cadcd[_0x3e68('0x50')](_0x3e68('0x5a'),{'WhatsappInteractionId':Number(_0x5c76cd[_0x173a51]),'UserId':Number(_0xfe9fac['id'])});}});}})[_0x3e68('0x5b')](function(_0x237b52){_0x4469b4[_0x3e68('0x5c')](_0x237b52);});}}function onDisconnect(_0x5e7207,_0x16fa4d){joinOrLeave(_0x5e7207,_0x3e68('0x4d'),_0x16fa4d);}function onConnect(_0x20918d){joinOrLeave(_0x20918d,_0x3e68('0x5d'));}exports[_0x3e68('0x5e')]=function(_0x24c3ba){_0x24c3ba['on'](_0x3e68('0x5f'),function(_0x608a9e){_0x608a9e['setMaxListeners'](0x0);_0x608a9e[_0x3e68('0x60')]=_0x608a9e[_0x3e68('0x61')][_0x3e68('0x5f')][_0x3e68('0x62')]+':'+_0x608a9e[_0x3e68('0x61')][_0x3e68('0x5f')][_0x3e68('0x63')];_0x608a9e[_0x3e68('0x64')]=new Date();_0x608a9e[_0x3e68('0x5c')]=function(_0x153db8){console['log'](_0x3e68('0x65')+_0x608a9e[_0x3e68('0x66')][_0x3e68('0x5')]+'['+_0x608a9e[_0x3e68('0x60')]+']',_0x153db8);};_0x608a9e['on']('disconnect',function(){onDisconnect(_0x608a9e,_0x24c3ba);_0x608a9e['log']('DISCONNECTED');});onConnect(_0x608a9e);_0x608a9e['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1fc36b5..df436e9 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 _0x46e2=['ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','request','EventManager','then','info','Trigger,\x20%s','error','code','motionChannel','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','UserId','SIP/%s','channel','incomingmessage','outgoingmessage','AfterCreateMessage','get','event','opened','resolve','sequelize','query','Sequelize','QueryTypes','interface','name','agent','catch','AfterCreate','changed','closed','substatus','contact','format','User','fullname','email','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','http','Chat'];(function(_0x14590c,_0x4a9af7){var _0x5e4d49=function(_0x45ea7f){while(--_0x45ea7f){_0x14590c['push'](_0x14590c['shift']());}};_0x5e4d49(++_0x4a9af7);}(_0x46e2,0x11f));var _0x246e=function(_0x3b132f,_0x2cfb9d){_0x3b132f=_0x3b132f-0x0;var _0x3ed21d=_0x46e2[_0x3b132f];return _0x3ed21d;};'use strict';var util=require(_0x246e('0x0'));var db=require(_0x246e('0x1'))['db'];var jayson=require(_0x246e('0x2'));var logger=require('../logger')('triggers');var client=jayson['client'][_0x246e('0x3')]({'port':0x232a});var triggers=[{'channel':_0x246e('0x4'),'model':_0x246e('0x5'),'event':_0x246e('0x6'),'condition':_0x246e('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0x246e('0x5'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x246e('0x4'),'model':_0x246e('0x8'),'event':_0x246e('0x6'),'condition':_0x246e('0x9'),'callback':afterCreateMessage},{'channel':_0x246e('0x4'),'model':_0x246e('0xa'),'event':'afterCreate','condition':_0x246e('0x9'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x246e('0xb'),'event':'afterCreate','condition':_0x246e('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x246e('0xb'),'event':_0x246e('0xc'),'condition':_0x246e('0xd'),'callback':afterUpdate},{'channel':'Sms','model':_0x246e('0xe'),'event':_0x246e('0x6'),'condition':_0x246e('0x9'),'callback':afterCreateMessage},{'channel':_0x246e('0xf'),'model':_0x246e('0x10'),'event':'afterCreate','condition':_0x246e('0x7'),'callback':afterCreate},{'channel':_0x246e('0xf'),'model':_0x246e('0x10'),'event':_0x246e('0xc'),'condition':_0x246e('0xd'),'callback':afterUpdate},{'channel':_0x246e('0xf'),'model':_0x246e('0x11'),'event':_0x246e('0x6'),'condition':_0x246e('0x9'),'callback':afterCreateMessage},{'channel':_0x246e('0x12'),'model':_0x246e('0x13'),'event':_0x246e('0x6'),'condition':_0x246e('0x7'),'callback':afterCreate},{'channel':_0x246e('0x12'),'model':_0x246e('0x13'),'event':'afterUpdate','condition':_0x246e('0xd'),'callback':afterUpdate},{'channel':_0x246e('0x12'),'model':_0x246e('0x14'),'event':_0x246e('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x246e('0x15'),'model':_0x246e('0x16'),'event':'afterCreate','condition':_0x246e('0x7'),'callback':afterCreate},{'channel':_0x246e('0x15'),'model':_0x246e('0x16'),'event':_0x246e('0xc'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x246e('0x17'),'event':_0x246e('0x6'),'condition':_0x246e('0x9'),'callback':afterCreateMessage},{'channel':_0x246e('0x18'),'model':'OpenchannelInteraction','event':_0x246e('0x6'),'condition':_0x246e('0x7'),'callback':afterCreate},{'channel':_0x246e('0x18'),'model':'OpenchannelInteraction','event':_0x246e('0xc'),'condition':_0x246e('0xd'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x246e('0x6'),'condition':_0x246e('0x9'),'callback':afterCreateMessage}];function request(_0x24f3ae){return client[_0x246e('0x19')](_0x246e('0x1a'),_0x24f3ae)[_0x246e('0x1b')](function(_0x5b21f1){logger[_0x246e('0x1c')](_0x246e('0x1d'),'EventManager',_0x5b21f1);if(_0x5b21f1[_0x246e('0x1e')]){if(_0x5b21f1['error'][_0x246e('0x1f')]===0x1f4){logger[_0x246e('0x1e')](_0x246e('0x1d'),_0x246e('0x1a'),_0x5b21f1[_0x246e('0x1e')]);}}})['catch'](function(_0x50ed25){logger['error'](_0x246e('0x1d'),'EventManager',_0x50ed25);});}function afterCreateMessage(_0x3cc672){return function(_0x139cc6){_0x139cc6=_0x139cc6['get']({'plain':!![]});_0x139cc6['channel']=_0x3cc672;_0x139cc6[_0x246e('0x20')]=_0x3cc672;_0x139cc6['event']=_0x139cc6[_0x246e('0x21')];Promise['resolve']()[_0x246e('0x1b')](function(){if(typeof _0x139cc6[_0x246e('0x22')]===_0x246e('0x23'))return null;var _0x9be45f=_0x246e('0x24')+_0x139cc6[_0x246e('0x22')];return db['sequelize']['query'](_0x9be45f,{'type':db['Sequelize']['QueryTypes'][_0x246e('0x25')],'raw':!![]});})[_0x246e('0x1b')](function(_0x1f024e){if(_0x1f024e){_0x139cc6['contact']=_0x1f024e[0x0];}if(typeof _0x139cc6[_0x246e('0x26')]===_0x246e('0x23'))return;return getAgent(_0x139cc6[_0x246e('0x26')]);})[_0x246e('0x1b')](function(_0x52b2ff){if(_0x52b2ff){_0x139cc6['interface']=util['format'](_0x246e('0x27'),_0x52b2ff['name']);_0x139cc6['agent']=_0x52b2ff;_0x139cc6[_0x246e('0x28')]=_0x3cc672;return request({'event':_0x246e('0x29'),'message':_0x139cc6});}else{return request({'event':_0x246e('0x2a'),'message':_0x139cc6});}})['catch'](function(_0x461f53){logger[_0x246e('0x1e')](_0x246e('0x1d'),_0x246e('0x2b'),_0x461f53);});};}function afterCreateOfflineMessage(_0xfeacb7){return function(_0x1de2a6){_0x1de2a6=_0x1de2a6[_0x246e('0x2c')]({'plain':!![]});_0x1de2a6[_0x246e('0x28')]=_0xfeacb7;_0x1de2a6[_0x246e('0x20')]=_0xfeacb7;_0x1de2a6[_0x246e('0x2d')]='offlineMessage';return request({'event':_0x1de2a6[_0x246e('0x2d')],'message':_0x1de2a6});};}function afterCreate(_0x3fd5d7,_0x3a2c80){return function(_0x51d504){_0x51d504=_0x51d504[_0x246e('0x2c')]({'plain':!![]});_0x51d504[_0x246e('0x28')]=_0x3fd5d7;_0x51d504[_0x246e('0x20')]=_0x3fd5d7;_0x51d504['event']=_0x246e('0x2e');Promise[_0x246e('0x2f')]()[_0x246e('0x1b')](function(){var _0x34f245=_0x246e('0x24')+_0x51d504[_0x246e('0x22')];return db[_0x246e('0x30')][_0x246e('0x31')](_0x34f245,{'type':db[_0x246e('0x32')][_0x246e('0x33')][_0x246e('0x25')],'raw':!![]});})[_0x246e('0x1b')](function(_0x1afd6e){if(_0x1afd6e){_0x51d504['contact']=_0x1afd6e[0x0];}if(typeof _0x51d504[_0x246e('0x26')]===_0x246e('0x23'))return;return getAgent(_0x51d504[_0x246e('0x26')]);})['then'](function(_0x5b8916){if(_0x5b8916){_0x51d504[_0x246e('0x34')]=util['format'](_0x246e('0x27'),_0x5b8916[_0x246e('0x35')]);_0x51d504[_0x246e('0x36')]=_0x5b8916;}return request({'event':_0x3a2c80,'message':_0x51d504});})[_0x246e('0x37')](function(_0x596f3e){logger[_0x246e('0x1e')](_0x246e('0x1d'),_0x246e('0x38'),_0x596f3e);});};}function afterUpdate(_0x2cd31d){return function(_0x5c320a){var _0x59d38f=_0x5c320a[_0x246e('0x39')](_0x246e('0x3a'))&&_0x5c320a[_0x246e('0x3a')];var _0x259247=_0x5c320a[_0x246e('0x39')]('substatus');if(_0x59d38f||_0x259247){var _0x3a8d77=_0x59d38f?_0x246e('0xd'):'substatus';var _0x1aebbe=_0x5c320a[_0x246e('0x2c')]({'plain':!![]});_0x1aebbe['channel']=_0x2cd31d;_0x1aebbe[_0x246e('0x20')]=_0x2cd31d;_0x1aebbe['event']=_0x59d38f?'closed':_0x246e('0x3b');var _0x2ba47c=_0x246e('0x24')+_0x1aebbe[_0x246e('0x22')];return db[_0x246e('0x30')]['query'](_0x2ba47c,{'type':db[_0x246e('0x32')][_0x246e('0x33')][_0x246e('0x25')],'raw':!![]})[_0x246e('0x1b')](function(_0x459aa6){if(_0x459aa6){_0x1aebbe[_0x246e('0x3c')]=_0x459aa6[0x0];}if(typeof _0x1aebbe['UserId']===_0x246e('0x23'))return;return getAgent(_0x1aebbe['UserId']);})[_0x246e('0x1b')](function(_0x13b1b8){if(_0x13b1b8){_0x1aebbe[_0x246e('0x34')]=util[_0x246e('0x3d')](_0x246e('0x27'),_0x13b1b8[_0x246e('0x35')]);_0x1aebbe['agent']=_0x13b1b8;}return request({'event':_0x3a8d77,'message':_0x1aebbe});})[_0x246e('0x37')](function(_0x1f8601){logger[_0x246e('0x1e')](_0x246e('0x1d'),'AfterUpdate',_0x1f8601);});}};}function getAgent(_0x437304){return db[_0x246e('0x3e')]['find']({'where':{'id':_0x437304},'attributes':['id',_0x246e('0x35'),_0x246e('0x3f'),_0x246e('0x40'),_0x246e('0x41')],'raw':!![]})['then'](function(_0x2faef3){return _0x2faef3;});}exports['default']=function(){for(var _0x55c7e0=0x0;_0x55c7e0=_0x3c5bf2[_0xce01('0x15')]){throw Error(_0xce01('0x16'));}_0x10f024(_0x5773b1);})['catch'](function(_0x4095a2){_0x499586(_0x4095a2);});});}; \ No newline at end of file +var _0xfbcb=['getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes'];(function(_0x14ae54,_0x21aa5b){var _0x5023de=function(_0x38d291){while(--_0x38d291){_0x14ae54['push'](_0x14ae54['shift']());}};_0x5023de(++_0x21aa5b);}(_0xfbcb,0x1e7));var _0xbfbc=function(_0x103b8a,_0x5bede9){_0x103b8a=_0x103b8a-0x0;var _0x57abb1=_0xfbcb[_0x103b8a];return _0x57abb1;};'use strict';var _=require('lodash');var BPromise=require(_0xbfbc('0x0'));var db=require(_0xbfbc('0x1'))['db'];var util=require('./license/util');var channels=[_0xbfbc('0x2'),_0xbfbc('0x3'),_0xbfbc('0x4'),_0xbfbc('0x5'),_0xbfbc('0x6'),_0xbfbc('0x7'),_0xbfbc('0x8')];exports[_0xbfbc('0x9')]=function(){return channels;};exports[_0xbfbc('0xa')]=function(_0x58d869){_0x58d869=_0x58d869[_0xbfbc('0xb')]();return _[_0xbfbc('0xc')](channels,_0x58d869);};exports[_0xbfbc('0xd')]=function(_0x24c7a8,_0x4fcbdf,_0x17b8b0,_0x21d62a){var _0x2a424d={'loginAttempts':_0x4fcbdf,'blocked':_0x17b8b0};if(!_[_0xbfbc('0xe')](_0x21d62a)){_0x2a424d[_0xbfbc('0xf')]=_0x21d62a;}return _0x24c7a8[_0xbfbc('0x10')](_0x2a424d);};exports[_0xbfbc('0x11')]=function(_0x536fb2){return new BPromise(function(_0x25e46d,_0x3c9aec){var _0xefe451=0x0;if(_0x536fb2[_0xbfbc('0x12')]!==_0xbfbc('0x13')){_0x25e46d(_0x536fb2);}db['User'][_0xbfbc('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x536fb2['id']}}})[_0xbfbc('0x15')](function(_0x42a482){_0xefe451=_0x42a482;return util[_0xbfbc('0x11')]();})[_0xbfbc('0x15')](function(_0x158444){if(_0x158444&&_0x158444[_0xbfbc('0x16')]&&_0xefe451>=_0x158444[_0xbfbc('0x16')]){throw Error(_0xbfbc('0x17'));}_0x25e46d(_0x536fb2);})['catch'](function(_0x3697f0){_0x3c9aec(_0x3697f0);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 5549794..06b9f17 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','message','Not\x20Found','Forbidden','error','status','send','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x32f846,_0x7501c6){_0x32f846=_0x32f846-0x0;var _0x26309f=_0x6f0d[_0x32f846];return _0x26309f;};'use strict';var util=require('util');var logger=require(_0xd6f0('0x0'))(_0xd6f0('0x1'));var APIError=function(_0xd1480,_0x107a8c){this['message']=_0xd1480||_0xd6f0('0x2');this[_0xd6f0('0x3')]=_0x107a8c||_0xd6f0('0x4');util[_0xd6f0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3a757f){this['message']=_0x3a757f||_0xd6f0('0x6');this['name']=_0xd6f0('0x6');util[_0xd6f0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x8b89a9){this[_0xd6f0('0x7')]=_0x8b89a9||'Entity\x20not\x20found';this['name']=_0xd6f0('0x8');util[_0xd6f0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x2854cd){switch(_0x2854cd){case _0xd6f0('0x6'):return 0x190;case _0xd6f0('0x9'),'OutOfInterval':return 0x193;case _0xd6f0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xee144c){return function(_0x329f69){logger[_0xd6f0('0xa')](_0x329f69['stack']);var _0x1ce8d5=getStatusCode(_0x329f69[_0xd6f0('0x3')]);if(_0x329f69[_0xd6f0('0x3')])delete _0x329f69[_0xd6f0('0x3')];return _0xee144c[_0xd6f0('0xb')](_0x1ce8d5)[_0xd6f0('0xc')](_0x329f69);};}module[_0xd6f0('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xac4a=['Bad\x20Request','Not\x20Found','OutOfInterval','error','name','send','exports','util','../config/logger','api','message','Error','inherits'];(function(_0x498943,_0x44eb2d){var _0x3edff4=function(_0x2495e6){while(--_0x2495e6){_0x498943['push'](_0x498943['shift']());}};_0x3edff4(++_0x44eb2d);}(_0xac4a,0x13f));var _0xaac4=function(_0x45a6f1,_0x359e29){_0x45a6f1=_0x45a6f1-0x0;var _0x5e33f8=_0xac4a[_0x45a6f1];return _0x5e33f8;};'use strict';var util=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var APIError=function(_0x132fc3,_0x38f4f4){this[_0xaac4('0x3')]=_0x132fc3||'Internal\x20Server\x20Error';this['name']=_0x38f4f4||_0xaac4('0x4');util[_0xaac4('0x5')](APIError,Error);};var APIBadRequestError=function(_0x32d34c){this['message']=_0x32d34c||_0xaac4('0x6');this['name']=_0xaac4('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1e4283){this[_0xaac4('0x3')]=_0x1e4283||'Entity\x20not\x20found';this['name']=_0xaac4('0x7');util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x452573){switch(_0x452573){case'Bad\x20Request':return 0x190;case'Forbidden',_0xaac4('0x8'):return 0x193;case _0xaac4('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x38d1d0){return function(_0x5f393e){logger[_0xaac4('0x9')](_0x5f393e['stack']);var _0x508e14=getStatusCode(_0x5f393e[_0xaac4('0xa')]);if(_0x5f393e[_0xaac4('0xa')])delete _0x5f393e[_0xaac4('0xa')];return _0x38d1d0['status'](_0x508e14)[_0xaac4('0xb')](_0x5f393e);};}module[_0xaac4('0xc')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 145fd69..fbb46ad 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9651=['render','json','404','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9651,0x166));var _0x1965=function(_0x27aef9,_0x16d564){_0x27aef9=_0x27aef9-0x0;var _0x2e9fa9=_0x9651[_0x27aef9];return _0x2e9fa9;};'use strict';module['exports'][0x194]=function pageNotFound(_0x45999b,_0x4c5399){var _0x249b3c=_0x1965('0x0');var _0x510398=0x194;var _0x40a52b={'status':_0x510398};_0x4c5399[_0x1965('0x1')](_0x40a52b[_0x1965('0x1')]);_0x4c5399[_0x1965('0x2')](_0x249b3c,{},function(_0x1b5701,_0x3f7a7c){if(_0x1b5701){return _0x4c5399['status'](_0x40a52b[_0x1965('0x1')])[_0x1965('0x3')](_0x40a52b);}_0x4c5399['send'](_0x3f7a7c);});}; \ No newline at end of file +var _0x3ce2=['exports','404','status','render','json','send'];(function(_0xa92ed9,_0x4dc7b6){var _0x59c7ef=function(_0x29543f){while(--_0x29543f){_0xa92ed9['push'](_0xa92ed9['shift']());}};_0x59c7ef(++_0x4dc7b6);}(_0x3ce2,0x192));var _0x23ce=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x3ce2[_0x4fdcc0];return _0xc0ce94;};'use strict';module[_0x23ce('0x0')][0x194]=function pageNotFound(_0x1743df,_0x5389db){var _0x2e30fd=_0x23ce('0x1');var _0x360171=0x194;var _0x2ad187={'status':_0x360171};_0x5389db[_0x23ce('0x2')](_0x2ad187['status']);_0x5389db[_0x23ce('0x3')](_0x2e30fd,{},function(_0xe0c48e,_0x500895){if(_0xe0c48e){return _0x5389db[_0x23ce('0x2')](_0x2ad187[_0x23ce('0x2')])[_0x23ce('0x4')](_0x2ad187);}_0x5389db[_0x23ce('0x5')](_0x500895);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 05ed93a..97cb4f7 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bde=['Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','Template','../api/template/template.model','Trigger','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.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','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','cm_user_has_contacts','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','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','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','mailbox','VoiceMailMessage','mailboxuser','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','restrict','MailServerOut','CloudProviderId','Smtp','Dispositions','Messages','List','ListId','TemplateId','team_has_mail_queues','Owner','mail_interaction_has_tags','Users','MailInteractionId','Attachments','ChatWebsite','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','DashboardItem','FaxAccountId','Answers','Interactions','Applications','Exntensions','FaxQueue','Account','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','ThroughTags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CmContactId','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','Campaign','CampaignId','OwnerId','OneAll','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','Extensions','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','Subjects','SubjectId','Descriptions','FieldId','AccountId','Subject','Description','DescriptionId','VariableId','Field','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromUserId','ToUserId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','Imap','exports','../config/environment','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','sequelizeHistory','motion2','utf8mb4','utf8_general_ci','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model'];(function(_0x42b8ad,_0x5f0671){var _0x1802fa=function(_0x583e40){while(--_0x583e40){_0x42b8ad['push'](_0x42b8ad['shift']());}};_0x1802fa(++_0x5f0671);}(_0x0bde,0x187));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var config=require(_0xe0bd('0x0'));var Sequelize=require(_0xe0bd('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config[_0xe0bd('0x1')]=_['defaultsDeep'](config[_0xe0bd('0x1')],{'database':'motion2','username':_0xe0bd('0x2'),'password':_0xe0bd('0x3'),'options':{'host':_0xe0bd('0x4'),'port':0xcea,'dialect':_0xe0bd('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe0bd('0x6')](),'define':{'charset':_0xe0bd('0x7'),'collate':'utf8_general_ci'}}});config[_0xe0bd('0x8')]=_['defaultsDeep'](config[_0xe0bd('0x8')],{'database':_0xe0bd('0x9'),'username':_0xe0bd('0x2'),'password':_0xe0bd('0x3'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe0bd('0x5'),'dialectOptions':{'charset':_0xe0bd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xe0bd('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe0bd('0x1')][_0xe0bd('0xc')],config[_0xe0bd('0x1')][_0xe0bd('0xd')],config[_0xe0bd('0x1')]['password'],config['sequelize'][_0xe0bd('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe0bd('0x8')][_0xe0bd('0xc')],config['sequelizeHistory'][_0xe0bd('0xd')],config[_0xe0bd('0x8')][_0xe0bd('0xf')],config['sequelizeHistory']['options'])};db[_0xe0bd('0x10')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x12'));db[_0xe0bd('0x13')]=db['sequelize']['import'](_0xe0bd('0x14'));db[_0xe0bd('0x15')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x16'));db[_0xe0bd('0x17')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x18'));db[_0xe0bd('0x19')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x1a'));db[_0xe0bd('0x1b')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/voiceQueue/voiceQueue.model');db[_0xe0bd('0x1c')]=db['sequelize']['import'](_0xe0bd('0x1d'));db[_0xe0bd('0x1e')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/screenRecording/screenRecording.model');db[_0xe0bd('0x1f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x20'));db[_0xe0bd('0x21')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x22'));db[_0xe0bd('0x23')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x24'));db['VoiceQueueReport']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x25'));db[_0xe0bd('0x26')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0xe0bd('0x27')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x28'));db[_0xe0bd('0x29')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x2a'));db[_0xe0bd('0x2b')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x2c'));db[_0xe0bd('0x2d')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x2e'));db[_0xe0bd('0x2f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x30'));db[_0xe0bd('0x31')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x32'));db[_0xe0bd('0x33')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x34'));db[_0xe0bd('0x35')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x36'));db[_0xe0bd('0x37')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x38'));db[_0xe0bd('0x39')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x3a'));db['MailServerOut']=db[_0xe0bd('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xe0bd('0x3b')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x3c'));db[_0xe0bd('0x3d')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x3e'));db[_0xe0bd('0x3f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe0bd('0x40')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x41'));db[_0xe0bd('0x42')]=db['sequelize'][_0xe0bd('0x11')]('../api/mailMessage/mailMessage.model');db[_0xe0bd('0x43')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x44'));db['MailQueueReport']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe0bd('0x45')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x46'));db['DashboardItem']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x47'));db[_0xe0bd('0x48')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x49'));db[_0xe0bd('0x4a')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x4b'));db[_0xe0bd('0x4c')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x4d'));db[_0xe0bd('0x4e')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x4f'));db['FaxQueue']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x50'));db[_0xe0bd('0x51')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x52'));db[_0xe0bd('0x53')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x54'));db['SmsApplication']=db['sequelize'][_0xe0bd('0x11')]('../api/smsApplication/smsApplication.model');db[_0xe0bd('0x55')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xe0bd('0x56')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x57'));db['SmsQueue']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x58'));db[_0xe0bd('0x59')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x5a'));db[_0xe0bd('0x5b')]=db['sequelize']['import'](_0xe0bd('0x5c'));db['OpenchannelInteraction']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x5d'));db[_0xe0bd('0x5e')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x5f'));db[_0xe0bd('0x60')]=db[_0xe0bd('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x61'));db[_0xe0bd('0x62')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe0bd('0x63')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x64'));db['ChatInteraction']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x65'));db[_0xe0bd('0x66')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x67'));db['ChatOfflineMessage']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x68'));db[_0xe0bd('0x69')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/chatQueue/chatQueue.model');db[_0xe0bd('0x6a')]=db[_0xe0bd('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xe0bd('0x6b')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0xe0bd('0x6c')]=db[_0xe0bd('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xe0bd('0x6d')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x6e'));db[_0xe0bd('0x6f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x70'));db[_0xe0bd('0x71')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x72'));db[_0xe0bd('0x73')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xe0bd('0x74')]=db['sequelize']['import'](_0xe0bd('0x75'));db['ReportAgentPreview']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x76'));db[_0xe0bd('0x77')]=db['sequelize']['import'](_0xe0bd('0x78'));db[_0xe0bd('0x79')]=db[_0xe0bd('0x1')]['import']('../api/action/action.model');db[_0xe0bd('0x7a')]=db['sequelize']['import'](_0xe0bd('0x7b'));db[_0xe0bd('0x7c')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x7d'));db[_0xe0bd('0x7e')]=db['sequelize'][_0xe0bd('0x11')]('../api/disposition/disposition.model');db[_0xe0bd('0x7f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x80'));db['Interval']=db[_0xe0bd('0x1')]['import']('../api/interval/interval.model');db[_0xe0bd('0x81')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x82'));db[_0xe0bd('0x83')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x84'));db[_0xe0bd('0x85')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x86'));db[_0xe0bd('0x87')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x88'));db[_0xe0bd('0x89')]=db['sequelize']['import'](_0xe0bd('0x8a'));db[_0xe0bd('0x8b')]=db['sequelize']['import'](_0xe0bd('0x8c'));db[_0xe0bd('0x8d')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x8e'));db[_0xe0bd('0x8f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0xe0bd('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xe0bd('0x90')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x91'));db[_0xe0bd('0x92')]=db['sequelize'][_0xe0bd('0x11')]('../api/trigger/trigger.model');db[_0xe0bd('0x93')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/variable/variable.model');db[_0xe0bd('0x94')]=db['sequelize'][_0xe0bd('0x11')]('../api/integration/integration.model');db[_0xe0bd('0x95')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x96'));db[_0xe0bd('0x97')]=db[_0xe0bd('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xe0bd('0x98')]=db['sequelize'][_0xe0bd('0x11')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe0bd('0x99')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x9a'));db[_0xe0bd('0x9b')]=db['sequelize'][_0xe0bd('0x11')]('../api/analyticMetric/analyticMetric.model');db[_0xe0bd('0x9c')]=db['sequelize'][_0xe0bd('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe0bd('0x9d')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x9e'));db['SalesforceAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xe0bd('0x9f')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xe0bd('0xa0')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xa1'));db[_0xe0bd('0xa2')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xa3'));db[_0xe0bd('0xa4')]=db['sequelize'][_0xe0bd('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xe0bd('0xa5')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xa6'));db[_0xe0bd('0xa7')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xa8'));db['DeskConfiguration']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xa9'));db[_0xe0bd('0xaa')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xab'));db[_0xe0bd('0xac')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xad'));db['ZohoConfiguration']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xe0bd('0xae')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xaf'));db[_0xe0bd('0xb0')]=db['sequelize']['import'](_0xe0bd('0xb1'));db[_0xe0bd('0xb2')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xb3'));db['ZendeskField']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xb4'));db[_0xe0bd('0xb5')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xb6'));db[_0xe0bd('0xb7')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xb8'));db[_0xe0bd('0xb9')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xba'));db[_0xe0bd('0xbb')]=db['sequelize'][_0xe0bd('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe0bd('0xbc')]=db[_0xe0bd('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0xe0bd('0xbd')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xbe'));db['ServicenowConfiguration']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xbf'));db[_0xe0bd('0xc0')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xc1'));db['Dynamics365Account']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xe0bd('0xc2')]=db['sequelize']['import'](_0xe0bd('0xc3'));db['Dynamics365Field']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xc4'));db[_0xe0bd('0xc5')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xc6'));db['FreshsalesConfiguration']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xc7'));db['FreshsalesField']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xc8'));db[_0xe0bd('0x94')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xc9'));db[_0xe0bd('0xca')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xcb'));db['ChatQueueReport']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xcc'));db[_0xe0bd('0xcd')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xce'));db[_0xe0bd('0xcf')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xd0'));db[_0xe0bd('0xd1')]=db[_0xe0bd('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe0bd('0xd2')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xd3'));db[_0xe0bd('0xd4')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xd5'));db[_0xe0bd('0xd6')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xd7'));db['SquareDetailsReport']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0xe0bd('0xd8')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xd9'));db[_0xe0bd('0xda')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xdb'));db[_0xe0bd('0xdc')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xdd'));db[_0xe0bd('0xde')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xdf'));db[_0xe0bd('0xe0')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xe1'));db[_0xe0bd('0xe2')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xe3'));db['Team']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xe4'));db['License']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xe5'));db['Campaign']=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xe6'));db[_0xe0bd('0xe7')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xe8'));db[_0xe0bd('0xe9')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xea'));db[_0xe0bd('0xeb')]=db[_0xe0bd('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0xec'));db[_0xe0bd('0xed')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xee'));db[_0xe0bd('0xef')]=db[_0xe0bd('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xe0bd('0xf0')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0xf1'));db[_0xe0bd('0xf2')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xf3'));db[_0xe0bd('0xf4')]=db[_0xe0bd('0x1')]['import']('../api/cmList/cmList.model');db[_0xe0bd('0xf5')]=db['sequelize']['import'](_0xe0bd('0xf6'));db[_0xe0bd('0xf7')]=db['sequelize']['import'](_0xe0bd('0xf8'));db[_0xe0bd('0xf9')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/userProfileSection/userProfileSection.model');db[_0xe0bd('0xfa')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xfb'));db['UserNotification']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xfc'));db['WhatsappAccount']=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/whatsappAccount/whatsappAccount.model');db[_0xe0bd('0xfd')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0xfe'));db[_0xe0bd('0xff')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x100'));db[_0xe0bd('0x101')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x102'));db[_0xe0bd('0x103')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x104'));db[_0xe0bd('0x105')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x106'));db[_0xe0bd('0x107')]=db[_0xe0bd('0x1')][_0xe0bd('0x11')](_0xe0bd('0x108'));db[_0xe0bd('0x109')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x10a'));db[_0xe0bd('0x10b')]=db[_0xe0bd('0x1')]['import'](_0xe0bd('0x10c'));db[_0xe0bd('0x10d')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x10e'));db[_0xe0bd('0x10f')]=db['sequelize'][_0xe0bd('0x11')](_0xe0bd('0x110'));db['User'][_0xe0bd('0x111')](db['VoiceMail'],{'as':_0xe0bd('0x1f'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')][_0xe0bd('0x111')](db[_0xe0bd('0x10f')],{'as':'userSetting','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')]['hasMany'](db[_0xe0bd('0x1c')],{'as':'Recordings','foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db[_0xe0bd('0x2b')],{'as':_0xe0bd('0x115'),'foreignKey':'UserId'});db[_0xe0bd('0x10')]['hasMany'](db[_0xe0bd('0x17')],{'as':'Extensions','onDelete':_0xe0bd('0x112'),'hooks':!![]});db[_0xe0bd('0x10')]['hasMany'](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x116'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db[_0xe0bd('0x74')],{'as':_0xe0bd('0x117'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')]['hasMany'](db[_0xe0bd('0x118')],{'as':_0xe0bd('0x118'),'foreignKey':'UserId'});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db[_0xe0bd('0x119')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0xe0bd('0x10')]['hasMany'](db[_0xe0bd('0x11a')],{'as':_0xe0bd('0x11b'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db[_0xe0bd('0x55')],{'as':_0xe0bd('0x11c'),'foreignKey':'UserId'});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db[_0xe0bd('0x4c')],{'as':_0xe0bd('0x11d'),'foreignKey':_0xe0bd('0x113')});db['User'][_0xe0bd('0x114')](db[_0xe0bd('0x40')],{'as':'MailInteractions','foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x10')][_0xe0bd('0x114')](db['WhatsappInteraction'],{'as':_0xe0bd('0x11e'),'foreignKey':'UserId'});db['User'][_0xe0bd('0x114')](db[_0xe0bd('0x11f')],{'as':_0xe0bd('0x120'),'foreignKey':_0xe0bd('0x121')});db['User'][_0xe0bd('0x122')](db[_0xe0bd('0xf7')],{'as':_0xe0bd('0xf7'),'foreignKey':'userProfileId'});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x6a')],{'as':_0xe0bd('0x124'),'through':'chat_group_has_users'});db['User'][_0xe0bd('0x123')](db[_0xe0bd('0x6d')],{'as':'Contacts','through':_0xe0bd('0x125')});db[_0xe0bd('0x10')]['belongsToMany'](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x126'),'through':'cm_user_has_lists'});db[_0xe0bd('0x10')]['belongsToMany'](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x128')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x40')],{'as':_0xe0bd('0x129'),'through':_0xe0bd('0x12a')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x11a')],{'as':'ChatInteractions','through':_0xe0bd('0x12b')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x4c')],{'as':_0xe0bd('0x11d'),'through':_0xe0bd('0x12c')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x55')],{'as':_0xe0bd('0x11c'),'through':_0xe0bd('0x12d')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x119')],{'as':_0xe0bd('0x12e'),'through':'user_has_openchannel_interactions'});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x12f')],{'as':'WhatsappInteractions','through':_0xe0bd('0x130')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db['VoiceQueue'],{'as':_0xe0bd('0x131'),'through':'UserVoiceQueue','required':![]});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0xf5')],{'as':_0xe0bd('0x132'),'through':_0xe0bd('0x10d'),'required':![]});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x3d')],{'as':_0xe0bd('0x133'),'through':_0xe0bd('0x31'),'required':![]});db[_0xe0bd('0x10')]['belongsToMany'](db[_0xe0bd('0x69')],{'as':_0xe0bd('0x134'),'through':_0xe0bd('0x2f'),'required':![],'hooks':!![]});db['User'][_0xe0bd('0x123')](db['FaxQueue'],{'as':'FaxQueues','through':_0xe0bd('0x33'),'required':![]});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x135')],{'as':_0xe0bd('0x136'),'through':'UserSmsQueue','required':![]});db['User'][_0xe0bd('0x123')](db['OpenchannelQueue'],{'as':_0xe0bd('0x137'),'through':_0xe0bd('0x35'),'required':![]});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db['WhatsappQueue'],{'as':_0xe0bd('0x138'),'through':_0xe0bd('0x37'),'required':![]});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0xf4')],{'through':_0xe0bd('0x139')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db['ChatWebsite'],{'as':_0xe0bd('0x13a'),'through':_0xe0bd('0x13b')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x48')],{'as':_0xe0bd('0x13c'),'through':_0xe0bd('0x13d')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db['MailAccount'],{'as':_0xe0bd('0x13e'),'through':_0xe0bd('0x13f')});db[_0xe0bd('0x10')]['belongsToMany'](db[_0xe0bd('0x59')],{'as':_0xe0bd('0x140'),'through':_0xe0bd('0x141')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x53')],{'as':_0xe0bd('0x142'),'through':_0xe0bd('0x143')});db[_0xe0bd('0x10')][_0xe0bd('0x123')](db[_0xe0bd('0x144')],{'as':_0xe0bd('0x145'),'through':_0xe0bd('0x146')});db['User'][_0xe0bd('0x123')](db[_0xe0bd('0xde')],{'as':_0xe0bd('0x147'),'through':_0xe0bd('0x148')});db[_0xe0bd('0x13')][_0xe0bd('0x114')](db[_0xe0bd('0x17')],{'as':_0xe0bd('0x149'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x14a')});db[_0xe0bd('0x15')][_0xe0bd('0x114')](db[_0xe0bd('0x17')],{'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x17')][_0xe0bd('0x114')](db[_0xe0bd('0x17')],{'as':'Applications','onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x19')][_0xe0bd('0x123')](db[_0xe0bd('0x89')],{'as':_0xe0bd('0x14b'),'through':_0xe0bd('0x14c')});db[_0xe0bd('0x1b')][_0xe0bd('0x114')](db['UserVoiceQueueRt'],{'as':_0xe0bd('0x14d'),'foreignKey':_0xe0bd('0x14e')});db['VoiceQueue']['hasMany'](db[_0xe0bd('0x6f')],{'as':_0xe0bd('0x14f'),'foreignKey':_0xe0bd('0x14e')});db['VoiceQueue'][_0xe0bd('0x114')](db[_0xe0bd('0x73')],{'as':'HopperFinals','foreignKey':_0xe0bd('0x14e')});db['VoiceQueue'][_0xe0bd('0x114')](db[_0xe0bd('0x74')],{'as':_0xe0bd('0x150'),'foreignKey':_0xe0bd('0x14e')});db['VoiceQueue'][_0xe0bd('0x114')](db[_0xe0bd('0x118')],{'as':'ReportAgentPreview','foreignKey':_0xe0bd('0x14e')});db[_0xe0bd('0x1b')][_0xe0bd('0x114')](db[_0xe0bd('0x71')],{'as':'HopperBlacks','foreignKey':_0xe0bd('0x14e')});db[_0xe0bd('0x1b')][_0xe0bd('0x114')](db[_0xe0bd('0xd2')],{'as':_0xe0bd('0x151'),'foreignKey':_0xe0bd('0x14e')});db[_0xe0bd('0x1b')][_0xe0bd('0x122')](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x27'),'foreignKey':_0xe0bd('0x152')});db[_0xe0bd('0x1b')]['belongsTo'](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x153'),'foreignKey':_0xe0bd('0x154')});db[_0xe0bd('0x1b')][_0xe0bd('0x122')](db[_0xe0bd('0x155')],{'as':_0xe0bd('0x155'),'foreignKey':_0xe0bd('0x156')});db['VoiceQueue']['belongsTo'](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x158')});db['VoiceQueue'][_0xe0bd('0x123')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x126'),'through':_0xe0bd('0x159')});db[_0xe0bd('0x1b')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':'UserVoiceQueue'});db[_0xe0bd('0x1b')][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'as':_0xe0bd('0x15b'),'through':'TeamVoiceQueue'});db[_0xe0bd('0x1b')][_0xe0bd('0x123')](db['CmList'],{'as':_0xe0bd('0x15c'),'through':'voice_queues_has_cm_blacklists'});db[_0xe0bd('0x1c')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10'),'foreignKey':_0xe0bd('0x113')});db['ScreenRecording'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x1f')]['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xe0bd('0x112'),'foreignKey':'mailboxuser','sourceKey':_0xe0bd('0x15d')});db[_0xe0bd('0x15e')][_0xe0bd('0x122')](db['VoiceMail'],{'foreignKey':_0xe0bd('0x15f'),'targetKey':_0xe0bd('0x15d')});db[_0xe0bd('0x21')][_0xe0bd('0x114')](db[_0xe0bd('0x160')],{'as':_0xe0bd('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0xe0bd('0x21')][_0xe0bd('0x114')](db[_0xe0bd('0x23')],{'as':_0xe0bd('0x162'),'foreignKey':_0xe0bd('0x163'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10'),'foreignKey':_0xe0bd('0x113')});db['VoiceCallReport']['belongsTo'](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db['MailServerIn']['belongsTo'](db[_0xe0bd('0x3b')],{'as':'MailAccount','foreignKey':_0xe0bd('0x166')});db[_0xe0bd('0x39')][_0xe0bd('0x122')](db[_0xe0bd('0x107')],{'as':_0xe0bd('0x107'),'foreignKey':'CloudProviderId','onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x168')][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{'as':_0xe0bd('0x3b'),'foreignKey':_0xe0bd('0x166')});db['MailServerOut'][_0xe0bd('0x122')](db['CloudProvider'],{'as':_0xe0bd('0x107'),'foreignKey':_0xe0bd('0x169'),'onDelete':'restrict'});db['MailAccount'][_0xe0bd('0x111')](db['MailServerIn'],{'as':'Imap','onDelete':'cascade'});db['MailAccount'][_0xe0bd('0x111')](db[_0xe0bd('0x168')],{'as':_0xe0bd('0x16a'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x3b')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':_0xe0bd('0x16b'),'foreignKey':_0xe0bd('0x166'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x3b')][_0xe0bd('0x114')](db[_0xe0bd('0x7c')],{'as':'Answers','foreignKey':_0xe0bd('0x166')});db[_0xe0bd('0x3b')][_0xe0bd('0x114')](db[_0xe0bd('0x42')],{'as':_0xe0bd('0x16c'),'foreignKey':'MailAccountId'});db[_0xe0bd('0x3b')]['hasMany'](db[_0xe0bd('0x40')],{'as':'Interactions'});db[_0xe0bd('0x3b')][_0xe0bd('0x114')](db['MailApplication'],{'as':'Applications'});db[_0xe0bd('0x3b')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x16e')});db['MailAccount']['belongsTo'](db['Template'],{'as':_0xe0bd('0x90'),'foreignKey':_0xe0bd('0x16f')});db[_0xe0bd('0x3b')][_0xe0bd('0x122')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x158')});db[_0xe0bd('0x3b')][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x13f')});db['MailQueue'][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':'Agents','through':_0xe0bd('0x31')});db[_0xe0bd('0x3d')][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x170'),'as':_0xe0bd('0x15b')});db[_0xe0bd('0x40')][_0xe0bd('0x114')](db['MailMessage'],{'as':_0xe0bd('0x16c'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xe0bd('0x40')][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xe0bd('0x40')][_0xe0bd('0x122')](db['CmContact'],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x40')]['belongsTo'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x40')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x172'),'as':'Tags'});db[_0xe0bd('0x40')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x172'),'as':'ThroughTags'});db[_0xe0bd('0x40')][_0xe0bd('0x123')](db['User'],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x12a'),'foreignKey':_0xe0bd('0x174')});db[_0xe0bd('0x42')][_0xe0bd('0x114')](db[_0xe0bd('0xe9')],{'as':_0xe0bd('0x175'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x42')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10')});db[_0xe0bd('0x42')]['belongsTo'](db[_0xe0bd('0x6d')],{'onDelete':'cascade','as':_0xe0bd('0x164')});db['MailMessage'][_0xe0bd('0x122')](db[_0xe0bd('0x40')],{'as':'Interaction','foreignKey':_0xe0bd('0x174')});db[_0xe0bd('0x42')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0xe0bd('0x166')});db['MailMessage'][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'as':_0xe0bd('0x176'),'foreignKey':_0xe0bd('0x177')});db[_0xe0bd('0x42')][_0xe0bd('0x122')](db[_0xe0bd('0x178')],{'as':_0xe0bd('0x178'),'foreignKey':_0xe0bd('0x179')});db['MailApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x167')});db['MailApplication']['belongsTo'](db[_0xe0bd('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{'onDelete':_0xe0bd('0x167')});db['MailApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x155')],{'onDelete':'restrict','foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0x43')][_0xe0bd('0x122')](db[_0xe0bd('0x8b')],{'onDelete':_0xe0bd('0x167'),'foreignKey':_0xe0bd('0x17a')});db['MailQueueReport'][_0xe0bd('0x122')](db['MailAccount'],{});db['MailQueueReport'][_0xe0bd('0x122')](db['CmList'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x16e')});db['MailQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'as':'Contact','foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x17b')][_0xe0bd('0x122')](db[_0xe0bd('0x40')],{});db[_0xe0bd('0x17b')][_0xe0bd('0x122')](db[_0xe0bd('0x42')],{});db[_0xe0bd('0x17b')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{});db['MailQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x3d')],{});db[_0xe0bd('0x45')]['hasMany'](db[_0xe0bd('0x17c')],{'as':'Items','onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x48')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':_0xe0bd('0x16b'),'foreignKey':_0xe0bd('0x17d'),'onDelete':'cascade'});db[_0xe0bd('0x48')][_0xe0bd('0x114')](db[_0xe0bd('0x7c')],{'as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x17d')});db['FaxAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x4c')],{'as':_0xe0bd('0x17f')});db[_0xe0bd('0x48')][_0xe0bd('0x114')](db[_0xe0bd('0x4a')],{'as':_0xe0bd('0x180')});db[_0xe0bd('0x48')][_0xe0bd('0x114')](db[_0xe0bd('0x17')],{'as':_0xe0bd('0x181'),'onDelete':_0xe0bd('0x112')});db['FaxAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x4e')],{'as':_0xe0bd('0x16c')});db['FaxAccount'][_0xe0bd('0x122')](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x27')});db[_0xe0bd('0x48')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0xe0bd('0x122')](db['Pause'],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x158')});db['FaxAccount'][_0xe0bd('0x123')](db['User'],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x13d')});db['FaxApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':'restrict'});db[_0xe0bd('0x4a')][_0xe0bd('0x122')](db[_0xe0bd('0x182')],{'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x4a')][_0xe0bd('0x122')](db[_0xe0bd('0x48')],{'onDelete':'restrict'});db[_0xe0bd('0x4a')][_0xe0bd('0x122')](db[_0xe0bd('0x8b')],{'onDelete':_0xe0bd('0x167'),'foreignKey':'TagId'});db[_0xe0bd('0x4c')]['hasMany'](db[_0xe0bd('0x4e')],{'as':_0xe0bd('0x16c'),'onDelete':_0xe0bd('0x112'),'foreignKey':'FaxInteractionId'});db[_0xe0bd('0x4c')]['belongsTo'](db['FaxAccount'],{'as':_0xe0bd('0x183'),'foreignKey':'FaxAccountId'});db[_0xe0bd('0x4c')]['belongsTo'](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x4c')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x113')});db['FaxInteraction'][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x184'),'as':_0xe0bd('0x185')});db[_0xe0bd('0x4c')][_0xe0bd('0x123')](db['Tag'],{'through':_0xe0bd('0x184'),'as':'ThroughTags'});db[_0xe0bd('0x4c')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x12c'),'foreignKey':_0xe0bd('0x186')});db[_0xe0bd('0x4e')][_0xe0bd('0x122')](db['User'],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x10')});db[_0xe0bd('0x4e')][_0xe0bd('0x122')](db[_0xe0bd('0x4c')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0xe0bd('0x6d')],{'onDelete':_0xe0bd('0x112'),'as':'Contact'});db[_0xe0bd('0x4e')][_0xe0bd('0x122')](db[_0xe0bd('0xe9')],{'as':_0xe0bd('0xe9'),'foreignKey':_0xe0bd('0x187')});db[_0xe0bd('0x4e')]['belongsTo'](db[_0xe0bd('0x48')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db['User'],{'as':'Agents','through':_0xe0bd('0x33')});db[_0xe0bd('0x182')][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x188'),'as':_0xe0bd('0x15b')});db[_0xe0bd('0x51')][_0xe0bd('0x122')](db[_0xe0bd('0x48')],{});db['FaxQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':_0xe0bd('0x16e')});db['FaxQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x51')][_0xe0bd('0x122')](db['FaxInteraction'],{});db[_0xe0bd('0x51')][_0xe0bd('0x122')](db[_0xe0bd('0x4e')],{});db['FaxQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{});db[_0xe0bd('0x51')][_0xe0bd('0x122')](db[_0xe0bd('0x182')],{});db[_0xe0bd('0x53')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':_0xe0bd('0x16b'),'foreignKey':'SmsAccountId','onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x53')][_0xe0bd('0x114')](db[_0xe0bd('0x7c')],{'as':'Answers','foreignKey':_0xe0bd('0x189')});db[_0xe0bd('0x53')]['hasMany'](db[_0xe0bd('0x56')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x189')});db[_0xe0bd('0x53')][_0xe0bd('0x114')](db[_0xe0bd('0x55')],{'as':_0xe0bd('0x17f')});db[_0xe0bd('0x53')]['hasMany'](db[_0xe0bd('0x18a')],{'as':'Applications'});db[_0xe0bd('0x53')]['belongsTo'](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0x53')][_0xe0bd('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe0bd('0x158')});db[_0xe0bd('0x53')][_0xe0bd('0x123')](db['User'],{'as':'Agents','through':_0xe0bd('0x143')});db[_0xe0bd('0x18a')]['belongsTo'](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x167')});db['SmsApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x135')],{'onDelete':'restrict'});db['SmsApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x53')],{'onDelete':_0xe0bd('0x167')});db['SmsApplication'][_0xe0bd('0x122')](db[_0xe0bd('0x155')],{'onDelete':_0xe0bd('0x167'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db[_0xe0bd('0x8b')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xe0bd('0x55')][_0xe0bd('0x114')](db['SmsMessage'],{'as':_0xe0bd('0x16c'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x18b')});db['SmsInteraction'][_0xe0bd('0x122')](db[_0xe0bd('0x53')],{'as':_0xe0bd('0x183'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':'ContactId'});db[_0xe0bd('0x55')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':'Owner','foreignKey':_0xe0bd('0x113')});db['SmsInteraction']['belongsToMany'](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x18c'),'as':_0xe0bd('0x185')});db[_0xe0bd('0x55')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x18c'),'as':_0xe0bd('0x18d')});db['SmsInteraction'][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x12d'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10')});db['SmsMessage']['belongsTo'](db[_0xe0bd('0x6d')],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x164')});db[_0xe0bd('0x56')]['belongsTo'](db[_0xe0bd('0x55')],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x18e'),'foreignKey':'SmsInteractionId'});db[_0xe0bd('0x56')][_0xe0bd('0x122')](db[_0xe0bd('0x53')],{'as':_0xe0bd('0x183'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':'UserSmsQueue','foreignKey':_0xe0bd('0x18f')});db[_0xe0bd('0x135')][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x190'),'as':'Teams'});db[_0xe0bd('0x59')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':'Dispositions','foreignKey':_0xe0bd('0x191'),'onDelete':'cascade'});db[_0xe0bd('0x59')][_0xe0bd('0x114')](db[_0xe0bd('0x7c')],{'as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x191')});db[_0xe0bd('0x59')][_0xe0bd('0x114')](db[_0xe0bd('0x119')],{'as':_0xe0bd('0x17f'),'foreignKey':_0xe0bd('0x191')});db[_0xe0bd('0x59')][_0xe0bd('0x114')](db[_0xe0bd('0x5e')],{'as':'Messages','foreignKey':_0xe0bd('0x191')});db[_0xe0bd('0x59')]['hasMany'](db['OpenchannelApplication'],{'as':_0xe0bd('0x180'),'foreignKey':_0xe0bd('0x191')});db[_0xe0bd('0x59')]['belongsTo'](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':_0xe0bd('0x16e')});db['OpenchannelAccount'][_0xe0bd('0x122')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x158')});db[_0xe0bd('0x59')][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x141')});db[_0xe0bd('0x5b')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x5b')][_0xe0bd('0x122')](db[_0xe0bd('0x60')],{'onDelete':'restrict','foreignKey':_0xe0bd('0x192')});db['OpenchannelApplication'][_0xe0bd('0x122')](db['OpenchannelAccount'],{'onDelete':_0xe0bd('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xe0bd('0x5b')][_0xe0bd('0x122')](db['Interval'],{'onDelete':_0xe0bd('0x167'),'foreignKey':'IntervalId'});db[_0xe0bd('0x5b')][_0xe0bd('0x122')](db[_0xe0bd('0x8b')],{'onDelete':_0xe0bd('0x167'),'foreignKey':'TagId'});db[_0xe0bd('0x119')][_0xe0bd('0x114')](db[_0xe0bd('0x5e')],{'as':_0xe0bd('0x16c'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x193')});db[_0xe0bd('0x119')][_0xe0bd('0x122')](db[_0xe0bd('0x59')],{'as':'Account','foreignKey':_0xe0bd('0x191')});db[_0xe0bd('0x119')][_0xe0bd('0x122')](db['CmContact'],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x119')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x119')][_0xe0bd('0x123')](db['Tag'],{'through':_0xe0bd('0x194'),'as':_0xe0bd('0x185')});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xe0bd('0x119')][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x195'),'foreignKey':_0xe0bd('0x193')});db[_0xe0bd('0x5e')]['belongsTo'](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x10')});db[_0xe0bd('0x5e')][_0xe0bd('0x122')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['OpenchannelMessage'][_0xe0bd('0x122')](db['OpenchannelInteraction'],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x18e'),'foreignKey':_0xe0bd('0x193')});db[_0xe0bd('0x5e')]['belongsTo'](db['Attachment'],{'as':_0xe0bd('0xe9'),'foreignKey':'AttachmentId'});db[_0xe0bd('0x5e')][_0xe0bd('0x122')](db[_0xe0bd('0x59')],{'as':_0xe0bd('0x183'),'foreignKey':'OpenchannelAccountId'});db[_0xe0bd('0x60')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x35'),'foreignKey':_0xe0bd('0x192')});db[_0xe0bd('0x60')][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x196'),'as':_0xe0bd('0x15b')});db['ChatWebsite'][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0xe0bd('0x176')]['hasMany'](db[_0xe0bd('0x7c')],{'as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x177')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db[_0xe0bd('0x6b')],{'as':_0xe0bd('0x197')});db[_0xe0bd('0x176')]['hasMany'](db[_0xe0bd('0x11a')],{'as':_0xe0bd('0x17f')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db['ChatApplication'],{'as':_0xe0bd('0x180')});db[_0xe0bd('0x176')][_0xe0bd('0x114')](db[_0xe0bd('0x66')],{'as':_0xe0bd('0x16c')});db['ChatWebsite']['belongsTo'](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0x176')]['belongsTo'](db[_0xe0bd('0x155')],{'as':'Interval','foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0x176')]['belongsTo'](db[_0xe0bd('0x3b')],{'as':_0xe0bd('0x3b'),'foreignKey':_0xe0bd('0x166')});db[_0xe0bd('0x176')][_0xe0bd('0x122')](db[_0xe0bd('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe0bd('0x176')][_0xe0bd('0x123')](db['User'],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x13b')});db['OpenchannelQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x59')],{});db['OpenchannelQueueReport'][_0xe0bd('0x122')](db['CmList'],{'as':'List','foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0x62')][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x62')][_0xe0bd('0x122')](db[_0xe0bd('0x119')],{});db[_0xe0bd('0x62')][_0xe0bd('0x122')](db[_0xe0bd('0x5e')],{});db[_0xe0bd('0x62')][_0xe0bd('0x122')](db['User'],{});db[_0xe0bd('0x62')][_0xe0bd('0x122')](db['OpenchannelQueue'],{});db[_0xe0bd('0x63')]['belongsTo'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x198'),'foreignKey':'UserId','onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x63')]['belongsTo'](db[_0xe0bd('0x69')],{'as':'Queue','foreignKey':_0xe0bd('0x199'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x63')][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'as':_0xe0bd('0x19a'),'foreignKey':_0xe0bd('0x177'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x63')][_0xe0bd('0x122')](db[_0xe0bd('0x8b')],{'onDelete':_0xe0bd('0x167'),'foreignKey':_0xe0bd('0x17a')});db[_0xe0bd('0x11a')][_0xe0bd('0x114')](db[_0xe0bd('0x66')],{'as':_0xe0bd('0x16c'),'onDelete':'cascade','foreignKey':_0xe0bd('0x19b')});db[_0xe0bd('0x11a')][_0xe0bd('0x122')](db['ChatWebsite'],{'as':_0xe0bd('0x183'),'foreignKey':'ChatWebsiteId'});db[_0xe0bd('0x11a')]['belongsTo'](db['CmContact'],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db['ChatInteraction'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':'Owner','foreignKey':_0xe0bd('0x113')});db[_0xe0bd('0x11a')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x19c'),'as':_0xe0bd('0x185')});db[_0xe0bd('0x11a')]['belongsToMany'](db['Tag'],{'through':_0xe0bd('0x19c'),'as':_0xe0bd('0x18d')});db[_0xe0bd('0x11a')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x12b'),'foreignKey':_0xe0bd('0x19b')});db['ChatMessage'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x10')});db[_0xe0bd('0x66')][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db['ChatMessage']['belongsTo'](db['ChatInteraction'],{'onDelete':_0xe0bd('0x112'),'as':_0xe0bd('0x18e'),'foreignKey':_0xe0bd('0x19b')});db[_0xe0bd('0x66')]['belongsTo'](db[_0xe0bd('0xe9')],{'as':'Attachment','foreignKey':_0xe0bd('0x187')});db['ChatMessage'][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'as':_0xe0bd('0x183'),'foreignKey':'ChatWebsiteId'});db[_0xe0bd('0x178')][_0xe0bd('0x114')](db[_0xe0bd('0xe9')],{'as':_0xe0bd('0x175'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xe0bd('0x112'),'hooks':!![]});db[_0xe0bd('0x178')]['belongsTo'](db[_0xe0bd('0x6d')],{'onDelete':'cascade','as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x178')][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe0bd('0x69')][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':_0xe0bd('0x19d'),'as':'Teams'});db[_0xe0bd('0x6a')][_0xe0bd('0x114')](db[_0xe0bd('0xcd')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x19e'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x6a')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x14d'),'through':_0xe0bd('0x19f')});db['ChatProactiveAction'][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'as':_0xe0bd('0x19a'),'foreignKey':_0xe0bd('0x177')});db[_0xe0bd('0x6c')][_0xe0bd('0x114')](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x1a0'),'foreignKey':'CompanyId'});db[_0xe0bd('0x6d')]['hasMany'](db[_0xe0bd('0x8f')],{'as':'Phones','foreignKey':_0xe0bd('0x1a1')});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db[_0xe0bd('0x6f')],{'as':_0xe0bd('0x14f'),'foreignKey':_0xe0bd('0x165')});db['CmContact']['hasMany'](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x116'),'foreignKey':_0xe0bd('0x165')});db['CmContact'][_0xe0bd('0x114')](db['CmHopperHistory'],{'as':_0xe0bd('0x150'),'foreignKey':'ContactId'});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db[_0xe0bd('0x118')],{'as':_0xe0bd('0x118'),'foreignKey':'ContactId'});db[_0xe0bd('0x6d')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db[_0xe0bd('0x119')],{'as':_0xe0bd('0x12e'),'foreignKey':_0xe0bd('0x165'),'onDelete':_0xe0bd('0x167')});db['CmContact'][_0xe0bd('0x114')](db[_0xe0bd('0x11a')],{'as':_0xe0bd('0x11b'),'foreignKey':_0xe0bd('0x165'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db[_0xe0bd('0x55')],{'as':_0xe0bd('0x11c'),'foreignKey':_0xe0bd('0x165'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db[_0xe0bd('0x4c')],{'as':_0xe0bd('0x11d'),'foreignKey':'ContactId','onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x6d')][_0xe0bd('0x114')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xe0bd('0x6d')]['belongsTo'](db['CmCompany'],{'as':'Company','foreignKey':_0xe0bd('0x1a2')});db[_0xe0bd('0x6d')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x16d'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xe0bd('0x6d')][_0xe0bd('0x123')](db['User'],{'as':'Users','through':_0xe0bd('0x125')});db[_0xe0bd('0x6d')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'as':_0xe0bd('0x185'),'through':_0xe0bd('0x1a3')});db[_0xe0bd('0x6d')]['belongsToMany'](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x1a3'),'as':_0xe0bd('0x18d')});db[_0xe0bd('0x6f')][_0xe0bd('0x114')](db['CmHopperAdditionalPhone'],{'as':_0xe0bd('0x1a4'),'foreignKey':_0xe0bd('0x1a5')});db[_0xe0bd('0x6f')][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165'),'onDelete':'cascade'});db[_0xe0bd('0x6f')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x16d'),'foreignKey':'ListId','onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x6f')]['belongsTo'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x198'),'foreignKey':_0xe0bd('0x113')});db['CmHopper']['belongsTo'](db[_0xe0bd('0x1b')],{'as':_0xe0bd('0x1a6'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe0bd('0x6f')][_0xe0bd('0x122')](db['Campaign'],{'as':_0xe0bd('0x1a7'),'foreignKey':_0xe0bd('0x1a8'),'onDelete':'cascade'});db['CmHopper'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x1a9')});db[_0xe0bd('0x71')]['belongsTo'](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xe0bd('0x71')]['belongsTo'](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':_0xe0bd('0x16e'),'onDelete':'cascade'});db[_0xe0bd('0x71')][_0xe0bd('0x122')](db[_0xe0bd('0x1b')],{'as':_0xe0bd('0x1a6'),'foreignKey':_0xe0bd('0x14e'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x71')][_0xe0bd('0x122')](db[_0xe0bd('0x1a7')],{'as':'Campaign','foreignKey':_0xe0bd('0x1a8'),'onDelete':'cascade'});db['Automation'][_0xe0bd('0x114')](db[_0xe0bd('0x7f')],{'as':{'plural':'All','singular':_0xe0bd('0x1aa')},'foreignKey':'AutomationAllId','onDelete':_0xe0bd('0x112'),'hooks':!![]});db['Automation'][_0xe0bd('0x114')](db[_0xe0bd('0x7f')],{'as':{'plural':_0xe0bd('0x1ab'),'singular':_0xe0bd('0x1ac')},'foreignKey':_0xe0bd('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0xe0bd('0x7a')][_0xe0bd('0x114')](db['Action'],{'as':_0xe0bd('0x1ae'),'foreignKey':'AutomationId','onDelete':_0xe0bd('0x112'),'hooks':!![]});db[_0xe0bd('0x7e')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':'Dispositions','foreignKey':_0xe0bd('0x1af'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x155')][_0xe0bd('0x114')](db['Interval'],{'as':_0xe0bd('0x1b0'),'foreignKey':_0xe0bd('0x156'),'onDelete':_0xe0bd('0x112'),'hooks':!![],'required':![]});db[_0xe0bd('0x155')]['hasMany'](db[_0xe0bd('0x17')],{'as':_0xe0bd('0x1b1'),'foreignKey':_0xe0bd('0x156'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x155')][_0xe0bd('0x114')](db[_0xe0bd('0x43')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xe0bd('0x155')]['hasMany'](db[_0xe0bd('0x63')],{'as':'ChatApplications','foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0x155')]['hasMany'](db[_0xe0bd('0x4a')],{'as':_0xe0bd('0x1b2'),'foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0x155')][_0xe0bd('0x114')](db[_0xe0bd('0x18a')],{'as':_0xe0bd('0x1b3'),'foreignKey':_0xe0bd('0x156')});db['Schedule'][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{});db[_0xe0bd('0x87')]['belongsTo'](db[_0xe0bd('0x98')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xe0bd('0x122')](db[_0xe0bd('0x97')],{'foreignKey':_0xe0bd('0x1b4')});db[_0xe0bd('0x89')][_0xe0bd('0x123')](db[_0xe0bd('0x19')],{'as':_0xe0bd('0x1b5'),'through':'moh_has_sounds','onDelete':_0xe0bd('0x167')});db['Tag'][_0xe0bd('0x123')](db[_0xe0bd('0x6d')],{'through':_0xe0bd('0x1a3')});db['Tag'][_0xe0bd('0x123')](db['ChatInteraction'],{'through':_0xe0bd('0x19c')});db[_0xe0bd('0x8b')][_0xe0bd('0x123')](db[_0xe0bd('0x40')],{'through':_0xe0bd('0x172')});db[_0xe0bd('0x8b')][_0xe0bd('0x123')](db[_0xe0bd('0x55')],{'through':_0xe0bd('0x18c')});db[_0xe0bd('0x8b')][_0xe0bd('0x123')](db[_0xe0bd('0x4c')],{'through':_0xe0bd('0x184')});db[_0xe0bd('0x8b')]['belongsToMany'](db[_0xe0bd('0x119')],{'through':_0xe0bd('0x194')});db[_0xe0bd('0x8b')][_0xe0bd('0x123')](db['WhatsappInteraction'],{'through':_0xe0bd('0x1b6')});db[_0xe0bd('0x8f')][_0xe0bd('0x122')](db['ContactItemType'],{'as':_0xe0bd('0x1b7'),'foreignKey':_0xe0bd('0x1b8')});db['CmHopperAdditionalPhone'][_0xe0bd('0x122')](db['CmHopper'],{'as':_0xe0bd('0x1b9'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x1a1')});db[_0xe0bd('0x92')][_0xe0bd('0x114')](db[_0xe0bd('0x7f')],{'as':{'plural':_0xe0bd('0x1ba'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0xe0bd('0x112'),'hooks':!![]});db[_0xe0bd('0x92')][_0xe0bd('0x114')](db[_0xe0bd('0x7f')],{'as':{'plural':_0xe0bd('0x1bb'),'singular':'AnyCondition'},'foreignKey':_0xe0bd('0x1bc'),'onDelete':'cascade','hooks':!![]});db[_0xe0bd('0x92')][_0xe0bd('0x114')](db['Action'],{'as':_0xe0bd('0x1ae'),'foreignKey':_0xe0bd('0x1bd'),'onDelete':_0xe0bd('0x112'),'hooks':!![]});db[_0xe0bd('0x97')][_0xe0bd('0x114')](db[_0xe0bd('0x9c')],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1b4'),'hooks':!![]});db['AnalyticDefaultReport'][_0xe0bd('0x114')](db[_0xe0bd('0x9c')],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':'DefaultReportId'});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1bf')});db['AnalyticFieldReport'][_0xe0bd('0x122')](db[_0xe0bd('0x9b')],{'foreignKey':_0xe0bd('0x1bf')});db[_0xe0bd('0x1c0')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xe0bd('0x1c1'),'onDelete':_0xe0bd('0x112'),'foreignKey':'AccountId'});db[_0xe0bd('0x9f')][_0xe0bd('0x114')](db[_0xe0bd('0xa0')],{'as':_0xe0bd('0x1c2'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0x9f')]['hasMany'](db[_0xe0bd('0xa0')],{'as':_0xe0bd('0x1c4'),'onDelete':_0xe0bd('0x112'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xe0bd('0x114')](db['SalesforceField'],{'as':'Fields','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c5')});db['SalesforceConfiguration'][_0xe0bd('0x122')](db[_0xe0bd('0x1c0')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xa0')][_0xe0bd('0x114')](db[_0xe0bd('0xa0')],{'as':_0xe0bd('0x1c7'),'foreignKey':'SubjectId'});db[_0xe0bd('0xa0')][_0xe0bd('0x114')](db[_0xe0bd('0xa0')],{'as':_0xe0bd('0x1c8'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xa0')][_0xe0bd('0x114')](db[_0xe0bd('0xa0')],{'as':'Field','foreignKey':_0xe0bd('0x1c5')});db['SalesforceField']['belongsTo'](db['Variable'],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0xa2')][_0xe0bd('0x114')](db[_0xe0bd('0xa4')],{'as':'Configurations','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c6')});db['SugarcrmConfiguration']['hasMany'](db[_0xe0bd('0xa5')],{'as':_0xe0bd('0x1c2'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1c3')});db['SugarcrmConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xa5')],{'as':_0xe0bd('0x1c4'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c9')});db['SugarcrmConfiguration'][_0xe0bd('0x114')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xa4')]['belongsTo'](db[_0xe0bd('0xa2')],{'as':_0xe0bd('0x183'),'foreignKey':'AccountId'});db[_0xe0bd('0xa5')][_0xe0bd('0x114')](db[_0xe0bd('0xa5')],{'as':'Subject','foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xa5')][_0xe0bd('0x114')](db[_0xe0bd('0xa5')],{'as':_0xe0bd('0x1c8'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xa5')][_0xe0bd('0x114')](db['SugarcrmField'],{'as':_0xe0bd('0x1cb'),'foreignKey':'FieldId'});db[_0xe0bd('0xa5')]['belongsTo'](db[_0xe0bd('0x93')],{'as':'Variable','foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0xa7')][_0xe0bd('0x114')](db[_0xe0bd('0x1cc')],{'as':_0xe0bd('0x1c1'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1cc')][_0xe0bd('0x114')](db[_0xe0bd('0xaa')],{'as':'Subjects','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c3')});db['DeskConfiguration'][_0xe0bd('0x114')](db['DeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xe0bd('0x1c9')});db['DeskConfiguration']['hasMany'](db[_0xe0bd('0xaa')],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0x1cc')][_0xe0bd('0x122')](db[_0xe0bd('0xa7')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1cc')][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':_0xe0bd('0x1cd')});db[_0xe0bd('0xaa')]['hasMany'](db['DeskField'],{'as':_0xe0bd('0x1c7'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xaa')]['hasMany'](db[_0xe0bd('0xaa')],{'as':_0xe0bd('0x1c8'),'foreignKey':'DescriptionId'});db[_0xe0bd('0xaa')][_0xe0bd('0x114')](db[_0xe0bd('0xaa')],{'as':_0xe0bd('0x1cb'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xaa')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':'VariableId'});db[_0xe0bd('0xac')][_0xe0bd('0x114')](db[_0xe0bd('0x1ce')],{'as':_0xe0bd('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe0bd('0x1ce')][_0xe0bd('0x114')](db['ZohoField'],{'as':_0xe0bd('0x1c2'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0x1ce')]['hasMany'](db['ZohoField'],{'as':_0xe0bd('0x1c4'),'onDelete':_0xe0bd('0x112'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xae')],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':'FieldId'});db[_0xe0bd('0x1ce')][_0xe0bd('0x122')](db[_0xe0bd('0xac')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xae')][_0xe0bd('0x114')](db['ZohoField'],{'as':_0xe0bd('0x1c7'),'foreignKey':'SubjectId'});db[_0xe0bd('0xae')][_0xe0bd('0x114')](db['ZohoField'],{'as':'Description','foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xae')]['hasMany'](db['ZohoField'],{'as':'Field','foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xae')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0xb0')][_0xe0bd('0x114')](db[_0xe0bd('0xb2')],{'as':_0xe0bd('0x1c1'),'onDelete':_0xe0bd('0x112'),'foreignKey':'AccountId'});db[_0xe0bd('0xb2')]['hasMany'](db[_0xe0bd('0x1cf')],{'as':_0xe0bd('0x1c2'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xb2')][_0xe0bd('0x114')](db[_0xe0bd('0x1cf')],{'as':'Descriptions','foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xb2')][_0xe0bd('0x114')](db[_0xe0bd('0x1cf')],{'as':_0xe0bd('0x1be'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xb2')][_0xe0bd('0x122')](db[_0xe0bd('0xb0')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xb2')][_0xe0bd('0x123')](db['Tag'],{'through':_0xe0bd('0x1d0')});db[_0xe0bd('0x1cf')][_0xe0bd('0x114')](db[_0xe0bd('0x1cf')],{'as':_0xe0bd('0x1c7'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0x1cf')][_0xe0bd('0x114')](db[_0xe0bd('0x1cf')],{'as':_0xe0bd('0x1c8'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0xe0bd('0x114')](db[_0xe0bd('0x1cf')],{'as':_0xe0bd('0x1cb'),'foreignKey':_0xe0bd('0x1c5')});db['ZendeskField'][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':'Variable','foreignKey':_0xe0bd('0x1ca')});db['FreshdeskAccount'][_0xe0bd('0x114')](db['FreshdeskConfiguration'],{'as':_0xe0bd('0x1c1'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xb7')]['hasMany'](db[_0xe0bd('0xb9')],{'as':_0xe0bd('0x1c2'),'onDelete':'cascade','foreignKey':_0xe0bd('0x1c3')});db['FreshdeskConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0xb9')],{'as':_0xe0bd('0x1c4'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xb7')]['hasMany'](db[_0xe0bd('0xb9')],{'as':_0xe0bd('0x1be'),'onDelete':_0xe0bd('0x112'),'foreignKey':'FieldId'});db[_0xe0bd('0xb7')][_0xe0bd('0x122')](db[_0xe0bd('0xb5')],{'as':'Account','foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xb7')][_0xe0bd('0x123')](db['Tag'],{'through':_0xe0bd('0x1d1')});db[_0xe0bd('0xb9')][_0xe0bd('0x114')](db[_0xe0bd('0xb9')],{'as':_0xe0bd('0x1c7'),'foreignKey':_0xe0bd('0x1c3')});db['FreshdeskField']['hasMany'](db[_0xe0bd('0xb9')],{'as':'Description','foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0xb9')][_0xe0bd('0x114')](db[_0xe0bd('0xb9')],{'as':_0xe0bd('0x1cb'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xb9')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0xbb')][_0xe0bd('0x114')](db[_0xe0bd('0xbc')],{'as':_0xe0bd('0x1c1'),'onDelete':_0xe0bd('0x112'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0x1d2')],{'as':_0xe0bd('0x1c2'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xbc')][_0xe0bd('0x114')](db[_0xe0bd('0x1d2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xe0bd('0xbc')][_0xe0bd('0x114')](db[_0xe0bd('0x1d2')],{'as':_0xe0bd('0x1be'),'foreignKey':'FieldId'});db[_0xe0bd('0xbc')]['belongsTo'](db[_0xe0bd('0xbb')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1d2')][_0xe0bd('0x114')](db[_0xe0bd('0x1d2')],{'as':'Subject','foreignKey':'SubjectId'});db['VtigerField'][_0xe0bd('0x114')](db['VtigerField'],{'as':_0xe0bd('0x1c8'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0x1d2')]['hasMany'](db[_0xe0bd('0x1d2')],{'as':_0xe0bd('0x1cb'),'foreignKey':'FieldId'});db[_0xe0bd('0x1d2')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db['ServicenowAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x1d3')],{'as':'Configurations','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1d3')][_0xe0bd('0x114')](db[_0xe0bd('0xc0')],{'as':_0xe0bd('0x1c2'),'foreignKey':_0xe0bd('0x1c3')});db['ServicenowConfiguration']['hasMany'](db[_0xe0bd('0xc0')],{'as':_0xe0bd('0x1c4'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0x1d3')]['hasMany'](db[_0xe0bd('0xc0')],{'as':'Fields','foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0x1d3')]['belongsTo'](db['ServicenowAccount'],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0xc0')][_0xe0bd('0x114')](db[_0xe0bd('0xc0')],{'as':_0xe0bd('0x1c7'),'foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xc0')][_0xe0bd('0x114')](db['ServicenowField'],{'as':_0xe0bd('0x1c8'),'foreignKey':'DescriptionId'});db[_0xe0bd('0xc0')][_0xe0bd('0x114')](db[_0xe0bd('0xc0')],{'as':_0xe0bd('0x1cb'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xc0')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0x1d4')][_0xe0bd('0x114')](db[_0xe0bd('0xc2')],{'as':'Configurations','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1d4')][_0xe0bd('0x122')](db[_0xe0bd('0x107')],{'as':_0xe0bd('0x107'),'foreignKey':_0xe0bd('0x169')});db[_0xe0bd('0xc2')]['hasMany'](db[_0xe0bd('0x1d5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0xc2')][_0xe0bd('0x114')](db[_0xe0bd('0x1d5')],{'as':_0xe0bd('0x1c4'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c9')});db['Dynamics365Configuration'][_0xe0bd('0x114')](db[_0xe0bd('0x1d5')],{'as':'Fields','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0xc2')][_0xe0bd('0x122')](db[_0xe0bd('0x1d4')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db['Dynamics365Field'][_0xe0bd('0x114')](db[_0xe0bd('0x1d5')],{'as':_0xe0bd('0x1c7'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xe0bd('0x114')](db[_0xe0bd('0x1d5')],{'as':_0xe0bd('0x1c8'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0x1d5')]['hasMany'](db[_0xe0bd('0x1d5')],{'as':_0xe0bd('0x1cb'),'foreignKey':'FieldId'});db[_0xe0bd('0x1d5')][_0xe0bd('0x122')](db[_0xe0bd('0x93')],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db['FreshsalesAccount'][_0xe0bd('0x114')](db[_0xe0bd('0x1d6')],{'as':'Configurations','onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1c6')});db[_0xe0bd('0x1d6')]['hasMany'](db[_0xe0bd('0x1d7')],{'as':'Subjects','foreignKey':_0xe0bd('0x1c3')});db[_0xe0bd('0x1d6')][_0xe0bd('0x114')](db[_0xe0bd('0x1d7')],{'as':'Descriptions','foreignKey':_0xe0bd('0x1c9')});db['FreshsalesConfiguration'][_0xe0bd('0x114')](db[_0xe0bd('0x1d7')],{'as':_0xe0bd('0x1be'),'foreignKey':'FieldId'});db[_0xe0bd('0x1d6')]['belongsTo'](db[_0xe0bd('0xc5')],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1c6')});db['FreshsalesField']['hasMany'](db[_0xe0bd('0x1d7')],{'as':_0xe0bd('0x1c7'),'foreignKey':_0xe0bd('0x1c3')});db['FreshsalesField'][_0xe0bd('0x114')](db[_0xe0bd('0x1d7')],{'as':_0xe0bd('0x1c8'),'foreignKey':_0xe0bd('0x1c9')});db[_0xe0bd('0x1d7')][_0xe0bd('0x114')](db[_0xe0bd('0x1d7')],{'as':_0xe0bd('0x1cb'),'foreignKey':_0xe0bd('0x1c5')});db[_0xe0bd('0x1d7')]['belongsTo'](db['Variable'],{'as':_0xe0bd('0x93'),'foreignKey':_0xe0bd('0x1ca')});db[_0xe0bd('0x1d8')]['belongsTo'](db[_0xe0bd('0x176')],{});db[_0xe0bd('0x1d8')][_0xe0bd('0x122')](db['CmList'],{'as':_0xe0bd('0x16d'),'foreignKey':'ListId'});db[_0xe0bd('0x1d8')][_0xe0bd('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x1d8')][_0xe0bd('0x122')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x66')],{});db[_0xe0bd('0x1d8')]['belongsTo'](db[_0xe0bd('0x10')],{});db[_0xe0bd('0x1d8')][_0xe0bd('0x122')](db[_0xe0bd('0x69')],{});db[_0xe0bd('0xcd')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':'cascade','foreignKey':_0xe0bd('0x1d9')});db[_0xe0bd('0xcd')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':'cascade','foreignKey':_0xe0bd('0x1da')});db[_0xe0bd('0xd2')][_0xe0bd('0x114')](db[_0xe0bd('0xd1')],{'foreignKey':_0xe0bd('0x1db'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0xd2')][_0xe0bd('0x114')](db[_0xe0bd('0xcf')],{'foreignKey':_0xe0bd('0x1db'),'onDelete':_0xe0bd('0x112')});db['SmsQueueReport'][_0xe0bd('0x122')](db[_0xe0bd('0x53')],{});db[_0xe0bd('0xd4')]['belongsTo'](db['CmList'],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x16e')});db['SmsQueueReport'][_0xe0bd('0x122')](db['CmContact'],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0xd4')]['belongsTo'](db[_0xe0bd('0x55')],{});db['SmsQueueReport']['belongsTo'](db[_0xe0bd('0x56')],{});db[_0xe0bd('0xd4')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{});db[_0xe0bd('0xd4')][_0xe0bd('0x122')](db[_0xe0bd('0x135')],{});db[_0xe0bd('0xd8')][_0xe0bd('0x114')](db[_0xe0bd('0xd2')],{'foreignKey':'ProjectId'});db[_0xe0bd('0xd8')][_0xe0bd('0x114')](db[_0xe0bd('0xd1')],{'foreignKey':_0xe0bd('0x1dc')});db[_0xe0bd('0xd8')][_0xe0bd('0x114')](db[_0xe0bd('0xcf')],{'foreignKey':_0xe0bd('0x1dc')});db['SquareProject'][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':'Users','through':'user_has_square_projects'});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db['User'],{'as':'Agents','through':_0xe0bd('0x128')});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xe0bd('0x131')});db[_0xe0bd('0x127')]['belongsToMany'](db[_0xe0bd('0x3d')],{'through':_0xe0bd('0x170'),'as':'MailQueues'});db[_0xe0bd('0x127')]['belongsToMany'](db[_0xe0bd('0x69')],{'through':'team_has_chat_queues','as':_0xe0bd('0x134')});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db[_0xe0bd('0x182')],{'through':_0xe0bd('0x188'),'as':'FaxQueues'});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db[_0xe0bd('0x135')],{'through':_0xe0bd('0x190'),'as':_0xe0bd('0x136')});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db['OpenchannelQueue'],{'through':_0xe0bd('0x196'),'as':_0xe0bd('0x137')});db[_0xe0bd('0x127')]['belongsToMany'](db[_0xe0bd('0x105')],{'through':_0xe0bd('0x1dd'),'as':_0xe0bd('0x138')});db[_0xe0bd('0x127')][_0xe0bd('0x123')](db[_0xe0bd('0xf5')],{'through':_0xe0bd('0x10b'),'as':_0xe0bd('0x132')});db[_0xe0bd('0x1a7')][_0xe0bd('0x114')](db[_0xe0bd('0x6f')],{'as':_0xe0bd('0x14f'),'foreignKey':_0xe0bd('0x1a8')});db[_0xe0bd('0x1a7')][_0xe0bd('0x114')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign']['hasMany'](db[_0xe0bd('0x74')],{'as':_0xe0bd('0x150'),'foreignKey':_0xe0bd('0x1a8')});db[_0xe0bd('0x1a7')][_0xe0bd('0x114')](db[_0xe0bd('0x71')],{'as':_0xe0bd('0x1de'),'foreignKey':_0xe0bd('0x1a8')});db[_0xe0bd('0x1a7')][_0xe0bd('0x122')](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x27'),'foreignKey':_0xe0bd('0x152')});db[_0xe0bd('0x1a7')][_0xe0bd('0x122')](db[_0xe0bd('0x27')],{'as':_0xe0bd('0x153'),'foreignKey':_0xe0bd('0x154')});db[_0xe0bd('0x1a7')]['belongsTo'](db[_0xe0bd('0x155')],{'as':_0xe0bd('0x155'),'foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0x1a7')][_0xe0bd('0x122')](db[_0xe0bd('0xde')],{'as':'SquareProject','foreignKey':_0xe0bd('0x1df')});db[_0xe0bd('0x1a7')]['belongsToMany'](db['CmList'],{'as':_0xe0bd('0x126'),'through':_0xe0bd('0x1e0')});db[_0xe0bd('0x1a7')][_0xe0bd('0x123')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x15c'),'through':_0xe0bd('0x1e1')});db['Attachment'][_0xe0bd('0x122')](db[_0xe0bd('0x178')],{'as':_0xe0bd('0x178'),'foreignKey':_0xe0bd('0x179')});db[_0xe0bd('0x1e2')]['belongsTo'](db[_0xe0bd('0x42')],{});db[_0xe0bd('0x1e2')][_0xe0bd('0x122')](db['MailInteraction'],{});db[_0xe0bd('0x1e2')][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{'foreignKey':_0xe0bd('0x1e3'),'as':_0xe0bd('0x1e4')});db['MailTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':'FromUserId','as':_0xe0bd('0x1e5')});db[_0xe0bd('0x1e2')][_0xe0bd('0x122')](db['User'],{'foreignKey':'ToUserId','as':_0xe0bd('0x1e6')});db[_0xe0bd('0x1e2')][_0xe0bd('0x122')](db[_0xe0bd('0x3d')],{'foreignKey':_0xe0bd('0x1e7'),'as':'ToQueue'});db['MailTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x3b')],{'foreignKey':'ToMailAccountId','as':_0xe0bd('0x1e8')});db[_0xe0bd('0xed')][_0xe0bd('0x122')](db[_0xe0bd('0x66')],{});db[_0xe0bd('0xed')]['belongsTo'](db[_0xe0bd('0x11a')],{});db[_0xe0bd('0xed')][_0xe0bd('0x122')](db['ChatWebsite'],{'foreignKey':_0xe0bd('0x1e9'),'as':_0xe0bd('0x1e4')});db['ChatTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':'FromUserId','as':_0xe0bd('0x1e5')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xe0bd('0x1e6')});db['ChatTransferReport'][_0xe0bd('0x122')](db['ChatQueue'],{'foreignKey':_0xe0bd('0x1ea'),'as':_0xe0bd('0x1eb')});db[_0xe0bd('0xed')][_0xe0bd('0x122')](db[_0xe0bd('0x176')],{'foreignKey':_0xe0bd('0x1ec'),'as':'ToAccount'});db[_0xe0bd('0xef')][_0xe0bd('0x122')](db[_0xe0bd('0x4e')],{});db['FaxTransferReport']['belongsTo'](db[_0xe0bd('0x4c')],{});db['FaxTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x48')],{'foreignKey':'FromFaxAccountId','as':_0xe0bd('0x1e4')});db[_0xe0bd('0xef')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ed'),'as':_0xe0bd('0x1e5')});db[_0xe0bd('0xef')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ee'),'as':_0xe0bd('0x1e6')});db[_0xe0bd('0xef')][_0xe0bd('0x122')](db[_0xe0bd('0x182')],{'foreignKey':'ToFaxQueueId','as':_0xe0bd('0x1eb')});db['FaxTransferReport']['belongsTo'](db[_0xe0bd('0x48')],{'foreignKey':_0xe0bd('0x1ef'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x5e')],{});db['OpenchannelTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x119')],{});db[_0xe0bd('0xf0')]['belongsTo'](db[_0xe0bd('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0xe0bd('0x1e4')});db[_0xe0bd('0xf0')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ed'),'as':_0xe0bd('0x1e5')});db['OpenchannelTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ee'),'as':_0xe0bd('0x1e6')});db[_0xe0bd('0xf0')][_0xe0bd('0x122')](db[_0xe0bd('0x60')],{'foreignKey':_0xe0bd('0x1f0'),'as':_0xe0bd('0x1eb')});db[_0xe0bd('0xf0')][_0xe0bd('0x122')](db[_0xe0bd('0x59')],{'foreignKey':_0xe0bd('0x1f1'),'as':_0xe0bd('0x1e8')});db['SmsTransferReport'][_0xe0bd('0x122')](db[_0xe0bd('0x56')],{});db[_0xe0bd('0xf2')]['belongsTo'](db[_0xe0bd('0x55')],{});db[_0xe0bd('0xf2')]['belongsTo'](db[_0xe0bd('0x53')],{'foreignKey':_0xe0bd('0x1f2'),'as':_0xe0bd('0x1e4')});db[_0xe0bd('0xf2')][_0xe0bd('0x122')](db['User'],{'foreignKey':_0xe0bd('0x1ed'),'as':_0xe0bd('0x1e5')});db[_0xe0bd('0xf2')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ee'),'as':_0xe0bd('0x1e6')});db[_0xe0bd('0xf2')][_0xe0bd('0x122')](db['SmsQueue'],{'foreignKey':_0xe0bd('0x1f3'),'as':_0xe0bd('0x1eb')});db[_0xe0bd('0xf2')][_0xe0bd('0x122')](db[_0xe0bd('0x53')],{'foreignKey':_0xe0bd('0x1f4'),'as':_0xe0bd('0x1e8')});db[_0xe0bd('0xf4')][_0xe0bd('0x114')](db[_0xe0bd('0x7e')],{'as':_0xe0bd('0x16b'),'foreignKey':'ListId','onDelete':_0xe0bd('0x112')});db['CmList']['hasMany'](db[_0xe0bd('0x77')],{'as':'CustomFields','foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0xf4')][_0xe0bd('0x114')](db['CmContact'],{'as':_0xe0bd('0x1a0'),'onDelete':'cascade','foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0xf4')][_0xe0bd('0x114')](db[_0xe0bd('0x73')],{'as':_0xe0bd('0x116'),'foreignKey':'ListId'});db[_0xe0bd('0xf4')][_0xe0bd('0x114')](db[_0xe0bd('0x74')],{'as':_0xe0bd('0x117'),'foreignKey':_0xe0bd('0x16e')});db['CmList'][_0xe0bd('0x114')](db[_0xe0bd('0x118')],{'as':_0xe0bd('0x118'),'foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0xf4')][_0xe0bd('0x123')](db[_0xe0bd('0x1b')],{'as':_0xe0bd('0x1f5'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0xe0bd('0x123')](db['User'],{'as':'Agents','through':_0xe0bd('0x139')});db[_0xe0bd('0xf5')][_0xe0bd('0x114')](db[_0xe0bd('0x17')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0xe0bd('0x123')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xe0bd('0xf5')]['belongsToMany'](db[_0xe0bd('0x127')],{'through':'TeamVoicePrefix','as':_0xe0bd('0x15b')});db['UserProfile'][_0xe0bd('0x114')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'foreignKey':_0xe0bd('0x1f6')});db[_0xe0bd('0xf7')][_0xe0bd('0x114')](db[_0xe0bd('0xf9')],{'as':_0xe0bd('0x1f7'),'foreignKey':_0xe0bd('0x1f6'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0xf9')][_0xe0bd('0x114')](db[_0xe0bd('0xfa')],{'as':'Resources','foreignKey':_0xe0bd('0x1f8'),'onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x144')]['hasMany'](db[_0xe0bd('0x7e')],{'as':_0xe0bd('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0xe0bd('0x112')});db[_0xe0bd('0x144')][_0xe0bd('0x114')](db[_0xe0bd('0x7c')],{'as':_0xe0bd('0x17e'),'foreignKey':_0xe0bd('0x1f9')});db[_0xe0bd('0x144')][_0xe0bd('0x114')](db[_0xe0bd('0xff')],{'as':_0xe0bd('0x16c'),'foreignKey':_0xe0bd('0x1f9')});db[_0xe0bd('0x144')][_0xe0bd('0x114')](db[_0xe0bd('0x12f')],{'as':_0xe0bd('0x17f')});db[_0xe0bd('0x144')][_0xe0bd('0x114')](db[_0xe0bd('0xfd')],{'as':_0xe0bd('0x180')});db[_0xe0bd('0x144')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':_0xe0bd('0x16d'),'foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0x144')][_0xe0bd('0x122')](db[_0xe0bd('0x81')],{'as':_0xe0bd('0x157'),'foreignKey':_0xe0bd('0x158')});db['WhatsappAccount'][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x146')});db[_0xe0bd('0xfd')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0xfd')]['belongsTo'](db['WhatsappQueue'],{'onDelete':'restrict'});db['WhatsappApplication'][_0xe0bd('0x122')](db['WhatsappAccount'],{'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0xfd')][_0xe0bd('0x122')](db['Interval'],{'onDelete':_0xe0bd('0x167'),'foreignKey':_0xe0bd('0x156')});db[_0xe0bd('0xfd')][_0xe0bd('0x122')](db[_0xe0bd('0x8b')],{'onDelete':_0xe0bd('0x167'),'foreignKey':_0xe0bd('0x17a')});db['WhatsappInteraction']['hasMany'](db[_0xe0bd('0xff')],{'as':_0xe0bd('0x16c'),'onDelete':_0xe0bd('0x112'),'foreignKey':_0xe0bd('0x1fa')});db['WhatsappInteraction'][_0xe0bd('0x122')](db['WhatsappAccount'],{'as':_0xe0bd('0x183'),'foreignKey':_0xe0bd('0x1f9')});db[_0xe0bd('0x12f')][_0xe0bd('0x122')](db['CmContact'],{'as':_0xe0bd('0x164'),'foreignKey':_0xe0bd('0x165')});db[_0xe0bd('0x12f')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x171'),'foreignKey':_0xe0bd('0x113')});db['WhatsappInteraction'][_0xe0bd('0x123')](db['Tag'],{'through':_0xe0bd('0x1b6'),'as':'Tags'});db['WhatsappInteraction'][_0xe0bd('0x123')](db[_0xe0bd('0x8b')],{'through':'whatsapp_interaction_has_tags','as':_0xe0bd('0x18d')});db[_0xe0bd('0x12f')][_0xe0bd('0x123')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x173'),'through':_0xe0bd('0x130'),'foreignKey':_0xe0bd('0x1fa')});db[_0xe0bd('0xff')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x10')});db[_0xe0bd('0xff')][_0xe0bd('0x122')](db[_0xe0bd('0x6d')],{'onDelete':'cascade','as':_0xe0bd('0x164')});db[_0xe0bd('0xff')]['belongsTo'](db[_0xe0bd('0x12f')],{'onDelete':'cascade','as':_0xe0bd('0x18e'),'foreignKey':_0xe0bd('0x1fa')});db['WhatsappMessage']['belongsTo'](db['WhatsappAccount'],{'as':_0xe0bd('0x183'),'foreignKey':'WhatsappAccountId'});db[_0xe0bd('0x101')][_0xe0bd('0x122')](db['WhatsappAccount'],{});db[_0xe0bd('0x101')][_0xe0bd('0x122')](db[_0xe0bd('0xf4')],{'as':'List','foreignKey':_0xe0bd('0x16e')});db[_0xe0bd('0x101')]['belongsTo'](db[_0xe0bd('0x6d')],{'as':_0xe0bd('0x164'),'foreignKey':'ContactId'});db[_0xe0bd('0x101')]['belongsTo'](db[_0xe0bd('0x12f')],{});db[_0xe0bd('0x101')][_0xe0bd('0x122')](db[_0xe0bd('0x105')],{});db[_0xe0bd('0x101')][_0xe0bd('0x122')](db[_0xe0bd('0xff')],{});db[_0xe0bd('0x101')]['belongsTo'](db[_0xe0bd('0x10')],{});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db[_0xe0bd('0xff')],{});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db[_0xe0bd('0x12f')],{});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db[_0xe0bd('0x144')],{'foreignKey':_0xe0bd('0x1fb'),'as':_0xe0bd('0x1e4')});db[_0xe0bd('0x103')]['belongsTo'](db[_0xe0bd('0x144')],{'foreignKey':_0xe0bd('0x1fc'),'as':_0xe0bd('0x1e8')});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db[_0xe0bd('0x105')],{'foreignKey':'ToQueueId','as':_0xe0bd('0x1eb')});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'foreignKey':_0xe0bd('0x1ed'),'as':_0xe0bd('0x1e5')});db[_0xe0bd('0x103')][_0xe0bd('0x122')](db['User'],{'foreignKey':_0xe0bd('0x1ee'),'as':_0xe0bd('0x1e6')});db[_0xe0bd('0x105')]['belongsToMany'](db[_0xe0bd('0x10')],{'as':_0xe0bd('0x15a'),'through':_0xe0bd('0x37'),'foreignKey':_0xe0bd('0x1fd')});db['WhatsappQueue'][_0xe0bd('0x123')](db[_0xe0bd('0x127')],{'through':'team_has_whatsapp_queues','as':'Teams'});db['UserSetting'][_0xe0bd('0x122')](db[_0xe0bd('0x10')],{'as':'user','foreignKey':_0xe0bd('0x113'),'onDelete':_0xe0bd('0x112'),'hooks':!![]});db['CloudProvider'][_0xe0bd('0x111')](db[_0xe0bd('0x1d4')],{'as':_0xe0bd('0x1d4'),'onDelete':_0xe0bd('0x167')});db['CloudProvider']['hasOne'](db[_0xe0bd('0x39')],{'as':_0xe0bd('0x1fe'),'onDelete':_0xe0bd('0x167')});db[_0xe0bd('0x107')][_0xe0bd('0x111')](db[_0xe0bd('0x168')],{'as':_0xe0bd('0x16a'),'onDelete':_0xe0bd('0x167')});module[_0xe0bd('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4a81=['FaxAccountId','Exntensions','mandatoryDispositionPauseId','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','ListId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Interactions','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatQueue','Queue','ChatMessage','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Website','CompanyId','Phones','CmContactId','JscriptySessionReport','JscriptySessions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','CampaignId','OwnerId','OneAll','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','FieldId','Description','VariableId','SugarcrmConfiguration','SubjectId','DescriptionId','Subject','Field','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','Dynamics365Configuration','FreshsalesField','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','SquareProject','VoiceQueues','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ToChatQueueId','ToChatWebsiteId','FromAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','HopperHistory','Queues','voice_queues_has_cm_lists','Extensions','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','lodash','determine','sequelize','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','xC@LL1234','utf8','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','Variable','../api/variable/variable.model','../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','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','WhatsappInteraction','UserNotification','SenderId','belongsTo','userProfileId','Groups','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SquareProjects','VoiceExtension','SpiedAgents','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','Trunk','IntervalId','Pause','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','Contact','ContactId','MailAccountId','restrict','Imap','Smtp','Dispositions','Answers','Messages','MailInteraction','List','TemplateId','mandatoryDispositionPause','user_has_mail_accounts','team_has_mail_queues','MailMessage','MailInteractionId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','Account','ChatWebsiteId','DashboardItem','Items'];(function(_0x180a87,_0x3c3463){var _0x281e81=function(_0x15cacd){while(--_0x15cacd){_0x180a87['push'](_0x180a87['shift']());}};_0x281e81(++_0x3c3463);}(_0x4a81,0x8a));var _0x14a8=function(_0x3ba9ea,_0x44c66d){_0x3ba9ea=_0x3ba9ea-0x0;var _0x432e50=_0x4a81[_0x3ba9ea];return _0x432e50;};'use strict';var config=require(_0x14a8('0x0'));var Sequelize=require('sequelize');var _=require(_0x14a8('0x1'));var jstz=require('jstz');var timezone=jstz[_0x14a8('0x2')]();config[_0x14a8('0x3')]=_['defaultsDeep'](config[_0x14a8('0x3')],{'database':_0x14a8('0x4'),'username':_0x14a8('0x5'),'password':'xC@LL1234','options':{'host':_0x14a8('0x6'),'port':0xcea,'dialect':_0x14a8('0x7'),'dialectOptions':{'charset':_0x14a8('0x8')},'logging':![],'timezone':timezone[_0x14a8('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x14a8('0xa')]=_['defaultsDeep'](config[_0x14a8('0xa')],{'database':_0x14a8('0x4'),'username':_0x14a8('0x5'),'password':_0x14a8('0xb'),'options':{'host':_0x14a8('0x6'),'port':0xcea,'dialect':_0x14a8('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x14a8('0x9')](),'define':{'charset':_0x14a8('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x14a8('0xd')],config[_0x14a8('0x3')][_0x14a8('0xe')],config['sequelize'][_0x14a8('0xf')],config[_0x14a8('0x3')][_0x14a8('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x14a8('0xa')]['database'],config[_0x14a8('0xa')][_0x14a8('0xe')],config['sequelizeHistory'][_0x14a8('0xf')],config['sequelizeHistory'][_0x14a8('0x10')])};db['User']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x12'));db[_0x14a8('0x13')]=db['sequelize'][_0x14a8('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x14a8('0x14')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x15'));db[_0x14a8('0x16')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x17'));db[_0x14a8('0x18')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/voiceQueue/voiceQueue.model');db[_0x14a8('0x19')]=db['sequelize'][_0x14a8('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x14a8('0x1a')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x1b'));db[_0x14a8('0x1c')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x1d'));db[_0x14a8('0x1e')]=db['sequelize'][_0x14a8('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x14a8('0x1f')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x20'));db['VoiceDialReport']=db[_0x14a8('0x3')]['import'](_0x14a8('0x21'));db[_0x14a8('0x22')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x23'));db[_0x14a8('0x24')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x25'));db['MemberReport']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x26'));db[_0x14a8('0x27')]=db[_0x14a8('0x3')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x28'));db[_0x14a8('0x29')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x2a'));db['UserChatQueue']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x2b'));db[_0x14a8('0x2c')]=db['sequelize']['import'](_0x14a8('0x2d'));db[_0x14a8('0x2e')]=db['sequelize']['import'](_0x14a8('0x2f'));db[_0x14a8('0x30')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x31'));db['UserOpenchannelQueue']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x14a8('0x32')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x33'));db[_0x14a8('0x34')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x35'));db[_0x14a8('0x36')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x37'));db['MailAccount']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/mailAccount/mailAccount.model');db[_0x14a8('0x38')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x39'));db[_0x14a8('0x3a')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x3b'));db['MailInteraction']=db['sequelize']['import'](_0x14a8('0x3c'));db['MailMessage']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x3d'));db[_0x14a8('0x3e')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x3f'));db[_0x14a8('0x40')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x41'));db[_0x14a8('0x42')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0x14a8('0x11')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/faxAccount/faxAccount.model');db[_0x14a8('0x43')]=db['sequelize'][_0x14a8('0x11')]('../api/faxApplication/faxApplication.model');db[_0x14a8('0x44')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/faxInteraction/faxInteraction.model');db[_0x14a8('0x45')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x46'));db[_0x14a8('0x47')]=db['sequelize']['import'](_0x14a8('0x48'));db[_0x14a8('0x49')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x4a'));db[_0x14a8('0x4b')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/smsAccount/smsAccount.model');db[_0x14a8('0x4c')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x4d'));db[_0x14a8('0x4e')]=db['sequelize'][_0x14a8('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0x14a8('0x4f')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/smsMessage/smsMessage.model');db[_0x14a8('0x50')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x51'));db[_0x14a8('0x52')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x53'));db[_0x14a8('0x54')]=db['sequelize'][_0x14a8('0x11')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x55'));db[_0x14a8('0x56')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x57'));db[_0x14a8('0x58')]=db['sequelize']['import'](_0x14a8('0x59'));db[_0x14a8('0x5a')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x14a8('0x5b')]=db['sequelize']['import'](_0x14a8('0x5c'));db[_0x14a8('0x5d')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x5e'));db[_0x14a8('0x5f')]=db['sequelize'][_0x14a8('0x11')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x60'));db[_0x14a8('0x61')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x62'));db['ChatQueue']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x63'));db[_0x14a8('0x64')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x65'));db['ChatProactiveAction']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x14a8('0x66')]=db['sequelize'][_0x14a8('0x11')]('../api/cmCompany/cmCompany.model');db[_0x14a8('0x67')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x68'));db[_0x14a8('0x69')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/cmHopper/cmHopper.model');db[_0x14a8('0x6a')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x6b'));db[_0x14a8('0x6c')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x6d'));db[_0x14a8('0x6e')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x6f'));db[_0x14a8('0x70')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x71'));db[_0x14a8('0x72')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x73'));db[_0x14a8('0x74')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x75'));db[_0x14a8('0x76')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x77'));db[_0x14a8('0x78')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/cannedAnswer/cannedAnswer.model');db[_0x14a8('0x79')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x7a'));db[_0x14a8('0x7b')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x7c'));db[_0x14a8('0x7d')]=db['sequelize'][_0x14a8('0x11')]('../api/interval/interval.model');db['Pause']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x7e'));db[_0x14a8('0x7f')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x80'));db[_0x14a8('0x81')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x82'));db[_0x14a8('0x83')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x84'));db[_0x14a8('0x85')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x86'));db[_0x14a8('0x87')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/tag/tag.model');db[_0x14a8('0x88')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x89'));db[_0x14a8('0x8a')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x8b'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x8c'));db[_0x14a8('0x8d')]=db['sequelize'][_0x14a8('0x11')]('../api/template/template.model');db[_0x14a8('0x8e')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/trigger/trigger.model');db[_0x14a8('0x8f')]=db['sequelize']['import'](_0x14a8('0x90'));db['Integration']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x91'));db[_0x14a8('0x92')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x93'));db[_0x14a8('0x94')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x95'));db[_0x14a8('0x96')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x97'));db[_0x14a8('0x98')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x99'));db[_0x14a8('0x9a')]=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0x14a8('0x9b')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x9c'));db[_0x14a8('0x9d')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x9e'));db[_0x14a8('0x9f')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xa0'));db[_0x14a8('0xa1')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xa2'));db[_0x14a8('0xa3')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xa4'));db[_0x14a8('0xa5')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xa6'));db['SugarcrmConfiguration']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xa7'));db[_0x14a8('0xa8')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xa9'));db[_0x14a8('0xaa')]=db[_0x14a8('0x3')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x14a8('0xab')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xac'));db['DeskField']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xad'));db[_0x14a8('0xae')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0x14a8('0xaf')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xb0'));db[_0x14a8('0xb1')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xb2'));db['ZendeskAccount']=db[_0x14a8('0x3')]['import'](_0x14a8('0xb3'));db[_0x14a8('0xb4')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xb5'));db[_0x14a8('0xb6')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xb7'));db[_0x14a8('0xb8')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xb9'));db[_0x14a8('0xba')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xbb'));db[_0x14a8('0xbc')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xbd'));db[_0x14a8('0xbe')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xbf'));db['VtigerConfiguration']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xc0'));db[_0x14a8('0xc1')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x14a8('0xc2')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xc3'));db['ServicenowConfiguration']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x14a8('0xc4')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xc5'));db[_0x14a8('0xc6')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xc7'));db['Dynamics365Configuration']=db['sequelize']['import'](_0x14a8('0xc8'));db[_0x14a8('0xc9')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xca'));db[_0x14a8('0xcb')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x14a8('0xcc')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xcd'));db['FreshsalesField']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xce'));db[_0x14a8('0xcf')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x91'));db[_0x14a8('0xd0')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xd1'));db['ChatQueueReport']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xd2'));db[_0x14a8('0xd3')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xd4'));db['JscriptyAnswerReport']=db[_0x14a8('0x3')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x14a8('0x3')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x14a8('0xd5')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xd6'));db[_0x14a8('0xd7')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xd8'));db[_0x14a8('0xd9')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x14a8('0xda')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xdb'));db[_0x14a8('0xdc')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xdd'));db[_0x14a8('0xde')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xdf'));db[_0x14a8('0xe0')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xe1'));db[_0x14a8('0xe2')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xe3'));db[_0x14a8('0xe4')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xe5'));db[_0x14a8('0xe6')]=db[_0x14a8('0x3')]['import']('../api/license/license.model');db['Campaign']=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xe7'));db[_0x14a8('0xe8')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xe9'));db['Attachment']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xea'));db['Plugin']=db['sequelize']['import'](_0x14a8('0xeb'));db[_0x14a8('0xec')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xed'));db[_0x14a8('0xee')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xef'));db[_0x14a8('0xf0')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xf1'));db['OpenchannelTransferReport']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xf2'));db['SmsTransferReport']=db['sequelize']['import'](_0x14a8('0xf3'));db[_0x14a8('0xf4')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0xf5'));db[_0x14a8('0xf6')]=db[_0x14a8('0x3')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x14a8('0xf7')]=db['sequelize'][_0x14a8('0x11')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xf8'));db[_0x14a8('0xf9')]=db['sequelize']['import'](_0x14a8('0xfa'));db['UserNotification']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/userNotification/userNotification.model');db[_0x14a8('0xfb')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xfc'));db['WhatsappApplication']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0xfd'));db['WhatsappInteraction']=db[_0x14a8('0x3')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x14a8('0xfe')]=db[_0x14a8('0x3')]['import'](_0x14a8('0xff'));db[_0x14a8('0x100')]=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x14a8('0x101')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x102'));db['WhatsappQueue']=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x103'));db[_0x14a8('0x104')]=db[_0x14a8('0x3')]['import'](_0x14a8('0x105'));db['TeamVoiceQueue']=db[_0x14a8('0x3')][_0x14a8('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x14a8('0x106')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x107'));db[_0x14a8('0x108')]=db[_0x14a8('0x3')][_0x14a8('0x11')](_0x14a8('0x109'));db[_0x14a8('0x10a')]=db['sequelize'][_0x14a8('0x11')](_0x14a8('0x10b'));db[_0x14a8('0x10c')][_0x14a8('0x10d')](db[_0x14a8('0x1c')],{'as':'VoiceMail','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')][_0x14a8('0x10d')](db[_0x14a8('0x10a')],{'as':'userSetting','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x19')],{'as':_0x14a8('0x111'),'foreignKey':'UserId'});db[_0x14a8('0x10c')]['hasMany'](db[_0x14a8('0x112')],{'as':_0x14a8('0x113'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x6c')],{'as':_0x14a8('0x114'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x6e')],{'as':'HopperHistory','foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x70')],{'as':'ReportAgentPreview','foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')]['hasMany'](db[_0x14a8('0x115')],{'as':_0x14a8('0x116'),'foreignKey':'UserId'});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x5f')],{'as':'ChatInteractions','foreignKey':_0x14a8('0x10f')});db['User'][_0x14a8('0x110')](db[_0x14a8('0x4e')],{'as':_0x14a8('0x117'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')]['hasMany'](db[_0x14a8('0x44')],{'as':'FaxInteractions','foreignKey':_0x14a8('0x10f')});db['User'][_0x14a8('0x110')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x118')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x14a8('0x10c')][_0x14a8('0x110')](db[_0x14a8('0x119')],{'as':'UserNotifications','foreignKey':_0x14a8('0x11a')});db[_0x14a8('0x10c')][_0x14a8('0x11b')](db['UserProfile'],{'as':_0x14a8('0xf7'),'foreignKey':_0x14a8('0x11c')});db[_0x14a8('0x10c')]['belongsToMany'](db[_0x14a8('0x64')],{'as':_0x14a8('0x11d'),'through':'chat_group_has_users'});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x67')],{'as':_0x14a8('0x11f'),'through':'cm_user_has_contacts'});db['User'][_0x14a8('0x11e')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x120'),'through':_0x14a8('0x121')});db['User'][_0x14a8('0x11e')](db[_0x14a8('0xe4')],{'through':_0x14a8('0x122')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['MailInteraction'],{'as':_0x14a8('0x123'),'through':_0x14a8('0x124')});db[_0x14a8('0x10c')]['belongsToMany'](db[_0x14a8('0x5f')],{'as':_0x14a8('0x125'),'through':_0x14a8('0x126')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x44')],{'as':_0x14a8('0x127'),'through':_0x14a8('0x128')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['SmsInteraction'],{'as':_0x14a8('0x117'),'through':'user_has_sms_interactions'});db[_0x14a8('0x10c')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x14a8('0x116'),'through':_0x14a8('0x129')});db[_0x14a8('0x10c')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x14a8('0x12a'),'through':_0x14a8('0x12b')});db['User'][_0x14a8('0x11e')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x14a8('0x29'),'required':![]});db['User'][_0x14a8('0x11e')](db['VoicePrefix'],{'as':_0x14a8('0x12c'),'through':_0x14a8('0x108'),'required':![]});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x38')],{'as':_0x14a8('0x12d'),'through':_0x14a8('0x2c'),'required':![]});db[_0x14a8('0x10c')]['belongsToMany'](db['ChatQueue'],{'as':_0x14a8('0x12e'),'through':_0x14a8('0x12f'),'required':![],'hooks':!![]});db['User'][_0x14a8('0x11e')](db['FaxQueue'],{'as':_0x14a8('0x130'),'through':'UserFaxQueue','required':![]});db[_0x14a8('0x10c')]['belongsToMany'](db[_0x14a8('0x50')],{'as':_0x14a8('0x131'),'through':_0x14a8('0x30'),'required':![]});db[_0x14a8('0x10c')]['belongsToMany'](db[_0x14a8('0x58')],{'as':_0x14a8('0x132'),'through':'UserOpenchannelQueue','required':![]});db[_0x14a8('0x10c')]['belongsToMany'](db[_0x14a8('0x133')],{'as':'WhatsappQueues','through':_0x14a8('0x32'),'required':![]});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['CmList'],{'through':_0x14a8('0x121')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x5a')],{'as':_0x14a8('0x134'),'through':_0x14a8('0x135')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x136')],{'as':_0x14a8('0x137'),'through':_0x14a8('0x138')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0x139')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x14a8('0x13a')});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['SmsAccount'],{'as':_0x14a8('0x13b'),'through':'user_has_sms_accounts'});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db[_0x14a8('0xfb')],{'as':_0x14a8('0x13c'),'through':'user_has_whatsapp_accounts'});db[_0x14a8('0x10c')][_0x14a8('0x11e')](db['SquareProject'],{'as':_0x14a8('0x13d'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0x14a8('0x110')](db[_0x14a8('0x13e')],{'as':_0x14a8('0x13f'),'onDelete':_0x14a8('0x10e'),'foreignKey':'ChanSpyId'});db[_0x14a8('0x14')]['hasMany'](db[_0x14a8('0x13e')],{'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x13e')]['hasMany'](db['VoiceExtension'],{'as':_0x14a8('0x140'),'onDelete':_0x14a8('0x10e')});db['VoiceMusicOnHold'][_0x14a8('0x11e')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0x14a8('0x18')][_0x14a8('0x110')](db[_0x14a8('0x112')],{'as':_0x14a8('0x141'),'foreignKey':_0x14a8('0x142')});db[_0x14a8('0x18')][_0x14a8('0x110')](db['CmHopper'],{'as':_0x14a8('0x143'),'foreignKey':_0x14a8('0x142')});db[_0x14a8('0x18')][_0x14a8('0x110')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x14a8('0x142')});db[_0x14a8('0x18')][_0x14a8('0x110')](db[_0x14a8('0x6e')],{'as':_0x14a8('0x144'),'foreignKey':_0x14a8('0x142')});db[_0x14a8('0x18')][_0x14a8('0x110')](db[_0x14a8('0x70')],{'as':_0x14a8('0x70'),'foreignKey':'VoiceQueueId'});db[_0x14a8('0x18')][_0x14a8('0x110')](db[_0x14a8('0x6a')],{'as':_0x14a8('0x145'),'foreignKey':'VoiceQueueId'});db[_0x14a8('0x18')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x14a8('0x142')});db[_0x14a8('0x18')]['belongsTo'](db[_0x14a8('0x146')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x14a8('0x18')][_0x14a8('0x11b')](db[_0x14a8('0x146')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x14a8('0x18')]['belongsTo'](db['Interval'],{'as':_0x14a8('0x7d'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x18')][_0x14a8('0x11b')](db[_0x14a8('0x148')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x14a8('0x18')][_0x14a8('0x11e')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x120'),'through':'voice_queues_has_cm_lists'});db[_0x14a8('0x18')][_0x14a8('0x11e')](db['User'],{'as':_0x14a8('0x149'),'through':_0x14a8('0x29')});db[_0x14a8('0x18')][_0x14a8('0x11e')](db['Team'],{'as':_0x14a8('0x14a'),'through':_0x14a8('0x14b')});db[_0x14a8('0x18')][_0x14a8('0x11e')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x14c'),'through':_0x14a8('0x14d')});db[_0x14a8('0x19')][_0x14a8('0x11b')](db['User'],{'as':_0x14a8('0x10c'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x1a')][_0x14a8('0x11b')](db['User'],{'as':'User','foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x1c')][_0x14a8('0x110')](db[_0x14a8('0x1e')],{'as':'Messages','onDelete':_0x14a8('0x10e'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x14a8('0x1e')][_0x14a8('0x11b')](db[_0x14a8('0x1c')],{'foreignKey':_0x14a8('0x14e'),'targetKey':_0x14a8('0x14f')});db[_0x14a8('0x1f')][_0x14a8('0x110')](db['VoiceQueueReport'],{'as':_0x14a8('0x150'),'foreignKey':'uniqueid','constraints':![]});db[_0x14a8('0x1f')]['hasMany'](db[_0x14a8('0x22')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x10c'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x1f')][_0x14a8('0x11b')](db['CmContact'],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x34')]['belongsTo'](db[_0x14a8('0x139')],{'as':_0x14a8('0x139'),'foreignKey':_0x14a8('0x153')});db[_0x14a8('0x34')][_0x14a8('0x11b')](db[_0x14a8('0x104')],{'as':_0x14a8('0x104'),'foreignKey':'CloudProviderId','onDelete':_0x14a8('0x154')});db[_0x14a8('0x36')][_0x14a8('0x11b')](db[_0x14a8('0x139')],{'as':_0x14a8('0x139'),'foreignKey':'MailAccountId'});db[_0x14a8('0x36')][_0x14a8('0x11b')](db[_0x14a8('0x104')],{'as':_0x14a8('0x104'),'foreignKey':'CloudProviderId','onDelete':_0x14a8('0x154')});db[_0x14a8('0x139')][_0x14a8('0x10d')](db[_0x14a8('0x34')],{'as':_0x14a8('0x155'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x139')][_0x14a8('0x10d')](db[_0x14a8('0x36')],{'as':_0x14a8('0x156'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x139')][_0x14a8('0x110')](db[_0x14a8('0x79')],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x153'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x139')][_0x14a8('0x110')](db[_0x14a8('0x78')],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x153')});db[_0x14a8('0x139')][_0x14a8('0x110')](db['MailMessage'],{'as':_0x14a8('0x159'),'foreignKey':'MailAccountId'});db[_0x14a8('0x139')][_0x14a8('0x110')](db[_0x14a8('0x15a')],{'as':'Interactions'});db[_0x14a8('0x139')][_0x14a8('0x110')](db['MailApplication'],{'as':_0x14a8('0x140')});db[_0x14a8('0x139')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':'ListId'});db[_0x14a8('0x139')][_0x14a8('0x11b')](db[_0x14a8('0x8d')],{'as':_0x14a8('0x8d'),'foreignKey':_0x14a8('0x15c')});db[_0x14a8('0x139')]['belongsTo'](db[_0x14a8('0x148')],{'as':_0x14a8('0x15d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x14a8('0x139')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':_0x14a8('0x15e')});db[_0x14a8('0x38')][_0x14a8('0x11e')](db['User'],{'as':_0x14a8('0x149'),'through':'UserMailQueue'});db[_0x14a8('0x38')][_0x14a8('0x11e')](db[_0x14a8('0xe4')],{'through':_0x14a8('0x15f'),'as':_0x14a8('0x14a')});db[_0x14a8('0x15a')][_0x14a8('0x110')](db[_0x14a8('0x160')],{'as':'Messages','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x161')});db[_0x14a8('0x15a')]['belongsTo'](db[_0x14a8('0x139')],{'as':'Account','foreignKey':_0x14a8('0x153')});db[_0x14a8('0x15a')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':'ContactId'});db[_0x14a8('0x15a')][_0x14a8('0x11b')](db['User'],{'as':_0x14a8('0x162'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x15a')]['belongsToMany'](db[_0x14a8('0x87')],{'through':'mail_interaction_has_tags','as':_0x14a8('0x163')});db[_0x14a8('0x15a')][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x164'),'as':_0x14a8('0x165')});db['MailInteraction']['belongsToMany'](db[_0x14a8('0x10c')],{'as':_0x14a8('0x166'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x14a8('0x160')][_0x14a8('0x110')](db[_0x14a8('0x167')],{'as':'Attachments','onDelete':_0x14a8('0x10e')});db['MailMessage'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x10c')});db['MailMessage'][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'onDelete':_0x14a8('0x10e'),'as':'Contact'});db[_0x14a8('0x160')][_0x14a8('0x11b')](db['MailInteraction'],{'as':_0x14a8('0x168'),'foreignKey':_0x14a8('0x161')});db['MailMessage'][_0x14a8('0x11b')](db[_0x14a8('0x139')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x153')});db[_0x14a8('0x160')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{'as':_0x14a8('0x5a'),'foreignKey':_0x14a8('0x16a')});db[_0x14a8('0x160')][_0x14a8('0x11b')](db[_0x14a8('0x61')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x14a8('0x3e')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x3e')][_0x14a8('0x11b')](db[_0x14a8('0x38')],{'onDelete':_0x14a8('0x154')});db['MailApplication'][_0x14a8('0x11b')](db[_0x14a8('0x139')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x3e')][_0x14a8('0x11b')](db[_0x14a8('0x7d')],{'onDelete':_0x14a8('0x154'),'foreignKey':'IntervalId'});db[_0x14a8('0x3e')][_0x14a8('0x11b')](db['Tag'],{'onDelete':_0x14a8('0x154'),'foreignKey':'TagId'});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x139')],{});db[_0x14a8('0x40')]['belongsTo'](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':'ListId'});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':'Contact','foreignKey':_0x14a8('0x152')});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x15a')],{});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x160')],{});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{});db[_0x14a8('0x40')][_0x14a8('0x11b')](db[_0x14a8('0x38')],{});db[_0x14a8('0x42')][_0x14a8('0x110')](db[_0x14a8('0x16b')],{'as':_0x14a8('0x16c'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x136')]['hasMany'](db['Disposition'],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x16d'),'onDelete':_0x14a8('0x10e')});db['FaxAccount'][_0x14a8('0x110')](db[_0x14a8('0x78')],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x16d')});db[_0x14a8('0x136')][_0x14a8('0x110')](db[_0x14a8('0x44')],{'as':'Interactions'});db[_0x14a8('0x136')][_0x14a8('0x110')](db['FaxApplication'],{'as':_0x14a8('0x140')});db['FaxAccount'][_0x14a8('0x110')](db[_0x14a8('0x13e')],{'as':_0x14a8('0x16e'),'onDelete':'cascade'});db[_0x14a8('0x136')][_0x14a8('0x110')](db[_0x14a8('0x45')],{'as':_0x14a8('0x159')});db[_0x14a8('0x136')][_0x14a8('0x11b')](db['Trunk'],{'as':'Trunk'});db[_0x14a8('0x136')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':'ListId'});db[_0x14a8('0x136')][_0x14a8('0x11b')](db[_0x14a8('0x148')],{'as':_0x14a8('0x15d'),'foreignKey':_0x14a8('0x16f')});db[_0x14a8('0x136')][_0x14a8('0x11e')](db['User'],{'as':_0x14a8('0x149'),'through':_0x14a8('0x138')});db['FaxApplication'][_0x14a8('0x11b')](db['User'],{'onDelete':_0x14a8('0x154')});db['FaxApplication'][_0x14a8('0x11b')](db[_0x14a8('0x47')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x43')][_0x14a8('0x11b')](db['FaxAccount'],{'onDelete':_0x14a8('0x154')});db['FaxApplication']['belongsTo'](db[_0x14a8('0x87')],{'onDelete':_0x14a8('0x154'),'foreignKey':_0x14a8('0x170')});db['FaxInteraction'][_0x14a8('0x110')](db[_0x14a8('0x45')],{'as':_0x14a8('0x159'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x171')});db[_0x14a8('0x44')][_0x14a8('0x11b')](db['FaxAccount'],{'as':_0x14a8('0x169'),'foreignKey':'FaxAccountId'});db[_0x14a8('0x44')]['belongsTo'](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db['FaxInteraction'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x162'),'foreignKey':'UserId'});db[_0x14a8('0x44')][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x14a8('0x44')][_0x14a8('0x11e')](db['Tag'],{'through':_0x14a8('0x172'),'as':'ThroughTags'});db[_0x14a8('0x44')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x166'),'through':_0x14a8('0x128'),'foreignKey':_0x14a8('0x171')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0x14a8('0x11b')](db[_0x14a8('0x44')],{'as':'Interaction','foreignKey':_0x14a8('0x171')});db[_0x14a8('0x45')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x151')});db[_0x14a8('0x45')]['belongsTo'](db[_0x14a8('0x167')],{'as':_0x14a8('0x167'),'foreignKey':_0x14a8('0x173')});db[_0x14a8('0x45')][_0x14a8('0x11b')](db[_0x14a8('0x136')],{'as':'Account','foreignKey':_0x14a8('0x16d')});db[_0x14a8('0x47')][_0x14a8('0x11e')](db['User'],{'as':_0x14a8('0x149'),'through':_0x14a8('0x2e')});db['FaxQueue'][_0x14a8('0x11e')](db[_0x14a8('0xe4')],{'through':'team_has_fax_queues','as':_0x14a8('0x14a')});db[_0x14a8('0x49')][_0x14a8('0x11b')](db[_0x14a8('0x136')],{});db[_0x14a8('0x49')]['belongsTo'](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174')});db['FaxQueueReport'][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x49')][_0x14a8('0x11b')](db[_0x14a8('0x44')],{});db[_0x14a8('0x49')][_0x14a8('0x11b')](db[_0x14a8('0x45')],{});db[_0x14a8('0x49')]['belongsTo'](db['User'],{});db[_0x14a8('0x49')]['belongsTo'](db['FaxQueue'],{});db['SmsAccount'][_0x14a8('0x110')](db['Disposition'],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x175'),'onDelete':'cascade'});db[_0x14a8('0x4b')]['hasMany'](db[_0x14a8('0x78')],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x175')});db['SmsAccount']['hasMany'](db[_0x14a8('0x4f')],{'as':_0x14a8('0x159'),'foreignKey':_0x14a8('0x175')});db[_0x14a8('0x4b')][_0x14a8('0x110')](db[_0x14a8('0x4e')],{'as':'Interactions'});db[_0x14a8('0x4b')][_0x14a8('0x110')](db['SmsApplication'],{'as':'Applications'});db[_0x14a8('0x4b')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174')});db[_0x14a8('0x4b')][_0x14a8('0x11b')](db[_0x14a8('0x148')],{'as':_0x14a8('0x15d'),'foreignKey':_0x14a8('0x16f')});db[_0x14a8('0x4b')]['belongsToMany'](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':'user_has_sms_accounts'});db[_0x14a8('0x4c')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x4c')][_0x14a8('0x11b')](db[_0x14a8('0x50')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x4c')][_0x14a8('0x11b')](db[_0x14a8('0x4b')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x4c')][_0x14a8('0x11b')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x14a8('0x147')});db[_0x14a8('0x4c')][_0x14a8('0x11b')](db['Tag'],{'onDelete':_0x14a8('0x154'),'foreignKey':_0x14a8('0x170')});db['SmsInteraction']['hasMany'](db[_0x14a8('0x4f')],{'as':_0x14a8('0x159'),'onDelete':'cascade','foreignKey':_0x14a8('0x176')});db[_0x14a8('0x4e')][_0x14a8('0x11b')](db[_0x14a8('0x4b')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x175')});db[_0x14a8('0x4e')]['belongsTo'](db['CmContact'],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x4e')]['belongsTo'](db[_0x14a8('0x10c')],{'as':_0x14a8('0x162'),'foreignKey':_0x14a8('0x10f')});db['SmsInteraction'][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x177'),'as':_0x14a8('0x163')});db[_0x14a8('0x4e')][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x177'),'as':_0x14a8('0x165')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x14a8('0x166'),'through':_0x14a8('0x178'),'foreignKey':_0x14a8('0x176')});db['SmsMessage'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x10c')});db[_0x14a8('0x4f')]['belongsTo'](db[_0x14a8('0x67')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x151')});db[_0x14a8('0x4f')][_0x14a8('0x11b')](db[_0x14a8('0x4e')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x168'),'foreignKey':_0x14a8('0x176')});db[_0x14a8('0x4f')][_0x14a8('0x11b')](db['SmsAccount'],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x175')});db['SmsQueue'][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':'Agents','through':_0x14a8('0x30'),'foreignKey':_0x14a8('0x179')});db[_0x14a8('0x50')]['belongsToMany'](db[_0x14a8('0xe4')],{'through':_0x14a8('0x17a'),'as':_0x14a8('0x14a')});db[_0x14a8('0x52')][_0x14a8('0x110')](db['Disposition'],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x17b'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x52')][_0x14a8('0x110')](db[_0x14a8('0x78')],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x17b')});db['OpenchannelAccount'][_0x14a8('0x110')](db[_0x14a8('0x115')],{'as':_0x14a8('0x17c'),'foreignKey':'OpenchannelAccountId'});db[_0x14a8('0x52')]['hasMany'](db[_0x14a8('0x56')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x14a8('0x52')][_0x14a8('0x110')](db[_0x14a8('0x54')],{'as':_0x14a8('0x140'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':'List','foreignKey':_0x14a8('0x174')});db[_0x14a8('0x52')][_0x14a8('0x11b')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x14a8('0x16f')});db['OpenchannelAccount'][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':_0x14a8('0x13a')});db['OpenchannelApplication'][_0x14a8('0x11b')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x14a8('0x17d')});db[_0x14a8('0x54')][_0x14a8('0x11b')](db[_0x14a8('0x52')],{'onDelete':_0x14a8('0x154'),'foreignKey':_0x14a8('0x17b')});db[_0x14a8('0x54')][_0x14a8('0x11b')](db[_0x14a8('0x7d')],{'onDelete':_0x14a8('0x154'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x54')][_0x14a8('0x11b')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x14a8('0x170')});db[_0x14a8('0x115')][_0x14a8('0x110')](db[_0x14a8('0x56')],{'as':_0x14a8('0x159'),'onDelete':'cascade','foreignKey':_0x14a8('0x17e')});db[_0x14a8('0x115')][_0x14a8('0x11b')](db[_0x14a8('0x52')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x17b')});db['OpenchannelInteraction'][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':'Contact','foreignKey':'ContactId'});db[_0x14a8('0x115')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x162'),'foreignKey':_0x14a8('0x10f')});db['OpenchannelInteraction'][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':'openchannel_interaction_has_tags','as':_0x14a8('0x163')});db[_0x14a8('0x115')][_0x14a8('0x11e')](db['Tag'],{'through':_0x14a8('0x17f'),'as':'ThroughTags'});db[_0x14a8('0x115')]['belongsToMany'](db[_0x14a8('0x10c')],{'as':'Users','through':_0x14a8('0x129'),'foreignKey':_0x14a8('0x17e')});db[_0x14a8('0x56')]['belongsTo'](db[_0x14a8('0x10c')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x10c')});db[_0x14a8('0x56')]['belongsTo'](db[_0x14a8('0x67')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x151')});db[_0x14a8('0x56')][_0x14a8('0x11b')](db[_0x14a8('0x115')],{'onDelete':_0x14a8('0x10e'),'as':'Interaction','foreignKey':_0x14a8('0x17e')});db[_0x14a8('0x56')][_0x14a8('0x11b')](db[_0x14a8('0x167')],{'as':_0x14a8('0x167'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x14a8('0x11b')](db[_0x14a8('0x52')],{'as':'Account','foreignKey':_0x14a8('0x17b')});db[_0x14a8('0x58')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':_0x14a8('0x180'),'foreignKey':'OpenchannelQueueId'});db[_0x14a8('0x58')]['belongsToMany'](db[_0x14a8('0xe4')],{'through':_0x14a8('0x181'),'as':_0x14a8('0x14a')});db['ChatWebsite'][_0x14a8('0x110')](db['Disposition'],{'as':_0x14a8('0x157'),'foreignKey':'ChatWebsiteId','onDelete':_0x14a8('0x10e')});db[_0x14a8('0x5a')][_0x14a8('0x110')](db[_0x14a8('0x78')],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x16a')});db[_0x14a8('0x5a')][_0x14a8('0x110')](db[_0x14a8('0x182')],{'as':_0x14a8('0x183')});db[_0x14a8('0x5a')][_0x14a8('0x110')](db[_0x14a8('0x5f')],{'as':_0x14a8('0x17c')});db[_0x14a8('0x5a')][_0x14a8('0x110')](db[_0x14a8('0x5d')],{'as':_0x14a8('0x140')});db[_0x14a8('0x5a')][_0x14a8('0x110')](db['ChatMessage'],{'as':_0x14a8('0x159')});db['ChatWebsite'][_0x14a8('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x14a8('0x174')});db[_0x14a8('0x5a')]['belongsTo'](db[_0x14a8('0x7d')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x14a8('0x5a')]['belongsTo'](db[_0x14a8('0x139')],{'as':_0x14a8('0x139'),'foreignKey':_0x14a8('0x153')});db['ChatWebsite'][_0x14a8('0x11b')](db[_0x14a8('0x148')],{'as':_0x14a8('0x15d'),'foreignKey':_0x14a8('0x16f')});db[_0x14a8('0x5a')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':_0x14a8('0x135')});db['OpenchannelQueueReport'][_0x14a8('0x11b')](db[_0x14a8('0x52')],{});db[_0x14a8('0x5b')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':'List','foreignKey':_0x14a8('0x174')});db['OpenchannelQueueReport']['belongsTo'](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x5b')][_0x14a8('0x11b')](db[_0x14a8('0x115')],{});db[_0x14a8('0x5b')]['belongsTo'](db[_0x14a8('0x56')],{});db['OpenchannelQueueReport'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{});db[_0x14a8('0x5b')][_0x14a8('0x11b')](db[_0x14a8('0x58')],{});db[_0x14a8('0x5d')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x14a8('0x154')});db[_0x14a8('0x5d')][_0x14a8('0x11b')](db[_0x14a8('0x184')],{'as':_0x14a8('0x185'),'foreignKey':'ChatQueueId','onDelete':_0x14a8('0x154')});db['ChatApplication'][_0x14a8('0x11b')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x14a8('0x16a'),'onDelete':'restrict'});db[_0x14a8('0x5d')]['belongsTo'](db[_0x14a8('0x87')],{'onDelete':'restrict','foreignKey':_0x14a8('0x170')});db[_0x14a8('0x5f')][_0x14a8('0x110')](db[_0x14a8('0x186')],{'as':_0x14a8('0x159'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x187')});db[_0x14a8('0x5f')]['belongsTo'](db[_0x14a8('0x5a')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x16a')});db[_0x14a8('0x5f')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x5f')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':'Owner','foreignKey':_0x14a8('0x10f')});db['ChatInteraction'][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x188'),'as':_0x14a8('0x163')});db[_0x14a8('0x5f')][_0x14a8('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x14a8('0x165')});db[_0x14a8('0x5f')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x166'),'through':'user_has_chat_interactions','foreignKey':_0x14a8('0x187')});db[_0x14a8('0x186')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'onDelete':'cascade','as':_0x14a8('0x10c')});db[_0x14a8('0x186')][_0x14a8('0x11b')](db['CmContact'],{'onDelete':_0x14a8('0x10e'),'as':'Contact','foreignKey':_0x14a8('0x152')});db[_0x14a8('0x186')][_0x14a8('0x11b')](db[_0x14a8('0x5f')],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x168'),'foreignKey':_0x14a8('0x187')});db[_0x14a8('0x186')][_0x14a8('0x11b')](db[_0x14a8('0x167')],{'as':_0x14a8('0x167'),'foreignKey':_0x14a8('0x173')});db[_0x14a8('0x186')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{'as':_0x14a8('0x169'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x14a8('0x110')](db['Attachment'],{'as':_0x14a8('0x189'),'foreignKey':_0x14a8('0x18a'),'onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x61')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'onDelete':_0x14a8('0x10e'),'as':'Contact','foreignKey':_0x14a8('0x152')});db[_0x14a8('0x61')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x14a8('0x184')]['belongsToMany'](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x14a8('0xe4')],{'through':_0x14a8('0x18b'),'as':_0x14a8('0x14a')});db[_0x14a8('0x64')][_0x14a8('0x110')](db[_0x14a8('0xd3')],{'as':'Messages','foreignKey':_0x14a8('0x18c'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x64')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':'Members','through':'chat_group_has_users'});db[_0x14a8('0x182')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{'as':_0x14a8('0x18d'),'foreignKey':_0x14a8('0x16a')});db['CmCompany']['hasMany'](db[_0x14a8('0x67')],{'as':_0x14a8('0x11f'),'foreignKey':_0x14a8('0x18e')});db['CmContact'][_0x14a8('0x110')](db[_0x14a8('0x8a')],{'as':_0x14a8('0x18f'),'foreignKey':_0x14a8('0x190')});db[_0x14a8('0x67')][_0x14a8('0x110')](db[_0x14a8('0x69')],{'as':_0x14a8('0x143'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x67')][_0x14a8('0x110')](db['CmHopperFinal'],{'as':_0x14a8('0x114'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x67')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x14a8('0x152')});db['CmContact'][_0x14a8('0x110')](db[_0x14a8('0x70')],{'as':'ReportAgentPreview','foreignKey':_0x14a8('0x152')});db[_0x14a8('0x67')][_0x14a8('0x110')](db[_0x14a8('0x191')],{'as':_0x14a8('0x192'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x67')][_0x14a8('0x110')](db[_0x14a8('0x115')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x14a8('0x154')});db[_0x14a8('0x67')][_0x14a8('0x110')](db[_0x14a8('0x5f')],{'as':_0x14a8('0x125'),'foreignKey':_0x14a8('0x152'),'onDelete':'restrict'});db[_0x14a8('0x67')]['hasMany'](db[_0x14a8('0x4e')],{'as':_0x14a8('0x117'),'foreignKey':_0x14a8('0x152'),'onDelete':_0x14a8('0x154')});db[_0x14a8('0x67')][_0x14a8('0x110')](db[_0x14a8('0x44')],{'as':'FaxInteractions','foreignKey':_0x14a8('0x152'),'onDelete':_0x14a8('0x154')});db['CmContact']['hasMany'](db[_0x14a8('0x15a')],{'as':_0x14a8('0x123'),'foreignKey':_0x14a8('0x152'),'onDelete':'restrict'});db[_0x14a8('0x67')]['belongsTo'](db[_0x14a8('0x66')],{'as':_0x14a8('0x193'),'foreignKey':_0x14a8('0x18e')});db[_0x14a8('0x67')][_0x14a8('0x11b')](db['CmList'],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x67')][_0x14a8('0x11e')](db['User'],{'as':_0x14a8('0x166'),'through':'cm_user_has_contacts'});db['CmContact'][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'as':_0x14a8('0x163'),'through':_0x14a8('0x194')});db[_0x14a8('0x67')][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x194'),'as':_0x14a8('0x165')});db[_0x14a8('0x69')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x14a8('0x195'),'foreignKey':_0x14a8('0x196')});db[_0x14a8('0x69')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':'Contact','foreignKey':_0x14a8('0x152'),'onDelete':'cascade'});db['CmHopper'][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x69')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x197'),'foreignKey':_0x14a8('0x10f')});db[_0x14a8('0x69')][_0x14a8('0x11b')](db[_0x14a8('0x18')],{'as':_0x14a8('0x185'),'foreignKey':_0x14a8('0x142'),'onDelete':_0x14a8('0x10e')});db['CmHopper'][_0x14a8('0x11b')](db['Campaign'],{'as':_0x14a8('0x198'),'foreignKey':_0x14a8('0x199'),'onDelete':_0x14a8('0x10e')});db['CmHopper'][_0x14a8('0x11b')](db['User'],{'as':_0x14a8('0x162'),'foreignKey':_0x14a8('0x19a')});db[_0x14a8('0x6a')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x6a')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':'List','foreignKey':_0x14a8('0x174'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x6a')][_0x14a8('0x11b')](db['VoiceQueue'],{'as':_0x14a8('0x185'),'foreignKey':_0x14a8('0x142'),'onDelete':'cascade'});db['CmHopperBlack'][_0x14a8('0x11b')](db['Campaign'],{'as':_0x14a8('0x198'),'foreignKey':_0x14a8('0x199'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0x76')][_0x14a8('0x110')](db[_0x14a8('0x7b')],{'as':{'plural':'All','singular':_0x14a8('0x19b')},'foreignKey':'AutomationAllId','onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x76')][_0x14a8('0x110')](db['Condition'],{'as':{'plural':'Any','singular':_0x14a8('0x19c')},'foreignKey':'AutomationAnyId','onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x76')]['hasMany'](db['Action'],{'as':_0x14a8('0x19d'),'foreignKey':_0x14a8('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x14a8('0x79')][_0x14a8('0x110')](db[_0x14a8('0x79')],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x19f'),'onDelete':_0x14a8('0x10e')});db['Interval']['hasMany'](db[_0x14a8('0x7d')],{'as':_0x14a8('0x1a0'),'foreignKey':'IntervalId','onDelete':_0x14a8('0x10e'),'hooks':!![],'required':![]});db[_0x14a8('0x7d')][_0x14a8('0x110')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x14a8('0x147'),'onDelete':_0x14a8('0x154')});db[_0x14a8('0x7d')][_0x14a8('0x110')](db[_0x14a8('0x3e')],{'as':_0x14a8('0x1a1'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x7d')]['hasMany'](db[_0x14a8('0x5d')],{'as':_0x14a8('0x1a2'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x7d')][_0x14a8('0x110')](db[_0x14a8('0x43')],{'as':_0x14a8('0x1a3'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x7d')][_0x14a8('0x110')](db[_0x14a8('0x4c')],{'as':_0x14a8('0x1a4'),'foreignKey':_0x14a8('0x147')});db['Schedule'][_0x14a8('0x11b')](db[_0x14a8('0x139')],{});db['Schedule']['belongsTo'](db[_0x14a8('0x96')],{'foreignKey':_0x14a8('0x1a5')});db[_0x14a8('0x83')][_0x14a8('0x11b')](db['AnalyticCustomReport'],{'foreignKey':_0x14a8('0x1a6')});db['Sound'][_0x14a8('0x11e')](db['VoiceMusicOnHold'],{'as':_0x14a8('0x1a7'),'through':_0x14a8('0x1a8'),'onDelete':_0x14a8('0x154')});db[_0x14a8('0x87')]['belongsToMany'](db[_0x14a8('0x67')],{'through':_0x14a8('0x194')});db[_0x14a8('0x87')][_0x14a8('0x11e')](db[_0x14a8('0x5f')],{'through':_0x14a8('0x188')});db[_0x14a8('0x87')][_0x14a8('0x11e')](db[_0x14a8('0x15a')],{'through':'mail_interaction_has_tags'});db[_0x14a8('0x87')]['belongsToMany'](db[_0x14a8('0x4e')],{'through':_0x14a8('0x177')});db['Tag'][_0x14a8('0x11e')](db[_0x14a8('0x44')],{'through':_0x14a8('0x172')});db[_0x14a8('0x87')][_0x14a8('0x11e')](db[_0x14a8('0x115')],{'through':_0x14a8('0x17f')});db[_0x14a8('0x87')][_0x14a8('0x11e')](db[_0x14a8('0x118')],{'through':_0x14a8('0x1a9')});db[_0x14a8('0x8a')][_0x14a8('0x11b')](db[_0x14a8('0x88')],{'as':_0x14a8('0x1aa'),'foreignKey':_0x14a8('0x1ab')});db['CmHopperAdditionalPhone'][_0x14a8('0x11b')](db[_0x14a8('0x69')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0x14a8('0x8a')]['belongsTo'](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x190')});db['Trigger'][_0x14a8('0x110')](db[_0x14a8('0x7b')],{'as':{'plural':_0x14a8('0x1ac'),'singular':'AllCondition'},'foreignKey':_0x14a8('0x1ad'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x14a8('0x110')](db[_0x14a8('0x7b')],{'as':{'plural':_0x14a8('0x1ae'),'singular':'AnyCondition'},'foreignKey':_0x14a8('0x1af'),'onDelete':_0x14a8('0x10e'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x14a8('0x74')],{'as':'Actions','foreignKey':_0x14a8('0x1b0'),'onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x94')][_0x14a8('0x110')](db[_0x14a8('0x9b')],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1a6'),'hooks':!![]});db[_0x14a8('0x96')]['hasMany'](db[_0x14a8('0x9b')],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1a5')});db[_0x14a8('0x9a')][_0x14a8('0x110')](db['AnalyticFieldReport'],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b2')});db[_0x14a8('0x9b')][_0x14a8('0x11b')](db[_0x14a8('0x9a')],{'foreignKey':_0x14a8('0x1b2')});db['SalesforceAccount'][_0x14a8('0x110')](db[_0x14a8('0xa1')],{'as':_0x14a8('0x1b3'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db['SalesforceConfiguration'][_0x14a8('0x110')](db[_0x14a8('0xa3')],{'as':_0x14a8('0x1b5'),'onDelete':_0x14a8('0x10e'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x14a8('0xa3')],{'as':_0x14a8('0x1b6'),'onDelete':_0x14a8('0x10e'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x14a8('0x110')](db['SalesforceField'],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xa1')][_0x14a8('0x11b')](db[_0x14a8('0x9f')],{'as':_0x14a8('0x169'),'foreignKey':'AccountId'});db[_0x14a8('0xa3')][_0x14a8('0x110')](db[_0x14a8('0xa3')],{'as':'Subject','foreignKey':'SubjectId'});db['SalesforceField'][_0x14a8('0x110')](db[_0x14a8('0xa3')],{'as':_0x14a8('0x1b8'),'foreignKey':'DescriptionId'});db[_0x14a8('0xa3')][_0x14a8('0x110')](db[_0x14a8('0xa3')],{'as':'Field','foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xa3')]['belongsTo'](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':_0x14a8('0x1b9')});db[_0x14a8('0xa5')][_0x14a8('0x110')](db[_0x14a8('0x1ba')],{'as':_0x14a8('0x1b3'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0x1ba')]['hasMany'](db[_0x14a8('0xa8')],{'as':_0x14a8('0x1b5'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0x1ba')]['hasMany'](db[_0x14a8('0xa8')],{'as':_0x14a8('0x1b6'),'onDelete':'cascade','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1ba')][_0x14a8('0x110')](db[_0x14a8('0xa8')],{'as':_0x14a8('0x1b1'),'onDelete':'cascade','foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0x1ba')][_0x14a8('0x11b')](db[_0x14a8('0xa5')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xa8')][_0x14a8('0x110')](db[_0x14a8('0xa8')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xa8')][_0x14a8('0x110')](db[_0x14a8('0xa8')],{'as':'Description','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0xa8')][_0x14a8('0x110')](db[_0x14a8('0xa8')],{'as':_0x14a8('0x1be'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xa8')][_0x14a8('0x11b')](db[_0x14a8('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0x14a8('0xaa')][_0x14a8('0x110')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db['DeskConfiguration'][_0x14a8('0x110')](db[_0x14a8('0x1bf')],{'as':_0x14a8('0x1b5'),'onDelete':'cascade','foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xab')]['hasMany'](db[_0x14a8('0x1bf')],{'as':_0x14a8('0x1b6'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bc')});db['DeskConfiguration'][_0x14a8('0x110')](db['DeskField'],{'as':'Fields','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xab')]['belongsTo'](db[_0x14a8('0xaa')],{'as':_0x14a8('0x169'),'foreignKey':'AccountId'});db[_0x14a8('0xab')]['belongsToMany'](db[_0x14a8('0x87')],{'through':_0x14a8('0x1c0')});db[_0x14a8('0x1bf')][_0x14a8('0x110')](db[_0x14a8('0x1bf')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0x1bf')]['hasMany'](db['DeskField'],{'as':'Description','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1bf')][_0x14a8('0x110')](db[_0x14a8('0x1bf')],{'as':_0x14a8('0x1be'),'foreignKey':_0x14a8('0x1b7')});db['DeskField']['belongsTo'](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':_0x14a8('0x1b9')});db['ZohoAccount'][_0x14a8('0x110')](db[_0x14a8('0xaf')],{'as':_0x14a8('0x1b3'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xaf')][_0x14a8('0x110')](db['ZohoField'],{'as':_0x14a8('0x1b5'),'onDelete':'cascade','foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xaf')][_0x14a8('0x110')](db[_0x14a8('0xb1')],{'as':_0x14a8('0x1b6'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0xaf')]['hasMany'](db['ZohoField'],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xaf')]['belongsTo'](db[_0x14a8('0xae')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db['ZohoField'][_0x14a8('0x110')](db[_0x14a8('0xb1')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xb1')][_0x14a8('0x110')](db[_0x14a8('0xb1')],{'as':'Description','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0xb1')][_0x14a8('0x110')](db['ZohoField'],{'as':_0x14a8('0x1be'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xb1')][_0x14a8('0x11b')](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':_0x14a8('0x1b9')});db['ZendeskAccount'][_0x14a8('0x110')](db[_0x14a8('0xb4')],{'as':_0x14a8('0x1b3'),'onDelete':_0x14a8('0x10e'),'foreignKey':'AccountId'});db[_0x14a8('0xb4')][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':'Subjects','foreignKey':_0x14a8('0x1bb')});db['ZendeskConfiguration'][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':'Descriptions','foreignKey':_0x14a8('0x1bc')});db['ZendeskConfiguration'][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':_0x14a8('0x1b1'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x14a8('0x1b4')});db['ZendeskConfiguration']['belongsToMany'](db[_0x14a8('0x87')],{'through':_0x14a8('0x1c1')});db[_0x14a8('0xb6')][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':_0x14a8('0x1bd'),'foreignKey':'SubjectId'});db[_0x14a8('0xb6')][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':_0x14a8('0x1b8'),'foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0xb6')][_0x14a8('0x110')](db[_0x14a8('0xb6')],{'as':_0x14a8('0x1be'),'foreignKey':'FieldId'});db[_0x14a8('0xb6')][_0x14a8('0x11b')](db['Variable'],{'as':_0x14a8('0x8f'),'foreignKey':'VariableId'});db[_0x14a8('0xb8')][_0x14a8('0x110')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xba')]['hasMany'](db[_0x14a8('0xbc')],{'as':_0x14a8('0x1b5'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xba')][_0x14a8('0x110')](db['FreshdeskField'],{'as':_0x14a8('0x1b6'),'onDelete':_0x14a8('0x10e'),'foreignKey':'DescriptionId'});db[_0x14a8('0xba')][_0x14a8('0x110')](db[_0x14a8('0xbc')],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':'FieldId'});db[_0x14a8('0xba')][_0x14a8('0x11b')](db['FreshdeskAccount'],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db['FreshdeskConfiguration'][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x1c2')});db[_0x14a8('0xbc')][_0x14a8('0x110')](db[_0x14a8('0xbc')],{'as':'Subject','foreignKey':_0x14a8('0x1bb')});db['FreshdeskField'][_0x14a8('0x110')](db[_0x14a8('0xbc')],{'as':_0x14a8('0x1b8'),'foreignKey':_0x14a8('0x1bc')});db['FreshdeskField']['hasMany'](db[_0x14a8('0xbc')],{'as':'Field','foreignKey':_0x14a8('0x1b7')});db['FreshdeskField']['belongsTo'](db[_0x14a8('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0x14a8('0xbe')][_0x14a8('0x110')](db[_0x14a8('0x1c3')],{'as':'Configurations','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0x1c3')]['hasMany'](db[_0x14a8('0xc1')],{'as':_0x14a8('0x1b5'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0x1c3')][_0x14a8('0x110')](db[_0x14a8('0xc1')],{'as':'Descriptions','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1c3')][_0x14a8('0x110')](db['VtigerField'],{'as':_0x14a8('0x1b1'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0x1c3')][_0x14a8('0x11b')](db['VtigerAccount'],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db['VtigerField'][_0x14a8('0x110')](db[_0x14a8('0xc1')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xc1')]['hasMany'](db[_0x14a8('0xc1')],{'as':_0x14a8('0x1b8'),'foreignKey':_0x14a8('0x1bc')});db['VtigerField']['hasMany'](db[_0x14a8('0xc1')],{'as':_0x14a8('0x1be'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xc1')]['belongsTo'](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':_0x14a8('0x1b9')});db[_0x14a8('0xc2')]['hasMany'](db[_0x14a8('0x1c4')],{'as':_0x14a8('0x1b3'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0x1c4')][_0x14a8('0x110')](db['ServicenowField'],{'as':_0x14a8('0x1b5'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x14a8('0x110')](db[_0x14a8('0xc4')],{'as':'Descriptions','foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1c4')][_0x14a8('0x110')](db[_0x14a8('0xc4')],{'as':'Fields','foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0x1c4')][_0x14a8('0x11b')](db[_0x14a8('0xc2')],{'as':_0x14a8('0x169'),'foreignKey':'AccountId'});db[_0x14a8('0xc4')][_0x14a8('0x110')](db[_0x14a8('0xc4')],{'as':'Subject','foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xc4')][_0x14a8('0x110')](db[_0x14a8('0xc4')],{'as':_0x14a8('0x1b8'),'foreignKey':'DescriptionId'});db[_0x14a8('0xc4')]['hasMany'](db[_0x14a8('0xc4')],{'as':_0x14a8('0x1be'),'foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xc4')][_0x14a8('0x11b')](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':'VariableId'});db[_0x14a8('0xc6')][_0x14a8('0x110')](db[_0x14a8('0x1c5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xc6')][_0x14a8('0x11b')](db['CloudProvider'],{'as':_0x14a8('0x104'),'foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x14a8('0x110')](db['Dynamics365Field'],{'as':_0x14a8('0x1b5'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bb')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0x14a8('0x1b6'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1c5')][_0x14a8('0x110')](db[_0x14a8('0xc9')],{'as':_0x14a8('0x1b1'),'onDelete':_0x14a8('0x10e'),'foreignKey':'FieldId'});db[_0x14a8('0x1c5')][_0x14a8('0x11b')](db[_0x14a8('0xc6')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xc9')][_0x14a8('0x110')](db[_0x14a8('0xc9')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xc9')][_0x14a8('0x110')](db[_0x14a8('0xc9')],{'as':_0x14a8('0x1b8'),'foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0xc9')][_0x14a8('0x110')](db['Dynamics365Field'],{'as':'Field','foreignKey':_0x14a8('0x1b7')});db['Dynamics365Field'][_0x14a8('0x11b')](db['Variable'],{'as':_0x14a8('0x8f'),'foreignKey':'VariableId'});db[_0x14a8('0xcb')][_0x14a8('0x110')](db[_0x14a8('0xcc')],{'as':'Configurations','onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1b4')});db[_0x14a8('0xcc')][_0x14a8('0x110')](db[_0x14a8('0x1c6')],{'as':_0x14a8('0x1b5'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0xcc')][_0x14a8('0x110')](db[_0x14a8('0x1c6')],{'as':_0x14a8('0x1b6'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x14a8('0x110')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0xcc')]['belongsTo'](db[_0x14a8('0xcb')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1b4')});db['FreshsalesField'][_0x14a8('0x110')](db[_0x14a8('0x1c6')],{'as':_0x14a8('0x1bd'),'foreignKey':_0x14a8('0x1bb')});db[_0x14a8('0x1c6')][_0x14a8('0x110')](db['FreshsalesField'],{'as':_0x14a8('0x1b8'),'foreignKey':_0x14a8('0x1bc')});db[_0x14a8('0x1c6')]['hasMany'](db[_0x14a8('0x1c6')],{'as':'Field','foreignKey':_0x14a8('0x1b7')});db[_0x14a8('0x1c6')][_0x14a8('0x11b')](db[_0x14a8('0x8f')],{'as':_0x14a8('0x8f'),'foreignKey':_0x14a8('0x1b9')});db[_0x14a8('0x1c7')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{});db[_0x14a8('0x1c7')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db['ChatQueueReport'][_0x14a8('0x11b')](db['ChatInteraction'],{});db[_0x14a8('0x1c7')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0x14a8('0x10c')],{});db[_0x14a8('0x1c7')][_0x14a8('0x11b')](db[_0x14a8('0x184')],{});db[_0x14a8('0xd3')]['belongsTo'](db[_0x14a8('0x10c')],{'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x1c8')});db['ChatInternalMessage'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'onDelete':'cascade','foreignKey':_0x14a8('0x1c9')});db[_0x14a8('0x191')][_0x14a8('0x110')](db[_0x14a8('0x1ca')],{'foreignKey':_0x14a8('0x1cb'),'onDelete':'cascade'});db[_0x14a8('0x191')][_0x14a8('0x110')](db[_0x14a8('0x1cc')],{'foreignKey':_0x14a8('0x1cb'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0xd5')]['belongsTo'](db[_0x14a8('0x4b')],{});db[_0x14a8('0xd5')][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174')});db[_0x14a8('0xd5')]['belongsTo'](db['CmContact'],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0xd5')]['belongsTo'](db[_0x14a8('0x4e')],{});db[_0x14a8('0xd5')]['belongsTo'](db[_0x14a8('0x4f')],{});db[_0x14a8('0xd5')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{});db[_0x14a8('0xd5')][_0x14a8('0x11b')](db[_0x14a8('0x50')],{});db[_0x14a8('0xda')]['hasMany'](db[_0x14a8('0x191')],{'foreignKey':_0x14a8('0x1cd')});db['JscriptyProject']['hasMany'](db[_0x14a8('0x1ca')],{'foreignKey':_0x14a8('0x1cd')});db['JscriptyProject'][_0x14a8('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x14a8('0x1cd')});db[_0x14a8('0x1ce')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x166'),'through':'user_has_square_projects'});db[_0x14a8('0xe4')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':'user_has_teams'});db['Team'][_0x14a8('0x11e')](db[_0x14a8('0x18')],{'through':_0x14a8('0x14b'),'as':_0x14a8('0x1cf')});db[_0x14a8('0xe4')]['belongsToMany'](db[_0x14a8('0x38')],{'through':_0x14a8('0x15f'),'as':'MailQueues'});db['Team'][_0x14a8('0x11e')](db[_0x14a8('0x184')],{'through':'team_has_chat_queues','as':_0x14a8('0x12e')});db['Team'][_0x14a8('0x11e')](db['FaxQueue'],{'through':_0x14a8('0x1d0'),'as':'FaxQueues'});db[_0x14a8('0xe4')][_0x14a8('0x11e')](db[_0x14a8('0x50')],{'through':_0x14a8('0x17a'),'as':_0x14a8('0x131')});db[_0x14a8('0xe4')]['belongsToMany'](db[_0x14a8('0x58')],{'through':_0x14a8('0x181'),'as':'OpenchannelQueues'});db[_0x14a8('0xe4')][_0x14a8('0x11e')](db['WhatsappQueue'],{'through':_0x14a8('0x1d1'),'as':_0x14a8('0x1d2')});db[_0x14a8('0xe4')][_0x14a8('0x11e')](db[_0x14a8('0xf6')],{'through':'TeamVoicePrefix','as':_0x14a8('0x12c')});db[_0x14a8('0x198')][_0x14a8('0x110')](db[_0x14a8('0x69')],{'as':_0x14a8('0x143'),'foreignKey':_0x14a8('0x199')});db[_0x14a8('0x198')][_0x14a8('0x110')](db['CmHopperFinal'],{'as':_0x14a8('0x114'),'foreignKey':_0x14a8('0x199')});db[_0x14a8('0x198')][_0x14a8('0x110')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x14a8('0x199')});db[_0x14a8('0x198')][_0x14a8('0x110')](db[_0x14a8('0x6a')],{'as':_0x14a8('0x145'),'foreignKey':_0x14a8('0x199')});db[_0x14a8('0x198')][_0x14a8('0x11b')](db['Trunk'],{'as':'Trunk','foreignKey':_0x14a8('0x1d3')});db[_0x14a8('0x198')][_0x14a8('0x11b')](db[_0x14a8('0x146')],{'as':'TrunkBackup','foreignKey':_0x14a8('0x1d4')});db[_0x14a8('0x198')]['belongsTo'](db['Interval'],{'as':_0x14a8('0x7d'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x198')][_0x14a8('0x11b')](db[_0x14a8('0x1ce')],{'as':_0x14a8('0x1ce'),'foreignKey':_0x14a8('0x1d5')});db[_0x14a8('0x198')][_0x14a8('0x11e')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x120'),'through':'campaigns_has_cm_lists'});db[_0x14a8('0x198')][_0x14a8('0x11e')](db[_0x14a8('0xf4')],{'as':'BlackLists','through':_0x14a8('0x1d6')});db[_0x14a8('0x167')][_0x14a8('0x11b')](db[_0x14a8('0x61')],{'as':_0x14a8('0x61'),'foreignKey':'ChatOfflineMessageId'});db[_0x14a8('0xec')][_0x14a8('0x11b')](db[_0x14a8('0x160')],{});db[_0x14a8('0xec')][_0x14a8('0x11b')](db['MailInteraction'],{});db[_0x14a8('0xec')][_0x14a8('0x11b')](db[_0x14a8('0x139')],{'foreignKey':'FromMailAccountId','as':_0x14a8('0x1d7')});db['MailTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d8'),'as':'FromAgent'});db['MailTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d9'),'as':_0x14a8('0x1da')});db[_0x14a8('0xec')][_0x14a8('0x11b')](db[_0x14a8('0x38')],{'foreignKey':_0x14a8('0x1db'),'as':_0x14a8('0x1dc')});db['MailTransferReport']['belongsTo'](db[_0x14a8('0x139')],{'foreignKey':'ToMailAccountId','as':_0x14a8('0x1dd')});db[_0x14a8('0xee')]['belongsTo'](db[_0x14a8('0x186')],{});db['ChatTransferReport']['belongsTo'](db['ChatInteraction'],{});db[_0x14a8('0xee')][_0x14a8('0x11b')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x14a8('0x1d7')});db[_0x14a8('0xee')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d8'),'as':'FromAgent'});db[_0x14a8('0xee')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d9'),'as':_0x14a8('0x1da')});db['ChatTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x184')],{'foreignKey':_0x14a8('0x1de'),'as':_0x14a8('0x1dc')});db[_0x14a8('0xee')][_0x14a8('0x11b')](db[_0x14a8('0x5a')],{'foreignKey':_0x14a8('0x1df'),'as':'ToAccount'});db['FaxTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x45')],{});db[_0x14a8('0xf0')][_0x14a8('0x11b')](db[_0x14a8('0x44')],{});db['FaxTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x136')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x14a8('0xf0')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d8'),'as':_0x14a8('0x1e0')});db[_0x14a8('0xf0')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d9'),'as':_0x14a8('0x1da')});db[_0x14a8('0xf0')][_0x14a8('0x11b')](db[_0x14a8('0x47')],{'foreignKey':_0x14a8('0x1e1'),'as':_0x14a8('0x1dc')});db[_0x14a8('0xf0')][_0x14a8('0x11b')](db[_0x14a8('0x136')],{'foreignKey':_0x14a8('0x1e2'),'as':_0x14a8('0x1dd')});db[_0x14a8('0x1e3')][_0x14a8('0x11b')](db[_0x14a8('0x56')],{});db[_0x14a8('0x1e3')][_0x14a8('0x11b')](db[_0x14a8('0x115')],{});db[_0x14a8('0x1e3')][_0x14a8('0x11b')](db[_0x14a8('0x52')],{'foreignKey':_0x14a8('0x1e4'),'as':_0x14a8('0x1d7')});db[_0x14a8('0x1e3')][_0x14a8('0x11b')](db['User'],{'foreignKey':_0x14a8('0x1d8'),'as':_0x14a8('0x1e0')});db['OpenchannelTransferReport']['belongsTo'](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d9'),'as':_0x14a8('0x1da')});db[_0x14a8('0x1e3')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x14a8('0x1e5'),'as':_0x14a8('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0x14a8('0x52')],{'foreignKey':_0x14a8('0x1e6'),'as':_0x14a8('0x1dd')});db[_0x14a8('0x1e7')][_0x14a8('0x11b')](db[_0x14a8('0x4f')],{});db[_0x14a8('0x1e7')]['belongsTo'](db['SmsInteraction'],{});db[_0x14a8('0x1e7')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x14a8('0x1e8'),'as':'FromAccount'});db[_0x14a8('0x1e7')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d8'),'as':'FromAgent'});db['SmsTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d9'),'as':_0x14a8('0x1da')});db['SmsTransferReport'][_0x14a8('0x11b')](db[_0x14a8('0x50')],{'foreignKey':'ToSmsQueueId','as':_0x14a8('0x1dc')});db[_0x14a8('0x1e7')][_0x14a8('0x11b')](db[_0x14a8('0x4b')],{'foreignKey':_0x14a8('0x1e9'),'as':'ToAccount'});db[_0x14a8('0xf4')][_0x14a8('0x110')](db[_0x14a8('0x79')],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x174'),'onDelete':'cascade'});db[_0x14a8('0xf4')][_0x14a8('0x110')](db[_0x14a8('0x72')],{'as':'CustomFields','foreignKey':_0x14a8('0x174')});db[_0x14a8('0xf4')][_0x14a8('0x110')](db[_0x14a8('0x67')],{'as':_0x14a8('0x11f'),'onDelete':_0x14a8('0x10e'),'foreignKey':_0x14a8('0x174')});db['CmList'][_0x14a8('0x110')](db[_0x14a8('0x6c')],{'as':_0x14a8('0x114'),'foreignKey':'ListId'});db[_0x14a8('0xf4')][_0x14a8('0x110')](db[_0x14a8('0x6e')],{'as':_0x14a8('0x1ea'),'foreignKey':_0x14a8('0x174')});db[_0x14a8('0xf4')][_0x14a8('0x110')](db[_0x14a8('0x70')],{'as':'ReportAgentPreview','foreignKey':_0x14a8('0x174')});db['CmList']['belongsToMany'](db[_0x14a8('0x18')],{'as':_0x14a8('0x1eb'),'through':_0x14a8('0x1ec')});db[_0x14a8('0xf4')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':_0x14a8('0x121')});db[_0x14a8('0xf6')][_0x14a8('0x110')](db[_0x14a8('0x13e')],{'as':_0x14a8('0x1ed'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0xf6')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':'UserVoicePrefix'});db[_0x14a8('0xf6')][_0x14a8('0x11e')](db[_0x14a8('0xe4')],{'through':_0x14a8('0x106'),'as':_0x14a8('0x14a')});db['UserProfile'][_0x14a8('0x110')](db['User'],{'as':_0x14a8('0x166'),'foreignKey':_0x14a8('0x11c')});db[_0x14a8('0xf7')][_0x14a8('0x110')](db[_0x14a8('0x1ee')],{'as':_0x14a8('0x1ef'),'foreignKey':_0x14a8('0x11c'),'onDelete':'cascade'});db[_0x14a8('0x1ee')][_0x14a8('0x110')](db[_0x14a8('0xf9')],{'as':'Resources','foreignKey':_0x14a8('0x1f0'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0xfb')]['hasMany'](db[_0x14a8('0x79')],{'as':_0x14a8('0x157'),'foreignKey':_0x14a8('0x1f1'),'onDelete':_0x14a8('0x10e')});db[_0x14a8('0xfb')][_0x14a8('0x110')](db['CannedAnswer'],{'as':_0x14a8('0x158'),'foreignKey':_0x14a8('0x1f1')});db[_0x14a8('0xfb')]['hasMany'](db[_0x14a8('0xfe')],{'as':_0x14a8('0x159'),'foreignKey':_0x14a8('0x1f1')});db[_0x14a8('0xfb')][_0x14a8('0x110')](db[_0x14a8('0x118')],{'as':_0x14a8('0x17c')});db[_0x14a8('0xfb')][_0x14a8('0x110')](db[_0x14a8('0x1f2')],{'as':_0x14a8('0x140')});db['WhatsappAccount'][_0x14a8('0x11b')](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':_0x14a8('0x174')});db[_0x14a8('0xfb')][_0x14a8('0x11b')](db[_0x14a8('0x148')],{'as':_0x14a8('0x15d'),'foreignKey':_0x14a8('0x16f')});db[_0x14a8('0xfb')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x149'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x1f2')]['belongsTo'](db[_0x14a8('0x133')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x1f2')][_0x14a8('0x11b')](db[_0x14a8('0xfb')],{'onDelete':_0x14a8('0x154')});db[_0x14a8('0x1f2')][_0x14a8('0x11b')](db[_0x14a8('0x7d')],{'onDelete':_0x14a8('0x154'),'foreignKey':_0x14a8('0x147')});db[_0x14a8('0x1f2')]['belongsTo'](db[_0x14a8('0x87')],{'onDelete':_0x14a8('0x154'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x14a8('0x110')](db[_0x14a8('0xfe')],{'as':_0x14a8('0x159'),'onDelete':_0x14a8('0x10e'),'foreignKey':'WhatsappInteractionId'});db[_0x14a8('0x118')][_0x14a8('0x11b')](db[_0x14a8('0xfb')],{'as':'Account','foreignKey':_0x14a8('0x1f1')});db['WhatsappInteraction'][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db['WhatsappInteraction'][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x162'),'foreignKey':'UserId'});db[_0x14a8('0x118')][_0x14a8('0x11e')](db[_0x14a8('0x87')],{'through':_0x14a8('0x1a9'),'as':_0x14a8('0x163')});db[_0x14a8('0x118')][_0x14a8('0x11e')](db['Tag'],{'through':_0x14a8('0x1a9'),'as':'ThroughTags'});db[_0x14a8('0x118')][_0x14a8('0x11e')](db[_0x14a8('0x10c')],{'as':_0x14a8('0x166'),'through':_0x14a8('0x12b'),'foreignKey':_0x14a8('0x1f3')});db['WhatsappMessage'][_0x14a8('0x11b')](db['User'],{'as':_0x14a8('0x10c')});db[_0x14a8('0xfe')][_0x14a8('0x11b')](db['CmContact'],{'onDelete':_0x14a8('0x10e'),'as':_0x14a8('0x151')});db[_0x14a8('0xfe')][_0x14a8('0x11b')](db[_0x14a8('0x118')],{'onDelete':_0x14a8('0x10e'),'as':'Interaction','foreignKey':_0x14a8('0x1f3')});db['WhatsappMessage'][_0x14a8('0x11b')](db[_0x14a8('0xfb')],{'as':_0x14a8('0x169'),'foreignKey':_0x14a8('0x1f1')});db['WhatsappQueueReport'][_0x14a8('0x11b')](db[_0x14a8('0xfb')],{});db[_0x14a8('0x100')]['belongsTo'](db[_0x14a8('0xf4')],{'as':_0x14a8('0x15b'),'foreignKey':'ListId'});db[_0x14a8('0x100')][_0x14a8('0x11b')](db[_0x14a8('0x67')],{'as':_0x14a8('0x151'),'foreignKey':_0x14a8('0x152')});db[_0x14a8('0x100')][_0x14a8('0x11b')](db[_0x14a8('0x118')],{});db[_0x14a8('0x100')]['belongsTo'](db[_0x14a8('0x133')],{});db[_0x14a8('0x100')][_0x14a8('0x11b')](db['WhatsappMessage'],{});db[_0x14a8('0x100')]['belongsTo'](db['User'],{});db[_0x14a8('0x101')][_0x14a8('0x11b')](db[_0x14a8('0xfe')],{});db[_0x14a8('0x101')][_0x14a8('0x11b')](db[_0x14a8('0x118')],{});db[_0x14a8('0x101')][_0x14a8('0x11b')](db['WhatsappAccount'],{'foreignKey':_0x14a8('0x1f4'),'as':_0x14a8('0x1d7')});db[_0x14a8('0x101')]['belongsTo'](db[_0x14a8('0xfb')],{'foreignKey':'ToWhatsappAccountId','as':_0x14a8('0x1dd')});db[_0x14a8('0x101')]['belongsTo'](db[_0x14a8('0x133')],{'foreignKey':_0x14a8('0x1f5'),'as':_0x14a8('0x1dc')});db[_0x14a8('0x101')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'foreignKey':_0x14a8('0x1d8'),'as':_0x14a8('0x1e0')});db[_0x14a8('0x101')][_0x14a8('0x11b')](db['User'],{'foreignKey':_0x14a8('0x1d9'),'as':'ToAgent'});db['WhatsappQueue'][_0x14a8('0x11e')](db['User'],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x14a8('0x1f6')});db[_0x14a8('0x133')][_0x14a8('0x11e')](db[_0x14a8('0xe4')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x14a8('0x10a')][_0x14a8('0x11b')](db[_0x14a8('0x10c')],{'as':'user','foreignKey':_0x14a8('0x10f'),'onDelete':_0x14a8('0x10e'),'hooks':!![]});db[_0x14a8('0x104')][_0x14a8('0x10d')](db[_0x14a8('0xc6')],{'as':_0x14a8('0xc6'),'onDelete':'restrict'});db[_0x14a8('0x104')][_0x14a8('0x10d')](db[_0x14a8('0x34')],{'as':_0x14a8('0x155'),'onDelete':_0x14a8('0x154')});db['CloudProvider'][_0x14a8('0x10d')](db[_0x14a8('0x36')],{'as':_0x14a8('0x156'),'onDelete':_0x14a8('0x154')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 66ba2cd..bb0918e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a2=['./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./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/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/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','/www','/demo','root','snippet','3.0.0','/plugins','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x91a2,0x67));var _0x291a=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0x91a2[_0x548200];return _0x1a6d74;};'use strict';var path=require(_0x291a('0x0'));var express=require(_0x291a('0x1'));var errors=require(_0x291a('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x291a('0x3'))[_0x291a('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x291a('0x5')]=function(_0x3c8e19){return setupLoggers(_0x3c8e19)[_0x291a('0x6')](function(){_0x3c8e19[_0x291a('0x7')]('/api/users',require('./api/user'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x8'),require(_0x291a('0x9')));_0x3c8e19['use'](_0x291a('0xa'),require(_0x291a('0xb')));_0x3c8e19['use']('/api/voice/extensions',require(_0x291a('0xc')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xd'),require('./api/voiceMusicOnHold'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xe'),require(_0x291a('0xf')));_0x3c8e19['use'](_0x291a('0x10'),require(_0x291a('0x11')));_0x3c8e19['use'](_0x291a('0x12'),require(_0x291a('0x13')));_0x3c8e19['use'](_0x291a('0x14'),require(_0x291a('0x15')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x16'),require(_0x291a('0x17')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x18'),require('./api/voiceCallReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x19'),require(_0x291a('0x1a')));_0x3c8e19[_0x291a('0x7')]('/api/voice/agents/reports',require(_0x291a('0x1b')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x1c'),require(_0x291a('0x1d')));_0x3c8e19['use'](_0x291a('0x1e'),require('./api/memberReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x1f'),require(_0x291a('0x20')));_0x3c8e19['use'](_0x291a('0x21'),require(_0x291a('0x22')));_0x3c8e19[_0x291a('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x23'),require(_0x291a('0x24')));_0x3c8e19[_0x291a('0x7')]('/api/mail/queues',require('./api/mailQueue'));_0x3c8e19['use'](_0x291a('0x25'),require(_0x291a('0x26')));_0x3c8e19[_0x291a('0x7')]('/api/mail/interactions',require(_0x291a('0x27')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x28'),require(_0x291a('0x29')));_0x3c8e19[_0x291a('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x3c8e19['use'](_0x291a('0x2a'),require(_0x291a('0x2b')));_0x3c8e19['use'](_0x291a('0x2c'),require(_0x291a('0x2d')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x2e'),require(_0x291a('0x2f')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x30'),require(_0x291a('0x31')));_0x3c8e19['use'](_0x291a('0x32'),require(_0x291a('0x33')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x34'),require(_0x291a('0x35')));_0x3c8e19[_0x291a('0x7')]('/api/fax/messages',require('./api/faxMessage'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x36'),require('./api/faxQueue'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x37'),require('./api/faxQueueReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x38'),require(_0x291a('0x39')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x3a'),require(_0x291a('0x3b')));_0x3c8e19['use'](_0x291a('0x3c'),require(_0x291a('0x3d')));_0x3c8e19[_0x291a('0x7')]('/api/sms/messages',require(_0x291a('0x3e')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x3f'),require(_0x291a('0x40')));_0x3c8e19[_0x291a('0x7')]('/api/openchannel/accounts',require(_0x291a('0x41')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x42'),require(_0x291a('0x43')));_0x3c8e19['use']('/api/openchannel/interactions',require(_0x291a('0x44')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x45'),require(_0x291a('0x46')));_0x3c8e19['use'](_0x291a('0x47'),require(_0x291a('0x48')));_0x3c8e19[_0x291a('0x7')]('/api/chat/websites',require('./api/chatWebsite'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x49'),require(_0x291a('0x4a')));_0x3c8e19[_0x291a('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x3c8e19['use']('/api/chat/interactions',require(_0x291a('0x4b')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x4c'),require('./api/chatMessage'));_0x3c8e19['use'](_0x291a('0x4d'),require(_0x291a('0x4e')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x4f'),require('./api/chatQueue'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x50'),require('./api/chatGroup'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x51'),require(_0x291a('0x52')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x53'),require(_0x291a('0x54')));_0x3c8e19['use'](_0x291a('0x55'),require(_0x291a('0x56')));_0x3c8e19['use'](_0x291a('0x57'),require('./api/cmHopper'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x58'),require(_0x291a('0x59')));_0x3c8e19[_0x291a('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x5a'),require(_0x291a('0x5b')));_0x3c8e19['use'](_0x291a('0x5c'),require(_0x291a('0x5d')));_0x3c8e19['use']('/api/actions',require(_0x291a('0x5e')));_0x3c8e19['use'](_0x291a('0x5f'),require(_0x291a('0x60')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x61'),require(_0x291a('0x62')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x63'),require(_0x291a('0x64')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x65'),require(_0x291a('0x66')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x67'),require(_0x291a('0x68')));_0x3c8e19['use']('/api/pauses',require('./api/pause'));_0x3c8e19[_0x291a('0x7')]('/api/cdr',require(_0x291a('0x69')));_0x3c8e19['use'](_0x291a('0x6a'),require(_0x291a('0x6b')));_0x3c8e19[_0x291a('0x7')]('/api/schedules',require(_0x291a('0x6c')));_0x3c8e19['use'](_0x291a('0x6d'),require(_0x291a('0x6e')));_0x3c8e19['use'](_0x291a('0x6f'),require(_0x291a('0x70')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x71'),require(_0x291a('0x72')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x73'),require('./api/cmContactHasItem'));_0x3c8e19[_0x291a('0x7')]('/api/cm_hopper_additional_phones',require(_0x291a('0x74')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x75'),require('./api/template'));_0x3c8e19['use']('/api/triggers',require('./api/trigger'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x76'),require(_0x291a('0x77')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x78'),require(_0x291a('0x79')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x7a'),require('./api/integrationReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x7b'),require(_0x291a('0x7c')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x7d'),require(_0x291a('0x7e')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x7f'),require(_0x291a('0x80')));_0x3c8e19['use'](_0x291a('0x81'),require('./api/analyticMetric'));_0x3c8e19['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x3c8e19[_0x291a('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x82'),require(_0x291a('0x83')));_0x3c8e19[_0x291a('0x7')]('/api/integrations/salesforce/configurations',require(_0x291a('0x84')));_0x3c8e19['use'](_0x291a('0x85'),require(_0x291a('0x86')));_0x3c8e19['use'](_0x291a('0x87'),require('./api/intSugarcrmAccount'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x88'),require(_0x291a('0x89')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x8a'),require('./api/intSugarcrmField'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x8b'),require('./api/intDeskAccount'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x8c'),require(_0x291a('0x8d')));_0x3c8e19['use'](_0x291a('0x8e'),require(_0x291a('0x8f')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x90'),require('./api/intZohoAccount'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x91'),require('./api/intZohoConfiguration'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x92'),require(_0x291a('0x93')));_0x3c8e19[_0x291a('0x7')]('/api/integrations/zendesk/accounts',require(_0x291a('0x94')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x95'),require(_0x291a('0x96')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x97'),require('./api/intZendeskField'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x98'),require(_0x291a('0x99')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x9a'),require(_0x291a('0x9b')));_0x3c8e19['use']('/api/integrations/freshdesk/fields',require(_0x291a('0x9c')));_0x3c8e19[_0x291a('0x7')](_0x291a('0x9d'),require('./api/intVtigerAccount'));_0x3c8e19[_0x291a('0x7')](_0x291a('0x9e'),require(_0x291a('0x9f')));_0x3c8e19[_0x291a('0x7')]('/api/integrations/vtiger/fields',require(_0x291a('0xa0')));_0x3c8e19[_0x291a('0x7')]('/api/integrations/servicenow/accounts',require(_0x291a('0xa1')));_0x3c8e19['use'](_0x291a('0xa2'),require('./api/intServicenowConfiguration'));_0x3c8e19[_0x291a('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xa3'),require(_0x291a('0xa4')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xa5'),require('./api/intDynamics365Configuration'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xa6'),require(_0x291a('0xa7')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xa8'),require(_0x291a('0xa9')));_0x3c8e19['use'](_0x291a('0xaa'),require('./api/intFreshsalesConfiguration'));_0x3c8e19['use'](_0x291a('0xab'),require(_0x291a('0xac')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xad'),require(_0x291a('0xae')));_0x3c8e19['use'](_0x291a('0xaf'),require(_0x291a('0xb0')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xb1'),require(_0x291a('0xb2')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xb3'),require(_0x291a('0xb4')));_0x3c8e19[_0x291a('0x7')]('/api/jscripty/questions/reports',require(_0x291a('0xb5')));_0x3c8e19['use'](_0x291a('0xb6'),require(_0x291a('0xb7')));_0x3c8e19['use']('/api/sms/reports/queue',require(_0x291a('0xb8')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xb9'),require(_0x291a('0xba')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xbb'),require(_0x291a('0xbc')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xbd'),require(_0x291a('0xbe')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xbf'),require(_0x291a('0xc0')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xc1'),require(_0x291a('0xc2')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xc3'),require(_0x291a('0xc4')));_0x3c8e19[_0x291a('0x7')]('/api/square/recordings',require(_0x291a('0xc5')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xc6'),require('./api/squareMessage'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xc7'),require(_0x291a('0xc8')));_0x3c8e19['use'](_0x291a('0xc9'),require(_0x291a('0xca')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xcb'),require(_0x291a('0xcc')));_0x3c8e19['use'](_0x291a('0xcd'),require(_0x291a('0xce')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xcf'),require(_0x291a('0xd0')));_0x3c8e19['use'](_0x291a('0xd1'),require(_0x291a('0xd2')));_0x3c8e19['use'](_0x291a('0xd3'),require(_0x291a('0xd4')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xd5'),require(_0x291a('0xd6')));_0x3c8e19['use']('/api/fax/reports/transfer',require(_0x291a('0xd7')));_0x3c8e19['use'](_0x291a('0xd8'),require('./api/openchannelTransferReport'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xd9'),require(_0x291a('0xda')));_0x3c8e19['use'](_0x291a('0xdb'),require(_0x291a('0xdc')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xdd'),require(_0x291a('0xde')));_0x3c8e19['use'](_0x291a('0xdf'),require('./api/userProfile'));_0x3c8e19['use'](_0x291a('0xe0'),require(_0x291a('0xe1')));_0x3c8e19[_0x291a('0x7')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xe2'),require(_0x291a('0xe3')));_0x3c8e19[_0x291a('0x7')]('/api/whatsapp/accounts',require(_0x291a('0xe4')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xe5'),require(_0x291a('0xe6')));_0x3c8e19['use'](_0x291a('0xe7'),require(_0x291a('0xe8')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xe9'),require('./api/whatsappMessage'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xea'),require(_0x291a('0xeb')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xec'),require('./api/whatsappTransferReport'));_0x3c8e19['use'](_0x291a('0xed'),require(_0x291a('0xee')));_0x3c8e19[_0x291a('0x7')]('/api/cloudProviders',require(_0x291a('0xef')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xf0'),require('./api/realtime'));_0x3c8e19[_0x291a('0x7')](_0x291a('0xf1'),require(_0x291a('0xf2')));_0x3c8e19[_0x291a('0x7')]('/api/auth/local',require(_0x291a('0xf3')));_0x3c8e19['use']('/api/auth/google',require(_0x291a('0xf4')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xf5'),require(_0x291a('0xf6')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xf7'),require(_0x291a('0xf8')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xf9'),require('./api/rpc'));_0x3c8e19['use'](_0x291a('0xfa'),require(_0x291a('0xfb')));_0x3c8e19[_0x291a('0x7')](_0x291a('0xfc'),require(_0x291a('0xfd')));_0x3c8e19['use']('/api/pm2',require(_0x291a('0xfe')));_0x3c8e19['use'](_0x291a('0xff'),require('./api/webbar'));_0x3c8e19[_0x291a('0x7')]('/api/logs',clientSideLogs);_0x3c8e19[_0x291a('0x7')](_0x291a('0x100'),express[_0x291a('0x101')](path[_0x291a('0x102')](config['root'],_0x291a('0x100'))));_0x3c8e19['use'](_0x291a('0x103'),express[_0x291a('0x101')](path['join'](config['root'],_0x291a('0x103'))));_0x3c8e19[_0x291a('0x7')](_0x291a('0x104'),express[_0x291a('0x101')](path[_0x291a('0x102')](config[_0x291a('0x105')],_0x291a('0x104'))));_0x3c8e19[_0x291a('0x7')]('/snippet',express[_0x291a('0x101')](path['join'](config[_0x291a('0x105')],_0x291a('0x106'),_0x291a('0x107'))));_0x3c8e19[_0x291a('0x7')](_0x291a('0x108'),express[_0x291a('0x101')](path[_0x291a('0x102')](config[_0x291a('0x105')],'/server/files/plugins')));_0x3c8e19['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x291a('0x109')](errors[0x194]);_0x3c8e19['route']('/*')[_0x291a('0x109')](function(_0x26dcc3,_0x1d919e){_0x1d919e[_0x291a('0x10a')](path[_0x291a('0x10b')](_0x3c8e19[_0x291a('0x109')](_0x291a('0x10c'))+_0x291a('0x10d')));});return _0x3c8e19;});}; \ No newline at end of file +var _0x6a7e=['./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','/api/contact_item_types','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','appPath','/index.html','express','./config/environment','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceAgentReport','/api/members/reports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a7e,0xf0));var _0xe6a7=function(_0x2fd806,_0x4cc0de){_0x2fd806=_0x2fd806-0x0;var _0xd7da23=_0x6a7e[_0x2fd806];return _0xd7da23;};'use strict';var path=require('path');var express=require(_0xe6a7('0x0'));var errors=require('./errors');var config=require(_0xe6a7('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0xe6a7('0x2')];var clientSideLogs=require(_0xe6a7('0x3'));exports[_0xe6a7('0x4')]=function(_0x3eb560){return setupLoggers(_0x3eb560)[_0xe6a7('0x5')](function(){_0x3eb560['use'](_0xe6a7('0x6'),require(_0xe6a7('0x7')));_0x3eb560['use'](_0xe6a7('0x8'),require(_0xe6a7('0x9')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xb'),require('./api/voiceContext'));_0x3eb560[_0xe6a7('0xa')]('/api/voice/extensions',require(_0xe6a7('0xc')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xd'),require(_0xe6a7('0xe')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf'),require('./api/voiceQueue'));_0x3eb560['use'](_0xe6a7('0x10'),require(_0xe6a7('0x11')));_0x3eb560[_0xe6a7('0xa')]('/api/screen/recordings',require(_0xe6a7('0x12')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x13'),require(_0xe6a7('0x14')));_0x3eb560['use'](_0xe6a7('0x15'),require(_0xe6a7('0x16')));_0x3eb560[_0xe6a7('0xa')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x17'),require('./api/voiceDialReport'));_0x3eb560['use']('/api/voice/agents/reports',require(_0xe6a7('0x18')));_0x3eb560[_0xe6a7('0xa')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x19'),require(_0xe6a7('0x1a')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x1b'),require('./api/trunk'));_0x3eb560[_0xe6a7('0xa')]('/api/voice/transfers/reports',require(_0xe6a7('0x1c')));_0x3eb560['use'](_0xe6a7('0x1d'),require(_0xe6a7('0x1e')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x1f'),require(_0xe6a7('0x20')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x21'),require('./api/mailQueue'));_0x3eb560['use'](_0xe6a7('0x22'),require(_0xe6a7('0x23')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x24'),require(_0xe6a7('0x25')));_0x3eb560['use'](_0xe6a7('0x26'),require('./api/mailMessage'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x27'),require('./api/mailApplication'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x28'),require(_0xe6a7('0x29')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x2a'),require('./api/dashboard'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x2b'),require(_0xe6a7('0x2c')));_0x3eb560[_0xe6a7('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x2d'),require('./api/faxApplication'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x2e'),require('./api/faxInteraction'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x2f'),require(_0xe6a7('0x30')));_0x3eb560[_0xe6a7('0xa')]('/api/fax/queues',require('./api/faxQueue'));_0x3eb560[_0xe6a7('0xa')]('/api/fax/reports/queue',require(_0xe6a7('0x31')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x32'),require(_0xe6a7('0x33')));_0x3eb560[_0xe6a7('0xa')]('/api/sms/applications',require(_0xe6a7('0x34')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x35'),require('./api/smsInteraction'));_0x3eb560['use'](_0xe6a7('0x36'),require(_0xe6a7('0x37')));_0x3eb560[_0xe6a7('0xa')]('/api/sms/queues',require(_0xe6a7('0x38')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x39'),require('./api/openchannelAccount'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x3a'),require(_0xe6a7('0x3b')));_0x3eb560['use'](_0xe6a7('0x3c'),require('./api/openchannelInteraction'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x3d'),require(_0xe6a7('0x3e')));_0x3eb560['use']('/api/openchannel/queues',require(_0xe6a7('0x3f')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x40'),require(_0xe6a7('0x41')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x42'),require('./api/openchannelQueueReport'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x43'),require(_0xe6a7('0x44')));_0x3eb560['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x45'),require(_0xe6a7('0x46')));_0x3eb560['use'](_0xe6a7('0x47'),require(_0xe6a7('0x48')));_0x3eb560['use'](_0xe6a7('0x49'),require(_0xe6a7('0x4a')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x4b'),require('./api/chatGroup'));_0x3eb560['use'](_0xe6a7('0x4c'),require(_0xe6a7('0x4d')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x4e'),require('./api/cmCompany'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x4f'),require('./api/cmContact'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x50'),require(_0xe6a7('0x51')));_0x3eb560['use']('/api/cm/hopper_black',require(_0xe6a7('0x52')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x53'),require('./api/cmHopperFinal'));_0x3eb560[_0xe6a7('0xa')]('/api/cm/hopper_history',require(_0xe6a7('0x54')));_0x3eb560[_0xe6a7('0xa')]('/api/cm/custom_fields',require(_0xe6a7('0x55')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x56'),require(_0xe6a7('0x57')));_0x3eb560['use'](_0xe6a7('0x58'),require(_0xe6a7('0x59')));_0x3eb560['use'](_0xe6a7('0x5a'),require(_0xe6a7('0x5b')));_0x3eb560['use']('/api/dispositions',require(_0xe6a7('0x5c')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x5d'),require(_0xe6a7('0x5e')));_0x3eb560[_0xe6a7('0xa')]('/api/intervals',require(_0xe6a7('0x5f')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x60'),require(_0xe6a7('0x61')));_0x3eb560[_0xe6a7('0xa')]('/api/cdr',require(_0xe6a7('0x62')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x63'),require(_0xe6a7('0x64')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x65'),require('./api/schedule'));_0x3eb560['use'](_0xe6a7('0x66'),require('./api/sound'));_0x3eb560['use'](_0xe6a7('0x67'),require('./api/tag'));_0x3eb560['use'](_0xe6a7('0x68'),require('./api/contactItemType'));_0x3eb560['use']('/api/cm_contact_has_items',require(_0xe6a7('0x69')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x6a'),require(_0xe6a7('0x6b')));_0x3eb560['use']('/api/templates',require(_0xe6a7('0x6c')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x6d'),require('./api/trigger'));_0x3eb560['use'](_0xe6a7('0x6e'),require('./api/variable'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x6f'),require(_0xe6a7('0x70')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x71'),require(_0xe6a7('0x72')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x73'),require(_0xe6a7('0x74')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x75'),require(_0xe6a7('0x76')));_0x3eb560[_0xe6a7('0xa')]('/api/analytics/extracted_reports',require(_0xe6a7('0x77')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x78'),require(_0xe6a7('0x79')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x7a'),require(_0xe6a7('0x7b')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x7c'),require(_0xe6a7('0x7d')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x7e'),require(_0xe6a7('0x7f')));_0x3eb560[_0xe6a7('0xa')]('/api/integrations/salesforce/configurations',require(_0xe6a7('0x80')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x81'),require(_0xe6a7('0x82')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x83'),require('./api/intSugarcrmAccount'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x84'),require(_0xe6a7('0x85')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x86'),require(_0xe6a7('0x87')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x88'),require(_0xe6a7('0x89')));_0x3eb560[_0xe6a7('0xa')]('/api/integrations/desk/configurations',require(_0xe6a7('0x8a')));_0x3eb560[_0xe6a7('0xa')]('/api/integrations/desk/fields',require(_0xe6a7('0x8b')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x8c'),require(_0xe6a7('0x8d')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x8e'),require('./api/intZohoConfiguration'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x8f'),require(_0xe6a7('0x90')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x91'),require('./api/intZendeskAccount'));_0x3eb560['use']('/api/integrations/zendesk/configurations',require(_0xe6a7('0x92')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x93'),require(_0xe6a7('0x94')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x95'),require(_0xe6a7('0x96')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x97'),require(_0xe6a7('0x98')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x99'),require(_0xe6a7('0x9a')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x9b'),require(_0xe6a7('0x9c')));_0x3eb560['use'](_0xe6a7('0x9d'),require(_0xe6a7('0x9e')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x9f'),require(_0xe6a7('0xa0')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xa1'),require(_0xe6a7('0xa2')));_0x3eb560[_0xe6a7('0xa')]('/api/integrations/servicenow/configurations',require(_0xe6a7('0xa3')));_0x3eb560['use'](_0xe6a7('0xa4'),require(_0xe6a7('0xa5')));_0x3eb560['use'](_0xe6a7('0xa6'),require('./api/intDynamics365Account'));_0x3eb560['use'](_0xe6a7('0xa7'),require('./api/intDynamics365Configuration'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xa8'),require(_0xe6a7('0xa9')));_0x3eb560['use']('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xaa'),require('./api/intFreshsalesConfiguration'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xab'),require('./api/intFreshsalesField'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xac'),require(_0xe6a7('0xad')));_0x3eb560['use'](_0xe6a7('0xae'),require(_0xe6a7('0xaf')));_0x3eb560['use'](_0xe6a7('0xb0'),require(_0xe6a7('0xb1')));_0x3eb560[_0xe6a7('0xa')]('/api/jscripty/answers/reports',require(_0xe6a7('0xb2')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xb3'),require(_0xe6a7('0xb4')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xb5'),require(_0xe6a7('0xb6')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xb7'),require(_0xe6a7('0xb8')));_0x3eb560[_0xe6a7('0xa')]('/api/square/reports',require(_0xe6a7('0xb9')));_0x3eb560['use'](_0xe6a7('0xba'),require(_0xe6a7('0xbb')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xbc'),require(_0xe6a7('0xbd')));_0x3eb560['use'](_0xe6a7('0xbe'),require(_0xe6a7('0xbf')));_0x3eb560[_0xe6a7('0xa')]('/api/square/odbc',require(_0xe6a7('0xc0')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xc1'),require(_0xe6a7('0xc2')));_0x3eb560[_0xe6a7('0xa')]('/api/square/recordings',require(_0xe6a7('0xc3')));_0x3eb560['use'](_0xe6a7('0xc4'),require(_0xe6a7('0xc5')));_0x3eb560[_0xe6a7('0xa')]('/api/teams',require('./api/team'));_0x3eb560['use'](_0xe6a7('0xc6'),require(_0xe6a7('0xc7')));_0x3eb560['use'](_0xe6a7('0xc8'),require(_0xe6a7('0xc9')));_0x3eb560[_0xe6a7('0xa')]('/api/migrations',require(_0xe6a7('0xca')));_0x3eb560[_0xe6a7('0xa')]('/api/attachments',require(_0xe6a7('0xcb')));_0x3eb560[_0xe6a7('0xa')]('/api/plugins',require(_0xe6a7('0xcc')));_0x3eb560['use'](_0xe6a7('0xcd'),require(_0xe6a7('0xce')));_0x3eb560[_0xe6a7('0xa')]('/api/chat/reports/transfer',require(_0xe6a7('0xcf')));_0x3eb560[_0xe6a7('0xa')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xd0'),require(_0xe6a7('0xd1')));_0x3eb560['use'](_0xe6a7('0xd2'),require(_0xe6a7('0xd3')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xd4'),require(_0xe6a7('0xd5')));_0x3eb560[_0xe6a7('0xa')]('/api/voice/prefixes',require(_0xe6a7('0xd6')));_0x3eb560['use'](_0xe6a7('0xd7'),require(_0xe6a7('0xd8')));_0x3eb560[_0xe6a7('0xa')]('/api/userProfile/sections',require(_0xe6a7('0xd9')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xda'),require(_0xe6a7('0xdb')));_0x3eb560['use'](_0xe6a7('0xdc'),require('./api/userNotification'));_0x3eb560[_0xe6a7('0xa')]('/api/whatsapp/accounts',require(_0xe6a7('0xdd')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xde'),require('./api/whatsappApplication'));_0x3eb560[_0xe6a7('0xa')]('/api/whatsapp/interactions',require(_0xe6a7('0xdf')));_0x3eb560[_0xe6a7('0xa')]('/api/whatsapp/messages',require(_0xe6a7('0xe0')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xe1'),require(_0xe6a7('0xe2')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xe3'),require(_0xe6a7('0xe4')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xe5'),require(_0xe6a7('0xe6')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xe7'),require(_0xe6a7('0xe8')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xe9'),require(_0xe6a7('0xea')));_0x3eb560['use'](_0xe6a7('0xeb'),require(_0xe6a7('0xec')));_0x3eb560['use'](_0xe6a7('0xed'),require('./api/authLocal'));_0x3eb560['use'](_0xe6a7('0xee'),require(_0xe6a7('0xef')));_0x3eb560['use']('/api/auth/activedirectory',require(_0xe6a7('0xf0')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf1'),require('./api/jira'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf2'),require('./api/rpc'));_0x3eb560['use'](_0xe6a7('0xf3'),require(_0xe6a7('0xf4')));_0x3eb560[_0xe6a7('0xa')]('/api/system',require(_0xe6a7('0xf5')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf6'),require('./api/pm2'));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf7'),require(_0xe6a7('0xf8')));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xf9'),clientSideLogs);_0x3eb560[_0xe6a7('0xa')]('/apidoc',express[_0xe6a7('0xfa')](path[_0xe6a7('0xfb')](config['root'],_0xe6a7('0xfc'))));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xfd'),express[_0xe6a7('0xfa')](path[_0xe6a7('0xfb')](config[_0xe6a7('0xfe')],_0xe6a7('0xfd'))));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0xff'),express[_0xe6a7('0xfa')](path[_0xe6a7('0xfb')](config[_0xe6a7('0xfe')],_0xe6a7('0xff'))));_0x3eb560[_0xe6a7('0xa')]('/snippet',express[_0xe6a7('0xfa')](path['join'](config[_0xe6a7('0xfe')],_0xe6a7('0x100'),_0xe6a7('0x101'))));_0x3eb560[_0xe6a7('0xa')](_0xe6a7('0x102'),express[_0xe6a7('0xfa')](path[_0xe6a7('0xfb')](config[_0xe6a7('0xfe')],_0xe6a7('0x103'))));_0x3eb560[_0xe6a7('0x104')](_0xe6a7('0x105'))['get'](errors[0x194]);_0x3eb560[_0xe6a7('0x104')]('/*')['get'](function(_0x2f70f5,_0x1c657e){_0x1c657e[_0xe6a7('0x106')](path[_0xe6a7('0x107')](_0x3eb560['get'](_0xe6a7('0x108'))+_0xe6a7('0x109')));});return _0x3eb560;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a9bac46..42e58dd 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0212=['../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.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/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','log','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/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/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc'];(function(_0x3dff64,_0x30cb82){var _0x535891=function(_0x391f8d){while(--_0x391f8d){_0x3dff64['push'](_0x3dff64['shift']());}};_0x535891(++_0x30cb82);}(_0x0212,0x170));var _0x2021=function(_0x855caa,_0x5624fa){_0x855caa=_0x855caa-0x0;var _0x25488a=_0x0212[_0x855caa];return _0x25488a;};'use strict';var jayson=require(_0x2021('0x0'));var _=require('lodash');var config=require(_0x2021('0x1'));exports[_0x2021('0x2')]=function(){return new Promise(function(_0x5ae032,_0x3654b7){var _0x2f3ac1={};_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x4')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x5')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x6')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x7')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x8')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x9')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0xa')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0xb')));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/memberReport/memberReport.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/trunk/trunk.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0xc')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0xd')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0xe')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0xf')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/mailQueue/mailQueue.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x10')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x11')));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/mailApplication/mailApplication.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x12')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x13')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x14')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/faxInteraction/faxInteraction.rpc'));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x15')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x16')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x17')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x18')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x19')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x1a')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x1b')));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x1c')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x1d')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x1e')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x1f')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x20')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x21')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x22')));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/cmContact/cmContact.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x23')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x24')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x25')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x26')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/pause/pause.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/sound/sound.rpc'));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x27')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x28')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x29')));_0x2f3ac1=_['merge'](_0x2f3ac1,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x2a')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x2b')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x2c')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x2d')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x2e')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x2f')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x30')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x31')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x32')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x33')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x34')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x35')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/setting/setting.rpc'));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x36')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x37')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x38')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/squareMessage/squareMessage.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x39')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x3a')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require('../api/plugin/plugin.rpc'));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x3b')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x3c')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x3d')));_0x2f3ac1=_['merge'](_0x2f3ac1,require(_0x2021('0x3e')));_0x2f3ac1=_[_0x2021('0x3')](_0x2f3ac1,require(_0x2021('0x3f')));var _0x5af82f=jayson['server'](_0x2f3ac1)[_0x2021('0x40')]();var _0x1a3674=config[_0x2021('0x41')][_0x2021('0x42')]||config[_0x2021('0x42')]+0x1;var _0xae221e=config[_0x2021('0x41')]['ip']||_0x2021('0x43');_0x5af82f['on']('error',function(_0x3de2e5){return _0x3654b7(_0x3de2e5);});_0x5af82f['listen'](_0x1a3674,_0xae221e,function(){console[_0x2021('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xae221e,_0x1a3674);require('../config/triggers')['default']();return _0x5ae032('RPC\x20listening\x20on\x20'+_0xae221e+':'+_0x1a3674);});});}; \ No newline at end of file +var _0x70ff=['../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.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/faxQueueReport/faxQueueReport.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/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x34fc38,_0x7b624f){var _0x9d7d84=function(_0x569eb8){while(--_0x569eb8){_0x34fc38['push'](_0x34fc38['shift']());}};_0x9d7d84(++_0x7b624f);}(_0x70ff,0x1ce));var _0xf70f=function(_0x179c0c,_0x20fe42){_0x179c0c=_0x179c0c-0x0;var _0x2ab663=_0x70ff[_0x179c0c];return _0x2ab663;};'use strict';var jayson=require(_0xf70f('0x0'));var _=require(_0xf70f('0x1'));var config=require(_0xf70f('0x2'));exports[_0xf70f('0x3')]=function(){return new Promise(function(_0x2498d6,_0x2b7a2e){var _0x28c4ed={};_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x5')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x6')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x7')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x8')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x9')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0xa')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0xb')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/trunk/trunk.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0xc')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/mailServerIn/mailServerIn.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/mailAccount/mailAccount.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0xd')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0xe')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0xf')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x10')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x11')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/faxAccount/faxAccount.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x12')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/faxInteraction/faxInteraction.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/faxMessage/faxMessage.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/faxQueue/faxQueue.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x13')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x14')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x15')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x16')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x17')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x18')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x19')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x1a')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x1b')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x1c')));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/chatQueue/chatQueue.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/cmContact/cmContact.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x1d')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x1e')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/pause/pause.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x1f')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x20')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x21')));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/trigger/trigger.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x22')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x23')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x24')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x25')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x26')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x27')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x28')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x29')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x2a')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x2b')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x2c')));_0x28c4ed=_['merge'](_0x28c4ed,require('../api/squareRecording/squareRecording.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/squareMessage/squareMessage.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/campaign/campaign.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x2d')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x2e')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x2f')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x30')));_0x28c4ed=_[_0xf70f('0x4')](_0x28c4ed,require(_0xf70f('0x31')));_0x28c4ed=_['merge'](_0x28c4ed,require(_0xf70f('0x32')));var _0x28bd83=jayson[_0xf70f('0x33')](_0x28c4ed)[_0xf70f('0x34')]();var _0x1153cb=config[_0xf70f('0x35')][_0xf70f('0x36')]||config[_0xf70f('0x36')]+0x1;var _0x349999=config[_0xf70f('0x35')]['ip']||_0xf70f('0x37');_0x28bd83['on']('error',function(_0x12ba7f){return _0x2b7a2e(_0x12ba7f);});_0x28bd83[_0xf70f('0x3')](_0x1153cb,_0x349999,function(){console['log'](_0xf70f('0x38'),_0x349999,_0x1153cb);require(_0xf70f('0x39'))[_0xf70f('0x3a')]();return _0x2498d6('RPC\x20listening\x20on\x20'+_0x349999+':'+_0x1153cb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fd69dc1..46ee5d6 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 _0x1a38=['SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','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','agi','AGI','exec','WAIT','label','util','lodash','events','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a38,0xb0));var _0x81a3=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x1a38[_0x328534];return _0x2796c0;};'use strict';var util=require(_0x81a3('0x0'));var _=require(_0x81a3('0x1'));var EventEmitter=require(_0x81a3('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x477513){var _0x2402ba=this,_0x2faf46=new AGIReply(),_0x28fd86=![],_0x33a486={};EventEmitter[_0x81a3('0x3')](_0x2402ba);_0x477513[_0x81a3('0x4')](_0x81a3('0x5'));_0x477513[_0x81a3('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2faf46[_0x81a3('0x4')](_0x81a3('0x5'));_0x2faf46['on'](_0x81a3('0x7'),function(_0x3be616){for(var _0x5a0d27 in _0x3be616){_0x2402ba[_0x5a0d27]=_0x3be616[_0x5a0d27];}_0x2402ba[_0x81a3('0x8')](_0x81a3('0x9'));});_0x2faf46['on'](_0x81a3('0xa'),function(_0x10f4c5){if(_0x10f4c5[_0x81a3('0xb')]()=='hangup'){_0x2402ba[_0x81a3('0x8')](_0x81a3('0xc'));return;}if(_0x10f4c5[_0x81a3('0xd')](0x0,0xb)=='520-Invalid'){_0x28fd86=!![];}if(_0x28fd86){_0x33a486['rx']+=_0x10f4c5+'\x0a';if(_0x10f4c5['search'](_0x81a3('0xe'))!=-0x1){_0x28fd86=![];}}else{_0x33a486['rx']=_0x10f4c5;}if(_0x28fd86){return;}if(typeof _0x33a486['cb']==_0x81a3('0xf')){var _0x44ac21=_0x33a486['rx'][_0x81a3('0xd')](0x0,0x3),_0x45004e=null,_0x199fa0=null;_0x44ac21=parseInt(_0x44ac21);if(isNaN(_0x44ac21)){_0x33a486['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x81a3('0x10')});return;}if(_0x44ac21!=0xc8){_0x33a486['cb'](null,{'code':_0x44ac21,'result':-0x1,'extra':'KO'});return;}_0x45004e=_0x33a486['rx'][_0x81a3('0xd')](0x4)[_0x81a3('0x11')](_0x81a3('0x12'),'');if(_0x45004e[_0x81a3('0x13')]('\x20')!=-0x1){_0x45004e=_0x45004e[_0x81a3('0x14')](0x0,_0x45004e['indexOf']('\x20'));}if(_[_0x81a3('0x15')](_0x45004e,'-1')){_0x45004e=parseInt(_0x45004e);}_0x199fa0=_0x33a486['rx'][_0x81a3('0x16')]('\x20');if(_0x199fa0[_0x81a3('0x17')]==0x3){_0x199fa0=_0x199fa0[0x2][_0x81a3('0xd')](0x1,_0x199fa0[0x2]['length']-0x1);}else if(_0x199fa0[_0x81a3('0x17')]>0x3){var _0x18fc8d=/\((.+)\)/;var _0x584f62=_0x33a486['rx'][_0x81a3('0x18')](_0x18fc8d);if(_0x584f62){_0x199fa0=_0x584f62[0x1];}else{_0x199fa0=null;}}else{_0x199fa0=null;}_0x33a486['cb'](null,{'code':_0x44ac21,'result':_0x45004e,'extra':_0x199fa0});}});_0x477513['on']('error',function(_0x4d4b86){_0x2402ba[_0x81a3('0x8')](_0x81a3('0x19'),new AGIError(_0x81a3('0x1a'),_0x4d4b86[_0x81a3('0x1b')]));});_0x477513['on'](_0x81a3('0x1c'),function(){_0x2402ba[_0x81a3('0x8')](_0x81a3('0x1c'),new AGIError(_0x81a3('0x1d')));});_0x477513['on']('timeout',function(){_0x2402ba[_0x81a3('0x8')](_0x81a3('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x477513[_0x81a3('0x1f')]();});_0x477513[_0x81a3('0x20')](_0x2faf46);this[_0x81a3('0x21')]=function(_0x172afa,_0x58b63d){var _0x172afa=_0x172afa||'',_0x58b63d=typeof _0x58b63d==_0x81a3('0xf')?_0x58b63d:new Function();_0x33a486={'tx':_0x172afa,'rx':'','cb':_0x58b63d};_0x477513['write'](_0x172afa+'\x0a');},this['close']=function(){_0x477513[_0x81a3('0x1f')]();};}util[_0x81a3('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x81a3('0x23')][_0x81a3('0x24')]=function(_0x4b6ae6){return this['command']['sync'](this,_0x4b6ae6);};AGIChannel[_0x81a3('0x23')][_0x81a3('0x25')]=function(){return this[_0x81a3('0x24')](_0x81a3('0x26'));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x27')]=function(_0x3f850d,_0x1f87d2,_0x46a4d0){_0x3f850d=_0x3f850d===undefined?_0x81a3('0x28'):_0x3f850d;_0x1f87d2=_0x1f87d2===undefined?'5':_0x1f87d2;_0x46a4d0=_0x46a4d0===undefined?'1':_0x46a4d0;return this[_0x81a3('0x24')](util[_0x81a3('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3f850d,_0x1f87d2*0x3e8,_0x46a4d0));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x2a')]=function(_0x398213){_0x398213=_0x398213||'NO\x20MESSAGE';return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x2b'),_0x398213));};AGIChannel['prototype']['exec']=function(_0x515aff,_0x962822){if(_[_0x81a3('0x2c')](_0x962822)){return this[_0x81a3('0x24')](util[_0x81a3('0x29')](_0x81a3('0x2d'),_0x515aff,_0x962822[_0x81a3('0x2e')](',')));}return this['sendRequest'](util[_0x81a3('0x29')]('EXEC\x20%s\x20%s',_0x515aff,_0x962822));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x2f')]=function(_0x2f8e88){return this[_0x81a3('0x24')](util[_0x81a3('0x29')](_0x81a3('0x30'),_0x2f8e88));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x31')]=function(_0x177760){return this['sendRequest'](util['format'](_0x81a3('0x32'),_0x177760));};AGIChannel['prototype'][_0x81a3('0x33')]=function(_0x5f31f2){return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x34'),_0x5f31f2));};AGIChannel[_0x81a3('0x23')][_0x81a3('0xc')]=function(){return this['sendRequest'](_0x81a3('0x35'));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x36')]=function(_0x5bb442,_0x1721d9){var _0x53bde1=_['isBoolean'](_0x1721d9)||_['isNumber'](_0x1721d9)?_0x1721d9[_0x81a3('0x37')]():_0x1721d9;return this[_0x81a3('0x24')](util['format'](_0x81a3('0x38'),_0x5bb442,_0x53bde1?_0x53bde1[_0x81a3('0x37')]()[_0x81a3('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x217914,_0x174515){return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x39'),_0x217914,_0x174515));};AGIChannel['prototype'][_0x81a3('0x3a')]=function(_0x5dbb22,_0x53cf9f){return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x3b'),_0x5dbb22,_0x53cf9f));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x3c')]=function(_0x24de2d,_0x3f07d8){return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x3d'),_0x24de2d,_0x3f07d8));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x3e')]=function(_0x3ad129,_0x1c3a38,_0x4fab85){_0x1c3a38=_0x1c3a38||this[_0x81a3('0x3f')];_0x4fab85=_0x4fab85||0x1;this[_0x81a3('0x2f')](_0x3ad129);this['setExtension'](_0x1c3a38);this[_0x81a3('0x33')](_0x4fab85);return this[_0x81a3('0x2a')](util[_0x81a3('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x3ad129,_0x1c3a38,_0x4fab85));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x40')]=function(_0x4e67ba){return this[_0x81a3('0x24')](util[_0x81a3('0x29')](_0x81a3('0x41'),_0x4e67ba));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x42')]=function(_0x353cc5,_0x711acf,_0x5e1b2d,_0x5cda98,_0x561bc3,_0x2f485b){_0x711acf=_0x711acf||_0x81a3('0x43');_0x5e1b2d=_0x5e1b2d||'';_0x5cda98=_0x5cda98===undefined?-0x1:_0x5cda98==='-1'?-0x1:_0x5cda98*0x3e8;_0x561bc3=_0x561bc3===undefined?'':'s='+_0x561bc3;_0x2f485b=_0x2f485b?_0x81a3('0x44'):'';return this['sendRequest'](util[_0x81a3('0x29')](_0x81a3('0x45'),_0x353cc5,_0x711acf,_0x5e1b2d,_0x5cda98,_0x2f485b,_0x561bc3));};AGIChannel['prototype'][_0x81a3('0x46')]=function(_0x166d35,_0x226bf2){_0x226bf2=_0x226bf2||'';return this['sendRequest'](util[_0x81a3('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x166d35,_0x226bf2));};AGIChannel[_0x81a3('0x23')][_0x81a3('0x47')]=function(_0x5bea18){return this['exec'](_0x81a3('0x48'),_0x5bea18);};AGIChannel[_0x81a3('0x23')]['wait']=function(_0xb7ce17){return this[_0x81a3('0x49')](_0x81a3('0x4a'),_0xb7ce17);};AGIChannel[_0x81a3('0x23')][_0x81a3('0x19')]=function(_0x1b03d2,_0x54f2df){this[_0x81a3('0x2a')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1b03d2['id'],_0x1b03d2[_0x81a3('0x4b')],_0x54f2df));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xaac4=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','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','setTimeout','setEncoding','headers','emit','ready','line','hangup','substring','search','520\x20End\x20of\x20proper','function','result=','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension'];(function(_0x231c94,_0x4dc344){var _0x4533fa=function(_0x2e654b){while(--_0x2e654b){_0x231c94['push'](_0x231c94['shift']());}};_0x4533fa(++_0x4dc344);}(_0xaac4,0x6c));var _0x4aac=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xaac4[_0x99ff94];return _0x1b5bc0;};'use strict';var util=require(_0x4aac('0x0'));var _=require(_0x4aac('0x1'));var EventEmitter=require('events')[_0x4aac('0x2')];var AGIReply=require(_0x4aac('0x3'));var AGIError=require(_0x4aac('0x4'));function AGIChannel(_0x5c92c5){var _0x7a4c88=this,_0x2e630e=new AGIReply(),_0x17a5e7=![],_0x63c769={};EventEmitter[_0x4aac('0x5')](_0x7a4c88);_0x5c92c5['setEncoding'](_0x4aac('0x6'));_0x5c92c5[_0x4aac('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2e630e[_0x4aac('0x8')]('utf8');_0x2e630e['on'](_0x4aac('0x9'),function(_0x59735a){for(var _0x3ba0ea in _0x59735a){_0x7a4c88[_0x3ba0ea]=_0x59735a[_0x3ba0ea];}_0x7a4c88[_0x4aac('0xa')](_0x4aac('0xb'));});_0x2e630e['on'](_0x4aac('0xc'),function(_0x33551f){if(_0x33551f['toLowerCase']()==_0x4aac('0xd')){_0x7a4c88[_0x4aac('0xa')](_0x4aac('0xd'));return;}if(_0x33551f[_0x4aac('0xe')](0x0,0xb)=='520-Invalid'){_0x17a5e7=!![];}if(_0x17a5e7){_0x63c769['rx']+=_0x33551f+'\x0a';if(_0x33551f[_0x4aac('0xf')](_0x4aac('0x10'))!=-0x1){_0x17a5e7=![];}}else{_0x63c769['rx']=_0x33551f;}if(_0x17a5e7){return;}if(typeof _0x63c769['cb']==_0x4aac('0x11')){var _0xfec6bd=_0x63c769['rx'][_0x4aac('0xe')](0x0,0x3),_0x323eb0=null,_0x30eefc=null;_0xfec6bd=parseInt(_0xfec6bd);if(isNaN(_0xfec6bd)){_0x63c769['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xfec6bd!=0xc8){_0x63c769['cb'](null,{'code':_0xfec6bd,'result':-0x1,'extra':'KO'});return;}_0x323eb0=_0x63c769['rx'][_0x4aac('0xe')](0x4)['replace'](_0x4aac('0x12'),'');if(_0x323eb0['indexOf']('\x20')!=-0x1){_0x323eb0=_0x323eb0[_0x4aac('0x13')](0x0,_0x323eb0['indexOf']('\x20'));}if(_[_0x4aac('0x14')](_0x323eb0,'-1')){_0x323eb0=parseInt(_0x323eb0);}_0x30eefc=_0x63c769['rx'][_0x4aac('0x15')]('\x20');if(_0x30eefc[_0x4aac('0x16')]==0x3){_0x30eefc=_0x30eefc[0x2]['substring'](0x1,_0x30eefc[0x2][_0x4aac('0x16')]-0x1);}else if(_0x30eefc[_0x4aac('0x16')]>0x3){var _0x4ff7c6=/\((.+)\)/;var _0x5e4f7c=_0x63c769['rx']['match'](_0x4ff7c6);if(_0x5e4f7c){_0x30eefc=_0x5e4f7c[0x1];}else{_0x30eefc=null;}}else{_0x30eefc=null;}_0x63c769['cb'](null,{'code':_0xfec6bd,'result':_0x323eb0,'extra':_0x30eefc});}});_0x5c92c5['on']('error',function(_0x1539fb){_0x7a4c88[_0x4aac('0xa')](_0x4aac('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x1539fb[_0x4aac('0x18')]));});_0x5c92c5['on'](_0x4aac('0x19'),function(){_0x7a4c88[_0x4aac('0xa')](_0x4aac('0x19'),new AGIError(_0x4aac('0x1a')));});_0x5c92c5['on'](_0x4aac('0x1b'),function(){_0x7a4c88[_0x4aac('0xa')](_0x4aac('0x1b'),new AGIError(_0x4aac('0x1c')));_0x5c92c5[_0x4aac('0x1d')]();});_0x5c92c5[_0x4aac('0x1e')](_0x2e630e);this['command']=function(_0x43847,_0x16eef9){var _0x43847=_0x43847||'',_0x16eef9=typeof _0x16eef9=='function'?_0x16eef9:new Function();_0x63c769={'tx':_0x43847,'rx':'','cb':_0x16eef9};_0x5c92c5[_0x4aac('0x1f')](_0x43847+'\x0a');},this[_0x4aac('0x19')]=function(){_0x5c92c5[_0x4aac('0x1d')]();};}util[_0x4aac('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4aac('0x21')][_0x4aac('0x22')]=function(_0x10e391){return this['command'][_0x4aac('0x23')](this,_0x10e391);};AGIChannel[_0x4aac('0x21')][_0x4aac('0x24')]=function(){return this['sendRequest'](_0x4aac('0x25'));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x26')]=function(_0x18bafe,_0x1767fd,_0x4dede8){_0x18bafe=_0x18bafe===undefined?_0x4aac('0x27'):_0x18bafe;_0x1767fd=_0x1767fd===undefined?'5':_0x1767fd;_0x4dede8=_0x4dede8===undefined?'1':_0x4dede8;return this['sendRequest'](util['format'](_0x4aac('0x28'),_0x18bafe,_0x1767fd*0x3e8,_0x4dede8));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x29')]=function(_0x3a1bd3){_0x3a1bd3=_0x3a1bd3||_0x4aac('0x2a');return this['sendRequest'](util[_0x4aac('0x2b')](_0x4aac('0x2c'),_0x3a1bd3));};AGIChannel['prototype'][_0x4aac('0x2d')]=function(_0x350183,_0x59b69f){if(_[_0x4aac('0x2e')](_0x59b69f)){return this['sendRequest'](util['format'](_0x4aac('0x2f'),_0x350183,_0x59b69f[_0x4aac('0x30')](',')));}return this[_0x4aac('0x22')](util['format'](_0x4aac('0x2f'),_0x350183,_0x59b69f));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x31')]=function(_0x468b97){return this[_0x4aac('0x22')](util['format'](_0x4aac('0x32'),_0x468b97));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x33')]=function(_0x158cd2){return this['sendRequest'](util[_0x4aac('0x2b')](_0x4aac('0x34'),_0x158cd2));};AGIChannel['prototype'][_0x4aac('0x35')]=function(_0x172f06){return this['sendRequest'](util[_0x4aac('0x2b')](_0x4aac('0x36'),_0x172f06));};AGIChannel[_0x4aac('0x21')]['hangup']=function(){return this['sendRequest'](_0x4aac('0x37'));};AGIChannel[_0x4aac('0x21')]['setVariable']=function(_0x17443c,_0x40cf49){var _0x4b4942=_[_0x4aac('0x38')](_0x40cf49)||_[_0x4aac('0x39')](_0x40cf49)?_0x40cf49[_0x4aac('0x3a')]():_0x40cf49;return this[_0x4aac('0x22')](util[_0x4aac('0x2b')](_0x4aac('0x3b'),_0x17443c,_0x4b4942?_0x4b4942[_0x4aac('0x3a')]()[_0x4aac('0x3c')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4aac('0x21')]['sayNumber']=function(_0xdbb665,_0x13c5cb){return this[_0x4aac('0x22')](util['format'](_0x4aac('0x3d'),_0xdbb665,_0x13c5cb));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x3e')]=function(_0x452172,_0x2c9a8f){return this[_0x4aac('0x22')](util[_0x4aac('0x2b')](_0x4aac('0x3f'),_0x452172,_0x2c9a8f));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x40')]=function(_0x331514,_0x5359f2){return this[_0x4aac('0x22')](util['format'](_0x4aac('0x41'),_0x331514,_0x5359f2));};AGIChannel[_0x4aac('0x21')]['continueAt']=function(_0x278e4e,_0x5d6394,_0x4d93a1){_0x5d6394=_0x5d6394||this[_0x4aac('0x42')];_0x4d93a1=_0x4d93a1||0x1;this[_0x4aac('0x31')](_0x278e4e);this[_0x4aac('0x33')](_0x5d6394);this[_0x4aac('0x35')](_0x4d93a1);return this['noop'](util[_0x4aac('0x2b')](_0x4aac('0x43'),_0x278e4e,_0x5d6394,_0x4d93a1));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x44')]=function(_0x44fb73){return this[_0x4aac('0x22')](util['format'](_0x4aac('0x45'),_0x44fb73));};AGIChannel['prototype'][_0x4aac('0x46')]=function(_0x1e07c8,_0xd7cb9f,_0x4efb08,_0x2713ba,_0xb22590,_0x14c75b){_0xd7cb9f=_0xd7cb9f||_0x4aac('0x47');_0x4efb08=_0x4efb08||'';_0x2713ba=_0x2713ba===undefined?-0x1:_0x2713ba==='-1'?-0x1:_0x2713ba*0x3e8;_0xb22590=_0xb22590===undefined?'':'s='+_0xb22590;_0x14c75b=_0x14c75b?_0x4aac('0x48'):'';return this[_0x4aac('0x22')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1e07c8,_0xd7cb9f,_0x4efb08,_0x2713ba,_0x14c75b,_0xb22590));};AGIChannel[_0x4aac('0x21')]['streamFile']=function(_0x2d7951,_0x3aaa09){_0x3aaa09=_0x3aaa09||'';return this[_0x4aac('0x22')](util[_0x4aac('0x2b')](_0x4aac('0x49'),_0x2d7951,_0x3aaa09));};AGIChannel[_0x4aac('0x21')][_0x4aac('0x4a')]=function(_0x339627){return this[_0x4aac('0x2d')]('AGI',_0x339627);};AGIChannel[_0x4aac('0x21')][_0x4aac('0x4b')]=function(_0x550448){return this['exec'](_0x4aac('0x4c'),_0x550448);};AGIChannel['prototype']['error']=function(_0x47d40a,_0x5191ba){this['noop'](util['format'](_0x4aac('0x4d'),_0x47d40a['id'],_0x47d40a[_0x4aac('0x4e')],_0x5191ba));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4aac('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bba43ac..4ed9159 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 _0x815d=['exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message'];(function(_0x3c0aea,_0xce7c72){var _0x106ceb=function(_0x4d4203){while(--_0x4d4203){_0x3c0aea['push'](_0x3c0aea['shift']());}};_0x106ceb(++_0xce7c72);}(_0x815d,0x1a1));var _0xd815=function(_0x5dbb3e,_0x4b494d){_0x5dbb3e=_0x5dbb3e-0x0;var _0x138d23=_0x815d[_0x5dbb3e];return _0x138d23;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xd815('0x0'),'E_AGI_ARGUMENT_PORT':_0xd815('0x1'),'E_AGI_SERVER_ERROR':_0xd815('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd815('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xd815('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd815('0x5'),'E_AGI_COMMAND_EMPTY':_0xd815('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd815('0x7'),'E_AGI_IVR_ENTRY':_0xd815('0x8')};function AGIError(_0x48e3f6){var _0x48e3f6=_0x48e3f6||null,_0x662215=_0x662215||[],_0x1c7fc7=0x1,_0x7cc1ea='';if(!error[_0x48e3f6]){_0x48e3f6=_0xd815('0x9');}_0x662215[_0xd815('0xa')](error[_0x48e3f6]);while(arguments[_0x1c7fc7]){_0x662215['push'](arguments[_0x1c7fc7]);_0x1c7fc7++;}_0x7cc1ea=util['format']['apply'](util,_0x662215);this[_0xd815('0xb')]=_0x7cc1ea;this['name']=_0x48e3f6;}module[_0xd815('0xc')]=AGIError; \ No newline at end of file +var _0x01d5=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x54dd86,_0x2fb515){var _0x2fe31c=function(_0x5ac3d4){while(--_0x5ac3d4){_0x54dd86['push'](_0x54dd86['shift']());}};_0x2fe31c(++_0x2fb515);}(_0x01d5,0x1a0));var _0x501d=function(_0x534e79,_0x31580c){_0x534e79=_0x534e79-0x0;var _0x4b31a5=_0x01d5[_0x534e79];return _0x4b31a5;};'use strict';var util=require(_0x501d('0x0'));var error={'E_AGI_UNDEFINED':_0x501d('0x1'),'E_AGI_ARGUMENT_PORT':_0x501d('0x2'),'E_AGI_SERVER_ERROR':_0x501d('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x501d('0x4'),'E_AGI_SOCKET_ERROR':_0x501d('0x5'),'E_AGI_SOCKET_CLOSE':_0x501d('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x501d('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x501d('0x8'),'E_AGI_IVR_ENTRY':_0x501d('0x9')};function AGIError(_0x255648){var _0x255648=_0x255648||null,_0x5d2048=_0x5d2048||[],_0x39fd7a=0x1,_0x4cf533='';if(!error[_0x255648]){_0x255648='E_AGI_UNDEFINED';}_0x5d2048[_0x501d('0xa')](error[_0x255648]);while(arguments[_0x39fd7a]){_0x5d2048[_0x501d('0xa')](arguments[_0x39fd7a]);_0x39fd7a++;}_0x4cf533=util['format'][_0x501d('0xb')](util,_0x5d2048);this['message']=_0x4cf533;this[_0x501d('0xc')]=_0x255648;}module[_0x501d('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 10aa5c0..f57ea2e 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x722c=['../../config/environment','redis','defaults','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','message','emit','exports','events'];(function(_0x3cffb0,_0x3f7248){var _0x37ce8e=function(_0x4522ee){while(--_0x4522ee){_0x3cffb0['push'](_0x3cffb0['shift']());}};_0x37ce8e(++_0x3f7248);}(_0x722c,0x6b));var _0xc722=function(_0x804de7,_0x3d3450){_0x804de7=_0x804de7-0x0;var _0x573168=_0x722c[_0x804de7];return _0x573168;};'use strict';var _=require('lodash');var EventEmitter=require(_0xc722('0x0'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0xc722('0x1'));config[_0xc722('0x2')]=_[_0xc722('0x3')](config[_0xc722('0x2')],{'host':_0xc722('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xc722('0x2')]);sub[_0xc722('0x5')](_0xc722('0x6'),function(_0x13981a){if(_0x13981a)return eventEmitter['emit'](_0xc722('0x7'),new AGIError(_0xc722('0x8'),_0x13981a));});sub['on'](_0xc722('0x9'),function(_0x55b50e,_0x42382b){if(_0x55b50e!==_0xc722('0x6'))return;try{var _0x36572d=JSON['parse'](_0x42382b);eventEmitter[_0xc722('0xa')]('projectUpdate',_0x36572d);}catch(_0x393e8b){eventEmitter['emit']('error',new AGIError(_0xc722('0x8'),_0x393e8b));}});module[_0xc722('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xceba=['./error','../../config/environment','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash'];(function(_0x1a96a0,_0x406836){var _0x382d32=function(_0x1d337d){while(--_0x1d337d){_0x1a96a0['push'](_0x1a96a0['shift']());}};_0x382d32(++_0x406836);}(_0xceba,0x1df));var _0xaceb=function(_0x5924fc,_0x30a9d6){_0x5924fc=_0x5924fc-0x0;var _0x20c0a7=_0xceba[_0x5924fc];return _0x20c0a7;};'use strict';var _=require(_0xaceb('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0xaceb('0x1'));var config=require(_0xaceb('0x2'));config[_0xaceb('0x3')]=_[_0xaceb('0x4')](config[_0xaceb('0x3')],{'host':_0xaceb('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xaceb('0x3')]);sub[_0xaceb('0x6')]('agi',function(_0x5375ee){if(_0x5375ee)return eventEmitter[_0xaceb('0x7')](_0xaceb('0x8'),new AGIError(_0xaceb('0x9'),_0x5375ee));});sub['on'](_0xaceb('0xa'),function(_0x6a1c61,_0x47a7df){if(_0x6a1c61!==_0xaceb('0xb'))return;try{var _0x48b344=JSON[_0xaceb('0xc')](_0x47a7df);eventEmitter[_0xaceb('0x7')](_0xaceb('0xd'),_0x48b344);}catch(_0x1788fd){eventEmitter[_0xaceb('0x7')](_0xaceb('0x8'),new AGIError(_0xaceb('0x9'),_0x1788fd));}});module[_0xaceb('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index aa9e394..8001a49 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 _0x3e7c=['getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','target','default','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','addVertex','vertices','prototype','addEdge','push','size','relations'];(function(_0x5c8f3e,_0x11f776){var _0x26f42f=function(_0x2b3ce8){while(--_0x2b3ce8){_0x5c8f3e['push'](_0x5c8f3e['shift']());}};_0x26f42f(++_0x11f776);}(_0x3e7c,0xe9));var _0xc3e7=function(_0x5879e8,_0x3fc0b8){_0x5879e8=_0x5879e8-0x0;var _0x5f57ff=_0x3e7c[_0x5879e8];return _0x5f57ff;};'use strict';var _=require(_0xc3e7('0x0'));var logger=require(_0xc3e7('0x1'))(_0xc3e7('0x2'));var verticesWithRetry=[_0xc3e7('0x3'),_0xc3e7('0x4'),_0xc3e7('0x5')];var Graph=function(){this['vertices']={};this[_0xc3e7('0x6')]={};this[_0xc3e7('0x7')]=0x0;};Graph['prototype'][_0xc3e7('0x8')]=function(_0x557aa4){this[_0xc3e7('0x9')][_0x557aa4['id']]=_0x557aa4;this['edges'][_0x557aa4['id']]=[];};Graph[_0xc3e7('0xa')][_0xc3e7('0xb')]=function(_0x263df0,_0x5cb1d8,_0x2cd5b7){this[_0xc3e7('0x6')][_0x263df0][_0xc3e7('0xc')]({'target':_0x5cb1d8,'condition':_0x2cd5b7});this[_0xc3e7('0x7')]+=0x1;};Graph['prototype'][_0xc3e7('0xd')]=function(){return _[_0xc3e7('0xd')](this['vertices']);};Graph['prototype'][_0xc3e7('0xe')]=function(){return this[_0xc3e7('0x7')];};Graph[_0xc3e7('0xa')][_0xc3e7('0xf')]=function(_0x31fbe7){return this[_0xc3e7('0x9')][_0x31fbe7];};Graph[_0xc3e7('0xa')][_0xc3e7('0x10')]=function(_0x142444,_0x1758ab){if(!this[_0xc3e7('0x9')][_0x142444]){return logger[_0xc3e7('0x11')](_0xc3e7('0x12'));}var _0x348f2c=_0x1758ab(this[_0xc3e7('0x9')][_0x142444]);if(!_0x348f2c){return logger[_0xc3e7('0x11')](_0xc3e7('0x13'));}if(this[_0xc3e7('0x6')][_0x142444]['length']===0x0){return logger[_0xc3e7('0x11')]('no\x20edge/s\x20available');}for(var _0x410bea=0x0,_0x2d755a=[],_0x26bcc1=![];_0x410bea\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','finally','./server','listening','connection'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7d91,0x122));var _0x17d9=function(_0x2c976f,_0x4bd2c4){_0x2c976f=_0x2c976f-0x0;var _0x1a1227=_0x7d91[_0x2c976f];return _0x1a1227;};'use strict';var _=require(_0x17d9('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x17d9('0x1'));var logger=require(_0x17d9('0x2'))(_0x17d9('0x3'));var utilLicense=require(_0x17d9('0x4'));var rpc=require(_0x17d9('0x5'));var Project=require(_0x17d9('0x6'));var AGIEmitter=require('./events')[_0x17d9('0x7')];var projects=[];config[_0x17d9('0x3')]=_[_0x17d9('0x8')](config['agi'],{'ip':_0x17d9('0x9'),'port':0x11dd});AGIEmitter['on'](_0x17d9('0xa'),projectUpdateHandler);function connectionHandler(_0x495577){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x495577);agiHandler(_0x495577);}catch(_0x5478c0){logger[_0x17d9('0xb')](_0x5478c0[_0x17d9('0xc')]);}});});}function projectUpdateHandler(_0x124c71){try{var _0x22e5a1=_[_0x17d9('0xd')](projects,['id',_0x124c71['id']]);if(_0x22e5a1>-0x1){if(_0x124c71[_0x17d9('0xe')]===!![]){projects[_0x17d9('0xf')](_0x22e5a1,0x1);}else{projects[_0x22e5a1]=_0x124c71;}}else{projects[_0x17d9('0x10')](_0x124c71);}}catch(_0x40663f){logger[_0x17d9('0xb')](_0x40663f['stack']);}}function listeningHandler(){console['log'](_0x17d9('0x11'),config[_0x17d9('0x3')]['port']);logger['info'](util[_0x17d9('0x12')](_0x17d9('0x13'),config[_0x17d9('0x3')]['ip'],config[_0x17d9('0x3')][_0x17d9('0x14')]));}function errorHandler(_0x3eef77){if(_0x3eef77&&_0x3eef77['name']&&_0x3eef77[_0x17d9('0x15')]){logger[_0x17d9('0xb')](util[_0x17d9('0x12')](_0x17d9('0x16'),_0x3eef77[_0x17d9('0x17')],_0x3eef77[_0x17d9('0x15')]));}else{logger['error'](util[_0x17d9('0x12')](_0x17d9('0x18'),_0x3eef77[_0x17d9('0xc')]));}}function closeHandler(){logger[_0x17d9('0x19')](util['format'](_0x17d9('0x1a'),this['arg_1'],this[_0x17d9('0x1b')],this[_0x17d9('0x1c')],this['dnid'],this[_0x17d9('0x1d')]));try{createSquareReport(this);}catch(_0x486b32){logger[_0x17d9('0xb')](_0x486b32[_0x17d9('0xc')]);}}function timeoutHandler(){logger['info'](util[_0x17d9('0x12')](_0x17d9('0x1e'),this['arg_1'],this[_0x17d9('0x1b')],this[_0x17d9('0x1c')],this[_0x17d9('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x17d9('0x19')](util[_0x17d9('0x12')](_0x17d9('0x20'),this[_0x17d9('0x21')],this[_0x17d9('0x1b')],this[_0x17d9('0x1c')],this[_0x17d9('0x1f')],this[_0x17d9('0x1d')]));this[_0x17d9('0x22')]=!![];}function createSquareReport(_0xa3ba96,_0x4b782a){rpc[_0x17d9('0x23')](_0xa3ba96)[_0x17d9('0x24')](function(_0x235eff){if(_0x4b782a){_0x4b782a(null,_0x235eff);}})[_0x17d9('0x25')](function(_0x3caa1c){if(_0x4b782a){_0x4b782a(null,_0x3caa1c);}});}function setChannelVariables(_0xbcde36){for(var _0x2136b4 in _0xbcde36){if(_0xbcde36[_0x17d9('0x26')](_0x2136b4)){if(_0x2136b4[_0x17d9('0x27')](_0x17d9('0x28'))===0x0){_0xbcde36[_0x2136b4[_0x17d9('0x29')](0x4)]=_0xbcde36[_0x2136b4];delete _0xbcde36[_0x2136b4];}}}}function agiHandler(_0x290d27){logger['debug'](_0x17d9('0x2a'),JSON[_0x17d9('0x2b')](_0x290d27,null,0x2));logger[_0x17d9('0x19')](util[_0x17d9('0x12')](_0x17d9('0x2c'),_0x290d27[_0x17d9('0x21')],_0x290d27[_0x17d9('0x1b')],_0x290d27[_0x17d9('0x1c')],_0x290d27[_0x17d9('0x1f')],_0x290d27[_0x17d9('0x1d')]));_0x290d27['on'](_0x17d9('0xb'),errorHandler);_0x290d27['on'](_0x17d9('0x2d'),closeHandler);_0x290d27['on'](_0x17d9('0x2e'),timeoutHandler);_0x290d27[_0x17d9('0x22')]=![];_0x290d27['on']('hangup',hangupHandler);var _0x3e3438=_['find'](projects,[_0x17d9('0x17'),_0x290d27['arg_1']]);if(!_0x3e3438)return Project[_0x17d9('0x2f')](_0x290d27);if(!_0x3e3438[_0x17d9('0x30')])return Project[_0x17d9('0x31')](_0x290d27);return Project[_0x17d9('0x32')](_0x3e3438,_0x290d27);}function main(){var _0x110f7e;return utilLicense[_0x17d9('0x33')]()[_0x17d9('0x24')](function(_0x4be31c){if(!_0x4be31c)return;if(_0x4be31c['voice']){if(_0x4be31c[_0x17d9('0x34')]&&_0x4be31c[_0x17d9('0x34')]>0x0){logger[_0x17d9('0x19')](util[_0x17d9('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x4be31c[_0x17d9('0x34')]));_0x110f7e=_0x4be31c[_0x17d9('0x34')];}else{logger[_0x17d9('0x19')](_0x17d9('0x35'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x110f7e=-0x1;}})[_0x17d9('0x24')](function(){return Project['getAll']();})['then'](function(_0x340e72){projects=_0x340e72;return;})['catch'](function(_0x99cb4){logger[_0x17d9('0xb')]('[LICENSE]',_0x99cb4[_0x17d9('0xc')]);})[_0x17d9('0x36')](function(){var _0x4e6b76=require(_0x17d9('0x37'))(config['agi'][_0x17d9('0x14')],config[_0x17d9('0x3')]['ip'],_0x110f7e);_0x4e6b76['on'](_0x17d9('0xb'),errorHandler);_0x4e6b76['on'](_0x17d9('0x38'),listeningHandler);_0x4e6b76['on'](_0x17d9('0x39'),connectionHandler);_0x4e6b76['on'](_0x17d9('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x80f6=['error','findIndex','deleted','splice','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','format','[%s]\x20%s','name','message','[ERROR]\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','createSquareReport','hasOwnProperty','indexOf','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','handleUnpublished','then','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x80f6,0x154));var _0x680f=function(_0x4d105a,_0x523c9c){_0x4d105a=_0x4d105a-0x0;var _0x507edc=_0x80f6[_0x4d105a];return _0x507edc;};'use strict';var _=require(_0x680f('0x0'));var syncho=require(_0x680f('0x1'));var util=require(_0x680f('0x2'));var config=require(_0x680f('0x3'));var logger=require('../../config/logger')(_0x680f('0x4'));var utilLicense=require(_0x680f('0x5'));var rpc=require(_0x680f('0x6'));var Project=require(_0x680f('0x7'));var AGIEmitter=require(_0x680f('0x8'))[_0x680f('0x9')];var projects=[];config[_0x680f('0x4')]=_[_0x680f('0xa')](config[_0x680f('0x4')],{'ip':_0x680f('0xb'),'port':0x11dd});AGIEmitter['on'](_0x680f('0xc'),projectUpdateHandler);function connectionHandler(_0x3ffce9){process[_0x680f('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3ffce9);agiHandler(_0x3ffce9);}catch(_0x5766e1){logger[_0x680f('0xe')](_0x5766e1['stack']);}});});}function projectUpdateHandler(_0x1fcd48){try{var _0x1f8b65=_[_0x680f('0xf')](projects,['id',_0x1fcd48['id']]);if(_0x1f8b65>-0x1){if(_0x1fcd48[_0x680f('0x10')]===!![]){projects[_0x680f('0x11')](_0x1f8b65,0x1);}else{projects[_0x1f8b65]=_0x1fcd48;}}else{projects[_0x680f('0x12')](_0x1fcd48);}}catch(_0x3ac0db){logger[_0x680f('0xe')](_0x3ac0db[_0x680f('0x13')]);}}function listeningHandler(){console[_0x680f('0x14')](_0x680f('0x15'),config['agi']['port']);logger['info'](util['format'](_0x680f('0x16'),config['agi']['ip'],config[_0x680f('0x4')][_0x680f('0x17')]));}function errorHandler(_0x2983f4){if(_0x2983f4&&_0x2983f4['name']&&_0x2983f4['message']){logger['error'](util[_0x680f('0x18')](_0x680f('0x19'),_0x2983f4[_0x680f('0x1a')],_0x2983f4[_0x680f('0x1b')]));}else{logger[_0x680f('0xe')](util['format'](_0x680f('0x1c'),_0x2983f4[_0x680f('0x13')]));}}function closeHandler(){logger[_0x680f('0x1d')](util[_0x680f('0x18')](_0x680f('0x1e'),this[_0x680f('0x1f')],this[_0x680f('0x20')],this[_0x680f('0x21')],this[_0x680f('0x22')],this[_0x680f('0x23')]));try{createSquareReport(this);}catch(_0x4713d6){logger[_0x680f('0xe')](_0x4713d6[_0x680f('0x13')]);}}function timeoutHandler(){logger[_0x680f('0x1d')](util[_0x680f('0x18')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x680f('0x20')],this[_0x680f('0x21')],this[_0x680f('0x22')],this[_0x680f('0x23')]));}function hangupHandler(){logger['info'](util[_0x680f('0x18')](_0x680f('0x24'),this['arg_1'],this[_0x680f('0x20')],this[_0x680f('0x21')],this[_0x680f('0x22')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x548b98,_0x37cc9a){rpc[_0x680f('0x25')](_0x548b98)['then'](function(_0x892978){if(_0x37cc9a){_0x37cc9a(null,_0x892978);}})['catch'](function(_0x41fd26){if(_0x37cc9a){_0x37cc9a(null,_0x41fd26);}});}function setChannelVariables(_0x21bb97){for(var _0x19ee50 in _0x21bb97){if(_0x21bb97[_0x680f('0x26')](_0x19ee50)){if(_0x19ee50[_0x680f('0x27')]('agi_')===0x0){_0x21bb97[_0x19ee50['substring'](0x4)]=_0x21bb97[_0x19ee50];delete _0x21bb97[_0x19ee50];}}}}function agiHandler(_0x58c0c2){logger[_0x680f('0x28')](_0x680f('0x29'),JSON[_0x680f('0x2a')](_0x58c0c2,null,0x2));logger['info'](util[_0x680f('0x18')](_0x680f('0x2b'),_0x58c0c2[_0x680f('0x1f')],_0x58c0c2[_0x680f('0x20')],_0x58c0c2[_0x680f('0x21')],_0x58c0c2[_0x680f('0x22')],_0x58c0c2[_0x680f('0x23')]));_0x58c0c2['on']('error',errorHandler);_0x58c0c2['on'](_0x680f('0x2c'),closeHandler);_0x58c0c2['on'](_0x680f('0x2d'),timeoutHandler);_0x58c0c2[_0x680f('0x2e')]=![];_0x58c0c2['on'](_0x680f('0x2f'),hangupHandler);var _0x373aa3=_['find'](projects,[_0x680f('0x1a'),_0x58c0c2['arg_1']]);if(!_0x373aa3)return Project['handleNotFound'](_0x58c0c2);if(!_0x373aa3[_0x680f('0x30')])return Project[_0x680f('0x31')](_0x58c0c2);return Project['initialize'](_0x373aa3,_0x58c0c2);}function main(){var _0x5d94f6;return utilLicense['getLicense']()[_0x680f('0x32')](function(_0x57f25e){if(!_0x57f25e)return;if(_0x57f25e['voice']){if(_0x57f25e['callysquare']&&_0x57f25e[_0x680f('0x33')]>0x0){logger[_0x680f('0x1d')](util[_0x680f('0x18')]('[LICENSE]\x20CHANNELS:\x20%s',_0x57f25e[_0x680f('0x33')]));_0x5d94f6=_0x57f25e[_0x680f('0x33')];}else{logger[_0x680f('0x1d')](_0x680f('0x34'));}}else{logger[_0x680f('0x1d')](_0x680f('0x35'));_0x5d94f6=-0x1;}})['then'](function(){return Project[_0x680f('0x36')]();})[_0x680f('0x32')](function(_0x31d1aa){projects=_0x31d1aa;return;})[_0x680f('0x37')](function(_0x33819d){logger[_0x680f('0xe')](_0x680f('0x38'),_0x33819d[_0x680f('0x13')]);})[_0x680f('0x39')](function(){var _0x5466d7=require('./server')(config[_0x680f('0x4')][_0x680f('0x17')],config[_0x680f('0x4')]['ip'],_0x5d94f6);_0x5466d7['on'](_0x680f('0xe'),errorHandler);_0x5466d7['on']('listening',listeningHandler);_0x5466d7['on'](_0x680f('0x3a'),connectionHandler);_0x5466d7['on'](_0x680f('0x2c'),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 6f069a6..3f72c33 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 _0x6b31=['client','http','request','then','error','message','catch','SendMail','bluebird','jayson/promise'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x6b31,0x10c));var _0x16b3=function(_0x45b594,_0x56fb4e){_0x45b594=_0x45b594-0x0;var _0x5d08a9=_0x6b31[_0x45b594];return _0x5d08a9;};'use strict';var BPromise=require(_0x16b3('0x0'));var jayson=require(_0x16b3('0x1'));var client=jayson[_0x16b3('0x2')][_0x16b3('0x3')]({'port':0x232b});function request(_0x1aeb96,_0x100a73){return new BPromise(function(_0x47ba91,_0x73d05a){return client[_0x16b3('0x4')](_0x1aeb96,_0x100a73)[_0x16b3('0x5')](function(_0x4ba516){if(_0x4ba516['error']){return _0x73d05a(_0x4ba516[_0x16b3('0x6')][_0x16b3('0x7')]);}else{return _0x47ba91(_0x4ba516['result']);}})[_0x16b3('0x8')](function(_0x18efa7){return _0x73d05a(_0x18efa7);});});}exports['sendMailMessage']=function(_0x2bed25,_0x5a3d23){return request(_0x16b3('0x9'),{'account':_0x2bed25,'message':_0x5a3d23});}; \ No newline at end of file +var _0x5f89=['sendMailMessage','SendMail','bluebird','client','request','then','error','message','result'];(function(_0x496bb7,_0x32b9fa){var _0x589721=function(_0x4ca56b){while(--_0x4ca56b){_0x496bb7['push'](_0x496bb7['shift']());}};_0x589721(++_0x32b9fa);}(_0x5f89,0x77));var _0x95f8=function(_0xbc3e0c,_0x29be9b){_0xbc3e0c=_0xbc3e0c-0x0;var _0x5a25af=_0x5f89[_0xbc3e0c];return _0x5a25af;};'use strict';var BPromise=require(_0x95f8('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x95f8('0x1')]['http']({'port':0x232b});function request(_0x2822b4,_0x4297dd){return new BPromise(function(_0x460b77,_0x52514f){return client[_0x95f8('0x2')](_0x2822b4,_0x4297dd)[_0x95f8('0x3')](function(_0x5e1a55){if(_0x5e1a55[_0x95f8('0x4')]){return _0x52514f(_0x5e1a55[_0x95f8('0x4')][_0x95f8('0x5')]);}else{return _0x460b77(_0x5e1a55[_0x95f8('0x6')]);}})['catch'](function(_0x55d055){return _0x52514f(_0x55d055);});});}exports[_0x95f8('0x7')]=function(_0x565849,_0x4f7daa){return request(_0x95f8('0x8'),{'account':_0x565849,'message':_0x4f7daa});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 0c32ee4..03328f8 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2134=['lodash','moment','xml2json','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','maxRetry','retry','omit','hasOwnProperty','length','target','addEdge','source','toJson','mxGraphModel','inspect','production','start','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','clear','context','extension','priority','response','code','debug','isUndefined','result','toString','agicommand\x20not\x20found','finally','format','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','traverseBFS','vertex','close','continueAt','exports'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x2134,0x1c8));var _0x4213=function(_0x2b17e1,_0x333bb5){_0x2b17e1=_0x2b17e1-0x0;var _0x43749c=_0x2134[_0x2b17e1];return _0x43749c;};'use strict';var _=require(_0x4213('0x0'));var moment=require(_0x4213('0x1'));var parser=require(_0x4213('0x2'));var util=require('util');var logger=require('../../config/logger')(_0x4213('0x3'));var rpc=require(_0x4213('0x4'));var mailRpc=require(_0x4213('0x5'));var Graph=require(_0x4213('0x6'));var Vertices=require(_0x4213('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4213('0x8')]()[_0x4213('0x9')](function(_0x92fd08){logger[_0x4213('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x92fd08[_0x4213('0xb')]);return[];});}function addVertex(_0x2d214f,_0x20e5b4,_0x27a47a){_0x20e5b4[_0x4213('0xc')]=_0x27a47a;if(_0x20e5b4['hasOwnProperty']('retry')){_0x20e5b4[_0x4213('0xd')]=parseInt(_0x20e5b4[_0x4213('0xe')],0xa);}_0x2d214f['addVertex'](_[_0x4213('0xf')](_0x20e5b4,'mxCell'));}function initGraph(_0x1fa6e8,_0x4ac8b4){var _0x219efc=new Graph();for(var _0x153965 in _0x1fa6e8){if(_0x1fa6e8[_0x4213('0x10')](_0x153965)){if(_['isArray'](_0x1fa6e8[_0x153965])){for(var _0x197b6d=0x0;_0x197b6d<_0x1fa6e8[_0x153965][_0x4213('0x11')];_0x197b6d+=0x1){addVertex(_0x219efc,_0x1fa6e8[_0x153965][_0x197b6d],_0x153965);}}else{addVertex(_0x219efc,_0x1fa6e8[_0x153965],_0x153965);}}}for(var _0x1c6a8e=0x0;_0x1c6a8e<_0x4ac8b4[_0x4213('0x11')];_0x1c6a8e+=0x1){if(_0x4ac8b4[_0x1c6a8e]['source']&&_0x4ac8b4[_0x1c6a8e][_0x4213('0x12')]){_0x219efc[_0x4213('0x13')](_0x4ac8b4[_0x1c6a8e][_0x4213('0x14')],_0x4ac8b4[_0x1c6a8e]['target'],_0x4ac8b4[_0x1c6a8e]['value']);}}return _0x219efc;}function getRoot(_0x3864ac){return parser[_0x4213('0x15')](_0x3864ac,{'object':!![]})[_0x4213('0x16')]['root'];}function inspect(_0x19c02f){return util[_0x4213('0x17')](_0x19c02f,{'showHidden':![],'depth':null});}function initialize(_0x1d4177,_0x526227){var _0x37163f=getRoot(_0x1d4177[_0x4213('0x18')]);if(!_0x37163f||!_0x37163f[_0x4213('0x19')])return;var _0x3c556d,_0x1c8075,_0x4a6d1c;logger['debug'](_0x4213('0x1a'),JSON[_0x4213('0x1b')](_0x37163f,null,0x2));_0x526227[_0x4213('0x1c')]=moment()['format'](_0x4213('0x1d'));_0x3c556d=initGraph(_[_0x4213('0xf')](_0x37163f,_0x4213('0x1e')),_0x37163f[_0x4213('0x1e')]);_0x1c8075=new Vertices(_0x526227,rpc,mailRpc);logger[_0x4213('0x1f')](util['format'](_0x4213('0x20'),_0x526227[_0x4213('0x21')],_0x526227[_0x4213('0x22')],_0x526227[_0x4213('0x23')],_0x526227[_0x4213('0x24')],_0x526227['uniqueid']));_0x3c556d['traverseBFS'](_0x37163f[_0x4213('0x19')]['id'],function(_0x5c0261){try{_0x5c0261=_0x1c8075[_0x4213('0x25')](_0x5c0261);logger['debug']('vertex',JSON['stringify'](_0x5c0261,null,0x2));if(_0x5c0261[_0x4213('0xc')]==='gotoc'){logger[_0x4213('0x1f')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x526227['context']=_0x5c0261['context']||_0x526227[_0x4213('0x26')];_0x526227[_0x4213('0x27')]=_0x5c0261['extension'];_0x526227[_0x4213('0x28')]=_0x5c0261['priority']?_0x5c0261[_0x4213('0x28')]-0x1:0x1;return null;}else if(_0x5c0261&&_0x1c8075[_0x5c0261[_0x4213('0xc')]]){_0x4a6d1c=_0x1c8075[_0x5c0261['agicommand']](_0x5c0261);logger['info'](_0x4213('0x29'),JSON['stringify'](_0x4a6d1c,null,0x2));if(_0x4a6d1c&&_0x4a6d1c[_0x4213('0x2a')]===AGI_CODE_SUCCESS&&_0x4a6d1c['result']!==AGI_RESULT_ERROR&&!_0x526227['evtHangup']){logger[_0x4213('0x2b')](_0x4213('0x29'),inspect(_0x4a6d1c));return _[_0x4213('0x2c')](_0x4a6d1c[_0x4213('0x2d')])?null:_0x4a6d1c[_0x4213('0x2d')][_0x4213('0x2e')]();}else{logger[_0x4213('0xa')](_0x4213('0x29'),inspect(_0x4a6d1c));return null;}}else{logger[_0x4213('0xa')](_0x4213('0x2f'));return null;}}catch(_0x52c3e2){logger[_0x4213('0xa')](_0x52c3e2[_0x4213('0xb')]);return null;}});if(_0x37163f[_0x4213('0x30')]){logger[_0x4213('0x1f')](util[_0x4213('0x31')](_0x4213('0x32'),_0x526227[_0x4213('0x21')],_0x526227[_0x4213('0x22')],_0x526227[_0x4213('0x23')],_0x526227[_0x4213('0x24')],_0x526227[_0x4213('0x33')]));_0x3c556d[_0x4213('0x34')](_0x37163f[_0x4213('0x30')]['id'],function(_0xed854b){try{_0xed854b=_0x1c8075[_0x4213('0x25')](_0xed854b);logger[_0x4213('0x2b')](_0x4213('0x35'),JSON[_0x4213('0x1b')](_0xed854b,null,0x2));if(_0xed854b&&_0x1c8075[_0xed854b[_0x4213('0xc')]]){_0x4a6d1c=_0x1c8075[_0xed854b[_0x4213('0xc')]](_0xed854b);if(_0x4a6d1c){logger[_0x4213('0x2b')](_0x4213('0x29'),inspect(_0x4a6d1c));return _[_0x4213('0x2c')](_0x4a6d1c[_0x4213('0x2d')])?null:_0x4a6d1c['result'][_0x4213('0x2e')]();}else{logger[_0x4213('0xa')](_0x4213('0x29'),inspect(_0x4a6d1c));return null;}}else{logger[_0x4213('0xa')](_0x4213('0x2f'));return null;}}catch(_0xed1573){logger['error'](_0xed1573[_0x4213('0xb')]);return null;}});}logger['info'](util[_0x4213('0x31')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x526227[_0x4213('0x21')],_0x526227['calleridname'],_0x526227['callerid'],_0x526227[_0x4213('0x24')],_0x526227[_0x4213('0x33')]));logger[_0x4213('0x1f')](util[_0x4213('0x31')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x526227[_0x4213('0x26')],_0x526227[_0x4213('0x27')],parseInt(_0x526227[_0x4213('0x28')],0xa)+0x1));_0x526227['continueAt'](_0x526227[_0x4213('0x26')],_0x526227[_0x4213('0x27')],parseInt(_0x526227[_0x4213('0x28')],0xa)+0x1);_0x526227[_0x4213('0x36')]();}function handleNotFound(_0x1e97c7){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x1e97c7[_0x4213('0x21')]));_0x1e97c7[_0x4213('0x37')](_0x1e97c7[_0x4213('0x26')],_0x1e97c7['extension'],parseInt(_0x1e97c7[_0x4213('0x28')],0xa)+0x1);_0x1e97c7[_0x4213('0x36')]();}function handleUnpublished(_0x567310){logger[_0x4213('0xa')](util['format']('Project\x20%s\x20not\x20published',_0x567310[_0x4213('0x21')]));_0x567310[_0x4213('0x37')](_0x567310[_0x4213('0x26')],_0x567310[_0x4213('0x27')],parseInt(_0x567310['priority'],0xa)+0x1);_0x567310[_0x4213('0x36')]();}module[_0x4213('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa683=['length','source','value','mxGraphModel','root','inspect','production','start','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','info','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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\x20found','exports','lodash','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray'];(function(_0x67a2fe,_0x47c07a){var _0x3cd6e3=function(_0x5d48d2){while(--_0x5d48d2){_0x67a2fe['push'](_0x67a2fe['shift']());}};_0x3cd6e3(++_0x47c07a);}(_0xa683,0x1ab));var _0x3a68=function(_0x1724a7,_0x2a2908){_0x1724a7=_0x1724a7-0x0;var _0x28605d=_0xa683[_0x1724a7];return _0x28605d;};'use strict';var _=require(_0x3a68('0x0'));var moment=require(_0x3a68('0x1'));var parser=require('xml2json');var util=require(_0x3a68('0x2'));var logger=require(_0x3a68('0x3'))(_0x3a68('0x4'));var rpc=require(_0x3a68('0x5'));var mailRpc=require(_0x3a68('0x6'));var Graph=require(_0x3a68('0x7'));var Vertices=require(_0x3a68('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3a68('0x9')]()[_0x3a68('0xa')](function(_0x1a6060){logger[_0x3a68('0xb')](_0x3a68('0xc'),_0x1a6060[_0x3a68('0xd')]);return[];});}function addVertex(_0x29ba21,_0x59b55e,_0x2afc97){_0x59b55e['agicommand']=_0x2afc97;if(_0x59b55e[_0x3a68('0xe')](_0x3a68('0xf'))){_0x59b55e[_0x3a68('0x10')]=parseInt(_0x59b55e[_0x3a68('0xf')],0xa);}_0x29ba21[_0x3a68('0x11')](_[_0x3a68('0x12')](_0x59b55e,_0x3a68('0x13')));}function initGraph(_0x1e58c8,_0x50d396){var _0x48026a=new Graph();for(var _0x468cb5 in _0x1e58c8){if(_0x1e58c8[_0x3a68('0xe')](_0x468cb5)){if(_[_0x3a68('0x14')](_0x1e58c8[_0x468cb5])){for(var _0x3060dc=0x0;_0x3060dc<_0x1e58c8[_0x468cb5][_0x3a68('0x15')];_0x3060dc+=0x1){addVertex(_0x48026a,_0x1e58c8[_0x468cb5][_0x3060dc],_0x468cb5);}}else{addVertex(_0x48026a,_0x1e58c8[_0x468cb5],_0x468cb5);}}}for(var _0x2d7613=0x0;_0x2d7613<_0x50d396['length'];_0x2d7613+=0x1){if(_0x50d396[_0x2d7613][_0x3a68('0x16')]&&_0x50d396[_0x2d7613]['target']){_0x48026a['addEdge'](_0x50d396[_0x2d7613][_0x3a68('0x16')],_0x50d396[_0x2d7613]['target'],_0x50d396[_0x2d7613][_0x3a68('0x17')]);}}return _0x48026a;}function getRoot(_0xa3c2f4){return parser['toJson'](_0xa3c2f4,{'object':!![]})[_0x3a68('0x18')][_0x3a68('0x19')];}function inspect(_0x1311b1){return util[_0x3a68('0x1a')](_0x1311b1,{'showHidden':![],'depth':null});}function initialize(_0xe2abfc,_0x450cb3){var _0x498e2c=getRoot(_0xe2abfc[_0x3a68('0x1b')]);if(!_0x498e2c||!_0x498e2c[_0x3a68('0x1c')])return;var _0x56d0d2,_0x1a31a9,_0x3faa12;logger['debug']('root',JSON['stringify'](_0x498e2c,null,0x2));_0x450cb3[_0x3a68('0x1d')]=moment()[_0x3a68('0x1e')](_0x3a68('0x1f'));_0x56d0d2=initGraph(_[_0x3a68('0x12')](_0x498e2c,_0x3a68('0x13')),_0x498e2c[_0x3a68('0x13')]);_0x1a31a9=new Vertices(_0x450cb3,rpc,mailRpc);logger['info'](util[_0x3a68('0x1e')](_0x3a68('0x20'),_0x450cb3[_0x3a68('0x21')],_0x450cb3[_0x3a68('0x22')],_0x450cb3[_0x3a68('0x23')],_0x450cb3[_0x3a68('0x24')],_0x450cb3[_0x3a68('0x25')]));_0x56d0d2[_0x3a68('0x26')](_0x498e2c['start']['id'],function(_0x127b30){try{_0x127b30=_0x1a31a9[_0x3a68('0x27')](_0x127b30);logger[_0x3a68('0x28')](_0x3a68('0x29'),JSON[_0x3a68('0x2a')](_0x127b30,null,0x2));if(_0x127b30['agicommand']===_0x3a68('0x2b')){logger['info'](_0x3a68('0x2c'));_0x450cb3[_0x3a68('0x2d')]=_0x127b30[_0x3a68('0x2d')]||_0x450cb3[_0x3a68('0x2d')];_0x450cb3[_0x3a68('0x2e')]=_0x127b30[_0x3a68('0x2e')];_0x450cb3[_0x3a68('0x2f')]=_0x127b30['priority']?_0x127b30[_0x3a68('0x2f')]-0x1:0x1;return null;}else if(_0x127b30&&_0x1a31a9[_0x127b30[_0x3a68('0x30')]]){_0x3faa12=_0x1a31a9[_0x127b30[_0x3a68('0x30')]](_0x127b30);logger[_0x3a68('0x31')](_0x3a68('0x32'),JSON[_0x3a68('0x2a')](_0x3faa12,null,0x2));if(_0x3faa12&&_0x3faa12['code']===AGI_CODE_SUCCESS&&_0x3faa12[_0x3a68('0x33')]!==AGI_RESULT_ERROR&&!_0x450cb3[_0x3a68('0x34')]){logger[_0x3a68('0x28')]('response',inspect(_0x3faa12));return _[_0x3a68('0x35')](_0x3faa12[_0x3a68('0x33')])?null:_0x3faa12['result'][_0x3a68('0x36')]();}else{logger[_0x3a68('0xb')](_0x3a68('0x32'),inspect(_0x3faa12));return null;}}else{logger[_0x3a68('0xb')](_0x3a68('0x37'));return null;}}catch(_0x37e40a){logger[_0x3a68('0xb')](_0x37e40a[_0x3a68('0xd')]);return null;}});if(_0x498e2c[_0x3a68('0x38')]){logger[_0x3a68('0x31')](util[_0x3a68('0x1e')](_0x3a68('0x39'),_0x450cb3[_0x3a68('0x21')],_0x450cb3[_0x3a68('0x22')],_0x450cb3[_0x3a68('0x23')],_0x450cb3['dnid'],_0x450cb3['uniqueid']));_0x56d0d2[_0x3a68('0x26')](_0x498e2c[_0x3a68('0x38')]['id'],function(_0x4d5c32){try{_0x4d5c32=_0x1a31a9['clear'](_0x4d5c32);logger[_0x3a68('0x28')](_0x3a68('0x29'),JSON[_0x3a68('0x2a')](_0x4d5c32,null,0x2));if(_0x4d5c32&&_0x1a31a9[_0x4d5c32[_0x3a68('0x30')]]){_0x3faa12=_0x1a31a9[_0x4d5c32[_0x3a68('0x30')]](_0x4d5c32);if(_0x3faa12){logger[_0x3a68('0x28')](_0x3a68('0x32'),inspect(_0x3faa12));return _[_0x3a68('0x35')](_0x3faa12['result'])?null:_0x3faa12[_0x3a68('0x33')][_0x3a68('0x36')]();}else{logger[_0x3a68('0xb')]('response',inspect(_0x3faa12));return null;}}else{logger[_0x3a68('0xb')](_0x3a68('0x37'));return null;}}catch(_0x222481){logger['error'](_0x222481['stack']);return null;}});}logger['info'](util['format'](_0x3a68('0x3a'),_0x450cb3[_0x3a68('0x21')],_0x450cb3[_0x3a68('0x22')],_0x450cb3[_0x3a68('0x23')],_0x450cb3[_0x3a68('0x24')],_0x450cb3['uniqueid']));logger[_0x3a68('0x31')](util[_0x3a68('0x1e')](_0x3a68('0x3b'),_0x450cb3['context'],_0x450cb3[_0x3a68('0x2e')],parseInt(_0x450cb3['priority'],0xa)+0x1));_0x450cb3[_0x3a68('0x3c')](_0x450cb3['context'],_0x450cb3[_0x3a68('0x2e')],parseInt(_0x450cb3[_0x3a68('0x2f')],0xa)+0x1);_0x450cb3[_0x3a68('0x3d')]();}function handleNotFound(_0x51cd31){logger['error'](util['format'](_0x3a68('0x3e'),_0x51cd31[_0x3a68('0x21')]));_0x51cd31['continueAt'](_0x51cd31[_0x3a68('0x2d')],_0x51cd31[_0x3a68('0x2e')],parseInt(_0x51cd31[_0x3a68('0x2f')],0xa)+0x1);_0x51cd31[_0x3a68('0x3d')]();}function handleUnpublished(_0x45ccaa){logger[_0x3a68('0xb')](util[_0x3a68('0x1e')]('Project\x20%s\x20not\x20published',_0x45ccaa['arg_1']));_0x45ccaa['continueAt'](_0x45ccaa[_0x3a68('0x2d')],_0x45ccaa[_0x3a68('0x2e')],parseInt(_0x45ccaa['priority'],0xa)+0x1);_0x45ccaa[_0x3a68('0x3d')]();}module[_0x3a68('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 09f0660..7ef254f 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 _0xadb4=['_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers','line','util','stream','call','_localBuffer'];(function(_0x32af46,_0xb38e36){var _0x5a5520=function(_0x42d5b9){while(--_0x42d5b9){_0x32af46['push'](_0x32af46['shift']());}};_0x5a5520(++_0xb38e36);}(_0xadb4,0x1b6));var _0x4adb=function(_0x23a005,_0x22877e){_0x23a005=_0x23a005-0x0;var _0x597995=_0xadb4[_0x23a005];return _0x597995;};'use strict';var util=require(_0x4adb('0x0'));var Transform=require(_0x4adb('0x1'))['Transform'];function AGIReply(_0x2b9f1a){Transform[_0x4adb('0x2')](this,_0x2b9f1a);this[_0x4adb('0x3')]='';this[_0x4adb('0x4')]=![];}util[_0x4adb('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x4adb('0x6')]=function(_0x101c73,_0x1f61b4,_0x18e9bf){var _0x5af492='\x0a',_0x14c07e=['\x0a\x0a',_0x4adb('0x7')],_0x15c33e=-0x1,_0x30c0b7=-0x1,_0x26ea0d='',_0x440b6f=0x0,_0x2ad622='',_0x5d5a5b='';this[_0x4adb('0x3')]+=_0x101c73['toString']();_0x2ad622=this['_localBuffer'];if(!this[_0x4adb('0x4')]){_0x440b6f=0x0;while(_0x14c07e[_0x440b6f]){while((_0x30c0b7=_0x2ad622[_0x4adb('0x8')](_0x14c07e[_0x440b6f]))!=-0x1){_0x26ea0d=_0x14c07e[_0x440b6f];_0x5d5a5b=_0x2ad622[_0x4adb('0x9')](0x0,_0x30c0b7);_0x2ad622=_0x2ad622[_0x4adb('0x9')](_0x30c0b7+_0x26ea0d[_0x4adb('0xa')]);var _0x53a4d9=_0x5d5a5b[_0x4adb('0xb')](_0x5af492),_0x2e6f46=0x0,_0x54f03b={},_0x1c47e7='',_0x41aae2='',_0x5ce781=-0x1;while(_0x53a4d9[_0x2e6f46]){_0x5ce781=_0x53a4d9[_0x2e6f46][_0x4adb('0x8')](':');if(_0x5ce781!=-0x1){_0x1c47e7=_0x53a4d9[_0x2e6f46][_0x4adb('0xc')](0x0,_0x5ce781)[_0x4adb('0xd')]();_0x41aae2=_0x53a4d9[_0x2e6f46]['slice'](_0x5ce781+0x1)[_0x4adb('0xd')]();if(_0x1c47e7[_0x4adb('0xa')]>0x0){_0x54f03b[_0x1c47e7]=_0x41aae2;}}else{}_0x2e6f46++;}this[_0x4adb('0xe')](_0x4adb('0xf'),_0x54f03b);this['_inBody']=!![];}_0x440b6f++;}this[_0x4adb('0x3')]=_0x2ad622;}else{while((_0x15c33e=_0x2ad622['indexOf'](_0x5af492))!=-0x1){_0x5d5a5b=_0x2ad622[_0x4adb('0x9')](0x0,_0x15c33e);this[_0x4adb('0xe')](_0x4adb('0x10'),_0x5d5a5b);_0x2ad622=_0x2ad622[_0x4adb('0x9')](_0x15c33e+_0x5af492[_0x4adb('0xa')]);}this[_0x4adb('0x3')]=_0x2ad622;}_0x18e9bf();};module['exports']=AGIReply; \ No newline at end of file +var _0x8bc8=['substring','length','split','slice','trim','headers','emit','line','exports','util','stream','Transform','_localBuffer','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf'];(function(_0x5f1f15,_0x411167){var _0x42b3a9=function(_0x109bc6){while(--_0x109bc6){_0x5f1f15['push'](_0x5f1f15['shift']());}};_0x42b3a9(++_0x411167);}(_0x8bc8,0xc4));var _0x88bc=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x8bc8[_0x5a7e78];return _0xa8d4a1;};'use strict';var util=require(_0x88bc('0x0'));var Transform=require(_0x88bc('0x1'))[_0x88bc('0x2')];function AGIReply(_0x325deb){Transform['call'](this,_0x325deb);this[_0x88bc('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x6a6b59,_0x538f65,_0x330a6e){var _0x57ded5='\x0a',_0x461948=['\x0a\x0a',_0x88bc('0x4')],_0x337252=-0x1,_0x30e9d7=-0x1,_0x206a6c='',_0x35e7f5=0x0,_0x4f9370='',_0x5ccdcf='';this['_localBuffer']+=_0x6a6b59[_0x88bc('0x5')]();_0x4f9370=this[_0x88bc('0x3')];if(!this[_0x88bc('0x6')]){_0x35e7f5=0x0;while(_0x461948[_0x35e7f5]){while((_0x30e9d7=_0x4f9370[_0x88bc('0x7')](_0x461948[_0x35e7f5]))!=-0x1){_0x206a6c=_0x461948[_0x35e7f5];_0x5ccdcf=_0x4f9370[_0x88bc('0x8')](0x0,_0x30e9d7);_0x4f9370=_0x4f9370[_0x88bc('0x8')](_0x30e9d7+_0x206a6c[_0x88bc('0x9')]);var _0x10386a=_0x5ccdcf[_0x88bc('0xa')](_0x57ded5),_0x2e02fb=0x0,_0x57266e={},_0x27379b='',_0x285007='',_0x21a4c1=-0x1;while(_0x10386a[_0x2e02fb]){_0x21a4c1=_0x10386a[_0x2e02fb]['indexOf'](':');if(_0x21a4c1!=-0x1){_0x27379b=_0x10386a[_0x2e02fb]['slice'](0x0,_0x21a4c1)['trim']();_0x285007=_0x10386a[_0x2e02fb][_0x88bc('0xb')](_0x21a4c1+0x1)[_0x88bc('0xc')]();if(_0x27379b['length']>0x0){_0x57266e[_0x27379b]=_0x285007;}}else{}_0x2e02fb++;}this['emit'](_0x88bc('0xd'),_0x57266e);this['_inBody']=!![];}_0x35e7f5++;}this[_0x88bc('0x3')]=_0x4f9370;}else{while((_0x337252=_0x4f9370[_0x88bc('0x7')](_0x57ded5))!=-0x1){_0x5ccdcf=_0x4f9370[_0x88bc('0x8')](0x0,_0x337252);this[_0x88bc('0xe')](_0x88bc('0xf'),_0x5ccdcf);_0x4f9370=_0x4f9370[_0x88bc('0x8')](_0x337252+_0x57ded5[_0x88bc('0x9')]);}this['_localBuffer']=_0x4f9370;}_0x330a6e();};module[_0x88bc('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9bf1bee..bdd3b2a 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 _0x8d0e=['Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5df0ce,_0x57c5cd){_0x5df0ce=_0x5df0ce-0x0;var _0x49e544=_0x8d0e[_0x5df0ce];return _0x49e544;};'use strict';var _=require(_0xe8d0('0x0'));var moment=require(_0xe8d0('0x1'));var jayson=require(_0xe8d0('0x2'));var client=jayson[_0xe8d0('0x3')][_0xe8d0('0x4')]({'port':0x2329});function request(_0x3584ab,_0x15521e){return new Promise(function(_0x940176,_0x32cee9){return client['request'](_0x3584ab,_0x15521e)[_0xe8d0('0x5')](function(_0x482e4e){if(_0x482e4e['error']){return _0x32cee9(_0x482e4e[_0xe8d0('0x6')][_0xe8d0('0x7')]);}else{return _0x940176(_0x482e4e[_0xe8d0('0x8')]);}})[_0xe8d0('0x9')](function(_0x2b6dce){return _0x32cee9(_0x2b6dce);});});}exports[_0xe8d0('0xa')]=function(){return request(_0xe8d0('0xb'),{'options':{'raw':![],'attributes':['id',_0xe8d0('0xc'),'production']}});};exports[_0xe8d0('0xd')]=function(_0x19c3d0){return request(_0xe8d0('0xe'),{'options':{'raw':![],'where':{'name':_0x19c3d0},'attributes':['production']}});};exports['getMailAccountById']=function(_0x42e0c2){return request(_0xe8d0('0xf'),{'options':{'raw':![],'where':{'id':_0x42e0c2},'include':[{'model':_0xe8d0('0x10'),'as':_0xe8d0('0x11'),'include':[{'model':_0xe8d0('0x12'),'as':_0xe8d0('0x12')}]}],'attributes':['id','name',_0xe8d0('0x13')],'smtp':!![]}});};exports[_0xe8d0('0x14')]=function(_0x533b42){return request(_0xe8d0('0xe'),{'options':{'where':{'id':_0x533b42},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x90a1ea){return request(_0xe8d0('0x15'),{'options':{'where':{'id':_0x90a1ea},'attributes':[_0xe8d0('0xc')]}});};exports[_0xe8d0('0x16')]=function(_0x15d3a1){return request(_0xe8d0('0x17'),{'options':{'where':{'id':_0x15d3a1},'attributes':['name']}});};exports[_0xe8d0('0x18')]=function(_0x49554d){return request(_0xe8d0('0x19'),{'options':{'where':{'id':_0x49554d},'attributes':[_0xe8d0('0x1a')]}});};exports[_0xe8d0('0x1b')]=function(_0x4d1db4){return request('ShowUser',{'options':{'where':{'id':_0x4d1db4},'attributes':['name']}});};exports[_0xe8d0('0x1c')]=function(_0x384854){return request(_0xe8d0('0x1d'),{'options':{'where':{'phone':_0x384854[_0xe8d0('0x1e')]},'attributes':['id']}});};exports[_0xe8d0('0x1f')]=function(_0x588133){return request(_0xe8d0('0x20'),{'options':{'where':{'id':_0x588133},'attributes':[_0xe8d0('0xc')]}});};exports['getSoundById']=function(_0x5ce284){return request('ShowSound',{'options':{'where':{'id':_0x5ce284},'attributes':[_0xe8d0('0x21')]}});};exports[_0xe8d0('0x22')]=function(_0x25363b){return request(_0xe8d0('0x23'),{'options':{'raw':![],'where':{'id':_0x25363b},'include':[{'model':_0xe8d0('0x24'),'as':_0xe8d0('0x25')}]}});};exports[_0xe8d0('0x26')]=function(_0x28a6b5){return request(_0xe8d0('0x27'),{'options':{'where':{'id':_0x28a6b5},'attributes':['id','name']}});};exports[_0xe8d0('0x28')]=function(_0x9f747){return request('CreateSmsMessage',{'body':_0x9f747});};exports[_0xe8d0('0x29')]=function(_0x2e69d1){return request(_0xe8d0('0x2a'),{'body':_0x2e69d1});};exports[_0xe8d0('0x2b')]=function(_0x146783){return request(_0xe8d0('0x2c'),{'body':_[_0xe8d0('0x2d')](_0x146783,{'project_name':_0x146783[_0xe8d0('0x2e')],'prev_project_name':_0x146783[_0xe8d0('0x2f')]||'','is_subproject':_0x146783[_0xe8d0('0x2f')]?!![]:![],'leaveAt':moment()[_0xe8d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xe8d0('0x31')]=function(_0x26dd52){return request(_0xe8d0('0x32'),{'body':_0x26dd52});};exports['createSquareMessage']=function(_0x10a30b){return request(_0xe8d0('0x33'),{'body':_0x10a30b});};exports['createCmContact']=function(_0x1519e2){return request(_0xe8d0('0x34'),{'options':{'raw':![],'where':{'phone':_0x1519e2[_0xe8d0('0x1e')],'ListId':_0x1519e2[_0xe8d0('0x35')]}}})[_0xe8d0('0x5')](function(_0x495064){if(_0x495064){return _0x495064;}return request(_0xe8d0('0x36'),{'body':_0x1519e2});});};exports['getPauseById']=function(_0x5d3276){return request('ShowPause',{'options':{'where':{'id':_0x5d3276},'attributes':[_0xe8d0('0xc')]}});};exports[_0xe8d0('0x37')]=function(_0x36ccec,_0x5151fa){return request('LoginUser',{'body':{'interface':_0x5151fa},'options':{'where':_0x36ccec}});};exports[_0xe8d0('0x38')]=function(_0x551999,_0x3b5d31,_0x383084){return request(_0xe8d0('0x39'),{'body':{'type':_0x3b5d31,'uniqueid':_0x383084},'options':{'where':_0x551999}});};exports[_0xe8d0('0x3a')]=function(_0x2277cf){return request('UnpauseUser',{'body':{},'options':{'where':_0x2277cf}});};exports[_0xe8d0('0x3b')]=function(_0x4db53c){return request(_0xe8d0('0x3c'),{'body':{},'options':{'where':_0x4db53c}});}; \ No newline at end of file +var _0x95f4=['agentLogout','lodash','moment','jayson/promise','request','then','error','message','result','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x95f4,0xf1));var _0x495f=function(_0x2b6876,_0x193ced){_0x2b6876=_0x2b6876-0x0;var _0x5e613e=_0x95f4[_0x2b6876];return _0x5e613e;};'use strict';var _=require(_0x495f('0x0'));var moment=require(_0x495f('0x1'));var jayson=require(_0x495f('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x13cd43,_0x3dbbc5){return new Promise(function(_0x5edb36,_0x501377){return client[_0x495f('0x3')](_0x13cd43,_0x3dbbc5)[_0x495f('0x4')](function(_0x1bc28e){if(_0x1bc28e['error']){return _0x501377(_0x1bc28e[_0x495f('0x5')][_0x495f('0x6')]);}else{return _0x5edb36(_0x1bc28e[_0x495f('0x7')]);}})['catch'](function(_0x2103a4){return _0x501377(_0x2103a4);});});}exports[_0x495f('0x8')]=function(){return request(_0x495f('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x495f('0xa')]=function(_0x48c225){return request(_0x495f('0xb'),{'options':{'raw':![],'where':{'name':_0x48c225},'attributes':['production']}});};exports[_0x495f('0xc')]=function(_0x41aa07){return request(_0x495f('0xd'),{'options':{'raw':![],'where':{'id':_0x41aa07},'include':[{'model':_0x495f('0xe'),'as':'Smtp','include':[{'model':_0x495f('0xf'),'as':_0x495f('0xf')}]}],'attributes':['id',_0x495f('0x10'),_0x495f('0x11')],'smtp':!![]}});};exports[_0x495f('0x12')]=function(_0x4d71bb){return request(_0x495f('0xb'),{'options':{'where':{'id':_0x4d71bb},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x13')]=function(_0x3ce068){return request(_0x495f('0x14'),{'options':{'where':{'id':_0x3ce068},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x15')]=function(_0x5ad821){return request(_0x495f('0x16'),{'options':{'where':{'id':_0x5ad821},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x17')]=function(_0x135ebd){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x135ebd},'attributes':[_0x495f('0x18')]}});};exports[_0x495f('0x19')]=function(_0x4a0f0f){return request(_0x495f('0x1a'),{'options':{'where':{'id':_0x4a0f0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x1b')]=function(_0x58bcc9){return request(_0x495f('0x1c'),{'options':{'where':{'phone':_0x58bcc9[_0x495f('0x1d')]},'attributes':['id']}});};exports[_0x495f('0x1e')]=function(_0x427c0f){return request('ShowTrunk',{'options':{'where':{'id':_0x427c0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x1f')]=function(_0x5f2530){return request(_0x495f('0x20'),{'options':{'where':{'id':_0x5f2530},'attributes':['save_name']}});};exports[_0x495f('0x21')]=function(_0x3883be){return request(_0x495f('0x22'),{'options':{'raw':![],'where':{'id':_0x3883be},'include':[{'model':_0x495f('0x23'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x75d4de){return request('ShowSmsAccount',{'options':{'where':{'id':_0x75d4de},'attributes':['id',_0x495f('0x10')]}});};exports[_0x495f('0x24')]=function(_0x59ffb2){return request(_0x495f('0x25'),{'body':_0x59ffb2});};exports[_0x495f('0x26')]=function(_0x1fd91e){return request(_0x495f('0x27'),{'body':_0x1fd91e});};exports[_0x495f('0x28')]=function(_0xdd67c4){return request('CreateSquareReport',{'body':_['merge'](_0xdd67c4,{'project_name':_0xdd67c4[_0x495f('0x29')],'prev_project_name':_0xdd67c4[_0x495f('0x2a')]||'','is_subproject':_0xdd67c4[_0x495f('0x2a')]?!![]:![],'leaveAt':moment()[_0x495f('0x2b')](_0x495f('0x2c'))})});};exports[_0x495f('0x2d')]=function(_0x5bb254){return request(_0x495f('0x2e'),{'body':_0x5bb254});};exports[_0x495f('0x2f')]=function(_0x5ee2f7){return request(_0x495f('0x30'),{'body':_0x5ee2f7});};exports[_0x495f('0x31')]=function(_0x34322c){return request(_0x495f('0x32'),{'options':{'raw':![],'where':{'phone':_0x34322c['phone'],'ListId':_0x34322c[_0x495f('0x33')]}}})[_0x495f('0x4')](function(_0x28a1fb){if(_0x28a1fb){return _0x28a1fb;}return request(_0x495f('0x34'),{'body':_0x34322c});});};exports[_0x495f('0x35')]=function(_0x3b8f0f){return request(_0x495f('0x36'),{'options':{'where':{'id':_0x3b8f0f},'attributes':[_0x495f('0x10')]}});};exports[_0x495f('0x37')]=function(_0x1933cf,_0x1e88ea){return request('LoginUser',{'body':{'interface':_0x1e88ea},'options':{'where':_0x1933cf}});};exports[_0x495f('0x38')]=function(_0x3f67ce,_0x2be0ab,_0x2e9e8c){return request(_0x495f('0x39'),{'body':{'type':_0x2be0ab,'uniqueid':_0x2e9e8c},'options':{'where':_0x3f67ce}});};exports['agentUnpause']=function(_0x2ce9ba){return request(_0x495f('0x3a'),{'body':{},'options':{'where':_0x2ce9ba}});};exports[_0x495f('0x3b')]=function(_0x3593b1){return request('LogoutUser',{'body':{},'options':{'where':_0x3593b1}});}; \ 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 d186257..3ff727e 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 _0xca84=['./lex','exports','./polly'];(function(_0x461a07,_0x286cd5){var _0x32841a=function(_0x40f211){while(--_0x40f211){_0x461a07['push'](_0x461a07['shift']());}};_0x32841a(++_0x286cd5);}(_0xca84,0xf5));var _0x4ca8=function(_0xd8cb0a,_0x3bcd29){_0xd8cb0a=_0xd8cb0a-0x0;var _0x1ba9a0=_0xca84[_0xd8cb0a];return _0x1ba9a0;};var polly=require(_0x4ca8('0x0'));var lex=require(_0x4ca8('0x1'));module[_0x4ca8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6f7b=['./lex','exports'];(function(_0x3c6e52,_0x5bc949){var _0x3e8825=function(_0x595424){while(--_0x595424){_0x3c6e52['push'](_0x3c6e52['shift']());}};_0x3e8825(++_0x5bc949);}(_0x6f7b,0x168));var _0xb6f7=function(_0x1dbeec,_0x4f0320){_0x1dbeec=_0x1dbeec-0x0;var _0x3b00b0=_0x6f7b[_0x1dbeec];return _0x3b00b0;};var polly=require('./polly');var lex=require(_0xb6f7('0x0'));module[_0xb6f7('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 6c6d4a1..1888b38 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0x6c76=['./lib/api','exports'];(function(_0xc3aadc,_0x33e8b4){var _0x114607=function(_0x4aee64){while(--_0x4aee64){_0xc3aadc['push'](_0xc3aadc['shift']());}};_0x114607(++_0x33e8b4);}(_0x6c76,0x184));var _0x66c7=function(_0x5a2ad9,_0x4530ac){_0x5a2ad9=_0x5a2ad9-0x0;var _0x24fb9a=_0x6c76[_0x5a2ad9];return _0x24fb9a;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ 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 62f2322..f28dbc9 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(_0x5724ff,_0x3160e3){var _0x4078f4=function(_0x466d2a){while(--_0x466d2a){_0x5724ff['push'](_0x5724ff['shift']());}};_0x4078f4(++_0x3160e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2e7018,_0xfa4dea){var _0xb406a4=function(_0x20077f){while(--_0x20077f){_0x2e7018['push'](_0x2e7018['shift']());}};_0xb406a4(++_0xfa4dea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 0f77df2..ed3d4c0 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x17a32a,_0x3dc335,_0x5f12eb,_0xd65be4,_0x46c785,_0x548830,_0x22a1e7){return polly(_0x17a32a,_0x3dc335,_0x5f12eb,_0xd65be4,_0x46c785,_0x548830,_0x22a1e7);}; \ No newline at end of file +var _0xc1a4=['./lib/api','exports'];(function(_0x2d37a8,_0x4101c0){var _0x1a4dc8=function(_0x41d469){while(--_0x41d469){_0x2d37a8['push'](_0x2d37a8['shift']());}};_0x1a4dc8(++_0x4101c0);}(_0xc1a4,0x88));var _0x4c1a=function(_0xbf18a6,_0x134eda){_0xbf18a6=_0xbf18a6-0x0;var _0x3dbb0c=_0xc1a4[_0xbf18a6];return _0x3dbb0c;};'use strict';var polly=require(_0x4c1a('0x0'));module[_0x4c1a('0x1')]=function(_0x874f5,_0x3f584e,_0x35aca9,_0x4f3d09,_0x42dd0f,_0x4d26a8,_0x2ebac1){return polly(_0x874f5,_0x3f584e,_0x35aca9,_0x4f3d09,_0x42dd0f,_0x4d26a8,_0x2ebac1);}; \ 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 931db01..cffa387 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 _0x7073=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x2bc867,_0x3b62d5){var _0x4d2bf1=function(_0x10c0ed){while(--_0x10c0ed){_0x2bc867['push'](_0x2bc867['shift']());}};_0x4d2bf1(++_0x3b62d5);}(_0x7073,0x126));var _0x3707=function(_0x26ce5f,_0x30c33d){_0x26ce5f=_0x26ce5f-0x0;var _0xb72e28=_0x7073[_0x26ce5f];return _0xb72e28;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x3707('0x0'));var rs=require(_0x3707('0x1'));var AWS=require(_0x3707('0x2'));function pollyResult(_0xa84a7c,_0x43bc2e,_0x3f306a){return new BPromise(function(_0x496042,_0x54b4bf){_0xa84a7c[_0x3707('0x3')](_0x43bc2e,function(_0x20adeb,_0x58d0cf){if(_0x20adeb){_0x54b4bf(_0x20adeb);}else if(_0x58d0cf){if(_0x58d0cf[_0x3707('0x4')]instanceof Buffer){fs[_0x3707('0x5')](_0x3f306a,_0x58d0cf[_0x3707('0x4')],function(_0x20b4e1){if(_0x20b4e1){_0x54b4bf(_0x20b4e1);}else{_0x496042();}});}else{_0x54b4bf(new Error(_0x3707('0x6')));}}else{_0x54b4bf(new Error(_0x3707('0x7')));}});});}module[_0x3707('0x8')]=function(_0x7ec558,_0x357f9e,_0x4ca48d,_0x3b89b0,_0x1daf68,_0x3322c8,_0x27dec2){var _0x57043a=new AWS[(_0x3707('0x9'))]({'accessKeyId':_0x7ec558,'secretAccessKey':_0x357f9e,'region':_0x4ca48d});var _0x29efbf={'Text':_0x1daf68,'TextType':_0x3322c8||_0x3707('0xa'),'OutputFormat':_0x3707('0xb'),'VoiceId':_0x3b89b0};return pollyResult(_0x57043a,_0x29efbf,_0x27dec2);}; \ No newline at end of file +var _0xc0db=['bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x56ed6a,_0x5b8578){var _0x1136e7=function(_0x295d7a){while(--_0x295d7a){_0x56ed6a['push'](_0x56ed6a['shift']());}};_0x1136e7(++_0x5b8578);}(_0xc0db,0xef));var _0xbc0d=function(_0x5d0825,_0x4876cf){_0x5d0825=_0x5d0825-0x0;var _0x284e5e=_0xc0db[_0x5d0825];return _0x284e5e;};'use strict';var fs=require('fs');var path=require(_0xbc0d('0x0'));var BPromise=require(_0xbc0d('0x1'));var rs=require(_0xbc0d('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x6633b1,_0x3fb848,_0xd6b8c8){return new BPromise(function(_0x345e4f,_0x4d9728){_0x6633b1[_0xbc0d('0x3')](_0x3fb848,function(_0x17ea0b,_0x5905d8){if(_0x17ea0b){_0x4d9728(_0x17ea0b);}else if(_0x5905d8){if(_0x5905d8[_0xbc0d('0x4')]instanceof Buffer){fs[_0xbc0d('0x5')](_0xd6b8c8,_0x5905d8[_0xbc0d('0x4')],function(_0xdafdde){if(_0xdafdde){_0x4d9728(_0xdafdde);}else{_0x345e4f();}});}else{_0x4d9728(new Error(_0xbc0d('0x6')));}}else{_0x4d9728(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xbc0d('0x7')]=function(_0x2c34cb,_0x2fc534,_0xe3af96,_0x513888,_0x2629fe,_0x564682,_0x5d025f){var _0xc2d246=new AWS[(_0xbc0d('0x8'))]({'accessKeyId':_0x2c34cb,'secretAccessKey':_0x2fc534,'region':_0xe3af96});var _0x5879d2={'Text':_0x2629fe,'TextType':_0x564682||_0xbc0d('0x9'),'OutputFormat':'mp3','VoiceId':_0x513888};return pollyResult(_0xc2d246,_0x5879d2,_0x5d025f);}; \ 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 1190fe9..6645711 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 _0x567d=['./lib/api','exports'];(function(_0x38e686,_0x167107){var _0x302ec0=function(_0x429bdc){while(--_0x429bdc){_0x38e686['push'](_0x38e686['shift']());}};_0x302ec0(++_0x167107);}(_0x567d,0x1cc));var _0xd567=function(_0x428a55,_0x357244){_0x428a55=_0x428a55-0x0;var _0x346549=_0x567d[_0x428a55];return _0x346549;};'use strict';var asr=require(_0xd567('0x0'));module[_0xd567('0x1')]=function(_0x308736,_0x4c92b9,_0x197907,_0x557083){return asr(_0x308736,_0x4c92b9,_0x197907);}; \ No newline at end of file +var _0x9191=['exports','./lib/api'];(function(_0x1c7de8,_0x1b9a17){var _0x1bbdbb=function(_0x4a8e69){while(--_0x4a8e69){_0x1c7de8['push'](_0x1c7de8['shift']());}};_0x1bbdbb(++_0x1b9a17);}(_0x9191,0xb9));var _0x1919=function(_0x45b2ac,_0x3010da){_0x45b2ac=_0x45b2ac-0x0;var _0x304bf3=_0x9191[_0x45b2ac];return _0x304bf3;};'use strict';var asr=require(_0x1919('0x0'));module[_0x1919('0x1')]=function(_0x1f1a2d,_0x32680d,_0x2e842e,_0x2344de){return asr(_0x1f1a2d,_0x32680d,_0x2e842e);}; \ 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 4cbc334..2176307 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 _0x6658=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0xebf3f3,_0x183b97){var _0x3141ac=function(_0x1d7cc5){while(--_0x1d7cc5){_0xebf3f3['push'](_0xebf3f3['shift']());}};_0x3141ac(++_0x183b97);}(_0x6658,0x198));var _0x8665=function(_0x29440c,_0x1cc1bd){_0x29440c=_0x29440c-0x0;var _0x37f012=_0x6658[_0x29440c];return _0x37f012;};'use strict';var url=require(_0x8665('0x0'));var BPromise=require(_0x8665('0x1'));var fs=require('fs');var host=_0x8665('0x2');module[_0x8665('0x3')]=function(_0x45eb4a,_0x454e7c,_0x252590){return new BPromise(function(_0x49b4d3,_0x4f1343){var _0xf643d8;if(typeof _0x45eb4a!==_0x8665('0x4')||_0x45eb4a['length']===0x0){return _0x4f1343('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x454e7c!==_0x8665('0x4')||_0x454e7c[_0x8665('0x5')]===0x0){return _0x4f1343(_0x8665('0x6'));}if(typeof _0x252590!==_0x8665('0x7')&&(typeof _0x252590!==_0x8665('0x4')||_0x252590[_0x8665('0x5')]===0x0)){return _0x4f1343(_0x8665('0x8'));}try{_0xf643d8=fs[_0x8665('0x9')](_0x45eb4a)['toString'](_0x8665('0xa'));}catch(_0x20da7d){return _0x4f1343(_0x20da7d);}return _0x49b4d3({'method':_0x8665('0xb'),'uri':host+_0x8665('0xc')+_0x454e7c,'body':{'config':{'encoding':_0x8665('0xd'),'sampleRateHertz':_0x8665('0xe'),'languageCode':_0x252590},'audio':{'content':_0xf643d8}},'json':!![]});});}; \ No newline at end of file +var _0x6737=['/v1/speech:recognize?key=','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length','readFileSync','toString','POST'];(function(_0x9edb44,_0x47ca75){var _0x527ab4=function(_0xaa38d3){while(--_0xaa38d3){_0x9edb44['push'](_0x9edb44['shift']());}};_0x527ab4(++_0x47ca75);}(_0x6737,0xe2));var _0x7673=function(_0x293e46,_0x1a04cd){_0x293e46=_0x293e46-0x0;var _0xb5c32c=_0x6737[_0x293e46];return _0xb5c32c;};'use strict';var url=require('url');var BPromise=require(_0x7673('0x0'));var fs=require('fs');var host=_0x7673('0x1');module['exports']=function(_0x2f05d4,_0x2a9cd0,_0x43ee27){return new BPromise(function(_0x12efff,_0x54002e){var _0x32e6f2;if(typeof _0x2f05d4!==_0x7673('0x2')||_0x2f05d4['length']===0x0){return _0x54002e(_0x7673('0x3'));}if(typeof _0x2a9cd0!==_0x7673('0x2')||_0x2a9cd0['length']===0x0){return _0x54002e('key\x20should\x20be\x20a\x20string');}if(typeof _0x43ee27!=='undefined'&&(typeof _0x43ee27!=='string'||_0x43ee27[_0x7673('0x4')]===0x0)){return _0x54002e('lang\x20should\x20be\x20a\x20string');}try{_0x32e6f2=fs[_0x7673('0x5')](_0x2f05d4)[_0x7673('0x6')]('base64');}catch(_0x29fdbc){return _0x54002e(_0x29fdbc);}return _0x12efff({'method':_0x7673('0x7'),'uri':host+_0x7673('0x8')+_0x2a9cd0,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x43ee27},'audio':{'content':_0x32e6f2}},'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 518f2c0..8ceed45 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 _0xa675=['exports','./asr'];(function(_0x42d937,_0x11c52c){var _0x132039=function(_0x138b1a){while(--_0x138b1a){_0x42d937['push'](_0x42d937['shift']());}};_0x132039(++_0x11c52c);}(_0xa675,0x1d3));var _0x5a67=function(_0x47e50b,_0x1fdec6){_0x47e50b=_0x47e50b-0x0;var _0x2e6fb3=_0xa675[_0x47e50b];return _0x2e6fb3;};var asr=require(_0x5a67('0x0'));module[_0x5a67('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3adc=['exports','./asr'];(function(_0x4a4b58,_0x29f567){var _0x4ab2d0=function(_0x3d4195){while(--_0x3d4195){_0x4a4b58['push'](_0x4a4b58['shift']());}};_0x4ab2d0(++_0x29f567);}(_0x3adc,0x1d3));var _0xc3ad=function(_0x1c287d,_0x14c316){_0x1c287d=_0x1c287d-0x0;var _0x4c6d78=_0x3adc[_0x1c287d];return _0x4c6d78;};var asr=require(_0xc3ad('0x0'));module[_0xc3ad('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 8cb1cee..ecd12e0 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 _0x56bd=['result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','metadata','endConversation','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','text','channelData','CustomAction','CustomActionData','Data','dirName','apiai-promise','dialogflow','http','https','path','querystring','randomstring','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','close','unlink','download\x20error','WHAT_EVER','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','777','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','length','lang\x20\x22','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow'];(function(_0x2ace01,_0x3d1f22){var _0x4cfede=function(_0x90f268){while(--_0x90f268){_0x2ace01['push'](_0x2ace01['shift']());}};_0x4cfede(++_0x3d1f22);}(_0x56bd,0xb7));var _0xd56b=function(_0x408d1d,_0x44afec){_0x408d1d=_0x408d1d-0x0;var _0x4e0b77=_0x56bd[_0x408d1d];return _0x4e0b77;};'use strict';var apiai=require(_0xd56b('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xd56b('0x1'));var fs=require('fs');var http=require(_0xd56b('0x2'));var https=require(_0xd56b('0x3'));var md5=require('md5');var path=require(_0xd56b('0x4'));var querystring=require(_0xd56b('0x5'));var rp=require('request-promise');var rs=require(_0xd56b('0x6'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xd56b('0x7'))['parse'];var util=require(_0xd56b('0x8'));var aws=require(_0xd56b('0x9'));var google=require(_0xd56b('0xa'));var sestek=require(_0xd56b('0xb'));var tilde=require(_0xd56b('0xc'));var logger=require(_0xd56b('0xd'))(_0xd56b('0xe'));var ISPEECH_API=_0xd56b('0xf');function downloadFile(_0x1ab50f,_0x3f6f1c){return new BPromise(function(_0x57f57d,_0x6c2d5b){var _0x4870f9=urlParse(_0x1ab50f);var _0x2d6b03=_0x4870f9[_0xd56b('0x10')]===_0xd56b('0x11')?https:http;var _0x3836f7={'host':_0x4870f9[_0xd56b('0x12')],'path':_0x4870f9['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2d6b03['get'](_0x3836f7,function(_0x42bb98){if(_0x42bb98[_0xd56b('0x13')]!==0xc8){logger[_0xd56b('0x14')](_0xd56b('0x15')+_0x1ab50f+_0xd56b('0x16')+_0x42bb98[_0xd56b('0x13')]+'\x20('+_0x42bb98[_0xd56b('0x17')]+')');_0x6c2d5b(new Error(_0xd56b('0x15')+_0x1ab50f+_0xd56b('0x16')+_0x42bb98[_0xd56b('0x13')]+'\x20('+_0x42bb98[_0xd56b('0x17')]+')'));return;}var _0x29ec78=fs['createWriteStream'](_0x3f6f1c);_0x29ec78['on'](_0xd56b('0x18'),function(){logger[_0xd56b('0x19')]('finish\x20download\x20file');_0x29ec78[_0xd56b('0x1a')](_0x57f57d);});_0x29ec78['on']('error',function(_0x3ad9c1){fs[_0xd56b('0x1b')](_0x3f6f1c);logger[_0xd56b('0x14')](_0xd56b('0x1c'),_0x3ad9c1);_0x6c2d5b(_0x3ad9c1);});_0x42bb98['pipe'](_0x29ec78);})['on']('error',function(_0x1e3ed1){logger[_0xd56b('0x14')](_0x1e3ed1);_0x6c2d5b(_0x1e3ed1);})['end']();});}function uploadFile(_0x575221){return new BPromise(function(_0x169245,_0x4687df){var _0x1957f9=urlParse(_0x575221);var _0x456eca=_0x1957f9[_0xd56b('0x10')]===_0xd56b('0x11')?https:http;var _0x5a1152={'host':_0x1957f9[_0xd56b('0x12')],'path':_0x1957f9[_0xd56b('0x4')],'headers':{'user-agent':_0xd56b('0x1d')}};_0x456eca['get'](_0x5a1152,function(_0x1af3fc){if(_0x1af3fc['statusCode']!==0xc8){_0x4687df(new Error(_0xd56b('0x15')+_0x575221+_0xd56b('0x16')+_0x1af3fc[_0xd56b('0x13')]+'\x20('+_0x1af3fc['statusMessage']+')'));return;}var _0x332137='';_0x1af3fc['on'](_0xd56b('0x1e'),function(_0x5c9eaa){_0x332137+=_0x5c9eaa;});_0x1af3fc['on'](_0xd56b('0x1f'),function(){_0x169245(_0x332137);});})['on']('error',function(_0x1c9a70){_0x4687df(_0x1c9a70);})[_0xd56b('0x1f')]();});}function convertFile(_0x50c390,_0x5cb8a6){return new BPromise(function(_0xb2c29a,_0x1be878){var _0x1f3c62=sox[_0xd56b('0x20')](_0x50c390,_0x5cb8a6,{'sampleRate':0x1f40,'format':_0xd56b('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f3c62['on'](_0xd56b('0x14'),function(_0x11d49c){logger[_0xd56b('0x14')](_0xd56b('0x22'),_0x11d49c);_0x1be878(_0x11d49c);});_0x1f3c62['on'](_0xd56b('0x1f'),function(){logger['info'](_0xd56b('0x23'));_0xb2c29a();});_0x1f3c62[_0xd56b('0x24')]();});}function base64Decode(_0xad31a8,_0x23e179){var _0x10cc01=path[_0xd56b('0x25')](__dirname,_0xd56b('0x26'),rs[_0xd56b('0x27')](0x4)+_0xd56b('0x28'));fs['writeFileSync'](_0x10cc01,_0xad31a8,_0xd56b('0x29'));return convertFile(_0x10cc01,_0x23e179)['then'](function(){try{fs['unlink'](_0x10cc01);fs[_0xd56b('0x2a')](_0x23e179,'777');}catch(_0x36554f){logger[_0xd56b('0x14')](_0x36554f);}return _0x23e179[_0xd56b('0x2b')]('.')[0x0];});}function base64Encode(_0x251328){var _0x275f41=fs[_0xd56b('0x2c')](_0x251328);return new Buffer(_0x275f41)[_0xd56b('0x2d')]('base64');}exports[_0xd56b('0x2e')]=function(_0x1ab5e9,_0x41757c,_0x11a035,_0x3f5014,_0x3eebe8,_0x1483e5){var _0x2cc695,_0x45cf04;var _0x20a13f=_0xd56b('0x2f');var _0x2512c7=_0xd56b('0x30')+_0x1ab5e9;var _0x34a554={};if(_0x41757c===_0xd56b('0x31')){_0x34a554[_0xd56b('0x32')]={'ssml':_0x11a035};}else{_0x34a554[_0xd56b('0x32')]={'text':_0x11a035};};_0x34a554[_0xd56b('0x33')]={'languageCode':_0x3f5014,'ssmlGender':_0x3eebe8};_0x34a554[_0xd56b('0x34')]={'audioEncoding':_0xd56b('0x35'),'sampleRateHertz':0x1f40};var _0x5a6ea3={'url':_0x20a13f+_0xd56b('0x36')+_0x2512c7,'method':_0xd56b('0x37'),'json':!![],'body':_0x34a554};return rp(_0x5a6ea3)[_0xd56b('0x38')](function(_0x14e3ac){return new BPromise(function(_0x47c1dc,_0x516964){_0x2cc695=path['resolve'](__dirname,_0xd56b('0x26'),rs['generate'](0x4)+_0xd56b('0x39'));var _0x20f8fa=Buffer[_0xd56b('0x3a')](_0x14e3ac[_0xd56b('0x3b')],_0xd56b('0x29'));return fs[_0xd56b('0x3c')](_0x2cc695,_0x20f8fa,function(_0x2f1d21){_0x516964(_0x2f1d21);},function(_0x58225f){fs['chmodSync'](_0x2cc695,'777');_0x47c1dc(_0x58225f);});});})['then'](function(_0x9f2792){_0x45cf04=path[_0xd56b('0x25')](__dirname,'tmp',rs[_0xd56b('0x27')](0x4)+_0xd56b('0x28'));return convertFile(_0x2cc695,_0x45cf04);})[_0xd56b('0x38')](function(){try{fs[_0xd56b('0x1b')](_0x2cc695);fs[_0xd56b('0x2a')](_0x45cf04,_0xd56b('0x3d'));}catch(_0x5d947e){logger['error'](_0x5d947e);}logger[_0xd56b('0x19')]('googleCloudTTS\x20path',_0x45cf04[_0xd56b('0x2b')]('.')[0x0]);return _0x45cf04[_0xd56b('0x2b')]('.')[0x0];});};exports[_0xd56b('0x3e')]=function(_0x35ba48,_0x1c608b){var _0x2e6d5b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x355634,_0x25b292;var _0x293fbf;var _0x2eeae8={'encoding':_0xd56b('0x3f'),'method':_0xd56b('0x37'),'timeout':0x2710,'url':_0x2e6d5b,'headers':{'Content-Type':_0xd56b('0x40')},'body':_0xd56b('0x41')+encodeURIComponent(JSON[_0xd56b('0x42')]([[[_0xd56b('0x43'),JSON[_0xd56b('0x42')]([_0x35ba48,_0x1c608b||'en',![],'null']),null,_0xd56b('0x44')]]]))};return rp(_0x2eeae8)[_0xd56b('0x38')](function(_0xa53878){try{_0x293fbf=eval(_0xa53878['slice'](0x5))[0x0][0x2];}catch(_0x42ad1d){throw new Error('parse\x20response\x20failed:\x0a'+_0xa53878[_0xd56b('0x1e')]);}if(!_0x293fbf){if(_0x35ba48[_0xd56b('0x45')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd56b('0x46')+_0x1c608b+'\x22\x20might\x20not\x20exist');}}try{_0x293fbf=eval(_0x293fbf)[0x0];}catch(_0x144651){throw new Error(_0xd56b('0x47')+res[_0xd56b('0x1e')]);}const _0x821842=_0x293fbf;_0x355634=path[_0xd56b('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xd56b('0x39'));fs[_0xd56b('0x48')](_0x355634,_0x293fbf,{'encoding':'base64'});_0x25b292=path[_0xd56b('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xd56b('0x28'));return convertFile(_0x355634,_0x25b292);})[_0xd56b('0x38')](function(){try{fs[_0xd56b('0x1b')](_0x355634);fs[_0xd56b('0x2a')](_0x25b292,'777');}catch(_0x4467f2){logger[_0xd56b('0x14')](_0x4467f2);}logger[_0xd56b('0x19')](_0xd56b('0x49'),_0x25b292[_0xd56b('0x2b')]('.')[0x0]);return _0x25b292[_0xd56b('0x2b')]('.')[0x0];});};exports[_0xd56b('0x4a')]=function(_0x1a35ad,_0x300552,_0x173da3){return google[_0xd56b('0x4b')](_0x1a35ad,_0x300552,_0x173da3)[_0xd56b('0x38')](function(_0x1f4617){logger['info'](_0x1f4617[_0xd56b('0x4c')]);return rp(_0x1f4617);})[_0xd56b('0x38')](function(_0x10805e){var _0xe95fd='';var _0x54c85c=0x0;try{fs[_0xd56b('0x1b')](_0x1a35ad);}catch(_0x37a76a){logger[_0xd56b('0x14')](_0x37a76a);}if(_0x10805e&&_0x10805e[_0xd56b('0x4d')]){_0xe95fd=_0x10805e[_0xd56b('0x4d')][_0xd56b('0x4e')](function(_0x300d01){return _0x300d01&&_0x300d01[_0xd56b('0x4f')][0x0]&&_0x300d01[_0xd56b('0x4f')][0x0][_0xd56b('0x50')]?_0x300d01[_0xd56b('0x4f')][0x0][_0xd56b('0x50')]:'';})[_0xd56b('0x51')]('\x0a');_0x54c85c=_0x10805e[_0xd56b('0x4d')][_0xd56b('0x4e')](function(_0x3a41a7){return _0x3a41a7&&_0x3a41a7[_0xd56b('0x4f')][0x0]&&_0x3a41a7[_0xd56b('0x4f')][0x0][_0xd56b('0x52')]?_0x3a41a7[_0xd56b('0x4f')][0x0][_0xd56b('0x52')]:0x0;})[_0xd56b('0x51')]('\x0a');}logger[_0xd56b('0x19')](_0xd56b('0x53'),_0xe95fd);logger[_0xd56b('0x19')](_0xd56b('0x54'),_0x54c85c);return{'transcript':_0xe95fd,'confidence':_0x54c85c};})[_0xd56b('0x55')](function(_0x1774c0){logger[_0xd56b('0x14')]('[%s]\x20%s:%s',_0x1774c0[_0xd56b('0x13')],_0x1774c0[_0xd56b('0x56')],_0x1774c0[_0xd56b('0x57')]);});};exports[_0xd56b('0x58')]=function(_0x4b6c7d,_0x5769c1,_0x597899,_0x4fa597){var _0x271d5c=apiai(_0x5769c1,{'language':_0x4fa597||'en'});return _0x271d5c['textRequest'](_0x597899,{'sessionId':md5(_0x4b6c7d)})[_0xd56b('0x38')](function(_0x1d9bc6){logger[_0xd56b('0x19')](JSON[_0xd56b('0x42')](_0x1d9bc6));return{'source':_0x1d9bc6[_0xd56b('0x59')][_0xd56b('0x5a')],'resolvedQuery':_0x1d9bc6['result'][_0xd56b('0x5b')],'action':_0x1d9bc6['result'][_0xd56b('0x5c')],'actionIncomplete':_0x1d9bc6[_0xd56b('0x59')][_0xd56b('0x5d')],'speech':_0x1d9bc6[_0xd56b('0x59')][_0xd56b('0x5e')][_0xd56b('0x5f')],'score':_0x1d9bc6[_0xd56b('0x59')][_0xd56b('0x60')],'statusCode':_0x1d9bc6['status']['code'],'endConversation':_0x1d9bc6['result'][_0xd56b('0x61')][_0xd56b('0x62')]||![],'isFallbackIntent':_0x1d9bc6[_0xd56b('0x59')][_0xd56b('0x61')]['isFallbackIntent']};});};exports[_0xd56b('0x63')]=function(_0x4ca2c1,_0x51e3bf,_0x2cce69,_0x21f304,_0x4c95e4,_0x394d76){var _0x207a56=_0x21f304[_0xd56b('0x64')](/\\n/g,'\x0a');var _0x57ca07={'credentials':{'private_key':_0x207a56,'client_email':_0x2cce69}};var _0x500706=new dialogflow['SessionsClient'](_0x57ca07);var _0x1b37fb=_0x500706['sessionPath'](_0x51e3bf,md5(_0x4ca2c1));var _0x389e9d={'session':_0x1b37fb,'queryInput':{'text':{'text':_0x4c95e4,'languageCode':_0x394d76}}};return _0x500706[_0xd56b('0x65')](_0x389e9d)[_0xd56b('0x38')](function(_0xfc1184){if(_0xfc1184&&_0xfc1184[_0xd56b('0x45')]){logger['info'](_0xd56b('0x66'),JSON[_0xd56b('0x42')](_0xfc1184));var _0x3a3a91=_0xfc1184[0x0];if(_0x3a3a91){var _0x392704={'action':_0x3a3a91['queryResult'][_0xd56b('0x5c')],'allRequiredParamsPresent':_0x3a3a91[_0xd56b('0x67')][_0xd56b('0x68')],'endConversation':_0x3a3a91[_0xd56b('0x67')]['diagnosticInfo']&&_0x3a3a91[_0xd56b('0x67')][_0xd56b('0x69')][_0xd56b('0x6a')]?_0x3a3a91[_0xd56b('0x67')][_0xd56b('0x69')][_0xd56b('0x6a')][_0xd56b('0x6b')][_0xd56b('0x6c')]:![],'fulfillmentText':_0x3a3a91['queryResult']['fulfillmentText'],'intentName':_0x3a3a91[_0xd56b('0x67')]['intent'][_0xd56b('0x56')],'intentDisplayName':_0x3a3a91['queryResult'][_0xd56b('0x6d')][_0xd56b('0x6e')],'isFallbackIntent':_0x3a3a91[_0xd56b('0x67')]['intent'][_0xd56b('0x6f')],'languageCode':_0x3a3a91[_0xd56b('0x67')][_0xd56b('0x70')],'queryText':_0x3a3a91['queryResult'][_0xd56b('0x71')],'responseId':_0x3a3a91['responseId'],'score':_0x3a3a91['queryResult']['intentDetectionConfidence'],'speech':_0x3a3a91[_0xd56b('0x67')][_0xd56b('0x72')],'providerResponse':JSON[_0xd56b('0x42')](_0xfc1184)};return _0x392704;}}});};exports[_0xd56b('0x73')]=function(_0x31c217,_0x25177a,_0x39d2f7,_0x18f743){return tilde[_0xd56b('0x4b')](_0x31c217,_0x25177a,_0x39d2f7,_0x18f743)['then'](function(_0x5030c3){try{fs[_0xd56b('0x1b')](_0x31c217);}catch(_0x1473fb){logger[_0xd56b('0x14')](_0x1473fb);}logger[_0xd56b('0x19')](_0xd56b('0x74'),_0x5030c3['transcript']);logger['info'](_0xd56b('0x75'),_0x5030c3['confidence']);return _0x5030c3;});};exports['awsPolly']=function(_0x8c2c1c,_0x50691f,_0x3706a5,_0x1ad45a,_0xc3dee1,_0x56d5ee){var _0x39b2ef=path[_0xd56b('0x25')](__dirname,'tmp',rs[_0xd56b('0x27')](0x4)+_0xd56b('0x39'));var _0x270821;return aws[_0xd56b('0x76')](_0x8c2c1c,_0x50691f,_0x3706a5,_0x1ad45a,_0xc3dee1,_0x56d5ee,_0x39b2ef)[_0xd56b('0x38')](function(){_0x270821=path[_0xd56b('0x25')](__dirname,_0xd56b('0x26'),rs['generate'](0x4)+_0xd56b('0x28'));return convertFile(_0x39b2ef,_0x270821);})[_0xd56b('0x38')](function(){try{fs[_0xd56b('0x1b')](_0x39b2ef);fs[_0xd56b('0x2a')](_0x270821,'777');}catch(_0x5785f6){logger[_0xd56b('0x14')](_0x5785f6);}return _0x270821[_0xd56b('0x2b')]('.')[0x0];});};exports[_0xd56b('0x77')]=function(_0x42e41e,_0x2f9287,_0x205146,_0x5b420c,_0x56fdb5,_0x275773){return aws[_0xd56b('0x78')](_0x42e41e,_0x2f9287,_0x205146,_0x5b420c,_0x56fdb5,_0x275773)[_0xd56b('0x38')](function(_0x2a01f1){logger['info'](JSON[_0xd56b('0x42')](_0x2a01f1));return _0x2a01f1;});};exports[_0xd56b('0x79')]=function(_0x23897b,_0x345674,_0xc1638b,_0x436db4){var _0x41c97c=util[_0xd56b('0x7a')](_0xd56b('0x7b'),ISPEECH_API,_0x23897b,encodeURIComponent(_0x345674),_0xc1638b,_0x436db4);var _0x561346=path['resolve'](__dirname,_0xd56b('0x26'),rs[_0xd56b('0x27')](0x4)+_0xd56b('0x39'));var _0xbcec12;return downloadFile(_0x41c97c,_0x561346)[_0xd56b('0x38')](function(){_0xbcec12=path[_0xd56b('0x25')](__dirname,'tmp',rs[_0xd56b('0x27')](0x4)+'.wav');return convertFile(_0x561346,_0xbcec12);})[_0xd56b('0x38')](function(){try{fs[_0xd56b('0x1b')](_0x561346);fs[_0xd56b('0x2a')](_0xbcec12,_0xd56b('0x3d'));}catch(_0x19b206){logger['error'](_0x19b206);}return _0xbcec12[_0xd56b('0x2b')]('.')[0x0];});};exports[_0xd56b('0x7c')]=function(_0x2e0fb3,_0x2b7380,_0x17fa9d,_0x589265){var _0x526a67=util[_0xd56b('0x7a')](_0xd56b('0x7d'),ISPEECH_API,_0x2b7380,_0x17fa9d,base64Encode(_0x2e0fb3),_0x589265?util[_0xd56b('0x7a')](_0xd56b('0x7e'),encodeURIComponent(_0x589265)):_0xd56b('0x7f'));return uploadFile(_0x526a67)[_0xd56b('0x38')](function(_0x58df45){return querystring[_0xd56b('0x80')](_0x58df45);});};exports[_0xd56b('0x81')]=function(_0x9b2953,_0x1e7933){return sestek['nda'](_0x9b2953,_0x1e7933)[_0xd56b('0x38')](function(_0xe6e7f3){logger['info'](JSON[_0xd56b('0x42')](_0xe6e7f3));var _0x118d72={'speech':_0xe6e7f3[_0xd56b('0x82')],'action':_0xe6e7f3[_0xd56b('0x83')]?_0xe6e7f3[_0xd56b('0x83')][_0xd56b('0x84')]:undefined,'actiondata':_0xe6e7f3[_0xd56b('0x83')]?_0xe6e7f3['channelData'][_0xd56b('0x85')]:undefined};if(_0xe6e7f3[_0xd56b('0x83')]&&_0xe6e7f3[_0xd56b('0x83')]['AudioFromTts']){return base64Decode(_0xe6e7f3['channelData']['AudioFromTts'][_0xd56b('0x86')],path[_0xd56b('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xd56b('0x28')))[_0xd56b('0x38')](function(_0x50dff3){_0x118d72['audiofile']=_0x50dff3;return _0x118d72;});}return _0x118d72;});};exports[_0xd56b('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x7372=['WHAT_EVER','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','get','data','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','.mp3','from','audioContent','split','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','generate','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7372,0x102));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0x2737('0x0'));var BPromise=require(_0x2737('0x1'));var dialogflow=require(_0x2737('0x2'));var fs=require('fs');var http=require(_0x2737('0x3'));var https=require(_0x2737('0x4'));var md5=require(_0x2737('0x5'));var path=require(_0x2737('0x6'));var querystring=require(_0x2737('0x7'));var rp=require(_0x2737('0x8'));var rs=require(_0x2737('0x9'));var sox=require(_0x2737('0xa'));var tts=require(_0x2737('0xb'));var urlParse=require('url')[_0x2737('0xc')];var util=require(_0x2737('0xd'));var aws=require(_0x2737('0xe'));var google=require('./google');var sestek=require(_0x2737('0xf'));var tilde=require(_0x2737('0x10'));var logger=require(_0x2737('0x11'))('agi');var ISPEECH_API=_0x2737('0x12');function downloadFile(_0x121cb0,_0xc8965e){return new BPromise(function(_0x8abaef,_0x388689){var _0x273da0=urlParse(_0x121cb0);var _0x446c83=_0x273da0[_0x2737('0x13')]===_0x2737('0x14')?https:http;var _0x586ab5={'host':_0x273da0[_0x2737('0x15')],'path':_0x273da0['path'],'headers':{'user-agent':_0x2737('0x16')}};_0x446c83['get'](_0x586ab5,function(_0x15fc67){if(_0x15fc67['statusCode']!==0xc8){logger[_0x2737('0x17')]('request\x20to\x20'+_0x121cb0+_0x2737('0x18')+_0x15fc67[_0x2737('0x19')]+'\x20('+_0x15fc67[_0x2737('0x1a')]+')');_0x388689(new Error(_0x2737('0x1b')+_0x121cb0+_0x2737('0x18')+_0x15fc67[_0x2737('0x19')]+'\x20('+_0x15fc67[_0x2737('0x1a')]+')'));return;}var _0x5ca39e=fs[_0x2737('0x1c')](_0xc8965e);_0x5ca39e['on'](_0x2737('0x1d'),function(){logger[_0x2737('0x1e')]('finish\x20download\x20file');_0x5ca39e[_0x2737('0x1f')](_0x8abaef);});_0x5ca39e['on'](_0x2737('0x17'),function(_0x3a61fa){fs[_0x2737('0x20')](_0xc8965e);logger['error'](_0x2737('0x21'),_0x3a61fa);_0x388689(_0x3a61fa);});_0x15fc67[_0x2737('0x22')](_0x5ca39e);})['on']('error',function(_0x4089b0){logger['error'](_0x4089b0);_0x388689(_0x4089b0);})[_0x2737('0x23')]();});}function uploadFile(_0x19bada){return new BPromise(function(_0x158e16,_0x535499){var _0x348f06=urlParse(_0x19bada);var _0x3e52a3=_0x348f06[_0x2737('0x13')]===_0x2737('0x14')?https:http;var _0x23a2a5={'host':_0x348f06[_0x2737('0x15')],'path':_0x348f06['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x3e52a3[_0x2737('0x24')](_0x23a2a5,function(_0x2b56a4){if(_0x2b56a4[_0x2737('0x19')]!==0xc8){_0x535499(new Error('request\x20to\x20'+_0x19bada+_0x2737('0x18')+_0x2b56a4[_0x2737('0x19')]+'\x20('+_0x2b56a4['statusMessage']+')'));return;}var _0x194588='';_0x2b56a4['on'](_0x2737('0x25'),function(_0x237bb4){_0x194588+=_0x237bb4;});_0x2b56a4['on'](_0x2737('0x23'),function(){_0x158e16(_0x194588);});})['on'](_0x2737('0x17'),function(_0x2bcb){_0x535499(_0x2bcb);})[_0x2737('0x23')]();});}function convertFile(_0x3ffe27,_0x90a273){return new BPromise(function(_0x2232ff,_0x1fc802){var _0xa88a7e=sox['transcode'](_0x3ffe27,_0x90a273,{'sampleRate':0x1f40,'format':_0x2737('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xa88a7e['on'](_0x2737('0x17'),function(_0x141680){logger[_0x2737('0x17')](_0x2737('0x27'),_0x141680);_0x1fc802(_0x141680);});_0xa88a7e['on'](_0x2737('0x23'),function(){logger[_0x2737('0x1e')](_0x2737('0x28'));_0x2232ff();});_0xa88a7e['start']();});}function base64Decode(_0x4baa0b,_0x375e87){var _0x4d0954=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs['generate'](0x4)+_0x2737('0x2b'));fs[_0x2737('0x2c')](_0x4d0954,_0x4baa0b,_0x2737('0x2d'));return convertFile(_0x4d0954,_0x375e87)[_0x2737('0x2e')](function(){try{fs['unlink'](_0x4d0954);fs[_0x2737('0x2f')](_0x375e87,_0x2737('0x30'));}catch(_0x53310f){logger['error'](_0x53310f);}return _0x375e87['split']('.')[0x0];});}function base64Encode(_0x3d8d94){var _0x57c3e5=fs[_0x2737('0x31')](_0x3d8d94);return new Buffer(_0x57c3e5)[_0x2737('0x32')](_0x2737('0x2d'));}exports[_0x2737('0x33')]=function(_0x48e91e,_0x12795b,_0x43e6f2,_0x112fa3,_0x3fed88,_0x1549ca){var _0x20f100,_0x4d0744;var _0x169820=_0x2737('0x34');var _0x219763=_0x2737('0x35')+_0x48e91e;var _0x3f7233={};if(_0x12795b===_0x2737('0x36')){_0x3f7233[_0x2737('0x37')]={'ssml':_0x43e6f2};}else{_0x3f7233[_0x2737('0x37')]={'text':_0x43e6f2};};_0x3f7233[_0x2737('0x38')]={'languageCode':_0x112fa3,'ssmlGender':_0x3fed88};_0x3f7233['audioConfig']={'audioEncoding':_0x2737('0x39'),'sampleRateHertz':0x1f40};var _0x1b8bc5={'url':_0x169820+'text:synthesize'+_0x219763,'method':'POST','json':!![],'body':_0x3f7233};return rp(_0x1b8bc5)[_0x2737('0x2e')](function(_0x22cd8b){return new BPromise(function(_0x234b3e,_0x370f30){_0x20f100=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs['generate'](0x4)+_0x2737('0x3a'));var _0x57bf18=Buffer[_0x2737('0x3b')](_0x22cd8b[_0x2737('0x3c')],_0x2737('0x2d'));return fs['writeFile'](_0x20f100,_0x57bf18,function(_0x1c81c5){_0x370f30(_0x1c81c5);},function(_0x4a05d8){fs[_0x2737('0x2f')](_0x20f100,_0x2737('0x30'));_0x234b3e(_0x4a05d8);});});})[_0x2737('0x2e')](function(_0x2ffcdf){_0x4d0744=path['resolve'](__dirname,_0x2737('0x2a'),rs['generate'](0x4)+_0x2737('0x2b'));return convertFile(_0x20f100,_0x4d0744);})[_0x2737('0x2e')](function(){try{fs[_0x2737('0x20')](_0x20f100);fs[_0x2737('0x2f')](_0x4d0744,_0x2737('0x30'));}catch(_0x5e7b07){logger['error'](_0x5e7b07);}logger['info']('googleCloudTTS\x20path',_0x4d0744[_0x2737('0x3d')]('.')[0x0]);return _0x4d0744['split']('.')[0x0];});};exports[_0x2737('0x3e')]=function(_0x37f42f,_0x2c0049){var _0x1f4e31='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x442598,_0x5eb91a;var _0x508107;var _0x5896c7={'encoding':_0x2737('0x3f'),'method':'POST','timeout':0x2710,'url':_0x1f4e31,'headers':{'Content-Type':_0x2737('0x40')},'body':_0x2737('0x41')+encodeURIComponent(JSON[_0x2737('0x42')]([[[_0x2737('0x43'),JSON[_0x2737('0x42')]([_0x37f42f,_0x2c0049||'en',![],'null']),null,_0x2737('0x44')]]]))};return rp(_0x5896c7)[_0x2737('0x2e')](function(_0xbd122f){try{_0x508107=eval(_0xbd122f[_0x2737('0x45')](0x5))[0x0][0x2];}catch(_0x220ab5){throw new Error(_0x2737('0x46')+_0xbd122f[_0x2737('0x25')]);}if(!_0x508107){if(_0x37f42f[_0x2737('0x47')]>0xc8){throw new Error(_0x2737('0x48'));}else{throw new Error('lang\x20\x22'+_0x2c0049+_0x2737('0x49'));}}try{_0x508107=eval(_0x508107)[0x0];}catch(_0x2b785d){throw new Error(_0x2737('0x46')+res[_0x2737('0x25')]);}const _0x59e54a=_0x508107;_0x442598=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs[_0x2737('0x4a')](0x4)+'.mp3');fs[_0x2737('0x2c')](_0x442598,_0x508107,{'encoding':'base64'});_0x5eb91a=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs[_0x2737('0x4a')](0x4)+_0x2737('0x2b'));return convertFile(_0x442598,_0x5eb91a);})[_0x2737('0x2e')](function(){try{fs['unlink'](_0x442598);fs[_0x2737('0x2f')](_0x5eb91a,'777');}catch(_0x2ce0b3){logger['error'](_0x2ce0b3);}logger[_0x2737('0x1e')](_0x2737('0x4b'),_0x5eb91a[_0x2737('0x3d')]('.')[0x0]);return _0x5eb91a[_0x2737('0x3d')]('.')[0x0];});};exports[_0x2737('0x4c')]=function(_0x4685a5,_0x19fb8e,_0x9d1c4){return google[_0x2737('0x4d')](_0x4685a5,_0x19fb8e,_0x9d1c4)[_0x2737('0x2e')](function(_0x4e1f6d){logger['info'](_0x4e1f6d[_0x2737('0x4e')]);return rp(_0x4e1f6d);})[_0x2737('0x2e')](function(_0x28ea7b){var _0x58cb99='';var _0x3ecbc9=0x0;try{fs['unlink'](_0x4685a5);}catch(_0x285489){logger[_0x2737('0x17')](_0x285489);}if(_0x28ea7b&&_0x28ea7b[_0x2737('0x4f')]){_0x58cb99=_0x28ea7b[_0x2737('0x4f')]['map'](function(_0x45990c){return _0x45990c&&_0x45990c[_0x2737('0x50')][0x0]&&_0x45990c[_0x2737('0x50')][0x0][_0x2737('0x51')]?_0x45990c[_0x2737('0x50')][0x0][_0x2737('0x51')]:'';})[_0x2737('0x52')]('\x0a');_0x3ecbc9=_0x28ea7b[_0x2737('0x4f')][_0x2737('0x53')](function(_0x547017){return _0x547017&&_0x547017[_0x2737('0x50')][0x0]&&_0x547017[_0x2737('0x50')][0x0][_0x2737('0x54')]?_0x547017[_0x2737('0x50')][0x0][_0x2737('0x54')]:0x0;})[_0x2737('0x52')]('\x0a');}logger[_0x2737('0x1e')](_0x2737('0x55'),_0x58cb99);logger['info'](_0x2737('0x56'),_0x3ecbc9);return{'transcript':_0x58cb99,'confidence':_0x3ecbc9};})[_0x2737('0x57')](function(_0x379b5f){logger['error'](_0x2737('0x58'),_0x379b5f[_0x2737('0x19')],_0x379b5f[_0x2737('0x59')],_0x379b5f[_0x2737('0x5a')]);});};exports['googleDialogflow']=function(_0xda11,_0x34f0e3,_0xcdf9e4,_0x5de7e8){var _0x2cd7c2=apiai(_0x34f0e3,{'language':_0x5de7e8||'en'});return _0x2cd7c2[_0x2737('0x5b')](_0xcdf9e4,{'sessionId':md5(_0xda11)})[_0x2737('0x2e')](function(_0x3c531d){logger['info'](JSON['stringify'](_0x3c531d));return{'source':_0x3c531d[_0x2737('0x5c')]['source'],'resolvedQuery':_0x3c531d[_0x2737('0x5c')][_0x2737('0x5d')],'action':_0x3c531d[_0x2737('0x5c')][_0x2737('0x5e')],'actionIncomplete':_0x3c531d[_0x2737('0x5c')][_0x2737('0x5f')],'speech':_0x3c531d[_0x2737('0x5c')][_0x2737('0x60')][_0x2737('0x61')],'score':_0x3c531d[_0x2737('0x5c')][_0x2737('0x62')],'statusCode':_0x3c531d['status'][_0x2737('0x63')],'endConversation':_0x3c531d['result'][_0x2737('0x64')][_0x2737('0x65')]||![],'isFallbackIntent':_0x3c531d[_0x2737('0x5c')][_0x2737('0x64')][_0x2737('0x66')]};});};exports[_0x2737('0x67')]=function(_0x31a40b,_0x5668d6,_0x5b364e,_0x17f61b,_0x219c1e,_0x50c74d){var _0x4f9c1a=_0x17f61b[_0x2737('0x68')](/\\n/g,'\x0a');var _0x1a11e7={'credentials':{'private_key':_0x4f9c1a,'client_email':_0x5b364e}};var _0x41776b=new dialogflow['SessionsClient'](_0x1a11e7);var _0x3ef873=_0x41776b[_0x2737('0x69')](_0x5668d6,md5(_0x31a40b));var _0x2a0f18={'session':_0x3ef873,'queryInput':{'text':{'text':_0x219c1e,'languageCode':_0x50c74d}}};return _0x41776b[_0x2737('0x6a')](_0x2a0f18)[_0x2737('0x2e')](function(_0x1c5eb7){if(_0x1c5eb7&&_0x1c5eb7[_0x2737('0x47')]){logger[_0x2737('0x1e')](_0x2737('0x6b'),JSON[_0x2737('0x42')](_0x1c5eb7));var _0x96878a=_0x1c5eb7[0x0];if(_0x96878a){var _0x297b50={'action':_0x96878a[_0x2737('0x6c')]['action'],'allRequiredParamsPresent':_0x96878a[_0x2737('0x6c')]['allRequiredParamsPresent'],'endConversation':_0x96878a['queryResult']['diagnosticInfo']&&_0x96878a[_0x2737('0x6c')][_0x2737('0x6d')][_0x2737('0x6e')]?_0x96878a[_0x2737('0x6c')][_0x2737('0x6d')][_0x2737('0x6e')][_0x2737('0x6f')][_0x2737('0x70')]:![],'fulfillmentText':_0x96878a[_0x2737('0x6c')]['fulfillmentText'],'intentName':_0x96878a['queryResult']['intent'][_0x2737('0x59')],'intentDisplayName':_0x96878a[_0x2737('0x6c')][_0x2737('0x71')][_0x2737('0x72')],'isFallbackIntent':_0x96878a[_0x2737('0x6c')][_0x2737('0x71')][_0x2737('0x73')],'languageCode':_0x96878a[_0x2737('0x6c')][_0x2737('0x74')],'queryText':_0x96878a['queryResult'][_0x2737('0x75')],'responseId':_0x96878a['responseId'],'score':_0x96878a[_0x2737('0x6c')][_0x2737('0x76')],'speech':_0x96878a[_0x2737('0x6c')][_0x2737('0x77')],'providerResponse':JSON['stringify'](_0x1c5eb7)};return _0x297b50;}}});};exports[_0x2737('0x78')]=function(_0x397655,_0x223ff2,_0x1a0825,_0x39fbcb){return tilde['asr'](_0x397655,_0x223ff2,_0x1a0825,_0x39fbcb)[_0x2737('0x2e')](function(_0x391212){try{fs[_0x2737('0x20')](_0x397655);}catch(_0x30f32e){logger[_0x2737('0x17')](_0x30f32e);}logger[_0x2737('0x1e')](_0x2737('0x79'),_0x391212[_0x2737('0x51')]);logger[_0x2737('0x1e')](_0x2737('0x7a'),_0x391212[_0x2737('0x54')]);return _0x391212;});};exports['awsPolly']=function(_0x37aae0,_0x393e3b,_0x358ec6,_0x4bd47c,_0x5d9f8b,_0x3f008c){var _0x1a53a7=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs[_0x2737('0x4a')](0x4)+_0x2737('0x3a'));var _0x31300c;return aws[_0x2737('0x7b')](_0x37aae0,_0x393e3b,_0x358ec6,_0x4bd47c,_0x5d9f8b,_0x3f008c,_0x1a53a7)[_0x2737('0x2e')](function(){_0x31300c=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs['generate'](0x4)+_0x2737('0x2b'));return convertFile(_0x1a53a7,_0x31300c);})[_0x2737('0x2e')](function(){try{fs[_0x2737('0x20')](_0x1a53a7);fs[_0x2737('0x2f')](_0x31300c,_0x2737('0x30'));}catch(_0x472b78){logger[_0x2737('0x17')](_0x472b78);}return _0x31300c[_0x2737('0x3d')]('.')[0x0];});};exports['awsLex']=function(_0x725b60,_0x345cfb,_0x583492,_0x5a2d0d,_0x324c87,_0x358359){return aws[_0x2737('0x7c')](_0x725b60,_0x345cfb,_0x583492,_0x5a2d0d,_0x324c87,_0x358359)[_0x2737('0x2e')](function(_0x24527b){logger[_0x2737('0x1e')](JSON[_0x2737('0x42')](_0x24527b));return _0x24527b;});};exports[_0x2737('0x7d')]=function(_0x3e1aa8,_0x418c6c,_0x2d3e02,_0x78822e){var _0x22aa33=util[_0x2737('0x7e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3e1aa8,encodeURIComponent(_0x418c6c),_0x2d3e02,_0x78822e);var _0x14f8ef=path[_0x2737('0x29')](__dirname,'tmp',rs[_0x2737('0x4a')](0x4)+'.mp3');var _0x4e2e4c;return downloadFile(_0x22aa33,_0x14f8ef)[_0x2737('0x2e')](function(){_0x4e2e4c=path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs[_0x2737('0x4a')](0x4)+_0x2737('0x2b'));return convertFile(_0x14f8ef,_0x4e2e4c);})[_0x2737('0x2e')](function(){try{fs['unlink'](_0x14f8ef);fs[_0x2737('0x2f')](_0x4e2e4c,_0x2737('0x30'));}catch(_0x18efc4){logger['error'](_0x18efc4);}return _0x4e2e4c[_0x2737('0x3d')]('.')[0x0];});};exports[_0x2737('0x7f')]=function(_0x4c2dad,_0x193220,_0x260fd1,_0x52acdf){var _0x4f7f46=util['format'](_0x2737('0x80'),ISPEECH_API,_0x193220,_0x260fd1,base64Encode(_0x4c2dad),_0x52acdf?util[_0x2737('0x7e')](_0x2737('0x81'),encodeURIComponent(_0x52acdf)):_0x2737('0x82'));return uploadFile(_0x4f7f46)[_0x2737('0x2e')](function(_0x4b3243){return querystring[_0x2737('0xc')](_0x4b3243);});};exports[_0x2737('0x83')]=function(_0x3fb8ad,_0x3a80e6){return sestek[_0x2737('0x84')](_0x3fb8ad,_0x3a80e6)[_0x2737('0x2e')](function(_0x2e3e0f){logger[_0x2737('0x1e')](JSON['stringify'](_0x2e3e0f));var _0x523122={'speech':_0x2e3e0f['text'],'action':_0x2e3e0f[_0x2737('0x85')]?_0x2e3e0f[_0x2737('0x85')][_0x2737('0x86')]:undefined,'actiondata':_0x2e3e0f[_0x2737('0x85')]?_0x2e3e0f[_0x2737('0x85')][_0x2737('0x87')]:undefined};if(_0x2e3e0f['channelData']&&_0x2e3e0f[_0x2737('0x85')][_0x2737('0x88')]){return base64Decode(_0x2e3e0f[_0x2737('0x85')][_0x2737('0x88')][_0x2737('0x89')],path[_0x2737('0x29')](__dirname,_0x2737('0x2a'),rs[_0x2737('0x4a')](0x4)+_0x2737('0x2b')))[_0x2737('0x2e')](function(_0x44f71b){_0x523122[_0x2737('0x8a')]=_0x44f71b;return _0x523122;});}return _0x523122;});};exports[_0x2737('0x8b')]=function(){return __dirname;}; \ 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 dbb44a5..a830835 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 _0x4dd3=['message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','channelData','audio/wav','custom_action','body','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','POST','resolve','/token','password','username','then','ndassistant_url','ndaactivity_type'];(function(_0x5ac4c7,_0x3caba1){var _0x24a2d2=function(_0x224b3b){while(--_0x224b3b){_0x5ac4c7['push'](_0x5ac4c7['shift']());}};_0x24a2d2(++_0x3caba1);}(_0x4dd3,0xf5));var _0x34dd=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x4dd3[_0x487ab4];return _0x3bef77;};'use strict';var rp=require(_0x34dd('0x0'));var url=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('agi');module['exports']=function(_0x23d13f,_0x4cdb5f){var _0x446f79={'method':_0x34dd('0x3'),'uri':url[_0x34dd('0x4')](_0x4cdb5f['ndauth_url'],_0x34dd('0x5')),'form':{'grant_type':_0x34dd('0x6'),'username':_0x4cdb5f[_0x34dd('0x7')],'password':_0x4cdb5f[_0x34dd('0x6')]},'json':!![]};return rp(_0x446f79)[_0x34dd('0x8')](function(_0x5e8911){var _0x4cb036={'method':_0x34dd('0x3'),'uri':url[_0x34dd('0x4')](_0x4cdb5f[_0x34dd('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4cdb5f[_0x34dd('0xa')]||_0x34dd('0xb'),'channelId':_0x34dd('0xc'),'conversation':{'id':_0x23d13f[_0x34dd('0xd')]},'from':{'id':_0x23d13f[_0x34dd('0xe')],'name':_0x23d13f[_0x34dd('0xf')]},'recipient':{'id':_0x23d13f['dnid'],'name':_0x23d13f[_0x34dd('0x10')]},'text':_0x4cdb5f[_0x34dd('0x11')],'channelData':{}},'headers':{'Authorization':_0x34dd('0x12')+_0x5e8911[_0x34dd('0x13')]},'json':!![]};if(_0x4cdb5f[_0x34dd('0x14')]){_0x4cb036['body']['channelData'][_0x34dd('0x15')]=_0x4cdb5f[_0x34dd('0x14')];}if(_0x4cdb5f[_0x34dd('0x16')]=='1'){_0x4cb036['body'][_0x34dd('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x34dd('0x18')};}if(_0x4cdb5f[_0x34dd('0x19')]){_0x4cb036[_0x34dd('0x1a')][_0x34dd('0x17')][_0x34dd('0x1b')]=_0x4cdb5f[_0x34dd('0x19')];if(_0x4cdb5f['custom_action_data']){_0x4cb036[_0x34dd('0x1a')][_0x34dd('0x17')][_0x34dd('0x1c')]=_0x4cdb5f[_0x34dd('0x1d')];}}logger[_0x34dd('0x1e')](JSON[_0x34dd('0x1f')](_0x4cb036));return rp(_0x4cb036);});}; \ No newline at end of file +var _0xdbfc=['CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','exports','POST','resolve','ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','dnid','text','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav'];(function(_0x1632ca,_0x4f1301){var _0x383f02=function(_0x16dbcf){while(--_0x16dbcf){_0x1632ca['push'](_0x1632ca['shift']());}};_0x383f02(++_0x4f1301);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x403678,_0x1b5184){_0x403678=_0x403678-0x0;var _0x9a5fbc=_0xdbfc[_0x403678];return _0x9a5fbc;};'use strict';var rp=require(_0xcdbf('0x0'));var url=require(_0xcdbf('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0xcdbf('0x2')]=function(_0x3067d8,_0x3db24f){var _0x3ed1e1={'method':_0xcdbf('0x3'),'uri':url[_0xcdbf('0x4')](_0x3db24f[_0xcdbf('0x5')],'/token'),'form':{'grant_type':_0xcdbf('0x6'),'username':_0x3db24f[_0xcdbf('0x7')],'password':_0x3db24f['password']},'json':!![]};return rp(_0x3ed1e1)[_0xcdbf('0x8')](function(_0x3c077d){var _0x409a4e={'method':_0xcdbf('0x3'),'uri':url['resolve'](_0x3db24f[_0xcdbf('0x9')],_0xcdbf('0xa')),'body':{'type':_0x3db24f[_0xcdbf('0xb')]||_0xcdbf('0xc'),'channelId':_0xcdbf('0xd'),'conversation':{'id':_0x3067d8['uniqueid']},'from':{'id':_0x3067d8[_0xcdbf('0xe')],'name':_0x3067d8['calleridname']},'recipient':{'id':_0x3067d8[_0xcdbf('0xf')],'name':_0x3067d8['extension']},'text':_0x3db24f[_0xcdbf('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3c077d[_0xcdbf('0x11')]},'json':!![]};if(_0x3db24f[_0xcdbf('0x12')]){_0x409a4e[_0xcdbf('0x13')]['channelData'][_0xcdbf('0x14')]=_0x3db24f['project'];}if(_0x3db24f[_0xcdbf('0x15')]=='1'){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcdbf('0x18')};}if(_0x3db24f['custom_action']){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x19')]=_0x3db24f[_0xcdbf('0x1a')];if(_0x3db24f[_0xcdbf('0x1b')]){_0x409a4e[_0xcdbf('0x13')][_0xcdbf('0x16')][_0xcdbf('0x1c')]=_0x3db24f[_0xcdbf('0x1b')];}}logger[_0xcdbf('0x1d')](JSON[_0xcdbf('0x1e')](_0x409a4e));return rp(_0x409a4e);});}; \ 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 7818c85..5bf91cc 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 _0x7cd6=['./lib/api','exports'];(function(_0x56bbd5,_0x20f4e0){var _0x42e2aa=function(_0xb38f3c){while(--_0xb38f3c){_0x56bbd5['push'](_0x56bbd5['shift']());}};_0x42e2aa(++_0x20f4e0);}(_0x7cd6,0x1c2));var _0x67cd=function(_0x4dbb7e,_0x783456){_0x4dbb7e=_0x4dbb7e-0x0;var _0x3cb14b=_0x7cd6[_0x4dbb7e];return _0x3cb14b;};'use strict';var asr=require(_0x67cd('0x0'));module[_0x67cd('0x1')]=function(_0x49dd60,_0x27d352,_0x69880b,_0x5d33f5){return asr(_0x49dd60,_0x27d352,_0x69880b,_0x5d33f5);}; \ No newline at end of file +var _0xb13c=['exports'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xb13c,0x14c));var _0xcb13=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0xb13c[_0xdd82b4];return _0x549bb2;};'use strict';var asr=require('./lib/api');module[_0xcb13('0x0')]=function(_0x1bb777,_0x365761,_0x95f1b4,_0x4ac514){return asr(_0x1bb777,_0x365761,_0x95f1b4,_0x4ac514);}; \ 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 dd4ebdd..4b22473 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 _0xdbf9=['isObject','open','message','bluebird','lodash','moment','../../../../../../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','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x4ae00e,_0x3f833a){var _0x57a4ad=function(_0x16bda1){while(--_0x16bda1){_0x4ae00e['push'](_0x4ae00e['shift']());}};_0x57a4ad(++_0x3f833a);}(_0xdbf9,0x1d7));var _0x9dbf=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xdbf9[_0x4dbaad];return _0x226c72;};'use strict';var BPromise=require(_0x9dbf('0x0'));var _=require(_0x9dbf('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9dbf('0x2'));var crypto=require('crypto');var logger=require(_0x9dbf('0x3'))(_0x9dbf('0x4'));module[_0x9dbf('0x5')]=function(_0x39034c,_0x5533cc,_0x532a58,_0x2200e3){return new BPromise(function(_0x2f0acb,_0x532741){logger[_0x9dbf('0x6')](_0x9dbf('0x7'),_0x2200e3||_0x9dbf('0x8'));var _0x23a593=new WebSocket(_0x2200e3||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x52fdbe='';var _0x41e8bc='0';var _0x482efd='1';var _0x251ceb=_0x9dbf('0x9');function _0x357f70(_0x2b0b35){var _0x47ffe3=crypto[_0x9dbf('0xa')]('sha1');_0x47ffe3[_0x9dbf('0xb')](_0x2b0b35);return _0x47ffe3[_0x9dbf('0xc')]('hex');}function _0x385e7f(){try{logger[_0x9dbf('0x6')](_0x9dbf('0xd'));var _0x5197d9=moment()['unix']();var _0x1a0c55=_0x357f70(_0x5197d9+_0x5533cc+_0x532a58);_0x23a593[_0x9dbf('0xe')](JSON[_0x9dbf('0xf')]({'appID':_0x5533cc,'timestamp':_0x5197d9,'appKey':_0x1a0c55}));var _0x5ecd09=fs['createReadStream'](_0x39034c);_0x5ecd09['on'](_0x9dbf('0x10'),function(_0x218f0a){_0x23a593[_0x9dbf('0xe')](_0x218f0a);});_0x5ecd09['on'](_0x9dbf('0x11'),function(){_0x23a593[_0x9dbf('0xe')](_0x9dbf('0x12'));});}catch(_0x9b6d70){logger['error'](_0x9dbf('0x13'),JSON[_0x9dbf('0xf')](_0x9b6d70));_0x23a593[_0x9dbf('0x14')]();}}function _0x107b1a(_0x3ee157){try{if(_0x3ee157){var _0x2f6438=JSON[_0x9dbf('0x15')](_0x3ee157);switch(_0x2f6438[_0x9dbf('0x16')]){case 0x0:if(_0x2f6438[_0x9dbf('0x17')]){if(_0x2f6438[_0x9dbf('0x17')][_0x9dbf('0x18')]){logger['info'](_0x9dbf('0x19'),JSON[_0x9dbf('0xf')](_0x2f6438[_0x9dbf('0x17')][_0x9dbf('0x1a')]));_0x52fdbe=_0x2f6438[_0x9dbf('0x17')][_0x9dbf('0x1a')][0x0]['transcript'];_0x41e8bc=_0x2f6438[_0x9dbf('0x17')][_0x9dbf('0x1a')][0x0]['likelihood'];_0x482efd='0';_0x251ceb='Success.';_0x23a593['terminate']();}}break;case 0x1:logger[_0x9dbf('0x6')](_0x9dbf('0x9'));_0x482efd='1';_0x251ceb='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x9dbf('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x482efd='2';_0x251ceb=_0x9dbf('0x1b');break;case 0x9:logger[_0x9dbf('0x6')](_0x9dbf('0x1c'));_0x482efd='9';_0x251ceb=_0x9dbf('0x1c');break;case 0xa:logger[_0x9dbf('0x6')](_0x9dbf('0x1d'));_0x482efd='10';_0x251ceb='Authentication\x20failed.';break;case 0xb:logger[_0x9dbf('0x6')](_0x9dbf('0x1e'));_0x482efd='11';_0x251ceb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5af240){logger[_0x9dbf('0x1f')](_0x9dbf('0x20'),JSON[_0x9dbf('0xf')](_0x5af240));_0x23a593[_0x9dbf('0x14')]();}}function _0x503d3d(){logger[_0x9dbf('0x6')](_0x9dbf('0x21'));_0x2f0acb({'transcript':_0x52fdbe,'confidence':_0x41e8bc,'status':_0x482efd,'status_message':_0x251ceb});}function _0x49ad60(_0xc44333){logger[_0x9dbf('0x1f')](_0x9dbf('0x22'));if(!_[_0x9dbf('0x23')](_0xc44333)){logger['error'](_[_0x9dbf('0x24')](_0xc44333)?JSON[_0x9dbf('0xf')](_0xc44333):_0xc44333);}}_0x23a593['on'](_0x9dbf('0x25'),_0x385e7f);_0x23a593['on'](_0x9dbf('0x26'),_0x107b1a);_0x23a593['on'](_0x9dbf('0x11'),_0x503d3d);_0x23a593['on'](_0x9dbf('0x1f'),_0x49ad60);});}; \ No newline at end of file +var _0x3428=['isNil','isObject','open','message','bluebird','lodash','crypto','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','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x411bce,_0x1a70fc){var _0xc26b42=function(_0x55b9b7){while(--_0x55b9b7){_0x411bce['push'](_0x411bce['shift']());}};_0xc26b42(++_0x1a70fc);}(_0x3428,0xc2));var _0x8342=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3428[_0xfae23b];return _0x200640;};'use strict';var BPromise=require(_0x8342('0x0'));var _=require(_0x8342('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x8342('0x2'));var logger=require('../../../../../../config/logger')(_0x8342('0x3'));module[_0x8342('0x4')]=function(_0x1a1734,_0x34e9cf,_0x1c8813,_0x2e0302){return new BPromise(function(_0x5a8f1d,_0x47f590){logger[_0x8342('0x5')](_0x8342('0x6'),_0x2e0302||_0x8342('0x7'));var _0x3e2f49=new WebSocket(_0x2e0302||_0x8342('0x7'),{'perMessageDeflate':![]});var _0x4b7760='';var _0x3e03c4='0';var _0x3864a0='1';var _0x2d666b=_0x8342('0x8');function _0x133a3a(_0x23c943){var _0x30284c=crypto['createHash'](_0x8342('0x9'));_0x30284c['update'](_0x23c943);return _0x30284c[_0x8342('0xa')](_0x8342('0xb'));}function _0x4e04c2(){try{logger[_0x8342('0x5')](_0x8342('0xc'));var _0x3560c1=moment()[_0x8342('0xd')]();var _0x524277=_0x133a3a(_0x3560c1+_0x34e9cf+_0x1c8813);_0x3e2f49[_0x8342('0xe')](JSON[_0x8342('0xf')]({'appID':_0x34e9cf,'timestamp':_0x3560c1,'appKey':_0x524277}));var _0x31e467=fs[_0x8342('0x10')](_0x1a1734);_0x31e467['on'](_0x8342('0x11'),function(_0x2c2db3){_0x3e2f49[_0x8342('0xe')](_0x2c2db3);});_0x31e467['on'](_0x8342('0x12'),function(){_0x3e2f49[_0x8342('0xe')]('EOS');});}catch(_0x74c1e4){logger[_0x8342('0x13')](_0x8342('0x14'),JSON[_0x8342('0xf')](_0x74c1e4));_0x3e2f49['terminate']();}}function _0x4d319e(_0xb1c748){try{if(_0xb1c748){var _0x494f59=JSON[_0x8342('0x15')](_0xb1c748);switch(_0x494f59[_0x8342('0x16')]){case 0x0:if(_0x494f59['result']){if(_0x494f59[_0x8342('0x17')]['final']){logger[_0x8342('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x8342('0xf')](_0x494f59[_0x8342('0x17')][_0x8342('0x18')]));_0x4b7760=_0x494f59[_0x8342('0x17')]['hypotheses'][0x0]['transcript'];_0x3e03c4=_0x494f59[_0x8342('0x17')][_0x8342('0x18')][0x0][_0x8342('0x19')];_0x3864a0='0';_0x2d666b=_0x8342('0x1a');_0x3e2f49[_0x8342('0x1b')]();}}break;case 0x1:logger['info'](_0x8342('0x8'));_0x3864a0='1';_0x2d666b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x8342('0x5')](_0x8342('0x1c'));_0x3864a0='2';_0x2d666b=_0x8342('0x1c');break;case 0x9:logger['info'](_0x8342('0x1d'));_0x3864a0='9';_0x2d666b=_0x8342('0x1d');break;case 0xa:logger[_0x8342('0x5')](_0x8342('0x1e'));_0x3864a0='10';_0x2d666b=_0x8342('0x1e');break;case 0xb:logger[_0x8342('0x5')](_0x8342('0x1f'));_0x3864a0='11';_0x2d666b=_0x8342('0x1f');}}}catch(_0x206bef){logger[_0x8342('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x8342('0xf')](_0x206bef));_0x3e2f49[_0x8342('0x1b')]();}}function _0x3facea(){logger[_0x8342('0x5')](_0x8342('0x20'));_0x5a8f1d({'transcript':_0x4b7760,'confidence':_0x3e03c4,'status':_0x3864a0,'status_message':_0x2d666b});}function _0x1800ec(_0x146b65){logger[_0x8342('0x13')](_0x8342('0x21'));if(!_[_0x8342('0x22')](_0x146b65)){logger[_0x8342('0x13')](_[_0x8342('0x23')](_0x146b65)?JSON[_0x8342('0xf')](_0x146b65):_0x146b65);}}_0x3e2f49['on'](_0x8342('0x24'),_0x4e04c2);_0x3e2f49['on'](_0x8342('0x25'),_0x4d319e);_0x3e2f49['on'](_0x8342('0x12'),_0x3facea);_0x3e2f49['on'](_0x8342('0x13'),_0x1800ec);});}; \ 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 c882537..b4754d1 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 _0x30eb=['./asr','exports'];(function(_0x2ee0f3,_0x552d17){var _0x58d32f=function(_0x185d11){while(--_0x185d11){_0x2ee0f3['push'](_0x2ee0f3['shift']());}};_0x58d32f(++_0x552d17);}(_0x30eb,0x104));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};var asr=require(_0xb30e('0x0'));module[_0xb30e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4cbc=['./asr','exports'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0x4cbc,0x64));var _0xc4cb=function(_0x4f121c,_0x2f273a){_0x4f121c=_0x4f121c-0x0;var _0x460d3a=_0x4cbc[_0x4f121c];return _0x460d3a;};var asr=require(_0xc4cb('0x0'));module[_0xc4cb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f1afa2b..87767a6 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x6d47ef,_0x55c533){var _0x2aebd7=function(_0x1f7b9c){while(--_0x1f7b9c){_0x6d47ef['push'](_0x6d47ef['shift']());}};_0x2aebd7(++_0x55c533);}(_0x34e8,0x12c));var _0x834e=function(_0x1e7c13,_0x33ab04){_0x1e7c13=_0x1e7c13-0x0;var _0x1787a8=_0x34e8[_0x1e7c13];return _0x1787a8;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x361912,_0x1bca02){var _0x54c216=function(_0x28685d){while(--_0x28685d){_0x361912['push'](_0x361912['shift']());}};_0x54c216(++_0x1bca02);}(_0x34e8,0x12c));var _0x834e=function(_0xd540e5,_0xa2d52b){_0xd540e5=_0xd540e5-0x0;var _0x170968=_0x34e8[_0xd540e5];return _0x170968;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index cb7d14b..4452433 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 _0x22a4=['exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agent','agentUnpause','agentLogout','agentLogin','internal','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','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isArray','replaceAllVariables','saveRestApiResult','isPlainObject','%s.%s','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','grammar','no\x20grammar\x20configured','exec','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','bot','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','variable_id','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','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','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','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','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','subject','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join'];(function(_0x37882f,_0xdb6caf){var _0x33c631=function(_0x41d831){while(--_0x41d831){_0x37882f['push'](_0x37882f['shift']());}};_0x33c631(++_0xdb6caf);}(_0x22a4,0x1cb));var _0x422a=function(_0x3408a7,_0x3ce209){_0x3408a7=_0x3408a7-0x0;var _0x54d552=_0x22a4[_0x3408a7];return _0x54d552;};'use strict';var fs=require('fs');var util=require(_0x422a('0x0'));var _=require(_0x422a('0x1'));var sh=require(_0x422a('0x2'));var odbc=require(_0x422a('0x3'))();var rs=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var Mustache=require(_0x422a('0x6'));var rp=require(_0x422a('0x7'));var logger=require('../../config/logger')(_0x422a('0x8'));var config=require(_0x422a('0x9'));var shared=require(_0x422a('0xa'));var scripts=require(_0x422a('0xb'));var FILES_PATH=_0x422a('0xc');var recursiveMapAttributes=['rawHeaders',_0x422a('0xd')];var verticesWithRetry=[_0x422a('0xe'),_0x422a('0xf'),_0x422a('0x10')];var AGIVertices=function(_0x3f785b,_0x3ad391,_0x317466){this[_0x422a('0x11')]=_0x3f785b;this['rpc']=_0x3ad391;this['mailRpc']=_0x317466;};AGIVertices[_0x422a('0x12')][_0x422a('0x13')]=function(_0x1ce3a7,_0x3261a7){this[_0x422a('0x14')][_0x422a('0x15')](_0x1ce3a7)['then'](function(_0x489953){_0x3261a7(null,_0x489953?_0x489953[_0x422a('0x16')]:![]);})['catch'](function(_0x5a0c59){_0x3261a7(_0x5a0c59);});};AGIVertices['prototype'][_0x422a('0x17')]=function(_0xe43bbf,_0x11af1f){this[_0x422a('0x14')][_0x422a('0x18')](_0xe43bbf)[_0x422a('0x19')](function(_0x3bfb41){_0x11af1f(null,_0x3bfb41?_0x3bfb41[_0x422a('0x16')]:![]);})[_0x422a('0x1a')](function(_0x2ba53b){_0x11af1f(_0x2ba53b);});};AGIVertices[_0x422a('0x12')][_0x422a('0x1b')]=function(_0x39c6a3,_0x3d5033){this[_0x422a('0x14')][_0x422a('0x1c')](_0x39c6a3)[_0x422a('0x19')](function(_0x5e2507){_0x3d5033(null,_0x5e2507?_0x5e2507[_0x422a('0x16')]:![]);})[_0x422a('0x1a')](function(_0x5b29fc){_0x3d5033(_0x5b29fc);});};AGIVertices[_0x422a('0x12')]['getSquareOdbc']=function(_0x552048,_0x3ef74f){this[_0x422a('0x14')][_0x422a('0x1d')](_0x552048)[_0x422a('0x19')](function(_0x194c25){_0x3ef74f(null,_0x194c25?_0x194c25[_0x422a('0x1e')]:![]);})[_0x422a('0x1a')](function(_0x26922a){_0x3ef74f(_0x26922a);});};AGIVertices['prototype'][_0x422a('0x1f')]=function(_0x3284ed,_0x211d93){this[_0x422a('0x14')][_0x422a('0x20')](_0x3284ed)['then'](function(_0x837c81){_0x211d93(null,_0x837c81?_0x837c81[_0x422a('0x16')]:![]);})[_0x422a('0x1a')](function(_0x5e3138){_0x211d93(_0x5e3138);});};AGIVertices[_0x422a('0x12')][_0x422a('0x21')]=function(_0x1fd126,_0xcc5ead){this[_0x422a('0x14')][_0x422a('0x22')](_0x1fd126)[_0x422a('0x19')](function(_0xe39bf5){_0xcc5ead(null,_0xe39bf5?_0xe39bf5['name']:![]);})[_0x422a('0x1a')](function(_0x15d2ab){_0xcc5ead(_0x15d2ab);});};AGIVertices['prototype'][_0x422a('0x23')]=function(_0x49d75f,_0x1b88ae){var _0xad42b4=this;this[_0x422a('0x14')][_0x422a('0x24')](_0x49d75f)['then'](function(_0x3cb362){_0x1b88ae(null,_0x3cb362?_0xad42b4[_0x422a('0x25')](_0x3cb362['save_name']):![]);})['catch'](function(_0x3414ad){_0x1b88ae(_0x3414ad);});};AGIVertices[_0x422a('0x12')]['getMailAccount']=function(_0x494226,_0x4903d1){this['rpc']['getMailAccountById'](_0x494226)[_0x422a('0x19')](function(_0x2fd9f8){_0x4903d1(null,_0x2fd9f8?_0x2fd9f8:![]);})[_0x422a('0x1a')](function(_0x2aaa9c){_0x4903d1(_0x2aaa9c);});};AGIVertices[_0x422a('0x12')]['sendMailMessage']=function(_0x145722,_0x8d8842,_0x1edfe4){this[_0x422a('0x26')][_0x422a('0x27')](_0x145722,_0x8d8842)[_0x422a('0x19')](function(){_0x1edfe4(null);})[_0x422a('0x1a')](function(_0x55dc4c){_0x1edfe4(_0x55dc4c);});};AGIVertices[_0x422a('0x12')][_0x422a('0x28')]=function(_0x3bf7c6,_0x3d650c){this['rpc'][_0x422a('0x29')](_0x3bf7c6)['then'](function(_0x1575db){if(_0x1575db){if(_0x1575db[_0x422a('0x2a')]){_0x3d650c(null,[_0x1575db['interval']]);}else{_0x3d650c(null,_[_0x422a('0x2b')](_0x1575db[_0x422a('0x2c')],'interval'));}}else{_0x3d650c(null,![]);}})[_0x422a('0x1a')](function(_0x2da03a){_0x3d650c(_0x2da03a);});};AGIVertices[_0x422a('0x12')][_0x422a('0x25')]=function(_0x1e2116){return util[_0x422a('0x2d')](_0x422a('0x2e'),FILES_PATH,_0x1e2116);};AGIVertices[_0x422a('0x12')]['getQueryOdbc']=function(_0x56f6fb,_0x36328a,_0xb1b1d8){odbc[_0x422a('0x2f')](_0x56f6fb,function(_0x4beffb){if(_0x4beffb){logger[_0x422a('0x30')](_0x422a('0x31'),_0x4beffb);_0xb1b1d8(_0x4beffb);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x422a('0x32')](_0x36328a,function(_0x5567f8,_0x4095d5){if(_0x5567f8){logger[_0x422a('0x33')](_0x422a('0x34'),_0x36328a);_0xb1b1d8(_0x5567f8);}else{logger['info'](_0x422a('0x35'),_0x36328a);odbc[_0x422a('0x36')](function(_0x3df5ac){if(_0x3df5ac){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3df5ac);}_0xb1b1d8(null,_0x4095d5);});}});}});};AGIVertices[_0x422a('0x12')][_0x422a('0x37')]=function(_0x226638,_0x5b3639){this[_0x422a('0x14')][_0x422a('0x38')](_0x226638)[_0x422a('0x19')](function(_0x4388b6){_0x5b3639(null,_0x4388b6?_0x4388b6:![]);})[_0x422a('0x1a')](function(_0x590c9b){_0x5b3639(_0x590c9b);});};AGIVertices[_0x422a('0x12')][_0x422a('0x39')]=function(_0x411a86,_0x155673){this[_0x422a('0x14')]['createSmsMessage'](_0x411a86)['then'](function(_0x2b700d){_0x155673(null,_0x2b700d);})['catch'](function(_0x4c2e63){_0x155673(_0x4c2e63);});};AGIVertices[_0x422a('0x12')][_0x422a('0x3a')]=function(_0x10302c,_0x474255,_0x1e010c){this[_0x422a('0x14')]['createSquareDetailsReport']({'uniqueid':this[_0x422a('0x11')][_0x422a('0x3b')],'node':_0x10302c[_0x422a('0x3c')],'application':_0x10302c[_0x422a('0x3d')],'data':_0x474255||null,'project_name':this[_0x422a('0x11')][_0x422a('0x3e')],'callerid':this[_0x422a('0x11')]['callerid']})[_0x422a('0x19')](function(_0x337038){if(_0x1e010c){_0x1e010c(null,_0x337038);}})['catch'](function(_0x8e988e){if(_0x1e010c){_0x1e010c(_0x8e988e);}});};AGIVertices[_0x422a('0x12')][_0x422a('0x3f')]=function(_0xc7e33,_0x3387c1,_0x1b2c55,_0x243989){this['rpc'][_0x422a('0x3f')]({'uniqueid':this[_0x422a('0x11')][_0x422a('0x3b')],'callerid':this[_0x422a('0x11')][_0x422a('0x40')],'calleridname':this[_0x422a('0x11')][_0x422a('0x41')],'context':this[_0x422a('0x11')][_0x422a('0x42')],'extension':this[_0x422a('0x11')]['extension'],'priority':this['channel'][_0x422a('0x43')],'accountcode':this[_0x422a('0x11')]['accountcode'],'dnid':this[_0x422a('0x11')][_0x422a('0x44')],'projectName':this[_0x422a('0x11')][_0x422a('0x3e')],'saveName':_0x3387c1,'filename':_0xc7e33[_0x422a('0x45')]||_0x3387c1,'savePath':_0x1b2c55})[_0x422a('0x19')](function(_0x2c8f29){_0x243989(null,_0x2c8f29);})[_0x422a('0x1a')](function(_0x34a739){_0x243989(_0x34a739);});};AGIVertices[_0x422a('0x12')]['createSquareMessage']=function(_0x565c6f,_0xedc7dc,_0x1f5066,_0x553ab8,_0x31da56){this[_0x422a('0x14')][_0x422a('0x46')]({'uniqueid':this[_0x422a('0x11')][_0x422a('0x3b')],'body':_0x565c6f,'direction':_0xedc7dc,'providerName':_0x1f5066,'providerResponse':_0x553ab8})[_0x422a('0x19')](function(_0x3a98cb){if(_0x31da56){_0x31da56(null,_0x3a98cb);}})['catch'](function(_0x399ead){if(_0x31da56){_0x31da56(_0x399ead);}});};AGIVertices[_0x422a('0x12')][_0x422a('0x47')]=function(_0x41deb3,_0x139d54){this[_0x422a('0x14')]['createCmContact']({'firstName':_['isEmpty'](_0x41deb3[_0x422a('0x16')])||_[_0x422a('0x48')](_0x41deb3[_0x422a('0x16')])?_0x422a('0x49')+Math[_0x422a('0x4a')]():_0x41deb3[_0x422a('0x16')],'lastName':_[_0x422a('0x4b')](_0x41deb3[_0x422a('0x4c')])||_[_0x422a('0x48')](_0x41deb3['lastName'])?null:_0x41deb3['lastName'],'phone':_0x41deb3['phone'],'ListId':_0x41deb3[_0x422a('0x4d')],'scheduledat':_0x41deb3[_0x422a('0x4e')],'callbackUniqueid':this[_0x422a('0x11')][_0x422a('0x3b')],'tags':'callback','description':_0x422a('0x4f')+_0x41deb3[_0x422a('0x4e')][_0x422a('0x50')](),'priority':_0x41deb3[_0x422a('0x51')]})[_0x422a('0x19')](function(_0x1f2834){_0x139d54(null,_0x1f2834);})['catch'](function(_0x5d7328){_0x139d54(_0x5d7328);});};AGIVertices[_0x422a('0x12')][_0x422a('0x52')]=function(_0x41d1c5,_0x5f2ea9){this[_0x422a('0x14')]['getPauseById'](_0x41d1c5)[_0x422a('0x19')](function(_0x12df25){_0x5f2ea9(null,_0x12df25?_0x12df25['name']:![]);})['catch'](function(_0x396809){_0x5f2ea9(_0x396809);});};AGIVertices[_0x422a('0x12')]['agentPause']=function(_0x34ebe5,_0x79c401,_0xe46b80){var _0xc006ef={'role':_0x422a('0x53')};_0xc006ef[_0x34ebe5]=this[_0x422a('0x11')][_0x422a('0x40')];this[_0x422a('0x14')]['agentPause'](_0xc006ef,_0x79c401,this['channel'][_0x422a('0x3b')])[_0x422a('0x19')](function(_0x167679){_0xe46b80(null,_[_0x422a('0x48')](_0x167679)?![]:!![]);})[_0x422a('0x1a')](function(_0x5398fd){logger['error'](_0x5398fd);_0xe46b80(null,![]);});};AGIVertices[_0x422a('0x12')][_0x422a('0x54')]=function(_0x197106,_0x39c9f4){var _0x580207={'role':_0x422a('0x53')};_0x580207[_0x197106]=this['channel']['callerid'];this['rpc'][_0x422a('0x54')](_0x580207)[_0x422a('0x19')](function(_0x381cf9){_0x39c9f4(null,_[_0x422a('0x48')](_0x381cf9)?![]:!![]);})['catch'](function(_0x34fcd2){logger[_0x422a('0x30')](_0x34fcd2);_0x39c9f4(null,![]);});};AGIVertices[_0x422a('0x12')][_0x422a('0x55')]=function(_0x333100,_0x21a2c3){var _0x524d68={'role':_0x422a('0x53')};_0x524d68[_0x333100]=this[_0x422a('0x11')][_0x422a('0x40')];this[_0x422a('0x14')][_0x422a('0x55')](_0x524d68)[_0x422a('0x19')](function(_0x5e59b4){_0x21a2c3(null,_['isNil'](_0x5e59b4)?![]:!![]);})[_0x422a('0x1a')](function(_0x27255c){logger[_0x422a('0x30')](_0x27255c);_0x21a2c3(null,![]);});};AGIVertices[_0x422a('0x12')][_0x422a('0x56')]=function(_0x174b1d,_0x381440){var _0x259433={'role':_0x422a('0x53')};_0x259433[_0x174b1d]=this['channel'][_0x422a('0x40')];var _0x1f1935=_0x174b1d!=_0x422a('0x57')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x422a('0x11')][_0x422a('0x40')]):undefined;this[_0x422a('0x14')][_0x422a('0x56')](_0x259433,_0x1f1935)[_0x422a('0x19')](function(_0x3f8b89){_0x381440(null,_[_0x422a('0x48')](_0x3f8b89)?![]:!![]);})[_0x422a('0x1a')](function(_0x42f08d){logger[_0x422a('0x30')](_0x42f08d);_0x381440(null,![]);});};AGIVertices[_0x422a('0x12')]['shellCommand']=function(_0x38e87a,_0xeaff7){sh['exec'](_[_0x422a('0x58')](_0x38e87a),function(_0x28bbdb,_0x265ea6){var _0x29dbc8=_0x265ea6['replace'](/(\r\n|\n|\r)/gm,'');_0xeaff7(null,_0x29dbc8);});};AGIVertices[_0x422a('0x12')]['googleCloudTTS']=function(_0x24937a,_0x51f204){scripts[_0x422a('0x59')](_0x24937a[_0x422a('0x5a')],_0x24937a[_0x422a('0x5b')]||_0x422a('0x5c'),_0x24937a[_0x422a('0x5c')],_0x24937a[_0x422a('0x5d')]||_0x422a('0x5e'),_0x24937a[_0x422a('0x5f')]||_0x422a('0x60'),_0x24937a[_0x422a('0x61')]||_0x422a('0x62'))[_0x422a('0x19')](function(_0x23d653){_0x51f204(null,_0x23d653);})['catch'](function(_0x506b3b){_0x51f204(_0x506b3b);});};AGIVertices[_0x422a('0x12')][_0x422a('0x63')]=function(_0x4f5acc,_0x5de838){scripts[_0x422a('0x63')](_0x4f5acc[_0x422a('0x5c')],_0x4f5acc[_0x422a('0x64')]||'en',0x1)['then'](function(_0x5c5f67){_0x5de838(null,_0x5c5f67);})[_0x422a('0x1a')](function(_0x53f7bb){_0x5de838(_0x53f7bb);});};AGIVertices['prototype'][_0x422a('0x65')]=function(_0x981bca,_0x2bbcd3){var _0x26d32f={'uri':_0x981bca[_0x422a('0x66')],'method':_0x981bca['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x981bca[_0x422a('0x67')])===_0x422a('0x68')&&parseInt(_0x981bca['timeout'])>=0x1?parseInt(_0x981bca[_0x422a('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x422a('0x69')]([_0x422a('0x6a'),'PUT'],_0x26d32f[_0x422a('0x6b')][_0x422a('0x6c')]())){try{_0x26d32f[_0x422a('0x6d')]=_0x981bca[_0x422a('0xd')]?JSON[_0x422a('0x6e')](_0x981bca[_0x422a('0xd')]):{};}catch(_0x36892f){logger['error'](_0x422a('0x6f'),_0x36892f);}}try{_0x26d32f[_0x422a('0x70')]=_0x981bca[_0x422a('0x71')]?JSON[_0x422a('0x6e')](_0x981bca[_0x422a('0x71')]):{};}catch(_0x5c87f){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5c87f);}if(_0x981bca[_0x422a('0x72')]){try{var _0x345444=require(_0x981bca['computedVariables'])[_0x422a('0x73')](this,_0x26d32f);_0x26d32f[_0x422a('0x74')]=Mustache[_0x422a('0x75')](_0x981bca[_0x422a('0x66')],_0x345444,{},['$$','$$']);if(_0x26d32f[_0x422a('0x70')]){_0x26d32f['headers']=JSON['parse'](Mustache['render'](JSON[_0x422a('0x76')](_0x26d32f[_0x422a('0x70')]),_0x345444,{},['$$','$$']));}if(_0x26d32f[_0x422a('0x6d')]){_0x26d32f['body']=JSON[_0x422a('0x6e')](Mustache[_0x422a('0x75')](JSON[_0x422a('0x76')](_0x26d32f['body']),_0x345444,{},['$$','$$']));}}catch(_0x2012ab){logger[_0x422a('0x30')](_0x422a('0x77'),_0x2012ab);}}rp(_0x26d32f)['then'](function(_0xd6fb30){var _0x1ce86c={'statusCode':_0xd6fb30[_0x422a('0x78')]||0xc8,'statusMessage':_0xd6fb30[_0x422a('0x79')]||'OK','headers':_0xd6fb30[_0x422a('0x70')]||{},'body':_0xd6fb30[_0x422a('0x6d')]||{}};_0x2bbcd3(null,_0x1ce86c);})['catch'](function(_0x513626){var _0x58d0fe={'statusCode':_0x513626[_0x422a('0x78')]||0x1f4,'statusMessage':_0x513626['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x513626['options']['headers']||{},'body':_0x513626[_0x422a('0x7a')]['body']||{}};_0x2bbcd3(null,_0x58d0fe);});};AGIVertices[_0x422a('0x12')][_0x422a('0x7b')]=function(_0x1a8c29,_0x1998a7){scripts[_0x422a('0x7b')](this[_0x422a('0x11')][_0x422a('0x3b')],_0x1a8c29[_0x422a('0x7c')],_0x1a8c29[_0x422a('0x5c')],_0x1a8c29[_0x422a('0x7d')]||'en')[_0x422a('0x19')](function(_0x442d96){_0x1998a7(null,_0x442d96);})[_0x422a('0x1a')](function(_0x15ccda){_0x1998a7(_0x15ccda);});};AGIVertices['prototype'][_0x422a('0x7e')]=function(_0x1e86ae,_0x93d934){scripts[_0x422a('0x7e')](this['channel'][_0x422a('0x3b')],_0x1e86ae[_0x422a('0x7f')],_0x1e86ae['client_email'],_0x1e86ae[_0x422a('0x80')],_0x1e86ae[_0x422a('0x5c')],_0x1e86ae['dialogflowV2_language']||'en')[_0x422a('0x19')](function(_0x5d290b){_0x93d934(null,_0x5d290b);})['catch'](function(_0x4ec23f){_0x93d934(_0x4ec23f);});};AGIVertices[_0x422a('0x12')][_0x422a('0x81')]=function(_0x555aa7,_0x383a2c){scripts[_0x422a('0x81')](this[_0x422a('0x11')],_0x555aa7)['then'](function(_0x4f3e56){_0x383a2c(null,_0x4f3e56);})[_0x422a('0x1a')](function(_0x1d1b5e){_0x383a2c(_0x1d1b5e);});};AGIVertices[_0x422a('0x12')][_0x422a('0x82')]=function(_0x450544,_0x21d6cb){scripts['ispeechTTS'](_0x450544[_0x422a('0x7c')],_0x450544[_0x422a('0x5c')],_0x450544[_0x422a('0x83')]||'en-US',_0x450544[_0x422a('0x84')])[_0x422a('0x19')](function(_0x3906f1){_0x21d6cb(null,_0x3906f1);})[_0x422a('0x1a')](function(_0xd9685a){_0x21d6cb(_0xd9685a);});};AGIVertices[_0x422a('0x12')][_0x422a('0x85')]=function(_0x5b3f89,_0x2d28b4,_0x4af932){scripts['ispeechASR'](_0x2d28b4,_0x5b3f89['key'],_0x5b3f89[_0x422a('0x86')]||_0x422a('0x5e'),this[_0x422a('0x87')](_0x5b3f89['model'])?_0x5b3f89[_0x422a('0x88')]:undefined)[_0x422a('0x19')](function(_0x42bec3){_0x4af932(null,_0x42bec3);})['catch'](function(_0x5ebd39){_0x4af932(_0x5ebd39);});};AGIVertices[_0x422a('0x12')][_0x422a('0x89')]=function(_0x2e9c08,_0x1732ff){scripts['awsPolly'](_0x2e9c08[_0x422a('0x8a')],_0x2e9c08[_0x422a('0x8b')],_0x2e9c08[_0x422a('0x8c')],_0x2e9c08[_0x422a('0x8d')]||'Amy',_0x2e9c08[_0x422a('0x5c')],_0x2e9c08[_0x422a('0x8e')]||'text')[_0x422a('0x19')](function(_0x54c5f6){_0x1732ff(null,_0x54c5f6);})[_0x422a('0x1a')](function(_0x30d559){_0x1732ff(_0x30d559);});};AGIVertices[_0x422a('0x12')][_0x422a('0x8f')]=function(_0x297dd8,_0x280b1e){scripts[_0x422a('0x8f')](this[_0x422a('0x11')][_0x422a('0x3b')],_0x297dd8[_0x422a('0x8a')],_0x297dd8[_0x422a('0x8b')],_0x297dd8[_0x422a('0x90')],_0x297dd8['text'],_0x297dd8[_0x422a('0x91')])[_0x422a('0x19')](function(_0x1c0ce1){_0x280b1e(null,_0x1c0ce1);})['catch'](function(_0x376632){_0x280b1e(_0x376632);});};AGIVertices[_0x422a('0x12')][_0x422a('0x92')]=function(_0x4b79a9,_0x15e661,_0x3216ff){scripts[_0x422a('0x92')](_0x15e661,_0x4b79a9[_0x422a('0x7c')],_0x4b79a9[_0x422a('0x93')]||_0x422a('0x5e'))['then'](function(_0x32a03e){_0x3216ff(null,_0x32a03e);})[_0x422a('0x1a')](function(_0x12c454){_0x3216ff(_0x12c454);});};AGIVertices[_0x422a('0x12')]['tildeASR']=function(_0x21cf22,_0x607341,_0x4d2565){scripts[_0x422a('0x94')](_0x607341,_0x21cf22[_0x422a('0x95')],_0x21cf22[_0x422a('0x96')],_0x21cf22[_0x422a('0x74')])[_0x422a('0x19')](function(_0x1c0f3a){_0x4d2565(null,_0x1c0f3a);})['catch'](function(_0x233c81){_0x4d2565(_0x233c81);});};AGIVertices[_0x422a('0x12')][_0x422a('0x97')]=function(_0x33b317){var _0x5b003a=_[_0x422a('0x69')](verticesWithRetry,_0x33b317[_0x422a('0x3d')])?_0x33b317:_[_0x422a('0x98')](_0x33b317);for(var _0x18cc8a in _0x5b003a){if(_0x5b003a[_0x422a('0x99')](_0x18cc8a)){if(_0x5b003a[_0x18cc8a]&&_[_0x422a('0x9a')](_0x5b003a[_0x18cc8a])){if(_['includes'](recursiveMapAttributes,_0x18cc8a)){_0x5b003a[_0x18cc8a]=this[_0x422a('0x9b')](_0x5b003a[_0x18cc8a]);}else{_0x5b003a[_0x18cc8a]=this['replaceAllVariables'](_0x5b003a[_0x18cc8a]);}}}}return _0x5b003a;};AGIVertices[_0x422a('0x12')][_0x422a('0x9c')]=function(_0x1b79f8){for(var _0x3ab2a0 in _0x1b79f8){if(_0x1b79f8[_0x422a('0x99')](_0x3ab2a0)){if(_['isPlainObject'](_0x1b79f8[_0x3ab2a0])){this[_0x422a('0x9c')](_0x1b79f8[_0x3ab2a0]);}else if(_[_0x422a('0x9d')](_0x1b79f8[_0x3ab2a0])){for(var _0x9081a5=0x0;_0x9081a5<_0x1b79f8[_0x3ab2a0]['length'];_0x9081a5++){this[_0x422a('0x9c')](_0x1b79f8[_0x3ab2a0][_0x9081a5]);}}else if(_['isString'](_0x1b79f8[_0x3ab2a0])){_0x1b79f8[_0x3ab2a0]=this[_0x422a('0x9e')](_0x1b79f8[_0x3ab2a0]);}}}};AGIVertices[_0x422a('0x12')][_0x422a('0x9f')]=function(_0x32a935,_0x1c0c21){for(var _0x28f957 in _0x32a935){if(_0x32a935['hasOwnProperty'](_0x28f957)){if(_[_0x422a('0xa0')](_0x32a935[_0x28f957])){if(!_[_0x422a('0x4b')](_0x32a935[_0x28f957])){this[_0x422a('0x9f')](_0x32a935[_0x28f957],util['format'](_0x422a('0xa1'),_0x1c0c21,_0x28f957));}}else if(_['isArray'](_0x32a935[_0x28f957])){for(var _0x1464b8=0x0;_0x1464b8<_0x32a935[_0x28f957]['length'];_0x1464b8++){this[_0x422a('0x9f')](_0x32a935[_0x28f957][_0x1464b8],util[_0x422a('0x2d')]('%s.%s',_0x1c0c21,_0x28f957+'['+_0x1464b8+']'));}}else{if(!_[_0x422a('0x48')](_0x32a935[_0x28f957])){this[_0x422a('0x11')]['setVariable'](util[_0x422a('0x2d')](_0x422a('0xa1'),_0x1c0c21,_0x28f957),_0x32a935[_0x28f957]);}}}}};AGIVertices[_0x422a('0x12')][_0x422a('0x9b')]=function(_0x226606){try{var _0x64ccb9=JSON[_0x422a('0x6e')](_0x226606);this[_0x422a('0x9c')](_0x64ccb9);return JSON[_0x422a('0x76')](_0x64ccb9);}catch(_0x584a40){return this['replaceAllVariables'](_0x226606);}};AGIVertices['prototype'][_0x422a('0x9e')]=function(_0x277019){var _0x3a532c=_0x277019[_0x422a('0xa2')]('{');for(var _0x3b580b=0x1;_0x3b580b<_0x3a532c[_0x422a('0xa3')];_0x3b580b+=0x1){var _0x191c5f=_0x3a532c[_0x3b580b][_0x422a('0xa2')]('}');if(_0x191c5f[_0x422a('0xa3')]>0x1){_0x277019=_0x277019[_0x422a('0xa4')]('{'+_0x191c5f[0x0]+'}',this[_0x422a('0x11')][_0x422a('0x13')](_0x191c5f[0x0])[_0x422a('0xa5')]||_0x191c5f[0x0]);}}if(_0x3a532c[_0x422a('0xa3')]===0x1){return _0x277019[_0x422a('0x50')]();}return this[_0x422a('0x9e')](_0x277019);};AGIVertices[_0x422a('0x12')][_0x422a('0xa6')]=function(_0x2df36d,_0x27b2d0){var _0xf0ca7a=this[_0x422a('0x11')][_0x422a('0x13')](_0x2df36d);if(_0xf0ca7a[_0x422a('0xa7')]===-0x1){return _0xf0ca7a;}logger['info'](util['format'](_0x422a('0xa8'),_0x27b2d0,_0xf0ca7a[_0x422a('0xa5')]));return this['channel'][_0x422a('0xa9')](_0x27b2d0,_0xf0ca7a['extra']);};AGIVertices[_0x422a('0x12')][_0x422a('0x87')]=function(_0x4466bd){return _0x4466bd&&_0x4466bd!=='0'&&_0x4466bd!=='-1'&&_0x4466bd!=='';};AGIVertices[_0x422a('0x12')][_0x422a('0xaa')]=function(_0x49ad65){this[_0x422a('0x3a')][_0x422a('0x73')](this,_0x49ad65,'-');_0x49ad65[_0x422a('0xab')]=_0x49ad65['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x422a('0x12')][_0x422a('0xac')]=function(_0x13ef68){logger['info'](util[_0x422a('0x2d')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x13ef68[_0x422a('0x3c')]));if(!this['isConfigured'](_0x13ef68[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xae'));}var _0x1d53fe='\x22'+_0x13ef68[_0x422a('0x5c')]+'\x22';if(this[_0x422a('0x87')](_0x13ef68[_0x422a('0x7a')])){_0x1d53fe+=','+_0x13ef68[_0x422a('0x7a')];}var _0x1dc6a9=this[_0x422a('0x11')]['exec'](_0x422a('0xaf'),_0x1d53fe);if(_0x1dc6a9[_0x422a('0xa7')]===-0x1){return _0x1dc6a9;}return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1d53fe));};AGIVertices['prototype']['mrcprecog']=function(_0x275e98){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x275e98[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x275e98[_0x422a('0xb0')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xb1'));}var _0x495daa=_0x275e98[_0x422a('0xb0')];if(this[_0x422a('0x87')](_0x275e98['options'])){_0x495daa+=','+_0x275e98[_0x422a('0x7a')];}var _0x90b893=this[_0x422a('0x11')][_0x422a('0xb2')]('MRCPRecog',_0x495daa);if(_0x90b893[_0x422a('0xa7')]===-0x1){return _0x90b893;}var _0x1418b9=this[_0x422a('0xa6')](_0x422a('0xb3'),_0x422a('0xb4'));if(_0x1418b9[_0x422a('0xa7')]===-0x1){return _0x1418b9;}var _0x4bb4b1=this['getAndSetVariable']('RECOG_INPUT()',_0x422a('0xb5'));if(_0x4bb4b1[_0x422a('0xa7')]===-0x1){return _0x4bb4b1;}var _0x187268=this[_0x422a('0xa6')]('RECOG_INSTANCE()',_0x422a('0xb6'));if(_0x187268['result']===-0x1){return _0x187268;}return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xb7'),_0x495daa));};AGIVertices[_0x422a('0x12')][_0x422a('0x8')]=function(_0x382585){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xb8'),_0x382585[_0x422a('0x3c')]));return this['channel'][_0x422a('0x8')]([_0x382585[_0x422a('0xb9')],_0x382585['args']]);};AGIVertices['prototype'][_0x422a('0xba')]=function(_0x149629){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xbb'),_0x149629[_0x422a('0x3c')]));if(this[_0x422a('0x87')](_0x149629[_0x422a('0x67')])){logger[_0x422a('0x33')](util['format'](_0x422a('0xbc'),_0x149629['timeout']));var _0x40fa24=this[_0x422a('0x11')][_0x422a('0xbd')](_0x149629[_0x422a('0x67')]);if(_0x40fa24['result']===-0x1){return _0x40fa24;}}return this[_0x422a('0x11')][_0x422a('0xba')]();};AGIVertices[_0x422a('0x12')][_0x422a('0xbe')]=function(_0x328f73){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xbf'),_0x328f73[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x328f73['list_id'])){return this['channel'][_0x422a('0x30')](_0x328f73,_0x422a('0xc0'));}_0x328f73[_0x422a('0x4e')]=moment();if(this[_0x422a('0x87')](_0x328f73[_0x422a('0xc1')])){_0x328f73['scheduledAt']=moment()[_0x422a('0xc2')](_0x328f73[_0x422a('0xc1')],_0x422a('0xc3'));}if(!this[_0x422a('0x87')](_0x328f73[_0x422a('0x51')])){_0x328f73['callback_priority']=0x2;}this['createCmContact'][_0x422a('0x73')](this,_0x328f73);return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xc4'),_0x328f73[_0x422a('0xc5')],_0x328f73[_0x422a('0x4d')],_0x328f73[_0x422a('0x4e')]));};AGIVertices[_0x422a('0x12')]['custom_app']=function(_0x380588){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xc6'),_0x380588['label']));var _0x1389c9=this[_0x422a('0x11')]['exec'](_0x380588[_0x422a('0xc7')],_0x380588['options']);if(_0x1389c9[_0x422a('0xa7')]===-0x1){return _0x1389c9;}return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xc8'),_0x380588[_0x422a('0xc7')],_0x380588['options']));};AGIVertices[_0x422a('0x12')]['lumenvoxtts']=function(_0xa13b4f){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xa13b4f['label']));if(!this[_0x422a('0x87')](_0xa13b4f[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20text\x20configured');}var _0x18eceb='\x22'+_0xa13b4f[_0x422a('0x5c')]+'\x22';if(this[_0x422a('0x87')](_0xa13b4f[_0x422a('0x7a')])){_0x18eceb+=','+_0xa13b4f[_0x422a('0x7a')];}var _0x336862=this[_0x422a('0x11')][_0x422a('0xb2')](_0x422a('0xaf'),_0x18eceb);if(_0x336862[_0x422a('0xa7')]===-0x1){return _0x336862;}return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xc9'),_0x18eceb));};AGIVertices['prototype'][_0x422a('0xca')]=function(_0x4e7515){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xcb'),_0x4e7515[_0x422a('0x3c')]));if(!this['isConfigured'](_0x4e7515['text'])){return this['channel'][_0x422a('0xad')](_0x422a('0xae'));}var _0x1fc6fa='\x22'+_0x4e7515['text']+'\x22';if(this[_0x422a('0x87')](_0x4e7515[_0x422a('0x7a')])){_0x1fc6fa+=','+_0x4e7515['options'];}var _0x233a59=this[_0x422a('0x11')][_0x422a('0xb2')](_0x422a('0xaf'),_0x1fc6fa);if(_0x233a59[_0x422a('0xa7')]===-0x1){return _0x233a59;}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xc9'),_0x1fc6fa));};AGIVertices[_0x422a('0x12')]['lumenvoxasr']=function(_0x2af271){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2af271[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x2af271[_0x422a('0xb0')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xb1'));}var _0x15a283=_0x2af271[_0x422a('0xb0')];if(this['isConfigured'](_0x2af271['options'])){_0x15a283+=','+_0x2af271['options'];}var _0x15e42c=this[_0x422a('0x11')]['exec'](_0x422a('0xcc'),_0x15a283);if(_0x15e42c['result']===-0x1){return _0x15e42c;}var _0x5e4d28=this[_0x422a('0xa6')](_0x422a('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5e4d28['result']===-0x1){return _0x5e4d28;}var _0x217660=this[_0x422a('0xa6')]('RECOG_INPUT()',_0x422a('0xcd'));if(_0x217660[_0x422a('0xa7')]===-0x1){return _0x217660;}var _0x61c660=this['getAndSetVariable'](_0x422a('0xce'),_0x422a('0xcf'));if(_0x61c660[_0x422a('0xa7')]===-0x1){return _0x61c660;}return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xb7'),_0x15a283));};AGIVertices[_0x422a('0x12')][_0x422a('0xd0')]=function(_0x2fb3a1){logger[_0x422a('0x33')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2fb3a1[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x2fb3a1['grammar'])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xb1'));}var _0x7fa546=_0x2fb3a1[_0x422a('0xb0')];if(this[_0x422a('0x87')](_0x2fb3a1[_0x422a('0x7a')])){_0x7fa546+=','+_0x2fb3a1[_0x422a('0x7a')];}var _0x3f0d=this['channel'][_0x422a('0xb2')](_0x422a('0xcc'),_0x7fa546);if(_0x3f0d[_0x422a('0xa7')]===-0x1){return _0x3f0d;}var _0x4b20b0=this['getAndSetVariable'](_0x422a('0xb3'),'SESTEK_ASR_CONFIDENCE');if(_0x4b20b0['result']===-0x1){return _0x4b20b0;}var _0x142187=this[_0x422a('0xa6')](_0x422a('0xd1'),_0x422a('0xd2'));if(_0x142187[_0x422a('0xa7')]===-0x1){return _0x142187;}var _0x2da370=this[_0x422a('0xa6')]('RECOG_INSTANCE()',_0x422a('0xd3'));if(_0x2da370[_0x422a('0xa7')]===-0x1){return _0x2da370;}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xb7'),_0x7fa546));};AGIVertices[_0x422a('0x12')][_0x422a('0xd4')]=function(_0x5cfffb){logger[_0x422a('0x33')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5cfffb[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x5cfffb[_0x422a('0xd5')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x5cfffb,'no\x20database\x20selected');}var _0x2f20fa=this['getSquareOdbc'][_0x422a('0x73')](this,_0x5cfffb['odbc_id']);if(!_0x2f20fa){return this[_0x422a('0x11')][_0x422a('0x30')](_0x5cfffb,_0x422a('0xd6'));}if(!this[_0x422a('0x87')](_0x5cfffb[_0x422a('0x32')])){return this['channel'][_0x422a('0x30')](_0x5cfffb,'no\x20query\x20configured');}var _0x5c8453=_0x5cfffb[_0x422a('0x32')][_0x422a('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xd8'),_0x5c8453));var _0x515966=this['getQueryOdbc'][_0x422a('0x73')](this,_0x2f20fa,_0x5c8453);this[_0x422a('0x3a')][_0x422a('0x73')](this,_0x5cfffb,_0x5c8453);if(!this[_0x422a('0x87')](_0x5cfffb['variable_id'])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xd9'));}var _0x5fa3b9=this[_0x422a('0x13')]['sync'](this,_0x5cfffb['variable_id']);if(!_0x5fa3b9){return this['channel']['error'](_0x5cfffb,'no\x20variable\x20found');}var _0x31f02e=this;_0x515966[_0x422a('0xda')](function(_0xb94661,_0x3f19e7){Object['keys'](_0xb94661)[_0x422a('0xda')](function(_0x1e1e78){_0x31f02e[_0x422a('0x11')][_0x422a('0xa9')](util['format'](_0x422a('0xdb'),_0x5fa3b9,_0x3f19e7,_0x1e1e78),_0xb94661[_0x1e1e78]);});});this[_0x422a('0x11')][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0xdc'),_0x5fa3b9),_0x515966[_0x422a('0xa3')]);return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xdd'),_0x5fa3b9));};AGIVertices['prototype'][_0x422a('0xde')]=function(_0x22735e){logger[_0x422a('0xdf')](util['format'](_0x422a('0xe0'),_0x22735e[_0x422a('0x3c')]));if(!this['isConfigured'](_0x22735e[_0x422a('0xe1')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x22735e,_0x422a('0xe2'));}var _0x5c2d87=this[_0x422a('0x1f')][_0x422a('0x73')](this,_0x22735e[_0x422a('0xe1')]);if(!_0x5c2d87){return this[_0x422a('0x11')][_0x422a('0x30')](_0x22735e,'no\x20user\x20found');}var _0xbf4ac8=this['channel'][_0x422a('0xb2')]('DIAL',[util['format']('SIP/%s',_0x5c2d87),_0x22735e[_0x422a('0x67')],_0x22735e[_0x422a('0xe3')],_0x22735e['url']]);if(_0xbf4ac8[_0x422a('0xa7')]===-0x1){return _0xbf4ac8;}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xe4'),_0x422a('0xe5')));};AGIVertices[_0x422a('0x12')][_0x422a('0xe6')]=function(_0x229146){logger['info'](util[_0x422a('0x2d')](_0x422a('0xe7'),_0x229146[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x229146[_0x422a('0x7c')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0x422a('0x87')](_0x229146[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xae'));}this['channel']['bot']=!![];this[_0x422a('0x3a')](_0x229146);this[_0x422a('0x46')](_0x229146[_0x422a('0x5c')],'in','','');this[_0x422a('0x11')][_0x422a('0xad')](util['format'](_0x422a('0xe8'),_0x229146[_0x422a('0x5c')]));var _0x1aadba=this['googleDialogflow'][_0x422a('0x73')](this,_0x229146);if(_0x1aadba){for(var _0x263f83 in _0x1aadba){if(_0x1aadba['hasOwnProperty'](_0x263f83)){this[_0x422a('0x11')]['setVariable'](util[_0x422a('0x2d')](_0x422a('0xe9'),_0x263f83['toUpperCase']()),_0x1aadba[_0x263f83]);}}this[_0x422a('0x46')](_0x1aadba[_0x422a('0xea')],'out',_0x422a('0xe6'),'');return this[_0x422a('0x11')][_0x422a('0xad')](util['format'](_0x422a('0xeb'),_0x1aadba[_0x422a('0xea')]));}return this[_0x422a('0x11')]['error'](_0x229146,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x422a('0x12')]['dialogflowV2']=function(_0x502840){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0xec'),_0x502840[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x502840[_0x422a('0x7f')])){return this[_0x422a('0x11')]['noop'](_0x422a('0xed'));}if(!this[_0x422a('0x87')](_0x502840[_0x422a('0xee')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xef'));}if(!this[_0x422a('0x87')](_0x502840[_0x422a('0x80')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xf0'));}if(!this[_0x422a('0x87')](_0x502840[_0x422a('0xf1')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20anguage\x20configured');}if(!this[_0x422a('0x87')](_0x502840[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xae'));}this['channel'][_0x422a('0xf2')]=!![];this[_0x422a('0x3a')](_0x502840);this[_0x422a('0x46')](_0x502840['text'],'in','','');this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xf3'),_0x502840['text']));var _0x13b2e3=this[_0x422a('0x7e')][_0x422a('0x73')](this,_0x502840);if(_0x13b2e3){for(var _0x252683 in _0x13b2e3){if(_0x13b2e3['hasOwnProperty'](_0x252683)){if(_0x252683!=='providerResponse'){this[_0x422a('0x11')][_0x422a('0xa9')](util[_0x422a('0x2d')]('DIALOGFLOW_%s',_0x252683[_0x422a('0x6c')]()),_0x13b2e3[_0x252683]);}}}this[_0x422a('0x46')](_0x13b2e3[_0x422a('0xea')],_0x422a('0xf4'),_0x422a('0xf5'),_0x13b2e3[_0x422a('0xf6')]);return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xf7'),_0x13b2e3['speech']));}return this['channel'][_0x422a('0x30')](_0x502840,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x422a('0x12')]['sesteknda']=function(_0x1e07b3){logger[_0x422a('0x33')](util['format'](_0x422a('0xf8'),_0x1e07b3['label']));if(!this[_0x422a('0x87')](_0x1e07b3[_0x422a('0xf9')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x422a('0x87')](_0x1e07b3[_0x422a('0xfa')])){return this[_0x422a('0x11')]['noop'](_0x422a('0xfb'));}if(!this[_0x422a('0x87')](_0x1e07b3[_0x422a('0xfc')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xfd'));}if(!this[_0x422a('0x87')](_0x1e07b3[_0x422a('0xfe')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xae'));}this[_0x422a('0x11')][_0x422a('0xf2')]=!![];this[_0x422a('0x3a')](_0x1e07b3);this[_0x422a('0x46')](_0x1e07b3[_0x422a('0x5c')],'in','','');this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xff'),_0x1e07b3[_0x422a('0x5c')]));var _0x2e9d95=this[_0x422a('0x81')]['sync'](this,_0x1e07b3);if(_0x2e9d95){for(var _0x491576 in _0x2e9d95){if(_0x2e9d95[_0x422a('0x99')](_0x491576)){this['channel'][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0x100'),_0x491576['toUpperCase']()),_0x2e9d95[_0x491576]);}}this[_0x422a('0x46')](_0x2e9d95[_0x422a('0xea')],_0x422a('0xf4'),_0x422a('0x101'),'');if(_0x2e9d95[_0x422a('0x102')]){this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x103'),_0x2e9d95['audiofile']));var _0x102428=this[_0x422a('0x11')]['streamFile'](_0x2e9d95[_0x422a('0x102')]);try{fs[_0x422a('0x104')](_0x2e9d95[_0x422a('0x102')]+'.wav');}catch(_0x4935a5){logger[_0x422a('0x30')](_0x4935a5);}return _0x102428;}else{return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')]('SestekNDA\x20Result\x20%s',_0x2e9d95[_0x422a('0xea')]));}}return this[_0x422a('0x11')]['error'](_0x1e07b3,_0x422a('0x105'));};AGIVertices[_0x422a('0x12')]['end']=function(_0x578d82){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x106'),_0x578d82[_0x422a('0x3c')]));return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x107'));};AGIVertices[_0x422a('0x12')][_0x422a('0x108')]=function(_0x3f10dc){logger['info'](util[_0x422a('0x2d')](_0x422a('0x109'),_0x3f10dc[_0x422a('0x3c')]));var _0x58c6ed='';if(_0x3f10dc[_0x422a('0x10a')]){if(!this[_0x422a('0x87')](_0x3f10dc[_0x422a('0x10a')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x3f10dc,_0x422a('0x10b'));}else{var _0x293e1a=parseInt(_0x3f10dc[_0x422a('0x10a')],0xa);if(isNaN(_0x293e1a)){_0x58c6ed=_0x3f10dc[_0x422a('0x10a')];}else{_0x58c6ed=this[_0x422a('0x21')][_0x422a('0x73')](this,_0x3f10dc['trunk_id']);if(!_0x58c6ed){return this[_0x422a('0x11')][_0x422a('0x30')](_0x3f10dc,_0x422a('0x10c'));}}}}else if(_0x3f10dc[_0x422a('0x10d')]){_0x58c6ed=_0x3f10dc[_0x422a('0x10d')];}else{return this[_0x422a('0x11')]['error'](_0x3f10dc,_0x422a('0x10b'));}var _0x1d514b=this[_0x422a('0x11')]['exec'](_0x422a('0xe5'),[util[_0x422a('0x2d')]('SIP/%s/%s',_0x58c6ed,_0x3f10dc['phone']),_0x3f10dc[_0x422a('0x67')],_0x3f10dc[_0x422a('0xe3')],_0x3f10dc[_0x422a('0x66')]]);if(_0x1d514b[_0x422a('0xa7')]===-0x1){return _0x1d514b;}return this[_0x422a('0x11')]['noop'](util['format'](_0x422a('0xe4'),_0x422a('0xe5')));};AGIVertices[_0x422a('0x12')][_0x422a('0x10e')]=function(_0x25dd50){logger['info'](util[_0x422a('0x2d')](_0x422a('0x10f'),_0x25dd50[_0x422a('0x3c')]));return this['channel'][_0x422a('0xad')](_0x422a('0x10e'));};AGIVertices[_0x422a('0x12')]['getdigits']=function(_0xb33094){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x110'),_0xb33094['label']));if(_0xb33094[_0x422a('0xab')]===0x0){return this[_0x422a('0xaa')](_0xb33094);}_0xb33094[_0x422a('0xab')]-=0x1;if(!this[_0x422a('0x87')](_0xb33094['file_id'])){return this['channel'][_0x422a('0x30')](_0xb33094,_0x422a('0x111'));}var _0x48fe43=this[_0x422a('0x23')]['sync'](this,_0xb33094['file_id']);if(!_0x48fe43){return this[_0x422a('0x11')][_0x422a('0x30')](_0xb33094,'no\x20file\x20audio\x20found');}if(!this[_0x422a('0x87')](_0xb33094[_0x422a('0x112')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x422a('0xd9'));}var _0x4735a8=this[_0x422a('0x11')][_0x422a('0x113')](_0x48fe43,_0xb33094[_0x422a('0x114')],_0xb33094[_0x422a('0x115')]);var _0x51aca7=_0x4735a8[_0x422a('0xa7')]?_0x4735a8[_0x422a('0xa7')]['toString']():'';logger['info'](_0x422a('0x116'),JSON[_0x422a('0x76')](_0x4735a8));if(_0x4735a8['result']===-0x1){this[_0x422a('0x3a')]['sync'](this,_0xb33094,_0x51aca7);return _0x4735a8;}else if(_0x4735a8[_0x422a('0xa5')]==='timeout'){_0x4735a8[_0x422a('0xa7')]=_0x51aca7[_0x422a('0xa3')]>=parseInt(_0xb33094[_0x422a('0x117')])?'x':'i';}else{_0x4735a8['result']=_0x51aca7[_0x422a('0xa3')]>=parseInt(_0xb33094[_0x422a('0x117')])&&_0x51aca7[_0x422a('0xa3')]<=parseInt(_0xb33094['maxdigit'])?'x':'i';}var _0x142568=this[_0x422a('0x13')][_0x422a('0x73')](this,_0xb33094[_0x422a('0x112')]);if(!_0x142568){return this[_0x422a('0x11')][_0x422a('0x30')](_0xb33094,_0x422a('0x118'));}this[_0x422a('0x11')][_0x422a('0xa9')](_0x142568,_0x51aca7);if(this['isConfigured'](_0xb33094[_0x422a('0x119')])){var _0x29371f=parseInt(_0xb33094[_0x422a('0x119')],0xa);var _0xad4ef7=rs[_0x422a('0x11a')]({'charset':'*','length':_0x29371f});var _0x445e49=_0x51aca7[_0x422a('0xa3')];if(_0x445e49>0x0){if(_0x445e49>_0x29371f){this[_0x422a('0x3a')]['sync'](this,_0xb33094,_0xb33094[_0x422a('0x11b')]==='first'?_0xad4ef7+_0x51aca7[_0x422a('0x11c')](_0x29371f):_0x51aca7[_0x422a('0x11c')](0x0,_0x445e49-_0x29371f)+_0xad4ef7);}else{this['createSquareDetailsReport'][_0x422a('0x73')](this,_0xb33094,rs[_0x422a('0x11a')]({'charset':'*','length':_0x445e49}));}}else{this[_0x422a('0x3a')]['sync'](this,_0xb33094,'');}}else{this[_0x422a('0x3a')][_0x422a('0x73')](this,_0xb33094,_0x51aca7);}return _0x4735a8;};AGIVertices[_0x422a('0x12')][_0x422a('0x10')]=function(_0x29c6ff){logger['info'](util[_0x422a('0x2d')](_0x422a('0x11d'),_0x29c6ff['label']));return this[_0x422a('0xf')](_0x29c6ff);};AGIVertices['prototype']['goal']=function(_0x171e17){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x11e'),_0x171e17[_0x422a('0x3c')]));this['createSquareDetailsReport']['sync'](this,_0x171e17,_0x171e17['goalname']);return this['channel'][_0x422a('0xad')](util['format'](_0x422a('0x11f'),_0x171e17[_0x422a('0x120')]));};AGIVertices[_0x422a('0x12')][_0x422a('0x121')]=function(_0x10fede){logger['info'](util[_0x422a('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x10fede[_0x422a('0x3c')]));if(!this['isConfigured'](_0x10fede['aws_access_key_id'])||!this['isConfigured'](_0x10fede[_0x422a('0x8b')])){return this['channel'][_0x422a('0xad')](_0x422a('0x122'));}if(!this[_0x422a('0x87')](_0x10fede[_0x422a('0x5c')])){return this[_0x422a('0x11')]['noop']('no\x20text\x20configured');}this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x123'),_0x10fede[_0x422a('0x5c')]));var _0x3d5bed=this[_0x422a('0x89')][_0x422a('0x73')](this,_0x10fede);if(_0x3d5bed){this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x3d5bed));var _0xde6643=this['channel'][_0x422a('0x124')](_0x3d5bed);try{fs[_0x422a('0x104')](_0x3d5bed+_0x422a('0x125'));}catch(_0x5f1da5){logger[_0x422a('0x30')](_0x5f1da5);}return _0xde6643;}return this['channel']['error'](_0x10fede,_0x422a('0x126'));};AGIVertices[_0x422a('0x12')][_0x422a('0x127')]=function(_0x3efe69){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x128'),_0x3efe69[_0x422a('0x3c')]));if(!this['isConfigured'](_0x3efe69[_0x422a('0x8a')])||!this[_0x422a('0x87')](_0x3efe69['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x422a('0x87')](_0x3efe69[_0x422a('0x91')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20bot\x20name\x20configured');}if(!this[_0x422a('0x87')](_0x3efe69['text'])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20text\x20configured');}this[_0x422a('0x11')]['bot']=!![];this[_0x422a('0x3a')](_0x3efe69);this['createSquareMessage'](_0x3efe69[_0x422a('0x5c')],'in','','');this['channel'][_0x422a('0xad')](util['format'](_0x422a('0x129'),_0x3efe69['text']));var _0xed97b5=this[_0x422a('0x8f')][_0x422a('0x73')](this,_0x3efe69);if(_0xed97b5){for(var _0x5922b0 in _0xed97b5){if(_0xed97b5[_0x422a('0x99')](_0x5922b0)&&_[_0x422a('0x9a')](_0xed97b5[_0x5922b0])){this[_0x422a('0x11')][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0x12a'),_0x5922b0['toUpperCase']()),_0xed97b5[_0x5922b0]);}}if(_[_0x422a('0x48')](_0xed97b5[_0x422a('0x12b')])){return this['channel'][_0x422a('0xad')](_0x422a('0x12c'));}else{this[_0x422a('0x46')](_0xed97b5['message'],_0x422a('0xf4'),_0x422a('0x12d'),'');return this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x12e'),_0xed97b5[_0x422a('0x12b')]));}}return this[_0x422a('0x11')][_0x422a('0x30')](_0x3efe69,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x422a('0x12')]['googleasr']=function(_0x47f3a3){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x12f'),_0x47f3a3[_0x422a('0x3c')],_0x47f3a3[_0x422a('0x67')]));if(!this[_0x422a('0x87')](_0x47f3a3[_0x422a('0x7c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x130'));}var _0x33eb9c=_0x422a('0x131');var _0x56a4f4=util[_0x422a('0x2d')](_0x422a('0x132'),FILES_PATH,rs['generate'](0x4));var _0x2082fe=util[_0x422a('0x2d')](_0x422a('0xa1'),_0x56a4f4,_0x33eb9c);var _0x49e818=!![];if(_0x47f3a3[_0x422a('0x133')]==='NOBEEP'){_0x49e818=![];}var _0x38a139=this[_0x422a('0x11')][_0x422a('0x134')](_0x56a4f4,_0x33eb9c,_0x47f3a3[_0x422a('0x135')],_0x47f3a3[_0x422a('0x67')],undefined,_0x49e818);if(_0x38a139[_0x422a('0xa7')]!==-0x1){this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x136'),_0x2082fe));var _0x5bd4bc=this[_0x422a('0x92')]['sync'](this,_0x47f3a3,_0x2082fe);if(_0x5bd4bc){for(var _0x3e4ba6 in _0x5bd4bc){if(_0x5bd4bc[_0x422a('0x99')](_0x3e4ba6)){this['channel'][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0x137'),_0x3e4ba6[_0x422a('0x6c')]()),_0x5bd4bc[_0x3e4ba6]);}}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x138'),JSON[_0x422a('0x76')](_0x5bd4bc)));}}return _0x38a139;};AGIVertices[_0x422a('0x12')][_0x422a('0x139')]=function(_0x12571b){logger[_0x422a('0x33')](util['format'](_0x422a('0x13a'),_0x12571b[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x12571b[_0x422a('0x95')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20appid\x20configured');}if(!this[_0x422a('0x87')](_0x12571b[_0x422a('0x96')])){return this[_0x422a('0x11')]['noop'](_0x422a('0x13b'));}var _0x80b5a7=_0x422a('0x131');var _0x385fbb=util[_0x422a('0x2d')]('%s/recordings/%s',FILES_PATH,rs[_0x422a('0x11a')](0x4));var _0x156e53=util[_0x422a('0x2d')](_0x422a('0xa1'),_0x385fbb,_0x80b5a7);var _0x235b4f=!![];if(_0x12571b[_0x422a('0x133')]===_0x422a('0x13c')){_0x235b4f=![];}var _0x668113=this['channel'][_0x422a('0x134')](_0x385fbb,_0x80b5a7,_0x12571b[_0x422a('0x135')],_0x12571b[_0x422a('0x67')],undefined,_0x235b4f);if(_0x668113['result']!==-0x1){this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x13d'),_0x156e53));var _0x9f89a9=this['tildeASR'][_0x422a('0x73')](this,_0x12571b,_0x156e53);if(_0x9f89a9){for(var _0x3ee13b in _0x9f89a9){if(_0x9f89a9[_0x422a('0x99')](_0x3ee13b)){this[_0x422a('0x11')]['setVariable'](util[_0x422a('0x2d')](_0x422a('0x13e'),_0x3ee13b[_0x422a('0x6c')]()),_0x9f89a9[_0x3ee13b]);}}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')]('TildeASR\x20Result\x20%s',JSON[_0x422a('0x76')](_0x9f89a9)));}}return _0x668113;};AGIVertices[_0x422a('0x12')][_0x422a('0x13f')]=function(_0x516a2a){logger['info'](util[_0x422a('0x2d')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x516a2a['label']));return this['channel']['continueAt'](_0x516a2a['context'],_0x516a2a[_0x422a('0x140')],_0x516a2a[_0x422a('0x43')]);};AGIVertices[_0x422a('0x12')][_0x422a('0x141')]=function(_0x488825){logger[_0x422a('0x33')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x488825[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x488825[_0x422a('0x142')])){return this[_0x422a('0x11')]['error'](_0x488825,_0x422a('0x143'));}try{var _0x10fbde=eval(_0x488825[_0x422a('0x142')])?_0x422a('0x144'):_0x422a('0x145');this['channel'][_0x422a('0xad')](util['format'](_0x422a('0x146'),_0x488825[_0x422a('0x142')],_0x10fbde));return{'code':0xc8,'result':_0x10fbde};}catch(_0x82f9c6){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x422a('0x12')]['gotoiftime']=function(_0x241d00){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x147'),_0x241d00[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x241d00[_0x422a('0x148')])){return this[_0x422a('0x11')]['error'](_0x241d00,'no\x20interval\x20configured');}var _0x48f852=this['getIntervals'][_0x422a('0x73')](this,_0x241d00['interval_id']);if(!_0x48f852){return this[_0x422a('0x11')]['error'](_0x241d00,'no\x20intervals\x20found');}for(var _0x244d9e=0x0;_0x244d9e<_0x48f852[_0x422a('0xa3')];_0x244d9e+=0x1){var _0x5541f3=this[_0x422a('0x11')][_0x422a('0x13')](util[_0x422a('0x2d')](_0x422a('0x149'),_0x48f852[_0x244d9e]));if(_0x5541f3[_0x422a('0xa7')]===-0x1){return _0x5541f3;}logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x14a'),_0x48f852[_0x244d9e],_0x5541f3[_0x422a('0xa5')]));if(_0x5541f3[_0x422a('0xa5')]===_0x422a('0x144')){logger[_0x422a('0x33')](util['format'](_0x422a('0x14a'),_0x48f852[_0x244d9e],'true'));this['channel']['noop'](util[_0x422a('0x2d')](_0x422a('0x14a'),_0x48f852[_0x244d9e],_0x422a('0x144')));return{'code':0xc8,'result':_0x422a('0x144')};}else{logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x14a'),_0x48f852[_0x244d9e],_0x422a('0x145')));this['channel'][_0x422a('0xad')](util['format']('IFTIME\x20%s\x20%s',_0x48f852[_0x244d9e],_0x422a('0x145')));}}return{'code':0xc8,'result':_0x422a('0x145')};};AGIVertices[_0x422a('0x12')][_0x422a('0x14b')]=function(_0x51a1c5){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x14c'),_0x51a1c5[_0x422a('0x3c')]));return this[_0x422a('0x11')]['hangup']();};AGIVertices[_0x422a('0x12')][_0x422a('0x14d')]=function(_0x327dde){logger[_0x422a('0x33')](util['format'](_0x422a('0x14e'),_0x327dde[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x327dde[_0x422a('0x7c')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x28b4ab=_0x422a('0x131');var _0x15fa4b=util['format'](_0x422a('0x132'),FILES_PATH,rs['generate'](0x4));var _0x4323d5=util[_0x422a('0x2d')](_0x422a('0xa1'),_0x15fa4b,_0x28b4ab);var _0x66ed13=!![];if(_0x327dde['beep']===_0x422a('0x13c')){_0x66ed13=![];}var _0x1def33=this['channel']['recordFile'](_0x15fa4b,_0x28b4ab,_0x327dde['intKey'],_0x327dde[_0x422a('0x67')],undefined,_0x66ed13);if(_0x1def33[_0x422a('0xa7')]!==-0x1){this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x14f'),_0x4323d5));var _0x14def7=this['ispeechASR']['sync'](this,_0x327dde,_0x4323d5);if(_0x14def7){for(var _0x519b4e in _0x14def7){if(_0x14def7['hasOwnProperty'](_0x519b4e)){this[_0x422a('0x11')][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0x150'),_0x519b4e[_0x422a('0x6c')]()),_0x14def7[_0x519b4e]);}}return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0x422a('0x76')](_0x14def7)));}}return _0x1def33;};AGIVertices['prototype'][_0x422a('0x151')]=function(_0x512de2){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x152'),_0x512de2['label']));if(!this[_0x422a('0x87')](_0x512de2[_0x422a('0x7c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x130'));}if(!this['isConfigured'](_0x512de2[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20text\x20configured');}this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x512de2[_0x422a('0x5c')]));var _0x28f42d=this['ispeechTTS']['sync'](this,_0x512de2);if(_0x28f42d){this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x14f'),_0x28f42d));var _0x45266e=this[_0x422a('0x11')][_0x422a('0x124')](_0x28f42d,_0x512de2[_0x422a('0x135')]);try{fs[_0x422a('0x104')](_0x28f42d+_0x422a('0x125'));}catch(_0x1d3eb4){logger[_0x422a('0x30')](_0x1d3eb4);}return _0x45266e;}return this[_0x422a('0x11')][_0x422a('0x30')](_0x512de2,_0x422a('0x153'));};AGIVertices['prototype'][_0x422a('0x154')]=function(_0x184706){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x155'),_0x184706[_0x422a('0x3c')]));if(!this['isConfigured'](_0x184706[_0x422a('0x156')])){return this['channel'][_0x422a('0x30')](_0x184706,_0x422a('0x157'));}logger[_0x422a('0x33')](util['format'](_0x422a('0x158'),this['channel'][_0x422a('0x40')],_0x184706['findBy']));var _0x3b8af3=this[_0x422a('0x56')][_0x422a('0x73')](this,_0x184706[_0x422a('0x156')]);if(_0x3b8af3){logger['info'](util[_0x422a('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x422a('0x40')],_0x184706[_0x422a('0x156')]));this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x159'),this['channel'][_0x422a('0x40')],_0x184706[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15a')};}else{logger[_0x422a('0x33')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x422a('0x40')],_0x184706[_0x422a('0x156')]));this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x15b'),this[_0x422a('0x11')][_0x422a('0x40')],_0x184706['findBy']));return{'code':0xc8,'result':_0x422a('0x15c')};}};AGIVertices[_0x422a('0x12')][_0x422a('0x15d')]=function(_0x90abe3){logger[_0x422a('0x33')](util['format'](_0x422a('0x15e'),_0x90abe3[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x90abe3[_0x422a('0x156')])){return this[_0x422a('0x11')]['error'](_0x90abe3,'no\x20find\x20by\x20configured');}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x422a('0x11')][_0x422a('0x40')],_0x90abe3['findBy']));var _0x585a3=this[_0x422a('0x55')][_0x422a('0x73')](this,_0x90abe3['findBy']);if(_0x585a3){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x422a('0x11')][_0x422a('0x40')],_0x90abe3['findBy']));this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x422a('0x11')]['callerid'],_0x90abe3[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15a')};}else{logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x15b'),this[_0x422a('0x11')][_0x422a('0x40')],_0x90abe3[_0x422a('0x156')]));this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x15b'),this[_0x422a('0x11')][_0x422a('0x40')],_0x90abe3[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15c')};}};AGIVertices[_0x422a('0x12')][_0x422a('0x15f')]=function(_0x207b07){logger[_0x422a('0x33')](util['format'](_0x422a('0x160'),_0x207b07['label']));if(!this['isConfigured'](_0x207b07[_0x422a('0x161')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x207b07,_0x422a('0x162'));}this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x163'),_0x207b07[_0x422a('0x161')]));var _0xcb0ad2=eval(_0x207b07[_0x422a('0x161')]);if(!this[_0x422a('0x87')](_0x207b07[_0x422a('0x112')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xd9'));}var _0x39a500=this[_0x422a('0x13')]['sync'](this,_0x207b07['variable_id']);if(!_0x39a500){return this['channel'][_0x422a('0x30')](_0x207b07,'no\x20variable\x20found');}if(_[_0x422a('0x9d')](_0xcb0ad2)){var _0x1f1c59=this;_0xcb0ad2[_0x422a('0xda')](function(_0x461c87,_0x198a5c){_0x1f1c59[_0x422a('0x11')][_0x422a('0xa9')](util['format'](_0x422a('0x164'),_0x39a500,_0x198a5c),_0x461c87);});return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')]('variable\x20%s[key]\x20set',_0x39a500));}else{return this[_0x422a('0x11')][_0x422a('0xa9')](_0x39a500,_0xcb0ad2);}};AGIVertices[_0x422a('0x12')][_0x422a('0xe')]=function(_0x3f6e32){logger['info'](util['format'](_0x422a('0x165'),_0x3f6e32['label']));if(_0x3f6e32[_0x422a('0xab')]===0x0){return this[_0x422a('0xaa')](_0x3f6e32);}_0x3f6e32[_0x422a('0xab')]-=0x1;if(!this[_0x422a('0x87')](_0x3f6e32[_0x422a('0x166')])){return this['channel'][_0x422a('0x30')](_0x3f6e32,_0x422a('0x111'));}var _0x360b42=this[_0x422a('0x23')][_0x422a('0x73')](this,_0x3f6e32[_0x422a('0x166')]);if(!_0x360b42){return this[_0x422a('0x11')]['error'](_0x3f6e32,_0x422a('0x167'));}var _0x12e2ea=this[_0x422a('0x11')]['getData'](_0x360b42,_0x3f6e32[_0x422a('0x114')],_0x3f6e32[_0x422a('0x168')]);var _0x2c8afb=_0x12e2ea[_0x422a('0xa7')];if(_0x12e2ea['result']===-0x1){this[_0x422a('0x3a')][_0x422a('0x73')](this,_0x3f6e32,'-1');return _0x12e2ea;}else if(_0x12e2ea[_0x422a('0xa5')]===_0x422a('0x67')){_0x12e2ea[_0x422a('0xa7')]=_0x12e2ea['result'][_0x422a('0xa3')]>0x0?_0x12e2ea[_0x422a('0xa7')]:'t';}else if(_['isEmpty'](_0x12e2ea['result'])){_0x12e2ea[_0x422a('0xa7')]='#';_0x2c8afb='#';}if(!this['isConfigured'](_0x3f6e32['variable_id'])){this[_0x422a('0x11')]['noop'](_0x422a('0xd9'));}else{var _0x3d69ad=this[_0x422a('0x13')][_0x422a('0x73')](this,_0x3f6e32[_0x422a('0x112')]);if(!_0x3d69ad){return this[_0x422a('0x11')][_0x422a('0x30')](_0x3f6e32,_0x422a('0x118'));}this['channel'][_0x422a('0xa9')](_0x3d69ad,_0x2c8afb);}this[_0x422a('0x3a')]['sync'](this,_0x3f6e32,_0x2c8afb);return _0x12e2ea;};AGIVertices[_0x422a('0x12')]['noop']=function(_0x450493){logger['info'](util[_0x422a('0x2d')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x450493[_0x422a('0x3c')]));return this[_0x422a('0x11')][_0x422a('0xad')](_0x450493[_0x422a('0x169')]||_0x450493[_0x422a('0x3c')]);};AGIVertices[_0x422a('0x12')][_0x422a('0x16a')]=function(_0x10270f){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x16b'),_0x10270f[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x10270f[_0x422a('0x156')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x10270f,_0x422a('0x157'));}logger[_0x422a('0x33')](util[_0x422a('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x422a('0x11')]['callerid'],_0x10270f['findBy']));var _0x3109e6=this['getPause']['sync'](this,_0x10270f['pause_id']);var _0x13bf3c=this[_0x422a('0x16c')][_0x422a('0x73')](this,_0x10270f[_0x422a('0x156')],_0x3109e6);if(_0x13bf3c){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x159'),this[_0x422a('0x11')][_0x422a('0x40')],_0x10270f[_0x422a('0x156')]));this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x159'),this[_0x422a('0x11')][_0x422a('0x40')],_0x10270f[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15a')};}else{logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x15b'),this[_0x422a('0x11')][_0x422a('0x40')],_0x10270f[_0x422a('0x156')]));this['channel'][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x159'),this['channel']['callerid'],_0x10270f['findBy']));return{'code':0xc8,'result':_0x422a('0x15c')};}};AGIVertices[_0x422a('0x12')]['playback']=function(_0x2c1a3a){logger['info'](util[_0x422a('0x2d')](_0x422a('0x16d'),_0x2c1a3a['label']));if(!this[_0x422a('0x87')](_0x2c1a3a[_0x422a('0x166')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x2c1a3a,_0x422a('0x111'));}var _0x20f030=this[_0x422a('0x23')][_0x422a('0x73')](this,_0x2c1a3a[_0x422a('0x166')]);if(!_0x20f030){return this[_0x422a('0x11')][_0x422a('0x30')](_0x2c1a3a,'no\x20file\x20audio\x20found');}var _0x1f431a=this[_0x422a('0x11')][_0x422a('0xb2')]('PLAYBACK',[_0x20f030,_0x2c1a3a[_0x422a('0xe3')]]);if(_0x1f431a['result']===-0x1){return _0x1f431a;}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0xc8'),_0x422a('0x16e'),_0x20f030));};AGIVertices[_0x422a('0x12')][_0x422a('0x16f')]=function(_0x5af47b){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x170'),_0x5af47b['label']));if(!this[_0x422a('0x87')](_0x5af47b[_0x422a('0x171')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x5af47b,_0x422a('0x172'));}var _0x4c0799='';var _0x5755da=parseInt(_0x5af47b['queue_id'],0xa);if(isNaN(_0x5755da)){_0x4c0799=_0x5af47b[_0x422a('0x171')];}else{_0x4c0799=this[_0x422a('0x17')][_0x422a('0x73')](this,_0x5af47b['queue_id']);if(!_0x4c0799){return this[_0x422a('0x11')][_0x422a('0x30')](_0x5af47b,_0x422a('0x173'));}}var _0x228d18='';if(this[_0x422a('0x87')](_0x5af47b['file_id'])){var _0x2d2750=this[_0x422a('0x23')][_0x422a('0x73')](this,_0x5af47b[_0x422a('0x166')]);if(_0x2d2750){_0x228d18=_0x2d2750;}}this[_0x422a('0x3a')][_0x422a('0x73')](this,_0x5af47b,_0x4c0799);if(_0x5af47b[_0x422a('0xe3')][_0x422a('0x174')]('x')<0x0){_0x5af47b[_0x422a('0xe3')]+='x';}if(_0x5af47b[_0x422a('0xe3')]['indexOf']('X')<0x0){_0x5af47b[_0x422a('0xe3')]+='X';}this[_0x422a('0x11')]['setVariable']('XMCS-QUEUE',_0x4c0799?_0x4c0799[_0x422a('0x175')]():'');var _0x477edf=this[_0x422a('0x11')]['exec'](_0x422a('0x176'),[_0x4c0799,_0x5af47b['opts'],_0x5af47b['url'],_0x228d18,_0x5af47b['timeout'],_0x5af47b[_0x422a('0x8')],_0x5af47b['macro'],_0x5af47b[_0x422a('0x177')],'',_0x5af47b[_0x422a('0x178')]]);if(_0x477edf[_0x422a('0xa7')]===-0x1){return _0x477edf;}return this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')]('Executed\x20command\x20%s\x20%s',_0x422a('0x176'),_0x4c0799));};AGIVertices['prototype'][_0x422a('0x179')]=function(_0x1fde0c){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x17a'),_0x1fde0c['label']));var _0x2e9088=_0x1fde0c['recordingFormat']||'wav';var _0x21a351=util[_0x422a('0x2d')](_0x422a('0x17b'),this['channel'][_0x422a('0x3b')],rs['generate'](0x5));var _0x72a0f4=util['format'](_0x422a('0x17c'),FILES_PATH,_0x21a351,_0x2e9088);var _0x2cb0e6=util['format'](_0x422a('0x132'),FILES_PATH,_0x21a351);this[_0x422a('0x3f')][_0x422a('0x73')](this,_0x1fde0c,_0x21a351,_0x72a0f4);this[_0x422a('0x11')][_0x422a('0xa9')](_0x422a('0x17d'),_0x21a351);logger[_0x422a('0x33')](_0x422a('0x17e'),_0x2cb0e6,_0x2e9088,_0x1fde0c['escape_digits'],_0x1fde0c[_0x422a('0x67')]);return this[_0x422a('0x11')][_0x422a('0x134')](_0x2cb0e6,_0x2e9088,_0x1fde0c['escape_digits'],_0x1fde0c[_0x422a('0x67')],undefined,!![]);};AGIVertices[_0x422a('0x12')][_0x422a('0x17f')]=function(_0x524c8f){logger[_0x422a('0x33')](util['format'](_0x422a('0x180'),_0x524c8f[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x524c8f[_0x422a('0x66')])){return this[_0x422a('0x11')]['noop'](_0x422a('0x181'));}var _0x56c65c=this[_0x422a('0x65')][_0x422a('0x73')](this,_0x524c8f);logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x182'),util['inspect'](_0x56c65c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x524c8f[_0x422a('0x112')])){return this[_0x422a('0x11')][_0x422a('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3f2ba8=this[_0x422a('0x13')][_0x422a('0x73')](this,_0x524c8f[_0x422a('0x112')]);if(!_0x3f2ba8){return this[_0x422a('0x11')][_0x422a('0x30')](_0x524c8f,_0x422a('0x118'));}this[_0x422a('0x11')][_0x422a('0xa9')](util[_0x422a('0x2d')]('%s_STATUS_CODE',_0x3f2ba8),_0x56c65c[_0x422a('0x78')]?_0x56c65c[_0x422a('0x78')]:_0x422a('0x183'));this['channel'][_0x422a('0xa9')](util[_0x422a('0x2d')](_0x422a('0x184'),_0x3f2ba8),_0x56c65c[_0x422a('0x79')]?_0x56c65c['statusMessage']:'OK');if(_0x56c65c[_0x422a('0x6d')]){try{this[_0x422a('0x9f')](_0x56c65c[_0x422a('0x6d')],_0x3f2ba8);}catch(_0x210632){logger[_0x422a('0x30')](util['format'](_0x422a('0x185'),_0x3f2ba8));}}return this[_0x422a('0x11')][_0x422a('0xad')](util['format']('variable\x20%s\x20set',_0x3f2ba8));};AGIVertices[_0x422a('0x12')][_0x422a('0x186')]=function(_0xc24bd){logger['info'](util['format'](_0x422a('0x187'),_0xc24bd[_0x422a('0x3c')]));return this['channel'][_0x422a('0x188')](_0xc24bd[_0x422a('0x189')][_0x422a('0xd7')](/\s+/g,''),_0xc24bd[_0x422a('0x18a')]);};AGIVertices[_0x422a('0x12')][_0x422a('0x18b')]=function(_0x210583){logger[_0x422a('0x33')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x210583['label']));return this[_0x422a('0x11')][_0x422a('0x18c')](_0x210583[_0x422a('0x68')]['replace'](/\s+/g,''),_0x210583['escape_digits']);};AGIVertices[_0x422a('0x12')][_0x422a('0x18d')]=function(_0x57fc19){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x18e'),_0x57fc19[_0x422a('0x3c')]));return this[_0x422a('0x11')]['sayPhonetic'](_0x57fc19[_0x422a('0x5c')],_0x57fc19[_0x422a('0x18a')]);};AGIVertices[_0x422a('0x12')]['sendMail']=function(_0x16081f){logger[_0x422a('0x33')](util['format'](_0x422a('0x18f'),_0x16081f[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x16081f[_0x422a('0x190')])){return this['channel'][_0x422a('0xad')](_0x422a('0x191'));}var _0x1557b0=this['getMailAccount'][_0x422a('0x73')](this,_0x16081f[_0x422a('0x190')]);if(!_0x1557b0||!_0x1557b0['Smtp']){return this[_0x422a('0x11')]['error'](_0x16081f,_0x422a('0x192'));}var _0x325401={'from':util[_0x422a('0x2d')](_0x422a('0x193'),_0x1557b0['name'],_0x1557b0[_0x422a('0x194')]||_0x1557b0[_0x422a('0x195')][_0x422a('0x196')]),'to':_0x16081f['to']||'','cc':_0x16081f['cc']||'','bcc':_0x16081f['bcc']||'','subject':_0x16081f[_0x422a('0x197')],'html':_0x16081f[_0x422a('0x5c')],'text':_0x16081f['text']};if(this['isConfigured'](_0x16081f['template_id'])){}logger[_0x422a('0xdf')](_0x422a('0x198'),JSON[_0x422a('0x76')](_0x325401));this[_0x422a('0x3a')]['sync'](this,_0x16081f,_0x16081f[_0x422a('0x190')]);this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1557b0[_0x422a('0x16')]));this['sendMailMessage'][_0x422a('0x73')](this,_0x1557b0[_0x422a('0x199')],_0x325401);return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x19a'));};AGIVertices['prototype'][_0x422a('0x19b')]=function(_0x3e371e){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x19c'),_0x3e371e[_0x422a('0x3c')]));return this[_0x422a('0x11')][_0x422a('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x422a('0x12')][_0x422a('0x19d')]=function(_0x2eebe9){logger[_0x422a('0x33')](util['format'](_0x422a('0x19e'),_0x2eebe9[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x2eebe9['sms_account_id'])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x19f'));}var _0x944570=this[_0x422a('0x37')]['sync'](this,_0x2eebe9[_0x422a('0x1a0')]);if(!_0x944570){return this[_0x422a('0x11')][_0x422a('0x30')](_0x2eebe9,'no\x20sms\x20account\x20found');}var _0x38752c={'body':_0x2eebe9[_0x422a('0x1a1')],'phone':_0x2eebe9['to']||'','SmsAccountId':_0x944570['id']};logger[_0x422a('0xdf')](_0x422a('0x1a2'),JSON[_0x422a('0x76')](_0x38752c));this['createSquareDetailsReport'][_0x422a('0x73')](this,_0x2eebe9,_0x2eebe9[_0x422a('0x1a0')]);this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x1a3'),_0x944570['name']));this[_0x422a('0x39')][_0x422a('0x73')](this,_0x38752c);return this[_0x422a('0x11')][_0x422a('0xad')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x422a('0x12')][_0x422a('0x1a4')]=function(_0x21e980){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x1a5'),_0x21e980[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x21e980[_0x422a('0x112')])){return this[_0x422a('0x11')]['error'](_0x21e980,_0x422a('0x1a6'));}var _0x38ef41=this[_0x422a('0x13')][_0x422a('0x73')](this,_0x21e980[_0x422a('0x112')]);if(!_0x38ef41){return this[_0x422a('0x11')][_0x422a('0x30')](_0x21e980,_0x422a('0x118'));}return this[_0x422a('0x11')][_0x422a('0xa9')](_0x38ef41,_0x21e980[_0x422a('0x1a7')]);};AGIVertices['prototype'][_0x422a('0x1a8')]=function(_0xe7f62c){logger['info'](util[_0x422a('0x2d')](_0x422a('0x1a9'),_0xe7f62c[_0x422a('0x3c')]));this[_0x422a('0x11')]['noop'](_0x422a('0x1aa'));if(_0xe7f62c['answer']===_0x422a('0x1ab')){this[_0x422a('0x11')]['noop']('Answer');return this[_0x422a('0x11')][_0x422a('0xba')]();}return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0x1ac'));};AGIVertices[_0x422a('0x12')][_0x422a('0x1ad')]=function(_0x39ec57){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x39ec57['label']));if(!this[_0x422a('0x87')](_0x39ec57[_0x422a('0x1ae')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x39ec57,_0x422a('0x1af'));}var _0x300bbd=this[_0x422a('0x1b')][_0x422a('0x73')](this,_0x39ec57['project_id']);if(!this[_0x422a('0x87')](_0x300bbd)){return this['channel'][_0x422a('0x30')](_0x39ec57,util[_0x422a('0x2d')](_0x422a('0x1b0'),_0x39ec57[_0x422a('0x1ae')]));}if(_0x300bbd===this[_0x422a('0x11')][_0x422a('0x3e')]){return this['channel']['error'](_0x39ec57,_0x422a('0x1b1'));}this['createSquareDetailsReport']['sync'](this,_0x39ec57,_0x300bbd);var _0x18c8a8=this[_0x422a('0x11')][_0x422a('0xb2')](_0x422a('0x1b2'),util[_0x422a('0x2d')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x422a('0x8')][_0x422a('0x1b3')]||_0x422a('0x1b4'),_0x300bbd,this[_0x422a('0x11')][_0x422a('0x3e')]));if(_0x18c8a8[_0x422a('0xa7')]===-0x1){return _0x18c8a8;}return this['channel'][_0x422a('0xad')](util['format']('Executed\x20command\x20%s\x20%s',_0x422a('0x1b2'),_0x300bbd));};AGIVertices[_0x422a('0x12')]['system']=function(_0x107543){logger['info'](util[_0x422a('0x2d')](_0x422a('0x1b5'),_0x107543['label']));var _0x1b84b8=this[_0x422a('0x1b6')][_0x422a('0x73')](this,_0x107543[_0x422a('0xb9')]);this[_0x422a('0x3a')]['sync'](this,_0x107543,_0x107543[_0x422a('0xb9')]);if(this[_0x422a('0x87')](_0x107543[_0x422a('0x112')])){var _0xbeda6d=this['getVariable']['sync'](this,_0x107543[_0x422a('0x112')]);if(_0xbeda6d){this[_0x422a('0x11')][_0x422a('0xa9')](_0xbeda6d,_0x1b84b8);return this[_0x422a('0x11')][_0x422a('0xad')](util['format'](_0x422a('0x1b7'),_0x107543[_0x422a('0xb9')],_0xbeda6d));}}return this[_0x422a('0x11')][_0x422a('0xad')](util['format'](_0x422a('0x1b8'),_0x107543[_0x422a('0xb9')]));};AGIVertices[_0x422a('0x12')][_0x422a('0x1b9')]=function(_0x50cd14){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x50cd14['label']));_0x50cd14[_0x422a('0x5c')]=_0x50cd14[_0x422a('0x5c')][_0x422a('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x50cd14[_0x422a('0x5a')])){return this['channel'][_0x422a('0xad')](_0x422a('0x1ba'));}if(!this[_0x422a('0x87')](_0x50cd14['text'])){return this[_0x422a('0x11')]['noop'](_0x422a('0xae'));}this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x50cd14[_0x422a('0x5c')]));var _0x407ce6=this[_0x422a('0x59')][_0x422a('0x73')](this,_0x50cd14);if(_0x407ce6){this['channel'][_0x422a('0xad')](util['format'](_0x422a('0x1bb'),_0x407ce6));var _0x221b90=this[_0x422a('0x11')][_0x422a('0x124')](_0x407ce6);try{fs[_0x422a('0x104')](_0x407ce6+_0x422a('0x125'));}catch(_0x1ab7be){logger['error'](_0x1ab7be);}return _0x221b90;}return this[_0x422a('0x11')][_0x422a('0x30')](_0x50cd14,_0x422a('0x1bc'));};AGIVertices[_0x422a('0x12')]['tts']=function(_0x164946){logger['info'](util['format'](_0x422a('0x1bd'),_0x164946[_0x422a('0x3c')]));_0x164946[_0x422a('0x5c')]=_0x164946[_0x422a('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x422a('0x87')](_0x164946[_0x422a('0x5c')])){return this[_0x422a('0x11')][_0x422a('0xad')](_0x422a('0xae'));}this[_0x422a('0x11')]['noop'](util[_0x422a('0x2d')](_0x422a('0x1be'),_0x164946[_0x422a('0x5c')]));var _0x5a99e4=this[_0x422a('0x63')][_0x422a('0x73')](this,_0x164946);if(_0x5a99e4){this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0x1bf'),_0x5a99e4));var _0x4980d7=this[_0x422a('0x11')][_0x422a('0x124')](_0x5a99e4);try{fs[_0x422a('0x104')](_0x5a99e4+_0x422a('0x125'));}catch(_0x192b37){logger[_0x422a('0x30')](_0x192b37);}return _0x4980d7;}return this[_0x422a('0x11')][_0x422a('0x30')](_0x164946,_0x422a('0x1c0'));};AGIVertices[_0x422a('0x12')]['unpause']=function(_0x242336){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x1c1'),_0x242336[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x242336[_0x422a('0x156')])){return this['channel'][_0x422a('0x30')](_0x242336,_0x422a('0x157'));}logger[_0x422a('0x33')](util['format'](_0x422a('0x158'),this[_0x422a('0x11')]['callerid'],_0x242336[_0x422a('0x156')]));var _0x572eac=this[_0x422a('0x54')][_0x422a('0x73')](this,_0x242336[_0x422a('0x156')]);if(_0x572eac){logger[_0x422a('0x33')](util[_0x422a('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x422a('0x11')][_0x422a('0x40')],_0x242336['findBy']));this[_0x422a('0x11')][_0x422a('0xad')](util['format'](_0x422a('0x159'),this[_0x422a('0x11')][_0x422a('0x40')],_0x242336[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15a')};}else{logger[_0x422a('0x33')](util[_0x422a('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x242336[_0x422a('0x156')]));this['channel']['noop'](util['format'](_0x422a('0x15b'),this[_0x422a('0x11')][_0x422a('0x40')],_0x242336[_0x422a('0x156')]));return{'code':0xc8,'result':_0x422a('0x15c')};}};AGIVertices[_0x422a('0x12')][_0x422a('0x1c2')]=function(_0x81733){logger['info'](util['format'](_0x422a('0x1c3'),_0x81733[_0x422a('0x3c')]));var _0x247673=this[_0x422a('0x11')][_0x422a('0xb2')]('VOICEMAIL',[_0x81733[_0x422a('0x1c4')],_0x81733[_0x422a('0x7a')]]);if(_0x247673['result']===-0x1){return _0x247673;}return this[_0x422a('0x11')][_0x422a('0xad')](util[_0x422a('0x2d')](_0x422a('0xc8'),_0x422a('0x1c5'),_0x81733[_0x422a('0x1c4')]));};AGIVertices[_0x422a('0x12')][_0x422a('0x1c6')]=function(_0x2147c3){logger[_0x422a('0x33')](util[_0x422a('0x2d')](_0x422a('0x1c7'),_0x2147c3[_0x422a('0x3c')]));if(!this[_0x422a('0x87')](_0x2147c3[_0x422a('0x112')])){return this[_0x422a('0x11')][_0x422a('0x30')](_0x2147c3,_0x422a('0x1a6'));}var _0x519a73=this['getVariable'][_0x422a('0x73')](this,_0x2147c3[_0x422a('0x112')]);if(!_0x519a73){return this[_0x422a('0x11')][_0x422a('0x30')](_0x2147c3,_0x422a('0x118'));}var _0x52ad72=this[_0x422a('0x11')][_0x422a('0x13')](_0x519a73);return{'code':0xc8,'result':_0x52ad72[_0x422a('0xa5')]?_0x52ad72[_0x422a('0xa5')]:'-'};};String[_0x422a('0x12')][_0x422a('0xa4')]=function(_0xd1c62,_0x4880d3){return this[_0x422a('0xa2')](_0xd1c62)[_0x422a('0x1c8')](_0x4880d3);};module[_0x422a('0x1c9')]=AGIVertices; \ No newline at end of file +var _0xde13=['awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','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','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','dialogflow','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','agi','host','system','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','streamFile','tts','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProjectById','then','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','googleTTS','restAPI','method','timeout','number','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model'];(function(_0x2cf5ac,_0x4d1255){var _0x5593a7=function(_0x173e8b){while(--_0x173e8b){_0x2cf5ac['push'](_0x2cf5ac['shift']());}};_0x5593a7(++_0x4d1255);}(_0xde13,0x146));var _0x3de1=function(_0x547d09,_0x3aa610){_0x547d09=_0x547d09-0x0;var _0x57b272=_0xde13[_0x547d09];return _0x57b272;};'use strict';var fs=require('fs');var util=require(_0x3de1('0x0'));var _=require(_0x3de1('0x1'));var sh=require(_0x3de1('0x2'));var odbc=require(_0x3de1('0x3'))();var rs=require(_0x3de1('0x4'));var moment=require('moment');var Mustache=require(_0x3de1('0x5'));var rp=require(_0x3de1('0x6'));var logger=require(_0x3de1('0x7'))('agi');var config=require(_0x3de1('0x8'));var shared=require('../../config/environment/shared');var scripts=require(_0x3de1('0x9'));var FILES_PATH=_0x3de1('0xa');var recursiveMapAttributes=[_0x3de1('0xb'),_0x3de1('0xc')];var verticesWithRetry=['menu',_0x3de1('0xd'),_0x3de1('0xe')];var AGIVertices=function(_0x441539,_0x51ac69,_0x4eb503){this['channel']=_0x441539;this[_0x3de1('0xf')]=_0x51ac69;this[_0x3de1('0x10')]=_0x4eb503;};AGIVertices[_0x3de1('0x11')]['getVariable']=function(_0x5f2183,_0x43158b){this[_0x3de1('0xf')]['getVariableById'](_0x5f2183)['then'](function(_0x982c03){_0x43158b(null,_0x982c03?_0x982c03['name']:![]);})['catch'](function(_0x5794ff){_0x43158b(_0x5794ff);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x12')]=function(_0x2ef0c1,_0xa014a6){this['rpc'][_0x3de1('0x13')](_0x2ef0c1)['then'](function(_0x261855){_0xa014a6(null,_0x261855?_0x261855['name']:![]);})[_0x3de1('0x14')](function(_0x14156f){_0xa014a6(_0x14156f);});};AGIVertices[_0x3de1('0x11')]['getSquareProject']=function(_0x17552e,_0x25f619){this[_0x3de1('0xf')][_0x3de1('0x15')](_0x17552e)[_0x3de1('0x16')](function(_0x510e5a){_0x25f619(null,_0x510e5a?_0x510e5a[_0x3de1('0x17')]:![]);})['catch'](function(_0x1e5a06){_0x25f619(_0x1e5a06);});};AGIVertices[_0x3de1('0x11')]['getSquareOdbc']=function(_0x3b5bcb,_0x4819df){this[_0x3de1('0xf')][_0x3de1('0x18')](_0x3b5bcb)[_0x3de1('0x16')](function(_0x5635b5){_0x4819df(null,_0x5635b5?_0x5635b5[_0x3de1('0x19')]:![]);})[_0x3de1('0x14')](function(_0x440a36){_0x4819df(_0x440a36);});};AGIVertices['prototype'][_0x3de1('0x1a')]=function(_0x2a4a31,_0x594bdb){this['rpc'][_0x3de1('0x1b')](_0x2a4a31)[_0x3de1('0x16')](function(_0x412c70){_0x594bdb(null,_0x412c70?_0x412c70[_0x3de1('0x17')]:![]);})[_0x3de1('0x14')](function(_0x4370f2){_0x594bdb(_0x4370f2);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x1c')]=function(_0x491b3d,_0x48ad4b){this[_0x3de1('0xf')][_0x3de1('0x1d')](_0x491b3d)[_0x3de1('0x16')](function(_0x2c4f40){_0x48ad4b(null,_0x2c4f40?_0x2c4f40[_0x3de1('0x17')]:![]);})['catch'](function(_0x5985b2){_0x48ad4b(_0x5985b2);});};AGIVertices['prototype']['getSound']=function(_0x3f4856,_0xc6537a){var _0x2173b1=this;this[_0x3de1('0xf')][_0x3de1('0x1e')](_0x3f4856)[_0x3de1('0x16')](function(_0xa5f4a6){_0xc6537a(null,_0xa5f4a6?_0x2173b1[_0x3de1('0x1f')](_0xa5f4a6[_0x3de1('0x20')]):![]);})[_0x3de1('0x14')](function(_0x3dae9b){_0xc6537a(_0x3dae9b);});};AGIVertices[_0x3de1('0x11')]['getMailAccount']=function(_0x566804,_0x8a3054){this['rpc'][_0x3de1('0x21')](_0x566804)[_0x3de1('0x16')](function(_0x17988e){_0x8a3054(null,_0x17988e?_0x17988e:![]);})['catch'](function(_0x3ca889){_0x8a3054(_0x3ca889);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x22')]=function(_0x370087,_0x43496a,_0x13df4f){this[_0x3de1('0x10')][_0x3de1('0x22')](_0x370087,_0x43496a)[_0x3de1('0x16')](function(){_0x13df4f(null);})[_0x3de1('0x14')](function(_0x24fa5b){_0x13df4f(_0x24fa5b);});};AGIVertices[_0x3de1('0x11')]['getIntervals']=function(_0x4b3db0,_0x5e1093){this[_0x3de1('0xf')][_0x3de1('0x23')](_0x4b3db0)[_0x3de1('0x16')](function(_0x1cc21b){if(_0x1cc21b){if(_0x1cc21b['IntervalId']){_0x5e1093(null,[_0x1cc21b['interval']]);}else{_0x5e1093(null,_[_0x3de1('0x24')](_0x1cc21b['Intervals'],'interval'));}}else{_0x5e1093(null,![]);}})[_0x3de1('0x14')](function(_0x32a72e){_0x5e1093(_0x32a72e);});};AGIVertices['prototype'][_0x3de1('0x1f')]=function(_0x4633c7){return util[_0x3de1('0x25')](_0x3de1('0x26'),FILES_PATH,_0x4633c7);};AGIVertices[_0x3de1('0x11')]['getQueryOdbc']=function(_0x447186,_0x5a389d,_0x23cc71){odbc[_0x3de1('0x27')](_0x447186,function(_0x324df5){if(_0x324df5){logger[_0x3de1('0x28')](_0x3de1('0x29'),_0x324df5);_0x23cc71(_0x324df5);}else{logger[_0x3de1('0x2a')](_0x3de1('0x2b'));odbc[_0x3de1('0x2c')](_0x5a389d,function(_0x643035,_0x5e5e12){if(_0x643035){logger[_0x3de1('0x2a')]('Error\x20executing\x20query\x20%s',_0x5a389d);_0x23cc71(_0x643035);}else{logger[_0x3de1('0x2a')](_0x3de1('0x2d'),_0x5a389d);odbc[_0x3de1('0x2e')](function(_0x2dbe10){if(_0x2dbe10){logger[_0x3de1('0x28')](_0x3de1('0x2f'),_0x2dbe10);}_0x23cc71(null,_0x5e5e12);});}});}});};AGIVertices[_0x3de1('0x11')]['getSmsAccount']=function(_0x2f2883,_0x1001b0){this[_0x3de1('0xf')][_0x3de1('0x30')](_0x2f2883)[_0x3de1('0x16')](function(_0x466397){_0x1001b0(null,_0x466397?_0x466397:![]);})['catch'](function(_0x200c41){_0x1001b0(_0x200c41);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x31')]=function(_0x3f0a68,_0x111d1a){this[_0x3de1('0xf')][_0x3de1('0x31')](_0x3f0a68)[_0x3de1('0x16')](function(_0x88b44c){_0x111d1a(null,_0x88b44c);})['catch'](function(_0x478585){_0x111d1a(_0x478585);});};AGIVertices[_0x3de1('0x11')]['createSquareDetailsReport']=function(_0x573cbb,_0x36daa8,_0x3d7e8e){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x3de1('0x32')][_0x3de1('0x33')],'node':_0x573cbb['label'],'application':_0x573cbb[_0x3de1('0x34')],'data':_0x36daa8||null,'project_name':this[_0x3de1('0x32')][_0x3de1('0x35')],'callerid':this['channel'][_0x3de1('0x36')]})[_0x3de1('0x16')](function(_0x6c8973){if(_0x3d7e8e){_0x3d7e8e(null,_0x6c8973);}})['catch'](function(_0x559e84){if(_0x3d7e8e){_0x3d7e8e(_0x559e84);}});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x37')]=function(_0x496596,_0x29c9ab,_0x166219,_0x33f561){this[_0x3de1('0xf')][_0x3de1('0x37')]({'uniqueid':this[_0x3de1('0x32')][_0x3de1('0x33')],'callerid':this[_0x3de1('0x32')]['callerid'],'calleridname':this[_0x3de1('0x32')][_0x3de1('0x38')],'context':this['channel']['context'],'extension':this[_0x3de1('0x32')][_0x3de1('0x39')],'priority':this[_0x3de1('0x32')][_0x3de1('0x3a')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0x3de1('0x3b')],'projectName':this[_0x3de1('0x32')][_0x3de1('0x35')],'saveName':_0x29c9ab,'filename':_0x496596['file']||_0x29c9ab,'savePath':_0x166219})[_0x3de1('0x16')](function(_0x622a5a){_0x33f561(null,_0x622a5a);})[_0x3de1('0x14')](function(_0x522acf){_0x33f561(_0x522acf);});};AGIVertices[_0x3de1('0x11')]['createSquareMessage']=function(_0x23f1e6,_0x39d24b,_0x7294c3,_0x3b797f,_0x75ab6c){this[_0x3de1('0xf')][_0x3de1('0x3c')]({'uniqueid':this[_0x3de1('0x32')][_0x3de1('0x33')],'body':_0x23f1e6,'direction':_0x39d24b,'providerName':_0x7294c3,'providerResponse':_0x3b797f})[_0x3de1('0x16')](function(_0x1f07cd){if(_0x75ab6c){_0x75ab6c(null,_0x1f07cd);}})[_0x3de1('0x14')](function(_0x101fd7){if(_0x75ab6c){_0x75ab6c(_0x101fd7);}});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x3d')]=function(_0x2226d9,_0x37caf9){this[_0x3de1('0xf')][_0x3de1('0x3d')]({'firstName':_[_0x3de1('0x3e')](_0x2226d9[_0x3de1('0x17')])||_['isNil'](_0x2226d9[_0x3de1('0x17')])?_0x3de1('0x3f')+Math['random']():_0x2226d9[_0x3de1('0x17')],'lastName':_[_0x3de1('0x3e')](_0x2226d9[_0x3de1('0x40')])||_[_0x3de1('0x41')](_0x2226d9[_0x3de1('0x40')])?null:_0x2226d9[_0x3de1('0x40')],'phone':_0x2226d9[_0x3de1('0x42')],'ListId':_0x2226d9[_0x3de1('0x43')],'scheduledat':_0x2226d9['scheduledAt'],'callbackUniqueid':this[_0x3de1('0x32')][_0x3de1('0x33')],'tags':_0x3de1('0x44'),'description':_0x3de1('0x45')+_0x2226d9[_0x3de1('0x46')][_0x3de1('0x47')](),'priority':_0x2226d9[_0x3de1('0x48')]})[_0x3de1('0x16')](function(_0x362f0d){_0x37caf9(null,_0x362f0d);})[_0x3de1('0x14')](function(_0x466b02){_0x37caf9(_0x466b02);});};AGIVertices['prototype'][_0x3de1('0x49')]=function(_0x5049a2,_0x4c2ca9){this[_0x3de1('0xf')][_0x3de1('0x4a')](_0x5049a2)['then'](function(_0x499174){_0x4c2ca9(null,_0x499174?_0x499174[_0x3de1('0x17')]:![]);})[_0x3de1('0x14')](function(_0x170d2c){_0x4c2ca9(_0x170d2c);});};AGIVertices[_0x3de1('0x11')]['agentPause']=function(_0x4fa704,_0x33c34d,_0x3e33c6){var _0x2a324e={'role':_0x3de1('0x4b')};_0x2a324e[_0x4fa704]=this[_0x3de1('0x32')]['callerid'];this[_0x3de1('0xf')][_0x3de1('0x4c')](_0x2a324e,_0x33c34d,this['channel'][_0x3de1('0x33')])[_0x3de1('0x16')](function(_0x6657a9){_0x3e33c6(null,_[_0x3de1('0x41')](_0x6657a9)?![]:!![]);})[_0x3de1('0x14')](function(_0x35a9da){logger[_0x3de1('0x28')](_0x35a9da);_0x3e33c6(null,![]);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x4d')]=function(_0x4da3c0,_0x4e2a68){var _0x57122c={'role':'agent'};_0x57122c[_0x4da3c0]=this[_0x3de1('0x32')][_0x3de1('0x36')];this[_0x3de1('0xf')][_0x3de1('0x4d')](_0x57122c)[_0x3de1('0x16')](function(_0x7bf677){_0x4e2a68(null,_[_0x3de1('0x41')](_0x7bf677)?![]:!![]);})['catch'](function(_0x4404ff){logger[_0x3de1('0x28')](_0x4404ff);_0x4e2a68(null,![]);});};AGIVertices[_0x3de1('0x11')]['agentLogout']=function(_0xd00c7e,_0x1da30d){var _0x2cdb7a={'role':'agent'};_0x2cdb7a[_0xd00c7e]=this['channel'][_0x3de1('0x36')];this[_0x3de1('0xf')][_0x3de1('0x4e')](_0x2cdb7a)[_0x3de1('0x16')](function(_0x5d6bc5){_0x1da30d(null,_['isNil'](_0x5d6bc5)?![]:!![]);})[_0x3de1('0x14')](function(_0x2d1c33){logger[_0x3de1('0x28')](_0x2d1c33);_0x1da30d(null,![]);});};AGIVertices['prototype'][_0x3de1('0x4f')]=function(_0x2f8664,_0x41b7f5){var _0x1b9c81={'role':_0x3de1('0x4b')};_0x1b9c81[_0x2f8664]=this[_0x3de1('0x32')][_0x3de1('0x36')];var _0xe3ba28=_0x2f8664!=_0x3de1('0x50')?util[_0x3de1('0x25')](_0x3de1('0x51'),_0x3de1('0x52'),this[_0x3de1('0x32')]['callerid']):undefined;this['rpc']['agentLogin'](_0x1b9c81,_0xe3ba28)['then'](function(_0x538021){_0x41b7f5(null,_[_0x3de1('0x41')](_0x538021)?![]:!![]);})[_0x3de1('0x14')](function(_0x530232){logger[_0x3de1('0x28')](_0x530232);_0x41b7f5(null,![]);});};AGIVertices['prototype'][_0x3de1('0x53')]=function(_0x53ee21,_0x238c99){sh[_0x3de1('0x54')](_[_0x3de1('0x55')](_0x53ee21),function(_0x1bc7ac,_0x52e7e1){var _0x25c87c=_0x52e7e1['replace'](/(\r\n|\n|\r)/gm,'');_0x238c99(null,_0x25c87c);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x56')]=function(_0x56d32c,_0x5dadb1){scripts[_0x3de1('0x56')](_0x56d32c['apiKey'],_0x56d32c[_0x3de1('0x57')]||_0x3de1('0x58'),_0x56d32c[_0x3de1('0x58')],_0x56d32c[_0x3de1('0x59')]||_0x3de1('0x5a'),_0x56d32c['ssmlGender']||_0x3de1('0x5b'),_0x56d32c['audioEncoding']||'MP3')[_0x3de1('0x16')](function(_0x5cf192){_0x5dadb1(null,_0x5cf192);})[_0x3de1('0x14')](function(_0x2c075c){_0x5dadb1(_0x2c075c);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x5c')]=function(_0x3a8155,_0x305803){scripts['googleTTS'](_0x3a8155[_0x3de1('0x58')],_0x3a8155['google_tts_language']||'en',0x1)[_0x3de1('0x16')](function(_0x16c891){_0x305803(null,_0x16c891);})[_0x3de1('0x14')](function(_0x203ca3){_0x305803(_0x203ca3);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x5d')]=function(_0x10bdfc,_0xeb8598){var _0x3b080b={'uri':_0x10bdfc['url'],'method':_0x10bdfc[_0x3de1('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x10bdfc[_0x3de1('0x5f')])===_0x3de1('0x60')&&parseInt(_0x10bdfc[_0x3de1('0x5f')])>=0x1?parseInt(_0x10bdfc['timeout'])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x3de1('0x61')],_0x3b080b[_0x3de1('0x5e')]['toUpperCase']())){try{_0x3b080b[_0x3de1('0x62')]=_0x10bdfc[_0x3de1('0xc')]?JSON[_0x3de1('0x63')](_0x10bdfc[_0x3de1('0xc')]):{};}catch(_0x4b586a){logger[_0x3de1('0x28')](_0x3de1('0x64'),_0x4b586a);}}try{_0x3b080b[_0x3de1('0x65')]=_0x10bdfc['rawHeaders']?JSON[_0x3de1('0x63')](_0x10bdfc[_0x3de1('0xb')]):{};}catch(_0x6020a8){logger[_0x3de1('0x28')](_0x3de1('0x66'),_0x6020a8);}if(_0x10bdfc[_0x3de1('0x67')]){try{var _0x5cd86c=require(_0x10bdfc[_0x3de1('0x67')])[_0x3de1('0x68')](this,_0x3b080b);_0x3b080b[_0x3de1('0x69')]=Mustache['render'](_0x10bdfc[_0x3de1('0x6a')],_0x5cd86c,{},['$$','$$']);if(_0x3b080b[_0x3de1('0x65')]){_0x3b080b[_0x3de1('0x65')]=JSON[_0x3de1('0x63')](Mustache[_0x3de1('0x6b')](JSON[_0x3de1('0x6c')](_0x3b080b[_0x3de1('0x65')]),_0x5cd86c,{},['$$','$$']));}if(_0x3b080b[_0x3de1('0x62')]){_0x3b080b[_0x3de1('0x62')]=JSON[_0x3de1('0x63')](Mustache['render'](JSON[_0x3de1('0x6c')](_0x3b080b[_0x3de1('0x62')]),_0x5cd86c,{},['$$','$$']));}}catch(_0x223165){logger['error'](_0x3de1('0x6d'),_0x223165);}}rp(_0x3b080b)['then'](function(_0x1e1c7c){var _0x1b7a6c={'statusCode':_0x1e1c7c[_0x3de1('0x6e')]||0xc8,'statusMessage':_0x1e1c7c[_0x3de1('0x6f')]||'OK','headers':_0x1e1c7c[_0x3de1('0x65')]||{},'body':_0x1e1c7c[_0x3de1('0x62')]||{}};_0xeb8598(null,_0x1b7a6c);})[_0x3de1('0x14')](function(_0x593153){var _0x5800d8={'statusCode':_0x593153[_0x3de1('0x6e')]||0x1f4,'statusMessage':_0x593153['message']||_0x3de1('0x70'),'headers':_0x593153[_0x3de1('0x71')]['headers']||{},'body':_0x593153[_0x3de1('0x71')]['body']||{}};_0xeb8598(null,_0x5800d8);});};AGIVertices['prototype'][_0x3de1('0x72')]=function(_0x5b02f1,_0xf9e786){scripts['googleDialogflow'](this['channel'][_0x3de1('0x33')],_0x5b02f1[_0x3de1('0x73')],_0x5b02f1[_0x3de1('0x58')],_0x5b02f1[_0x3de1('0x74')]||'en')[_0x3de1('0x16')](function(_0x4aff44){_0xf9e786(null,_0x4aff44);})[_0x3de1('0x14')](function(_0x56931b){_0xf9e786(_0x56931b);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x75')]=function(_0x3fa306,_0x311df3){scripts[_0x3de1('0x75')](this[_0x3de1('0x32')][_0x3de1('0x33')],_0x3fa306['dialogflowV2_project_id'],_0x3fa306[_0x3de1('0x76')],_0x3fa306['private_key'],_0x3fa306[_0x3de1('0x58')],_0x3fa306[_0x3de1('0x77')]||'en')[_0x3de1('0x16')](function(_0x4df7c3){_0x311df3(null,_0x4df7c3);})[_0x3de1('0x14')](function(_0x2f820c){_0x311df3(_0x2f820c);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x78')]=function(_0x5b05ce,_0xa7e0f5){scripts['sestekNDA'](this['channel'],_0x5b05ce)['then'](function(_0x2f77ac){_0xa7e0f5(null,_0x2f77ac);})[_0x3de1('0x14')](function(_0x220a69){_0xa7e0f5(_0x220a69);});};AGIVertices['prototype'][_0x3de1('0x79')]=function(_0x133045,_0x4bd8e5){scripts[_0x3de1('0x79')](_0x133045[_0x3de1('0x73')],_0x133045[_0x3de1('0x58')],_0x133045[_0x3de1('0x7a')]||'en-US',_0x133045['speed'])[_0x3de1('0x16')](function(_0x3f290d){_0x4bd8e5(null,_0x3f290d);})[_0x3de1('0x14')](function(_0x92b311){_0x4bd8e5(_0x92b311);});};AGIVertices['prototype'][_0x3de1('0x7b')]=function(_0x3da1d4,_0x58618a,_0x4b6681){scripts[_0x3de1('0x7b')](_0x58618a,_0x3da1d4[_0x3de1('0x73')],_0x3da1d4['ispeech_asr_language']||_0x3de1('0x5a'),this['isConfigured'](_0x3da1d4[_0x3de1('0x7c')])?_0x3da1d4[_0x3de1('0x7c')]:undefined)[_0x3de1('0x16')](function(_0x560499){_0x4b6681(null,_0x560499);})[_0x3de1('0x14')](function(_0x4cff5d){_0x4b6681(_0x4cff5d);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x7d')]=function(_0x34dfbb,_0xa6ba30){scripts[_0x3de1('0x7d')](_0x34dfbb[_0x3de1('0x7e')],_0x34dfbb['aws_secret_access_key'],_0x34dfbb[_0x3de1('0x7f')],_0x34dfbb[_0x3de1('0x80')]||_0x3de1('0x81'),_0x34dfbb[_0x3de1('0x58')],_0x34dfbb[_0x3de1('0x82')]||'text')[_0x3de1('0x16')](function(_0x49b418){_0xa6ba30(null,_0x49b418);})[_0x3de1('0x14')](function(_0x40c5ae){_0xa6ba30(_0x40c5ae);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x83')]=function(_0x3d6abd,_0x5cc10f){scripts[_0x3de1('0x83')](this[_0x3de1('0x32')][_0x3de1('0x33')],_0x3d6abd[_0x3de1('0x7e')],_0x3d6abd[_0x3de1('0x84')],_0x3d6abd[_0x3de1('0x85')],_0x3d6abd['text'],_0x3d6abd['aws_bot_name'])[_0x3de1('0x16')](function(_0x4c2844){_0x5cc10f(null,_0x4c2844);})[_0x3de1('0x14')](function(_0x1579e7){_0x5cc10f(_0x1579e7);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x86')]=function(_0x6538c1,_0x552d3f,_0xb20fa0){scripts['googleASR'](_0x552d3f,_0x6538c1['key'],_0x6538c1[_0x3de1('0x87')]||_0x3de1('0x5a'))[_0x3de1('0x16')](function(_0x645408){_0xb20fa0(null,_0x645408);})[_0x3de1('0x14')](function(_0x5d1e42){_0xb20fa0(_0x5d1e42);});};AGIVertices[_0x3de1('0x11')][_0x3de1('0x88')]=function(_0x18b5f3,_0x13c0d8,_0x57b7d4){scripts[_0x3de1('0x88')](_0x13c0d8,_0x18b5f3['appid'],_0x18b5f3[_0x3de1('0x89')],_0x18b5f3[_0x3de1('0x69')])['then'](function(_0x43f93b){_0x57b7d4(null,_0x43f93b);})[_0x3de1('0x14')](function(_0x1efd6f){_0x57b7d4(_0x1efd6f);});};AGIVertices[_0x3de1('0x11')]['clear']=function(_0x5ac4f8){var _0x5c0987=_[_0x3de1('0x8a')](verticesWithRetry,_0x5ac4f8[_0x3de1('0x34')])?_0x5ac4f8:_[_0x3de1('0x8b')](_0x5ac4f8);for(var _0x4e57bc in _0x5c0987){if(_0x5c0987[_0x3de1('0x8c')](_0x4e57bc)){if(_0x5c0987[_0x4e57bc]&&_[_0x3de1('0x8d')](_0x5c0987[_0x4e57bc])){if(_['includes'](recursiveMapAttributes,_0x4e57bc)){_0x5c0987[_0x4e57bc]=this[_0x3de1('0x8e')](_0x5c0987[_0x4e57bc]);}else{_0x5c0987[_0x4e57bc]=this[_0x3de1('0x8f')](_0x5c0987[_0x4e57bc]);}}}}return _0x5c0987;};AGIVertices[_0x3de1('0x11')][_0x3de1('0x90')]=function(_0x223eed){for(var _0x124900 in _0x223eed){if(_0x223eed[_0x3de1('0x8c')](_0x124900)){if(_[_0x3de1('0x91')](_0x223eed[_0x124900])){this['recursiveNodeIndex'](_0x223eed[_0x124900]);}else if(_[_0x3de1('0x92')](_0x223eed[_0x124900])){for(var _0x565f08=0x0;_0x565f08<_0x223eed[_0x124900][_0x3de1('0x93')];_0x565f08++){this[_0x3de1('0x90')](_0x223eed[_0x124900][_0x565f08]);}}else if(_[_0x3de1('0x8d')](_0x223eed[_0x124900])){_0x223eed[_0x124900]=this['replaceAllVariables'](_0x223eed[_0x124900]);}}}};AGIVertices[_0x3de1('0x11')][_0x3de1('0x94')]=function(_0x1e6b92,_0x3d9515){for(var _0x368e1a in _0x1e6b92){if(_0x1e6b92[_0x3de1('0x8c')](_0x368e1a)){if(_[_0x3de1('0x91')](_0x1e6b92[_0x368e1a])){if(!_['isEmpty'](_0x1e6b92[_0x368e1a])){this[_0x3de1('0x94')](_0x1e6b92[_0x368e1a],util[_0x3de1('0x25')](_0x3de1('0x95'),_0x3d9515,_0x368e1a));}}else if(_[_0x3de1('0x92')](_0x1e6b92[_0x368e1a])){for(var _0x374e46=0x0;_0x374e46<_0x1e6b92[_0x368e1a][_0x3de1('0x93')];_0x374e46++){this[_0x3de1('0x94')](_0x1e6b92[_0x368e1a][_0x374e46],util[_0x3de1('0x25')](_0x3de1('0x95'),_0x3d9515,_0x368e1a+'['+_0x374e46+']'));}}else{if(!_[_0x3de1('0x41')](_0x1e6b92[_0x368e1a])){this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0x95'),_0x3d9515,_0x368e1a),_0x1e6b92[_0x368e1a]);}}}}};AGIVertices[_0x3de1('0x11')][_0x3de1('0x8e')]=function(_0x93d011){try{var _0x4e2735=JSON[_0x3de1('0x63')](_0x93d011);this[_0x3de1('0x90')](_0x4e2735);return JSON['stringify'](_0x4e2735);}catch(_0x795439){return this[_0x3de1('0x8f')](_0x93d011);}};AGIVertices[_0x3de1('0x11')][_0x3de1('0x8f')]=function(_0x18630d){var _0x274ed3=_0x18630d['split']('{');for(var _0x3c33ec=0x1;_0x3c33ec<_0x274ed3[_0x3de1('0x93')];_0x3c33ec+=0x1){var _0x272a01=_0x274ed3[_0x3c33ec][_0x3de1('0x97')]('}');if(_0x272a01[_0x3de1('0x93')]>0x1){_0x18630d=_0x18630d['replaceAll']('{'+_0x272a01[0x0]+'}',this[_0x3de1('0x32')]['getVariable'](_0x272a01[0x0])[_0x3de1('0x98')]||_0x272a01[0x0]);}}if(_0x274ed3[_0x3de1('0x93')]===0x1){return _0x18630d['toString']();}return this['replaceAllVariables'](_0x18630d);};AGIVertices['prototype'][_0x3de1('0x99')]=function(_0xfb2f6a,_0x26f581){var _0x5d167a=this[_0x3de1('0x32')][_0x3de1('0x9a')](_0xfb2f6a);if(_0x5d167a[_0x3de1('0x9b')]===-0x1){return _0x5d167a;}logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x9c'),_0x26f581,_0x5d167a[_0x3de1('0x98')]));return this['channel']['setVariable'](_0x26f581,_0x5d167a['extra']);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x9d')]=function(_0x2947e7){return _0x2947e7&&_0x2947e7!=='0'&&_0x2947e7!=='-1'&&_0x2947e7!=='';};AGIVertices['prototype']['maxRetry']=function(_0x2f1b6b){this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x2f1b6b,'-');_0x2f1b6b[_0x3de1('0x9f')]=_0x2f1b6b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x3de1('0xa0')]=function(_0xc73467){logger['info'](util[_0x3de1('0x25')](_0x3de1('0xa1'),_0xc73467[_0x3de1('0xa2')]));if(!this['isConfigured'](_0xc73467[_0x3de1('0x58')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xa4'));}var _0x967f87='\x22'+_0xc73467['text']+'\x22';if(this['isConfigured'](_0xc73467[_0x3de1('0x71')])){_0x967f87+=','+_0xc73467[_0x3de1('0x71')];}var _0x352c6d=this[_0x3de1('0x32')]['exec']('MRCPSynth',_0x967f87);if(_0x352c6d[_0x3de1('0x9b')]===-0x1){return _0x352c6d;}return this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xa5'),_0x967f87));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xa6')]=function(_0x6b36fd){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xa7'),_0x6b36fd['label']));if(!this[_0x3de1('0x9d')](_0x6b36fd[_0x3de1('0xa8')])){return this[_0x3de1('0x32')]['noop']('no\x20grammar\x20configured');}var _0x332bc2=_0x6b36fd[_0x3de1('0xa8')];if(this[_0x3de1('0x9d')](_0x6b36fd[_0x3de1('0x71')])){_0x332bc2+=','+_0x6b36fd[_0x3de1('0x71')];}var _0x2ae4ea=this[_0x3de1('0x32')][_0x3de1('0x54')]('MRCPRecog',_0x332bc2);if(_0x2ae4ea[_0x3de1('0x9b')]===-0x1){return _0x2ae4ea;}var _0x3669a5=this['getAndSetVariable'](_0x3de1('0xa9'),_0x3de1('0xaa'));if(_0x3669a5['result']===-0x1){return _0x3669a5;}var _0x2475e6=this[_0x3de1('0x99')](_0x3de1('0xab'),'MRCP_RECOG_TRANSCRIPT');if(_0x2475e6[_0x3de1('0x9b')]===-0x1){return _0x2475e6;}var _0x189e17=this[_0x3de1('0x99')](_0x3de1('0xac'),_0x3de1('0xad'));if(_0x189e17[_0x3de1('0x9b')]===-0x1){return _0x189e17;}return this[_0x3de1('0x32')]['noop'](util[_0x3de1('0x25')](_0x3de1('0xae'),_0x332bc2));};AGIVertices['prototype']['agi']=function(_0x4e956c){logger['info'](util[_0x3de1('0x25')](_0x3de1('0xaf'),_0x4e956c[_0x3de1('0xa2')]));return this['channel']['agi']([_0x4e956c[_0x3de1('0xb0')],_0x4e956c[_0x3de1('0xb1')]]);};AGIVertices['prototype'][_0x3de1('0xb2')]=function(_0x2ae05f){logger['info'](util[_0x3de1('0x25')](_0x3de1('0xb3'),_0x2ae05f[_0x3de1('0xa2')]));if(this[_0x3de1('0x9d')](_0x2ae05f[_0x3de1('0x5f')])){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xb4'),_0x2ae05f[_0x3de1('0x5f')]));var _0x3da625=this[_0x3de1('0x32')][_0x3de1('0xb5')](_0x2ae05f[_0x3de1('0x5f')]);if(_0x3da625[_0x3de1('0x9b')]===-0x1){return _0x3da625;}}return this[_0x3de1('0x32')][_0x3de1('0xb2')]();};AGIVertices[_0x3de1('0x11')]['callback']=function(_0x1c81cd){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1c81cd['label']));if(!this[_0x3de1('0x9d')](_0x1c81cd[_0x3de1('0x43')])){return this['channel'][_0x3de1('0x28')](_0x1c81cd,_0x3de1('0xb6'));}_0x1c81cd[_0x3de1('0x46')]=moment();if(this['isConfigured'](_0x1c81cd[_0x3de1('0xb7')])){_0x1c81cd[_0x3de1('0x46')]=moment()['add'](_0x1c81cd[_0x3de1('0xb7')],'minutes');}if(!this['isConfigured'](_0x1c81cd[_0x3de1('0x48')])){_0x1c81cd[_0x3de1('0x48')]=0x2;}this[_0x3de1('0x3d')][_0x3de1('0x68')](this,_0x1c81cd);return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xb8'),_0x1c81cd[_0x3de1('0x42')],_0x1c81cd[_0x3de1('0x43')],_0x1c81cd['scheduledAt']));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xb9')]=function(_0x257ce4){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x257ce4[_0x3de1('0xa2')]));var _0x2b267e=this[_0x3de1('0x32')][_0x3de1('0x54')](_0x257ce4[_0x3de1('0xba')],_0x257ce4[_0x3de1('0x71')]);if(_0x2b267e['result']===-0x1){return _0x2b267e;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xbb'),_0x257ce4[_0x3de1('0xba')],_0x257ce4[_0x3de1('0x71')]));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xbc')]=function(_0x3afcf0){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xbd'),_0x3afcf0['label']));if(!this[_0x3de1('0x9d')](_0x3afcf0['text'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20text\x20configured');}var _0x1493c7='\x22'+_0x3afcf0[_0x3de1('0x58')]+'\x22';if(this[_0x3de1('0x9d')](_0x3afcf0[_0x3de1('0x71')])){_0x1493c7+=','+_0x3afcf0[_0x3de1('0x71')];}var _0x1e2dd4=this[_0x3de1('0x32')][_0x3de1('0x54')](_0x3de1('0xbe'),_0x1493c7);if(_0x1e2dd4[_0x3de1('0x9b')]===-0x1){return _0x1e2dd4;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1493c7));};AGIVertices[_0x3de1('0x11')]['sestektts']=function(_0x2b9329){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xbf'),_0x2b9329['label']));if(!this['isConfigured'](_0x2b9329[_0x3de1('0x58')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xa4'));}var _0x1c186f='\x22'+_0x2b9329['text']+'\x22';if(this[_0x3de1('0x9d')](_0x2b9329['options'])){_0x1c186f+=','+_0x2b9329['options'];}var _0x467e8b=this[_0x3de1('0x32')][_0x3de1('0x54')](_0x3de1('0xbe'),_0x1c186f);if(_0x467e8b[_0x3de1('0x9b')]===-0x1){return _0x467e8b;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format'](_0x3de1('0xa5'),_0x1c186f));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xc0')]=function(_0x15ce04){logger['info'](util['format'](_0x3de1('0xc1'),_0x15ce04[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x15ce04['grammar'])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xc2'));}var _0x21ebba=_0x15ce04[_0x3de1('0xa8')];if(this[_0x3de1('0x9d')](_0x15ce04[_0x3de1('0x71')])){_0x21ebba+=','+_0x15ce04[_0x3de1('0x71')];}var _0x4fa84d=this[_0x3de1('0x32')][_0x3de1('0x54')](_0x3de1('0xc3'),_0x21ebba);if(_0x4fa84d[_0x3de1('0x9b')]===-0x1){return _0x4fa84d;}var _0x3e595f=this[_0x3de1('0x99')]('RECOG_CONFIDENCE()',_0x3de1('0xc4'));if(_0x3e595f[_0x3de1('0x9b')]===-0x1){return _0x3e595f;}var _0x171844=this[_0x3de1('0x99')](_0x3de1('0xab'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x171844[_0x3de1('0x9b')]===-0x1){return _0x171844;}var _0x34bc6c=this['getAndSetVariable'](_0x3de1('0xac'),_0x3de1('0xc5'));if(_0x34bc6c[_0x3de1('0x9b')]===-0x1){return _0x34bc6c;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xae'),_0x21ebba));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xc6')]=function(_0x273d69){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x273d69['label']));if(!this[_0x3de1('0x9d')](_0x273d69[_0x3de1('0xa8')])){return this[_0x3de1('0x32')]['noop'](_0x3de1('0xc2'));}var _0x388fe5=_0x273d69[_0x3de1('0xa8')];if(this[_0x3de1('0x9d')](_0x273d69[_0x3de1('0x71')])){_0x388fe5+=','+_0x273d69['options'];}var _0x5bd7c6=this[_0x3de1('0x32')][_0x3de1('0x54')](_0x3de1('0xc3'),_0x388fe5);if(_0x5bd7c6['result']===-0x1){return _0x5bd7c6;}var _0x318e76=this['getAndSetVariable'](_0x3de1('0xa9'),'SESTEK_ASR_CONFIDENCE');if(_0x318e76[_0x3de1('0x9b')]===-0x1){return _0x318e76;}var _0x15f467=this[_0x3de1('0x99')](_0x3de1('0xab'),_0x3de1('0xc7'));if(_0x15f467[_0x3de1('0x9b')]===-0x1){return _0x15f467;}var _0x3d3070=this[_0x3de1('0x99')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x3d3070[_0x3de1('0x9b')]===-0x1){return _0x3d3070;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xae'),_0x388fe5));};AGIVertices['prototype'][_0x3de1('0xc8')]=function(_0x5b1446){logger['info'](util[_0x3de1('0x25')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5b1446[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x5b1446[_0x3de1('0xc9')])){return this['channel'][_0x3de1('0x28')](_0x5b1446,_0x3de1('0xca'));}var _0x174f0b=this[_0x3de1('0xcb')][_0x3de1('0x68')](this,_0x5b1446['odbc_id']);if(!_0x174f0b){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x5b1446,'no\x20odbc\x20database\x20found');}if(!this[_0x3de1('0x9d')](_0x5b1446['query'])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x5b1446,_0x3de1('0xcc'));}var _0x3bb0b9=_0x5b1446['query'][_0x3de1('0xcd')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xce'),_0x3bb0b9));var _0x5f6a22=this[_0x3de1('0xcf')][_0x3de1('0x68')](this,_0x174f0b,_0x3bb0b9);this[_0x3de1('0x9e')]['sync'](this,_0x5b1446,_0x3bb0b9);if(!this['isConfigured'](_0x5b1446['variable_id'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xd0'));}var _0x4f8cb1=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x5b1446[_0x3de1('0xd1')]);if(!_0x4f8cb1){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x5b1446,_0x3de1('0xd2'));}var _0x29b541=this;_0x5f6a22[_0x3de1('0xd3')](function(_0x5aa7f9,_0x5426cc){Object[_0x3de1('0xd4')](_0x5aa7f9)[_0x3de1('0xd3')](function(_0x68fdd4){_0x29b541[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0xd5'),_0x4f8cb1,_0x5426cc,_0x68fdd4),_0x5aa7f9[_0x68fdd4]);});});this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0xd6'),_0x4f8cb1),_0x5f6a22[_0x3de1('0x93')]);return this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xd7'),_0x4f8cb1));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xd8')]=function(_0x3d6f62){logger['debug'](util[_0x3de1('0x25')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3d6f62[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x3d6f62[_0x3de1('0xd9')])){return this[_0x3de1('0x32')]['error'](_0x3d6f62,_0x3de1('0xda'));}var _0x5cb068=this[_0x3de1('0x1a')][_0x3de1('0x68')](this,_0x3d6f62[_0x3de1('0xd9')]);if(!_0x5cb068){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x3d6f62,_0x3de1('0xdb'));}var _0x2d0ffb=this['channel'][_0x3de1('0x54')]('DIAL',[util[_0x3de1('0x25')](_0x3de1('0xdc'),_0x5cb068),_0x3d6f62[_0x3de1('0x5f')],_0x3d6f62[_0x3de1('0xdd')],_0x3d6f62['url']]);if(_0x2d0ffb[_0x3de1('0x9b')]===-0x1){return _0x2d0ffb;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xde'),_0x3de1('0xdf')));};AGIVertices['prototype']['dialogflow']=function(_0x363eed){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xe0'),_0x363eed[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x363eed[_0x3de1('0x73')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xe1'));}if(!this[_0x3de1('0x9d')](_0x363eed[_0x3de1('0x58')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20text\x20configured');}this[_0x3de1('0x32')][_0x3de1('0xe2')]=!![];this[_0x3de1('0x9e')](_0x363eed);this['createSquareMessage'](_0x363eed[_0x3de1('0x58')],'in','','');this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format']('Trying\x20Dialogflow:\x20%s',_0x363eed['text']));var _0x4c848c=this[_0x3de1('0x72')]['sync'](this,_0x363eed);if(_0x4c848c){for(var _0x408467 in _0x4c848c){if(_0x4c848c['hasOwnProperty'](_0x408467)){this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0xe3'),_0x408467[_0x3de1('0xe4')]()),_0x4c848c[_0x408467]);}}this[_0x3de1('0x3c')](_0x4c848c[_0x3de1('0xe5')],'out',_0x3de1('0xe6'),'');return this[_0x3de1('0x32')]['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x4c848c[_0x3de1('0xe5')]));}return this['channel'][_0x3de1('0x28')](_0x363eed,_0x3de1('0xe7'));};AGIVertices['prototype']['dialogflowV2']=function(_0xccc191){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0xe8'),_0xccc191['label']));if(!this[_0x3de1('0x9d')](_0xccc191[_0x3de1('0xe9')])){return this[_0x3de1('0x32')]['noop'](_0x3de1('0xea'));}if(!this[_0x3de1('0x9d')](_0xccc191[_0x3de1('0x76')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20client_email\x20configured');}if(!this[_0x3de1('0x9d')](_0xccc191[_0x3de1('0xeb')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20private_key\x20configured');}if(!this[_0x3de1('0x9d')](_0xccc191['dialogflowV2_language'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xec'));}if(!this[_0x3de1('0x9d')](_0xccc191[_0x3de1('0x58')])){return this['channel'][_0x3de1('0xa3')]('no\x20text\x20configured');}this[_0x3de1('0x32')][_0x3de1('0xe2')]=!![];this['createSquareDetailsReport'](_0xccc191);this[_0x3de1('0x3c')](_0xccc191[_0x3de1('0x58')],'in','','');this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xed'),_0xccc191[_0x3de1('0x58')]));var _0x2c6a1a=this[_0x3de1('0x75')]['sync'](this,_0xccc191);if(_0x2c6a1a){for(var _0xd74c58 in _0x2c6a1a){if(_0x2c6a1a['hasOwnProperty'](_0xd74c58)){if(_0xd74c58!==_0x3de1('0xee')){this['channel'][_0x3de1('0x96')](util[_0x3de1('0x25')]('DIALOGFLOW_%s',_0xd74c58[_0x3de1('0xe4')]()),_0x2c6a1a[_0xd74c58]);}}}this['createSquareMessage'](_0x2c6a1a['speech'],'out',_0x3de1('0xef'),_0x2c6a1a['providerResponse']);return this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xf0'),_0x2c6a1a[_0x3de1('0xe5')]));}return this['channel'][_0x3de1('0x28')](_0xccc191,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x3de1('0xf1')]=function(_0x572dd1){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0xf2'),_0x572dd1[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x572dd1['ndauth_url'])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xf3'));}if(!this[_0x3de1('0x9d')](_0x572dd1['username'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xf4'));}if(!this[_0x3de1('0x9d')](_0x572dd1[_0x3de1('0xf5')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xf6'));}if(!this[_0x3de1('0x9d')](_0x572dd1[_0x3de1('0xf7')])){return this[_0x3de1('0x32')]['noop'](_0x3de1('0xa4'));}this[_0x3de1('0x32')]['bot']=!![];this[_0x3de1('0x9e')](_0x572dd1);this[_0x3de1('0x3c')](_0x572dd1[_0x3de1('0x58')],'in','','');this[_0x3de1('0x32')]['noop'](util[_0x3de1('0x25')](_0x3de1('0xf8'),_0x572dd1[_0x3de1('0x58')]));var _0x5312ec=this[_0x3de1('0x78')]['sync'](this,_0x572dd1);if(_0x5312ec){for(var _0x4572f3 in _0x5312ec){if(_0x5312ec['hasOwnProperty'](_0x4572f3)){this['channel']['setVariable'](util[_0x3de1('0x25')](_0x3de1('0xf9'),_0x4572f3[_0x3de1('0xe4')]()),_0x5312ec[_0x4572f3]);}}this[_0x3de1('0x3c')](_0x5312ec[_0x3de1('0xe5')],_0x3de1('0xfa'),_0x3de1('0xf1'),'');if(_0x5312ec[_0x3de1('0xfb')]){this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xfc'),_0x5312ec[_0x3de1('0xfb')]));var _0x2d1f7b=this[_0x3de1('0x32')]['streamFile'](_0x5312ec['audiofile']);try{fs[_0x3de1('0xfd')](_0x5312ec[_0x3de1('0xfb')]+_0x3de1('0xfe'));}catch(_0x1e944c){logger[_0x3de1('0x28')](_0x1e944c);}return _0x2d1f7b;}else{return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xff'),_0x5312ec[_0x3de1('0xe5')]));}}return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x572dd1,_0x3de1('0x100'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x101')]=function(_0x4abcfc){logger[_0x3de1('0x2a')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x4abcfc['label']));return this[_0x3de1('0x32')][_0x3de1('0xa3')]('end');};AGIVertices[_0x3de1('0x11')][_0x3de1('0x102')]=function(_0x46230b){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x103'),_0x46230b[_0x3de1('0xa2')]));var _0x3d639c='';if(_0x46230b[_0x3de1('0x104')]){if(!this[_0x3de1('0x9d')](_0x46230b[_0x3de1('0x104')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x46230b,_0x3de1('0x105'));}else{var _0x5a909f=parseInt(_0x46230b['trunk_id'],0xa);if(isNaN(_0x5a909f)){_0x3d639c=_0x46230b['trunk_id'];}else{_0x3d639c=this[_0x3de1('0x1c')]['sync'](this,_0x46230b[_0x3de1('0x104')]);if(!_0x3d639c){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x46230b,_0x3de1('0x106'));}}}}else if(_0x46230b[_0x3de1('0x107')]){_0x3d639c=_0x46230b[_0x3de1('0x107')];}else{return this[_0x3de1('0x32')]['error'](_0x46230b,_0x3de1('0x105'));}var _0x44f77c=this['channel'][_0x3de1('0x54')](_0x3de1('0xdf'),[util[_0x3de1('0x25')](_0x3de1('0x108'),_0x3d639c,_0x46230b['phone']),_0x46230b['timeout'],_0x46230b['opts'],_0x46230b[_0x3de1('0x6a')]]);if(_0x44f77c[_0x3de1('0x9b')]===-0x1){return _0x44f77c;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x109')]=function(_0x1d8429){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x10a'),_0x1d8429[_0x3de1('0xa2')]));return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x109'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0xd')]=function(_0x8eef9d){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x10b'),_0x8eef9d[_0x3de1('0xa2')]));if(_0x8eef9d['retry']===0x0){return this[_0x3de1('0x10c')](_0x8eef9d);}_0x8eef9d['retry']-=0x1;if(!this['isConfigured'](_0x8eef9d[_0x3de1('0x10d')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x8eef9d,_0x3de1('0x10e'));}var _0x58fb0d=this[_0x3de1('0x10f')]['sync'](this,_0x8eef9d[_0x3de1('0x10d')]);if(!_0x58fb0d){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x8eef9d,_0x3de1('0x110'));}if(!this['isConfigured'](_0x8eef9d[_0x3de1('0xd1')])){return this['channel'][_0x3de1('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2e6252=this[_0x3de1('0x32')][_0x3de1('0x111')](_0x58fb0d,_0x8eef9d['response'],_0x8eef9d[_0x3de1('0x112')]);var _0x3bcc60=_0x2e6252[_0x3de1('0x9b')]?_0x2e6252[_0x3de1('0x9b')][_0x3de1('0x47')]():'';logger[_0x3de1('0x2a')](_0x3de1('0x113'),JSON[_0x3de1('0x6c')](_0x2e6252));if(_0x2e6252['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x8eef9d,_0x3bcc60);return _0x2e6252;}else if(_0x2e6252[_0x3de1('0x98')]===_0x3de1('0x5f')){_0x2e6252[_0x3de1('0x9b')]=_0x3bcc60['length']>=parseInt(_0x8eef9d['mindigit'])?'x':'i';}else{_0x2e6252[_0x3de1('0x9b')]=_0x3bcc60[_0x3de1('0x93')]>=parseInt(_0x8eef9d[_0x3de1('0x114')])&&_0x3bcc60['length']<=parseInt(_0x8eef9d[_0x3de1('0x112')])?'x':'i';}var _0x59c93e=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x8eef9d[_0x3de1('0xd1')]);if(!_0x59c93e){return this[_0x3de1('0x32')]['error'](_0x8eef9d,_0x3de1('0xd2'));}this[_0x3de1('0x32')][_0x3de1('0x96')](_0x59c93e,_0x3bcc60);if(this[_0x3de1('0x9d')](_0x8eef9d['hiddendigitsnum'])){var _0x930da2=parseInt(_0x8eef9d[_0x3de1('0x115')],0xa);var _0x149543=rs['generate']({'charset':'*','length':_0x930da2});var _0x5e326e=_0x3bcc60[_0x3de1('0x93')];if(_0x5e326e>0x0){if(_0x5e326e>_0x930da2){this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x8eef9d,_0x8eef9d[_0x3de1('0x116')]===_0x3de1('0x117')?_0x149543+_0x3bcc60[_0x3de1('0x118')](_0x930da2):_0x3bcc60[_0x3de1('0x118')](0x0,_0x5e326e-_0x930da2)+_0x149543);}else{this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x8eef9d,rs[_0x3de1('0x119')]({'charset':'*','length':_0x5e326e}));}}else{this['createSquareDetailsReport'][_0x3de1('0x68')](this,_0x8eef9d,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x8eef9d,_0x3bcc60);}return _0x2e6252;};AGIVertices['prototype'][_0x3de1('0xe')]=function(_0x4b51c4){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x11a'),_0x4b51c4[_0x3de1('0xa2')]));return this[_0x3de1('0xd')](_0x4b51c4);};AGIVertices[_0x3de1('0x11')]['goal']=function(_0x188b91){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x11b'),_0x188b91['label']));this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x188b91,_0x188b91[_0x3de1('0x11c')]);return this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format']('GOAL\x20%s',_0x188b91[_0x3de1('0x11c')]));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x11d')]=function(_0x189e7a){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x189e7a[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x189e7a[_0x3de1('0x7e')])||!this['isConfigured'](_0x189e7a[_0x3de1('0x84')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x11e'));}if(!this[_0x3de1('0x9d')](_0x189e7a[_0x3de1('0x58')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xa4'));}this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x11f'),_0x189e7a[_0x3de1('0x58')]));var _0x5150b8=this[_0x3de1('0x7d')][_0x3de1('0x68')](this,_0x189e7a);if(_0x5150b8){this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x120'),_0x5150b8));var _0x1507a7=this['channel']['streamFile'](_0x5150b8);try{fs[_0x3de1('0xfd')](_0x5150b8+'.wav');}catch(_0xbce551){logger['error'](_0xbce551);}return _0x1507a7;}return this[_0x3de1('0x32')]['error'](_0x189e7a,_0x3de1('0x121'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x122')]=function(_0xdab28d){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x123'),_0xdab28d[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0xdab28d[_0x3de1('0x7e')])||!this[_0x3de1('0x9d')](_0xdab28d[_0x3de1('0x84')])){return this['channel']['noop'](_0x3de1('0x11e'));}if(!this[_0x3de1('0x9d')](_0xdab28d[_0x3de1('0x124')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0xdab28d[_0x3de1('0x58')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20text\x20configured');}this[_0x3de1('0x32')]['bot']=!![];this[_0x3de1('0x9e')](_0xdab28d);this[_0x3de1('0x3c')](_0xdab28d['text'],'in','','');this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x125'),_0xdab28d[_0x3de1('0x58')]));var _0x397ff5=this[_0x3de1('0x83')]['sync'](this,_0xdab28d);if(_0x397ff5){for(var _0x343df1 in _0x397ff5){if(_0x397ff5[_0x3de1('0x8c')](_0x343df1)&&_[_0x3de1('0x8d')](_0x397ff5[_0x343df1])){this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0x126'),_0x343df1[_0x3de1('0xe4')]()),_0x397ff5[_0x343df1]);}}if(_[_0x3de1('0x41')](_0x397ff5[_0x3de1('0x127')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0x128'));}else{this[_0x3de1('0x3c')](_0x397ff5[_0x3de1('0x127')],_0x3de1('0xfa'),_0x3de1('0x129'),'');return this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x12a'),_0x397ff5['message']));}}return this[_0x3de1('0x32')]['error'](_0xdab28d,_0x3de1('0x12b'));};AGIVertices['prototype'][_0x3de1('0x12c')]=function(_0x2eb0f2){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2eb0f2[_0x3de1('0xa2')],_0x2eb0f2[_0x3de1('0x5f')]));if(!this['isConfigured'](_0x2eb0f2[_0x3de1('0x73')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xe1'));}var _0x4e1458=_0x3de1('0x12d');var _0x2433ce=util[_0x3de1('0x25')](_0x3de1('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x82ee18=util[_0x3de1('0x25')](_0x3de1('0x95'),_0x2433ce,_0x4e1458);var _0x113e1e=!![];if(_0x2eb0f2[_0x3de1('0x12f')]===_0x3de1('0x130')){_0x113e1e=![];}var _0x39b4f7=this[_0x3de1('0x32')]['recordFile'](_0x2433ce,_0x4e1458,_0x2eb0f2[_0x3de1('0x131')],_0x2eb0f2[_0x3de1('0x5f')],undefined,_0x113e1e);if(_0x39b4f7[_0x3de1('0x9b')]!==-0x1){this['channel']['noop'](util[_0x3de1('0x25')](_0x3de1('0x132'),_0x82ee18));var _0x1f6262=this[_0x3de1('0x86')]['sync'](this,_0x2eb0f2,_0x82ee18);if(_0x1f6262){for(var _0xc207aa in _0x1f6262){if(_0x1f6262[_0x3de1('0x8c')](_0xc207aa)){this[_0x3de1('0x32')]['setVariable'](util[_0x3de1('0x25')](_0x3de1('0x133'),_0xc207aa[_0x3de1('0xe4')]()),_0x1f6262[_0xc207aa]);}}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('GoogleASR\x20Result\x20%s',JSON[_0x3de1('0x6c')](_0x1f6262)));}}return _0x39b4f7;};AGIVertices[_0x3de1('0x11')][_0x3de1('0x134')]=function(_0x5b3328){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5b3328['label']));if(!this[_0x3de1('0x9d')](_0x5b3328['appid'])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0x135'));}if(!this[_0x3de1('0x9d')](_0x5b3328[_0x3de1('0x89')])){return this['channel']['noop'](_0x3de1('0x136'));}var _0x1524b6=_0x3de1('0x12d');var _0x173e98=util[_0x3de1('0x25')](_0x3de1('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x50c153=util[_0x3de1('0x25')](_0x3de1('0x95'),_0x173e98,_0x1524b6);var _0x53ae54=!![];if(_0x5b3328[_0x3de1('0x12f')]==='NOBEEP'){_0x53ae54=![];}var _0x4dbe27=this[_0x3de1('0x32')][_0x3de1('0x137')](_0x173e98,_0x1524b6,_0x5b3328[_0x3de1('0x131')],_0x5b3328['timeout'],undefined,_0x53ae54);if(_0x4dbe27['result']!==-0x1){this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x138'),_0x50c153));var _0x215e4e=this['tildeASR'][_0x3de1('0x68')](this,_0x5b3328,_0x50c153);if(_0x215e4e){for(var _0x35b1eb in _0x215e4e){if(_0x215e4e['hasOwnProperty'](_0x35b1eb)){this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0x139'),_0x35b1eb[_0x3de1('0xe4')]()),_0x215e4e[_0x35b1eb]);}}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x13a'),JSON[_0x3de1('0x6c')](_0x215e4e)));}}return _0x4dbe27;};AGIVertices[_0x3de1('0x11')]['gotoc']=function(_0x281f4a){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x13b'),_0x281f4a['label']));return this['channel']['continueAt'](_0x281f4a[_0x3de1('0x13c')],_0x281f4a[_0x3de1('0x39')],_0x281f4a[_0x3de1('0x3a')]);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x13d')]=function(_0x33cb82){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x13e'),_0x33cb82[_0x3de1('0xa2')]));if(!this['isConfigured'](_0x33cb82['condition'])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x33cb82,_0x3de1('0x13f'));}try{var _0x2f2e29=eval(_0x33cb82['condition'])?_0x3de1('0x140'):'false';this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0x33cb82['condition'],_0x2f2e29));return{'code':0xc8,'result':_0x2f2e29};}catch(_0x1b3348){return{'code':0xc8,'result':_0x3de1('0x141')};}};AGIVertices['prototype']['gotoiftime']=function(_0x46afb4){logger['info'](util['format'](_0x3de1('0x142'),_0x46afb4['label']));if(!this['isConfigured'](_0x46afb4[_0x3de1('0x143')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x46afb4,_0x3de1('0x144'));}var _0x314b7e=this[_0x3de1('0x145')][_0x3de1('0x68')](this,_0x46afb4[_0x3de1('0x143')]);if(!_0x314b7e){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x46afb4,_0x3de1('0x146'));}for(var _0x234395=0x0;_0x234395<_0x314b7e[_0x3de1('0x93')];_0x234395+=0x1){var _0x3a5453=this['channel'][_0x3de1('0x9a')](util[_0x3de1('0x25')](_0x3de1('0x147'),_0x314b7e[_0x234395]));if(_0x3a5453[_0x3de1('0x9b')]===-0x1){return _0x3a5453;}logger['info'](util[_0x3de1('0x25')](_0x3de1('0x148'),_0x314b7e[_0x234395],_0x3a5453[_0x3de1('0x98')]));if(_0x3a5453[_0x3de1('0x98')]==='true'){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('IFTIME\x20%s\x20%s',_0x314b7e[_0x234395],_0x3de1('0x140')));this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x148'),_0x314b7e[_0x234395],'true'));return{'code':0xc8,'result':_0x3de1('0x140')};}else{logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x148'),_0x314b7e[_0x234395],_0x3de1('0x141')));this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x148'),_0x314b7e[_0x234395],'false'));}}return{'code':0xc8,'result':_0x3de1('0x141')};};AGIVertices['prototype'][_0x3de1('0x149')]=function(_0x8f96a1){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x14a'),_0x8f96a1[_0x3de1('0xa2')]));return this['channel'][_0x3de1('0x149')]();};AGIVertices[_0x3de1('0x11')][_0x3de1('0x14b')]=function(_0x1e5498){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x14c'),_0x1e5498[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x1e5498[_0x3de1('0x73')])){return this[_0x3de1('0x32')][_0x3de1('0xa3')]('no\x20key\x20configured');}var _0x5e693a=_0x3de1('0x12d');var _0x495272=util['format'](_0x3de1('0x12e'),FILES_PATH,rs[_0x3de1('0x119')](0x4));var _0x31099a=util[_0x3de1('0x25')](_0x3de1('0x95'),_0x495272,_0x5e693a);var _0xedf52=!![];if(_0x1e5498[_0x3de1('0x12f')]===_0x3de1('0x130')){_0xedf52=![];}var _0x2f35c6=this['channel']['recordFile'](_0x495272,_0x5e693a,_0x1e5498[_0x3de1('0x131')],_0x1e5498[_0x3de1('0x5f')],undefined,_0xedf52);if(_0x2f35c6[_0x3de1('0x9b')]!==-0x1){this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x14d'),_0x31099a));var _0x16883f=this[_0x3de1('0x7b')][_0x3de1('0x68')](this,_0x1e5498,_0x31099a);if(_0x16883f){for(var _0x408d32 in _0x16883f){if(_0x16883f['hasOwnProperty'](_0x408d32)){this['channel'][_0x3de1('0x96')](util['format'](_0x3de1('0x14e'),_0x408d32[_0x3de1('0xe4')]()),_0x16883f[_0x408d32]);}}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x14f'),JSON[_0x3de1('0x6c')](_0x16883f)));}}return _0x2f35c6;};AGIVertices[_0x3de1('0x11')]['ispeechtts']=function(_0x3b7879){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x150'),_0x3b7879[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x3b7879[_0x3de1('0x73')])){return this[_0x3de1('0x32')]['noop'](_0x3de1('0xe1'));}if(!this[_0x3de1('0x9d')](_0x3b7879['text'])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xa4'));}this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x3b7879['text']));var _0x40d85d=this[_0x3de1('0x79')]['sync'](this,_0x3b7879);if(_0x40d85d){this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('ispeech\x20%s\x20file\x20created',_0x40d85d));var _0x278bc8=this[_0x3de1('0x32')]['streamFile'](_0x40d85d,_0x3b7879[_0x3de1('0x131')]);try{fs['unlink'](_0x40d85d+_0x3de1('0xfe'));}catch(_0x389a09){logger[_0x3de1('0x28')](_0x389a09);}return _0x278bc8;}return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x3b7879,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x14598c){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x151'),_0x14598c[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x14598c['findBy'])){return this['channel'][_0x3de1('0x28')](_0x14598c,_0x3de1('0x152'));}logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3de1('0x32')][_0x3de1('0x36')],_0x14598c[_0x3de1('0x153')]));var _0x56f9a0=this[_0x3de1('0x4f')][_0x3de1('0x68')](this,_0x14598c['findBy']);if(_0x56f9a0){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x154'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x14598c[_0x3de1('0x153')]));this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format'](_0x3de1('0x154'),this[_0x3de1('0x32')]['callerid'],_0x14598c['findBy']));return{'code':0xc8,'result':_0x3de1('0x155')};}else{logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x156'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x14598c['findBy']));this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x156'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x14598c['findBy']));return{'code':0xc8,'result':_0x3de1('0x157')};}};AGIVertices['prototype']['logout']=function(_0x5cefe0){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x158'),_0x5cefe0[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x5cefe0[_0x3de1('0x153')])){return this['channel'][_0x3de1('0x28')](_0x5cefe0,'no\x20find\x20by\x20configured');}logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x159'),this[_0x3de1('0x32')]['callerid'],_0x5cefe0['findBy']));var _0xb8e62c=this[_0x3de1('0x4e')][_0x3de1('0x68')](this,_0x5cefe0[_0x3de1('0x153')]);if(_0xb8e62c){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x154'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x5cefe0[_0x3de1('0x153')]));this[_0x3de1('0x32')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3de1('0x32')]['callerid'],_0x5cefe0[_0x3de1('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x3de1('0x156'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x5cefe0[_0x3de1('0x153')]));this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3de1('0x32')]['callerid'],_0x5cefe0[_0x3de1('0x153')]));return{'code':0xc8,'result':_0x3de1('0x157')};}};AGIVertices[_0x3de1('0x11')][_0x3de1('0x15a')]=function(_0x539783){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x15b'),_0x539783['label']));if(!this['isConfigured'](_0x539783[_0x3de1('0x15c')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x539783,_0x3de1('0x15d'));}this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('math\x20%s',_0x539783[_0x3de1('0x15c')]));var _0x28269d=eval(_0x539783[_0x3de1('0x15c')]);if(!this[_0x3de1('0x9d')](_0x539783['variable_id'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xd0'));}var _0x585d4d=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x539783[_0x3de1('0xd1')]);if(!_0x585d4d){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x539783,_0x3de1('0xd2'));}if(_[_0x3de1('0x92')](_0x28269d)){var _0x4930a3=this;_0x28269d[_0x3de1('0xd3')](function(_0x1e664b,_0x5b6269){_0x4930a3['channel'][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0x15e'),_0x585d4d,_0x5b6269),_0x1e664b);});return this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format'](_0x3de1('0x15f'),_0x585d4d));}else{return this[_0x3de1('0x32')][_0x3de1('0x96')](_0x585d4d,_0x28269d);}};AGIVertices['prototype'][_0x3de1('0x160')]=function(_0x54d864){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x161'),_0x54d864[_0x3de1('0xa2')]));if(_0x54d864[_0x3de1('0x9f')]===0x0){return this[_0x3de1('0x10c')](_0x54d864);}_0x54d864['retry']-=0x1;if(!this[_0x3de1('0x9d')](_0x54d864[_0x3de1('0x10d')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x54d864,'no\x20file\x20audio\x20selected');}var _0x5379c8=this[_0x3de1('0x10f')][_0x3de1('0x68')](this,_0x54d864[_0x3de1('0x10d')]);if(!_0x5379c8){return this[_0x3de1('0x32')]['error'](_0x54d864,_0x3de1('0x110'));}var _0x2a829e=this[_0x3de1('0x32')][_0x3de1('0x111')](_0x5379c8,_0x54d864['response'],_0x54d864['digit']);var _0x4bb541=_0x2a829e[_0x3de1('0x9b')];if(_0x2a829e['result']===-0x1){this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x54d864,'-1');return _0x2a829e;}else if(_0x2a829e['extra']===_0x3de1('0x5f')){_0x2a829e[_0x3de1('0x9b')]=_0x2a829e['result'][_0x3de1('0x93')]>0x0?_0x2a829e[_0x3de1('0x9b')]:'t';}else if(_[_0x3de1('0x3e')](_0x2a829e[_0x3de1('0x9b')])){_0x2a829e['result']='#';_0x4bb541='#';}if(!this['isConfigured'](_0x54d864[_0x3de1('0xd1')])){this[_0x3de1('0x32')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x4b57e6=this[_0x3de1('0x9a')]['sync'](this,_0x54d864[_0x3de1('0xd1')]);if(!_0x4b57e6){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x54d864,_0x3de1('0xd2'));}this[_0x3de1('0x32')][_0x3de1('0x96')](_0x4b57e6,_0x4bb541);}this['createSquareDetailsReport'][_0x3de1('0x68')](this,_0x54d864,_0x4bb541);return _0x2a829e;};AGIVertices[_0x3de1('0x11')][_0x3de1('0xa3')]=function(_0x5cb688){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x162'),_0x5cb688[_0x3de1('0xa2')]));return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x5cb688[_0x3de1('0x163')]||_0x5cb688[_0x3de1('0xa2')]);};AGIVertices[_0x3de1('0x11')]['pause']=function(_0xb1d33e){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x164'),_0xb1d33e['label']));if(!this[_0x3de1('0x9d')](_0xb1d33e[_0x3de1('0x153')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0xb1d33e,_0x3de1('0x152'));}logger[_0x3de1('0x2a')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3de1('0x32')]['callerid'],_0xb1d33e[_0x3de1('0x153')]));var _0xa9ddbd=this[_0x3de1('0x49')]['sync'](this,_0xb1d33e[_0x3de1('0x165')]);var _0x1f43ef=this[_0x3de1('0x4c')][_0x3de1('0x68')](this,_0xb1d33e['findBy'],_0xa9ddbd);if(_0x1f43ef){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x154'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0xb1d33e[_0x3de1('0x153')]));this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format'](_0x3de1('0x154'),this[_0x3de1('0x32')]['callerid'],_0xb1d33e[_0x3de1('0x153')]));return{'code':0xc8,'result':_0x3de1('0x155')};}else{logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x156'),this[_0x3de1('0x32')]['callerid'],_0xb1d33e[_0x3de1('0x153')]));this['channel']['noop'](util[_0x3de1('0x25')](_0x3de1('0x154'),this['channel']['callerid'],_0xb1d33e[_0x3de1('0x153')]));return{'code':0xc8,'result':_0x3de1('0x157')};}};AGIVertices['prototype']['playback']=function(_0x3773d2){logger[_0x3de1('0x2a')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3773d2[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x3773d2['file_id'])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x3773d2,_0x3de1('0x10e'));}var _0xaee06d=this[_0x3de1('0x10f')][_0x3de1('0x68')](this,_0x3773d2[_0x3de1('0x10d')]);if(!_0xaee06d){return this['channel'][_0x3de1('0x28')](_0x3773d2,_0x3de1('0x110'));}var _0xdd45e8=this[_0x3de1('0x32')]['exec'](_0x3de1('0x166'),[_0xaee06d,_0x3773d2[_0x3de1('0xdd')]]);if(_0xdd45e8[_0x3de1('0x9b')]===-0x1){return _0xdd45e8;}return this[_0x3de1('0x32')]['noop'](util[_0x3de1('0x25')](_0x3de1('0xbb'),_0x3de1('0x166'),_0xaee06d));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x167')]=function(_0xb1aae4){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x168'),_0xb1aae4[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0xb1aae4[_0x3de1('0x169')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0xb1aae4,_0x3de1('0x16a'));}var _0x602747='';var _0x3b3720=parseInt(_0xb1aae4[_0x3de1('0x169')],0xa);if(isNaN(_0x3b3720)){_0x602747=_0xb1aae4[_0x3de1('0x169')];}else{_0x602747=this['getVoiceQueue'][_0x3de1('0x68')](this,_0xb1aae4['queue_id']);if(!_0x602747){return this['channel'][_0x3de1('0x28')](_0xb1aae4,_0x3de1('0x16b'));}}var _0x26fd05='';if(this['isConfigured'](_0xb1aae4[_0x3de1('0x10d')])){var _0x293412=this[_0x3de1('0x10f')]['sync'](this,_0xb1aae4[_0x3de1('0x10d')]);if(_0x293412){_0x26fd05=_0x293412;}}this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0xb1aae4,_0x602747);if(_0xb1aae4[_0x3de1('0xdd')]['indexOf']('x')<0x0){_0xb1aae4[_0x3de1('0xdd')]+='x';}if(_0xb1aae4[_0x3de1('0xdd')][_0x3de1('0x16c')]('X')<0x0){_0xb1aae4[_0x3de1('0xdd')]+='X';}this['channel'][_0x3de1('0x96')](_0x3de1('0x16d'),_0x602747?_0x602747['toLowerCase']():'');var _0x3df3db=this['channel'][_0x3de1('0x54')](_0x3de1('0x16e'),[_0x602747,_0xb1aae4['opts'],_0xb1aae4[_0x3de1('0x6a')],_0x26fd05,_0xb1aae4['timeout'],_0xb1aae4['agi'],_0xb1aae4['macro'],_0xb1aae4[_0x3de1('0x16f')],'',_0xb1aae4[_0x3de1('0x170')]]);if(_0x3df3db['result']===-0x1){return _0x3df3db;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Executed\x20command\x20%s\x20%s',_0x3de1('0x16e'),_0x602747));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x171')]=function(_0x2c85a9){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x172'),_0x2c85a9['label']));var _0x38cfc4=_0x2c85a9[_0x3de1('0x173')]||_0x3de1('0x12d');var _0x26d8db=util[_0x3de1('0x25')](_0x3de1('0x174'),this['channel'][_0x3de1('0x33')],rs[_0x3de1('0x119')](0x5));var _0x3d89b0=util[_0x3de1('0x25')]('%s/recordings/%s.%s',FILES_PATH,_0x26d8db,_0x38cfc4);var _0x140b2e=util[_0x3de1('0x25')](_0x3de1('0x12e'),FILES_PATH,_0x26d8db);this[_0x3de1('0x37')][_0x3de1('0x68')](this,_0x2c85a9,_0x26d8db,_0x3d89b0);this['channel'][_0x3de1('0x96')](_0x3de1('0x175'),_0x26d8db);logger['info'](_0x3de1('0x176'),_0x140b2e,_0x38cfc4,_0x2c85a9[_0x3de1('0x177')],_0x2c85a9['timeout']);return this[_0x3de1('0x32')][_0x3de1('0x137')](_0x140b2e,_0x38cfc4,_0x2c85a9['escape_digits'],_0x2c85a9[_0x3de1('0x5f')],undefined,!![]);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x178')]=function(_0x579258){logger['info'](util[_0x3de1('0x25')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x579258[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x579258['url'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x179'));}var _0x233e86=this[_0x3de1('0x5d')][_0x3de1('0x68')](this,_0x579258);logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x17a'),util[_0x3de1('0x17b')](_0x233e86,{'showHidden':![],'depth':null})));if(!this[_0x3de1('0x9d')](_0x579258[_0x3de1('0xd1')])){return this[_0x3de1('0x32')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x46be70=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x579258['variable_id']);if(!_0x46be70){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x579258,'no\x20variable\x20found');}this[_0x3de1('0x32')][_0x3de1('0x96')](util[_0x3de1('0x25')](_0x3de1('0x17c'),_0x46be70),_0x233e86[_0x3de1('0x6e')]?_0x233e86[_0x3de1('0x6e')]:_0x3de1('0x17d'));this[_0x3de1('0x32')][_0x3de1('0x96')](util['format'](_0x3de1('0x17e'),_0x46be70),_0x233e86['statusMessage']?_0x233e86['statusMessage']:'OK');if(_0x233e86['body']){try{this['saveRestApiResult'](_0x233e86[_0x3de1('0x62')],_0x46be70);}catch(_0x50fe11){logger[_0x3de1('0x28')](util[_0x3de1('0x25')](_0x3de1('0x17f'),_0x46be70));}}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xd7'),_0x46be70));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x180')]=function(_0x2803f4){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x181'),_0x2803f4[_0x3de1('0xa2')]));return this[_0x3de1('0x32')]['sayDigits'](_0x2803f4[_0x3de1('0x182')]['replace'](/\s+/g,''),_0x2803f4[_0x3de1('0x177')]);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x183')]=function(_0x763f9c){logger[_0x3de1('0x2a')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x763f9c[_0x3de1('0xa2')]));return this['channel'][_0x3de1('0x184')](_0x763f9c['number'][_0x3de1('0xcd')](/\s+/g,''),_0x763f9c[_0x3de1('0x177')]);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x185')]=function(_0x181d66){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x186'),_0x181d66[_0x3de1('0xa2')]));return this[_0x3de1('0x32')]['sayPhonetic'](_0x181d66[_0x3de1('0x58')],_0x181d66[_0x3de1('0x177')]);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x187')]=function(_0x57e930){logger['info'](util['format'](_0x3de1('0x188'),_0x57e930[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x57e930[_0x3de1('0x189')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0x18a'));}var _0xdf92b6=this[_0x3de1('0x18b')][_0x3de1('0x68')](this,_0x57e930[_0x3de1('0x189')]);if(!_0xdf92b6||!_0xdf92b6[_0x3de1('0x18c')]){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x57e930,_0x3de1('0x18d'));}var _0x52c774={'from':util[_0x3de1('0x25')]('\x22%s\x22\x20<%s>',_0xdf92b6['name'],_0xdf92b6[_0x3de1('0x18e')]||_0xdf92b6[_0x3de1('0x18c')][_0x3de1('0x18f')]),'to':_0x57e930['to']||'','cc':_0x57e930['cc']||'','bcc':_0x57e930['bcc']||'','subject':_0x57e930[_0x3de1('0x190')],'html':_0x57e930[_0x3de1('0x58')],'text':_0x57e930[_0x3de1('0x58')]};if(this[_0x3de1('0x9d')](_0x57e930[_0x3de1('0x191')])){}logger[_0x3de1('0x192')](_0x3de1('0x193'),JSON['stringify'](_0x52c774));this[_0x3de1('0x9e')]['sync'](this,_0x57e930,_0x57e930[_0x3de1('0x189')]);this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x194'),_0xdf92b6[_0x3de1('0x17')]));this[_0x3de1('0x22')][_0x3de1('0x68')](this,_0xdf92b6[_0x3de1('0x195')],_0x52c774);return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x196'));};AGIVertices['prototype'][_0x3de1('0x197')]=function(_0xdf6c92){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xdf6c92[_0x3de1('0xa2')]));return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x198'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x199')]=function(_0x579ce0){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x19a'),_0x579ce0[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x579ce0[_0x3de1('0x19b')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0x19c'));}var _0x3d7d8c=this[_0x3de1('0x19d')][_0x3de1('0x68')](this,_0x579ce0['sms_account_id']);if(!_0x3d7d8c){return this['channel'][_0x3de1('0x28')](_0x579ce0,'no\x20sms\x20account\x20found');}var _0xf6faf1={'body':_0x579ce0[_0x3de1('0x19e')],'phone':_0x579ce0['to']||'','SmsAccountId':_0x3d7d8c['id']};logger[_0x3de1('0x192')](_0x3de1('0x19f'),JSON[_0x3de1('0x6c')](_0xf6faf1));this[_0x3de1('0x9e')]['sync'](this,_0x579ce0,_0x579ce0[_0x3de1('0x19b')]);this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x1a0'),_0x3d7d8c[_0x3de1('0x17')]));this[_0x3de1('0x31')][_0x3de1('0x68')](this,_0xf6faf1);return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0x1a1'));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x1a2')]=function(_0xebc0f5){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x1a3'),_0xebc0f5[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0xebc0f5['variable_id'])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0xebc0f5,_0x3de1('0x1a4'));}var _0xaec8f=this['getVariable']['sync'](this,_0xebc0f5[_0x3de1('0xd1')]);if(!_0xaec8f){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0xebc0f5,_0x3de1('0xd2'));}return this[_0x3de1('0x32')][_0x3de1('0x96')](_0xaec8f,_0xebc0f5['variable_value']);};AGIVertices[_0x3de1('0x11')][_0x3de1('0x1a5')]=function(_0x5aff3e){logger['info'](util[_0x3de1('0x25')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5aff3e[_0x3de1('0xa2')]));this['channel'][_0x3de1('0xa3')]('START\x20CALLY\x20SQUARE');if(_0x5aff3e['answer']===_0x3de1('0x1a6')){this[_0x3de1('0x32')]['noop'](_0x3de1('0x1a7'));return this[_0x3de1('0x32')][_0x3de1('0xb2')]();}return this[_0x3de1('0x32')][_0x3de1('0xa3')]('Skipped\x20Answer');};AGIVertices['prototype']['subproject']=function(_0x2291b5){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x1a8'),_0x2291b5[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x2291b5[_0x3de1('0x1a9')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x2291b5,_0x3de1('0x1aa'));}var _0x3236dd=this[_0x3de1('0x1ab')][_0x3de1('0x68')](this,_0x2291b5[_0x3de1('0x1a9')]);if(!this[_0x3de1('0x9d')](_0x3236dd)){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x2291b5,util[_0x3de1('0x25')](_0x3de1('0x1ac'),_0x2291b5['project_id']));}if(_0x3236dd===this[_0x3de1('0x32')][_0x3de1('0x35')]){return this['channel']['error'](_0x2291b5,_0x3de1('0x1ad'));}this['createSquareDetailsReport'][_0x3de1('0x68')](this,_0x2291b5,_0x3236dd);var _0x1deaaf=this[_0x3de1('0x32')]['exec'](_0x3de1('0x1ae'),util[_0x3de1('0x25')](_0x3de1('0x1af'),config[_0x3de1('0x1b0')][_0x3de1('0x1b1')]||'127.0.0.1',_0x3236dd,this[_0x3de1('0x32')][_0x3de1('0x35')]));if(_0x1deaaf[_0x3de1('0x9b')]===-0x1){return _0x1deaaf;}return this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0xbb'),_0x3de1('0x1ae'),_0x3236dd));};AGIVertices['prototype'][_0x3de1('0x1b2')]=function(_0x2d5959){logger['info'](util[_0x3de1('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2d5959['label']));var _0x309716=this[_0x3de1('0x53')]['sync'](this,_0x2d5959['command']);this[_0x3de1('0x9e')][_0x3de1('0x68')](this,_0x2d5959,_0x2d5959[_0x3de1('0xb0')]);if(this['isConfigured'](_0x2d5959[_0x3de1('0xd1')])){var _0x4930e6=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x2d5959['variable_id']);if(_0x4930e6){this[_0x3de1('0x32')][_0x3de1('0x96')](_0x4930e6,_0x309716);return this['channel'][_0x3de1('0xa3')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2d5959[_0x3de1('0xb0')],_0x4930e6));}}return this[_0x3de1('0x32')]['noop'](util[_0x3de1('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2d5959[_0x3de1('0xb0')]));};AGIVertices['prototype'][_0x3de1('0x1b3')]=function(_0x1bcd81){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x1b4'),_0x1bcd81[_0x3de1('0xa2')]));_0x1bcd81[_0x3de1('0x58')]=_0x1bcd81[_0x3de1('0x58')][_0x3de1('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3de1('0x9d')](_0x1bcd81[_0x3de1('0x1b5')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0x1b6'));}if(!this[_0x3de1('0x9d')](_0x1bcd81[_0x3de1('0x58')])){return this['channel'][_0x3de1('0xa3')](_0x3de1('0xa4'));}this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')](_0x3de1('0x1b7'),_0x1bcd81[_0x3de1('0x58')]));var _0x45b557=this['googleCloudTTS'][_0x3de1('0x68')](this,_0x1bcd81);if(_0x45b557){this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x45b557));var _0x23aed9=this[_0x3de1('0x32')][_0x3de1('0x1b8')](_0x45b557);try{fs[_0x3de1('0xfd')](_0x45b557+'.wav');}catch(_0x10c2ea){logger[_0x3de1('0x28')](_0x10c2ea);}return _0x23aed9;}return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x1bcd81,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x3de1('0x11')][_0x3de1('0x1b9')]=function(_0x2a6989){logger['info'](util[_0x3de1('0x25')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2a6989[_0x3de1('0xa2')]));_0x2a6989[_0x3de1('0x58')]=_0x2a6989[_0x3de1('0x58')][_0x3de1('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3de1('0x9d')](_0x2a6989['text'])){return this[_0x3de1('0x32')][_0x3de1('0xa3')](_0x3de1('0xa4'));}this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x2a6989[_0x3de1('0x58')]));var _0xc83568=this['googleTTS'][_0x3de1('0x68')](this,_0x2a6989);if(_0xc83568){this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')]('Google\x20TTS\x20%s\x20file\x20created',_0xc83568));var _0x54ce97=this[_0x3de1('0x32')]['streamFile'](_0xc83568);try{fs[_0x3de1('0xfd')](_0xc83568+_0x3de1('0xfe'));}catch(_0x53040d){logger['error'](_0x53040d);}return _0x54ce97;}return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x2a6989,_0x3de1('0x1ba'));};AGIVertices[_0x3de1('0x11')]['unpause']=function(_0x3a4640){logger[_0x3de1('0x2a')](util['format'](_0x3de1('0x1bb'),_0x3a4640[_0x3de1('0xa2')]));if(!this[_0x3de1('0x9d')](_0x3a4640[_0x3de1('0x153')])){return this[_0x3de1('0x32')][_0x3de1('0x28')](_0x3a4640,_0x3de1('0x152'));}logger['info'](util[_0x3de1('0x25')](_0x3de1('0x159'),this[_0x3de1('0x32')][_0x3de1('0x36')],_0x3a4640[_0x3de1('0x153')]));var _0x48855e=this[_0x3de1('0x4d')][_0x3de1('0x68')](this,_0x3a4640['findBy']);if(_0x48855e){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x154'),this[_0x3de1('0x32')]['callerid'],_0x3a4640[_0x3de1('0x153')]));this[_0x3de1('0x32')][_0x3de1('0xa3')](util[_0x3de1('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3de1('0x36')],_0x3a4640['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x3de1('0x2a')](util[_0x3de1('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x3a4640[_0x3de1('0x153')]));this['channel'][_0x3de1('0xa3')](util[_0x3de1('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3de1('0x32')][_0x3de1('0x36')],_0x3a4640['findBy']));return{'code':0xc8,'result':_0x3de1('0x157')};}};AGIVertices['prototype'][_0x3de1('0x1bc')]=function(_0x521dd3){logger[_0x3de1('0x2a')](util[_0x3de1('0x25')](_0x3de1('0x1bd'),_0x521dd3[_0x3de1('0xa2')]));var _0x5a9973=this['channel'][_0x3de1('0x54')](_0x3de1('0x1be'),[_0x521dd3[_0x3de1('0x1bf')],_0x521dd3[_0x3de1('0x71')]]);if(_0x5a9973[_0x3de1('0x9b')]===-0x1){return _0x5a9973;}return this[_0x3de1('0x32')][_0x3de1('0xa3')](util['format'](_0x3de1('0xbb'),_0x3de1('0x1be'),_0x521dd3[_0x3de1('0x1bf')]));};AGIVertices[_0x3de1('0x11')][_0x3de1('0x1c0')]=function(_0x28cc21){logger['info'](util[_0x3de1('0x25')](_0x3de1('0x1c1'),_0x28cc21['label']));if(!this[_0x3de1('0x9d')](_0x28cc21[_0x3de1('0xd1')])){return this['channel'][_0x3de1('0x28')](_0x28cc21,'no\x20variable\x20selected');}var _0x122f42=this[_0x3de1('0x9a')][_0x3de1('0x68')](this,_0x28cc21['variable_id']);if(!_0x122f42){return this['channel'][_0x3de1('0x28')](_0x28cc21,'no\x20variable\x20found');}var _0x542486=this[_0x3de1('0x32')]['getVariable'](_0x122f42);return{'code':0xc8,'result':_0x542486[_0x3de1('0x98')]?_0x542486[_0x3de1('0x98')]:'-'};};String[_0x3de1('0x11')]['replaceAll']=function(_0x48191e,_0x37e3cf){return this[_0x3de1('0x97')](_0x48191e)[_0x3de1('0x1c2')](_0x37e3cf);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index dca3056..5b92042 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 _0x5e9a=['[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','finally','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','stringify'];(function(_0x3cf5db,_0x1a77ff){var _0x21fbba=function(_0x5f4029){while(--_0x5f4029){_0x3cf5db['push'](_0x3cf5db['shift']());}};_0x21fbba(++_0x1a77ff);}(_0x5e9a,0x11c));var _0xa5e9=function(_0x26ee9e,_0x26a216){_0x26ee9e=_0x26ee9e-0x0;var _0x3dbf17=_0x5e9a[_0x26ee9e];return _0x3dbf17;};'use strict';var util=require(_0xa5e9('0x0'));var _=require(_0xa5e9('0x1'));var moment=require(_0xa5e9('0x2'));var ami=require(_0xa5e9('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xa5e9('0x4'));var RpcVoiceAgentReport=require(_0xa5e9('0x5'));function Acw(_0x9b214f){this[_0xa5e9('0x6')]=_0x9b214f['voiceQueues'];this[_0xa5e9('0x7')]=_0x9b214f[_0xa5e9('0x7')];this[_0xa5e9('0x8')]=_0x9b214f[_0xa5e9('0x8')];this[_0xa5e9('0x9')]={};ami['on']('agentconnect',this[_0xa5e9('0xa')][_0xa5e9('0xb')](this));ami['on'](_0xa5e9('0xc'),this['syncHangupRequest'][_0xa5e9('0xb')](this));ami['on']('hangup',this['syncHangup'][_0xa5e9('0xb')](this));ami['on'](_0xa5e9('0xd'),this[_0xa5e9('0xe')]['bind'](this));ami['on'](_0xa5e9('0xf'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xa5e9('0x10'),this[_0xa5e9('0x11')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xa5e9('0x12')]['bind'](this));}function getDiff(_0x10af86){var _0x1c53c6=moment()[_0xa5e9('0x13')](0x0);var _0x1d0b23=moment(_0x10af86)[_0xa5e9('0x13')](0x0);return _0x1c53c6[_0xa5e9('0x14')](_0x1d0b23,_0xa5e9('0x15'));}Acw['prototype'][_0xa5e9('0x16')]=function(_0x342376){try{var _0x84f75d=this;var _0x3ba6ad=this['channels'][_0x342376][_0xa5e9('0x17')];var _0x357323=this[_0xa5e9('0x9')][_0x342376][_0xa5e9('0x18')];var _0x302013=this[_0xa5e9('0x6')][_0x357323];var _0x2a3089=![];var _0x22dcba=_0xa5e9('0x19');if(_0x302013[_0xa5e9('0x1a')]){if(_0x302013['mandatoryDispositionPause'][_0xa5e9('0x1b')]){_0x2a3089=!![];_0x22dcba=_0x302013[_0xa5e9('0x1c')][_0xa5e9('0x1b')];}}ami[_0xa5e9('0x1d')]({'action':_0xa5e9('0x1e'),'interface':_0x3ba6ad,'paused':!![],'reason':_0x22dcba})[_0xa5e9('0x1f')](function(_0xa47e15){if(_0x84f75d['agents'][_0x3ba6ad]){return RpcUser['getAgent'](_0x84f75d[_0xa5e9('0x7')][_0x3ba6ad]['id'])[_0xa5e9('0x1f')](function(_0x45747f){if(_0x45747f&&!_0x45747f[_0xa5e9('0x20')]){logger['info'](_0xa5e9('0x21'),_0x342376,_0x3ba6ad,_0x357323);var _0x1ca430=_0x84f75d[_0xa5e9('0x9')][_0x342376][_0xa5e9('0x22')]&&_0x84f75d[_0xa5e9('0x9')][_0x342376][_0xa5e9('0x23')]?_0x84f75d[_0xa5e9('0x9')][_0x342376][_0xa5e9('0x23')]:_0x342376;return RpcUser['savePause'](_0x84f75d['agents'][_0x3ba6ad],_0x22dcba,_0x1ca430)[_0xa5e9('0x1f')](function(_0x4b4674){if(!_0x2a3089){_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad]={};logger[_0xa5e9('0x24')](_0xa5e9('0x25'),_0x342376,_0x84f75d[_0xa5e9('0x6')][_0x357323]['acwTimeout'],_0x3ba6ad,_0x357323);_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x26')]=setTimeout(_0x84f75d[_0xa5e9('0x27')][_0xa5e9('0xb')](_0x84f75d,_0x3ba6ad),_0x84f75d[_0xa5e9('0x6')][_0x357323][_0xa5e9('0x28')]*0x3e8);_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x2a')]=_0x342376;_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x18')]=_0x357323;_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x2b')]=function(){var _0xd8af34=getDiff(_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x29')]);clearTimeout(_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x26')]);_0x84f75d['timers'][_0x3ba6ad][_0xa5e9('0x26')]=![];RpcVoiceAgentReport[_0xa5e9('0x2c')]({'acwtime':_0xd8af34},_0x84f75d[_0xa5e9('0x8')][_0x3ba6ad][_0xa5e9('0x2a')],_0x3ba6ad)['then'](function(_0x35bd7b){logger[_0xa5e9('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x342376,_0xd8af34,_0x35bd7b);})[_0xa5e9('0x2d')](function(_0x3a8965){logger[_0xa5e9('0x2e')](_0xa5e9('0x2f'),_0x342376,_0x3a8965);});delete _0x84f75d[_0xa5e9('0x8')][_0x3ba6ad];};}});}else{logger[_0xa5e9('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x342376,_0x3ba6ad,_0x357323);}});}})[_0xa5e9('0x2d')](function(_0x13f5f9){logger[_0xa5e9('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x342376,_0x84f75d[_0xa5e9('0x6')][_0x357323]['acwTimeout'],_0x3ba6ad,_0x357323);})[_0xa5e9('0x30')](function(){delete _0x84f75d['channels'][_0x342376];});}catch(_0x34e1e1){logger['error'](_0xa5e9('0x31'),_0x34e1e1['message']);}};Acw[_0xa5e9('0x32')]['stopAcw']=function(_0x1d928f){try{var _0x312fb6=this;if(_0x312fb6[_0xa5e9('0x8')][_0x1d928f]){_0x312fb6['timers'][_0x1d928f]['timer']=![];var _0x3f33ba=_0x312fb6[_0xa5e9('0x8')][_0x1d928f][_0xa5e9('0x2a')];var _0x1bb8da=_0x312fb6['timers'][_0x1d928f][_0xa5e9('0x18')];var _0x3df505=_0x312fb6[_0xa5e9('0x6')][_0x1bb8da][_0xa5e9('0x28')];logger['info'](_0xa5e9('0x33'),_0x3f33ba,_0x1d928f);RpcUser[_0xa5e9('0x34')](this['agents'][_0x1d928f]);RpcVoiceAgentReport['update']({'acwtime':_0x3df505,'agentacw':!![]},_0x3f33ba,_0x1d928f)[_0xa5e9('0x1f')](function(_0x322082){logger[_0xa5e9('0x24')](_0xa5e9('0x35'),_0x3f33ba,_0x3df505,_0x322082);})[_0xa5e9('0x2d')](function(_0x2d2442){logger[_0xa5e9('0x2e')](_0xa5e9('0x2f'),_0x3f33ba,_0x2d2442);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1d928f);if(_0x312fb6[_0xa5e9('0x8')]){logger[_0xa5e9('0x24')](_0xa5e9('0x36'),JSON[_0xa5e9('0x37')](_0x312fb6[_0xa5e9('0x8')]));}}}catch(_0x51b835){logger[_0xa5e9('0x2e')](_0xa5e9('0x38'),_0x51b835[_0xa5e9('0x39')]);}};Acw[_0xa5e9('0x32')][_0xa5e9('0xa')]=function(_0x54daf1){try{if(this['voiceQueues'][_0x54daf1[_0xa5e9('0x18')]]&&(this['voiceQueues'][_0x54daf1[_0xa5e9('0x18')]][_0xa5e9('0x3a')]||this[_0xa5e9('0x6')][_0x54daf1[_0xa5e9('0x18')]][_0xa5e9('0x1a')])){if(this['agents'][_0x54daf1['interface']]){this[_0xa5e9('0x9')][_0x54daf1[_0xa5e9('0x2a')]]={'queue':_0x54daf1[_0xa5e9('0x18')],'interface':_0x54daf1['interface'],'destlinkedid':_0x54daf1['destlinkedid']};}}}catch(_0x241758){logger[_0xa5e9('0x2e')](_0xa5e9('0x3b'),_0x241758[_0xa5e9('0x39')]);}};Acw[_0xa5e9('0x32')][_0xa5e9('0x12')]=function(_0x3eddbb){try{if(this[_0xa5e9('0x6')][_0x3eddbb['queue']]&&(this['voiceQueues'][_0x3eddbb[_0xa5e9('0x18')]][_0xa5e9('0x3a')]||this['voiceQueues'][_0x3eddbb[_0xa5e9('0x18')]]['mandatoryDisposition'])){if(this['agents'][_0x3eddbb[_0xa5e9('0x17')]]){this[_0xa5e9('0x9')][_0x3eddbb[_0xa5e9('0x2a')]]={'queue':_0x3eddbb[_0xa5e9('0x18')],'interface':_0x3eddbb[_0xa5e9('0x17')]};}}}catch(_0x65be03){logger[_0xa5e9('0x2e')](_0xa5e9('0x3c'),_0x65be03[_0xa5e9('0x39')]);}};Acw[_0xa5e9('0x32')]['syncHangupRequest']=function(_0x374491){try{if(this['channels'][_0x374491[_0xa5e9('0x2a')]]&&_[_0xa5e9('0x3d')](this[_0xa5e9('0x9')][_0x374491[_0xa5e9('0x2a')]]['attended'])){logger[_0xa5e9('0x24')]('[%s][HANGUP:UNIQUEID]',_0x374491[_0xa5e9('0x2a')]);this[_0xa5e9('0x16')](_0x374491[_0xa5e9('0x2a')]);}else if(this[_0xa5e9('0x9')][_0x374491[_0xa5e9('0x3e')]]&&_[_0xa5e9('0x3d')](this[_0xa5e9('0x9')][_0x374491[_0xa5e9('0x3e')]][_0xa5e9('0x22')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x374491['linkedid']);this[_0xa5e9('0x16')](_0x374491[_0xa5e9('0x3e')]);}}catch(_0x5ac34f){logger[_0xa5e9('0x2e')](_0xa5e9('0x3f'),_0x5ac34f['message']);}};Acw[_0xa5e9('0x32')][_0xa5e9('0x40')]=function(_0x5aa713){try{if(this[_0xa5e9('0x9')][_0x5aa713[_0xa5e9('0x2a')]]&&this[_0xa5e9('0x9')][_0x5aa713[_0xa5e9('0x2a')]]['attended']){logger['info'](_0xa5e9('0x41'),_0x5aa713['uniqueid']);this['startAcw'](_0x5aa713[_0xa5e9('0x2a')]);}else if(this[_0xa5e9('0x9')][_0x5aa713[_0xa5e9('0x3e')]]&&this[_0xa5e9('0x9')][_0x5aa713['linkedid']][_0xa5e9('0x22')]){logger[_0xa5e9('0x24')](_0xa5e9('0x42'),_0x5aa713['linkedid']);this[_0xa5e9('0x16')](_0x5aa713[_0xa5e9('0x3e')]);}}catch(_0x22c27b){logger[_0xa5e9('0x2e')](_0xa5e9('0x43'),_0x22c27b['message']);}};Acw[_0xa5e9('0x32')][_0xa5e9('0x44')]=function(_0x38f612){try{if(!_[_0xa5e9('0x45')](this[_0xa5e9('0x9')][_0x38f612['transfereeuniqueid']])){this['startAcw'](_0x38f612[_0xa5e9('0x46')]);if(this[_0xa5e9('0x9')][_0x38f612[_0xa5e9('0x47')]]){this[_0xa5e9('0x9')][_0x38f612[_0xa5e9('0x47')]][_0xa5e9('0x22')]=!![];this['channels'][_0x38f612[_0xa5e9('0x48')]]=this['channels'][_0x38f612[_0xa5e9('0x47')]];delete this[_0xa5e9('0x9')][_0x38f612['secondtransfereruniqueid']];}}else if(!_[_0xa5e9('0x45')](this[_0xa5e9('0x9')][_0x38f612['transfertargetuniqueid']])){this['startAcw'](_0x38f612['transfertargetuniqueid']);if(this['channels'][_0x38f612['origtransfereruniqueid']]){this[_0xa5e9('0x9')][_0x38f612['origtransfereruniqueid']]['attended']=!![];this[_0xa5e9('0x9')][_0x38f612[_0xa5e9('0x46')]]=this[_0xa5e9('0x9')][_0x38f612[_0xa5e9('0x49')]];delete this[_0xa5e9('0x9')][_0x38f612['origtransfereruniqueid']];}}}catch(_0x45a4bc){logger[_0xa5e9('0x2e')](_0xa5e9('0x4a'),_0x45a4bc[_0xa5e9('0x39')]);}};Acw['prototype'][_0xa5e9('0x11')]=function(_0x4cfbd2){try{if(this['channels'][_0x4cfbd2[_0xa5e9('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xa5e9('0x37')](_0x4cfbd2['transfereruniqueid']));this[_0xa5e9('0x16')](_0x4cfbd2['transfereruniqueid']);}else if(this[_0xa5e9('0x9')][_0x4cfbd2[_0xa5e9('0x4c')]]){logger[_0xa5e9('0x24')](_0xa5e9('0x4d'),JSON[_0xa5e9('0x37')](_0x4cfbd2[_0xa5e9('0x4c')]));this[_0xa5e9('0x16')](_0x4cfbd2[_0xa5e9('0x4c')]);}}catch(_0x43f747){logger[_0xa5e9('0x2e')](_0xa5e9('0x4e'),_0x43f747[_0xa5e9('0x39')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x50f9fc){try{if(this[_0xa5e9('0x6')][_0x50f9fc['queue']]&&this[_0xa5e9('0x6')][_0x50f9fc['queue']][_0xa5e9('0x4f')]===_0xa5e9('0x50')){if(this[_0xa5e9('0x7')][_0x50f9fc[_0xa5e9('0x17')]]){logger[_0xa5e9('0x24')](_0xa5e9('0x51'),_0x50f9fc[_0xa5e9('0x2a')],_0x50f9fc[_0xa5e9('0x17')],_0x50f9fc[_0xa5e9('0x18')]);return RpcUser[_0xa5e9('0x52')](this[_0xa5e9('0x7')][_0x50f9fc[_0xa5e9('0x17')]],'Auto-Pause',_0x50f9fc[_0xa5e9('0x2a')]);}}}catch(_0xcfb7cc){logger[_0xa5e9('0x2e')](_0xa5e9('0x53'),_0xcfb7cc[_0xa5e9('0x39')]);}};module[_0xa5e9('0x54')]=Acw; \ No newline at end of file +var _0xaa68=['isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','name','mandatoryDispositionPause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','mandatoryDisposition','interface','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','attended','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaa68,0x161));var _0x8aa6=function(_0xb2e8b1,_0x46beb7){_0xb2e8b1=_0xb2e8b1-0x0;var _0x30ee7d=_0xaa68[_0xb2e8b1];return _0x30ee7d;};'use strict';var util=require(_0x8aa6('0x0'));var _=require('lodash');var moment=require(_0x8aa6('0x1'));var ami=require(_0x8aa6('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x8aa6('0x3'));function Acw(_0x23e035){this[_0x8aa6('0x4')]=_0x23e035[_0x8aa6('0x4')];this[_0x8aa6('0x5')]=_0x23e035[_0x8aa6('0x5')];this[_0x8aa6('0x6')]=_0x23e035[_0x8aa6('0x6')];this['channels']={};ami['on'](_0x8aa6('0x7'),this[_0x8aa6('0x8')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x8aa6('0x9')](this));ami['on'](_0x8aa6('0xa'),this[_0x8aa6('0xb')][_0x8aa6('0x9')](this));ami['on'](_0x8aa6('0xc'),this[_0x8aa6('0xd')][_0x8aa6('0x9')](this));ami['on'](_0x8aa6('0xe'),this[_0x8aa6('0xf')][_0x8aa6('0x9')](this));ami['on'](_0x8aa6('0x10'),this[_0x8aa6('0x11')][_0x8aa6('0x9')](this));ami['on'](_0x8aa6('0x12'),this[_0x8aa6('0x13')]['bind'](this));}function getDiff(_0x14dcd4){var _0x530049=moment()[_0x8aa6('0x14')](0x0);var _0x709da6=moment(_0x14dcd4)[_0x8aa6('0x14')](0x0);return _0x530049[_0x8aa6('0x15')](_0x709da6,_0x8aa6('0x16'));}Acw[_0x8aa6('0x17')]['startAcw']=function(_0x485353){try{var _0x2079d7=this;var _0x491e46=this[_0x8aa6('0x18')][_0x485353]['interface'];var _0x4b0609=this[_0x8aa6('0x18')][_0x485353]['queue'];var _0x491d91=this[_0x8aa6('0x4')][_0x4b0609];var _0x4e1f44=![];var _0x17f152='ACW';if(_0x491d91['mandatoryDisposition']){if(_0x491d91['mandatoryDispositionPause'][_0x8aa6('0x19')]){_0x4e1f44=!![];_0x17f152=_0x491d91[_0x8aa6('0x1a')][_0x8aa6('0x19')];}}ami['Action']({'action':'QueuePause','interface':_0x491e46,'paused':!![],'reason':_0x17f152})[_0x8aa6('0x1b')](function(_0x2eb332){if(_0x2079d7[_0x8aa6('0x5')][_0x491e46]){return RpcUser[_0x8aa6('0x1c')](_0x2079d7[_0x8aa6('0x5')][_0x491e46]['id'])[_0x8aa6('0x1b')](function(_0x2d9ccc){if(_0x2d9ccc&&!_0x2d9ccc['voicePause']){logger[_0x8aa6('0x1d')](_0x8aa6('0x1e'),_0x485353,_0x491e46,_0x4b0609);var _0x397abd=_0x2079d7[_0x8aa6('0x18')][_0x485353]['attended']&&_0x2079d7[_0x8aa6('0x18')][_0x485353][_0x8aa6('0x1f')]?_0x2079d7[_0x8aa6('0x18')][_0x485353]['destlinkedid']:_0x485353;return RpcUser[_0x8aa6('0x20')](_0x2079d7[_0x8aa6('0x5')][_0x491e46],_0x17f152,_0x397abd)[_0x8aa6('0x1b')](function(_0x54e840){if(!_0x4e1f44){_0x2079d7[_0x8aa6('0x6')][_0x491e46]={};logger[_0x8aa6('0x1d')](_0x8aa6('0x21'),_0x485353,_0x2079d7['voiceQueues'][_0x4b0609]['acwTimeout'],_0x491e46,_0x4b0609);_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x22')]=setTimeout(_0x2079d7[_0x8aa6('0x23')][_0x8aa6('0x9')](_0x2079d7,_0x491e46),_0x2079d7[_0x8aa6('0x4')][_0x4b0609][_0x8aa6('0x24')]*0x3e8);_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x25')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x26')]=_0x485353;_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x27')]=_0x4b0609;_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x28')]=function(){var _0x3c3faf=getDiff(_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x25')]);clearTimeout(_0x2079d7['timers'][_0x491e46][_0x8aa6('0x22')]);_0x2079d7[_0x8aa6('0x6')][_0x491e46][_0x8aa6('0x22')]=![];RpcVoiceAgentReport[_0x8aa6('0x29')]({'acwtime':_0x3c3faf},_0x2079d7[_0x8aa6('0x6')][_0x491e46]['uniqueid'],_0x491e46)['then'](function(_0xced08c){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x485353,_0x3c3faf,_0xced08c);})[_0x8aa6('0x2a')](function(_0xab2a92){logger[_0x8aa6('0x2b')](_0x8aa6('0x2c'),_0x485353,_0xab2a92);});delete _0x2079d7[_0x8aa6('0x6')][_0x491e46];};}});}else{logger[_0x8aa6('0x1d')](_0x8aa6('0x2d'),_0x485353,_0x491e46,_0x4b0609);}});}})[_0x8aa6('0x2a')](function(_0x193e43){logger['error'](_0x8aa6('0x21'),_0x485353,_0x2079d7['voiceQueues'][_0x4b0609]['acwTimeout'],_0x491e46,_0x4b0609);})[_0x8aa6('0x2e')](function(){delete _0x2079d7[_0x8aa6('0x18')][_0x485353];});}catch(_0x3f3b93){logger['error'](_0x8aa6('0x2f'),_0x3f3b93[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')][_0x8aa6('0x23')]=function(_0x12a765){try{var _0x2f6a15=this;if(_0x2f6a15['timers'][_0x12a765]){_0x2f6a15[_0x8aa6('0x6')][_0x12a765][_0x8aa6('0x22')]=![];var _0x4ec17a=_0x2f6a15[_0x8aa6('0x6')][_0x12a765][_0x8aa6('0x26')];var _0x46bbb3=_0x2f6a15[_0x8aa6('0x6')][_0x12a765]['queue'];var _0x5d4e31=_0x2f6a15[_0x8aa6('0x4')][_0x46bbb3][_0x8aa6('0x24')];logger['info'](_0x8aa6('0x31'),_0x4ec17a,_0x12a765);RpcUser[_0x8aa6('0x32')](this[_0x8aa6('0x5')][_0x12a765]);RpcVoiceAgentReport[_0x8aa6('0x29')]({'acwtime':_0x5d4e31,'agentacw':!![]},_0x4ec17a,_0x12a765)[_0x8aa6('0x1b')](function(_0x12207c){logger[_0x8aa6('0x1d')](_0x8aa6('0x33'),_0x4ec17a,_0x5d4e31,_0x12207c);})[_0x8aa6('0x2a')](function(_0x3b8b87){logger[_0x8aa6('0x2b')](_0x8aa6('0x2c'),_0x4ec17a,_0x3b8b87);});}else{logger[_0x8aa6('0x2b')](_0x8aa6('0x34'),_0x12a765);if(_0x2f6a15[_0x8aa6('0x6')]){logger[_0x8aa6('0x1d')](_0x8aa6('0x35'),JSON[_0x8aa6('0x36')](_0x2f6a15[_0x8aa6('0x6')]));}}}catch(_0x9f861c){logger[_0x8aa6('0x2b')](_0x8aa6('0x37'),_0x9f861c[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')][_0x8aa6('0x8')]=function(_0x2e5dae){try{if(this[_0x8aa6('0x4')][_0x2e5dae[_0x8aa6('0x27')]]&&(this[_0x8aa6('0x4')][_0x2e5dae['queue']][_0x8aa6('0x38')]||this['voiceQueues'][_0x2e5dae[_0x8aa6('0x27')]][_0x8aa6('0x39')])){if(this['agents'][_0x2e5dae[_0x8aa6('0x3a')]]){this[_0x8aa6('0x18')][_0x2e5dae[_0x8aa6('0x26')]]={'queue':_0x2e5dae[_0x8aa6('0x27')],'interface':_0x2e5dae[_0x8aa6('0x3a')],'destlinkedid':_0x2e5dae['destlinkedid']};}}}catch(_0xdf226a){logger[_0x8aa6('0x2b')]('[ACW][syncAgentConnect]\x20%s',_0xdf226a[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')][_0x8aa6('0x13')]=function(_0x24e50c){try{if(this[_0x8aa6('0x4')][_0x24e50c[_0x8aa6('0x27')]]&&(this[_0x8aa6('0x4')][_0x24e50c['queue']][_0x8aa6('0x38')]||this['voiceQueues'][_0x24e50c[_0x8aa6('0x27')]][_0x8aa6('0x39')])){if(this[_0x8aa6('0x5')][_0x24e50c[_0x8aa6('0x3a')]]){this['channels'][_0x24e50c['uniqueid']]={'queue':_0x24e50c[_0x8aa6('0x27')],'interface':_0x24e50c[_0x8aa6('0x3a')]};}}}catch(_0x36d4e1){logger['error'](_0x8aa6('0x3b'),_0x36d4e1[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')][_0x8aa6('0x3c')]=function(_0xa4dc92){try{if(this['channels'][_0xa4dc92[_0x8aa6('0x26')]]&&_[_0x8aa6('0x3d')](this[_0x8aa6('0x18')][_0xa4dc92['uniqueid']]['attended'])){logger[_0x8aa6('0x1d')]('[%s][HANGUP:UNIQUEID]',_0xa4dc92['uniqueid']);this[_0x8aa6('0x3e')](_0xa4dc92[_0x8aa6('0x26')]);}else if(this[_0x8aa6('0x18')][_0xa4dc92['linkedid']]&&_[_0x8aa6('0x3d')](this[_0x8aa6('0x18')][_0xa4dc92[_0x8aa6('0x3f')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0xa4dc92['linkedid']);this[_0x8aa6('0x3e')](_0xa4dc92[_0x8aa6('0x3f')]);}}catch(_0x1212cd){logger['error'](_0x8aa6('0x40'),_0x1212cd['message']);}};Acw[_0x8aa6('0x17')][_0x8aa6('0xb')]=function(_0x1d543c){try{if(this[_0x8aa6('0x18')][_0x1d543c['uniqueid']]&&this[_0x8aa6('0x18')][_0x1d543c[_0x8aa6('0x26')]][_0x8aa6('0x41')]){logger[_0x8aa6('0x1d')](_0x8aa6('0x42'),_0x1d543c[_0x8aa6('0x26')]);this[_0x8aa6('0x3e')](_0x1d543c[_0x8aa6('0x26')]);}else if(this[_0x8aa6('0x18')][_0x1d543c[_0x8aa6('0x3f')]]&&this[_0x8aa6('0x18')][_0x1d543c[_0x8aa6('0x3f')]]['attended']){logger[_0x8aa6('0x1d')](_0x8aa6('0x43'),_0x1d543c['linkedid']);this[_0x8aa6('0x3e')](_0x1d543c[_0x8aa6('0x3f')]);}}catch(_0x12daad){logger['error'](_0x8aa6('0x44'),_0x12daad[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')][_0x8aa6('0xf')]=function(_0x51b5b7){try{if(!_['isNil'](this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x45')]])){this['startAcw'](_0x51b5b7[_0x8aa6('0x45')]);if(this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x46')]]){this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x46')]][_0x8aa6('0x41')]=!![];this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x47')]]=this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x46')]];delete this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x46')]];}}else if(!_[_0x8aa6('0x48')](this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x47')]])){this[_0x8aa6('0x3e')](_0x51b5b7['transfertargetuniqueid']);if(this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x49')]]){this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x49')]][_0x8aa6('0x41')]=!![];this[_0x8aa6('0x18')][_0x51b5b7['transfereeuniqueid']]=this['channels'][_0x51b5b7[_0x8aa6('0x49')]];delete this[_0x8aa6('0x18')][_0x51b5b7[_0x8aa6('0x49')]];}}}catch(_0x4ffb78){logger[_0x8aa6('0x2b')](_0x8aa6('0x4a'),_0x4ffb78[_0x8aa6('0x30')]);}};Acw[_0x8aa6('0x17')]['syncBlindTransfer']=function(_0x1a63ba){try{if(this[_0x8aa6('0x18')][_0x1a63ba[_0x8aa6('0x4b')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x8aa6('0x36')](_0x1a63ba[_0x8aa6('0x4b')]));this[_0x8aa6('0x3e')](_0x1a63ba[_0x8aa6('0x4b')]);}else if(this['channels'][_0x1a63ba[_0x8aa6('0x4c')]]){logger[_0x8aa6('0x1d')](_0x8aa6('0x4d'),JSON[_0x8aa6('0x36')](_0x1a63ba[_0x8aa6('0x4c')]));this['startAcw'](_0x1a63ba[_0x8aa6('0x4c')]);}}catch(_0x2dbc6a){logger[_0x8aa6('0x2b')](_0x8aa6('0x4e'),_0x2dbc6a['message']);}};Acw[_0x8aa6('0x17')][_0x8aa6('0xd')]=function(_0x146beb){try{if(this[_0x8aa6('0x4')][_0x146beb[_0x8aa6('0x27')]]&&this[_0x8aa6('0x4')][_0x146beb['queue']][_0x8aa6('0x4f')]===_0x8aa6('0x50')){if(this[_0x8aa6('0x5')][_0x146beb['interface']]){logger[_0x8aa6('0x1d')](_0x8aa6('0x51'),_0x146beb[_0x8aa6('0x26')],_0x146beb[_0x8aa6('0x3a')],_0x146beb[_0x8aa6('0x27')]);return RpcUser[_0x8aa6('0x20')](this['agents'][_0x146beb[_0x8aa6('0x3a')]],_0x8aa6('0x52'),_0x146beb[_0x8aa6('0x26')]);}}}catch(_0x3df12b){logger[_0x8aa6('0x2b')](_0x8aa6('0x53'),_0x3df12b[_0x8aa6('0x30')]);}};module[_0x8aa6('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8466162..bf759ff 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','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','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x459534,_0x5eda71){var _0x22fdc5=function(_0x2d5a8d){while(--_0x2d5a8d){_0x459534['push'](_0x459534['shift']());}};_0x22fdc5(++_0x5eda71);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x3bbc9b,_0x25ccac){var _0x49478a=function(_0x1996bf){while(--_0x1996bf){_0x3bbc9b['push'](_0x3bbc9b['shift']());}};_0x49478a(++_0x25ccac);}(_0x0b0e,0x187));var _0xe0b0=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0x0b0e[_0x537c37];return _0x241f84;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index aafff6c..6a29262 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x2a2f51,_0x2c76cf){var _0x53d7c4=function(_0x3309b3){while(--_0x3309b3){_0x2a2f51['push'](_0x2a2f51['shift']());}};_0x53d7c4(++_0x2c76cf);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1e656c,_0x5dea47){_0x1e656c=_0x1e656c-0x0;var _0x507856=_0xf4eb[_0x1e656c];return _0x507856;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x70e0,0x17b));var _0x070e=function(_0x1cd056,_0x4667f8){_0x1cd056=_0x1cd056-0x0;var _0x464634=_0x70e0[_0x1cd056];return _0x464634;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index dfb6687..6c39624 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 _0x01b9=['CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','string','isNil','name','Contact','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2b2387,_0xea8b40){var _0x40fac2=function(_0x34b955){while(--_0x34b955){_0x2b2387['push'](_0x2b2387['shift']());}};_0x40fac2(++_0xea8b40);}(_0x01b9,0x19e));var _0x901b=function(_0x5e42cb,_0x477838){_0x5e42cb=_0x5e42cb-0x0;var _0x1ec854=_0x01b9[_0x5e42cb];return _0x1ec854;};'use strict';var util=require(_0x901b('0x0'));var _=require(_0x901b('0x1'));var moment=require(_0x901b('0x2'));function checkNameSurname(_0x589e0f,_0x1d52bb,_0x3407e6){var _0x36a58e='';if(!_['isNil'](_0x1d52bb)&&_0x901b('0x3')===typeof _0x1d52bb){_0x36a58e+=_0x1d52bb;}if(!_[_0x901b('0x4')](_0x3407e6)&&_0x901b('0x3')===typeof _0x3407e6){_0x36a58e+='\x20'+_0x3407e6;}if(_0x36a58e!==''){return _0x36a58e;}return _0x589e0f;}function Action(_0x4cba70,_0x11fc86,_0x415f63){this['voiceQueue']=_0x4cba70;this['uniqueid']=_0x415f63||undefined;this[_0x901b('0x5')]=checkNameSurname(_0x11fc86[_0x901b('0x6')]['phone'],_0x11fc86[_0x901b('0x6')][_0x901b('0x7')],_0x11fc86[_0x901b('0x6')]['lastName']);this[_0x901b('0x8')]=_0x11fc86['phone'];this[_0x901b('0x9')]=_0x4cba70[_0x901b('0x5')];this[_0x901b('0xa')]=_0x11fc86[_0x901b('0xa')]||![];this[_0x901b('0xb')]=_0x4cba70[_0x901b('0xb')];this[_0x901b('0xc')]=_0x4cba70[_0x901b('0xc')]||0x3;this[_0x901b('0xd')]=_0x11fc86[_0x901b('0xd')];this[_0x901b('0xe')]=_0x11fc86[_0x901b('0xe')];this['countcongestionretry']=_0x11fc86[_0x901b('0xf')];this[_0x901b('0x10')]=_0x11fc86[_0x901b('0x10')];this[_0x901b('0x11')]=_0x11fc86[_0x901b('0x11')];this[_0x901b('0x12')]=_0x11fc86[_0x901b('0x12')];this[_0x901b('0x13')]=_0x11fc86[_0x901b('0x13')];this['countmachineretry']=_0x11fc86[_0x901b('0x14')];this[_0x901b('0x15')]=_0x11fc86[_0x901b('0x15')];this[_0x901b('0x16')]=_0x11fc86[_0x901b('0x16')];this[_0x901b('0x17')]=_0x11fc86[_0x901b('0x17')];this[_0x901b('0x18')]=_0x11fc86['UserId'];this['VoiceQueueId']=_0x11fc86[_0x901b('0x19')];this['CampaignId']=_0x11fc86[_0x901b('0x1a')];this[_0x901b('0x1b')]=_0x11fc86['id'];this['ContactFirstName']=_0x11fc86[_0x901b('0x6')][_0x901b('0x7')]||'';this[_0x901b('0x1c')]=moment()[_0x901b('0x1d')](_0x901b('0x1e'));this[_0x901b('0x1f')]=_0x11fc86[_0x901b('0x1f')];this[_0x901b('0x20')]=_0x11fc86[_0x901b('0x20')];this[_0x901b('0x21')]=_0x11fc86[_0x901b('0x21')];this['recallme']=_0x11fc86[_0x901b('0x22')];this[_0x901b('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x901b('0x24')]=function(){return util[_0x901b('0x1d')](_0x901b('0x25'),this[_0x901b('0x5')],this[_0x901b('0x26')][_0x901b('0x27')]>0x0?this[_0x901b('0x8')][_0x901b('0x28')](this[_0x901b('0x26')][_0x901b('0x27')]):this[_0x901b('0x8')]);};Action[_0x901b('0x29')][_0x901b('0x2a')]=function(){return this[_0x901b('0x9')];};module[_0x901b('0x2b')]=Action; \ No newline at end of file +var _0x8464=['countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','moment','string','isNil','voiceQueue','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry'];(function(_0x319373,_0x4540ce){var _0x58555f=function(_0x5eac39){while(--_0x5eac39){_0x319373['push'](_0x319373['shift']());}};_0x58555f(++_0x4540ce);}(_0x8464,0xe7));var _0x4846=function(_0x2cccc7,_0x512822){_0x2cccc7=_0x2cccc7-0x0;var _0x4e1603=_0x8464[_0x2cccc7];return _0x4e1603;};'use strict';var util=require(_0x4846('0x0'));var _=require('lodash');var moment=require(_0x4846('0x1'));function checkNameSurname(_0x473ff7,_0x1f1ee1,_0x33b567){var _0x34dd7a='';if(!_['isNil'](_0x1f1ee1)&&_0x4846('0x2')===typeof _0x1f1ee1){_0x34dd7a+=_0x1f1ee1;}if(!_[_0x4846('0x3')](_0x33b567)&&_0x4846('0x2')===typeof _0x33b567){_0x34dd7a+='\x20'+_0x33b567;}if(_0x34dd7a!==''){return _0x34dd7a;}return _0x473ff7;}function Action(_0x34aef1,_0x3de52f,_0x5816dc){this[_0x4846('0x4')]=_0x34aef1;this['uniqueid']=_0x5816dc||undefined;this[_0x4846('0x5')]=checkNameSurname(_0x3de52f[_0x4846('0x6')]['phone'],_0x3de52f[_0x4846('0x6')][_0x4846('0x7')],_0x3de52f[_0x4846('0x6')][_0x4846('0x8')]);this[_0x4846('0x9')]=_0x3de52f[_0x4846('0xa')];this[_0x4846('0xb')]=_0x34aef1[_0x4846('0x5')];this[_0x4846('0xc')]=_0x3de52f[_0x4846('0xc')]||![];this['type']=_0x34aef1[_0x4846('0xd')];this[_0x4846('0xe')]=_0x34aef1['dialQueueTimeout']||0x3;this[_0x4846('0xf')]=_0x3de52f[_0x4846('0xf')];this['countbusyretry']=_0x3de52f['countbusyretry'];this[_0x4846('0x10')]=_0x3de52f[_0x4846('0x10')];this[_0x4846('0x11')]=_0x3de52f[_0x4846('0x11')];this['countnosuchnumberretry']=_0x3de52f[_0x4846('0x12')];this['countdropretry']=_0x3de52f[_0x4846('0x13')];this['countabandonedretry']=_0x3de52f['countabandonedretry'];this['countmachineretry']=_0x3de52f[_0x4846('0x14')];this[_0x4846('0x15')]=_0x3de52f[_0x4846('0x15')];this[_0x4846('0x16')]=_0x3de52f[_0x4846('0x16')];this[_0x4846('0x17')]=_0x3de52f[_0x4846('0x17')];this[_0x4846('0x18')]=_0x3de52f[_0x4846('0x18')];this['VoiceQueueId']=_0x3de52f['VoiceQueueId'];this[_0x4846('0x19')]=_0x3de52f['CampaignId'];this[_0x4846('0x1a')]=_0x3de52f['id'];this[_0x4846('0x1b')]=_0x3de52f[_0x4846('0x6')][_0x4846('0x7')]||'';this[_0x4846('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x3de52f[_0x4846('0x1d')];this[_0x4846('0x1e')]=_0x3de52f[_0x4846('0x1e')];this[_0x4846('0x1f')]=_0x3de52f[_0x4846('0x1f')];this[_0x4846('0x20')]=_0x3de52f[_0x4846('0x20')];this[_0x4846('0x21')]='';this[_0x4846('0x22')]='';}Action[_0x4846('0x23')][_0x4846('0x24')]=function(){return util[_0x4846('0x25')](_0x4846('0x26'),this['name'],this[_0x4846('0x4')][_0x4846('0x27')]>0x0?this['number'][_0x4846('0x28')](this[_0x4846('0x4')][_0x4846('0x27')]):this[_0x4846('0x9')]);};Action[_0x4846('0x23')][_0x4846('0x29')]=function(){return this['queue'];};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 974a657..02a5f48 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 _0xbcfe=['answertime','endtime','format','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime'];(function(_0xcbb8db,_0x1f0a12){var _0x2fdcac=function(_0x2eedc9){while(--_0x2eedc9){_0xcbb8db['push'](_0xcbb8db['shift']());}};_0x2fdcac(++_0x1f0a12);}(_0xbcfe,0x1cb));var _0xebcf=function(_0x1bfd65,_0x405968){_0x1bfd65=_0x1bfd65-0x0;var _0x2fc3c2=_0xbcfe[_0x1bfd65];return _0x2fc3c2;};'use strict';var util=require(_0xebcf('0x0'));var _=require(_0xebcf('0x1'));var moment=require('moment');function getSeconds(_0x243d08,_0x5b4ca9){var _0x51d2dc=moment(_0x243d08)[_0xebcf('0x2')](0x0);var _0x4ce38d=moment(_0x5b4ca9)['milliseconds'](0x0);return _0x51d2dc[_0xebcf('0x3')](_0x4ce38d,_0xebcf('0x4'));}function AgentComplete(_0x188bdb,_0x20b398){this[_0xebcf('0x5')]=0x4;this['statedesc']='Answer';this[_0xebcf('0x6')]=_0x188bdb[_0xebcf('0x6')];this[_0xebcf('0x7')]=_0x188bdb['type'];this[_0xebcf('0x8')]=_0x188bdb[_0xebcf('0x7')]===_0xebcf('0x9')?_0xebcf('0xa'):_0x188bdb['type'];this[_0xebcf('0xb')]=_0x188bdb[_0xebcf('0xb')];this[_0xebcf('0xc')]=_0x188bdb['countcongestionretry'];this[_0xebcf('0xd')]=_0x188bdb[_0xebcf('0xd')];this[_0xebcf('0xe')]=_0x188bdb[_0xebcf('0xb')]+_0x188bdb['countcongestionretry']+_0x188bdb['countnoanswerretry']+_0x188bdb[_0xebcf('0xf')]+_0x188bdb['countdropretry']+_0x188bdb['countabandonedretry']+_0x188bdb[_0xebcf('0x10')]+_0x188bdb[_0xebcf('0x11')];this[_0xebcf('0xf')]=_0x188bdb['countnosuchnumberretry'];this[_0xebcf('0x12')]=_0x188bdb[_0xebcf('0x12')];this[_0xebcf('0x13')]=_0x188bdb[_0xebcf('0x13')];this[_0xebcf('0x10')]=_0x188bdb[_0xebcf('0x10')];this[_0xebcf('0x11')]=_0x188bdb[_0xebcf('0x11')];this[_0xebcf('0x14')]=_0x20b398[_0xebcf('0x14')];this['calleridname']=_0x188bdb[_0xebcf('0x15')];this[_0xebcf('0x16')]=_0x188bdb['number'];this[_0xebcf('0x17')]=_0x188bdb[_0xebcf('0x17')];this[_0xebcf('0x18')]=_0x188bdb[_0xebcf('0x18')];this[_0xebcf('0x19')]=_0x188bdb[_0xebcf('0x19')];this[_0xebcf('0x1a')]=moment()[_0xebcf('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x188bdb[_0xebcf('0x18')],_0x188bdb[_0xebcf('0x17')]);this[_0xebcf('0x1c')]=getSeconds(_0x188bdb[_0xebcf('0x19')],_0x188bdb[_0xebcf('0x18')]);this[_0xebcf('0x1d')]=getSeconds(this[_0xebcf('0x1a')],_0x188bdb[_0xebcf('0x19')]);this[_0xebcf('0xa')]=_0x20b398['queue'];this[_0xebcf('0x1e')]=_0x20b398[_0xebcf('0x1e')];this[_0xebcf('0x1f')]=_0x20b398[_0xebcf('0x1f')];this[_0xebcf('0x20')]=_0x188bdb[_0xebcf('0x20')];this[_0xebcf('0x21')]=_0x188bdb[_0xebcf('0x21')];this[_0xebcf('0x22')]=_0x188bdb[_0xebcf('0x22')];this['recallme']=_0x188bdb[_0xebcf('0x23')];this['ContactId']=_0x188bdb[_0xebcf('0x24')];this[_0xebcf('0x25')]=_0x188bdb[_0xebcf('0x25')];this['UserId']=_0x188bdb[_0xebcf('0x26')];this['VoiceQueueId']=_0x188bdb[_0xebcf('0x27')];this['CampaignId']=_0x188bdb[_0xebcf('0x28')];this[_0xebcf('0x29')]=_0x188bdb[_0xebcf('0x29')]||'';this[_0xebcf('0x2a')]=_0x188bdb[_0xebcf('0x2a')]||'';}module[_0xebcf('0x2b')]=AgentComplete; \ No newline at end of file +var _0x97df=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callbackuniqueid'];(function(_0x3d0b47,_0x2e1b5a){var _0x4f45ba=function(_0x1808ee){while(--_0x1808ee){_0x3d0b47['push'](_0x3d0b47['shift']());}};_0x4f45ba(++_0x2e1b5a);}(_0x97df,0x196));var _0xf97d=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x97df[_0x491a7f];return _0x3d8f44;};'use strict';var util=require(_0xf97d('0x0'));var _=require(_0xf97d('0x1'));var moment=require('moment');function getSeconds(_0x3bae13,_0x2493bf){var _0x27a3f3=moment(_0x3bae13)[_0xf97d('0x2')](0x0);var _0x564cb7=moment(_0x2493bf)[_0xf97d('0x2')](0x0);return _0x27a3f3['diff'](_0x564cb7,'seconds');}function AgentComplete(_0x5ef1cf,_0x23f307){this['state']=0x4;this['statedesc']=_0xf97d('0x3');this[_0xf97d('0x4')]=_0x5ef1cf['scheduledat'];this[_0xf97d('0x5')]=_0x5ef1cf[_0xf97d('0x5')];this[_0xf97d('0x6')]=_0x5ef1cf[_0xf97d('0x5')]===_0xf97d('0x7')?'queue':_0x5ef1cf[_0xf97d('0x5')];this[_0xf97d('0x8')]=_0x5ef1cf[_0xf97d('0x8')];this['countcongestionretry']=_0x5ef1cf['countcongestionretry'];this['countnoanswerretry']=_0x5ef1cf[_0xf97d('0x9')];this[_0xf97d('0xa')]=_0x5ef1cf[_0xf97d('0x8')]+_0x5ef1cf[_0xf97d('0xb')]+_0x5ef1cf[_0xf97d('0x9')]+_0x5ef1cf[_0xf97d('0xc')]+_0x5ef1cf['countdropretry']+_0x5ef1cf[_0xf97d('0xd')]+_0x5ef1cf[_0xf97d('0xe')]+_0x5ef1cf[_0xf97d('0xf')];this[_0xf97d('0xc')]=_0x5ef1cf[_0xf97d('0xc')];this[_0xf97d('0x10')]=_0x5ef1cf['countdropretry'];this['countabandonedretry']=_0x5ef1cf[_0xf97d('0xd')];this['countmachineretry']=_0x5ef1cf[_0xf97d('0xe')];this[_0xf97d('0xf')]=_0x5ef1cf[_0xf97d('0xf')];this['uniqueid']=_0x23f307[_0xf97d('0x11')];this[_0xf97d('0x12')]=_0x5ef1cf[_0xf97d('0x13')];this['calleridnum']=_0x5ef1cf[_0xf97d('0x14')];this[_0xf97d('0x15')]=_0x5ef1cf[_0xf97d('0x15')];this[_0xf97d('0x16')]=_0x5ef1cf[_0xf97d('0x16')];this[_0xf97d('0x17')]=_0x5ef1cf[_0xf97d('0x17')];this[_0xf97d('0x18')]=moment()[_0xf97d('0x19')](_0xf97d('0x1a'));this[_0xf97d('0x1b')]=getSeconds(_0x5ef1cf[_0xf97d('0x16')],_0x5ef1cf[_0xf97d('0x15')]);this[_0xf97d('0x1c')]=getSeconds(_0x5ef1cf[_0xf97d('0x17')],_0x5ef1cf['responsetime']);this[_0xf97d('0x1d')]=getSeconds(this[_0xf97d('0x18')],_0x5ef1cf[_0xf97d('0x17')]);this[_0xf97d('0x1e')]=_0x23f307[_0xf97d('0x1e')];this[_0xf97d('0x1f')]=_0x23f307[_0xf97d('0x1f')];this[_0xf97d('0x20')]=_0x23f307['reason'];this['callback']=_0x5ef1cf['callback'];this[_0xf97d('0x21')]=_0x5ef1cf[_0xf97d('0x21')];this[_0xf97d('0x22')]=_0x5ef1cf[_0xf97d('0x22')];this[_0xf97d('0x23')]=_0x5ef1cf[_0xf97d('0x23')];this[_0xf97d('0x24')]=_0x5ef1cf[_0xf97d('0x24')];this[_0xf97d('0x25')]=_0x5ef1cf[_0xf97d('0x25')];this[_0xf97d('0x26')]=_0x5ef1cf[_0xf97d('0x26')];this[_0xf97d('0x27')]=_0x5ef1cf[_0xf97d('0x27')];this[_0xf97d('0x28')]=_0x5ef1cf[_0xf97d('0x28')];this[_0xf97d('0x29')]=_0x5ef1cf[_0xf97d('0x29')]||'';this[_0xf97d('0x2a')]=_0x5ef1cf['originatecalleridname']||'';}module[_0xf97d('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 47c5158..69255d1 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 _0x25fa=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x416035,_0xc2df2){var _0x445360=function(_0x3cfa39){while(--_0x3cfa39){_0x416035['push'](_0x416035['shift']());}};_0x445360(++_0xc2df2);}(_0x25fa,0x109));var _0xa25f=function(_0x39d3ee,_0x5b0aef){_0x39d3ee=_0x39d3ee-0x0;var _0x5b6a30=_0x25fa[_0x39d3ee];return _0x5b6a30;};'use strict';var util=require(_0xa25f('0x0'));var _=require('lodash');var moment=require(_0xa25f('0x1'));function getSeconds(_0x37129d,_0x57e272){var _0x408155=moment(_0x37129d)[_0xa25f('0x2')](0x0);var _0x256155=moment(_0x57e272)['milliseconds'](0x0);return _0x408155['diff'](_0x256155,_0xa25f('0x3'));}function Final(_0x50dafc){this[_0xa25f('0x4')]=_0x50dafc[_0xa25f('0x4')];this[_0xa25f('0x5')]=_0x50dafc[_0xa25f('0x5')];this[_0xa25f('0x6')]=_0x50dafc[_0xa25f('0x6')];this[_0xa25f('0x7')]=_0x50dafc[_0xa25f('0x6')]===_0xa25f('0x8')?'queue':_0x50dafc[_0xa25f('0x6')];this[_0xa25f('0x9')]=_0x50dafc['countbusyretry'];this[_0xa25f('0xa')]=_0x50dafc[_0xa25f('0xa')];this[_0xa25f('0xb')]=_0x50dafc[_0xa25f('0xb')];this['countglobal']=_0x50dafc[_0xa25f('0x9')]+_0x50dafc[_0xa25f('0xa')]+_0x50dafc['countnoanswerretry']+_0x50dafc[_0xa25f('0xc')]+_0x50dafc[_0xa25f('0xd')]+_0x50dafc['countabandonedretry']+_0x50dafc[_0xa25f('0xe')]+_0x50dafc[_0xa25f('0xf')];this[_0xa25f('0xc')]=_0x50dafc[_0xa25f('0xc')];this[_0xa25f('0xd')]=_0x50dafc[_0xa25f('0xd')];this[_0xa25f('0x10')]=_0x50dafc[_0xa25f('0x10')];this[_0xa25f('0xe')]=_0x50dafc[_0xa25f('0xe')];this[_0xa25f('0xf')]=_0x50dafc[_0xa25f('0xf')];this['queue']=_0x50dafc[_0xa25f('0x11')];this[_0xa25f('0x12')]=_0x50dafc[_0xa25f('0x12')];this[_0xa25f('0x13')]=_0x50dafc[_0xa25f('0x13')];this[_0xa25f('0x14')]=_0x50dafc['starttime'];this[_0xa25f('0x15')]=_0x50dafc['responsetime'];this[_0xa25f('0x16')]=_0x50dafc['responsetime'];this['ringtime']=_0x50dafc[_0xa25f('0x17')]||0x0;this['holdtime']=_0x50dafc[_0xa25f('0x18')]||0x0;this[_0xa25f('0x19')]=_0x50dafc[_0xa25f('0x19')]||0x0;this[_0xa25f('0x1a')]=_0x50dafc[_0xa25f('0x1a')];this['callbackuniqueid']=_0x50dafc[_0xa25f('0x1b')];this[_0xa25f('0x1c')]=_0x50dafc[_0xa25f('0x1c')];this[_0xa25f('0x1d')]=_0x50dafc['recallme'];this[_0xa25f('0x1e')]=_0x50dafc[_0xa25f('0x1e')];this[_0xa25f('0x1f')]=_0x50dafc[_0xa25f('0x1f')];this['UserId']=_0x50dafc[_0xa25f('0x20')];this[_0xa25f('0x21')]=_0x50dafc[_0xa25f('0x21')];this[_0xa25f('0x22')]=_0x50dafc['CampaignId'];this[_0xa25f('0x23')]=_0x50dafc[_0xa25f('0x23')]||'';this['originatecalleridname']=_0x50dafc[_0xa25f('0x24')]||'';}module['exports']=Final; \ No newline at end of file +var _0xe0c3=['util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0xc14cce,_0x35e0de){var _0x417ac5=function(_0x237e6f){while(--_0x237e6f){_0xc14cce['push'](_0xc14cce['shift']());}};_0x417ac5(++_0x35e0de);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3e0c('0x0'));var _=require('lodash');var moment=require(_0x3e0c('0x1'));function getSeconds(_0x172593,_0x3bb243){var _0x41c0bf=moment(_0x172593)[_0x3e0c('0x2')](0x0);var _0x410ec4=moment(_0x3bb243)[_0x3e0c('0x2')](0x0);return _0x41c0bf[_0x3e0c('0x3')](_0x410ec4,_0x3e0c('0x4'));}function Final(_0x511cfa){this['uniqueid']=_0x511cfa[_0x3e0c('0x5')];this[_0x3e0c('0x6')]=_0x511cfa[_0x3e0c('0x6')];this[_0x3e0c('0x7')]=_0x511cfa[_0x3e0c('0x7')];this[_0x3e0c('0x8')]=_0x511cfa[_0x3e0c('0x7')]===_0x3e0c('0x9')?_0x3e0c('0xa'):_0x511cfa[_0x3e0c('0x7')];this[_0x3e0c('0xb')]=_0x511cfa['countbusyretry'];this['countcongestionretry']=_0x511cfa[_0x3e0c('0xc')];this[_0x3e0c('0xd')]=_0x511cfa[_0x3e0c('0xd')];this[_0x3e0c('0xe')]=_0x511cfa[_0x3e0c('0xb')]+_0x511cfa[_0x3e0c('0xc')]+_0x511cfa[_0x3e0c('0xd')]+_0x511cfa['countnosuchnumberretry']+_0x511cfa[_0x3e0c('0xf')]+_0x511cfa['countabandonedretry']+_0x511cfa[_0x3e0c('0x10')]+_0x511cfa[_0x3e0c('0x11')];this['countnosuchnumberretry']=_0x511cfa[_0x3e0c('0x12')];this[_0x3e0c('0xf')]=_0x511cfa[_0x3e0c('0xf')];this[_0x3e0c('0x13')]=_0x511cfa[_0x3e0c('0x13')];this[_0x3e0c('0x10')]=_0x511cfa[_0x3e0c('0x10')];this[_0x3e0c('0x11')]=_0x511cfa[_0x3e0c('0x11')];this[_0x3e0c('0xa')]=_0x511cfa[_0x3e0c('0xa')];this[_0x3e0c('0x14')]=_0x511cfa['calleridname'];this['calleridnum']=_0x511cfa[_0x3e0c('0x15')];this[_0x3e0c('0x16')]=_0x511cfa[_0x3e0c('0x16')];this[_0x3e0c('0x17')]=_0x511cfa[_0x3e0c('0x17')];this[_0x3e0c('0x18')]=_0x511cfa['responsetime'];this[_0x3e0c('0x19')]=_0x511cfa[_0x3e0c('0x19')]||0x0;this[_0x3e0c('0x1a')]=_0x511cfa['holdtime']||0x0;this[_0x3e0c('0x1b')]=_0x511cfa['talktime']||0x0;this['callback']=_0x511cfa[_0x3e0c('0x1c')];this[_0x3e0c('0x1d')]=_0x511cfa[_0x3e0c('0x1d')];this[_0x3e0c('0x1e')]=_0x511cfa['callbackat'];this['recallme']=_0x511cfa[_0x3e0c('0x1f')];this['ContactId']=_0x511cfa['ContactId'];this[_0x3e0c('0x20')]=_0x511cfa[_0x3e0c('0x20')];this[_0x3e0c('0x21')]=_0x511cfa['UserId'];this[_0x3e0c('0x22')]=_0x511cfa[_0x3e0c('0x22')];this['CampaignId']=_0x511cfa[_0x3e0c('0x23')];this[_0x3e0c('0x24')]=_0x511cfa[_0x3e0c('0x24')]||'';this[_0x3e0c('0x25')]=_0x511cfa['originatecalleridname']||'';}module[_0x3e0c('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a100391..1800217 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 _0xa101=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type'];(function(_0x71e814,_0x56dd2b){var _0x242a31=function(_0x2f780e){while(--_0x2f780e){_0x71e814['push'](_0x71e814['shift']());}};_0x242a31(++_0x56dd2b);}(_0xa101,0x171));var _0x1a10=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0xa101[_0x3bb5b4];return _0x586c60;};'use strict';var util=require(_0x1a10('0x0'));var _=require(_0x1a10('0x1'));var moment=require(_0x1a10('0x2'));function getSeconds(_0x4c5561,_0xe628d9){var _0x1cc48b=moment(_0x4c5561)[_0x1a10('0x3')](0x0);var _0x1bd00f=moment(_0xe628d9)['milliseconds'](0x0);return _0x1cc48b['diff'](_0x1bd00f,'seconds');}function Hangup(_0x18c76f,_0x4ef2a1){this[_0x1a10('0x4')]=0x4;this[_0x1a10('0x5')]=_0x1a10('0x6');this[_0x1a10('0x7')]=_0x18c76f[_0x1a10('0x7')];this[_0x1a10('0x8')]=_0x18c76f[_0x1a10('0x8')];this[_0x1a10('0x9')]=_0x18c76f[_0x1a10('0x8')]===_0x1a10('0xa')?_0x1a10('0xb'):_0x18c76f[_0x1a10('0x8')];this['countbusyretry']=_0x18c76f[_0x1a10('0xc')];this['countcongestionretry']=_0x18c76f[_0x1a10('0xd')];this['countnoanswerretry']=_0x18c76f['countnoanswerretry'];this[_0x1a10('0xe')]=_0x18c76f[_0x1a10('0xc')]+_0x18c76f[_0x1a10('0xd')]+_0x18c76f[_0x1a10('0xf')]+_0x18c76f[_0x1a10('0x10')]+_0x18c76f['countdropretry']+_0x18c76f[_0x1a10('0x11')]+_0x18c76f[_0x1a10('0x12')]+_0x18c76f[_0x1a10('0x13')];this[_0x1a10('0x10')]=_0x18c76f[_0x1a10('0x10')];this[_0x1a10('0x14')]=_0x18c76f['countdropretry'];this[_0x1a10('0x11')]=_0x18c76f[_0x1a10('0x11')];this['countmachineretry']=_0x18c76f[_0x1a10('0x12')];this[_0x1a10('0x13')]=_0x18c76f[_0x1a10('0x13')];this['uniqueid']=_0x4ef2a1[_0x1a10('0x15')];this['calleridname']=_0x18c76f['name'];this[_0x1a10('0x16')]=_0x18c76f[_0x1a10('0x17')];this['starttime']=_0x18c76f[_0x1a10('0x18')];this['responsetime']=_0x18c76f[_0x1a10('0x19')];this['endtime']=moment()[_0x1a10('0x1a')](_0x1a10('0x1b'));this['ringtime']=getSeconds(_0x18c76f[_0x1a10('0x19')],_0x18c76f[_0x1a10('0x18')]);this['holdtime']=0x0;this[_0x1a10('0x1c')]=getSeconds(this[_0x1a10('0x1d')],_0x18c76f[_0x1a10('0x19')]);this[_0x1a10('0xb')]=_0x18c76f[_0x1a10('0xb')];this[_0x1a10('0x1e')]=_0x1a10('0x1f');this[_0x1a10('0x20')]=_0x4ef2a1[_0x1a10('0x21')];this['callback']=_0x18c76f[_0x1a10('0x22')];this['callbackuniqueid']=_0x18c76f['callbackuniqueid'];this[_0x1a10('0x23')]=_0x18c76f[_0x1a10('0x23')];this[_0x1a10('0x24')]=_0x18c76f[_0x1a10('0x24')];this[_0x1a10('0x25')]=_0x18c76f[_0x1a10('0x25')];this[_0x1a10('0x26')]=_0x18c76f[_0x1a10('0x26')];this['UserId']=_0x18c76f['UserId'];this[_0x1a10('0x27')]=_0x18c76f['VoiceQueueId'];this[_0x1a10('0x28')]=_0x18c76f[_0x1a10('0x28')];}module[_0x1a10('0x29')]=Hangup; \ No newline at end of file +var _0x52e4=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','IVR','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x318b68,_0x3d376b){var _0x23e686=function(_0x3b71ba){while(--_0x3b71ba){_0x318b68['push'](_0x318b68['shift']());}};_0x23e686(++_0x3d376b);}(_0x52e4,0x1e9));var _0x452e=function(_0x37a778,_0x4c3341){_0x37a778=_0x37a778-0x0;var _0xaad7ea=_0x52e4[_0x37a778];return _0xaad7ea;};'use strict';var util=require(_0x452e('0x0'));var _=require(_0x452e('0x1'));var moment=require(_0x452e('0x2'));function getSeconds(_0x245e69,_0xc2d4bc){var _0x2fac4a=moment(_0x245e69)[_0x452e('0x3')](0x0);var _0x8ec147=moment(_0xc2d4bc)[_0x452e('0x3')](0x0);return _0x2fac4a[_0x452e('0x4')](_0x8ec147,'seconds');}function Hangup(_0x1a7634,_0xd7f89d){this[_0x452e('0x5')]=0x4;this[_0x452e('0x6')]=_0x452e('0x7');this[_0x452e('0x8')]=_0x1a7634[_0x452e('0x8')];this[_0x452e('0x9')]=_0x1a7634['type'];this['campaigntype']=_0x1a7634[_0x452e('0x9')]===_0x452e('0xa')?_0x452e('0xb'):_0x1a7634[_0x452e('0x9')];this[_0x452e('0xc')]=_0x1a7634[_0x452e('0xc')];this[_0x452e('0xd')]=_0x1a7634[_0x452e('0xd')];this[_0x452e('0xe')]=_0x1a7634['countnoanswerretry'];this[_0x452e('0xf')]=_0x1a7634['countbusyretry']+_0x1a7634['countcongestionretry']+_0x1a7634[_0x452e('0xe')]+_0x1a7634[_0x452e('0x10')]+_0x1a7634[_0x452e('0x11')]+_0x1a7634[_0x452e('0x12')]+_0x1a7634[_0x452e('0x13')]+_0x1a7634[_0x452e('0x14')];this[_0x452e('0x10')]=_0x1a7634[_0x452e('0x10')];this['countdropretry']=_0x1a7634[_0x452e('0x11')];this['countabandonedretry']=_0x1a7634[_0x452e('0x12')];this[_0x452e('0x13')]=_0x1a7634[_0x452e('0x13')];this['countagentrejectretry']=_0x1a7634[_0x452e('0x14')];this[_0x452e('0x15')]=_0xd7f89d[_0x452e('0x15')];this[_0x452e('0x16')]=_0x1a7634[_0x452e('0x17')];this['calleridnum']=_0x1a7634[_0x452e('0x18')];this[_0x452e('0x19')]=_0x1a7634[_0x452e('0x19')];this[_0x452e('0x1a')]=_0x1a7634[_0x452e('0x1a')];this[_0x452e('0x1b')]=moment()[_0x452e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x452e('0x1d')]=getSeconds(_0x1a7634['responsetime'],_0x1a7634[_0x452e('0x19')]);this[_0x452e('0x1e')]=0x0;this[_0x452e('0x1f')]=getSeconds(this[_0x452e('0x1b')],_0x1a7634[_0x452e('0x1a')]);this['queue']=_0x1a7634['queue'];this[_0x452e('0x20')]=_0x452e('0x21');this['reason']=_0xd7f89d['cause-txt'];this[_0x452e('0x22')]=_0x1a7634[_0x452e('0x22')];this[_0x452e('0x23')]=_0x1a7634[_0x452e('0x23')];this[_0x452e('0x24')]=_0x1a7634[_0x452e('0x24')];this['recallme']=_0x1a7634['recallme'];this['ContactId']=_0x1a7634['ContactId'];this[_0x452e('0x25')]=_0x1a7634[_0x452e('0x25')];this[_0x452e('0x26')]=_0x1a7634[_0x452e('0x26')];this[_0x452e('0x27')]=_0x1a7634[_0x452e('0x27')];this['CampaignId']=_0x1a7634[_0x452e('0x28')];}module[_0x452e('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 ee749d3..b2b22f1 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 _0x2cf1=['queue','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3c4834,_0x3a00e1){var _0x46671b=function(_0x30a862){while(--_0x30a862){_0x3c4834['push'](_0x3c4834['shift']());}};_0x46671b(++_0x3a00e1);}(_0x2cf1,0x134));var _0x12cf=function(_0x249e33,_0x44e206){_0x249e33=_0x249e33-0x0;var _0xf4243f=_0x2cf1[_0x249e33];return _0xf4243f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x12cf('0x0'));function getSeconds(_0x132b00,_0x1b2a2c){var _0x17d206=moment(_0x132b00)['milliseconds'](0x0);var _0xa6fa76=moment(_0x1b2a2c)[_0x12cf('0x1')](0x0);return _0x17d206[_0x12cf('0x2')](_0xa6fa76,_0x12cf('0x3'));}function History(_0x18e330){this[_0x12cf('0x4')]=_0x18e330[_0x12cf('0x4')];this[_0x12cf('0x5')]=_0x18e330[_0x12cf('0x5')]||undefined;this[_0x12cf('0x6')]=_0x18e330[_0x12cf('0x6')];this['campaigntype']=_0x18e330['type']==='outbound'?'queue':_0x18e330[_0x12cf('0x6')];this[_0x12cf('0x7')]=_0x18e330[_0x12cf('0x7')];this[_0x12cf('0x8')]=_0x18e330[_0x12cf('0x8')];this[_0x12cf('0x9')]=_0x18e330[_0x12cf('0x9')];this[_0x12cf('0xa')]=_0x18e330[_0x12cf('0x7')]+_0x18e330[_0x12cf('0x8')]+_0x18e330[_0x12cf('0x9')]+_0x18e330[_0x12cf('0xb')]+_0x18e330[_0x12cf('0xc')]+_0x18e330['countabandonedretry']+_0x18e330['countmachineretry']+_0x18e330['countagentrejectretry'];this['countnosuchnumberretry']=_0x18e330[_0x12cf('0xb')];this['countdropretry']=_0x18e330[_0x12cf('0xc')];this[_0x12cf('0xd')]=_0x18e330[_0x12cf('0xd')];this['countmachineretry']=_0x18e330[_0x12cf('0xe')];this[_0x12cf('0xf')]=_0x18e330[_0x12cf('0xf')];this[_0x12cf('0x10')]=_0x18e330[_0x12cf('0x10')];this[_0x12cf('0x11')]=_0x18e330['name'];this[_0x12cf('0x12')]=_0x18e330[_0x12cf('0x13')];this[_0x12cf('0x14')]=_0x18e330['starttime'];this[_0x12cf('0x15')]=_0x18e330[_0x12cf('0x15')];this[_0x12cf('0x16')]=_0x18e330['responsetime'];this[_0x12cf('0x17')]=getSeconds(_0x18e330[_0x12cf('0x15')],_0x18e330[_0x12cf('0x14')]);this[_0x12cf('0x18')]=0x0;this['talktime']=0x0;this['callback']=_0x18e330['callback'];this[_0x12cf('0x19')]=_0x18e330[_0x12cf('0x19')];this[_0x12cf('0x1a')]=_0x18e330['callbackat'];this[_0x12cf('0x1b')]=_0x18e330['recallme'];this[_0x12cf('0x1c')]=_0x18e330[_0x12cf('0x1c')];this[_0x12cf('0x1d')]=_0x18e330['ListId'];this[_0x12cf('0x1e')]=_0x18e330[_0x12cf('0x1e')];this['VoiceQueueId']=_0x18e330[_0x12cf('0x1f')];this[_0x12cf('0x20')]=_0x18e330[_0x12cf('0x20')];this['originatecalleridnum']=_0x18e330[_0x12cf('0x21')]||'';this[_0x12cf('0x22')]=_0x18e330[_0x12cf('0x22')]||'';}module[_0x12cf('0x23')]=History; \ No newline at end of file +var _0x1b13=['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','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','talktime'];(function(_0x145642,_0x3d2be5){var _0x5b67a5=function(_0x105e7d){while(--_0x105e7d){_0x145642['push'](_0x145642['shift']());}};_0x5b67a5(++_0x3d2be5);}(_0x1b13,0x16a));var _0x31b1=function(_0x13720f,_0x2ee470){_0x13720f=_0x13720f-0x0;var _0xe0cd91=_0x1b13[_0x13720f];return _0xe0cd91;};'use strict';var util=require(_0x31b1('0x0'));var _=require('lodash');var moment=require(_0x31b1('0x1'));function getSeconds(_0x1568ea,_0x4394b1){var _0x4b41f4=moment(_0x1568ea)[_0x31b1('0x2')](0x0);var _0x1e8479=moment(_0x4394b1)[_0x31b1('0x2')](0x0);return _0x4b41f4[_0x31b1('0x3')](_0x1e8479,_0x31b1('0x4'));}function History(_0x15f5c0){this[_0x31b1('0x5')]=_0x15f5c0[_0x31b1('0x5')];this['scheduledat']=_0x15f5c0[_0x31b1('0x6')]||undefined;this[_0x31b1('0x7')]=_0x15f5c0[_0x31b1('0x7')];this[_0x31b1('0x8')]=_0x15f5c0[_0x31b1('0x7')]===_0x31b1('0x9')?_0x31b1('0xa'):_0x15f5c0['type'];this[_0x31b1('0xb')]=_0x15f5c0[_0x31b1('0xb')];this[_0x31b1('0xc')]=_0x15f5c0['countcongestionretry'];this['countnoanswerretry']=_0x15f5c0[_0x31b1('0xd')];this[_0x31b1('0xe')]=_0x15f5c0[_0x31b1('0xb')]+_0x15f5c0[_0x31b1('0xc')]+_0x15f5c0['countnoanswerretry']+_0x15f5c0['countnosuchnumberretry']+_0x15f5c0['countdropretry']+_0x15f5c0[_0x31b1('0xf')]+_0x15f5c0[_0x31b1('0x10')]+_0x15f5c0[_0x31b1('0x11')];this['countnosuchnumberretry']=_0x15f5c0[_0x31b1('0x12')];this['countdropretry']=_0x15f5c0[_0x31b1('0x13')];this['countabandonedretry']=_0x15f5c0[_0x31b1('0xf')];this[_0x31b1('0x10')]=_0x15f5c0['countmachineretry'];this[_0x31b1('0x11')]=_0x15f5c0[_0x31b1('0x11')];this[_0x31b1('0xa')]=_0x15f5c0[_0x31b1('0xa')];this[_0x31b1('0x14')]=_0x15f5c0[_0x31b1('0x15')];this[_0x31b1('0x16')]=_0x15f5c0[_0x31b1('0x17')];this[_0x31b1('0x18')]=_0x15f5c0[_0x31b1('0x18')];this['responsetime']=_0x15f5c0[_0x31b1('0x19')];this[_0x31b1('0x1a')]=_0x15f5c0[_0x31b1('0x19')];this['ringtime']=getSeconds(_0x15f5c0[_0x31b1('0x19')],_0x15f5c0['starttime']);this['holdtime']=0x0;this[_0x31b1('0x1b')]=0x0;this[_0x31b1('0x1c')]=_0x15f5c0[_0x31b1('0x1c')];this['callbackuniqueid']=_0x15f5c0[_0x31b1('0x1d')];this['callbackat']=_0x15f5c0['callbackat'];this[_0x31b1('0x1e')]=_0x15f5c0[_0x31b1('0x1e')];this[_0x31b1('0x1f')]=_0x15f5c0[_0x31b1('0x1f')];this[_0x31b1('0x20')]=_0x15f5c0[_0x31b1('0x20')];this[_0x31b1('0x21')]=_0x15f5c0[_0x31b1('0x21')];this[_0x31b1('0x22')]=_0x15f5c0[_0x31b1('0x22')];this[_0x31b1('0x23')]=_0x15f5c0[_0x31b1('0x23')];this['originatecalleridnum']=_0x15f5c0[_0x31b1('0x24')]||'';this['originatecalleridname']=_0x15f5c0[_0x31b1('0x25')]||'';}module[_0x31b1('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index dcf5e74..7e3c70a 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 _0xa9e0=['reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countbusyretry','countnosuchnumberretry','countdropretry','stateGlobal','rescheduleContact','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','stateinterface','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','inspect','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','push','command','iftime\x20%s,%s','timezones','indexOf','true','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','reachable','map','syncCampaigns','checkIfTime','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','originate','voiceQueue\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','phone','variables','trim','substring','SIP/%s/%s%s','dialCutDigit','from-sip','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','[countReScheduled]\x20','emptyContact','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','RUNNING','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','p\x20=\x20','[abandonmentRate]','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','seconds','type','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','md5','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','uniqueId','[uniqueid]','clearZombieChannels','[actions]','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','statedesc','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var ut=require('../preview/util/util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerBooked=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var loggerPredictive=require('../../../config/logger')(_0x0a9e('0x8'));var loggerPredictiveCalls=require(_0x0a9e('0x5'))(_0x0a9e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':_0x0a9e('0xc'),'port':0x18eb});var io=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xb')]));var cmHopper=require(_0x0a9e('0xe'));var cmHopperHistory=require(_0x0a9e('0xf'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x0a9e('0x10'));var History=require(_0x0a9e('0x11'));var Final=require(_0x0a9e('0x12'));var AgentComplete=require(_0x0a9e('0x13'));var QueueCallerAbandon=require(_0x0a9e('0x14'));var Hangup=require(_0x0a9e('0x15'));var ipAgi=process['env'][_0x0a9e('0x16')]||_0x0a9e('0x17');var strategy={'rrmemory':_0x0a9e('0x18'),'roundrobin':_0x0a9e('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0a9e('0x1a')][_0x0a9e('0x1b')]=function(_0x52a03d){this[_0x0a9e('0x1c')]=this['tail']?this[_0x0a9e('0x1c')]['finally'](_0x52a03d):_0x52a03d();};function Dialer(_0x16033c,_0x12066b){this['sequence']=new Sequence();this[_0x0a9e('0x1d')]=_0x12066b;this['voiceQueues']=_0x16033c[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x16033c[_0x0a9e('0x1f')];this[_0x0a9e('0x20')]=_0x16033c[_0x0a9e('0x20')];this[_0x0a9e('0x21')]=_0x16033c[_0x0a9e('0x21')];this[_0x0a9e('0x22')]=config[_0x0a9e('0x22')]||0x2;this[_0x0a9e('0x23')]={};this[_0x0a9e('0x24')]={};this[_0x0a9e('0x25')]={};this['uniqueId']={};this[_0x0a9e('0x26')]={};this[_0x0a9e('0x27')]={};this['startProgressive']={};this[_0x0a9e('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x0a9e('0x29'),this[_0x0a9e('0x2a')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2c'),this['syncQueueCallerAbandon'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2d'),this[_0x0a9e('0x2e')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2f'),this[_0x0a9e('0x30')][_0x0a9e('0x2b')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x31'),this[_0x0a9e('0x32')][_0x0a9e('0x2b')](this));ami['on']('hangup',this[_0x0a9e('0x33')]['bind'](this));ami['on'](_0x0a9e('0x34'),this['syncNewExten'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x35'),this[_0x0a9e('0x36')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x37'),this[_0x0a9e('0x38')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x39'),this['syncQueueStatusComplete'][_0x0a9e('0x2b')](this));this[_0x0a9e('0x3a')]();this[_0x0a9e('0x3b')]();RpcSetting[_0x0a9e('0x3c')]()['then'](function(_0x15b200){previewRecallmeReminderInterval=_0x15b200[_0x0a9e('0x3d')];});}function isNotNull(_0x1843b2){return _0x1843b2!==null&&!_[_0x0a9e('0x3e')](_0x1843b2);}function checkIsLoggedIn(_0x58b06f,_0x563b45){return function(){if(_0x563b45<=0x0){_0x58b06f[_0x0a9e('0x3f')]=_0x0a9e('0x40');throw _0x58b06f[_0x0a9e('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x426950){return _0x426950;}function checkIsActive(_0x5d1e0e,_0x2407f9){return function(){if(!isActive(_0x2407f9)){_0x5d1e0e[_0x0a9e('0x3f')]=_0x0a9e('0x42');throw _0x5d1e0e[_0x0a9e('0x41')]+_0x0a9e('0x43');}};}function checkInterval(_0x5180f1){return function(){if(!isNotNull(_0x5180f1[_0x0a9e('0x44')])){_0x5180f1[_0x0a9e('0x3f')]=_0x0a9e('0x45');throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}if(!isNotNull(_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')])){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0a9e('0x48')](_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')]))){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}};}function msgResponse(_0x1fa90d,_0x15de0e,_0x4853b1){return{'action':_0x1fa90d,'response':_0x15de0e,'message':_0x4853b1,'stack':_0x4853b1};}function myreject(_0x54135e){return function(_0x1e8694){return _0x54135e(msgResponse('[ifTime][Action]',_0x0a9e('0x49'),JSON[_0x0a9e('0x4a')](_0x1e8694)));};}function getSeconds(_0x381c37,_0x1ef87a){var _0x4f41ae=moment(_0x381c37)[_0x0a9e('0x4b')](0x0);var _0x3bfce8=moment(_0x1ef87a)[_0x0a9e('0x4b')](0x0);return _0x4f41ae['diff'](_0x3bfce8,_0x0a9e('0x4c'));}function emit(_0x1a180b,_0x289467,_0x4c1c0e){io['to'](_0x1a180b)['emit'](_0x289467,_0x4c1c0e);}function emitVoiceQueueSummary(_0x11b61d){if(_0x11b61d[_0x0a9e('0x4d')]==='outbound'){var _0x2b814e={'id':_0x11b61d['id'],'name':_0x11b61d[_0x0a9e('0x41')],'strategy':_0x11b61d[_0x0a9e('0x4e')],'answered':_0x11b61d[_0x0a9e('0x4f')],'available':_0x11b61d['available'],'loggedIn':_0x11b61d['loggedIn'],'pTalking':_0x11b61d[_0x0a9e('0x50')],'sumBillable':_0x11b61d[_0x0a9e('0x51')],'sumDuration':_0x11b61d['sumDuration'],'sumHoldTime':_0x11b61d[_0x0a9e('0x52')]||0x0,'talking':_0x11b61d[_0x0a9e('0x53')],'total':_0x11b61d[_0x0a9e('0x54')],'type':_0x11b61d['type'],'unmanaged':_0x11b61d[_0x0a9e('0x55')],'abandoned':_0x11b61d[_0x0a9e('0x56')],'waiting':_0x11b61d[_0x0a9e('0x57')],'loggedInDb':_0x11b61d[_0x0a9e('0x58')],'dialActive':_0x11b61d[_0x0a9e('0x59')],'dialMethod':_0x11b61d[_0x0a9e('0x5a')],'dialOriginateCallerIdName':_0x11b61d[_0x0a9e('0x5b')],'dialOriginateCallerIdNumber':_0x11b61d[_0x0a9e('0x5c')],'dialOriginateTimeout':_0x11b61d[_0x0a9e('0x5d')],'dialPrefix':_0x11b61d[_0x0a9e('0x5e')],'outboundAnswerAgiCallsDay':_0x11b61d[_0x0a9e('0x5f')],'outboundAnswerCallsDay':_0x11b61d[_0x0a9e('0x60')],'outboundBlacklistCallsDay':_0x11b61d[_0x0a9e('0x61')],'outboundBusyCallsDay':_0x11b61d[_0x0a9e('0x62')],'outboundCongestionCallsDay':_0x11b61d[_0x0a9e('0x63')],'outboundDropCallsDayACS':_0x11b61d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x11b61d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x11b61d[_0x0a9e('0x64')],'outboundNoAnswerCallsDay':_0x11b61d[_0x0a9e('0x65')],'outboundNoSuchCallsDay':_0x11b61d[_0x0a9e('0x66')],'outboundOriginateFailureCallsDay':_0x11b61d[_0x0a9e('0x67')],'outboundReCallsDay':_0x11b61d[_0x0a9e('0x68')],'outboundRejectCallsDay':_0x11b61d[_0x0a9e('0x69')],'outboundUnknownCallsDay':_0x11b61d[_0x0a9e('0x6a')],'predictiveIntervalAnsweredCalls':_0x11b61d[_0x0a9e('0x6b')],'predictiveIntervalAvgHoldtime':_0x11b61d[_0x0a9e('0x6c')],'predictiveIntervalAvgTalktime':_0x11b61d[_0x0a9e('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x11b61d[_0x0a9e('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x11b61d[_0x0a9e('0x6f')],'predictiveIntervalErlangCalls':_0x11b61d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x11b61d[_0x0a9e('0x70')],'predictiveIntervalHitRate':_0x11b61d[_0x0a9e('0x71')],'predictiveIntervalMultiplicativeFactor':_0x11b61d[_0x0a9e('0x72')],'predictiveIntervalPauses':_0x11b61d[_0x0a9e('0x73')],'predictiveIntervalAvailable':_0x11b61d[_0x0a9e('0x74')],'predictiveIntervalTotalCalls':_0x11b61d[_0x0a9e('0x75')],'message':_0x11b61d[_0x0a9e('0x3f')],'originated':_0x11b61d[_0x0a9e('0x76')],'erlangCalls':_0x11b61d['erlangCalls'],'erlangCallToSecond':_0x11b61d[_0x0a9e('0x77')],'erlangAbandonmentRate':_0x11b61d['erlangAbandonmentRate'],'erlangBusyFactor':_0x11b61d[_0x0a9e('0x78')],'startPredictive':_0x11b61d[_0x0a9e('0x27')],'startProgressive':_0x11b61d[_0x0a9e('0x79')]};if(_0x11b61d['Trunk']){_0x2b814e[_0x0a9e('0x7a')]={'id':_0x11b61d[_0x0a9e('0x7a')]['id'],'name':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x41')],'active':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x7b')],'callerid':_0x11b61d[_0x0a9e('0x7a')]['callerid']};}if(_0x11b61d[_0x0a9e('0x44')]){_0x2b814e[_0x0a9e('0x44')]={'id':_0x11b61d[_0x0a9e('0x44')]['id'],'name':_0x11b61d[_0x0a9e('0x44')][_0x0a9e('0x41')]};}var _0x992c77=md5(JSON[_0x0a9e('0x4a')](_0x2b814e));if(_0x11b61d[_0x0a9e('0x7c')]!==_0x992c77){_0x11b61d[_0x0a9e('0x7c')]=_0x992c77;emit(util['format'](_0x0a9e('0x7d'),_0x2b814e[_0x0a9e('0x41')]),'voice_queue:save',_0x2b814e);}}}function emitCampaignSummary(_0x4ae14b){if(_0x4ae14b['type']===_0x0a9e('0x7e')){emit(util[_0x0a9e('0x7f')](_0x0a9e('0x80'),_0x4ae14b[_0x0a9e('0x41')]),_0x0a9e('0x81'),_0x4ae14b);}}function checkGetDataPredictive(_0x30decb){if(isNotNull(_0x30decb)&&!_[_0x0a9e('0x48')](_0x30decb)){loggerPredictive[_0x0a9e('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x75')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x83'),_0x30decb['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x84'),_0x30decb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x0a9e('0x85'),_0x30decb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x0a9e('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x6c')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x86'),_0x30decb['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));if(_0x30decb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6d')])&&_0x30decb[_0x0a9e('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0x0a9e('0x88'));if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6c')])&&_0x30decb['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0a9e('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0a9e('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2f7092){return function(_0x65432){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x89'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8a'),_0x65432[_0x0a9e('0x8b')]);loggerPredictive[_0x0a9e('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x65432[_0x0a9e('0x77')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432[_0x0a9e('0x8d')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8e'),_0x65432['erlangBusyFactor']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432['erlangAbandonmentRate']);loggerPredictive[_0x0a9e('0x82')]('---------------------------');_[_0x0a9e('0x8f')](_0x2f7092,_0x65432);};}function getDiff(_0x5ba1f9){var _0x4b3c1a=moment()['milliseconds'](0x0);var _0x273cb5=moment(_0x5ba1f9)['milliseconds'](0x0);return _0x4b3c1a[_0x0a9e('0x90')](_0x273cb5,_0x0a9e('0x4c'));}function ifInterval(_0x261adb,_0x7be420){if(_[_0x0a9e('0x3e')](_0x7be420)){return![];}return getDiff(_0x7be420)<_0x261adb*0x3c;}function freeVariablesPredictive(_0x26d7db){if(isNotNull(_0x26d7db)){if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x79')])){_0x26d7db['startProgressive']=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x91'));}if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x27')])){_0x26d7db[_0x0a9e('0x27')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0a9e('0x3e')](_0x26d7db[_0x0a9e('0x92')])){clearInterval(_0x26d7db['handlePredictive']);_0x26d7db[_0x0a9e('0x92')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x93'));}}}function erlangb(_0x401837,_0x4d4a35){if(_0x4d4a35===0x0){return 0x0;}var _0x176840=0x1;for(var _0x2937e0=0x1;_0x2937e0<=_0x4d4a35;_0x2937e0+=0x1){_0x176840=0x1+_0x176840*_0x2937e0/_0x401837;}return 0x1/_0x176840;}function isVoiceQueueOutbound(_0x281c7d){return _0x281c7d==='outbound';}function isNotPreview(_0x3528b7){return _0x3528b7!=='preview';}function isCampaignIvr(_0x5211e3){return _0x5211e3===_0x0a9e('0x7e');}function getCallerId(_0x4556c5,_0x9375fb,_0x19c995){if(!_[_0x0a9e('0x3e')](_0x19c995)&&typeof _0x19c995===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x19c995)){if(!_[_0x0a9e('0x3e')](_0x9375fb)&&typeof _0x9375fb===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x9375fb)){return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x9375fb,_0x19c995);}return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x19c995,_0x19c995);}if(!_[_0x0a9e('0x3e')](_0x4556c5)&&typeof _0x4556c5===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x4556c5)){return _0x4556c5;}return _0x0a9e('0x96');}function loggerCatchQueueSummary(_0x5150a4,_0x1b0b98){return function(_0x295763){freeVariablesPredictive(_0x1b0b98);emitVoiceQueueSummary(_0x1b0b98);emitCampaignSummary(_0x1b0b98);loggerSyncQueueSummary[_0x0a9e('0x97')](_0x5150a4,util['inspect'](_0x295763,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1148a1,_0x30944e){return function(_0x4b341d){loggerPredictive[_0x0a9e('0x98')](_0x30944e[_0x0a9e('0x41')],_0x1148a1);loggerPredictive[_0x0a9e('0x98')](_0x4b341d[_0x0a9e('0x99')]);freeVariablesPredictive(_0x30944e);};}function loggerCatch(_0x13b5c0){return function(_0x4a43a8){logger['error'](_0x13b5c0,util['inspect'](_0x4a43a8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x40fb85){return _0x40fb85&&!_[_0x0a9e('0x3e')](_0x40fb85)&&_0x40fb85[_0x0a9e('0x9a')]>0x0;}function decremetOriginate(_0x23a7d3){if(!_[_0x0a9e('0x3e')](_0x23a7d3)&&_0x23a7d3!==null){if(typeof _0x23a7d3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x23a7d3[_0x0a9e('0x76')]>0x0){_0x23a7d3['originated']-=0x1;}else{logger[_0x0a9e('0x98')](_0x0a9e('0x9c'));}}}else{logger[_0x0a9e('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2bdc44,_0x583b2e,_0x4437ff){if(_0x583b2e>_0x4437ff){for(var _0x44351d=0x0;_0x44351d<_0x583b2e-_0x4437ff;_0x44351d+=0x1){decremetOriginate(_0x2bdc44);}}}function loggerGetContactDialer(_0x4c46c1,_0x2ed01e,_0x75912a){return function(_0x2cc7a7){checkContactLowerLimitOriginate(_0x2ed01e,_0x75912a,0x0);logger[_0x0a9e('0x98')](_0x4c46c1,util['inspect'](_0x2cc7a7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d442c){return function(_0x2e9552){if(isNotNull(_0x2e9552)&&isNotNull(_0x2e9552[0x0])){if(_0x2e9552[0x0][_0x0a9e('0x9d')]>0x0){_0x1d442c[_0x0a9e('0x3f')]='RESCHEDULED_CONTACTS';logger[_0x0a9e('0x82')](_0x0a9e('0x9e')+_0x1d442c[_0x0a9e('0x41')],_0x2e9552[0x0][_0x0a9e('0x9d')],'contacts');}else{_0x1d442c[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger[_0x0a9e('0x82')](_0x0a9e('0xa0')+_0x1d442c[_0x0a9e('0x41')]);}}};}function notSendMessagesQueue(_0xdb98ca){if(_0xdb98ca[_0x0a9e('0xa1')]){freeVariablesPredictive(_0xdb98ca);if(_0xdb98ca[_0x0a9e('0x76')]===0x0&&_0xdb98ca[_0x0a9e('0x53')]===0x0&&_0xdb98ca[_0x0a9e('0x57')]===0x0&&(_0xdb98ca[_0x0a9e('0x50')]||0x0)===0x0){_0xdb98ca[_0x0a9e('0xa1')]=![];_0xdb98ca[_0x0a9e('0xa2')]=0x0;_0xdb98ca[_0x0a9e('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca[_0x0a9e('0x41')],'is\x20not\x20active');}else{_0xdb98ca[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca['name'],'is\x20disactive');}emitVoiceQueueSummary(_0xdb98ca);}}function notSendMessagesCampaign(_0x7ebea8){if(_0x7ebea8[_0x0a9e('0xa1')]){if(_0x7ebea8['originated']===0x0){_0x7ebea8[_0x0a9e('0xa1')]=![];_0x7ebea8['message']=_0x0a9e('0x42');loggerSyncQueueSummary[_0x0a9e('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x7ebea8[_0x0a9e('0x41')],_0x0a9e('0xa5'));}else{_0x7ebea8[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa6'),_0x7ebea8[_0x0a9e('0x41')],'is\x20disactive');}emitCampaignSummary(_0x7ebea8);}}function createObjHistory(_0x2973d3,_0x3ca9b9,_0x45c109,_0x16e5b9,_0x492543){_0x2973d3[_0x0a9e('0x3f')]=_0x45c109;var _0xf0db1=new Action(_0x2973d3,_0x3ca9b9);var _0x4bf3a5=new History(_0xf0db1);_0x4bf3a5[_0x0a9e('0xa7')]=_0x16e5b9;_0x4bf3a5['statedesc']=_0x492543;_0x4bf3a5[_0x0a9e('0xa8')]=_0xf0db1[_0x0a9e('0xa9')];return _0x4bf3a5;}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x3b')]=function(){var _0x5af453=this;setInterval(function(){_0x5af453['clearZombieChannels'](_0x5af453[_0x0a9e('0xaa')],_0x0a9e('0xab'));_0x5af453[_0x0a9e('0xac')](_0x5af453['actions'],_0x0a9e('0xad'));},0x32c8);};Dialer[_0x0a9e('0x1a')]['clearZombieChannels']=function(_0x4e46b2,_0xf0a802){var _0x56acca=this;for(var _0x5ea541 in _0x4e46b2){if(typeof _0x4e46b2[_0x5ea541]!=='undefined'){this[_0x0a9e('0xae')][_0x0a9e('0x1b')](function(){if(!_[_0x0a9e('0xaf')](_0x4e46b2[_0x5ea541])){return ami[_0x0a9e('0xb0')]({'action':_0x0a9e('0xb1'),'channel':_0x4e46b2[_0x5ea541][_0x0a9e('0xb2')]})['catch'](function(_0x5fd5db){if(_0x5fd5db['message']===_0x0a9e('0xb3')){setTimeout(function(){if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca['voiceQueues'][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb6'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541]['queue']);delete _0x4e46b2[_0x5ea541];}if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]===_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca[_0x0a9e('0x1f')][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb7'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]);delete _0x4e46b2[_0x5ea541];}},0x2328);}});}});}}};Dialer['prototype'][_0x0a9e('0xb8')]=function(_0x3325c5){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xb8')](_0x3325c5))[_0x0a9e('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0a9e('0x1a')]['checkIsBlackList']=function(_0x8c8fbe){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack[_0x0a9e('0xbc')](_0x8c8fbe))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbd')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xbe')]=function(_0x501050,_0x329d88,_0x31d25a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperAdditionalPhone[_0x0a9e('0xbe')](_0x501050,_0x329d88,_0x31d25a))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbf')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc0')]=function(_0x31af8c,_0x151956,_0x3754e2){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperAdditionalPhone[_0x0a9e('0xc0')](_0x31af8c,_0x151956,_0x3754e2))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xc1')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc2')]=function(_0x5d9ddb){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack['checkIsBlackListIvr'](_0x5d9ddb))[_0x0a9e('0xba')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc3')]=function(_0x1d93b1){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperHistory[_0x0a9e('0xc4')](_0x1d93b1))['catch'](loggerCatch(_0x0a9e('0xc5')));};Dialer[_0x0a9e('0x1a')]['rescheduleContact']=function(_0x231c6a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['rescheduleContact'](_0x231c6a))['catch'](loggerCatch(_0x0a9e('0xc6')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc7')]=function(_0x413190,_0x3f2f40,_0x2450a8){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc7')](_0x413190,_0x3f2f40,_0x2450a8))['catch'](loggerCatch(_0x0a9e('0xc8')));};Dialer['prototype'][_0x0a9e('0xc9')]=function(_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5,_0x4e7273){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc9')](_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5))[_0x0a9e('0xba')](function(_0x2263f1){_0x4e7273['temp']-=_0x28ce92;_0x4e7273['temp']=_0x4e7273[_0x0a9e('0xca')]>0x0?_0x4e7273['temp']:0x0;loggerCatch(_0x0a9e('0xcb'))(_0x2263f1);});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcc')]=function(_0x16313e,_0x2ad54b,_0x213e5d,_0x596312){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper['getContactDialerIvr'](_0x16313e,_0x2ad54b,_0x213e5d))[_0x0a9e('0xba')](function(_0x5c689c){_0x596312[_0x0a9e('0xca')]-=_0x2ad54b;_0x596312['temp']=_0x596312['temp']>0x0?_0x596312[_0x0a9e('0xca')]:0x0;loggerCatch(_0x0a9e('0xcd'))(_0x5c689c);});};Dialer['prototype'][_0x0a9e('0xce')]=function(_0x17cb30){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](voiceQueueRt[_0x0a9e('0xce')](_0x17cb30))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcf')]=function(_0x41c8cd){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['moveContactManagedDialer'](_0x41c8cd))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd0')));};Dialer['prototype'][_0x0a9e('0xd1')]=function(_0x19fd11){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperHistory[_0x0a9e('0xd1')](_0x19fd11))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd2')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xb4')]=function(_0x16afb3){if(!_['isUndefined'](_0x16afb3)&&_0x16afb3!==null){if(typeof _0x16afb3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x16afb3[_0x0a9e('0x76')]>0x0){_0x16afb3[_0x0a9e('0x76')]-=0x1;}else{logger[_0x0a9e('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0a9e('0xd3'));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd4')]=function(_0x2fea95,_0x34f7b5){var _0x59e46f=this;return function(_0x1339d0){_0x59e46f[_0x0a9e('0xb4')](_0x34f7b5);logger[_0x0a9e('0x98')](_0x2fea95,util['inspect'](_0x1339d0,{'showHidden':![],'depth':null}));};};Dialer[_0x0a9e('0x1a')]['emptyContact']=function(_0x2144ca,_0x4799d4,_0x25b745){var _0x42b833={'state':0x19,'statedesc':_0x0a9e('0xd5')};this['updateOriginated'](_0x4799d4);this[_0x0a9e('0xd6')](_['merge'](_0x42b833,_[_0x0a9e('0xd7')](_0x25b745,[_0x0a9e('0xd8'),_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x0a9e('0xdc')])),_0x0a9e('0xdd'),_0x0a9e('0xde'));logger[_0x0a9e('0x98')](_0x2144ca);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xdf')]=function(_0xc876d4){return _0xc876d4===_0x0a9e('0xe0');};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xe1')]=function(_0x248368){return!_['isUndefined'](_0x248368)&&_0x248368&&!_['isUndefined'](_0x248368[_0x0a9e('0x41')])&&!_['isUndefined'](_0x248368[_0x0a9e('0x7b')])&&_0x248368[_0x0a9e('0x7b')]&&(this['trunks'][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])][_0x0a9e('0xb1')]==='reachable'||this[_0x0a9e('0x21')][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])]['status']===_0x0a9e('0xe3'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd6')]=function(_0x5c838b,_0x2650eb,_0x270df8){this[_0x0a9e('0xd1')](_0x5c838b)['catch'](loggerCatch(_0x2650eb));this[_0x0a9e('0xcf')](_0x5c838b)[_0x0a9e('0xba')](loggerCatch(_0x270df8));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x36')]=function(_0x2394d3){var _0x555780=this;var _0x3211d2=this[_0x0a9e('0xaa')][_0x2394d3['uniqueid']];var _0x3bab3e;if(!_[_0x0a9e('0xaf')](_0x2394d3)&&!_[_0x0a9e('0xaf')](_0x2394d3['variable'])&&!_['isNil'](_0x2394d3['variable'][_0x0a9e('0xe4')])&&_0x2394d3[_0x0a9e('0xe5')]==='xcally-motion-dialer'&&_0x3211d2){if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xe8')){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0x60')]+=0x1;this['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e[_0x0a9e('0xea')]=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]='AMD';ami[_0x0a9e('0xed')](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0xf1'),_0x0a9e('0xf2'));}if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x3539b7,_0x57f0ad){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780[_0x0a9e('0xb4')](_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x1a9ef1=_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]];var _0x41e446=new Hangup(_0x3211d2,_0x2394d3);_0x41e446[_0x0a9e('0xa7')]=0x13;_0x41e446[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0x41e446[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0x41e446[_0x0a9e('0xf6')]+=0x1;_0x41e446[_0x0a9e('0xf7')]+=0x1;_0x41e446[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x41e446,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0x41e446)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x41e446['countbusyretry']+_0x41e446[_0x0a9e('0xf9')]+_0x41e446['countnoanswerretry']+_0x41e446['countnosuchnumberretry']+_0x41e446['countdropretry']+_0x41e446[_0x0a9e('0xfa')]+_0x41e446[_0x0a9e('0xf6')]+_0x41e446[_0x0a9e('0xfb')]>=_0x1a9ef1[_0x0a9e('0xfc')]){_0x555780['stateGlobal'](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0xfd'));}else{if(_0x41e446[_0x0a9e('0xf6')]>=_0x1a9ef1[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0x100'));}else{_0x555780['rescheduleContact']({'active':![],'countmachineretry':_0x41e446['countmachineretry'],'scheduledat':moment()[_0x0a9e('0x101')](_0x1a9ef1[_0x0a9e('0x102')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x41e446[_0x0a9e('0xd8')],'ListId':_0x41e446[_0x0a9e('0xd9')],'VoiceQueueId':_0x41e446['VoiceQueueId']||undefined,'CampaignId':_0x41e446[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x3539b7({'reschedule':0x1});}}});}if(_0x3211d2['type']===_0x0a9e('0x7e')&&this[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]['dialAMDActive']&&_0x2394d3['value']==='HANGUP'){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1f')][_0x3211d2['queue']]);_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e['statedesc']=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]=_0x0a9e('0xf5');ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0x106'),'[syncHangupInAMDIvr]');}if(_0x3211d2[_0x0a9e('0x4d')]==='ivr'&&this[_0x0a9e('0x1f')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x10ace8,_0x1e306c){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780['updateOriginated'](_0x555780[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x16b578=_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]];var _0xf49ed4=new Hangup(_0x3211d2,_0x2394d3);_0xf49ed4[_0x0a9e('0xa7')]=0x13;_0xf49ed4[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0xf49ed4[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0xf49ed4[_0x0a9e('0xf6')]+=0x1;_0xf49ed4[_0x0a9e('0xf7')]+=0x1;_0xf49ed4[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut['buildObj'](_0xf49ed4,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0xf49ed4)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0xf49ed4[_0x0a9e('0x107')]+_0xf49ed4[_0x0a9e('0xf9')]+_0xf49ed4['countnoanswerretry']+_0xf49ed4[_0x0a9e('0x108')]+_0xf49ed4[_0x0a9e('0x109')]+_0xf49ed4[_0x0a9e('0xfa')]+_0xf49ed4['countmachineretry']+_0xf49ed4[_0x0a9e('0xfb')]>=_0x16b578[_0x0a9e('0xfc')]){_0x555780[_0x0a9e('0x10a')](_0xf49ed4,_0x10ace8,_0x1e306c,_0x0a9e('0xfd'));}else{if(_0xf49ed4[_0x0a9e('0xf6')]>=_0x16b578[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0xf49ed4,_0x10ace8,_0x1e306c,'reason\x2019\x20machine....');}else{_0x555780[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0xf49ed4[_0x0a9e('0xf6')],'scheduledat':moment()[_0x0a9e('0x101')](_0x16b578[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0xf49ed4['ContactId'],'ListId':_0xf49ed4['ListId'],'VoiceQueueId':_0xf49ed4[_0x0a9e('0xdb')]||undefined,'CampaignId':_0xf49ed4[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x10ace8({'reschedule':0x1});}}});}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x33')]=function(_0x609711){var _0x584854=this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];var _0x2d8e91;if(_0x584854&&_0x584854[_0x0a9e('0x4d')]===_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];this['updateOriginated'](this[_0x0a9e('0x1f')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1f')][_0x584854['queue']][_0x0a9e('0x10c')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this['moveContactManagedDialer'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this[_0x0a9e('0xaa')][_0x609711['uniqueid']];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0x10;_0x2d8e91[_0x0a9e('0xea')]=_0x0a9e('0x110');_0x2d8e91['membername']=_0x0a9e('0x111');this['createHistory'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x2d8e91)['catch'](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&!isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this['uniqueId'][_0x609711[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x6a')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0xc;_0x2d8e91['statedesc']=_0x609711[_0x0a9e('0x112')];_0x2d8e91['membername']=_0x0a9e('0x113');this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this[_0x0a9e('0xcf')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0a9e('0x1a')]['syncAgentComplete']=function(_0x50e32a){var _0x504403=this['uniqueId'][_0x50e32a[_0x0a9e('0xe9')]];if(this['voiceQueues'][_0x50e32a['queue']]){if(_0x504403&&_0x504403[_0x0a9e('0x4d')]!=='ivr'){delete this[_0x0a9e('0xaa')][_0x50e32a[_0x0a9e('0xe9')]];this[_0x0a9e('0x1e')][_0x50e32a['queue']][_0x0a9e('0x60')]+=0x1;var _0x1209c4=new AgentComplete(_0x504403,_0x50e32a);if(_0x50e32a[_0x0a9e('0x114')]==='agent'){_0x1209c4['agiafterat']=this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x115')]&&this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x116')]?moment()[_0x0a9e('0x7f')](_0x0a9e('0x104')):undefined;}this[_0x0a9e('0xd1')](_0x1209c4)[_0x0a9e('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1209c4)['catch'](loggerCatch(_0x0a9e('0x117')));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x2a')]=function(_0x2d21c7){if(this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]){if(this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]]&&this['uniqueId'][_0x2d21c7['uniqueid']][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){this['updateOriginated'](this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]);this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]][_0x0a9e('0x118')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x119')]=function(_0x400800,_0xbd1af3){this[_0x0a9e('0xd1')](_0x400800)['catch'](loggerCatch(_0x0a9e('0x11a')));if(_0xbd1af3==0x0){this[_0x0a9e('0xcf')](_0x400800)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x11b')));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x11c')]=function(_0x292e67){var _0x23bec3=this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];var _0x6b048e=this;var _0x3ba472=![];var _0x4e6eb9;var _0x572a72;if(this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]){if(_0x23bec3&&_0x23bec3[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]);_0x23bec3['droptime']=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0x1e9f9f=new QueueCallerAbandon(_0x23bec3,_0x292e67);if(getSeconds(_0x23bec3[_0x0a9e('0x11d')],_0x23bec3[_0x0a9e('0x11e')])>=_0x23bec3[_0x0a9e('0x11f')]){this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x6f')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x64')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x70')]+=0x1;_0x1e9f9f[_0x0a9e('0xa7')]=0xa;_0x1e9f9f['statedesc']='Drop';_0x1e9f9f[_0x0a9e('0x120')]=_0x0a9e('0x121');_0x1e9f9f['agiafterat']=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x115')]?moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1e9f9f[_0x0a9e('0x109')]+=0x1;_0x1e9f9f['countglobal']+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']][_0x0a9e('0x122')];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f['state'],_0x23bec3[_0x0a9e('0x124')])['then'](function(_0x505ffd){_0x3ba472=_0x505ffd[_0x0a9e('0x125')]==0x1;if(_0x1e9f9f[_0x0a9e('0x109')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x126')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x505ffd[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countdropretry':_0x1e9f9f[_0x0a9e('0x109')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x122')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));var _0x543b30=new History(_0x1e9f9f);_0x543b30[_0x0a9e('0xa7')]=0xa;_0x543b30['statedesc']='Drop';_0x543b30['starttime']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x543b30[_0x0a9e('0xa8')]=_0x543b30[_0x0a9e('0xa9')];_0x543b30[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x543b30[_0x0a9e('0x129')]=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x543b30)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12a')));}})[_0x0a9e('0xb9')](function(){if(_0x3ba472)_0x6b048e['swapAdditionalPhones'](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}else{this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12b')]+=0x1;_0x1e9f9f['state']=0xb;_0x1e9f9f[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x1e9f9f['dropreason']='CALLEREXIT';_0x1e9f9f[_0x0a9e('0xfa')]+=0x1;_0x1e9f9f[_0x0a9e('0xf7')]+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']]['dialAbandonedRetryFrequency'];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f[_0x0a9e('0xa7')],_0x23bec3[_0x0a9e('0x124')])[_0x0a9e('0xb9')](function(_0x183b9b){if(_0x1e9f9f[_0x0a9e('0xfa')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12d')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x183b9b[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x1e9f9f[_0x0a9e('0xfa')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]['dialAbandonedRetryFrequency'],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12e')));var _0x3a14d7=new History(_0x1e9f9f);_0x3a14d7[_0x0a9e('0xa7')]=0xb;_0x3a14d7[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x3a14d7[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x3a14d7['endtime']=_0x3a14d7['starttime'];_0x3a14d7[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x3a14d7['calleridnum']=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x3a14d7)['catch'](loggerCatch(_0x0a9e('0x12f')));}})['then'](function(){if(_0x3ba472)_0x6b048e[_0x0a9e('0xc0')](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x0a9e('0x130')]=function(_0x31ab12){if(this['actions'][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0x24')][_0x31ab12['uniqueid']][_0x0a9e('0xb2')]=_0x31ab12[_0x0a9e('0xb2')];}if(this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]['channel']=_0x31ab12[_0x0a9e('0xb2')];}};Dialer[_0x0a9e('0x1a')]['syncQueueMember']=function(_0x3d63aa){if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x3d63aa['actionid']]&&_['isNil'](this['actions'][_0x3d63aa['actionid']][_0x0a9e('0x132')])&&_0x3d63aa[_0x0a9e('0xb1')]==='1'&&_0x3d63aa['paused']==='0'){if(this['agents'][_0x3d63aa[_0x0a9e('0x133')]]){if(!this['agents'][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]){this[_0x0a9e('0x20')][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x133')]=_0x3d63aa[_0x0a9e('0x133')];}}}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]||'rrmemory')===_0x0a9e('0x18')){if(this['actions'][_0x3d63aa[_0x0a9e('0x131')]]){if(this[_0x0a9e('0x20')][_0x3d63aa['stateinterface']]){this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]]['stateinterface']=_0x3d63aa[_0x0a9e('0x133')];if(_['isNil'](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0xb5')]])){this['queueBooked'][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]=[];}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['push'](_[_0x0a9e('0x8f')](_[_0x0a9e('0xd7')](this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]],[_0x0a9e('0x135'),'stateinterface']),{'status':_0x3d63aa[_0x0a9e('0xb1')],'paused':_0x3d63aa['paused']}));}}}};function unlockQueueStatus(_0x5d1159,_0x3a459c){setTimeout(function(){if(_['isUndefined'](_0x5d1159[_0x0a9e('0x136')])){loggerBooked[_0x0a9e('0x98')]('[unlockQueueStatus][undefined]',_0x3a459c);}_0x5d1159[_0x0a9e('0x136')]=!![];loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x137'),_0x3a459c,JSON[_0x0a9e('0x4a')](_[_0x0a9e('0xd7')](_0x5d1159,[_0x0a9e('0x41'),_0x0a9e('0x136')])));},0x1f3);}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x138')]=function(_0x5871d7){var _0x26f1c6=this;var _0x421b6c=_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]];if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]){this[_0x0a9e('0x1d')][_0x0a9e('0x139')](this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x135')],this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')])[_0x0a9e('0xba')](function(_0x14444e){logger[_0x0a9e('0x98')](_0x0a9e('0x13a'),util[_0x0a9e('0x13b')](_0x14444e,{'showHidden':![],'depth':null}));})[_0x0a9e('0x13c')](function(){_0x26f1c6[_0x0a9e('0xb4')](_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]);_0x26f1c6[_0x0a9e('0x20')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]][_0x0a9e('0x132')]=![];delete _0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]];unlockQueueStatus(_0x421b6c);});}else{this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]);this[_0x0a9e('0x10b')]({'active':![],'ContactId':this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xd8')],'ListId':this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xd9')],'VoiceQueueId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdb')]||undefined,'CampaignId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x13d')));delete this[_0x0a9e('0x24')][_0x5871d7['actionid']];unlockQueueStatus(_0x421b6c);}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']][_0x0a9e('0x4e')]]||_0x0a9e('0x18'))===_0x0a9e('0x18')){var _0x1bf053;if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&!_[_0x0a9e('0x48')](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']])){if(this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]){this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']]['queue']]=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]?this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]:this['queueBooked'][this['actions'][_0x5871d7[_0x0a9e('0x131')]]['queue']]?this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['_rr']||0x0:0x0;}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]['_rr']=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]];for(var _0x223e19=0x0;_0x223e19=0x0;})[_0x0a9e('0xba')](myreject(_0x1e30bc)));}}else{_0x1ebf20[_0x0a9e('0x150')](ami[_0x0a9e('0xb0')]({'action':'command','command':util[_0x0a9e('0x7f')](_0x0a9e('0x152'),_0x4ad6fc,!_[_0x0a9e('0x3e')](config['timezones'][_0xaa43da])?_0xaa43da:'')})[_0x0a9e('0xb9')](function(_0x4f8949){return _0x4f8949[_0x0a9e('0x156')][_0x0a9e('0x154')](_0x0a9e('0x155'))>=0x0;})['catch'](myreject(_0x1e30bc)));}Promise[_0x0a9e('0x157')](_0x1ebf20)[_0x0a9e('0xb9')](function(_0x310f89){var _0x1ecb3b=_[_0x0a9e('0x158')](_0x310f89);if(_0x1ecb3b){return _0xcdd954(_0x1ecb3b);}else{_0x2bc6a3[_0x0a9e('0x3f')]=_0x5174c5?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0a9e('0x159');return _0x1e30bc(msgResponse(_0x0a9e('0x15a'),_0x0a9e('0x14c'),_0x0a9e('0x15b')+_0x5174c5+'\x20'+_0x2ee2fc+_0x0a9e('0x15c')+util[_0x0a9e('0x13b')](_0x4ad6fc,{'showHidden':![],'depth':null})+_0x0a9e('0x15d')+_0xaa43da));}})[_0x0a9e('0xba')](function(_0x597e99){return _0x1e30bc(msgResponse(_0x0a9e('0x14a'),_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0x597e99)));});});};Dialer[_0x0a9e('0x1a')]['checkDialMethod']=function(_0x388b9c){var _0x57c3c4=this;return function(){switch(_0x388b9c[_0x0a9e('0x5a')]){case _0x0a9e('0x15e'):freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;case'power':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,_0x388b9c[_0x0a9e('0x160')]);break;case _0x0a9e('0x8'):_0x57c3c4[_0x0a9e('0x8')](_0x388b9c);break;case'booked':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;default:freeVariablesPredictive(_0x388b9c);logger[_0x0a9e('0x98')](_0x0a9e('0x161'),_0x388b9c[_0x0a9e('0x41')],_0x0a9e('0x162'));}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x163')]=function(_0x5af336){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_0x5af336['id'],previewRecallmeReminderInterval))[_0x0a9e('0xb9')](function(_0x52cdf4){for(var _0x1b6dde=0x0;_0x1b6dde<_0x52cdf4['length'];_0x1b6dde++){var _0x2b8f51=_0x52cdf4[_0x1b6dde][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x2b8f51)io['to'](util[_0x0a9e('0x7f')](_0x0a9e('0x166'),_0x2b8f51))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x52cdf4[_0x1b6dde]});}})['catch'](function(){});};Dialer[_0x0a9e('0x1a')]['launchHandleIvr']=function(_0x382412){var _0x1612d8=this;return function(){_0x1612d8['handleIvr'](_0x382412);};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x168')]=function(_0x46f728){var _0x3b2dd9=this;if(isNotPreview(_0x46f728['dialMethod'])){if(isVoiceQueueOutbound(_0x46f728[_0x0a9e('0x4d')])&&isActive(_0x46f728[_0x0a9e('0x59')])){_0x46f728['sendMessageOneNotActive']=!![];Promise[_0x0a9e('0xbb')]()['then'](checkIsLoggedIn(_0x46f728,_0x46f728['loggedIn']))['then'](checkIsActive(_0x46f728,_0x46f728[_0x0a9e('0x59')]))[_0x0a9e('0xb9')](checkInterval(_0x46f728))['then'](_0x3b2dd9[_0x0a9e('0x147')](_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkIfTime'](_0x46f728[_0x0a9e('0x169')],_0x46f728[_0x0a9e('0x16a')],_0x46f728[_0x0a9e('0x41')],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9[_0x0a9e('0x14b')](_0x46f728[_0x0a9e('0x44')],_0x46f728[_0x0a9e('0x16a')],_0x46f728['name'],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkDialMethod'](_0x46f728))[_0x0a9e('0xba')](loggerCatchQueueSummary(_0x0a9e('0x16b'),_0x46f728));}else{notSendMessagesQueue(_0x46f728);}}else{freeVariablesPredictive(_0x46f728);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x32')]=_[_0x0a9e('0x16c')](function(){var _0x184453=_['filter'](this[_0x0a9e('0x1e')],function(_0x2af0c6){return _0x2af0c6[_0x0a9e('0x16d')];});var _0x53e92b=_[_0x0a9e('0x16e')](this[_0x0a9e('0x20')],function(_0xd886e5){return _0xd886e5[_0x0a9e('0x16f')]&&_0xd886e5[_0x0a9e('0xb1')]===_0x0a9e('0x170');});if(_0x184453[_0x0a9e('0x9a')]>0x0&&_0x53e92b[_0x0a9e('0x9a')]>0x0){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_[_0x0a9e('0x171')](_0x184453,'id'),previewRecallmeReminderInterval,_[_0x0a9e('0x171')](_0x53e92b,'id')))[_0x0a9e('0xb9')](function(_0x3e31dc){for(var _0x2efc65=0x0;_0x2efc65<_0x3e31dc['length'];_0x2efc65++){var _0x20ebd0=_0x3e31dc[_0x2efc65][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x20ebd0)io['to'](util['format'](_0x0a9e('0x166'),_0x20ebd0))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x3e31dc[_0x2efc65]});}})[_0x0a9e('0xba')](function(_0x56f175){logger[_0x0a9e('0x98')](_0x0a9e('0x163'),_0x56f175);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0a9e('0x1a')][_0x0a9e('0x172')]=function(){var _0x4e8eb9=this;var _0x2b263b;for(var _0x1634cc in this[_0x0a9e('0x1f')]){if(typeof this[_0x0a9e('0x1f')][_0x1634cc]!=='undefined'){_0x2b263b=this['campaigns'][_0x1634cc];if(isCampaignIvr(_0x2b263b[_0x0a9e('0x4d')])&&isActive(_0x2b263b[_0x0a9e('0x7b')])){_0x2b263b[_0x0a9e('0xa1')]=!![];Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](checkIsActive(_0x2b263b,_0x2b263b[_0x0a9e('0x7b')]))[_0x0a9e('0xb9')](checkInterval(_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x147')](_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x173')](_0x2b263b[_0x0a9e('0x169')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b[_0x0a9e('0x41')],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x14b')](_0x2b263b[_0x0a9e('0x44')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b['name'],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x174')](_0x2b263b))['catch'](loggerCatchQueueSummary(_0x0a9e('0x175'),_0x2b263b));}else{notSendMessagesCampaign(_0x2b263b);}}}};function getCallerIdRandom(_0xe81ac2,_0x2e3df6){var _0x12a7e;var _0x56caca;var _0x59ce14;if(_0x2e3df6<=0x0){_0x2e3df6=0x1;}_0x12a7e=new RegExp(_0x0a9e('0x176')+_0x2e3df6+'}$');_0x56caca=Math[_0x0a9e('0x177')](0xa,_0x2e3df6-0x1);_0x59ce14=Math[_0x0a9e('0x177')](0xa,_0x2e3df6)-0x1;return util[_0x0a9e('0x7f')]('%s',_['replace'](_0xe81ac2,_0x12a7e,_[_0x0a9e('0x178')](_0x56caca,_0x59ce14)));}function extractCalleridName(_0xc1811b){var _0xa64f55=_0xc1811b[_0x0a9e('0x179')](/"(.*?)"/);return _0xa64f55?_0xa64f55[0x1]:_0xc1811b;}Dialer[_0x0a9e('0x1a')]['actionOriginate']=function(_0x5cfe15,_0x35b0e6){var _0x3cfcc3=this;var _0x45aa98=uuid['v4']();this[_0x0a9e('0x24')][_0x45aa98]=new Action(_0x5cfe15,_0x35b0e6,_0x45aa98);return new Promise(function(_0x126620,_0x25f447){if(_[_0x0a9e('0x3e')](_0x5cfe15)&&typeof _0x5cfe15!=='object'){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),_0x0a9e('0x17b')));}if(_['isUndefined'](_0x35b0e6['phone'])||_0x35b0e6['phone']===null){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),'contact\x20is\x20undefine'));}var _0x419d9e={'XMD-CALLERID':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AGI':_0x5cfe15['dialQueueProject']?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15[_0x0a9e('0x10f')]):_0x0a9e('0x17e'),'XMD-AGIAFTER':_0x5cfe15[_0x0a9e('0x115')]?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15['dialQueueProject2']):'NONE','XMD-QUEUE':_0x5cfe15[_0x0a9e('0x4d')]==='outbound'?util[_0x0a9e('0x7f')](_0x0a9e('0x17f'),_0x5cfe15[_0x0a9e('0x41')],_0x5cfe15['dialQueueOptions']||'',_0x5cfe15[_0x0a9e('0x116')]?'c':'',_0x5cfe15[_0x0a9e('0x11f')]||0x3):_0x0a9e('0x17e'),'XMD-CONTACTID':_0x35b0e6['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AMD':_0x5cfe15[_0x0a9e('0xe6')]?_0x0a9e('0x180'):_0x0a9e('0x17e'),'XMD-DESTINATION':_0x0a9e('0x181')};if(_0x5cfe15['dialAMDActive']){_0x419d9e['XMD-AMDINITIALSILENCE']=_0x5cfe15[_0x0a9e('0x182')]||0x9c4;_0x419d9e[_0x0a9e('0x183')]=_0x5cfe15['dialAMDGreeting']||0x5dc;_0x419d9e['XMD-AMDAFTERGREETINGSILENCE']=_0x5cfe15['dialAMDAfterGreetingSilence']||0x320;_0x419d9e['XMD-AMDTOTALANALYSISTIME']=_0x5cfe15['dialAMDTotalAnalysisTime']||0x1388;_0x419d9e['XMD-AMDMINWORDLENGTH']=_0x5cfe15[_0x0a9e('0x184')]||0x64;_0x419d9e['XMD-AMDBETWEENWORDSSILENCE']=_0x5cfe15[_0x0a9e('0x185')]||0x32;_0x419d9e[_0x0a9e('0x186')]=_0x5cfe15[_0x0a9e('0x187')]||0x3;_0x419d9e[_0x0a9e('0x188')]=_0x5cfe15[_0x0a9e('0x189')]||0x100;_0x419d9e[_0x0a9e('0x18a')]=_0x5cfe15[_0x0a9e('0x18b')]||0x1388;}if(_0x5cfe15['type']===_0x0a9e('0x18c')){_0x419d9e[_0x0a9e('0x18d')]=_0x35b0e6[_0x0a9e('0xdb')];}else{_0x419d9e[_0x0a9e('0x18e')]=_0x35b0e6[_0x0a9e('0xdc')];}for(var _0x3d2589 in _0x35b0e6[_0x0a9e('0x18f')]){if(typeof _0x35b0e6[_0x0a9e('0x18f')][_0x3d2589]!==_0x0a9e('0x9b')){if(isNotNull(_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589])&&_0x3d2589!=='id'&&_0x3d2589!==_0x0a9e('0x190')&&_0x3d2589!=='createdAt'&&_0x3d2589!==_0x0a9e('0x191')){_0x419d9e[util[_0x0a9e('0x7f')]('%s%s',_0x0a9e('0x192'),_['toUpper'](_0x3d2589))]=_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589];}}}var _0x34b3d8=_0x3cfcc3['isTrunkReachable'](_0x5cfe15['Trunk'])?getCallerId(_0x5cfe15[_0x0a9e('0x7a')]['callerid'],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15[_0x0a9e('0x193')]):_0x5cfe15[_0x0a9e('0x5c')]):getCallerId(_['isNil'](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15['Trunk']['callerid']:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x195')],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15['dialRandomLastDigitCallerIdNumber']):_0x5cfe15[_0x0a9e('0x5c')]);if(_0x34b3d8){_0x419d9e[_0x0a9e('0x196')]=_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x197')]=extractCalleridName(_0x34b3d8);_0x419d9e['XMD-ORIGINATECALLERIDNUM']=_0x35b0e6[_0x0a9e('0x198')];}_0x5cfe15[_0x0a9e('0x199')]=_0x419d9e;return ami['Action']({'actionid':_0x45aa98,'action':_0x0a9e('0x17a'),'channel':_0x3cfcc3[_0x0a9e('0xe1')](_0x5cfe15[_0x0a9e('0x7a')])?util[_0x0a9e('0x7f')]('SIP/%s/%s%s',_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15['dialCutDigit']>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15['dialCutDigit']):_0x35b0e6[_0x0a9e('0x198')]):util['format'](_0x0a9e('0x19c'),_[_0x0a9e('0xaf')](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')]:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15[_0x0a9e('0x19d')]>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15[_0x0a9e('0x19d')]):_0x35b0e6[_0x0a9e('0x198')]),'callerid':_0x34b3d8,'Exten':'xcally-motion-dialer','Context':_0x0a9e('0x19e'),'Priority':'1','variable':_0x419d9e,'timeout':(_0x5cfe15[_0x0a9e('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45aa98})[_0x0a9e('0xb9')](function(_0xf35801){return _0x126620(_0xf35801);})[_0x0a9e('0xba')](function(_0x3d7d73){_0x5cfe15[_0x0a9e('0x67')]+=0x1;var _0x1fbf62=new History(_0x3cfcc3['actions'][_0x45aa98]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x0a9e('0x4a')](_0x3d7d73)));_0x1fbf62['state']=0xe;_0x1fbf62['statedesc']='OriginateError';_0x1fbf62[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x1fbf62[_0x0a9e('0xa8')]=_0x1fbf62['starttime'];_0x3cfcc3['createHistory'](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x19f')));_0x3cfcc3[_0x0a9e('0xcf')](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch('[originate][error]'))[_0x0a9e('0x13c')](function(){delete _0x3cfcc3[_0x0a9e('0x24')][_0x45aa98];return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x49'),_0x0a9e('0x1a0')));});});});};Dialer[_0x0a9e('0x1a')]['syncOriginateResponse']=function(_0x298a78){var _0x5056d5=this['actions'][_0x298a78[_0x0a9e('0x131')]];if(_0x5056d5){delete this['actions'][_0x298a78[_0x0a9e('0x131')]];_0x5056d5[_0x0a9e('0x11e')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0xe87eb3=_0x5056d5[_0x0a9e('0x4d')]===_0x0a9e('0x7e')?this[_0x0a9e('0x1f')][_0x5056d5[_0x0a9e('0xb5')]]:this['voiceQueues'][_0x5056d5[_0x0a9e('0x1a1')]()];if(!this[_0x0a9e('0xdf')](_0x298a78['response'])){this[_0x0a9e('0xb4')](_0xe87eb3);return this[_0x0a9e('0x1a2')](_0x5056d5,_0xe87eb3,_0x298a78)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a3')));}this['uniqueId'][_0x298a78[_0x0a9e('0xe9')]]=_0x5056d5;}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1a4')]=function(_0x44b14c,_0x1aa179,_0x5840d5){var _0x4c08b3=new History(_0x1aa179);if(_0x4c08b3[_0x0a9e('0x107')]+_0x4c08b3['countcongestionretry']+_0x4c08b3[_0x0a9e('0x1a5')]+_0x4c08b3['countnosuchnumberretry']+_0x4c08b3[_0x0a9e('0x109')]+_0x4c08b3['countabandonedretry']+_0x4c08b3[_0x0a9e('0xf6')]+_0x4c08b3['countagentrejectretry']>=_0x5840d5[_0x0a9e('0xfc')]-0x1){return!![];}switch(_0x44b14c){case 0x3:if(_0x4c08b3[_0x0a9e('0x1a5')]>=_0x5840d5[_0x0a9e('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4c08b3['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5['dialNoAnswerRetryFrequency'],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a7')));break;case 0x5:if(_0x4c08b3[_0x0a9e('0x107')]>=_0x5840d5[_0x0a9e('0x1a8')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countbusyretry':_0x4c08b3[_0x0a9e('0x107')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1a9')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4c08b3[_0x0a9e('0xf9')]>=_0x5840d5['dialCongestionMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countcongestionretry':_0x4c08b3['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1aa')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ab')));break;case 0x0:if(_0x4c08b3['countnosuchnumberretry']>=_0x5840d5[_0x0a9e('0x1ac')]-0x1){return!![];}else{this[_0x0a9e('0x10b')]({'active':![],'countnosuchnumberretry':_0x4c08b3[_0x0a9e('0x108')]+=0x1,'scheduledat':moment()['add'](_0x5840d5['dialNoSuchNumberRetryFrequency'],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ad')));}break;case 0xa:if(_0x4c08b3['countdropretry']>=_0x5840d5[_0x0a9e('0x126')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4c08b3['countdropretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x122')],'minutes')['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));break;case 0xb:if(_0x4c08b3['countabandonedretry']>=_0x5840d5['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x4c08b3[_0x0a9e('0xfa')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1ae')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x12e')));break;case 0x13:if(_0x4c08b3[_0x0a9e('0xf6')]>=_0x5840d5[_0x0a9e('0xfe')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0x4c08b3[_0x0a9e('0xf6')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));break;case 0x14:if(_0x4c08b3[_0x0a9e('0xfb')]>=_0x5840d5[_0x0a9e('0x1af')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countagentrejectretry':_0x4c08b3[_0x0a9e('0xfb')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1b0')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3['ListId'],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1b1')));break;default:return!![];}};Dialer['prototype'][_0x0a9e('0x1a2')]=function(_0x174487,_0x5cacc0,_0x15f892){var _0x22b47b=this;var _0x57d648=new History(_0x174487);var _0x4b24bd=![];var _0x5a7379;var _0x34f612;return new Promise(function(_0x2d6673,_0x25bc80){if(_['isUndefined'](_0x5cacc0)&&typeof _0x5cacc0!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0x14c'),_0x0a9e('0x1b3')));}if(_[_0x0a9e('0x3e')](_0x15f892)&&typeof _0x15f892!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),'Failure','evt\x20is\x20undefine'));}_0x22b47b[_0x0a9e('0xbe')](_0x57d648,_0x15f892[_0x0a9e('0x114')],_0x5cacc0)[_0x0a9e('0xb9')](function(_0x5763cb){if(_0x5763cb[_0x0a9e('0x125')]==0x1)_0x4b24bd=!![];switch(_0x15f892[_0x0a9e('0x114')]){case'0':_0x5cacc0[_0x0a9e('0x66')]+=0x1;_0x57d648['state']=0x0;_0x57d648['statedesc']=_0x0a9e('0x1b4');_0x57d648[_0x0a9e('0x108')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x0a9e('0xef')](_0x174487,'nosuchnumber'));_0x5a7379=_0x5cacc0['dialNoSuchNumberRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x22b47b['checkRetriveMax'](0x0,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x108')]>=_0x5cacc0[_0x0a9e('0x1ac')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}}break;case'3':_0x5cacc0[_0x0a9e('0x65')]+=0x1;_0x57d648['state']=0x3;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1b6');_0x57d648[_0x0a9e('0x1a5')]+=0x1;_0x57d648['countglobal']+=0x1;var _0x10f9fe=ut[_0x0a9e('0x1b7')](_0x174487,_0x5cacc0);ami[_0x0a9e('0xed')]('custom:agentnoanswer',_0x10f9fe);_0x5a7379=_0x5cacc0[_0x0a9e('0x1b8')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1b9')));if(_0x22b47b[_0x0a9e('0x1a4')](0x3,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x1a5')]>=_0x5cacc0[_0x0a9e('0x1a6')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}}break;case'5':_0x5cacc0['outboundBusyCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x5;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1bb');_0x57d648[_0x0a9e('0x107')]+=0x1;_0x57d648['countglobal']+=0x1;ami[_0x0a9e('0xed')](_0x0a9e('0x1bc'),ut['buildObj'](_0x174487,_0x0a9e('0x1bd')));_0x5a7379=_0x5cacc0[_0x0a9e('0x1a9')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1be')));if(_0x22b47b[_0x0a9e('0x1a4')](0x5,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]>=_0x5cacc0['dialBusyMaxRetry']){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x205\x20busy');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1bf'));}}break;case'8':_0x5cacc0['outboundCongestionCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x8;_0x57d648[_0x0a9e('0xea')]='Congestion';_0x57d648[_0x0a9e('0xf9')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0['dialCongestionRetryFrequency'];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x174487,_0x0a9e('0x1c0')));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1c1')));if(_0x22b47b[_0x0a9e('0x1a4')](0x8,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648['countcongestionretry']>=_0x5cacc0[_0x0a9e('0x1c2')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x208\x20congestion');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c3'));}}break;case'11':_0x5cacc0[_0x0a9e('0x1c4')]+=0x1;_0x57d648['state']=0xb;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x57d648[_0x0a9e('0xfa')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0[_0x0a9e('0x1ae')];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x12f')));if(_0x22b47b[_0x0a9e('0x1a4')](0xb,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfa')]>=_0x5cacc0[_0x0a9e('0x12d')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}}break;case'20':_0x5cacc0[_0x0a9e('0x69')]+=0x1;_0x57d648['state']=0x14;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1c6');_0x57d648[_0x0a9e('0xfb')]+=0x1;_0x57d648['countglobal']+=0x1;_0x5a7379=_0x5cacc0['dialAgentRejectRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x0a9e('0xef')](_0x174487,'agentreject'));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c7')));if(_0x22b47b[_0x0a9e('0x1a4')](0x14,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0x1af')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c8'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,'reason\x2020\x20agentreject');}}break;default:_0x5cacc0[_0x0a9e('0x6a')]+=0x1;_0x57d648['state']=0xc;_0x57d648[_0x0a9e('0xea')]=_0x15f892['reason'];_0x5a7379=_0x5cacc0[_0x0a9e('0x1b0')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c9')));if(_0x22b47b['checkRetriveMax'](_0x15f892[_0x0a9e('0x114')],_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]+_0x57d648['countcongestionretry']+_0x57d648[_0x0a9e('0x1a5')]+_0x57d648[_0x0a9e('0x108')]+_0x57d648['countdropretry']+_0x57d648[_0x0a9e('0xfa')]+_0x57d648[_0x0a9e('0xf6')]+_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0xfc')]){_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892[_0x0a9e('0x114')]);}else{_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892['reason']);}}}})[_0x0a9e('0xb9')](function(){if(_0x4b24bd){_0x22b47b[_0x0a9e('0xc0')](_0x57d648,_0x5a7379,_0x34f612)[_0x0a9e('0xb9')](function(){return _0x2d6673(0x1);});}});});};Dialer[_0x0a9e('0x1a')]['stateGlobal']=function(_0x19e176,_0x300474,_0x189e15,_0x12bc40){var _0x32c53e=new Final(_0x19e176);_0x32c53e[_0x0a9e('0xa7')]=0xf;_0x32c53e[_0x0a9e('0xea')]=_0x0a9e('0x1ca');this['createStateFinal'](_0x32c53e,_0x300474,_0x189e15,_0x12bc40);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xff')]=function(_0x315236,_0x4a80a0,_0x3da853,_0x101e33){this[_0x0a9e('0xcf')](_0x315236)[_0x0a9e('0xb9')](function(){return _0x4a80a0(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0xe0'),_0x101e33));})[_0x0a9e('0xba')](function(){return _0x3da853(msgResponse(_0x0a9e('0x1cb'),_0x0a9e('0x14c'),_0x0a9e('0x1cc')));});};Dialer['prototype'][_0x0a9e('0x8')]=function(_0x3a87e7){var _0x21f245=_0x3a87e7['dialPredictiveOptimizationPercentage']/0x64;var _0x4d473a=_0x3a87e7[_0x0a9e('0x64')]/(_0x3a87e7[_0x0a9e('0x64')]+_0x3a87e7[_0x0a9e('0x60')]);var _0x73014f=Math[_0x0a9e('0x1cd')](_0x3a87e7[_0x0a9e('0x74')]*(_0x3a87e7[_0x0a9e('0x1ce')]/0x64));var _0x236a28=Math[_0x0a9e('0x1cd')](_0x3a87e7['predictiveIntervalAvailable']*(_0x3a87e7[_0x0a9e('0x1cf')]/0x64));var _0x41ae51=_0x3a87e7['available']+_0x3a87e7[_0x0a9e('0x53')];var _0xa0ec15=Math['floor'](_0x3a87e7['erlangCalls']*_0x3a87e7[_0x0a9e('0x8d')]*_0x3a87e7[_0x0a9e('0x71')]*_0x3a87e7[_0x0a9e('0x72')]);if(_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){if(!_['isUndefined'](_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x0a9e('0x1d0'));}if(!_['isUndefined'](_0x3a87e7['handlePredictive'])){loggerPredictive['error'](_0x0a9e('0x1d1'),_0x0a9e('0x1d2'));clearInterval(_0x3a87e7[_0x0a9e('0x92')]);_0x3a87e7[_0x0a9e('0x92')]=undefined;}_0x3a87e7['startProgressive']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1d3'),_0x3a87e7[_0x0a9e('0x79')]);this['handlePower'](_0x3a87e7,0x1);}else if(ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7['startProgressive'])){this[_0x0a9e('0x15f')](_0x3a87e7,0x1);loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x1d4'),_0x3a87e7[_0x0a9e('0x79')],_0x3a87e7[_0x0a9e('0x41')]);_0x3a87e7['erlangCalls']=0x0;_0x3a87e7[_0x0a9e('0x70')]=0x0;}else if(_0x21f245<_0x4d473a&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d7'),_0x0a9e('0x1d8'),_0x4d473a,'startProgressive',_0x3a87e7[_0x0a9e('0x41')]);}else if(_0xa0ec15<_0x3a87e7[_0x0a9e('0x70')]&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d9'),_0x0a9e('0x1da'),_0xa0ec15,_0x0a9e('0x1db'),_0x3a87e7[_0x0a9e('0x70')],_0x0a9e('0x79'),_0x3a87e7[_0x0a9e('0x41')]);}else if(!ifInterval(_0x3a87e7[_0x0a9e('0x1dc')],_0x3a87e7[_0x0a9e('0x79')])&&_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x27')])&&!_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){_0x3a87e7[_0x0a9e('0x27')]=moment()['format'](_0x0a9e('0x104'));loggerPredictive[_0x0a9e('0x82')](_0x3a87e7['name'],'started\x20in\x20predictive\x20at',_0x3a87e7['startPredictive']);this[_0x0a9e('0xc3')](_0x3a87e7[_0x0a9e('0x1dc')])['then'](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))['then'](this[_0x0a9e('0x1de')](_0x3a87e7))['catch'](loggerCatchPredictive(_0x0a9e('0x1df'),_0x3a87e7));}else if(!ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7[_0x0a9e('0x70')]=0x0;_0x3a87e7[_0x0a9e('0x27')]=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e0'),_0x3a87e7['startPredictive']);clearInterval(_0x3a87e7['handlePredictive']);_0x3a87e7['handlePredictive']=undefined;this['averageHandleTime'](_0x3a87e7[_0x0a9e('0x1dc')])[_0x0a9e('0xb9')](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))[_0x0a9e('0xb9')](this['startMethodPredictive'](_0x3a87e7))[_0x0a9e('0xba')](loggerCatchPredictive(_0x0a9e('0x1e1'),_0x3a87e7));}else if(_0x3a87e7[_0x0a9e('0x74')]&&_0x41ae51<_0x3a87e7[_0x0a9e('0x74')]-_0x236a28){freeVariablesPredictive(_0x3a87e7);loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e2'),_0x41ae51,_0x0a9e('0x1e3'),_0x3a87e7[_0x0a9e('0x74')],'-',_0x236a28,'=',_0x3a87e7[_0x0a9e('0x74')]-_0x236a28,')');}else if(_0x3a87e7['predictiveIntervalAvailable']&&_0x41ae51>_0x3a87e7[_0x0a9e('0x74')]+_0x73014f){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41ae51,_0x0a9e('0x1e4'),_0x3a87e7['predictiveIntervalAvailable'],'+',_0x73014f,'=',_0x3a87e7[_0x0a9e('0x74')]+_0x73014f,')');}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1dd')]=function(_0xda737b){var _0x415fce=this;return function(_0x59f11d){return new Promise(function(_0x4bacf7,_0x1428a7){_[_0x0a9e('0x8f')](_0xda737b,_0x59f11d[0x0]);if(checkGetDataPredictive(_0x59f11d[0x0])){var _0x44b401=_0xda737b[_0x0a9e('0x74')]=_0xda737b['talking']+_0xda737b[_0x0a9e('0xa2')];var _0x706802=_0xda737b[_0x0a9e('0x1dc')]*0x3c;var _0x5bba8b=_0x59f11d[0x0][_0x0a9e('0x6d')]+_0x59f11d[0x0]['predictiveIntervalAvgHoldtime'];var _0x479441=(_0x59f11d[0x0][_0x0a9e('0x6b')]+_0x59f11d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59f11d[0x0][_0x0a9e('0x6e')])/_0x59f11d[0x0][_0x0a9e('0x75')];_0xda737b[_0x0a9e('0x71')]=_0x479441>0x0?_0x479441:0x1;switch(_0xda737b['dialPredictiveOptimization']){case _0x0a9e('0x1d6'):var _0x25d456=_0xda737b[_0x0a9e('0x1e5')]/0x64;return _0x415fce[_0x0a9e('0x1e6')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x25d456)[_0x0a9e('0xb9')](function(_0x26fd45){return _0x4bacf7(_0x26fd45);});case _0x0a9e('0x1e7'):var _0x1c3f66=_0xda737b['dialPredictiveOptimizationPercentage']/0x64;return _0x415fce[_0x0a9e('0x1e8')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x1c3f66)[_0x0a9e('0xb9')](function(_0x3ea9f1){return _0x4bacf7(_0x3ea9f1);});default:return _0x1428a7(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),'Unknown\x20Predictive'));}}else{return _0x1428a7(msgResponse('[getDataPredictive]',_0x0a9e('0x14c'),'check\x20failure'));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1ea')]=function(_0x58b3f3){var _0x2eb471=this;return function(_0x239eef){return new Promise(function(_0xc91243,_0x49973b){_[_0x0a9e('0x8f')](_0x58b3f3,_0x239eef[0x0]);if(checkGetDataPredictive(_0x239eef[0x0])){loggerPredictive[_0x0a9e('0x82')](JSON[_0x0a9e('0x4a')](_0x239eef[0x0]));if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){return _0x2eb471[_0x0a9e('0xce')](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x305a4b){var _0x5695b6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x305a4b[0x0][_0x0a9e('0x1ec')];var _0x459efc=_0x58b3f3[_0x0a9e('0x1dc')]*0x3c;var _0x727652=_0x239eef[0x0]['predictiveIntervalAvgTalktime']+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x4fb1ea=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0][_0x0a9e('0x6f')]+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x43ff93=_0x58b3f3['dialPredictiveOptimizationPercentage']/0x64;_0x58b3f3[_0x0a9e('0x73')]=_0x305a4b[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x4fb1ea>0x0?_0x4fb1ea:0x1;return _0x2eb471[_0x0a9e('0x1e6')](_0x5695b6,_0x459efc,_0x727652,_0x4fb1ea,_0x43ff93);})['then'](function(_0x323936){return _0xc91243(_0x323936);})['catch'](function(_0x334e91){return _0x49973b(msgResponse(_0x0a9e('0x1ed'),'Failure',JSON[_0x0a9e('0x4a')](_0x334e91)));});}if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1e7')){return _0x2eb471['getVoiceQueueRtPauses'](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x5608ed){var _0xdbcd6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x5608ed[0x0]['outboundQueuePauses'];var _0x4df5cc=_0x58b3f3['dialPredictiveInterval']*0x3c;var _0x495820=_0x239eef[0x0][_0x0a9e('0x6d')]+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x3d7fb6=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x400b85=_0x58b3f3[_0x0a9e('0x1e5')]/0x64;_0x58b3f3['predictiveIntervalPauses']=_0x5608ed[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x3d7fb6>0x0?_0x3d7fb6:0x1;return _0x2eb471[_0x0a9e('0x1e8')](_0xdbcd6,_0x4df5cc,_0x495820,_0x3d7fb6,_0x400b85);})[_0x0a9e('0xb9')](function(_0x37c272){return _0xc91243(_0x37c272);})[_0x0a9e('0xba')](function(_0xf01ef8){return _0x49973b(msgResponse('[CatchErlangB]',_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0xf01ef8)));});}}else{return _0x49973b(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),_0x0a9e('0x1ee')));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1de')]=function(_0xd66cc3){var _0x2dc3df=this;return function(){var _0x43fd4c=0x0;var _0x10e1b9=Math['floor'](_0xd66cc3[_0x0a9e('0x77')]*0x3e8);if(_0x10e1b9>0x0){_0x10e1b9=_0x10e1b9<0x64?0x64:_0x10e1b9;loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],_0x0a9e('0x1ef'),_0x10e1b9,_0x0a9e('0x4b'));_0xd66cc3[_0x0a9e('0x92')]=setInterval(function(){_0x2dc3df[_0x0a9e('0x92')](_0xd66cc3);loggerPredictiveCalls['info'](_0x0a9e('0x1f0'),_0x43fd4c+=0x1);},_0x10e1b9);}else{loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1f1')]=function(_0x2e082a,_0x4c7e3b){var _0x5d3ad3=this;return function(_0x23b67e){if(_[_0x0a9e('0x48')](_0x23b67e)){if(_[_0x0a9e('0xaf')](_0x4c7e3b[_0x0a9e('0xda')])||!_0x4c7e3b[_0x0a9e('0x1f2')]){if(_0x2e082a['dialMethod']===_0x0a9e('0x7')){_0x2e082a['queueStatusComplete']=_[_0x0a9e('0x3e')](_0x2e082a[_0x0a9e('0x136')])?!![]:_0x2e082a['queueStatusComplete'];var _0x449dd9=uuid['v4']();_0x5d3ad3['actions'][_0x449dd9]=new Action(_0x2e082a,_0x4c7e3b,_0x449dd9);loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x1f3'),_0x449dd9,'queueStatusComplete:\x20',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a['name']);if(_0x2e082a[_0x0a9e('0x136')]){_0x2e082a[_0x0a9e('0x136')]=![];_0x5d3ad3[_0x0a9e('0x134')][_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xb5')]]=[];ami[_0x0a9e('0xb0')]({'actionid':_0x449dd9,'action':'queuestatus','queue':_0x2e082a[_0x0a9e('0x41')]})[_0x0a9e('0xba')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3[_0x0a9e('0x10b')]({'active':![],'ContactId':_0x5d3ad3['actions'][_0x449dd9]['ContactId'],'ListId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9]['VoiceQueueId']||undefined,'CampaignId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];});}else{loggerBooked[_0x0a9e('0x82')]('[booked][checkContactBlack][else]',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a[_0x0a9e('0x41')]);_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3['rescheduleContact']({'active':![],'ContactId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd8')],'ListId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdb')]||undefined,'CampaignId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x1f5')));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];}}else{return _0x5d3ad3['actionOriginate'](_0x2e082a,_0x4c7e3b);}}else{if(getDiff(_0x4c7e3b['scheduledat'])<_0x2e082a[_0x0a9e('0x1f6')]*0x3c){if(_0x4c7e3b[_0x0a9e('0x165')]&&!_0x4c7e3b['Agent']['voicePause']){_0x5d3ad3[_0x0a9e('0x1d')][_0x0a9e('0x139')](_0x4c7e3b['id'])[_0x0a9e('0x13c')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}else{_0x5d3ad3[_0x0a9e('0xc7')]({'active':![]},_0x4c7e3b['id'],0x1)['finally'](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}}else{_0x2e082a['outboundReCallsDay']+=0x1;_0x5d3ad3['updateOriginated'](_0x2e082a);if(_0x2e082a[_0x0a9e('0x1f7')]){_0x5d3ad3['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c7e3b[_0x0a9e('0xd8')],'ListId':_0x4c7e3b['ListId'],'VoiceQueueId':_0x4c7e3b[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c7e3b['CampaignId']||undefined})['catch'](loggerCatch(_0x0a9e('0x1f8')));_0x5d3ad3[_0x0a9e('0xd1')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1f9'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5d3ad3[_0x0a9e('0xd6')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fa'),0x16,'RecallFailedTimeout'),_0x0a9e('0x1fb'),'[Originate][HistoryRecallClose]');}}}}else{_0x2e082a[_0x0a9e('0x61')]+=0x1;_0x5d3ad3['saveInDb'](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fc'),0xd,_0x0a9e('0x1fd')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1fe')]=function(_0x149a5d){var _0x2f8a0a=this;var _0x311544=_0x149a5d[_0x0a9e('0x1ff')]-_0x149a5d[_0x0a9e('0x76')]-_0x149a5d[_0x0a9e('0xca')];emitCampaignSummary(_0x149a5d);if(_0x311544>0x0){if(_0x311544>this[_0x0a9e('0x22')]){_0x311544=this[_0x0a9e('0x22')];}_0x149a5d[_0x0a9e('0xca')]+=_0x311544;this[_0x0a9e('0xcc')](_0x149a5d['id'],_0x311544,_0x149a5d[_0x0a9e('0x200')],_0x149a5d)[_0x0a9e('0xb9')](function(_0x2e8669){_0x149a5d['temp']-=_0x311544;_0x149a5d['temp']=_0x149a5d[_0x0a9e('0xca')]>0x0?_0x149a5d[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x2e8669)){_0x149a5d[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger['info'](_0x0a9e('0x201')+_0x149a5d['name']);}else{_0x149a5d[_0x0a9e('0x76')]+=_0x2e8669['length'];_0x149a5d[_0x0a9e('0x3f')]='RUNNING';for(var _0x50985c=0x0;_0x50985c<_0x2e8669[_0x0a9e('0x9a')];_0x50985c+=0x1){_0x149a5d[_0x0a9e('0x202')]+=0x1;if(_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c])||_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c]['Contact'])||_['isNil'](_0x2e8669[_0x50985c][_0x0a9e('0x198')])){_0x2f8a0a['emptyContact'](_0x0a9e('0x203'),_0x149a5d,_0x2e8669[_0x50985c]);}else{_0x2f8a0a[_0x0a9e('0xc2')](_['pick'](_0x2e8669[_0x50985c],[_0x0a9e('0xdc'),'Contact.phone']))[_0x0a9e('0xb9')](_0x2f8a0a[_0x0a9e('0x1f1')](_0x149a5d,_0x2e8669[_0x50985c]))[_0x0a9e('0xba')](_0x2f8a0a[_0x0a9e('0xd4')](_0x0a9e('0x204'),_0x149a5d));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x205'),_0x149a5d,_0x311544));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x15f')]=function(_0x342861,_0x2d4b26){var _0x2070da=this;var _0x29930d=[];var _0x68d005=_0x2d4b26>=0x1?_0x2d4b26:0x1;if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x68d005=0x1;}var _0x5b42ef=Math[_0x0a9e('0x206')](_0x342861[_0x0a9e('0xa2')]*_0x68d005)-_0x342861[_0x0a9e('0x76')]-_0x342861['temp'];emitVoiceQueueSummary(_0x342861);if(_0x342861[_0x0a9e('0x207')]>0x0){var _0x312cf5=_0x342861[_0x0a9e('0x207')]-_0x342861[_0x0a9e('0x76')]-_0x342861[_0x0a9e('0x53')]-_0x342861[_0x0a9e('0xca')]-_0x342861[_0x0a9e('0x50')];if(_0x5b42ef>_0x312cf5){_0x5b42ef=_0x312cf5;}}if(_0x5b42ef>0x0){if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x5b42ef=0x1;}if(_0x5b42ef>this[_0x0a9e('0x22')]){_0x5b42ef=this[_0x0a9e('0x22')];}_0x342861['temp']+=_0x5b42ef;for(var _0x189849 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x189849]!=='undefined'){if(this[_0x0a9e('0x20')][_0x189849]['state']==='not_inuse'&&this[_0x0a9e('0x20')][_0x189849]['status']===_0x0a9e('0x170')){_0x29930d['push'](this[_0x0a9e('0x20')][_0x189849]['id']);}}}this[_0x0a9e('0xc9')](_0x342861['id'],_0x29930d,_0x5b42ef,_0x342861[_0x0a9e('0x200')],_0x342861)['then'](function(_0x1676f3){_0x342861['temp']-=_0x5b42ef;_0x342861['temp']=_0x342861[_0x0a9e('0xca')]>0x0?_0x342861[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x1676f3)){_0x2070da[_0x0a9e('0xb8')](_0x342861)[_0x0a9e('0xb9')](sendMessageReschedule(_0x342861))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x342861['originated']+=_0x1676f3[_0x0a9e('0x9a')];_0x342861[_0x0a9e('0x3f')]=_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')?_0x0a9e('0x180'):'RUNNING';for(var _0xda6cd8=0x0;_0xda6cd8<_0x1676f3[_0x0a9e('0x9a')];_0xda6cd8+=0x1){if(_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x198')])){_0x2070da[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x342861,_0x1676f3[_0xda6cd8]);}else{_0x2070da[_0x0a9e('0xbc')](_[_0x0a9e('0xd7')](_0x1676f3[_0xda6cd8],[_0x0a9e('0xdb'),_0x0a9e('0x20a')]))['then'](_0x2070da['checkContactBlack'](_0x342861,_0x1676f3[_0xda6cd8]))[_0x0a9e('0xba')](_0x2070da[_0x0a9e('0xd4')]('[actionOriginate]\x20',_0x342861));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x20b'),_0x342861,_0x5b42ef));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x92')]=function(_0x2fdb67){if(_0x2fdb67['dialLimitQueue']>0x0){var _0x5d85ab=_0x2fdb67['dialLimitQueue']-_0x2fdb67[_0x0a9e('0x76')]-_0x2fdb67[_0x0a9e('0x53')];if(_0x5d85ab>0x0){this[_0x0a9e('0x20c')](_0x2fdb67);}else{loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x20d'));}}else{this[_0x0a9e('0x20c')](_0x2fdb67);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x20c')]=function(_0x44c694){var _0x4ee67f=this;var _0x4a0c23=[];_0x44c694[_0x0a9e('0x76')]+=0x1;for(var _0x45fac7 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x45fac7]!==_0x0a9e('0x9b')){if(this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xa7')]===_0x0a9e('0x20e')&&this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xb1')]==='reachable'){_0x4a0c23[_0x0a9e('0x150')](this['agents'][_0x45fac7]['id']);}}}this['getContactDialer'](_0x44c694['id'],_0x4a0c23,0x1,_0x44c694[_0x0a9e('0x200')],_0x44c694)[_0x0a9e('0xb9')](function(_0x115423){if(!checkContactEmpty(_0x115423)){checkContactLowerLimitOriginate(_0x44c694,0x1,0x0);_0x4ee67f[_0x0a9e('0xb8')](_0x44c694)[_0x0a9e('0xb9')](sendMessageReschedule(_0x44c694))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x44c694[_0x0a9e('0x3f')]=_0x0a9e('0x20f');if(_['isNil'](_0x115423[0x0])||_[_0x0a9e('0xaf')](_0x115423[0x0][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x115423[0x0]['phone'])){_0x4ee67f[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x44c694,_0x115423[0x0]);}else{_0x4ee67f['checkIsBlackList'](_['pick'](_0x115423[0x0],['VoiceQueueId','Contact.phone']))[_0x0a9e('0xb9')](_0x4ee67f[_0x0a9e('0x1f1')](_0x44c694,_0x115423[0x0]))['catch'](_0x4ee67f[_0x0a9e('0xd4')]('[actionOriginatePredictive]\x20',_0x44c694));}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x210'),_0x44c694,0x1));emitVoiceQueueSummary(_0x44c694);};Dialer[_0x0a9e('0x1a')]['abandonmentRate']=function(_0x5976d2,_0x4165be,_0x14c011,_0xb68b,_0x42d9ca,_0x1a1cb2){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x211'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x212'),_0x5976d2);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x213'),_0x4165be);loggerPredictive['info'](_0x0a9e('0x214'),_0x14c011);loggerPredictive[_0x0a9e('0x82')]('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',_0xb68b);loggerPredictive['info'](_0x0a9e('0x215'),_0x42d9ca);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x3366f2,_0x31981e){if(_0x5976d2<=0x0||isNaN(_0x5976d2)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),_0x0a9e('0x216')+_0x5976d2));}if(_0x14c011<=0x0||isNaN(_0x14c011)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),'Ts\x20=\x20'+_0x14c011));}if(_0xb68b<=0x0||isNaN(_0xb68b)){return _0x31981e(msgResponse('[abandonmentRate]','Error',_0x0a9e('0x217')+_0xb68b));}if(_0x4165be<=0x0||isNaN(_0x4165be)){return _0x31981e(msgResponse(_0x0a9e('0x218'),'Error','interval\x20=\x20'+_0x4165be));}if(_0x42d9ca<=0x0||isNaN(_0x42d9ca)){return _0x31981e(msgResponse(_0x0a9e('0x218'),_0x0a9e('0x49'),_0x0a9e('0x219')+_0x42d9ca));}_0x1a1cb2=_0x1a1cb2||0x0;var _0x1682dc=0x1/_0x14c011;var _0x5db09e=0x0;var _0xe9bc8e=0x0;var _0x3eac52=0x0;var _0x12d833=0x0;for(var _0x483d88=0x0;_0x3eac52<_0x42d9ca;_0x483d88+=0x1){_0xe9bc8e=_0x483d88/_0x4165be;_0x5db09e=(_0xb68b*_0xe9bc8e+_0x1a1cb2)/_0x1682dc;_0x3eac52=erlangb(_0x5db09e,_0x5976d2);_0x12d833=_0x5db09e/_0x5976d2*(0x1-erlangb(_0x5db09e,_0x5976d2));}return _0x3366f2({'erlangCalls':_0x483d88,'erlangCallToSecond':_0x4165be/_0x483d88,'erlangAbandonmentRate':_0x3eac52,'erlangBusyFactor':_0x12d833});});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1e8')]=function(_0x400f7a,_0x3a1953,_0x2cdbbf,_0x5a240f,_0x5b862a,_0x171660){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21a'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x400f7a);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a1953);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x214'),_0x2cdbbf);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21b'),_0x5a240f);loggerPredictive[_0x0a9e('0x82')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b862a);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x34f39f,_0x2e40a9){if(_0x400f7a<=0x0||isNaN(_0x400f7a)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x216')+_0x400f7a));}if(_0x2cdbbf<=0x0||isNaN(_0x2cdbbf)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),_0x0a9e('0x49'),_0x0a9e('0x21d')+_0x2cdbbf));}if(_0x5a240f<=0x0||isNaN(_0x5a240f)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x217')+_0x5a240f));}if(_0x3a1953<=0x0||isNaN(_0x3a1953)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error','interval\x20=\x20'+_0x3a1953));}if(_0x5b862a<=0x0||isNaN(_0x5b862a)){return _0x2e40a9(msgResponse('[busyFactor]',_0x0a9e('0x49'),_0x0a9e('0x21e')+_0x5b862a));}_0x171660=_0x171660||0x0;var _0x4dafc8=0x1/_0x2cdbbf;var _0x23fc30=0x0;var _0x5e2a11=0x0;var _0x58503f=0x0;var _0x4b1969=0x0;for(var _0x4e0508=0x0;_0x4b1969<_0x5b862a;_0x4e0508+=0x1){_0x5e2a11=_0x4e0508/_0x3a1953;_0x23fc30=(_0x5a240f*_0x5e2a11+_0x171660)/_0x4dafc8;_0x58503f=erlangb(_0x23fc30,_0x400f7a);_0x4b1969=_0x23fc30/_0x400f7a*(0x1-erlangb(_0x23fc30,_0x400f7a));}return _0x34f39f({'erlangCalls':_0x4e0508,'erlangCallToSecond':_0x3a1953/_0x4e0508,'erlangAbandonmentRate':_0x58503f,'erlangBusyFactor':_0x4b1969});});};module[_0x0a9e('0x21f')]=Dialer; \ No newline at end of file +var _0xa9e0=['reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countbusyretry','countnosuchnumberretry','countdropretry','stateGlobal','rescheduleContact','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','stateinterface','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','inspect','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','push','command','iftime\x20%s,%s','timezones','indexOf','true','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','reachable','map','syncCampaigns','checkIfTime','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','originate','voiceQueue\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','phone','variables','trim','substring','SIP/%s/%s%s','dialCutDigit','from-sip','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','[countReScheduled]\x20','emptyContact','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','RUNNING','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','p\x20=\x20','[abandonmentRate]','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','seconds','type','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','md5','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','uniqueId','[uniqueid]','clearZombieChannels','[actions]','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','statedesc','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var ut=require('../preview/util/util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerBooked=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var loggerPredictive=require('../../../config/logger')(_0x0a9e('0x8'));var loggerPredictiveCalls=require(_0x0a9e('0x5'))(_0x0a9e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':_0x0a9e('0xc'),'port':0x18eb});var io=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xb')]));var cmHopper=require(_0x0a9e('0xe'));var cmHopperHistory=require(_0x0a9e('0xf'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x0a9e('0x10'));var History=require(_0x0a9e('0x11'));var Final=require(_0x0a9e('0x12'));var AgentComplete=require(_0x0a9e('0x13'));var QueueCallerAbandon=require(_0x0a9e('0x14'));var Hangup=require(_0x0a9e('0x15'));var ipAgi=process['env'][_0x0a9e('0x16')]||_0x0a9e('0x17');var strategy={'rrmemory':_0x0a9e('0x18'),'roundrobin':_0x0a9e('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0a9e('0x1a')][_0x0a9e('0x1b')]=function(_0x52a03d){this[_0x0a9e('0x1c')]=this['tail']?this[_0x0a9e('0x1c')]['finally'](_0x52a03d):_0x52a03d();};function Dialer(_0x16033c,_0x12066b){this['sequence']=new Sequence();this[_0x0a9e('0x1d')]=_0x12066b;this['voiceQueues']=_0x16033c[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x16033c[_0x0a9e('0x1f')];this[_0x0a9e('0x20')]=_0x16033c[_0x0a9e('0x20')];this[_0x0a9e('0x21')]=_0x16033c[_0x0a9e('0x21')];this[_0x0a9e('0x22')]=config[_0x0a9e('0x22')]||0x2;this[_0x0a9e('0x23')]={};this[_0x0a9e('0x24')]={};this[_0x0a9e('0x25')]={};this['uniqueId']={};this[_0x0a9e('0x26')]={};this[_0x0a9e('0x27')]={};this['startProgressive']={};this[_0x0a9e('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x0a9e('0x29'),this[_0x0a9e('0x2a')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2c'),this['syncQueueCallerAbandon'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2d'),this[_0x0a9e('0x2e')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2f'),this[_0x0a9e('0x30')][_0x0a9e('0x2b')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x31'),this[_0x0a9e('0x32')][_0x0a9e('0x2b')](this));ami['on']('hangup',this[_0x0a9e('0x33')]['bind'](this));ami['on'](_0x0a9e('0x34'),this['syncNewExten'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x35'),this[_0x0a9e('0x36')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x37'),this[_0x0a9e('0x38')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x39'),this['syncQueueStatusComplete'][_0x0a9e('0x2b')](this));this[_0x0a9e('0x3a')]();this[_0x0a9e('0x3b')]();RpcSetting[_0x0a9e('0x3c')]()['then'](function(_0x15b200){previewRecallmeReminderInterval=_0x15b200[_0x0a9e('0x3d')];});}function isNotNull(_0x1843b2){return _0x1843b2!==null&&!_[_0x0a9e('0x3e')](_0x1843b2);}function checkIsLoggedIn(_0x58b06f,_0x563b45){return function(){if(_0x563b45<=0x0){_0x58b06f[_0x0a9e('0x3f')]=_0x0a9e('0x40');throw _0x58b06f[_0x0a9e('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x426950){return _0x426950;}function checkIsActive(_0x5d1e0e,_0x2407f9){return function(){if(!isActive(_0x2407f9)){_0x5d1e0e[_0x0a9e('0x3f')]=_0x0a9e('0x42');throw _0x5d1e0e[_0x0a9e('0x41')]+_0x0a9e('0x43');}};}function checkInterval(_0x5180f1){return function(){if(!isNotNull(_0x5180f1[_0x0a9e('0x44')])){_0x5180f1[_0x0a9e('0x3f')]=_0x0a9e('0x45');throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}if(!isNotNull(_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')])){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0a9e('0x48')](_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')]))){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}};}function msgResponse(_0x1fa90d,_0x15de0e,_0x4853b1){return{'action':_0x1fa90d,'response':_0x15de0e,'message':_0x4853b1,'stack':_0x4853b1};}function myreject(_0x54135e){return function(_0x1e8694){return _0x54135e(msgResponse('[ifTime][Action]',_0x0a9e('0x49'),JSON[_0x0a9e('0x4a')](_0x1e8694)));};}function getSeconds(_0x381c37,_0x1ef87a){var _0x4f41ae=moment(_0x381c37)[_0x0a9e('0x4b')](0x0);var _0x3bfce8=moment(_0x1ef87a)[_0x0a9e('0x4b')](0x0);return _0x4f41ae['diff'](_0x3bfce8,_0x0a9e('0x4c'));}function emit(_0x1a180b,_0x289467,_0x4c1c0e){io['to'](_0x1a180b)['emit'](_0x289467,_0x4c1c0e);}function emitVoiceQueueSummary(_0x11b61d){if(_0x11b61d[_0x0a9e('0x4d')]==='outbound'){var _0x2b814e={'id':_0x11b61d['id'],'name':_0x11b61d[_0x0a9e('0x41')],'strategy':_0x11b61d[_0x0a9e('0x4e')],'answered':_0x11b61d[_0x0a9e('0x4f')],'available':_0x11b61d['available'],'loggedIn':_0x11b61d['loggedIn'],'pTalking':_0x11b61d[_0x0a9e('0x50')],'sumBillable':_0x11b61d[_0x0a9e('0x51')],'sumDuration':_0x11b61d['sumDuration'],'sumHoldTime':_0x11b61d[_0x0a9e('0x52')]||0x0,'talking':_0x11b61d[_0x0a9e('0x53')],'total':_0x11b61d[_0x0a9e('0x54')],'type':_0x11b61d['type'],'unmanaged':_0x11b61d[_0x0a9e('0x55')],'abandoned':_0x11b61d[_0x0a9e('0x56')],'waiting':_0x11b61d[_0x0a9e('0x57')],'loggedInDb':_0x11b61d[_0x0a9e('0x58')],'dialActive':_0x11b61d[_0x0a9e('0x59')],'dialMethod':_0x11b61d[_0x0a9e('0x5a')],'dialOriginateCallerIdName':_0x11b61d[_0x0a9e('0x5b')],'dialOriginateCallerIdNumber':_0x11b61d[_0x0a9e('0x5c')],'dialOriginateTimeout':_0x11b61d[_0x0a9e('0x5d')],'dialPrefix':_0x11b61d[_0x0a9e('0x5e')],'outboundAnswerAgiCallsDay':_0x11b61d[_0x0a9e('0x5f')],'outboundAnswerCallsDay':_0x11b61d[_0x0a9e('0x60')],'outboundBlacklistCallsDay':_0x11b61d[_0x0a9e('0x61')],'outboundBusyCallsDay':_0x11b61d[_0x0a9e('0x62')],'outboundCongestionCallsDay':_0x11b61d[_0x0a9e('0x63')],'outboundDropCallsDayACS':_0x11b61d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x11b61d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x11b61d[_0x0a9e('0x64')],'outboundNoAnswerCallsDay':_0x11b61d[_0x0a9e('0x65')],'outboundNoSuchCallsDay':_0x11b61d[_0x0a9e('0x66')],'outboundOriginateFailureCallsDay':_0x11b61d[_0x0a9e('0x67')],'outboundReCallsDay':_0x11b61d[_0x0a9e('0x68')],'outboundRejectCallsDay':_0x11b61d[_0x0a9e('0x69')],'outboundUnknownCallsDay':_0x11b61d[_0x0a9e('0x6a')],'predictiveIntervalAnsweredCalls':_0x11b61d[_0x0a9e('0x6b')],'predictiveIntervalAvgHoldtime':_0x11b61d[_0x0a9e('0x6c')],'predictiveIntervalAvgTalktime':_0x11b61d[_0x0a9e('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x11b61d[_0x0a9e('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x11b61d[_0x0a9e('0x6f')],'predictiveIntervalErlangCalls':_0x11b61d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x11b61d[_0x0a9e('0x70')],'predictiveIntervalHitRate':_0x11b61d[_0x0a9e('0x71')],'predictiveIntervalMultiplicativeFactor':_0x11b61d[_0x0a9e('0x72')],'predictiveIntervalPauses':_0x11b61d[_0x0a9e('0x73')],'predictiveIntervalAvailable':_0x11b61d[_0x0a9e('0x74')],'predictiveIntervalTotalCalls':_0x11b61d[_0x0a9e('0x75')],'message':_0x11b61d[_0x0a9e('0x3f')],'originated':_0x11b61d[_0x0a9e('0x76')],'erlangCalls':_0x11b61d['erlangCalls'],'erlangCallToSecond':_0x11b61d[_0x0a9e('0x77')],'erlangAbandonmentRate':_0x11b61d['erlangAbandonmentRate'],'erlangBusyFactor':_0x11b61d[_0x0a9e('0x78')],'startPredictive':_0x11b61d[_0x0a9e('0x27')],'startProgressive':_0x11b61d[_0x0a9e('0x79')]};if(_0x11b61d['Trunk']){_0x2b814e[_0x0a9e('0x7a')]={'id':_0x11b61d[_0x0a9e('0x7a')]['id'],'name':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x41')],'active':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x7b')],'callerid':_0x11b61d[_0x0a9e('0x7a')]['callerid']};}if(_0x11b61d[_0x0a9e('0x44')]){_0x2b814e[_0x0a9e('0x44')]={'id':_0x11b61d[_0x0a9e('0x44')]['id'],'name':_0x11b61d[_0x0a9e('0x44')][_0x0a9e('0x41')]};}var _0x992c77=md5(JSON[_0x0a9e('0x4a')](_0x2b814e));if(_0x11b61d[_0x0a9e('0x7c')]!==_0x992c77){_0x11b61d[_0x0a9e('0x7c')]=_0x992c77;emit(util['format'](_0x0a9e('0x7d'),_0x2b814e[_0x0a9e('0x41')]),'voice_queue:save',_0x2b814e);}}}function emitCampaignSummary(_0x4ae14b){if(_0x4ae14b['type']===_0x0a9e('0x7e')){emit(util[_0x0a9e('0x7f')](_0x0a9e('0x80'),_0x4ae14b[_0x0a9e('0x41')]),_0x0a9e('0x81'),_0x4ae14b);}}function checkGetDataPredictive(_0x30decb){if(isNotNull(_0x30decb)&&!_[_0x0a9e('0x48')](_0x30decb)){loggerPredictive[_0x0a9e('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x75')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x83'),_0x30decb['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x84'),_0x30decb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x0a9e('0x85'),_0x30decb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x0a9e('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x6c')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x86'),_0x30decb['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));if(_0x30decb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6d')])&&_0x30decb[_0x0a9e('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0x0a9e('0x88'));if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6c')])&&_0x30decb['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0a9e('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0a9e('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2f7092){return function(_0x65432){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x89'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8a'),_0x65432[_0x0a9e('0x8b')]);loggerPredictive[_0x0a9e('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x65432[_0x0a9e('0x77')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432[_0x0a9e('0x8d')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8e'),_0x65432['erlangBusyFactor']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432['erlangAbandonmentRate']);loggerPredictive[_0x0a9e('0x82')]('---------------------------');_[_0x0a9e('0x8f')](_0x2f7092,_0x65432);};}function getDiff(_0x5ba1f9){var _0x4b3c1a=moment()['milliseconds'](0x0);var _0x273cb5=moment(_0x5ba1f9)['milliseconds'](0x0);return _0x4b3c1a[_0x0a9e('0x90')](_0x273cb5,_0x0a9e('0x4c'));}function ifInterval(_0x261adb,_0x7be420){if(_[_0x0a9e('0x3e')](_0x7be420)){return![];}return getDiff(_0x7be420)<_0x261adb*0x3c;}function freeVariablesPredictive(_0x26d7db){if(isNotNull(_0x26d7db)){if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x79')])){_0x26d7db['startProgressive']=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x91'));}if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x27')])){_0x26d7db[_0x0a9e('0x27')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0a9e('0x3e')](_0x26d7db[_0x0a9e('0x92')])){clearInterval(_0x26d7db['handlePredictive']);_0x26d7db[_0x0a9e('0x92')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x93'));}}}function erlangb(_0x401837,_0x4d4a35){if(_0x4d4a35===0x0){return 0x0;}var _0x176840=0x1;for(var _0x2937e0=0x1;_0x2937e0<=_0x4d4a35;_0x2937e0+=0x1){_0x176840=0x1+_0x176840*_0x2937e0/_0x401837;}return 0x1/_0x176840;}function isVoiceQueueOutbound(_0x281c7d){return _0x281c7d==='outbound';}function isNotPreview(_0x3528b7){return _0x3528b7!=='preview';}function isCampaignIvr(_0x5211e3){return _0x5211e3===_0x0a9e('0x7e');}function getCallerId(_0x4556c5,_0x9375fb,_0x19c995){if(!_[_0x0a9e('0x3e')](_0x19c995)&&typeof _0x19c995===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x19c995)){if(!_[_0x0a9e('0x3e')](_0x9375fb)&&typeof _0x9375fb===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x9375fb)){return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x9375fb,_0x19c995);}return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x19c995,_0x19c995);}if(!_[_0x0a9e('0x3e')](_0x4556c5)&&typeof _0x4556c5===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x4556c5)){return _0x4556c5;}return _0x0a9e('0x96');}function loggerCatchQueueSummary(_0x5150a4,_0x1b0b98){return function(_0x295763){freeVariablesPredictive(_0x1b0b98);emitVoiceQueueSummary(_0x1b0b98);emitCampaignSummary(_0x1b0b98);loggerSyncQueueSummary[_0x0a9e('0x97')](_0x5150a4,util['inspect'](_0x295763,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1148a1,_0x30944e){return function(_0x4b341d){loggerPredictive[_0x0a9e('0x98')](_0x30944e[_0x0a9e('0x41')],_0x1148a1);loggerPredictive[_0x0a9e('0x98')](_0x4b341d[_0x0a9e('0x99')]);freeVariablesPredictive(_0x30944e);};}function loggerCatch(_0x13b5c0){return function(_0x4a43a8){logger['error'](_0x13b5c0,util['inspect'](_0x4a43a8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x40fb85){return _0x40fb85&&!_[_0x0a9e('0x3e')](_0x40fb85)&&_0x40fb85[_0x0a9e('0x9a')]>0x0;}function decremetOriginate(_0x23a7d3){if(!_[_0x0a9e('0x3e')](_0x23a7d3)&&_0x23a7d3!==null){if(typeof _0x23a7d3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x23a7d3[_0x0a9e('0x76')]>0x0){_0x23a7d3['originated']-=0x1;}else{logger[_0x0a9e('0x98')](_0x0a9e('0x9c'));}}}else{logger[_0x0a9e('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2bdc44,_0x583b2e,_0x4437ff){if(_0x583b2e>_0x4437ff){for(var _0x44351d=0x0;_0x44351d<_0x583b2e-_0x4437ff;_0x44351d+=0x1){decremetOriginate(_0x2bdc44);}}}function loggerGetContactDialer(_0x4c46c1,_0x2ed01e,_0x75912a){return function(_0x2cc7a7){checkContactLowerLimitOriginate(_0x2ed01e,_0x75912a,0x0);logger[_0x0a9e('0x98')](_0x4c46c1,util['inspect'](_0x2cc7a7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d442c){return function(_0x2e9552){if(isNotNull(_0x2e9552)&&isNotNull(_0x2e9552[0x0])){if(_0x2e9552[0x0][_0x0a9e('0x9d')]>0x0){_0x1d442c[_0x0a9e('0x3f')]='RESCHEDULED_CONTACTS';logger[_0x0a9e('0x82')](_0x0a9e('0x9e')+_0x1d442c[_0x0a9e('0x41')],_0x2e9552[0x0][_0x0a9e('0x9d')],'contacts');}else{_0x1d442c[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger[_0x0a9e('0x82')](_0x0a9e('0xa0')+_0x1d442c[_0x0a9e('0x41')]);}}};}function notSendMessagesQueue(_0xdb98ca){if(_0xdb98ca[_0x0a9e('0xa1')]){freeVariablesPredictive(_0xdb98ca);if(_0xdb98ca[_0x0a9e('0x76')]===0x0&&_0xdb98ca[_0x0a9e('0x53')]===0x0&&_0xdb98ca[_0x0a9e('0x57')]===0x0&&(_0xdb98ca[_0x0a9e('0x50')]||0x0)===0x0){_0xdb98ca[_0x0a9e('0xa1')]=![];_0xdb98ca[_0x0a9e('0xa2')]=0x0;_0xdb98ca[_0x0a9e('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca[_0x0a9e('0x41')],'is\x20not\x20active');}else{_0xdb98ca[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca['name'],'is\x20disactive');}emitVoiceQueueSummary(_0xdb98ca);}}function notSendMessagesCampaign(_0x7ebea8){if(_0x7ebea8[_0x0a9e('0xa1')]){if(_0x7ebea8['originated']===0x0){_0x7ebea8[_0x0a9e('0xa1')]=![];_0x7ebea8['message']=_0x0a9e('0x42');loggerSyncQueueSummary[_0x0a9e('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x7ebea8[_0x0a9e('0x41')],_0x0a9e('0xa5'));}else{_0x7ebea8[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa6'),_0x7ebea8[_0x0a9e('0x41')],'is\x20disactive');}emitCampaignSummary(_0x7ebea8);}}function createObjHistory(_0x2973d3,_0x3ca9b9,_0x45c109,_0x16e5b9,_0x492543){_0x2973d3[_0x0a9e('0x3f')]=_0x45c109;var _0xf0db1=new Action(_0x2973d3,_0x3ca9b9);var _0x4bf3a5=new History(_0xf0db1);_0x4bf3a5[_0x0a9e('0xa7')]=_0x16e5b9;_0x4bf3a5['statedesc']=_0x492543;_0x4bf3a5[_0x0a9e('0xa8')]=_0xf0db1[_0x0a9e('0xa9')];return _0x4bf3a5;}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x3b')]=function(){var _0x5af453=this;setInterval(function(){_0x5af453['clearZombieChannels'](_0x5af453[_0x0a9e('0xaa')],_0x0a9e('0xab'));_0x5af453[_0x0a9e('0xac')](_0x5af453['actions'],_0x0a9e('0xad'));},0x32c8);};Dialer[_0x0a9e('0x1a')]['clearZombieChannels']=function(_0x4e46b2,_0xf0a802){var _0x56acca=this;for(var _0x5ea541 in _0x4e46b2){if(typeof _0x4e46b2[_0x5ea541]!=='undefined'){this[_0x0a9e('0xae')][_0x0a9e('0x1b')](function(){if(!_[_0x0a9e('0xaf')](_0x4e46b2[_0x5ea541])){return ami[_0x0a9e('0xb0')]({'action':_0x0a9e('0xb1'),'channel':_0x4e46b2[_0x5ea541][_0x0a9e('0xb2')]})['catch'](function(_0x5fd5db){if(_0x5fd5db['message']===_0x0a9e('0xb3')){setTimeout(function(){if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca['voiceQueues'][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb6'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541]['queue']);delete _0x4e46b2[_0x5ea541];}if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]===_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca[_0x0a9e('0x1f')][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb7'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]);delete _0x4e46b2[_0x5ea541];}},0x2328);}});}});}}};Dialer['prototype'][_0x0a9e('0xb8')]=function(_0x3325c5){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xb8')](_0x3325c5))[_0x0a9e('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0a9e('0x1a')]['checkIsBlackList']=function(_0x8c8fbe){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack[_0x0a9e('0xbc')](_0x8c8fbe))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbd')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xbe')]=function(_0x501050,_0x329d88,_0x31d25a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperAdditionalPhone[_0x0a9e('0xbe')](_0x501050,_0x329d88,_0x31d25a))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbf')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc0')]=function(_0x31af8c,_0x151956,_0x3754e2){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperAdditionalPhone[_0x0a9e('0xc0')](_0x31af8c,_0x151956,_0x3754e2))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xc1')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc2')]=function(_0x5d9ddb){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack['checkIsBlackListIvr'](_0x5d9ddb))[_0x0a9e('0xba')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc3')]=function(_0x1d93b1){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperHistory[_0x0a9e('0xc4')](_0x1d93b1))['catch'](loggerCatch(_0x0a9e('0xc5')));};Dialer[_0x0a9e('0x1a')]['rescheduleContact']=function(_0x231c6a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['rescheduleContact'](_0x231c6a))['catch'](loggerCatch(_0x0a9e('0xc6')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc7')]=function(_0x413190,_0x3f2f40,_0x2450a8){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc7')](_0x413190,_0x3f2f40,_0x2450a8))['catch'](loggerCatch(_0x0a9e('0xc8')));};Dialer['prototype'][_0x0a9e('0xc9')]=function(_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5,_0x4e7273){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc9')](_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5))[_0x0a9e('0xba')](function(_0x2263f1){_0x4e7273['temp']-=_0x28ce92;_0x4e7273['temp']=_0x4e7273[_0x0a9e('0xca')]>0x0?_0x4e7273['temp']:0x0;loggerCatch(_0x0a9e('0xcb'))(_0x2263f1);});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcc')]=function(_0x16313e,_0x2ad54b,_0x213e5d,_0x596312){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper['getContactDialerIvr'](_0x16313e,_0x2ad54b,_0x213e5d))[_0x0a9e('0xba')](function(_0x5c689c){_0x596312[_0x0a9e('0xca')]-=_0x2ad54b;_0x596312['temp']=_0x596312['temp']>0x0?_0x596312[_0x0a9e('0xca')]:0x0;loggerCatch(_0x0a9e('0xcd'))(_0x5c689c);});};Dialer['prototype'][_0x0a9e('0xce')]=function(_0x17cb30){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](voiceQueueRt[_0x0a9e('0xce')](_0x17cb30))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcf')]=function(_0x41c8cd){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['moveContactManagedDialer'](_0x41c8cd))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd0')));};Dialer['prototype'][_0x0a9e('0xd1')]=function(_0x19fd11){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperHistory[_0x0a9e('0xd1')](_0x19fd11))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd2')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xb4')]=function(_0x16afb3){if(!_['isUndefined'](_0x16afb3)&&_0x16afb3!==null){if(typeof _0x16afb3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x16afb3[_0x0a9e('0x76')]>0x0){_0x16afb3[_0x0a9e('0x76')]-=0x1;}else{logger[_0x0a9e('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0a9e('0xd3'));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd4')]=function(_0x2fea95,_0x34f7b5){var _0x59e46f=this;return function(_0x1339d0){_0x59e46f[_0x0a9e('0xb4')](_0x34f7b5);logger[_0x0a9e('0x98')](_0x2fea95,util['inspect'](_0x1339d0,{'showHidden':![],'depth':null}));};};Dialer[_0x0a9e('0x1a')]['emptyContact']=function(_0x2144ca,_0x4799d4,_0x25b745){var _0x42b833={'state':0x19,'statedesc':_0x0a9e('0xd5')};this['updateOriginated'](_0x4799d4);this[_0x0a9e('0xd6')](_['merge'](_0x42b833,_[_0x0a9e('0xd7')](_0x25b745,[_0x0a9e('0xd8'),_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x0a9e('0xdc')])),_0x0a9e('0xdd'),_0x0a9e('0xde'));logger[_0x0a9e('0x98')](_0x2144ca);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xdf')]=function(_0xc876d4){return _0xc876d4===_0x0a9e('0xe0');};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xe1')]=function(_0x248368){return!_['isUndefined'](_0x248368)&&_0x248368&&!_['isUndefined'](_0x248368[_0x0a9e('0x41')])&&!_['isUndefined'](_0x248368[_0x0a9e('0x7b')])&&_0x248368[_0x0a9e('0x7b')]&&(this['trunks'][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])][_0x0a9e('0xb1')]==='reachable'||this[_0x0a9e('0x21')][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])]['status']===_0x0a9e('0xe3'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd6')]=function(_0x5c838b,_0x2650eb,_0x270df8){this[_0x0a9e('0xd1')](_0x5c838b)['catch'](loggerCatch(_0x2650eb));this[_0x0a9e('0xcf')](_0x5c838b)[_0x0a9e('0xba')](loggerCatch(_0x270df8));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x36')]=function(_0x2394d3){var _0x555780=this;var _0x3211d2=this[_0x0a9e('0xaa')][_0x2394d3['uniqueid']];var _0x3bab3e;if(!_[_0x0a9e('0xaf')](_0x2394d3)&&!_[_0x0a9e('0xaf')](_0x2394d3['variable'])&&!_['isNil'](_0x2394d3['variable'][_0x0a9e('0xe4')])&&_0x2394d3[_0x0a9e('0xe5')]==='xcally-motion-dialer'&&_0x3211d2){if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xe8')){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0x60')]+=0x1;this['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e[_0x0a9e('0xea')]=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]='AMD';ami[_0x0a9e('0xed')](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0xf1'),_0x0a9e('0xf2'));}if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x3539b7,_0x57f0ad){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780[_0x0a9e('0xb4')](_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x1a9ef1=_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]];var _0x41e446=new Hangup(_0x3211d2,_0x2394d3);_0x41e446[_0x0a9e('0xa7')]=0x13;_0x41e446[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0x41e446[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0x41e446[_0x0a9e('0xf6')]+=0x1;_0x41e446[_0x0a9e('0xf7')]+=0x1;_0x41e446[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x41e446,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0x41e446)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x41e446['countbusyretry']+_0x41e446[_0x0a9e('0xf9')]+_0x41e446['countnoanswerretry']+_0x41e446['countnosuchnumberretry']+_0x41e446['countdropretry']+_0x41e446[_0x0a9e('0xfa')]+_0x41e446[_0x0a9e('0xf6')]+_0x41e446[_0x0a9e('0xfb')]>=_0x1a9ef1[_0x0a9e('0xfc')]){_0x555780['stateGlobal'](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0xfd'));}else{if(_0x41e446[_0x0a9e('0xf6')]>=_0x1a9ef1[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0x100'));}else{_0x555780['rescheduleContact']({'active':![],'countmachineretry':_0x41e446['countmachineretry'],'scheduledat':moment()[_0x0a9e('0x101')](_0x1a9ef1[_0x0a9e('0x102')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x41e446[_0x0a9e('0xd8')],'ListId':_0x41e446[_0x0a9e('0xd9')],'VoiceQueueId':_0x41e446['VoiceQueueId']||undefined,'CampaignId':_0x41e446[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x3539b7({'reschedule':0x1});}}});}if(_0x3211d2['type']===_0x0a9e('0x7e')&&this[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]['dialAMDActive']&&_0x2394d3['value']==='HANGUP'){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1f')][_0x3211d2['queue']]);_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e['statedesc']=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]=_0x0a9e('0xf5');ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0x106'),'[syncHangupInAMDIvr]');}if(_0x3211d2[_0x0a9e('0x4d')]==='ivr'&&this[_0x0a9e('0x1f')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x10ace8,_0x1e306c){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780['updateOriginated'](_0x555780[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x16b578=_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]];var _0xf49ed4=new Hangup(_0x3211d2,_0x2394d3);_0xf49ed4[_0x0a9e('0xa7')]=0x13;_0xf49ed4[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0xf49ed4[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0xf49ed4[_0x0a9e('0xf6')]+=0x1;_0xf49ed4[_0x0a9e('0xf7')]+=0x1;_0xf49ed4[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut['buildObj'](_0xf49ed4,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0xf49ed4)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0xf49ed4[_0x0a9e('0x107')]+_0xf49ed4[_0x0a9e('0xf9')]+_0xf49ed4['countnoanswerretry']+_0xf49ed4[_0x0a9e('0x108')]+_0xf49ed4[_0x0a9e('0x109')]+_0xf49ed4[_0x0a9e('0xfa')]+_0xf49ed4['countmachineretry']+_0xf49ed4[_0x0a9e('0xfb')]>=_0x16b578[_0x0a9e('0xfc')]){_0x555780[_0x0a9e('0x10a')](_0xf49ed4,_0x10ace8,_0x1e306c,_0x0a9e('0xfd'));}else{if(_0xf49ed4[_0x0a9e('0xf6')]>=_0x16b578[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0xf49ed4,_0x10ace8,_0x1e306c,'reason\x2019\x20machine....');}else{_0x555780[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0xf49ed4[_0x0a9e('0xf6')],'scheduledat':moment()[_0x0a9e('0x101')](_0x16b578[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0xf49ed4['ContactId'],'ListId':_0xf49ed4['ListId'],'VoiceQueueId':_0xf49ed4[_0x0a9e('0xdb')]||undefined,'CampaignId':_0xf49ed4[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x10ace8({'reschedule':0x1});}}});}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x33')]=function(_0x609711){var _0x584854=this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];var _0x2d8e91;if(_0x584854&&_0x584854[_0x0a9e('0x4d')]===_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];this['updateOriginated'](this[_0x0a9e('0x1f')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1f')][_0x584854['queue']][_0x0a9e('0x10c')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this['moveContactManagedDialer'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this[_0x0a9e('0xaa')][_0x609711['uniqueid']];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0x10;_0x2d8e91[_0x0a9e('0xea')]=_0x0a9e('0x110');_0x2d8e91['membername']=_0x0a9e('0x111');this['createHistory'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x2d8e91)['catch'](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&!isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this['uniqueId'][_0x609711[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x6a')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0xc;_0x2d8e91['statedesc']=_0x609711[_0x0a9e('0x112')];_0x2d8e91['membername']=_0x0a9e('0x113');this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this[_0x0a9e('0xcf')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0a9e('0x1a')]['syncAgentComplete']=function(_0x50e32a){var _0x504403=this['uniqueId'][_0x50e32a[_0x0a9e('0xe9')]];if(this['voiceQueues'][_0x50e32a['queue']]){if(_0x504403&&_0x504403[_0x0a9e('0x4d')]!=='ivr'){delete this[_0x0a9e('0xaa')][_0x50e32a[_0x0a9e('0xe9')]];this[_0x0a9e('0x1e')][_0x50e32a['queue']][_0x0a9e('0x60')]+=0x1;var _0x1209c4=new AgentComplete(_0x504403,_0x50e32a);if(_0x50e32a[_0x0a9e('0x114')]==='agent'){_0x1209c4['agiafterat']=this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x115')]&&this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x116')]?moment()[_0x0a9e('0x7f')](_0x0a9e('0x104')):undefined;}this[_0x0a9e('0xd1')](_0x1209c4)[_0x0a9e('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1209c4)['catch'](loggerCatch(_0x0a9e('0x117')));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x2a')]=function(_0x2d21c7){if(this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]){if(this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]]&&this['uniqueId'][_0x2d21c7['uniqueid']][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){this['updateOriginated'](this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]);this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]][_0x0a9e('0x118')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x119')]=function(_0x400800,_0xbd1af3){this[_0x0a9e('0xd1')](_0x400800)['catch'](loggerCatch(_0x0a9e('0x11a')));if(_0xbd1af3==0x0){this[_0x0a9e('0xcf')](_0x400800)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x11b')));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x11c')]=function(_0x292e67){var _0x23bec3=this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];var _0x6b048e=this;var _0x3ba472=![];var _0x4e6eb9;var _0x572a72;if(this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]){if(_0x23bec3&&_0x23bec3[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]);_0x23bec3['droptime']=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0x1e9f9f=new QueueCallerAbandon(_0x23bec3,_0x292e67);if(getSeconds(_0x23bec3[_0x0a9e('0x11d')],_0x23bec3[_0x0a9e('0x11e')])>=_0x23bec3[_0x0a9e('0x11f')]){this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x6f')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x64')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x70')]+=0x1;_0x1e9f9f[_0x0a9e('0xa7')]=0xa;_0x1e9f9f['statedesc']='Drop';_0x1e9f9f[_0x0a9e('0x120')]=_0x0a9e('0x121');_0x1e9f9f['agiafterat']=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x115')]?moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1e9f9f[_0x0a9e('0x109')]+=0x1;_0x1e9f9f['countglobal']+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']][_0x0a9e('0x122')];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f['state'],_0x23bec3[_0x0a9e('0x124')])['then'](function(_0x505ffd){_0x3ba472=_0x505ffd[_0x0a9e('0x125')]==0x1;if(_0x1e9f9f[_0x0a9e('0x109')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x126')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x505ffd[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countdropretry':_0x1e9f9f[_0x0a9e('0x109')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x122')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));var _0x543b30=new History(_0x1e9f9f);_0x543b30[_0x0a9e('0xa7')]=0xa;_0x543b30['statedesc']='Drop';_0x543b30['starttime']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x543b30[_0x0a9e('0xa8')]=_0x543b30[_0x0a9e('0xa9')];_0x543b30[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x543b30[_0x0a9e('0x129')]=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x543b30)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12a')));}})[_0x0a9e('0xb9')](function(){if(_0x3ba472)_0x6b048e['swapAdditionalPhones'](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}else{this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12b')]+=0x1;_0x1e9f9f['state']=0xb;_0x1e9f9f[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x1e9f9f['dropreason']='CALLEREXIT';_0x1e9f9f[_0x0a9e('0xfa')]+=0x1;_0x1e9f9f[_0x0a9e('0xf7')]+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']]['dialAbandonedRetryFrequency'];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f[_0x0a9e('0xa7')],_0x23bec3[_0x0a9e('0x124')])[_0x0a9e('0xb9')](function(_0x183b9b){if(_0x1e9f9f[_0x0a9e('0xfa')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12d')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x183b9b[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x1e9f9f[_0x0a9e('0xfa')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]['dialAbandonedRetryFrequency'],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12e')));var _0x3a14d7=new History(_0x1e9f9f);_0x3a14d7[_0x0a9e('0xa7')]=0xb;_0x3a14d7[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x3a14d7[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x3a14d7['endtime']=_0x3a14d7['starttime'];_0x3a14d7[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x3a14d7['calleridnum']=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x3a14d7)['catch'](loggerCatch(_0x0a9e('0x12f')));}})['then'](function(){if(_0x3ba472)_0x6b048e[_0x0a9e('0xc0')](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x0a9e('0x130')]=function(_0x31ab12){if(this['actions'][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0x24')][_0x31ab12['uniqueid']][_0x0a9e('0xb2')]=_0x31ab12[_0x0a9e('0xb2')];}if(this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]['channel']=_0x31ab12[_0x0a9e('0xb2')];}};Dialer[_0x0a9e('0x1a')]['syncQueueMember']=function(_0x3d63aa){if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x3d63aa['actionid']]&&_['isNil'](this['actions'][_0x3d63aa['actionid']][_0x0a9e('0x132')])&&_0x3d63aa[_0x0a9e('0xb1')]==='1'&&_0x3d63aa['paused']==='0'){if(this['agents'][_0x3d63aa[_0x0a9e('0x133')]]){if(!this['agents'][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]){this[_0x0a9e('0x20')][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x133')]=_0x3d63aa[_0x0a9e('0x133')];}}}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]||'rrmemory')===_0x0a9e('0x18')){if(this['actions'][_0x3d63aa[_0x0a9e('0x131')]]){if(this[_0x0a9e('0x20')][_0x3d63aa['stateinterface']]){this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]]['stateinterface']=_0x3d63aa[_0x0a9e('0x133')];if(_['isNil'](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0xb5')]])){this['queueBooked'][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]=[];}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['push'](_[_0x0a9e('0x8f')](_[_0x0a9e('0xd7')](this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]],[_0x0a9e('0x135'),'stateinterface']),{'status':_0x3d63aa[_0x0a9e('0xb1')],'paused':_0x3d63aa['paused']}));}}}};function unlockQueueStatus(_0x5d1159,_0x3a459c){setTimeout(function(){if(_['isUndefined'](_0x5d1159[_0x0a9e('0x136')])){loggerBooked[_0x0a9e('0x98')]('[unlockQueueStatus][undefined]',_0x3a459c);}_0x5d1159[_0x0a9e('0x136')]=!![];loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x137'),_0x3a459c,JSON[_0x0a9e('0x4a')](_[_0x0a9e('0xd7')](_0x5d1159,[_0x0a9e('0x41'),_0x0a9e('0x136')])));},0x1f3);}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x138')]=function(_0x5871d7){var _0x26f1c6=this;var _0x421b6c=_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]];if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]){this[_0x0a9e('0x1d')][_0x0a9e('0x139')](this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x135')],this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')])[_0x0a9e('0xba')](function(_0x14444e){logger[_0x0a9e('0x98')](_0x0a9e('0x13a'),util[_0x0a9e('0x13b')](_0x14444e,{'showHidden':![],'depth':null}));})[_0x0a9e('0x13c')](function(){_0x26f1c6[_0x0a9e('0xb4')](_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]);_0x26f1c6[_0x0a9e('0x20')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]][_0x0a9e('0x132')]=![];delete _0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]];unlockQueueStatus(_0x421b6c);});}else{this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]);this[_0x0a9e('0x10b')]({'active':![],'ContactId':this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xd8')],'ListId':this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xd9')],'VoiceQueueId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdb')]||undefined,'CampaignId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x13d')));delete this[_0x0a9e('0x24')][_0x5871d7['actionid']];unlockQueueStatus(_0x421b6c);}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']][_0x0a9e('0x4e')]]||_0x0a9e('0x18'))===_0x0a9e('0x18')){var _0x1bf053;if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&!_[_0x0a9e('0x48')](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']])){if(this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]){this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']]['queue']]=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]?this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]:this['queueBooked'][this['actions'][_0x5871d7[_0x0a9e('0x131')]]['queue']]?this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['_rr']||0x0:0x0;}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]['_rr']=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]];for(var _0x223e19=0x0;_0x223e19=0x0;})[_0x0a9e('0xba')](myreject(_0x1e30bc)));}}else{_0x1ebf20[_0x0a9e('0x150')](ami[_0x0a9e('0xb0')]({'action':'command','command':util[_0x0a9e('0x7f')](_0x0a9e('0x152'),_0x4ad6fc,!_[_0x0a9e('0x3e')](config['timezones'][_0xaa43da])?_0xaa43da:'')})[_0x0a9e('0xb9')](function(_0x4f8949){return _0x4f8949[_0x0a9e('0x156')][_0x0a9e('0x154')](_0x0a9e('0x155'))>=0x0;})['catch'](myreject(_0x1e30bc)));}Promise[_0x0a9e('0x157')](_0x1ebf20)[_0x0a9e('0xb9')](function(_0x310f89){var _0x1ecb3b=_[_0x0a9e('0x158')](_0x310f89);if(_0x1ecb3b){return _0xcdd954(_0x1ecb3b);}else{_0x2bc6a3[_0x0a9e('0x3f')]=_0x5174c5?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0a9e('0x159');return _0x1e30bc(msgResponse(_0x0a9e('0x15a'),_0x0a9e('0x14c'),_0x0a9e('0x15b')+_0x5174c5+'\x20'+_0x2ee2fc+_0x0a9e('0x15c')+util[_0x0a9e('0x13b')](_0x4ad6fc,{'showHidden':![],'depth':null})+_0x0a9e('0x15d')+_0xaa43da));}})[_0x0a9e('0xba')](function(_0x597e99){return _0x1e30bc(msgResponse(_0x0a9e('0x14a'),_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0x597e99)));});});};Dialer[_0x0a9e('0x1a')]['checkDialMethod']=function(_0x388b9c){var _0x57c3c4=this;return function(){switch(_0x388b9c[_0x0a9e('0x5a')]){case _0x0a9e('0x15e'):freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;case'power':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,_0x388b9c[_0x0a9e('0x160')]);break;case _0x0a9e('0x8'):_0x57c3c4[_0x0a9e('0x8')](_0x388b9c);break;case'booked':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;default:freeVariablesPredictive(_0x388b9c);logger[_0x0a9e('0x98')](_0x0a9e('0x161'),_0x388b9c[_0x0a9e('0x41')],_0x0a9e('0x162'));}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x163')]=function(_0x5af336){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_0x5af336['id'],previewRecallmeReminderInterval))[_0x0a9e('0xb9')](function(_0x52cdf4){for(var _0x1b6dde=0x0;_0x1b6dde<_0x52cdf4['length'];_0x1b6dde++){var _0x2b8f51=_0x52cdf4[_0x1b6dde][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x2b8f51)io['to'](util[_0x0a9e('0x7f')](_0x0a9e('0x166'),_0x2b8f51))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x52cdf4[_0x1b6dde]});}})['catch'](function(){});};Dialer[_0x0a9e('0x1a')]['launchHandleIvr']=function(_0x382412){var _0x1612d8=this;return function(){_0x1612d8['handleIvr'](_0x382412);};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x168')]=function(_0x46f728){var _0x3b2dd9=this;if(isNotPreview(_0x46f728['dialMethod'])){if(isVoiceQueueOutbound(_0x46f728[_0x0a9e('0x4d')])&&isActive(_0x46f728[_0x0a9e('0x59')])){_0x46f728['sendMessageOneNotActive']=!![];Promise[_0x0a9e('0xbb')]()['then'](checkIsLoggedIn(_0x46f728,_0x46f728['loggedIn']))['then'](checkIsActive(_0x46f728,_0x46f728[_0x0a9e('0x59')]))[_0x0a9e('0xb9')](checkInterval(_0x46f728))['then'](_0x3b2dd9[_0x0a9e('0x147')](_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkIfTime'](_0x46f728[_0x0a9e('0x169')],_0x46f728[_0x0a9e('0x16a')],_0x46f728[_0x0a9e('0x41')],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9[_0x0a9e('0x14b')](_0x46f728[_0x0a9e('0x44')],_0x46f728[_0x0a9e('0x16a')],_0x46f728['name'],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkDialMethod'](_0x46f728))[_0x0a9e('0xba')](loggerCatchQueueSummary(_0x0a9e('0x16b'),_0x46f728));}else{notSendMessagesQueue(_0x46f728);}}else{freeVariablesPredictive(_0x46f728);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x32')]=_[_0x0a9e('0x16c')](function(){var _0x184453=_['filter'](this[_0x0a9e('0x1e')],function(_0x2af0c6){return _0x2af0c6[_0x0a9e('0x16d')];});var _0x53e92b=_[_0x0a9e('0x16e')](this[_0x0a9e('0x20')],function(_0xd886e5){return _0xd886e5[_0x0a9e('0x16f')]&&_0xd886e5[_0x0a9e('0xb1')]===_0x0a9e('0x170');});if(_0x184453[_0x0a9e('0x9a')]>0x0&&_0x53e92b[_0x0a9e('0x9a')]>0x0){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_[_0x0a9e('0x171')](_0x184453,'id'),previewRecallmeReminderInterval,_[_0x0a9e('0x171')](_0x53e92b,'id')))[_0x0a9e('0xb9')](function(_0x3e31dc){for(var _0x2efc65=0x0;_0x2efc65<_0x3e31dc['length'];_0x2efc65++){var _0x20ebd0=_0x3e31dc[_0x2efc65][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x20ebd0)io['to'](util['format'](_0x0a9e('0x166'),_0x20ebd0))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x3e31dc[_0x2efc65]});}})[_0x0a9e('0xba')](function(_0x56f175){logger[_0x0a9e('0x98')](_0x0a9e('0x163'),_0x56f175);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0a9e('0x1a')][_0x0a9e('0x172')]=function(){var _0x4e8eb9=this;var _0x2b263b;for(var _0x1634cc in this[_0x0a9e('0x1f')]){if(typeof this[_0x0a9e('0x1f')][_0x1634cc]!=='undefined'){_0x2b263b=this['campaigns'][_0x1634cc];if(isCampaignIvr(_0x2b263b[_0x0a9e('0x4d')])&&isActive(_0x2b263b[_0x0a9e('0x7b')])){_0x2b263b[_0x0a9e('0xa1')]=!![];Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](checkIsActive(_0x2b263b,_0x2b263b[_0x0a9e('0x7b')]))[_0x0a9e('0xb9')](checkInterval(_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x147')](_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x173')](_0x2b263b[_0x0a9e('0x169')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b[_0x0a9e('0x41')],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x14b')](_0x2b263b[_0x0a9e('0x44')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b['name'],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x174')](_0x2b263b))['catch'](loggerCatchQueueSummary(_0x0a9e('0x175'),_0x2b263b));}else{notSendMessagesCampaign(_0x2b263b);}}}};function getCallerIdRandom(_0xe81ac2,_0x2e3df6){var _0x12a7e;var _0x56caca;var _0x59ce14;if(_0x2e3df6<=0x0){_0x2e3df6=0x1;}_0x12a7e=new RegExp(_0x0a9e('0x176')+_0x2e3df6+'}$');_0x56caca=Math[_0x0a9e('0x177')](0xa,_0x2e3df6-0x1);_0x59ce14=Math[_0x0a9e('0x177')](0xa,_0x2e3df6)-0x1;return util[_0x0a9e('0x7f')]('%s',_['replace'](_0xe81ac2,_0x12a7e,_[_0x0a9e('0x178')](_0x56caca,_0x59ce14)));}function extractCalleridName(_0xc1811b){var _0xa64f55=_0xc1811b[_0x0a9e('0x179')](/"(.*?)"/);return _0xa64f55?_0xa64f55[0x1]:_0xc1811b;}Dialer[_0x0a9e('0x1a')]['actionOriginate']=function(_0x5cfe15,_0x35b0e6){var _0x3cfcc3=this;var _0x45aa98=uuid['v4']();this[_0x0a9e('0x24')][_0x45aa98]=new Action(_0x5cfe15,_0x35b0e6,_0x45aa98);return new Promise(function(_0x126620,_0x25f447){if(_[_0x0a9e('0x3e')](_0x5cfe15)&&typeof _0x5cfe15!=='object'){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),_0x0a9e('0x17b')));}if(_['isUndefined'](_0x35b0e6['phone'])||_0x35b0e6['phone']===null){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),'contact\x20is\x20undefine'));}var _0x419d9e={'XMD-CALLERID':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AGI':_0x5cfe15['dialQueueProject']?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15[_0x0a9e('0x10f')]):_0x0a9e('0x17e'),'XMD-AGIAFTER':_0x5cfe15[_0x0a9e('0x115')]?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15['dialQueueProject2']):'NONE','XMD-QUEUE':_0x5cfe15[_0x0a9e('0x4d')]==='outbound'?util[_0x0a9e('0x7f')](_0x0a9e('0x17f'),_0x5cfe15[_0x0a9e('0x41')],_0x5cfe15['dialQueueOptions']||'',_0x5cfe15[_0x0a9e('0x116')]?'c':'',_0x5cfe15[_0x0a9e('0x11f')]||0x3):_0x0a9e('0x17e'),'XMD-CONTACTID':_0x35b0e6['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AMD':_0x5cfe15[_0x0a9e('0xe6')]?_0x0a9e('0x180'):_0x0a9e('0x17e'),'XMD-DESTINATION':_0x0a9e('0x181')};if(_0x5cfe15['dialAMDActive']){_0x419d9e['XMD-AMDINITIALSILENCE']=_0x5cfe15[_0x0a9e('0x182')]||0x9c4;_0x419d9e[_0x0a9e('0x183')]=_0x5cfe15['dialAMDGreeting']||0x5dc;_0x419d9e['XMD-AMDAFTERGREETINGSILENCE']=_0x5cfe15['dialAMDAfterGreetingSilence']||0x320;_0x419d9e['XMD-AMDTOTALANALYSISTIME']=_0x5cfe15['dialAMDTotalAnalysisTime']||0x1388;_0x419d9e['XMD-AMDMINWORDLENGTH']=_0x5cfe15[_0x0a9e('0x184')]||0x64;_0x419d9e['XMD-AMDBETWEENWORDSSILENCE']=_0x5cfe15[_0x0a9e('0x185')]||0x32;_0x419d9e[_0x0a9e('0x186')]=_0x5cfe15[_0x0a9e('0x187')]||0x3;_0x419d9e[_0x0a9e('0x188')]=_0x5cfe15[_0x0a9e('0x189')]||0x100;_0x419d9e[_0x0a9e('0x18a')]=_0x5cfe15[_0x0a9e('0x18b')]||0x1388;}if(_0x5cfe15['type']===_0x0a9e('0x18c')){_0x419d9e[_0x0a9e('0x18d')]=_0x35b0e6[_0x0a9e('0xdb')];}else{_0x419d9e[_0x0a9e('0x18e')]=_0x35b0e6[_0x0a9e('0xdc')];}for(var _0x3d2589 in _0x35b0e6[_0x0a9e('0x18f')]){if(typeof _0x35b0e6[_0x0a9e('0x18f')][_0x3d2589]!==_0x0a9e('0x9b')){if(isNotNull(_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589])&&_0x3d2589!=='id'&&_0x3d2589!==_0x0a9e('0x190')&&_0x3d2589!=='createdAt'&&_0x3d2589!==_0x0a9e('0x191')){_0x419d9e[util[_0x0a9e('0x7f')]('%s%s',_0x0a9e('0x192'),_['toUpper'](_0x3d2589))]=_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589];}}}var _0x34b3d8=_0x3cfcc3['isTrunkReachable'](_0x5cfe15['Trunk'])?getCallerId(_0x5cfe15[_0x0a9e('0x7a')]['callerid'],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15[_0x0a9e('0x193')]):_0x5cfe15[_0x0a9e('0x5c')]):getCallerId(_['isNil'](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15['Trunk']['callerid']:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x195')],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15['dialRandomLastDigitCallerIdNumber']):_0x5cfe15[_0x0a9e('0x5c')]);if(_0x34b3d8){_0x419d9e[_0x0a9e('0x196')]=_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x197')]=extractCalleridName(_0x34b3d8);_0x419d9e['XMD-ORIGINATECALLERIDNUM']=_0x35b0e6[_0x0a9e('0x198')];}_0x5cfe15[_0x0a9e('0x199')]=_0x419d9e;return ami['Action']({'actionid':_0x45aa98,'action':_0x0a9e('0x17a'),'channel':_0x3cfcc3[_0x0a9e('0xe1')](_0x5cfe15[_0x0a9e('0x7a')])?util[_0x0a9e('0x7f')]('SIP/%s/%s%s',_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15['dialCutDigit']>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15['dialCutDigit']):_0x35b0e6[_0x0a9e('0x198')]):util['format'](_0x0a9e('0x19c'),_[_0x0a9e('0xaf')](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')]:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15[_0x0a9e('0x19d')]>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15[_0x0a9e('0x19d')]):_0x35b0e6[_0x0a9e('0x198')]),'callerid':_0x34b3d8,'Exten':'xcally-motion-dialer','Context':_0x0a9e('0x19e'),'Priority':'1','variable':_0x419d9e,'timeout':(_0x5cfe15[_0x0a9e('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45aa98})[_0x0a9e('0xb9')](function(_0xf35801){return _0x126620(_0xf35801);})[_0x0a9e('0xba')](function(_0x3d7d73){_0x5cfe15[_0x0a9e('0x67')]+=0x1;var _0x1fbf62=new History(_0x3cfcc3['actions'][_0x45aa98]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x0a9e('0x4a')](_0x3d7d73)));_0x1fbf62['state']=0xe;_0x1fbf62['statedesc']='OriginateError';_0x1fbf62[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x1fbf62[_0x0a9e('0xa8')]=_0x1fbf62['starttime'];_0x3cfcc3['createHistory'](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x19f')));_0x3cfcc3[_0x0a9e('0xcf')](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch('[originate][error]'))[_0x0a9e('0x13c')](function(){delete _0x3cfcc3[_0x0a9e('0x24')][_0x45aa98];return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x49'),_0x0a9e('0x1a0')));});});});};Dialer[_0x0a9e('0x1a')]['syncOriginateResponse']=function(_0x298a78){var _0x5056d5=this['actions'][_0x298a78[_0x0a9e('0x131')]];if(_0x5056d5){delete this['actions'][_0x298a78[_0x0a9e('0x131')]];_0x5056d5[_0x0a9e('0x11e')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0xe87eb3=_0x5056d5[_0x0a9e('0x4d')]===_0x0a9e('0x7e')?this[_0x0a9e('0x1f')][_0x5056d5[_0x0a9e('0xb5')]]:this['voiceQueues'][_0x5056d5[_0x0a9e('0x1a1')]()];if(!this[_0x0a9e('0xdf')](_0x298a78['response'])){this[_0x0a9e('0xb4')](_0xe87eb3);return this[_0x0a9e('0x1a2')](_0x5056d5,_0xe87eb3,_0x298a78)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a3')));}this['uniqueId'][_0x298a78[_0x0a9e('0xe9')]]=_0x5056d5;}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1a4')]=function(_0x44b14c,_0x1aa179,_0x5840d5){var _0x4c08b3=new History(_0x1aa179);if(_0x4c08b3[_0x0a9e('0x107')]+_0x4c08b3['countcongestionretry']+_0x4c08b3[_0x0a9e('0x1a5')]+_0x4c08b3['countnosuchnumberretry']+_0x4c08b3[_0x0a9e('0x109')]+_0x4c08b3['countabandonedretry']+_0x4c08b3[_0x0a9e('0xf6')]+_0x4c08b3['countagentrejectretry']>=_0x5840d5[_0x0a9e('0xfc')]-0x1){return!![];}switch(_0x44b14c){case 0x3:if(_0x4c08b3[_0x0a9e('0x1a5')]>=_0x5840d5[_0x0a9e('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4c08b3['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5['dialNoAnswerRetryFrequency'],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a7')));break;case 0x5:if(_0x4c08b3[_0x0a9e('0x107')]>=_0x5840d5[_0x0a9e('0x1a8')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countbusyretry':_0x4c08b3[_0x0a9e('0x107')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1a9')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4c08b3[_0x0a9e('0xf9')]>=_0x5840d5['dialCongestionMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countcongestionretry':_0x4c08b3['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1aa')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ab')));break;case 0x0:if(_0x4c08b3['countnosuchnumberretry']>=_0x5840d5[_0x0a9e('0x1ac')]-0x1){return!![];}else{this[_0x0a9e('0x10b')]({'active':![],'countnosuchnumberretry':_0x4c08b3[_0x0a9e('0x108')]+=0x1,'scheduledat':moment()['add'](_0x5840d5['dialNoSuchNumberRetryFrequency'],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ad')));}break;case 0xa:if(_0x4c08b3['countdropretry']>=_0x5840d5[_0x0a9e('0x126')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4c08b3['countdropretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x122')],'minutes')['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));break;case 0xb:if(_0x4c08b3['countabandonedretry']>=_0x5840d5['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x4c08b3[_0x0a9e('0xfa')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1ae')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x12e')));break;case 0x13:if(_0x4c08b3[_0x0a9e('0xf6')]>=_0x5840d5[_0x0a9e('0xfe')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0x4c08b3[_0x0a9e('0xf6')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));break;case 0x14:if(_0x4c08b3[_0x0a9e('0xfb')]>=_0x5840d5[_0x0a9e('0x1af')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countagentrejectretry':_0x4c08b3[_0x0a9e('0xfb')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1b0')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3['ListId'],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1b1')));break;default:return!![];}};Dialer['prototype'][_0x0a9e('0x1a2')]=function(_0x174487,_0x5cacc0,_0x15f892){var _0x22b47b=this;var _0x57d648=new History(_0x174487);var _0x4b24bd=![];var _0x5a7379;var _0x34f612;return new Promise(function(_0x2d6673,_0x25bc80){if(_['isUndefined'](_0x5cacc0)&&typeof _0x5cacc0!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0x14c'),_0x0a9e('0x1b3')));}if(_[_0x0a9e('0x3e')](_0x15f892)&&typeof _0x15f892!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),'Failure','evt\x20is\x20undefine'));}_0x22b47b[_0x0a9e('0xbe')](_0x57d648,_0x15f892[_0x0a9e('0x114')],_0x5cacc0)[_0x0a9e('0xb9')](function(_0x5763cb){if(_0x5763cb[_0x0a9e('0x125')]==0x1)_0x4b24bd=!![];switch(_0x15f892[_0x0a9e('0x114')]){case'0':_0x5cacc0[_0x0a9e('0x66')]+=0x1;_0x57d648['state']=0x0;_0x57d648['statedesc']=_0x0a9e('0x1b4');_0x57d648[_0x0a9e('0x108')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x0a9e('0xef')](_0x174487,'nosuchnumber'));_0x5a7379=_0x5cacc0['dialNoSuchNumberRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x22b47b['checkRetriveMax'](0x0,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x108')]>=_0x5cacc0[_0x0a9e('0x1ac')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}}break;case'3':_0x5cacc0[_0x0a9e('0x65')]+=0x1;_0x57d648['state']=0x3;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1b6');_0x57d648[_0x0a9e('0x1a5')]+=0x1;_0x57d648['countglobal']+=0x1;var _0x10f9fe=ut[_0x0a9e('0x1b7')](_0x174487,_0x5cacc0);ami[_0x0a9e('0xed')]('custom:agentnoanswer',_0x10f9fe);_0x5a7379=_0x5cacc0[_0x0a9e('0x1b8')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1b9')));if(_0x22b47b[_0x0a9e('0x1a4')](0x3,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x1a5')]>=_0x5cacc0[_0x0a9e('0x1a6')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}}break;case'5':_0x5cacc0['outboundBusyCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x5;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1bb');_0x57d648[_0x0a9e('0x107')]+=0x1;_0x57d648['countglobal']+=0x1;ami[_0x0a9e('0xed')](_0x0a9e('0x1bc'),ut['buildObj'](_0x174487,_0x0a9e('0x1bd')));_0x5a7379=_0x5cacc0[_0x0a9e('0x1a9')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1be')));if(_0x22b47b[_0x0a9e('0x1a4')](0x5,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]>=_0x5cacc0['dialBusyMaxRetry']){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x205\x20busy');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1bf'));}}break;case'8':_0x5cacc0['outboundCongestionCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x8;_0x57d648[_0x0a9e('0xea')]='Congestion';_0x57d648[_0x0a9e('0xf9')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0['dialCongestionRetryFrequency'];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x174487,_0x0a9e('0x1c0')));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1c1')));if(_0x22b47b[_0x0a9e('0x1a4')](0x8,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648['countcongestionretry']>=_0x5cacc0[_0x0a9e('0x1c2')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x208\x20congestion');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c3'));}}break;case'11':_0x5cacc0[_0x0a9e('0x1c4')]+=0x1;_0x57d648['state']=0xb;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x57d648[_0x0a9e('0xfa')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0[_0x0a9e('0x1ae')];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x12f')));if(_0x22b47b[_0x0a9e('0x1a4')](0xb,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfa')]>=_0x5cacc0[_0x0a9e('0x12d')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}}break;case'20':_0x5cacc0[_0x0a9e('0x69')]+=0x1;_0x57d648['state']=0x14;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1c6');_0x57d648[_0x0a9e('0xfb')]+=0x1;_0x57d648['countglobal']+=0x1;_0x5a7379=_0x5cacc0['dialAgentRejectRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x0a9e('0xef')](_0x174487,'agentreject'));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c7')));if(_0x22b47b[_0x0a9e('0x1a4')](0x14,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0x1af')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c8'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,'reason\x2020\x20agentreject');}}break;default:_0x5cacc0[_0x0a9e('0x6a')]+=0x1;_0x57d648['state']=0xc;_0x57d648[_0x0a9e('0xea')]=_0x15f892['reason'];_0x5a7379=_0x5cacc0[_0x0a9e('0x1b0')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c9')));if(_0x22b47b['checkRetriveMax'](_0x15f892[_0x0a9e('0x114')],_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]+_0x57d648['countcongestionretry']+_0x57d648[_0x0a9e('0x1a5')]+_0x57d648[_0x0a9e('0x108')]+_0x57d648['countdropretry']+_0x57d648[_0x0a9e('0xfa')]+_0x57d648[_0x0a9e('0xf6')]+_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0xfc')]){_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892[_0x0a9e('0x114')]);}else{_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892['reason']);}}}})[_0x0a9e('0xb9')](function(){if(_0x4b24bd){_0x22b47b[_0x0a9e('0xc0')](_0x57d648,_0x5a7379,_0x34f612)[_0x0a9e('0xb9')](function(){return _0x2d6673(0x1);});}});});};Dialer[_0x0a9e('0x1a')]['stateGlobal']=function(_0x19e176,_0x300474,_0x189e15,_0x12bc40){var _0x32c53e=new Final(_0x19e176);_0x32c53e[_0x0a9e('0xa7')]=0xf;_0x32c53e[_0x0a9e('0xea')]=_0x0a9e('0x1ca');this['createStateFinal'](_0x32c53e,_0x300474,_0x189e15,_0x12bc40);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xff')]=function(_0x315236,_0x4a80a0,_0x3da853,_0x101e33){this[_0x0a9e('0xcf')](_0x315236)[_0x0a9e('0xb9')](function(){return _0x4a80a0(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0xe0'),_0x101e33));})[_0x0a9e('0xba')](function(){return _0x3da853(msgResponse(_0x0a9e('0x1cb'),_0x0a9e('0x14c'),_0x0a9e('0x1cc')));});};Dialer['prototype'][_0x0a9e('0x8')]=function(_0x3a87e7){var _0x21f245=_0x3a87e7['dialPredictiveOptimizationPercentage']/0x64;var _0x4d473a=_0x3a87e7[_0x0a9e('0x64')]/(_0x3a87e7[_0x0a9e('0x64')]+_0x3a87e7[_0x0a9e('0x60')]);var _0x73014f=Math[_0x0a9e('0x1cd')](_0x3a87e7[_0x0a9e('0x74')]*(_0x3a87e7[_0x0a9e('0x1ce')]/0x64));var _0x236a28=Math[_0x0a9e('0x1cd')](_0x3a87e7['predictiveIntervalAvailable']*(_0x3a87e7[_0x0a9e('0x1cf')]/0x64));var _0x41ae51=_0x3a87e7['available']+_0x3a87e7[_0x0a9e('0x53')];var _0xa0ec15=Math['floor'](_0x3a87e7['erlangCalls']*_0x3a87e7[_0x0a9e('0x8d')]*_0x3a87e7[_0x0a9e('0x71')]*_0x3a87e7[_0x0a9e('0x72')]);if(_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){if(!_['isUndefined'](_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x0a9e('0x1d0'));}if(!_['isUndefined'](_0x3a87e7['handlePredictive'])){loggerPredictive['error'](_0x0a9e('0x1d1'),_0x0a9e('0x1d2'));clearInterval(_0x3a87e7[_0x0a9e('0x92')]);_0x3a87e7[_0x0a9e('0x92')]=undefined;}_0x3a87e7['startProgressive']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1d3'),_0x3a87e7[_0x0a9e('0x79')]);this['handlePower'](_0x3a87e7,0x1);}else if(ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7['startProgressive'])){this[_0x0a9e('0x15f')](_0x3a87e7,0x1);loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x1d4'),_0x3a87e7[_0x0a9e('0x79')],_0x3a87e7[_0x0a9e('0x41')]);_0x3a87e7['erlangCalls']=0x0;_0x3a87e7[_0x0a9e('0x70')]=0x0;}else if(_0x21f245<_0x4d473a&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d7'),_0x0a9e('0x1d8'),_0x4d473a,'startProgressive',_0x3a87e7[_0x0a9e('0x41')]);}else if(_0xa0ec15<_0x3a87e7[_0x0a9e('0x70')]&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d9'),_0x0a9e('0x1da'),_0xa0ec15,_0x0a9e('0x1db'),_0x3a87e7[_0x0a9e('0x70')],_0x0a9e('0x79'),_0x3a87e7[_0x0a9e('0x41')]);}else if(!ifInterval(_0x3a87e7[_0x0a9e('0x1dc')],_0x3a87e7[_0x0a9e('0x79')])&&_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x27')])&&!_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){_0x3a87e7[_0x0a9e('0x27')]=moment()['format'](_0x0a9e('0x104'));loggerPredictive[_0x0a9e('0x82')](_0x3a87e7['name'],'started\x20in\x20predictive\x20at',_0x3a87e7['startPredictive']);this[_0x0a9e('0xc3')](_0x3a87e7[_0x0a9e('0x1dc')])['then'](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))['then'](this[_0x0a9e('0x1de')](_0x3a87e7))['catch'](loggerCatchPredictive(_0x0a9e('0x1df'),_0x3a87e7));}else if(!ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7[_0x0a9e('0x70')]=0x0;_0x3a87e7[_0x0a9e('0x27')]=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e0'),_0x3a87e7['startPredictive']);clearInterval(_0x3a87e7['handlePredictive']);_0x3a87e7['handlePredictive']=undefined;this['averageHandleTime'](_0x3a87e7[_0x0a9e('0x1dc')])[_0x0a9e('0xb9')](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))[_0x0a9e('0xb9')](this['startMethodPredictive'](_0x3a87e7))[_0x0a9e('0xba')](loggerCatchPredictive(_0x0a9e('0x1e1'),_0x3a87e7));}else if(_0x3a87e7[_0x0a9e('0x74')]&&_0x41ae51<_0x3a87e7[_0x0a9e('0x74')]-_0x236a28){freeVariablesPredictive(_0x3a87e7);loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e2'),_0x41ae51,_0x0a9e('0x1e3'),_0x3a87e7[_0x0a9e('0x74')],'-',_0x236a28,'=',_0x3a87e7[_0x0a9e('0x74')]-_0x236a28,')');}else if(_0x3a87e7['predictiveIntervalAvailable']&&_0x41ae51>_0x3a87e7[_0x0a9e('0x74')]+_0x73014f){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41ae51,_0x0a9e('0x1e4'),_0x3a87e7['predictiveIntervalAvailable'],'+',_0x73014f,'=',_0x3a87e7[_0x0a9e('0x74')]+_0x73014f,')');}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1dd')]=function(_0xda737b){var _0x415fce=this;return function(_0x59f11d){return new Promise(function(_0x4bacf7,_0x1428a7){_[_0x0a9e('0x8f')](_0xda737b,_0x59f11d[0x0]);if(checkGetDataPredictive(_0x59f11d[0x0])){var _0x44b401=_0xda737b[_0x0a9e('0x74')]=_0xda737b['talking']+_0xda737b[_0x0a9e('0xa2')];var _0x706802=_0xda737b[_0x0a9e('0x1dc')]*0x3c;var _0x5bba8b=_0x59f11d[0x0][_0x0a9e('0x6d')]+_0x59f11d[0x0]['predictiveIntervalAvgHoldtime'];var _0x479441=(_0x59f11d[0x0][_0x0a9e('0x6b')]+_0x59f11d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59f11d[0x0][_0x0a9e('0x6e')])/_0x59f11d[0x0][_0x0a9e('0x75')];_0xda737b[_0x0a9e('0x71')]=_0x479441>0x0?_0x479441:0x1;switch(_0xda737b['dialPredictiveOptimization']){case _0x0a9e('0x1d6'):var _0x25d456=_0xda737b[_0x0a9e('0x1e5')]/0x64;return _0x415fce[_0x0a9e('0x1e6')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x25d456)[_0x0a9e('0xb9')](function(_0x26fd45){return _0x4bacf7(_0x26fd45);});case _0x0a9e('0x1e7'):var _0x1c3f66=_0xda737b['dialPredictiveOptimizationPercentage']/0x64;return _0x415fce[_0x0a9e('0x1e8')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x1c3f66)[_0x0a9e('0xb9')](function(_0x3ea9f1){return _0x4bacf7(_0x3ea9f1);});default:return _0x1428a7(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),'Unknown\x20Predictive'));}}else{return _0x1428a7(msgResponse('[getDataPredictive]',_0x0a9e('0x14c'),'check\x20failure'));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1ea')]=function(_0x58b3f3){var _0x2eb471=this;return function(_0x239eef){return new Promise(function(_0xc91243,_0x49973b){_[_0x0a9e('0x8f')](_0x58b3f3,_0x239eef[0x0]);if(checkGetDataPredictive(_0x239eef[0x0])){loggerPredictive[_0x0a9e('0x82')](JSON[_0x0a9e('0x4a')](_0x239eef[0x0]));if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){return _0x2eb471[_0x0a9e('0xce')](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x305a4b){var _0x5695b6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x305a4b[0x0][_0x0a9e('0x1ec')];var _0x459efc=_0x58b3f3[_0x0a9e('0x1dc')]*0x3c;var _0x727652=_0x239eef[0x0]['predictiveIntervalAvgTalktime']+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x4fb1ea=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0][_0x0a9e('0x6f')]+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x43ff93=_0x58b3f3['dialPredictiveOptimizationPercentage']/0x64;_0x58b3f3[_0x0a9e('0x73')]=_0x305a4b[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x4fb1ea>0x0?_0x4fb1ea:0x1;return _0x2eb471[_0x0a9e('0x1e6')](_0x5695b6,_0x459efc,_0x727652,_0x4fb1ea,_0x43ff93);})['then'](function(_0x323936){return _0xc91243(_0x323936);})['catch'](function(_0x334e91){return _0x49973b(msgResponse(_0x0a9e('0x1ed'),'Failure',JSON[_0x0a9e('0x4a')](_0x334e91)));});}if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1e7')){return _0x2eb471['getVoiceQueueRtPauses'](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x5608ed){var _0xdbcd6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x5608ed[0x0]['outboundQueuePauses'];var _0x4df5cc=_0x58b3f3['dialPredictiveInterval']*0x3c;var _0x495820=_0x239eef[0x0][_0x0a9e('0x6d')]+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x3d7fb6=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x400b85=_0x58b3f3[_0x0a9e('0x1e5')]/0x64;_0x58b3f3['predictiveIntervalPauses']=_0x5608ed[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x3d7fb6>0x0?_0x3d7fb6:0x1;return _0x2eb471[_0x0a9e('0x1e8')](_0xdbcd6,_0x4df5cc,_0x495820,_0x3d7fb6,_0x400b85);})[_0x0a9e('0xb9')](function(_0x37c272){return _0xc91243(_0x37c272);})[_0x0a9e('0xba')](function(_0xf01ef8){return _0x49973b(msgResponse('[CatchErlangB]',_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0xf01ef8)));});}}else{return _0x49973b(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),_0x0a9e('0x1ee')));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1de')]=function(_0xd66cc3){var _0x2dc3df=this;return function(){var _0x43fd4c=0x0;var _0x10e1b9=Math['floor'](_0xd66cc3[_0x0a9e('0x77')]*0x3e8);if(_0x10e1b9>0x0){_0x10e1b9=_0x10e1b9<0x64?0x64:_0x10e1b9;loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],_0x0a9e('0x1ef'),_0x10e1b9,_0x0a9e('0x4b'));_0xd66cc3[_0x0a9e('0x92')]=setInterval(function(){_0x2dc3df[_0x0a9e('0x92')](_0xd66cc3);loggerPredictiveCalls['info'](_0x0a9e('0x1f0'),_0x43fd4c+=0x1);},_0x10e1b9);}else{loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1f1')]=function(_0x2e082a,_0x4c7e3b){var _0x5d3ad3=this;return function(_0x23b67e){if(_[_0x0a9e('0x48')](_0x23b67e)){if(_[_0x0a9e('0xaf')](_0x4c7e3b[_0x0a9e('0xda')])||!_0x4c7e3b[_0x0a9e('0x1f2')]){if(_0x2e082a['dialMethod']===_0x0a9e('0x7')){_0x2e082a['queueStatusComplete']=_[_0x0a9e('0x3e')](_0x2e082a[_0x0a9e('0x136')])?!![]:_0x2e082a['queueStatusComplete'];var _0x449dd9=uuid['v4']();_0x5d3ad3['actions'][_0x449dd9]=new Action(_0x2e082a,_0x4c7e3b,_0x449dd9);loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x1f3'),_0x449dd9,'queueStatusComplete:\x20',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a['name']);if(_0x2e082a[_0x0a9e('0x136')]){_0x2e082a[_0x0a9e('0x136')]=![];_0x5d3ad3[_0x0a9e('0x134')][_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xb5')]]=[];ami[_0x0a9e('0xb0')]({'actionid':_0x449dd9,'action':'queuestatus','queue':_0x2e082a[_0x0a9e('0x41')]})[_0x0a9e('0xba')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3[_0x0a9e('0x10b')]({'active':![],'ContactId':_0x5d3ad3['actions'][_0x449dd9]['ContactId'],'ListId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9]['VoiceQueueId']||undefined,'CampaignId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];});}else{loggerBooked[_0x0a9e('0x82')]('[booked][checkContactBlack][else]',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a[_0x0a9e('0x41')]);_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3['rescheduleContact']({'active':![],'ContactId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd8')],'ListId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdb')]||undefined,'CampaignId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x1f5')));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];}}else{return _0x5d3ad3['actionOriginate'](_0x2e082a,_0x4c7e3b);}}else{if(getDiff(_0x4c7e3b['scheduledat'])<_0x2e082a[_0x0a9e('0x1f6')]*0x3c){if(_0x4c7e3b[_0x0a9e('0x165')]&&!_0x4c7e3b['Agent']['voicePause']){_0x5d3ad3[_0x0a9e('0x1d')][_0x0a9e('0x139')](_0x4c7e3b['id'])[_0x0a9e('0x13c')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}else{_0x5d3ad3[_0x0a9e('0xc7')]({'active':![]},_0x4c7e3b['id'],0x1)['finally'](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}}else{_0x2e082a['outboundReCallsDay']+=0x1;_0x5d3ad3['updateOriginated'](_0x2e082a);if(_0x2e082a[_0x0a9e('0x1f7')]){_0x5d3ad3['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c7e3b[_0x0a9e('0xd8')],'ListId':_0x4c7e3b['ListId'],'VoiceQueueId':_0x4c7e3b[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c7e3b['CampaignId']||undefined})['catch'](loggerCatch(_0x0a9e('0x1f8')));_0x5d3ad3[_0x0a9e('0xd1')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1f9'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5d3ad3[_0x0a9e('0xd6')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fa'),0x16,'RecallFailedTimeout'),_0x0a9e('0x1fb'),'[Originate][HistoryRecallClose]');}}}}else{_0x2e082a[_0x0a9e('0x61')]+=0x1;_0x5d3ad3['saveInDb'](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fc'),0xd,_0x0a9e('0x1fd')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1fe')]=function(_0x149a5d){var _0x2f8a0a=this;var _0x311544=_0x149a5d[_0x0a9e('0x1ff')]-_0x149a5d[_0x0a9e('0x76')]-_0x149a5d[_0x0a9e('0xca')];emitCampaignSummary(_0x149a5d);if(_0x311544>0x0){if(_0x311544>this[_0x0a9e('0x22')]){_0x311544=this[_0x0a9e('0x22')];}_0x149a5d[_0x0a9e('0xca')]+=_0x311544;this[_0x0a9e('0xcc')](_0x149a5d['id'],_0x311544,_0x149a5d[_0x0a9e('0x200')],_0x149a5d)[_0x0a9e('0xb9')](function(_0x2e8669){_0x149a5d['temp']-=_0x311544;_0x149a5d['temp']=_0x149a5d[_0x0a9e('0xca')]>0x0?_0x149a5d[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x2e8669)){_0x149a5d[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger['info'](_0x0a9e('0x201')+_0x149a5d['name']);}else{_0x149a5d[_0x0a9e('0x76')]+=_0x2e8669['length'];_0x149a5d[_0x0a9e('0x3f')]='RUNNING';for(var _0x50985c=0x0;_0x50985c<_0x2e8669[_0x0a9e('0x9a')];_0x50985c+=0x1){_0x149a5d[_0x0a9e('0x202')]+=0x1;if(_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c])||_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c]['Contact'])||_['isNil'](_0x2e8669[_0x50985c][_0x0a9e('0x198')])){_0x2f8a0a['emptyContact'](_0x0a9e('0x203'),_0x149a5d,_0x2e8669[_0x50985c]);}else{_0x2f8a0a[_0x0a9e('0xc2')](_['pick'](_0x2e8669[_0x50985c],[_0x0a9e('0xdc'),'Contact.phone']))[_0x0a9e('0xb9')](_0x2f8a0a[_0x0a9e('0x1f1')](_0x149a5d,_0x2e8669[_0x50985c]))[_0x0a9e('0xba')](_0x2f8a0a[_0x0a9e('0xd4')](_0x0a9e('0x204'),_0x149a5d));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x205'),_0x149a5d,_0x311544));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x15f')]=function(_0x342861,_0x2d4b26){var _0x2070da=this;var _0x29930d=[];var _0x68d005=_0x2d4b26>=0x1?_0x2d4b26:0x1;if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x68d005=0x1;}var _0x5b42ef=Math[_0x0a9e('0x206')](_0x342861[_0x0a9e('0xa2')]*_0x68d005)-_0x342861[_0x0a9e('0x76')]-_0x342861['temp'];emitVoiceQueueSummary(_0x342861);if(_0x342861[_0x0a9e('0x207')]>0x0){var _0x312cf5=_0x342861[_0x0a9e('0x207')]-_0x342861[_0x0a9e('0x76')]-_0x342861[_0x0a9e('0x53')]-_0x342861[_0x0a9e('0xca')]-_0x342861[_0x0a9e('0x50')];if(_0x5b42ef>_0x312cf5){_0x5b42ef=_0x312cf5;}}if(_0x5b42ef>0x0){if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x5b42ef=0x1;}if(_0x5b42ef>this[_0x0a9e('0x22')]){_0x5b42ef=this[_0x0a9e('0x22')];}_0x342861['temp']+=_0x5b42ef;for(var _0x189849 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x189849]!=='undefined'){if(this[_0x0a9e('0x20')][_0x189849]['state']==='not_inuse'&&this[_0x0a9e('0x20')][_0x189849]['status']===_0x0a9e('0x170')){_0x29930d['push'](this[_0x0a9e('0x20')][_0x189849]['id']);}}}this[_0x0a9e('0xc9')](_0x342861['id'],_0x29930d,_0x5b42ef,_0x342861[_0x0a9e('0x200')],_0x342861)['then'](function(_0x1676f3){_0x342861['temp']-=_0x5b42ef;_0x342861['temp']=_0x342861[_0x0a9e('0xca')]>0x0?_0x342861[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x1676f3)){_0x2070da[_0x0a9e('0xb8')](_0x342861)[_0x0a9e('0xb9')](sendMessageReschedule(_0x342861))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x342861['originated']+=_0x1676f3[_0x0a9e('0x9a')];_0x342861[_0x0a9e('0x3f')]=_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')?_0x0a9e('0x180'):'RUNNING';for(var _0xda6cd8=0x0;_0xda6cd8<_0x1676f3[_0x0a9e('0x9a')];_0xda6cd8+=0x1){if(_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x198')])){_0x2070da[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x342861,_0x1676f3[_0xda6cd8]);}else{_0x2070da[_0x0a9e('0xbc')](_[_0x0a9e('0xd7')](_0x1676f3[_0xda6cd8],[_0x0a9e('0xdb'),_0x0a9e('0x20a')]))['then'](_0x2070da['checkContactBlack'](_0x342861,_0x1676f3[_0xda6cd8]))[_0x0a9e('0xba')](_0x2070da[_0x0a9e('0xd4')]('[actionOriginate]\x20',_0x342861));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x20b'),_0x342861,_0x5b42ef));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x92')]=function(_0x2fdb67){if(_0x2fdb67['dialLimitQueue']>0x0){var _0x5d85ab=_0x2fdb67['dialLimitQueue']-_0x2fdb67[_0x0a9e('0x76')]-_0x2fdb67[_0x0a9e('0x53')];if(_0x5d85ab>0x0){this[_0x0a9e('0x20c')](_0x2fdb67);}else{loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x20d'));}}else{this[_0x0a9e('0x20c')](_0x2fdb67);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x20c')]=function(_0x44c694){var _0x4ee67f=this;var _0x4a0c23=[];_0x44c694[_0x0a9e('0x76')]+=0x1;for(var _0x45fac7 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x45fac7]!==_0x0a9e('0x9b')){if(this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xa7')]===_0x0a9e('0x20e')&&this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xb1')]==='reachable'){_0x4a0c23[_0x0a9e('0x150')](this['agents'][_0x45fac7]['id']);}}}this['getContactDialer'](_0x44c694['id'],_0x4a0c23,0x1,_0x44c694[_0x0a9e('0x200')],_0x44c694)[_0x0a9e('0xb9')](function(_0x115423){if(!checkContactEmpty(_0x115423)){checkContactLowerLimitOriginate(_0x44c694,0x1,0x0);_0x4ee67f[_0x0a9e('0xb8')](_0x44c694)[_0x0a9e('0xb9')](sendMessageReschedule(_0x44c694))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x44c694[_0x0a9e('0x3f')]=_0x0a9e('0x20f');if(_['isNil'](_0x115423[0x0])||_[_0x0a9e('0xaf')](_0x115423[0x0][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x115423[0x0]['phone'])){_0x4ee67f[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x44c694,_0x115423[0x0]);}else{_0x4ee67f['checkIsBlackList'](_['pick'](_0x115423[0x0],['VoiceQueueId','Contact.phone']))[_0x0a9e('0xb9')](_0x4ee67f[_0x0a9e('0x1f1')](_0x44c694,_0x115423[0x0]))['catch'](_0x4ee67f[_0x0a9e('0xd4')]('[actionOriginatePredictive]\x20',_0x44c694));}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x210'),_0x44c694,0x1));emitVoiceQueueSummary(_0x44c694);};Dialer[_0x0a9e('0x1a')]['abandonmentRate']=function(_0x5976d2,_0x4165be,_0x14c011,_0xb68b,_0x42d9ca,_0x1a1cb2){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x211'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x212'),_0x5976d2);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x213'),_0x4165be);loggerPredictive['info'](_0x0a9e('0x214'),_0x14c011);loggerPredictive[_0x0a9e('0x82')]('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',_0xb68b);loggerPredictive['info'](_0x0a9e('0x215'),_0x42d9ca);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x3366f2,_0x31981e){if(_0x5976d2<=0x0||isNaN(_0x5976d2)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),_0x0a9e('0x216')+_0x5976d2));}if(_0x14c011<=0x0||isNaN(_0x14c011)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),'Ts\x20=\x20'+_0x14c011));}if(_0xb68b<=0x0||isNaN(_0xb68b)){return _0x31981e(msgResponse('[abandonmentRate]','Error',_0x0a9e('0x217')+_0xb68b));}if(_0x4165be<=0x0||isNaN(_0x4165be)){return _0x31981e(msgResponse(_0x0a9e('0x218'),'Error','interval\x20=\x20'+_0x4165be));}if(_0x42d9ca<=0x0||isNaN(_0x42d9ca)){return _0x31981e(msgResponse(_0x0a9e('0x218'),_0x0a9e('0x49'),_0x0a9e('0x219')+_0x42d9ca));}_0x1a1cb2=_0x1a1cb2||0x0;var _0x1682dc=0x1/_0x14c011;var _0x5db09e=0x0;var _0xe9bc8e=0x0;var _0x3eac52=0x0;var _0x12d833=0x0;for(var _0x483d88=0x0;_0x3eac52<_0x42d9ca;_0x483d88+=0x1){_0xe9bc8e=_0x483d88/_0x4165be;_0x5db09e=(_0xb68b*_0xe9bc8e+_0x1a1cb2)/_0x1682dc;_0x3eac52=erlangb(_0x5db09e,_0x5976d2);_0x12d833=_0x5db09e/_0x5976d2*(0x1-erlangb(_0x5db09e,_0x5976d2));}return _0x3366f2({'erlangCalls':_0x483d88,'erlangCallToSecond':_0x4165be/_0x483d88,'erlangAbandonmentRate':_0x3eac52,'erlangBusyFactor':_0x12d833});});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1e8')]=function(_0x400f7a,_0x3a1953,_0x2cdbbf,_0x5a240f,_0x5b862a,_0x171660){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21a'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x400f7a);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a1953);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x214'),_0x2cdbbf);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21b'),_0x5a240f);loggerPredictive[_0x0a9e('0x82')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b862a);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x34f39f,_0x2e40a9){if(_0x400f7a<=0x0||isNaN(_0x400f7a)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x216')+_0x400f7a));}if(_0x2cdbbf<=0x0||isNaN(_0x2cdbbf)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),_0x0a9e('0x49'),_0x0a9e('0x21d')+_0x2cdbbf));}if(_0x5a240f<=0x0||isNaN(_0x5a240f)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x217')+_0x5a240f));}if(_0x3a1953<=0x0||isNaN(_0x3a1953)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error','interval\x20=\x20'+_0x3a1953));}if(_0x5b862a<=0x0||isNaN(_0x5b862a)){return _0x2e40a9(msgResponse('[busyFactor]',_0x0a9e('0x49'),_0x0a9e('0x21e')+_0x5b862a));}_0x171660=_0x171660||0x0;var _0x4dafc8=0x1/_0x2cdbbf;var _0x23fc30=0x0;var _0x5e2a11=0x0;var _0x58503f=0x0;var _0x4b1969=0x0;for(var _0x4e0508=0x0;_0x4b1969<_0x5b862a;_0x4e0508+=0x1){_0x5e2a11=_0x4e0508/_0x3a1953;_0x23fc30=(_0x5a240f*_0x5e2a11+_0x171660)/_0x4dafc8;_0x58503f=erlangb(_0x23fc30,_0x400f7a);_0x4b1969=_0x23fc30/_0x400f7a*(0x1-erlangb(_0x23fc30,_0x400f7a));}return _0x34f39f({'erlangCalls':_0x4e0508,'erlangCallToSecond':_0x3a1953/_0x4e0508,'erlangAbandonmentRate':_0x58503f,'erlangBusyFactor':_0x4b1969});});};module[_0x0a9e('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4cc5592..007f375 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 _0xb506=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x28dee7,_0x566fba){var _0x3a4c76=function(_0x2866e9){while(--_0x2866e9){_0x28dee7['push'](_0x28dee7['shift']());}};_0x3a4c76(++_0x566fba);}(_0xb506,0x18d));var _0x6b50=function(_0x2e10b8,_0x3a2dca){_0x2e10b8=_0x2e10b8-0x0;var _0xb11c09=_0xb506[_0x2e10b8];return _0xb11c09;};'use strict';var util=require(_0x6b50('0x0'));var _=require(_0x6b50('0x1'));var moment=require(_0x6b50('0x2'));function getSeconds(_0xc645bc,_0x42c67c){var _0x2a8f0e=moment(_0xc645bc)[_0x6b50('0x3')](0x0);var _0x2695a5=moment(_0x42c67c)[_0x6b50('0x3')](0x0);return _0x2a8f0e[_0x6b50('0x4')](_0x2695a5,'seconds');}function QueueCallerAbandon(_0x171d0a,_0x59a756){this[_0x6b50('0x5')]=_0x171d0a['scheduledat'];this[_0x6b50('0x6')]=_0x171d0a['type'];this[_0x6b50('0x7')]=_0x171d0a[_0x6b50('0x6')]===_0x6b50('0x8')?_0x6b50('0x9'):_0x171d0a[_0x6b50('0x6')];this[_0x6b50('0xa')]=_0x171d0a['countbusyretry'];this[_0x6b50('0xb')]=_0x171d0a[_0x6b50('0xb')];this[_0x6b50('0xc')]=_0x171d0a[_0x6b50('0xc')];this['countglobal']=_0x171d0a[_0x6b50('0xa')]+_0x171d0a['countcongestionretry']+_0x171d0a['countnoanswerretry']+_0x171d0a[_0x6b50('0xd')]+_0x171d0a[_0x6b50('0xe')]+_0x171d0a[_0x6b50('0xf')]+_0x171d0a[_0x6b50('0x10')]+_0x171d0a['countagentrejectretry'];this[_0x6b50('0xd')]=_0x171d0a[_0x6b50('0xd')];this[_0x6b50('0xe')]=_0x171d0a[_0x6b50('0xe')];this['countabandonedretry']=_0x171d0a[_0x6b50('0xf')];this[_0x6b50('0x10')]=_0x171d0a['countmachineretry'];this[_0x6b50('0x11')]=_0x171d0a[_0x6b50('0x11')];this[_0x6b50('0x12')]=_0x59a756[_0x6b50('0x12')];this[_0x6b50('0x13')]=_0x171d0a[_0x6b50('0x14')];this[_0x6b50('0x15')]=_0x171d0a['number'];this[_0x6b50('0x16')]=_0x171d0a['starttime'];this[_0x6b50('0x17')]=_0x171d0a['responsetime'];this[_0x6b50('0x18')]=_0x171d0a[_0x6b50('0x18')];this[_0x6b50('0x19')]=this[_0x6b50('0x18')];this[_0x6b50('0x1a')]=getSeconds(_0x171d0a[_0x6b50('0x17')],_0x171d0a['starttime']);this['holdtime']=getSeconds(this[_0x6b50('0x18')],_0x171d0a['responsetime']);this[_0x6b50('0x1b')]=0x0;this['queue']=_0x59a756[_0x6b50('0x9')];this[_0x6b50('0x1c')]=_0x59a756['connectedlinename'];this[_0x6b50('0x1d')]=_0x59a756[_0x6b50('0x1d')];this[_0x6b50('0x1e')]=_0x171d0a[_0x6b50('0x1e')];this[_0x6b50('0x1f')]=_0x171d0a[_0x6b50('0x1f')];this['callbackat']=_0x171d0a[_0x6b50('0x20')];this['recallme']=_0x171d0a['recallme'];this[_0x6b50('0x21')]=_0x171d0a[_0x6b50('0x21')];this[_0x6b50('0x22')]=_0x171d0a['ListId'];this[_0x6b50('0x23')]=_0x171d0a['UserId'];this[_0x6b50('0x24')]=_0x171d0a['VoiceQueueId'];this[_0x6b50('0x25')]=_0x171d0a['CampaignId'];this[_0x6b50('0x26')]=_0x171d0a[_0x6b50('0x26')]||'';this[_0x6b50('0x27')]=_0x171d0a['originatecalleridname']||'';}module[_0x6b50('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x31e5=['ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','starttime','responsetime','droptime','endtime'];(function(_0x27d15e,_0x5e7c33){var _0x19ac9f=function(_0x14c3ed){while(--_0x14c3ed){_0x27d15e['push'](_0x27d15e['shift']());}};_0x19ac9f(++_0x5e7c33);}(_0x31e5,0xde));var _0x531e=function(_0xeae565,_0x4a4bfd){_0xeae565=_0xeae565-0x0;var _0x30a53e=_0x31e5[_0xeae565];return _0x30a53e;};'use strict';var util=require(_0x531e('0x0'));var _=require('lodash');var moment=require(_0x531e('0x1'));function getSeconds(_0x5d59f3,_0xa4c1fa){var _0x1069e2=moment(_0x5d59f3)[_0x531e('0x2')](0x0);var _0x5718ce=moment(_0xa4c1fa)[_0x531e('0x2')](0x0);return _0x1069e2[_0x531e('0x3')](_0x5718ce,_0x531e('0x4'));}function QueueCallerAbandon(_0x3aa00c,_0x1f89c1){this['scheduledat']=_0x3aa00c[_0x531e('0x5')];this[_0x531e('0x6')]=_0x3aa00c[_0x531e('0x6')];this['campaigntype']=_0x3aa00c[_0x531e('0x6')]==='outbound'?_0x531e('0x7'):_0x3aa00c[_0x531e('0x6')];this[_0x531e('0x8')]=_0x3aa00c[_0x531e('0x8')];this[_0x531e('0x9')]=_0x3aa00c[_0x531e('0x9')];this[_0x531e('0xa')]=_0x3aa00c[_0x531e('0xa')];this[_0x531e('0xb')]=_0x3aa00c[_0x531e('0x8')]+_0x3aa00c[_0x531e('0x9')]+_0x3aa00c['countnoanswerretry']+_0x3aa00c['countnosuchnumberretry']+_0x3aa00c[_0x531e('0xc')]+_0x3aa00c[_0x531e('0xd')]+_0x3aa00c[_0x531e('0xe')]+_0x3aa00c[_0x531e('0xf')];this[_0x531e('0x10')]=_0x3aa00c['countnosuchnumberretry'];this[_0x531e('0xc')]=_0x3aa00c[_0x531e('0xc')];this['countabandonedretry']=_0x3aa00c[_0x531e('0xd')];this[_0x531e('0xe')]=_0x3aa00c[_0x531e('0xe')];this[_0x531e('0xf')]=_0x3aa00c[_0x531e('0xf')];this[_0x531e('0x11')]=_0x1f89c1[_0x531e('0x11')];this[_0x531e('0x12')]=_0x3aa00c[_0x531e('0x13')];this['calleridnum']=_0x3aa00c['number'];this['starttime']=_0x3aa00c[_0x531e('0x14')];this[_0x531e('0x15')]=_0x3aa00c[_0x531e('0x15')];this[_0x531e('0x16')]=_0x3aa00c[_0x531e('0x16')];this[_0x531e('0x17')]=this[_0x531e('0x16')];this[_0x531e('0x18')]=getSeconds(_0x3aa00c[_0x531e('0x15')],_0x3aa00c[_0x531e('0x14')]);this[_0x531e('0x19')]=getSeconds(this[_0x531e('0x16')],_0x3aa00c[_0x531e('0x15')]);this[_0x531e('0x1a')]=0x0;this[_0x531e('0x7')]=_0x1f89c1[_0x531e('0x7')];this[_0x531e('0x1b')]=_0x1f89c1[_0x531e('0x1c')];this['reason']=_0x1f89c1[_0x531e('0x1d')];this[_0x531e('0x1e')]=_0x3aa00c[_0x531e('0x1e')];this[_0x531e('0x1f')]=_0x3aa00c[_0x531e('0x1f')];this[_0x531e('0x20')]=_0x3aa00c[_0x531e('0x20')];this[_0x531e('0x21')]=_0x3aa00c[_0x531e('0x21')];this[_0x531e('0x22')]=_0x3aa00c[_0x531e('0x22')];this['ListId']=_0x3aa00c['ListId'];this['UserId']=_0x3aa00c[_0x531e('0x23')];this[_0x531e('0x24')]=_0x3aa00c[_0x531e('0x24')];this[_0x531e('0x25')]=_0x3aa00c[_0x531e('0x25')];this[_0x531e('0x26')]=_0x3aa00c[_0x531e('0x26')]||'';this[_0x531e('0x27')]=_0x3aa00c[_0x531e('0x27')]||'';}module[_0x531e('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e95dd12..64ce83e 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(_0x46c532,_0x795bc6){var _0x40715d=function(_0xdf8b98){while(--_0xdf8b98){_0x46c532['push'](_0x46c532['shift']());}};_0x40715d(++_0x795bc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x33c5ea,_0x1c0fa8){var _0x3c5498=function(_0x427eb0){while(--_0x427eb0){_0x33c5ea['push'](_0x33c5ea['shift']());}};_0x3c5498(++_0x1c0fa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 1c1a922..acbfdd3 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 _0x976a=['tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','name','info','\x20syncNewchannel\x20','actions','prototype','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','message','parse','application/pdf','then','.pdf','catch','error','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','path'];(function(_0xf6e566,_0x13f9b3){var _0x3e93f1=function(_0x5a5857){while(--_0x5a5857){_0xf6e566['push'](_0xf6e566['shift']());}};_0x3e93f1(++_0x13f9b3);}(_0x976a,0x6d));var _0xa976=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0x976a[_0x169a8a];return _0x2e8502;};'use strict';var util=require(_0xa976('0x0'));var _=require(_0xa976('0x1'));var BPromise=require(_0xa976('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xa976('0x3'));var tiff2pdf=require(_0xa976('0x4'));var gs=require(_0xa976('0x5'));var logger=require(_0xa976('0x6'))(_0xa976('0x7'));var ami=require(_0xa976('0x8'));var rpcDb=require(_0xa976('0x9'));var Channel=require(_0xa976('0xa'));var ut=require('./util/util');var Action=require(_0xa976('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xa976('0xc'));function Fax(_0xaa923e){this[_0xa976('0xd')]={};this['faxAccounts']=_0xaa923e[_0xa976('0xe')];this[_0xa976('0xf')]=_0xaa923e[_0xa976('0xf')];this['actions']={};ami['on'](_0xa976('0x10'),this[_0xa976('0x11')][_0xa976('0x12')](this));ami['on'](_0xa976('0x13'),this[_0xa976('0x14')][_0xa976('0x12')](this));ami['on'](_0xa976('0x15'),this['syncNewState'][_0xa976('0x12')](this));ami['on'](_0xa976('0x16'),this[_0xa976('0x17')][_0xa976('0x12')](this));ami['on'](_0xa976('0x18'),this[_0xa976('0x19')][_0xa976('0x12')](this));ami['on'](_0xa976('0x1a'),this[_0xa976('0x1b')][_0xa976('0x12')](this));ami['on']('hangup',this[_0xa976('0x1c')][_0xa976('0x12')](this));ami['on'](_0xa976('0x1d'),this[_0xa976('0x1e')][_0xa976('0x12')](this));}Fax['prototype'][_0xa976('0x11')]=function(_0x4e3317){if(_0x4e3317[_0xa976('0x1f')]===_0xa976('0x20')){for(var _0x23fa4a in this['faxAccounts']){if(this[_0xa976('0xe')][_0xa976('0x21')](_0x23fa4a)){if(_0x4e3317[_0xa976('0x22')]===this[_0xa976('0xe')][_0x23fa4a][_0xa976('0x23')]){this[_0xa976('0xd')][_0x4e3317['uniqueid']]={};this[_0xa976('0xd')][_0x4e3317['uniqueid']]['channel']=_0x4e3317[_0xa976('0x24')];this[_0xa976('0xd')][_0x4e3317[_0xa976('0x25')]]['id']=this[_0xa976('0xe')][_0x23fa4a]['id'];this[_0xa976('0xd')][_0x4e3317['uniqueid']][_0xa976('0x26')]=this[_0xa976('0xe')][_0x23fa4a][_0xa976('0x26')];logger[_0xa976('0x27')](_0x4e3317[_0xa976('0x25')],_0xa976('0x28'));}}}}if(this[_0xa976('0x29')][_0x4e3317[_0xa976('0x25')]]){this[_0xa976('0xd')][_0x4e3317[_0xa976('0x25')]]={};this[_0xa976('0xd')][_0x4e3317[_0xa976('0x25')]][_0xa976('0x24')]=_0x4e3317[_0xa976('0x24')];logger[_0xa976('0x27')](_0x4e3317[_0xa976('0x25')],_0xa976('0x28'));}};Fax[_0xa976('0x2a')]['syncVarSet']=function(_0x1d7733){if(this['channels'][_0x1d7733[_0xa976('0x25')]]){for(var _0x16bc42 in _0x1d7733[_0xa976('0x2b')]){if(_0x1d7733[_0xa976('0x2b')][_0xa976('0x21')](_0x16bc42)){this['channels'][_0x1d7733[_0xa976('0x25')]][_0x16bc42]=_0x1d7733[_0xa976('0x2c')];}}}};Fax[_0xa976('0x2a')]['syncNewState']=function(_0x450d4e){if(this[_0xa976('0xd')][_0x450d4e[_0xa976('0x25')]]){this[_0xa976('0xd')][_0x450d4e[_0xa976('0x25')]][_0xa976('0x2d')]=_0x450d4e['channelstate'];this[_0xa976('0xd')][_0x450d4e['uniqueid']]['channelstatedesc']=_0x450d4e[_0xa976('0x2e')];}};Fax[_0xa976('0x2a')][_0xa976('0x17')]=function(_0x19d9dc){if(this[_0xa976('0xd')][_0x19d9dc[_0xa976('0x25')]]){for(var _0x273b8b in _0x19d9dc[_0xa976('0x2b')]){if(_0x19d9dc[_0xa976('0x2b')][_0xa976('0x21')](_0x273b8b)){this[_0xa976('0xd')][_0x19d9dc[_0xa976('0x25')]][_0x273b8b]=_0x19d9dc[_0xa976('0x2c')];}}}};Fax[_0xa976('0x2a')][_0xa976('0x19')]=function(_0x59b924){if(this[_0xa976('0xd')][_0x59b924[_0xa976('0x25')]]){this[_0xa976('0xd')][_0x59b924['uniqueid']][_0xa976('0x2f')]=_0x59b924[_0xa976('0x2f')];this[_0xa976('0xd')][_0x59b924['uniqueid']]['status']=_0x59b924['status'];this[_0xa976('0xd')][_0x59b924[_0xa976('0x25')]][_0xa976('0x23')]=_0x59b924[_0xa976('0x23')];this[_0xa976('0xd')][_0x59b924[_0xa976('0x25')]][_0xa976('0x30')]=_0x59b924[_0xa976('0x30')];logger['info'](_0x59b924[_0xa976('0x25')],_0xa976('0x31'));}};Fax['prototype'][_0xa976('0x1b')]=function(_0x1e9bf9){var _0x42dd6b=this;if(this['channels'][_0x1e9bf9[_0xa976('0x25')]]){var _0x2c7b99=this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]]['id'];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]][_0xa976('0x32')]=_0x1e9bf9[_0xa976('0x32')];this[_0xa976('0xd')][_0x1e9bf9['uniqueid']][_0xa976('0x33')]=_0x1e9bf9[_0xa976('0x33')];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]][_0xa976('0x23')]=_0x1e9bf9[_0xa976('0x23')];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]][_0xa976('0x34')]=_0x1e9bf9[_0xa976('0x34')];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]]['transferrate']=_0x1e9bf9['transferrate'];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]][_0xa976('0x30')]=_0x1e9bf9[_0xa976('0x30')];this[_0xa976('0xd')][_0x1e9bf9[_0xa976('0x25')]][_0xa976('0x35')]=_0x1e9bf9['calleridnum'];if(this[_0xa976('0xd')][_0x1e9bf9['uniqueid']][_0xa976('0x33')]>0x0){tiff2pdf(_0x1e9bf9[_0xa976('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0xd3dd88){logger['info'](_0x1e9bf9[_0xa976('0x25')],'\x20result\x20conversion\x20file\x20',_0xd3dd88[_0xa976('0x36')]);attachment['create']({'name':path[_0xa976('0x37')](_0x1e9bf9[_0xa976('0x30')])[_0xa976('0x26')],'basename':path[_0xa976('0x37')](_0x1e9bf9[_0xa976('0x30')])[_0xa976('0x26')]+'.pdf','type':_0xa976('0x38')})[_0xa976('0x39')](function(_0x45c430){faxAccount['notify'](_0x2c7b99,{'from':_0x1e9bf9[_0xa976('0x35')],'mapKey':'fax','body':path['parse'](_0x1e9bf9[_0xa976('0x30')])[_0xa976('0x26')]+_0xa976('0x3a'),'AttachmentId':_0x45c430['id']})[_0xa976('0x3b')](function(_0x18e49b){logger[_0xa976('0x3c')](_0x1e9bf9[_0xa976('0x25')],'\x20notify\x20',JSON[_0xa976('0x3d')](_0x18e49b));});})['catch'](function(_0x117ffd){logger[_0xa976('0x3c')](_0x1e9bf9[_0xa976('0x25')],'\x20receiveFax\x20',JSON[_0xa976('0x3d')](_0x117ffd));});});}logger[_0xa976('0x27')](_0x1e9bf9[_0xa976('0x25')],'\x20receiveFax\x20');}};Fax['prototype']['syncOriginateResponse']=function(_0x61068d){if(this[_0xa976('0x29')][_0x61068d['uniqueid']]){_[_0xa976('0x3e')](this['channels'][_0x61068d[_0xa976('0x25')]],_[_0xa976('0x3f')](_0x61068d,[_0xa976('0x40'),_0xa976('0x41')]));}};function updateStatus(_0x12e4ba){if(_0x12e4ba[_0xa976('0x42')]){faxMessage[_0xa976('0x43')](_0x12e4ba[_0xa976('0x42')],{'failMessage':_0xa976('0x44')})[_0xa976('0x39')](function(_0xa7cdf){ut[_0xa976('0x45')](_0xa976('0x46'),_0xa7cdf);})['catch'](function(_0x3854c3){ut[_0xa976('0x45')](_0xa976('0x47'),_0x3854c3);});}else{ut['logger'](_0xa976('0x48'));}}Fax[_0xa976('0x2a')][_0xa976('0x49')]=function(_0x50f6bf,_0x4dd291,_0x34108f){var _0x17ba0c=this;var _0x4e57fe={};if(_0x4dd291){_0x4e57fe={'read':_0x4dd291};}else{_0x4e57fe={'failMessage':_0x34108f};}if(this[_0xa976('0x29')][_0x50f6bf][_0xa976('0x42')]){faxMessage[_0xa976('0x43')](this[_0xa976('0x29')][_0x50f6bf][_0xa976('0x42')],_0x4e57fe)[_0xa976('0x39')](function(_0x53c56e){ut[_0xa976('0x45')](_0xa976('0x4a'),_0x53c56e);})['catch'](function(_0xb84adc){ut[_0xa976('0x45')](_0xa976('0x4b'),_0xb84adc);})['finally'](function(){delete _0x17ba0c['channels'][_0x50f6bf];delete _0x17ba0c[_0xa976('0x29')][_0x50f6bf];});}else{ut[_0xa976('0x45')]('[Fax][Message][NoUpdate2]');delete this[_0xa976('0xd')][_0x50f6bf];delete this[_0xa976('0x29')][_0x50f6bf];}};Fax['prototype'][_0xa976('0x1c')]=function(_0x5f0ab5){var _0x4cdd52=this;if(this[_0xa976('0xd')][_0x5f0ab5[_0xa976('0x25')]]){if(this['actions'][_0x5f0ab5[_0xa976('0x25')]]){this[_0xa976('0xd')][_0x5f0ab5[_0xa976('0x25')]]['id']=this[_0xa976('0x29')][_0x5f0ab5[_0xa976('0x25')]]['id'];this['channels'][_0x5f0ab5[_0xa976('0x25')]]['name']=this['actions'][_0x5f0ab5[_0xa976('0x25')]][_0xa976('0x26')];}logger[_0xa976('0x27')](_0x5f0ab5[_0xa976('0x25')],this['actions'][_0x5f0ab5[_0xa976('0x25')]]?'\x20hangup\x20sendFile\x20':_0xa976('0x4c'),JSON[_0xa976('0x3d')](this[_0xa976('0xd')][_0x5f0ab5[_0xa976('0x25')]]));if(this[_0xa976('0x29')][_0x5f0ab5[_0xa976('0x25')]]){if(this['channels'][_0x5f0ab5[_0xa976('0x25')]][_0xa976('0x4d')]>0x0&&this[_0xa976('0xd')][_0x5f0ab5[_0xa976('0x25')]][_0xa976('0x18')]===_0xa976('0x4e')){this[_0xa976('0x49')](_0x5f0ab5[_0xa976('0x25')],!![]);}else{this[_0xa976('0x49')](_0x5f0ab5['uniqueid'],![],this['channels'][_0x5f0ab5['uniqueid']][_0xa976('0x4f')]?_0xa976('0x50')+this['channels'][_0x5f0ab5[_0xa976('0x25')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xa976('0x2a')][_0xa976('0x51')]=function(_0x1799f1){var _0x3bab81=this;return new BPromise(function(_0x4c159c,_0x2493b1){_0x3bab81[_0xa976('0x52')](_0x1799f1,_0x3bab81[_0xa976('0xe')][_0x1799f1[_0xa976('0x53')]])[_0xa976('0x39')](function(_0x27beaa){ut['logger'](_0xa976('0x54'),_0x27beaa);_0x4c159c(ut[_0xa976('0x36')](_0xa976('0x55')));})[_0xa976('0x3b')](function(_0x54a367){ut[_0xa976('0x45')](_0xa976('0x56'),_0x54a367);updateStatus(_0x1799f1);_0x2493b1(ut['message'](_0xa976('0x57')));});});};Fax[_0xa976('0x2a')]['checkAfterSend']=function(_0x4d704c){var _0x2d582b=this;return new BPromise(function(_0x138131,_0x53edc9){var _0x3fbd16=_0x2d582b[_0xa976('0x58')](_0x2d582b[_0xa976('0xe')][_0x4d704c[_0xa976('0x53')]]['Trunk'],_0x4d704c);if(_0x3fbd16[_0xa976('0x59')]){_0x138131(ut['message'](_0xa976('0x5a')));}else{_0x53edc9(ut[_0xa976('0x36')](_0x3fbd16[_0xa976('0x36')]));}});};function originate(_0x26c275,_0x12322e,_0x119897){return new BPromise(function(_0x37aa38,_0xb3e0c0){if(_0x119897){var _0x3e78a2=util[_0xa976('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['parse'](_0x26c275[_0xa976('0x3')])[_0xa976('0x26')],_0x26c275[_0xa976('0x3')]);gs[_0xa976('0x5c')](_0x3e78a2)[_0xa976('0x39')](function(){_0x26c275['path']=util[_0xa976('0x5b')](_0xa976('0x5d'),path[_0xa976('0x37')](_0x26c275[_0xa976('0x3')])[_0xa976('0x5e')],path['parse'](_0x26c275[_0xa976('0x3')])[_0xa976('0x26')]);_0x12322e[_0xa976('0x5f')]=_0x26c275[_0xa976('0x3')];ut[_0xa976('0x45')](_0xa976('0x60'),'');ami['Action'](ut[_0xa976('0x61')](_0x26c275,_0x12322e))[_0xa976('0x39')](function(_0x1e339c){_0x37aa38(_0x1e339c);})[_0xa976('0x3b')](function(_0x40cfcd){_0xb3e0c0(_0x40cfcd);});})[_0xa976('0x3b')](function(_0x15fce4){_0xb3e0c0(_0x15fce4);});}else{ami[_0xa976('0x62')](ut['variablesAction'](_0x26c275,_0x12322e))[_0xa976('0x39')](function(_0x583e31){_0x37aa38(_0x583e31);})[_0xa976('0x3b')](function(_0x46088a){_0xb3e0c0(_0x46088a);});}});}Fax[_0xa976('0x2a')]['execOriginate']=function(_0x483cc0,_0x410768){var _0x1fbefb=this;return new BPromise(function(_0x27b0be,_0x13997c){var _0xe63248=uuid['v4']();var _0x815c06=ut['addVariables'](_0x483cc0,_0x410768);_0x1fbefb[_0xa976('0x29')][_0xe63248]=new Action(_0xe63248,_0x410768,_0x483cc0);var _0x22b95f=_0x1fbefb[_0xa976('0x29')][_0xe63248];if(path[_0xa976('0x37')](_0x483cc0['path'])[_0xa976('0x63')]===_0xa976('0x3a')){originate(_0x22b95f,_0x815c06,!![])[_0xa976('0x39')](function(_0x1bb5e7){_0x27b0be(_0x1bb5e7);})[_0xa976('0x3b')](function(_0x34d73f){_0x13997c(_0x34d73f);});}else{originate(_0x22b95f,_0x815c06,![])[_0xa976('0x39')](function(_0x973bcd){_0x27b0be(_0x973bcd);})[_0xa976('0x3b')](function(_0x354e46){_0x13997c(_0x354e46);});}});};Fax['prototype'][_0xa976('0x64')]=function(_0x38f85a){return!_['isNil'](_0x38f85a)&&!_[_0xa976('0x65')](_0x38f85a['name'])&&!_['isNil'](_0x38f85a['active'])&&_0x38f85a[_0xa976('0x66')]&&!_[_0xa976('0x65')](this[_0xa976('0xf')][util[_0xa976('0x5b')](_0xa976('0x67'),_0x38f85a[_0xa976('0x26')])])&&!_['isNil'](this[_0xa976('0xf')][util['format'](_0xa976('0x67'),_0x38f85a[_0xa976('0x26')])][_0xa976('0x68')])&&(this['trunks'][util[_0xa976('0x5b')](_0xa976('0x67'),_0x38f85a['name'])][_0xa976('0x68')]===_0xa976('0x69')||this[_0xa976('0xf')][util[_0xa976('0x5b')](_0xa976('0x67'),_0x38f85a[_0xa976('0x26')])][_0xa976('0x68')]==='unmonitored');};Fax[_0xa976('0x2a')][_0xa976('0x58')]=function(_0x153ca9,_0x28939d){if(!this[_0xa976('0x64')](_0x153ca9)){ut[_0xa976('0x45')](_0xa976('0x6a'),_[_0xa976('0x65')](_0x153ca9)?'':_0x153ca9[_0xa976('0x26')]+_0xa976('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xa976('0x65')](_0x28939d['fax'])){ut[_0xa976('0x45')](_0xa976('0x6c'),JSON['stringify'](_0x28939d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x28939d['path'])){ut['logger'](_0xa976('0x6d'),JSON[_0xa976('0x3d')](_0x28939d));return{'isValid':![],'message':_0xa976('0x6e')};}return{'isValid':!![],'message':_0xa976('0x6f')};};module[_0xa976('0x70')]=Fax; \ No newline at end of file +var _0x3407=['exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncNewState','newexten','syncNewExten','syncFaxStatus','prototype','context','from-voip-provider','hasOwnProperty'];(function(_0x420f49,_0x36b183){var _0x608149=function(_0x4cfb20){while(--_0x4cfb20){_0x420f49['push'](_0x420f49['shift']());}};_0x608149(++_0x36b183);}(_0x3407,0x1c8));var _0x7340=function(_0x11fb01,_0x384679){_0x11fb01=_0x11fb01-0x0;var _0x27bf0c=_0x3407[_0x11fb01];return _0x27bf0c;};'use strict';var util=require(_0x7340('0x0'));var _=require(_0x7340('0x1'));var BPromise=require(_0x7340('0x2'));var uuid=require(_0x7340('0x3'));var moment=require(_0x7340('0x4'));var path=require(_0x7340('0x5'));var tiff2pdf=require(_0x7340('0x6'));var gs=require(_0x7340('0x7'));var logger=require(_0x7340('0x8'))(_0x7340('0x9'));var ami=require(_0x7340('0xa'));var rpcDb=require(_0x7340('0xb'));var Channel=require(_0x7340('0xc'));var ut=require(_0x7340('0xd'));var Action=require(_0x7340('0xe'));var faxAccount=require(_0x7340('0xf'));var attachment=require(_0x7340('0x10'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3645fc){this['channels']={};this[_0x7340('0x11')]=_0x3645fc['faxAccounts'];this['trunks']=_0x3645fc[_0x7340('0x12')];this[_0x7340('0x13')]={};ami['on'](_0x7340('0x14'),this[_0x7340('0x15')][_0x7340('0x16')](this));ami['on'](_0x7340('0x17'),this['syncVarSet'][_0x7340('0x16')](this));ami['on']('newstate',this[_0x7340('0x18')][_0x7340('0x16')](this));ami['on'](_0x7340('0x19'),this[_0x7340('0x1a')][_0x7340('0x16')](this));ami['on']('faxstatus',this[_0x7340('0x1b')][_0x7340('0x16')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on']('hangup',this['syncHangup'][_0x7340('0x16')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x7340('0x16')](this));}Fax[_0x7340('0x1c')][_0x7340('0x15')]=function(_0x5c30f9){if(_0x5c30f9[_0x7340('0x1d')]===_0x7340('0x1e')){for(var _0x4d2577 in this['faxAccounts']){if(this[_0x7340('0x11')][_0x7340('0x1f')](_0x4d2577)){if(_0x5c30f9[_0x7340('0x20')]===this[_0x7340('0x11')][_0x4d2577][_0x7340('0x21')]){this[_0x7340('0x22')][_0x5c30f9[_0x7340('0x23')]]={};this[_0x7340('0x22')][_0x5c30f9['uniqueid']][_0x7340('0x24')]=_0x5c30f9[_0x7340('0x24')];this[_0x7340('0x22')][_0x5c30f9['uniqueid']]['id']=this['faxAccounts'][_0x4d2577]['id'];this[_0x7340('0x22')][_0x5c30f9[_0x7340('0x23')]][_0x7340('0x25')]=this[_0x7340('0x11')][_0x4d2577][_0x7340('0x25')];logger[_0x7340('0x26')](_0x5c30f9[_0x7340('0x23')],_0x7340('0x27'));}}}}if(this[_0x7340('0x13')][_0x5c30f9['uniqueid']]){this['channels'][_0x5c30f9[_0x7340('0x23')]]={};this[_0x7340('0x22')][_0x5c30f9[_0x7340('0x23')]][_0x7340('0x24')]=_0x5c30f9[_0x7340('0x24')];logger[_0x7340('0x26')](_0x5c30f9[_0x7340('0x23')],_0x7340('0x27'));}};Fax[_0x7340('0x1c')][_0x7340('0x28')]=function(_0x3b8694){if(this[_0x7340('0x22')][_0x3b8694[_0x7340('0x23')]]){for(var _0x37de11 in _0x3b8694['variable']){if(_0x3b8694[_0x7340('0x29')][_0x7340('0x1f')](_0x37de11)){this['channels'][_0x3b8694[_0x7340('0x23')]][_0x37de11]=_0x3b8694[_0x7340('0x2a')];}}}};Fax[_0x7340('0x1c')][_0x7340('0x18')]=function(_0x163eb2){if(this['channels'][_0x163eb2[_0x7340('0x23')]]){this[_0x7340('0x22')][_0x163eb2[_0x7340('0x23')]]['channelstate']=_0x163eb2[_0x7340('0x2b')];this[_0x7340('0x22')][_0x163eb2[_0x7340('0x23')]][_0x7340('0x2c')]=_0x163eb2[_0x7340('0x2c')];}};Fax[_0x7340('0x1c')][_0x7340('0x1a')]=function(_0x4728e0){if(this[_0x7340('0x22')][_0x4728e0[_0x7340('0x23')]]){for(var _0x5e953b in _0x4728e0[_0x7340('0x29')]){if(_0x4728e0[_0x7340('0x29')][_0x7340('0x1f')](_0x5e953b)){this['channels'][_0x4728e0['uniqueid']][_0x5e953b]=_0x4728e0[_0x7340('0x2a')];}}}};Fax['prototype'][_0x7340('0x1b')]=function(_0x1a9484){if(this[_0x7340('0x22')][_0x1a9484[_0x7340('0x23')]]){this[_0x7340('0x22')][_0x1a9484[_0x7340('0x23')]][_0x7340('0x2d')]=_0x1a9484['operation'];this[_0x7340('0x22')][_0x1a9484[_0x7340('0x23')]][_0x7340('0x2e')]=_0x1a9484[_0x7340('0x2e')];this[_0x7340('0x22')][_0x1a9484['uniqueid']]['localstationid']=_0x1a9484[_0x7340('0x21')];this[_0x7340('0x22')][_0x1a9484['uniqueid']][_0x7340('0x2f')]=_0x1a9484[_0x7340('0x2f')];logger[_0x7340('0x26')](_0x1a9484[_0x7340('0x23')],_0x7340('0x30'));}};Fax[_0x7340('0x1c')][_0x7340('0x31')]=function(_0x255be2){var _0x274bec=this;if(this['channels'][_0x255be2[_0x7340('0x23')]]){var _0x1f4ef9=this['channels'][_0x255be2[_0x7340('0x23')]]['id'];this[_0x7340('0x22')][_0x255be2[_0x7340('0x23')]][_0x7340('0x32')]=_0x255be2[_0x7340('0x32')];this[_0x7340('0x22')][_0x255be2[_0x7340('0x23')]][_0x7340('0x33')]=_0x255be2[_0x7340('0x33')];this[_0x7340('0x22')][_0x255be2['uniqueid']][_0x7340('0x21')]=_0x255be2[_0x7340('0x21')];this[_0x7340('0x22')][_0x255be2['uniqueid']][_0x7340('0x34')]=_0x255be2[_0x7340('0x34')];this[_0x7340('0x22')][_0x255be2['uniqueid']][_0x7340('0x35')]=_0x255be2['transferrate'];this[_0x7340('0x22')][_0x255be2[_0x7340('0x23')]][_0x7340('0x2f')]=_0x255be2[_0x7340('0x2f')];this[_0x7340('0x22')][_0x255be2[_0x7340('0x23')]][_0x7340('0x36')]=_0x255be2[_0x7340('0x36')];if(this[_0x7340('0x22')][_0x255be2[_0x7340('0x23')]][_0x7340('0x33')]>0x0){tiff2pdf(_0x255be2[_0x7340('0x2f')],_0x7340('0x37'),function(_0x2a8d2a){logger[_0x7340('0x26')](_0x255be2['uniqueid'],_0x7340('0x38'),_0x2a8d2a[_0x7340('0x39')]);attachment['create']({'name':path[_0x7340('0x3a')](_0x255be2[_0x7340('0x2f')])[_0x7340('0x25')],'basename':path['parse'](_0x255be2[_0x7340('0x2f')])[_0x7340('0x25')]+_0x7340('0x3b'),'type':_0x7340('0x3c')})[_0x7340('0x3d')](function(_0x47f6a0){faxAccount['notify'](_0x1f4ef9,{'from':_0x255be2[_0x7340('0x36')],'mapKey':_0x7340('0x9'),'body':path['parse'](_0x255be2['filename'])[_0x7340('0x25')]+_0x7340('0x3b'),'AttachmentId':_0x47f6a0['id']})['catch'](function(_0x36e53f){logger[_0x7340('0x3e')](_0x255be2['uniqueid'],_0x7340('0x3f'),JSON[_0x7340('0x40')](_0x36e53f));});})[_0x7340('0x41')](function(_0x19e3fe){logger[_0x7340('0x3e')](_0x255be2[_0x7340('0x23')],_0x7340('0x42'),JSON['stringify'](_0x19e3fe));});});}logger[_0x7340('0x26')](_0x255be2[_0x7340('0x23')],_0x7340('0x42'));}};Fax[_0x7340('0x1c')][_0x7340('0x43')]=function(_0x22102b){if(this[_0x7340('0x13')][_0x22102b[_0x7340('0x23')]]){_['merge'](this[_0x7340('0x22')][_0x22102b[_0x7340('0x23')]],_['pick'](_0x22102b,['response',_0x7340('0x44')]));}};function updateStatus(_0x53384a){if(_0x53384a['AttachmentId']){faxMessage[_0x7340('0x45')](_0x53384a[_0x7340('0x46')],{'failMessage':_0x7340('0x47')})[_0x7340('0x3d')](function(_0x5a9379){ut[_0x7340('0x48')](_0x7340('0x49'),_0x5a9379);})[_0x7340('0x41')](function(_0x1920b6){ut[_0x7340('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x1920b6);});}else{ut['logger'](_0x7340('0x4a'));}}Fax[_0x7340('0x1c')][_0x7340('0x4b')]=function(_0x3d1ea9,_0x48853a,_0x34409d){var _0x307ed6=this;var _0x16d0fe={};if(_0x48853a){_0x16d0fe={'read':_0x48853a};}else{_0x16d0fe={'failMessage':_0x34409d};}if(this[_0x7340('0x13')][_0x3d1ea9][_0x7340('0x46')]){faxMessage[_0x7340('0x45')](this['actions'][_0x3d1ea9]['AttachmentId'],_0x16d0fe)['then'](function(_0xb9fb05){ut[_0x7340('0x48')](_0x7340('0x4c'),_0xb9fb05);})[_0x7340('0x41')](function(_0x879803){ut['logger'](_0x7340('0x4d'),_0x879803);})[_0x7340('0x4e')](function(){delete _0x307ed6[_0x7340('0x22')][_0x3d1ea9];delete _0x307ed6['actions'][_0x3d1ea9];});}else{ut[_0x7340('0x48')](_0x7340('0x4f'));delete this[_0x7340('0x22')][_0x3d1ea9];delete this['actions'][_0x3d1ea9];}};Fax[_0x7340('0x1c')][_0x7340('0x50')]=function(_0x33388b){var _0x20e168=this;if(this['channels'][_0x33388b[_0x7340('0x23')]]){if(this['actions'][_0x33388b['uniqueid']]){this[_0x7340('0x22')][_0x33388b[_0x7340('0x23')]]['id']=this['actions'][_0x33388b[_0x7340('0x23')]]['id'];this[_0x7340('0x22')][_0x33388b[_0x7340('0x23')]][_0x7340('0x25')]=this[_0x7340('0x13')][_0x33388b[_0x7340('0x23')]][_0x7340('0x25')];}logger[_0x7340('0x26')](_0x33388b[_0x7340('0x23')],this[_0x7340('0x13')][_0x33388b[_0x7340('0x23')]]?_0x7340('0x51'):_0x7340('0x52'),JSON[_0x7340('0x40')](this[_0x7340('0x22')][_0x33388b['uniqueid']]));if(this[_0x7340('0x13')][_0x33388b[_0x7340('0x23')]]){if(this['channels'][_0x33388b[_0x7340('0x23')]][_0x7340('0x53')]>0x0&&this[_0x7340('0x22')][_0x33388b[_0x7340('0x23')]][_0x7340('0x54')]===_0x7340('0x55')){this['updateStatus'](_0x33388b[_0x7340('0x23')],!![]);}else{this[_0x7340('0x4b')](_0x33388b[_0x7340('0x23')],![],this[_0x7340('0x22')][_0x33388b[_0x7340('0x23')]][_0x7340('0x56')]?_0x7340('0x57')+this['channels'][_0x33388b[_0x7340('0x23')]][_0x7340('0x56')]:_0x7340('0x58'));}}}};Fax[_0x7340('0x1c')][_0x7340('0x59')]=function(_0x5cc493){var _0xcf7f4c=this;return new BPromise(function(_0x98cb43,_0x437a64){_0xcf7f4c['execOriginate'](_0x5cc493,_0xcf7f4c[_0x7340('0x11')][_0x5cc493['FaxAccountId']])[_0x7340('0x3d')](function(_0x5400b2){ut[_0x7340('0x48')](_0x7340('0x5a'),_0x5400b2);_0x98cb43(ut[_0x7340('0x39')](_0x7340('0x5b')));})['catch'](function(_0x36212a){ut['logger']('[Fax][execOriginate][failure]',_0x36212a);updateStatus(_0x5cc493);_0x437a64(ut['message']('Fax\x20failed'));});});};Fax[_0x7340('0x1c')][_0x7340('0x5c')]=function(_0x3b97da){var _0x599c15=this;return new BPromise(function(_0x1f7ba4,_0xc41d9d){var _0x8d28d2=_0x599c15['checkTrunk'](_0x599c15[_0x7340('0x11')][_0x3b97da[_0x7340('0x5d')]][_0x7340('0x5e')],_0x3b97da);if(_0x8d28d2[_0x7340('0x5f')]){_0x1f7ba4(ut[_0x7340('0x39')](_0x7340('0x60')));}else{_0xc41d9d(ut[_0x7340('0x39')](_0x8d28d2['message']));}});};function originate(_0x457aae,_0xced9e7,_0x8b38ff){return new BPromise(function(_0x707d79,_0x4cf006){if(_0x8b38ff){var _0x39be31=util[_0x7340('0x61')](_0x7340('0x62'),path[_0x7340('0x3a')](_0x457aae[_0x7340('0x5')])['name'],_0x457aae[_0x7340('0x5')]);gs[_0x7340('0x63')](_0x39be31)[_0x7340('0x3d')](function(){_0x457aae[_0x7340('0x5')]=util['format'](_0x7340('0x64'),path[_0x7340('0x3a')](_0x457aae[_0x7340('0x5')])[_0x7340('0x65')],path['parse'](_0x457aae[_0x7340('0x5')])[_0x7340('0x25')]);_0xced9e7[_0x7340('0x66')]=_0x457aae[_0x7340('0x5')];ut[_0x7340('0x48')](_0x7340('0x67'),'');ami[_0x7340('0x68')](ut['variablesAction'](_0x457aae,_0xced9e7))['then'](function(_0x1e71df){_0x707d79(_0x1e71df);})[_0x7340('0x41')](function(_0x2302d5){_0x4cf006(_0x2302d5);});})[_0x7340('0x41')](function(_0x2b0f75){_0x4cf006(_0x2b0f75);});}else{ami[_0x7340('0x68')](ut[_0x7340('0x69')](_0x457aae,_0xced9e7))[_0x7340('0x3d')](function(_0x183150){_0x707d79(_0x183150);})[_0x7340('0x41')](function(_0x245317){_0x4cf006(_0x245317);});}});}Fax[_0x7340('0x1c')]['execOriginate']=function(_0x2c3376,_0x4ee0b6){var _0xf39a4f=this;return new BPromise(function(_0x43eb41,_0x3fba76){var _0x42b49d=uuid['v4']();var _0x4182a0=ut['addVariables'](_0x2c3376,_0x4ee0b6);_0xf39a4f[_0x7340('0x13')][_0x42b49d]=new Action(_0x42b49d,_0x4ee0b6,_0x2c3376);var _0x5825cb=_0xf39a4f[_0x7340('0x13')][_0x42b49d];if(path['parse'](_0x2c3376['path'])[_0x7340('0x6a')]===_0x7340('0x3b')){originate(_0x5825cb,_0x4182a0,!![])[_0x7340('0x3d')](function(_0x50065a){_0x43eb41(_0x50065a);})[_0x7340('0x41')](function(_0x297db0){_0x3fba76(_0x297db0);});}else{originate(_0x5825cb,_0x4182a0,![])[_0x7340('0x3d')](function(_0x3e0bf7){_0x43eb41(_0x3e0bf7);})['catch'](function(_0x1c4c5a){_0x3fba76(_0x1c4c5a);});}});};Fax[_0x7340('0x1c')][_0x7340('0x6b')]=function(_0x1f0bd8){return!_[_0x7340('0x6c')](_0x1f0bd8)&&!_['isNil'](_0x1f0bd8['name'])&&!_[_0x7340('0x6c')](_0x1f0bd8[_0x7340('0x6d')])&&_0x1f0bd8['active']&&!_[_0x7340('0x6c')](this[_0x7340('0x12')][util[_0x7340('0x61')]('SIP/%s',_0x1f0bd8[_0x7340('0x25')])])&&!_[_0x7340('0x6c')](this['trunks'][util[_0x7340('0x61')]('SIP/%s',_0x1f0bd8[_0x7340('0x25')])]['status'])&&(this[_0x7340('0x12')][util[_0x7340('0x61')](_0x7340('0x6e'),_0x1f0bd8['name'])][_0x7340('0x2e')]===_0x7340('0x6f')||this[_0x7340('0x12')][util[_0x7340('0x61')](_0x7340('0x6e'),_0x1f0bd8[_0x7340('0x25')])][_0x7340('0x2e')]===_0x7340('0x70'));};Fax[_0x7340('0x1c')][_0x7340('0x71')]=function(_0x3eff41,_0x2a6356){if(!this['isTrunkReachable'](_0x3eff41)){ut[_0x7340('0x48')](_0x7340('0x72'),_[_0x7340('0x6c')](_0x3eff41)?'':_0x3eff41[_0x7340('0x25')]+_0x7340('0x73'));return{'isValid':![],'message':_0x7340('0x74')};}if(_[_0x7340('0x6c')](_0x2a6356[_0x7340('0x9')])){ut[_0x7340('0x48')](_0x7340('0x75'),JSON['stringify'](_0x2a6356));return{'isValid':![],'message':_0x7340('0x76')};}if(_[_0x7340('0x6c')](_0x2a6356[_0x7340('0x5')])){ut['logger'](_0x7340('0x77'),JSON[_0x7340('0x40')](_0x2a6356));return{'isValid':![],'message':_0x7340('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x7340('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8e68a0e..406d2de 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 _0xb338=['inspect','resolve','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error'];(function(_0x2992e3,_0x9af0f3){var _0x2f4640=function(_0x351b8a){while(--_0x351b8a){_0x2992e3['push'](_0x2992e3['shift']());}};_0x2f4640(++_0x9af0f3);}(_0xb338,0xd6));var _0x8b33=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0xb338[_0x1e93fa];return _0xd4e1e6;};'use strict';var util=require(_0x8b33('0x0'));var BPromise=require(_0x8b33('0x1'));var logger=require(_0x8b33('0x2'))(_0x8b33('0x3'));var _=require(_0x8b33('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2c605a){return function(_0x1feb6e){logger[_0x8b33('0x5')](_0x2c605a,util[_0x8b33('0x6')](_0x1feb6e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x1dfadb,_0x2c9363){return BPromise[_0x8b33('0x7')]()['then'](faxAccount[_0x8b33('0x8')](_0x1dfadb,_0x2c9363))[_0x8b33('0x9')](loggerCatch(_0x8b33('0xa')));}; \ No newline at end of file +var _0xa1cf=['util','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','resolve','then','notify','[Notify]\x20'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xa1cf,0x140));var _0xfa1c=function(_0x397c99,_0x53e5f6){_0x397c99=_0x397c99-0x0;var _0x30aef3=_0xa1cf[_0x397c99];return _0x30aef3;};'use strict';var util=require(_0xfa1c('0x0'));var BPromise=require('bluebird');var logger=require(_0xfa1c('0x1'))('preview');var _=require(_0xfa1c('0x2'));var faxAccount=require(_0xfa1c('0x3'));function loggerCatch(_0x938a5d){return function(_0x42f3b2){logger[_0xfa1c('0x4')](_0x938a5d,util[_0xfa1c('0x5')](_0x42f3b2,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x5745e6,_0x6fa4e8){return BPromise[_0xfa1c('0x6')]()[_0xfa1c('0x7')](faxAccount[_0xfa1c('0x8')](_0x5745e6,_0x6fa4e8))['catch'](loggerCatch(_0xfa1c('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 461ffd0..979fa3f 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 _0x8b0a=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x259991,_0x56b6dc){var _0x18c8e7=function(_0x113e03){while(--_0x113e03){_0x259991['push'](_0x259991['shift']());}};_0x18c8e7(++_0x56b6dc);}(_0x8b0a,0x1ec));var _0xa8b0=function(_0x1694f3,_0x58d6ba){_0x1694f3=_0x1694f3-0x0;var _0x27372c=_0x8b0a[_0x1694f3];return _0x27372c;};'use strict';var util=require(_0xa8b0('0x0'));var logger=require(_0xa8b0('0x1'))(_0xa8b0('0x2'));var BPromise=require(_0xa8b0('0x3'));var exec=require(_0xa8b0('0x4'))[_0xa8b0('0x5')];exports[_0xa8b0('0x6')]=function(_0x433ab1){return new BPromise(function(_0xb36e5,_0x3e6ebd){exec(_0x433ab1,function(_0xe46864,_0x4f5163,_0x2a0260){logger[_0xa8b0('0x7')](_0xa8b0('0x8'),_0x4f5163);if(_0xe46864){logger[_0xa8b0('0x7')](_0xa8b0('0x8'),_0xa8b0('0x9'),util[_0xa8b0('0xa')](_0xe46864,{'showHidden':![],'depth':null}),_0x4f5163,_0x2a0260);_0x3e6ebd(_0xe46864);}_0xb36e5(_0x4f5163);});});}; \ No newline at end of file +var _0x77f1=['fax','exec','execute','info','Exec\x20gs','inspect','util'];(function(_0x57d4c4,_0x1eb1c7){var _0x551561=function(_0x5aa58d){while(--_0x5aa58d){_0x57d4c4['push'](_0x57d4c4['shift']());}};_0x551561(++_0x1eb1c7);}(_0x77f1,0x8b));var _0x177f=function(_0x3630f2,_0x3ac1e7){_0x3630f2=_0x3630f2-0x0;var _0xce3304=_0x77f1[_0x3630f2];return _0xce3304;};'use strict';var util=require(_0x177f('0x0'));var logger=require('../../../../config/logger')(_0x177f('0x1'));var BPromise=require('bluebird');var exec=require('child_process')[_0x177f('0x2')];exports[_0x177f('0x3')]=function(_0x560900){return new BPromise(function(_0x26d737,_0x3e0a8d){exec(_0x560900,function(_0x25145b,_0x5a2f6f,_0x48846d){logger[_0x177f('0x4')]('Exec\x20gs',_0x5a2f6f);if(_0x25145b){logger[_0x177f('0x4')](_0x177f('0x5'),'\x20Error\x20:',util[_0x177f('0x6')](_0x25145b,{'showHidden':![],'depth':null}),_0x5a2f6f,_0x48846d);_0x3e0a8d(_0x25145b);}_0x26d737(_0x5a2f6f);});});}; \ 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 f7d00f2..9244525 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 _0x74cd=['lodash','moment','fax','message','inspect','addVariables','ecm','headerinfo','minrate','format','modem','faxdetect','t38timeout','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid'];(function(_0x405542,_0x10b3c0){var _0x5f1c2c=function(_0x1245c0){while(--_0x1245c0){_0x405542['push'](_0x405542['shift']());}};_0x5f1c2c(++_0x10b3c0);}(_0x74cd,0x69));var _0xd74c=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x74cd[_0x4709c0];return _0x13348b;};'use strict';var util=require('util');var _=require(_0xd74c('0x0'));var moment=require(_0xd74c('0x1'));var logger=require('../../../../config/logger')(_0xd74c('0x2'));exports[_0xd74c('0x3')]=function(_0x40f1ea){return{'message':_0x40f1ea};};exports['logger']=function(_0x4582b7,_0x35284e){logger['info'](_0x4582b7,util[_0xd74c('0x4')](_0x35284e,{'showHidden':![],'depth':null}));};exports[_0xd74c('0x5')]=function(_0x125ed9,_0x1d65e9){var _0x309ade={'XMF-ECM':_0x1d65e9[_0xd74c('0x6')],'XMF-HEADERINFO':_0x1d65e9[_0xd74c('0x7')],'XMF-MINRATE':_0x1d65e9[_0xd74c('0x8')],'XMF-MAXRATE':_0x1d65e9['maxrate'],'XMF-MODEM':util[_0xd74c('0x9')]('\x22%s\x22',_0x1d65e9[_0xd74c('0xa')]),'XMF-GATEWAY':_0x1d65e9['gateway'],'XMF-FAXDETECT':_0x1d65e9[_0xd74c('0xb')],'XMF-T38TIMEOUT':_0x1d65e9[_0xd74c('0xc')],'XMF-LOCALSTATIONID':_0x1d65e9['localstationid'],'XMF-PATH':_0x125ed9['path']};return _0x309ade;};exports[_0xd74c('0xd')]=function(_0x52b2d,_0x163533){return{'actionid':_0x52b2d[_0xd74c('0xe')],'action':_0xd74c('0xf'),'channel':_0x52b2d[_0xd74c('0x10')],'Exten':_0xd74c('0x11'),'Context':_0xd74c('0x12'),'Priority':'1','callerid':util[_0xd74c('0x9')](_0xd74c('0x13'),_0x52b2d[_0xd74c('0x7')]?_0x52b2d[_0xd74c('0x7')]:'',_0x52b2d[_0xd74c('0x14')]),'variable':_0x163533,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x52b2d[_0xd74c('0xe')]};}; \ No newline at end of file +var _0x827b=['faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','message','inspect','addVariables','headerinfo','minrate','format','\x22%s\x22','modem','gateway'];(function(_0x5da980,_0x45b11c){var _0x4ee75e=function(_0x1e843b){while(--_0x1e843b){_0x5da980['push'](_0x5da980['shift']());}};_0x4ee75e(++_0x45b11c);}(_0x827b,0x11e));var _0xb827=function(_0x1b309b,_0x36af21){_0x1b309b=_0x1b309b-0x0;var _0x33a0d3=_0x827b[_0x1b309b];return _0x33a0d3;};'use strict';var util=require(_0xb827('0x0'));var _=require(_0xb827('0x1'));var moment=require(_0xb827('0x2'));var logger=require('../../../../config/logger')(_0xb827('0x3'));exports[_0xb827('0x4')]=function(_0x68bda3){return{'message':_0x68bda3};};exports['logger']=function(_0x2c18f9,_0x54dfe2){logger['info'](_0x2c18f9,util[_0xb827('0x5')](_0x54dfe2,{'showHidden':![],'depth':null}));};exports[_0xb827('0x6')]=function(_0x445c28,_0x1e6bef){var _0x60da52={'XMF-ECM':_0x1e6bef['ecm'],'XMF-HEADERINFO':_0x1e6bef[_0xb827('0x7')],'XMF-MINRATE':_0x1e6bef[_0xb827('0x8')],'XMF-MAXRATE':_0x1e6bef['maxrate'],'XMF-MODEM':util[_0xb827('0x9')](_0xb827('0xa'),_0x1e6bef[_0xb827('0xb')]),'XMF-GATEWAY':_0x1e6bef[_0xb827('0xc')],'XMF-FAXDETECT':_0x1e6bef[_0xb827('0xd')],'XMF-T38TIMEOUT':_0x1e6bef[_0xb827('0xe')],'XMF-LOCALSTATIONID':_0x1e6bef['localstationid'],'XMF-PATH':_0x445c28[_0xb827('0xf')]};return _0x60da52;};exports[_0xb827('0x10')]=function(_0x10aa52,_0x5944ca){return{'actionid':_0x10aa52[_0xb827('0x11')],'action':_0xb827('0x12'),'channel':_0x10aa52[_0xb827('0x13')],'Exten':_0xb827('0x14'),'Context':_0xb827('0x15'),'Priority':'1','callerid':util[_0xb827('0x9')](_0xb827('0x16'),_0x10aa52[_0xb827('0x7')]?_0x10aa52[_0xb827('0x7')]:'',_0x10aa52['localstationid']),'variable':_0x5944ca,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10aa52[_0xb827('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e989f7b..5e5bc58 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 _0x12f3=['./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','hour','get','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','listen','sync','[index.js][main]','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x12f3,0x1a4));var _0x312f=function(_0x4f0272,_0x43e5c5){_0x4f0272=_0x4f0272-0x0;var _0x440684=_0x12f3[_0x4f0272];return _0x440684;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0x312f('0x0'));var Realtime=require('./realtime');var Report=require(_0x312f('0x1'));var Acw=require(_0x312f('0x2'));var Trigger=require(_0x312f('0x3'));var Dialer=require(_0x312f('0x4'));var Preview=require(_0x312f('0x5'));var Fax=require(_0x312f('0x6'));var user=require(_0x312f('0x7'));var voiceQueue=require(_0x312f('0x8'));var voiceQueueReport=require(_0x312f('0x9'));var voiceCallReport=require(_0x312f('0xa'));var trunk=require(_0x312f('0xb'));var trigger=require(_0x312f('0xc'));var template=require(_0x312f('0xd'));var cmHopperHistory=require(_0x312f('0xe'));var campaign=require(_0x312f('0xf'));var voiceExtension=require(_0x312f('0x10'));var faxAccount=require(_0x312f('0x11'));var zendesk=require(_0x312f('0x12'));var salesforce=require(_0x312f('0x13'));var sugarcrm=require(_0x312f('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x312f('0x15'));var zoho=require(_0x312f('0x16'));var vtiger=require(_0x312f('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x312f('0x18'));var dynamics365=require(_0x312f('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x312f('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x312f('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x312f('0x1c')](_0x312f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x312f('0x1d')](user[_0x312f('0x1e')]())[_0x312f('0x1d')](realtime[_0x312f('0x1f')]())[_0x312f('0x1d')](user['getTelephones']())['then'](realtime[_0x312f('0x20')]())[_0x312f('0x1d')](trunk[_0x312f('0x21')]())[_0x312f('0x1d')](realtime[_0x312f('0x22')]())[_0x312f('0x1d')](voiceQueue[_0x312f('0x23')]())['then'](realtime[_0x312f('0x24')]())['then'](trigger[_0x312f('0x25')]())['then'](realtime[_0x312f('0x26')]())[_0x312f('0x1d')](template['getTemplates']())['then'](realtime[_0x312f('0x27')]())[_0x312f('0x1d')](zendesk[_0x312f('0x28')]())[_0x312f('0x1d')](realtime[_0x312f('0x29')]())['then'](salesforce[_0x312f('0x2a')]())['then'](realtime[_0x312f('0x2b')]())[_0x312f('0x1d')](sugarcrm[_0x312f('0x2c')]())[_0x312f('0x1d')](realtime[_0x312f('0x2d')]())[_0x312f('0x1d')](freshdesk[_0x312f('0x2e')]())['then'](realtime[_0x312f('0x2f')]())[_0x312f('0x1d')](desk['getDeskAccounts']())['then'](realtime[_0x312f('0x30')]())[_0x312f('0x1d')](zoho[_0x312f('0x31')]())[_0x312f('0x1d')](realtime['initZohoAccounts']())['then'](vtiger[_0x312f('0x32')]())['then'](realtime[_0x312f('0x33')]())[_0x312f('0x1d')](freshsales['getFreshsalesAccounts']())[_0x312f('0x1d')](realtime[_0x312f('0x34')]())[_0x312f('0x1d')](servicenow[_0x312f('0x35')]())['then'](realtime[_0x312f('0x36')]())['then'](dynamics365[_0x312f('0x37')]())[_0x312f('0x1d')](realtime['initDynamics365Accounts']())[_0x312f('0x1d')](campaign[_0x312f('0x38')]())[_0x312f('0x1d')](realtime[_0x312f('0x39')]())[_0x312f('0x1d')](voiceExtension[_0x312f('0x3a')]())[_0x312f('0x1d')](realtime[_0x312f('0x3b')]())[_0x312f('0x1d')](faxAccount[_0x312f('0x3c')]())[_0x312f('0x1d')](realtime[_0x312f('0x3d')]())[_0x312f('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x312f('0x3e')]()[_0x312f('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x312f('0x1d')](realtime[_0x312f('0x3f')]())[_0x312f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x312f('0x1d')](realtime[_0x312f('0x40')]())[_0x312f('0x1d')](cmHopperHistory[_0x312f('0x41')]())[_0x312f('0x1d')](realtime[_0x312f('0x42')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x312f('0x1d')](realtime['initVoiceCallReports']())[_0x312f('0x43')](function(_0x39be35){logger[_0x312f('0x44')]('[index.js][initParams]',util['inspect'](_0x39be35,{'showHidden':![],'depth':null}));});}function main(){return server[_0x312f('0x45')](realtime,preview,fax)[_0x312f('0x1d')](function(_0x525e4e){return initRealtime();})[_0x312f('0x1d')](function(){return initParams();})[_0x312f('0x1d')](function(){report[_0x312f('0x46')]();setInterval(initRealtime,0x1388);})[_0x312f('0x43')](function(_0x6c71d3){logger[_0x312f('0x44')](_0x312f('0x47'),util['inspect'](_0x6c71d3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xbac2=['getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','bluebird','util','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbac2,0x107));var _0x2bac=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbac2[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x2bac('0x0'));var util=require(_0x2bac('0x1'));var moment=require('moment');var server=require(_0x2bac('0x2'));var Realtime=require(_0x2bac('0x3'));var Report=require(_0x2bac('0x4'));var Acw=require(_0x2bac('0x5'));var Trigger=require(_0x2bac('0x6'));var Dialer=require('./dialer');var Preview=require(_0x2bac('0x7'));var Fax=require(_0x2bac('0x8'));var user=require(_0x2bac('0x9'));var voiceQueue=require(_0x2bac('0xa'));var voiceQueueReport=require(_0x2bac('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x2bac('0xc'));var trigger=require(_0x2bac('0xd'));var template=require(_0x2bac('0xe'));var cmHopperHistory=require(_0x2bac('0xf'));var campaign=require(_0x2bac('0x10'));var voiceExtension=require(_0x2bac('0x11'));var faxAccount=require(_0x2bac('0x12'));var zendesk=require(_0x2bac('0x13'));var salesforce=require(_0x2bac('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x2bac('0x15'));var desk=require(_0x2bac('0x16'));var zoho=require(_0x2bac('0x17'));var vtiger=require(_0x2bac('0x18'));var freshsales=require(_0x2bac('0x19'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x2bac('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2bac('0x1b'))(_0x2bac('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x2bac('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2bac('0x1e')](_0x2bac('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2bac('0x1f')]()[_0x2bac('0x20')](user[_0x2bac('0x21')]())['then'](realtime[_0x2bac('0x22')]())[_0x2bac('0x20')](user[_0x2bac('0x23')]())[_0x2bac('0x20')](realtime[_0x2bac('0x24')]())['then'](trunk[_0x2bac('0x25')]())['then'](realtime['initTrunks']())[_0x2bac('0x20')](voiceQueue[_0x2bac('0x26')]())['then'](realtime[_0x2bac('0x27')]())['then'](trigger[_0x2bac('0x28')]())[_0x2bac('0x20')](realtime['initTriggers']())[_0x2bac('0x20')](template[_0x2bac('0x29')]())[_0x2bac('0x20')](realtime[_0x2bac('0x2a')]())['then'](zendesk[_0x2bac('0x2b')]())[_0x2bac('0x20')](realtime[_0x2bac('0x2c')]())[_0x2bac('0x20')](salesforce[_0x2bac('0x2d')]())[_0x2bac('0x20')](realtime[_0x2bac('0x2e')]())[_0x2bac('0x20')](sugarcrm[_0x2bac('0x2f')]())['then'](realtime[_0x2bac('0x30')]())[_0x2bac('0x20')](freshdesk[_0x2bac('0x31')]())['then'](realtime[_0x2bac('0x32')]())['then'](desk[_0x2bac('0x33')]())[_0x2bac('0x20')](realtime[_0x2bac('0x34')]())[_0x2bac('0x20')](zoho[_0x2bac('0x35')]())[_0x2bac('0x20')](realtime['initZohoAccounts']())[_0x2bac('0x20')](vtiger[_0x2bac('0x36')]())[_0x2bac('0x20')](realtime[_0x2bac('0x37')]())[_0x2bac('0x20')](freshsales[_0x2bac('0x38')]())[_0x2bac('0x20')](realtime[_0x2bac('0x39')]())[_0x2bac('0x20')](servicenow[_0x2bac('0x3a')]())[_0x2bac('0x20')](realtime[_0x2bac('0x3b')]())['then'](dynamics365[_0x2bac('0x3c')]())[_0x2bac('0x20')](realtime[_0x2bac('0x3d')]())[_0x2bac('0x20')](campaign[_0x2bac('0x3e')]())[_0x2bac('0x20')](realtime[_0x2bac('0x3f')]())[_0x2bac('0x20')](voiceExtension[_0x2bac('0x40')]())[_0x2bac('0x20')](realtime[_0x2bac('0x41')]())[_0x2bac('0x20')](faxAccount[_0x2bac('0x42')]())[_0x2bac('0x20')](realtime[_0x2bac('0x43')]())[_0x2bac('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x2bac('0x1f')]()[_0x2bac('0x20')](voiceQueueReport[_0x2bac('0x44')]())['then'](realtime[_0x2bac('0x45')]())[_0x2bac('0x20')](cmHopperHistory[_0x2bac('0x46')]())[_0x2bac('0x20')](realtime['initVoiceQueueHopperHistory']())[_0x2bac('0x20')](cmHopperHistory[_0x2bac('0x47')]())[_0x2bac('0x20')](realtime[_0x2bac('0x48')]())[_0x2bac('0x20')](voiceCallReport[_0x2bac('0x49')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x4a0eb9){logger[_0x2bac('0x4a')](_0x2bac('0x4b'),util[_0x2bac('0x4c')](_0x4a0eb9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2bac('0x4d')](realtime,preview,fax)[_0x2bac('0x20')](function(_0x315625){return initRealtime();})[_0x2bac('0x20')](function(){return initParams();})[_0x2bac('0x20')](function(){report[_0x2bac('0x4e')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xb73e53){logger[_0x2bac('0x4a')]('[index.js][main]',util[_0x2bac('0x4c')](_0xb73e53,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 2449995..8d5ad8b 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x3845a1,_0x28caeb){var _0x3100c1=function(_0x1e2c4b){while(--_0x1e2c4b){_0x3845a1['push'](_0x3845a1['shift']());}};_0x3100c1(++_0x28caeb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x176043,_0x3248d0){var _0x419c4d=function(_0xdc64ad){while(--_0xdc64ad){_0x176043['push'](_0x176043['shift']());}};_0x419c4d(++_0x3248d0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xcb91[_0x22e47a];return _0x15a12a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7f01b80..ef4982d 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 _0xba69=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0xd5f137,_0x4c77ff){var _0xbb3f7f=function(_0x329929){while(--_0x329929){_0xd5f137['push'](_0xd5f137['shift']());}};_0xbb3f7f(++_0x4c77ff);}(_0xba69,0xa0));var _0x9ba6=function(_0x17e4d5,_0x1544b5){_0x17e4d5=_0x17e4d5-0x0;var _0x145646=_0xba69[_0x17e4d5];return _0x145646;};'use strict';function Campaign(_0x21b119){this['id']=_0x21b119['id']||0x0;this[_0x9ba6('0x0')]=_0x21b119[_0x9ba6('0x0')]||'';this[_0x9ba6('0x1')]=_0x21b119[_0x9ba6('0x1')]||_0x9ba6('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x9ba6('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x9ba6('0x4')]=!![];this[_0x9ba6('0x5')]=_0x21b119[_0x9ba6('0x5')];this[_0x9ba6('0x6')]=_0x21b119[_0x9ba6('0x6')];this[_0x9ba6('0x7')]=_0x21b119['dialTimezone']||null;this[_0x9ba6('0x8')]=_0x21b119[_0x9ba6('0x8')]?_0x21b119['dialGlobalInterval']:null;this[_0x9ba6('0x9')]=_0x21b119[_0x9ba6('0x9')];this['dialOriginateCallerIdNumber']=_0x21b119[_0x9ba6('0xa')];this[_0x9ba6('0xb')]=_0x21b119[_0x9ba6('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x21b119[_0x9ba6('0xc')];this[_0x9ba6('0xd')]=_0x21b119['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x21b119['dialBusyMaxRetry'];this[_0x9ba6('0xe')]=_0x21b119[_0x9ba6('0xe')];this[_0x9ba6('0xf')]=_0x21b119[_0x9ba6('0xf')];this[_0x9ba6('0x10')]=_0x21b119['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x21b119['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x21b119[_0x9ba6('0x11')]||0x3;this[_0x9ba6('0x12')]=_0x21b119['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9ba6('0x13')]=_0x21b119[_0x9ba6('0x13')]||0x3;this['dialDropRetryFrequency']=_0x21b119[_0x9ba6('0x14')]||0x96;this[_0x9ba6('0x15')]=_0x21b119['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x21b119[_0x9ba6('0x16')]||0x96;this['dialMachineMaxRetry']=_0x21b119[_0x9ba6('0x17')]||0x3;this[_0x9ba6('0x18')]=_0x21b119['dialMachineRetryFrequency']||0x96;this[_0x9ba6('0x19')]=_0x21b119['dialAgentRejectMaxRetry']||0x3;this[_0x9ba6('0x1a')]=_0x21b119[_0x9ba6('0x1a')]||0x96;this[_0x9ba6('0x1b')]=_0x21b119[_0x9ba6('0x1b')]||'DESC';this[_0x9ba6('0x1c')]=_0x21b119[_0x9ba6('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x21b119[_0x9ba6('0x1d')]||undefined;this[_0x9ba6('0x1e')]=_0x21b119['dialCutDigit']||undefined;this[_0x9ba6('0x1f')]=_0x21b119[_0x9ba6('0x1f')]?_0x21b119[_0x9ba6('0x1f')]:undefined;this['Trunk']=_0x21b119[_0x9ba6('0x20')]?_0x21b119[_0x9ba6('0x20')]:undefined;this['Interval']=_0x21b119['Interval']?_0x21b119[_0x9ba6('0x21')]:undefined;this[_0x9ba6('0x22')]=_0x21b119['SquareProject']?_0x21b119[_0x9ba6('0x22')]:undefined;this[_0x9ba6('0x23')]=_0x21b119[_0x9ba6('0x22')]?_0x21b119[_0x9ba6('0x22')][_0x9ba6('0x0')]:undefined;this[_0x9ba6('0x24')]=_0x21b119[_0x9ba6('0x24')]||![];this['dialAMDInitialSilence']=_0x21b119[_0x9ba6('0x25')];this[_0x9ba6('0x26')]=_0x21b119[_0x9ba6('0x26')];this[_0x9ba6('0x27')]=_0x21b119['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x21b119[_0x9ba6('0x28')];this[_0x9ba6('0x29')]=_0x21b119['dialAMDMinWordLength'];this[_0x9ba6('0x2a')]=_0x21b119[_0x9ba6('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x21b119['dialAMDMaximumNumberOfWords'];this[_0x9ba6('0x2b')]=_0x21b119[_0x9ba6('0x2b')];this[_0x9ba6('0x2c')]=_0x21b119[_0x9ba6('0x2c')];}module[_0x9ba6('0x2d')]=Campaign; \ No newline at end of file +var _0x2264=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x4c66e3,_0x363b81){var _0x2a89f0=function(_0x47c352){while(--_0x47c352){_0x4c66e3['push'](_0x4c66e3['shift']());}};_0x2a89f0(++_0x363b81);}(_0x2264,0x18c));var _0x4226=function(_0x3abb1b,_0x384ffc){_0x3abb1b=_0x3abb1b-0x0;var _0x3b3159=_0x2264[_0x3abb1b];return _0x3b3159;};'use strict';function Campaign(_0x50b3ec){this['id']=_0x50b3ec['id']||0x0;this['name']=_0x50b3ec['name']||'';this['type']=_0x50b3ec['type']||_0x4226('0x0');this[_0x4226('0x1')]=0x0;this[_0x4226('0x2')]=0x0;this[_0x4226('0x3')]=0x0;this[_0x4226('0x4')]=0x0;this[_0x4226('0x5')]='';this[_0x4226('0x6')]=!![];this['active']=_0x50b3ec[_0x4226('0x7')];this[_0x4226('0x8')]=_0x50b3ec[_0x4226('0x8')];this['dialTimezone']=_0x50b3ec[_0x4226('0x9')]||null;this[_0x4226('0xa')]=_0x50b3ec[_0x4226('0xa')]?_0x50b3ec[_0x4226('0xa')]:null;this[_0x4226('0xb')]=_0x50b3ec[_0x4226('0xb')];this['dialOriginateCallerIdNumber']=_0x50b3ec[_0x4226('0xc')];this[_0x4226('0xd')]=_0x50b3ec[_0x4226('0xd')]||0x1e;this[_0x4226('0xe')]=_0x50b3ec[_0x4226('0xe')];this[_0x4226('0xf')]=_0x50b3ec['dialCongestionRetryFrequency'];this[_0x4226('0x10')]=_0x50b3ec['dialBusyMaxRetry'];this[_0x4226('0x11')]=_0x50b3ec[_0x4226('0x11')];this[_0x4226('0x12')]=_0x50b3ec['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x50b3ec['dialNoAnswerRetryFrequency'];this[_0x4226('0x13')]=_0x50b3ec[_0x4226('0x13')];this[_0x4226('0x14')]=_0x50b3ec['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x50b3ec[_0x4226('0x15')]||0x96;this[_0x4226('0x16')]=_0x50b3ec['dialDropMaxRetry']||0x3;this[_0x4226('0x17')]=_0x50b3ec[_0x4226('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x50b3ec[_0x4226('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x50b3ec['dialAbandonedRetryFrequency']||0x96;this[_0x4226('0x19')]=_0x50b3ec[_0x4226('0x19')]||0x3;this[_0x4226('0x1a')]=_0x50b3ec[_0x4226('0x1a')]||0x96;this[_0x4226('0x1b')]=_0x50b3ec[_0x4226('0x1b')]||0x3;this[_0x4226('0x1c')]=_0x50b3ec[_0x4226('0x1c')]||0x96;this[_0x4226('0x1d')]=_0x50b3ec[_0x4226('0x1d')]||_0x4226('0x1e');this[_0x4226('0x1f')]=_0x50b3ec[_0x4226('0x1f')]||undefined;this[_0x4226('0x20')]=_0x50b3ec[_0x4226('0x20')]||undefined;this[_0x4226('0x21')]=_0x50b3ec['dialCutDigit']||undefined;this['TrunkBackup']=_0x50b3ec[_0x4226('0x22')]?_0x50b3ec[_0x4226('0x22')]:undefined;this[_0x4226('0x23')]=_0x50b3ec[_0x4226('0x23')]?_0x50b3ec[_0x4226('0x23')]:undefined;this[_0x4226('0x24')]=_0x50b3ec[_0x4226('0x24')]?_0x50b3ec[_0x4226('0x24')]:undefined;this[_0x4226('0x25')]=_0x50b3ec[_0x4226('0x25')]?_0x50b3ec['SquareProject']:undefined;this[_0x4226('0x26')]=_0x50b3ec['SquareProject']?_0x50b3ec[_0x4226('0x25')][_0x4226('0x27')]:undefined;this[_0x4226('0x28')]=_0x50b3ec[_0x4226('0x28')]||![];this['dialAMDInitialSilence']=_0x50b3ec[_0x4226('0x29')];this[_0x4226('0x2a')]=_0x50b3ec['dialAMDGreeting'];this[_0x4226('0x2b')]=_0x50b3ec[_0x4226('0x2b')];this[_0x4226('0x2c')]=_0x50b3ec['dialAMDTotalAnalysisTime'];this[_0x4226('0x2d')]=_0x50b3ec['dialAMDMinWordLength'];this[_0x4226('0x2e')]=_0x50b3ec[_0x4226('0x2e')];this[_0x4226('0x2f')]=_0x50b3ec['dialAMDMaximumNumberOfWords'];this[_0x4226('0x30')]=_0x50b3ec[_0x4226('0x30')];this['dialAMDMaximumWordLength']=_0x50b3ec['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d399581..d0fdac8 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 _0x31b5=['connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answertime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','disposition','monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x4d8ea0,_0x3ad597){var _0x3279b1=function(_0x5a2646){while(--_0x5a2646){_0x4d8ea0['push'](_0x4d8ea0['shift']());}};_0x3279b1(++_0x3ad597);}(_0x31b5,0x159));var _0x531b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x31b5[_0x397e5f];return _0x5302b8;};'use strict';function Channel(){this[_0x531b('0x0')]=null;this[_0x531b('0x1')]='';this[_0x531b('0x2')]='';this[_0x531b('0x3')]=0x0;this[_0x531b('0x4')]='';this[_0x531b('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x531b('0x6')]=0x0;this[_0x531b('0x7')]='';this[_0x531b('0x8')]=0x0;this[_0x531b('0x9')]=0x0;this[_0x531b('0xa')]=0x0;this['answered']=![];this[_0x531b('0xb')]=null;this['endtime']=null;this[_0x531b('0xc')]=![];this['abandoned']=![];this[_0x531b('0xd')]='';this[_0x531b('0xe')]='';this[_0x531b('0xf')]=0x0;this[_0x531b('0x10')]=0x0;this[_0x531b('0x11')]=0x0;this['type']=null;this['tag']=null;this[_0x531b('0x12')]=null;this['monitor']=![];this[_0x531b('0x13')]=null;this['queue']=null;this['monitors']=[];this[_0x531b('0x14')]=undefined;this[_0x531b('0x15')]=undefined;this[_0x531b('0x16')]=undefined;this[_0x531b('0x17')]=0x0;}module[_0x531b('0x18')]=Channel; \ No newline at end of file +var _0x0d78=['calleridnum','connectedlinenum','connectedlinename','accountcode','context','linkedid','answered','answertime','endtime','unmanaged','abandoned','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','mohtime','exports'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0x0d78,0x134));var _0x80d7=function(_0x54cefb,_0x192225){_0x54cefb=_0x54cefb-0x0;var _0x5e4fbb=_0x0d78[_0x54cefb];return _0x5e4fbb;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0x80d7('0x0')]=0x0;this['calleridname']='';this[_0x80d7('0x1')]=undefined;this[_0x80d7('0x2')]=undefined;this[_0x80d7('0x3')]=0x0;this[_0x80d7('0x4')]='';this['uniqueid']=0x0;this[_0x80d7('0x5')]=0x0;this['exten']=0x0;this[_0x80d7('0x6')]=![];this[_0x80d7('0x7')]=null;this[_0x80d7('0x8')]=null;this[_0x80d7('0x9')]=![];this[_0x80d7('0xa')]=![];this['lastapplication']='';this['lastdata']='';this[_0x80d7('0xb')]=0x0;this[_0x80d7('0xc')]=0x0;this[_0x80d7('0xd')]=0x0;this[_0x80d7('0xe')]=null;this[_0x80d7('0xf')]=null;this[_0x80d7('0x10')]=null;this[_0x80d7('0x11')]=![];this[_0x80d7('0x12')]=null;this['queue']=null;this[_0x80d7('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x80d7('0x14')]=0x0;}module[_0x80d7('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2eba836..bebff28 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 _0x6737=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x18cbd6,_0x1633d2){var _0x441c99=function(_0x2ff980){while(--_0x2ff980){_0x18cbd6['push'](_0x18cbd6['shift']());}};_0x441c99(++_0x1633d2);}(_0x6737,0x1b8));var _0x7673=function(_0x5c8efd,_0x672757){_0x5c8efd=_0x5c8efd-0x0;var _0x560b50=_0x6737[_0x5c8efd];return _0x560b50;};'use strict';function DeskAccount(_0x5505d3){this['id']=_0x5505d3['id']||0x0;this[_0x7673('0x0')]=_0x5505d3[_0x7673('0x0')]||'';this['username']=_0x5505d3[_0x7673('0x1')]||'';this[_0x7673('0x2')]=_0x5505d3[_0x7673('0x2')]||'';this['authType']=_0x5505d3[_0x7673('0x3')]||'';this[_0x7673('0x4')]=_0x5505d3[_0x7673('0x4')]||'';this['consumerKey']=_0x5505d3[_0x7673('0x5')]||'';this[_0x7673('0x6')]=_0x5505d3[_0x7673('0x6')]||'';this[_0x7673('0x7')]=_0x5505d3[_0x7673('0x7')]||'';this[_0x7673('0x8')]=_0x5505d3[_0x7673('0x8')]||'';this[_0x7673('0x9')]=_0x5505d3[_0x7673('0x9')]||'';this[_0x7673('0xa')]=_0x5505d3[_0x7673('0xa')]||'';this[_0x7673('0xb')]=_0x5505d3['Configurations']||{};}module[_0x7673('0xc')]=DeskAccount; \ No newline at end of file +var _0x7a8b=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x4c18a1,_0x5708c4){var _0x3e7632=function(_0x26fbf1){while(--_0x26fbf1){_0x4c18a1['push'](_0x4c18a1['shift']());}};_0x3e7632(++_0x5708c4);}(_0x7a8b,0xd8));var _0xb7a8=function(_0x37bcf0,_0x4b44b1){_0x37bcf0=_0x37bcf0-0x0;var _0x41b0f5=_0x7a8b[_0x37bcf0];return _0x41b0f5;};'use strict';function DeskAccount(_0xca014b){this['id']=_0xca014b['id']||0x0;this['name']=_0xca014b[_0xb7a8('0x0')]||'';this[_0xb7a8('0x1')]=_0xca014b[_0xb7a8('0x1')]||'';this[_0xb7a8('0x2')]=_0xca014b['remoteUri']||'';this[_0xb7a8('0x3')]=_0xca014b[_0xb7a8('0x3')]||'';this[_0xb7a8('0x4')]=_0xca014b['password']||'';this['consumerKey']=_0xca014b[_0xb7a8('0x5')]||'';this[_0xb7a8('0x6')]=_0xca014b[_0xb7a8('0x6')]||'';this['token']=_0xca014b[_0xb7a8('0x7')]||'';this[_0xb7a8('0x8')]=_0xca014b[_0xb7a8('0x8')]||'';this[_0xb7a8('0x9')]=_0xca014b[_0xb7a8('0x9')]||'';this['serverUrl']=_0xca014b[_0xb7a8('0xa')]||'';this[_0xb7a8('0xb')]=_0xca014b[_0xb7a8('0xb')]||{};}module[_0xb7a8('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e56d5bb..a113d2d 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 _0x4174=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x46d071,_0xcdd690){var _0x455f6c=function(_0x25eec2){while(--_0x25eec2){_0x46d071['push'](_0x46d071['shift']());}};_0x455f6c(++_0xcdd690);}(_0x4174,0x12a));var _0x4417=function(_0x55ec67,_0x1c90d5){_0x55ec67=_0x55ec67-0x0;var _0x1350f6=_0x4174[_0x55ec67];return _0x1350f6;};'use strict';function Dynamics365Account(_0x3be3b2){this['id']=_0x3be3b2['id']||0x0;this[_0x4417('0x0')]=_0x3be3b2[_0x4417('0x0')]||'';this[_0x4417('0x1')]=_0x3be3b2[_0x4417('0x1')]||'';this[_0x4417('0x2')]=_0x3be3b2['password']||'';this[_0x4417('0x3')]=_0x3be3b2['remoteUri']||'';this['tenantId']=_0x3be3b2[_0x4417('0x4')]||'';this['clientId']=_0x3be3b2[_0x4417('0x5')]||'';this[_0x4417('0x6')]=_0x3be3b2[_0x4417('0x6')]||{};this['serverUrl']=_0x3be3b2[_0x4417('0x7')]||'';this[_0x4417('0x8')]=_0x3be3b2['modernAuthentication']||![];this[_0x4417('0x9')]=_0x3be3b2[_0x4417('0x9')]||{};this['CloudProvider']=_0x3be3b2[_0x4417('0xa')]||{};}module[_0x4417('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa246=['password','remoteUri','tenantId','clientId','serverUrl','modernAuthentication','CloudProvider','exports','name','username'];(function(_0x1d5df7,_0x3baca8){var _0x57c7f6=function(_0x56818c){while(--_0x56818c){_0x1d5df7['push'](_0x1d5df7['shift']());}};_0x57c7f6(++_0x3baca8);}(_0xa246,0xee));var _0x6a24=function(_0x53cb6b,_0x52840e){_0x53cb6b=_0x53cb6b-0x0;var _0x67ffe3=_0xa246[_0x53cb6b];return _0x67ffe3;};'use strict';function Dynamics365Account(_0x4fb7ef){this['id']=_0x4fb7ef['id']||0x0;this[_0x6a24('0x0')]=_0x4fb7ef['name']||'';this[_0x6a24('0x1')]=_0x4fb7ef['username']||'';this[_0x6a24('0x2')]=_0x4fb7ef['password']||'';this[_0x6a24('0x3')]=_0x4fb7ef[_0x6a24('0x3')]||'';this[_0x6a24('0x4')]=_0x4fb7ef['tenantId']||'';this[_0x6a24('0x5')]=_0x4fb7ef[_0x6a24('0x5')]||'';this['clientSecret']=_0x4fb7ef['clientSecret']||{};this[_0x6a24('0x6')]=_0x4fb7ef[_0x6a24('0x6')]||'';this['modernAuthentication']=_0x4fb7ef[_0x6a24('0x7')]||![];this['Configurations']=_0x4fb7ef['Configurations']||{};this[_0x6a24('0x8')]=_0x4fb7ef[_0x6a24('0x8')]||{};}module[_0x6a24('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 651e026..133cd09 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 _0xc58b=['tech','Trunk','ListId','key','name','description','ecm','headerinfo','minrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x369ab1,_0x196273){var _0x54149f=function(_0x3ab025){while(--_0x3ab025){_0x369ab1['push'](_0x369ab1['shift']());}};_0x54149f(++_0x196273);}(_0xc58b,0xf2));var _0xbc58=function(_0x4a55da,_0x32b39b){_0x4a55da=_0x4a55da-0x0;var _0x56086b=_0xc58b[_0x4a55da];return _0x56086b;};'use strict';function FaxAccount(_0x1a0d37){this['id']=_0x1a0d37['id']||0x0;this['name']=_0x1a0d37[_0xbc58('0x0')]||'';this[_0xbc58('0x1')]=_0x1a0d37[_0xbc58('0x1')];this[_0xbc58('0x2')]=_0x1a0d37[_0xbc58('0x2')];this[_0xbc58('0x3')]=_0x1a0d37[_0xbc58('0x3')];this['localstationid']=_0x1a0d37['localstationid'];this[_0xbc58('0x4')]=_0x1a0d37[_0xbc58('0x4')]||0x960;this['maxrate']=_0x1a0d37['maxrate']||0x3840;this[_0xbc58('0x5')]=_0x1a0d37[_0xbc58('0x5')]||_0xbc58('0x6');this['gateway']=_0x1a0d37[_0xbc58('0x7')]||'no';this['faxdetect']=_0x1a0d37[_0xbc58('0x8')]||'no';this['t38timeout']=_0x1a0d37[_0xbc58('0x9')]||0x1388;this[_0xbc58('0xa')]=_0x1a0d37[_0xbc58('0xa')]||'SIP';this['Trunk']=_0x1a0d37[_0xbc58('0xb')]?_0x1a0d37[_0xbc58('0xb')]:undefined;this[_0xbc58('0xc')]=_0x1a0d37[_0xbc58('0xc')];this['key']=_0x1a0d37[_0xbc58('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xa1c2=['ListId','key','name','description','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa1c2,0xe2));var _0x2a1c=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xa1c2[_0x487496];return _0x539dc8;};'use strict';function FaxAccount(_0x588cac){this['id']=_0x588cac['id']||0x0;this[_0x2a1c('0x0')]=_0x588cac[_0x2a1c('0x0')]||'';this[_0x2a1c('0x1')]=_0x588cac[_0x2a1c('0x1')];this['ecm']=_0x588cac['ecm'];this['headerinfo']=_0x588cac['headerinfo'];this[_0x2a1c('0x2')]=_0x588cac[_0x2a1c('0x2')];this['minrate']=_0x588cac[_0x2a1c('0x3')]||0x960;this[_0x2a1c('0x4')]=_0x588cac['maxrate']||0x3840;this['modem']=_0x588cac[_0x2a1c('0x5')]||_0x2a1c('0x6');this[_0x2a1c('0x7')]=_0x588cac['gateway']||'no';this[_0x2a1c('0x8')]=_0x588cac['faxdetect']||'no';this[_0x2a1c('0x9')]=_0x588cac[_0x2a1c('0x9')]||0x1388;this['tech']=_0x588cac['tech']||_0x2a1c('0xa');this['Trunk']=_0x588cac[_0x2a1c('0xb')]?_0x588cac[_0x2a1c('0xb')]:undefined;this['ListId']=_0x588cac[_0x2a1c('0xc')];this['key']=_0x588cac[_0x2a1c('0xd')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 32efd0e..ee9b951 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 _0xe284=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4366ec,_0x160d8a){var _0x19f23a=function(_0x20ffc7){while(--_0x20ffc7){_0x4366ec['push'](_0x4366ec['shift']());}};_0x19f23a(++_0x160d8a);}(_0xe284,0xb4));var _0x4e28=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xe284[_0x384231];return _0x2480bf;};'use strict';function FreshdeskAccount(_0x386a12){this['id']=_0x386a12['id']||0x0;this[_0x4e28('0x0')]=_0x386a12[_0x4e28('0x0')]||'';this[_0x4e28('0x1')]=_0x386a12[_0x4e28('0x1')]||'';this[_0x4e28('0x2')]=_0x386a12[_0x4e28('0x3')]||'';this[_0x4e28('0x4')]=_0x386a12[_0x4e28('0x4')]||'';this[_0x4e28('0x5')]=_0x386a12[_0x4e28('0x5')]||'';this[_0x4e28('0x6')]=_0x386a12[_0x4e28('0x6')]||{};}module[_0x4e28('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7dac=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x2ef15a,_0x2eb29b){var _0x56bf24=function(_0x13cd0a){while(--_0x13cd0a){_0x2ef15a['push'](_0x2ef15a['shift']());}};_0x56bf24(++_0x2eb29b);}(_0x7dac,0x1d6));var _0xc7da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dac[_0x321bb2];return _0x9c12ed;};'use strict';function FreshdeskAccount(_0x582150){this['id']=_0x582150['id']||0x0;this[_0xc7da('0x0')]=_0x582150['name']||'';this['username']=_0x582150[_0xc7da('0x1')]||'';this['apiKey']=_0x582150[_0xc7da('0x2')]||'';this[_0xc7da('0x3')]=_0x582150[_0xc7da('0x3')]||'';this[_0xc7da('0x4')]=_0x582150[_0xc7da('0x4')]||'';this[_0xc7da('0x5')]=_0x582150[_0xc7da('0x5')]||{};}module[_0xc7da('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 46e7ded..6ff13d7 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 _0xdf98=['remoteUri','serverUrl','Configurations','exports','name','apiKey','token'];(function(_0x23840e,_0x2fb0cb){var _0x277300=function(_0x246e5a){while(--_0x246e5a){_0x23840e['push'](_0x23840e['shift']());}};_0x277300(++_0x2fb0cb);}(_0xdf98,0xcf));var _0x8df9=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xdf98[_0x58d5ac];return _0x37985c;};'use strict';function FreshsalesAccount(_0x52102b){this['id']=_0x52102b['id']||0x0;this['name']=_0x52102b[_0x8df9('0x0')]||'';this['username']=_0x52102b['username']||'';this[_0x8df9('0x1')]=_0x52102b[_0x8df9('0x2')]||'';this[_0x8df9('0x3')]=_0x52102b[_0x8df9('0x3')]||'';this[_0x8df9('0x4')]=_0x52102b[_0x8df9('0x4')]||'';this[_0x8df9('0x5')]=_0x52102b[_0x8df9('0x5')]||{};}module[_0x8df9('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x535d=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x3d8088,_0x13ce30){var _0x1baf8a=function(_0x2e84eb){while(--_0x2e84eb){_0x3d8088['push'](_0x3d8088['shift']());}};_0x1baf8a(++_0x13ce30);}(_0x535d,0xe8));var _0xd535=function(_0x2ee057,_0x1d85a8){_0x2ee057=_0x2ee057-0x0;var _0x5be487=_0x535d[_0x2ee057];return _0x5be487;};'use strict';function FreshsalesAccount(_0x28de83){this['id']=_0x28de83['id']||0x0;this[_0xd535('0x0')]=_0x28de83['name']||'';this[_0xd535('0x1')]=_0x28de83[_0xd535('0x1')]||'';this['apiKey']=_0x28de83['token']||'';this[_0xd535('0x2')]=_0x28de83[_0xd535('0x2')]||'';this[_0xd535('0x3')]=_0x28de83[_0xd535('0x3')]||'';this[_0xd535('0x4')]=_0x28de83[_0xd535('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 76f1a41..69d3e42 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 _0x605a=['calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x268403,_0x51a72e){var _0x45bc55=function(_0x503f35){while(--_0x503f35){_0x268403['push'](_0x268403['shift']());}};_0x45bc55(++_0x51a72e);}(_0x605a,0x1a8));var _0xa605=function(_0x2c9770,_0x418a8d){_0x2c9770=_0x2c9770-0x0;var _0x41fb35=_0x605a[_0x2c9770];return _0x41fb35;};'use strict';function QueueReport(){this[_0xa605('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this[_0xa605('0x1')]='';this[_0xa605('0x2')]='';this[_0xa605('0x3')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xa605('0x4')]=0x1;this[_0xa605('0x5')]=![];this[_0xa605('0x6')]=null;this[_0xa605('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xa605('0x8')]=![];this[_0xa605('0x9')]=null;this[_0xa605('0xa')]=0x1;this[_0xa605('0xb')]='';this[_0xa605('0xc')]='';this[_0xa605('0xd')]='';this[_0xa605('0xe')]='';this[_0xa605('0xf')]='';this[_0xa605('0x10')]='';this[_0xa605('0x11')]='';this[_0xa605('0x12')]=0x0;this['assigned']=![];this[_0xa605('0x13')]='';this[_0xa605('0x14')]=_0xa605('0x15');this[_0xa605('0x16')]=0x0;this[_0xa605('0x17')]={};}module[_0xa605('0x18')]=QueueReport; \ No newline at end of file +var _0x2b8e=['holdtime','assigned','motionChannel','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority'];(function(_0x5eeab2,_0x938fad){var _0x21bc3b=function(_0x252e11){while(--_0x252e11){_0x5eeab2['push'](_0x5eeab2['shift']());}};_0x21bc3b(++_0x938fad);}(_0x2b8e,0x100));var _0xe2b8=function(_0xbee5d7,_0x29bd85){_0xbee5d7=_0xbee5d7-0x0;var _0x7938c7=_0x2b8e[_0xbee5d7];return _0x7938c7;};'use strict';function QueueReport(){this[_0xe2b8('0x0')]=_0xe2b8('0x1');this[_0xe2b8('0x2')]='';this[_0xe2b8('0x3')]='';this[_0xe2b8('0x4')]='';this[_0xe2b8('0x5')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xe2b8('0x6')]=0x1;this['count']=0x1;this[_0xe2b8('0x7')]=![];this[_0xe2b8('0x8')]=null;this[_0xe2b8('0x9')]=![];this[_0xe2b8('0xa')]=null;this[_0xe2b8('0xb')]=![];this[_0xe2b8('0xc')]=null;this[_0xe2b8('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xe2b8('0xe')]='';this[_0xe2b8('0xf')]='';this[_0xe2b8('0x10')]='';this[_0xe2b8('0x11')]='';this[_0xe2b8('0x12')]='';this[_0xe2b8('0x13')]=0x0;this[_0xe2b8('0x14')]=![];this['lastAssignedTo']='';this[_0xe2b8('0x15')]='voice';this[_0xe2b8('0x16')]=0x0;this[_0xe2b8('0x17')]={};}module[_0xe2b8('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c50e4c7..1ce0b66 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 _0x6d20=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x53cf75,_0x5ca782){var _0x5e7bf8=function(_0x168087){while(--_0x168087){_0x53cf75['push'](_0x53cf75['shift']());}};_0x5e7bf8(++_0x5ca782);}(_0x6d20,0xf7));var _0x06d2=function(_0xf74372,_0x51fe82){_0xf74372=_0xf74372-0x0;var _0x36bb65=_0x6d20[_0xf74372];return _0x36bb65;};'use strict';function SalesforceAccount(_0x45a4db){this['id']=_0x45a4db['id']||0x0;this['name']=_0x45a4db[_0x06d2('0x0')]||'';this[_0x06d2('0x1')]=_0x45a4db[_0x06d2('0x1')]||'';this[_0x06d2('0x2')]=_0x45a4db[_0x06d2('0x2')]||'';this[_0x06d2('0x3')]=_0x45a4db['password']||'';this['clientId']=_0x45a4db[_0x06d2('0x4')]||'';this[_0x06d2('0x5')]=_0x45a4db['clientSecret']||'';this[_0x06d2('0x6')]=_0x45a4db['securityToken']||'';this[_0x06d2('0x7')]=_0x45a4db[_0x06d2('0x7')]||_0x06d2('0x8');this[_0x06d2('0x9')]=_0x45a4db[_0x06d2('0x9')]||'';this['Configurations']=_0x45a4db[_0x06d2('0xa')]||{};}module[_0x06d2('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x896e=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x4fda38,_0x44c823){var _0x16c06b=function(_0x5bad99){while(--_0x5bad99){_0x4fda38['push'](_0x4fda38['shift']());}};_0x16c06b(++_0x44c823);}(_0x896e,0x1e9));var _0xe896=function(_0x5f4b67,_0x36dc6d){_0x5f4b67=_0x5f4b67-0x0;var _0x4da6fd=_0x896e[_0x5f4b67];return _0x4da6fd;};'use strict';function SalesforceAccount(_0xc62635){this['id']=_0xc62635['id']||0x0;this[_0xe896('0x0')]=_0xc62635[_0xe896('0x0')]||'';this[_0xe896('0x1')]=_0xc62635[_0xe896('0x1')]||'';this[_0xe896('0x2')]=_0xc62635[_0xe896('0x2')]||'';this[_0xe896('0x3')]=_0xc62635[_0xe896('0x3')]||'';this[_0xe896('0x4')]=_0xc62635[_0xe896('0x4')]||'';this[_0xe896('0x5')]=_0xc62635['clientSecret']||'';this[_0xe896('0x6')]=_0xc62635[_0xe896('0x6')]||'';this[_0xe896('0x7')]=_0xc62635[_0xe896('0x7')]||_0xe896('0x8');this['serverUrl']=_0xc62635[_0xe896('0x9')]||'';this[_0xe896('0xa')]=_0xc62635[_0xe896('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fe80941..0f49942 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 _0xb7c4=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xb7c4,0x139));var _0x4b7c=function(_0x9626c0,_0x219ec8){_0x9626c0=_0x9626c0-0x0;var _0x146236=_0xb7c4[_0x9626c0];return _0x146236;};'use strict';function ServicenowAccount(_0x451247){this['id']=_0x451247['id']||0x0;this[_0x4b7c('0x0')]=_0x451247[_0x4b7c('0x0')]||'';this[_0x4b7c('0x1')]=_0x451247['username']||'';this[_0x4b7c('0x2')]=_0x451247[_0x4b7c('0x2')]||'';this[_0x4b7c('0x3')]=_0x451247[_0x4b7c('0x3')]||'';this[_0x4b7c('0x4')]=_0x451247['serverUrl']||'';this['Configurations']=_0x451247[_0x4b7c('0x5')]||{};}module[_0x4b7c('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x6f7c=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6f7c,0xd4));var _0xc6f7=function(_0x1ce7cf,_0x1706be){_0x1ce7cf=_0x1ce7cf-0x0;var _0x38fe5a=_0x6f7c[_0x1ce7cf];return _0x38fe5a;};'use strict';function ServicenowAccount(_0x27e914){this['id']=_0x27e914['id']||0x0;this[_0xc6f7('0x0')]=_0x27e914[_0xc6f7('0x0')]||'';this[_0xc6f7('0x1')]=_0x27e914[_0xc6f7('0x1')]||'';this[_0xc6f7('0x2')]=_0x27e914['password']||'';this[_0xc6f7('0x3')]=_0x27e914[_0xc6f7('0x3')]||'';this[_0xc6f7('0x4')]=_0x27e914['serverUrl']||'';this[_0xc6f7('0x5')]=_0x27e914[_0xc6f7('0x5')]||{};}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 ccf8f28..0911c0a 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 _0x064a=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x064a,0xb1));var _0xa064=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x064a[_0x14add3];return _0x4a174f;};'use strict';function SugarcrmAccount(_0x595545){this['id']=_0x595545['id']||0x0;this['name']=_0x595545[_0xa064('0x0')]||'';this[_0xa064('0x1')]=_0x595545[_0xa064('0x1')]||'';this[_0xa064('0x2')]=_0x595545['password']||'';this['remoteUri']=_0x595545[_0xa064('0x3')]||'';this[_0xa064('0x4')]=_0x595545['serverUrl']||'';this[_0xa064('0x5')]=_0x595545[_0xa064('0x5')]||{};}module[_0xa064('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x6acb=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x6acb,0x1c0));var _0xb6ac=function(_0x4e1211,_0x1c0e26){_0x4e1211=_0x4e1211-0x0;var _0x4ae887=_0x6acb[_0x4e1211];return _0x4ae887;};'use strict';function SugarcrmAccount(_0x2e5e9e){this['id']=_0x2e5e9e['id']||0x0;this[_0xb6ac('0x0')]=_0x2e5e9e[_0xb6ac('0x0')]||'';this[_0xb6ac('0x1')]=_0x2e5e9e[_0xb6ac('0x1')]||'';this[_0xb6ac('0x2')]=_0x2e5e9e['password']||'';this[_0xb6ac('0x3')]=_0x2e5e9e[_0xb6ac('0x3')]||'';this[_0xb6ac('0x4')]=_0x2e5e9e[_0xb6ac('0x4')]||'';this[_0xb6ac('0x5')]=_0x2e5e9e['Configurations']||{};}module[_0xb6ac('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 ec8fe62..50826f1 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 _0xdd99=['address','exports','name','accountcode','unknown','stateTime'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xdd99,0x146));var _0x9dd9=function(_0x15e462,_0x1810e4){_0x15e462=_0x15e462-0x0;var _0x2903f7=_0xdd99[_0x15e462];return _0x2903f7;};'use strict';function Telephone(_0x4ea45c){this['id']=_0x4ea45c['id']||0x0;this[_0x9dd9('0x0')]=_0x4ea45c[_0x9dd9('0x0')]||'';this['accountcode']=_0x4ea45c[_0x9dd9('0x1')]||'';this['state']=_0x9dd9('0x2');this[_0x9dd9('0x3')]=0x0;this['status']=_0x9dd9('0x2');this[_0x9dd9('0x4')]='';}module[_0x9dd9('0x5')]=Telephone; \ No newline at end of file +var _0x5c38=['status','address','name','accountcode','unknown','stateTime'];(function(_0x25d94e,_0x59381d){var _0x3f4c2e=function(_0x461d37){while(--_0x461d37){_0x25d94e['push'](_0x25d94e['shift']());}};_0x3f4c2e(++_0x59381d);}(_0x5c38,0xe0));var _0x85c3=function(_0x4de67b,_0x58fa2a){_0x4de67b=_0x4de67b-0x0;var _0x3b6456=_0x5c38[_0x4de67b];return _0x3b6456;};'use strict';function Telephone(_0x19113b){this['id']=_0x19113b['id']||0x0;this[_0x85c3('0x0')]=_0x19113b['name']||'';this[_0x85c3('0x1')]=_0x19113b[_0x85c3('0x1')]||'';this['state']=_0x85c3('0x2');this[_0x85c3('0x3')]=0x0;this[_0x85c3('0x4')]=_0x85c3('0x2');this[_0x85c3('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 6d5ea7a..d985937 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x2c8c4c,_0x325dcc){var _0x50bf69=function(_0x3a132f){while(--_0x3a132f){_0x2c8c4c['push'](_0x2c8c4c['shift']());}};_0x50bf69(++_0x325dcc);}(_0xb10b,0x12a));var _0xbb10=function(_0x137c34,_0x2ebd98){_0x137c34=_0x137c34-0x0;var _0x145d9b=_0xb10b[_0x137c34];return _0x145d9b;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x5ef027,_0x24156f){var _0x475738=function(_0x3145b9){while(--_0x3145b9){_0x5ef027['push'](_0x5ef027['shift']());}};_0x475738(++_0x24156f);}(_0xb10b,0x12a));var _0xbb10=function(_0x474e22,_0x5d5515){_0x474e22=_0x474e22-0x0;var _0x76a179=_0xb10b[_0x474e22];return _0x76a179;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 3d9344d..2c8199e 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4d1238,_0x4534a3){var _0x1baca0=function(_0x366eb2){while(--_0x366eb2){_0x4d1238['push'](_0x4d1238['shift']());}};_0x1baca0(++_0x4534a3);}(_0x8603,0x190));var _0x3860=function(_0x15af6c,_0x47fe2d){_0x15af6c=_0x15af6c-0x0;var _0x13c017=_0x8603[_0x15af6c];return _0x13c017;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x2b26b1,_0x121949){var _0x19acbd=function(_0x26a915){while(--_0x26a915){_0x2b26b1['push'](_0x2b26b1['shift']());}};_0x19acbd(++_0x121949);}(_0x4fc2,0x111));var _0x24fc=function(_0x533290,_0x31e3ae){_0x533290=_0x533290-0x0;var _0x23f13d=_0x4fc2[_0x533290];return _0x23f13d;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ce629a7..3ae0608 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 _0x59f3=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','split','host','port'];(function(_0x2b80ca,_0x113ec3){var _0x2c8d2c=function(_0x4577f2){while(--_0x4577f2){_0x2b80ca['push'](_0x2b80ca['shift']());}};_0x2c8d2c(++_0x113ec3);}(_0x59f3,0xce));var _0x359f=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x59f3[_0x274f14];return _0x13b97e;};'use strict';function Trunk(_0x40f6f0){this['id']=_0x40f6f0['id']||0x0;this[_0x359f('0x0')]=_0x40f6f0[_0x359f('0x0')]||![];this[_0x359f('0x1')]=_0x40f6f0[_0x359f('0x1')]||'';this[_0x359f('0x2')]=_0x359f('0x3');this[_0x359f('0x4')]=0x0;this[_0x359f('0x5')]=_0x359f('0x3');this[_0x359f('0x6')]=_0x40f6f0[_0x359f('0x6')]&&_0x40f6f0[_0x359f('0x6')]['indexOf'](':')?_0x40f6f0[_0x359f('0x6')][_0x359f('0x7')](':')[0x0]:'';this[_0x359f('0x8')]='';this[_0x359f('0x9')]='';this[_0x359f('0xa')]='';this[_0x359f('0xb')]='';this[_0x359f('0xc')]='';this[_0x359f('0xd')]=_0x359f('0x3');this[_0x359f('0xe')]='';this[_0x359f('0xf')]='';this[_0x359f('0x10')]=_0x40f6f0[_0x359f('0x10')]||'';}module[_0x359f('0x11')]=Trunk; \ No newline at end of file +var _0x746a=['domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','port'];(function(_0x384458,_0x527dca){var _0x1a186b=function(_0xdbf526){while(--_0xdbf526){_0x384458['push'](_0x384458['shift']());}};_0x1a186b(++_0x527dca);}(_0x746a,0x1c1));var _0xa746=function(_0x5e777f,_0x55fe35){_0x5e777f=_0x5e777f-0x0;var _0x28f80d=_0x746a[_0x5e777f];return _0x28f80d;};'use strict';function Trunk(_0x34cc82){this['id']=_0x34cc82['id']||0x0;this[_0xa746('0x0')]=_0x34cc82['active']||![];this[_0xa746('0x1')]=_0x34cc82[_0xa746('0x1')]||'';this[_0xa746('0x2')]=_0xa746('0x3');this[_0xa746('0x4')]=0x0;this[_0xa746('0x5')]=_0xa746('0x3');this[_0xa746('0x6')]=_0x34cc82[_0xa746('0x6')]&&_0x34cc82[_0xa746('0x6')][_0xa746('0x7')](':')?_0x34cc82[_0xa746('0x6')][_0xa746('0x8')](':')[0x0]:'';this['host']='';this[_0xa746('0x9')]='';this[_0xa746('0xa')]='';this[_0xa746('0xb')]='';this[_0xa746('0xc')]='';this[_0xa746('0xd')]=_0xa746('0x3');this['registrationtime']='';this[_0xa746('0xe')]='';this[_0xa746('0xf')]=_0x34cc82[_0xa746('0xf')]||'';}module[_0xa746('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 36db486..95c9a21 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 _0x3ee8=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3ee8,0x1e6));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x4676e8){this['id']=_0x4676e8['id']||0x0;this[_0x83ee('0x0')]=_0x4676e8[_0x83ee('0x0')]||'';this['recordingFormat']=_0x4676e8[_0x83ee('0x1')]||'none';this[_0x83ee('0x2')]=_0x4676e8['mandatoryDisposition']||![];}module[_0x83ee('0x3')]=voiceExtension; \ No newline at end of file +var _0x7a7c=['exten','recordingFormat','mandatoryDisposition'];(function(_0x414c97,_0x18f960){var _0x3110c0=function(_0x5563dc){while(--_0x5563dc){_0x414c97['push'](_0x414c97['shift']());}};_0x3110c0(++_0x18f960);}(_0x7a7c,0x195));var _0xc7a7=function(_0x48091e,_0x3d750f){_0x48091e=_0x48091e-0x0;var _0x1cf447=_0x7a7c[_0x48091e];return _0x1cf447;};'use strict';function voiceExtension(_0x15be43){this['id']=_0x15be43['id']||0x0;this[_0xc7a7('0x0')]=_0x15be43[_0xc7a7('0x0')]||'';this[_0xc7a7('0x1')]=_0x15be43[_0xc7a7('0x1')]||'none';this[_0xc7a7('0x2')]=_0x15be43[_0xc7a7('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9241381..d408235 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 _0x3f25=['startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS'];(function(_0x118bf9,_0x411f12){var _0x152c06=function(_0x404fa5){while(--_0x404fa5){_0x118bf9['push'](_0x118bf9['shift']());}};_0x152c06(++_0x411f12);}(_0x3f25,0x181));var _0x53f2=function(_0x932de0,_0x45b2d1){_0x932de0=_0x932de0-0x0;var _0x2f4e9d=_0x3f25[_0x932de0];return _0x2f4e9d;};'use strict';var statusDesc=[_0x53f2('0x0'),'not_inuse',_0x53f2('0x1'),_0x53f2('0x2'),_0x53f2('0x3'),'unavailable',_0x53f2('0x4'),_0x53f2('0x5'),_0x53f2('0x6')];var monitorFormat={'wav':_0x53f2('0x7'),'wav49':'wav49','gsm':_0x53f2('0x8')};var strategy={'rrmemory':_0x53f2('0x9'),'roundrobin':_0x53f2('0xa')};function VoiceQueue(_0x2ef5f2){this['id']=_0x2ef5f2['id']||0x0;this[_0x53f2('0xb')]=_0x2ef5f2[_0x53f2('0xb')]||'';this[_0x53f2('0xc')]=_0x2ef5f2[_0x53f2('0xc')]||'';this['type']=_0x2ef5f2[_0x53f2('0xd')]||_0x53f2('0xe');this['waiting']=0x0;this[_0x53f2('0xf')]=0x0;this[_0x53f2('0x10')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x53f2('0x11')]=0x0;this[_0x53f2('0x12')]=0x0;this[_0x53f2('0x13')]=0x0;this[_0x53f2('0x14')]=0x0;this[_0x53f2('0x15')]=0x0;this[_0x53f2('0x16')]=_0x2ef5f2[_0x53f2('0x16')]||![];this[_0x53f2('0x17')]=_0x2ef5f2[_0x53f2('0x17')]||0xa;this[_0x53f2('0x18')]=_0x2ef5f2['autopause']||'no';this[_0x53f2('0x19')]=!![];this[_0x53f2('0x1a')]='';this[_0x53f2('0x1b')]=0x0;this[_0x53f2('0x1c')]=0x0;this[_0x53f2('0x1d')]=_0x2ef5f2[_0x53f2('0x1d')]||null;this['dialGlobalInterval']=_0x2ef5f2[_0x53f2('0x1e')]?_0x2ef5f2[_0x53f2('0x1e')]:null;this[_0x53f2('0x1f')]=_0x2ef5f2[_0x53f2('0x1f')];this[_0x53f2('0x20')]=_0x2ef5f2[_0x53f2('0x20')]||_0x53f2('0x21');this[_0x53f2('0x22')]=_0x2ef5f2[_0x53f2('0x22')]||0x0;this[_0x53f2('0x23')]=_0x2ef5f2['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x2ef5f2[_0x53f2('0x24')]||0x1;this[_0x53f2('0x25')]=_0x2ef5f2[_0x53f2('0x25')]||_0x53f2('0x26');this[_0x53f2('0x27')]=_0x2ef5f2['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2ef5f2[_0x53f2('0x28')]||0x258;this[_0x53f2('0x29')]=_0x2ef5f2[_0x53f2('0x29')]||_0x53f2('0x2a');this['dialOriginateCallerIdNumber']=_0x2ef5f2['dialOriginateCallerIdNumber']||_0x53f2('0x2a');this[_0x53f2('0x2b')]=_0x2ef5f2[_0x53f2('0x2b')]||0x1e;this[_0x53f2('0x2c')]=_0x2ef5f2[_0x53f2('0x2c')]||_0x53f2('0x2d');this[_0x53f2('0x2e')]=_0x2ef5f2[_0x53f2('0x2e')]||0x3;this[_0x53f2('0x2f')]=_0x2ef5f2[_0x53f2('0x2f')]||undefined;this[_0x53f2('0x30')]=_0x2ef5f2[_0x53f2('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x2ef5f2[_0x53f2('0x31')]||0x96;this[_0x53f2('0x32')]=_0x2ef5f2[_0x53f2('0x32')]||0x3;this[_0x53f2('0x33')]=_0x2ef5f2['dialBusyRetryFrequency']||0x96;this[_0x53f2('0x34')]=_0x2ef5f2['dialNoAnswerMaxRetry']||0x3;this[_0x53f2('0x35')]=_0x2ef5f2['dialNoAnswerRetryFrequency']||0x96;this[_0x53f2('0x36')]=_0x2ef5f2['dialNoSuchNumberMaxRetry']||0x3;this[_0x53f2('0x37')]=_0x2ef5f2['dialNoSuchNumberRetryFrequency']||0x96;this[_0x53f2('0x38')]=_0x2ef5f2[_0x53f2('0x38')]||0x3;this[_0x53f2('0x39')]=_0x2ef5f2[_0x53f2('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x2ef5f2[_0x53f2('0x3a')]||0x3;this[_0x53f2('0x3b')]=_0x2ef5f2['dialAbandonedRetryFrequency']||0x96;this[_0x53f2('0x3c')]=_0x2ef5f2[_0x53f2('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x2ef5f2[_0x53f2('0x3d')]||0x96;this[_0x53f2('0x3e')]=_0x2ef5f2[_0x53f2('0x3e')]||0x3;this[_0x53f2('0x3f')]=_0x2ef5f2[_0x53f2('0x3f')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2ef5f2[_0x53f2('0x40')]||0x3;this[_0x53f2('0x41')]=_0x2ef5f2['dialGlobalMaxRetry']||0x4;this[_0x53f2('0x42')]=_0x2ef5f2[_0x53f2('0x42')]?_0x2ef5f2[_0x53f2('0x42')]:undefined;this[_0x53f2('0x43')]=_0x2ef5f2[_0x53f2('0x43')]?_0x2ef5f2[_0x53f2('0x43')]:undefined;this[_0x53f2('0x44')]=_0x2ef5f2[_0x53f2('0x44')]||undefined;this[_0x53f2('0x45')]=_0x2ef5f2[_0x53f2('0x45')]?_0x2ef5f2['Interval']:undefined;this[_0x53f2('0x46')]=_0x2ef5f2[_0x53f2('0x46')]||_0x53f2('0x47');this[_0x53f2('0x48')]=_0x2ef5f2[_0x53f2('0x48')]||undefined;this[_0x53f2('0x49')]=_0x2ef5f2['dialCutDigit']||undefined;this[_0x53f2('0x4a')]=strategy[_0x2ef5f2[_0x53f2('0x4a')]]||_0x53f2('0x9');this['queueStatusComplete']=!![];this[_0x53f2('0x4b')]=_0x2ef5f2[_0x53f2('0x4b')]||![];this[_0x53f2('0x4c')]=_0x2ef5f2['dialAMDInitialSilence'];this[_0x53f2('0x4d')]=_0x2ef5f2['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2ef5f2['dialAMDAfterGreetingSilence'];this[_0x53f2('0x4e')]=_0x2ef5f2['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x2ef5f2[_0x53f2('0x4f')];this[_0x53f2('0x50')]=_0x2ef5f2[_0x53f2('0x50')];this['dialAMDMaximumNumberOfWords']=_0x2ef5f2[_0x53f2('0x51')];this[_0x53f2('0x52')]=_0x2ef5f2[_0x53f2('0x52')];this[_0x53f2('0x53')]=_0x2ef5f2[_0x53f2('0x53')];this[_0x53f2('0x54')]=0x0;this[_0x53f2('0x55')]=0x0;this['timeout']=_0x2ef5f2['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x53f2('0x56')]=0x0;this[_0x53f2('0x57')]=0x0;this[_0x53f2('0x58')]=0x0;this[_0x53f2('0x59')]=0x0;this[_0x53f2('0x5a')]=0x0;this[_0x53f2('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x53f2('0x5c')]=0x0;this[_0x53f2('0x5d')]=0x0;this[_0x53f2('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x53f2('0x5f')]=undefined;this[_0x53f2('0x60')]=undefined;this[_0x53f2('0x61')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x53f2('0x62')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x53f2('0x63')]=0x0;this[_0x53f2('0x64')]=0x0;this[_0x53f2('0x65')]=0x0;this[_0x53f2('0x66')]=0x0;this[_0x53f2('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2ef5f2['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x53f2('0x68')]=_0x2ef5f2[_0x53f2('0x69')]||0xa;this[_0x53f2('0x6a')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x53f2('0x6b')]=0x1;this['erlangCalls']=0x0;this[_0x53f2('0x6c')]=0x0;this[_0x53f2('0x6d')]=0x0;this[_0x53f2('0x6e')]=0x0;this[_0x53f2('0x6f')]=_0x2ef5f2[_0x53f2('0x6f')]||0x1e;this[_0x53f2('0x70')]=_0x2ef5f2[_0x53f2('0x70')]||![];this[_0x53f2('0x71')]=!!_0x2ef5f2['dialPreviewAutoRecallMe']||![];this[_0x53f2('0x72')]=!!_0x2ef5f2['dialPreviewRecallmeReminder']||![];this[_0x53f2('0x73')]=_0x2ef5f2['dialQueueProject2']||undefined;this[_0x53f2('0x74')]=_0x2ef5f2[_0x53f2('0x74')]||![];this[_0x53f2('0x75')]=_0x2ef5f2[_0x53f2('0x75')]||![];this[_0x53f2('0xc')]=monitorFormat[_0x2ef5f2[_0x53f2('0xc')]]?monitorFormat[_0x2ef5f2['monitor_format']]:undefined;this[_0x53f2('0x76')]=_0x2ef5f2[_0x53f2('0x76')]||![];this[_0x53f2('0x77')]=_0x2ef5f2[_0x53f2('0x77')]?_0x2ef5f2[_0x53f2('0x77')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x8c78=['handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive'];(function(_0x380175,_0x2191a3){var _0x209e0b=function(_0x2ad1f0){while(--_0x2ad1f0){_0x380175['push'](_0x380175['shift']());}};_0x209e0b(++_0x2191a3);}(_0x8c78,0x197));var _0x88c7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8c78[_0x2be8c2];return _0x97f531;};'use strict';var statusDesc=['unknown','not_inuse',_0x88c7('0x0'),'busy',_0x88c7('0x1'),_0x88c7('0x2'),_0x88c7('0x3'),_0x88c7('0x4'),_0x88c7('0x5')];var monitorFormat={'wav':_0x88c7('0x6'),'wav49':_0x88c7('0x7'),'gsm':_0x88c7('0x8')};var strategy={'rrmemory':_0x88c7('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x17f506){this['id']=_0x17f506['id']||0x0;this[_0x88c7('0xa')]=_0x17f506[_0x88c7('0xa')]||'';this[_0x88c7('0xb')]=_0x17f506[_0x88c7('0xb')]||'';this[_0x88c7('0xc')]=_0x17f506[_0x88c7('0xc')]||_0x88c7('0xd');this[_0x88c7('0xe')]=0x0;this[_0x88c7('0xf')]=0x0;this[_0x88c7('0x10')]=0x0;this[_0x88c7('0x11')]=0x0;this['sumDuration']=0x0;this[_0x88c7('0x12')]=0x0;this[_0x88c7('0x13')]=0x0;this['unmanaged']=0x0;this[_0x88c7('0x14')]=0x0;this['loggedIn']=0x0;this[_0x88c7('0x15')]=0x0;this[_0x88c7('0x16')]=_0x17f506[_0x88c7('0x16')]||![];this[_0x88c7('0x17')]=_0x17f506['acwTimeout']||0xa;this[_0x88c7('0x18')]=_0x17f506[_0x88c7('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x88c7('0x19')]='';this[_0x88c7('0x1a')]=0x0;this[_0x88c7('0x1b')]=0x0;this[_0x88c7('0x1c')]=_0x17f506[_0x88c7('0x1c')]||null;this['dialGlobalInterval']=_0x17f506['dialGlobalInterval']?_0x17f506[_0x88c7('0x1d')]:null;this['dialActive']=_0x17f506[_0x88c7('0x1e')];this[_0x88c7('0x1f')]=_0x17f506['dialMethod']||_0x88c7('0x20');this[_0x88c7('0x21')]=_0x17f506[_0x88c7('0x21')]||0x0;this[_0x88c7('0x22')]=_0x17f506[_0x88c7('0x22')]||0x0;this[_0x88c7('0x23')]=_0x17f506[_0x88c7('0x23')]||0x1;this[_0x88c7('0x24')]=_0x17f506[_0x88c7('0x24')]||_0x88c7('0x25');this[_0x88c7('0x26')]=_0x17f506['dialPredictiveOptimizationPercentage']||0.03;this[_0x88c7('0x27')]=_0x17f506['dialPredictiveInterval']||0x258;this[_0x88c7('0x28')]=_0x17f506['dialOriginateCallerIdName']||_0x88c7('0x29');this['dialOriginateCallerIdNumber']=_0x17f506[_0x88c7('0x2a')]||_0x88c7('0x29');this['dialOriginateTimeout']=_0x17f506[_0x88c7('0x2b')]||0x1e;this[_0x88c7('0x2c')]=_0x17f506[_0x88c7('0x2c')]||'tTxX';this[_0x88c7('0x2d')]=_0x17f506['dialQueueTimeout']||0x3;this[_0x88c7('0x2e')]=_0x17f506[_0x88c7('0x2e')]||undefined;this[_0x88c7('0x2f')]=_0x17f506['dialCongestionMaxRetry']||0x3;this[_0x88c7('0x30')]=_0x17f506[_0x88c7('0x30')]||0x96;this['dialBusyMaxRetry']=_0x17f506[_0x88c7('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x17f506[_0x88c7('0x32')]||0x96;this[_0x88c7('0x33')]=_0x17f506[_0x88c7('0x33')]||0x3;this[_0x88c7('0x34')]=_0x17f506[_0x88c7('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x17f506['dialNoSuchNumberMaxRetry']||0x3;this[_0x88c7('0x35')]=_0x17f506[_0x88c7('0x35')]||0x96;this[_0x88c7('0x36')]=_0x17f506[_0x88c7('0x36')]||0x3;this[_0x88c7('0x37')]=_0x17f506['dialDropRetryFrequency']||0x96;this[_0x88c7('0x38')]=_0x17f506['dialAbandonedMaxRetry']||0x3;this[_0x88c7('0x39')]=_0x17f506[_0x88c7('0x39')]||0x96;this['dialMachineMaxRetry']=_0x17f506['dialMachineMaxRetry']||0x3;this[_0x88c7('0x3a')]=_0x17f506[_0x88c7('0x3a')]||0x96;this[_0x88c7('0x3b')]=_0x17f506['dialAgentRejectMaxRetry']||0x3;this[_0x88c7('0x3c')]=_0x17f506[_0x88c7('0x3c')]||0x96;this['callAdditionalPhoneAfterMin']=_0x17f506[_0x88c7('0x3d')]||0x3;this[_0x88c7('0x3e')]=_0x17f506[_0x88c7('0x3e')]||0x4;this[_0x88c7('0x3f')]=_0x17f506[_0x88c7('0x3f')]?_0x17f506['Trunk']:undefined;this[_0x88c7('0x40')]=_0x17f506[_0x88c7('0x40')]?_0x17f506[_0x88c7('0x40')]:undefined;this['dialPrefix']=_0x17f506['dialPrefix']||undefined;this[_0x88c7('0x41')]=_0x17f506[_0x88c7('0x41')]?_0x17f506[_0x88c7('0x41')]:undefined;this[_0x88c7('0x42')]=_0x17f506[_0x88c7('0x42')]||_0x88c7('0x43');this['dialRandomLastDigitCallerIdNumber']=_0x17f506[_0x88c7('0x44')]||undefined;this[_0x88c7('0x45')]=_0x17f506[_0x88c7('0x45')]||undefined;this['strategy']=strategy[_0x17f506[_0x88c7('0x46')]]||_0x88c7('0x9');this[_0x88c7('0x47')]=!![];this[_0x88c7('0x48')]=_0x17f506[_0x88c7('0x48')]||![];this[_0x88c7('0x49')]=_0x17f506[_0x88c7('0x49')];this[_0x88c7('0x4a')]=_0x17f506[_0x88c7('0x4a')];this['dialAMDAfterGreetingSilence']=_0x17f506[_0x88c7('0x4b')];this[_0x88c7('0x4c')]=_0x17f506[_0x88c7('0x4c')];this[_0x88c7('0x4d')]=_0x17f506[_0x88c7('0x4d')];this[_0x88c7('0x4e')]=_0x17f506[_0x88c7('0x4e')];this[_0x88c7('0x4f')]=_0x17f506[_0x88c7('0x4f')];this[_0x88c7('0x50')]=_0x17f506['dialAMDSilenceThreshold'];this[_0x88c7('0x51')]=_0x17f506[_0x88c7('0x51')];this[_0x88c7('0x52')]=0x0;this[_0x88c7('0x53')]=0x0;this[_0x88c7('0x54')]=_0x17f506[_0x88c7('0x54')];this[_0x88c7('0x55')]=0x0;this[_0x88c7('0x56')]=0x0;this[_0x88c7('0x57')]=0x0;this[_0x88c7('0x58')]=0x0;this[_0x88c7('0x59')]=0x0;this[_0x88c7('0x5a')]=0x0;this[_0x88c7('0x5b')]=0x0;this[_0x88c7('0x5c')]=0x0;this[_0x88c7('0x5d')]=0x0;this[_0x88c7('0x5e')]=0x0;this[_0x88c7('0x5f')]=0x0;this[_0x88c7('0x60')]=0x0;this[_0x88c7('0x61')]=0x0;this[_0x88c7('0x62')]=0x0;this[_0x88c7('0x63')]=undefined;this[_0x88c7('0x64')]=undefined;this[_0x88c7('0x65')]=undefined;this[_0x88c7('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x88c7('0x67')]=0x0;this[_0x88c7('0x68')]=0x0;this[_0x88c7('0x69')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x88c7('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x88c7('0x6b')]=0x0;this[_0x88c7('0x6c')]=_0x17f506[_0x88c7('0x6d')]||0x14;this[_0x88c7('0x6e')]=_0x17f506[_0x88c7('0x6d')]||0xa;this[_0x88c7('0x6f')]=0x0;this[_0x88c7('0x70')]=0x0;this[_0x88c7('0x71')]=0x1;this[_0x88c7('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x88c7('0x73')]=0x0;this[_0x88c7('0x74')]=0x0;this[_0x88c7('0x75')]=_0x17f506[_0x88c7('0x75')]||0x1e;this[_0x88c7('0x76')]=_0x17f506[_0x88c7('0x76')]||![];this[_0x88c7('0x77')]=!!_0x17f506[_0x88c7('0x77')]||![];this[_0x88c7('0x78')]=!!_0x17f506[_0x88c7('0x78')]||![];this[_0x88c7('0x79')]=_0x17f506[_0x88c7('0x79')]||undefined;this[_0x88c7('0x7a')]=_0x17f506[_0x88c7('0x7a')]||![];this[_0x88c7('0x7b')]=_0x17f506['dialAgiAfterHangupAgent']||![];this[_0x88c7('0xb')]=monitorFormat[_0x17f506[_0x88c7('0xb')]]?monitorFormat[_0x17f506[_0x88c7('0xb')]]:undefined;this['mandatoryDisposition']=_0x17f506[_0x88c7('0x7c')]||![];this['mandatoryDispositionPause']=_0x17f506[_0x88c7('0x7d')]?_0x17f506[_0x88c7('0x7d')]:undefined;}module[_0x88c7('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3fadf80..48f79af 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 _0x0c73=['exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3f6f77,_0x55ad6b){var _0x1df664=function(_0x55a861){while(--_0x55a861){_0x3f6f77['push'](_0x3f6f77['shift']());}};_0x1df664(++_0x55ad6b);}(_0x0c73,0x1f3));var _0x30c7=function(_0x39c323,_0x1642e0){_0x39c323=_0x39c323-0x0;var _0x245081=_0x0c73[_0x39c323];return _0x245081;};'use strict';function VtigerAccount(_0x36e2d6){this['id']=_0x36e2d6['id']||0x0;this['name']=_0x36e2d6[_0x30c7('0x0')]||'';this[_0x30c7('0x1')]=_0x36e2d6['username']||'';this[_0x30c7('0x2')]=_0x36e2d6[_0x30c7('0x2')]||'';this[_0x30c7('0x3')]=_0x36e2d6['remoteUri']||'';this[_0x30c7('0x4')]=_0x36e2d6['serverUrl']||'';this['Configurations']=_0x36e2d6['Configurations']||{};}module[_0x30c7('0x5')]=VtigerAccount; \ No newline at end of file +var _0xff76=['name','username','accessKey','remoteUri','serverUrl'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0xff76,0x87));var _0x6ff7=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xff76[_0x40bffc];return _0x3007e9;};'use strict';function VtigerAccount(_0x4eeec7){this['id']=_0x4eeec7['id']||0x0;this[_0x6ff7('0x0')]=_0x4eeec7['name']||'';this['username']=_0x4eeec7[_0x6ff7('0x1')]||'';this['accessKey']=_0x4eeec7[_0x6ff7('0x2')]||'';this[_0x6ff7('0x3')]=_0x4eeec7[_0x6ff7('0x3')]||'';this[_0x6ff7('0x4')]=_0x4eeec7['serverUrl']||'';this['Configurations']=_0x4eeec7['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8a8f2dc..1f64459 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 _0xaaf8=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x2da5b9,_0x3e6be0){var _0x1d006c=function(_0x910c43){while(--_0x910c43){_0x2da5b9['push'](_0x2da5b9['shift']());}};_0x1d006c(++_0x3e6be0);}(_0xaaf8,0x14f));var _0x8aaf=function(_0x50d2a0,_0x13168b){_0x50d2a0=_0x50d2a0-0x0;var _0x11fe24=_0xaaf8[_0x50d2a0];return _0x11fe24;};'use strict';function ZendeskAccount(_0x43bd55){this['id']=_0x43bd55['id']||0x0;this[_0x8aaf('0x0')]=_0x43bd55[_0x8aaf('0x0')]||'';this[_0x8aaf('0x1')]=_0x43bd55[_0x8aaf('0x1')]||'';this[_0x8aaf('0x2')]=_0x43bd55[_0x8aaf('0x2')]||'';this[_0x8aaf('0x3')]=_0x43bd55[_0x8aaf('0x3')]||'';this[_0x8aaf('0x4')]=_0x43bd55[_0x8aaf('0x4')]||'';this[_0x8aaf('0x5')]=_0x43bd55[_0x8aaf('0x5')]||'';this['type']=_0x43bd55[_0x8aaf('0x6')]||_0x8aaf('0x7');this['serverUrl']=_0x43bd55[_0x8aaf('0x8')]||'';this[_0x8aaf('0x9')]=_0x43bd55['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x11dd=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x5bd7a9,_0x4735cb){var _0x3f44a7=function(_0x1d623a){while(--_0x1d623a){_0x5bd7a9['push'](_0x5bd7a9['shift']());}};_0x3f44a7(++_0x4735cb);}(_0x11dd,0x1e6));var _0xd11d=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x11dd[_0x39c734];return _0xb2a2f9;};'use strict';function ZendeskAccount(_0x2e2ad0){this['id']=_0x2e2ad0['id']||0x0;this[_0xd11d('0x0')]=_0x2e2ad0['name']||'';this[_0xd11d('0x1')]=_0x2e2ad0['username']||'';this['password']=_0x2e2ad0[_0xd11d('0x2')]||'';this[_0xd11d('0x3')]=_0x2e2ad0[_0xd11d('0x3')]||'';this[_0xd11d('0x4')]=_0x2e2ad0[_0xd11d('0x4')]||'';this[_0xd11d('0x5')]=_0x2e2ad0[_0xd11d('0x5')]||'';this[_0xd11d('0x6')]=_0x2e2ad0[_0xd11d('0x6')]||_0xd11d('0x7');this[_0xd11d('0x8')]=_0x2e2ad0[_0xd11d('0x8')]||'';this[_0xd11d('0x9')]=_0x2e2ad0[_0xd11d('0x9')]||{};}module[_0xd11d('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 734952b..5247301 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 _0xac5a=['clientId','clientSecret','serverUrl','code','Configurations','exports','name','description','host','zone'];(function(_0x132399,_0x1c4b0f){var _0x2a27e9=function(_0x4eac3b){while(--_0x4eac3b){_0x132399['push'](_0x132399['shift']());}};_0x2a27e9(++_0x1c4b0f);}(_0xac5a,0x178));var _0xaac5=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xac5a[_0x1b6186];return _0x186121;};'use strict';function ZohoAccount(_0x5ca07f){this['id']=_0x5ca07f['id']||0x0;this[_0xaac5('0x0')]=_0x5ca07f[_0xaac5('0x0')]||'';this['description']=_0x5ca07f[_0xaac5('0x1')]||'';this[_0xaac5('0x2')]=_0x5ca07f['host']||'';this[_0xaac5('0x3')]=_0x5ca07f[_0xaac5('0x3')]||'';this[_0xaac5('0x4')]=_0x5ca07f[_0xaac5('0x4')]||'';this[_0xaac5('0x5')]=_0x5ca07f[_0xaac5('0x5')]||'';this[_0xaac5('0x6')]=_0x5ca07f[_0xaac5('0x6')]||'';this[_0xaac5('0x7')]=_0x5ca07f[_0xaac5('0x7')]||'';this['refreshToken']=_0x5ca07f['refreshToken']||'';this[_0xaac5('0x8')]=_0x5ca07f['Configurations']||{};}module[_0xaac5('0x9')]=ZohoAccount; \ No newline at end of file +var _0x4950=['name','description','host','zone','clientId','clientSecret','serverUrl','refreshToken','exports'];(function(_0x12a237,_0x2c75da){var _0x14c6a7=function(_0x3fef8b){while(--_0x3fef8b){_0x12a237['push'](_0x12a237['shift']());}};_0x14c6a7(++_0x2c75da);}(_0x4950,0x1a7));var _0x0495=function(_0x2a288c,_0x2e147e){_0x2a288c=_0x2a288c-0x0;var _0x4cd9dd=_0x4950[_0x2a288c];return _0x4cd9dd;};'use strict';function ZohoAccount(_0x1e4180){this['id']=_0x1e4180['id']||0x0;this[_0x0495('0x0')]=_0x1e4180['name']||'';this[_0x0495('0x1')]=_0x1e4180[_0x0495('0x1')]||'';this[_0x0495('0x2')]=_0x1e4180['host']||'';this[_0x0495('0x3')]=_0x1e4180[_0x0495('0x3')]||'';this[_0x0495('0x4')]=_0x1e4180[_0x0495('0x4')]||'';this[_0x0495('0x5')]=_0x1e4180[_0x0495('0x5')]||'';this[_0x0495('0x6')]=_0x1e4180[_0x0495('0x6')]||'';this['code']=_0x1e4180['code']||'';this[_0x0495('0x7')]=_0x1e4180[_0x0495('0x7')]||'';this['Configurations']=_0x1e4180['Configurations']||{};}module[_0x0495('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 666ade2..680adc1 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 _0x57ca=['name','type','campaigntype','dialAnswer','Agent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x537745,_0x5f4996){var _0x486457=function(_0x111b49){while(--_0x111b49){_0x537745['push'](_0x537745['shift']());}};_0x486457(++_0x5f4996);}(_0x57ca,0x108));var _0xa57c=function(_0x2890d8,_0x2fdbab){_0x2890d8=_0x2890d8-0x0;var _0x1d9163=_0x57ca[_0x2890d8];return _0x1d9163;};'use strict';var util=require('util');var _=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));function checkNameSurname(_0x4b1712,_0x3a7394,_0x396613){var _0x1d38e7='';if(!_[_0xa57c('0x2')](_0x3a7394)&&_0xa57c('0x3')===typeof _0x3a7394){_0x1d38e7+=_0x3a7394;}if(!_['isNil'](_0x396613)&&_0xa57c('0x3')===typeof _0x396613){_0x1d38e7+='\x20'+_0x396613;}if(_0x1d38e7!==''){return _0x1d38e7;}return _0x4b1712;}function Action(_0x1c3e31,_0x113dcf,_0x19473f,_0xbdfffb,_0x314574){this[_0xa57c('0x4')]=_0x19473f||undefined;this[_0xa57c('0x5')]=_0x1c3e31['id'];this['queue']=_0x113dcf[_0xa57c('0x6')];this['type']=_0x113dcf[_0xa57c('0x7')];this[_0xa57c('0x8')]='queue';this[_0xa57c('0x9')]=![];this['membername']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?undefined:_0x1c3e31['Agent'][_0xa57c('0x6')];this['channelAgent']=this[_0xa57c('0xb')]?util[_0xa57c('0xc')](_0xa57c('0xd'),this[_0xa57c('0xb')]):_0xbdfffb||undefined;this[_0xa57c('0xe')]=checkNameSurname(_0x1c3e31['Contact'][_0xa57c('0xf')],_0x1c3e31['Contact'][_0xa57c('0x10')],_0x1c3e31[_0xa57c('0x11')][_0xa57c('0x12')]);this[_0xa57c('0x13')]=_0x1c3e31[_0xa57c('0x13')]||![];this[_0xa57c('0x14')]=_0x1c3e31[_0xa57c('0xf')];this['scheduledat']=_0x1c3e31[_0xa57c('0x15')];this[_0xa57c('0x16')]=_0x1c3e31[_0xa57c('0x16')]||0x0;this['countcongestionretry']=_0x1c3e31[_0xa57c('0x17')]||0x0;this['countnoanswerretry']=_0x1c3e31[_0xa57c('0x18')]||0x0;this[_0xa57c('0x19')]=(_0x1c3e31[_0xa57c('0x16')]||0x0)+(_0x1c3e31[_0xa57c('0x17')]||0x0)+(_0x1c3e31[_0xa57c('0x18')]||0x0)+(_0x1c3e31[_0xa57c('0x1a')]||0x0)+(_0x1c3e31[_0xa57c('0x1b')]||0x0)+(_0x1c3e31[_0xa57c('0x1c')]||0x0)+(_0x1c3e31['countmachineretry']||0x0)+(_0x1c3e31[_0xa57c('0x1d')]||0x0);this['countnosuchnumberretry']=_0x1c3e31['countnosuchnumberretry']||0x0;this[_0xa57c('0x1b')]=_0x1c3e31[_0xa57c('0x1b')]||0x0;this[_0xa57c('0x1c')]=_0x1c3e31[_0xa57c('0x1c')]||0x0;this['countmachineretry']=_0x1c3e31[_0xa57c('0x1e')]||0x0;this[_0xa57c('0x1d')]=_0x1c3e31[_0xa57c('0x1d')]||0x0;this[_0xa57c('0x1f')]=_0x1c3e31[_0xa57c('0x1f')];this[_0xa57c('0x20')]=_0x1c3e31[_0xa57c('0x20')];this[_0xa57c('0x21')]=_0x1c3e31[_0xa57c('0x21')];this[_0xa57c('0x22')]=_0x1c3e31[_0xa57c('0x22')];this[_0xa57c('0x23')]=_0x1c3e31[_0xa57c('0x23')];this[_0xa57c('0x24')]=_0x1c3e31[_0xa57c('0x24')];this['UserId']=_[_0xa57c('0x2')](_0x1c3e31[_0xa57c('0xa')])?_0x1c3e31[_0xa57c('0x25')]:_0x1c3e31[_0xa57c('0xa')]['id'];this[_0xa57c('0x26')]=_0x1c3e31[_0xa57c('0x26')];this[_0xa57c('0x27')]='';this[_0xa57c('0x28')]='';}Action[_0xa57c('0x29')][_0xa57c('0x2a')]=function(){return util['format'](_0xa57c('0x2b'),this['calleridname'],this['number']);};module[_0xa57c('0x2c')]=Action; \ No newline at end of file +var _0x1eba=['channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name'];(function(_0x38cd63,_0x37c8ae){var _0x4e1de3=function(_0x528d9a){while(--_0x528d9a){_0x38cd63['push'](_0x38cd63['shift']());}};_0x4e1de3(++_0x37c8ae);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x1eba[_0x3f5dca];return _0x5b833a;};'use strict';var util=require(_0xa1eb('0x0'));var _=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));function checkNameSurname(_0x2158d5,_0x3ef7ee,_0x5865fc){var _0x56c5f2='';if(!_[_0xa1eb('0x3')](_0x3ef7ee)&&_0xa1eb('0x4')===typeof _0x3ef7ee){_0x56c5f2+=_0x3ef7ee;}if(!_[_0xa1eb('0x3')](_0x5865fc)&&_0xa1eb('0x4')===typeof _0x5865fc){_0x56c5f2+='\x20'+_0x5865fc;}if(_0x56c5f2!==''){return _0x56c5f2;}return _0x2158d5;}function Action(_0x138789,_0x2933d0,_0x1d0d67,_0x2bfbb0,_0x39a5a3){this[_0xa1eb('0x5')]=_0x1d0d67||undefined;this[_0xa1eb('0x6')]=_0x138789['id'];this[_0xa1eb('0x7')]=_0x2933d0['name'];this[_0xa1eb('0x8')]=_0x2933d0['type'];this[_0xa1eb('0x9')]='queue';this[_0xa1eb('0xa')]=![];this['membername']=_[_0xa1eb('0x3')](_0x138789['Agent'])?undefined:_0x138789[_0xa1eb('0xb')][_0xa1eb('0xc')];this[_0xa1eb('0xd')]=this['membername']?util[_0xa1eb('0xe')](_0xa1eb('0xf'),this['membername']):_0x2bfbb0||undefined;this[_0xa1eb('0x10')]=checkNameSurname(_0x138789['Contact']['phone'],_0x138789[_0xa1eb('0x11')]['firstName'],_0x138789[_0xa1eb('0x11')][_0xa1eb('0x12')]);this[_0xa1eb('0x13')]=_0x138789[_0xa1eb('0x13')]||![];this[_0xa1eb('0x14')]=_0x138789[_0xa1eb('0x15')];this[_0xa1eb('0x16')]=_0x138789[_0xa1eb('0x16')];this[_0xa1eb('0x17')]=_0x138789['countbusyretry']||0x0;this[_0xa1eb('0x18')]=_0x138789['countcongestionretry']||0x0;this[_0xa1eb('0x19')]=_0x138789[_0xa1eb('0x19')]||0x0;this[_0xa1eb('0x1a')]=(_0x138789[_0xa1eb('0x17')]||0x0)+(_0x138789['countcongestionretry']||0x0)+(_0x138789[_0xa1eb('0x19')]||0x0)+(_0x138789[_0xa1eb('0x1b')]||0x0)+(_0x138789[_0xa1eb('0x1c')]||0x0)+(_0x138789[_0xa1eb('0x1d')]||0x0)+(_0x138789[_0xa1eb('0x1e')]||0x0)+(_0x138789[_0xa1eb('0x1f')]||0x0);this[_0xa1eb('0x1b')]=_0x138789[_0xa1eb('0x1b')]||0x0;this['countdropretry']=_0x138789[_0xa1eb('0x1c')]||0x0;this['countabandonedretry']=_0x138789[_0xa1eb('0x1d')]||0x0;this[_0xa1eb('0x1e')]=_0x138789[_0xa1eb('0x1e')]||0x0;this[_0xa1eb('0x1f')]=_0x138789['countagentrejectretry']||0x0;this['callback']=_0x138789[_0xa1eb('0x20')];this[_0xa1eb('0x21')]=_0x138789['callbackuniqueid'];this[_0xa1eb('0x22')]=_0x138789[_0xa1eb('0x22')];this[_0xa1eb('0x23')]=_0x138789[_0xa1eb('0x23')];this[_0xa1eb('0x24')]=_0x138789[_0xa1eb('0x24')];this[_0xa1eb('0x25')]=_0x138789[_0xa1eb('0x25')];this[_0xa1eb('0x26')]=_[_0xa1eb('0x3')](_0x138789[_0xa1eb('0xb')])?_0x138789[_0xa1eb('0x26')]:_0x138789['Agent']['id'];this[_0xa1eb('0x27')]=_0x138789[_0xa1eb('0x27')];this['originatecalleridnum']='';this[_0xa1eb('0x28')]='';}Action['prototype'][_0xa1eb('0x29')]=function(){return util[_0xa1eb('0xe')]('\x22%s\x22\x20<%s>',this[_0xa1eb('0x10')],this[_0xa1eb('0x2a')]);};module[_0xa1eb('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 81643fa..f164515 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 _0x0d47=['Answer','[callProgressDetectingCustomer][logAnswer]','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','totalGlobal','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','actionid','clone','isFailure','custom:agentringnoanswer','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','filterKey','variable','keys','value','error','inspect','transfertargetlinkedid','lodash','uuid','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','redis','socket.io-emitter','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','originated','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','hasOwnProperty','booked','type','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','buildObj','connect','custom:agentConnectPreview','buildAcw','complete'];(function(_0x1a5784,_0x4cd773){var _0x10980b=function(_0x287ee2){while(--_0x287ee2){_0x1a5784['push'](_0x1a5784['shift']());}};_0x10980b(++_0x4cd773);}(_0x0d47,0x1f4));var _0x70d4=function(_0x4e61f3,_0x5cc8c7){_0x4e61f3=_0x4e61f3-0x0;var _0x358be2=_0x0d47[_0x4e61f3];return _0x358be2;};'use strict';var util=require('util');var _=require(_0x70d4('0x0'));var uuid=require(_0x70d4('0x1'));var moment=require('moment');var md5=require(_0x70d4('0x2'));var Redis=require('ioredis');var config=require(_0x70d4('0x3'));var logger=require(_0x70d4('0x4'))(_0x70d4('0x5'));var loggerAction=require('../../../config/logger')(_0x70d4('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x70d4('0x7'));var Action=require('./action');var ut=require(_0x70d4('0x8'));config[_0x70d4('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x70d4('0xa'))(new Redis(config[_0x70d4('0x9')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x45a4b2){this['tail']=this[_0x70d4('0xb')]?this[_0x70d4('0xb')][_0x70d4('0xc')](_0x45a4b2):_0x45a4b2();};function Preview(_0x1a772b){this[_0x70d4('0xd')]=new Sequence();this[_0x70d4('0xe')]=_0x1a772b[_0x70d4('0xf')];this[_0x70d4('0x10')]=_0x1a772b[_0x70d4('0x10')];this[_0x70d4('0x11')]={};this[_0x70d4('0x12')]=_0x1a772b['agents'];this[_0x70d4('0x13')]=0x0;ami['on'](_0x70d4('0x14'),this['syncOriginateResponse'][_0x70d4('0x15')](this));ami['on'](_0x70d4('0x16'),this[_0x70d4('0x17')][_0x70d4('0x15')](this));ami['on'](_0x70d4('0x18'),this['syncHangupRequest'][_0x70d4('0x15')](this));ami['on']('dialend',this[_0x70d4('0x19')][_0x70d4('0x15')](this));ami['on']('newexten',this[_0x70d4('0x1a')][_0x70d4('0x15')](this));ami['on'](_0x70d4('0x1b'),this[_0x70d4('0x1c')][_0x70d4('0x15')](this));ami['on'](_0x70d4('0x1d'),this['syncAttendedTransfer'][_0x70d4('0x15')](this));ami['on']('blindtransfer',this[_0x70d4('0x1e')][_0x70d4('0x15')](this));this[_0x70d4('0x1f')](this[_0x70d4('0xe')]);}function emit(_0x4fc542,_0x4bae6e,_0x4f977b){io['to'](_0x4fc542)['emit'](_0x4bae6e,_0x4f977b);}function emitCampaignPreview(_0x1cf595){if(_0x1cf595['type']===_0x70d4('0x20')){var _0x300073={'id':_0x1cf595['id'],'name':_0x1cf595[_0x70d4('0x21')],'strategy':_0x1cf595[_0x70d4('0x22')],'answered':_0x1cf595[_0x70d4('0x23')],'available':_0x1cf595[_0x70d4('0x24')],'loggedIn':_0x1cf595['loggedIn'],'pTalking':_0x1cf595[_0x70d4('0x25')],'sumBillable':_0x1cf595[_0x70d4('0x26')],'sumDuration':_0x1cf595[_0x70d4('0x27')],'sumHoldTime':_0x1cf595[_0x70d4('0x28')]||0x0,'talking':_0x1cf595[_0x70d4('0x29')],'total':_0x1cf595[_0x70d4('0x2a')],'type':_0x1cf595['type'],'unmanaged':_0x1cf595[_0x70d4('0x2b')],'abandoned':_0x1cf595[_0x70d4('0x2c')],'waiting':_0x1cf595[_0x70d4('0x2d')],'loggedInDb':_0x1cf595[_0x70d4('0x2e')],'dialActive':_0x1cf595[_0x70d4('0x2f')],'dialMethod':_0x1cf595[_0x70d4('0x30')],'dialOriginateCallerIdName':_0x1cf595['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1cf595['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1cf595[_0x70d4('0x31')],'dialPrefix':_0x1cf595[_0x70d4('0x32')],'outboundAnswerAgiCallsDay':_0x1cf595[_0x70d4('0x33')],'outboundAnswerCallsDay':_0x1cf595[_0x70d4('0x34')],'outboundBlacklistCallsDay':_0x1cf595[_0x70d4('0x35')],'outboundBusyCallsDay':_0x1cf595['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1cf595[_0x70d4('0x36')],'outboundDropCallsDayACS':_0x1cf595[_0x70d4('0x37')],'outboundDropCallsDayCallersExit':_0x1cf595[_0x70d4('0x38')],'outboundDropCallsDayTimeout':_0x1cf595[_0x70d4('0x39')],'outboundNoAnswerCallsDay':_0x1cf595[_0x70d4('0x3a')],'outboundNoSuchCallsDay':_0x1cf595['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1cf595[_0x70d4('0x3b')],'outboundReCallsDay':_0x1cf595[_0x70d4('0x3c')],'outboundRejectCallsDay':_0x1cf595[_0x70d4('0x3d')],'outboundUnknownCallsDay':_0x1cf595[_0x70d4('0x3e')],'outboundAbandonedCallsDay':_0x1cf595[_0x70d4('0x3f')],'predictiveIntervalAnsweredCalls':_0x1cf595[_0x70d4('0x40')],'predictiveIntervalAvgHoldtime':_0x1cf595[_0x70d4('0x41')],'predictiveIntervalAvgTalktime':_0x1cf595[_0x70d4('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x1cf595['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1cf595[_0x70d4('0x43')],'predictiveIntervalErlangCalls':_0x1cf595[_0x70d4('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x1cf595['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1cf595[_0x70d4('0x45')],'predictiveIntervalMultiplicativeFactor':_0x1cf595[_0x70d4('0x46')],'predictiveIntervalPauses':_0x1cf595[_0x70d4('0x47')],'predictiveIntervalAvailable':_0x1cf595['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1cf595[_0x70d4('0x48')],'message':_0x1cf595[_0x70d4('0x49')],'originated':_0x1cf595['originated'],'erlangCalls':_0x1cf595['erlangCalls'],'erlangCallToSecond':_0x1cf595[_0x70d4('0x4a')],'erlangAbandonmentRate':_0x1cf595[_0x70d4('0x4b')],'erlangBusyFactor':_0x1cf595[_0x70d4('0x4c')],'startPredictive':_0x1cf595[_0x70d4('0x4d')],'startProgressive':_0x1cf595[_0x70d4('0x4e')]};if(_0x1cf595[_0x70d4('0x4f')]){_0x300073['Trunk']={'id':_0x1cf595[_0x70d4('0x4f')]['id'],'name':_0x1cf595['Trunk'][_0x70d4('0x21')],'active':_0x1cf595['Trunk'][_0x70d4('0x50')],'callerid':_0x1cf595['Trunk']['callerid']};}if(_0x1cf595[_0x70d4('0x51')]){_0x300073['Interval']={'id':_0x1cf595[_0x70d4('0x51')]['id'],'name':_0x1cf595[_0x70d4('0x51')]['name']};}var _0x11b023=md5(JSON[_0x70d4('0x52')](_0x300073));if(_0x1cf595['md5']!==_0x11b023){_0x1cf595[_0x70d4('0x2')]=_0x11b023;emit(util[_0x70d4('0x53')](_0x70d4('0x54'),_0x300073[_0x70d4('0x21')]),_0x70d4('0x55'),_0x300073);}}}function emitVoiceQueueChannelRemove(_0x3103a9){logger[_0x70d4('0x56')](_0x70d4('0x57'),JSON['stringify'](_0x3103a9));emit(util[_0x70d4('0x53')](_0x70d4('0x54'),_0x3103a9[_0x70d4('0x21')]),'voice_queue_channel:remove',_0x3103a9);io[_0x70d4('0x58')](_0x70d4('0x59'),_0x3103a9);}function notSendMessagesQueue(_0x38e421){if(_0x38e421['sendMessageOneNotActive']){if(_0x38e421[_0x70d4('0x5a')]===0x0&&_0x38e421[_0x70d4('0x25')]===0x0){_0x38e421[_0x70d4('0x5b')]=![];_0x38e421[_0x70d4('0x24')]=0x0;_0x38e421[_0x70d4('0x5c')]=0x0;_0x38e421['message']=_0x70d4('0x5d');ut[_0x70d4('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x38e421[_0x70d4('0x21')]+_0x70d4('0x5f'));}else{_0x38e421['message']=_0x70d4('0x60');ut['logger'](_0x70d4('0x61'),_0x38e421[_0x70d4('0x21')]+_0x70d4('0x62'));}emitCampaignPreview(_0x38e421);}}Preview[_0x70d4('0x63')][_0x70d4('0x1f')]=function(){var _0x32af8f=this;setInterval(function(){_0x32af8f[_0x70d4('0x64')]();},0x7cf);};Preview[_0x70d4('0x63')][_0x70d4('0x64')]=function(){var _0x3f59ba=this[_0x70d4('0xe')];this[_0x70d4('0x13')]+=0x1;for(var _0xaca269 in _0x3f59ba){if(_0x3f59ba[_0x70d4('0x65')](_0xaca269)&&(_0x3f59ba[_0xaca269][_0x70d4('0x30')]===_0x70d4('0x5')||_0x3f59ba[_0xaca269][_0x70d4('0x30')]===_0x70d4('0x66'))&&_0x3f59ba[_0xaca269][_0x70d4('0x67')]===_0x70d4('0x20')){if(this['clockClearZombieChannels']>0x7){this[_0x70d4('0x13')]=0x0;this[_0x70d4('0x68')]();}}if(_0x3f59ba[_0x70d4('0x65')](_0xaca269)&&_0x3f59ba[_0xaca269][_0x70d4('0x30')]===_0x70d4('0x5')&&_0x3f59ba[_0xaca269][_0x70d4('0x67')]===_0x70d4('0x20')){if(_0x3f59ba[_0xaca269][_0x70d4('0x2f')]){this[_0x70d4('0x69')](_0x3f59ba[_0xaca269]);if(_0x3f59ba[_0xaca269]['dialPreviewAutoRecallMe'])this[_0x70d4('0x6a')](_0x3f59ba[_0xaca269]);}else{notSendMessagesQueue(_0x3f59ba[_0xaca269]);}}}};Preview['prototype'][_0x70d4('0x6b')]=function(_0xe4dce4){var _0x3d70e1=this;this[_0x70d4('0xd')]['enqueue'](function(){if(!_[_0x70d4('0x6c')](_0x3d70e1[_0x70d4('0x11')][_0xe4dce4])){loggerAction['info'](_0x70d4('0x6d'),_0xe4dce4,_0x70d4('0x6e'),_0x3d70e1[_0x70d4('0x11')][_0xe4dce4]['queue'],_0x70d4('0x6f'),JSON[_0x70d4('0x52')](_0x3d70e1[_0x70d4('0xe')][_0x3d70e1[_0x70d4('0x11')][_0xe4dce4][_0x70d4('0x70')]][_0x70d4('0x5a')]),'pTalking:\x20',JSON[_0x70d4('0x52')](_0x3d70e1[_0x70d4('0xe')][_0x3d70e1[_0x70d4('0x11')][_0xe4dce4][_0x70d4('0x70')]][_0x70d4('0x25')]),JSON[_0x70d4('0x52')](_0x3d70e1['actions'][_0xe4dce4][_0x70d4('0x71')]),JSON[_0x70d4('0x52')](_[_0x70d4('0x72')](_0x3d70e1[_0x70d4('0x11')][_0xe4dce4],[_0x70d4('0x73'),_0x70d4('0x74'),_0x70d4('0x75'),_0x70d4('0x76')])));return ami[_0x70d4('0x77')]({'action':_0x70d4('0x78'),'channel':_0x3d70e1[_0x70d4('0x11')][_0xe4dce4]['channel']})[_0x70d4('0x79')](function(_0x5f301a){if(_0x5f301a[_0x70d4('0x49')]===_0x70d4('0x7a')){setTimeout(function(){if(_0x3d70e1[_0x70d4('0x11')][_0xe4dce4]){ut['updateOriginated'](_0x3d70e1['campaignsPreview'][_0x3d70e1[_0x70d4('0x11')][_0xe4dce4][_0x70d4('0x70')]],'[clearZombieChannel]');if(_0x3d70e1[_0x70d4('0x11')][_0xe4dce4]['dialAnswer']===!![]){ut[_0x70d4('0x7b')](_0x3d70e1[_0x70d4('0xe')][_0x3d70e1['actions'][_0xe4dce4]['queue']],'[clearZombieChannel]');ut[_0x70d4('0x7c')](_0x70d4('0x7d')+_0xe4dce4,_0x3d70e1[_0x70d4('0x11')][_0xe4dce4][_0x70d4('0x70')]);}ut[_0x70d4('0x7c')](_0x70d4('0x7e')+_0xe4dce4,_0x3d70e1[_0x70d4('0x11')][_0xe4dce4][_0x70d4('0x70')]);delete _0x3d70e1[_0x70d4('0x11')][_0xe4dce4];}},0x2328);}});}});};Preview['prototype'][_0x70d4('0x68')]=function(){var _0x4457b2=this;loggerAction[_0x70d4('0x56')](_0x70d4('0x7f'),_[_0x70d4('0x80')](this[_0x70d4('0x11')]));for(var _0xb21536 in this[_0x70d4('0x11')]){if(_0x4457b2['actions'][_0x70d4('0x65')](_0xb21536)){_0x4457b2[_0x70d4('0x6b')](_0xb21536);}}};Preview[_0x70d4('0x63')][_0x70d4('0x6a')]=function(_0x4ffefc){var _0x25a049=this;rpcDb[_0x70d4('0x81')](_0x4ffefc['id'],ut[_0x70d4('0x82')](this[_0x70d4('0x12')]))[_0x70d4('0x83')](function(_0x58df8d){if(!_[_0x70d4('0x6c')](_0x58df8d)){for(var _0x337797=0x0;_0x337797<_0x58df8d[_0x70d4('0x84')];_0x337797+=0x1){if(ut[_0x70d4('0x85')](_0x58df8d[_0x337797][_0x70d4('0x86')])<_0x4ffefc['dialRecallMeTimeout']*0x3c){if(_0x58df8d[_0x337797][_0x70d4('0x87')]&&!_0x58df8d[_0x337797][_0x70d4('0x87')][_0x70d4('0x88')]){_0x25a049[_0x70d4('0x89')](_0x58df8d[_0x337797]['id'])[_0x70d4('0x83')](ut[_0x70d4('0x8a')](_0x70d4('0x8b')))[_0x70d4('0x79')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x70d4('0x8c')](_0x58df8d[_0x337797]['id']);}}else{var _0x49ad47=new Action(_0x58df8d[_0x337797],_0x4ffefc);_0x49ad47[_0x70d4('0x8d')]=moment()[_0x70d4('0x53')](_0x70d4('0x8e'));_0x4ffefc[_0x70d4('0x3c')]+=0x1;ut[_0x70d4('0x8f')](_0x49ad47,0x17,_0x70d4('0x90'));if(_0x4ffefc['dialRecallInQueue']){rpcDb[_0x70d4('0x91')](ut[_0x70d4('0x92')](_0x58df8d[_0x337797]));rpcDb[_0x70d4('0x93')](_0x49ad47,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x70d4('0x8f')](_0x49ad47,0x16,_0x70d4('0x94'));rpcDb[_0x70d4('0x93')](_0x49ad47,_0x70d4('0x95'));rpcDb[_0x70d4('0x96')](_0x49ad47,_0x70d4('0x95'));}}}}})[_0x70d4('0x79')](ut[_0x70d4('0x8a')](_0x70d4('0x97')));};Preview['prototype'][_0x70d4('0x69')]=function(_0x49cbf3){_0x49cbf3['sendMessageOneNotActive']=!![];if(ut[_0x70d4('0x98')](_0x49cbf3[_0x70d4('0x99')])){_0x49cbf3[_0x70d4('0x49')]=_0x70d4('0x9a');}else if(!ut['isActive'](_0x49cbf3[_0x70d4('0x2f')])){_0x49cbf3[_0x70d4('0x49')]=_0x70d4('0x5d');}else if(!this['isTrunkReachable'](_0x49cbf3[_0x70d4('0x4f')])){if(!this[_0x70d4('0x9b')](_0x49cbf3[_0x70d4('0x9c')])){_0x49cbf3[_0x70d4('0x49')]=_0x70d4('0x9d');}else{_0x49cbf3['message']=_0x70d4('0x9e');}}else{_0x49cbf3[_0x70d4('0x49')]=_0x70d4('0x9e');}emitCampaignPreview(_0x49cbf3);};Preview[_0x70d4('0x63')][_0x70d4('0x9f')]=function(_0x3e837b,_0x2d59ed,_0x769bfc){var _0x383af4=this;var _0x5a8d45=this[_0x70d4('0x11')][_0x2d59ed];var _0x3aca47=this['campaignsPreview'][_0x5a8d45[_0x70d4('0x70')]];var _0x500e05;var _0x41b021=![];var _0xf140eb=0x2;var _0x176569=0x3;if(_0x3aca47){switch(_0x769bfc){case'1':_0x3aca47[_0x70d4('0xa0')]+=0x1;_0x5a8d45[_0x70d4('0xa1')]+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut['totalGlobal'](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0x0,'NoSuchNumber');ami[_0x70d4('0x58')]('custom:agentnosuchnumber',ut['buildObj'](_0x5a8d45,_0x70d4('0xa3')));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xa4'));_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'0',_0x3aca47)[_0x70d4('0x83')](function(_0x1d023f){_0x41b021=_0x1d023f[_0x70d4('0xa6')]==0x1;_0xf140eb=_0x3aca47[_0x70d4('0xa7')];_0x176569=_0x3aca47[_0x70d4('0xa8')];if(!_0x41b021){if(ut['totalGlobal'](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,'Global');rpcDb[_0x70d4('0x96')](_0x500e05,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5a8d45[_0x70d4('0xa1')]>=_0x3aca47['dialNoSuchNumberMaxRetry']){rpcDb[_0x70d4('0x96')](_0x5a8d45,_0x70d4('0xab'));}else{rpcDb[_0x70d4('0xac')](ut[_0x70d4('0xad')](_0x5a8d45,_0x70d4('0xa1'),_0x3aca47['dialNoSuchNumberRetryFrequency']),_0x5a8d45[_0x70d4('0xae')],_0x5a8d45['activeContact']);}}delete this[_0x70d4('0x11')][_0x3e837b[_0x70d4('0xaf')]];}else{_0x5a8d45[_0x70d4('0xa1')]++;logger[_0x70d4('0x56')](_0x70d4('0xb0'),_0x5a8d45['countnosuchnumberretry']);logger[_0x70d4('0x56')]('id',_0x5a8d45[_0x70d4('0xb1')]);_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countnosuchnumberretry':_0x5a8d45[_0x70d4('0xa1')]}})[_0x70d4('0x83')](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)['then'](function(){});});}});break;case _0x70d4('0xb4'):var _0x479df1=moment()[_0x70d4('0x53')](_0x70d4('0x8e'));_0x5a8d45[_0x70d4('0xb5')]=_0x479df1;_0x5a8d45[_0x70d4('0xb6')]=_0x479df1;_0x5a8d45[_0x70d4('0x71')]=!![];_0x3aca47['pTalking']+=0x1;logger[_0x70d4('0x56')](_0x70d4('0xb7'),_0x5a8d45[_0x70d4('0xb8')],_0x70d4('0xb9'),_0x3aca47[_0x70d4('0x21')],_0x70d4('0xba'),_0x3aca47[_0x70d4('0x25')]);ami[_0x70d4('0x58')]('custom:agentconnect',ut[_0x70d4('0xbb')](_0x5a8d45,_0x70d4('0xbc'),this[_0x70d4('0xe')][_0x5a8d45[_0x70d4('0x70')]]));if(_0x3aca47['acw']){ami[_0x70d4('0x58')](_0x70d4('0xbd'),ut[_0x70d4('0xbe')](_0x5a8d45));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x70d4('0xbb')](_0x5a8d45,_0x70d4('0xbf'),this[_0x70d4('0xe')][_0x5a8d45['queue']]));emitVoiceQueueChannelRemove(ut[_0x70d4('0xbb')](_0x5a8d45,_0x70d4('0xbf')));_0x3aca47[_0x70d4('0x34')]+=0x1;_0x3aca47[_0x70d4('0x2a')]+=0x1;_0x3aca47[_0x70d4('0x23')]+=0x1;ut[_0x70d4('0x7b')](_0x3aca47,'[16]');_0x5a8d45[_0x70d4('0xa2')]=ut['totalGlobal'](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0x4,_0x70d4('0xc0'));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xc1'));rpcDb[_0x70d4('0x96')](_0x5a8d45,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x5a8d45);_0x3aca47[_0x70d4('0x27')]+=_0x5a8d45[_0x70d4('0xc2')];_0x3aca47[_0x70d4('0x26')]+=_0x5a8d45[_0x70d4('0xc2')];logger[_0x70d4('0x56')](_0x70d4('0xc3'),_0x5a8d45[_0x70d4('0xb8')],_0x70d4('0xb9'),_0x3aca47['name'],_0x70d4('0xba'),_0x3aca47[_0x70d4('0x25')]);delete this['actions'][_0x3e837b[_0x70d4('0xaf')]];break;case _0x70d4('0xc4'):_0x3aca47[_0x70d4('0xc5')]+=0x1;_0x5a8d45[_0x70d4('0xc6')]+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut['totalGlobal'](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0x5,_0x70d4('0xc7'));_0xf140eb=_0x3aca47['dialBusyRetryFrequency'];_0x176569=_0x3aca47['callAdditionalPhoneAfterMin'];ami[_0x70d4('0x58')](_0x70d4('0xc8'),ut[_0x70d4('0xbb')](_0x5a8d45,_0x70d4('0xc9')));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xca'));_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'5',_0x3aca47)[_0x70d4('0x83')](function(_0x48b236){_0x41b021=_0x48b236[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,_0x70d4('0xcc'));rpcDb[_0x70d4('0x96')](_0x500e05,_0x70d4('0xcd'));}else{if(_0x5a8d45[_0x70d4('0xc6')]>=_0x3aca47[_0x70d4('0xce')]){rpcDb['createCustomerFinal'](_0x5a8d45,_0x70d4('0xca'));}else{rpcDb[_0x70d4('0xac')](ut[_0x70d4('0xad')](_0x5a8d45,_0x70d4('0xc6'),_0x3aca47[_0x70d4('0xcf')]),_0x5a8d45[_0x70d4('0xae')],_0x5a8d45[_0x70d4('0xd0')]);}}}else{_0x5a8d45[_0x70d4('0xc6')]++;_0x383af4['incrementPreviewCounters']({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countbusyretry':_0x5a8d45[_0x70d4('0xc6')]}})[_0x70d4('0x83')](function(){_0x383af4['swapAdditionalPhones'](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});break;case _0x70d4('0xd1'):_0x3aca47[_0x70d4('0x3a')]+=0x1;_0x5a8d45['countnoanswerretry']+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut[_0x70d4('0xcb')](_0x5a8d45);ut['logCustomer'](_0x5a8d45,0x3,_0x70d4('0xd2'));_0xf140eb=_0x3aca47[_0x70d4('0xd3')];_0x176569=_0x3aca47[_0x70d4('0xa8')];var _0x54cbea=ut['buildNoAnswerEventPayload'](_0x5a8d45,_0x3aca47);ami[_0x70d4('0x58')]('custom:agentnoanswer',_0x54cbea);rpcDb['createCustomerHistory'](_0x5a8d45,_0x70d4('0xd4'));_0x383af4['verifyAdditionalPhones'](_0x5a8d45,'3',_0x3aca47)[_0x70d4('0x83')](function(_0x3dc9ec){_0x41b021=_0x3dc9ec['additional']==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47['dialGlobalMaxRetry']){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,'Global');rpcDb['createCustomerFinal'](_0x500e05,_0x70d4('0xd5'));}else{if(_0x5a8d45['countnoanswerretry']>=_0x3aca47['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5a8d45,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x70d4('0xac')](ut[_0x70d4('0xad')](_0x5a8d45,'countnoanswerretry',_0x3aca47[_0x70d4('0xd3')]),_0x5a8d45[_0x70d4('0xae')],_0x5a8d45[_0x70d4('0xd0')]);}}}else{_0x5a8d45[_0x70d4('0xd6')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countnoanswerretry':_0x5a8d45[_0x70d4('0xd6')]}})[_0x70d4('0x83')](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});break;case _0x70d4('0xd7'):_0x3aca47['outboundCongestionCallsDay']+=0x1;_0x5a8d45[_0x70d4('0xd8')]+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut[_0x70d4('0xcb')](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0x8,'Congestion');_0xf140eb=_0x3aca47[_0x70d4('0xd9')];_0x176569=_0x3aca47[_0x70d4('0xa8')];ami[_0x70d4('0x58')](_0x70d4('0xda'),ut[_0x70d4('0xbb')](_0x5a8d45,'congestion'));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xdb'));_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'8',_0x3aca47)['then'](function(_0x396300){_0x41b021=_0x396300[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut['totalGlobal'](_0x5a8d45)>=_0x3aca47['dialGlobalMaxRetry']){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,_0x70d4('0xcc'));rpcDb[_0x70d4('0x96')](_0x500e05,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5a8d45[_0x70d4('0xd8')]>=_0x3aca47[_0x70d4('0xdc')]){rpcDb[_0x70d4('0x96')](_0x5a8d45,_0x70d4('0xdb'));}else{rpcDb[_0x70d4('0xac')](ut['scheduledAt'](_0x5a8d45,_0x70d4('0xd8'),_0x3aca47[_0x70d4('0xcf')]),_0x5a8d45[_0x70d4('0xae')],_0x5a8d45[_0x70d4('0xd0')]);}}}else{_0x5a8d45[_0x70d4('0xd8')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countcongestionretry':_0x5a8d45[_0x70d4('0xd8')]}})[_0x70d4('0x83')](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});break;case'CANCEL':_0x3aca47[_0x70d4('0x3d')]+=0x1;_0x5a8d45['countagentrejectretry']+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut[_0x70d4('0xcb')](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0x14,_0x70d4('0xdd'));_0xf140eb=_0x3aca47['dialAgentRejectRetryFrequency'];_0x176569=_0x3aca47[_0x70d4('0xa8')];ami[_0x70d4('0x58')](_0x70d4('0xde'),ut['buildObj'](_0x5a8d45,_0x70d4('0xdf')));rpcDb['createCustomerHistory'](_0x5a8d45,_0x70d4('0xe0'));_0x383af4['verifyAdditionalPhones'](_0x5a8d45,'20',_0x3aca47)[_0x70d4('0x83')](function(_0x3e8530){_0x41b021=_0x3e8530[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut['cloneAction'](_0x5a8d45,0x14,_0x70d4('0xdd'));rpcDb['createCustomerFinal'](_0x500e05,_0x70d4('0xe1'));}else{if(_0x5a8d45[_0x70d4('0xe2')]>=_0x3aca47['dialAgentRejectMaxRetry']){rpcDb[_0x70d4('0x96')](_0x5a8d45,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x70d4('0xad')](_0x5a8d45,_0x70d4('0xe2'),_0x3aca47[_0x70d4('0xe3')]),_0x5a8d45['unlockAgent'],_0x5a8d45['activeContact']);}}}else{_0x5a8d45[_0x70d4('0xd6')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countnoanswerretry':_0x5a8d45[_0x70d4('0xd6')]}})[_0x70d4('0x83')](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)['then'](function(){});});}});break;case'ABANDONED':_0x3aca47['outboundAbandonedCallsDay']+=0x1;_0x5a8d45[_0x70d4('0xe4')]+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut[_0x70d4('0xcb')](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0xb,_0x70d4('0xe5'));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xe6'));_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'11',_0x3aca47)[_0x70d4('0x83')](function(_0x18a4d3){_0x41b021=_0x18a4d3['additional']==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47['dialGlobalMaxRetry']){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,_0x70d4('0xcc'));rpcDb[_0x70d4('0x96')](_0x500e05,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5a8d45[_0x70d4('0xe7')]>=_0x3aca47[_0x70d4('0xe8')]){rpcDb['createCustomerFinal'](_0x5a8d45,_0x70d4('0xe6'));}else{rpcDb['rescheduleContact'](ut[_0x70d4('0xad')](_0x5a8d45,_0x70d4('0xe4'),_0x3aca47[_0x70d4('0xe9')]),_0x5a8d45[_0x70d4('0xae')],_0x5a8d45[_0x70d4('0xd0')]);}}}else{_0x5a8d45[_0x70d4('0xd6')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countnoanswerretry':_0x5a8d45['countnoanswerretry']}})[_0x70d4('0x83')](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});break;case'18':_0x3aca47['outboundUnknownCallsDay']+=0x1;_0x5a8d45['countmachineretry']+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut[_0x70d4('0xcb')](_0x5a8d45);ut['logCustomer'](_0x5a8d45,0x12,_0x3e837b[_0x70d4('0xea')]||_0x3e837b['dialstatus']);ami[_0x70d4('0x58')]('custom:amd',ut['buildObj'](_0x5a8d45,_0x70d4('0xeb')));rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xec'));_0x383af4['verifyAdditionalPhones'](_0x5a8d45,'18',_0x3aca47)[_0x70d4('0x83')](function(_0x250405){_0x41b021=_0x250405[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut['cloneAction'](_0x5a8d45,0x12,_0x70d4('0xcc'));rpcDb[_0x70d4('0x96')](_0x500e05,_0x70d4('0xec'));}else{rpcDb[_0x70d4('0x96')](_0x5a8d45,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x5a8d45[_0x70d4('0xd6')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45[_0x70d4('0xb1')],'field':{'countnoanswerretry':_0x5a8d45[_0x70d4('0xd6')]}})['then'](function(){_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});delete this[_0x70d4('0x11')][_0x3e837b[_0x70d4('0xaf')]];break;case'19':_0x3aca47[_0x70d4('0x3e')]+=0x1;_0x5a8d45[_0x70d4('0xa2')]=ut['totalGlobal'](_0x5a8d45);ut['logCustomer'](_0x5a8d45,0x13,_0x3e837b[_0x70d4('0xea')]||_0x3e837b[_0x70d4('0xed')]);ami['emit'](_0x70d4('0xee'),ut['buildObj'](_0x5a8d45,_0x70d4('0xeb')));rpcDb[_0x70d4('0x93')](_0x5a8d45,'[callProgressDetectingCustomer][machine]');_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'18',_0x3aca47)[_0x70d4('0x83')](function(_0xdfba15){_0x41b021=_0xdfba15[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,'Global');rpcDb[_0x70d4('0x96')](_0x500e05,_0x70d4('0xef'));}else{rpcDb[_0x70d4('0x96')](_0x5a8d45,_0x70d4('0xef'));}}else{_0x5a8d45[_0x70d4('0xd6')]++;_0x383af4[_0x70d4('0xb2')]({'id':_0x5a8d45['idContact'],'field':{'countnoanswerretry':_0x5a8d45[_0x70d4('0xd6')]}})[_0x70d4('0x83')](function(){_0x383af4['swapAdditionalPhones'](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});});}});delete this[_0x70d4('0x11')][_0x3e837b[_0x70d4('0xaf')]];break;default:if(_0x5a8d45[_0x70d4('0x71')]){ut[_0x70d4('0x7b')](_0x3aca47,_0x70d4('0xf0'));ut[_0x70d4('0x7c')](_0x70d4('0xf1')+_0x3aca47['name'],_0x3e837b);}_0x3aca47[_0x70d4('0x3e')]+=0x1;_0x5a8d45['countglobal']=ut[_0x70d4('0xcb')](_0x5a8d45);ut[_0x70d4('0x8f')](_0x5a8d45,0xc,_0x3e837b[_0x70d4('0xea')]||_0x3e837b[_0x70d4('0xed')]);_0xf140eb=_0x3aca47[_0x70d4('0xe3')];_0x176569=_0x3aca47[_0x70d4('0xa8')];rpcDb[_0x70d4('0x93')](_0x5a8d45,_0x70d4('0xf2'));_0x383af4[_0x70d4('0xa5')](_0x5a8d45,'20',_0x3aca47)[_0x70d4('0x83')](function(_0x37ef0f){_0x41b021=_0x37ef0f[_0x70d4('0xa6')]==0x1;if(!_0x41b021){if(ut[_0x70d4('0xcb')](_0x5a8d45)>=_0x3aca47[_0x70d4('0xa9')]){_0x500e05=ut[_0x70d4('0xaa')](_0x5a8d45,0xf,_0x70d4('0xcc'));rpcDb[_0x70d4('0x96')](_0x500e05,_0x70d4('0xf3'));}else{rpcDb[_0x70d4('0x96')](_0x5a8d45,_0x70d4('0xf3'));}delete this[_0x70d4('0x11')][_0x3e837b[_0x70d4('0xaf')]];}else{_0x383af4[_0x70d4('0xb3')](_0x5a8d45,_0xf140eb,_0x176569)[_0x70d4('0x83')](function(){});}});}if(!(_0x5a8d45[_0x70d4('0x71')]&&_0x769bfc==='16')){ut[_0x70d4('0xf4')](_0x3aca47,_0x70d4('0xf5'));logger[_0x70d4('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x5a8d45[_0x70d4('0xb8')],_0x70d4('0xb9'),_0x3aca47[_0x70d4('0x21')],'originated:\x20',_0x3aca47[_0x70d4('0x5a')]);}if(_0x769bfc!==_0x70d4('0xb4')){delete this[_0x70d4('0x11')][_0x3e837b['linkedid']];delete this['actions'][_0x3e837b['destlinkedid']];}}};Preview[_0x70d4('0x63')][_0x70d4('0xf6')]=function(_0x3d0e2a,_0x29e306,_0x3fb4e0){if(_[_0x70d4('0xf7')](_0x29e306)&&_0x70d4('0xf8')!==typeof _0x29e306){return;}if(_[_0x70d4('0xf7')](_0x3fb4e0)&&_0x70d4('0xf8')!==typeof _0x3fb4e0){return;}switch(_0x3fb4e0['reason']){case'0':ut['logAgent'](_0x3d0e2a,0x0,_0x70d4('0xf9'));rpcDb[_0x70d4('0xfa')](_0x3d0e2a,_0x70d4('0xfb'));break;case'3':ut[_0x70d4('0xfc')](_0x3d0e2a,0x3,_0x70d4('0xd2'));rpcDb[_0x70d4('0xfa')](_0x3d0e2a,_0x70d4('0xfd'));break;case'5':ut[_0x70d4('0xfc')](_0x3d0e2a,0x5,_0x70d4('0xc7'));rpcDb[_0x70d4('0xfa')](_0x3d0e2a,_0x70d4('0xfe'));break;case'8':ut[_0x70d4('0xfc')](_0x3d0e2a,0x8,_0x70d4('0xff'));rpcDb[_0x70d4('0xfa')](_0x3d0e2a,_0x70d4('0x100'));break;case'22':ut[_0x70d4('0xfc')](_0x3d0e2a,0x16,'AnswerAGI');rpcDb[_0x70d4('0xfa')](_0x3d0e2a,_0x70d4('0x101'));break;default:ut['logAgent'](_0x3d0e2a,0xc,_0x3fb4e0[_0x70d4('0x102')]);rpcDb[_0x70d4('0xfa')](_0x3d0e2a,'[callProgressDetectingAgent][logCongestion]');}ut[_0x70d4('0xf4')](_0x29e306,_0x70d4('0x103'));logger[_0x70d4('0x56')](_0x70d4('0x104'),_0x3d0e2a[_0x70d4('0xb8')],_0x70d4('0xb9'),_0x29e306[_0x70d4('0x21')],'originated:\x20',_0x29e306[_0x70d4('0x5a')]);delete this[_0x70d4('0x11')][_0x3d0e2a[_0x70d4('0xb8')]];};Preview[_0x70d4('0x63')][_0x70d4('0xa5')]=function(_0x3aa4eb,_0x4dc947,_0x5563c0){return Promise[_0x70d4('0x105')]()[_0x70d4('0x83')](cmHopperAdditionalPhone[_0x70d4('0xa5')](_0x3aa4eb,_0x4dc947,_0x5563c0))[_0x70d4('0x79')](logger[_0x70d4('0x56')](_0x70d4('0x106')));};Preview['prototype']['swapAdditionalPhones']=function(_0x13fc27,_0x3a85ec,_0x24a0e9){return Promise[_0x70d4('0x105')]()[_0x70d4('0x83')](cmHopperAdditionalPhone[_0x70d4('0xb3')](_0x13fc27,_0x3a85ec,_0x24a0e9))['catch'](logger[_0x70d4('0x56')](_0x70d4('0x107')));};Preview[_0x70d4('0x63')][_0x70d4('0xb2')]=function(_0x5571e7){return Promise[_0x70d4('0x105')]()[_0x70d4('0x83')](cmHopperAdditionalPhone[_0x70d4('0xb2')](_0x5571e7))[_0x70d4('0x79')](logger['info'](_0x70d4('0x108')));};Preview[_0x70d4('0x63')][_0x70d4('0x109')]=function(_0x29057a,_0x15fd34,_0x378a1b,_0x51397d,_0x1b3557){var _0x2f9b2d=this;return new Promise(function(_0x3ebc6c,_0x54d3e9){if(_[_0x70d4('0x6c')](_0x15fd34)||_[_0x70d4('0x6c')](_0x15fd34['Contact'])||_[_0x70d4('0x6c')](_0x15fd34[_0x70d4('0x10a')])||_[_0x70d4('0x6c')](_0x15fd34[_0x70d4('0x75')])){_0x54d3e9(ut[_0x70d4('0x49')]('Contact\x20is\x20undefined',_0x51397d,_0x1b3557));return;}var _0x42ffea=uuid['v4']();var _0x315015=_0x2f9b2d['campaignsPreview'][_0x15fd34[_0x70d4('0x6e')][_0x70d4('0x21')]];var _0x170d65=_0x378a1b?_0x2f9b2d[_0x70d4('0x12')][_0x378a1b]['id']:undefined;_0x2f9b2d[_0x70d4('0x11')][_0x42ffea]=new Action(_0x15fd34,_0x315015,_0x42ffea,_0x378a1b,_0x170d65);var _0x774c4=_0x2f9b2d[_0x70d4('0x11')][_0x42ffea];_0x774c4[_0x70d4('0xae')]=_0x51397d;_0x774c4[_0x70d4('0xd0')]=_0x1b3557;_0x774c4[_0x70d4('0x10b')]=_0x378a1b;if(_[_0x70d4('0x10c')](_0x29057a)){_0x2f9b2d[_0x70d4('0x10d')](_0x774c4,_0x315015,_0x15fd34,_0x378a1b)[_0x70d4('0x83')](function(_0x1456af){logger['info'](_0x70d4('0x10e'),_0x70d4('0x10f')+_0x774c4[_0x70d4('0x70')]+'\x20IdHopper:\x20'+_0x774c4['idContact'],JSON[_0x70d4('0x52')](_0x1456af));ami['emit'](_0x70d4('0x110'),ut[_0x70d4('0xbb')](_0x774c4,_0x70d4('0x111'),_0x2f9b2d[_0x70d4('0xe')][_0x774c4[_0x70d4('0x70')]]));_0x3ebc6c(ut[_0x70d4('0x49')](_0x70d4('0x112')));})[_0x70d4('0x79')](function(_0x74b2f3){ut['logger'](_0x70d4('0x113'),_0x74b2f3);_0x54d3e9(ut[_0x70d4('0x49')](_0x70d4('0x114'),_0x51397d,_0x1b3557));});}else{_0x315015[_0x70d4('0x35')]+=0x1;ut['logBlacklist'](_0x774c4);rpcDb[_0x70d4('0x115')](_0x774c4,_0x70d4('0x116'));delete _0x2f9b2d[_0x70d4('0x11')][_0x42ffea];_0x54d3e9(ut['message'](_0x70d4('0x117'),_0x51397d,_0x1b3557));}});};Preview[_0x70d4('0x63')]['isTrunkReachable']=function(_0x158460){return!_['isNil'](_0x158460)&&!_[_0x70d4('0x6c')](_0x158460[_0x70d4('0x21')])&&!_[_0x70d4('0x6c')](_0x158460[_0x70d4('0x50')])&&_0x158460['active']&&!_[_0x70d4('0x6c')](this[_0x70d4('0x10')][util[_0x70d4('0x53')](_0x70d4('0x118'),_0x158460[_0x70d4('0x21')])])&&!_[_0x70d4('0x6c')](this[_0x70d4('0x10')][util[_0x70d4('0x53')](_0x70d4('0x118'),_0x158460[_0x70d4('0x21')])][_0x70d4('0x78')])&&(this[_0x70d4('0x10')][util[_0x70d4('0x53')](_0x70d4('0x118'),_0x158460[_0x70d4('0x21')])][_0x70d4('0x78')]===_0x70d4('0x119')||this[_0x70d4('0x10')][util[_0x70d4('0x53')](_0x70d4('0x118'),_0x158460[_0x70d4('0x21')])][_0x70d4('0x78')]===_0x70d4('0x11a'));};Preview[_0x70d4('0x63')][_0x70d4('0x89')]=function(_0x512015,_0x3f3b41){var _0x5c139a=this;return new Promise(function(_0xcf6698,_0x222127){_0x5c139a[_0x70d4('0x11b')](_0x512015,_0x3f3b41)['then'](function(_0x39c027){_0xcf6698(_[_0x70d4('0x72')](_0x39c027,[_0x70d4('0x49')]));})['catch'](function(_0x185f57){if(_0x185f57[_0x70d4('0x11c')]){rpcDb[_0x70d4('0x11d')](_0x512015);}if(_0x185f57[_0x70d4('0x50')]){rpcDb['disableContact'](_0x512015);}_0x222127(_['pick'](_0x185f57,['message']));});});};Preview[_0x70d4('0x63')][_0x70d4('0x11b')]=function(_0x1c89c0,_0x53ea03){var _0x651493=this;return new Promise(function(_0x2721ed,_0x342c6b){var _0x46ae02,_0x3d08de;rpcDb[_0x70d4('0x11e')](_0x1c89c0)[_0x70d4('0x83')](function(_0x1c3ee0){if(!_[_0x70d4('0x6c')](_0x1c3ee0[0x0])){_0x3d08de=_0x1c3ee0[0x0][_0x70d4('0x11f')]?![]:!![];_0x46ae02=_0x1c3ee0[0x0][_0x70d4('0x11f')]?!![]:![];_0x46ae02=_0x53ea03?!![]:_0x46ae02;}var _0xdbde63=_0x651493[_0x70d4('0x120')](_0x1c3ee0);if(_0xdbde63[_0x70d4('0x121')]){rpcDb[_0x70d4('0x122')](_[_0x70d4('0x72')](_0x1c3ee0[0x0],[_0x70d4('0x75'),_0x70d4('0x10a')]))[_0x70d4('0x83')](function(_0x2314a2){_0x651493[_0x70d4('0x109')](_0x2314a2,_0x1c3ee0[0x0],_0x53ea03,_0x3d08de,_0x46ae02)[_0x70d4('0x83')](function(_0x19628c){_0x2721ed(_0x19628c);})[_0x70d4('0x79')](function(_0x3a3351){_0x342c6b(_0x3a3351);});})[_0x70d4('0x79')](function(_0x2a7835){ut[_0x70d4('0x5e')]('[Preview][checkIsBlackList]',_0x2a7835);_0x342c6b(ut['message'](_0x70d4('0x123'),_0x3d08de,_0x46ae02));});}else{_0x342c6b(ut[_0x70d4('0x49')](_0xdbde63[_0x70d4('0x49')],_0x3d08de,_0x46ae02));}})['catch'](function(_0x5ef6cb){ut[_0x70d4('0x5e')]('[Preview][getContactPreview]',_0x5ef6cb);_0x342c6b(ut[_0x70d4('0x49')](_0x70d4('0x123'),![],!![]));});});};Preview[_0x70d4('0x63')][_0x70d4('0x120')]=function(_0x20d502){if(_[_0x70d4('0x6c')](_0x20d502)||_[_0x70d4('0x10c')](_0x20d502)||!_['isNil'](_0x20d502[0x0][_0x70d4('0x87')])&&_['isNil'](_0x20d502[0x0][_0x70d4('0x87')][_0x70d4('0x21')])){ut['logger'](_0x70d4('0x124'),_0x20d502);return{'isValid':![],'message':_0x70d4('0x125')};}var _0x33fef3=this['campaignsPreview'][_0x20d502[0x0][_0x70d4('0x6e')][_0x70d4('0x21')]];_0x33fef3['message']=_0x70d4('0x9e');if(_[_0x70d4('0x6c')](_0x33fef3)){ut[_0x70d4('0x5e')](_0x70d4('0x126'),_0x33fef3);return{'isValid':![],'message':_0x70d4('0x127')};}if(!this[_0x70d4('0x9b')](_0x33fef3[_0x70d4('0x4f')])){ut['logger'](_0x70d4('0x128'),_0x70d4('0x129')+_0x33fef3['name']+_0x70d4('0x12a'));if(!this[_0x70d4('0x9b')](_0x33fef3['TrunkBackup'])){ut[_0x70d4('0x5e')](_0x70d4('0x128'),_0x33fef3['name']+_0x70d4('0x12b'));return{'isValid':![],'message':_0x70d4('0x12c')};}}if(!ut[_0x70d4('0x12d')](_0x33fef3[_0x70d4('0x2f')])){ut[_0x70d4('0x5e')]('[Preview][validateContact][Campaign\x20Active]',_0x33fef3[_0x70d4('0x21')]+_0x70d4('0x12e'));return{'isValid':![],'message':_0x70d4('0x129')+_0x33fef3[_0x70d4('0x21')]+_0x70d4('0x12e')};}return{'isValid':!![],'message':_0x70d4('0x12f')};};Preview['prototype'][_0x70d4('0x10d')]=function(_0x12ff47,_0x3b079c,_0xaf5b6d,_0x16c01a){var _0x4396e6=this;return new Promise(function(_0x58dc16,_0x259b31){var _0x571ff5=_0x12ff47[_0x70d4('0xb8')];var _0x3770b6=_0x4396e6[_0x70d4('0x9b')](_0x3b079c['Trunk'])?util[_0x70d4('0x53')](_0x70d4('0x130'),_0x3b079c[_0x70d4('0x4f')][_0x70d4('0x21')],_[_0x70d4('0x6c')](_0x3b079c[_0x70d4('0x32')])?'':_0x3b079c[_0x70d4('0x32')][_0x70d4('0x131')]()||'',_0x3b079c[_0x70d4('0x132')]>0x0?_0xaf5b6d['phone'][_0x70d4('0x133')](_0x3b079c[_0x70d4('0x132')]):_0xaf5b6d[_0x70d4('0x10a')]):util[_0x70d4('0x53')](_0x70d4('0x130'),_['isNil'](_0x3b079c['TrunkBackup'])?_0x3b079c[_0x70d4('0x4f')]['name']:_0x3b079c[_0x70d4('0x9c')][_0x70d4('0x21')],_['isNil'](_0x3b079c[_0x70d4('0x32')])?'':_0x3b079c[_0x70d4('0x32')][_0x70d4('0x131')]()||'',_0x3b079c['dialCutDigit']>0x0?_0xaf5b6d['phone'][_0x70d4('0x133')](_0x3b079c['dialCutDigit']):_0xaf5b6d[_0x70d4('0x10a')]);var _0x20ceb9=_0x4396e6['isTrunkReachable'](_0x3b079c[_0x70d4('0x4f')])?ut[_0x70d4('0x134')](_0x3b079c[_0x70d4('0x4f')]['callerid'],_0x3b079c['dialOriginateCallerIdName'],_0x3b079c[_0x70d4('0x135')]>0x0?ut['getCallerIdRandom'](_0x3b079c[_0x70d4('0x136')],_0x3b079c[_0x70d4('0x135')]):_0x3b079c[_0x70d4('0x136')]):ut[_0x70d4('0x134')](_[_0x70d4('0x6c')](_0x3b079c[_0x70d4('0x9c')])?_0x3b079c[_0x70d4('0x4f')]['callerid']:_0x3b079c[_0x70d4('0x9c')][_0x70d4('0x137')],_0x3b079c[_0x70d4('0x138')],_0x3b079c[_0x70d4('0x135')]>0x0?ut[_0x70d4('0x139')](_0x3b079c['dialOriginateCallerIdNumber'],_0x3b079c[_0x70d4('0x135')]):_0x3b079c[_0x70d4('0x136')]);if(_0x20ceb9){_0x12ff47['originatecalleridname']=ut[_0x70d4('0x13a')](_0x20ceb9);_0x12ff47[_0x70d4('0x13b')]=ut[_0x70d4('0x13c')](_0x20ceb9);}var _0x11549d=ut[_0x70d4('0x13d')](_0x3b079c,_0xaf5b6d,_0x3770b6,_0x20ceb9,_0x571ff5,_0x12ff47);_['merge'](_0x12ff47,ut['toLowerVariables'](_0x11549d));_0x12ff47[_0x70d4('0x8d')]=moment()['format'](_0x70d4('0x8e'));_0x3b079c[_0x70d4('0x13e')]=_0x11549d;ami['Action'](ut[_0x70d4('0x13f')](_0x12ff47,_0x3b079c,_0x11549d,_0x12ff47[_0x70d4('0xd0')],_0x16c01a))['then'](function(_0x49cc8d){_0x3b079c[_0x70d4('0x5a')]+=0x1;logger[_0x70d4('0x56')](_0x70d4('0x140'),_0x571ff5,_0x70d4('0xb9'),_0x3b079c[_0x70d4('0x21')],_0x70d4('0x6f'),_0x3b079c[_0x70d4('0x5a')]);_0x58dc16(_0x49cc8d);})[_0x70d4('0x79')](function(_0x1f40a0){ut[_0x70d4('0xfc')](_0x12ff47,0xe,_0x70d4('0x141'));rpcDb[_0x70d4('0xfa')](_0x12ff47,_0x70d4('0x142'));_0x259b31(_0x1f40a0);});});};Preview['prototype'][_0x70d4('0x1a')]=function(_0x565e7b){if(this[_0x70d4('0x11')][_0x565e7b[_0x70d4('0xaf')]]){this[_0x70d4('0x11')][_0x565e7b[_0x70d4('0xaf')]][_0x70d4('0x143')]=_0x565e7b[_0x70d4('0x143')];}};Preview[_0x70d4('0x63')][_0x70d4('0x144')]=function(_0x728a3c){var _0x360879=this;var _0x4681cc=this[_0x70d4('0x11')][_0x728a3c[_0x70d4('0x145')]];if(_0x4681cc){if(_0x4681cc[_0x70d4('0x10b')]&&this[_0x70d4('0x12')][_0x4681cc[_0x70d4('0x10b')]]){ut['logLookAgent'](_0x4681cc,this[_0x70d4('0x12')][_0x4681cc[_0x70d4('0x10b')]][_0x70d4('0x21')],this[_0x70d4('0x12')][_0x4681cc[_0x70d4('0x10b')]]['id']);}var _0x4fbea7=_[_0x70d4('0x146')](_0x4681cc);_0x4fbea7['responsetime']=moment()[_0x70d4('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1feade=_0x360879[_0x70d4('0xe')][_0x4681cc['queue']];if(ut[_0x70d4('0x147')](_0x728a3c['response'])){if(_0x4681cc[_0x70d4('0xae')]){rpcDb[_0x70d4('0x11d')](_0x4681cc[_0x70d4('0xb1')]);}if(_0x4681cc[_0x70d4('0xd0')]){rpcDb[_0x70d4('0x8c')](_0x4681cc[_0x70d4('0xb1')]);}ami[_0x70d4('0x58')](_0x70d4('0x148'),ut[_0x70d4('0xbb')](_0x4681cc,'rejected',this['campaignsPreview'][_0x4681cc[_0x70d4('0x70')]]));this[_0x70d4('0xf6')](_0x4fbea7,_0x1feade,_0x728a3c);}else{_0x4681cc[_0x70d4('0x8d')]=moment()[_0x70d4('0x53')](_0x70d4('0x8e'));ut[_0x70d4('0xfc')](_0x4fbea7,0x4,_0x70d4('0xc0'));rpcDb['createAgentHistory'](_0x4fbea7,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x70d4('0x63')][_0x70d4('0x17')]=function(_0x23aaf6){var _0x2a1ac4=this[_0x70d4('0x11')][_0x23aaf6[_0x70d4('0xaf')]];var _0x307cd1;if(_0x2a1ac4){_0x307cd1=this['campaignsPreview'][_0x2a1ac4[_0x70d4('0x70')]];logger[_0x70d4('0x56')]('[syncHangup][talking]',_0x23aaf6['linkedid'],_0x70d4('0xb9'),_0x307cd1['name'],_0x70d4('0xba'),_0x307cd1[_0x70d4('0x25')]);}if(this[_0x70d4('0x11')][_0x23aaf6['linkedid']]&&_0x23aaf6[_0x70d4('0xaf')]!==_0x23aaf6[_0x70d4('0xb8')]){if(_0x23aaf6[_0x70d4('0x149')]==='16'&&this[_0x70d4('0x11')][_0x23aaf6[_0x70d4('0xaf')]][_0x70d4('0x71')]){this[_0x70d4('0x9f')](_0x23aaf6,_0x23aaf6[_0x70d4('0xaf')],_0x23aaf6[_0x70d4('0x149')]);}else if(this[_0x70d4('0x11')][_0x23aaf6[_0x70d4('0xaf')]][_0x70d4('0x71')]){logger['info']('[syncHangup][talking][cause]',_0x23aaf6['linkedid'],_0x23aaf6[_0x70d4('0x149')],_0x70d4('0xb9'),_0x307cd1[_0x70d4('0x21')],_0x70d4('0xba'),_0x307cd1[_0x70d4('0x25')]);this['callProgressDetectingCustomer'](_0x23aaf6,_0x23aaf6[_0x70d4('0xaf')],_0x23aaf6[_0x70d4('0x149')]);}}else if(_0x2a1ac4&&_[_0x70d4('0x6c')](_0x2a1ac4['statedesc'])&&_0x307cd1[_0x70d4('0x14a')]&&_0x23aaf6[_0x70d4('0xaf')]===_0x23aaf6[_0x70d4('0xb8')]&&_[_0x70d4('0x6c')](_0x23aaf6[_0x70d4('0x102')])&&_0x23aaf6[_0x70d4('0x149')]==='16'&&_0x23aaf6[_0x70d4('0x14b')]==='6'&&_[_0x70d4('0xf7')](_0x2a1ac4[_0x70d4('0x14c')])){if(_0x2a1ac4[_0x70d4('0xae')]){rpcDb[_0x70d4('0x11d')](_0x2a1ac4[_0x70d4('0xb1')]);}if(_0x2a1ac4['activeContact']){rpcDb[_0x70d4('0x8c')](_0x2a1ac4[_0x70d4('0xb1')]);}_0x23aaf6[_0x70d4('0x102')]='22';this['callProgressDetectingAgent'](_0x2a1ac4,_0x307cd1,_0x23aaf6);}else if(_0x2a1ac4&&_0x2a1ac4['transfer']){if(_0x23aaf6[_0x70d4('0x149')]==='16'&&this[_0x70d4('0x11')][_0x23aaf6[_0x70d4('0xaf')]][_0x70d4('0x71')]){logger[_0x70d4('0x56')](_0x70d4('0x14d'),_0x23aaf6['linkedid'],_0x23aaf6[_0x70d4('0x149')],'\x20Queue',_0x307cd1[_0x70d4('0x21')],'pTalking:\x20',_0x307cd1[_0x70d4('0x25')]);this[_0x70d4('0x9f')](_0x23aaf6,_0x23aaf6['linkedid'],_0x23aaf6[_0x70d4('0x149')]);}else if(this[_0x70d4('0x11')][_0x23aaf6[_0x70d4('0xaf')]][_0x70d4('0x71')]){logger[_0x70d4('0x56')](_0x70d4('0x14e'),_0x23aaf6[_0x70d4('0xaf')],_0x23aaf6['cause'],'\x20Queue',_0x307cd1[_0x70d4('0x21')],'pTalking:\x20',_0x307cd1[_0x70d4('0x25')]);this[_0x70d4('0x9f')](_0x23aaf6,_0x23aaf6[_0x70d4('0xaf')],_0x23aaf6[_0x70d4('0x149')]);}}};Preview[_0x70d4('0x63')][_0x70d4('0x19')]=function(_0x4e850c){if(this[_0x70d4('0x11')][_0x4e850c[_0x70d4('0x14f')]]&&_0x4e850c['destlinkedid']!==_0x4e850c[_0x70d4('0x150')]){this[_0x70d4('0x9f')](_0x4e850c,_0x4e850c[_0x70d4('0x14f')],_0x4e850c['dialstatus']);}};Preview[_0x70d4('0x63')][_0x70d4('0x151')]=function(_0x561e3e){if(this[_0x70d4('0x11')][_0x561e3e[_0x70d4('0xaf')]]&&_0x561e3e[_0x70d4('0xaf')]!==_0x561e3e[_0x70d4('0xb8')]&&!this[_0x70d4('0x11')][_0x561e3e[_0x70d4('0xaf')]]['dialAnswer']){if(_0x561e3e['cause']==='1'){this['callProgressDetectingCustomer'](_0x561e3e,_0x561e3e[_0x70d4('0xaf')],_0x561e3e[_0x70d4('0x149')]);}}};Preview['prototype'][_0x70d4('0x152')]=function(_0xc96597,_0x18bb46,_0x277618){if(this[_0x70d4('0x11')][_0xc96597]){if(_[_0x70d4('0x6c')](this[_0x70d4('0x11')][_0xc96597]['variables'])){this['actions'][_0xc96597][_0x70d4('0x13e')]={};}this[_0x70d4('0x11')][_0xc96597][_0x70d4('0x13e')][_0x18bb46]=_0x277618;}};Preview[_0x70d4('0x63')][_0x70d4('0x1c')]=function(_0x93f7d){try{if(!_[_0x70d4('0x6c')](_0x93f7d)){if(ut[_0x70d4('0x153')](_['keys'](_0x93f7d[_0x70d4('0x154')])[0x0])){this[_0x70d4('0x152')](_0x93f7d['uniqueid'],_[_0x70d4('0x155')](_0x93f7d[_0x70d4('0x154')])[0x0],_0x93f7d[_0x70d4('0x156')]);}}}catch(_0x4e7891){logger[_0x70d4('0x157')]('[syncVarSet][Preview]',util[_0x70d4('0x158')](_0x4e7891,{'showHidden':![],'depth':null}));}};Preview[_0x70d4('0x63')]['syncAttendedTransfer']=function(_0x4db8ef){if(_0x4db8ef){if(this['actions'][_0x4db8ef['transfertargetlinkedid']]){this[_0x70d4('0x11')][_0x4db8ef[_0x70d4('0x159')]][_0x70d4('0x14c')]=!![];}}};Preview[_0x70d4('0x63')][_0x70d4('0x1e')]=function(_0x3fafe8){if(_0x3fafe8){if(this[_0x70d4('0x11')][_0x3fafe8['transfererlinkedid']]){this['actions'][_0x3fafe8['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x6e01=['statedesc','transfer','keys','variable','addVariable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_presence:remove','sendMessageOneNotActive','available','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','loopCampaigns','syncCampaigns','hasOwnProperty','booked','dialActive','setMessage','isNil','actions','info','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','uniqueid','resolve','[verifyAdditionalPhone]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','substring','dialCutDigit','SIP/%s/%s%s','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x6e01,0x167));var _0x16e0=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x6e01[_0x3e8cae];return _0x45c4d6;};'use strict';var util=require(_0x16e0('0x0'));var _=require(_0x16e0('0x1'));var uuid=require(_0x16e0('0x2'));var moment=require(_0x16e0('0x3'));var md5=require('md5');var Redis=require(_0x16e0('0x4'));var config=require('../../../config/environment');var logger=require(_0x16e0('0x5'))(_0x16e0('0x6'));var loggerAction=require('../../../config/logger')(_0x16e0('0x7'));var ami=require(_0x16e0('0x8'));var rpcDb=require(_0x16e0('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x16e0('0xa'));var ut=require(_0x16e0('0xb'));config[_0x16e0('0xc')]=_[_0x16e0('0xd')](config['redis'],{'host':_0x16e0('0xe'),'port':0x18eb});var io=require(_0x16e0('0xf'))(new Redis(config[_0x16e0('0xc')]));var Sequence=function(){};Sequence[_0x16e0('0x10')][_0x16e0('0x11')]=function(_0x1a344b){this[_0x16e0('0x12')]=this[_0x16e0('0x12')]?this[_0x16e0('0x12')][_0x16e0('0x13')](_0x1a344b):_0x1a344b();};function Preview(_0x5cf45d){this[_0x16e0('0x14')]=new Sequence();this[_0x16e0('0x15')]=_0x5cf45d['voiceQueues'];this[_0x16e0('0x16')]=_0x5cf45d[_0x16e0('0x16')];this['actions']={};this[_0x16e0('0x17')]=_0x5cf45d[_0x16e0('0x17')];this[_0x16e0('0x18')]=0x0;ami['on'](_0x16e0('0x19'),this['syncOriginateResponse'][_0x16e0('0x1a')](this));ami['on'](_0x16e0('0x1b'),this[_0x16e0('0x1c')][_0x16e0('0x1a')](this));ami['on']('hanguprequest',this[_0x16e0('0x1d')][_0x16e0('0x1a')](this));ami['on'](_0x16e0('0x1e'),this[_0x16e0('0x1f')][_0x16e0('0x1a')](this));ami['on']('newexten',this[_0x16e0('0x20')]['bind'](this));ami['on'](_0x16e0('0x21'),this[_0x16e0('0x22')][_0x16e0('0x1a')](this));ami['on']('attendedtransfer',this[_0x16e0('0x23')][_0x16e0('0x1a')](this));ami['on'](_0x16e0('0x24'),this[_0x16e0('0x25')][_0x16e0('0x1a')](this));this['loopCampaigns'](this[_0x16e0('0x15')]);}function emit(_0x2edd65,_0x2ce688,_0xc27768){io['to'](_0x2edd65)[_0x16e0('0x26')](_0x2ce688,_0xc27768);}function emitCampaignPreview(_0x4c5d93){if(_0x4c5d93[_0x16e0('0x27')]===_0x16e0('0x28')){var _0x12ed98={'id':_0x4c5d93['id'],'name':_0x4c5d93[_0x16e0('0x29')],'strategy':_0x4c5d93[_0x16e0('0x2a')],'answered':_0x4c5d93[_0x16e0('0x2b')],'available':_0x4c5d93['available'],'loggedIn':_0x4c5d93[_0x16e0('0x2c')],'pTalking':_0x4c5d93[_0x16e0('0x2d')],'sumBillable':_0x4c5d93[_0x16e0('0x2e')],'sumDuration':_0x4c5d93[_0x16e0('0x2f')],'sumHoldTime':_0x4c5d93['sumHoldTime']||0x0,'talking':_0x4c5d93[_0x16e0('0x30')],'total':_0x4c5d93[_0x16e0('0x31')],'type':_0x4c5d93[_0x16e0('0x27')],'unmanaged':_0x4c5d93[_0x16e0('0x32')],'abandoned':_0x4c5d93[_0x16e0('0x33')],'waiting':_0x4c5d93[_0x16e0('0x34')],'loggedInDb':_0x4c5d93['loggedInDb'],'dialActive':_0x4c5d93['dialActive'],'dialMethod':_0x4c5d93[_0x16e0('0x35')],'dialOriginateCallerIdName':_0x4c5d93[_0x16e0('0x36')],'dialOriginateCallerIdNumber':_0x4c5d93[_0x16e0('0x37')],'dialOriginateTimeout':_0x4c5d93[_0x16e0('0x38')],'dialPrefix':_0x4c5d93[_0x16e0('0x39')],'outboundAnswerAgiCallsDay':_0x4c5d93[_0x16e0('0x3a')],'outboundAnswerCallsDay':_0x4c5d93['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4c5d93[_0x16e0('0x3b')],'outboundBusyCallsDay':_0x4c5d93['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4c5d93[_0x16e0('0x3c')],'outboundDropCallsDayACS':_0x4c5d93[_0x16e0('0x3d')],'outboundDropCallsDayCallersExit':_0x4c5d93['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4c5d93[_0x16e0('0x3e')],'outboundNoAnswerCallsDay':_0x4c5d93[_0x16e0('0x3f')],'outboundNoSuchCallsDay':_0x4c5d93[_0x16e0('0x40')],'outboundOriginateFailureCallsDay':_0x4c5d93['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4c5d93[_0x16e0('0x41')],'outboundRejectCallsDay':_0x4c5d93[_0x16e0('0x42')],'outboundUnknownCallsDay':_0x4c5d93[_0x16e0('0x43')],'outboundAbandonedCallsDay':_0x4c5d93[_0x16e0('0x44')],'predictiveIntervalAnsweredCalls':_0x4c5d93['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4c5d93['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4c5d93[_0x16e0('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x4c5d93[_0x16e0('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x4c5d93[_0x16e0('0x47')],'predictiveIntervalErlangCalls':_0x4c5d93[_0x16e0('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c5d93[_0x16e0('0x49')],'predictiveIntervalHitRate':_0x4c5d93[_0x16e0('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x4c5d93[_0x16e0('0x4b')],'predictiveIntervalPauses':_0x4c5d93[_0x16e0('0x4c')],'predictiveIntervalAvailable':_0x4c5d93['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4c5d93[_0x16e0('0x4d')],'message':_0x4c5d93['message'],'originated':_0x4c5d93[_0x16e0('0x4e')],'erlangCalls':_0x4c5d93[_0x16e0('0x4f')],'erlangCallToSecond':_0x4c5d93['erlangCallToSecond'],'erlangAbandonmentRate':_0x4c5d93[_0x16e0('0x50')],'erlangBusyFactor':_0x4c5d93[_0x16e0('0x51')],'startPredictive':_0x4c5d93['startPredictive'],'startProgressive':_0x4c5d93[_0x16e0('0x52')]};if(_0x4c5d93[_0x16e0('0x53')]){_0x12ed98[_0x16e0('0x53')]={'id':_0x4c5d93[_0x16e0('0x53')]['id'],'name':_0x4c5d93[_0x16e0('0x53')][_0x16e0('0x29')],'active':_0x4c5d93[_0x16e0('0x53')]['active'],'callerid':_0x4c5d93[_0x16e0('0x53')][_0x16e0('0x54')]};}if(_0x4c5d93[_0x16e0('0x55')]){_0x12ed98[_0x16e0('0x55')]={'id':_0x4c5d93[_0x16e0('0x55')]['id'],'name':_0x4c5d93[_0x16e0('0x55')][_0x16e0('0x29')]};}var _0x50167e=md5(JSON[_0x16e0('0x56')](_0x12ed98));if(_0x4c5d93[_0x16e0('0x57')]!==_0x50167e){_0x4c5d93['md5']=_0x50167e;emit(util[_0x16e0('0x58')](_0x16e0('0x59'),_0x12ed98[_0x16e0('0x29')]),_0x16e0('0x5a'),_0x12ed98);}}}function emitVoiceQueueChannelRemove(_0x372391){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x372391));emit(util[_0x16e0('0x58')]('voice:queue:%s',_0x372391[_0x16e0('0x29')]),'voice_queue_channel:remove',_0x372391);io[_0x16e0('0x26')](_0x16e0('0x5b'),_0x372391);}function notSendMessagesQueue(_0x5b70d1){if(_0x5b70d1[_0x16e0('0x5c')]){if(_0x5b70d1[_0x16e0('0x4e')]===0x0&&_0x5b70d1[_0x16e0('0x2d')]===0x0){_0x5b70d1['sendMessageOneNotActive']=![];_0x5b70d1[_0x16e0('0x5d')]=0x0;_0x5b70d1['paused']=0x0;_0x5b70d1[_0x16e0('0x5e')]=_0x16e0('0x5f');ut['logger'](_0x16e0('0x60'),_0x5b70d1[_0x16e0('0x29')]+_0x16e0('0x61'));}else{_0x5b70d1['message']=_0x16e0('0x62');ut[_0x16e0('0x63')](_0x16e0('0x60'),_0x5b70d1['name']+'\x20is\x20deactivated');}emitCampaignPreview(_0x5b70d1);}}Preview[_0x16e0('0x10')][_0x16e0('0x64')]=function(){var _0x18e14d=this;setInterval(function(){_0x18e14d[_0x16e0('0x65')]();},0x7cf);};Preview[_0x16e0('0x10')][_0x16e0('0x65')]=function(){var _0x53845a=this[_0x16e0('0x15')];this[_0x16e0('0x18')]+=0x1;for(var _0x3e2175 in _0x53845a){if(_0x53845a[_0x16e0('0x66')](_0x3e2175)&&(_0x53845a[_0x3e2175]['dialMethod']===_0x16e0('0x6')||_0x53845a[_0x3e2175][_0x16e0('0x35')]===_0x16e0('0x67'))&&_0x53845a[_0x3e2175][_0x16e0('0x27')]===_0x16e0('0x28')){if(this[_0x16e0('0x18')]>0x7){this[_0x16e0('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x53845a['hasOwnProperty'](_0x3e2175)&&_0x53845a[_0x3e2175][_0x16e0('0x35')]===_0x16e0('0x6')&&_0x53845a[_0x3e2175][_0x16e0('0x27')]==='outbound'){if(_0x53845a[_0x3e2175][_0x16e0('0x68')]){this[_0x16e0('0x69')](_0x53845a[_0x3e2175]);if(_0x53845a[_0x3e2175]['dialPreviewAutoRecallMe'])this['recallMe'](_0x53845a[_0x3e2175]);}else{notSendMessagesQueue(_0x53845a[_0x3e2175]);}}}};Preview[_0x16e0('0x10')]['clearZombieChannel']=function(_0x25b45d){var _0x571656=this;this[_0x16e0('0x14')][_0x16e0('0x11')](function(){if(!_[_0x16e0('0x6a')](_0x571656[_0x16e0('0x6b')][_0x25b45d])){loggerAction[_0x16e0('0x6c')](_0x16e0('0x6d'),_0x25b45d,'Queue',_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')],_0x16e0('0x6f'),JSON[_0x16e0('0x56')](_0x571656[_0x16e0('0x15')][_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')]][_0x16e0('0x4e')]),_0x16e0('0x70'),JSON[_0x16e0('0x56')](_0x571656[_0x16e0('0x15')][_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')]][_0x16e0('0x2d')]),JSON[_0x16e0('0x56')](_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x71')]),JSON[_0x16e0('0x56')](_[_0x16e0('0x72')](_0x571656[_0x16e0('0x6b')][_0x25b45d],[_0x16e0('0x73'),_0x16e0('0x74'),_0x16e0('0x75'),_0x16e0('0x76')])));return ami['Action']({'action':_0x16e0('0x77'),'channel':_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x78')]})['catch'](function(_0x53ba29){if(_0x53ba29['message']===_0x16e0('0x79')){setTimeout(function(){if(_0x571656[_0x16e0('0x6b')][_0x25b45d]){ut['updateOriginated'](_0x571656[_0x16e0('0x15')][_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')]],_0x16e0('0x7a'));if(_0x571656[_0x16e0('0x6b')][_0x25b45d]['dialAnswer']===!![]){ut[_0x16e0('0x7b')](_0x571656[_0x16e0('0x15')][_0x571656[_0x16e0('0x6b')][_0x25b45d]['queue']],'[clearZombieChannel]');ut[_0x16e0('0x7c')](_0x16e0('0x7d')+_0x25b45d,_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')]);}ut[_0x16e0('0x7c')](_0x16e0('0x7e')+_0x25b45d,_0x571656[_0x16e0('0x6b')][_0x25b45d][_0x16e0('0x6e')]);delete _0x571656[_0x16e0('0x6b')][_0x25b45d];}},0x2328);}});}});};Preview[_0x16e0('0x10')][_0x16e0('0x7f')]=function(){var _0x32cd1d=this;loggerAction[_0x16e0('0x6c')](_0x16e0('0x80'),_[_0x16e0('0x81')](this[_0x16e0('0x6b')]));for(var _0x1b1161 in this[_0x16e0('0x6b')]){if(_0x32cd1d['actions'][_0x16e0('0x66')](_0x1b1161)){_0x32cd1d[_0x16e0('0x82')](_0x1b1161);}}};Preview[_0x16e0('0x10')]['recallMe']=function(_0xd11e55){var _0x54b891=this;rpcDb[_0x16e0('0x83')](_0xd11e55['id'],ut[_0x16e0('0x84')](this[_0x16e0('0x17')]))[_0x16e0('0x85')](function(_0x1a3d6f){if(!_[_0x16e0('0x6a')](_0x1a3d6f)){for(var _0x13a66e=0x0;_0x13a66e<_0x1a3d6f['length'];_0x13a66e+=0x1){if(ut['getDiff'](_0x1a3d6f[_0x13a66e][_0x16e0('0x86')])<_0xd11e55[_0x16e0('0x87')]*0x3c){if(_0x1a3d6f[_0x13a66e][_0x16e0('0x88')]&&!_0x1a3d6f[_0x13a66e][_0x16e0('0x88')][_0x16e0('0x89')]){_0x54b891[_0x16e0('0x8a')](_0x1a3d6f[_0x13a66e]['id'])[_0x16e0('0x85')](ut[_0x16e0('0x8b')](_0x16e0('0x8c')))[_0x16e0('0x8d')](ut[_0x16e0('0x8b')](_0x16e0('0x8c')));}else{rpcDb[_0x16e0('0x8e')](_0x1a3d6f[_0x13a66e]['id']);}}else{var _0xa112b=new Action(_0x1a3d6f[_0x13a66e],_0xd11e55);_0xa112b[_0x16e0('0x8f')]=moment()[_0x16e0('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0xd11e55[_0x16e0('0x41')]+=0x1;ut[_0x16e0('0x90')](_0xa112b,0x17,'RecallInQueue');if(_0xd11e55[_0x16e0('0x91')]){rpcDb[_0x16e0('0x92')](ut[_0x16e0('0x93')](_0x1a3d6f[_0x13a66e]));rpcDb[_0x16e0('0x94')](_0xa112b,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0xa112b,0x16,_0x16e0('0x95'));rpcDb[_0x16e0('0x94')](_0xa112b,_0x16e0('0x96'));rpcDb[_0x16e0('0x97')](_0xa112b,_0x16e0('0x96'));}}}}})[_0x16e0('0x8d')](ut[_0x16e0('0x8b')](_0x16e0('0x98')));};Preview[_0x16e0('0x10')][_0x16e0('0x69')]=function(_0x2d4074){_0x2d4074[_0x16e0('0x5c')]=!![];if(ut['IsNotLoggedIn'](_0x2d4074[_0x16e0('0x2c')])){_0x2d4074['message']=_0x16e0('0x99');}else if(!ut[_0x16e0('0x9a')](_0x2d4074[_0x16e0('0x68')])){_0x2d4074['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x2d4074[_0x16e0('0x53')])){if(!this[_0x16e0('0x9b')](_0x2d4074[_0x16e0('0x9c')])){_0x2d4074[_0x16e0('0x5e')]=_0x16e0('0x9d');}else{_0x2d4074[_0x16e0('0x5e')]=_0x16e0('0x9e');}}else{_0x2d4074[_0x16e0('0x5e')]=_0x16e0('0x9e');}emitCampaignPreview(_0x2d4074);};Preview[_0x16e0('0x10')][_0x16e0('0x9f')]=function(_0x4d613a,_0x2af41f,_0xf35cad){var _0x354d86=this;var _0x4df44a=this[_0x16e0('0x6b')][_0x2af41f];var _0x5e4d71=this[_0x16e0('0x15')][_0x4df44a[_0x16e0('0x6e')]];var _0x1ddea2;var _0x1fa33d=![];var _0x67356b=0x2;var _0x146017=0x3;if(_0x5e4d71){switch(_0xf35cad){case'1':_0x5e4d71[_0x16e0('0x40')]+=0x1;_0x4df44a[_0x16e0('0xa0')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0x0,_0x16e0('0xa3'));ami[_0x16e0('0x26')](_0x16e0('0xa4'),ut[_0x16e0('0xa5')](_0x4df44a,_0x16e0('0xa6')));rpcDb['createCustomerHistory'](_0x4df44a,_0x16e0('0xa7'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'0',_0x5e4d71)[_0x16e0('0x85')](function(_0x1be38e){_0x1fa33d=_0x1be38e[_0x16e0('0xa9')]==0x1;_0x67356b=_0x5e4d71[_0x16e0('0xaa')];_0x146017=_0x5e4d71[_0x16e0('0xab')];if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,'Global');rpcDb[_0x16e0('0x97')](_0x1ddea2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4df44a[_0x16e0('0xa0')]>=_0x5e4d71[_0x16e0('0xae')]){rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xaf'));}else{rpcDb[_0x16e0('0xb0')](ut[_0x16e0('0xb1')](_0x4df44a,'countnosuchnumberretry',_0x5e4d71[_0x16e0('0xaa')]),_0x4df44a[_0x16e0('0xb2')],_0x4df44a[_0x16e0('0xb3')]);}}delete this['actions'][_0x4d613a['linkedid']];}else{_0x4df44a[_0x16e0('0xa0')]++;logger[_0x16e0('0x6c')](_0x16e0('0xb4'),_0x4df44a[_0x16e0('0xa0')]);logger[_0x16e0('0x6c')]('id',_0x4df44a[_0x16e0('0xb5')]);_0x354d86['incrementPreviewCounters']({'id':_0x4df44a[_0x16e0('0xb5')],'field':{'countnosuchnumberretry':_0x4df44a[_0x16e0('0xa0')]}})[_0x16e0('0x85')](function(){_0x354d86['swapAdditionalPhones'](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});break;case _0x16e0('0xb6'):var _0x2ee9df=moment()[_0x16e0('0x58')](_0x16e0('0xb7'));_0x4df44a[_0x16e0('0xb8')]=_0x2ee9df;_0x4df44a['answertime']=_0x2ee9df;_0x4df44a[_0x16e0('0x71')]=!![];_0x5e4d71[_0x16e0('0x2d')]+=0x1;logger[_0x16e0('0x6c')](_0x16e0('0xb9'),_0x4df44a['uniqueid'],_0x16e0('0xba'),_0x5e4d71['name'],'pTalking:\x20',_0x5e4d71['pTalking']);ami[_0x16e0('0x26')](_0x16e0('0xbb'),ut['buildObj'](_0x4df44a,_0x16e0('0xbc'),this[_0x16e0('0x15')][_0x4df44a[_0x16e0('0x6e')]]));if(_0x5e4d71[_0x16e0('0xbd')]){ami[_0x16e0('0x26')](_0x16e0('0xbe'),ut[_0x16e0('0xbf')](_0x4df44a));}break;case'16':ami[_0x16e0('0x26')]('custom:agentcomplete',ut['buildObj'](_0x4df44a,_0x16e0('0xc0'),this['campaignsPreview'][_0x4df44a[_0x16e0('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x16e0('0xa5')](_0x4df44a,'complete'));_0x5e4d71[_0x16e0('0xc1')]+=0x1;_0x5e4d71['total']+=0x1;_0x5e4d71[_0x16e0('0x2b')]+=0x1;ut[_0x16e0('0x7b')](_0x5e4d71,'[16]');_0x4df44a[_0x16e0('0xa1')]=ut['totalGlobal'](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0x4,_0x16e0('0xc2'));rpcDb[_0x16e0('0x94')](_0x4df44a,_0x16e0('0xc3'));rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xc4'));rpcDb[_0x16e0('0xc5')](_0x4df44a);_0x5e4d71[_0x16e0('0x2f')]+=_0x4df44a[_0x16e0('0xc6')];_0x5e4d71[_0x16e0('0x2e')]+=_0x4df44a['talktime'];logger['info'](_0x16e0('0xc7'),_0x4df44a['uniqueid'],_0x16e0('0xba'),_0x5e4d71[_0x16e0('0x29')],_0x16e0('0x70'),_0x5e4d71[_0x16e0('0x2d')]);delete this['actions'][_0x4d613a[_0x16e0('0xc8')]];break;case _0x16e0('0xc9'):_0x5e4d71[_0x16e0('0xca')]+=0x1;_0x4df44a[_0x16e0('0xcb')]+=0x1;_0x4df44a['countglobal']=ut[_0x16e0('0xa2')](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0x5,_0x16e0('0xcc'));_0x67356b=_0x5e4d71[_0x16e0('0xcd')];_0x146017=_0x5e4d71['callAdditionalPhoneAfterMin'];ami[_0x16e0('0x26')](_0x16e0('0xce'),ut['buildObj'](_0x4df44a,_0x16e0('0xcf')));rpcDb['createCustomerHistory'](_0x4df44a,_0x16e0('0xd0'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'5',_0x5e4d71)[_0x16e0('0x85')](function(_0x5619a4){_0x1fa33d=_0x5619a4[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71['dialGlobalMaxRetry']){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,_0x16e0('0xd1'));rpcDb['createCustomerFinal'](_0x1ddea2,_0x16e0('0xd2'));}else{if(_0x4df44a[_0x16e0('0xcb')]>=_0x5e4d71[_0x16e0('0xd3')]){rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xd0'));}else{rpcDb[_0x16e0('0xb0')](ut['scheduledAt'](_0x4df44a,_0x16e0('0xcb'),_0x5e4d71[_0x16e0('0xcd')]),_0x4df44a[_0x16e0('0xb2')],_0x4df44a[_0x16e0('0xb3')]);}}}else{_0x4df44a[_0x16e0('0xcb')]++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a[_0x16e0('0xb5')],'field':{'countbusyretry':_0x4df44a[_0x16e0('0xcb')]}})[_0x16e0('0x85')](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});break;case _0x16e0('0xd6'):_0x5e4d71[_0x16e0('0x3f')]+=0x1;_0x4df44a[_0x16e0('0xd7')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut['totalGlobal'](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0x3,_0x16e0('0xd8'));_0x67356b=_0x5e4d71[_0x16e0('0xd9')];_0x146017=_0x5e4d71[_0x16e0('0xab')];var _0x2e61ad=ut[_0x16e0('0xda')](_0x4df44a,_0x5e4d71);ami[_0x16e0('0x26')]('custom:agentnoanswer',_0x2e61ad);rpcDb['createCustomerHistory'](_0x4df44a,_0x16e0('0xdb'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'3',_0x5e4d71)[_0x16e0('0x85')](function(_0x296778){_0x1fa33d=_0x296778[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71['dialGlobalMaxRetry']){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,'Global');rpcDb[_0x16e0('0x97')](_0x1ddea2,_0x16e0('0xdc'));}else{if(_0x4df44a[_0x16e0('0xd7')]>=_0x5e4d71[_0x16e0('0xdd')]){rpcDb[_0x16e0('0x97')](_0x4df44a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x16e0('0xb0')](ut[_0x16e0('0xb1')](_0x4df44a,_0x16e0('0xd7'),_0x5e4d71['dialNoAnswerRetryFrequency']),_0x4df44a[_0x16e0('0xb2')],_0x4df44a['activeContact']);}}}else{_0x4df44a[_0x16e0('0xd7')]++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a['idContact'],'field':{'countnoanswerretry':_0x4df44a[_0x16e0('0xd7')]}})[_0x16e0('0x85')](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});break;case _0x16e0('0xde'):_0x5e4d71[_0x16e0('0x3c')]+=0x1;_0x4df44a[_0x16e0('0xdf')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0x8,_0x16e0('0xe0'));_0x67356b=_0x5e4d71[_0x16e0('0xe1')];_0x146017=_0x5e4d71[_0x16e0('0xab')];ami[_0x16e0('0x26')]('custom:agentcongestion',ut[_0x16e0('0xa5')](_0x4df44a,_0x16e0('0xe2')));rpcDb[_0x16e0('0x94')](_0x4df44a,'[callProgressDetectingCustomer][logCongestion]');_0x354d86[_0x16e0('0xa8')](_0x4df44a,'8',_0x5e4d71)['then'](function(_0x9a330f){_0x1fa33d=_0x9a330f['additional']==0x1;if(!_0x1fa33d){if(ut['totalGlobal'](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,_0x16e0('0xd1'));rpcDb[_0x16e0('0x97')](_0x1ddea2,_0x16e0('0xe3'));}else{if(_0x4df44a[_0x16e0('0xdf')]>=_0x5e4d71['dialCongestionMaxRetry']){rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xe4'));}else{rpcDb[_0x16e0('0xb0')](ut['scheduledAt'](_0x4df44a,_0x16e0('0xdf'),_0x5e4d71['dialBusyRetryFrequency']),_0x4df44a[_0x16e0('0xb2')],_0x4df44a['activeContact']);}}}else{_0x4df44a[_0x16e0('0xdf')]++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a['idContact'],'field':{'countcongestionretry':_0x4df44a['countcongestionretry']}})[_0x16e0('0x85')](function(){_0x354d86['swapAdditionalPhones'](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});break;case _0x16e0('0xe5'):_0x5e4d71[_0x16e0('0x42')]+=0x1;_0x4df44a[_0x16e0('0xe6')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut['logCustomer'](_0x4df44a,0x14,'AgentReject');_0x67356b=_0x5e4d71[_0x16e0('0xe7')];_0x146017=_0x5e4d71[_0x16e0('0xab')];ami[_0x16e0('0x26')](_0x16e0('0xe8'),ut[_0x16e0('0xa5')](_0x4df44a,'agentreject'));rpcDb[_0x16e0('0x94')](_0x4df44a,_0x16e0('0xe9'));_0x354d86['verifyAdditionalPhones'](_0x4df44a,'20',_0x5e4d71)[_0x16e0('0x85')](function(_0x320c17){_0x1fa33d=_0x320c17[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut['totalGlobal'](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0x14,'AgentReject');rpcDb[_0x16e0('0x97')](_0x1ddea2,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4df44a[_0x16e0('0xe6')]>=_0x5e4d71[_0x16e0('0xea')]){rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xeb'));}else{rpcDb['rescheduleContact'](ut[_0x16e0('0xb1')](_0x4df44a,_0x16e0('0xe6'),_0x5e4d71['dialAgentRejectRetryFrequency']),_0x4df44a[_0x16e0('0xb2')],_0x4df44a[_0x16e0('0xb3')]);}}}else{_0x4df44a[_0x16e0('0xd7')]++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a['idContact'],'field':{'countnoanswerretry':_0x4df44a[_0x16e0('0xd7')]}})[_0x16e0('0x85')](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});break;case _0x16e0('0xec'):_0x5e4d71[_0x16e0('0x44')]+=0x1;_0x4df44a['countabandonedretry']+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0xb,'Abandoned');rpcDb[_0x16e0('0x94')](_0x4df44a,_0x16e0('0xed'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'11',_0x5e4d71)[_0x16e0('0x85')](function(_0x40268b){_0x1fa33d=_0x40268b[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut['cloneAction'](_0x4df44a,0xf,_0x16e0('0xd1'));rpcDb[_0x16e0('0x97')](_0x1ddea2,_0x16e0('0xed'));}else{if(_0x4df44a[_0x16e0('0xee')]>=_0x5e4d71[_0x16e0('0xef')]){rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xed'));}else{rpcDb[_0x16e0('0xb0')](ut[_0x16e0('0xb1')](_0x4df44a,_0x16e0('0xf0'),_0x5e4d71[_0x16e0('0xf1')]),_0x4df44a['unlockAgent'],_0x4df44a['activeContact']);}}}else{_0x4df44a['countnoanswerretry']++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a[_0x16e0('0xb5')],'field':{'countnoanswerretry':_0x4df44a[_0x16e0('0xd7')]}})[_0x16e0('0x85')](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)['then'](function(){});});}});break;case'18':_0x5e4d71['outboundUnknownCallsDay']+=0x1;_0x4df44a[_0x16e0('0xf2')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut['logCustomer'](_0x4df44a,0x12,_0x4d613a[_0x16e0('0xf3')]||_0x4d613a[_0x16e0('0xf4')]);ami[_0x16e0('0x26')](_0x16e0('0xf5'),ut[_0x16e0('0xa5')](_0x4df44a,_0x16e0('0xf6')));rpcDb[_0x16e0('0x94')](_0x4df44a,_0x16e0('0xf7'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'18',_0x5e4d71)['then'](function(_0x20f907){_0x1fa33d=_0x20f907[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0x12,_0x16e0('0xd1'));rpcDb[_0x16e0('0x97')](_0x1ddea2,_0x16e0('0xf7'));}else{rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xf7'));}}else{_0x4df44a[_0x16e0('0xd7')]++;_0x354d86['incrementPreviewCounters']({'id':_0x4df44a[_0x16e0('0xb5')],'field':{'countnoanswerretry':_0x4df44a[_0x16e0('0xd7')]}})[_0x16e0('0x85')](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});delete this[_0x16e0('0x6b')][_0x4d613a['linkedid']];break;case'19':_0x5e4d71[_0x16e0('0x43')]+=0x1;_0x4df44a['countglobal']=ut['totalGlobal'](_0x4df44a);ut['logCustomer'](_0x4df44a,0x13,_0x4d613a['cause-txt']||_0x4d613a[_0x16e0('0xf4')]);ami[_0x16e0('0x26')](_0x16e0('0xf5'),ut[_0x16e0('0xa5')](_0x4df44a,_0x16e0('0xf6')));rpcDb[_0x16e0('0x94')](_0x4df44a,_0x16e0('0xf8'));_0x354d86[_0x16e0('0xa8')](_0x4df44a,'18',_0x5e4d71)[_0x16e0('0x85')](function(_0xd04b62){_0x1fa33d=_0xd04b62[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut['totalGlobal'](_0x4df44a)>=_0x5e4d71['dialGlobalMaxRetry']){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,'Global');rpcDb['createCustomerFinal'](_0x1ddea2,_0x16e0('0xf8'));}else{rpcDb['createCustomerFinal'](_0x4df44a,_0x16e0('0xf8'));}}else{_0x4df44a['countnoanswerretry']++;_0x354d86[_0x16e0('0xd4')]({'id':_0x4df44a[_0x16e0('0xb5')],'field':{'countnoanswerretry':_0x4df44a[_0x16e0('0xd7')]}})['then'](function(){_0x354d86[_0x16e0('0xd5')](_0x4df44a,_0x67356b,_0x146017)[_0x16e0('0x85')](function(){});});}});delete this[_0x16e0('0x6b')][_0x4d613a[_0x16e0('0xc8')]];break;default:if(_0x4df44a['dialAnswer']){ut['decrementTalkink'](_0x5e4d71,'[default]');ut[_0x16e0('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5e4d71['name'],_0x4d613a);}_0x5e4d71[_0x16e0('0x43')]+=0x1;_0x4df44a[_0x16e0('0xa1')]=ut[_0x16e0('0xa2')](_0x4df44a);ut[_0x16e0('0x90')](_0x4df44a,0xc,_0x4d613a[_0x16e0('0xf3')]||_0x4d613a[_0x16e0('0xf4')]);_0x67356b=_0x5e4d71[_0x16e0('0xe7')];_0x146017=_0x5e4d71[_0x16e0('0xab')];rpcDb[_0x16e0('0x94')](_0x4df44a,'[callProgressDetectingCustomer][logUnknown]');_0x354d86[_0x16e0('0xa8')](_0x4df44a,'20',_0x5e4d71)[_0x16e0('0x85')](function(_0x200cbd){_0x1fa33d=_0x200cbd[_0x16e0('0xa9')]==0x1;if(!_0x1fa33d){if(ut[_0x16e0('0xa2')](_0x4df44a)>=_0x5e4d71[_0x16e0('0xac')]){_0x1ddea2=ut[_0x16e0('0xad')](_0x4df44a,0xf,_0x16e0('0xd1'));rpcDb[_0x16e0('0x97')](_0x1ddea2,_0x16e0('0xf9'));}else{rpcDb[_0x16e0('0x97')](_0x4df44a,_0x16e0('0xf9'));}delete this['actions'][_0x4d613a[_0x16e0('0xc8')]];}else{_0x354d86['swapAdditionalPhones'](_0x4df44a,_0x67356b,_0x146017)['then'](function(){});}});}if(!(_0x4df44a[_0x16e0('0x71')]&&_0xf35cad==='16')){ut[_0x16e0('0xfa')](_0x5e4d71,_0x16e0('0xfb'));logger[_0x16e0('0x6c')](_0x16e0('0xfc'),_0x4df44a['uniqueid'],_0x16e0('0xba'),_0x5e4d71[_0x16e0('0x29')],'originated:\x20',_0x5e4d71[_0x16e0('0x4e')]);}if(_0xf35cad!==_0x16e0('0xb6')){delete this[_0x16e0('0x6b')][_0x4d613a[_0x16e0('0xc8')]];delete this['actions'][_0x4d613a[_0x16e0('0xfd')]];}}};Preview[_0x16e0('0x10')][_0x16e0('0xfe')]=function(_0x43458b,_0x3201bf,_0x3418fb){if(_[_0x16e0('0xff')](_0x3201bf)&&_0x16e0('0x100')!==typeof _0x3201bf){return;}if(_[_0x16e0('0xff')](_0x3418fb)&&_0x16e0('0x100')!==typeof _0x3418fb){return;}switch(_0x3418fb[_0x16e0('0x101')]){case'0':ut[_0x16e0('0x102')](_0x43458b,0x0,_0x16e0('0xa3'));rpcDb[_0x16e0('0x103')](_0x43458b,_0x16e0('0x104'));break;case'3':ut[_0x16e0('0x102')](_0x43458b,0x3,_0x16e0('0xd8'));rpcDb[_0x16e0('0x103')](_0x43458b,_0x16e0('0x105'));break;case'5':ut[_0x16e0('0x102')](_0x43458b,0x5,'Busy');rpcDb[_0x16e0('0x103')](_0x43458b,_0x16e0('0x106'));break;case'8':ut[_0x16e0('0x102')](_0x43458b,0x8,_0x16e0('0xe0'));rpcDb[_0x16e0('0x103')](_0x43458b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x16e0('0x102')](_0x43458b,0x16,_0x16e0('0x107'));rpcDb[_0x16e0('0x103')](_0x43458b,_0x16e0('0x108'));break;default:ut['logAgent'](_0x43458b,0xc,_0x3418fb[_0x16e0('0x101')]);rpcDb['createAgentHistory'](_0x43458b,_0x16e0('0x109'));}ut['updateOriginated'](_0x3201bf,_0x16e0('0x10a'));logger['info'](_0x16e0('0x10b'),_0x43458b[_0x16e0('0x10c')],'\x20Queue',_0x3201bf[_0x16e0('0x29')],_0x16e0('0x6f'),_0x3201bf[_0x16e0('0x4e')]);delete this[_0x16e0('0x6b')][_0x43458b[_0x16e0('0x10c')]];};Preview[_0x16e0('0x10')][_0x16e0('0xa8')]=function(_0x46d994,_0x3f22cd,_0x3cd726){return Promise[_0x16e0('0x10d')]()[_0x16e0('0x85')](cmHopperAdditionalPhone[_0x16e0('0xa8')](_0x46d994,_0x3f22cd,_0x3cd726))[_0x16e0('0x8d')](logger[_0x16e0('0x6c')](_0x16e0('0x10e')));};Preview[_0x16e0('0x10')][_0x16e0('0xd5')]=function(_0x365d88,_0x30c0a6,_0x4b0f7b){return Promise[_0x16e0('0x10d')]()[_0x16e0('0x85')](cmHopperAdditionalPhone[_0x16e0('0xd5')](_0x365d88,_0x30c0a6,_0x4b0f7b))[_0x16e0('0x8d')](logger[_0x16e0('0x6c')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x16e0('0xd4')]=function(_0x253279){return Promise[_0x16e0('0x10d')]()[_0x16e0('0x85')](cmHopperAdditionalPhone[_0x16e0('0xd4')](_0x253279))[_0x16e0('0x8d')](logger[_0x16e0('0x6c')]('[incrementPreviewCounters]\x20'));};Preview[_0x16e0('0x10')][_0x16e0('0x10f')]=function(_0x55922e,_0x391d59,_0x2968f3,_0x2db95e,_0x47ddf8){var _0x1e9250=this;return new Promise(function(_0x5b73ac,_0x183134){if(_['isNil'](_0x391d59)||_[_0x16e0('0x6a')](_0x391d59[_0x16e0('0x110')])||_[_0x16e0('0x6a')](_0x391d59[_0x16e0('0x111')])||_['isNil'](_0x391d59[_0x16e0('0x75')])){_0x183134(ut[_0x16e0('0x5e')](_0x16e0('0x112'),_0x2db95e,_0x47ddf8));return;}var _0x5b25f3=uuid['v4']();var _0xc91dbf=_0x1e9250[_0x16e0('0x15')][_0x391d59[_0x16e0('0x113')][_0x16e0('0x29')]];var _0x16e18a=_0x2968f3?_0x1e9250[_0x16e0('0x17')][_0x2968f3]['id']:undefined;_0x1e9250[_0x16e0('0x6b')][_0x5b25f3]=new Action(_0x391d59,_0xc91dbf,_0x5b25f3,_0x2968f3,_0x16e18a);var _0x1a3304=_0x1e9250[_0x16e0('0x6b')][_0x5b25f3];_0x1a3304['unlockAgent']=_0x2db95e;_0x1a3304[_0x16e0('0xb3')]=_0x47ddf8;_0x1a3304['lookAgent']=_0x2968f3;if(_[_0x16e0('0x114')](_0x55922e)){_0x1e9250[_0x16e0('0x115')](_0x1a3304,_0xc91dbf,_0x391d59,_0x2968f3)[_0x16e0('0x85')](function(_0x428da3){logger[_0x16e0('0x6c')](_0x16e0('0x116'),'Queue:\x20'+_0x1a3304[_0x16e0('0x6e')]+_0x16e0('0x117')+_0x1a3304[_0x16e0('0xb5')],JSON[_0x16e0('0x56')](_0x428da3));ami[_0x16e0('0x26')](_0x16e0('0x118'),ut[_0x16e0('0xa5')](_0x1a3304,_0x16e0('0x119'),_0x1e9250[_0x16e0('0x15')][_0x1a3304[_0x16e0('0x6e')]]));_0x5b73ac(ut[_0x16e0('0x5e')](_0x16e0('0x11a')));})[_0x16e0('0x8d')](function(_0x1c1697){ut[_0x16e0('0x63')](_0x16e0('0x11b'),_0x1c1697);_0x183134(ut[_0x16e0('0x5e')](_0x16e0('0x11c'),_0x2db95e,_0x47ddf8));});}else{_0xc91dbf['outboundBlacklistCallsDay']+=0x1;ut[_0x16e0('0x11d')](_0x1a3304);rpcDb[_0x16e0('0x11e')](_0x1a3304,_0x16e0('0x11f'));delete _0x1e9250[_0x16e0('0x6b')][_0x5b25f3];_0x183134(ut[_0x16e0('0x5e')]('Contact\x20in\x20black\x20List',_0x2db95e,_0x47ddf8));}});};Preview['prototype']['isTrunkReachable']=function(_0x23c635){return!_[_0x16e0('0x6a')](_0x23c635)&&!_[_0x16e0('0x6a')](_0x23c635[_0x16e0('0x29')])&&!_[_0x16e0('0x6a')](_0x23c635[_0x16e0('0x120')])&&_0x23c635[_0x16e0('0x120')]&&!_[_0x16e0('0x6a')](this[_0x16e0('0x16')][util[_0x16e0('0x58')](_0x16e0('0x121'),_0x23c635[_0x16e0('0x29')])])&&!_[_0x16e0('0x6a')](this[_0x16e0('0x16')][util[_0x16e0('0x58')](_0x16e0('0x121'),_0x23c635['name'])][_0x16e0('0x77')])&&(this[_0x16e0('0x16')][util[_0x16e0('0x58')](_0x16e0('0x121'),_0x23c635[_0x16e0('0x29')])][_0x16e0('0x77')]==='reachable'||this['trunks'][util[_0x16e0('0x58')](_0x16e0('0x121'),_0x23c635[_0x16e0('0x29')])][_0x16e0('0x77')]===_0x16e0('0x122'));};Preview[_0x16e0('0x10')][_0x16e0('0x8a')]=function(_0x19edec,_0x22508c){var _0x2cb7db=this;return new Promise(function(_0x35f2bd,_0x2e84f5){_0x2cb7db[_0x16e0('0x123')](_0x19edec,_0x22508c)[_0x16e0('0x85')](function(_0x179f4c){_0x35f2bd(_[_0x16e0('0x72')](_0x179f4c,[_0x16e0('0x5e')]));})['catch'](function(_0x5945f8){if(_0x5945f8[_0x16e0('0x124')]){rpcDb[_0x16e0('0x125')](_0x19edec);}if(_0x5945f8['active']){rpcDb[_0x16e0('0x8e')](_0x19edec);}_0x2e84f5(_[_0x16e0('0x72')](_0x5945f8,[_0x16e0('0x5e')]));});});};Preview[_0x16e0('0x10')][_0x16e0('0x123')]=function(_0x5d1da5,_0x364706){var _0x4b956e=this;return new Promise(function(_0x295a83,_0x54f9a1){var _0x25016f,_0x21c7a7;rpcDb[_0x16e0('0x126')](_0x5d1da5)[_0x16e0('0x85')](function(_0x5bdb70){if(!_['isNil'](_0x5bdb70[0x0])){_0x21c7a7=_0x5bdb70[0x0][_0x16e0('0x127')]?![]:!![];_0x25016f=_0x5bdb70[0x0]['recallme']?!![]:![];_0x25016f=_0x364706?!![]:_0x25016f;}var _0x1f3c64=_0x4b956e[_0x16e0('0x128')](_0x5bdb70);if(_0x1f3c64[_0x16e0('0x129')]){rpcDb[_0x16e0('0x12a')](_[_0x16e0('0x72')](_0x5bdb70[0x0],['VoiceQueueId',_0x16e0('0x111')]))[_0x16e0('0x85')](function(_0x3fe601){_0x4b956e[_0x16e0('0x10f')](_0x3fe601,_0x5bdb70[0x0],_0x364706,_0x21c7a7,_0x25016f)['then'](function(_0x3f63b3){_0x295a83(_0x3f63b3);})[_0x16e0('0x8d')](function(_0x101d11){_0x54f9a1(_0x101d11);});})[_0x16e0('0x8d')](function(_0xcca867){ut[_0x16e0('0x63')](_0x16e0('0x12b'),_0xcca867);_0x54f9a1(ut[_0x16e0('0x5e')](_0x16e0('0x12c'),_0x21c7a7,_0x25016f));});}else{_0x54f9a1(ut[_0x16e0('0x5e')](_0x1f3c64[_0x16e0('0x5e')],_0x21c7a7,_0x25016f));}})[_0x16e0('0x8d')](function(_0x9865b4){ut[_0x16e0('0x63')](_0x16e0('0x12d'),_0x9865b4);_0x54f9a1(ut[_0x16e0('0x5e')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x16e0('0x10')][_0x16e0('0x128')]=function(_0x538575){if(_[_0x16e0('0x6a')](_0x538575)||_['isEmpty'](_0x538575)||!_[_0x16e0('0x6a')](_0x538575[0x0]['Agent'])&&_['isNil'](_0x538575[0x0][_0x16e0('0x88')][_0x16e0('0x29')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x538575);return{'isValid':![],'message':_0x16e0('0x12e')};}var _0x178460=this[_0x16e0('0x15')][_0x538575[0x0][_0x16e0('0x113')][_0x16e0('0x29')]];_0x178460[_0x16e0('0x5e')]=_0x16e0('0x9e');if(_['isNil'](_0x178460)){ut[_0x16e0('0x63')](_0x16e0('0x12f'),_0x178460);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x16e0('0x9b')](_0x178460[_0x16e0('0x53')])){ut[_0x16e0('0x63')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x16e0('0x130')+_0x178460[_0x16e0('0x29')]+_0x16e0('0x131'));if(!this[_0x16e0('0x9b')](_0x178460[_0x16e0('0x9c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x178460['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x16e0('0x132')};}}if(!ut['isActive'](_0x178460[_0x16e0('0x68')])){ut[_0x16e0('0x63')](_0x16e0('0x133'),_0x178460[_0x16e0('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x178460['name']+_0x16e0('0x134')};}return{'isValid':!![],'message':_0x16e0('0x135')};};Preview['prototype'][_0x16e0('0x115')]=function(_0x153ded,_0x379fd5,_0x1fb21a,_0x445454){var _0xe25e1a=this;return new Promise(function(_0x3196a3,_0xe7e5a2){var _0x8f7763=_0x153ded[_0x16e0('0x10c')];var _0x53c1eb=_0xe25e1a[_0x16e0('0x9b')](_0x379fd5[_0x16e0('0x53')])?util['format']('SIP/%s/%s%s',_0x379fd5[_0x16e0('0x53')][_0x16e0('0x29')],_[_0x16e0('0x6a')](_0x379fd5[_0x16e0('0x39')])?'':_0x379fd5[_0x16e0('0x39')][_0x16e0('0x136')]()||'',_0x379fd5['dialCutDigit']>0x0?_0x1fb21a[_0x16e0('0x111')][_0x16e0('0x137')](_0x379fd5[_0x16e0('0x138')]):_0x1fb21a[_0x16e0('0x111')]):util[_0x16e0('0x58')](_0x16e0('0x139'),_[_0x16e0('0x6a')](_0x379fd5[_0x16e0('0x9c')])?_0x379fd5['Trunk'][_0x16e0('0x29')]:_0x379fd5[_0x16e0('0x9c')][_0x16e0('0x29')],_[_0x16e0('0x6a')](_0x379fd5['dialPrefix'])?'':_0x379fd5[_0x16e0('0x39')][_0x16e0('0x136')]()||'',_0x379fd5[_0x16e0('0x138')]>0x0?_0x1fb21a[_0x16e0('0x111')][_0x16e0('0x137')](_0x379fd5[_0x16e0('0x138')]):_0x1fb21a['phone']);var _0x3c72f8=_0xe25e1a[_0x16e0('0x9b')](_0x379fd5[_0x16e0('0x53')])?ut['getCallerId'](_0x379fd5[_0x16e0('0x53')][_0x16e0('0x54')],_0x379fd5[_0x16e0('0x36')],_0x379fd5[_0x16e0('0x13a')]>0x0?ut[_0x16e0('0x13b')](_0x379fd5[_0x16e0('0x37')],_0x379fd5[_0x16e0('0x13a')]):_0x379fd5[_0x16e0('0x37')]):ut['getCallerId'](_['isNil'](_0x379fd5[_0x16e0('0x9c')])?_0x379fd5[_0x16e0('0x53')][_0x16e0('0x54')]:_0x379fd5[_0x16e0('0x9c')][_0x16e0('0x54')],_0x379fd5['dialOriginateCallerIdName'],_0x379fd5['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x16e0('0x13b')](_0x379fd5[_0x16e0('0x37')],_0x379fd5[_0x16e0('0x13a')]):_0x379fd5['dialOriginateCallerIdNumber']);if(_0x3c72f8){_0x153ded[_0x16e0('0x13c')]=ut[_0x16e0('0x13d')](_0x3c72f8);_0x153ded[_0x16e0('0x13e')]=ut[_0x16e0('0x13f')](_0x3c72f8);}var _0x31d84a=ut[_0x16e0('0x140')](_0x379fd5,_0x1fb21a,_0x53c1eb,_0x3c72f8,_0x8f7763,_0x153ded);_['merge'](_0x153ded,ut[_0x16e0('0x141')](_0x31d84a));_0x153ded[_0x16e0('0x8f')]=moment()['format'](_0x16e0('0xb7'));_0x379fd5[_0x16e0('0x142')]=_0x31d84a;ami[_0x16e0('0x143')](ut[_0x16e0('0x144')](_0x153ded,_0x379fd5,_0x31d84a,_0x153ded[_0x16e0('0xb3')],_0x445454))[_0x16e0('0x85')](function(_0x1e1e1c){_0x379fd5[_0x16e0('0x4e')]+=0x1;logger[_0x16e0('0x6c')](_0x16e0('0x145'),_0x8f7763,'\x20Queue',_0x379fd5[_0x16e0('0x29')],'originated:\x20',_0x379fd5[_0x16e0('0x4e')]);_0x3196a3(_0x1e1e1c);})[_0x16e0('0x8d')](function(_0x25e4d7){ut['logAgent'](_0x153ded,0xe,_0x16e0('0x146'));rpcDb[_0x16e0('0x103')](_0x153ded,_0x16e0('0x147'));_0xe7e5a2(_0x25e4d7);});});};Preview[_0x16e0('0x10')][_0x16e0('0x20')]=function(_0x4e4eb7){if(this[_0x16e0('0x6b')][_0x4e4eb7['linkedid']]){this['actions'][_0x4e4eb7[_0x16e0('0xc8')]][_0x16e0('0x78')]=_0x4e4eb7[_0x16e0('0x78')];}};Preview[_0x16e0('0x10')][_0x16e0('0x148')]=function(_0x44cd84){var _0x239bfb=this;var _0x48a06c=this[_0x16e0('0x6b')][_0x44cd84[_0x16e0('0x149')]];if(_0x48a06c){if(_0x48a06c[_0x16e0('0x14a')]&&this[_0x16e0('0x17')][_0x48a06c[_0x16e0('0x14a')]]){ut['logLookAgent'](_0x48a06c,this[_0x16e0('0x17')][_0x48a06c[_0x16e0('0x14a')]]['name'],this[_0x16e0('0x17')][_0x48a06c['lookAgent']]['id']);}var _0xbe1ad=_[_0x16e0('0x14b')](_0x48a06c);_0xbe1ad['responsetime']=moment()[_0x16e0('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3d0983=_0x239bfb[_0x16e0('0x15')][_0x48a06c[_0x16e0('0x6e')]];if(ut[_0x16e0('0x14c')](_0x44cd84[_0x16e0('0x14d')])){if(_0x48a06c[_0x16e0('0xb2')]){rpcDb[_0x16e0('0x125')](_0x48a06c['idContact']);}if(_0x48a06c[_0x16e0('0xb3')]){rpcDb[_0x16e0('0x8e')](_0x48a06c[_0x16e0('0xb5')]);}ami[_0x16e0('0x26')](_0x16e0('0x14e'),ut[_0x16e0('0xa5')](_0x48a06c,_0x16e0('0x14f'),this[_0x16e0('0x15')][_0x48a06c['queue']]));this['callProgressDetectingAgent'](_0xbe1ad,_0x3d0983,_0x44cd84);}else{_0x48a06c['starttime']=moment()[_0x16e0('0x58')](_0x16e0('0xb7'));ut['logAgent'](_0xbe1ad,0x4,_0x16e0('0xc2'));rpcDb['createAgentHistory'](_0xbe1ad,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x16e0('0x10')][_0x16e0('0x1c')]=function(_0x3c61c3){var _0x388d2c=this['actions'][_0x3c61c3[_0x16e0('0xc8')]];var _0x552f2f;if(_0x388d2c){_0x552f2f=this[_0x16e0('0x15')][_0x388d2c[_0x16e0('0x6e')]];logger[_0x16e0('0x6c')](_0x16e0('0x150'),_0x3c61c3[_0x16e0('0xc8')],_0x16e0('0xba'),_0x552f2f['name'],'pTalking:\x20',_0x552f2f[_0x16e0('0x2d')]);}if(this[_0x16e0('0x6b')][_0x3c61c3[_0x16e0('0xc8')]]&&_0x3c61c3[_0x16e0('0xc8')]!==_0x3c61c3['uniqueid']){if(_0x3c61c3[_0x16e0('0x151')]==='16'&&this[_0x16e0('0x6b')][_0x3c61c3[_0x16e0('0xc8')]][_0x16e0('0x71')]){this['callProgressDetectingCustomer'](_0x3c61c3,_0x3c61c3['linkedid'],_0x3c61c3['cause']);}else if(this[_0x16e0('0x6b')][_0x3c61c3[_0x16e0('0xc8')]]['dialAnswer']){logger['info'](_0x16e0('0x152'),_0x3c61c3[_0x16e0('0xc8')],_0x3c61c3[_0x16e0('0x151')],_0x16e0('0xba'),_0x552f2f[_0x16e0('0x29')],_0x16e0('0x70'),_0x552f2f[_0x16e0('0x2d')]);this[_0x16e0('0x9f')](_0x3c61c3,_0x3c61c3[_0x16e0('0xc8')],_0x3c61c3[_0x16e0('0x151')]);}}else if(_0x388d2c&&_[_0x16e0('0x6a')](_0x388d2c[_0x16e0('0x153')])&&_0x552f2f['dialQueueProject']&&_0x3c61c3['linkedid']===_0x3c61c3[_0x16e0('0x10c')]&&_['isNil'](_0x3c61c3[_0x16e0('0x101')])&&_0x3c61c3[_0x16e0('0x151')]==='16'&&_0x3c61c3['channelstate']==='6'&&_['isUndefined'](_0x388d2c[_0x16e0('0x154')])){if(_0x388d2c[_0x16e0('0xb2')]){rpcDb[_0x16e0('0x125')](_0x388d2c['idContact']);}if(_0x388d2c['activeContact']){rpcDb[_0x16e0('0x8e')](_0x388d2c[_0x16e0('0xb5')]);}_0x3c61c3['reason']='22';this[_0x16e0('0xfe')](_0x388d2c,_0x552f2f,_0x3c61c3);}else if(_0x388d2c&&_0x388d2c['transfer']){if(_0x3c61c3[_0x16e0('0x151')]==='16'&&this[_0x16e0('0x6b')][_0x3c61c3[_0x16e0('0xc8')]][_0x16e0('0x71')]){logger[_0x16e0('0x6c')]('[syncHangup][talking][transfer]',_0x3c61c3['linkedid'],_0x3c61c3['cause'],'\x20Queue',_0x552f2f[_0x16e0('0x29')],'pTalking:\x20',_0x552f2f[_0x16e0('0x2d')]);this[_0x16e0('0x9f')](_0x3c61c3,_0x3c61c3[_0x16e0('0xc8')],_0x3c61c3[_0x16e0('0x151')]);}else if(this[_0x16e0('0x6b')][_0x3c61c3['linkedid']][_0x16e0('0x71')]){logger['info'](_0x16e0('0x152'),_0x3c61c3[_0x16e0('0xc8')],_0x3c61c3[_0x16e0('0x151')],_0x16e0('0xba'),_0x552f2f['name'],_0x16e0('0x70'),_0x552f2f['pTalking']);this[_0x16e0('0x9f')](_0x3c61c3,_0x3c61c3[_0x16e0('0xc8')],_0x3c61c3[_0x16e0('0x151')]);}}};Preview[_0x16e0('0x10')]['syncDialEnd']=function(_0x5a3d61){if(this[_0x16e0('0x6b')][_0x5a3d61[_0x16e0('0xfd')]]&&_0x5a3d61[_0x16e0('0xfd')]!==_0x5a3d61['destuniqueid']){this[_0x16e0('0x9f')](_0x5a3d61,_0x5a3d61[_0x16e0('0xfd')],_0x5a3d61[_0x16e0('0xf4')]);}};Preview[_0x16e0('0x10')][_0x16e0('0x1d')]=function(_0x309326){if(this['actions'][_0x309326[_0x16e0('0xc8')]]&&_0x309326[_0x16e0('0xc8')]!==_0x309326[_0x16e0('0x10c')]&&!this[_0x16e0('0x6b')][_0x309326[_0x16e0('0xc8')]][_0x16e0('0x71')]){if(_0x309326[_0x16e0('0x151')]==='1'){this[_0x16e0('0x9f')](_0x309326,_0x309326[_0x16e0('0xc8')],_0x309326[_0x16e0('0x151')]);}}};Preview[_0x16e0('0x10')]['addVariable']=function(_0xe72df6,_0x2cb662,_0x479f6a){if(this[_0x16e0('0x6b')][_0xe72df6]){if(_[_0x16e0('0x6a')](this[_0x16e0('0x6b')][_0xe72df6]['variables'])){this[_0x16e0('0x6b')][_0xe72df6]['variables']={};}this[_0x16e0('0x6b')][_0xe72df6][_0x16e0('0x142')][_0x2cb662]=_0x479f6a;}};Preview[_0x16e0('0x10')][_0x16e0('0x22')]=function(_0x27b85d){try{if(!_['isNil'](_0x27b85d)){if(ut['filterKey'](_[_0x16e0('0x155')](_0x27b85d[_0x16e0('0x156')])[0x0])){this[_0x16e0('0x157')](_0x27b85d[_0x16e0('0x10c')],_[_0x16e0('0x155')](_0x27b85d[_0x16e0('0x156')])[0x0],_0x27b85d['value']);}}}catch(_0x5c66c5){logger['error'](_0x16e0('0x158'),util[_0x16e0('0x159')](_0x5c66c5,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x16e0('0x23')]=function(_0xc45c5d){if(_0xc45c5d){if(this[_0x16e0('0x6b')][_0xc45c5d[_0x16e0('0x15a')]]){this['actions'][_0xc45c5d[_0x16e0('0x15a')]][_0x16e0('0x154')]=!![];}}};Preview[_0x16e0('0x10')]['syncBlindTransfer']=function(_0x3826d1){if(_0x3826d1){if(this['actions'][_0x3826d1[_0x16e0('0x15b')]]){this[_0x16e0('0x6b')][_0x3826d1[_0x16e0('0x15b')]][_0x16e0('0x154')]=!![];}}};module[_0x16e0('0x15c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 831a53f..868888d 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 _0xb307=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','resolve','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xb307,0x10c));var _0x7b30=function(_0x48952d,_0x3a8b6e){_0x48952d=_0x48952d-0x0;var _0x162322=_0xb307[_0x48952d];return _0x162322;};'use strict';var util=require('util');var BPromise=require(_0x7b30('0x0'));var logger=require(_0x7b30('0x1'))(_0x7b30('0x2'));var _=require(_0x7b30('0x3'));var cmHopper=require(_0x7b30('0x4'));var cmHopperFinal=require(_0x7b30('0x5'));var cmHopperHistory=require(_0x7b30('0x6'));var cmHopperBlack=require(_0x7b30('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x7b30('0x8'));var voiceQueueReport=require(_0x7b30('0x9'));function loggerCatch(_0x5ef8cd){return function(_0x6cdba0){logger[_0x7b30('0xa')](_0x5ef8cd,util[_0x7b30('0xb')](_0x6cdba0,{'showHidden':![],'depth':null}));};}function create(_0x3d0d78){return BPromise['resolve']()[_0x7b30('0xc')](cmHopperHistory[_0x7b30('0xd')](_0x3d0d78))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x36aed0){return BPromise[_0x7b30('0xe')]()[_0x7b30('0xc')](agentReportPreview['createHistory'](_0x36aed0))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x10')));}function moveContact(_0x1a2b98){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x1a2b98,!![]))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x11')));}exports[_0x7b30('0x12')]=function(_0x640362){return BPromise['resolve']()[_0x7b30('0xc')](cmHopperBlack[_0x7b30('0x12')](_0x640362))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x13')));};exports[_0x7b30('0x14')]=function(_0x4c4189){return BPromise[_0x7b30('0xe')]()['then'](cmHopper['getContactPreview'](_0x4c4189))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x15')));};exports['createHistory']=function(_0x310ae4,_0x3474a8){create(_0x310ae4)['catch'](loggerCatch(_0x3474a8));moveContact(_0x310ae4)[_0x7b30('0xf')](loggerCatch(_0x3474a8));};exports['createAgentHistory']=function(_0x3b6337,_0x4a8e72){createAgent(_0x3b6337)['catch'](loggerCatch(_0x4a8e72));};exports[_0x7b30('0x16')]=function(_0x5c371a,_0x52f959){create(_0x5c371a)[_0x7b30('0xf')](loggerCatch(_0x52f959));};exports[_0x7b30('0x17')]=function(_0xc0c94c,_0x347a05){moveContact(_0xc0c94c)['catch'](loggerCatch(_0x347a05));};exports[_0x7b30('0x18')]=function(_0x39e369,_0x26c85c,_0x1b194b){if(_0x26c85c){_0x39e369[_0x7b30('0x19')]=null;}if(_0x1b194b){_0x39e369[_0x7b30('0x1a')]=![];}return BPromise['resolve']()[_0x7b30('0xc')](cmHopper['rescheduleContact'](_0x39e369))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x1b')));};exports[_0x7b30('0x1c')]=function(_0x59bea0){return BPromise['resolve']()[_0x7b30('0xc')](cmHopper[_0x7b30('0x1c')](_0x59bea0))['catch'](loggerCatch(_0x7b30('0x1d')));};exports[_0x7b30('0x1e')]=function(_0x14ec56){return BPromise[_0x7b30('0xe')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x14ec56,0x1))['catch'](loggerCatch(_0x7b30('0x1f')));};exports[_0x7b30('0x20')]=function(_0x3cfbed){return BPromise[_0x7b30('0xe')]()[_0x7b30('0xc')](cmHopper[_0x7b30('0x1e')]({'active':![]},_0x3cfbed,0x1))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x21')));};exports[_0x7b30('0x22')]=function(_0x6e8fa2){var _0x4876dc={};_0x4876dc[_0x7b30('0x23')]=_0x6e8fa2[_0x7b30('0x23')];_0x4876dc['uniqueid']=_0x6e8fa2[_0x7b30('0x24')];_0x4876dc[_0x7b30('0x25')]=_0x6e8fa2[_0x7b30('0x25')];_0x4876dc[_0x7b30('0x26')]=_0x6e8fa2['calleridname'];_0x4876dc[_0x7b30('0x27')]=_0x6e8fa2[_0x7b30('0x27')];_0x4876dc[_0x7b30('0x28')]=_0x6e8fa2['answertime'];_0x4876dc[_0x7b30('0x29')]=_0x6e8fa2[_0x7b30('0x2a')];_0x4876dc[_0x7b30('0x2b')]=0x1;_0x4876dc[_0x7b30('0x2c')]=_0x6e8fa2[_0x7b30('0x2d')];_0x4876dc[_0x7b30('0x2e')]=_0x6e8fa2[_0x7b30('0x2f')];_0x4876dc[_0x7b30('0x30')]=_0x7b30('0x31');_0x4876dc[_0x7b30('0x32')]=_0x7b30('0x33');_0x4876dc[_0x7b30('0x34')]=0x0;_0x4876dc[_0x7b30('0x35')]=0x1;_0x4876dc[_0x7b30('0x36')]=_0x6e8fa2[_0x7b30('0x2f')];_0x4876dc[_0x7b30('0x37')]=_0x7b30('0x38');return BPromise[_0x7b30('0xe')]()[_0x7b30('0xc')](voiceQueueReport[_0x7b30('0x39')](_0x4876dc))[_0x7b30('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x7b30('0x3a')]=function(_0x5910ba,_0x4932c0){return BPromise[_0x7b30('0xe')]()[_0x7b30('0xc')](cmHopper[_0x7b30('0x3a')](_0x5910ba,_0x4932c0))[_0x7b30('0xf')](loggerCatch(_0x7b30('0x3b')));};exports['rescheduleContactInQueue']=function(_0x2d0eb0){return BPromise[_0x7b30('0xe')]()[_0x7b30('0xc')](cmHopper['rescheduleContact'](_0x2d0eb0,!![],!![]))['catch'](loggerCatch(_0x7b30('0x3c')));}; \ No newline at end of file +var _0xc687=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x4c1a63,_0x346035){var _0x304ddb=function(_0x339a09){while(--_0x339a09){_0x4c1a63['push'](_0x4c1a63['shift']());}};_0x304ddb(++_0x346035);}(_0xc687,0xb3));var _0x7c68=function(_0x153792,_0x3fabff){_0x153792=_0x153792-0x0;var _0x578222=_0xc687[_0x153792];return _0x578222;};'use strict';var util=require('util');var BPromise=require(_0x7c68('0x0'));var logger=require(_0x7c68('0x1'))(_0x7c68('0x2'));var _=require(_0x7c68('0x3'));var cmHopper=require(_0x7c68('0x4'));var cmHopperFinal=require(_0x7c68('0x5'));var cmHopperHistory=require(_0x7c68('0x6'));var cmHopperBlack=require(_0x7c68('0x7'));var voiceQueueRt=require(_0x7c68('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x7c68('0x9'));function loggerCatch(_0x2b9580){return function(_0x2d8768){logger[_0x7c68('0xa')](_0x2b9580,util[_0x7c68('0xb')](_0x2d8768,{'showHidden':![],'depth':null}));};}function create(_0x14c7a9){return BPromise[_0x7c68('0xc')]()['then'](cmHopperHistory[_0x7c68('0xd')](_0x14c7a9))[_0x7c68('0xe')](loggerCatch(_0x7c68('0xf')));}function createAgent(_0x97dbf3){return BPromise['resolve']()[_0x7c68('0x10')](agentReportPreview[_0x7c68('0xd')](_0x97dbf3))[_0x7c68('0xe')](loggerCatch(_0x7c68('0xf')));}function moveContact(_0x386c00){return BPromise['resolve']()[_0x7c68('0x10')](cmHopper[_0x7c68('0x11')](_0x386c00,!![]))[_0x7c68('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x45f30c){return BPromise['resolve']()[_0x7c68('0x10')](cmHopperBlack[_0x7c68('0x12')](_0x45f30c))[_0x7c68('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x7f5ad){return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x13')](_0x7f5ad))['catch'](loggerCatch(_0x7c68('0x14')));};exports[_0x7c68('0xd')]=function(_0xf31e4b,_0x1f2022){create(_0xf31e4b)[_0x7c68('0xe')](loggerCatch(_0x1f2022));moveContact(_0xf31e4b)[_0x7c68('0xe')](loggerCatch(_0x1f2022));};exports[_0x7c68('0x15')]=function(_0x12cc8e,_0x2512e6){createAgent(_0x12cc8e)['catch'](loggerCatch(_0x2512e6));};exports[_0x7c68('0x16')]=function(_0x1583a1,_0x3155a0){create(_0x1583a1)[_0x7c68('0xe')](loggerCatch(_0x3155a0));};exports['createCustomerFinal']=function(_0x2a3a68,_0x2b204e){moveContact(_0x2a3a68)['catch'](loggerCatch(_0x2b204e));};exports[_0x7c68('0x17')]=function(_0x28f7cd,_0x3648aa,_0x3dc33e){if(_0x3648aa){_0x28f7cd[_0x7c68('0x18')]=null;}if(_0x3dc33e){_0x28f7cd[_0x7c68('0x19')]=![];}return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x17')](_0x28f7cd))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x7c68('0x1a')]=function(_0x4b9a60){return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x1a')](_0x4b9a60))[_0x7c68('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x7c68('0x1b')]=function(_0x527038){return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x1b')]({'UserId':null},_0x527038,0x1))[_0x7c68('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x7c68('0x1c')]=function(_0xc843d0){return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x1b')]({'active':![]},_0xc843d0,0x1))[_0x7c68('0xe')](loggerCatch(_0x7c68('0x1d')));};exports[_0x7c68('0x1e')]=function(_0x13f022){var _0x1c18b1={};_0x1c18b1[_0x7c68('0x1f')]=_0x13f022[_0x7c68('0x1f')];_0x1c18b1[_0x7c68('0x20')]=_0x13f022['uniqueid'];_0x1c18b1[_0x7c68('0x21')]=_0x13f022[_0x7c68('0x21')];_0x1c18b1[_0x7c68('0x22')]=_0x13f022[_0x7c68('0x22')];_0x1c18b1[_0x7c68('0x23')]=_0x13f022[_0x7c68('0x23')];_0x1c18b1[_0x7c68('0x24')]=_0x13f022[_0x7c68('0x25')];_0x1c18b1[_0x7c68('0x26')]=_0x13f022[_0x7c68('0x25')];_0x1c18b1[_0x7c68('0x27')]=0x1;_0x1c18b1[_0x7c68('0x28')]=_0x13f022['endtime'];_0x1c18b1[_0x7c68('0x29')]=_0x13f022[_0x7c68('0x2a')];_0x1c18b1[_0x7c68('0x2b')]=_0x7c68('0x2c');_0x1c18b1[_0x7c68('0x2d')]=_0x7c68('0x2e');_0x1c18b1[_0x7c68('0x2f')]=0x0;_0x1c18b1[_0x7c68('0x30')]=0x1;_0x1c18b1[_0x7c68('0x31')]=_0x13f022[_0x7c68('0x2a')];_0x1c18b1['queuecallerexitreason']='COMPLETED';return BPromise[_0x7c68('0xc')]()['then'](voiceQueueReport['create'](_0x1c18b1))[_0x7c68('0xe')](loggerCatch(_0x7c68('0x32')));};exports['getContactRecallMe']=function(_0x132445,_0x5938b9){return BPromise['resolve']()[_0x7c68('0x10')](cmHopper[_0x7c68('0x33')](_0x132445,_0x5938b9))[_0x7c68('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7c68('0x34')]=function(_0x257e95){return BPromise[_0x7c68('0xc')]()[_0x7c68('0x10')](cmHopper[_0x7c68('0x17')](_0x257e95,!![],!![]))[_0x7c68('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index aa896fb..a386f42 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 _0xd144=['util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','Contact','isNil','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','ringtime','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','status','reachable','push','getDiff','createBody','CampaignId','type','campaigntype','dialAnswer','scheduledat','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0xd144,0x97));var _0x4d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd144[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4d14('0x0'));var _=require(_0x4d14('0x1'));var moment=require(_0x4d14('0x2'));var logger=require(_0x4d14('0x3'))(_0x4d14('0x4'));var ipAgi=process['env'][_0x4d14('0x5')]||_0x4d14('0x6');function getSeconds(_0x3a49ad,_0x1a99f2){var _0x49bafc=moment(_0x3a49ad)[_0x4d14('0x7')](0x0);var _0x5718a8=moment(_0x1a99f2)['milliseconds'](0x0);return _0x49bafc[_0x4d14('0x8')](_0x5718a8,_0x4d14('0x9'));}exports[_0x4d14('0xa')]=function(_0x3c4420){return function(_0x4f981c){logger[_0x4d14('0xb')](_0x3c4420,util['inspect'](_0x4f981c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3d8a37,_0x51f54d){logger[_0x4d14('0xc')](_0x3d8a37,util[_0x4d14('0xd')](_0x51f54d,{'showHidden':![],'depth':null}));};exports[_0x4d14('0xe')]=function(_0x4be10b,_0x2278f5){logger[_0x4d14('0xb')](_0x4be10b,util[_0x4d14('0xd')](_0x2278f5,{'showHidden':![],'depth':null}));};exports[_0x4d14('0xf')]=function(_0x68cea2){return function(_0x39c69f){logger[_0x4d14('0xc')](_0x68cea2,util['inspect'](_0x39c69f,{'showHidden':![],'depth':null}));};};exports[_0x4d14('0x10')]=function(_0x15200c,_0x788f39,_0x3e9078){return{'message':_0x15200c,'unlock':_0x788f39,'active':_0x3e9078};};exports[_0x4d14('0x11')]=function(_0x576b42,_0x275782,_0x31a35a){if(!_[_0x4d14('0x12')](_0x31a35a)&&_0x4d14('0x13')===typeof _0x31a35a&&!_[_0x4d14('0x14')](_0x31a35a)){if(!_[_0x4d14('0x12')](_0x275782)&&_0x4d14('0x13')===typeof _0x275782&&!_['isEmpty'](_0x275782)){return util['format'](_0x4d14('0x15'),_0x275782,_0x31a35a);}return util[_0x4d14('0x16')]('\x22%s\x22\x20<%s>',_0x31a35a,_0x31a35a);}if(!_[_0x4d14('0x12')](_0x576b42)&&_0x4d14('0x13')===typeof _0x576b42&&!_[_0x4d14('0x14')](_0x576b42)){return _0x576b42;}return'\x22\x22\x20<>';};exports[_0x4d14('0x17')]=function(_0x471a64){if(_['isNil'](_0x471a64)){return![];}return _0x471a64;};exports[_0x4d14('0x18')]=function(_0x4d3b0f,_0x58294b,_0x27038d,_0x10554e,_0x1a7c2e,_0x20b7d1){var _0x28b0de={'XMD-QUEUE':_0x58294b['Queue']?_0x58294b[_0x4d14('0x19')][_0x4d14('0x1a')]:'','XMD-CALLERID':_0x10554e,'XMD-CALLERID-PREVIEW':_0x20b7d1?util[_0x4d14('0x16')](_0x4d14('0x15'),_0x20b7d1[_0x4d14('0x1b')],_0x20b7d1['calleridnum']):_0x10554e,'XMD-DIALID':_0x1a7c2e,'XMD-CONTACTID':_0x58294b[_0x4d14('0x1c')],'XMD-CDRTYPE':_0x4d14('0x1d'),'CALLERID(all)':_0x10554e,'XMD-VOICEQUEUEID':_0x58294b[_0x4d14('0x1e')],'XMD-DIALCHANNEL':_0x27038d,'XMD-DIALTIMEOUT':_0x4d3b0f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x4d14('0x16')]('\x22rtTxX%s%s\x22',_0x4d3b0f[_0x4d14('0x1f')]?'g':'',_[_0x4d14('0x14')](_0x4d3b0f[_0x4d14('0x20')])?'':_0x4d14('0x21')),'XMD-DIALURL':_0x4d3b0f[_0x4d14('0x22')]||'','XMD-AGI':_0x4d3b0f['dialQueueProject']?util['format'](_0x4d14('0x23'),ipAgi,_0x4d3b0f[_0x4d14('0x24')]):_0x4d14('0x25'),'XMD-AGIAFTER':_0x4d3b0f['dialQueueProject2']?util[_0x4d14('0x16')](_0x4d14('0x23'),ipAgi,_0x4d3b0f[_0x4d14('0x1f')]):_0x4d14('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x20b7d1?_0x20b7d1[_0x4d14('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x20b7d1?_0x20b7d1['originatecalleridname']:'','XMD-DESTINATION':_0x4d14('0x27'),'SIPADDHEADER':_0x4d14('0x28')};if(!_['isEmpty'](_0x4d3b0f[_0x4d14('0x20')])){_0x28b0de[util[_0x4d14('0x16')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4d3b0f[_0x4d14('0x20')];_0x28b0de[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1a7c2e;}if(_0x58294b&&_0x58294b[_0x4d14('0x29')]){for(var _0x1942a8 in _0x58294b[_0x4d14('0x29')]){if(_0x58294b['Contact']['hasOwnProperty'](_0x1942a8)){if(!_[_0x4d14('0x2a')](_0x58294b[_0x4d14('0x29')][_0x1942a8])&&_0x1942a8!=='id'&&_0x1942a8!==_0x4d14('0x2b')&&_0x1942a8!=='createdAt'&&_0x1942a8!==_0x4d14('0x2c')){_0x28b0de[util[_0x4d14('0x16')](_0x4d14('0x2d'),_0x4d14('0x2e'),_[_0x4d14('0x2f')](_0x1942a8))]=_0x58294b[_0x4d14('0x29')][_0x1942a8];}}}}return _0x28b0de;};exports[_0x4d14('0x30')]=function(_0x2662ab){var _0x1608d0={};for(var _0x5bb5a9 in _0x2662ab){if(_0x2662ab[_0x4d14('0x31')](_0x5bb5a9)){_0x1608d0[util[_0x4d14('0x16')]('%s',_[_0x4d14('0x32')](_0x5bb5a9))]=_0x2662ab[_0x5bb5a9];}}return{'variables':_0x1608d0};};exports['updateOriginated']=function(_0x3d02aa,_0x5c17d5){if(!_[_0x4d14('0x2a')](_0x3d02aa)){if(_0x3d02aa['hasOwnProperty'](_0x4d14('0x33'))){if(_0x3d02aa[_0x4d14('0x33')]>0x0){_0x3d02aa[_0x4d14('0x33')]-=0x1;}else{logger[_0x4d14('0xb')](_0x4d14('0x34'),_0x5c17d5);}}}else{logger[_0x4d14('0xb')](_0x4d14('0x35'),_0x5c17d5);}};exports[_0x4d14('0x36')]=function(_0x3915a3){var _0x4bef56=moment()[_0x4d14('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x3915a3['state']=0xd;_0x3915a3['statedesc']=_0x4d14('0x37');_0x3915a3[_0x4d14('0x38')]=_0x4bef56;_0x3915a3[_0x4d14('0x39')]=_0x4bef56;_0x3915a3[_0x4d14('0x3a')]=_0x4bef56;};exports['logAgent']=function(_0x23e1eb,_0x4aa2bf,_0x3803e9){var _0x3d265e=moment()[_0x4d14('0x16')](_0x4d14('0x3b'));_0x23e1eb[_0x4d14('0x3c')]=_0x4aa2bf;_0x23e1eb[_0x4d14('0x3d')]=_0x3803e9;_0x23e1eb[_0x4d14('0x39')]=_0x3d265e;_0x23e1eb[_0x4d14('0x3e')]=getSeconds(_0x23e1eb[_0x4d14('0x39')],_0x23e1eb[_0x4d14('0x38')]);};exports['logLookAgent']=function(_0x37f3c5,_0x583526,_0x1c4542){_0x37f3c5[_0x4d14('0x3f')]=_0x583526;_0x37f3c5[_0x4d14('0x40')]=_0x1c4542;};exports['logCustomer']=function(_0x4c420a,_0xb8f6e1,_0x4e58e0){var _0x1a6dde=moment()[_0x4d14('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c420a[_0x4d14('0x3c')]=_0xb8f6e1;_0x4c420a[_0x4d14('0x3d')]=_0x4e58e0;_0x4c420a[_0x4d14('0x39')]=_0x4c420a[_0x4d14('0x39')]?_0x4c420a[_0x4d14('0x39')]:_0x1a6dde;_0x4c420a['endtime']=_0x4c420a[_0x4d14('0x3a')]?_0x4c420a[_0x4d14('0x3a')]:_0x1a6dde;_0x4c420a[_0x4d14('0x3e')]=getSeconds(_0x4c420a[_0x4d14('0x39')]||0x0,_0x4c420a[_0x4d14('0x38')]||0x0);_0x4c420a[_0x4d14('0x41')]=_0x4c420a[_0x4d14('0x42')]?getSeconds(_0x4c420a[_0x4d14('0x3a')],_0x4c420a[_0x4d14('0x42')]):0x0;};exports[_0x4d14('0x43')]=function(_0x292c0e){return _0x292c0e===_0x4d14('0x44');};exports[_0x4d14('0x45')]=function(_0x59c300,_0x3eadd2,_0x367ebf,_0x2d440e,_0xc31e78){var _0x12a7d9=_0x2d440e?_0x4d14('0x46'):_0x59c300[_0x4d14('0x1b')];_0x12a7d9=_0xc31e78?_0x4d14('0x47'):_0x12a7d9;return{'actionid':_0x59c300[_0x4d14('0x48')],'action':_0x4d14('0x49'),'channel':_0x59c300[_0x4d14('0x4a')],'callerid':util[_0x4d14('0x16')](_0x4d14('0x15'),_0x12a7d9,_0x59c300[_0x4d14('0x4b')]),'Exten':_0x4d14('0x27'),'Context':_0x4d14('0x4c'),'Priority':'1','variable':_0x367ebf,'timeout':(_0x3eadd2[_0x4d14('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x59c300['uniqueid']};};exports[_0x4d14('0x4e')]=function(_0x334904){return _0x334904[_0x4d14('0x4f')]+_0x334904['countcongestionretry']+_0x334904['countnoanswerretry']+_0x334904['countagentrejectretry']+_0x334904[_0x4d14('0x50')];};exports[_0x4d14('0x51')]=function(_0x4f4dbe){var _0x67f4e2=_[_0x4d14('0x52')](_0x4f4dbe);_0x67f4e2['state']=0xf;_0x67f4e2['statedesc']=_0x4d14('0x53');return _0x67f4e2;};exports[_0x4d14('0x54')]=function(_0x589ac4,_0x57a745,_0x424c0d){var _0x353339={};_0x353339[_0x57a745]=_0x589ac4[_0x57a745];_0x353339[_0x4d14('0x55')]=![];_0x353339['scheduledat']=moment()[_0x4d14('0x56')](_0x424c0d,_0x4d14('0x57'))[_0x4d14('0x16')](_0x4d14('0x3b'));_0x353339[_0x4d14('0x1c')]=_0x589ac4[_0x4d14('0x1c')];_0x353339[_0x4d14('0x58')]=_0x589ac4[_0x4d14('0x58')];_0x353339[_0x4d14('0x1e')]=_0x589ac4[_0x4d14('0x1e')]||undefined;return _0x353339;};exports[_0x4d14('0x59')]=function(_0xdb0ea8,_0x3a953d){if(!_[_0x4d14('0x2a')](_0xdb0ea8)){if(_0xdb0ea8[_0x4d14('0x5a')]>0x0){_0xdb0ea8[_0x4d14('0x5a')]-=0x1;}else{logger[_0x4d14('0xb')](_0x3a953d,_0x4d14('0x5b'));}}else{logger[_0x4d14('0xb')](_0x3a953d,_0x4d14('0x5c'));}};exports[_0x4d14('0x5d')]=function(_0x4c5946){if(_0x4c5946<=0x0){return!![];}return![];};function buildObj(_0x4d026e,_0x254a1d,_0x1c2ee8){_0x4d026e[_0x4d14('0x5e')]=_0x254a1d;_0x4d026e[_0x4d14('0x1a')]=_0x4d026e[_0x4d14('0x5f')];_0x4d026e[_0x4d14('0x60')]=_0x4d026e[_0x4d14('0x4a')];_0x4d026e[_0x4d14('0x61')]=_0x4d14('0x62');if(_0x1c2ee8){_0x4d026e['mandatoryDisposition']=_0x1c2ee8[_0x4d14('0x63')];}return _0x4d026e;}exports[_0x4d14('0x64')]=buildObj;exports[_0x4d14('0x65')]=function(_0x55c4ef){var _0x1b3c55={};_0x1b3c55[_0x4d14('0x5f')]=_0x55c4ef[_0x4d14('0x5f')];_0x1b3c55[_0x4d14('0x60')]=_0x55c4ef[_0x4d14('0x4a')];_0x1b3c55[_0x4d14('0x48')]=_0x55c4ef[_0x4d14('0x48')];return _0x1b3c55;};exports['agentReadyId']=function(_0x56b53f){var _0x244112=[];for(var _0x364a6c in _0x56b53f){if(_0x56b53f[_0x4d14('0x31')](_0x364a6c)){if(!_[_0x4d14('0x2a')](_0x56b53f[_0x364a6c])&&_0x56b53f[_0x364a6c][_0x4d14('0x3c')]==='not_inuse'&&_0x56b53f[_0x364a6c][_0x4d14('0x66')]===_0x4d14('0x67')){_0x244112[_0x4d14('0x68')](_0x56b53f[_0x364a6c]['id']);}}}return _0x244112;};exports[_0x4d14('0x69')]=function(_0x4ebac7){var _0x3bc733=moment()[_0x4d14('0x7')](0x0);var _0x195f35=moment(_0x4ebac7)[_0x4d14('0x7')](0x0);return _0x3bc733[_0x4d14('0x8')](_0x195f35,'seconds');};exports[_0x4d14('0x6a')]=function(_0x44ca87){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x44ca87[_0x4d14('0x1c')],'ListId':_0x44ca87[_0x4d14('0x58')],'VoiceQueueId':_0x44ca87[_0x4d14('0x1e')]||undefined,'CampaignId':_0x44ca87[_0x4d14('0x6b')]||undefined};};exports['filterKey']=function(_0x5bedd4){if(_0x5bedd4===_0x4d14('0x48')||_0x5bedd4==='idContact'||_0x5bedd4==='queue'||_0x5bedd4===_0x4d14('0x6c')||_0x5bedd4===_0x4d14('0x6d')||_0x5bedd4===_0x4d14('0x6e')||_0x5bedd4==='membername'||_0x5bedd4===_0x4d14('0x4a')||_0x5bedd4==='calleridname'||_0x5bedd4==='active'||_0x5bedd4==='calleridnum'||_0x5bedd4===_0x4d14('0x6f')||_0x5bedd4==='countbusyretry'||_0x5bedd4===_0x4d14('0x70')||_0x5bedd4===_0x4d14('0x71')||_0x5bedd4==='countglobal'||_0x5bedd4===_0x4d14('0x72')||_0x5bedd4===_0x4d14('0x73')||_0x5bedd4==='callbackat'||_0x5bedd4==='recallme'||_0x5bedd4===_0x4d14('0x1c')||_0x5bedd4===_0x4d14('0x58')||_0x5bedd4==='UserId'||_0x5bedd4===_0x4d14('0x1e')||_0x5bedd4===_0x4d14('0x74')||_0x5bedd4===_0x4d14('0x75')||_0x5bedd4===_0x4d14('0x76')||_0x5bedd4===_0x4d14('0x77')||_0x5bedd4===_0x4d14('0x78')||_0x5bedd4===_0x4d14('0x79')||_0x5bedd4==='xmd-dialtimeout'||_0x5bedd4===_0x4d14('0x7a')||_0x5bedd4===_0x4d14('0x7b')||_0x5bedd4===_0x4d14('0x7c')||_0x5bedd4===_0x4d14('0x7d')||_0x5bedd4==='xmd-cdrtype'||_0x5bedd4===_0x4d14('0x7e')||_0x5bedd4===_0x4d14('0x7f')||_0x5bedd4===_0x4d14('0x80')||_0x5bedd4===_0x4d14('0x81')||_0x5bedd4===_0x4d14('0x82')||_0x5bedd4===_0x4d14('0x83')||_0x5bedd4===_0x4d14('0x84')||_0x5bedd4==='rtpaudioqosloss'||_0x5bedd4===_0x4d14('0x85')||_0x5bedd4===_0x4d14('0x86')||_0x5bedd4==='rtpaudioqosrttbridged'||_0x5bedd4===_0x4d14('0x81')||_0x5bedd4==='rtpaudioqosbridged'||_0x5bedd4===_0x4d14('0x83')||_0x5bedd4===_0x4d14('0x84')||_0x5bedd4===_0x4d14('0x87')||_0x5bedd4==='rtpaudioqoslossbridged'||_0x5bedd4===_0x4d14('0x86')||_0x5bedd4===_0x4d14('0x88')||_0x5bedd4===_0x4d14('0x89')||_0x5bedd4==='bridgepvtcallid'||_0x5bedd4==='state'||_0x5bedd4===_0x4d14('0x3d')){return![];}return!![];};exports[_0x4d14('0x8a')]=function(_0x5a1b1a,_0x49ba5a){var _0x210883,_0x1d5c75,_0x1bad6f;if(_0x49ba5a<=0x0){_0x49ba5a=0x1;}_0x210883=new RegExp(_0x4d14('0x8b')+_0x49ba5a+'}$');_0x1d5c75=Math[_0x4d14('0x8c')](0xa,_0x49ba5a-0x1);_0x1bad6f=Math[_0x4d14('0x8c')](0xa,_0x49ba5a)-0x1;return util[_0x4d14('0x16')]('%s',_[_0x4d14('0x8d')](_0x5a1b1a,_0x210883,_[_0x4d14('0x8e')](_0x1d5c75,_0x1bad6f)));};exports[_0x4d14('0x8f')]=function(_0x4696a4){var _0x42f709=_0x4696a4[_0x4d14('0x90')](/"(.*?)"/);return _0x42f709?_0x42f709[0x1]:_0x4696a4;};exports[_0x4d14('0x91')]=function(_0x4b7381){var _0x2fe1f2=_0x4b7381[_0x4d14('0x90')](/<(.*?)>/);return _0x2fe1f2?_0x2fe1f2[0x1]:_0x4b7381;};function buildNoAnswerEventPayload(_0x12a0bc,_0x14c172){var _0x53afe9=buildObj(_0x12a0bc,_0x4d14('0x92'));if(!_[_0x4d14('0x14')](_0x14c172[_0x4d14('0x93')])){Object['keys'](_0x14c172[_0x4d14('0x93')])[_0x4d14('0x94')](function(_0x3d136b){_0x53afe9[_0x3d136b[_0x4d14('0x95')]()]=_0x14c172[_0x4d14('0x93')][_0x3d136b];});}return _0x53afe9;}exports[_0x4d14('0x96')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x4eb0=['countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','not_inuse','status','reachable','push','getDiff','createBody','filterKey','type','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','milliseconds','diff','seconds','inspect','logger','error','logger2','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logLookAgent','membername','UserId','endtime','ringtime','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','totalGlobal'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4eb0,0x1cf));var _0x04eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4eb0[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x04eb('0x0'));var _=require(_0x04eb('0x1'));var moment=require(_0x04eb('0x2'));var logger=require(_0x04eb('0x3'))(_0x04eb('0x4'));var ipAgi=process['env'][_0x04eb('0x5')]||'127.0.0.1';function getSeconds(_0xd042d2,_0x5423da){var _0x5c98a9=moment(_0xd042d2)[_0x04eb('0x6')](0x0);var _0x435ebb=moment(_0x5423da)['milliseconds'](0x0);return _0x5c98a9[_0x04eb('0x7')](_0x435ebb,_0x04eb('0x8'));}exports['loggerCatch']=function(_0x278213){return function(_0x4b6a41){logger['error'](_0x278213,util[_0x04eb('0x9')](_0x4b6a41,{'showHidden':![],'depth':null}));};};exports[_0x04eb('0xa')]=function(_0x534266,_0x1ae16){logger['info'](_0x534266,util[_0x04eb('0x9')](_0x1ae16,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x161bb7,_0x581dfc){logger[_0x04eb('0xb')](_0x161bb7,util[_0x04eb('0x9')](_0x581dfc,{'showHidden':![],'depth':null}));};exports[_0x04eb('0xc')]=function(_0x4317fa){return function(_0x551d2){logger['info'](_0x4317fa,util[_0x04eb('0x9')](_0x551d2,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5339c8,_0x3ff38b,_0x445eb2){return{'message':_0x5339c8,'unlock':_0x3ff38b,'active':_0x445eb2};};exports[_0x04eb('0xd')]=function(_0x1c0d6f,_0x52f9c7,_0x13d7da){if(!_['isUndefined'](_0x13d7da)&&'string'===typeof _0x13d7da&&!_[_0x04eb('0xe')](_0x13d7da)){if(!_[_0x04eb('0xf')](_0x52f9c7)&&_0x04eb('0x10')===typeof _0x52f9c7&&!_[_0x04eb('0xe')](_0x52f9c7)){return util[_0x04eb('0x11')](_0x04eb('0x12'),_0x52f9c7,_0x13d7da);}return util['format'](_0x04eb('0x12'),_0x13d7da,_0x13d7da);}if(!_[_0x04eb('0xf')](_0x1c0d6f)&&_0x04eb('0x10')===typeof _0x1c0d6f&&!_['isEmpty'](_0x1c0d6f)){return _0x1c0d6f;}return _0x04eb('0x13');};exports[_0x04eb('0x14')]=function(_0x4c9543){if(_[_0x04eb('0x15')](_0x4c9543)){return![];}return _0x4c9543;};exports['addVariables']=function(_0x1a1c7f,_0x3ce78a,_0x5dd739,_0x155643,_0x52ab43,_0x57a0b4){var _0x1d2faa={'XMD-QUEUE':_0x3ce78a[_0x04eb('0x16')]?_0x3ce78a[_0x04eb('0x16')][_0x04eb('0x17')]:'','XMD-CALLERID':_0x155643,'XMD-CALLERID-PREVIEW':_0x57a0b4?util[_0x04eb('0x11')](_0x04eb('0x12'),_0x57a0b4[_0x04eb('0x18')],_0x57a0b4[_0x04eb('0x19')]):_0x155643,'XMD-DIALID':_0x52ab43,'XMD-CONTACTID':_0x3ce78a[_0x04eb('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x155643,'XMD-VOICEQUEUEID':_0x3ce78a[_0x04eb('0x1b')],'XMD-DIALCHANNEL':_0x5dd739,'XMD-DIALTIMEOUT':_0x1a1c7f[_0x04eb('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x04eb('0x11')]('\x22rtTxX%s%s\x22',_0x1a1c7f['dialQueueProject2']?'g':'',_[_0x04eb('0xe')](_0x1a1c7f['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1a1c7f[_0x04eb('0x1d')]||'','XMD-AGI':_0x1a1c7f[_0x04eb('0x1e')]?util[_0x04eb('0x11')](_0x04eb('0x1f'),ipAgi,_0x1a1c7f[_0x04eb('0x1e')]):_0x04eb('0x20'),'XMD-AGIAFTER':_0x1a1c7f['dialQueueProject2']?util['format'](_0x04eb('0x1f'),ipAgi,_0x1a1c7f[_0x04eb('0x21')]):_0x04eb('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x57a0b4?_0x57a0b4[_0x04eb('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x57a0b4?_0x57a0b4['originatecalleridname']:'','XMD-DESTINATION':_0x04eb('0x23'),'SIPADDHEADER':_0x04eb('0x24')};if(!_[_0x04eb('0xe')](_0x1a1c7f[_0x04eb('0x25')])){_0x1d2faa[util[_0x04eb('0x11')]('%s',_0x04eb('0x26'))]=_0x1a1c7f['monitor_format'];_0x1d2faa[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x52ab43;}if(_0x3ce78a&&_0x3ce78a[_0x04eb('0x27')]){for(var _0xb7c1ad in _0x3ce78a[_0x04eb('0x27')]){if(_0x3ce78a[_0x04eb('0x27')][_0x04eb('0x28')](_0xb7c1ad)){if(!_[_0x04eb('0x15')](_0x3ce78a[_0x04eb('0x27')][_0xb7c1ad])&&_0xb7c1ad!=='id'&&_0xb7c1ad!==_0x04eb('0x29')&&_0xb7c1ad!==_0x04eb('0x2a')&&_0xb7c1ad!==_0x04eb('0x2b')){_0x1d2faa[util['format'](_0x04eb('0x2c'),_0x04eb('0x2d'),_[_0x04eb('0x2e')](_0xb7c1ad))]=_0x3ce78a[_0x04eb('0x27')][_0xb7c1ad];}}}}return _0x1d2faa;};exports[_0x04eb('0x2f')]=function(_0x2374d4){var _0x12b010={};for(var _0x7c2b29 in _0x2374d4){if(_0x2374d4['hasOwnProperty'](_0x7c2b29)){_0x12b010[util['format']('%s',_[_0x04eb('0x30')](_0x7c2b29))]=_0x2374d4[_0x7c2b29];}}return{'variables':_0x12b010};};exports[_0x04eb('0x31')]=function(_0x4c9167,_0x160cc8){if(!_[_0x04eb('0x15')](_0x4c9167)){if(_0x4c9167['hasOwnProperty'](_0x04eb('0x32'))){if(_0x4c9167[_0x04eb('0x32')]>0x0){_0x4c9167[_0x04eb('0x32')]-=0x1;}else{logger['error'](_0x04eb('0x33'),_0x160cc8);}}}else{logger[_0x04eb('0xb')](_0x04eb('0x34'),_0x160cc8);}};exports[_0x04eb('0x35')]=function(_0x148287){var _0x258e73=moment()[_0x04eb('0x11')](_0x04eb('0x36'));_0x148287[_0x04eb('0x37')]=0xd;_0x148287[_0x04eb('0x38')]='Blacklist';_0x148287[_0x04eb('0x39')]=_0x258e73;_0x148287[_0x04eb('0x3a')]=_0x258e73;_0x148287['endtime']=_0x258e73;};exports['logAgent']=function(_0x5d521e,_0x4b59e1,_0x547a00){var _0x3c51cb=moment()[_0x04eb('0x11')](_0x04eb('0x36'));_0x5d521e['state']=_0x4b59e1;_0x5d521e[_0x04eb('0x38')]=_0x547a00;_0x5d521e[_0x04eb('0x3a')]=_0x3c51cb;_0x5d521e['ringtime']=getSeconds(_0x5d521e[_0x04eb('0x3a')],_0x5d521e[_0x04eb('0x39')]);};exports[_0x04eb('0x3b')]=function(_0x162c5a,_0x926db0,_0x560fef){_0x162c5a[_0x04eb('0x3c')]=_0x926db0;_0x162c5a[_0x04eb('0x3d')]=_0x560fef;};exports['logCustomer']=function(_0x2be9cb,_0x149b88,_0x40751e){var _0x159a68=moment()[_0x04eb('0x11')](_0x04eb('0x36'));_0x2be9cb[_0x04eb('0x37')]=_0x149b88;_0x2be9cb['statedesc']=_0x40751e;_0x2be9cb[_0x04eb('0x3a')]=_0x2be9cb['responsetime']?_0x2be9cb[_0x04eb('0x3a')]:_0x159a68;_0x2be9cb[_0x04eb('0x3e')]=_0x2be9cb[_0x04eb('0x3e')]?_0x2be9cb['endtime']:_0x159a68;_0x2be9cb[_0x04eb('0x3f')]=getSeconds(_0x2be9cb[_0x04eb('0x3a')]||0x0,_0x2be9cb[_0x04eb('0x39')]||0x0);_0x2be9cb[_0x04eb('0x40')]=_0x2be9cb[_0x04eb('0x41')]?getSeconds(_0x2be9cb[_0x04eb('0x3e')],_0x2be9cb['answertime']):0x0;};exports[_0x04eb('0x42')]=function(_0x648e2a){return _0x648e2a==='Failure';};exports['variablesAction']=function(_0x107d23,_0x294b3b,_0xb287c8,_0x59d9e4,_0x59d3b8){var _0x138ccd=_0x59d9e4?_0x04eb('0x43'):_0x107d23[_0x04eb('0x18')];_0x138ccd=_0x59d3b8?_0x04eb('0x44'):_0x138ccd;return{'actionid':_0x107d23[_0x04eb('0x45')],'action':'originate','channel':_0x107d23[_0x04eb('0x46')],'callerid':util[_0x04eb('0x11')](_0x04eb('0x12'),_0x138ccd,_0x107d23[_0x04eb('0x19')]),'Exten':_0x04eb('0x23'),'Context':_0x04eb('0x47'),'Priority':'1','variable':_0xb287c8,'timeout':(_0x294b3b['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x107d23[_0x04eb('0x45')]};};exports[_0x04eb('0x48')]=function(_0x4a29d1){return _0x4a29d1[_0x04eb('0x49')]+_0x4a29d1['countcongestionretry']+_0x4a29d1[_0x04eb('0x4a')]+_0x4a29d1['countagentrejectretry']+_0x4a29d1[_0x04eb('0x4b')];};exports[_0x04eb('0x4c')]=function(_0x489900){var _0xc7a797=_['clone'](_0x489900);_0xc7a797[_0x04eb('0x37')]=0xf;_0xc7a797['statedesc']=_0x04eb('0x4d');return _0xc7a797;};exports[_0x04eb('0x4e')]=function(_0x3c9b98,_0x40174,_0x5902b1){var _0x21434f={};_0x21434f[_0x40174]=_0x3c9b98[_0x40174];_0x21434f['active']=![];_0x21434f[_0x04eb('0x4f')]=moment()[_0x04eb('0x50')](_0x5902b1,_0x04eb('0x51'))[_0x04eb('0x11')](_0x04eb('0x36'));_0x21434f[_0x04eb('0x1a')]=_0x3c9b98['ContactId'];_0x21434f['ListId']=_0x3c9b98[_0x04eb('0x52')];_0x21434f[_0x04eb('0x1b')]=_0x3c9b98[_0x04eb('0x1b')]||undefined;return _0x21434f;};exports[_0x04eb('0x53')]=function(_0x38a715,_0x3c5241){if(!_[_0x04eb('0x15')](_0x38a715)){if(_0x38a715['pTalking']>0x0){_0x38a715[_0x04eb('0x54')]-=0x1;}else{logger['error'](_0x3c5241,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x04eb('0xb')](_0x3c5241,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x04eb('0x55')]=function(_0xafc08c){if(_0xafc08c<=0x0){return!![];}return![];};function buildObj(_0x1444eb,_0x406c05,_0x2a51cd){_0x1444eb['lastevent']=_0x406c05;_0x1444eb['name']=_0x1444eb[_0x04eb('0x56')];_0x1444eb['interface']=_0x1444eb[_0x04eb('0x46')];_0x1444eb[_0x04eb('0x57')]=_0x04eb('0x58');if(_0x2a51cd){_0x1444eb[_0x04eb('0x59')]=_0x2a51cd[_0x04eb('0x59')];}return _0x1444eb;}exports['buildObj']=buildObj;exports[_0x04eb('0x5a')]=function(_0x3fc140){var _0x517106={};_0x517106[_0x04eb('0x56')]=_0x3fc140[_0x04eb('0x56')];_0x517106[_0x04eb('0x5b')]=_0x3fc140[_0x04eb('0x46')];_0x517106[_0x04eb('0x45')]=_0x3fc140[_0x04eb('0x45')];return _0x517106;};exports['agentReadyId']=function(_0xf75dc5){var _0x135c11=[];for(var _0x3754da in _0xf75dc5){if(_0xf75dc5[_0x04eb('0x28')](_0x3754da)){if(!_['isNil'](_0xf75dc5[_0x3754da])&&_0xf75dc5[_0x3754da][_0x04eb('0x37')]===_0x04eb('0x5c')&&_0xf75dc5[_0x3754da][_0x04eb('0x5d')]===_0x04eb('0x5e')){_0x135c11[_0x04eb('0x5f')](_0xf75dc5[_0x3754da]['id']);}}}return _0x135c11;};exports[_0x04eb('0x60')]=function(_0x20ed95){var _0x33d884=moment()[_0x04eb('0x6')](0x0);var _0xd19b0e=moment(_0x20ed95)[_0x04eb('0x6')](0x0);return _0x33d884[_0x04eb('0x7')](_0xd19b0e,_0x04eb('0x8'));};exports[_0x04eb('0x61')]=function(_0x50376c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x50376c[_0x04eb('0x1a')],'ListId':_0x50376c['ListId'],'VoiceQueueId':_0x50376c[_0x04eb('0x1b')]||undefined,'CampaignId':_0x50376c['CampaignId']||undefined};};exports[_0x04eb('0x62')]=function(_0x5cf7e9){if(_0x5cf7e9===_0x04eb('0x45')||_0x5cf7e9==='idContact'||_0x5cf7e9===_0x04eb('0x56')||_0x5cf7e9===_0x04eb('0x63')||_0x5cf7e9==='campaigntype'||_0x5cf7e9==='dialAnswer'||_0x5cf7e9==='membername'||_0x5cf7e9==='channelAgent'||_0x5cf7e9===_0x04eb('0x18')||_0x5cf7e9==='active'||_0x5cf7e9===_0x04eb('0x19')||_0x5cf7e9===_0x04eb('0x4f')||_0x5cf7e9===_0x04eb('0x49')||_0x5cf7e9===_0x04eb('0x64')||_0x5cf7e9===_0x04eb('0x4a')||_0x5cf7e9===_0x04eb('0x65')||_0x5cf7e9===_0x04eb('0x66')||_0x5cf7e9===_0x04eb('0x67')||_0x5cf7e9===_0x04eb('0x68')||_0x5cf7e9===_0x04eb('0x69')||_0x5cf7e9===_0x04eb('0x1a')||_0x5cf7e9==='ListId'||_0x5cf7e9==='UserId'||_0x5cf7e9==='VoiceQueueId'||_0x5cf7e9===_0x04eb('0x6a')||_0x5cf7e9===_0x04eb('0x6b')||_0x5cf7e9==='xmd-queue'||_0x5cf7e9===_0x04eb('0x6c')||_0x5cf7e9===_0x04eb('0x6d')||_0x5cf7e9==='xmd-dialurl'||_0x5cf7e9==='xmd-dialtimeout'||_0x5cf7e9===_0x04eb('0x6e')||_0x5cf7e9===_0x04eb('0x6f')||_0x5cf7e9===_0x04eb('0x70')||_0x5cf7e9===_0x04eb('0x71')||_0x5cf7e9==='xmd-cdrtype'||_0x5cf7e9===_0x04eb('0x72')||_0x5cf7e9==='xmd-agiafter'||_0x5cf7e9===_0x04eb('0x73')||_0x5cf7e9===_0x04eb('0x74')||_0x5cf7e9===_0x04eb('0x75')||_0x5cf7e9===_0x04eb('0x76')||_0x5cf7e9===_0x04eb('0x77')||_0x5cf7e9===_0x04eb('0x78')||_0x5cf7e9===_0x04eb('0x79')||_0x5cf7e9==='rtpaudioqosrtt'||_0x5cf7e9===_0x04eb('0x7a')||_0x5cf7e9==='rtpaudioqos'||_0x5cf7e9===_0x04eb('0x75')||_0x5cf7e9===_0x04eb('0x76')||_0x5cf7e9===_0x04eb('0x77')||_0x5cf7e9===_0x04eb('0x78')||_0x5cf7e9===_0x04eb('0x79')||_0x5cf7e9==='rtpaudioqosrtt'||_0x5cf7e9==='rtpaudioqosrttbridged'||_0x5cf7e9===_0x04eb('0x7b')||_0x5cf7e9==='bridgepvtcallid'||_0x5cf7e9==='state'||_0x5cf7e9===_0x04eb('0x38')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x437a85,_0x282ae4){var _0x5ec539,_0x5bf9d2,_0x4de299;if(_0x282ae4<=0x0){_0x282ae4=0x1;}_0x5ec539=new RegExp(_0x04eb('0x7c')+_0x282ae4+'}$');_0x5bf9d2=Math[_0x04eb('0x7d')](0xa,_0x282ae4-0x1);_0x4de299=Math[_0x04eb('0x7d')](0xa,_0x282ae4)-0x1;return util[_0x04eb('0x11')]('%s',_[_0x04eb('0x7e')](_0x437a85,_0x5ec539,_[_0x04eb('0x7f')](_0x5bf9d2,_0x4de299)));};exports[_0x04eb('0x80')]=function(_0x408546){var _0x3c1071=_0x408546[_0x04eb('0x81')](/"(.*?)"/);return _0x3c1071?_0x3c1071[0x1]:_0x408546;};exports[_0x04eb('0x82')]=function(_0x383016){var _0x15632b=_0x383016[_0x04eb('0x81')](/<(.*?)>/);return _0x15632b?_0x15632b[0x1]:_0x383016;};function buildNoAnswerEventPayload(_0x508762,_0x109e0f){var _0x1242ee=buildObj(_0x508762,'noanswer');if(!_[_0x04eb('0xe')](_0x109e0f[_0x04eb('0x83')])){Object[_0x04eb('0x84')](_0x109e0f[_0x04eb('0x83')])[_0x04eb('0x85')](function(_0x2777fd){_0x1242ee[_0x2777fd['toLowerCase']()]=_0x109e0f[_0x04eb('0x83')][_0x2777fd];});}return _0x1242ee;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5bcdd96..dd3d270 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 _0xe7c6=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','number','queuepause','string','boolean','reload','voicequeuechannel'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xe7c6,0xcb));var _0x6e7c=function(_0x1636c6,_0x5968bd){_0x1636c6=_0x1636c6-0x0;var _0x5ee59e=_0xe7c6[_0x1636c6];return _0x5ee59e;};'use strict';exports[_0x6e7c('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x6e7c('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x6e7c('0x2')]={'interface':{'type':_0x6e7c('0x3'),'required':!![]},'paused':{'type':_0x6e7c('0x4')},'reason':{'type':_0x6e7c('0x3'),'required':![]}};exports[_0x6e7c('0x5')]={'module':{'type':_0x6e7c('0x3'),'required':![]}};exports[_0x6e7c('0x6')]={'uniqueid':{'type':_0x6e7c('0x3'),'required':!![]}};exports[_0x6e7c('0x7')]={'uniqueid':{'type':_0x6e7c('0x3'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x6e7c('0x3')}};exports[_0x6e7c('0x8')]={'uniqueid':{'type':_0x6e7c('0x3'),'required':!![]}};exports[_0x6e7c('0x9')]={'uniqueid':{'type':_0x6e7c('0x3'),'required':!![]},'exten':{'type':_0x6e7c('0x3'),'required':!![]},'context':{'type':_0x6e7c('0x3')}}; \ No newline at end of file +var _0xe092=['queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xe092,0x82));var _0x2e09=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xe092[_0x119280];return _0x481797;};'use strict';exports[_0x2e09('0x0')]={'queue':{'type':_0x2e09('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x2e09('0x1'),'required':!![]},'penalty':{'type':_0x2e09('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x2e09('0x3')]={'queue':{'type':_0x2e09('0x1'),'required':!![]},'interface':{'type':_0x2e09('0x1'),'required':!![]}};exports[_0x2e09('0x4')]={'interface':{'type':_0x2e09('0x1'),'required':!![]},'paused':{'type':_0x2e09('0x5')},'reason':{'type':_0x2e09('0x1'),'required':![]}};exports[_0x2e09('0x6')]={'module':{'type':_0x2e09('0x1'),'required':![]}};exports[_0x2e09('0x7')]={'uniqueid':{'type':_0x2e09('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2e09('0x1')},'format':{'type':_0x2e09('0x1')},'mixmonitorid':{'type':_0x2e09('0x1')}};exports[_0x2e09('0x8')]={'uniqueid':{'type':_0x2e09('0x1'),'required':!![]}};exports[_0x2e09('0x9')]={'uniqueid':{'type':_0x2e09('0x1'),'required':!![]},'exten':{'type':_0x2e09('0x1'),'required':!![]},'context':{'type':_0x2e09('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 28a7721..f31975f 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 _0x5f71=['../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumDuration','isEmpty','ivrTotalCallsDays','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','isUndefined','initTelephones','telephones','initTrunks','trunks','length','mergeFromDatabase','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','campaigns','dialQueueProject','initVoiceExtensions','exports','util','moment','../model/telephone','../model/template','../model/campaign'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0x5f71,0xc9));var _0x15f7=function(_0x35cfba,_0x1ef66e){_0x35cfba=_0x35cfba-0x0;var _0x2f9103=_0x5f71[_0x35cfba];return _0x2f9103;};'use strict';var util=require(_0x15f7('0x0'));var _=require('lodash');var moment=require(_0x15f7('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x15f7('0x2'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x15f7('0x3'));var Campaign=require(_0x15f7('0x4'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x15f7('0x5'));var SalesforceAccount=require(_0x15f7('0x6'));var FreshdeskAccount=require(_0x15f7('0x7'));var SugarcrmAccount=require(_0x15f7('0x8'));var ZohoAccount=require(_0x15f7('0x9'));var DeskAccount=require(_0x15f7('0xa'));var VtigerAccount=require(_0x15f7('0xb'));var ServicenowAccount=require(_0x15f7('0xc'));var Dynamics365Account=require(_0x15f7('0xd'));var FreshsalesAccount=require(_0x15f7('0xe'));var FaxAccount=require(_0x15f7('0xf'));var Realtime=function(){this[_0x15f7('0x10')]={};this['telephones']={};this['trunks']={};this[_0x15f7('0x11')]={};this[_0x15f7('0x12')]={};this['campaigns']={};this[_0x15f7('0x13')]={};this[_0x15f7('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x15f7('0x15')]={};this[_0x15f7('0x16')]={};this[_0x15f7('0x17')]={};this[_0x15f7('0x18')]={};this[_0x15f7('0x19')]={};this['settings']={};this[_0x15f7('0x1a')]={};this[_0x15f7('0x1b')]={};this[_0x15f7('0x1c')]={};this['freshdeskAccounts']={};this[_0x15f7('0x1d')]={};this[_0x15f7('0x1e')]={};this['vtigerAccounts']={};this[_0x15f7('0x1f')]={};this[_0x15f7('0x20')]={};this[_0x15f7('0x21')]={};this[_0x15f7('0x22')]={};};function freeIsNotKey(_0x345892,_0x2c0e67,_0x42928d){var _0x4b0d42=_[_0x15f7('0x23')](_0x345892,function(_0x385844,_0x4e61c9){return _0x385844[_0x42928d];});for(var _0x2c78ca in _0x2c0e67){if(_0x2c0e67[_0x15f7('0x24')](_0x2c78ca)){if(!_0x4b0d42[_0x2c78ca]){delete _0x2c0e67[_0x2c78ca];}}}}function freeIsNotKeySip(_0x2d4bc3,_0x40b752){var _0x26627b=_[_0x15f7('0x23')](_0x2d4bc3,function(_0x3ced97,_0x5d8f26){return util[_0x15f7('0x25')](_0x15f7('0x26'),_0x3ced97[_0x15f7('0x27')]);});for(var _0x422c6e in _0x40b752){if(_0x40b752[_0x15f7('0x24')](_0x422c6e)){if(!_0x26627b[_0x422c6e]){delete _0x40b752[_0x422c6e];}}}}function freeIsNotKeyAgent(_0x28a8a6,_0x3bf068){var _0x490d17=_['mapKeys'](_0x28a8a6,function(_0xa8c65a,_0x368ea9){var _0x370652=_[_0x15f7('0x28')](_0xa8c65a[_0x15f7('0x29')])?util['format'](_0x15f7('0x26'),_0xa8c65a['name']):_0xa8c65a[_0x15f7('0x29')];return _0x370652;});for(var _0xe6ec62 in _0x3bf068){if(_0x3bf068['hasOwnProperty'](_0xe6ec62)){if(!_0x490d17[_0xe6ec62]){delete _0x3bf068[_0xe6ec62];}}}}function clearVoiceCallReports(_0x523410){_0x523410[_0x15f7('0x2a')]=0x0;_0x523410['answered']=0x0;_0x523410['sumHoldTime']=0x0;_0x523410[_0x15f7('0x2b')]=0x0;_0x523410['sumBillable']=0x0;}function clearCampaigns(_0x3ba76f){if(!_[_0x15f7('0x2c')](_0x3ba76f)){for(var _0x64f9d9 in _0x3ba76f){if(_0x3ba76f[_0x15f7('0x24')](_0x64f9d9)){_0x3ba76f[_0x64f9d9][_0x15f7('0x2d')]=0x0;_0x3ba76f[_0x64f9d9]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3adf28){if(!_[_0x15f7('0x2c')](_0x3adf28)){for(var _0x1b50ed in _0x3adf28){if(_0x3adf28['hasOwnProperty'](_0x1b50ed)){_0x3adf28[_0x1b50ed]['total']=0x0;_0x3adf28[_0x1b50ed]['answered']=0x0;_0x3adf28[_0x1b50ed]['unmanaged']=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x2e')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x2f')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x2b')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x30')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x31')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x32')]=0x0;_0x3adf28[_0x1b50ed]['outboundBusyCallsDay']=0x0;_0x3adf28[_0x1b50ed]['outboundCongestionCallsDay']=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x33')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x34')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x35')]=0x0;_0x3adf28[_0x1b50ed]['outboundDropCallsDayCallersExit']=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x36')]=0x0;_0x3adf28[_0x1b50ed]['outboundOriginateFailureCallsDay']=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x37')]=0x0;_0x3adf28[_0x1b50ed]['outboundReCallsDay']=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x31')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x38')]=0x0;_0x3adf28[_0x1b50ed][_0x15f7('0x39')]=!![];}}}}Realtime[_0x15f7('0x3a')]['mergeFromDatabase']=function(_0x5c552e,_0x1cd151){for(var _0x346082 in _0x1cd151){if(_0x5c552e[_0x15f7('0x24')](_0x346082)){_0x5c552e[_0x346082]=_0x1cd151[_0x346082];}}};Realtime[_0x15f7('0x3a')][_0x15f7('0x3b')]=function(){var _0x23883f=this;return function(_0x2954cb){if(_0x2954cb){freeIsNotKeyAgent(_0x2954cb,_0x23883f[_0x15f7('0x10')]);for(var _0x3ebdfb=0x0,_0x4019ff={},_0x89637={};_0x3ebdfb<_0x2954cb['length'];_0x3ebdfb+=0x1){_0x4019ff=_0x2954cb[_0x3ebdfb];var _0x1c737c=_['isNil'](_0x4019ff[_0x15f7('0x29')])?util[_0x15f7('0x25')](_0x15f7('0x26'),_0x4019ff[_0x15f7('0x27')]):_0x4019ff[_0x15f7('0x29')];if(_[_0x15f7('0x3c')](_0x23883f['agents'][_0x1c737c])){_0x23883f[_0x15f7('0x10')][_0x1c737c]=new Agent(_0x4019ff);}else{_0x23883f['mergeFromDatabase'](_0x23883f[_0x15f7('0x10')][_0x1c737c],_0x4019ff);}}}return _0x23883f[_0x15f7('0x10')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x3d')]=function(){var _0x437f11=this;return function(_0x58f02d){if(_0x58f02d){freeIsNotKeySip(_0x58f02d,_0x437f11[_0x15f7('0x3e')]);for(var _0x4fd128=0x0,_0x4ee777={},_0xe958d9={};_0x4fd128<_0x58f02d['length'];_0x4fd128+=0x1){_0x4ee777=_0x58f02d[_0x4fd128];if(_[_0x15f7('0x3c')](_0x437f11[_0x15f7('0x3e')][util[_0x15f7('0x25')](_0x15f7('0x26'),_0x4ee777[_0x15f7('0x27')])])){_0x437f11[_0x15f7('0x3e')][util[_0x15f7('0x25')]('SIP/%s',_0x4ee777[_0x15f7('0x27')])]=new Telephone(_0x4ee777);}else{_0x437f11['mergeFromDatabase'](_0x437f11[_0x15f7('0x3e')][util[_0x15f7('0x25')]('SIP/%s',_0x4ee777['name'])],_0x4ee777);}}}return _0x437f11[_0x15f7('0x3e')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x3f')]=function(){var _0x712774=this;return function(_0x332e81){if(_0x332e81){freeIsNotKeySip(_0x332e81,_0x712774[_0x15f7('0x40')]);for(var _0x180345=0x0,_0x365fad={},_0x2a9b0f={};_0x180345<_0x332e81[_0x15f7('0x41')];_0x180345+=0x1){_0x365fad=_0x332e81[_0x180345];if(_[_0x15f7('0x3c')](_0x712774[_0x15f7('0x40')][util['format'](_0x15f7('0x26'),_0x365fad[_0x15f7('0x27')])])){_0x712774['trunks'][util[_0x15f7('0x25')](_0x15f7('0x26'),_0x365fad['name'])]=new Trunk(_0x365fad);}else{_0x712774[_0x15f7('0x42')](_0x712774[_0x15f7('0x40')][util[_0x15f7('0x25')]('SIP/%s',_0x365fad[_0x15f7('0x27')])],_0x365fad);}}}return _0x712774[_0x15f7('0x40')];};};Realtime[_0x15f7('0x3a')]['initVoiceQueues']=function(){var _0xc31ca7=this;return function(_0x58b724){if(_0x58b724){freeIsNotKey(_0x58b724,_0xc31ca7[_0x15f7('0x11')],_0x15f7('0x27'));for(var _0x52ae1e=0x0,_0x3a3feb={},_0xa3bc7e={};_0x52ae1e<_0x58b724[_0x15f7('0x41')];_0x52ae1e+=0x1){_0x3a3feb=_0x58b724[_0x52ae1e];if(_[_0x15f7('0x3c')](_0xc31ca7[_0x15f7('0x11')][_0x3a3feb[_0x15f7('0x27')]])){_0xc31ca7[_0x15f7('0x11')][_0x3a3feb[_0x15f7('0x27')]]=new VoiceQueue(_0x3a3feb);}else{_0xc31ca7[_0x15f7('0x42')](_0xc31ca7['voiceQueues'][_0x3a3feb[_0x15f7('0x27')]],_0x3a3feb);}}}return _0xc31ca7['voiceQueues'];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x43')]=function(){var _0x5bf39d=this;return function(_0x5aabc1){if(_0x5aabc1){freeIsNotKey(_0x5aabc1,_0x5bf39d[_0x15f7('0x12')],'id');for(var _0x2a7f3a=0x0,_0x328b0d={},_0x59a7eb={};_0x2a7f3a<_0x5aabc1[_0x15f7('0x41')];_0x2a7f3a+=0x1){_0x328b0d=_0x5aabc1[_0x2a7f3a];if(_[_0x15f7('0x3c')](_0x5bf39d[_0x15f7('0x12')][_0x328b0d['id']])){_0x5bf39d[_0x15f7('0x12')][_0x328b0d['id']]=new Trigger(_0x328b0d);}else{_0x5bf39d[_0x15f7('0x42')](_0x5bf39d[_0x15f7('0x12')][_0x328b0d['id']],_0x328b0d);}}}return _0x5bf39d['triggers'];};};Realtime['prototype'][_0x15f7('0x44')]=function(){var _0x48eeb4=this;return function(_0x31717c){if(_0x31717c){freeIsNotKey(_0x31717c,_0x48eeb4[_0x15f7('0x13')],'id');for(var _0x4d9e8f=0x0,_0x16fb3e={},_0x966be3={};_0x4d9e8f<_0x31717c[_0x15f7('0x41')];_0x4d9e8f+=0x1){_0x16fb3e=_0x31717c[_0x4d9e8f];if(_[_0x15f7('0x3c')](_0x48eeb4[_0x15f7('0x13')][_0x16fb3e['id']])){_0x48eeb4[_0x15f7('0x13')][_0x16fb3e['id']]=new Template(_0x16fb3e);}else{_0x48eeb4[_0x15f7('0x42')](_0x48eeb4['templates'][_0x16fb3e['id']],_0x16fb3e);}}}return _0x48eeb4[_0x15f7('0x13')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x45')]=function(){var _0x12a1d2=this;return function(_0x3aadac){if(_0x3aadac){freeIsNotKey(_0x3aadac,_0x12a1d2[_0x15f7('0x1a')],'id');for(var _0x27e5a8=0x0,_0x587f7f={},_0x2ccdc1={};_0x27e5a8<_0x3aadac[_0x15f7('0x41')];_0x27e5a8+=0x1){_0x587f7f=_0x3aadac[_0x27e5a8];if(_['isUndefined'](_0x12a1d2[_0x15f7('0x1a')][_0x587f7f['id']])){_0x12a1d2[_0x15f7('0x1a')][_0x587f7f['id']]=new ZendeskAccount(_0x587f7f);}else{_0x12a1d2[_0x15f7('0x42')](_0x12a1d2['zendeskAccounts'][_0x587f7f['id']],_0x587f7f);}}}return _0x12a1d2[_0x15f7('0x1a')];};};Realtime['prototype'][_0x15f7('0x46')]=function(){var _0x15b39d=this;return function(_0xc5443){if(_0xc5443){freeIsNotKey(_0xc5443,_0x15b39d['salesforceAccounts'],'id');for(var _0x45468f=0x0,_0x48d9b5={},_0x35ad5c={};_0x45468f<_0xc5443['length'];_0x45468f+=0x1){_0x48d9b5=_0xc5443[_0x45468f];if(_[_0x15f7('0x3c')](_0x15b39d[_0x15f7('0x1b')][_0x48d9b5['id']])){_0x15b39d[_0x15f7('0x1b')][_0x48d9b5['id']]=new SalesforceAccount(_0x48d9b5);}else{_0x15b39d[_0x15f7('0x42')](_0x15b39d[_0x15f7('0x1b')][_0x48d9b5['id']],_0x48d9b5);}}}return _0x15b39d['salesforceAccounts'];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x47')]=function(){var _0x4aa1e6=this;return function(_0x5a8ff7){if(_0x5a8ff7){freeIsNotKey(_0x5a8ff7,_0x4aa1e6['freshdeskAccounts'],'id');for(var _0xebbda4=0x0,_0x33b318={},_0x190857={};_0xebbda4<_0x5a8ff7['length'];_0xebbda4+=0x1){_0x33b318=_0x5a8ff7[_0xebbda4];if(_[_0x15f7('0x3c')](_0x4aa1e6[_0x15f7('0x48')][_0x33b318['id']])){_0x4aa1e6['freshdeskAccounts'][_0x33b318['id']]=new FreshdeskAccount(_0x33b318);}else{_0x4aa1e6[_0x15f7('0x42')](_0x4aa1e6[_0x15f7('0x48')][_0x33b318['id']],_0x33b318);}}}return _0x4aa1e6[_0x15f7('0x48')];};};Realtime[_0x15f7('0x3a')]['initZohoAccounts']=function(){var _0x30f6a0=this;return function(_0x363f8c){if(_0x363f8c){freeIsNotKey(_0x363f8c,_0x30f6a0[_0x15f7('0x1d')],'id');for(var _0x46e9de=0x0,_0x56ca14={},_0x6f2443={};_0x46e9de<_0x363f8c[_0x15f7('0x41')];_0x46e9de+=0x1){_0x56ca14=_0x363f8c[_0x46e9de];if(_[_0x15f7('0x3c')](_0x30f6a0[_0x15f7('0x1d')][_0x56ca14['id']])){_0x30f6a0['zohoAccounts'][_0x56ca14['id']]=new ZohoAccount(_0x56ca14);}else{_0x30f6a0['mergeFromDatabase'](_0x30f6a0[_0x15f7('0x1d')][_0x56ca14['id']],_0x56ca14);}}}return _0x30f6a0[_0x15f7('0x1d')];};};Realtime[_0x15f7('0x3a')]['initDeskAccounts']=function(){var _0x4c85ae=this;return function(_0x184030){if(_0x184030){freeIsNotKey(_0x184030,_0x4c85ae[_0x15f7('0x1e')],'id');for(var _0x9cedc1=0x0,_0x952456={},_0x4db8ea={};_0x9cedc1<_0x184030[_0x15f7('0x41')];_0x9cedc1+=0x1){_0x952456=_0x184030[_0x9cedc1];if(_[_0x15f7('0x3c')](_0x4c85ae[_0x15f7('0x1e')][_0x952456['id']])){_0x4c85ae[_0x15f7('0x1e')][_0x952456['id']]=new DeskAccount(_0x952456);}else{_0x4c85ae['mergeFromDatabase'](_0x4c85ae['deskAccounts'][_0x952456['id']],_0x952456);}}}return _0x4c85ae['deskAccounts'];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x49')]=function(){var _0x33e73b=this;return function(_0x160d30){if(_0x160d30){freeIsNotKey(_0x160d30,_0x33e73b[_0x15f7('0x1c')],'id');for(var _0x4b8894=0x0,_0x950833={},_0x3f05bf={};_0x4b8894<_0x160d30[_0x15f7('0x41')];_0x4b8894+=0x1){_0x950833=_0x160d30[_0x4b8894];if(_[_0x15f7('0x3c')](_0x33e73b[_0x15f7('0x1c')][_0x950833['id']])){_0x33e73b[_0x15f7('0x1c')][_0x950833['id']]=new SugarcrmAccount(_0x950833);}else{_0x33e73b[_0x15f7('0x42')](_0x33e73b['sugarcrmAccounts'][_0x950833['id']],_0x950833);}}}return _0x33e73b[_0x15f7('0x1c')];};};Realtime['prototype'][_0x15f7('0x4a')]=function(){var _0x18e25e=this;return function(_0x22f669){if(_0x22f669){freeIsNotKey(_0x22f669,_0x18e25e[_0x15f7('0x4b')],'id');for(var _0x45f945=0x0,_0x1cabc3={},_0x26e188={};_0x45f945<_0x22f669[_0x15f7('0x41')];_0x45f945+=0x1){_0x1cabc3=_0x22f669[_0x45f945];if(_['isUndefined'](_0x18e25e[_0x15f7('0x4b')][_0x1cabc3['id']])){_0x18e25e[_0x15f7('0x4b')][_0x1cabc3['id']]=new VtigerAccount(_0x1cabc3);}else{_0x18e25e['mergeFromDatabase'](_0x18e25e[_0x15f7('0x4b')][_0x1cabc3['id']],_0x1cabc3);}}}return _0x18e25e['vtigerAccounts'];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x4c')]=function(){var _0x111090=this;return function(_0xb20214){if(_0xb20214){freeIsNotKey(_0xb20214,_0x111090['servicenowAccounts'],'id');for(var _0x55c79a=0x0,_0x598086={},_0x21e727={};_0x55c79a<_0xb20214[_0x15f7('0x41')];_0x55c79a+=0x1){_0x598086=_0xb20214[_0x55c79a];if(_[_0x15f7('0x3c')](_0x111090[_0x15f7('0x1f')][_0x598086['id']])){_0x111090[_0x15f7('0x1f')][_0x598086['id']]=new ServicenowAccount(_0x598086);}else{_0x111090[_0x15f7('0x42')](_0x111090['servicenowAccounts'][_0x598086['id']],_0x598086);}}}return _0x111090['servicenowAccounts'];};};Realtime['prototype'][_0x15f7('0x4d')]=function(){var _0x3504dd=this;return function(_0x518c0a){if(_0x518c0a){freeIsNotKey(_0x518c0a,_0x3504dd[_0x15f7('0x20')],'id');for(var _0x31cd02=0x0,_0xd2a2e5={},_0x14fd45={};_0x31cd02<_0x518c0a[_0x15f7('0x41')];_0x31cd02+=0x1){_0xd2a2e5=_0x518c0a[_0x31cd02];if(_[_0x15f7('0x3c')](_0x3504dd['dynamics365Accounts'][_0xd2a2e5['id']])){_0x3504dd[_0x15f7('0x20')][_0xd2a2e5['id']]=new Dynamics365Account(_0xd2a2e5);}else{_0x3504dd[_0x15f7('0x42')](_0x3504dd['dynamics365Accounts'][_0xd2a2e5['id']],_0xd2a2e5);}}}return _0x3504dd[_0x15f7('0x20')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x4e')]=function(){var _0xdec028=this;return function(_0x4d808a){if(_0x4d808a){freeIsNotKey(_0x4d808a,_0xdec028[_0x15f7('0x21')],'id');for(var _0x4522d9=0x0,_0x29d280={},_0x1e9747={};_0x4522d9<_0x4d808a['length'];_0x4522d9+=0x1){_0x29d280=_0x4d808a[_0x4522d9];if(_[_0x15f7('0x3c')](_0xdec028[_0x15f7('0x21')][_0x29d280['id']])){_0xdec028[_0x15f7('0x21')][_0x29d280['id']]=new FreshsalesAccount(_0x29d280);}else{_0xdec028[_0x15f7('0x42')](_0xdec028[_0x15f7('0x21')][_0x29d280['id']],_0x29d280);}}}return _0xdec028[_0x15f7('0x21')];};};Realtime[_0x15f7('0x3a')]['initVoiceQueueHopperHistory']=function(){var _0x23a31c=this;return function(_0x342bc2){for(var _0x2a98f4=0x0;_0x2a98f4<_0x342bc2['length'];_0x2a98f4+=0x1){_[_0x15f7('0x4f')](_0x23a31c['voiceQueues'][_0x342bc2[_0x2a98f4]['name']],_0x342bc2[_0x2a98f4]);}return _0x23a31c[_0x15f7('0x11')];};};Realtime[_0x15f7('0x3a')]['initVoiceQueueReports']=function(){var _0x493d88=this;return function(_0x5418e9){clearVoiceQueues(_0x493d88[_0x15f7('0x11')]);if(_0x5418e9){_0x5418e9=_[_0x15f7('0x50')](_0x5418e9,_0x15f7('0x51'));for(var _0x17db6e in _0x5418e9){if(_0x5418e9[_0x15f7('0x24')](_0x17db6e)){var _0x4e2c26={};for(var _0x428a61=0x0;_0x428a61<_0x5418e9[_0x17db6e]['length'];_0x428a61+=0x1){var _0xdeacee=_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x52')];if(_0x493d88['voiceQueues'][_0xdeacee]){if(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x53')]){_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x54')]+=0x1;}if(_0x5418e9[_0x17db6e][_0x428a61]['queuecallerabandon']){_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x2e')]+=0x1;}_0x493d88['voiceQueues'][_0xdeacee]['sumHoldTime']+=moment(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x55')])['diff'](moment(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x56')]),_0x15f7('0x57'))||0x0;if(_0x428a61===_0x5418e9[_0x17db6e][_0x15f7('0x41')]-0x1){_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x2b')]+=moment(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x58')]||_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x59')]||_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x5a')])[_0x15f7('0x5b')](moment(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x56')]),_0x15f7('0x57'))||0x0;_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x2a')]+=0x1;if(_0x5418e9[_0x17db6e][_0x428a61][_0x15f7('0x5c')]){_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x5d')]+=0x1;_0x493d88[_0x15f7('0x11')][_0xdeacee][_0x15f7('0x30')]+=moment(_0x5418e9[_0x17db6e][_0x428a61]['queuecallercompleteAt'])[_0x15f7('0x5b')](moment(_0x5418e9[_0x17db6e][_0x428a61]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x493d88[_0x15f7('0x11')][_0xdeacee]['sumDuration']+=_0x493d88[_0x15f7('0x11')][_0xdeacee]['sumHoldTime']||0x0;}}}}}}return _0x493d88[_0x15f7('0x11')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x5e')]=function(){var _0x343f50=this;return function(_0x547b77){clearVoiceCallReports(_0x343f50[_0x15f7('0x14')]);if(_0x547b77){for(var _0x3241a3=0x0;_0x3241a3<_0x547b77[_0x15f7('0x41')];_0x3241a3+=0x1){_0x343f50[_0x15f7('0x14')][_0x15f7('0x2a')]+=0x1;_0x343f50[_0x15f7('0x14')][_0x15f7('0x2b')]+=_0x547b77[_0x3241a3][_0x15f7('0x5f')];if(_0x547b77[_0x3241a3][_0x15f7('0x60')]==='ANSWERED'){_0x343f50[_0x15f7('0x14')]['answered']+=0x1;_0x343f50[_0x15f7('0x14')]['sumHoldTime']+=_0x547b77[_0x3241a3][_0x15f7('0x5f')]-_0x547b77[_0x3241a3]['billableseconds']||0x0;_0x343f50[_0x15f7('0x14')][_0x15f7('0x30')]+=_0x547b77[_0x3241a3][_0x15f7('0x61')];}}}return _0x343f50['outbound'];};};Realtime['prototype'][_0x15f7('0x62')]=function(){var _0x260988=this;return function(_0x2e22eb){if(_0x2e22eb){freeIsNotKey(_0x2e22eb,_0x260988[_0x15f7('0x63')],_0x15f7('0x27'));for(var _0x399b03=0x0,_0x2d7369={};_0x399b03<_0x2e22eb['length'];_0x399b03+=0x1){_0x2d7369=_0x2e22eb[_0x399b03];if(_['isUndefined'](_0x260988[_0x15f7('0x63')][_0x2d7369[_0x15f7('0x27')]])){_0x260988[_0x15f7('0x63')][_0x2d7369[_0x15f7('0x27')]]=new Campaign(_0x2d7369);}else{_0x260988[_0x15f7('0x42')](_0x260988[_0x15f7('0x63')][_0x2d7369[_0x15f7('0x27')]],_0x2d7369);_0x260988['campaigns'][_0x2d7369[_0x15f7('0x27')]][_0x15f7('0x64')]=_0x2d7369['SquareProject']?_0x2d7369['SquareProject']['name']:undefined;}}}return _0x260988[_0x15f7('0x63')];};};Realtime[_0x15f7('0x3a')][_0x15f7('0x65')]=function(){var _0x22923b=this;return function(_0x2dc4e8){if(_0x2dc4e8){freeIsNotKey(_0x2dc4e8,_0x22923b[_0x15f7('0x15')],'id');for(var _0x2e5941=0x0,_0x12641e={};_0x2e5941<_0x2dc4e8[_0x15f7('0x41')];_0x2e5941+=0x1){_0x12641e=_0x2dc4e8[_0x2e5941];if(_[_0x15f7('0x3c')](_0x22923b[_0x15f7('0x15')][_0x12641e['id']])){_0x22923b['voiceExtensions'][_0x12641e['id']]=new VoiceExtension(_0x12641e);}else{_0x22923b[_0x15f7('0x42')](_0x22923b[_0x15f7('0x15')][_0x12641e['id']],_0x12641e);}}}return _0x22923b[_0x15f7('0x15')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1d7228=this;return function(_0x7f6873){clearCampaigns(_0x1d7228[_0x15f7('0x63')]);for(var _0x212f05=0x0;_0x212f05<_0x7f6873[_0x15f7('0x41')];_0x212f05+=0x1){_[_0x15f7('0x4f')](_0x1d7228[_0x15f7('0x63')][_0x7f6873[_0x212f05]['name']],_0x7f6873[_0x212f05]);}return _0x1d7228[_0x15f7('0x63')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x15ded6=this;return function(_0x5ec128){if(_0x5ec128){freeIsNotKey(_0x5ec128,_0x15ded6[_0x15f7('0x22')],'id');for(var _0x2ad0a4=0x0,_0x147a22={},_0x1ad52e={};_0x2ad0a4<_0x5ec128[_0x15f7('0x41')];_0x2ad0a4+=0x1){_0x147a22=_0x5ec128[_0x2ad0a4];if(_[_0x15f7('0x3c')](_0x15ded6[_0x15f7('0x22')][_0x147a22['id']])){_0x15ded6[_0x15f7('0x22')][_0x147a22['id']]=new FaxAccount(_0x147a22);}else{_0x15ded6[_0x15f7('0x42')](_0x15ded6[_0x15f7('0x22')][_0x147a22['id']],_0x147a22);}}}return _0x15ded6[_0x15f7('0x22')];};};module[_0x15f7('0x66')]=Realtime; \ No newline at end of file +var _0xfb8f=['../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','name','isNil','interface','format','total','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','hasOwnProperty','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','agents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfb8f,0x18c));var _0xffb8=function(_0x1aa68f,_0x374779){_0x1aa68f=_0x1aa68f-0x0;var _0x102acf=_0xfb8f[_0x1aa68f];return _0x102acf;};'use strict';var util=require('util');var _=require(_0xffb8('0x0'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xffb8('0x1'));var Trunk=require(_0xffb8('0x2'));var VoiceQueue=require(_0xffb8('0x3'));var Trigger=require(_0xffb8('0x4'));var Template=require(_0xffb8('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xffb8('0x6'));var ZendeskAccount=require(_0xffb8('0x7'));var SalesforceAccount=require(_0xffb8('0x8'));var FreshdeskAccount=require(_0xffb8('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xffb8('0xa'));var VtigerAccount=require(_0xffb8('0xb'));var ServicenowAccount=require(_0xffb8('0xc'));var Dynamics365Account=require(_0xffb8('0xd'));var FreshsalesAccount=require(_0xffb8('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xffb8('0xf')]={};this[_0xffb8('0x10')]={};this[_0xffb8('0x11')]={};this[_0xffb8('0x12')]={};this[_0xffb8('0x13')]={};this['templates']={};this[_0xffb8('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xffb8('0x15')]={};this[_0xffb8('0x16')]={};this[_0xffb8('0x17')]={};this[_0xffb8('0x18')]={};this['timers']={};this[_0xffb8('0x19')]={};this[_0xffb8('0x1a')]={};this[_0xffb8('0x1b')]={};this['sugarcrmAccounts']={};this[_0xffb8('0x1c')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xffb8('0x1d')]={};this[_0xffb8('0x1e')]={};this[_0xffb8('0x1f')]={};this[_0xffb8('0x20')]={};this[_0xffb8('0x21')]={};};function freeIsNotKey(_0x462d8e,_0x1f05ba,_0x37b219){var _0x1a310e=_['mapKeys'](_0x462d8e,function(_0x4c835f,_0x2b4e0f){return _0x4c835f[_0x37b219];});for(var _0x514cba in _0x1f05ba){if(_0x1f05ba['hasOwnProperty'](_0x514cba)){if(!_0x1a310e[_0x514cba]){delete _0x1f05ba[_0x514cba];}}}}function freeIsNotKeySip(_0x506284,_0x50754f){var _0x377463=_[_0xffb8('0x22')](_0x506284,function(_0x31f5c8,_0x6fe61a){return util['format'](_0xffb8('0x23'),_0x31f5c8[_0xffb8('0x24')]);});for(var _0x2c9e1c in _0x50754f){if(_0x50754f['hasOwnProperty'](_0x2c9e1c)){if(!_0x377463[_0x2c9e1c]){delete _0x50754f[_0x2c9e1c];}}}}function freeIsNotKeyAgent(_0x268066,_0x51d7fe){var _0x30d97d=_[_0xffb8('0x22')](_0x268066,function(_0x5216f0,_0x14be86){var _0x39785c=_[_0xffb8('0x25')](_0x5216f0[_0xffb8('0x26')])?util[_0xffb8('0x27')](_0xffb8('0x23'),_0x5216f0[_0xffb8('0x24')]):_0x5216f0['interface'];return _0x39785c;});for(var _0x297bc0 in _0x51d7fe){if(_0x51d7fe['hasOwnProperty'](_0x297bc0)){if(!_0x30d97d[_0x297bc0]){delete _0x51d7fe[_0x297bc0];}}}}function clearVoiceCallReports(_0x3994c5){_0x3994c5[_0xffb8('0x28')]=0x0;_0x3994c5['answered']=0x0;_0x3994c5['sumHoldTime']=0x0;_0x3994c5[_0xffb8('0x29')]=0x0;_0x3994c5[_0xffb8('0x2a')]=0x0;}function clearCampaigns(_0x4d85e1){if(!_[_0xffb8('0x2b')](_0x4d85e1)){for(var _0x457bfa in _0x4d85e1){if(_0x4d85e1['hasOwnProperty'](_0x457bfa)){_0x4d85e1[_0x457bfa][_0xffb8('0x2c')]=0x0;_0x4d85e1[_0x457bfa]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5eeba5){if(!_[_0xffb8('0x2b')](_0x5eeba5)){for(var _0x366f87 in _0x5eeba5){if(_0x5eeba5[_0xffb8('0x2d')](_0x366f87)){_0x5eeba5[_0x366f87]['total']=0x0;_0x5eeba5[_0x366f87]['answered']=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x2e')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x2f')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x30')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x29')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x2a')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x31')]=0x0;_0x5eeba5[_0x366f87]['outboundNoAnswerCallsDay']=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x32')]=0x0;_0x5eeba5[_0x366f87]['outboundCongestionCallsDay']=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x33')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x34')]=0x0;_0x5eeba5[_0x366f87]['outboundDropCallsDayTimeout']=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x35')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x36')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x37')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x38')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x39')]=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x31')]=0x0;_0x5eeba5[_0x366f87]['outboundAnswerCallsDay']=0x0;_0x5eeba5[_0x366f87][_0xffb8('0x3a')]=!![];}}}}Realtime[_0xffb8('0x3b')][_0xffb8('0x3c')]=function(_0x92e684,_0x37d179){for(var _0x380984 in _0x37d179){if(_0x92e684[_0xffb8('0x2d')](_0x380984)){_0x92e684[_0x380984]=_0x37d179[_0x380984];}}};Realtime[_0xffb8('0x3b')]['initAgents']=function(){var _0x5aa8a6=this;return function(_0x5abddf){if(_0x5abddf){freeIsNotKeyAgent(_0x5abddf,_0x5aa8a6[_0xffb8('0x3d')]);for(var _0x1ed7dd=0x0,_0x358e9c={},_0x4828e4={};_0x1ed7dd<_0x5abddf[_0xffb8('0x3e')];_0x1ed7dd+=0x1){_0x358e9c=_0x5abddf[_0x1ed7dd];var _0x1b9191=_['isNil'](_0x358e9c[_0xffb8('0x26')])?util[_0xffb8('0x27')]('SIP/%s',_0x358e9c['name']):_0x358e9c[_0xffb8('0x26')];if(_[_0xffb8('0x3f')](_0x5aa8a6['agents'][_0x1b9191])){_0x5aa8a6[_0xffb8('0x3d')][_0x1b9191]=new Agent(_0x358e9c);}else{_0x5aa8a6[_0xffb8('0x3c')](_0x5aa8a6['agents'][_0x1b9191],_0x358e9c);}}}return _0x5aa8a6[_0xffb8('0x3d')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x40')]=function(){var _0x1b65cb=this;return function(_0x1185ed){if(_0x1185ed){freeIsNotKeySip(_0x1185ed,_0x1b65cb[_0xffb8('0xf')]);for(var _0x265735=0x0,_0x4c854b={},_0x58254a={};_0x265735<_0x1185ed[_0xffb8('0x3e')];_0x265735+=0x1){_0x4c854b=_0x1185ed[_0x265735];if(_[_0xffb8('0x3f')](_0x1b65cb['telephones'][util['format'](_0xffb8('0x23'),_0x4c854b[_0xffb8('0x24')])])){_0x1b65cb['telephones'][util[_0xffb8('0x27')](_0xffb8('0x23'),_0x4c854b[_0xffb8('0x24')])]=new Telephone(_0x4c854b);}else{_0x1b65cb['mergeFromDatabase'](_0x1b65cb[_0xffb8('0xf')][util[_0xffb8('0x27')](_0xffb8('0x23'),_0x4c854b[_0xffb8('0x24')])],_0x4c854b);}}}return _0x1b65cb[_0xffb8('0xf')];};};Realtime['prototype'][_0xffb8('0x41')]=function(){var _0x3a0083=this;return function(_0x4604b1){if(_0x4604b1){freeIsNotKeySip(_0x4604b1,_0x3a0083[_0xffb8('0x10')]);for(var _0x55561=0x0,_0x2dc322={},_0x18e124={};_0x55561<_0x4604b1[_0xffb8('0x3e')];_0x55561+=0x1){_0x2dc322=_0x4604b1[_0x55561];if(_[_0xffb8('0x3f')](_0x3a0083[_0xffb8('0x10')][util[_0xffb8('0x27')](_0xffb8('0x23'),_0x2dc322[_0xffb8('0x24')])])){_0x3a0083[_0xffb8('0x10')][util[_0xffb8('0x27')](_0xffb8('0x23'),_0x2dc322[_0xffb8('0x24')])]=new Trunk(_0x2dc322);}else{_0x3a0083[_0xffb8('0x3c')](_0x3a0083[_0xffb8('0x10')][util[_0xffb8('0x27')]('SIP/%s',_0x2dc322[_0xffb8('0x24')])],_0x2dc322);}}}return _0x3a0083[_0xffb8('0x10')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x42')]=function(){var _0x5c9904=this;return function(_0x4ed750){if(_0x4ed750){freeIsNotKey(_0x4ed750,_0x5c9904[_0xffb8('0x11')],_0xffb8('0x24'));for(var _0x44759b=0x0,_0x1dc429={},_0x57c907={};_0x44759b<_0x4ed750[_0xffb8('0x3e')];_0x44759b+=0x1){_0x1dc429=_0x4ed750[_0x44759b];if(_['isUndefined'](_0x5c9904[_0xffb8('0x11')][_0x1dc429['name']])){_0x5c9904[_0xffb8('0x11')][_0x1dc429[_0xffb8('0x24')]]=new VoiceQueue(_0x1dc429);}else{_0x5c9904[_0xffb8('0x3c')](_0x5c9904[_0xffb8('0x11')][_0x1dc429['name']],_0x1dc429);}}}return _0x5c9904['voiceQueues'];};};Realtime['prototype'][_0xffb8('0x43')]=function(){var _0x5a8acc=this;return function(_0x16fcf4){if(_0x16fcf4){freeIsNotKey(_0x16fcf4,_0x5a8acc[_0xffb8('0x12')],'id');for(var _0x1f367e=0x0,_0x597dfd={},_0x3fa51c={};_0x1f367e<_0x16fcf4[_0xffb8('0x3e')];_0x1f367e+=0x1){_0x597dfd=_0x16fcf4[_0x1f367e];if(_[_0xffb8('0x3f')](_0x5a8acc[_0xffb8('0x12')][_0x597dfd['id']])){_0x5a8acc['triggers'][_0x597dfd['id']]=new Trigger(_0x597dfd);}else{_0x5a8acc['mergeFromDatabase'](_0x5a8acc['triggers'][_0x597dfd['id']],_0x597dfd);}}}return _0x5a8acc[_0xffb8('0x12')];};};Realtime[_0xffb8('0x3b')]['initTemplates']=function(){var _0x298b3d=this;return function(_0x47506a){if(_0x47506a){freeIsNotKey(_0x47506a,_0x298b3d[_0xffb8('0x44')],'id');for(var _0x35b40b=0x0,_0x41ac34={},_0x1c6505={};_0x35b40b<_0x47506a[_0xffb8('0x3e')];_0x35b40b+=0x1){_0x41ac34=_0x47506a[_0x35b40b];if(_['isUndefined'](_0x298b3d[_0xffb8('0x44')][_0x41ac34['id']])){_0x298b3d[_0xffb8('0x44')][_0x41ac34['id']]=new Template(_0x41ac34);}else{_0x298b3d['mergeFromDatabase'](_0x298b3d[_0xffb8('0x44')][_0x41ac34['id']],_0x41ac34);}}}return _0x298b3d[_0xffb8('0x44')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x45')]=function(){var _0x591dea=this;return function(_0x13ee53){if(_0x13ee53){freeIsNotKey(_0x13ee53,_0x591dea[_0xffb8('0x1a')],'id');for(var _0x46d7cd=0x0,_0x2c3b05={},_0x47048f={};_0x46d7cd<_0x13ee53[_0xffb8('0x3e')];_0x46d7cd+=0x1){_0x2c3b05=_0x13ee53[_0x46d7cd];if(_[_0xffb8('0x3f')](_0x591dea[_0xffb8('0x1a')][_0x2c3b05['id']])){_0x591dea[_0xffb8('0x1a')][_0x2c3b05['id']]=new ZendeskAccount(_0x2c3b05);}else{_0x591dea['mergeFromDatabase'](_0x591dea['zendeskAccounts'][_0x2c3b05['id']],_0x2c3b05);}}}return _0x591dea[_0xffb8('0x1a')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x46')]=function(){var _0x134eb9=this;return function(_0x3c6c28){if(_0x3c6c28){freeIsNotKey(_0x3c6c28,_0x134eb9['salesforceAccounts'],'id');for(var _0x3c08f8=0x0,_0xf261db={},_0xa4a501={};_0x3c08f8<_0x3c6c28[_0xffb8('0x3e')];_0x3c08f8+=0x1){_0xf261db=_0x3c6c28[_0x3c08f8];if(_[_0xffb8('0x3f')](_0x134eb9['salesforceAccounts'][_0xf261db['id']])){_0x134eb9[_0xffb8('0x1b')][_0xf261db['id']]=new SalesforceAccount(_0xf261db);}else{_0x134eb9[_0xffb8('0x3c')](_0x134eb9[_0xffb8('0x1b')][_0xf261db['id']],_0xf261db);}}}return _0x134eb9[_0xffb8('0x1b')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x47')]=function(){var _0x59e2ab=this;return function(_0x16e1c2){if(_0x16e1c2){freeIsNotKey(_0x16e1c2,_0x59e2ab[_0xffb8('0x1c')],'id');for(var _0x5efa2f=0x0,_0x557dda={},_0xe9d828={};_0x5efa2f<_0x16e1c2['length'];_0x5efa2f+=0x1){_0x557dda=_0x16e1c2[_0x5efa2f];if(_[_0xffb8('0x3f')](_0x59e2ab[_0xffb8('0x1c')][_0x557dda['id']])){_0x59e2ab[_0xffb8('0x1c')][_0x557dda['id']]=new FreshdeskAccount(_0x557dda);}else{_0x59e2ab['mergeFromDatabase'](_0x59e2ab['freshdeskAccounts'][_0x557dda['id']],_0x557dda);}}}return _0x59e2ab[_0xffb8('0x1c')];};};Realtime['prototype'][_0xffb8('0x48')]=function(){var _0x90ad5=this;return function(_0x43ec7a){if(_0x43ec7a){freeIsNotKey(_0x43ec7a,_0x90ad5[_0xffb8('0x49')],'id');for(var _0x41fb00=0x0,_0x2c6f0f={},_0x3c4f99={};_0x41fb00<_0x43ec7a[_0xffb8('0x3e')];_0x41fb00+=0x1){_0x2c6f0f=_0x43ec7a[_0x41fb00];if(_[_0xffb8('0x3f')](_0x90ad5[_0xffb8('0x49')][_0x2c6f0f['id']])){_0x90ad5[_0xffb8('0x49')][_0x2c6f0f['id']]=new ZohoAccount(_0x2c6f0f);}else{_0x90ad5['mergeFromDatabase'](_0x90ad5[_0xffb8('0x49')][_0x2c6f0f['id']],_0x2c6f0f);}}}return _0x90ad5[_0xffb8('0x49')];};};Realtime[_0xffb8('0x3b')]['initDeskAccounts']=function(){var _0x50fc91=this;return function(_0x1f3194){if(_0x1f3194){freeIsNotKey(_0x1f3194,_0x50fc91[_0xffb8('0x4a')],'id');for(var _0x220551=0x0,_0x181075={},_0x9efbd3={};_0x220551<_0x1f3194[_0xffb8('0x3e')];_0x220551+=0x1){_0x181075=_0x1f3194[_0x220551];if(_['isUndefined'](_0x50fc91['deskAccounts'][_0x181075['id']])){_0x50fc91[_0xffb8('0x4a')][_0x181075['id']]=new DeskAccount(_0x181075);}else{_0x50fc91['mergeFromDatabase'](_0x50fc91['deskAccounts'][_0x181075['id']],_0x181075);}}}return _0x50fc91[_0xffb8('0x4a')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x4b')]=function(){var _0x4ca1fb=this;return function(_0x2ef0e9){if(_0x2ef0e9){freeIsNotKey(_0x2ef0e9,_0x4ca1fb[_0xffb8('0x4c')],'id');for(var _0x4e1a93=0x0,_0x1068d5={},_0x1db70f={};_0x4e1a93<_0x2ef0e9[_0xffb8('0x3e')];_0x4e1a93+=0x1){_0x1068d5=_0x2ef0e9[_0x4e1a93];if(_[_0xffb8('0x3f')](_0x4ca1fb[_0xffb8('0x4c')][_0x1068d5['id']])){_0x4ca1fb[_0xffb8('0x4c')][_0x1068d5['id']]=new SugarcrmAccount(_0x1068d5);}else{_0x4ca1fb[_0xffb8('0x3c')](_0x4ca1fb[_0xffb8('0x4c')][_0x1068d5['id']],_0x1068d5);}}}return _0x4ca1fb[_0xffb8('0x4c')];};};Realtime[_0xffb8('0x3b')]['initVtigerAccounts']=function(){var _0x19d0de=this;return function(_0x3de139){if(_0x3de139){freeIsNotKey(_0x3de139,_0x19d0de[_0xffb8('0x1d')],'id');for(var _0x4d1b3b=0x0,_0xf82b44={},_0x211f9a={};_0x4d1b3b<_0x3de139[_0xffb8('0x3e')];_0x4d1b3b+=0x1){_0xf82b44=_0x3de139[_0x4d1b3b];if(_['isUndefined'](_0x19d0de[_0xffb8('0x1d')][_0xf82b44['id']])){_0x19d0de[_0xffb8('0x1d')][_0xf82b44['id']]=new VtigerAccount(_0xf82b44);}else{_0x19d0de['mergeFromDatabase'](_0x19d0de[_0xffb8('0x1d')][_0xf82b44['id']],_0xf82b44);}}}return _0x19d0de[_0xffb8('0x1d')];};};Realtime['prototype'][_0xffb8('0x4d')]=function(){var _0x1a6a5f=this;return function(_0x39c74a){if(_0x39c74a){freeIsNotKey(_0x39c74a,_0x1a6a5f[_0xffb8('0x1e')],'id');for(var _0x1b7f8f=0x0,_0x43a9a2={},_0x41f424={};_0x1b7f8f<_0x39c74a[_0xffb8('0x3e')];_0x1b7f8f+=0x1){_0x43a9a2=_0x39c74a[_0x1b7f8f];if(_['isUndefined'](_0x1a6a5f[_0xffb8('0x1e')][_0x43a9a2['id']])){_0x1a6a5f['servicenowAccounts'][_0x43a9a2['id']]=new ServicenowAccount(_0x43a9a2);}else{_0x1a6a5f[_0xffb8('0x3c')](_0x1a6a5f[_0xffb8('0x1e')][_0x43a9a2['id']],_0x43a9a2);}}}return _0x1a6a5f['servicenowAccounts'];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x4e')]=function(){var _0x16a847=this;return function(_0x52ebb0){if(_0x52ebb0){freeIsNotKey(_0x52ebb0,_0x16a847[_0xffb8('0x1f')],'id');for(var _0x35d90b=0x0,_0x261fd6={},_0xd0babc={};_0x35d90b<_0x52ebb0[_0xffb8('0x3e')];_0x35d90b+=0x1){_0x261fd6=_0x52ebb0[_0x35d90b];if(_[_0xffb8('0x3f')](_0x16a847[_0xffb8('0x1f')][_0x261fd6['id']])){_0x16a847['dynamics365Accounts'][_0x261fd6['id']]=new Dynamics365Account(_0x261fd6);}else{_0x16a847[_0xffb8('0x3c')](_0x16a847[_0xffb8('0x1f')][_0x261fd6['id']],_0x261fd6);}}}return _0x16a847[_0xffb8('0x1f')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x4f')]=function(){var _0x174ab0=this;return function(_0x5b1cfb){if(_0x5b1cfb){freeIsNotKey(_0x5b1cfb,_0x174ab0[_0xffb8('0x20')],'id');for(var _0x31c627=0x0,_0x5f503a={},_0x17e388={};_0x31c627<_0x5b1cfb['length'];_0x31c627+=0x1){_0x5f503a=_0x5b1cfb[_0x31c627];if(_[_0xffb8('0x3f')](_0x174ab0[_0xffb8('0x20')][_0x5f503a['id']])){_0x174ab0[_0xffb8('0x20')][_0x5f503a['id']]=new FreshsalesAccount(_0x5f503a);}else{_0x174ab0[_0xffb8('0x3c')](_0x174ab0[_0xffb8('0x20')][_0x5f503a['id']],_0x5f503a);}}}return _0x174ab0['freshsalesAccounts'];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x50')]=function(){var _0x54fcc5=this;return function(_0x55339d){for(var _0x4336e1=0x0;_0x4336e1<_0x55339d[_0xffb8('0x3e')];_0x4336e1+=0x1){_['merge'](_0x54fcc5[_0xffb8('0x11')][_0x55339d[_0x4336e1]['name']],_0x55339d[_0x4336e1]);}return _0x54fcc5['voiceQueues'];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x51')]=function(){var _0x26ad47=this;return function(_0x12b7f4){clearVoiceQueues(_0x26ad47['voiceQueues']);if(_0x12b7f4){_0x12b7f4=_['groupBy'](_0x12b7f4,_0xffb8('0x52'));for(var _0x1b82bd in _0x12b7f4){if(_0x12b7f4['hasOwnProperty'](_0x1b82bd)){var _0x58e201={};for(var _0x235b74=0x0;_0x235b74<_0x12b7f4[_0x1b82bd][_0xffb8('0x3e')];_0x235b74+=0x1){var _0x18bd3a=_0x12b7f4[_0x1b82bd][_0x235b74]['queue'];if(_0x26ad47['voiceQueues'][_0x18bd3a]){if(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x53')]){_0x26ad47['voiceQueues'][_0x18bd3a][_0xffb8('0x2e')]+=0x1;}if(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x54')]){_0x26ad47[_0xffb8('0x11')][_0x18bd3a][_0xffb8('0x2f')]+=0x1;}_0x26ad47['voiceQueues'][_0x18bd3a]['sumHoldTime']+=moment(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x55')])[_0xffb8('0x56')](moment(_0x12b7f4[_0x1b82bd][_0x235b74]['queuecallerjoinAt']),'seconds')||0x0;if(_0x235b74===_0x12b7f4[_0x1b82bd][_0xffb8('0x3e')]-0x1){_0x26ad47[_0xffb8('0x11')][_0x18bd3a][_0xffb8('0x29')]+=moment(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x57')]||_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x58')]||_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x59')])['diff'](moment(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x5a')]),'seconds')||0x0;_0x26ad47['voiceQueues'][_0x18bd3a][_0xffb8('0x28')]+=0x1;if(_0x12b7f4[_0x1b82bd][_0x235b74]['queuecallercomplete']){_0x26ad47['voiceQueues'][_0x18bd3a][_0xffb8('0x5b')]+=0x1;_0x26ad47[_0xffb8('0x11')][_0x18bd3a][_0xffb8('0x2a')]+=moment(_0x12b7f4[_0x1b82bd][_0x235b74][_0xffb8('0x57')])[_0xffb8('0x56')](moment(_0x12b7f4[_0x1b82bd][_0x235b74]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x26ad47[_0xffb8('0x11')][_0x18bd3a]['sumDuration']+=_0x26ad47['voiceQueues'][_0x18bd3a][_0xffb8('0x30')]||0x0;}}}}}}return _0x26ad47[_0xffb8('0x11')];};};Realtime['prototype'][_0xffb8('0x5c')]=function(){var _0x4f1128=this;return function(_0xc71747){clearVoiceCallReports(_0x4f1128[_0xffb8('0x14')]);if(_0xc71747){for(var _0x4f5a94=0x0;_0x4f5a94<_0xc71747[_0xffb8('0x3e')];_0x4f5a94+=0x1){_0x4f1128['outbound'][_0xffb8('0x28')]+=0x1;_0x4f1128[_0xffb8('0x14')][_0xffb8('0x29')]+=_0xc71747[_0x4f5a94][_0xffb8('0x5d')];if(_0xc71747[_0x4f5a94][_0xffb8('0x5e')]===_0xffb8('0x5f')){_0x4f1128[_0xffb8('0x14')][_0xffb8('0x5b')]+=0x1;_0x4f1128[_0xffb8('0x14')][_0xffb8('0x30')]+=_0xc71747[_0x4f5a94][_0xffb8('0x5d')]-_0xc71747[_0x4f5a94][_0xffb8('0x60')]||0x0;_0x4f1128[_0xffb8('0x14')]['sumBillable']+=_0xc71747[_0x4f5a94][_0xffb8('0x60')];}}}return _0x4f1128[_0xffb8('0x14')];};};Realtime[_0xffb8('0x3b')]['initCampaigns']=function(){var _0x48bc5b=this;return function(_0x28a5b3){if(_0x28a5b3){freeIsNotKey(_0x28a5b3,_0x48bc5b[_0xffb8('0x13')],_0xffb8('0x24'));for(var _0x2b29b6=0x0,_0x179849={};_0x2b29b6<_0x28a5b3['length'];_0x2b29b6+=0x1){_0x179849=_0x28a5b3[_0x2b29b6];if(_[_0xffb8('0x3f')](_0x48bc5b[_0xffb8('0x13')][_0x179849[_0xffb8('0x24')]])){_0x48bc5b[_0xffb8('0x13')][_0x179849[_0xffb8('0x24')]]=new Campaign(_0x179849);}else{_0x48bc5b[_0xffb8('0x3c')](_0x48bc5b[_0xffb8('0x13')][_0x179849[_0xffb8('0x24')]],_0x179849);_0x48bc5b['campaigns'][_0x179849[_0xffb8('0x24')]][_0xffb8('0x61')]=_0x179849[_0xffb8('0x62')]?_0x179849[_0xffb8('0x62')][_0xffb8('0x24')]:undefined;}}}return _0x48bc5b[_0xffb8('0x13')];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x63')]=function(){var _0x115ca2=this;return function(_0x96c96e){if(_0x96c96e){freeIsNotKey(_0x96c96e,_0x115ca2[_0xffb8('0x15')],'id');for(var _0x52e5b8=0x0,_0x323277={};_0x52e5b8<_0x96c96e[_0xffb8('0x3e')];_0x52e5b8+=0x1){_0x323277=_0x96c96e[_0x52e5b8];if(_[_0xffb8('0x3f')](_0x115ca2['voiceExtensions'][_0x323277['id']])){_0x115ca2[_0xffb8('0x15')][_0x323277['id']]=new VoiceExtension(_0x323277);}else{_0x115ca2['mergeFromDatabase'](_0x115ca2[_0xffb8('0x15')][_0x323277['id']],_0x323277);}}}return _0x115ca2['voiceExtensions'];};};Realtime[_0xffb8('0x3b')][_0xffb8('0x64')]=function(){var _0x17fe8f=this;return function(_0xc5fca2){clearCampaigns(_0x17fe8f[_0xffb8('0x13')]);for(var _0x2766cf=0x0;_0x2766cf<_0xc5fca2[_0xffb8('0x3e')];_0x2766cf+=0x1){_['merge'](_0x17fe8f[_0xffb8('0x13')][_0xc5fca2[_0x2766cf]['name']],_0xc5fca2[_0x2766cf]);}return _0x17fe8f[_0xffb8('0x13')];};};Realtime[_0xffb8('0x3b')]['initFaxAccounts']=function(){var _0x3662e4=this;return function(_0x205162){if(_0x205162){freeIsNotKey(_0x205162,_0x3662e4['faxAccounts'],'id');for(var _0x480b32=0x0,_0x39b871={},_0x587a24={};_0x480b32<_0x205162[_0xffb8('0x3e')];_0x480b32+=0x1){_0x39b871=_0x205162[_0x480b32];if(_[_0xffb8('0x3f')](_0x3662e4[_0xffb8('0x21')][_0x39b871['id']])){_0x3662e4[_0xffb8('0x21')][_0x39b871['id']]=new FaxAccount(_0x39b871);}else{_0x3662e4['mergeFromDatabase'](_0x3662e4[_0xffb8('0x21')][_0x39b871['id']],_0x39b871);}}}return _0x3662e4[_0xffb8('0x21')];};};module[_0xffb8('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e6125c2..a1e9cb9 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 _0x39c3=['name','isNil','interface','format','SIP/%s','connectedlinenum','accountcode','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','prototype','getAgentByInternal','length','keys','getCallType','channel','split','outbound','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','disposition','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','startsWith','indexOf','mobile','phone','substring','lastIndexOf','voiceDialReport','transfererlinkedid','exports','lodash','moment','util','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find'];(function(_0x2c6598,_0x1bf90a){var _0x5588df=function(_0x1ea8f6){while(--_0x1ea8f6){_0x2c6598['push'](_0x2c6598['shift']());}};_0x5588df(++_0x1bf90a);}(_0x39c3,0x97));var _0x339c=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x39c3[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0x339c('0x0'));var moment=require(_0x339c('0x1'));var util=require(_0x339c('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x339c('0x3'));var RpcMemberReport=require(_0x339c('0x4'));var RpcVoiceQueueReport=require(_0x339c('0x5'));var RpcVoiceRecording=require(_0x339c('0x6'));var RpcVoiceTransferReport=require(_0x339c('0x7'));var VoiceQueueReport=require(_0x339c('0x8'));var VoiceCallReport=require(_0x339c('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x339c('0xa'));function Report(_0x1d1566){this[_0x339c('0xb')]=_0x1d1566;this['agents']=_0x1d1566[_0x339c('0xc')];this[_0x339c('0xd')]=_0x1d1566['telephones'];}Report['prototype']['sync']=function(_0x3efed2){var _0x21ab86=new VoiceQueueReport(this[_0x339c('0xb')]);var _0x24948f=new VoiceAgentReport(this[_0x339c('0xb')]);var _0x1744f4=new VoiceDialReport(this['realtime']);var _0x5b3e00=new VoiceCallReport(this[_0x339c('0xb')]);var _0x4f12f0=new UserReport(this[_0x339c('0xb')]);if(config[_0x339c('0xe')]&&config[_0x339c('0xe')]['disabled']){ami['on'](_0x339c('0xf'),this[_0x339c('0x10')]['bind'](this));ami['on'](_0x339c('0x11'),this[_0x339c('0x12')][_0x339c('0x13')](this));ami['on'](_0x339c('0x14'),this[_0x339c('0x15')][_0x339c('0x13')](this));ami['on'](_0x339c('0x16'),this['voiceDialReport'][_0x339c('0x13')](this));ami['on'](_0x339c('0x17'),this[_0x339c('0x18')][_0x339c('0x13')](this));ami['on'](_0x339c('0x19'),this[_0x339c('0x1a')][_0x339c('0x13')](this));}};Report['prototype'][_0x339c('0x1b')]=function(_0x10b276){var _0x3fae86;_0x3fae86=_[_0x339c('0x1c')](this[_0x339c('0xc')],function(_0x57ac31){return _0x57ac31['accountcode']==_0x10b276||_0x57ac31[_0x339c('0x1d')]==_0x10b276;});if(_[_0x339c('0x1e')](_0x3fae86)){var _0xd6150a=_[_0x339c('0x1c')](this[_0x339c('0xd')],function(_0x5cc2d2){return _0x5cc2d2['accountcode']==_0x10b276||_0x5cc2d2[_0x339c('0x1d')]==_0x10b276;});if(_0xd6150a){_0x3fae86=_[_0x339c('0x1c')](this['agents'],function(_0x599ea9){return _0x599ea9[_0x339c('0x1f')]==util[_0x339c('0x20')](_0x339c('0x21'),_0xd6150a['name']);});}}return _0x3fae86;};Report['prototype'][_0x339c('0x10')]=function(_0x3d5b0d){for(var _0x14779c=0x0;_0x14779c<_0x3d5b0d['length'];_0x14779c+=0x1){var _0x49dc5d=this['findAgent'](_0x3d5b0d[_0x14779c][_0x339c('0x22')]);if(_0x49dc5d){_0x3d5b0d[_0x14779c][_0x339c('0x23')]=_0x49dc5d[_0x339c('0x23')];_0x3d5b0d[_0x14779c][_0x339c('0x24')]=!![];_0x3d5b0d[_0x14779c][_0x339c('0x25')]=_0x49dc5d['name'];_0x3d5b0d[_0x14779c][_0x339c('0x1f')]=_[_0x339c('0x1e')](_0x49dc5d[_0x339c('0x1f')])?util[_0x339c('0x20')]('SIP/%s',_0x49dc5d[_0x339c('0x1d')]):_0x49dc5d[_0x339c('0x1f')];if(_0x3d5b0d[_0x14779c][_0x339c('0x26')]){_0x3d5b0d[_0x14779c][_0x339c('0x27')]=moment()[_0x339c('0x20')](_0x339c('0x28'));}if(_0x3d5b0d[_0x14779c]['queuecallerexit']){_0x3d5b0d[_0x14779c]['queuecallerexitAt']=moment()[_0x339c('0x20')](_0x339c('0x28'));}RpcMemberReport['voiceQueueReport'](_0x3d5b0d[_0x14779c]);}RpcVoiceQueueReport[_0x339c('0x29')](_0x3d5b0d[_0x14779c]);}};function extractCalleridNumber(_0x3052da){var _0x2568e7=_0x3052da['match'](/<(.*?)>/);return _0x2568e7?_0x2568e7[0x1]:_0x3052da;}Report[_0x339c('0x2a')][_0x339c('0x2b')]=function(_0x422cf0){for(var _0x53b510=0x0;_0x53b510',_0xfa7909[_0x339c('0x42')],_0xfa7909[_0x339c('0x3d')]);}if(RpcVoiceTransferReport['transfers'][_0xfa7909[_0x339c('0x43')]]){var _0x174a63=RpcVoiceTransferReport[_0x339c('0x44')][_0xfa7909[_0x339c('0x43')]];_0x174a63[_0x339c('0x45')]=_0xfa7909[_0x339c('0x46')];RpcVoiceTransferReport[_0x339c('0x18')](_0x174a63);delete RpcVoiceTransferReport[_0x339c('0x44')][_0xfa7909[_0x339c('0x43')]];}if(_[_0x339c('0x1e')](_0xfa7909[_0x339c('0x47')])){_0xfa7909[_0x339c('0x47')]=this['getCallType'](_0xfa7909);}if(_[_0x339c('0x1e')](_0xfa7909[_0x339c('0x48')])){var _0xffa70a=_0xfa7909[_0x339c('0x2f')]['split']('-')[0x0];var _0x128fb9=this[_0x339c('0xc')][_0xffa70a];if(!_0x128fb9)_0x128fb9=this[_0x339c('0x2b')](_0xfa7909[_0x339c('0x23')]);if(_0x128fb9){_0xfa7909[_0x339c('0x48')]=_0x128fb9['id'];_0xfa7909[_0x339c('0x49')]=_0x128fb9[_0x339c('0x1d')];}}RpcVoiceCallReport[_0x339c('0x29')](_0xfa7909);if(_0xfa7909[_0x339c('0x4a')]){for(var _0x3204e5=0x0;_0x3204e5<_0xfa7909[_0x339c('0x4b')]['length'];_0x3204e5+=0x1){_0xfa7909[_0x339c('0x4c')]=_0xfa7909[_0x339c('0x4b')][_0x3204e5]['filename'];_0xfa7909['createdAt']=_0xfa7909[_0x339c('0x4b')][_0x3204e5][_0x339c('0x4d')];if(_0xfa7909[_0x339c('0x33')]=='xcally-motion-preview'){_0xfa7909[_0x339c('0x3d')]=_0xfa7909[_0x339c('0x22')];_0xfa7909['calleridname']=_0xfa7909['connectedlinename'];_0xfa7909[_0x339c('0x22')]=_0xfa7909['accountcode'];_0xfa7909[_0x339c('0x4e')]=_0xfa7909[_0x339c('0x49')];_0xfa7909['exten']=_0xfa7909[_0x339c('0x3e')];}else if(_0xfa7909[_0x339c('0x33')]==_0x339c('0x4f')){_0xfa7909['calleridnum']=_0xfa7909['destination'];_0xfa7909[_0x339c('0x33')]=_0xfa7909[_0x339c('0x3e')];}RpcVoiceRecording[_0x339c('0x29')](_0xfa7909);}}};Report[_0x339c('0x2a')][_0x339c('0x15')]=function(_0x3a832f){if(_[_0x339c('0x50')](_0x3a832f)){_0x3a832f['forEach'](function(_0x3fa805){RpcVoiceAgentReport[_0x339c('0x29')](_0x3fa805);});}else{RpcVoiceAgentReport[_0x339c('0x29')](_0x3a832f);}};Report[_0x339c('0x2a')]['voiceDialReport']=function(_0x3cc514){RpcVoiceDialReport[_0x339c('0x29')](_0x3cc514);var _0x483a84;var _0xe91d48;var _0x5b857a=_0x3cc514[_0x339c('0x2f')];if(_[_0x339c('0x51')](_0x5b857a,'Local')){_0xe91d48=_0x5b857a['substring'](_0x5b857a[_0x339c('0x52')]('/')+0x1,_0x5b857a[_0x339c('0x52')]('@'));_0x483a84=_['find'](this[_0x339c('0xc')],function(_0x1dc093){return _0x1dc093[_0x339c('0x53')]==_0xe91d48||_0x1dc093[_0x339c('0x54')]==_0xe91d48||_0x1dc093[_0x339c('0x23')]==_0xe91d48;});}else{_0xe91d48=_0x5b857a[_0x339c('0x55')](_0x5b857a[_0x339c('0x52')]('/')+0x1,_0x5b857a[_0x339c('0x56')]('-'));_0x483a84=this[_0x339c('0x1b')](_0xe91d48);}if(_0x483a84){_0x3cc514[_0x339c('0x1f')]=_[_0x339c('0x1e')](_0x483a84[_0x339c('0x1f')])?util[_0x339c('0x20')](_0x339c('0x21'),_0x483a84[_0x339c('0x1d')]):_0x483a84['interface'];_0x3cc514[_0x339c('0x49')]=_0x483a84[_0x339c('0x1d')];_0x3cc514['accountcode']=_0x483a84[_0x339c('0x23')];RpcMemberReport[_0x339c('0x57')](_0x3cc514);}};Report['prototype'][_0x339c('0x18')]=function(_0x4c33f1){RpcVoiceTransferReport['transfers'][_0x4c33f1[_0x339c('0x58')]]=_0x4c33f1;};Report[_0x339c('0x2a')][_0x339c('0x1a')]=function(_0x4bd3cc){RpcVoiceTransferReport['attendedTransfer'](_0x4bd3cc);};module[_0x339c('0x59')]=Report; \ No newline at end of file +var _0xdff3=['lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','uniqueid','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','isNil','name','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','format','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue'];(function(_0x159f5c,_0x2e3c7a){var _0x412b3d=function(_0x309df7){while(--_0x309df7){_0x159f5c['push'](_0x159f5c['shift']());}};_0x412b3d(++_0x2e3c7a);}(_0xdff3,0x7f));var _0x3dff=function(_0x5ac2b7,_0x18e84b){_0x5ac2b7=_0x5ac2b7-0x0;var _0x4f22a7=_0xdff3[_0x5ac2b7];return _0x4f22a7;};'use strict';var _=require(_0x3dff('0x0'));var moment=require(_0x3dff('0x1'));var util=require(_0x3dff('0x2'));var config=require(_0x3dff('0x3'));var ami=require(_0x3dff('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x3dff('0x5'));var RpcVoiceDialReport=require(_0x3dff('0x6'));var RpcMemberReport=require(_0x3dff('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x3dff('0x8'));var RpcVoiceTransferReport=require(_0x3dff('0x9'));var VoiceQueueReport=require(_0x3dff('0xa'));var VoiceCallReport=require(_0x3dff('0xb'));var VoiceAgentReport=require(_0x3dff('0xc'));var VoiceDialReport=require(_0x3dff('0xd'));var UserReport=require(_0x3dff('0xe'));function Report(_0x5e88d6){this[_0x3dff('0xf')]=_0x5e88d6;this[_0x3dff('0x10')]=_0x5e88d6['agents'];this[_0x3dff('0x11')]=_0x5e88d6[_0x3dff('0x11')];}Report['prototype']['sync']=function(_0x152c40){var _0x5db746=new VoiceQueueReport(this['realtime']);var _0x4d1cdd=new VoiceAgentReport(this[_0x3dff('0xf')]);var _0x7c676c=new VoiceDialReport(this['realtime']);var _0x3cf4b7=new VoiceCallReport(this['realtime']);var _0x5d62f2=new UserReport(this[_0x3dff('0xf')]);if(config['xdr']&&config[_0x3dff('0x12')][_0x3dff('0x13')]){ami['on'](_0x3dff('0x14'),this[_0x3dff('0x15')][_0x3dff('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x3dff('0x17')][_0x3dff('0x16')](this));ami['on'](_0x3dff('0x18'),this[_0x3dff('0x19')][_0x3dff('0x16')](this));ami['on']('custom:voiceDialReport',this[_0x3dff('0x1a')][_0x3dff('0x16')](this));ami['on']('blindtransfer',this[_0x3dff('0x1b')]['bind'](this));ami['on'](_0x3dff('0x1c'),this['attendedTransfer'][_0x3dff('0x16')](this));}};Report[_0x3dff('0x1d')][_0x3dff('0x1e')]=function(_0x5b31ea){var _0x1852c9;_0x1852c9=_[_0x3dff('0x1f')](this[_0x3dff('0x10')],function(_0xcbdad6){return _0xcbdad6[_0x3dff('0x20')]==_0x5b31ea||_0xcbdad6['name']==_0x5b31ea;});if(_[_0x3dff('0x21')](_0x1852c9)){var _0x266a87=_[_0x3dff('0x1f')](this['telephones'],function(_0x1474fe){return _0x1474fe['accountcode']==_0x5b31ea||_0x1474fe[_0x3dff('0x22')]==_0x5b31ea;});if(_0x266a87){_0x1852c9=_[_0x3dff('0x1f')](this[_0x3dff('0x10')],function(_0xaabf12){return _0xaabf12['interface']==util['format'](_0x3dff('0x23'),_0x266a87['name']);});}}return _0x1852c9;};Report[_0x3dff('0x1d')][_0x3dff('0x15')]=function(_0x39317d){for(var _0xc57356=0x0;_0xc57356<_0x39317d[_0x3dff('0x24')];_0xc57356+=0x1){var _0x3d0792=this[_0x3dff('0x1e')](_0x39317d[_0xc57356][_0x3dff('0x25')]);if(_0x3d0792){_0x39317d[_0xc57356][_0x3dff('0x20')]=_0x3d0792[_0x3dff('0x20')];_0x39317d[_0xc57356]['assigned']=!![];_0x39317d[_0xc57356][_0x3dff('0x26')]=_0x3d0792['name'];_0x39317d[_0xc57356]['interface']=_[_0x3dff('0x21')](_0x3d0792[_0x3dff('0x27')])?util[_0x3dff('0x28')]('SIP/%s',_0x3d0792[_0x3dff('0x22')]):_0x3d0792[_0x3dff('0x27')];if(_0x39317d[_0xc57356]['queuecallercomplete']){_0x39317d[_0xc57356][_0x3dff('0x29')]=moment()[_0x3dff('0x28')](_0x3dff('0x2a'));}if(_0x39317d[_0xc57356]['queuecallerexit']){_0x39317d[_0xc57356]['queuecallerexitAt']=moment()[_0x3dff('0x28')](_0x3dff('0x2a'));}RpcMemberReport[_0x3dff('0x15')](_0x39317d[_0xc57356]);}RpcVoiceQueueReport[_0x3dff('0x2b')](_0x39317d[_0xc57356]);}};function extractCalleridNumber(_0x201c71){var _0x46f3d0=_0x201c71[_0x3dff('0x2c')](/<(.*?)>/);return _0x46f3d0?_0x46f3d0[0x1]:_0x201c71;}Report[_0x3dff('0x1d')][_0x3dff('0x2d')]=function(_0x785973){for(var _0x1d9e7d=0x0;_0x1d9e7d0x0?_0x443087:0x0;this['voiceQueues'][_0x5ab7d9[_0x034b('0x64')]][_0x034b('0x2d')]=this[_0x034b('0x12')][_0x5ab7d9[_0x034b('0x64')]][_0x034b('0x2d')]>_['toNumber'](_0x5ab7d9[_0x034b('0x6a')])?_[_0x034b('0x69')](_0x5ab7d9[_0x034b('0x6a')]):this[_0x034b('0x12')][_0x5ab7d9[_0x034b('0x64')]][_0x034b('0x2d')];this['emitVoiceQueueSummary'](this[_0x034b('0x12')][_0x5ab7d9[_0x034b('0x64')]],_0x034b('0x15'));}logger[_0x034b('0x5b')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x034b('0x39')](this[_0x034b('0x12')][_0x5ab7d9[_0x034b('0x64')]],{'showHidden':![],'depth':null}));ami['emit'](_0x034b('0x6b'),this[_0x034b('0x12')][_0x5ab7d9['queue']]);}}}catch(_0x7d3c87){logger[_0x034b('0x38')](_0x034b('0x63'),util[_0x034b('0x39')](_0x7d3c87,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x034b('0x6c')]=function(_0x5064ab){logger[_0x034b('0x5b')](_0x034b('0x6d'),util[_0x034b('0x39')](_0x5064ab,{'showHidden':![],'depth':null}));ami[_0x034b('0x40')]('custom:queuesummarycomplete',{});this[_0x034b('0x13')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2fa20f){try{if(this[_0x034b('0x5f')](_0x2fa20f)){logger['debug'](_0x034b('0x6e'),_0x2fa20f[_0x034b('0x47')],util['inspect'](_0x2fa20f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x034b('0xf')][_0x2fa20f[_0x034b('0x47')]]))this[_0x034b('0xf')][_0x2fa20f[_0x034b('0x47')]]=[];if(_[_0x034b('0x6f')](this[_0x034b('0x10')][_0x2fa20f[_0x034b('0x47')]]))this[_0x034b('0x10')][_0x2fa20f[_0x034b('0x47')]]={};var _0x47d4dc=new QueueReport();_0x47d4dc[_0x034b('0x43')]=_0x2fa20f['queue'];_0x47d4dc[_0x034b('0x70')]=this[_0x034b('0x12')][_0x47d4dc[_0x034b('0x43')]]&&this['voiceQueues'][_0x47d4dc[_0x034b('0x43')]][_0x034b('0x70')]?this[_0x034b('0x12')][_0x47d4dc[_0x034b('0x43')]][_0x034b('0x70')]||_0x034b('0x4e'):_0x034b('0x4e');_0x47d4dc[_0x034b('0x64')]=_0x2fa20f[_0x034b('0x64')];_0x47d4dc['queuecallerjoinAt']=moment()[_0x034b('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x47d4dc['position']=_0x2fa20f['position'];_0x47d4dc[_0x034b('0x71')]=_0x2fa20f['count'];_0x47d4dc['uniqueid']=_0x2fa20f['uniqueid'];_0x47d4dc[_0x034b('0x72')]=this['channels'][_0x2fa20f['uniqueid']][_0x034b('0x72')];logger[_0x034b('0x66')](_0x034b('0x73'),_0x47d4dc['name'],_0x47d4dc[_0x034b('0x70')]);_[_0x034b('0x74')](_0x47d4dc,_[_0x034b('0x75')](_0x2fa20f,_[_0x034b('0x76')](_0x47d4dc)));this['queueReports'][_0x2fa20f['uniqueid']][_0x034b('0x77')](_0x47d4dc);this[_0x034b('0x10')][_0x2fa20f[_0x034b('0x47')]]=_0x47d4dc;this[_0x034b('0x78')](_0x47d4dc,_0x034b('0x19'));}}catch(_0x1af323){logger[_0x034b('0x38')](_0x034b('0x6e'),_0x2fa20f['uniqueid'],util['inspect'](_0x1af323,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x034b('0x1c')]=function(_0x1df523){try{if(this[_0x034b('0x5f')](_0x1df523)){logger['debug'](_0x034b('0x79'),_0x1df523[_0x034b('0x47')],util[_0x034b('0x39')](_0x1df523,{'showHidden':![],'depth':null}));if(this[_0x034b('0xf')][_0x1df523[_0x034b('0x47')]]){var _0x204279=_['last'](this['queueReports'][_0x1df523[_0x034b('0x47')]]);_0x204279[_0x034b('0x7a')]=![];_0x204279[_0x034b('0x7b')]=null;_0x204279[_0x034b('0x7c')]=_0x1df523[_0x034b('0x7c')];_0x204279[_0x034b('0x7d')]=_0x1df523[_0x034b('0x7d')];_0x204279[_0x034b('0x1b')]=!![];_0x204279['queuecallerabandonAt']=moment()['format'](_0x034b('0x7e'));_0x204279[_0x034b('0x48')]='ABANDONED';_0x204279['lastAssignedTo']=null;logger[_0x034b('0x66')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x204279['name'],_0x204279['type']);this[_0x034b('0x10')][_0x1df523['uniqueid']]=_0x204279;this[_0x034b('0x3f')](_0x204279,_0x034b('0x1b'));}}}catch(_0x1525e2){logger[_0x034b('0x38')](_0x034b('0x79'),_0x1df523[_0x034b('0x47')],util[_0x034b('0x39')](_0x1525e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x034b('0x1d')]=function(_0x205a28){try{if(this['isNotNull'](_0x205a28)){logger['debug'](_0x034b('0x7f'),_0x205a28[_0x034b('0x47')],util[_0x034b('0x39')](_0x205a28,{'showHidden':![],'depth':null}));if(this[_0x034b('0xf')][_0x205a28[_0x034b('0x47')]]){var _0xe5d6b3=_[_0x034b('0x80')](this[_0x034b('0xf')][_0x205a28['uniqueid']]);_0xe5d6b3[_0x034b('0x81')]=moment()[_0x034b('0x49')](_0x034b('0x7e'));_0xe5d6b3['connectedlinenum']=_0x205a28['connectedlinenum'];_0xe5d6b3['connectedlinename']=_0x205a28[_0x034b('0x82')];logger['info'](_0x034b('0x83'),_0xe5d6b3[_0x034b('0x43')],_0xe5d6b3['type'],_0x205a28['connectedlinenum'],_0x205a28[_0x034b('0x82')]);this[_0x034b('0x10')][_0x205a28['uniqueid']]=_0xe5d6b3;this['emitVoiceQueueChannelSave'](_0xe5d6b3,_0x034b('0x84'));}}}catch(_0x29c6ef){logger[_0x034b('0x38')](_0x034b('0x7f'),_0x205a28[_0x034b('0x47')],util[_0x034b('0x39')](_0x29c6ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x034b('0x20')]=function(_0x1fcbc8){try{if(this[_0x034b('0x5f')](_0x1fcbc8)){logger['debug'](_0x034b('0x85'),_0x1fcbc8[_0x034b('0x47')],util[_0x034b('0x39')](_0x1fcbc8,{'showHidden':![],'depth':null}));if(this[_0x034b('0xf')][_0x1fcbc8[_0x034b('0x47')]]){var _0x4e9f0d=_['last'](this['queueReports'][_0x1fcbc8['uniqueid']]);_0x4e9f0d[_0x034b('0x7a')]=!![];_0x4e9f0d['queuecallerexitreason']=_0x034b('0x86');logger[_0x034b('0x66')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4e9f0d['name'],_0x4e9f0d['type']);}}}catch(_0x5528de){logger[_0x034b('0x38')]('[%s][voiceQueueReport][agentconnect]',_0x1fcbc8['uniqueid'],util['inspect'](_0x5528de,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x034b('0x87')]=function(_0x49b7a6){try{if(this[_0x034b('0x5f')](_0x49b7a6)){logger[_0x034b('0x5b')]('[%s][voiceQueueReport][agentcomplete]',_0x49b7a6[_0x034b('0x47')],util[_0x034b('0x39')](_0x49b7a6,{'showHidden':![],'depth':null}));if(this[_0x034b('0xf')][_0x49b7a6[_0x034b('0x47')]]){var _0x2a9073=_[_0x034b('0x80')](this['queueReports'][_0x49b7a6[_0x034b('0x47')]]);_0x2a9073[_0x034b('0x1b')]=![];_0x2a9073[_0x034b('0x88')]=null;_0x2a9073['assigned']=!![];_0x2a9073[_0x034b('0x89')]=_0x49b7a6[_0x034b('0x8a')];_0x2a9073[_0x034b('0x7c')]=_0x49b7a6['holdtime'];_0x2a9073['queuecallercomplete']=!![];_0x2a9073[_0x034b('0x8b')]=![];_0x2a9073[_0x034b('0x8c')]=null;if(!_0x2a9073[_0x034b('0x8d')]){if(_0x49b7a6[_0x034b('0x8e')]==_0x034b('0x8d')){_0x2a9073[_0x034b('0x48')]=_0x034b('0x8f');logger[_0x034b('0x66')](_0x034b('0x90'),_0x2a9073[_0x034b('0x43')],_0x2a9073[_0x034b('0x70')]);}else{if(_[_0x034b('0x91')](_0x49b7a6[_0x034b('0x36')][_0x034b('0x92')](),'local/')){if(this[_0x034b('0xf')][_0x49b7a6['linkedid']]){var _0x3667a0=_['last'](this[_0x034b('0xf')][_0x49b7a6['linkedid']]);_0x3667a0[_0x034b('0x7a')]=![];_0x3667a0[_0x034b('0x8b')]=!![];_0x3667a0[_0x034b('0x8c')]=moment(_0x2a9073[_0x034b('0x93')])['add'](_0x49b7a6[_0x034b('0x7c')],_0x034b('0x94'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3667a0['queuecallerexitreason']='FORWARDTRANSFER';_0x3667a0[_0x034b('0x8d')]=!![];_0x3667a0[_0x034b('0x95')]=_0x034b('0x96');_0x3667a0[_0x034b('0x97')]=_0x49b7a6[_0x034b('0x98')];_0x3667a0[_0x034b('0x99')]=_0x49b7a6[_0x034b('0x47')];logger[_0x034b('0x66')](_0x034b('0x9a'),_0x3667a0['name'],_0x3667a0['type']);var _0x126918=this[_0x034b('0xf')][_0x49b7a6['linkedid']];this[_0x034b('0xf')][_0x49b7a6['linkedid']]=this['queueReports'][_0x49b7a6[_0x034b('0x47')]];this[_0x034b('0xf')][_0x49b7a6[_0x034b('0x47')]]=_0x126918;}}else{_0x2a9073[_0x034b('0x48')]='COMPLETEDBY'+_0x49b7a6[_0x034b('0x8e')][_0x034b('0x9b')]();logger[_0x034b('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2a9073[_0x034b('0x43')],_0x2a9073[_0x034b('0x70')],_0x2a9073[_0x034b('0x48')]);}}}this[_0x034b('0x10')][_0x49b7a6['uniqueid']]=_0x2a9073;this['emitVoiceQueueChannelRemove'](_0x2a9073,_0x034b('0x1e'));}}}catch(_0x24a82e){logger['error'](_0x034b('0x9c'),_0x49b7a6[_0x034b('0x47')],util[_0x034b('0x39')](_0x24a82e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x034b('0xb')][_0x034b('0x21')]=function(_0x317f68){try{if(this[_0x034b('0x5f')](_0x317f68)){logger[_0x034b('0x5b')](_0x034b('0x9d'),_0x317f68['uniqueid'],util[_0x034b('0x39')](_0x317f68,{'showHidden':![],'depth':null}));this['addVariable'](_0x317f68[_0x034b('0x47')],_[_0x034b('0x76')](_0x317f68[_0x034b('0x9e')])[0x0],_0x317f68['value']);if(this[_0x034b('0xf')][_0x317f68[_0x034b('0x47')]]){var _0x1a4a65=_[_0x034b('0x80')](this[_0x034b('0xf')][_0x317f68['uniqueid']]);if(_0x1a4a65){if(this[_0x034b('0x5f')](_0x317f68[_0x034b('0x9e')])&&this['isNotNull'](_0x317f68[_0x034b('0x9e')]['queuestatus'])){switch(_0x317f68[_0x034b('0x9f')]){case _0x034b('0xa0'):_0x1a4a65[_0x034b('0x8b')]=![];_0x1a4a65[_0x034b('0x8c')]=null;break;case _0x034b('0xa1'):_0x1a4a65[_0x034b('0xa2')]=_0x034b('0xa3');_0x1a4a65[_0x034b('0x8b')]=!![];_0x1a4a65[_0x034b('0x8c')]=moment()[_0x034b('0x49')](_0x034b('0x7e'));_0x1a4a65[_0x034b('0x81')]=moment()[_0x034b('0x49')](_0x034b('0x7e'));logger[_0x034b('0x5b')](_0x034b('0xa4'),_0x317f68['uniqueid'],util[_0x034b('0x39')](_0x1a4a65,{'showHidden':![],'depth':null}));ami['emit'](_0x034b('0xa5'),_0x1a4a65);break;default:_0x1a4a65[_0x034b('0x8b')]=!![];_0x1a4a65[_0x034b('0x8c')]=moment()['format'](_0x034b('0x7e'));_0x1a4a65[_0x034b('0x81')]=moment()[_0x034b('0x49')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a4a65['queuecallerabandon']=![];_0x1a4a65[_0x034b('0x88')]=null;_0x1a4a65[_0x034b('0x48')]=_0x317f68[_0x034b('0x9f')];this['channels'][_0x317f68[_0x034b('0x47')]]=_0x1a4a65;this['emitVoiceQueueChannelRemove'](_0x1a4a65,_0x034b('0xa6'));}else if(this['isNotNull'](_0x317f68[_0x034b('0x9e')])&&this[_0x034b('0x5f')](_0x317f68[_0x034b('0x9e')][_0x034b('0xa7')])){if(!_0x1a4a65[_0x034b('0x1b')]){_0x1a4a65[_0x034b('0x8b')]=!![];_0x1a4a65[_0x034b('0x8c')]=moment()[_0x034b('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a4a65['queuecallerexitreason']=_0x034b('0xa8');_0x1a4a65[_0x034b('0x81')]=moment()[_0x034b('0x49')](_0x034b('0x7e'));this['channels'][_0x317f68['uniqueid']]=_0x1a4a65;}}logger[_0x034b('0x66')](_0x034b('0xa9'),_0x317f68[_0x034b('0x47')],_0x1a4a65[_0x034b('0x43')],_0x1a4a65['type'],_[_0x034b('0x76')](_0x317f68['variable'])[0x0],_0x317f68[_0x034b('0x9f')]);_0x1a4a65['variables']=this[_0x034b('0x3b')][_0x317f68['uniqueid']];}}}}catch(_0x4a60ea){logger[_0x034b('0x38')](_0x034b('0x9d'),_0x317f68['uniqueid'],util[_0x034b('0x39')](_0x4a60ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x49b86e,_0x242bcb,_0x105eff){var _0x4afdaf=[_0x034b('0xaa'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x034b('0xab'),_0x034b('0xac'),_0x034b('0xad'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x034b('0xae'),_0x034b('0xaf'),_0x034b('0xb0'),_0x034b('0xb1'),_0x034b('0xb2'),'memberinterface',_0x034b('0xb3'),_0x034b('0x8a'),_0x034b('0xb4'),_0x034b('0xb5')];if(!_[_0x034b('0x33')](_0x242bcb)&&!_[_0x034b('0xb6')](_0x4afdaf,_0x242bcb)){if(_[_0x034b('0x6f')](this['variables'][_0x49b86e])){this[_0x034b('0x3b')][_0x49b86e]={};}this[_0x034b('0x3b')][_0x49b86e][_0x242bcb]=_0x105eff;}};VoiceQueueReport['prototype'][_0x034b('0xb7')]=function(_0x470405,_0x5b05f9,_0x1b489a){var _0x5d4a5c={};for(var _0x7365f2=0x0;_0x7365f20x0?_0x2c42c:0x0;this[_0x1668('0x13')][_0x154c7f[_0x1668('0x6d')]][_0x1668('0x32')]=this[_0x1668('0x13')][_0x154c7f[_0x1668('0x6d')]][_0x1668('0x32')]>_[_0x1668('0x71')](_0x154c7f[_0x1668('0x73')])?_[_0x1668('0x71')](_0x154c7f[_0x1668('0x73')]):this[_0x1668('0x13')][_0x154c7f[_0x1668('0x6d')]][_0x1668('0x32')];this[_0x1668('0x55')](this[_0x1668('0x13')][_0x154c7f['queue']],_0x1668('0x17'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x1668('0x40')](this[_0x1668('0x13')][_0x154c7f[_0x1668('0x6d')]],{'showHidden':![],'depth':null}));ami[_0x1668('0x47')](_0x1668('0x75'),this['voiceQueues'][_0x154c7f[_0x1668('0x6d')]]);}}}catch(_0x36c6c2){logger['error'](_0x1668('0x76'),util[_0x1668('0x40')](_0x36c6c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')][_0x1668('0x77')]=function(_0xdbfac){logger[_0x1668('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0xdbfac,{'showHidden':![],'depth':null}));ami[_0x1668('0x47')](_0x1668('0x78'),{});this[_0x1668('0x14')]=!![];};VoiceQueueReport[_0x1668('0xb')][_0x1668('0x79')]=function(_0x497414){try{if(this[_0x1668('0x68')](_0x497414)){logger[_0x1668('0x49')](_0x1668('0x7a'),_0x497414[_0x1668('0x4b')],util[_0x1668('0x40')](_0x497414,{'showHidden':![],'depth':null}));if(_[_0x1668('0x69')](this['queueReports'][_0x497414[_0x1668('0x4b')]]))this[_0x1668('0x10')][_0x497414[_0x1668('0x4b')]]=[];if(_[_0x1668('0x69')](this[_0x1668('0x36')][_0x497414[_0x1668('0x4b')]]))this[_0x1668('0x36')][_0x497414[_0x1668('0x4b')]]={};var _0x4ff0e3=new QueueReport();_0x4ff0e3[_0x1668('0x4d')]=_0x497414['queue'];_0x4ff0e3[_0x1668('0x56')]=this[_0x1668('0x13')][_0x4ff0e3[_0x1668('0x4d')]]&&this[_0x1668('0x13')][_0x4ff0e3[_0x1668('0x4d')]]['type']?this['voiceQueues'][_0x4ff0e3[_0x1668('0x4d')]][_0x1668('0x56')]||_0x1668('0x57'):_0x1668('0x57');_0x4ff0e3[_0x1668('0x6d')]=_0x497414['queue'];_0x4ff0e3[_0x1668('0x7b')]=moment()[_0x1668('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ff0e3[_0x1668('0x7c')]=_0x497414[_0x1668('0x7c')];_0x4ff0e3[_0x1668('0x7d')]=_0x497414[_0x1668('0x7d')];_0x4ff0e3[_0x1668('0x4b')]=_0x497414['uniqueid'];_0x4ff0e3[_0x1668('0x7e')]=this[_0x1668('0x36')][_0x497414[_0x1668('0x4b')]]['routealias'];logger[_0x1668('0x6e')](_0x1668('0x7f'),_0x4ff0e3[_0x1668('0x4d')],_0x4ff0e3[_0x1668('0x56')]);_['merge'](_0x4ff0e3,_[_0x1668('0x80')](_0x497414,_[_0x1668('0x81')](_0x4ff0e3)));this[_0x1668('0x10')][_0x497414[_0x1668('0x4b')]][_0x1668('0x82')](_0x4ff0e3);this['channels'][_0x497414[_0x1668('0x4b')]]=_0x4ff0e3;this[_0x1668('0x48')](_0x4ff0e3,_0x1668('0x1b'));}}catch(_0x3b62ff){logger[_0x1668('0x3e')](_0x1668('0x7a'),_0x497414['uniqueid'],util[_0x1668('0x40')](_0x3b62ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')]['syncQueueCallerAbandon']=function(_0x35a530){try{if(this[_0x1668('0x68')](_0x35a530)){logger[_0x1668('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x35a530[_0x1668('0x4b')],util['inspect'](_0x35a530,{'showHidden':![],'depth':null}));if(this[_0x1668('0x10')][_0x35a530[_0x1668('0x4b')]]){var _0x12a221=_[_0x1668('0x83')](this[_0x1668('0x10')][_0x35a530[_0x1668('0x4b')]]);_0x12a221[_0x1668('0x84')]=![];_0x12a221[_0x1668('0x85')]=null;_0x12a221[_0x1668('0x86')]=_0x35a530[_0x1668('0x86')];_0x12a221[_0x1668('0x87')]=_0x35a530['originalposition'];_0x12a221[_0x1668('0x1c')]=!![];_0x12a221['queuecallerabandonAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12a221[_0x1668('0x51')]=_0x1668('0x88');_0x12a221[_0x1668('0x89')]=null;logger[_0x1668('0x6e')](_0x1668('0x8a'),_0x12a221['name'],_0x12a221[_0x1668('0x56')]);this[_0x1668('0x36')][_0x35a530[_0x1668('0x4b')]]=_0x12a221;this[_0x1668('0x45')](_0x12a221,_0x1668('0x1c'));}}}catch(_0x1c24eb){logger[_0x1668('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x35a530[_0x1668('0x4b')],util[_0x1668('0x40')](_0x1c24eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')]['syncQueueCallerLeave']=function(_0x51b3c9){try{if(this['isNotNull'](_0x51b3c9)){logger[_0x1668('0x49')](_0x1668('0x8b'),_0x51b3c9[_0x1668('0x4b')],util[_0x1668('0x40')](_0x51b3c9,{'showHidden':![],'depth':null}));if(this[_0x1668('0x10')][_0x51b3c9[_0x1668('0x4b')]]){var _0x524d7c=_[_0x1668('0x83')](this[_0x1668('0x10')][_0x51b3c9[_0x1668('0x4b')]]);_0x524d7c[_0x1668('0x8c')]=moment()['format'](_0x1668('0x8d'));_0x524d7c[_0x1668('0x8e')]=_0x51b3c9[_0x1668('0x8e')];_0x524d7c[_0x1668('0x8f')]=_0x51b3c9[_0x1668('0x8f')];logger['info'](_0x1668('0x90'),_0x524d7c[_0x1668('0x4d')],_0x524d7c[_0x1668('0x56')],_0x51b3c9[_0x1668('0x8e')],_0x51b3c9[_0x1668('0x8f')]);this[_0x1668('0x36')][_0x51b3c9['uniqueid']]=_0x524d7c;this['emitVoiceQueueChannelSave'](_0x524d7c,_0x1668('0x1e'));}}}catch(_0x38a56e){logger['error'](_0x1668('0x8b'),_0x51b3c9[_0x1668('0x4b')],util[_0x1668('0x40')](_0x38a56e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')][_0x1668('0x21')]=function(_0x2daffc){try{if(this[_0x1668('0x68')](_0x2daffc)){logger['debug'](_0x1668('0x91'),_0x2daffc[_0x1668('0x4b')],util[_0x1668('0x40')](_0x2daffc,{'showHidden':![],'depth':null}));if(this[_0x1668('0x10')][_0x2daffc[_0x1668('0x4b')]]){var _0x398198=_[_0x1668('0x83')](this[_0x1668('0x10')][_0x2daffc[_0x1668('0x4b')]]);_0x398198[_0x1668('0x84')]=!![];_0x398198[_0x1668('0x51')]='COMPLETEDBYAGENT';logger[_0x1668('0x6e')](_0x1668('0x92'),_0x398198[_0x1668('0x4d')],_0x398198[_0x1668('0x56')]);}}}catch(_0x33a111){logger[_0x1668('0x3e')](_0x1668('0x91'),_0x2daffc[_0x1668('0x4b')],util[_0x1668('0x40')](_0x33a111,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')][_0x1668('0x93')]=function(_0xe02631){try{if(this[_0x1668('0x68')](_0xe02631)){logger[_0x1668('0x49')]('[%s][voiceQueueReport][agentcomplete]',_0xe02631['uniqueid'],util[_0x1668('0x40')](_0xe02631,{'showHidden':![],'depth':null}));if(this[_0x1668('0x10')][_0xe02631[_0x1668('0x4b')]]){var _0x5de9d7=_[_0x1668('0x83')](this['queueReports'][_0xe02631[_0x1668('0x4b')]]);_0x5de9d7['queuecallerabandon']=![];_0x5de9d7[_0x1668('0x94')]=null;_0x5de9d7['assigned']=!![];_0x5de9d7['lastAssignedTo']=_0xe02631[_0x1668('0x95')];_0x5de9d7['holdtime']=_0xe02631[_0x1668('0x86')];_0x5de9d7[_0x1668('0x84')]=!![];_0x5de9d7[_0x1668('0x96')]=![];_0x5de9d7[_0x1668('0x97')]=null;if(!_0x5de9d7[_0x1668('0x98')]){if(_0xe02631[_0x1668('0x99')]==_0x1668('0x98')){_0x5de9d7[_0x1668('0x51')]=_0x1668('0x9a');logger[_0x1668('0x6e')](_0x1668('0x9b'),_0x5de9d7[_0x1668('0x4d')],_0x5de9d7['type']);}else{if(_['startsWith'](_0xe02631[_0x1668('0x3b')]['toLowerCase'](),'local/')){if(this[_0x1668('0x10')][_0xe02631[_0x1668('0x9c')]]){var _0xf7bbd6=_[_0x1668('0x83')](this[_0x1668('0x10')][_0xe02631[_0x1668('0x9c')]]);_0xf7bbd6[_0x1668('0x84')]=![];_0xf7bbd6[_0x1668('0x96')]=!![];_0xf7bbd6[_0x1668('0x97')]=moment(_0x5de9d7[_0x1668('0x7b')])[_0x1668('0x9d')](_0xe02631[_0x1668('0x86')],'seconds')['format'](_0x1668('0x8d'));_0xf7bbd6[_0x1668('0x51')]=_0x1668('0x9e');_0xf7bbd6['transfer']=!![];_0xf7bbd6['transfertype']=_0x1668('0x9f');_0xf7bbd6[_0x1668('0xa0')]=_0xe02631[_0x1668('0xa1')];_0xf7bbd6['transferuniqueid']=_0xe02631[_0x1668('0x4b')];logger[_0x1668('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xf7bbd6[_0x1668('0x4d')],_0xf7bbd6[_0x1668('0x56')]);var _0x45d5ad=this[_0x1668('0x10')][_0xe02631['linkedid']];this[_0x1668('0x10')][_0xe02631[_0x1668('0x9c')]]=this[_0x1668('0x10')][_0xe02631[_0x1668('0x4b')]];this['queueReports'][_0xe02631['uniqueid']]=_0x45d5ad;}}else{_0x5de9d7['queuecallerexitreason']=_0x1668('0xa2')+_0xe02631[_0x1668('0x99')][_0x1668('0xa3')]();logger[_0x1668('0x6e')](_0x1668('0xa4'),_0x5de9d7['name'],_0x5de9d7[_0x1668('0x56')],_0x5de9d7[_0x1668('0x51')]);}}}this[_0x1668('0x36')][_0xe02631[_0x1668('0x4b')]]=_0x5de9d7;this[_0x1668('0x45')](_0x5de9d7,'agentcomplete');}}}catch(_0x453245){logger[_0x1668('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0xe02631['uniqueid'],util[_0x1668('0x40')](_0x453245,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1668('0xb')][_0x1668('0x23')]=function(_0x2041c8){try{if(this[_0x1668('0x68')](_0x2041c8)){logger['debug']('[%s][voiceQueueReport][varset]',_0x2041c8[_0x1668('0x4b')],util[_0x1668('0x40')](_0x2041c8,{'showHidden':![],'depth':null}));this[_0x1668('0xa5')](_0x2041c8[_0x1668('0x4b')],_[_0x1668('0x81')](_0x2041c8['variable'])[0x0],_0x2041c8[_0x1668('0xa6')]);if(this[_0x1668('0x10')][_0x2041c8[_0x1668('0x4b')]]){var _0xd78409=_['last'](this['queueReports'][_0x2041c8[_0x1668('0x4b')]]);if(_0xd78409){if(this[_0x1668('0x68')](_0x2041c8[_0x1668('0xa7')])&&this[_0x1668('0x68')](_0x2041c8[_0x1668('0xa7')]['queuestatus'])){switch(_0x2041c8[_0x1668('0xa6')]){case _0x1668('0xa8'):_0xd78409[_0x1668('0x96')]=![];_0xd78409[_0x1668('0x97')]=null;break;case _0x1668('0xa9'):_0xd78409['lastevent']=_0x1668('0xaa');_0xd78409['queuecallerexit']=!![];_0xd78409[_0x1668('0x97')]=moment()[_0x1668('0x53')](_0x1668('0x8d'));_0xd78409[_0x1668('0x8c')]=moment()[_0x1668('0x53')](_0x1668('0x8d'));logger['debug'](_0x1668('0xab'),_0x2041c8[_0x1668('0x4b')],util[_0x1668('0x40')](_0xd78409,{'showHidden':![],'depth':null}));ami[_0x1668('0x47')](_0x1668('0xac'),_0xd78409);break;default:_0xd78409[_0x1668('0x96')]=!![];_0xd78409['queuecallerexitAt']=moment()[_0x1668('0x53')](_0x1668('0x8d'));_0xd78409[_0x1668('0x8c')]=moment()[_0x1668('0x53')](_0x1668('0x8d'));}_0xd78409['queuecallerabandon']=![];_0xd78409[_0x1668('0x94')]=null;_0xd78409[_0x1668('0x51')]=_0x2041c8['value'];this[_0x1668('0x36')][_0x2041c8[_0x1668('0x4b')]]=_0xd78409;this[_0x1668('0x45')](_0xd78409,_0x1668('0x22'));}else if(this[_0x1668('0x68')](_0x2041c8[_0x1668('0xa7')])&&this['isNotNull'](_0x2041c8[_0x1668('0xa7')][_0x1668('0xad')])){if(!_0xd78409[_0x1668('0x1c')]){_0xd78409['queuecallerexit']=!![];_0xd78409['queuecallerexitAt']=moment()['format'](_0x1668('0x8d'));_0xd78409[_0x1668('0x51')]='EXITWITHKEY';_0xd78409[_0x1668('0x8c')]=moment()['format'](_0x1668('0x8d'));this['channels'][_0x2041c8[_0x1668('0x4b')]]=_0xd78409;}}logger[_0x1668('0x6e')](_0x1668('0xae'),_0x2041c8[_0x1668('0x4b')],_0xd78409['name'],_0xd78409[_0x1668('0x56')],_['keys'](_0x2041c8[_0x1668('0xa7')])[0x0],_0x2041c8['value']);_0xd78409['variables']=this[_0x1668('0x16')][_0x2041c8[_0x1668('0x4b')]];}}}}catch(_0x2618cf){logger[_0x1668('0x3e')]('[%s][voiceQueueReport][varset]',_0x2041c8[_0x1668('0x4b')],util['inspect'](_0x2618cf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1668('0xa5')]=function(_0x2790b7,_0x30c397,_0x373f73){var _0x4d81d5=[_0x1668('0xaf'),_0x1668('0xb0'),_0x1668('0xb1'),_0x1668('0xb2'),_0x1668('0xb3'),_0x1668('0xb4'),_0x1668('0xb5'),_0x1668('0xb6'),'sipcallid',_0x1668('0xb7'),_0x1668('0xb8'),_0x1668('0xb9'),_0x1668('0xba'),_0x1668('0xbb'),_0x1668('0xbc'),_0x1668('0xbd'),_0x1668('0x95'),_0x1668('0xbe'),'memberrealtime'];if(!_[_0x1668('0x38')](_0x30c397)&&!_[_0x1668('0xbf')](_0x4d81d5,_0x30c397)){if(_[_0x1668('0x69')](this[_0x1668('0x16')][_0x2790b7])){this[_0x1668('0x16')][_0x2790b7]={};}this[_0x1668('0x16')][_0x2790b7][_0x30c397]=_0x373f73;}};VoiceQueueReport[_0x1668('0xb')]['handleHangup']=function(_0x2283b5,_0x8bff54,_0x577084){var _0x3152f0={};for(var _0x1d294e=0x0;_0x1d294e=0x0?moment(_0x3fce06[_0x5511('0x15')])[_0x5511('0x16')](_0x3fce06[_0x5511('0x14')],_0x5511('0x17')):null,'data1':_0x5511('0x18'),'data2':_0x3fce06[_0x5511('0x19')],'data3':_0x3fce06[_0x5511('0xe')],'data4':_0x3fce06['dialstring']||null,'role':'agent','internal':_0x3fce06[_0x5511('0x19')]?_['toNumber'](_0x3fce06[_0x5511('0x19')]):undefined,'uniqueid':_0x3fce06[_0x5511('0x10')]},'log':_0x5511('0x6')});}; \ No newline at end of file +var _0xc752=['queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','toNumber','accountcode','uniqueid','membername','TALKING','endtime','starttime','outbound','dialstring','lodash','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s'];(function(_0x132ba1,_0x352097){var _0x1af422=function(_0x4622f9){while(--_0x4622f9){_0x132ba1['push'](_0x132ba1['shift']());}};_0x1af422(++_0x352097);}(_0xc752,0x9d));var _0x2c75=function(_0x3d01ea,_0x5333c2){_0x3d01ea=_0x3d01ea-0x0;var _0x177aeb=_0xc752[_0x3d01ea];return _0x177aeb;};'use strict';var moment=require('moment');var _=require(_0x2c75('0x0'));var util=require('util');var client=require('../client');exports[_0x2c75('0x1')]=function(_0x4fdff7){var _0x21d976=_0x4fdff7[_0x2c75('0x2')]||_0x4fdff7[_0x2c75('0x3')];return client['Request'](_0x2c75('0x4'),{'body':{'channel':_0x2c75('0x5'),'membername':_0x4fdff7[_0x2c75('0x6')],'interface':_[_0x2c75('0x7')](_0x4fdff7[_0x2c75('0x8')])?util[_0x2c75('0x9')](_0x2c75('0xa'),_0x4fdff7['lastAssignedTo']):_0x4fdff7[_0x2c75('0x8')],'type':'TALKING','enterAt':_0x4fdff7[_0x2c75('0xb')],'exitAt':_0x21d976,'duration':moment(_0x21d976)[_0x2c75('0xc')](_0x4fdff7[_0x2c75('0xb')],_0x2c75('0xd')),'data1':_0x2c75('0xe'),'data2':_0x4fdff7[_0x2c75('0xf')],'data3':_0x4fdff7[_0x2c75('0x10')],'data4':null,'data5':_0x4fdff7[_0x2c75('0x11')],'role':_0x2c75('0x12'),'internal':_0x4fdff7['accountcode']?_[_0x2c75('0x13')](_0x4fdff7[_0x2c75('0x14')]):undefined,'uniqueid':_0x4fdff7[_0x2c75('0x15')]},'log':_0x2c75('0x4')});};exports['voiceDialReport']=function(_0x28497e){return client['Request'](_0x2c75('0x4'),{'body':{'channel':_0x2c75('0x5'),'membername':_0x28497e[_0x2c75('0x16')],'interface':_0x28497e[_0x2c75('0x8')],'type':_0x2c75('0x17'),'enterAt':_0x28497e['starttime'],'exitAt':_0x28497e[_0x2c75('0x18')],'duration':moment(_0x28497e[_0x2c75('0x18')])[_0x2c75('0xc')](_0x28497e[_0x2c75('0x19')],'seconds')>=0x0?moment(_0x28497e[_0x2c75('0x18')])['diff'](_0x28497e[_0x2c75('0x19')],'seconds'):null,'data1':_0x2c75('0x1a'),'data2':_0x28497e['accountcode'],'data3':_0x28497e[_0x2c75('0x10')],'data4':_0x28497e[_0x2c75('0x1b')]||null,'role':'agent','internal':_0x28497e['accountcode']?_[_0x2c75('0x13')](_0x28497e['accountcode']):undefined,'uniqueid':_0x28497e[_0x2c75('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index f8f410c..cbe7c65 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 _0xf7d9=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0xf7d9,0x122));var _0x9f7d=function(_0x3b6a66,_0xf3202e){_0x3b6a66=_0x3b6a66-0x0;var _0xb25adc=_0xf7d9[_0x3b6a66];return _0xb25adc;};'use strict';var client=require(_0x9f7d('0x0'));exports[_0x9f7d('0x1')]=function(){return client[_0x9f7d('0x2')](_0x9f7d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x9f7d('0x4')});}; \ No newline at end of file +var _0x9153=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x4b00d7,_0x164bc0){var _0x481166=function(_0x4fc6a9){while(--_0x4fc6a9){_0x4b00d7['push'](_0x4b00d7['shift']());}};_0x481166(++_0x164bc0);}(_0x9153,0xd8));var _0x3915=function(_0x26d2ec,_0x14ce40){_0x26d2ec=_0x26d2ec-0x0;var _0x2670d5=_0x9153[_0x26d2ec];return _0x2670d5;};'use strict';var client=require(_0x3915('0x0'));exports[_0x3915('0x1')]=function(){return client[_0x3915('0x2')](_0x3915('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3915('0x4'),_0x3915('0x5')]},'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 82cecc1..2dc7b58 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 _0x0acc=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x48fc54,_0x1708e3){var _0x2fe2bc=function(_0x3a42f9){while(--_0x3a42f9){_0x48fc54['push'](_0x48fc54['shift']());}};_0x2fe2bc(++_0x1708e3);}(_0x0acc,0xd0));var _0xc0ac=function(_0x32de1c,_0x1b9e3b){_0x32de1c=_0x32de1c-0x0;var _0x34efc5=_0x0acc[_0x32de1c];return _0x34efc5;};'use strict';var client=require(_0xc0ac('0x0'));exports[_0xc0ac('0x1')]=function(_0x238b53){return function(_0x3e4a33){return client[_0xc0ac('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xc0ac('0x3'),_0xc0ac('0x4')]},'log':_0xc0ac('0x5')});};}; \ No newline at end of file +var _0x86eb=['getTemplates','Request','GetTemplate','html'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0x86eb,0x188));var _0xb86e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86eb[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xb86e('0x0')]=function(_0x53e535){return function(_0x48425a){return client[_0xb86e('0x1')](_0xb86e('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xb86e('0x3')]},'log':_0xb86e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fb3663b..43ae1c9 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 _0x7377=['getTriggers','Request','GetTrigger','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2','data4','data5','data7'];(function(_0x32ee10,_0x589f51){var _0xe93415=function(_0x44b119){while(--_0x44b119){_0x32ee10['push'](_0x32ee10['shift']());}};_0xe93415(++_0x589f51);}(_0x7377,0x1db));var _0x7737=function(_0x304f9d,_0x2f3ec0){_0x304f9d=_0x304f9d-0x0;var _0x179bc4=_0x7377[_0x304f9d];return _0x179bc4;};'use strict';var client=require('../client');exports[_0x7737('0x0')]=function(_0x4f5082){return function(_0x4893df){return client[_0x7737('0x1')](_0x7737('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7737('0x3'),_0x7737('0x4')],'include':[{'model':'Condition','as':_0x7737('0x5'),'attributes':['id',_0x7737('0x6'),_0x7737('0x7'),_0x7737('0x8')]},{'model':_0x7737('0x9'),'as':_0x7737('0xa'),'attributes':['id',_0x7737('0x6'),_0x7737('0x7'),_0x7737('0x8')]},{'model':_0x7737('0xb'),'as':_0x7737('0xc'),'attributes':['id',_0x7737('0xd'),_0x7737('0xe'),_0x7737('0xf'),'data3',_0x7737('0x10'),_0x7737('0x11'),'data6',_0x7737('0x12')]}]},'log':_0x7737('0x2')});};}; \ No newline at end of file +var _0x0a86=['data3','data5','data6','../client','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action','action','data1','data2'];(function(_0x2dfd87,_0x388604){var _0x48301c=function(_0x56e1e2){while(--_0x56e1e2){_0x2dfd87['push'](_0x2dfd87['shift']());}};_0x48301c(++_0x388604);}(_0x0a86,0x1f3));var _0x60a8=function(_0x9658dc,_0x4b1905){_0x9658dc=_0x9658dc-0x0;var _0x2ad48e=_0x0a86[_0x9658dc];return _0x2ad48e;};'use strict';var client=require(_0x60a8('0x0'));exports['getTriggers']=function(_0x211efa){return function(_0x22fd70){return client['Request'](_0x60a8('0x1'),{'options':{'raw':![],'attributes':['id',_0x60a8('0x2'),_0x60a8('0x3'),'status'],'include':[{'model':_0x60a8('0x4'),'as':_0x60a8('0x5'),'attributes':['id',_0x60a8('0x6'),_0x60a8('0x7'),_0x60a8('0x8')]},{'model':_0x60a8('0x4'),'as':'AnyConditions','attributes':['id',_0x60a8('0x6'),'operator',_0x60a8('0x8')]},{'model':_0x60a8('0x9'),'as':'Actions','attributes':['id',_0x60a8('0xa'),_0x60a8('0xb'),_0x60a8('0xc'),_0x60a8('0xd'),'data4',_0x60a8('0xe'),_0x60a8('0xf'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6e762b2..bc1377b 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 _0x2635=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x4c12d8,_0x4ff475){var _0x147272=function(_0xe2e687){while(--_0xe2e687){_0x4c12d8['push'](_0x4c12d8['shift']());}};_0x147272(++_0x4ff475);}(_0x2635,0x148));var _0x5263=function(_0x165148,_0x4c4ebc){_0x165148=_0x165148-0x0;var _0x458114=_0x2635[_0x165148];return _0x458114;};'use strict';var client=require(_0x5263('0x0'));exports[_0x5263('0x1')]=function(_0x42ec13){return function(_0x5e55d9){return client[_0x5263('0x2')](_0x5263('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5263('0x4'),_0x5263('0x5'),_0x5263('0x6')]},'log':_0x5263('0x3')});};}; \ No newline at end of file +var _0x78f4=['registry','Request','name'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0x78f4,0x193));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x123f11){return function(_0x4a4d67){return client[_0x478f('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x478f('0x1'),_0x478f('0x2'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7fc2f7e..3c6a774 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x747bd1,_0x45b674){var _0x1d2b10=function(_0xd49ca0){while(--_0xd49ca0){_0x747bd1['push'](_0x747bd1['shift']());}};_0x1d2b10(++_0x45b674);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xcb91[_0x3fe6df];return _0x372a0e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ 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(_0x39b3a2,_0x5ca287){var _0x3d43ef=function(_0x4172fd){while(--_0x4172fd){_0x39b3a2['push'](_0x39b3a2['shift']());}};_0x3d43ef(++_0x5ca287);}(_0x70e0,0x17b));var _0x070e=function(_0x422fb5,_0x27d28a){_0x422fb5=_0x422fb5-0x0;var _0x132ed9=_0x70e0[_0x422fb5];return _0x132ed9;};'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 03bad3d..ad36e0a 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 _0xf466=['../client','Request','UpdateVoiceAgentReport'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xf466,0x10b));var _0x6f46=function(_0x53377b,_0x166f23){_0x53377b=_0x53377b-0x0;var _0x39cba9=_0xf466[_0x53377b];return _0x39cba9;};'use strict';var client=require(_0x6f46('0x0'));exports['create']=function(_0x5c3534){return client[_0x6f46('0x1')]('CreateVoiceAgentReport',{'body':_0x5c3534,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5dd2b4,_0x20bab2,_0x2e1e1e){return client[_0x6f46('0x1')](_0x6f46('0x2'),{'body':_0x5dd2b4,'options':{'where':{'uniqueid':_0x20bab2,'interface':_0x2e1e1e,'agentcomplete':!![]}},'log':_0x6f46('0x2')});}; \ No newline at end of file +var _0x68a5=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x2f2f12,_0x490589){var _0x39d1b0=function(_0x462cff){while(--_0x462cff){_0x2f2f12['push'](_0x2f2f12['shift']());}};_0x39d1b0(++_0x490589);}(_0x68a5,0x1d3));var _0x568a=function(_0x5d82d0,_0x5a45e8){_0x5d82d0=_0x5d82d0-0x0;var _0x572377=_0x68a5[_0x5d82d0];return _0x572377;};'use strict';var client=require(_0x568a('0x0'));exports[_0x568a('0x1')]=function(_0x5cb4ca){return client[_0x568a('0x2')](_0x568a('0x3'),{'body':_0x5cb4ca,'log':_0x568a('0x3')});};exports[_0x568a('0x4')]=function(_0x34518d,_0x30c1ff,_0x3ae0f9){return client['Request'](_0x568a('0x5'),{'body':_0x34518d,'options':{'where':{'uniqueid':_0x30c1ff,'interface':_0x3ae0f9,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3c22f6e..7e9f4c4 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 _0xa91d=['context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','../client','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xa91d,0x109));var _0xda91=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa91d[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0xda91('0x0'));exports[_0xda91('0x1')]=function(_0x103a3f){return client['Request'](_0xda91('0x2'),{'body':_[_0xda91('0x3')](_0x103a3f,{'source':_0x103a3f[_0xda91('0x4')],'destinationcontext':_0x103a3f[_0xda91('0x5')],'callerid':_0x103a3f[_0xda91('0x6')],'amaflags':_0xda91('0x7')}),'log':_0xda91('0x2')});};exports[_0xda91('0x8')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xda91('0x9')],'createdAt':{'$between':[moment()['startOf'](_0xda91('0xa'))[_0xda91('0xb')](_0xda91('0xc')),moment()[_0xda91('0xd')](_0xda91('0xa'))[_0xda91('0xb')](_0xda91('0xc'))]}},'attributes':[_0xda91('0xe'),_0xda91('0xf'),_0xda91('0x10'),'billableseconds']},'log':_0xda91('0x11')});};}; \ No newline at end of file +var _0x3ce1=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','merge','context','callerid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ce1,0x7d));var _0x13ce=function(_0x2ca5d0,_0xeba001){_0x2ca5d0=_0x2ca5d0-0x0;var _0x588c6d=_0x3ce1[_0x2ca5d0];return _0x588c6d;};'use strict';var moment=require(_0x13ce('0x0'));var util=require(_0x13ce('0x1'));var _=require(_0x13ce('0x2'));var client=require('../client');exports['create']=function(_0x41f720){return client[_0x13ce('0x3')](_0x13ce('0x4'),{'body':_[_0x13ce('0x5')](_0x41f720,{'source':_0x41f720['calleridnum'],'destinationcontext':_0x41f720[_0x13ce('0x6')],'callerid':_0x41f720[_0x13ce('0x7')],'amaflags':_0x13ce('0x8')}),'log':_0x13ce('0x4')});};exports[_0x13ce('0x9')]=function(){return function(){return client[_0x13ce('0x3')](_0x13ce('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x13ce('0xb')](_0x13ce('0xc'))[_0x13ce('0xd')](_0x13ce('0xe')),moment()['endOf'](_0x13ce('0xc'))[_0x13ce('0xd')](_0x13ce('0xe'))]}},'attributes':[_0x13ce('0xf'),'disposition',_0x13ce('0x10'),_0x13ce('0x11')]},'log':_0x13ce('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 822d3ab..80841fd 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 _0x2c67=['create','CreateVoiceDialReport','../client'];(function(_0x9c44de,_0x16509d){var _0x2a127b=function(_0x4907fc){while(--_0x4907fc){_0x9c44de['push'](_0x9c44de['shift']());}};_0x2a127b(++_0x16509d);}(_0x2c67,0x98));var _0x72c6=function(_0x5239ff,_0x46ff0f){_0x5239ff=_0x5239ff-0x0;var _0x466b66=_0x2c67[_0x5239ff];return _0x466b66;};'use strict';var client=require(_0x72c6('0x0'));exports[_0x72c6('0x1')]=function(_0x3d53f5){return client['Request'](_0x72c6('0x2'),{'body':_0x3d53f5,'log':_0x72c6('0x2')});}; \ No newline at end of file +var _0x0da5=['Request','CreateVoiceDialReport','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0da5,0x8f));var _0x50da=function(_0x210408,_0x23fb48){_0x210408=_0x210408-0x0;var _0x37dc40=_0x0da5[_0x210408];return _0x37dc40;};'use strict';var client=require('../client');exports[_0x50da('0x0')]=function(_0x16feff){return client[_0x50da('0x1')](_0x50da('0x2'),{'body':_0x16feff,'log':_0x50da('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5d24cb9..6ef675c 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 _0xf6e8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x45872a,_0x4e1103){var _0x37d69f=function(_0xc9e893){while(--_0xc9e893){_0x45872a['push'](_0x45872a['shift']());}};_0x37d69f(++_0x4e1103);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x490d96,_0x3c92d0){_0x490d96=_0x490d96-0x0;var _0x2988fa=_0xf6e8[_0x490d96];return _0x2988fa;};'use strict';var client=require('../client');exports[_0x8f6e('0x0')]=function(){return function(){return client[_0x8f6e('0x1')](_0x8f6e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x8f6e('0x3'),_0x8f6e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x8f6e('0x0')});};}; \ No newline at end of file +var _0x13f6=['../client','getVoiceExtensions','exten','recordingFormat'];(function(_0x3b56f2,_0x1f2ee2){var _0x1fc4a9=function(_0x116d02){while(--_0x116d02){_0x3b56f2['push'](_0x3b56f2['shift']());}};_0x1fc4a9(++_0x1f2ee2);}(_0x13f6,0x124));var _0x613f=function(_0x24bf75,_0x58a852){_0x24bf75=_0x24bf75-0x0;var _0x231bdb=_0x13f6[_0x24bf75];return _0x231bdb;};'use strict';var client=require(_0x613f('0x0'));exports[_0x613f('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x613f('0x2'),_0x613f('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x613f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0e98f93..8e423f7 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 _0xecbf=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','Interval','Intervals','../client','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x3df0c9,_0xa40ec1){var _0x40ab16=function(_0x424a8d){while(--_0x424a8d){_0x3df0c9['push'](_0x3df0c9['shift']());}};_0x40ab16(++_0xa40ec1);}(_0xecbf,0x1f0));var _0xfecb=function(_0x3bdba5,_0x5e24a8){_0x3bdba5=_0x3bdba5-0x0;var _0x2f10f9=_0xecbf[_0x3bdba5];return _0x2f10f9;};'use strict';var client=require(_0xfecb('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfecb('0x1')](_0xfecb('0x2'),{'options':{'raw':![],'attributes':['id',_0xfecb('0x3'),_0xfecb('0x4'),_0xfecb('0x5'),'autopause',_0xfecb('0x6'),_0xfecb('0x7'),'dialActive',_0xfecb('0x8'),'dialLimitChannel',_0xfecb('0x9'),_0xfecb('0xa'),_0xfecb('0xb'),'dialPredictiveOptimizationPercentage',_0xfecb('0xc'),'dialOriginateCallerIdName',_0xfecb('0xd'),_0xfecb('0xe'),_0xfecb('0xf'),_0xfecb('0x10'),_0xfecb('0x11'),_0xfecb('0x12'),_0xfecb('0x13'),_0xfecb('0x14'),'dialBusyRetryFrequency',_0xfecb('0x15'),_0xfecb('0x16'),_0xfecb('0x17'),_0xfecb('0x18'),_0xfecb('0x19'),_0xfecb('0x1a'),_0xfecb('0x1b'),'dialAMDActive',_0xfecb('0x1c'),'dialAMDGreeting',_0xfecb('0x1d'),'dialAMDTotalAnalysisTime',_0xfecb('0x1e'),'dialAMDBetweenWordsSilence',_0xfecb('0x1f'),'dialAMDSilenceThreshold',_0xfecb('0x20'),'timeout','dialRecallMeTimeout',_0xfecb('0x21'),_0xfecb('0x22'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xfecb('0x23'),_0xfecb('0x6'),_0xfecb('0x24'),_0xfecb('0x25'),'dialCutDigit',_0xfecb('0x26'),_0xfecb('0x27'),_0xfecb('0x28'),'dialDropRetryFrequency',_0xfecb('0x29'),_0xfecb('0x2a'),_0xfecb('0x2b'),_0xfecb('0x2c'),_0xfecb('0x2d'),_0xfecb('0x2e'),_0xfecb('0x2f'),_0xfecb('0x30'),'dialPredictiveIntervalMinThreshold',_0xfecb('0x31'),_0xfecb('0x32'),'callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':_0xfecb('0x33'),'attributes':['id',_0xfecb('0x3'),_0xfecb('0x34'),_0xfecb('0x35')]},{'model':_0xfecb('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0xfecb('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0xfecb('0x3'),'callerid','active']},{'model':_0xfecb('0x37'),'as':'Interval','attributes':['id',_0xfecb('0x3')],'include':[{'model':'Interval','as':_0xfecb('0x38'),'attributes':['id',_0xfecb('0x3'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x1e61=['acw','acwTimeout','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','interval','../client','Request','GetVoiceQueue','name'];(function(_0x581370,_0x2338eb){var _0x414db0=function(_0x543ab4){while(--_0x543ab4){_0x581370['push'](_0x581370['shift']());}};_0x414db0(++_0x2338eb);}(_0x1e61,0x170));var _0x11e6=function(_0x34f5f8,_0x232eb7){_0x34f5f8=_0x34f5f8-0x0;var _0x29d447=_0x1e61[_0x34f5f8];return _0x29d447;};'use strict';var client=require(_0x11e6('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x11e6('0x1')](_0x11e6('0x2'),{'options':{'raw':![],'attributes':['id',_0x11e6('0x3'),_0x11e6('0x4'),_0x11e6('0x5'),'autopause','monitor_format',_0x11e6('0x6'),_0x11e6('0x7'),_0x11e6('0x8'),_0x11e6('0x9'),_0x11e6('0xa'),_0x11e6('0xb'),_0x11e6('0xc'),_0x11e6('0xd'),_0x11e6('0xe'),_0x11e6('0xf'),_0x11e6('0x10'),_0x11e6('0x11'),_0x11e6('0x12'),_0x11e6('0x13'),_0x11e6('0x14'),_0x11e6('0x15'),_0x11e6('0x16'),'dialBusyMaxRetry',_0x11e6('0x17'),'dialNoAnswerMaxRetry',_0x11e6('0x18'),_0x11e6('0x19'),'dialTimezone',_0x11e6('0x1a'),_0x11e6('0x1b'),_0x11e6('0x1c'),_0x11e6('0x1d'),_0x11e6('0x1e'),_0x11e6('0x1f'),'dialAMDAfterGreetingSilence',_0x11e6('0x20'),_0x11e6('0x21'),_0x11e6('0x22'),'dialAMDMaximumNumberOfWords',_0x11e6('0x23'),'dialAMDMaximumWordLength',_0x11e6('0x24'),_0x11e6('0x25'),'dialRecallInQueue',_0x11e6('0x26'),_0x11e6('0x27'),_0x11e6('0x28'),_0x11e6('0x29'),_0x11e6('0x2a'),_0x11e6('0x2b'),_0x11e6('0x2c'),_0x11e6('0x2d'),'dialNoSuchNumberMaxRetry',_0x11e6('0x2e'),_0x11e6('0x2f'),'dialDropRetryFrequency',_0x11e6('0x30'),_0x11e6('0x31'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x11e6('0x32'),_0x11e6('0x33'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x11e6('0x34'),_0x11e6('0x35'),'dialPreviewRecallmeReminder',_0x11e6('0x36')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id','name','callerid',_0x11e6('0x37')]},{'model':_0x11e6('0x38'),'as':_0x11e6('0x39'),'attributes':['id',_0x11e6('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x11e6('0x3'),_0x11e6('0x3a'),_0x11e6('0x37')]},{'model':_0x11e6('0x3b'),'as':_0x11e6('0x3b'),'attributes':['id',_0x11e6('0x3')],'include':[{'model':_0x11e6('0x3b'),'as':_0x11e6('0x3c'),'attributes':['id',_0x11e6('0x3'),_0x11e6('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ec28ab6..424e6d7 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(_0x1dc630,_0x2e5472){var _0x287da3=function(_0x362647){while(--_0x362647){_0x1dc630['push'](_0x1dc630['shift']());}};_0x287da3(++_0x2e5472);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x480f56,_0x297969){var _0xc85ab9=function(_0x3cd85b){while(--_0x3cd85b){_0x480f56['push'](_0x480f56['shift']());}};_0xc85ab9(++_0x297969);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 eb8b941..366598d 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 _0xd07f=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x14674d,_0x41db2f){var _0x195f61=function(_0x57f242){while(--_0x57f242){_0x14674d['push'](_0x14674d['shift']());}};_0x195f61(++_0x41db2f);}(_0xd07f,0x126));var _0xfd07=function(_0x1c15c0,_0x2d366c){_0x1c15c0=_0x1c15c0-0x0;var _0x68b389=_0xd07f[_0x1c15c0];return _0x68b389;};'use strict';var client=require(_0xfd07('0x0'));exports[_0xfd07('0x1')]=function(_0x5bf937){return function(){return client['Request'](_0xfd07('0x2'),{'options':{'where':{'VoiceQueueId':_0x5bf937,'paused':!![]},'raw':!![]},'log':_0xfd07('0x1')});};}; \ No newline at end of file +var _0xb287=['getVoiceQueueRtPauses','../client','GetVoiceQueueRtPauses'];(function(_0xec1b03,_0x1ed76f){var _0x140c51=function(_0x2081cb){while(--_0x2081cb){_0xec1b03['push'](_0xec1b03['shift']());}};_0x140c51(++_0x1ed76f);}(_0xb287,0xb2));var _0x7b28=function(_0x2d4032,_0x2d969d){_0x2d4032=_0x2d4032-0x0;var _0x4b1bba=_0xb287[_0x2d4032];return _0x4b1bba;};'use strict';var client=require(_0x7b28('0x0'));exports['getVoiceQueueRtPauses']=function(_0x387820){return function(){return client['Request'](_0x7b28('0x1'),{'options':{'where':{'VoiceQueueId':_0x387820,'paused':!![]},'raw':!![]},'log':_0x7b28('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 220e445..94e52c1 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(_0x470701,_0x48aef){var _0x409ad6=function(_0x2ccc44){while(--_0x2ccc44){_0x470701['push'](_0x470701['shift']());}};_0x409ad6(++_0x48aef);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x45a95f,_0x3a0ea9){var _0x3c3156=function(_0x274cc7){while(--_0x274cc7){_0x45a95f['push'](_0x45a95f['shift']());}};_0x3c3156(++_0x3a0ea9);}(_0x7a54,0x106));var _0x47a5=function(_0x1d23d1,_0xd3e539){_0x1d23d1=_0x1d23d1-0x0;var _0x28618a=_0x7a54[_0x1d23d1];return _0x28618a;};'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 0c44be8..7e2400a 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 _0xb710=['CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransfererexten','../client','transfers','blindTransfer','Request'];(function(_0x2411ea,_0x4e2188){var _0x4b9644=function(_0x3273ad){while(--_0x3273ad){_0x2411ea['push'](_0x2411ea['shift']());}};_0x4b9644(++_0x4e2188);}(_0xb710,0xa1));var _0x0b71=function(_0x486f00,_0x283182){_0x486f00=_0x486f00-0x0;var _0x2b29a8=_0xb710[_0x486f00];return _0x2b29a8;};'use strict';var client=require(_0x0b71('0x0'));exports[_0x0b71('0x1')]={};exports[_0x0b71('0x2')]=function(_0x578d26){return client[_0x0b71('0x3')](_0x0b71('0x4'),{'body':{'result':_0x578d26['result'],'transfererchannel':_0x578d26[_0x0b71('0x5')],'transferercalleridnum':_0x578d26['transferercalleridnum'],'transferercalleridname':_0x578d26[_0x0b71('0x6')],'transfererconnectedlinenum':_0x578d26[_0x0b71('0x7')],'transfererconnectedlinename':_0x578d26[_0x0b71('0x8')],'transfereraccountcode':_0x578d26['transfereraccountcode'],'transferercontext':_0x578d26[_0x0b71('0x9')],'transfererexten':_0x578d26[_0x0b71('0xa')],'transfererlinkedid':_0x578d26['transfererlinkedid'],'transfereechannel':_0x578d26[_0x0b71('0xb')],'transfereecalleridnum':_0x578d26[_0x0b71('0xc')],'transfereecalleridname':_0x578d26['transfereecalleridname'],'transfereeconnectedlinenum':_0x578d26[_0x0b71('0xd')],'transfereeconnectedlinename':_0x578d26[_0x0b71('0xe')],'transfereeaccountcode':_0x578d26[_0x0b71('0xf')],'transfereecontext':_0x578d26[_0x0b71('0x10')],'transfereeexten':_0x578d26[_0x0b71('0x11')],'transfereelinkedid':_0x578d26['transfereelinkedid'],'isexternal':_0x578d26[_0x0b71('0x12')],'context':_0x578d26[_0x0b71('0x13')],'extension':_0x578d26['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0xb380fe){return client[_0x0b71('0x3')](_0x0b71('0x4'),{'body':{'result':_0xb380fe['result'],'transfererchannel':_0xb380fe['origtransfererchannel'],'transferercalleridnum':_0xb380fe[_0x0b71('0x14')],'transferercalleridname':_0xb380fe[_0x0b71('0x15')],'transfererconnectedlinenum':_0xb380fe[_0x0b71('0x16')],'transfererconnectedlinename':_0xb380fe['secondtransfererconnectedlinename'],'transfereraccountcode':_0xb380fe[_0x0b71('0x17')],'transferercontext':_0xb380fe[_0x0b71('0x18')],'transfererexten':_0xb380fe[_0x0b71('0x19')],'transfererlinkedid':_0xb380fe[_0x0b71('0x1a')],'transfereechannel':_0xb380fe['transfertargetchannel'],'transfereecalleridnum':_0xb380fe[_0x0b71('0x1b')],'transfereecalleridname':_0xb380fe['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb380fe[_0x0b71('0x1c')],'transfereeconnectedlinename':_0xb380fe['transfertargetconnectedlinename'],'transfereeaccountcode':_0xb380fe[_0x0b71('0x1d')],'transfereecontext':_0xb380fe[_0x0b71('0x1e')],'transfereeexten':_0xb380fe[_0x0b71('0x1f')],'transfereelinkedid':_0xb380fe['transfertargetlinkedid'],'isexternal':_0xb380fe[_0x0b71('0x12')],'context':_0xb380fe['origtransferercontext'],'extension':_0xb380fe[_0x0b71('0x20')],'type':'attended'},'log':_0x0b71('0x4')});}; \ No newline at end of file +var _0x4426=['transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext'];(function(_0x38c221,_0x523596){var _0x6751ea=function(_0x26050f){while(--_0x26050f){_0x38c221['push'](_0x38c221['shift']());}};_0x6751ea(++_0x523596);}(_0x4426,0xc1));var _0x6442=function(_0x45b271,_0x409a71){_0x45b271=_0x45b271-0x0;var _0x51949a=_0x4426[_0x45b271];return _0x51949a;};'use strict';var client=require(_0x6442('0x0'));exports[_0x6442('0x1')]={};exports['blindTransfer']=function(_0x33a050){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x33a050[_0x6442('0x2')],'transfererchannel':_0x33a050[_0x6442('0x3')],'transferercalleridnum':_0x33a050[_0x6442('0x4')],'transferercalleridname':_0x33a050[_0x6442('0x5')],'transfererconnectedlinenum':_0x33a050[_0x6442('0x6')],'transfererconnectedlinename':_0x33a050['transfererconnectedlinename'],'transfereraccountcode':_0x33a050['transfereraccountcode'],'transferercontext':_0x33a050[_0x6442('0x7')],'transfererexten':_0x33a050[_0x6442('0x8')],'transfererlinkedid':_0x33a050[_0x6442('0x9')],'transfereechannel':_0x33a050[_0x6442('0xa')],'transfereecalleridnum':_0x33a050['transfereecalleridnum'],'transfereecalleridname':_0x33a050[_0x6442('0xb')],'transfereeconnectedlinenum':_0x33a050[_0x6442('0xc')],'transfereeconnectedlinename':_0x33a050[_0x6442('0xd')],'transfereeaccountcode':_0x33a050[_0x6442('0xe')],'transfereecontext':_0x33a050[_0x6442('0xf')],'transfereeexten':_0x33a050[_0x6442('0x10')],'transfereelinkedid':_0x33a050[_0x6442('0x11')],'isexternal':_0x33a050[_0x6442('0x12')],'context':_0x33a050['context'],'extension':_0x33a050[_0x6442('0x13')],'type':_0x6442('0x14')},'log':_0x6442('0x15')});};exports[_0x6442('0x16')]=function(_0x18c05f){return client[_0x6442('0x17')](_0x6442('0x15'),{'body':{'result':_0x18c05f[_0x6442('0x2')],'transfererchannel':_0x18c05f['origtransfererchannel'],'transferercalleridnum':_0x18c05f['origtransferercalleridnum'],'transferercalleridname':_0x18c05f['origtransferercalleridname'],'transfererconnectedlinenum':_0x18c05f[_0x6442('0x18')],'transfererconnectedlinename':_0x18c05f[_0x6442('0x19')],'transfereraccountcode':_0x18c05f[_0x6442('0x1a')],'transferercontext':_0x18c05f['secondtransferercontext'],'transfererexten':_0x18c05f[_0x6442('0x1b')],'transfererlinkedid':_0x18c05f[_0x6442('0x1c')],'transfereechannel':_0x18c05f[_0x6442('0x1d')],'transfereecalleridnum':_0x18c05f[_0x6442('0x1e')],'transfereecalleridname':_0x18c05f[_0x6442('0x1f')],'transfereeconnectedlinenum':_0x18c05f[_0x6442('0x20')],'transfereeconnectedlinename':_0x18c05f[_0x6442('0x21')],'transfereeaccountcode':_0x18c05f['transfertargetaccountcode'],'transfereecontext':_0x18c05f[_0x6442('0x22')],'transfereeexten':_0x18c05f[_0x6442('0x23')],'transfereelinkedid':_0x18c05f['transfertargetlinkedid'],'isexternal':_0x18c05f[_0x6442('0x12')],'context':_0x18c05f[_0x6442('0x24')],'extension':_0x18c05f[_0x6442('0x25')],'type':'attended'},'log':_0x6442('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b331c98..ec5dc9d 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 _0x3fa4=['name','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','values','channels','voicechannel','validate','find','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','uniqueid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','filename','toLowerCase','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','checkAfterSend','server','127.0.0.1','lodash','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','timers','timer','agents','updateStatusRealtime','QueuePause','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','then','catch','error','message','isConnected','username','command','Command','content','voiceQueues'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0x3fa4,0xf0));var _0x43fa=function(_0x5aa2af,_0x1019ef){_0x5aa2af=_0x5aa2af-0x0;var _0x46031f=_0x3fa4[_0x5aa2af];return _0x46031f;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x43fa('0x1'));var moment=require(_0x43fa('0x2'));var config=require(_0x43fa('0x3'));var properties=require(_0x43fa('0x4'));var ami=require(_0x43fa('0x5'));exports[_0x43fa('0x6')]=function(_0x41ded6,_0x4cd7ec,_0x2c7789){return new BPromise(function(_0x1e53b3,_0x6df71c){var _0x584209={'QueuePause':function(_0x3dc891){return new Promise(function(_0x46adc7,_0x1dc401){var _0x5a3921=util[_0x43fa('0x7')](_0x43fa('0x8'),'SIP',_0x3dc891['name']);if(_0x41ded6[_0x43fa('0x9')]&&_0x41ded6[_0x43fa('0x9')][_0x5a3921]&&_0x41ded6[_0x43fa('0x9')][_0x5a3921][_0x43fa('0xa')]){_0x41ded6[_0x43fa('0x9')][_0x5a3921]['updateAcw']();}if(_0x41ded6[_0x43fa('0xb')][_0x5a3921]){_0x41ded6[_0x43fa('0xb')][_0x5a3921][_0x43fa('0xc')]({'statePause':_0x3dc891['pause']?!![]:![]});}_0x46adc7({'code':0xc8,'message':_0x43fa('0xd')});});},'Reload':function(_0x4353c1){var _0x4665c1=this;return new Promise(function(_0x529c85,_0x24fb1e){if(ami['isConnected']()==![]){return _0x24fb1e(_0x4665c1['error'](0x1f4,[config['asterisk']['ip'],config[_0x43fa('0xe')]['username'],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}_0x4353c1=_['pick'](_0x4353c1,_[_0x43fa('0x11')](properties[_0x43fa('0x12')]));_0x4353c1[_0x43fa('0x13')]=_0x43fa('0x14');return ami[_0x43fa('0x15')](_0x4353c1)[_0x43fa('0x16')](function(_0x5d12ac){_0x529c85({'code':0xc8,'message':_0x5d12ac['message']});})[_0x43fa('0x17')](function(_0x29b8aa){_0x24fb1e(_0x4665c1[_0x43fa('0x18')](0x1f5,_0x29b8aa[_0x43fa('0x19')]));});});},'Command':function(_0x660f61){var _0x15e594=this;return new Promise(function(_0xdf68a6,_0x2d8594){if(ami[_0x43fa('0x1a')]()==![]){return _0x2d8594(_0x15e594['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')][_0x43fa('0x1b')],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}_0x660f61=_['pick'](_0x660f61,_0x43fa('0x1c'));_0x660f61[_0x43fa('0x13')]=_0x43fa('0x1d');return ami[_0x43fa('0x15')](_0x660f61)[_0x43fa('0x16')](function(_0x1d3328){_0xdf68a6({'code':0xc8,'message':_0x1d3328[_0x43fa('0x1e')]});})[_0x43fa('0x17')](function(_0x427426){_0x2d8594(_0x15e594['error'](0x1f5,_0x427426['message']));});});},'VoiceQueues':function(_0xdb62ec){return new Promise(function(_0x197eac,_0x28f695){var _0x78f105=[];for(var _0x40969a in _0x41ded6[_0x43fa('0x1f')]){if(_0x41ded6['voiceQueues']['hasOwnProperty'](_0x40969a)){var _0x1fa077=_0x41ded6[_0x43fa('0x1f')][_0x40969a];var _0x3d6365={'id':_0x1fa077['id'],'name':_0x1fa077[_0x43fa('0x20')],'strategy':_0x1fa077['strategy'],'answered':_0x1fa077[_0x43fa('0x21')],'available':_0x1fa077[_0x43fa('0x22')],'loggedIn':_0x1fa077[_0x43fa('0x23')],'pTalking':_0x1fa077[_0x43fa('0x24')],'sumBillable':_0x1fa077['sumBillable'],'sumDuration':_0x1fa077[_0x43fa('0x25')],'sumHoldTime':_0x1fa077[_0x43fa('0x26')]||0x0,'talking':_0x1fa077[_0x43fa('0x27')],'total':_0x1fa077[_0x43fa('0x28')],'type':_0x1fa077[_0x43fa('0x29')],'unmanaged':_0x1fa077[_0x43fa('0x2a')],'abandoned':_0x1fa077[_0x43fa('0x2b')],'waiting':_0x1fa077[_0x43fa('0x2c')],'loggedInDb':_0x1fa077[_0x43fa('0x2d')]};if(_0x1fa077[_0x43fa('0x29')]===_0x43fa('0x2e')){_0x3d6365[_0x43fa('0x2f')]=_0x1fa077['dialActive'];_0x3d6365['dialMethod']=_0x1fa077[_0x43fa('0x30')];_0x3d6365[_0x43fa('0x31')]=_0x1fa077[_0x43fa('0x31')];_0x3d6365[_0x43fa('0x32')]=_0x1fa077['dialOriginateCallerIdNumber'];_0x3d6365[_0x43fa('0x33')]=_0x1fa077[_0x43fa('0x33')];_0x3d6365[_0x43fa('0x34')]=_0x1fa077['dialPrefix'];_0x3d6365[_0x43fa('0x35')]=_0x1fa077[_0x43fa('0x35')];_0x3d6365[_0x43fa('0x36')]=_0x1fa077[_0x43fa('0x36')];_0x3d6365['outboundAnswerCallsDay']=_0x1fa077[_0x43fa('0x37')];_0x3d6365['outboundBlacklistCallsDay']=_0x1fa077[_0x43fa('0x38')];_0x3d6365[_0x43fa('0x39')]=_0x1fa077[_0x43fa('0x39')];_0x3d6365['outboundCongestionCallsDay']=_0x1fa077[_0x43fa('0x3a')];_0x3d6365['outboundDropCallsDayACS']=_0x1fa077['outboundDropCallsDayACS'];_0x3d6365[_0x43fa('0x3b')]=_0x1fa077[_0x43fa('0x3b')];_0x3d6365[_0x43fa('0x3c')]=_0x1fa077['outboundDropCallsDayTimeout'];_0x3d6365[_0x43fa('0x3d')]=_0x1fa077[_0x43fa('0x3d')];_0x3d6365[_0x43fa('0x3e')]=_0x1fa077[_0x43fa('0x3e')];_0x3d6365[_0x43fa('0x3f')]=_0x1fa077['outboundOriginateFailureCallsDay'];_0x3d6365[_0x43fa('0x40')]=_0x1fa077[_0x43fa('0x40')];_0x3d6365[_0x43fa('0x41')]=_0x1fa077[_0x43fa('0x41')];_0x3d6365['outboundUnknownCallsDay']=_0x1fa077['outboundUnknownCallsDay'];_0x3d6365[_0x43fa('0x42')]=_0x1fa077[_0x43fa('0x42')];_0x3d6365[_0x43fa('0x43')]=_0x1fa077[_0x43fa('0x43')];_0x3d6365[_0x43fa('0x44')]=_0x1fa077['predictiveIntervalAvgTalktime'];_0x3d6365[_0x43fa('0x45')]=_0x1fa077['predictiveIntervalDroppedCallsCallersExit'];_0x3d6365['predictiveIntervalDroppedCallsTimeout']=_0x1fa077[_0x43fa('0x46')];_0x3d6365['predictiveIntervalErlangCalls']=_0x1fa077[_0x43fa('0x47')];_0x3d6365[_0x43fa('0x48')]=_0x1fa077[_0x43fa('0x48')];_0x3d6365[_0x43fa('0x49')]=_0x1fa077['predictiveIntervalHitRate'];_0x3d6365['predictiveIntervalMultiplicativeFactor']=_0x1fa077['predictiveIntervalMultiplicativeFactor'];_0x3d6365[_0x43fa('0x4a')]=_0x1fa077[_0x43fa('0x4a')];_0x3d6365['predictiveIntervalAvailable']=_0x1fa077[_0x43fa('0x4b')];_0x3d6365[_0x43fa('0x4c')]=_0x1fa077[_0x43fa('0x4c')];_0x3d6365[_0x43fa('0x19')]=_0x1fa077['message'];_0x3d6365[_0x43fa('0x4d')]=_0x1fa077[_0x43fa('0x4d')];_0x3d6365['erlangCalls']=_0x1fa077['erlangCalls'];_0x3d6365[_0x43fa('0x4e')]=_0x1fa077['erlangCallToSecond'];_0x3d6365[_0x43fa('0x4f')]=_0x1fa077[_0x43fa('0x4f')];_0x3d6365['erlangBusyFactor']=_0x1fa077[_0x43fa('0x50')];_0x3d6365['startPredictive']=_0x1fa077[_0x43fa('0x51')];_0x3d6365[_0x43fa('0x52')]=_0x1fa077[_0x43fa('0x52')];}if(_0x1fa077['Trunk']){_0x3d6365[_0x43fa('0x53')]={'id':_0x1fa077[_0x43fa('0x53')]['id'],'name':_0x1fa077[_0x43fa('0x53')][_0x43fa('0x20')],'active':_0x1fa077[_0x43fa('0x53')][_0x43fa('0x54')],'callerid':_0x1fa077['Trunk'][_0x43fa('0x55')]};}if(_0x1fa077['Interval']){_0x3d6365[_0x43fa('0x56')]={'id':_0x1fa077['Interval']['id'],'name':_0x1fa077[_0x43fa('0x56')][_0x43fa('0x20')]};}_0x78f105[_0x43fa('0x57')](_0x3d6365);}}_0x197eac({'count':_0x78f105[_0x43fa('0x58')],'rows':_0x78f105});});},'UpdateVoiceQueue':function(_0x1b8851){return new Promise(function(_0x5575a7,_0x2fffef){var _0x5c96e1=_['find'](_0x41ded6['voiceQueues'],{'id':parseInt(_0x1b8851['id'])});var _0x436da4=_[_0x43fa('0x59')](_0x1b8851,['id']);if(_0x5c96e1){for(var _0x2c246e in _0x436da4){if(typeof _0x436da4[_0x2c246e]!==_0x43fa('0x5a')&&typeof _0x5c96e1[_0x2c246e]!==_0x43fa('0x5a')){_0x5c96e1[_0x2c246e]=_0x436da4[_0x2c246e];}}_0x5575a7(_0x5c96e1);}else{_0x2fffef();}});},'VoiceChannels':function(_0x4d3522){return new Promise(function(_0x42bf1c,_0x1662d5){var _0x305e90=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x5c')]);_0x42bf1c({'count':_0x305e90[_0x43fa('0x58')],'rows':_0x305e90});});},'VoiceChannelMixMonitor':function(_0x1e2acd){var _0x33f828=this;return new Promise(function(_0x345c65,_0x458e11){if(ami[_0x43fa('0x1a')]()==![]){return _0x458e11(_0x33f828['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')]['username'],_0x43fa('0xf')]['join']('\x20')));}var _0x193a0b=schema(properties[_0x43fa('0x5d')])[_0x43fa('0x5e')](_0x1e2acd);if(_0x193a0b[_0x43fa('0x58')]>0x0){return _0x458e11(_0x33f828[_0x43fa('0x18')](0x1f4,_['map'](_0x193a0b,_0x43fa('0x19'))['join'](',\x20')));}var _0x12ac3f=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x5c')],{'uniqueid':_0x1e2acd['uniqueid']});if(_0x12ac3f&&_0x12ac3f['channel']){var _0xc3f7aa=util['format'](_0x43fa('0x60'),_0x1e2acd['filename']||_0x1e2acd['uniqueid'],_0x1e2acd[_0x43fa('0x7')]||_0x43fa('0x61'));return ami['Action']({'action':_0x43fa('0x62'),'channel':_0x12ac3f[_0x43fa('0x63')],'file':_0xc3f7aa,'options':_0x43fa('0x64')})[_0x43fa('0x16')](function(_0x51d224){var _0xb03adb=_[_0x43fa('0x5f')](_0x12ac3f[_0x43fa('0x65')],{'filename':_0x43fa('0x66')+_0xc3f7aa['toLowerCase']()});if(_['isNil'](_0xb03adb)){_0x12ac3f[_0x43fa('0x65')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0xc3f7aa['toLowerCase'](),'createdAt':moment()[_0x43fa('0x7')](_0x43fa('0x67')),'mixmonitorid':_0x51d224[_0x43fa('0x68')],'status':_0x43fa('0x69')});}else{_0xb03adb[_0x43fa('0x68')]=_0x51d224[_0x43fa('0x68')];_0xb03adb[_0x43fa('0x6a')]='rec';}_0x345c65({'code':0xc8,'message':[_0x1e2acd[_0x43fa('0x6b')],_0x43fa('0x6c'),_0x51d224['mixmonitorid']][_0x43fa('0x10')]('\x20'),'mixmonitorid':_0x51d224['mixmonitorid']});})[_0x43fa('0x17')](function(_0x18cea7){_0x458e11(_0x33f828[_0x43fa('0x18')](0x1f5,[_0x1e2acd[_0x43fa('0x6b')],_0x18cea7['message']['toLowerCase']()][_0x43fa('0x10')]('\x20')));});}else{return _0x458e11(_0x33f828[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x3ba2e0){var _0x5aa7af=this;return new Promise(function(_0x4cfc61,_0x4045d1){if(ami['isConnected']()==![]){return _0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')][_0x43fa('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x220e2a=schema(properties['voicechannel'])[_0x43fa('0x5e')](_0x3ba2e0);if(_0x220e2a[_0x43fa('0x58')]>0x0){return _0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f4,_[_0x43fa('0x6e')](_0x220e2a,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x3f89f4=_['find'](_0x41ded6[_0x43fa('0x5c')],{'uniqueid':_0x3ba2e0[_0x43fa('0x6b')]});if(_0x3f89f4){return BPromise[_0x43fa('0x6f')]()[_0x43fa('0x16')](function(){if(_0x3f89f4[_0x43fa('0x63')]){return ami['Action']({'action':_0x43fa('0x70'),'channel':_0x3f89f4[_0x43fa('0x63')],'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]})[_0x43fa('0x17')](function(_0x78f0a9){});}})[_0x43fa('0x16')](function(){if(_0x3f89f4[_0x43fa('0x71')]){return ami[_0x43fa('0x15')]({'action':_0x43fa('0x70'),'channel':_0x3f89f4['destinationchannel'],'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]})[_0x43fa('0x17')](function(_0x2d8a01){});}})[_0x43fa('0x16')](function(_0x31fdeb){var _0x4e9f30=_['find'](_0x3f89f4[_0x43fa('0x65')],{'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]});if(_0x4e9f30){_0x4e9f30[_0x43fa('0x6a')]=_0x43fa('0x72');}})[_0x43fa('0x16')](function(){var _0x2bae57=util[_0x43fa('0x7')](_0x43fa('0x60'),_0x3ba2e0[_0x43fa('0x73')]||_0x3ba2e0[_0x43fa('0x6b')],_0x3ba2e0[_0x43fa('0x7')]||_0x43fa('0x61'));var _0xa96468=_[_0x43fa('0x5f')](_0x3f89f4[_0x43fa('0x65')],{'filename':_0x43fa('0x66')+_0x2bae57[_0x43fa('0x74')]()});if(_0xa96468){_0xa96468[_0x43fa('0x6a')]=_0x43fa('0x72');}})[_0x43fa('0x16')](function(){_0x4cfc61({'code':0xc8,'message':[_0x3ba2e0[_0x43fa('0x6b')],_0x43fa('0x75')]['join']('\x20')});})['catch'](function(_0x2840d9){_0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f5,[_0x3ba2e0['uniqueid'],_0x2840d9[_0x43fa('0x19')]['toLowerCase']()][_0x43fa('0x10')]('\x20')));});}else{return _0x4045d1(_0x5aa7af['error'](0x1f5,_0x43fa('0x6d')));}});},'VoiceQueuesChannels':function(_0x6679e0){return new Promise(function(_0x1b79b3,_0x149093){var _0x61aef=_['values'](_0x41ded6[_0x43fa('0x76')]);_0x1b79b3({'count':_0x61aef['length'],'rows':_0x61aef});});},'VoiceQueuesChannel':function(_0x1ea3a0){var _0x310232=this;return new Promise(function(_0x2ed970,_0x1619ae){var _0x195c8b=schema(properties['voicequeuechannel'])[_0x43fa('0x5e')](_0x1ea3a0);if(_0x195c8b[_0x43fa('0x58')]>0x0){return _0x1619ae(_0x310232['error'](0x1f4,_[_0x43fa('0x6e')](_0x195c8b,'message')[_0x43fa('0x10')](',\x20')));}var _0x3c138c=_['find'](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x1ea3a0[_0x43fa('0x6b')]});if(_0x3c138c){_0x2ed970(_0x3c138c);}else{return _0x1619ae(_0x310232[_0x43fa('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x5c2538){var _0x43088a=this;return new Promise(function(_0x334642,_0x161e93){if(ami[_0x43fa('0x1a')]()==![]){return _0x161e93(_0x43088a['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config['asterisk']['username'],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}var _0xb7596=schema(properties[_0x43fa('0x77')])[_0x43fa('0x5e')](_0x5c2538);if(_0xb7596[_0x43fa('0x58')]>0x0){return _0x161e93(_0x43088a['error'](0x1f4,_[_0x43fa('0x6e')](_0xb7596,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x5779d1=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x5c2538[_0x43fa('0x6b')]});if(_0x5779d1&&_0x5779d1['channel']){return ami[_0x43fa('0x15')]({'action':_0x43fa('0x78'),'channel':_0x5779d1['channel']})['then'](function(_0xa71bb){_0x334642({'code':0xc8,'message':[_0x5c2538[_0x43fa('0x6b')],_0xa71bb[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')});})[_0x43fa('0x17')](function(_0x241200){_0x161e93(_0x43088a[_0x43fa('0x18')](0x1f5,[_0x5c2538[_0x43fa('0x6b')],_0x241200[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')));});}else{return _0x161e93(_0x43088a[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x41ea25){var _0x33b067=this;return new Promise(function(_0x5d3d43,_0x2c3333){if(ami[_0x43fa('0x1a')]()==![]){return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f4,[config[_0x43fa('0xe')]['ip'],config['asterisk'][_0x43fa('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x4931dd=schema(properties[_0x43fa('0x79')])['validate'](_0x41ea25);if(_0x4931dd[_0x43fa('0x58')]>0x0){return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f4,_[_0x43fa('0x6e')](_0x4931dd,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x521d7a=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x41ea25[_0x43fa('0x6b')]});if(_0x521d7a&&_0x521d7a[_0x43fa('0x63')]){return ami['Action']({'action':'Redirect','channel':_0x521d7a['channel'],'exten':_0x41ea25['exten'],'context':_0x41ea25[_0x43fa('0x7a')]||_0x521d7a[_0x43fa('0x7a')],'priority':0x1})[_0x43fa('0x16')](function(_0x583deb){_0x5d3d43({'code':0xc8,'message':[_0x41ea25[_0x43fa('0x6b')],_0x583deb[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')});})['catch'](function(_0x170e69){_0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f5,[_0x41ea25[_0x43fa('0x6b')],_0x170e69[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')));});}else{return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'Agents':function(_0x5c98df){return new Promise(function(_0x4b31b2,_0x278242){var _0xe218b0=_[_0x43fa('0x5b')](_0x41ded6['agents']);_0x4b31b2({'count':_0xe218b0[_0x43fa('0x58')],'rows':_0xe218b0});});},'Telephones':function(_0x3f4839){return new Promise(function(_0x268cb2,_0x563487){var _0x3a3771=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7b')]);_0x268cb2({'count':_0x3a3771['length'],'rows':_0x3a3771});});},'Trunks':function(_0x10123f){return new Promise(function(_0x457006,_0x461abd){var _0x5272eb=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7c')]);_0x457006({'count':_0x5272eb['length'],'rows':_0x5272eb});});},'OutboundChannels':function(_0x733caf){return new Promise(function(_0x941b71,_0xb7fb97){var _0x50a4a9=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7d')]);_0x941b71({'count':_0x50a4a9[_0x43fa('0x58')],'rows':_0x50a4a9});});},'Outbound':function(_0x1d033b){return new Promise(function(_0x2ee768,_0xb7474f){_0x2ee768(_0x41ded6['outbound']);});},'Campaigns':function(_0x179678){return new Promise(function(_0x1e2e8e,_0x302f7c){var _0x1f7593=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7e')]);_0x1e2e8e({'count':_0x1f7593[_0x43fa('0x58')],'rows':_0x1f7593});});},'VoiceQueuesPreview':function(_0x2a56a9){var _0x59cda3=this;return new Promise(function(_0x5a615c,_0x1c881d){_0x4cd7ec[_0x43fa('0x7f')](_0x2a56a9['id'])[_0x43fa('0x16')](function(_0x1f1dd0){_0x5a615c({'code':0xc8,'message':_0x1f1dd0['message']});})[_0x43fa('0x17')](function(_0x374039){_0x1c881d(_0x59cda3['error'](0x1f4,_0x374039[_0x43fa('0x19')]));});});},'EventManager':function(_0x1f240a){var _0x3c2c3c=this;return new Promise(function(_0x1f5df6,_0x187b74){if(!_0x1f240a['event']){return _0x187b74(_0x3c2c3c[_0x43fa('0x18')](0x1f4,_0x43fa('0x80')));}ami[_0x43fa('0x81')](_0x43fa('0x82')+_0x1f240a[_0x43fa('0x83')],_0x1f240a[_0x43fa('0x19')]);_0x1f5df6({'code':0xc8,'message':_0x1f240a});});},'FaxAccounts':function(_0x303923){return new Promise(function(_0xac5e4f,_0x121f31){var _0x5af6e3=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x84')]);_0xac5e4f({'count':_0x5af6e3[_0x43fa('0x58')],'rows':_0x5af6e3});});},'SendFax':function(_0x3ef055){var _0x15230c=this;return new Promise(function(_0x3480c6,_0x1d4217){_0x2c7789['send'](_0x3ef055)[_0x43fa('0x16')](function(_0x5250b4){_0x3480c6({'code':0xc8,'message':_0x5250b4[_0x43fa('0x19')]});})[_0x43fa('0x17')](function(_0x484c73){_0x1d4217(_0x15230c['error'](0x1f4,_0x484c73[_0x43fa('0x19')]));});});},'CheckAfterSend':function(_0x12a889){var _0x30a504=this;return new Promise(function(_0x262aee,_0x131afb){_0x2c7789[_0x43fa('0x85')](_0x12a889)[_0x43fa('0x16')](function(_0xdec4bc){_0x262aee({'code':0xc8,'message':_0xdec4bc['message']});})[_0x43fa('0x17')](function(_0x1c41a1){_0x131afb(_0x30a504[_0x43fa('0x18')](0x1f4,_0x1c41a1[_0x43fa('0x19')]));});});}};var _0x377a73=jayson[_0x43fa('0x86')](_0x584209)['http']();_0x377a73['on']('error',function(_0x5c75b0){return _0x6df71c(_0x5c75b0);});_0x377a73[_0x43fa('0x6')](0x232a,_0x43fa('0x87'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1e53b3('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x7b84=['QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','catch','command','Command','then','message','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','%s.%s','wav','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','context','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause'];(function(_0x1f3b08,_0x102f07){var _0xabd13b=function(_0x2a5ce3){while(--_0x2a5ce3){_0x1f3b08['push'](_0x1f3b08['shift']());}};_0xabd13b(++_0x102f07);}(_0x7b84,0x17c));var _0x47b8=function(_0x8720a0,_0x11ebed){_0x8720a0=_0x8720a0-0x0;var _0x4e26f4=_0x7b84[_0x8720a0];return _0x4e26f4;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var jayson=require(_0x47b8('0x2'));var schema=require(_0x47b8('0x3'));var BPromise=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var config=require(_0x47b8('0x6'));var properties=require('../properties');var ami=require(_0x47b8('0x7'));exports[_0x47b8('0x8')]=function(_0x2279ea,_0x7013d7,_0x2e6853){return new BPromise(function(_0xafe88a,_0x53e656){var _0x3867ca={'QueuePause':function(_0x3ce846){return new Promise(function(_0x46245a,_0xb845c9){var _0x2289d5=util[_0x47b8('0x9')](_0x47b8('0xa'),_0x47b8('0xb'),_0x3ce846[_0x47b8('0xc')]);if(_0x2279ea[_0x47b8('0xd')]&&_0x2279ea[_0x47b8('0xd')][_0x2289d5]&&_0x2279ea[_0x47b8('0xd')][_0x2289d5][_0x47b8('0xe')]){_0x2279ea[_0x47b8('0xd')][_0x2289d5][_0x47b8('0xf')]();}if(_0x2279ea[_0x47b8('0x10')][_0x2289d5]){_0x2279ea[_0x47b8('0x10')][_0x2289d5][_0x47b8('0x11')]({'statePause':_0x3ce846[_0x47b8('0x12')]?!![]:![]});}_0x46245a({'code':0xc8,'message':_0x47b8('0x13')});});},'Reload':function(_0x1edb4b){var _0x127d42=this;return new Promise(function(_0x2d1aaf,_0x268440){if(ami[_0x47b8('0x14')]()==![]){return _0x268440(_0x127d42[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config['asterisk'][_0x47b8('0x17')],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}_0x1edb4b=_[_0x47b8('0x1a')](_0x1edb4b,_[_0x47b8('0x1b')](properties[_0x47b8('0x1c')]));_0x1edb4b[_0x47b8('0x1d')]='Reload';return ami[_0x47b8('0x1e')](_0x1edb4b)['then'](function(_0x525fd6){_0x2d1aaf({'code':0xc8,'message':_0x525fd6['message']});})[_0x47b8('0x1f')](function(_0x36faf1){_0x268440(_0x127d42[_0x47b8('0x15')](0x1f5,_0x36faf1['message']));});});},'Command':function(_0x502a23){var _0x4f6716=this;return new Promise(function(_0x1c5bfd,_0x5531a2){if(ami[_0x47b8('0x14')]()==![]){return _0x5531a2(_0x4f6716[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')]['username'],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}_0x502a23=_[_0x47b8('0x1a')](_0x502a23,_0x47b8('0x20'));_0x502a23[_0x47b8('0x1d')]=_0x47b8('0x21');return ami['Action'](_0x502a23)[_0x47b8('0x22')](function(_0x2a22e3){_0x1c5bfd({'code':0xc8,'message':_0x2a22e3['content']});})[_0x47b8('0x1f')](function(_0x247429){_0x5531a2(_0x4f6716[_0x47b8('0x15')](0x1f5,_0x247429[_0x47b8('0x23')]));});});},'VoiceQueues':function(_0x5604c9){return new Promise(function(_0x35b327,_0x332c23){var _0x319d17=[];for(var _0x3e3de0 in _0x2279ea[_0x47b8('0x24')]){if(_0x2279ea[_0x47b8('0x24')][_0x47b8('0x25')](_0x3e3de0)){var _0x568c1e=_0x2279ea[_0x47b8('0x24')][_0x3e3de0];var _0x1f719a={'id':_0x568c1e['id'],'name':_0x568c1e['name'],'strategy':_0x568c1e[_0x47b8('0x26')],'answered':_0x568c1e[_0x47b8('0x27')],'available':_0x568c1e[_0x47b8('0x28')],'loggedIn':_0x568c1e[_0x47b8('0x29')],'pTalking':_0x568c1e['pTalking'],'sumBillable':_0x568c1e[_0x47b8('0x2a')],'sumDuration':_0x568c1e['sumDuration'],'sumHoldTime':_0x568c1e[_0x47b8('0x2b')]||0x0,'talking':_0x568c1e[_0x47b8('0x2c')],'total':_0x568c1e[_0x47b8('0x2d')],'type':_0x568c1e[_0x47b8('0x2e')],'unmanaged':_0x568c1e['unmanaged'],'abandoned':_0x568c1e[_0x47b8('0x2f')],'waiting':_0x568c1e[_0x47b8('0x30')],'loggedInDb':_0x568c1e[_0x47b8('0x31')]};if(_0x568c1e[_0x47b8('0x2e')]===_0x47b8('0x32')){_0x1f719a[_0x47b8('0x33')]=_0x568c1e['dialActive'];_0x1f719a['dialMethod']=_0x568c1e['dialMethod'];_0x1f719a[_0x47b8('0x34')]=_0x568c1e[_0x47b8('0x34')];_0x1f719a[_0x47b8('0x35')]=_0x568c1e['dialOriginateCallerIdNumber'];_0x1f719a['dialOriginateTimeout']=_0x568c1e['dialOriginateTimeout'];_0x1f719a['dialPrefix']=_0x568c1e[_0x47b8('0x36')];_0x1f719a[_0x47b8('0x37')]=_0x568c1e[_0x47b8('0x37')];_0x1f719a[_0x47b8('0x38')]=_0x568c1e[_0x47b8('0x38')];_0x1f719a[_0x47b8('0x39')]=_0x568c1e[_0x47b8('0x39')];_0x1f719a[_0x47b8('0x3a')]=_0x568c1e[_0x47b8('0x3a')];_0x1f719a['outboundBusyCallsDay']=_0x568c1e['outboundBusyCallsDay'];_0x1f719a[_0x47b8('0x3b')]=_0x568c1e[_0x47b8('0x3b')];_0x1f719a['outboundDropCallsDayACS']=_0x568c1e['outboundDropCallsDayACS'];_0x1f719a[_0x47b8('0x3c')]=_0x568c1e[_0x47b8('0x3c')];_0x1f719a[_0x47b8('0x3d')]=_0x568c1e['outboundDropCallsDayTimeout'];_0x1f719a[_0x47b8('0x3e')]=_0x568c1e[_0x47b8('0x3e')];_0x1f719a['outboundNoSuchCallsDay']=_0x568c1e['outboundNoSuchCallsDay'];_0x1f719a['outboundOriginateFailureCallsDay']=_0x568c1e['outboundOriginateFailureCallsDay'];_0x1f719a[_0x47b8('0x3f')]=_0x568c1e[_0x47b8('0x3f')];_0x1f719a[_0x47b8('0x40')]=_0x568c1e[_0x47b8('0x40')];_0x1f719a[_0x47b8('0x41')]=_0x568c1e[_0x47b8('0x41')];_0x1f719a['predictiveIntervalAnsweredCalls']=_0x568c1e['predictiveIntervalAnsweredCalls'];_0x1f719a[_0x47b8('0x42')]=_0x568c1e[_0x47b8('0x42')];_0x1f719a[_0x47b8('0x43')]=_0x568c1e['predictiveIntervalAvgTalktime'];_0x1f719a['predictiveIntervalDroppedCallsCallersExit']=_0x568c1e[_0x47b8('0x44')];_0x1f719a[_0x47b8('0x45')]=_0x568c1e['predictiveIntervalDroppedCallsTimeout'];_0x1f719a[_0x47b8('0x46')]=_0x568c1e[_0x47b8('0x46')];_0x1f719a['predictiveIntervalErlangCallsDroppedCalls']=_0x568c1e['predictiveIntervalErlangCallsDroppedCalls'];_0x1f719a['predictiveIntervalHitRate']=_0x568c1e['predictiveIntervalHitRate'];_0x1f719a[_0x47b8('0x47')]=_0x568c1e[_0x47b8('0x47')];_0x1f719a[_0x47b8('0x48')]=_0x568c1e[_0x47b8('0x48')];_0x1f719a[_0x47b8('0x49')]=_0x568c1e['predictiveIntervalAvailable'];_0x1f719a[_0x47b8('0x4a')]=_0x568c1e['predictiveIntervalTotalCalls'];_0x1f719a[_0x47b8('0x23')]=_0x568c1e[_0x47b8('0x23')];_0x1f719a[_0x47b8('0x4b')]=_0x568c1e['originated'];_0x1f719a[_0x47b8('0x4c')]=_0x568c1e[_0x47b8('0x4c')];_0x1f719a[_0x47b8('0x4d')]=_0x568c1e[_0x47b8('0x4d')];_0x1f719a[_0x47b8('0x4e')]=_0x568c1e[_0x47b8('0x4e')];_0x1f719a[_0x47b8('0x4f')]=_0x568c1e['erlangBusyFactor'];_0x1f719a[_0x47b8('0x50')]=_0x568c1e['startPredictive'];_0x1f719a[_0x47b8('0x51')]=_0x568c1e[_0x47b8('0x51')];}if(_0x568c1e[_0x47b8('0x52')]){_0x1f719a[_0x47b8('0x52')]={'id':_0x568c1e[_0x47b8('0x52')]['id'],'name':_0x568c1e[_0x47b8('0x52')]['name'],'active':_0x568c1e['Trunk'][_0x47b8('0x53')],'callerid':_0x568c1e[_0x47b8('0x52')][_0x47b8('0x54')]};}if(_0x568c1e['Interval']){_0x1f719a[_0x47b8('0x55')]={'id':_0x568c1e['Interval']['id'],'name':_0x568c1e[_0x47b8('0x55')][_0x47b8('0xc')]};}_0x319d17[_0x47b8('0x56')](_0x1f719a);}}_0x35b327({'count':_0x319d17[_0x47b8('0x57')],'rows':_0x319d17});});},'UpdateVoiceQueue':function(_0x3f13ae){return new Promise(function(_0x5c26c7,_0x40ff24){var _0xfb8041=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x24')],{'id':parseInt(_0x3f13ae['id'])});var _0x1dce38=_[_0x47b8('0x59')](_0x3f13ae,['id']);if(_0xfb8041){for(var _0x46e648 in _0x1dce38){if(typeof _0x1dce38[_0x46e648]!=='undefined'&&typeof _0xfb8041[_0x46e648]!==_0x47b8('0x5a')){_0xfb8041[_0x46e648]=_0x1dce38[_0x46e648];}}_0x5c26c7(_0xfb8041);}else{_0x40ff24();}});},'VoiceChannels':function(_0x4bc93d){return new Promise(function(_0x4020f2,_0x2b46da){var _0x4a46eb=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x5c')]);_0x4020f2({'count':_0x4a46eb[_0x47b8('0x57')],'rows':_0x4a46eb});});},'VoiceChannelMixMonitor':function(_0x33ae87){var _0x223443=this;return new Promise(function(_0x167f24,_0x1b1733){if(ami[_0x47b8('0x14')]()==![]){return _0x1b1733(_0x223443['error'](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],'ami\x20disconnected'][_0x47b8('0x19')]('\x20')));}var _0x5645e6=schema(properties[_0x47b8('0x5d')])[_0x47b8('0x3')](_0x33ae87);if(_0x5645e6['length']>0x0){return _0x1b1733(_0x223443[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0x5645e6,'message')[_0x47b8('0x19')](',\x20')));}var _0x263698=_[_0x47b8('0x58')](_0x2279ea['channels'],{'uniqueid':_0x33ae87[_0x47b8('0x5f')]});if(_0x263698&&_0x263698['channel']){var _0x178427=util['format'](_0x47b8('0x60'),_0x33ae87['filename']||_0x33ae87[_0x47b8('0x5f')],_0x33ae87[_0x47b8('0x9')]||_0x47b8('0x61'));return ami[_0x47b8('0x1e')]({'action':'MixMonitor','channel':_0x263698[_0x47b8('0x62')],'file':_0x178427,'options':_0x47b8('0x63')})[_0x47b8('0x22')](function(_0x115da1){var _0x586cf6=_[_0x47b8('0x58')](_0x263698[_0x47b8('0x64')],{'filename':_0x47b8('0x65')+_0x178427['toLowerCase']()});if(_['isNil'](_0x586cf6)){_0x263698[_0x47b8('0x64')]['push']({'filename':_0x47b8('0x65')+_0x178427[_0x47b8('0x66')](),'createdAt':moment()[_0x47b8('0x9')](_0x47b8('0x67')),'mixmonitorid':_0x115da1['mixmonitorid'],'status':_0x47b8('0x68')});}else{_0x586cf6[_0x47b8('0x69')]=_0x115da1[_0x47b8('0x69')];_0x586cf6['status']='rec';}_0x167f24({'code':0xc8,'message':[_0x33ae87[_0x47b8('0x5f')],_0x47b8('0x6a'),_0x115da1[_0x47b8('0x69')]]['join']('\x20'),'mixmonitorid':_0x115da1[_0x47b8('0x69')]});})[_0x47b8('0x1f')](function(_0x23a759){_0x1b1733(_0x223443[_0x47b8('0x15')](0x1f5,[_0x33ae87['uniqueid'],_0x23a759[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x1b1733(_0x223443['error'](0x1f5,_0x47b8('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x480d8c){var _0x1311aa=this;return new Promise(function(_0x4fc8ac,_0x447ff7){if(ami[_0x47b8('0x14')]()==![]){return _0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f4,[config['asterisk']['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],'ami\x20disconnected'][_0x47b8('0x19')]('\x20')));}var _0x4e1aa7=schema(properties['voicechannel'])['validate'](_0x480d8c);if(_0x4e1aa7[_0x47b8('0x57')]>0x0){return _0x447ff7(_0x1311aa['error'](0x1f4,_[_0x47b8('0x5e')](_0x4e1aa7,'message')[_0x47b8('0x19')](',\x20')));}var _0x4be9dc=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x5c')],{'uniqueid':_0x480d8c[_0x47b8('0x5f')]});if(_0x4be9dc){return BPromise[_0x47b8('0x6c')]()[_0x47b8('0x22')](function(){if(_0x4be9dc['channel']){return ami[_0x47b8('0x1e')]({'action':_0x47b8('0x6d'),'channel':_0x4be9dc[_0x47b8('0x62')],'mixmonitorid':_0x480d8c[_0x47b8('0x69')]})[_0x47b8('0x1f')](function(_0x4ada28){});}})[_0x47b8('0x22')](function(){if(_0x4be9dc[_0x47b8('0x6e')]){return ami['Action']({'action':_0x47b8('0x6d'),'channel':_0x4be9dc[_0x47b8('0x6e')],'mixmonitorid':_0x480d8c[_0x47b8('0x69')]})[_0x47b8('0x1f')](function(_0x5f3771){});}})[_0x47b8('0x22')](function(_0x226d29){var _0x44b461=_[_0x47b8('0x58')](_0x4be9dc[_0x47b8('0x64')],{'mixmonitorid':_0x480d8c[_0x47b8('0x69')]});if(_0x44b461){_0x44b461[_0x47b8('0x6f')]=_0x47b8('0x70');}})[_0x47b8('0x22')](function(){var _0xd55e85=util[_0x47b8('0x9')](_0x47b8('0x60'),_0x480d8c[_0x47b8('0x71')]||_0x480d8c[_0x47b8('0x5f')],_0x480d8c[_0x47b8('0x9')]||_0x47b8('0x61'));var _0x5e4b95=_[_0x47b8('0x58')](_0x4be9dc['monitors'],{'filename':_0x47b8('0x65')+_0xd55e85['toLowerCase']()});if(_0x5e4b95){_0x5e4b95[_0x47b8('0x6f')]=_0x47b8('0x70');}})[_0x47b8('0x22')](function(){_0x4fc8ac({'code':0xc8,'message':[_0x480d8c[_0x47b8('0x5f')],'StopMixMonitor\x20Success'][_0x47b8('0x19')]('\x20')});})[_0x47b8('0x1f')](function(_0x5a7cbe){_0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f5,[_0x480d8c[_0x47b8('0x5f')],_0x5a7cbe[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x447ff7(_0x1311aa[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannels':function(_0x1a38fe){return new Promise(function(_0x56545b,_0x355d01){var _0x1246f9=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x72')]);_0x56545b({'count':_0x1246f9[_0x47b8('0x57')],'rows':_0x1246f9});});},'VoiceQueuesChannel':function(_0x3cf1b6){var _0x547df3=this;return new Promise(function(_0x578a3e,_0x1829f8){var _0xe2c20c=schema(properties[_0x47b8('0x73')])['validate'](_0x3cf1b6);if(_0xe2c20c['length']>0x0){return _0x1829f8(_0x547df3[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0xe2c20c,_0x47b8('0x23'))['join'](',\x20')));}var _0x6ed009=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x72')],{'uniqueid':_0x3cf1b6[_0x47b8('0x5f')]});if(_0x6ed009){_0x578a3e(_0x6ed009);}else{return _0x1829f8(_0x547df3[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0xbac225){var _0x4ad83a=this;return new Promise(function(_0xde73a6,_0x2930cc){if(ami['isConnected']()==![]){return _0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f4,[config[_0x47b8('0x16')]['ip'],config['asterisk'][_0x47b8('0x17')],_0x47b8('0x18')]['join']('\x20')));}var _0xdf662d=schema(properties[_0x47b8('0x74')])['validate'](_0xbac225);if(_0xdf662d[_0x47b8('0x57')]>0x0){return _0x2930cc(_0x4ad83a['error'](0x1f4,_['map'](_0xdf662d,_0x47b8('0x23'))[_0x47b8('0x19')](',\x20')));}var _0x2ded9a=_[_0x47b8('0x58')](_0x2279ea[_0x47b8('0x72')],{'uniqueid':_0xbac225[_0x47b8('0x5f')]});if(_0x2ded9a&&_0x2ded9a[_0x47b8('0x62')]){return ami[_0x47b8('0x1e')]({'action':_0x47b8('0x75'),'channel':_0x2ded9a['channel']})['then'](function(_0x341bf5){_0xde73a6({'code':0xc8,'message':[_0xbac225[_0x47b8('0x5f')],_0x341bf5['message'][_0x47b8('0x66')]()]['join']('\x20')});})[_0x47b8('0x1f')](function(_0x116691){_0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f5,[_0xbac225[_0x47b8('0x5f')],_0x116691[_0x47b8('0x23')][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')));});}else{return _0x2930cc(_0x4ad83a[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x5e4b92){var _0x437cc5=this;return new Promise(function(_0x590577,_0x22f163){if(ami[_0x47b8('0x14')]()==![]){return _0x22f163(_0x437cc5['error'](0x1f4,[config[_0x47b8('0x16')]['ip'],config[_0x47b8('0x16')][_0x47b8('0x17')],_0x47b8('0x18')][_0x47b8('0x19')]('\x20')));}var _0x1dc765=schema(properties['voicequeuechannelredirect'])[_0x47b8('0x3')](_0x5e4b92);if(_0x1dc765[_0x47b8('0x57')]>0x0){return _0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f4,_[_0x47b8('0x5e')](_0x1dc765,_0x47b8('0x23'))[_0x47b8('0x19')](',\x20')));}var _0x398d44=_['find'](_0x2279ea['queueChannels'],{'uniqueid':_0x5e4b92[_0x47b8('0x5f')]});if(_0x398d44&&_0x398d44[_0x47b8('0x62')]){return ami['Action']({'action':'Redirect','channel':_0x398d44[_0x47b8('0x62')],'exten':_0x5e4b92['exten'],'context':_0x5e4b92[_0x47b8('0x76')]||_0x398d44['context'],'priority':0x1})['then'](function(_0x438fc1){_0x590577({'code':0xc8,'message':[_0x5e4b92['uniqueid'],_0x438fc1['message'][_0x47b8('0x66')]()][_0x47b8('0x19')]('\x20')});})['catch'](function(_0x83c650){_0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f5,[_0x5e4b92[_0x47b8('0x5f')],_0x83c650['message']['toLowerCase']()][_0x47b8('0x19')]('\x20')));});}else{return _0x22f163(_0x437cc5[_0x47b8('0x15')](0x1f5,_0x47b8('0x6b')));}});},'Agents':function(_0x19354e){return new Promise(function(_0x23bf13,_0x5237c3){var _0x41e4a7=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x10')]);_0x23bf13({'count':_0x41e4a7['length'],'rows':_0x41e4a7});});},'Telephones':function(_0x50cd3d){return new Promise(function(_0x2dab51,_0x182d57){var _0x37effe=_['values'](_0x2279ea['telephones']);_0x2dab51({'count':_0x37effe[_0x47b8('0x57')],'rows':_0x37effe});});},'Trunks':function(_0x5baf1a){return new Promise(function(_0x9d58bc,_0x45c6e0){var _0x5ab3be=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x77')]);_0x9d58bc({'count':_0x5ab3be['length'],'rows':_0x5ab3be});});},'OutboundChannels':function(_0x57e1f8){return new Promise(function(_0x398685,_0x4ef77b){var _0x4aa570=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x78')]);_0x398685({'count':_0x4aa570[_0x47b8('0x57')],'rows':_0x4aa570});});},'Outbound':function(_0x5703e3){return new Promise(function(_0x3559f4,_0x36e455){_0x3559f4(_0x2279ea[_0x47b8('0x32')]);});},'Campaigns':function(_0xe6cc93){return new Promise(function(_0x2faf37,_0x43c5ce){var _0x34e2cb=_['values'](_0x2279ea[_0x47b8('0x79')]);_0x2faf37({'count':_0x34e2cb[_0x47b8('0x57')],'rows':_0x34e2cb});});},'VoiceQueuesPreview':function(_0x347240){var _0x3c784e=this;return new Promise(function(_0x4281be,_0x289fa7){_0x7013d7[_0x47b8('0x7a')](_0x347240['id'])[_0x47b8('0x22')](function(_0x2136d0){_0x4281be({'code':0xc8,'message':_0x2136d0[_0x47b8('0x23')]});})[_0x47b8('0x1f')](function(_0x1b646e){_0x289fa7(_0x3c784e[_0x47b8('0x15')](0x1f4,_0x1b646e[_0x47b8('0x23')]));});});},'EventManager':function(_0x3df892){var _0x199933=this;return new Promise(function(_0x1524e6,_0x4690a5){if(!_0x3df892[_0x47b8('0x7b')]){return _0x4690a5(_0x199933[_0x47b8('0x15')](0x1f4,_0x47b8('0x7c')));}ami['emit'](_0x47b8('0x7d')+_0x3df892[_0x47b8('0x7b')],_0x3df892['message']);_0x1524e6({'code':0xc8,'message':_0x3df892});});},'FaxAccounts':function(_0xc2596d){return new Promise(function(_0xca5d3d,_0x349cc4){var _0x4dbf55=_[_0x47b8('0x5b')](_0x2279ea[_0x47b8('0x7e')]);_0xca5d3d({'count':_0x4dbf55[_0x47b8('0x57')],'rows':_0x4dbf55});});},'SendFax':function(_0xe0e869){var _0x3565ec=this;return new Promise(function(_0xd0a81a,_0xa7efe3){_0x2e6853[_0x47b8('0x7f')](_0xe0e869)[_0x47b8('0x22')](function(_0x37aa38){_0xd0a81a({'code':0xc8,'message':_0x37aa38[_0x47b8('0x23')]});})['catch'](function(_0x2ce472){_0xa7efe3(_0x3565ec[_0x47b8('0x15')](0x1f4,_0x2ce472[_0x47b8('0x23')]));});});},'CheckAfterSend':function(_0x3ed98e){var _0x3e1971=this;return new Promise(function(_0xc10a53,_0x579df5){_0x2e6853[_0x47b8('0x80')](_0x3ed98e)[_0x47b8('0x22')](function(_0x2db02c){_0xc10a53({'code':0xc8,'message':_0x2db02c['message']});})[_0x47b8('0x1f')](function(_0x542c38){_0x579df5(_0x3e1971[_0x47b8('0x15')](0x1f4,_0x542c38[_0x47b8('0x23')]));});});}};var _0x258f13=jayson[_0x47b8('0x81')](_0x3867ca)[_0x47b8('0x82')]();_0x258f13['on'](_0x47b8('0x15'),function(_0x74851f){return _0x53e656(_0x74851f);});_0x258f13['listen'](0x232a,_0x47b8('0x83'),function(){console[_0x47b8('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xafe88a('RPC\x20listening\x20on\x20port:'+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 7e842cf..a611303 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 _0xd8e8=['data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','uniqueid','join','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','action','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','info','stringify','emit','data2','isNil'];(function(_0x30e804,_0x8d453b){var _0x529374=function(_0x4731c0){while(--_0x4731c0){_0x30e804['push'](_0x30e804['shift']());}};_0x529374(++_0x8d453b);}(_0xd8e8,0xc7));var _0x8d8e=function(_0x5b7c0d,_0x1825bb){_0x5b7c0d=_0x5b7c0d-0x0;var _0x2b835c=_0xd8e8[_0x5b7c0d];return _0x2b835c;};'use strict';var _=require(_0x8d8e('0x0'));var BPromise=require(_0x8d8e('0x1'));var Redis=require(_0x8d8e('0x2'));var util=require(_0x8d8e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x8d8e('0x4'))(_0x8d8e('0x5'));var cmContactRpc=require(_0x8d8e('0x6'));config[_0x8d8e('0x7')]=_['defaults'](config[_0x8d8e('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d8e('0x7')]));function emit(_0x379a57,_0x1989b0,_0x4cd3d5,_0x54cfab,_0x1f7ce0){logger[_0x8d8e('0x8')]('[CM][%s][%s]',_0x379a57,_0x1989b0['id'],_0x4cd3d5,_0x54cfab,JSON[_0x8d8e('0x9')](_0x1f7ce0));io['to'](_0x4cd3d5)[_0x8d8e('0xa')](_0x54cfab,_0x1f7ce0);}exports['exec']=function(_0x8cd02,_0x1213d7,_0x2aa403,_0xd406ff){var _0x3986cc,_0x1c8464;var _0x2ec840={};var _0x3307ae;var _0x5aedf4=Number(_0x2aa403['data1']);var _0x1f66bf=_0x2aa403[_0x8d8e('0xb')]?Boolean(Number(_0x2aa403[_0x8d8e('0xb')])):![];var _0x21ca4e;var _0x292bea=![];if(!_[_0x8d8e('0xc')](_0x2aa403['data5'])){if(_0x2aa403[_0x8d8e('0xd')]=='1')_0x292bea=!![];}if(!_0x292bea){if(_0xd406ff[_0x8d8e('0xe')]){_0x2ec840['id']=_0xd406ff[_0x8d8e('0xe')];}}if(!_0x2ec840['id']){_0x2ec840[_0x8d8e('0xf')]=_0x5aedf4;_0x21ca4e=_0x2aa403[_0x8d8e('0x10')]&&_0x2aa403['data3']!=='0'?_0x2aa403[_0x8d8e('0x10')][_0x8d8e('0x11')](','):['phone'];_0x2ec840[_0x8d8e('0x12')]=_[_0x8d8e('0x13')](_0x21ca4e,function(_0x287596){var _0x3748e2={};_0x3748e2[_0x287596]=_0xd406ff['routeId']?_0xd406ff[_0x8d8e('0x14')]:_0xd406ff[_0x8d8e('0x15')];return _0x3748e2;});_0x3307ae=_0xd406ff[_0x8d8e('0x16')]?_0xd406ff[_0x8d8e('0x14')]:_0xd406ff['calleridnum'];}var _0xa088ad=['id',_0x8d8e('0x17'),_0x8d8e('0x18'),'phone',_0x8d8e('0x19'),_0x8d8e('0x1a'),'ListId',_0x8d8e('0x1b'),_0x8d8e('0x1c'),_0x8d8e('0x1d')];var _0xc5610c=_[_0x8d8e('0x1e')](_0xa088ad,_0x21ca4e);BPromise[_0x8d8e('0x1f')]()[_0x8d8e('0x20')](cmContactRpc['getContacts']({'attributes':_0xc5610c,'where':_0x2ec840,'phone':_0x3307ae}))['then'](function(_0x505d12){_0x1c8464=_0x505d12;if(!_[_0x8d8e('0x21')](_0x1c8464)){if(_0x1c8464[_0x8d8e('0x22')]===0x1){_0x3986cc=_0x1c8464[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0xd406ff[_0x8d8e('0x23')],_0x1213d7['id'],_0x3986cc['id']);}else{logger[_0x8d8e('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xd406ff[_0x8d8e('0x23')],_0x1213d7['id'],_['map'](_0x1c8464,'id')[_0x8d8e('0x24')](','));}return;}else{logger[_0x8d8e('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xd406ff['uniqueid'],_0x1213d7['id']);var _0x78785={'ListId':_0x5aedf4};var _0x36a693=_0x2aa403[_0x8d8e('0x25')]&&_0x2aa403[_0x8d8e('0x25')]!=='0'?_0x2aa403[_0x8d8e('0x25')]:_0x8d8e('0x26');if(_0x1f66bf){logger[_0x8d8e('0x8')](_0x8d8e('0x27'),_0xd406ff[_0x8d8e('0x23')],_0x1213d7['id']);_0x78785[_0x36a693]=_['isNil'](_0xd406ff[_0x8d8e('0x16')])?_0xd406ff['calleridnum']:_0xd406ff['destcalleridnum'];if(_[_0x8d8e('0xc')](_0xd406ff[_0x8d8e('0x16')])){_0x78785[_0x8d8e('0x17')]=_0xd406ff[_0x8d8e('0x28')]&&_0xd406ff['calleridname']!==''?_0xd406ff['calleridname']:_0x8d8e('0x29');}else{_0x78785[_0x8d8e('0x17')]=_0xd406ff[_0x8d8e('0x2a')]&&_0xd406ff['destcalleridname']!==_0x8d8e('0x2b')?_0xd406ff[_0x8d8e('0x2a')]:_0x8d8e('0x29');}return BPromise[_0x8d8e('0x1f')]()['then'](cmContactRpc[_0x8d8e('0x2c')](_0x78785))[_0x8d8e('0x20')](function(_0x397990){_0x3986cc=_0x397990;_0x1c8464['push'](_0x397990);if(_0x3986cc){logger[_0x8d8e('0x8')](_0x8d8e('0x2d'),_0xd406ff['uniqueid'],_0x1213d7['id'],_0x3986cc['id']);}return;});}else{logger[_0x8d8e('0x8')](_0x8d8e('0x2e'),_0xd406ff[_0x8d8e('0x23')],_0x1213d7['id']);_0x78785[_0x36a693]=_[_0x8d8e('0xc')](_0xd406ff[_0x8d8e('0x16')])?_0xd406ff['calleridnum']:_0xd406ff[_0x8d8e('0x14')];if(_['isNil'](_0xd406ff[_0x8d8e('0x16')])){_0x78785['firstName']=_0xd406ff['calleridname']&&_0xd406ff[_0x8d8e('0x28')]!==_0x8d8e('0x2b')?_0xd406ff[_0x8d8e('0x28')]:'Unknown';}else{_0x78785[_0x8d8e('0x17')]=_0xd406ff[_0x8d8e('0x2a')]&&_0xd406ff['destcalleridname']!==_0x8d8e('0x2b')?_0xd406ff[_0x8d8e('0x2a')]:_0x8d8e('0x29');}_0x3986cc=_0x78785;_0x1c8464[_0x8d8e('0x2f')](_0x78785);return;}}})[_0x8d8e('0x20')](function(){if(_0x8cd02){emit(_0xd406ff[_0x8d8e('0x23')],_0x1213d7,util[_0x8d8e('0x30')](_0x8d8e('0x31'),_0x8cd02[_0x8d8e('0x32')]),util[_0x8d8e('0x30')]('trigger:%s',_0x2aa403[_0x8d8e('0x33')]['toLowerCase']()),{'evt':_[_0x8d8e('0x34')](_0xd406ff,{'autoCreate':_0x1f66bf}),'contact':_0x3986cc===undefined?{}:_0x3986cc,'contacts':_0x1c8464[_0x8d8e('0x22')]===0x0?undefined:_0x1c8464});}});}; \ No newline at end of file +var _0x0aeb=['[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','scheduledAt','getContacts','then','isEmpty','length','uniqueid','info'];(function(_0x3aaa94,_0x3fd49b){var _0x47f4d8=function(_0x4facd8){while(--_0x4facd8){_0x3aaa94['push'](_0x3aaa94['shift']());}};_0x47f4d8(++_0x3fd49b);}(_0x0aeb,0x7c));var _0xb0ae=function(_0x53bf85,_0x406cf0){_0x53bf85=_0x53bf85-0x0;var _0x3c73b9=_0x0aeb[_0x53bf85];return _0x3c73b9;};'use strict';var _=require(_0xb0ae('0x0'));var BPromise=require(_0xb0ae('0x1'));var Redis=require('ioredis');var util=require(_0xb0ae('0x2'));var config=require(_0xb0ae('0x3'));var logger=require(_0xb0ae('0x4'))('trigger');var cmContactRpc=require(_0xb0ae('0x5'));config[_0xb0ae('0x6')]=_[_0xb0ae('0x7')](config[_0xb0ae('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xe8ac07,_0x305f83,_0xf4478a,_0x47a30b,_0x1e41d0){logger['info'](_0xb0ae('0x8'),_0xe8ac07,_0x305f83['id'],_0xf4478a,_0x47a30b,JSON[_0xb0ae('0x9')](_0x1e41d0));io['to'](_0xf4478a)['emit'](_0x47a30b,_0x1e41d0);}exports['exec']=function(_0x4a5e33,_0x196a7c,_0x14dfed,_0x373cae){var _0x1ef1cc,_0x36145b;var _0x4772f1={};var _0x3b81f7;var _0x3b2bb6=Number(_0x14dfed[_0xb0ae('0xa')]);var _0x3f99bb=_0x14dfed[_0xb0ae('0xb')]?Boolean(Number(_0x14dfed[_0xb0ae('0xb')])):![];var _0x47413f;var _0x341839=![];if(!_[_0xb0ae('0xc')](_0x14dfed['data5'])){if(_0x14dfed[_0xb0ae('0xd')]=='1')_0x341839=!![];}if(!_0x341839){if(_0x373cae['xmd-contactid']){_0x4772f1['id']=_0x373cae[_0xb0ae('0xe')];}}if(!_0x4772f1['id']){_0x4772f1[_0xb0ae('0xf')]=_0x3b2bb6;_0x47413f=_0x14dfed[_0xb0ae('0x10')]&&_0x14dfed[_0xb0ae('0x10')]!=='0'?_0x14dfed[_0xb0ae('0x10')]['split'](','):['phone'];_0x4772f1[_0xb0ae('0x11')]=_[_0xb0ae('0x12')](_0x47413f,function(_0x3b3418){var _0x3f4c5f={};_0x3f4c5f[_0x3b3418]=_0x373cae[_0xb0ae('0x13')]?_0x373cae[_0xb0ae('0x14')]:_0x373cae[_0xb0ae('0x15')];return _0x3f4c5f;});_0x3b81f7=_0x373cae[_0xb0ae('0x13')]?_0x373cae['destcalleridnum']:_0x373cae[_0xb0ae('0x15')];}var _0x40b7dc=['id','firstName',_0xb0ae('0x16'),'phone',_0xb0ae('0x17'),'fax',_0xb0ae('0xf'),_0xb0ae('0x18'),_0xb0ae('0x19'),'updatedAt'];var _0xce7b8d=_['union'](_0x40b7dc,_0x47413f);BPromise['resolve']()['then'](cmContactRpc[_0xb0ae('0x1a')]({'attributes':_0xce7b8d,'where':_0x4772f1,'phone':_0x3b81f7}))[_0xb0ae('0x1b')](function(_0x3c4ffa){_0x36145b=_0x3c4ffa;if(!_[_0xb0ae('0x1c')](_0x36145b)){if(_0x36145b[_0xb0ae('0x1d')]===0x1){_0x1ef1cc=_0x36145b[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x373cae[_0xb0ae('0x1e')],_0x196a7c['id'],_0x1ef1cc['id']);}else{logger[_0xb0ae('0x1f')](_0xb0ae('0x20'),_0x373cae[_0xb0ae('0x1e')],_0x196a7c['id'],_[_0xb0ae('0x12')](_0x36145b,'id')[_0xb0ae('0x21')](','));}return;}else{logger[_0xb0ae('0x1f')](_0xb0ae('0x22'),_0x373cae[_0xb0ae('0x1e')],_0x196a7c['id']);var _0x540919={'ListId':_0x3b2bb6};var _0x3fd7aa=_0x14dfed[_0xb0ae('0x23')]&&_0x14dfed[_0xb0ae('0x23')]!=='0'?_0x14dfed[_0xb0ae('0x23')]:_0xb0ae('0x24');if(_0x3f99bb){logger[_0xb0ae('0x1f')](_0xb0ae('0x25'),_0x373cae['uniqueid'],_0x196a7c['id']);_0x540919[_0x3fd7aa]=_['isNil'](_0x373cae[_0xb0ae('0x13')])?_0x373cae[_0xb0ae('0x15')]:_0x373cae['destcalleridnum'];if(_['isNil'](_0x373cae[_0xb0ae('0x13')])){_0x540919['firstName']=_0x373cae[_0xb0ae('0x26')]&&_0x373cae[_0xb0ae('0x26')]!==_0xb0ae('0x27')?_0x373cae['calleridname']:_0xb0ae('0x28');}else{_0x540919[_0xb0ae('0x29')]=_0x373cae['destcalleridname']&&_0x373cae['destcalleridname']!==_0xb0ae('0x27')?_0x373cae[_0xb0ae('0x2a')]:_0xb0ae('0x28');}return BPromise[_0xb0ae('0x2b')]()['then'](cmContactRpc[_0xb0ae('0x2c')](_0x540919))[_0xb0ae('0x1b')](function(_0x414ae9){_0x1ef1cc=_0x414ae9;_0x36145b['push'](_0x414ae9);if(_0x1ef1cc){logger[_0xb0ae('0x1f')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x373cae[_0xb0ae('0x1e')],_0x196a7c['id'],_0x1ef1cc['id']);}return;});}else{logger[_0xb0ae('0x1f')](_0xb0ae('0x2d'),_0x373cae[_0xb0ae('0x1e')],_0x196a7c['id']);_0x540919[_0x3fd7aa]=_[_0xb0ae('0xc')](_0x373cae[_0xb0ae('0x13')])?_0x373cae[_0xb0ae('0x15')]:_0x373cae['destcalleridnum'];if(_['isNil'](_0x373cae[_0xb0ae('0x13')])){_0x540919[_0xb0ae('0x29')]=_0x373cae[_0xb0ae('0x26')]&&_0x373cae[_0xb0ae('0x26')]!==_0xb0ae('0x27')?_0x373cae['calleridname']:_0xb0ae('0x28');}else{_0x540919[_0xb0ae('0x29')]=_0x373cae[_0xb0ae('0x2a')]&&_0x373cae['destcalleridname']!==_0xb0ae('0x27')?_0x373cae[_0xb0ae('0x2a')]:'Unknown';}_0x1ef1cc=_0x540919;_0x36145b[_0xb0ae('0x2e')](_0x540919);return;}}})[_0xb0ae('0x1b')](function(){if(_0x4a5e33){emit(_0x373cae[_0xb0ae('0x1e')],_0x196a7c,util[_0xb0ae('0x2f')](_0xb0ae('0x30'),_0x4a5e33['name']),util[_0xb0ae('0x2f')](_0xb0ae('0x31'),_0x14dfed['action'][_0xb0ae('0x32')]()),{'evt':_[_0xb0ae('0x33')](_0x373cae,{'autoCreate':_0x3f99bb}),'contact':_0x1ef1cc===undefined?{}:_0x1ef1cc,'contacts':_0x36145b[_0xb0ae('0x1d')]===0x0?undefined:_0x36145b});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 45b2a1d..2d51552 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 _0x9ed7=['channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','upperFirst','AccountId','value','interaction','event','operator','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','util','lodash','url','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','emit','motionChannel','undefined','voice','checkTriggers','hasOwnProperty','status','merge','variables','Actions','action','toLowerCase','motionbar','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','800','data5','data6','600','winapp','winApplication','format','user:%s','interface','name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','exec','integration','queue','routeId','script','parse','query','search','replace'];(function(_0x2f3d0c,_0x10bf4b){var _0x228c62=function(_0x5106b6){while(--_0x5106b6){_0x2f3d0c['push'](_0x2f3d0c['shift']());}};_0x228c62(++_0x10bf4b);}(_0x9ed7,0x1a6));var _0x79ed=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9ed7[_0x4a53d];return _0x27410e;};'use strict';var util=require(_0x79ed('0x0'));var _=require(_0x79ed('0x1'));var url=require(_0x79ed('0x2'));var Mustache=require('mustache');var Redis=require(_0x79ed('0x3'));var urlforward=require('./urlforward');var integration=require(_0x79ed('0x4'));var cmContact=require(_0x79ed('0x5'));var script=require(_0x79ed('0x6'));var config=require(_0x79ed('0x7'));var logger=require(_0x79ed('0x8'))(_0x79ed('0x9'));var ami=require(_0x79ed('0xa'));config['redis']=_[_0x79ed('0xb')](config[_0x79ed('0xc')],{'host':_0x79ed('0xd'),'port':0x18eb});var io=require(_0x79ed('0xe'))(new Redis(config[_0x79ed('0xc')]));var operators={'equals':function(_0x2cfb84,_0x3d90fe){return _0x2cfb84==_0x3d90fe;},'not_equals':function(_0x56ab7e,_0xc900c6){return _0x56ab7e!=_0xc900c6;}};var barAndWebActions=['popup','url','winapp'];function Trigger(_0x130dc8){this[_0x79ed('0xf')]=_0x130dc8[_0x79ed('0xf')];this[_0x79ed('0x10')]=_0x130dc8['agents'];this['voiceQueues']=_0x130dc8[_0x79ed('0x11')];this[_0x79ed('0x12')]=_0x130dc8[_0x79ed('0x12')];this['voiceExtensions']=_0x130dc8[_0x79ed('0x13')];this[_0x79ed('0x14')]=_0x130dc8[_0x79ed('0x14')];this[_0x79ed('0x15')]=_0x130dc8[_0x79ed('0x15')];this[_0x79ed('0x16')]=_0x130dc8[_0x79ed('0x16')];this['sugarcrmAccounts']=_0x130dc8[_0x79ed('0x17')];this[_0x79ed('0x18')]=_0x130dc8[_0x79ed('0x18')];this[_0x79ed('0x19')]=_0x130dc8['deskAccounts'];this[_0x79ed('0x1a')]=_0x130dc8[_0x79ed('0x1a')];this[_0x79ed('0x1b')]=_0x130dc8[_0x79ed('0x1b')];this[_0x79ed('0x1c')]=_0x130dc8[_0x79ed('0x1c')];this[_0x79ed('0x1d')]=_0x130dc8[_0x79ed('0x1d')];this[_0x79ed('0x1e')]={'zendesk':this[_0x79ed('0x14')],'salesforce':this[_0x79ed('0x16')],'freshdesk':this[_0x79ed('0x15')],'sugarcrm':this[_0x79ed('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0x79ed('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x79ed('0x1c')],'freshsales':this[_0x79ed('0x1d')],'servicenow':this[_0x79ed('0x1b')]};ami['on'](_0x79ed('0x1f'),this['syncCustomEvent'][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x21'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x23'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x24'),this[_0x79ed('0x22')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x25'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x26'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x27'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x28'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x29'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x2a'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x2b'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x2c'),this[_0x79ed('0x2d')]['bind'](this));ami['on']('custom:dialconnect',this[_0x79ed('0x2d')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x2e'),this[_0x79ed('0x2d')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x2f'),this['syncCustomEvent'][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x30'),this['syncCustomEvent'][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x31'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x32'),this['syncCustomEvent'][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x33'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x34'),this['syncCustomEvent'][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x35'),this[_0x79ed('0x22')][_0x79ed('0x20')](this));ami['on'](_0x79ed('0x36'),this['syncCustomEvent'][_0x79ed('0x20')](this));}Trigger[_0x79ed('0x37')]['emit']=function(_0x13060c,_0x5d40d9,_0x2cc339){logger[_0x79ed('0x38')](_0x13060c,_0x5d40d9,JSON['stringify'](_0x2cc339));io['to'](_0x13060c)[_0x79ed('0x39')](_0x5d40d9,_0x2cc339);};Trigger[_0x79ed('0x37')]['syncCustomEvent']=function(_0x5b49cf){var _0x313609=_['clone'](_0x5b49cf);if(typeof _0x313609[_0x79ed('0x3a')]===_0x79ed('0x3b')){_0x313609[_0x79ed('0x3a')]=_0x79ed('0x3c');}this[_0x79ed('0x3d')](_0x313609);};Trigger['prototype'][_0x79ed('0x2d')]=function(_0x1bc25d){if(this[_0x79ed('0x10')][_0x1bc25d['interface']]){this[_0x79ed('0x22')](_0x1bc25d);}};Trigger['prototype'][_0x79ed('0x3d')]=function(_0x56b65b){var _0x25fc6c;for(var _0x13f1f8 in this[_0x79ed('0xf')]){if(this[_0x79ed('0xf')][_0x79ed('0x3e')](_0x13f1f8)){if(this[_0x79ed('0xf')][_0x13f1f8][_0x79ed('0x3f')]){_0x25fc6c=this['checkTrigger'](this[_0x79ed('0xf')][_0x13f1f8],_0x56b65b);if(_0x25fc6c){_[_0x79ed('0x40')](_0x56b65b,_0x56b65b[_0x79ed('0x41')]);for(var _0x35a446=0x0,_0x4364b1,_0x306866,_0x333012;_0x35a4460x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x3c16f7,_0x4cbfe2){var _0x294add=function(_0x2a7e04){while(--_0x2a7e04){_0x3c16f7['push'](_0x3c16f7['shift']());}};_0x294add(++_0x4cbfe2);}(_0x55ca,0x126));var _0xa55c=function(_0xfcfc24,_0x48ca53){_0xfcfc24=_0xfcfc24-0x0;var _0x58f773=_0x55ca[_0xfcfc24];return _0x58f773;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 8a3b8c5..e152850 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 _0x4fee=['\x20eq\x20\x27','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','indexOf','content','ticketType','incident','POST','incidents','assign','getString','Subjects','Descriptions','/contacts(','enduserId','/systemusers(','Fields','callDirection','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','userEmail','length','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','odata-entityid','substring','lastIndexOf','contacts?$select=','&$filter='];(function(_0x1fbafd,_0x1ba0a5){var _0x2ccceb=function(_0x1b71cf){while(--_0x1b71cf){_0x1fbafd['push'](_0x1fbafd['shift']());}};_0x2ccceb(++_0x1ba0a5);}(_0x4fee,0x18f));var _0xe4fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0xe4fe('0x0'));var util=require(_0xe4fe('0x1'));var intUtil=require(_0xe4fe('0x2'));var md5=require(_0xe4fe('0x3'));var Redis=require(_0xe4fe('0x4'));var logger=require(_0xe4fe('0x5'))(_0xe4fe('0x6'));var config=require(_0xe4fe('0x7'));config[_0xe4fe('0x8')]=_[_0xe4fe('0x9')](config[_0xe4fe('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe4fe('0xa'))(new Redis(config[_0xe4fe('0x8')]));function getAuthToken(_0x392437,_0x5b717c,_0x201c87){if(_0x392437['modernAuthentication']){_0x392437[_0xe4fe('0xb')]=_0x392437[_0xe4fe('0xc')][_0xe4fe('0xd')];_0x392437[_0xe4fe('0xe')]=_0x392437['CloudProvider'][_0xe4fe('0xf')];return Promise[_0xe4fe('0x10')](_0x392437[_0xe4fe('0xc')][_0xe4fe('0x11')]);}var _0x14bf22={'method':'POST','uri':_0x5b717c,'form':{'client_id':_0x392437[_0xe4fe('0x12')],'resource':_0x392437[_0xe4fe('0xb')],'username':_0x392437[_0xe4fe('0x13')],'password':_0x392437[_0xe4fe('0x14')],'grant_type':_0xe4fe('0x14'),'client_secret':_0x392437[_0xe4fe('0x15')]},'json':!![]};return rp(_0x14bf22)['then'](function(_0xb78eef){return _0xb78eef[_0xe4fe('0x16')];})[_0xe4fe('0x17')](function(_0x2bad2c){logger['error']('['+[_0x201c87[_0xe4fe('0x18')]()]+_0xe4fe('0x19'));return _0x2bad2c[_0xe4fe('0x1a')];});}function getUser(_0x5b0de7,_0x8599b7,_0x3adf3c,_0x4891d9,_0x48049a,_0x598d33){return new Promise(function(_0x1e2294,_0x24075d){return getAuthToken(_0x8599b7,_0x4891d9,_0x598d33)[_0xe4fe('0x1b')](function(_0x388448){var _0x101f5e={'method':_0xe4fe('0x1c'),'uri':_0x48049a+_0xe4fe('0x1d'),'headers':{'Authorization':_0xe4fe('0x1e')+_0x388448,'OData-Version':_0xe4fe('0x1f')},'json':!![]};return rp(_0x101f5e);})[_0xe4fe('0x1b')](function(_0x347a91){var _0x59e961=_0x347a91['value'];var _0x53b4de=![];var _0x475f04=null;if(!_[_0xe4fe('0x20')](_0x3adf3c)){if(intUtil[_0xe4fe('0x21')](_0x3adf3c['email'])){_0x5b0de7[_0xe4fe('0x22')]=_0x3adf3c['email'];for(_0x475f04=0x0;_0x475f04<_0x59e961[_0xe4fe('0x23')];_0x475f04++){if(_0x59e961[_0x475f04]['internalemailaddress']===_0x3adf3c['email']&&!_0x59e961[_0x475f04]['isdisabled']){_0x53b4de=!![];logger[_0xe4fe('0x24')]('['+[_0x598d33[_0xe4fe('0x18')]()]+_0xe4fe('0x25')+_0x59e961[_0x475f04]['systemuserid']+'!');_0x5b0de7['userId']=_0x59e961[_0x475f04][_0xe4fe('0x26')];}}}}if(!_0x53b4de){logger[_0xe4fe('0x24')]('['+[_0x598d33[_0xe4fe('0x18')]()]+_0xe4fe('0x27'));_0x5b0de7[_0xe4fe('0x22')]=_0x8599b7['username'];for(_0x475f04=0x0;_0x475f04<_0x59e961['length'];_0x475f04++){if(_0x59e961[_0x475f04][_0xe4fe('0x28')]===_0x8599b7[_0xe4fe('0x13')]){_0x5b0de7[_0xe4fe('0x29')]=_0x59e961[_0x475f04][_0xe4fe('0x26')];}}}_0x1e2294(_0x5b0de7);})[_0xe4fe('0x17')](function(_0x4e51a7){_0x24075d(_0x4e51a7[_0xe4fe('0x1a')]);});});}function createEndUser(_0x125979,_0x207a95,_0x4e81e6,_0x358ff7,_0x55f0c0,_0x23c9c3,_0x5a7d7d){return new Promise(function(_0x50f8f0,_0x5080f1){return getAuthToken(_0x207a95,_0x4e81e6,_0x23c9c3)[_0xe4fe('0x1b')](function(_0x34fa09){var _0x172725=_0x23c9c3[_0xe4fe('0x2a')]()===_0xe4fe('0x2b')?_0x55f0c0[_0xe4fe('0x2c')]:_0x55f0c0[_0xe4fe('0x2d')];var _0x15278c={'method':'POST','uri':_0x358ff7+_0xe4fe('0x2e'),'body':{'fullname':_0x172725,'firstname':_0x172725,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x125979['userId']+')'},'headers':{'Authorization':_0xe4fe('0x1e')+_0x34fa09,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x15278c[_0xe4fe('0x2f')][_0x5a7d7d]=_0x172725;return rp(_0x15278c);})['then'](function(_0x2707fb){var _0x5a6e22=_0x2707fb['headers'][_0xe4fe('0x30')];var _0x28c3e0=_0x5a6e22[_0xe4fe('0x31')](_0x5a6e22[_0xe4fe('0x32')]('(')+0x1,_0x5a6e22['lastIndexOf'](')'));_0x125979['enduserId']=_0x28c3e0;_0x50f8f0(_0x125979);})[_0xe4fe('0x17')](function(_0x5ae37c){_0x5080f1(_0x5ae37c['message']);});});}function getEndUser(_0x1ecfe3,_0x3baa45,_0x1112fd,_0x3d2bab,_0x596214,_0x37894c,_0x3f6971,_0x52cc70){var _0x2b47ee=_0x37894c[_0xe4fe('0x2a')]()==='outbound'?_0x596214[_0xe4fe('0x2c')]:_0x596214['calleridnum'];return getAuthToken(_0x3baa45,_0x1112fd,_0x37894c)['then'](function(_0x16d6ac){_0x52cc70=_0x52cc70?_0x52cc70:'telephone1';var _0x407b78={'method':_0xe4fe('0x1c'),'uri':_0x3d2bab+_0xe4fe('0x33')+_0x52cc70+_0xe4fe('0x34')+_0x52cc70+_0xe4fe('0x35')+_0x2b47ee['replace']('+',_0xe4fe('0x36'))+'\x27','headers':{'Authorization':_0xe4fe('0x1e')+_0x16d6ac,'If-None-Match':null,'OData-Version':_0xe4fe('0x1f')},'json':!![]};return rp(_0x407b78);})[_0xe4fe('0x1b')](function(_0x3a96ef){var _0x374c78=![];if(!_0x3a96ef)return _0x374c78;var _0x367438=_0x3a96ef[_0xe4fe('0x37')];for(var _0x2b97a7=0x0;_0x2b97a7<_0x367438[_0xe4fe('0x23')];_0x2b97a7++){if(_0x367438[_0x2b97a7][_0x52cc70]===_0x2b47ee){_0x374c78=!![];_0x1ecfe3['enduserId']=_0x367438[_0x2b97a7]['contactid'];}}return _0x374c78;})[_0xe4fe('0x1b')](function(_0x458deb){if(_0x458deb)return _0x1ecfe3;if(_0x3f6971===_0xe4fe('0x38')){logger[_0xe4fe('0x24')]('['+[_0x37894c[_0xe4fe('0x18')]()]+_0xe4fe('0x39'));return _0x1ecfe3;}return createEndUser(_0x1ecfe3,_0x3baa45,_0x1112fd,_0x3d2bab,_0x596214,_0x37894c,_0x52cc70)[_0xe4fe('0x1b')](function(_0x2ca531){logger[_0xe4fe('0x24')]('['+[_0x37894c['toUpperCase']()]+_0xe4fe('0x3a'),_0x2ca531['enduserId']);return _0x2ca531;});});}function getCustomFields(_0x1f0574,_0x201eaf,_0x51513c){var _0x16009e={};if(_0x1f0574[_0xe4fe('0x23')]>0x0){_[_0xe4fe('0x3b')](_0x1f0574,function(_0x36ed60){if(_[_0xe4fe('0x3c')](['string',_0xe4fe('0x3d')],_0x36ed60[_0xe4fe('0x3e')])&&_0x36ed60[_0xe4fe('0x3f')]&&!_0x36ed60['customField']){var _0x22cefc=_0x36ed60['idField']['toLowerCase']();var _0x3fc9a7=_0x22cefc['substring'](0x0,_0x22cefc[_0xe4fe('0x40')]('_'));var _0x2b942f=_0x22cefc['substring'](_0x22cefc[_0xe4fe('0x40')]('_')+0x1);if(_0x3fc9a7===_0x51513c){_0x16009e[_0x2b942f]=_0x36ed60[_0xe4fe('0x41')];}}});}return _0x16009e;}function getTicket(_0x35f422,_0x4ff8b1,_0x23761c,_0xef9dff,_0x593b5c,_0x2bc1d9,_0x41f31b){return new Promise(function(_0x1aaa21,_0x19e469){var _0x1bf07e;return getAuthToken(_0x4ff8b1,_0x23761c,_0x41f31b)[_0xe4fe('0x1b')](function(_0x498015){if(_0x2bc1d9[_0xe4fe('0x42')]===_0xe4fe('0x43')){_0x1bf07e={'method':_0xe4fe('0x44'),'uri':_0xef9dff+_0xe4fe('0x45'),'body':Object[_0xe4fe('0x46')]({},{'title':intUtil[_0xe4fe('0x47')](_0x2bc1d9[_0xe4fe('0x48')],_0x593b5c,'\x20'),'description':intUtil['getString'](_0x2bc1d9[_0xe4fe('0x49')],_0x593b5c,'\x0a'),'customerid_contact@odata.bind':_0x35f422['enduserId']?_0xe4fe('0x4a')+_0x35f422[_0xe4fe('0x4b')]+')':undefined,'ownerid@odata.bind':_0xe4fe('0x4c')+_0x35f422['userId']+')','caseorigincode':'1'},getCustomFields(_0x2bc1d9[_0xe4fe('0x4d')],_0x593b5c,_0x2bc1d9[_0xe4fe('0x42')])),'headers':{'Authorization':'Bearer\x20'+_0x498015,'OData-Version':_0xe4fe('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2bc1d9['ticketType']==='phonecall'){var _0x41eb9a=_0x35f422[_0xe4fe('0x4b')]?[{'partyid_systemuser@odata.bind':_0xe4fe('0x4c')+_0x35f422['userId']+')','participationtypemask':_0x35f422[_0xe4fe('0x4e')]===_0xe4fe('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0xe4fe('0x4a')+_0x35f422[_0xe4fe('0x4b')]+')','participationtypemask':_0x35f422[_0xe4fe('0x4e')]===_0xe4fe('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe4fe('0x4c')+_0x35f422[_0xe4fe('0x29')]+')','participationtypemask':_0x35f422[_0xe4fe('0x4e')]===_0xe4fe('0x4f')?0x2:0x1}];_0x1bf07e={'method':_0xe4fe('0x44'),'uri':_0xef9dff+'phonecalls','body':Object[_0xe4fe('0x46')]({},{'subject':intUtil['getString'](_0x2bc1d9[_0xe4fe('0x48')],_0x593b5c,'\x20'),'phonenumber':String(_0x593b5c['calleridnum']),'description':intUtil['getString'](_0x2bc1d9[_0xe4fe('0x49')],_0x593b5c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x35f422['enduserId']?_0xe4fe('0x4a')+_0x35f422[_0xe4fe('0x4b')]+')':undefined,'ownerid@odata.bind':_0xe4fe('0x4c')+_0x35f422['userId']+')','directioncode':_0x35f422[_0xe4fe('0x4e')]===_0xe4fe('0x4f')?![]:!![],'phonecall_activity_parties':_0x41eb9a},getCustomFields(_0x2bc1d9['Fields'],_0x593b5c,_0x2bc1d9['ticketType'])),'headers':{'Authorization':_0xe4fe('0x1e')+_0x498015,'OData-Version':_0xe4fe('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1bf07e);})[_0xe4fe('0x1b')](function(_0x1b212e){var _0x2fb0a3=_0x1b212e[_0xe4fe('0x50')]['odata-entityid'];var _0x34d027=_0x2fb0a3[_0xe4fe('0x31')](_0x2fb0a3[_0xe4fe('0x32')]('(')+0x1,_0x2fb0a3['lastIndexOf'](')'));_0x35f422[_0xe4fe('0x51')]=_0x34d027;_0x1aaa21(_0x35f422);})[_0xe4fe('0x17')](function(_0x1277a5){_0x19e469(_0x1277a5[_0xe4fe('0x1a')]);});});}function emit(_0x4e6b46,_0x17dd5c,_0x362988,_0x2c8444){var _0x203157={'uri':util[_0xe4fe('0x52')](_0xe4fe('0x53'),_0x4e6b46,_0x362988,_0x2c8444)};io['to'](util[_0xe4fe('0x52')](_0xe4fe('0x54'),_0x17dd5c))[_0xe4fe('0x55')](_0xe4fe('0x56'),_0x203157);}exports['cs']=function(_0x3eabc2,_0x152996,_0x37ec98,_0x1dfef3,_0x42143e,_0x576939,_0x5b1549,_0x139915){var _0x264154={};_0x576939[_0xe4fe('0xb')]=_0x576939[_0xe4fe('0x57')]?intUtil[_0xe4fe('0x58')](_0x576939['CloudProvider'][_0xe4fe('0xd')]):intUtil[_0xe4fe('0x58')](_0x576939[_0xe4fe('0xb')]);_0x576939[_0xe4fe('0x59')]=intUtil[_0xe4fe('0x58')](_0x576939[_0xe4fe('0x59')]);_0x264154['callDirection']=_0x139915==='queue'||_0x139915==='unmanaged'?_0xe4fe('0x4f'):_0xe4fe('0x2b');var _0x3eba1b=_0x576939[_0xe4fe('0x57')]?util[_0xe4fe('0x52')]('%s/api/data/v9.0/',_0x576939[_0xe4fe('0xc')][_0xe4fe('0xd')]):util[_0xe4fe('0x52')](_0xe4fe('0x5a'),_0x576939['remoteUri']);var _0x1906b2=util['format'](_0xe4fe('0x5b'),_0x576939[_0xe4fe('0xe')]);var _0x4d3a9b=util[_0xe4fe('0x52')](_0xe4fe('0x5c'),_0x576939['serverUrl'],_0x152996['uniqueid'],md5(_0x152996[_0xe4fe('0x5d')]));if(_0x42143e&&_0x42143e[_0xe4fe('0x5e')]){logger[_0xe4fe('0x24')](_0xe4fe('0x5f'),'Recording\x20is\x20enabled!');_0x152996[_0xe4fe('0x60')]=_0x4d3a9b;}else if(_0x5b1549&&_0x5b1549['recordingFormat']&&_0x5b1549['recordingFormat']!==_0xe4fe('0x61')){logger[_0xe4fe('0x24')](_0xe4fe('0x62'),_0xe4fe('0x63'));_0x152996[_0xe4fe('0x60')]=_0x4d3a9b;}else{_0x152996['recordingURL']='';}return getUser(_0x264154,_0x576939,_0x1dfef3,_0x1906b2,_0x3eba1b,_0x139915)[_0xe4fe('0x1b')](function(_0x11cbae){logger[_0xe4fe('0x24')]('['+_0x139915['toUpperCase']()+_0xe4fe('0x64'),_0x11cbae[_0xe4fe('0x29')]);logger[_0xe4fe('0x24')]('['+_0x139915['toUpperCase']()+_0xe4fe('0x65'),_0x11cbae[_0xe4fe('0x22')]);return getEndUser(_0x11cbae,_0x576939,_0x1906b2,_0x3eba1b,_0x152996,_0x139915,_0x37ec98[_0xe4fe('0x66')],_0x37ec98['additionalSearchContact']);})['then'](function(_0x1d03bd){logger[_0xe4fe('0x24')]('['+_0x139915[_0xe4fe('0x18')]()+_0xe4fe('0x67'),_0x1d03bd[_0xe4fe('0x4b')]);logger[_0xe4fe('0x24')]('['+_0x139915[_0xe4fe('0x18')]()+_0xe4fe('0x68'),_0x152996[_0xe4fe('0x2d')]);return getTicket(_0x1d03bd,_0x576939,_0x1906b2,_0x3eba1b,_0x152996,_0x37ec98,_0x139915);})['then'](function(_0x55a240){logger[_0xe4fe('0x24')](util[_0xe4fe('0x52')]('['+_0x139915[_0xe4fe('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x37ec98[_0xe4fe('0x42')],_0x55a240[_0xe4fe('0x51')]));logger[_0xe4fe('0x24')](util[_0xe4fe('0x52')]('['+_0x139915['toUpperCase']()+_0xe4fe('0x69'),_0x139915));if(_0x139915!==_0xe4fe('0x6a')&&_0x37ec98[_0xe4fe('0x6b')]){logger[_0xe4fe('0x24')]('['+_0x139915[_0xe4fe('0x18')]()+']',_0xe4fe('0x6c'));emit(_0x576939[_0xe4fe('0xb')],_0x1dfef3[_0xe4fe('0x6d')],_0x37ec98[_0xe4fe('0x42')],_0x55a240['ticketId']);}})['catch'](function(_0x509651){logger['error']('['+_0x139915['toUpperCase']()+_0xe4fe('0x6e'),_0x509651[_0xe4fe('0x1a')]);console[_0xe4fe('0x6f')](_0xe4fe('0x70'),_0x509651);});}; \ No newline at end of file +var _0xd2d4=['nothing','includes','string','picklist','type','customField','idField','indexOf','content','incident','Subjects','getString','Descriptions','/contacts(','/systemusers(','Fields','ticketType','callDirection','queue','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','username','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','telephone1','&$filter=','replace','%2b','enduserId'];(function(_0xef2133,_0x2dc465){var _0x513140=function(_0x5c645d){while(--_0x5c645d){_0xef2133['push'](_0xef2133['shift']());}};_0x513140(++_0x2dc465);}(_0xd2d4,0x16b));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4d2d('0x0'));var rp=require(_0x4d2d('0x1'));var util=require('util');var intUtil=require(_0x4d2d('0x2'));var md5=require(_0x4d2d('0x3'));var Redis=require('ioredis');var logger=require(_0x4d2d('0x4'))('dynamics365');var config=require(_0x4d2d('0x5'));config[_0x4d2d('0x6')]=_[_0x4d2d('0x7')](config[_0x4d2d('0x6')],{'host':_0x4d2d('0x8'),'port':0x18eb});var io=require(_0x4d2d('0x9'))(new Redis(config['redis']));function getAuthToken(_0x2f4c05,_0x2a8a77,_0x3abd66){if(_0x2f4c05[_0x4d2d('0xa')]){_0x2f4c05[_0x4d2d('0xb')]=_0x2f4c05[_0x4d2d('0xc')][_0x4d2d('0xd')];_0x2f4c05[_0x4d2d('0xe')]=_0x2f4c05[_0x4d2d('0xc')][_0x4d2d('0xf')];return Promise['resolve'](_0x2f4c05[_0x4d2d('0xc')]['data5']);}var _0x5035ae={'method':_0x4d2d('0x10'),'uri':_0x2a8a77,'form':{'client_id':_0x2f4c05['clientId'],'resource':_0x2f4c05[_0x4d2d('0xb')],'username':_0x2f4c05[_0x4d2d('0x11')],'password':_0x2f4c05['password'],'grant_type':'password','client_secret':_0x2f4c05[_0x4d2d('0x12')]},'json':!![]};return rp(_0x5035ae)[_0x4d2d('0x13')](function(_0x34f9a2){return _0x34f9a2[_0x4d2d('0x14')];})['catch'](function(_0x31494f){logger[_0x4d2d('0x15')]('['+[_0x3abd66[_0x4d2d('0x16')]()]+_0x4d2d('0x17'));return _0x31494f['message'];});}function getUser(_0x5aa601,_0x2ec387,_0x5c0c67,_0x3ac83a,_0xef392,_0x255b2e){return new Promise(function(_0x1b2437,_0x41bfe6){return getAuthToken(_0x2ec387,_0x3ac83a,_0x255b2e)[_0x4d2d('0x13')](function(_0x308b1d){var _0x370e52={'method':_0x4d2d('0x18'),'uri':_0xef392+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x4d2d('0x19')+_0x308b1d,'OData-Version':_0x4d2d('0x1a')},'json':!![]};return rp(_0x370e52);})[_0x4d2d('0x13')](function(_0x3bbf01){var _0x1b9a90=_0x3bbf01[_0x4d2d('0x1b')];var _0x2d2731=![];var _0xd09e0f=null;if(!_[_0x4d2d('0x1c')](_0x5c0c67)){if(intUtil[_0x4d2d('0x1d')](_0x5c0c67[_0x4d2d('0x1e')])){_0x5aa601[_0x4d2d('0x1f')]=_0x5c0c67['email'];for(_0xd09e0f=0x0;_0xd09e0f<_0x1b9a90[_0x4d2d('0x20')];_0xd09e0f++){if(_0x1b9a90[_0xd09e0f][_0x4d2d('0x21')]===_0x5c0c67[_0x4d2d('0x1e')]&&!_0x1b9a90[_0xd09e0f][_0x4d2d('0x22')]){_0x2d2731=!![];logger[_0x4d2d('0x23')]('['+[_0x255b2e[_0x4d2d('0x16')]()]+_0x4d2d('0x24')+_0x1b9a90[_0xd09e0f][_0x4d2d('0x25')]+'!');_0x5aa601[_0x4d2d('0x26')]=_0x1b9a90[_0xd09e0f]['systemuserid'];}}}}if(!_0x2d2731){logger[_0x4d2d('0x23')]('['+[_0x255b2e[_0x4d2d('0x16')]()]+_0x4d2d('0x27'));_0x5aa601[_0x4d2d('0x1f')]=_0x2ec387[_0x4d2d('0x11')];for(_0xd09e0f=0x0;_0xd09e0f<_0x1b9a90[_0x4d2d('0x20')];_0xd09e0f++){if(_0x1b9a90[_0xd09e0f][_0x4d2d('0x21')]===_0x2ec387['username']){_0x5aa601[_0x4d2d('0x26')]=_0x1b9a90[_0xd09e0f][_0x4d2d('0x25')];}}}_0x1b2437(_0x5aa601);})[_0x4d2d('0x28')](function(_0x1e72f2){_0x41bfe6(_0x1e72f2[_0x4d2d('0x29')]);});});}function createEndUser(_0x4762f1,_0x305504,_0x95f668,_0x51ea18,_0x1c25f6,_0x4d25e9,_0x39fbdc){return new Promise(function(_0x2ad76e,_0x411d16){return getAuthToken(_0x305504,_0x95f668,_0x4d25e9)[_0x4d2d('0x13')](function(_0x152caf){var _0x34a4dc=_0x4d25e9[_0x4d2d('0x2a')]()===_0x4d2d('0x2b')?_0x1c25f6[_0x4d2d('0x2c')]:_0x1c25f6[_0x4d2d('0x2d')];var _0x1d3f9={'method':_0x4d2d('0x10'),'uri':_0x51ea18+_0x4d2d('0x2e'),'body':{'fullname':_0x34a4dc,'firstname':_0x34a4dc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4762f1[_0x4d2d('0x26')]+')'},'headers':{'Authorization':_0x4d2d('0x19')+_0x152caf,'OData-Version':_0x4d2d('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x1d3f9[_0x4d2d('0x2f')][_0x39fbdc]=_0x34a4dc;return rp(_0x1d3f9);})['then'](function(_0x1b5ffe){var _0x1f3fef=_0x1b5ffe[_0x4d2d('0x30')][_0x4d2d('0x31')];var _0x324025=_0x1f3fef[_0x4d2d('0x32')](_0x1f3fef[_0x4d2d('0x33')]('(')+0x1,_0x1f3fef[_0x4d2d('0x33')](')'));_0x4762f1['enduserId']=_0x324025;_0x2ad76e(_0x4762f1);})['catch'](function(_0x3be25d){_0x411d16(_0x3be25d[_0x4d2d('0x29')]);});});}function getEndUser(_0x18543b,_0x3c2cab,_0x5f5b30,_0x5649bb,_0x393341,_0x519dfe,_0x57941a,_0x4be37f){var _0x58a909=_0x519dfe[_0x4d2d('0x2a')]()===_0x4d2d('0x2b')?_0x393341['destcalleridnum']:_0x393341[_0x4d2d('0x2d')];return getAuthToken(_0x3c2cab,_0x5f5b30,_0x519dfe)[_0x4d2d('0x13')](function(_0x56b389){_0x4be37f=_0x4be37f?_0x4be37f:_0x4d2d('0x34');var _0x558945={'method':'GET','uri':_0x5649bb+'contacts?$select='+_0x4be37f+_0x4d2d('0x35')+_0x4be37f+'\x20eq\x20\x27'+_0x58a909[_0x4d2d('0x36')]('+',_0x4d2d('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x56b389,'If-None-Match':null,'OData-Version':_0x4d2d('0x1a')},'json':!![]};return rp(_0x558945);})['then'](function(_0xb297a6){var _0x5a1565=![];if(!_0xb297a6)return _0x5a1565;var _0x1745ba=_0xb297a6[_0x4d2d('0x1b')];for(var _0x977dbe=0x0;_0x977dbe<_0x1745ba[_0x4d2d('0x20')];_0x977dbe++){if(_0x1745ba[_0x977dbe][_0x4be37f]===_0x58a909){_0x5a1565=!![];_0x18543b[_0x4d2d('0x38')]=_0x1745ba[_0x977dbe]['contactid'];}}return _0x5a1565;})[_0x4d2d('0x13')](function(_0x4e126a){if(_0x4e126a)return _0x18543b;if(_0x57941a===_0x4d2d('0x39')){logger[_0x4d2d('0x23')]('['+[_0x519dfe[_0x4d2d('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x18543b;}return createEndUser(_0x18543b,_0x3c2cab,_0x5f5b30,_0x5649bb,_0x393341,_0x519dfe,_0x4be37f)['then'](function(_0x3160cd){logger[_0x4d2d('0x23')]('['+[_0x519dfe[_0x4d2d('0x16')]()]+']\x20Enduser\x20created!',_0x3160cd['enduserId']);return _0x3160cd;});});}function getCustomFields(_0x1b05d2,_0x308aff,_0x39ba8a){var _0x4572d3={};if(_0x1b05d2[_0x4d2d('0x20')]>0x0){_['forEach'](_0x1b05d2,function(_0x4aa8b5){if(_[_0x4d2d('0x3a')]([_0x4d2d('0x3b'),_0x4d2d('0x3c')],_0x4aa8b5[_0x4d2d('0x3d')])&&_0x4aa8b5['nameField']&&!_0x4aa8b5[_0x4d2d('0x3e')]){var _0x289078=_0x4aa8b5[_0x4d2d('0x3f')][_0x4d2d('0x2a')]();var _0x5189ae=_0x289078[_0x4d2d('0x32')](0x0,_0x289078[_0x4d2d('0x40')]('_'));var _0x1bc226=_0x289078[_0x4d2d('0x32')](_0x289078[_0x4d2d('0x40')]('_')+0x1);if(_0x5189ae===_0x39ba8a){_0x4572d3[_0x1bc226]=_0x4aa8b5[_0x4d2d('0x41')];}}});}return _0x4572d3;}function getTicket(_0x21b4d4,_0x416bd8,_0x1ff6f6,_0x4deff9,_0x1235d2,_0x32fb64,_0x49f252){return new Promise(function(_0x5b1b04,_0x5e0817){var _0x3d9ef9;return getAuthToken(_0x416bd8,_0x1ff6f6,_0x49f252)[_0x4d2d('0x13')](function(_0xdb6a5f){if(_0x32fb64['ticketType']===_0x4d2d('0x42')){_0x3d9ef9={'method':'POST','uri':_0x4deff9+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x32fb64[_0x4d2d('0x43')],_0x1235d2,'\x20'),'description':intUtil[_0x4d2d('0x44')](_0x32fb64[_0x4d2d('0x45')],_0x1235d2,'\x0a'),'customerid_contact@odata.bind':_0x21b4d4[_0x4d2d('0x38')]?_0x4d2d('0x46')+_0x21b4d4['enduserId']+')':undefined,'ownerid@odata.bind':_0x4d2d('0x47')+_0x21b4d4[_0x4d2d('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x32fb64[_0x4d2d('0x48')],_0x1235d2,_0x32fb64[_0x4d2d('0x49')])),'headers':{'Authorization':_0x4d2d('0x19')+_0xdb6a5f,'OData-Version':_0x4d2d('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x32fb64[_0x4d2d('0x49')]==='phonecall'){var _0x335159=_0x21b4d4[_0x4d2d('0x38')]?[{'partyid_systemuser@odata.bind':_0x4d2d('0x47')+_0x21b4d4['userId']+')','participationtypemask':_0x21b4d4[_0x4d2d('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x4d2d('0x46')+_0x21b4d4['enduserId']+')','participationtypemask':_0x21b4d4[_0x4d2d('0x4a')]===_0x4d2d('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4d2d('0x47')+_0x21b4d4['userId']+')','participationtypemask':_0x21b4d4['callDirection']===_0x4d2d('0x4b')?0x2:0x1}];_0x3d9ef9={'method':_0x4d2d('0x10'),'uri':_0x4deff9+'phonecalls','body':Object[_0x4d2d('0x4c')]({},{'subject':intUtil['getString'](_0x32fb64[_0x4d2d('0x43')],_0x1235d2,'\x20'),'phonenumber':String(_0x1235d2[_0x4d2d('0x2d')]),'description':intUtil['getString'](_0x32fb64[_0x4d2d('0x45')],_0x1235d2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x21b4d4['enduserId']?_0x4d2d('0x46')+_0x21b4d4[_0x4d2d('0x38')]+')':undefined,'ownerid@odata.bind':_0x4d2d('0x47')+_0x21b4d4[_0x4d2d('0x26')]+')','directioncode':_0x21b4d4[_0x4d2d('0x4a')]===_0x4d2d('0x4b')?![]:!![],'phonecall_activity_parties':_0x335159},getCustomFields(_0x32fb64[_0x4d2d('0x48')],_0x1235d2,_0x32fb64[_0x4d2d('0x49')])),'headers':{'Authorization':_0x4d2d('0x19')+_0xdb6a5f,'OData-Version':_0x4d2d('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3d9ef9);})[_0x4d2d('0x13')](function(_0x2356c5){var _0x356d7b=_0x2356c5[_0x4d2d('0x30')]['odata-entityid'];var _0x153453=_0x356d7b[_0x4d2d('0x32')](_0x356d7b['lastIndexOf']('(')+0x1,_0x356d7b[_0x4d2d('0x33')](')'));_0x21b4d4[_0x4d2d('0x4d')]=_0x153453;_0x5b1b04(_0x21b4d4);})[_0x4d2d('0x28')](function(_0x40f109){_0x5e0817(_0x40f109[_0x4d2d('0x29')]);});});}function emit(_0x4fd54f,_0x31f423,_0x2abc8e,_0x1b35a0){var _0x7180fa={'uri':util['format'](_0x4d2d('0x4e'),_0x4fd54f,_0x2abc8e,_0x1b35a0)};io['to'](util[_0x4d2d('0x4f')](_0x4d2d('0x50'),_0x31f423))[_0x4d2d('0x51')](_0x4d2d('0x52'),_0x7180fa);}exports['cs']=function(_0x14e7db,_0x2f0c07,_0x322430,_0x11cbfc,_0xa410c3,_0x28cecc,_0x572b07,_0x58fe8a){var _0x112642={};_0x28cecc['remoteUri']=_0x28cecc['modernAuthentication']?intUtil[_0x4d2d('0x53')](_0x28cecc[_0x4d2d('0xc')][_0x4d2d('0xd')]):intUtil[_0x4d2d('0x53')](_0x28cecc[_0x4d2d('0xb')]);_0x28cecc['serverUrl']=intUtil['stripTrailingSlash'](_0x28cecc[_0x4d2d('0x54')]);_0x112642[_0x4d2d('0x4a')]=_0x58fe8a===_0x4d2d('0x4b')||_0x58fe8a==='unmanaged'?_0x4d2d('0x4b'):'outbound';var _0x19ebdb=_0x28cecc[_0x4d2d('0xa')]?util[_0x4d2d('0x4f')](_0x4d2d('0x55'),_0x28cecc[_0x4d2d('0xc')][_0x4d2d('0xd')]):util[_0x4d2d('0x4f')](_0x4d2d('0x55'),_0x28cecc[_0x4d2d('0xb')]);var _0x33e9a1=util[_0x4d2d('0x4f')](_0x4d2d('0x56'),_0x28cecc[_0x4d2d('0xe')]);var _0x3110ce=util[_0x4d2d('0x4f')](_0x4d2d('0x57'),_0x28cecc['serverUrl'],_0x2f0c07[_0x4d2d('0x58')],md5(_0x2f0c07[_0x4d2d('0x58')]));if(_0xa410c3&&_0xa410c3['monitor_format']){logger[_0x4d2d('0x23')](_0x4d2d('0x59'),_0x4d2d('0x5a'));_0x2f0c07[_0x4d2d('0x5b')]=_0x3110ce;}else if(_0x572b07&&_0x572b07[_0x4d2d('0x5c')]&&_0x572b07[_0x4d2d('0x5c')]!==_0x4d2d('0x5d')){logger['info'](_0x4d2d('0x5e'),'Recording\x20is\x20enabled!');_0x2f0c07[_0x4d2d('0x5b')]=_0x3110ce;}else{_0x2f0c07[_0x4d2d('0x5b')]='';}return getUser(_0x112642,_0x28cecc,_0x11cbfc,_0x33e9a1,_0x19ebdb,_0x58fe8a)[_0x4d2d('0x13')](function(_0x5d9f98){logger['info']('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x5f'),_0x5d9f98[_0x4d2d('0x26')]);logger[_0x4d2d('0x23')]('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x60'),_0x5d9f98['userEmail']);return getEndUser(_0x5d9f98,_0x28cecc,_0x33e9a1,_0x19ebdb,_0x2f0c07,_0x58fe8a,_0x322430[_0x4d2d('0x61')],_0x322430['additionalSearchContact']);})[_0x4d2d('0x13')](function(_0x194421){logger[_0x4d2d('0x23')]('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x62'),_0x194421[_0x4d2d('0x38')]);logger[_0x4d2d('0x23')]('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x63'),_0x2f0c07['calleridnum']);return getTicket(_0x194421,_0x28cecc,_0x33e9a1,_0x19ebdb,_0x2f0c07,_0x322430,_0x58fe8a);})['then'](function(_0x4cac63){logger['info'](util[_0x4d2d('0x4f')]('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x64'),_0x322430['ticketType'],_0x4cac63[_0x4d2d('0x4d')]));logger[_0x4d2d('0x23')](util[_0x4d2d('0x4f')]('['+_0x58fe8a[_0x4d2d('0x16')]()+']\x20Call\x20direction:\x20%s',_0x58fe8a));if(_0x58fe8a!=='unmanaged'&&_0x322430[_0x4d2d('0x65')]){logger['info']('['+_0x58fe8a[_0x4d2d('0x16')]()+']',_0x4d2d('0x66'));emit(_0x28cecc[_0x4d2d('0xb')],_0x11cbfc['name'],_0x322430[_0x4d2d('0x49')],_0x4cac63[_0x4d2d('0x4d')]);}})[_0x4d2d('0x28')](function(_0x580aa4){logger['error']('['+_0x58fe8a[_0x4d2d('0x16')]()+_0x4d2d('0x67'),_0x580aa4[_0x4d2d('0x29')]);console['error'](_0x4d2d('0x68'),_0x580aa4);});}; \ 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 9691ce5..deb6dce 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 _0xbc05=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xbc05,0x6f));var _0x5bc0=function(_0x3b1795,_0x498be7){_0x3b1795=_0x3b1795-0x0;var _0x26037c=_0xbc05[_0x3b1795];return _0x26037c;};'use strict';var _=require('lodash');var rp=require(_0x5bc0('0x0'));var md5=require(_0x5bc0('0x1'));var util=require('util');var Redis=require(_0x5bc0('0x2'));var intUtil=require(_0x5bc0('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5bc0('0x4'))('freshdesk');config[_0x5bc0('0x5')]=_['defaults'](config[_0x5bc0('0x5')],{'host':_0x5bc0('0x6'),'port':0x18eb});var io=require(_0x5bc0('0x7'))(new Redis(config[_0x5bc0('0x5')]));var headers={'Content-Type':_0x5bc0('0x8'),'Accept':_0x5bc0('0x8')};function emit(_0x45c6de,_0x2e8e97,_0x36df2a){io['to'](_0x45c6de)[_0x5bc0('0x9')](_0x2e8e97,_0x36df2a);}function getTicket(_0x51b5a3,_0x475da9,_0x3c7d32,_0x4bce6a,_0x3fffbf){logger[_0x5bc0('0xa')](_0x5bc0('0xb'));var _0x36f621=_[_0x5bc0('0xc')]({'responder_id':_0x475da9['id'],'requester_id':_0x3c7d32['id'],'name':util[_0x5bc0('0xd')](_0x5bc0('0xe'),_0x3fffbf[_0x5bc0('0xf')]),'phone':_0x3fffbf[_0x5bc0('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5bc0('0x11')](_0x4bce6a[_0x5bc0('0x12')],_0x3fffbf,'\x20'),'description':intUtil[_0x5bc0('0x11')](_0x4bce6a['Descriptions'],_0x3fffbf,_0x5bc0('0x13')),'tags':getTags(_0x4bce6a['Tags'],_0x5bc0('0x14'))},getCustomFields(_0x4bce6a[_0x5bc0('0x15')],_0x3fffbf));_0x36f621[_0x5bc0('0x16')]=_['mapValues'](_[_0x5bc0('0x17')](_0x36f621[_0x5bc0('0x16')],'id'),_0x5bc0('0x18'));return request({'uri':util[_0x5bc0('0xd')](_0x5bc0('0x19'),_0x51b5a3[_0x5bc0('0x1a')]),'method':_0x5bc0('0x1b'),'body':_0x36f621})[_0x5bc0('0x1c')](function(_0x327206){logger[_0x5bc0('0xa')](_0x5bc0('0x1d'));return _0x327206;});}function getUser(_0x241c5b,_0x4185b4){if(intUtil[_0x5bc0('0x1e')](_0x4185b4)){return request({'uri':util[_0x5bc0('0xd')]('%s/api/v2/agents',_0x241c5b[_0x5bc0('0x1a')]),'qs':{'email':_0x4185b4}})['then'](function(_0x274633){if(_0x274633[_0x5bc0('0x1f')]){logger[_0x5bc0('0xa')](_0x5bc0('0x20'));return _['find'](_0x274633,function(_0x11f9a2){return _0x11f9a2[_0x5bc0('0x21')][_0x5bc0('0x22')]===_0x4185b4;});}else{logger[_0x5bc0('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5bc0('0xd')](_0x5bc0('0x23'),_0x241c5b[_0x5bc0('0x1a')])})[_0x5bc0('0x1c')](function(_0x2995dc){logger[_0x5bc0('0xa')](_0x5bc0('0x24'));return _0x2995dc;});}});}else{logger[_0x5bc0('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5bc0('0xd')](_0x5bc0('0x23'),_0x241c5b[_0x5bc0('0x1a')])})[_0x5bc0('0x1c')](function(_0x68c88f){logger[_0x5bc0('0xa')](_0x5bc0('0x24'));return _0x68c88f;});}}function getEndUser(_0xed45fc,_0xf97898,_0x1690c1){logger[_0x5bc0('0xa')](_0x5bc0('0x25'),_0x1690c1);return request({'uri':util[_0x5bc0('0xd')](_0x5bc0('0x26'),_0xed45fc[_0x5bc0('0x1a')]),'qs':{'phone':_0x1690c1}})[_0x5bc0('0x1c')](function(_0x2071d0){if(_0x2071d0[_0x5bc0('0x1f')]){logger[_0x5bc0('0xa')](_0x5bc0('0x27'));return _[_0x5bc0('0x28')](_0x2071d0,{'phone':_0x1690c1});}else{logger[_0x5bc0('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5bc0('0xd')](_0x5bc0('0x26'),_0xed45fc[_0x5bc0('0x1a')]),'method':_0x5bc0('0x1b'),'body':{'name':_0xf97898,'phone':_0x1690c1}})[_0x5bc0('0x1c')](function(_0x305a5d){logger[_0x5bc0('0xa')](_0x5bc0('0x29'));return _0x305a5d;});}});}function getAuth(_0x2ab53c){return util[_0x5bc0('0xd')](_0x5bc0('0x2a'),new Buffer(_0x2ab53c['apiKey']+':X')[_0x5bc0('0x2b')]('base64'));}function request(_0xb13aee){logger[_0x5bc0('0x2c')](_0x5bc0('0x2d'),JSON[_0x5bc0('0x2e')](_0xb13aee));return rp(_['defaults'](_0xb13aee,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2fba06,_0x517dca){var _0x4d1ad8=[];if(_0x2fba06&&_0x2fba06[_0x5bc0('0x1f')]>0x0){_0x4d1ad8=_['map'](_0x2fba06,_0x517dca);}return _0x4d1ad8;}function getCustomFields(_0x5a2ede,_0x3e4c2e){var _0x39971c=[];var _0x4724c9={'custom_fields':[]};if(_0x5a2ede[_0x5bc0('0x1f')]>0x0){_['forEach'](_0x5a2ede,function(_0xf3699a){if(_[_0x5bc0('0x2f')]([_0x5bc0('0x30'),'picklist'],_0xf3699a[_0x5bc0('0x31')])&&_0xf3699a[_0x5bc0('0x32')]&&!_0xf3699a[_0x5bc0('0x33')]){_0x4724c9[_0xf3699a[_0x5bc0('0x32')][_0x5bc0('0x34')]()]=_0xf3699a[_0x5bc0('0x35')][_0x5bc0('0x2b')]();}else if(_[_0x5bc0('0x2f')]([_0x5bc0('0x30'),_0x5bc0('0x36')],_0xf3699a[_0x5bc0('0x31')])&&_0xf3699a[_0x5bc0('0x37')]&&_0xf3699a[_0x5bc0('0x33')]){_0x4724c9[_0x5bc0('0x16')][_0x5bc0('0x38')]({'id':_0xf3699a[_0x5bc0('0x37')],'value':_0xf3699a[_0x5bc0('0x35')]['toString']()});}else if(_0xf3699a[_0x5bc0('0x31')]===_0x5bc0('0x39')&&_0xf3699a[_0x5bc0('0x3a')]&&_0xf3699a[_0x5bc0('0x37')]&&_0xf3699a['customField']){_0x3e4c2e[_0xf3699a[_0x5bc0('0x3a')]]&&_0x4724c9[_0x5bc0('0x16')][_0x5bc0('0x38')]({'id':_0xf3699a[_0x5bc0('0x37')],'value':_0x3e4c2e[_0xf3699a[_0x5bc0('0x3a')]][_0x5bc0('0x2b')]()});}else if(_0xf3699a[_0x5bc0('0x31')]===_0x5bc0('0x3b')&&_0xf3699a[_0x5bc0('0x3c')]&&_0xf3699a[_0x5bc0('0x3c')][_0x5bc0('0x14')]&&_0xf3699a[_0x5bc0('0x37')]&&_0xf3699a[_0x5bc0('0x33')]){_0x3e4c2e[_0xf3699a[_0x5bc0('0x3c')]['name']['toLowerCase']()]&&_0x4724c9[_0x5bc0('0x16')]['push']({'id':_0xf3699a[_0x5bc0('0x37')],'value':_0x3e4c2e[_0xf3699a['Variable'][_0x5bc0('0x14')]['toLowerCase']()][_0x5bc0('0x2b')]()});}});}return _0x4724c9;}exports[_0x5bc0('0x3d')]=function(_0x2d2c6b,_0x575c56,_0x5058e7,_0x372ba7,_0x41654e,_0x26c7f2){var _0x21855e,_0x30e7e8;_0x26c7f2[_0x5bc0('0x1a')]=intUtil['stripTrailingSlash'](_0x26c7f2[_0x5bc0('0x1a')]);_0x26c7f2[_0x5bc0('0x3e')]=intUtil[_0x5bc0('0x3f')](_0x26c7f2[_0x5bc0('0x3e')]);if(_0x41654e&&_0x41654e[_0x5bc0('0x40')]){logger[_0x5bc0('0xa')](_0x5bc0('0x41'),_0x5bc0('0x42'));_0x575c56[_0x5bc0('0x43')]=util[_0x5bc0('0xd')](_0x5bc0('0x44'),_0x26c7f2[_0x5bc0('0x3e')],_0x575c56[_0x5bc0('0x45')],md5(_0x575c56['uniqueid']));}else{_0x575c56[_0x5bc0('0x43')]='';}headers[_0x5bc0('0x46')]=getAuth(_0x26c7f2);return getUser(_0x26c7f2,_0x372ba7[_0x5bc0('0x22')])[_0x5bc0('0x1c')](function(_0x12e9e4){_0x21855e=_0x12e9e4;logger[_0x5bc0('0xa')](_0x5bc0('0x47'),_0x21855e['id']);return getEndUser(_0x26c7f2,_0x575c56['calleridname'],_0x575c56[_0x5bc0('0x10')]);})[_0x5bc0('0x1c')](function(_0x330a16){_0x30e7e8=_0x330a16;logger[_0x5bc0('0xa')](_0x5bc0('0x48'),_0x30e7e8['id']);return getTicket(_0x26c7f2,_0x21855e,_0x30e7e8,_0x5058e7,_0x575c56);})[_0x5bc0('0x1c')](function(_0x4283cc){if(_0x4283cc&&_0x4283cc['id']){logger['info'](_0x5bc0('0x1d'));logger[_0x5bc0('0xa')](_0x5bc0('0x49'),_0x4283cc['id']);logger['info'](_0x5bc0('0x41'),_0x5bc0('0x4a'));emit(util[_0x5bc0('0xd')](_0x5bc0('0x4b'),_0x372ba7['name']),'trigger:browser:url',{'uri':util['format'](_0x5bc0('0x4c'),_0x26c7f2[_0x5bc0('0x1a')],_0x4283cc['id'])});}})[_0x5bc0('0x4d')](function(_0x3cd6aa){logger[_0x5bc0('0x4e')](_0x5bc0('0x41'),JSON[_0x5bc0('0x2e')](_0x3cd6aa));});};exports[_0x5bc0('0x4f')]=function(_0x2ce8db,_0x5ec014,_0x16c0dc,_0x27707e,_0x49b5fb,_0x1b595e,_0x2cb60c){var _0x3c06c3,_0xe7b24;_0x1b595e[_0x5bc0('0x1a')]=intUtil['stripTrailingSlash'](_0x1b595e['remoteUri']);_0x1b595e['serverUrl']=intUtil[_0x5bc0('0x3f')](_0x1b595e[_0x5bc0('0x3e')]);if(_0x2cb60c&&_0x2cb60c[_0x5bc0('0x50')]&&_0x2cb60c[_0x5bc0('0x50')]!==_0x5bc0('0x51')){logger['info'](_0x5bc0('0x52'),_0x5bc0('0x42'));_0x5ec014[_0x5bc0('0x43')]=util[_0x5bc0('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b595e[_0x5bc0('0x3e')],_0x5ec014['uniqueid'],md5(_0x5ec014['uniqueid']));}headers['Authorization']=getAuth(_0x1b595e);return getUser(_0x1b595e,_0x27707e[_0x5bc0('0x22')])[_0x5bc0('0x1c')](function(_0x52dbba){_0x3c06c3=_0x52dbba;logger[_0x5bc0('0xa')](_0x5bc0('0x47'),_0x3c06c3['id']);return getEndUser(_0x1b595e,_0x5ec014[_0x5bc0('0x53')],_0x5ec014['destcalleridnum']);})[_0x5bc0('0x1c')](function(_0x46dee7){_0xe7b24=_0x46dee7;logger[_0x5bc0('0xa')](_0x5bc0('0x48'),_0xe7b24['id']);return getTicket(_0x1b595e,_0x3c06c3,_0xe7b24,_0x16c0dc,_0x5ec014);})[_0x5bc0('0x1c')](function(_0x27f238){if(_0x27f238&&_0x27f238['id']){logger[_0x5bc0('0xa')](_0x5bc0('0x1d'));logger[_0x5bc0('0xa')](_0x5bc0('0x49'),_0x27f238['id']);logger[_0x5bc0('0xa')]('[OUTBOUND]',_0x5bc0('0x4a'));emit(util[_0x5bc0('0xd')](_0x5bc0('0x4b'),_0x27707e[_0x5bc0('0x14')]),_0x5bc0('0x54'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1b595e[_0x5bc0('0x1a')],_0x27f238['id'])});}})['catch'](function(_0x120dff){logger[_0x5bc0('0x4e')](_0x5bc0('0x52'),JSON[_0x5bc0('0x2e')](_0x120dff));});};exports[_0x5bc0('0x55')]=function(_0x225831,_0x113933,_0x4cb3c8,_0x3de8df,_0x2bf39a,_0xbcd311){var _0xf4b132,_0x2c9482;_0xbcd311['remoteUri']=intUtil['stripTrailingSlash'](_0xbcd311['remoteUri']);_0xbcd311[_0x5bc0('0x3e')]=intUtil['stripTrailingSlash'](_0xbcd311[_0x5bc0('0x3e')]);if(_0x2bf39a&&_0x2bf39a[_0x5bc0('0x40')]){logger[_0x5bc0('0xa')]('['+_0x113933[_0x5bc0('0x56')][_0x5bc0('0x57')]()+']',_0x5bc0('0x42'));_0x113933[_0x5bc0('0x43')]=util[_0x5bc0('0xd')](_0x5bc0('0x44'),_0xbcd311[_0x5bc0('0x3e')],_0x113933['uniqueid'],md5(_0x113933[_0x5bc0('0x45')]));}else{_0x113933[_0x5bc0('0x43')]='';}headers[_0x5bc0('0x46')]=getAuth(_0xbcd311);return getUser(_0xbcd311,'')['then'](function(_0x402042){_0xf4b132=_0x402042;logger[_0x5bc0('0xa')](_0x5bc0('0x47'),_0xf4b132['id']);return getEndUser(_0xbcd311,_0x113933[_0x5bc0('0xf')],_0x113933['calleridnum']);})['then'](function(_0x1da75c){_0x2c9482=_0x1da75c;logger[_0x5bc0('0xa')](_0x5bc0('0x48'),_0x2c9482['id']);return getTicket(_0xbcd311,_0xf4b132,_0x2c9482,_0x4cb3c8,_0x113933);})[_0x5bc0('0x1c')](function(_0x9305f0){if(_0x9305f0){logger['info'](_0x5bc0('0x1d'));logger['info'](_0x5bc0('0x49'),_0x9305f0['id']);}})['catch'](function(_0x5653ff){logger[_0x5bc0('0x4e')]('['+_0x113933[_0x5bc0('0x56')][_0x5bc0('0x57')]()+']',JSON['stringify'](_0x5653ff));});}; \ No newline at end of file +var _0x194e=['POST','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','customField','nameField','toLowerCase','content','picklist','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','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','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','unmanaged','monitor_format','toUpperCase','lastevent','lodash','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x194e,0x93));var _0xe194=function(_0x13e8fd,_0x4358e5){_0x13e8fd=_0x13e8fd-0x0;var _0x21c80b=_0x194e[_0x13e8fd];return _0x21c80b;};'use strict';var _=require(_0xe194('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe194('0x1'));var Redis=require('ioredis');var intUtil=require(_0xe194('0x2'));var config=require(_0xe194('0x3'));var logger=require(_0xe194('0x4'))(_0xe194('0x5'));config[_0xe194('0x6')]=_['defaults'](config['redis'],{'host':_0xe194('0x7'),'port':0x18eb});var io=require(_0xe194('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0xe194('0x9'),'Accept':_0xe194('0x9')};function emit(_0x2043d7,_0x454d55,_0x186660){io['to'](_0x2043d7)[_0xe194('0xa')](_0x454d55,_0x186660);}function getTicket(_0x3896d7,_0x231411,_0x5915c1,_0x4de8e6,_0x54251b){logger['info'](_0xe194('0xb'));var _0x1aed0e=_[_0xe194('0xc')]({'responder_id':_0x231411['id'],'requester_id':_0x5915c1['id'],'name':util[_0xe194('0xd')](_0xe194('0xe'),_0x54251b[_0xe194('0xf')]),'phone':_0x54251b[_0xe194('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe194('0x11')](_0x4de8e6[_0xe194('0x12')],_0x54251b,'\x20'),'description':intUtil[_0xe194('0x11')](_0x4de8e6[_0xe194('0x13')],_0x54251b,_0xe194('0x14')),'tags':getTags(_0x4de8e6[_0xe194('0x15')],_0xe194('0x16'))},getCustomFields(_0x4de8e6[_0xe194('0x17')],_0x54251b));_0x1aed0e[_0xe194('0x18')]=_['mapValues'](_[_0xe194('0x19')](_0x1aed0e['custom_fields'],'id'),_0xe194('0x1a'));return request({'uri':util[_0xe194('0xd')](_0xe194('0x1b'),_0x3896d7[_0xe194('0x1c')]),'method':'POST','body':_0x1aed0e})[_0xe194('0x1d')](function(_0x24d4ee){logger[_0xe194('0x1e')](_0xe194('0x1f'));return _0x24d4ee;});}function getUser(_0x426501,_0x3eb97b){if(intUtil[_0xe194('0x20')](_0x3eb97b)){return request({'uri':util[_0xe194('0xd')](_0xe194('0x21'),_0x426501[_0xe194('0x1c')]),'qs':{'email':_0x3eb97b}})[_0xe194('0x1d')](function(_0x3112f8){if(_0x3112f8[_0xe194('0x22')]){logger[_0xe194('0x1e')]('Agent\x20found!');return _[_0xe194('0x23')](_0x3112f8,function(_0x2720d0){return _0x2720d0[_0xe194('0x24')]['email']===_0x3eb97b;});}else{logger['info'](_0xe194('0x25'));return request({'uri':util['format'](_0xe194('0x26'),_0x426501[_0xe194('0x1c')])})[_0xe194('0x1d')](function(_0x588d09){logger['info'](_0xe194('0x27'));return _0x588d09;});}});}else{logger[_0xe194('0x1e')](_0xe194('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x426501['remoteUri'])})[_0xe194('0x1d')](function(_0x490d72){logger[_0xe194('0x1e')](_0xe194('0x27'));return _0x490d72;});}}function getEndUser(_0x4b3cc3,_0x26621b,_0x19abcd){logger['info'](_0xe194('0x29'),_0x19abcd);return request({'uri':util[_0xe194('0xd')](_0xe194('0x2a'),_0x4b3cc3[_0xe194('0x1c')]),'qs':{'phone':_0x19abcd}})['then'](function(_0x43a1b8){if(_0x43a1b8[_0xe194('0x22')]){logger[_0xe194('0x1e')](_0xe194('0x2b'));return _[_0xe194('0x23')](_0x43a1b8,{'phone':_0x19abcd});}else{logger['info'](_0xe194('0x2c'));return request({'uri':util[_0xe194('0xd')]('%s/api/v2/contacts',_0x4b3cc3['remoteUri']),'method':_0xe194('0x2d'),'body':{'name':_0x26621b,'phone':_0x19abcd}})[_0xe194('0x1d')](function(_0x5058a1){logger[_0xe194('0x1e')]('Enduser\x20created.');return _0x5058a1;});}});}function getAuth(_0xaf2cb7){return util[_0xe194('0xd')](_0xe194('0x2e'),new Buffer(_0xaf2cb7['apiKey']+':X')[_0xe194('0x2f')]('base64'));}function request(_0x443632){logger[_0xe194('0x30')](_0xe194('0x31'),JSON[_0xe194('0x32')](_0x443632));return rp(_['defaults'](_0x443632,{'method':_0xe194('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2b70bf,_0x3e5d1a){var _0xa90f6=[];if(_0x2b70bf&&_0x2b70bf[_0xe194('0x22')]>0x0){_0xa90f6=_[_0xe194('0x34')](_0x2b70bf,_0x3e5d1a);}return _0xa90f6;}function getCustomFields(_0x3e98f9,_0x1127a4){var _0x407c08=[];var _0x4eca47={'custom_fields':[]};if(_0x3e98f9[_0xe194('0x22')]>0x0){_[_0xe194('0x35')](_0x3e98f9,function(_0x1055c6){if(_[_0xe194('0x36')]([_0xe194('0x37'),'picklist'],_0x1055c6[_0xe194('0x38')])&&_0x1055c6['nameField']&&!_0x1055c6[_0xe194('0x39')]){_0x4eca47[_0x1055c6[_0xe194('0x3a')][_0xe194('0x3b')]()]=_0x1055c6[_0xe194('0x3c')]['toString']();}else if(_[_0xe194('0x36')]([_0xe194('0x37'),_0xe194('0x3d')],_0x1055c6[_0xe194('0x38')])&&_0x1055c6[_0xe194('0x3e')]&&_0x1055c6[_0xe194('0x39')]){_0x4eca47[_0xe194('0x18')]['push']({'id':_0x1055c6[_0xe194('0x3e')],'value':_0x1055c6[_0xe194('0x3c')][_0xe194('0x2f')]()});}else if(_0x1055c6['type']===_0xe194('0x3f')&&_0x1055c6[_0xe194('0x40')]&&_0x1055c6[_0xe194('0x3e')]&&_0x1055c6[_0xe194('0x39')]){_0x1127a4[_0x1055c6[_0xe194('0x40')]]&&_0x4eca47[_0xe194('0x18')][_0xe194('0x41')]({'id':_0x1055c6[_0xe194('0x3e')],'value':_0x1127a4[_0x1055c6[_0xe194('0x40')]][_0xe194('0x2f')]()});}else if(_0x1055c6['type']===_0xe194('0x42')&&_0x1055c6['Variable']&&_0x1055c6[_0xe194('0x43')][_0xe194('0x16')]&&_0x1055c6['idField']&&_0x1055c6[_0xe194('0x39')]){_0x1127a4[_0x1055c6[_0xe194('0x43')]['name']['toLowerCase']()]&&_0x4eca47[_0xe194('0x18')][_0xe194('0x41')]({'id':_0x1055c6['idField'],'value':_0x1127a4[_0x1055c6[_0xe194('0x43')]['name'][_0xe194('0x3b')]()]['toString']()});}});}return _0x4eca47;}exports[_0xe194('0x44')]=function(_0x1d28c6,_0x42fba7,_0x360bc1,_0x26370a,_0xa5fca3,_0x3f4784){var _0x470e89,_0x1e8f90;_0x3f4784[_0xe194('0x1c')]=intUtil[_0xe194('0x45')](_0x3f4784['remoteUri']);_0x3f4784[_0xe194('0x46')]=intUtil['stripTrailingSlash'](_0x3f4784[_0xe194('0x46')]);if(_0xa5fca3&&_0xa5fca3['monitor_format']){logger[_0xe194('0x1e')](_0xe194('0x47'),'Recording\x20is\x20enabled!');_0x42fba7['recordingURL']=util[_0xe194('0xd')](_0xe194('0x48'),_0x3f4784[_0xe194('0x46')],_0x42fba7[_0xe194('0x49')],md5(_0x42fba7[_0xe194('0x49')]));}else{_0x42fba7['recordingURL']='';}headers[_0xe194('0x4a')]=getAuth(_0x3f4784);return getUser(_0x3f4784,_0x26370a[_0xe194('0x4b')])[_0xe194('0x1d')](function(_0x5d9547){_0x470e89=_0x5d9547;logger[_0xe194('0x1e')](_0xe194('0x4c'),_0x470e89['id']);return getEndUser(_0x3f4784,_0x42fba7[_0xe194('0xf')],_0x42fba7[_0xe194('0x10')]);})[_0xe194('0x1d')](function(_0x128258){_0x1e8f90=_0x128258;logger[_0xe194('0x1e')](_0xe194('0x4d'),_0x1e8f90['id']);return getTicket(_0x3f4784,_0x470e89,_0x1e8f90,_0x360bc1,_0x42fba7);})[_0xe194('0x1d')](function(_0xdece18){if(_0xdece18&&_0xdece18['id']){logger[_0xe194('0x1e')](_0xe194('0x1f'));logger['info'](_0xe194('0x4e'),_0xdece18['id']);logger[_0xe194('0x1e')](_0xe194('0x47'),_0xe194('0x4f'));emit(util['format'](_0xe194('0x50'),_0x26370a['name']),_0xe194('0x51'),{'uri':util[_0xe194('0xd')](_0xe194('0x52'),_0x3f4784[_0xe194('0x1c')],_0xdece18['id'])});}})[_0xe194('0x53')](function(_0x4dd1c3){logger[_0xe194('0x54')]('[QUEUE]',JSON[_0xe194('0x32')](_0x4dd1c3));});};exports[_0xe194('0x55')]=function(_0x13d126,_0x3774e9,_0x182215,_0x36abff,_0x1829d8,_0x39c4be,_0x2f1291){var _0x1a4d6b,_0x3445ee;_0x39c4be[_0xe194('0x1c')]=intUtil[_0xe194('0x45')](_0x39c4be[_0xe194('0x1c')]);_0x39c4be[_0xe194('0x46')]=intUtil['stripTrailingSlash'](_0x39c4be[_0xe194('0x46')]);if(_0x2f1291&&_0x2f1291[_0xe194('0x56')]&&_0x2f1291[_0xe194('0x56')]!=='none'){logger[_0xe194('0x1e')](_0xe194('0x57'),_0xe194('0x58'));_0x3774e9[_0xe194('0x59')]=util[_0xe194('0xd')](_0xe194('0x48'),_0x39c4be['serverUrl'],_0x3774e9[_0xe194('0x49')],md5(_0x3774e9[_0xe194('0x49')]));}headers[_0xe194('0x4a')]=getAuth(_0x39c4be);return getUser(_0x39c4be,_0x36abff['email'])[_0xe194('0x1d')](function(_0x4c0b41){_0x1a4d6b=_0x4c0b41;logger[_0xe194('0x1e')](_0xe194('0x4c'),_0x1a4d6b['id']);return getEndUser(_0x39c4be,_0x3774e9[_0xe194('0x5a')],_0x3774e9[_0xe194('0x5b')]);})['then'](function(_0x44595a){_0x3445ee=_0x44595a;logger[_0xe194('0x1e')](_0xe194('0x4d'),_0x3445ee['id']);return getTicket(_0x39c4be,_0x1a4d6b,_0x3445ee,_0x182215,_0x3774e9);})[_0xe194('0x1d')](function(_0x510afb){if(_0x510afb&&_0x510afb['id']){logger[_0xe194('0x1e')](_0xe194('0x1f'));logger[_0xe194('0x1e')](_0xe194('0x4e'),_0x510afb['id']);logger[_0xe194('0x1e')](_0xe194('0x57'),_0xe194('0x4f'));emit(util[_0xe194('0xd')](_0xe194('0x50'),_0x36abff[_0xe194('0x16')]),_0xe194('0x51'),{'uri':util[_0xe194('0xd')](_0xe194('0x52'),_0x39c4be['remoteUri'],_0x510afb['id'])});}})[_0xe194('0x53')](function(_0x5c3d70){logger[_0xe194('0x54')](_0xe194('0x57'),JSON[_0xe194('0x32')](_0x5c3d70));});};exports[_0xe194('0x5c')]=function(_0x5c7dfe,_0x1123f3,_0x209430,_0x24cbe8,_0x40c606,_0x269ce3){var _0x494731,_0x437fb2;_0x269ce3[_0xe194('0x1c')]=intUtil[_0xe194('0x45')](_0x269ce3['remoteUri']);_0x269ce3[_0xe194('0x46')]=intUtil[_0xe194('0x45')](_0x269ce3[_0xe194('0x46')]);if(_0x40c606&&_0x40c606[_0xe194('0x5d')]){logger[_0xe194('0x1e')]('['+_0x1123f3['lastevent'][_0xe194('0x5e')]()+']','Recording\x20is\x20enabled!');_0x1123f3[_0xe194('0x59')]=util[_0xe194('0xd')](_0xe194('0x48'),_0x269ce3[_0xe194('0x46')],_0x1123f3['uniqueid'],md5(_0x1123f3['uniqueid']));}else{_0x1123f3[_0xe194('0x59')]='';}headers['Authorization']=getAuth(_0x269ce3);return getUser(_0x269ce3,'')[_0xe194('0x1d')](function(_0x4fd555){_0x494731=_0x4fd555;logger[_0xe194('0x1e')](_0xe194('0x4c'),_0x494731['id']);return getEndUser(_0x269ce3,_0x1123f3[_0xe194('0xf')],_0x1123f3['calleridnum']);})[_0xe194('0x1d')](function(_0x3a6c61){_0x437fb2=_0x3a6c61;logger[_0xe194('0x1e')](_0xe194('0x4d'),_0x437fb2['id']);return getTicket(_0x269ce3,_0x494731,_0x437fb2,_0x209430,_0x1123f3);})[_0xe194('0x1d')](function(_0x4f5169){if(_0x4f5169){logger[_0xe194('0x1e')](_0xe194('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4f5169['id']);}})[_0xe194('0x53')](function(_0x1b1098){logger[_0xe194('0x54')]('['+_0x1123f3[_0xe194('0x5f')]['toUpperCase']()+']',JSON[_0xe194('0x32')](_0x1b1098));});}; \ 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 84f80e8..dc0a645 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 _0x437f=['User\x20found:','Admin\x20selected','userEmail','catch','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','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','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId'];(function(_0x5e01eb,_0x2347ae){var _0x501285=function(_0x4aa280){while(--_0x4aa280){_0x5e01eb['push'](_0x5e01eb['shift']());}};_0x501285(++_0x2347ae);}(_0x437f,0x13b));var _0xf437=function(_0x1fd7c0,_0x1d3c01){_0x1fd7c0=_0x1fd7c0-0x0;var _0x1f27d5=_0x437f[_0x1fd7c0];return _0x1f27d5;};'use strict';var _=require(_0xf437('0x0'));var rp=require(_0xf437('0x1'));var md5=require(_0xf437('0x2'));var util=require(_0xf437('0x3'));var moment=require(_0xf437('0x4'));var Promise=require(_0xf437('0x5'));var Redis=require(_0xf437('0x6'));var intUtil=require(_0xf437('0x7'));var config=require(_0xf437('0x8'));var logger=require(_0xf437('0x9'))(_0xf437('0xa'));config[_0xf437('0xb')]=_[_0xf437('0xc')](config[_0xf437('0xb')],{'host':_0xf437('0xd'),'port':0x18eb});var io=require(_0xf437('0xe'))(new Redis(config['redis']));function getAdminId(_0x39d10f,_0x333055,_0x5a5245,_0x7e9e55){return new Promise(function(_0x46b601,_0x16b1cd){var _0x45e1e6=![];var _0x4ad61b={'method':'GET','uri':_0x7e9e55+_0xf437('0xf'),'json':!![]};_0x4ad61b['headers']=_0x5a5245;logger[_0xf437('0x10')]('Getting\x20admin\x20information');return rp(_0x4ad61b)[_0xf437('0x11')](function(_0xce5d4d){if(_0xce5d4d){var _0x5a18c6=_0xce5d4d[_0xf437('0x12')];var _0x2a5ddf=null;for(_0x2a5ddf=0x0;_0x2a5ddf<_0x5a18c6[_0xf437('0x13')];_0x2a5ddf++){if(_0x5a18c6[_0x2a5ddf][_0xf437('0x14')]===_0x39d10f[_0xf437('0x15')]){_0x39d10f[_0xf437('0x16')]=_0x5a18c6[_0x2a5ddf]['id'];_0x45e1e6=!![];}}if(_0x45e1e6){logger[_0xf437('0x10')]('Admin\x20found:',_0x39d10f['adminId']);_0x46b601(_0x39d10f);}else{_0x16b1cd({'statusCode':0x194,'message':_0xf437('0x17')});}}else{_0x16b1cd({'statusCode':0x194,'message':_0xf437('0x17')});}})['catch'](function(_0x172415){logger[_0xf437('0x18')]('['+[_0x333055[_0xf437('0x19')]()]+']',_0x172415[_0xf437('0x1a')]);_0x16b1cd(_0x172415);});});}function getUser(_0x18f013,_0x7f9fc,_0x5342c0){return function(_0x424cce){return new Promise(function(_0x4a57c1,_0x32a95d){var _0x2ae0d5={'method':_0xf437('0x1b'),'uri':_0x5342c0+'/api/selector/owners','json':!![]};_0x2ae0d5[_0xf437('0x1c')]=_0x7f9fc;logger[_0xf437('0x10')](_0xf437('0x1d'));return rp(_0x2ae0d5)['then'](function(_0x22fe41){if(_0x22fe41){var _0x547cea=_0x22fe41['users'];var _0x1680ac=![];var _0x9adc3b=null;if(_0x424cce[_0xf437('0x1e')]!==null){logger[_0xf437('0x10')](_0xf437('0x1f'),_0x424cce[_0xf437('0x1e')]);_0x424cce['userEmail']=_0x424cce[_0xf437('0x1e')];for(_0x9adc3b=0x0;_0x9adc3b<_0x547cea['length'];_0x9adc3b++){if(_0x547cea[_0x9adc3b][_0xf437('0x14')]===_0x424cce[_0xf437('0x1e')]){_0x1680ac=!![];_0x424cce[_0xf437('0x20')]=_0x547cea[_0x9adc3b]['id'];logger[_0xf437('0x10')](_0xf437('0x21'),_0x424cce[_0xf437('0x20')]);}}}if(!_0x1680ac){logger[_0xf437('0x10')](_0xf437('0x22'));_0x424cce[_0xf437('0x23')]=_0x424cce[_0xf437('0x15')];_0x424cce['userId']=_0x424cce['adminId'];_0x1680ac=!![];}if(_0x1680ac){_0x4a57c1(_0x424cce);}else{_0x32a95d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x32a95d({'statusCode':0x194,'message':_0xf437('0x17')});}})[_0xf437('0x24')](function(_0xf44d56){logger[_0xf437('0x18')]('['+[_0x18f013[_0xf437('0x19')]()]+']',_0xf44d56['message']);_0x32a95d(_0xf44d56);});});};}function searchContact(_0x22398a,_0x56df9d,_0x5dd88b,_0xfa1a43){return new Promise(function(_0x138f75,_0x49e590){var _0x245f35={'method':'GET','headers':_0x56df9d,'uri':_0x22398a+'/api/lookup?q='+_0xfa1a43+'&f='+_0x5dd88b+_0xf437('0x25'),'json':!![]};rp(_0x245f35)[_0xf437('0x11')](function(_0x4fd204){var _0x158bfa=_['find'](_0x4fd204[_0xf437('0x26')][_0xf437('0x26')],[_0x5dd88b,_0xfa1a43]);_0x138f75(_0x158bfa);})[_0xf437('0x24')](function(_0x4f8e2c){_0x49e590(_0x4f8e2c);});});}function getEndUser(_0x28fffe,_0x2277fc,_0x2dc2b9){return function(_0x54e70d){return new Promise(function(_0x1785be,_0x2c6f03){logger['info'](util[_0xf437('0x27')](_0xf437('0x28'),_0x54e70d[_0xf437('0x29')]));searchContact(_0x2dc2b9,_0x2277fc,_0xf437('0x2a'),_0x54e70d['contactNumber'])['then'](function(_0x33c91a){if(_0x33c91a){_0x54e70d[_0xf437('0x2b')]=_0x33c91a['id'];logger['info'](_0xf437('0x2c'),_0x54e70d[_0xf437('0x2b')]);return _0x1785be(_0x54e70d);}searchContact(_0x2dc2b9,_0x2277fc,'work_number',_0x54e70d[_0xf437('0x29')])[_0xf437('0x11')](function(_0x4d8407){if(_0x4d8407){_0x54e70d[_0xf437('0x2b')]=_0x4d8407['id'];logger['info'](_0xf437('0x2d'),_0x54e70d[_0xf437('0x2b')]);return _0x1785be(_0x54e70d);}createEndUser(_0x54e70d,_0x28fffe,_0x2277fc,_0x2dc2b9)[_0xf437('0x11')](function(_0x1973f3){logger['info'](_0xf437('0x2e'),_0x1973f3[_0xf437('0x2b')]);return _0x1785be(_0x1973f3);});});})[_0xf437('0x24')](function(_0x44e56c){_0x2c6f03(_0x44e56c);});});};}function createEndUser(_0x5bd1be,_0x454ac5,_0x46d770,_0x1fdf93){return new Promise(function(_0x4da07e,_0x36c1eb){var _0x402489=moment();var _0xc725b1={'method':'POST','uri':_0x1fdf93+_0xf437('0x2f'),'body':{'contact':{'last_name':_0x5bd1be['contactNumber'],'work_number':_0x5bd1be[_0xf437('0x29')],'mobile_number':_0x5bd1be[_0xf437('0x29')],'owner_id':_0x5bd1be[_0xf437('0x20')],'created_at':_0x402489[_0xf437('0x27')](_0xf437('0x30'))}},'json':!![]};_0xc725b1['headers']=_0x46d770;logger[_0xf437('0x10')](_0xf437('0x31'));return rp(_0xc725b1)['then'](function(_0x47a994){_0x5bd1be['endUserId']=_0x47a994[_0xf437('0x32')]['id'];_0x4da07e(_0x5bd1be);})[_0xf437('0x24')](function(_0x339eb3){logger[_0xf437('0x18')]('['+[_0x454ac5[_0xf437('0x19')]()]+']',_0x339eb3['message']);_0x36c1eb(_0x339eb3[_0xf437('0x1a')]);});});}function getTicket(_0x5b8b2c,_0x578ad7,_0x36c6ed,_0x195778,_0x370b5c){return function(_0x231735){logger[_0xf437('0x10')](_0xf437('0x33'));return new Promise(function(_0x2a1b77,_0x54e8f6){var _0x4eed9f=moment();var _0x370c15={'method':_0xf437('0x34'),'uri':_0x36c6ed+_0xf437('0x35'),'body':{'title':intUtil[_0xf437('0x36')](_0x195778[_0xf437('0x37')],_0x370b5c,'\x20'),'description':intUtil[_0xf437('0x36')](_0x195778[_0xf437('0x38')],_0x370b5c,'\x0a'),'owner_id':_0x231735[_0xf437('0x20')],'creater_id':_0x231735['adminId'],'targetable_id':_0x231735[_0xf437('0x2b')],'targetable_type':_0xf437('0x39'),'created_at':_0x4eed9f[_0xf437('0x27')](_0xf437('0x30')),'due_date':_0x4eed9f[_0xf437('0x3a')](0x1e,'m')[_0xf437('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x370c15['headers']=_0x578ad7;return rp(_0x370c15)[_0xf437('0x11')](function(_0x4d2489){_0x231735[_0xf437('0x3b')]=_0x4d2489[_0xf437('0x3c')]['id'];logger[_0xf437('0x10')](_0xf437('0x3d'),_0x231735[_0xf437('0x3b')]);_0x2a1b77(_0x231735);})['catch'](function(_0x81153e){logger[_0xf437('0x18')]('['+[_0x5b8b2c['toUpperCase']()]+']',_0x81153e[_0xf437('0x1a')]);_0x54e8f6(_0x81153e[_0xf437('0x1a')]);});});};}function emit(_0x157902,_0x5ba147,_0x2accfb){var _0x517738={'uri':_0x157902+_0xf437('0x3e')+_0x2accfb};io['to'](util[_0xf437('0x27')](_0xf437('0x3f'),_0x5ba147))[_0xf437('0x40')](_0xf437('0x41'),_0x517738);}exports['cs']=function(_0x449bbb,_0x21de38,_0x425e4a,_0x3e1c7a,_0x1714b7,_0x4a1a97,_0xcc4dc5,_0x254ed9){var _0x3559b0={};var _0x1eab62={'Authorization':_0xf437('0x42')+_0x4a1a97[_0xf437('0x43')]};_0x4a1a97[_0xf437('0x44')]=intUtil[_0xf437('0x45')](_0x4a1a97[_0xf437('0x44')]);_0x4a1a97[_0xf437('0x46')]=intUtil[_0xf437('0x45')](_0x4a1a97[_0xf437('0x46')]);var _0x1c66c8=_0x4a1a97[_0xf437('0x44')];_0x3559b0[_0xf437('0x15')]=_0x4a1a97[_0xf437('0x47')];_0x3559b0[_0xf437('0x29')]=_0x254ed9[_0xf437('0x48')]()==='outbound'?_0x21de38[_0xf437('0x49')]:_0x21de38[_0xf437('0x4a')];_0x3559b0[_0xf437('0x4b')]=_0x254ed9===_0xf437('0x4c')||_0x254ed9==='unmanaged'?'queue':_0xf437('0x4d');if(_0x3e1c7a){_0x3559b0[_0xf437('0x1e')]=_0x3e1c7a[_0xf437('0x14')];}var _0x51db38=util[_0xf437('0x27')](_0xf437('0x4e'),_0x4a1a97[_0xf437('0x46')],_0x21de38[_0xf437('0x4f')],md5(_0x21de38[_0xf437('0x4f')]));if(_0x1714b7&&_0x1714b7['monitor_format']){logger[_0xf437('0x10')]('[QUEUE]',_0xf437('0x50'));_0x21de38[_0xf437('0x51')]=_0x51db38;}else if(_0xcc4dc5&&_0xcc4dc5['recordingFormat']&&_0xcc4dc5['recordingFormat']!==_0xf437('0x52')){logger['info']('[OUTBOUND]',_0xf437('0x50'));_0x21de38['recordingURL']=_0x51db38;}else{_0x21de38['recordingURL']='';}return getAdminId(_0x3559b0,_0x254ed9,_0x1eab62,_0x1c66c8)[_0xf437('0x11')](getUser(_0x254ed9,_0x1eab62,_0x1c66c8))[_0xf437('0x11')](getEndUser(_0x254ed9,_0x1eab62,_0x1c66c8))['then'](getTicket(_0x254ed9,_0x1eab62,_0x1c66c8,_0x425e4a,_0x21de38))[_0xf437('0x11')](function(_0x7a438e){logger[_0xf437('0x10')](util[_0xf437('0x27')](_0xf437('0x53'),_0x7a438e[_0xf437('0x3b')]));if(_0x254ed9!==_0xf437('0x54')){logger['info']('['+[_0x254ed9[_0xf437('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1c66c8,_0x3e1c7a[_0xf437('0x55')],_0x7a438e[_0xf437('0x2b')]);}})[_0xf437('0x24')](function(_0xa0d652){logger[_0xf437('0x18')]('['+[_0x254ed9[_0xf437('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xf437('0x56')](_0xa0d652,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7339=['Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','&entities=contact','find','contacts','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','serverUrl','stripTrailingSlash','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged'];(function(_0x52bcfd,_0x44397c){var _0x541f8d=function(_0x3cef22){while(--_0x3cef22){_0x52bcfd['push'](_0x52bcfd['shift']());}};_0x541f8d(++_0x44397c);}(_0x7339,0x1ef));var _0x9733=function(_0x5f067d,_0x40fc07){_0x5f067d=_0x5f067d-0x0;var _0x533f13=_0x7339[_0x5f067d];return _0x533f13;};'use strict';var _=require(_0x9733('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9733('0x1'));var moment=require(_0x9733('0x2'));var Promise=require(_0x9733('0x3'));var Redis=require('ioredis');var intUtil=require(_0x9733('0x4'));var config=require(_0x9733('0x5'));var logger=require(_0x9733('0x6'))('freshsales');config[_0x9733('0x7')]=_[_0x9733('0x8')](config[_0x9733('0x7')],{'host':_0x9733('0x9'),'port':0x18eb});var io=require(_0x9733('0xa'))(new Redis(config[_0x9733('0x7')]));function getAdminId(_0x483d2d,_0x1e0c6e,_0x2ed058,_0x426a09){return new Promise(function(_0x170eac,_0x45c829){var _0x1ed3a3=![];var _0x56fc5e={'method':_0x9733('0xb'),'uri':_0x426a09+_0x9733('0xc'),'json':!![]};_0x56fc5e[_0x9733('0xd')]=_0x2ed058;logger[_0x9733('0xe')]('Getting\x20admin\x20information');return rp(_0x56fc5e)[_0x9733('0xf')](function(_0x4abb44){if(_0x4abb44){var _0x4bbc62=_0x4abb44[_0x9733('0x10')];var _0x160d93=null;for(_0x160d93=0x0;_0x160d93<_0x4bbc62[_0x9733('0x11')];_0x160d93++){if(_0x4bbc62[_0x160d93][_0x9733('0x12')]===_0x483d2d[_0x9733('0x13')]){_0x483d2d[_0x9733('0x14')]=_0x4bbc62[_0x160d93]['id'];_0x1ed3a3=!![];}}if(_0x1ed3a3){logger[_0x9733('0xe')](_0x9733('0x15'),_0x483d2d[_0x9733('0x14')]);_0x170eac(_0x483d2d);}else{_0x45c829({'statusCode':0x194,'message':_0x9733('0x16')});}}else{_0x45c829({'statusCode':0x194,'message':_0x9733('0x16')});}})[_0x9733('0x17')](function(_0x33b44f){logger[_0x9733('0x18')]('['+[_0x1e0c6e[_0x9733('0x19')]()]+']',_0x33b44f[_0x9733('0x1a')]);_0x45c829(_0x33b44f);});});}function getUser(_0xc91d82,_0x5aefc5,_0x5ed753){return function(_0x2ffd14){return new Promise(function(_0x28a7a5,_0x33b3ab){var _0x594671={'method':_0x9733('0xb'),'uri':_0x5ed753+'/api/selector/owners','json':!![]};_0x594671[_0x9733('0xd')]=_0x5aefc5;logger[_0x9733('0xe')](_0x9733('0x1b'));return rp(_0x594671)[_0x9733('0xf')](function(_0xeb6960){if(_0xeb6960){var _0x6137a7=_0xeb6960[_0x9733('0x10')];var _0x186e6f=![];var _0x1ce2fa=null;if(_0x2ffd14[_0x9733('0x1c')]!==null){logger[_0x9733('0xe')]('Getting\x20user\x20with\x20email',_0x2ffd14['agentEmail']);_0x2ffd14[_0x9733('0x1d')]=_0x2ffd14['agentEmail'];for(_0x1ce2fa=0x0;_0x1ce2fa<_0x6137a7['length'];_0x1ce2fa++){if(_0x6137a7[_0x1ce2fa][_0x9733('0x12')]===_0x2ffd14['agentEmail']){_0x186e6f=!![];_0x2ffd14[_0x9733('0x1e')]=_0x6137a7[_0x1ce2fa]['id'];logger['info']('User\x20found:',_0x2ffd14[_0x9733('0x1e')]);}}}if(!_0x186e6f){logger['info'](_0x9733('0x1f'));_0x2ffd14[_0x9733('0x1d')]=_0x2ffd14[_0x9733('0x13')];_0x2ffd14['userId']=_0x2ffd14['adminId'];_0x186e6f=!![];}if(_0x186e6f){_0x28a7a5(_0x2ffd14);}else{_0x33b3ab({'statusCode':0x194,'message':_0x9733('0x16')});}}else{_0x33b3ab({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9733('0x17')](function(_0x335888){logger[_0x9733('0x18')]('['+[_0xc91d82[_0x9733('0x19')]()]+']',_0x335888['message']);_0x33b3ab(_0x335888);});});};}function searchContact(_0x965256,_0x574355,_0x351db7,_0x1f1972){return new Promise(function(_0x3bd9af,_0x53e11a){var _0x3eec22={'method':'GET','headers':_0x574355,'uri':_0x965256+_0x9733('0x20')+_0x1f1972+'&f='+_0x351db7+_0x9733('0x21'),'json':!![]};rp(_0x3eec22)['then'](function(_0x57e580){var _0xea3db6=_[_0x9733('0x22')](_0x57e580[_0x9733('0x23')][_0x9733('0x23')],[_0x351db7,_0x1f1972]);_0x3bd9af(_0xea3db6);})[_0x9733('0x17')](function(_0x56dd63){_0x53e11a(_0x56dd63);});});}function getEndUser(_0x589dea,_0x1bf52c,_0x1e448d){return function(_0x117498){return new Promise(function(_0x464614,_0x4769b9){logger[_0x9733('0xe')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x117498['contactNumber']));searchContact(_0x1e448d,_0x1bf52c,_0x9733('0x24'),_0x117498[_0x9733('0x25')])[_0x9733('0xf')](function(_0x34af2a){if(_0x34af2a){_0x117498['endUserId']=_0x34af2a['id'];logger[_0x9733('0xe')](_0x9733('0x26'),_0x117498[_0x9733('0x27')]);return _0x464614(_0x117498);}searchContact(_0x1e448d,_0x1bf52c,_0x9733('0x28'),_0x117498[_0x9733('0x25')])[_0x9733('0xf')](function(_0x5045ef){if(_0x5045ef){_0x117498[_0x9733('0x27')]=_0x5045ef['id'];logger[_0x9733('0xe')](_0x9733('0x29'),_0x117498[_0x9733('0x27')]);return _0x464614(_0x117498);}createEndUser(_0x117498,_0x589dea,_0x1bf52c,_0x1e448d)['then'](function(_0x27d64b){logger[_0x9733('0xe')]('Contact\x20created:',_0x27d64b[_0x9733('0x27')]);return _0x464614(_0x27d64b);});});})[_0x9733('0x17')](function(_0x31d073){_0x4769b9(_0x31d073);});});};}function createEndUser(_0x5b4eaa,_0x31f9de,_0x220c78,_0x4368f4){return new Promise(function(_0x3e55fd,_0x650495){var _0x4a39e6=moment();var _0x1e610a={'method':'POST','uri':_0x4368f4+_0x9733('0x2a'),'body':{'contact':{'last_name':_0x5b4eaa[_0x9733('0x25')],'work_number':_0x5b4eaa[_0x9733('0x25')],'mobile_number':_0x5b4eaa[_0x9733('0x25')],'owner_id':_0x5b4eaa[_0x9733('0x1e')],'created_at':_0x4a39e6[_0x9733('0x2b')](_0x9733('0x2c'))}},'json':!![]};_0x1e610a[_0x9733('0xd')]=_0x220c78;logger['info'](_0x9733('0x2d'));return rp(_0x1e610a)[_0x9733('0xf')](function(_0x2a205a){_0x5b4eaa[_0x9733('0x27')]=_0x2a205a[_0x9733('0x2e')]['id'];_0x3e55fd(_0x5b4eaa);})[_0x9733('0x17')](function(_0x346772){logger['error']('['+[_0x31f9de['toUpperCase']()]+']',_0x346772[_0x9733('0x1a')]);_0x650495(_0x346772[_0x9733('0x1a')]);});});}function getTicket(_0x5c36c0,_0x377e09,_0x22cc94,_0x5e2722,_0x49b06d){return function(_0x33b683){logger['info'](_0x9733('0x2f'));return new Promise(function(_0x312413,_0x2f713d){var _0x22345a=moment();var _0x47a357={'method':_0x9733('0x30'),'uri':_0x22cc94+_0x9733('0x31'),'body':{'title':intUtil[_0x9733('0x32')](_0x5e2722['Subjects'],_0x49b06d,'\x20'),'description':intUtil[_0x9733('0x32')](_0x5e2722['Descriptions'],_0x49b06d,'\x0a'),'owner_id':_0x33b683['userId'],'creater_id':_0x33b683['adminId'],'targetable_id':_0x33b683[_0x9733('0x27')],'targetable_type':_0x9733('0x33'),'created_at':_0x22345a[_0x9733('0x2b')](_0x9733('0x2c')),'due_date':_0x22345a[_0x9733('0x34')](0x1e,'m')[_0x9733('0x2b')](_0x9733('0x2c'))},'json':!![]};_0x47a357[_0x9733('0xd')]=_0x377e09;return rp(_0x47a357)[_0x9733('0xf')](function(_0x3b35b5){_0x33b683[_0x9733('0x35')]=_0x3b35b5['task']['id'];logger[_0x9733('0xe')](_0x9733('0x36'),_0x33b683[_0x9733('0x35')]);_0x312413(_0x33b683);})['catch'](function(_0xb11b62){logger[_0x9733('0x18')]('['+[_0x5c36c0[_0x9733('0x19')]()]+']',_0xb11b62['message']);_0x2f713d(_0xb11b62[_0x9733('0x1a')]);});});};}function emit(_0x4ef1cc,_0x2bed46,_0x1fa4fb){var _0x1fbfd6={'uri':_0x4ef1cc+_0x9733('0x37')+_0x1fa4fb};io['to'](util[_0x9733('0x2b')](_0x9733('0x38'),_0x2bed46))[_0x9733('0x39')](_0x9733('0x3a'),_0x1fbfd6);}exports['cs']=function(_0x3c9c18,_0x3ec26b,_0x1d992d,_0x215b6d,_0xd438a2,_0x2cafed,_0x1594cf,_0x1323dc){var _0x5b7a8b={};var _0x2549d7={'Authorization':'Token\x20token='+_0x2cafed[_0x9733('0x3b')]};_0x2cafed['remoteUri']=intUtil['stripTrailingSlash'](_0x2cafed['remoteUri']);_0x2cafed[_0x9733('0x3c')]=intUtil[_0x9733('0x3d')](_0x2cafed[_0x9733('0x3c')]);var _0x16174e=_0x2cafed[_0x9733('0x3e')];_0x5b7a8b[_0x9733('0x13')]=_0x2cafed[_0x9733('0x3f')];_0x5b7a8b[_0x9733('0x25')]=_0x1323dc[_0x9733('0x40')]()===_0x9733('0x41')?_0x3ec26b[_0x9733('0x42')]:_0x3ec26b[_0x9733('0x43')];_0x5b7a8b[_0x9733('0x44')]=_0x1323dc==='queue'||_0x1323dc==='unmanaged'?'queue':_0x9733('0x41');if(_0x215b6d){_0x5b7a8b[_0x9733('0x1c')]=_0x215b6d['email'];}var _0x49889a=util['format'](_0x9733('0x45'),_0x2cafed[_0x9733('0x3c')],_0x3ec26b[_0x9733('0x46')],md5(_0x3ec26b[_0x9733('0x46')]));if(_0xd438a2&&_0xd438a2[_0x9733('0x47')]){logger['info'](_0x9733('0x48'),_0x9733('0x49'));_0x3ec26b[_0x9733('0x4a')]=_0x49889a;}else if(_0x1594cf&&_0x1594cf[_0x9733('0x4b')]&&_0x1594cf['recordingFormat']!==_0x9733('0x4c')){logger[_0x9733('0xe')](_0x9733('0x4d'),'Recording\x20is\x20enabled!');_0x3ec26b['recordingURL']=_0x49889a;}else{_0x3ec26b[_0x9733('0x4a')]='';}return getAdminId(_0x5b7a8b,_0x1323dc,_0x2549d7,_0x16174e)['then'](getUser(_0x1323dc,_0x2549d7,_0x16174e))[_0x9733('0xf')](getEndUser(_0x1323dc,_0x2549d7,_0x16174e))['then'](getTicket(_0x1323dc,_0x2549d7,_0x16174e,_0x1d992d,_0x3ec26b))[_0x9733('0xf')](function(_0xe1e159){logger[_0x9733('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0xe1e159[_0x9733('0x35')]));if(_0x1323dc!==_0x9733('0x4e')){logger[_0x9733('0xe')]('['+[_0x1323dc['toUpperCase']()]+']',_0x9733('0x4f'));emit(_0x16174e,_0x215b6d[_0x9733('0x50')],_0xe1e159['endUserId']);}})[_0x9733('0x17')](function(_0x453587){logger[_0x9733('0x18')]('['+[_0x1323dc[_0x9733('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x9733('0x51')](_0x453587,{'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 7e5affc..1f00121 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 _0x3311=['find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2'];(function(_0x32da77,_0x2bd665){var _0x46e672=function(_0x5e960b){while(--_0x5e960b){_0x32da77['push'](_0x32da77['shift']());}};_0x46e672(++_0x2bd665);}(_0x3311,0x1d4));var _0x1331=function(_0x9d71ec,_0x2078ca){_0x9d71ec=_0x9d71ec-0x0;var _0x490440=_0x3311[_0x9d71ec];return _0x490440;};'use strict';var _=require(_0x1331('0x0'));var util=require(_0x1331('0x1'));var zendesk=require(_0x1331('0x2'));var salesforce=require(_0x1331('0x3'));var sugarcrm=require(_0x1331('0x4'));var freshdesk=require(_0x1331('0x5'));var zoho=require(_0x1331('0x6'));var desk=require(_0x1331('0x7'));var vtiger=require(_0x1331('0x8'));var servicenow=require(_0x1331('0x9'));var dynamics365=require(_0x1331('0xa'));var freshsales=require(_0x1331('0xb'));var integrations=[_0x1331('0xc'),_0x1331('0xd'),_0x1331('0xe'),_0x1331('0xf'),'zoho','desk',_0x1331('0x10'),_0x1331('0x11'),_0x1331('0x12'),_0x1331('0x13')];exports[_0x1331('0x14')]=function(_0x4e42b9,_0x3d478c,_0x295085,_0x15169c,_0xf07c62,_0xb83bf8){if(_0x295085){if(_['includes'](integrations,_0x4e42b9[_0x1331('0x15')]['toLowerCase']())){try{var _0x420717=null;var _0x27f7fa='';var _0xe1cbfb=_0x295085[_0x4e42b9[_0x1331('0x15')][_0x1331('0x16')]()];if(_0xe1cbfb){var _0x3042d8=_0xe1cbfb[_0x4e42b9[_0x1331('0x17')]];if(_0x3042d8){var _0x4e4c9a=_[_0x1331('0x18')](_0x3042d8[_0x1331('0x19')],{'id':parseInt(_0x4e42b9[_0x1331('0x1a')],0xa)});if(_0x4e4c9a){if(_0x15169c){if(_0xf07c62&&_0x3d478c[_0x1331('0x1b')]){_0x27f7fa=_0x1331('0x1b');}else if(_0x3d478c[_0x1331('0x1c')]){_0x27f7fa=_0x1331('0x1d');}else{console[_0x1331('0x1e')](_0x1331('0x1f'),_0x3d478c);}}else{_0x27f7fa=_0x1331('0x20');}switch(_0x4e42b9['data1']['toLowerCase']()){case _0x1331('0xc'):zendesk[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case'salesforce':salesforce[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case _0x1331('0xe'):sugarcrm[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case _0x1331('0xf'):freshdesk[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case'zoho':zoho[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case _0x1331('0x21'):desk[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case _0x1331('0x10'):vtiger[_0x27f7fa](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8);break;case _0x1331('0x12'):freshsales['cs'](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8,_0x27f7fa);break;case _0x1331('0x13'):servicenow['cs'](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8,_0x27f7fa);break;case'dynamics365':dynamics365['cs'](_0x4e42b9,_0x3d478c,_0x4e4c9a,_0x15169c,_0xf07c62,_0x3042d8,_0xb83bf8,_0x27f7fa);break;default:console[_0x1331('0x1e')](_0x1331('0x22'));}}else{_0x420717=require(_0x1331('0x23'))(_0x4e42b9['data1']['toLowerCase']());_0x420717['error'](_0x1331('0x24'),util[_0x1331('0x25')](_0x1331('0x26'),_0x4e42b9[_0x1331('0x15')][_0x1331('0x16')](),_0x4e42b9[_0x1331('0x1a')]));}}else{_0x420717=require(_0x1331('0x23'))(_0x4e42b9[_0x1331('0x15')][_0x1331('0x16')]());_0x420717[_0x1331('0x27')]('[EXEC]',util[_0x1331('0x25')](_0x1331('0x28'),_0x4e42b9['data1'][_0x1331('0x16')](),_0x4e42b9['data2']));}}else{}}catch(_0x7ae041){console[_0x1331('0x27')](_0x7ae041);}}}}; \ No newline at end of file +var _0x7965=['./dynamics365','./freshsales','salesforce','sugarcrm','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','log','zendesk','freshdesk','freshsales','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','./salesforce','./zoho','./vtiger'];(function(_0x1e05d2,_0x3e304d){var _0xb8e543=function(_0x81127d){while(--_0x81127d){_0x1e05d2['push'](_0x1e05d2['shift']());}};_0xb8e543(++_0x3e304d);}(_0x7965,0x114));var _0x5796=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x7965[_0x22e9fe];return _0x47cd19;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x5796('0x0'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x5796('0x1'));var desk=require('./desk');var vtiger=require(_0x5796('0x2'));var servicenow=require('./servicenow');var dynamics365=require(_0x5796('0x3'));var freshsales=require(_0x5796('0x4'));var integrations=['zendesk',_0x5796('0x5'),_0x5796('0x6'),'freshdesk',_0x5796('0x7'),_0x5796('0x8'),_0x5796('0x9'),'dynamics365','freshsales',_0x5796('0xa')];exports[_0x5796('0xb')]=function(_0x1a0372,_0x581ff8,_0xc878c5,_0x667c19,_0x19b910,_0x40f2aa){if(_0xc878c5){if(_[_0x5796('0xc')](integrations,_0x1a0372[_0x5796('0xd')][_0x5796('0xe')]())){try{var _0x253f3a=null;var _0x12bfa2='';var _0x294d6c=_0xc878c5[_0x1a0372['data1'][_0x5796('0xe')]()];if(_0x294d6c){var _0x2efcd3=_0x294d6c[_0x1a0372[_0x5796('0xf')]];if(_0x2efcd3){var _0xd4f572=_['find'](_0x2efcd3[_0x5796('0x10')],{'id':parseInt(_0x1a0372[_0x5796('0x11')],0xa)});if(_0xd4f572){if(_0x667c19){if(_0x19b910&&_0x581ff8['queue']){_0x12bfa2=_0x5796('0x12');}else if(_0x581ff8[_0x5796('0x13')]){_0x12bfa2='outbound';}else{console[_0x5796('0x14')]('EVENT\x20UNKNOWN',_0x581ff8);}}else{_0x12bfa2='unmanaged';}switch(_0x1a0372[_0x5796('0xd')][_0x5796('0xe')]()){case _0x5796('0x15'):zendesk[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case _0x5796('0x5'):salesforce[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case _0x5796('0x6'):sugarcrm[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case _0x5796('0x16'):freshdesk[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case'zoho':zoho[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case'desk':desk[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case _0x5796('0x9'):vtiger[_0x12bfa2](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa);break;case _0x5796('0x17'):freshsales['cs'](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa,_0x12bfa2);break;case _0x5796('0xa'):servicenow['cs'](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa,_0x12bfa2);break;case'dynamics365':dynamics365['cs'](_0x1a0372,_0x581ff8,_0xd4f572,_0x667c19,_0x19b910,_0x2efcd3,_0x40f2aa,_0x12bfa2);break;default:console[_0x5796('0x14')](_0x5796('0x18'));}}else{_0x253f3a=require(_0x5796('0x19'))(_0x1a0372[_0x5796('0xd')][_0x5796('0xe')]());_0x253f3a['error']('[EXEC]',util[_0x5796('0x1a')](_0x5796('0x1b'),_0x1a0372['data1'][_0x5796('0xe')](),_0x1a0372[_0x5796('0x11')]));}}else{_0x253f3a=require(_0x5796('0x19'))(_0x1a0372[_0x5796('0xd')][_0x5796('0xe')]());_0x253f3a[_0x5796('0x1c')](_0x5796('0x1d'),util[_0x5796('0x1a')](_0x5796('0x1e'),_0x1a0372['data1'][_0x5796('0xe')](),_0x1a0372[_0x5796('0xf')]));}}else{}}catch(_0x2b28f0){console[_0x5796('0x1c')](_0x2b28f0);}}}}; \ 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 2f0b2ae..fe368b1 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 _0x59a2=['integrationTab','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','user:%s','trigger:salesforce:display','newTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','util','./util','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','ContactId','account','AccountId','leadId','sobject','create','validateEmail','User','find','execute','then','length','Email','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','upperFirst','forEach','includes','string','idField','toString','type','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x59a2,0x116));var _0x259a=function(_0x564f06,_0x29f19e){_0x564f06=_0x564f06-0x0;var _0x2b2802=_0x59a2[_0x564f06];return _0x2b2802;};'use strict';var _=require(_0x259a('0x0'));var rp=require(_0x259a('0x1'));var moment=require(_0x259a('0x2'));var BPromise=require(_0x259a('0x3'));var md5=require(_0x259a('0x4'));var jsforce=require('jsforce');var util=require(_0x259a('0x5'));var Redis=require('ioredis');var intUtil=require(_0x259a('0x6'));var config=require('../../../../config/environment');var logger=require(_0x259a('0x7'))(_0x259a('0x8'));config[_0x259a('0x9')]=_['defaults'](config['redis'],{'host':_0x259a('0xa'),'port':0x18eb});var io=require(_0x259a('0xb'))(new Redis(config['redis']));function emit(_0x32874a,_0x3ba682,_0x345805){io['to'](_0x32874a)[_0x259a('0xc')](_0x3ba682,_0x345805);}function getTicket(_0x396aa9,_0x50434b,_0x4733f3,_0x345f9f,_0xa7ccc4,_0x5a425b,_0xa5e776,_0x2fd5da){var _0x4a727f=Object[_0x259a('0xd')]({},{'OwnerId':_0x50434b['id'],'Subject':intUtil[_0x259a('0xe')](_0x345f9f[_0x259a('0xf')],_0xa7ccc4,'\x20'),'Description':intUtil['getString'](_0x345f9f[_0x259a('0x10')],_0xa7ccc4,'\x0a')},getCustomFields(_0x5a425b,_0xa7ccc4));if(_0x4733f3){if(_0x345f9f[_0x259a('0x11')]===_0x259a('0x12')){_0x4a727f['ActivityDate']=moment[_0x259a('0x13')]();_0x4a727f[_0x259a('0x14')]=![];_0x4a727f[_0x259a('0x15')]=![];if(_0x4733f3[_0x259a('0x16')]===_0x259a('0x17')||_0x4733f3['endUserType']===_0x259a('0x18')){_0x4a727f[_0x259a('0x19')]=_0x4733f3['id'];}else if(_0x4733f3['endUserType']==='account'){_0x4a727f[_0x259a('0x1a')]=_0x4733f3['id'];}}else if(_0x345f9f[_0x259a('0x11')]==='Case'){if(_0x4733f3['endUserType']===_0x259a('0x17')){_0x4a727f[_0x259a('0x1b')]=_0x4733f3['id'];}else if(_0x4733f3[_0x259a('0x16')]===_0x259a('0x1c')){_0x4a727f[_0x259a('0x1d')]=_0x4733f3['id'];}else if(_0x4733f3[_0x259a('0x16')]===_0x259a('0x18')&&_0x345f9f[_0x259a('0x1e')]){_0x4a727f[_0x345f9f[_0x259a('0x1e')]]=_0x4733f3['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xa5e776[_0x259a('0x1f')](_0x345f9f[_0x259a('0x11')])[_0x259a('0x20')](_0x4a727f);}function getUser(_0x2db58c,_0x4f975d,_0x2b179a){if(!_['isNil'](_0x4f975d)&&intUtil[_0x259a('0x21')](_0x4f975d)){var _0xa664b0={'Email':_0x4f975d};var _0x1926c5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b179a['sobject'](_0x259a('0x22'))[_0x259a('0x23')](_0xa664b0,_0x1926c5)[_0x259a('0x24')]()[_0x259a('0x25')](function(_0x2c36dc){if(_0x2c36dc[_0x259a('0x26')]){var _0x15d500=_[_0x259a('0x23')](_0x2c36dc,function(_0x782dbc){return _0x782dbc[_0x259a('0x27')]===_0x4f975d;});if(_0x15d500){logger[_0x259a('0x28')]('Agent\x20%s\x20found.',_0x4f975d);return BPromise['resolve']({'id':_0x15d500['Id'],'name':_0x15d500[_0x259a('0x29')]});}}else{logger[_0x259a('0x28')](_0x259a('0x2a'),_0x4f975d);return _0x2b179a['identity']()[_0x259a('0x25')](function(_0x3c68d0){return BPromise['resolve']({'id':_0x3c68d0[_0x259a('0x2b')],'name':_0x3c68d0['display_name']});});}});}else{logger['info'](_0x259a('0x2a'),_0x4f975d);return _0x2b179a[_0x259a('0x2c')]()[_0x259a('0x25')](function(_0x691217){return BPromise[_0x259a('0x2d')]({'id':_0x691217[_0x259a('0x2b')],'name':_0x691217['display_name']});});}}function getEndUser(_0x5581c1,_0x39852d,_0x15b7c1,_0x333538,_0x5cdd55){var _0x34c45a={'$or':{'Phone':_0x333538}};var _0x36f9b9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x259a('0x2d')]()[_0x259a('0x25')](function(){logger[_0x259a('0x28')](_0x259a('0x2e'),_0x333538,_0x39852d[_0x259a('0x2f')]);switch(_0x39852d[_0x259a('0x2f')]){case _0x259a('0x30'):var _0x2f4bac=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d['additionalSearchContact']){var _0x5466a5={};_0x5466a5[_0x39852d[_0x259a('0x32')]]=_0x333538;_['merge'](_0x2f4bac[_0x259a('0x33')],_0x5466a5);}return _0x5cdd55[_0x259a('0x1f')](_0x259a('0x34'))[_0x259a('0x23')](_0x2f4bac,_0x36f9b9)['execute']()['then'](function(_0xbc077a){if(_0xbc077a&&_0xbc077a[_0x259a('0x26')]){return _0xbc077a;}else{var _0x4ea988=_['cloneDeep'](_0x34c45a);if(_0x39852d[_0x259a('0x35')]){var _0x3c09e7={};_0x3c09e7[_0x39852d[_0x259a('0x35')]]=_0x333538;_[_0x259a('0x36')](_0x4ea988[_0x259a('0x33')],_0x3c09e7);}return _0x5cdd55['sobject'](_0x259a('0x37'))[_0x259a('0x23')](_0x4ea988,_0x36f9b9);}});case _0x259a('0x38'):var _0x3a744f=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d['additionalSearchAccount']){var _0x5466a5={};_0x5466a5[_0x39852d[_0x259a('0x39')]]=_0x333538;_[_0x259a('0x36')](_0x3a744f[_0x259a('0x33')],_0x5466a5);}return _0x5cdd55[_0x259a('0x1f')]('Account')[_0x259a('0x23')](_0x3a744f,_0x36f9b9)[_0x259a('0x24')]()[_0x259a('0x25')](function(_0x3b8777){if(_0x3b8777&&_0x3b8777[_0x259a('0x26')]){return _0x3b8777;}else{var _0x403b1e=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d[_0x259a('0x32')]){var _0x5d246f={};_0x5d246f[_0x39852d[_0x259a('0x32')]]=_0x333538;_['merge'](_0x403b1e[_0x259a('0x33')],_0x5d246f);}return _0x5cdd55[_0x259a('0x1f')]('Contact')[_0x259a('0x23')](_0x403b1e,_0x36f9b9)[_0x259a('0x25')](function(_0xf8df48){if(_0xf8df48&&_0xf8df48['length']){return _0xf8df48;}else{var _0x5dc85b=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d[_0x259a('0x35')]){var _0xf50eea={};_0xf50eea[_0x39852d['additionalSearchLead']]=_0x333538;_['merge'](_0x5dc85b['$or'],_0xf50eea);}return _0x5cdd55[_0x259a('0x1f')](_0x259a('0x37'))['find'](_0x5dc85b,_0x36f9b9);}});}});case _0x259a('0x17'):var _0x2f4bac=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d[_0x259a('0x32')]){var _0x5466a5={};_0x5466a5[_0x39852d[_0x259a('0x32')]]=_0x333538;_[_0x259a('0x36')](_0x2f4bac[_0x259a('0x33')],_0x5466a5);}return _0x5cdd55[_0x259a('0x1f')](_0x259a('0x34'))[_0x259a('0x23')](_0x2f4bac,_0x36f9b9)[_0x259a('0x24')]();case'lead':var _0x1b519d=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d[_0x259a('0x35')]){var _0x5466a5={};_0x5466a5[_0x39852d[_0x259a('0x35')]]=_0x333538;_['merge'](_0x1b519d[_0x259a('0x33')],_0x5466a5);}return _0x5cdd55['sobject'](_0x259a('0x37'))[_0x259a('0x23')](_0x1b519d,_0x36f9b9);case _0x259a('0x1c'):var _0x3a744f=_[_0x259a('0x31')](_0x34c45a);if(_0x39852d[_0x259a('0x39')]){var _0x5466a5={};_0x5466a5[_0x39852d[_0x259a('0x39')]]=_0x333538;_[_0x259a('0x36')](_0x3a744f[_0x259a('0x33')],_0x5466a5);}return _0x5cdd55['sobject'](_0x259a('0x3a'))[_0x259a('0x23')](_0x3a744f,_0x36f9b9);default:return null;}})[_0x259a('0x25')](function(_0x50961c){if(_0x50961c&&_0x50961c[_0x259a('0x26')]){var _0x1b65e5=_['first'](_0x50961c);if(_0x1b65e5){return BPromise[_0x259a('0x2d')]({'id':_0x1b65e5['Id'],'name':_0x1b65e5['Name'],'phone':_0x1b65e5[_0x259a('0x3b')],'endUserType':_0x1b65e5[_0x259a('0x3c')]['type'][_0x259a('0x3d')]()});}}})[_0x259a('0x25')](function(_0xea6b7e){if(_0xea6b7e){logger['info'](_0x259a('0x3e'),_0xea6b7e['endUserType'],_0x333538);return BPromise[_0x259a('0x2d')](_0xea6b7e);}else{logger[_0x259a('0x28')](_0x259a('0x3f'),_0x333538);var _0x3340d7={'Phone':_0x333538};if(_0x39852d[_0x259a('0x40')]){if(_0x39852d[_0x259a('0x40')]===_0x259a('0x17')){logger[_0x259a('0x28')](_0x259a('0x41'),_0x333538,_0x39852d[_0x259a('0x40')]);_0x3340d7['LastName']=_0x15b7c1!==''?_0x15b7c1:util[_0x259a('0x42')](_0x259a('0x43'),_0x333538);}else if(_0x39852d[_0x259a('0x40')]==='lead'){logger['info'](_0x259a('0x41'),_0x333538,_0x39852d[_0x259a('0x40')]);_0x3340d7[_0x259a('0x44')]=_0x15b7c1!==_0x259a('0x45')?_0x15b7c1:util['format'](_0x259a('0x43'),_0x333538);_0x3340d7[_0x259a('0x46')]=_0x259a('0x47');}else if(_0x39852d[_0x259a('0x40')]===_0x259a('0x1c')){logger[_0x259a('0x28')](_0x259a('0x41'),_0x333538,_0x39852d[_0x259a('0x40')]);_0x3340d7['Name']=_0x15b7c1!==''?_0x15b7c1:util[_0x259a('0x42')](_0x259a('0x43'),_0x333538);}else{return null;}}return _0x5cdd55[_0x259a('0x1f')](_[_0x259a('0x48')](_0x39852d[_0x259a('0x40')]))[_0x259a('0x20')](_0x3340d7)[_0x259a('0x25')](function(_0x3f6c6c){return BPromise['resolve']({'id':_0x3f6c6c['id'],'endUserType':_0x39852d['moduleCreate']});});}});}function getCustomFields(_0x415e85,_0x5cf676){var _0x355df7={};if(_0x415e85['length']>0x0){_[_0x259a('0x49')](_0x415e85,function(_0x15c920){if(_[_0x259a('0x4a')]([_0x259a('0x4b'),'picklist'],_0x15c920['type'])&&_0x15c920[_0x259a('0x4c')]){_0x355df7[_0x15c920[_0x259a('0x4c')]]=_0x15c920['content'][_0x259a('0x4d')]();}else if(_0x15c920[_0x259a('0x4e')]===_0x259a('0x4f')&&_0x15c920['variableName']&&_0x15c920[_0x259a('0x4c')]){_0x5cf676[_0x15c920[_0x259a('0x50')]]&&(_0x355df7[_0x15c920[_0x259a('0x4c')]]=_0x5cf676[_0x15c920[_0x259a('0x50')]]['toString']());}else if(_0x15c920[_0x259a('0x4e')]===_0x259a('0x51')&&_0x15c920[_0x259a('0x52')]&&_0x15c920[_0x259a('0x52')][_0x259a('0x53')]&&_0x15c920['idField']){_0x5cf676[_0x15c920['Variable']['name'][_0x259a('0x3d')]()]&&(_0x355df7[_0x15c920[_0x259a('0x4c')]]=_0x5cf676[_0x15c920['Variable'][_0x259a('0x53')][_0x259a('0x3d')]()][_0x259a('0x4d')]());}});}return _0x355df7;}function getConnection(_0x409944){var _0x3e6c8c=_0x409944[_0x259a('0x54')][_0x259a('0x55')](_0x409944[_0x259a('0x56')]);var _0x41941f=new jsforce[(_0x259a('0x57'))]({'oauth2':{'loginUrl':_0x409944[_0x259a('0x58')]||_0x259a('0x59'),'clientId':_0x409944[_0x259a('0x5a')],'clientSecret':_0x409944[_0x259a('0x5b')]}});return _0x41941f['login'](_0x409944[_0x259a('0x5c')],_0x3e6c8c)['then'](function(){logger[_0x259a('0x28')]('Connection\x20established.');return _0x41941f;});}exports[_0x259a('0x5d')]=function(_0x305be3,_0x4c238b,_0x46ccda,_0x15943d,_0x93bfff,_0x1e3cc0){var _0x1a7136,_0x24b67b,_0x452693,_0x4850d4;_0x1e3cc0[_0x259a('0x5e')]=intUtil[_0x259a('0x5f')](_0x1e3cc0['serverUrl']);_0x1e3cc0[_0x259a('0x58')]=intUtil[_0x259a('0x5f')](_0x1e3cc0[_0x259a('0x58')]);if(_0x93bfff&&_0x93bfff[_0x259a('0x60')]){logger[_0x259a('0x28')](_0x259a('0x61'),_0x259a('0x62'));_0x4c238b[_0x259a('0x63')]=util[_0x259a('0x42')](_0x259a('0x64'),_0x1e3cc0[_0x259a('0x5e')],_0x4c238b[_0x259a('0x65')],md5(_0x4c238b[_0x259a('0x65')]));}else{_0x4c238b['recordingURL']='';}return getConnection(_0x1e3cc0)['then'](function(_0x303cea){_0x4850d4=_0x303cea;return getUser(_0x1e3cc0,_0x15943d[_0x259a('0x66')],_0x4850d4);})[_0x259a('0x25')](function(_0x23919f){_0x1a7136=_0x23919f;return getEndUser(_0x1e3cc0,_0x46ccda,_0x4c238b[_0x259a('0x67')],_0x4c238b[_0x259a('0x68')],_0x4850d4);})[_0x259a('0x25')](function(_0x379892){_0x24b67b=_0x379892;return getTicket(_0x1e3cc0,_0x1a7136,_0x24b67b,_0x46ccda,_0x4c238b,_0x46ccda['Fields'],_0x4850d4,'queue');})[_0x259a('0x25')](function(_0xfd04df){_0x452693=_0xfd04df;logger[_0x259a('0x28')](_0x259a('0x69'),_0x452693['id']);logger[_0x259a('0x28')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x452693['id'],_0x15943d[_0x259a('0x53')],_0x1e3cc0['type']);switch(_0x1e3cc0[_0x259a('0x4e')]){case _0x259a('0x6a'):emit(util[_0x259a('0x42')]('user:%s',_0x15943d[_0x259a('0x53')]),'trigger:salesforce:display',{'recordId':_0x452693['id']});break;case'newTab':emit(util['format']('user:%s',_0x15943d['name']),'trigger:browser:url',{'uri':util['format'](_0x259a('0x6b'),_0x4850d4['instanceUrl'],_0x452693['id'])});break;default:logger[_0x259a('0x6c')](_0x259a('0x6d'));}})[_0x259a('0x6e')](function(_0x4a3399){logger[_0x259a('0x6c')](_0x259a('0x61'),_0x4a3399);});};exports[_0x259a('0x6f')]=function(_0x4e3037,_0x25b860,_0x28a221,_0x2b2160,_0x4b0123,_0x3b0591,_0xdc04c9){var _0x83cdd8,_0x311383,_0x19adcf,_0x3c4294;_0x3b0591['serverUrl']=intUtil[_0x259a('0x5f')](_0x3b0591[_0x259a('0x5e')]);_0x3b0591[_0x259a('0x58')]=intUtil['stripTrailingSlash'](_0x3b0591[_0x259a('0x58')]);if(_0xdc04c9&&_0xdc04c9['recordingFormat']&&_0xdc04c9[_0x259a('0x70')]!==_0x259a('0x71')){logger[_0x259a('0x28')](_0x259a('0x72'),_0x259a('0x62'));_0x25b860['recordingURL']=util[_0x259a('0x42')](_0x259a('0x64'),_0x3b0591[_0x259a('0x5e')],_0x25b860[_0x259a('0x65')],md5(_0x25b860[_0x259a('0x65')]));}return getConnection(_0x3b0591)['then'](function(_0x3915b3){_0x3c4294=_0x3915b3;return getUser(_0x3b0591,_0x2b2160[_0x259a('0x66')],_0x3c4294);})[_0x259a('0x25')](function(_0x171332){_0x83cdd8=_0x171332;return getEndUser(_0x3b0591,_0x28a221,_0x25b860[_0x259a('0x73')],_0x25b860[_0x259a('0x74')],_0x3c4294);})[_0x259a('0x25')](function(_0x5be707){_0x311383=_0x5be707;return getTicket(_0x3b0591,_0x83cdd8,_0x311383,_0x28a221,_0x25b860,_0x28a221[_0x259a('0x75')],_0x3c4294,_0x259a('0x6f'));})[_0x259a('0x25')](function(_0x57ea10){_0x19adcf=_0x57ea10;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x19adcf['id']);logger[_0x259a('0x28')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x19adcf['id'],_0x2b2160['name'],_0x3b0591[_0x259a('0x4e')]);switch(_0x3b0591[_0x259a('0x4e')]){case'integrationTab':emit(util[_0x259a('0x42')](_0x259a('0x76'),_0x2b2160[_0x259a('0x53')]),_0x259a('0x77'),{'recordId':_0x19adcf['id']});break;case _0x259a('0x78'):emit(util[_0x259a('0x42')](_0x259a('0x76'),_0x2b2160[_0x259a('0x53')]),'trigger:browser:url',{'uri':util['format'](_0x259a('0x6b'),_0x3c4294[_0x259a('0x79')],_0x19adcf['id'])});break;default:logger['error'](_0x259a('0x72'),_0x259a('0x7a'));}})[_0x259a('0x6e')](function(_0x1fc628){logger[_0x259a('0x6c')](_0x259a('0x72'),_0x1fc628);});};exports[_0x259a('0x7b')]=function(_0x12c403,_0x533e08,_0x243ffb,_0x5bf99a,_0x2cac41,_0x2a2bbf){var _0x131354,_0x56bbde,_0x993406,_0xf0fb73;_0x2a2bbf[_0x259a('0x5e')]=intUtil[_0x259a('0x5f')](_0x2a2bbf[_0x259a('0x5e')]);_0x2a2bbf[_0x259a('0x58')]=intUtil[_0x259a('0x5f')](_0x2a2bbf['remoteUri']);if(_0x2cac41&&_0x2cac41['monitor_format']){logger[_0x259a('0x28')]('['+_0x533e08[_0x259a('0x7c')][_0x259a('0x7d')]()+']',_0x259a('0x62'));_0x533e08[_0x259a('0x63')]=util[_0x259a('0x42')](_0x259a('0x64'),_0x2a2bbf[_0x259a('0x5e')],_0x533e08[_0x259a('0x65')],md5(_0x533e08[_0x259a('0x65')]));}else{_0x533e08[_0x259a('0x63')]='';}return getConnection(_0x2a2bbf)[_0x259a('0x25')](function(_0xf4b23e){_0xf0fb73=_0xf4b23e;if(!_[_0x259a('0x7e')](_0x5bf99a)){return getUser(_0x2a2bbf,_0x5bf99a['name'],_0xf0fb73);}else{return getUser(_0x2a2bbf,null,_0xf0fb73);}})['then'](function(_0x3e29e0){_0x131354=_0x3e29e0;return getEndUser(_0x2a2bbf,_0x243ffb,_0x533e08[_0x259a('0x67')],_0x533e08[_0x259a('0x68')],_0xf0fb73);})[_0x259a('0x25')](function(_0x484a93){_0x56bbde=_0x484a93;return getTicket(_0x2a2bbf,_0x131354,_0x56bbde,_0x243ffb,_0x533e08,_0x243ffb[_0x259a('0x75')],_0xf0fb73);})[_0x259a('0x25')](function(_0x2a46f9){_0x993406=_0x2a46f9;logger[_0x259a('0x28')]('['+_0x533e08[_0x259a('0x7c')][_0x259a('0x7d')]()+_0x259a('0x7f'),_0x993406['id']);logger[_0x259a('0x28')]('['+_0x533e08[_0x259a('0x7c')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x2a2bbf['type']);})[_0x259a('0x6e')](function(_0x48e642){logger[_0x259a('0x6c')]('['+_0x533e08['lastevent'][_0x259a('0x7d')]()+']',_0x48e642);});}; \ No newline at end of file +var _0x07db=['lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','account','WhatId','ticketType','Case','AccountId','leadId','isNil','validateEmail','sobject','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','Contact','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','create','forEach','includes','string','picklist','type','content','toString','variable','variableName','idField','customVariable','Variable','name','password','concat','Connection','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized'];(function(_0x5da048,_0xca5c85){var _0x13dfc5=function(_0x1ac05f){while(--_0x1ac05f){_0x5da048['push'](_0x5da048['shift']());}};_0x13dfc5(++_0xca5c85);}(_0x07db,0x84));var _0xb07d=function(_0x1a2ef3,_0x21186c){_0x1a2ef3=_0x1a2ef3-0x0;var _0x34f4a4=_0x07db[_0x1a2ef3];return _0x34f4a4;};'use strict';var _=require(_0xb07d('0x0'));var rp=require(_0xb07d('0x1'));var moment=require(_0xb07d('0x2'));var BPromise=require(_0xb07d('0x3'));var md5=require(_0xb07d('0x4'));var jsforce=require(_0xb07d('0x5'));var util=require(_0xb07d('0x6'));var Redis=require(_0xb07d('0x7'));var intUtil=require('./util');var config=require(_0xb07d('0x8'));var logger=require(_0xb07d('0x9'))(_0xb07d('0xa'));config[_0xb07d('0xb')]=_[_0xb07d('0xc')](config[_0xb07d('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xb07d('0xd'))(new Redis(config[_0xb07d('0xb')]));function emit(_0x2230f7,_0x4cb6f5,_0x4a5e3a){io['to'](_0x2230f7)[_0xb07d('0xe')](_0x4cb6f5,_0x4a5e3a);}function getTicket(_0x125658,_0x4eacfa,_0x374ece,_0x4e976a,_0x5c1ef5,_0x57a6b3,_0x14553d,_0x5a2920){var _0x4aa3e4=Object['assign']({},{'OwnerId':_0x4eacfa['id'],'Subject':intUtil['getString'](_0x4e976a['Subjects'],_0x5c1ef5,'\x20'),'Description':intUtil[_0xb07d('0xf')](_0x4e976a[_0xb07d('0x10')],_0x5c1ef5,'\x0a')},getCustomFields(_0x57a6b3,_0x5c1ef5));if(_0x374ece){if(_0x4e976a['ticketType']===_0xb07d('0x11')){_0x4aa3e4[_0xb07d('0x12')]=moment[_0xb07d('0x13')]();_0x4aa3e4[_0xb07d('0x14')]=![];_0x4aa3e4[_0xb07d('0x15')]=![];if(_0x374ece['endUserType']===_0xb07d('0x16')||_0x374ece[_0xb07d('0x17')]===_0xb07d('0x18')){_0x4aa3e4['WhoId']=_0x374ece['id'];}else if(_0x374ece[_0xb07d('0x17')]===_0xb07d('0x19')){_0x4aa3e4[_0xb07d('0x1a')]=_0x374ece['id'];}}else if(_0x4e976a[_0xb07d('0x1b')]===_0xb07d('0x1c')){if(_0x374ece[_0xb07d('0x17')]===_0xb07d('0x16')){_0x4aa3e4['ContactId']=_0x374ece['id'];}else if(_0x374ece[_0xb07d('0x17')]===_0xb07d('0x19')){_0x4aa3e4[_0xb07d('0x1d')]=_0x374ece['id'];}else if(_0x374ece['endUserType']===_0xb07d('0x18')&&_0x4e976a['leadId']){_0x4aa3e4[_0x4e976a[_0xb07d('0x1e')]]=_0x374ece['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x14553d['sobject'](_0x4e976a['ticketType'])['create'](_0x4aa3e4);}function getUser(_0x1b668a,_0x553db1,_0x3bab40){if(!_[_0xb07d('0x1f')](_0x553db1)&&intUtil[_0xb07d('0x20')](_0x553db1)){var _0x5026ec={'Email':_0x553db1};var _0x371a2a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bab40[_0xb07d('0x21')]('User')[_0xb07d('0x22')](_0x5026ec,_0x371a2a)[_0xb07d('0x23')]()[_0xb07d('0x24')](function(_0x1e50f0){if(_0x1e50f0[_0xb07d('0x25')]){var _0x496e39=_[_0xb07d('0x22')](_0x1e50f0,function(_0x5c9502){return _0x5c9502[_0xb07d('0x26')]===_0x553db1;});if(_0x496e39){logger['info'](_0xb07d('0x27'),_0x553db1);return BPromise[_0xb07d('0x28')]({'id':_0x496e39['Id'],'name':_0x496e39[_0xb07d('0x29')]});}}else{logger[_0xb07d('0x2a')](_0xb07d('0x2b'),_0x553db1);return _0x3bab40['identity']()[_0xb07d('0x24')](function(_0xbc7673){return BPromise[_0xb07d('0x28')]({'id':_0xbc7673[_0xb07d('0x2c')],'name':_0xbc7673[_0xb07d('0x2d')]});});}});}else{logger[_0xb07d('0x2a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x553db1);return _0x3bab40['identity']()[_0xb07d('0x24')](function(_0x32d8f8){return BPromise[_0xb07d('0x28')]({'id':_0x32d8f8[_0xb07d('0x2c')],'name':_0x32d8f8[_0xb07d('0x2d')]});});}}function getEndUser(_0x1d21da,_0x226937,_0x1449cc,_0x4c5ad4,_0xd0577c){var _0x832d67={'$or':{'Phone':_0x4c5ad4}};var _0x29443e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb07d('0x28')]()[_0xb07d('0x24')](function(){logger[_0xb07d('0x2a')](_0xb07d('0x2e'),_0x4c5ad4,_0x226937[_0xb07d('0x2f')]);switch(_0x226937[_0xb07d('0x2f')]){case _0xb07d('0x30'):var _0x53f5ef=_[_0xb07d('0x31')](_0x832d67);if(_0x226937['additionalSearchContact']){var _0x1f19d9={};_0x1f19d9[_0x226937['additionalSearchContact']]=_0x4c5ad4;_[_0xb07d('0x32')](_0x53f5ef[_0xb07d('0x33')],_0x1f19d9);}return _0xd0577c[_0xb07d('0x21')]('Contact')[_0xb07d('0x22')](_0x53f5ef,_0x29443e)[_0xb07d('0x23')]()[_0xb07d('0x24')](function(_0x35d8d4){if(_0x35d8d4&&_0x35d8d4['length']){return _0x35d8d4;}else{var _0x56974d=_[_0xb07d('0x31')](_0x832d67);if(_0x226937[_0xb07d('0x34')]){var _0x58b6ee={};_0x58b6ee[_0x226937[_0xb07d('0x34')]]=_0x4c5ad4;_[_0xb07d('0x32')](_0x56974d['$or'],_0x58b6ee);}return _0xd0577c['sobject'](_0xb07d('0x35'))['find'](_0x56974d,_0x29443e);}});case _0xb07d('0x36'):var _0x1632d1=_[_0xb07d('0x31')](_0x832d67);if(_0x226937[_0xb07d('0x37')]){var _0x1f19d9={};_0x1f19d9[_0x226937[_0xb07d('0x37')]]=_0x4c5ad4;_[_0xb07d('0x32')](_0x1632d1['$or'],_0x1f19d9);}return _0xd0577c[_0xb07d('0x21')](_0xb07d('0x38'))[_0xb07d('0x22')](_0x1632d1,_0x29443e)[_0xb07d('0x23')]()[_0xb07d('0x24')](function(_0x11454f){if(_0x11454f&&_0x11454f['length']){return _0x11454f;}else{var _0x165e17=_[_0xb07d('0x31')](_0x832d67);if(_0x226937[_0xb07d('0x39')]){var _0x47aa2e={};_0x47aa2e[_0x226937['additionalSearchContact']]=_0x4c5ad4;_[_0xb07d('0x32')](_0x165e17[_0xb07d('0x33')],_0x47aa2e);}return _0xd0577c['sobject'](_0xb07d('0x3a'))[_0xb07d('0x22')](_0x165e17,_0x29443e)['then'](function(_0x559796){if(_0x559796&&_0x559796[_0xb07d('0x25')]){return _0x559796;}else{var _0x309a4d=_['cloneDeep'](_0x832d67);if(_0x226937[_0xb07d('0x34')]){var _0x24383b={};_0x24383b[_0x226937[_0xb07d('0x34')]]=_0x4c5ad4;_[_0xb07d('0x32')](_0x309a4d[_0xb07d('0x33')],_0x24383b);}return _0xd0577c['sobject'](_0xb07d('0x35'))[_0xb07d('0x22')](_0x309a4d,_0x29443e);}});}});case _0xb07d('0x16'):var _0x53f5ef=_[_0xb07d('0x31')](_0x832d67);if(_0x226937['additionalSearchContact']){var _0x1f19d9={};_0x1f19d9[_0x226937[_0xb07d('0x39')]]=_0x4c5ad4;_['merge'](_0x53f5ef[_0xb07d('0x33')],_0x1f19d9);}return _0xd0577c[_0xb07d('0x21')](_0xb07d('0x3a'))[_0xb07d('0x22')](_0x53f5ef,_0x29443e)[_0xb07d('0x23')]();case _0xb07d('0x18'):var _0x20c60f=_[_0xb07d('0x31')](_0x832d67);if(_0x226937[_0xb07d('0x34')]){var _0x1f19d9={};_0x1f19d9[_0x226937['additionalSearchLead']]=_0x4c5ad4;_[_0xb07d('0x32')](_0x20c60f[_0xb07d('0x33')],_0x1f19d9);}return _0xd0577c[_0xb07d('0x21')]('Lead')[_0xb07d('0x22')](_0x20c60f,_0x29443e);case _0xb07d('0x19'):var _0x1632d1=_[_0xb07d('0x31')](_0x832d67);if(_0x226937['additionalSearchAccount']){var _0x1f19d9={};_0x1f19d9[_0x226937[_0xb07d('0x37')]]=_0x4c5ad4;_[_0xb07d('0x32')](_0x1632d1[_0xb07d('0x33')],_0x1f19d9);}return _0xd0577c[_0xb07d('0x21')](_0xb07d('0x38'))['find'](_0x1632d1,_0x29443e);default:return null;}})[_0xb07d('0x24')](function(_0xd3f694){if(_0xd3f694&&_0xd3f694[_0xb07d('0x25')]){var _0x3989e4=_[_0xb07d('0x3b')](_0xd3f694);if(_0x3989e4){return BPromise[_0xb07d('0x28')]({'id':_0x3989e4['Id'],'name':_0x3989e4[_0xb07d('0x29')],'phone':_0x3989e4['Phone'],'endUserType':_0x3989e4[_0xb07d('0x3c')]['type'][_0xb07d('0x3d')]()});}}})['then'](function(_0x31fb45){if(_0x31fb45){logger[_0xb07d('0x2a')](_0xb07d('0x3e'),_0x31fb45['endUserType'],_0x4c5ad4);return BPromise[_0xb07d('0x28')](_0x31fb45);}else{logger[_0xb07d('0x2a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4c5ad4);var _0x439037={'Phone':_0x4c5ad4};if(_0x226937[_0xb07d('0x3f')]){if(_0x226937['moduleCreate']===_0xb07d('0x16')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4c5ad4,_0x226937[_0xb07d('0x3f')]);_0x439037[_0xb07d('0x40')]=_0x1449cc!==_0xb07d('0x41')?_0x1449cc:util[_0xb07d('0x42')](_0xb07d('0x43'),_0x4c5ad4);}else if(_0x226937['moduleCreate']===_0xb07d('0x18')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4c5ad4,_0x226937[_0xb07d('0x3f')]);_0x439037[_0xb07d('0x40')]=_0x1449cc!==_0xb07d('0x41')?_0x1449cc:util['format'](_0xb07d('0x43'),_0x4c5ad4);_0x439037['Company']=_0xb07d('0x44');}else if(_0x226937[_0xb07d('0x3f')]===_0xb07d('0x19')){logger[_0xb07d('0x2a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4c5ad4,_0x226937[_0xb07d('0x3f')]);_0x439037[_0xb07d('0x29')]=_0x1449cc!==_0xb07d('0x41')?_0x1449cc:util['format']('Caller\x20-\x20%s',_0x4c5ad4);}else{return null;}}return _0xd0577c[_0xb07d('0x21')](_[_0xb07d('0x45')](_0x226937[_0xb07d('0x3f')]))[_0xb07d('0x46')](_0x439037)[_0xb07d('0x24')](function(_0x1da5ec){return BPromise[_0xb07d('0x28')]({'id':_0x1da5ec['id'],'endUserType':_0x226937[_0xb07d('0x3f')]});});}});}function getCustomFields(_0x395bb4,_0xfad3ab){var _0x5b4b5f={};if(_0x395bb4[_0xb07d('0x25')]>0x0){_[_0xb07d('0x47')](_0x395bb4,function(_0x273d2e){if(_[_0xb07d('0x48')]([_0xb07d('0x49'),_0xb07d('0x4a')],_0x273d2e[_0xb07d('0x4b')])&&_0x273d2e['idField']){_0x5b4b5f[_0x273d2e['idField']]=_0x273d2e[_0xb07d('0x4c')][_0xb07d('0x4d')]();}else if(_0x273d2e[_0xb07d('0x4b')]===_0xb07d('0x4e')&&_0x273d2e[_0xb07d('0x4f')]&&_0x273d2e[_0xb07d('0x50')]){_0xfad3ab[_0x273d2e[_0xb07d('0x4f')]]&&(_0x5b4b5f[_0x273d2e[_0xb07d('0x50')]]=_0xfad3ab[_0x273d2e[_0xb07d('0x4f')]][_0xb07d('0x4d')]());}else if(_0x273d2e[_0xb07d('0x4b')]===_0xb07d('0x51')&&_0x273d2e[_0xb07d('0x52')]&&_0x273d2e[_0xb07d('0x52')]['name']&&_0x273d2e[_0xb07d('0x50')]){_0xfad3ab[_0x273d2e[_0xb07d('0x52')][_0xb07d('0x53')][_0xb07d('0x3d')]()]&&(_0x5b4b5f[_0x273d2e[_0xb07d('0x50')]]=_0xfad3ab[_0x273d2e[_0xb07d('0x52')][_0xb07d('0x53')][_0xb07d('0x3d')]()][_0xb07d('0x4d')]());}});}return _0x5b4b5f;}function getConnection(_0x4b773a){var _0x23ca74=_0x4b773a[_0xb07d('0x54')][_0xb07d('0x55')](_0x4b773a['securityToken']);var _0x846d18=new jsforce[(_0xb07d('0x56'))]({'oauth2':{'loginUrl':_0x4b773a['remoteUri']||'https://login.salesforce.com','clientId':_0x4b773a['clientId'],'clientSecret':_0x4b773a[_0xb07d('0x57')]}});return _0x846d18[_0xb07d('0x58')](_0x4b773a[_0xb07d('0x59')],_0x23ca74)[_0xb07d('0x24')](function(){logger[_0xb07d('0x2a')](_0xb07d('0x5a'));return _0x846d18;});}exports[_0xb07d('0x5b')]=function(_0xd31f14,_0x209370,_0x49f7c,_0x3fea66,_0xd5da15,_0x222a91){var _0x3571d3,_0x26bdad,_0x4fa35b,_0x38c7cd;_0x222a91['serverUrl']=intUtil[_0xb07d('0x5c')](_0x222a91[_0xb07d('0x5d')]);_0x222a91[_0xb07d('0x5e')]=intUtil['stripTrailingSlash'](_0x222a91[_0xb07d('0x5e')]);if(_0xd5da15&&_0xd5da15[_0xb07d('0x5f')]){logger[_0xb07d('0x2a')](_0xb07d('0x60'),_0xb07d('0x61'));_0x209370[_0xb07d('0x62')]=util[_0xb07d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x222a91['serverUrl'],_0x209370['uniqueid'],md5(_0x209370[_0xb07d('0x63')]));}else{_0x209370['recordingURL']='';}return getConnection(_0x222a91)[_0xb07d('0x24')](function(_0x1a9d0c){_0x38c7cd=_0x1a9d0c;return getUser(_0x222a91,_0x3fea66['email'],_0x38c7cd);})['then'](function(_0x4382be){_0x3571d3=_0x4382be;return getEndUser(_0x222a91,_0x49f7c,_0x209370[_0xb07d('0x64')],_0x209370[_0xb07d('0x65')],_0x38c7cd);})[_0xb07d('0x24')](function(_0x45b60f){_0x26bdad=_0x45b60f;return getTicket(_0x222a91,_0x3571d3,_0x26bdad,_0x49f7c,_0x209370,_0x49f7c['Fields'],_0x38c7cd,_0xb07d('0x5b'));})[_0xb07d('0x24')](function(_0x1a2110){_0x4fa35b=_0x1a2110;logger[_0xb07d('0x2a')](_0xb07d('0x66'),_0x4fa35b['id']);logger[_0xb07d('0x2a')](_0xb07d('0x67'),_0x4fa35b['id'],_0x3fea66[_0xb07d('0x53')],_0x222a91[_0xb07d('0x4b')]);switch(_0x222a91[_0xb07d('0x4b')]){case _0xb07d('0x68'):emit(util[_0xb07d('0x42')](_0xb07d('0x69'),_0x3fea66['name']),_0xb07d('0x6a'),{'recordId':_0x4fa35b['id']});break;case _0xb07d('0x6b'):emit(util[_0xb07d('0x42')](_0xb07d('0x69'),_0x3fea66[_0xb07d('0x53')]),_0xb07d('0x6c'),{'uri':util['format'](_0xb07d('0x6d'),_0x38c7cd['instanceUrl'],_0x4fa35b['id'])});break;default:logger[_0xb07d('0x6e')](_0xb07d('0x6f'));}})[_0xb07d('0x70')](function(_0x7d4a7e){logger[_0xb07d('0x6e')](_0xb07d('0x60'),_0x7d4a7e);});};exports[_0xb07d('0x71')]=function(_0x1508f3,_0x37e7c3,_0x237a34,_0x362f1d,_0x14d663,_0x33fc1a,_0x41b715){var _0x562911,_0x1f9f87,_0x474547,_0x1bf1ab;_0x33fc1a['serverUrl']=intUtil[_0xb07d('0x5c')](_0x33fc1a[_0xb07d('0x5d')]);_0x33fc1a[_0xb07d('0x5e')]=intUtil[_0xb07d('0x5c')](_0x33fc1a[_0xb07d('0x5e')]);if(_0x41b715&&_0x41b715['recordingFormat']&&_0x41b715['recordingFormat']!==_0xb07d('0x72')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x37e7c3['recordingURL']=util[_0xb07d('0x42')](_0xb07d('0x73'),_0x33fc1a[_0xb07d('0x5d')],_0x37e7c3['uniqueid'],md5(_0x37e7c3[_0xb07d('0x63')]));}return getConnection(_0x33fc1a)[_0xb07d('0x24')](function(_0x5247d1){_0x1bf1ab=_0x5247d1;return getUser(_0x33fc1a,_0x362f1d[_0xb07d('0x74')],_0x1bf1ab);})[_0xb07d('0x24')](function(_0x579a42){_0x562911=_0x579a42;return getEndUser(_0x33fc1a,_0x237a34,_0x37e7c3[_0xb07d('0x75')],_0x37e7c3[_0xb07d('0x76')],_0x1bf1ab);})[_0xb07d('0x24')](function(_0x19119c){_0x1f9f87=_0x19119c;return getTicket(_0x33fc1a,_0x562911,_0x1f9f87,_0x237a34,_0x37e7c3,_0x237a34[_0xb07d('0x77')],_0x1bf1ab,'outbound');})[_0xb07d('0x24')](function(_0x4928fb){_0x474547=_0x4928fb;logger[_0xb07d('0x2a')](_0xb07d('0x78'),_0x474547['id']);logger[_0xb07d('0x2a')](_0xb07d('0x79'),_0x474547['id'],_0x362f1d[_0xb07d('0x53')],_0x33fc1a['type']);switch(_0x33fc1a[_0xb07d('0x4b')]){case _0xb07d('0x68'):emit(util[_0xb07d('0x42')](_0xb07d('0x69'),_0x362f1d[_0xb07d('0x53')]),_0xb07d('0x6a'),{'recordId':_0x474547['id']});break;case'newTab':emit(util[_0xb07d('0x42')]('user:%s',_0x362f1d[_0xb07d('0x53')]),'trigger:browser:url',{'uri':util['format'](_0xb07d('0x6d'),_0x1bf1ab['instanceUrl'],_0x474547['id'])});break;default:logger[_0xb07d('0x6e')](_0xb07d('0x7a'),_0xb07d('0x7b'));}})[_0xb07d('0x70')](function(_0xdd718f){logger[_0xb07d('0x6e')](_0xb07d('0x7a'),_0xdd718f);});};exports['unmanaged']=function(_0x2daf86,_0x152748,_0x41a214,_0x1c27ac,_0x4d593d,_0x549f8b){var _0x33726f,_0x4490c8,_0x151230,_0x5506a9;_0x549f8b[_0xb07d('0x5d')]=intUtil[_0xb07d('0x5c')](_0x549f8b[_0xb07d('0x5d')]);_0x549f8b[_0xb07d('0x5e')]=intUtil['stripTrailingSlash'](_0x549f8b[_0xb07d('0x5e')]);if(_0x4d593d&&_0x4d593d[_0xb07d('0x5f')]){logger[_0xb07d('0x2a')]('['+_0x152748[_0xb07d('0x7c')][_0xb07d('0x7d')]()+']','Recording\x20is\x20enabled!');_0x152748[_0xb07d('0x62')]=util[_0xb07d('0x42')](_0xb07d('0x73'),_0x549f8b['serverUrl'],_0x152748[_0xb07d('0x63')],md5(_0x152748[_0xb07d('0x63')]));}else{_0x152748[_0xb07d('0x62')]='';}return getConnection(_0x549f8b)['then'](function(_0x273831){_0x5506a9=_0x273831;if(!_[_0xb07d('0x1f')](_0x1c27ac)){return getUser(_0x549f8b,_0x1c27ac['name'],_0x5506a9);}else{return getUser(_0x549f8b,null,_0x5506a9);}})[_0xb07d('0x24')](function(_0x31e1bd){_0x33726f=_0x31e1bd;return getEndUser(_0x549f8b,_0x41a214,_0x152748['calleridname'],_0x152748[_0xb07d('0x65')],_0x5506a9);})[_0xb07d('0x24')](function(_0x38b74e){_0x4490c8=_0x38b74e;return getTicket(_0x549f8b,_0x33726f,_0x4490c8,_0x41a214,_0x152748,_0x41a214[_0xb07d('0x77')],_0x5506a9);})[_0xb07d('0x24')](function(_0x262b45){_0x151230=_0x262b45;logger[_0xb07d('0x2a')]('['+_0x152748[_0xb07d('0x7c')][_0xb07d('0x7d')]()+_0xb07d('0x7e'),_0x151230['id']);logger['info']('['+_0x152748[_0xb07d('0x7c')][_0xb07d('0x7d')]()+_0xb07d('0x7f'),_0x549f8b['type']);})[_0xb07d('0x70')](function(_0x2f1714){logger['error']('['+_0x152748[_0xb07d('0x7c')]['toUpperCase']()+']',_0x2f1714);});}; \ 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 1d9ad99..6283d63 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 _0x616c=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','sys_id','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','Descriptions','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x616c,0x1ce));var _0xc616=function(_0x23e992,_0x59158f){_0x23e992=_0x23e992-0x0;var _0x5377fc=_0x616c[_0x23e992];return _0x5377fc;};'use strict';var _=require(_0xc616('0x0'));var Promise=require(_0xc616('0x1'));var rp=require(_0xc616('0x2'));var util=require(_0xc616('0x3'));var md5=require(_0xc616('0x4'));var Redis=require(_0xc616('0x5'));var intUtil=require(_0xc616('0x6'));var config=require(_0xc616('0x7'));var logger=require(_0xc616('0x8'))(_0xc616('0x9'));config['redis']=_['defaults'](config[_0xc616('0xa')],{'host':_0xc616('0xb'),'port':0x18eb});var io=require(_0xc616('0xc'))(new Redis(config[_0xc616('0xa')]));function getAdminUser(_0x3edc6c,_0x260947,_0x256399,_0x59fc1c,_0x478ffd,_0x18f7fc){return new Promise(function(_0x2f4047,_0x5bec8c){var _0x3c44a8={'method':_0xc616('0xd'),'uri':_0x59fc1c+_0xc616('0xe')+'&'+_0x478ffd+'&'+_0x18f7fc,'auth':_0x260947,'json':!![]};return rp(_0x3c44a8)[_0xc616('0xf')](function(_0x109ab1){if(_0x109ab1[_0xc616('0x10')][_0xc616('0x11')]>0x0){_0x256399[_0xc616('0x12')]=_0x109ab1[_0xc616('0x10')][0x0]['sys_id'];}logger[_0xc616('0x13')]('['+[_0x3edc6c[_0xc616('0x14')]()]+'],\x20getAdminUser\x20crm',_0x256399);_0x2f4047(_0x256399);})['catch'](function(_0x74ec4e){logger[_0xc616('0x15')]('['+[_0x3edc6c[_0xc616('0x14')]()]+']',_0x74ec4e[_0xc616('0x16')]);_0x5bec8c(_0x74ec4e[_0xc616('0x16')]);});});}function getUser(_0x1aa558,_0xc9121a,_0x30e4c8,_0x30fc4a,_0x15f5fe){return function(_0x42cf42){logger['info']('['+[_0x1aa558[_0xc616('0x14')]()]+_0xc616('0x17'),_0x42cf42);return new Promise(function(_0xf5f5d7,_0x3752ba){if(intUtil[_0xc616('0x18')](_0x42cf42[_0xc616('0x19')])){var _0x587b80={'method':_0xc616('0xd'),'uri':_0x30e4c8+_0xc616('0x1a')+_0x42cf42[_0xc616('0x19')]+'&'+_0x30fc4a+'&'+_0x15f5fe,'auth':_0xc9121a,'json':!![]};logger['info']('['+[_0x1aa558['toUpperCase']()]+_0xc616('0x1b'),_0x587b80);return rp(_0x587b80)[_0xc616('0xf')](function(_0x25fc90){logger[_0xc616('0x13')]('['+[_0x1aa558['toUpperCase']()]+_0xc616('0x1c'),_0x25fc90);if(_0x25fc90[_0xc616('0x10')][_0xc616('0x11')]>0x0&&String(_0x25fc90[_0xc616('0x10')][0x0][_0xc616('0x1d')])===_0xc616('0x1e')){_0x42cf42[_0xc616('0x1f')]=_0x25fc90[_0xc616('0x10')][0x0][_0xc616('0x20')];}else{_0x42cf42[_0xc616('0x1f')]=_0x42cf42[_0xc616('0x12')];_0x42cf42[_0xc616('0x19')]=_0x42cf42[_0xc616('0x21')];}logger[_0xc616('0x13')]('['+[_0x1aa558['toUpperCase']()]+'],\x20getUser\x20crm',_0x42cf42);_0xf5f5d7(_0x42cf42);})[_0xc616('0x22')](function(_0x480741){logger[_0xc616('0x15')]('['+[_0x1aa558[_0xc616('0x14')]()]+']',_0x480741[_0xc616('0x16')]);_0x3752ba(_0x480741[_0xc616('0x16')]);});}else{logger[_0xc616('0x13')]('['+[_0x1aa558[_0xc616('0x14')]()]+_0xc616('0x23'));_0x42cf42[_0xc616('0x1f')]=_0x42cf42['adminId'];_0x42cf42['userEmail']=_0x42cf42[_0xc616('0x21')];_0xf5f5d7(_0x42cf42);}});};}function createEndUser(_0x22d89c,_0xfbd8e3,_0xefdf53,_0x4223c8,_0x1c8b7b){logger[_0xc616('0x13')]('['+[_0x22d89c[_0xc616('0x14')]()]+_0xc616('0x24'),_0xefdf53);return new Promise(function(_0x2158ce,_0x296447){var _0x374a62={'method':_0xc616('0x25'),'uri':_0x4223c8+_0xc616('0x26')+_0x1c8b7b,'body':{'user_name':_0xefdf53['endUserNumber'],'roles':'user','first_name':_0xefdf53[_0xc616('0x27')],'active':_0xc616('0x1e'),'date_format':'System','phone':_0xefdf53['endUserNumber']},'auth':_0xfbd8e3,'json':!![]};return rp(_0x374a62)['then'](function(_0x1fe781){logger[_0xc616('0x13')]('['+[_0x22d89c['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1fe781[_0xc616('0x10')]);_0xefdf53[_0xc616('0x28')]=_0x1fe781['result']['sys_id'];_0x2158ce(_0xefdf53);})['catch'](function(_0x31ad0f){logger['error']('['+[_0x22d89c[_0xc616('0x14')]()]+']',_0x31ad0f['message']);_0x296447(_0x31ad0f[_0xc616('0x16')]);});});}function getEndUser(_0x4ed336,_0x35729d,_0xc083db,_0x1f5210,_0x2faf10){return function(_0x420f73){logger[_0xc616('0x13')]('['+[_0x4ed336[_0xc616('0x14')]()]+_0xc616('0x29'),_0x420f73);return new Promise(function(_0x14cbee,_0x4b945a){var _0x19c313={'method':'GET','uri':_0xc083db+_0xc616('0x2a')+_0x420f73[_0xc616('0x27')]+'&'+_0x1f5210+'&'+_0x2faf10,'auth':_0x35729d,'json':!![]};return rp(_0x19c313)[_0xc616('0xf')](function(_0x2628c8){if(_0x2628c8['result']['length']>0x0){_0x420f73[_0xc616('0x28')]=_0x2628c8[_0xc616('0x10')][0x0][_0xc616('0x20')];logger[_0xc616('0x13')]('['+[_0x4ed336[_0xc616('0x14')]()]+_0xc616('0x2b'),_0x420f73);_0x14cbee(_0x420f73);}else{return createEndUser(_0x4ed336,_0x35729d,_0x420f73,_0xc083db,_0x1f5210)[_0xc616('0xf')](function(_0x188b6e){logger[_0xc616('0x13')]('['+[_0x4ed336[_0xc616('0x14')]()]+'],\x20createEndUser\x20crm',_0x188b6e);_0x14cbee(_0x188b6e);});}})['catch'](function(_0x296694){logger[_0xc616('0x15')]('['+[_0x4ed336[_0xc616('0x14')]()]+']',_0x296694['message']);_0x4b945a(_0x296694[_0xc616('0x16')]);});});};}function getCustomFields(_0x494f43,_0x4d15a8){var _0x17c4c9={};if(_0x494f43[_0xc616('0x11')]>0x0){_['forEach'](_0x494f43,function(_0x51e0dc){if(_['includes']([_0xc616('0x2c'),_0xc616('0x2d')],_0x51e0dc[_0xc616('0x2e')])&&_0x51e0dc[_0xc616('0x2f')]&&!_0x51e0dc[_0xc616('0x30')]){_0x17c4c9[_0x51e0dc[_0xc616('0x2f')][_0xc616('0x31')]()]=_0x51e0dc[_0xc616('0x32')][_0xc616('0x33')]();}else if(_['includes']([_0xc616('0x2c'),'picklist'],_0x51e0dc['type'])&&_0x51e0dc[_0xc616('0x34')]&&_0x51e0dc[_0xc616('0x30')]){_0x17c4c9[_0x51e0dc['idField'][_0xc616('0x31')]()]=_0x51e0dc[_0xc616('0x32')]['toString']();}else if(_0x51e0dc[_0xc616('0x2e')]===_0xc616('0x35')&&_0x51e0dc[_0xc616('0x36')]&&_0x51e0dc[_0xc616('0x34')]&&_0x51e0dc['customField']){_0x17c4c9[_0x51e0dc['idField']['toLowerCase']()]=_0x4d15a8[_0x51e0dc[_0xc616('0x36')]][_0xc616('0x33')]();}else if(_0x51e0dc[_0xc616('0x2e')]===_0xc616('0x37')&&_0x51e0dc['Variable']&&_0x51e0dc[_0xc616('0x38')]['name']&&_0x51e0dc[_0xc616('0x34')]&&_0x51e0dc[_0xc616('0x30')]){_0x17c4c9[_0x51e0dc[_0xc616('0x34')][_0xc616('0x31')]()]=_0x4d15a8[_0x51e0dc[_0xc616('0x38')][_0xc616('0x39')]['toLowerCase']()][_0xc616('0x33')]();}});}return _0x17c4c9;}function getTicket(_0xa97ec9,_0x20e71d,_0x4f3a5a,_0x3d97fb,_0x20f940,_0x591609){return function(_0x341046){logger[_0xc616('0x13')]('['+[_0xa97ec9[_0xc616('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x341046);return new Promise(function(_0x447050,_0x53ed68){var _0x2a93bd=_0xa97ec9['toLowerCase']()===_0xc616('0x3a')?_0x341046[_0xc616('0x1f')]:_0x341046['endUserId'];var _0x1368b8={'method':_0xc616('0x25'),'uri':_0x4f3a5a+_0xc616('0x3b')+'?'+_0x591609,'body':Object[_0xc616('0x3c')]({},{'active':'true','caller_id':_0x2a93bd,'assigned_to':_0x341046[_0xc616('0x1f')],'short_description':intUtil['getString'](_0x3d97fb[_0xc616('0x3d')],_0x20f940,'\x20'),'description':intUtil['getString'](_0x3d97fb[_0xc616('0x3e')],_0x20f940,'\x0a')},getCustomFields(_0x3d97fb['Fields'],_0x20f940)),'auth':_0x20e71d,'json':!![]};return rp(_0x1368b8)[_0xc616('0xf')](function(_0xc749bf){logger[_0xc616('0x13')]('['+[_0xa97ec9['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0xc749bf[_0xc616('0x10')]);_0x341046[_0xc616('0x3f')]=_0xc749bf[_0xc616('0x10')][_0xc616('0x20')];_0x341046[_0xc616('0x40')]=_0xc749bf[_0xc616('0x10')][_0xc616('0x41')];logger[_0xc616('0x13')]('['+[_0xa97ec9[_0xc616('0x14')]()]+_0xc616('0x42'),_0x341046);_0x447050(_0x341046);})[_0xc616('0x22')](function(_0x2e8946){logger[_0xc616('0x15')]('['+[_0xa97ec9[_0xc616('0x14')]()]+']',_0x2e8946[_0xc616('0x16')]);_0x53ed68(_0x2e8946['message']);});});};}function createRemoteTag(_0x1a8c1a,_0x5a0957,_0x55f65f,_0x245c17){return new Promise(function(_0x322f63,_0x26ab35){var _0x47b938={'method':_0xc616('0x25'),'uri':_0x55f65f+_0xc616('0x43')+'?'+_0x245c17,'body':{'short_description':_0x1a8c1a,'global':!![],'active':!![],'name':_0x1a8c1a},'auth':_0x5a0957,'json':!![]};return rp(_0x47b938)['then'](function(_0x29a494){var _0x150557=_0x29a494[_0xc616('0x10')][_0xc616('0x20')];_0x322f63(_0x150557);});});}function getRemoteTag(_0xe514a2,_0x589a57,_0x33340a,_0x224f67,_0x46bc0d){return new Promise(function(_0x5d55c5,_0x5e0cd8){var _0x5f1b84={'method':_0xc616('0xd'),'uri':_0x33340a+_0xc616('0x43')+_0xc616('0x44')+_0xe514a2+'&'+_0x224f67,'auth':_0x589a57,'json':!![]};return rp(_0x5f1b84)['then'](function(_0x173af8){if(_0x173af8[_0xc616('0x10')][_0xc616('0x11')]>0x0){var _0x3e4c09=_0x173af8[_0xc616('0x10')][0x0]['sys_id'];_0x5d55c5(_0x3e4c09);}else{return createRemoteTag(_0xe514a2,_0x589a57,_0x33340a,_0x224f67)['then'](function(_0x356d38){_0x5d55c5(_0x356d38);});}});});}function assignTagToIncident(_0xa4fbe1,_0x2a8a02,_0x5a2eb2,_0x2c365e,_0x10de4e){return new Promise(function(_0x32dda1,_0x40741b){var _0x4d5c1c={'method':_0xc616('0x25'),'uri':_0x5a2eb2+_0xc616('0x45')+'?'+_0x10de4e,'body':{'label':_0xa4fbe1,'table':_0xc616('0x3b'),'id_type':_0xc616('0x46'),'table_key':_0x2c365e[_0xc616('0x3f')],'title':_0xc616('0x47')+_0x2c365e['ticketNumber'],'id_display':_0x2c365e[_0xc616('0x40')]},'auth':_0x2a8a02,'json':!![]};return rp(_0x4d5c1c)[_0xc616('0xf')](function(_0x251f02){_0x32dda1();})[_0xc616('0x22')](function(){_0x32dda1();});});}function manageTags(_0x186c1a,_0x4fda56,_0x392c32,_0x43e287,_0x506ef8,_0xaa5077,_0x1c06ab){return new Promise(function(_0x11e3e7,_0x586e20){var _0x4e3477=[];_0x4fda56[_0xc616('0x48')](function(_0x3083cf){_0x4e3477[_0xc616('0x49')](getRemoteTag(_0x3083cf,_0x392c32,_0x43e287,_0xaa5077,_0x1c06ab));});return Promise[_0xc616('0x4a')](_0x4e3477)[_0xc616('0xf')](function(_0x5d175a){if(_0x5d175a[_0xc616('0x11')]){logger[_0xc616('0x13')]('['+[_0x186c1a[_0xc616('0x14')]()]+_0xc616('0x4b'),_0x5d175a);var _0x4d6ab6=[];_0x5d175a[_0xc616('0x48')](function(_0x49ee41){_0x4d6ab6[_0xc616('0x49')](assignTagToIncident(_0x49ee41,_0x392c32,_0x43e287,_0x506ef8,_0xaa5077));});return Promise[_0xc616('0x4a')](_0x4d6ab6)['then'](function(){_0x11e3e7();})['catch'](function(){_0x11e3e7();});}else{_0x11e3e7();}});});}function getTags(_0x2278cc,_0x4f8706,_0x4a0c32,_0x1c1014,_0xc94691,_0x1db24e){return function(_0x2711c5){return new Promise(function(_0x565d21,_0x289ed2){var _0x381d15=[];var _0x244b3b=_0x1c1014[_0xc616('0x4c')];if(_0x244b3b&&_0x244b3b[_0xc616('0x11')]>0x0){_0x381d15=_[_0xc616('0x4d')](_0x244b3b,'name');}if(_0x381d15[_0xc616('0x11')]>0x0){return manageTags(_0x2278cc,_0x381d15,_0x4f8706,_0x4a0c32,_0x2711c5,_0xc94691,_0x1db24e)['then'](function(){_0x565d21(_0x2711c5);});}else{_0x565d21(_0x2711c5);}});};}function emit(_0x4c30d7,_0x3b94a2,_0x228953){var _0x4d4b00=_0xc616('0x4e')+_0xc616('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x45ecdd={'uri':_0x4c30d7+_0xc616('0x50')+_0x228953+_0x4d4b00};io['to'](util['format'](_0xc616('0x51'),_0x3b94a2))[_0xc616('0x52')](_0xc616('0x53'),_0x45ecdd);}exports['cs']=function(_0x38b6cd,_0x55e88d,_0x2a80ca,_0x238cf7,_0x5b9126,_0x4f9800,_0x48f91e,_0x2ddaf3){var _0x5ec613={};var _0x2409de={'user':_0x4f9800[_0xc616('0x54')],'pass':_0x4f9800[_0xc616('0x55')]};var _0x100646=_0xc616('0x56');var _0x5a2944=_0xc616('0x57');_0x4f9800[_0xc616('0x58')]=intUtil[_0xc616('0x59')](_0x4f9800[_0xc616('0x58')]);_0x4f9800[_0xc616('0x5a')]=intUtil['stripTrailingSlash'](_0x4f9800['serverUrl']);var _0x416773=util[_0xc616('0x5b')](_0xc616('0x5c'),_0x4f9800['remoteUri']);_0x5ec613['userEmail']=!_[_0xc616('0x5d')](_0x238cf7)?_0x238cf7[_0xc616('0x5e')]:null;_0x5ec613[_0xc616('0x21')]=_0x4f9800['email'];_0x5ec613['endUserNumber']=_0x2ddaf3[_0xc616('0x31')]()===_0xc616('0x3a')?_0x55e88d[_0xc616('0x5f')]:_0x55e88d[_0xc616('0x60')];_0x5ec613[_0xc616('0x61')]=_0x2ddaf3===_0xc616('0x62')||_0x2ddaf3===_0xc616('0x63')?_0xc616('0x62'):_0xc616('0x3a');var _0x4e3a9c=util[_0xc616('0x5b')](_0xc616('0x64'),_0x4f9800['serverUrl'],_0x55e88d['uniqueid'],md5(_0x55e88d[_0xc616('0x65')]));if(_0x5b9126&&_0x5b9126[_0xc616('0x66')]){logger[_0xc616('0x13')](_0xc616('0x67'),_0xc616('0x68'));_0x55e88d[_0xc616('0x69')]=_0x4e3a9c;}else if(_0x48f91e&&_0x48f91e[_0xc616('0x6a')]&&_0x48f91e['recordingFormat']!==_0xc616('0x6b')){logger[_0xc616('0x13')](_0xc616('0x6c'),_0xc616('0x68'));_0x55e88d[_0xc616('0x69')]=_0x4e3a9c;}else{_0x55e88d[_0xc616('0x69')]='';}return getAdminUser(_0x2ddaf3,_0x2409de,_0x5ec613,_0x416773,_0x5a2944,_0x100646)['then'](getUser(_0x2ddaf3,_0x2409de,_0x416773,_0x5a2944,_0x100646))[_0xc616('0xf')](getEndUser(_0x2ddaf3,_0x2409de,_0x416773,_0x5a2944,_0x100646))[_0xc616('0xf')](getTicket(_0x2ddaf3,_0x2409de,_0x416773,_0x2a80ca,_0x55e88d,_0x5a2944))[_0xc616('0xf')](function(_0x239aa0){logger[_0xc616('0x13')](util['format'](_0xc616('0x6d'),_0x239aa0[_0xc616('0x3f')]));logger[_0xc616('0x13')](util[_0xc616('0x5b')](_0xc616('0x6e'),_0x2ddaf3));if(_0x2ddaf3!=='unmanaged'){logger[_0xc616('0x13')]('['+[_0x2ddaf3[_0xc616('0x14')]()]+']',_0xc616('0x6f'));emit(_0x4f9800[_0xc616('0x58')],_0x238cf7[_0xc616('0x39')],_0x239aa0['ticketId']);}})[_0xc616('0x22')](function(_0x2262ea){logger['error']('['+[_0x2ddaf3['toUpperCase']()]+_0xc616('0x70'),util['inspect'](_0x2262ea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4913=['ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','customField','nameField','toLowerCase','toString','variable','variableName','idField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0x104a7c,_0x19cd3e){var _0x5eaea6=function(_0xb2d6f4){while(--_0xb2d6f4){_0x104a7c['push'](_0x104a7c['shift']());}};_0x5eaea6(++_0x19cd3e);}(_0x4913,0x100));var _0x3491=function(_0x4d0660,_0x14676d){_0x4d0660=_0x4d0660-0x0;var _0x52876c=_0x4913[_0x4d0660];return _0x52876c;};'use strict';var _=require(_0x3491('0x0'));var Promise=require('bluebird');var rp=require(_0x3491('0x1'));var util=require(_0x3491('0x2'));var md5=require(_0x3491('0x3'));var Redis=require(_0x3491('0x4'));var intUtil=require(_0x3491('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x3491('0x6')]=_[_0x3491('0x7')](config[_0x3491('0x6')],{'host':_0x3491('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3491('0x6')]));function getAdminUser(_0x337b96,_0x97d3f5,_0x3d0b36,_0x3cf01a,_0x2d0748,_0x35f712){return new Promise(function(_0x44b0c7,_0x44ddc7){var _0x141b45={'method':_0x3491('0x9'),'uri':_0x3cf01a+_0x3491('0xa')+'&'+_0x2d0748+'&'+_0x35f712,'auth':_0x97d3f5,'json':!![]};return rp(_0x141b45)[_0x3491('0xb')](function(_0x83c90a){if(_0x83c90a[_0x3491('0xc')][_0x3491('0xd')]>0x0){_0x3d0b36[_0x3491('0xe')]=_0x83c90a['result'][0x0][_0x3491('0xf')];}logger['info']('['+[_0x337b96[_0x3491('0x10')]()]+_0x3491('0x11'),_0x3d0b36);_0x44b0c7(_0x3d0b36);})[_0x3491('0x12')](function(_0x244278){logger[_0x3491('0x13')]('['+[_0x337b96[_0x3491('0x10')]()]+']',_0x244278[_0x3491('0x14')]);_0x44ddc7(_0x244278[_0x3491('0x14')]);});});}function getUser(_0x5ce6c3,_0x5036bd,_0x15bb01,_0x530d01,_0x551f19){return function(_0x5db264){logger[_0x3491('0x15')]('['+[_0x5ce6c3[_0x3491('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x5db264);return new Promise(function(_0x3d6871,_0x2f8eb0){if(intUtil[_0x3491('0x16')](_0x5db264[_0x3491('0x17')])){var _0x6ac697={'method':_0x3491('0x9'),'uri':_0x15bb01+'sys_user?sysparm_query=email%3D'+_0x5db264['userEmail']+'&'+_0x530d01+'&'+_0x551f19,'auth':_0x5036bd,'json':!![]};logger[_0x3491('0x15')]('['+[_0x5ce6c3[_0x3491('0x10')]()]+_0x3491('0x18'),_0x6ac697);return rp(_0x6ac697)[_0x3491('0xb')](function(_0x583d4e){logger['info']('['+[_0x5ce6c3['toUpperCase']()]+_0x3491('0x19'),_0x583d4e);if(_0x583d4e[_0x3491('0xc')]['length']>0x0&&String(_0x583d4e['result'][0x0][_0x3491('0x1a')])===_0x3491('0x1b')){_0x5db264[_0x3491('0x1c')]=_0x583d4e[_0x3491('0xc')][0x0][_0x3491('0xf')];}else{_0x5db264[_0x3491('0x1c')]=_0x5db264[_0x3491('0xe')];_0x5db264[_0x3491('0x17')]=_0x5db264[_0x3491('0x1d')];}logger['info']('['+[_0x5ce6c3[_0x3491('0x10')]()]+'],\x20getUser\x20crm',_0x5db264);_0x3d6871(_0x5db264);})[_0x3491('0x12')](function(_0x269604){logger[_0x3491('0x13')]('['+[_0x5ce6c3[_0x3491('0x10')]()]+']',_0x269604['message']);_0x2f8eb0(_0x269604[_0x3491('0x14')]);});}else{logger[_0x3491('0x15')]('['+[_0x5ce6c3['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x5db264[_0x3491('0x1c')]=_0x5db264[_0x3491('0xe')];_0x5db264[_0x3491('0x17')]=_0x5db264['adminEmail'];_0x3d6871(_0x5db264);}});};}function createEndUser(_0x98e42f,_0x57f034,_0x56ea39,_0x3213e4,_0xe15324){logger[_0x3491('0x15')]('['+[_0x98e42f[_0x3491('0x10')]()]+_0x3491('0x1e'),_0x56ea39);return new Promise(function(_0x526871,_0x12339d){var _0x2add55={'method':'POST','uri':_0x3213e4+_0x3491('0x1f')+_0xe15324,'body':{'user_name':_0x56ea39[_0x3491('0x20')],'roles':'user','first_name':_0x56ea39[_0x3491('0x20')],'active':_0x3491('0x1b'),'date_format':_0x3491('0x21'),'phone':_0x56ea39[_0x3491('0x20')]},'auth':_0x57f034,'json':!![]};return rp(_0x2add55)['then'](function(_0x1d4af5){logger[_0x3491('0x15')]('['+[_0x98e42f[_0x3491('0x10')]()]+_0x3491('0x22'),_0x1d4af5[_0x3491('0xc')]);_0x56ea39[_0x3491('0x23')]=_0x1d4af5[_0x3491('0xc')][_0x3491('0xf')];_0x526871(_0x56ea39);})[_0x3491('0x12')](function(_0x2705cb){logger['error']('['+[_0x98e42f[_0x3491('0x10')]()]+']',_0x2705cb[_0x3491('0x14')]);_0x12339d(_0x2705cb[_0x3491('0x14')]);});});}function getEndUser(_0x92c475,_0x22d8c3,_0x25d694,_0x21a0de,_0x18d677){return function(_0x166638){logger['info']('['+[_0x92c475[_0x3491('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x166638);return new Promise(function(_0x22f34a,_0x404147){var _0x5f408c={'method':_0x3491('0x9'),'uri':_0x25d694+'sys_user?sysparm_query=phone%3D'+_0x166638['endUserNumber']+'&'+_0x21a0de+'&'+_0x18d677,'auth':_0x22d8c3,'json':!![]};return rp(_0x5f408c)[_0x3491('0xb')](function(_0x3d3df3){if(_0x3d3df3[_0x3491('0xc')][_0x3491('0xd')]>0x0){_0x166638[_0x3491('0x23')]=_0x3d3df3[_0x3491('0xc')][0x0][_0x3491('0xf')];logger[_0x3491('0x15')]('['+[_0x92c475['toUpperCase']()]+_0x3491('0x24'),_0x166638);_0x22f34a(_0x166638);}else{return createEndUser(_0x92c475,_0x22d8c3,_0x166638,_0x25d694,_0x21a0de)['then'](function(_0x1e76b2){logger[_0x3491('0x15')]('['+[_0x92c475[_0x3491('0x10')]()]+_0x3491('0x25'),_0x1e76b2);_0x22f34a(_0x1e76b2);});}})[_0x3491('0x12')](function(_0x5a4b84){logger[_0x3491('0x13')]('['+[_0x92c475[_0x3491('0x10')]()]+']',_0x5a4b84[_0x3491('0x14')]);_0x404147(_0x5a4b84[_0x3491('0x14')]);});});};}function getCustomFields(_0x4c7792,_0x379df8){var _0x36173a={};if(_0x4c7792[_0x3491('0xd')]>0x0){_[_0x3491('0x26')](_0x4c7792,function(_0x495625){if(_[_0x3491('0x27')](['string',_0x3491('0x28')],_0x495625[_0x3491('0x29')])&&_0x495625['nameField']&&!_0x495625[_0x3491('0x2a')]){_0x36173a[_0x495625[_0x3491('0x2b')][_0x3491('0x2c')]()]=_0x495625['content'][_0x3491('0x2d')]();}else if(_[_0x3491('0x27')](['string',_0x3491('0x28')],_0x495625[_0x3491('0x29')])&&_0x495625['idField']&&_0x495625[_0x3491('0x2a')]){_0x36173a[_0x495625['idField']['toLowerCase']()]=_0x495625['content'][_0x3491('0x2d')]();}else if(_0x495625[_0x3491('0x29')]===_0x3491('0x2e')&&_0x495625[_0x3491('0x2f')]&&_0x495625[_0x3491('0x30')]&&_0x495625[_0x3491('0x2a')]){_0x36173a[_0x495625['idField'][_0x3491('0x2c')]()]=_0x379df8[_0x495625['variableName']][_0x3491('0x2d')]();}else if(_0x495625['type']==='customVariable'&&_0x495625['Variable']&&_0x495625[_0x3491('0x31')]['name']&&_0x495625[_0x3491('0x30')]&&_0x495625['customField']){_0x36173a[_0x495625['idField'][_0x3491('0x2c')]()]=_0x379df8[_0x495625[_0x3491('0x31')][_0x3491('0x32')][_0x3491('0x2c')]()][_0x3491('0x2d')]();}});}return _0x36173a;}function getTicket(_0x2017b4,_0x117938,_0x16f723,_0xd12c00,_0x3131ea,_0x41b8cc){return function(_0x3962a5){logger[_0x3491('0x15')]('['+[_0x2017b4['toUpperCase']()]+_0x3491('0x33'),_0x3962a5);return new Promise(function(_0x25d74a,_0x2afb15){var _0x25c3a1=_0x2017b4['toLowerCase']()===_0x3491('0x34')?_0x3962a5['userId']:_0x3962a5[_0x3491('0x23')];var _0x22d66e={'method':_0x3491('0x35'),'uri':_0x16f723+'incident'+'?'+_0x41b8cc,'body':Object['assign']({},{'active':_0x3491('0x1b'),'caller_id':_0x25c3a1,'assigned_to':_0x3962a5[_0x3491('0x1c')],'short_description':intUtil['getString'](_0xd12c00[_0x3491('0x36')],_0x3131ea,'\x20'),'description':intUtil['getString'](_0xd12c00[_0x3491('0x37')],_0x3131ea,'\x0a')},getCustomFields(_0xd12c00[_0x3491('0x38')],_0x3131ea)),'auth':_0x117938,'json':!![]};return rp(_0x22d66e)[_0x3491('0xb')](function(_0x31768c){logger[_0x3491('0x15')]('['+[_0x2017b4['toUpperCase']()]+_0x3491('0x39'),_0x31768c['result']);_0x3962a5[_0x3491('0x3a')]=_0x31768c[_0x3491('0xc')][_0x3491('0xf')];_0x3962a5[_0x3491('0x3b')]=_0x31768c['result']['number'];logger['info']('['+[_0x2017b4[_0x3491('0x10')]()]+_0x3491('0x3c'),_0x3962a5);_0x25d74a(_0x3962a5);})[_0x3491('0x12')](function(_0x3d055e){logger[_0x3491('0x13')]('['+[_0x2017b4[_0x3491('0x10')]()]+']',_0x3d055e[_0x3491('0x14')]);_0x2afb15(_0x3d055e[_0x3491('0x14')]);});});};}function createRemoteTag(_0x553320,_0x1c1ba0,_0x69a801,_0x20e08f){return new Promise(function(_0x46c224,_0x2f933f){var _0x37a8dd={'method':_0x3491('0x35'),'uri':_0x69a801+_0x3491('0x3d')+'?'+_0x20e08f,'body':{'short_description':_0x553320,'global':!![],'active':!![],'name':_0x553320},'auth':_0x1c1ba0,'json':!![]};return rp(_0x37a8dd)[_0x3491('0xb')](function(_0xba5376){var _0x562352=_0xba5376[_0x3491('0xc')][_0x3491('0xf')];_0x46c224(_0x562352);});});}function getRemoteTag(_0x1f6cac,_0x4f2269,_0x465c4a,_0x143510,_0x54f266){return new Promise(function(_0x5b51fd,_0x391635){var _0x1c1fa3={'method':_0x3491('0x9'),'uri':_0x465c4a+_0x3491('0x3d')+_0x3491('0x3e')+_0x1f6cac+'&'+_0x143510,'auth':_0x4f2269,'json':!![]};return rp(_0x1c1fa3)[_0x3491('0xb')](function(_0x253ba5){if(_0x253ba5[_0x3491('0xc')][_0x3491('0xd')]>0x0){var _0x4c9e6c=_0x253ba5['result'][0x0][_0x3491('0xf')];_0x5b51fd(_0x4c9e6c);}else{return createRemoteTag(_0x1f6cac,_0x4f2269,_0x465c4a,_0x143510)['then'](function(_0x193ad0){_0x5b51fd(_0x193ad0);});}});});}function assignTagToIncident(_0x5ad992,_0x1435f3,_0x2907af,_0x40769a,_0x44c688){return new Promise(function(_0x3fe224,_0x5d0dae){var _0x4352a9={'method':_0x3491('0x35'),'uri':_0x2907af+_0x3491('0x3f')+'?'+_0x44c688,'body':{'label':_0x5ad992,'table':_0x3491('0x40'),'id_type':'Incident','table_key':_0x40769a['ticketId'],'title':_0x3491('0x41')+_0x40769a[_0x3491('0x3b')],'id_display':_0x40769a[_0x3491('0x3b')]},'auth':_0x1435f3,'json':!![]};return rp(_0x4352a9)[_0x3491('0xb')](function(_0x138c43){_0x3fe224();})['catch'](function(){_0x3fe224();});});}function manageTags(_0x3f5698,_0x3bfdf0,_0x15275c,_0x49a828,_0x53380a,_0x33a764,_0x4ebda2){return new Promise(function(_0x576258,_0x492ddb){var _0x2fa96e=[];_0x3bfdf0[_0x3491('0x26')](function(_0x32827c){_0x2fa96e[_0x3491('0x42')](getRemoteTag(_0x32827c,_0x15275c,_0x49a828,_0x33a764,_0x4ebda2));});return Promise['all'](_0x2fa96e)[_0x3491('0xb')](function(_0x23ffa5){if(_0x23ffa5[_0x3491('0xd')]){logger[_0x3491('0x15')]('['+[_0x3f5698[_0x3491('0x10')]()]+_0x3491('0x43'),_0x23ffa5);var _0x13acbe=[];_0x23ffa5['forEach'](function(_0x2af1be){_0x13acbe[_0x3491('0x42')](assignTagToIncident(_0x2af1be,_0x15275c,_0x49a828,_0x53380a,_0x33a764));});return Promise[_0x3491('0x44')](_0x13acbe)[_0x3491('0xb')](function(){_0x576258();})['catch'](function(){_0x576258();});}else{_0x576258();}});});}function getTags(_0x50635f,_0xb04886,_0x5ec222,_0x216b55,_0x57af1e,_0x1eca3f){return function(_0x4261c7){return new Promise(function(_0x3358b8,_0x529a18){var _0x4876c7=[];var _0x258c1f=_0x216b55[_0x3491('0x45')];if(_0x258c1f&&_0x258c1f[_0x3491('0xd')]>0x0){_0x4876c7=_[_0x3491('0x46')](_0x258c1f,_0x3491('0x32'));}if(_0x4876c7[_0x3491('0xd')]>0x0){return manageTags(_0x50635f,_0x4876c7,_0xb04886,_0x5ec222,_0x4261c7,_0x57af1e,_0x1eca3f)[_0x3491('0xb')](function(){_0x3358b8(_0x4261c7);});}else{_0x3358b8(_0x4261c7);}});};}function emit(_0x5d98fb,_0x3129c,_0x3cc52a){var _0x20fcdf='%26sysparm_record_target%3Dincident'+_0x3491('0x47')+_0x3491('0x48')+'%255EORDERBYDESCnumber';var _0xf887f5={'uri':_0x5d98fb+_0x3491('0x49')+_0x3cc52a+_0x20fcdf};io['to'](util[_0x3491('0x4a')]('user:%s',_0x3129c))[_0x3491('0x4b')](_0x3491('0x4c'),_0xf887f5);}exports['cs']=function(_0x4d00b8,_0x47c005,_0x4629eb,_0x3cafb2,_0x4de05c,_0x4d2f90,_0x559573,_0x5c78c9){var _0x1c5159={};var _0x53176e={'user':_0x4d2f90[_0x3491('0x4d')],'pass':_0x4d2f90[_0x3491('0x4e')]};var _0x342453=_0x3491('0x4f');var _0x4c1578=_0x3491('0x50');_0x4d2f90['remoteUri']=intUtil[_0x3491('0x51')](_0x4d2f90[_0x3491('0x52')]);_0x4d2f90[_0x3491('0x53')]=intUtil[_0x3491('0x51')](_0x4d2f90[_0x3491('0x53')]);var _0x16319e=util['format'](_0x3491('0x54'),_0x4d2f90[_0x3491('0x52')]);_0x1c5159[_0x3491('0x17')]=!_[_0x3491('0x55')](_0x3cafb2)?_0x3cafb2[_0x3491('0x56')]:null;_0x1c5159[_0x3491('0x1d')]=_0x4d2f90[_0x3491('0x56')];_0x1c5159[_0x3491('0x20')]=_0x5c78c9[_0x3491('0x2c')]()===_0x3491('0x34')?_0x47c005[_0x3491('0x57')]:_0x47c005[_0x3491('0x58')];_0x1c5159[_0x3491('0x59')]=_0x5c78c9===_0x3491('0x5a')||_0x5c78c9===_0x3491('0x5b')?_0x3491('0x5a'):_0x3491('0x34');var _0x1a9cb7=util['format'](_0x3491('0x5c'),_0x4d2f90['serverUrl'],_0x47c005['uniqueid'],md5(_0x47c005[_0x3491('0x5d')]));if(_0x4de05c&&_0x4de05c[_0x3491('0x5e')]){logger[_0x3491('0x15')](_0x3491('0x5f'),_0x3491('0x60'));_0x47c005[_0x3491('0x61')]=_0x1a9cb7;}else if(_0x559573&&_0x559573[_0x3491('0x62')]&&_0x559573[_0x3491('0x62')]!==_0x3491('0x63')){logger['info'](_0x3491('0x64'),'Recording\x20is\x20enabled!');_0x47c005['recordingURL']=_0x1a9cb7;}else{_0x47c005[_0x3491('0x61')]='';}return getAdminUser(_0x5c78c9,_0x53176e,_0x1c5159,_0x16319e,_0x4c1578,_0x342453)[_0x3491('0xb')](getUser(_0x5c78c9,_0x53176e,_0x16319e,_0x4c1578,_0x342453))[_0x3491('0xb')](getEndUser(_0x5c78c9,_0x53176e,_0x16319e,_0x4c1578,_0x342453))[_0x3491('0xb')](getTicket(_0x5c78c9,_0x53176e,_0x16319e,_0x4629eb,_0x47c005,_0x4c1578))[_0x3491('0xb')](function(_0x18d56a){logger[_0x3491('0x15')](util[_0x3491('0x4a')](_0x3491('0x65'),_0x18d56a[_0x3491('0x3a')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x5c78c9));if(_0x5c78c9!==_0x3491('0x5b')){logger[_0x3491('0x15')]('['+[_0x5c78c9[_0x3491('0x10')]()]+']',_0x3491('0x66'));emit(_0x4d2f90[_0x3491('0x52')],_0x3cafb2['name'],_0x18d56a[_0x3491('0x3a')]);}})[_0x3491('0x12')](function(_0x283760){logger['error']('['+[_0x5c78c9[_0x3491('0x10')]()]+_0x3491('0x67'),util[_0x3491('0x68')](_0x283760,{'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 136b53d..a7e9635 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 _0xa039=['queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','catch','unmanaged','lastevent','recordingURL','toUpperCase','request-promise','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','getString','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid'];(function(_0x23b2a8,_0x3bdd7f){var _0x4b2794=function(_0x460160){while(--_0x460160){_0x23b2a8['push'](_0x23b2a8['shift']());}};_0x4b2794(++_0x3bdd7f);}(_0xa039,0x120));var _0x9a03=function(_0x3f9bf6,_0x2760a4){_0x3f9bf6=_0x3f9bf6-0x0;var _0x58b56c=_0xa039[_0x3f9bf6];return _0x58b56c;};'use strict';var _=require('lodash');var rp=require(_0x9a03('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x9a03('0x1'));var Redis=require('ioredis');var intUtil=require(_0x9a03('0x2'));var config=require(_0x9a03('0x3'));var logger=require(_0x9a03('0x4'))(_0x9a03('0x5'));config[_0x9a03('0x6')]=_[_0x9a03('0x7')](config[_0x9a03('0x6')],{'host':_0x9a03('0x8'),'port':0x18eb});var io=require(_0x9a03('0x9'))(new Redis(config[_0x9a03('0x6')]));var def={'method':_0x9a03('0xa'),'json':!![]};function emit(_0x4ea046,_0x47f576,_0x4714ac){io['to'](_0x4ea046)['emit'](_0x47f576,_0x4714ac);}function getTicket(_0x5f3699,_0x2ac1ba,_0x2754b4,_0x232dcb,_0x55c62f,_0x3a3209,_0x310ad9,_0x2654e2){logger[_0x9a03('0xb')](_0x9a03('0xc'));var _0x4bddf2=new Date();var _0x424dd7=[{'name':_0x9a03('0xd'),'value':intUtil['getString'](_0x232dcb[_0x9a03('0xe')],_0x55c62f,'\x20')},{'name':_0x9a03('0xf'),'value':_0x2ac1ba['id']},{'name':'created_by','value':_0x2ac1ba['id']},{'name':_0x9a03('0x10'),'value':intUtil[_0x9a03('0x11')](_0x232dcb[_0x9a03('0x12')],_0x55c62f,'\x0a')},{'name':'date_start','value':_0x4bddf2[_0x9a03('0x13')]()[_0x9a03('0x14')](0x0,0x13)[_0x9a03('0x15')]('T','\x20')},{'name':_0x9a03('0x16'),'value':'0'},{'name':_0x9a03('0x17'),'value':'15'},{'name':'parent_id','value':_0x2754b4['id']},{'name':_0x9a03('0x18'),'value':'Contacts'},{'name':_0x9a03('0x19'),'value':_0x2754b4['name']},{'name':_0x9a03('0x1a'),'value':_0x2654e2}];if(_0x3a3209[_0x9a03('0x1b')]){_[_0x9a03('0x1c')](_0x3a3209,function(_0x349479){if(_0x55c62f[_0x349479[_0x9a03('0x1d')]]){_0x424dd7[_0x9a03('0x1e')]({'name':_0x349479[_0x9a03('0x1f')],'value':_0x55c62f[_0x349479[_0x9a03('0x1d')]]});}});}return request({'form':{'method':_0x9a03('0x20'),'input_type':_0x9a03('0x21'),'response_type':_0x9a03('0x21'),'rest_data':JSON[_0x9a03('0x22')]({'session':_0x310ad9['id'],'module_name':_0x9a03('0x23'),'name_value_list':_0x424dd7})}});}function getAuth(_0x40b7a9){return util[_0x9a03('0x24')](_0x9a03('0x25'),new Buffer(_0x40b7a9['apiKey']+':X')[_0x9a03('0x26')](_0x9a03('0x27')));}function getServerInfo(_0xb713c0){return request({'form':{'method':_0x9a03('0x28'),'input_type':_0x9a03('0x21'),'response_type':_0x9a03('0x21'),'rest_data':JSON[_0x9a03('0x22')]({'session':_0xb713c0['id']})}});}function getUser(_0x4fc297,_0x33501a,_0x45261d){if(!_['isNil'](_0x33501a)){logger[_0x9a03('0xb')](_0x9a03('0x29'),_0x33501a);return request({'form':{'method':'get_entry_list','input_type':_0x9a03('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x45261d['id'],'module_name':_0x9a03('0x2a'),'query':util[_0x9a03('0x24')](_0x9a03('0x2b'),_0x33501a),'order_by':'','offset':'0','select_fields':['id','name',_0x9a03('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x30293b){if(_0x30293b[_0x9a03('0x2d')][_0x9a03('0x1b')]){var _0x499d9d=_[_0x9a03('0x2e')](_0x30293b[_0x9a03('0x2d')],function(_0x46e2ea){return _0x46e2ea['name_value_list'][_0x9a03('0x2c')][_0x9a03('0x2f')]===_0x33501a;});if(_0x499d9d){logger[_0x9a03('0xb')](_0x9a03('0x30'));return BPromise['resolve']({'id':_0x499d9d[_0x9a03('0x31')]['id']['value'],'name':_0x499d9d[_0x9a03('0x31')]['name'][_0x9a03('0x2f')]});}}logger[_0x9a03('0xb')](_0x9a03('0x32'));return BPromise[_0x9a03('0x33')]({'id':_0x45261d['name_value_list']['user_id'][_0x9a03('0x2f')],'name':_0x45261d['name_value_list'][_0x9a03('0x2c')][_0x9a03('0x2f')]});});}else{logger[_0x9a03('0xb')](_0x9a03('0x34'));return BPromise[_0x9a03('0x33')]({'id':_0x45261d[_0x9a03('0x31')][_0x9a03('0x35')][_0x9a03('0x2f')],'name':_0x45261d[_0x9a03('0x31')]['user_name'][_0x9a03('0x2f')]});}}function getEndUser(_0xac789b,_0xfb3cd4,_0x55636d,_0x4d0a4b){logger['info'](_0x9a03('0x36'),_0x55636d);return request({'form':{'method':_0x9a03('0x37'),'input_type':'JSON','response_type':_0x9a03('0x21'),'rest_data':JSON[_0x9a03('0x22')]({'session':_0x4d0a4b['id'],'module_name':_0x9a03('0x38'),'query':util[_0x9a03('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x55636d),'order_by':'','offset':'0','select_fields':['id',_0x9a03('0xd'),_0x9a03('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9a03('0x3a')](function(_0x5fc899){if(_0x5fc899['entry_list'][_0x9a03('0x1b')]){var _0x57a2cd=_[_0x9a03('0x2e')](_0x5fc899[_0x9a03('0x2d')],function(_0x17eb8b){return _0x17eb8b[_0x9a03('0x31')]['phone_home'][_0x9a03('0x2f')]===_0x55636d;});if(_0x57a2cd){logger['info'](_0x9a03('0x3b'));return BPromise['resolve']({'id':_0x57a2cd['name_value_list']['id'][_0x9a03('0x2f')],'name':_0x57a2cd[_0x9a03('0x31')][_0x9a03('0xd')][_0x9a03('0x2f')],'phone':_0x57a2cd[_0x9a03('0x31')][_0x9a03('0x39')][_0x9a03('0x2f')]});}}else{logger[_0x9a03('0xb')](_0x9a03('0x3c'));return request({'form':{'method':_0x9a03('0x20'),'input_type':_0x9a03('0x21'),'response_type':'JSON','rest_data':JSON[_0x9a03('0x22')]({'session':_0x4d0a4b['id'],'module_name':_0x9a03('0x38'),'name_value_list':[{'name':_0x9a03('0x3d'),'value':_0xfb3cd4!==_0x9a03('0x3e')?_0xfb3cd4:util[_0x9a03('0x24')](_0x9a03('0x3f'),_0x55636d)},{'name':'phone_home','value':_0x55636d}]})}})[_0x9a03('0x3a')](function(_0x3ac0f8){logger[_0x9a03('0xb')](_0x9a03('0x40'));return BPromise[_0x9a03('0x33')]({'id':_0x3ac0f8['id'],'name':_0x3ac0f8[_0x9a03('0x2d')][_0x9a03('0x3d')]['value'],'phone':_0x3ac0f8[_0x9a03('0x2d')][_0x9a03('0x39')]['value']});});}});}function request(_0xcd13f5){logger['debug'](_0x9a03('0x41'),JSON[_0x9a03('0x22')](_0xcd13f5));return rp(_[_0x9a03('0x42')](def,_0xcd13f5));}function getTags(_0xb17b33,_0x3bf209){var _0x2b5309=[];if(_0xb17b33&&_0xb17b33[_0x9a03('0x1b')]>0x0){_0x2b5309=_[_0x9a03('0x43')](_0xb17b33,_0x3bf209);}return _0x2b5309;}function getCustomFields(_0x274b63,_0x348e25){var _0x5efb2b=[];var _0x150840={'custom_fields':[]};if(_0x274b63[_0x9a03('0x1b')]>0x0){_[_0x9a03('0x1c')](_0x274b63,function(_0x5d9988){if(_0x5d9988[_0x9a03('0x44')]===_0x9a03('0x45')&&_0x5d9988[_0x9a03('0x46')]&&!_0x5d9988[_0x9a03('0x47')]){_0x150840[_0x5d9988['nameField'][_0x9a03('0x48')]()]=_0x5d9988[_0x9a03('0x49')][_0x9a03('0x26')]();}else if(_0x5d9988[_0x9a03('0x44')]===_0x9a03('0x45')&&_0x5d9988['idField']&&_0x5d9988['customField']){_0x150840[_0x9a03('0x4a')]['push']({'id':_0x5d9988[_0x9a03('0x1f')],'value':_0x5d9988[_0x9a03('0x49')]['toString']()});}else if(_0x5d9988[_0x9a03('0x44')]===_0x9a03('0x4b')&&_0x5d9988['variableName']&&_0x5d9988[_0x9a03('0x1f')]&&_0x5d9988[_0x9a03('0x47')]){_0x348e25[_0x5d9988[_0x9a03('0x1d')]]&&_0x150840['custom_fields']['push']({'id':_0x5d9988['idField'],'value':_0x348e25[_0x5d9988[_0x9a03('0x1d')]]['toString']()});}else if(_0x5d9988['type']===_0x9a03('0x4c')&&_0x5d9988['Variable']&&_0x5d9988['Variable'][_0x9a03('0xd')]&&_0x5d9988['idField']&&_0x5d9988[_0x9a03('0x47')]){_0x348e25[_0x5d9988[_0x9a03('0x4d')][_0x9a03('0xd')][_0x9a03('0x48')]()]&&_0x150840[_0x9a03('0x4a')][_0x9a03('0x1e')]({'id':_0x5d9988['idField'],'value':_0x348e25[_0x5d9988[_0x9a03('0x4d')][_0x9a03('0xd')]['toLowerCase']()][_0x9a03('0x26')]()});}});}return _0x150840;}function getConnection(_0x1890c2){return request({'method':_0x9a03('0xa'),'form':{'method':_0x9a03('0x4e'),'input_type':_0x9a03('0x21'),'response_type':_0x9a03('0x21'),'rest_data':JSON[_0x9a03('0x22')]({'user_auth':{'user_name':_0x1890c2['username'],'password':_0x1890c2[_0x9a03('0x4f')],'encryption':_0x9a03('0x50')},'application':_0x9a03('0x51')})}})['then'](function(_0x479e6c){var _0x4f5d54=_0x479e6c;if(_0x4f5d54['id']){def[_0x9a03('0x52')]=_0x4f5d54['id'];return BPromise[_0x9a03('0x33')](_0x4f5d54);}else{throw new Error(util[_0x9a03('0x24')](_0x9a03('0x53'),_0x1890c2['id']));}});}function setRelationship(_0xfb0c52,_0x53eebd,_0x13dcfa,_0x177bd9){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x9a03('0x21'),'rest_data':JSON[_0x9a03('0x22')]({'session':_0xfb0c52['id'],'module_name':_0x9a03('0x23'),'module_id':_0x13dcfa['id'],'link_field_name':_0x177bd9,'related_ids':[_0x53eebd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9a03('0x54')]=function(_0x2ba114,_0x3f9bee,_0x4d1d6c,_0x5c0106,_0x9909b,_0xd4737c){var _0x1f4f67,_0x1ae31e,_0x505345,_0x2e13af;_0xd4737c[_0x9a03('0x55')]=intUtil[_0x9a03('0x56')](_0xd4737c[_0x9a03('0x55')]);_0xd4737c[_0x9a03('0x57')]=intUtil['stripTrailingSlash'](_0xd4737c['serverUrl']);def[_0x9a03('0x58')]=util['format'](_0x9a03('0x59'),_0xd4737c[_0x9a03('0x55')]);if(_0x9909b&&_0x9909b[_0x9a03('0x5a')]){logger[_0x9a03('0xb')]('[QUEUE]',_0x9a03('0x5b'));_0x3f9bee['recordingURL']=util[_0x9a03('0x24')](_0x9a03('0x5c'),_0xd4737c[_0x9a03('0x57')],_0x3f9bee[_0x9a03('0x5d')],md5(_0x3f9bee[_0x9a03('0x5d')]));}else{_0x3f9bee['recordingURL']='';}return getConnection(_0xd4737c)[_0x9a03('0x3a')](function(_0xd7b936){_0x2e13af=_0xd7b936;return getUser(_0xd4737c,_0x5c0106[_0x9a03('0xd')],_0x2e13af);})[_0x9a03('0x3a')](function(_0x2734da){_0x1f4f67=_0x2734da;logger['info'](_0x9a03('0x5e'),_0x1f4f67['id']);return getEndUser(_0xd4737c,_0x3f9bee[_0x9a03('0x5f')],_0x3f9bee[_0x9a03('0x60')],_0x2e13af);})[_0x9a03('0x3a')](function(_0xf90571){_0x1ae31e=_0xf90571;logger[_0x9a03('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1ae31e['id']);return getTicket(_0xd4737c,_0x1f4f67,_0x1ae31e,_0x4d1d6c,_0x3f9bee,_0x4d1d6c[_0x9a03('0x61')],_0x2e13af,_0x9a03('0x62'));})[_0x9a03('0x3a')](function(_0x29020a){_0x505345=_0x29020a;logger['info'](_0x9a03('0x63'));logger['info'](_0x9a03('0x64'),_0x505345['id']);return setRelationship(_0x2e13af,_0x1f4f67,_0x505345,_0x9a03('0x65'));})[_0x9a03('0x3a')](function(){return setRelationship(_0x2e13af,_0x1ae31e,_0x505345,_0x9a03('0x66'));})[_0x9a03('0x3a')](function(){return getServerInfo(_0x2e13af);})[_0x9a03('0x3a')](function(_0x2cc284){var _0x481150=parseInt(_0x2cc284[_0x9a03('0x67')][_0x9a03('0x68')](0x0));var _0x125a99=util[_0x9a03('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xd4737c[_0x9a03('0x55')],_0x505345['id']);if(_0x481150>0x6){_0x125a99=util['format'](_0x9a03('0x69'),_0xd4737c[_0x9a03('0x55')],_0x505345['id']);}logger[_0x9a03('0xb')](_0x9a03('0x6a'),_0x9a03('0x6b'));emit(util[_0x9a03('0x24')]('user:%s',_0x5c0106[_0x9a03('0xd')]),_0x9a03('0x6c'),{'uri':_0x125a99});})['catch'](function(_0x4769d1){logger[_0x9a03('0x6d')](_0x9a03('0x6a'),JSON[_0x9a03('0x22')](_0x4769d1));});};exports[_0x9a03('0x6e')]=function(_0x34e9e3,_0x1d1d7e,_0x248cb0,_0x12d7ab,_0x2e4d97,_0x35da09,_0x494ed2){var _0x2f5d0c,_0x2ef559,_0x4efa22,_0x36630d;_0x35da09[_0x9a03('0x55')]=intUtil[_0x9a03('0x56')](_0x35da09[_0x9a03('0x55')]);_0x35da09[_0x9a03('0x57')]=intUtil['stripTrailingSlash'](_0x35da09['serverUrl']);def[_0x9a03('0x58')]=util[_0x9a03('0x24')](_0x9a03('0x59'),_0x35da09[_0x9a03('0x55')]);if(_0x494ed2&&_0x494ed2[_0x9a03('0x6f')]&&_0x494ed2[_0x9a03('0x6f')]!==_0x9a03('0x70')){logger[_0x9a03('0xb')](_0x9a03('0x71'),_0x9a03('0x5b'));_0x1d1d7e['recordingURL']=util[_0x9a03('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35da09[_0x9a03('0x57')],_0x1d1d7e[_0x9a03('0x5d')],md5(_0x1d1d7e[_0x9a03('0x5d')]));}return getConnection(_0x35da09)[_0x9a03('0x3a')](function(_0x3aa07d){_0x36630d=_0x3aa07d;return getUser(_0x35da09,_0x12d7ab[_0x9a03('0xd')],_0x36630d);})[_0x9a03('0x3a')](function(_0x547f51){_0x2f5d0c=_0x547f51;logger[_0x9a03('0xb')](_0x9a03('0x5e'),_0x2f5d0c['id']);return getEndUser(_0x35da09,_0x1d1d7e[_0x9a03('0x72')],_0x1d1d7e[_0x9a03('0x73')],_0x36630d);})[_0x9a03('0x3a')](function(_0xa270be){_0x2ef559=_0xa270be;logger[_0x9a03('0xb')](_0x9a03('0x74'),_0x2ef559['id']);return getTicket(_0x35da09,_0x2f5d0c,_0x2ef559,_0x248cb0,_0x1d1d7e,_0x248cb0['Fields'],_0x36630d,'Outbound');})[_0x9a03('0x3a')](function(_0x14dacc){_0x4efa22=_0x14dacc;logger[_0x9a03('0xb')](_0x9a03('0x63'));logger[_0x9a03('0xb')](_0x9a03('0x64'),_0x4efa22['id']);return setRelationship(_0x36630d,_0x2f5d0c,_0x4efa22,'users');})[_0x9a03('0x3a')](function(){return setRelationship(_0x36630d,_0x2ef559,_0x4efa22,_0x9a03('0x66'));})[_0x9a03('0x3a')](function(){return getServerInfo(_0x36630d);})['then'](function(_0x55616b){var _0x39d56f=parseInt(_0x55616b[_0x9a03('0x67')]['charAt'](0x0));var _0x487d2b=util[_0x9a03('0x24')](_0x9a03('0x75'),_0x35da09[_0x9a03('0x55')],_0x4efa22['id']);if(_0x39d56f>0x6){_0x487d2b=util[_0x9a03('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x35da09['remoteUri'],_0x4efa22['id']);}logger[_0x9a03('0xb')](_0x9a03('0x71'),_0x9a03('0x6b'));emit(util[_0x9a03('0x24')](_0x9a03('0x76'),_0x12d7ab[_0x9a03('0xd')]),_0x9a03('0x6c'),{'uri':_0x487d2b});})[_0x9a03('0x77')](function(_0x101593){logger[_0x9a03('0x6d')]('[OUTBOUND]',JSON[_0x9a03('0x22')](_0x101593));});};exports[_0x9a03('0x78')]=function(_0x24976d,_0x1fbc9d,_0x395db4,_0x37d68b,_0x3b8b96,_0x469191){var _0x2ff04c,_0x50c1c6,_0xcc47bd,_0x50e7ee;_0x469191[_0x9a03('0x55')]=intUtil[_0x9a03('0x56')](_0x469191[_0x9a03('0x55')]);_0x469191['serverUrl']=intUtil[_0x9a03('0x56')](_0x469191[_0x9a03('0x57')]);def[_0x9a03('0x58')]=util['format'](_0x9a03('0x59'),_0x469191['remoteUri']);if(_0x3b8b96&&_0x3b8b96[_0x9a03('0x5a')]){logger[_0x9a03('0xb')]('['+_0x1fbc9d[_0x9a03('0x79')]['toUpperCase']()+']',_0x9a03('0x5b'));_0x1fbc9d[_0x9a03('0x7a')]=util[_0x9a03('0x24')](_0x9a03('0x5c'),_0x469191[_0x9a03('0x57')],_0x1fbc9d[_0x9a03('0x5d')],md5(_0x1fbc9d[_0x9a03('0x5d')]));}else{_0x1fbc9d[_0x9a03('0x7a')]='';}return getConnection(_0x469191)[_0x9a03('0x3a')](function(_0xbabdab){_0x50e7ee=_0xbabdab;if(!_['isNil'](_0x37d68b)){return getUser(_0x469191,_0x37d68b[_0x9a03('0xd')],_0x50e7ee);}else{return getUser(_0x469191,null,_0x50e7ee);}})['then'](function(_0x4df3b8){_0x2ff04c=_0x4df3b8;logger[_0x9a03('0xb')](_0x9a03('0x5e'),_0x2ff04c['id']);return getEndUser(_0x469191,_0x1fbc9d[_0x9a03('0x5f')],_0x1fbc9d[_0x9a03('0x60')],_0x50e7ee);})['then'](function(_0x4f1e60){_0x50c1c6=_0x4f1e60;logger['info'](_0x9a03('0x74'),_0x50c1c6['id']);return getTicket(_0x469191,_0x2ff04c,_0x50c1c6,_0x395db4,_0x1fbc9d,_0x395db4['Fields'],_0x50e7ee,_0x9a03('0x62'));})[_0x9a03('0x3a')](function(_0x259cd6){_0xcc47bd=_0x259cd6;logger['info']('Ticket\x20created!');logger[_0x9a03('0xb')](_0x9a03('0x64'),_0xcc47bd['id']);return setRelationship(_0x50e7ee,_0x2ff04c,_0xcc47bd,_0x9a03('0x65'));})[_0x9a03('0x3a')](function(){return setRelationship(_0x50e7ee,_0x50c1c6,_0xcc47bd,_0x9a03('0x66'));})[_0x9a03('0x3a')](function(){return getServerInfo(_0x50e7ee);})[_0x9a03('0x77')](function(_0x41efa8){logger[_0x9a03('0x6d')]('['+_0x1fbc9d[_0x9a03('0x79')][_0x9a03('0x7b')]()+']',JSON['stringify'](_0x41efa8));});}; \ No newline at end of file +var _0x8e05=['length','forEach','variableName','idField','set_entry','JSON','stringify','format','apiKey','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','toString','custom_fields','push','content','customField','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','contacts','charAt','unmanaged','lastevent','calleridnum','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x8e05,0x1b3));var _0x58e0=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x8e05[_0x5f0501];return _0x3c2c45;};'use strict';var _=require(_0x58e0('0x0'));var rp=require(_0x58e0('0x1'));var BPromise=require(_0x58e0('0x2'));var md5=require(_0x58e0('0x3'));var util=require('util');var Redis=require(_0x58e0('0x4'));var intUtil=require('./util');var config=require(_0x58e0('0x5'));var logger=require(_0x58e0('0x6'))(_0x58e0('0x7'));config[_0x58e0('0x8')]=_['defaults'](config[_0x58e0('0x8')],{'host':_0x58e0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58e0('0x8')]));var def={'method':_0x58e0('0xa'),'json':!![]};function emit(_0x593e0a,_0x4e5d70,_0x3c03b6){io['to'](_0x593e0a)['emit'](_0x4e5d70,_0x3c03b6);}function getTicket(_0x5cdfdc,_0x43cfc6,_0x212fd4,_0x517c0c,_0x2d0b08,_0x1381ba,_0x293006,_0x3e7938){logger[_0x58e0('0xb')](_0x58e0('0xc'));var _0x5d21ca=new Date();var _0x2a7fcd=[{'name':_0x58e0('0xd'),'value':intUtil['getString'](_0x517c0c[_0x58e0('0xe')],_0x2d0b08,'\x20')},{'name':_0x58e0('0xf'),'value':_0x43cfc6['id']},{'name':_0x58e0('0x10'),'value':_0x43cfc6['id']},{'name':'description','value':intUtil[_0x58e0('0x11')](_0x517c0c[_0x58e0('0x12')],_0x2d0b08,'\x0a')},{'name':_0x58e0('0x13'),'value':_0x5d21ca['toISOString']()[_0x58e0('0x14')](0x0,0x13)[_0x58e0('0x15')]('T','\x20')},{'name':_0x58e0('0x16'),'value':'0'},{'name':_0x58e0('0x17'),'value':'15'},{'name':_0x58e0('0x18'),'value':_0x212fd4['id']},{'name':_0x58e0('0x19'),'value':_0x58e0('0x1a')},{'name':_0x58e0('0x1b'),'value':_0x212fd4[_0x58e0('0xd')]},{'name':_0x58e0('0x1c'),'value':_0x3e7938}];if(_0x1381ba[_0x58e0('0x1d')]){_[_0x58e0('0x1e')](_0x1381ba,function(_0x27b0b1){if(_0x2d0b08[_0x27b0b1[_0x58e0('0x1f')]]){_0x2a7fcd['push']({'name':_0x27b0b1[_0x58e0('0x20')],'value':_0x2d0b08[_0x27b0b1['variableName']]});}});}return request({'form':{'method':_0x58e0('0x21'),'input_type':_0x58e0('0x22'),'response_type':'JSON','rest_data':JSON[_0x58e0('0x23')]({'session':_0x293006['id'],'module_name':'Calls','name_value_list':_0x2a7fcd})}});}function getAuth(_0x1f44d7){return util[_0x58e0('0x24')]('Basic\x20%s',new Buffer(_0x1f44d7[_0x58e0('0x25')]+':X')['toString'](_0x58e0('0x26')));}function getServerInfo(_0x556f37){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x58e0('0x22'),'rest_data':JSON[_0x58e0('0x23')]({'session':_0x556f37['id']})}});}function getUser(_0x196c86,_0x271ef2,_0x1ace9c){if(!_[_0x58e0('0x27')](_0x271ef2)){logger['info'](_0x58e0('0x28'),_0x271ef2);return request({'form':{'method':_0x58e0('0x29'),'input_type':_0x58e0('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x1ace9c['id'],'module_name':_0x58e0('0x2a'),'query':util[_0x58e0('0x24')](_0x58e0('0x2b'),_0x271ef2),'order_by':'','offset':'0','select_fields':['id',_0x58e0('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x58e0('0x2c')](function(_0x5a10f2){if(_0x5a10f2[_0x58e0('0x2d')]['length']){var _0x14ea37=_['find'](_0x5a10f2[_0x58e0('0x2d')],function(_0x1a6f72){return _0x1a6f72[_0x58e0('0x2e')]['user_name'][_0x58e0('0x2f')]===_0x271ef2;});if(_0x14ea37){logger[_0x58e0('0xb')](_0x58e0('0x30'));return BPromise[_0x58e0('0x31')]({'id':_0x14ea37[_0x58e0('0x2e')]['id'][_0x58e0('0x2f')],'name':_0x14ea37['name_value_list'][_0x58e0('0xd')][_0x58e0('0x2f')]});}}logger[_0x58e0('0xb')](_0x58e0('0x32'));return BPromise['resolve']({'id':_0x1ace9c[_0x58e0('0x2e')][_0x58e0('0x33')][_0x58e0('0x2f')],'name':_0x1ace9c[_0x58e0('0x2e')]['user_name'][_0x58e0('0x2f')]});});}else{logger[_0x58e0('0xb')](_0x58e0('0x34'));return BPromise[_0x58e0('0x31')]({'id':_0x1ace9c[_0x58e0('0x2e')][_0x58e0('0x33')][_0x58e0('0x2f')],'name':_0x1ace9c[_0x58e0('0x2e')]['user_name']['value']});}}function getEndUser(_0x29ff59,_0x5559d4,_0x4ff1d0,_0x516d7f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4ff1d0);return request({'form':{'method':_0x58e0('0x29'),'input_type':_0x58e0('0x22'),'response_type':_0x58e0('0x22'),'rest_data':JSON['stringify']({'session':_0x516d7f['id'],'module_name':_0x58e0('0x1a'),'query':util[_0x58e0('0x24')](_0x58e0('0x35'),_0x4ff1d0),'order_by':'','offset':'0','select_fields':['id',_0x58e0('0xd'),_0x58e0('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x58e0('0x2c')](function(_0x14e525){if(_0x14e525['entry_list'][_0x58e0('0x1d')]){var _0x33b770=_['find'](_0x14e525['entry_list'],function(_0x414130){return _0x414130[_0x58e0('0x2e')][_0x58e0('0x36')]['value']===_0x4ff1d0;});if(_0x33b770){logger[_0x58e0('0xb')]('Enduser\x20found!');return BPromise[_0x58e0('0x31')]({'id':_0x33b770[_0x58e0('0x2e')]['id'][_0x58e0('0x2f')],'name':_0x33b770['name_value_list'][_0x58e0('0xd')][_0x58e0('0x2f')],'phone':_0x33b770[_0x58e0('0x2e')][_0x58e0('0x36')][_0x58e0('0x2f')]});}}else{logger[_0x58e0('0xb')](_0x58e0('0x37'));return request({'form':{'method':'set_entry','input_type':_0x58e0('0x22'),'response_type':_0x58e0('0x22'),'rest_data':JSON[_0x58e0('0x23')]({'session':_0x516d7f['id'],'module_name':'Contacts','name_value_list':[{'name':_0x58e0('0x38'),'value':_0x5559d4!==_0x58e0('0x39')?_0x5559d4:util[_0x58e0('0x24')]('Caller\x20-\x20%s',_0x4ff1d0)},{'name':'phone_home','value':_0x4ff1d0}]})}})[_0x58e0('0x2c')](function(_0x350409){logger[_0x58e0('0xb')](_0x58e0('0x3a'));return BPromise[_0x58e0('0x31')]({'id':_0x350409['id'],'name':_0x350409[_0x58e0('0x2d')]['first_name'][_0x58e0('0x2f')],'phone':_0x350409[_0x58e0('0x2d')][_0x58e0('0x36')]['value']});});}});}function request(_0x1a5b75){logger[_0x58e0('0x3b')](_0x58e0('0x3c'),JSON[_0x58e0('0x23')](_0x1a5b75));return rp(_[_0x58e0('0x3d')](def,_0x1a5b75));}function getTags(_0x216658,_0x49088b){var _0x1c5801=[];if(_0x216658&&_0x216658[_0x58e0('0x1d')]>0x0){_0x1c5801=_[_0x58e0('0x3e')](_0x216658,_0x49088b);}return _0x1c5801;}function getCustomFields(_0x40900d,_0x3392ff){var _0x5660a3=[];var _0x215345={'custom_fields':[]};if(_0x40900d[_0x58e0('0x1d')]>0x0){_[_0x58e0('0x1e')](_0x40900d,function(_0x19fa7f){if(_0x19fa7f[_0x58e0('0x3f')]===_0x58e0('0x40')&&_0x19fa7f[_0x58e0('0x41')]&&!_0x19fa7f['customField']){_0x215345[_0x19fa7f[_0x58e0('0x41')]['toLowerCase']()]=_0x19fa7f['content'][_0x58e0('0x42')]();}else if(_0x19fa7f[_0x58e0('0x3f')]===_0x58e0('0x40')&&_0x19fa7f[_0x58e0('0x20')]&&_0x19fa7f['customField']){_0x215345[_0x58e0('0x43')][_0x58e0('0x44')]({'id':_0x19fa7f['idField'],'value':_0x19fa7f[_0x58e0('0x45')]['toString']()});}else if(_0x19fa7f[_0x58e0('0x3f')]==='variable'&&_0x19fa7f[_0x58e0('0x1f')]&&_0x19fa7f[_0x58e0('0x20')]&&_0x19fa7f[_0x58e0('0x46')]){_0x3392ff[_0x19fa7f[_0x58e0('0x1f')]]&&_0x215345['custom_fields'][_0x58e0('0x44')]({'id':_0x19fa7f['idField'],'value':_0x3392ff[_0x19fa7f[_0x58e0('0x1f')]]['toString']()});}else if(_0x19fa7f[_0x58e0('0x3f')]==='customVariable'&&_0x19fa7f[_0x58e0('0x47')]&&_0x19fa7f[_0x58e0('0x47')][_0x58e0('0xd')]&&_0x19fa7f[_0x58e0('0x20')]&&_0x19fa7f[_0x58e0('0x46')]){_0x3392ff[_0x19fa7f[_0x58e0('0x47')]['name'][_0x58e0('0x48')]()]&&_0x215345[_0x58e0('0x43')][_0x58e0('0x44')]({'id':_0x19fa7f['idField'],'value':_0x3392ff[_0x19fa7f[_0x58e0('0x47')]['name'][_0x58e0('0x48')]()]['toString']()});}});}return _0x215345;}function getConnection(_0x2e94d5){return request({'method':_0x58e0('0xa'),'form':{'method':_0x58e0('0x49'),'input_type':_0x58e0('0x22'),'response_type':_0x58e0('0x22'),'rest_data':JSON[_0x58e0('0x23')]({'user_auth':{'user_name':_0x2e94d5[_0x58e0('0x4a')],'password':_0x2e94d5[_0x58e0('0x4b')],'encryption':_0x58e0('0x4c')},'application':_0x58e0('0x4d')})}})[_0x58e0('0x2c')](function(_0x39bf04){var _0x1a416b=_0x39bf04;if(_0x1a416b['id']){def['sessionID']=_0x1a416b['id'];return BPromise[_0x58e0('0x31')](_0x1a416b);}else{throw new Error(util[_0x58e0('0x24')](_0x58e0('0x4e'),_0x2e94d5['id']));}});}function setRelationship(_0x253640,_0x1284d6,_0x2c5854,_0x5e2932){return request({'form':{'method':_0x58e0('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x58e0('0x23')]({'session':_0x253640['id'],'module_name':_0x58e0('0x50'),'module_id':_0x2c5854['id'],'link_field_name':_0x5e2932,'related_ids':[_0x1284d6['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x43f8fd,_0x4be48f,_0x2709ac,_0x3d008c,_0x1a3f4b,_0x53a229){var _0x158655,_0x3249d5,_0x5c1ccf,_0x26af82;_0x53a229[_0x58e0('0x51')]=intUtil[_0x58e0('0x52')](_0x53a229[_0x58e0('0x51')]);_0x53a229[_0x58e0('0x53')]=intUtil[_0x58e0('0x52')](_0x53a229[_0x58e0('0x53')]);def['uri']=util[_0x58e0('0x24')](_0x58e0('0x54'),_0x53a229[_0x58e0('0x51')]);if(_0x1a3f4b&&_0x1a3f4b[_0x58e0('0x55')]){logger[_0x58e0('0xb')](_0x58e0('0x56'),_0x58e0('0x57'));_0x4be48f[_0x58e0('0x58')]=util[_0x58e0('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x53a229[_0x58e0('0x53')],_0x4be48f['uniqueid'],md5(_0x4be48f[_0x58e0('0x59')]));}else{_0x4be48f[_0x58e0('0x58')]='';}return getConnection(_0x53a229)[_0x58e0('0x2c')](function(_0x3ffc31){_0x26af82=_0x3ffc31;return getUser(_0x53a229,_0x3d008c[_0x58e0('0xd')],_0x26af82);})[_0x58e0('0x2c')](function(_0x4c466a){_0x158655=_0x4c466a;logger['info'](_0x58e0('0x5a'),_0x158655['id']);return getEndUser(_0x53a229,_0x4be48f[_0x58e0('0x5b')],_0x4be48f['calleridnum'],_0x26af82);})['then'](function(_0x2a5438){_0x3249d5=_0x2a5438;logger[_0x58e0('0xb')](_0x58e0('0x5c'),_0x3249d5['id']);return getTicket(_0x53a229,_0x158655,_0x3249d5,_0x2709ac,_0x4be48f,_0x2709ac[_0x58e0('0x5d')],_0x26af82,_0x58e0('0x5e'));})[_0x58e0('0x2c')](function(_0x677277){_0x5c1ccf=_0x677277;logger[_0x58e0('0xb')](_0x58e0('0x5f'));logger[_0x58e0('0xb')](_0x58e0('0x60'),_0x5c1ccf['id']);return setRelationship(_0x26af82,_0x158655,_0x5c1ccf,_0x58e0('0x61'));})[_0x58e0('0x2c')](function(){return setRelationship(_0x26af82,_0x3249d5,_0x5c1ccf,'contacts');})['then'](function(){return getServerInfo(_0x26af82);})['then'](function(_0x16cdd0){var _0x51e6f8=parseInt(_0x16cdd0[_0x58e0('0x62')]['charAt'](0x0));var _0x65f024=util[_0x58e0('0x24')](_0x58e0('0x63'),_0x53a229['remoteUri'],_0x5c1ccf['id']);if(_0x51e6f8>0x6){_0x65f024=util[_0x58e0('0x24')](_0x58e0('0x64'),_0x53a229[_0x58e0('0x51')],_0x5c1ccf['id']);}logger[_0x58e0('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3d008c[_0x58e0('0xd')]),_0x58e0('0x65'),{'uri':_0x65f024});})[_0x58e0('0x66')](function(_0x1f3fa8){logger[_0x58e0('0x67')](_0x58e0('0x56'),JSON['stringify'](_0x1f3fa8));});};exports['outbound']=function(_0x40a2ee,_0x2ccbd3,_0x15d652,_0x10fe57,_0x48e5df,_0x17e062,_0x543ca2){var _0x52dc42,_0x1db3e2,_0x5cd3a5,_0x30ff8c;_0x17e062[_0x58e0('0x51')]=intUtil['stripTrailingSlash'](_0x17e062[_0x58e0('0x51')]);_0x17e062['serverUrl']=intUtil[_0x58e0('0x52')](_0x17e062[_0x58e0('0x53')]);def[_0x58e0('0x68')]=util[_0x58e0('0x24')](_0x58e0('0x54'),_0x17e062['remoteUri']);if(_0x543ca2&&_0x543ca2[_0x58e0('0x69')]&&_0x543ca2[_0x58e0('0x69')]!==_0x58e0('0x6a')){logger[_0x58e0('0xb')](_0x58e0('0x6b'),_0x58e0('0x57'));_0x2ccbd3[_0x58e0('0x58')]=util[_0x58e0('0x24')](_0x58e0('0x6c'),_0x17e062['serverUrl'],_0x2ccbd3[_0x58e0('0x59')],md5(_0x2ccbd3[_0x58e0('0x59')]));}return getConnection(_0x17e062)[_0x58e0('0x2c')](function(_0x37f6c8){_0x30ff8c=_0x37f6c8;return getUser(_0x17e062,_0x10fe57['name'],_0x30ff8c);})[_0x58e0('0x2c')](function(_0x711b39){_0x52dc42=_0x711b39;logger[_0x58e0('0xb')](_0x58e0('0x5a'),_0x52dc42['id']);return getEndUser(_0x17e062,_0x2ccbd3['destcalleridname'],_0x2ccbd3[_0x58e0('0x6d')],_0x30ff8c);})[_0x58e0('0x2c')](function(_0x3d2859){_0x1db3e2=_0x3d2859;logger[_0x58e0('0xb')](_0x58e0('0x5c'),_0x1db3e2['id']);return getTicket(_0x17e062,_0x52dc42,_0x1db3e2,_0x15d652,_0x2ccbd3,_0x15d652[_0x58e0('0x5d')],_0x30ff8c,'Outbound');})[_0x58e0('0x2c')](function(_0x249b89){_0x5cd3a5=_0x249b89;logger['info'](_0x58e0('0x5f'));logger[_0x58e0('0xb')](_0x58e0('0x60'),_0x5cd3a5['id']);return setRelationship(_0x30ff8c,_0x52dc42,_0x5cd3a5,_0x58e0('0x61'));})[_0x58e0('0x2c')](function(){return setRelationship(_0x30ff8c,_0x1db3e2,_0x5cd3a5,_0x58e0('0x6e'));})[_0x58e0('0x2c')](function(){return getServerInfo(_0x30ff8c);})[_0x58e0('0x2c')](function(_0x26b594){var _0x1fe1bb=parseInt(_0x26b594[_0x58e0('0x62')][_0x58e0('0x6f')](0x0));var _0x1e96b4=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x17e062[_0x58e0('0x51')],_0x5cd3a5['id']);if(_0x1fe1bb>0x6){_0x1e96b4=util[_0x58e0('0x24')](_0x58e0('0x64'),_0x17e062[_0x58e0('0x51')],_0x5cd3a5['id']);}logger[_0x58e0('0xb')](_0x58e0('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x10fe57[_0x58e0('0xd')]),_0x58e0('0x65'),{'uri':_0x1e96b4});})[_0x58e0('0x66')](function(_0x2ffa34){logger['error'](_0x58e0('0x6b'),JSON[_0x58e0('0x23')](_0x2ffa34));});};exports[_0x58e0('0x70')]=function(_0x223de1,_0x509dd2,_0xbb67e9,_0x2755a0,_0x145b77,_0x345e23){var _0x44d8b0,_0x5e11a5,_0x560fff,_0x332213;_0x345e23[_0x58e0('0x51')]=intUtil[_0x58e0('0x52')](_0x345e23['remoteUri']);_0x345e23[_0x58e0('0x53')]=intUtil[_0x58e0('0x52')](_0x345e23[_0x58e0('0x53')]);def[_0x58e0('0x68')]=util[_0x58e0('0x24')](_0x58e0('0x54'),_0x345e23[_0x58e0('0x51')]);if(_0x145b77&&_0x145b77['monitor_format']){logger[_0x58e0('0xb')]('['+_0x509dd2[_0x58e0('0x71')]['toUpperCase']()+']',_0x58e0('0x57'));_0x509dd2[_0x58e0('0x58')]=util[_0x58e0('0x24')](_0x58e0('0x6c'),_0x345e23['serverUrl'],_0x509dd2[_0x58e0('0x59')],md5(_0x509dd2[_0x58e0('0x59')]));}else{_0x509dd2['recordingURL']='';}return getConnection(_0x345e23)['then'](function(_0x155014){_0x332213=_0x155014;if(!_[_0x58e0('0x27')](_0x2755a0)){return getUser(_0x345e23,_0x2755a0['name'],_0x332213);}else{return getUser(_0x345e23,null,_0x332213);}})[_0x58e0('0x2c')](function(_0x1a9ccc){_0x44d8b0=_0x1a9ccc;logger[_0x58e0('0xb')]('The\x20User\x20ID\x20is:',_0x44d8b0['id']);return getEndUser(_0x345e23,_0x509dd2['calleridname'],_0x509dd2[_0x58e0('0x72')],_0x332213);})['then'](function(_0x5a127d){_0x5e11a5=_0x5a127d;logger[_0x58e0('0xb')](_0x58e0('0x5c'),_0x5e11a5['id']);return getTicket(_0x345e23,_0x44d8b0,_0x5e11a5,_0xbb67e9,_0x509dd2,_0xbb67e9[_0x58e0('0x5d')],_0x332213,_0x58e0('0x5e'));})[_0x58e0('0x2c')](function(_0x21e1b7){_0x560fff=_0x21e1b7;logger['info'](_0x58e0('0x5f'));logger['info'](_0x58e0('0x60'),_0x560fff['id']);return setRelationship(_0x332213,_0x44d8b0,_0x560fff,_0x58e0('0x61'));})[_0x58e0('0x2c')](function(){return setRelationship(_0x332213,_0x5e11a5,_0x560fff,'contacts');})[_0x58e0('0x2c')](function(){return getServerInfo(_0x332213);})['catch'](function(_0x91aab2){logger[_0x58e0('0x67')]('['+_0x509dd2[_0x58e0('0x71')][_0x58e0('0x73')]()+']',JSON['stringify'](_0x91aab2));});}; \ 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 922d0af..05c2b57 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 _0x9e1d=['key','keyContent','variable','format','join','stripTrailingSlash','slice','lastIndexOf','isNil','lodash','util','getString','length','type','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','string','%s:\x20%s'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x9e1d,0xe1));var _0xd9e1=function(_0x598aaf,_0xb2b2c1){_0x598aaf=_0x598aaf-0x0;var _0x592139=_0x9e1d[_0x598aaf];return _0x592139;};'use strict';var _=require(_0xd9e1('0x0'));var util=require(_0xd9e1('0x1'));exports[_0xd9e1('0x2')]=function(_0x2978b7,_0x54117e,_0x473092){var _0x434ee2=[];if(_0x2978b7[_0xd9e1('0x3')]>0x0){var _0xdd51f9=_['sortBy'](_0x2978b7,['id']);for(var _0x1cd5ad=0x0;_0x1cd5ad<_0xdd51f9[_0xd9e1('0x3')];_0x1cd5ad++){var _0x16039e=_0xdd51f9[_0x1cd5ad];if(_0x16039e['type']==='string'){_0x434ee2['push'](_0x16039e['content']);}else if(_0x16039e[_0xd9e1('0x4')]==='variable'&&_0x16039e[_0xd9e1('0x5')]){_0x54117e[_0x16039e[_0xd9e1('0x5')]]&&_0x434ee2[_0xd9e1('0x6')](_0x54117e[_0x16039e[_0xd9e1('0x5')]][_0xd9e1('0x7')]());}else if(_0x16039e[_0xd9e1('0x4')]===_0xd9e1('0x8')&&_0x16039e[_0xd9e1('0x9')]&&_0x16039e[_0xd9e1('0x9')][_0xd9e1('0xa')]){_0x54117e[_0x16039e[_0xd9e1('0x9')]['name'][_0xd9e1('0xb')]()]&&_0x434ee2['push'](_0x54117e[_0x16039e[_0xd9e1('0x9')][_0xd9e1('0xa')][_0xd9e1('0xb')]()][_0xd9e1('0x7')]());}else if(_0x16039e[_0xd9e1('0x4')]==='keyValue'){if(_0x16039e[_0xd9e1('0xc')]===_0xd9e1('0xd')&&_0x16039e['key']){_0x434ee2[_0xd9e1('0x6')](util['format'](_0xd9e1('0xe'),_0x16039e[_0xd9e1('0xf')],_0x16039e[_0xd9e1('0x10')]));}else if(_0x16039e[_0xd9e1('0xc')]===_0xd9e1('0x11')&&_0x16039e[_0xd9e1('0x5')]&&_0x16039e[_0xd9e1('0xf')]){_0x54117e[_0x16039e['variableName']]&&_0x434ee2[_0xd9e1('0x6')](util['format'](_0xd9e1('0xe'),_0x16039e['key'],_0x54117e[_0x16039e[_0xd9e1('0x5')]]));}else if(_0x16039e[_0xd9e1('0xc')]===_0xd9e1('0x8')&&_0x16039e['Variable']&&_0x16039e['Variable']['name']&&_0x16039e['key']){_0x54117e[_0x16039e['Variable'][_0xd9e1('0xa')][_0xd9e1('0xb')]()]&&_0x434ee2[_0xd9e1('0x6')](util[_0xd9e1('0x12')](_0xd9e1('0xe'),_0x16039e['key'],_0x54117e[_0x16039e[_0xd9e1('0x9')][_0xd9e1('0xa')]['toLowerCase']()]));}}}}return _0x434ee2[_0xd9e1('0x13')](_0x473092);};exports[_0xd9e1('0x14')]=function(_0x4b3989){var _0xd44b02=_0x4b3989[_0xd9e1('0x15')](-0x1);if(_0xd44b02==='/'){_0x4b3989=_0x4b3989['substring'](0x0,_0x4b3989[_0xd9e1('0x16')](_0xd44b02));}return _0x4b3989;};exports['validateEmail']=function(_0x323a38){if(!_[_0xd9e1('0x17')](_0x323a38)&&_0x323a38!==''){var _0x1612bd=/^(([^<>()\[\]\\.,;:\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 _0x1612bd['test'](String(_0x323a38)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4d8d=['key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','sortBy','type','string','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x4d8d,0x129));var _0xd4d8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d8d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd4d8('0x0'));var util=require(_0xd4d8('0x1'));exports['getString']=function(_0x4d2c3d,_0x48ca47,_0x24e91a){var _0x8d3a25=[];if(_0x4d2c3d['length']>0x0){var _0x623013=_[_0xd4d8('0x2')](_0x4d2c3d,['id']);for(var _0x1da74e=0x0;_0x1da74e<_0x623013['length'];_0x1da74e++){var _0x159a60=_0x623013[_0x1da74e];if(_0x159a60[_0xd4d8('0x3')]===_0xd4d8('0x4')){_0x8d3a25['push'](_0x159a60[_0xd4d8('0x5')]);}else if(_0x159a60[_0xd4d8('0x3')]===_0xd4d8('0x6')&&_0x159a60[_0xd4d8('0x7')]){_0x48ca47[_0x159a60[_0xd4d8('0x7')]]&&_0x8d3a25[_0xd4d8('0x8')](_0x48ca47[_0x159a60[_0xd4d8('0x7')]][_0xd4d8('0x9')]());}else if(_0x159a60['type']==='customVariable'&&_0x159a60[_0xd4d8('0xa')]&&_0x159a60[_0xd4d8('0xa')][_0xd4d8('0xb')]){_0x48ca47[_0x159a60[_0xd4d8('0xa')]['name']['toLowerCase']()]&&_0x8d3a25['push'](_0x48ca47[_0x159a60[_0xd4d8('0xa')][_0xd4d8('0xb')][_0xd4d8('0xc')]()][_0xd4d8('0x9')]());}else if(_0x159a60['type']===_0xd4d8('0xd')){if(_0x159a60[_0xd4d8('0xe')]===_0xd4d8('0x4')&&_0x159a60[_0xd4d8('0xf')]){_0x8d3a25['push'](util['format'](_0xd4d8('0x10'),_0x159a60[_0xd4d8('0xf')],_0x159a60[_0xd4d8('0x11')]));}else if(_0x159a60[_0xd4d8('0xe')]==='variable'&&_0x159a60[_0xd4d8('0x7')]&&_0x159a60[_0xd4d8('0xf')]){_0x48ca47[_0x159a60[_0xd4d8('0x7')]]&&_0x8d3a25[_0xd4d8('0x8')](util[_0xd4d8('0x12')]('%s:\x20%s',_0x159a60[_0xd4d8('0xf')],_0x48ca47[_0x159a60[_0xd4d8('0x7')]]));}else if(_0x159a60['keyType']==='customVariable'&&_0x159a60[_0xd4d8('0xa')]&&_0x159a60[_0xd4d8('0xa')]['name']&&_0x159a60[_0xd4d8('0xf')]){_0x48ca47[_0x159a60[_0xd4d8('0xa')]['name']['toLowerCase']()]&&_0x8d3a25[_0xd4d8('0x8')](util[_0xd4d8('0x12')]('%s:\x20%s',_0x159a60[_0xd4d8('0xf')],_0x48ca47[_0x159a60[_0xd4d8('0xa')]['name'][_0xd4d8('0xc')]()]));}}}}return _0x8d3a25[_0xd4d8('0x13')](_0x24e91a);};exports[_0xd4d8('0x14')]=function(_0x33e1f4){var _0x3bd1f3=_0x33e1f4[_0xd4d8('0x15')](-0x1);if(_0x3bd1f3==='/'){_0x33e1f4=_0x33e1f4[_0xd4d8('0x16')](0x0,_0x33e1f4[_0xd4d8('0x17')](_0x3bd1f3));}return _0x33e1f4;};exports[_0xd4d8('0x18')]=function(_0x2ab157){if(!_[_0xd4d8('0x19')](_0x2ab157)&&_0x2ab157!==''){var _0x779373=/^(([^<>()\[\]\\.,;:\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 _0x779373['test'](String(_0x2ab157)[_0xd4d8('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 adfaf4b..840cb7f 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(_0x3ac0eb,_0x2360eb){var _0x565ab5=function(_0x594c61){while(--_0x594c61){_0x3ac0eb['push'](_0x3ac0eb['shift']());}};_0x565ab5(++_0x2360eb);}(_0xe706,0xa3));var _0x6e70=function(_0x466d24,_0x3a3d6c){_0x466d24=_0x466d24-0x0;var _0x535da6=_0xe706[_0x466d24];return _0x535da6;};'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(_0x1f3e80,_0x19e38f){var _0x4455a2=function(_0x1896c0){while(--_0x1896c0){_0x1f3e80['push'](_0x1f3e80['shift']());}};_0x4455a2(++_0x19e38f);}(_0xe706,0xa3));var _0x6e70=function(_0xd8efb0,_0x2fb48b){_0xd8efb0=_0xd8efb0-0x0;var _0x3d962c=_0xe706[_0xd8efb0];return _0x3d962c;};'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 9090cec..ac46b54 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 _0xa0e5=['push','variable','variableName','custom_fields','customVariable','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','filter','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','GET','map','forEach','string','picklist','toLowerCase','content','includes','type','idField','customField'];(function(_0x4e6c08,_0x3febdb){var _0x5eaa93=function(_0x383678){while(--_0x383678){_0x4e6c08['push'](_0x4e6c08['shift']());}};_0x5eaa93(++_0x3febdb);}(_0xa0e5,0x182));var _0x5a0e=function(_0x7f8efd,_0x3baa7d){_0x7f8efd=_0x7f8efd-0x0;var _0x40c0b0=_0xa0e5[_0x7f8efd];return _0x40c0b0;};'use strict';var _=require('lodash');var rp=require(_0x5a0e('0x0'));var md5=require(_0x5a0e('0x1'));var util=require(_0x5a0e('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5a0e('0x3'));var config=require(_0x5a0e('0x4'));var logger=require(_0x5a0e('0x5'))('zendesk');config[_0x5a0e('0x6')]=_[_0x5a0e('0x7')](config[_0x5a0e('0x6')],{'host':_0x5a0e('0x8'),'port':0x18eb});var io=require(_0x5a0e('0x9'))(new Redis(config[_0x5a0e('0x6')]));function emit(_0x1f98f4,_0x14be01,_0x3a97bc){io['to'](_0x1f98f4)['emit'](_0x14be01,_0x3a97bc);}var headers={'Content-Type':'application/json','Accept':_0x5a0e('0xa')};function getTicket(_0x24aed7,_0x1ee536,_0x42bfc8,_0x1a24b0,_0xa40d23){logger['info'](_0x5a0e('0xb'));return request({'uri':util[_0x5a0e('0xc')]('%s/tickets.json',_0x24aed7[_0x5a0e('0xd')]),'method':_0x5a0e('0xe'),'body':{'ticket':_[_0x5a0e('0xf')]({'requester_id':_0x42bfc8['id'],'submitter_id':_0x1ee536?_0x1ee536['id']:undefined,'assignee_id':_0x1ee536?_0x1ee536['id']:undefined,'tags':getTags(_0x1a24b0[_0x5a0e('0x10')],'name'),'subject':intUtil[_0x5a0e('0x11')](_0x1a24b0[_0x5a0e('0x12')],_0xa40d23,'\x20'),'description':intUtil[_0x5a0e('0x11')](_0x1a24b0[_0x5a0e('0x13')],_0xa40d23,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5a0e('0x11')](_0x1a24b0[_0x5a0e('0x13')],_0xa40d23,'\x0a')}},getCustomFields(_0x1a24b0['Fields'],_0xa40d23))}})[_0x5a0e('0x14')](function(_0x3fe2a0){logger['info'](_0x5a0e('0x15'));return _0x3fe2a0[_0x5a0e('0x16')];});}function getUser(_0x596df7,_0xbd9f64){if(intUtil[_0x5a0e('0x17')](_0xbd9f64)){logger[_0x5a0e('0x18')](_0x5a0e('0x19'),_0xbd9f64);return request({'uri':util[_0x5a0e('0xc')](_0x5a0e('0x1a'),_0x596df7[_0x5a0e('0xd')]),'qs':{'query':util[_0x5a0e('0xc')](_0x5a0e('0x1b'),_0xbd9f64)}})['then'](function(_0x1f7101){if(_0x1f7101[_0x5a0e('0x1c')]){logger['info'](_0x5a0e('0x1d'));return _[_0x5a0e('0x1e')](_0x1f7101['results'],{'email':_0xbd9f64,'role':'agent'});}else{logger[_0x5a0e('0x18')](_0x5a0e('0x1f'));return request({'uri':util[_0x5a0e('0xc')](_0x5a0e('0x20'),_0x596df7[_0x5a0e('0xd')])})[_0x5a0e('0x14')](function(_0xf3aa1d){logger[_0x5a0e('0x18')](_0x5a0e('0x21'));return _0xf3aa1d['user'];});}});}else{logger[_0x5a0e('0x18')](_0x5a0e('0x1f'));return request({'uri':util[_0x5a0e('0xc')]('%s/users/me.json',_0x596df7[_0x5a0e('0xd')])})[_0x5a0e('0x14')](function(_0x28499f){logger[_0x5a0e('0x18')](_0x5a0e('0x21'));return _0x28499f[_0x5a0e('0x22')];});}}function getEndUser(_0xa5e811,_0x3c6cc8,_0x58234e){logger[_0x5a0e('0x18')](_0x5a0e('0x23'),_0x58234e);return request({'uri':util[_0x5a0e('0xc')]('%s/search.json',_0xa5e811[_0x5a0e('0xd')]),'qs':{'query':util[_0x5a0e('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x58234e)}})[_0x5a0e('0x14')](function(_0x31389d){var _0xa4b82b;if(_0x31389d['results']['length']){_0x31389d[_0x5a0e('0x24')]=_[_0x5a0e('0x25')](_0x31389d[_0x5a0e('0x24')],{'suspended':![],'role':'end-user'});if(_0x31389d[_0x5a0e('0x24')][_0x5a0e('0x26')]){_0xa4b82b=_[_0x5a0e('0x27')](_0x31389d[_0x5a0e('0x24')]);}}if(_0xa4b82b){logger['info']('Enduser\x20found!');return _0xa4b82b;}else{logger['info'](_0x5a0e('0x28'));return request({'uri':util[_0x5a0e('0xc')](_0x5a0e('0x29'),_0xa5e811[_0x5a0e('0xd')]),'method':'POST','body':{'user':{'role':_0x5a0e('0x2a'),'name':util['format'](_0x5a0e('0x2b'),_0x3c6cc8||_0x58234e),'phone':_0x58234e}}})['then'](function(_0x47e3f0){logger[_0x5a0e('0x18')](_0x5a0e('0x2c'));return _0x47e3f0[_0x5a0e('0x22')];});}});}function getAuth(_0x2ea04b){var _0x48258a;if(_0x2ea04b[_0x5a0e('0x2d')]===_0x5a0e('0x2e')){_0x48258a=util[_0x5a0e('0xc')](_0x5a0e('0x2f'),_0x2ea04b[_0x5a0e('0x30')],_0x2ea04b[_0x5a0e('0x2e')]);}else if(_0x2ea04b[_0x5a0e('0x2d')]===_0x5a0e('0x31')){_0x48258a=util[_0x5a0e('0xc')](_0x5a0e('0x32'),_0x2ea04b[_0x5a0e('0x30')],_0x2ea04b[_0x5a0e('0x31')]);}return util[_0x5a0e('0xc')](_0x5a0e('0x33'),new Buffer(_0x48258a)[_0x5a0e('0x34')](_0x5a0e('0x35')));}function request(_0x538170){logger['debug'](_0x5a0e('0x36'),JSON['stringify'](_0x538170));return rp(_['defaults'](_0x538170,{'method':_0x5a0e('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x2bb44e,_0x19e41b){var _0x2c5266=[];if(_0x2bb44e&&_0x2bb44e[_0x5a0e('0x26')]>0x0){_0x2c5266=_[_0x5a0e('0x38')](_0x2bb44e,_0x19e41b);}return _0x2c5266;}function getCustomFields(_0x1e3100,_0x347b52){var _0x4f4d02=[];var _0x52966d={'custom_fields':[]};if(_0x1e3100[_0x5a0e('0x26')]>0x0){_[_0x5a0e('0x39')](_0x1e3100,function(_0xb458e0){if(_['includes']([_0x5a0e('0x3a'),_0x5a0e('0x3b')],_0xb458e0['type'])&&_0xb458e0['nameField']&&!_0xb458e0['customField']){_0x52966d[_0xb458e0['nameField'][_0x5a0e('0x3c')]()]=_0xb458e0[_0x5a0e('0x3d')]['toString']();}else if(_[_0x5a0e('0x3e')]([_0x5a0e('0x3a'),_0x5a0e('0x3b')],_0xb458e0[_0x5a0e('0x3f')])&&_0xb458e0[_0x5a0e('0x40')]&&_0xb458e0[_0x5a0e('0x41')]){_0x52966d['custom_fields'][_0x5a0e('0x42')]({'id':_0xb458e0[_0x5a0e('0x40')],'value':_0xb458e0[_0x5a0e('0x3d')][_0x5a0e('0x34')]()});}else if(_0xb458e0[_0x5a0e('0x3f')]===_0x5a0e('0x43')&&_0xb458e0['variableName']&&_0xb458e0[_0x5a0e('0x40')]&&_0xb458e0['customField']){_0x347b52[_0xb458e0[_0x5a0e('0x44')]]&&_0x52966d[_0x5a0e('0x45')][_0x5a0e('0x42')]({'id':_0xb458e0['idField'],'value':_0x347b52[_0xb458e0[_0x5a0e('0x44')]][_0x5a0e('0x34')]()});}else if(_0xb458e0[_0x5a0e('0x3f')]===_0x5a0e('0x46')&&_0xb458e0[_0x5a0e('0x47')]&&_0xb458e0[_0x5a0e('0x47')][_0x5a0e('0x48')]&&_0xb458e0[_0x5a0e('0x40')]&&_0xb458e0[_0x5a0e('0x41')]){_0x347b52[_0xb458e0['Variable'][_0x5a0e('0x48')][_0x5a0e('0x3c')]()]&&_0x52966d['custom_fields'][_0x5a0e('0x42')]({'id':_0xb458e0[_0x5a0e('0x40')],'value':_0x347b52[_0xb458e0[_0x5a0e('0x47')][_0x5a0e('0x48')][_0x5a0e('0x3c')]()][_0x5a0e('0x34')]()});}});}return _0x52966d;}exports['queue']=function(_0x12572a,_0x17339e,_0x333634,_0x2b962c,_0x2d6823,_0x15f04a){var _0x52fe7b,_0x2ab622;_0x15f04a[_0x5a0e('0xd')]=intUtil[_0x5a0e('0x49')](_0x15f04a['remoteUri']);_0x15f04a[_0x5a0e('0x4a')]=intUtil[_0x5a0e('0x49')](_0x15f04a[_0x5a0e('0x4a')]);if(_0x2d6823&&_0x2d6823['monitor_format']){logger[_0x5a0e('0x18')](_0x5a0e('0x4b'),_0x5a0e('0x4c'));_0x17339e['recordingURL']=util[_0x5a0e('0xc')](_0x5a0e('0x4d'),_0x15f04a[_0x5a0e('0x4a')],_0x17339e[_0x5a0e('0x4e')],md5(_0x17339e[_0x5a0e('0x4e')]));}else{_0x17339e['recordingURL']='';}headers['Authorization']=getAuth(_0x15f04a);return getUser(_0x15f04a,_0x2b962c[_0x5a0e('0x4f')])[_0x5a0e('0x14')](function(_0x2d3ab7){_0x52fe7b=_0x2d3ab7;logger[_0x5a0e('0x18')](_0x5a0e('0x50'),_0x52fe7b['id']);return getEndUser(_0x15f04a,_0x17339e[_0x5a0e('0x51')],_0x17339e[_0x5a0e('0x52')]);})[_0x5a0e('0x14')](function(_0x382307){_0x2ab622=_0x382307;logger[_0x5a0e('0x18')](_0x5a0e('0x53'),_0x2ab622['id']);return getTicket(_0x15f04a,_0x52fe7b,_0x2ab622,_0x333634,_0x17339e);})[_0x5a0e('0x14')](function(_0x36b07d){if(_0x36b07d){logger[_0x5a0e('0x18')]('The\x20Ticket\x20ID\x20is:',_0x36b07d['id']);switch(_0x15f04a[_0x5a0e('0x3f')]){case _0x5a0e('0x54'):logger[_0x5a0e('0x18')](_0x5a0e('0x4b'),_0x5a0e('0x55'));return request({'uri':util[_0x5a0e('0xc')](_0x5a0e('0x56'),_0x15f04a[_0x5a0e('0xd')],_0x52fe7b['id'],_0x36b07d['id']),'method':_0x5a0e('0xe')});case'newTab':logger['info'](_0x5a0e('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a0e('0xc')]('user:%s',_0x2b962c['name']),'trigger:browser:url',{'uri':util[_0x5a0e('0xc')]('%s/agent/tickets/%s',_0x15f04a[_0x5a0e('0xd')][_0x5a0e('0x57')](_0x5a0e('0x58'),''),_0x36b07d['id'])});break;default:logger[_0x5a0e('0x59')](_0x5a0e('0x4b'),_0x5a0e('0x5a'));}}})[_0x5a0e('0x5b')](function(_0x20ec24){logger[_0x5a0e('0x59')](_0x5a0e('0x5c'),util[_0x5a0e('0x5d')](_0x20ec24,{'showHidden':!![],'depth':null}));});};exports[_0x5a0e('0x5e')]=function(_0x13ae04,_0x29bb04,_0x13d86d,_0x5817c7,_0x525550,_0x3498e6,_0x1324c7){var _0x123661,_0x54c746;_0x3498e6[_0x5a0e('0xd')]=intUtil[_0x5a0e('0x49')](_0x3498e6['remoteUri']);_0x3498e6[_0x5a0e('0x4a')]=intUtil['stripTrailingSlash'](_0x3498e6[_0x5a0e('0x4a')]);if(_0x1324c7&&_0x1324c7[_0x5a0e('0x5f')]&&_0x1324c7[_0x5a0e('0x5f')]!=='none'){logger[_0x5a0e('0x18')](_0x5a0e('0x60'),_0x5a0e('0x4c'));_0x29bb04[_0x5a0e('0x61')]=util['format'](_0x5a0e('0x4d'),_0x3498e6[_0x5a0e('0x4a')],_0x29bb04[_0x5a0e('0x4e')],md5(_0x29bb04[_0x5a0e('0x4e')]));}headers[_0x5a0e('0x62')]=getAuth(_0x3498e6);return getUser(_0x3498e6,_0x5817c7[_0x5a0e('0x4f')])[_0x5a0e('0x14')](function(_0x3ac34d){_0x123661=_0x3ac34d;logger['info'](_0x5a0e('0x50'),_0x123661['id']);return getEndUser(_0x3498e6,_0x29bb04[_0x5a0e('0x63')],_0x29bb04[_0x5a0e('0x64')]);})[_0x5a0e('0x14')](function(_0x29b6c2){_0x54c746=_0x29b6c2;logger[_0x5a0e('0x18')](_0x5a0e('0x53'),_0x54c746['id']);return getTicket(_0x3498e6,_0x123661,_0x54c746,_0x13d86d,_0x29bb04);})[_0x5a0e('0x14')](function(_0x293690){if(_0x293690){logger[_0x5a0e('0x18')](_0x5a0e('0x65'),_0x293690['id']);switch(_0x3498e6[_0x5a0e('0x3f')]){case _0x5a0e('0x54'):logger[_0x5a0e('0x18')](_0x5a0e('0x60'),_0x5a0e('0x55'));return request({'uri':util['format'](_0x5a0e('0x56'),_0x3498e6[_0x5a0e('0xd')],_0x123661['id'],_0x293690['id']),'method':_0x5a0e('0xe')});case _0x5a0e('0x66'):logger['info'](_0x5a0e('0x60'),_0x5a0e('0x67'));emit(util[_0x5a0e('0xc')](_0x5a0e('0x68'),_0x5817c7['name']),_0x5a0e('0x69'),{'uri':util[_0x5a0e('0xc')](_0x5a0e('0x6a'),_0x3498e6[_0x5a0e('0xd')]['replace'](_0x5a0e('0x58'),''),_0x293690['id'])});break;default:logger[_0x5a0e('0x59')](_0x5a0e('0x60'),_0x5a0e('0x5a'));}}})[_0x5a0e('0x5b')](function(_0x2e428c){logger['error'](_0x5a0e('0x6b'),util[_0x5a0e('0x5d')](_0x2e428c,{'showHidden':!![],'depth':null}));});};exports[_0x5a0e('0x6c')]=function(_0x2fb208,_0x283564,_0x4a1683,_0x112eab,_0x38757f,_0x204b33){var _0x56973e,_0x486883;_0x204b33[_0x5a0e('0xd')]=intUtil['stripTrailingSlash'](_0x204b33['remoteUri']);_0x204b33[_0x5a0e('0x4a')]=intUtil['stripTrailingSlash'](_0x204b33[_0x5a0e('0x4a')]);if(_0x38757f&&_0x38757f[_0x5a0e('0x6d')]){logger[_0x5a0e('0x18')]('['+_0x283564['lastevent']['toUpperCase']()+']',_0x5a0e('0x4c'));_0x283564[_0x5a0e('0x61')]=util[_0x5a0e('0xc')](_0x5a0e('0x4d'),_0x204b33[_0x5a0e('0x4a')],_0x283564[_0x5a0e('0x4e')],md5(_0x283564['uniqueid']));}else{_0x283564['recordingURL']='';}headers[_0x5a0e('0x62')]=getAuth(_0x204b33);return getUser(_0x204b33)[_0x5a0e('0x14')](function(_0x3c9d7c){_0x56973e=_0x3c9d7c;logger[_0x5a0e('0x18')](_0x5a0e('0x50'),_0x56973e['id']);return getEndUser(_0x204b33,_0x283564[_0x5a0e('0x51')],_0x283564['calleridnum']);})['then'](function(_0x1643e1){_0x486883=_0x1643e1;logger[_0x5a0e('0x18')]('The\x20Enduser\x20ID\x20is:',_0x486883['id']);return getTicket(_0x204b33,_0x56973e,_0x486883,_0x4a1683,_0x283564);})[_0x5a0e('0x14')](function(_0x23100e){if(_0x23100e){logger[_0x5a0e('0x18')](_0x5a0e('0x65'),_0x23100e['id']);}})[_0x5a0e('0x5b')](function(_0x5b0ca2){logger[_0x5a0e('0x59')]('['+_0x283564[_0x5a0e('0x6e')][_0x5a0e('0x6f')]()+']'+_0x5a0e('0x70'),util[_0x5a0e('0x5d')](_0x5b0ca2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe931=['find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','picklist','nameField','customField','type','custom_fields','push','idField','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','Authorization','email','[OUTBOUND]','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','format','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xe931,0x124));var _0x1e93=function(_0x423a34,_0x439d2d){_0x423a34=_0x423a34-0x0;var _0x3b9a77=_0xe931[_0x423a34];return _0x3b9a77;};'use strict';var _=require(_0x1e93('0x0'));var rp=require('request-promise');var md5=require(_0x1e93('0x1'));var util=require(_0x1e93('0x2'));var Redis=require(_0x1e93('0x3'));var intUtil=require(_0x1e93('0x4'));var config=require(_0x1e93('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0x1e93('0x6')](config[_0x1e93('0x7')],{'host':_0x1e93('0x8'),'port':0x18eb});var io=require(_0x1e93('0x9'))(new Redis(config[_0x1e93('0x7')]));function emit(_0x30748e,_0x2ed4be,_0x50b33b){io['to'](_0x30748e)[_0x1e93('0xa')](_0x2ed4be,_0x50b33b);}var headers={'Content-Type':_0x1e93('0xb'),'Accept':_0x1e93('0xb')};function getTicket(_0x2da9a9,_0x1b828c,_0x3e7978,_0x4d1ebb,_0x5e74fa){logger[_0x1e93('0xc')](_0x1e93('0xd'));return request({'uri':util['format']('%s/tickets.json',_0x2da9a9['remoteUri']),'method':_0x1e93('0xe'),'body':{'ticket':_[_0x1e93('0xf')]({'requester_id':_0x3e7978['id'],'submitter_id':_0x1b828c?_0x1b828c['id']:undefined,'assignee_id':_0x1b828c?_0x1b828c['id']:undefined,'tags':getTags(_0x4d1ebb[_0x1e93('0x10')],_0x1e93('0x11')),'subject':intUtil['getString'](_0x4d1ebb[_0x1e93('0x12')],_0x5e74fa,'\x20'),'description':intUtil[_0x1e93('0x13')](_0x4d1ebb[_0x1e93('0x14')],_0x5e74fa,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1e93('0x13')](_0x4d1ebb['Descriptions'],_0x5e74fa,'\x0a')}},getCustomFields(_0x4d1ebb[_0x1e93('0x15')],_0x5e74fa))}})[_0x1e93('0x16')](function(_0x5b9c89){logger[_0x1e93('0xc')]('Ticket\x20created!');return _0x5b9c89['ticket'];});}function getUser(_0x21e2ba,_0x59123f){if(intUtil[_0x1e93('0x17')](_0x59123f)){logger[_0x1e93('0xc')](_0x1e93('0x18'),_0x59123f);return request({'uri':util[_0x1e93('0x19')]('%s/search.json',_0x21e2ba[_0x1e93('0x1a')]),'qs':{'query':util[_0x1e93('0x19')](_0x1e93('0x1b'),_0x59123f)}})[_0x1e93('0x16')](function(_0x5400b7){if(_0x5400b7['count']){logger['info'](_0x1e93('0x1c'));return _[_0x1e93('0x1d')](_0x5400b7[_0x1e93('0x1e')],{'email':_0x59123f,'role':_0x1e93('0x1f')});}else{logger[_0x1e93('0xc')](_0x1e93('0x20'));return request({'uri':util['format'](_0x1e93('0x21'),_0x21e2ba[_0x1e93('0x1a')])})[_0x1e93('0x16')](function(_0xd1a2c){logger[_0x1e93('0xc')](_0x1e93('0x22'));return _0xd1a2c[_0x1e93('0x23')];});}});}else{logger[_0x1e93('0xc')](_0x1e93('0x20'));return request({'uri':util[_0x1e93('0x19')](_0x1e93('0x21'),_0x21e2ba['remoteUri'])})[_0x1e93('0x16')](function(_0x595896){logger[_0x1e93('0xc')](_0x1e93('0x22'));return _0x595896[_0x1e93('0x23')];});}}function getEndUser(_0x11c101,_0x10bf29,_0x51a7b4){logger[_0x1e93('0xc')]('Searching\x20enduser\x20with\x20phone',_0x51a7b4);return request({'uri':util[_0x1e93('0x19')](_0x1e93('0x24'),_0x11c101[_0x1e93('0x1a')]),'qs':{'query':util[_0x1e93('0x19')](_0x1e93('0x25'),_0x51a7b4)}})[_0x1e93('0x16')](function(_0xf05b3c){var _0x506dd0;if(_0xf05b3c['results'][_0x1e93('0x26')]){_0xf05b3c[_0x1e93('0x1e')]=_[_0x1e93('0x27')](_0xf05b3c[_0x1e93('0x1e')],{'suspended':![],'role':'end-user'});if(_0xf05b3c[_0x1e93('0x1e')][_0x1e93('0x26')]){_0x506dd0=_['first'](_0xf05b3c['results']);}}if(_0x506dd0){logger[_0x1e93('0xc')](_0x1e93('0x28'));return _0x506dd0;}else{logger[_0x1e93('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1e93('0x19')](_0x1e93('0x29'),_0x11c101[_0x1e93('0x1a')]),'method':'POST','body':{'user':{'role':_0x1e93('0x2a'),'name':util[_0x1e93('0x19')](_0x1e93('0x2b'),_0x10bf29||_0x51a7b4),'phone':_0x51a7b4}}})[_0x1e93('0x16')](function(_0x18d485){logger[_0x1e93('0xc')](_0x1e93('0x2c'));return _0x18d485[_0x1e93('0x23')];});}});}function getAuth(_0x3446df){var _0x449592;if(_0x3446df[_0x1e93('0x2d')]===_0x1e93('0x2e')){_0x449592=util[_0x1e93('0x19')](_0x1e93('0x2f'),_0x3446df[_0x1e93('0x30')],_0x3446df[_0x1e93('0x2e')]);}else if(_0x3446df[_0x1e93('0x2d')]==='token'){_0x449592=util['format'](_0x1e93('0x31'),_0x3446df[_0x1e93('0x30')],_0x3446df['token']);}return util['format']('Basic\x20%s',new Buffer(_0x449592)[_0x1e93('0x32')](_0x1e93('0x33')));}function request(_0x4928e5){logger[_0x1e93('0x34')](_0x1e93('0x35'),JSON['stringify'](_0x4928e5));return rp(_[_0x1e93('0x6')](_0x4928e5,{'method':_0x1e93('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x7f769b,_0x4a8b24){var _0x5e9a4b=[];if(_0x7f769b&&_0x7f769b['length']>0x0){_0x5e9a4b=_[_0x1e93('0x37')](_0x7f769b,_0x4a8b24);}return _0x5e9a4b;}function getCustomFields(_0x59115a,_0x26bd86){var _0x36e8bf=[];var _0x311b44={'custom_fields':[]};if(_0x59115a[_0x1e93('0x26')]>0x0){_[_0x1e93('0x38')](_0x59115a,function(_0x152cab){if(_[_0x1e93('0x39')]([_0x1e93('0x3a'),_0x1e93('0x3b')],_0x152cab['type'])&&_0x152cab[_0x1e93('0x3c')]&&!_0x152cab[_0x1e93('0x3d')]){_0x311b44[_0x152cab[_0x1e93('0x3c')]['toLowerCase']()]=_0x152cab['content'][_0x1e93('0x32')]();}else if(_['includes']([_0x1e93('0x3a'),_0x1e93('0x3b')],_0x152cab[_0x1e93('0x3e')])&&_0x152cab['idField']&&_0x152cab[_0x1e93('0x3d')]){_0x311b44[_0x1e93('0x3f')][_0x1e93('0x40')]({'id':_0x152cab[_0x1e93('0x41')],'value':_0x152cab['content']['toString']()});}else if(_0x152cab[_0x1e93('0x3e')]===_0x1e93('0x42')&&_0x152cab[_0x1e93('0x43')]&&_0x152cab['idField']&&_0x152cab['customField']){_0x26bd86[_0x152cab[_0x1e93('0x43')]]&&_0x311b44[_0x1e93('0x3f')]['push']({'id':_0x152cab[_0x1e93('0x41')],'value':_0x26bd86[_0x152cab[_0x1e93('0x43')]][_0x1e93('0x32')]()});}else if(_0x152cab[_0x1e93('0x3e')]===_0x1e93('0x44')&&_0x152cab[_0x1e93('0x45')]&&_0x152cab['Variable'][_0x1e93('0x11')]&&_0x152cab[_0x1e93('0x41')]&&_0x152cab['customField']){_0x26bd86[_0x152cab[_0x1e93('0x45')][_0x1e93('0x11')][_0x1e93('0x46')]()]&&_0x311b44[_0x1e93('0x3f')]['push']({'id':_0x152cab['idField'],'value':_0x26bd86[_0x152cab[_0x1e93('0x45')][_0x1e93('0x11')][_0x1e93('0x46')]()]['toString']()});}});}return _0x311b44;}exports['queue']=function(_0x5ea617,_0x3f3a82,_0x19d3fa,_0x2ded90,_0x3ce81c,_0x47c8e5){var _0x1f138c,_0x25bb52;_0x47c8e5[_0x1e93('0x1a')]=intUtil[_0x1e93('0x47')](_0x47c8e5[_0x1e93('0x1a')]);_0x47c8e5['serverUrl']=intUtil[_0x1e93('0x47')](_0x47c8e5[_0x1e93('0x48')]);if(_0x3ce81c&&_0x3ce81c['monitor_format']){logger[_0x1e93('0xc')]('[QUEUE]',_0x1e93('0x49'));_0x3f3a82[_0x1e93('0x4a')]=util[_0x1e93('0x19')](_0x1e93('0x4b'),_0x47c8e5[_0x1e93('0x48')],_0x3f3a82[_0x1e93('0x4c')],md5(_0x3f3a82[_0x1e93('0x4c')]));}else{_0x3f3a82[_0x1e93('0x4a')]='';}headers['Authorization']=getAuth(_0x47c8e5);return getUser(_0x47c8e5,_0x2ded90['email'])[_0x1e93('0x16')](function(_0x2b9e58){_0x1f138c=_0x2b9e58;logger['info'](_0x1e93('0x4d'),_0x1f138c['id']);return getEndUser(_0x47c8e5,_0x3f3a82[_0x1e93('0x4e')],_0x3f3a82[_0x1e93('0x4f')]);})[_0x1e93('0x16')](function(_0x375e0a){_0x25bb52=_0x375e0a;logger[_0x1e93('0xc')](_0x1e93('0x50'),_0x25bb52['id']);return getTicket(_0x47c8e5,_0x1f138c,_0x25bb52,_0x19d3fa,_0x3f3a82);})[_0x1e93('0x16')](function(_0x25df45){if(_0x25df45){logger[_0x1e93('0xc')](_0x1e93('0x51'),_0x25df45['id']);switch(_0x47c8e5[_0x1e93('0x3e')]){case _0x1e93('0x52'):logger[_0x1e93('0xc')](_0x1e93('0x53'),_0x1e93('0x54'));return request({'uri':util[_0x1e93('0x19')](_0x1e93('0x55'),_0x47c8e5[_0x1e93('0x1a')],_0x1f138c['id'],_0x25df45['id']),'method':_0x1e93('0xe')});case _0x1e93('0x56'):logger[_0x1e93('0xc')](_0x1e93('0x53'),_0x1e93('0x57'));emit(util[_0x1e93('0x19')]('user:%s',_0x2ded90['name']),_0x1e93('0x58'),{'uri':util[_0x1e93('0x19')]('%s/agent/tickets/%s',_0x47c8e5['remoteUri'][_0x1e93('0x59')](_0x1e93('0x5a'),''),_0x25df45['id'])});break;default:logger[_0x1e93('0x5b')](_0x1e93('0x53'),_0x1e93('0x5c'));}}})[_0x1e93('0x5d')](function(_0x24528c){logger[_0x1e93('0x5b')](_0x1e93('0x5e'),util[_0x1e93('0x5f')](_0x24528c,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xac9406,_0x220157,_0xc0a4af,_0x5572d4,_0x55db9c,_0x1ce461,_0x34c429){var _0x1db954,_0x33e1f4;_0x1ce461[_0x1e93('0x1a')]=intUtil[_0x1e93('0x47')](_0x1ce461['remoteUri']);_0x1ce461[_0x1e93('0x48')]=intUtil[_0x1e93('0x47')](_0x1ce461['serverUrl']);if(_0x34c429&&_0x34c429[_0x1e93('0x60')]&&_0x34c429[_0x1e93('0x60')]!==_0x1e93('0x61')){logger[_0x1e93('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x220157['recordingURL']=util['format'](_0x1e93('0x4b'),_0x1ce461[_0x1e93('0x48')],_0x220157[_0x1e93('0x4c')],md5(_0x220157[_0x1e93('0x4c')]));}headers[_0x1e93('0x62')]=getAuth(_0x1ce461);return getUser(_0x1ce461,_0x5572d4[_0x1e93('0x63')])[_0x1e93('0x16')](function(_0x4fda13){_0x1db954=_0x4fda13;logger[_0x1e93('0xc')]('The\x20User\x20ID\x20is:',_0x1db954['id']);return getEndUser(_0x1ce461,_0x220157['destcalleridname'],_0x220157['destcalleridnum']);})[_0x1e93('0x16')](function(_0x44e204){_0x33e1f4=_0x44e204;logger[_0x1e93('0xc')](_0x1e93('0x50'),_0x33e1f4['id']);return getTicket(_0x1ce461,_0x1db954,_0x33e1f4,_0xc0a4af,_0x220157);})['then'](function(_0x5b30e7){if(_0x5b30e7){logger[_0x1e93('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5b30e7['id']);switch(_0x1ce461[_0x1e93('0x3e')]){case _0x1e93('0x52'):logger[_0x1e93('0xc')](_0x1e93('0x64'),_0x1e93('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1ce461[_0x1e93('0x1a')],_0x1db954['id'],_0x5b30e7['id']),'method':'POST'});case _0x1e93('0x56'):logger['info'](_0x1e93('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1e93('0x65'),_0x5572d4[_0x1e93('0x11')]),_0x1e93('0x58'),{'uri':util[_0x1e93('0x19')]('%s/agent/tickets/%s',_0x1ce461['remoteUri']['replace'](_0x1e93('0x5a'),''),_0x5b30e7['id'])});break;default:logger['error'](_0x1e93('0x64'),_0x1e93('0x5c'));}}})[_0x1e93('0x5d')](function(_0x38cd48){logger[_0x1e93('0x5b')](_0x1e93('0x66'),util[_0x1e93('0x5f')](_0x38cd48,{'showHidden':!![],'depth':null}));});};exports[_0x1e93('0x67')]=function(_0x2a6c8a,_0x3c1503,_0x3c033e,_0x2e1c75,_0xe7c17d,_0xc92fcb){var _0x5ac50f,_0x3d9fbd;_0xc92fcb['remoteUri']=intUtil[_0x1e93('0x47')](_0xc92fcb[_0x1e93('0x1a')]);_0xc92fcb[_0x1e93('0x48')]=intUtil['stripTrailingSlash'](_0xc92fcb[_0x1e93('0x48')]);if(_0xe7c17d&&_0xe7c17d[_0x1e93('0x68')]){logger[_0x1e93('0xc')]('['+_0x3c1503['lastevent'][_0x1e93('0x69')]()+']','Recording\x20is\x20enabled!');_0x3c1503[_0x1e93('0x4a')]=util['format'](_0x1e93('0x4b'),_0xc92fcb[_0x1e93('0x48')],_0x3c1503[_0x1e93('0x4c')],md5(_0x3c1503[_0x1e93('0x4c')]));}else{_0x3c1503[_0x1e93('0x4a')]='';}headers['Authorization']=getAuth(_0xc92fcb);return getUser(_0xc92fcb)[_0x1e93('0x16')](function(_0x1874fe){_0x5ac50f=_0x1874fe;logger[_0x1e93('0xc')](_0x1e93('0x4d'),_0x5ac50f['id']);return getEndUser(_0xc92fcb,_0x3c1503[_0x1e93('0x4e')],_0x3c1503[_0x1e93('0x4f')]);})[_0x1e93('0x16')](function(_0x494aa2){_0x3d9fbd=_0x494aa2;logger[_0x1e93('0xc')](_0x1e93('0x50'),_0x3d9fbd['id']);return getTicket(_0xc92fcb,_0x5ac50f,_0x3d9fbd,_0x3c033e,_0x3c1503);})['then'](function(_0x3ac632){if(_0x3ac632){logger[_0x1e93('0xc')](_0x1e93('0x51'),_0x3ac632['id']);}})[_0x1e93('0x5d')](function(_0xe613f3){logger[_0x1e93('0x5b')]('['+_0x3c1503['lastevent'][_0x1e93('0x69')]()+']'+_0x1e93('0x6a'),util['inspect'](_0xe613f3,{'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 fe99f2e..ad9f3d7 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 _0xd8ea=['https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','seconds','catch','error','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','isArrayLikeObject','email','Agent\x20found!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','details','enduserType','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','format','mm:ss','answertime','endtime','Call_Duration','utc','diff','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','toUpperCase','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x53cb18,_0x43869c){var _0x191986=function(_0x526bd7){while(--_0x526bd7){_0x53cb18['push'](_0x53cb18['shift']());}};_0x191986(++_0x43869c);}(_0xd8ea,0x1bd));var _0xad8e=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0xd8ea[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0xad8e('0x0'));var rp=require(_0xad8e('0x1'));var md5=require(_0xad8e('0x2'));var util=require(_0xad8e('0x3'));var intUtil=require(_0xad8e('0x4'));var moment=require(_0xad8e('0x5'));var Redis=require('ioredis');var BPromise=require(_0xad8e('0x6'));var config=require(_0xad8e('0x7'));var logger=require(_0xad8e('0x8'))('zoho');config[_0xad8e('0x9')]=_[_0xad8e('0xa')](config[_0xad8e('0x9')],{'host':_0xad8e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x396cc6,_0x47627c,_0x24c518){io['to'](_0x396cc6)[_0xad8e('0xc')](_0x47627c,_0x24c518);}function request(_0xbef199){logger[_0xad8e('0xd')](_0xad8e('0xe'),JSON[_0xad8e('0xf')](_0xbef199));return rp(_0xbef199);}function getCustomFields(_0x1ff2f1,_0x549b06){var _0x401588={};if(_0x1ff2f1['length']>0x0){_[_0xad8e('0x10')](_0x1ff2f1,function(_0x112807){if(_['includes']([_0xad8e('0x11'),_0xad8e('0x12')],_0x112807[_0xad8e('0x13')])&&_0x112807['idField']){_0x401588[_0x112807[_0xad8e('0x14')]]=_0x112807[_0xad8e('0x15')][_0xad8e('0x16')]();}else if(_0x112807[_0xad8e('0x13')]===_0xad8e('0x17')&&_0x112807[_0xad8e('0x18')]&&_0x112807[_0xad8e('0x14')]&&_0x549b06[_0x112807[_0xad8e('0x18')]]){_0x401588[_0x112807[_0xad8e('0x14')]]=_0x549b06[_0x112807['variableName']][_0xad8e('0x16')]();}else if(_0x112807['type']===_0xad8e('0x19')&&_0x112807[_0xad8e('0x1a')]&&_0x112807[_0xad8e('0x1a')][_0xad8e('0x1b')]&&_0x112807['idField']&&_0x549b06[_0x112807['Variable']['name'][_0xad8e('0x1c')]()]){_0x401588[_0x112807['idField']]=_0x549b06[_0x112807[_0xad8e('0x1a')][_0xad8e('0x1b')]['toLowerCase']()][_0xad8e('0x16')]();}});}return _0x401588;}function getName(_0xcf9b61){if(_0xcf9b61[_0xad8e('0x1d')]('\x20')>0x0){var _0x471fb=_0xcf9b61[_0xad8e('0x1e')](/ (.+)/);if(_0x471fb[0x1]){return _0x471fb;}}return[_0xcf9b61,_0xcf9b61];}var accountsTokens={};function getAccessToken(_0x4b3a6a){return new Promise(function(_0x2486c3,_0x357c9e){if(!_[_0xad8e('0x1f')](accountsTokens[_0x4b3a6a['id']])&&!_[_0xad8e('0x1f')](accountsTokens[_0x4b3a6a['id']]['access_token'])){if(moment()[_0xad8e('0x20')](accountsTokens[_0x4b3a6a['id']][_0xad8e('0x21')])){_0x2486c3(accountsTokens[_0x4b3a6a['id']][_0xad8e('0x22')]);}}var _0x2f2287;switch(_0x4b3a6a[_0xad8e('0x23')]){case'US':_0x2f2287=_0xad8e('0x24');break;case'AU':_0x2f2287=_0xad8e('0x25');break;case'EU':_0x2f2287=_0xad8e('0x26');break;case'IN':_0x2f2287=_0xad8e('0x27');break;case'CN':_0x2f2287=_0xad8e('0x28');break;default:_0x2f2287=_0xad8e('0x26');break;}var _0x556ed7={'method':_0xad8e('0x29'),'uri':_0x2f2287+_0xad8e('0x2a'),'qs':{'refresh_token':_0x4b3a6a['refreshToken'],'client_id':_0x4b3a6a[_0xad8e('0x2b')],'client_secret':_0x4b3a6a[_0xad8e('0x2c')],'grant_type':_0xad8e('0x2d')},'json':!![]};return rp(_0x556ed7)['then'](function(_0x5a2004){accountsTokens[_0x4b3a6a['id']]={'access_token':_0x5a2004[_0xad8e('0x22')],'expires_in':moment()['add'](_0x5a2004[_0xad8e('0x21')],_0xad8e('0x2e'))};_0x2486c3(_0x5a2004[_0xad8e('0x22')]);})[_0xad8e('0x2f')](function(_0x51349a){logger[_0xad8e('0x30')]('Failing\x20creating\x20the\x20access_token',_0x51349a[_0xad8e('0x31')]);_0x357c9e(_0x51349a);});});}function getUser(_0xf7c664,_0x313b6f,_0x21a0d1,_0xd912a4){logger[_0xad8e('0x32')](_0xad8e('0x33'));return request({'method':'GET','uri':util['format'](_0xad8e('0x34'),_0x313b6f),'qs':{'type':_0xad8e('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xf7c664},'json':!![]})[_0xad8e('0x36')](function(_0x37a47f){if(_0x37a47f[_0xad8e('0x37')]){var _0x1cd25a=-0x1;if(_[_0xad8e('0x38')](_0x37a47f[_0xad8e('0x37')])){if(!_[_0xad8e('0x1f')](_0xd912a4)){_0x1cd25a=_['findIndex'](_0x37a47f['users'],function(_0x56c126){return _0x56c126[_0xad8e('0x39')]===_0xd912a4;});}if(_0x1cd25a>=0x0){logger[_0xad8e('0x32')](_0xad8e('0x3a'));}else{logger[_0xad8e('0x32')]('Using\x20the\x20admin\x20account!');_0x1cd25a=_[_0xad8e('0x3b')](_0x37a47f[_0xad8e('0x37')],function(_0xc54a0a){return _0xc54a0a[_0xad8e('0x3c')]['name']===_0xad8e('0x3d');});}return _0x37a47f[_0xad8e('0x37')][_0x1cd25a];}else{if(_0x37a47f[_0xad8e('0x3e')]['profile']['name']===_0xad8e('0x3d')){logger[_0xad8e('0x32')]('Using\x20the\x20admin\x20account!');user=_0x37a47f[_0xad8e('0x3e')];return user;}else{logger[_0xad8e('0x30')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x37a47f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xad8e('0xf')](_0x37a47f));}}}else{logger['error'](_0xad8e('0x3f'),JSON[_0xad8e('0xf')](_0x37a47f));throw new Error(_0xad8e('0x40')+JSON['stringify'](_0x37a47f));}})[_0xad8e('0x2f')](function(_0x185650){console[_0xad8e('0x30')](_0x185650);});}function getZohoUser(_0xc9a129,_0x2086cb){return new BPromise(function(_0x184a61,_0x4fe5de){request(_0xc9a129)[_0xad8e('0x36')](function(_0x419240){var _0x4b1838=null;if(_0x419240){_0x4b1838=_0x419240[_0xad8e('0x41')][0x0];_0x4b1838['enduserType']=_0x2086cb;}_0x184a61(_0x4b1838);})[_0xad8e('0x2f')](function(_0x7621a9){_0x4fe5de(_0x7621a9);});});}function createEndUser(_0x49e256,_0x2d397f,_0x54733f,_0x55261f,_0x2395e8,_0x306e45){var _0x54733f=getName(_0x54733f);return request({'method':_0xad8e('0x29'),'uri':_0xad8e('0x42')+_0x2d397f+_0xad8e('0x43')+_[_0xad8e('0x44')](_0x306e45[_0xad8e('0x45')])+'s','body':{'data':[{'Last_Name':_0x54733f[0x1],'First_Name':_0x54733f[0x0],'Phone':_0x55261f,'Owner':{'name':!_['isNil'](_0x2395e8[_0xad8e('0x46')][_0xad8e('0x1b')])?_0x2395e8[_0xad8e('0x46')][_0xad8e('0x1b')]:!_[_0xad8e('0x1f')](_0x2395e8[_0xad8e('0x47')])?_0x2395e8[_0xad8e('0x47')]+'\x20'+_0x2395e8[_0xad8e('0x48')]:_0x2395e8[_0xad8e('0x48')],'id':_0x2395e8['id']}}]},'headers':{'Authorization':_0xad8e('0x49')+_0x49e256},'json':!![]})[_0xad8e('0x36')](function(_0x253071){if(_0x253071&&_0x253071['data'][0x0]['code']==='SUCCESS'){var _0xfeb909=_0x253071['data'][0x0][_0xad8e('0x4a')];_0xfeb909[_0xad8e('0x4b')]=_['startCase'](_0x306e45['moduleCreate'])+'s';return _0xfeb909;}logger[_0xad8e('0x30')](_0xad8e('0x3f'),JSON[_0xad8e('0xf')](data));throw new Error('Error:\x20'+JSON[_0xad8e('0xf')](data));})[_0xad8e('0x2f')](function(_0xe7f7d9){console[_0xad8e('0x4c')](_0xad8e('0x4d'),_0xe7f7d9);});}function getEndUser(_0x18bcb0,_0x460ff8,_0x50b84b,_0x38ebb3,_0x2b18bd,_0x650a78,_0x424f01){var _0x5b8add={'method':_0xad8e('0x4e'),'uri':'','headers':{'Authorization':_0xad8e('0x49')+_0x18bcb0},'json':!![]};switch(_0x424f01[_0xad8e('0x4f')]){case _0xad8e('0x50'):_0x5b8add[_0xad8e('0x51')]=_0xad8e('0x42')+_0x460ff8+_0xad8e('0x52')+_0x2b18bd+'))';return getZohoUser(_0x5b8add,_0xad8e('0x53'))[_0xad8e('0x36')](function(_0x560f0d){if(_0x560f0d)return _0x560f0d;_0x5b8add[_0xad8e('0x51')]=_0xad8e('0x42')+_0x460ff8+_0xad8e('0x54')+_0x2b18bd+'))';return getZohoUser(_0x5b8add,'Leads')[_0xad8e('0x36')](function(_0x584a31){if(_0x584a31)return _0x584a31;if(_0x424f01[_0xad8e('0x45')]!='nothing'){return createEndUser(_0x18bcb0,_0x460ff8,_0x38ebb3,_0x2b18bd,_0x650a78,_0x424f01);}else{return{};}});});break;case _0xad8e('0x55'):_0x5b8add[_0xad8e('0x51')]=_0xad8e('0x42')+_0x460ff8+_0xad8e('0x52')+_0x2b18bd+'))';return getZohoUser(_0x5b8add,_0xad8e('0x53'))[_0xad8e('0x36')](function(_0x3f1bba){if(_0x3f1bba)return _0x3f1bba;if(_0x424f01[_0xad8e('0x45')]!='nothing'){return createEndUser(_0x18bcb0,_0x460ff8,_0x38ebb3,_0x2b18bd,_0x650a78,_0x424f01);}else{return{};}});break;case'lead':_0x5b8add['uri']=_0xad8e('0x42')+_0x460ff8+_0xad8e('0x54')+_0x2b18bd+'))';return getZohoUser(_0x5b8add,_0xad8e('0x56'))[_0xad8e('0x36')](function(_0x5ef48d){if(_0x5ef48d)return _0x5ef48d;if(_0x424f01['moduleCreate']!=_0xad8e('0x57')){return createEndUser(_0x18bcb0,_0x460ff8,_0x38ebb3,_0x2b18bd,_0x650a78,_0x424f01);}else{return{};}});break;}}function getCall(_0x55f72a,_0x3e42c4,_0x36e883,_0x778f34,_0x3c59ea,_0x992e49,_0x31896c,_0x4dd081){logger['info'](_0xad8e('0x58'));var _0x40f16e={};_0x40f16e[_0xad8e('0x59')]={'name':!_[_0xad8e('0x1f')](_0x778f34[_0xad8e('0x46')][_0xad8e('0x1b')])&&!_[_0xad8e('0x1f')](_0x778f34[_0xad8e('0x3c')][_0xad8e('0x1b')])&&_0x778f34[_0xad8e('0x3c')][_0xad8e('0x1b')]===_0xad8e('0x5a')?_0x778f34[_0xad8e('0x46')][_0xad8e('0x1b')]:!_['isNil'](_0x778f34[_0xad8e('0x47')])?_0x778f34[_0xad8e('0x47')]+'\x20'+_0x778f34[_0xad8e('0x48')]:_0x778f34[_0xad8e('0x48')],'id':_0x778f34['id']};_0x40f16e[_0xad8e('0x5b')]=intUtil[_0xad8e('0x5c')](_0x992e49[_0xad8e('0x5d')],_0x31896c,'\x20');_0x40f16e['Description']=intUtil['getString'](_0x992e49['Descriptions'],_0x31896c,'\x0a');if(_0x3c59ea[_0xad8e('0x4b')]===_0xad8e('0x53')){_0x40f16e[_0xad8e('0x5e')]={'name':!_[_0xad8e('0x1f')](_0x3c59ea[_0xad8e('0x5f')])?_0x3c59ea['Full_Name']:!_[_0xad8e('0x1f')](_0x3c59ea[_0xad8e('0x60')])?_0x3c59ea[_0xad8e('0x60')]+'\x20'+_0x3c59ea[_0xad8e('0x61')]:_0x3c59ea[_0xad8e('0x61')],'id':_0x3c59ea['id']};}if(_0x3c59ea['enduserType']===_0xad8e('0x56')){_0x40f16e['What_Id']={'name':!_[_0xad8e('0x1f')](_0x3c59ea[_0xad8e('0x5f')])?_0x3c59ea['Full_Name']:!_['isNil'](_0x3c59ea[_0xad8e('0x60')])?_0x3c59ea[_0xad8e('0x60')]+'\x20'+_0x3c59ea[_0xad8e('0x61')]:_0x3c59ea['Last_Name'],'id':_0x3c59ea['id']};_0x40f16e[_0xad8e('0x62')]=_['startCase'](_0x3c59ea[_0xad8e('0x4b')]);}if(_0x31896c[_0xad8e('0x63')]){_0x40f16e['Call_Duration']=moment['utc'](parseInt(_0x31896c[_0xad8e('0x63')])*0x3e8)[_0xad8e('0x64')](_0xad8e('0x65'));}else if(_0x31896c[_0xad8e('0x66')]&&_0x31896c[_0xad8e('0x67')]){_0x40f16e[_0xad8e('0x68')]=moment[_0xad8e('0x69')](moment(_0x31896c[_0xad8e('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xad8e('0x6a')](moment(_0x31896c['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xad8e('0x64')]('mm:ss');}switch(_0x31896c[_0xad8e('0x6b')]){case _0xad8e('0x6c'):_0x40f16e[_0xad8e('0x6d')]=_0xad8e('0x6e');break;case _0xad8e('0x6f'):case'connect':_0x40f16e[_0xad8e('0x6d')]=_0xad8e('0x70');break;case _0xad8e('0x71'):_0x40f16e[_0xad8e('0x6d')]=_0xad8e('0x72');break;case _0xad8e('0x73'):_0x40f16e['Call_Result']=_0xad8e('0x74');break;case _0xad8e('0x75'):_0x40f16e[_0xad8e('0x6d')]=_0xad8e('0x76');default:}_0x40f16e[_0xad8e('0x77')]=(_0x4dd081===_0xad8e('0x78')?moment(_0x31896c[_0xad8e('0x79')])[_0xad8e('0x64')](_0xad8e('0x7a')):moment(_0x31896c[_0xad8e('0x7b')])[_0xad8e('0x64')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xad8e('0x64')](_0xad8e('0x7a'));_0x40f16e[_0xad8e('0x7c')]=_0x4dd081||_0xad8e('0x7d');_0x40f16e=_[_0xad8e('0x7e')](_0x40f16e,getCustomFields(_0x992e49[_0xad8e('0x7f')],_0x31896c));return request({'method':_0xad8e('0x29'),'uri':_0xad8e('0x42')+_0x3e42c4+_0xad8e('0x80'),'headers':{'Authorization':_0xad8e('0x49')+_0x55f72a},'body':{'data':[_0x40f16e]},'json':!![]})[_0xad8e('0x36')](function(_0x20e5e2){if(_0x20e5e2&&_0x20e5e2['data'][0x0][_0xad8e('0x81')]===_0xad8e('0x82')){logger['info']('Call\x20created!');return{'id':_0x20e5e2[_0xad8e('0x41')][0x0][_0xad8e('0x4a')]['id']};}})[_0xad8e('0x2f')](function(_0x470b75){logger[_0xad8e('0x32')](_0xad8e('0x83'),_0x470b75[_0xad8e('0x31')]);console[_0xad8e('0x4c')]('err',_0x470b75);});}exports[_0xad8e('0x84')]=function(_0x52dbaa,_0x458e26,_0x4a0f74,_0x398b8d,_0x5e20c3,_0x351471){var _0x237dab,_0x50a74f,_0x246ca3;_0x351471[_0xad8e('0x85')]=intUtil[_0xad8e('0x86')](_0x351471[_0xad8e('0x85')]);_0x351471[_0xad8e('0x87')]=intUtil[_0xad8e('0x86')](_0x351471['serverUrl']);if(_0x5e20c3&&_0x5e20c3[_0xad8e('0x88')]){logger[_0xad8e('0x32')](_0xad8e('0x89'),'Recording\x20is\x20enabled!');_0x458e26[_0xad8e('0x8a')]=_0x351471[_0xad8e('0x87')]+'/api/voice/recordings/'+_0x458e26[_0xad8e('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x458e26[_0xad8e('0x8b')]);}else{_0x458e26[_0xad8e('0x8a')]='';}var _0x2b8eab=_0x351471[_0xad8e('0x85')]===_0xad8e('0x8c')?'eu':_0xad8e('0x8d');return getAccessToken(_0x351471)[_0xad8e('0x36')](function(_0x16c413){_0x246ca3=_0x16c413;return getUser(_0x246ca3,_0x2b8eab,_0x351471,_0x398b8d[_0xad8e('0x39')]);})['then'](function(_0x3bd26b){_0x237dab=_0x3bd26b;logger[_0xad8e('0x32')](_0xad8e('0x8e'),_0x237dab['id']);return getEndUser(_0x246ca3,_0x2b8eab,_0x351471,_0x458e26[_0xad8e('0x8f')],_0x458e26[_0xad8e('0x90')],_0x237dab,_0x4a0f74);})[_0xad8e('0x36')](function(_0x18f051){_0x50a74f=_0x18f051;return getCall(_0x246ca3,_0x2b8eab,_0x351471,_0x237dab,_0x50a74f,_0x4a0f74,_0x458e26,_0xad8e('0x7d'));})[_0xad8e('0x36')](function(_0x4594ac){if(_0x4594ac){logger[_0xad8e('0x32')](_0xad8e('0x91'),_0x4594ac['id']);logger[_0xad8e('0x32')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xad8e('0x92'),_0x398b8d[_0xad8e('0x1b')]),_0xad8e('0x93'),{'uri':'https://crm.'+_0x351471[_0xad8e('0x85')]+_0xad8e('0x94')+_0x4594ac['id']});}})[_0xad8e('0x2f')](function(_0x563294){logger['error'](_0xad8e('0x89'),JSON[_0xad8e('0xf')](_0x563294));});};exports[_0xad8e('0x78')]=function(_0x3e75ed,_0xdfcefc,_0xa34f59,_0x1adc3d,_0x8ffb9e,_0x2d7961,_0x5f59c7){var _0x433e89,_0x1a0b0a,_0x404522;_0x2d7961[_0xad8e('0x85')]=intUtil[_0xad8e('0x86')](_0x2d7961['host']);_0x2d7961[_0xad8e('0x87')]=intUtil['stripTrailingSlash'](_0x2d7961[_0xad8e('0x87')]);if(_0x5f59c7&&_0x5f59c7[_0xad8e('0x95')]&&_0x5f59c7[_0xad8e('0x95')]!==_0xad8e('0x96')){logger[_0xad8e('0x32')](_0xad8e('0x97'),_0xad8e('0x98'));_0xdfcefc[_0xad8e('0x8a')]=_0x2d7961[_0xad8e('0x87')]+_0xad8e('0x99')+_0xdfcefc[_0xad8e('0x8b')]+_0xad8e('0x9a')+md5(_0xdfcefc['uniqueid']);}var _0x451c0b=_0x2d7961['host']===_0xad8e('0x8c')?'eu':'com';return getAccessToken(_0x2d7961)[_0xad8e('0x36')](function(_0xbefa0c){_0x404522=_0xbefa0c;return getUser(_0x404522,_0x451c0b,_0x2d7961,_0x1adc3d['email']);})[_0xad8e('0x36')](function(_0x443b74){_0x433e89=_0x443b74;logger[_0xad8e('0x32')](_0xad8e('0x8e'),_0x433e89['id']);return getEndUser(_0x404522,_0x451c0b,_0x2d7961,_0xdfcefc[_0xad8e('0x9b')],_0xdfcefc[_0xad8e('0x9c')],_0x433e89,_0xa34f59);})[_0xad8e('0x36')](function(_0x12cc46){_0x1a0b0a=_0x12cc46;return getCall(_0x404522,_0x451c0b,_0x2d7961,_0x433e89,_0x1a0b0a,_0xa34f59,_0xdfcefc,_0xad8e('0x9d'));})[_0xad8e('0x36')](function(_0x38aaec){if(_0x38aaec){logger['info'](_0xad8e('0x91'),_0x38aaec['id']);logger[_0xad8e('0x32')](_0xad8e('0x97'),_0xad8e('0x9e'));emit(util[_0xad8e('0x64')](_0xad8e('0x92'),_0x1adc3d[_0xad8e('0x1b')]),_0xad8e('0x93'),{'uri':_0xad8e('0x9f')+_0x2d7961[_0xad8e('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x38aaec['id']});}})[_0xad8e('0x2f')](function(_0x560356){logger[_0xad8e('0x30')]('[OUTBOUND]',JSON['stringify'](_0x560356));});};exports['unmanaged']=function(_0x2693a8,_0x50871f,_0x561ebf,_0x430636,_0x5a55a9,_0x155eec){var _0x4a0160,_0x2e1a74,_0xf74a57;_0x155eec[_0xad8e('0x85')]=intUtil[_0xad8e('0x86')](_0x155eec[_0xad8e('0x85')]);_0x155eec['serverUrl']=intUtil['stripTrailingSlash'](_0x155eec['serverUrl']);if(_0x5a55a9&&_0x5a55a9[_0xad8e('0x88')]){logger[_0xad8e('0x32')]('['+_0x50871f['lastevent'][_0xad8e('0xa0')]()+']',_0xad8e('0x98'));_0x50871f[_0xad8e('0x8a')]=_0x155eec[_0xad8e('0x87')]+'/api/voice/recordings/'+_0x50871f[_0xad8e('0x8b')]+_0xad8e('0x9a')+md5(_0x50871f[_0xad8e('0x8b')]);}else{_0x50871f[_0xad8e('0x8a')]='';}var _0x4c8219=_0x155eec[_0xad8e('0x85')]===_0xad8e('0x8c')?'eu':_0xad8e('0x8d');return getAccessToken(_0x155eec)[_0xad8e('0x36')](function(_0x3b3d25){_0xf74a57=_0x3b3d25;return getUser(_0xf74a57,_0x4c8219,_0x155eec);})['then'](function(_0x73d55d){_0x4a0160=_0x73d55d;logger[_0xad8e('0x32')](_0xad8e('0x8e'),_0x4a0160['id']);return getEndUser(_0xf74a57,_0x4c8219,_0x155eec,_0x50871f['calleridname'],_0x50871f['calleridnum'],_0x4a0160,_0x561ebf);})['then'](function(_0x5d1d17){_0x2e1a74=_0x5d1d17;return getCall(_0xf74a57,_0x4c8219,_0x155eec,_0x4a0160,_0x2e1a74,_0x561ebf,_0x50871f,'Inbound');})[_0xad8e('0x36')](function(_0xda6eba){if(_0xda6eba){logger['info']('The\x20Call\x20ID\x20is:',_0xda6eba['id']);}})[_0xad8e('0x2f')](function(_0x1b226c){logger[_0xad8e('0x30')]('['+_0x50871f[_0xad8e('0x6b')]['toUpperCase']()+']',JSON[_0xad8e('0xf')](_0x1b226c));});}; \ No newline at end of file +var _0x3148=['utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','log','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','calleridname','calleridnum','The\x20Call\x20ID\x20is:','toUpperCase','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','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','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','user','profile','info','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','catch','GET','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration'];(function(_0x5335de,_0x19e9f2){var _0x342c16=function(_0x57bbbd){while(--_0x57bbbd){_0x5335de['push'](_0x5335de['shift']());}};_0x342c16(++_0x19e9f2);}(_0x3148,0x172));var _0x8314=function(_0x175f46,_0x94c9a2){_0x175f46=_0x175f46-0x0;var _0x2c1c5d=_0x3148[_0x175f46];return _0x2c1c5d;};'use strict';var _=require('lodash');var rp=require(_0x8314('0x0'));var md5=require('md5');var util=require(_0x8314('0x1'));var intUtil=require(_0x8314('0x2'));var moment=require(_0x8314('0x3'));var Redis=require(_0x8314('0x4'));var BPromise=require(_0x8314('0x5'));var config=require(_0x8314('0x6'));var logger=require('../../../../config/logger')(_0x8314('0x7'));config[_0x8314('0x8')]=_[_0x8314('0x9')](config[_0x8314('0x8')],{'host':_0x8314('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8314('0x8')]));function emit(_0x39dbec,_0x3d91a6,_0x4cc810){io['to'](_0x39dbec)[_0x8314('0xb')](_0x3d91a6,_0x4cc810);}function request(_0x2b03ce){logger['debug'](_0x8314('0xc'),JSON[_0x8314('0xd')](_0x2b03ce));return rp(_0x2b03ce);}function getCustomFields(_0x872f67,_0xc91c1b){var _0xf04be1={};if(_0x872f67[_0x8314('0xe')]>0x0){_[_0x8314('0xf')](_0x872f67,function(_0x511cd4){if(_[_0x8314('0x10')](['string',_0x8314('0x11')],_0x511cd4[_0x8314('0x12')])&&_0x511cd4[_0x8314('0x13')]){_0xf04be1[_0x511cd4[_0x8314('0x13')]]=_0x511cd4[_0x8314('0x14')][_0x8314('0x15')]();}else if(_0x511cd4[_0x8314('0x12')]==='variable'&&_0x511cd4['variableName']&&_0x511cd4[_0x8314('0x13')]&&_0xc91c1b[_0x511cd4[_0x8314('0x16')]]){_0xf04be1[_0x511cd4[_0x8314('0x13')]]=_0xc91c1b[_0x511cd4[_0x8314('0x16')]]['toString']();}else if(_0x511cd4[_0x8314('0x12')]==='customVariable'&&_0x511cd4[_0x8314('0x17')]&&_0x511cd4['Variable'][_0x8314('0x18')]&&_0x511cd4[_0x8314('0x13')]&&_0xc91c1b[_0x511cd4['Variable'][_0x8314('0x18')][_0x8314('0x19')]()]){_0xf04be1[_0x511cd4['idField']]=_0xc91c1b[_0x511cd4[_0x8314('0x17')]['name']['toLowerCase']()][_0x8314('0x15')]();}});}return _0xf04be1;}function getName(_0x38476e){if(_0x38476e['indexOf']('\x20')>0x0){var _0x2a9866=_0x38476e[_0x8314('0x1a')](/ (.+)/);if(_0x2a9866[0x1]){return _0x2a9866;}}return[_0x38476e,_0x38476e];}var accountsTokens={};function getAccessToken(_0x18edfd){return new Promise(function(_0x47bae9,_0x4454c0){if(!_[_0x8314('0x1b')](accountsTokens[_0x18edfd['id']])&&!_[_0x8314('0x1b')](accountsTokens[_0x18edfd['id']][_0x8314('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x18edfd['id']][_0x8314('0x1d')])){_0x47bae9(accountsTokens[_0x18edfd['id']][_0x8314('0x1c')]);}}var _0x5627e1;switch(_0x18edfd[_0x8314('0x1e')]){case'US':_0x5627e1=_0x8314('0x1f');break;case'AU':_0x5627e1=_0x8314('0x20');break;case'EU':_0x5627e1='https://accounts.zoho.eu';break;case'IN':_0x5627e1=_0x8314('0x21');break;case'CN':_0x5627e1=_0x8314('0x22');break;default:_0x5627e1=_0x8314('0x23');break;}var _0x5af7d6={'method':_0x8314('0x24'),'uri':_0x5627e1+_0x8314('0x25'),'qs':{'refresh_token':_0x18edfd[_0x8314('0x26')],'client_id':_0x18edfd[_0x8314('0x27')],'client_secret':_0x18edfd[_0x8314('0x28')],'grant_type':_0x8314('0x29')},'json':!![]};return rp(_0x5af7d6)[_0x8314('0x2a')](function(_0xbb6007){accountsTokens[_0x18edfd['id']]={'access_token':_0xbb6007['access_token'],'expires_in':moment()[_0x8314('0x2b')](_0xbb6007[_0x8314('0x1d')],_0x8314('0x2c'))};_0x47bae9(_0xbb6007[_0x8314('0x1c')]);})['catch'](function(_0x1febdb){logger['error'](_0x8314('0x2d'),_0x1febdb[_0x8314('0x2e')]);_0x4454c0(_0x1febdb);});});}function getUser(_0x4b5b8c,_0x8dac12,_0x25fc68,_0x4e9632){logger['info'](_0x8314('0x2f'));return request({'method':'GET','uri':util[_0x8314('0x30')](_0x8314('0x31'),_0x8dac12),'qs':{'type':_0x8314('0x32')},'headers':{'Authorization':_0x8314('0x33')+_0x4b5b8c},'json':!![]})[_0x8314('0x2a')](function(_0xf5d6fd){if(_0xf5d6fd[_0x8314('0x34')]){var _0x3bd4c3=-0x1;if(_[_0x8314('0x35')](_0xf5d6fd[_0x8314('0x34')])){if(!_[_0x8314('0x1b')](_0x4e9632)){_0x3bd4c3=_[_0x8314('0x36')](_0xf5d6fd[_0x8314('0x34')],function(_0x47425c){return _0x47425c[_0x8314('0x37')]===_0x4e9632;});}if(_0x3bd4c3>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0x8314('0x38'));_0x3bd4c3=_[_0x8314('0x36')](_0xf5d6fd[_0x8314('0x34')],function(_0x480def){return _0x480def['profile']['name']==='Administrator';});}return _0xf5d6fd['users'][_0x3bd4c3];}else{if(_0xf5d6fd[_0x8314('0x39')][_0x8314('0x3a')][_0x8314('0x18')]==='Administrator'){logger[_0x8314('0x3b')](_0x8314('0x38'));user=_0xf5d6fd[_0x8314('0x39')];return user;}else{logger['error'](_0x8314('0x3c'),JSON['stringify'](_0xf5d6fd));throw new Error(_0x8314('0x3d')+JSON['stringify'](_0xf5d6fd));}}}else{logger[_0x8314('0x3e')](_0x8314('0x3c'),JSON[_0x8314('0xd')](_0xf5d6fd));throw new Error(_0x8314('0x3d')+JSON[_0x8314('0xd')](_0xf5d6fd));}})['catch'](function(_0xd83a42){console['error'](_0xd83a42);});}function getZohoUser(_0x4f7a35,_0x1369b0){return new BPromise(function(_0x366e3b,_0x52a7e2){request(_0x4f7a35)['then'](function(_0x3df5cf){var _0xfc8d1d=null;if(_0x3df5cf){_0xfc8d1d=_0x3df5cf[_0x8314('0x3f')][0x0];_0xfc8d1d[_0x8314('0x40')]=_0x1369b0;}_0x366e3b(_0xfc8d1d);})['catch'](function(_0x416cbe){_0x52a7e2(_0x416cbe);});});}function createEndUser(_0x46a0f0,_0x18a270,_0x516866,_0x103efb,_0x25cc38,_0x34ce5f){var _0x516866=getName(_0x516866);return request({'method':_0x8314('0x24'),'uri':_0x8314('0x41')+_0x18a270+_0x8314('0x42')+_[_0x8314('0x43')](_0x34ce5f[_0x8314('0x44')])+'s','body':{'data':[{'Last_Name':_0x516866[0x1],'First_Name':_0x516866[0x0],'Phone':_0x103efb,'Owner':{'name':!_['isNil'](_0x25cc38[_0x8314('0x45')][_0x8314('0x18')])?_0x25cc38[_0x8314('0x45')][_0x8314('0x18')]:!_[_0x8314('0x1b')](_0x25cc38[_0x8314('0x46')])?_0x25cc38[_0x8314('0x46')]+'\x20'+_0x25cc38[_0x8314('0x47')]:_0x25cc38[_0x8314('0x47')],'id':_0x25cc38['id']}}]},'headers':{'Authorization':_0x8314('0x33')+_0x46a0f0},'json':!![]})[_0x8314('0x2a')](function(_0xe3e641){if(_0xe3e641&&_0xe3e641[_0x8314('0x3f')][0x0]['code']==='SUCCESS'){var _0x5f0c43=_0xe3e641[_0x8314('0x3f')][0x0][_0x8314('0x48')];_0x5f0c43[_0x8314('0x40')]=_['startCase'](_0x34ce5f[_0x8314('0x44')])+'s';return _0x5f0c43;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x8314('0xd')](data));throw new Error(_0x8314('0x49')+JSON[_0x8314('0xd')](data));})[_0x8314('0x4a')](function(_0x320650){console['log']('CREATE\x20ERROR',_0x320650);});}function getEndUser(_0xafbbdf,_0x1a9de8,_0x17b959,_0x417d3e,_0x4c13d1,_0x4e7ee4,_0x5be3e9){var _0x45ed19={'method':_0x8314('0x4b'),'uri':'','headers':{'Authorization':_0x8314('0x33')+_0xafbbdf},'json':!![]};switch(_0x5be3e9[_0x8314('0x4c')]){case'contact_lead':_0x45ed19[_0x8314('0x4d')]=_0x8314('0x41')+_0x1a9de8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4c13d1+'))';return getZohoUser(_0x45ed19,_0x8314('0x4e'))[_0x8314('0x2a')](function(_0x33e643){if(_0x33e643)return _0x33e643;_0x45ed19[_0x8314('0x4d')]=_0x8314('0x41')+_0x1a9de8+_0x8314('0x4f')+_0x4c13d1+'))';return getZohoUser(_0x45ed19,'Leads')['then'](function(_0x5399c7){if(_0x5399c7)return _0x5399c7;if(_0x5be3e9[_0x8314('0x44')]!=_0x8314('0x50')){return createEndUser(_0xafbbdf,_0x1a9de8,_0x417d3e,_0x4c13d1,_0x4e7ee4,_0x5be3e9);}else{return{};}});});break;case _0x8314('0x51'):_0x45ed19[_0x8314('0x4d')]=_0x8314('0x41')+_0x1a9de8+_0x8314('0x52')+_0x4c13d1+'))';return getZohoUser(_0x45ed19,'Contacts')['then'](function(_0x570353){if(_0x570353)return _0x570353;if(_0x5be3e9[_0x8314('0x44')]!=_0x8314('0x50')){return createEndUser(_0xafbbdf,_0x1a9de8,_0x417d3e,_0x4c13d1,_0x4e7ee4,_0x5be3e9);}else{return{};}});break;case _0x8314('0x53'):_0x45ed19[_0x8314('0x4d')]=_0x8314('0x41')+_0x1a9de8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4c13d1+'))';return getZohoUser(_0x45ed19,_0x8314('0x54'))[_0x8314('0x2a')](function(_0x448c7b){if(_0x448c7b)return _0x448c7b;if(_0x5be3e9[_0x8314('0x44')]!='nothing'){return createEndUser(_0xafbbdf,_0x1a9de8,_0x417d3e,_0x4c13d1,_0x4e7ee4,_0x5be3e9);}else{return{};}});break;}}function getCall(_0x49433f,_0x1e79cf,_0x4bf05a,_0x55be5b,_0x4ce6de,_0x5eb77b,_0x206a41,_0x12eef4){logger['info'](_0x8314('0x55'));var _0x238753={};_0x238753['Owner']={'name':!_[_0x8314('0x1b')](_0x55be5b['role'][_0x8314('0x18')])&&!_[_0x8314('0x1b')](_0x55be5b[_0x8314('0x3a')][_0x8314('0x18')])&&_0x55be5b[_0x8314('0x3a')][_0x8314('0x18')]===_0x8314('0x56')?_0x55be5b[_0x8314('0x45')]['name']:!_[_0x8314('0x1b')](_0x55be5b[_0x8314('0x46')])?_0x55be5b[_0x8314('0x46')]+'\x20'+_0x55be5b[_0x8314('0x47')]:_0x55be5b[_0x8314('0x47')],'id':_0x55be5b['id']};_0x238753[_0x8314('0x57')]=intUtil[_0x8314('0x58')](_0x5eb77b['Subjects'],_0x206a41,'\x20');_0x238753['Description']=intUtil[_0x8314('0x58')](_0x5eb77b[_0x8314('0x59')],_0x206a41,'\x0a');if(_0x4ce6de[_0x8314('0x40')]===_0x8314('0x4e')){_0x238753[_0x8314('0x5a')]={'name':!_[_0x8314('0x1b')](_0x4ce6de[_0x8314('0x5b')])?_0x4ce6de[_0x8314('0x5b')]:!_[_0x8314('0x1b')](_0x4ce6de[_0x8314('0x5c')])?_0x4ce6de['First_Name']+'\x20'+_0x4ce6de['Last_Name']:_0x4ce6de[_0x8314('0x5d')],'id':_0x4ce6de['id']};}if(_0x4ce6de[_0x8314('0x40')]==='Leads'){_0x238753[_0x8314('0x5e')]={'name':!_['isNil'](_0x4ce6de[_0x8314('0x5b')])?_0x4ce6de['Full_Name']:!_[_0x8314('0x1b')](_0x4ce6de[_0x8314('0x5c')])?_0x4ce6de[_0x8314('0x5c')]+'\x20'+_0x4ce6de['Last_Name']:_0x4ce6de['Last_Name'],'id':_0x4ce6de['id']};_0x238753[_0x8314('0x5f')]=_[_0x8314('0x43')](_0x4ce6de[_0x8314('0x40')]);}if(_0x206a41[_0x8314('0x60')]){_0x238753[_0x8314('0x61')]=moment[_0x8314('0x62')](parseInt(_0x206a41['talktime'])*0x3e8)[_0x8314('0x30')]('mm:ss');}else if(_0x206a41[_0x8314('0x63')]&&_0x206a41[_0x8314('0x64')]){_0x238753[_0x8314('0x61')]=moment[_0x8314('0x62')](moment(_0x206a41['endtime'],_0x8314('0x65'))[_0x8314('0x66')](moment(_0x206a41['starttime'],_0x8314('0x65'))))['format'](_0x8314('0x67'));}switch(_0x206a41[_0x8314('0x68')]){case _0x8314('0x69'):_0x238753[_0x8314('0x6a')]=_0x8314('0x6b');break;case _0x8314('0x6c'):case _0x8314('0x6d'):_0x238753[_0x8314('0x6a')]=_0x8314('0x6e');break;case _0x8314('0x6f'):_0x238753[_0x8314('0x6a')]=_0x8314('0x70');break;case _0x8314('0x71'):_0x238753[_0x8314('0x6a')]=_0x8314('0x72');break;case _0x8314('0x73'):_0x238753[_0x8314('0x6a')]=_0x8314('0x74');default:}_0x238753[_0x8314('0x75')]=(_0x12eef4===_0x8314('0x76')?moment(_0x206a41['starttime'])['format'](_0x8314('0x65')):moment(_0x206a41[_0x8314('0x77')])[_0x8314('0x30')](_0x8314('0x65')))||moment()[_0x8314('0x30')](_0x8314('0x65'));_0x238753['Call_Type']=_0x12eef4||_0x8314('0x78');_0x238753=_[_0x8314('0x79')](_0x238753,getCustomFields(_0x5eb77b[_0x8314('0x7a')],_0x206a41));return request({'method':'POST','uri':_0x8314('0x41')+_0x1e79cf+_0x8314('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x49433f},'body':{'data':[_0x238753]},'json':!![]})[_0x8314('0x2a')](function(_0x565f26){if(_0x565f26&&_0x565f26[_0x8314('0x3f')][0x0][_0x8314('0x7c')]==='SUCCESS'){logger[_0x8314('0x3b')](_0x8314('0x7d'));return{'id':_0x565f26[_0x8314('0x3f')][0x0]['details']['id']};}})[_0x8314('0x4a')](function(_0x3558ac){logger[_0x8314('0x3b')]('err',_0x3558ac[_0x8314('0x2e')]);console[_0x8314('0x7e')](_0x8314('0x7f'),_0x3558ac);});}exports['queue']=function(_0x984d78,_0x3cde27,_0x4553f9,_0x52f8eb,_0x124088,_0x14ce2b){var _0x1a058b,_0x420eda,_0x2a1ff9;_0x14ce2b[_0x8314('0x80')]=intUtil[_0x8314('0x81')](_0x14ce2b['host']);_0x14ce2b['serverUrl']=intUtil[_0x8314('0x81')](_0x14ce2b[_0x8314('0x82')]);if(_0x124088&&_0x124088[_0x8314('0x83')]){logger[_0x8314('0x3b')](_0x8314('0x84'),_0x8314('0x85'));_0x3cde27[_0x8314('0x86')]=_0x14ce2b[_0x8314('0x82')]+_0x8314('0x87')+_0x3cde27['uniqueid']+_0x8314('0x88')+md5(_0x3cde27[_0x8314('0x89')]);}else{_0x3cde27[_0x8314('0x86')]='';}var _0x154d4d=_0x14ce2b[_0x8314('0x80')]===_0x8314('0x8a')?'eu':'com';return getAccessToken(_0x14ce2b)[_0x8314('0x2a')](function(_0x29001e){_0x2a1ff9=_0x29001e;return getUser(_0x2a1ff9,_0x154d4d,_0x14ce2b,_0x52f8eb[_0x8314('0x37')]);})[_0x8314('0x2a')](function(_0x4a8f03){_0x1a058b=_0x4a8f03;logger[_0x8314('0x3b')](_0x8314('0x8b'),_0x1a058b['id']);return getEndUser(_0x2a1ff9,_0x154d4d,_0x14ce2b,_0x3cde27['calleridname'],_0x3cde27['calleridnum'],_0x1a058b,_0x4553f9);})['then'](function(_0x45150c){_0x420eda=_0x45150c;return getCall(_0x2a1ff9,_0x154d4d,_0x14ce2b,_0x1a058b,_0x420eda,_0x4553f9,_0x3cde27,_0x8314('0x78'));})[_0x8314('0x2a')](function(_0x331161){if(_0x331161){logger['info']('The\x20Call\x20ID\x20is:',_0x331161['id']);logger['info'](_0x8314('0x84'),_0x8314('0x8c'));emit(util[_0x8314('0x30')](_0x8314('0x8d'),_0x52f8eb[_0x8314('0x18')]),_0x8314('0x8e'),{'uri':_0x8314('0x8f')+_0x14ce2b[_0x8314('0x80')]+'/crm/EntityInfo.do?module=Calls&id='+_0x331161['id']});}})['catch'](function(_0x2ba563){logger[_0x8314('0x3e')]('[QUEUE]',JSON[_0x8314('0xd')](_0x2ba563));});};exports['outbound']=function(_0x396479,_0x2ad1d1,_0x223a5e,_0x5eba69,_0x153a62,_0x28abf9,_0x363156){var _0x102416,_0xd13e44,_0x43ad73;_0x28abf9[_0x8314('0x80')]=intUtil[_0x8314('0x81')](_0x28abf9[_0x8314('0x80')]);_0x28abf9[_0x8314('0x82')]=intUtil[_0x8314('0x81')](_0x28abf9[_0x8314('0x82')]);if(_0x363156&&_0x363156[_0x8314('0x90')]&&_0x363156[_0x8314('0x90')]!==_0x8314('0x91')){logger['info'](_0x8314('0x92'),'Recording\x20is\x20enabled!');_0x2ad1d1[_0x8314('0x86')]=_0x28abf9['serverUrl']+_0x8314('0x87')+_0x2ad1d1[_0x8314('0x89')]+_0x8314('0x88')+md5(_0x2ad1d1[_0x8314('0x89')]);}var _0x25b120=_0x28abf9[_0x8314('0x80')]===_0x8314('0x8a')?'eu':_0x8314('0x93');return getAccessToken(_0x28abf9)[_0x8314('0x2a')](function(_0x198814){_0x43ad73=_0x198814;return getUser(_0x43ad73,_0x25b120,_0x28abf9,_0x5eba69[_0x8314('0x37')]);})[_0x8314('0x2a')](function(_0x24a32f){_0x102416=_0x24a32f;logger[_0x8314('0x3b')](_0x8314('0x8b'),_0x102416['id']);return getEndUser(_0x43ad73,_0x25b120,_0x28abf9,_0x2ad1d1[_0x8314('0x94')],_0x2ad1d1[_0x8314('0x95')],_0x102416,_0x223a5e);})[_0x8314('0x2a')](function(_0x2a31a6){_0xd13e44=_0x2a31a6;return getCall(_0x43ad73,_0x25b120,_0x28abf9,_0x102416,_0xd13e44,_0x223a5e,_0x2ad1d1,_0x8314('0x96'));})[_0x8314('0x2a')](function(_0x1526b){if(_0x1526b){logger['info']('The\x20Call\x20ID\x20is:',_0x1526b['id']);logger[_0x8314('0x3b')](_0x8314('0x92'),_0x8314('0x8c'));emit(util[_0x8314('0x30')](_0x8314('0x8d'),_0x5eba69[_0x8314('0x18')]),'trigger:browser:url',{'uri':_0x8314('0x8f')+_0x28abf9[_0x8314('0x80')]+_0x8314('0x97')+_0x1526b['id']});}})[_0x8314('0x4a')](function(_0x4e11ed){logger[_0x8314('0x3e')](_0x8314('0x92'),JSON[_0x8314('0xd')](_0x4e11ed));});};exports['unmanaged']=function(_0x3b822c,_0x26a091,_0x175132,_0x4d2a8f,_0x5a783b,_0x54ec50){var _0x15b0e3,_0x20cdd4,_0x45be91;_0x54ec50[_0x8314('0x80')]=intUtil[_0x8314('0x81')](_0x54ec50['host']);_0x54ec50[_0x8314('0x82')]=intUtil[_0x8314('0x81')](_0x54ec50[_0x8314('0x82')]);if(_0x5a783b&&_0x5a783b['monitor_format']){logger[_0x8314('0x3b')]('['+_0x26a091[_0x8314('0x68')]['toUpperCase']()+']',_0x8314('0x85'));_0x26a091[_0x8314('0x86')]=_0x54ec50['serverUrl']+'/api/voice/recordings/'+_0x26a091[_0x8314('0x89')]+_0x8314('0x88')+md5(_0x26a091[_0x8314('0x89')]);}else{_0x26a091[_0x8314('0x86')]='';}var _0x46c108=_0x54ec50[_0x8314('0x80')]===_0x8314('0x8a')?'eu':_0x8314('0x93');return getAccessToken(_0x54ec50)[_0x8314('0x2a')](function(_0x39ba46){_0x45be91=_0x39ba46;return getUser(_0x45be91,_0x46c108,_0x54ec50);})[_0x8314('0x2a')](function(_0x4013f1){_0x15b0e3=_0x4013f1;logger[_0x8314('0x3b')](_0x8314('0x8b'),_0x15b0e3['id']);return getEndUser(_0x45be91,_0x46c108,_0x54ec50,_0x26a091[_0x8314('0x98')],_0x26a091[_0x8314('0x99')],_0x15b0e3,_0x175132);})[_0x8314('0x2a')](function(_0x35f73b){_0x20cdd4=_0x35f73b;return getCall(_0x45be91,_0x46c108,_0x54ec50,_0x15b0e3,_0x20cdd4,_0x175132,_0x26a091,'Inbound');})[_0x8314('0x2a')](function(_0x318ccc){if(_0x318ccc){logger['info'](_0x8314('0x9a'),_0x318ccc['id']);}})['catch'](function(_0x20cc4e){logger['error']('['+_0x26a091[_0x8314('0x68')][_0x8314('0x9b')]()+']',JSON[_0x8314('0xd')](_0x20cc4e));});}; \ 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 6439f91..2e8fe92 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 _0xd0b1=['shelljs','mustache','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x77d25f,_0x55b7d9){var _0x15a0e0=function(_0x1c06e0){while(--_0x1c06e0){_0x77d25f['push'](_0x77d25f['shift']());}};_0x15a0e0(++_0x55b7d9);}(_0xd0b1,0x187));var _0x1d0b=function(_0x857a5a,_0x52d7eb){_0x857a5a=_0x857a5a-0x0;var _0x47ef10=_0xd0b1[_0x857a5a];return _0x47ef10;};'use strict';var util=require(_0x1d0b('0x0'));var sh=require(_0x1d0b('0x1'));var Mustache=require(_0x1d0b('0x2'));var logger=require('../../../../config/logger')(_0x1d0b('0x3'));exports[_0x1d0b('0x4')]=function(_0x1fa80b,_0x165ff5){var _0x5d36c6=_0x1fa80b[_0x1d0b('0x5')]?_0x1fa80b[_0x1d0b('0x5')]:_0x1d0b('0x6');var _0x2897b6=_0x1fa80b[_0x1d0b('0x7')]?Mustache[_0x1d0b('0x8')](_0x1fa80b['data3'],_0x165ff5):_0x165ff5;sh[_0x1d0b('0x4')](_0x2897b6,function(_0x1f1a1d,_0xf3921c,_0x54a4f1){if(_0x1f1a1d!==0x0){logger[_0x1d0b('0x9')](util[_0x1d0b('0xa')](_0x1d0b('0xb'),_0x5d36c6,_0x2897b6,_0x1f1a1d,_0x54a4f1));}else{logger[_0x1d0b('0xc')](util['format'](_0x1d0b('0xd'),_0x5d36c6,_0x2897b6,_0xf3921c));}});}; \ No newline at end of file +var _0x2e1f=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x2e1f,0x12d));var _0xf2e1=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x2e1f[_0x2a4095];return _0x52eeab;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0xf2e1('0x0'));var logger=require(_0xf2e1('0x1'))(_0xf2e1('0x2'));exports[_0xf2e1('0x3')]=function(_0x46670c,_0x54626b){var _0x1d26ca=_0x46670c[_0xf2e1('0x4')]?_0x46670c[_0xf2e1('0x4')]:_0xf2e1('0x5');var _0x475ce7=_0x46670c[_0xf2e1('0x6')]?Mustache['render'](_0x46670c[_0xf2e1('0x6')],_0x54626b):_0x54626b;sh['exec'](_0x475ce7,function(_0x3e8670,_0x164b26,_0xe42c78){if(_0x3e8670!==0x0){logger[_0xf2e1('0x7')](util[_0xf2e1('0x8')](_0xf2e1('0x9'),_0x1d26ca,_0x475ce7,_0x3e8670,_0xe42c78));}else{logger[_0xf2e1('0xa')](util[_0xf2e1('0x8')](_0xf2e1('0xb'),_0x1d26ca,_0x475ce7,_0x164b26));}});}; \ 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 e522e1d..d9b2bd6 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 _0xb02a=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','message','util','lodash','mustache','trigger','toUpperCase','render','data2','data5','number','headers','data6','stack','data1','GET','DELETE','PUT','data7','parse','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xb02a,0x170));var _0xab02=function(_0x4aebfc,_0x3b6e30){_0x4aebfc=_0x4aebfc-0x0;var _0x17e239=_0xb02a[_0x4aebfc];return _0x17e239;};'use strict';var rp=require('request-promise');var util=require(_0xab02('0x0'));var _=require(_0xab02('0x1'));var Mustache=require(_0xab02('0x2'));var logger=require('../../../../config/logger')(_0xab02('0x3'));exports['exec']=function(_0x349b02,_0x9a2870){var _0x585ad2,_0xd94798;var _0x57eb27={'method':_0x349b02['data1'][_0xab02('0x4')](),'uri':Mustache[_0xab02('0x5')](_0x349b02[_0xab02('0x6')],_0x9a2870),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x349b02[_0xab02('0x7')])===_0xab02('0x8')&&parseInt(_0x349b02[_0xab02('0x7')])>=0x1&&parseInt(_0x349b02[_0xab02('0x7')])<=0xa?parseInt(_0x349b02[_0xab02('0x7')])*0x3e8:0x5*0x3e8};try{_0x57eb27[_0xab02('0x9')]=_0x349b02[_0xab02('0xa')]?JSON['parse'](Mustache[_0xab02('0x5')](_0x349b02['data6'],_0x9a2870)):{};}catch(_0x49d435){logger['error'](_0x49d435[_0xab02('0xb')]);}switch(_0x349b02[_0xab02('0xc')][_0xab02('0x4')]()){case _0xab02('0xd'):case _0xab02('0xe'):_0x585ad2=null;_0x57eb27['qs']=_0x9a2870;break;case'POST':case _0xab02('0xf'):if(_0x349b02[_0xab02('0x10')]){try{_0x585ad2=JSON[_0xab02('0x11')](Mustache[_0xab02('0x5')](_0x349b02[_0xab02('0x10')],_0x9a2870));_0x57eb27[_0xab02('0x12')]=_0x585ad2;}catch(_0x14b3e7){logger[_0xab02('0x13')](_0x14b3e7[_0xab02('0xb')]);logger[_0xab02('0x13')](_0xab02('0x14'));}}else{_0x585ad2=_0x9a2870;_0x57eb27[_0xab02('0x12')]=_0x585ad2;}break;}logger[_0xab02('0x15')](util[_0xab02('0x16')](_0xab02('0x17'),_0x349b02['data1'],_0x349b02[_0xab02('0x6')],JSON[_0xab02('0x18')](_0x57eb27)));rp(_0x57eb27)[_0xab02('0x19')](function(_0x55b9d8){_0x585ad2=!_[_0xab02('0x1a')](_0x585ad2)?_0xab02('0x1b')+_0x585ad2:'';_0xd94798=typeof _0x55b9d8[_0xab02('0x12')]===_0xab02('0x1c')?JSON[_0xab02('0x18')](_0x55b9d8['body']):_0x55b9d8[_0xab02('0x12')];logger[_0xab02('0x15')](util['format'](_0xab02('0x1d'),_0x349b02[_0xab02('0xc')],_0x349b02[_0xab02('0x6')],_0x55b9d8[_0xab02('0x1e')],_0xd94798));})[_0xab02('0x1f')](function(_0x1b721d){logger[_0xab02('0x13')](util[_0xab02('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x349b02[_0xab02('0xc')],_0x349b02[_0xab02('0x6')],_0x1b721d[_0xab02('0x1e')],_0x1b721d['name'],_0x1b721d[_0xab02('0x20')]));});}; \ No newline at end of file +var _0x003a=['request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5','number','headers','data6','parse','render','error','stack','GET','POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil',',\x20request\x20body:\x20','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name'];(function(_0x39cad6,_0x1edf41){var _0x5a82f2=function(_0x416563){while(--_0x416563){_0x39cad6['push'](_0x39cad6['shift']());}};_0x5a82f2(++_0x1edf41);}(_0x003a,0x1ef));var _0xa003=function(_0x2f2ffc,_0x4c7d19){_0x2f2ffc=_0x2f2ffc-0x0;var _0x318d44=_0x003a[_0x2f2ffc];return _0x318d44;};'use strict';var rp=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var _=require('lodash');var Mustache=require(_0xa003('0x2'));var logger=require(_0xa003('0x3'))(_0xa003('0x4'));exports[_0xa003('0x5')]=function(_0x72e8bc,_0x5f4054){var _0xa32103,_0x234b3e;var _0x285509={'method':_0x72e8bc[_0xa003('0x6')][_0xa003('0x7')](),'uri':Mustache['render'](_0x72e8bc['data2'],_0x5f4054),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x72e8bc[_0xa003('0x8')])===_0xa003('0x9')&&parseInt(_0x72e8bc[_0xa003('0x8')])>=0x1&&parseInt(_0x72e8bc[_0xa003('0x8')])<=0xa?parseInt(_0x72e8bc[_0xa003('0x8')])*0x3e8:0x5*0x3e8};try{_0x285509[_0xa003('0xa')]=_0x72e8bc[_0xa003('0xb')]?JSON[_0xa003('0xc')](Mustache[_0xa003('0xd')](_0x72e8bc[_0xa003('0xb')],_0x5f4054)):{};}catch(_0x2cf44c){logger[_0xa003('0xe')](_0x2cf44c[_0xa003('0xf')]);}switch(_0x72e8bc[_0xa003('0x6')][_0xa003('0x7')]()){case _0xa003('0x10'):case'DELETE':_0xa32103=null;_0x285509['qs']=_0x5f4054;break;case _0xa003('0x11'):case _0xa003('0x12'):if(_0x72e8bc[_0xa003('0x13')]){try{_0xa32103=JSON[_0xa003('0xc')](Mustache[_0xa003('0xd')](_0x72e8bc[_0xa003('0x13')],_0x5f4054));_0x285509[_0xa003('0x14')]=_0xa32103;}catch(_0x1192a0){logger[_0xa003('0xe')](_0x1192a0[_0xa003('0xf')]);logger[_0xa003('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xa32103=_0x5f4054;_0x285509[_0xa003('0x14')]=_0xa32103;}break;}logger[_0xa003('0x15')](util[_0xa003('0x16')](_0xa003('0x17'),_0x72e8bc[_0xa003('0x6')],_0x72e8bc[_0xa003('0x18')],JSON[_0xa003('0x19')](_0x285509)));rp(_0x285509)['then'](function(_0x5dbee2){_0xa32103=!_[_0xa003('0x1a')](_0xa32103)?_0xa003('0x1b')+_0xa32103:'';_0x234b3e=typeof _0x5dbee2[_0xa003('0x14')]===_0xa003('0x1c')?JSON[_0xa003('0x19')](_0x5dbee2['body']):_0x5dbee2[_0xa003('0x14')];logger['info'](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x72e8bc['data1'],_0x72e8bc[_0xa003('0x18')],_0x5dbee2['statusCode'],_0x234b3e));})[_0xa003('0x1d')](function(_0x2d5eec){logger['error'](util['format'](_0xa003('0x1e'),_0x72e8bc[_0xa003('0x6')],_0x72e8bc[_0xa003('0x18')],_0x2d5eec[_0xa003('0x1f')],_0x2d5eec[_0xa003('0x20')],_0x2d5eec['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c766e66..a13534a 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 _0xfabd=['catch','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x124441,_0x2e0a4e){var _0x2651de=function(_0x1cca1d){while(--_0x1cca1d){_0x124441['push'](_0x124441['shift']());}};_0x2651de(++_0x2e0a4e);}(_0xfabd,0x188));var _0xdfab=function(_0x51ff07,_0x712efc){_0x51ff07=_0x51ff07-0x0;var _0x413c4c=_0xfabd[_0x51ff07];return _0x413c4c;};'use strict';var jayson=require(_0xdfab('0x0'));var BPromise=require(_0xdfab('0x1'));var logger=require('../../config/logger')(_0xdfab('0x2'));var client=jayson[_0xdfab('0x3')][_0xdfab('0x4')]({'port':0x2329});client[_0xdfab('0x5')]=function(_0xd0e223,_0xebe898){return new BPromise(function(_0x4cb7f3,_0xaa9ab1){return client[_0xdfab('0x6')](_0xd0e223,_0xebe898)[_0xdfab('0x7')](function(_0x381a6e){logger[_0xdfab('0x8')](_0xdfab('0x9'),_0xdfab('0x2'),_0xd0e223,_0xebe898,_0x381a6e);if(_0x381a6e[_0xdfab('0xa')]){logger[_0xdfab('0xa')](_0xdfab('0x9'),'routing',_0xd0e223,_0x381a6e[_0xdfab('0xa')][_0xdfab('0xb')],_0xebe898);return _0xaa9ab1(_0x381a6e[_0xdfab('0xa')]['message']);}else{return _0x4cb7f3(_0x381a6e[_0xdfab('0xc')]);}})[_0xdfab('0xd')](function(_0x1933cd){logger[_0xdfab('0xa')](_0xdfab('0x9'),_0xdfab('0x2'),_0xd0e223,_0x1933cd,_0xebe898);return _0xaa9ab1(_0x1933cd);});});};module[_0xdfab('0xe')]=client; \ No newline at end of file +var _0xb6d1=['jayson/promise','bluebird','../../config/logger','client','http','request','then','debug','rpc','routing','error','message','result','catch'];(function(_0x1b2705,_0x87e381){var _0x12301f=function(_0xee3cbc){while(--_0xee3cbc){_0x1b2705['push'](_0x1b2705['shift']());}};_0x12301f(++_0x87e381);}(_0xb6d1,0x7e));var _0x1b6d=function(_0x197837,_0x439ae2){_0x197837=_0x197837-0x0;var _0x3eed5f=_0xb6d1[_0x197837];return _0x3eed5f;};'use strict';var jayson=require(_0x1b6d('0x0'));var BPromise=require(_0x1b6d('0x1'));var logger=require(_0x1b6d('0x2'))('routing');var client=jayson[_0x1b6d('0x3')][_0x1b6d('0x4')]({'port':0x2329});client['Request']=function(_0x157d57,_0x29e8d8){return new BPromise(function(_0x5dff2c,_0x183405){return client[_0x1b6d('0x5')](_0x157d57,_0x29e8d8)[_0x1b6d('0x6')](function(_0x4ffb37){logger[_0x1b6d('0x7')](_0x1b6d('0x8'),_0x1b6d('0x9'),_0x157d57,_0x29e8d8,_0x4ffb37);if(_0x4ffb37[_0x1b6d('0xa')]){logger[_0x1b6d('0xa')](_0x1b6d('0x8'),'routing',_0x157d57,_0x4ffb37['error']['message'],_0x29e8d8);return _0x183405(_0x4ffb37[_0x1b6d('0xa')][_0x1b6d('0xb')]);}else{return _0x5dff2c(_0x4ffb37[_0x1b6d('0xc')]);}})[_0x1b6d('0xd')](function(_0x23239f){logger[_0x1b6d('0xa')]('rpc','routing',_0x157d57,_0x23239f,_0x29e8d8);return _0x183405(_0x23239f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f12ecaa..d66a0bc 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 _0x94bc=['refresh','mailAccounts','listen','getSettings','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','getMailAccounts','initMailAccounts','then'];(function(_0x4df1f9,_0x318bc8){var _0x10be22=function(_0x221ac){while(--_0x221ac){_0x4df1f9['push'](_0x4df1f9['shift']());}};_0x10be22(++_0x318bc8);}(_0x94bc,0x155));var _0xc94b=function(_0x528404,_0x27a5ba){_0x528404=_0x528404-0x0;var _0xe59e6b=_0x94bc[_0x528404];return _0xe59e6b;};'use strict';var server=require(_0xc94b('0x0'));var Realtime=require(_0xc94b('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc94b('0x2'));var setting=require(_0xc94b('0x3'));var logger=require(_0xc94b('0x4'))(_0xc94b('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0xc94b('0x6')]())['then'](realtime[_0xc94b('0x7')]())[_0xc94b('0x8')](function(){email[_0xc94b('0x9')](realtime[_0xc94b('0xa')]);return realtime;});}function main(){return server[_0xc94b('0xb')](realtime,email)[_0xc94b('0x8')](function(){return initRealtime();})[_0xc94b('0x8')](function(){return setting[_0xc94b('0xc')]();})['then'](function(_0x193b32){return setInterval(initRealtime,_0x193b32['loginMailFrequency']*0x3e8);})['catch'](function(_0x1e6bb3){logger['error'](_0xc94b('0xd'),_0x1e6bb3);});}main(); \ No newline at end of file +var _0xe294=['loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','then','refresh','listen','getSettings'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xe294,0x1ca));var _0x4e29=function(_0x26b82d,_0x40b9f0){_0x26b82d=_0x26b82d-0x0;var _0x59374d=_0xe294[_0x26b82d];return _0x59374d;};'use strict';var server=require('./server');var Realtime=require(_0x4e29('0x0'));var EmailChannel=require(_0x4e29('0x1'));var mailAccount=require(_0x4e29('0x2'));var setting=require(_0x4e29('0x3'));var logger=require('../../config/logger')(_0x4e29('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x4e29('0x5')]()['then'](mailAccount['getMailAccounts']())[_0x4e29('0x6')](realtime['initMailAccounts']())[_0x4e29('0x6')](function(){email[_0x4e29('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x4e29('0x8')](realtime,email)[_0x4e29('0x6')](function(){return initRealtime();})[_0x4e29('0x6')](function(){return setting[_0x4e29('0x9')]();})[_0x4e29('0x6')](function(_0x70cf50){return setInterval(initRealtime,_0x70cf50[_0x4e29('0xa')]*0x3e8);})['catch'](function(_0x44b382){logger[_0x4e29('0xb')](_0x4e29('0xc'),_0x44b382);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0a4bc86..bf14347 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 _0x768d=['verified','catch','exports','lodash','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','lastName','from','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify'];(function(_0x455193,_0xc47006){var _0x5c1dd3=function(_0x58567b){while(--_0x58567b){_0x455193['push'](_0x455193['shift']());}};_0x5c1dd3(++_0xc47006);}(_0x768d,0x1b3));var _0xd768=function(_0x12a4a9,_0x5b65d0){_0x12a4a9=_0x12a4a9-0x0;var _0x5540f=_0x768d[_0x12a4a9];return _0x5540f;};'use strict';var _=require(_0xd768('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xd768('0x1'));var Redis=require(_0xd768('0x2'));var config=require('../../../config/environment');var logger=require(_0xd768('0x3'))(_0xd768('0x4'));config[_0xd768('0x5')]=_['defaults'](config[_0xd768('0x5')],{'host':_0xd768('0x6'),'port':0x18eb});var io=require(_0xd768('0x7'))(new Redis(config['redis']));var EmailImap=require(_0xd768('0x8'));var EmailSmtp=require(_0xd768('0x9'));var mailAccount=require(_0xd768('0xa'));var md5Accounts={};function EmailChannel(_0x34a302){logger[_0xd768('0xb')](_0xd768('0xc'));this[_0xd768('0xd')]=_0x34a302[_0xd768('0xd')];this['imapAccounts']={};this[_0xd768('0xe')]=new EmailSmtp();}EmailChannel[_0xd768('0xf')][_0xd768('0x10')]=function(_0x3f3ad5){var _0x515686=this[_0xd768('0xd')][_0x3f3ad5];var _0x5f5404={'id':_0x515686['id'],'name':_0x515686[_0xd768('0x11')],'key':_0x515686[_0xd768('0x12')],'active':_0x515686[_0xd768('0x13')],'Imap':{'status':_0x515686[_0xd768('0x14')][_0xd768('0x15')],'messageStatus':_0x515686['Imap'][_0xd768('0x16')],'total':_0x515686[_0xd768('0x14')][_0xd768('0x17')]}};if(_['isNil'](md5Accounts[_0x3f3ad5])){md5Accounts[_0x3f3ad5]={};}var _0x537d26=md5(JSON[_0xd768('0x18')](_0x5f5404));if(md5Accounts[_0x3f3ad5][_0xd768('0x1')]!==_0x537d26){md5Accounts[_0x3f3ad5][_0xd768('0x1')]=_0x537d26;io['emit'](_0xd768('0x19'),_0x5f5404);}};EmailChannel['prototype']['refresh']=function(_0x5b1f95){for(var _0x17d604 in _0x5b1f95){if(_0x5b1f95[_0xd768('0x1a')](_0x17d604)){if(_0x5b1f95[_0x17d604][_0xd768('0x14')]&&_0x5b1f95[_0x17d604][_0xd768('0x13')]){var _0x169b6a=_0x5b1f95[_0x17d604][_0xd768('0x14')];if(!_0x169b6a[_0xd768('0x1b')]&&_0x5b1f95[_0x17d604]['provider']!=='custom')_0x169b6a[_0xd768('0x1b')]=_0x5b1f95[_0x17d604][_0xd768('0x1c')];if(!this['imapAccounts'][_0xd768('0x1a')](_0x169b6a['id'])){this['imapAccounts'][_0x169b6a['id']]=new EmailImap(_0x169b6a,_0x5b1f95[_0x17d604]['email']);this[_0xd768('0x1d')][_0x169b6a['id']]['on'](_0xd768('0x1e'),this[_0xd768('0x1f')][_0xd768('0x20')](this,_0x17d604));this['imapAccounts'][_0x169b6a['id']]['on'](_0xd768('0x4'),this[_0xd768('0x21')][_0xd768('0x20')](this,_0x17d604));this['imapAccounts'][_0x169b6a['id']]['on'](_0xd768('0x22'),this[_0xd768('0x23')][_0xd768('0x20')](this,_0x17d604));this[_0xd768('0x1d')][_0x169b6a['id']]['on'](_0xd768('0x24'),this[_0xd768('0x25')][_0xd768('0x20')](this,_0x17d604));}}else{if(_[_0xd768('0x26')](this[_0xd768('0xd')][_0x17d604][_0xd768('0x14')])){this[_0xd768('0xd')][_0x17d604][_0xd768('0x14')]={};}this[_0xd768('0xd')][_0x17d604][_0xd768('0x14')][_0xd768('0x15')]=_0xd768('0x27');this[_0xd768('0xd')][_0x17d604][_0xd768('0x14')][_0xd768('0x16')]='';this[_0xd768('0x10')](_0x17d604);}}}};EmailChannel[_0xd768('0xf')][_0xd768('0x1f')]=function(_0x1731cc,_0xaf6fce){if(this['mailAccounts'][_0x1731cc]){this['mailAccounts'][_0x1731cc][_0xd768('0x14')][_0xd768('0x15')]=_0xd768('0x28');this[_0xd768('0xd')][_0x1731cc][_0xd768('0x14')]['messageStatus']=_0xaf6fce[_0xd768('0x11')];if(_0xaf6fce[_0xd768('0x29')]){this[_0xd768('0xd')][_0x1731cc][_0xd768('0x14')][_0xd768('0x17')]=_0xaf6fce['messages']['total'];}return this[_0xd768('0x10')](_0x1731cc);}};EmailChannel['prototype'][_0xd768('0x21')]=function(_0x26d217,_0x58bfe1){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x58bfe1['firstName'],_0x58bfe1[_0xd768('0x2a')],_0x58bfe1[_0xd768('0x2b')],_0x26d217);if(this['mailAccounts'][_0x26d217]){return mailAccount[_0xd768('0x2c')](_0x26d217,_0x58bfe1)['then'](function(_0x2577ad){if(_0x2577ad){logger[_0xd768('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x311538){logger[_0xd768('0x24')](_0xd768('0x2d'),JSON[_0xd768('0x18')](_0x311538));});}};EmailChannel[_0xd768('0xf')]['handleImapEnd']=function(_0x2d6437){if(this[_0xd768('0xd')][_0x2d6437]&&this['mailAccounts'][_0x2d6437][_0xd768('0x14')]){if(this[_0xd768('0x1d')][this[_0xd768('0xd')][_0x2d6437][_0xd768('0x14')]['id']]){delete this[_0xd768('0x1d')][this[_0xd768('0xd')][_0x2d6437][_0xd768('0x14')]['id']];}this[_0xd768('0xd')][_0x2d6437][_0xd768('0x14')][_0xd768('0x2e')]=moment();this[_0xd768('0x10')](_0x2d6437);}};EmailChannel[_0xd768('0xf')][_0xd768('0x25')]=function(_0x591305,_0xfc338b){if(this[_0xd768('0xd')][_0x591305]){this[_0xd768('0xd')][_0x591305]['Imap']['status']=_0xd768('0x24');this['mailAccounts'][_0x591305][_0xd768('0x14')][_0xd768('0x16')]=_0xfc338b;return this['emit'](_0x591305);}};EmailChannel[_0xd768('0xf')][_0xd768('0x2f')]=function(_0x4afeb3,_0x2549df){return this[_0xd768('0xe')]['send'](_0x4afeb3,_0x2549df);};EmailChannel[_0xd768('0xf')][_0xd768('0x30')]=function(_0x174460){var _0x40c508=this;if(this[_0xd768('0xd')][_0x174460['id']]){if(_['isNil'](this[_0xd768('0xd')][_0x174460['id']]['Smtp'])){this[_0xd768('0xd')][_0x174460['id']][_0xd768('0x31')]={};}this['mailAccounts'][_0x174460['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x9389f2,_0x1d48c3){return _0x40c508[_0xd768('0xe')][_0xd768('0x32')](_0x174460)['then'](function(_0xf31417){_0x40c508[_0xd768('0xd')][_0x174460['id']][_0xd768('0x31')]['status']=_0xd768('0x33');_0x40c508[_0xd768('0xd')][_0x174460['id']][_0xd768('0x31')][_0xd768('0x16')]='';_0x40c508[_0xd768('0x10')](_0x174460['id']);_0x9389f2(_0xf31417);})[_0xd768('0x34')](function(_0x384e00){_0x40c508[_0xd768('0xd')][_0x174460['id']][_0xd768('0x31')][_0xd768('0x15')]=_0xd768('0x24');_0x40c508['mailAccounts'][_0x174460['id']][_0xd768('0x31')][_0xd768('0x16')]=_0x384e00;_0x40c508['emit'](_0x174460['id']);_0x1d48c3(_0x384e00);});});}return this[_0xd768('0xe')][_0xd768('0x32')](_0x174460);};module[_0xd768('0x35')]=EmailChannel; \ No newline at end of file +var _0x55bf=['send','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','imapAccounts','box','handleImapBox','handleImapEmail','bind','error','handleImapError','status','connected','messages','lastName','from','notify','then','catch','handleImapEnd','lastSync','sendMail'];(function(_0xebe9d8,_0x238b74){var _0x461f35=function(_0x1ce3f3){while(--_0x1ce3f3){_0xebe9d8['push'](_0xebe9d8['shift']());}};_0x461f35(++_0x238b74);}(_0x55bf,0x17f));var _0xf55b=function(_0x24a818,_0x22a839){_0x24a818=_0x24a818-0x0;var _0x2adc96=_0x55bf[_0x24a818];return _0x2adc96;};'use strict';var _=require(_0xf55b('0x0'));var moment=require(_0xf55b('0x1'));var BPromise=require('bluebird');var md5=require(_0xf55b('0x2'));var Redis=require(_0xf55b('0x3'));var config=require(_0xf55b('0x4'));var logger=require(_0xf55b('0x5'))(_0xf55b('0x6'));config[_0xf55b('0x7')]=_['defaults'](config[_0xf55b('0x7')],{'host':_0xf55b('0x8'),'port':0x18eb});var io=require(_0xf55b('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xf55b('0xa'));var EmailSmtp=require(_0xf55b('0xb'));var mailAccount=require(_0xf55b('0xc'));var md5Accounts={};function EmailChannel(_0x26cf10){logger[_0xf55b('0xd')]('start\x20email\x20channel');this[_0xf55b('0xe')]=_0x26cf10[_0xf55b('0xe')];this['imapAccounts']={};this[_0xf55b('0xf')]=new EmailSmtp();}EmailChannel[_0xf55b('0x10')][_0xf55b('0x11')]=function(_0x5499ed){var _0x2a7200=this[_0xf55b('0xe')][_0x5499ed];var _0x56da7a={'id':_0x2a7200['id'],'name':_0x2a7200[_0xf55b('0x12')],'key':_0x2a7200[_0xf55b('0x13')],'active':_0x2a7200['active'],'Imap':{'status':_0x2a7200[_0xf55b('0x14')]['status'],'messageStatus':_0x2a7200['Imap'][_0xf55b('0x15')],'total':_0x2a7200[_0xf55b('0x14')][_0xf55b('0x16')]}};if(_[_0xf55b('0x17')](md5Accounts[_0x5499ed])){md5Accounts[_0x5499ed]={};}var _0x582255=md5(JSON[_0xf55b('0x18')](_0x56da7a));if(md5Accounts[_0x5499ed][_0xf55b('0x2')]!==_0x582255){md5Accounts[_0x5499ed][_0xf55b('0x2')]=_0x582255;io['emit'](_0xf55b('0x19'),_0x56da7a);}};EmailChannel['prototype'][_0xf55b('0x1a')]=function(_0x4401b6){for(var _0x26ed34 in _0x4401b6){if(_0x4401b6[_0xf55b('0x1b')](_0x26ed34)){if(_0x4401b6[_0x26ed34][_0xf55b('0x14')]&&_0x4401b6[_0x26ed34]['active']){var _0x89939a=_0x4401b6[_0x26ed34]['Imap'];if(!_0x89939a[_0xf55b('0x1c')]&&_0x4401b6[_0x26ed34]['provider']!==_0xf55b('0x1d'))_0x89939a[_0xf55b('0x1c')]=_0x4401b6[_0x26ed34][_0xf55b('0x1e')];if(!this[_0xf55b('0x1f')][_0xf55b('0x1b')](_0x89939a['id'])){this[_0xf55b('0x1f')][_0x89939a['id']]=new EmailImap(_0x89939a,_0x4401b6[_0x26ed34]['email']);this['imapAccounts'][_0x89939a['id']]['on'](_0xf55b('0x20'),this[_0xf55b('0x21')]['bind'](this,_0x26ed34));this['imapAccounts'][_0x89939a['id']]['on'](_0xf55b('0x6'),this[_0xf55b('0x22')][_0xf55b('0x23')](this,_0x26ed34));this['imapAccounts'][_0x89939a['id']]['on']('end',this['handleImapEnd']['bind'](this,_0x26ed34));this[_0xf55b('0x1f')][_0x89939a['id']]['on'](_0xf55b('0x24'),this[_0xf55b('0x25')]['bind'](this,_0x26ed34));}}else{if(_[_0xf55b('0x17')](this[_0xf55b('0xe')][_0x26ed34][_0xf55b('0x14')])){this[_0xf55b('0xe')][_0x26ed34][_0xf55b('0x14')]={};}this[_0xf55b('0xe')][_0x26ed34][_0xf55b('0x14')][_0xf55b('0x26')]='disabled';this[_0xf55b('0xe')][_0x26ed34][_0xf55b('0x14')]['messageStatus']='';this[_0xf55b('0x11')](_0x26ed34);}}}};EmailChannel[_0xf55b('0x10')]['handleImapBox']=function(_0x329d8e,_0x4353d9){if(this['mailAccounts'][_0x329d8e]){this[_0xf55b('0xe')][_0x329d8e][_0xf55b('0x14')]['status']=_0xf55b('0x27');this['mailAccounts'][_0x329d8e][_0xf55b('0x14')]['messageStatus']=_0x4353d9[_0xf55b('0x12')];if(_0x4353d9[_0xf55b('0x28')]){this[_0xf55b('0xe')][_0x329d8e][_0xf55b('0x14')][_0xf55b('0x16')]=_0x4353d9['messages'][_0xf55b('0x16')];}return this[_0xf55b('0x11')](_0x329d8e);}};EmailChannel[_0xf55b('0x10')]['handleImapEmail']=function(_0x4913d1,_0x2ab6f8){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2ab6f8['firstName'],_0x2ab6f8[_0xf55b('0x29')],_0x2ab6f8[_0xf55b('0x2a')],_0x4913d1);if(this[_0xf55b('0xe')][_0x4913d1]){return mailAccount[_0xf55b('0x2b')](_0x4913d1,_0x2ab6f8)[_0xf55b('0x2c')](function(_0x109fb0){if(_0x109fb0){logger[_0xf55b('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0xf55b('0x2d')](function(_0x404266){logger[_0xf55b('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xf55b('0x18')](_0x404266));});}};EmailChannel[_0xf55b('0x10')][_0xf55b('0x2e')]=function(_0xa29fce){if(this[_0xf55b('0xe')][_0xa29fce]&&this['mailAccounts'][_0xa29fce][_0xf55b('0x14')]){if(this[_0xf55b('0x1f')][this[_0xf55b('0xe')][_0xa29fce]['Imap']['id']]){delete this['imapAccounts'][this[_0xf55b('0xe')][_0xa29fce][_0xf55b('0x14')]['id']];}this[_0xf55b('0xe')][_0xa29fce]['Imap'][_0xf55b('0x2f')]=moment();this[_0xf55b('0x11')](_0xa29fce);}};EmailChannel[_0xf55b('0x10')][_0xf55b('0x25')]=function(_0x1a13c3,_0xb3f2ba){if(this['mailAccounts'][_0x1a13c3]){this[_0xf55b('0xe')][_0x1a13c3][_0xf55b('0x14')][_0xf55b('0x26')]=_0xf55b('0x24');this[_0xf55b('0xe')][_0x1a13c3]['Imap'][_0xf55b('0x15')]=_0xb3f2ba;return this['emit'](_0x1a13c3);}};EmailChannel[_0xf55b('0x10')][_0xf55b('0x30')]=function(_0x2e30af,_0x1885fa){return this[_0xf55b('0xf')][_0xf55b('0x31')](_0x2e30af,_0x1885fa);};EmailChannel['prototype']['verifySmtp']=function(_0x53a41e){var _0x154a43=this;if(this['mailAccounts'][_0x53a41e['id']]){if(_[_0xf55b('0x17')](this[_0xf55b('0xe')][_0x53a41e['id']][_0xf55b('0x32')])){this[_0xf55b('0xe')][_0x53a41e['id']][_0xf55b('0x32')]={};}this[_0xf55b('0xe')][_0x53a41e['id']]['Smtp'][_0xf55b('0x2f')]=moment();return new BPromise(function(_0x57b666,_0x3c9588){return _0x154a43[_0xf55b('0xf')][_0xf55b('0x33')](_0x53a41e)[_0xf55b('0x2c')](function(_0xed7a4c){_0x154a43['mailAccounts'][_0x53a41e['id']]['Smtp']['status']=_0xf55b('0x34');_0x154a43[_0xf55b('0xe')][_0x53a41e['id']][_0xf55b('0x32')][_0xf55b('0x15')]='';_0x154a43['emit'](_0x53a41e['id']);_0x57b666(_0xed7a4c);})['catch'](function(_0x74248b){_0x154a43[_0xf55b('0xe')][_0x53a41e['id']][_0xf55b('0x32')]['status']=_0xf55b('0x24');_0x154a43['mailAccounts'][_0x53a41e['id']]['Smtp'][_0xf55b('0x15')]=_0x74248b;_0x154a43['emit'](_0x53a41e['id']);_0x3c9588(_0x74248b);});});}return this['smtp'][_0xf55b('0x33')](_0x53a41e);};module[_0xf55b('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f1b4a4c..0623ae1 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 _0x2b29=['error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','host','port','tls','autotls','required','mailbox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','once','handleReady','bind','end','handleEnd'];(function(_0x1fffb4,_0x4ff820){var _0x5e6336=function(_0x3c2787){while(--_0x3c2787){_0x1fffb4['push'](_0x1fffb4['shift']());}};_0x5e6336(++_0x4ff820);}(_0x2b29,0x163));var _0x92b2=function(_0x104475,_0x3c3dc5){_0x104475=_0x104475-0x0;var _0x3b987d=_0x2b29[_0x104475];return _0x3b987d;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var Imap=require(_0x92b2('0x1'));var simpleParser=require(_0x92b2('0x2'))[_0x92b2('0x3')];var Iconv=require('iconv')[_0x92b2('0x4')];var EventEmitter=require(_0x92b2('0x5'))[_0x92b2('0x6')];var utils=require(_0x92b2('0x7'));var logger=require(_0x92b2('0x8'))(_0x92b2('0x9'));function EmailImap(_0x47c522,_0xb1d856){this['mailbox']=_0x92b2('0xa');this[_0x92b2('0xb')]=this['getAccount'](_0x47c522,_0xb1d856);this[_0x92b2('0x1')]=new Imap(this[_0x92b2('0xb')]);this[_0x92b2('0x1')][_0x92b2('0xc')]('ready',this[_0x92b2('0xd')][_0x92b2('0xe')](this));this[_0x92b2('0x1')][_0x92b2('0xc')](_0x92b2('0xf'),this[_0x92b2('0x10')][_0x92b2('0xe')](this));this['imap']['on'](_0x92b2('0x11'),this[_0x92b2('0x12')][_0x92b2('0xe')](this));this['imap'][_0x92b2('0x13')]();}util[_0x92b2('0x14')](EmailImap,EventEmitter);EmailImap[_0x92b2('0x15')][_0x92b2('0x16')]=function(_0x12c2d1,_0x179834){var _0x52ef07={'connTimeout':_0x12c2d1[_0x92b2('0x17')]?_0x12c2d1['connTimeout']*0x3e8:0x2710,'authTimeout':_0x12c2d1[_0x92b2('0x18')]?_0x12c2d1[_0x92b2('0x18')]*0x3e8:0x1388};if(_0x12c2d1[_0x92b2('0x19')]){_0x52ef07['user']=_0x12c2d1['user'];_0x52ef07[_0x92b2('0x9')]=_0x179834||_0x12c2d1['user']||_0x92b2('0x1a');if(_0x12c2d1['modernAuthentication']){_0x52ef07[_0x92b2('0x1b')]=utils[_0x92b2('0x1c')](_0x12c2d1[_0x92b2('0x1d')][_0x92b2('0x1e')],_0x12c2d1[_0x92b2('0x1f')]);}else{_0x52ef07[_0x92b2('0x20')]=_0x12c2d1[_0x92b2('0x20')];}}else{if(_0x12c2d1[_0x92b2('0x21')]){_0x52ef07[_0x92b2('0x1f')]=_0x12c2d1[_0x92b2('0x1f')];_0x52ef07[_0x92b2('0x20')]=_0x12c2d1[_0x92b2('0x20')];}}_0x52ef07[_0x92b2('0x22')]=_0x12c2d1[_0x92b2('0x22')];_0x52ef07[_0x92b2('0x23')]=_0x12c2d1['port']||0x3e1;if(_0x12c2d1[_0x92b2('0x24')]){_0x52ef07['tls']=!![];}else{_0x52ef07[_0x92b2('0x24')]=![];_0x52ef07[_0x92b2('0x25')]=_0x92b2('0x26');}return _0x52ef07;};EmailImap[_0x92b2('0x15')][_0x92b2('0xd')]=function(){this['imap']['openBox'](this[_0x92b2('0x27')],![],this[_0x92b2('0x28')][_0x92b2('0xe')](this));};EmailImap[_0x92b2('0x15')][_0x92b2('0x28')]=function(_0x30a205,_0x15faf5){if(_0x30a205){this[_0x92b2('0x12')](_0x30a205,!![]);}else{this[_0x92b2('0x29')]('box',_0x15faf5);this[_0x92b2('0x2a')]();}};EmailImap['prototype'][_0x92b2('0x2b')]=function(_0x4a587f){if(_0x4a587f){this['handleError'](_0x4a587f,!![]);}else{this[_0x92b2('0x1')][_0x92b2('0xf')]();}};EmailImap[_0x92b2('0x15')]['readUnseen']=function(){this[_0x92b2('0x1')]['search']([_0x92b2('0x2c')],this[_0x92b2('0x2d')][_0x92b2('0xe')](this));};EmailImap[_0x92b2('0x15')][_0x92b2('0x2d')]=function(_0x7b6e4e,_0x3b676f){if(_0x7b6e4e){this['handleError'](_0x7b6e4e,!![]);}else{if(_0x3b676f['length']){try{var _0x5efa2b=this[_0x92b2('0x1')][_0x92b2('0x2e')](_0x3b676f,{'bodies':'','markSeen':!![]});_0x5efa2b['on'](_0x92b2('0x2f'),this['handleFetchMessage']['bind'](this));_0x5efa2b[_0x92b2('0xc')](_0x92b2('0x11'),this[_0x92b2('0x30')][_0x92b2('0xe')](this));_0x5efa2b[_0x92b2('0xc')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x22ea02){logger[_0x92b2('0x11')](_0x22ea02);}}else{this['imap'][_0x92b2('0x31')](!![],this[_0x92b2('0x2b')][_0x92b2('0xe')](this));}}};EmailImap[_0x92b2('0x15')][_0x92b2('0x32')]=function(_0x35ffdf){_0x35ffdf['on'](_0x92b2('0x33'),this[_0x92b2('0x34')]['bind'](this));_0x35ffdf[_0x92b2('0xc')](_0x92b2('0x35'),this[_0x92b2('0x36')]['bind'](this));_0x35ffdf[_0x92b2('0xc')]('end',this[_0x92b2('0x37')][_0x92b2('0xe')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x119d4c){simpleParser(_0x119d4c,{'Iconv':Iconv},this[_0x92b2('0x38')]['bind'](this));};EmailImap['prototype'][_0x92b2('0x36')]=function(){};EmailImap[_0x92b2('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x92b2('0x15')][_0x92b2('0x38')]=function(_0x3ebe1f,_0x4fc817){if(_0x3ebe1f){logger[_0x92b2('0x11')](_0x3ebe1f);}else{var _0x4c3f44=this;utils[_0x92b2('0x39')](this[_0x92b2('0xb')],_0x4fc817,function(_0x34d6bf){_0x4c3f44[_0x92b2('0x29')](_0x92b2('0x9'),_0x34d6bf);});}};EmailImap[_0x92b2('0x15')]['handleFetchEnd']=function(){this[_0x92b2('0x1')][_0x92b2('0x31')](!![],this['handleCloseBox'][_0x92b2('0xe')](this));};EmailImap[_0x92b2('0x15')][_0x92b2('0x30')]=function(_0xf5f958){this[_0x92b2('0x12')](_0xf5f958);this[_0x92b2('0x1')][_0x92b2('0x31')](!![],this['handleCloseBox'][_0x92b2('0xe')](this));};EmailImap['prototype'][_0x92b2('0x10')]=function(){this['emit'](_0x92b2('0xf'));};EmailImap[_0x92b2('0x15')][_0x92b2('0x12')]=function(_0x53a3f0,_0x3b9a4f){logger[_0x92b2('0x11')](_0x92b2('0x12'),this['account'][_0x92b2('0x9')],JSON[_0x92b2('0x3a')](_0x53a3f0));var _0x82fabe='';if(_0x53a3f0){if(_0x53a3f0[_0x92b2('0x3b')]){_0x82fabe=_0x53a3f0['textCode'];}else{for(var _0x59d09e in _0x53a3f0){if(_0x53a3f0['hasOwnProperty'](_0x59d09e)){_0x82fabe+=_[_0x92b2('0x3c')](_0x59d09e)+':\x20'+_0x53a3f0[_0x59d09e]+'\x0a';}}}}if(_0x3b9a4f){this[_0x92b2('0x1')][_0x92b2('0xf')]();}else{this['emit'](_0x92b2('0x11'),_0x82fabe);this['emit'](_0x92b2('0xf'));}};module[_0x92b2('0x3d')]=EmailImap; \ No newline at end of file +var _0x3024=['connTimeout','authTimeout','user','email','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','port','tls','required','openBox','mailbox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','mailparser','simpleParser','events','./utils','../../../config/logger','INBOX','account','getAccount','imap','once','handleReady','bind','end','handleEnd','error','handleError','connect','prototype'];(function(_0x4d5cce,_0x3082d7){var _0x5e2e77=function(_0xd79ddf){while(--_0xd79ddf){_0x4d5cce['push'](_0x4d5cce['shift']());}};_0x5e2e77(++_0x3082d7);}(_0x3024,0x64));var _0x4302=function(_0x1923ae,_0x336588){_0x1923ae=_0x1923ae-0x0;var _0x2723ad=_0x3024[_0x1923ae];return _0x2723ad;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var Imap=require('imap');var simpleParser=require(_0x4302('0x2'))[_0x4302('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x4302('0x4'))['EventEmitter'];var utils=require(_0x4302('0x5'));var logger=require(_0x4302('0x6'))('email');function EmailImap(_0x13d051,_0x5f20){this['mailbox']=_0x4302('0x7');this[_0x4302('0x8')]=this[_0x4302('0x9')](_0x13d051,_0x5f20);this[_0x4302('0xa')]=new Imap(this[_0x4302('0x8')]);this[_0x4302('0xa')][_0x4302('0xb')]('ready',this[_0x4302('0xc')][_0x4302('0xd')](this));this[_0x4302('0xa')]['once'](_0x4302('0xe'),this[_0x4302('0xf')]['bind'](this));this[_0x4302('0xa')]['on'](_0x4302('0x10'),this[_0x4302('0x11')]['bind'](this));this[_0x4302('0xa')][_0x4302('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x4302('0x13')][_0x4302('0x9')]=function(_0x2b9821,_0x5b19ca){var _0x1b254c={'connTimeout':_0x2b9821[_0x4302('0x14')]?_0x2b9821['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2b9821[_0x4302('0x15')]?_0x2b9821[_0x4302('0x15')]*0x3e8:0x1388};if(_0x2b9821['service']){_0x1b254c[_0x4302('0x16')]=_0x2b9821[_0x4302('0x16')];_0x1b254c[_0x4302('0x17')]=_0x5b19ca||_0x2b9821[_0x4302('0x16')]||_0x4302('0x18');if(_0x2b9821[_0x4302('0x19')]){_0x1b254c[_0x4302('0x1a')]=utils[_0x4302('0x1b')](_0x2b9821[_0x4302('0x1c')][_0x4302('0x1d')],_0x2b9821[_0x4302('0x16')]);}else{_0x1b254c[_0x4302('0x1e')]=_0x2b9821[_0x4302('0x1e')];}}else{if(_0x2b9821[_0x4302('0x1f')]){_0x1b254c['user']=_0x2b9821[_0x4302('0x16')];_0x1b254c['password']=_0x2b9821[_0x4302('0x1e')];}}_0x1b254c['host']=_0x2b9821['host'];_0x1b254c[_0x4302('0x20')]=_0x2b9821[_0x4302('0x20')]||0x3e1;if(_0x2b9821[_0x4302('0x21')]){_0x1b254c[_0x4302('0x21')]=!![];}else{_0x1b254c['tls']=![];_0x1b254c['autotls']=_0x4302('0x22');}return _0x1b254c;};EmailImap[_0x4302('0x13')][_0x4302('0xc')]=function(){this['imap'][_0x4302('0x23')](this[_0x4302('0x24')],![],this[_0x4302('0x25')][_0x4302('0xd')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x481a9d,_0x5a2952){if(_0x481a9d){this[_0x4302('0x11')](_0x481a9d,!![]);}else{this[_0x4302('0x26')]('box',_0x5a2952);this[_0x4302('0x27')]();}};EmailImap[_0x4302('0x13')][_0x4302('0x28')]=function(_0x5407b3){if(_0x5407b3){this[_0x4302('0x11')](_0x5407b3,!![]);}else{this['imap']['end']();}};EmailImap['prototype'][_0x4302('0x27')]=function(){this['imap'][_0x4302('0x29')]([_0x4302('0x2a')],this['handleReadUnseen'][_0x4302('0xd')](this));};EmailImap['prototype'][_0x4302('0x2b')]=function(_0x42abf4,_0x35ae42){if(_0x42abf4){this[_0x4302('0x11')](_0x42abf4,!![]);}else{if(_0x35ae42[_0x4302('0x2c')]){try{var _0x45474f=this[_0x4302('0xa')][_0x4302('0x2d')](_0x35ae42,{'bodies':'','markSeen':!![]});_0x45474f['on'](_0x4302('0x2e'),this['handleFetchMessage'][_0x4302('0xd')](this));_0x45474f[_0x4302('0xb')](_0x4302('0x10'),this[_0x4302('0x2f')]['bind'](this));_0x45474f[_0x4302('0xb')](_0x4302('0xe'),this[_0x4302('0x30')][_0x4302('0xd')](this));}catch(_0x31fa2c){logger['error'](_0x31fa2c);}}else{this[_0x4302('0xa')][_0x4302('0x31')](!![],this[_0x4302('0x28')][_0x4302('0xd')](this));}}};EmailImap[_0x4302('0x13')][_0x4302('0x32')]=function(_0x42c99e){_0x42c99e['on'](_0x4302('0x33'),this[_0x4302('0x34')]['bind'](this));_0x42c99e[_0x4302('0xb')]('attributes',this[_0x4302('0x35')]['bind'](this));_0x42c99e['once'](_0x4302('0xe'),this[_0x4302('0x36')][_0x4302('0xd')](this));};EmailImap['prototype'][_0x4302('0x34')]=function(_0x21974c){simpleParser(_0x21974c,{'Iconv':Iconv},this[_0x4302('0x37')][_0x4302('0xd')](this));};EmailImap['prototype'][_0x4302('0x35')]=function(){};EmailImap['prototype'][_0x4302('0x36')]=function(){};EmailImap[_0x4302('0x13')][_0x4302('0x37')]=function(_0x31e786,_0xffd1ca){if(_0x31e786){logger['error'](_0x31e786);}else{var _0x4748d9=this;utils['parser'](this['account'],_0xffd1ca,function(_0x59d3de){_0x4748d9[_0x4302('0x26')](_0x4302('0x17'),_0x59d3de);});}};EmailImap[_0x4302('0x13')][_0x4302('0x30')]=function(){this[_0x4302('0xa')][_0x4302('0x31')](!![],this[_0x4302('0x28')][_0x4302('0xd')](this));};EmailImap[_0x4302('0x13')][_0x4302('0x2f')]=function(_0x4b8275){this['handleError'](_0x4b8275);this[_0x4302('0xa')][_0x4302('0x31')](!![],this[_0x4302('0x28')][_0x4302('0xd')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4302('0x26')](_0x4302('0xe'));};EmailImap[_0x4302('0x13')][_0x4302('0x11')]=function(_0x380b4d,_0x3469b0){logger['error'](_0x4302('0x11'),this['account'][_0x4302('0x17')],JSON[_0x4302('0x38')](_0x380b4d));var _0x30f0e7='';if(_0x380b4d){if(_0x380b4d[_0x4302('0x39')]){_0x30f0e7=_0x380b4d['textCode'];}else{for(var _0x368256 in _0x380b4d){if(_0x380b4d[_0x4302('0x3a')](_0x368256)){_0x30f0e7+=_[_0x4302('0x3b')](_0x368256)+':\x20'+_0x380b4d[_0x368256]+'\x0a';}}}}if(_0x3469b0){this[_0x4302('0xa')][_0x4302('0xe')]();}else{this['emit'](_0x4302('0x10'),_0x30f0e7);this[_0x4302('0x26')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index b53739f..cd69cfc 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 _0x989c=['createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x4a6417,_0x28ad5c){var _0x2d190d=function(_0x59f264){while(--_0x59f264){_0x4a6417['push'](_0x4a6417['shift']());}};_0x2d190d(++_0x28ad5c);}(_0x989c,0x19e));var _0xc989=function(_0xa100f9,_0x3308bd){_0xa100f9=_0xa100f9-0x0;var _0x564186=_0x989c[_0xa100f9];return _0x564186;};'use strict';var nodemailer=require(_0xc989('0x0'));var inlineBase64=require(_0xc989('0x1'));function EmailSmtp(){}EmailSmtp[_0xc989('0x2')][_0xc989('0x3')]=function(_0x55b884,_0x4c7422){return new Promise(function(_0x185640,_0x42e29f){var _0x245040=nodemailer[_0xc989('0x4')](_0x55b884);_0x245040['use'](_0xc989('0x5'),inlineBase64());_0x245040[_0xc989('0x6')](_0x4c7422,function(_0x20c743,_0x2bb68e){if(_0x20c743){_0x42e29f(_0x20c743[_0xc989('0x7')]());}else{_0x185640(_0x2bb68e);}});});};EmailSmtp[_0xc989('0x2')][_0xc989('0x8')]=function(_0x159dcd){return new Promise(function(_0x5eb053,_0x3bfa99){var _0x4f71ff=nodemailer[_0xc989('0x4')](_0x159dcd);_0x4f71ff['verify'](function(_0x50c348,_0x556144){if(_0x50c348){_0x3bfa99(_0x50c348[_0xc989('0x7')]());}else{if(_0x556144){_0x5eb053(_0x556144);}else{_0x3bfa99(_0xc989('0x9'));}}});});};module[_0xc989('0xa')]=EmailSmtp; \ No newline at end of file +var _0xc654=['verify','createTransport','exports','prototype','use','sendMail'];(function(_0xf0d5a1,_0x52f3dd){var _0x4bc219=function(_0x407d5d){while(--_0x407d5d){_0xf0d5a1['push'](_0xf0d5a1['shift']());}};_0x4bc219(++_0x52f3dd);}(_0xc654,0x7b));var _0x4c65=function(_0x8eb3ce,_0x130a49){_0x8eb3ce=_0x8eb3ce-0x0;var _0x44df65=_0xc654[_0x8eb3ce];return _0x44df65;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x4c65('0x0')]['send']=function(_0xc5296b,_0xd2897b){return new Promise(function(_0x49940a,_0xd8b349){var _0x5732f5=nodemailer['createTransport'](_0xc5296b);_0x5732f5[_0x4c65('0x1')]('compile',inlineBase64());_0x5732f5[_0x4c65('0x2')](_0xd2897b,function(_0x1af20d,_0x45f5f4){if(_0x1af20d){_0xd8b349(_0x1af20d['toString']());}else{_0x49940a(_0x45f5f4);}});});};EmailSmtp[_0x4c65('0x0')][_0x4c65('0x3')]=function(_0x2efa6e){return new Promise(function(_0x3cce1b,_0x2e68b8){var _0x43c348=nodemailer[_0x4c65('0x4')](_0x2efa6e);_0x43c348[_0x4c65('0x3')](function(_0x3e03f1,_0x965b57){if(_0x3e03f1){_0x2e68b8(_0x3e03f1['toString']());}else{if(_0x965b57){_0x3cce1b(_0x965b57);}else{_0x2e68b8('Not\x20verifired');}}});});};module[_0x4c65('0x5')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3143bcf..c017b61 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 _0x3864=['anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','head','value','pop','isEmpty','html','test','','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','util','email','address'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3864,0xd1));var _0x4386=function(_0xcf74f9,_0x1b6d45){_0xcf74f9=_0xcf74f9-0x0;var _0x51bcc9=_0x3864[_0xcf74f9];return _0x51bcc9;};'use strict';var _=require(_0x4386('0x0'));var moment=require(_0x4386('0x1'));var random=require(_0x4386('0x2'));var fs=require('fs');var path=require(_0x4386('0x3'));var util=require(_0x4386('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x4386('0x5'));var config=require('../../../config/environment');function getAddress(_0x520d8b){var _0x4c6d30=_['head'](_0x520d8b['value']);return _0x4c6d30&&_0x4c6d30[_0x4386('0x6')]?_0x4c6d30['address']:_0x4386('0x7')+random[_0x4386('0x8')](0x6)+_0x4386('0x9');}function getFirstName(_0x3350b2){var _0x20e285=_['head'](_0x3350b2['value']);if(_0x20e285&&_0x20e285[_0x4386('0xa')]){if(_0x20e285[_0x4386('0xa')]==_0x20e285[_0x4386('0x6')]){return _0x20e285[_0x4386('0xa')][_0x4386('0xb')](0x0,_0x20e285[_0x4386('0xa')][_0x4386('0xc')]('@'));}var _0x89b53b=_0x20e285[_0x4386('0xa')][_0x4386('0xd')](/\s+/);return _0x89b53b[_0x4386('0xe')]>0x1?_0x89b53b[_0x4386('0xf')](0x0,-0x1)[_0x4386('0x10')]('\x20'):_0x20e285[_0x4386('0xa')];}return _0x4386('0x11');}function getLastName(_0x3a7f11){var _0x2bd9f6=_[_0x4386('0x12')](_0x3a7f11[_0x4386('0x13')]);if(_0x2bd9f6&&_0x2bd9f6[_0x4386('0xa')]){var _0x3705c3=_0x2bd9f6['name']['split'](/\s+/);return _0x3705c3[_0x4386('0xe')]>0x1?_0x3705c3[_0x4386('0x14')]():'';}return'';}function getMails(_0x504865,_0x45c7b3){var _0xd5c388='';for(var _0x770fb6=0x0;_0x770fb6<_0x45c7b3[_0x4386('0x13')][_0x4386('0xe')];_0x770fb6+=0x1){if(_0x45c7b3[_0x4386('0x13')][_0x770fb6][_0x4386('0x6')]!==_0x504865){if(!_[_0x4386('0x15')](_0xd5c388)){_0xd5c388+=',';}_0xd5c388+=_0x45c7b3['value'][_0x770fb6]['name']||_0x45c7b3[_0x4386('0x13')][_0x770fb6][_0x4386('0x6')]||'';_0xd5c388+='\x20<';_0xd5c388+=_0x45c7b3[_0x4386('0x13')][_0x770fb6][_0x4386('0x6')]?_0x45c7b3['value'][_0x770fb6][_0x4386('0x6')]:_0x4386('0x7')+random['generate'](0x6)+_0x4386('0x9');_0xd5c388+='>';}}return _0xd5c388;}function parseEmail(_0x31490e,_0x4d4593,_0x2337db){if(_0x4d4593[_0x4386('0x16')]){var _0x2437a1=/)<[^<]*)*<\/script>/gi;while(_0x2437a1[_0x4386('0x17')](_0x4d4593['html'])){_0x4d4593['html']=_0x4d4593[_0x4386('0x16')]['replace'](_0x2437a1,'');}if(_0x4d4593[_0x4386('0x16')]['includes'](_0x4386('0x18'))){var _0x57d949=[];_0x4d4593[_0x4386('0x19')][_0x4386('0x1a')](_0x1fa7e0=>{_0x57d949[_0x4386('0x1b')](_0x1fa7e0[_0x4386('0x1c')]);});var _0x29c4de=/]+>/g;var _0x38702a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4d19e3=_0x4d4593[_0x4386('0x16')][_0x4386('0x1d')](_0x38702a,_0x4386('0x1e'));var _0x1cac04=_0x4d19e3[_0x4386('0x1d')](_0x29c4de,_0x4386('0x1f'));for(let _0x561206=0x0;_0x561206<_0x57d949['length'];_0x561206++){var _0x13b4db=_0x1cac04[_0x4386('0x1d')]('_IMG','\x20[Attachment:\x20'+_0x57d949[_0x561206]+_0x4386('0x20'));_0x1cac04=_0x13b4db;}_0x4d4593[_0x4386('0x16')]=_0x1cac04;}_0x2337db[_0x4386('0x21')]=_0x4d4593[_0x4386('0x16')];}else{_0x2337db[_0x4386('0x21')]=_0x4d4593[_0x4386('0x22')];}if(_0x2337db['body']){_0x2337db[_0x4386('0x21')]=_0x2337db['body'][_0x4386('0x1d')](/0x0){var _0x446249=[_0x4386('0x2e'),_0x4386('0x2f'),_0x4386('0x30')];for(var _0x2f38f0=0x0;_0x2f38f0<_0x4d4593['headerLines'][_0x4386('0xe')];_0x2f38f0++){var _0x154f91=_[_0x4386('0xc')](_0x446249,_0x4d4593[_0x4386('0x2d')][_0x2f38f0][_0x4386('0x31')]);if(_0x154f91>=0x0){_0x2337db[_0x4386('0x32')]=!![];}}}return _0x2337db;}exports['parser']=function(_0x5c734c,_0x20525a,_0xa44b71){var _0x1045ee={'from':getAddress(_0x20525a[_0x4386('0x33')]),'firstName':getFirstName(_0x20525a['from']),'lastName':getLastName(_0x20525a['from']),'mapKey':_0x4386('0x5'),'message':{'from':getMails(_0x5c734c[_0x4386('0x5')],_0x20525a[_0x4386('0x33')]),'to':_0x5c734c['email'],'cc':'','subject':_0x20525a[_0x4386('0x34')]||'','messageId':_0x20525a['messageId'],'inReplyTo':_0x20525a['inReplyTo'],'sentAt':moment(_0x20525a['date'])[_0x4386('0x35')](_0x4386('0x36')),'attach':![],'attachments':[]}};if(!_0x20525a[_0x4386('0x16')]&&!_0x20525a['textAsHtml']){var _0xa7a3c4=_[_0x4386('0x37')](_0x20525a[_0x4386('0x19')],{'contentType':_0x4386('0x38')});if(_0xa7a3c4[_0x4386('0xe')]){logger[_0x4386('0x39')](util[_0x4386('0x35')](_0x4386('0x3a'),_0x20525a[_0x4386('0x3b')]));tnef[_0x4386('0x3c')](_[_0x4386('0x3d')](_0xa7a3c4)['content'],function(_0x459bac,_0x41f873){if(_0x41f873){_0x20525a['html']=_0x41f873[_0x4386('0x3e')]||_0x4386('0x3f');if(_0x41f873[_0x4386('0x40')]){for(var _0x10fc82=0x0;_0x10fc82<_0x41f873['Attachments']['length'];_0x10fc82++){var _0x226ab6=_0x41f873['Attachments'][_0x10fc82];_0x1045ee[_0x4386('0x24')][_0x4386('0x19')]['push']({'filename':_0x226ab6[_0x4386('0x41')],'content':Buffer['from'](_0x226ab6[_0x4386('0x42')])});}}}_0xa44b71(parseEmail(_0x5c734c,_0x20525a,_0x1045ee));});}else{_0x20525a[_0x4386('0x16')]=_0x4386('0x3f');_0xa44b71(parseEmail(_0x5c734c,_0x20525a,_0x1045ee));}}else{_0xa44b71(parseEmail(_0x5c734c,_0x20525a,_0x1045ee));}};exports[_0x4386('0x43')]=function(_0x34649a,_0x32ed49){var _0x5cc689=[_0x4386('0x44')+(_0x32ed49||''),'auth=Bearer\x20'+_0x34649a,'',''];return Buffer[_0x4386('0x33')](_0x5cc689[_0x4386('0x10')](''),_0x4386('0x45'))[_0x4386('0x46')](_0x4386('0x47'));}; \ No newline at end of file +var _0xc16f=['length','slice','join','pop','isEmpty','anonymous','html','replace','attachments','forEach','push','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','includes','bcc','attach','type','attachment','filename','attachment-','now','root','server/files/attachments/','writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','indexOf','line','parser','from','subject','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','utf-8','toString','base64','lodash','moment','util','node-tnef','email','../../../config/environment','value','address','generate','@xcally.com','head','name','split'];(function(_0x38491c,_0x49283b){var _0x409969=function(_0x1d874a){while(--_0x1d874a){_0x38491c['push'](_0x38491c['shift']());}};_0x409969(++_0x49283b);}(_0xc16f,0x18b));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var moment=require(_0xfc16('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xfc16('0x2'));var tnef=require(_0xfc16('0x3'));var logger=require('../../../config/logger')(_0xfc16('0x4'));var config=require(_0xfc16('0x5'));function getAddress(_0x36c89c){var _0x2b8d7b=_['head'](_0x36c89c[_0xfc16('0x6')]);return _0x2b8d7b&&_0x2b8d7b[_0xfc16('0x7')]?_0x2b8d7b[_0xfc16('0x7')]:'anonymous'+random[_0xfc16('0x8')](0x6)+_0xfc16('0x9');}function getFirstName(_0x4d5b4d){var _0x41d92e=_[_0xfc16('0xa')](_0x4d5b4d[_0xfc16('0x6')]);if(_0x41d92e&&_0x41d92e[_0xfc16('0xb')]){if(_0x41d92e[_0xfc16('0xb')]==_0x41d92e['address']){return _0x41d92e['name']['substring'](0x0,_0x41d92e['name']['indexOf']('@'));}var _0x4d5bed=_0x41d92e['name'][_0xfc16('0xc')](/\s+/);return _0x4d5bed[_0xfc16('0xd')]>0x1?_0x4d5bed[_0xfc16('0xe')](0x0,-0x1)[_0xfc16('0xf')]('\x20'):_0x41d92e[_0xfc16('0xb')];}return'Anonymous';}function getLastName(_0x5a3773){var _0xf790da=_[_0xfc16('0xa')](_0x5a3773[_0xfc16('0x6')]);if(_0xf790da&&_0xf790da[_0xfc16('0xb')]){var _0x50b165=_0xf790da['name']['split'](/\s+/);return _0x50b165[_0xfc16('0xd')]>0x1?_0x50b165[_0xfc16('0x10')]():'';}return'';}function getMails(_0x25c4ab,_0x5747e7){var _0x58daf9='';for(var _0x460cd7=0x0;_0x460cd7<_0x5747e7[_0xfc16('0x6')][_0xfc16('0xd')];_0x460cd7+=0x1){if(_0x5747e7[_0xfc16('0x6')][_0x460cd7]['address']!==_0x25c4ab){if(!_[_0xfc16('0x11')](_0x58daf9)){_0x58daf9+=',';}_0x58daf9+=_0x5747e7['value'][_0x460cd7][_0xfc16('0xb')]||_0x5747e7['value'][_0x460cd7][_0xfc16('0x7')]||'';_0x58daf9+='\x20<';_0x58daf9+=_0x5747e7[_0xfc16('0x6')][_0x460cd7][_0xfc16('0x7')]?_0x5747e7[_0xfc16('0x6')][_0x460cd7][_0xfc16('0x7')]:_0xfc16('0x12')+random[_0xfc16('0x8')](0x6)+_0xfc16('0x9');_0x58daf9+='>';}}return _0x58daf9;}function parseEmail(_0x33ce3e,_0x11c781,_0x7c117d){if(_0x11c781[_0xfc16('0x13')]){var _0x51331b=/)<[^<]*)*<\/script>/gi;while(_0x51331b['test'](_0x11c781[_0xfc16('0x13')])){_0x11c781[_0xfc16('0x13')]=_0x11c781[_0xfc16('0x13')][_0xfc16('0x14')](_0x51331b,'');}if(_0x11c781[_0xfc16('0x13')]['includes']('{_0x2f88f7[_0xfc16('0x17')](_0x249e59['filename']);});var _0x1ede3d=/]+>/g;var _0x372de4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a022b=_0x11c781['html'][_0xfc16('0x14')](_0x372de4,'_SRC');var _0x3b4e5a=_0x5a022b['replace'](_0x1ede3d,_0xfc16('0x18'));for(let _0x5bd430=0x0;_0x5bd430<_0x2f88f7[_0xfc16('0xd')];_0x5bd430++){var _0x42f30a=_0x3b4e5a[_0xfc16('0x14')](_0xfc16('0x18'),_0xfc16('0x19')+_0x2f88f7[_0x5bd430]+_0xfc16('0x1a'));_0x3b4e5a=_0x42f30a;}_0x11c781[_0xfc16('0x13')]=_0x3b4e5a;}_0x7c117d['body']=_0x11c781[_0xfc16('0x13')];}else{_0x7c117d[_0xfc16('0x1b')]=_0x11c781[_0xfc16('0x1c')];}if(_0x7c117d['body']){_0x7c117d[_0xfc16('0x1b')]=_0x7c117d[_0xfc16('0x1b')]['replace'](/0x0){var _0x64fa1c=[_0xfc16('0x2d'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x1b4234=0x0;_0x1b4234<_0x11c781[_0xfc16('0x2c')]['length'];_0x1b4234++){var _0x2801d7=_[_0xfc16('0x2e')](_0x64fa1c,_0x11c781[_0xfc16('0x2c')][_0x1b4234][_0xfc16('0x2f')]);if(_0x2801d7>=0x0){_0x7c117d['isAutoreply']=!![];}}}return _0x7c117d;}exports[_0xfc16('0x30')]=function(_0xccc741,_0x148f85,_0x4544c3){var _0x53a9c6={'from':getAddress(_0x148f85[_0xfc16('0x31')]),'firstName':getFirstName(_0x148f85['from']),'lastName':getLastName(_0x148f85['from']),'mapKey':_0xfc16('0x4'),'message':{'from':getMails(_0xccc741[_0xfc16('0x4')],_0x148f85['from']),'to':_0xccc741[_0xfc16('0x4')],'cc':'','subject':_0x148f85[_0xfc16('0x32')]||'','messageId':_0x148f85['messageId'],'inReplyTo':_0x148f85['inReplyTo'],'sentAt':moment(_0x148f85[_0xfc16('0x33')])[_0xfc16('0x34')](_0xfc16('0x35')),'attach':![],'attachments':[]}};if(!_0x148f85[_0xfc16('0x13')]&&!_0x148f85[_0xfc16('0x1c')]){var _0x124768=_[_0xfc16('0x36')](_0x148f85[_0xfc16('0x15')],{'contentType':_0xfc16('0x37')});if(_0x124768[_0xfc16('0xd')]){logger['info'](util[_0xfc16('0x34')](_0xfc16('0x38'),_0x148f85['messageId']));tnef[_0xfc16('0x39')](_[_0xfc16('0x3a')](_0x124768)[_0xfc16('0x3b')],function(_0x4a6821,_0x3f2b38){if(_0x3f2b38){_0x148f85[_0xfc16('0x13')]=_0x3f2b38[_0xfc16('0x3c')]||_0xfc16('0x3d');if(_0x3f2b38['Attachments']){for(var _0x39bd16=0x0;_0x39bd16<_0x3f2b38['Attachments'][_0xfc16('0xd')];_0x39bd16++){var _0x118ddf=_0x3f2b38[_0xfc16('0x3e')][_0x39bd16];_0x53a9c6[_0xfc16('0x1d')]['attachments'][_0xfc16('0x17')]({'filename':_0x118ddf[_0xfc16('0x3f')],'content':Buffer[_0xfc16('0x31')](_0x118ddf['Data'])});}}}_0x4544c3(parseEmail(_0xccc741,_0x148f85,_0x53a9c6));});}else{_0x148f85[_0xfc16('0x13')]=_0xfc16('0x3d');_0x4544c3(parseEmail(_0xccc741,_0x148f85,_0x53a9c6));}}else{_0x4544c3(parseEmail(_0xccc741,_0x148f85,_0x53a9c6));}};exports[_0xfc16('0x40')]=function(_0x38ab8b,_0x55a41e){var _0x550ead=['user='+(_0x55a41e||''),'auth=Bearer\x20'+_0x38ab8b,'',''];return Buffer[_0xfc16('0x31')](_0x550ead[_0xfc16('0xf')](''),_0xfc16('0x41'))[_0xfc16('0x42')](_0xfc16('0x43'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a20864b..d7656d7 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 _0x082b=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0x148f22,_0xe93291){var _0x3bc1ef=function(_0x4c080f){while(--_0x4c080f){_0x148f22['push'](_0x148f22['shift']());}};_0x3bc1ef(++_0xe93291);}(_0x082b,0x1b2));var _0xb082=function(_0x5c7906,_0x236f64){_0x5c7906=_0x5c7906-0x0;var _0x1dee80=_0x082b[_0x5c7906];return _0x1dee80;};'use strict';var _=require('lodash');function MailAccount(_0x3002e5){this['id']=_0x3002e5['id']||0x0;this[_0xb082('0x0')]=_0x3002e5['name']||'Service';this['key']=_0x3002e5[_0xb082('0x1')]||_0xb082('0x2');this[_0xb082('0x3')]=_0x3002e5[_0xb082('0x3')]||![];this[_0xb082('0x4')]=_0x3002e5[_0xb082('0x4')]||[];this[_0xb082('0x5')]=_0x3002e5[_0xb082('0x5')]||[];}module[_0xb082('0x6')]=MailAccount; \ No newline at end of file +var _0xfeb7=['key','SERV','active','Imap','Smtp','lodash','name','Service'];(function(_0x59b7fc,_0x3f2f66){var _0x50a212=function(_0x595baa){while(--_0x595baa){_0x59b7fc['push'](_0x59b7fc['shift']());}};_0x50a212(++_0x3f2f66);}(_0xfeb7,0x18d));var _0x7feb=function(_0x30c8cb,_0x453d1b){_0x30c8cb=_0x30c8cb-0x0;var _0x462acf=_0xfeb7[_0x30c8cb];return _0x462acf;};'use strict';var _=require(_0x7feb('0x0'));function MailAccount(_0x1c03dc){this['id']=_0x1c03dc['id']||0x0;this['name']=_0x1c03dc[_0x7feb('0x1')]||_0x7feb('0x2');this[_0x7feb('0x3')]=_0x1c03dc[_0x7feb('0x3')]||_0x7feb('0x4');this[_0x7feb('0x5')]=_0x1c03dc[_0x7feb('0x5')]||![];this[_0x7feb('0x6')]=_0x1c03dc[_0x7feb('0x6')]||[];this[_0x7feb('0x7')]=_0x1c03dc['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e8049f9..5bc6e2b 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 _0x799c=['length','exports','lodash','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts'];(function(_0x1f467f,_0x15cd16){var _0x28e1ed=function(_0x1e640f){while(--_0x1e640f){_0x1f467f['push'](_0x1f467f['shift']());}};_0x28e1ed(++_0x15cd16);}(_0x799c,0x6a));var _0xc799=function(_0x459e28,_0xadfa6d){_0x459e28=_0x459e28-0x0;var _0x5270e7=_0x799c[_0x459e28];return _0x5270e7;};'use strict';var _=require(_0xc799('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xc799('0x1')]={};};function freeIsNotKey(_0x5ae6e9,_0x35d6a4,_0x5033bc){var _0x377c69=_['mapKeys'](_0x5ae6e9,function(_0x37ef74,_0x175020){return _0x37ef74[_0x5033bc];});for(var _0x20f7aa in _0x35d6a4){if(_0x35d6a4[_0xc799('0x2')](_0x20f7aa)){if(!_0x377c69[_0x20f7aa]){delete _0x35d6a4[_0x20f7aa];}}}}Realtime['prototype'][_0xc799('0x3')]=function(_0x19056f,_0x15dd85){for(var _0x3c48a1 in _0x15dd85){if(_0x19056f[_0xc799('0x2')](_0x3c48a1)){_0x19056f[_0x3c48a1]=_0x15dd85[_0x3c48a1];}}};Realtime[_0xc799('0x4')][_0xc799('0x5')]=function(){var _0x55b56a=this;return function(_0x137895){if(_0x137895){freeIsNotKey(_0x137895,_0x55b56a[_0xc799('0x1')],'id');for(var _0x5ece1d=0x0,_0x4884da={},_0x251ed4={};_0x5ece1d<_0x137895[_0xc799('0x6')];_0x5ece1d+=0x1){_0x4884da=_0x137895[_0x5ece1d];if(_['isUndefined'](_0x55b56a['mailAccounts'][_0x4884da['id']])){_0x55b56a[_0xc799('0x1')][_0x4884da['id']]=new MailAccount(_0x4884da);}else{_['merge'](_0x55b56a[_0xc799('0x1')][_0x4884da['id']],_0x4884da);}}}return _0x55b56a[_0xc799('0x1')];};};module[_0xc799('0x7')]=Realtime; \ No newline at end of file +var _0xc611=['mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge'];(function(_0x4e02ef,_0x186678){var _0x5a45ca=function(_0x2bbfc1){while(--_0x2bbfc1){_0x4e02ef['push'](_0x4e02ef['shift']());}};_0x5a45ca(++_0x186678);}(_0xc611,0x70));var _0x1c61=function(_0x333b08,_0x3b5c6c){_0x333b08=_0x333b08-0x0;var _0x47a915=_0xc611[_0x333b08];return _0x47a915;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x1c61('0x0')]={};};function freeIsNotKey(_0x1ccbef,_0x6fb97d,_0x37036a){var _0xf983c4=_['mapKeys'](_0x1ccbef,function(_0x406f79,_0x1a615e){return _0x406f79[_0x37036a];});for(var _0x47ed3e in _0x6fb97d){if(_0x6fb97d[_0x1c61('0x1')](_0x47ed3e)){if(!_0xf983c4[_0x47ed3e]){delete _0x6fb97d[_0x47ed3e];}}}}Realtime[_0x1c61('0x2')][_0x1c61('0x3')]=function(_0x1aebc7,_0xfa964e){for(var _0x4926fb in _0xfa964e){if(_0x1aebc7[_0x1c61('0x1')](_0x4926fb)){_0x1aebc7[_0x4926fb]=_0xfa964e[_0x4926fb];}}};Realtime['prototype'][_0x1c61('0x4')]=function(){var _0x34c581=this;return function(_0x43391e){if(_0x43391e){freeIsNotKey(_0x43391e,_0x34c581[_0x1c61('0x0')],'id');for(var _0x178343=0x0,_0x59e346={},_0x58bf72={};_0x178343<_0x43391e[_0x1c61('0x5')];_0x178343+=0x1){_0x59e346=_0x43391e[_0x178343];if(_[_0x1c61('0x6')](_0x34c581[_0x1c61('0x0')][_0x59e346['id']])){_0x34c581[_0x1c61('0x0')][_0x59e346['id']]=new MailAccount(_0x59e346);}else{_[_0x1c61('0x7')](_0x34c581[_0x1c61('0x0')][_0x59e346['id']],_0x59e346);}}}return _0x34c581['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 8730eb4..4fcd74a 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 _0xb96d=['service','email','ListId','TemplateId','MailServerIn','Imap','name','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','provider'];(function(_0x3fa027,_0x599b38){var _0x5a478b=function(_0x4923d8){while(--_0x4923d8){_0x3fa027['push'](_0x3fa027['shift']());}};_0x5a478b(++_0x599b38);}(_0xb96d,0x9e));var _0xdb96=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xb96d[_0x11dc39];return _0x457277;};'use strict';var client=require('../client');exports[_0xdb96('0x0')]=function(){return function(){return client[_0xdb96('0x1')](_0xdb96('0x2'),{'options':{'attributes':['id','name',_0xdb96('0x3'),_0xdb96('0x4'),_0xdb96('0x5'),'active','key',_0xdb96('0x6'),_0xdb96('0x7')],'raw':![],'include':[{'model':_0xdb96('0x8'),'as':_0xdb96('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb96('0xa'),_0xdb96('0x4'),'type',_0xdb96('0xb')],'as':'CloudProvider'}]},{'model':_0xdb96('0xc'),'as':_0xdb96('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0xdb96('0xa'),_0xdb96('0x4'),'type',_0xdb96('0xb')],'as':_0xdb96('0xe')}]}]},'log':_0xdb96('0xf')});};};exports[_0xdb96('0x10')]=function(_0x47c94d,_0xa18db8){return client[_0xdb96('0x1')](_0xdb96('0x11'),{'account':{'id':_0x47c94d},'body':_0xa18db8,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xfbf2=['key','ListId','TemplateId','MailServerIn','Imap','service','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','active'];(function(_0x46ce9a,_0x2291e4){var _0x6aa3fc=function(_0x3e2d04){while(--_0x3e2d04){_0x46ce9a['push'](_0x46ce9a['shift']());}};_0x6aa3fc(++_0x2291e4);}(_0xfbf2,0xc0));var _0x2fbf=function(_0x1c8567,_0x5180c6){_0x1c8567=_0x1c8567-0x0;var _0x5309fd=_0xfbf2[_0x1c8567];return _0x5309fd;};'use strict';var client=require(_0x2fbf('0x0'));exports[_0x2fbf('0x1')]=function(){return function(){return client[_0x2fbf('0x2')](_0x2fbf('0x3'),{'options':{'attributes':['id',_0x2fbf('0x4'),_0x2fbf('0x5'),'service',_0x2fbf('0x6'),_0x2fbf('0x7'),_0x2fbf('0x8'),_0x2fbf('0x9'),_0x2fbf('0xa')],'raw':![],'include':[{'model':_0x2fbf('0xb'),'as':_0x2fbf('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0x2fbf('0x4'),_0x2fbf('0xd'),'type',_0x2fbf('0xe')],'as':'CloudProvider'}]},{'model':_0x2fbf('0xf'),'as':_0x2fbf('0x10'),'include':[{'model':_0x2fbf('0x11'),'attributes':['id',_0x2fbf('0x4'),_0x2fbf('0xd'),'type',_0x2fbf('0xe')],'as':'CloudProvider'}]}]},'log':_0x2fbf('0x12')});};};exports['notify']=function(_0x152ad2,_0x16d3f3){return client[_0x2fbf('0x2')](_0x2fbf('0x13'),{'account':{'id':_0x152ad2},'body':_0x16d3f3,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 8c7d2b5..7dcd65d 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 _0x2872=['loginMailFrequency','GetSettings','getSettings','ShowSetting'];(function(_0x2941f9,_0x43ad28){var _0x5a001c=function(_0x30f25a){while(--_0x30f25a){_0x2941f9['push'](_0x2941f9['shift']());}};_0x5a001c(++_0x43ad28);}(_0x2872,0x156));var _0x2287=function(_0x28e2b4,_0x46ca3c){_0x28e2b4=_0x28e2b4-0x0;var _0x59fa92=_0x2872[_0x28e2b4];return _0x59fa92;};'use strict';var client=require('../client');exports[_0x2287('0x0')]=function(){return client['Request'](_0x2287('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2287('0x2')]},'log':_0x2287('0x3')});}; \ No newline at end of file +var _0xc526=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x346075,_0x1c55a9){var _0x3c6a33=function(_0x2cca87){while(--_0x2cca87){_0x346075['push'](_0x346075['shift']());}};_0x3c6a33(++_0x1c55a9);}(_0xc526,0xdd));var _0x6c52=function(_0x50563f,_0x538946){_0x50563f=_0x50563f-0x0;var _0x4a0372=_0xc526[_0x50563f];return _0x4a0372;};'use strict';var client=require(_0x6c52('0x0'));exports[_0x6c52('0x1')]=function(){return client[_0x6c52('0x2')](_0x6c52('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x6c52('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 047a4e8..21a1646 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 75daf67..c57e04f 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 _0x0b06=['socket.io','websocket','polling','redis','localhost','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','port'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x0b06,0x10b));var _0x60b0=function(_0x28e151,_0x3cc4d0){_0x28e151=_0x28e151-0x0;var _0x3c159b=_0x0b06[_0x28e151];return _0x3c159b;};'use strict';var _=require(_0x60b0('0x0'));var http=require(_0x60b0('0x1'));var express=require(_0x60b0('0x2'));var sticky=require(_0x60b0('0x3'));var Redis=require(_0x60b0('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x60b0('0x5')](app);server[_0x60b0('0x6')]=0xdbba0;if(sticky[_0x60b0('0x7')](server,config[_0x60b0('0x8')])){var socketio=require(_0x60b0('0x9'))(server,{'transports':[_0x60b0('0xa'),_0x60b0('0xb')]});config[_0x60b0('0xc')]=_['defaults'](config[_0x60b0('0xc')],{'host':_0x60b0('0xd'),'port':0x18eb});socketio['adapter'](require(_0x60b0('0xe'))({'pubClient':new Redis(config[_0x60b0('0xc')]),'subClient':new Redis(config[_0x60b0('0xc')])}));require(_0x60b0('0xf'))['default']();require(_0x60b0('0x10'))[_0x60b0('0x11')](socketio);require('../../config/express')[_0x60b0('0x11')](app);require(_0x60b0('0x12'))[_0x60b0('0x11')](app);}else{server[_0x60b0('0x13')](_0x60b0('0x14'),function(){console['log'](_0x60b0('0x15'),config[_0x60b0('0x8')]);});}exports=module[_0x60b0('0x16')]=app; \ No newline at end of file +var _0x1ab7=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter'];(function(_0x5e4a2f,_0x2e2a91){var _0x159f46=function(_0x4ec721){while(--_0x4ec721){_0x5e4a2f['push'](_0x5e4a2f['shift']());}};_0x159f46(++_0x2e2a91);}(_0x1ab7,0x1d4));var _0x71ab=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0x1ab7[_0x260073];return _0x4ff033;};'use strict';var _=require(_0x71ab('0x0'));var http=require(_0x71ab('0x1'));var express=require('express');var sticky=require(_0x71ab('0x2'));var Redis=require('ioredis');var config=require(_0x71ab('0x3'));var app=express();var server=http[_0x71ab('0x4')](app);server[_0x71ab('0x5')]=0xdbba0;if(sticky[_0x71ab('0x6')](server,config[_0x71ab('0x7')])){var socketio=require(_0x71ab('0x8'))(server,{'transports':[_0x71ab('0x9'),_0x71ab('0xa')]});config[_0x71ab('0xb')]=_[_0x71ab('0xc')](config['redis'],{'host':_0x71ab('0xd'),'port':0x18eb});socketio[_0x71ab('0xe')](require(_0x71ab('0xf'))({'pubClient':new Redis(config[_0x71ab('0xb')]),'subClient':new Redis(config['redis'])}));require(_0x71ab('0x10'))[_0x71ab('0x11')]();require(_0x71ab('0x12'))[_0x71ab('0x11')](socketio);require(_0x71ab('0x13'))[_0x71ab('0x11')](app);require('../../routes')[_0x71ab('0x11')](app);}else{server[_0x71ab('0x14')]('listening',function(){console[_0x71ab('0x15')](_0x71ab('0x16'),config[_0x71ab('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 92bfb72..ae69fd0 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 _0xdaf3=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request'];(function(_0x4ba1ba,_0x4fa0af){var _0x2daf62=function(_0x19ad2e){while(--_0x19ad2e){_0x4ba1ba['push'](_0x4ba1ba['shift']());}};_0x2daf62(++_0x4fa0af);}(_0xdaf3,0x149));var _0x3daf=function(_0x5908b8,_0x544699){_0x5908b8=_0x5908b8-0x0;var _0xe24a76=_0xdaf3[_0x5908b8];return _0xe24a76;};'use strict';var jayson=require(_0x3daf('0x0'));var BPromise=require(_0x3daf('0x1'));var logger=require(_0x3daf('0x2'))('routing');var client=jayson[_0x3daf('0x3')][_0x3daf('0x4')]({'port':0x2329});client[_0x3daf('0x5')]=function(_0x275c86,_0x274c2d){return new BPromise(function(_0x35af0d,_0x346df8){return client[_0x3daf('0x6')](_0x275c86,_0x274c2d)[_0x3daf('0x7')](function(_0x100003){logger[_0x3daf('0x8')](_0x3daf('0x9'),_0x3daf('0xa'),_0x275c86,_0x274c2d,_0x100003);if(_0x100003['error']){logger[_0x3daf('0xb')](_0x3daf('0x9'),_0x3daf('0xa'),_0x275c86,_0x100003['error'][_0x3daf('0xc')],_0x274c2d);return _0x346df8(_0x100003[_0x3daf('0xb')]['message']);}else{return _0x35af0d(_0x100003[_0x3daf('0xd')]);}})[_0x3daf('0xe')](function(_0x11d43e){logger['error']('rpc',_0x3daf('0xa'),_0x275c86,_0x11d43e,_0x274c2d);return _0x346df8(_0x11d43e);});});};module[_0x3daf('0xf')]=client; \ No newline at end of file +var _0xe9db=['exports','jayson/promise','../../config/logger','client','Request','then','debug','error','rpc','routing','message','result'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xe9db,0x12d));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xbe9d('0x0'));var BPromise=require('bluebird');var logger=require(_0xbe9d('0x1'))('routing');var client=jayson[_0xbe9d('0x2')]['http']({'port':0x2329});client[_0xbe9d('0x3')]=function(_0x352917,_0x1ef83d){return new BPromise(function(_0x1b416e,_0x5ad8e9){return client['request'](_0x352917,_0x1ef83d)[_0xbe9d('0x4')](function(_0x22171e){logger[_0xbe9d('0x5')]('rpc','routing',_0x352917,_0x1ef83d,_0x22171e);if(_0x22171e[_0xbe9d('0x6')]){logger[_0xbe9d('0x6')](_0xbe9d('0x7'),_0xbe9d('0x8'),_0x352917,_0x22171e[_0xbe9d('0x6')][_0xbe9d('0x9')],_0x1ef83d);return _0x5ad8e9(_0x22171e[_0xbe9d('0x6')][_0xbe9d('0x9')]);}else{return _0x1b416e(_0x22171e[_0xbe9d('0xa')]);}})['catch'](function(_0x2485a8){logger[_0xbe9d('0x6')](_0xbe9d('0x7'),'routing',_0x352917,_0x2485a8,_0x1ef83d);return _0x5ad8e9(_0x2485a8);});});};module[_0xbe9d('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 357a80c..92e1105 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 _0x4c47=['getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues'];(function(_0x18307e,_0x306a3d){var _0x56143f=function(_0x562fe3){while(--_0x562fe3){_0x18307e['push'](_0x18307e['shift']());}};_0x56143f(++_0x306a3d);}(_0x4c47,0xf6));var _0x74c4=function(_0x24c862,_0x556541){_0x24c862=_0x24c862-0x0;var _0x5d639e=_0x4c47[_0x24c862];return _0x5d639e;};'use strict';var BPromise=require(_0x74c4('0x0'));var server=require(_0x74c4('0x1'));var Realtime=require('./realtime');var user=require(_0x74c4('0x2'));var interval=require(_0x74c4('0x3'));var openchannelQueue=require(_0x74c4('0x4'));var chatQueue=require(_0x74c4('0x5'));var smsQueue=require(_0x74c4('0x6'));var mailQueue=require(_0x74c4('0x7'));var faxQueue=require(_0x74c4('0x8'));var whatsappQueue=require(_0x74c4('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x74c4('0xa')]()['then'](user[_0x74c4('0xb')]())[_0x74c4('0xc')](realtime[_0x74c4('0xd')]())[_0x74c4('0xc')](interval[_0x74c4('0xe')]())[_0x74c4('0xc')](realtime[_0x74c4('0xf')]())[_0x74c4('0xc')](openchannelQueue[_0x74c4('0x10')]())[_0x74c4('0xc')](realtime[_0x74c4('0x11')]())['then'](chatQueue['getChatQueues']())[_0x74c4('0xc')](realtime['initChatQueues']())[_0x74c4('0xc')](smsQueue[_0x74c4('0x12')]())[_0x74c4('0xc')](realtime[_0x74c4('0x13')]())['then'](mailQueue[_0x74c4('0x14')]())[_0x74c4('0xc')](realtime[_0x74c4('0x15')]())[_0x74c4('0xc')](faxQueue[_0x74c4('0x16')]())[_0x74c4('0xc')](realtime[_0x74c4('0x17')]())[_0x74c4('0xc')](whatsappQueue[_0x74c4('0x18')]())[_0x74c4('0xc')](realtime[_0x74c4('0x19')]())[_0x74c4('0xc')](function(){return realtime;});}function main(){return server[_0x74c4('0x1a')](realtime)[_0x74c4('0xc')](function(_0x13de1a){return initRealtime();})[_0x74c4('0xc')](function(_0x3b9f52){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3c644e){console['log'](_0x3c644e);});}main(); \ No newline at end of file +var _0xa300=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','getMailQueues'];(function(_0x8269ae,_0xcd8119){var _0x1e733d=function(_0x1365df){while(--_0x1365df){_0x8269ae['push'](_0x8269ae['shift']());}};_0x1e733d(++_0xcd8119);}(_0xa300,0x1a6));var _0x0a30=function(_0x2294cb,_0x362fea){_0x2294cb=_0x2294cb-0x0;var _0x5855fa=_0xa300[_0x2294cb];return _0x5855fa;};'use strict';var BPromise=require(_0x0a30('0x0'));var server=require('./server');var Realtime=require(_0x0a30('0x1'));var user=require(_0x0a30('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x0a30('0x3'));var chatQueue=require(_0x0a30('0x4'));var smsQueue=require(_0x0a30('0x5'));var mailQueue=require(_0x0a30('0x6'));var faxQueue=require(_0x0a30('0x7'));var whatsappQueue=require(_0x0a30('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0a30('0x9')]()[_0x0a30('0xa')](user[_0x0a30('0xb')]())[_0x0a30('0xa')](realtime[_0x0a30('0xc')]())[_0x0a30('0xa')](interval[_0x0a30('0xd')]())['then'](realtime[_0x0a30('0xe')]())[_0x0a30('0xa')](openchannelQueue[_0x0a30('0xf')]())[_0x0a30('0xa')](realtime[_0x0a30('0x10')]())[_0x0a30('0xa')](chatQueue[_0x0a30('0x11')]())[_0x0a30('0xa')](realtime['initChatQueues']())['then'](smsQueue[_0x0a30('0x12')]())['then'](realtime['initSmsQueues']())['then'](mailQueue[_0x0a30('0x13')]())[_0x0a30('0xa')](realtime[_0x0a30('0x14')]())[_0x0a30('0xa')](faxQueue[_0x0a30('0x15')]())[_0x0a30('0xa')](realtime[_0x0a30('0x16')]())['then'](whatsappQueue[_0x0a30('0x17')]())[_0x0a30('0xa')](realtime[_0x0a30('0x18')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x0a30('0xa')](function(_0x3b7a83){return initRealtime();})[_0x0a30('0xa')](function(_0x5978ad){return setInterval(initRealtime,0x1388);})[_0x0a30('0x19')](function(_0x17fca8){console['log'](_0x17fca8);});}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 9d58202..eb62a82 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x8b09ae,_0x55733c){var _0x27ff72=function(_0x44c6cf){while(--_0x44c6cf){_0x8b09ae['push'](_0x8b09ae['shift']());}};_0x27ff72(++_0x55733c);}(_0x7a54,0x106));var _0x47a5=function(_0xb23790,_0x2a472d){_0xb23790=_0xb23790-0x0;var _0x95a307=_0x7a54[_0xb23790];return _0x95a307;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x30b97f,_0x24234f){var _0x3768d8=function(_0x2837b2){while(--_0x2837b2){_0x30b97f['push'](_0x30b97f['shift']());}};_0x3768d8(++_0x24234f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3f70c91..a522b2e 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 _0x9db7=['SendMail','jayson/promise','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9db7,0x16c));var _0x79db=function(_0x3a31a9,_0x1d1e78){_0x3a31a9=_0x3a31a9-0x0;var _0x311715=_0x9db7[_0x3a31a9];return _0x311715;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x79db('0x0'));var client=jayson[_0x79db('0x1')][_0x79db('0x2')]({'port':0x232b});function request(_0x3471d0,_0x5f2dad){return new BPromise(function(_0x2d2354,_0x12f31e){return client[_0x79db('0x3')](_0x3471d0,_0x5f2dad)[_0x79db('0x4')](function(_0x131174){if(_0x131174[_0x79db('0x5')]){return _0x12f31e(_0x131174[_0x79db('0x5')][_0x79db('0x6')]);}else{return _0x2d2354(_0x131174[_0x79db('0x7')]);}})[_0x79db('0x8')](function(_0x260c94){return _0x12f31e(_0x260c94);});});}exports[_0x79db('0x9')]=function(_0x1a2617,_0x402cd3){return request(_0x79db('0xa'),{'account':_0x1a2617,'message':_0x402cd3});}; \ No newline at end of file +var _0x0629=['result','catch','sendMailMessage','jayson/promise','client','http','request','then','error','message'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0629,0x143));var _0x9062=function(_0x1de9e6,_0x3bffbb){_0x1de9e6=_0x1de9e6-0x0;var _0x3641d2=_0x0629[_0x1de9e6];return _0x3641d2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9062('0x0'));var client=jayson[_0x9062('0x1')][_0x9062('0x2')]({'port':0x232b});function request(_0x4488fb,_0x439275){return new BPromise(function(_0x466856,_0x55a944){return client[_0x9062('0x3')](_0x4488fb,_0x439275)[_0x9062('0x4')](function(_0x1e82be){if(_0x1e82be[_0x9062('0x5')]){return _0x55a944(_0x1e82be[_0x9062('0x5')][_0x9062('0x6')]);}else{return _0x466856(_0x1e82be[_0x9062('0x7')]);}})[_0x9062('0x8')](function(_0xcc7579){return _0x55a944(_0xcc7579);});});}exports[_0x9062('0x9')]=function(_0x4fab89,_0x11ab8a){return request('SendMail',{'account':_0x4fab89,'message':_0x11ab8a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ac3d4bc..a47e256 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 _0x29da=['mail','chat','fax','sms','length','format','openchannelPause','whatsappStatus','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime'];(function(_0x3abd45,_0x44850c){var _0x540309=function(_0x4f2d3b){while(--_0x4f2d3b){_0x3abd45['push'](_0x3abd45['shift']());}};_0x540309(++_0x44850c);}(_0x29da,0xf8));var _0xa29d=function(_0x4333c2,_0x11b143){_0x4333c2=_0x4333c2-0x0;var _0x3a1181=_0x29da[_0x4333c2];return _0x3a1181;};'use strict';var _=require(_0xa29d('0x0'));var moment=require(_0xa29d('0x1'));var md5=require('md5');var Redis=require(_0xa29d('0x2'));var config=require(_0xa29d('0x3'));config['redis']=_[_0xa29d('0x4')](config[_0xa29d('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa29d('0x5')]));function Agent(_0x2951df){this['id']=_0x2951df['id']||0x0;this[_0xa29d('0x6')]=_0x2951df[_0xa29d('0x6')]||'';this[_0xa29d('0x7')]=_0x2951df['online']||!![];this[_0xa29d('0x8')]=_0x2951df[_0xa29d('0x8')]||![];this[_0xa29d('0x9')]=_0x2951df[_0xa29d('0x9')]||![];this[_0xa29d('0xa')]=_0x2951df[_0xa29d('0xa')]||![];this[_0xa29d('0xb')]=_0x2951df['faxPause']||![];this[_0xa29d('0xc')]=_0x2951df['smsPause']||![];this['openchannelPause']=_0x2951df['openchannelPause']||![];this[_0xa29d('0xd')]='unknown';this[_0xa29d('0xe')]=0x0;this['chatCapacity']=_0x2951df[_0xa29d('0xf')]||0x0;this[_0xa29d('0x10')]=0x0;this[_0xa29d('0x11')]=_0xa29d('0x12');this[_0xa29d('0x13')]=0x0;this[_0xa29d('0x14')]=_0x2951df[_0xa29d('0x14')]||0x0;this[_0xa29d('0x15')]=0x0;this[_0xa29d('0x16')]=_0xa29d('0x12');this[_0xa29d('0x17')]=0x0;this[_0xa29d('0x18')]=_0x2951df[_0xa29d('0x18')]||0x0;this[_0xa29d('0x19')]=0x0;this[_0xa29d('0x1a')]=_0xa29d('0x12');this[_0xa29d('0x1b')]=0x0;this[_0xa29d('0x1c')]=_0x2951df[_0xa29d('0x1c')]||0x0;this[_0xa29d('0x1d')]=0x0;this['whatsappStatus']=_0xa29d('0x12');this[_0xa29d('0x1e')]=0x0;this[_0xa29d('0x1f')]=_0x2951df[_0xa29d('0x1f')]||0x0;this[_0xa29d('0x20')]=0x0;this['openchannelStatus']='unknown';this[_0xa29d('0x21')]=0x0;this[_0xa29d('0x22')]=_0x2951df[_0xa29d('0x22')]||0x0;this[_0xa29d('0x23')]=0x0;this[_0xa29d('0x24')]=![];this[_0xa29d('0x25')]=undefined;this[_0xa29d('0x26')]='';this['updateRealtime']();}Agent[_0xa29d('0x27')][_0xa29d('0x28')]=function(_0x1f4475){if(this[_0x1f4475+_0xa29d('0x29')]>0x0){if(this[_0x1f4475+_0xa29d('0x2a')]>0x0&&this[_0x1f4475+_0xa29d('0x29')]>=this[_0x1f4475+_0xa29d('0x2a')]){return _0xa29d('0x2b');}else{return _0xa29d('0x2c');}}else{return _0xa29d('0x2d');}};Agent['prototype'][_0xa29d('0x2e')]=function(){var _0x4bb135=[_0xa29d('0x2f'),_0xa29d('0x30'),'openchannel',_0xa29d('0x31'),_0xa29d('0x32'),'whatsapp'];for(var _0xf3593a=0x0;_0xf3593a<_0x4bb135[_0xa29d('0x33')];_0xf3593a+=0x1){var _0x4329d1=this[_0xa29d('0x28')](_0x4bb135[_0xf3593a]);if(this[_0x4bb135[_0xf3593a]+'Status']!==_0x4329d1){this[_0x4bb135[_0xf3593a]+'StatusTime']=_['toNumber'](moment()[_0xa29d('0x34')]('x'));}this[_0x4bb135[_0xf3593a]+'Status']=_0x4329d1;}var _0x14d912={'id':this['id'],'name':this[_0xa29d('0x6')],'online':this[_0xa29d('0x7')],'voicePause':this[_0xa29d('0x8')],'chatPause':this[_0xa29d('0x9')],'mailPause':this[_0xa29d('0xa')],'smsPause':this[_0xa29d('0xc')],'faxPause':this[_0xa29d('0xb')],'openchannelPause':this[_0xa29d('0x35')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xa29d('0xe')],'chatCapacity':this[_0xa29d('0xf')],'chatCurrentCapacity':this[_0xa29d('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xa29d('0x13')],'mailCapacity':this[_0xa29d('0x14')],'mailCurrentCapacity':this[_0xa29d('0x15')],'faxStatus':this[_0xa29d('0x16')],'faxStatusTime':this[_0xa29d('0x17')],'faxCapacity':this[_0xa29d('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xa29d('0x1a')],'smsStatusTime':this[_0xa29d('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xa29d('0x1d')],'whatsappStatus':this[_0xa29d('0x36')],'whatsappStatusTime':this[_0xa29d('0x1e')],'whatsappCapacity':this[_0xa29d('0x1f')],'whatsappCurrentCapacity':this[_0xa29d('0x20')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xa29d('0x21')],'openchannelCapacity':this[_0xa29d('0x22')],'openchannelCurrentCapacity':this[_0xa29d('0x23')],'busy':this[_0xa29d('0x24')],'busyQueue':this['busyQueue']};var _0x2b83e8=md5(JSON[_0xa29d('0x37')](_0x14d912));if(this[_0xa29d('0x26')]!==_0x2b83e8){this['md5']=_0x2b83e8;io[_0xa29d('0x38')](_0xa29d('0x39'),_0x14d912);}};module[_0xa29d('0x3a')]=Agent; \ No newline at end of file +var _0xbf3c=['idle','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','stringify','user:save','lodash','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','CurrentCapacity','Capacity'];(function(_0x414688,_0x4dae18){var _0x244712=function(_0x200c7a){while(--_0x200c7a){_0x414688['push'](_0x414688['shift']());}};_0x244712(++_0x4dae18);}(_0xbf3c,0x1ce));var _0xcbf3=function(_0xa42674,_0x1cb46a){_0xa42674=_0xa42674-0x0;var _0x51e9bc=_0xbf3c[_0xa42674];return _0x51e9bc;};'use strict';var _=require(_0xcbf3('0x0'));var moment=require(_0xcbf3('0x1'));var md5=require('md5');var Redis=require(_0xcbf3('0x2'));var config=require('../../../config/environment');config[_0xcbf3('0x3')]=_[_0xcbf3('0x4')](config[_0xcbf3('0x3')],{'host':_0xcbf3('0x5'),'port':0x18eb});var io=require(_0xcbf3('0x6'))(new Redis(config['redis']));function Agent(_0x54af8c){this['id']=_0x54af8c['id']||0x0;this['name']=_0x54af8c[_0xcbf3('0x7')]||'';this[_0xcbf3('0x8')]=_0x54af8c[_0xcbf3('0x8')]||!![];this[_0xcbf3('0x9')]=_0x54af8c['voicePause']||![];this[_0xcbf3('0xa')]=_0x54af8c[_0xcbf3('0xa')]||![];this[_0xcbf3('0xb')]=_0x54af8c['mailPause']||![];this[_0xcbf3('0xc')]=_0x54af8c[_0xcbf3('0xc')]||![];this[_0xcbf3('0xd')]=_0x54af8c[_0xcbf3('0xd')]||![];this['openchannelPause']=_0x54af8c[_0xcbf3('0xe')]||![];this['chatStatus']=_0xcbf3('0xf');this['chatStatusTime']=0x0;this[_0xcbf3('0x10')]=_0x54af8c[_0xcbf3('0x10')]||0x0;this[_0xcbf3('0x11')]=0x0;this['mailStatus']=_0xcbf3('0xf');this[_0xcbf3('0x12')]=0x0;this[_0xcbf3('0x13')]=_0x54af8c[_0xcbf3('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xcbf3('0x14')]=_0xcbf3('0xf');this[_0xcbf3('0x15')]=0x0;this[_0xcbf3('0x16')]=_0x54af8c['faxCapacity']||0x0;this[_0xcbf3('0x17')]=0x0;this[_0xcbf3('0x18')]='unknown';this[_0xcbf3('0x19')]=0x0;this[_0xcbf3('0x1a')]=_0x54af8c[_0xcbf3('0x1a')]||0x0;this[_0xcbf3('0x1b')]=0x0;this[_0xcbf3('0x1c')]=_0xcbf3('0xf');this[_0xcbf3('0x1d')]=0x0;this[_0xcbf3('0x1e')]=_0x54af8c[_0xcbf3('0x1e')]||0x0;this[_0xcbf3('0x1f')]=0x0;this[_0xcbf3('0x20')]=_0xcbf3('0xf');this[_0xcbf3('0x21')]=0x0;this['openchannelCapacity']=_0x54af8c[_0xcbf3('0x22')]||0x0;this[_0xcbf3('0x23')]=0x0;this[_0xcbf3('0x24')]=![];this[_0xcbf3('0x25')]=undefined;this[_0xcbf3('0x26')]='';this['updateRealtime']();}Agent[_0xcbf3('0x27')]['getChannelStatus']=function(_0x725603){if(this[_0x725603+_0xcbf3('0x28')]>0x0){if(this[_0x725603+_0xcbf3('0x29')]>0x0&&this[_0x725603+_0xcbf3('0x28')]>=this[_0x725603+_0xcbf3('0x29')]){return'maxcapacity';}else{return'working';}}else{return _0xcbf3('0x2a');}};Agent[_0xcbf3('0x27')]['updateRealtime']=function(){var _0x5c43db=[_0xcbf3('0x2b'),'chat',_0xcbf3('0x2c'),_0xcbf3('0x2d'),_0xcbf3('0x2e'),_0xcbf3('0x2f')];for(var _0x2dda94=0x0;_0x2dda94<_0x5c43db[_0xcbf3('0x30')];_0x2dda94+=0x1){var _0x1f6eed=this['getChannelStatus'](_0x5c43db[_0x2dda94]);if(this[_0x5c43db[_0x2dda94]+_0xcbf3('0x31')]!==_0x1f6eed){this[_0x5c43db[_0x2dda94]+_0xcbf3('0x32')]=_[_0xcbf3('0x33')](moment()[_0xcbf3('0x34')]('x'));}this[_0x5c43db[_0x2dda94]+_0xcbf3('0x31')]=_0x1f6eed;}var _0x4a69d3={'id':this['id'],'name':this[_0xcbf3('0x7')],'online':this[_0xcbf3('0x8')],'voicePause':this[_0xcbf3('0x9')],'chatPause':this[_0xcbf3('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xcbf3('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xcbf3('0x35')],'chatCapacity':this[_0xcbf3('0x10')],'chatCurrentCapacity':this[_0xcbf3('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xcbf3('0x12')],'mailCapacity':this[_0xcbf3('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xcbf3('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xcbf3('0x16')],'faxCurrentCapacity':this[_0xcbf3('0x17')],'smsStatus':this[_0xcbf3('0x18')],'smsStatusTime':this[_0xcbf3('0x19')],'smsCapacity':this[_0xcbf3('0x1a')],'smsCurrentCapacity':this[_0xcbf3('0x1b')],'whatsappStatus':this[_0xcbf3('0x1c')],'whatsappStatusTime':this[_0xcbf3('0x1d')],'whatsappCapacity':this[_0xcbf3('0x1e')],'whatsappCurrentCapacity':this[_0xcbf3('0x1f')],'openchannelStatus':this[_0xcbf3('0x20')],'openchannelStatusTime':this[_0xcbf3('0x21')],'openchannelCapacity':this[_0xcbf3('0x22')],'openchannelCurrentCapacity':this[_0xcbf3('0x23')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x196401=md5(JSON[_0xcbf3('0x36')](_0x4a69d3));if(this[_0xcbf3('0x26')]!==_0x196401){this[_0xcbf3('0x26')]=_0x196401;io['emit'](_0xcbf3('0x37'),_0x4a69d3);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5eb8494..581e047 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 _0x37fc=['format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','waiting','stringify'];(function(_0x238443,_0x345b03){var _0x32db23=function(_0x1a3cb4){while(--_0x1a3cb4){_0x238443['push'](_0x238443['shift']());}};_0x32db23(++_0x345b03);}(_0x37fc,0x179));var _0xc37f=function(_0x48c46b,_0x42d810){_0x48c46b=_0x48c46b-0x0;var _0x1186d8=_0x37fc[_0x48c46b];return _0x1186d8;};'use strict';var _=require('lodash');var md5=require(_0xc37f('0x0'));var util=require(_0xc37f('0x1'));var Redis=require(_0xc37f('0x2'));var config=require(_0xc37f('0x3'));config[_0xc37f('0x4')]=_[_0xc37f('0x5')](config[_0xc37f('0x4')],{'host':_0xc37f('0x6'),'port':0x18eb});var io=require(_0xc37f('0x7'))(new Redis(config[_0xc37f('0x4')]));function ChatQueue(_0x152c14){this['id']=_0x152c14['id']||0x0;this[_0xc37f('0x8')]=_0x152c14[_0xc37f('0x8')]||'';this['timeout']=_0x152c14[_0xc37f('0x9')]||0xa;this[_0xc37f('0xa')]=_0x152c14[_0xc37f('0xa')]||_0xc37f('0xb');this[_0xc37f('0xc')]=_0x152c14[_0xc37f('0xc')];this[_0xc37f('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xc37f('0xe')]();this['updateRealtime']();}ChatQueue[_0xc37f('0xf')]['updateRouting']=function(){var _0x57fc32=this['mapAgentsId']['_rr'];this[_0xc37f('0xd')]=_[_0xc37f('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x57fc32;};ChatQueue[_0xc37f('0xf')][_0xc37f('0x11')]=function(){this[_0xc37f('0x12')]=0x0;this[_0xc37f('0x13')]=0x0;for(var _0x4d7029=0x0;_0x4d7029=0x0?this[_0xc37f('0x17')]:0x0;var _0x19e469={'id':this['id'],'available':this['available'],'loggedIn':this[_0xc37f('0x12')],'name':this[_0xc37f('0x8')],'paused':this[_0xc37f('0x13')],'waiting':this[_0xc37f('0x18')]};var _0x4821c9=md5(JSON[_0xc37f('0x19')](_0x19e469));if(this['md5']!==_0x4821c9){this[_0xc37f('0x0')]=_0x4821c9;io['to'](util[_0xc37f('0x1a')](_0xc37f('0x1b'),_0x19e469['name']))[_0xc37f('0x1c')](_0xc37f('0x1d'),_0x19e469);}};module[_0xc37f('0x1e')]=ChatQueue; \ No newline at end of file +var _0xb289=['online','chatPause','paused','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xb289,0xef));var _0x9b28=function(_0x57c9a2,_0x57980e){_0x57c9a2=_0x57c9a2-0x0;var _0x1e42ae=_0xb289[_0x57c9a2];return _0x1e42ae;};'use strict';var _=require(_0x9b28('0x0'));var md5=require(_0x9b28('0x1'));var util=require(_0x9b28('0x2'));var Redis=require(_0x9b28('0x3'));var config=require(_0x9b28('0x4'));config[_0x9b28('0x5')]=_[_0x9b28('0x6')](config[_0x9b28('0x5')],{'host':_0x9b28('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b28('0x5')]));function ChatQueue(_0x39a934){this['id']=_0x39a934['id']||0x0;this[_0x9b28('0x8')]=_0x39a934[_0x9b28('0x8')]||'';this[_0x9b28('0x9')]=_0x39a934['timeout']||0xa;this[_0x9b28('0xa')]=_0x39a934['strategy']||_0x9b28('0xb');this[_0x9b28('0xc')]=_0x39a934[_0x9b28('0xc')];this[_0x9b28('0xd')]={};this[_0x9b28('0xe')]=0x0;this[_0x9b28('0x1')]='';this['updateRouting']();this[_0x9b28('0xf')]();}ChatQueue[_0x9b28('0x10')][_0x9b28('0x11')]=function(){var _0x46ce03=this[_0x9b28('0xd')]['_rr'];this[_0x9b28('0xd')]=_[_0x9b28('0x12')](this[_0x9b28('0xc')],'id');this[_0x9b28('0xd')][_0x9b28('0x13')]=_0x46ce03;};ChatQueue['prototype'][_0x9b28('0xf')]=function(){this[_0x9b28('0x14')]=0x0;this['paused']=0x0;for(var _0x90e0b0=0x0;_0x90e0b0=0x0?this[_0x9b28('0x19')]:0x0;var _0x389753={'id':this['id'],'available':this[_0x9b28('0x19')],'loggedIn':this[_0x9b28('0x14')],'name':this[_0x9b28('0x8')],'paused':this[_0x9b28('0x18')],'waiting':this[_0x9b28('0xe')]};var _0x4304a6=md5(JSON[_0x9b28('0x1a')](_0x389753));if(this[_0x9b28('0x1')]!==_0x4304a6){this[_0x9b28('0x1')]=_0x4304a6;io['to'](util['format']('chat:queue:%s',_0x389753[_0x9b28('0x8')]))[_0x9b28('0x1b')]('chat_queue:save',_0x389753);}};module[_0x9b28('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 857c597..14a4731 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 _0x22fa=['beepall','Agents','waiting','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','defaults','redis','name','timeout','strategy'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x22fa,0xc8));var _0xa22f=function(_0x4c4ca2,_0x30d812){_0x4c4ca2=_0x4c4ca2-0x0;var _0x17dac3=_0x22fa[_0x4c4ca2];return _0x17dac3;};'use strict';var _=require('lodash');var md5=require(_0xa22f('0x0'));var util=require(_0xa22f('0x1'));var Redis=require(_0xa22f('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xa22f('0x3')](config[_0xa22f('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa22f('0x4')]));function FaxQueue(_0x342f98){this['id']=_0x342f98['id']||0x0;this[_0xa22f('0x5')]=_0x342f98[_0xa22f('0x5')]||'';this['timeout']=_0x342f98[_0xa22f('0x6')]||0xa;this[_0xa22f('0x7')]=_0x342f98[_0xa22f('0x7')]||_0xa22f('0x8');this['Agents']=_0x342f98[_0xa22f('0x9')];this['mapAgentsId']={};this[_0xa22f('0xa')]=0x0;this[_0xa22f('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xa22f('0xb')]['updateRouting']=function(){var _0x33604e=this[_0xa22f('0xc')][_0xa22f('0xd')];this[_0xa22f('0xc')]=_['map'](this[_0xa22f('0x9')],'id');this[_0xa22f('0xc')][_0xa22f('0xd')]=_0x33604e;};FaxQueue[_0xa22f('0xb')]['updateRealtime']=function(){this[_0xa22f('0xe')]=0x0;this[_0xa22f('0xf')]=0x0;for(var _0x3adbb5=0x0;_0x3adbb5=0x0?this['available']:0x0;var _0x583d20={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa22f('0xe')],'name':this[_0xa22f('0x5')],'paused':this['paused'],'waiting':this[_0xa22f('0xa')]};var _0x531a8d=md5(JSON[_0xa22f('0x14')](_0x583d20));if(this[_0xa22f('0x0')]!==_0x531a8d){this['md5']=_0x531a8d;io['to'](util[_0xa22f('0x15')](_0xa22f('0x16'),_0x583d20['name']))[_0xa22f('0x17')](_0xa22f('0x18'),_0x583d20);}};module[_0xa22f('0x19')]=FaxQueue; \ No newline at end of file +var _0x02d8=['available','name','format','fax:queue:%s','emit','fax_queue:save','md5','util','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','faxPause','paused'];(function(_0x274dd7,_0x2e6051){var _0x148829=function(_0x4cec98){while(--_0x4cec98){_0x274dd7['push'](_0x274dd7['shift']());}};_0x148829(++_0x2e6051);}(_0x02d8,0x114));var _0x802d=function(_0x1df7a8,_0x205e45){_0x1df7a8=_0x1df7a8-0x0;var _0x4656e2=_0x02d8[_0x1df7a8];return _0x4656e2;};'use strict';var _=require('lodash');var md5=require(_0x802d('0x0'));var util=require(_0x802d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x802d('0x2')]=_[_0x802d('0x3')](config[_0x802d('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x802d('0x4'))(new Redis(config[_0x802d('0x2')]));function FaxQueue(_0x758057){this['id']=_0x758057['id']||0x0;this['name']=_0x758057['name']||'';this[_0x802d('0x5')]=_0x758057['timeout']||0xa;this['strategy']=_0x758057[_0x802d('0x6')]||_0x802d('0x7');this[_0x802d('0x8')]=_0x758057['Agents'];this[_0x802d('0x9')]={};this[_0x802d('0xa')]=0x0;this['md5']='';this[_0x802d('0xb')]();this[_0x802d('0xc')]();}FaxQueue[_0x802d('0xd')]['updateRouting']=function(){var _0x296925=this[_0x802d('0x9')][_0x802d('0xe')];this['mapAgentsId']=_[_0x802d('0xf')](this[_0x802d('0x8')],'id');this[_0x802d('0x9')][_0x802d('0xe')]=_0x296925;};FaxQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3bc02f=0x0;_0x3bc02f=0x0?this['available']:0x0;var _0x1b830f={'id':this['id'],'available':this[_0x802d('0x15')],'loggedIn':this[_0x802d('0x12')],'name':this[_0x802d('0x16')],'paused':this[_0x802d('0x14')],'waiting':this[_0x802d('0xa')]};var _0x470f08=md5(JSON['stringify'](_0x1b830f));if(this[_0x802d('0x0')]!==_0x470f08){this[_0x802d('0x0')]=_0x470f08;io['to'](util[_0x802d('0x17')](_0x802d('0x18'),_0x1b830f[_0x802d('0x16')]))[_0x802d('0x19')](_0x802d('0x1a'),_0x1b830f);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 31efb66..660a77f 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 _0xf546=['exports','name','Intervals'];(function(_0x2da407,_0x12cddc){var _0x149d58=function(_0x110a06){while(--_0x110a06){_0x2da407['push'](_0x2da407['shift']());}};_0x149d58(++_0x12cddc);}(_0xf546,0xeb));var _0x6f54=function(_0x512538,_0x2d5fc7){_0x512538=_0x512538-0x0;var _0x352d98=_0xf546[_0x512538];return _0x352d98;};'use strict';function Interval(_0x1e9822){this['id']=_0x1e9822['id']||0x0;this['name']=_0x1e9822[_0x6f54('0x0')]||'';this[_0x6f54('0x1')]=_0x1e9822['Intervals']||{};}module[_0x6f54('0x2')]=Interval; \ No newline at end of file +var _0x50e1=['name'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x50e1,0x98));var _0x150e=function(_0x3b6c5c,_0xe3dae8){_0x3b6c5c=_0x3b6c5c-0x0;var _0x378895=_0x50e1[_0x3b6c5c];return _0x378895;};'use strict';function Interval(_0xaf3162){this['id']=_0xaf3162['id']||0x0;this[_0x150e('0x0')]=_0xaf3162[_0x150e('0x0')]||'';this['Intervals']=_0xaf3162['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1b9ab06..ed1023c 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 _0x8fd1=['loggedIn','paused','length','online','available','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x280dd8,_0x5c8eb8){var _0x2a6aa6=function(_0x118d85){while(--_0x118d85){_0x280dd8['push'](_0x280dd8['shift']());}};_0x2a6aa6(++_0x5c8eb8);}(_0x8fd1,0x98));var _0x18fd=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x8fd1[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x18fd('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x18fd('0x1')]=_[_0x18fd('0x2')](config[_0x18fd('0x1')],{'host':_0x18fd('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x18fd('0x1')]));function MailQueue(_0x1dcac0){this['id']=_0x1dcac0['id']||0x0;this[_0x18fd('0x4')]=_0x1dcac0[_0x18fd('0x4')]||'';this[_0x18fd('0x5')]=_0x1dcac0['timeout']||0xa;this[_0x18fd('0x6')]=_0x1dcac0['strategy']||_0x18fd('0x7');this[_0x18fd('0x8')]=_0x1dcac0['Agents'];this[_0x18fd('0x9')]={};this[_0x18fd('0xa')]=0x0;this['md5']='';this[_0x18fd('0xb')]();this[_0x18fd('0xc')]();}MailQueue[_0x18fd('0xd')][_0x18fd('0xb')]=function(){var _0x29310a=this[_0x18fd('0x9')][_0x18fd('0xe')];this[_0x18fd('0x9')]=_[_0x18fd('0xf')](this['Agents'],'id');this[_0x18fd('0x9')][_0x18fd('0xe')]=_0x29310a;};MailQueue[_0x18fd('0xd')][_0x18fd('0xc')]=function(){this[_0x18fd('0x10')]=0x0;this[_0x18fd('0x11')]=0x0;for(var _0x381b90=0x0;_0x381b90=0x0?this[_0x18fd('0x14')]:0x0;var _0x2516d1={'id':this['id'],'available':this[_0x18fd('0x14')],'loggedIn':this[_0x18fd('0x10')],'name':this['name'],'paused':this[_0x18fd('0x11')],'waiting':this[_0x18fd('0xa')]};var _0x415539=md5(JSON[_0x18fd('0x15')](_0x2516d1));if(this[_0x18fd('0x16')]!==_0x415539){this[_0x18fd('0x16')]=_0x415539;io['to'](util[_0x18fd('0x17')](_0x18fd('0x18'),_0x2516d1[_0x18fd('0x4')]))[_0x18fd('0x19')](_0x18fd('0x1a'),_0x2516d1);}};module[_0x18fd('0x1b')]=MailQueue; \ No newline at end of file +var _0xd3fb=['ioredis','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','length','online','mailPause','paused','available','loggedIn','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','exports','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd3fb,0x16b));var _0xbd3f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3fb[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xbd3f('0x0'));var Redis=require(_0xbd3f('0x1'));var config=require('../../../config/environment');config[_0xbd3f('0x2')]=_['defaults'](config[_0xbd3f('0x2')],{'host':_0xbd3f('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd3f('0x2')]));function MailQueue(_0x30be5b){this['id']=_0x30be5b['id']||0x0;this[_0xbd3f('0x4')]=_0x30be5b[_0xbd3f('0x4')]||'';this[_0xbd3f('0x5')]=_0x30be5b['timeout']||0xa;this[_0xbd3f('0x6')]=_0x30be5b[_0xbd3f('0x6')]||'beepall';this[_0xbd3f('0x7')]=_0x30be5b[_0xbd3f('0x7')];this[_0xbd3f('0x8')]={};this[_0xbd3f('0x9')]=0x0;this['md5']='';this[_0xbd3f('0xa')]();this[_0xbd3f('0xb')]();}MailQueue[_0xbd3f('0xc')][_0xbd3f('0xa')]=function(){var _0x1465e5=this[_0xbd3f('0x8')]['_rr'];this[_0xbd3f('0x8')]=_[_0xbd3f('0xd')](this['Agents'],'id');this[_0xbd3f('0x8')][_0xbd3f('0xe')]=_0x1465e5;};MailQueue[_0xbd3f('0xc')][_0xbd3f('0xb')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5964c9=0x0;_0x5964c9=0x0?this[_0xbd3f('0x13')]:0x0;var _0x193bdf={'id':this['id'],'available':this[_0xbd3f('0x13')],'loggedIn':this[_0xbd3f('0x14')],'name':this['name'],'paused':this[_0xbd3f('0x12')],'waiting':this[_0xbd3f('0x9')]};var _0x218fc3=md5(JSON[_0xbd3f('0x15')](_0x193bdf));if(this[_0xbd3f('0x16')]!==_0x218fc3){this[_0xbd3f('0x16')]=_0x218fc3;io['to'](util[_0xbd3f('0x17')](_0xbd3f('0x18'),_0x193bdf['name']))[_0xbd3f('0x19')](_0xbd3f('0x1a'),_0x193bdf);}};module[_0xbd3f('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 2052b45..e9a7dba 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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x2ef3,0xba));var _0x32ef=function(_0x4916e5,_0x1ac3d4){_0x4916e5=_0x4916e5-0x0;var _0x599368=_0x2ef3[_0x4916e5];return _0x599368;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xadb5,0xad));var _0x5adb=function(_0x5a46ea,_0x2fd14c){_0x5a46ea=_0x5a46ea-0x0;var _0x56ac06=_0xadb5[_0x5a46ea];return _0x56ac06;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7cb49be..e2b899f 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 _0x89e8=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0xa51851,_0x316e78){var _0x5581e6=function(_0x296533){while(--_0x296533){_0xa51851['push'](_0xa51851['shift']());}};_0x5581e6(++_0x316e78);}(_0x89e8,0x74));var _0x889e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x89e8[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x889e('0x0'));var md5=require(_0x889e('0x1'));var util=require(_0x889e('0x2'));var Redis=require(_0x889e('0x3'));var config=require(_0x889e('0x4'));config[_0x889e('0x5')]=_[_0x889e('0x6')](config[_0x889e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x186826){this['id']=_0x186826['id']||0x0;this[_0x889e('0x7')]=_0x186826[_0x889e('0x7')]||'';this['timeout']=_0x186826[_0x889e('0x8')]||0xa;this['strategy']=_0x186826[_0x889e('0x9')]||_0x889e('0xa');this[_0x889e('0xb')]=_0x186826['Agents'];this[_0x889e('0xc')]={};this[_0x889e('0xd')]=0x0;this[_0x889e('0x1')]='';this[_0x889e('0xe')]();this['updateRealtime']();}SmsQueue[_0x889e('0xf')][_0x889e('0xe')]=function(){var _0x5eca9c=this[_0x889e('0xc')][_0x889e('0x10')];this[_0x889e('0xc')]=_[_0x889e('0x11')](this['Agents'],'id');this[_0x889e('0xc')][_0x889e('0x10')]=_0x5eca9c;};SmsQueue[_0x889e('0xf')]['updateRealtime']=function(){this[_0x889e('0x12')]=0x0;this[_0x889e('0x13')]=0x0;for(var _0x2b69db=0x0;_0x2b69db=0x0?this['available']:0x0;var _0x75e219={'id':this['id'],'available':this[_0x889e('0x16')],'loggedIn':this[_0x889e('0x12')],'name':this[_0x889e('0x7')],'paused':this[_0x889e('0x13')],'waiting':this['waiting']};var _0xa1b610=md5(JSON[_0x889e('0x17')](_0x75e219));if(this['md5']!==_0xa1b610){this[_0x889e('0x1')]=_0xa1b610;io['to'](util[_0x889e('0x18')](_0x889e('0x19'),_0x75e219['name']))[_0x889e('0x1a')](_0x889e('0x1b'),_0x75e219);}};module[_0x889e('0x1c')]=SmsQueue; \ No newline at end of file +var _0x19ea=['loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','mapAgentsId','map','_rr'];(function(_0x2f0323,_0x3b9a9f){var _0x45f4fa=function(_0x51bdd4){while(--_0x51bdd4){_0x2f0323['push'](_0x2f0323['shift']());}};_0x45f4fa(++_0x3b9a9f);}(_0x19ea,0xfe));var _0xa19e=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x19ea[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0xa19e('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xa19e('0x1'));var config=require('../../../config/environment');config[_0xa19e('0x2')]=_[_0xa19e('0x3')](config[_0xa19e('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa19e('0x2')]));function SmsQueue(_0x2a8e2c){this['id']=_0x2a8e2c['id']||0x0;this[_0xa19e('0x4')]=_0x2a8e2c[_0xa19e('0x4')]||'';this[_0xa19e('0x5')]=_0x2a8e2c[_0xa19e('0x5')]||0xa;this[_0xa19e('0x6')]=_0x2a8e2c[_0xa19e('0x6')]||_0xa19e('0x7');this[_0xa19e('0x8')]=_0x2a8e2c[_0xa19e('0x8')];this['mapAgentsId']={};this[_0xa19e('0x9')]=0x0;this[_0xa19e('0xa')]='';this[_0xa19e('0xb')]();this[_0xa19e('0xc')]();}SmsQueue['prototype'][_0xa19e('0xb')]=function(){var _0x239829=this[_0xa19e('0xd')]['_rr'];this[_0xa19e('0xd')]=_[_0xa19e('0xe')](this[_0xa19e('0x8')],'id');this[_0xa19e('0xd')][_0xa19e('0xf')]=_0x239829;};SmsQueue['prototype'][_0xa19e('0xc')]=function(){this[_0xa19e('0x10')]=0x0;this[_0xa19e('0x11')]=0x0;for(var _0x28dedd=0x0;_0x28dedd=0x0?this[_0xa19e('0x15')]:0x0;var _0x1f37c4={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa19e('0x10')],'name':this['name'],'paused':this[_0xa19e('0x11')],'waiting':this['waiting']};var _0x5ce913=md5(JSON[_0xa19e('0x16')](_0x1f37c4));if(this[_0xa19e('0xa')]!==_0x5ce913){this['md5']=_0x5ce913;io['to'](util[_0xa19e('0x17')](_0xa19e('0x18'),_0x1f37c4[_0xa19e('0x4')]))[_0xa19e('0x19')]('sms_queue:save',_0x1f37c4);}};module[_0xa19e('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 77589df..a0c4c2a 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 _0x3814=['online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','loggedIn','paused','length'];(function(_0x5d49ae,_0x267f16){var _0x198567=function(_0x390a72){while(--_0x390a72){_0x5d49ae['push'](_0x5d49ae['shift']());}};_0x198567(++_0x267f16);}(_0x3814,0x1f4));var _0x4381=function(_0x2af240,_0x1af5e1){_0x2af240=_0x2af240-0x0;var _0x26976e=_0x3814[_0x2af240];return _0x26976e;};'use strict';var _=require(_0x4381('0x0'));var md5=require(_0x4381('0x1'));var util=require(_0x4381('0x2'));var Redis=require('ioredis');var config=require(_0x4381('0x3'));config[_0x4381('0x4')]=_[_0x4381('0x5')](config[_0x4381('0x4')],{'host':_0x4381('0x6'),'port':0x18eb});var io=require(_0x4381('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x5be21e){this['id']=_0x5be21e['id']||0x0;this[_0x4381('0x8')]=_0x5be21e['name']||'';this[_0x4381('0x9')]=_0x5be21e['timeout']||0xa;this[_0x4381('0xa')]=_0x5be21e['strategy']||_0x4381('0xb');this[_0x4381('0xc')]=_0x5be21e[_0x4381('0xc')];this['mapAgentsId']={};this[_0x4381('0xd')]=0x0;this['md5']='';this[_0x4381('0xe')]();this[_0x4381('0xf')]();}WhatsappQueue['prototype'][_0x4381('0xe')]=function(){var _0xcf3b86=this[_0x4381('0x10')][_0x4381('0x11')];this[_0x4381('0x10')]=_['map'](this[_0x4381('0xc')],'id');this[_0x4381('0x10')]['_rr']=_0xcf3b86;};WhatsappQueue[_0x4381('0x12')]['updateRealtime']=function(){this[_0x4381('0x13')]=0x0;this[_0x4381('0x14')]=0x0;for(var _0x145628=0x0;_0x145628=0x0?this[_0x4381('0x18')]:0x0;var _0x1cadd3={'id':this['id'],'available':this[_0x4381('0x18')],'loggedIn':this[_0x4381('0x13')],'name':this[_0x4381('0x8')],'paused':this['paused'],'waiting':this[_0x4381('0xd')]};var _0x2632d7=md5(JSON['stringify'](_0x1cadd3));if(this[_0x4381('0x1')]!==_0x2632d7){this[_0x4381('0x1')]=_0x2632d7;io['to'](util[_0x4381('0x19')](_0x4381('0x1a'),_0x1cadd3[_0x4381('0x8')]))[_0x4381('0x1b')](_0x4381('0x1c'),_0x1cadd3);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x35fe=['Agents','mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','paused','length','online','loggedIn','whatsappPause','available','whatsapp:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','beepall'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x35fe,0x148));var _0xe35f=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x35fe[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var md5=require(_0xe35f('0x0'));var util=require('util');var Redis=require(_0xe35f('0x1'));var config=require(_0xe35f('0x2'));config[_0xe35f('0x3')]=_['defaults'](config[_0xe35f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xe35f('0x4'))(new Redis(config['redis']));function WhatsappQueue(_0x5f3e52){this['id']=_0x5f3e52['id']||0x0;this[_0xe35f('0x5')]=_0x5f3e52[_0xe35f('0x5')]||'';this[_0xe35f('0x6')]=_0x5f3e52[_0xe35f('0x6')]||0xa;this['strategy']=_0x5f3e52['strategy']||_0xe35f('0x7');this[_0xe35f('0x8')]=_0x5f3e52[_0xe35f('0x8')];this[_0xe35f('0x9')]={};this['waiting']=0x0;this[_0xe35f('0x0')]='';this[_0xe35f('0xa')]();this['updateRealtime']();}WhatsappQueue[_0xe35f('0xb')][_0xe35f('0xa')]=function(){var _0x40b0ca=this[_0xe35f('0x9')]['_rr'];this['mapAgentsId']=_[_0xe35f('0xc')](this['Agents'],'id');this[_0xe35f('0x9')][_0xe35f('0xd')]=_0x40b0ca;};WhatsappQueue[_0xe35f('0xb')][_0xe35f('0xe')]=function(){this['loggedIn']=0x0;this[_0xe35f('0xf')]=0x0;for(var _0x56c166=0x0;_0x56c166=0x0?this[_0xe35f('0x14')]:0x0;var _0x2721b2={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe35f('0x12')],'name':this[_0xe35f('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x5d5b15=md5(JSON['stringify'](_0x2721b2));if(this[_0xe35f('0x0')]!==_0x5d5b15){this[_0xe35f('0x0')]=_0x5d5b15;io['to'](util['format'](_0xe35f('0x15'),_0x2721b2[_0xe35f('0x5')]))[_0xe35f('0x16')]('whatsapp_queue:save',_0x2721b2);}};module[_0xe35f('0x17')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3a06b33..7d3c071 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x226131,_0xd16de0){var _0x116670=function(_0x4c9e08){while(--_0x4c9e08){_0x226131['push'](_0x226131['shift']());}};_0x116670(++_0xd16de0);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bec61,_0x3a04b8){_0x3bec61=_0x3bec61-0x0;var _0x4bf6d2=_0xb10b[_0x3bec61];return _0x4bf6d2;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 59cc1ed..bab6c1b 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 _0xb4a5=['update','UpdateChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb4a5,0xaf));var _0x5b4a=function(_0x34629a,_0xb9e40a){_0x34629a=_0x34629a-0x0;var _0x2733b1=_0xb4a5[_0x34629a];return _0x2733b1;};'use strict';var client=require(_0x5b4a('0x0'));exports[_0x5b4a('0x1')]=function(_0x344b63,_0x56799a){return client['Request'](_0x5b4a('0x2'),{'body':_0x56799a,'options':{'where':{'id':_0x344b63}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x22d711,_0x3c1d5e){return client['Request']('AddTagsToChatInteraction',{'body':_0x3c1d5e,'options':{'where':{'id':_0x22d711}},'log':_0x5b4a('0x3')});}; \ No newline at end of file +var _0x5713=['addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0x5713,0x166));var _0x3571=function(_0x4d338d,_0x42b9cd){_0x4d338d=_0x4d338d-0x0;var _0x12cc06=_0x5713[_0x4d338d];return _0x12cc06;};'use strict';var client=require('../client');exports[_0x3571('0x0')]=function(_0x22408a,_0x134fb3){return client[_0x3571('0x1')](_0x3571('0x2'),{'body':_0x134fb3,'options':{'where':{'id':_0x22408a}},'log':_0x3571('0x3')});};exports[_0x3571('0x4')]=function(_0x3472f4,_0x40512c){return client['Request'](_0x3571('0x5'),{'body':_0x40512c,'options':{'where':{'id':_0x3472f4}},'log':_0x3571('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index d460d5a..c6e3efc 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 _0x1efb=['Request','createChatMessage','../client','create'];(function(_0x14e22a,_0x36be5a){var _0x4e162e=function(_0x4ab884){while(--_0x4ab884){_0x14e22a['push'](_0x14e22a['shift']());}};_0x4e162e(++_0x36be5a);}(_0x1efb,0x76));var _0xb1ef=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1efb[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xb1ef('0x0'));exports[_0xb1ef('0x1')]=function(_0x216bb4){return client[_0xb1ef('0x2')]('CreateChatMessage',{'body':_0x216bb4,'log':_0xb1ef('0x3')});}; \ No newline at end of file +var _0xde23=['createChatMessage','create','Request'];(function(_0x267368,_0x567515){var _0xa1c715=function(_0x4779b4){while(--_0x4779b4){_0x267368['push'](_0x267368['shift']());}};_0xa1c715(++_0x567515);}(_0xde23,0xb2));var _0x3de2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde23[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x3de2('0x0')]=function(_0x39ca53){return client[_0x3de2('0x1')]('CreateChatMessage',{'body':_0x39ca53,'log':_0x3de2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 26c631c..87ef274 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 _0xab29=['User','Agents','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0xab29,0x145));var _0x9ab2=function(_0x22ac5e,_0x4c6288){_0x22ac5e=_0x22ac5e-0x0;var _0x2cd38c=_0xab29[_0x22ac5e];return _0x2cd38c;};'use strict';var client=require(_0x9ab2('0x0'));exports[_0x9ab2('0x1')]=function(){return function(){return client[_0x9ab2('0x2')](_0x9ab2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9ab2('0x4'),'strategy'],'include':[{'model':_0x9ab2('0x5'),'as':_0x9ab2('0x6'),'attributes':['id',_0x9ab2('0x7'),_0x9ab2('0x8'),_0x9ab2('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xe4d9=['chatPause','../client','getChatQueues','Request','name','User','Agents','online'];(function(_0x19cdf8,_0x371f0a){var _0x59c582=function(_0x4dd7ce){while(--_0x4dd7ce){_0x19cdf8['push'](_0x19cdf8['shift']());}};_0x59c582(++_0x371f0a);}(_0xe4d9,0x141));var _0x9e4d=function(_0x125068,_0x136ee3){_0x125068=_0x125068-0x0;var _0xd2233d=_0xe4d9[_0x125068];return _0xd2233d;};'use strict';var client=require(_0x9e4d('0x0'));exports[_0x9e4d('0x1')]=function(){return function(){return client[_0x9e4d('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x9e4d('0x3'),'timeout','strategy'],'include':[{'model':_0x9e4d('0x4'),'as':_0x9e4d('0x5'),'attributes':['id','name',_0x9e4d('0x6'),_0x9e4d('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8e096a3..5f3df62 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 _0xd52a=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x4266b4,_0x4859ad){var _0x1442aa=function(_0x21f8c1){while(--_0x21f8c1){_0x4266b4['push'](_0x4266b4['shift']());}};_0x1442aa(++_0x4859ad);}(_0xd52a,0xca));var _0xad52=function(_0x4dcefa,_0x4f5468){_0x4dcefa=_0x4dcefa-0x0;var _0x3f0c21=_0xd52a[_0x4dcefa];return _0x3f0c21;};'use strict';var client=require('../client');exports[_0xad52('0x0')]=function(_0x5e6aa7){return client[_0xad52('0x1')](_0xad52('0x2'),{'body':_0x5e6aa7,'log':_0xad52('0x2')});};exports['update']=function(_0x3f4207,_0x383c44){return client[_0xad52('0x1')](_0xad52('0x3'),{'body':_0x383c44,'options':{'where':{'uniqueid':_0x3f4207},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe105=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x376a22,_0x454f22){var _0x45e054=function(_0x4b86e4){while(--_0x4b86e4){_0x376a22['push'](_0x376a22['shift']());}};_0x45e054(++_0x454f22);}(_0xe105,0xef));var _0x5e10=function(_0x249d4d,_0x33138c){_0x249d4d=_0x249d4d-0x0;var _0x2e71c9=_0xe105[_0x249d4d];return _0x2e71c9;};'use strict';var client=require(_0x5e10('0x0'));exports['create']=function(_0x4d5a73){return client['Request']('CreateChatQueueReport',{'body':_0x4d5a73,'log':_0x5e10('0x1')});};exports[_0x5e10('0x2')]=function(_0x1cddb3,_0x191ab2){return client['Request'](_0x5e10('0x3'),{'body':_0x191ab2,'options':{'where':{'uniqueid':_0x1cddb3},'order':[['id',_0x5e10('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 925dc62..1056d6e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x36ad90,_0x15b1f9){var _0x710ae7=function(_0x40743e){while(--_0x40743e){_0x36ad90['push'](_0x36ad90['shift']());}};_0x710ae7(++_0x15b1f9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2170af,_0x4830f9){var _0x2c359c=function(_0x1bba2b){while(--_0x1bba2b){_0x2170af['push'](_0x2170af['shift']());}};_0x2c359c(++_0x4830f9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 4b03917..94ceb93 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 _0x1dfd=['../client','create','createFaxMessage'];(function(_0x13f2d6,_0x1cbf18){var _0x4a8b4f=function(_0x43753a){while(--_0x43753a){_0x13f2d6['push'](_0x13f2d6['shift']());}};_0x4a8b4f(++_0x1cbf18);}(_0x1dfd,0x18f));var _0xd1df=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1dfd[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xd1df('0x0'));exports[_0xd1df('0x1')]=function(_0x105163){return client['Request']('CreateFaxMessage',{'body':_0x105163,'log':_0xd1df('0x2')});}; \ No newline at end of file +var _0xfc3d=['../client','create','Request','createFaxMessage'];(function(_0x2ae5e5,_0x1a00b0){var _0x5d4111=function(_0x1cb579){while(--_0x1cb579){_0x2ae5e5['push'](_0x2ae5e5['shift']());}};_0x5d4111(++_0x1a00b0);}(_0xfc3d,0x124));var _0xdfc3=function(_0x17b4af,_0x59a67c){_0x17b4af=_0x17b4af-0x0;var _0x2d758f=_0xfc3d[_0x17b4af];return _0x2d758f;};'use strict';var client=require(_0xdfc3('0x0'));exports[_0xdfc3('0x1')]=function(_0x5f8042){return client[_0xdfc3('0x2')]('CreateFaxMessage',{'body':_0x5f8042,'log':_0xdfc3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 7ed3e53..27ab962 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 _0xe652=['GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','getFaxQueues','../client','Request'];(function(_0x33c59f,_0xc6023f){var _0x372991=function(_0x43f3af){while(--_0x43f3af){_0x33c59f['push'](_0x33c59f['shift']());}};_0x372991(++_0xc6023f);}(_0xe652,0x1c1));var _0x2e65=function(_0x4a8c74,_0x46a6ab){_0x4a8c74=_0x4a8c74-0x0;var _0x536ad8=_0xe652[_0x4a8c74];return _0x536ad8;};'use strict';var client=require(_0x2e65('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2e65('0x1')](_0x2e65('0x2'),{'options':{'raw':![],'attributes':['id',_0x2e65('0x3'),_0x2e65('0x4'),_0x2e65('0x5')],'include':[{'model':_0x2e65('0x6'),'as':_0x2e65('0x7'),'attributes':['id',_0x2e65('0x3'),_0x2e65('0x8'),_0x2e65('0x9')]}]},'log':_0x2e65('0xa')});};}; \ No newline at end of file +var _0xf14e=['name','timeout','User','Agents','../client','getFaxQueues'];(function(_0x292d90,_0xd9a51e){var _0x2ecf23=function(_0x35ddf2){while(--_0x35ddf2){_0x292d90['push'](_0x292d90['shift']());}};_0x2ecf23(++_0xd9a51e);}(_0xf14e,0x1a2));var _0xef14=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf14e[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require(_0xef14('0x0'));exports[_0xef14('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xef14('0x2'),_0xef14('0x3'),'strategy'],'include':[{'model':_0xef14('0x4'),'as':_0xef14('0x5'),'attributes':['id','name','online','faxPause']}]},'log':_0xef14('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 490ec33..2439267 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 _0xdb73=['DESC','../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x30a111,_0x22c113){var _0x5a95b9=function(_0x27db7e){while(--_0x27db7e){_0x30a111['push'](_0x30a111['shift']());}};_0x5a95b9(++_0x22c113);}(_0xdb73,0x1eb));var _0x3db7=function(_0x192f5e,_0x44dbd7){_0x192f5e=_0x192f5e-0x0;var _0x2ff03b=_0xdb73[_0x192f5e];return _0x2ff03b;};'use strict';var client=require(_0x3db7('0x0'));exports['create']=function(_0x236ed0){return client[_0x3db7('0x1')](_0x3db7('0x2'),{'body':_0x236ed0,'log':'CreateFaxQueueReport'});};exports['update']=function(_0xcd152e,_0x52b305){return client[_0x3db7('0x1')](_0x3db7('0x3'),{'body':_0x52b305,'options':{'where':{'uniqueid':_0xcd152e},'order':[['id',_0x3db7('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x736b=['DESC','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3062da,_0x352b8f){var _0x1c95ba=function(_0x203c3e){while(--_0x203c3e){_0x3062da['push'](_0x3062da['shift']());}};_0x1c95ba(++_0x352b8f);}(_0x736b,0x9d));var _0xb736=function(_0x5aaf30,_0x10a43b){_0x5aaf30=_0x5aaf30-0x0;var _0x95673e=_0x736b[_0x5aaf30];return _0x95673e;};'use strict';var client=require('../client');exports[_0xb736('0x0')]=function(_0x335c3a){return client[_0xb736('0x1')](_0xb736('0x2'),{'body':_0x335c3a,'log':_0xb736('0x2')});};exports[_0xb736('0x3')]=function(_0x4b571b,_0x519cda){return client['Request'](_0xb736('0x4'),{'body':_0x519cda,'options':{'where':{'uniqueid':_0x4b571b},'order':[['id',_0xb736('0x5')]],'limit':0x1},'log':_0xb736('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8889ec5..69cce48 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 _0x8d14=['getIntervals','Request','GetInterval','name','Interval','interval','../client'];(function(_0x1b8baf,_0x29b919){var _0x41d2f4=function(_0x499fc0){while(--_0x499fc0){_0x1b8baf['push'](_0x1b8baf['shift']());}};_0x41d2f4(++_0x29b919);}(_0x8d14,0xdf));var _0x48d1=function(_0x46a9af,_0x2e7fdc){_0x46a9af=_0x46a9af-0x0;var _0x30a0d8=_0x8d14[_0x46a9af];return _0x30a0d8;};'use strict';var client=require(_0x48d1('0x0'));exports[_0x48d1('0x1')]=function(){return function(){return client[_0x48d1('0x2')](_0x48d1('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x48d1('0x4')],'include':[{'model':_0x48d1('0x5'),'as':'Intervals','attributes':['id',_0x48d1('0x4'),_0x48d1('0x6')]}]},'log':_0x48d1('0x1')});};}; \ No newline at end of file +var _0x437a=['getIntervals','Request','GetInterval','Interval','Intervals','name'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x437a,0x17a));var _0xa437=function(_0x27fdf9,_0x2ea7bd){_0x27fdf9=_0x27fdf9-0x0;var _0x13a909=_0x437a[_0x27fdf9];return _0x13a909;};'use strict';var client=require('../client');exports[_0xa437('0x0')]=function(){return function(){return client[_0xa437('0x1')](_0xa437('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xa437('0x3'),'as':_0xa437('0x4'),'attributes':['id',_0xa437('0x5'),'interval']}]},'log':_0xa437('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f447b86..be70379 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 _0x1a85=['AddTagsToMailInteraction','Request','addTags'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1a85,0x178));var _0x51a8=function(_0x37cc4c,_0x288c26){_0x37cc4c=_0x37cc4c-0x0;var _0x425695=_0x1a85[_0x37cc4c];return _0x425695;};'use strict';var client=require('../client');exports['update']=function(_0x305f18,_0x382cb8){return client[_0x51a8('0x0')]('UpdateMailInteraction',{'body':_0x382cb8,'options':{'where':{'id':_0x305f18}},'log':'updateMailInteraction'});};exports[_0x51a8('0x1')]=function(_0x1377a4,_0x99e371){return client['Request'](_0x51a8('0x2'),{'body':_0x99e371,'options':{'where':{'id':_0x1377a4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf2e3=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf2e3[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x3f2e('0x0'));exports['update']=function(_0x143e9e,_0x231b2b){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'body':_0x231b2b,'options':{'where':{'id':_0x143e9e}},'log':_0x3f2e('0x3')});};exports[_0x3f2e('0x4')]=function(_0x3938e2,_0xabcf5c){return client[_0x3f2e('0x1')]('AddTagsToMailInteraction',{'body':_0xabcf5c,'options':{'where':{'id':_0x3938e2}},'log':_0x3f2e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a98242a..19c4cf4 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 _0x9776=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x9776,0xdd));var _0x6977=function(_0xafcb48,_0xbb0709){_0xafcb48=_0xafcb48-0x0;var _0x1b214a=_0x9776[_0xafcb48];return _0x1b214a;};'use strict';var client=require(_0x6977('0x0'));exports['create']=function(_0x515c83){return client[_0x6977('0x1')](_0x6977('0x2'),{'body':_0x515c83,'log':_0x6977('0x3')});}; \ No newline at end of file +var _0x6c71=['create','createMailMessage','../client'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x6c71,0x170));var _0x16c7=function(_0x572736,_0x35e723){_0x572736=_0x572736-0x0;var _0x231515=_0x6c71[_0x572736];return _0x231515;};'use strict';var client=require(_0x16c7('0x0'));exports[_0x16c7('0x1')]=function(_0x39b2ab){return client['Request']('CreateMailMessage',{'body':_0x39b2ab,'log':_0x16c7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8973918..aaf70ae 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 _0x077e=['../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','name','online','mailPause'];(function(_0x420dd3,_0x442318){var _0x34b5cd=function(_0x13c3ea){while(--_0x13c3ea){_0x420dd3['push'](_0x420dd3['shift']());}};_0x34b5cd(++_0x442318);}(_0x077e,0x14a));var _0xe077=function(_0x3907dd,_0x4de06d){_0x3907dd=_0x3907dd-0x0;var _0x49334c=_0x077e[_0x3907dd];return _0x49334c;};'use strict';var client=require(_0xe077('0x0'));exports[_0xe077('0x1')]=function(){return function(){return client[_0xe077('0x2')](_0xe077('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe077('0x4'),_0xe077('0x5')],'include':[{'model':_0xe077('0x6'),'as':'Agents','attributes':['id',_0xe077('0x7'),_0xe077('0x8'),_0xe077('0x9')]}]},'log':_0xe077('0x1')});};}; \ No newline at end of file +var _0xcd0d=['online','mailPause','getMailQueues','../client','Request','GetMailQueue','name','strategy','User','Agents'];(function(_0x475132,_0x5a0bce){var _0x461dae=function(_0x399cef){while(--_0x399cef){_0x475132['push'](_0x475132['shift']());}};_0x461dae(++_0x5a0bce);}(_0xcd0d,0xa3));var _0xdcd0=function(_0x13d915,_0x306818){_0x13d915=_0x13d915-0x0;var _0x3e1907=_0xcd0d[_0x13d915];return _0x3e1907;};'use strict';var client=require(_0xdcd0('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xdcd0('0x1')](_0xdcd0('0x2'),{'options':{'raw':![],'attributes':['id',_0xdcd0('0x3'),'timeout',_0xdcd0('0x4')],'include':[{'model':_0xdcd0('0x5'),'as':_0xdcd0('0x6'),'attributes':['id',_0xdcd0('0x3'),_0xdcd0('0x7'),_0xdcd0('0x8')]}]},'log':_0xdcd0('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0830c39..5565c68 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 _0xd4b0=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x4c73f1,_0x3da813){var _0x3dc834=function(_0x3dff43){while(--_0x3dff43){_0x4c73f1['push'](_0x4c73f1['shift']());}};_0x3dc834(++_0x3da813);}(_0xd4b0,0x153));var _0x0d4b=function(_0xf2c763,_0x42d01a){_0xf2c763=_0xf2c763-0x0;var _0x581cb4=_0xd4b0[_0xf2c763];return _0x581cb4;};'use strict';var client=require(_0x0d4b('0x0'));exports[_0x0d4b('0x1')]=function(_0xa77350){return client[_0x0d4b('0x2')](_0x0d4b('0x3'),{'body':_0xa77350,'log':'CreateMailQueueReport'});};exports[_0x0d4b('0x4')]=function(_0x52d6e6,_0x176457){return client[_0x0d4b('0x2')](_0x0d4b('0x5'),{'body':_0x176457,'options':{'where':{'uniqueid':_0x52d6e6},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xb9aa=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb9aa,0x185));var _0xab9a=function(_0x2fc0f2,_0x1fa2f6){_0x2fc0f2=_0x2fc0f2-0x0;var _0xd42d53=_0xb9aa[_0x2fc0f2];return _0xd42d53;};'use strict';var client=require(_0xab9a('0x0'));exports[_0xab9a('0x1')]=function(_0x4754ee){return client[_0xab9a('0x2')](_0xab9a('0x3'),{'body':_0x4754ee,'log':_0xab9a('0x3')});};exports[_0xab9a('0x4')]=function(_0x247eeb,_0xf02bf0){return client[_0xab9a('0x2')]('UpdateMailQueueReport',{'body':_0xf02bf0,'options':{'where':{'uniqueid':_0x247eeb},'order':[['id',_0xab9a('0x5')]],'limit':0x1},'log':_0xab9a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e28fb17..210e51e 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 _0x3afe=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x2a9153,_0x44fd73){var _0x2f6615=function(_0x3d50c9){while(--_0x3d50c9){_0x2a9153['push'](_0x2a9153['shift']());}};_0x2f6615(++_0x44fd73);}(_0x3afe,0x15b));var _0xe3af=function(_0x2caa3c,_0x3cc8bc){_0x2caa3c=_0x2caa3c-0x0;var _0x204fe2=_0x3afe[_0x2caa3c];return _0x204fe2;};'use strict';var client=require(_0xe3af('0x0'));exports['update']=function(_0x4e7a25,_0xf4ac43){return client['Request'](_0xe3af('0x1'),{'body':_0xf4ac43,'options':{'where':{'id':_0x4e7a25}},'log':_0xe3af('0x2')});};exports[_0xe3af('0x3')]=function(_0x11a08c,_0x1eb849){return client['Request'](_0xe3af('0x4'),{'body':_0x1eb849,'options':{'where':{'id':_0x11a08c}},'log':_0xe3af('0x5')});}; \ No newline at end of file +var _0xef04=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x480fa7,_0x435691){var _0xc26afd=function(_0x5659c7){while(--_0x5659c7){_0x480fa7['push'](_0x480fa7['shift']());}};_0xc26afd(++_0x435691);}(_0xef04,0x96));var _0x4ef0=function(_0xd4aab1,_0x281c3c){_0xd4aab1=_0xd4aab1-0x0;var _0xf16259=_0xef04[_0xd4aab1];return _0xf16259;};'use strict';var client=require(_0x4ef0('0x0'));exports[_0x4ef0('0x1')]=function(_0x46c30a,_0x38d1fb){return client[_0x4ef0('0x2')](_0x4ef0('0x3'),{'body':_0x38d1fb,'options':{'where':{'id':_0x46c30a}},'log':_0x4ef0('0x4')});};exports[_0x4ef0('0x5')]=function(_0xcb4b57,_0x55b10e){return client[_0x4ef0('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x55b10e,'options':{'where':{'id':_0xcb4b57}},'log':_0x4ef0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 86272d8..8c396bc 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 _0x169f=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x34ed75,_0x14fbfe){var _0x126a10=function(_0x115827){while(--_0x115827){_0x34ed75['push'](_0x34ed75['shift']());}};_0x126a10(++_0x14fbfe);}(_0x169f,0xea));var _0xf169=function(_0x3eec31,_0xf46d99){_0x3eec31=_0x3eec31-0x0;var _0x4e0dc1=_0x169f[_0x3eec31];return _0x4e0dc1;};'use strict';var client=require(_0xf169('0x0'));exports[_0xf169('0x1')]=function(_0x2339d0){return client[_0xf169('0x2')](_0xf169('0x3'),{'body':_0x2339d0,'log':_0xf169('0x4')});}; \ No newline at end of file +var _0x86c7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x86c7,0x1d3));var _0x786c=function(_0x26f3c6,_0x1d03e8){_0x26f3c6=_0x26f3c6-0x0;var _0x367018=_0x86c7[_0x26f3c6];return _0x367018;};'use strict';var client=require(_0x786c('0x0'));exports[_0x786c('0x1')]=function(_0x36cc4d){return client[_0x786c('0x2')](_0x786c('0x3'),{'body':_0x36cc4d,'log':_0x786c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 48e0814..6952f2b 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 _0x7114=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','User'];(function(_0x433920,_0x3059eb){var _0x183996=function(_0x3ef728){while(--_0x3ef728){_0x433920['push'](_0x433920['shift']());}};_0x183996(++_0x3059eb);}(_0x7114,0xd2));var _0x4711=function(_0x59c9ea,_0x331689){_0x59c9ea=_0x59c9ea-0x0;var _0x4d2bfc=_0x7114[_0x59c9ea];return _0x4d2bfc;};'use strict';var client=require(_0x4711('0x0'));exports[_0x4711('0x1')]=function(){return function(){return client[_0x4711('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4711('0x3'),_0x4711('0x4'),'strategy'],'include':[{'model':_0x4711('0x5'),'as':_0x4711('0x6'),'attributes':['id',_0x4711('0x3'),_0x4711('0x7'),_0x4711('0x8')]}]},'log':_0x4711('0x1')});};}; \ No newline at end of file +var _0x93d3=['Request','User','Agents','name','../client'];(function(_0x2a7fbe,_0x59ca12){var _0x52ad4d=function(_0x2dbbce){while(--_0x2dbbce){_0x2a7fbe['push'](_0x2a7fbe['shift']());}};_0x52ad4d(++_0x59ca12);}(_0x93d3,0x1e9));var _0x393d=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x93d3[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require(_0x393d('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x393d('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x393d('0x2'),'as':_0x393d('0x3'),'attributes':['id',_0x393d('0x4'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c95d1c0..093d63e 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 _0x0490=['UpdateOpenchannelQueueReport','DESC','create','update','Request'];(function(_0x399445,_0x2b732e){var _0x220cc0=function(_0x11ae31){while(--_0x11ae31){_0x399445['push'](_0x399445['shift']());}};_0x220cc0(++_0x2b732e);}(_0x0490,0x147));var _0x0049=function(_0x1d2aa2,_0xa1ae51){_0x1d2aa2=_0x1d2aa2-0x0;var _0x110fc3=_0x0490[_0x1d2aa2];return _0x110fc3;};'use strict';var client=require('../client');exports[_0x0049('0x0')]=function(_0x5f5313){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x5f5313,'log':'CreateOpenchannelQueueReport'});};exports[_0x0049('0x1')]=function(_0x3b1b70,_0x435d2d){return client[_0x0049('0x2')](_0x0049('0x3'),{'body':_0x435d2d,'options':{'where':{'uniqueid':_0x3b1b70},'order':[['id',_0x0049('0x4')]],'limit':0x1},'log':_0x0049('0x3')});}; \ No newline at end of file +var _0xa596=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_0xa596,0x7b));var _0x6a59=function(_0x10dfb1,_0x45277a){_0x10dfb1=_0x10dfb1-0x0;var _0x275e68=_0xa596[_0x10dfb1];return _0x275e68;};'use strict';var client=require(_0x6a59('0x0'));exports[_0x6a59('0x1')]=function(_0x5b127f){return client[_0x6a59('0x2')](_0x6a59('0x3'),{'body':_0x5b127f,'log':_0x6a59('0x3')});};exports[_0x6a59('0x4')]=function(_0x2922e5,_0xf0435f){return client[_0x6a59('0x2')](_0x6a59('0x5'),{'body':_0xf0435f,'options':{'where':{'uniqueid':_0x2922e5},'order':[['id','DESC']],'limit':0x1},'log':_0x6a59('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 426be13..aa53818 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 _0x34aa=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x5721d7,_0x3908cd){var _0x504bbe=function(_0x5a7c32){while(--_0x5a7c32){_0x5721d7['push'](_0x5721d7['shift']());}};_0x504bbe(++_0x3908cd);}(_0x34aa,0x171));var _0xa34a=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x34aa[_0x54f7c0];return _0x245d03;};'use strict';var client=require(_0xa34a('0x0'));exports['update']=function(_0x2a4773,_0x1cc043){return client[_0xa34a('0x1')](_0xa34a('0x2'),{'body':_0x1cc043,'options':{'where':{'id':_0x2a4773}},'log':'updateSmsInteraction'});};exports[_0xa34a('0x3')]=function(_0x30f3a2,_0x284561){return client[_0xa34a('0x1')](_0xa34a('0x4'),{'body':_0x284561,'options':{'where':{'id':_0x30f3a2}},'log':_0xa34a('0x5')});}; \ No newline at end of file +var _0x85d8=['../client','update','Request','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x51785c,_0x33d72c){var _0x26dd6c=function(_0x2dcbeb){while(--_0x2dcbeb){_0x51785c['push'](_0x51785c['shift']());}};_0x26dd6c(++_0x33d72c);}(_0x85d8,0x1b0));var _0x885d=function(_0x1d4831,_0x4fd14a){_0x1d4831=_0x1d4831-0x0;var _0x94dd41=_0x85d8[_0x1d4831];return _0x94dd41;};'use strict';var client=require(_0x885d('0x0'));exports[_0x885d('0x1')]=function(_0x347816,_0x763604){return client[_0x885d('0x2')]('UpdateSmsInteraction',{'body':_0x763604,'options':{'where':{'id':_0x347816}},'log':_0x885d('0x3')});};exports[_0x885d('0x4')]=function(_0x320d7d,_0x3fe8a0){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3fe8a0,'options':{'where':{'id':_0x320d7d}},'log':_0x885d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 58cc054..4980823 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 _0x7b14=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x56b9bd,_0x48f4c0){var _0x13985f=function(_0x3c618c){while(--_0x3c618c){_0x56b9bd['push'](_0x56b9bd['shift']());}};_0x13985f(++_0x48f4c0);}(_0x7b14,0x1d6));var _0x47b1=function(_0x16503f,_0x4ffbb9){_0x16503f=_0x16503f-0x0;var _0x583569=_0x7b14[_0x16503f];return _0x583569;};'use strict';var client=require(_0x47b1('0x0'));exports[_0x47b1('0x1')]=function(_0x3f6a54){return client[_0x47b1('0x2')](_0x47b1('0x3'),{'body':_0x3f6a54,'log':_0x47b1('0x4')});}; \ No newline at end of file +var _0x49e3=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x48bb36,_0x401939){var _0x1f3dd8=function(_0x4c8b19){while(--_0x4c8b19){_0x48bb36['push'](_0x48bb36['shift']());}};_0x1f3dd8(++_0x401939);}(_0x49e3,0x155));var _0x349e=function(_0x2fbb95,_0x3a9af6){_0x2fbb95=_0x2fbb95-0x0;var _0x2b9ecb=_0x49e3[_0x2fbb95];return _0x2b9ecb;};'use strict';var client=require(_0x349e('0x0'));exports['create']=function(_0x3a9a95){return client[_0x349e('0x1')](_0x349e('0x2'),{'body':_0x3a9a95,'log':_0x349e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c1ee552..5000b95 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(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_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(_0x54d808,_0x59f15b){var _0x2bb92b=function(_0x2b3c9d){while(--_0x2b3c9d){_0x54d808['push'](_0x54d808['shift']());}};_0x2bb92b(++_0x59f15b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xb7e7[_0x1c8c28];return _0x1f59b4;};'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 0faaf7b..4a5dac3 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x187e22,_0x29da1e){var _0x279660=function(_0x8c7459){while(--_0x8c7459){_0x187e22['push'](_0x187e22['shift']());}};_0x279660(++_0x29da1e);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x562163,_0x264e2a){var _0x551eed=function(_0x5ecde8){while(--_0x5ecde8){_0x562163['push'](_0x562163['shift']());}};_0x551eed(++_0x264e2a);}(_0x70e0,0x17b));var _0x070e=function(_0x34d9bb,_0x4e607a){_0x34d9bb=_0x34d9bb-0x0;var _0x5ee63e=_0x70e0[_0x34d9bb];return _0x5ee63e;};'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 bab5e8d..2d84caa 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(_0x655502,_0x21ec11){var _0x3aaddb=function(_0x11a2f7){while(--_0x11a2f7){_0x655502['push'](_0x655502['shift']());}};_0x3aaddb(++_0x21ec11);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x2889a7,_0xc99e77){var _0x543ea0=function(_0x2509fb){while(--_0x2509fb){_0x2889a7['push'](_0x2889a7['shift']());}};_0x543ea0(++_0xc99e77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 8241112..328f7aa 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 _0x68fd=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x3da1c5,_0x53f43f){var _0x20d262=function(_0x5b914f){while(--_0x5b914f){_0x3da1c5['push'](_0x3da1c5['shift']());}};_0x20d262(++_0x53f43f);}(_0x68fd,0x1e9));var _0xd68f=function(_0x4e5dd0,_0x3a07b6){_0x4e5dd0=_0x4e5dd0-0x0;var _0x4fb52e=_0x68fd[_0x4e5dd0];return _0x4fb52e;};'use strict';var client=require(_0xd68f('0x0'));exports['update']=function(_0x17591d,_0x1492a9){return client['Request'](_0xd68f('0x1'),{'body':_0x1492a9,'options':{'where':{'id':_0x17591d}},'log':_0xd68f('0x2')});};exports[_0xd68f('0x3')]=function(_0x3e5e78,_0x37c481){return client[_0xd68f('0x4')](_0xd68f('0x5'),{'body':_0x37c481,'options':{'where':{'id':_0x3e5e78}},'log':_0xd68f('0x6')});}; \ No newline at end of file +var _0x565f=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0xcdad31,_0x17c0b4){var _0x4f6190=function(_0x3c21dd){while(--_0x3c21dd){_0xcdad31['push'](_0xcdad31['shift']());}};_0x4f6190(++_0x17c0b4);}(_0x565f,0x68));var _0xf565=function(_0x47b273,_0x34a49a){_0x47b273=_0x47b273-0x0;var _0x41185b=_0x565f[_0x47b273];return _0x41185b;};'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 e521de8..bcc0e16 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 _0x680f=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x4cbe7a,_0x13614a){var _0x39a440=function(_0x587585){while(--_0x587585){_0x4cbe7a['push'](_0x4cbe7a['shift']());}};_0x39a440(++_0x13614a);}(_0x680f,0x1aa));var _0xf680=function(_0x5438b6,_0x446306){_0x5438b6=_0x5438b6-0x0;var _0x4680fa=_0x680f[_0x5438b6];return _0x4680fa;};'use strict';var client=require(_0xf680('0x0'));exports[_0xf680('0x1')]=function(_0x422406){return client['Request'](_0xf680('0x2'),{'body':_0x422406,'log':_0xf680('0x3')});}; \ No newline at end of file +var _0xec8e=['createWhatsappMessage','create','Request'];(function(_0x419c8e,_0x232f0a){var _0x478913=function(_0x398e32){while(--_0x398e32){_0x419c8e['push'](_0x419c8e['shift']());}};_0x478913(++_0x232f0a);}(_0xec8e,0x193));var _0xeec8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec8e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xeec8('0x0')]=function(_0x4a51f7){return client[_0xeec8('0x1')]('CreateWhatsappMessage',{'body':_0x4a51f7,'log':_0xeec8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 391fe41..03fcbdd 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 _0xc3e0=['strategy','online','../client','getWhatsappQueues','Request','name','timeout'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc3e0,0x191));var _0x0c3e=function(_0xa4cc69,_0x10b37d){_0xa4cc69=_0xa4cc69-0x0;var _0x1cd40a=_0xc3e0[_0xa4cc69];return _0x1cd40a;};'use strict';var client=require(_0x0c3e('0x0'));exports[_0x0c3e('0x1')]=function(){return function(){return client[_0x0c3e('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x0c3e('0x3'),_0x0c3e('0x4'),_0x0c3e('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x0c3e('0x6'),'whatsappPause']}]},'log':_0x0c3e('0x1')});};}; \ No newline at end of file +var _0x40a3=['getWhatsappQueues','../client','GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x40a3,0x13c));var _0x340a=function(_0x28565f,_0x4463f7){_0x28565f=_0x28565f-0x0;var _0x1f00a5=_0x40a3[_0x28565f];return _0x1f00a5;};'use strict';var client=require(_0x340a('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x340a('0x1'),{'options':{'raw':![],'attributes':['id',_0x340a('0x2'),'timeout',_0x340a('0x3')],'include':[{'model':_0x340a('0x4'),'as':_0x340a('0x5'),'attributes':['id',_0x340a('0x2'),_0x340a('0x6'),_0x340a('0x7')]}]},'log':_0x340a('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a16646b..def144f 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 _0x2550=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x420e3d,_0x4fa509){var _0x15fd28=function(_0xe4818b){while(--_0xe4818b){_0x420e3d['push'](_0x420e3d['shift']());}};_0x15fd28(++_0x4fa509);}(_0x2550,0xb6));var _0x0255=function(_0x270819,_0x481445){_0x270819=_0x270819-0x0;var _0xcb2e37=_0x2550[_0x270819];return _0xcb2e37;};'use strict';var client=require(_0x0255('0x0'));exports[_0x0255('0x1')]=function(_0x40a2e3){return client[_0x0255('0x2')](_0x0255('0x3'),{'body':_0x40a2e3,'log':'CreateWhatsappQueueReport'});};exports[_0x0255('0x4')]=function(_0x19efad,_0x4243d3){return client[_0x0255('0x2')](_0x0255('0x5'),{'body':_0x4243d3,'options':{'where':{'uniqueid':_0x19efad},'order':[['id',_0x0255('0x6')]],'limit':0x1},'log':_0x0255('0x5')});}; \ No newline at end of file +var _0xaee7=['../client','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x5993bf,_0x2b0843){var _0x4cea01=function(_0x29282b){while(--_0x29282b){_0x5993bf['push'](_0x5993bf['shift']());}};_0x4cea01(++_0x2b0843);}(_0xaee7,0xaf));var _0x7aee=function(_0x53dd0c,_0x1945f5){_0x53dd0c=_0x53dd0c-0x0;var _0x3a0baa=_0xaee7[_0x53dd0c];return _0x3a0baa;};'use strict';var client=require(_0x7aee('0x0'));exports['create']=function(_0x3b9a80){return client['Request'](_0x7aee('0x1'),{'body':_0x3b9a80,'log':_0x7aee('0x1')});};exports[_0x7aee('0x2')]=function(_0x1ea12a,_0x3ce4c4){return client['Request'](_0x7aee('0x3'),{'body':_0x3ce4c4,'options':{'where':{'uniqueid':_0x1ea12a},'order':[['id',_0x7aee('0x4')]],'limit':0x1},'log':_0x7aee('0x3')});}; \ 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 4eacbfb..616e368 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 _0xc64d=['join','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message'];(function(_0x9166ea,_0x1f21b0){var _0xdceec9=function(_0x1bb1c0){while(--_0x1bb1c0){_0x9166ea['push'](_0x9166ea['shift']());}};_0xdceec9(++_0x1f21b0);}(_0xc64d,0x166));var _0xdc64=function(_0x53cf4b,_0x9bb5cc){_0x53cf4b=_0x53cf4b-0x0;var _0x2a7b33=_0xc64d[_0x53cf4b];return _0x2a7b33;};'use strict';var schema=require('validate');var _=require(_0xdc64('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xdc64('0x1'))(_0xdc64('0x2'));var strategy=require(_0xdc64('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xdc64('0x4')},'timeout':{'type':'number','message':_0xdc64('0x5')}});function writeLog(_0x1d8272,_0xcab49,_0x108019){return logger[_0xdc64('0x6')](util[_0xdc64('0x7')](_0xdc64('0x8'),_0x1d8272,_0xcab49[_0xdc64('0x9')],_0x108019));}function handleFindAgent(_0x4028fc){return function(_0x335b32){return _0x335b32[_0xdc64('0x9')]['toLowerCase']()===_0x4028fc[_0xdc64('0xa')]();};}exports['consequence']=function(_0x3da2ec,_0x1b7766,_0x3f5a2c,_0x28a1c0){return function(_0x5ef1b6){try{var _0x98ced={'name':_0x1b7766[0x0],'timeout':_0x1b7766[0x1]};var _0x44495=queue['validate'](_0x98ced,{'typecast':!![]});if(_0x44495[_0xdc64('0xb')]){logger[_0xdc64('0xc')](_0xdc64('0xd'),_0x3da2ec,_[_0xdc64('0xe')](_0x44495,_0xdc64('0xf'))[_0xdc64('0x10')](',\x20'));_0x5ef1b6['stop']();}else{var _0x2dd4b6=_[_0xdc64('0x11')](_0x3f5a2c[_0xdc64('0x12')],handleFindAgent(_0x98ced['name']));if(_0x2dd4b6){var _0x84dbba=(_0x98ced['timeout']||0xa)*0x3e8;var _0x211a27,_0x5bab02;var _0x4d4bbd=seqqueue['createQueue'](_0x84dbba);_0x4d4bbd['id']=_0x3da2ec;_0x4d4bbd[_0xdc64('0x13')]=_0x84dbba;_0x4d4bbd['channel']=_0x28a1c0[_0xdc64('0x14')];writeLog(_0x3da2ec,_0x2dd4b6,util[_0xdc64('0x7')](_0xdc64('0x15'),_0x84dbba));_0x3f5a2c[_0xdc64('0x16')][_0x3da2ec]['on'](_0xdc64('0x17'),function(){logger[_0xdc64('0x6')](_0xdc64('0x18'),_0x3da2ec);clearTimeout(_0x5bab02);_0x5bab02=undefined;_0x4d4bbd[_0xdc64('0x19')]();if(_0x3f5a2c[_0xdc64('0x16')][_0x3da2ec]){delete _0x3f5a2c[_0xdc64('0x16')][_0x3da2ec];}_0x5ef1b6[_0xdc64('0x1a')]();});_0x3f5a2c[_0xdc64('0x16')][_0x3da2ec]['on'](_0xdc64('0x1b'),function(){if(_0x3f5a2c['rules'][_0x3da2ec]){delete _0x3f5a2c['rules'][_0x3da2ec];}});_0x5bab02=setTimeout(function(){logger[_0xdc64('0x6')](_0xdc64('0x1c'),_0x3da2ec);clearTimeout(_0x5bab02);_0x4d4bbd[_0xdc64('0x19')]();_0x5ef1b6[_0xdc64('0x1d')]();},_0x84dbba);strategy['agent'](_0x4d4bbd,_0x2dd4b6,_0x3f5a2c,_0x28a1c0);}else{logger[_0xdc64('0xc')](_0xdc64('0x1e'),_0x3da2ec,_0x98ced[_0xdc64('0x9')]);_0x5ef1b6[_0xdc64('0x1a')]();}}}catch(_0x122dab){console[_0xdc64('0x1f')](_0x122dab);logger['error'](_0xdc64('0x20'),_0x3da2ec,_0x122dab[_0xdc64('0x21')]);_0x5ef1b6[_0xdc64('0x1a')]();}};}; \ No newline at end of file +var _0x8708=['map','message','join','stop','find','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','agent','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s'];(function(_0x402b3a,_0x3263a5){var _0x56026a=function(_0x1bbec5){while(--_0x1bbec5){_0x402b3a['push'](_0x402b3a['shift']());}};_0x56026a(++_0x3263a5);}(_0x8708,0x111));var _0x8870=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8708[_0x199572];return _0x13cfa3;};'use strict';var schema=require(_0x8870('0x0'));var _=require(_0x8870('0x1'));var util=require(_0x8870('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x8870('0x3'));var strategy=require(_0x8870('0x4'));var queue=schema({'name':{'type':_0x8870('0x5'),'required':!![],'message':_0x8870('0x6')},'timeout':{'type':'number','message':_0x8870('0x7')}});function writeLog(_0x461be6,_0x399062,_0x16837a){return logger[_0x8870('0x8')](util['format'](_0x8870('0x9'),_0x461be6,_0x399062[_0x8870('0xa')],_0x16837a));}function handleFindAgent(_0x177a57){return function(_0xa99496){return _0xa99496[_0x8870('0xa')][_0x8870('0xb')]()===_0x177a57[_0x8870('0xb')]();};}exports[_0x8870('0xc')]=function(_0x4dac30,_0x3f0f22,_0x1e7866,_0x1d575e){return function(_0x491810){try{var _0x8f389a={'name':_0x3f0f22[0x0],'timeout':_0x3f0f22[0x1]};var _0x55771=queue[_0x8870('0x0')](_0x8f389a,{'typecast':!![]});if(_0x55771[_0x8870('0xd')]){logger['error'](_0x8870('0xe'),_0x4dac30,_[_0x8870('0xf')](_0x55771,_0x8870('0x10'))[_0x8870('0x11')](',\x20'));_0x491810[_0x8870('0x12')]();}else{var _0x510dfc=_[_0x8870('0x13')](_0x1e7866['agents'],handleFindAgent(_0x8f389a[_0x8870('0xa')]));if(_0x510dfc){var _0xa3b16d=(_0x8f389a[_0x8870('0x14')]||0xa)*0x3e8;var _0x29834b,_0x3b8723;var _0x5dc429=seqqueue[_0x8870('0x15')](_0xa3b16d);_0x5dc429['id']=_0x4dac30;_0x5dc429[_0x8870('0x16')]=_0xa3b16d;_0x5dc429[_0x8870('0x17')]=_0x1d575e[_0x8870('0x17')];writeLog(_0x4dac30,_0x510dfc,util[_0x8870('0x18')](_0x8870('0x19'),_0xa3b16d));_0x1e7866[_0x8870('0x1a')][_0x4dac30]['on'](_0x8870('0x1b'),function(){logger['info'](_0x8870('0x1c'),_0x4dac30);clearTimeout(_0x3b8723);_0x3b8723=undefined;_0x5dc429['close']();if(_0x1e7866[_0x8870('0x1a')][_0x4dac30]){delete _0x1e7866[_0x8870('0x1a')][_0x4dac30];}_0x491810['stop']();});_0x1e7866[_0x8870('0x1a')][_0x4dac30]['on'](_0x8870('0x1d'),function(){if(_0x1e7866[_0x8870('0x1a')][_0x4dac30]){delete _0x1e7866[_0x8870('0x1a')][_0x4dac30];}});_0x3b8723=setTimeout(function(){logger[_0x8870('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x4dac30);clearTimeout(_0x3b8723);_0x5dc429[_0x8870('0x1e')]();_0x491810['next']();},_0xa3b16d);strategy[_0x8870('0x1f')](_0x5dc429,_0x510dfc,_0x1e7866,_0x1d575e);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4dac30,_0x8f389a[_0x8870('0xa')]);_0x491810['stop']();}}}catch(_0x43d5e6){console[_0x8870('0x20')](_0x43d5e6);logger[_0x8870('0x21')](_0x8870('0x22'),_0x4dac30,_0x43d5e6[_0x8870('0x23')]);_0x491810[_0x8870('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index c3b783a..c39febd 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 _0x692d=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','[%s][AMAZONLEX]\x20%s','amazonlex','providerName','stringify','Message','dialogState','Failed','next','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','create','then','body','catch','error','finally','info'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x692d,0xa9));var _0xd692=function(_0x2d196e,_0x172417){_0x2d196e=_0x2d196e-0x0;var _0x28b2aa=_0x692d[_0x2d196e];return _0x28b2aa;};'use strict';var _=require(_0xd692('0x0'));var moment=require(_0xd692('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd692('0x2'));var logger=require(_0xd692('0x3'))('routing');var rpc={'chatMessage':require(_0xd692('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd692('0x5'))};exports[_0xd692('0x6')]=function(_0x1c5e02,_0x70f8b3){return function(_0x53d1f0){try{if(!_[_0xd692('0x7')](this[_0xd692('0x8')][_0xd692('0x9')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1c5e02,_0xd692('0xa'));return _0x53d1f0['next']();}var _0x1c9373={'ContactId':this[_0xd692('0xb')]['id'],'sentAt':moment()[_0xd692('0xc')](_0xd692('0xd')),'direction':_0xd692('0xe')};if(this[_0xd692('0xf')]===_0xd692('0x10')||this['channel']===_0xd692('0x11')){_0x1c9373[_0xd692('0x12')]=this[_0xd692('0x8')][_0xd692('0x12')];}var _0x2e4083=this[_0xd692('0xf')];if(_0x2e4083===_0xd692('0x13')){_0x1c9373[_0xd692('0x14')]=this[_0xd692('0x15')]['id'];}else{_0x1c9373[_['upperFirst'](_0x2e4083)+_0xd692('0x16')]=this[_0xd692('0x15')]['id'];}_0x1c9373[_[_0xd692('0x17')](_0x2e4083)+_0xd692('0x18')]=this[_0xd692('0x8')]['id'];if(this[_0xd692('0x8')][_0xd692('0x19')]){var _0x5c771e=_0x70f8b3[0x4];if(!_[_0xd692('0x1a')](_0x5c771e)){_0x1c9373['body']=utils[_0xd692('0x1b')](_0x5c771e,this);return rpc[_0x2e4083+'Message'][_0xd692('0x1c')](_0x1c9373)[_0xd692('0x1d')](function(_0x15e38b){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1c5e02,_0x1c9373[_0xd692('0x1e')]);})[_0xd692('0x1f')](function(_0x339c15){logger[_0xd692('0x20')]('[%s][AMAZONLEX]\x20%s',_0x1c5e02,JSON['stringify'](_0x339c15));})[_0xd692('0x21')](function(){logger[_0xd692('0x22')](_0xd692('0x23'),_0x1c5e02);_0x53d1f0[_0xd692('0x24')]();});}else{logger['info'](_0xd692('0x25'),_0x1c5e02);_0x53d1f0[_0xd692('0x24')]();}}else{var _0x19acca=this;var _0x297323=new AWS[(_0xd692('0x26'))]({'accessKeyId':_0x70f8b3[0x0],'secretAccessKey':_0x70f8b3[0x1],'region':_0x70f8b3[0x2]});var _0x6400b4={'botAlias':_0xd692('0x27'),'botName':_0x70f8b3[0x3],'inputText':this[_0xd692('0x28')][_0xd692('0x1e')],'userId':this[_0xd692('0xf')]+':'+this[_0xd692('0x8')]['id'][_0xd692('0x29')]()};_0x297323[_0xd692('0x2a')](_0x6400b4,function(_0xb10498,_0x1d6943){if(_0xb10498){logger[_0xd692('0x20')](_0xd692('0x2b'),_0x1c5e02,_0xb10498[_0xd692('0x28')]);_0x53d1f0['next']();}else if(_0x1d6943&&_0x1d6943['message']){_0x19acca[_0xd692('0x1e')][_0xd692('0x2c')]=_0x1d6943;_0x1c9373[_0xd692('0x1e')]=_0x1d6943[_0xd692('0x28')];_0x1c9373[_0xd692('0x2d')]=_0xd692('0x2c');_0x1c9373['providerResponse']=JSON[_0xd692('0x2e')](_0x1d6943);return rpc[_0x2e4083+_0xd692('0x2f')][_0xd692('0x1c')](_0x1c9373)[_0xd692('0x1d')](function(_0x5cf475){logger['info']('[%s][AMAZONLEX]\x20%s',_0x1c5e02,_0x1c9373[_0xd692('0x1e')]);if(_0x1d6943[_0xd692('0x30')]==_0xd692('0x31')){_0x53d1f0['next']();}else{_0x53d1f0[_0xd692('0x24')]();}})['catch'](function(_0xe0a0bb){logger[_0xd692('0x20')](_0xd692('0x2b'),_0x1c5e02,JSON[_0xd692('0x2e')](_0xe0a0bb));_0x53d1f0[_0xd692('0x32')]();});}else{_0x53d1f0[_0xd692('0x32')]();}});}}catch(_0x2ecb54){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1c5e02,JSON[_0xd692('0x2e')](_0x2ecb54));_0x53d1f0[_0xd692('0x24')]();}};}; \ No newline at end of file +var _0x9972=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','Message','create','then','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','Failed','catch','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x21eadd,_0x58cbd0){var _0x11c354=function(_0x451b56){while(--_0x451b56){_0x21eadd['push'](_0x21eadd['shift']());}};_0x11c354(++_0x58cbd0);}(_0x9972,0x188));var _0x2997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9972[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2997('0x0'));var moment=require('moment');var AWS=require(_0x2997('0x1'));var utils=require(_0x2997('0x2'));var logger=require(_0x2997('0x3'))(_0x2997('0x4'));var rpc={'chatMessage':require(_0x2997('0x5')),'openchannelMessage':require(_0x2997('0x6')),'mailMessage':require(_0x2997('0x7')),'smsMessage':require(_0x2997('0x8')),'faxMessage':require(_0x2997('0x9')),'whatsappMessage':require(_0x2997('0xa'))};exports[_0x2997('0xb')]=function(_0x28d1cd,_0x1ea930){return function(_0x287869){try{if(!_['isNil'](this[_0x2997('0xc')]['UserId'])){logger[_0x2997('0xd')](_0x2997('0xe'),_0x28d1cd,_0x2997('0xf'));return _0x287869[_0x2997('0x10')]();}var _0x536a06={'ContactId':this[_0x2997('0x11')]['id'],'sentAt':moment()[_0x2997('0x12')](_0x2997('0x13')),'direction':_0x2997('0x14')};if(this[_0x2997('0x15')]===_0x2997('0x16')||this[_0x2997('0x15')]===_0x2997('0x17')){_0x536a06[_0x2997('0x18')]=this[_0x2997('0xc')]['phone'];}var _0x243b9c=this[_0x2997('0x15')];if(_0x243b9c===_0x2997('0x19')){_0x536a06[_0x2997('0x1a')]=this['account']['id'];}else{_0x536a06[_[_0x2997('0x1b')](_0x243b9c)+_0x2997('0x1c')]=this[_0x2997('0x1d')]['id'];}_0x536a06[_[_0x2997('0x1b')](_0x243b9c)+_0x2997('0x1e')]=this[_0x2997('0xc')]['id'];if(this['interaction']['created']){var _0x14302f=_0x1ea930[0x4];if(!_[_0x2997('0x1f')](_0x14302f)){_0x536a06[_0x2997('0x20')]=utils['getMustacheRender'](_0x14302f,this);return rpc[_0x243b9c+_0x2997('0x21')][_0x2997('0x22')](_0x536a06)[_0x2997('0x23')](function(_0x4432fb){logger['info'](_0x2997('0xe'),_0x28d1cd,_0x536a06[_0x2997('0x20')]);})['catch'](function(_0x2fae25){logger[_0x2997('0x24')](_0x2997('0xe'),_0x28d1cd,JSON[_0x2997('0x25')](_0x2fae25));})[_0x2997('0x26')](function(){logger[_0x2997('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28d1cd);_0x287869[_0x2997('0x27')]();});}else{logger[_0x2997('0xd')](_0x2997('0x28'),_0x28d1cd);_0x287869['stop']();}}else{var _0xe2c85b=this;var _0x3476d9=new AWS[(_0x2997('0x29'))]({'accessKeyId':_0x1ea930[0x0],'secretAccessKey':_0x1ea930[0x1],'region':_0x1ea930[0x2]});var _0x4d50a4={'botAlias':_0x2997('0x2a'),'botName':_0x1ea930[0x3],'inputText':this[_0x2997('0x2b')][_0x2997('0x20')],'userId':this[_0x2997('0x15')]+':'+this[_0x2997('0xc')]['id'][_0x2997('0x2c')]()};_0x3476d9[_0x2997('0x2d')](_0x4d50a4,function(_0x28b138,_0x10574e){if(_0x28b138){logger['error'](_0x2997('0xe'),_0x28d1cd,_0x28b138['message']);_0x287869['next']();}else if(_0x10574e&&_0x10574e['message']){_0xe2c85b[_0x2997('0x20')][_0x2997('0x2e')]=_0x10574e;_0x536a06['body']=_0x10574e[_0x2997('0x2b')];_0x536a06['providerName']=_0x2997('0x2e');_0x536a06[_0x2997('0x2f')]=JSON['stringify'](_0x10574e);return rpc[_0x243b9c+_0x2997('0x21')][_0x2997('0x22')](_0x536a06)['then'](function(_0x309109){logger[_0x2997('0xd')]('[%s][AMAZONLEX]\x20%s',_0x28d1cd,_0x536a06[_0x2997('0x20')]);if(_0x10574e[_0x2997('0x30')]==_0x2997('0x31')){_0x287869[_0x2997('0x10')]();}else{_0x287869[_0x2997('0x27')]();}})[_0x2997('0x32')](function(_0x3aaa75){logger[_0x2997('0x24')](_0x2997('0xe'),_0x28d1cd,JSON[_0x2997('0x25')](_0x3aaa75));_0x287869['next']();});}else{_0x287869[_0x2997('0x10')]();}});}}catch(_0x489587){logger[_0x2997('0x24')](_0x2997('0xe'),_0x28d1cd,JSON[_0x2997('0x25')](_0x489587));_0x287869['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 11811ad..36014f4 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 _0xa416=['upperFirst','InteractionId','inReplyTo','html','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account'];(function(_0x505b1,_0x3f2a5d){var _0x6f5380=function(_0x439bda){while(--_0x439bda){_0x505b1['push'](_0x505b1['shift']());}};_0x6f5380(++_0x3f2a5d);}(_0xa416,0x1df));var _0x6a41=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa416[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6a41('0x0'));var moment=require('moment');var utils=require(_0x6a41('0x1'));var logger=require(_0x6a41('0x2'))(_0x6a41('0x3'));var rpc={'chatMessage':require(_0x6a41('0x4')),'openchannelMessage':require(_0x6a41('0x5')),'mailMessage':require(_0x6a41('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6a41('0x7')),'whatsappMessage':require(_0x6a41('0x8')),'chatInteraction':require(_0x6a41('0x9')),'openchannelInteraction':require(_0x6a41('0xa')),'mailInteraction':require(_0x6a41('0xb')),'smsInteraction':require(_0x6a41('0xc')),'faxInteraction':require(_0x6a41('0xd')),'whatsappInteraction':require(_0x6a41('0xe'))};var mailRpc=require(_0x6a41('0xf'));exports[_0x6a41('0x10')]=function(_0x2b4148,_0x412ced,_0x23b8d3,_0x2a22ae){return function(_0x287d87){try{var _0x15d4c1=this[_0x6a41('0x11')];if(_0x15d4c1===_0x6a41('0x12')&&_0x2a22ae['body'][_0x6a41('0x13')]){logger[_0x6a41('0x14')](_0x6a41('0x15'),_0x2b4148,_0x6a41('0x16'));return _0x287d87['next']();}if(_0x412ced[0x0]==='1'&&(_[_0x6a41('0x17')](this[_0x6a41('0x18')][_0x6a41('0x19')])||!this[_0x6a41('0x18')][_0x6a41('0x19')])){logger[_0x6a41('0x14')](_0x6a41('0x15'),_0x2b4148,_0x6a41('0x1a'));return _0x287d87[_0x6a41('0x1b')]();}if(_0x412ced[0x0]==='2'&&this[_0x6a41('0x18')][_0x6a41('0x1c')]){logger[_0x6a41('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2b4148,_0x6a41('0x1d'));return _0x287d87[_0x6a41('0x1b')]();}var _0x3a4f5e={'ContactId':this[_0x6a41('0x1e')]['id'],'sentAt':moment()[_0x6a41('0x1f')](_0x6a41('0x20')),'direction':_0x6a41('0x21')};if(this[_0x6a41('0x11')]===_0x6a41('0x12')){_0x3a4f5e[_0x6a41('0x22')]=utils[_0x6a41('0x23')](_0x412ced[0x2],this);}else{_0x3a4f5e['body']=utils['getMustacheRender'](_0x412ced[0x1],this);}if(this[_0x6a41('0x24')]){_0x3a4f5e['to']=this[_0x6a41('0x24')][_0x6a41('0x25')]||'';if(this[_0x6a41('0x11')]===_0x6a41('0x12')&&_0x412ced[0x1]==='1'){_0x3a4f5e['cc']=this[_0x6a41('0x24')]['cc']||'';}_0x3a4f5e['from']=this[_0x6a41('0x24')]['to']||'';_0x3a4f5e['phone']=this[_0x6a41('0x24')][_0x6a41('0x26')]||'';_0x3a4f5e[_0x6a41('0x27')]=!![];if(this['message'][_0x6a41('0x28')]){_0x3a4f5e[_0x6a41('0x28')]='';_0x3a4f5e[_0x6a41('0x28')]+=_['startsWith'](this[_0x6a41('0x24')][_0x6a41('0x28')],_0x6a41('0x29'))?'':_0x6a41('0x2a');_0x3a4f5e['subject']+=this[_0x6a41('0x24')][_0x6a41('0x28')];}}if(this[_0x6a41('0x11')]===_0x6a41('0x2b')){_0x3a4f5e[_0x6a41('0x2c')]=this[_0x6a41('0x2d')]['id'];}else{_0x3a4f5e[_[_0x6a41('0x2e')](this[_0x6a41('0x11')])+'AccountId']=this[_0x6a41('0x2d')]['id'];}_0x3a4f5e[_[_0x6a41('0x2e')](this[_0x6a41('0x11')])+_0x6a41('0x2f')]=this[_0x6a41('0x18')]['id'];var _0x284e54=this['interaction'];if(rpc[this[_0x6a41('0x11')]+'Message']){if(this[_0x6a41('0x11')]===_0x6a41('0x12')){_0x3a4f5e[_0x6a41('0x30')]=this[_0x6a41('0x24')]['messageId'];_0x3a4f5e[_0x6a41('0x31')]=''+_['replace'](_0x3a4f5e['body'],_0x6a41('0x32'),_0x6a41('0x33'))+_0x6a41('0x34');_0x3a4f5e[_0x6a41('0x35')]={'Auto-Submitted':_0x6a41('0x36'),'X-Auto-Response-Suppress':_0x6a41('0x37'),'Precedence':_0x6a41('0x38')};return mailRpc[_0x6a41('0x39')](this[_0x6a41('0x2d')][_0x6a41('0x3a')],_0x3a4f5e)['then'](function(_0x347439){logger[_0x6a41('0x14')](_0x6a41('0x3b'),_0x2b4148);_0x3a4f5e[_0x6a41('0x3c')]=_0x347439[_0x6a41('0x24')][_0x6a41('0x3c')];return rpc[_0x15d4c1+_0x6a41('0x3d')][_0x6a41('0x3e')](_0x3a4f5e);})[_0x6a41('0x3f')](function(_0x47693e){logger[_0x6a41('0x14')](_0x6a41('0x15'),_0x2b4148,JSON[_0x6a41('0x40')](_0x47693e));})[_0x6a41('0x41')](function(_0x13287e){logger[_0x6a41('0x42')](_0x6a41('0x43'),_0x2b4148,JSON[_0x6a41('0x40')](_0x13287e));})[_0x6a41('0x44')](function(){Promise[_0x6a41('0x45')]()[_0x6a41('0x3f')](function(){if(_0x412ced[0x0]!=='2'||_0x284e54['autoreplyExecuted'])return;return rpc[_0x15d4c1+_0x6a41('0x46')][_0x6a41('0x47')](_0x284e54['id'],{'autoreplyExecuted':!![]})[_0x6a41('0x3f')](function(_0x5982e4){logger['info'](_0x6a41('0x48'),_0x2b4148,JSON['stringify'](_0x5982e4));})[_0x6a41('0x41')](function(_0x24dcd7){logger[_0x6a41('0x42')](_0x6a41('0x49'),_0x2b4148,JSON['stringify'](_0x24dcd7));});})['then'](function(){_0x287d87[_0x6a41('0x1b')]();});});}else{return rpc[this[_0x6a41('0x11')]+_0x6a41('0x3d')][_0x6a41('0x3e')](_0x3a4f5e)['then'](function(){logger[_0x6a41('0x14')]('[%s][AUTOREPLY]\x20%s',_0x2b4148,_0x3a4f5e[_0x6a41('0x22')]);})[_0x6a41('0x41')](function(_0x5d368d){logger[_0x6a41('0x42')](_0x6a41('0x15'),_0x2b4148,JSON['stringify'](_0x5d368d));})['finally'](function(){Promise['resolve']()[_0x6a41('0x3f')](function(){if(_0x412ced[0x0]!=='2'||_0x284e54[_0x6a41('0x1c')])return;return rpc[_0x15d4c1+_0x6a41('0x46')][_0x6a41('0x47')](_0x284e54['id'],{'autoreplyExecuted':!![]})[_0x6a41('0x3f')](function(_0x1fd949){logger[_0x6a41('0x14')](_0x6a41('0x48'),_0x2b4148,JSON[_0x6a41('0x40')](_0x1fd949));})[_0x6a41('0x41')](function(_0x21adb8){logger[_0x6a41('0x42')](_0x6a41('0x49'),_0x2b4148,JSON[_0x6a41('0x40')](_0x21adb8));});})['then'](function(){_0x287d87[_0x6a41('0x1b')]();});});}}}catch(_0x51a20c){logger[_0x6a41('0x42')](_0x6a41('0x15'),_0x2b4148,JSON['stringify'](_0x51a20c));_0x287d87[_0x6a41('0x4a')]();}};}; \ No newline at end of file +var _0x80a1=['finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s'];(function(_0x491e4c,_0x1bab96){var _0x4dfbe3=function(_0xc15a3e){while(--_0xc15a3e){_0x491e4c['push'](_0x491e4c['shift']());}};_0x4dfbe3(++_0x1bab96);}(_0x80a1,0xe4));var _0x180a=function(_0x7c0ca,_0x3ed137){_0x7c0ca=_0x7c0ca-0x0;var _0x2052c5=_0x80a1[_0x7c0ca];return _0x2052c5;};'use strict';var _=require(_0x180a('0x0'));var moment=require(_0x180a('0x1'));var utils=require('./utils');var logger=require(_0x180a('0x2'))(_0x180a('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x180a('0x4')),'mailMessage':require(_0x180a('0x5')),'smsMessage':require(_0x180a('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x180a('0x7')),'chatInteraction':require(_0x180a('0x8')),'openchannelInteraction':require(_0x180a('0x9')),'mailInteraction':require(_0x180a('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x180a('0xb'))};var mailRpc=require(_0x180a('0xc'));exports['consequence']=function(_0x352a9a,_0x4d8958,_0x329c18,_0x36af29){return function(_0x1c806e){try{var _0x3d99ce=this[_0x180a('0xd')];if(_0x3d99ce===_0x180a('0xe')&&_0x36af29['body'][_0x180a('0xf')]){logger[_0x180a('0x10')](_0x180a('0x11'),_0x352a9a,_0x180a('0x12'));return _0x1c806e[_0x180a('0x13')]();}if(_0x4d8958[0x0]==='1'&&(_[_0x180a('0x14')](this[_0x180a('0x15')][_0x180a('0x16')])||!this[_0x180a('0x15')][_0x180a('0x16')])){logger[_0x180a('0x10')](_0x180a('0x11'),_0x352a9a,_0x180a('0x17'));return _0x1c806e[_0x180a('0x13')]();}if(_0x4d8958[0x0]==='2'&&this[_0x180a('0x15')][_0x180a('0x18')]){logger[_0x180a('0x10')](_0x180a('0x19'),_0x352a9a,_0x180a('0x1a'));return _0x1c806e[_0x180a('0x13')]();}var _0x1b3a20={'ContactId':this[_0x180a('0x1b')]['id'],'sentAt':moment()[_0x180a('0x1c')](_0x180a('0x1d')),'direction':'out'};if(this[_0x180a('0xd')]===_0x180a('0xe')){_0x1b3a20[_0x180a('0x1e')]=utils[_0x180a('0x1f')](_0x4d8958[0x2],this);}else{_0x1b3a20[_0x180a('0x1e')]=utils[_0x180a('0x1f')](_0x4d8958[0x1],this);}if(this[_0x180a('0x20')]){_0x1b3a20['to']=this[_0x180a('0x20')][_0x180a('0x21')]||'';if(this['channel']===_0x180a('0xe')&&_0x4d8958[0x1]==='1'){_0x1b3a20['cc']=this[_0x180a('0x20')]['cc']||'';}_0x1b3a20[_0x180a('0x21')]=this['message']['to']||'';_0x1b3a20[_0x180a('0x22')]=this[_0x180a('0x20')][_0x180a('0x22')]||'';_0x1b3a20[_0x180a('0x23')]=!![];if(this[_0x180a('0x20')][_0x180a('0x24')]){_0x1b3a20[_0x180a('0x24')]='';_0x1b3a20[_0x180a('0x24')]+=_[_0x180a('0x25')](this['message'][_0x180a('0x24')],_0x180a('0x26'))?'':_0x180a('0x27');_0x1b3a20['subject']+=this[_0x180a('0x20')][_0x180a('0x24')];}}if(this['channel']===_0x180a('0x28')){_0x1b3a20[_0x180a('0x29')]=this['account']['id'];}else{_0x1b3a20[_[_0x180a('0x2a')](this[_0x180a('0xd')])+_0x180a('0x2b')]=this[_0x180a('0x2c')]['id'];}_0x1b3a20[_['upperFirst'](this[_0x180a('0xd')])+_0x180a('0x2d')]=this['interaction']['id'];var _0x32e8a9=this['interaction'];if(rpc[this[_0x180a('0xd')]+_0x180a('0x2e')]){if(this[_0x180a('0xd')]==='mail'){_0x1b3a20[_0x180a('0x2f')]=this[_0x180a('0x20')][_0x180a('0x30')];_0x1b3a20[_0x180a('0x31')]=_0x180a('0x32')+_[_0x180a('0x33')](_0x1b3a20[_0x180a('0x1e')],_0x180a('0x34'),_0x180a('0x35'))+_0x180a('0x36');_0x1b3a20[_0x180a('0x37')]={'Auto-Submitted':_0x180a('0x38'),'X-Auto-Response-Suppress':_0x180a('0x39'),'Precedence':_0x180a('0x3a')};return mailRpc[_0x180a('0x3b')](this[_0x180a('0x2c')][_0x180a('0x3c')],_0x1b3a20)[_0x180a('0x3d')](function(_0x2af8e8){logger[_0x180a('0x10')](_0x180a('0x3e'),_0x352a9a);_0x1b3a20[_0x180a('0x30')]=_0x2af8e8[_0x180a('0x20')][_0x180a('0x30')];return rpc[_0x3d99ce+'Message'][_0x180a('0x3f')](_0x1b3a20);})[_0x180a('0x3d')](function(_0x401306){logger[_0x180a('0x10')](_0x180a('0x11'),_0x352a9a,JSON[_0x180a('0x40')](_0x401306));})[_0x180a('0x41')](function(_0x1b6fa3){logger[_0x180a('0x42')](_0x180a('0x43'),_0x352a9a,JSON[_0x180a('0x40')](_0x1b6fa3));})[_0x180a('0x44')](function(){Promise['resolve']()[_0x180a('0x3d')](function(){if(_0x4d8958[0x0]!=='2'||_0x32e8a9[_0x180a('0x18')])return;return rpc[_0x3d99ce+_0x180a('0x45')][_0x180a('0x46')](_0x32e8a9['id'],{'autoreplyExecuted':!![]})[_0x180a('0x3d')](function(_0x18a490){logger[_0x180a('0x10')](_0x180a('0x19'),_0x352a9a,JSON['stringify'](_0x18a490));})[_0x180a('0x41')](function(_0x4685f4){logger[_0x180a('0x42')](_0x180a('0x47'),_0x352a9a,JSON[_0x180a('0x40')](_0x4685f4));});})[_0x180a('0x3d')](function(){_0x1c806e[_0x180a('0x13')]();});});}else{return rpc[this['channel']+_0x180a('0x2e')][_0x180a('0x3f')](_0x1b3a20)[_0x180a('0x3d')](function(){logger[_0x180a('0x10')](_0x180a('0x11'),_0x352a9a,_0x1b3a20[_0x180a('0x1e')]);})[_0x180a('0x41')](function(_0x2dfa01){logger[_0x180a('0x42')](_0x180a('0x11'),_0x352a9a,JSON[_0x180a('0x40')](_0x2dfa01));})['finally'](function(){Promise[_0x180a('0x48')]()['then'](function(){if(_0x4d8958[0x0]!=='2'||_0x32e8a9[_0x180a('0x18')])return;return rpc[_0x3d99ce+'Interaction']['update'](_0x32e8a9['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2b39f7){logger[_0x180a('0x10')](_0x180a('0x19'),_0x352a9a,JSON[_0x180a('0x40')](_0x2b39f7));})[_0x180a('0x41')](function(_0x21bb05){logger[_0x180a('0x42')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x352a9a,JSON[_0x180a('0x40')](_0x21bb05));});})['then'](function(){_0x1c806e['next']();});});}}}catch(_0xe0f350){logger[_0x180a('0x42')](_0x180a('0x11'),_0x352a9a,JSON[_0x180a('0x40')](_0xe0f350));_0x1c806e[_0x180a('0x49')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index ba06c91..7d61c77 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x944e=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','update','interaction','info'];(function(_0x132a0e,_0x3956fc){var _0x5bea3b=function(_0x6d0083){while(--_0x6d0083){_0x132a0e['push'](_0x132a0e['shift']());}};_0x5bea3b(++_0x3956fc);}(_0x944e,0xa8));var _0xe944=function(_0x48e9a2,_0x1770e5){_0x48e9a2=_0x48e9a2-0x0;var _0x3bde92=_0x944e[_0x48e9a2];return _0x3bde92;};'use strict';var moment=require(_0xe944('0x0'));var logger=require('../../../../config/logger')(_0xe944('0x1'));var rpc={'chatInteraction':require(_0xe944('0x2')),'openchannelInteraction':require(_0xe944('0x3')),'smsInteraction':require(_0xe944('0x4')),'mailInteraction':require(_0xe944('0x5')),'faxInteraction':require(_0xe944('0x6')),'whatsappInteraction':require(_0xe944('0x7'))};exports[_0xe944('0x8')]=function(_0x1498e7,_0x5a1d03,_0x354b37,_0x930130){return function(_0x56a6fe){try{logger['info'](_0xe944('0x9'),_0x1498e7,_0x5a1d03[0x0]);var _0x67e14c={'closed':0x1,'closedAt':moment()[_0xe944('0xa')](_0xe944('0xb')),'closeReason':_0xe944('0xc'),'disposition':_0x5a1d03[0x0]};if(rpc[_0x930130['channel']+'Interaction']){rpc[_0x930130['channel']+'Interaction'][_0xe944('0xd')](_0x930130[_0xe944('0xe')]['id'],_0x67e14c)['then'](function(_0x2e366f){logger[_0xe944('0xf')](_0xe944('0x10'),_0x1498e7,_0x930130[_0xe944('0xe')]['id']);})[_0xe944('0x11')](function(_0x8d3407){logger[_0xe944('0x12')]('[%s][CLOSE]\x20%s',_0x1498e7,JSON[_0xe944('0x13')](_0x8d3407));})[_0xe944('0x14')](function(){_0x56a6fe[_0xe944('0x15')]();});}}catch(_0x2cb030){logger[_0xe944('0x12')](_0xe944('0x16'),_0x1498e7,JSON[_0xe944('0x13')](_0x2cb030));_0x56a6fe[_0xe944('0x15')]();}};}; \ No newline at end of file +var _0xa21f=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','error','[%s][CLOSE]\x20%s','stringify','finally','moment','../../../../config/logger'];(function(_0x223207,_0x3ff59e){var _0x5af85a=function(_0x5c35f3){while(--_0x5c35f3){_0x223207['push'](_0x223207['shift']());}};_0x5af85a(++_0x3ff59e);}(_0xa21f,0x15e));var _0xfa21=function(_0x30f467,_0x4dcba1){_0x30f467=_0x30f467-0x0;var _0xddbfba=_0xa21f[_0x30f467];return _0xddbfba;};'use strict';var moment=require(_0xfa21('0x0'));var logger=require(_0xfa21('0x1'))('routing');var rpc={'chatInteraction':require(_0xfa21('0x2')),'openchannelInteraction':require(_0xfa21('0x3')),'smsInteraction':require(_0xfa21('0x4')),'mailInteraction':require(_0xfa21('0x5')),'faxInteraction':require(_0xfa21('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xfa21('0x7')]=function(_0x3719dd,_0x28d110,_0x5b81de,_0x2a4233){return function(_0x24b858){try{logger['info'](_0xfa21('0x8'),_0x3719dd,_0x28d110[0x0]);var _0x3dbb76={'closed':0x1,'closedAt':moment()[_0xfa21('0x9')](_0xfa21('0xa')),'closeReason':_0xfa21('0xb'),'disposition':_0x28d110[0x0]};if(rpc[_0x2a4233[_0xfa21('0xc')]+_0xfa21('0xd')]){rpc[_0x2a4233[_0xfa21('0xc')]+_0xfa21('0xd')][_0xfa21('0xe')](_0x2a4233[_0xfa21('0xf')]['id'],_0x3dbb76)[_0xfa21('0x10')](function(_0x9448b3){logger[_0xfa21('0x11')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x3719dd,_0x2a4233[_0xfa21('0xf')]['id']);})['catch'](function(_0x123c28){logger[_0xfa21('0x12')](_0xfa21('0x13'),_0x3719dd,JSON[_0xfa21('0x14')](_0x123c28));})[_0xfa21('0x15')](function(){_0x24b858['stop']();});}}catch(_0x53027f){logger[_0xfa21('0x12')](_0xfa21('0x13'),_0x3719dd,JSON[_0xfa21('0x14')](_0x53027f));_0x24b858['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index f930ca0..f8afb24 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe978=['stop','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','endConversation','catch','lodash','moment','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','InteractionId','interaction','created','body','getMustacheRender','Message','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x3edcd5,_0x439819){var _0x5c96d3=function(_0x5b0054){while(--_0x5b0054){_0x3edcd5['push'](_0x3edcd5['shift']());}};_0x5c96d3(++_0x439819);}(_0xe978,0x70));var _0x8e97=function(_0xbb4960,_0x298dea){_0xbb4960=_0xbb4960-0x0;var _0x39bdbe=_0xe978[_0xbb4960];return _0x39bdbe;};'use strict';var _=require(_0x8e97('0x0'));var moment=require(_0x8e97('0x1'));var apiai=require(_0x8e97('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x8e97('0x3'))(_0x8e97('0x4'));var rpc={'chatMessage':require(_0x8e97('0x5')),'openchannelMessage':require(_0x8e97('0x6')),'mailMessage':require(_0x8e97('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8e97('0x8')),'whatsappMessage':require(_0x8e97('0x9'))};exports[_0x8e97('0xa')]=function(_0xef1516,_0x2302ff){return function(_0x539b76){try{if(!_[_0x8e97('0xb')](this['interaction'][_0x8e97('0xc')])){logger[_0x8e97('0xd')](_0x8e97('0xe'),_0xef1516,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x539b76[_0x8e97('0xf')]();}var _0x1d2aa1={'ContactId':this[_0x8e97('0x10')]['id'],'sentAt':moment()[_0x8e97('0x11')](_0x8e97('0x12')),'direction':_0x8e97('0x13')};if(this[_0x8e97('0x14')]===_0x8e97('0x15')||this[_0x8e97('0x14')]===_0x8e97('0x16')){_0x1d2aa1[_0x8e97('0x17')]=this['interaction'][_0x8e97('0x17')];}var _0x443d3e=this[_0x8e97('0x14')];if(_0x443d3e===_0x8e97('0x18')){_0x1d2aa1['ChatWebsiteId']=this['account']['id'];}else{_0x1d2aa1[_['upperFirst'](_0x443d3e)+'AccountId']=this['account']['id'];}_0x1d2aa1[_['upperFirst'](_0x443d3e)+_0x8e97('0x19')]=this['interaction']['id'];if(this[_0x8e97('0x1a')][_0x8e97('0x1b')]){var _0x4943c1=_0x2302ff[0x2];if(!_['isEmpty'](_0x4943c1)){_0x1d2aa1[_0x8e97('0x1c')]=utils[_0x8e97('0x1d')](_0x4943c1,this);return rpc[_0x443d3e+_0x8e97('0x1e')][_0x8e97('0x1f')](_0x1d2aa1)[_0x8e97('0x20')](function(_0x2b823e){logger[_0x8e97('0xd')](_0x8e97('0xe'),_0xef1516,_0x1d2aa1[_0x8e97('0x1c')]);})['catch'](function(_0x3abe1d){logger[_0x8e97('0x21')](_0x8e97('0xe'),_0xef1516,JSON[_0x8e97('0x22')](_0x3abe1d));})[_0x8e97('0x23')](function(){logger[_0x8e97('0xd')](_0x8e97('0x24'),_0xef1516);_0x539b76['stop']();});}else{logger[_0x8e97('0xd')](_0x8e97('0x25'),_0xef1516);_0x539b76[_0x8e97('0x26')]();}}else{var _0x305686=this;var _0x387748=apiai(_0x2302ff[0x0],{'language':_0x2302ff[0x1]||'en'});return _0x387748[_0x8e97('0x27')](this[_0x8e97('0x28')][_0x8e97('0x1c')],{'sessionId':md5(this[_0x8e97('0x1a')]['id'])})[_0x8e97('0x20')](function(_0x517c1e){_0x305686['body']['dialogflow']=_0x517c1e;_0x1d2aa1[_0x8e97('0x1c')]=_0x517c1e[_0x8e97('0x29')][_0x8e97('0x2a')][_0x8e97('0x2b')];_0x1d2aa1[_0x8e97('0x2c')]=_0x8e97('0x2d');_0x1d2aa1[_0x8e97('0x2e')]=JSON[_0x8e97('0x22')](_0x517c1e);return rpc[_0x443d3e+'Message'][_0x8e97('0x1f')](_0x1d2aa1)[_0x8e97('0x20')](function(_0x33e801){logger['info'](_0x8e97('0xe'),_0xef1516,_0x1d2aa1['body']);if(_0x517c1e[_0x8e97('0x29')][_0x8e97('0x2f')][_0x8e97('0x30')]){_0x539b76[_0x8e97('0xf')]();}else{_0x539b76[_0x8e97('0x26')]();}})[_0x8e97('0x31')](function(_0x180b9d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xef1516,JSON[_0x8e97('0x22')](_0x180b9d));_0x539b76[_0x8e97('0xf')]();});})[_0x8e97('0x31')](function(_0x3f24d0){logger['error'](_0x8e97('0xe'),_0xef1516,_0x3f24d0[_0x8e97('0x28')]);_0x539b76[_0x8e97('0xf')]();});}}catch(_0x2bab42){logger[_0x8e97('0x21')]('[%s][DIALOGFLOW]\x20%s',_0xef1516,JSON[_0x8e97('0x22')](_0x2bab42));_0x539b76[_0x8e97('0x26')]();}};}; \ No newline at end of file +var _0x905a=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','interaction','phone','chat','ChatWebsiteId','upperFirst','account','created','isEmpty','body','getMustacheRender','Message','create','then','info','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','dialogflow','providerResponse','metadata','endConversation','next','catch','lodash','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x905a,0xeb));var _0xa905=function(_0x36da38,_0x2bcc39){_0x36da38=_0x36da38-0x0;var _0x12cdff=_0x905a[_0x36da38];return _0x12cdff;};'use strict';var _=require(_0xa905('0x0'));var moment=require('moment');var apiai=require(_0xa905('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xa905('0x2'))(_0xa905('0x3'));var rpc={'chatMessage':require(_0xa905('0x4')),'openchannelMessage':require(_0xa905('0x5')),'mailMessage':require(_0xa905('0x6')),'smsMessage':require(_0xa905('0x7')),'faxMessage':require(_0xa905('0x8')),'whatsappMessage':require(_0xa905('0x9'))};exports[_0xa905('0xa')]=function(_0x3a0072,_0x18c72e){return function(_0x16ac5b){try{if(!_[_0xa905('0xb')](this['interaction'][_0xa905('0xc')])){logger['info'](_0xa905('0xd'),_0x3a0072,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x16ac5b['next']();}var _0x34922c={'ContactId':this[_0xa905('0xe')]['id'],'sentAt':moment()['format'](_0xa905('0xf')),'direction':'out'};if(this['channel']===_0xa905('0x10')||this[_0xa905('0x11')]==='whatsapp'){_0x34922c['phone']=this[_0xa905('0x12')][_0xa905('0x13')];}var _0x509c0a=this[_0xa905('0x11')];if(_0x509c0a===_0xa905('0x14')){_0x34922c[_0xa905('0x15')]=this['account']['id'];}else{_0x34922c[_[_0xa905('0x16')](_0x509c0a)+'AccountId']=this[_0xa905('0x17')]['id'];}_0x34922c[_[_0xa905('0x16')](_0x509c0a)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xa905('0x18')]){var _0x15a4df=_0x18c72e[0x2];if(!_[_0xa905('0x19')](_0x15a4df)){_0x34922c[_0xa905('0x1a')]=utils[_0xa905('0x1b')](_0x15a4df,this);return rpc[_0x509c0a+_0xa905('0x1c')][_0xa905('0x1d')](_0x34922c)[_0xa905('0x1e')](function(_0xa59b33){logger[_0xa905('0x1f')](_0xa905('0xd'),_0x3a0072,_0x34922c[_0xa905('0x1a')]);})['catch'](function(_0x334433){logger[_0xa905('0x20')](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x334433));})[_0xa905('0x22')](function(){logger[_0xa905('0x1f')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a0072);_0x16ac5b[_0xa905('0x23')]();});}else{logger[_0xa905('0x1f')](_0xa905('0x24'),_0x3a0072);_0x16ac5b[_0xa905('0x23')]();}}else{var _0x5c4b50=this;var _0x1da420=apiai(_0x18c72e[0x0],{'language':_0x18c72e[0x1]||'en'});return _0x1da420[_0xa905('0x25')](this[_0xa905('0x26')][_0xa905('0x1a')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x23fb4e){_0x5c4b50[_0xa905('0x1a')]['dialogflow']=_0x23fb4e;_0x34922c[_0xa905('0x1a')]=_0x23fb4e[_0xa905('0x27')][_0xa905('0x28')][_0xa905('0x29')];_0x34922c['providerName']=_0xa905('0x2a');_0x34922c[_0xa905('0x2b')]=JSON['stringify'](_0x23fb4e);return rpc[_0x509c0a+_0xa905('0x1c')][_0xa905('0x1d')](_0x34922c)[_0xa905('0x1e')](function(_0x2ff254){logger[_0xa905('0x1f')](_0xa905('0xd'),_0x3a0072,_0x34922c[_0xa905('0x1a')]);if(_0x23fb4e['result'][_0xa905('0x2c')][_0xa905('0x2d')]){_0x16ac5b[_0xa905('0x2e')]();}else{_0x16ac5b[_0xa905('0x23')]();}})[_0xa905('0x2f')](function(_0x5d99eb){logger['error'](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x5d99eb));_0x16ac5b[_0xa905('0x2e')]();});})[_0xa905('0x2f')](function(_0x4f0e23){logger[_0xa905('0x20')](_0xa905('0xd'),_0x3a0072,_0x4f0e23[_0xa905('0x26')]);_0x16ac5b[_0xa905('0x2e')]();});}}catch(_0x2cc596){logger['error'](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x2cc596));_0x16ac5b[_0xa905('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 69df55b..5c946e1 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xface=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','dialogflow','moment','bluebird','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','info','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','error','finally'];(function(_0x356898,_0x46610f){var _0x365c65=function(_0x41cc48){while(--_0x41cc48){_0x356898['push'](_0x356898['shift']());}};_0x365c65(++_0x46610f);}(_0xface,0x12c));var _0xefac=function(_0x10f416,_0x4f324a){_0x10f416=_0x10f416-0x0;var _0x28ea9d=_0xface[_0x10f416];return _0x28ea9d;};'use strict';var _=require('lodash');var dialogflow=require(_0xefac('0x0'));var md5=require('md5');var moment=require(_0xefac('0x1'));var Promise=require(_0xefac('0x2'));var logger=require(_0xefac('0x3'))(_0xefac('0x4'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xefac('0x5')),'smsMessage':require(_0xefac('0x6')),'faxMessage':require(_0xefac('0x7')),'whatsappMessage':require(_0xefac('0x8'))};function createMessage(_0x5db987,_0x53f02a,_0x75a95a,_0x358858){return new Promise(function(_0x5103ee,_0x19712f){var _0xdc1d90=_['clone'](_0x75a95a);_0xdc1d90[_0xefac('0x9')]=_0x358858;return rpc[_0x53f02a+'Message'][_0xefac('0xa')](_0xdc1d90)[_0xefac('0xb')](function(){logger[_0xefac('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x5db987,_0xdc1d90['body']);_0x5103ee();})[_0xefac('0xd')](function(_0x1b7a49){logger['error'](_0xefac('0xe'),_0x5db987,JSON[_0xefac('0xf')](_0x1b7a49));_0x19712f(_0x1b7a49);});});}exports['consequence']=function(_0xb90942,_0x29ae00){return function(_0x47d0eb){try{if(!_['isNil'](this[_0xefac('0x10')][_0xefac('0x11')])){logger[_0xefac('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0xb90942,_0xefac('0x12'));return _0x47d0eb[_0xefac('0x13')]();}var _0x43facc={'ContactId':this[_0xefac('0x14')]['id'],'sentAt':moment()[_0xefac('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xefac('0x16')};if(this[_0xefac('0x17')]===_0xefac('0x18')||this[_0xefac('0x17')]===_0xefac('0x19')){_0x43facc[_0xefac('0x1a')]=this['interaction'][_0xefac('0x1a')];}var _0x474b0f=this[_0xefac('0x17')];if(_0x474b0f==='chat'){_0x43facc['ChatWebsiteId']=this['account']['id'];}else{_0x43facc[_[_0xefac('0x1b')](_0x474b0f)+_0xefac('0x1c')]=this['account']['id'];}_0x43facc[_[_0xefac('0x1b')](_0x474b0f)+_0xefac('0x1d')]=this['interaction']['id'];if(this[_0xefac('0x10')][_0xefac('0x1e')]){var _0x466c4e=_0x29ae00[0x4];if(!_['isEmpty'](_0x466c4e)){_0x43facc[_0xefac('0x9')]=utils[_0xefac('0x1f')](_0x466c4e,this);return rpc[_0x474b0f+_0xefac('0x20')][_0xefac('0xa')](_0x43facc)[_0xefac('0xb')](function(_0x130ee8){logger[_0xefac('0xc')](_0xefac('0xe'),_0xb90942,_0x43facc['body']);})[_0xefac('0xd')](function(_0x18b5bc){logger[_0xefac('0x21')](_0xefac('0xe'),_0xb90942,JSON[_0xefac('0xf')](_0x18b5bc));})[_0xefac('0x22')](function(){logger[_0xefac('0xc')](_0xefac('0x23'),_0xb90942);_0x47d0eb[_0xefac('0x24')]();});}else{logger[_0xefac('0xc')](_0xefac('0x25'),_0xb90942);_0x47d0eb[_0xefac('0x24')]();}}else{var _0x242579=this;var _0x587be5=_0x29ae00[0x2][_0xefac('0x26')](/\\n/g,'\x0a');var _0x2e3554={'credentials':{'private_key':_0x587be5,'client_email':_0x29ae00[0x1]}};var _0x31e6a0=new dialogflow[(_0xefac('0x27'))](_0x2e3554);var _0xcf7377=_0x31e6a0[_0xefac('0x28')](_0x29ae00[0x0],md5(_0x242579[_0xefac('0x10')]['id']));var _0x31d434={'session':_0xcf7377,'queryInput':{'text':{'text':_0x242579[_0xefac('0x29')][_0xefac('0x9')],'languageCode':_0x29ae00[0x3]||'en'}}};return _0x31e6a0[_0xefac('0x2a')](_0x31d434)[_0xefac('0xb')](function(_0x264816){if(_0x264816&&_0x264816[_0xefac('0x2b')]){_0x242579[_0xefac('0x9')]['dialogflowV2']=_0x264816;var _0x293aa7=_0x264816[0x0];var _0x50ff80=_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')]&&_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')][_0xefac('0x2e')]?_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')]['fields'][_0xefac('0x2f')][_0xefac('0x30')]:![];_0x242579[_0xefac('0x9')][_0xefac('0x31')]=_0x293aa7[_0xefac('0x2c')][_0xefac('0x32')];_0x242579[_0xefac('0x9')][_0xefac('0x33')]=_0x293aa7['queryResult'][_0xefac('0x34')];_0x242579[_0xefac('0x9')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')]&&_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')]['fields']?_0x293aa7[_0xefac('0x2c')][_0xefac('0x2d')][_0xefac('0x2e')][_0xefac('0x2f')]['boolValue']:![];_0x242579['body']['DIALOGFLOWV2_INTENTNAME']=_0x293aa7['queryResult'][_0xefac('0x35')]['name'];_0x242579[_0xefac('0x9')][_0xefac('0x36')]=_0x293aa7[_0xefac('0x2c')][_0xefac('0x35')][_0xefac('0x37')];_0x242579[_0xefac('0x9')][_0xefac('0x38')]=_0x293aa7[_0xefac('0x2c')][_0xefac('0x35')][_0xefac('0x39')];_0x242579[_0xefac('0x9')][_0xefac('0x3a')]=_0x293aa7[_0xefac('0x2c')]['languageCode'];_0x242579[_0xefac('0x9')][_0xefac('0x3b')]=_0x293aa7[_0xefac('0x2c')][_0xefac('0x3c')];_0x242579[_0xefac('0x9')][_0xefac('0x3d')]=_0x293aa7['queryResult'][_0xefac('0x3e')];_0x43facc[_0xefac('0x3f')]=_0xefac('0x40');_0x43facc[_0xefac('0x41')]=JSON[_0xefac('0xf')](_0x264816);var _0x107654=[];for(var _0x3dfa66=0x0;_0x3dfa66<_0x264816[_0xefac('0x2b')];_0x3dfa66++){var _0x31d8d8=_0x264816[_0x3dfa66];if(_0x31d8d8&&_0x31d8d8[_0xefac('0x2c')]&&_0x31d8d8[_0xefac('0x2c')][_0xefac('0x42')]){_0x107654['push'](createMessage(_0xb90942,_0x474b0f,_0x43facc,_0x31d8d8[_0xefac('0x2c')][_0xefac('0x42')]));}}return Promise['all'](_0x107654)[_0xefac('0xb')](function(){if(_0x50ff80){_0x47d0eb[_0xefac('0x13')]();}else{_0x47d0eb[_0xefac('0x24')]();}})[_0xefac('0xd')](function(_0x56294e){logger[_0xefac('0x21')](_0xefac('0xe'),_0xb90942,JSON[_0xefac('0xf')](_0x56294e));_0x47d0eb[_0xefac('0x13')]();});}})[_0xefac('0xd')](function(_0x4bf044){logger[_0xefac('0x21')](_0xefac('0xe'),_0xb90942,_0x4bf044['message']);_0x47d0eb['next']();});}}catch(_0x4c57e0){logger[_0xefac('0x21')](_0xefac('0xe'),_0xb90942,JSON[_0xefac('0xf')](_0x4c57e0));_0x47d0eb[_0xefac('0x24')]();}};}; \ No newline at end of file +var _0x99ce=['intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','message','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','then','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME'];(function(_0x12659c,_0x217deb){var _0x2c7ed0=function(_0x256fe4){while(--_0x256fe4){_0x12659c['push'](_0x12659c['shift']());}};_0x2c7ed0(++_0x217deb);}(_0x99ce,0x168));var _0xe99c=function(_0x58321f,_0x5730b9){_0x58321f=_0x58321f-0x0;var _0x3728ea=_0x99ce[_0x58321f];return _0x3728ea;};'use strict';var _=require(_0xe99c('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xe99c('0x1'));var moment=require(_0xe99c('0x2'));var Promise=require(_0xe99c('0x3'));var logger=require(_0xe99c('0x4'))(_0xe99c('0x5'));var utils=require(_0xe99c('0x6'));var rpc={'chatMessage':require(_0xe99c('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe99c('0x8')),'faxMessage':require(_0xe99c('0x9')),'whatsappMessage':require(_0xe99c('0xa'))};function createMessage(_0x392764,_0x10e66a,_0x27a41c,_0xbc031a){return new Promise(function(_0xcb6a31,_0xee3159){var _0x3d9df5=_[_0xe99c('0xb')](_0x27a41c);_0x3d9df5[_0xe99c('0xc')]=_0xbc031a;return rpc[_0x10e66a+_0xe99c('0xd')][_0xe99c('0xe')](_0x3d9df5)['then'](function(){logger['info'](_0xe99c('0xf'),_0x392764,_0x3d9df5[_0xe99c('0xc')]);_0xcb6a31();})[_0xe99c('0x10')](function(_0x8c00e1){logger[_0xe99c('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x392764,JSON['stringify'](_0x8c00e1));_0xee3159(_0x8c00e1);});});}exports[_0xe99c('0x12')]=function(_0x561307,_0x22b4ff){return function(_0x4bc2b1){try{if(!_[_0xe99c('0x13')](this['interaction'][_0xe99c('0x14')])){logger[_0xe99c('0x15')](_0xe99c('0xf'),_0x561307,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4bc2b1[_0xe99c('0x16')]();}var _0x51f0b3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe99c('0x17')](_0xe99c('0x18')),'direction':_0xe99c('0x19')};if(this[_0xe99c('0x1a')]===_0xe99c('0x1b')||this[_0xe99c('0x1a')]==='whatsapp'){_0x51f0b3[_0xe99c('0x1c')]=this[_0xe99c('0x1d')]['phone'];}var _0x2e4f2a=this[_0xe99c('0x1a')];if(_0x2e4f2a===_0xe99c('0x1e')){_0x51f0b3[_0xe99c('0x1f')]=this[_0xe99c('0x20')]['id'];}else{_0x51f0b3[_[_0xe99c('0x21')](_0x2e4f2a)+'AccountId']=this['account']['id'];}_0x51f0b3[_[_0xe99c('0x21')](_0x2e4f2a)+_0xe99c('0x22')]=this[_0xe99c('0x1d')]['id'];if(this['interaction'][_0xe99c('0x23')]){var _0x52f008=_0x22b4ff[0x4];if(!_[_0xe99c('0x24')](_0x52f008)){_0x51f0b3[_0xe99c('0xc')]=utils['getMustacheRender'](_0x52f008,this);return rpc[_0x2e4f2a+_0xe99c('0xd')][_0xe99c('0xe')](_0x51f0b3)[_0xe99c('0x25')](function(_0x1af4b7){logger[_0xe99c('0x15')](_0xe99c('0xf'),_0x561307,_0x51f0b3[_0xe99c('0xc')]);})[_0xe99c('0x10')](function(_0x284be0){logger[_0xe99c('0x11')](_0xe99c('0xf'),_0x561307,JSON[_0xe99c('0x26')](_0x284be0));})['finally'](function(){logger[_0xe99c('0x15')](_0xe99c('0x27'),_0x561307);_0x4bc2b1[_0xe99c('0x28')]();});}else{logger['info'](_0xe99c('0x29'),_0x561307);_0x4bc2b1[_0xe99c('0x28')]();}}else{var _0x45746a=this;var _0x4c9345=_0x22b4ff[0x2]['replace'](/\\n/g,'\x0a');var _0x188402={'credentials':{'private_key':_0x4c9345,'client_email':_0x22b4ff[0x1]}};var _0x31c3ed=new dialogflow['SessionsClient'](_0x188402);var _0xde6b3a=_0x31c3ed[_0xe99c('0x2a')](_0x22b4ff[0x0],md5(_0x45746a[_0xe99c('0x1d')]['id']));var _0x4e642d={'session':_0xde6b3a,'queryInput':{'text':{'text':_0x45746a['message'][_0xe99c('0xc')],'languageCode':_0x22b4ff[0x3]||'en'}}};return _0x31c3ed['detectIntent'](_0x4e642d)['then'](function(_0x4861ab){if(_0x4861ab&&_0x4861ab[_0xe99c('0x2b')]){_0x45746a[_0xe99c('0xc')][_0xe99c('0x2c')]=_0x4861ab;var _0x1896d6=_0x4861ab[0x0];var _0x54ced8=_0x1896d6['queryResult']['diagnosticInfo']&&_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x2e')][_0xe99c('0x2f')]?_0x1896d6['queryResult']['diagnosticInfo'][_0xe99c('0x2f')][_0xe99c('0x30')][_0xe99c('0x31')]:![];_0x45746a[_0xe99c('0xc')][_0xe99c('0x32')]=_0x1896d6['queryResult']['action'];_0x45746a[_0xe99c('0xc')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x33')];_0x45746a[_0xe99c('0xc')][_0xe99c('0x34')]=_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x2e')]&&_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x2e')][_0xe99c('0x2f')]?_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x2e')][_0xe99c('0x2f')][_0xe99c('0x30')][_0xe99c('0x31')]:![];_0x45746a[_0xe99c('0xc')][_0xe99c('0x35')]=_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x36')][_0xe99c('0x37')];_0x45746a[_0xe99c('0xc')][_0xe99c('0x38')]=_0x1896d6['queryResult']['intent'][_0xe99c('0x39')];_0x45746a[_0xe99c('0xc')][_0xe99c('0x3a')]=_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x36')]['isFallback'];_0x45746a[_0xe99c('0xc')][_0xe99c('0x3b')]=_0x1896d6['queryResult'][_0xe99c('0x3c')];_0x45746a[_0xe99c('0xc')][_0xe99c('0x3d')]=_0x1896d6['queryResult'][_0xe99c('0x3e')];_0x45746a[_0xe99c('0xc')][_0xe99c('0x3f')]=_0x1896d6[_0xe99c('0x2d')][_0xe99c('0x40')];_0x51f0b3['providerName']=_0xe99c('0x2c');_0x51f0b3[_0xe99c('0x41')]=JSON[_0xe99c('0x26')](_0x4861ab);var _0xd60ec1=[];for(var _0x5900f3=0x0;_0x5900f3<_0x4861ab['length'];_0x5900f3++){var _0x94aa64=_0x4861ab[_0x5900f3];if(_0x94aa64&&_0x94aa64['queryResult']&&_0x94aa64[_0xe99c('0x2d')][_0xe99c('0x42')]){_0xd60ec1['push'](createMessage(_0x561307,_0x2e4f2a,_0x51f0b3,_0x94aa64[_0xe99c('0x2d')][_0xe99c('0x42')]));}}return Promise[_0xe99c('0x43')](_0xd60ec1)[_0xe99c('0x25')](function(){if(_0x54ced8){_0x4bc2b1['next']();}else{_0x4bc2b1[_0xe99c('0x28')]();}})[_0xe99c('0x10')](function(_0x45f86f){logger[_0xe99c('0x11')](_0xe99c('0xf'),_0x561307,JSON[_0xe99c('0x26')](_0x45f86f));_0x4bc2b1[_0xe99c('0x16')]();});}})[_0xe99c('0x10')](function(_0x279c1e){logger[_0xe99c('0x11')](_0xe99c('0xf'),_0x561307,_0x279c1e[_0xe99c('0x44')]);_0x4bc2b1['next']();});}}catch(_0x1efad3){logger[_0xe99c('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x561307,JSON['stringify'](_0x1efad3));_0x4bc2b1[_0xe99c('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 31ca9e7..a4cb8e5 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7fd=['lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate'];(function(_0x40d1aa,_0x3fdd1f){var _0x17a614=function(_0x69d019){while(--_0x69d019){_0x40d1aa['push'](_0x40d1aa['shift']());}};_0x17a614(++_0x3fdd1f);}(_0xb7fd,0x104));var _0xdb7f=function(_0x5bee0c,_0x3e644b){_0x5bee0c=_0x5bee0c-0x0;var _0x225494=_0xb7fd[_0x5bee0c];return _0x225494;};'use strict';var schema=require(_0xdb7f('0x0'));var _=require(_0xdb7f('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xdb7f('0x2'));var logger=require(_0xdb7f('0x3'))(_0xdb7f('0x4'));var gotoif=schema({'condition':{'type':_0xdb7f('0x5'),'required':!![],'message':_0xdb7f('0x6')},'priorityTrue':{'type':_0xdb7f('0x7'),'message':_0xdb7f('0x8')},'priorityFalse':{'type':_0xdb7f('0x7'),'message':_0xdb7f('0x9')}});exports[_0xdb7f('0xa')]=function(_0x1fa722,_0x5b5316){return function(_0x2c4773){try{var _0x24de59={'condition':htmlToText[_0xdb7f('0xb')](utils[_0xdb7f('0xc')](_0x5b5316[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b5316[0x1],'priorityFalse':_0x5b5316[0x2]};var _0x33a6b3=gotoif[_0xdb7f('0x0')](_0x24de59,{'typecast':!![]});if(_0x33a6b3['length']){logger[_0xdb7f('0xd')](_0xdb7f('0xe'),_0x1fa722,_[_0xdb7f('0xf')](_0x33a6b3,'message')['join'](',\x20'));_0x2c4773['stop']();}else{try{var _0x33b459=eval('('+_0x24de59[_0xdb7f('0x10')]+')');var _0x2b614b=_0x33b459?_0x24de59[_0xdb7f('0x11')]:_0x24de59[_0xdb7f('0x12')];logger[_0xdb7f('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1fa722,_0x24de59['condition'],_0x33b459,_0x2b614b||'next');if(_0x2b614b){var _0x48425f=_[_0xdb7f('0x14')](_0x2c4773[_0xdb7f('0x15')](),{'p':_0x2b614b});if(_0x48425f>=0x0){logger[_0xdb7f('0x13')](_0xdb7f('0x16'),_0x1fa722,_0x2b614b||_0xdb7f('0x17'),_0x48425f);_0x2c4773['next'](_0x48425f);}else{logger[_0xdb7f('0x13')](_0xdb7f('0x18'),_0x1fa722,_0x2b614b||_0xdb7f('0x17'));_0x2c4773[_0xdb7f('0x19')]();}}else{_0x2c4773[_0xdb7f('0x17')]();}}catch(_0x22bb9){logger[_0xdb7f('0xd')](_0xdb7f('0x1a'),_0x1fa722,_0x22bb9[_0xdb7f('0x1b')]);_0x2c4773['stop']();}}}catch(_0x234c48){logger[_0xdb7f('0xd')](_0xdb7f('0xe'),_0x1fa722,JSON[_0xdb7f('0x1c')](_0x234c48));_0x2c4773[_0xdb7f('0x19')]();}};}; \ No newline at end of file +var _0xaca6=['priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x132e8,_0x2af623){var _0x43a160=function(_0x13c9f0){while(--_0x13c9f0){_0x132e8['push'](_0x132e8['shift']());}};_0x43a160(++_0x2af623);}(_0xaca6,0x1e3));var _0x6aca=function(_0x5f2f93,_0x1d772b){_0x5f2f93=_0x5f2f93-0x0;var _0x2a3d1b=_0xaca6[_0x5f2f93];return _0x2a3d1b;};'use strict';var schema=require(_0x6aca('0x0'));var _=require(_0x6aca('0x1'));var htmlToText=require(_0x6aca('0x2'));var utils=require(_0x6aca('0x3'));var logger=require(_0x6aca('0x4'))(_0x6aca('0x5'));var gotoif=schema({'condition':{'type':_0x6aca('0x6'),'required':!![],'message':_0x6aca('0x7')},'priorityTrue':{'type':_0x6aca('0x8'),'message':_0x6aca('0x9')},'priorityFalse':{'type':_0x6aca('0x8'),'message':_0x6aca('0xa')}});exports['consequence']=function(_0x3b790e,_0x4e9021){return function(_0x434586){try{var _0x2833d5={'condition':htmlToText[_0x6aca('0xb')](utils[_0x6aca('0xc')](_0x4e9021[0x0],this),{'wordwrap':![]})[_0x6aca('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4e9021[0x1],'priorityFalse':_0x4e9021[0x2]};var _0x5b5d14=gotoif[_0x6aca('0x0')](_0x2833d5,{'typecast':!![]});if(_0x5b5d14[_0x6aca('0xe')]){logger[_0x6aca('0xf')]('[%s][GOTOIF]\x20%s',_0x3b790e,_[_0x6aca('0x10')](_0x5b5d14,_0x6aca('0x11'))[_0x6aca('0x12')](',\x20'));_0x434586[_0x6aca('0x13')]();}else{try{var _0x5e534d=eval('('+_0x2833d5[_0x6aca('0x14')]+')');var _0x544fc1=_0x5e534d?_0x2833d5[_0x6aca('0x15')]:_0x2833d5[_0x6aca('0x16')];logger[_0x6aca('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3b790e,_0x2833d5[_0x6aca('0x14')],_0x5e534d,_0x544fc1||_0x6aca('0x18'));if(_0x544fc1){var _0xac38d5=_[_0x6aca('0x19')](_0x434586['rules'](),{'p':_0x544fc1});if(_0xac38d5>=0x0){logger[_0x6aca('0x17')](_0x6aca('0x1a'),_0x3b790e,_0x544fc1||'next',_0xac38d5);_0x434586[_0x6aca('0x18')](_0xac38d5);}else{logger[_0x6aca('0x17')](_0x6aca('0x1b'),_0x3b790e,_0x544fc1||'next');_0x434586[_0x6aca('0x13')]();}}else{_0x434586['next']();}}catch(_0x263f72){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3b790e,_0x263f72[_0x6aca('0x11')]);_0x434586[_0x6aca('0x13')]();}}}catch(_0x1bcf1d){logger[_0x6aca('0xf')]('[%s][GOTOIF]\x20%s',_0x3b790e,JSON[_0x6aca('0x1c')](_0x1bcf1d));_0x434586[_0x6aca('0x13')]();}};}; \ 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 179bc0a..ea115ea 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 _0xbf89=['info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','join','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x40c630,_0x35863d){var _0x5579f6=function(_0x1cc616){while(--_0x1cc616){_0x40c630['push'](_0x40c630['shift']());}};_0x5579f6(++_0x35863d);}(_0xbf89,0x124));var _0x9bf8=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xbf89[_0xbe40ad];return _0x50fac9;};'use strict';var schema=require(_0x9bf8('0x0'));var _=require(_0x9bf8('0x1'));var logger=require(_0x9bf8('0x2'))(_0x9bf8('0x3'));var gotop=schema({'priority':{'type':_0x9bf8('0x4'),'required':!![],'message':_0x9bf8('0x5')}});exports[_0x9bf8('0x6')]=function(_0x3b48d7,_0x2edbfd){return function(_0x207b8c){try{var _0x5a2873={'priority':_0x2edbfd[0x0]};var _0x462a6b=gotop['validate'](_0x5a2873,{'typecast':!![]});if(_0x462a6b['length']){logger[_0x9bf8('0x7')]('[%s][GOTOP]\x20%s',_0x3b48d7,_[_0x9bf8('0x8')](_0x462a6b,'message')[_0x9bf8('0x9')](',\x20'));_0x207b8c['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x3b48d7,_0x5a2873[_0x9bf8('0xa')]);if(_0x5a2873[_0x9bf8('0xa')]){var _0x1df818=_['findIndex'](_0x207b8c[_0x9bf8('0xb')](),{'p':_0x5a2873[_0x9bf8('0xa')]});if(_0x1df818>=0x0){logger['info'](_0x9bf8('0xc'),_0x3b48d7,_0x5a2873[_0x9bf8('0xa')]||_0x9bf8('0xd'),_0x1df818);_0x207b8c[_0x9bf8('0xd')](_0x1df818);}else{logger[_0x9bf8('0xe')](_0x9bf8('0xf'),_0x3b48d7,_0x5a2873[_0x9bf8('0xa')]||_0x9bf8('0xd'));_0x207b8c['stop']();}}else{_0x207b8c['next']();}}}catch(_0x26c741){logger[_0x9bf8('0x7')](_0x9bf8('0x10'),_0x3b48d7,JSON['stringify'](_0x26c741));_0x207b8c[_0x9bf8('0x11')]();}};}; \ No newline at end of file +var _0x61bc=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x42079c,_0xb9ee95){var _0x3b5c12=function(_0x300d86){while(--_0x300d86){_0x42079c['push'](_0x42079c['shift']());}};_0x3b5c12(++_0xb9ee95);}(_0x61bc,0x7c));var _0xc61b=function(_0x4ed49b,_0x14240b){_0x4ed49b=_0x4ed49b-0x0;var _0x4aa30c=_0x61bc[_0x4ed49b];return _0x4aa30c;};'use strict';var schema=require(_0xc61b('0x0'));var _=require(_0xc61b('0x1'));var logger=require(_0xc61b('0x2'))(_0xc61b('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xc61b('0x4')}});exports[_0xc61b('0x5')]=function(_0x4ce371,_0x1b1ba3){return function(_0x11e9e9){try{var _0x3f709c={'priority':_0x1b1ba3[0x0]};var _0x5a0985=gotop[_0xc61b('0x0')](_0x3f709c,{'typecast':!![]});if(_0x5a0985[_0xc61b('0x6')]){logger[_0xc61b('0x7')](_0xc61b('0x8'),_0x4ce371,_[_0xc61b('0x9')](_0x5a0985,_0xc61b('0xa'))['join'](',\x20'));_0x11e9e9[_0xc61b('0xb')]();}else{logger[_0xc61b('0xc')](_0xc61b('0xd'),_0x4ce371,_0x3f709c[_0xc61b('0xe')]);if(_0x3f709c[_0xc61b('0xe')]){var _0x2e7da1=_[_0xc61b('0xf')](_0x11e9e9[_0xc61b('0x10')](),{'p':_0x3f709c['priority']});if(_0x2e7da1>=0x0){logger['info'](_0xc61b('0x11'),_0x4ce371,_0x3f709c['priority']||_0xc61b('0x12'),_0x2e7da1);_0x11e9e9[_0xc61b('0x12')](_0x2e7da1);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4ce371,_0x3f709c['priority']||'next');_0x11e9e9[_0xc61b('0xb')]();}}else{_0x11e9e9[_0xc61b('0x12')]();}}}catch(_0xa2cb94){logger[_0xc61b('0x7')](_0xc61b('0x8'),_0x4ce371,JSON[_0xc61b('0x13')](_0xa2cb94));_0x11e9e9[_0xc61b('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index e9eafe6..a42ecb2 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 _0x0507=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','chat','account','upperFirst','AccountId','interaction','Message','then','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0507,0x15e));var _0x7050=function(_0x15b42d,_0x580bd2){_0x15b42d=_0x15b42d-0x0;var _0x4cda9e=_0x0507[_0x15b42d];return _0x4cda9e;};'use strict';var _=require(_0x7050('0x0'));var utils=require(_0x7050('0x1'));var logger=require(_0x7050('0x2'))(_0x7050('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7050('0x4')),'mailMessage':require(_0x7050('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7050('0x6')),'whatsappMessage':require(_0x7050('0x7'))};exports['consequence']=function(_0x3dfca1,_0x14a662){return function(_0x41ce3e){try{var _0x4b2915={'body':utils['getMustacheRender'](_0x14a662[0x0],this),'ContactId':this[_0x7050('0x8')]['id']};if(this[_0x7050('0x9')]===_0x7050('0xa')){_0x4b2915['ChatWebsiteId']=this[_0x7050('0xb')]['id'];}else{_0x4b2915[_[_0x7050('0xc')](this['channel'])+_0x7050('0xd')]=this[_0x7050('0xb')]['id'];}_0x4b2915[_[_0x7050('0xc')](this[_0x7050('0x9')])+'InteractionId']=this[_0x7050('0xe')]['id'];if(rpc[this['channel']+_0x7050('0xf')]){return rpc[this[_0x7050('0x9')]+'Message']['create'](_0x4b2915)[_0x7050('0x10')](function(_0x404bd8){logger[_0x7050('0x11')](_0x7050('0x12'),_0x3dfca1,_0x4b2915['body']);_0x41ce3e[_0x7050('0x13')]();})[_0x7050('0x14')](function(_0x1e7df0){logger[_0x7050('0x15')](_0x7050('0x12'),_0x3dfca1,JSON[_0x7050('0x16')](_0x1e7df0));_0x41ce3e['stop']();});}}catch(_0x10d412){logger[_0x7050('0x15')]('[%s][MESSAGE]\x20%s',_0x3dfca1,JSON['stringify'](_0x10d412));_0x41ce3e['stop']();}};}; \ No newline at end of file +var _0xf84a=['info','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','Message','create','then'];(function(_0x29ab4c,_0x4177d4){var _0x35dafb=function(_0x379f88){while(--_0x379f88){_0x29ab4c['push'](_0x29ab4c['shift']());}};_0x35dafb(++_0x4177d4);}(_0xf84a,0x97));var _0xaf84=function(_0x46b394,_0x37aadc){_0x46b394=_0x46b394-0x0;var _0x32d044=_0xf84a[_0x46b394];return _0x32d044;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xaf84('0x0'))(_0xaf84('0x1'));var rpc={'chatMessage':require(_0xaf84('0x2')),'openchannelMessage':require(_0xaf84('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaf84('0x4')),'faxMessage':require(_0xaf84('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xaf84('0x6')]=function(_0x300a58,_0x246ab7){return function(_0x3db4e9){try{var _0x551f84={'body':utils[_0xaf84('0x7')](_0x246ab7[0x0],this),'ContactId':this[_0xaf84('0x8')]['id']};if(this[_0xaf84('0x9')]===_0xaf84('0xa')){_0x551f84['ChatWebsiteId']=this[_0xaf84('0xb')]['id'];}else{_0x551f84[_[_0xaf84('0xc')](this[_0xaf84('0x9')])+_0xaf84('0xd')]=this[_0xaf84('0xb')]['id'];}_0x551f84[_[_0xaf84('0xc')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xaf84('0xe')]){return rpc[this[_0xaf84('0x9')]+_0xaf84('0xe')][_0xaf84('0xf')](_0x551f84)[_0xaf84('0x10')](function(_0x1024af){logger[_0xaf84('0x11')](_0xaf84('0x12'),_0x300a58,_0x551f84['body']);_0x3db4e9[_0xaf84('0x13')]();})[_0xaf84('0x14')](function(_0x4fb427){logger[_0xaf84('0x15')](_0xaf84('0x12'),_0x300a58,JSON['stringify'](_0x4fb427));_0x3db4e9[_0xaf84('0x16')]();});}}catch(_0x3ee365){logger[_0xaf84('0x15')](_0xaf84('0x12'),_0x300a58,JSON[_0xaf84('0x17')](_0x3ee365));_0x3db4e9[_0xaf84('0x16')]();}};}; \ 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 60e0072..20aa365 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 _0xf5b8=['[%s][NOOP]\x20%s','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x234c2a,_0x3b62f2){var _0x243d8d=function(_0x37736f){while(--_0x37736f){_0x234c2a['push'](_0x234c2a['shift']());}};_0x243d8d(++_0x3b62f2);}(_0xf5b8,0x8b));var _0x8f5b=function(_0x126e28,_0x112ec2){_0x126e28=_0x126e28-0x0;var _0x5775c8=_0xf5b8[_0x126e28];return _0x5775c8;};'use strict';var utils=require(_0x8f5b('0x0'));var logger=require(_0x8f5b('0x1'))(_0x8f5b('0x2'));exports[_0x8f5b('0x3')]=function(_0x458f97,_0x5540d1){return function(_0x618c51){try{logger[_0x8f5b('0x4')](_0x8f5b('0x5'),_0x458f97,utils['getMustacheRender'](_0x5540d1[0x0],this));_0x618c51['next']();}catch(_0x5f040c){logger[_0x8f5b('0x6')](_0x8f5b('0x5'),_0x458f97,JSON[_0x8f5b('0x7')](_0x5f040c));_0x618c51[_0x8f5b('0x8')]();}};}; \ No newline at end of file +var _0x06e7=['error','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0xa7fdba,_0x50f870){var _0x3d0727=function(_0xac2d24){while(--_0xac2d24){_0xa7fdba['push'](_0xa7fdba['shift']());}};_0x3d0727(++_0x50f870);}(_0x06e7,0x1a9));var _0x706e=function(_0x57f3be,_0x2860d9){_0x57f3be=_0x57f3be-0x0;var _0x13eb40=_0x06e7[_0x57f3be];return _0x13eb40;};'use strict';var utils=require(_0x706e('0x0'));var logger=require('../../../../config/logger')(_0x706e('0x1'));exports[_0x706e('0x2')]=function(_0x446c7f,_0x4a33f9){return function(_0x242fde){try{logger[_0x706e('0x3')](_0x706e('0x4'),_0x446c7f,utils[_0x706e('0x5')](_0x4a33f9[0x0],this));_0x242fde[_0x706e('0x6')]();}catch(_0x1ef98d){logger[_0x706e('0x7')](_0x706e('0x4'),_0x446c7f,JSON['stringify'](_0x1ef98d));_0x242fde[_0x706e('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6ea64b5..b518ee6 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 _0xb84e=['InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','Queues','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','defaults','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xb84e,0xbf));var _0xeb84=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0xb84e[_0x200aa5];return _0x458200;};'use strict';var schema=require('validate');var _=require(_0xeb84('0x0'));var util=require(_0xeb84('0x1'));var seqqueue=require(_0xeb84('0x2'));var moment=require(_0xeb84('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xeb84('0x4'))(_0xeb84('0x5'));var strategy=require(_0xeb84('0x6'));config[_0xeb84('0x7')]=_[_0xeb84('0x8')](config[_0xeb84('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeb84('0x7')]));var attributes=['id','queue_id',_0xeb84('0x9'),_0xeb84('0xa'),_0xeb84('0xb'),_0xeb84('0xc')];function emit(_0x5b1b26,_0x156b9a,_0x94f704){io['to'](_0x5b1b26)[_0xeb84('0xd')](_0x156b9a,_0x94f704);}function emitChannelQueueInteraction(_0x2d81e5,_0x2839ec,_0x159896,_0x3f38d4,_0x4559a8,_0x179a1a,_0x260a97,_0x45c8ca){var _0x2b884e=_[_0xeb84('0xe')](_0x159896);_0x2b884e['queue_id']=_0x45c8ca;_0x2b884e['queue']=_0x2839ec;_0x2b884e[_0xeb84('0x9')]=_0x3f38d4;_0x2b884e['id']=_0x4559a8;if(_0x179a1a){_0x260a97[util[_0xeb84('0xf')](_0xeb84('0x10'),_0x2d81e5)][_0x4559a8]=_[_0xeb84('0x11')](_0x2b884e,attributes);}else{delete _0x260a97[util[_0xeb84('0xf')](_0xeb84('0x10'),_0x2d81e5)][_0x4559a8];}emit(util['format'](_0xeb84('0x12'),_0x2d81e5,_0x2839ec),util[_0xeb84('0xf')](_0xeb84('0x13'),_0x2d81e5,_0x179a1a?_0xeb84('0x14'):'remove'),_[_0xeb84('0x11')](_0x2b884e,attributes));}var rpc={'openchannelQueueReport':require(_0xeb84('0x15')),'mailQueueReport':require(_0xeb84('0x16')),'chatQueueReport':require(_0xeb84('0x17')),'smsQueueReport':require(_0xeb84('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xeb84('0x19'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xeb84('0x1a')},'timeout':{'type':_0xeb84('0x1b'),'message':_0xeb84('0x1c')}});function startRouting(_0x4bb89d,_0x568a75,_0x2824f6,_0x255c26){if(_0x4bb89d&&_0x568a75&&_0x2824f6){_0x568a75[_0xeb84('0x1d')]+=0x1;var _0x3ac277={'uniqueid':_0x4bb89d,'from':_0x2824f6[_0xeb84('0x1e')]?_0x2824f6[_0xeb84('0x1e')][_0xeb84('0xb')]:'','joinAt':moment()[_0xeb84('0xf')](_0xeb84('0x1f')),'ContactId':_0x2824f6[_0xeb84('0x20')]?_0x2824f6[_0xeb84('0x20')]['id']:null,'ListId':_0x2824f6[_0xeb84('0x21')]?_0x2824f6[_0xeb84('0x21')]['id']:null};_0x3ac277[_[_0xeb84('0x22')](_0x2824f6[_0xeb84('0x23')])+_0xeb84('0x24')]=_0x568a75['id']||null;_0x3ac277[_['upperFirst'](_0x2824f6[_0xeb84('0x23')])+_0xeb84('0x25')]=_0x2824f6['interaction']?_0x2824f6[_0xeb84('0x26')]['id']:null;_0x3ac277[_[_0xeb84('0x22')](_0x2824f6[_0xeb84('0x23')])+_0xeb84('0x27')]=_0x2824f6[_0xeb84('0x28')]?_0x2824f6[_0xeb84('0x28')]['id']:null;_0x3ac277[_[_0xeb84('0x22')](_0x2824f6['channel'])+(_0x2824f6['channel']!==_0xeb84('0x29')?_0xeb84('0x2a'):_0xeb84('0x2b'))]=_0x2824f6[_0xeb84('0x9')]?_0x2824f6[_0xeb84('0x9')]['id']:null;logger[_0xeb84('0x2c')](util[_0xeb84('0xf')](_0xeb84('0x2d'),_0x4bb89d,_0x568a75[_0xeb84('0x2e')]));emitChannelQueueInteraction(_0x2824f6[_0xeb84('0x23')],_0x568a75[_0xeb84('0x2e')],_0x3ac277,_0x2824f6[_0xeb84('0x9')][_0xeb84('0x2e')],_0x2824f6[_0xeb84('0x28')]['id'],!![],_0x255c26,_0x568a75['id']);if(rpc[_0x2824f6['channel']+_0xeb84('0x2f')]){return rpc[_0x2824f6[_0xeb84('0x23')]+_0xeb84('0x2f')][_0xeb84('0x30')](_0x3ac277)[_0xeb84('0x31')](function(_0x433d7f){logger[_0xeb84('0x32')](_0xeb84('0x33'));});}}}function stopRouting(_0x278a0d,_0x35061c,_0x466c08,_0x54b072){if(_0x278a0d&&_0x35061c){_0x35061c['waiting']-=0x1;var _0x19e00b={'leaveAt':moment()['format'](_0xeb84('0x1f')),'acceptAt':moment()[_0xeb84('0xf')](_0xeb84('0x1f')),'reason':_0xeb84('0x34')};logger['info'](util['format'](_0xeb84('0x35'),_0x278a0d,_0x35061c[_0xeb84('0x2e')]));emitChannelQueueInteraction(_0x466c08['channel'],_0x35061c[_0xeb84('0x2e')],_0x466c08[_0xeb84('0x1e')],_0x466c08['account'][_0xeb84('0x2e')],_0x466c08[_0xeb84('0x28')]['id'],![],_0x54b072,_0x35061c['id']);if(rpc[_0x466c08['channel']+_0xeb84('0x2f')]){return rpc[_0x466c08['channel']+'QueueReport'][_0xeb84('0x36')](_0x278a0d,_0x19e00b)['catch'](function(_0x11640c){logger[_0xeb84('0x32')](_0xeb84('0x37'));});}}}function endRouting(_0x25ec5f,_0x538c33,_0x18b22d,_0x516b96){if(_0x25ec5f&&_0x538c33){_0x538c33[_0xeb84('0x1d')]-=0x1;var _0x25b031={'leaveAt':moment()[_0xeb84('0xf')](_0xeb84('0x1f')),'exitAt':moment()[_0xeb84('0xf')](_0xeb84('0x1f')),'reason':_0xeb84('0x38')};logger[_0xeb84('0x2c')](util['format'](_0xeb84('0x39'),_0x25ec5f,_0x538c33[_0xeb84('0x2e')]));emitChannelQueueInteraction(_0x18b22d[_0xeb84('0x23')],_0x538c33[_0xeb84('0x2e')],_0x18b22d[_0xeb84('0x1e')],_0x18b22d[_0xeb84('0x9')]['name'],_0x18b22d['message']['id'],![],_0x516b96);if(rpc[_0x18b22d[_0xeb84('0x23')]+'QueueReport']){return rpc[_0x18b22d[_0xeb84('0x23')]+_0xeb84('0x2f')][_0xeb84('0x36')](_0x25ec5f,_0x25b031)['catch'](function(_0x34d9f5){logger[_0xeb84('0x32')](_0xeb84('0x37'));});}}}function handleFindQueue(_0x493523){return function(_0x3dd3bc){return _0x3dd3bc['name'][_0xeb84('0x3a')]()===_0x493523['toLowerCase']();};}exports[_0xeb84('0x3b')]=function(_0x418bcd,_0x5095f3,_0x5ab301,_0x6f1442){return function(_0x10b6a4){try{var _0x209a99={'name':_0x5095f3[0x0],'timeout':_0x5095f3[0x1]};var _0x4e4df3=queue['validate'](_0x209a99,{'typecast':!![]});if(_0x4e4df3[_0xeb84('0x3c')]){logger[_0xeb84('0x32')]('[%s][QUEUE]\x20%s',_0x418bcd,_[_0xeb84('0x3d')](_0x4e4df3,'message')[_0xeb84('0x3e')](',\x20'));_0x10b6a4[_0xeb84('0x3f')]();}else{var _0x48d62a=_[_0xeb84('0x40')](_0x5ab301[_0x6f1442[_0xeb84('0x23')]+_0xeb84('0x41')],handleFindQueue(_0x209a99[_0xeb84('0x2e')]));if(_0x48d62a){startRouting(_0x418bcd,_0x48d62a,_0x6f1442,_0x5ab301);var _0x38a77d=(_0x48d62a[_0xeb84('0x38')]||0xa)*0x3e8;var _0x5bb7ce=(_0x209a99[_0xeb84('0x38')]||0x14)*0x3e8;var _0x2118a9,_0x4faeea;if(_0x38a77d>_0x5bb7ce){_0x5bb7ce=_0x38a77d;}var _0x473b34=seqqueue['createQueue'](_0x38a77d);_0x473b34['id']=_0x418bcd;_0x473b34['atimeout']=_0x38a77d;_0x473b34[_0xeb84('0x42')]=_0x5bb7ce;_0x473b34[_0xeb84('0x23')]=_0x6f1442[_0xeb84('0x23')];_0x5ab301[_0xeb84('0x43')][_0x418bcd]['on']('end',function(){logger[_0xeb84('0x2c')](_0xeb84('0x44'),_0x418bcd);stopRouting(_0x418bcd,_0x48d62a,_0x6f1442,_0x5ab301);clearTimeout(_0x2118a9);_0x2118a9=undefined;_0x473b34[_0xeb84('0x45')](!![]);if(_0x5ab301[_0xeb84('0x43')][_0x418bcd]){delete _0x5ab301[_0xeb84('0x43')][_0x418bcd];}_0x10b6a4['stop']();});_0x5ab301[_0xeb84('0x43')][_0x418bcd]['on']('complete',function(){if(_0x5ab301['rules'][_0x418bcd]){delete _0x5ab301['rules'][_0x418bcd];}});_0x2118a9=setTimeout(function(){logger[_0xeb84('0x2c')](_0xeb84('0x46'),_0x418bcd);endRouting(_0x418bcd,_0x48d62a,_0x6f1442,_0x5ab301);clearTimeout(_0x2118a9);_0x473b34[_0xeb84('0x45')](!![]);_0x10b6a4['next']();},_0x5bb7ce);switch(_0x48d62a[_0xeb84('0x47')]){case _0xeb84('0x48'):strategy[_0xeb84('0x48')](_0x473b34,_0x48d62a,_0x5ab301,_0x6f1442);break;default:strategy[_0xeb84('0x49')](_0x473b34,_0x48d62a,_0x5ab301,_0x6f1442);}}else{logger[_0xeb84('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x418bcd,_0x209a99['name']);_0x10b6a4['stop']();}}}catch(_0x52ea44){console[_0xeb84('0x4a')](_0x52ea44);logger[_0xeb84('0x32')](_0xeb84('0x4b'),_0x418bcd,_0x52ea44['stack']);_0x10b6a4[_0xeb84('0x3f')]();}};}; \ No newline at end of file +var _0x4cea=['clone','queue','format','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','account','from','joinAt','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4cea,0x13c));var _0xa4ce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4cea[_0x21a9d9];return _0x46adce;};'use strict';var schema=require(_0xa4ce('0x0'));var _=require(_0xa4ce('0x1'));var util=require(_0xa4ce('0x2'));var seqqueue=require(_0xa4ce('0x3'));var moment=require(_0xa4ce('0x4'));var Redis=require(_0xa4ce('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa4ce('0x6'))('routing');var strategy=require(_0xa4ce('0x7'));config[_0xa4ce('0x8')]=_[_0xa4ce('0x9')](config[_0xa4ce('0x8')],{'host':_0xa4ce('0xa'),'port':0x18eb});var io=require(_0xa4ce('0xb'))(new Redis(config[_0xa4ce('0x8')]));var attributes=['id','queue_id',_0xa4ce('0xc'),'queue',_0xa4ce('0xd'),_0xa4ce('0xe')];function emit(_0x154bb9,_0x1036fa,_0x5a3e43){io['to'](_0x154bb9)[_0xa4ce('0xf')](_0x1036fa,_0x5a3e43);}function emitChannelQueueInteraction(_0x87597a,_0x35e5f4,_0x57fb8f,_0xafed2e,_0x7a18ee,_0x3ed3eb,_0x5a0c85,_0x4e0fa8){var _0x1d008=_[_0xa4ce('0x10')](_0x57fb8f);_0x1d008['queue_id']=_0x4e0fa8;_0x1d008[_0xa4ce('0x11')]=_0x35e5f4;_0x1d008[_0xa4ce('0xc')]=_0xafed2e;_0x1d008['id']=_0x7a18ee;if(_0x3ed3eb){_0x5a0c85[util[_0xa4ce('0x12')]('%sQueuesWaitingInteractions',_0x87597a)][_0x7a18ee]=_[_0xa4ce('0x13')](_0x1d008,attributes);}else{delete _0x5a0c85[util['format']('%sQueuesWaitingInteractions',_0x87597a)][_0x7a18ee];}emit(util[_0xa4ce('0x12')]('%s:queue:%s',_0x87597a,_0x35e5f4),util['format'](_0xa4ce('0x14'),_0x87597a,_0x3ed3eb?_0xa4ce('0x15'):_0xa4ce('0x16')),_[_0xa4ce('0x13')](_0x1d008,attributes));}var rpc={'openchannelQueueReport':require(_0xa4ce('0x17')),'mailQueueReport':require(_0xa4ce('0x18')),'chatQueueReport':require(_0xa4ce('0x19')),'smsQueueReport':require(_0xa4ce('0x1a')),'faxQueueReport':require(_0xa4ce('0x1b')),'whatsappQueueReport':require(_0xa4ce('0x1c'))};var queue=schema({'name':{'type':_0xa4ce('0x1d'),'required':!![],'message':_0xa4ce('0x1e')},'timeout':{'type':_0xa4ce('0x1f'),'message':_0xa4ce('0x20')}});function startRouting(_0x4d0c06,_0xeeca20,_0xae136b,_0x3070c5){if(_0x4d0c06&&_0xeeca20&&_0xae136b){_0xeeca20['waiting']+=0x1;var _0x5b201e={'uniqueid':_0x4d0c06,'from':_0xae136b[_0xa4ce('0x21')]?_0xae136b['body'][_0xa4ce('0xd')]:'','joinAt':moment()[_0xa4ce('0x12')](_0xa4ce('0x22')),'ContactId':_0xae136b[_0xa4ce('0x23')]?_0xae136b['contact']['id']:null,'ListId':_0xae136b[_0xa4ce('0x24')]?_0xae136b[_0xa4ce('0x24')]['id']:null};_0x5b201e[_[_0xa4ce('0x25')](_0xae136b[_0xa4ce('0x26')])+_0xa4ce('0x27')]=_0xeeca20['id']||null;_0x5b201e[_['upperFirst'](_0xae136b['channel'])+_0xa4ce('0x28')]=_0xae136b[_0xa4ce('0x29')]?_0xae136b[_0xa4ce('0x29')]['id']:null;_0x5b201e[_[_0xa4ce('0x25')](_0xae136b[_0xa4ce('0x26')])+_0xa4ce('0x2a')]=_0xae136b[_0xa4ce('0x2b')]?_0xae136b[_0xa4ce('0x2b')]['id']:null;_0x5b201e[_['upperFirst'](_0xae136b[_0xa4ce('0x26')])+(_0xae136b[_0xa4ce('0x26')]!=='chat'?_0xa4ce('0x2c'):_0xa4ce('0x2d'))]=_0xae136b[_0xa4ce('0xc')]?_0xae136b[_0xa4ce('0xc')]['id']:null;logger[_0xa4ce('0x2e')](util[_0xa4ce('0x12')](_0xa4ce('0x2f'),_0x4d0c06,_0xeeca20[_0xa4ce('0x30')]));emitChannelQueueInteraction(_0xae136b['channel'],_0xeeca20[_0xa4ce('0x30')],_0x5b201e,_0xae136b['account']['name'],_0xae136b[_0xa4ce('0x2b')]['id'],!![],_0x3070c5,_0xeeca20['id']);if(rpc[_0xae136b[_0xa4ce('0x26')]+_0xa4ce('0x31')]){return rpc[_0xae136b[_0xa4ce('0x26')]+_0xa4ce('0x31')][_0xa4ce('0x32')](_0x5b201e)[_0xa4ce('0x33')](function(_0x5a573e){logger[_0xa4ce('0x34')](_0xa4ce('0x35'));});}}}function stopRouting(_0x33ad57,_0x438344,_0x16f409,_0x4068e6){if(_0x33ad57&&_0x438344){_0x438344['waiting']-=0x1;var _0x573485={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa4ce('0x12')](_0xa4ce('0x22')),'reason':_0xa4ce('0x36')};logger[_0xa4ce('0x2e')](util[_0xa4ce('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x33ad57,_0x438344[_0xa4ce('0x30')]));emitChannelQueueInteraction(_0x16f409[_0xa4ce('0x26')],_0x438344[_0xa4ce('0x30')],_0x16f409[_0xa4ce('0x21')],_0x16f409[_0xa4ce('0xc')]['name'],_0x16f409[_0xa4ce('0x2b')]['id'],![],_0x4068e6,_0x438344['id']);if(rpc[_0x16f409[_0xa4ce('0x26')]+_0xa4ce('0x31')]){return rpc[_0x16f409['channel']+_0xa4ce('0x31')][_0xa4ce('0x37')](_0x33ad57,_0x573485)[_0xa4ce('0x33')](function(_0x5a9cdf){logger['error'](_0xa4ce('0x38'));});}}}function endRouting(_0x52de9f,_0x24f43c,_0x379808,_0x3a9c4b){if(_0x52de9f&&_0x24f43c){_0x24f43c[_0xa4ce('0x39')]-=0x1;var _0x39904e={'leaveAt':moment()['format'](_0xa4ce('0x22')),'exitAt':moment()[_0xa4ce('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa4ce('0x3a')};logger[_0xa4ce('0x2e')](util[_0xa4ce('0x12')](_0xa4ce('0x3b'),_0x52de9f,_0x24f43c[_0xa4ce('0x30')]));emitChannelQueueInteraction(_0x379808[_0xa4ce('0x26')],_0x24f43c[_0xa4ce('0x30')],_0x379808[_0xa4ce('0x21')],_0x379808['account'][_0xa4ce('0x30')],_0x379808[_0xa4ce('0x2b')]['id'],![],_0x3a9c4b);if(rpc[_0x379808[_0xa4ce('0x26')]+_0xa4ce('0x31')]){return rpc[_0x379808[_0xa4ce('0x26')]+_0xa4ce('0x31')][_0xa4ce('0x37')](_0x52de9f,_0x39904e)[_0xa4ce('0x33')](function(_0x8ad62e){logger[_0xa4ce('0x34')](_0xa4ce('0x38'));});}}}function handleFindQueue(_0x5da502){return function(_0x16f6ba){return _0x16f6ba[_0xa4ce('0x30')][_0xa4ce('0x3c')]()===_0x5da502[_0xa4ce('0x3c')]();};}exports['consequence']=function(_0x217355,_0x3c20ec,_0x46438d,_0x1905f1){return function(_0x4be6a6){try{var _0xd5facb={'name':_0x3c20ec[0x0],'timeout':_0x3c20ec[0x1]};var _0x35fc5d=queue[_0xa4ce('0x0')](_0xd5facb,{'typecast':!![]});if(_0x35fc5d[_0xa4ce('0x3d')]){logger[_0xa4ce('0x34')](_0xa4ce('0x3e'),_0x217355,_[_0xa4ce('0x3f')](_0x35fc5d,_0xa4ce('0x2b'))[_0xa4ce('0x40')](',\x20'));_0x4be6a6[_0xa4ce('0x41')]();}else{var _0x4d1810=_['find'](_0x46438d[_0x1905f1[_0xa4ce('0x26')]+_0xa4ce('0x42')],handleFindQueue(_0xd5facb['name']));if(_0x4d1810){startRouting(_0x217355,_0x4d1810,_0x1905f1,_0x46438d);var _0xdeb7c7=(_0x4d1810[_0xa4ce('0x3a')]||0xa)*0x3e8;var _0x50af7d=(_0xd5facb[_0xa4ce('0x3a')]||0x14)*0x3e8;var _0x214af3,_0x187997;if(_0xdeb7c7>_0x50af7d){_0x50af7d=_0xdeb7c7;}var _0x1ff56c=seqqueue[_0xa4ce('0x43')](_0xdeb7c7);_0x1ff56c['id']=_0x217355;_0x1ff56c[_0xa4ce('0x44')]=_0xdeb7c7;_0x1ff56c[_0xa4ce('0x45')]=_0x50af7d;_0x1ff56c[_0xa4ce('0x26')]=_0x1905f1[_0xa4ce('0x26')];_0x46438d['rules'][_0x217355]['on'](_0xa4ce('0x46'),function(){logger[_0xa4ce('0x2e')](_0xa4ce('0x47'),_0x217355);stopRouting(_0x217355,_0x4d1810,_0x1905f1,_0x46438d);clearTimeout(_0x214af3);_0x214af3=undefined;_0x1ff56c['close'](!![]);if(_0x46438d[_0xa4ce('0x48')][_0x217355]){delete _0x46438d[_0xa4ce('0x48')][_0x217355];}_0x4be6a6[_0xa4ce('0x41')]();});_0x46438d[_0xa4ce('0x48')][_0x217355]['on'](_0xa4ce('0x49'),function(){if(_0x46438d[_0xa4ce('0x48')][_0x217355]){delete _0x46438d[_0xa4ce('0x48')][_0x217355];}});_0x214af3=setTimeout(function(){logger[_0xa4ce('0x2e')](_0xa4ce('0x4a'),_0x217355);endRouting(_0x217355,_0x4d1810,_0x1905f1,_0x46438d);clearTimeout(_0x214af3);_0x1ff56c[_0xa4ce('0x4b')](!![]);_0x4be6a6[_0xa4ce('0x4c')]();},_0x50af7d);switch(_0x4d1810[_0xa4ce('0x4d')]){case _0xa4ce('0x4e'):strategy['rrmemory'](_0x1ff56c,_0x4d1810,_0x46438d,_0x1905f1);break;default:strategy[_0xa4ce('0x4f')](_0x1ff56c,_0x4d1810,_0x46438d,_0x1905f1);}}else{logger['error'](_0xa4ce('0x50'),_0x217355,_0xd5facb['name']);_0x4be6a6[_0xa4ce('0x41')]();}}}catch(_0x59e16f){console[_0xa4ce('0x51')](_0x59e16f);logger['error'](_0xa4ce('0x3e'),_0x217355,_0x59e16f[_0xa4ce('0x52')]);_0x4be6a6[_0xa4ce('0x41')]();}};}; \ 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 8e1b475..355dd65 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 _0xa98c=['prototype','debug','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','RINGING',':FORCED','isNil','writeLog','exports','uuid','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','handleDrained'];(function(_0x49036e,_0x1eed49){var _0xb21daf=function(_0x17b545){while(--_0x17b545){_0x49036e['push'](_0x49036e['shift']());}};_0xb21daf(++_0x1eed49);}(_0xa98c,0x108));var _0xca98=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xa98c[_0x3b76f7];return _0x43984e;};'use strict';var _=require('lodash');var uuid=require(_0xca98('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xca98('0x1'));var Agent=function(_0x51b8cd,_0x2940b2,_0x10ae51,_0x17a1d0){this[_0xca98('0x2')]=uuid['v4']();this[_0xca98('0x3')]=_0x51b8cd;this[_0xca98('0x4')]=_0x2940b2;this[_0xca98('0x5')]=_0x10ae51;this['routing']=_0x17a1d0;this[_0xca98('0x3')][_0xca98('0x6')](this[_0xca98('0x7')][_0xca98('0x8')](this),this[_0xca98('0x9')][_0xca98('0x8')](this));this[_0xca98('0x3')]['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this[_0xca98('0xa')][_0xca98('0x8')](this));};Agent[_0xca98('0xb')]['push']=function(){this[_0xca98('0x3')]['push'](this[_0xca98('0x7')]['bind'](this),this[_0xca98('0x9')][_0xca98('0x8')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xca98('0xb')]['handleRun']=function(){logger[_0xca98('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xca98('0x3')]['id'],this[_0xca98('0x4')]['id']);if(_['isNil'](this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']])){logger[_0xca98('0xc')](_0xca98('0xe'),this[_0xca98('0x3')]['id'],this[_0xca98('0x4')]['id']);setTimeout(this[_0xca98('0x6')][_0xca98('0x8')](this),0x3e8);}else{if(this['routing'][_0xca98('0xf')]||util['isAgentAvailable'](this[_0xca98('0x3')]['id'],this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']],this[_0xca98('0x3')][_0xca98('0x10')],![])){this['realtime']['agents'][this['agent']['id']][_0xca98('0x11')]=!![];this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']][_0xca98('0x12')]=undefined;util[_0xca98('0x13')](this[_0xca98('0x2')],this[_0xca98('0x3')]['id'],this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']],null,this[_0xca98('0x1')]);util['writeLog'](this['squeue']['id'],this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']],_0xca98('0x14')+(this[_0xca98('0x1')][_0xca98('0xf')]?_0xca98('0x15'):''));}else{logger[_0xca98('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xca98('0x4')]['id']);setTimeout(this[_0xca98('0x6')]['bind'](this),0x3e8);}}};Agent[_0xca98('0xb')][_0xca98('0x9')]=function(_0x753b8d){if(_[_0xca98('0x16')](this['realtime']['agents'][this[_0xca98('0x4')]['id']])){return logger[_0xca98('0xc')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xca98('0x3')]['id'],this[_0xca98('0x4')]['id']);}else{logger[_0xca98('0xc')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xca98('0x3')]['id'],this[_0xca98('0x4')]['id']);util['hideNotification'](this[_0xca98('0x2')],this[_0xca98('0x3')]['id'],this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']],null,this['routing']);this[_0xca98('0x5')]['agents'][this[_0xca98('0x4')]['id']][_0xca98('0x11')]=![];this[_0xca98('0x5')]['agents'][this[_0xca98('0x4')]['id']][_0xca98('0x12')]=undefined;util[_0xca98('0x17')](this[_0xca98('0x3')]['id'],this[_0xca98('0x5')][_0xca98('0xd')][this[_0xca98('0x4')]['id']],_0x753b8d?'STOP':'TIMEOUT');}if(!_0x753b8d){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x519800,_0x48af50,_0x397ffe,_0x411c26){return new Agent(_0x519800,_0x48af50,_0x397ffe,_0x411c26);}module[_0xca98('0x18')]=agent; \ No newline at end of file +var _0x7aca=['debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','busyQueue','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','notificationId','agent','routing','push','handleRun','bind','handleTimeout','handleDrained','squeue','prototype'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x7aca,0x67));var _0xa7ac=function(_0x4bc8fe,_0x319d8b){_0x4bc8fe=_0x4bc8fe-0x0;var _0x4bb539=_0x7aca[_0x4bc8fe];return _0x4bb539;};'use strict';var _=require(_0xa7ac('0x0'));var uuid=require(_0xa7ac('0x1'));var util=require('./util');var logger=require(_0xa7ac('0x2'))('routing');var Agent=function(_0x375a66,_0x136ed7,_0x3106d1,_0x51fe82){this[_0xa7ac('0x3')]=uuid['v4']();this['squeue']=_0x375a66;this[_0xa7ac('0x4')]=_0x136ed7;this['realtime']=_0x3106d1;this[_0xa7ac('0x5')]=_0x51fe82;this['squeue'][_0xa7ac('0x6')](this[_0xa7ac('0x7')][_0xa7ac('0x8')](this),this[_0xa7ac('0x9')][_0xa7ac('0x8')](this));this['squeue']['on']('timeout',this[_0xa7ac('0x9')][_0xa7ac('0x8')](this));this['squeue']['on']('drained',this[_0xa7ac('0xa')][_0xa7ac('0x8')](this));};Agent['prototype'][_0xa7ac('0x6')]=function(){this[_0xa7ac('0xb')][_0xa7ac('0x6')](this[_0xa7ac('0x7')][_0xa7ac('0x8')](this),this[_0xa7ac('0x9')][_0xa7ac('0x8')](this));};Agent[_0xa7ac('0xc')]['handleDrained']=function(){this[_0xa7ac('0x9')](!![]);};Agent['prototype'][_0xa7ac('0x7')]=function(){logger[_0xa7ac('0xd')](_0xa7ac('0xe'),this[_0xa7ac('0xb')]['id'],this[_0xa7ac('0x4')]['id']);if(_['isNil'](this[_0xa7ac('0xf')]['agents'][this['agent']['id']])){logger['debug'](_0xa7ac('0x10'),this[_0xa7ac('0xb')]['id'],this[_0xa7ac('0x4')]['id']);setTimeout(this['push'][_0xa7ac('0x8')](this),0x3e8);}else{if(this[_0xa7ac('0x5')][_0xa7ac('0x11')]||util['isAgentAvailable'](this[_0xa7ac('0xb')]['id'],this[_0xa7ac('0xf')][_0xa7ac('0x12')][this[_0xa7ac('0x4')]['id']],this[_0xa7ac('0xb')][_0xa7ac('0x13')],![])){this[_0xa7ac('0xf')][_0xa7ac('0x12')][this[_0xa7ac('0x4')]['id']][_0xa7ac('0x14')]=!![];this[_0xa7ac('0xf')][_0xa7ac('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0xa7ac('0x15')](this[_0xa7ac('0x3')],this['squeue']['id'],this[_0xa7ac('0xf')]['agents'][this[_0xa7ac('0x4')]['id']],null,this[_0xa7ac('0x5')]);util[_0xa7ac('0x16')](this['squeue']['id'],this[_0xa7ac('0xf')]['agents'][this['agent']['id']],_0xa7ac('0x17')+(this[_0xa7ac('0x5')]['forcedOwnership']?':FORCED':''));}else{logger[_0xa7ac('0xd')](_0xa7ac('0x18'),this['squeue']['id'],this[_0xa7ac('0x4')]['id']);setTimeout(this[_0xa7ac('0x6')][_0xa7ac('0x8')](this),0x3e8);}}};Agent[_0xa7ac('0xc')]['handleTimeout']=function(_0x22c6b8){if(_[_0xa7ac('0x19')](this[_0xa7ac('0xf')][_0xa7ac('0x12')][this[_0xa7ac('0x4')]['id']])){return logger[_0xa7ac('0xd')](_0xa7ac('0x10'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xa7ac('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xa7ac('0xb')]['id'],this[_0xa7ac('0x4')]['id']);util['hideNotification'](this[_0xa7ac('0x3')],this[_0xa7ac('0xb')]['id'],this[_0xa7ac('0xf')][_0xa7ac('0x12')][this['agent']['id']],null,this[_0xa7ac('0x5')]);this[_0xa7ac('0xf')]['agents'][this[_0xa7ac('0x4')]['id']][_0xa7ac('0x14')]=![];this[_0xa7ac('0xf')]['agents'][this[_0xa7ac('0x4')]['id']][_0xa7ac('0x1a')]=undefined;util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xa7ac('0x4')]['id']],_0x22c6b8?'STOP':_0xa7ac('0x1b'));}if(!_0x22c6b8){setTimeout(this[_0xa7ac('0x6')][_0xa7ac('0x8')](this),0x3e8);}};function agent(_0x50fe51,_0x291bae,_0x4531ff,_0xd7c69d){return new Agent(_0x50fe51,_0x291bae,_0x4531ff,_0xd7c69d);}module[_0xa7ac('0x1c')]=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 b25494c..f1399df 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 _0x1094=['squeue','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','notificationId','queue','realtime','routing'];(function(_0x1ac570,_0x561b15){var _0x51946e=function(_0x2d8214){while(--_0x2d8214){_0x1ac570['push'](_0x1ac570['shift']());}};_0x51946e(++_0x561b15);}(_0x1094,0x143));var _0x4109=function(_0x625a73,_0x50ae08){_0x625a73=_0x625a73-0x0;var _0x3eceb5=_0x1094[_0x625a73];return _0x3eceb5;};'use strict';var _=require(_0x4109('0x0'));var uuid=require(_0x4109('0x1'));var util=require('./util');var logger=require(_0x4109('0x2'))('routing');var Beepall=function(_0x42557f,_0x32d6c3,_0x308136,_0x181d79){this[_0x4109('0x3')]=uuid['v4']();this['squeue']=_0x42557f;this[_0x4109('0x4')]=_0x32d6c3;this[_0x4109('0x5')]=_0x308136;this[_0x4109('0x6')]=_0x181d79;this[_0x4109('0x7')][_0x4109('0x8')](this[_0x4109('0x9')]['bind'](this),this[_0x4109('0xa')][_0x4109('0xb')](this));this[_0x4109('0x7')]['on'](_0x4109('0xc'),this[_0x4109('0xa')]['bind'](this));this['squeue']['on'](_0x4109('0xd'),this['handleDrained'][_0x4109('0xb')](this));};Beepall[_0x4109('0xe')][_0x4109('0x8')]=function(){this['squeue'][_0x4109('0x8')](this[_0x4109('0x9')][_0x4109('0xb')](this),this[_0x4109('0xa')][_0x4109('0xb')](this));};Beepall['prototype'][_0x4109('0xf')]=function(){this[_0x4109('0xa')](!![]);};Beepall[_0x4109('0xe')][_0x4109('0x9')]=function(){var _0x4a13fc=!![];if(!_['isNil'](this[_0x4109('0x4')])&&!_[_0x4109('0x10')](this[_0x4109('0x4')][_0x4109('0x11')])&&this[_0x4109('0x4')][_0x4109('0x11')][_0x4109('0x12')]>0x0){for(var _0x3c6542=0x0,_0x4c2570;_0x3c65420x0){for(var _0xfac49d=0x0,_0x46769f;_0xfac49d0x0&&_0x259541[_0x483212+_0x898a('0x26')]>=_0x259541[_0x483212+'Capacity']){writeLog(_0x3570e8,_0x259541,_0x483212[_0x898a('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x53ddb2,_0x3678be,_0x1f4d86,_0x420b25,_0x40b3db){return sendNotification(!![],_0x53ddb2,_0x3678be,_0x1f4d86,_0x420b25,_0x40b3db);};exports[_0x898a('0x28')]=function(_0x2efde2,_0x398e98,_0xac1fc4,_0xd31922,_0x58149d){return sendNotification(![],_0x2efde2,_0x398e98,_0xac1fc4,_0xd31922,_0x58149d);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x31f0=['BUSY','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','format','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','notification:%s','save','remove','debug','isAgentAvailable'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x31f0,0xb7));var _0x031f=function(_0x2628d3,_0x12b1de){_0x2628d3=_0x2628d3-0x0;var _0x556f64=_0x31f0[_0x2628d3];return _0x556f64;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var utils=require(_0x031f('0x1'));var Redis=require('ioredis');var config=require(_0x031f('0x2'));var logger=require(_0x031f('0x3'))(_0x031f('0x4'));config[_0x031f('0x5')]=_['defaults'](config[_0x031f('0x5')],{'host':_0x031f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x56328c,_0x3dc98e,_0x487e65,_0x365f59,_0x4300b4,_0x2569b6){io['to'](util[_0x031f('0x7')]('user:%s',_0x365f59[_0x031f('0x8')]))[_0x031f('0x9')](_0x031f('0xa'),_0x365f59);var _0x439940=_0x2569b6||{};var _0x3dd729=_0x487e65[_0x031f('0xb')]('.');var _0x2202dc={'uniqueid':_0x3dc98e,'channel':_0x3dd729[0x0],'id':_0x3dd729[0x1],'title':_0x3dd729[0x0]+_0x031f('0xc'),'interactionId':_0x3dd729[0x2],'queue':_0x4300b4?_0x4300b4['name']:null,'sound':_0x439940[_0x031f('0xd')][_0x031f('0xe')],'shake':_0x439940[_0x031f('0xd')][_0x031f('0xf')]};try{if(!_0x439940[_0x031f('0x10')]){_0x439940[_0x031f('0x10')]={};}if(_0x4300b4){_0x439940[_0x031f('0x10')]['queue']=_0x4300b4;}else if(_0x439940[_0x031f('0x10')][_0x031f('0x11')]){delete _0x439940[_0x031f('0x10')][_0x031f('0x11')];}_0x2202dc[_0x031f('0x12')]=utils['getMustacheRender'](_0x439940['account'][_0x031f('0x13')],_0x439940);}catch(_0x3a10aa){_0x2202dc[_0x031f('0x12')]=_0x031f('0x14');logger['error'](util[_0x031f('0x7')](_0x031f('0x15'),_0x3dc98e,_0x3a10aa['message']));}io['to'](util[_0x031f('0x7')]('user:%s',_0x365f59[_0x031f('0x8')]))[_0x031f('0x9')](util[_0x031f('0x7')](_0x031f('0x16'),_0x56328c?_0x031f('0x17'):_0x031f('0x18')),_0x2202dc);}function writeLog(_0x1b76d6,_0x2825ef,_0xf76f1b){return logger[_0x031f('0x19')](util[_0x031f('0x7')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1b76d6,_0x2825ef[_0x031f('0x8')],_0xf76f1b));}exports[_0x031f('0x1a')]=function(_0x451328,_0x4d6706,_0x5c4184,_0xa11a2b){if(_0x4d6706['busy']){writeLog(_0x451328,_0x4d6706,_0x031f('0x1b'));return![];}if(!_0x4d6706['online']){writeLog(_0x451328,_0x4d6706,'OFFLINE');return![];}if(_0x4d6706[_0x5c4184+'Pause']){writeLog(_0x451328,_0x4d6706,_0x031f('0x1c'));return![];}if(_0xa11a2b&&_0x4d6706[_0x031f('0x1d')](_0x5c4184+_0x031f('0x1e'))&&_0x4d6706[_0x031f('0x1d')](_0x5c4184+'CurrentCapacity')){if(_0x4d6706[_0x5c4184+_0x031f('0x1e')]>0x0&&_0x4d6706[_0x5c4184+'CurrentCapacity']>=_0x4d6706[_0x5c4184+_0x031f('0x1e')]){writeLog(_0x451328,_0x4d6706,_0x5c4184[_0x031f('0x1f')]()+_0x031f('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){return sendNotification(!![],_0x35af16,_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617);};exports[_0x031f('0x21')]=function(_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea){return sendNotification(![],_0x5395ea,_0xa308b,_0x114e34,_0xb6ed6c,_0xaf5bea);};exports[_0x031f('0x22')]=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 e871337..fa15987 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 _0x66e6=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x1abbf4,_0x2f199d){var _0x4c28d9=function(_0x1c5316){while(--_0x1c5316){_0x1abbf4['push'](_0x1abbf4['shift']());}};_0x4c28d9(++_0x2f199d);}(_0x66e6,0xb1));var _0x666e=function(_0x3d268a,_0x5cd98c){_0x3d268a=_0x3d268a-0x0;var _0x4b8664=_0x66e6[_0x3d268a];return _0x4b8664;};'use strict';var schema=require(_0x666e('0x0'));var sh=require(_0x666e('0x1'));var _=require('lodash');var utils=require(_0x666e('0x2'));var logger=require(_0x666e('0x3'))(_0x666e('0x4'));var system=schema({'command':{'type':_0x666e('0x5'),'required':!![],'message':_0x666e('0x6')}});exports[_0x666e('0x7')]=function(_0x5f3c00,_0x429822){return function(_0xc5323f){try{var _0x17b830={'command':_0x429822[0x0]};var _0x39fd1f=system[_0x666e('0x0')](_0x17b830,{'typecast':!![]});if(_0x39fd1f['length']){logger[_0x666e('0x8')](_0x666e('0x9'),_0x5f3c00,_[_0x666e('0xa')](_0x39fd1f,_0x666e('0xb'))[_0x666e('0xc')](',\x20'));logger[_0x666e('0xd')](_0x666e('0xe'),_0x5f3c00);_0xc5323f[_0x666e('0xf')]();}else{var _0x458748=this;var _0x40c427=utils[_0x666e('0x10')](_0x429822[0x0],this);logger[_0x666e('0xd')](_0x666e('0x11'),_0x5f3c00,_0x40c427);sh[_0x666e('0x12')](_[_0x666e('0x13')](_0x40c427),function(_0x575b9d,_0x26a1c3){logger[_0x666e('0xd')](_0x666e('0x14'),_0x5f3c00,_0x575b9d);if(_0x575b9d==0x0){var _0x528ace=_0x26a1c3[_0x666e('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x666e('0x16')](_0x429822[0x1])||_[_0x666e('0x17')](_0x429822[0x1])){logger[_0x666e('0xd')](_0x666e('0x18'),_0x5f3c00);_0x458748[_0x666e('0x19')][_0x429822[0x1]]=_0x528ace;}else{logger[_0x666e('0xd')](_0x666e('0x1a'),_0x5f3c00,_0x429822[0x1],_0x528ace);_0x458748['body'][_0x429822[0x1]]=_0x528ace;}}_0xc5323f[_0x666e('0xf')]();});}}catch(_0x24c693){logger['error'](_0x666e('0x9'),_0x5f3c00,_[_0x666e('0x1b')](_0x24c693)?JSON['stringify'](_0x24c693):_0x24c693);logger[_0x666e('0xd')](_0x666e('0xe'),_0x5f3c00);_0xc5323f[_0x666e('0xf')]();}};}; \ No newline at end of file +var _0xf6fb=['routing','string','consequence','validate','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','lodash','./utils'];(function(_0x4254e7,_0x4fc342){var _0x5e0844=function(_0x3a92c7){while(--_0x3a92c7){_0x4254e7['push'](_0x4254e7['shift']());}};_0x5e0844(++_0x4fc342);}(_0xf6fb,0x111));var _0xbf6f=function(_0x27b20b,_0x310196){_0x27b20b=_0x27b20b-0x0;var _0x15ef30=_0xf6fb[_0x27b20b];return _0x15ef30;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xbf6f('0x0'));var utils=require(_0xbf6f('0x1'));var logger=require('../../../../config/logger')(_0xbf6f('0x2'));var system=schema({'command':{'type':_0xbf6f('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xbf6f('0x4')]=function(_0x4f7bc9,_0x121ca1){return function(_0x41f22f){try{var _0x2d8ffb={'command':_0x121ca1[0x0]};var _0x370983=system[_0xbf6f('0x5')](_0x2d8ffb,{'typecast':!![]});if(_0x370983[_0xbf6f('0x6')]){logger[_0xbf6f('0x7')](_0xbf6f('0x8'),_0x4f7bc9,_['map'](_0x370983,_0xbf6f('0x9'))[_0xbf6f('0xa')](',\x20'));logger[_0xbf6f('0xb')](_0xbf6f('0xc'),_0x4f7bc9);_0x41f22f[_0xbf6f('0xd')]();}else{var _0x5ad71d=this;var _0x4b3ac5=utils[_0xbf6f('0xe')](_0x121ca1[0x0],this);logger[_0xbf6f('0xb')](_0xbf6f('0xf'),_0x4f7bc9,_0x4b3ac5);sh['exec'](_[_0xbf6f('0x10')](_0x4b3ac5),function(_0x541915,_0xbb2b04){logger[_0xbf6f('0xb')](_0xbf6f('0x11'),_0x4f7bc9,_0x541915);if(_0x541915==0x0){var _0x50c054=_0xbb2b04[_0xbf6f('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xbf6f('0x13')](_0x121ca1[0x1])||_[_0xbf6f('0x14')](_0x121ca1[0x1])){logger[_0xbf6f('0xb')](_0xbf6f('0x15'),_0x4f7bc9);_0x5ad71d[_0xbf6f('0x16')][_0x121ca1[0x1]]=_0x50c054;}else{logger['info'](_0xbf6f('0x17'),_0x4f7bc9,_0x121ca1[0x1],_0x50c054);_0x5ad71d[_0xbf6f('0x16')][_0x121ca1[0x1]]=_0x50c054;}}_0x41f22f[_0xbf6f('0xd')]();});}}catch(_0x40ad56){logger[_0xbf6f('0x7')](_0xbf6f('0x8'),_0x4f7bc9,_[_0xbf6f('0x18')](_0x40ad56)?JSON['stringify'](_0x40ad56):_0x40ad56);logger['info'](_0xbf6f('0xc'),_0x4f7bc9);_0x41f22f[_0xbf6f('0xd')]();}};}; \ 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 9f2c3db..917ff63 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 _0xada2=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','channel','stringify','isObject','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger'];(function(_0x54764a,_0x2a27bf){var _0x28d7a8=function(_0xf3d2fb){while(--_0xf3d2fb){_0x54764a['push'](_0x54764a['shift']());}};_0x28d7a8(++_0x2a27bf);}(_0xada2,0x15b));var _0x2ada=function(_0x4ceeef,_0x35979e){_0x4ceeef=_0x4ceeef-0x0;var _0x31e9a8=_0xada2[_0x4ceeef];return _0x31e9a8;};'use strict';var schema=require(_0x2ada('0x0'));var _=require(_0x2ada('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x2ada('0x2')),'mailInteraction':require(_0x2ada('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x2ada('0x4'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x2ada('0x5')}});exports[_0x2ada('0x6')]=function(_0x14cf2c,_0x2ea3e5,_0x7ba6a1,_0x47ecdc){return function(_0x570777){try{var _0xc36280={'tag':_0x2ea3e5[0x0]};var _0xa601=tag[_0x2ada('0x0')](_0xc36280,{'typecast':!![]});if(_0xa601[_0x2ada('0x7')]){logger[_0x2ada('0x8')](_0x2ada('0x9'),_0x14cf2c,_[_0x2ada('0xa')](_0xa601,_0x2ada('0xb'))['join'](',\x20'));logger[_0x2ada('0xc')](_0x2ada('0xd'),_0x14cf2c);_0x570777[_0x2ada('0xe')]();}else{var _0x22aa68={'ids':[_0x2ea3e5[0x0]]};if(rpc[_0x47ecdc['channel']+_0x2ada('0xf')]){rpc[_0x47ecdc['channel']+_0x2ada('0xf')][_0x2ada('0x10')](_0x47ecdc[_0x2ada('0x11')]['id'],_0x22aa68)[_0x2ada('0x12')](function(_0x2213c5){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x14cf2c,_0x2ea3e5[0x1],_0x47ecdc[_0x2ada('0x13')],_0x47ecdc[_0x2ada('0x11')]['id']);})['catch'](function(_0x1f18ca){logger[_0x2ada('0x8')]('[%s][TAG]\x20%s',_0x14cf2c,JSON[_0x2ada('0x14')](_0x1f18ca));logger[_0x2ada('0xc')](_0x2ada('0xd'),_0x14cf2c);})['finally'](function(){_0x570777[_0x2ada('0xe')]();});}}}catch(_0x58b468){logger['error'](_0x2ada('0x9'),_0x14cf2c,_[_0x2ada('0x15')](_0x58b468)?JSON[_0x2ada('0x14')](_0x58b468):_0x58b468);logger['info'](_0x2ada('0xd'),_0x14cf2c);_0x570777[_0x2ada('0xe')]();}};}; \ No newline at end of file +var _0x4308=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','catch','finally','next','stringify','validate','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0xb67443,_0x1fe0d4){var _0x3a5098=function(_0x3725a3){while(--_0x3725a3){_0xb67443['push'](_0xb67443['shift']());}};_0x3a5098(++_0x1fe0d4);}(_0x4308,0x16d));var _0x8430=function(_0x370343,_0x2c58e2){_0x370343=_0x370343-0x0;var _0x4ffb4d=_0x4308[_0x370343];return _0x4ffb4d;};'use strict';var schema=require(_0x8430('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x8430('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8430('0x2')),'mailInteraction':require(_0x8430('0x3')),'faxInteraction':require(_0x8430('0x4')),'whatsappInteraction':require(_0x8430('0x5'))};var logger=require('../../../../config/logger')(_0x8430('0x6'));var tag=schema({'tag':{'type':_0x8430('0x7'),'required':!![],'message':_0x8430('0x8')}});exports['consequence']=function(_0x5cf374,_0x100d66,_0x18df5f,_0x1c90c0){return function(_0x21b408){try{var _0x1fe0df={'tag':_0x100d66[0x0]};var _0x527c38=tag[_0x8430('0x0')](_0x1fe0df,{'typecast':!![]});if(_0x527c38[_0x8430('0x9')]){logger['error'](_0x8430('0xa'),_0x5cf374,_[_0x8430('0xb')](_0x527c38,'message')[_0x8430('0xc')](',\x20'));logger[_0x8430('0xd')](_0x8430('0xe'),_0x5cf374);_0x21b408['next']();}else{var _0x2660e6={'ids':[_0x100d66[0x0]]};if(rpc[_0x1c90c0[_0x8430('0xf')]+_0x8430('0x10')]){rpc[_0x1c90c0[_0x8430('0xf')]+_0x8430('0x10')][_0x8430('0x11')](_0x1c90c0[_0x8430('0x12')]['id'],_0x2660e6)['then'](function(_0x232ef4){logger[_0x8430('0xd')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5cf374,_0x100d66[0x1],_0x1c90c0[_0x8430('0xf')],_0x1c90c0[_0x8430('0x12')]['id']);})[_0x8430('0x13')](function(_0x5c88d6){logger['error']('[%s][TAG]\x20%s',_0x5cf374,JSON['stringify'](_0x5c88d6));logger['info'](_0x8430('0xe'),_0x5cf374);})[_0x8430('0x14')](function(){_0x21b408[_0x8430('0x15')]();});}}}catch(_0x2f132e){logger['error'](_0x8430('0xa'),_0x5cf374,_['isObject'](_0x2f132e)?JSON[_0x8430('0x16')](_0x2f132e):_0x2f132e);logger[_0x8430('0xd')](_0x8430('0xe'),_0x5cf374);_0x21b408[_0x8430('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 14ecc4f..f49c1cf 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a7b=['isObject','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','2.0','login','params','stringify','utf8','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error'];(function(_0x3dd6b3,_0x41a157){var _0x20511e=function(_0x41c992){while(--_0x41c992){_0x3dd6b3['push'](_0x3dd6b3['shift']());}};_0x20511e(++_0x41a157);}(_0x0a7b,0x1a2));var _0xb0a7=function(_0x2372d5,_0x50c0de){_0x2372d5=_0x2372d5-0x0;var _0x2d16c6=_0x0a7b[_0x2372d5];return _0x2d16c6;};'use strict';var rp=require('request-promise');var logger=require(_0xb0a7('0x0'))(_0xb0a7('0x1'));var _=require(_0xb0a7('0x2'));var arr=[];exports[_0xb0a7('0x3')]=function(_0x33da0d,_0x25074c){return function(_0x382ebe){var _0x2f98d2=_0x25074c[0xa];var _0x45c791=_0x25074c[0xb];var _0x31c469=_0x25074c[0xc];var _0x3c4eb8=_0x25074c[0xd];var _0x5375c4=_0x25074c[0xe];var _0x2e304e=_0x25074c[0xf][_0xb0a7('0x4')](/\n/g,_0xb0a7('0x5'));var _0x299cda=_0x25074c[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x45c791)){arr[_0xb0a7('0x6')](_0x45c791);var _0x14f786=_0x25074c[0x3];var _0x34921c=_0x25074c[0x4];var _0x498787=_0x25074c[0x1];var _0xfc8343=_0x25074c[0x0];var _0x14fc0d={};_0x14fc0d[_0xb0a7('0x7')]=_0x25074c[0x8]+'?params='+_0x31c469+'|'+_0x2f98d2+'|'+_0x3c4eb8+'|'+_0x45c791+'|'+_0x5375c4;_0x14fc0d[_0xb0a7('0x8')]=_0x25074c[0x7]+_0xb0a7('0x9')+_0x31c469+'|'+_0x2f98d2+'|'+_0x3c4eb8+'|'+_0x45c791+'|'+_0x5375c4+'|'+_0x2e304e+'|'+_0x299cda;_0x14fc0d['title']=_0x25074c[0x9];var _0x582da7={};_0x582da7['jsonrpc']=_0xb0a7('0xa');_0x582da7['method']=_0xb0a7('0xb');var _0x16eb2e=[];_0x16eb2e[_0xb0a7('0x6')](_0x25074c[0x2]);_0x16eb2e[_0xb0a7('0x6')](_0x25074c[0x5]);_0x16eb2e[_0xb0a7('0x6')](_0x25074c[0x6]);_0x582da7[_0xb0a7('0xc')]=_0x16eb2e;_0x582da7['id']=0x1;var _0x2eb423=JSON[_0xb0a7('0xd')](_0x582da7);var _0x27c87b={'encoding':_0xb0a7('0xe'),'method':_0xb0a7('0xf'),'timeout':0x2710,'url':_0x14f786,'headers':{'Content-Type':_0xb0a7('0x10')},'body':_0x2eb423};return rp(_0x27c87b)['then'](function(_0x1192af){const _0x133b7a=JSON[_0xb0a7('0x11')](_0x1192af);if(!_0x133b7a[_0xb0a7('0x12')][_0xb0a7('0x13')]){throw new Error(_0xb0a7('0x14'));}var _0x2d40c3=_0x45c791;var _0x5962ce=_0xb0a7('0x15')+_0x498787+_0xb0a7('0x16')+_0xfc8343+_0xb0a7('0x17')+_0x2d40c3+_0xb0a7('0x18')+JSON[_0xb0a7('0xd')](_0x14fc0d);var _0x167aff=_0x34921c+'?'+_0x5962ce;return rp(_0x167aff);})[_0xb0a7('0x19')](function(_0x2fdcf3){logger[_0xb0a7('0x1a')](_0xb0a7('0x1b'),_0x33da0d,_0x2fdcf3);_0x382ebe[_0xb0a7('0x1c')]();})['catch'](function(_0x23b453){logger[_0xb0a7('0x1d')]('[%s][TVOX]\x20%s',_0x33da0d,_[_0xb0a7('0x1e')](_0x23b453)?JSON['stringify'](_0x23b453):_0x23b453);_0x382ebe[_0xb0a7('0x1c')]();});}else{logger[_0xb0a7('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x33da0d);_0x382ebe[_0xb0a7('0x1f')]();}};}; \ No newline at end of file +var _0xf7d7=['stringify','info','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','login','params','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject'];(function(_0x412901,_0x196a7c){var _0x115821=function(_0x4bf01f){while(--_0x4bf01f){_0x412901['push'](_0x412901['shift']());}};_0x115821(++_0x196a7c);}(_0xf7d7,0x6c));var _0x7f7d=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf7d7[_0xc0a3d3];return _0x3386e8;};'use strict';var rp=require(_0x7f7d('0x0'));var logger=require(_0x7f7d('0x1'))(_0x7f7d('0x2'));var _=require(_0x7f7d('0x3'));var arr=[];exports[_0x7f7d('0x4')]=function(_0x464326,_0x3227e3){return function(_0x261ab5){var _0x1ac7c6=_0x3227e3[0xa];var _0x29b868=_0x3227e3[0xb];var _0x131e08=_0x3227e3[0xc];var _0x1038d1=_0x3227e3[0xd];var _0x4919ac=_0x3227e3[0xe];var _0x31b4e8=_0x3227e3[0xf][_0x7f7d('0x5')](/\n/g,_0x7f7d('0x6'));var _0xdfdac1=_0x3227e3[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x7f7d('0x7')](_0x29b868)){arr[_0x7f7d('0x8')](_0x29b868);var _0x17577f=_0x3227e3[0x3];var _0x13cbc4=_0x3227e3[0x4];var _0x680c0f=_0x3227e3[0x1];var _0xf18d83=_0x3227e3[0x0];var _0x48b5df={};_0x48b5df[_0x7f7d('0x9')]=_0x3227e3[0x8]+'?params='+_0x131e08+'|'+_0x1ac7c6+'|'+_0x1038d1+'|'+_0x29b868+'|'+_0x4919ac;_0x48b5df[_0x7f7d('0xa')]=_0x3227e3[0x7]+_0x7f7d('0xb')+_0x131e08+'|'+_0x1ac7c6+'|'+_0x1038d1+'|'+_0x29b868+'|'+_0x4919ac+'|'+_0x31b4e8+'|'+_0xdfdac1;_0x48b5df[_0x7f7d('0xc')]=_0x3227e3[0x9];var _0x46b91a={};_0x46b91a[_0x7f7d('0xd')]=_0x7f7d('0xe');_0x46b91a['method']=_0x7f7d('0xf');var _0x4493e7=[];_0x4493e7[_0x7f7d('0x8')](_0x3227e3[0x2]);_0x4493e7[_0x7f7d('0x8')](_0x3227e3[0x5]);_0x4493e7[_0x7f7d('0x8')](_0x3227e3[0x6]);_0x46b91a[_0x7f7d('0x10')]=_0x4493e7;_0x46b91a['id']=0x1;var _0x586bb6=JSON['stringify'](_0x46b91a);var _0x59dc76={'encoding':'utf8','method':_0x7f7d('0x11'),'timeout':0x2710,'url':_0x17577f,'headers':{'Content-Type':_0x7f7d('0x12')},'body':_0x586bb6};return rp(_0x59dc76)[_0x7f7d('0x13')](function(_0x1df886){const _0x2f05fe=JSON[_0x7f7d('0x14')](_0x1df886);if(!_0x2f05fe[_0x7f7d('0x15')][_0x7f7d('0x16')]){throw new Error(_0x7f7d('0x17'));}var _0x4bcfe2=_0x29b868;var _0x39f531='channelId='+_0x680c0f+'&serviceId='+_0xf18d83+_0x7f7d('0x18')+_0x4bcfe2+_0x7f7d('0x19')+JSON['stringify'](_0x48b5df);var _0x1de6cd=_0x13cbc4+'?'+_0x39f531;return rp(_0x1de6cd);})[_0x7f7d('0x13')](function(_0x53af46){logger['info'](_0x7f7d('0x1a'),_0x464326,_0x53af46);_0x261ab5[_0x7f7d('0x1b')]();})[_0x7f7d('0x1c')](function(_0x1798e4){logger[_0x7f7d('0x1d')](_0x7f7d('0x1e'),_0x464326,_[_0x7f7d('0x1f')](_0x1798e4)?JSON[_0x7f7d('0x20')](_0x1798e4):_0x1798e4);_0x261ab5['stop']();});}else{logger[_0x7f7d('0x21')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x464326);_0x261ab5[_0x7f7d('0x22')]();}};}; \ 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 36a44a4..3b6d2c7 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x6b391f,_0x4bb70d){var _0x50177a=function(_0x2ffa5f){while(--_0x2ffa5f){_0x6b391f['push'](_0x6b391f['shift']());}};_0x50177a(++_0x4bb70d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1751de,_0x40e33d){var _0x4b9c02=function(_0x26f068){while(--_0x26f068){_0x1751de['push'](_0x1751de['shift']());}};_0x4b9c02(++_0x40e33d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index bee6cda..f819460 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 _0xa9e0=['lodash','util','path','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','join','.js','toLowerCase','autoreply','appdata','channel','mail','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','app','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','end','QueueReport','update','catch','message\x20is\x20empty','capacity','hasOwnProperty','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x5694d3,_0x2e3008){var _0x1ca96e=function(_0x33a079){while(--_0x33a079){_0x5694d3['push'](_0x5694d3['shift']());}};_0x1ca96e(++_0x2e3008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x0a9e('0x3'));var utils=require('./applications/utils');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var rpc={'openchannelQueueReport':require(_0x0a9e('0x7')),'mailQueueReport':require(_0x0a9e('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x0a9e('0x9')),'faxQueueReport':require(_0x0a9e('0xa')),'whatsappQueueReport':require(_0x0a9e('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x503809,_0xe42b77,_0x56465b){return util['format'](_0x0a9e('0xc'),_0x503809,_0xe42b77||0x0,_0x56465b||0x0);}function getIntervals(_0xf81284,_0x307b3e){var _0x3ab53f=[];if(!_[_0x0a9e('0xd')](_0x307b3e[_0x0a9e('0xe')])&&!_['isNil'](_0xf81284[_0x307b3e['IntervalId']])&&!_['isNil'](_0xf81284[_0x307b3e['IntervalId']][_0x0a9e('0xf')])){_0x3ab53f=_[_0x0a9e('0x10')](_0xf81284[_0x307b3e[_0x0a9e('0xe')]][_0x0a9e('0xf')],_0x0a9e('0x11'));}else if(!_[_0x0a9e('0xd')](_0x307b3e['interval'])){_0x3ab53f=[_0x307b3e[_0x0a9e('0x11')]];}return _0x3ab53f;}exports[_0x0a9e('0x12')]=function(_0x2b4227){_0x2b4227[_0x0a9e('0x13')]={};return new BPromise(function(_0x44dcfd,_0x4d5611){var _0x52a03d={'Start':function(_0x22dccb){var _0x5d0880=this;return new Promise(function(_0x1985b6,_0x519dfd){if(_0x22dccb){try{var _0x16033c=[];var _0x12066b=getId(_0x22dccb['channel'],_0x22dccb[_0x0a9e('0x14')]?_0x22dccb['message']['id']:0x0,_0x22dccb[_0x0a9e('0x15')]?_0x22dccb[_0x0a9e('0x15')]['id']:0x0);if(_0x22dccb[_0x0a9e('0x16')]&&_[_0x0a9e('0x17')](_0x22dccb[_0x0a9e('0x16')])&&_0x22dccb[_0x0a9e('0x16')][_0x0a9e('0x18')]){for(var _0x20559e=0x0;_0x20559e<_0x22dccb[_0x0a9e('0x16')][_0x0a9e('0x18')];_0x20559e+=0x1){var _0x1c696a=_0x22dccb[_0x0a9e('0x16')][_0x20559e];if(fs['existsSync'](path[_0x0a9e('0x19')](__dirname,_0x0a9e('0x16'),_0x1c696a['app']+_0x0a9e('0x1a')))){var _0x5a09ef=[];switch(_0x1c696a['app'][_0x0a9e('0x1b')]()){case _0x0a9e('0x1c'):var _0x38e7c4=_0x1c696a[_0x0a9e('0x1d')]['split'](',');if(_0x22dccb[_0x0a9e('0x1e')]===_0x0a9e('0x1f')){_0x5a09ef[_0x0a9e('0x20')](_0x38e7c4[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x38e7c4[0x1]);_0x5a09ef[_0x0a9e('0x20')](_0x38e7c4[_0x0a9e('0x21')](0x2,_0x38e7c4[_0x0a9e('0x18')])['join'](','));}else{_0x5a09ef['push'](_0x38e7c4[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x38e7c4[_0x0a9e('0x21')](0x1,_0x38e7c4[_0x0a9e('0x18')])[_0x0a9e('0x19')](','));}break;case'dialogflow':var _0x384319=_0x1c696a['appdata'][_0x0a9e('0x22')](',');_0x5a09ef['push'](_0x384319[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x384319[0x1]);_0x5a09ef[_0x0a9e('0x20')](_0x384319[_0x0a9e('0x21')](0x2,_0x384319[_0x0a9e('0x18')])[_0x0a9e('0x19')](','));break;case _0x0a9e('0x23'):var _0x11c3b6=_0x1c696a[_0x0a9e('0x1d')]['split'](',');_0x5a09ef[_0x0a9e('0x20')](_0x11c3b6[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x11c3b6[0x1]);_0x5a09ef[_0x0a9e('0x20')](_0x11c3b6[0x2]);_0x5a09ef[_0x0a9e('0x20')](_0x11c3b6[0x3]);_0x5a09ef['push'](_0x11c3b6[_0x0a9e('0x21')](0x4,_0x11c3b6[_0x0a9e('0x18')])[_0x0a9e('0x19')](','));break;case _0x0a9e('0x24'):var _0x58b06f=_0x1c696a[_0x0a9e('0x1d')][_0x0a9e('0x22')](',');_0x5a09ef[_0x0a9e('0x20')](_0x58b06f[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x58b06f[0x1]);_0x5a09ef['push'](_0x58b06f[0x2]);_0x5a09ef[_0x0a9e('0x20')](_0x58b06f[0x3]);_0x5a09ef['push'](_0x58b06f[_0x0a9e('0x21')](0x4,_0x58b06f[_0x0a9e('0x18')])[_0x0a9e('0x19')](','));break;case _0x0a9e('0x14'):_0x5a09ef[_0x0a9e('0x20')](_0x1c696a['appdata']);break;case _0x0a9e('0x25'):_0x5a09ef[_0x0a9e('0x20')](_0x1c696a[_0x0a9e('0x26')]);_0x5a09ef[_0x0a9e('0x20')](_0x1c696a[_0x0a9e('0x1d')]);break;case _0x0a9e('0x27'):var _0x332d35=utils[_0x0a9e('0x28')](_0x22dccb['account'][_0x0a9e('0x29')],_0x22dccb);var _0x5e7238=_0x1c696a[_0x0a9e('0x1d')][_0x0a9e('0x22')](',');_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x0]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x1]);_0x5a09ef['push'](_0x5e7238[0x2]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x3]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x4]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x5]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x6]);_0x5a09ef['push'](_0x5e7238[0x7]);_0x5a09ef['push'](_0x5e7238[0x8]);_0x5a09ef[_0x0a9e('0x20')](_0x5e7238[0x9]);_0x5a09ef['push'](_0x5e7238[0xa]);_0x5a09ef[_0x0a9e('0x20')](_0x22dccb[_0x0a9e('0x15')]['id']);_0x5a09ef[_0x0a9e('0x20')](_0x22dccb[_0x0a9e('0x14')]['id']);_0x5a09ef['push'](_0x1c696a[_0x0a9e('0x2a')]);_0x5a09ef[_0x0a9e('0x20')](_0x22dccb[_0x0a9e('0x15')]['ContactId']);_0x5a09ef[_0x0a9e('0x20')](_0x22dccb[_0x0a9e('0x2b')][_0x0a9e('0x2b')]);_0x5a09ef['push'](_0x332d35);break;default:_0x5a09ef=_['isNil'](_0x1c696a[_0x0a9e('0x1d')])?[]:_0x1c696a[_0x0a9e('0x1d')]['split'](',');}var _0x2b814e={'id':util[_0x0a9e('0x2c')](_0x0a9e('0x2d'),_0x12066b,_0x1c696a['id'],_0x1c696a[_0x0a9e('0x2e')]),'condition':require('./interval')['condition'](_0x12066b,getIntervals(_0x2b4227[_0x0a9e('0x2f')],_0x1c696a),_0x2b4227),'consequence':require(_0x0a9e('0x30')+_0x1c696a['app'])[_0x0a9e('0x31')](_0x12066b,_0x5a09ef,_0x2b4227,_0x22dccb),'p':_0x1c696a[_0x0a9e('0x32')]||0x0};logger[_0x0a9e('0x33')]('Push\x20new\x20rule',_0x2b814e['id'],_0x0a9e('0x34'),getIntervals(_0x2b4227[_0x0a9e('0x2f')],_0x1c696a)[_0x0a9e('0x19')](_0x0a9e('0x35')));_0x16033c[_0x0a9e('0x20')](_0x2b814e);}else{logger[_0x0a9e('0x36')](_0x0a9e('0x37'),path[_0x0a9e('0x19')](__dirname,_0x0a9e('0x16'),_0x1c696a[_0x0a9e('0x2e')]+_0x0a9e('0x1a')));}}_0x2b4227[_0x0a9e('0x13')][_0x12066b]=new RuleEngine(_0x16033c);_0x2b4227[_0x0a9e('0x13')][_0x12066b][_0x0a9e('0x38')](_0x22dccb,function(_0x37f6cc){logger['info']('Applications\x20executed',JSON[_0x0a9e('0x39')](_0x37f6cc[_0x0a9e('0x3a')]));if(_0x2b4227[_0x0a9e('0x13')][_0x12066b]){_0x2b4227[_0x0a9e('0x13')][_0x12066b][_0x0a9e('0x3b')](_0x0a9e('0x3c'));}});return _0x1985b6({'code':0xc8,'message':_0x22dccb});}else{logger[_0x0a9e('0x33')](_0x0a9e('0x3d'));return _0x1985b6({'code':0xc8,'message':_0x22dccb});}}catch(_0x432fcc){logger[_0x0a9e('0x36')](_0x432fcc[_0x0a9e('0x3e')]);return _0x519dfd(_0x5d0880[_0x0a9e('0x36')](0x1f4,_0x432fcc));}}return _0x519dfd('routing\x20is\x20empty');});},'AcceptMessage':function(_0x117c99){var _0x138b8b=this;return new Promise(function(_0xdd268f,_0xfbd5ad){if(_0x117c99[_0x0a9e('0x3f')]&&_0x117c99[_0x0a9e('0x3f')]['id']){if(_0x2b4227[_0x0a9e('0x40')][_0x117c99[_0x0a9e('0x3f')]['id']]){_0x2b4227['agents'][_0x117c99[_0x0a9e('0x3f')]['id']]['busy']=![];_0x2b4227[_0x0a9e('0x40')][_0x117c99[_0x0a9e('0x3f')]['id']][_0x0a9e('0x41')]=undefined;}}if(_0x117c99['message']&&_0x117c99[_0x0a9e('0x14')]['id']){try{var _0x7f6eb1=getId(_0x117c99[_0x0a9e('0x1e')],_0x117c99[_0x0a9e('0x14')]?_0x117c99[_0x0a9e('0x14')]['id']:0x0,_0x117c99[_0x0a9e('0x15')]?_0x117c99[_0x0a9e('0x15')]['id']:0x0);if(_0x2b4227['rules'][_0x7f6eb1]){_0x2b4227[_0x0a9e('0x13')][_0x7f6eb1][_0x0a9e('0x3b')](_0x0a9e('0x42'));if(rpc[_0x117c99[_0x0a9e('0x1e')]+_0x0a9e('0x43')]){rpc[_0x117c99[_0x0a9e('0x1e')]+_0x0a9e('0x43')][_0x0a9e('0x44')](_0x7f6eb1,{'UserId':_0x117c99[_0x0a9e('0x14')]['UserId']})[_0x0a9e('0x45')](function(_0x3fe430){logger['error']('error\x20update\x20queue\x20report');});}}return _0xdd268f({'code':0xc8,'message':_0x117c99});}catch(_0x5ddf84){logger[_0x0a9e('0x36')](_0x5ddf84[_0x0a9e('0x3e')]);return _0xfbd5ad(_0x138b8b[_0x0a9e('0x36')](0x1f4,_0x5ddf84));}}logger[_0x0a9e('0x36')](_0x0a9e('0x46'));return _0xfbd5ad(_0x138b8b[_0x0a9e('0x36')](0x1f4,_0x0a9e('0x46')));});},'RejectMessage':function(_0x375c18){var _0x5d38ae=this;return new Promise(function(_0x4b1b9f,_0x53975a){if(_0x375c18[_0x0a9e('0x3f')]&&_0x375c18[_0x0a9e('0x3f')]['id']){try{if(_0x2b4227[_0x0a9e('0x40')][_0x375c18['agent']['id']]){_0x2b4227[_0x0a9e('0x40')][_0x375c18[_0x0a9e('0x3f')]['id']]['busy']=![];_0x2b4227['agents'][_0x375c18[_0x0a9e('0x3f')]['id']]['busyQueue']=undefined;}return _0x4b1b9f({'code':0xc8,'message':_0x375c18});}catch(_0x443e72){logger['error'](_0x443e72[_0x0a9e('0x3e')]);return _0x53975a(_0x5d38ae[_0x0a9e('0x36')](0x1f4,_0x443e72));}}logger[_0x0a9e('0x36')]('message\x20is\x20empty');return _0x53975a(_0x5d38ae[_0x0a9e('0x36')](0x1f4,_0x0a9e('0x46')));});},'AbandonInteraction':function(_0x508b47){var _0x50f687=this;return new Promise(function(_0x128aa6,_0x3aedd0){if(_0x508b47['channel']&&_0x508b47[_0x0a9e('0x15')]&&_0x508b47['interaction']['id']){try{var _0x211ef9=getId(_0x508b47['channel'],_0x508b47[_0x0a9e('0x14')]?_0x508b47['message']['id']:0x0,_0x508b47['interaction']?_0x508b47['interaction']['id']:0x0);if(_0x2b4227[_0x0a9e('0x13')][_0x211ef9]){_0x2b4227['rules'][_0x211ef9][_0x0a9e('0x3b')](_0x0a9e('0x42'));}return _0x128aa6({'code':0xc8,'message':_0x508b47});}catch(_0x3cfd00){logger[_0x0a9e('0x36')](_0x3cfd00[_0x0a9e('0x3e')]);return _0x3aedd0(_0x50f687[_0x0a9e('0x36')](0x1f4,_0x3cfd00));}}logger[_0x0a9e('0x36')](_0x0a9e('0x46'));return _0x3aedd0(_0x50f687['error'](0x1f4,_0x0a9e('0x46')));});},'AgentCapacity':function(_0x121cef){var _0x2642bb=this;return new Promise(function(_0x30c491,_0xb83dfd){if(_0x2b4227[_0x0a9e('0x40')]['hasOwnProperty'](_0x121cef['id'])){for(var _0x956fbe in _0x121cef[_0x0a9e('0x47')]){if(_0x121cef['capacity'][_0x0a9e('0x48')](_0x956fbe)){if(_0x2b4227['agents'][_0x121cef['id']][_0x0a9e('0x48')](_0x956fbe+'CurrentCapacity')){_0x2b4227['agents'][_0x121cef['id']][_0x956fbe+'CurrentCapacity']=parseInt(_0x121cef[_0x0a9e('0x47')][_0x956fbe],0xa);}}}_0x2b4227['agents'][_0x121cef['id']][_0x0a9e('0x49')]();return _0x30c491({'code':0xc8,'message':_0x2b4227[_0x0a9e('0x40')][_0x121cef['id']]});}else{return _0xb83dfd(_0x2642bb[_0x0a9e('0x36')](0x1f4,_0x0a9e('0x4a')));}});},'Agents':function(_0x1cca9f){return new Promise(function(_0x26d7db,_0x49eed0){var _0x1627a7=_['values'](_0x2b4227[_0x0a9e('0x40')]);_0x26d7db({'count':_0x1627a7[_0x0a9e('0x18')],'rows':_0x1627a7});});},'ChatQueues':function(_0x51aaf7){return new Promise(function(_0x5adf8f,_0x453360){var _0x156f1c=[];for(var _0x119677 in _0x2b4227[_0x0a9e('0x4b')]){if(_0x2b4227['chatQueues'][_0x0a9e('0x48')](_0x119677)){var _0xe05a5a=_0x2b4227['chatQueues'][_0x119677];var _0x797b45={'id':_0xe05a5a['id'],'available':_0xe05a5a[_0x0a9e('0x4c')],'loggedIn':_0xe05a5a[_0x0a9e('0x4d')],'name':_0xe05a5a[_0x0a9e('0x4e')],'paused':_0xe05a5a[_0x0a9e('0x4f')],'waiting':_0xe05a5a['waiting']};_0x156f1c[_0x0a9e('0x20')](_0x797b45);}}_0x5adf8f({'count':_0x156f1c[_0x0a9e('0x18')],'rows':_0x156f1c});});},'MailQueues':function(_0x281c7d){return new Promise(function(_0x47bb43,_0x3528b7){var _0x4f1e60=[];for(var _0x5211e3 in _0x2b4227[_0x0a9e('0x50')]){if(_0x2b4227[_0x0a9e('0x50')][_0x0a9e('0x48')](_0x5211e3)){var _0x19c995=_0x2b4227[_0x0a9e('0x50')][_0x5211e3];var _0xc8c264={'id':_0x19c995['id'],'available':_0x19c995[_0x0a9e('0x4c')],'loggedIn':_0x19c995[_0x0a9e('0x4d')],'name':_0x19c995[_0x0a9e('0x4e')],'paused':_0x19c995[_0x0a9e('0x4f')],'waiting':_0x19c995[_0x0a9e('0x51')]};_0x4f1e60[_0x0a9e('0x20')](_0xc8c264);}}_0x47bb43({'count':_0x4f1e60[_0x0a9e('0x18')],'rows':_0x4f1e60});});},'OpenchannelQueues':function(_0x2b8192){return new Promise(function(_0x320898,_0x412a72){var _0x2a28c0=[];for(var _0x4257c9 in _0x2b4227['openchannelQueues']){if(_0x2b4227[_0x0a9e('0x52')][_0x0a9e('0x48')](_0x4257c9)){var _0x243d12=_0x2b4227['openchannelQueues'][_0x4257c9];var _0x1148a1={'id':_0x243d12['id'],'available':_0x243d12[_0x0a9e('0x4c')],'loggedIn':_0x243d12['loggedIn'],'name':_0x243d12[_0x0a9e('0x4e')],'paused':_0x243d12[_0x0a9e('0x4f')],'waiting':_0x243d12[_0x0a9e('0x51')]};_0x2a28c0[_0x0a9e('0x20')](_0x1148a1);}}_0x320898({'count':_0x2a28c0[_0x0a9e('0x18')],'rows':_0x2a28c0});});},'SmsQueues':function(_0x4a43a8){return new Promise(function(_0x50cdce,_0x4a2438){var _0x40fb85=[];for(var _0x18bf5d in _0x2b4227[_0x0a9e('0x53')]){if(_0x2b4227[_0x0a9e('0x53')][_0x0a9e('0x48')](_0x18bf5d)){var _0x380ab3=_0x2b4227[_0x0a9e('0x53')][_0x18bf5d];var _0x1a0677={'id':_0x380ab3['id'],'available':_0x380ab3['available'],'loggedIn':_0x380ab3[_0x0a9e('0x4d')],'name':_0x380ab3[_0x0a9e('0x4e')],'paused':_0x380ab3[_0x0a9e('0x4f')],'waiting':_0x380ab3['waiting']};_0x40fb85[_0x0a9e('0x20')](_0x1a0677);}}_0x50cdce({'count':_0x40fb85['length'],'rows':_0x40fb85});});},'FaxQueues':function(_0x4437ff){return new Promise(function(_0x44351d,_0x4c46c1){var _0x2ed01e=[];for(var _0x75912a in _0x2b4227[_0x0a9e('0x54')]){if(_0x2b4227[_0x0a9e('0x54')]['hasOwnProperty'](_0x75912a)){var _0x1d442c=_0x2b4227[_0x0a9e('0x54')][_0x75912a];var _0x371533={'id':_0x1d442c['id'],'available':_0x1d442c[_0x0a9e('0x4c')],'loggedIn':_0x1d442c['loggedIn'],'name':_0x1d442c[_0x0a9e('0x4e')],'paused':_0x1d442c[_0x0a9e('0x4f')],'waiting':_0x1d442c[_0x0a9e('0x51')]};_0x2ed01e[_0x0a9e('0x20')](_0x371533);}}_0x44351d({'count':_0x2ed01e['length'],'rows':_0x2ed01e});});},'WhatsappQueues':function(_0x290d43){return new Promise(function(_0x3511c9,_0x30a4c7){var _0xf410e5=[];for(var _0x332367 in _0x2b4227[_0x0a9e('0x55')]){if(_0x2b4227[_0x0a9e('0x55')][_0x0a9e('0x48')](_0x332367)){var _0x1a7b03=_0x2b4227[_0x0a9e('0x55')][_0x332367];var _0xc4c230={'id':_0x1a7b03['id'],'available':_0x1a7b03[_0x0a9e('0x4c')],'loggedIn':_0x1a7b03[_0x0a9e('0x4d')],'name':_0x1a7b03[_0x0a9e('0x4e')],'paused':_0x1a7b03['paused'],'waiting':_0x1a7b03[_0x0a9e('0x51')]};_0xf410e5[_0x0a9e('0x20')](_0xc4c230);}}_0x3511c9({'count':_0xf410e5[_0x0a9e('0x18')],'rows':_0xf410e5});});},'ChatQueuesWaitingInteractions':function(_0x563627){return new Promise(function(_0x3736e0,_0x33dda0){var _0x8cea96=_[_0x0a9e('0x56')](_0x2b4227['chatQueuesWaitingInteractions']);_0x3736e0({'count':_0x8cea96['length'],'rows':_0x8cea96});});},'MailQueuesWaitingInteractions':function(_0x7ebea8){return new Promise(function(_0x2bbdb5,_0x4c54fa){var _0x45108c=_['values'](_0x2b4227[_0x0a9e('0x57')]);_0x2bbdb5({'count':_0x45108c[_0x0a9e('0x18')],'rows':_0x45108c});});},'OpenchannelQueuesWaitingInteractions':function(_0x5637a1){return new Promise(function(_0x28a942,_0x41cf12){var _0x2d2286=_[_0x0a9e('0x56')](_0x2b4227[_0x0a9e('0x58')]);_0x28a942({'count':_0x2d2286[_0x0a9e('0x18')],'rows':_0x2d2286});});},'SmsQueuesWaitingInteractions':function(_0x444f1f){return new Promise(function(_0x482ca2,_0x2973d3){var _0x3ca9b9=_[_0x0a9e('0x56')](_0x2b4227[_0x0a9e('0x59')]);_0x482ca2({'count':_0x3ca9b9['length'],'rows':_0x3ca9b9});});},'FaxQueuesWaitingInteractions':function(_0xf51744){return new Promise(function(_0xf0db1,_0x4bf3a5){var _0x1d6834=_['values'](_0x2b4227[_0x0a9e('0x5a')]);_0xf0db1({'count':_0x1d6834[_0x0a9e('0x18')],'rows':_0x1d6834});});},'WhatsappQueuesWaitingInteractions':function(_0x3003eb){return new Promise(function(_0x385d52,_0x5af453){var _0x51ccd7=_[_0x0a9e('0x56')](_0x2b4227[_0x0a9e('0x5b')]);_0x385d52({'count':_0x51ccd7[_0x0a9e('0x18')],'rows':_0x51ccd7});});}};var _0x5ac73d=jayson[_0x0a9e('0x5c')](_0x52a03d)[_0x0a9e('0x5d')]();_0x5ac73d['on']('error',function(_0x4e46b2){logger[_0x0a9e('0x36')](JSON['stringify'](_0x4e46b2));return _0x4d5611(_0x4e46b2);});_0x5ac73d['listen'](0x232c,'127.0.0.1',function(){console[_0x0a9e('0x5e')](_0x0a9e('0x5f'),0x232c);return _0x44dcfd(_0x0a9e('0x60')+0x232c);});});}; \ No newline at end of file +var _0x574d=['./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','account','ChatWebsiteId','body','./interval','consequence','priority','info','on\x20interval','intervals','\x20|\x20','error','rules','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid'];(function(_0x3a429b,_0x2291d4){var _0x44c2e7=function(_0x205459){while(--_0x205459){_0x3a429b['push'](_0x3a429b['shift']());}};_0x44c2e7(++_0x2291d4);}(_0x574d,0xc0));var _0xd574=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x574d[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var path=require(_0xd574('0x2'));var fs=require('fs');var jayson=require(_0xd574('0x3'));var BPromise=require(_0xd574('0x4'));var uuid=require(_0xd574('0x5'));var utils=require(_0xd574('0x6'));var config=require('../../../config/environment');var logger=require(_0xd574('0x7'))(_0xd574('0x8'));var rpc={'openchannelQueueReport':require(_0xd574('0x9')),'mailQueueReport':require(_0xd574('0xa')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xd574('0xb')),'faxQueueReport':require(_0xd574('0xc')),'whatsappQueueReport':require(_0xd574('0xd'))};var RuleEngine=require(_0xd574('0xe'));function getId(_0x3a1e54,_0x20751c,_0x54fe4f){return util['format'](_0xd574('0xf'),_0x3a1e54,_0x20751c||0x0,_0x54fe4f||0x0);}function getIntervals(_0x11ef21,_0x2caf61){var _0x1aa38f=[];if(!_[_0xd574('0x10')](_0x2caf61[_0xd574('0x11')])&&!_[_0xd574('0x10')](_0x11ef21[_0x2caf61['IntervalId']])&&!_[_0xd574('0x10')](_0x11ef21[_0x2caf61[_0xd574('0x11')]][_0xd574('0x12')])){_0x1aa38f=_[_0xd574('0x13')](_0x11ef21[_0x2caf61[_0xd574('0x11')]][_0xd574('0x12')],_0xd574('0x14'));}else if(!_[_0xd574('0x10')](_0x2caf61[_0xd574('0x14')])){_0x1aa38f=[_0x2caf61[_0xd574('0x14')]];}return _0x1aa38f;}exports[_0xd574('0x15')]=function(_0x2cc660){_0x2cc660['rules']={};return new BPromise(function(_0xb44f5d,_0x147cdf){var _0x2d66be={'Start':function(_0x1537f4){var _0x46fb4c=this;return new Promise(function(_0x341463,_0x137917){if(_0x1537f4){try{var _0x2fcdfe=[];var _0x5c1db1=getId(_0x1537f4['channel'],_0x1537f4[_0xd574('0x16')]?_0x1537f4[_0xd574('0x16')]['id']:0x0,_0x1537f4[_0xd574('0x17')]?_0x1537f4['interaction']['id']:0x0);if(_0x1537f4['applications']&&_[_0xd574('0x18')](_0x1537f4[_0xd574('0x19')])&&_0x1537f4[_0xd574('0x19')][_0xd574('0x1a')]){for(var _0x1c899f=0x0;_0x1c899f<_0x1537f4[_0xd574('0x19')][_0xd574('0x1a')];_0x1c899f+=0x1){var _0xf5939a=_0x1537f4[_0xd574('0x19')][_0x1c899f];if(fs[_0xd574('0x1b')](path[_0xd574('0x1c')](__dirname,'applications',_0xf5939a[_0xd574('0x1d')]+_0xd574('0x1e')))){var _0x481564=[];switch(_0xf5939a[_0xd574('0x1d')]['toLowerCase']()){case _0xd574('0x1f'):var _0x274a1e=_0xf5939a[_0xd574('0x20')][_0xd574('0x21')](',');if(_0x1537f4[_0xd574('0x22')]===_0xd574('0x23')){_0x481564[_0xd574('0x24')](_0x274a1e[0x0]);_0x481564[_0xd574('0x24')](_0x274a1e[0x1]);_0x481564[_0xd574('0x24')](_0x274a1e[_0xd574('0x25')](0x2,_0x274a1e[_0xd574('0x1a')])[_0xd574('0x1c')](','));}else{_0x481564[_0xd574('0x24')](_0x274a1e[0x0]);_0x481564[_0xd574('0x24')](_0x274a1e['slice'](0x1,_0x274a1e[_0xd574('0x1a')])['join'](','));}break;case _0xd574('0x26'):var _0x5c9224=_0xf5939a['appdata'][_0xd574('0x21')](',');_0x481564[_0xd574('0x24')](_0x5c9224[0x0]);_0x481564[_0xd574('0x24')](_0x5c9224[0x1]);_0x481564['push'](_0x5c9224[_0xd574('0x25')](0x2,_0x5c9224[_0xd574('0x1a')])[_0xd574('0x1c')](','));break;case _0xd574('0x27'):var _0x508eaa=_0xf5939a['appdata'][_0xd574('0x21')](',');_0x481564[_0xd574('0x24')](_0x508eaa[0x0]);_0x481564[_0xd574('0x24')](_0x508eaa[0x1]);_0x481564[_0xd574('0x24')](_0x508eaa[0x2]);_0x481564[_0xd574('0x24')](_0x508eaa[0x3]);_0x481564[_0xd574('0x24')](_0x508eaa['slice'](0x4,_0x508eaa['length'])[_0xd574('0x1c')](','));break;case _0xd574('0x28'):var _0x3adfdf=_0xf5939a[_0xd574('0x20')][_0xd574('0x21')](',');_0x481564[_0xd574('0x24')](_0x3adfdf[0x0]);_0x481564[_0xd574('0x24')](_0x3adfdf[0x1]);_0x481564[_0xd574('0x24')](_0x3adfdf[0x2]);_0x481564['push'](_0x3adfdf[0x3]);_0x481564['push'](_0x3adfdf[_0xd574('0x25')](0x4,_0x3adfdf[_0xd574('0x1a')])[_0xd574('0x1c')](','));break;case _0xd574('0x16'):_0x481564[_0xd574('0x24')](_0xf5939a['appdata']);break;case _0xd574('0x29'):_0x481564[_0xd574('0x24')](_0xf5939a[_0xd574('0x2a')]);_0x481564[_0xd574('0x24')](_0xf5939a[_0xd574('0x20')]);break;case _0xd574('0x2b'):var _0x27498e=utils['getMustacheRender'](_0x1537f4[_0xd574('0x2c')]['notificationTemplate'],_0x1537f4);var _0x35594e=_0xf5939a[_0xd574('0x20')][_0xd574('0x21')](',');_0x481564[_0xd574('0x24')](_0x35594e[0x0]);_0x481564[_0xd574('0x24')](_0x35594e[0x1]);_0x481564[_0xd574('0x24')](_0x35594e[0x2]);_0x481564[_0xd574('0x24')](_0x35594e[0x3]);_0x481564[_0xd574('0x24')](_0x35594e[0x4]);_0x481564[_0xd574('0x24')](_0x35594e[0x5]);_0x481564[_0xd574('0x24')](_0x35594e[0x6]);_0x481564[_0xd574('0x24')](_0x35594e[0x7]);_0x481564['push'](_0x35594e[0x8]);_0x481564[_0xd574('0x24')](_0x35594e[0x9]);_0x481564[_0xd574('0x24')](_0x35594e[0xa]);_0x481564[_0xd574('0x24')](_0x1537f4['interaction']['id']);_0x481564[_0xd574('0x24')](_0x1537f4[_0xd574('0x16')]['id']);_0x481564[_0xd574('0x24')](_0xf5939a[_0xd574('0x2d')]);_0x481564[_0xd574('0x24')](_0x1537f4[_0xd574('0x17')]['ContactId']);_0x481564[_0xd574('0x24')](_0x1537f4[_0xd574('0x2e')][_0xd574('0x2e')]);_0x481564[_0xd574('0x24')](_0x27498e);break;default:_0x481564=_[_0xd574('0x10')](_0xf5939a['appdata'])?[]:_0xf5939a[_0xd574('0x20')][_0xd574('0x21')](',');}var _0x37b588={'id':util['format']('%s:%s:%s',_0x5c1db1,_0xf5939a['id'],_0xf5939a['app']),'condition':require(_0xd574('0x2f'))['condition'](_0x5c1db1,getIntervals(_0x2cc660['intervals'],_0xf5939a),_0x2cc660),'consequence':require('./applications/'+_0xf5939a[_0xd574('0x1d')])[_0xd574('0x30')](_0x5c1db1,_0x481564,_0x2cc660,_0x1537f4),'p':_0xf5939a[_0xd574('0x31')]||0x0};logger[_0xd574('0x32')]('Push\x20new\x20rule',_0x37b588['id'],_0xd574('0x33'),getIntervals(_0x2cc660[_0xd574('0x34')],_0xf5939a)[_0xd574('0x1c')](_0xd574('0x35')));_0x2fcdfe['push'](_0x37b588);}else{logger[_0xd574('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xd574('0x1c')](__dirname,_0xd574('0x19'),_0xf5939a[_0xd574('0x1d')]+_0xd574('0x1e')));}}_0x2cc660[_0xd574('0x37')][_0x5c1db1]=new RuleEngine(_0x2fcdfe);_0x2cc660[_0xd574('0x37')][_0x5c1db1][_0xd574('0x38')](_0x1537f4,function(_0x323882){logger[_0xd574('0x32')](_0xd574('0x39'),JSON[_0xd574('0x3a')](_0x323882[_0xd574('0x3b')]));if(_0x2cc660[_0xd574('0x37')][_0x5c1db1]){_0x2cc660['rules'][_0x5c1db1][_0xd574('0x3c')]('complete');}});return _0x341463({'code':0xc8,'message':_0x1537f4});}else{logger['info'](_0xd574('0x3d'));return _0x341463({'code':0xc8,'message':_0x1537f4});}}catch(_0x4757a3){logger['error'](_0x4757a3[_0xd574('0x3e')]);return _0x137917(_0x46fb4c[_0xd574('0x36')](0x1f4,_0x4757a3));}}return _0x137917(_0xd574('0x3f'));});},'AcceptMessage':function(_0x4b756a){var _0xea1d6f=this;return new Promise(function(_0x398bf2,_0xba34fe){if(_0x4b756a[_0xd574('0x40')]&&_0x4b756a[_0xd574('0x40')]['id']){if(_0x2cc660[_0xd574('0x41')][_0x4b756a['agent']['id']]){_0x2cc660[_0xd574('0x41')][_0x4b756a[_0xd574('0x40')]['id']][_0xd574('0x42')]=![];_0x2cc660[_0xd574('0x41')][_0x4b756a[_0xd574('0x40')]['id']][_0xd574('0x43')]=undefined;}}if(_0x4b756a[_0xd574('0x16')]&&_0x4b756a[_0xd574('0x16')]['id']){try{var _0xb6e16c=getId(_0x4b756a[_0xd574('0x22')],_0x4b756a[_0xd574('0x16')]?_0x4b756a[_0xd574('0x16')]['id']:0x0,_0x4b756a[_0xd574('0x17')]?_0x4b756a[_0xd574('0x17')]['id']:0x0);if(_0x2cc660[_0xd574('0x37')][_0xb6e16c]){_0x2cc660[_0xd574('0x37')][_0xb6e16c]['emit'](_0xd574('0x44'));if(rpc[_0x4b756a[_0xd574('0x22')]+'QueueReport']){rpc[_0x4b756a[_0xd574('0x22')]+_0xd574('0x45')][_0xd574('0x46')](_0xb6e16c,{'UserId':_0x4b756a[_0xd574('0x16')][_0xd574('0x47')]})[_0xd574('0x48')](function(_0x462e5e){logger[_0xd574('0x36')](_0xd574('0x49'));});}}return _0x398bf2({'code':0xc8,'message':_0x4b756a});}catch(_0xf9ce02){logger['error'](_0xf9ce02[_0xd574('0x3e')]);return _0xba34fe(_0xea1d6f[_0xd574('0x36')](0x1f4,_0xf9ce02));}}logger[_0xd574('0x36')](_0xd574('0x4a'));return _0xba34fe(_0xea1d6f[_0xd574('0x36')](0x1f4,_0xd574('0x4a')));});},'RejectMessage':function(_0x2eedec){var _0x1b7d1d=this;return new Promise(function(_0x349303,_0xba391f){if(_0x2eedec[_0xd574('0x40')]&&_0x2eedec[_0xd574('0x40')]['id']){try{if(_0x2cc660[_0xd574('0x41')][_0x2eedec[_0xd574('0x40')]['id']]){_0x2cc660[_0xd574('0x41')][_0x2eedec[_0xd574('0x40')]['id']][_0xd574('0x42')]=![];_0x2cc660[_0xd574('0x41')][_0x2eedec[_0xd574('0x40')]['id']][_0xd574('0x43')]=undefined;}return _0x349303({'code':0xc8,'message':_0x2eedec});}catch(_0x33ca39){logger[_0xd574('0x36')](_0x33ca39[_0xd574('0x3e')]);return _0xba391f(_0x1b7d1d[_0xd574('0x36')](0x1f4,_0x33ca39));}}logger[_0xd574('0x36')]('message\x20is\x20empty');return _0xba391f(_0x1b7d1d[_0xd574('0x36')](0x1f4,_0xd574('0x4a')));});},'AbandonInteraction':function(_0x2ec166){var _0xd1a7e3=this;return new Promise(function(_0x216e7e,_0x81ae22){if(_0x2ec166[_0xd574('0x22')]&&_0x2ec166[_0xd574('0x17')]&&_0x2ec166[_0xd574('0x17')]['id']){try{var _0x56206e=getId(_0x2ec166['channel'],_0x2ec166[_0xd574('0x16')]?_0x2ec166[_0xd574('0x16')]['id']:0x0,_0x2ec166['interaction']?_0x2ec166[_0xd574('0x17')]['id']:0x0);if(_0x2cc660[_0xd574('0x37')][_0x56206e]){_0x2cc660[_0xd574('0x37')][_0x56206e][_0xd574('0x3c')]('end');}return _0x216e7e({'code':0xc8,'message':_0x2ec166});}catch(_0x2069a8){logger[_0xd574('0x36')](_0x2069a8[_0xd574('0x3e')]);return _0x81ae22(_0xd1a7e3[_0xd574('0x36')](0x1f4,_0x2069a8));}}logger[_0xd574('0x36')](_0xd574('0x4a'));return _0x81ae22(_0xd1a7e3['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x34a223){var _0x257a5f=this;return new Promise(function(_0x483490,_0x128e11){if(_0x2cc660['agents']['hasOwnProperty'](_0x34a223['id'])){for(var _0x2deaec in _0x34a223[_0xd574('0x4b')]){if(_0x34a223['capacity']['hasOwnProperty'](_0x2deaec)){if(_0x2cc660[_0xd574('0x41')][_0x34a223['id']][_0xd574('0x4c')](_0x2deaec+_0xd574('0x4d'))){_0x2cc660[_0xd574('0x41')][_0x34a223['id']][_0x2deaec+_0xd574('0x4d')]=parseInt(_0x34a223['capacity'][_0x2deaec],0xa);}}}_0x2cc660[_0xd574('0x41')][_0x34a223['id']][_0xd574('0x4e')]();return _0x483490({'code':0xc8,'message':_0x2cc660['agents'][_0x34a223['id']]});}else{return _0x128e11(_0x257a5f[_0xd574('0x36')](0x1f4,_0xd574('0x4f')));}});},'Agents':function(_0x2d2897){return new Promise(function(_0x2794b9,_0x4c89f9){var _0x1c691a=_[_0xd574('0x50')](_0x2cc660['agents']);_0x2794b9({'count':_0x1c691a[_0xd574('0x1a')],'rows':_0x1c691a});});},'ChatQueues':function(_0x43cd92){return new Promise(function(_0x2f97df,_0x5b1ba1){var _0x28493c=[];for(var _0x4d52cf in _0x2cc660[_0xd574('0x51')]){if(_0x2cc660[_0xd574('0x51')]['hasOwnProperty'](_0x4d52cf)){var _0x5d4367=_0x2cc660['chatQueues'][_0x4d52cf];var _0xca35cf={'id':_0x5d4367['id'],'available':_0x5d4367[_0xd574('0x52')],'loggedIn':_0x5d4367[_0xd574('0x53')],'name':_0x5d4367[_0xd574('0x54')],'paused':_0x5d4367['paused'],'waiting':_0x5d4367[_0xd574('0x55')]};_0x28493c[_0xd574('0x24')](_0xca35cf);}}_0x2f97df({'count':_0x28493c[_0xd574('0x1a')],'rows':_0x28493c});});},'MailQueues':function(_0x22775a){return new Promise(function(_0x28eaa2,_0x446f4d){var _0x7d3569=[];for(var _0x121ddf in _0x2cc660[_0xd574('0x56')]){if(_0x2cc660['mailQueues']['hasOwnProperty'](_0x121ddf)){var _0xb6fcbe=_0x2cc660[_0xd574('0x56')][_0x121ddf];var _0x23e557={'id':_0xb6fcbe['id'],'available':_0xb6fcbe['available'],'loggedIn':_0xb6fcbe['loggedIn'],'name':_0xb6fcbe['name'],'paused':_0xb6fcbe[_0xd574('0x57')],'waiting':_0xb6fcbe[_0xd574('0x55')]};_0x7d3569[_0xd574('0x24')](_0x23e557);}}_0x28eaa2({'count':_0x7d3569['length'],'rows':_0x7d3569});});},'OpenchannelQueues':function(_0x2fa24c){return new Promise(function(_0xe99fdc,_0x17fc5e){var _0x353c74=[];for(var _0x1e3399 in _0x2cc660['openchannelQueues']){if(_0x2cc660[_0xd574('0x58')][_0xd574('0x4c')](_0x1e3399)){var _0x44808f=_0x2cc660[_0xd574('0x58')][_0x1e3399];var _0x341272={'id':_0x44808f['id'],'available':_0x44808f[_0xd574('0x52')],'loggedIn':_0x44808f[_0xd574('0x53')],'name':_0x44808f[_0xd574('0x54')],'paused':_0x44808f[_0xd574('0x57')],'waiting':_0x44808f[_0xd574('0x55')]};_0x353c74[_0xd574('0x24')](_0x341272);}}_0xe99fdc({'count':_0x353c74[_0xd574('0x1a')],'rows':_0x353c74});});},'SmsQueues':function(_0xcf4f9e){return new Promise(function(_0x43d981,_0x587716){var _0x5ea1e3=[];for(var _0x1ed86b in _0x2cc660[_0xd574('0x59')]){if(_0x2cc660[_0xd574('0x59')][_0xd574('0x4c')](_0x1ed86b)){var _0x3a8f91=_0x2cc660['smsQueues'][_0x1ed86b];var _0x13bcad={'id':_0x3a8f91['id'],'available':_0x3a8f91[_0xd574('0x52')],'loggedIn':_0x3a8f91[_0xd574('0x53')],'name':_0x3a8f91['name'],'paused':_0x3a8f91[_0xd574('0x57')],'waiting':_0x3a8f91[_0xd574('0x55')]};_0x5ea1e3['push'](_0x13bcad);}}_0x43d981({'count':_0x5ea1e3[_0xd574('0x1a')],'rows':_0x5ea1e3});});},'FaxQueues':function(_0x287dda){return new Promise(function(_0x29988c,_0x20d31c){var _0x1f8378=[];for(var _0x315455 in _0x2cc660[_0xd574('0x5a')]){if(_0x2cc660[_0xd574('0x5a')][_0xd574('0x4c')](_0x315455)){var _0x151b66=_0x2cc660['faxQueues'][_0x315455];var _0x57c878={'id':_0x151b66['id'],'available':_0x151b66[_0xd574('0x52')],'loggedIn':_0x151b66[_0xd574('0x53')],'name':_0x151b66['name'],'paused':_0x151b66[_0xd574('0x57')],'waiting':_0x151b66['waiting']};_0x1f8378[_0xd574('0x24')](_0x57c878);}}_0x29988c({'count':_0x1f8378['length'],'rows':_0x1f8378});});},'WhatsappQueues':function(_0x3e7040){return new Promise(function(_0xb1abcb,_0x4921c2){var _0x1fa5c8=[];for(var _0x36f1b3 in _0x2cc660[_0xd574('0x5b')]){if(_0x2cc660[_0xd574('0x5b')]['hasOwnProperty'](_0x36f1b3)){var _0x46607f=_0x2cc660[_0xd574('0x5b')][_0x36f1b3];var _0x149bdd={'id':_0x46607f['id'],'available':_0x46607f[_0xd574('0x52')],'loggedIn':_0x46607f[_0xd574('0x53')],'name':_0x46607f[_0xd574('0x54')],'paused':_0x46607f[_0xd574('0x57')],'waiting':_0x46607f[_0xd574('0x55')]};_0x1fa5c8[_0xd574('0x24')](_0x149bdd);}}_0xb1abcb({'count':_0x1fa5c8[_0xd574('0x1a')],'rows':_0x1fa5c8});});},'ChatQueuesWaitingInteractions':function(_0x4ad8d0){return new Promise(function(_0x181789,_0x248330){var _0x3e2479=_[_0xd574('0x50')](_0x2cc660['chatQueuesWaitingInteractions']);_0x181789({'count':_0x3e2479[_0xd574('0x1a')],'rows':_0x3e2479});});},'MailQueuesWaitingInteractions':function(_0x5c94b6){return new Promise(function(_0x35e788,_0x1be508){var _0x517383=_[_0xd574('0x50')](_0x2cc660['mailQueuesWaitingInteractions']);_0x35e788({'count':_0x517383[_0xd574('0x1a')],'rows':_0x517383});});},'OpenchannelQueuesWaitingInteractions':function(_0x5b8547){return new Promise(function(_0x388889,_0x2c3fdc){var _0x5b6c90=_[_0xd574('0x50')](_0x2cc660[_0xd574('0x5c')]);_0x388889({'count':_0x5b6c90[_0xd574('0x1a')],'rows':_0x5b6c90});});},'SmsQueuesWaitingInteractions':function(_0x29bd54){return new Promise(function(_0x23bff3,_0x5ea76e){var _0x1b3cc6=_[_0xd574('0x50')](_0x2cc660[_0xd574('0x5d')]);_0x23bff3({'count':_0x1b3cc6[_0xd574('0x1a')],'rows':_0x1b3cc6});});},'FaxQueuesWaitingInteractions':function(_0x1e9eb5){return new Promise(function(_0x24d65b,_0x1a253a){var _0x3dc27a=_[_0xd574('0x50')](_0x2cc660[_0xd574('0x5e')]);_0x24d65b({'count':_0x3dc27a[_0xd574('0x1a')],'rows':_0x3dc27a});});},'WhatsappQueuesWaitingInteractions':function(_0x3deaf1){return new Promise(function(_0x586681,_0x5d0b0d){var _0x4afe1a=_[_0xd574('0x50')](_0x2cc660['whatsappQueuesWaitingInteractions']);_0x586681({'count':_0x4afe1a['length'],'rows':_0x4afe1a});});}};var _0x47fb61=jayson[_0xd574('0x5f')](_0x2d66be)[_0xd574('0x60')]();_0x47fb61['on']('error',function(_0x521bc){logger[_0xd574('0x36')](JSON['stringify'](_0x521bc));return _0x147cdf(_0x521bc);});_0x47fb61[_0xd574('0x15')](0x232c,_0xd574('0x61'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xb44f5d(_0xd574('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9bd219d..8c38484 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 _0xa8a4=['stack','stop','util','bluebird','../../../config/logger','routing','request','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','then','indexOf','true','all','some','join','when','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0xa8a4,0x1b5));var _0x4a8a=function(_0x47bce4,_0x287773){_0x47bce4=_0x47bce4-0x0;var _0x38ee35=_0xa8a4[_0x47bce4];return _0x38ee35;};'use strict';var util=require(_0x4a8a('0x0'));var BPromise=require(_0x4a8a('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x4a8a('0x2'))(_0x4a8a('0x3'));var client=jayson['client']['http']({'port':0x232a});function request(_0x438281,_0x14e7d2){return new BPromise(function(_0x5221b5,_0x5228a7){return client[_0x4a8a('0x4')](_0x438281,_0x14e7d2)['then'](function(_0x460392){if(_0x460392[_0x4a8a('0x5')]){return _0x5228a7(_0x460392['error'][_0x4a8a('0x6')]);}else{return _0x5221b5(_0x460392[_0x4a8a('0x7')]);}})[_0x4a8a('0x8')](function(_0x11bf37){return _0x5228a7(_0x11bf37);});});}exports['condition']=function(_0x30e682,_0x208935,_0x418486){return function(_0x1ce196){if(_0x418486['rules']&&!_0x418486[_0x4a8a('0x9')][_0x30e682]){logger[_0x4a8a('0xa')](_0x4a8a('0xb'),_0x30e682);return _0x1ce196['stop']();}var _0x5271ab=[];for(var _0x45f49e=0x0;_0x45f49e<_0x208935[_0x4a8a('0xc')];_0x45f49e+=0x1){_0x5271ab[_0x4a8a('0xd')](request(_0x4a8a('0xe'),{'command':util[_0x4a8a('0xf')](_0x4a8a('0x10'),_0x208935[_0x45f49e])})[_0x4a8a('0x11')](function(_0x37133f){return _0x37133f&&_0x37133f[_0x4a8a('0x6')]&&_0x37133f['message'][_0x4a8a('0x12')](_0x4a8a('0x13'))>=0x0?!![]:![];})[_0x4a8a('0x8')](function(_0x17a577){logger[_0x4a8a('0x5')]('[%s][INTERVAL]\x20%s',_0x30e682,_0x208935[_0x45f49e]);}));}BPromise[_0x4a8a('0x14')](_0x5271ab)[_0x4a8a('0x11')](function(_0xae8350){var _0x924c82=_[_0x4a8a('0x15')](_0xae8350);logger[_0x4a8a('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x30e682,_0x208935[_0x4a8a('0x16')]('\x20|\x20'),_0x924c82);_0x1ce196[_0x4a8a('0x17')](_0x924c82);})[_0x4a8a('0x8')](function(_0x39694f){console[_0x4a8a('0x18')](_0x39694f);logger['error'](_0x4a8a('0x19'),_0x30e682,_0x208935[_0x4a8a('0x16')](_0x4a8a('0x1a')),_0x39694f[_0x4a8a('0x1b')]);_0x1ce196[_0x4a8a('0x1c')]();});};}; \ No newline at end of file +var _0x498f=['stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','http','request','then','error','result','catch','condition','rules'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x498f,0xad));var _0xf498=function(_0x1240db,_0x192d1f){_0x1240db=_0x1240db-0x0;var _0x3253de=_0x498f[_0x1240db];return _0x3253de;};'use strict';var util=require(_0xf498('0x0'));var BPromise=require(_0xf498('0x1'));var jayson=require(_0xf498('0x2'));var _=require(_0xf498('0x3'));var logger=require(_0xf498('0x4'))('routing');var client=jayson['client'][_0xf498('0x5')]({'port':0x232a});function request(_0x178ce0,_0x5b0a4a){return new BPromise(function(_0x295986,_0x57bc89){return client[_0xf498('0x6')](_0x178ce0,_0x5b0a4a)[_0xf498('0x7')](function(_0x2536b0){if(_0x2536b0[_0xf498('0x8')]){return _0x57bc89(_0x2536b0[_0xf498('0x8')]['message']);}else{return _0x295986(_0x2536b0[_0xf498('0x9')]);}})[_0xf498('0xa')](function(_0x552c98){return _0x57bc89(_0x552c98);});});}exports[_0xf498('0xb')]=function(_0x1f02e0,_0x410b17,_0x10820d){return function(_0x39e173){if(_0x10820d[_0xf498('0xc')]&&!_0x10820d[_0xf498('0xc')][_0x1f02e0]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1f02e0);return _0x39e173[_0xf498('0xd')]();}var _0x11ced3=[];for(var _0x2fdbdb=0x0;_0x2fdbdb<_0x410b17[_0xf498('0xe')];_0x2fdbdb+=0x1){_0x11ced3[_0xf498('0xf')](request(_0xf498('0x10'),{'command':util[_0xf498('0x11')](_0xf498('0x12'),_0x410b17[_0x2fdbdb])})[_0xf498('0x7')](function(_0x2a0b61){return _0x2a0b61&&_0x2a0b61[_0xf498('0x13')]&&_0x2a0b61[_0xf498('0x13')][_0xf498('0x14')](_0xf498('0x15'))>=0x0?!![]:![];})[_0xf498('0xa')](function(_0x2c6050){logger[_0xf498('0x8')](_0xf498('0x16'),_0x1f02e0,_0x410b17[_0x2fdbdb]);}));}BPromise[_0xf498('0x17')](_0x11ced3)[_0xf498('0x7')](function(_0x5aedd7){var _0x32643c=_[_0xf498('0x18')](_0x5aedd7);logger[_0xf498('0x19')](_0xf498('0x1a'),_0x1f02e0,_0x410b17[_0xf498('0x1b')](_0xf498('0x1c')),_0x32643c);_0x39e173['when'](_0x32643c);})[_0xf498('0xa')](function(_0x225774){console[_0xf498('0x1d')](_0x225774);logger[_0xf498('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x1f02e0,_0x410b17[_0xf498('0x1b')](_0xf498('0x1c')),_0x225774[_0xf498('0x1e')]);_0x39e173[_0xf498('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fe166a0..b72cdb7 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 _0xbfcc=['now','lastevent','called','connectedlinename','agentringnoanswer','isNil','debug','timeout','reason','holdtime','ringtime','push','error','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','talktime','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','info','format','membername','interface','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','uniqueid'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xbfcc[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1a2fe0,_0x2d1386){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1a2fe0['uniqueid'],_0x1a2fe0['channel'],_0x1a2fe0['queue'],_0x1a2fe0[_0xcbfc('0x3')],_0x1a2fe0[_0xcbfc('0x4')],_0x1a2fe0['calleridnum'],_0x1a2fe0[_0xcbfc('0x5')],_0x1a2fe0['lastevent']));if(_0x1a2fe0[_0xcbfc('0x6')]){utils[_0xcbfc('0x7')](_0x1a2fe0[_0xcbfc('0x6')])[_0xcbfc('0x8')](function(_0x4eff22){if(_0x4eff22){_0x1a2fe0[_0xcbfc('0x9')]=_0x4eff22[_0xcbfc('0x9')];_0x1a2fe0[_0xcbfc('0xa')]=_0x1a2fe0[_0xcbfc('0xb')]?_0x4eff22[_0xcbfc('0xc')]:![];_0x1a2fe0[_0xcbfc('0xd')]=_0x1a2fe0['agentacw']?_0x4eff22[_0xcbfc('0xe')]:0x0;}utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);});}else{utils[_0xcbfc('0xf')](_0xcbfc('0x10'),_0x1a2fe0);}if(_0x2d1386){delete transfers[_0x1a2fe0['uniqueid']];}else{delete agents[_0x1a2fe0[_0xcbfc('0x11')]];}}exports[_0xcbfc('0x12')]=function(_0x80d08d){try{utils['debug'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x80d08d);agents[_0x80d08d[_0xcbfc('0x11')]]=_0x80d08d;agents[_0x80d08d[_0xcbfc('0x11')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x16')]=_0xcbfc('0x17');agents[_0x80d08d['destuniqueid']]['connectedlinenum']=null;agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x18')]=null;utils[_0xcbfc('0x1')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x80d08d[_0xcbfc('0x14')],agents[_0x80d08d[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x80d08d['destuniqueid']));}catch(_0x3825d5){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x13'),_0x80d08d[_0xcbfc('0x14')]),_0x3825d5);}};exports[_0xcbfc('0x19')]=function(_0x25c167){try{if(!_[_0xcbfc('0x1a')](agents[_0x25c167['destuniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')]('[%s][agents][agentringnoanswer]',_0x25c167[_0xcbfc('0x14')]),_0x25c167);utils['info'](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x25c167[_0xcbfc('0x14')],agents[_0x25c167['destuniqueid']]['membername'],_0x25c167[_0xcbfc('0x11')]));agents[_0x25c167[_0xcbfc('0x11')]][_0xcbfc('0x19')]=!![];agents[_0x25c167[_0xcbfc('0x11')]]['agentringnoanswerAt']=utils[_0xcbfc('0x15')]();agents[_0x25c167['destuniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1d')]=_0xcbfc('0x1c');agents[_0x25c167['destuniqueid']][_0xcbfc('0x1e')]=_0x25c167[_0xcbfc('0x1f')]?parseInt(_0x25c167[_0xcbfc('0x1f')])/0x3e8:0x0;agents[_0x25c167[_0xcbfc('0x11')]]['talktime']=0x0;unanswered[_0xcbfc('0x20')](_0x25c167[_0xcbfc('0x11')]);}}catch(_0x4f632a){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x22'),_0x25c167[_0xcbfc('0x14')]),_0x4f632a);}};exports[_0xcbfc('0x23')]=function(_0x19d2e){try{_[_0xcbfc('0x24')](agents,function(_0x5366cf,_0x41b68b){if(_0x5366cf[_0xcbfc('0x14')]==_0x19d2e[_0xcbfc('0x14')]&&!_[_0xcbfc('0x25')](unanswered,_0x5366cf['destuniqueid'])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x19d2e);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x27'),_0x19d2e['uniqueid'],_0x5366cf[_0xcbfc('0x3')],_0x5366cf[_0xcbfc('0x11')]));_0x5366cf['agentringnoanswer']=!![];_0x5366cf[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x5366cf[_0xcbfc('0x16')]='abandoned';_0x5366cf['reason']='abandoned';_0x5366cf[_0xcbfc('0x1e')]=_0x19d2e[_0xcbfc('0x1e')];_0x5366cf[_0xcbfc('0x29')]=0x0;writeDB(_0x5366cf);}});}catch(_0x9c1ff3){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')](_0xcbfc('0x26'),_0x19d2e[_0xcbfc('0x14')]),_0x9c1ff3);}};exports['agentconnect']=function(_0x2f14ff){try{if(agents[_0x2f14ff[_0xcbfc('0x11')]]){utils['debug'](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]',_0x2f14ff[_0xcbfc('0x14')]),_0x2f14ff);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2f14ff[_0xcbfc('0x14')],agents[_0x2f14ff['destuniqueid']]['membername'],_0x2f14ff[_0xcbfc('0x11')]));agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x5')]=_0x2f14ff[_0xcbfc('0x5')];agents[_0x2f14ff[_0xcbfc('0x11')]]['connectedlinename']=_0x2f14ff[_0xcbfc('0x18')];agents[_0x2f14ff['destuniqueid']][_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];agents[_0x2f14ff[_0xcbfc('0x11')]][_0xcbfc('0x16')]='connect';_['forIn'](agents,function(_0x236b66,_0x1c678b){if(_0x236b66[_0xcbfc('0x11')]!=_0x2f14ff[_0xcbfc('0x11')]&&_0x236b66[_0xcbfc('0x14')]==_0x2f14ff['uniqueid']){_0x236b66[_0xcbfc('0x29')]=0x0;_0x236b66[_0xcbfc('0x1e')]=_0x2f14ff[_0xcbfc('0x1f')];_0x236b66['agentringnoanswer']=!![];_0x236b66[_0xcbfc('0x28')]=utils[_0xcbfc('0x15')]();_0x236b66[_0xcbfc('0x16')]='answered_elsewhere';_0x236b66[_0xcbfc('0x1d')]=_0xcbfc('0x2b');_0x236b66[_0xcbfc('0x2c')]=_0x2f14ff[_0xcbfc('0x11')];_0x236b66[_0xcbfc('0x2d')]=_0x2f14ff[_0xcbfc('0x3')];writeDB(_0x236b66);}});}}catch(_0x1e14bb){utils['error'](util[_0xcbfc('0x2')](_0xcbfc('0x2e'),_0x2f14ff['uniqueid']),_0x1e14bb);}};exports[_0xcbfc('0xb')]=function(_0x50a01c){try{if(!_[_0xcbfc('0x1a')](agents[_0x50a01c[_0xcbfc('0x11')]])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x2f'),_0x50a01c[_0xcbfc('0x14')]),_0x50a01c);utils['info'](util[_0xcbfc('0x2')](_0xcbfc('0x30'),_0x50a01c[_0xcbfc('0x14')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x3')],_0x50a01c[_0xcbfc('0x11')]));agents[_0x50a01c[_0xcbfc('0x11')]]['agentcomplete']=!![];agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x31')]=utils['now']();agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x50a01c['destuniqueid']][_0xcbfc('0x31')],agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x2a')]);agents[_0x50a01c[_0xcbfc('0x11')]][_0xcbfc('0x1d')]=_0x50a01c[_0xcbfc('0x1d')];agents[_0x50a01c[_0xcbfc('0x11')]]['lastevent']='complete';writeDB(agents[_0x50a01c[_0xcbfc('0x11')]]);}}catch(_0x94398c){utils[_0xcbfc('0x21')](util[_0xcbfc('0x2')]('[%s][agents][agentcomplete]',_0x50a01c['uniqueid']),_0x94398c);}};exports[_0xcbfc('0x33')]=function(_0xe5c5ef){try{if(!_[_0xcbfc('0x1a')](agents[_0xe5c5ef['transfereruniqueid']])){utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x34'),_0xe5c5ef['uniqueid']),_0xe5c5ef);utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x35'),_0xe5c5ef[_0xcbfc('0x14')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x3')],agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')]));agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x37')]=!![];agents[_0xe5c5ef['transfereruniqueid']][_0xcbfc('0x38')]=_0xcbfc('0x39');agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferexten']=_0xe5c5ef[_0xcbfc('0x3a')];agents[_0xe5c5ef[_0xcbfc('0x36')]]['transferuniqueid']=agents[_0xe5c5ef[_0xcbfc('0x36')]][_0xcbfc('0x14')];}}catch(_0x38db76){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x34'),_0xe5c5ef[_0xcbfc('0x14')]),_0x38db76);}};exports['attendedtransfer']=function(_0x2fe240){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x3b'),_0x2fe240[_0xcbfc('0x3c')]),_0x2fe240);if(_0x2fe240[_0xcbfc('0x3c')]==_0x2fe240[_0xcbfc('0x3d')]){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3e')]])){utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x3f'),_0x2fe240['origtransfereruniqueid'],agents[_0x2fe240['secondtransfereruniqueid']]['membername']));agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3e')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x42')];agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3c')];}if(_0x2fe240[_0xcbfc('0x44')]&&agents[_0x2fe240['transfereeuniqueid']]){agents[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x45')]=0x1;transfers[_0x2fe240[_0xcbfc('0x44')]]=_[_0xcbfc('0x46')](agents[_0x2fe240[_0xcbfc('0x44')]]);transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x47')]=agents[_0x2fe240['secondtransfereruniqueid']][_0xcbfc('0x47')];transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x48')]=agents[_0x2fe240[_0xcbfc('0x3e')]]['calleridname'];transfers[_0x2fe240[_0xcbfc('0x44')]]['agentcalledAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x2a')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x44')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfereeuniqueid']][_0xcbfc('0x45')]=0x2;}}else if(_0x2fe240[_0xcbfc('0x3e')]==_0x2fe240['secondtransfererlinkedid']){if(!_[_0xcbfc('0x1a')](agents[_0x2fe240[_0xcbfc('0x3c')]])){utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x3f'),_0x2fe240[_0xcbfc('0x3c')],agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x3')]));agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x37')]=!![];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x38')]=_0xcbfc('0x40');agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x41')]=_0x2fe240[_0xcbfc('0x49')];agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x43')]=_0x2fe240[_0xcbfc('0x3e')];}if(_0x2fe240['transfertargetuniqueid']&&agents[_0x2fe240[_0xcbfc('0x4a')]]){agents[_0x2fe240[_0xcbfc('0x4a')]]['agententerreason']=0x1;transfers[_0x2fe240[_0xcbfc('0x4a')]]=_['clone'](agents[_0x2fe240['transfertargetuniqueid']]);transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x47')]=agents[_0x2fe240[_0xcbfc('0x3c')]][_0xcbfc('0x47')];transfers[_0x2fe240[_0xcbfc('0x4a')]]['calleridname']=agents[_0x2fe240['origtransfereruniqueid']][_0xcbfc('0x48')];transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x4b')]=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]]['agentconnectAt']=utils[_0xcbfc('0x15')]();transfers[_0x2fe240[_0xcbfc('0x4a')]][_0xcbfc('0x1e')]=0x0;transfers[_0x2fe240['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4c3d4d){utils[_0xcbfc('0x21')](util['format']('[%s][agents][attendedtransfer]',_0x2fe240[_0xcbfc('0x3c')]),_0x4c3d4d);}};exports['hangup']=function(_0x99068f){try{utils[_0xcbfc('0x1b')](util[_0xcbfc('0x2')](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x99068f);if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]===_0xcbfc('0x1c')){if(_0x99068f['cause']==='21'){agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x4d');agents[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x4d');}utils[_0xcbfc('0x1')](util[_0xcbfc('0x2')](_0xcbfc('0x4e'),_0x99068f[_0xcbfc('0x14')],agents[_0x99068f[_0xcbfc('0x14')]]['membername'],agents[_0x99068f[_0xcbfc('0x14')]]['reason'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);var _0x51019a=unanswered[_0xcbfc('0x4f')](_0x99068f['uniqueid']);if(_0x51019a>-0x1){unanswered[_0xcbfc('0x50')](_0x51019a,0x1);}}if(transfers[_0x99068f[_0xcbfc('0x14')]]){transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0xb')]=!![];transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();transfers[_0x99068f['uniqueid']][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](transfers[_0x99068f[_0xcbfc('0x14')]]['agentcompleteAt'],transfers[_0x99068f[_0xcbfc('0x14')]]['agentconnectAt']);transfers[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=_0xcbfc('0x51');transfers[_0x99068f['uniqueid']][_0xcbfc('0x16')]=_0xcbfc('0x52');utils['info'](util[_0xcbfc('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x99068f[_0xcbfc('0x14')],transfers[_0x99068f['uniqueid']][_0xcbfc('0x3')],transfers[_0x99068f[_0xcbfc('0x14')]]['reason'],transfers[_0x99068f[_0xcbfc('0x14')]]['lastevent']));writeDB(transfers[_0x99068f[_0xcbfc('0x14')]],!![]);}if(agents[_0x99068f[_0xcbfc('0x14')]]&&agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]){agents[_0x99068f['uniqueid']][_0xcbfc('0xb')]=!![];agents[_0x99068f['uniqueid']][_0xcbfc('0x31')]=utils[_0xcbfc('0x15')]();agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x29')]=utils[_0xcbfc('0x32')](agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x31')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x2a')]);agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')]=agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x37')]?_0xcbfc('0x37'):_0xcbfc('0x51');agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]='complete';utils[_0xcbfc('0x1')](util['format'](_0xcbfc('0x4e'),_0x99068f['uniqueid'],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x3')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x1d')],agents[_0x99068f[_0xcbfc('0x14')]][_0xcbfc('0x16')]));writeDB(agents[_0x99068f[_0xcbfc('0x14')]]);}}catch(_0x4f38cb){utils[_0xcbfc('0x21')](util['format'](_0xcbfc('0x4c'),_0x99068f[_0xcbfc('0x14')]),_0x4f38cb);}}; \ No newline at end of file +var _0xda3f=['ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','holdtime','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason'];(function(_0x317866,_0x3d4dc8){var _0x46b05d=function(_0x36c6b8){while(--_0x36c6b8){_0x317866['push'](_0x317866['shift']());}};_0x46b05d(++_0x3d4dc8);}(_0xda3f,0xec));var _0xfda3=function(_0x99a369,_0x3f31bf){_0x99a369=_0x99a369-0x0;var _0x28550c=_0xda3f[_0x99a369];return _0x28550c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var utils=require(_0xfda3('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x534697,_0x5299b0){utils['info'](util[_0xfda3('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x534697[_0xfda3('0x3')],_0x534697[_0xfda3('0x4')],_0x534697['queue'],_0x534697[_0xfda3('0x5')],_0x534697[_0xfda3('0x6')],_0x534697['calleridnum'],_0x534697['connectedlinenum'],_0x534697[_0xfda3('0x7')]));if(_0x534697[_0xfda3('0x8')]){utils[_0xfda3('0x9')](_0x534697[_0xfda3('0x8')])[_0xfda3('0xa')](function(_0x20e790){if(_0x20e790){_0x534697[_0xfda3('0xb')]=_0x20e790[_0xfda3('0xb')];_0x534697[_0xfda3('0xc')]=_0x534697[_0xfda3('0xd')]?_0x20e790[_0xfda3('0xe')]:![];_0x534697[_0xfda3('0xf')]=_0x534697['agentacw']?_0x20e790[_0xfda3('0x10')]:0x0;}utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);});}else{utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);}if(_0x5299b0){delete transfers[_0x534697['uniqueid']];}else{delete agents[_0x534697[_0xfda3('0x13')]];}}exports['agentcalled']=function(_0x3fd031){try{utils[_0xfda3('0x14')](util['format']('[%s][agents][agentcalled]',_0x3fd031['uniqueid']),_0x3fd031);agents[_0x3fd031[_0xfda3('0x13')]]=_0x3fd031;agents[_0x3fd031[_0xfda3('0x13')]]['agentcalledAt']=utils['now']();agents[_0x3fd031['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x15');agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x16')]=null;agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x17')]=null;utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x19'),_0x3fd031[_0xfda3('0x3')],agents[_0x3fd031['destuniqueid']][_0xfda3('0x5')],_0x3fd031[_0xfda3('0x13')]));}catch(_0x12d568){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x1b'),_0x3fd031[_0xfda3('0x3')]),_0x12d568);}};exports[_0xfda3('0x1c')]=function(_0x51e731){try{if(!_['isNil'](agents[_0x51e731[_0xfda3('0x13')]])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')]('[%s][agents][agentringnoanswer]',_0x51e731[_0xfda3('0x3')]),_0x51e731);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x1d'),_0x51e731[_0xfda3('0x3')],agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x5')],_0x51e731[_0xfda3('0x13')]));agents[_0x51e731[_0xfda3('0x13')]]['agentringnoanswer']=!![];agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();agents[_0x51e731['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x21')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]]['holdtime']=_0x51e731[_0xfda3('0x22')]?parseInt(_0x51e731[_0xfda3('0x22')])/0x3e8:0x0;agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x23')]=0x0;unanswered[_0xfda3('0x24')](_0x51e731['destuniqueid']);}}catch(_0x3c1549){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x25'),_0x51e731[_0xfda3('0x3')]),_0x3c1549);}};exports[_0xfda3('0x26')]=function(_0x26e544){try{_['forIn'](agents,function(_0x56ca3a,_0x3aef3c){if(_0x56ca3a['uniqueid']==_0x26e544['uniqueid']&&!_[_0xfda3('0x27')](unanswered,_0x56ca3a[_0xfda3('0x13')])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x26e544);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x29'),_0x26e544['uniqueid'],_0x56ca3a[_0xfda3('0x5')],_0x56ca3a[_0xfda3('0x13')]));_0x56ca3a[_0xfda3('0x1c')]=!![];_0x56ca3a[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x56ca3a[_0xfda3('0x7')]=_0xfda3('0x2a');_0x56ca3a[_0xfda3('0x21')]=_0xfda3('0x2a');_0x56ca3a['holdtime']=_0x26e544['holdtime'];_0x56ca3a[_0xfda3('0x23')]=0x0;writeDB(_0x56ca3a);}});}catch(_0x17cccb){utils['error'](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x17cccb);}};exports['agentconnect']=function(_0x1d92a9){try{if(agents[_0x1d92a9[_0xfda3('0x13')]]){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x1d92a9);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x2c'),_0x1d92a9['uniqueid'],agents[_0x1d92a9[_0xfda3('0x13')]]['membername'],_0x1d92a9[_0xfda3('0x13')]));agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x16')]=_0x1d92a9[_0xfda3('0x16')];agents[_0x1d92a9[_0xfda3('0x13')]]['connectedlinename']=_0x1d92a9[_0xfda3('0x17')];agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];agents[_0x1d92a9['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x2f');_[_0xfda3('0x30')](agents,function(_0x5bad90,_0x5ac61e){if(_0x5bad90[_0xfda3('0x13')]!=_0x1d92a9[_0xfda3('0x13')]&&_0x5bad90[_0xfda3('0x3')]==_0x1d92a9[_0xfda3('0x3')]){_0x5bad90[_0xfda3('0x23')]=0x0;_0x5bad90[_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];_0x5bad90[_0xfda3('0x1c')]=!![];_0x5bad90[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x5bad90['lastevent']=_0xfda3('0x31');_0x5bad90[_0xfda3('0x21')]='answered_elsewhere';_0x5bad90[_0xfda3('0x32')]=_0x1d92a9['destuniqueid'];_0x5bad90['answeredelsewheremembername']=_0x1d92a9['membername'];writeDB(_0x5bad90);}});}}catch(_0x2208bc){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x2208bc);}};exports[_0xfda3('0xd')]=function(_0x25b9a6){try{if(!_[_0xfda3('0x33')](agents[_0x25b9a6[_0xfda3('0x13')]])){utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x25b9a6);utils['info'](util['format'](_0xfda3('0x35'),_0x25b9a6[_0xfda3('0x3')],agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x5')],_0x25b9a6[_0xfda3('0x13')]));agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0xd')]=!![];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x25b9a6[_0xfda3('0x13')]]['agentcompleteAt'],agents[_0x25b9a6['destuniqueid']][_0xfda3('0x2d')]);agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x21')]=_0x25b9a6[_0xfda3('0x21')];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x7')]=_0xfda3('0x38');writeDB(agents[_0x25b9a6[_0xfda3('0x13')]]);}}catch(_0x1372ee){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x1372ee);}};exports[_0xfda3('0x39')]=function(_0x36aa3a){try{if(!_[_0xfda3('0x33')](agents[_0x36aa3a['transfereruniqueid']])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a['uniqueid']),_0x36aa3a);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x3b'),_0x36aa3a['uniqueid'],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x5')],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x3')]));agents[_0x36aa3a[_0xfda3('0x3c')]]['transfer']=!![];agents[_0x36aa3a[_0xfda3('0x3c')]]['transfertype']=_0xfda3('0x3d');agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3e')]=_0x36aa3a[_0xfda3('0x3f')];agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x40')]=agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3')];}}catch(_0x3b430d){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a[_0xfda3('0x3')]),_0x3b430d);}};exports[_0xfda3('0x41')]=function(_0x54fba2){try{utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x42'),_0x54fba2[_0xfda3('0x43')]),_0x54fba2);if(_0x54fba2['origtransfereruniqueid']==_0x54fba2['origtransfererlinkedid']){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x44')]])){utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x45'),_0x54fba2['origtransfereruniqueid'],agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x46')]=!![];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x3e')]=_0x54fba2[_0xfda3('0x49')];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x40')]=_0x54fba2['origtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x4a')]&&agents[_0x54fba2[_0xfda3('0x4a')]]){agents[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2[_0xfda3('0x4a')]]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x4a')]]);transfers[_0x54fba2['transfereeuniqueid']]['calleridnum']=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4e')]=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4e')];transfers[_0x54fba2[_0xfda3('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4b')]=0x2;}}else if(_0x54fba2[_0xfda3('0x44')]==_0x54fba2[_0xfda3('0x4f')]){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x43')]])){utils[_0xfda3('0x18')](util['format'](_0xfda3('0x45'),_0x54fba2[_0xfda3('0x43')],agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x43')]]['transfer']=!![];agents[_0x54fba2['origtransfereruniqueid']][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2['origtransfereruniqueid']]['transferexten']=_0x54fba2['secondtransfererexten'];agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x40')]=_0x54fba2['secondtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x50')]&&agents[_0x54fba2[_0xfda3('0x50')]]){agents[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2['transfertargetuniqueid']]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x50')]]);transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4d')]=agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfertargetuniqueid']]['calleridname']=agents[_0x54fba2[_0xfda3('0x43')]]['calleridname'];transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x51')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x2;}}}catch(_0x4aa383){utils[_0xfda3('0x1a')](util['format']('[%s][agents][attendedtransfer]',_0x54fba2[_0xfda3('0x43')]),_0x4aa383);}};exports[_0xfda3('0x52')]=function(_0x531874){try{utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x531874);if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]===_0xfda3('0x20')){if(_0x531874[_0xfda3('0x54')]==='21'){agents[_0x531874['uniqueid']]['reason']='rejected';agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x7')]=_0xfda3('0x55');}utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874['uniqueid'],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],agents[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(agents[_0x531874['uniqueid']]);var _0x311645=unanswered[_0xfda3('0x57')](_0x531874[_0xfda3('0x3')]);if(_0x311645>-0x1){unanswered[_0xfda3('0x58')](_0x311645,0x1);}}if(transfers[_0x531874[_0xfda3('0x3')]]){transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0xd')]=!![];transfers[_0x531874['uniqueid']][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](transfers[_0x531874[_0xfda3('0x3')]]['agentcompleteAt'],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]=_0xfda3('0x59');transfers[_0x531874['uniqueid']][_0xfda3('0x7')]=_0xfda3('0x38');utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],transfers[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(transfers[_0x531874[_0xfda3('0x3')]],!![]);}if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]){agents[_0x531874['uniqueid']]['agentcomplete']=!![];agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);agents[_0x531874[_0xfda3('0x3')]]['reason']=agents[_0x531874[_0xfda3('0x3')]]['transfer']?'transfer':'agent';agents[_0x531874[_0xfda3('0x3')]]['lastevent']=_0xfda3('0x38');utils[_0xfda3('0x18')](util['format'](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],agents[_0x531874['uniqueid']][_0xfda3('0x5')],agents[_0x531874['uniqueid']][_0xfda3('0x21')],agents[_0x531874[_0xfda3('0x3')]]['lastevent']));writeDB(agents[_0x531874[_0xfda3('0x3')]]);}}catch(_0x2122e3){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x2122e3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 78dc8db..f623537 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 _0xf62d=['xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%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','startsWith','cdr','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','recording','debug','linkedid','OutgoingSpoolFailed','format','exten','context','now','DOCUMENTATION','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','channelstate','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','value','destination','\x22\x20<','xmd-callerid-preview'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0xf62d,0x1c0));var _0xdf62=function(_0x4c790a,_0xa1999){_0x4c790a=_0x4c790a-0x0;var _0x3cf65d=_0xf62d[_0x4c790a];return _0x3cf65d;};'use strict';var _=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var utils=require('./utils');var transfers=require(_0xdf62('0x2'));var dispositions=[_0xdf62('0x3'),_0xdf62('0x4'),_0xdf62('0x4'),_0xdf62('0x3'),_0xdf62('0x3'),_0xdf62('0x3'),_0xdf62('0x5'),'BUSY','FAILED','FAILED',_0xdf62('0x4')];var channels={};function writeDB(_0x5e7e30){var _0x36d742;if(transfers[_0xdf62('0x6')][_0x5e7e30[_0xdf62('0x7')]]){_0x36d742=_0x5e7e30[_0xdf62('0x7')];_0x5e7e30[_0xdf62('0x7')]=transfers[_0xdf62('0x6')][_0x5e7e30[_0xdf62('0x7')]][_0xdf62('0x8')];}utils[_0xdf62('0x9')](util['format'](_0xdf62('0xa'),_0x5e7e30['uniqueid'],_0x5e7e30[_0xdf62('0xb')],_0x5e7e30['queue'],_0x5e7e30[_0xdf62('0xc')],_0x5e7e30[_0xdf62('0xd')],_0x5e7e30[_0xdf62('0xe')],_0x5e7e30[_0xdf62('0xf')],_0x5e7e30[_0xdf62('0x10')]));if(_0x5e7e30[_0xdf62('0x11')]){utils['getUserByInternal'](_0x5e7e30[_0xdf62('0x11')])[_0xdf62('0x12')](function(_0x31201c){if(_0x31201c){_0x5e7e30[_0xdf62('0x13')]=_0x31201c['id'];}utils['request']('CreateVoiceCallReport',_0x5e7e30);});}else{utils[_0xdf62('0x14')]('CreateVoiceCallReport',_0x5e7e30);}if(channels[_0x5e7e30[_0xdf62('0x7')]]){delete channels[_0x5e7e30[_0xdf62('0x7')]];}else if(_0x36d742&&channels[_0x36d742]){if(!transfers[_0xdf62('0x6')][_0x36d742][_0xdf62('0x15')])delete transfers['blinds'][_0x36d742];delete channels[_0x36d742];}}exports['newchannel']=function(_0x159ff1){try{utils[_0xdf62('0x16')](util['format']('[%s][calls][newchannel]',_0x159ff1[_0xdf62('0x7')]),_0x159ff1);if(_0x159ff1[_0xdf62('0x7')]==_0x159ff1[_0xdf62('0x17')]&&_0x159ff1[_0xdf62('0xb')]!=_0xdf62('0x18')){utils[_0xdf62('0x9')](util[_0xdf62('0x19')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x159ff1[_0xdf62('0x7')],_0x159ff1['context'],_0x159ff1[_0xdf62('0x1a')]));channels[_0x159ff1[_0xdf62('0x7')]]={'uniqueid':_0x159ff1[_0xdf62('0x7')],'accountcode':_0x159ff1[_0xdf62('0x11')],'source':_0x159ff1[_0xdf62('0xe')],'destination':_0x159ff1['exten'],'destinationcontext':_0x159ff1[_0xdf62('0x1b')],'channel':_0x159ff1[_0xdf62('0xb')],'starttime':utils[_0xdf62('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdf62('0x3'),'amaflags':_0xdf62('0x1d')};}}catch(_0xaf57ab){utils['error'](util[_0xdf62('0x19')](_0xdf62('0x1e'),_0x159ff1[_0xdf62('0x7')]),_0xaf57ab);}};exports['newstate']=function(_0x589429){try{utils[_0xdf62('0x16')](util[_0xdf62('0x19')](_0xdf62('0x1f'),_0x589429[_0xdf62('0x7')]),_0x589429);if(!_[_0xdf62('0x20')](channels[_0x589429[_0xdf62('0x7')]])&&_0x589429['channelstate']==0x6){utils[_0xdf62('0x9')](util[_0xdf62('0x19')](_0xdf62('0x21'),_0x589429[_0xdf62('0x7')],_0x589429['context'],_0x589429[_0xdf62('0xb')]));if(_[_0xdf62('0x20')](channels[_0x589429[_0xdf62('0x7')]][_0xdf62('0x22')])){channels[_0x589429['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_['isNil'](channels[_0x589429[_0xdf62('0x17')]])&&_0x589429['channelstate']==0x6&&_0x589429[_0xdf62('0x1b')]!=_0xdf62('0x23')){utils[_0xdf62('0x9')](util[_0xdf62('0x19')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x589429['uniqueid'],_0x589429[_0xdf62('0x17')],_0x589429[_0xdf62('0x1b')],_0x589429[_0xdf62('0xb')]));channels[_0x589429[_0xdf62('0x17')]]['accountcode']=_0x589429[_0xdf62('0x11')];channels[_0x589429[_0xdf62('0x17')]][_0xdf62('0x24')]=_0x589429[_0xdf62('0xb')];if(_[_0xdf62('0x20')](channels[_0x589429[_0xdf62('0x17')]][_0xdf62('0x25')])){channels[_0x589429[_0xdf62('0x17')]][_0xdf62('0x25')]=utils[_0xdf62('0x1c')]();}channels[_0x589429[_0xdf62('0x17')]][_0xdf62('0x26')]=dispositions[_[_0xdf62('0x27')](_0x589429[_0xdf62('0x28')])]||_0xdf62('0x5');}}catch(_0x5886c9){utils[_0xdf62('0x29')](util[_0xdf62('0x19')](_0xdf62('0x1f'),_0x589429['uniqueid']),_0x5886c9);}};exports[_0xdf62('0x2a')]=function(_0x5d3af6){try{if(!_['isNil'](channels[_0x5d3af6['uniqueid']])){utils[_0xdf62('0x16')](util[_0xdf62('0x19')](_0xdf62('0x2b'),_0x5d3af6[_0xdf62('0x7')]),_0x5d3af6);if(_['isNil'](channels[_0x5d3af6['uniqueid']]['callerid'])){channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x2c')]=_0x5d3af6[_0xdf62('0x2d')]+'\x20<'+_0x5d3af6[_0xdf62('0xe')]+'>';}utils[_0xdf62('0x9')](util['format'](_0xdf62('0x2e'),_0x5d3af6[_0xdf62('0x7')],channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x2c')],_0x5d3af6[_0xdf62('0x2f')]));channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x30')]=utils[_0xdf62('0x1c')]();channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x31')]=utils[_0xdf62('0x32')](channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x30')],channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x33')]);channels[_0x5d3af6[_0xdf62('0x7')]]['billableseconds']=channels[_0x5d3af6[_0xdf62('0x7')]]['answertime']?utils[_0xdf62('0x32')](channels[_0x5d3af6['uniqueid']]['endtime'],channels[_0x5d3af6[_0xdf62('0x7')]][_0xdf62('0x25')]):0x0;writeDB(channels[_0x5d3af6[_0xdf62('0x7')]]);}}catch(_0x5c56a){utils[_0xdf62('0x29')](util[_0xdf62('0x19')]('[%s][calls][hangup]',_0x5d3af6['uniqueid']),_0x5c56a);}};exports[_0xdf62('0x34')]=function(_0x55ca41){try{if(!_[_0xdf62('0x20')](channels[_0x55ca41[_0xdf62('0x35')]])){utils[_0xdf62('0x16')](util['format'](_0xdf62('0x36'),_0x55ca41[_0xdf62('0x37')]),_0x55ca41);if(channels[_0x55ca41[_0xdf62('0x35')]]['channel']==_0x55ca41[_0xdf62('0x38')]){utils['info'](util[_0xdf62('0x19')](_0xdf62('0x39'),_0x55ca41[_0xdf62('0x37')],_0x55ca41[_0xdf62('0x35')],_0x55ca41['secondtransfererchannel']));channels[_0x55ca41[_0xdf62('0x35')]][_0xdf62('0x24')]=_0x55ca41['secondtransfererchannel'];channels[_0x55ca41[_0xdf62('0x35')]][_0xdf62('0x3a')]='_attended';}else if(channels[_0x55ca41['localtwolinkedid']][_0xdf62('0xb')]=_0x55ca41['transfertargetchannel']){utils[_0xdf62('0x9')](util[_0xdf62('0x19')](_0xdf62('0x39'),_0x55ca41['origtransfereruniqueid'],_0x55ca41[_0xdf62('0x35')],_0x55ca41[_0xdf62('0x3b')]));channels[_0x55ca41[_0xdf62('0x35')]]['destinationchannel']=_0x55ca41['origtransfererchannel'];channels[_0x55ca41[_0xdf62('0x35')]]['userfield']=_0xdf62('0x3c');}}}catch(_0x469a38){utils[_0xdf62('0x29')](util[_0xdf62('0x19')]('[%s][calls][attendedtransfer]',_0x55ca41[_0xdf62('0x37')]),_0x469a38);}};exports[_0xdf62('0x3d')]=function(_0x2493b7){try{if(!_[_0xdf62('0x20')](channels[_0x2493b7[_0xdf62('0x7')]])){utils[_0xdf62('0x16')](util[_0xdf62('0x19')]('[%s][calls][musiconholdstart]',_0x2493b7[_0xdf62('0x7')]),_0x2493b7);channels[_0x2493b7[_0xdf62('0x7')]][_0xdf62('0x3e')]=utils['now']();utils['info'](util[_0xdf62('0x19')](_0xdf62('0x3f'),_0x2493b7[_0xdf62('0x7')],channels[_0x2493b7[_0xdf62('0x7')]][_0xdf62('0x3e')]));}}catch(_0x128cbc){utils[_0xdf62('0x29')](util[_0xdf62('0x19')](_0xdf62('0x40'),_0x2493b7[_0xdf62('0x7')]),_0x128cbc);}};exports['musiconholdstop']=function(_0x3f01ff){try{if(!_[_0xdf62('0x20')](channels[_0x3f01ff[_0xdf62('0x7')]])){utils[_0xdf62('0x16')](util[_0xdf62('0x19')](_0xdf62('0x41'),_0x3f01ff[_0xdf62('0x7')]),_0x3f01ff);if(!_['isNil'](channels[_0x3f01ff[_0xdf62('0x7')]][_0xdf62('0x3e')])){channels[_0x3f01ff[_0xdf62('0x7')]][_0xdf62('0x42')]+=utils[_0xdf62('0x32')](utils[_0xdf62('0x1c')](),channels[_0x3f01ff[_0xdf62('0x7')]]['musiconholdstartAt']);utils[_0xdf62('0x9')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x3f01ff[_0xdf62('0x7')],channels[_0x3f01ff['uniqueid']][_0xdf62('0x42')]));delete channels[_0x3f01ff[_0xdf62('0x7')]]['musiconholdstartAt'];}}}catch(_0x3c9551){utils[_0xdf62('0x29')](util[_0xdf62('0x19')](_0xdf62('0x41'),_0x3f01ff[_0xdf62('0x7')]),_0x3c9551);}};exports[_0xdf62('0x43')]=function(_0x50f263){try{if(!_[_0xdf62('0x20')](channels[_0x50f263['uniqueid']])){utils['debug'](util[_0xdf62('0x19')](_0xdf62('0x44'),_0x50f263[_0xdf62('0x7')]),_0x50f263);if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')]['xmd-originatecalleridnum'])){utils['info'](util[_0xdf62('0x19')](_0xdf62('0x46'),_0x50f263[_0xdf62('0x7')],_0x50f263['value']));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x47')]=_0x50f263['value'];}if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x48')])){utils[_0xdf62('0x9')](util[_0xdf62('0x19')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x50f263['uniqueid'],_0x50f263[_0xdf62('0x49')]));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x4a')]=_0x50f263[_0xdf62('0x49')];channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x2c')]='\x22'+_0x50f263[_0xdf62('0x49')]+_0xdf62('0x4b')+_0x50f263[_0xdf62('0x49')]+'>';}if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x4c')])||!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x4d')])){utils['info'](util[_0xdf62('0x19')](_0xdf62('0x4e'),_0x50f263[_0xdf62('0x7')],!_[_0xdf62('0x20')](_0x50f263['variable'][_0xdf62('0x4c')])?_0xdf62('0x4c'):_0xdf62('0x4d'),_0x50f263['value']));channels[_0x50f263[_0xdf62('0x7')]]['callerid']=_0x50f263[_0xdf62('0x49')];}if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x4f')])||!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x50')])){utils[_0xdf62('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x50f263['uniqueid'],!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x4f')])?_0xdf62('0x4f'):_0xdf62('0x50'),_0x50f263[_0xdf62('0x49')]));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x51')]=_0xdf62('0x52');channels[_0x50f263[_0xdf62('0x7')]]['lastdata']=_0x50f263[_0xdf62('0x49')];channels[_0x50f263['uniqueid']][_0xdf62('0x53')]=!![];}if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')]['xmd-contactid'])){utils['info'](util[_0xdf62('0x19')](_0xdf62('0x54'),_0x50f263[_0xdf62('0x7')],_0x50f263[_0xdf62('0x49')]));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x55')]=_0x50f263[_0xdf62('0x49')];}if(!_['isNil'](_0x50f263[_0xdf62('0x45')][_0xdf62('0x56')])){utils[_0xdf62('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x50f263['uniqueid'],_0x50f263['value']));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x57')]=_0x50f263[_0xdf62('0x49')];}if(!_[_0xdf62('0x20')](_0x50f263['variable']['outboundrouteid'])){utils[_0xdf62('0x9')](util['format'](_0xdf62('0x58'),_0x50f263['uniqueid'],_0x50f263['value']));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x59')]=_0x50f263[_0xdf62('0x49')];}if(!_[_0xdf62('0x20')](_0x50f263[_0xdf62('0x45')][_0xdf62('0x5a')])){utils[_0xdf62('0x9')](util['format'](_0xdf62('0x5b'),_0x50f263['uniqueid'],_0x50f263[_0xdf62('0x49')]));channels[_0x50f263[_0xdf62('0x7')]][_0xdf62('0x5a')]=_0x50f263['value'];}}}catch(_0x5c9c7e){utils[_0xdf62('0x29')](util['format'](_0xdf62('0x44'),_0x50f263['uniqueid']),_0x5c9c7e);}};exports[_0xdf62('0x5c')]=function(_0x125593){try{if(!_['isNil'](channels[_0x125593[_0xdf62('0x7')]])){utils[_0xdf62('0x16')](util[_0xdf62('0x19')](_0xdf62('0x5d'),_0x125593[_0xdf62('0x7')]),_0x125593);utils[_0xdf62('0x9')](util[_0xdf62('0x19')](_0xdf62('0x5e'),_0x125593[_0xdf62('0x7')],_0x125593[_0xdf62('0x5f')],_0x125593[_0xdf62('0x60')]));if(_0x125593[_0xdf62('0x5f')][_0xdf62('0x61')]()=='set'&&_[_0xdf62('0x62')](_0x125593[_0xdf62('0x60')][_0xdf62('0x61')](),_0xdf62('0x63'))){var _0x255d8e=_0x125593[_0xdf62('0x60')]['split']('=');var _0x1ec8b2=_0x255d8e[0x0][_0xdf62('0x64')](_0x255d8e[0x0][_0xdf62('0x65')]('(')+0x1,_0x255d8e[0x0][_0xdf62('0x65')](')'));var _0x12cce9=_0x255d8e[0x1];channels[_0x125593[_0xdf62('0x7')]][_0x1ec8b2]=_0x12cce9;}if(!_[_0xdf62('0x66')]([_0xdf62('0x2a'),'noop',_0xdf62('0x67'),'set',_0xdf62('0x68')],_0x125593['application'][_0xdf62('0x61')]())){channels[_0x125593['uniqueid']][_0xdf62('0x51')]=_0x125593[_0xdf62('0x5f')];channels[_0x125593[_0xdf62('0x7')]]['lastdata']=_0x125593[_0xdf62('0x60')];}}}catch(_0x4423bc){utils[_0xdf62('0x29')](util[_0xdf62('0x19')](_0xdf62('0x5d'),_0x125593[_0xdf62('0x7')]),_0x4423bc);}}; \ No newline at end of file +var _0xd85e=['lastIndexOf','includes','noop','execif','lastapplication','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','systemanswertime','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','duration','diffTime','endtime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','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','split'];(function(_0x5df872,_0x50667a){var _0x1052e9=function(_0x5a3443){while(--_0x5a3443){_0x5df872['push'](_0x5df872['shift']());}};_0x1052e9(++_0x50667a);}(_0xd85e,0x72));var _0xed85=function(_0x299eb0,_0x4896ee){_0x299eb0=_0x299eb0-0x0;var _0x584ed6=_0xd85e[_0x299eb0];return _0x584ed6;};'use strict';var _=require(_0xed85('0x0'));var util=require(_0xed85('0x1'));var utils=require(_0xed85('0x2'));var transfers=require(_0xed85('0x3'));var dispositions=['NO\x20ANSWER','FAILED','FAILED','NO\x20ANSWER',_0xed85('0x4'),_0xed85('0x4'),'ANSWERED','BUSY','FAILED',_0xed85('0x5'),_0xed85('0x5')];var channels={};function writeDB(_0x50ca4b){var _0x801c9c;if(transfers[_0xed85('0x6')][_0x50ca4b[_0xed85('0x7')]]){_0x801c9c=_0x50ca4b['uniqueid'];_0x50ca4b[_0xed85('0x7')]=transfers['blinds'][_0x50ca4b['uniqueid']][_0xed85('0x8')];}utils[_0xed85('0x9')](util[_0xed85('0xa')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x50ca4b['uniqueid'],_0x50ca4b[_0xed85('0xb')],_0x50ca4b['queue'],_0x50ca4b[_0xed85('0xc')],_0x50ca4b['interface'],_0x50ca4b[_0xed85('0xd')],_0x50ca4b[_0xed85('0xe')],_0x50ca4b[_0xed85('0xf')]));if(_0x50ca4b[_0xed85('0x10')]){utils[_0xed85('0x11')](_0x50ca4b[_0xed85('0x10')])[_0xed85('0x12')](function(_0x381602){if(_0x381602){_0x50ca4b[_0xed85('0x13')]=_0x381602['id'];}utils[_0xed85('0x14')](_0xed85('0x15'),_0x50ca4b);});}else{utils[_0xed85('0x14')](_0xed85('0x15'),_0x50ca4b);}if(channels[_0x50ca4b['uniqueid']]){delete channels[_0x50ca4b[_0xed85('0x7')]];}else if(_0x801c9c&&channels[_0x801c9c]){if(!transfers[_0xed85('0x6')][_0x801c9c]['recording'])delete transfers[_0xed85('0x6')][_0x801c9c];delete channels[_0x801c9c];}}exports[_0xed85('0x16')]=function(_0x340713){try{utils[_0xed85('0x17')](util[_0xed85('0xa')](_0xed85('0x18'),_0x340713[_0xed85('0x7')]),_0x340713);if(_0x340713[_0xed85('0x7')]==_0x340713[_0xed85('0x19')]&&_0x340713['channel']!='OutgoingSpoolFailed'){utils[_0xed85('0x9')](util['format'](_0xed85('0x1a'),_0x340713[_0xed85('0x7')],_0x340713['context'],_0x340713[_0xed85('0x1b')]));channels[_0x340713[_0xed85('0x7')]]={'uniqueid':_0x340713['uniqueid'],'accountcode':_0x340713['accountcode'],'source':_0x340713[_0xed85('0xd')],'destination':_0x340713[_0xed85('0x1b')],'destinationcontext':_0x340713[_0xed85('0x1c')],'channel':_0x340713[_0xed85('0xb')],'starttime':utils[_0xed85('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xed85('0x4'),'amaflags':_0xed85('0x1e')};}}catch(_0x1c30d9){utils[_0xed85('0x1f')](util[_0xed85('0xa')](_0xed85('0x18'),_0x340713['uniqueid']),_0x1c30d9);}};exports[_0xed85('0x20')]=function(_0x17ba71){try{utils[_0xed85('0x17')](util[_0xed85('0xa')](_0xed85('0x21'),_0x17ba71[_0xed85('0x7')]),_0x17ba71);if(!_['isNil'](channels[_0x17ba71[_0xed85('0x7')]])&&_0x17ba71[_0xed85('0x22')]==0x6){utils[_0xed85('0x9')](util[_0xed85('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x17ba71[_0xed85('0x7')],_0x17ba71[_0xed85('0x1c')],_0x17ba71[_0xed85('0xb')]));if(_['isNil'](channels[_0x17ba71[_0xed85('0x7')]][_0xed85('0x23')])){channels[_0x17ba71[_0xed85('0x7')]]['systemanswertime']=utils[_0xed85('0x1d')]();}}else if(!_[_0xed85('0x24')](channels[_0x17ba71[_0xed85('0x19')]])&&_0x17ba71[_0xed85('0x22')]==0x6&&_0x17ba71[_0xed85('0x1c')]!=_0xed85('0x25')){utils['info'](util[_0xed85('0xa')](_0xed85('0x26'),_0x17ba71[_0xed85('0x7')],_0x17ba71[_0xed85('0x19')],_0x17ba71['context'],_0x17ba71['channel']));channels[_0x17ba71[_0xed85('0x19')]][_0xed85('0x10')]=_0x17ba71[_0xed85('0x10')];channels[_0x17ba71[_0xed85('0x19')]][_0xed85('0x27')]=_0x17ba71[_0xed85('0xb')];if(_[_0xed85('0x24')](channels[_0x17ba71[_0xed85('0x19')]][_0xed85('0x28')])){channels[_0x17ba71[_0xed85('0x19')]][_0xed85('0x28')]=utils[_0xed85('0x1d')]();}channels[_0x17ba71[_0xed85('0x19')]][_0xed85('0x29')]=dispositions[_[_0xed85('0x2a')](_0x17ba71[_0xed85('0x22')])]||_0xed85('0x2b');}}catch(_0x53bb7e){utils[_0xed85('0x1f')](util[_0xed85('0xa')]('[%s][calls][newstate]',_0x17ba71[_0xed85('0x7')]),_0x53bb7e);}};exports[_0xed85('0x2c')]=function(_0x313863){try{if(!_['isNil'](channels[_0x313863[_0xed85('0x7')]])){utils[_0xed85('0x17')](util[_0xed85('0xa')](_0xed85('0x2d'),_0x313863[_0xed85('0x7')]),_0x313863);if(_[_0xed85('0x24')](channels[_0x313863[_0xed85('0x7')]]['callerid'])){channels[_0x313863['uniqueid']][_0xed85('0x2e')]=_0x313863[_0xed85('0x2f')]+'\x20<'+_0x313863[_0xed85('0xd')]+'>';}utils[_0xed85('0x9')](util[_0xed85('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x313863[_0xed85('0x7')],channels[_0x313863[_0xed85('0x7')]][_0xed85('0x2e')],_0x313863[_0xed85('0x30')]));channels[_0x313863[_0xed85('0x7')]]['endtime']=utils[_0xed85('0x1d')]();channels[_0x313863[_0xed85('0x7')]][_0xed85('0x31')]=utils[_0xed85('0x32')](channels[_0x313863[_0xed85('0x7')]][_0xed85('0x33')],channels[_0x313863[_0xed85('0x7')]][_0xed85('0x34')]);channels[_0x313863[_0xed85('0x7')]]['billableseconds']=channels[_0x313863[_0xed85('0x7')]][_0xed85('0x28')]?utils['diffTime'](channels[_0x313863['uniqueid']][_0xed85('0x33')],channels[_0x313863[_0xed85('0x7')]][_0xed85('0x28')]):0x0;writeDB(channels[_0x313863['uniqueid']]);}}catch(_0x583444){utils[_0xed85('0x1f')](util['format']('[%s][calls][hangup]',_0x313863[_0xed85('0x7')]),_0x583444);}};exports[_0xed85('0x35')]=function(_0x3eb417){try{if(!_[_0xed85('0x24')](channels[_0x3eb417[_0xed85('0x36')]])){utils[_0xed85('0x17')](util[_0xed85('0xa')](_0xed85('0x37'),_0x3eb417[_0xed85('0x38')]),_0x3eb417);if(channels[_0x3eb417[_0xed85('0x36')]][_0xed85('0xb')]==_0x3eb417['transfereechannel']){utils['info'](util[_0xed85('0xa')](_0xed85('0x39'),_0x3eb417[_0xed85('0x38')],_0x3eb417[_0xed85('0x36')],_0x3eb417[_0xed85('0x3a')]));channels[_0x3eb417[_0xed85('0x36')]]['destinationchannel']=_0x3eb417['secondtransfererchannel'];channels[_0x3eb417['localtwolinkedid']][_0xed85('0x3b')]=_0xed85('0x3c');}else if(channels[_0x3eb417[_0xed85('0x36')]][_0xed85('0xb')]=_0x3eb417[_0xed85('0x3d')]){utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x39'),_0x3eb417['origtransfereruniqueid'],_0x3eb417['localtwolinkedid'],_0x3eb417[_0xed85('0x3e')]));channels[_0x3eb417['localtwolinkedid']][_0xed85('0x27')]=_0x3eb417[_0xed85('0x3e')];channels[_0x3eb417[_0xed85('0x36')]]['userfield']=_0xed85('0x3c');}}}catch(_0x404cd0){utils[_0xed85('0x1f')](util['format']('[%s][calls][attendedtransfer]',_0x3eb417[_0xed85('0x38')]),_0x404cd0);}};exports[_0xed85('0x3f')]=function(_0x4346ce){try{if(!_['isNil'](channels[_0x4346ce['uniqueid']])){utils['debug'](util[_0xed85('0xa')](_0xed85('0x40'),_0x4346ce[_0xed85('0x7')]),_0x4346ce);channels[_0x4346ce['uniqueid']][_0xed85('0x41')]=utils['now']();utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x42'),_0x4346ce[_0xed85('0x7')],channels[_0x4346ce[_0xed85('0x7')]][_0xed85('0x41')]));}}catch(_0x568548){utils[_0xed85('0x1f')](util['format']('[%s][calls][musiconholdstart]',_0x4346ce['uniqueid']),_0x568548);}};exports[_0xed85('0x43')]=function(_0x13349b){try{if(!_['isNil'](channels[_0x13349b['uniqueid']])){utils[_0xed85('0x17')](util['format'](_0xed85('0x44'),_0x13349b[_0xed85('0x7')]),_0x13349b);if(!_[_0xed85('0x24')](channels[_0x13349b[_0xed85('0x7')]]['musiconholdstartAt'])){channels[_0x13349b[_0xed85('0x7')]][_0xed85('0x45')]+=utils[_0xed85('0x32')](utils[_0xed85('0x1d')](),channels[_0x13349b[_0xed85('0x7')]][_0xed85('0x41')]);utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x46'),_0x13349b[_0xed85('0x7')],channels[_0x13349b[_0xed85('0x7')]]['mohtime']));delete channels[_0x13349b[_0xed85('0x7')]][_0xed85('0x41')];}}}catch(_0x5049b4){utils[_0xed85('0x1f')](util[_0xed85('0xa')](_0xed85('0x44'),_0x13349b[_0xed85('0x7')]),_0x5049b4);}};exports[_0xed85('0x47')]=function(_0x171f39){try{if(!_[_0xed85('0x24')](channels[_0x171f39[_0xed85('0x7')]])){utils['debug'](util[_0xed85('0xa')](_0xed85('0x48'),_0x171f39[_0xed85('0x7')]),_0x171f39);if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x4a')])){utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x4b'),_0x171f39[_0xed85('0x7')],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x4d')]=_0x171f39['value'];}if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x4e')])){utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x4f'),_0x171f39['uniqueid'],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]]['destination']=_0x171f39['value'];channels[_0x171f39['uniqueid']][_0xed85('0x2e')]='\x22'+_0x171f39[_0xed85('0x4c')]+'\x22\x20<'+_0x171f39[_0xed85('0x4c')]+'>';}if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x50')])||!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x51')])){utils['info'](util[_0xed85('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x171f39[_0xed85('0x7')],!_['isNil'](_0x171f39[_0xed85('0x49')][_0xed85('0x50')])?_0xed85('0x50'):'xmd-callerid',_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x2e')]=_0x171f39[_0xed85('0x4c')];}if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')]['xmd-queue'])||!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x52')])){utils[_0xed85('0x9')](util['format'](_0xed85('0x53'),_0x171f39[_0xed85('0x7')],!_['isNil'](_0x171f39[_0xed85('0x49')][_0xed85('0x54')])?_0xed85('0x54'):_0xed85('0x52'),_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]]['lastapplication']=_0xed85('0x55');channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x56')]=_0x171f39[_0xed85('0x4c')];channels[_0x171f39[_0xed85('0x7')]]['queue']=!![];}if(!_['isNil'](_0x171f39[_0xed85('0x49')]['xmd-contactid'])){utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x57'),_0x171f39['uniqueid'],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x58')]=_0x171f39['value'];}if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x59')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x171f39[_0xed85('0x7')],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39['uniqueid']][_0xed85('0x5a')]=_0x171f39[_0xed85('0x4c')];}if(!_['isNil'](_0x171f39[_0xed85('0x49')][_0xed85('0x5b')])){utils[_0xed85('0x9')](util[_0xed85('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x171f39['uniqueid'],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x5c')]=_0x171f39[_0xed85('0x4c')];}if(!_[_0xed85('0x24')](_0x171f39[_0xed85('0x49')][_0xed85('0x5d')])){utils['info'](util[_0xed85('0xa')](_0xed85('0x5e'),_0x171f39[_0xed85('0x7')],_0x171f39[_0xed85('0x4c')]));channels[_0x171f39[_0xed85('0x7')]][_0xed85('0x5d')]=_0x171f39['value'];}}}catch(_0x148a68){utils[_0xed85('0x1f')](util[_0xed85('0xa')](_0xed85('0x48'),_0x171f39[_0xed85('0x7')]),_0x148a68);}};exports[_0xed85('0x5f')]=function(_0xcec038){try{if(!_[_0xed85('0x24')](channels[_0xcec038['uniqueid']])){utils['debug'](util['format'](_0xed85('0x60'),_0xcec038[_0xed85('0x7')]),_0xcec038);utils[_0xed85('0x9')](util[_0xed85('0xa')](_0xed85('0x61'),_0xcec038[_0xed85('0x7')],_0xcec038[_0xed85('0x62')],_0xcec038[_0xed85('0x63')]));if(_0xcec038[_0xed85('0x62')][_0xed85('0x64')]()==_0xed85('0x65')&&_[_0xed85('0x66')](_0xcec038[_0xed85('0x63')][_0xed85('0x64')](),'cdr')){var _0x11bc66=_0xcec038[_0xed85('0x63')][_0xed85('0x67')]('=');var _0x38c0d0=_0x11bc66[0x0]['substring'](_0x11bc66[0x0][_0xed85('0x68')]('(')+0x1,_0x11bc66[0x0]['lastIndexOf'](')'));var _0x546ed6=_0x11bc66[0x1];channels[_0xcec038[_0xed85('0x7')]][_0x38c0d0]=_0x546ed6;}if(!_[_0xed85('0x69')]([_0xed85('0x2c'),_0xed85('0x6a'),_0xed85('0x6b'),_0xed85('0x65'),'gotoif'],_0xcec038[_0xed85('0x62')][_0xed85('0x64')]())){channels[_0xcec038[_0xed85('0x7')]][_0xed85('0x6c')]=_0xcec038['application'];channels[_0xcec038[_0xed85('0x7')]][_0xed85('0x56')]=_0xcec038[_0xed85('0x63')];}}}catch(_0x4a77c4){utils[_0xed85('0x1f')](util[_0xed85('0xa')](_0xed85('0x60'),_0xcec038[_0xed85('0x7')]),_0x4a77c4);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index da690b0..1a809ad 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 _0xf435=['managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0xe88a66,_0x2fbd2e){var _0xcfe206=function(_0x428675){while(--_0x428675){_0xe88a66['push'](_0xe88a66['shift']());}};_0xcfe206(++_0x2fbd2e);}(_0xf435,0x115));var _0x5f43=function(_0x522e3b,_0x31f192){_0x522e3b=_0x522e3b-0x0;var _0x552b7d=_0xf435[_0x522e3b];return _0x552b7d;};'use strict';var utils=require(_0x5f43('0x0'));exports[_0x5f43('0x1')]=function(){utils['info'](_0x5f43('0x2'));};exports[_0x5f43('0x3')]=function(){utils[_0x5f43('0x4')](_0x5f43('0x5'));};exports[_0x5f43('0x6')]=function(){utils[_0x5f43('0x4')](_0x5f43('0x7'));};exports[_0x5f43('0x8')]=function(_0x36e791){utils[_0x5f43('0x8')](_0x5f43('0x9'),_0x36e791);};exports[_0x5f43('0xa')]=function(){utils[_0x5f43('0x4')]('[core]\x20close');};exports[_0x5f43('0xb')]=function(_0x3903c2){}; \ No newline at end of file +var _0xded7=['error','[core]\x20error','close','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x37be00,_0x45514d){var _0x12b45f=function(_0x400632){while(--_0x400632){_0x37be00['push'](_0x37be00['shift']());}};_0x12b45f(++_0x45514d);}(_0xded7,0x18f));var _0x7ded=function(_0x3e080e,_0x56d2e6){_0x3e080e=_0x3e080e-0x0;var _0x3bff6f=_0xded7[_0x3e080e];return _0x3bff6f;};'use strict';var utils=require('./utils');exports[_0x7ded('0x0')]=function(){utils[_0x7ded('0x1')](_0x7ded('0x2'));};exports[_0x7ded('0x3')]=function(){utils[_0x7ded('0x1')](_0x7ded('0x4'));};exports['fullybooted']=function(){utils[_0x7ded('0x1')](_0x7ded('0x5'));};exports['error']=function(_0x34058e){utils[_0x7ded('0x6')](_0x7ded('0x7'),_0x34058e);};exports[_0x7ded('0x8')]=function(){utils[_0x7ded('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x2abd50){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index bce85cb..beaf701 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 _0x49b7=['startsWith','split','error','varset','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','toLowerCase','set'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x49b7,0x126));var _0x749b=function(_0x2d892a,_0x59e61a){_0x2d892a=_0x2d892a-0x0;var _0x367765=_0x49b7[_0x2d892a];return _0x367765;};'use strict';var _=require(_0x749b('0x0'));var util=require(_0x749b('0x1'));var utils=require(_0x749b('0x2'));var dials={};function writeDB(_0xf51463){utils[_0x749b('0x3')](util[_0x749b('0x4')](_0x749b('0x5'),_0xf51463[_0x749b('0x6')],_0xf51463[_0x749b('0x7')],_0xf51463[_0x749b('0x8')],_0xf51463['calleridnum'],_0xf51463[_0x749b('0x9')],_0xf51463[_0x749b('0xa')]));utils['request'](_0x749b('0xb'),_0xf51463);delete dials[_0xf51463[_0x749b('0x6')]];}exports['newexten']=function(_0x52cfc7){try{utils[_0x749b('0xc')](util['format'](_0x749b('0xd'),_0x52cfc7[_0x749b('0x6')]),_0x52cfc7);utils[_0x749b('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x52cfc7[_0x749b('0x6')],_0x52cfc7[_0x749b('0xe')],_0x52cfc7[_0x749b('0xf')]));if(_0x52cfc7[_0x749b('0xe')][_0x749b('0x10')]()==_0x749b('0x11')&&_[_0x749b('0x12')](_0x52cfc7[_0x749b('0xf')][_0x749b('0x10')](),'cdr(routeid)')){var _0x41f0ba=_0x52cfc7['appdata'][_0x749b('0x13')]('=');dials[_0x52cfc7[_0x749b('0x6')]]={'routeId':_0x41f0ba[0x1]};}}catch(_0x16b298){utils[_0x749b('0x14')](util[_0x749b('0x4')](_0x749b('0xd'),_0x52cfc7['uniqueid']),_0x16b298);}};exports[_0x749b('0x15')]=function(_0x3cf5bb){try{utils[_0x749b('0xc')](util[_0x749b('0x4')](_0x749b('0x16'),_0x3cf5bb[_0x749b('0x6')]),_0x3cf5bb);if(!_['isNil'](_0x3cf5bb['variable']['outboundrouteid'])){utils['info'](util['format'](_0x749b('0x17'),_0x3cf5bb[_0x749b('0x6')],_0x3cf5bb[_0x749b('0x18')]));dials[_0x3cf5bb[_0x749b('0x6')]]={'routeId':_0x3cf5bb[_0x749b('0x18')]};}}catch(_0x588089){utils[_0x749b('0x14')](util[_0x749b('0x4')](_0x749b('0x16'),_0x3cf5bb['uniqueid']),_0x588089);}};exports[_0x749b('0x19')]=function(_0x212ace){try{if(!_[_0x749b('0x1a')](dials[_0x212ace[_0x749b('0x6')]])){utils[_0x749b('0xc')](util[_0x749b('0x4')](_0x749b('0x1b'),_0x212ace['uniqueid']),_0x212ace);dials[_0x212ace['uniqueid']]=_['assign'](dials[_0x212ace[_0x749b('0x6')]],_0x212ace);dials[_0x212ace['uniqueid']][_0x749b('0x1c')]=utils[_0x749b('0x1d')]();dials[_0x212ace[_0x749b('0x6')]][_0x749b('0x1e')]=_0x749b('0x1f');utils[_0x749b('0x3')](util[_0x749b('0x4')](_0x749b('0x20'),_0x212ace[_0x749b('0x6')],dials[_0x212ace[_0x749b('0x6')]][_0x749b('0x1c')]));}}catch(_0x130cef){utils['error'](util['format'](_0x749b('0x1b'),_0x212ace[_0x749b('0x6')]),_0x130cef);}};exports[_0x749b('0x21')]=function(_0x3e85ae){try{if(!_['isNil'](dials[_0x3e85ae[_0x749b('0x6')]])){utils[_0x749b('0xc')](util[_0x749b('0x4')](_0x749b('0x22'),_0x3e85ae[_0x749b('0x6')]),_0x3e85ae);dials[_0x3e85ae[_0x749b('0x6')]][_0x749b('0xa')]=_0x3e85ae[_0x749b('0xa')];if(_0x3e85ae['dialstatus']==_0x749b('0x23')){dials[_0x3e85ae['uniqueid']]=_[_0x749b('0x24')](dials[_0x3e85ae['uniqueid']],_0x3e85ae);dials[_0x3e85ae['uniqueid']][_0x749b('0x25')]=utils[_0x749b('0x1d')]();dials[_0x3e85ae[_0x749b('0x6')]][_0x749b('0x1e')]=_0x749b('0x26');utils[_0x749b('0x3')](util['format'](_0x749b('0x27'),_0x3e85ae['uniqueid'],_0x3e85ae['dialstatus'],dials[_0x3e85ae[_0x749b('0x6')]][_0x749b('0x25')]));}else{utils[_0x749b('0x3')](util[_0x749b('0x4')](_0x749b('0x28'),_0x3e85ae['uniqueid'],_0x3e85ae[_0x749b('0xa')]));}}}catch(_0x3e3947){utils[_0x749b('0x14')](util[_0x749b('0x4')](_0x749b('0x22'),_0x3e85ae[_0x749b('0x6')]),_0x3e3947);}};exports[_0x749b('0x29')]=function(_0x49c2e7){try{if(!_[_0x749b('0x1a')](dials[_0x49c2e7['uniqueid']])){utils[_0x749b('0xc')](util[_0x749b('0x4')](_0x749b('0x2a'),_0x49c2e7[_0x749b('0x6')]),_0x49c2e7);utils[_0x749b('0x3')](util['format'](_0x749b('0x2b'),_0x49c2e7[_0x749b('0x6')],_0x49c2e7['calleridnum'],_0x49c2e7[_0x749b('0x2c')],_0x49c2e7[_0x749b('0x2d')]));dials[_0x49c2e7[_0x749b('0x6')]]=_[_0x749b('0x24')](dials[_0x49c2e7[_0x749b('0x6')]],{'endtime':utils['now'](),'lastevent':_0x749b('0x2e')});dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x2f')]=utils[_0x749b('0x30')](dials[_0x49c2e7['uniqueid']][_0x749b('0x31')],dials[_0x49c2e7['uniqueid']]['starttime']);dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x32')]=utils[_0x749b('0x30')](dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x25')]||dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x31')],dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x1c')]);dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x33')]=dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x25')]?utils[_0x749b('0x30')](dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x31')],dials[_0x49c2e7[_0x749b('0x6')]][_0x749b('0x25')]):0x0;writeDB(dials[_0x49c2e7[_0x749b('0x6')]]);}}catch(_0x5a3cd9){utils[_0x749b('0x14')](util[_0x749b('0x4')](_0x749b('0x2a'),_0x49c2e7[_0x749b('0x6')]),_0x5a3cd9);}}; \ No newline at end of file +var _0xad23=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','endtime','diffTime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','split','error','varset','debug','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','answertime','hangup'];(function(_0x22254d,_0x20edb6){var _0x5a56e2=function(_0x3269ca){while(--_0x3269ca){_0x22254d['push'](_0x22254d['shift']());}};_0x5a56e2(++_0x20edb6);}(_0xad23,0x16e));var _0x3ad2=function(_0x4b256e,_0x3aaaaa){_0x4b256e=_0x4b256e-0x0;var _0x3d2736=_0xad23[_0x4b256e];return _0x3d2736;};'use strict';var _=require(_0x3ad2('0x0'));var util=require(_0x3ad2('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x167354){utils[_0x3ad2('0x2')](util[_0x3ad2('0x3')](_0x3ad2('0x4'),_0x167354['uniqueid'],_0x167354[_0x3ad2('0x5')],_0x167354[_0x3ad2('0x6')],_0x167354[_0x3ad2('0x7')],_0x167354[_0x3ad2('0x8')],_0x167354[_0x3ad2('0x9')]));utils[_0x3ad2('0xa')](_0x3ad2('0xb'),_0x167354);delete dials[_0x167354['uniqueid']];}exports['newexten']=function(_0x34c835){try{utils['debug'](util[_0x3ad2('0x3')](_0x3ad2('0xc'),_0x34c835[_0x3ad2('0xd')]),_0x34c835);utils[_0x3ad2('0x2')](util[_0x3ad2('0x3')](_0x3ad2('0xe'),_0x34c835['uniqueid'],_0x34c835['application'],_0x34c835[_0x3ad2('0xf')]));if(_0x34c835[_0x3ad2('0x10')][_0x3ad2('0x11')]()=='set'&&_['startsWith'](_0x34c835[_0x3ad2('0xf')][_0x3ad2('0x11')](),'cdr(routeid)')){var _0x37fdeb=_0x34c835['appdata'][_0x3ad2('0x12')]('=');dials[_0x34c835[_0x3ad2('0xd')]]={'routeId':_0x37fdeb[0x1]};}}catch(_0x2105fa){utils[_0x3ad2('0x13')](util[_0x3ad2('0x3')]('[%s][dials][newexten]',_0x34c835[_0x3ad2('0xd')]),_0x2105fa);}};exports[_0x3ad2('0x14')]=function(_0x40e4bb){try{utils[_0x3ad2('0x15')](util[_0x3ad2('0x3')](_0x3ad2('0x16'),_0x40e4bb['uniqueid']),_0x40e4bb);if(!_['isNil'](_0x40e4bb[_0x3ad2('0x17')][_0x3ad2('0x18')])){utils['info'](util[_0x3ad2('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x40e4bb[_0x3ad2('0xd')],_0x40e4bb['value']));dials[_0x40e4bb[_0x3ad2('0xd')]]={'routeId':_0x40e4bb[_0x3ad2('0x19')]};}}catch(_0x678d42){utils[_0x3ad2('0x13')](util['format'](_0x3ad2('0x16'),_0x40e4bb[_0x3ad2('0xd')]),_0x678d42);}};exports[_0x3ad2('0x1a')]=function(_0xd036df){try{if(!_['isNil'](dials[_0xd036df['uniqueid']])){utils[_0x3ad2('0x15')](util[_0x3ad2('0x3')](_0x3ad2('0x1b'),_0xd036df[_0x3ad2('0xd')]),_0xd036df);dials[_0xd036df[_0x3ad2('0xd')]]=_[_0x3ad2('0x1c')](dials[_0xd036df[_0x3ad2('0xd')]],_0xd036df);dials[_0xd036df[_0x3ad2('0xd')]][_0x3ad2('0x1d')]=utils[_0x3ad2('0x1e')]();dials[_0xd036df[_0x3ad2('0xd')]][_0x3ad2('0x1f')]=_0x3ad2('0x20');utils[_0x3ad2('0x2')](util[_0x3ad2('0x3')](_0x3ad2('0x21'),_0xd036df[_0x3ad2('0xd')],dials[_0xd036df[_0x3ad2('0xd')]][_0x3ad2('0x1d')]));}}catch(_0x4402b1){utils[_0x3ad2('0x13')](util['format'](_0x3ad2('0x1b'),_0xd036df[_0x3ad2('0xd')]),_0x4402b1);}};exports[_0x3ad2('0x22')]=function(_0x307c47){try{if(!_[_0x3ad2('0x23')](dials[_0x307c47[_0x3ad2('0xd')]])){utils[_0x3ad2('0x15')](util[_0x3ad2('0x3')](_0x3ad2('0x24'),_0x307c47[_0x3ad2('0xd')]),_0x307c47);dials[_0x307c47[_0x3ad2('0xd')]][_0x3ad2('0x9')]=_0x307c47[_0x3ad2('0x9')];if(_0x307c47['dialstatus']=='ANSWER'){dials[_0x307c47[_0x3ad2('0xd')]]=_[_0x3ad2('0x1c')](dials[_0x307c47['uniqueid']],_0x307c47);dials[_0x307c47['uniqueid']][_0x3ad2('0x25')]=utils[_0x3ad2('0x1e')]();dials[_0x307c47[_0x3ad2('0xd')]][_0x3ad2('0x1f')]='connect';utils[_0x3ad2('0x2')](util[_0x3ad2('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x307c47[_0x3ad2('0xd')],_0x307c47[_0x3ad2('0x9')],dials[_0x307c47[_0x3ad2('0xd')]][_0x3ad2('0x25')]));}else{utils['info'](util[_0x3ad2('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x307c47['uniqueid'],_0x307c47[_0x3ad2('0x9')]));}}}catch(_0x3e7420){utils['error'](util[_0x3ad2('0x3')](_0x3ad2('0x24'),_0x307c47['uniqueid']),_0x3e7420);}};exports[_0x3ad2('0x26')]=function(_0x4e5d0d){try{if(!_[_0x3ad2('0x23')](dials[_0x4e5d0d[_0x3ad2('0xd')]])){utils[_0x3ad2('0x15')](util[_0x3ad2('0x3')](_0x3ad2('0x27'),_0x4e5d0d[_0x3ad2('0xd')]),_0x4e5d0d);utils[_0x3ad2('0x2')](util[_0x3ad2('0x3')](_0x3ad2('0x28'),_0x4e5d0d['uniqueid'],_0x4e5d0d[_0x3ad2('0x7')],_0x4e5d0d[_0x3ad2('0x29')],_0x4e5d0d['cause-txt']));dials[_0x4e5d0d[_0x3ad2('0xd')]]=_[_0x3ad2('0x1c')](dials[_0x4e5d0d['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x3ad2('0x2a')});dials[_0x4e5d0d[_0x3ad2('0xd')]]['duration']=utils['diffTime'](dials[_0x4e5d0d['uniqueid']][_0x3ad2('0x2b')],dials[_0x4e5d0d[_0x3ad2('0xd')]][_0x3ad2('0x1d')]);dials[_0x4e5d0d[_0x3ad2('0xd')]]['holdtime']=utils[_0x3ad2('0x2c')](dials[_0x4e5d0d[_0x3ad2('0xd')]]['answertime']||dials[_0x4e5d0d[_0x3ad2('0xd')]]['endtime'],dials[_0x4e5d0d[_0x3ad2('0xd')]]['starttime']);dials[_0x4e5d0d[_0x3ad2('0xd')]]['billableseconds']=dials[_0x4e5d0d[_0x3ad2('0xd')]][_0x3ad2('0x25')]?utils['diffTime'](dials[_0x4e5d0d[_0x3ad2('0xd')]][_0x3ad2('0x2b')],dials[_0x4e5d0d[_0x3ad2('0xd')]]['answertime']):0x0;writeDB(dials[_0x4e5d0d[_0x3ad2('0xd')]]);}}catch(_0x4804da){utils[_0x3ad2('0x13')](util[_0x3ad2('0x3')](_0x3ad2('0x27'),_0x4e5d0d['uniqueid']),_0x4804da);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b27b33a..0c3bcdd 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 _0x91a0=['devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x91a0,0x105));var _0x091a=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x91a0[_0x68ee8b];return _0x5148f7;};var AsteriskManager=require(_0x091a('0x0'));var config=require(_0x091a('0x1'));var utils=require(_0x091a('0x2'));var util=require(_0x091a('0x3'));var isXDREnabled=config['xdr']&&config[_0x091a('0x4')]['disabled']?!config[_0x091a('0x4')][_0x091a('0x5')]:!![];var isProduction=config[_0x091a('0x6')]===_0x091a('0x7')||![];var isLocalAsterisk=config[_0x091a('0x4')]&&config[_0x091a('0x4')][_0x091a('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0x091a('0x9')]['ip'],config[_0x091a('0x9')][_0x091a('0xa')],config[_0x091a('0x9')]['password'],!![]);ami[_0x091a('0xb')]();if(!isXDREnabled){utils[_0x091a('0xc')](_0x091a('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x091a('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x091a('0xe'));var queues=require(_0x091a('0xf'));var recordings=require(_0x091a('0x10'));var members=require(_0x091a('0x11'));var dials=require(_0x091a('0x12'));var transfers=require(_0x091a('0x13'));var core=require(_0x091a('0x14'));ami['on'](_0x091a('0x15'),core[_0x091a('0x15')]);ami['on'](_0x091a('0x16'),core[_0x091a('0x16')]);ami['on'](_0x091a('0x17'),core['fullybooted']);ami['on'](_0x091a('0x18'),core[_0x091a('0x18')]);ami['on']('close',core[_0x091a('0x19')]);ami['on']('managerevent',core[_0x091a('0x1a')]);ami['on'](_0x091a('0x1b'),function(_0x1cac9e){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x1e'),_0x1cac9e[_0x091a('0x1f')]),_0x1cac9e);members['devicestatechange'](_0x1cac9e);}catch(_0x44d009){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x1e'),_0x1cac9e[_0x091a('0x1f')]),_0x44d009);}});ami['on'](_0x091a('0x20'),function(_0xd587a){try{utils['debug'](util[_0x091a('0x1d')]('[%s][index][agentcalled]',_0xd587a[_0x091a('0x21')]),_0xd587a);agents[_0x091a('0x20')](_0xd587a);}catch(_0x3d5c59){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x22'),_0xd587a[_0x091a('0x21')]),_0x3d5c59);}});ami['on']('agentringnoanswer',function(_0x1310d3){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x23'),_0x1310d3[_0x091a('0x21')]),_0x1310d3);agents['agentringnoanswer'](_0x1310d3);}catch(_0x2b8051){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x23'),_0x1310d3[_0x091a('0x21')]),_0x2b8051);}});ami['on']('agentconnect',function(_0x1c329e){try{utils['debug'](util[_0x091a('0x1d')](_0x091a('0x24'),_0x1c329e[_0x091a('0x21')]),_0x1c329e);agents[_0x091a('0x25')](_0x1c329e);queues[_0x091a('0x25')](_0x1c329e);}catch(_0x35e380){utils[_0x091a('0x18')](util['format'](_0x091a('0x24'),_0x1c329e['uniqueid']),_0x35e380);}});ami['on'](_0x091a('0x26'),function(_0x16f7bf){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')]('[%s][index][agentcomplete]',_0x16f7bf[_0x091a('0x21')]),_0x16f7bf);agents[_0x091a('0x26')](_0x16f7bf);queues[_0x091a('0x26')](_0x16f7bf);members['agentcomplete'](_0x16f7bf);}catch(_0x12c58b){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x27'),_0x16f7bf['uniqueid']),_0x12c58b);}});ami['on'](_0x091a('0x28'),function(_0x22babc){try{utils[_0x091a('0x1c')](util['format'](_0x091a('0x29'),_0x22babc[_0x091a('0x21')]),_0x22babc);agents[_0x091a('0x28')](_0x22babc);queues[_0x091a('0x28')](_0x22babc);}catch(_0x39d515){utils[_0x091a('0x18')](util['format'](_0x091a('0x29'),_0x22babc[_0x091a('0x21')]),_0x39d515);}});ami['on'](_0x091a('0x2a'),function(_0x5e5c14){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')]('[%s][index][queuecallerjoin]',_0x5e5c14[_0x091a('0x21')]),_0x5e5c14);queues[_0x091a('0x2a')](_0x5e5c14);recordings[_0x091a('0x2a')](_0x5e5c14);}catch(_0x9c767f){utils['error'](util[_0x091a('0x1d')](_0x091a('0x2b'),_0x5e5c14[_0x091a('0x21')]),_0x9c767f);}});ami['on'](_0x091a('0x2c'),function(_0x6766dc){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x2d'),_0x6766dc[_0x091a('0x21')]),_0x6766dc);queues[_0x091a('0x2c')](_0x6766dc);}catch(_0x4c680c){utils[_0x091a('0x18')](util['format'](_0x091a('0x2d'),_0x6766dc[_0x091a('0x21')]),_0x4c680c);}});ami['on'](_0x091a('0x2e'),function(_0x14954d){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x2f'),_0x14954d['uniqueid']),_0x14954d);queues[_0x091a('0x2e')](_0x14954d);calls[_0x091a('0x2e')](_0x14954d);}catch(_0x6d6829){utils[_0x091a('0x18')](util['format'](_0x091a('0x2f'),_0x14954d[_0x091a('0x21')]),_0x6d6829);}});ami['on'](_0x091a('0x30'),function(_0xb82027){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x31'),_0xb82027[_0x091a('0x21')]),_0xb82027);queues[_0x091a('0x30')](_0xb82027);calls[_0x091a('0x30')](_0xb82027);}catch(_0x102cba){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x31'),_0xb82027['uniqueid']),_0x102cba);}});ami['on'](_0x091a('0x32'),function(_0x39ff3c){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x33'),_0x39ff3c[_0x091a('0x21')]),_0x39ff3c);calls['newstate'](_0x39ff3c);recordings['newstate'](_0x39ff3c);}catch(_0x26b7d3){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x33'),_0x39ff3c[_0x091a('0x21')]),_0x26b7d3);}});ami['on'](_0x091a('0x34'),function(_0x4060d6){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x35'),_0x4060d6[_0x091a('0x21')]),_0x4060d6);calls[_0x091a('0x34')](_0x4060d6);recordings[_0x091a('0x34')](_0x4060d6);dials[_0x091a('0x34')](_0x4060d6);agents[_0x091a('0x34')](_0x4060d6);queues[_0x091a('0x34')](_0x4060d6);}catch(_0x334e0e){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x35'),_0x4060d6[_0x091a('0x21')]),_0x334e0e);}});ami['on'](_0x091a('0x36'),function(_0x43916e){try{utils['debug'](util[_0x091a('0x1d')](_0x091a('0x37'),_0x43916e[_0x091a('0x21')]),_0x43916e);members[_0x091a('0x36')](_0x43916e);}catch(_0x55d532){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x37'),_0x43916e[_0x091a('0x21')]),_0x55d532);}});ami['on'](_0x091a('0x38'),function(_0x23fa79){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x39'),_0x23fa79[_0x091a('0x21')]),_0x23fa79);queues['blindtransfer'](_0x23fa79);agents[_0x091a('0x38')](_0x23fa79);transfers[_0x091a('0x38')](_0x23fa79);recordings[_0x091a('0x38')](_0x23fa79);}catch(_0x2461e0){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x39'),_0x23fa79[_0x091a('0x21')]),_0x2461e0);}});ami['on'](_0x091a('0x3a'),function(_0x4c2f3b){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')]('[%s][index][attendedtransfer]',_0x4c2f3b[_0x091a('0x3b')]),_0x4c2f3b);queues['attendedtransfer'](_0x4c2f3b);transfers[_0x091a('0x3a')](_0x4c2f3b);agents['attendedtransfer'](_0x4c2f3b);calls[_0x091a('0x3a')](_0x4c2f3b);}catch(_0x416c0b){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x3c'),_0x4c2f3b[_0x091a('0x3b')]),_0x416c0b);}});ami['on'](_0x091a('0x3d'),function(_0xfc8377){try{utils['debug'](util[_0x091a('0x1d')](_0x091a('0x3e'),_0xfc8377['uniqueid']),_0xfc8377);queues[_0x091a('0x3d')](_0xfc8377);recordings[_0x091a('0x3d')](_0xfc8377);calls[_0x091a('0x3d')](_0xfc8377);dials[_0x091a('0x3d')](_0xfc8377);}catch(_0x569b86){utils[_0x091a('0x18')](util['format']('[%s][index][varset]',_0xfc8377[_0x091a('0x21')]),_0x569b86);}});ami['on'](_0x091a('0x3f'),function(_0x27ed1a){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')]('[%s][index][newexten]',_0x27ed1a[_0x091a('0x21')]),_0x27ed1a);calls['newexten'](_0x27ed1a);recordings[_0x091a('0x3f')](_0x27ed1a);dials[_0x091a('0x3f')](_0x27ed1a);}catch(_0x44c96c){utils['error'](util['format'](_0x091a('0x40'),_0x27ed1a[_0x091a('0x21')]),_0x44c96c);}});ami['on'](_0x091a('0x41'),function(_0x2fee8f){try{utils[_0x091a('0x1c')](util[_0x091a('0x1d')](_0x091a('0x42'),_0x2fee8f[_0x091a('0x21')]),_0x2fee8f);calls['newchannel'](_0x2fee8f);recordings['newchannel'](_0x2fee8f);}catch(_0x25dbd7){utils[_0x091a('0x18')](util['format']('[%s][index][newchannel]',_0x2fee8f[_0x091a('0x21')]),_0x25dbd7);}});ami['on'](_0x091a('0x43'),function(_0x4a0357){try{utils[_0x091a('0x1c')](util['format'](_0x091a('0x44'),_0x4a0357[_0x091a('0x21')]),_0x4a0357);dials[_0x091a('0x43')](_0x4a0357);}catch(_0x5e498a){utils[_0x091a('0x18')](util[_0x091a('0x1d')](_0x091a('0x45'),_0x4a0357[_0x091a('0x21')]),_0x5e498a);}});ami['on'](_0x091a('0x46'),function(_0x4c6bdd){try{utils['debug'](util[_0x091a('0x1d')](_0x091a('0x47'),_0x4c6bdd['uniqueid']),_0x4c6bdd);dials[_0x091a('0x46')](_0x4c6bdd);}catch(_0x915240){utils['error'](util[_0x091a('0x1d')](_0x091a('0x47'),_0x4c6bdd[_0x091a('0x21')]),_0x915240);}});} \ No newline at end of file +var _0x4917=['[%s][index][dialbegin]','dialbegin','dialend','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel'];(function(_0x1ebc6d,_0x946ada){var _0x22f29e=function(_0x5dbdb7){while(--_0x5dbdb7){_0x1ebc6d['push'](_0x1ebc6d['shift']());}};_0x22f29e(++_0x946ada);}(_0x4917,0x157));var _0x7491=function(_0x17b53e,_0x46402f){_0x17b53e=_0x17b53e-0x0;var _0x55e839=_0x4917[_0x17b53e];return _0x55e839;};var AsteriskManager=require('asterisk-manager');var config=require(_0x7491('0x0'));var utils=require(_0x7491('0x1'));var util=require('util');var isXDREnabled=config[_0x7491('0x2')]&&config[_0x7491('0x2')][_0x7491('0x3')]?!config[_0x7491('0x2')][_0x7491('0x3')]:!![];var isProduction=config[_0x7491('0x4')]===_0x7491('0x5')||![];var isLocalAsterisk=config[_0x7491('0x2')]&&config['xdr'][_0x7491('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x7491('0x7')][_0x7491('0x8')],config[_0x7491('0x7')]['ip'],config[_0x7491('0x7')][_0x7491('0x9')],config[_0x7491('0x7')][_0x7491('0xa')],!![]);ami[_0x7491('0xb')]();if(!isXDREnabled){utils[_0x7491('0xc')](_0x7491('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7491('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x7491('0xe'));var recordings=require(_0x7491('0xf'));var members=require(_0x7491('0x10'));var dials=require(_0x7491('0x11'));var transfers=require(_0x7491('0x12'));var core=require(_0x7491('0x13'));ami['on'](_0x7491('0x14'),core[_0x7491('0x14')]);ami['on']('shutdown',core[_0x7491('0x15')]);ami['on'](_0x7491('0x16'),core[_0x7491('0x16')]);ami['on'](_0x7491('0x17'),core[_0x7491('0x17')]);ami['on'](_0x7491('0x18'),core['close']);ami['on'](_0x7491('0x19'),core[_0x7491('0x19')]);ami['on'](_0x7491('0x1a'),function(_0x1b7321){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x1d'),_0x1b7321['device']),_0x1b7321);members[_0x7491('0x1a')](_0x1b7321);}catch(_0x3080d8){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x1d'),_0x1b7321[_0x7491('0x1e')]),_0x3080d8);}});ami['on'](_0x7491('0x1f'),function(_0xaa5fd3){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')]('[%s][index][agentcalled]',_0xaa5fd3[_0x7491('0x20')]),_0xaa5fd3);agents[_0x7491('0x1f')](_0xaa5fd3);}catch(_0x49101c){utils[_0x7491('0x17')](util[_0x7491('0x1c')]('[%s][index][agentcalled]',_0xaa5fd3['uniqueid']),_0x49101c);}});ami['on']('agentringnoanswer',function(_0x167448){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x21'),_0x167448['uniqueid']),_0x167448);agents[_0x7491('0x22')](_0x167448);}catch(_0x4921af){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x21'),_0x167448[_0x7491('0x20')]),_0x4921af);}});ami['on'](_0x7491('0x23'),function(_0x3d220b){try{utils['debug'](util[_0x7491('0x1c')](_0x7491('0x24'),_0x3d220b[_0x7491('0x20')]),_0x3d220b);agents[_0x7491('0x23')](_0x3d220b);queues[_0x7491('0x23')](_0x3d220b);}catch(_0x32b1df){utils['error'](util[_0x7491('0x1c')](_0x7491('0x24'),_0x3d220b[_0x7491('0x20')]),_0x32b1df);}});ami['on']('agentcomplete',function(_0x1522ef){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x25'),_0x1522ef[_0x7491('0x20')]),_0x1522ef);agents[_0x7491('0x26')](_0x1522ef);queues[_0x7491('0x26')](_0x1522ef);members[_0x7491('0x26')](_0x1522ef);}catch(_0x1c4e46){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x25'),_0x1522ef[_0x7491('0x20')]),_0x1c4e46);}});ami['on'](_0x7491('0x27'),function(_0x239069){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x28'),_0x239069[_0x7491('0x20')]),_0x239069);agents[_0x7491('0x27')](_0x239069);queues[_0x7491('0x27')](_0x239069);}catch(_0x3c9610){utils[_0x7491('0x17')](util['format'](_0x7491('0x28'),_0x239069[_0x7491('0x20')]),_0x3c9610);}});ami['on'](_0x7491('0x29'),function(_0x4b3f7c){try{utils['debug'](util[_0x7491('0x1c')]('[%s][index][queuecallerjoin]',_0x4b3f7c[_0x7491('0x20')]),_0x4b3f7c);queues[_0x7491('0x29')](_0x4b3f7c);recordings[_0x7491('0x29')](_0x4b3f7c);}catch(_0x12c513){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x2a'),_0x4b3f7c[_0x7491('0x20')]),_0x12c513);}});ami['on']('queuecallerleave',function(_0x35a4ab){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')]('[%s][index][queuecallerleave]',_0x35a4ab['uniqueid']),_0x35a4ab);queues['queuecallerleave'](_0x35a4ab);}catch(_0x11928c){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x2b'),_0x35a4ab['uniqueid']),_0x11928c);}});ami['on'](_0x7491('0x2c'),function(_0x2f7da4){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x2d'),_0x2f7da4[_0x7491('0x20')]),_0x2f7da4);queues[_0x7491('0x2c')](_0x2f7da4);calls[_0x7491('0x2c')](_0x2f7da4);}catch(_0x444bb4){utils['error'](util[_0x7491('0x1c')](_0x7491('0x2d'),_0x2f7da4['uniqueid']),_0x444bb4);}});ami['on'](_0x7491('0x2e'),function(_0x4d9b02){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x2f'),_0x4d9b02[_0x7491('0x20')]),_0x4d9b02);queues[_0x7491('0x2e')](_0x4d9b02);calls['musiconholdstop'](_0x4d9b02);}catch(_0x47cb43){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x2f'),_0x4d9b02[_0x7491('0x20')]),_0x47cb43);}});ami['on'](_0x7491('0x30'),function(_0x420cd4){try{utils['debug'](util['format'](_0x7491('0x31'),_0x420cd4[_0x7491('0x20')]),_0x420cd4);calls[_0x7491('0x30')](_0x420cd4);recordings[_0x7491('0x30')](_0x420cd4);}catch(_0x9ab416){utils[_0x7491('0x17')](util['format']('[%s][index][newstate]',_0x420cd4[_0x7491('0x20')]),_0x9ab416);}});ami['on'](_0x7491('0x32'),function(_0x3a05bc){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')]('[%s][index][hangup]',_0x3a05bc[_0x7491('0x20')]),_0x3a05bc);calls[_0x7491('0x32')](_0x3a05bc);recordings[_0x7491('0x32')](_0x3a05bc);dials['hangup'](_0x3a05bc);agents[_0x7491('0x32')](_0x3a05bc);queues[_0x7491('0x32')](_0x3a05bc);}catch(_0x209efb){utils[_0x7491('0x17')](util['format'](_0x7491('0x33'),_0x3a05bc[_0x7491('0x20')]),_0x209efb);}});ami['on'](_0x7491('0x34'),function(_0xbfb685){try{utils[_0x7491('0x1b')](util['format'](_0x7491('0x35'),_0xbfb685['uniqueid']),_0xbfb685);members[_0x7491('0x34')](_0xbfb685);}catch(_0x3c96b9){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x35'),_0xbfb685['uniqueid']),_0x3c96b9);}});ami['on'](_0x7491('0x36'),function(_0x502782){try{utils['debug'](util[_0x7491('0x1c')](_0x7491('0x37'),_0x502782[_0x7491('0x20')]),_0x502782);queues[_0x7491('0x36')](_0x502782);agents[_0x7491('0x36')](_0x502782);transfers[_0x7491('0x36')](_0x502782);recordings['blindtransfer'](_0x502782);}catch(_0x130ed0){utils[_0x7491('0x17')](util['format'](_0x7491('0x37'),_0x502782[_0x7491('0x20')]),_0x130ed0);}});ami['on']('attendedtransfer',function(_0x4f5025){try{utils['debug'](util[_0x7491('0x1c')](_0x7491('0x38'),_0x4f5025[_0x7491('0x39')]),_0x4f5025);queues['attendedtransfer'](_0x4f5025);transfers[_0x7491('0x3a')](_0x4f5025);agents[_0x7491('0x3a')](_0x4f5025);calls['attendedtransfer'](_0x4f5025);}catch(_0x59ae93){utils[_0x7491('0x17')](util['format']('[%s][index][attendedtransfer]',_0x4f5025['origtransfereruniqueid']),_0x59ae93);}});ami['on'](_0x7491('0x3b'),function(_0x5418a1){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')]('[%s][index][varset]',_0x5418a1[_0x7491('0x20')]),_0x5418a1);queues['varset'](_0x5418a1);recordings[_0x7491('0x3b')](_0x5418a1);calls[_0x7491('0x3b')](_0x5418a1);dials[_0x7491('0x3b')](_0x5418a1);}catch(_0xdbe22e){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x3c'),_0x5418a1['uniqueid']),_0xdbe22e);}});ami['on'](_0x7491('0x3d'),function(_0x9a1b75){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x3e'),_0x9a1b75['uniqueid']),_0x9a1b75);calls['newexten'](_0x9a1b75);recordings[_0x7491('0x3d')](_0x9a1b75);dials['newexten'](_0x9a1b75);}catch(_0x3198fc){utils[_0x7491('0x17')](util[_0x7491('0x1c')](_0x7491('0x3e'),_0x9a1b75[_0x7491('0x20')]),_0x3198fc);}});ami['on']('newchannel',function(_0x54db46){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x3f'),_0x54db46[_0x7491('0x20')]),_0x54db46);calls[_0x7491('0x40')](_0x54db46);recordings[_0x7491('0x40')](_0x54db46);}catch(_0x1a6e89){utils['error'](util['format'](_0x7491('0x3f'),_0x54db46[_0x7491('0x20')]),_0x1a6e89);}});ami['on']('dialbegin',function(_0x3d5dea){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')](_0x7491('0x41'),_0x3d5dea[_0x7491('0x20')]),_0x3d5dea);dials[_0x7491('0x42')](_0x3d5dea);}catch(_0x10c2f9){utils['error'](util['format']('[%s]dialbegin',_0x3d5dea[_0x7491('0x20')]),_0x10c2f9);}});ami['on'](_0x7491('0x43'),function(_0x4763ab){try{utils[_0x7491('0x1b')](util[_0x7491('0x1c')]('[%s][index][dialend]',_0x4763ab['uniqueid']),_0x4763ab);dials[_0x7491('0x43')](_0x4763ab);}catch(_0x3a434a){utils['error'](util[_0x7491('0x1c')]('[%s][index][dialend]',_0x4763ab[_0x7491('0x20')]),_0x3a434a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9cc574a..bca420d 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 _0x795a=['agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','split','data1','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source','[%s][members][cdr]','util','./utils','Queue:','info','format','interface','channel','data2','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING'];(function(_0x289f5a,_0x20e57e){var _0x3850ef=function(_0x38839d){while(--_0x38839d){_0x289f5a['push'](_0x289f5a['shift']());}};_0x3850ef(++_0x20e57e);}(_0x795a,0xa2));var _0xa795=function(_0x3f58c2,_0x3003ca){_0x3f58c2=_0x3f58c2-0x0;var _0x1c2253=_0x795a[_0x3f58c2];return _0x1c2253;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var utils=require(_0xa795('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xa795('0x2')];function writeDB(_0x4e8f61){utils[_0xa795('0x3')](util[_0xa795('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x4e8f61['uniqueid'],_0x4e8f61[_0xa795('0x5')],_0x4e8f61[_0xa795('0x6')],_0x4e8f61[_0xa795('0x7')],_0x4e8f61[_0xa795('0x8')],_0x4e8f61['type']));if(_0x4e8f61[_0xa795('0x5')]){utils['getUserByInterface'](_0x4e8f61[_0xa795('0x5')])['then'](function(_0x4bb5b5){if(_0x4bb5b5){_0x4e8f61[_0xa795('0x8')]=_0x4bb5b5[_0xa795('0x9')];_0x4e8f61[_0xa795('0xa')]=_0x4bb5b5[_0xa795('0xa')];utils[_0xa795('0xb')](_0xa795('0xc'),_0x4e8f61);}else{utils[_0xa795('0xd')](_0x4e8f61[_0xa795('0x5')]['split']('/')[0x1])['then'](function(_0x15a7b3){if(_0x15a7b3){_0x4e8f61[_0xa795('0x8')]=_0x15a7b3[_0xa795('0x9')];_0x4e8f61['internal']=_0x15a7b3[_0xa795('0xa')];utils[_0xa795('0xb')]('CreateMemberReport',_0x4e8f61);}});}})[_0xa795('0xe')](function(_0x1fa71a){utils[_0xa795('0xf')](util[_0xa795('0x4')](_0xa795('0x10'),_0x4e8f61[_0xa795('0x11')]),_0x1fa71a);});}delete members[_0x4e8f61[_0xa795('0x5')]];}function startsWith(_0x4b0bc9,_0x1e4d13){return _[_0xa795('0x12')](_0x4b0bc9,function(_0x558e04){return _['startsWith'](_0x1e4d13,_0x558e04);});}exports[_0xa795('0x13')]=function(_0x56db2c){try{utils[_0xa795('0x14')](util[_0xa795('0x4')](_0xa795('0x15'),members[_0x56db2c[_0xa795('0x16')]]?members[_0x56db2c[_0xa795('0x16')]]['uniqueid']:_0x56db2c[_0xa795('0x16')]),_0x56db2c);utils[_0xa795('0x3')](util[_0xa795('0x4')](_0xa795('0x17'),members[_0x56db2c[_0xa795('0x16')]]?members[_0x56db2c[_0xa795('0x16')]][_0xa795('0x11')]:_0x56db2c['device'],_0x56db2c['state'],_0x56db2c[_0xa795('0x16')]));switch(_0x56db2c[_0xa795('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x56db2c[_0xa795('0x16')])){members[_0x56db2c[_0xa795('0x16')]]={'channel':'voice','interface':_0x56db2c[_0xa795('0x16')],'type':_0xa795('0x19'),'enterAt':utils['now'](),'role':_0xa795('0x1a')};}break;case _0xa795('0x1b'):if(!_[_0xa795('0x1c')](members[_0x56db2c[_0xa795('0x16')]])){members[_0x56db2c[_0xa795('0x16')]][_0xa795('0x1d')]=utils[_0xa795('0x1e')]();members[_0x56db2c[_0xa795('0x16')]][_0xa795('0x1f')]=utils[_0xa795('0x20')](members[_0x56db2c[_0xa795('0x16')]]['exitAt'],members[_0x56db2c[_0xa795('0x16')]]['enterAt']);if(members[_0x56db2c[_0xa795('0x16')]][_0xa795('0x11')]){writeDB(members[_0x56db2c['device']]);}}break;default:break;}}catch(_0x20eaef){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x56db2c[_0xa795('0x16')]]?members[_0x56db2c['device']][_0xa795('0x11')]:_0x56db2c[_0xa795('0x16')]),_0x20eaef);}};exports[_0xa795('0x21')]=function(_0x432587){try{if(!_['isNil'](members[_0x432587['interface']])){utils['debug'](util[_0xa795('0x4')](_0xa795('0x22'),_0x432587['uniqueid']),_0x432587);utils['info'](util[_0xa795('0x4')](_0xa795('0x23'),_0x432587['uniqueid'],_0x432587[_0xa795('0x5')],_0x432587['queue']));members[_0x432587[_0xa795('0x5')]]=_[_0xa795('0x24')](members[_0x432587['interface']],{'data4':_0x432587[_0xa795('0x25')],'uniqueid':_0x432587[_0xa795('0x11')]});}}catch(_0x4fbf57){utils[_0xa795('0xf')](util[_0xa795('0x4')]('[%s][members][agentcomplete]',_0x432587['uniqueid']),_0x4fbf57);}};exports[_0xa795('0x26')]=function(_0x210cfa){try{utils['debug'](util[_0xa795('0x4')]('[%s][members][cdr]',_0x210cfa['uniqueid']),_0x210cfa);if(_0x210cfa[_0xa795('0x6')]){var _0x5455a1=_0x210cfa[_0xa795('0x6')][_0xa795('0x27')]('-')[0x0];if(!_[_0xa795('0x1c')](members[_0x5455a1])){members[_0x5455a1]=_['assign'](members[_0x5455a1],{'data1':members[_0x5455a1][_0xa795('0x28')]||_0x210cfa[_0xa795('0x29')],'data2':members[_0x5455a1]['data2']||_0x210cfa['source'],'data3':members[_0x5455a1][_0xa795('0x2a')]||_0x210cfa[_0xa795('0x2b')],'uniqueid':members[_0x5455a1]['uniqueid']||_0x210cfa[_0xa795('0x11')]});utils[_0xa795('0x3')](util[_0xa795('0x4')](_0xa795('0x2c'),_0x210cfa[_0xa795('0x11')],members[_0x5455a1][_0xa795('0x28')],members[_0x5455a1][_0xa795('0x7')],members[_0x5455a1]['data3']));if(members[_0x5455a1]['exitAt']){writeDB(members[_0x5455a1]);}}}if(_0x210cfa['destinationchannel']){var _0x2fc1e3=_0x210cfa['destinationchannel'][_0xa795('0x27')]('-')[0x0];if(!_[_0xa795('0x1c')](members[_0x2fc1e3])){members[_0x2fc1e3]=_['assign'](members[_0x2fc1e3],{'data1':members[_0x2fc1e3][_0xa795('0x28')]||_0x210cfa[_0xa795('0x29')],'data2':members[_0x2fc1e3][_0xa795('0x7')]||_0x210cfa[_0xa795('0x2d')],'data3':members[_0x2fc1e3][_0xa795('0x2a')]||_0x210cfa['destination'],'uniqueid':members[_0x2fc1e3]['uniqueid']||_0x210cfa['uniqueid']});utils[_0xa795('0x3')](util['format'](_0xa795('0x2c'),_0x210cfa[_0xa795('0x11')],members[_0x2fc1e3][_0xa795('0x28')],members[_0x2fc1e3][_0xa795('0x7')],members[_0x2fc1e3][_0xa795('0x2a')]));if(members[_0x2fc1e3][_0xa795('0x1d')]){writeDB(members[_0x2fc1e3]);}}}}catch(_0x18f3eb){utils[_0xa795('0xf')](util['format'](_0xa795('0x2e'),_0x210cfa[_0xa795('0x11')]),_0x18f3eb);}}; \ No newline at end of file +var _0x561f=['[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','type','data2','source','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','interface','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug'];(function(_0x38c1eb,_0x18f54b){var _0x42a7be=function(_0x4b4842){while(--_0x4b4842){_0x38c1eb['push'](_0x38c1eb['shift']());}};_0x42a7be(++_0x18f54b);}(_0x561f,0x15b));var _0xf561=function(_0x2389c8,_0x20340d){_0x2389c8=_0x2389c8-0x0;var _0x818842=_0x561f[_0x2389c8];return _0x818842;};'use strict';var _=require(_0xf561('0x0'));var util=require(_0xf561('0x1'));var utils=require(_0xf561('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x467707){utils[_0xf561('0x3')](util[_0xf561('0x4')](_0xf561('0x5'),_0x467707[_0xf561('0x6')],_0x467707['interface'],_0x467707[_0xf561('0x7')],_0x467707['data2'],_0x467707[_0xf561('0x8')],_0x467707['type']));if(_0x467707[_0xf561('0x9')]){utils[_0xf561('0xa')](_0x467707[_0xf561('0x9')])[_0xf561('0xb')](function(_0x56d89f){if(_0x56d89f){_0x467707[_0xf561('0x8')]=_0x56d89f[_0xf561('0xc')];_0x467707['internal']=_0x56d89f[_0xf561('0xd')];utils['request'](_0xf561('0xe'),_0x467707);}else{utils[_0xf561('0xf')](_0x467707['interface'][_0xf561('0x10')]('/')[0x1])['then'](function(_0x3480f7){if(_0x3480f7){_0x467707[_0xf561('0x8')]=_0x3480f7[_0xf561('0xc')];_0x467707[_0xf561('0xd')]=_0x3480f7[_0xf561('0xd')];utils[_0xf561('0x11')](_0xf561('0xe'),_0x467707);}});}})[_0xf561('0x12')](function(_0x5876bd){utils['error'](util[_0xf561('0x4')](_0xf561('0x13'),_0x467707[_0xf561('0x6')]),_0x5876bd);});}delete members[_0x467707[_0xf561('0x9')]];}function startsWith(_0x1a6a10,_0x3e620a){return _[_0xf561('0x14')](_0x1a6a10,function(_0x5d4066){return _[_0xf561('0x15')](_0x3e620a,_0x5d4066);});}exports[_0xf561('0x16')]=function(_0x251b01){try{utils[_0xf561('0x17')](util['format'](_0xf561('0x18'),members[_0x251b01['device']]?members[_0x251b01[_0xf561('0x19')]][_0xf561('0x6')]:_0x251b01[_0xf561('0x19')]),_0x251b01);utils[_0xf561('0x3')](util['format'](_0xf561('0x1a'),members[_0x251b01[_0xf561('0x19')]]?members[_0x251b01[_0xf561('0x19')]][_0xf561('0x6')]:_0x251b01['device'],_0x251b01[_0xf561('0x1b')],_0x251b01[_0xf561('0x19')]));switch(_0x251b01[_0xf561('0x1b')]){case _0xf561('0x1c'):case _0xf561('0x1d'):if(!startsWith(exclude,_0x251b01[_0xf561('0x19')])){members[_0x251b01[_0xf561('0x19')]]={'channel':'voice','interface':_0x251b01[_0xf561('0x19')],'type':_0xf561('0x1e'),'enterAt':utils['now'](),'role':_0xf561('0x1f')};}break;case _0xf561('0x20'):if(!_['isNil'](members[_0x251b01['device']])){members[_0x251b01['device']][_0xf561('0x21')]=utils[_0xf561('0x22')]();members[_0x251b01[_0xf561('0x19')]][_0xf561('0x23')]=utils[_0xf561('0x24')](members[_0x251b01[_0xf561('0x19')]][_0xf561('0x21')],members[_0x251b01[_0xf561('0x19')]][_0xf561('0x25')]);if(members[_0x251b01[_0xf561('0x19')]][_0xf561('0x6')]){writeDB(members[_0x251b01[_0xf561('0x19')]]);}}break;default:break;}}catch(_0x4fbe34){utils[_0xf561('0x26')](util[_0xf561('0x4')](_0xf561('0x18'),members[_0x251b01[_0xf561('0x19')]]?members[_0x251b01[_0xf561('0x19')]][_0xf561('0x6')]:_0x251b01[_0xf561('0x19')]),_0x4fbe34);}};exports[_0xf561('0x27')]=function(_0x1d58d4){try{if(!_[_0xf561('0x28')](members[_0x1d58d4[_0xf561('0x9')]])){utils[_0xf561('0x17')](util[_0xf561('0x4')](_0xf561('0x29'),_0x1d58d4[_0xf561('0x6')]),_0x1d58d4);utils[_0xf561('0x3')](util['format'](_0xf561('0x2a'),_0x1d58d4[_0xf561('0x6')],_0x1d58d4[_0xf561('0x9')],_0x1d58d4[_0xf561('0x2b')]));members[_0x1d58d4[_0xf561('0x9')]]=_[_0xf561('0x2c')](members[_0x1d58d4['interface']],{'data4':_0x1d58d4[_0xf561('0x2b')],'uniqueid':_0x1d58d4[_0xf561('0x6')]});}}catch(_0x495693){utils[_0xf561('0x26')](util[_0xf561('0x4')](_0xf561('0x29'),_0x1d58d4[_0xf561('0x6')]),_0x495693);}};exports['cdr']=function(_0x293f47){try{utils['debug'](util['format'](_0xf561('0x2d'),_0x293f47[_0xf561('0x6')]),_0x293f47);if(_0x293f47[_0xf561('0x7')]){var _0x4c3f6e=_0x293f47['channel'][_0xf561('0x10')]('-')[0x0];if(!_[_0xf561('0x28')](members[_0x4c3f6e])){members[_0x4c3f6e]=_['assign'](members[_0x4c3f6e],{'data1':members[_0x4c3f6e][_0xf561('0x2e')]||_0x293f47[_0xf561('0x2f')],'data2':members[_0x4c3f6e][_0xf561('0x30')]||_0x293f47[_0xf561('0x31')],'data3':members[_0x4c3f6e][_0xf561('0x32')]||_0x293f47['destination'],'uniqueid':members[_0x4c3f6e][_0xf561('0x6')]||_0x293f47[_0xf561('0x6')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x293f47['uniqueid'],members[_0x4c3f6e]['data1'],members[_0x4c3f6e][_0xf561('0x30')],members[_0x4c3f6e][_0xf561('0x32')]));if(members[_0x4c3f6e]['exitAt']){writeDB(members[_0x4c3f6e]);}}}if(_0x293f47[_0xf561('0x33')]){var _0x14854c=_0x293f47[_0xf561('0x33')][_0xf561('0x10')]('-')[0x0];if(!_['isNil'](members[_0x14854c])){members[_0x14854c]=_[_0xf561('0x2c')](members[_0x14854c],{'data1':members[_0x14854c][_0xf561('0x2e')]||_0x293f47['type'],'data2':members[_0x14854c][_0xf561('0x30')]||_0x293f47['source'],'data3':members[_0x14854c][_0xf561('0x32')]||_0x293f47['destination'],'uniqueid':members[_0x14854c][_0xf561('0x6')]||_0x293f47['uniqueid']});utils[_0xf561('0x3')](util[_0xf561('0x4')](_0xf561('0x34'),_0x293f47['uniqueid'],members[_0x14854c]['data1'],members[_0x14854c][_0xf561('0x30')],members[_0x14854c]['data3']));if(members[_0x14854c]['exitAt']){writeDB(members[_0x14854c]);}}}}catch(_0x2cbc31){utils['error'](util['format'](_0xf561('0x2d'),_0x293f47[_0xf561('0x6')]),_0x2cbc31);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 85ffc55..9da0078 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 _0x12c5=['membername','destaccountcode','assigned','agentcomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','position','assign','now','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','isNil','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][varset]','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s'];(function(_0x3449dd,_0x18e820){var _0x3662f8=function(_0x5156a6){while(--_0x5156a6){_0x3449dd['push'](_0x3449dd['shift']());}};_0x3662f8(++_0x18e820);}(_0x12c5,0x165));var _0x512c=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x12c5[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x512c('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x734037){utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x3'),_0x734037[_0x512c('0x4')],_0x734037[_0x512c('0x5')],_0x734037['queue'],_0x734037[_0x512c('0x6')],_0x734037[_0x512c('0x7')],_0x734037[_0x512c('0x8')],_0x734037['queuecallerexitreason']));if(_0x734037['queue']){utils[_0x512c('0x9')](_0x734037[_0x512c('0xa')])['then'](function(_0x4d2b7c){if(_0x4d2b7c){_0x734037[_0x512c('0xb')]=_0x4d2b7c['type'];}utils[_0x512c('0xc')](_0x512c('0xd'),_0x734037);});}else{utils[_0x512c('0xc')](_0x512c('0xd'),_0x734037);}if(_0x734037[_0x512c('0xe')]){delete queues[_0x734037[_0x512c('0xe')]];}else{delete queues[_0x734037[_0x512c('0x4')]];}}exports[_0x512c('0xf')]=function(_0x3ec37b){try{utils['debug'](util[_0x512c('0x2')](_0x512c('0x10'),_0x3ec37b[_0x512c('0x4')]),_0x3ec37b);utils[_0x512c('0x1')](util[_0x512c('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3ec37b[_0x512c('0x4')],_0x3ec37b[_0x512c('0xa')],_0x3ec37b[_0x512c('0x11')]));queues[_0x3ec37b['uniqueid']]=_[_0x512c('0x12')](_0x3ec37b,{'originalposition':_0x3ec37b[_0x512c('0x11')],'queuecallerjoinAt':utils[_0x512c('0x13')](),'mohtime':0x0});}catch(_0x38f915){utils['error'](util[_0x512c('0x2')]('[%s][queues][queuecallerjoin]',_0x3ec37b['uniqueid']),_0x38f915);}};exports['hangup']=function(_0x4d9d33){try{if(!_['isNil'](queues[_0x4d9d33[_0x512c('0x4')]])){utils[_0x512c('0x14')](util[_0x512c('0x2')](_0x512c('0x15'),_0x4d9d33[_0x512c('0x4')]),_0x4d9d33);if(queues[_0x4d9d33['uniqueid']][_0x512c('0x16')]){if(!queues[_0x4d9d33[_0x512c('0x4')]]['queuecallerabandon']&&!queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0x17')]){queues[_0x4d9d33[_0x512c('0x4')]]['queuecallercomplete']=!![];queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0x18')]=utils['now']();queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0x19')]=_0x512c('0x1a');}utils[_0x512c('0x1')](util['format'](_0x512c('0x1b'),_0x4d9d33[_0x512c('0x4')],queues[_0x4d9d33['uniqueid']][_0x512c('0x1c')],queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0x19')]));writeDB(queues[_0x4d9d33[_0x512c('0x4')]]);}else if(queues[_0x4d9d33[_0x512c('0x4')]]['transfereduniqueid']){utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x1d'),_0x4d9d33[_0x512c('0x4')],queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0x1c')],queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0xe')]));queues[queues[_0x4d9d33[_0x512c('0x4')]][_0x512c('0xe')]]=queues[_0x4d9d33[_0x512c('0x4')]];queues[queues[_0x4d9d33[_0x512c('0x4')]]['transfereduniqueid']][_0x512c('0x1e')]=0x2;delete queues[_0x4d9d33['uniqueid']];}}}catch(_0x547090){utils['error'](util[_0x512c('0x2')](_0x512c('0x15'),_0x4d9d33[_0x512c('0x4')]),_0x547090);}};exports[_0x512c('0x1f')]=function(_0x1411ae){try{utils['debug'](util[_0x512c('0x2')]('[%s][queues][varset]',_0x1411ae[_0x512c('0x4')]),_0x1411ae);if(!_[_0x512c('0x20')](_0x1411ae['variable'][_0x512c('0x21')])&&_0x1411ae[_0x512c('0x22')][_0x512c('0x23')]()!=='CONTINUE'){if(!_[_0x512c('0x20')](queues[_0x1411ae[_0x512c('0x4')]])){queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x24')]=![];queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x25')]=null;queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x17')]=!![];queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x26')]=utils['now']();queues[_0x1411ae['uniqueid']][_0x512c('0x19')]=_0x1411ae[_0x512c('0x22')][_0x512c('0x23')]();utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x27'),_0x1411ae[_0x512c('0x4')],queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x1c')],_0x1411ae[_0x512c('0x22')],queues[_0x1411ae['uniqueid']][_0x512c('0x19')]));writeDB(queues[_0x1411ae[_0x512c('0x4')]]);}}else if(!_[_0x512c('0x20')](_0x1411ae[_0x512c('0x28')][_0x512c('0x29')])){if(!_[_0x512c('0x20')](queues[_0x1411ae['uniqueid']])&&!queues[_0x1411ae[_0x512c('0x4')]]['queuecallerabandon']){queues[_0x1411ae['uniqueid']][_0x512c('0x24')]=![];queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x25')]=null;queues[_0x1411ae['uniqueid']][_0x512c('0x17')]=!![];queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x26')]=utils['now']();queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x19')]=_0x512c('0x2a');utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x2b'),_0x1411ae[_0x512c('0x4')],queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x1c')],_0x1411ae['value'],queues[_0x1411ae[_0x512c('0x4')]][_0x512c('0x19')]));}}}catch(_0x53d064){utils[_0x512c('0x2c')](util[_0x512c('0x2')](_0x512c('0x2d'),_0x1411ae['uniqueid']),_0x53d064);}};exports[_0x512c('0x24')]=function(_0xbe43d8){try{if(!_['isNil'](queues[_0xbe43d8[_0x512c('0x4')]])){utils[_0x512c('0x14')](util[_0x512c('0x2')](_0x512c('0x2e'),_0xbe43d8[_0x512c('0x4')]),_0xbe43d8);queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x17')]=![];queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x26')]=null;queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x24')]=!![];queues[_0xbe43d8['uniqueid']][_0x512c('0x25')]=utils[_0x512c('0x13')]();queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x19')]='ABANDONED';utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x2f'),_0xbe43d8[_0x512c('0x4')],queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x1c')],queues[_0xbe43d8[_0x512c('0x4')]][_0x512c('0x19')]));}}catch(_0x3d527){utils['error'](util[_0x512c('0x2')](_0x512c('0x2e'),_0xbe43d8[_0x512c('0x4')]),_0x3d527);}};exports[_0x512c('0x30')]=function(_0x3a71ff){try{if(!_[_0x512c('0x20')](queues[_0x3a71ff['uniqueid']])){utils[_0x512c('0x14')](util[_0x512c('0x2')]('[%s][queues][queuecallerleave]',_0x3a71ff['uniqueid']),_0x3a71ff);utils['info'](util['format'](_0x512c('0x31'),_0x3a71ff['uniqueid'],queues[_0x3a71ff['uniqueid']][_0x512c('0x1c')],_0x3a71ff[_0x512c('0x32')],_0x3a71ff[_0x512c('0x33')]));queues[_0x3a71ff[_0x512c('0x4')]][_0x512c('0x30')]=!![];queues[_0x3a71ff[_0x512c('0x4')]][_0x512c('0x16')]=utils['now']();queues[_0x3a71ff[_0x512c('0x4')]][_0x512c('0x34')]=utils[_0x512c('0x35')](queues[_0x3a71ff[_0x512c('0x4')]][_0x512c('0x16')],queues[_0x3a71ff[_0x512c('0x4')]][_0x512c('0x36')]);queues[_0x3a71ff[_0x512c('0x4')]]['position']=_0x3a71ff[_0x512c('0x11')];queues[_0x3a71ff['uniqueid']][_0x512c('0x37')]=_0x3a71ff[_0x512c('0x37')];queues[_0x3a71ff[_0x512c('0x4')]]['connectedlinenum']=_0x3a71ff[_0x512c('0x32')];queues[_0x3a71ff['uniqueid']][_0x512c('0x33')]=_0x3a71ff[_0x512c('0x33')];}}catch(_0x55db27){utils['error'](util[_0x512c('0x2')](_0x512c('0x38'),_0x3a71ff[_0x512c('0x4')]),_0x55db27);}};exports[_0x512c('0x39')]=function(_0x40b22e){try{if(!_['isNil'](queues[_0x40b22e['uniqueid']])){utils['debug'](util[_0x512c('0x2')]('[%s][queues][agentconnect]',_0x40b22e['uniqueid']),_0x40b22e);utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x3a'),_0x40b22e[_0x512c('0x4')],queues[_0x40b22e[_0x512c('0x4')]][_0x512c('0x1c')],_0x40b22e[_0x512c('0x3b')],_0x40b22e[_0x512c('0x3c')]));queues[_0x40b22e[_0x512c('0x4')]]['queuecallerabandon']=![];queues[_0x40b22e['uniqueid']][_0x512c('0x24')]=![];queues[_0x40b22e['uniqueid']][_0x512c('0x25')]=null;queues[_0x40b22e[_0x512c('0x4')]][_0x512c('0x17')]=![];queues[_0x40b22e['uniqueid']]['queuecallerexitreason']=null;queues[_0x40b22e[_0x512c('0x4')]][_0x512c('0x26')]=null;queues[_0x40b22e['uniqueid']][_0x512c('0x3d')]=!![];queues[_0x40b22e['uniqueid']][_0x512c('0x8')]=_0x40b22e['destaccountcode'];queues[_0x40b22e[_0x512c('0x4')]][_0x512c('0x6')]=_0x40b22e['membername'];}}catch(_0x3ed9ce){utils['error'](util[_0x512c('0x2')]('[%s][queues][agentconnect]',_0x40b22e[_0x512c('0x4')]),_0x3ed9ce);}};exports[_0x512c('0x3e')]=function(_0x4bc54d){try{if(!_['isNil'](queues[_0x4bc54d[_0x512c('0x4')]])){if(queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x16')]){utils[_0x512c('0x14')](util['format']('[%s][queues][agentcomplete]',_0x4bc54d[_0x512c('0x4')]),_0x4bc54d);queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x24')]=![];queues[_0x4bc54d[_0x512c('0x4')]]['queuecallerabandon']=![];queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x25')]=null;queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x17')]=![];queues[_0x4bc54d[_0x512c('0x4')]]['queuecallerexitAt']=null;queues[_0x4bc54d['uniqueid']]['assigned']=!![];queues[_0x4bc54d[_0x512c('0x4')]]['lastAssignedTo']=_0x4bc54d[_0x512c('0x3b')];queues[_0x4bc54d[_0x512c('0x4')]]['queuecallercomplete']=!![];queues[_0x4bc54d['uniqueid']]['queuecallercompleteAt']=utils[_0x512c('0x13')]();if(_0x4bc54d[_0x512c('0x3f')]==_0x512c('0x40')){if(!queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x40')]){queues[_0x4bc54d['uniqueid']][_0x512c('0x19')]='TRANSFER';}}else{queues[_0x4bc54d['uniqueid']][_0x512c('0x19')]=_0x512c('0x41')+_0x4bc54d[_0x512c('0x3f')]['toUpperCase']();}utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x42'),_0x4bc54d['uniqueid'],queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x1c')],_0x4bc54d['membername'],queues[_0x4bc54d[_0x512c('0x4')]][_0x512c('0x19')]));writeDB(queues[_0x4bc54d[_0x512c('0x4')]]);}}}catch(_0x19ca3e){utils['error'](util[_0x512c('0x2')](_0x512c('0x43'),_0x4bc54d[_0x512c('0x4')]),_0x19ca3e);}};exports[_0x512c('0x44')]=function(_0x1dea21){try{if(!_[_0x512c('0x20')](queues[_0x1dea21['transfereeuniqueid']])){utils['debug'](util[_0x512c('0x2')](_0x512c('0x45'),_0x1dea21[_0x512c('0x4')]),_0x1dea21);queues[_0x1dea21['transfereeuniqueid']]['transfer']=!![];queues[_0x1dea21[_0x512c('0x46')]][_0x512c('0x47')]=_0x512c('0x48');queues[_0x1dea21[_0x512c('0x46')]][_0x512c('0x49')]=_0x1dea21['extension'];queues[_0x1dea21['transfereeuniqueid']][_0x512c('0x4a')]=_0x1dea21['transfereeuniqueid'];queues[_0x1dea21[_0x512c('0x46')]][_0x512c('0x19')]=_0x512c('0x4b');utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x4c'),_0x1dea21[_0x512c('0x4')],queues[_0x1dea21[_0x512c('0x46')]]['name'],_0x1dea21[_0x512c('0x46')],_0x1dea21[_0x512c('0x4d')]));}}catch(_0x3fce82){utils[_0x512c('0x2c')](util[_0x512c('0x2')](_0x512c('0x45'),_0x1dea21[_0x512c('0x4')]),_0x3fce82);}};exports[_0x512c('0x4e')]=function(_0x48de15){try{utils[_0x512c('0x14')](util[_0x512c('0x2')](_0x512c('0x4f'),_0x48de15[_0x512c('0x50')]),_0x48de15);if(_0x48de15[_0x512c('0x50')]==_0x48de15[_0x512c('0x51')]){if(!_[_0x512c('0x20')](queues[_0x48de15[_0x512c('0x52')]])){utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x53'),_0x48de15[_0x512c('0x50')],queues[_0x48de15['secondtransfererlinkedid']][_0x512c('0x1c')],_0x48de15['origtransfererexten']));queues[_0x48de15[_0x512c('0x52')]][_0x512c('0x40')]=!![];queues[_0x48de15['secondtransfererlinkedid']][_0x512c('0x47')]=_0x512c('0x54');queues[_0x48de15['secondtransfererlinkedid']]['transferexten']=_0x48de15[_0x512c('0x55')];queues[_0x48de15[_0x512c('0x52')]][_0x512c('0x4a')]=_0x48de15[_0x512c('0x50')];queues[_0x48de15[_0x512c('0x52')]]['queuecallerexitreason']=_0x512c('0x56');}if(!_[_0x512c('0x20')](queues[_0x48de15['origtransfererlinkedid']])){if(_0x48de15[_0x512c('0x57')]&&queues[_0x48de15[_0x512c('0x57')]]){queues[_0x48de15[_0x512c('0x57')]]['queuecallerenterreason']=0x1;queues[_0x48de15['transfereeuniqueid']]=_['clone'](queues[_0x48de15[_0x512c('0x57')]]);queues[_0x48de15[_0x512c('0x46')]][_0x512c('0xe')]=_0x48de15['transfertargetuniqueid'];queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x1e')]=0x2;queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x7')]=queues[_0x48de15['secondtransfererlinkedid']]['calleridnum'];queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x58')]=queues[_0x48de15[_0x512c('0x52')]]['calleridname'];queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x36')]=utils[_0x512c('0x13')]();queues[_0x48de15['transfereeuniqueid']][_0x512c('0x16')]=utils[_0x512c('0x13')]();queues[_0x48de15['transfereeuniqueid']]['holdtime']=0x0;queues[_0x48de15[_0x512c('0x46')]]['mohtime']=0x0;utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x59'),_0x48de15[_0x512c('0x50')],queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x1c')],queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x7')],queues[_0x48de15[_0x512c('0x46')]][_0x512c('0x58')]));}else{utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x5a'),_0x48de15[_0x512c('0x50')],queues[_0x48de15['origtransfererlinkedid']][_0x512c('0x1c')],_0x48de15[_0x512c('0x52')]));queues[_0x48de15[_0x512c('0x51')]]['transfereduniqueid']=_0x48de15['secondtransfererlinkedid'];}}}else if(_0x48de15['secondtransfereruniqueid']==_0x48de15[_0x512c('0x52')]){if(!_[_0x512c('0x20')](queues[_0x48de15['origtransfererlinkedid']])){utils['info'](util['format'](_0x512c('0x5b'),_0x48de15[_0x512c('0x50')],queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x1c')],_0x48de15[_0x512c('0x5c')],_0x48de15[_0x512c('0x5d')]));queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x40')]=!![];queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x47')]=_0x512c('0x54');queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x49')]=_0x48de15[_0x512c('0x5d')];queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x4a')]=_0x48de15['secondtransfereruniqueid'];queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x19')]='ATTENDEDTRANSFER';}if(!_[_0x512c('0x20')](queues[_0x48de15[_0x512c('0x52')]])){if(_0x48de15[_0x512c('0x5e')]&&queues[_0x48de15[_0x512c('0x5e')]]){queues[_0x48de15[_0x512c('0x5e')]]['queuecallerenterreason']=0x1;queues[_0x48de15[_0x512c('0x5f')]]=_[_0x512c('0x60')](queues[_0x48de15[_0x512c('0x5e')]]);queues[_0x48de15[_0x512c('0x5f')]][_0x512c('0xe')]=_0x48de15['transfertargetuniqueid'];queues[_0x48de15[_0x512c('0x5f')]][_0x512c('0x1e')]=0x2;queues[_0x48de15[_0x512c('0x5f')]]['calleridnum']=queues[_0x48de15[_0x512c('0x51')]][_0x512c('0x7')];queues[_0x48de15['transfertargetuniqueid']]['calleridname']=queues[_0x48de15[_0x512c('0x51')]]['calleridname'];queues[_0x48de15[_0x512c('0x5f')]][_0x512c('0x36')]=utils[_0x512c('0x13')]();queues[_0x48de15[_0x512c('0x5f')]][_0x512c('0x16')]=utils['now']();queues[_0x48de15[_0x512c('0x5f')]]['holdtime']=0x0;queues[_0x48de15[_0x512c('0x5f')]]['mohtime']=0x0;utils['info'](util['format'](_0x512c('0x61'),_0x48de15['origtransfereruniqueid'],queues[_0x48de15[_0x512c('0x5f')]][_0x512c('0x1c')],queues[_0x48de15['transfertargetuniqueid']][_0x512c('0xe')],queues[_0x48de15[_0x512c('0x5f')]]['calleridnum'],queues[_0x48de15['transfertargetuniqueid']][_0x512c('0x58')]));}else{utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x5a'),_0x48de15[_0x512c('0x50')],queues[_0x48de15[_0x512c('0x52')]][_0x512c('0x1c')],_0x48de15['origtransfererlinkedid']));queues[_0x48de15[_0x512c('0x52')]][_0x512c('0xe')]=_0x48de15[_0x512c('0x51')];}}}}catch(_0xe957a3){utils['error'](util[_0x512c('0x2')](_0x512c('0x4f'),_0x48de15[_0x512c('0x50')]),_0xe957a3);}};exports['musiconholdstart']=function(_0x3d771e){try{if(!_[_0x512c('0x20')](queues[_0x3d771e[_0x512c('0x4')]])){utils[_0x512c('0x14')](util['format'](_0x512c('0x62'),_0x3d771e['uniqueid']),_0x3d771e);queues[_0x3d771e[_0x512c('0x4')]]['musiconholdstartAt']=utils[_0x512c('0x13')]();utils[_0x512c('0x1')](util[_0x512c('0x2')](_0x512c('0x63'),_0x3d771e[_0x512c('0x4')],queues[_0x3d771e[_0x512c('0x4')]][_0x512c('0x1c')],queues[_0x3d771e[_0x512c('0x4')]][_0x512c('0x64')]));}}catch(_0x3d3dc9){utils[_0x512c('0x2c')](util['format'](_0x512c('0x62'),_0x3d771e[_0x512c('0x4')]),_0x3d3dc9);}};exports[_0x512c('0x65')]=function(_0x4bff4){try{if(!_['isNil'](queues[_0x4bff4[_0x512c('0x4')]])){if(!_['isNil'](queues[_0x4bff4[_0x512c('0x4')]][_0x512c('0x64')])){utils[_0x512c('0x14')](util[_0x512c('0x2')](_0x512c('0x66'),_0x4bff4[_0x512c('0x4')]),_0x4bff4);queues[_0x4bff4[_0x512c('0x4')]]['mohtime']+=utils[_0x512c('0x35')](utils[_0x512c('0x13')](),queues[_0x4bff4[_0x512c('0x4')]][_0x512c('0x64')]);utils[_0x512c('0x1')](util['format'](_0x512c('0x67'),_0x4bff4[_0x512c('0x4')],queues[_0x4bff4['uniqueid']][_0x512c('0x1c')],queues[_0x4bff4[_0x512c('0x4')]]['mohtime']));delete queues[_0x4bff4[_0x512c('0x4')]][_0x512c('0x64')];}}}catch(_0x1d7a56){utils[_0x512c('0x2c')](util[_0x512c('0x2')]('[%s][queues][musiconholdstop]',_0x4bff4[_0x512c('0x4')]),_0x1d7a56);}}; \ No newline at end of file +var _0x9809=['[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','now','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','membername','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','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','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]'];(function(_0x4c16a9,_0x2abe85){var _0x5de103=function(_0x38a206){while(--_0x38a206){_0x4c16a9['push'](_0x4c16a9['shift']());}};_0x5de103(++_0x2abe85);}(_0x9809,0xb1));var _0x9980=function(_0x438335,_0x2bd454){_0x438335=_0x438335-0x0;var _0x103218=_0x9809[_0x438335];return _0x103218;};'use strict';var _=require(_0x9980('0x0'));var util=require('util');var utils=require(_0x9980('0x1'));var queues={};function writeDB(_0x161829){utils[_0x9980('0x2')](util['format'](_0x9980('0x3'),_0x161829[_0x9980('0x4')],_0x161829[_0x9980('0x5')],_0x161829[_0x9980('0x6')],_0x161829['lastAssignedTo'],_0x161829[_0x9980('0x7')],_0x161829['accountcode'],_0x161829[_0x9980('0x8')]));if(_0x161829[_0x9980('0x6')]){utils[_0x9980('0x9')](_0x161829[_0x9980('0x6')])[_0x9980('0xa')](function(_0x3c4532){if(_0x3c4532){_0x161829[_0x9980('0xb')]=_0x3c4532['type'];}utils['request'](_0x9980('0xc'),_0x161829);});}else{utils[_0x9980('0xd')](_0x9980('0xc'),_0x161829);}if(_0x161829[_0x9980('0xe')]){delete queues[_0x161829[_0x9980('0xe')]];}else{delete queues[_0x161829[_0x9980('0x4')]];}}exports[_0x9980('0xf')]=function(_0x5a6e9b){try{utils[_0x9980('0x10')](util[_0x9980('0x11')]('[%s][queues][queuecallerjoin]',_0x5a6e9b[_0x9980('0x4')]),_0x5a6e9b);utils[_0x9980('0x2')](util[_0x9980('0x11')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5a6e9b[_0x9980('0x4')],_0x5a6e9b[_0x9980('0x6')],_0x5a6e9b[_0x9980('0x12')]));queues[_0x5a6e9b[_0x9980('0x4')]]=_[_0x9980('0x13')](_0x5a6e9b,{'originalposition':_0x5a6e9b['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5c3fdf){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x15'),_0x5a6e9b[_0x9980('0x4')]),_0x5c3fdf);}};exports[_0x9980('0x16')]=function(_0x5a82ab){try{if(!_[_0x9980('0x17')](queues[_0x5a82ab[_0x9980('0x4')]])){utils['debug'](util['format']('[%s][queues][hangup]',_0x5a82ab[_0x9980('0x4')]),_0x5a82ab);if(queues[_0x5a82ab['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x5a82ab['uniqueid']]['queuecallerabandon']&&!queues[_0x5a82ab[_0x9980('0x4')]]['queuecallerexit']){queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0x18')]=!![];queues[_0x5a82ab['uniqueid']][_0x9980('0x19')]=utils['now']();queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0x8')]=_0x9980('0x1a');}utils['info'](util[_0x9980('0x11')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x5a82ab[_0x9980('0x4')],queues[_0x5a82ab['uniqueid']][_0x9980('0x1b')],queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0x8')]));writeDB(queues[_0x5a82ab[_0x9980('0x4')]]);}else if(queues[_0x5a82ab['uniqueid']][_0x9980('0xe')]){utils['info'](util[_0x9980('0x11')](_0x9980('0x1c'),_0x5a82ab[_0x9980('0x4')],queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0x1b')],queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0xe')]));queues[queues[_0x5a82ab['uniqueid']][_0x9980('0xe')]]=queues[_0x5a82ab[_0x9980('0x4')]];queues[queues[_0x5a82ab[_0x9980('0x4')]][_0x9980('0xe')]][_0x9980('0x1d')]=0x2;delete queues[_0x5a82ab[_0x9980('0x4')]];}}}catch(_0x474b80){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x1e'),_0x5a82ab[_0x9980('0x4')]),_0x474b80);}};exports['varset']=function(_0x28918d){try{utils['debug'](util[_0x9980('0x11')](_0x9980('0x1f'),_0x28918d['uniqueid']),_0x28918d);if(!_[_0x9980('0x17')](_0x28918d[_0x9980('0x20')][_0x9980('0x21')])&&_0x28918d[_0x9980('0x22')][_0x9980('0x23')]()!==_0x9980('0x24')){if(!_['isNil'](queues[_0x28918d[_0x9980('0x4')]])){queues[_0x28918d['uniqueid']][_0x9980('0x25')]=![];queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x26')]=null;queues[_0x28918d['uniqueid']][_0x9980('0x27')]=!![];queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x28')]=utils['now']();queues[_0x28918d['uniqueid']]['queuecallerexitreason']=_0x28918d['value'][_0x9980('0x23')]();utils['info'](util[_0x9980('0x11')](_0x9980('0x29'),_0x28918d[_0x9980('0x4')],queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x1b')],_0x28918d[_0x9980('0x22')],queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x8')]));writeDB(queues[_0x28918d[_0x9980('0x4')]]);}}else if(!_[_0x9980('0x17')](_0x28918d['variable'][_0x9980('0x2a')])){if(!_[_0x9980('0x17')](queues[_0x28918d[_0x9980('0x4')]])&&!queues[_0x28918d['uniqueid']][_0x9980('0x25')]){queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x25')]=![];queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x26')]=null;queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x27')]=!![];queues[_0x28918d['uniqueid']][_0x9980('0x28')]=utils[_0x9980('0x2b')]();queues[_0x28918d[_0x9980('0x4')]]['queuecallerexitreason']=_0x9980('0x2c');utils[_0x9980('0x2')](util[_0x9980('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x28918d[_0x9980('0x4')],queues[_0x28918d[_0x9980('0x4')]][_0x9980('0x1b')],_0x28918d[_0x9980('0x22')],queues[_0x28918d['uniqueid']][_0x9980('0x8')]));}}}catch(_0xfaf814){utils['error'](util[_0x9980('0x11')](_0x9980('0x1f'),_0x28918d[_0x9980('0x4')]),_0xfaf814);}};exports[_0x9980('0x25')]=function(_0x1c27cf){try{if(!_[_0x9980('0x17')](queues[_0x1c27cf[_0x9980('0x4')]])){utils['debug'](util['format'](_0x9980('0x2d'),_0x1c27cf[_0x9980('0x4')]),_0x1c27cf);queues[_0x1c27cf[_0x9980('0x4')]][_0x9980('0x27')]=![];queues[_0x1c27cf[_0x9980('0x4')]][_0x9980('0x28')]=null;queues[_0x1c27cf['uniqueid']][_0x9980('0x25')]=!![];queues[_0x1c27cf[_0x9980('0x4')]][_0x9980('0x26')]=utils[_0x9980('0x2b')]();queues[_0x1c27cf[_0x9980('0x4')]][_0x9980('0x8')]=_0x9980('0x2e');utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x2f'),_0x1c27cf[_0x9980('0x4')],queues[_0x1c27cf[_0x9980('0x4')]]['name'],queues[_0x1c27cf[_0x9980('0x4')]][_0x9980('0x8')]));}}catch(_0x3e9495){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x2d'),_0x1c27cf[_0x9980('0x4')]),_0x3e9495);}};exports[_0x9980('0x30')]=function(_0x3ec779){try{if(!_[_0x9980('0x17')](queues[_0x3ec779['uniqueid']])){utils[_0x9980('0x10')](util['format'](_0x9980('0x31'),_0x3ec779[_0x9980('0x4')]),_0x3ec779);utils[_0x9980('0x2')](util[_0x9980('0x11')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3ec779[_0x9980('0x4')],queues[_0x3ec779[_0x9980('0x4')]][_0x9980('0x1b')],_0x3ec779['connectedlinenum'],_0x3ec779[_0x9980('0x32')]));queues[_0x3ec779['uniqueid']][_0x9980('0x30')]=!![];queues[_0x3ec779['uniqueid']]['queuecallerleaveAt']=utils[_0x9980('0x2b')]();queues[_0x3ec779[_0x9980('0x4')]][_0x9980('0x33')]=utils['diffTime'](queues[_0x3ec779[_0x9980('0x4')]][_0x9980('0x34')],queues[_0x3ec779['uniqueid']][_0x9980('0x35')]);queues[_0x3ec779['uniqueid']][_0x9980('0x12')]=_0x3ec779[_0x9980('0x12')];queues[_0x3ec779[_0x9980('0x4')]][_0x9980('0x36')]=_0x3ec779[_0x9980('0x36')];queues[_0x3ec779['uniqueid']][_0x9980('0x37')]=_0x3ec779[_0x9980('0x37')];queues[_0x3ec779[_0x9980('0x4')]][_0x9980('0x32')]=_0x3ec779[_0x9980('0x32')];}}catch(_0x4f6701){utils['error'](util[_0x9980('0x11')](_0x9980('0x31'),_0x3ec779[_0x9980('0x4')]),_0x4f6701);}};exports['agentconnect']=function(_0xe126f7){try{if(!_['isNil'](queues[_0xe126f7[_0x9980('0x4')]])){utils['debug'](util[_0x9980('0x11')](_0x9980('0x38'),_0xe126f7[_0x9980('0x4')]),_0xe126f7);utils['info'](util[_0x9980('0x11')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xe126f7[_0x9980('0x4')],queues[_0xe126f7['uniqueid']][_0x9980('0x1b')],_0xe126f7['membername'],_0xe126f7[_0x9980('0x39')]));queues[_0xe126f7[_0x9980('0x4')]][_0x9980('0x25')]=![];queues[_0xe126f7[_0x9980('0x4')]][_0x9980('0x25')]=![];queues[_0xe126f7[_0x9980('0x4')]][_0x9980('0x26')]=null;queues[_0xe126f7['uniqueid']][_0x9980('0x27')]=![];queues[_0xe126f7[_0x9980('0x4')]]['queuecallerexitreason']=null;queues[_0xe126f7[_0x9980('0x4')]]['queuecallerexitAt']=null;queues[_0xe126f7[_0x9980('0x4')]][_0x9980('0x3a')]=!![];queues[_0xe126f7[_0x9980('0x4')]][_0x9980('0x3b')]=_0xe126f7['destaccountcode'];queues[_0xe126f7[_0x9980('0x4')]]['lastAssignedTo']=_0xe126f7['membername'];}}catch(_0x426476){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x38'),_0xe126f7['uniqueid']),_0x426476);}};exports[_0x9980('0x3c')]=function(_0x47a6e1){try{if(!_[_0x9980('0x17')](queues[_0x47a6e1[_0x9980('0x4')]])){if(queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x34')]){utils['debug'](util[_0x9980('0x11')](_0x9980('0x3d'),_0x47a6e1[_0x9980('0x4')]),_0x47a6e1);queues[_0x47a6e1['uniqueid']][_0x9980('0x25')]=![];queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x25')]=![];queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x26')]=null;queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x27')]=![];queues[_0x47a6e1['uniqueid']][_0x9980('0x28')]=null;queues[_0x47a6e1[_0x9980('0x4')]]['assigned']=!![];queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x3e')]=_0x47a6e1[_0x9980('0x3f')];queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x18')]=!![];queues[_0x47a6e1[_0x9980('0x4')]]['queuecallercompleteAt']=utils[_0x9980('0x2b')]();if(_0x47a6e1['reason']==_0x9980('0x40')){if(!queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x40')]){queues[_0x47a6e1[_0x9980('0x4')]]['queuecallerexitreason']=_0x9980('0x41');}}else{queues[_0x47a6e1[_0x9980('0x4')]][_0x9980('0x8')]='COMPLETEDBY'+_0x47a6e1[_0x9980('0x42')][_0x9980('0x23')]();}utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x43'),_0x47a6e1[_0x9980('0x4')],queues[_0x47a6e1[_0x9980('0x4')]]['name'],_0x47a6e1[_0x9980('0x3f')],queues[_0x47a6e1['uniqueid']][_0x9980('0x8')]));writeDB(queues[_0x47a6e1[_0x9980('0x4')]]);}}}catch(_0x2e23d3){utils['error'](util[_0x9980('0x11')](_0x9980('0x3d'),_0x47a6e1[_0x9980('0x4')]),_0x2e23d3);}};exports[_0x9980('0x44')]=function(_0x2264d1){try{if(!_[_0x9980('0x17')](queues[_0x2264d1['transfereeuniqueid']])){utils[_0x9980('0x10')](util['format']('[%s][queues][blindtransfer]',_0x2264d1[_0x9980('0x4')]),_0x2264d1);queues[_0x2264d1[_0x9980('0x45')]]['transfer']=!![];queues[_0x2264d1[_0x9980('0x45')]][_0x9980('0x46')]=_0x9980('0x47');queues[_0x2264d1[_0x9980('0x45')]][_0x9980('0x48')]=_0x2264d1['extension'];queues[_0x2264d1[_0x9980('0x45')]][_0x9980('0x49')]=_0x2264d1[_0x9980('0x45')];queues[_0x2264d1['transfereeuniqueid']][_0x9980('0x8')]='BLINDTRANSFER';utils['info'](util[_0x9980('0x11')](_0x9980('0x4a'),_0x2264d1['uniqueid'],queues[_0x2264d1[_0x9980('0x45')]]['name'],_0x2264d1[_0x9980('0x45')],_0x2264d1[_0x9980('0x4b')]));}}catch(_0x402ecb){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x4c'),_0x2264d1['uniqueid']),_0x402ecb);}};exports['attendedtransfer']=function(_0xb2b1e9){try{utils[_0x9980('0x10')](util['format'](_0x9980('0x4d'),_0xb2b1e9[_0x9980('0x4e')]),_0xb2b1e9);if(_0xb2b1e9[_0x9980('0x4e')]==_0xb2b1e9[_0x9980('0x4f')]){if(!_[_0x9980('0x17')](queues[_0xb2b1e9[_0x9980('0x50')]])){utils[_0x9980('0x2')](util['format'](_0x9980('0x51'),_0xb2b1e9[_0x9980('0x4e')],queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x1b')],_0xb2b1e9[_0x9980('0x52')]));queues[_0xb2b1e9[_0x9980('0x50')]]['transfer']=!![];queues[_0xb2b1e9[_0x9980('0x50')]]['transfertype']=_0x9980('0x53');queues[_0xb2b1e9['secondtransfererlinkedid']][_0x9980('0x48')]=_0xb2b1e9[_0x9980('0x52')];queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x49')]=_0xb2b1e9[_0x9980('0x4e')];queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x8')]=_0x9980('0x54');}if(!_['isNil'](queues[_0xb2b1e9['origtransfererlinkedid']])){if(_0xb2b1e9['transfereelinkedid']&&queues[_0xb2b1e9[_0x9980('0x55')]]){queues[_0xb2b1e9[_0x9980('0x55')]]['queuecallerenterreason']=0x1;queues[_0xb2b1e9[_0x9980('0x45')]]=_[_0x9980('0x56')](queues[_0xb2b1e9[_0x9980('0x55')]]);queues[_0xb2b1e9[_0x9980('0x45')]]['transfereduniqueid']=_0xb2b1e9['transfertargetuniqueid'];queues[_0xb2b1e9['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0xb2b1e9[_0x9980('0x45')]][_0x9980('0x7')]=queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x7')];queues[_0xb2b1e9['transfereeuniqueid']][_0x9980('0x57')]=queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x57')];queues[_0xb2b1e9[_0x9980('0x45')]][_0x9980('0x35')]=utils['now']();queues[_0xb2b1e9[_0x9980('0x45')]][_0x9980('0x34')]=utils[_0x9980('0x2b')]();queues[_0xb2b1e9[_0x9980('0x45')]][_0x9980('0x33')]=0x0;queues[_0xb2b1e9[_0x9980('0x45')]]['mohtime']=0x0;utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x58'),_0xb2b1e9[_0x9980('0x4e')],queues[_0xb2b1e9['transfereeuniqueid']][_0x9980('0x1b')],queues[_0xb2b1e9['transfereeuniqueid']]['calleridnum'],queues[_0xb2b1e9[_0x9980('0x45')]][_0x9980('0x57')]));}else{utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x59'),_0xb2b1e9[_0x9980('0x4e')],queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x1b')],_0xb2b1e9[_0x9980('0x50')]));queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0xe')]=_0xb2b1e9['secondtransfererlinkedid'];}}}else if(_0xb2b1e9[_0x9980('0x5a')]==_0xb2b1e9[_0x9980('0x50')]){if(!_['isNil'](queues[_0xb2b1e9[_0x9980('0x4f')]])){utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x5b'),_0xb2b1e9[_0x9980('0x4e')],queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x1b')],_0xb2b1e9[_0x9980('0x5a')],_0xb2b1e9[_0x9980('0x5c')]));queues[_0xb2b1e9[_0x9980('0x4f')]]['transfer']=!![];queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x46')]='ATTENDED';queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x48')]=_0xb2b1e9[_0x9980('0x5c')];queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x49')]=_0xb2b1e9[_0x9980('0x5a')];queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x8')]=_0x9980('0x54');}if(!_[_0x9980('0x17')](queues[_0xb2b1e9[_0x9980('0x50')]])){if(_0xb2b1e9[_0x9980('0x5d')]&&queues[_0xb2b1e9[_0x9980('0x5d')]]){queues[_0xb2b1e9['transfertargetlinkedid']][_0x9980('0x1d')]=0x1;queues[_0xb2b1e9[_0x9980('0x5e')]]=_['clone'](queues[_0xb2b1e9[_0x9980('0x5d')]]);queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0xe')]=_0xb2b1e9[_0x9980('0x5e')];queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x1d')]=0x2;queues[_0xb2b1e9['transfertargetuniqueid']][_0x9980('0x7')]=queues[_0xb2b1e9[_0x9980('0x4f')]][_0x9980('0x7')];queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x57')]=queues[_0xb2b1e9[_0x9980('0x4f')]]['calleridname'];queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x35')]=utils[_0x9980('0x2b')]();queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x34')]=utils[_0x9980('0x2b')]();queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x33')]=0x0;queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x5f')]=0x0;utils['info'](util[_0x9980('0x11')](_0x9980('0x60'),_0xb2b1e9['origtransfereruniqueid'],queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x1b')],queues[_0xb2b1e9['transfertargetuniqueid']][_0x9980('0xe')],queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x7')],queues[_0xb2b1e9[_0x9980('0x5e')]][_0x9980('0x57')]));}else{utils['info'](util[_0x9980('0x11')](_0x9980('0x59'),_0xb2b1e9['origtransfereruniqueid'],queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0x1b')],_0xb2b1e9[_0x9980('0x4f')]));queues[_0xb2b1e9[_0x9980('0x50')]][_0x9980('0xe')]=_0xb2b1e9[_0x9980('0x4f')];}}}}catch(_0x23ee4e){utils[_0x9980('0x14')](util[_0x9980('0x11')](_0x9980('0x4d'),_0xb2b1e9['origtransfereruniqueid']),_0x23ee4e);}};exports[_0x9980('0x61')]=function(_0x3bb6b4){try{if(!_[_0x9980('0x17')](queues[_0x3bb6b4[_0x9980('0x4')]])){utils[_0x9980('0x10')](util[_0x9980('0x11')](_0x9980('0x62'),_0x3bb6b4['uniqueid']),_0x3bb6b4);queues[_0x3bb6b4[_0x9980('0x4')]][_0x9980('0x63')]=utils[_0x9980('0x2b')]();utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x64'),_0x3bb6b4['uniqueid'],queues[_0x3bb6b4[_0x9980('0x4')]][_0x9980('0x1b')],queues[_0x3bb6b4[_0x9980('0x4')]][_0x9980('0x63')]));}}catch(_0x1e93be){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0x3bb6b4[_0x9980('0x4')]),_0x1e93be);}};exports['musiconholdstop']=function(_0x463b43){try{if(!_[_0x9980('0x17')](queues[_0x463b43['uniqueid']])){if(!_[_0x9980('0x17')](queues[_0x463b43[_0x9980('0x4')]][_0x9980('0x63')])){utils[_0x9980('0x10')](util[_0x9980('0x11')](_0x9980('0x65'),_0x463b43[_0x9980('0x4')]),_0x463b43);queues[_0x463b43[_0x9980('0x4')]][_0x9980('0x5f')]+=utils[_0x9980('0x66')](utils[_0x9980('0x2b')](),queues[_0x463b43[_0x9980('0x4')]][_0x9980('0x63')]);utils[_0x9980('0x2')](util[_0x9980('0x11')](_0x9980('0x67'),_0x463b43[_0x9980('0x4')],queues[_0x463b43[_0x9980('0x4')]][_0x9980('0x1b')],queues[_0x463b43['uniqueid']][_0x9980('0x5f')]));delete queues[_0x463b43[_0x9980('0x4')]]['musiconholdstartAt'];}}}catch(_0x17aae4){utils[_0x9980('0x14')](util[_0x9980('0x11')]('[%s][queues][musiconholdstop]',_0x463b43[_0x9980('0x4')]),_0x17aae4);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2b2eb21..1d77941 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 _0xf498=['lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','getUserByInternal','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','varset','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','endsWith','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]'];(function(_0x224ad0,_0x2482bd){var _0x2e04fc=function(_0x5ee761){while(--_0x5ee761){_0x224ad0['push'](_0x224ad0['shift']());}};_0x2e04fc(++_0x2482bd);}(_0xf498,0xdb));var _0x8f49=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf498[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x8f49('0x0'));var util=require(_0x8f49('0x1'));var utils=require(_0x8f49('0x2'));var transfers=require(_0x8f49('0x3'));var recordings={};function writeDB(_0x4e1610){var _0x510355;utils[_0x8f49('0x4')](util[_0x8f49('0x5')](_0x8f49('0x6'),_0x4e1610['uniqueid']));if(transfers[_0x8f49('0x7')][_0x4e1610['uniqueid']]){_0x510355=_0x4e1610['uniqueid'];_0x4e1610[_0x8f49('0x8')]=transfers['blinds'][_0x4e1610['uniqueid']]['transfereeuniqueid'];}if(_0x4e1610['accountcode']){utils[_0x8f49('0x9')](_0x4e1610[_0x8f49('0xa')])[_0x8f49('0xb')](function(_0x4da7d9){if(_0x4da7d9){_0x4e1610['membername']=_0x4da7d9[_0x8f49('0xc')];_0x4e1610[_0x8f49('0xd')]=_0x4da7d9['id'];}utils[_0x8f49('0xe')](_0x8f49('0xf'),_0x4e1610);});}else{utils[_0x8f49('0xe')](_0x8f49('0xf'),_0x4e1610);}if(_0x510355)delete transfers[_0x8f49('0x7')][_0x510355];}exports[_0x8f49('0x10')]=function(_0x36b19d){try{utils['debug'](util[_0x8f49('0x5')](_0x8f49('0x11'),_0x36b19d[_0x8f49('0x8')]),_0x36b19d);if(_0x36b19d['uniqueid']==_0x36b19d['linkedid']){utils[_0x8f49('0x4')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x36b19d['uniqueid'],_0x36b19d[_0x8f49('0x12')],_0x36b19d['exten']));recordings[_0x36b19d[_0x8f49('0x8')]]={'uniqueid':_0x36b19d[_0x8f49('0x8')],'accountcode':_0x36b19d[_0x8f49('0xa')],'exten':_0x36b19d[_0x8f49('0x13')],'context':_0x36b19d['context'],'channel':_0x36b19d[_0x8f49('0x14')],'monitors':[]};}}catch(_0x4dc8d2){utils[_0x8f49('0x15')](util[_0x8f49('0x5')](_0x8f49('0x11'),_0x36b19d[_0x8f49('0x8')]),_0x4dc8d2);}};exports[_0x8f49('0x16')]=function(_0x517280){try{utils[_0x8f49('0x17')](util[_0x8f49('0x5')](_0x8f49('0x18'),_0x517280['uniqueid']),_0x517280);if(!_['isNil'](recordings[_0x517280[_0x8f49('0x8')]])&&_0x517280[_0x8f49('0x19')]==0x6){utils[_0x8f49('0x4')](util['format'](_0x8f49('0x1a'),_0x517280[_0x8f49('0x8')],_0x517280[_0x8f49('0x12')],_0x517280[_0x8f49('0x14')]));}else if(!_[_0x8f49('0x1b')](recordings[_0x517280['linkedid']])&&_0x517280['channelstate']==0x6&&_0x517280['context']!=_0x8f49('0x1c')){utils[_0x8f49('0x4')](util[_0x8f49('0x5')](_0x8f49('0x1d'),_0x517280[_0x8f49('0x8')],_0x517280[_0x8f49('0x1e')],_0x517280[_0x8f49('0x12')],_0x517280['channel']));recordings[_0x517280[_0x8f49('0x1e')]][_0x8f49('0xa')]=_0x517280[_0x8f49('0xa')];}}catch(_0x2222a6){utils[_0x8f49('0x15')](util[_0x8f49('0x5')](_0x8f49('0x18'),_0x517280[_0x8f49('0x8')]),_0x2222a6);}};exports[_0x8f49('0x1f')]=function(_0x5103aa){try{if(!_[_0x8f49('0x1b')](_0x5103aa['variable'])&&!_[_0x8f49('0x1b')](_0x5103aa['variable'][_0x8f49('0x20')])){utils[_0x8f49('0x17')](util[_0x8f49('0x5')](_0x8f49('0x21'),_0x5103aa[_0x8f49('0x8')]),_0x5103aa);utils[_0x8f49('0x4')](util[_0x8f49('0x5')](_0x8f49('0x22'),_0x5103aa[_0x8f49('0x8')],_0x5103aa[_0x8f49('0x23')],_0x5103aa['value']));if(_[_0x8f49('0x24')](_0x5103aa[_0x8f49('0x25')],_0x8f49('0x26'))){_0x5103aa[_0x8f49('0x25')]=_0x5103aa['value']['replace'](_0x8f49('0x26'),_0x8f49('0x27'));}if(recordings[_0x5103aa[_0x8f49('0x1e')]]){var _0x2970b1=_[_0x8f49('0x28')](recordings[_0x5103aa[_0x8f49('0x1e')]][_0x8f49('0x29')],{'value':_0x5103aa[_0x8f49('0x25')]});if(_[_0x8f49('0x1b')](_0x2970b1)){recordings[_0x5103aa['linkedid']]['monitors'][_0x8f49('0x2a')]({'value':_0x5103aa[_0x8f49('0x25')]});}}}}catch(_0x237453){utils[_0x8f49('0x15')](util[_0x8f49('0x5')](_0x8f49('0x21'),_0x5103aa[_0x8f49('0x8')]),_0x237453);}};exports[_0x8f49('0x2b')]=function(_0x483f31){try{if(!_[_0x8f49('0x1b')](recordings[_0x483f31['uniqueid']])){utils['debug'](util[_0x8f49('0x5')](_0x8f49('0x2c'),_0x483f31[_0x8f49('0x8')]),_0x483f31);utils[_0x8f49('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x483f31[_0x8f49('0x8')],_0x483f31[_0x8f49('0x2d')],_0x483f31[_0x8f49('0x2e')],_0x483f31[_0x8f49('0x2f')]));recordings[_0x483f31[_0x8f49('0x8')]]['calleridnum']=_0x483f31[_0x8f49('0x2d')];recordings[_0x483f31[_0x8f49('0x8')]][_0x8f49('0x2e')]=_0x483f31['calleridname'];recordings[_0x483f31[_0x8f49('0x8')]][_0x8f49('0x30')]=_0x483f31['connectedlinenum'];recordings[_0x483f31[_0x8f49('0x8')]]['connectedlinename']=_0x483f31[_0x8f49('0x31')];if(recordings[_0x483f31[_0x8f49('0x8')]][_0x8f49('0x32')]==_0x8f49('0x33')&&recordings[_0x483f31[_0x8f49('0x8')]][_0x8f49('0xa')]){recordings[_0x483f31[_0x8f49('0x8')]]['connectedlinenum']=recordings[_0x483f31[_0x8f49('0x8')]][_0x8f49('0xa')];recordings[_0x483f31[_0x8f49('0x8')]]['connectedlinename']='';}recordings[_0x483f31[_0x8f49('0x8')]]['monitors'][_0x8f49('0x34')](function(_0x7978ae){var _0x67772a=_['clone'](recordings[_0x483f31[_0x8f49('0x8')]]);_0x67772a['value']=_0x7978ae[_0x8f49('0x25')];writeDB(_0x67772a);});delete recordings[_0x483f31[_0x8f49('0x8')]];}}catch(_0x3daf0a){utils[_0x8f49('0x15')](util['format'](_0x8f49('0x2c'),_0x483f31[_0x8f49('0x8')]),_0x3daf0a);}};exports[_0x8f49('0x35')]=function(_0x58ccd5){try{if(!_[_0x8f49('0x1b')](recordings[_0x58ccd5[_0x8f49('0x8')]])){utils[_0x8f49('0x17')](util[_0x8f49('0x5')](_0x8f49('0x36'),_0x58ccd5[_0x8f49('0x8')]),_0x58ccd5);utils[_0x8f49('0x4')](util[_0x8f49('0x5')](_0x8f49('0x37'),_0x58ccd5[_0x8f49('0x8')],_0x58ccd5[_0x8f49('0x38')],_0x58ccd5[_0x8f49('0x39')]));if(_0x58ccd5[_0x8f49('0x38')]['toLowerCase']()=='set'&&_[_0x8f49('0x3a')](_0x58ccd5[_0x8f49('0x39')][_0x8f49('0x3b')](),_0x8f49('0x3c'))){var _0x5af22e=_0x58ccd5[_0x8f49('0x39')][_0x8f49('0x3d')]('=');var _0xba1e26=_0x5af22e[0x0]['substring'](_0x5af22e[0x0]['lastIndexOf']('(')+0x1,_0x5af22e[0x0][_0x8f49('0x3e')](')'));var _0x5c38f0=_0x5af22e[0x1];recordings[_0x58ccd5[_0x8f49('0x8')]][_0xba1e26]=_0x5c38f0;}}}catch(_0x2f447a){utils['error'](util[_0x8f49('0x5')](_0x8f49('0x36'),_0x58ccd5['uniqueid']),_0x2f447a);}};exports[_0x8f49('0x3f')]=function(_0x3255be){try{if(!_[_0x8f49('0x1b')](recordings[_0x3255be[_0x8f49('0x8')]])){utils[_0x8f49('0x17')](util[_0x8f49('0x5')](_0x8f49('0x40'),_0x3255be[_0x8f49('0x8')]),_0x3255be);utils['info'](util[_0x8f49('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3255be[_0x8f49('0x8')],_0x3255be[_0x8f49('0x41')]));recordings[_0x3255be[_0x8f49('0x8')]]['queue']=_0x3255be[_0x8f49('0x41')];}}catch(_0x5a43d6){utils['error'](util[_0x8f49('0x5')](_0x8f49('0x40'),_0x3255be[_0x8f49('0x8')]),_0x5a43d6);}};exports[_0x8f49('0x42')]=function(_0x2194e7){try{utils[_0x8f49('0x17')](util[_0x8f49('0x5')]('[%s][recordings][blindtransfer]',_0x2194e7[_0x8f49('0x8')]),_0x2194e7);utils[_0x8f49('0x4')](util[_0x8f49('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2194e7['uniqueid'],_0x2194e7[_0x8f49('0x43')],_0x2194e7['transferercalleridname'],_0x2194e7[_0x8f49('0x44')],_0x2194e7[_0x8f49('0x45')]));if(recordings[_0x2194e7[_0x8f49('0x46')]]&&transfers[_0x8f49('0x7')][_0x2194e7[_0x8f49('0x46')]]){transfers['blinds'][_0x2194e7['transfereruniqueid']][_0x8f49('0x47')]=!![];}}catch(_0x3ace29){utils[_0x8f49('0x15')](util[_0x8f49('0x5')](_0x8f49('0x48'),_0x2194e7[_0x8f49('0x8')]),_0x3ace29);}}; \ No newline at end of file +var _0x64be=['calleridname','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','varset','variable','mixmonitor_filename','endsWith','.wav49','value','replace','.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum'];(function(_0x54a687,_0x4ce189){var _0x4b5083=function(_0x4e9dc7){while(--_0x4e9dc7){_0x54a687['push'](_0x54a687['shift']());}};_0x4b5083(++_0x4ce189);}(_0x64be,0x1c3));var _0xe64b=function(_0x5625b5,_0x1dfcc0){_0x5625b5=_0x5625b5-0x0;var _0x91a58f=_0x64be[_0x5625b5];return _0x91a58f;};'use strict';var _=require(_0xe64b('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x5a4101){var _0x1aa4a3;utils[_0xe64b('0x1')](util[_0xe64b('0x2')]('[%s][recordings][writeDB]',_0x5a4101[_0xe64b('0x3')]));if(transfers['blinds'][_0x5a4101[_0xe64b('0x3')]]){_0x1aa4a3=_0x5a4101[_0xe64b('0x3')];_0x5a4101[_0xe64b('0x3')]=transfers[_0xe64b('0x4')][_0x5a4101[_0xe64b('0x3')]][_0xe64b('0x5')];}if(_0x5a4101[_0xe64b('0x6')]){utils['getUserByInternal'](_0x5a4101[_0xe64b('0x6')])[_0xe64b('0x7')](function(_0x2484f9){if(_0x2484f9){_0x5a4101['membername']=_0x2484f9['name'];_0x5a4101['UserId']=_0x2484f9['id'];}utils[_0xe64b('0x8')]('CreateVoiceRecording',_0x5a4101);});}else{utils[_0xe64b('0x8')](_0xe64b('0x9'),_0x5a4101);}if(_0x1aa4a3)delete transfers[_0xe64b('0x4')][_0x1aa4a3];}exports[_0xe64b('0xa')]=function(_0x2e40a9){try{utils[_0xe64b('0xb')](util['format']('[%s][recordings][newchannel]',_0x2e40a9[_0xe64b('0x3')]),_0x2e40a9);if(_0x2e40a9[_0xe64b('0x3')]==_0x2e40a9['linkedid']){utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0xc'),_0x2e40a9['uniqueid'],_0x2e40a9[_0xe64b('0xd')],_0x2e40a9[_0xe64b('0xe')]));recordings[_0x2e40a9['uniqueid']]={'uniqueid':_0x2e40a9[_0xe64b('0x3')],'accountcode':_0x2e40a9[_0xe64b('0x6')],'exten':_0x2e40a9['exten'],'context':_0x2e40a9[_0xe64b('0xd')],'channel':_0x2e40a9['channel'],'monitors':[]};}}catch(_0x218955){utils[_0xe64b('0xf')](util[_0xe64b('0x2')]('[%s][recordings][newchannel]',_0x2e40a9[_0xe64b('0x3')]),_0x218955);}};exports[_0xe64b('0x10')]=function(_0x4c29d7){try{utils['debug'](util[_0xe64b('0x2')](_0xe64b('0x11'),_0x4c29d7[_0xe64b('0x3')]),_0x4c29d7);if(!_[_0xe64b('0x12')](recordings[_0x4c29d7[_0xe64b('0x3')]])&&_0x4c29d7[_0xe64b('0x13')]==0x6){utils['info'](util[_0xe64b('0x2')](_0xe64b('0x14'),_0x4c29d7[_0xe64b('0x3')],_0x4c29d7[_0xe64b('0xd')],_0x4c29d7[_0xe64b('0x15')]));}else if(!_[_0xe64b('0x12')](recordings[_0x4c29d7['linkedid']])&&_0x4c29d7[_0xe64b('0x13')]==0x6&&_0x4c29d7['context']!=_0xe64b('0x16')){utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0x17'),_0x4c29d7[_0xe64b('0x3')],_0x4c29d7[_0xe64b('0x18')],_0x4c29d7[_0xe64b('0xd')],_0x4c29d7[_0xe64b('0x15')]));recordings[_0x4c29d7[_0xe64b('0x18')]][_0xe64b('0x6')]=_0x4c29d7[_0xe64b('0x6')];}}catch(_0x76d1be){utils[_0xe64b('0xf')](util['format'](_0xe64b('0x11'),_0x4c29d7[_0xe64b('0x3')]),_0x76d1be);}};exports[_0xe64b('0x19')]=function(_0x3d5d9b){try{if(!_[_0xe64b('0x12')](_0x3d5d9b[_0xe64b('0x1a')])&&!_[_0xe64b('0x12')](_0x3d5d9b['variable'][_0xe64b('0x1b')])){utils[_0xe64b('0xb')](util[_0xe64b('0x2')]('[%s][recordings][varset]',_0x3d5d9b[_0xe64b('0x3')]),_0x3d5d9b);utils[_0xe64b('0x1')](util[_0xe64b('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3d5d9b['uniqueid'],_0x3d5d9b[_0xe64b('0x1a')],_0x3d5d9b['value']));if(_[_0xe64b('0x1c')](_0x3d5d9b['value'],_0xe64b('0x1d'))){_0x3d5d9b['value']=_0x3d5d9b[_0xe64b('0x1e')][_0xe64b('0x1f')](_0xe64b('0x1d'),_0xe64b('0x20'));}if(recordings[_0x3d5d9b[_0xe64b('0x18')]]){var _0x13563b=_['find'](recordings[_0x3d5d9b['linkedid']][_0xe64b('0x21')],{'value':_0x3d5d9b[_0xe64b('0x1e')]});if(_[_0xe64b('0x12')](_0x13563b)){recordings[_0x3d5d9b[_0xe64b('0x18')]][_0xe64b('0x21')][_0xe64b('0x22')]({'value':_0x3d5d9b[_0xe64b('0x1e')]});}}}}catch(_0x4bbc41){utils['error'](util['format'](_0xe64b('0x23'),_0x3d5d9b[_0xe64b('0x3')]),_0x4bbc41);}};exports[_0xe64b('0x24')]=function(_0x43559){try{if(!_['isNil'](recordings[_0x43559[_0xe64b('0x3')]])){utils[_0xe64b('0xb')](util[_0xe64b('0x2')]('[%s][recordings][hangup]',_0x43559[_0xe64b('0x3')]),_0x43559);utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0x25'),_0x43559[_0xe64b('0x3')],_0x43559[_0xe64b('0x26')],_0x43559[_0xe64b('0x27')],_0x43559['cause-txt']));recordings[_0x43559[_0xe64b('0x3')]][_0xe64b('0x26')]=_0x43559[_0xe64b('0x26')];recordings[_0x43559['uniqueid']][_0xe64b('0x27')]=_0x43559[_0xe64b('0x27')];recordings[_0x43559['uniqueid']][_0xe64b('0x28')]=_0x43559['connectedlinenum'];recordings[_0x43559['uniqueid']][_0xe64b('0x29')]=_0x43559[_0xe64b('0x29')];if(recordings[_0x43559[_0xe64b('0x3')]][_0xe64b('0x2a')]==_0xe64b('0x2b')&&recordings[_0x43559['uniqueid']]['accountcode']){recordings[_0x43559[_0xe64b('0x3')]][_0xe64b('0x28')]=recordings[_0x43559[_0xe64b('0x3')]]['accountcode'];recordings[_0x43559[_0xe64b('0x3')]]['connectedlinename']='';}recordings[_0x43559['uniqueid']][_0xe64b('0x21')]['forEach'](function(_0x1097d0){var _0xd5eb5d=_[_0xe64b('0x2c')](recordings[_0x43559[_0xe64b('0x3')]]);_0xd5eb5d[_0xe64b('0x1e')]=_0x1097d0[_0xe64b('0x1e')];writeDB(_0xd5eb5d);});delete recordings[_0x43559[_0xe64b('0x3')]];}}catch(_0x2fa131){utils[_0xe64b('0xf')](util[_0xe64b('0x2')](_0xe64b('0x2d'),_0x43559[_0xe64b('0x3')]),_0x2fa131);}};exports[_0xe64b('0x2e')]=function(_0x34b143){try{if(!_[_0xe64b('0x12')](recordings[_0x34b143[_0xe64b('0x3')]])){utils[_0xe64b('0xb')](util['format'](_0xe64b('0x2f'),_0x34b143['uniqueid']),_0x34b143);utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0x30'),_0x34b143[_0xe64b('0x3')],_0x34b143['application'],_0x34b143[_0xe64b('0x31')]));if(_0x34b143[_0xe64b('0x32')][_0xe64b('0x33')]()==_0xe64b('0x34')&&_[_0xe64b('0x35')](_0x34b143[_0xe64b('0x31')]['toLowerCase'](),_0xe64b('0x36'))){var _0x2b76b3=_0x34b143[_0xe64b('0x31')][_0xe64b('0x37')]('=');var _0xe66a4b=_0x2b76b3[0x0]['substring'](_0x2b76b3[0x0][_0xe64b('0x38')]('(')+0x1,_0x2b76b3[0x0][_0xe64b('0x38')](')'));var _0x3214d3=_0x2b76b3[0x1];recordings[_0x34b143[_0xe64b('0x3')]][_0xe66a4b]=_0x3214d3;}}}catch(_0x4e8d2a){utils['error'](util[_0xe64b('0x2')]('[%s][recordings][newexten]',_0x34b143[_0xe64b('0x3')]),_0x4e8d2a);}};exports[_0xe64b('0x39')]=function(_0xe93b9){try{if(!_[_0xe64b('0x12')](recordings[_0xe93b9[_0xe64b('0x3')]])){utils[_0xe64b('0xb')](util[_0xe64b('0x2')](_0xe64b('0x3a'),_0xe93b9['uniqueid']),_0xe93b9);utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0x3b'),_0xe93b9[_0xe64b('0x3')],_0xe93b9['queue']));recordings[_0xe93b9[_0xe64b('0x3')]][_0xe64b('0x3c')]=_0xe93b9[_0xe64b('0x3c')];}}catch(_0x1c3733){utils[_0xe64b('0xf')](util['format'](_0xe64b('0x3a'),_0xe93b9[_0xe64b('0x3')]),_0x1c3733);}};exports[_0xe64b('0x3d')]=function(_0x11dba2){try{utils[_0xe64b('0xb')](util[_0xe64b('0x2')]('[%s][recordings][blindtransfer]',_0x11dba2[_0xe64b('0x3')]),_0x11dba2);utils[_0xe64b('0x1')](util[_0xe64b('0x2')](_0xe64b('0x3e'),_0x11dba2[_0xe64b('0x3')],_0x11dba2[_0xe64b('0x3f')],_0x11dba2[_0xe64b('0x40')],_0x11dba2[_0xe64b('0x41')],_0x11dba2[_0xe64b('0x42')]));if(recordings[_0x11dba2[_0xe64b('0x43')]]&&transfers['blinds'][_0x11dba2['transfereruniqueid']]){transfers[_0xe64b('0x4')][_0x11dba2[_0xe64b('0x43')]][_0xe64b('0x44')]=!![];}}catch(_0x839f1a){utils['error'](util[_0xe64b('0x2')](_0xe64b('0x45'),_0x11dba2[_0xe64b('0x3')]),_0x839f1a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 44ec333..e8b2047 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 _0x3d6b=['transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil'];(function(_0x5ec25b,_0x1ff58e){var _0x4fe26f=function(_0x3997cf){while(--_0x3997cf){_0x5ec25b['push'](_0x5ec25b['shift']());}};_0x4fe26f(++_0x1ff58e);}(_0x3d6b,0x87));var _0xb3d6=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x3d6b[_0x2d4065];return _0xef6016;};'use strict';var _=require(_0xb3d6('0x0'));var util=require(_0xb3d6('0x1'));var utils=require('./utils');function writeDB(_0x22ef8e){utils['info'](util[_0xb3d6('0x2')](_0xb3d6('0x3'),_0x22ef8e[_0xb3d6('0x4')]===_0xb3d6('0x5')?_0x22ef8e[_0xb3d6('0x6')]:_0x22ef8e[_0xb3d6('0x7')],_0x22ef8e[_0xb3d6('0x4')]));utils[_0xb3d6('0x8')](_0xb3d6('0x9'),_0x22ef8e);}exports['blinds']={};exports[_0xb3d6('0xa')]=function(_0x6b8e21){try{utils[_0xb3d6('0xb')](util['format'](_0xb3d6('0xc'),_0x6b8e21[_0xb3d6('0x7')]),_0x6b8e21);utils[_0xb3d6('0xd')](util[_0xb3d6('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x6b8e21[_0xb3d6('0x7')],_0x6b8e21[_0xb3d6('0xe')],_0x6b8e21[_0xb3d6('0xf')],_0x6b8e21[_0xb3d6('0x10')],_0x6b8e21['transfereecalleridname']));_0x6b8e21[_0xb3d6('0x4')]=_0xb3d6('0x11');exports[_0xb3d6('0x12')][_0x6b8e21[_0xb3d6('0x13')]]=_0x6b8e21;writeDB(_0x6b8e21);}catch(_0xee9551){utils['error'](util['format'](_0xb3d6('0xc'),_0x6b8e21[_0xb3d6('0x7')]),_0xee9551);}};exports[_0xb3d6('0x14')]=function(_0x1dc5b0){try{utils[_0xb3d6('0xb')](util['format']('[%s][transfers][attendedtransfer]',_0x1dc5b0[_0xb3d6('0x6')]),_0x1dc5b0);utils[_0xb3d6('0xd')](util[_0xb3d6('0x2')](_0xb3d6('0x15'),_0x1dc5b0[_0xb3d6('0x6')],_0x1dc5b0[_0xb3d6('0x16')],_0x1dc5b0[_0xb3d6('0x17')],_0x1dc5b0['transfertargetcalleridnum'],_0x1dc5b0[_0xb3d6('0x18')]));_0x1dc5b0=_['assign'](_0x1dc5b0,{'transfererchannel':_0x1dc5b0['origtransfererchannel'],'transferercalleridnum':_0x1dc5b0['origtransferercalleridnum'],'transferercalleridname':_0x1dc5b0['origtransferercalleridname'],'transfererconnectedlinenum':_0x1dc5b0[_0xb3d6('0x19')],'transfererconnectedlinename':_0x1dc5b0[_0xb3d6('0x1a')],'transfereraccountcode':_0x1dc5b0[_0xb3d6('0x1b')],'transferercontext':_0x1dc5b0['secondtransferercontext'],'transfererexten':_0x1dc5b0[_0xb3d6('0x1c')],'transfererlinkedid':_0x1dc5b0[_0xb3d6('0x1d')],'context':_0x1dc5b0[_0xb3d6('0x1e')],'extension':_0x1dc5b0[_0xb3d6('0x1f')],'type':_0xb3d6('0x5')});if(_[_0xb3d6('0x20')](_0x1dc5b0[_0xb3d6('0x21')])){_0x1dc5b0=_[_0xb3d6('0x22')](_0x1dc5b0,{'transfereechannel':_0x1dc5b0['transfertargetchannel'],'transfereecalleridnum':_0x1dc5b0['transfertargetcalleridnum'],'transfereecalleridname':_0x1dc5b0[_0xb3d6('0x18')],'transfereeconnectedlinenum':_0x1dc5b0[_0xb3d6('0x23')],'transfereeconnectedlinename':_0x1dc5b0[_0xb3d6('0x24')],'transfereeaccountcode':_0x1dc5b0[_0xb3d6('0x25')],'transfereecontext':_0x1dc5b0[_0xb3d6('0x26')],'transfereeexten':_0x1dc5b0[_0xb3d6('0x27')],'transfereelinkedid':_0x1dc5b0[_0xb3d6('0x28')]});}writeDB(_0x1dc5b0);}catch(_0x2a864e){utils['error'](util[_0xb3d6('0x2')](_0xb3d6('0x29'),_0x1dc5b0[_0xb3d6('0x6')]),_0x2a864e);}}; \ No newline at end of file +var _0x37d5=['attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0x37d5,0x1b8));var _0x537d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x537d('0x0'));var util=require(_0x537d('0x1'));var utils=require(_0x537d('0x2'));function writeDB(_0x27849d){utils[_0x537d('0x3')](util['format'](_0x537d('0x4'),_0x27849d['type']===_0x537d('0x5')?_0x27849d[_0x537d('0x6')]:_0x27849d[_0x537d('0x7')],_0x27849d[_0x537d('0x8')]));utils[_0x537d('0x9')](_0x537d('0xa'),_0x27849d);}exports[_0x537d('0xb')]={};exports[_0x537d('0xc')]=function(_0x4cbcb8){try{utils[_0x537d('0xd')](util[_0x537d('0xe')](_0x537d('0xf'),_0x4cbcb8['uniqueid']),_0x4cbcb8);utils[_0x537d('0x3')](util['format'](_0x537d('0x10'),_0x4cbcb8['uniqueid'],_0x4cbcb8[_0x537d('0x11')],_0x4cbcb8[_0x537d('0x12')],_0x4cbcb8[_0x537d('0x13')],_0x4cbcb8['transfereecalleridname']));_0x4cbcb8['type']=_0x537d('0x14');exports[_0x537d('0xb')][_0x4cbcb8[_0x537d('0x15')]]=_0x4cbcb8;writeDB(_0x4cbcb8);}catch(_0x19d3c1){utils['error'](util[_0x537d('0xe')](_0x537d('0xf'),_0x4cbcb8[_0x537d('0x7')]),_0x19d3c1);}};exports[_0x537d('0x16')]=function(_0x58389b){try{utils[_0x537d('0xd')](util[_0x537d('0xe')](_0x537d('0x17'),_0x58389b[_0x537d('0x6')]),_0x58389b);utils[_0x537d('0x3')](util[_0x537d('0xe')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x58389b[_0x537d('0x6')],_0x58389b[_0x537d('0x18')],_0x58389b[_0x537d('0x19')],_0x58389b[_0x537d('0x1a')],_0x58389b[_0x537d('0x1b')]));_0x58389b=_['assign'](_0x58389b,{'transfererchannel':_0x58389b['origtransfererchannel'],'transferercalleridnum':_0x58389b[_0x537d('0x18')],'transferercalleridname':_0x58389b[_0x537d('0x19')],'transfererconnectedlinenum':_0x58389b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x58389b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x58389b[_0x537d('0x1c')],'transferercontext':_0x58389b['secondtransferercontext'],'transfererexten':_0x58389b[_0x537d('0x1d')],'transfererlinkedid':_0x58389b[_0x537d('0x1e')],'context':_0x58389b['origtransferercontext'],'extension':_0x58389b[_0x537d('0x1f')],'type':_0x537d('0x5')});if(_[_0x537d('0x20')](_0x58389b[_0x537d('0x21')])){_0x58389b=_[_0x537d('0x22')](_0x58389b,{'transfereechannel':_0x58389b['transfertargetchannel'],'transfereecalleridnum':_0x58389b[_0x537d('0x1a')],'transfereecalleridname':_0x58389b[_0x537d('0x1b')],'transfereeconnectedlinenum':_0x58389b[_0x537d('0x23')],'transfereeconnectedlinename':_0x58389b[_0x537d('0x24')],'transfereeaccountcode':_0x58389b[_0x537d('0x25')],'transfereecontext':_0x58389b[_0x537d('0x26')],'transfereeexten':_0x58389b[_0x537d('0x27')],'transfereelinkedid':_0x58389b[_0x537d('0x28')]});}writeDB(_0x58389b);}catch(_0x3aae73){utils[_0x537d('0x29')](util[_0x537d('0xe')](_0x537d('0x17'),_0x58389b[_0x537d('0x6')]),_0x3aae73);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b48fe84..d527246 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 _0x1454=['diff','now','isAfter','isBefore','jayson/promise','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','stringify','length','result','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1454,0x1a8));var _0x4145=function(_0xbe523d,_0x21e0d5){_0xbe523d=_0xbe523d-0x0;var _0x51e88e=_0x1454[_0xbe523d];return _0x51e88e;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4145('0x0'));var moment=require('moment');var util=require('util');var client=jayson[_0x4145('0x1')][_0x4145('0x2')]({'port':0x2329});var logger=require(_0x4145('0x3'))('xdr');exports[_0x4145('0x4')]=function(_0x1586ca,_0x2e7d0a){logger[_0x4145('0x4')](_0x1586ca,_0x2e7d0a?util[_0x4145('0x5')](_0x2e7d0a,{'showHidden':![],'depth':null}):'');};exports[_0x4145('0x6')]=function(_0x27b06e,_0x51cfa5){logger[_0x4145('0x6')](_0x27b06e,_0x51cfa5?util[_0x4145('0x5')](_0x51cfa5,{'showHidden':![],'depth':null}):'');};exports[_0x4145('0x7')]=function(_0x7743c5,_0x4e38ac){logger[_0x4145('0x7')](_0x7743c5,_0x4e38ac?util[_0x4145('0x5')](_0x4e38ac,{'showHidden':![],'depth':null}):'');};exports[_0x4145('0x8')]=function(_0x5bc30c,_0x300439){return client[_0x4145('0x8')](_0x5bc30c,{'body':_0x300439})[_0x4145('0x9')](function(_0x528ac6){logger[_0x4145('0x6')](_0x4145('0xa'),_0x5bc30c,_0x528ac6?util[_0x4145('0x5')](_0x528ac6,{'showHidden':![],'depth':null}):'');})[_0x4145('0xb')](function(_0x4ae60d){logger[_0x4145('0x7')]('[utils][request]\x20name:%s',_0x5bc30c,_0x4ae60d?util[_0x4145('0x5')](_0x4ae60d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x13f305){return client[_0x4145('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x4145('0xc'),_0x4145('0xd'),_0x4145('0xe')],'where':_0x13f305,'limit':0x1}})[_0x4145('0x9')](function(_0x4ad090){logger[_0x4145('0x6')]('[utils][getUser]\x20where:%s',JSON[_0x4145('0xf')](_0x13f305),_0x4ad090?util[_0x4145('0x5')](_0x4ad090,{'showHidden':![],'depth':null}):'');return _0x4ad090['result'][_0x4145('0x10')]?_0x4ad090[_0x4145('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0xf94015){return new BPromise(function(_0x595f8f,_0x8ea3a5){if(_0xf94015){return getUser({'internal':_0xf94015})['then'](function(_0x22c2a0){logger[_0x4145('0x4')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xf94015,_0x22c2a0?_0x4145('0x12'):_0x4145('0x13'));return _0x595f8f(_0x22c2a0);})[_0x4145('0xb')](function(_0x7870c7){logger[_0x4145('0x7')](_0x4145('0x14'),_0x7870c7?util['inspect'](_0x7870c7,{'showHidden':![],'depth':null}):'');return _0x595f8f(null);});}return _0x595f8f(null);});};exports['getUserByInterface']=function(_0x3420ea){return new BPromise(function(_0x7a5f87,_0x128932){if(_0x3420ea){return getUser({'interface':_0x3420ea})[_0x4145('0x9')](function(_0x21b4bd){logger['info'](_0x4145('0x15'),_0x3420ea,_0x21b4bd?_0x4145('0x12'):_0x4145('0x13'));return _0x7a5f87(_0x21b4bd);})[_0x4145('0xb')](function(_0x622528){logger[_0x4145('0x7')](_0x4145('0x16'),_0x622528?util['inspect'](_0x622528,{'showHidden':![],'depth':null}):'');return _0x7a5f87(null);});}return _0x7a5f87(null);});};exports[_0x4145('0x17')]=function(_0x1aa71d){return new BPromise(function(_0x2d18ac,_0x8475c7){if(_0x1aa71d){return getUser({'name':_0x1aa71d})['then'](function(_0x355d15){logger[_0x4145('0x4')](_0x4145('0x18'),_0x1aa71d,_0x355d15?'found':_0x4145('0x13'));return _0x2d18ac(_0x355d15);})[_0x4145('0xb')](function(_0x539e83){logger[_0x4145('0x7')](_0x4145('0x19'),_0x539e83?util[_0x4145('0x5')](_0x539e83,{'showHidden':![],'depth':null}):'');return _0x2d18ac(null);});}return _0x2d18ac(null);});};exports[_0x4145('0x1a')]=function(_0x1abf4e){return new BPromise(function(_0x556099,_0x569254){if(_0x1abf4e){return client[_0x4145('0x8')](_0x4145('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x4145('0xd'),_0x4145('0x1c'),_0x4145('0x1d'),'acwTimeout'],'where':{'name':_0x1abf4e},'limit':0x1}})['then'](function(_0x26614f){logger['debug'](_0x4145('0x1e'),_0x1abf4e,_0x26614f?util[_0x4145('0x5')](_0x26614f,{'showHidden':![],'depth':null}):'');logger[_0x4145('0x4')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1abf4e,_0x26614f?_0x4145('0x12'):_0x4145('0x13'));return _0x556099(_0x26614f[_0x4145('0x11')][_0x4145('0x10')]?_0x26614f[_0x4145('0x11')][0x0]:null);})[_0x4145('0xb')](function(_0x2a2bda){logger[_0x4145('0x7')]('[utils][getVoiceQueueByName]',_0x2a2bda?util[_0x4145('0x5')](_0x2a2bda,{'showHidden':![],'depth':null}):'');return _0x556099(null);});}return _0x556099(null);});};exports['addTime']=function(_0x4a5b19,_0x58bbd2){return moment(_0x4a5b19)[_0x4145('0x1f')](_0x58bbd2,_0x4145('0x20'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x4145('0x21')]=function(_0x2dbfa9,_0x47a1aa){return moment(_0x2dbfa9)[_0x4145('0x22')](_0x47a1aa,_0x4145('0x20'))[_0x4145('0x23')](_0x4145('0x24'));};exports[_0x4145('0x25')]=function(_0x5c5895,_0x1b067f){return moment(_0x5c5895)[_0x4145('0x26')](moment(_0x1b067f),_0x4145('0x20'));};exports['sumTime']=function(_0x48d9c5,_0x4b77bf){return parseInt(_0x48d9c5,0xa)+parseInt(_0x4b77bf,0xa);};exports[_0x4145('0x27')]=function(){return moment()[_0x4145('0x23')](_0x4145('0x24'));};exports['isAfter']=function(_0x20a968,_0x45f2b5){if(_0x45f2b5){return moment(_0x20a968)[_0x4145('0x28')](_0x45f2b5);}return!![];};exports[_0x4145('0x29')]=function(_0x2ebd0f,_0x3a9002){if(_0x3a9002){return moment(_0x2ebd0f)[_0x4145('0x29')](_0x3a9002);}else if(_0x2ebd0f){return!![];}return![];}; \ No newline at end of file +var _0x9030=['seconds','format','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add'];(function(_0x4217f4,_0x3ce0ee){var _0x10a201=function(_0x1ac9ad){while(--_0x1ac9ad){_0x4217f4['push'](_0x4217f4['shift']());}};_0x10a201(++_0x3ce0ee);}(_0x9030,0x121));var _0x0903=function(_0xe5a154,_0x224294){_0xe5a154=_0xe5a154-0x0;var _0x3e4c8a=_0x9030[_0xe5a154];return _0x3e4c8a;};'use strict';var BPromise=require(_0x0903('0x0'));var jayson=require(_0x0903('0x1'));var moment=require(_0x0903('0x2'));var util=require(_0x0903('0x3'));var client=jayson['client'][_0x0903('0x4')]({'port':0x2329});var logger=require(_0x0903('0x5'))(_0x0903('0x6'));exports[_0x0903('0x7')]=function(_0x11866a,_0x8fe7f5){logger[_0x0903('0x7')](_0x11866a,_0x8fe7f5?util[_0x0903('0x8')](_0x8fe7f5,{'showHidden':![],'depth':null}):'');};exports[_0x0903('0x9')]=function(_0x2622d1,_0x57dc3b){logger[_0x0903('0x9')](_0x2622d1,_0x57dc3b?util['inspect'](_0x57dc3b,{'showHidden':![],'depth':null}):'');};exports[_0x0903('0xa')]=function(_0x21c14e,_0x56eaad){logger[_0x0903('0xa')](_0x21c14e,_0x56eaad?util[_0x0903('0x8')](_0x56eaad,{'showHidden':![],'depth':null}):'');};exports[_0x0903('0xb')]=function(_0x3f666a,_0x50e386){return client[_0x0903('0xb')](_0x3f666a,{'body':_0x50e386})[_0x0903('0xc')](function(_0x473d5c){logger['debug'](_0x0903('0xd'),_0x3f666a,_0x473d5c?util[_0x0903('0x8')](_0x473d5c,{'showHidden':![],'depth':null}):'');})[_0x0903('0xe')](function(_0x439d35){logger[_0x0903('0xa')](_0x0903('0xd'),_0x3f666a,_0x439d35?util['inspect'](_0x439d35,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1c65f1){return client[_0x0903('0xb')](_0x0903('0xf'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x0903('0x10')],'where':_0x1c65f1,'limit':0x1}})[_0x0903('0xc')](function(_0x487f05){logger['debug'](_0x0903('0x11'),JSON[_0x0903('0x12')](_0x1c65f1),_0x487f05?util[_0x0903('0x8')](_0x487f05,{'showHidden':![],'depth':null}):'');return _0x487f05[_0x0903('0x13')][_0x0903('0x14')]?_0x487f05[_0x0903('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x2a567c){return new BPromise(function(_0x5cfff5,_0x443e14){if(_0x2a567c){return getUser({'internal':_0x2a567c})['then'](function(_0xa45c16){logger['info'](_0x0903('0x15'),_0x2a567c,_0xa45c16?_0x0903('0x16'):_0x0903('0x17'));return _0x5cfff5(_0xa45c16);})[_0x0903('0xe')](function(_0x3f6a3a){logger[_0x0903('0xa')](_0x0903('0x18'),_0x3f6a3a?util[_0x0903('0x8')](_0x3f6a3a,{'showHidden':![],'depth':null}):'');return _0x5cfff5(null);});}return _0x5cfff5(null);});};exports[_0x0903('0x19')]=function(_0x3c2164){return new BPromise(function(_0x266634,_0x2e8e59){if(_0x3c2164){return getUser({'interface':_0x3c2164})['then'](function(_0x44f648){logger[_0x0903('0x7')](_0x0903('0x1a'),_0x3c2164,_0x44f648?_0x0903('0x16'):_0x0903('0x17'));return _0x266634(_0x44f648);})[_0x0903('0xe')](function(_0xeeb3e){logger[_0x0903('0xa')](_0x0903('0x1b'),_0xeeb3e?util['inspect'](_0xeeb3e,{'showHidden':![],'depth':null}):'');return _0x266634(null);});}return _0x266634(null);});};exports[_0x0903('0x1c')]=function(_0x3ab27a){return new BPromise(function(_0x4b9d87,_0x102666){if(_0x3ab27a){return getUser({'name':_0x3ab27a})[_0x0903('0xc')](function(_0x801fd6){logger[_0x0903('0x7')](_0x0903('0x1d'),_0x3ab27a,_0x801fd6?_0x0903('0x16'):_0x0903('0x17'));return _0x4b9d87(_0x801fd6);})[_0x0903('0xe')](function(_0x559a51){logger[_0x0903('0xa')]('[utils][getUserByName]',_0x559a51?util[_0x0903('0x8')](_0x559a51,{'showHidden':![],'depth':null}):'');return _0x4b9d87(null);});}return _0x4b9d87(null);});};exports[_0x0903('0x1e')]=function(_0x1e3752){return new BPromise(function(_0x11817c,_0x22b9c3){if(_0x1e3752){return client['request'](_0x0903('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x0903('0x20'),_0x0903('0x21'),_0x0903('0x22'),'acwTimeout'],'where':{'name':_0x1e3752},'limit':0x1}})[_0x0903('0xc')](function(_0x288e4d){logger[_0x0903('0x9')](_0x0903('0x23'),_0x1e3752,_0x288e4d?util['inspect'](_0x288e4d,{'showHidden':![],'depth':null}):'');logger[_0x0903('0x7')](_0x0903('0x24'),_0x1e3752,_0x288e4d?'found':_0x0903('0x17'));return _0x11817c(_0x288e4d[_0x0903('0x13')][_0x0903('0x14')]?_0x288e4d['result'][0x0]:null);})[_0x0903('0xe')](function(_0x179a25){logger[_0x0903('0xa')](_0x0903('0x25'),_0x179a25?util['inspect'](_0x179a25,{'showHidden':![],'depth':null}):'');return _0x11817c(null);});}return _0x11817c(null);});};exports[_0x0903('0x26')]=function(_0xabbf3f,_0xccaa03){return moment(_0xabbf3f)[_0x0903('0x27')](_0xccaa03,_0x0903('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x2f76a5,_0x3701b2){return moment(_0x2f76a5)['subtract'](_0x3701b2,_0x0903('0x28'))[_0x0903('0x29')](_0x0903('0x2a'));};exports['diffTime']=function(_0x557b9e,_0x3d31cc){return moment(_0x557b9e)[_0x0903('0x2b')](moment(_0x3d31cc),_0x0903('0x28'));};exports['sumTime']=function(_0x44e5cd,_0x7b4468){return parseInt(_0x44e5cd,0xa)+parseInt(_0x7b4468,0xa);};exports[_0x0903('0x2c')]=function(){return moment()[_0x0903('0x29')](_0x0903('0x2a'));};exports[_0x0903('0x2d')]=function(_0x553edb,_0x29593c){if(_0x29593c){return moment(_0x553edb)[_0x0903('0x2d')](_0x29593c);}return!![];};exports[_0x0903('0x2e')]=function(_0x5be2eb,_0x580442){if(_0x580442){return moment(_0x5be2eb)[_0x0903('0x2e')](_0x580442);}else if(_0x5be2eb){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 373dfdc..ac841d1 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d11=['./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','device','agent_id','statusCode','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d11,0x114));var _0x18d1=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x8d11[_0x18d631];return _0x50d708;};var fs=require(_0x18d1('0x0'));var _=require(_0x18d1('0x1'));var ewinston=require(_0x18d1('0x2'));var path=require(_0x18d1('0x3'));var util=require(_0x18d1('0x4'));var fileLogger=require('./loggers')[_0x18d1('0x5')];var safeTemplate=require(_0x18d1('0x6'))[_0x18d1('0x7')];var maskSensitiveData=require(_0x18d1('0x8'))[_0x18d1('0x9')];function ClientSideLogger(){function _0x4bbf04(_0x34a457){var _0x2d024a=path['join'](_0x18d1('0xa'),_0x18d1('0xb'),_0x18d1('0xc'));var _0x171b1c=path[_0x18d1('0xd')](_0x18d1('0xe'),_0x34a457[_0x18d1('0xf')]+'-'+_0x34a457[_0x18d1('0x10')]);return fs[_0x18d1('0x11')](path[_0x18d1('0xd')](_0x2d024a,_0x171b1c))[_0x18d1('0x12')](function(){var _0x542b01=fileLogger(_0x18d1('0xe'),path[_0x18d1('0xd')](_0x2d024a,_0x171b1c));return _0x542b01;})[_0x18d1('0x13')](function(_0x30b484){throw _0x30b484;});}this['log']=function(_0x7f95d8,_0x26ef49,_0x4fc670,_0x1cdc48){return _0x4bbf04(_0x7f95d8[_0x18d1('0x14')])[_0x18d1('0x12')](function(_0x12747b){var _0x53a3d1=_0x12747b[_0x26ef49];return _0x53a3d1;})[_0x18d1('0x12')](function(_0x27852a){var _0xf00c8d=_0x7f95d8['user']?_0x7f95d8[_0x18d1('0x14')]['id']:_0x18d1('0x15');var _0x455eca=_0x1cdc48[_0x18d1('0x16')];var _0x18c6f6=_0x1cdc48[_0x18d1('0x17')];var _0x35175e=new Date(Number(_0x18c6f6));return _0x27852a(_0xf00c8d,_0x35175e,_0x4fc670,_0x455eca);})[_0x18d1('0x13')](function(_0x4011bc){fileLogger(_0x18d1('0xe'))[_0x18d1('0x18')](_0x4011bc);});};}function setupLoggers(_0xbeafd8){return new Promise(function(_0x16081f){var _0x150c7c=new ClientSideLogger();var _0x1a0ad5=fileLogger(_0x18d1('0x19'));var _0x148798=fileLogger(_0x18d1('0x1a'));_0xbeafd8[_0x18d1('0x1b')](_0x18d1('0x1c'),_0x150c7c);_0xbeafd8['use'](ewinston[_0x18d1('0x1d')]({'winstonInstance':_0x1a0ad5,'meta':![],'statusLevels':!![],'msg':function(_0x3ff44f,_0x566bd4){var _0x5b4292='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x18d1('0x1e')](_0x3ff44f[_0x18d1('0x1f')])){_0x5b4292+=_0x18d1('0x20');var _0x17722f=_0x3ff44f[_0x18d1('0x1f')];maskSensitiveData(_0x17722f);}return safeTemplate(util[_0x18d1('0x21')](_0x5b4292,_0x3ff44f[_0x18d1('0x22')],_0x3ff44f[_0x18d1('0x23')][_0x18d1('0x24')]?_0x3ff44f[_0x18d1('0x23')]['x-forwarded-for']:_0x3ff44f[_0x18d1('0x25')][_0x18d1('0x26')]||_0x3ff44f['ip'],_0x3ff44f[_0x18d1('0x27')],_0x566bd4['statusCode'],_0x566bd4[_0x18d1('0x28')],_0x3ff44f[_0x18d1('0x14')]?_0x3ff44f[_0x18d1('0x14')]['id']:null,_0x3ff44f[_0x18d1('0x14')]?_0x3ff44f[_0x18d1('0x14')][_0x18d1('0x10')]:null,_0x3ff44f[_0x18d1('0x14')]?_0x3ff44f['user']['role']:null,_0x17722f?util['inspect'](_0x17722f,![],null):''));}}));_0xbeafd8['use'](ewinston[_0x18d1('0x1d')]({'winstonInstance':_0x148798,'meta':![],'statusLevels':!![],'msg':function(_0x378bd9,_0x326b47){var _0x509462='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x378bd9[_0x18d1('0x1f')]&&_0x378bd9[_0x18d1('0x1f')][_0x18d1('0x29')]&&_0x378bd9[_0x18d1('0x1f')][_0x18d1('0x2a')]){_0x509462='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x18d1('0x21')](_0x509462,_0x378bd9[_0x18d1('0x22')],_0x378bd9[_0x18d1('0x23')][_0x18d1('0x24')]?_0x378bd9[_0x18d1('0x23')][_0x18d1('0x24')]:_0x378bd9[_0x18d1('0x25')][_0x18d1('0x26')]||_0x378bd9['ip'],_0x378bd9[_0x18d1('0x27')],_0x326b47[_0x18d1('0x2b')],_0x326b47[_0x18d1('0x28')],_0x378bd9[_0x18d1('0x14')]?_0x378bd9[_0x18d1('0x14')]['id']:null,_0x378bd9[_0x18d1('0x14')]?_0x378bd9['user'][_0x18d1('0x10')]:null,_0x378bd9[_0x18d1('0x14')]?_0x378bd9[_0x18d1('0x14')]['role']:null,_0x378bd9[_0x18d1('0x1f')]&&_0x378bd9[_0x18d1('0x1f')]['device']?_0x378bd9[_0x18d1('0x1f')][_0x18d1('0x29')]:_0x18d1('0x2c'),_0x378bd9[_0x18d1('0x1f')]&&_0x378bd9['body'][_0x18d1('0x2a')]?_0x378bd9[_0x18d1('0x1f')][_0x18d1('0x2a')]:'',_0x378bd9['body']&&_0x378bd9[_0x18d1('0x1f')][_0x18d1('0x2d')]?_0x378bd9['body'][_0x18d1('0x2d')]:'');},'ignoreRoute':function(_0x1978af){var _0x1f00da=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1f00da['test'](_0x1978af['url']);}}));return _0x16081f();});}exports[_0x18d1('0x2e')]=setupLoggers; \ No newline at end of file +var _0x68b6=['name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','logger','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','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)','statusCode','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','./loggers','fileLogger','./safe-template','safeTemplate','join','/var','log','client'];(function(_0x49d8f3,_0x140341){var _0x11f8c5=function(_0x4fa8d4){while(--_0x4fa8d4){_0x49d8f3['push'](_0x49d8f3['shift']());}};_0x11f8c5(++_0x140341);}(_0x68b6,0x7c));var _0x668b=function(_0x5dcbf2,_0x37d117){_0x5dcbf2=_0x5dcbf2-0x0;var _0x22a0d7=_0x68b6[_0x5dcbf2];return _0x22a0d7;};var fs=require(_0x668b('0x0'));var _=require(_0x668b('0x1'));var ewinston=require(_0x668b('0x2'));var path=require('path');var util=require('util');var fileLogger=require(_0x668b('0x3'))[_0x668b('0x4')];var safeTemplate=require(_0x668b('0x5'))[_0x668b('0x6')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x3aa006(_0x2f6206){var _0x55738b=path[_0x668b('0x7')](_0x668b('0x8'),_0x668b('0x9'),'xcally');var _0x74b5ce=path[_0x668b('0x7')](_0x668b('0xa'),_0x2f6206['role']+'-'+_0x2f6206[_0x668b('0xb')]);return fs[_0x668b('0xc')](path[_0x668b('0x7')](_0x55738b,_0x74b5ce))[_0x668b('0xd')](function(){var _0x617042=fileLogger(_0x668b('0xa'),path[_0x668b('0x7')](_0x55738b,_0x74b5ce));return _0x617042;})[_0x668b('0xe')](function(_0x490b70){throw _0x490b70;});}this[_0x668b('0x9')]=function(_0x57f55e,_0x44181d,_0x8986e0,_0x46e4df){return _0x3aa006(_0x57f55e['user'])['then'](function(_0x110c7e){var _0x3ae799=_0x110c7e[_0x44181d];return _0x3ae799;})['then'](function(_0x13ebc3){var _0x31abff=_0x57f55e[_0x668b('0xf')]?_0x57f55e[_0x668b('0xf')]['id']:_0x668b('0x10');var _0x182dd0=_0x46e4df[_0x668b('0x11')];var _0x4afa9c=_0x46e4df[_0x668b('0x12')];var _0x2b46c8=new Date(Number(_0x4afa9c));return _0x13ebc3(_0x31abff,_0x2b46c8,_0x8986e0,_0x182dd0);})[_0x668b('0xe')](function(_0xd60a99){fileLogger(_0x668b('0xa'))[_0x668b('0x13')](_0xd60a99);});};}function setupLoggers(_0x670cce){return new Promise(function(_0x410ba4){var _0x5eaf8a=new ClientSideLogger();var _0x1384a3=fileLogger(_0x668b('0x14'));var _0x6d2207=fileLogger(_0x668b('0x15'));_0x670cce[_0x668b('0x16')]('client-side-logger',_0x5eaf8a);_0x670cce['use'](ewinston[_0x668b('0x17')]({'winstonInstance':_0x1384a3,'meta':![],'statusLevels':!![],'msg':function(_0x35303f,_0x45a4cb){var _0x5698e2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x668b('0x18')](_0x35303f[_0x668b('0x19')])){_0x5698e2+='\x20body=%s';var _0x49ac97=_0x35303f[_0x668b('0x19')];maskSensitiveData(_0x49ac97);}return safeTemplate(util[_0x668b('0x1a')](_0x5698e2,_0x35303f[_0x668b('0x1b')],_0x35303f[_0x668b('0x1c')][_0x668b('0x1d')]?_0x35303f[_0x668b('0x1c')][_0x668b('0x1d')]:_0x35303f[_0x668b('0x1e')][_0x668b('0x1f')]||_0x35303f['ip'],_0x35303f[_0x668b('0x20')],_0x45a4cb['statusCode'],_0x45a4cb[_0x668b('0x21')],_0x35303f['user']?_0x35303f[_0x668b('0xf')]['id']:null,_0x35303f[_0x668b('0xf')]?_0x35303f[_0x668b('0xf')][_0x668b('0xb')]:null,_0x35303f['user']?_0x35303f[_0x668b('0xf')][_0x668b('0x22')]:null,_0x49ac97?util[_0x668b('0x23')](_0x49ac97,![],null):''));}}));_0x670cce[_0x668b('0x24')](ewinston[_0x668b('0x17')]({'winstonInstance':_0x6d2207,'meta':![],'statusLevels':!![],'msg':function(_0x274701,_0x3cead4){var _0x118ba9=_0x668b('0x25');if(_0x274701[_0x668b('0x19')]&&_0x274701[_0x668b('0x19')][_0x668b('0x26')]&&_0x274701['body'][_0x668b('0x27')]){_0x118ba9=_0x668b('0x28');}return util[_0x668b('0x1a')](_0x118ba9,_0x274701[_0x668b('0x1b')],_0x274701[_0x668b('0x1c')][_0x668b('0x1d')]?_0x274701[_0x668b('0x1c')]['x-forwarded-for']:_0x274701[_0x668b('0x1e')][_0x668b('0x1f')]||_0x274701['ip'],_0x274701[_0x668b('0x20')],_0x3cead4[_0x668b('0x29')],_0x3cead4[_0x668b('0x21')],_0x274701[_0x668b('0xf')]?_0x274701[_0x668b('0xf')]['id']:null,_0x274701[_0x668b('0xf')]?_0x274701[_0x668b('0xf')][_0x668b('0xb')]:null,_0x274701['user']?_0x274701[_0x668b('0xf')][_0x668b('0x22')]:null,_0x274701[_0x668b('0x19')]&&_0x274701[_0x668b('0x19')][_0x668b('0x26')]?_0x274701[_0x668b('0x19')][_0x668b('0x26')]:'other',_0x274701['body']&&_0x274701[_0x668b('0x19')][_0x668b('0x27')]?_0x274701['body']['agent_id']:'',_0x274701[_0x668b('0x19')]&&_0x274701['body']['agent_name']?_0x274701[_0x668b('0x19')][_0x668b('0x2a')]:'');},'ignoreRoute':function(_0x29f2d1){var _0x46a07c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46a07c[_0x668b('0x2b')](_0x29f2d1[_0x668b('0x20')]);}}));return _0x410ba4();});}exports[_0x668b('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ad45c16..06d9bef 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x377f=['gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Console','warn','Logger','transports','File','error','%s-%s','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green'];(function(_0x365bf1,_0x2e657a){var _0x132121=function(_0x3b0ba8){while(--_0x3b0ba8){_0x365bf1['push'](_0x365bf1['shift']());}};_0x132121(++_0x2e657a);}(_0x377f,0x1b7));var _0xf377=function(_0x2503c8,_0x28da29){_0x2503c8=_0x2503c8-0x0;var _0x197b20=_0x377f[_0x2503c8];return _0x197b20;};'use strict';var path=require(_0xf377('0x0'));var util=require(_0xf377('0x1'));var moment=require(_0xf377('0x2'));var winston=require(_0xf377('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0xf377('0x4')][_0xf377('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xf377('0x6'),'error':_0xf377('0x7'),'warn':_0xf377('0x8'),'info':_0xf377('0x9'),'print':_0xf377('0xa'),'success':_0xf377('0xb'),'http':_0xf377('0xc'),'verbose':'bold\x20magenta','debug':_0xf377('0xd'),'silly':_0xf377('0xe')};winston[_0xf377('0xf')](XC_LOG_COLORS);function getLogFileName(_0x419fb2,_0x4bc66a,_0x49ab45){var _0x26b1e8=_0x419fb2||_0xf377('0x10');return path[_0xf377('0x11')](_0x26b1e8,util['format'](_0xf377('0x12'),_0x4bc66a,_0x49ab45));}function formatter(_0x6ac244,_0x15e5e6){_0x15e5e6[_0xf377('0x13')]=_0x15e5e6['message']['replace'](/@@{/g,'{{{')[_0xf377('0x14')](/}@@/g,_0xf377('0x15'))['replace'](/@{/g,'{{')[_0xf377('0x14')](/}@/g,'}}');return util[_0xf377('0x16')](_0xf377('0x17'),moment()['format'](_0xf377('0x18')),_0x15e5e6[_0xf377('0x19')][_0xf377('0x1a')](),_0x6ac244,_0x15e5e6['message']);}function fileFormat(_0x43fd36,_0x4f28fe){_0x4f28fe[_0xf377('0x13')]=_0x4f28fe[_0xf377('0x13')][_0xf377('0x14')](/@@{/g,_0xf377('0x1b'))['replace'](/}@@/g,_0xf377('0x15'))[_0xf377('0x14')](/@{/g,'{{')[_0xf377('0x14')](/}@/g,'}}');var _0x141f8d=_0x4f28fe[_0xf377('0x1c')]&&Object['keys'](_0x4f28fe[_0xf377('0x1c')])[_0xf377('0x1d')]?'\x0a\x09'+JSON[_0xf377('0x1e')](_0x4f28fe[_0xf377('0x1c')]):'';return util[_0xf377('0x16')](_0xf377('0x1f'),moment()[_0xf377('0x16')](_0xf377('0x18')),_0x4f28fe['level'][_0xf377('0x1a')](),_0x43fd36,_0x4f28fe[_0xf377('0x13')],_0x141f8d);}function consoleLogger(){var _0x12e81b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf377('0x20'))]({'level':_0xf377('0x21'),'json':![],'formatter':function(_0xbc579f){return formatter('',_0xbc579f);}})]});return _0x12e81b;}function fileLogger(_0x45ebdf,_0x475dc4){var _0x51dce4=new winston[(_0xf377('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf377('0x23'))][(_0xf377('0x24'))]({'name':util['format']('%s-%s',_0x45ebdf,'error'),'filename':getLogFileName(_0x475dc4,_0x45ebdf,_0xf377('0x25')),'level':_0xf377('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51b69e){return fileFormat(_0x45ebdf,_0x51b69e);}}),new winston['transports'][(_0xf377('0x24'))]({'name':util[_0xf377('0x16')](_0xf377('0x26'),_0x45ebdf,debugLevel),'filename':getLogFileName(_0x475dc4,_0x45ebdf,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3e31c5){return fileFormat(_0x45ebdf,_0x3e31c5);}}),new winston[(_0xf377('0x23'))][(_0xf377('0x20'))]({'level':'warn','json':![],'formatter':function(_0x354b3e){return fileFormat(_0x45ebdf,_0x354b3e);}})]});return _0x51dce4;}exports[_0xf377('0x27')]=consoleLogger;exports[_0xf377('0x28')]=fileLogger; \ No newline at end of file +var _0x8004=['level','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','path','moment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e5ae7,_0x3dbb98){var _0x2e0a00=function(_0x9361aa){while(--_0x9361aa){_0x3e5ae7['push'](_0x3e5ae7['shift']());}};_0x2e0a00(++_0x3dbb98);}(_0x8004,0x113));var _0x4800=function(_0x3f68cd,_0xbff477){_0x3f68cd=_0x3f68cd-0x0;var _0x33637a=_0x8004[_0x3f68cd];return _0x33637a;};'use strict';var path=require(_0x4800('0x0'));var util=require('util');var moment=require(_0x4800('0x1'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x4800('0x2')]?config[_0x4800('0x2')][_0x4800('0x3')]():_0x4800('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x4800('0x5'),'error':_0x4800('0x6'),'warn':'bold\x20yellow','info':_0x4800('0x7'),'print':'bold\x20white','success':_0x4800('0x8'),'http':_0x4800('0x9'),'verbose':_0x4800('0xa'),'debug':_0x4800('0xb'),'silly':_0x4800('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x61616a,_0x35b669,_0x506a2e){var _0x582610=_0x61616a||_0x4800('0xd');return path['join'](_0x582610,util[_0x4800('0xe')](_0x4800('0xf'),_0x35b669,_0x506a2e));}function formatter(_0x5934b5,_0x132e55){_0x132e55[_0x4800('0x10')]=_0x132e55[_0x4800('0x10')][_0x4800('0x11')](/@@{/g,'{{{')['replace'](/}@@/g,_0x4800('0x12'))[_0x4800('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x4800('0xe')](_0x4800('0x13'),moment()[_0x4800('0xe')](_0x4800('0x14')),_0x132e55[_0x4800('0x15')][_0x4800('0x16')](),_0x5934b5,_0x132e55[_0x4800('0x10')]);}function fileFormat(_0xcc53e2,_0x4e0af7){_0x4e0af7['message']=_0x4e0af7['message'][_0x4800('0x11')](/@@{/g,_0x4800('0x17'))['replace'](/}@@/g,_0x4800('0x12'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x4d88e0=_0x4e0af7[_0x4800('0x18')]&&Object[_0x4800('0x19')](_0x4e0af7['meta'])[_0x4800('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x4e0af7['meta']):'';return util[_0x4800('0xe')](_0x4800('0x1b'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x4e0af7[_0x4800('0x15')][_0x4800('0x16')](),_0xcc53e2,_0x4e0af7[_0x4800('0x10')],_0x4d88e0);}function consoleLogger(){var _0x2fe964=new winston[(_0x4800('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4800('0x1d'))][(_0x4800('0x1e'))]({'level':_0x4800('0x1f'),'json':![],'formatter':function(_0x15de82){return formatter('',_0x15de82);}})]});return _0x2fe964;}function fileLogger(_0x18c2e9,_0x34d05b){var _0x15546b=new winston[(_0x4800('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4800('0x1d'))]['File']({'name':util[_0x4800('0xe')](_0x4800('0x20'),_0x18c2e9,_0x4800('0x21')),'filename':getLogFileName(_0x34d05b,_0x18c2e9,_0x4800('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x11d39a){return fileFormat(_0x18c2e9,_0x11d39a);}}),new winston['transports'][(_0x4800('0x22'))]({'name':util['format'](_0x4800('0x20'),_0x18c2e9,debugLevel),'filename':getLogFileName(_0x34d05b,_0x18c2e9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x33ee9e){return fileFormat(_0x18c2e9,_0x33ee9e);}}),new winston[(_0x4800('0x1d'))]['Console']({'level':_0x4800('0x1f'),'json':![],'formatter':function(_0x5a5601){return fileFormat(_0x18c2e9,_0x5a5601);}})]});return _0x15546b;}exports[_0x4800('0x23')]=consoleLogger;exports[_0x4800('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7dfcb29..926e687 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x3c7a7b,_0x12a673){var _0x27980c=function(_0x5bfafe){while(--_0x5bfafe){_0x3c7a7b['push'](_0x3c7a7b['shift']());}};_0x27980c(++_0x12a673);}(_0xadb5,0xad));var _0x5adb=function(_0x3b64ce,_0x426ed4){_0x3b64ce=_0x3b64ce-0x0;var _0x8a3d12=_0xadb5[_0x3b64ce];return _0x8a3d12;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x136c4b,_0x213d0d){var _0x401f49=function(_0x46c8d5){while(--_0x46c8d5){_0x136c4b['push'](_0x136c4b['shift']());}};_0x401f49(++_0x213d0d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0x0b0e[_0x17dcd1];return _0x12af77;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ce770ec..6c2a63c 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x5ccd0d,_0x218a95){var _0xbddf3e=function(_0x45488c){while(--_0x45488c){_0x5ccd0d['push'](_0x5ccd0d['shift']());}};_0xbddf3e(++_0x218a95);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};var _=require(_0xf0ab('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4d04cc){return _0x4d04cc==='{{'?_0xf0ab('0x1'):_0xf0ab('0x2');}function safeTemplate(_0x528ef7){var _0x598001=_0x528ef7;if(typeof _0x528ef7===_0xf0ab('0x3')){_0x598001=_0x528ef7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf0ab('0x4')](_0x528ef7)){_0x598001=_0x528ef7[_0xf0ab('0x5')](function(_0x2efe43){return safeTemplate(_0x2efe43);});}else if(_[_0xf0ab('0x6')](_0x528ef7)){_0x598001=Object[_0xf0ab('0x7')](_0x528ef7)[_0xf0ab('0x8')](function(_0x233afe,_0x57ff3b){_0x233afe[_0x57ff3b]=safeTemplate(_0x528ef7[_0x57ff3b]);return _0x233afe;},{});}return _0x598001;}module[_0xf0ab('0x9')][_0xf0ab('0xa')]=safeTemplate; \ No newline at end of file +var _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x33db9f,_0x1e6ae4){var _0x52df2d=function(_0x42cf82){while(--_0x42cf82){_0x33db9f['push'](_0x33db9f['shift']());}};_0x52df2d(++_0x1e6ae4);}(_0x4024,0x89));var _0x4402=function(_0x45de10,_0x59f7f9){_0x45de10=_0x45de10-0x0;var _0x3c4712=_0x4024[_0x45de10];return _0x3c4712;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file -- 1.7.1